mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 03:56:16 +00:00
Merge branch 'main' into fix-quote-table
This commit is contained in:
commit
aa801048dd
2
.github/workflows/e2e.yml
vendored
2
.github/workflows/e2e.yml
vendored
@ -419,6 +419,8 @@ jobs:
|
||||
- plugin-workflow
|
||||
- plugin-workflow-approval
|
||||
- plugin-data-source-main
|
||||
permissions:
|
||||
pull-requests: write
|
||||
if: ${{ !cancelled() && github.event.pull_request.number }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
@ -69,7 +69,7 @@ const PreviewCom = (props) => {
|
||||
};
|
||||
});
|
||||
const children = collection.fields
|
||||
.filter((v) => !['hasOne', 'hasMany', 'belongsToMany'].includes(v?.type))
|
||||
.filter((v) => !['obo', 'oho', 'm2m', 'o2m'].includes(v?.interface))
|
||||
?.map((v) => {
|
||||
return { value: v.name, key: v.name, label: t(v.uiSchema?.title || v.name) };
|
||||
})
|
||||
|
@ -68,11 +68,12 @@ const useSourceFieldsOptions = () => {
|
||||
return;
|
||||
}
|
||||
const children = (collection.fields as FieldOptions[])
|
||||
.filter((v) => !['hasOne', 'hasMany', 'belongsToMany'].includes(v?.type))
|
||||
.filter((v) => {
|
||||
return !['hasOne', 'hasMany', 'belongsToMany', 'belongsTo'].includes(v?.type);
|
||||
})
|
||||
?.map((v) => {
|
||||
return { value: v.name, label: t(v.uiSchema?.title) };
|
||||
});
|
||||
|
||||
data.push({
|
||||
value: item,
|
||||
label: t(collection.title),
|
||||
@ -110,7 +111,6 @@ export const FieldsConfigure = observer(
|
||||
[compile],
|
||||
);
|
||||
const sourceFieldsOptions = useSourceFieldsOptions();
|
||||
|
||||
const refGetInterface = useRef(getInterface);
|
||||
useEffect(() => {
|
||||
const fieldsMp = new Map();
|
||||
|
@ -13,7 +13,7 @@ import { isEqual } from 'lodash';
|
||||
import { useCallback, useEffect, useMemo } from 'react';
|
||||
import { useTableBlockContext } from '../../../../../block-provider/TableBlockProvider';
|
||||
import { findFilterTargets } from '../../../../../block-provider/hooks';
|
||||
import { useFilterBlock } from '../../../../../filter-provider/FilterProvider';
|
||||
import { DataBlock, useFilterBlock } from '../../../../../filter-provider/FilterProvider';
|
||||
import { mergeFilter } from '../../../../../filter-provider/utils';
|
||||
import { removeNullCondition } from '../../../../../schema-component';
|
||||
|
||||
@ -103,12 +103,17 @@ export const useTableBlockProps = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
const value = [record[ctx.rowKey]];
|
||||
const currentBlock = dataBlocks.find((block) => block.uid === fieldSchema.parent['x-uid']);
|
||||
|
||||
dataBlocks.forEach((block) => {
|
||||
const target = targets.find((target) => target.uid === block.uid);
|
||||
if (!target) return;
|
||||
|
||||
const isForeignKey = block.foreignKeyFields?.some((field) => field.name === target.field);
|
||||
const sourceKey = getSourceKey(currentBlock, target.field);
|
||||
const recordKey = isForeignKey ? sourceKey : ctx.rowKey;
|
||||
const value = [record[recordKey]];
|
||||
|
||||
const param = block.service.params?.[0] || {};
|
||||
// 保留原有的 filter
|
||||
const storedFilter = block.service.params?.[1]?.filters || {};
|
||||
@ -146,7 +151,7 @@ export const useTableBlockProps = () => {
|
||||
});
|
||||
|
||||
// 更新表格的选中状态
|
||||
setSelectedRow((prev) => (prev?.includes(record[ctx.rowKey]) ? [] : [...value]));
|
||||
setSelectedRow((prev) => (prev?.includes(record[ctx.rowKey]) ? [] : [record[ctx.rowKey]]));
|
||||
},
|
||||
[ctx.rowKey, fieldSchema, getDataBlocks],
|
||||
),
|
||||
@ -155,3 +160,8 @@ export const useTableBlockProps = () => {
|
||||
}, []),
|
||||
};
|
||||
};
|
||||
|
||||
function getSourceKey(currentBlock: DataBlock, field: string) {
|
||||
const associationField = currentBlock?.associatedFields?.find((item) => item.foreignKey === field);
|
||||
return associationField?.sourceKey || 'id';
|
||||
}
|
||||
|
@ -362,9 +362,10 @@ export const selectComponentFieldSettings = new SchemaSettings({
|
||||
{
|
||||
...allowMultiple,
|
||||
useVisible() {
|
||||
const isFieldReadPretty = useIsFieldReadPretty();
|
||||
const isAssociationField = useIsAssociationField();
|
||||
const IsShowMultipleSwitch = useIsShowMultipleSwitch();
|
||||
return isAssociationField && IsShowMultipleSwitch();
|
||||
return !isFieldReadPretty && isAssociationField && IsShowMultipleSwitch();
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -127,7 +127,7 @@ const InternalAssociationSelect = observer(
|
||||
};
|
||||
return (
|
||||
<div key={fieldSchema.name}>
|
||||
<Space.Compact style={{ display: 'flex', lineHeight: '32px' }}>
|
||||
<Space.Compact style={{ display: 'flex' }}>
|
||||
<RemoteSelect
|
||||
style={{ width: '100%' }}
|
||||
{...rest}
|
||||
|
@ -121,7 +121,7 @@ const getChildren = (
|
||||
): Option[] => {
|
||||
const result = options
|
||||
.map((option): Option => {
|
||||
if (!option.target) {
|
||||
if (!option.target || option.target === 'chinaRegions') {
|
||||
return {
|
||||
key: option.name,
|
||||
value: option.name,
|
||||
|
@ -7,14 +7,14 @@
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
import { Model } from './model';
|
||||
import { isPlainObject } from '@nocobase/utils';
|
||||
import { Model as SequelizeModel } from 'sequelize';
|
||||
import { Collection } from './collection';
|
||||
import Database from './database';
|
||||
import { InheritedSyncRunner } from './inherited-sync-runner';
|
||||
import { InheritedCollection } from './inherited-collection';
|
||||
import { Model as SequelizeModel } from 'sequelize';
|
||||
import { ZeroColumnTableError } from './errors/zero-column-table-error';
|
||||
import { isPlainObject } from '@nocobase/utils';
|
||||
import { InheritedCollection } from './inherited-collection';
|
||||
import { InheritedSyncRunner } from './inherited-sync-runner';
|
||||
import { Model } from './model';
|
||||
|
||||
export class SyncRunner {
|
||||
private readonly collection: Collection;
|
||||
@ -74,14 +74,17 @@ export class SyncRunner {
|
||||
throw e;
|
||||
}
|
||||
|
||||
let beforeColumns;
|
||||
|
||||
try {
|
||||
const beforeColumns = await this.queryInterface.describeTable(this.tableName, options);
|
||||
beforeColumns = await this.queryInterface.describeTable(this.tableName, options);
|
||||
} catch (error) {
|
||||
// continue
|
||||
}
|
||||
|
||||
if (beforeColumns) {
|
||||
await this.handlePrimaryKeyBeforeSync(beforeColumns, options);
|
||||
await this.handleUniqueFieldBeforeSync(beforeColumns, options);
|
||||
} catch (e) {
|
||||
if (!e.message.includes('No description found')) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
const syncResult = await this.performSync(options);
|
||||
|
@ -69,7 +69,8 @@ test('menu permission ', async ({ page, mockPage, mockRole, updateRole }) => {
|
||||
expect(page.url()).toContain(uid2);
|
||||
});
|
||||
|
||||
test('i18n should not fallbackNS', async ({ page }) => {
|
||||
// TODO: this is not stable
|
||||
test.skip('i18n should not fallbackNS', async ({ page }) => {
|
||||
await page.goto('/admin/settings/system-settings');
|
||||
|
||||
// 创建 Users 页面
|
||||
|
Loading…
Reference in New Issue
Block a user