From ff1877ce014df5272dcf13cb4167eb93a0a70d30 Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Wed, 13 Mar 2024 12:59:20 +0800 Subject: [PATCH 01/15] fix: radio (#3701) --- packages/core/client/src/schema-component/antd/radio/Radio.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/client/src/schema-component/antd/radio/Radio.tsx b/packages/core/client/src/schema-component/antd/radio/Radio.tsx index 7ff5cf6e8..d34cae02a 100644 --- a/packages/core/client/src/schema-component/antd/radio/Radio.tsx +++ b/packages/core/client/src/schema-component/antd/radio/Radio.tsx @@ -40,10 +40,11 @@ Radio.Group = connect( const field = useField(); const collectionField = useCollectionField(); const dataSource = field.dataSource || collectionField?.uiSchema.enum || []; + const val = value ? props.value.toString() : value; return (
{dataSource - .filter((option) => option.value === value) + .filter((option) => option.value === val) .map((option, key) => ( {option.label} From 61a290117fd3aab61975e6387ca2af108b4cbbd3 Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Wed, 13 Mar 2024 15:21:35 +0800 Subject: [PATCH 02/15] fix: field configuration of Kanban interacts with other block (#3689) --- packages/core/client/src/schema-initializer/utils.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/core/client/src/schema-initializer/utils.ts b/packages/core/client/src/schema-initializer/utils.ts index 2704ff435..5640e698b 100644 --- a/packages/core/client/src/schema-initializer/utils.ts +++ b/packages/core/client/src/schema-initializer/utils.ts @@ -728,8 +728,7 @@ export const useCurrentSchema = (action: string, key: string, find = findSchema, const { removeActiveFieldName } = useFormActiveFields() || {}; const { form }: { form: Form } = useFormBlockContext(); let fieldSchema = useFieldSchema(); - - if (!fieldSchema?.['x-initializer']) { + if (!fieldSchema?.['x-initializer'] && fieldSchema?.['x-decorator'] === 'FormItem') { const recursiveInitializerSchema = recursiveParent(fieldSchema); if (recursiveInitializerSchema) { fieldSchema = recursiveInitializerSchema; From 0123a3320bf1f2344e8610080f3bf300883676d5 Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Wed, 13 Mar 2024 15:22:40 +0800 Subject: [PATCH 03/15] fix: select fieldnames (#3704) --- .../core/client/src/schema-component/antd/select/Select.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/client/src/schema-component/antd/select/Select.tsx b/packages/core/client/src/schema-component/antd/select/Select.tsx index 9207a1bc7..3d9784817 100644 --- a/packages/core/client/src/schema-component/antd/select/Select.tsx +++ b/packages/core/client/src/schema-component/antd/select/Select.tsx @@ -122,7 +122,7 @@ const InternalSelect = connect( } return undefined; } - return v ? v.toString() : v; + return v; }; return ( Date: Wed, 13 Mar 2024 16:17:18 +0800 Subject: [PATCH 04/15] fix: get async json schema (#3705) * fix: get async json schema * fix: test --- .../__tests__/ui-schema-repository.test.ts | 24 ++++++++++++++++++- .../src/server/repository.ts | 6 +++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/packages/plugins/@nocobase/plugin-ui-schema-storage/src/server/__tests__/ui-schema-repository.test.ts b/packages/plugins/@nocobase/plugin-ui-schema-storage/src/server/__tests__/ui-schema-repository.test.ts index 580366b63..00a6aae25 100644 --- a/packages/plugins/@nocobase/plugin-ui-schema-storage/src/server/__tests__/ui-schema-repository.test.ts +++ b/packages/plugins/@nocobase/plugin-ui-schema-storage/src/server/__tests__/ui-schema-repository.test.ts @@ -1,5 +1,5 @@ import { Collection, Database } from '@nocobase/database'; -import { MockServer, createMockServer } from '@nocobase/test'; +import { createMockServer, MockServer } from '@nocobase/test'; import { SchemaNode } from '../dao/ui_schema_node_dao'; import UiSchemaRepository from '../repository'; @@ -387,6 +387,28 @@ describe('ui_schema repository', () => { expect(schema).toBeDefined(); }); + it('should get root async json schema', async () => { + await repository.insert({ + 'x-uid': 'n1', + async: true, + name: 'a', + type: 'object', + properties: { + b: { + 'x-uid': 'n2', + type: 'object', + properties: { + c: { 'x-uid': 'n3' }, + }, + }, + d: { 'x-uid': 'n4' }, + }, + }); + + const schema = await repository.getJsonSchema('n1'); + expect(schema).toBeDefined(); + }); + it('should getProperties', async () => { await repository.insert(schema); const rootNode = await repository.findOne({ diff --git a/packages/plugins/@nocobase/plugin-ui-schema-storage/src/server/repository.ts b/packages/plugins/@nocobase/plugin-ui-schema-storage/src/server/repository.ts index 2fc2a9e07..7b7f5cf71 100644 --- a/packages/plugins/@nocobase/plugin-ui-schema-storage/src/server/repository.ts +++ b/packages/plugins/@nocobase/plugin-ui-schema-storage/src/server/repository.ts @@ -1013,7 +1013,7 @@ WHERE TreeTable.depth = 1 AND TreeTable.ancestor = :ancestor and TreeTable.sort LEFT JOIN ${this.uiSchemasTableName} as "SchemaTable" ON "SchemaTable"."x-uid" = TreePath.descendant LEFT JOIN ${this.uiSchemaTreePathTableName} as NodeInfo ON NodeInfo.descendant = "SchemaTable"."x-uid" and NodeInfo.descendant = NodeInfo.ancestor and NodeInfo.depth = 0 LEFT JOIN ${this.uiSchemaTreePathTableName} as ParentPath ON (ParentPath.descendant = "SchemaTable"."x-uid" AND ParentPath.depth = 1) - WHERE TreePath.ancestor = :ancestor AND (NodeInfo.async = false or TreePath.depth = 1)`; + WHERE TreePath.ancestor = :ancestor AND (NodeInfo.async = false or TreePath.depth <= 1)`; const nodes = await db.sequelize.query(this.sqlAdapter(rawSql), { replacements: { @@ -1043,7 +1043,9 @@ WHERE TreeTable.depth = 1 AND TreeTable.ancestor = :ancestor and TreeTable.sort LEFT JOIN ${this.uiSchemasTableName} as "SchemaTable" ON "SchemaTable"."x-uid" = TreePath.descendant LEFT JOIN ${treeTable} as NodeInfo ON NodeInfo.descendant = "SchemaTable"."x-uid" and NodeInfo.descendant = NodeInfo.ancestor and NodeInfo.depth = 0 LEFT JOIN ${treeTable} as ParentPath ON (ParentPath.descendant = "SchemaTable"."x-uid" AND ParentPath.depth = 1) - WHERE TreePath.ancestor = :ancestor ${options?.includeAsyncNode ? '' : 'AND (NodeInfo.async != true )'} + WHERE TreePath.ancestor = :ancestor ${ + options?.includeAsyncNode ? '' : 'AND (NodeInfo.async != true or TreePath.depth = 0)' + } `; const nodes = await db.sequelize.query(this.sqlAdapter(rawSql), { From 0779a4eab37098a6f7c71f77eef0b32bcb8a80b1 Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Wed, 13 Mar 2024 16:44:17 +0800 Subject: [PATCH 05/15] refactor(radio): radio support multiple field types (#3706) * style: fieldTitleInput style improve * refactor: radio support mutiple type * refactor: code improve --- .../antd/date-picker/DatePicker.tsx | 1 - .../src/schema-component/antd/radio/Radio.tsx | 14 +++++++++----- .../components/FieldTitleInput.tsx | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/date-picker/DatePicker.tsx b/packages/core/client/src/schema-component/antd/date-picker/DatePicker.tsx index 6430eddb6..60dfe93bf 100644 --- a/packages/core/client/src/schema-component/antd/date-picker/DatePicker.tsx +++ b/packages/core/client/src/schema-component/antd/date-picker/DatePicker.tsx @@ -38,7 +38,6 @@ const InternalRangePicker = connect( export const DatePicker = (props) => { const { utc = true } = useDatePickerContext(); const value = Array.isArray(props.value) ? props.value[0] : props.value; - console.log(value); props = { utc, ...props }; return ; }; diff --git a/packages/core/client/src/schema-component/antd/radio/Radio.tsx b/packages/core/client/src/schema-component/antd/radio/Radio.tsx index d34cae02a..e59deacd5 100644 --- a/packages/core/client/src/schema-component/antd/radio/Radio.tsx +++ b/packages/core/client/src/schema-component/antd/radio/Radio.tsx @@ -2,7 +2,7 @@ import { connect, mapProps, mapReadPretty, useField } from '@formily/react'; import { isValid } from '@formily/shared'; import { Radio as AntdRadio, Tag } from 'antd'; import type { RadioGroupProps, RadioProps } from 'antd/es/radio'; -import React from 'react'; +import React, { useState, useEffect } from 'react'; import { useCollectionField } from '../../../data-source/collection-field/CollectionFieldProvider'; type ComposedRadio = React.FC & { @@ -25,10 +25,15 @@ Radio.Group = connect( { dataSource: 'options', }, - (props) => { + (props: any, field: any) => { + useEffect(() => { + const defaultOption = field.dataSource?.find((option) => option.value == props.value); + if (defaultOption) { + field.setValue(defaultOption.value); + } + }, [props.value, field.dataSource]); return { ...props, - value: props.value && typeof props.value !== 'boolean' ? props.value.toString() : props.value, }; }, ), @@ -40,11 +45,10 @@ Radio.Group = connect( const field = useField(); const collectionField = useCollectionField(); const dataSource = field.dataSource || collectionField?.uiSchema.enum || []; - const val = value ? props.value.toString() : value; return (
{dataSource - .filter((option) => option.value === val) + .filter((option) => option.value == value) .map((option, key) => ( {option.label} diff --git a/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/CollectionsManager/components/FieldTitleInput.tsx b/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/CollectionsManager/components/FieldTitleInput.tsx index fe1f6a297..c29935c9c 100644 --- a/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/CollectionsManager/components/FieldTitleInput.tsx +++ b/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/CollectionsManager/components/FieldTitleInput.tsx @@ -38,7 +38,7 @@ export const FieldTitleInput = observer( useEffect(() => { setTitleValue(value); }, [value]); - return ; + return ; }, { displayName: 'FieldTitleInput' }, ); From e5c1bef8de6f9d57ee0f79fd01a5f9377cf619d0 Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Wed, 13 Mar 2024 19:00:28 +0800 Subject: [PATCH 06/15] fix(client): size undefined in nanoid (#3708) * fix(data-source): foreignkey * fix: size undefined in nanoid --- .../schema-component/antd/nanoIDInput/NanoIDInput.tsx | 10 +++++----- .../component/CollectionsManager/components/index.tsx | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/nanoIDInput/NanoIDInput.tsx b/packages/core/client/src/schema-component/antd/nanoIDInput/NanoIDInput.tsx index 648cb411e..48deba759 100644 --- a/packages/core/client/src/schema-component/antd/nanoIDInput/NanoIDInput.tsx +++ b/packages/core/client/src/schema-component/antd/nanoIDInput/NanoIDInput.tsx @@ -11,22 +11,22 @@ export const NanoIDInput = Object.assign( connect( AntdInput, mapProps((props: any, field: any) => { - const { size, customAlphabet } = useCollectionField(); + const { size, customAlphabet } = useCollectionField() || {}; const { t } = useTranslation(); const form = useForm(); function isValidNanoid(value) { - if (value.length !== size) { - return t('Field value size is') + ` ${size}`; + if (value?.length !== size) { + return t('Field value size is') + ` ${size || 21}`; } for (let i = 0; i < value.length; i++) { - if (customAlphabet.indexOf(value[i]) === -1) { + if (customAlphabet?.indexOf(value[i]) === -1) { return t(`Field value do not meet the requirements`); } } } useEffect(() => { - if (!field.initialValue) { + if (!field.initialValue && customAlphabet) { field.setInitialValue(Alphabet(customAlphabet, size)()); } form.setFieldState(field.props.name, (state) => { diff --git a/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/CollectionsManager/components/index.tsx b/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/CollectionsManager/components/index.tsx index 84ca05760..24a8e578c 100644 --- a/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/CollectionsManager/components/index.tsx +++ b/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/CollectionsManager/components/index.tsx @@ -63,7 +63,7 @@ export const ForeignKey = observer( : ['belongsToMany'].includes(type) ? through : target; - const fields = getCollection(effectField || name, dataSourceKey)?.fields; + const fields = getCollection(effectField, dataSourceKey)?.fields; if (fields) { const sourceOptions = fields ?.filter((v) => { @@ -95,7 +95,7 @@ export const ForeignKey = observer( onDropdownVisibleChange={async (open) => { const { target, type, through } = form.values; const effectField = ['belongsTo'].includes(type) - ? collectionName + ? collectionName || name : ['belongsToMany'].includes(type) ? through : target; From 40a22943b91455734a255b6598178391d7887999 Mon Sep 17 00:00:00 2001 From: chenos Date: Wed, 13 Mar 2024 22:41:12 +0800 Subject: [PATCH 07/15] =?UTF-8?q?chore(versions):=20=F0=9F=98=8A=20publish?= =?UTF-8?q?=20v0.20.0-alpha.10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lerna.json | 2 +- packages/core/acl/package.json | 6 +- packages/core/actions/package.json | 8 +- packages/core/app/package.json | 10 +- packages/core/auth/package.json | 12 +- packages/core/build/package.json | 2 +- packages/core/cache/package.json | 2 +- packages/core/cli/package.json | 6 +- packages/core/client/package.json | 8 +- .../core/create-nocobase-app/package.json | 2 +- .../core/data-source-manager/package.json | 12 +- packages/core/database/package.json | 6 +- packages/core/devtools/package.json | 8 +- packages/core/evaluators/package.json | 4 +- packages/core/logger/package.json | 2 +- packages/core/resourcer/package.json | 4 +- packages/core/sdk/package.json | 2 +- packages/core/server/package.json | 26 ++-- packages/core/telemetry/package.json | 4 +- packages/core/test/package.json | 4 +- packages/core/utils/package.json | 2 +- .../plugins/@nocobase/plugin-acl/package.json | 2 +- .../plugin-action-bulk-edit/package.json | 2 +- .../plugin-action-bulk-update/package.json | 2 +- .../plugin-action-duplicate/package.json | 2 +- .../plugin-action-print/package.json | 2 +- .../@nocobase/plugin-api-doc/package.json | 2 +- .../@nocobase/plugin-api-keys/package.json | 2 +- .../@nocobase/plugin-audit-logs/package.json | 2 +- .../@nocobase/plugin-auth/package.json | 2 +- .../plugin-backup-restore/package.json | 2 +- .../@nocobase/plugin-calendar/package.json | 2 +- .../plugins/@nocobase/plugin-cas/package.json | 2 +- .../@nocobase/plugin-charts/package.json | 2 +- .../plugin-china-region/package.json | 2 +- .../@nocobase/plugin-client/package.json | 2 +- .../plugin-collection-manager/package.json | 2 +- .../plugin-custom-request/package.json | 2 +- .../plugin-data-source-manager/package.json | 2 +- .../plugin-data-visualization/package.json | 2 +- .../plugin-disable-pm-add/package.json | 2 +- .../plugin-error-handler/package.json | 2 +- .../plugin-excel-formula-field/package.json | 2 +- .../@nocobase/plugin-export/package.json | 2 +- .../plugin-file-manager/package.json | 2 +- .../plugin-formula-field/package.json | 2 +- .../@nocobase/plugin-gantt/package.json | 2 +- .../package.json | 2 +- .../plugin-iframe-block/package.json | 2 +- .../@nocobase/plugin-import/package.json | 2 +- .../@nocobase/plugin-kanban/package.json | 2 +- .../package.json | 2 +- .../@nocobase/plugin-logger/package.json | 2 +- .../plugins/@nocobase/plugin-map/package.json | 2 +- .../plugin-math-formula-field/package.json | 2 +- .../plugin-mobile-client/package.json | 2 +- .../plugin-mock-collections/package.json | 2 +- .../plugin-multi-app-manager/package.json | 2 +- .../package.json | 2 +- .../plugin-notifications/package.json | 2 +- .../@nocobase/plugin-oidc/package.json | 2 +- .../@nocobase/plugin-saml/package.json | 2 +- .../plugin-sample-hello/package.json | 2 +- .../plugin-sequence-field/package.json | 2 +- .../@nocobase/plugin-sms-auth/package.json | 2 +- .../plugin-snapshot-field/package.json | 2 +- .../plugin-system-settings/package.json | 2 +- .../plugin-theme-editor/package.json | 2 +- .../plugin-ui-routes-storage/package.json | 2 +- .../plugin-ui-schema-storage/package.json | 2 +- .../@nocobase/plugin-users/package.json | 2 +- .../plugin-verification/package.json | 2 +- .../package.json | 2 +- .../plugin-workflow-aggregate/package.json | 2 +- .../plugin-workflow-delay/package.json | 2 +- .../package.json | 2 +- .../plugin-workflow-loop/package.json | 2 +- .../plugin-workflow-manual/package.json | 2 +- .../plugin-workflow-parallel/package.json | 2 +- .../plugin-workflow-request/package.json | 2 +- .../plugin-workflow-sql/package.json | 2 +- .../plugin-workflow-test/package.json | 2 +- .../@nocobase/plugin-workflow/package.json | 4 +- packages/presets/nocobase/package.json | 114 +++++++++--------- 84 files changed, 186 insertions(+), 186 deletions(-) diff --git a/lerna.json b/lerna.json index 54af1d5c2..e9e38c08f 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "npmClient": "yarn", "useWorkspaces": true, "npmClientArgs": ["--ignore-engines"], diff --git a/packages/core/acl/package.json b/packages/core/acl/package.json index ee6a87636..0cb0276fb 100644 --- a/packages/core/acl/package.json +++ b/packages/core/acl/package.json @@ -1,13 +1,13 @@ { "name": "@nocobase/acl", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "description": "", "license": "Apache-2.0", "main": "./lib/index.js", "types": "./lib/index.d.ts", "dependencies": { - "@nocobase/resourcer": "0.20.0-alpha.9", - "@nocobase/utils": "0.20.0-alpha.9", + "@nocobase/resourcer": "0.20.0-alpha.10", + "@nocobase/utils": "0.20.0-alpha.10", "minimatch": "^5.1.1" }, "repository": { diff --git a/packages/core/actions/package.json b/packages/core/actions/package.json index 8fa6edd48..2b671c2a4 100644 --- a/packages/core/actions/package.json +++ b/packages/core/actions/package.json @@ -1,14 +1,14 @@ { "name": "@nocobase/actions", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "description": "", "license": "Apache-2.0", "main": "./lib/index.js", "types": "./lib/index.d.ts", "dependencies": { - "@nocobase/cache": "0.20.0-alpha.9", - "@nocobase/database": "0.20.0-alpha.9", - "@nocobase/resourcer": "0.20.0-alpha.9" + "@nocobase/cache": "0.20.0-alpha.10", + "@nocobase/database": "0.20.0-alpha.10", + "@nocobase/resourcer": "0.20.0-alpha.10" }, "repository": { "type": "git", diff --git a/packages/core/app/package.json b/packages/core/app/package.json index 002296205..a8abd359c 100644 --- a/packages/core/app/package.json +++ b/packages/core/app/package.json @@ -1,17 +1,17 @@ { "name": "@nocobase/app", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "description": "", "license": "AGPL-3.0", "main": "./lib/index.js", "types": "./lib/index.d.ts", "dependencies": { - "@nocobase/database": "0.20.0-alpha.9", - "@nocobase/preset-nocobase": "0.20.0-alpha.9", - "@nocobase/server": "0.20.0-alpha.9" + "@nocobase/database": "0.20.0-alpha.10", + "@nocobase/preset-nocobase": "0.20.0-alpha.10", + "@nocobase/server": "0.20.0-alpha.10" }, "devDependencies": { - "@nocobase/client": "0.20.0-alpha.9" + "@nocobase/client": "0.20.0-alpha.10" }, "repository": { "type": "git", diff --git a/packages/core/auth/package.json b/packages/core/auth/package.json index 0f4577c7e..a5613924a 100644 --- a/packages/core/auth/package.json +++ b/packages/core/auth/package.json @@ -1,16 +1,16 @@ { "name": "@nocobase/auth", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "description": "", "license": "Apache-2.0", "main": "./lib/index.js", "types": "./lib/index.d.ts", "dependencies": { - "@nocobase/actions": "0.20.0-alpha.9", - "@nocobase/cache": "0.20.0-alpha.9", - "@nocobase/database": "0.20.0-alpha.9", - "@nocobase/resourcer": "0.20.0-alpha.9", - "@nocobase/utils": "0.20.0-alpha.9", + "@nocobase/actions": "0.20.0-alpha.10", + "@nocobase/cache": "0.20.0-alpha.10", + "@nocobase/database": "0.20.0-alpha.10", + "@nocobase/resourcer": "0.20.0-alpha.10", + "@nocobase/utils": "0.20.0-alpha.10", "@types/jsonwebtoken": "^8.5.8", "jsonwebtoken": "^8.5.1" }, diff --git a/packages/core/build/package.json b/packages/core/build/package.json index 47283a8d2..c81042f07 100755 --- a/packages/core/build/package.json +++ b/packages/core/build/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/build", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "description": "Library build tool based on rollup.", "main": "lib/index.js", "types": "./lib/index.d.ts", diff --git a/packages/core/cache/package.json b/packages/core/cache/package.json index 259a33074..bd4d1115c 100644 --- a/packages/core/cache/package.json +++ b/packages/core/cache/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/cache", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "description": "", "license": "Apache-2.0", "main": "./lib/index.js", diff --git a/packages/core/cli/package.json b/packages/core/cli/package.json index b26bddc62..dace07c0a 100644 --- a/packages/core/cli/package.json +++ b/packages/core/cli/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/cli", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "description": "", "license": "Apache-2.0", "main": "./src/index.js", @@ -8,7 +8,7 @@ "nocobase": "./bin/index.js" }, "dependencies": { - "@nocobase/app": "0.20.0-alpha.9", + "@nocobase/app": "0.20.0-alpha.10", "@types/fs-extra": "^11.0.1", "@umijs/utils": "3.5.20", "chalk": "^4.1.1", @@ -25,7 +25,7 @@ "tsx": "^4.6.2" }, "devDependencies": { - "@nocobase/devtools": "0.20.0-alpha.9" + "@nocobase/devtools": "0.20.0-alpha.10" }, "repository": { "type": "git", diff --git a/packages/core/client/package.json b/packages/core/client/package.json index 4eb74587d..39224cc48 100644 --- a/packages/core/client/package.json +++ b/packages/core/client/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/client", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "Apache-2.0", "main": "lib/index.js", "module": "es/index.mjs", @@ -26,9 +26,9 @@ "@formily/reactive-react": "^2.2.27", "@formily/shared": "^2.2.27", "@formily/validator": "^2.2.27", - "@nocobase/evaluators": "0.20.0-alpha.9", - "@nocobase/sdk": "0.20.0-alpha.9", - "@nocobase/utils": "0.20.0-alpha.9", + "@nocobase/evaluators": "0.20.0-alpha.10", + "@nocobase/sdk": "0.20.0-alpha.10", + "@nocobase/utils": "0.20.0-alpha.10", "ahooks": "^3.7.2", "antd": "^5.12.8", "antd-style": "3.4.5", diff --git a/packages/core/create-nocobase-app/package.json b/packages/core/create-nocobase-app/package.json index 8bc6084d4..9249650b0 100755 --- a/packages/core/create-nocobase-app/package.json +++ b/packages/core/create-nocobase-app/package.json @@ -1,6 +1,6 @@ { "name": "create-nocobase-app", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "main": "src/index.js", "license": "Apache-2.0", "dependencies": { diff --git a/packages/core/data-source-manager/package.json b/packages/core/data-source-manager/package.json index cb81c0aa2..9a82b720b 100644 --- a/packages/core/data-source-manager/package.json +++ b/packages/core/data-source-manager/package.json @@ -1,16 +1,16 @@ { "name": "@nocobase/data-source-manager", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "description": "", "license": "Apache-2.0", "main": "./lib/index.js", "types": "./lib/index.d.ts", "dependencies": { - "@nocobase/actions": "0.20.0-alpha.9", - "@nocobase/cache": "0.20.0-alpha.9", - "@nocobase/database": "0.20.0-alpha.9", - "@nocobase/resourcer": "0.20.0-alpha.9", - "@nocobase/utils": "0.20.0-alpha.9", + "@nocobase/actions": "0.20.0-alpha.10", + "@nocobase/cache": "0.20.0-alpha.10", + "@nocobase/database": "0.20.0-alpha.10", + "@nocobase/resourcer": "0.20.0-alpha.10", + "@nocobase/utils": "0.20.0-alpha.10", "@types/jsonwebtoken": "^8.5.8", "jsonwebtoken": "^8.5.1" }, diff --git a/packages/core/database/package.json b/packages/core/database/package.json index 47b881261..fecbde3d4 100644 --- a/packages/core/database/package.json +++ b/packages/core/database/package.json @@ -1,13 +1,13 @@ { "name": "@nocobase/database", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "description": "", "main": "./lib/index.js", "types": "./lib/index.d.ts", "license": "Apache-2.0", "dependencies": { - "@nocobase/logger": "0.20.0-alpha.9", - "@nocobase/utils": "0.20.0-alpha.9", + "@nocobase/logger": "0.20.0-alpha.10", + "@nocobase/utils": "0.20.0-alpha.10", "async-mutex": "^0.3.2", "chalk": "^4.1.1", "cron-parser": "4.4.0", diff --git a/packages/core/devtools/package.json b/packages/core/devtools/package.json index 184c9cef4..86d145f07 100644 --- a/packages/core/devtools/package.json +++ b/packages/core/devtools/package.json @@ -1,13 +1,13 @@ { "name": "@nocobase/devtools", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "description": "", "license": "Apache-2.0", "main": "./src/index.js", "dependencies": { - "@nocobase/build": "0.20.0-alpha.9", - "@nocobase/client": "0.20.0-alpha.9", - "@nocobase/test": "0.20.0-alpha.9", + "@nocobase/build": "0.20.0-alpha.10", + "@nocobase/client": "0.20.0-alpha.10", + "@nocobase/test": "0.20.0-alpha.10", "@types/koa": "^2.13.4", "@types/koa-bodyparser": "^4.3.4", "@types/lodash": "^4.14.177", diff --git a/packages/core/evaluators/package.json b/packages/core/evaluators/package.json index c3e85e93f..3d5708527 100644 --- a/packages/core/evaluators/package.json +++ b/packages/core/evaluators/package.json @@ -1,13 +1,13 @@ { "name": "@nocobase/evaluators", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "description": "", "main": "./lib/index.js", "types": "./lib/index.d.ts", "license": "Apache-2.0", "dependencies": { "@formulajs/formulajs": "4.2.0", - "@nocobase/utils": "0.20.0-alpha.9", + "@nocobase/utils": "0.20.0-alpha.10", "mathjs": "^10.6.0" }, "repository": { diff --git a/packages/core/logger/package.json b/packages/core/logger/package.json index 0295e1191..466d925b3 100644 --- a/packages/core/logger/package.json +++ b/packages/core/logger/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/logger", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "description": "nocobase logging library", "license": "Apache-2.0", "main": "./lib/index.js", diff --git a/packages/core/resourcer/package.json b/packages/core/resourcer/package.json index 3955ed4f8..2af63bac9 100644 --- a/packages/core/resourcer/package.json +++ b/packages/core/resourcer/package.json @@ -1,12 +1,12 @@ { "name": "@nocobase/resourcer", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "description": "", "main": "./lib/index.js", "types": "./lib/index.d.ts", "license": "Apache-2.0", "dependencies": { - "@nocobase/utils": "0.20.0-alpha.9", + "@nocobase/utils": "0.20.0-alpha.10", "deepmerge": "^4.2.2", "koa-compose": "^4.1.0", "lodash": "^4.17.21", diff --git a/packages/core/sdk/package.json b/packages/core/sdk/package.json index 13087f403..e295d9e8a 100644 --- a/packages/core/sdk/package.json +++ b/packages/core/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/sdk", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "Apache-2.0", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/core/server/package.json b/packages/core/server/package.json index bc8df7751..407afcf8d 100644 --- a/packages/core/server/package.json +++ b/packages/core/server/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/server", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "main": "lib/index.js", "types": "./lib/index.d.ts", "license": "Apache-2.0", @@ -10,18 +10,18 @@ "@koa/cors": "^3.1.0", "@koa/multer": "^3.0.2", "@koa/router": "^9.4.0", - "@nocobase/acl": "0.20.0-alpha.9", - "@nocobase/actions": "0.20.0-alpha.9", - "@nocobase/auth": "0.20.0-alpha.9", - "@nocobase/cache": "0.20.0-alpha.9", - "@nocobase/data-source-manager": "0.20.0-alpha.9", - "@nocobase/database": "0.20.0-alpha.9", - "@nocobase/evaluators": "0.20.0-alpha.9", - "@nocobase/logger": "0.20.0-alpha.9", - "@nocobase/resourcer": "0.20.0-alpha.9", - "@nocobase/sdk": "0.20.0-alpha.9", - "@nocobase/telemetry": "0.20.0-alpha.9", - "@nocobase/utils": "0.20.0-alpha.9", + "@nocobase/acl": "0.20.0-alpha.10", + "@nocobase/actions": "0.20.0-alpha.10", + "@nocobase/auth": "0.20.0-alpha.10", + "@nocobase/cache": "0.20.0-alpha.10", + "@nocobase/data-source-manager": "0.20.0-alpha.10", + "@nocobase/database": "0.20.0-alpha.10", + "@nocobase/evaluators": "0.20.0-alpha.10", + "@nocobase/logger": "0.20.0-alpha.10", + "@nocobase/resourcer": "0.20.0-alpha.10", + "@nocobase/sdk": "0.20.0-alpha.10", + "@nocobase/telemetry": "0.20.0-alpha.10", + "@nocobase/utils": "0.20.0-alpha.10", "@types/decompress": "4.2.4", "@types/ini": "^1.3.31", "@types/koa-send": "^4.1.3", diff --git a/packages/core/telemetry/package.json b/packages/core/telemetry/package.json index 264a85d42..75aeb5c98 100644 --- a/packages/core/telemetry/package.json +++ b/packages/core/telemetry/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/telemetry", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "description": "nocobase telemetry library", "license": "Apache-2.0", "main": "./lib/index.js", @@ -11,7 +11,7 @@ "directory": "packages/telemetry" }, "dependencies": { - "@nocobase/utils": "0.20.0-alpha.9", + "@nocobase/utils": "0.20.0-alpha.10", "@opentelemetry/api": "^1.7.0", "@opentelemetry/instrumentation": "^0.46.0", "@opentelemetry/resources": "^1.19.0", diff --git a/packages/core/test/package.json b/packages/core/test/package.json index d1ff15a4c..5b2d1e34d 100644 --- a/packages/core/test/package.json +++ b/packages/core/test/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/test", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "main": "lib/index.js", "module": "./src/index.ts", "types": "./lib/index.d.ts", @@ -40,7 +40,7 @@ }, "dependencies": { "@faker-js/faker": "8.1.0", - "@nocobase/server": "0.20.0-alpha.9", + "@nocobase/server": "0.20.0-alpha.10", "@playwright/test": "^1.42.1", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "^14.4.3", diff --git a/packages/core/utils/package.json b/packages/core/utils/package.json index a1306fe76..74e79ddf8 100644 --- a/packages/core/utils/package.json +++ b/packages/core/utils/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/utils", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "main": "lib/index.js", "types": "./lib/index.d.ts", "license": "Apache-2.0", diff --git a/packages/plugins/@nocobase/plugin-acl/package.json b/packages/plugins/@nocobase/plugin-acl/package.json index 3f0d5ddff..a83bf4318 100644 --- a/packages/plugins/@nocobase/plugin-acl/package.json +++ b/packages/plugins/@nocobase/plugin-acl/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "权限控制", "description": "Based on roles, resources, and actions, access control can precisely manage interface configuration permissions, data operation permissions, menu access permissions, and plugin permissions.", "description.zh-CN": "基于角色、资源和操作的权限控制,可以精确控制界面配置权限、数据操作权限、菜单访问权限、插件权限。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/acl", diff --git a/packages/plugins/@nocobase/plugin-action-bulk-edit/package.json b/packages/plugins/@nocobase/plugin-action-bulk-edit/package.json index c94bd82b6..541015ea5 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-edit/package.json +++ b/packages/plugins/@nocobase/plugin-action-bulk-edit/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-action-bulk-edit", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/action-bulk-edit", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/action-bulk-edit", diff --git a/packages/plugins/@nocobase/plugin-action-bulk-update/package.json b/packages/plugins/@nocobase/plugin-action-bulk-update/package.json index e94a34b5d..e1aec50a3 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-update/package.json +++ b/packages/plugins/@nocobase/plugin-action-bulk-update/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-action-bulk-update", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/action-bulk-update", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/action-bulk-update", diff --git a/packages/plugins/@nocobase/plugin-action-duplicate/package.json b/packages/plugins/@nocobase/plugin-action-duplicate/package.json index 4a9c5a9bd..a1e5d902c 100644 --- a/packages/plugins/@nocobase/plugin-action-duplicate/package.json +++ b/packages/plugins/@nocobase/plugin-action-duplicate/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-action-duplicate", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/action-duplicate", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/action-duplicate", diff --git a/packages/plugins/@nocobase/plugin-action-print/package.json b/packages/plugins/@nocobase/plugin-action-print/package.json index 28bcc1bc3..f7f3a5261 100644 --- a/packages/plugins/@nocobase/plugin-action-print/package.json +++ b/packages/plugins/@nocobase/plugin-action-print/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-action-print", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/action-print", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/action-print", diff --git a/packages/plugins/@nocobase/plugin-api-doc/package.json b/packages/plugins/@nocobase/plugin-api-doc/package.json index a8e2d1815..8bf3d1d05 100644 --- a/packages/plugins/@nocobase/plugin-api-doc/package.json +++ b/packages/plugins/@nocobase/plugin-api-doc/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-api-doc", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "displayName": "API documentation", "displayName.zh-CN": "API 文档", "description": "An OpenAPI documentation generator for NocoBase HTTP API.", diff --git a/packages/plugins/@nocobase/plugin-api-keys/package.json b/packages/plugins/@nocobase/plugin-api-keys/package.json index 5da690c26..b78a9252d 100644 --- a/packages/plugins/@nocobase/plugin-api-keys/package.json +++ b/packages/plugins/@nocobase/plugin-api-keys/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "认证:API 密钥", "description": "Allows users to use API key to access application's HTTP API", "description.zh-CN": "允许用户使用 API 密钥访问应用的 HTTP API", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/api-keys", diff --git a/packages/plugins/@nocobase/plugin-audit-logs/package.json b/packages/plugins/@nocobase/plugin-audit-logs/package.json index 6551dd092..290bdfbbb 100644 --- a/packages/plugins/@nocobase/plugin-audit-logs/package.json +++ b/packages/plugins/@nocobase/plugin-audit-logs/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-audit-logs", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "displayName": "Audit logs (deprecated)", "displayName.zh-CN": "审计日志(废弃)", "description": "This plugin is deprecated. There will be a new audit log plugin in the future.", diff --git a/packages/plugins/@nocobase/plugin-auth/package.json b/packages/plugins/@nocobase/plugin-auth/package.json index bc1e70a68..0d474060a 100644 --- a/packages/plugins/@nocobase/plugin-auth/package.json +++ b/packages/plugins/@nocobase/plugin-auth/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-auth", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/auth", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/auth", diff --git a/packages/plugins/@nocobase/plugin-backup-restore/package.json b/packages/plugins/@nocobase/plugin-backup-restore/package.json index 032adab2f..fcf48888f 100644 --- a/packages/plugins/@nocobase/plugin-backup-restore/package.json +++ b/packages/plugins/@nocobase/plugin-backup-restore/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "应用的备份与还原", "description": "Backup and restore applications for scenarios such as application replication, migration, and upgrades.", "description.zh-CN": "备份和还原应用,可用于应用的复制、迁移、升级等场景。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/backup-restore", diff --git a/packages/plugins/@nocobase/plugin-calendar/package.json b/packages/plugins/@nocobase/plugin-calendar/package.json index 042639a18..10db22f9f 100644 --- a/packages/plugins/@nocobase/plugin-calendar/package.json +++ b/packages/plugins/@nocobase/plugin-calendar/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-calendar", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "displayName": "Calendar", "displayName.zh-CN": "日历", "description": "Provides callendar collection template and block for managing date data, typically for date/time related information such as events, appointments, tasks, and so on.", diff --git a/packages/plugins/@nocobase/plugin-cas/package.json b/packages/plugins/@nocobase/plugin-cas/package.json index 2745c3f23..cf17c7519 100644 --- a/packages/plugins/@nocobase/plugin-cas/package.json +++ b/packages/plugins/@nocobase/plugin-cas/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "认证:CAS", "description": "CAS authentication.", "description.zh-CN": "通过 CAS 协议认证身份。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/auth-cas", diff --git a/packages/plugins/@nocobase/plugin-charts/package.json b/packages/plugins/@nocobase/plugin-charts/package.json index 2d999732d..81b84351f 100644 --- a/packages/plugins/@nocobase/plugin-charts/package.json +++ b/packages/plugins/@nocobase/plugin-charts/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "图表(废弃)", "description": "The plugin has been deprecated, please use the data visualization plugin instead.", "description.zh-CN": "已废弃插件,请使用数据可视化插件代替。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "main": "./dist/server/index.js", "license": "AGPL-3.0", "devDependencies": { diff --git a/packages/plugins/@nocobase/plugin-china-region/package.json b/packages/plugins/@nocobase/plugin-china-region/package.json index 6bfe6638e..983e4c3dd 100644 --- a/packages/plugins/@nocobase/plugin-china-region/package.json +++ b/packages/plugins/@nocobase/plugin-china-region/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-china-region", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "displayName": "Administrative divisions of China", "displayName.zh-CN": "中国行政区划", "description": "Provides data and field type for administrative divisions of China.", diff --git a/packages/plugins/@nocobase/plugin-client/package.json b/packages/plugins/@nocobase/plugin-client/package.json index 82b5549e6..6d88e5283 100644 --- a/packages/plugins/@nocobase/plugin-client/package.json +++ b/packages/plugins/@nocobase/plugin-client/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "WEB 客户端", "description": "Provides a client interface for the NocoBase server", "description.zh-CN": "为 NocoBase 服务端提供客户端界面", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "main": "./dist/server/index.js", "license": "AGPL-3.0", "devDependencies": { diff --git a/packages/plugins/@nocobase/plugin-collection-manager/package.json b/packages/plugins/@nocobase/plugin-collection-manager/package.json index d8bb4aeef..1e5aaa26b 100644 --- a/packages/plugins/@nocobase/plugin-collection-manager/package.json +++ b/packages/plugins/@nocobase/plugin-collection-manager/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "数据源:主数据库", "description": "NocoBase main database, supports relational databases such as MySQL, PostgreSQL, SQLite and so on.", "description.zh-CN": "NocoBase 主数据库,支持 MySQL、PostgreSQL、SQLite 等关系型数据库。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/data-source-main", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/data-source-main", diff --git a/packages/plugins/@nocobase/plugin-custom-request/package.json b/packages/plugins/@nocobase/plugin-custom-request/package.json index f71bb7554..64baf480a 100644 --- a/packages/plugins/@nocobase/plugin-custom-request/package.json +++ b/packages/plugins/@nocobase/plugin-custom-request/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-custom-request", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/action-custom-request", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/action-custom-request", diff --git a/packages/plugins/@nocobase/plugin-data-source-manager/package.json b/packages/plugins/@nocobase/plugin-data-source-manager/package.json index b4795fb86..70f0fc105 100644 --- a/packages/plugins/@nocobase/plugin-data-source-manager/package.json +++ b/packages/plugins/@nocobase/plugin-data-source-manager/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-data-source-manager", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "main": "dist/server/index.js", "displayName": "Data source manager", "displayName.zh-CN": "数据源管理", diff --git a/packages/plugins/@nocobase/plugin-data-visualization/package.json b/packages/plugins/@nocobase/plugin-data-visualization/package.json index 6a5970966..385fdf183 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/package.json +++ b/packages/plugins/@nocobase/plugin-data-visualization/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-data-visualization", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "displayName": "Data visualization", "displayName.zh-CN": "数据可视化", "description": "Provides data visualization feature, including chart block and chart filter block, support line charts, area charts, bar charts and more than a dozen kinds of charts, you can also extend more chart types.", diff --git a/packages/plugins/@nocobase/plugin-disable-pm-add/package.json b/packages/plugins/@nocobase/plugin-disable-pm-add/package.json index d1ae6c805..f5082b226 100644 --- a/packages/plugins/@nocobase/plugin-disable-pm-add/package.json +++ b/packages/plugins/@nocobase/plugin-disable-pm-add/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-disable-pm-add", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "main": "./dist/server/index.js", "peerDependencies": { "@nocobase/client": "0.x", diff --git a/packages/plugins/@nocobase/plugin-error-handler/package.json b/packages/plugins/@nocobase/plugin-error-handler/package.json index c28aa4837..cb908cd18 100644 --- a/packages/plugins/@nocobase/plugin-error-handler/package.json +++ b/packages/plugins/@nocobase/plugin-error-handler/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "错误处理器", "description": "Handling application errors and exceptions.", "description.zh-CN": "处理应用程序中的错误和异常。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "devDependencies": { diff --git a/packages/plugins/@nocobase/plugin-excel-formula-field/package.json b/packages/plugins/@nocobase/plugin-excel-formula-field/package.json index 135af577f..e05ffd36a 100644 --- a/packages/plugins/@nocobase/plugin-excel-formula-field/package.json +++ b/packages/plugins/@nocobase/plugin-excel-formula-field/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-excel-formula-field", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "description": "", "license": "AGPL-3.0", "main": "./dist/server/index.js", diff --git a/packages/plugins/@nocobase/plugin-export/package.json b/packages/plugins/@nocobase/plugin-export/package.json index 76362c49c..c0dc94477 100644 --- a/packages/plugins/@nocobase/plugin-export/package.json +++ b/packages/plugins/@nocobase/plugin-export/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "操作:导出记录", "description": "Export filtered records to excel, you can configure which fields to export.", "description.zh-CN": "导出筛选后的记录到 Excel 中,可以配置导出哪些字段。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/action-export", diff --git a/packages/plugins/@nocobase/plugin-file-manager/package.json b/packages/plugins/@nocobase/plugin-file-manager/package.json index a81af3c0c..3c3af3c0e 100644 --- a/packages/plugins/@nocobase/plugin-file-manager/package.json +++ b/packages/plugins/@nocobase/plugin-file-manager/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-file-manager", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "displayName": "File manager", "displayName.zh-CN": "文件管理器", "description": "Provides files storage services with files collection template and attachment field.", diff --git a/packages/plugins/@nocobase/plugin-formula-field/package.json b/packages/plugins/@nocobase/plugin-formula-field/package.json index d79295a73..10a80f85c 100644 --- a/packages/plugins/@nocobase/plugin-formula-field/package.json +++ b/packages/plugins/@nocobase/plugin-formula-field/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "数据表字段:公式", "description": "Configure and store the results of calculations between multiple field values in the same record, supporting both Math.js and Excel formula functions.", "description.zh-CN": "可以配置并存储同一条记录的多字段值之间的计算结果,支持 Math.js 和 Excel formula functions 两种引擎", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/field-formula", diff --git a/packages/plugins/@nocobase/plugin-gantt/package.json b/packages/plugins/@nocobase/plugin-gantt/package.json index 07d2f23bf..c7714b92a 100644 --- a/packages/plugins/@nocobase/plugin-gantt/package.json +++ b/packages/plugins/@nocobase/plugin-gantt/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-gantt", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "displayName": "Block: Gantt", "displayName.zh-CN": "区块:甘特图", "description": "Provides Gantt block.", diff --git a/packages/plugins/@nocobase/plugin-graph-collection-manager/package.json b/packages/plugins/@nocobase/plugin-graph-collection-manager/package.json index 1fa6f833a..040fda488 100644 --- a/packages/plugins/@nocobase/plugin-graph-collection-manager/package.json +++ b/packages/plugins/@nocobase/plugin-graph-collection-manager/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "可视化数据表管理", "description": "An ER diagram-like tool. Currently only the Master database is supported.", "description.zh-CN": "类似 ER 图的工具,目前只支持主数据库。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/graph-collection-manager", diff --git a/packages/plugins/@nocobase/plugin-iframe-block/package.json b/packages/plugins/@nocobase/plugin-iframe-block/package.json index 0fa1ef662..88212dac4 100644 --- a/packages/plugins/@nocobase/plugin-iframe-block/package.json +++ b/packages/plugins/@nocobase/plugin-iframe-block/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "区块:iframe", "description": "Create an iframe block on the page to embed and display external web pages or content.", "description.zh-CN": "在页面上创建和管理iframe,用于嵌入和展示外部网页或内容。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/block-iframe", diff --git a/packages/plugins/@nocobase/plugin-import/package.json b/packages/plugins/@nocobase/plugin-import/package.json index 1e9027037..388ab919a 100644 --- a/packages/plugins/@nocobase/plugin-import/package.json +++ b/packages/plugins/@nocobase/plugin-import/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "操作:导入记录", "description": "Import records using excel templates. You can configure which fields to import and templates will be generated automatically.", "description.zh-CN": "使用 Excel 模板导入数据,可以配置导入哪些字段,自动生成模板。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/action-import", diff --git a/packages/plugins/@nocobase/plugin-kanban/package.json b/packages/plugins/@nocobase/plugin-kanban/package.json index a9ab3f331..c30c776ab 100644 --- a/packages/plugins/@nocobase/plugin-kanban/package.json +++ b/packages/plugins/@nocobase/plugin-kanban/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-kanban", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/block-kanban", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/block-kanban", diff --git a/packages/plugins/@nocobase/plugin-localization-management/package.json b/packages/plugins/@nocobase/plugin-localization-management/package.json index ae0fd77c8..b30647ce1 100644 --- a/packages/plugins/@nocobase/plugin-localization-management/package.json +++ b/packages/plugins/@nocobase/plugin-localization-management/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-localization-management", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/localization-management", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/localization-management", diff --git a/packages/plugins/@nocobase/plugin-logger/package.json b/packages/plugins/@nocobase/plugin-logger/package.json index 0c77903db..741da708e 100644 --- a/packages/plugins/@nocobase/plugin-logger/package.json +++ b/packages/plugins/@nocobase/plugin-logger/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "日志", "description": "Server-side logs, mainly including API request logs and system runtime logs, and allows to package and download log files.", "description.zh-CN": "服务端日志,主要包括接口请求日志和系统运行日志,并支持打包和下载日志文件。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/logger", diff --git a/packages/plugins/@nocobase/plugin-map/package.json b/packages/plugins/@nocobase/plugin-map/package.json index 352745544..c397e904d 100644 --- a/packages/plugins/@nocobase/plugin-map/package.json +++ b/packages/plugins/@nocobase/plugin-map/package.json @@ -2,7 +2,7 @@ "name": "@nocobase/plugin-map", "displayName": "Block: Map", "displayName.zh-CN": "区块:地图", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "description": "Map block, support Gaode map and Google map, you can also extend more map types.", "description.zh-CN": "地图区块,支持高德地图和 Google 地图,你也可以扩展更多地图类型。", "license": "AGPL-3.0", diff --git a/packages/plugins/@nocobase/plugin-math-formula-field/package.json b/packages/plugins/@nocobase/plugin-math-formula-field/package.json index fe29098dd..c57ad4426 100644 --- a/packages/plugins/@nocobase/plugin-math-formula-field/package.json +++ b/packages/plugins/@nocobase/plugin-math-formula-field/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "数学公式字段", "description": "A powerful mathematical formula field plugin designed to provide flexible mathematical and formula calculation capabilities for databases or data management systems. It seamlessly integrates with various database systems such as MySQL, PostgreSQL, and offers an intuitive user interface for defining and executing mathematical formula fields.", "description.zh-CN": "一个功能强大的数学公式字段插件,旨在为数据库或数据管理系统提供灵活的数学计算和公式计算功能。它可以与各种数据库系统(如MySQL、PostgreSQL)无缝集成,并提供直观的用户界面来定义和执行数学公式字段。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "devDependencies": { diff --git a/packages/plugins/@nocobase/plugin-mobile-client/package.json b/packages/plugins/@nocobase/plugin-mobile-client/package.json index d4c7bc7c0..a80b47eb9 100644 --- a/packages/plugins/@nocobase/plugin-mobile-client/package.json +++ b/packages/plugins/@nocobase/plugin-mobile-client/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-mobile-client", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/mobile-client", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/mobile-client", diff --git a/packages/plugins/@nocobase/plugin-mock-collections/package.json b/packages/plugins/@nocobase/plugin-mock-collections/package.json index 305b00262..01833333e 100644 --- a/packages/plugins/@nocobase/plugin-mock-collections/package.json +++ b/packages/plugins/@nocobase/plugin-mock-collections/package.json @@ -2,7 +2,7 @@ "name": "@nocobase/plugin-mock-collections", "displayName": "mock-collections", "description": "mock-collections", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "main": "./dist/server/index.js", "license": "AGPL-3.0", "peerDependencies": { diff --git a/packages/plugins/@nocobase/plugin-multi-app-manager/package.json b/packages/plugins/@nocobase/plugin-multi-app-manager/package.json index 4c07cad24..ee47737bc 100644 --- a/packages/plugins/@nocobase/plugin-multi-app-manager/package.json +++ b/packages/plugins/@nocobase/plugin-multi-app-manager/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "多应用管理器", "description": "Dynamically create multiple apps without separate deployments.", "description.zh-CN": "无需单独部署即可动态创建多个应用。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/multi-app-manager", diff --git a/packages/plugins/@nocobase/plugin-multi-app-share-collection/package.json b/packages/plugins/@nocobase/plugin-multi-app-share-collection/package.json index e1ceaaae2..830cab66d 100644 --- a/packages/plugins/@nocobase/plugin-multi-app-share-collection/package.json +++ b/packages/plugins/@nocobase/plugin-multi-app-share-collection/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "多应用数据表共享", "description": "", "description.zh-CN": "", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "main": "./dist/server/index.js", "devDependencies": { "@formily/react": "2.x", diff --git a/packages/plugins/@nocobase/plugin-notifications/package.json b/packages/plugins/@nocobase/plugin-notifications/package.json index 0e5c47008..635a614e5 100644 --- a/packages/plugins/@nocobase/plugin-notifications/package.json +++ b/packages/plugins/@nocobase/plugin-notifications/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-notifications", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "description": "", "license": "AGPL-3.0", "main": "./dist/server/index.js", diff --git a/packages/plugins/@nocobase/plugin-oidc/package.json b/packages/plugins/@nocobase/plugin-oidc/package.json index 314051dba..088f46fdc 100644 --- a/packages/plugins/@nocobase/plugin-oidc/package.json +++ b/packages/plugins/@nocobase/plugin-oidc/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "认证:OIDC", "description": "OIDC (OpenID Connect) authentication.", "description.zh-CN": "通过 OIDC (OpenID Connect) 协议认证身份。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/auth-oidc", diff --git a/packages/plugins/@nocobase/plugin-saml/package.json b/packages/plugins/@nocobase/plugin-saml/package.json index 863231ceb..3373bf0f2 100644 --- a/packages/plugins/@nocobase/plugin-saml/package.json +++ b/packages/plugins/@nocobase/plugin-saml/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "认证:SAML 2.0", "description": "SAML 2.0 authentication.", "description.zh-CN": "通过 SAML 2.0 协议认证身份。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/auth-saml", diff --git a/packages/plugins/@nocobase/plugin-sample-hello/package.json b/packages/plugins/@nocobase/plugin-sample-hello/package.json index faeb8611e..558459776 100644 --- a/packages/plugins/@nocobase/plugin-sample-hello/package.json +++ b/packages/plugins/@nocobase/plugin-sample-hello/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-sample-hello", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "main": "./dist/server/index.js", "displayName": "Hello", "displayName.zh-CN": "Hello", diff --git a/packages/plugins/@nocobase/plugin-sequence-field/package.json b/packages/plugins/@nocobase/plugin-sequence-field/package.json index 6bfd920e8..75701ac49 100644 --- a/packages/plugins/@nocobase/plugin-sequence-field/package.json +++ b/packages/plugins/@nocobase/plugin-sequence-field/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "数据表字段:自动编码", "description": "Automatically generate codes based on configured rules, supporting combinations of dates, numbers, and text.", "description.zh-CN": "根据配置的规则自动生成编码,支持日期、数字、文本的组合。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/field-sequence", diff --git a/packages/plugins/@nocobase/plugin-sms-auth/package.json b/packages/plugins/@nocobase/plugin-sms-auth/package.json index 3c431d96d..09e12c77d 100644 --- a/packages/plugins/@nocobase/plugin-sms-auth/package.json +++ b/packages/plugins/@nocobase/plugin-sms-auth/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "认证:短信", "description": "SMS authentication.", "description.zh-CN": "通过短信验证码认证身份。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/auth-sms", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/auth-sms", diff --git a/packages/plugins/@nocobase/plugin-snapshot-field/package.json b/packages/plugins/@nocobase/plugin-snapshot-field/package.json index 56c63bc94..6603c768c 100644 --- a/packages/plugins/@nocobase/plugin-snapshot-field/package.json +++ b/packages/plugins/@nocobase/plugin-snapshot-field/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "数据表字段:关系快照", "description": "When adding a new record, create a snapshot for its relational record and save in the new record. The snapshot will not be updated when the relational record is updated.", "description.zh-CN": "在添加数据时,为它的关系数据创建快照,并保存在当前的数据中。关系数据更新时,快照不会更新。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/field-snapshot", diff --git a/packages/plugins/@nocobase/plugin-system-settings/package.json b/packages/plugins/@nocobase/plugin-system-settings/package.json index 0260c95f0..c042e0faa 100644 --- a/packages/plugins/@nocobase/plugin-system-settings/package.json +++ b/packages/plugins/@nocobase/plugin-system-settings/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "系统设置", "description": "Used to adjust the system title, logo, language, etc.", "description.zh-CN": "用于调整系统的标题、LOGO、语言等。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/system-settings", diff --git a/packages/plugins/@nocobase/plugin-theme-editor/package.json b/packages/plugins/@nocobase/plugin-theme-editor/package.json index 88757ea34..19e5999d0 100644 --- a/packages/plugins/@nocobase/plugin-theme-editor/package.json +++ b/packages/plugins/@nocobase/plugin-theme-editor/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-theme-editor", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/theme-editor", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/theme-editor", diff --git a/packages/plugins/@nocobase/plugin-ui-routes-storage/package.json b/packages/plugins/@nocobase/plugin-ui-routes-storage/package.json index c4f104045..1e5278ed2 100644 --- a/packages/plugins/@nocobase/plugin-ui-routes-storage/package.json +++ b/packages/plugins/@nocobase/plugin-ui-routes-storage/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "路由管理", "description": "manage the routes of nocobase", "description.zh-CN": "管理页面路由。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "devDependencies": { diff --git a/packages/plugins/@nocobase/plugin-ui-schema-storage/package.json b/packages/plugins/@nocobase/plugin-ui-schema-storage/package.json index a5872fc21..67234b106 100644 --- a/packages/plugins/@nocobase/plugin-ui-schema-storage/package.json +++ b/packages/plugins/@nocobase/plugin-ui-schema-storage/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "UI schema 存储服务", "description": "Provides centralized UI schema storage service.", "description.zh-CN": "提供中心化的 UI schema 存储服务。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/ui-schema-storage", diff --git a/packages/plugins/@nocobase/plugin-users/package.json b/packages/plugins/@nocobase/plugin-users/package.json index 929ba1311..b80078539 100644 --- a/packages/plugins/@nocobase/plugin-users/package.json +++ b/packages/plugins/@nocobase/plugin-users/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "用户", "description": "Provides basic user model, as well as created by and updated by fields.", "description.zh-CN": "提供了基础的用户模型,以及创建人和最后更新人字段。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/users", diff --git a/packages/plugins/@nocobase/plugin-verification/package.json b/packages/plugins/@nocobase/plugin-verification/package.json index 9de7d9243..52614a7f6 100644 --- a/packages/plugins/@nocobase/plugin-verification/package.json +++ b/packages/plugins/@nocobase/plugin-verification/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "验证码", "description": "verification setting.", "description.zh-CN": "验证码配置。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/verification", diff --git a/packages/plugins/@nocobase/plugin-workflow-action-trigger/package.json b/packages/plugins/@nocobase/plugin-workflow-action-trigger/package.json index 0ff7e6aca..87544fd71 100644 --- a/packages/plugins/@nocobase/plugin-workflow-action-trigger/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-action-trigger/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:数据操作触发器", "description": "Bind action buttons to trigger workflow events when clicked.", "description.zh-CN": "可对数据操作按钮绑定,在点击后触发对应的工作流事件。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/plugins/workflow-action-trigger", diff --git a/packages/plugins/@nocobase/plugin-workflow-aggregate/package.json b/packages/plugins/@nocobase/plugin-workflow-aggregate/package.json index d1dde89ff..5246841d2 100644 --- a/packages/plugins/@nocobase/plugin-workflow-aggregate/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-aggregate/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:聚合查询节点", "description": "Used to aggregate data against the database in workflow, such as: statistics, sum, average, etc.", "description.zh-CN": "可用于在工作流中对数据库进行聚合查询,如:统计数量、求和、平均值等。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-aggregate", diff --git a/packages/plugins/@nocobase/plugin-workflow-delay/package.json b/packages/plugins/@nocobase/plugin-workflow-delay/package.json index aa66137a1..757cb8aba 100644 --- a/packages/plugins/@nocobase/plugin-workflow-delay/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-delay/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:延时节点", "description": "Could be used in workflow parallel branch for waiting other branches.", "description.zh-CN": "可用于工作流并行分支中等待其他分支执行完成。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-delay", diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/package.json b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/package.json index a0826fef3..5bdcc5337 100644 --- a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:动态表达式计算节点", "description": "Useful plugin for doing dynamic calculation based on expression collection records in workflow.", "description.zh-CN": "用于在工作流中进行基于数据行的动态表达式计算。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-dynamic-calculation", diff --git a/packages/plugins/@nocobase/plugin-workflow-loop/package.json b/packages/plugins/@nocobase/plugin-workflow-loop/package.json index 6c6bcfd33..929387b05 100644 --- a/packages/plugins/@nocobase/plugin-workflow-loop/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-loop/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:循环节点", "description": "Used to repeat the sub-process processing of each value in an array, and can also be used for fixed times of sub-process processing.", "description.zh-CN": "用于对一个数组中的每个值进行重复的子流程处理,也可用于固定次数的重复子流程处理。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-loop", diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/package.json b/packages/plugins/@nocobase/plugin-workflow-manual/package.json index 9784c01d6..14b9cf530 100644 --- a/packages/plugins/@nocobase/plugin-workflow-manual/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-manual/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:人工处理节点", "description": "Could be used for workflows which some of decisions are made by users.", "description.zh-CN": "用于人工控制部分决策的流程。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-manual", diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/package.json b/packages/plugins/@nocobase/plugin-workflow-parallel/package.json index da799c9dd..1c38a7631 100644 --- a/packages/plugins/@nocobase/plugin-workflow-parallel/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-parallel/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:并行分支节点", "description": "Could be used for parallel execution of branch processes in the workflow.", "description.zh-CN": "用于在工作流中需要并行执行的分支流程。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-parallel", diff --git a/packages/plugins/@nocobase/plugin-workflow-request/package.json b/packages/plugins/@nocobase/plugin-workflow-request/package.json index c7a28ac54..f2fcd1ce9 100644 --- a/packages/plugins/@nocobase/plugin-workflow-request/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-request/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:HTTP 请求节点", "description": "Send HTTP requests to any HTTP service for data interaction in workflow.", "description.zh-CN": "可用于在工作流中向任意 HTTP 服务发送请求,进行数据交互。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-request", diff --git a/packages/plugins/@nocobase/plugin-workflow-sql/package.json b/packages/plugins/@nocobase/plugin-workflow-sql/package.json index 6c90c67ca..3ebe59232 100644 --- a/packages/plugins/@nocobase/plugin-workflow-sql/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-sql/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:SQL 节点", "description": "Execute SQL statements in workflow.", "description.zh-CN": "可用于在工作流中对数据库执行任意 SQL 语句。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-sql", diff --git a/packages/plugins/@nocobase/plugin-workflow-test/package.json b/packages/plugins/@nocobase/plugin-workflow-test/package.json index 5cd3c3c51..ab4ecd319 100644 --- a/packages/plugins/@nocobase/plugin-workflow-test/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-test/package.json @@ -2,7 +2,7 @@ "name": "@nocobase/plugin-workflow-test", "displayName": "Workflow: test kit", "displayName.zh-CN": "工作流:测试工具包", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "dist/server/index.js", "types": "./dist/server/index.d.ts", diff --git a/packages/plugins/@nocobase/plugin-workflow/package.json b/packages/plugins/@nocobase/plugin-workflow/package.json index 93dbd474e..c9302dca2 100644 --- a/packages/plugins/@nocobase/plugin-workflow/package.json +++ b/packages/plugins/@nocobase/plugin-workflow/package.json @@ -4,13 +4,13 @@ "displayName.zh-CN": "工作流", "description": "A powerful BPM tool that provides foundational support for business automation, with the capability to extend unlimited triggers and nodes.", "description.zh-CN": "一个强大的 BPM 工具,为业务自动化提供基础支持,并且可任意扩展更多的触发器和节点。", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/workflow", "dependencies": { - "@nocobase/plugin-workflow-test": "0.20.0-alpha.9" + "@nocobase/plugin-workflow-test": "0.20.0-alpha.10" }, "devDependencies": { "@ant-design/icons": "5.x", diff --git a/packages/presets/nocobase/package.json b/packages/presets/nocobase/package.json index 20f0e427f..00eab188a 100644 --- a/packages/presets/nocobase/package.json +++ b/packages/presets/nocobase/package.json @@ -1,66 +1,66 @@ { "name": "@nocobase/preset-nocobase", - "version": "0.20.0-alpha.9", + "version": "0.20.0-alpha.10", "license": "AGPL-3.0", "main": "./lib/server/index.js", "dependencies": { "@formily/json-schema": "2.x", - "@nocobase/plugin-acl": "0.20.0-alpha.9", - "@nocobase/plugin-action-bulk-edit": "0.20.0-alpha.9", - "@nocobase/plugin-action-bulk-update": "0.20.0-alpha.9", - "@nocobase/plugin-action-duplicate": "0.20.0-alpha.9", - "@nocobase/plugin-action-print": "0.20.0-alpha.9", - "@nocobase/plugin-api-doc": "0.20.0-alpha.9", - "@nocobase/plugin-api-keys": "0.20.0-alpha.9", - "@nocobase/plugin-audit-logs": "0.20.0-alpha.9", - "@nocobase/plugin-auth": "0.20.0-alpha.9", - "@nocobase/plugin-backup-restore": "0.20.0-alpha.9", - "@nocobase/plugin-calendar": "0.20.0-alpha.9", - "@nocobase/plugin-cas": "0.20.0-alpha.9", - "@nocobase/plugin-charts": "0.20.0-alpha.9", - "@nocobase/plugin-china-region": "0.20.0-alpha.9", - "@nocobase/plugin-client": "0.20.0-alpha.9", - "@nocobase/plugin-collection-manager": "0.20.0-alpha.9", - "@nocobase/plugin-custom-request": "0.20.0-alpha.9", - "@nocobase/plugin-data-source-manager": "0.20.0-alpha.9", - "@nocobase/plugin-data-visualization": "0.20.0-alpha.9", - "@nocobase/plugin-error-handler": "0.20.0-alpha.9", - "@nocobase/plugin-export": "0.20.0-alpha.9", - "@nocobase/plugin-file-manager": "0.20.0-alpha.9", - "@nocobase/plugin-formula-field": "0.20.0-alpha.9", - "@nocobase/plugin-gantt": "0.20.0-alpha.9", - "@nocobase/plugin-graph-collection-manager": "0.20.0-alpha.9", - "@nocobase/plugin-iframe-block": "0.20.0-alpha.9", - "@nocobase/plugin-import": "0.20.0-alpha.9", - "@nocobase/plugin-kanban": "0.20.0-alpha.9", - "@nocobase/plugin-localization-management": "0.20.0-alpha.9", - "@nocobase/plugin-logger": "0.20.0-alpha.9", - "@nocobase/plugin-map": "0.20.0-alpha.9", - "@nocobase/plugin-mobile-client": "0.20.0-alpha.9", - "@nocobase/plugin-mock-collections": "0.20.0-alpha.9", - "@nocobase/plugin-multi-app-manager": "0.20.0-alpha.9", - "@nocobase/plugin-multi-app-share-collection": "0.20.0-alpha.9", - "@nocobase/plugin-oidc": "0.20.0-alpha.9", - "@nocobase/plugin-saml": "0.20.0-alpha.9", - "@nocobase/plugin-sequence-field": "0.20.0-alpha.9", - "@nocobase/plugin-sms-auth": "0.20.0-alpha.9", - "@nocobase/plugin-snapshot-field": "0.20.0-alpha.9", - "@nocobase/plugin-system-settings": "0.20.0-alpha.9", - "@nocobase/plugin-theme-editor": "0.20.0-alpha.9", - "@nocobase/plugin-ui-schema-storage": "0.20.0-alpha.9", - "@nocobase/plugin-users": "0.20.0-alpha.9", - "@nocobase/plugin-verification": "0.20.0-alpha.9", - "@nocobase/plugin-workflow": "0.20.0-alpha.9", - "@nocobase/plugin-workflow-action-trigger": "0.20.0-alpha.9", - "@nocobase/plugin-workflow-aggregate": "0.20.0-alpha.9", - "@nocobase/plugin-workflow-delay": "0.20.0-alpha.9", - "@nocobase/plugin-workflow-dynamic-calculation": "0.20.0-alpha.9", - "@nocobase/plugin-workflow-loop": "0.20.0-alpha.9", - "@nocobase/plugin-workflow-manual": "0.20.0-alpha.9", - "@nocobase/plugin-workflow-parallel": "0.20.0-alpha.9", - "@nocobase/plugin-workflow-request": "0.20.0-alpha.9", - "@nocobase/plugin-workflow-sql": "0.20.0-alpha.9", - "@nocobase/server": "0.20.0-alpha.9", + "@nocobase/plugin-acl": "0.20.0-alpha.10", + "@nocobase/plugin-action-bulk-edit": "0.20.0-alpha.10", + "@nocobase/plugin-action-bulk-update": "0.20.0-alpha.10", + "@nocobase/plugin-action-duplicate": "0.20.0-alpha.10", + "@nocobase/plugin-action-print": "0.20.0-alpha.10", + "@nocobase/plugin-api-doc": "0.20.0-alpha.10", + "@nocobase/plugin-api-keys": "0.20.0-alpha.10", + "@nocobase/plugin-audit-logs": "0.20.0-alpha.10", + "@nocobase/plugin-auth": "0.20.0-alpha.10", + "@nocobase/plugin-backup-restore": "0.20.0-alpha.10", + "@nocobase/plugin-calendar": "0.20.0-alpha.10", + "@nocobase/plugin-cas": "0.20.0-alpha.10", + "@nocobase/plugin-charts": "0.20.0-alpha.10", + "@nocobase/plugin-china-region": "0.20.0-alpha.10", + "@nocobase/plugin-client": "0.20.0-alpha.10", + "@nocobase/plugin-collection-manager": "0.20.0-alpha.10", + "@nocobase/plugin-custom-request": "0.20.0-alpha.10", + "@nocobase/plugin-data-source-manager": "0.20.0-alpha.10", + "@nocobase/plugin-data-visualization": "0.20.0-alpha.10", + "@nocobase/plugin-error-handler": "0.20.0-alpha.10", + "@nocobase/plugin-export": "0.20.0-alpha.10", + "@nocobase/plugin-file-manager": "0.20.0-alpha.10", + "@nocobase/plugin-formula-field": "0.20.0-alpha.10", + "@nocobase/plugin-gantt": "0.20.0-alpha.10", + "@nocobase/plugin-graph-collection-manager": "0.20.0-alpha.10", + "@nocobase/plugin-iframe-block": "0.20.0-alpha.10", + "@nocobase/plugin-import": "0.20.0-alpha.10", + "@nocobase/plugin-kanban": "0.20.0-alpha.10", + "@nocobase/plugin-localization-management": "0.20.0-alpha.10", + "@nocobase/plugin-logger": "0.20.0-alpha.10", + "@nocobase/plugin-map": "0.20.0-alpha.10", + "@nocobase/plugin-mobile-client": "0.20.0-alpha.10", + "@nocobase/plugin-mock-collections": "0.20.0-alpha.10", + "@nocobase/plugin-multi-app-manager": "0.20.0-alpha.10", + "@nocobase/plugin-multi-app-share-collection": "0.20.0-alpha.10", + "@nocobase/plugin-oidc": "0.20.0-alpha.10", + "@nocobase/plugin-saml": "0.20.0-alpha.10", + "@nocobase/plugin-sequence-field": "0.20.0-alpha.10", + "@nocobase/plugin-sms-auth": "0.20.0-alpha.10", + "@nocobase/plugin-snapshot-field": "0.20.0-alpha.10", + "@nocobase/plugin-system-settings": "0.20.0-alpha.10", + "@nocobase/plugin-theme-editor": "0.20.0-alpha.10", + "@nocobase/plugin-ui-schema-storage": "0.20.0-alpha.10", + "@nocobase/plugin-users": "0.20.0-alpha.10", + "@nocobase/plugin-verification": "0.20.0-alpha.10", + "@nocobase/plugin-workflow": "0.20.0-alpha.10", + "@nocobase/plugin-workflow-action-trigger": "0.20.0-alpha.10", + "@nocobase/plugin-workflow-aggregate": "0.20.0-alpha.10", + "@nocobase/plugin-workflow-delay": "0.20.0-alpha.10", + "@nocobase/plugin-workflow-dynamic-calculation": "0.20.0-alpha.10", + "@nocobase/plugin-workflow-loop": "0.20.0-alpha.10", + "@nocobase/plugin-workflow-manual": "0.20.0-alpha.10", + "@nocobase/plugin-workflow-parallel": "0.20.0-alpha.10", + "@nocobase/plugin-workflow-request": "0.20.0-alpha.10", + "@nocobase/plugin-workflow-sql": "0.20.0-alpha.10", + "@nocobase/server": "0.20.0-alpha.10", "cronstrue": "^2.11.0" }, "repository": { From 42448ecddb1afe455cced9c4a8b6ca78586a060f Mon Sep 17 00:00:00 2001 From: chenos Date: Wed, 13 Mar 2024 22:41:16 +0800 Subject: [PATCH 08/15] chore: update changelog --- CHANGELOG.md | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e038b1b0e..efd999fd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +## [v0.20.0-alpha.10](https://github.com/nocobase/nocobase/compare/v0.20.0-alpha.9...v0.20.0-alpha.10) - 2024-03-13 + +### Merged + +- fix(client): size undefined in nanoid [`#3708`](https://github.com/nocobase/nocobase/pull/3708) +- refactor(radio): radio support multiple field types [`#3706`](https://github.com/nocobase/nocobase/pull/3706) +- fix: get async json schema [`#3705`](https://github.com/nocobase/nocobase/pull/3705) +- fix: select fieldnames [`#3704`](https://github.com/nocobase/nocobase/pull/3704) +- fix: field configuration of Kanban interacts with other block [`#3689`](https://github.com/nocobase/nocobase/pull/3689) +- fix: radio [`#3701`](https://github.com/nocobase/nocobase/pull/3701) +- feat: add uuid & nanoid & unitTimestamp interface [`#3684`](https://github.com/nocobase/nocobase/pull/3684) +- fix(plugin-workflow): fix duplicated triggering schedule event [`#3692`](https://github.com/nocobase/nocobase/pull/3692) +- refactor(client): add component to support data source select [`#3691`](https://github.com/nocobase/nocobase/pull/3691) +- fix(Form): should be created instead of updated when clicking submit [`#3687`](https://github.com/nocobase/nocobase/pull/3687) +- fix: incorrect pagination query parameters when batch deleting last page [`#3670`](https://github.com/nocobase/nocobase/pull/3670) + +### Commits + +- chore(versions): 😊 publish v0.20.0-alpha.10 [`40a2294`](https://github.com/nocobase/nocobase/commit/40a22943b91455734a255b6598178391d7887999) +- chore: update changelog [`a8e37f6`](https://github.com/nocobase/nocobase/commit/a8e37f6224a5a03f90164a2848ad2e9a250bebae) +- fix: add external deps [`24b52c9`](https://github.com/nocobase/nocobase/commit/24b52c98d18f11083e97f584b8e23749846052f0) + ## [v0.20.0-alpha.9](https://github.com/nocobase/nocobase/compare/v0.20.0-alpha.8...v0.20.0-alpha.9) - 2024-03-12 ### Merged @@ -144,11 +166,21 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - chore: update changelog [`eda9a37`](https://github.com/nocobase/nocobase/commit/eda9a37e997c08744e9f648466412b620ccc98cd) - fix: import [`e5a380f`](https://github.com/nocobase/nocobase/commit/e5a380ff394b6f1c2b8b77ad7505e78321c3f471) -## [v0.20.0-alpha.1](https://github.com/nocobase/nocobase/compare/v0.19.0-alpha.9...v0.20.0-alpha.1) - 2024-03-03 +## [v0.20.0-alpha.1](https://github.com/nocobase/nocobase/compare/v0.19.0-alpha.10...v0.20.0-alpha.1) - 2024-03-03 ### Merged - feat: support for multiple data sources [`#3418`](https://github.com/nocobase/nocobase/pull/3418) + +### Commits + +- chore(versions): 😊 publish v0.20.0-alpha.1 [`29e10f3`](https://github.com/nocobase/nocobase/commit/29e10f365fc51e2f9838320cbc1d672dd390a1ef) + +## [v0.19.0-alpha.10](https://github.com/nocobase/nocobase/compare/v0.19.0-alpha.9...v0.19.0-alpha.10) - 2024-03-13 + +### Merged + +- fix: get async json schema [`#3705`](https://github.com/nocobase/nocobase/pull/3705) - fix(plugin-workflow): fix off static schedule trigger [`#3595`](https://github.com/nocobase/nocobase/pull/3595) - fix(plugin-workflow): fix interval number greater then 32-bits integer [`#3592`](https://github.com/nocobase/nocobase/pull/3592) - fix: plugin settings auth bug [`#3585`](https://github.com/nocobase/nocobase/pull/3585) @@ -157,7 +189,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). ### Commits -- chore(versions): 😊 publish v0.20.0-alpha.1 [`29e10f3`](https://github.com/nocobase/nocobase/commit/29e10f365fc51e2f9838320cbc1d672dd390a1ef) +- chore(versions): 😊 publish v0.19.0-alpha.10 [`7a74b10`](https://github.com/nocobase/nocobase/commit/7a74b101f42acdb3d0833214e70cea132b1156e2) - chore: update changelog [`866eccc`](https://github.com/nocobase/nocobase/commit/866eccc60770fa2d2b42138e7083d78730d82de8) ## [v0.19.0-alpha.9](https://github.com/nocobase/nocobase/compare/v0.19.0-alpha.8...v0.19.0-alpha.9) - 2024-02-28 From 69ff55ba9074abf8ecd79985e1b80ef83e780fd0 Mon Sep 17 00:00:00 2001 From: YANG QIA <2013xile@gmail.com> Date: Wed, 13 Mar 2024 23:03:15 +0800 Subject: [PATCH 09/15] fix(data-vi): update antv version (#3710) --- .../plugin-data-visualization/package.json | 2 +- .../src/client/chart/g2plot/g2plot.ts | 2 +- yarn.lock | 458 ++++++++++++++++-- 3 files changed, 427 insertions(+), 35 deletions(-) diff --git a/packages/plugins/@nocobase/plugin-data-visualization/package.json b/packages/plugins/@nocobase/plugin-data-visualization/package.json index 385fdf183..8c8d1c94e 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/package.json +++ b/packages/plugins/@nocobase/plugin-data-visualization/package.json @@ -10,7 +10,7 @@ "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/data-visualization", "devDependencies": { "@ant-design/icons": "5.x", - "@ant-design/plots": "^1.2.5", + "@ant-design/plots": "^2.1.4", "@emotion/css": "^11.7.1", "@formily/antd-v5": "1.x", "@formily/core": "2.x", diff --git a/packages/plugins/@nocobase/plugin-data-visualization/src/client/chart/g2plot/g2plot.ts b/packages/plugins/@nocobase/plugin-data-visualization/src/client/chart/g2plot/g2plot.ts index 5094318af..9277ee836 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/src/client/chart/g2plot/g2plot.ts +++ b/packages/plugins/@nocobase/plugin-data-visualization/src/client/chart/g2plot/g2plot.ts @@ -70,7 +70,7 @@ export class G2PlotChart extends Chart { getReference() { return { title: this.title, - link: `https://ant-design-charts.antgroup.com/api/plots/${this.name}`, + link: `https://g2plot.antv.antgroup.com/api/plots/${this.name}`, }; } } diff --git a/yarn.lock b/yarn.lock index 5110e39b7..f3f0eaa48 100644 --- a/yarn.lock +++ b/yarn.lock @@ -147,6 +147,11 @@ "@jridgewell/gen-mapping" "^0.3.0" "@jridgewell/trace-mapping" "^0.3.9" +"@ant-design/charts-util@0.0.1-alpha.5": + version "0.0.1-alpha.5" + resolved "https://registry.npmjs.org/@ant-design/charts-util/-/charts-util-0.0.1-alpha.5.tgz#bb8ab113194f0ffeddb688d54bfd63d6f0007fb7" + integrity sha512-EwTUjRPhU2CUyI2e11pAi9aOQg9oEWdFEWxv1f4j+Ta4doYXd1yTl94Zy9JvigiEj4qv8dPGl0PUd3r+qMVrAg== + "@ant-design/colors@^6": version "6.0.0" resolved "https://registry.npmmirror.com/@ant-design/colors/-/colors-6.0.0.tgz#9b9366257cffcc47db42b9d0203bb592c13c0298" @@ -210,14 +215,16 @@ classnames "^2.2.6" rc-util "^5.31.1" -"@ant-design/plots@^1.2.5": - version "1.2.6" - resolved "https://registry.npmmirror.com/@ant-design/plots/-/plots-1.2.6.tgz#35e541484069249989f92b7d9cdc835ea87191c5" - integrity sha512-fFzB9DxRSPQa47S3WypRk4Rh+P8vBUuY/DT+IXgUrlKJtvVZUFnuYfjypX3Q/Pie2PEbI6gmskzXLxVF+3Ztvw== +"@ant-design/plots@^2.1.4": + version "2.1.14" + resolved "https://registry.npmjs.org/@ant-design/plots/-/plots-2.1.14.tgz#967a6fbf3e86ad216026fdbb853af1391549c795" + integrity sha512-ZFhvlNUsPcvD8d+nX4bXA9djbEUDVfKm8/xvFplffWT68rWM37d32qI7EghSvLUreszqh60DZAy80wCA08lgoQ== dependencies: - "@antv/g2plot" "^2.2.11" - "@antv/util" "^2.0.9" - react-content-loader "^5.0.4" + "@ant-design/charts-util" "0.0.1-alpha.5" + "@antv/event-emitter" "^0.1.3" + "@antv/g" "^5.18.24" + "@antv/g2" "^5.1.9" + "@antv/g2-extension-plot" "^0.1.1" "@ant-design/pro-layout@^7.16.11": version "7.17.16" @@ -330,6 +337,16 @@ fecha "~4.2.0" tslib "^2.0.3" +"@antv/component@^1.0.1-beta.0": + version "1.0.2" + resolved "https://registry.npmjs.org/@antv/component/-/component-1.0.2.tgz#a5563b7d2264b994ffd7bc45d5820283b64d6fd7" + integrity sha512-n/zYeU7peCnbwVPHzrjN4lWQZCNk665uYFplxnqVSsEV7NMqsptml0EaSxJ5GzYk69uWq+2I5scc/jnljBwULQ== + dependencies: + "@antv/g" "^5.18.6" + "@antv/scale" "^0.4.3" + "@antv/util" "^3.3.5" + svg-path-parser "^1.1.0" + "@antv/coord@^0.3.0": version "0.3.1" resolved "https://registry.npmmirror.com/@antv/coord/-/coord-0.3.1.tgz#982e261d8a1e06a198eb518ea7acc20ed875a019" @@ -339,6 +356,15 @@ "@antv/util" "~2.0.12" tslib "^2.1.0" +"@antv/coord@^0.4.6": + version "0.4.7" + resolved "https://registry.npmjs.org/@antv/coord/-/coord-0.4.7.tgz#3ef6c6e3f9ca0f024b90888549946061f35df77a" + integrity sha512-UTbrMLhwJUkKzqJx5KFnSRpU3BqrdLORJbwUbHK2zHSCT3q3bjcFA//ZYLVfIlwqFDXp/hzfMyRtp0c77A9ZVA== + dependencies: + "@antv/scale" "^0.4.12" + "@antv/util" "^2.0.13" + gl-matrix "^3.4.3" + "@antv/dom-util@^2.0.2", "@antv/dom-util@~2.0.1": version "2.0.4" resolved "https://registry.npmmirror.com/@antv/dom-util/-/dom-util-2.0.4.tgz#b09b56c56fec42896fc856edad56b595b47ab514" @@ -346,7 +372,7 @@ dependencies: tslib "^2.0.3" -"@antv/event-emitter@^0.1.1", "@antv/event-emitter@^0.1.2", "@antv/event-emitter@~0.1.0": +"@antv/event-emitter@^0.1.1", "@antv/event-emitter@^0.1.2", "@antv/event-emitter@^0.1.3", "@antv/event-emitter@~0.1.0": version "0.1.3" resolved "https://registry.npmmirror.com/@antv/event-emitter/-/event-emitter-0.1.3.tgz#3e06323b9dcd55a3241ddc7c5458cfabd2095164" integrity sha512-4ddpsiHN9Pd4UIlWuKVK1C4IiZIdbwQvy9i7DUSI3xNJ89FPUFt8lxDYj8GzzfdllV0NkJTRxnG+FvLk0llidg== @@ -368,6 +394,31 @@ detect-browser "^5.1.0" tslib "^2.0.3" +"@antv/g-camera-api@1.2.23": + version "1.2.23" + resolved "https://registry.npmjs.org/@antv/g-camera-api/-/g-camera-api-1.2.23.tgz#3762940d327503097ed232547548ae5ecb38b837" + integrity sha512-jvKxf00/vTIbfE57koiSh8DMR85M4TeP4P1OntR1pD0SHszapi9DiF1odPrGUlojddmCA4iQr1x9awhEMwcGYA== + dependencies: + "@antv/g-lite" "1.2.22" + "@antv/util" "^3.3.4" + gl-matrix "^3.4.3" + tslib "^2.5.3" + +"@antv/g-canvas@^1.11.22": + version "1.11.27" + resolved "https://registry.npmjs.org/@antv/g-canvas/-/g-canvas-1.11.27.tgz#bb2a3c085642c9b1beab8841d34418419602d217" + integrity sha512-wYYS39BYjb16Ou89/XOd1pa1E/BPc30UlmXjsuN8URrucLiQLQXIRfpqN/oww5ehuXwzfauWpuqhQt8A1VNZDg== + dependencies: + "@antv/g-lite" "1.2.22" + "@antv/g-plugin-canvas-path-generator" "1.3.22" + "@antv/g-plugin-canvas-picker" "1.10.24" + "@antv/g-plugin-canvas-renderer" "1.9.24" + "@antv/g-plugin-dom-interaction" "1.9.22" + "@antv/g-plugin-html-renderer" "1.9.25" + "@antv/g-plugin-image-loader" "1.3.22" + "@antv/util" "^3.3.4" + tslib "^2.5.3" + "@antv/g-canvas@~0.5.10": version "0.5.14" resolved "https://registry.npmmirror.com/@antv/g-canvas/-/g-canvas-0.5.14.tgz#099668cb65d9c89dc2fc1000313c18298dcf8a13" @@ -381,6 +432,35 @@ gl-matrix "^3.0.0" tslib "^2.0.3" +"@antv/g-dom-mutation-observer-api@1.2.22": + version "1.2.22" + resolved "https://registry.npmjs.org/@antv/g-dom-mutation-observer-api/-/g-dom-mutation-observer-api-1.2.22.tgz#f8de838fc51c025a8f46df014d512888ace594bf" + integrity sha512-EwbM1Fy0iVEaNvfJPGi68/bTomcuY/S+MyAQP6eK13rwo3a6nfzNIHdtGv24XQPrN4+q3BT0qey6+M2XxGqf1A== + dependencies: + "@antv/g-lite" "1.2.22" + +"@antv/g-lite@1.2.22": + version "1.2.22" + resolved "https://registry.npmjs.org/@antv/g-lite/-/g-lite-1.2.22.tgz#2141d49ee9b6a77d73f00ca8cc8d62a3ae8a82e3" + integrity sha512-GuVeKH3ogxCitnuyAet5cd9ZISFqGQwiaHsBm0XVAp5QSR/azpZAjNT/FwIUP6m/hbzv6dcJvAM5Ssisc9OcAw== + dependencies: + "@antv/g-math" "2.0.2" + "@antv/util" "^3.3.4" + d3-color "^1.4.0" + eventemitter3 "^5.0.1" + gl-matrix "^3.4.3" + rbush "^3.0.1" + tslib "^2.5.3" + +"@antv/g-math@2.0.2": + version "2.0.2" + resolved "https://registry.npmjs.org/@antv/g-math/-/g-math-2.0.2.tgz#fc37e3e90591a52657553017ddadf55177d18a12" + integrity sha512-uqGU1C+70orjeSUoIzD3TuXjL5dRQCIyjZrBrTmm0FWd6VQJMWHyG5ypuZ2lMiI5MrRajVSE1w+3J4hiNBYSJg== + dependencies: + "@antv/util" "^3.3.4" + gl-matrix "^3.4.3" + tslib "^2.5.3" + "@antv/g-math@^0.1.9": version "0.1.9" resolved "https://registry.npmmirror.com/@antv/g-math/-/g-math-0.1.9.tgz#1f981b9aebf5c024f284389aa3e5cba8cefa1f28" @@ -389,6 +469,79 @@ "@antv/util" "~2.0.0" gl-matrix "^3.0.0" +"@antv/g-plugin-canvas-path-generator@1.3.22": + version "1.3.22" + resolved "https://registry.npmjs.org/@antv/g-plugin-canvas-path-generator/-/g-plugin-canvas-path-generator-1.3.22.tgz#c189495e5a5989996a472c38a72549cc50b2291c" + integrity sha512-RJal9xJ6393SuCZuNqukQr7FMqh3A68AlV0EYSlVLr1uZZlYMvl7ZKSYO149MxzswUCOeK2CjhQvOFKNJW5xcg== + dependencies: + "@antv/g-lite" "1.2.22" + "@antv/g-math" "2.0.2" + "@antv/util" "^3.3.4" + tslib "^2.5.3" + +"@antv/g-plugin-canvas-picker@1.10.24": + version "1.10.24" + resolved "https://registry.npmjs.org/@antv/g-plugin-canvas-picker/-/g-plugin-canvas-picker-1.10.24.tgz#7e6a226fe2af582e73867e99078f0c52d2fdf750" + integrity sha512-rT+ahyHtK9nPv6gzLTF2L8J4UnbgasjoBrmUC0HWf6/IplPrpZNB7nXFvHinLcw9AZvC3OT70BSWLssEhnD5Lw== + dependencies: + "@antv/g-lite" "1.2.22" + "@antv/g-math" "2.0.2" + "@antv/g-plugin-canvas-path-generator" "1.3.22" + "@antv/g-plugin-canvas-renderer" "1.9.24" + "@antv/util" "^3.3.4" + gl-matrix "^3.4.3" + tslib "^2.5.3" + +"@antv/g-plugin-canvas-renderer@1.9.24": + version "1.9.24" + resolved "https://registry.npmjs.org/@antv/g-plugin-canvas-renderer/-/g-plugin-canvas-renderer-1.9.24.tgz#f0a10e734b1fb223be7a91b48f1cabd2f39ed9fe" + integrity sha512-927EX3Pd35ZUP44IIT0ds4I4bTJPDdaREF7IIUuc0EFhXghWDcdq65/cxzVKa/dNYWVkUxQsG9VIjmoNxUhIzw== + dependencies: + "@antv/g-lite" "1.2.22" + "@antv/g-math" "2.0.2" + "@antv/g-plugin-canvas-path-generator" "1.3.22" + "@antv/g-plugin-image-loader" "1.3.22" + "@antv/util" "^3.3.4" + gl-matrix "^3.4.3" + tslib "^2.5.3" + +"@antv/g-plugin-dom-interaction@1.9.22": + version "1.9.22" + resolved "https://registry.npmjs.org/@antv/g-plugin-dom-interaction/-/g-plugin-dom-interaction-1.9.22.tgz#341b82c7bbf854c02a5747aa70c0a121d2941a62" + integrity sha512-Dbd0jHMOL7VLPgGkJbf7okYrhkm2Ie75hvPVKhFSGOtJmNE7CZmP0D9/E3RkxSFb4Gvd9JcSA7hLYig9FwcjBA== + dependencies: + "@antv/g-lite" "1.2.22" + tslib "^2.5.3" + +"@antv/g-plugin-dragndrop@^1.8.17": + version "1.8.22" + resolved "https://registry.npmjs.org/@antv/g-plugin-dragndrop/-/g-plugin-dragndrop-1.8.22.tgz#314e30e7dc7c6f678462da2da0b9230778f40acc" + integrity sha512-wiALMQ68bh5z5OYIU8d3X4DvK4kgIFLGM7yXmI2raOF1i1STyFLElTw7ZZzvVVhftZLQ6Yc4jgEuPcnpquMN4A== + dependencies: + "@antv/g-lite" "1.2.22" + "@antv/util" "^3.3.4" + tslib "^2.5.3" + +"@antv/g-plugin-html-renderer@1.9.25": + version "1.9.25" + resolved "https://registry.npmjs.org/@antv/g-plugin-html-renderer/-/g-plugin-html-renderer-1.9.25.tgz#8d6de8e210c60ce07d9d55bca401093cd626b088" + integrity sha512-E0bRrdtEz7Yx9z8wIABaUtNT2XA/FdqIdwdtxigDwkVgvzcZHV97pd5VZ/VR/XGogEgcEKWxtcQcRXTmKmDQ7g== + dependencies: + "@antv/g-lite" "1.2.22" + "@antv/util" "^3.3.4" + gl-matrix "^3.4.3" + tslib "^2.5.3" + +"@antv/g-plugin-image-loader@1.3.22": + version "1.3.22" + resolved "https://registry.npmjs.org/@antv/g-plugin-image-loader/-/g-plugin-image-loader-1.3.22.tgz#7050f0133eb4226eeb1f0682b53210cc0c45a387" + integrity sha512-AgkC+MGNG4cLRyi7XtEqfgf9ceqbet3awTibZs6OroX5B0pQVyAarXvW/A92jlvrY2jq0ccokTPjBcRmhTegxA== + dependencies: + "@antv/g-lite" "1.2.22" + "@antv/util" "^3.3.4" + gl-matrix "^3.4.3" + tslib "^2.5.3" + "@antv/g-svg@~0.5.6": version "0.5.7" resolved "https://registry.npmmirror.com/@antv/g-svg/-/g-svg-0.5.7.tgz#d63db5f8590a5f3ceab097c183ec80ed143f0a50" @@ -400,6 +553,26 @@ detect-browser "^5.0.0" tslib "^2.0.3" +"@antv/g-web-animations-api@1.2.23": + version "1.2.23" + resolved "https://registry.npmjs.org/@antv/g-web-animations-api/-/g-web-animations-api-1.2.23.tgz#93451ae8efc36badf912f632ca3ed0509e204c77" + integrity sha512-/II55fB3ox4BulBWgBp2AAEOKZm5N1izly5/AbJcCC9NIUfRu4227SBq5qWMuegnW7nFUPBkKY/ejDBO64JKkw== + dependencies: + "@antv/g-lite" "1.2.22" + "@antv/util" "^3.3.4" + tslib "^2.5.3" + +"@antv/g2-extension-plot@^0.1.1": + version "0.1.1" + resolved "https://registry.npmjs.org/@antv/g2-extension-plot/-/g2-extension-plot-0.1.1.tgz#256b13b7e0084c057db2e6597b93357963590607" + integrity sha512-yruGQudJYL/3/2/mHA0+WRW6oJ+YX4ZWMSqGu6eY5+ooqvTgeeF91KHixrodiPfiZZ+zDFrNeZ0HsOcLuHB+YA== + dependencies: + "@antv/g" "^5.18.19" + "@antv/g2" "^5.1.8" + "@antv/util" "^3.3.5" + d3-array "^3.2.4" + d3-hierarchy "^3.1.2" + "@antv/g2@^4.1.26": version "4.2.10" resolved "https://registry.npmmirror.com/@antv/g2/-/g2-4.2.10.tgz#9448082e7610eb8d16bdf7c97c2ce4f275bafdf9" @@ -421,7 +594,35 @@ "@antv/util" "~2.0.5" tslib "^2.0.0" -"@antv/g2plot@^2.2.11", "@antv/g2plot@^2.4.18": +"@antv/g2@^5.1.8", "@antv/g2@^5.1.9": + version "5.1.15" + resolved "https://registry.npmjs.org/@antv/g2/-/g2-5.1.15.tgz#c6abb97f6164a27b04ea832931424845fbb2c2ef" + integrity sha512-WiISs4GUOzHlA4vrkt+eQfr1+LVIAuv4AkfFCRzTprayMO72pLAdgTcwUg9YlvafwM220r9FQD1nXIlYNXOOhA== + dependencies: + "@antv/component" "^1.0.1-beta.0" + "@antv/coord" "^0.4.6" + "@antv/event-emitter" "^0.1.3" + "@antv/g" "^5.18.19" + "@antv/g-canvas" "^1.11.22" + "@antv/g-plugin-dragndrop" "^1.8.17" + "@antv/path-util" "^3.0.1" + "@antv/scale" "^0.4.12" + "@antv/util" "^3.3.5" + d3-array "^3.2.4" + d3-dsv "^3.0.1" + d3-force "^3.0.0" + d3-format "^3.1.0" + d3-geo "^3.1.0" + d3-hierarchy "^3.1.2" + d3-path "^3.1.0" + d3-scale-chromatic "^3.0.0" + d3-shape "^3.2.0" + d3-voronoi "^1.1.4" + flru "^1.0.2" + fmin "^0.0.2" + pdfast "^0.2.0" + +"@antv/g2plot@^2.4.18": version "2.4.31" resolved "https://registry.npmmirror.com/@antv/g2plot/-/g2plot-2.4.31.tgz#b444aee07d06939949eaa8ba8f8e93f948634aa5" integrity sha512-SlWHYVsJgRN7E1Oe5Qk6yWBrSWmctmloknFmklaqe9vEeK+YB9ZLUffZvtAHT10mA2NZ+VjGUhlnMNgR9M1PQg== @@ -441,6 +642,16 @@ size-sensor "^1.0.1" tslib "^2.0.3" +"@antv/g@^5.18.19", "@antv/g@^5.18.24", "@antv/g@^5.18.6": + version "5.18.25" + resolved "https://registry.npmjs.org/@antv/g/-/g-5.18.25.tgz#ba0062d7e33f4dab93067fc74cc091715f617b6e" + integrity sha512-KZyOBIuJ4BoRi/rYERE86QdHMFH75XyC/9yRjDzEoiB1SYWqL+z+0VuaCR7/pqHW1d1SHq/nnjawHe7MMiWKLA== + dependencies: + "@antv/g-camera-api" "1.2.23" + "@antv/g-dom-mutation-observer-api" "1.2.22" + "@antv/g-lite" "1.2.22" + "@antv/g-web-animations-api" "1.2.23" + "@antv/matrix-util@^3.0.4": version "3.0.4" resolved "https://registry.npmmirror.com/@antv/matrix-util/-/matrix-util-3.0.4.tgz#ea13f158aa2fb4ba2fb8d6b6b561ec467ea3ac20" @@ -486,7 +697,16 @@ fecha "~4.2.0" tslib "^2.0.0" -"@antv/util@^2.0.17", "@antv/util@^2.0.9", "@antv/util@~2.0.0", "@antv/util@~2.0.12", "@antv/util@~2.0.13", "@antv/util@~2.0.3", "@antv/util@~2.0.5": +"@antv/scale@^0.4.12", "@antv/scale@^0.4.3": + version "0.4.15" + resolved "https://registry.npmjs.org/@antv/scale/-/scale-0.4.15.tgz#491f3443f81c024f2bd9ac991bffa6e62809fe7f" + integrity sha512-b3b2U1L55fcJg0fB/BloVvcngPo/QxhosWgjn6JmYLVLezxDYMO+zdQou8hxpsLMUVhH15NqRDcM/1n4U6G04g== + dependencies: + "@antv/util" "^2.0.13" + color-string "^1.5.5" + fecha "^4.2.1" + +"@antv/util@^2.0.13", "@antv/util@^2.0.17", "@antv/util@^2.0.9", "@antv/util@~2.0.0", "@antv/util@~2.0.12", "@antv/util@~2.0.13", "@antv/util@~2.0.3", "@antv/util@~2.0.5": version "2.0.17" resolved "https://registry.npmmirror.com/@antv/util/-/util-2.0.17.tgz#e8ef42aca7892815b229269f3dd10c6b3c7597a9" integrity sha512-o6I9hi5CIUvLGDhth0RxNSFDRwXeywmt6ExR4+RmVAzIi48ps6HUy+svxOCayvrPBN37uE6TAc2KDofRo0nK9Q== @@ -494,6 +714,15 @@ csstype "^3.0.8" tslib "^2.0.3" +"@antv/util@^3.3.4", "@antv/util@^3.3.5": + version "3.3.7" + resolved "https://registry.npmjs.org/@antv/util/-/util-3.3.7.tgz#35a900f0e9b65defbb92ec0e92a20b8189a18815" + integrity sha512-qqPg7rIPCsJyl7N56jAC25v/99mJ3ApVkgBsGijhiWrEeKvzXBPk1r5P77Pm9nCljpnn+hH8Z3t5AivbEoTJMg== + dependencies: + fast-deep-equal "^3.1.3" + gl-matrix "^3.3.0" + tslib "^2.3.1" + "@antv/x6-common@^2.0.16": version "2.0.16" resolved "https://registry.npmmirror.com/@antv/x6-common/-/x6-common-2.0.16.tgz#f5b12c3eb7afd5736deb1c9bd899c83de08d77f3" @@ -4507,6 +4736,15 @@ dependencies: "@opentelemetry/semantic-conventions" "1.19.0" +"@opentelemetry/exporter-prometheus@^0.46.0": + version "0.46.0" + resolved "https://registry.npmjs.org/@opentelemetry/exporter-prometheus/-/exporter-prometheus-0.46.0.tgz#c411a1e8a5266f9f3ddc44a088a538c3c1ee4830" + integrity sha512-AXcoCHG31K2PLGizlJJWcfQqZsGfUZkT7ik6C8VJu7U2Cenk0Xhvd3rO+vVNSSjP1+LHkP4MQtqEXpIZttw5cw== + dependencies: + "@opentelemetry/core" "1.19.0" + "@opentelemetry/resources" "1.19.0" + "@opentelemetry/sdk-metrics" "1.19.0" + "@opentelemetry/instrumentation@^0.46.0": version "0.46.0" resolved "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.46.0.tgz#a8a252306f82e2eace489312798592a14eb9830e" @@ -4540,7 +4778,7 @@ "@opentelemetry/core" "1.19.0" "@opentelemetry/semantic-conventions" "1.19.0" -"@opentelemetry/sdk-metrics@^1.19.0": +"@opentelemetry/sdk-metrics@1.19.0", "@opentelemetry/sdk-metrics@^1.19.0": version "1.19.0" resolved "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-1.19.0.tgz#fe8029af29402563eb8dba75a85fc02006ea92c4" integrity sha512-FiMii40zr0Fmys4F1i8gmuCvbinBnBsDeGBr4FQemOf0iPCLytYQm5AZJ/nn4xSc71IgKBQwTFQRAGJI7JvZ4Q== @@ -6430,6 +6668,15 @@ dependencies: "@types/express" "*" +"@types/pg@^8.10.9": + version "8.11.2" + resolved "https://registry.npmjs.org/@types/pg/-/pg-8.11.2.tgz#e5c306601d2e0cc54c0801cc61a41761c8a95c92" + integrity sha512-G2Mjygf2jFMU/9hCaTYxJrwdObdcnuQde1gndooZSOHsNSaCehAuwc7EIuSA34Do8Jx2yZ19KtvW8P0j4EuUXw== + dependencies: + "@types/node" "*" + pg-protocol "*" + pg-types "^4.0.1" + "@types/picomatch@*": version "2.3.3" resolved "https://registry.npmmirror.com/@types/picomatch/-/picomatch-2.3.3.tgz#be60498568c19e989e43fb39aa84be1ed3655e92" @@ -8569,7 +8816,7 @@ bessel@^1.0.2: resolved "https://registry.npmmirror.com/bessel/-/bessel-1.0.2.tgz#828812291e0b62e94959cdea43fac186e8a7202d" integrity sha512-Al3nHGQGqDYqqinXhQzmwmcRToe/3WyBv4N8aZc5Pef8xw2neZlR9VPi84Sa23JtgWcucu18HxVZrnI0fn2etw== -big-integer@^1.6.44: +big-integer@^1.6.44, big-integer@^1.6.48: version "1.6.52" resolved "https://registry.npmmirror.com/big-integer/-/big-integer-1.6.52.tgz#60a887f3047614a8e1bffe5d7173490a97dc8c85" integrity sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg== @@ -9759,7 +10006,7 @@ color-name@^1.0.0, color-name@~1.1.4: resolved "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -color-string@^1.6.0: +color-string@^1.5.5, color-string@^1.6.0: version "1.9.1" resolved "https://registry.npmmirror.com/color-string/-/color-string-1.9.1.tgz#4467f9146f036f855b764dfb5bf8582bf342c7a4" integrity sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg== @@ -10675,7 +10922,7 @@ cytoscape@^3.23.0: heap "^0.2.6" lodash "^4.17.21" -"d3-array@2 - 3", "d3-array@2.10.0 - 3", "d3-array@2.5.0 - 3", d3-array@3, d3-array@^3.2.0: +"d3-array@2 - 3", "d3-array@2.10.0 - 3", "d3-array@2.5.0 - 3", d3-array@3, d3-array@^3.2.0, d3-array@^3.2.4: version "3.2.4" resolved "https://registry.npmmirror.com/d3-array/-/d3-array-3.2.4.tgz#15fec33b237f97ac5d7c986dc77da273a8ed0bb5" integrity sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg== @@ -10710,6 +10957,11 @@ d3-chord@3: resolved "https://registry.npmmirror.com/d3-color/-/d3-color-3.1.0.tgz#395b2833dfac71507f12ac2f7af23bf819de24e2" integrity sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA== +d3-color@^1.4.0: + version "1.4.1" + resolved "https://registry.npmjs.org/d3-color/-/d3-color-1.4.1.tgz#c52002bf8846ada4424d55d97982fef26eb3bc8a" + integrity sha512-p2sTHSLCJI2QKunbGb7ocOh7DgTAn8IrLx21QRc/BSnodXM4sv6aLQlnfpvehFMLZEfBc6g9pH9SWQccFYfJ9Q== + d3-contour@4: version "4.0.2" resolved "https://registry.npmmirror.com/d3-contour/-/d3-contour-4.0.2.tgz#bb92063bc8c5663acb2422f99c73cbb6c6ae3bcc" @@ -10737,7 +10989,7 @@ d3-delaunay@6: d3-dispatch "1 - 3" d3-selection "3" -"d3-dsv@1 - 3", d3-dsv@3: +"d3-dsv@1 - 3", d3-dsv@3, d3-dsv@^3.0.1: version "3.0.1" resolved "https://registry.npmmirror.com/d3-dsv/-/d3-dsv-3.0.1.tgz#c63af978f4d6a0d084a52a673922be2160789b73" integrity sha512-UG6OvdI5afDIFP9w4G0mNq50dSOsXHJaRE8arAS5o9ApWnIElp8GZw1Dun8vP8OyHOZ/QJUKUJwxiiCCnUwm+Q== @@ -10763,7 +11015,7 @@ d3-fetch@3: dependencies: d3-dsv "1 - 3" -d3-force@3: +d3-force@3, d3-force@^3.0.0: version "3.0.0" resolved "https://registry.npmmirror.com/d3-force/-/d3-force-3.0.0.tgz#3e2ba1a61e70888fe3d9194e30d6d14eece155c4" integrity sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg== @@ -10772,7 +11024,7 @@ d3-force@3: d3-quadtree "1 - 3" d3-timer "1 - 3" -"d3-format@1 - 3", d3-format@3: +"d3-format@1 - 3", d3-format@3, d3-format@^3.1.0: version "3.1.0" resolved "https://registry.npmmirror.com/d3-format/-/d3-format-3.1.0.tgz#9260e23a28ea5cb109e93b21a06e24e2ebd55641" integrity sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA== @@ -10784,7 +11036,14 @@ d3-geo@3: dependencies: d3-array "2.5.0 - 3" -d3-hierarchy@3: +d3-geo@^3.1.0: + version "3.1.1" + resolved "https://registry.npmjs.org/d3-geo/-/d3-geo-3.1.1.tgz#6027cf51246f9b2ebd64f99e01dc7c3364033a4d" + integrity sha512-637ln3gXKXOwhalDzinUgY83KzNWZRKbYubaG+fGVuc/dxO64RRljtCTnf5ecMyE1RIdtqpkVcq0IbtU2S8j2Q== + dependencies: + d3-array "2.5.0 - 3" + +d3-hierarchy@3, d3-hierarchy@^3.1.2: version "3.1.2" resolved "https://registry.npmmirror.com/d3-hierarchy/-/d3-hierarchy-3.1.2.tgz#b01cd42c1eed3d46db77a5966cf726f8c09160c6" integrity sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA== @@ -10834,6 +11093,14 @@ d3-scale-chromatic@3: d3-color "1 - 3" d3-interpolate "1 - 3" +d3-scale-chromatic@^3.0.0: + version "3.1.0" + resolved "https://registry.npmjs.org/d3-scale-chromatic/-/d3-scale-chromatic-3.1.0.tgz#34c39da298b23c20e02f1a4b239bd0f22e7f1314" + integrity sha512-A3s5PWiZ9YCXFye1o246KoscMWqf8BsD9eRiJ3He7C9OBaxKhAd5TFCdEx/7VbKtxxTsu//1mMJFrEt572cEyQ== + dependencies: + d3-color "1 - 3" + d3-interpolate "1 - 3" + d3-scale@4: version "4.0.2" resolved "https://registry.npmmirror.com/d3-scale/-/d3-scale-4.0.2.tgz#82b38e8e8ff7080764f8dcec77bd4be393689396" @@ -10850,7 +11117,7 @@ d3-scale@4: resolved "https://registry.npmmirror.com/d3-selection/-/d3-selection-3.0.0.tgz#c25338207efa72cc5b9bd1458a1a41901f1e1b31" integrity sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ== -d3-shape@3: +d3-shape@3, d3-shape@^3.2.0: version "3.2.0" resolved "https://registry.npmmirror.com/d3-shape/-/d3-shape-3.2.0.tgz#a1a839cbd9ba45f28674c69d7f855bcf91dfc6a5" integrity sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA== @@ -10892,6 +11159,11 @@ d3-timer@^1.0.9: d3-interpolate "1 - 3" d3-timer "1 - 3" +d3-voronoi@^1.1.4: + version "1.1.4" + resolved "https://registry.npmjs.org/d3-voronoi/-/d3-voronoi-1.1.4.tgz#dd3c78d7653d2bb359284ae478645d95944c8297" + integrity sha512-dArJ32hchFsrQ8uMiTBLq256MpnZjeuBtdHpaDlYuQyjU0CVzCJl/BVW+SkszaAeH95D/8gxqAhgx0ouAWAfRg== + d3-zoom@3, d3-zoom@^3.0.0: version "3.0.0" resolved "https://registry.npmmirror.com/d3-zoom/-/d3-zoom-3.0.0.tgz#d13f4165c73217ffeaa54295cd6969b3e7aee8f3" @@ -11375,7 +11647,7 @@ delegates@^1.0.0: resolved "https://registry.npmmirror.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" integrity sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ== -denque@^2.0.1: +denque@^2.0.1, denque@^2.1.0: version "2.1.0" resolved "https://registry.npmmirror.com/denque/-/denque-2.1.0.tgz#e93e1a6569fb5e66f16a3c2a2964617d349d6ab1" integrity sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw== @@ -13000,7 +13272,7 @@ fd-slicer@~1.1.0: dependencies: pend "~1.2.0" -fecha@^4.2.0, fecha@~4.2.0: +fecha@^4.2.0, fecha@^4.2.1, fecha@~4.2.0: version "4.2.3" resolved "https://registry.npmmirror.com/fecha/-/fecha-4.2.3.tgz#4d9ccdbc61e8629b259fdca67e65891448d569fd" integrity sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw== @@ -13248,6 +13520,11 @@ flatted@^3.2.9: resolved "https://registry.npmmirror.com/flatted/-/flatted-3.2.9.tgz#7eb4c67ca1ba34232ca9d2d93e9886e611ad7daf" integrity sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ== +flru@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/flru/-/flru-1.0.2.tgz#1ae514c62b8b035ffff9ca9e4563ddcc817f4845" + integrity sha512-kWyh8ADvHBFz6ua5xYOPnUroZTT/bwWfrCeL0Wj1dzG4/YOmOcfJ99W8dOVyyynJN35rZ9aCOtHChqQovV7yog== + flush-write-stream@^1.0.0, flush-write-stream@^1.0.2: version "1.1.1" resolved "https://registry.npmmirror.com/flush-write-stream/-/flush-write-stream-1.1.1.tgz#8dd7d873a1babc207d94ead0c2e0e44276ebf2e8" @@ -15916,6 +16193,11 @@ jest-worker@^29.7.0: merge-stream "^2.0.0" supports-color "^8.0.0" +jmespath@^0.16.0: + version "0.16.0" + resolved "https://registry.npmjs.org/jmespath/-/jmespath-0.16.0.tgz#b15b0a85dfd4d930d43e69ed605943c802785076" + integrity sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw== + jose@^4.15.1: version "4.15.4" resolved "https://registry.npmmirror.com/jose/-/jose-4.15.4.tgz#02a9a763803e3872cf55f29ecef0dfdcc218cc03" @@ -16105,6 +16387,11 @@ json5@^2.1.2, json5@^2.2.2, json5@^2.2.3: resolved "https://registry.npmmirror.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== +jsonata@^2.0.3: + version "2.0.4" + resolved "https://registry.npmjs.org/jsonata/-/jsonata-2.0.4.tgz#d8575d4c7695a2086162a2baebce0f0ee4e84fdb" + integrity sha512-vfavX4/G/yrYxE+UrmT/oUJ3ph7KqUrb0R7b0LVRcntQwxw+Z5kA1pNUIQzX5hF04Oe1eKxyoIPsmXtc2LgJTQ== + jsonc-parser@^3.2.0: version "3.2.0" resolved "https://registry.npmmirror.com/jsonc-parser/-/jsonc-parser-3.2.0.tgz#31ff3f4c2b9793f89c67212627c51c6394f88e76" @@ -16138,6 +16425,11 @@ jsonparse@^1.2.0, jsonparse@^1.3.1: resolved "https://registry.npmmirror.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" integrity sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg== +jsonpath-plus@^7.2.0: + version "7.2.0" + resolved "https://registry.npmjs.org/jsonpath-plus/-/jsonpath-plus-7.2.0.tgz#7ad94e147b3ed42f7939c315d2b9ce490c5a3899" + integrity sha512-zBfiUPM5nD0YZSBT/o/fbCUlCcepMIdP0CJZxM1+KgA4f2T206f6VAg9e7mX35+KlMaIc5qXW34f3BnwJ3w+RA== + jsonwebtoken@^8.5.1: version "8.5.1" resolved "https://registry.npmmirror.com/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz#00e71e0b8df54c2121a1f26137df2280673bcc0d" @@ -16909,7 +17201,7 @@ long@^4.0.0: resolved "https://registry.npmmirror.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== -long@^5.2.0: +long@^5.2.0, long@^5.2.1: version "5.2.3" resolved "https://registry.npmmirror.com/long/-/long-5.2.3.tgz#a3ba97f3877cf1d778eccbcb048525ebb77499e1" integrity sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q== @@ -16955,7 +17247,7 @@ lowercase-keys@^2.0.0: resolved "https://registry.npmmirror.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479" integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA== -lru-cache@8.0.5: +lru-cache@8.0.5, lru-cache@^8.0.0: version "8.0.5" resolved "https://registry.npmmirror.com/lru-cache/-/lru-cache-8.0.5.tgz#983fe337f3e176667f8e567cfcce7cb064ea214e" integrity sha512-MhWWlVnuab1RG5/zMRRcVGXZLCXrZTgfwMikgzCegsPnG62yDQo5JnqKkrK4jO5iKqDAZGItAqN5CtKBCBWRUA== @@ -18329,6 +18621,20 @@ mysql2@^2.3.3: seq-queue "^0.0.5" sqlstring "^2.3.2" +mysql2@^3.9.1: + version "3.9.2" + resolved "https://registry.npmjs.org/mysql2/-/mysql2-3.9.2.tgz#567343581f9742032598b6c15bd7aa65d2f7d4af" + integrity sha512-3Cwg/UuRkAv/wm6RhtPE5L7JlPB877vwSF6gfLAS68H+zhH+u5oa3AieqEd0D0/kC3W7qIhYbH419f7O9i/5nw== + dependencies: + denque "^2.1.0" + generate-function "^2.3.1" + iconv-lite "^0.6.3" + long "^5.2.1" + lru-cache "^8.0.0" + named-placeholders "^1.1.3" + seq-queue "^0.0.5" + sqlstring "^2.3.2" + mz@^2.7.0: version "2.7.0" resolved "https://registry.npmmirror.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" @@ -18338,7 +18644,7 @@ mz@^2.7.0: object-assign "^4.0.1" thenify-all "^1.0.0" -named-placeholders@^1.1.2: +named-placeholders@^1.1.2, named-placeholders@^1.1.3: version "1.1.3" resolved "https://registry.npmmirror.com/named-placeholders/-/named-placeholders-1.1.3.tgz#df595799a36654da55dda6152ba7a137ad1d9351" integrity sha512-eLoBxg6wE/rZkJPhU/xRX1WTpkFEwDJEN96oxFrTsqBdbT5ec295Q+CoHrL9IT0DipqKhmGcaZmwOt8OON5x1w== @@ -18570,6 +18876,13 @@ node-releases@^2.0.14: resolved "https://registry.npmmirror.com/node-releases/-/node-releases-2.0.14.tgz#2ffb053bceb8b2be8495ece1ab6ce600c4461b0b" integrity sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw== +node-sql-parser@^4.11.0: + version "4.18.0" + resolved "https://registry.npmjs.org/node-sql-parser/-/node-sql-parser-4.18.0.tgz#516b6e633c55c5abbba1ca588ab372db81ae9318" + integrity sha512-2YEOR5qlI1zUFbGMLKNfsrR5JUvFg9LxIRVE+xJe962pfVLH0rnItqLzv96XVs1Y1UIR8FxsXAuvX/lYAWZ2BQ== + dependencies: + big-integer "^1.6.48" + node-xlsx@^0.16.1: version "0.16.2" resolved "https://registry.npmmirror.com/node-xlsx/-/node-xlsx-0.16.2.tgz#40f580187eae0e032cac96e958e97cb6ceca09f6" @@ -19033,7 +19346,7 @@ object.values@^1.1.6, object.values@^1.1.7: define-properties "^1.2.0" es-abstract "^1.22.1" -obuf@^1.0.0, obuf@^1.1.2: +obuf@^1.0.0, obuf@^1.1.2, obuf@~1.1.2: version "1.1.2" resolved "https://registry.npmmirror.com/obuf/-/obuf-1.1.2.tgz#09bea3343d41859ebd446292d11c9d4db619084e" integrity sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg== @@ -19862,12 +20175,17 @@ pg-int8@1.0.1: resolved "https://registry.npmmirror.com/pg-int8/-/pg-int8-1.0.1.tgz#943bd463bf5b71b4170115f80f8efc9a0c0eb78c" integrity sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw== +pg-numeric@1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/pg-numeric/-/pg-numeric-1.0.2.tgz#816d9a44026086ae8ae74839acd6a09b0636aa3a" + integrity sha512-BM/Thnrw5jm2kKLE5uJkXqqExRUY/toLHda65XgFTBTFYZyopbKjBe29Ii3RbkvlsMoFwD+tHeGaCjjv0gHlyw== + pg-pool@^3.6.1: version "3.6.1" resolved "https://registry.npmmirror.com/pg-pool/-/pg-pool-3.6.1.tgz#5a902eda79a8d7e3c928b77abf776b3cb7d351f7" integrity sha512-jizsIzhkIitxCGfPRzJn1ZdcosIt3pz9Sh3V01fm1vZnbnCMgmGl5wvGGdNN2EL9Rmb0EcFoCkixH4Pu+sP9Og== -pg-protocol@^1.6.0: +pg-protocol@*, pg-protocol@^1.6.0: version "1.6.0" resolved "https://registry.npmmirror.com/pg-protocol/-/pg-protocol-1.6.0.tgz#4c91613c0315349363af2084608db843502f8833" integrity sha512-M+PDm637OY5WM307051+bsDia5Xej6d9IR4GwJse1qA1DIhiKlksvrneZOYQq42OM+spubpcNYEo2FcKQrDk+Q== @@ -19883,7 +20201,20 @@ pg-types@^2.1.0: postgres-date "~1.0.4" postgres-interval "^1.1.0" -pg@^8.7.3: +pg-types@^4.0.1: + version "4.0.2" + resolved "https://registry.npmjs.org/pg-types/-/pg-types-4.0.2.tgz#399209a57c326f162461faa870145bb0f918b76d" + integrity sha512-cRL3JpS3lKMGsKaWndugWQoLOCoP+Cic8oseVcbr0qhPzYD5DWXK+RZ9LY9wxRf7RQia4SCwQlXk0q6FCPrVng== + dependencies: + pg-int8 "1.0.1" + pg-numeric "1.0.2" + postgres-array "~3.0.1" + postgres-bytea "~3.0.0" + postgres-date "~2.1.0" + postgres-interval "^3.0.0" + postgres-range "^1.1.1" + +pg@^8.11.3, pg@^8.7.3: version "8.11.3" resolved "https://registry.npmmirror.com/pg/-/pg-8.11.3.tgz#d7db6e3fe268fcedd65b8e4599cda0b8b4bf76cb" integrity sha512-+9iuvG8QfaaUrrph+kpF24cXkH1YOOUeArRNYIxq1viYHZagBxrTno7cecY1Fa44tJeZvaoG+Djpkc3JwehN5g== @@ -20481,16 +20812,33 @@ postgres-array@~2.0.0: resolved "https://registry.npmmirror.com/postgres-array/-/postgres-array-2.0.0.tgz#48f8fce054fbc69671999329b8834b772652d82e" integrity sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA== +postgres-array@~3.0.1: + version "3.0.2" + resolved "https://registry.npmjs.org/postgres-array/-/postgres-array-3.0.2.tgz#68d6182cb0f7f152a7e60dc6a6889ed74b0a5f98" + integrity sha512-6faShkdFugNQCLwucjPcY5ARoW1SlbnrZjmGl0IrrqewpvxvhSLHimCVzqeuULCbG0fQv7Dtk1yDbG3xv7Veog== + postgres-bytea@~1.0.0: version "1.0.0" resolved "https://registry.npmmirror.com/postgres-bytea/-/postgres-bytea-1.0.0.tgz#027b533c0aa890e26d172d47cf9ccecc521acd35" integrity sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w== +postgres-bytea@~3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-3.0.0.tgz#9048dc461ac7ba70a6a42d109221619ecd1cb089" + integrity sha512-CNd4jim9RFPkObHSjVHlVrxoVQXz7quwNFpz7RY1okNNme49+sVyiTvTRobiLV548Hx/hb1BG+iE7h9493WzFw== + dependencies: + obuf "~1.1.2" + postgres-date@~1.0.4: version "1.0.7" resolved "https://registry.npmmirror.com/postgres-date/-/postgres-date-1.0.7.tgz#51bc086006005e5061c591cee727f2531bf641a8" integrity sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q== +postgres-date@~2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/postgres-date/-/postgres-date-2.1.0.tgz#b85d3c1fb6fb3c6c8db1e9942a13a3bf625189d0" + integrity sha512-K7Juri8gtgXVcDfZttFKVmhglp7epKb1K4pgrkLxehjqkrgPhfG6OO8LHLkfaqkbpjNRnra018XwAr1yQFWGcA== + postgres-interval@^1.1.0: version "1.2.0" resolved "https://registry.npmmirror.com/postgres-interval/-/postgres-interval-1.2.0.tgz#b460c82cb1587507788819a06aa0fffdb3544695" @@ -20498,6 +20846,16 @@ postgres-interval@^1.1.0: dependencies: xtend "^4.0.0" +postgres-interval@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/postgres-interval/-/postgres-interval-3.0.0.tgz#baf7a8b3ebab19b7f38f07566c7aab0962f0c86a" + integrity sha512-BSNDnbyZCXSxgA+1f5UU2GmwhoI0aU5yMxRGO8CdFEcY2BQF9xm/7MqKnYoM1nJDk8nONNWDk9WeSmePFhQdlw== + +postgres-range@^1.1.1: + version "1.1.4" + resolved "https://registry.npmjs.org/postgres-range/-/postgres-range-1.1.4.tgz#a59c5f9520909bcec5e63e8cf913a92e4c952863" + integrity sha512-i/hbxIE9803Alj/6ytL7UHQxRvZkI9O4Sy+J3HGc4F4oo/2eQAjTSNJ0bfxyse3bH0nuVesCk+3IRLaMtG3H6w== + prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.npmmirror.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" @@ -20865,6 +21223,11 @@ quick-lru@^4.0.1: resolved "https://registry.npmmirror.com/quick-lru/-/quick-lru-4.0.1.tgz#5b8878f113a58217848c6482026c73e1ba57727f" integrity sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g== +quickselect@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/quickselect/-/quickselect-2.0.0.tgz#f19680a486a5eefb581303e023e98faaf25dd018" + integrity sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw== + quill-delta@^3.6.2: version "3.6.3" resolved "https://registry.npmmirror.com/quill-delta/-/quill-delta-3.6.3.tgz#b19fd2b89412301c60e1ff213d8d860eac0f1032" @@ -20934,6 +21297,13 @@ raw-loader@^4.0.2: loader-utils "^2.0.0" schema-utils "^3.0.0" +rbush@^3.0.1: + version "3.0.1" + resolved "https://registry.npmjs.org/rbush/-/rbush-3.0.1.tgz#5fafa8a79b3b9afdfe5008403a720cc1de882ecf" + integrity sha512-XRaVO0YecOpEuIvbhbpTrZgoiI6xBlz6hnlr6EHhd+0x9ase6EmeN+hdwwUaJvLcsFFQ8iWVF1GAK1yB0BWi0w== + dependencies: + quickselect "^2.0.0" + rc-align@^4.0.0: version "4.0.15" resolved "https://registry.npmmirror.com/rc-align/-/rc-align-4.0.15.tgz#2bbd665cf85dfd0b0244c5a752b07565e9098577" @@ -21412,11 +21782,6 @@ react-colorful@^5.5.1: resolved "https://registry.npmmirror.com/react-colorful/-/react-colorful-5.6.1.tgz#7dc2aed2d7c72fac89694e834d179e32f3da563b" integrity sha512-1exovf0uGTGyq5mXQT0zgQ80uvj2PCwvF8zY1RN9/vbJVSjSo3fsB/4L3ObbF7u70NduSiK4xu4Y6q1MHoUGEw== -react-content-loader@^5.0.4: - version "5.1.4" - resolved "https://registry.npmmirror.com/react-content-loader/-/react-content-loader-5.1.4.tgz#854bafe4415dd9de07174621375bc308edd0ebb5" - integrity sha512-hTq7pZi2GKCK6a9d3u6XStozm0QGCEjw8cSqQReiWnh2up6IwCha5R5TF0o6SY5qUDpByloEZEZtnFxpJyENFw== - react-copy-to-clipboard@^5.1.0: version "5.1.0" resolved "https://registry.npmmirror.com/react-copy-to-clipboard/-/react-copy-to-clipboard-5.1.0.tgz#09aae5ec4c62750ccb2e6421a58725eabc41255c" @@ -22766,6 +23131,28 @@ sequelize@^6.26.0: validator "^13.9.0" wkx "^0.5.0" +sequelize@^6.35.0: + version "6.37.1" + resolved "https://registry.npmjs.org/sequelize/-/sequelize-6.37.1.tgz#9380fe0a3b5ff17638d3fce30c3cf3a2396c2343" + integrity sha512-vIKKzQ9dGp2aBOxQRD1FmUYViuQiKXSJ8yah8TsaBx4U3BokJt+Y2A0qz2C4pj08uX59qpWxRqSLEfRmVOEgQw== + dependencies: + "@types/debug" "^4.1.8" + "@types/validator" "^13.7.17" + debug "^4.3.4" + dottie "^2.0.6" + inflection "^1.13.4" + lodash "^4.17.21" + moment "^2.29.4" + moment-timezone "^0.5.43" + pg-connection-string "^2.6.1" + retry-as-promised "^7.0.4" + semver "^7.5.4" + sequelize-pool "^7.1.0" + toposort-class "^1.0.1" + uuid "^8.3.2" + validator "^13.9.0" + wkx "^0.5.0" + serve-handler@6.1.3: version "6.1.3" resolved "https://registry.npmmirror.com/serve-handler/-/serve-handler-6.1.3.tgz#1bf8c5ae138712af55c758477533b9117f6435e8" @@ -23883,6 +24270,11 @@ svg-parser@^2.0.4: resolved "https://registry.npmmirror.com/svg-parser/-/svg-parser-2.0.4.tgz#fdc2e29e13951736140b76cb122c8ee6630eb6b5" integrity sha512-e4hG1hRwoOdRb37cIMSgzNsxyzKfayW6VOflrwvR+/bzrkyxY/31WkbgnQpgtrNp1SdpJvpUAGTa/ZoiPNDuRQ== +svg-path-parser@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/svg-path-parser/-/svg-path-parser-1.1.0.tgz#e16b4b39df0d2b0d39e8347db79fdda1453a6046" + integrity sha512-jGCUqcQyXpfe38R7RFfhrMyfXcBmpMNJI/B+4CE9/Unkh98UporAc461GTthv+TVDuZXsBx7/WiwJb1Oh4tt4A== + svg-pathdata@^5.0.5: version "5.0.5" resolved "https://registry.npmmirror.com/svg-pathdata/-/svg-pathdata-5.0.5.tgz#65e8d765642ba15fe15434444087d082bc526b29" @@ -24569,7 +24961,7 @@ tslib@^1.10.0, tslib@^1.11.1, tslib@^1.8.1, tslib@^1.9.0: resolved "https://registry.npmmirror.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^2.0.0, tslib@^2.0.1, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.3.1, tslib@^2.4.0, tslib@^2.4.1, tslib@^2.5.0, tslib@^2.6.0, tslib@^2.6.2: +tslib@^2.0.0, tslib@^2.0.1, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.3.1, tslib@^2.4.0, tslib@^2.4.1, tslib@^2.5.0, tslib@^2.5.3, tslib@^2.6.0, tslib@^2.6.2: version "2.6.2" resolved "https://registry.npmmirror.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== From ca01bdc306c610297f503134732bb6b3ab26033a Mon Sep 17 00:00:00 2001 From: jack zhang <1098626505@qq.com> Date: Thu, 14 Mar 2024 10:35:19 +0800 Subject: [PATCH 10/15] fix: remove env in colletion delete button (#3682) --- .../CollectionDeletedPlaceholder.test.tsx | 36 ++----------------- .../CollectionDeletedPlaceholder.tsx | 2 +- 2 files changed, 3 insertions(+), 35 deletions(-) diff --git a/packages/core/client/src/data-source/__tests__/components/CollectionDeletedPlaceholder.test.tsx b/packages/core/client/src/data-source/__tests__/components/CollectionDeletedPlaceholder.test.tsx index eb304d888..d716197d0 100644 --- a/packages/core/client/src/data-source/__tests__/components/CollectionDeletedPlaceholder.test.tsx +++ b/packages/core/client/src/data-source/__tests__/components/CollectionDeletedPlaceholder.test.tsx @@ -31,47 +31,15 @@ describe('CollectionDeletedPlaceholder', () => { }); describe('name exist', () => { - test("designable: true & process.env.NODE_ENV === 'development', render `Result` component", () => { - const NODE_ENV = process.env.NODE_ENV; - process.env.NODE_ENV = 'development'; - + test('designable: true, render `Result` component', () => { renderApp('test', true); - process.env.NODE_ENV = NODE_ENV; - expect(document.body.innerHTML).toContain('ant-result'); }); - test("designable: false & process.env.NODE_ENV === 'development', render `Result` component", () => { - const NODE_ENV = process.env.NODE_ENV; - process.env.NODE_ENV = 'development'; - + test('designable: false, render nothing', () => { renderApp('test', false); - process.env.NODE_ENV = NODE_ENV; - - expect(document.body.innerHTML).toContain('ant-result'); - }); - - test("designable: true & process.env.NODE_ENV !== 'development', render `Result` component", () => { - const NODE_ENV = process.env.NODE_ENV; - process.env.NODE_ENV = 'production'; - - renderApp('test', true); - - process.env.NODE_ENV = NODE_ENV; - - expect(document.body.innerHTML).toContain('ant-result'); - }); - - test("designable: false & process.env.NODE_ENV !== 'development', render nothing", () => { - const NODE_ENV = process.env.NODE_ENV; - process.env.NODE_ENV = 'production'; - - renderApp('test', false); - - process.env.NODE_ENV = NODE_ENV; - expect(screen.getByTestId('app').innerHTML.length).toBe(0); }); }); diff --git a/packages/core/client/src/data-source/components/CollectionDeletedPlaceholder.tsx b/packages/core/client/src/data-source/components/CollectionDeletedPlaceholder.tsx index e96e3244c..d92c582d4 100644 --- a/packages/core/client/src/data-source/components/CollectionDeletedPlaceholder.tsx +++ b/packages/core/client/src/data-source/components/CollectionDeletedPlaceholder.tsx @@ -61,7 +61,7 @@ export const CollectionDeletedPlaceholder: FC }).replaceAll('>', '>'); }, [message, nameValue, type, t, blockType]); - if (designable || process.env.NODE_ENV === 'development') { + if (designable) { if (type === 'Field') { return {messageValue}; } From 51de34251a9c03d36da4b3d9b785b1a9166f5a19 Mon Sep 17 00:00:00 2001 From: Zeke Zhang <958414905@qq.com> Date: Thu, 14 Mar 2024 14:13:11 +0800 Subject: [PATCH 11/15] refactor(SchemaInitializers): unify naming style (#3604) * refactor(SchemaSettings): unify naming style * refactor(SchemaInitializers): unify naming stle * refactor: replace CreateFormBlockInitializers to blockInitializers:createForm * refactor: replace to blockInitializers:customizeCreateForm * refactor: replace block intializers name * refactor: replace action initializers name * refactor: replace field initializers name * style: fix hover style for column action (T-3297) * refactor: revert some codes * chore: update comment * chore: replace iframeBlockSchemaSettings to blockSettings:iframe * chore: delete pro-packages * feat: add CompatibleSchemaInitializer * test: add unit tests * chore: add @internal for CompatibleSchemaInitializer * chore: block * chore: field * chore: ations * fix: build * chore: typo * fix: fix unit tests * test: fix e2e * chore: remove igone * refactor: page:addBlock * refactor: popup:addNew:addBlock * fix: fix max call stack * refactor: popup:addRecord:addBlock * refactor: remove blockInitializers:recordForm * refactor: popup:tableSelector:addBlock * refactor: popup:view:addBlock * refactor: popup:bulkEdit:addBlock & charts:addBlock * refactor: mobilePage:addBlock * refactor: popup:snapshot:addBlock * refactor: popup:workflowManual:configureUserInterface:addBlock * fix: avoid crashing * chore: optimize * refactor: popup:common:addBlock * refactor: workflowManual:popup:configureUserInterface:addBlock * refactor: details:configureFields * refactor: form:configureFields * refactor: table:configureColumns * refactor: filterForm:configureFields * refactor: associationFilterInitializer * refactor: assignFieldValuesForm:configureFields * refactor: bulkEditForm:configureFields * refactor: auditLogsTable:configureColumns * refactor: chartFilterForm:configureFields * refactor: kanban:configureItemFields * refactor: workflowManual:customForm:configureFields * refactor: detailsWithPaging:configureActions * refactor: details:configureActions * refactor: createForm:configureActions * refactor: editForm:configureActions * refactor: gridCard:configureActions * refactor: gridCard:configureItemActions * refactor: list:configureActions * refactor: list:configureItemActions * refactor: table:configureItemActions * refactor: table:configureActions * refactor: filterForm:configureActions * refactor: subTable:configureActions * refactor: bulkEditForm:configureActions * refactor: auditLogsTable:configureItemActions * refactor: auditLogsTable:configureActions * refactor: calendar:configureActions * refactor: chartFilterForm:configureActions * refactor: gantt:configureActions * refactor: kanban:configureActions * refactor: map:configureActions * refactor: workflowManual:form:configureActions * feat: use 'createForm:configureActions' in page * feat: use 'details:configureActions' in Calendar * feat: register deleteEvent initializer in calendar plugin * fix: fix delete event action * test: fix e2e * test: fix e2e * chore: only run workflow's e2e * Revert "chore: only run workflow's e2e" This reverts commit 9e5b4af41e40e8d616007a5ab97291fb2370d88a. * fix: use isInitializersSame to fix some case --- .../CompatibleSchemaInitializer.test.ts | 66 ++ .../__tests__/SchemaInitializer.test.ts | 74 +++ .../CompatibleSchemaInitializer.tsx | 99 +++ .../application/schema-initializer/index.ts | 1 + .../src/collection-manager/demos/demo5.tsx | 4 +- .../interfaces/properties/index.ts | 2 +- .../collection-manager/interfaces/subTable.ts | 4 +- .../add-child/CreateChildInitializer.tsx | 2 +- .../add-new/CreateActionInitializer.tsx | 2 +- .../add-new/createFormBlockInitializers.tsx | 43 +- .../CustomizeAddRecordActionInitializer.tsx | 4 +- .../customizeCreateFormBlockInitializers.tsx | 44 +- .../submit/updateSubmitActionSettings.tsx | 5 +- .../PopupActionInitializer.tsx | 4 +- .../RecordFormBlockInitializers.tsx | 3 + .../UpdateActionInitializer.tsx | 2 +- .../view-edit-popup/ViewActionInitializer.tsx | 2 +- .../DetailsActionInitializers.tsx | 51 +- .../details-multi/DetailsBlockInitializer.tsx | 2 +- .../__e2e__/schemaInitializer.test.ts | 8 +- .../__e2e__/schemaSettings.test.ts | 2 +- .../ReadPrettyFormActionInitializers.tsx | 94 ++- .../ReadPrettyFormItemInitializers.tsx | 56 +- .../RecordReadPrettyFormBlockInitializer.tsx | 2 +- .../__e2e__/schemaInitializer.test.ts | 8 +- .../form/CreateFormBlockInitializer.tsx | 4 +- .../form/RecordFormBlockInitializer.tsx | 4 +- .../__e2e__/form-create/dragAndDrop.test.ts | 2 +- .../lazyLoadAssociationFields.test.ts | 2 +- .../form-create/schemaInitializer.test.ts | 14 +- .../form-create/schemaSettings.test.ts | 36 +- .../__e2e__/form-create/templatesOfBug.ts | 164 +++-- .../form-edit/schemaInitializer.test.ts | 2 +- .../form/createFormActionInitializers.tsx | 54 +- .../form/formActionInitializers.tsx | 8 +- .../data-blocks/form/formItemInitializers.tsx | 45 +- .../form/updateFormActionInitializers.tsx | 65 +- .../grid-card/GridCardActionInitializers.tsx | 90 ++- .../__e2e__/schemaInitializer.test.ts | 16 +- .../gridCardItemActionInitializers.tsx | 108 +++- .../list/ListActionInitializers.tsx | 95 ++- .../list/__e2e__/schemaInitializer.test.ts | 16 +- .../list/listItemActionInitializers.tsx | 108 +++- .../__e2e__/schemaInitializer.test.ts | 8 +- .../table-selector/__e2e__/utils.ts | 2 +- .../table/TableActionColumnInitializers.tsx | 173 +++++- .../table/TableActionInitializers.tsx | 128 +++- .../table/TableColumnInitializers.tsx | 72 ++- .../table/__e2e__/dragAndDrop.test.ts | 2 +- .../table/__e2e__/schemaInitializer.test.ts | 10 +- .../table/__e2e__/schemaSettings.test.ts | 16 +- .../table/__e2e__/templatesOfBug.ts | 30 +- .../__e2e__/schemaInitializer.test.ts | 2 +- .../filterCollapseItemInitializer.tsx | 85 ++- .../form/FilterFormActionInitializers.tsx | 43 +- .../form/__e2e__/schemaInitializer.test.ts | 8 +- .../form/__e2e__/schemaSettings.test.ts | 2 +- .../form/filterFormItemInitializers.tsx | 42 +- .../__e2e__/schemaInitializer.test.ts | 2 +- .../dialog/__e2e__/schemaInitializer.test.ts | 22 +- .../modules/dialog/__e2e__/templatesOfBug.ts | 48 +- .../Picker/TableSelectorInitializers.tsx | 91 ++- .../client/src/modules/menu/PageMenuItem.tsx | 4 +- .../src/modules/menu/menuItemInitializer.tsx | 26 +- .../src/modules/page/BlockInitializers.tsx | 80 ++- .../page/__e2e__/schemaSettings.test.ts | 4 +- .../antd/action/Action.Designer.tsx | 10 +- .../antd/action/demos/demo6.tsx | 4 +- .../antd/association-field/schema.ts | 12 +- .../ActionBarAssociationFilterAction.tsx | 5 + .../AssociationFilter.Initializer.tsx | 5 +- .../association-filter/AssociationFilter.tsx | 2 + .../antd/form-item/FormItem.Settings.tsx | 3 + .../antd/form-v2/Form.Settings.tsx | 9 + .../antd/form/Form.Settings.tsx | 3 + .../antd/grid/demos/demo3.tsx | 4 +- .../antd/menu/Menu.Designer.tsx | 2 +- .../antd/page/Page.Settings.tsx | 3 + .../src/schema-component/antd/page/Page.tsx | 2 +- .../antd/page/PageTab.Settings.tsx | 3 + .../buttons/CustomFormItemInitializers.tsx | 31 +- .../buttons/RecordBlockInitializers.tsx | 98 ++- .../buttons/SubTableActionInitializers.tsx | 46 +- .../buttons/TabPaneInitializers.tsx | 17 +- .../src/schema-initializer/demos/basic.tsx | 6 +- .../schema-initializer/demos/build-type.tsx | 4 +- .../demos/custom-button.tsx | 4 +- .../demos/custom-items-component.tsx | 4 +- .../demos/dynamic-visible-children.tsx | 4 +- .../demos/insert-schema-action.tsx | 4 +- .../demos/insert-schema-basic.tsx | 4 +- .../demos/insert-schema-form-item.tsx | 4 +- .../schema-initializer/demos/nested-items.tsx | 6 +- .../client/src/schema-initializer/index.ts | 125 +++- .../RecordAssociationFormBlockInitializer.tsx | 4 +- ...dPrettyAssociationFormBlockInitializer.tsx | 2 +- .../items/SelectActionInitializer.tsx | 4 +- .../items/SubmitActionInitializer.tsx | 2 +- .../items/TableActionColumnInitializer.tsx | 2 +- .../client/src/schema-initializer/utils.ts | 40 +- .../src/schema-settings/demos/demo3.tsx | 4 +- packages/core/test/src/e2e/e2eUtils.ts | 4 +- packages/core/test/src/e2e/templatesOfPage.ts | 562 +++++++++--------- .../plugin-acl/src/client/__e2e__/utils.ts | 40 +- .../src/client/BulkEditActionInitializer.tsx | 2 +- .../src/client/BulkEditBlockInitializers.tsx | 43 +- .../client/BulkEditFormActionInitializers.tsx | 34 +- .../client/BulkEditFormItemInitializers.tsx | 46 +- .../CreateFormBulkEditBlockInitializer.tsx | 6 +- .../client/__e2e__/schemaInitailizer.test.ts | 4 +- .../src/client/__e2e__/schemaSettings.test.ts | 6 +- .../src/client/__e2e__/utils.ts | 20 +- .../src/client/index.tsx | 28 +- .../client/__e2e__/schemaInitailizer.test.ts | 4 +- .../src/client/__e2e__/schemaSettings.test.ts | 2 +- .../src/client/__e2e__/utils.ts | 18 +- .../src/client/index.tsx | 6 +- .../src/client/DuplicateActionInitializer.tsx | 2 +- .../client/__e2e__/schemaInitailizer.test.ts | 2 +- .../src/client/__e2e__/schemaSettings.test.ts | 6 +- .../src/client/__e2e__/utils.ts | 20 +- .../src/client/index.ts | 6 +- .../client/__e2e__/schemaInitailizer.test.ts | 4 +- .../src/client/__e2e__/utils.ts | 36 +- .../plugin-action-print/src/client/index.tsx | 6 +- .../src/client/AuditLogsBlockInitializer.tsx | 6 +- .../AuditLogsViewActionInitializer.tsx | 2 +- .../src/client/deplicated/AuditLogs.tsx | 2 +- .../plugin-audit-logs/src/client/index.ts | 22 +- .../AuditLogsTableActionColumnInitializer.tsx | 2 +- ...AuditLogsTableActionColumnInitializers.tsx | 78 ++- .../AuditLogsTableActionInitializers.tsx | 46 +- .../AuditLogsTableColumnInitializers.tsx | 54 +- .../src/client/calendar/DeleteEvent.tsx | 2 +- .../plugin-calendar/src/client/index.tsx | 17 +- .../CalendarActionInitializers.tsx | 97 ++- .../CalendarFormActionInitializers.tsx | 39 +- .../src/client/schema-initializer/utils.ts | 8 +- .../plugin-charts/src/client/index.tsx | 4 +- .../attachment/schemaInitializer.test.ts | 6 +- .../belongsTo/schemaInitializer.test.ts | 6 +- .../fields/checkbox/schemaInitializer.test.ts | 6 +- .../collection/schemaInitializer.test.ts | 6 +- .../fields/color/schemaInitializer.test.ts | 6 +- .../createdAt/schemaInitializer.test.ts | 6 +- .../fields/datetime/schemaInitializer.test.ts | 6 +- .../fields/manyToMany/schemaSettings.test.ts | 4 +- .../src/client/__e2e__/utils.ts | 2 +- .../src/client/__e2e__/schemaSettings.test.ts | 2 +- .../client/block/ChartBlockInitializer.tsx | 37 +- .../filter/FilterActionInitializers.tsx | 53 +- .../client/filter/FilterBlockInitializer.tsx | 4 +- .../client/filter/FilterItemInitializers.tsx | 57 +- .../src/client/index.tsx | 22 +- .../src/client/utils.ts | 4 +- .../plugin-export/src/client/index.ts | 4 +- .../plugin-file-manager/src/client/index.tsx | 2 +- .../src/client/GanttActionInitializers.tsx | 156 ++++- .../src/client/__e2e__/drag.test.ts | 2 +- .../client/__e2e__/schemaInitailizer.test.ts | 8 +- .../src/client/__e2e__/schemaSettings.test.ts | 8 +- .../plugin-gantt/src/client/__e2e__/utils.ts | 10 +- .../plugin-gantt/src/client/index.tsx | 7 +- .../plugin-gantt/src/client/utils.tsx | 10 +- .../src/client/IframeBlockInitializer.tsx | 2 +- .../plugin-iframe-block/src/client/index.ts | 9 +- .../src/client/schemaSettings.ts | 146 ++++- .../plugin-import/src/client/index.ts | 4 +- .../src/client/Kanban.Card.Designer.tsx | 87 ++- .../src/client/KanbanActionInitializers.tsx | 52 +- .../client/__e2e__/schemaInitailizer.test.ts | 16 +- .../plugin-kanban/src/client/__e2e__/utils.ts | 6 +- .../plugin-kanban/src/client/index.tsx | 14 +- .../plugin-kanban/src/client/utils.ts | 4 +- .../client/block/MapActionInitializers.tsx | 80 ++- .../plugin-map/src/client/block/utils.ts | 4 +- .../@nocobase/plugin-map/src/client/index.tsx | 10 +- .../src/client/core/schema/common/page.ts | 2 +- .../schema/components/page/Page.Designer.tsx | 2 +- .../schema/initializers/BlockInitializers.ts | 79 ++- .../plugin-mobile-client/src/client/index.tsx | 3 +- .../plugin-mobile-client/src/server/plugin.ts | 2 +- .../plugin-mobile-client/src/server/routes.ts | 2 +- .../plugin-sample-hello/src/client/index.tsx | 4 +- .../SnapshotBlockInitializers.tsx | 46 +- .../SnapshotBlockInitializersDetailItem.tsx | 6 +- .../src/client/index.tsx | 6 +- .../src/client/interface.ts | 2 +- .../src/server/__tests__/fixtures/data.ts | 107 ++-- .../src/client/__e2e__/configuration.test.ts | 16 +- .../src/client/index.ts | 2 +- .../client/__e2e__/createRecordForm.test.ts | 121 ++-- .../client/__e2e__/customFormBlocks.test.ts | 197 ++++-- .../src/client/__e2e__/datablocks.test.ts | 60 +- .../client/__e2e__/updateRecordForm.test.ts | 94 ++- .../src/client/__e2e__/workflowTodo.test.ts | 14 +- .../src/client/index.ts | 16 +- .../instruction/FormBlockInitializer.tsx | 2 +- .../src/client/instruction/SchemaConfig.tsx | 120 +++- .../src/client/instruction/forms/custom.tsx | 22 +- .../src/e2e/e2ePageObjectModel.ts | 4 +- .../calculationNode/formulaEngine.test.ts | 6 +- .../calculationNode/mathEngine.test.ts | 6 +- .../components/CollectionBlockInitializer.tsx | 2 +- .../20230411034722-manual-multi-form.ts | 4 +- .../20230612021134-manual-collection-block.ts | 2 +- 206 files changed, 4605 insertions(+), 1297 deletions(-) create mode 100644 packages/core/client/src/application/__tests__/CompatibleSchemaInitializer.test.ts create mode 100644 packages/core/client/src/application/__tests__/SchemaInitializer.test.ts create mode 100644 packages/core/client/src/application/schema-initializer/CompatibleSchemaInitializer.tsx diff --git a/packages/core/client/src/application/__tests__/CompatibleSchemaInitializer.test.ts b/packages/core/client/src/application/__tests__/CompatibleSchemaInitializer.test.ts new file mode 100644 index 000000000..2c16ec081 --- /dev/null +++ b/packages/core/client/src/application/__tests__/CompatibleSchemaInitializer.test.ts @@ -0,0 +1,66 @@ +import { CompatibleSchemaInitializer, isInitializersSame } from '../schema-initializer/CompatibleSchemaInitializer'; + +describe('CompatibleSchemaInitializer', () => { + it('should synchronize add operations between instances', () => { + const first = new CompatibleSchemaInitializer({ type: 'item', items: [], name: 'firstSchema' }); + const second = new CompatibleSchemaInitializer({ type: 'item', items: [], name: 'secondSchema' }, first); + first.add('item1', { type: 'item', test: true }); + expect(second.items).toContainEqual({ type: 'item', name: 'item1', test: true }); + expect(first.items).toContainEqual({ type: 'item', name: 'item1', test: true }); + }); + + it('should synchronize remove operations between instances', () => { + const first = new CompatibleSchemaInitializer({ + type: 'item', + items: [{ type: 'item', name: 'toRemove', test: true }], + name: 'firstSchema', + }); + const second = new CompatibleSchemaInitializer( + { type: 'item', items: [{ type: 'item', name: 'toRemove', test: true }], name: 'secondSchema' }, + first, + ); + first.remove('toRemove'); + expect(first.items).not.toContainEqual({ type: 'item', name: 'toRemove', test: true }); + expect(second.items).not.toContainEqual({ type: 'item', name: 'toRemove', test: true }); + }); +}); + +describe('isInitializersSame', () => { + test('should return true for matching old and new names directly', () => { + expect(isInitializersSame('page:addBlock', 'page:addBlock')).toBeTruthy(); + }); + + test('should return true for an old name matching a new name via the mapping', () => { + expect(isInitializersSame('BlockInitializers', 'page:addBlock')).toBeTruthy(); + }); + + test('should return false when old name does not match and is not found in mapping', () => { + expect(isInitializersSame('NonExistentInitializer', 'page:addBlock')).toBeFalsy(); + }); + + test('should handle case where old name is in the map but does not match the new name', () => { + expect(isInitializersSame('BlockInitializers', 'mobilePage:addBlock')).toBeFalsy(); + }); + + test('should return true for complex name structures that match through the mapping', () => { + expect(isInitializersSame('CreateFormBlockInitializers', 'popup:addNew:addBlock')).toBeTruthy(); + }); + + test('should return false for complex name structures that do not match any new name', () => { + expect(isInitializersSame('CreateFormBlockInitializers', 'nonExistentAction')).toBeFalsy(); + }); + + test('should return true for new names that match directly and are not in the mapping', () => { + expect(isInitializersSame('unmappedNewInitializer:action', 'unmappedNewInitializer:action')).toBeTruthy(); + }); + + test('should return false for old names trying to match to unrelated new names', () => { + expect(isInitializersSame('BlockInitializers', 'unrelatedNewInitializer:action')).toBeFalsy(); + }); + + test('should handle empty strings', () => { + expect(isInitializersSame('', '')).toBeTruthy(); + expect(isInitializersSame('', 'page:addBlock')).toBeFalsy(); + expect(isInitializersSame('BlockInitializers', '')).toBeFalsy(); + }); +}); diff --git a/packages/core/client/src/application/__tests__/SchemaInitializer.test.ts b/packages/core/client/src/application/__tests__/SchemaInitializer.test.ts new file mode 100644 index 000000000..b1591be89 --- /dev/null +++ b/packages/core/client/src/application/__tests__/SchemaInitializer.test.ts @@ -0,0 +1,74 @@ +import { SchemaInitializer } from '../schema-initializer/SchemaInitializer'; + +describe('SchemaInitializer', () => { + it('should initialize with default items when no options provided', () => { + const schema = new SchemaInitializer({ name: 'schema0' }); + expect(schema.items).toEqual([]); + }); + + it('should initialize with provided items', () => { + const schema = new SchemaInitializer({ type: 'item', items: [{ name: 'test', type: 'item' }], name: 'schema1' }); + expect(schema.items).toEqual([{ type: 'item', name: 'test' }]); + }); + + it('should add item with unique name', () => { + const schema = new SchemaInitializer({ items: [], name: 'schema2' }); + schema.add('item1', { type: 'item', test: true }); + expect(schema.items).toContainEqual({ type: 'item', name: 'item1', test: true }); + }); + + it('should replace item with same name', () => { + const schema = new SchemaInitializer({ + type: 'item', + items: [{ type: 'item', name: 'item1', test: false }], + name: 'schema3', + }); + schema.add('item1', { type: 'item', test: true }); + expect(schema.items).toContainEqual({ type: 'item', name: 'item1', test: true }); + expect(schema.items.length).toBe(1); + }); + + it('should add children to the specified parent item', () => { + const schema = new SchemaInitializer({ + type: 'item', + items: [{ type: 'item', name: 'parent', children: [] }], + name: 'schema4', + }); + schema.add('parent.child', { type: 'item', test: true }); + expect(schema.get('parent').children).toContainEqual({ type: 'item', name: 'child', test: true }); + }); + + it('should get the item by nested name', () => { + const schema = new SchemaInitializer({ + type: 'item', + items: [{ type: 'item', name: 'parent', children: [{ type: 'item', name: 'child', test: true }] }], + name: 'schema5', + }); + expect(schema.get('parent.child')).toEqual({ type: 'item', name: 'child', test: true }); + }); + + it('should return undefined for non-existent item', () => { + const schema = new SchemaInitializer({ type: 'item', items: [], name: 'schema6' }); + expect(schema.get('nonexistent')).toBeUndefined(); + }); + + it('should remove the specified item', () => { + const schema = new SchemaInitializer({ + type: 'item', + items: [{ type: 'item', name: 'toRemove', test: true }], + name: 'schema7', + }); + schema.remove('toRemove'); + expect(schema.items).not.toContainEqual({ type: 'item', name: 'toRemove', test: true }); + }); + + it('should remove the specified nested item', () => { + const schema = new SchemaInitializer({ + type: 'item', + items: [{ type: 'item', name: 'parent', children: [{ type: 'item', name: 'toRemove', test: true }] }], + name: 'schema8', + }); + schema.remove('parent.toRemove'); + expect(schema.get('parent').children).not.toContainEqual({ type: 'item', name: 'toRemove', test: true }); + }); +}); diff --git a/packages/core/client/src/application/schema-initializer/CompatibleSchemaInitializer.tsx b/packages/core/client/src/application/schema-initializer/CompatibleSchemaInitializer.tsx new file mode 100644 index 000000000..8f3570bb6 --- /dev/null +++ b/packages/core/client/src/application/schema-initializer/CompatibleSchemaInitializer.tsx @@ -0,0 +1,99 @@ +import { SchemaInitializer } from './SchemaInitializer'; + +/** + * @internal + * + * 因为需要把 SchemaInitializer 的 name 统一为一致的命名风格,统一之后新创建的 Schema 将 + * 使用新的命名风格,而旧的 Schema 仍然使用旧的命名风格,这样会导致一些问题。所以需要有一个方法 + * 可以确保旧版的 name 也可以正常工作,直到旧的 Schema 被移除。该类就是用来兼容旧 name 的: + * + * 1. 在新版实例中通过接收旧版 name 的实例,在新版实例变更后,同步变更旧版实例; + * 2. 在旧版实例中也接收新版 name 的实例,当旧版实例变更后,同步变更新版实例,这样可以保证在插件中即使不把旧版改成新版也能正常运行; + */ +export class CompatibleSchemaInitializer extends SchemaInitializer { + /** + * 需要同步变更的另一个实例 + */ + otherInstance: CompatibleSchemaInitializer = null; + + constructor(options: any, otherInstance?: CompatibleSchemaInitializer) { + super(options); + if (otherInstance) { + this.otherInstance = otherInstance; + otherInstance.otherInstance = this; + } + } + + add(name: string, item: any) { + if (super.get(name)) return; + + super.add(name, item); + if (this.otherInstance) { + this.otherInstance.add(name, item); + } + } + + remove(nestedName: string): void { + if (!super.get(nestedName)) return; + + super.remove(nestedName); + if (this.otherInstance) { + this.otherInstance.remove(nestedName); + } + } +} + +const oldToNewNameMap = { + BlockInitializers: 'page:addBlock', + MBlockInitializers: 'mobilePage:addBlock', + CreateFormBlockInitializers: 'popup:addNew:addBlock', + CusomeizeCreateFormBlockInitializers: 'popup:addRecord:addBlock', + RecordBlockInitializers: 'popup:common:addBlock', + BulkEditBlockInitializers: 'popup:bulkEdit:addBlock', + TableColumnInitializers: 'table:configureColumns', + TableActionColumnInitializers: 'table:configureItemActions', + TableActionInitializers: 'table:configureActions', + SubTableActionInitializers: 'subTable:configureActions', + FormItemInitializers: 'form:configureFields', + CreateFormActionInitializers: 'createForm:configureActions', + UpdateFormActionInitializers: 'editForm:configureActions', + ReadPrettyFormItemInitializers: 'details:configureFields', + DetailsActionInitializers: 'detailsWithPaging:configureActions', + ReadPrettyFormActionInitializers: 'details:configureActions', + KanbanCardInitializers: 'kanban:configureItemFields', + KanbanActionInitializers: 'kanban:configureActions', + GridCardActionInitializers: 'gridCard:configureActions', + GridCardItemActionInitializers: 'gridCard:configureItemActions', + ListActionInitializers: 'list:configureActions', + ListItemActionInitializers: 'list:configureItemActions', + CalendarActionInitializers: 'calendar:configureActions', + GanttActionInitializers: 'gantt:configureActions', + MapActionInitializers: 'map:configureActions', + TableSelectorInitializers: 'popup:tableSelector:addBlock', + ChartInitializers: 'charts:addBlock', + ChartFilterItemInitializers: 'chartFilterForm:configureFields', + ChartFilterActionInitializers: 'chartFilterForm:configureActions', + AssociationFilterInitializers: 'filterCollapse:configureFields', + FilterFormItemInitializers: 'filterForm:configureFields', + FilterFormActionInitializers: 'filterForm:configureActions', + CustomFormItemInitializers: 'assignFieldValuesForm:configureFields', + BulkEditFormItemInitializers: 'bulkEditForm:configureFields', + BulkEditFormActionInitializers: 'bulkEditForm:configureActions', + AuditLogsTableColumnInitializers: 'auditLogsTable:configureColumns', + AuditLogsTableActionColumnInitializers: 'auditLogsTable:configureItemActions', + AuditLogsTableActionInitializers: 'auditLogsTable:configureActions', + SnapshotBlockInitializers: 'popup:snapshot:addBlock', + AddBlockButton: 'workflowManual:popup:configureUserInterface:addBlock', + AddCustomFormField: 'workflowManual:customForm:configureFields', + AddActionButton: 'workflowManual:form:configureActions', +}; + +/** + * 由于旧版的 schema 的 x-initializer 的值是旧的命名风格,当其与新的命名比较时就存在问题, + * 这里通过将新版命名转换为旧版命名再进行比较,已解决这个问题。 + * @param oldOrNewName x-initializer 的值 + * @param newName 新的命名 + */ +export function isInitializersSame(oldOrNewName: string, newName: string) { + return oldOrNewName === newName || oldToNewNameMap[oldOrNewName] === newName; +} diff --git a/packages/core/client/src/application/schema-initializer/index.ts b/packages/core/client/src/application/schema-initializer/index.ts index d39c13e67..9bb2efd08 100644 --- a/packages/core/client/src/application/schema-initializer/index.ts +++ b/packages/core/client/src/application/schema-initializer/index.ts @@ -4,4 +4,5 @@ export * from './types'; export * from './context'; export * from './components'; export * from './SchemaInitializer'; +export * from './CompatibleSchemaInitializer'; export * from './SchemaInitializerManager'; diff --git a/packages/core/client/src/collection-manager/demos/demo5.tsx b/packages/core/client/src/collection-manager/demos/demo5.tsx index b04edbb77..bddfbbcad 100644 --- a/packages/core/client/src/collection-manager/demos/demo5.tsx +++ b/packages/core/client/src/collection-manager/demos/demo5.tsx @@ -40,7 +40,7 @@ const schema: ISchema = { type: 'void', 'x-component': Grid, 'x-read-pretty': true, - 'x-initializer': 'AddFieldButton', + 'x-initializer': 'addFieldButton', 'x-uid': uid(), properties: {}, }, @@ -124,7 +124,7 @@ const FormItemInitializer = () => { }; const addFieldButton = new SchemaInitializer({ - name: 'AddFieldButton', + name: 'addFieldButton', // 正常情况下这个值为 false,通过点击页面左上角的设计按钮切换,这里为了显示设置为 true designable: true, // 按钮标题标题 diff --git a/packages/core/client/src/collection-manager/interfaces/properties/index.ts b/packages/core/client/src/collection-manager/interfaces/properties/index.ts index e7f24b38f..2ee0485df 100644 --- a/packages/core/client/src/collection-manager/interfaces/properties/index.ts +++ b/packages/core/client/src/collection-manager/interfaces/properties/index.ts @@ -398,7 +398,7 @@ export const recordPickerViewer = { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: {}, }, }, diff --git a/packages/core/client/src/collection-manager/interfaces/subTable.ts b/packages/core/client/src/collection-manager/interfaces/subTable.ts index e67cec4cc..3000836cb 100644 --- a/packages/core/client/src/collection-manager/interfaces/subTable.ts +++ b/packages/core/client/src/collection-manager/interfaces/subTable.ts @@ -42,13 +42,13 @@ export class SubTableFieldInterface extends CollectionFieldInterface { properties: { actions: { type: 'void', - 'x-initializer': 'SubTableActionInitializers', + 'x-initializer': 'subTable:configureActions', 'x-component': 'TableField.ActionBar', 'x-component-props': {}, }, [field.name]: { type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowSelection: { diff --git a/packages/core/client/src/modules/actions/add-child/CreateChildInitializer.tsx b/packages/core/client/src/modules/actions/add-child/CreateChildInitializer.tsx index 9c82a52b5..a5673e802 100644 --- a/packages/core/client/src/modules/actions/add-child/CreateChildInitializer.tsx +++ b/packages/core/client/src/modules/actions/add-child/CreateChildInitializer.tsx @@ -41,7 +41,7 @@ export const CreateChildInitializer = (props) => { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', properties: {}, }, }, diff --git a/packages/core/client/src/modules/actions/add-new/CreateActionInitializer.tsx b/packages/core/client/src/modules/actions/add-new/CreateActionInitializer.tsx index ad3eb2383..39faabb53 100644 --- a/packages/core/client/src/modules/actions/add-new/CreateActionInitializer.tsx +++ b/packages/core/client/src/modules/actions/add-new/CreateActionInitializer.tsx @@ -43,7 +43,7 @@ export const CreateActionInitializer = () => { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', properties: {}, }, }, diff --git a/packages/core/client/src/modules/actions/add-new/createFormBlockInitializers.tsx b/packages/core/client/src/modules/actions/add-new/createFormBlockInitializers.tsx index 17da54b81..4cb926553 100644 --- a/packages/core/client/src/modules/actions/add-new/createFormBlockInitializers.tsx +++ b/packages/core/client/src/modules/actions/add-new/createFormBlockInitializers.tsx @@ -1,7 +1,10 @@ -import { SchemaInitializer } from '../../../application/schema-initializer/SchemaInitializer'; +import { CompatibleSchemaInitializer } from '../../../application/schema-initializer/CompatibleSchemaInitializer'; import { gridRowColWrap } from '../../../schema-initializer/utils'; -export const createFormBlockInitializers = new SchemaInitializer({ +/** + * @deprecated + */ +export const createFormBlockInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'CreateFormBlockInitializers', wrap: gridRowColWrap, title: '{{t("Add block")}}', @@ -33,3 +36,39 @@ export const createFormBlockInitializers = new SchemaInitializer({ }, ], }); + +export const createFormBlockInitializers = new CompatibleSchemaInitializer( + { + name: 'popup:addNew:addBlock', + wrap: gridRowColWrap, + title: '{{t("Add block")}}', + icon: 'PlusOutlined', + items: [ + { + type: 'itemGroup', + title: '{{t("Data blocks")}}', + name: 'dataBlocks', + children: [ + { + name: 'form', + title: '{{t("Form")}}', + Component: 'CreateFormBlockInitializer', + }, + ], + }, + { + type: 'itemGroup', + title: '{{t("Other blocks")}}', + name: 'otherBlocks', + children: [ + { + name: 'markdown', + title: '{{t("Markdown")}}', + Component: 'MarkdownBlockInitializer', + }, + ], + }, + ], + }, + createFormBlockInitializers_deprecated, +); diff --git a/packages/core/client/src/modules/actions/add-record/CustomizeAddRecordActionInitializer.tsx b/packages/core/client/src/modules/actions/add-record/CustomizeAddRecordActionInitializer.tsx index 765424a8f..106e24f19 100644 --- a/packages/core/client/src/modules/actions/add-record/CustomizeAddRecordActionInitializer.tsx +++ b/packages/core/client/src/modules/actions/add-record/CustomizeAddRecordActionInitializer.tsx @@ -29,7 +29,7 @@ export const CustomizeAddRecordActionInitializer = () => { 'x-component-props': {}, 'x-initializer': 'TabPaneInitializersForCreateFormBlock', 'x-initializer-props': { - gridInitializer: 'CusomeizeCreateFormBlockInitializers', + gridInitializer: 'popup:addRecord:addBlock', }, properties: { tab1: { @@ -42,7 +42,7 @@ export const CustomizeAddRecordActionInitializer = () => { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CusomeizeCreateFormBlockInitializers', + 'x-initializer': 'popup:addRecord:addBlock', properties: {}, }, }, diff --git a/packages/core/client/src/modules/actions/add-record/customizeCreateFormBlockInitializers.tsx b/packages/core/client/src/modules/actions/add-record/customizeCreateFormBlockInitializers.tsx index ba20a66ad..f98ddeef9 100644 --- a/packages/core/client/src/modules/actions/add-record/customizeCreateFormBlockInitializers.tsx +++ b/packages/core/client/src/modules/actions/add-record/customizeCreateFormBlockInitializers.tsx @@ -1,7 +1,10 @@ -import { SchemaInitializer } from '../../../application/schema-initializer/SchemaInitializer'; +import { CompatibleSchemaInitializer } from '../../../application/schema-initializer/CompatibleSchemaInitializer'; import { gridRowColWrap } from '../../../schema-initializer/utils'; -export const customizeCreateFormBlockInitializers = new SchemaInitializer({ +/** + * @deprecated + */ +export const customizeCreateFormBlockInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'CusomeizeCreateFormBlockInitializers', wrap: gridRowColWrap, title: '{{t("Add block")}}', @@ -34,3 +37,40 @@ export const customizeCreateFormBlockInitializers = new SchemaInitializer({ }, ], }); + +export const customizeCreateFormBlockInitializers = new CompatibleSchemaInitializer( + { + name: 'popup:addRecord:addBlock', + wrap: gridRowColWrap, + title: '{{t("Add block")}}', + icon: 'PlusOutlined', + items: [ + { + type: 'itemGroup', + title: '{{t("Data blocks")}}', + name: 'dataBlocks', + children: [ + { + name: 'form', + title: '{{t("Form")}}', + Component: 'FormBlockInitializer', + isCusomeizeCreate: true, + }, + ], + }, + { + type: 'itemGroup', + title: '{{t("Other blocks")}}', + name: 'otherBlocks', + children: [ + { + name: 'markdown', + title: '{{t("Markdown")}}', + Component: 'MarkdownBlockInitializer', + }, + ], + }, + ], + }, + customizeCreateFormBlockInitializers_deprecated, +); diff --git a/packages/core/client/src/modules/actions/submit/updateSubmitActionSettings.tsx b/packages/core/client/src/modules/actions/submit/updateSubmitActionSettings.tsx index f10e286d6..c1adee749 100644 --- a/packages/core/client/src/modules/actions/submit/updateSubmitActionSettings.tsx +++ b/packages/core/client/src/modules/actions/submit/updateSubmitActionSettings.tsx @@ -1,6 +1,6 @@ import { useFieldSchema } from '@formily/react'; import { isValid } from '@formily/shared'; -import { useSchemaToolbar } from '../../../application'; +import { isInitializersSame, useSchemaToolbar } from '../../../application'; import { SchemaSettings } from '../../../application/schema-settings/SchemaSettings'; import { ButtonEditor, @@ -45,7 +45,6 @@ export const updateSubmitActionSettings = new SchemaSettings({ ], }); -// TODO: 0.20 发版之前后移除 export const submitActionSettings = new SchemaSettings({ name: 'actionSettings:submit', items: [ @@ -76,7 +75,7 @@ export const submitActionSettings = new SchemaSettings({ const fieldSchema = useFieldSchema(); return ( fieldSchema['x-action'] === 'submit' && - fieldSchema.parent?.['x-initializer'] === 'CreateFormActionInitializers' + isInitializersSame(fieldSchema.parent?.['x-initializer'], 'createForm:configureActions') ); }, }, diff --git a/packages/core/client/src/modules/actions/view-edit-popup/PopupActionInitializer.tsx b/packages/core/client/src/modules/actions/view-edit-popup/PopupActionInitializer.tsx index 4d4149586..06ae9a4ff 100644 --- a/packages/core/client/src/modules/actions/view-edit-popup/PopupActionInitializer.tsx +++ b/packages/core/client/src/modules/actions/view-edit-popup/PopupActionInitializer.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { BlockInitializer } from '../../../schema-initializer/items'; import { useSchemaInitializerItem } from '../../../application'; +import { BlockInitializer } from '../../../schema-initializer/items'; export const PopupActionInitializer = (props) => { const schema = { @@ -38,7 +38,7 @@ export const PopupActionInitializer = (props) => { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: {}, }, }, diff --git a/packages/core/client/src/modules/actions/view-edit-popup/RecordFormBlockInitializers.tsx b/packages/core/client/src/modules/actions/view-edit-popup/RecordFormBlockInitializers.tsx index 034f9ffec..b338cdfc4 100644 --- a/packages/core/client/src/modules/actions/view-edit-popup/RecordFormBlockInitializers.tsx +++ b/packages/core/client/src/modules/actions/view-edit-popup/RecordFormBlockInitializers.tsx @@ -1,6 +1,9 @@ import { SchemaInitializer } from '../../../application/schema-initializer/SchemaInitializer'; import { gridRowColWrap } from '../../../schema-initializer/utils'; +/** + * @deprecated + */ export const recordFormBlockInitializers = new SchemaInitializer({ name: 'RecordFormBlockInitializers', title: '{{ t("Add block") }}', diff --git a/packages/core/client/src/modules/actions/view-edit-popup/UpdateActionInitializer.tsx b/packages/core/client/src/modules/actions/view-edit-popup/UpdateActionInitializer.tsx index 2ab32a4d9..c7a1c5487 100644 --- a/packages/core/client/src/modules/actions/view-edit-popup/UpdateActionInitializer.tsx +++ b/packages/core/client/src/modules/actions/view-edit-popup/UpdateActionInitializer.tsx @@ -39,7 +39,7 @@ export const UpdateActionInitializer = (props) => { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: {}, }, }, diff --git a/packages/core/client/src/modules/actions/view-edit-popup/ViewActionInitializer.tsx b/packages/core/client/src/modules/actions/view-edit-popup/ViewActionInitializer.tsx index c091def8d..e564ac00e 100644 --- a/packages/core/client/src/modules/actions/view-edit-popup/ViewActionInitializer.tsx +++ b/packages/core/client/src/modules/actions/view-edit-popup/ViewActionInitializer.tsx @@ -38,7 +38,7 @@ export const ViewActionInitializer = (props) => { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: {}, }, }, diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-multi/DetailsActionInitializers.tsx b/packages/core/client/src/modules/blocks/data-blocks/details-multi/DetailsActionInitializers.tsx index 0e8da5417..15ace51a0 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/details-multi/DetailsActionInitializers.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/details-multi/DetailsActionInitializers.tsx @@ -1,7 +1,10 @@ -import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer'; +import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; -// 表单的操作配置 -export const detailsActionInitializers = new SchemaInitializer({ +/** + * @deprecated + * 表单的操作配置 + */ +export const detailsActionInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'DetailsActionInitializers', title: '{{t("Configure actions")}}', icon: 'SettingOutlined', @@ -49,3 +52,45 @@ export const detailsActionInitializers = new SchemaInitializer({ }, ], }); + +export const detailsActionInitializers = new CompatibleSchemaInitializer( + { + name: 'detailsWithPaging:configureActions', + title: '{{t("Configure actions")}}', + icon: 'SettingOutlined', + style: { + marginLeft: 8, + }, + items: [ + { + type: 'itemGroup', + title: '{{t("Enable actions")}}', + name: 'enableActions', + children: [ + { + name: 'edit', + title: '{{t("Edit")}}', + Component: 'UpdateActionInitializer', + schema: { + 'x-component': 'Action', + 'x-decorator': 'ACLActionProvider', + 'x-component-props': { + type: 'primary', + }, + }, + }, + { + name: 'delete', + title: '{{t("Delete")}}', + Component: 'DestroyActionInitializer', + schema: { + 'x-component': 'Action', + 'x-decorator': 'ACLActionProvider', + }, + }, + ], + }, + ], + }, + detailsActionInitializers_deprecated, +); diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-multi/DetailsBlockInitializer.tsx b/packages/core/client/src/modules/blocks/data-blocks/details-multi/DetailsBlockInitializer.tsx index 42c0684a5..ae075be78 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/details-multi/DetailsBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/details-multi/DetailsBlockInitializer.tsx @@ -23,7 +23,7 @@ export const DetailsBlockInitializer = () => { actionInitializers: (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql' && - 'DetailsActionInitializers', + 'detailsWithPaging:configureActions', settings: 'blockSettings:multiDataDetails', }); insert(schema); diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-multi/__e2e__/schemaInitializer.test.ts b/packages/core/client/src/modules/blocks/data-blocks/details-multi/__e2e__/schemaInitializer.test.ts index d3bd9cf36..bfaa5c77d 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/details-multi/__e2e__/schemaInitializer.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/details-multi/__e2e__/schemaInitializer.test.ts @@ -3,7 +3,7 @@ import { createBlockInPage, expect, oneEmptyDetailsBlock, test } from '@nocobase test.describe('where multi data details block can be added', () => { test('page', async ({ page, mockPage }) => { await mockPage().goto(); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await createBlockInPage(page, 'Details'); await expect(page.getByLabel('block-item-CardItem-users-details')).toBeVisible(); }); @@ -13,7 +13,7 @@ test.describe('configure fields', () => { test('display collection fields & display association fields & add text', async ({ page, mockPage }) => { await mockPage(oneEmptyDetailsBlock).goto(); - const formItemInitializer = page.getByLabel('schema-initializer-Grid-ReadPrettyFormItemInitializers-general'); + const formItemInitializer = page.getByLabel('schema-initializer-Grid-details:configureFields-general'); // add fields await formItemInitializer.hover(); @@ -63,7 +63,7 @@ test.describe('configure actions', () => { test('edit & delete & duplicate', async ({ page, mockPage }) => { await mockPage(oneEmptyDetailsBlock).goto(); - await page.getByLabel('schema-initializer-ActionBar-DetailsActionInitializers-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-detailsWithPaging:configureActions-general').hover(); await page.getByRole('menuitem', { name: 'Edit' }).click(); await page.getByRole('menuitem', { name: 'Delete' }).click(); @@ -75,7 +75,7 @@ test.describe('configure actions', () => { await expect(page.getByRole('button', { name: 'Delete' })).toBeVisible(); // delete buttons - await page.getByLabel('schema-initializer-ActionBar-DetailsActionInitializers-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-detailsWithPaging:configureActions-general').hover(); await page.getByRole('menuitem', { name: 'Edit' }).click(); await page.getByRole('menuitem', { name: 'Delete' }).click(); diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-multi/__e2e__/schemaSettings.test.ts b/packages/core/client/src/modules/blocks/data-blocks/details-multi/__e2e__/schemaSettings.test.ts index 01f300347..2ba21a02d 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/details-multi/__e2e__/schemaSettings.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/details-multi/__e2e__/schemaSettings.test.ts @@ -33,7 +33,7 @@ test.describe('actions schema settings', () => { await mockPage(oneEmptyDetailsBlock).goto(); // 创建 Edit & Delete 两个按钮 - await page.getByLabel('schema-initializer-ActionBar-DetailsActionInitializers-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-detailsWithPaging:configureActions-general').hover(); await page.getByRole('menuitem', { name: 'Edit' }).click(); await page.getByRole('menuitem', { name: 'Delete' }).click(); await page.mouse.move(0, 300); diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-single/ReadPrettyFormActionInitializers.tsx b/packages/core/client/src/modules/blocks/data-blocks/details-single/ReadPrettyFormActionInitializers.tsx index 98da59cb3..f2dbe5404 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/details-single/ReadPrettyFormActionInitializers.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/details-single/ReadPrettyFormActionInitializers.tsx @@ -1,12 +1,16 @@ -import { useCollection_deprecated } from '../../../..'; -import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer'; +import { useCollection_deprecated } from '../../../../collection-manager/hooks/useCollection_deprecated'; +import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; const useVisibleCollection = () => { const collection = useCollection_deprecated(); return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; }; -// 表单的操作配置 -export const readPrettyFormActionInitializers = new SchemaInitializer({ + +/** + * @deprecated + * 表单的操作配置 + */ +export const readPrettyFormActionInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'ReadPrettyFormActionInitializers', title: '{{t("Configure actions")}}', icon: 'SettingOutlined', @@ -84,3 +88,85 @@ export const readPrettyFormActionInitializers = new SchemaInitializer({ }, ], }); + +export const readPrettyFormActionInitializers = new CompatibleSchemaInitializer( + { + name: 'details:configureActions', + title: '{{t("Configure actions")}}', + icon: 'SettingOutlined', + style: { + marginLeft: 8, + }, + items: [ + { + type: 'itemGroup', + name: 'enableActions', + title: '{{t("Enable actions")}}', + children: [ + { + title: '{{t("Edit")}}', + name: 'edit', + Component: 'UpdateActionInitializer', + schema: { + 'x-component': 'Action', + 'x-decorator': 'ACLActionProvider', + 'x-component-props': { + type: 'primary', + }, + }, + useVisible: useVisibleCollection, + }, + { + title: '{{t("Delete")}}', + name: 'delete', + Component: 'DestroyActionInitializer', + schema: { + 'x-component': 'Action', + 'x-decorator': 'ACLActionProvider', + }, + useVisible: useVisibleCollection, + }, + ], + }, + { + name: 'divider', + type: 'divider', + }, + { + type: 'subMenu', + name: 'customize', + title: '{{t("Customize")}}', + children: [ + { + name: 'popup', + title: '{{t("Popup")}}', + Component: 'PopupActionInitializer', + useComponentProps() { + return { + 'x-component': 'Action', + }; + }, + }, + { + name: 'updateRecord', + title: '{{t("Update record")}}', + Component: 'UpdateRecordActionInitializer', + useComponentProps() { + return { + 'x-component': 'Action', + }; + }, + visible: useVisibleCollection, + }, + { + name: 'customRequest', + title: '{{t("Custom request")}}', + Component: 'CustomRequestInitializer', + useVisible: useVisibleCollection, + }, + ], + }, + ], + }, + readPrettyFormActionInitializers_deprecated, +); diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-single/ReadPrettyFormItemInitializers.tsx b/packages/core/client/src/modules/blocks/data-blocks/details-single/ReadPrettyFormItemInitializers.tsx index 0f0f2b677..9efcdcf26 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/details-single/ReadPrettyFormItemInitializers.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/details-single/ReadPrettyFormItemInitializers.tsx @@ -1,7 +1,6 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; -import { SchemaInitializerChildren } from '../../../../application'; -import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer'; +import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; import { useCompile } from '../../../../schema-component'; import { gridRowColWrap, @@ -9,6 +8,7 @@ import { useFormItemInitializerFields, useInheritsFormItemInitializerFields, } from '../../../../schema-initializer/utils'; +import { SchemaInitializerChildren } from '../../../../application/schema-initializer/components/SchemaInitializerChildren'; const ParentCollectionFields = () => { const inheritFields = useInheritsFormItemInitializerFields(); @@ -45,7 +45,10 @@ const AssociatedFields = () => { return {schema}; }; -export const readPrettyFormItemInitializers = new SchemaInitializer({ +/** + * @deprecated + */ +export const readPrettyFormItemInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'ReadPrettyFormItemInitializers', wrap: gridRowColWrap, icon: 'SettingOutlined', @@ -88,3 +91,50 @@ export const readPrettyFormItemInitializers = new SchemaInitializer({ }, ], }); + +export const readPrettyFormItemInitializers = new CompatibleSchemaInitializer( + { + name: 'details:configureFields', + wrap: gridRowColWrap, + icon: 'SettingOutlined', + title: '{{t("Configure fields")}}', + items: [ + { + type: 'itemGroup', + name: 'displayFields', + title: '{{t("Display fields")}}', + useChildren: useFormItemInitializerFields, + }, + { + name: 'parentCollectionFields', + Component: ParentCollectionFields, + }, + { + name: 'associationFields', + Component: AssociatedFields, + }, + { + name: 'divider', + type: 'divider', + }, + { + name: 'addText', + title: '{{t("Add text")}}', + Component: 'BlockItemInitializer', + schema: { + type: 'void', + 'x-editable': false, + 'x-decorator': 'FormItem', + // 'x-designer': 'Markdown.Void.Designer', + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:markdown', + 'x-component': 'Markdown.Void', + 'x-component-props': { + content: '{{t("This is a demo text, **supports Markdown syntax**.")}}', + }, + }, + }, + ], + }, + readPrettyFormItemInitializers_deprecated, +); diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-single/RecordReadPrettyFormBlockInitializer.tsx b/packages/core/client/src/modules/blocks/data-blocks/details-single/RecordReadPrettyFormBlockInitializer.tsx index 39eae3464..946574ee1 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/details-single/RecordReadPrettyFormBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/details-single/RecordReadPrettyFormBlockInitializer.tsx @@ -26,7 +26,7 @@ export const RecordReadPrettyFormBlockInitializer = () => { const association = useBlockAssociationContext(); const { block } = useBlockRequestContext(); const actionInitializers = - block !== 'TableField' ? itemConfig.actionInitializers || 'ReadPrettyFormActionInitializers' : null; + block !== 'TableField' ? itemConfig.actionInitializers || 'details:configureActions' : null; return ( { await nocoPage.goto(); await page.getByLabel('action-Action.Link-View-view-general-table-0').click(); - await page.getByLabel('schema-initializer-Grid-RecordBlockInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover(); await page.getByRole('menuitem', { name: 'Details' }).click(); await page.mouse.move(300, 0); @@ -22,7 +22,7 @@ test.describe('configure actions', () => { await nocoPage.goto(); await page.getByLabel('action-Action.Link-View-view-general-table-0').click(); - await page.getByLabel('schema-initializer-Grid-RecordBlockInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover(); await page.getByRole('menuitem', { name: 'Details' }).click(); await page.mouse.move(300, 0); @@ -61,14 +61,14 @@ test.describe('configure actions', () => { test.describe('configure fields', () => {}); async function createAction(page: Page, name: string) { - await page.getByLabel('schema-initializer-ActionBar-ReadPrettyFormActionInitializers-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-details:configureActions-general').hover(); await page.getByRole('menuitem', { name: name }).click(); await expect(page.getByRole('menuitem', { name: name }).getByRole('switch')).toBeChecked(); await page.mouse.move(300, 0); } async function createCustomAction(page: Page, name: string) { - await page.getByLabel('schema-initializer-ActionBar-ReadPrettyFormActionInitializers-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-details:configureActions-general').hover(); await page.getByRole('menuitem', { name: 'Customize' }).hover(); await page.getByRole('menuitem', { name: name }).click(); await page.mouse.move(0, 400); diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/CreateFormBlockInitializer.tsx b/packages/core/client/src/modules/blocks/data-blocks/form/CreateFormBlockInitializer.tsx index 1793c2961..68614c002 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/CreateFormBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/form/CreateFormBlockInitializer.tsx @@ -24,7 +24,7 @@ export const CreateFormBlockInitializer = () => { const s = await getTemplateSchemaByMode(item); if (item.template.componentName === 'FormItem') { const blockSchema = createFormBlockSchema({ - actionInitializers: 'CreateFormActionInitializers', + actionInitializers: 'createForm:configureActions', association, dataSource: collection.dataSource, collection: collection.name, @@ -41,7 +41,7 @@ export const CreateFormBlockInitializer = () => { } else { insert( createFormBlockSchema({ - actionInitializers: 'CreateFormActionInitializers', + actionInitializers: 'createForm:configureActions', association, dataSource: collection.dataSource, collection: collection.name, diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/RecordFormBlockInitializer.tsx b/packages/core/client/src/modules/blocks/data-blocks/form/RecordFormBlockInitializer.tsx index 245fb6c0c..3fa04e006 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/RecordFormBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/form/RecordFormBlockInitializer.tsx @@ -29,7 +29,7 @@ export const RecordFormBlockInitializer = () => { action: 'get', useSourceId: '{{ useSourceIdFromParentRecord }}', useParams: '{{ useParamsFromRecord }}', - actionInitializers: 'UpdateFormActionInitializers', + actionInitializers: 'editForm:configureActions', template: s, settings: 'blockSettings:editForm', }); @@ -49,7 +49,7 @@ export const RecordFormBlockInitializer = () => { action: 'get', useSourceId: '{{ useSourceIdFromParentRecord }}', useParams: '{{ useParamsFromRecord }}', - actionInitializers: 'UpdateFormActionInitializers', + actionInitializers: 'editForm:configureActions', settings: 'blockSettings:editForm', }), ); diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/dragAndDrop.test.ts b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/dragAndDrop.test.ts index d1c87ff93..f78366e74 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/dragAndDrop.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/dragAndDrop.test.ts @@ -2,7 +2,7 @@ import { expect, oneFormBlockBasedOnUsers, test } from '@nocobase/test/e2e'; test('fields', async ({ page, mockPage }) => { await mockPage(oneFormBlockBasedOnUsers).goto(); - await page.getByLabel('schema-initializer-Grid-FormItemInitializers-users').hover(); + await page.getByLabel('schema-initializer-Grid-form:configureFields-users').hover(); await page.getByRole('menuitem', { name: 'Nickname' }).click(); await page.getByRole('menuitem', { name: 'Username' }).click(); await page.getByRole('menuitem', { name: 'Email' }).click(); diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/lazyLoadAssociationFields.test.ts b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/lazyLoadAssociationFields.test.ts index 05a5bf367..c21837c22 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/lazyLoadAssociationFields.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/lazyLoadAssociationFields.test.ts @@ -282,7 +282,7 @@ test.describe('association fields', () => { await expect(page.getByLabel('Member')).toBeHidden(); await expect(page.getByLabel('Root')).toBeVisible(); - await page.getByLabel('schema-initializer-Grid-FormItemInitializers-users').hover(); + await page.getByLabel('schema-initializer-Grid-form:configureFields-users').hover(); await page.getByRole('menuitem', { name: 'Nickname' }).click(); await page.mouse.move(200, 0); diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaInitializer.test.ts b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaInitializer.test.ts index fb9b93f30..d7b9b99be 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaInitializer.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaInitializer.test.ts @@ -6,7 +6,7 @@ test.describe('where creation form block can be added', () => { test('page', async ({ page, mockPage }) => { await mockPage().goto(); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await createBlockInPage(page, 'Form'); await expect(page.getByLabel('block-item-CardItem-users-form')).toBeVisible(); }); @@ -17,7 +17,7 @@ test.describe('configure fields', () => { await mockPage(oneEmptyForm).goto(); // collection fields - await page.getByLabel('schema-initializer-Grid-FormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover(); await page.getByRole('menuitem', { name: 'ID', exact: true }).click(); await expect(page.getByRole('menuitem', { name: 'ID', exact: true }).getByRole('switch')).toBeChecked(); @@ -33,7 +33,7 @@ test.describe('configure fields', () => { await expect(page.getByLabel('block-item-CollectionField-general-form-general.manyToOne.nickname')).toBeVisible(); // delete fields - await page.getByLabel('schema-initializer-Grid-FormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover(); await page.getByRole('menuitem', { name: 'ID', exact: true }).click(); await expect(page.getByRole('menuitem', { name: 'ID', exact: true }).getByRole('switch')).not.toBeChecked(); @@ -50,7 +50,7 @@ test.describe('configure fields', () => { ).not.toBeVisible(); // add text - await page.getByLabel('schema-initializer-Grid-FormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover(); await page.getByRole('menuitem', { name: 'Text' }).click(); await expect(page.getByLabel('block-item-Markdown.Void-general-form')).toBeVisible(); }); @@ -62,7 +62,7 @@ test.describe('configure actions', () => { test('submit', async ({ page, mockPage }) => { await mockPage(oneEmptyForm).goto(); - await page.getByLabel('schema-initializer-ActionBar-FormActionInitializers-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-createForm:configureActions-general').hover(); // add button await page.getByRole('menuitem', { name: 'Submit' }).click(); @@ -72,7 +72,7 @@ test.describe('configure actions', () => { await expect(page.getByRole('button', { name: 'Submit' })).toBeVisible(); // delete button - await page.getByLabel('schema-initializer-ActionBar-FormActionInitializers-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-createForm:configureActions-general').hover(); await page.getByRole('menuitem', { name: 'Submit' }).click(); await expect(page.getByRole('menuitem', { name: 'Submit' }).getByRole('switch')).not.toBeChecked(); @@ -137,7 +137,7 @@ test.describe('configure actions', () => { test('customize: save record', async ({ page, mockPage }) => { await mockPage(oneEmptyForm).goto(); - await page.getByLabel('schema-initializer-ActionBar-FormActionInitializers-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-createForm:configureActions-general').hover(); await page.getByRole('menuitem', { name: 'Customize' }).hover(); await page.getByRole('menuitem', { name: 'Save record' }).click(); diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaSettings.test.ts b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaSettings.test.ts index 7f8a5acd7..cb311d787 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaSettings.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaSettings.test.ts @@ -350,7 +350,7 @@ test.describe('creation form block schema settings', () => { await expect(page.getByRole('menuitem', { name: 'Convert reference to duplicate' })).toBeVisible(); // 创建区块的时候,可以选择刚才保存的模板 -------------------------------------------------- - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'form Form right' }).first().hover(); await page.getByRole('menuitem', { name: 'General right' }).hover(); @@ -359,7 +359,7 @@ test.describe('creation form block schema settings', () => { await page.getByRole('menuitem', { name: 'new_form_template (Fields only)' }).click(); // Reference template - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'form Form right' }).first().hover(); await page.getByRole('menuitem', { name: 'General right' }).hover(); await page.getByRole('menuitem', { name: 'General right' }).click(); @@ -549,7 +549,7 @@ test.describe('creation form block schema settings', () => { .hover(); await page.mouse.move(100, 0); - await page.getByLabel('schema-initializer-Grid-FormItemInitializers-users').hover(); + await page.getByLabel('schema-initializer-Grid-form:configureFields-users').hover(); await page.getByRole('menuitem', { name: 'Nickname' }).click(); await page.getByRole('menuitem', { name: 'Username' }).click(); @@ -622,7 +622,7 @@ test.describe('creation form block schema settings', () => { .hover(); await page.mouse.move(100, 0); - await page.getByLabel('schema-initializer-AssociationField.SubTable-TableColumnInitializers-users').hover(); + await page.getByLabel('schema-initializer-AssociationField.SubTable-table:configureColumns-users').hover(); await page.getByRole('menuitem', { name: 'Nickname' }).click(); await page.getByRole('menuitem', { name: 'Username' }).click(); @@ -719,7 +719,7 @@ test.describe('creation form block schema settings', () => { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { gdj0ceke8ac: { _isJSONSchemaObject: true, @@ -764,7 +764,7 @@ test.describe('creation form block schema settings', () => { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { gnw25oyqe56: { _isJSONSchemaObject: true, @@ -810,7 +810,7 @@ test.describe('creation form block schema settings', () => { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'FormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -879,7 +879,7 @@ test.describe('creation form block schema settings', () => { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { ibb0kjq3kyl: { _isJSONSchemaObject: true, @@ -919,7 +919,7 @@ test.describe('creation form block schema settings', () => { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -980,7 +980,7 @@ test.describe('creation form block schema settings', () => { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', 'x-uid': 'w224zhqyair', 'x-async': false, 'x-index': 1, @@ -1014,7 +1014,7 @@ test.describe('creation form block schema settings', () => { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -1033,7 +1033,7 @@ test.describe('creation form block schema settings', () => { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -1094,7 +1094,7 @@ test.describe('creation form block schema settings', () => { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', 'x-uid': 's49vs6v3qs0', 'x-async': false, 'x-index': 1, @@ -1160,7 +1160,7 @@ test.describe('creation form block schema settings', () => { 'x-index': 1, }, }).goto(); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); //使用复制模板 await page.getByRole('menuitem', { name: 'form Form' }).first().hover(); await page.getByRole('menuitem', { name: 'Users' }).hover(); @@ -1171,25 +1171,25 @@ test.describe('creation form block schema settings', () => { //在新建操作中使用引用模板 await page.getByLabel('action-Action-Add new-create-users-table').click(); - await page.getByLabel('schema-initializer-Grid-CreateFormBlockInitializers-users').hover(); + await page.getByLabel('schema-initializer-Grid-popup:addNew:addBlock-users').hover(); await page.getByRole('menuitem', { name: 'form Form' }).first().hover(); await page.getByRole('menuitem', { name: 'Reference template' }).hover(); await page.getByRole('menuitem', { name: 'Users_Form (Fields only)' }).first().click(); await page.mouse.move(300, 0); - await page.getByLabel('schema-initializer-Grid-CreateFormBlockInitializers-users').hover(); + await page.getByLabel('schema-initializer-Grid-popup:addNew:addBlock-users').hover(); await expect(page.locator('.ant-drawer').getByLabel('block-item-CardItem-users-form')).toBeVisible(); await page.locator('.ant-drawer-mask').click(); //在编辑操作中使用引用模板 await page.getByLabel('action-Action.Link-Edit-update-users-table-0').click(); - await page.getByLabel('schema-initializer-Grid-RecordBlockInitializers-users').click(); + await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-users').click(); await page.getByRole('menuitem', { name: 'form Form' }).first().hover(); await page.getByRole('menuitem', { name: 'Reference template' }).hover(); await page.getByRole('menuitem', { name: 'Users_Form (Fields only)' }).first().click(); await page.mouse.move(300, 0); //修改引用模板 - await page.locator('.ant-drawer').getByLabel('schema-initializer-Grid-FormItemInitializers-users').hover(); + await page.locator('.ant-drawer').getByLabel('schema-initializer-Grid-form:configureFields-users').hover(); await page.getByRole('menuitem', { name: 'Phone' }).click(); await page.locator('.ant-drawer-mask').click(); //复制模板不同步,引用模板同步 diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/templatesOfBug.ts b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/templatesOfBug.ts index 03cae11ff..41afc0d6d 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/templatesOfBug.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/templatesOfBug.ts @@ -12,7 +12,7 @@ export const T2165 = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { psn8ekavlq6: { _isJSONSchemaObject: true, @@ -58,7 +58,7 @@ export const T2165 = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', 'x-linkage-rules': [ { condition: { @@ -235,7 +235,7 @@ export const T2165 = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'FormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -291,7 +291,7 @@ export const T2174 = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', 'x-index': 1, properties: { ppgwx2drpng: { @@ -335,7 +335,7 @@ export const T2174 = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -350,7 +350,7 @@ export const T2174 = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -370,7 +370,7 @@ export const T2174 = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', 'x-index': 1, properties: { actions: { @@ -438,7 +438,7 @@ export const T2174 = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', 'x-index': 1, properties: { g8w7wq09bgo: { @@ -492,7 +492,7 @@ export const T2174 = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', 'x-index': 1, properties: { s3hhb0ohnv1: { @@ -543,7 +543,7 @@ export const T2174 = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'CreateFormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -722,7 +722,7 @@ export const T2174 = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', 'x-index': 1, 'x-uid': 'roog7uz0d2o', 'x-async': false, @@ -888,7 +888,7 @@ export const T2614: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { vv0l8wohslb: { _isJSONSchemaObject: true, @@ -928,7 +928,7 @@ export const T2614: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -943,7 +943,7 @@ export const T2614: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -962,7 +962,7 @@ export const T2614: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -1024,7 +1024,7 @@ export const T2614: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { qbl84fadyr0: { _isJSONSchemaObject: true, @@ -1069,8 +1069,7 @@ export const T2614: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': - 'ReadPrettyFormActionInitializers', + 'x-initializer': 'details:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -1086,8 +1085,7 @@ export const T2614: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': - 'ReadPrettyFormItemInitializers', + 'x-initializer': 'details:configureFields', properties: { i39cn9ve66b: { _isJSONSchemaObject: true, @@ -1128,7 +1126,7 @@ export const T2614: PageConfig = { type: 'void', 'x-component': 'Grid', 'x-initializer': - 'FormItemInitializers', + 'form:configureFields', properties: { e5kqdzyj562: { _isJSONSchemaObject: @@ -1355,7 +1353,7 @@ export const T2614: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { z79dioevb4n: { _isJSONSchemaObject: true, @@ -1403,7 +1401,7 @@ export const T2614: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { j9egu0k0tkq: { _isJSONSchemaObject: true, @@ -1444,7 +1442,7 @@ export const T2614: PageConfig = { type: 'void', 'x-component': 'Grid', 'x-initializer': - 'FormItemInitializers', + 'form:configureFields', properties: { esgv9d2n3jl: { _isJSONSchemaObject: @@ -1581,7 +1579,7 @@ export const T2614: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'UpdateFormActionInitializers', + 'x-initializer': 'editForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -1724,7 +1722,7 @@ export const T2993: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', 'x-index': 1, properties: { vv0l8wohslb: { @@ -1768,7 +1766,7 @@ export const T2993: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -1830,7 +1828,7 @@ export const T2993: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', properties: { kvyqrrxvggn: { _isJSONSchemaObject: true, @@ -1875,7 +1873,7 @@ export const T2993: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { itg7al9oxaw: { _isJSONSchemaObject: true, @@ -1917,7 +1915,7 @@ export const T2993: PageConfig = { type: 'void', 'x-component': 'Grid', 'x-initializer': - 'FormItemInitializers', + 'form:configureFields', properties: { um4p1ariq2x: { _isJSONSchemaObject: true, @@ -2017,7 +2015,7 @@ export const T2993: PageConfig = { 'x-component': 'Grid', 'x-initializer': - 'FormItemInitializers', + 'form:configureFields', properties: { uscd5l8tu2t: { @@ -2136,7 +2134,7 @@ export const T2993: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'CreateFormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -2201,7 +2199,7 @@ export const T2993: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -2221,7 +2219,7 @@ export const T2993: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', 'x-index': 1, properties: { actions: { @@ -2311,7 +2309,7 @@ export const T2615: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { '1valv0kj8vs': { _isJSONSchemaObject: true, @@ -2351,7 +2349,7 @@ export const T2615: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -2412,7 +2410,7 @@ export const T2615: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', properties: { '8ei3tsaojf6': { _isJSONSchemaObject: true, @@ -2457,7 +2455,7 @@ export const T2615: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { i7cb2o172ey: { _isJSONSchemaObject: true, @@ -2546,7 +2544,7 @@ export const T2615: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'CreateFormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -2612,7 +2610,7 @@ export const T2615: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -2631,7 +2629,7 @@ export const T2615: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -2693,7 +2691,7 @@ export const T2615: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { l79xm6sfjst: { _isJSONSchemaObject: true, @@ -2741,7 +2739,7 @@ export const T2615: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { '7eayo28dgzo': { _isJSONSchemaObject: true, @@ -2830,7 +2828,7 @@ export const T2615: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'UpdateFormActionInitializers', + 'x-initializer': 'editForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -2936,7 +2934,7 @@ export const T2615: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { nlnfd9hnl53: { _isJSONSchemaObject: true, @@ -2981,8 +2979,7 @@ export const T2615: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': - 'ReadPrettyFormActionInitializers', + 'x-initializer': 'details:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -2998,8 +2995,7 @@ export const T2615: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': - 'ReadPrettyFormItemInitializers', + 'x-initializer': 'details:configureFields', properties: { j9mxulol74m: { _isJSONSchemaObject: true, @@ -3215,7 +3211,7 @@ export const T2845: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', 'x-index': 1, properties: { '1valv0kj8vs': { @@ -3259,7 +3255,7 @@ export const T2845: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -3325,7 +3321,7 @@ export const T2845: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', 'x-index': 1, properties: { '8ei3tsaojf6': { @@ -3375,7 +3371,7 @@ export const T2845: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', 'x-index': 1, properties: { i7cb2o172ey: { @@ -3463,7 +3459,7 @@ export const T2845: PageConfig = { type: 'void', 'x-component': 'Grid', 'x-initializer': - 'FormItemInitializers', + 'form:configureFields', properties: { '3wg2gga1tgx': { _isJSONSchemaObject: true, @@ -3564,7 +3560,7 @@ export const T2845: PageConfig = { 'x-component': 'Grid', 'x-initializer': - 'RecordBlockInitializers', + 'popup:common:addBlock', 'x-uid': 'fen65isdi05', 'x-async': @@ -3650,7 +3646,7 @@ export const T2845: PageConfig = { type: 'void', 'x-component': 'Grid', 'x-initializer': - 'RecordBlockInitializers', + 'popup:common:addBlock', properties: { dksoesw9cnq: { _isJSONSchemaObject: @@ -3728,7 +3724,7 @@ export const T2845: PageConfig = { 'x-component': 'Grid', 'x-initializer': - 'FormItemInitializers', + 'form:configureFields', 'x-uid': 'slesgjv4uxx', 'x-async': @@ -3743,7 +3739,7 @@ export const T2845: PageConfig = { '2.0', type: 'void', 'x-initializer': - 'UpdateFormActionInitializers', + 'editForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': @@ -3824,7 +3820,7 @@ export const T2845: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'CreateFormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -3880,7 +3876,7 @@ export const T2845: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -3900,7 +3896,7 @@ export const T2845: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', 'x-index': 1, properties: { actions: { @@ -3967,7 +3963,7 @@ export const T2845: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', 'x-index': 1, properties: { l79xm6sfjst: { @@ -4020,7 +4016,7 @@ export const T2845: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', 'x-index': 1, properties: { '7eayo28dgzo': { @@ -4107,7 +4103,7 @@ export const T2845: PageConfig = { type: 'void', 'x-component': 'Grid', 'x-initializer': - 'FormItemInitializers', + 'form:configureFields', properties: { ddo3fvkz6hw: { _isJSONSchemaObject: @@ -4235,7 +4231,7 @@ export const T2845: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'UpdateFormActionInitializers', + 'x-initializer': 'editForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -4336,7 +4332,7 @@ export const T2845: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', 'x-index': 1, properties: { nlnfd9hnl53: { @@ -4386,8 +4382,7 @@ export const T2845: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': - 'ReadPrettyFormActionInitializers', + 'x-initializer': 'details:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -4403,8 +4398,7 @@ export const T2845: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': - 'ReadPrettyFormItemInitializers', + 'x-initializer': 'details:configureFields', 'x-index': 2, properties: { j9mxulol74m: { @@ -4491,7 +4485,7 @@ export const T2845: PageConfig = { type: 'void', 'x-component': 'Grid', 'x-initializer': - 'FormItemInitializers', + 'form:configureFields', properties: { c5mcb8foh05: { _isJSONSchemaObject: @@ -4697,7 +4691,7 @@ export const T2200 = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { ai6ojrzwkiv: { _isJSONSchemaObject: true, @@ -4737,7 +4731,7 @@ export const T2200 = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -4752,7 +4746,7 @@ export const T2200 = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -4771,7 +4765,7 @@ export const T2200 = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -4832,7 +4826,7 @@ export const T2200 = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { dv88ljcl0qw: { _isJSONSchemaObject: true, @@ -4880,7 +4874,7 @@ export const T2200 = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { '3i87cpmv87x': { _isJSONSchemaObject: true, @@ -4926,7 +4920,7 @@ export const T2200 = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'UpdateFormActionInitializers', + 'x-initializer': 'editForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -5039,7 +5033,7 @@ export const T3106: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', 'x-index': 1, properties: { cxk2aa058lc: { @@ -5089,7 +5083,7 @@ export const T3106: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', 'x-index': 1, properties: { wbvuzjzl83g: { @@ -5123,7 +5117,7 @@ export const T3106: PageConfig = { version: '2.0', type: 'void', 'x-component': 'AssociationField.SubTable', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-initializer-props': { action: false, }, @@ -5187,7 +5181,7 @@ export const T3106: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'FormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -5259,7 +5253,7 @@ export const T3251: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { xovhjqo0uig: { _isJSONSchemaObject: true, @@ -5305,7 +5299,7 @@ export const T3251: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', 'x-linkage-rules': [ { condition: { @@ -5448,7 +5442,7 @@ export const T3251: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'FormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-edit/schemaInitializer.test.ts b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-edit/schemaInitializer.test.ts index f81394c78..e24468c88 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-edit/schemaInitializer.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-edit/schemaInitializer.test.ts @@ -7,7 +7,7 @@ test.describe('where edit form block can be added', () => { await nocoPage.goto(); await page.getByLabel('action-Action.Link-Edit-update-general-table-0').click(); - await page.getByLabel('schema-initializer-Grid-RecordBlockInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover(); await page.getByText('Form').first().click(); await page.mouse.move(300, 0); diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/createFormActionInitializers.tsx b/packages/core/client/src/modules/blocks/data-blocks/form/createFormActionInitializers.tsx index 87b57abbe..4696bec0d 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/createFormActionInitializers.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/form/createFormActionInitializers.tsx @@ -1,6 +1,9 @@ -import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer'; +import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; -export const createFormActionInitializers = new SchemaInitializer({ +/** + * @deprecated + */ +export const createFormActionInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'CreateFormActionInitializers', title: '{{t("Configure actions")}}', icon: 'SettingOutlined', @@ -43,3 +46,50 @@ export const createFormActionInitializers = new SchemaInitializer({ }, ], }); + +export const createFormActionInitializers = new CompatibleSchemaInitializer( + { + name: 'createForm:configureActions', + title: '{{t("Configure actions")}}', + icon: 'SettingOutlined', + items: [ + { + type: 'itemGroup', + title: '{{t("Enable actions")}}', + name: 'enableActions', + children: [ + { + name: 'submit', + title: '{{t("Submit")}}', + Component: 'CreateSubmitActionInitializer', + schema: { + 'x-action-settings': {}, + }, + }, + ], + }, + { + name: 'divider', + type: 'divider', + }, + { + type: 'subMenu', + title: '{{t("Customize")}}', + name: 'customize', + children: [ + { + name: 'saveRecord', + title: '{{t("Save record")}}', + Component: 'SaveRecordActionInitializer', + }, + { + name: 'customRequest', + title: '{{t("Custom request")}}', + Component: 'CustomRequestInitializer', + }, + ], + }, + ], + }, + createFormActionInitializers_deprecated, +); diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/formActionInitializers.tsx b/packages/core/client/src/modules/blocks/data-blocks/form/formActionInitializers.tsx index a16659f4a..8ff127252 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/formActionInitializers.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/form/formActionInitializers.tsx @@ -1,7 +1,9 @@ -import { SchemaInitializerItemType } from '../../../../application'; import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer'; -// 表单的操作配置 +/** + * @deprecated + * 表单的操作配置 + */ export const formActionInitializers = new SchemaInitializer({ name: 'FormActionInitializers', title: '{{t("Configure actions")}}', @@ -27,7 +29,7 @@ export const formActionInitializers = new SchemaInitializer({ type: 'divider', }, { - name: 'custom', + name: 'customize', type: 'subMenu', title: '{{t("Customize")}}', children: [ diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/formItemInitializers.tsx b/packages/core/client/src/modules/blocks/data-blocks/form/formItemInitializers.tsx index 63f3c6bed..633ab1db0 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/formItemInitializers.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/form/formItemInitializers.tsx @@ -1,10 +1,12 @@ -import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer'; import { gridRowColWrap, useFormItemInitializerFields } from '../../../../schema-initializer/utils'; import { ParentCollectionFields, AssociatedFields } from '../../../../schema-initializer/buttons/FormItemInitializers'; +import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; -// 表单里配置字段 - -export const formItemInitializers = new SchemaInitializer({ +/** + * @deprecated + * 表单里配置字段 + */ +export const formItemInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'FormItemInitializers', wrap: gridRowColWrap, icon: 'SettingOutlined', @@ -35,3 +37,38 @@ export const formItemInitializers = new SchemaInitializer({ }, ], }); + +export const formItemInitializers = new CompatibleSchemaInitializer( + { + name: 'form:configureFields', + wrap: gridRowColWrap, + icon: 'SettingOutlined', + title: '{{t("Configure fields")}}', + items: [ + { + type: 'itemGroup', + name: 'displayFields', + title: '{{t("Display fields")}}', + useChildren: useFormItemInitializerFields, + }, + { + name: 'parentCollectionFields', + Component: ParentCollectionFields, + }, + { + name: 'associationFields', + Component: AssociatedFields, + }, + { + name: 'divider', + type: 'divider', + }, + { + name: 'addText', + title: '{{t("Add text")}}', + Component: 'MarkdownFormItemInitializer', + }, + ], + }, + formItemInitializers_deprecated, +); diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/updateFormActionInitializers.tsx b/packages/core/client/src/modules/blocks/data-blocks/form/updateFormActionInitializers.tsx index 56aaa47fc..46bf31630 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/updateFormActionInitializers.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/form/updateFormActionInitializers.tsx @@ -1,6 +1,9 @@ -import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer'; +import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; -export const updateFormActionInitializers = new SchemaInitializer({ +/** + * @deprecated + */ +export const updateFormActionInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'UpdateFormActionInitializers', title: '{{t("Configure actions")}}', icon: 'SettingOutlined', @@ -54,3 +57,61 @@ export const updateFormActionInitializers = new SchemaInitializer({ }, ], }); + +export const updateFormActionInitializers = new CompatibleSchemaInitializer( + { + name: 'editForm:configureActions', + title: '{{t("Configure actions")}}', + icon: 'SettingOutlined', + items: [ + { + type: 'itemGroup', + title: '{{t("Enable actions")}}', + name: 'enableActions', + children: [ + { + name: 'submit', + title: '{{t("Submit")}}', + Component: 'UpdateSubmitActionInitializer', + schema: { + 'x-action-settings': {}, + }, + }, + ], + }, + { + name: 'divider', + type: 'divider', + }, + { + type: 'subMenu', + title: '{{t("Customize")}}', + name: 'customize', + children: [ + { + name: 'popup', + title: '{{t("Popup")}}', + Component: 'PopupActionInitializer', + useComponentProps() { + return { + 'x-component': 'Action', + }; + }, + }, + { + name: 'saveRecord', + title: '{{t("Save record")}}', + Component: 'SaveRecordActionInitializer', + }, + { + type: 'item', + name: 'customRequest', + title: '{{t("Custom request")}}', + Component: 'CustomRequestInitializer', + }, + ], + }, + ], + }, + updateFormActionInitializers_deprecated, +); diff --git a/packages/core/client/src/modules/blocks/data-blocks/grid-card/GridCardActionInitializers.tsx b/packages/core/client/src/modules/blocks/data-blocks/grid-card/GridCardActionInitializers.tsx index 67ae9874a..5b143528a 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/grid-card/GridCardActionInitializers.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/grid-card/GridCardActionInitializers.tsx @@ -1,8 +1,10 @@ -import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer'; +import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; import { useCollection_deprecated } from '../../../../collection-manager'; -// 表单的操作配置 -export const gridCardActionInitializers = new SchemaInitializer({ +/** + * @deprecated + */ +export const gridCardActionInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'GridCardActionInitializers', title: "{{t('Configure actions')}}", icon: 'SettingOutlined', @@ -80,3 +82,85 @@ export const gridCardActionInitializers = new SchemaInitializer({ }, ], }); + +export const gridCardActionInitializers = new CompatibleSchemaInitializer( + { + name: 'gridCard:configureActions', + title: "{{t('Configure actions')}}", + icon: 'SettingOutlined', + style: { + marginLeft: 8, + }, + items: [ + { + type: 'itemGroup', + title: "{{t('Enable actions')}}", + name: 'enableActions', + children: [ + { + name: 'filter', + title: "{{t('Filter')}}", + Component: 'FilterActionInitializer', + schema: { + 'x-align': 'left', + }, + }, + { + name: 'addNew', + title: "{{t('Add new')}}", + Component: 'CreateActionInitializer', + schema: { + 'x-align': 'right', + 'x-decorator': 'ACLActionProvider', + 'x-acl-action-props': { + skipScopeCheck: true, + }, + }, + useVisible() { + const collection = useCollection_deprecated(); + return !['view', 'file', 'sql'].includes(collection.template) || collection?.writableView; + }, + }, + { + name: 'refresh', + title: "{{t('Refresh')}}", + Component: 'RefreshActionInitializer', + schema: { + 'x-align': 'right', + }, + }, + { + name: 'import', + title: "{{t('Import')}}", + Component: 'ImportActionInitializer', + schema: { + 'x-align': 'right', + 'x-acl-action': 'importXlsx', + 'x-decorator': 'ACLActionProvider', + 'x-acl-action-props': { + skipScopeCheck: true, + }, + }, + useVisible() { + const collection = useCollection_deprecated(); + return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; + }, + }, + { + name: 'export', + title: "{{t('Export')}}", + Component: 'ExportActionInitializer', + schema: { + 'x-align': 'right', + 'x-decorator': 'ACLActionProvider', + 'x-acl-action-props': { + skipScopeCheck: true, + }, + }, + }, + ], + }, + ], + }, + gridCardActionInitializers_deprecated, +); diff --git a/packages/core/client/src/modules/blocks/data-blocks/grid-card/__e2e__/schemaInitializer.test.ts b/packages/core/client/src/modules/blocks/data-blocks/grid-card/__e2e__/schemaInitializer.test.ts index 8570f5539..8357c3a51 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/grid-card/__e2e__/schemaInitializer.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/grid-card/__e2e__/schemaInitializer.test.ts @@ -4,7 +4,7 @@ test.describe('where grid card block can be added', () => { test('page', async ({ page, mockPage }) => { await mockPage().goto(); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await createBlockInPage(page, 'Grid Card'); await expect(page.getByLabel('block-item-BlockItem-users-grid-card')).toBeVisible(); }); @@ -16,7 +16,7 @@ test.describe('configure global actions', () => { test('filter & add new & refresh', async ({ page, mockPage }) => { await mockPage(oneEmptyGridCardBlock).goto(); - await page.getByLabel('schema-initializer-ActionBar-GridCardActionInitializers-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-gridCard:configureActions-general').hover(); await page.getByRole('menuitem', { name: 'Filter' }).click(); await page.getByRole('menuitem', { name: 'Add new' }).click(); await page.getByRole('menuitem', { name: 'Refresh' }).click(); @@ -31,7 +31,7 @@ test.describe('configure global actions', () => { await expect(page.getByRole('button', { name: 'Refresh' })).toBeVisible(); // delete buttons - await page.getByLabel('schema-initializer-ActionBar-GridCardActionInitializers-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-gridCard:configureActions-general').hover(); await page.getByRole('menuitem', { name: 'Filter' }).click(); await page.getByRole('menuitem', { name: 'Add new' }).click(); await page.getByRole('menuitem', { name: 'Refresh' }).click(); @@ -53,7 +53,7 @@ test.describe('configure item actions', () => { await mockRecord('general'); await nocoPage.goto(); - await page.getByLabel('schema-initializer-ActionBar-GridCardItemActionInitializers-general').first().hover(); + await page.getByLabel('schema-initializer-ActionBar-gridCard:configureItemActions-general').first().hover(); await page.getByRole('menuitem', { name: 'View' }).click(); await page.getByRole('menuitem', { name: 'Edit' }).click(); await page.getByRole('menuitem', { name: 'Delete' }).click(); @@ -68,7 +68,7 @@ test.describe('configure item actions', () => { await expect(page.getByLabel('action-Action.Link-Delete-destroy-general-grid-card').first()).toBeVisible(); // delete buttons - await page.getByLabel('schema-initializer-ActionBar-GridCardItemActionInitializers-general').first().hover(); + await page.getByLabel('schema-initializer-ActionBar-gridCard:configureItemActions-general').first().hover(); await page.getByRole('menuitem', { name: 'View' }).click(); await page.getByRole('menuitem', { name: 'Edit' }).click(); await page.getByRole('menuitem', { name: 'Delete' }).click(); @@ -88,7 +88,7 @@ test.describe('configure item actions', () => { await mockRecord('general'); await nocoPage.goto(); - await page.getByLabel('schema-initializer-ActionBar-GridCardItemActionInitializers-general').first().hover(); + await page.getByLabel('schema-initializer-ActionBar-gridCard:configureItemActions-general').first().hover(); await page.getByRole('menuitem', { name: 'Customize' }).hover(); await page.getByRole('menuitem', { name: 'Popup' }).click(); await page.getByRole('menuitem', { name: 'Update record' }).click(); @@ -107,9 +107,7 @@ test.describe('configure fields', () => { await mockRecord('general'); await nocoPage.goto(); - const formItemInitializer = page - .getByLabel('schema-initializer-Grid-ReadPrettyFormItemInitializers-general') - .first(); + const formItemInitializer = page.getByLabel('schema-initializer-Grid-details:configureFields-general').first(); await formItemInitializer.hover(); await page.getByRole('menuitem', { name: 'ID', exact: true }).click(); diff --git a/packages/core/client/src/modules/blocks/data-blocks/grid-card/gridCardItemActionInitializers.tsx b/packages/core/client/src/modules/blocks/data-blocks/grid-card/gridCardItemActionInitializers.tsx index 3118ebe22..8418ffd6e 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/grid-card/gridCardItemActionInitializers.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/grid-card/gridCardItemActionInitializers.tsx @@ -1,7 +1,10 @@ -import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer'; +import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; import { useCollection_deprecated } from '../../../../collection-manager'; -export const gridCardItemActionInitializers = new SchemaInitializer({ +/** + * @deprecated + */ +export const gridCardItemActionInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'GridCardItemActionInitializers', title: '{{t("Configure actions")}}', icon: 'SettingOutlined', @@ -98,3 +101,104 @@ export const gridCardItemActionInitializers = new SchemaInitializer({ }, ], }); + +export const gridCardItemActionInitializers = new CompatibleSchemaInitializer( + { + name: 'gridCard:configureItemActions', + title: '{{t("Configure actions")}}', + icon: 'SettingOutlined', + items: [ + { + type: 'itemGroup', + title: '{{t("Enable actions")}}', + name: 'enable-actions', + children: [ + { + name: 'view', + title: '{{t("View")}}', + Component: 'ViewActionInitializer', + schema: { + 'x-component': 'Action.Link', + 'x-action': 'view', + 'x-decorator': 'ACLActionProvider', + 'x-align': 'left', + }, + }, + { + name: 'edit', + title: '{{t("Edit")}}', + Component: 'UpdateActionInitializer', + schema: { + 'x-component': 'Action.Link', + 'x-action': 'update', + 'x-decorator': 'ACLActionProvider', + 'x-align': 'left', + }, + useVisible() { + const collection = useCollection_deprecated(); + return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; + }, + }, + { + name: 'delete', + title: '{{t("Delete")}}', + Component: 'DestroyActionInitializer', + schema: { + 'x-component': 'Action.Link', + 'x-action': 'destroy', + 'x-decorator': 'ACLActionProvider', + 'x-align': 'left', + }, + useVisible() { + const collection = useCollection_deprecated(); + return collection.template !== 'sql'; + }, + }, + ], + }, + { + name: 'divider', + type: 'divider', + }, + { + type: 'subMenu', + title: '{{t("Customize")}}', + name: 'customize', + children: [ + { + name: 'popup', + title: '{{t("Popup")}}', + Component: 'PopupActionInitializer', + useComponentProps() { + return { + 'x-component': 'Action.Link', + }; + }, + }, + { + name: 'update-record', + title: '{{t("Update record")}}', + Component: 'UpdateRecordActionInitializer', + useVisible() { + const collection = useCollection_deprecated(); + return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; + }, + }, + { + name: 'customRequest', + title: '{{t("Custom request")}}', + Component: 'CustomRequestInitializer', + schema: { + 'x-action': 'customize:table:request', + }, + useVisible() { + const collection = useCollection_deprecated(); + return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; + }, + }, + ], + }, + ], + }, + gridCardItemActionInitializers_deprecated, +); diff --git a/packages/core/client/src/modules/blocks/data-blocks/list/ListActionInitializers.tsx b/packages/core/client/src/modules/blocks/data-blocks/list/ListActionInitializers.tsx index ab4e0bbdc..ab7caa761 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/list/ListActionInitializers.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/list/ListActionInitializers.tsx @@ -1,8 +1,11 @@ -import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer'; +import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; import { useCollection_deprecated } from '../../../../collection-manager'; -// 表单的操作配置 -export const listActionInitializers = new SchemaInitializer({ +/** + * @deprecated + * 表单的操作配置 + */ +export const listActionInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'ListActionInitializers', title: "{{t('Configure actions')}}", icon: 'SettingOutlined', @@ -84,3 +87,89 @@ export const listActionInitializers = new SchemaInitializer({ }, ], }); + +export const listActionInitializers = new CompatibleSchemaInitializer( + { + name: 'list:configureActions', + title: "{{t('Configure actions')}}", + icon: 'SettingOutlined', + style: { + marginLeft: 8, + }, + items: [ + { + type: 'itemGroup', + name: 'enableActions', + title: "{{t('Enable actions')}}", + children: [ + { + name: 'filter', + title: "{{t('Filter')}}", + Component: 'FilterActionInitializer', + schema: { + 'x-align': 'left', + }, + }, + { + name: 'addNew', + title: "{{t('Add new')}}", + Component: 'CreateActionInitializer', + schema: { + 'x-align': 'right', + 'x-decorator': 'ACLActionProvider', + 'x-acl-action-props': { + skipScopeCheck: true, + }, + }, + useVisible() { + const collection = useCollection_deprecated(); + return ( + (collection.template !== 'view' || collection?.writableView) && + collection.template !== 'file' && + collection.template !== 'sql' + ); + }, + }, + { + name: 'refresh', + title: "{{t('Refresh')}}", + Component: 'RefreshActionInitializer', + schema: { + 'x-align': 'right', + }, + }, + { + name: 'import', + title: "{{t('Import')}}", + Component: 'ImportActionInitializer', + schema: { + 'x-align': 'right', + 'x-acl-action': 'importXlsx', + 'x-decorator': 'ACLActionProvider', + 'x-acl-action-props': { + skipScopeCheck: true, + }, + }, + useVisible() { + const collection = useCollection_deprecated(); + return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; + }, + }, + { + name: 'export', + title: "{{t('Export')}}", + Component: 'ExportActionInitializer', + schema: { + 'x-align': 'right', + 'x-decorator': 'ACLActionProvider', + 'x-acl-action-props': { + skipScopeCheck: true, + }, + }, + }, + ], + }, + ], + }, + listActionInitializers_deprecated, +); diff --git a/packages/core/client/src/modules/blocks/data-blocks/list/__e2e__/schemaInitializer.test.ts b/packages/core/client/src/modules/blocks/data-blocks/list/__e2e__/schemaInitializer.test.ts index 38798576d..e1c6e7293 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/list/__e2e__/schemaInitializer.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/list/__e2e__/schemaInitializer.test.ts @@ -4,7 +4,7 @@ test.describe('where list block can be added', () => { test('page', async ({ page, mockPage }) => { await mockPage().goto(); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await createBlockInPage(page, 'List'); await expect(page.getByLabel('block-item-CardItem-users-list')).toBeVisible(); }); @@ -14,7 +14,7 @@ test.describe('configure global actions', () => { test('filter & add new & refresh', async ({ page, mockPage }) => { await mockPage(oneEmptyListBlock).goto(); - await page.getByLabel('schema-initializer-ActionBar-ListActionInitializers-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-list:configureActions-general').hover(); await page.getByRole('menuitem', { name: 'Filter' }).click(); await page.getByRole('menuitem', { name: 'Add new' }).click(); await page.getByRole('menuitem', { name: 'Refresh' }).click(); @@ -29,7 +29,7 @@ test.describe('configure global actions', () => { await expect(page.getByRole('button', { name: 'Refresh' })).toBeVisible(); // delete buttons - await page.getByLabel('schema-initializer-ActionBar-ListActionInitializers-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-list:configureActions-general').hover(); await page.getByRole('menuitem', { name: 'Filter' }).click(); await page.getByRole('menuitem', { name: 'Add new' }).click(); await page.getByRole('menuitem', { name: 'Refresh' }).click(); @@ -51,7 +51,7 @@ test.describe('configure item actions', () => { await mockRecord('general'); await nocoPage.goto(); - await page.getByLabel('schema-initializer-ActionBar-ListItemActionInitializers-general').first().hover(); + await page.getByLabel('schema-initializer-ActionBar-list:configureItemActions-general').first().hover(); await page.getByRole('menuitem', { name: 'View' }).click(); await page.getByRole('menuitem', { name: 'Edit' }).click(); await page.getByRole('menuitem', { name: 'Delete' }).click(); @@ -66,7 +66,7 @@ test.describe('configure item actions', () => { await expect(page.getByLabel('action-Action.Link-Delete-destroy-general-list').first()).toBeVisible(); // delete buttons - await page.getByLabel('schema-initializer-ActionBar-ListItemActionInitializers-general').first().hover(); + await page.getByLabel('schema-initializer-ActionBar-list:configureItemActions-general').first().hover(); await page.getByRole('menuitem', { name: 'View' }).click(); await page.getByRole('menuitem', { name: 'Edit' }).click(); await page.getByRole('menuitem', { name: 'Delete' }).click(); @@ -86,7 +86,7 @@ test.describe('configure item actions', () => { await mockRecord('general'); await nocoPage.goto(); - await page.getByLabel('schema-initializer-ActionBar-ListItemActionInitializers-general').first().hover(); + await page.getByLabel('schema-initializer-ActionBar-list:configureItemActions-general').first().hover(); await page.getByRole('menuitem', { name: 'Customize' }).hover(); await page.getByRole('menuitem', { name: 'Popup' }).click(); await page.getByRole('menuitem', { name: 'Update record' }).click(); @@ -105,9 +105,7 @@ test.describe('configure fields', () => { await mockRecord('general'); await nocoPage.goto(); - const formItemInitializer = page - .getByLabel('schema-initializer-Grid-ReadPrettyFormItemInitializers-general') - .first(); + const formItemInitializer = page.getByLabel('schema-initializer-Grid-details:configureFields-general').first(); // add fields await formItemInitializer.hover(); diff --git a/packages/core/client/src/modules/blocks/data-blocks/list/listItemActionInitializers.tsx b/packages/core/client/src/modules/blocks/data-blocks/list/listItemActionInitializers.tsx index 063c4f60c..845836879 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/list/listItemActionInitializers.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/list/listItemActionInitializers.tsx @@ -1,7 +1,10 @@ -import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer'; +import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; import { useCollection_deprecated } from '../../../../collection-manager'; -export const listItemActionInitializers = new SchemaInitializer({ +/** + * @deprecated + */ +export const listItemActionInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'ListItemActionInitializers', title: '{{t("Configure actions")}}', icon: 'SettingOutlined', @@ -98,3 +101,104 @@ export const listItemActionInitializers = new SchemaInitializer({ }, ], }); + +export const listItemActionInitializers = new CompatibleSchemaInitializer( + { + name: 'list:configureItemActions', + title: '{{t("Configure actions")}}', + icon: 'SettingOutlined', + items: [ + { + type: 'itemGroup', + name: 'enableActions', + title: '{{t("Enable actions")}}', + children: [ + { + name: 'view', + title: '{{t("View")}}', + Component: 'ViewActionInitializer', + schema: { + 'x-component': 'Action.Link', + 'x-action': 'view', + 'x-decorator': 'ACLActionProvider', + 'x-align': 'left', + }, + }, + { + name: 'edit', + title: '{{t("Edit")}}', + Component: 'UpdateActionInitializer', + schema: { + 'x-component': 'Action.Link', + 'x-action': 'update', + 'x-decorator': 'ACLActionProvider', + 'x-align': 'left', + }, + useVisible() { + const collection = useCollection_deprecated(); + return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; + }, + }, + { + name: 'delete', + title: '{{t("Delete")}}', + Component: 'DestroyActionInitializer', + schema: { + 'x-component': 'Action.Link', + 'x-action': 'destroy', + 'x-decorator': 'ACLActionProvider', + 'x-align': 'left', + }, + useVisible() { + const collection = useCollection_deprecated(); + return collection.template !== 'sql'; + }, + }, + ], + }, + { + name: 'divider', + type: 'divider', + }, + { + type: 'subMenu', + title: '{{t("Customize")}}', + name: 'customize', + children: [ + { + name: 'popup', + title: '{{t("Popup")}}', + Component: 'PopupActionInitializer', + useComponentProps() { + return { + 'x-component': 'Action.Link', + }; + }, + }, + { + name: 'updateRecord', + title: '{{t("Update record")}}', + Component: 'UpdateRecordActionInitializer', + useVisible() { + const collection = useCollection_deprecated(); + return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; + }, + }, + { + name: 'customRequest', + title: '{{t("Custom request")}}', + Component: 'CustomRequestInitializer', + schema: { + 'x-action': 'customize:table:request', + }, + useVisible() { + const collection = useCollection_deprecated(); + return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; + }, + }, + ], + }, + ], + }, + listItemActionInitializers_deprecated, +); diff --git a/packages/core/client/src/modules/blocks/data-blocks/table-selector/__e2e__/schemaInitializer.test.ts b/packages/core/client/src/modules/blocks/data-blocks/table-selector/__e2e__/schemaInitializer.test.ts index 282531176..32bd72dce 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table-selector/__e2e__/schemaInitializer.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/table-selector/__e2e__/schemaInitializer.test.ts @@ -20,7 +20,7 @@ test.describe('configure actions', () => { await createTable({ page, mockPage, fieldName: 'manyToOne' }); // add buttons - await page.getByLabel('schema-initializer-ActionBar-TableActionInitializers-users').hover(); + await page.getByLabel('schema-initializer-ActionBar-table:configureActions-users').hover(); await page.getByRole('menuitem', { name: 'Filter' }).click(); await page.getByRole('menuitem', { name: 'Add new' }).click(); await page.getByRole('menuitem', { name: 'Delete' }).click(); @@ -38,7 +38,7 @@ test.describe('configure actions', () => { await expect(page.getByRole('button', { name: 'Refresh' })).toBeVisible(); // delete buttons - await page.getByLabel('schema-initializer-ActionBar-TableActionInitializers-users').hover(); + await page.getByLabel('schema-initializer-ActionBar-table:configureActions-users').hover(); await page.getByRole('menuitem', { name: 'Filter' }).click(); await page.getByRole('menuitem', { name: 'Add new' }).click(); await page.getByRole('menuitem', { name: 'Delete' }).click(); @@ -59,7 +59,7 @@ test.describe('configure actions', () => { test('customize: bulk update', async ({ page, mockPage }) => { await createTable({ page, mockPage, fieldName: 'manyToOne' }); - await page.getByLabel('schema-initializer-ActionBar-TableActionInitializers-users').hover(); + await page.getByLabel('schema-initializer-ActionBar-table:configureActions-users').hover(); await page.getByRole('menuitem', { name: 'Customize' }).hover(); await page.getByRole('menuitem', { name: 'Bulk update' }).click(); @@ -99,6 +99,6 @@ test.describe('configure actions column', () => { }); async function createActionColumn(page: Page) { - await page.getByLabel('schema-initializer-TableV2.Selector-TableColumnInitializers-users').hover(); + await page.getByLabel('schema-initializer-TableV2.Selector-table:configureColumns-users').hover(); await page.getByRole('menuitem', { name: 'Action column' }).click(); } diff --git a/packages/core/client/src/modules/blocks/data-blocks/table-selector/__e2e__/utils.ts b/packages/core/client/src/modules/blocks/data-blocks/table-selector/__e2e__/utils.ts index 6b4424ad4..574ee0121 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table-selector/__e2e__/utils.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/table-selector/__e2e__/utils.ts @@ -18,7 +18,7 @@ export async function createTable({ .click(); // create a table block - await page.getByLabel('schema-initializer-Grid-TableSelectorInitializers-users').hover(); + await page.getByLabel('schema-initializer-Grid-popup:tableSelector:addBlock-users').hover(); await page.getByRole('menuitem', { name: 'form Table' }).click(); await page.mouse.move(300, 0); } diff --git a/packages/core/client/src/modules/blocks/data-blocks/table/TableActionColumnInitializers.tsx b/packages/core/client/src/modules/blocks/data-blocks/table/TableActionColumnInitializers.tsx index 5262b2e86..0fe2fa090 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table/TableActionColumnInitializers.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/table/TableActionColumnInitializers.tsx @@ -4,11 +4,13 @@ import _ from 'lodash'; import React from 'react'; import { useTranslation } from 'react-i18next'; import { useAPIClient } from '../../../../api-client'; -import { SchemaInitializerActionModal, SchemaInitializerItem, useSchemaInitializer } from '../../../../application'; -import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer'; import { useCollection_deprecated } from '../../../../collection-manager'; import { createDesignable, useDesignable } from '../../../../schema-component'; import { useGetAriaLabelOfDesigner } from '../../../../schema-settings/hooks/useGetAriaLabelOfDesigner'; +import { SchemaInitializerActionModal } from '../../../../application/schema-initializer/components/SchemaInitializerActionModal'; +import { useSchemaInitializer } from '../../../../application/schema-initializer/context'; +import { SchemaInitializerItem } from '../../../../application/schema-initializer/components/SchemaInitializerItem'; +import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; export const Resizable = () => { const { t } = useTranslation(); @@ -63,7 +65,10 @@ export const Resizable = () => { ); }; -export const tableActionColumnInitializers = new SchemaInitializer({ +/** + * @deprecated + */ +export const tableActionColumnInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'TableActionColumnInitializers', insertPosition: 'beforeEnd', useInsert: function useInsert() { @@ -221,3 +226,165 @@ export const tableActionColumnInitializers = new SchemaInitializer({ }, ], }); + +export const tableActionColumnInitializers = new CompatibleSchemaInitializer( + { + name: 'table:configureItemActions', + insertPosition: 'beforeEnd', + useInsert: function useInsert() { + const { refresh } = useDesignable(); + const fieldSchema = useFieldSchema(); + const api = useAPIClient(); + const { t } = useTranslation(); + + return function insert(schema) { + const spaceSchema = fieldSchema.reduceProperties((buf, schema) => { + if (schema['x-component'] === 'Space') { + return schema; + } + return buf; + }, null); + if (!spaceSchema) { + return; + } + _.set(schema, 'x-designer-props.linkageAction', true); + const dn = createDesignable({ + t, + api, + refresh, + current: spaceSchema, + }); + dn.loadAPIClientEvents(); + dn.insertBeforeEnd(schema); + }; + }, + Component: (props: any) => { + const { getAriaLabel } = useGetAriaLabelOfDesigner(); + return ( + + ); + }, + items: [ + { + type: 'itemGroup', + name: 'actions', + title: '{{t("Enable actions")}}', + children: [ + { + type: 'item', + title: '{{t("View")}}', + name: 'view', + Component: 'ViewActionInitializer', + schema: { + 'x-component': 'Action.Link', + 'x-action': 'view', + 'x-decorator': 'ACLActionProvider', + }, + }, + { + type: 'item', + name: 'edit', + title: '{{t("Edit")}}', + Component: 'UpdateActionInitializer', + schema: { + 'x-component': 'Action.Link', + 'x-action': 'update', + 'x-decorator': 'ACLActionProvider', + }, + useVisible() { + const collection = useCollection_deprecated(); + return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; + }, + }, + { + type: 'item', + title: '{{t("Delete")}}', + name: 'delete', + Component: 'DestroyActionInitializer', + schema: { + 'x-component': 'Action.Link', + 'x-action': 'destroy', + 'x-decorator': 'ACLActionProvider', + }, + useVisible() { + const collection = useCollection_deprecated(); + return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; + }, + }, + { + type: 'item', + title: '{{t("Add child")}}', + name: 'addChildren', + Component: 'CreateChildInitializer', + schema: { + 'x-component': 'Action.Link', + 'x-action': 'create', + 'x-decorator': 'ACLActionProvider', + }, + useVisible() { + const fieldSchema = useFieldSchema(); + const collection = useCollection_deprecated(); + const { treeTable } = fieldSchema?.parent?.parent['x-decorator-props'] || {}; + return collection.tree && treeTable !== false; + }, + }, + ], + }, + { + name: 'divider', + type: 'divider', + }, + { + type: 'subMenu', + title: '{{t("Customize")}}', + name: 'customize', + children: [ + { + type: 'item', + title: '{{t("Popup")}}', + name: 'popup', + Component: 'PopupActionInitializer', + }, + { + type: 'item', + title: '{{t("Update record")}}', + name: 'updateRecord', + Component: 'UpdateRecordActionInitializer', + useVisible() { + const collection = useCollection_deprecated(); + return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; + }, + }, + { + name: 'customRequest', + title: '{{t("Custom request")}}', + Component: 'CustomRequestInitializer', + schema: { + 'x-action': 'customize:table:request', + }, + useVisible() { + const collection = useCollection_deprecated(); + return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; + }, + }, + ], + }, + { + name: 'divider2', + type: 'divider', + }, + { + type: 'item', + name: 'columnWidth', + title: 't("Column width")', + Component: Resizable, + }, + ], + }, + tableActionColumnInitializers_deprecated, +); diff --git a/packages/core/client/src/modules/blocks/data-blocks/table/TableActionInitializers.tsx b/packages/core/client/src/modules/blocks/data-blocks/table/TableActionInitializers.tsx index c4028aedd..512679908 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table/TableActionInitializers.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/table/TableActionInitializers.tsx @@ -1,9 +1,12 @@ import { useFieldSchema } from '@formily/react'; -import { useCollection_deprecated } from '../../../..'; -import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer'; +import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; +import { useCollection_deprecated } from '../../../../collection-manager/hooks/useCollection_deprecated'; -// 表格操作配置 -export const tableActionInitializers = new SchemaInitializer({ +/** + * @deprecated + * 表格操作配置 + */ +export const tableActionInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'TableActionInitializers', title: "{{t('Configure actions')}}", icon: 'SettingOutlined', @@ -116,3 +119,120 @@ export const tableActionInitializers = new SchemaInitializer({ }, ], }); + +export const tableActionInitializers = new CompatibleSchemaInitializer( + { + name: 'table:configureActions', + title: "{{t('Configure actions')}}", + icon: 'SettingOutlined', + style: { + marginLeft: 8, + }, + items: [ + { + type: 'itemGroup', + name: 'enableActions', + title: "{{t('Enable actions')}}", + children: [ + { + type: 'item', + name: 'filter', + title: "{{t('Filter')}}", + Component: 'FilterActionInitializer', + schema: { + 'x-align': 'left', + }, + }, + { + type: 'item', + title: "{{t('Add new')}}", + name: 'addNew', + Component: 'CreateActionInitializer', + schema: { + 'x-align': 'right', + 'x-decorator': 'ACLActionProvider', + 'x-acl-action-props': { + skipScopeCheck: true, + }, + }, + useVisible() { + const collection = useCollection_deprecated(); + return !['view', 'file', 'sql'].includes(collection.template) || collection?.writableView; + }, + }, + { + type: 'item', + title: "{{t('Delete')}}", + name: 'delete', + Component: 'BulkDestroyActionInitializer', + schema: { + 'x-align': 'right', + 'x-decorator': 'ACLActionProvider', + }, + useVisible() { + const collection = useCollection_deprecated(); + return !['view', 'sql'].includes(collection.template) || collection?.writableView; + }, + }, + { + type: 'item', + title: "{{t('Refresh')}}", + name: 'refresh', + Component: 'RefreshActionInitializer', + schema: { + 'x-align': 'right', + }, + }, + { + name: 'toggle', + title: "{{t('Expand/Collapse')}}", + Component: 'ExpandableActionInitializer', + schema: { + 'x-align': 'right', + }, + useVisible() { + const schema = useFieldSchema(); + const collection = useCollection_deprecated(); + const { treeTable } = schema?.parent?.['x-decorator-props'] || {}; + return collection.tree && treeTable !== false; + }, + }, + ], + }, + { + name: 'divider', + type: 'divider', + useVisible() { + const collection = useCollection_deprecated(); + return !['view', 'sql'].includes(collection.template) || collection?.writableView; + }, + }, + { + type: 'subMenu', + name: 'customize', + title: '{{t("Customize")}}', + children: [ + { + type: 'item', + title: '{{t("Add record")}}', + name: 'addRecord', + Component: 'CustomizeAddRecordActionInitializer', + schema: { + 'x-align': 'right', + 'x-decorator': 'ACLActionProvider', + 'x-acl-action': 'create', + 'x-acl-action-props': { + skipScopeCheck: true, + }, + }, + }, + ], + useVisible() { + const collection = useCollection_deprecated(); + return !['view', 'sql'].includes(collection.template) || collection?.writableView; + }, + }, + ], + }, + tableActionInitializers_deprecated, +); diff --git a/packages/core/client/src/modules/blocks/data-blocks/table/TableColumnInitializers.tsx b/packages/core/client/src/modules/blocks/data-blocks/table/TableColumnInitializers.tsx index c892e4c06..dcc8d31e4 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table/TableColumnInitializers.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/table/TableColumnInitializers.tsx @@ -1,14 +1,14 @@ import { useFieldSchema } from '@formily/react'; import React, { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; -import { SchemaInitializerChildren } from '../../../../application'; -import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer'; import { useCompile } from '../../../../schema-component'; import { useAssociatedTableColumnInitializerFields, useInheritsTableColumnInitializerFields, useTableColumnInitializerFields, } from '../../../../schema-initializer/utils'; +import { SchemaInitializerChildren } from '../../../../application/schema-initializer/components/SchemaInitializerChildren'; +import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; // 表格列配置 const ParentCollectionFields = () => { @@ -47,7 +47,10 @@ const AssociatedFields = () => { return {schema}; }; -export const tableColumnInitializers = new SchemaInitializer({ +/** + * @deprecated + */ +export const tableColumnInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'TableColumnInitializers', insertPosition: 'beforeEnd', icon: 'SettingOutlined', @@ -106,3 +109,66 @@ export const tableColumnInitializers = new SchemaInitializer({ }, ], }); + +export const tableColumnInitializers = new CompatibleSchemaInitializer( + { + name: 'table:configureColumns', + insertPosition: 'beforeEnd', + icon: 'SettingOutlined', + title: '{{t("Configure columns")}}', + wrap: (s, { isInSubTable }) => { + if (s['x-action-column']) { + return s; + } + return { + type: 'void', + 'x-decorator': 'TableV2.Column.Decorator', + // 'x-designer': 'TableV2.Column.Designer', + 'x-toolbar': 'TableColumnSchemaToolbar', + 'x-settings': 'fieldSettings:TableColumn', + 'x-component': 'TableV2.Column', + properties: { + [s.name]: { + ...s, + }, + }, + }; + }, + items: [ + { + name: 'displayFields', + type: 'itemGroup', + title: '{{t("Display fields")}}', + // children: DisplayFields, + useChildren: useTableColumnInitializerFields, + }, + { + name: 'parentCollectionFields', + Component: ParentCollectionFields, + }, + { + name: 'associationFields', + Component: AssociatedFields, + }, + { + name: 'divider', + type: 'divider', + useVisible() { + const fieldSchema = useFieldSchema(); + return fieldSchema['x-component'] !== 'AssociationField.SubTable'; + }, + }, + { + type: 'item', + name: 'add', + title: '{{t("Action column")}}', + Component: 'TableActionColumnInitializer', + useVisible() { + const fieldSchema = useFieldSchema(); + return fieldSchema['x-component'] !== 'AssociationField.SubTable'; + }, + }, + ], + }, + tableColumnInitializers_deprecated, +); diff --git a/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/dragAndDrop.test.ts b/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/dragAndDrop.test.ts index de2b93435..8ee143670 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/dragAndDrop.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/dragAndDrop.test.ts @@ -2,7 +2,7 @@ import { expect, oneEmptyTableBlockBasedOnUsers, test } from '@nocobase/test/e2e test('actions', async ({ page, mockPage }) => { await mockPage(oneEmptyTableBlockBasedOnUsers).goto(); - await page.getByLabel('schema-initializer-ActionBar-TableActionInitializers-users').hover(); + await page.getByLabel('schema-initializer-ActionBar-table:configureActions-users').hover(); //添加按钮 await page.getByRole('menuitem', { name: 'Add new' }).click(); await page.getByRole('menuitem', { name: 'Delete' }).click(); diff --git a/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/schemaInitializer.test.ts b/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/schemaInitializer.test.ts index 786d750b0..6cd112846 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/schemaInitializer.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/schemaInitializer.test.ts @@ -4,7 +4,7 @@ test.describe('where table block can be added', () => { test('page', async ({ page, mockPage }) => { await mockPage().goto(); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await createBlockInPage(page, 'Table'); await expect(page.getByLabel('block-item-CardItem-users-table')).toBeVisible(); }); @@ -17,7 +17,7 @@ test.describe('configure actions', () => { await mockPage(oneEmptyTable).goto(); // add buttons - await page.getByLabel('schema-initializer-ActionBar-TableActionInitializers-t_unp4scqamw9').hover(); + await page.getByLabel('schema-initializer-ActionBar-table:configureActions-t_unp4scqamw9').hover(); await page.getByRole('menuitem', { name: 'Filter' }).click(); await page.getByRole('menuitem', { name: 'Add new' }).click(); await page.getByRole('menuitem', { name: 'Delete' }).click(); @@ -35,7 +35,7 @@ test.describe('configure actions', () => { await expect(page.getByRole('button', { name: 'Refresh' })).toBeVisible(); // delete buttons - await page.getByLabel('schema-initializer-ActionBar-TableActionInitializers-t_unp4scqamw9').hover(); + await page.getByLabel('schema-initializer-ActionBar-table:configureActions-t_unp4scqamw9').hover(); await page.getByRole('menuitem', { name: 'Filter' }).click(); await page.getByRole('menuitem', { name: 'Add new' }).click(); await page.getByRole('menuitem', { name: 'Delete' }).click(); @@ -56,7 +56,7 @@ test.describe('configure actions', () => { test('customize: add record', async ({ page, mockPage }) => { await mockPage(oneEmptyTable).goto(); - await page.getByLabel('schema-initializer-ActionBar-TableActionInitializers-t_unp4scqamw9').hover(); + await page.getByLabel('schema-initializer-ActionBar-table:configureActions-t_unp4scqamw9').hover(); await page.getByRole('menuitem', { name: 'Customize' }).hover(); await page.getByRole('menuitem', { name: 'add record' }).click(); @@ -70,7 +70,7 @@ test.describe('configure columns', () => { test.describe.configure({ retries: process.env.CI ? 4 : 0 }); test('action column & display collection fields & display association fields', async ({ page, mockPage }) => { await mockPage(oneEmptyTable).goto(); - const configureColumnButton = page.getByLabel('schema-initializer-TableV2-TableColumnInitializers-t_unp4scqamw9'); + const configureColumnButton = page.getByLabel('schema-initializer-TableV2-table:configureColumns-t_unp4scqamw9'); // Action column ------------------------------------------------------------- // 1. 点击开关,可以开启和关闭 Action column diff --git a/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/schemaSettings.test.ts b/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/schemaSettings.test.ts index 983295906..6a5072a21 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/schemaSettings.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/schemaSettings.test.ts @@ -101,7 +101,7 @@ test.describe('table block schema settings', () => { ).toBeChecked(); await expect(page.getByRole('menuitem', { name: 'Set default sorting rules' })).toBeHidden(); // 显示出来 email 和 ID - await page.getByLabel('schema-initializer-TableV2-TableColumnInitializers-general').hover(); + await page.getByLabel('schema-initializer-TableV2-table:configureColumns-general').hover(); await page.getByRole('menuitem', { name: 'email' }).click(); await page.getByRole('menuitem', { name: 'ID', exact: true }).click(); await page.getByLabel('schema-initializer-TableV2-').click(); @@ -141,7 +141,7 @@ test.describe('table block schema settings', () => { } async function createColumnItem(page: Page, fieldName: string) { - await page.getByLabel('schema-initializer-TableV2-TableColumnInitializers-general').hover(); + await page.getByLabel('schema-initializer-TableV2-table:configureColumns-general').hover(); await page.getByRole('menuitem', { name: fieldName, exact: true }).click(); await page.mouse.move(300, 0); } @@ -213,7 +213,7 @@ test.describe('table block schema settings', () => { await page.getByRole('button', { name: 'OK', exact: true }).click(); // 显示出来 email 和 ID - await page.getByLabel('schema-initializer-TableV2-TableColumnInitializers-general').hover(); + await page.getByLabel('schema-initializer-TableV2-table:configureColumns-general').hover(); await page.getByRole('menuitem', { name: 'email' }).click(); await page.getByRole('menuitem', { name: 'ID', exact: true }).click(); await page.mouse.move(300, 0); @@ -567,7 +567,7 @@ test.describe('actions schema settings', () => { test.describe('popup', () => { const addSomeCustomActions = async (page: Page) => { // 先删除掉之前的 actions - await page.getByRole('button', { name: 'Actions' }).hover(); + await page.getByRole('button', { name: 'Actions', exact: true }).hover(); await page.getByLabel('designer-schema-settings-TableV2.Column-TableV2.ActionColumnDesigner-general').hover(); await page.getByRole('menuitem', { name: 'View' }).click(); await page.getByRole('menuitem', { name: 'Edit' }).click(); @@ -624,7 +624,7 @@ test.describe('actions schema settings', () => { test.describe('update record', () => { const addSomeCustomActions = async (page: Page) => { // 先删除掉之前的 actions - await page.getByRole('button', { name: 'Actions' }).hover(); + await page.getByRole('button', { name: 'Actions', exact: true }).hover(); await page.getByLabel('designer-schema-settings-TableV2.Column-TableV2.ActionColumnDesigner-general').hover(); await page.getByRole('menuitem', { name: 'View' }).click(); await page.getByRole('menuitem', { name: 'Edit' }).click(); @@ -677,13 +677,13 @@ test.describe('actions schema settings', () => { // 添加一行数据 // TODO: 使用 mockRecord 为 tree 表添加一行数据无效 - await page.getByLabel('schema-initializer-ActionBar-TableActionInitializers-treeCollection').hover(); + await page.getByLabel('schema-initializer-ActionBar-table:configureActions-treeCollection').hover(); await page.getByRole('menuitem', { name: 'Add new' }).click(); await page.getByRole('button', { name: 'Add new' }).click(); - await page.getByLabel('schema-initializer-Grid-CreateFormBlockInitializers-treeCollection').hover(); + await page.getByLabel('schema-initializer-Grid-popup:addNew:addBlock-treeCollection').hover(); await page.getByRole('menuitem', { name: 'form Form' }).click(); await page.mouse.move(300, 0); - await page.getByLabel('schema-initializer-ActionBar-CreateFormActionInitializers-treeCollection').hover(); + await page.getByLabel('schema-initializer-ActionBar-createForm:configureActions-treeCollection').hover(); await page.getByRole('menuitem', { name: 'Submit' }).click(); await page.mouse.move(300, 0); await page.getByRole('button', { name: 'Submit' }).click(); diff --git a/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/templatesOfBug.ts b/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/templatesOfBug.ts index 213b21f58..0e544064f 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/templatesOfBug.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/templatesOfBug.ts @@ -10,7 +10,7 @@ export const T2183 = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { '1n5r9s23amo': { _isJSONSchemaObject: true, @@ -50,7 +50,7 @@ export const T2183 = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -87,7 +87,7 @@ export const T2183 = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -106,7 +106,7 @@ export const T2183 = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -169,7 +169,7 @@ export const T2186 = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { '0r1mwh6fgdj': { _isJSONSchemaObject: true, @@ -209,7 +209,7 @@ export const T2186 = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -246,7 +246,7 @@ export const T2186 = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -265,7 +265,7 @@ export const T2186 = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -328,7 +328,7 @@ export const T2187 = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { zp24b63pujf: { _isJSONSchemaObject: true, @@ -368,7 +368,7 @@ export const T2187 = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -383,7 +383,7 @@ export const T2187 = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -402,7 +402,7 @@ export const T2187 = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -468,7 +468,7 @@ export const T2187 = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', properties: { qvyfk3a9a2g: { _isJSONSchemaObject: true, @@ -513,7 +513,7 @@ export const T2187 = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { h191s1ni4am: { _isJSONSchemaObject: true, @@ -573,7 +573,7 @@ export const T2187 = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'CreateFormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', diff --git a/packages/core/client/src/modules/blocks/filter-blocks/collapse/__e2e__/schemaInitializer.test.ts b/packages/core/client/src/modules/blocks/filter-blocks/collapse/__e2e__/schemaInitializer.test.ts index e2e5f2679..41a8022e0 100644 --- a/packages/core/client/src/modules/blocks/filter-blocks/collapse/__e2e__/schemaInitializer.test.ts +++ b/packages/core/client/src/modules/blocks/filter-blocks/collapse/__e2e__/schemaInitializer.test.ts @@ -4,7 +4,7 @@ test.describe('where collapse block can be added', () => { test('page', async ({ page, mockPage }) => { await mockPage().goto(); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await createBlockInPage(page, 'Collapse'); await expect(page.getByLabel('block-item-CardItem-users-filter-collapse')).toBeVisible(); }); diff --git a/packages/core/client/src/modules/blocks/filter-blocks/collapse/filterCollapseItemInitializer.tsx b/packages/core/client/src/modules/blocks/filter-blocks/collapse/filterCollapseItemInitializer.tsx index d403f06f8..01ae30774 100644 --- a/packages/core/client/src/modules/blocks/filter-blocks/collapse/filterCollapseItemInitializer.tsx +++ b/packages/core/client/src/modules/blocks/filter-blocks/collapse/filterCollapseItemInitializer.tsx @@ -1,3 +1,4 @@ +import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer'; import { useOptionalFieldList } from '../../../../block-provider/hooks'; import { useCollectionManager_deprecated } from '../../../../collection-manager'; @@ -80,8 +81,10 @@ export const associationFilterFilterBlockInitializer = new SchemaInitializer({ ], }); -export const filterCollapseItemInitializer = new SchemaInitializer({ - // name: 'AssociationFilter.FilterBlockInitializer', +/** + * @deprecated + */ +export const filterCollapseItemInitializer_deprecated = new CompatibleSchemaInitializer({ name: 'AssociationFilterInitializers', style: { marginTop: 16 }, icon: 'SettingOutlined', @@ -155,3 +158,81 @@ export const filterCollapseItemInitializer = new SchemaInitializer({ }, ], }); + +export const filterCollapseItemInitializer = new CompatibleSchemaInitializer( + { + name: 'filterCollapse:configureFields', + style: { marginTop: 16 }, + icon: 'SettingOutlined', + title: '{{t("Configure fields")}}', + items: [ + { + type: 'itemGroup', + name: 'associationFields', + title: '{{t("Association fields")}}', + useChildren() { + const associatedFields = useAssociatedFields(); + const useProps = '{{useAssociationFilterBlockProps}}'; + const cm = useCollectionManager_deprecated(); + const children = associatedFields.map((field) => ({ + name: field.key, + title: field.uiSchema?.title, + Component: 'AssociationFilterDesignerDisplayField', + schema: { + name: field.name, + title: field.uiSchema?.title, + type: 'void', + // 'x-designer': 'AssociationFilter.Item.Designer', + 'x-toolbar': 'CollapseItemSchemaToolbar', + 'x-settings': 'fieldSettings:FilterCollapseItem', + 'x-component': 'AssociationFilter.Item', + 'x-component-props': { + fieldNames: { + label: cm.getCollection(field.target)?.getPrimaryKey() || 'id', + }, + useProps, + }, + properties: {}, + }, + })); + return children; + }, + }, + { + name: 'choicesFields', + type: 'itemGroup', + title: '{{t("Choices fields")}}', + hideIfNoChildren: true, + useChildren() { + const optionalList = useOptionalFieldList(); + const useProps = '{{useAssociationFilterBlockProps}}'; + const optionalChildren = optionalList.map((field) => ({ + name: field.key, + title: field.uiSchema.title, + Component: 'AssociationFilterDesignerDisplayField', + schema: { + name: field.name, + title: field.uiSchema.title, + interface: field.interface, + type: 'void', + // 'x-designer': 'AssociationFilter.Item.Designer', + 'x-toolbar': 'CollapseItemSchemaToolbar', + 'x-settings': 'fieldSettings:FilterCollapseItem', + 'x-component': 'AssociationFilter.Item', + 'x-component-props': { + fieldNames: { + label: field.name, + }, + useProps, + }, + properties: {}, + }, + })); + + return optionalChildren; + }, + }, + ], + }, + filterCollapseItemInitializer_deprecated, +); diff --git a/packages/core/client/src/modules/blocks/filter-blocks/form/FilterFormActionInitializers.tsx b/packages/core/client/src/modules/blocks/filter-blocks/form/FilterFormActionInitializers.tsx index 12be8c91c..dc1f7ec75 100644 --- a/packages/core/client/src/modules/blocks/filter-blocks/form/FilterFormActionInitializers.tsx +++ b/packages/core/client/src/modules/blocks/filter-blocks/form/FilterFormActionInitializers.tsx @@ -1,7 +1,10 @@ -import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer'; +import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; -// 表单的操作配置 -export const filterFormActionInitializers = new SchemaInitializer({ +/** + * @deprecated + * 表单的操作配置 + */ +export const filterFormActionInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'FilterFormActionInitializers', title: '{{t("Configure actions")}}', icon: 'SettingOutlined', @@ -31,3 +34,37 @@ export const filterFormActionInitializers = new SchemaInitializer({ }, ], }); + +export const filterFormActionInitializers = new CompatibleSchemaInitializer( + { + name: 'filterForm:configureActions', + title: '{{t("Configure actions")}}', + icon: 'SettingOutlined', + items: [ + { + type: 'itemGroup', + title: '{{t("Enable actions")}}', + name: 'enableActions', + children: [ + { + name: 'filter', + title: '{{t("Filter")}}', + Component: 'CreateFilterActionInitializer', + schema: { + 'x-action-settings': {}, + }, + }, + { + name: 'reset', + title: '{{t("Reset")}}', + Component: 'CreateResetActionInitializer', + schema: { + 'x-action-settings': {}, + }, + }, + ], + }, + ], + }, + filterFormActionInitializers_deprecated, +); diff --git a/packages/core/client/src/modules/blocks/filter-blocks/form/__e2e__/schemaInitializer.test.ts b/packages/core/client/src/modules/blocks/filter-blocks/form/__e2e__/schemaInitializer.test.ts index 4e6d806c4..3870fa5c2 100644 --- a/packages/core/client/src/modules/blocks/filter-blocks/form/__e2e__/schemaInitializer.test.ts +++ b/packages/core/client/src/modules/blocks/filter-blocks/form/__e2e__/schemaInitializer.test.ts @@ -4,7 +4,7 @@ test.describe('where filter form block can be added', () => { test('page', async ({ page, mockPage }) => { await mockPage().goto(); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await createBlockInPage(page, 'Filter form'); await expect(page.getByLabel('block-item-CardItem-users-filter-form')).toBeVisible(); }); @@ -14,7 +14,7 @@ test.describe('configure fields', () => { test('display collection fields & display association fields & add text', async ({ page, mockPage }) => { await mockPage(oneEmptyFilterFormBlock).goto(); - const formItemInitializer = page.getByLabel('schema-initializer-Grid-FilterFormItemInitializers-general'); + const formItemInitializer = page.getByLabel('schema-initializer-Grid-filterForm:configureFields-general'); // add fields await formItemInitializer.hover(); @@ -72,7 +72,7 @@ test.describe('configure actions', () => { test('filter & reset', async ({ page, mockPage }) => { await mockPage(oneEmptyFilterFormBlock).goto(); - await page.getByLabel('schema-initializer-ActionBar-FilterFormActionInitializers-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-filterForm:configureActions-general').hover(); await page.getByRole('menuitem', { name: 'Filter' }).click(); await page.getByRole('menuitem', { name: 'Reset' }).click(); @@ -84,7 +84,7 @@ test.describe('configure actions', () => { await expect(page.getByLabel('action-Action-Reset-general-filter-form')).toBeVisible(); // delete buttons - await page.getByLabel('schema-initializer-ActionBar-FilterFormActionInitializers-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-filterForm:configureActions-general').hover(); await page.getByRole('menuitem', { name: 'Filter' }).click(); await page.getByRole('menuitem', { name: 'Reset' }).click(); diff --git a/packages/core/client/src/modules/blocks/filter-blocks/form/__e2e__/schemaSettings.test.ts b/packages/core/client/src/modules/blocks/filter-blocks/form/__e2e__/schemaSettings.test.ts index a66625ecb..e022eae3c 100644 --- a/packages/core/client/src/modules/blocks/filter-blocks/form/__e2e__/schemaSettings.test.ts +++ b/packages/core/client/src/modules/blocks/filter-blocks/form/__e2e__/schemaSettings.test.ts @@ -81,7 +81,7 @@ test.describe('actions schema settings', () => { await mockPage(oneEmptyFilterFormBlock).goto(); // 创建 Filter & Reset 两个按钮 - await page.getByLabel('schema-initializer-ActionBar-FilterFormActionInitializers-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-filterForm:configureActions-general').hover(); await page.getByRole('menuitem', { name: 'Filter' }).click(); await page.getByRole('menuitem', { name: 'Reset' }).click(); diff --git a/packages/core/client/src/modules/blocks/filter-blocks/form/filterFormItemInitializers.tsx b/packages/core/client/src/modules/blocks/filter-blocks/form/filterFormItemInitializers.tsx index 0e8206f3e..02ae03aa8 100644 --- a/packages/core/client/src/modules/blocks/filter-blocks/form/filterFormItemInitializers.tsx +++ b/packages/core/client/src/modules/blocks/filter-blocks/form/filterFormItemInitializers.tsx @@ -1,11 +1,14 @@ -import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer'; import { gridRowColWrap, useFilterFormItemInitializerFields } from '../../../../schema-initializer/utils'; import { FilterParentCollectionFields, FilterAssociatedFields, } from '../../../../schema-initializer/buttons/FormItemInitializers'; +import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; -export const filterFormItemInitializers = new SchemaInitializer({ +/** + * @deprecated + */ +export const filterFormItemInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'FilterFormItemInitializers', wrap: gridRowColWrap, icon: 'SettingOutlined', @@ -36,3 +39,38 @@ export const filterFormItemInitializers = new SchemaInitializer({ }, ], }); + +export const filterFormItemInitializers = new CompatibleSchemaInitializer( + { + name: 'filterForm:configureFields', + wrap: gridRowColWrap, + icon: 'SettingOutlined', + title: '{{t("Configure fields")}}', + items: [ + { + type: 'itemGroup', + name: 'displayFields', + title: '{{t("Display fields")}}', + useChildren: useFilterFormItemInitializerFields, + }, + { + name: 'parentCollectionFields', + Component: FilterParentCollectionFields, + }, + { + name: 'associationFields', + Component: FilterAssociatedFields, + }, + { + name: 'divider', + type: 'divider', + }, + { + title: '{{t("Add text")}}', + Component: 'MarkdownFormItemInitializer', + name: 'addText', + }, + ], + }, + filterFormItemInitializers_deprecated, +); diff --git a/packages/core/client/src/modules/blocks/other-blocks/markdown/__e2e__/schemaInitializer.test.ts b/packages/core/client/src/modules/blocks/other-blocks/markdown/__e2e__/schemaInitializer.test.ts index 7aca90e7b..50365c718 100644 --- a/packages/core/client/src/modules/blocks/other-blocks/markdown/__e2e__/schemaInitializer.test.ts +++ b/packages/core/client/src/modules/blocks/other-blocks/markdown/__e2e__/schemaInitializer.test.ts @@ -4,7 +4,7 @@ test.describe('where markdown block can be added', () => { test('page', async ({ page, mockPage }) => { await mockPage().goto(); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await createBlockInPage(page, 'Markdown'); await expect(page.getByLabel('block-item-Markdown.Void-markdown')).toBeVisible(); }); diff --git a/packages/core/client/src/modules/dialog/__e2e__/schemaInitializer.test.ts b/packages/core/client/src/modules/dialog/__e2e__/schemaInitializer.test.ts index 702785999..47f4e2567 100644 --- a/packages/core/client/src/modules/dialog/__e2e__/schemaInitializer.test.ts +++ b/packages/core/client/src/modules/dialog/__e2e__/schemaInitializer.test.ts @@ -23,7 +23,7 @@ test.describe('where to open a popup and what can be added to it', () => { await expect(page.getByText('test123')).toBeVisible(); // add blocks - await page.getByLabel('schema-initializer-Grid-CreateFormBlockInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-popup:addNew:addBlock-general').hover(); await page.getByText('Form').click(); await page.getByText('Markdown').click(); @@ -48,12 +48,12 @@ test.describe('where to open a popup and what can be added to it', () => { await expect(page.getByText('test7')).toBeVisible(); // add blocks - await page.getByLabel('schema-initializer-Grid-CusomeizeCreateFormBlockInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-popup:addRecord:addBlock-general').hover(); await page.getByText('Form').hover(); await page.getByRole('menuitem', { name: 'Users' }).click(); // add Markdown - await page.getByLabel('schema-initializer-Grid-CusomeizeCreateFormBlockInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-popup:addRecord:addBlock-general').hover(); await page.getByRole('menuitem', { name: 'Markdown' }).click(); await expect(page.getByLabel('block-item-CardItem-users-form')).toBeVisible(); @@ -77,7 +77,7 @@ test.describe('where to open a popup and what can be added to it', () => { await expect(page.getByText('test8')).toBeVisible(); // add blocks - await page.getByLabel('schema-initializer-Grid-RecordBlockInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover(); await page.getByRole('menuitem', { name: 'Details' }).click(); await page.getByText('Form').first().click(); await page.getByRole('menuitem', { name: 'Markdown' }).click(); @@ -106,13 +106,13 @@ test.describe('where to open a popup and what can be added to it', () => { await page.getByRole('button', { name: 'OK', exact: true }).click(); // add relationship blocks - await page.getByLabel('schema-initializer-Grid-RecordBlockInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover(); await page.getByRole('menuitem', { name: 'Many to one' }).hover(); await page.getByRole('menuitem', { name: 'Details' }).click(); await page.mouse.move(300, 0); - await page.getByLabel('schema-initializer-Grid-RecordBlockInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover(); await page.getByRole('menuitem', { name: 'One to many' }).hover(); // 下拉列表中,可选择以下区块进行创建 @@ -141,7 +141,7 @@ test.describe('where to open a popup and what can be added to it', () => { await expect(page.getByText('test1')).toBeVisible(); // add blocks - await page.getByLabel('schema-initializer-Grid-BulkEditBlockInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-popup:bulkEdit:addBlock-general').hover(); await page.getByText('Form').click(); await page.getByRole('menuitem', { name: 'Markdown' }).click(); await page.mouse.move(300, 0); @@ -170,7 +170,7 @@ test.describe('where to open a popup and what can be added to it', () => { await expect(page.getByText('test8')).toBeVisible(); // add blocks - await page.getByLabel('schema-initializer-Grid-RecordBlockInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover(); await page.getByRole('menuitem', { name: 'Details' }).click(); await page.getByText('Form').first().click(); await page.getByRole('menuitem', { name: 'Markdown' }).click(); @@ -181,14 +181,14 @@ test.describe('where to open a popup and what can be added to it', () => { await expect(page.getByLabel('block-item-Markdown.Void-general-markdown')).toBeVisible(); // add relationship blocks - await page.getByLabel('schema-initializer-Grid-RecordBlockInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover(); await page.getByRole('menuitem', { name: 'Many to one' }).hover(); await page.getByRole('menuitem', { name: 'Details' }).click(); await page.mouse.move(300, 0); await expect(page.getByLabel('block-item-CardItem-general-').nth(2)).toBeVisible(); - await page.getByLabel('schema-initializer-Grid-RecordBlockInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover(); await page.getByRole('menuitem', { name: 'One to many' }).hover(); // 下拉列表中,可选择以下区块进行创建 @@ -225,7 +225,7 @@ test.describe('where to open a popup and what can be added to it', () => { await expect(page.getByLabel('block-item-Markdown.Void-roles-form')).toBeVisible(); async function addBlock(name: string) { - await page.getByLabel('schema-initializer-Grid-TableSelectorInitializers-roles').hover(); + await page.getByLabel('schema-initializer-Grid-popup:tableSelector:addBlock-roles').hover(); await page.getByRole('menuitem', { name }).click(); await page.mouse.move(300, 0); } diff --git a/packages/core/client/src/modules/dialog/__e2e__/templatesOfBug.ts b/packages/core/client/src/modules/dialog/__e2e__/templatesOfBug.ts index ad594799c..f2f1f583c 100644 --- a/packages/core/client/src/modules/dialog/__e2e__/templatesOfBug.ts +++ b/packages/core/client/src/modules/dialog/__e2e__/templatesOfBug.ts @@ -13,7 +13,7 @@ export const T2797: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', 'x-index': 1, properties: { '921il71tsii': { @@ -59,7 +59,7 @@ export const T2797: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -74,7 +74,7 @@ export const T2797: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -94,7 +94,7 @@ export const T2797: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', 'x-index': 1, properties: { actions: { @@ -161,7 +161,7 @@ export const T2797: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', 'x-index': 1, properties: { uq6k35ibdum: { @@ -214,7 +214,7 @@ export const T2797: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', 'x-index': 1, 'x-uid': '1d3zru9pi2o', 'x-async': false, @@ -223,7 +223,7 @@ export const T2797: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'UpdateFormActionInitializers', + 'x-initializer': 'editForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -286,7 +286,7 @@ export const T2797: PageConfig = { type: 'void', 'x-component': 'Grid', 'x-initializer': - 'RecordBlockInitializers', + 'popup:common:addBlock', 'x-index': 1, properties: { i7919iug0zf: { @@ -367,7 +367,7 @@ export const T2797: PageConfig = { 'x-component': 'Grid', 'x-initializer': - 'FormItemInitializers', + 'form:configureFields', 'x-index': 1, 'x-uid': 'k9p2rqt49v1', @@ -382,7 +382,7 @@ export const T2797: PageConfig = { '2.0', type: 'void', 'x-initializer': - 'UpdateFormActionInitializers', + 'editForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': @@ -594,7 +594,7 @@ export const T2838: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', 'x-index': 1, properties: { ocvzef7y4nh: { @@ -638,7 +638,7 @@ export const T2838: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -653,7 +653,7 @@ export const T2838: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -673,7 +673,7 @@ export const T2838: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', 'x-index': 1, properties: { actions: { @@ -740,7 +740,7 @@ export const T2838: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', 'x-index': 1, properties: { w9u8i9nzh10: { @@ -791,8 +791,7 @@ export const T2838: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': - 'ReadPrettyFormActionInitializers', + 'x-initializer': 'details:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -856,7 +855,7 @@ export const T2838: PageConfig = { type: 'void', 'x-component': 'Grid', 'x-initializer': - 'RecordBlockInitializers', + 'popup:common:addBlock', 'x-index': 1, properties: { nclrn6m8w40: { @@ -935,7 +934,7 @@ export const T2838: PageConfig = { '2.0', type: 'void', 'x-initializer': - 'ReadPrettyFormActionInitializers', + 'details:configureActions', 'x-component': 'ActionBar', 'x-component-props': @@ -1039,7 +1038,7 @@ export const T2838: PageConfig = { 'x-component': 'Grid', 'x-initializer': - 'RecordBlockInitializers', + 'popup:common:addBlock', 'x-index': 1, properties: { @@ -1133,7 +1132,7 @@ export const T2838: PageConfig = { 'x-component': 'Grid', 'x-initializer': - 'FormItemInitializers', + 'form:configureFields', 'x-index': 1, properties: { @@ -1222,7 +1221,7 @@ export const T2838: PageConfig = { '2.0', type: 'void', 'x-initializer': - 'UpdateFormActionInitializers', + 'editForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': @@ -1344,7 +1343,7 @@ export const T2838: PageConfig = { 'x-component': 'Grid', 'x-initializer': - 'ReadPrettyFormItemInitializers', + 'details:configureFields', 'x-index': 2, 'x-uid': '1et421zrsz4', @@ -1400,8 +1399,7 @@ export const T2838: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': - 'ReadPrettyFormItemInitializers', + 'x-initializer': 'details:configureFields', 'x-index': 2, 'x-uid': 'j4qxeoy1pqw', 'x-async': false, diff --git a/packages/core/client/src/modules/fields/component/Picker/TableSelectorInitializers.tsx b/packages/core/client/src/modules/fields/component/Picker/TableSelectorInitializers.tsx index 0ad6d3a85..defd4cf93 100644 --- a/packages/core/client/src/modules/fields/component/Picker/TableSelectorInitializers.tsx +++ b/packages/core/client/src/modules/fields/component/Picker/TableSelectorInitializers.tsx @@ -1,8 +1,11 @@ import { useCollection_deprecated } from '../../../..'; -import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer'; +import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; import { gridRowColWrap } from '../../../../schema-initializer/utils'; -export const tableSelectorInitializers = new SchemaInitializer({ +/** + * @deprecated + */ +export const tableSelectorInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'TableSelectorInitializers', wrap: gridRowColWrap, title: '{{t("Add block")}}', @@ -82,3 +85,87 @@ export const tableSelectorInitializers = new SchemaInitializer({ }, ], }); + +export const tableSelectorInitializers = new CompatibleSchemaInitializer( + { + name: 'popup:tableSelector:addBlock', + wrap: gridRowColWrap, + title: '{{t("Add block")}}', + icon: 'PlusOutlined', + items: [ + { + type: 'itemGroup', + title: '{{t("Selector")}}', + name: 'selector', + children: [ + { + name: 'title', + title: 'Table', + Component: 'TableSelectorInitializer', + }, + ], + }, + { + type: 'itemGroup', + title: '{{t("Filter blocks")}}', + name: 'filterBlocks', + useChildren() { + const { name, dataSource } = useCollection_deprecated(); + return [ + { + name: 'filterFormBlockInTableSelector', + title: '{{t("Form")}}', + Component: 'FilterFormBlockInitializer', + componentProps: { + filterMenuItemChildren() { + return false; + }, + onlyCurrentDataSource: true, + }, + collectionName: name, + dataSource, + }, + { + name: 'filterCollapseBlockInTableSelector', + title: '{{t("Collapse")}}', + Component: 'FilterCollapseBlockInitializer', + componentProps: { + filterMenuItemChildren() { + return false; + }, + onlyCurrentDataSource: true, + }, + collectionName: name, + dataSource, + }, + ]; + }, + }, + { + type: 'itemGroup', + title: '{{t("Other blocks")}}', + name: 'otherBlocks', + children: [ + { + title: '{{t("Add text")}}', + Component: 'BlockItemInitializer', + name: 'addText', + schema: { + type: 'void', + 'x-editable': false, + 'x-decorator': 'BlockItem', + // 'x-designer': 'Markdown.Void.Designer', + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:markdown', + 'x-component': 'Markdown.Void', + 'x-component-props': { + content: '{{t("This is a demo text, **supports Markdown syntax**.")}}', + }, + }, + }, + ], + }, + ], + }, + tableSelectorInitializers_deprecated, +); diff --git a/packages/core/client/src/modules/menu/PageMenuItem.tsx b/packages/core/client/src/modules/menu/PageMenuItem.tsx index 0c2096d55..494bfcd7b 100644 --- a/packages/core/client/src/modules/menu/PageMenuItem.tsx +++ b/packages/core/client/src/modules/menu/PageMenuItem.tsx @@ -3,9 +3,9 @@ import { SchemaOptionsContext } from '@formily/react'; import { uid } from '@formily/shared'; import React, { useCallback, useContext } from 'react'; import { useTranslation } from 'react-i18next'; -import { FormDialog, SchemaComponent, SchemaComponentOptions } from '../../schema-component'; import { SchemaInitializerItem, useSchemaInitializer } from '../../application'; import { useGlobalTheme } from '../../global-theme'; +import { FormDialog, SchemaComponent, SchemaComponentOptions } from '../../schema-component'; import { useStyles } from '../../schema-component/antd/menu/MenuItemInitializers'; export const PageMenuItem = () => { @@ -75,7 +75,7 @@ export const PageMenuItem = () => { [uid()]: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: {}, }, }, diff --git a/packages/core/client/src/modules/menu/menuItemInitializer.tsx b/packages/core/client/src/modules/menu/menuItemInitializer.tsx index b5271258f..d9b94ec34 100644 --- a/packages/core/client/src/modules/menu/menuItemInitializer.tsx +++ b/packages/core/client/src/modules/menu/menuItemInitializer.tsx @@ -3,7 +3,10 @@ import { LinkMenuItem } from './LinkMenuItem'; import { PageMenuItem } from './PageMenuItem'; import { GroupItem } from './GroupItem'; -export const menuItemInitializer = new SchemaInitializer({ +/** + * @deprecated + */ +export const menuItemInitializer_deprecated = new SchemaInitializer({ name: 'MenuItemInitializers', insertPosition: 'beforeEnd', icon: 'PlusOutlined', @@ -26,3 +29,24 @@ export const menuItemInitializer = new SchemaInitializer({ }, ], }); + +export const menuItemInitializer = new SchemaInitializer({ + name: 'menuInitializers:menuItem', + insertPosition: 'beforeEnd', + icon: 'PlusOutlined', + title: '{{t("Add menu item")}}', + items: [ + { + name: 'group', + Component: GroupItem, + }, + { + name: 'page', + Component: PageMenuItem, + }, + { + name: 'link', + Component: LinkMenuItem, + }, + ], +}); diff --git a/packages/core/client/src/modules/page/BlockInitializers.tsx b/packages/core/client/src/modules/page/BlockInitializers.tsx index e5611365c..d532e63aa 100644 --- a/packages/core/client/src/modules/page/BlockInitializers.tsx +++ b/packages/core/client/src/modules/page/BlockInitializers.tsx @@ -1,7 +1,10 @@ -import { SchemaInitializer } from '../../application/schema-initializer/SchemaInitializer'; +import { CompatibleSchemaInitializer } from '../../application/schema-initializer/CompatibleSchemaInitializer'; import { gridRowColWrap } from '../../schema-initializer/utils'; -export const blockInitializers = new SchemaInitializer({ +/** + * @deprecated + */ +export const blockInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'BlockInitializers', title: '{{t("Add block")}}', icon: 'PlusOutlined', @@ -70,3 +73,76 @@ export const blockInitializers = new SchemaInitializer({ }, ], }); + +export const blockInitializers = new CompatibleSchemaInitializer( + { + name: 'page:addBlock', + title: '{{t("Add block")}}', + icon: 'PlusOutlined', + wrap: gridRowColWrap, + items: [ + { + name: 'dataBlocks', + title: '{{t("Data blocks")}}', + type: 'itemGroup', + children: [ + { + name: 'table', + title: '{{t("Table")}}', + Component: 'TableBlockInitializer', + }, + { + name: 'form', + title: '{{t("Form")}}', + Component: 'FormBlockInitializer', + }, + { + name: 'details', + title: '{{t("Details")}}', + Component: 'DetailsBlockInitializer', + }, + { + name: 'list', + title: '{{t("List")}}', + Component: 'ListBlockInitializer', + }, + { + name: 'gridCard', + title: '{{t("Grid Card")}}', + Component: 'GridCardBlockInitializer', + }, + ], + }, + { + name: 'filterBlocks', + title: '{{t("Filter blocks")}}', + type: 'itemGroup', + children: [ + { + name: 'filterForm', + title: '{{t("Form")}}', + Component: 'FilterFormBlockInitializer', + }, + { + name: 'filterCollapse', + title: '{{t("Collapse")}}', + Component: 'FilterCollapseBlockInitializer', + }, + ], + }, + { + name: 'otherBlocks', + type: 'itemGroup', + title: '{{t("Other blocks")}}', + children: [ + { + name: 'markdown', + title: '{{t("Markdown")}}', + Component: 'MarkdownBlockInitializer', + }, + ], + }, + ], + }, + blockInitializers_deprecated, +); diff --git a/packages/core/client/src/modules/page/__e2e__/schemaSettings.test.ts b/packages/core/client/src/modules/page/__e2e__/schemaSettings.test.ts index 405173e4f..cba11d367 100644 --- a/packages/core/client/src/modules/page/__e2e__/schemaSettings.test.ts +++ b/packages/core/client/src/modules/page/__e2e__/schemaSettings.test.ts @@ -2,7 +2,7 @@ import { Page, expect, test } from '@nocobase/test/e2e'; test.describe('page schema settings', () => { const showMenu = async (page: Page) => { - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByLabel('designer-schema-settings-Page').hover(); }; @@ -68,7 +68,7 @@ test.describe('tabs schema settings', () => { } async function enablePageTabs(page) { - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('button', { name: 'designer-schema-settings-Page' }).hover(); await page.getByRole('menuitem', { name: 'Enable page tabs' }).click(); await page.mouse.move(300, 0); diff --git a/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx b/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx index ce184b1ec..0f26e5bef 100644 --- a/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx @@ -6,7 +6,7 @@ import { Alert, Flex, ModalProps, Tag } from 'antd'; import React, { useCallback, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { RemoteSelect, useCompile, useDesignable } from '../..'; -import { useApp } from '../../../application'; +import { isInitializersSame, useApp } from '../../../application'; import { usePlugin } from '../../../application/hooks'; import { SchemaSettingOptions, SchemaSettings } from '../../../application/schema-settings'; import { useSchemaToolbar } from '../../../application/schema-toolbar'; @@ -139,7 +139,7 @@ export function AssignedFieldValues() { type: 'void', 'x-uid': uid(), 'x-component': 'Grid', - 'x-initializer': 'CustomFormItemInitializers', + 'x-initializer': 'assignFieldValuesForm:configureFields', }; const tips = { 'customize:update': t( @@ -671,7 +671,7 @@ export const actionSettingsItems: SchemaSettingOptions['items'] = [ const fieldSchema = useFieldSchema(); return ( fieldSchema['x-action'] === 'submit' && - fieldSchema.parent?.['x-initializer'] === 'CreateFormActionInitializers' + isInitializersSame(fieldSchema.parent?.['x-initializer'], 'createForm:configureActions') ); }, }, @@ -745,6 +745,10 @@ export function SecondConFirm() { /> ); } + +/** + * @deprecated + */ export const actionSettings = new SchemaSettings({ name: 'ActionSettings', items: actionSettingsItems, diff --git a/packages/core/client/src/schema-component/antd/action/demos/demo6.tsx b/packages/core/client/src/schema-component/antd/action/demos/demo6.tsx index daf885e29..9f7fc3146 100644 --- a/packages/core/client/src/schema-component/antd/action/demos/demo6.tsx +++ b/packages/core/client/src/schema-component/antd/action/demos/demo6.tsx @@ -13,7 +13,7 @@ import { import React from 'react'; const addActionButton = new SchemaInitializer({ - name: 'AddActionButton', + name: 'addActionButton', designable: true, title: 'Configure actions', style: { @@ -58,7 +58,7 @@ const schema: ISchema = { actions: { type: 'void', 'x-component': 'ActionBar', - 'x-initializer': 'AddActionButton', + 'x-initializer': 'addActionButton', 'x-uid': uid(), properties: { a1: { diff --git a/packages/core/client/src/schema-component/antd/association-field/schema.ts b/packages/core/client/src/schema-component/antd/association-field/schema.ts index 76331ff1e..23ceada49 100644 --- a/packages/core/client/src/schema-component/antd/association-field/schema.ts +++ b/packages/core/client/src/schema-component/antd/association-field/schema.ts @@ -6,7 +6,7 @@ export default { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', }, }, }, @@ -35,7 +35,7 @@ export default { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', properties: {}, }, }, @@ -55,7 +55,7 @@ export default { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'TableSelectorInitializers', + 'x-initializer': 'popup:tableSelector:addBlock', properties: {}, }, footer: { @@ -73,7 +73,7 @@ export default { 'x-component': 'Action', // 'x-designer': 'Action.Designer', 'x-toolbar': 'ActionSchemaToolbar', - 'x-settings': 'actionSettings:updateSubmit', + 'x-settings': 'actionSettings:submit', 'x-component-props': { type: 'primary', htmlType: 'submit', @@ -110,7 +110,7 @@ export default { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: {}, }, }, @@ -122,7 +122,7 @@ export default { SubTable: { type: 'void', 'x-component': 'AssociationField.SubTable', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-initializer-props': { action: false, }, diff --git a/packages/core/client/src/schema-component/antd/association-filter/ActionBarAssociationFilterAction.tsx b/packages/core/client/src/schema-component/antd/association-filter/ActionBarAssociationFilterAction.tsx index 35c409265..29443a477 100644 --- a/packages/core/client/src/schema-component/antd/association-filter/ActionBarAssociationFilterAction.tsx +++ b/packages/core/client/src/schema-component/antd/association-filter/ActionBarAssociationFilterAction.tsx @@ -7,6 +7,11 @@ import { useBlockRequestContext } from '../../../block-provider'; import { mergeFilter } from '../../../filter-provider/utils'; import { ActionInitializer } from '../../../schema-initializer/items/ActionInitializer'; +/** + * @deprecated + * @param props + * @returns + */ export const ActionBarAssociationFilterAction = (props) => { const { refresh } = useContext(SchemaComponentContext); const fieldSchema = useFieldSchema(); diff --git a/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.Initializer.tsx b/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.Initializer.tsx index ba5e77ca2..b99d7f45e 100644 --- a/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.Initializer.tsx +++ b/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.Initializer.tsx @@ -1,7 +1,10 @@ -import { SchemaInitializerItemType } from '../../../application'; import { SchemaInitializer } from '../../../application/schema-initializer/SchemaInitializer'; +import { SchemaInitializerItemType } from '../../../application/schema-initializer/types'; import { useAssociatedFields } from '../../../filter-provider/utils'; +/** + * @deprecated + */ export const associationFilterInitializer = new SchemaInitializer({ name: 'AssociationFilter.Initializer', style: { diff --git a/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.tsx b/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.tsx index ba122283e..ce5551cc4 100644 --- a/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.tsx +++ b/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.tsx @@ -15,6 +15,7 @@ import { Plugin } from '../../../application/Plugin'; import { associationFilterFilterBlockInitializer, filterCollapseItemInitializer, + filterCollapseItemInitializer_deprecated, } from '../../../modules/blocks/filter-blocks/collapse/filterCollapseItemInitializer'; import { associationFilterInitializer } from './AssociationFilter.Initializer'; @@ -104,6 +105,7 @@ AssociationFilter.useAssociationField = () => { export class AssociationFilterPlugin extends Plugin { async load() { this.app.schemaInitializerManager.add(associationFilterFilterBlockInitializer); + this.app.schemaInitializerManager.add(filterCollapseItemInitializer_deprecated); this.app.schemaInitializerManager.add(filterCollapseItemInitializer); this.app.schemaInitializerManager.add(associationFilterInitializer); } diff --git a/packages/core/client/src/schema-component/antd/form-item/FormItem.Settings.tsx b/packages/core/client/src/schema-component/antd/form-item/FormItem.Settings.tsx index 5f669056f..c0f7886c6 100644 --- a/packages/core/client/src/schema-component/antd/form-item/FormItem.Settings.tsx +++ b/packages/core/client/src/schema-component/antd/form-item/FormItem.Settings.tsx @@ -32,6 +32,9 @@ import { getTempFieldState } from '../form-v2/utils'; import { useColorFields } from '../table-v2/Table.Column.Designer'; import { useColumnSchema } from '../../../schema-component/antd/table-v2/Table.Column.Decorator'; +/** + * @deprecated + */ export const formItemSettings = new SchemaSettings({ name: 'FormItemSettings', items: [ diff --git a/packages/core/client/src/schema-component/antd/form-v2/Form.Settings.tsx b/packages/core/client/src/schema-component/antd/form-v2/Form.Settings.tsx index f163e09e8..463fcf5aa 100644 --- a/packages/core/client/src/schema-component/antd/form-v2/Form.Settings.tsx +++ b/packages/core/client/src/schema-component/antd/form-v2/Form.Settings.tsx @@ -17,6 +17,9 @@ import { SchemaSettingsDataScope } from '../../../schema-settings/SchemaSettings import { useDesignable } from '../../hooks'; import { removeNullCondition } from '../filter'; +/** + * @deprecated + */ export const formSettings = new SchemaSettings({ name: 'FormSettings', items: [ @@ -83,6 +86,9 @@ export const formSettings = new SchemaSettings({ ], }); +/** + * @deprecated + */ export const readPrettyFormSettings = new SchemaSettings({ name: 'ReadPrettyFormSettings', items: [ @@ -122,6 +128,9 @@ export const readPrettyFormSettings = new SchemaSettings({ ], }); +/** + * @deprecated + */ export const formDetailsSettings = new SchemaSettings({ name: 'FormDetailsSettings', items: [ diff --git a/packages/core/client/src/schema-component/antd/form/Form.Settings.tsx b/packages/core/client/src/schema-component/antd/form/Form.Settings.tsx index 54b711f5a..de11dd456 100644 --- a/packages/core/client/src/schema-component/antd/form/Form.Settings.tsx +++ b/packages/core/client/src/schema-component/antd/form/Form.Settings.tsx @@ -2,6 +2,9 @@ import { SchemaSettings } from '../../../application/schema-settings'; import { useCollection_deprecated } from '../../../collection-manager'; import { SchemaSettingsTemplate } from '../../../schema-settings/SchemaSettings'; +/** + * @deprecated + */ export const formV1Settings = new SchemaSettings({ name: 'FormV1Settings', items: [ diff --git a/packages/core/client/src/schema-component/antd/grid/demos/demo3.tsx b/packages/core/client/src/schema-component/antd/grid/demos/demo3.tsx index a1219f869..03f6e560c 100644 --- a/packages/core/client/src/schema-component/antd/grid/demos/demo3.tsx +++ b/packages/core/client/src/schema-component/antd/grid/demos/demo3.tsx @@ -30,7 +30,7 @@ const gridRowColWrap = (schema) => { }; export const addBlockButton = new SchemaInitializer({ - name: 'AddBlockButton', + name: 'addBlockButton', title: 'Add block', wrap: gridRowColWrap, items: [ @@ -55,7 +55,7 @@ const schema: ISchema = { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'AddBlockButton', + 'x-initializer': 'addBlockButton', 'x-uid': uid(), properties: {}, }, diff --git a/packages/core/client/src/schema-component/antd/menu/Menu.Designer.tsx b/packages/core/client/src/schema-component/antd/menu/Menu.Designer.tsx index 2e6e72624..9950aa41d 100644 --- a/packages/core/client/src/schema-component/antd/menu/Menu.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/menu/Menu.Designer.tsx @@ -147,7 +147,7 @@ const InsertMenuItems = (props) => { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: {}, }, }, diff --git a/packages/core/client/src/schema-component/antd/page/Page.Settings.tsx b/packages/core/client/src/schema-component/antd/page/Page.Settings.tsx index 5fdc6c610..4d9576cf9 100644 --- a/packages/core/client/src/schema-component/antd/page/Page.Settings.tsx +++ b/packages/core/client/src/schema-component/antd/page/Page.Settings.tsx @@ -9,6 +9,9 @@ function useNotDisableHeader() { return !fieldSchema['x-component-props']?.disablePageHeader; } +/** + * @deprecated + */ export const pageSettings = new SchemaSettings({ name: 'PageSettings', items: [ diff --git a/packages/core/client/src/schema-component/antd/page/Page.tsx b/packages/core/client/src/schema-component/antd/page/Page.tsx index 136037a98..95133313d 100644 --- a/packages/core/client/src/schema-component/antd/page/Page.tsx +++ b/packages/core/client/src/schema-component/antd/page/Page.tsx @@ -146,7 +146,7 @@ export const Page = (props) => { title, 'x-icon': icon, 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: {}, }); }} diff --git a/packages/core/client/src/schema-component/antd/page/PageTab.Settings.tsx b/packages/core/client/src/schema-component/antd/page/PageTab.Settings.tsx index 029fb4687..8c5ae397c 100644 --- a/packages/core/client/src/schema-component/antd/page/PageTab.Settings.tsx +++ b/packages/core/client/src/schema-component/antd/page/PageTab.Settings.tsx @@ -5,6 +5,9 @@ import { useDesignable } from '../../hooks'; import { useSchemaToolbar } from '../../../application/schema-toolbar'; import { SchemaSettings } from '../../../application/schema-settings/SchemaSettings'; +/** + * @deprecated + */ export const pageTabSettings = new SchemaSettings({ name: 'PageTabSettings', items: [ diff --git a/packages/core/client/src/schema-initializer/buttons/CustomFormItemInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/CustomFormItemInitializers.tsx index 24c1c295a..e224dd872 100644 --- a/packages/core/client/src/schema-initializer/buttons/CustomFormItemInitializers.tsx +++ b/packages/core/client/src/schema-initializer/buttons/CustomFormItemInitializers.tsx @@ -1,9 +1,9 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; -import { SchemaInitializerChildren } from '../../application'; -import { SchemaInitializer } from '../../application/schema-initializer/SchemaInitializer'; import { useCompile } from '../../schema-component'; import { gridRowColWrap, useCustomFormItemInitializerFields, useInheritsFormItemInitializerFields } from '../utils'; +import { SchemaInitializerChildren } from '../../application/schema-initializer/components/SchemaInitializerChildren'; +import { CompatibleSchemaInitializer } from '../../application/schema-initializer/CompatibleSchemaInitializer'; // 表单里配置字段 const ParentCollectionFields = () => { @@ -24,7 +24,10 @@ const ParentCollectionFields = () => { return {res}; }; -export const customFormItemInitializers = new SchemaInitializer({ +/** + * @deprecated + */ +export const customFormItemInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'CustomFormItemInitializers', wrap: gridRowColWrap, icon: 'SettingOutlined', @@ -42,3 +45,25 @@ export const customFormItemInitializers = new SchemaInitializer({ }, ], }); + +export const customFormItemInitializers = new CompatibleSchemaInitializer( + { + name: 'assignFieldValuesForm:configureFields', + wrap: gridRowColWrap, + icon: 'SettingOutlined', + title: '{{t("Configure fields")}}', + items: [ + { + type: 'itemGroup', + title: '{{t("Configure fields")}}', + name: 'configureFields', + useChildren: useCustomFormItemInitializerFields, + }, + { + name: 'parentCollectionFields', + Component: ParentCollectionFields, + }, + ], + }, + customFormItemInitializers_deprecated, +); diff --git a/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx index 5384c3d5d..141b070fb 100644 --- a/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx +++ b/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx @@ -1,8 +1,8 @@ import { Schema, useFieldSchema } from '@formily/react'; import { useMemo } from 'react'; -import { useCollection_deprecated, useCollectionManager_deprecated } from '../..'; +import { useCollectionManager_deprecated, useCollection_deprecated } from '../..'; import { SchemaInitializerItemType, useSchemaInitializer } from '../../application'; -import { SchemaInitializer } from '../../application/schema-initializer/SchemaInitializer'; +import { CompatibleSchemaInitializer } from '../../application/schema-initializer/CompatibleSchemaInitializer'; import { gridRowColWrap } from '../utils'; const recursiveParent = (schema: Schema) => { @@ -236,7 +236,10 @@ function useRecordBlocks() { return res; } -export const recordBlockInitializers = new SchemaInitializer({ +/** + * @deprecated + */ +export const recordBlockInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'RecordBlockInitializers', wrap: gridRowColWrap, title: '{{t("Add block")}}', @@ -321,3 +324,92 @@ export const recordBlockInitializers = new SchemaInitializer({ }, ], }); + +export const recordBlockInitializers = new CompatibleSchemaInitializer( + { + name: 'popup:common:addBlock', + wrap: gridRowColWrap, + title: '{{t("Add block")}}', + icon: 'PlusOutlined', + items: [ + { + type: 'itemGroup', + name: 'currentRecordBlocks', + title: '{{t("Current record blocks")}}', + useChildren: useRecordBlocks, + }, + { + name: 'filterBlocks', + title: '{{t("Filter blocks")}}', + type: 'itemGroup', + useVisible() { + const collection = useCollection_deprecated(); + return collection.fields.some((field) => ['hasMany', 'belongsToMany'].includes(field.type)); + }, + children: [ + { + name: 'filterForm', + title: '{{t("Form")}}', + Component: 'FilterFormBlockInitializer', + useComponentProps() { + const collection = useCollection_deprecated(); + const toManyField = useMemo( + () => collection.fields.filter((field) => ['hasMany', 'belongsToMany'].includes(field.type)), + [collection.fields], + ); + + return { + filterMenuItemChildren(collection) { + return toManyField.some((field) => field.target === collection.name); + }, + onlyCurrentDataSource: true, + }; + }, + }, + { + name: 'filterCollapse', + title: '{{t("Collapse")}}', + Component: 'FilterCollapseBlockInitializer', + useComponentProps() { + const collection = useCollection_deprecated(); + const toManyField = useMemo( + () => collection.fields.filter((field) => ['hasMany', 'belongsToMany'].includes(field.type)), + [collection.fields], + ); + + return { + filterMenuItemChildren(collection) { + return toManyField.some((field) => field.target === collection.name); + }, + onlyCurrentDataSource: true, + }; + }, + }, + ], + }, + { + type: 'itemGroup', + name: 'relationshipBlocks', + title: '{{t("Relationship blocks")}}', + useChildren: useRelationFields, + useVisible() { + const res = useRelationFields(); + return res.length > 0; + }, + }, + { + type: 'itemGroup', + name: 'otherBlocks', + title: '{{t("Other blocks")}}', + children: [ + { + name: 'markdown', + title: '{{t("Markdown")}}', + Component: 'MarkdownBlockInitializer', + }, + ], + }, + ], + }, + recordBlockInitializers_deprecated, +); diff --git a/packages/core/client/src/schema-initializer/buttons/SubTableActionInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/SubTableActionInitializers.tsx index 7068482e7..561f0c205 100644 --- a/packages/core/client/src/schema-initializer/buttons/SubTableActionInitializers.tsx +++ b/packages/core/client/src/schema-initializer/buttons/SubTableActionInitializers.tsx @@ -1,7 +1,10 @@ -import { SchemaInitializer } from '../../application/schema-initializer/SchemaInitializer'; +import { CompatibleSchemaInitializer } from '../../application/schema-initializer/CompatibleSchemaInitializer'; -// 表格操作配置 -export const subTableActionInitializers = new SchemaInitializer({ +/** + * @deprecated + * 表格操作配置 + */ +export const subTableActionInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'SubTableActionInitializers', title: "{{t('Configure actions')}}", icon: 'SettingOutlined', @@ -34,3 +37,40 @@ export const subTableActionInitializers = new SchemaInitializer({ }, ], }); + +export const subTableActionInitializers = new CompatibleSchemaInitializer( + { + name: 'subTable:configureActions', + title: "{{t('Configure actions')}}", + icon: 'SettingOutlined', + style: { + marginLeft: 8, + }, + items: [ + { + type: 'itemGroup', + title: "{{t('Enable actions')}}", + name: 'enableActions', + children: [ + { + name: 'addNew', + title: "{{t('Add new')}}", + Component: 'CreateActionInitializer', + schema: { + 'x-align': 'right', + }, + }, + { + name: 'delete', + title: "{{t('Delete')}}", + Component: 'BulkDestroyActionInitializer', + schema: { + 'x-align': 'right', + }, + }, + ], + }, + ], + }, + subTableActionInitializers_deprecated, +); diff --git a/packages/core/client/src/schema-initializer/buttons/TabPaneInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/TabPaneInitializers.tsx index 2fa3422c6..b0bc396e2 100644 --- a/packages/core/client/src/schema-initializer/buttons/TabPaneInitializers.tsx +++ b/packages/core/client/src/schema-initializer/buttons/TabPaneInitializers.tsx @@ -16,11 +16,11 @@ export const TabPaneInitializers = (props?: any) => { const ctx = useActionContext(); let initializer = gridInitializer; if (!initializer) { - initializer = 'RecordBlockInitializers'; + initializer = 'popup:common:addBlock'; if (isCreate || !record) { - initializer = 'CreateFormBlockInitializers'; + initializer = 'popup:addNew:addBlock'; } else if (isBulkEdit) { - initializer = 'BulkEditBlockInitializers'; + initializer = 'popup:bulkEdit:addBlock'; } } return { @@ -138,18 +138,27 @@ export const TabPaneInitializersForBulkEditFormBlock = (props) => { return ; }; -export const tabPaneInitializers = new SchemaInitializer({ +/** + * @deprecated + */ +export const tabPaneInitializers_deprecated = new SchemaInitializer({ name: 'TabPaneInitializers', Component: TabPaneInitializers, popover: false, }); +/** + * @deprecated + */ export const tabPaneInitializersForRecordBlock = new SchemaInitializer({ name: 'TabPaneInitializersForCreateFormBlock', Component: TabPaneInitializersForCreateFormBlock, popover: false, }); +/** + * @deprecated + */ export const tabPaneInitializersForBulkEditFormBlock = new SchemaInitializer({ name: 'TabPaneInitializersForBulkEditFormBlock', Component: TabPaneInitializersForBulkEditFormBlock, diff --git a/packages/core/client/src/schema-initializer/demos/basic.tsx b/packages/core/client/src/schema-initializer/demos/basic.tsx index 9153f1f3a..0408a6f0b 100644 --- a/packages/core/client/src/schema-initializer/demos/basic.tsx +++ b/packages/core/client/src/schema-initializer/demos/basic.tsx @@ -8,7 +8,7 @@ import { import React from 'react'; const myInitializer = new SchemaInitializer({ - name: 'MyInitializer', + name: 'myInitializer', // 正常情况下这个值为 false,通过点击页面左上角的设计按钮切换,这里为了显示设置为 true designable: true, // 按钮标题标题 @@ -27,7 +27,7 @@ const myInitializer = new SchemaInitializer({ }); const Root = () => { - const { render } = useSchemaInitializerRender('MyInitializer'); + const { render } = useSchemaInitializerRender('myInitializer'); return
{render()}
; }; @@ -45,7 +45,7 @@ class MyPlugin extends Plugin { class MyPlugin2 extends Plugin { async load() { - const myInitializer = this.app.schemaInitializerManager.get('MyInitializer'); + const myInitializer = this.app.schemaInitializerManager.get('myInitializer'); // 添加或者修改 schema initializer 的 items myInitializer.add('demo3', { diff --git a/packages/core/client/src/schema-initializer/demos/build-type.tsx b/packages/core/client/src/schema-initializer/demos/build-type.tsx index 13b66069d..2bf62f249 100644 --- a/packages/core/client/src/schema-initializer/demos/build-type.tsx +++ b/packages/core/client/src/schema-initializer/demos/build-type.tsx @@ -8,7 +8,7 @@ import { import React from 'react'; const myInitializer = new SchemaInitializer({ - name: 'MyInitializer', + name: 'myInitializer', designable: true, title: 'Button Text', items: [ @@ -61,7 +61,7 @@ const myInitializer = new SchemaInitializer({ }); const Root = () => { - const { render } = useSchemaInitializerRender('MyInitializer'); + const { render } = useSchemaInitializerRender('myInitializer'); return
{render()}
; }; diff --git a/packages/core/client/src/schema-initializer/demos/custom-button.tsx b/packages/core/client/src/schema-initializer/demos/custom-button.tsx index 2c39c5da7..cf69043f7 100644 --- a/packages/core/client/src/schema-initializer/demos/custom-button.tsx +++ b/packages/core/client/src/schema-initializer/demos/custom-button.tsx @@ -4,7 +4,7 @@ import { PlusOutlined } from '@ant-design/icons'; import { Divider, Avatar, AvatarProps } from 'antd'; const myInitializer = new SchemaInitializer({ - name: 'MyInitializer', + name: 'myInitializer', designable: true, // 使用自定义组件代替默认的 Button Component: (props) => ( @@ -25,7 +25,7 @@ const myInitializer = new SchemaInitializer({ }); const Root = () => { - const { exists, render } = useSchemaInitializerRender('MyInitializer'); + const { exists, render } = useSchemaInitializerRender('myInitializer'); if (!exists) return null; return (
diff --git a/packages/core/client/src/schema-initializer/demos/custom-items-component.tsx b/packages/core/client/src/schema-initializer/demos/custom-items-component.tsx index e88355249..00d5588c1 100644 --- a/packages/core/client/src/schema-initializer/demos/custom-items-component.tsx +++ b/packages/core/client/src/schema-initializer/demos/custom-items-component.tsx @@ -38,7 +38,7 @@ const CustomListGridMenu: FC { - const { exists, render } = useSchemaInitializerRender('MyInitializer'); + const { exists, render } = useSchemaInitializerRender('myInitializer'); if (!exists) return null; return (
diff --git a/packages/core/client/src/schema-initializer/demos/dynamic-visible-children.tsx b/packages/core/client/src/schema-initializer/demos/dynamic-visible-children.tsx index 94c04554d..eac229826 100644 --- a/packages/core/client/src/schema-initializer/demos/dynamic-visible-children.tsx +++ b/packages/core/client/src/schema-initializer/demos/dynamic-visible-children.tsx @@ -8,7 +8,7 @@ import { import React from 'react'; const myInitializer = new SchemaInitializer({ - name: 'MyInitializer', + name: 'myInitializer', designable: true, title: 'Button Text', items: [ @@ -59,7 +59,7 @@ const myInitializer = new SchemaInitializer({ }); const Root = () => { - const { render } = useSchemaInitializerRender('MyInitializer'); + const { render } = useSchemaInitializerRender('myInitializer'); return
{render()}
; }; diff --git a/packages/core/client/src/schema-initializer/demos/insert-schema-action.tsx b/packages/core/client/src/schema-initializer/demos/insert-schema-action.tsx index 7a273c084..0ee7db75d 100644 --- a/packages/core/client/src/schema-initializer/demos/insert-schema-action.tsx +++ b/packages/core/client/src/schema-initializer/demos/insert-schema-action.tsx @@ -12,7 +12,7 @@ import { import React from 'react'; const addActionInitializer = new SchemaInitializer({ - name: 'AddAction', + name: 'addAction', title: 'Configure actions', // 插入位置 insertPosition: 'beforeEnd', @@ -65,7 +65,7 @@ const Root = () => { // 指定初始化的按钮组件, // Table、Form、Details、Calendar、Kanban 等等不同区块 // 可以根据情况组装自己的 initializer - 'x-initializer': 'AddAction', + 'x-initializer': 'addAction', properties: { action1: { type: 'void', diff --git a/packages/core/client/src/schema-initializer/demos/insert-schema-basic.tsx b/packages/core/client/src/schema-initializer/demos/insert-schema-basic.tsx index 6da9a5cdc..53f7ee5fb 100644 --- a/packages/core/client/src/schema-initializer/demos/insert-schema-basic.tsx +++ b/packages/core/client/src/schema-initializer/demos/insert-schema-basic.tsx @@ -36,7 +36,7 @@ function Demo() { } const myInitializer = new SchemaInitializer({ - name: 'MyInitializer', + name: 'myInitializer', title: 'Add Block', // 插入位置 insertPosition: 'beforeEnd', @@ -55,7 +55,7 @@ const myInitializer = new SchemaInitializer({ }); const AddBlockButton = observer(() => { - const { render } = useSchemaInitializerRender('MyInitializer'); + const { render } = useSchemaInitializerRender('myInitializer'); return render(); }); diff --git a/packages/core/client/src/schema-initializer/demos/insert-schema-form-item.tsx b/packages/core/client/src/schema-initializer/demos/insert-schema-form-item.tsx index 9368462c9..a7c9c5b55 100644 --- a/packages/core/client/src/schema-initializer/demos/insert-schema-form-item.tsx +++ b/packages/core/client/src/schema-initializer/demos/insert-schema-form-item.tsx @@ -67,7 +67,7 @@ const TextInitializer: FC = () => { }; const addFormItemInitializer = new SchemaInitializer({ - name: 'AddFormItem', + name: 'addFormItem', title: 'Configure actions', insertPosition: 'beforeEnd', items: [ @@ -91,7 +91,7 @@ const addFormItemInitializer = new SchemaInitializer({ }); const Page = (props) => { - const { render } = useSchemaInitializerRender('AddFormItem'); + const { render } = useSchemaInitializerRender('addFormItem'); return (
{props.children} diff --git a/packages/core/client/src/schema-initializer/demos/nested-items.tsx b/packages/core/client/src/schema-initializer/demos/nested-items.tsx index 187eb5fac..0ff86b6a7 100644 --- a/packages/core/client/src/schema-initializer/demos/nested-items.tsx +++ b/packages/core/client/src/schema-initializer/demos/nested-items.tsx @@ -69,7 +69,7 @@ const Demo = () => { }; const myInitializer = new SchemaInitializer({ - name: 'MyInitializer', + name: 'myInitializer', designable: true, title: 'Button Text', items: [ @@ -99,7 +99,7 @@ const myInitializer = new SchemaInitializer({ }); const Root = () => { - const { render } = useSchemaInitializerRender('MyInitializer'); + const { render } = useSchemaInitializerRender('myInitializer'); return
{render()}
; }; @@ -115,7 +115,7 @@ class MyPlugin extends Plugin { class MyPlugin2 extends Plugin { async load() { - const myInitializer = this.app.schemaInitializerManager.get('MyInitializer'); + const myInitializer = this.app.schemaInitializerManager.get('myInitializer'); // 嵌套添加 myInitializer.add('a.a4', { diff --git a/packages/core/client/src/schema-initializer/index.ts b/packages/core/client/src/schema-initializer/index.ts index ee6d1f2ef..cc68d9725 100644 --- a/packages/core/client/src/schema-initializer/index.ts +++ b/packages/core/client/src/schema-initializer/index.ts @@ -1,9 +1,15 @@ import { Plugin } from '../application/Plugin'; import { CreateChildInitializer } from '../modules/actions/add-child/CreateChildInitializer'; import { CreateActionInitializer } from '../modules/actions/add-new/CreateActionInitializer'; -import { createFormBlockInitializers } from '../modules/actions/add-new/createFormBlockInitializers'; +import { + createFormBlockInitializers, + createFormBlockInitializers_deprecated, +} from '../modules/actions/add-new/createFormBlockInitializers'; import { CustomizeAddRecordActionInitializer } from '../modules/actions/add-record/CustomizeAddRecordActionInitializer'; -import { customizeCreateFormBlockInitializers } from '../modules/actions/add-record/customizeCreateFormBlockInitializers'; +import { + customizeCreateFormBlockInitializers, + customizeCreateFormBlockInitializers_deprecated, +} from '../modules/actions/add-record/customizeCreateFormBlockInitializers'; import { BulkDestroyActionInitializer } from '../modules/actions/bulk-destroy/BulkDestroyActionInitializer'; import { DestroyActionInitializer } from '../modules/actions/delete/DestroyActionInitializer'; import { ExpandableActionInitializer } from '../modules/actions/expand-collapse/ExpandableActionInitializer'; @@ -17,47 +23,98 @@ import { PopupActionInitializer } from '../modules/actions/view-edit-popup/Popup import { recordFormBlockInitializers } from '../modules/actions/view-edit-popup/RecordFormBlockInitializers'; import { UpdateActionInitializer } from '../modules/actions/view-edit-popup/UpdateActionInitializer'; import { ViewActionInitializer } from '../modules/actions/view-edit-popup/ViewActionInitializer'; -import { detailsActionInitializers } from '../modules/blocks/data-blocks/details-multi/DetailsActionInitializers'; +import { + detailsActionInitializers, + detailsActionInitializers_deprecated, +} from '../modules/blocks/data-blocks/details-multi/DetailsActionInitializers'; import { DetailsBlockInitializer } from '../modules/blocks/data-blocks/details-multi/DetailsBlockInitializer'; -import { readPrettyFormActionInitializers } from '../modules/blocks/data-blocks/details-single/ReadPrettyFormActionInitializers'; -import { readPrettyFormItemInitializers } from '../modules/blocks/data-blocks/details-single/ReadPrettyFormItemInitializers'; +import { + readPrettyFormActionInitializers, + readPrettyFormActionInitializers_deprecated, +} from '../modules/blocks/data-blocks/details-single/ReadPrettyFormActionInitializers'; +import { + readPrettyFormItemInitializers, + readPrettyFormItemInitializers_deprecated, +} from '../modules/blocks/data-blocks/details-single/ReadPrettyFormItemInitializers'; import { RecordReadPrettyFormBlockInitializer } from '../modules/blocks/data-blocks/details-single/RecordReadPrettyFormBlockInitializer'; import { CreateFormBlockInitializer } from '../modules/blocks/data-blocks/form/CreateFormBlockInitializer'; import { FormBlockInitializer } from '../modules/blocks/data-blocks/form/FormBlockInitializer'; import { RecordFormBlockInitializer } from '../modules/blocks/data-blocks/form/RecordFormBlockInitializer'; -import { createFormActionInitializers } from '../modules/blocks/data-blocks/form/createFormActionInitializers'; +import { + createFormActionInitializers, + createFormActionInitializers_deprecated, +} from '../modules/blocks/data-blocks/form/createFormActionInitializers'; import { formActionInitializers } from '../modules/blocks/data-blocks/form/formActionInitializers'; -import { formItemInitializers } from '../modules/blocks/data-blocks/form/formItemInitializers'; -import { updateFormActionInitializers } from '../modules/blocks/data-blocks/form/updateFormActionInitializers'; -import { gridCardActionInitializers } from '../modules/blocks/data-blocks/grid-card/GridCardActionInitializers'; +import { + formItemInitializers, + formItemInitializers_deprecated, +} from '../modules/blocks/data-blocks/form/formItemInitializers'; +import { + updateFormActionInitializers, + updateFormActionInitializers_deprecated, +} from '../modules/blocks/data-blocks/form/updateFormActionInitializers'; +import { + gridCardActionInitializers, + gridCardActionInitializers_deprecated, +} from '../modules/blocks/data-blocks/grid-card/GridCardActionInitializers'; import { GridCardBlockInitializer } from '../modules/blocks/data-blocks/grid-card/GridCardBlockInitializer'; -import { gridCardItemActionInitializers } from '../modules/blocks/data-blocks/grid-card/gridCardItemActionInitializers'; -import { listActionInitializers } from '../modules/blocks/data-blocks/list/ListActionInitializers'; +import { + gridCardItemActionInitializers, + gridCardItemActionInitializers_deprecated, +} from '../modules/blocks/data-blocks/grid-card/gridCardItemActionInitializers'; +import { + listActionInitializers, + listActionInitializers_deprecated, +} from '../modules/blocks/data-blocks/list/ListActionInitializers'; import { ListBlockInitializer } from '../modules/blocks/data-blocks/list/ListBlockInitializer'; -import { listItemActionInitializers } from '../modules/blocks/data-blocks/list/listItemActionInitializers'; +import { + listItemActionInitializers, + listItemActionInitializers_deprecated, +} from '../modules/blocks/data-blocks/list/listItemActionInitializers'; import { TableSelectorInitializer } from '../modules/blocks/data-blocks/table-selector/TableSelectorInitializer'; -import { tableActionColumnInitializers } from '../modules/blocks/data-blocks/table/TableActionColumnInitializers'; -import { tableActionInitializers } from '../modules/blocks/data-blocks/table/TableActionInitializers'; +import { + tableActionColumnInitializers, + tableActionColumnInitializers_deprecated, +} from '../modules/blocks/data-blocks/table/TableActionColumnInitializers'; +import { + tableActionInitializers, + tableActionInitializers_deprecated, +} from '../modules/blocks/data-blocks/table/TableActionInitializers'; import { TableBlockInitializer } from '../modules/blocks/data-blocks/table/TableBlockInitializer'; -import { tableColumnInitializers } from '../modules/blocks/data-blocks/table/TableColumnInitializers'; +import { + tableColumnInitializers, + tableColumnInitializers_deprecated, +} from '../modules/blocks/data-blocks/table/TableColumnInitializers'; import { FilterCollapseBlockInitializer } from '../modules/blocks/filter-blocks/collapse/FilterCollapseBlockInitializer'; -import { filterFormActionInitializers } from '../modules/blocks/filter-blocks/form/FilterFormActionInitializers'; +import { + filterFormActionInitializers, + filterFormActionInitializers_deprecated, +} from '../modules/blocks/filter-blocks/form/FilterFormActionInitializers'; import { FilterFormBlockInitializer } from '../modules/blocks/filter-blocks/form/FilterFormBlockInitializer'; -import { filterFormItemInitializers } from '../modules/blocks/filter-blocks/form/filterFormItemInitializers'; +import { + filterFormItemInitializers, + filterFormItemInitializers_deprecated, +} from '../modules/blocks/filter-blocks/form/filterFormItemInitializers'; import { MarkdownBlockInitializer } from '../modules/blocks/other-blocks/markdown/MarkdownBlockInitializer'; import { MarkdownFormItemInitializer } from '../modules/blocks/other-blocks/markdown/MarkdownFormItemInitializer'; -import { tableSelectorInitializers } from '../modules/fields/component/Picker/TableSelectorInitializers'; +import { + tableSelectorInitializers, + tableSelectorInitializers_deprecated, +} from '../modules/fields/component/Picker/TableSelectorInitializers'; import { CollectionFieldInitializer } from '../modules/fields/initializer/CollectionFieldInitializer'; import { TableCollectionFieldInitializer } from '../modules/fields/initializer/TableCollectionFieldInitializer'; -import { menuItemInitializer } from '../modules/menu/menuItemInitializer'; -import { blockInitializers } from '../modules/page/BlockInitializers'; +import { menuItemInitializer, menuItemInitializer_deprecated } from '../modules/menu/menuItemInitializer'; +import { blockInitializers, blockInitializers_deprecated } from '../modules/page/BlockInitializers'; import { customFormItemInitializers, + customFormItemInitializers_deprecated, recordBlockInitializers, + recordBlockInitializers_deprecated, subTableActionInitializers, - tabPaneInitializers, + subTableActionInitializers_deprecated, tabPaneInitializersForBulkEditFormBlock, tabPaneInitializersForRecordBlock, + tabPaneInitializers_deprecated, } from './buttons'; import * as initializerComponents from './components'; import * as items from './items'; @@ -118,35 +175,57 @@ export class SchemaInitializerPlugin extends Plugin { RefreshActionInitializer, } as any); + this.app.schemaInitializerManager.add(blockInitializers_deprecated); this.app.schemaInitializerManager.add(blockInitializers); + this.app.schemaInitializerManager.add(tableActionInitializers_deprecated); this.app.schemaInitializerManager.add(tableActionInitializers); + this.app.schemaInitializerManager.add(tableColumnInitializers_deprecated); this.app.schemaInitializerManager.add(tableColumnInitializers); + this.app.schemaInitializerManager.add(tableActionColumnInitializers_deprecated); this.app.schemaInitializerManager.add(tableActionColumnInitializers); + this.app.schemaInitializerManager.add(formItemInitializers_deprecated); this.app.schemaInitializerManager.add(formItemInitializers); this.app.schemaInitializerManager.add(formActionInitializers); + this.app.schemaInitializerManager.add(detailsActionInitializers_deprecated); this.app.schemaInitializerManager.add(detailsActionInitializers); + this.app.schemaInitializerManager.add(readPrettyFormItemInitializers_deprecated); this.app.schemaInitializerManager.add(readPrettyFormItemInitializers); + this.app.schemaInitializerManager.add(readPrettyFormActionInitializers_deprecated); this.app.schemaInitializerManager.add(readPrettyFormActionInitializers); + this.app.schemaInitializerManager.add(createFormBlockInitializers_deprecated); this.app.schemaInitializerManager.add(createFormBlockInitializers); + this.app.schemaInitializerManager.add(customizeCreateFormBlockInitializers_deprecated); this.app.schemaInitializerManager.add(customizeCreateFormBlockInitializers); + this.app.schemaInitializerManager.add(customFormItemInitializers_deprecated); this.app.schemaInitializerManager.add(customFormItemInitializers); + this.app.schemaInitializerManager.add(filterFormActionInitializers_deprecated); this.app.schemaInitializerManager.add(filterFormActionInitializers); + this.app.schemaInitializerManager.add(createFormActionInitializers_deprecated); this.app.schemaInitializerManager.add(createFormActionInitializers); + this.app.schemaInitializerManager.add(updateFormActionInitializers_deprecated); this.app.schemaInitializerManager.add(updateFormActionInitializers); + this.app.schemaInitializerManager.add(filterFormItemInitializers_deprecated); this.app.schemaInitializerManager.add(filterFormItemInitializers); + this.app.schemaInitializerManager.add(gridCardActionInitializers_deprecated); this.app.schemaInitializerManager.add(gridCardActionInitializers); + this.app.schemaInitializerManager.add(gridCardItemActionInitializers_deprecated); this.app.schemaInitializerManager.add(gridCardItemActionInitializers); + this.app.schemaInitializerManager.add(listActionInitializers_deprecated); this.app.schemaInitializerManager.add(listActionInitializers); + this.app.schemaInitializerManager.add(listItemActionInitializers_deprecated); this.app.schemaInitializerManager.add(listItemActionInitializers); + this.app.schemaInitializerManager.add(recordBlockInitializers_deprecated); this.app.schemaInitializerManager.add(recordBlockInitializers); this.app.schemaInitializerManager.add(recordFormBlockInitializers); + this.app.schemaInitializerManager.add(subTableActionInitializers_deprecated); this.app.schemaInitializerManager.add(subTableActionInitializers); + this.app.schemaInitializerManager.add(tableSelectorInitializers_deprecated); this.app.schemaInitializerManager.add(tableSelectorInitializers); - this.app.schemaInitializerManager.add(tabPaneInitializers); + this.app.schemaInitializerManager.add(tabPaneInitializers_deprecated); this.app.schemaInitializerManager.add(tabPaneInitializersForRecordBlock); this.app.schemaInitializerManager.add(tabPaneInitializersForBulkEditFormBlock); - this.app.schemaInitializerManager.add(createFormBlockInitializers); + this.app.schemaInitializerManager.add(menuItemInitializer_deprecated); this.app.schemaInitializerManager.add(menuItemInitializer); } } diff --git a/packages/core/client/src/schema-initializer/items/RecordAssociationFormBlockInitializer.tsx b/packages/core/client/src/schema-initializer/items/RecordAssociationFormBlockInitializer.tsx index 0d22eec64..274f94941 100644 --- a/packages/core/client/src/schema-initializer/items/RecordAssociationFormBlockInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/RecordAssociationFormBlockInitializer.tsx @@ -23,8 +23,8 @@ export const RecordAssociationFormBlockInitializer = () => { onClick={async ({ item }) => { const action = ['hasOne', 'belongsTo'].includes(field.type) ? 'get' : null; const actionInitializers = ['hasOne', 'belongsTo'].includes(field.type) - ? 'UpdateFormActionInitializers' - : 'CreateFormActionInitializers'; + ? 'editForm:configureActions' + : 'createForm:configureActions'; if (item.template) { const s = await getTemplateSchemaByMode(item); diff --git a/packages/core/client/src/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.tsx b/packages/core/client/src/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.tsx index 503c1c7b2..83b662f17 100644 --- a/packages/core/client/src/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.tsx @@ -20,7 +20,7 @@ export const RecordReadPrettyAssociationFormBlockInitializer = () => { const resource = `${field.collectionName}.${field.name}`; const { block } = useBlockRequestContext(); - const actionInitializers = block !== 'TableField' ? 'ReadPrettyFormActionInitializers' : null; + const actionInitializers = block !== 'TableField' ? 'details:configureActions' : null; return ( { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'TableSelectorInitializers', + 'x-initializer': 'popup:tableSelector:addBlock', properties: {}, }, footer: { @@ -41,7 +41,7 @@ export const SelectActionInitializer = (props) => { 'x-component': 'Action', // 'x-designer': 'Action.Designer', 'x-toolbar': 'ActionSchemaToolbar', - 'x-settings': 'actionSettings:updateSubmit', + 'x-settings': 'actionSettings:submit', 'x-component-props': { type: 'primary', htmlType: 'submit', diff --git a/packages/core/client/src/schema-initializer/items/SubmitActionInitializer.tsx b/packages/core/client/src/schema-initializer/items/SubmitActionInitializer.tsx index f3f0afb84..c0edbf266 100644 --- a/packages/core/client/src/schema-initializer/items/SubmitActionInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/SubmitActionInitializer.tsx @@ -9,7 +9,7 @@ export const SubmitActionInitializer = (props) => { 'x-component': 'Action', // 'x-designer': 'Action.Designer', 'x-toolbar': 'ActionSchemaToolbar', - 'x-settings': 'actionSettings:updateSubmit', + 'x-settings': 'actionSettings:submit', 'x-component-props': { type: 'primary', htmlType: 'submit', diff --git a/packages/core/client/src/schema-initializer/items/TableActionColumnInitializer.tsx b/packages/core/client/src/schema-initializer/items/TableActionColumnInitializer.tsx index 604c77935..33d833d6b 100644 --- a/packages/core/client/src/schema-initializer/items/TableActionColumnInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/TableActionColumnInitializer.tsx @@ -10,7 +10,7 @@ export const TableActionColumnInitializer = () => { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', 'x-action-column': 'actions', properties: { [uid()]: { diff --git a/packages/core/client/src/schema-initializer/utils.ts b/packages/core/client/src/schema-initializer/utils.ts index 5640e698b..34411a58e 100644 --- a/packages/core/client/src/schema-initializer/utils.ts +++ b/packages/core/client/src/schema-initializer/utils.ts @@ -857,8 +857,8 @@ export const useCollectionDataSourceItems = ( export const createDetailsBlockSchema = (options) => { const { - formItemInitializers = 'ReadPrettyFormItemInitializers', - actionInitializers = 'DetailsActionInitializers', + formItemInitializers = 'details:configureFields', + actionInitializers = 'detailsWithPaging:configureActions', collection, dataSource, association, @@ -930,9 +930,9 @@ export const createDetailsBlockSchema = (options) => { export const createListBlockSchema = (options) => { const { - formItemInitializers = 'ReadPrettyFormItemInitializers', - actionInitializers = 'ListActionInitializers', - itemActionInitializers = 'ListItemActionInitializers', + formItemInitializers = 'details:configureFields', + actionInitializers = 'list:configureActions', + itemActionInitializers = 'list:configureItemActions', collection, dataSource, association, @@ -1020,9 +1020,9 @@ export const createListBlockSchema = (options) => { export const createGridCardBlockSchema = (options) => { const { - formItemInitializers = 'ReadPrettyFormItemInitializers', - actionInitializers = 'GridCardActionInitializers', - itemActionInitializers = 'GridCardItemActionInitializers', + formItemInitializers = 'details:configureFields', + actionInitializers = 'gridCard:configureActions', + itemActionInitializers = 'gridCard:configureItemActions', collection, association, resource, @@ -1112,8 +1112,8 @@ export const createGridCardBlockSchema = (options) => { }; export const createFormBlockSchema = (options) => { const { - formItemInitializers = 'FormItemInitializers', - actionInitializers = 'FormActionInitializers', + formItemInitializers = 'form:configureFields', + actionInitializers = 'createForm:configureActions', collection, resource, dataSource, @@ -1185,8 +1185,8 @@ export const createFormBlockSchema = (options) => { export const createFilterFormBlockSchema = (options) => { const { - formItemInitializers = 'FilterFormItemInitializers', - actionInitializers = 'FilterFormActionInitializers', + formItemInitializers = 'filterForm:configureFields', + actionInitializers = 'filterForm:configureActions', collection, resource, association, @@ -1250,8 +1250,8 @@ export const createFilterFormBlockSchema = (options) => { export const createReadPrettyFormBlockSchema = (options) => { const { - formItemInitializers = 'ReadPrettyFormItemInitializers', - actionInitializers = 'ReadPrettyFormActionInitializers', + formItemInitializers = 'details:configureFields', + actionInitializers = 'details:configureActions', collection, association, dataSource, @@ -1353,7 +1353,7 @@ export const createTableBlockSchema = (options) => { properties: { actions: { type: 'void', - 'x-initializer': tableActionInitializers ?? 'TableActionInitializers', + 'x-initializer': tableActionInitializers ?? 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -1364,7 +1364,7 @@ export const createTableBlockSchema = (options) => { }, [uid()]: { type: 'array', - 'x-initializer': tableColumnInitializers ?? 'TableColumnInitializers', + 'x-initializer': tableColumnInitializers ?? 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -1381,7 +1381,7 @@ export const createTableBlockSchema = (options) => { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': tableActionColumnInitializers ?? 'TableActionColumnInitializers', + 'x-initializer': tableActionColumnInitializers ?? 'table:configureItemActions', properties: { [uid()]: { type: 'void', @@ -1424,7 +1424,7 @@ export const createCollapseBlockSchema = (options) => { [uid()]: { type: 'void', 'x-action': 'associateFilter', - 'x-initializer': 'AssociationFilterInitializers', + 'x-initializer': 'filterCollapse:configureFields', 'x-component': 'AssociationFilter', properties: {}, }, @@ -1457,7 +1457,7 @@ export const createTableSelectorSchema = (options) => { properties: { [uid()]: { type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -1468,7 +1468,7 @@ export const createTableSelectorSchema = (options) => { }, value: { type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2.Selector', 'x-component-props': { rowSelection: { diff --git a/packages/core/client/src/schema-settings/demos/demo3.tsx b/packages/core/client/src/schema-settings/demos/demo3.tsx index 4a6d52d53..0161c525c 100644 --- a/packages/core/client/src/schema-settings/demos/demo3.tsx +++ b/packages/core/client/src/schema-settings/demos/demo3.tsx @@ -28,7 +28,7 @@ const mySettings = new SchemaSettings({ }); const myInitializer = new SchemaInitializer({ - name: 'MyInitializer', + name: 'myInitializer', // 按钮标题标题 title: 'Button Text', wrap: Grid.wrap, @@ -80,7 +80,7 @@ const HelloPage = () => { name: 'hello', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'MyInitializer', + 'x-initializer': 'myInitializer', }} />
diff --git a/packages/core/test/src/e2e/e2eUtils.ts b/packages/core/test/src/e2e/e2eUtils.ts index b6409575f..1dc9fe9c0 100644 --- a/packages/core/test/src/e2e/e2eUtils.ts +++ b/packages/core/test/src/e2e/e2eUtils.ts @@ -526,7 +526,7 @@ const createPage = async (options?: CreatePageOptions) => { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', 'x-uid': uid(), name: gridName, }, @@ -864,7 +864,7 @@ export async function expectInitializerMenu({ showMenu, supportedOptions, page } * @param name */ export const createBlockInPage = async (page: Page, name: string) => { - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); if (name === 'Form') { await page.getByText('Form', { exact: true }).first().hover(); diff --git a/packages/core/test/src/e2e/templatesOfPage.ts b/packages/core/test/src/e2e/templatesOfPage.ts index a87be8b28..1273488fd 100644 --- a/packages/core/test/src/e2e/templatesOfPage.ts +++ b/packages/core/test/src/e2e/templatesOfPage.ts @@ -56,7 +56,7 @@ export const tabPageEmpty: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', 'x-uid': 'ir8tvhr1xqi', 'x-async': false, 'x-index': 1, @@ -153,7 +153,7 @@ export const oneEmptyTable: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { fdkznek8n9o: { _isJSONSchemaObject: true, @@ -193,7 +193,7 @@ export const oneEmptyTable: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -208,7 +208,7 @@ export const oneEmptyTable: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -227,7 +227,7 @@ export const oneEmptyTable: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -295,7 +295,7 @@ export const oneEmptyForm: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { cxk2aa058lc: { _isJSONSchemaObject: true, @@ -340,7 +340,7 @@ export const oneEmptyForm: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', 'x-uid': 'y6qzidbf0lm', 'x-async': false, 'x-index': 1, @@ -349,7 +349,7 @@ export const oneEmptyForm: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'FormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -405,7 +405,7 @@ export const oneEmptyFormWithActions: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { ybhtsluv6ay: { _isJSONSchemaObject: true, @@ -450,7 +450,7 @@ export const oneEmptyFormWithActions: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', 'x-uid': '9gcg27ewld4', 'x-async': false, 'x-index': 1, @@ -459,7 +459,7 @@ export const oneEmptyFormWithActions: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'FormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -571,7 +571,7 @@ export const oneEmptyDetailsBlock: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', 'x-index': 1, properties: { cnp4fnntodr: { @@ -619,7 +619,7 @@ export const oneEmptyDetailsBlock: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'DetailsActionInitializers', + 'x-initializer': 'detailsWithPaging:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -635,7 +635,7 @@ export const oneEmptyDetailsBlock: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'ReadPrettyFormItemInitializers', + 'x-initializer': 'details:configureFields', 'x-uid': 'sldwwd6jq6g', 'x-async': false, 'x-index': 2, @@ -699,7 +699,7 @@ export const oneEmptyListBlock: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', 'x-index': 1, properties: { wpm7v8svnpo: { @@ -738,7 +738,7 @@ export const oneEmptyListBlock: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'ListActionInitializers', + 'x-initializer': 'list:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -773,7 +773,7 @@ export const oneEmptyListBlock: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'ReadPrettyFormItemInitializers', + 'x-initializer': 'details:configureFields', 'x-initializer-props': { useProps: '{{ useListItemInitializerProps }}', }, @@ -786,7 +786,7 @@ export const oneEmptyListBlock: PageConfig = { version: '2.0', type: 'void', 'x-align': 'left', - 'x-initializer': 'ListItemActionInitializers', + 'x-initializer': 'list:configureItemActions', 'x-component': 'ActionBar', 'x-component-props': { useProps: '{{ useListActionBarProps }}', @@ -848,7 +848,7 @@ export const oneEmptyGridCardBlock: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', 'x-index': 1, properties: { x22u60kld4t: { @@ -890,7 +890,7 @@ export const oneEmptyGridCardBlock: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'GridCardActionInitializers', + 'x-initializer': 'gridCard:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -925,7 +925,7 @@ export const oneEmptyGridCardBlock: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'ReadPrettyFormItemInitializers', + 'x-initializer': 'details:configureFields', 'x-initializer-props': { useProps: '{{ useGridCardItemInitializerProps }}', }, @@ -938,7 +938,7 @@ export const oneEmptyGridCardBlock: PageConfig = { version: '2.0', type: 'void', 'x-align': 'left', - 'x-initializer': 'GridCardItemActionInitializers', + 'x-initializer': 'gridCard:configureItemActions', 'x-component': 'ActionBar', 'x-component-props': { useProps: '{{ useGridCardActionBarProps }}', @@ -1000,7 +1000,7 @@ export const oneEmptyFilterFormBlock: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', 'x-index': 1, properties: { mk7wdkfacfo: { @@ -1043,7 +1043,7 @@ export const oneEmptyFilterFormBlock: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FilterFormItemInitializers', + 'x-initializer': 'filterForm:configureFields', 'x-uid': 'yls3c6j92ex', 'x-async': false, 'x-index': 1, @@ -1052,7 +1052,7 @@ export const oneEmptyFilterFormBlock: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'FilterFormActionInitializers', + 'x-initializer': 'filterForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -1111,7 +1111,7 @@ export const oneEmptyFilterCollapseBlock: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', 'x-index': 1, properties: { vnikc8bt477: { @@ -1196,7 +1196,7 @@ export const oneEmptyTableBlockWithActions: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', 'x-index': 1, properties: { '1m4gz110aaw': { @@ -1237,7 +1237,7 @@ export const oneEmptyTableBlockWithActions: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -1315,7 +1315,7 @@ export const oneEmptyTableBlockWithActions: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', 'x-uid': 'k0zm3uifn6v', 'x-async': false, 'x-index': 1, @@ -1434,7 +1434,7 @@ export const oneEmptyTableBlockWithActions: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CusomeizeCreateFormBlockInitializers', + 'x-initializer': 'popup:addRecord:addBlock', 'x-uid': '60wmk833o7b', 'x-async': false, 'x-index': 1, @@ -1468,7 +1468,7 @@ export const oneEmptyTableBlockWithActions: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -1487,7 +1487,7 @@ export const oneEmptyTableBlockWithActions: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -1547,7 +1547,7 @@ export const oneEmptyTableBlockWithActions: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', 'x-uid': '1m4fg88bmp6', 'x-async': false, 'x-index': 1, @@ -1621,7 +1621,7 @@ export const oneEmptyTableBlockWithActions: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', 'x-uid': 'zjv8mf85knj', 'x-async': false, 'x-index': 1, @@ -1720,7 +1720,7 @@ export const oneEmptyTableBlockWithActions: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', 'x-uid': 'vtcnkzcaeec', 'x-async': false, 'x-index': 1, @@ -1804,7 +1804,7 @@ export const oneTableBlockWithActionsAndFormBlocks: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { n6xy1x7hh3l: { _isJSONSchemaObject: true, @@ -1844,7 +1844,7 @@ export const oneTableBlockWithActionsAndFormBlocks: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -1922,7 +1922,7 @@ export const oneTableBlockWithActionsAndFormBlocks: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', properties: { '7tcjyx5gipn': { _isJSONSchemaObject: true, @@ -1967,7 +1967,7 @@ export const oneTableBlockWithActionsAndFormBlocks: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', 'x-uid': '3h8z0005y9o', 'x-async': false, 'x-index': 1, @@ -1976,7 +1976,7 @@ export const oneTableBlockWithActionsAndFormBlocks: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'CreateFormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -2127,7 +2127,7 @@ export const oneTableBlockWithActionsAndFormBlocks: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CusomeizeCreateFormBlockInitializers', + 'x-initializer': 'popup:addRecord:addBlock', properties: { vdhd3r5uw3r: { _isJSONSchemaObject: true, @@ -2173,7 +2173,7 @@ export const oneTableBlockWithActionsAndFormBlocks: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', 'x-uid': 'kin1do2rmxl', 'x-async': false, 'x-index': 1, @@ -2182,7 +2182,7 @@ export const oneTableBlockWithActionsAndFormBlocks: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'FormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -2248,7 +2248,7 @@ export const oneTableBlockWithActionsAndFormBlocks: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -2267,7 +2267,7 @@ export const oneTableBlockWithActionsAndFormBlocks: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -2327,7 +2327,7 @@ export const oneTableBlockWithActionsAndFormBlocks: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { tg0zrjeg91v: { _isJSONSchemaObject: true, @@ -2372,8 +2372,7 @@ export const oneTableBlockWithActionsAndFormBlocks: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': - 'ReadPrettyFormActionInitializers', + 'x-initializer': 'details:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -2389,8 +2388,7 @@ export const oneTableBlockWithActionsAndFormBlocks: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': - 'ReadPrettyFormItemInitializers', + 'x-initializer': 'details:configureFields', 'x-uid': 'cbavg5h8yd3', 'x-async': false, 'x-index': 2, @@ -2489,7 +2487,7 @@ export const oneTableBlockWithActionsAndFormBlocks: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { kvt96oyiaij: { _isJSONSchemaObject: true, @@ -2537,7 +2535,7 @@ export const oneTableBlockWithActionsAndFormBlocks: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', 'x-uid': 'mlnbbyffhjc', 'x-async': false, 'x-index': 1, @@ -2546,7 +2544,7 @@ export const oneTableBlockWithActionsAndFormBlocks: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'UpdateFormActionInitializers', + 'x-initializer': 'editForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -2662,7 +2660,7 @@ export const oneEmptyTableBlockWithCustomizeActions: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', 'x-index': 1, properties: { '1m4gz110aaw': { @@ -2703,7 +2701,7 @@ export const oneEmptyTableBlockWithCustomizeActions: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -2765,7 +2763,7 @@ export const oneEmptyTableBlockWithCustomizeActions: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BulkEditBlockInitializers', + 'x-initializer': 'popup:bulkEdit:addBlock', 'x-uid': '3gjmo60w4de', 'x-async': false, 'x-index': 1, @@ -2799,7 +2797,7 @@ export const oneEmptyTableBlockWithCustomizeActions: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -2818,7 +2816,7 @@ export const oneEmptyTableBlockWithCustomizeActions: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -2884,7 +2882,7 @@ export const oneFormBlockWithRolesFieldBasedUsers: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', 'x-index': 1, properties: { f998lh2qg2h: { @@ -2930,7 +2928,7 @@ export const oneFormBlockWithRolesFieldBasedUsers: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { '91d8jzkh9r5': { _isJSONSchemaObject: true, @@ -2973,7 +2971,7 @@ export const oneFormBlockWithRolesFieldBasedUsers: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'TableSelectorInitializers', + 'x-initializer': 'popup:tableSelector:addBlock', 'x-uid': 'lzt548tlewj', 'x-async': false, 'x-index': 1, @@ -3044,7 +3042,7 @@ export const oneFormBlockWithRolesFieldBasedUsers: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'FormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -3102,7 +3100,7 @@ export const oneFormBlockWithAllAssociationFieldsAndSelectorMode: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { f3fq1mwccgr: { _isJSONSchemaObject: true, @@ -3147,7 +3145,7 @@ export const oneFormBlockWithAllAssociationFieldsAndSelectorMode: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { '7dnk9dcjavn': { _isJSONSchemaObject: true, @@ -3190,7 +3188,7 @@ export const oneFormBlockWithAllAssociationFieldsAndSelectorMode: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'TableSelectorInitializers', + 'x-initializer': 'popup:tableSelector:addBlock', 'x-uid': 'dge1apckyd3', 'x-async': false, 'x-index': 1, @@ -3293,7 +3291,7 @@ export const oneFormBlockWithAllAssociationFieldsAndSelectorMode: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'TableSelectorInitializers', + 'x-initializer': 'popup:tableSelector:addBlock', 'x-uid': 'k6nd50abevi', 'x-async': false, 'x-index': 1, @@ -3396,7 +3394,7 @@ export const oneFormBlockWithAllAssociationFieldsAndSelectorMode: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'TableSelectorInitializers', + 'x-initializer': 'popup:tableSelector:addBlock', 'x-uid': '2i6td26ppt2', 'x-async': false, 'x-index': 1, @@ -3499,7 +3497,7 @@ export const oneFormBlockWithAllAssociationFieldsAndSelectorMode: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'TableSelectorInitializers', + 'x-initializer': 'popup:tableSelector:addBlock', 'x-uid': 'zlj99lap4yq', 'x-async': false, 'x-index': 1, @@ -3602,7 +3600,7 @@ export const oneFormBlockWithAllAssociationFieldsAndSelectorMode: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'TableSelectorInitializers', + 'x-initializer': 'popup:tableSelector:addBlock', 'x-uid': 'ssclmlysxxl', 'x-async': false, 'x-index': 1, @@ -3673,7 +3671,7 @@ export const oneFormBlockWithAllAssociationFieldsAndSelectorMode: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'FormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -3733,7 +3731,7 @@ export const oneDetailBlockWithM2oFieldToGeneral: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { '40g1gedv1hg': { _isJSONSchemaObject: true, @@ -3780,7 +3778,7 @@ export const oneDetailBlockWithM2oFieldToGeneral: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'DetailsActionInitializers', + 'x-initializer': 'detailsWithPaging:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -3796,7 +3794,7 @@ export const oneDetailBlockWithM2oFieldToGeneral: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'ReadPrettyFormItemInitializers', + 'x-initializer': 'details:configureFields', properties: { rp7rbwiym41: { _isJSONSchemaObject: true, @@ -3902,7 +3900,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndBasicFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { '2i2th7yfrlz': { _isJSONSchemaObject: true, @@ -3942,7 +3940,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndBasicFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -4003,7 +4001,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndBasicFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', properties: { '7soqvrflnps': { _isJSONSchemaObject: true, @@ -4048,7 +4046,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndBasicFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { s251k4sz6zy: { _isJSONSchemaObject: true, @@ -4449,7 +4447,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndBasicFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'CreateFormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -4537,7 +4535,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndBasicFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -4556,7 +4554,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndBasicFields: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -4616,7 +4614,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndBasicFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { '1yv7y62q3u0': { _isJSONSchemaObject: true, @@ -4661,8 +4659,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndBasicFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': - 'ReadPrettyFormActionInitializers', + 'x-initializer': 'details:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -4719,7 +4716,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndBasicFields: PageConfig = { type: 'void', 'x-component': 'Grid', 'x-initializer': - 'RecordBlockInitializers', + 'popup:common:addBlock', 'x-uid': 'dz4i8jw4kqz', 'x-async': false, 'x-index': 1, @@ -4754,8 +4751,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndBasicFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': - 'ReadPrettyFormItemInitializers', + 'x-initializer': 'details:configureFields', properties: { kdxsyya4m45: { _isJSONSchemaObject: true, @@ -5255,7 +5251,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndBasicFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { cw6dlprjcwy: { _isJSONSchemaObject: true, @@ -5303,7 +5299,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndBasicFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { '9uqlmdu75wk': { _isJSONSchemaObject: true, @@ -5713,7 +5709,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndBasicFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'UpdateFormActionInitializers', + 'x-initializer': 'editForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -5871,7 +5867,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndBasicFieldsAndSubTable: Pag version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { mbtse8e9kap: { _isJSONSchemaObject: true, @@ -5911,7 +5907,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndBasicFieldsAndSubTable: Pag _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -5926,7 +5922,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndBasicFieldsAndSubTable: Pag _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -5945,7 +5941,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndBasicFieldsAndSubTable: Pag 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -6007,7 +6003,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndBasicFieldsAndSubTable: Pag version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { trny88kf0bk: { _isJSONSchemaObject: true, @@ -6055,7 +6051,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndBasicFieldsAndSubTable: Pag version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { '7mwkv9h74ki': { _isJSONSchemaObject: true, @@ -6090,7 +6086,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndBasicFieldsAndSubTable: Pag 'x-component': 'AssociationField.SubTable', 'x-initializer': - 'TableColumnInitializers', + 'table:configureColumns', 'x-initializer-props': { action: false, }, @@ -6162,7 +6158,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndBasicFieldsAndSubTable: Pag _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'UpdateFormActionInitializers', + 'x-initializer': 'editForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -6280,7 +6276,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndChoicesFields: PageConfig = version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { bjxj2sjr36f: { _isJSONSchemaObject: true, @@ -6320,7 +6316,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndChoicesFields: PageConfig = _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -6381,7 +6377,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndChoicesFields: PageConfig = version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', properties: { xgwlijx7tl0: { _isJSONSchemaObject: true, @@ -6426,7 +6422,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndChoicesFields: PageConfig = version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { '0k83zkmy257': { _isJSONSchemaObject: true, @@ -6661,7 +6657,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndChoicesFields: PageConfig = _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'CreateFormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -6749,7 +6745,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndChoicesFields: PageConfig = _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -6768,7 +6764,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndChoicesFields: PageConfig = 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -6830,7 +6826,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndChoicesFields: PageConfig = version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { '1xwjbso8iwl': { _isJSONSchemaObject: true, @@ -6875,8 +6871,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndChoicesFields: PageConfig = _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': - 'ReadPrettyFormActionInitializers', + 'x-initializer': 'details:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -6933,7 +6928,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndChoicesFields: PageConfig = type: 'void', 'x-component': 'Grid', 'x-initializer': - 'RecordBlockInitializers', + 'popup:common:addBlock', 'x-uid': 'wbrtmx39s4q', 'x-async': false, 'x-index': 1, @@ -6968,8 +6963,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndChoicesFields: PageConfig = version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': - 'ReadPrettyFormItemInitializers', + 'x-initializer': 'details:configureFields', properties: { u1uz4vfwcd7: { _isJSONSchemaObject: true, @@ -7294,7 +7288,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndChoicesFields: PageConfig = version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { t2x4eztgl9z: { _isJSONSchemaObject: true, @@ -7342,7 +7336,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndChoicesFields: PageConfig = version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { lq1mdgniw87: { _isJSONSchemaObject: true, @@ -7577,7 +7571,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndChoicesFields: PageConfig = _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'UpdateFormActionInitializers', + 'x-initializer': 'editForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -7717,7 +7711,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndMediaFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { kworhysix0k: { _isJSONSchemaObject: true, @@ -7757,7 +7751,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndMediaFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -7818,7 +7812,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndMediaFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', properties: { q5fy0fkcotq: { _isJSONSchemaObject: true, @@ -7863,7 +7857,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndMediaFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { j8pqhlswvky: { _isJSONSchemaObject: true, @@ -7981,7 +7975,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndMediaFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'CreateFormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -8069,7 +8063,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndMediaFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -8088,7 +8082,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndMediaFields: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -8150,7 +8144,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndMediaFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { rqr8ymho8qk: { _isJSONSchemaObject: true, @@ -8195,8 +8189,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndMediaFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': - 'ReadPrettyFormActionInitializers', + 'x-initializer': 'details:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -8253,7 +8246,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndMediaFields: PageConfig = { type: 'void', 'x-component': 'Grid', 'x-initializer': - 'RecordBlockInitializers', + 'popup:common:addBlock', 'x-uid': 'nzgpjel7gnt', 'x-async': false, 'x-index': 1, @@ -8288,8 +8281,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndMediaFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': - 'ReadPrettyFormItemInitializers', + 'x-initializer': 'details:configureFields', properties: { gm9h65g0rrf: { _isJSONSchemaObject: true, @@ -8500,7 +8492,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndMediaFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { i0qbr8outk2: { _isJSONSchemaObject: true, @@ -8548,7 +8540,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndMediaFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { dho8aesxv5r: { _isJSONSchemaObject: true, @@ -8669,7 +8661,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndMediaFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'UpdateFormActionInitializers', + 'x-initializer': 'editForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -8809,7 +8801,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndDatetimeFields: PageConfig version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { '0wtvsmu7fgy': { _isJSONSchemaObject: true, @@ -8849,7 +8841,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndDatetimeFields: PageConfig _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -8910,7 +8902,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndDatetimeFields: PageConfig version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', properties: { '54z7u3t354f': { _isJSONSchemaObject: true, @@ -8955,7 +8947,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndDatetimeFields: PageConfig version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { '9tn7mmv6q2j': { _isJSONSchemaObject: true, @@ -9036,7 +9028,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndDatetimeFields: PageConfig _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'CreateFormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -9124,7 +9116,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndDatetimeFields: PageConfig _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -9143,7 +9135,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndDatetimeFields: PageConfig 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -9205,7 +9197,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndDatetimeFields: PageConfig version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { '5oesm2w11p1': { _isJSONSchemaObject: true, @@ -9250,8 +9242,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndDatetimeFields: PageConfig _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': - 'ReadPrettyFormActionInitializers', + 'x-initializer': 'details:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -9308,7 +9299,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndDatetimeFields: PageConfig type: 'void', 'x-component': 'Grid', 'x-initializer': - 'RecordBlockInitializers', + 'popup:common:addBlock', 'x-uid': 'o61euxh6r2l', 'x-async': false, 'x-index': 1, @@ -9343,8 +9334,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndDatetimeFields: PageConfig version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': - 'ReadPrettyFormItemInitializers', + 'x-initializer': 'details:configureFields', properties: { f88bpjnnp8b: { _isJSONSchemaObject: true, @@ -9517,7 +9507,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndDatetimeFields: PageConfig version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { itbs2k3vnwh: { _isJSONSchemaObject: true, @@ -9565,7 +9555,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndDatetimeFields: PageConfig version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { nx1dw628ww8: { _isJSONSchemaObject: true, @@ -9648,7 +9638,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndDatetimeFields: PageConfig _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'UpdateFormActionInitializers', + 'x-initializer': 'editForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -9788,7 +9778,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAssociationFields: PageConf version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { '31trec6eh60': { _isJSONSchemaObject: true, @@ -9828,7 +9818,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAssociationFields: PageConf _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -9889,7 +9879,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAssociationFields: PageConf version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', properties: { '8yo09nilrra': { _isJSONSchemaObject: true, @@ -9934,7 +9924,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAssociationFields: PageConf version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { '08iltavqcsw': { _isJSONSchemaObject: true, @@ -10122,7 +10112,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAssociationFields: PageConf _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'CreateFormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -10210,7 +10200,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAssociationFields: PageConf _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -10229,7 +10219,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAssociationFields: PageConf 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -10291,7 +10281,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAssociationFields: PageConf version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { '53lam282m0w': { _isJSONSchemaObject: true, @@ -10336,8 +10326,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAssociationFields: PageConf _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': - 'ReadPrettyFormActionInitializers', + 'x-initializer': 'details:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -10394,7 +10383,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAssociationFields: PageConf type: 'void', 'x-component': 'Grid', 'x-initializer': - 'RecordBlockInitializers', + 'popup:common:addBlock', 'x-uid': 'vgnlbwsjqbx', 'x-async': false, 'x-index': 1, @@ -10429,8 +10418,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAssociationFields: PageConf version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': - 'ReadPrettyFormItemInitializers', + 'x-initializer': 'details:configureFields', properties: { ee8my5o19ku: { _isJSONSchemaObject: true, @@ -10711,7 +10699,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAssociationFields: PageConf version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { ik4xkal0fk3: { _isJSONSchemaObject: true, @@ -10759,7 +10747,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAssociationFields: PageConf version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { '5rcq2dnzpvl': { _isJSONSchemaObject: true, @@ -10950,7 +10938,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAssociationFields: PageConf _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'UpdateFormActionInitializers', + 'x-initializer': 'editForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -11086,7 +11074,7 @@ export const oneFilterFormBlockWithAllAssociationFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { oogm3hoka7c: { _isJSONSchemaObject: true, @@ -11128,7 +11116,7 @@ export const oneFilterFormBlockWithAllAssociationFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FilterFormItemInitializers', + 'x-initializer': 'filterForm:configureFields', properties: { y5gw4zxp20e: { _isJSONSchemaObject: true, @@ -11349,7 +11337,7 @@ export const oneFilterFormBlockWithAllAssociationFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'FilterFormActionInitializers', + 'x-initializer': 'filterForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -11413,7 +11401,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAdvancedFields: PageConfig version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { jp9qjk95sgp: { _isJSONSchemaObject: true, @@ -11453,7 +11441,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAdvancedFields: PageConfig _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -11514,7 +11502,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAdvancedFields: PageConfig version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', properties: { jykx4mc4tan: { _isJSONSchemaObject: true, @@ -11559,7 +11547,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAdvancedFields: PageConfig version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { o59i5tuhrf9: { _isJSONSchemaObject: true, @@ -11717,7 +11705,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAdvancedFields: PageConfig _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'CreateFormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -11805,7 +11793,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAdvancedFields: PageConfig _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -11824,7 +11812,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAdvancedFields: PageConfig 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -11886,7 +11874,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAdvancedFields: PageConfig version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { '1sdc9mt382r': { _isJSONSchemaObject: true, @@ -11931,8 +11919,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAdvancedFields: PageConfig _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': - 'ReadPrettyFormActionInitializers', + 'x-initializer': 'details:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -11989,7 +11976,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAdvancedFields: PageConfig type: 'void', 'x-component': 'Grid', 'x-initializer': - 'RecordBlockInitializers', + 'popup:common:addBlock', 'x-uid': 'hku8pm0hkmc', 'x-async': false, 'x-index': 1, @@ -12024,8 +12011,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAdvancedFields: PageConfig version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': - 'ReadPrettyFormItemInitializers', + 'x-initializer': 'details:configureFields', properties: { '7243zv6k16f': { _isJSONSchemaObject: true, @@ -12277,7 +12263,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAdvancedFields: PageConfig version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { '873tavkmkob': { _isJSONSchemaObject: true, @@ -12325,7 +12311,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAdvancedFields: PageConfig version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { q4u8z9fymes: { _isJSONSchemaObject: true, @@ -12487,7 +12473,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndAdvancedFields: PageConfig _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'UpdateFormActionInitializers', + 'x-initializer': 'editForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -12627,7 +12613,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndSystemInfoFields: PageConfi version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { epqxqgug6qx: { _isJSONSchemaObject: true, @@ -12667,7 +12653,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndSystemInfoFields: PageConfi _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -12728,7 +12714,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndSystemInfoFields: PageConfi version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', properties: { zmbofsdker4: { _isJSONSchemaObject: true, @@ -12773,7 +12759,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndSystemInfoFields: PageConfi version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { f6yjc0sfg5k: { _isJSONSchemaObject: true, @@ -12905,7 +12891,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndSystemInfoFields: PageConfi type: 'void', 'x-component': 'Grid', 'x-initializer': - 'RecordBlockInitializers', + 'popup:common:addBlock', 'x-uid': 'i4pbty5jkhr', 'x-async': false, 'x-index': 1, @@ -12997,7 +12983,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndSystemInfoFields: PageConfi type: 'void', 'x-component': 'Grid', 'x-initializer': - 'RecordBlockInitializers', + 'popup:common:addBlock', 'x-uid': 'ofz5idx9716', 'x-async': false, 'x-index': 1, @@ -13113,7 +13099,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndSystemInfoFields: PageConfi _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'CreateFormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -13201,7 +13187,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndSystemInfoFields: PageConfi _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -13220,7 +13206,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndSystemInfoFields: PageConfi 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -13282,7 +13268,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndSystemInfoFields: PageConfi version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { '5g4hlzrrkbh': { _isJSONSchemaObject: true, @@ -13327,8 +13313,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndSystemInfoFields: PageConfi _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': - 'ReadPrettyFormActionInitializers', + 'x-initializer': 'details:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -13385,7 +13370,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndSystemInfoFields: PageConfi type: 'void', 'x-component': 'Grid', 'x-initializer': - 'RecordBlockInitializers', + 'popup:common:addBlock', 'x-uid': '5v2mpey52su', 'x-async': false, 'x-index': 1, @@ -13420,8 +13405,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndSystemInfoFields: PageConfi version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': - 'ReadPrettyFormItemInitializers', + 'x-initializer': 'details:configureFields', properties: { qe2nm5ot23c: { _isJSONSchemaObject: true, @@ -13562,7 +13546,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndSystemInfoFields: PageConfi 'x-component': 'Grid', 'x-initializer': - 'RecordBlockInitializers', + 'popup:common:addBlock', 'x-uid': 'eno5ymv0s21', 'x-async': false, @@ -13663,7 +13647,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndSystemInfoFields: PageConfi 'x-component': 'Grid', 'x-initializer': - 'RecordBlockInitializers', + 'popup:common:addBlock', 'x-uid': 'cpoo628xa2y', 'x-async': false, @@ -13871,7 +13855,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndSystemInfoFields: PageConfi version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { f4262c4203q: { _isJSONSchemaObject: true, @@ -13919,7 +13903,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndSystemInfoFields: PageConfi version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { fr6gmmxwxm6: { _isJSONSchemaObject: true, @@ -14060,7 +14044,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndSystemInfoFields: PageConfi 'x-component': 'Grid', 'x-initializer': - 'RecordBlockInitializers', + 'popup:common:addBlock', 'x-uid': 'y3qxvvkexzc', 'x-async': false, @@ -14161,7 +14145,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndSystemInfoFields: PageConfi 'x-component': 'Grid', 'x-initializer': - 'RecordBlockInitializers', + 'popup:common:addBlock', 'x-uid': '8voz33qzsh8', 'x-async': false, @@ -14279,7 +14263,7 @@ export const oneTableBlockWithAddNewAndViewAndEditAndSystemInfoFields: PageConfi _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'UpdateFormActionInitializers', + 'x-initializer': 'editForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -14412,7 +14396,7 @@ export const oneEmptyTableWithTreeCollection: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { tt9ipsm1wb7: { _isJSONSchemaObject: true, @@ -14452,7 +14436,7 @@ export const oneEmptyTableWithTreeCollection: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -14467,7 +14451,7 @@ export const oneEmptyTableWithTreeCollection: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -14486,7 +14470,7 @@ export const oneEmptyTableWithTreeCollection: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -14550,7 +14534,7 @@ export const oneEmptyMarkdown: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { eocwxdkmped: { _isJSONSchemaObject: true, @@ -14620,7 +14604,7 @@ export const oneCollapseAndOneTableWithSameCollection: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { xxnsq3r1w5u: { _isJSONSchemaObject: true, @@ -14735,7 +14719,7 @@ export const oneCollapseAndOneTableWithSameCollection: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -14750,7 +14734,7 @@ export const oneCollapseAndOneTableWithSameCollection: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -14844,7 +14828,7 @@ export const oneFormWithMultiLevelAssociationFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { djjvozyzzha: { _isJSONSchemaObject: true, @@ -14889,7 +14873,7 @@ export const oneFormWithMultiLevelAssociationFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { grgso6wba2b: { _isJSONSchemaObject: true, @@ -15015,7 +14999,7 @@ export const oneFormWithMultiLevelAssociationFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'FormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -15098,7 +15082,7 @@ export const oneSubformWithMultiLevelAssociationFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { mxqswxl18hb: { _isJSONSchemaObject: true, @@ -15143,7 +15127,7 @@ export const oneSubformWithMultiLevelAssociationFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { '6k12v33b6j3': { _isJSONSchemaObject: true, @@ -15183,7 +15167,7 @@ export const oneSubformWithMultiLevelAssociationFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { '9c4mwdnt1kf': { _isJSONSchemaObject: true, @@ -15332,7 +15316,7 @@ export const oneSubformWithMultiLevelAssociationFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'FormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -15415,7 +15399,7 @@ export const oneTableSubformWithMultiLevelAssociationFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { spt3dncqt6g: { _isJSONSchemaObject: true, @@ -15455,7 +15439,7 @@ export const oneTableSubformWithMultiLevelAssociationFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -15516,7 +15500,7 @@ export const oneTableSubformWithMultiLevelAssociationFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', 'x-uid': 'ezrqm7whaxk', 'x-async': false, 'x-index': 1, @@ -15550,7 +15534,7 @@ export const oneTableSubformWithMultiLevelAssociationFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -15569,7 +15553,7 @@ export const oneTableSubformWithMultiLevelAssociationFields: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -15631,7 +15615,7 @@ export const oneTableSubformWithMultiLevelAssociationFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { rxh2yo159ct: { _isJSONSchemaObject: true, @@ -15676,8 +15660,7 @@ export const oneTableSubformWithMultiLevelAssociationFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': - 'ReadPrettyFormActionInitializers', + 'x-initializer': 'details:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -15693,8 +15676,7 @@ export const oneTableSubformWithMultiLevelAssociationFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': - 'ReadPrettyFormItemInitializers', + 'x-initializer': 'details:configureFields', properties: { h091lw5s3ot: { _isJSONSchemaObject: true, @@ -15772,7 +15754,7 @@ export const oneTableSubformWithMultiLevelAssociationFields: PageConfig = { type: 'void', 'x-component': 'Grid', 'x-initializer': - 'FormItemInitializers', + 'form:configureFields', properties: { '7gni7kgrxc6': { _isJSONSchemaObject: @@ -15880,7 +15862,7 @@ export const oneTableSubformWithMultiLevelAssociationFields: PageConfig = { 'x-component': 'Grid', 'x-initializer': - 'FormItemInitializers', + 'form:configureFields', properties: { wfis8uozy45: @@ -16009,7 +15991,7 @@ export const oneTableSubformWithMultiLevelAssociationFields: PageConfig = { 'x-component': 'Grid', 'x-initializer': - 'FormItemInitializers', + 'form:configureFields', properties: { '8ga4k036hkh': @@ -16314,7 +16296,7 @@ export const oneTableSubformWithMultiLevelAssociationFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { scqusdl60dp: { _isJSONSchemaObject: true, @@ -16362,7 +16344,7 @@ export const oneTableSubformWithMultiLevelAssociationFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { row_x1kzwaop93e: { _isJSONSchemaObject: true, @@ -16440,7 +16422,7 @@ export const oneTableSubformWithMultiLevelAssociationFields: PageConfig = { type: 'void', 'x-component': 'Grid', 'x-initializer': - 'FormItemInitializers', + 'form:configureFields', properties: { '0o134mwdmzm': { _isJSONSchemaObject: @@ -16548,7 +16530,7 @@ export const oneTableSubformWithMultiLevelAssociationFields: PageConfig = { 'x-component': 'Grid', 'x-initializer': - 'FormItemInitializers', + 'form:configureFields', properties: { '2eg7xlliyk0': @@ -16677,7 +16659,7 @@ export const oneTableSubformWithMultiLevelAssociationFields: PageConfig = { 'x-component': 'Grid', 'x-initializer': - 'FormItemInitializers', + 'form:configureFields', properties: { wca260ji2ih: @@ -16806,7 +16788,7 @@ export const oneTableSubformWithMultiLevelAssociationFields: PageConfig = { 'x-component': 'Grid', 'x-initializer': - 'FormItemInitializers', + 'form:configureFields', properties: { '9xq8mnnzyrw': @@ -16994,7 +16976,7 @@ export const oneTableSubformWithMultiLevelAssociationFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'UpdateFormActionInitializers', + 'x-initializer': 'editForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -17131,7 +17113,7 @@ export const oneTableSubtableWithMultiLevelAssociationFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { vp7c9oaymjr: { _isJSONSchemaObject: true, @@ -17171,7 +17153,7 @@ export const oneTableSubtableWithMultiLevelAssociationFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -17232,7 +17214,7 @@ export const oneTableSubtableWithMultiLevelAssociationFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', 'x-uid': 'hhhjt2axsd2', 'x-async': false, 'x-index': 1, @@ -17266,7 +17248,7 @@ export const oneTableSubtableWithMultiLevelAssociationFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -17285,7 +17267,7 @@ export const oneTableSubtableWithMultiLevelAssociationFields: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -17347,7 +17329,7 @@ export const oneTableSubtableWithMultiLevelAssociationFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { qd1exa12t8i: { _isJSONSchemaObject: true, @@ -17392,8 +17374,7 @@ export const oneTableSubtableWithMultiLevelAssociationFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': - 'ReadPrettyFormActionInitializers', + 'x-initializer': 'details:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -17450,7 +17431,7 @@ export const oneTableSubtableWithMultiLevelAssociationFields: PageConfig = { type: 'void', 'x-component': 'Grid', 'x-initializer': - 'RecordBlockInitializers', + 'popup:common:addBlock', 'x-uid': 'y94je87dtvs', 'x-async': false, 'x-index': 1, @@ -17485,8 +17466,7 @@ export const oneTableSubtableWithMultiLevelAssociationFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': - 'ReadPrettyFormItemInitializers', + 'x-initializer': 'details:configureFields', properties: { czwqhu0r4kn: { _isJSONSchemaObject: true, @@ -17557,7 +17537,7 @@ export const oneTableSubtableWithMultiLevelAssociationFields: PageConfig = { 'x-component': 'AssociationField.SubTable', 'x-initializer': - 'TableColumnInitializers', + 'table:configureColumns', 'x-initializer-props': { action: false, }, @@ -17658,7 +17638,7 @@ export const oneTableSubtableWithMultiLevelAssociationFields: PageConfig = { type: 'void', 'x-component': 'Grid', 'x-initializer': - 'FormItemInitializers', + 'form:configureFields', 'x-uid': 'gf8iixoigrh', 'x-async': false, 'x-index': 1, @@ -17780,7 +17760,7 @@ export const oneTableSubtableWithMultiLevelAssociationFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { a7fabwj9osd: { _isJSONSchemaObject: true, @@ -17828,7 +17808,7 @@ export const oneTableSubtableWithMultiLevelAssociationFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { beh7yt0xrkh: { _isJSONSchemaObject: true, @@ -17899,7 +17879,7 @@ export const oneTableSubtableWithMultiLevelAssociationFields: PageConfig = { 'x-component': 'AssociationField.SubTable', 'x-initializer': - 'TableColumnInitializers', + 'table:configureColumns', 'x-initializer-props': { action: false, }, @@ -18008,7 +17988,7 @@ export const oneTableSubtableWithMultiLevelAssociationFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'UpdateFormActionInitializers', + 'x-initializer': 'editForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -18145,7 +18125,7 @@ export const formBlockDefaultValueTemplate: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { i7hhy9qt3vm: { _isJSONSchemaObject: true, @@ -18185,7 +18165,7 @@ export const formBlockDefaultValueTemplate: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -18246,7 +18226,7 @@ export const formBlockDefaultValueTemplate: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', properties: { ec8k6t8hyfd: { _isJSONSchemaObject: true, @@ -18291,7 +18271,7 @@ export const formBlockDefaultValueTemplate: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { '11k61q066eh': { _isJSONSchemaObject: true, @@ -18375,7 +18355,7 @@ export const formBlockDefaultValueTemplate: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'CreateFormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -18441,7 +18421,7 @@ export const formBlockDefaultValueTemplate: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -18460,7 +18440,7 @@ export const formBlockDefaultValueTemplate: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -18522,7 +18502,7 @@ export const formBlockDefaultValueTemplate: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', 'x-uid': '6k8q5pvnbjg', 'x-async': false, 'x-index': 1, @@ -18596,7 +18576,7 @@ export const formBlockDefaultValueTemplate: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', 'x-uid': 'yqsyvw7utn4', 'x-async': false, 'x-index': 1, @@ -18678,7 +18658,7 @@ export const oneFormBlockBasedOnUsers: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { skmxkfr67em: { _isJSONSchemaObject: true, @@ -18723,7 +18703,7 @@ export const oneFormBlockBasedOnUsers: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', 'x-uid': '66dozhzo5ld', 'x-async': false, 'x-index': 1, @@ -18732,7 +18712,7 @@ export const oneFormBlockBasedOnUsers: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'FormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -18793,7 +18773,7 @@ export const oneFormAndOneTableWithSameCollection: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { '0qplm51g52v': { _isJSONSchemaObject: true, @@ -18835,7 +18815,7 @@ export const oneFormAndOneTableWithSameCollection: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FilterFormItemInitializers', + 'x-initializer': 'filterForm:configureFields', properties: { '0k8y0nlffht': { _isJSONSchemaObject: true, @@ -18882,7 +18862,7 @@ export const oneFormAndOneTableWithSameCollection: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'FilterFormActionInitializers', + 'x-initializer': 'filterForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', @@ -18986,7 +18966,7 @@ export const oneFormAndOneTableWithSameCollection: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -19001,7 +18981,7 @@ export const oneFormAndOneTableWithSameCollection: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -19095,7 +19075,7 @@ export const twoTabsPage = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', title: 'tab 1', 'x-async': false, 'x-index': 1, @@ -19106,7 +19086,7 @@ export const twoTabsPage = { type: 'void', title: 'tab 2', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', 'x-uid': 'o5vp90rqsjx', 'x-async': false, 'x-index': 2, @@ -19133,7 +19113,7 @@ export const twoTableWithSameCollection: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { jkcte869qpa: { _isJSONSchemaObject: true, @@ -19177,7 +19157,7 @@ export const twoTableWithSameCollection: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -19192,7 +19172,7 @@ export const twoTableWithSameCollection: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -19285,7 +19265,7 @@ export const twoTableWithSameCollection: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -19300,7 +19280,7 @@ export const twoTableWithSameCollection: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -19397,7 +19377,7 @@ export const twoTableWithAssociationFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { qtp19qlje2y: { _isJSONSchemaObject: true, @@ -19442,7 +19422,7 @@ export const twoTableWithAssociationFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -19457,7 +19437,7 @@ export const twoTableWithAssociationFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -19549,7 +19529,7 @@ export const twoTableWithAssociationFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -19564,7 +19544,7 @@ export const twoTableWithAssociationFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -19667,7 +19647,7 @@ export const oneEmptyTableBlockBasedOnUsers = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { vduni5v1u2v: { _isJSONSchemaObject: true, @@ -19707,7 +19687,7 @@ export const oneEmptyTableBlockBasedOnUsers = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -19722,7 +19702,7 @@ export const oneEmptyTableBlockBasedOnUsers = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -19741,7 +19721,7 @@ export const oneEmptyTableBlockBasedOnUsers = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -19820,7 +19800,7 @@ export const checkboxForTableRow = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { w85tu6tnlfp: { _isJSONSchemaObject: true, @@ -19860,7 +19840,7 @@ export const checkboxForTableRow = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -19903,7 +19883,7 @@ export const checkboxForTableRow = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -19922,7 +19902,7 @@ export const checkboxForTableRow = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, diff --git a/packages/plugins/@nocobase/plugin-acl/src/client/__e2e__/utils.ts b/packages/plugins/@nocobase/plugin-acl/src/client/__e2e__/utils.ts index 216e4e0f1..d61e9c282 100644 --- a/packages/plugins/@nocobase/plugin-acl/src/client/__e2e__/utils.ts +++ b/packages/plugins/@nocobase/plugin-acl/src/client/__e2e__/utils.ts @@ -14,7 +14,7 @@ export const oneTableBlock: PageConfig = { type: 'void', version: '2.0', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', _isJSONSchemaObject: true, properties: { hxf5h572bwc: { @@ -56,7 +56,7 @@ export const oneTableBlock: PageConfig = { type: 'void', version: '2.0', 'x-component': 'ActionBar', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component-props': { style: { marginBottom: 'var(--nb-spacing)', @@ -116,7 +116,7 @@ export const oneTableBlock: PageConfig = { type: 'void', version: '2.0', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', _isJSONSchemaObject: true, properties: { f3q7xmyiyl4: { @@ -161,7 +161,7 @@ export const oneTableBlock: PageConfig = { type: 'void', version: '2.0', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', _isJSONSchemaObject: true, properties: { ddz3kqt5kpf: { @@ -240,7 +240,7 @@ export const oneTableBlock: PageConfig = { version: '2.0', 'x-component': 'Grid', 'x-initializer': - 'FormItemInitializers', + 'form:configureFields', _isJSONSchemaObject: true, properties: { yhxqnl03mak: { @@ -435,7 +435,7 @@ export const oneTableBlock: PageConfig = { type: 'void', version: '2.0', 'x-component': 'ActionBar', - 'x-initializer': 'CreateFormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component-props': { style: { marginTop: 24, @@ -767,7 +767,7 @@ export const oneTableBlock: PageConfig = { type: 'array', version: '2.0', 'x-component': 'TableV2', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component-props': { rowKey: 'id', useProps: '{{ useTableBlockProps }}', @@ -785,7 +785,7 @@ export const oneTableBlock: PageConfig = { 'x-designer': 'TableV2.ActionColumnDesigner', 'x-component': 'TableV2.Column', 'x-decorator': 'TableV2.Column.ActionBar', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', 'x-action-column': 'actions', 'x-component-props': { width: 400, @@ -850,7 +850,7 @@ export const oneTableBlock: PageConfig = { type: 'void', version: '2.0', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', _isJSONSchemaObject: true, properties: { yyehsjjoo8e: { @@ -898,7 +898,7 @@ export const oneTableBlock: PageConfig = { type: 'void', version: '2.0', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', _isJSONSchemaObject: true, properties: { q3s02k44o3o: { @@ -1054,7 +1054,7 @@ export const oneTableBlock: PageConfig = { type: 'void', version: '2.0', 'x-component': 'ActionBar', - 'x-initializer': 'UpdateFormActionInitializers', + 'x-initializer': 'editForm:configureActions', 'x-component-props': { style: { marginTop: 24, @@ -1180,7 +1180,7 @@ export const oneTableBlock: PageConfig = { type: 'void', version: '2.0', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', _isJSONSchemaObject: true, 'x-uid': '9be5zlgowvl', 'x-async': false, @@ -1254,7 +1254,7 @@ export const oneTableBlock: PageConfig = { type: 'void', version: '2.0', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', _isJSONSchemaObject: true, properties: { pk40wwnw0cp: { @@ -1302,7 +1302,7 @@ export const oneTableBlock: PageConfig = { type: 'void', version: '2.0', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', _isJSONSchemaObject: true, properties: { '7043nizntd8': { @@ -1344,7 +1344,7 @@ export const oneTableBlock: PageConfig = { version: '2.0', 'x-component': 'Grid', 'x-initializer': - 'FormItemInitializers', + 'form:configureFields', _isJSONSchemaObject: true, properties: { dtxjb31ls31: { @@ -1739,7 +1739,7 @@ export const oneTableBlock: PageConfig = { type: 'void', version: '2.0', 'x-component': 'ActionBar', - 'x-initializer': 'UpdateFormActionInitializers', + 'x-initializer': 'editForm:configureActions', 'x-component-props': { style: { marginTop: 24, @@ -1843,7 +1843,7 @@ export const oneTableBlock: PageConfig = { type: 'void', version: '2.0', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', _isJSONSchemaObject: true, properties: { h9gq1awpz33: { @@ -1890,8 +1890,7 @@ export const oneTableBlock: PageConfig = { type: 'void', version: '2.0', 'x-component': 'ActionBar', - 'x-initializer': - 'ReadPrettyFormActionInitializers', + 'x-initializer': 'details:configureActions', 'x-component-props': { style: { marginBottom: 24, @@ -1906,8 +1905,7 @@ export const oneTableBlock: PageConfig = { type: 'void', version: '2.0', 'x-component': 'Grid', - 'x-initializer': - 'ReadPrettyFormItemInitializers', + 'x-initializer': 'details:configureFields', _isJSONSchemaObject: true, properties: { hnzs6hajxl8: { diff --git a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditActionInitializer.tsx b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditActionInitializer.tsx index 439ad79db..581a8ed49 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditActionInitializer.tsx +++ b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditActionInitializer.tsx @@ -39,7 +39,7 @@ export const BulkEditActionInitializer = () => { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BulkEditBlockInitializers', + 'x-initializer': 'popup:bulkEdit:addBlock', properties: {}, }, }, diff --git a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditBlockInitializers.tsx b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditBlockInitializers.tsx index 860ce737d..61607416c 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditBlockInitializers.tsx +++ b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditBlockInitializers.tsx @@ -1,4 +1,4 @@ -import { SchemaInitializer, gridRowColWrap } from '@nocobase/client'; +import { CompatibleSchemaInitializer, SchemaInitializer, gridRowColWrap } from '@nocobase/client'; import { CreateFormBulkEditBlockInitializer } from './CreateFormBulkEditBlockInitializer'; /** @@ -38,7 +38,10 @@ export const CreateFormBulkEditBlockInitializers: SchemaInitializer = new Schema ], }); -export const BulkEditBlockInitializers: SchemaInitializer = new SchemaInitializer({ +/** + * @deprecated + */ +export const BulkEditBlockInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'BulkEditBlockInitializers', wrap: gridRowColWrap, title: '{{t("Add block")}}', @@ -70,3 +73,39 @@ export const BulkEditBlockInitializers: SchemaInitializer = new SchemaInitialize }, ], }); + +export const bulkEditBlockInitializers = new CompatibleSchemaInitializer( + { + name: 'popup:bulkEdit:addBlock', + wrap: gridRowColWrap, + title: '{{t("Add block")}}', + icon: 'PlusOutlined', + items: [ + { + type: 'itemGroup', + title: '{{t("Data blocks")}}', + name: 'dataBlocks', + children: [ + { + name: 'form', + title: '{{t("Form")}}', + Component: CreateFormBulkEditBlockInitializer, + }, + ], + }, + { + type: 'itemGroup', + title: '{{t("Other blocks")}}', + name: 'otherBlocks', + children: [ + { + name: 'markdown', + title: '{{t("Markdown")}}', + Component: 'MarkdownBlockInitializer', + }, + ], + }, + ], + }, + BulkEditBlockInitializers_deprecated, +); diff --git a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditFormActionInitializers.tsx b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditFormActionInitializers.tsx index 4158fe8c8..2b5257745 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditFormActionInitializers.tsx +++ b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditFormActionInitializers.tsx @@ -1,6 +1,10 @@ -import { SchemaInitializer } from '@nocobase/client'; +import { CompatibleSchemaInitializer, SchemaInitializer } from '@nocobase/client'; import { BulkEditSubmitActionInitializer } from './BulkEditSubmitActionInitializer'; -export const BulkEditFormActionInitializers = new SchemaInitializer({ + +/** + * @deprecated + */ +export const BulkEditFormActionInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'BulkEditFormActionInitializers', title: '{{t("Configure actions")}}', icon: 'SettingOutlined', @@ -22,3 +26,29 @@ export const BulkEditFormActionInitializers = new SchemaInitializer({ }, ], }); + +export const bulkEditFormActionInitializers = new CompatibleSchemaInitializer( + { + name: 'bulkEditForm:configureActions', + title: '{{t("Configure actions")}}', + icon: 'SettingOutlined', + items: [ + { + type: 'itemGroup', + title: '{{t("Enable actions")}}', + name: 'enableActions', + children: [ + { + name: 'submit', + title: '{{t("Submit")}}', + Component: BulkEditSubmitActionInitializer, + schema: { + 'x-action-settings': {}, + }, + }, + ], + }, + ], + }, + BulkEditFormActionInitializers_deprecated, +); diff --git a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditFormItemInitializers.tsx b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditFormItemInitializers.tsx index 8f3fbd53f..9f42168e4 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditFormItemInitializers.tsx +++ b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditFormItemInitializers.tsx @@ -1,7 +1,10 @@ -import { SchemaInitializer, gridRowColWrap } from '@nocobase/client'; +import { CompatibleSchemaInitializer, gridRowColWrap } from '@nocobase/client'; import { useCustomBulkEditFormItemInitializerFields } from './utils'; -export const BulkEditFormItemInitializers: SchemaInitializer = new SchemaInitializer({ +/** + * @deprecated + */ +export const BulkEditFormItemInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'BulkEditFormItemInitializers', wrap: gridRowColWrap, icon: 'SettingOutlined', @@ -36,3 +39,42 @@ export const BulkEditFormItemInitializers: SchemaInitializer = new SchemaInitial }, ], }); + +export const bulkEditFormItemInitializers = new CompatibleSchemaInitializer( + { + name: 'bulkEditForm:configureFields', + wrap: gridRowColWrap, + icon: 'SettingOutlined', + title: '{{t("Configure fields")}}', + items: [ + { + name: 'displayFields', + type: 'itemGroup', + title: '{{t("Display fields")}}', + useChildren: useCustomBulkEditFormItemInitializerFields, + }, + { + name: 'divider', + type: 'divider', + }, + { + name: 'addText', + title: '{{t("Add text")}}', + Component: 'BlockItemInitializer', + schema: { + type: 'void', + 'x-editable': false, + 'x-decorator': 'FormItem', + // 'x-designer': 'Markdown.Void.Designer', + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:markdown', + 'x-component': 'Markdown.Void', + 'x-component-props': { + content: '{{t("This is a demo text, **supports Markdown syntax**.")}}', + }, + }, + }, + ], + }, + BulkEditFormItemInitializers_deprecated, +); diff --git a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/CreateFormBulkEditBlockInitializer.tsx b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/CreateFormBulkEditBlockInitializer.tsx index 6dab74057..f5afd1b22 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/CreateFormBulkEditBlockInitializer.tsx +++ b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/CreateFormBulkEditBlockInitializer.tsx @@ -27,7 +27,7 @@ export const CreateFormBulkEditBlockInitializer = () => { const s = await getTemplateSchemaByMode(item); if (item.template.componentName === 'FormItem') { const blockSchema = createFormBlockSchema({ - actionInitializers: 'CreateFormActionInitializers', + actionInitializers: 'createForm:configureActions', association, collection: collection.name, dataSource: collection.dataSource, @@ -43,8 +43,8 @@ export const CreateFormBulkEditBlockInitializer = () => { } else { insert( createFormBlockSchema({ - formItemInitializers: 'BulkEditFormItemInitializers', - actionInitializers: 'BulkEditFormActionInitializers', + formItemInitializers: 'bulkEditForm:configureFields', + actionInitializers: 'bulkEditForm:configureActions', association, collection: collection.name, dataSource: collection.dataSource, diff --git a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/__e2e__/schemaInitailizer.test.ts b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/__e2e__/schemaInitailizer.test.ts index df47a471d..248b13c7b 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/__e2e__/schemaInitailizer.test.ts +++ b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/__e2e__/schemaInitailizer.test.ts @@ -4,7 +4,7 @@ import { oneEmptyGantt } from './utils'; test.describe('TableActionInitializers & GanttActionInitializers & MapActionInitializers should add bulk edit action', () => { test('bulk edit in TableActionInitializers', async ({ page, mockPage }) => { await mockPage(oneEmptyTableBlockWithActions).goto(); - await page.getByLabel('schema-initializer-ActionBar-TableActionInitializers-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-table:configureActions-general').hover(); await page.getByRole('menuitem', { name: 'Customize right' }).click(); await page.getByRole('menuitem', { name: 'Bulk edit' }).click(); await page.mouse.move(300, 0); @@ -14,7 +14,7 @@ test.describe('TableActionInitializers & GanttActionInitializers & MapActionInit const nocoPage = await mockPage(oneEmptyGantt).waitForInit(); await mockRecords('general', 3); await nocoPage.goto(); - await page.getByLabel('schema-initializer-ActionBar-GanttActionInitializers-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-gantt:configureActions-general').hover(); await page.getByRole('menuitem', { name: 'Customize right' }).click(); await page.getByRole('menuitem', { name: 'Bulk edit' }).click(); await expect(page.getByLabel('Bulk edit')).toBeVisible(); diff --git a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/__e2e__/schemaSettings.test.ts b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/__e2e__/schemaSettings.test.ts index 3dd1bae22..9e424c76b 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/__e2e__/schemaSettings.test.ts +++ b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/__e2e__/schemaSettings.test.ts @@ -15,10 +15,10 @@ test.describe('bulk edit action setting', () => { await page.getByRole('option', { name: 'All' }).click(); //配置更新规则 await page.getByLabel('Bulk edit').click(); - await page.getByLabel('schema-initializer-Grid-BulkEditBlockInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-popup:bulkEdit:addBlock-general').hover(); await page.getByRole('menuitem', { name: 'form Form' }).click(); await page.mouse.move(300, 0); - await page.getByLabel('schema-initializer-Grid-BulkEditFormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-bulkEditForm:configureFields-general').hover(); await page.getByRole('menuitem', { name: 'Single line text' }).click(); await page.getByRole('menuitem', { name: 'Start date time' }).click(); await page.getByRole('menuitem', { name: 'Percent' }).click(); @@ -30,7 +30,7 @@ test.describe('bulk edit action setting', () => { await page.getByRole('option', { name: 'Changed to' }).locator('div').click(); await page.getByRole('spinbutton').click(); await page.getByRole('spinbutton').fill('0'); - await page.getByLabel('schema-initializer-ActionBar-BulkEditFormActionInitializers-general').click(); + await page.getByLabel('schema-initializer-ActionBar-bulkEditForm:configureActions-general').click(); await page.getByRole('menuitem', { name: 'Submit' }).click(); //更新提交的数据符合预期 const [request] = await Promise.all([ diff --git a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/__e2e__/utils.ts b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/__e2e__/utils.ts index 6233fa049..75af4dd96 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/__e2e__/utils.ts +++ b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/__e2e__/utils.ts @@ -97,7 +97,7 @@ export const oneEmptyGantt: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { gl57m4hyewf: { _isJSONSchemaObject: true, @@ -154,7 +154,7 @@ export const oneEmptyGantt: PageConfig = { marginBottom: 24, }, }, - 'x-initializer': 'GanttActionInitializers', + 'x-initializer': 'gantt:configureActions', 'x-uid': 'guwovmwt4c0', 'x-async': false, 'x-index': 1, @@ -170,7 +170,7 @@ export const oneEmptyGantt: PageConfig = { maxWidth: '35%', }, }, - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -190,7 +190,7 @@ export const oneEmptyGantt: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -253,7 +253,7 @@ export const oneEmptyGantt: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', 'x-uid': 'gxtfjqzxbfu', 'x-async': false, 'x-index': 1, @@ -327,7 +327,7 @@ export const oneEmptyTableBlockWithCustomizeActions: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', 'x-index': 1, properties: { '1m4gz110aaw': { @@ -368,7 +368,7 @@ export const oneEmptyTableBlockWithCustomizeActions: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -430,7 +430,7 @@ export const oneEmptyTableBlockWithCustomizeActions: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BulkEditBlockInitializers', + 'x-initializer': 'popup:bulkEdit:addBlock', 'x-uid': '3gjmo60w4de', 'x-async': false, 'x-index': 1, @@ -464,7 +464,7 @@ export const oneEmptyTableBlockWithCustomizeActions: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -483,7 +483,7 @@ export const oneEmptyTableBlockWithCustomizeActions: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, diff --git a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/index.tsx b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/index.tsx index 41ae1d0ca..fe337eafc 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/index.tsx +++ b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/index.tsx @@ -1,8 +1,15 @@ import { Plugin, useCollection_deprecated } from '@nocobase/client'; import { bulkEditActionSettings, deprecatedBulkEditActionSettings } from './BulkEditAction.Settings'; -import { BulkEditFormItemInitializers } from './BulkEditFormItemInitializers'; -import { CreateFormBulkEditBlockInitializers, BulkEditBlockInitializers } from './BulkEditBlockInitializers'; -import { BulkEditFormActionInitializers } from './BulkEditFormActionInitializers'; +import { BulkEditFormItemInitializers_deprecated, bulkEditFormItemInitializers } from './BulkEditFormItemInitializers'; +import { + CreateFormBulkEditBlockInitializers, + BulkEditBlockInitializers_deprecated, + bulkEditBlockInitializers, +} from './BulkEditBlockInitializers'; +import { + BulkEditFormActionInitializers_deprecated, + bulkEditFormActionInitializers, +} from './BulkEditFormActionInitializers'; import { BulkEditActionInitializer } from './BulkEditActionInitializer'; import { bulkEditFormItemSettings } from './bulkEditFormItemSettings'; import { BulkEditField } from './component/BulkEditField'; @@ -14,10 +21,13 @@ export class BulkEditPlugin extends Plugin { this.app.schemaSettingsManager.add(deprecatedBulkEditActionSettings); this.app.schemaSettingsManager.add(bulkEditActionSettings); this.app.schemaSettingsManager.add(bulkEditFormItemSettings); - this.app.schemaInitializerManager.add(BulkEditFormItemInitializers); + this.app.schemaInitializerManager.add(BulkEditFormItemInitializers_deprecated); + this.app.schemaInitializerManager.add(bulkEditFormItemInitializers); this.app.schemaInitializerManager.add(CreateFormBulkEditBlockInitializers); - this.app.schemaInitializerManager.add(BulkEditBlockInitializers); - this.app.schemaInitializerManager.add(BulkEditFormActionInitializers); + this.app.schemaInitializerManager.add(BulkEditBlockInitializers_deprecated); + this.app.schemaInitializerManager.add(bulkEditBlockInitializers); + this.app.schemaInitializerManager.add(BulkEditFormActionInitializers_deprecated); + this.app.schemaInitializerManager.add(bulkEditFormActionInitializers); const initializerData = { type: 'item', @@ -45,9 +55,9 @@ export class BulkEditPlugin extends Plugin { }, }; - this.app.schemaInitializerManager.addItem('TableActionInitializers', 'customize.bulkEdit', initializerData); - this.app.schemaInitializerManager.addItem('GanttActionInitializers', 'customize.bulkEdit', initializerData); - this.app.schemaInitializerManager.addItem('MapActionInitializers', 'customize.bulkEdit', initializerData); + this.app.schemaInitializerManager.addItem('table:configureActions', 'customize.bulkEdit', initializerData); + this.app.schemaInitializerManager.addItem('gantt:configureActions', 'customize.bulkEdit', initializerData); + this.app.schemaInitializerManager.addItem('map:configureActions', 'customize.bulkEdit', initializerData); } } diff --git a/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/__e2e__/schemaInitailizer.test.ts b/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/__e2e__/schemaInitailizer.test.ts index bcec7f689..d29899c60 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/__e2e__/schemaInitailizer.test.ts +++ b/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/__e2e__/schemaInitailizer.test.ts @@ -4,7 +4,7 @@ import { oneEmptyGantt } from './utils'; test.describe('TableActionInitializers & GanttActionInitializers & MapActionInitializers ', () => { test('TableActionInitializers should add bulk update', async ({ page, mockPage }) => { await mockPage(oneEmptyTableBlockWithCustomizeActions).goto(); - await page.getByLabel('schema-initializer-ActionBar-TableActionInitializers-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-table:configureActions-general').hover(); await page.getByRole('menuitem', { name: 'Customize right' }).click(); await page.getByRole('menuitem', { name: 'Bulk update' }).click(); await expect(page.getByLabel('action-Action-Bulk update-customize:bulkUpdate-general-table')).toBeVisible(); @@ -13,7 +13,7 @@ test.describe('TableActionInitializers & GanttActionInitializers & MapActionInit const nocoPage = await mockPage(oneEmptyGantt).waitForInit(); await mockRecords('general', 3); await nocoPage.goto(); - await page.getByLabel('schema-initializer-ActionBar-GanttActionInitializers-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-gantt:configureActions-general').hover(); await page.getByRole('menuitem', { name: 'Customize right' }).click(); await page.getByRole('menuitem', { name: 'Bulk update' }).click(); await page.mouse.move(300, 0); diff --git a/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/__e2e__/schemaSettings.test.ts b/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/__e2e__/schemaSettings.test.ts index e30ced60c..af5097940 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/__e2e__/schemaSettings.test.ts +++ b/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/__e2e__/schemaSettings.test.ts @@ -18,7 +18,7 @@ test.describe('data will be updated && Assign field values && after successful s await page.getByRole('option', { name: 'All' }).click(); //字段赋值 await page.getByRole('menuitem', { name: 'Assign field values' }).click(); - await page.getByLabel('schema-initializer-Grid-CustomFormItemInitializers-general').click(); + await page.getByLabel('schema-initializer-Grid-assignFieldValuesForm:configureFields-general').click(); await page.getByRole('menuitem', { name: 'Single select' }).click(); await page.getByTestId('select-single').click(); await page.getByText('option3').click(); diff --git a/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/__e2e__/utils.ts b/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/__e2e__/utils.ts index b145cb2bc..61f7aaae9 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/__e2e__/utils.ts +++ b/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/__e2e__/utils.ts @@ -140,7 +140,7 @@ export const oneEmptyGantt: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { gl57m4hyewf: { _isJSONSchemaObject: true, @@ -197,7 +197,7 @@ export const oneEmptyGantt: PageConfig = { marginBottom: 24, }, }, - 'x-initializer': 'GanttActionInitializers', + 'x-initializer': 'gantt:configureActions', 'x-uid': 'guwovmwt4c0', 'x-async': false, 'x-index': 1, @@ -213,7 +213,7 @@ export const oneEmptyGantt: PageConfig = { maxWidth: '35%', }, }, - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -233,7 +233,7 @@ export const oneEmptyGantt: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -296,7 +296,7 @@ export const oneEmptyGantt: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', 'x-uid': 'gxtfjqzxbfu', 'x-async': false, 'x-index': 1, @@ -367,7 +367,7 @@ export const oneEmptyTableBlockWithCustomizeUpdate: PageConfig = { type: 'void', version: '2.0', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', _isJSONSchemaObject: true, properties: { btrf53i4lpi: { @@ -408,7 +408,7 @@ export const oneEmptyTableBlockWithCustomizeUpdate: PageConfig = { type: 'void', version: '2.0', 'x-component': 'ActionBar', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component-props': { style: { marginBottom: 'var(--nb-spacing)', @@ -457,7 +457,7 @@ export const oneEmptyTableBlockWithCustomizeUpdate: PageConfig = { type: 'array', version: '2.0', 'x-component': 'TableV2', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component-props': { rowKey: 'id', useProps: '{{ useTableBlockProps }}', @@ -474,7 +474,7 @@ export const oneEmptyTableBlockWithCustomizeUpdate: PageConfig = { 'x-designer': 'TableV2.ActionColumnDesigner', 'x-component': 'TableV2.Column', 'x-decorator': 'TableV2.Column.ActionBar', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', 'x-action-column': 'actions', _isJSONSchemaObject: true, properties: { diff --git a/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/index.tsx b/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/index.tsx index 4340f6e90..360b12649 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/index.tsx +++ b/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/index.tsx @@ -25,9 +25,9 @@ export class PluginBulkUpdateClient extends Plugin { }, }; - this.app.schemaInitializerManager.addItem('TableActionInitializers', 'customize.bulkUpdate', initializerData); - this.app.schemaInitializerManager.addItem('GanttActionInitializers', 'customize.bulkUpdate', initializerData); - this.app.schemaInitializerManager.addItem('MapActionInitializers', 'customize.bulkUpdate', initializerData); + this.app.schemaInitializerManager.addItem('table:configureActions', 'customize.bulkUpdate', initializerData); + this.app.schemaInitializerManager.addItem('gantt:configureActions', 'customize.bulkUpdate', initializerData); + this.app.schemaInitializerManager.addItem('map:configureActions', 'customize.bulkUpdate', initializerData); } } diff --git a/packages/plugins/@nocobase/plugin-action-duplicate/src/client/DuplicateActionInitializer.tsx b/packages/plugins/@nocobase/plugin-action-duplicate/src/client/DuplicateActionInitializer.tsx index e70d18f8f..917c9e641 100644 --- a/packages/plugins/@nocobase/plugin-action-duplicate/src/client/DuplicateActionInitializer.tsx +++ b/packages/plugins/@nocobase/plugin-action-duplicate/src/client/DuplicateActionInitializer.tsx @@ -38,7 +38,7 @@ export const DuplicateActionInitializer = (props) => { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', properties: {}, }, }, diff --git a/packages/plugins/@nocobase/plugin-action-duplicate/src/client/__e2e__/schemaInitailizer.test.ts b/packages/plugins/@nocobase/plugin-action-duplicate/src/client/__e2e__/schemaInitailizer.test.ts index 000201fbe..a9d77f2d6 100644 --- a/packages/plugins/@nocobase/plugin-action-duplicate/src/client/__e2e__/schemaInitailizer.test.ts +++ b/packages/plugins/@nocobase/plugin-action-duplicate/src/client/__e2e__/schemaInitailizer.test.ts @@ -11,7 +11,7 @@ test.describe('TableActionColumnInitializers & DetailsActionInitializers & ReadP const nocoPage = await mockPage(oneEmptyTableBlockWithCustomizeActions).waitForInit(); await mockRecords('general', 3); await nocoPage.goto(); - await page.getByRole('button', { name: 'Actions' }).hover(); + await page.getByRole('button', { name: 'Actions', exact: true }).hover(); await page.getByLabel('designer-schema-settings-TableV2.Column-TableV2.ActionColumnDesigner-general').hover(); await page.getByRole('menuitem', { name: 'Duplicate' }).click(); await expect(page.getByLabel('action-Action.Link-Duplicate-duplicate-general-table-0')).toBeVisible(); diff --git a/packages/plugins/@nocobase/plugin-action-duplicate/src/client/__e2e__/schemaSettings.test.ts b/packages/plugins/@nocobase/plugin-action-duplicate/src/client/__e2e__/schemaSettings.test.ts index 337d56b24..d74999e27 100644 --- a/packages/plugins/@nocobase/plugin-action-duplicate/src/client/__e2e__/schemaSettings.test.ts +++ b/packages/plugins/@nocobase/plugin-action-duplicate/src/client/__e2e__/schemaSettings.test.ts @@ -34,18 +34,18 @@ test.describe('direct duplicate & copy into the form and continue to fill in', ( await page.getByRole('button', { name: 'singleLineText (Duplicate)' }).click(); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page.getByLabel('action-Action.Link-Duplicate-duplicate-general-table-0').click(); - await page.getByLabel('schema-initializer-Grid-CreateFormBlockInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-popup:addNew:addBlock-general').hover(); //配置表单区块 await page.getByRole('menuitem', { name: 'form Form' }).click(); await page.mouse.move(300, 0); - await page.getByLabel('schema-initializer-Grid-FormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover(); await page.getByRole('menuitem', { name: 'singleLineText' }).click(); await page.getByRole('menuitem', { name: 'oneToOneBelongsTo' }).click(); await page.getByRole('menuitem', { name: 'oneToOneHasOne' }).click(); await page.getByRole('menuitem', { name: 'oneToMany' }).click(); await page.getByRole('menuitem', { name: 'manyToOne', exact: true }).click(); await page.getByRole('menuitem', { name: 'manyToMany' }).click(); - await page.getByLabel('schema-initializer-ActionBar-CreateFormActionInitializers-general').click(); + await page.getByLabel('schema-initializer-ActionBar-createForm:configureActions-general').click(); await page.getByRole('menuitem', { name: 'Submit' }).click(); await page.getByLabel('drawer-Action.Container-general-Duplicate-mask').click(); //同步表单字段 diff --git a/packages/plugins/@nocobase/plugin-action-duplicate/src/client/__e2e__/utils.ts b/packages/plugins/@nocobase/plugin-action-duplicate/src/client/__e2e__/utils.ts index e85717235..19c0498c1 100644 --- a/packages/plugins/@nocobase/plugin-action-duplicate/src/client/__e2e__/utils.ts +++ b/packages/plugins/@nocobase/plugin-action-duplicate/src/client/__e2e__/utils.ts @@ -97,7 +97,7 @@ export const oneEmptyGantt: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { gl57m4hyewf: { _isJSONSchemaObject: true, @@ -154,7 +154,7 @@ export const oneEmptyGantt: PageConfig = { marginBottom: 24, }, }, - 'x-initializer': 'GanttActionInitializers', + 'x-initializer': 'gantt:configureActions', 'x-uid': 'guwovmwt4c0', 'x-async': false, 'x-index': 1, @@ -170,7 +170,7 @@ export const oneEmptyGantt: PageConfig = { maxWidth: '35%', }, }, - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -190,7 +190,7 @@ export const oneEmptyGantt: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -253,7 +253,7 @@ export const oneEmptyGantt: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', 'x-uid': 'gxtfjqzxbfu', 'x-async': false, 'x-index': 1, @@ -327,7 +327,7 @@ export const oneEmptyTableBlockWithDuplicateActions: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', 'x-index': 1, properties: { '1m4gz110aaw': { @@ -368,7 +368,7 @@ export const oneEmptyTableBlockWithDuplicateActions: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -384,7 +384,7 @@ export const oneEmptyTableBlockWithDuplicateActions: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -403,7 +403,7 @@ export const oneEmptyTableBlockWithDuplicateActions: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -465,7 +465,7 @@ export const oneEmptyTableBlockWithDuplicateActions: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', 'x-uid': 'vtcnkzcaeec', 'x-async': false, 'x-index': 1, diff --git a/packages/plugins/@nocobase/plugin-action-duplicate/src/client/index.ts b/packages/plugins/@nocobase/plugin-action-duplicate/src/client/index.ts index 3a2abcf9c..072d681d8 100644 --- a/packages/plugins/@nocobase/plugin-action-duplicate/src/client/index.ts +++ b/packages/plugins/@nocobase/plugin-action-duplicate/src/client/index.ts @@ -60,11 +60,7 @@ export class PluginDuplicateClient extends Plugin { }, }; - this.app.schemaInitializerManager.addItem( - 'TableActionColumnInitializers', - 'actions.duplicate', - initializerTableData, - ); + this.app.schemaInitializerManager.addItem('table:configureItemActions', 'actions.duplicate', initializerTableData); } } diff --git a/packages/plugins/@nocobase/plugin-action-print/src/client/__e2e__/schemaInitailizer.test.ts b/packages/plugins/@nocobase/plugin-action-print/src/client/__e2e__/schemaInitailizer.test.ts index abe84dde0..16182a2ab 100644 --- a/packages/plugins/@nocobase/plugin-action-print/src/client/__e2e__/schemaInitailizer.test.ts +++ b/packages/plugins/@nocobase/plugin-action-print/src/client/__e2e__/schemaInitailizer.test.ts @@ -8,7 +8,7 @@ test.describe('ReadPrettyFormActionInitializers & CalendarFormActionInitializers await nocoPage.goto(); await page.getByLabel('block-item-CardItem-general-table').hover(); await page.getByLabel('action-Action.Link-View-view-general').click(); - await page.getByLabel('schema-initializer-ActionBar-ReadPrettyFormActionInitializers-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-details:configureActions-general').hover(); await page.getByRole('menuitem', { name: 'Print' }).click(); await expect(page.getByLabel('action-Action-Print-print-general-form')).toBeVisible(); }); @@ -17,7 +17,7 @@ test.describe('ReadPrettyFormActionInitializers & CalendarFormActionInitializers await mockRecord('general', { singleLineText: 'test' }); await nocoPage.goto(); await page.getByTitle('test').click(); - await page.getByLabel('schema-initializer-ActionBar-CalendarFormActionInitializers-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-details:configureActions-general').hover(); await page.getByRole('menuitem', { name: 'Print' }).click(); await page.getByLabel('action-Action-Print-print-general-form').click(); }); diff --git a/packages/plugins/@nocobase/plugin-action-print/src/client/__e2e__/utils.ts b/packages/plugins/@nocobase/plugin-action-print/src/client/__e2e__/utils.ts index 51debcd72..84ab88f58 100644 --- a/packages/plugins/@nocobase/plugin-action-print/src/client/__e2e__/utils.ts +++ b/packages/plugins/@nocobase/plugin-action-print/src/client/__e2e__/utils.ts @@ -96,7 +96,7 @@ export const oneTableWithViewAction: PageConfig = { type: 'void', version: '2.0', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', _isJSONSchemaObject: true, properties: { '8xj4v8eg792': { @@ -137,7 +137,7 @@ export const oneTableWithViewAction: PageConfig = { type: 'void', version: '2.0', 'x-component': 'ActionBar', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component-props': { style: { marginBottom: 'var(--nb-spacing)', @@ -152,7 +152,7 @@ export const oneTableWithViewAction: PageConfig = { type: 'array', version: '2.0', 'x-component': 'TableV2', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component-props': { rowKey: 'id', useProps: '{{ useTableBlockProps }}', @@ -169,7 +169,7 @@ export const oneTableWithViewAction: PageConfig = { 'x-designer': 'TableV2.ActionColumnDesigner', 'x-component': 'TableV2.Column', 'x-decorator': 'TableV2.Column.ActionBar', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', 'x-action-column': 'actions', _isJSONSchemaObject: true, properties: { @@ -230,7 +230,7 @@ export const oneTableWithViewAction: PageConfig = { type: 'void', version: '2.0', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', _isJSONSchemaObject: true, properties: { v9jpx7749ok: { @@ -276,8 +276,7 @@ export const oneTableWithViewAction: PageConfig = { type: 'void', version: '2.0', 'x-component': 'ActionBar', - 'x-initializer': - 'ReadPrettyFormActionInitializers', + 'x-initializer': 'details:configureActions', 'x-component-props': { style: { marginBottom: 24, @@ -292,8 +291,7 @@ export const oneTableWithViewAction: PageConfig = { type: 'void', version: '2.0', 'x-component': 'Grid', - 'x-initializer': - 'ReadPrettyFormItemInitializers', + 'x-initializer': 'details:configureFields', _isJSONSchemaObject: true, 'x-uid': 'kum0xpsh9se', 'x-async': false, @@ -392,7 +390,7 @@ export const oneCalenderWithViewAction: PageConfig = { type: 'void', version: '2.0', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', _isJSONSchemaObject: true, properties: { '8er4x7qwc0p': { @@ -443,7 +441,7 @@ export const oneCalenderWithViewAction: PageConfig = { type: 'void', version: '2.0', 'x-component': 'CalendarV2.ActionBar', - 'x-initializer': 'CalendarActionInitializers', + 'x-initializer': 'calendar:configureActions', 'x-component-props': { style: { marginBottom: 24, @@ -503,7 +501,7 @@ export const oneCalenderWithViewAction: PageConfig = { type: 'void', version: '2.0', 'x-component': 'Grid', - 'x-initializer': 'CreateFormBlockInitializers', + 'x-initializer': 'popup:addNew:addBlock', _isJSONSchemaObject: true, properties: { '7e9xtqdm96x': { @@ -548,7 +546,7 @@ export const oneCalenderWithViewAction: PageConfig = { type: 'void', version: '2.0', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', _isJSONSchemaObject: true, properties: { ikh538659hb: { @@ -668,7 +666,7 @@ export const oneCalenderWithViewAction: PageConfig = { type: 'void', version: '2.0', 'x-component': 'ActionBar', - 'x-initializer': 'CreateFormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component-props': { style: { marginTop: 24, @@ -776,7 +774,7 @@ export const oneCalenderWithViewAction: PageConfig = { 'x-component-props': {}, _isJSONSchemaObject: true, 'x-initializer-props': { - gridInitializer: 'RecordBlockInitializers', + gridInitializer: 'popup:common:addBlock', }, properties: { tab1: { @@ -792,10 +790,10 @@ export const oneCalenderWithViewAction: PageConfig = { type: 'void', version: '2.0', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', _isJSONSchemaObject: true, 'x-initializer-props': { - actionInitializers: 'CalendarFormActionInitializers', + actionInitializers: 'details:configureActions', }, properties: { '0j7rb0bivys': { @@ -841,7 +839,7 @@ export const oneCalenderWithViewAction: PageConfig = { type: 'void', version: '2.0', 'x-component': 'ActionBar', - 'x-initializer': 'CalendarFormActionInitializers', + 'x-initializer': 'details:configureActions', 'x-component-props': { style: { marginBottom: 24, @@ -856,7 +854,7 @@ export const oneCalenderWithViewAction: PageConfig = { type: 'void', version: '2.0', 'x-component': 'Grid', - 'x-initializer': 'ReadPrettyFormItemInitializers', + 'x-initializer': 'details:configureFields', _isJSONSchemaObject: true, 'x-uid': 'br7bq2ddccy', 'x-async': false, diff --git a/packages/plugins/@nocobase/plugin-action-print/src/client/index.tsx b/packages/plugins/@nocobase/plugin-action-print/src/client/index.tsx index 89e15fff0..3730092f6 100644 --- a/packages/plugins/@nocobase/plugin-action-print/src/client/index.tsx +++ b/packages/plugins/@nocobase/plugin-action-print/src/client/index.tsx @@ -18,11 +18,7 @@ export class PrintPlugin extends Plugin { }, }; - this.app.schemaInitializerManager.addItem( - 'ReadPrettyFormActionInitializers', - 'enableActions.print', - initializerData, - ); + this.app.schemaInitializerManager.addItem('details:configureActions', 'enableActions.print', initializerData); this.app.schemaInitializerManager.addItem('CalendarFormActionInitializers', 'enableActions.print', initializerData); } } diff --git a/packages/plugins/@nocobase/plugin-audit-logs/src/client/AuditLogsBlockInitializer.tsx b/packages/plugins/@nocobase/plugin-audit-logs/src/client/AuditLogsBlockInitializer.tsx index 440a694f9..6752dcf10 100644 --- a/packages/plugins/@nocobase/plugin-audit-logs/src/client/AuditLogsBlockInitializer.tsx +++ b/packages/plugins/@nocobase/plugin-audit-logs/src/client/AuditLogsBlockInitializer.tsx @@ -17,9 +17,9 @@ export const AuditLogsBlockInitializer = () => { const schema = createTableBlockSchema({ collection: 'auditLogs', rowKey: 'id', - tableActionInitializers: 'AuditLogsTableActionInitializers', - tableColumnInitializers: 'AuditLogsTableColumnInitializers', - tableActionColumnInitializers: 'AuditLogsTableActionColumnInitializers', + tableActionInitializers: 'auditLogsTable:configureActions', + tableColumnInitializers: 'auditLogsTable:configureColumns', + tableActionColumnInitializers: 'auditLogsTable:configureItemActions', tableBlockProvider: 'AuditLogsBlockProvider', disableTemplate: true, }); diff --git a/packages/plugins/@nocobase/plugin-audit-logs/src/client/components/AuditLogsViewActionInitializer.tsx b/packages/plugins/@nocobase/plugin-audit-logs/src/client/components/AuditLogsViewActionInitializer.tsx index 3802544d1..2ab850ef3 100644 --- a/packages/plugins/@nocobase/plugin-audit-logs/src/client/components/AuditLogsViewActionInitializer.tsx +++ b/packages/plugins/@nocobase/plugin-audit-logs/src/client/components/AuditLogsViewActionInitializer.tsx @@ -206,7 +206,7 @@ export const AuditLogsViewActionInitializer = () => { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', }, }, }, diff --git a/packages/plugins/@nocobase/plugin-audit-logs/src/client/deplicated/AuditLogs.tsx b/packages/plugins/@nocobase/plugin-audit-logs/src/client/deplicated/AuditLogs.tsx index f502bc7d3..54e62873d 100644 --- a/packages/plugins/@nocobase/plugin-audit-logs/src/client/deplicated/AuditLogs.tsx +++ b/packages/plugins/@nocobase/plugin-audit-logs/src/client/deplicated/AuditLogs.tsx @@ -171,7 +171,7 @@ export const AuditLogs: any = () => { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { type: 'void', diff --git a/packages/plugins/@nocobase/plugin-audit-logs/src/client/index.ts b/packages/plugins/@nocobase/plugin-audit-logs/src/client/index.ts index afee90c42..3cb402f30 100644 --- a/packages/plugins/@nocobase/plugin-audit-logs/src/client/index.ts +++ b/packages/plugins/@nocobase/plugin-audit-logs/src/client/index.ts @@ -1,20 +1,32 @@ import { Plugin, SchemaInitializerItemType } from '@nocobase/client'; import { AuditLogsProvider } from './AuditLogsProvider'; -import { auditLogsTableActionColumnInitializers } from './initializers/AuditLogsTableActionColumnInitializers'; -import { auditLogsTableActionInitializers } from './initializers/AuditLogsTableActionInitializers'; -import { auditLogsTableColumnInitializers } from './initializers/AuditLogsTableColumnInitializers'; +import { + auditLogsTableActionColumnInitializers, + auditLogsTableActionColumnInitializers_deprecated, +} from './initializers/AuditLogsTableActionColumnInitializers'; +import { + auditLogsTableActionInitializers, + auditLogsTableActionInitializers_deprecated, +} from './initializers/AuditLogsTableActionInitializers'; +import { + auditLogsTableColumnInitializers, + auditLogsTableColumnInitializers_deprecated, +} from './initializers/AuditLogsTableColumnInitializers'; export * from './AuditLogsBlockInitializer'; export * from './AuditLogsProvider'; export class AuditLogsPlugin extends Plugin { async load() { this.app.use(AuditLogsProvider); + this.app.schemaInitializerManager.add(auditLogsTableActionInitializers_deprecated); this.app.schemaInitializerManager.add(auditLogsTableActionInitializers); + this.app.schemaInitializerManager.add(auditLogsTableActionColumnInitializers_deprecated); this.app.schemaInitializerManager.add(auditLogsTableActionColumnInitializers); + this.app.schemaInitializerManager.add(auditLogsTableColumnInitializers_deprecated); this.app.schemaInitializerManager.add(auditLogsTableColumnInitializers); - const blockInitializers = this.app.schemaInitializerManager.get('BlockInitializers'); - const recordBlockInitializers = this.app.schemaInitializerManager.get('RecordBlockInitializers'); + const blockInitializers = this.app.schemaInitializerManager.get('page:addBlock'); + const recordBlockInitializers = this.app.schemaInitializerManager.get('popup:common:addBlock'); const auditLogs: Omit = { title: '{{t("Audit logs")}}', Component: 'AuditLogsBlockInitializer', diff --git a/packages/plugins/@nocobase/plugin-audit-logs/src/client/initializers/AuditLogsTableActionColumnInitializer.tsx b/packages/plugins/@nocobase/plugin-audit-logs/src/client/initializers/AuditLogsTableActionColumnInitializer.tsx index 5ec9f3719..a045445a7 100644 --- a/packages/plugins/@nocobase/plugin-audit-logs/src/client/initializers/AuditLogsTableActionColumnInitializer.tsx +++ b/packages/plugins/@nocobase/plugin-audit-logs/src/client/initializers/AuditLogsTableActionColumnInitializer.tsx @@ -8,7 +8,7 @@ export const AuditLogsTableActionColumnInitializer = () => { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'AuditLogsTableActionColumnInitializers', + 'x-initializer': 'auditLogsTable:configureItemActions', 'x-action-column': 'actions', properties: { actions: { diff --git a/packages/plugins/@nocobase/plugin-audit-logs/src/client/initializers/AuditLogsTableActionColumnInitializers.tsx b/packages/plugins/@nocobase/plugin-audit-logs/src/client/initializers/AuditLogsTableActionColumnInitializers.tsx index 2026e5397..437f47899 100644 --- a/packages/plugins/@nocobase/plugin-audit-logs/src/client/initializers/AuditLogsTableActionColumnInitializers.tsx +++ b/packages/plugins/@nocobase/plugin-audit-logs/src/client/initializers/AuditLogsTableActionColumnInitializers.tsx @@ -1,10 +1,19 @@ import { MenuOutlined } from '@ant-design/icons'; import { useFieldSchema } from '@formily/react'; -import { createDesignable, Resizable, SchemaInitializer, useAPIClient, useDesignable } from '@nocobase/client'; +import { + CompatibleSchemaInitializer, + createDesignable, + Resizable, + useAPIClient, + useDesignable, +} from '@nocobase/client'; import React from 'react'; import { useTranslation } from 'react-i18next'; -export const auditLogsTableActionColumnInitializers = new SchemaInitializer({ +/** + * @deprecated + */ +export const auditLogsTableActionColumnInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'AuditLogsTableActionColumnInitializers', insertPosition: 'beforeEnd', Component: (props: any) => , @@ -65,3 +74,68 @@ export const auditLogsTableActionColumnInitializers = new SchemaInitializer({ }, ], }); + +export const auditLogsTableActionColumnInitializers = new CompatibleSchemaInitializer( + { + name: 'auditLogsTable:configureItemActions', + insertPosition: 'beforeEnd', + Component: (props: any) => , + useInsert() { + const fieldSchema = useFieldSchema(); + const api = useAPIClient(); + const { refresh } = useDesignable(); + const { t } = useTranslation(); + + return (schema) => { + const spaceSchema = fieldSchema.reduceProperties((buf, schema) => { + if (schema['x-component'] === 'Space') { + return schema; + } + return buf; + }, null); + if (!spaceSchema) { + return; + } + const dn = createDesignable({ + t, + api, + refresh, + current: spaceSchema, + }); + dn.loadAPIClientEvents(); + dn.insertBeforeEnd(schema); + }; + }, + items: [ + { + name: 'enableActions', + type: 'itemGroup', + title: '{{t("Enable actions")}}', + children: [ + { + name: 'view', + type: 'item', + title: '{{t("View")}}', + Component: 'AuditLogsViewActionInitializer', + schema: { + 'x-component': 'Action.Link', + 'x-action': 'view', + 'x-decorator': 'ACLActionProvider', + }, + }, + ], + }, + { + name: 'divider', + type: 'divider', + }, + { + name: 'columnWidth', + type: 'item', + title: '{{t("Column width")}}', + Component: Resizable, + }, + ], + }, + auditLogsTableActionColumnInitializers_deprecated, +); diff --git a/packages/plugins/@nocobase/plugin-audit-logs/src/client/initializers/AuditLogsTableActionInitializers.tsx b/packages/plugins/@nocobase/plugin-audit-logs/src/client/initializers/AuditLogsTableActionInitializers.tsx index 2fe57c478..41b74bec4 100644 --- a/packages/plugins/@nocobase/plugin-audit-logs/src/client/initializers/AuditLogsTableActionInitializers.tsx +++ b/packages/plugins/@nocobase/plugin-audit-logs/src/client/initializers/AuditLogsTableActionInitializers.tsx @@ -1,7 +1,10 @@ -import { SchemaInitializer } from '@nocobase/client'; +import { CompatibleSchemaInitializer } from '@nocobase/client'; -// 操作记录表格操作配置 -export const auditLogsTableActionInitializers: SchemaInitializer = new SchemaInitializer({ +/** + * @deprecated + * 操作记录表格操作配置 + */ +export const auditLogsTableActionInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'AuditLogsTableActionInitializers', title: "{{t('Configure actions')}}", icon: 'SettingOutlined', @@ -34,3 +37,40 @@ export const auditLogsTableActionInitializers: SchemaInitializer = new SchemaIni }, ], }); + +export const auditLogsTableActionInitializers = new CompatibleSchemaInitializer( + { + name: 'auditLogsTable:configureActions', + title: "{{t('Configure actions')}}", + icon: 'SettingOutlined', + style: { + marginLeft: 8, + }, + items: [ + { + type: 'itemGroup', + title: "{{t('Enable actions')}}", + name: 'enableActions', + children: [ + { + name: 'filter', + title: "{{t('Filter')}}", + Component: 'FilterActionInitializer', + schema: { + 'x-align': 'left', + }, + }, + { + name: 'refresh', + title: "{{t('Refresh')}}", + Component: 'RefreshActionInitializer', + schema: { + 'x-align': 'right', + }, + }, + ], + }, + ], + }, + auditLogsTableActionInitializers_deprecated, +); diff --git a/packages/plugins/@nocobase/plugin-audit-logs/src/client/initializers/AuditLogsTableColumnInitializers.tsx b/packages/plugins/@nocobase/plugin-audit-logs/src/client/initializers/AuditLogsTableColumnInitializers.tsx index d285ca29e..81ae12a81 100644 --- a/packages/plugins/@nocobase/plugin-audit-logs/src/client/initializers/AuditLogsTableColumnInitializers.tsx +++ b/packages/plugins/@nocobase/plugin-audit-logs/src/client/initializers/AuditLogsTableColumnInitializers.tsx @@ -1,5 +1,5 @@ import { - SchemaInitializer, + CompatibleSchemaInitializer, SchemaInitializerChildren, useAssociatedTableColumnInitializerFields, useCompile, @@ -44,7 +44,10 @@ const AssociatedFields = () => { return {schema}; }; -export const auditLogsTableColumnInitializers: SchemaInitializer = new SchemaInitializer({ +/** + * @deprecated + */ +export const auditLogsTableColumnInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'AuditLogsTableColumnInitializers', insertPosition: 'beforeEnd', icon: 'SettingOutlined', @@ -87,3 +90,50 @@ export const auditLogsTableColumnInitializers: SchemaInitializer = new SchemaIni }, ], }); + +export const auditLogsTableColumnInitializers = new CompatibleSchemaInitializer( + { + name: 'auditLogsTable:configureColumns', + insertPosition: 'beforeEnd', + icon: 'SettingOutlined', + title: '{{t("Configure columns")}}', + wrap(s) { + if (s['x-action-column']) { + return s; + } + return { + type: 'void', + 'x-decorator': 'TableV2.Column.Decorator', + 'x-designer': 'TableV2.Column.Designer', + 'x-component': 'TableV2.Column', + properties: { + [s.name]: { + ...s, + }, + }, + }; + }, + items: [ + { + name: 'displayFields', + type: 'itemGroup', + title: '{{t("Display fields")}}', + useChildren: useTableColumnInitializerFields, + }, + { + name: 'parentCollectionFields', + Component: ParentCollectionFields, + }, + { + name: 'associationFields', + Component: AssociatedFields, + }, + { + name: 'actionColumn', + title: '{{t("Action column")}}', + Component: 'AuditLogsTableActionColumnInitializer', + }, + ], + }, + auditLogsTableColumnInitializers_deprecated, +); diff --git a/packages/plugins/@nocobase/plugin-calendar/src/client/calendar/DeleteEvent.tsx b/packages/plugins/@nocobase/plugin-calendar/src/client/calendar/DeleteEvent.tsx index fdadf924f..2a3348737 100644 --- a/packages/plugins/@nocobase/plugin-calendar/src/client/calendar/DeleteEvent.tsx +++ b/packages/plugins/@nocobase/plugin-calendar/src/client/calendar/DeleteEvent.tsx @@ -14,7 +14,7 @@ export const DeleteEvent = observer( const { visible, setVisible } = useActionContext(); const { exclude = [], cron, ...record } = useRecord(); const { close } = useContext(DeleteEventContext); - const startDate = formatDate(dayjs(record.__parent.__event.start)); + const startDate = formatDate(dayjs(record.__parent?.__event.start)); const filterByTk = useFilterByTk(); const { resource, service, __parent } = useBlockRequestContext(); const [value, onChange] = useState(startDate); diff --git a/packages/plugins/@nocobase/plugin-calendar/src/client/index.tsx b/packages/plugins/@nocobase/plugin-calendar/src/client/index.tsx index 4119903e6..de7d6fbd1 100644 --- a/packages/plugins/@nocobase/plugin-calendar/src/client/index.tsx +++ b/packages/plugins/@nocobase/plugin-calendar/src/client/index.tsx @@ -1,16 +1,21 @@ import { Plugin } from '@nocobase/client'; import { generateNTemplate } from '../locale'; import { CalendarV2 } from './calendar'; +import { calendarBlockSettings } from './calendar/Calender.Settings'; import { CalendarCollectionTemplate } from './collection-templates/calendar'; import { CalendarBlockProvider, useCalendarBlockProps } from './schema-initializer/CalendarBlockProvider'; -import { CalendarActionInitializers, CalendarFormActionInitializers } from './schema-initializer/initializers'; +import { + CalendarActionInitializers_deprecated, + CalendarFormActionInitializers, + calendarActionInitializers, + deleteEventActionInitializer, +} from './schema-initializer/initializers'; import { CalendarBlockInitializer, RecordAssociationCalendarBlockInitializer } from './schema-initializer/items'; -import { calendarBlockSettings } from './calendar/Calender.Settings'; export class PluginCalendarClient extends Plugin { async load() { this.app.dataSourceManager.addCollectionTemplates([CalendarCollectionTemplate]); - this.app.schemaInitializerManager.addItem('BlockInitializers', 'dataBlocks.calendar', { + this.app.schemaInitializerManager.addItem('page:addBlock', 'dataBlocks.calendar', { title: generateNTemplate('Calendar'), Component: 'CalendarBlockInitializer', }); @@ -22,8 +27,12 @@ export class PluginCalendarClient extends Plugin { }); this.app.addScopes({ useCalendarBlockProps }); this.schemaSettingsManager.add(calendarBlockSettings); - this.app.schemaInitializerManager.add(CalendarActionInitializers); + this.app.schemaInitializerManager.add(CalendarActionInitializers_deprecated); + this.app.schemaInitializerManager.add(calendarActionInitializers); this.app.schemaInitializerManager.add(CalendarFormActionInitializers); + this.app.schemaInitializerManager + .get('details:configureActions') + .add('enableActions.deleteEvent', deleteEventActionInitializer); } } diff --git a/packages/plugins/@nocobase/plugin-calendar/src/client/schema-initializer/initializers/CalendarActionInitializers.tsx b/packages/plugins/@nocobase/plugin-calendar/src/client/schema-initializer/initializers/CalendarActionInitializers.tsx index 1da7aa53f..23df1f694 100644 --- a/packages/plugins/@nocobase/plugin-calendar/src/client/schema-initializer/initializers/CalendarActionInitializers.tsx +++ b/packages/plugins/@nocobase/plugin-calendar/src/client/schema-initializer/initializers/CalendarActionInitializers.tsx @@ -1,8 +1,11 @@ -import { SchemaInitializer, useCollection_deprecated } from '@nocobase/client'; +import { CompatibleSchemaInitializer, useCollection_deprecated } from '@nocobase/client'; import { generateNTemplate } from '../../../locale'; -// 日历的操作配置 -export const CalendarActionInitializers: SchemaInitializer = new SchemaInitializer({ +/** + * @deprecated + * 日历的操作配置 + */ +export const CalendarActionInitializers_deprecated = new CompatibleSchemaInitializer({ title: generateNTemplate('Configure actions'), icon: 'SettingOutlined', name: 'CalendarActionInitializers', @@ -86,3 +89,91 @@ export const CalendarActionInitializers: SchemaInitializer = new SchemaInitializ }, ], }); + +export const calendarActionInitializers = new CompatibleSchemaInitializer( + { + title: generateNTemplate('Configure actions'), + icon: 'SettingOutlined', + name: 'calendar:configureActions', + style: { marginLeft: 8 }, + items: [ + { + type: 'itemGroup', + name: 'enableActions', + title: generateNTemplate('Enable actions'), + children: [ + { + name: 'today', + title: generateNTemplate('Today'), + Component: 'ActionInitializer', + schema: { + title: generateNTemplate('Today'), + 'x-component': 'CalendarV2.Today', + 'x-action': `calendar:today`, + 'x-align': 'left', + }, + }, + { + name: 'turnPages', + title: generateNTemplate('Turn pages'), + Component: 'ActionInitializer', + schema: { + title: generateNTemplate('Turn pages'), + 'x-component': 'CalendarV2.Nav', + 'x-action': `calendar:nav`, + 'x-align': 'left', + }, + }, + { + name: 'title', + title: generateNTemplate('Title'), + Component: 'ActionInitializer', + schema: { + title: generateNTemplate('Title'), + 'x-component': 'CalendarV2.Title', + 'x-action': `calendar:title`, + 'x-align': 'left', + }, + }, + { + name: 'selectView', + title: generateNTemplate('Select view'), + Component: 'ActionInitializer', + schema: { + title: generateNTemplate('Select view'), + 'x-component': 'CalendarV2.ViewSelect', + 'x-action': `calendar:viewSelect`, + 'x-align': 'right', + 'x-designer': 'Action.Designer', + }, + }, + { + name: 'filter', + title: generateNTemplate('Filter'), + Component: 'FilterActionInitializer', + schema: { + 'x-align': 'right', + }, + }, + { + name: 'addNew', + title: generateNTemplate('Add new'), + Component: 'CreateActionInitializer', + schema: { + 'x-align': 'right', + 'x-decorator': 'ACLActionProvider', + 'x-acl-action-props': { + skipScopeCheck: true, + }, + }, + useVisible() { + const collection = useCollection_deprecated(); + return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; + }, + }, + ], + }, + ], + }, + CalendarActionInitializers_deprecated, +); diff --git a/packages/plugins/@nocobase/plugin-calendar/src/client/schema-initializer/initializers/CalendarFormActionInitializers.tsx b/packages/plugins/@nocobase/plugin-calendar/src/client/schema-initializer/initializers/CalendarFormActionInitializers.tsx index 97832dea4..67bea5c3f 100644 --- a/packages/plugins/@nocobase/plugin-calendar/src/client/schema-initializer/initializers/CalendarFormActionInitializers.tsx +++ b/packages/plugins/@nocobase/plugin-calendar/src/client/schema-initializer/initializers/CalendarFormActionInitializers.tsx @@ -1,8 +1,25 @@ -import { SchemaInitializer, useCollection_deprecated } from '@nocobase/client'; +import { SchemaInitializer, SchemaInitializerItemType, useCollection_deprecated } from '@nocobase/client'; import { generateNTemplate } from '../../../locale'; -// 表单的操作配置 -export const CalendarFormActionInitializers: SchemaInitializer = new SchemaInitializer({ +export const deleteEventActionInitializer: SchemaInitializerItemType = { + name: 'deleteEvent', + title: generateNTemplate('Delete Event'), + Component: 'DeleteEventActionInitializer', + schema: { + 'x-component': 'Action', + 'x-decorator': 'ACLActionProvider', + }, + useVisible() { + const collection = useCollection_deprecated(); + return collection.template === 'calendar'; + }, +}; + +/** + * @deprecated + * 表单的操作配置 + */ +export const CalendarFormActionInitializers = new SchemaInitializer({ title: generateNTemplate('Configure actions'), name: 'CalendarFormActionInitializers', icon: 'SettingOutlined', @@ -44,19 +61,7 @@ export const CalendarFormActionInitializers: SchemaInitializer = new SchemaIniti return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; }, }, - { - name: 'deleteEvent', - title: generateNTemplate('Delete Event'), - Component: 'DeleteEventActionInitializer', - schema: { - 'x-component': 'Action', - 'x-decorator': 'ACLActionProvider', - }, - useVisible() { - const collection = useCollection_deprecated(); - return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; - }, - }, + deleteEventActionInitializer, ], }, { @@ -108,7 +113,7 @@ export const CalendarFormActionInitializers: SchemaInitializer = new SchemaIniti grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: {}, }, }, diff --git a/packages/plugins/@nocobase/plugin-calendar/src/client/schema-initializer/utils.ts b/packages/plugins/@nocobase/plugin-calendar/src/client/schema-initializer/utils.ts index a358c922b..2cfced89a 100644 --- a/packages/plugins/@nocobase/plugin-calendar/src/client/schema-initializer/utils.ts +++ b/packages/plugins/@nocobase/plugin-calendar/src/client/schema-initializer/utils.ts @@ -41,7 +41,7 @@ export const createCalendarBlockSchema = (options) => { marginBottom: 24, }, }, - 'x-initializer': 'CalendarActionInitializers', + 'x-initializer': 'calendar:configureActions', properties: {}, }, event: { @@ -62,7 +62,7 @@ export const createCalendarBlockSchema = (options) => { 'x-component-props': {}, 'x-initializer': 'TabPaneInitializers', 'x-initializer-props': { - gridInitializer: 'RecordBlockInitializers', + gridInitializer: 'popup:common:addBlock', }, properties: { tab1: { @@ -76,9 +76,9 @@ export const createCalendarBlockSchema = (options) => { type: 'void', 'x-component': 'Grid', 'x-initializer-props': { - actionInitializers: 'CalendarFormActionInitializers', + actionInitializers: 'details:configureActions', }, - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: {}, }, }, diff --git a/packages/plugins/@nocobase/plugin-charts/src/client/index.tsx b/packages/plugins/@nocobase/plugin-charts/src/client/index.tsx index 9265307db..0eff99b25 100644 --- a/packages/plugins/@nocobase/plugin-charts/src/client/index.tsx +++ b/packages/plugins/@nocobase/plugin-charts/src/client/index.tsx @@ -6,7 +6,7 @@ import { ChartBlockEngine } from './ChartBlockEngine'; import { ChartBlockInitializer } from './ChartBlockInitializer'; import { ChartQueryMetadataProvider } from './ChartQueryMetadataProvider'; import './Icons'; -import { lang, NAMESPACE } from './locale'; +import { NAMESPACE, lang } from './locale'; import { CustomSelect } from './select'; import { QueriesTable } from './settings/QueriesTable'; @@ -73,7 +73,7 @@ export class ChartsPlugin extends Plugin { } async load() { // Chart (Old) 老的不需要了 - // const blockInitializers = this.app.schemaInitializerManager.get('BlockInitializers'); + // const blockInitializers = this.app.schemaInitializerManager.get('page:addBlock'); // blockInitializers?.add('data-blocks.chart-old', { // icon: 'PieChartOutlined', // title: '{{t("Chart (Old)",{ns:"charts"})}}', diff --git a/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/attachment/schemaInitializer.test.ts b/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/attachment/schemaInitializer.test.ts index 4275cb470..c5d23c6e1 100644 --- a/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/attachment/schemaInitializer.test.ts +++ b/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/attachment/schemaInitializer.test.ts @@ -9,7 +9,7 @@ test.describe('form item & create form', () => { page, showMenu: async () => { await page.getByRole('button', { name: 'Add new' }).click(); - await page.getByLabel('schema-initializer-Grid-FormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover(); }, supportedOptions: ['markdown', 'richtext', 'attachment'], }); @@ -28,7 +28,7 @@ test.describe('form item & edit form', () => { await page.getByLabel('action-Action.Link-Edit record-update-general-table-0').click(); // 等待弹窗内容渲染完成 await page.waitForTimeout(1000); - await page.getByLabel('schema-initializer-Grid-FormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover(); }, supportedOptions: ['markdown', 'richtext', 'attachment'], }); @@ -47,7 +47,7 @@ test.describe('form item & view form', () => { await page.getByLabel('action-Action.Link-View record-view-general-table-0').click(); // 等待弹窗内容渲染完成 await page.waitForTimeout(1000); - await page.getByLabel('schema-initializer-Grid-ReadPrettyFormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-details:configureFields-general').hover(); }, supportedOptions: ['markdown', 'richtext', 'attachment'], }); diff --git a/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/belongsTo/schemaInitializer.test.ts b/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/belongsTo/schemaInitializer.test.ts index 7a92dab3f..dd3f791ac 100644 --- a/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/belongsTo/schemaInitializer.test.ts +++ b/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/belongsTo/schemaInitializer.test.ts @@ -14,7 +14,7 @@ test.describe('form item & create form', () => { page, showMenu: async () => { await page.getByRole('button', { name: 'Add new' }).click(); - await page.getByLabel('schema-initializer-Grid-FormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover(); }, supportedOptions: ['oneToMany', 'manyToOne', 'manyToMany', 'oneToOneBelongsTo', 'oneToOneHasOne'], }); @@ -32,7 +32,7 @@ test.describe('form item & edit form', () => { page, showMenu: async () => { await page.getByLabel('action-Action.Link-Edit record-update-general-table-0').click(); - await page.getByLabel('schema-initializer-Grid-FormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover(); }, supportedOptions: ['oneToMany', 'manyToOne', 'manyToMany', 'oneToOneBelongsTo', 'oneToOneHasOne'], }); @@ -49,7 +49,7 @@ test.describe('form item & view form', () => { page, showMenu: async () => { await page.getByLabel('action-Action.Link-View record-view-general-table-0').click(); - await page.getByLabel('schema-initializer-Grid-ReadPrettyFormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-details:configureFields-general').hover(); }, supportedOptions: ['oneToMany', 'manyToOne', 'manyToMany', 'oneToOneBelongsTo', 'oneToOneHasOne'], }); diff --git a/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/checkbox/schemaInitializer.test.ts b/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/checkbox/schemaInitializer.test.ts index 0e534358f..ab83df419 100644 --- a/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/checkbox/schemaInitializer.test.ts +++ b/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/checkbox/schemaInitializer.test.ts @@ -9,7 +9,7 @@ test.describe('form item & create form', () => { page, showMenu: async () => { await page.getByRole('button', { name: 'Add new' }).click(); - await page.getByLabel('schema-initializer-Grid-FormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover(); }, supportedOptions: ['checkbox', 'chinaRegion', 'multipleSelect', 'radioGroup', 'singleSelect', 'checkboxGroup'], }); @@ -26,7 +26,7 @@ test.describe('form item & edit form', () => { page, showMenu: async () => { await page.getByLabel('action-Action.Link-Edit record-update-general-table-0').click(); - await page.getByLabel('schema-initializer-Grid-FormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover(); }, supportedOptions: ['checkbox', 'chinaRegion', 'multipleSelect', 'radioGroup', 'singleSelect', 'checkboxGroup'], }); @@ -43,7 +43,7 @@ test.describe('form item & view form', () => { page, showMenu: async () => { await page.getByLabel('action-Action.Link-View record-view-general-table-0').click(); - await page.getByLabel('schema-initializer-Grid-ReadPrettyFormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-details:configureFields-general').hover(); }, supportedOptions: ['checkbox', 'chinaRegion', 'multipleSelect', 'radioGroup', 'singleSelect', 'checkboxGroup'], }); diff --git a/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/collection/schemaInitializer.test.ts b/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/collection/schemaInitializer.test.ts index a8f460d07..90ceb02b6 100644 --- a/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/collection/schemaInitializer.test.ts +++ b/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/collection/schemaInitializer.test.ts @@ -13,7 +13,7 @@ test.describe('form item & create form', () => { page, showMenu: async () => { await page.getByRole('button', { name: 'Add new' }).click(); - await page.getByLabel('schema-initializer-Grid-FormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover(); }, supportedOptions: ['formula', 'sequence', 'JSON', 'collection'], }); @@ -30,7 +30,7 @@ test.describe('form item & edit form', () => { page, showMenu: async () => { await page.getByLabel('action-Action.Link-Edit record-update-general-table-0').click(); - await page.getByLabel('schema-initializer-Grid-FormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover(); }, supportedOptions: ['formula', 'sequence', 'JSON', 'collection'], }); @@ -47,7 +47,7 @@ test.describe('form item & view form', () => { page, showMenu: async () => { await page.getByLabel('action-Action.Link-View record-view-general-table-0').click(); - await page.getByLabel('schema-initializer-Grid-ReadPrettyFormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-details:configureFields-general').hover(); }, supportedOptions: ['formula', 'sequence', 'JSON', 'collection'], }); diff --git a/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/color/schemaInitializer.test.ts b/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/color/schemaInitializer.test.ts index dd82910d1..363c198af 100644 --- a/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/color/schemaInitializer.test.ts +++ b/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/color/schemaInitializer.test.ts @@ -9,7 +9,7 @@ test.describe('form item & create form', () => { page, showMenu: async () => { await page.getByRole('button', { name: 'Add new' }).click(); - await page.getByLabel('schema-initializer-Grid-FormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover(); }, supportedOptions: [ 'color', @@ -38,7 +38,7 @@ test.describe('form item & edit form', () => { page, showMenu: async () => { await page.getByLabel('action-Action.Link-Edit record-update-general-table-0').click(); - await page.getByLabel('schema-initializer-Grid-FormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover(); }, supportedOptions: [ 'color', @@ -67,7 +67,7 @@ test.describe('form item & view form', () => { page, showMenu: async () => { await page.getByLabel('action-Action.Link-View record-view-general-table-0').click(); - await page.getByLabel('schema-initializer-Grid-ReadPrettyFormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-details:configureFields-general').hover(); }, supportedOptions: [ 'color', diff --git a/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/createdAt/schemaInitializer.test.ts b/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/createdAt/schemaInitializer.test.ts index 60dc80d84..cc3df5e70 100644 --- a/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/createdAt/schemaInitializer.test.ts +++ b/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/createdAt/schemaInitializer.test.ts @@ -13,7 +13,7 @@ test.describe('form item & create form', () => { page, showMenu: async () => { await page.getByRole('button', { name: 'Add new' }).click(); - await page.getByLabel('schema-initializer-Grid-FormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover(); }, supportedOptions: ['Created at', 'Last updated at', 'Created by', 'Last updated by', 'ID', 'Table OID'], }); @@ -30,7 +30,7 @@ test.describe('form item & edit form', () => { page, showMenu: async () => { await page.getByLabel('action-Action.Link-Edit record-update-general-table-0').click(); - await page.getByLabel('schema-initializer-Grid-FormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover(); }, supportedOptions: ['Created at', 'Last updated at', 'Created by', 'Last updated by', 'ID', 'Table OID'], }); @@ -47,7 +47,7 @@ test.describe('form item & view form', () => { page, showMenu: async () => { await page.getByLabel('action-Action.Link-View').click(); - await page.getByLabel('schema-initializer-Grid-ReadPrettyFormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-details:configureFields-general').hover(); }, supportedOptions: ['Created at', 'Last updated at', 'Created by', 'Last updated by', 'ID', 'Table OID'], }); diff --git a/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/datetime/schemaInitializer.test.ts b/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/datetime/schemaInitializer.test.ts index 0f982e116..1ef8819d9 100644 --- a/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/datetime/schemaInitializer.test.ts +++ b/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/datetime/schemaInitializer.test.ts @@ -13,7 +13,7 @@ test.describe('form item & create form', () => { page, showMenu: async () => { await page.getByRole('button', { name: 'Add new' }).click(); - await page.getByLabel('schema-initializer-Grid-FormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover(); }, supportedOptions: ['datetime', 'time'], }); @@ -30,7 +30,7 @@ test.describe('form item & edit form', () => { page, showMenu: async () => { await page.getByLabel('action-Action.Link-Edit record-update-general-table-0').click(); - await page.getByLabel('schema-initializer-Grid-FormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover(); }, supportedOptions: ['datetime', 'time'], }); @@ -47,7 +47,7 @@ test.describe('form item & view form', () => { page, showMenu: async () => { await page.getByLabel('action-Action.Link-View record-view-general-table-0').click(); - await page.getByLabel('schema-initializer-Grid-ReadPrettyFormItemInitializers-general').hover(); + await page.getByLabel('schema-initializer-Grid-details:configureFields-general').hover(); }, supportedOptions: ['datetime', 'time'], }); diff --git a/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/manyToMany/schemaSettings.test.ts b/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/manyToMany/schemaSettings.test.ts index 8ab817f29..87b53d701 100644 --- a/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/manyToMany/schemaSettings.test.ts +++ b/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/manyToMany/schemaSettings.test.ts @@ -260,7 +260,7 @@ test.describe('form item & create form', () => { await expect( page .getByLabel('block-item-CollectionField-general-form-general.manyToMany-manyToMany') - .getByLabel('schema-initializer-AssociationField.SubTable-TableColumnInitializers-users'), + .getByLabel('schema-initializer-AssociationField.SubTable-table:configureColumns-users'), ).toBeVisible(); // 选择 Sub-form @@ -275,7 +275,7 @@ test.describe('form item & create form', () => { await expect( page .getByLabel('block-item-CollectionField-general-form-general.manyToMany-manyToMany') - .getByLabel('schema-initializer-Grid-FormItemInitializers-users'), + .getByLabel('schema-initializer-Grid-form:configureFields-users'), ).toBeVisible(); // 选择 Sub-form(Popover) diff --git a/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/utils.ts b/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/utils.ts index 616c47b33..97b646c26 100644 --- a/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/utils.ts +++ b/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/utils.ts @@ -6,7 +6,7 @@ export async function showSettingsMenu(page: Page, fieldName: string) { } export async function createColumnItem(page: Page, fieldName: string) { - await page.getByLabel('schema-initializer-TableV2-TableColumnInitializers-general').hover(); + await page.getByLabel('schema-initializer-TableV2-table:configureColumns-general').hover(); await page.getByRole('menuitem', { name: fieldName, exact: true }).click(); await page.mouse.move(300, 0); } diff --git a/packages/plugins/@nocobase/plugin-custom-request/src/client/__e2e__/schemaSettings.test.ts b/packages/plugins/@nocobase/plugin-custom-request/src/client/__e2e__/schemaSettings.test.ts index a3bd9265b..bb4a46bc2 100644 --- a/packages/plugins/@nocobase/plugin-custom-request/src/client/__e2e__/schemaSettings.test.ts +++ b/packages/plugins/@nocobase/plugin-custom-request/src/client/__e2e__/schemaSettings.test.ts @@ -5,7 +5,7 @@ test('edit button', async ({ page, mockPage, mockRecord }) => { await mockRecord('t_unp4scqamw9'); // 新建一个 custom request action - await page.getByRole('button', { name: 'Actions' }).hover(); + await page.getByRole('button', { name: 'Actions', exact: true }).hover(); await page.getByLabel('designer-schema-settings-TableV2.Column-TableV2.ActionColumnDesigner-').hover(); await page.getByRole('menuitem', { name: 'Customize right' }).hover(); await page.getByRole('menuitem', { name: 'Custom request' }).click(); diff --git a/packages/plugins/@nocobase/plugin-data-visualization/src/client/block/ChartBlockInitializer.tsx b/packages/plugins/@nocobase/plugin-data-visualization/src/client/block/ChartBlockInitializer.tsx index 7683f1327..07ebb20af 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/src/client/block/ChartBlockInitializer.tsx +++ b/packages/plugins/@nocobase/plugin-data-visualization/src/client/block/ChartBlockInitializer.tsx @@ -1,8 +1,8 @@ import { BarChartOutlined, LineChartOutlined } from '@ant-design/icons'; import { uid } from '@formily/shared'; import { + CompatibleSchemaInitializer, DataBlockInitializer, - SchemaInitializer, SchemaInitializerItem, useACLRoleContext, useSchemaInitializer, @@ -46,7 +46,10 @@ const ChartInitializer = () => { ); }; -export const chartInitializers: SchemaInitializer = new SchemaInitializer({ +/** + * @deprecated + */ +export const chartInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'ChartInitializers', icon: 'PlusOutlined', title: '{{t("Add block")}}', @@ -71,6 +74,34 @@ export const chartInitializers: SchemaInitializer = new SchemaInitializer({ ], }); +export const chartInitializers = new CompatibleSchemaInitializer( + { + name: 'charts:addBlock', + icon: 'PlusOutlined', + title: '{{t("Add block")}}', + items: [ + { + name: 'chart', + title: lang('Chart'), + Component: ChartInitializer, + }, + { + name: 'otherBlocks', + type: 'itemGroup', + title: lang('Other blocks'), + children: [ + { + name: 'filter', + title: lang('Filter'), + Component: FilterBlockInitializer, + }, + ], + }, + ], + }, + chartInitializers_deprecated, +); + export const ChartV2BlockInitializer: React.FC = () => { const itemConfig = useSchemaInitializerItem(); const { insert } = useSchemaInitializer(); @@ -91,7 +122,7 @@ export const ChartV2BlockInitializer: React.FC = () => { type: 'void', 'x-component': 'Grid', 'x-decorator': 'ChartV2Block', - 'x-initializer': 'ChartInitializers', + 'x-initializer': 'charts:addBlock', }, }, }); diff --git a/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterActionInitializers.tsx b/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterActionInitializers.tsx index 15c7e4a53..7e400fc47 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterActionInitializers.tsx +++ b/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterActionInitializers.tsx @@ -3,8 +3,8 @@ import { useForm } from '@formily/react'; import { Action, ActionInitializer, + CompatibleSchemaInitializer, GeneralSchemaDesigner, - SchemaInitializer, SchemaSettingsDivider, SchemaSettingsRemove, } from '@nocobase/client'; @@ -125,7 +125,10 @@ const ChartFilterCollapseInitializer = (props) => { return ; }; -export const chartFilterActionInitializers: SchemaInitializer = new SchemaInitializer({ +/** + * @deprecated + */ +export const chartFilterActionInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'ChartFilterActionInitializers', 'data-testid': 'configure-actions-button-of-chart-filter', title: '{{t("Configure actions")}}', @@ -167,3 +170,49 @@ export const chartFilterActionInitializers: SchemaInitializer = new SchemaInitia }, ], }); + +export const chartFilterActionInitializers = new CompatibleSchemaInitializer( + { + name: 'chartFilterForm:configureActions', + 'data-testid': 'configure-actions-button-of-chart-filter', + title: '{{t("Configure actions")}}', + icon: 'SettingOutlined', + items: [ + { + name: 'enbaleActions', + type: 'itemGroup', + title: '{{t("Enable actions")}}', + children: [ + { + name: 'filter', + type: 'item', + title: '{{t("Filter")}}', + component: ChartFilterActionInitializer, + schema: { + 'x-action-settings': {}, + }, + }, + { + name: 'reset', + type: 'item', + title: '{{t("Reset")}}', + component: ChartFilterResetInitializer, + schema: { + 'x-action-settings': {}, + }, + }, + { + name: 'collapse', + type: 'item', + title: '{{t("Collapse")}}', + component: ChartFilterCollapseInitializer, + schema: { + 'x-action-settings': {}, + }, + }, + ], + }, + ], + }, + chartFilterActionInitializers_deprecated, +); diff --git a/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterBlockInitializer.tsx b/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterBlockInitializer.tsx index f85276afa..56cdb3cfb 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterBlockInitializer.tsx +++ b/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterBlockInitializer.tsx @@ -31,12 +31,12 @@ const createFilterSchema = () => { grid: { type: 'void', 'x-component': 'ChartFilterGrid', - 'x-initializer': 'ChartFilterItemInitializers', + 'x-initializer': 'chartFilterForm:configureFields', properties: {}, }, actions: { type: 'void', - 'x-initializer': 'ChartFilterActionInitializers', + 'x-initializer': 'chartFilterForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', diff --git a/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterItemInitializers.tsx b/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterItemInitializers.tsx index baa269873..6fa6c3fc8 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterItemInitializers.tsx +++ b/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterItemInitializers.tsx @@ -8,11 +8,11 @@ import { BlockItem, CollectionFieldProvider, CollectionProvider, + CompatibleSchemaInitializer, FormDialog, HTMLEncode, SchemaComponent, SchemaComponentOptions, - SchemaInitializer, SchemaInitializerItem, gridRowColWrap, useCollectionManager_deprecated, @@ -227,7 +227,10 @@ export const ChartFilterCustomItemInitializer: React.FC<{ }); ChartFilterCustomItemInitializer.displayName = 'ChartFilterCustomItemInitializer'; -export const chartFilterItemInitializers: SchemaInitializer = new SchemaInitializer({ +/** + * @deprecated + */ +export const chartFilterItemInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'ChartFilterItemInitializers', 'data-testid': 'configure-fields-button-of-chart-filter-item', wrap: gridRowColWrap, @@ -273,3 +276,53 @@ export const chartFilterItemInitializers: SchemaInitializer = new SchemaInitiali }, ], }); + +export const chartFilterItemInitializers = new CompatibleSchemaInitializer( + { + name: 'chartFilterForm:configureFields', + 'data-testid': 'configure-fields-button-of-chart-filter-item', + wrap: gridRowColWrap, + icon: 'SettingOutlined', + title: '{{ t("Configure fields") }}', + items: [ + { + type: 'itemGroup', + name: 'displayFields', + title: '{{ t("Display fields") }}', + useChildren: () => { + const { getCollection } = useCollectionManager_deprecated(); + const { getChartCollections } = useChartData(); + const { getChartFilterFields } = useChartFilter(); + const collections = getChartCollections(); + + return useMemo(() => { + return collections.map((name: any) => { + const collection = getCollection(name); + const fields = getChartFilterFields(collection); + return { + name: collection.key, + type: 'subMenu', + title: collection.title, + children: fields, + }; + }); + }, [collections]); + }, + }, + { + name: 'divider', + type: 'divider', + }, + { + name: 'custom', + type: 'item', + title: lang('Custom'), + Component: () => { + const { insertAdjacent } = useDesignable(); + return insertAdjacent('beforeEnd', s)} />; + }, + }, + ], + }, + chartFilterItemInitializers_deprecated, +); diff --git a/packages/plugins/@nocobase/plugin-data-visualization/src/client/index.tsx b/packages/plugins/@nocobase/plugin-data-visualization/src/client/index.tsx index 793222d4a..b311511f5 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/src/client/index.tsx +++ b/packages/plugins/@nocobase/plugin-data-visualization/src/client/index.tsx @@ -1,10 +1,21 @@ import { Plugin } from '@nocobase/client'; -import { ChartV2Block, ChartV2BlockDesigner, ChartV2BlockInitializer, chartInitializers } from './block'; +import { + ChartV2Block, + ChartV2BlockDesigner, + ChartV2BlockInitializer, + chartInitializers, + chartInitializers_deprecated, +} from './block'; import antd from './chart/antd'; import g2plot from './chart/g2plot'; import { ChartGroup } from './chart/group'; +import { + chartFilterActionInitializers, + chartFilterActionInitializers_deprecated, + chartFilterItemInitializers, + chartFilterItemInitializers_deprecated, +} from './filter'; import { lang } from './locale'; -import { chartFilterActionInitializers, chartFilterItemInitializers } from './filter'; class DataVisualizationPlugin extends Plugin { public charts: ChartGroup = new ChartGroup(); @@ -18,11 +29,14 @@ class DataVisualizationPlugin extends Plugin { ChartV2Block, }); + this.app.schemaInitializerManager.add(chartInitializers_deprecated); this.app.schemaInitializerManager.add(chartInitializers); + this.app.schemaInitializerManager.add(chartFilterItemInitializers_deprecated); this.app.schemaInitializerManager.add(chartFilterItemInitializers); + this.app.schemaInitializerManager.add(chartFilterActionInitializers_deprecated); this.app.schemaInitializerManager.add(chartFilterActionInitializers); - const blockInitializers = this.app.schemaInitializerManager.get('BlockInitializers'); + const blockInitializers = this.app.schemaInitializerManager.get('page:addBlock'); blockInitializers?.add('dataBlocks.chartV2', { title: lang('Charts'), Component: 'ChartV2BlockInitializer', @@ -33,6 +47,6 @@ class DataVisualizationPlugin extends Plugin { export default DataVisualizationPlugin; export { Chart } from './chart/chart'; export type { ChartProps, ChartType, RenderProps } from './chart/chart'; +export { ChartConfigContext } from './configure'; export type { FieldOption } from './hooks'; export type { QueryProps } from './renderer'; -export { ChartConfigContext } from './configure'; diff --git a/packages/plugins/@nocobase/plugin-data-visualization/src/client/utils.ts b/packages/plugins/@nocobase/plugin-data-visualization/src/client/utils.ts index 2e8e842d0..0d6d4d98b 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/src/client/utils.ts +++ b/packages/plugins/@nocobase/plugin-data-visualization/src/client/utils.ts @@ -1,9 +1,9 @@ import { Schema } from '@formily/react'; import { uid } from '@formily/shared'; +import lodash from 'lodash'; import { SelectedField } from './configure'; import { FieldOption } from './hooks'; import { QueryProps } from './renderer'; -import lodash from 'lodash'; export const createRendererSchema = (decoratorProps: any, componentProps = {}) => { const { collection } = decoratorProps; @@ -17,7 +17,7 @@ export const createRendererSchema = (decoratorProps: any, componentProps = {}) = 'x-component-props': { size: 'small', }, - 'x-initializer': 'ChartInitializers', + 'x-initializer': 'charts:addBlock', properties: { [uid()]: { type: 'void', diff --git a/packages/plugins/@nocobase/plugin-export/src/client/index.ts b/packages/plugins/@nocobase/plugin-export/src/client/index.ts index 97ee42a6a..f503debb0 100644 --- a/packages/plugins/@nocobase/plugin-export/src/client/index.ts +++ b/packages/plugins/@nocobase/plugin-export/src/client/index.ts @@ -22,9 +22,9 @@ export class ExportPlugin extends Plugin { }, }; - const tableActionInitializers = this.app.schemaInitializerManager.get('TableActionInitializers'); + const tableActionInitializers = this.app.schemaInitializerManager.get('table:configureActions'); tableActionInitializers?.add('enableActions.export', initializerData); - this.app.schemaInitializerManager.addItem('GanttActionInitializers', 'enableActions.export', initializerData); + this.app.schemaInitializerManager.addItem('gantt:configureActions', 'enableActions.export', initializerData); this.app.schemaSettingsManager.add(exportActionSchemaSettings); } } diff --git a/packages/plugins/@nocobase/plugin-file-manager/src/client/index.tsx b/packages/plugins/@nocobase/plugin-file-manager/src/client/index.tsx index dff9a349d..f8bbea241 100644 --- a/packages/plugins/@nocobase/plugin-file-manager/src/client/index.tsx +++ b/packages/plugins/@nocobase/plugin-file-manager/src/client/index.tsx @@ -24,7 +24,7 @@ export class FileManagerPlugin extends Plugin { this.registerStorageType(storageType.name, storageType); }); - const tableActionInitializers = this.app.schemaInitializerManager.get('TableActionInitializers'); + const tableActionInitializers = this.app.schemaInitializerManager.get('table:configureActions'); tableActionInitializers?.add('enableActions.upload', { title: "{{t('Upload')}}", Component: 'UploadActionInitializer', diff --git a/packages/plugins/@nocobase/plugin-gantt/src/client/GanttActionInitializers.tsx b/packages/plugins/@nocobase/plugin-gantt/src/client/GanttActionInitializers.tsx index d20332963..b7368dafa 100644 --- a/packages/plugins/@nocobase/plugin-gantt/src/client/GanttActionInitializers.tsx +++ b/packages/plugins/@nocobase/plugin-gantt/src/client/GanttActionInitializers.tsx @@ -1,7 +1,10 @@ import { useFieldSchema } from '@formily/react'; -import { SchemaInitializer, useCollection_deprecated } from '@nocobase/client'; +import { CompatibleSchemaInitializer, useCollection_deprecated } from '@nocobase/client'; -export const GanttActionInitializers: SchemaInitializer = new SchemaInitializer({ +/** + * @deprecated + */ +export const GanttActionInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'GanttActionInitializers', title: "{{t('Configure actions')}}", icon: 'SettingOutlined', @@ -146,3 +149,152 @@ export const GanttActionInitializers: SchemaInitializer = new SchemaInitializer( }, ], }); + +export const ganttActionInitializers = new CompatibleSchemaInitializer( + { + name: 'gantt:configureActions', + title: "{{t('Configure actions')}}", + icon: 'SettingOutlined', + style: { + marginLeft: 8, + }, + items: [ + { + type: 'itemGroup', + name: 'enableActions', + title: "{{t('Enable actions')}}", + children: [ + { + type: 'item', + name: 'filter', + title: "{{t('Filter')}}", + Component: 'FilterActionInitializer', + schema: { + 'x-align': 'left', + }, + }, + { + type: 'item', + title: "{{t('Add new')}}", + name: 'addNew', + Component: 'CreateActionInitializer', + schema: { + 'x-align': 'right', + 'x-decorator': 'ACLActionProvider', + 'x-acl-action-props': { + skipScopeCheck: true, + }, + }, + useVisible() { + const collection = useCollection_deprecated(); + return !['view', 'file', 'sql'].includes(collection.template) || collection?.writableView; + }, + }, + { + type: 'item', + title: "{{t('Delete')}}", + name: 'delete', + Component: 'BulkDestroyActionInitializer', + schema: { + 'x-align': 'right', + 'x-decorator': 'ACLActionProvider', + }, + useVisible() { + const collection = useCollection_deprecated(); + return !['view', 'sql'].includes(collection.template) || collection?.writableView; + }, + }, + { + type: 'item', + title: "{{t('Refresh')}}", + name: 'refresh', + Component: 'RefreshActionInitializer', + schema: { + 'x-align': 'right', + }, + }, + { + name: 'toggle', + title: "{{t('Expand/Collapse')}}", + Component: 'ExpandableActionInitializer', + schema: { + 'x-align': 'right', + }, + useVisible() { + const schema = useFieldSchema(); + const collection = useCollection_deprecated(); + const { treeTable } = schema?.parent?.['x-decorator-props'] || {}; + return collection.tree && treeTable !== false; + }, + }, + ], + }, + { + name: 'divider', + type: 'divider', + useVisible() { + const collection = useCollection_deprecated(); + return !['view', 'sql'].includes(collection.template) || collection?.writableView; + }, + }, + { + type: 'subMenu', + name: 'customize', + title: '{{t("Customize")}}', + children: [ + // { + // type: 'item', + // title: '{{t("Bulk update")}}', + // Component: 'CustomizeActionInitializer', + // name: 'bulkUpdate', + // schema: { + // type: 'void', + // title: '{{ t("Bulk update") }}', + // 'x-component': 'Action', + // 'x-align': 'right', + // 'x-acl-action': 'update', + // 'x-decorator': 'ACLActionProvider', + // 'x-acl-action-props': { + // skipScopeCheck: true, + // }, + // 'x-action': 'customize:bulkUpdate', + // 'x-designer': 'Action.Designer', + // 'x-action-settings': { + // assignedValues: {}, + // updateMode: 'selected', + // onSuccess: { + // manualClose: true, + // redirecting: false, + // successMessage: '{{t("Updated successfully")}}', + // }, + // }, + // 'x-component-props': { + // icon: 'EditOutlined', + // useProps: '{{ useCustomizeBulkUpdateActionProps }}', + // }, + // }, + // }, + { + type: 'item', + title: '{{t("Add record")}}', + name: 'addRecord', + Component: 'CustomizeAddRecordActionInitializer', + schema: { + 'x-align': 'right', + 'x-decorator': 'ACLActionProvider', + 'x-acl-action': 'create', + 'x-acl-action-props': { + skipScopeCheck: true, + }, + }, + }, + ], + useVisible() { + const collection = useCollection_deprecated(); + return !['view', 'sql'].includes(collection.template) || collection?.writableView; + }, + }, + ], + }, + GanttActionInitializers_deprecated, +); diff --git a/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/drag.test.ts b/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/drag.test.ts index 4874963eb..c054f0d15 100644 --- a/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/drag.test.ts +++ b/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/drag.test.ts @@ -16,7 +16,7 @@ test('drag and adjust start time, end time, and progress', async ({ page, mockPa await page.getByRole('option', { name: 'Week' }).click(); await page.getByRole('menuitem', { name: 'Time scale' }).hover(); await page.mouse.move(300, 0); - await page.getByRole('button', { name: 'Actions' }).click(); + await page.getByRole('button', { name: 'Actions', exact: true }).click(); await expect(page.locator('.calendarBottomText').first()).toHaveText(/W/); await page.locator('.bar ').hover(); const draggableElement = await page.getByLabel('task-bar').getByRole('button').first(); diff --git a/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/schemaInitailizer.test.ts b/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/schemaInitailizer.test.ts index 880ecc635..5a5569ca4 100644 --- a/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/schemaInitailizer.test.ts +++ b/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/schemaInitailizer.test.ts @@ -4,7 +4,7 @@ import { generalWithDatetimeFields, oneEmptyGantt } from './utils'; test('BlockInitializers should add gantt block', async ({ page, mockPage, mockCollections }) => { await mockCollections(generalWithDatetimeFields); await mockPage().goto(); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').click(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').click(); await page.getByRole('menuitem', { name: 'form Gantt right' }).click(); await page.getByRole('menuitem', { name: 'General' }).click(); await page.getByLabel('block-item-Select-Title field').click(); @@ -25,7 +25,7 @@ test('BlockInitializers should add gantt block', async ({ page, mockPage, mockCo test.describe('configure fields', () => { test('add field,then remove field in gantt block', async ({ page, mockPage, mockRecord }) => { await mockPage(oneEmptyGantt).goto(); - await page.getByLabel('schema-initializer-TableV2-TableColumnInitializers-general').hover(); + await page.getByLabel('schema-initializer-TableV2-table:configureColumns-general').hover(); await page.getByRole('menuitem', { name: 'ID' }).click(); await page.getByRole('menuitem', { name: 'Single line text2' }).click(); //添加字段 @@ -43,7 +43,7 @@ test.describe('configure fields', () => { test('add assciation field should appends association', async ({ page, mockPage, mockRecord }) => { await mockPage(oneEmptyGantt).goto(); await mockRecord('general', { singleLineText: 'singleLineText', manyToOne: { id: 1 } }); - await page.getByLabel('schema-initializer-TableV2-TableColumnInitializers-general').hover(); + await page.getByLabel('schema-initializer-TableV2-table:configureColumns-general').hover(); //关系字段,断言请求的appends是否符合预期 const [request] = await Promise.all([ @@ -75,7 +75,7 @@ test.describe('configure fields', () => { test.describe('configure actions', () => { test('configure button in gannt block', async ({ page, mockPage }) => { await mockPage(oneEmptyGantt).goto(); - await page.getByLabel('schema-initializer-ActionBar-GanttActionInitializers-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-gantt:configureActions-general').hover(); await page.getByRole('menuitem', { name: 'Filter' }).getByRole('switch').click(); await page.getByRole('menuitem', { name: 'Add new' }).click(); await page.getByRole('menuitem', { name: 'Delete' }).click(); diff --git a/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/schemaSettings.test.ts b/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/schemaSettings.test.ts index e57c90439..8db3544ba 100644 --- a/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/schemaSettings.test.ts +++ b/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/schemaSettings.test.ts @@ -43,7 +43,7 @@ test.describe('configure params in gantt block', () => { await page.getByLabel('designer-schema-settings-CardItem-Gantt.Designer-general').hover(); await page.getByRole('menuitem', { name: 'Title field' }).click(); await page.getByRole('option', { name: 'Single line text2' }).locator('div').click(); - await page.getByRole('button', { name: 'Actions' }).click(); + await page.getByRole('button', { name: 'Actions', exact: true }).click(); await page.mouse.move(300, 0); const barLabel = page.getByLabel('block-item-gantt').locator('.barLabel'); await barLabel.hover(); @@ -57,7 +57,7 @@ test.describe('configure params in gantt block', () => { await page.getByRole('menuitem', { name: 'Start date field' }).click(); await page.getByRole('option', { name: 'Start date time2' }).locator('div').click(); await page.mouse.move(300, 0); - await page.getByRole('button', { name: 'Actions' }).click(); + await page.getByRole('button', { name: 'Actions', exact: true }).click(); await page.locator('.bar').hover({ position: { x: 20, y: 10 } }); await expect(page.getByLabel('nb-gantt-tooltip')).toHaveText( new RegExp(String(getYmd(new Date(mockData['startDatetime2'])))), @@ -72,7 +72,7 @@ test.describe('configure params in gantt block', () => { await page.getByRole('menuitem', { name: 'End date field' }).click(); await page.getByRole('option', { name: 'End date time2' }).locator('div').click(); await page.mouse.move(300, 0); - await page.getByRole('button', { name: 'Actions' }).click(); + await page.getByRole('button', { name: 'Actions', exact: true }).click(); await page.locator('.bar').hover({ position: { x: 20, y: 10 } }); await expect(page.getByLabel('nb-gantt-tooltip')).toHaveText( new RegExp(String(getYmd(new Date(mockData['endDatetime2'])))), @@ -88,7 +88,7 @@ test.describe('configure params in gantt block', () => { await page.getByRole('option', { name: 'Week' }).click(); await page.getByRole('menuitem', { name: 'Time scale' }).hover(); await page.mouse.move(300, 0); - await page.getByRole('button', { name: 'Actions' }).click(); + await page.getByRole('button', { name: 'Actions', exact: true }).click(); await page.locator('.bar').hover({ position: { x: 20, y: 10 } }); await expect(page.locator('.calendarBottomText').first()).toHaveText(/W/); }); diff --git a/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/utils.ts b/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/utils.ts index 806fc3866..de81821fd 100644 --- a/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/utils.ts +++ b/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/utils.ts @@ -140,7 +140,7 @@ export const oneEmptyGantt: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { gl57m4hyewf: { _isJSONSchemaObject: true, @@ -197,7 +197,7 @@ export const oneEmptyGantt: PageConfig = { marginBottom: 24, }, }, - 'x-initializer': 'GanttActionInitializers', + 'x-initializer': 'gantt:configureActions', 'x-uid': 'guwovmwt4c0', 'x-async': false, 'x-index': 1, @@ -213,7 +213,7 @@ export const oneEmptyGantt: PageConfig = { maxWidth: '35%', }, }, - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -233,7 +233,7 @@ export const oneEmptyGantt: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { _isJSONSchemaObject: true, @@ -296,7 +296,7 @@ export const oneEmptyGantt: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', 'x-uid': 'gxtfjqzxbfu', 'x-async': false, 'x-index': 1, diff --git a/packages/plugins/@nocobase/plugin-gantt/src/client/index.tsx b/packages/plugins/@nocobase/plugin-gantt/src/client/index.tsx index e2e963038..496f02507 100644 --- a/packages/plugins/@nocobase/plugin-gantt/src/client/index.tsx +++ b/packages/plugins/@nocobase/plugin-gantt/src/client/index.tsx @@ -2,7 +2,7 @@ import { ActionBar, CurrentAppInfoProvider, Plugin, SchemaComponentOptions } fro import React from 'react'; import { GanttDesigner } from './Gantt.Designer'; import { ganttSettings, oldGanttSettings } from './Gantt.Settings'; -import { GanttActionInitializers } from './GanttActionInitializers'; +import { GanttActionInitializers_deprecated, ganttActionInitializers } from './GanttActionInitializers'; import { GanttBlockInitializer } from './GanttBlockInitializer'; import { GanttBlockProvider, useGanttBlockProps } from './GanttBlockProvider'; import { Event } from './components/gantt/Event'; @@ -34,8 +34,9 @@ export class GanttPlugin extends Plugin { this.app.use(GanttProvider); this.app.schemaSettingsManager.add(oldGanttSettings); this.app.schemaSettingsManager.add(ganttSettings); - this.app.schemaInitializerManager.add(GanttActionInitializers); - const blockInitializers = this.app.schemaInitializerManager.get('BlockInitializers'); + this.app.schemaInitializerManager.add(GanttActionInitializers_deprecated); + this.app.schemaInitializerManager.add(ganttActionInitializers); + const blockInitializers = this.app.schemaInitializerManager.get('page:addBlock'); blockInitializers?.add('dataBlocks.gantt', { title: "{{t('Gantt')}}", Component: 'GanttBlockInitializer', diff --git a/packages/plugins/@nocobase/plugin-gantt/src/client/utils.tsx b/packages/plugins/@nocobase/plugin-gantt/src/client/utils.tsx index c37497183..667011506 100644 --- a/packages/plugins/@nocobase/plugin-gantt/src/client/utils.tsx +++ b/packages/plugins/@nocobase/plugin-gantt/src/client/utils.tsx @@ -1,6 +1,6 @@ import { ISchema } from '@formily/react'; import { uid } from '@formily/shared'; -import { useCompile, useCollection_deprecated } from '@nocobase/client'; +import { useCollection_deprecated, useCompile } from '@nocobase/client'; import { useTranslation } from 'react-i18next'; export const useGanttTranslation = () => { @@ -55,7 +55,7 @@ export const createGanttBlockSchema = (options) => { marginBottom: 24, }, }, - 'x-initializer': 'GanttActionInitializers', + 'x-initializer': 'gantt:configureActions', properties: {}, }, table: { @@ -68,7 +68,7 @@ export const createGanttBlockSchema = (options) => { }, }, - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -86,7 +86,7 @@ export const createGanttBlockSchema = (options) => { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { actions: { type: 'void', @@ -129,7 +129,7 @@ export const createGanttBlockSchema = (options) => { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: {}, }, }, diff --git a/packages/plugins/@nocobase/plugin-iframe-block/src/client/IframeBlockInitializer.tsx b/packages/plugins/@nocobase/plugin-iframe-block/src/client/IframeBlockInitializer.tsx index 9bc2742e5..54705ed47 100644 --- a/packages/plugins/@nocobase/plugin-iframe-block/src/client/IframeBlockInitializer.tsx +++ b/packages/plugins/@nocobase/plugin-iframe-block/src/client/IframeBlockInitializer.tsx @@ -12,7 +12,7 @@ export const IframeBlockInitializer = () => { onClick={() => { insert({ type: 'void', - 'x-settings': 'iframeBlockSchemaSettings', + 'x-settings': 'blockSettings:iframe', 'x-decorator': 'BlockItem', 'x-decorator-props': { name: 'iframe', diff --git a/packages/plugins/@nocobase/plugin-iframe-block/src/client/index.ts b/packages/plugins/@nocobase/plugin-iframe-block/src/client/index.ts index c19b0ab02..a30d4869d 100644 --- a/packages/plugins/@nocobase/plugin-iframe-block/src/client/index.ts +++ b/packages/plugins/@nocobase/plugin-iframe-block/src/client/index.ts @@ -1,24 +1,25 @@ import { Plugin } from '@nocobase/client'; import { IframeBlockProvider } from './IframeBlockProvider'; -import { iframeBlockSchemaSettings } from './schemaSettings'; +import { iframeBlockSchemaSettings, iframeBlockSchemaSettings_deprecated } from './schemaSettings'; export class IframeBlockPlugin extends Plugin { async load() { + this.app.schemaSettingsManager.add(iframeBlockSchemaSettings_deprecated); this.app.schemaSettingsManager.add(iframeBlockSchemaSettings); this.app.use(IframeBlockProvider); - const blockInitializers = this.app.schemaInitializerManager.get('BlockInitializers'); + const blockInitializers = this.app.schemaInitializerManager.get('page:addBlock'); blockInitializers?.add('otherBlocks.iframe', { title: '{{t("Iframe")}}', Component: 'IframeBlockInitializer', }); - const createFormBlockInitializers = this.app.schemaInitializerManager.get('CreateFormBlockInitializers'); + const createFormBlockInitializers = this.app.schemaInitializerManager.get('popup:addNew:addBlock'); createFormBlockInitializers?.add('otherBlocks.iframe', { title: '{{t("Iframe")}}', Component: 'IframeBlockInitializer', }); - const recordBlockInitializers = this.app.schemaInitializerManager.get('RecordBlockInitializers'); + const recordBlockInitializers = this.app.schemaInitializerManager.get('popup:common:addBlock'); recordBlockInitializers?.add('otherBlocks.iframe', { title: '{{t("Iframe")}}', Component: 'IframeBlockInitializer', diff --git a/packages/plugins/@nocobase/plugin-iframe-block/src/client/schemaSettings.ts b/packages/plugins/@nocobase/plugin-iframe-block/src/client/schemaSettings.ts index d4141a7c9..771a14d6e 100644 --- a/packages/plugins/@nocobase/plugin-iframe-block/src/client/schemaSettings.ts +++ b/packages/plugins/@nocobase/plugin-iframe-block/src/client/schemaSettings.ts @@ -3,7 +3,10 @@ import { uid } from '@formily/shared'; import { SchemaSettings, useAPIClient, useDesignable } from '@nocobase/client'; import { useTranslation } from 'react-i18next'; -export const iframeBlockSchemaSettings = new SchemaSettings({ +/** + * @deprecated + */ +export const iframeBlockSchemaSettings_deprecated = new SchemaSettings({ name: 'iframeBlockSchemaSettings', items: [ { @@ -143,3 +146,144 @@ export const iframeBlockSchemaSettings = new SchemaSettings({ }, ], }); + +export const iframeBlockSchemaSettings = new SchemaSettings({ + name: 'blockSettings:iframe', + items: [ + { + name: 'EditIframe', + type: 'modal', + useComponentProps() { + const field = useField(); + const fieldSchema = useFieldSchema(); + const { t } = useTranslation(); + const { dn } = useDesignable(); + const api = useAPIClient(); + const { mode, url, htmlId, height = '60vh' } = fieldSchema['x-component-props'] || {}; + + const saveHtml = async (html: string) => { + const options = { + values: { html }, + }; + if (htmlId) { + // eslint-disable-next-line no-unsafe-optional-chaining + const { data } = await api.resource('iframeHtml').update?.({ ...options, filterByTk: htmlId }); + return data?.data?.[0] || { id: htmlId }; + } else { + // eslint-disable-next-line no-unsafe-optional-chaining + const { data } = await api.resource('iframeHtml').create?.(options); + return data?.data; + } + }; + + const submitHandler = async ({ mode, url, html, height }) => { + const componentProps = fieldSchema['x-component-props'] || {}; + componentProps['mode'] = mode; + componentProps['height'] = height; + componentProps['url'] = url; + if (mode === 'html') { + const data = await saveHtml(html); + componentProps['htmlId'] = data.id; + } + fieldSchema['x-component-props'] = componentProps; + field.componentProps = { ...componentProps }; + field.data = { v: uid() }; + dn.emit('patch', { + schema: { + 'x-uid': fieldSchema['x-uid'], + 'x-component-props': componentProps, + }, + }); + }; + + return { + title: t('Edit iframe'), + asyncGetInitialValues: async () => { + const values = { + mode, + url, + height, + }; + if (htmlId) { + // eslint-disable-next-line no-unsafe-optional-chaining + const { data } = await api.resource('iframeHtml').get?.({ filterByTk: htmlId }); + values['html'] = data?.data?.html || ''; + } + return values; + }, + schema: { + type: 'object', + title: t('Edit iframe'), + properties: { + mode: { + title: '{{t("Mode")}}', + 'x-component': 'Radio.Group', + 'x-decorator': 'FormItem', + required: true, + default: 'url', + enum: [ + { value: 'url', label: t('URL') }, + { value: 'html', label: t('html') }, + ], + }, + url: { + title: t('URL'), + type: 'string', + 'x-decorator': 'FormItem', + 'x-component': 'Input', + required: true, + 'x-reactions': { + dependencies: ['mode'], + fulfill: { + state: { + hidden: '{{$deps[0] === "html"}}', + }, + }, + }, + }, + html: { + title: t('html'), + type: 'string', + 'x-decorator': 'FormItem', + 'x-component': 'Input.TextArea', + required: true, + 'x-reactions': { + dependencies: ['mode'], + fulfill: { + state: { + hidden: '{{$deps[0] === "url"}}', + }, + }, + }, + }, + height: { + title: t('Height'), + type: 'string', + 'x-decorator': 'FormItem', + 'x-component': 'Input', + required: true, + }, + }, + } as ISchema, + onSubmit: submitHandler, + }; + }, + }, + { + name: 'divider', + type: 'divider', + }, + { + name: 'delete', + type: 'remove', + useComponentProps() { + return { + removeParentsIfNoChildren: true, + breakRemoveOn: { + 'x-component': 'Grid', + }, + }; + }, + }, + ], +}); diff --git a/packages/plugins/@nocobase/plugin-import/src/client/index.ts b/packages/plugins/@nocobase/plugin-import/src/client/index.ts index eccd07d6e..b1922c29a 100644 --- a/packages/plugins/@nocobase/plugin-import/src/client/index.ts +++ b/packages/plugins/@nocobase/plugin-import/src/client/index.ts @@ -35,9 +35,9 @@ export class ImportPlugin extends Plugin { }, }; - const tableActionInitializers = this.app.schemaInitializerManager.get('TableActionInitializers'); + const tableActionInitializers = this.app.schemaInitializerManager.get('table:configureActions'); tableActionInitializers?.add('enableActions.import', initializerData); - this.app.schemaInitializerManager.addItem('GanttActionInitializers', 'enableActions.import', initializerData); + this.app.schemaInitializerManager.addItem('gantt:configureActions', 'enableActions.import', initializerData); this.app.schemaSettingsManager.add(importActionSchemaSettings); } } diff --git a/packages/plugins/@nocobase/plugin-kanban/src/client/Kanban.Card.Designer.tsx b/packages/plugins/@nocobase/plugin-kanban/src/client/Kanban.Card.Designer.tsx index 0ff5e8b56..1a51ce194 100644 --- a/packages/plugins/@nocobase/plugin-kanban/src/client/Kanban.Card.Designer.tsx +++ b/packages/plugins/@nocobase/plugin-kanban/src/client/Kanban.Card.Designer.tsx @@ -2,7 +2,7 @@ import { MenuOutlined } from '@ant-design/icons'; import { ISchema, useFieldSchema } from '@formily/react'; import { uid } from '@formily/shared'; import { - SchemaInitializer, + CompatibleSchemaInitializer, SchemaInitializerOpenModeSchemaItems, createDesignable, useAPIClient, @@ -44,8 +44,7 @@ const gridRowColWrap = (schema: ISchema) => { export const KanbanCardDesigner = () => { const { designable } = useDesignable(); - const { getAriaLabel } = useGetAriaLabelOfDesigner(); - const { render } = useSchemaInitializerRender('KanbanCardInitializers'); + const { render } = useSchemaInitializerRender('kanban:configureItemFields'); if (!designable) { return null; } @@ -60,7 +59,10 @@ export const KanbanCardDesigner = () => { ); }; -export const kanbanCardInitializers: SchemaInitializer = new SchemaInitializer({ +/** + * @deprecated + */ +export const kanbanCardInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'KanbanCardInitializers', wrap: gridRowColWrap, useInsert() { @@ -133,3 +135,80 @@ export const kanbanCardInitializers: SchemaInitializer = new SchemaInitializer({ }, ], }); + +export const kanbanCardInitializers = new CompatibleSchemaInitializer( + { + name: 'kanban:configureItemFields', + wrap: gridRowColWrap, + useInsert() { + const fieldSchema = useFieldSchema(); + const { t } = useTranslation(); + const api = useAPIClient(); + const { refresh } = useDesignable(); + + return (schema) => { + const gridSchema = fieldSchema.reduceProperties((buf, schema) => { + if (schema['x-component'] === 'Grid') { + return schema; + } + return buf; + }, null); + + if (!gridSchema) { + return; + } + + const dn = createDesignable({ + t, + api, + refresh, + current: gridSchema, + }); + dn.loadAPIClientEvents(); + dn.insertBeforeEnd(schema); + }; + }, + Component: (props: any) => { + const { getAriaLabel } = useGetAriaLabelOfDesigner(); + return ( + + ); + }, + items: [ + { + type: 'itemGroup', + title: '{{t("Display fields")}}', + name: 'displayFields', + useChildren: useFormItemInitializerFields, + }, + { + type: 'itemGroup', + divider: true, + title: '{{t("Display association fields")}}', + name: 'displayAssociationFields', + hideIfNoChildren: true, + useChildren() { + const associationFields = useAssociatedFormItemInitializerFields({ + readPretty: true, + block: 'Kanban', + }); + return associationFields; + }, + }, + { + name: 'divider', + type: 'divider', + }, + { + name: 'openMode', + Component: SchemaInitializerOpenModeSchemaItems, + }, + ], + }, + kanbanCardInitializers_deprecated, +); diff --git a/packages/plugins/@nocobase/plugin-kanban/src/client/KanbanActionInitializers.tsx b/packages/plugins/@nocobase/plugin-kanban/src/client/KanbanActionInitializers.tsx index 9dead418c..2864b7aca 100644 --- a/packages/plugins/@nocobase/plugin-kanban/src/client/KanbanActionInitializers.tsx +++ b/packages/plugins/@nocobase/plugin-kanban/src/client/KanbanActionInitializers.tsx @@ -1,6 +1,9 @@ -import { SchemaInitializer, useCollection_deprecated } from '@nocobase/client'; +import { CompatibleSchemaInitializer, useCollection_deprecated } from '@nocobase/client'; -export const kanbanActionInitializers: SchemaInitializer = new SchemaInitializer({ +/** + * @deprecated + */ +export const kanbanActionInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'KanbanActionInitializers', title: "{{t('Configure actions')}}", icon: 'SettingOutlined', @@ -41,3 +44,48 @@ export const kanbanActionInitializers: SchemaInitializer = new SchemaInitializer }, ], }); + +export const kanbanActionInitializers = new CompatibleSchemaInitializer( + { + name: 'kanban:configureActions', + title: "{{t('Configure actions')}}", + icon: 'SettingOutlined', + style: { + marginLeft: 8, + }, + items: [ + { + type: 'itemGroup', + title: "{{t('Enable actions')}}", + name: 'enableActions', + children: [ + { + name: 'filter', + title: "{{t('Filter')}}", + Component: 'FilterActionInitializer', + schema: { + 'x-align': 'left', + }, + }, + { + name: 'addNew', + title: "{{t('Add new')}}", + Component: 'CreateActionInitializer', + schema: { + 'x-align': 'right', + 'x-decorator': 'ACLActionProvider', + 'x-acl-action-props': { + skipScopeCheck: true, + }, + }, + useVisible() { + const collection = useCollection_deprecated(); + return (collection as any).template !== 'view' || collection?.writableView; + }, + }, + ], + }, + ], + }, + kanbanActionInitializers_deprecated, +); diff --git a/packages/plugins/@nocobase/plugin-kanban/src/client/__e2e__/schemaInitailizer.test.ts b/packages/plugins/@nocobase/plugin-kanban/src/client/__e2e__/schemaInitailizer.test.ts index 4d368857f..aa79b8fd9 100644 --- a/packages/plugins/@nocobase/plugin-kanban/src/client/__e2e__/schemaInitailizer.test.ts +++ b/packages/plugins/@nocobase/plugin-kanban/src/client/__e2e__/schemaInitailizer.test.ts @@ -7,7 +7,7 @@ test.describe('blockInitializers should add kanban block', () => { await mockCollections(generalWithSingleSelect); await mockRecord('general'); await mockPage().goto(); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await expect(page.getByRole('menuitem', { name: 'form Kanban right' })).toBeVisible(); await page.getByRole('menuitem', { name: 'form Kanban right' }).click(); await page.getByRole('menuitem', { name: 'General' }).click(); @@ -62,7 +62,7 @@ test.describe('configure fields', () => { expect(appends).toContain('manyToOne'); await expect(page.getByLabel('block-item-CollectionField-general-kanban-general.manyToOne')).toBeVisible(); //修改标题字段 - await page.getByLabel('schema-initializer-ActionBar-KanbanActionInitializers-general').click(); + await page.getByLabel('schema-initializer-ActionBar-kanban:configureActions-general').click(); await page.getByLabel('block-item-CollectionField-general-kanban-general.manyToOne').hover(); await page.getByTestId('card-1').getByLabel('designer-schema-settings-').hover(); await page.getByText('Title field').click(); @@ -78,8 +78,8 @@ test.describe('configure actions', () => { const nocoPage = await mockPage(oneEmptyKanbanBlock).waitForInit(); await nocoPage.goto(); await expect(page.getByLabel('block-item-CardItem-general-kanban')).toBeVisible(); - await expect(page.getByLabel('schema-initializer-ActionBar-KanbanActionInitializers-general')).toBeVisible(); - await page.getByLabel('schema-initializer-ActionBar-KanbanActionInitializers-general').click(); + await expect(page.getByLabel('schema-initializer-ActionBar-kanban:configureActions-general')).toBeVisible(); + await page.getByLabel('schema-initializer-ActionBar-kanban:configureActions-general').click(); await page.getByRole('menuitem', { name: 'Filter' }).getByRole('switch').click(); //按钮正常显示 await expect(page.getByLabel('action-Filter.Action-Filter-filter-general-kanban')).toBeVisible(); @@ -87,20 +87,20 @@ test.describe('configure actions', () => { test('add new action in kanban', async ({ page, mockPage }) => { const nocoPage = await mockPage(oneEmptyKanbanBlock).waitForInit(); await nocoPage.goto(); - await page.getByLabel('schema-initializer-ActionBar-KanbanActionInitializers-general').click(); + await page.getByLabel('schema-initializer-ActionBar-kanban:configureActions-general').click(); await page.getByRole('menuitem', { name: 'Add new' }).getByRole('switch').click(); //按钮正常显示 await expect(page.getByLabel('action-Action-Add ')).toBeVisible(); //添加数据 await page.getByLabel('action-Action-Add new-create-general-kanban').click(); - await page.getByLabel('schema-initializer-Grid-CreateFormBlockInitializers-general').click(); + await page.getByLabel('schema-initializer-Grid-popup:addNew:addBlock-general').click(); await page.getByRole('menuitem', { name: 'form Form' }).click(); await page.mouse.move(300, 0); - await page.getByLabel('schema-initializer-Grid-FormItemInitializers-general').click(); + await page.getByLabel('schema-initializer-Grid-form:configureFields-general').click(); await page.getByRole('menuitem', { name: 'Single Select' }).click(); await page.getByLabel('block-item-CollectionField-').locator('.ant-select').click(); await page.getByRole('option', { name: 'option1' }).click(); - await page.getByLabel('schema-initializer-ActionBar-CreateFormActionInitializers-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-createForm:configureActions-general').hover(); await page.getByRole('menuitem', { name: 'Submit' }).click(); await page.getByLabel('action-Action-Submit-submit-general-form').click(); await page.getByLabel('block-item-Kanban.Card-general-kanban').hover(); diff --git a/packages/plugins/@nocobase/plugin-kanban/src/client/__e2e__/utils.ts b/packages/plugins/@nocobase/plugin-kanban/src/client/__e2e__/utils.ts index 853143df4..22dcb9ef3 100644 --- a/packages/plugins/@nocobase/plugin-kanban/src/client/__e2e__/utils.ts +++ b/packages/plugins/@nocobase/plugin-kanban/src/client/__e2e__/utils.ts @@ -96,7 +96,7 @@ export const oneEmptyKanbanBlock: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { '4io56n1mje4': { _isJSONSchemaObject: true, @@ -133,7 +133,7 @@ export const oneEmptyKanbanBlock: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'KanbanActionInitializers', + 'x-initializer': 'kanban:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -227,7 +227,7 @@ export const oneEmptyKanbanBlock: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', 'x-uid': '2hsi7zy93g6', 'x-async': false, 'x-index': 1, diff --git a/packages/plugins/@nocobase/plugin-kanban/src/client/index.tsx b/packages/plugins/@nocobase/plugin-kanban/src/client/index.tsx index c4191a629..1538f1aa3 100644 --- a/packages/plugins/@nocobase/plugin-kanban/src/client/index.tsx +++ b/packages/plugins/@nocobase/plugin-kanban/src/client/index.tsx @@ -1,14 +1,14 @@ +import { Action, CurrentAppInfoProvider, Plugin, SchemaComponentOptions } from '@nocobase/client'; import React from 'react'; -import { Plugin, Action, CurrentAppInfoProvider, SchemaComponentOptions } from '@nocobase/client'; import { Kanban } from './Kanban'; import { KanbanCard } from './Kanban.Card'; -import { KanbanCardDesigner, kanbanCardInitializers } from './Kanban.Card.Designer'; +import { KanbanCardDesigner, kanbanCardInitializers, kanbanCardInitializers_deprecated } from './Kanban.Card.Designer'; import { KanbanCardViewer } from './Kanban.CardViewer'; import { KanbanDesigner } from './Kanban.Designer'; -import { kanbanActionInitializers } from './KanbanActionInitializers'; -import { KanbanBlockProvider, useKanbanBlockProps } from './KanbanBlockProvider'; -import { KanbanBlockInitializer } from './KanbanBlockInitializer'; import { kanbanSettings } from './Kanban.Settings'; +import { kanbanActionInitializers, kanbanActionInitializers_deprecated } from './KanbanActionInitializers'; +import { KanbanBlockInitializer } from './KanbanBlockInitializer'; +import { KanbanBlockProvider, useKanbanBlockProps } from './KanbanBlockProvider'; Kanban.Card = KanbanCard; Kanban.CardAdder = Action; @@ -35,11 +35,13 @@ KanbanPluginProvider.displayName = 'KanbanPluginProvider'; class KanbanPlugin extends Plugin { async load() { this.app.use(KanbanPluginProvider); + this.app.schemaInitializerManager.add(kanbanCardInitializers_deprecated); this.app.schemaInitializerManager.add(kanbanCardInitializers); + this.app.schemaInitializerManager.add(kanbanActionInitializers_deprecated); this.app.schemaInitializerManager.add(kanbanActionInitializers); this.app.schemaSettingsManager.add(kanbanSettings); - const blockInitializers = this.app.schemaInitializerManager.get('BlockInitializers'); + const blockInitializers = this.app.schemaInitializerManager.get('page:addBlock'); blockInitializers?.add('dataBlocks.kanban', { title: '{{t("Kanban")}}', Component: 'KanbanBlockInitializer', diff --git a/packages/plugins/@nocobase/plugin-kanban/src/client/utils.ts b/packages/plugins/@nocobase/plugin-kanban/src/client/utils.ts index 9962a2484..3304820da 100644 --- a/packages/plugins/@nocobase/plugin-kanban/src/client/utils.ts +++ b/packages/plugins/@nocobase/plugin-kanban/src/client/utils.ts @@ -23,7 +23,7 @@ export const createKanbanBlockSchema = (options) => { properties: { actions: { type: 'void', - 'x-initializer': 'KanbanActionInitializers', + 'x-initializer': 'kanban:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -91,7 +91,7 @@ export const createKanbanBlockSchema = (options) => { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: {}, }, }, diff --git a/packages/plugins/@nocobase/plugin-map/src/client/block/MapActionInitializers.tsx b/packages/plugins/@nocobase/plugin-map/src/client/block/MapActionInitializers.tsx index 18a9433b6..16e645e56 100644 --- a/packages/plugins/@nocobase/plugin-map/src/client/block/MapActionInitializers.tsx +++ b/packages/plugins/@nocobase/plugin-map/src/client/block/MapActionInitializers.tsx @@ -1,7 +1,10 @@ -import { SchemaInitializer, useCollection_deprecated } from '@nocobase/client'; +import { CompatibleSchemaInitializer, useCollection_deprecated } from '@nocobase/client'; -// 表格操作配置 -export const mapActionInitializers: SchemaInitializer = new SchemaInitializer({ +/** + * @deprecated + * 表格操作配置 + */ +export const mapActionInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'MapActionInitializers', title: "{{t('Configure actions')}}", icon: 'SettingOutlined', @@ -68,3 +71,74 @@ export const mapActionInitializers: SchemaInitializer = new SchemaInitializer({ }, ], }); + +export const mapActionInitializers = new CompatibleSchemaInitializer( + { + name: 'map:configureActions', + title: "{{t('Configure actions')}}", + icon: 'SettingOutlined', + style: { + marginLeft: 8, + }, + items: [ + { + type: 'itemGroup', + title: "{{t('Enable actions')}}", + name: 'enableActions', + children: [ + { + name: 'filter', + title: "{{t('Filter')}}", + Component: 'FilterActionInitializer', + schema: { + 'x-align': 'left', + }, + }, + { + name: 'addNew', + title: "{{t('Add new')}}", + Component: 'CreateActionInitializer', + schema: { + 'x-align': 'right', + 'x-decorator': 'ACLActionProvider', + 'x-acl-action-props': { + skipScopeCheck: true, + }, + }, + useVisible() { + const collection = useCollection_deprecated(); + return collection.template !== 'sql'; + }, + }, + { + name: 'refresh', + title: "{{t('Refresh')}}", + Component: 'RefreshActionInitializer', + schema: { + 'x-align': 'right', + }, + }, + ], + }, + { + name: 'divider', + type: 'divider', + useVisible() { + const collection = useCollection_deprecated(); + return collection.template !== 'sql'; + }, + }, + { + type: 'subMenu', + title: '{{t("Customize")}}', + name: 'customize', + children: [], + useVisible() { + const collection = useCollection_deprecated(); + return collection.template !== 'sql'; + }, + }, + ], + }, + mapActionInitializers_deprecated, +); diff --git a/packages/plugins/@nocobase/plugin-map/src/client/block/utils.ts b/packages/plugins/@nocobase/plugin-map/src/client/block/utils.ts index 58e4f67d4..e6d92cd1c 100644 --- a/packages/plugins/@nocobase/plugin-map/src/client/block/utils.ts +++ b/packages/plugins/@nocobase/plugin-map/src/client/block/utils.ts @@ -25,7 +25,7 @@ export const createMapBlockSchema = (options) => { properties: { actions: { type: 'void', - 'x-initializer': 'MapActionInitializers', + 'x-initializer': 'map:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -65,7 +65,7 @@ export const createMapBlockSchema = (options) => { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: {}, }, }, diff --git a/packages/plugins/@nocobase/plugin-map/src/client/index.tsx b/packages/plugins/@nocobase/plugin-map/src/client/index.tsx index d400d901d..66c64b054 100644 --- a/packages/plugins/@nocobase/plugin-map/src/client/index.tsx +++ b/packages/plugins/@nocobase/plugin-map/src/client/index.tsx @@ -1,12 +1,11 @@ import { CurrentAppInfoProvider, Plugin, SchemaComponentOptions } from '@nocobase/client'; import React from 'react'; import { MapBlockOptions } from './block'; -import { mapActionInitializers } from './block/MapActionInitializers'; +import { mapActionInitializers, mapActionInitializers_deprecated } from './block/MapActionInitializers'; +import { mapBlockSettings } from './block/MapBlock.Settings'; import { Configuration, Map } from './components'; import { fields } from './fields'; -import { generateNTemplate } from './locale'; -import { NAMESPACE } from './locale'; -import { mapBlockSettings } from './block/MapBlock.Settings'; +import { NAMESPACE, generateNTemplate } from './locale'; const MapProvider = React.memo((props) => { return ( @@ -29,10 +28,11 @@ export class MapPlugin extends Plugin { order: 51, }, }); + this.app.schemaInitializerManager.add(mapActionInitializers_deprecated); this.app.schemaInitializerManager.add(mapActionInitializers); this.schemaSettingsManager.add(mapBlockSettings); - const blockInitializers = this.app.schemaInitializerManager.get('BlockInitializers'); + const blockInitializers = this.app.schemaInitializerManager.get('page:addBlock'); blockInitializers?.add('dataBlocks.map', { title: generateNTemplate('Map'), Component: 'MapBlockInitializer', diff --git a/packages/plugins/@nocobase/plugin-mobile-client/src/client/core/schema/common/page.ts b/packages/plugins/@nocobase/plugin-mobile-client/src/client/core/schema/common/page.ts index a2335e96c..e2de8d88a 100644 --- a/packages/plugins/@nocobase/plugin-mobile-client/src/client/core/schema/common/page.ts +++ b/packages/plugins/@nocobase/plugin-mobile-client/src/client/core/schema/common/page.ts @@ -7,7 +7,7 @@ export const PageSchema = { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'MBlockInitializers', + 'x-initializer': 'mobilePage:addBlock', 'x-component-props': { showDivider: false, }, diff --git a/packages/plugins/@nocobase/plugin-mobile-client/src/client/core/schema/components/page/Page.Designer.tsx b/packages/plugins/@nocobase/plugin-mobile-client/src/client/core/schema/components/page/Page.Designer.tsx index 6583ca489..5ab4834fe 100644 --- a/packages/plugins/@nocobase/plugin-mobile-client/src/client/core/schema/components/page/Page.Designer.tsx +++ b/packages/plugins/@nocobase/plugin-mobile-client/src/client/core/schema/components/page/Page.Designer.tsx @@ -77,7 +77,7 @@ export const PageDesigner = (props) => { 'x-component-props': {}, 'x-initializer': 'TabPaneInitializers', 'x-initializer-props': { - gridInitializer: 'MBlockInitializers', + gridInitializer: 'mobilePage:addBlock', }, properties: { tab1: { diff --git a/packages/plugins/@nocobase/plugin-mobile-client/src/client/core/schema/initializers/BlockInitializers.ts b/packages/plugins/@nocobase/plugin-mobile-client/src/client/core/schema/initializers/BlockInitializers.ts index 47db07d90..36f8b3169 100644 --- a/packages/plugins/@nocobase/plugin-mobile-client/src/client/core/schema/initializers/BlockInitializers.ts +++ b/packages/plugins/@nocobase/plugin-mobile-client/src/client/core/schema/initializers/BlockInitializers.ts @@ -1,7 +1,10 @@ -import { SchemaInitializer, gridRowColWrap } from '@nocobase/client'; +import { CompatibleSchemaInitializer, gridRowColWrap } from '@nocobase/client'; import { generateNTemplate } from '../../../locale'; -export const mBlockInitializers: SchemaInitializer = new SchemaInitializer({ +/** + * @deprecated + */ +export const mBlockInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'MBlockInitializers', title: '{{t("Add block")}}', icon: 'PlusOutlined', @@ -69,3 +72,75 @@ export const mBlockInitializers: SchemaInitializer = new SchemaInitializer({ }, ], }); + +export const mBlockInitializers = new CompatibleSchemaInitializer( + { + name: 'mobilePage:addBlock', + title: '{{t("Add block")}}', + icon: 'PlusOutlined', + wrap: gridRowColWrap, + items: [ + { + name: 'dataBlocks', + type: 'itemGroup', + title: '{{t("Data blocks")}}', + children: [ + { + name: 'gridCard', + type: 'item', + title: '{{t("Grid Card")}}', + Component: 'GridCardBlockInitializer', + }, + { + name: 'table', + title: '{{t("Table")}}', + Component: 'TableBlockInitializer', + }, + { + name: 'form', + title: '{{t("Form")}}', + Component: 'FormBlockInitializer', + }, + { + name: 'details', + title: '{{t("Details")}}', + Component: 'DetailsBlockInitializer', + }, + { + name: 'calendar', + title: '{{t("Calendar")}}', + Component: 'CalendarBlockInitializer', + }, + { + name: 'mapBlock', + title: generateNTemplate('Map'), + Component: 'MapBlockInitializer', + }, + ], + }, + { + name: 'otherBlocks', + type: 'itemGroup', + title: '{{t("Other blocks")}}', + children: [ + { + name: 'menu', + title: generateNTemplate('Menu'), + Component: 'MMenuBlockInitializer', + }, + { + name: 'markdown', + title: '{{t("Markdown")}}', + Component: 'MarkdownBlockInitializer', + }, + { + name: 'settings', + title: generateNTemplate('Settings'), + Component: 'MSettingsBlockInitializer', + }, + ], + }, + ], + }, + mBlockInitializers_deprecated, +); diff --git a/packages/plugins/@nocobase/plugin-mobile-client/src/client/index.tsx b/packages/plugins/@nocobase/plugin-mobile-client/src/client/index.tsx index b900b50e1..0b54b8d78 100644 --- a/packages/plugins/@nocobase/plugin-mobile-client/src/client/index.tsx +++ b/packages/plugins/@nocobase/plugin-mobile-client/src/client/index.tsx @@ -3,7 +3,7 @@ import React from 'react'; import { Navigate, Outlet } from 'react-router-dom'; import { MobileClientProvider } from './MobileClientProvider'; import MApplication from './router/Application'; -import { mBlockInitializers } from './core/schema'; +import { mBlockInitializers, mBlockInitializers_deprecated } from './core/schema'; import { AppConfiguration, InterfaceConfiguration } from './configuration'; import { NAMESPACE } from './locale'; @@ -14,6 +14,7 @@ export class MobileClientPlugin extends Plugin { this.addRoutes(); this.addSettings(); this.app.use(MobileClientProvider); + this.app.schemaInitializerManager.add(mBlockInitializers_deprecated); this.app.schemaInitializerManager.add(mBlockInitializers); } diff --git a/packages/plugins/@nocobase/plugin-mobile-client/src/server/plugin.ts b/packages/plugins/@nocobase/plugin-mobile-client/src/server/plugin.ts index 02aa05d55..a895263ae 100644 --- a/packages/plugins/@nocobase/plugin-mobile-client/src/server/plugin.ts +++ b/packages/plugins/@nocobase/plugin-mobile-client/src/server/plugin.ts @@ -32,7 +32,7 @@ export class MobileClientPlugin extends Plugin { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'MBlockInitializers', + 'x-initializer': 'mobilePage:addBlock', 'x-component-props': { showDivider: false, }, diff --git a/packages/plugins/@nocobase/plugin-mobile-client/src/server/routes.ts b/packages/plugins/@nocobase/plugin-mobile-client/src/server/routes.ts index 3470f1170..dafca0988 100644 --- a/packages/plugins/@nocobase/plugin-mobile-client/src/server/routes.ts +++ b/packages/plugins/@nocobase/plugin-mobile-client/src/server/routes.ts @@ -18,7 +18,7 @@ export const routes = [ grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'MBlockInitializers', + 'x-initializer': 'mobilePage:addBlock', 'x-component-props': { showDivider: false, }, diff --git a/packages/plugins/@nocobase/plugin-sample-hello/src/client/index.tsx b/packages/plugins/@nocobase/plugin-sample-hello/src/client/index.tsx index 7ec484b48..4e86e06b5 100644 --- a/packages/plugins/@nocobase/plugin-sample-hello/src/client/index.tsx +++ b/packages/plugins/@nocobase/plugin-sample-hello/src/client/index.tsx @@ -1,5 +1,5 @@ import { TableOutlined } from '@ant-design/icons'; -import { SchemaInitializerItem, Plugin, useSchemaInitializer, SchemaSettings } from '@nocobase/client'; +import { Plugin, SchemaInitializerItem, SchemaSettings, useSchemaInitializer } from '@nocobase/client'; import { Card } from 'antd'; import React from 'react'; import { useTranslation } from 'react-i18next'; @@ -50,7 +50,7 @@ const helloSettings = new SchemaSettings({ class HelloPlugin extends Plugin { async load() { - this.app.schemaInitializerManager.addItem('BlockInitializers', 'otherBlocks.hello', { + this.app.schemaInitializerManager.addItem('page:addBlock', 'otherBlocks.hello', { title: '{{t("Hello block")}}', Component: HelloBlockInitializer, }); diff --git a/packages/plugins/@nocobase/plugin-snapshot-field/src/client/SnapshotBlock/SnapshotBlockInitializers/SnapshotBlockInitializers.tsx b/packages/plugins/@nocobase/plugin-snapshot-field/src/client/SnapshotBlock/SnapshotBlockInitializers/SnapshotBlockInitializers.tsx index 86a43a0a7..5991c94e9 100644 --- a/packages/plugins/@nocobase/plugin-snapshot-field/src/client/SnapshotBlock/SnapshotBlockInitializers/SnapshotBlockInitializers.tsx +++ b/packages/plugins/@nocobase/plugin-snapshot-field/src/client/SnapshotBlock/SnapshotBlockInitializers/SnapshotBlockInitializers.tsx @@ -1,7 +1,10 @@ -import { SchemaInitializer, gridRowColWrap } from '@nocobase/client'; +import { CompatibleSchemaInitializer, gridRowColWrap } from '@nocobase/client'; import { NAMESPACE } from '../../locale'; -export const snapshotBlockInitializers: SchemaInitializer = new SchemaInitializer({ +/** + * @deprecated + */ +export const snapshotBlockInitializers_deprecated = new CompatibleSchemaInitializer({ name: 'SnapshotBlockInitializers', wrap: gridRowColWrap, title: `{{t("Add block", { ns: "${NAMESPACE}" })}}`, @@ -16,7 +19,7 @@ export const snapshotBlockInitializers: SchemaInitializer = new SchemaInitialize name: 'details', title: '{{t("Details")}}', Component: 'SnapshotBlockInitializersDetailItem', - actionInitializers: 'CalendarFormActionInitializers', + actionInitializers: 'details:configureActions', }, ], }, @@ -34,3 +37,40 @@ export const snapshotBlockInitializers: SchemaInitializer = new SchemaInitialize }, ], }); + +export const snapshotBlockInitializers = new CompatibleSchemaInitializer( + { + name: 'popup:snapshot:addBlock', + wrap: gridRowColWrap, + title: `{{t("Add block", { ns: "${NAMESPACE}" })}}`, + icon: 'PlusOutlined', + items: [ + { + type: 'itemGroup', + title: '{{t("Current record blocks")}}', + name: 'currentRecordBlocks', + children: [ + { + name: 'details', + title: '{{t("Details")}}', + Component: 'SnapshotBlockInitializersDetailItem', + actionInitializers: 'details:configureActions', + }, + ], + }, + { + type: 'itemGroup', + title: '{{t("Other blocks")}}', + name: 'otherBlocks', + children: [ + { + name: 'markdown', + title: '{{t("Markdown")}}', + Component: 'MarkdownBlockInitializer', + }, + ], + }, + ], + }, + snapshotBlockInitializers_deprecated, +); diff --git a/packages/plugins/@nocobase/plugin-snapshot-field/src/client/SnapshotBlock/SnapshotBlockInitializers/SnapshotBlockInitializersDetailItem.tsx b/packages/plugins/@nocobase/plugin-snapshot-field/src/client/SnapshotBlock/SnapshotBlockInitializers/SnapshotBlockInitializersDetailItem.tsx index 244a2ac38..f7444dd30 100644 --- a/packages/plugins/@nocobase/plugin-snapshot-field/src/client/SnapshotBlock/SnapshotBlockInitializers/SnapshotBlockInitializersDetailItem.tsx +++ b/packages/plugins/@nocobase/plugin-snapshot-field/src/client/SnapshotBlock/SnapshotBlockInitializers/SnapshotBlockInitializersDetailItem.tsx @@ -15,8 +15,8 @@ import { uid } from '@formily/shared'; export const createSnapshotBlockSchema = (options) => { const { - formItemInitializers = 'ReadPrettyFormItemInitializers', - actionInitializers = 'ReadPrettyFormActionInitializers', + formItemInitializers = 'details:configureFields', + actionInitializers = 'details:configureActions', collection, association, resource, @@ -78,7 +78,7 @@ export const SnapshotBlockInitializersDetailItem = () => { const association = useBlockAssociationContext(); const { block } = useBlockRequestContext(); const actionInitializers = - block !== 'TableField' ? itemConfig.actionInitializers || 'ReadPrettyFormActionInitializers' : null; + block !== 'TableField' ? itemConfig.actionInitializers || 'details:configureActions' : null; return ( { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'table Table' }).hover(); await page.getByRole('menuitem', { name: `${triggerNodeCollectionDisplayName}` }).click(); @@ -71,16 +71,16 @@ test.describe('Configuration page to configure the Trigger node', () => { await page.getByRole('menuitem', { name: 'Add new' }).getByRole('switch').click(); await expect(page.getByRole('menuitem', { name: 'Add new' }).getByRole('switch')).toBeEnabled(); await page.getByLabel(`action-Action-Add new-create-${triggerNodeCollectionName}-table`).click(); - await page.getByLabel(`schema-initializer-Grid-CreateFormBlockInitializers-${triggerNodeCollectionName}`).hover(); + await page.getByLabel(`schema-initializer-Grid-popup:addNew:addBlock-${triggerNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'form Form' }).click(); // 移开鼠标,关闭菜单 await page.mouse.move(300, 0); await page - .getByLabel(`schema-initializer-ActionBar-CreateFormActionInitializers-${triggerNodeCollectionName}`) + .getByLabel(`schema-initializer-ActionBar-createForm:configureActions-${triggerNodeCollectionName}`) .hover(); await page.getByRole('menuitem', { name: 'Submit' }).click(); // 绑定工作流 - await page.getByLabel(`schema-initializer-Grid-FormItemInitializers-${triggerNodeCollectionName}`).hover(); + await page.getByLabel(`schema-initializer-Grid-form:configureFields-${triggerNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: `${triggerNodeFieldDisplayName}` }).click(); await page.mouse.move(300, 0); await page.getByLabel(`action-Action-Submit-submit-${triggerNodeCollectionName}-form`).hover(); @@ -150,7 +150,7 @@ test.describe('Configuration page to configure the Trigger node', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'table Table' }).hover(); await page.getByRole('menuitem', { name: `${triggerNodeCollectionDisplayName}` }).click(); @@ -164,7 +164,7 @@ test.describe('Configuration page to configure the Trigger node', () => { await expect(page.getByRole('menuitem', { name: 'Add new' }).getByRole('switch')).toBeEnabled(); await page.getByLabel(`action-Action-Add new-create-${triggerNodeCollectionName}-table`).click(); - await page.getByLabel(`schema-initializer-Grid-CreateFormBlockInitializers-${triggerNodeCollectionName}`).hover(); + await page.getByLabel(`schema-initializer-Grid-popup:addNew:addBlock-${triggerNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'form Form' }).click(); // 移开鼠标,关闭菜单 @@ -172,11 +172,11 @@ test.describe('Configuration page to configure the Trigger node', () => { // 绑定工作流 await page - .getByLabel(`schema-initializer-ActionBar-CreateFormActionInitializers-${triggerNodeCollectionName}`) + .getByLabel(`schema-initializer-ActionBar-createForm:configureActions-${triggerNodeCollectionName}`) .hover(); await page.getByRole('menuitem', { name: 'Customize' }).hover(); await page.getByRole('menuitem', { name: 'Submit to workflow' }).click(); - await page.getByLabel(`schema-initializer-Grid-FormItemInitializers-${triggerNodeCollectionName}`).hover(); + await page.getByLabel(`schema-initializer-Grid-form:configureFields-${triggerNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: `${triggerNodeFieldDisplayName}` }).click(); await page.mouse.move(300, 0); await page.getByRole('button', { name: 'Submit to workflow' }).hover(); diff --git a/packages/plugins/@nocobase/plugin-workflow-action-trigger/src/client/index.ts b/packages/plugins/@nocobase/plugin-workflow-action-trigger/src/client/index.ts index 8b02ac516..53af3ba02 100644 --- a/packages/plugins/@nocobase/plugin-workflow-action-trigger/src/client/index.ts +++ b/packages/plugins/@nocobase/plugin-workflow-action-trigger/src/client/index.ts @@ -1,7 +1,7 @@ import { Plugin, SchemaInitializerItemType } from '@nocobase/client'; import WorkflowPlugin, { - useTriggerWorkflowsActionProps, useRecordTriggerWorkflowsActionProps, + useTriggerWorkflowsActionProps, } from '@nocobase/plugin-workflow/client'; import ActionTrigger from './ActionTrigger'; diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/__e2e__/createRecordForm.test.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/__e2e__/createRecordForm.test.ts index e2e5d5775..b1988c123 100644 --- a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/__e2e__/createRecordForm.test.ts +++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/__e2e__/createRecordForm.test.ts @@ -1,31 +1,18 @@ import { faker } from '@faker-js/faker'; import { CollectionTriggerNode, - CreateWorkFlow, - EditWorkFlow, - WorkflowListRecords, + ManualNode, apiCreateWorkflow, apiDeleteWorkflow, + apiGetRecord, apiGetWorkflow, - apiUpdateRecord, apiGetWorkflowNodeExecutions, apiUpdateWorkflowTrigger, appendJsonCollectionName, generalWithNoRelationalFields, - QueryRecordNode, - ManualNode, - apiGetRecord, - apiCreateWorkflowNode, - apiGetWorkflowNode, - ClculationNode, - CreateRecordNode, - AggregateNode, - apiGetList, - apiFilterList, } from '@nocobase/plugin-workflow-test/e2e'; import { expect, test } from '@nocobase/test/e2e'; import { dayjs } from '@nocobase/utils'; -import { Button } from 'antd'; test.describe('block configuration', () => {}); @@ -97,7 +84,7 @@ test.describe('field data entry', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-CreateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -105,7 +92,7 @@ test.describe('field data entry', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -129,7 +116,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -232,7 +219,7 @@ test.describe('field data entry', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-CreateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -240,7 +227,7 @@ test.describe('field data entry', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -264,7 +251,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -367,7 +354,7 @@ test.describe('field data entry', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-CreateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -375,7 +362,7 @@ test.describe('field data entry', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -399,7 +386,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -502,7 +489,7 @@ test.describe('field data entry', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-CreateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -510,7 +497,7 @@ test.describe('field data entry', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -534,7 +521,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -637,7 +624,7 @@ test.describe('field data entry', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-CreateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -645,7 +632,7 @@ test.describe('field data entry', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -669,7 +656,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -772,7 +759,7 @@ test.describe('field data entry', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-CreateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -780,7 +767,7 @@ test.describe('field data entry', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -804,7 +791,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -907,7 +894,7 @@ test.describe('field data entry', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-CreateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -915,7 +902,7 @@ test.describe('field data entry', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -939,7 +926,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -1043,7 +1030,7 @@ test.describe('field data entry', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-CreateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -1051,7 +1038,7 @@ test.describe('field data entry', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -1075,7 +1062,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -1178,7 +1165,7 @@ test.describe('field data entry', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-CreateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -1186,7 +1173,7 @@ test.describe('field data entry', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -1210,7 +1197,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -1313,7 +1300,7 @@ test.describe('field data entry', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-CreateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -1321,7 +1308,7 @@ test.describe('field data entry', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -1345,7 +1332,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -1456,7 +1443,7 @@ test.describe('field data entry', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-CreateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -1464,7 +1451,7 @@ test.describe('field data entry', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -1488,7 +1475,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -1590,7 +1577,7 @@ test.describe('field data entry', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-CreateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -1598,7 +1585,7 @@ test.describe('field data entry', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -1622,7 +1609,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -1731,7 +1718,7 @@ test.describe('field data entry', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-CreateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -1739,7 +1726,7 @@ test.describe('field data entry', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -1763,7 +1750,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -1881,7 +1868,7 @@ test.describe('action button', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-CreateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -1889,7 +1876,7 @@ test.describe('action button', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -1913,7 +1900,7 @@ test.describe('action button', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -2016,7 +2003,7 @@ test.describe('action button', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-CreateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -2024,12 +2011,14 @@ test.describe('action button', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); // await page.mouse.click(300, 0); - await page.getByLabel(`schema-initializer-ActionBar-AddActionButton-${manualNodeCollectionName}`).hover(); + await page + .getByLabel(`schema-initializer-ActionBar-workflowManual:form:configureActions-${manualNodeCollectionName}`) + .hover(); await page.getByRole('menuitem', { name: 'Terminate the process' }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); await page.mouse.click(300, 0); @@ -2052,7 +2041,7 @@ test.describe('action button', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -2155,7 +2144,7 @@ test.describe('action button', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-CreateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -2163,12 +2152,14 @@ test.describe('action button', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); // await page.mouse.click(300, 0); - await page.getByLabel(`schema-initializer-ActionBar-AddActionButton-${manualNodeCollectionName}`).hover(); + await page + .getByLabel(`schema-initializer-ActionBar-workflowManual:form:configureActions-${manualNodeCollectionName}`) + .hover(); await page.getByRole('menuitem', { name: 'Save temporarily' }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); await page.mouse.click(300, 0); @@ -2191,7 +2182,7 @@ test.describe('action button', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/__e2e__/customFormBlocks.test.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/__e2e__/customFormBlocks.test.ts index a969e7ee3..cb4b1a46b 100644 --- a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/__e2e__/customFormBlocks.test.ts +++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/__e2e__/customFormBlocks.test.ts @@ -1,27 +1,14 @@ import { faker } from '@faker-js/faker'; import { CollectionTriggerNode, - CreateWorkFlow, - EditWorkFlow, - WorkflowListRecords, + ManualNode, apiCreateWorkflow, apiDeleteWorkflow, apiGetWorkflow, - apiUpdateRecord, apiGetWorkflowNodeExecutions, apiUpdateWorkflowTrigger, appendJsonCollectionName, generalWithNoRelationalFields, - QueryRecordNode, - ManualNode, - apiGetRecord, - apiCreateWorkflowNode, - apiGetWorkflowNode, - ClculationNode, - CreateRecordNode, - AggregateNode, - apiGetList, - apiFilterList, } from '@nocobase/plugin-workflow-test/e2e'; import { expect, test } from '@nocobase/test/e2e'; import { dayjs } from '@nocobase/utils'; @@ -95,17 +82,23 @@ test.describe('field data entry', () => { await manualNode.customFormMenu.click(); await page.mouse.move(300, 0, { steps: 100 }); // 获取自定义表单的随机值 - const configureFieldsButton = page.locator('button[aria-label^="schema-initializer-Grid-AddCustomFormField-"]'); + const configureFieldsButton = page.locator( + 'button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-"]', + ); const ariaLabel = await configureFieldsButton.getAttribute('aria-label'); const randomValue = ariaLabel.split('-').pop(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByLabel(`designer-schema-settings-CardItem-SimpleDesigner-${randomValue}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); const blockTitle = 'Form' + dayjs().format('YYYYMMDDHHmmss.SSS').toString(); await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByRole('menuitem', { name: 'Single line text' }).click(); await page .getByLabel(`block-item-Input-${randomValue}-Field display name`) @@ -134,7 +127,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -232,17 +225,23 @@ test.describe('field data entry', () => { await manualNode.customFormMenu.click(); await page.mouse.move(300, 0, { steps: 100 }); // 获取自定义表单的随机值 - const configureFieldsButton = page.locator('button[aria-label^="schema-initializer-Grid-AddCustomFormField-"]'); + const configureFieldsButton = page.locator( + 'button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-"]', + ); const ariaLabel = await configureFieldsButton.getAttribute('aria-label'); const randomValue = ariaLabel.split('-').pop(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByLabel(`designer-schema-settings-CardItem-SimpleDesigner-${randomValue}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); const blockTitle = 'Form' + dayjs().format('YYYYMMDDHHmmss.SSS').toString(); await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByRole('menuitem', { name: 'Long text' }).click(); await page .getByLabel(`block-item-Input-${randomValue}-Field display name`) @@ -271,7 +270,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -369,17 +368,23 @@ test.describe('field data entry', () => { await manualNode.customFormMenu.click(); await page.mouse.move(300, 0, { steps: 100 }); // 获取自定义表单的随机值 - const configureFieldsButton = page.locator('button[aria-label^="schema-initializer-Grid-AddCustomFormField-"]'); + const configureFieldsButton = page.locator( + 'button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-"]', + ); const ariaLabel = await configureFieldsButton.getAttribute('aria-label'); const randomValue = ariaLabel.split('-').pop(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByLabel(`designer-schema-settings-CardItem-SimpleDesigner-${randomValue}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); const blockTitle = 'Form' + dayjs().format('YYYYMMDDHHmmss.SSS').toString(); await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByRole('menuitem', { name: 'Phone' }).click(); await page .getByLabel(`block-item-Input-${randomValue}-Field display name`) @@ -408,7 +413,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -506,17 +511,23 @@ test.describe('field data entry', () => { await manualNode.customFormMenu.click(); await page.mouse.move(300, 0, { steps: 100 }); // 获取自定义表单的随机值 - const configureFieldsButton = page.locator('button[aria-label^="schema-initializer-Grid-AddCustomFormField-"]'); + const configureFieldsButton = page.locator( + 'button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-"]', + ); const ariaLabel = await configureFieldsButton.getAttribute('aria-label'); const randomValue = ariaLabel.split('-').pop(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByLabel(`designer-schema-settings-CardItem-SimpleDesigner-${randomValue}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); const blockTitle = 'Form' + dayjs().format('YYYYMMDDHHmmss.SSS').toString(); await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByRole('menuitem', { name: 'Email' }).click(); await page .getByLabel(`block-item-Input-${randomValue}-Field display name`) @@ -545,7 +556,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -643,17 +654,23 @@ test.describe('field data entry', () => { await manualNode.customFormMenu.click(); await page.mouse.move(300, 0, { steps: 100 }); // 获取自定义表单的随机值 - const configureFieldsButton = page.locator('button[aria-label^="schema-initializer-Grid-AddCustomFormField-"]'); + const configureFieldsButton = page.locator( + 'button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-"]', + ); const ariaLabel = await configureFieldsButton.getAttribute('aria-label'); const randomValue = ariaLabel.split('-').pop(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByLabel(`designer-schema-settings-CardItem-SimpleDesigner-${randomValue}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); const blockTitle = 'Form' + dayjs().format('YYYYMMDDHHmmss.SSS').toString(); await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByRole('menuitem', { name: 'Integer' }).click(); await page .getByLabel(`block-item-Input-${randomValue}-Field display name`) @@ -682,7 +699,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -780,17 +797,23 @@ test.describe('field data entry', () => { await manualNode.customFormMenu.click(); await page.mouse.move(300, 0, { steps: 100 }); // 获取自定义表单的随机值 - const configureFieldsButton = page.locator('button[aria-label^="schema-initializer-Grid-AddCustomFormField-"]'); + const configureFieldsButton = page.locator( + 'button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-"]', + ); const ariaLabel = await configureFieldsButton.getAttribute('aria-label'); const randomValue = ariaLabel.split('-').pop(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByLabel(`designer-schema-settings-CardItem-SimpleDesigner-${randomValue}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); const blockTitle = 'Form' + dayjs().format('YYYYMMDDHHmmss.SSS').toString(); await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByRole('menuitem', { name: 'Number' }).click(); await page .getByLabel(`block-item-Input-${randomValue}-Field display name`) @@ -819,7 +842,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -917,17 +940,23 @@ test.describe('field data entry', () => { await manualNode.customFormMenu.click(); await page.mouse.move(300, 0, { steps: 100 }); // 获取自定义表单的随机值 - const configureFieldsButton = page.locator('button[aria-label^="schema-initializer-Grid-AddCustomFormField-"]'); + const configureFieldsButton = page.locator( + 'button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-"]', + ); const ariaLabel = await configureFieldsButton.getAttribute('aria-label'); const randomValue = ariaLabel.split('-').pop(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByLabel(`designer-schema-settings-CardItem-SimpleDesigner-${randomValue}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); const blockTitle = 'Form' + dayjs().format('YYYYMMDDHHmmss.SSS').toString(); await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByRole('menuitem', { name: 'Percent' }).click(); await page .getByLabel(`block-item-Input-${randomValue}-Field display name`) @@ -956,7 +985,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -1054,17 +1083,23 @@ test.describe('field data entry', () => { await manualNode.customFormMenu.click(); await page.mouse.move(300, 0, { steps: 100 }); // 获取自定义表单的随机值 - const configureFieldsButton = page.locator('button[aria-label^="schema-initializer-Grid-AddCustomFormField-"]'); + const configureFieldsButton = page.locator( + 'button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-"]', + ); const ariaLabel = await configureFieldsButton.getAttribute('aria-label'); const randomValue = ariaLabel.split('-').pop(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByLabel(`designer-schema-settings-CardItem-SimpleDesigner-${randomValue}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); const blockTitle = 'Form' + dayjs().format('YYYYMMDDHHmmss.SSS').toString(); await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByRole('menuitem', { name: 'Checkbox', exact: true }).click(); await page .getByLabel(`block-item-Input-${randomValue}-Field display name`) @@ -1093,7 +1128,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -1191,17 +1226,23 @@ test.describe('field data entry', () => { await manualNode.customFormMenu.click(); await page.mouse.move(300, 0, { steps: 100 }); // 获取自定义表单的随机值 - const configureFieldsButton = page.locator('button[aria-label^="schema-initializer-Grid-AddCustomFormField-"]'); + const configureFieldsButton = page.locator( + 'button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-"]', + ); const ariaLabel = await configureFieldsButton.getAttribute('aria-label'); const randomValue = ariaLabel.split('-').pop(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByLabel(`designer-schema-settings-CardItem-SimpleDesigner-${randomValue}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); const blockTitle = 'Form' + dayjs().format('YYYYMMDDHHmmss.SSS').toString(); await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByRole('menuitem', { name: 'Single select', exact: true }).click(); await page .getByLabel(`block-item-Input-${randomValue}-Field display name`) @@ -1236,7 +1277,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -1335,17 +1376,23 @@ test.describe('field data entry', () => { await manualNode.customFormMenu.click(); await page.mouse.move(300, 0, { steps: 100 }); // 获取自定义表单的随机值 - const configureFieldsButton = page.locator('button[aria-label^="schema-initializer-Grid-AddCustomFormField-"]'); + const configureFieldsButton = page.locator( + 'button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-"]', + ); const ariaLabel = await configureFieldsButton.getAttribute('aria-label'); const randomValue = ariaLabel.split('-').pop(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByLabel(`designer-schema-settings-CardItem-SimpleDesigner-${randomValue}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); const blockTitle = 'Form' + dayjs().format('YYYYMMDDHHmmss.SSS').toString(); await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByRole('menuitem', { name: 'Multiple select', exact: true }).click(); await page .getByLabel(`block-item-Input-${randomValue}-Field display name`) @@ -1380,7 +1427,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -1486,17 +1533,23 @@ test.describe('field data entry', () => { await manualNode.customFormMenu.click(); await page.mouse.move(300, 0, { steps: 100 }); // 获取自定义表单的随机值 - const configureFieldsButton = page.locator('button[aria-label^="schema-initializer-Grid-AddCustomFormField-"]'); + const configureFieldsButton = page.locator( + 'button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-"]', + ); const ariaLabel = await configureFieldsButton.getAttribute('aria-label'); const randomValue = ariaLabel.split('-').pop(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByLabel(`designer-schema-settings-CardItem-SimpleDesigner-${randomValue}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); const blockTitle = 'Form' + dayjs().format('YYYYMMDDHHmmss.SSS').toString(); await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByRole('menuitem', { name: 'Radio group', exact: true }).click(); await page .getByLabel(`block-item-Input-${randomValue}-Field display name`) @@ -1531,7 +1584,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -1629,17 +1682,23 @@ test.describe('field data entry', () => { await manualNode.customFormMenu.click(); await page.mouse.move(300, 0, { steps: 100 }); // 获取自定义表单的随机值 - const configureFieldsButton = page.locator('button[aria-label^="schema-initializer-Grid-AddCustomFormField-"]'); + const configureFieldsButton = page.locator( + 'button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-"]', + ); const ariaLabel = await configureFieldsButton.getAttribute('aria-label'); const randomValue = ariaLabel.split('-').pop(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByLabel(`designer-schema-settings-CardItem-SimpleDesigner-${randomValue}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); const blockTitle = 'Form' + dayjs().format('YYYYMMDDHHmmss.SSS').toString(); await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByRole('menuitem', { name: 'Checkbox group', exact: true }).click(); await page .getByLabel(`block-item-Input-${randomValue}-Field display name`) @@ -1674,7 +1733,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -1778,17 +1837,23 @@ test.describe('field data entry', () => { await manualNode.customFormMenu.click(); await page.mouse.move(300, 0, { steps: 100 }); // 获取自定义表单的随机值 - const configureFieldsButton = page.locator('button[aria-label^="schema-initializer-Grid-AddCustomFormField-"]'); + const configureFieldsButton = page.locator( + 'button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-"]', + ); const ariaLabel = await configureFieldsButton.getAttribute('aria-label'); const randomValue = ariaLabel.split('-').pop(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByLabel(`designer-schema-settings-CardItem-SimpleDesigner-${randomValue}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); const blockTitle = 'Form' + dayjs().format('YYYYMMDDHHmmss.SSS').toString(); await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByRole('menuitem', { name: 'Datetime', exact: true }).click(); await page .getByLabel(`block-item-Input-${randomValue}-Field display name`) @@ -1817,7 +1882,7 @@ test.describe('field data entry', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/__e2e__/datablocks.test.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/__e2e__/datablocks.test.ts index 96c1b4608..447c4a3d8 100644 --- a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/__e2e__/datablocks.test.ts +++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/__e2e__/datablocks.test.ts @@ -1,27 +1,21 @@ import { faker } from '@faker-js/faker'; import { + AggregateNode, + ClculationNode, CollectionTriggerNode, - CreateWorkFlow, - EditWorkFlow, - WorkflowListRecords, + CreateRecordNode, + ManualNode, + QueryRecordNode, apiCreateWorkflow, + apiCreateWorkflowNode, apiDeleteWorkflow, + apiFilterList, + apiGetList, apiGetWorkflow, - apiUpdateRecord, - apiGetWorkflowNodeExecutions, + apiGetWorkflowNode, apiUpdateWorkflowTrigger, appendJsonCollectionName, generalWithNoRelationalFields, - QueryRecordNode, - ManualNode, - apiGetRecord, - apiCreateWorkflowNode, - apiGetWorkflowNode, - ClculationNode, - CreateRecordNode, - AggregateNode, - apiGetList, - apiFilterList, } from '@nocobase/plugin-workflow-test/e2e'; import { expect, test } from '@nocobase/test/e2e'; import { dayjs } from '@nocobase/utils'; @@ -111,7 +105,7 @@ test.describe('field data', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -223,7 +217,7 @@ test.describe('field data', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -346,7 +340,7 @@ test.describe('field data', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -474,7 +468,7 @@ test.describe('field data', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -634,7 +628,7 @@ test.describe('field data', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -733,17 +727,23 @@ test.describe('field data', () => { await preManualNodePom.customFormMenu.click(); await page.mouse.move(300, 0, { steps: 100 }); // 获取自定义表单的随机值 - const configureFieldsButton = page.locator('button[aria-label^="schema-initializer-Grid-AddCustomFormField-"]'); + const configureFieldsButton = page.locator( + 'button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-"]', + ); const ariaLabel = await configureFieldsButton.getAttribute('aria-label'); const randomValue = ariaLabel.split('-').pop(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByLabel(`designer-schema-settings-CardItem-SimpleDesigner-${randomValue}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); const blockTitle = 'Form' + dayjs().format('YYYYMMDDHHmmss.SSS').toString(); await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); - await page.locator(`button[aria-label^="schema-initializer-Grid-AddCustomFormField-${randomValue}"]`).hover(); + await page + .locator(`button[aria-label^="schema-initializer-Grid-workflowManual:customForm:configureFields-${randomValue}"]`) + .hover(); await page.getByRole('menuitem', { name: 'Single line text' }).click(); await page .getByLabel(`block-item-Input-${randomValue}-Field display name`) @@ -793,7 +793,7 @@ test.describe('field data', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -902,7 +902,7 @@ test.describe('field data', () => { await page.getByRole('menuitem', { name: preManualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${preManualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${preManualNodeCollectionName}"]`) .hover(); await page .getByLabel(`designer-schema-settings-CardItem-CreateFormDesigner-${preManualNodeCollectionName}`) @@ -912,7 +912,7 @@ test.describe('field data', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${preManualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${preManualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: triggerNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -957,7 +957,7 @@ test.describe('field data', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -1102,7 +1102,7 @@ test.describe('field data', () => { await page.getByRole('menuitem', { name: preManualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${preManualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${preManualNodeCollectionName}"]`) .hover(); await page .getByLabel(`designer-schema-settings-CardItem-UpdateFormDesigner-${preManualNodeCollectionName}`) @@ -1112,7 +1112,7 @@ test.describe('field data', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${preManualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${preManualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: triggerNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -1157,7 +1157,7 @@ test.describe('field data', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/__e2e__/updateRecordForm.test.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/__e2e__/updateRecordForm.test.ts index 83fb84d85..ddff9eb21 100644 --- a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/__e2e__/updateRecordForm.test.ts +++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/__e2e__/updateRecordForm.test.ts @@ -1,27 +1,15 @@ import { faker } from '@faker-js/faker'; import { CollectionTriggerNode, - CreateWorkFlow, - EditWorkFlow, - WorkflowListRecords, + ManualNode, apiCreateWorkflow, apiDeleteWorkflow, + apiFilterList, apiGetWorkflow, - apiUpdateRecord, apiGetWorkflowNodeExecutions, apiUpdateWorkflowTrigger, appendJsonCollectionName, generalWithNoRelationalFields, - QueryRecordNode, - ManualNode, - apiGetRecord, - apiCreateWorkflowNode, - apiGetWorkflowNode, - ClculationNode, - CreateRecordNode, - AggregateNode, - apiGetList, - apiFilterList, } from '@nocobase/plugin-workflow-test/e2e'; import { expect, test } from '@nocobase/test/e2e'; import { dayjs } from '@nocobase/utils'; @@ -112,7 +100,7 @@ test.describe('field data update', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-UpdateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -120,7 +108,7 @@ test.describe('field data update', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -144,7 +132,7 @@ test.describe('field data update', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -264,7 +252,7 @@ test.describe('field data update', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-UpdateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -272,7 +260,7 @@ test.describe('field data update', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -296,7 +284,7 @@ test.describe('field data update', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -416,7 +404,7 @@ test.describe('field data update', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-UpdateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -424,7 +412,7 @@ test.describe('field data update', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -448,7 +436,7 @@ test.describe('field data update', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -568,7 +556,7 @@ test.describe('field data update', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-UpdateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -576,7 +564,7 @@ test.describe('field data update', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -600,7 +588,7 @@ test.describe('field data update', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -720,7 +708,7 @@ test.describe('field data update', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-UpdateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -728,7 +716,7 @@ test.describe('field data update', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -752,7 +740,7 @@ test.describe('field data update', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -872,7 +860,7 @@ test.describe('field data update', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-UpdateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -880,7 +868,7 @@ test.describe('field data update', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -904,7 +892,7 @@ test.describe('field data update', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -1040,7 +1028,7 @@ test.describe('field data update', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-UpdateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -1048,7 +1036,7 @@ test.describe('field data update', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -1072,7 +1060,7 @@ test.describe('field data update', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -1208,7 +1196,7 @@ test.describe('field data update', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-UpdateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -1216,7 +1204,7 @@ test.describe('field data update', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -1240,7 +1228,7 @@ test.describe('field data update', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -1376,7 +1364,7 @@ test.describe('field data update', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-UpdateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -1384,7 +1372,7 @@ test.describe('field data update', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -1408,7 +1396,7 @@ test.describe('field data update', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -1545,7 +1533,7 @@ test.describe('field data update', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-UpdateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -1553,7 +1541,7 @@ test.describe('field data update', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -1577,7 +1565,7 @@ test.describe('field data update', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -1722,7 +1710,7 @@ test.describe('field data update', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-UpdateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -1730,7 +1718,7 @@ test.describe('field data update', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -1754,7 +1742,7 @@ test.describe('field data update', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -1890,7 +1878,7 @@ test.describe('field data update', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-UpdateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -1898,7 +1886,7 @@ test.describe('field data update', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -1922,7 +1910,7 @@ test.describe('field data update', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -2064,7 +2052,7 @@ test.describe('field data update', () => { await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-UpdateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -2072,7 +2060,7 @@ test.describe('field data update', () => { await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -2096,7 +2084,7 @@ test.describe('field data update', () => { const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/__e2e__/workflowTodo.test.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/__e2e__/workflowTodo.test.ts index 6fa027703..672dd6e89 100644 --- a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/__e2e__/workflowTodo.test.ts +++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/__e2e__/workflowTodo.test.ts @@ -1,13 +1,13 @@ import { faker } from '@faker-js/faker'; import { CollectionTriggerNode, + ManualNode, apiCreateWorkflow, apiDeleteWorkflow, apiGetWorkflow, apiUpdateWorkflowTrigger, appendJsonCollectionName, generalWithNoRelationalFields, - ManualNode, } from '@nocobase/plugin-workflow-test/e2e'; import { expect, test } from '@nocobase/test/e2e'; import { dayjs } from '@nocobase/utils'; @@ -72,7 +72,7 @@ test('filter task node', async ({ page, mockPage, mockCollections, mockRecords } await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-CreateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -80,7 +80,7 @@ test('filter task node', async ({ page, mockPage, mockCollections, mockRecords } await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -103,7 +103,7 @@ test('filter task node', async ({ page, mockPage, mockCollections, mockRecords } const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); @@ -182,7 +182,7 @@ test('filter workflow name', async ({ page, mockPage, mockCollections, mockRecor await page.getByRole('menuitem', { name: manualNodeCollectionDisplayName }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByLabel(`designer-schema-settings-CardItem-CreateFormDesigner-${manualNodeCollectionName}`).hover(); await page.getByRole('menuitem', { name: 'Edit block title' }).click(); @@ -190,7 +190,7 @@ test('filter workflow name', async ({ page, mockPage, mockCollections, mockRecor await page.getByLabel('Edit block title').getByRole('textbox').fill(blockTitle); await page.getByRole('button', { name: 'OK', exact: true }).click(); await page - .locator(`button[aria-label^="schema-initializer-Grid-FormItemInitializers-${manualNodeCollectionName}"]`) + .locator(`button[aria-label^="schema-initializer-Grid-form:configureFields-${manualNodeCollectionName}"]`) .hover(); await page.getByRole('menuitem', { name: manualNodeFieldDisplayName }).getByRole('switch').click(); await page.mouse.move(300, 0, { steps: 100 }); @@ -213,7 +213,7 @@ test('filter workflow name', async ({ page, mockPage, mockCollections, mockRecor const newPage = mockPage(); await newPage.goto(); await page.waitForLoadState('networkidle'); - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); await page.getByRole('menuitem', { name: 'check-square Workflow todos' }).click(); await page.mouse.move(300, 0, { steps: 100 }); await page.waitForTimeout(300); diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/index.ts b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/index.ts index 95a7954c1..9832405e1 100644 --- a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/index.ts +++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/index.ts @@ -3,11 +3,16 @@ import WorkflowPlugin from '@nocobase/plugin-workflow/client'; import Manual from './instruction'; +import { NAMESPACE } from '../locale'; import { WorkflowTodo } from './WorkflowTodo'; import { WorkflowTodoBlockInitializer } from './WorkflowTodoBlockInitializer'; -import { NAMESPACE } from '../locale'; -import { addActionButton, addBlockButton } from './instruction/SchemaConfig'; -import { addCustomFormField } from './instruction/forms/custom'; +import { + addActionButton, + addActionButton_deprecated, + addBlockButton, + addBlockButton_deprecated, +} from './instruction/SchemaConfig'; +import { addCustomFormField, addCustomFormField_deprecated } from './instruction/forms/custom'; export default class extends Plugin { async afterAdd() { @@ -22,11 +27,14 @@ export default class extends Plugin { const workflow = this.app.pm.get('workflow') as WorkflowPlugin; workflow.registerInstruction('manual', Manual); + this.app.schemaInitializerManager.add(addBlockButton_deprecated); this.app.schemaInitializerManager.add(addBlockButton); + this.app.schemaInitializerManager.add(addActionButton_deprecated); this.app.schemaInitializerManager.add(addActionButton); + this.app.schemaInitializerManager.add(addCustomFormField_deprecated); this.app.schemaInitializerManager.add(addCustomFormField); - const blockInitializers = this.app.schemaInitializerManager.get('BlockInitializers'); + const blockInitializers = this.app.schemaInitializerManager.get('page:addBlock'); blockInitializers.add('otherBlocks.workflowTodos', { title: `{{t("Workflow todos", { ns: "${NAMESPACE}" })}}`, Component: 'WorkflowTodoBlockInitializer', diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/FormBlockInitializer.tsx b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/FormBlockInitializer.tsx index 656f3bb01..5ee4fc513 100644 --- a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/FormBlockInitializer.tsx +++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/FormBlockInitializer.tsx @@ -22,7 +22,7 @@ function InternalFormBlockInitializer({ schema, ...others }) { async function onConfirm({ item }) { const template = item.template ? await getTemplateSchemaByMode(item) : null; const result = createFormBlockSchema({ - actionInitializers: 'AddActionButton', + actionInitializers: 'workflowManual:form:configureActions', actions: { resolve: { type: 'void', diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/SchemaConfig.tsx b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/SchemaConfig.tsx index 3b08356f4..271830b44 100644 --- a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/SchemaConfig.tsx +++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/SchemaConfig.tsx @@ -8,13 +8,13 @@ import { useTranslation } from 'react-i18next'; import { Action, ActionContextProvider, + CompatibleSchemaInitializer, DefaultValueProvider, FormActiveFieldsProvider, GeneralSchemaDesigner, InitializerWithSwitch, SchemaComponent, SchemaComponentContext, - SchemaInitializer, SchemaInitializerItem, SchemaInitializerItemType, SchemaSettingsBlockTitleItem, @@ -122,7 +122,10 @@ function SimpleDesigner() { ); } -export const addBlockButton: SchemaInitializer = new SchemaInitializer({ +/** + * @deprecated + */ +export const addBlockButton_deprecated = new CompatibleSchemaInitializer({ name: 'AddBlockButton', wrap: gridRowColWrap, title: '{{t("Add block")}}', @@ -187,6 +190,74 @@ export const addBlockButton: SchemaInitializer = new SchemaInitializer({ ], }); +export const addBlockButton = new CompatibleSchemaInitializer( + { + name: 'workflowManual:popup:configureUserInterface:addBlock', + wrap: gridRowColWrap, + title: '{{t("Add block")}}', + items: [ + { + type: 'itemGroup', + name: 'dataBlocks', + title: '{{t("Data blocks")}}', + hideIfNoChildren: true, + useChildren() { + const workflowPlugin = usePlugin(WorkflowPlugin); + const current = useNodeContext(); + const nodes = useAvailableUpstreams(current); + const triggerInitializers = [useTriggerInitializers()].filter(Boolean); + const nodeBlockInitializers = nodes + .map((node) => { + const instruction = workflowPlugin.instructions.get(node.type); + return instruction?.useInitializers?.(node); + }) + .filter(Boolean); + const dataBlockInitializers: any = [ + ...triggerInitializers, + ...(nodeBlockInitializers.length + ? [ + { + name: 'nodes', + type: 'subMenu', + title: `{{t("Node result", { ns: "${NAMESPACE}" })}}`, + children: nodeBlockInitializers, + }, + ] + : []), + ].filter(Boolean); + return dataBlockInitializers; + }, + }, + { + type: 'itemGroup', + name: 'form', + title: '{{t("Form")}}', + useChildren() { + const dm = useDataSourceManager(); + const allCollections = dm.getAllCollections(); + return Array.from(manualFormTypes.getValues()).map((item: ManualFormType) => { + const { useInitializer: getInitializer } = item.config; + return getInitializer({ allCollections }); + }); + }, + }, + { + type: 'itemGroup', + name: 'otherBlocks', + title: '{{t("Other blocks")}}', + children: [ + { + name: 'markdown', + title: '{{t("Markdown")}}', + Component: 'MarkdownBlockInitializer', + }, + ], + }, + ], + }, + addBlockButton_deprecated, +); + function AssignedFieldValues() { const ctx = useContext(SchemaComponentContext); const { t } = useTranslation(); @@ -197,7 +268,7 @@ function AssignedFieldValues() { fieldSchema?.['x-action-settings']?.assignedValues?.schema ?? { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'CustomFormItemInitializers', + 'x-initializer': 'assignFieldValuesForm:configureFields', properties: {}, }, ); @@ -365,7 +436,10 @@ function ActionInitializer() { ); } -export const addActionButton: SchemaInitializer = new SchemaInitializer({ +/** + * @deprecated + */ +export const addActionButton_deprecated = new CompatibleSchemaInitializer({ name: 'AddActionButton', title: '{{t("Configure actions")}}', items: [ @@ -396,6 +470,40 @@ export const addActionButton: SchemaInitializer = new SchemaInitializer({ ], }); +export const addActionButton = new CompatibleSchemaInitializer( + { + name: 'workflowManual:form:configureActions', + title: '{{t("Configure actions")}}', + items: [ + { + name: 'jobStatusResolved', + title: `{{t("Continue the process", { ns: "${NAMESPACE}" })}}`, + Component: ContinueInitializer, + action: JOB_STATUS.RESOLVED, + actionProps: { + type: 'primary', + }, + }, + { + name: 'jobStatusRejected', + title: `{{t("Terminate the process", { ns: "${NAMESPACE}" })}}`, + Component: ActionInitializer, + action: JOB_STATUS.REJECTED, + actionProps: { + danger: true, + }, + }, + { + name: 'jobStatusPending', + title: `{{t("Save temporarily", { ns: "${NAMESPACE}" })}}`, + Component: ActionInitializer, + action: JOB_STATUS.PENDING, + }, + ], + }, + addActionButton_deprecated, +); + // NOTE: fake useAction for ui configuration function useSubmit() { // const { values, submit, id: formId } = useForm(); @@ -442,7 +550,7 @@ export function SchemaConfig({ value, onChange }) { 'x-component-props': {}, 'x-initializer': 'TabPaneInitializers', 'x-initializer-props': { - gridInitializer: 'AddBlockButton', + gridInitializer: 'workflowManual:popup:configureUserInterface:addBlock', }, properties: value ?? { tab1: { @@ -454,7 +562,7 @@ export function SchemaConfig({ value, onChange }) { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'AddBlockButton', + 'x-initializer': 'workflowManual:popup:configureUserInterface:addBlock', properties: {}, }, }, diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/forms/custom.tsx b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/forms/custom.tsx index 8ef4198e1..f81a1057c 100644 --- a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/forms/custom.tsx +++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/forms/custom.tsx @@ -8,10 +8,10 @@ import lodash from 'lodash'; import { ActionContextProvider, CollectionProvider_deprecated, + CompatibleSchemaInitializer, FormBlockContext, RecordProvider, SchemaComponent, - SchemaInitializer, SchemaInitializerItem, SchemaInitializerItemType, SchemaInitializerItems, @@ -103,7 +103,7 @@ function CustomFormBlockInitializer() { grid: { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'AddCustomFormField', + 'x-initializer': 'workflowManual:customForm:configureFields', }, actions: { type: 'void', @@ -116,7 +116,7 @@ function CustomFormBlockInitializer() { flexWrap: 'wrap', }, }, - 'x-initializer': 'AddActionButton', + 'x-initializer': 'workflowManual:form:configureActions', properties: { resolve: { type: 'void', @@ -322,7 +322,10 @@ const CustomItemsComponent = (props) => { ); }; -export const addCustomFormField: SchemaInitializer = new SchemaInitializer({ +/** + * @deprecated + */ +export const addCustomFormField_deprecated = new CompatibleSchemaInitializer({ name: 'AddCustomFormField', wrap: gridRowColWrap, insertPosition: 'beforeEnd', @@ -330,6 +333,17 @@ export const addCustomFormField: SchemaInitializer = new SchemaInitializer({ ItemsComponent: CustomItemsComponent, }); +export const addCustomFormField = new CompatibleSchemaInitializer( + { + name: 'workflowManual:customForm:configureFields', + wrap: gridRowColWrap, + insertPosition: 'beforeEnd', + title: "{{t('Configure fields')}}", + ItemsComponent: CustomItemsComponent, + }, + addCustomFormField_deprecated, +); + function CustomFormFieldInitializer() { const itemConfig = useSchemaInitializerItem(); const { insert, setVisible } = useSchemaInitializer(); diff --git a/packages/plugins/@nocobase/plugin-workflow-test/src/e2e/e2ePageObjectModel.ts b/packages/plugins/@nocobase/plugin-workflow-test/src/e2e/e2ePageObjectModel.ts index d351cda2f..a5bed4fc2 100644 --- a/packages/plugins/@nocobase/plugin-workflow-test/src/e2e/e2ePageObjectModel.ts +++ b/packages/plugins/@nocobase/plugin-workflow-test/src/e2e/e2ePageObjectModel.ts @@ -434,7 +434,9 @@ export class ManualNode { .getByRole('button', { name: 'Configure' }); this.assigneesDropDown = page.getByTestId('select-single'); this.configureUserInterfaceButton = page.getByRole('button', { name: 'Configure user interface' }); - this.addBlockButton = page.getByLabel('schema-initializer-Grid-AddBlockButton-workflows'); + this.addBlockButton = page.getByLabel( + 'schema-initializer-Grid-workflowManual:popup:configureUserInterface:addBlock-workflows', + ); this.triggerDataMenu = page.getByRole('menuitem', { name: 'Trigger data' }); this.nodeDataMenu = page.getByRole('menuitem', { name: 'Node result right' }); this.customFormMenu = page.getByRole('menuitem', { name: 'Custom form' }); diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/__e2e__/calculationNode/formulaEngine.test.ts b/packages/plugins/@nocobase/plugin-workflow/src/client/__e2e__/calculationNode/formulaEngine.test.ts index 557874253..3aae8f6ae 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/client/__e2e__/calculationNode/formulaEngine.test.ts +++ b/packages/plugins/@nocobase/plugin-workflow/src/client/__e2e__/calculationNode/formulaEngine.test.ts @@ -563,7 +563,7 @@ test.skip('Collection event add data trigger, get front manual node add form sin version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'AddBlockButton', + 'x-initializer': 'workflowManual:popup:configureUserInterface:addBlock', name: 'grid', properties: { '59t231zx5vx': { @@ -608,7 +608,7 @@ test.skip('Collection event add data trigger, get front manual node add form sin version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', name: 'grid', properties: { yt2rbpepdsl: { @@ -646,7 +646,7 @@ test.skip('Collection event add data trigger, get front manual node add form sin _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'AddActionButton', + 'x-initializer': 'workflowManual:form:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/__e2e__/calculationNode/mathEngine.test.ts b/packages/plugins/@nocobase/plugin-workflow/src/client/__e2e__/calculationNode/mathEngine.test.ts index ff318ec9f..710d97b1e 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/client/__e2e__/calculationNode/mathEngine.test.ts +++ b/packages/plugins/@nocobase/plugin-workflow/src/client/__e2e__/calculationNode/mathEngine.test.ts @@ -558,7 +558,7 @@ test.skip('Collection event add data trigger, get front manual node add form sin version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'AddBlockButton', + 'x-initializer': 'workflowManual:popup:configureUserInterface:addBlock', name: 'grid', properties: { '59t231zx5vx': { @@ -603,7 +603,7 @@ test.skip('Collection event add data trigger, get front manual node add form sin version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', name: 'grid', properties: { yt2rbpepdsl: { @@ -641,7 +641,7 @@ test.skip('Collection event add data trigger, get front manual node add form sin _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'AddActionButton', + 'x-initializer': 'workflowManual:form:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/components/CollectionBlockInitializer.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/components/CollectionBlockInitializer.tsx index 048b2a942..72bc3b079 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/client/components/CollectionBlockInitializer.tsx +++ b/packages/plugins/@nocobase/plugin-workflow/src/client/components/CollectionBlockInitializer.tsx @@ -48,7 +48,7 @@ function InnerCollectionBlockInitializer({ collection, dataSource, ...props }) { grid: template || { type: 'void', 'x-component': 'Grid', - 'x-initializer': 'ReadPrettyFormItemInitializers', + 'x-initializer': 'details:configureFields', properties: {}, }, }, diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/migrations/20230411034722-manual-multi-form.ts b/packages/plugins/@nocobase/plugin-workflow/src/server/migrations/20230411034722-manual-multi-form.ts index 1c2b6a7d3..a2a786694 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/server/migrations/20230411034722-manual-multi-form.ts +++ b/packages/plugins/@nocobase/plugin-workflow/src/server/migrations/20230411034722-manual-multi-form.ts @@ -113,7 +113,7 @@ function migrateConfig({ schema = {}, actions = [] }: { schema: any; actions: nu }, properties: { grid: Object.assign(formBlock.properties.grid, { - 'x-initializer': 'AddCustomFormField', + 'x-initializer': 'workflowManual:customForm:configureFields', }), // 7. actions: { @@ -126,7 +126,7 @@ function migrateConfig({ schema = {}, actions = [] }: { schema: any; actions: nu marginTop: '1.5em', }, }, - 'x-initializer': 'AddActionButton', + 'x-initializer': 'workflowManual:form:configureActions', properties: schema.actions, }, }, diff --git a/packages/plugins/@nocobase/plugin-workflow/src/server/migrations/20230612021134-manual-collection-block.ts b/packages/plugins/@nocobase/plugin-workflow/src/server/migrations/20230612021134-manual-collection-block.ts index dfee79936..05fe1ec51 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/server/migrations/20230612021134-manual-collection-block.ts +++ b/packages/plugins/@nocobase/plugin-workflow/src/server/migrations/20230612021134-manual-collection-block.ts @@ -64,7 +64,7 @@ function migrateSchema(schema = {}): object { type: 'void', name: 'grid', 'x-component': 'Grid', - 'x-initializer': 'ReadPrettyFormItemInitializers', + 'x-initializer': 'details:configureFields', properties: grid.properties, }, }, From 99358ee796ff28a597529e5ef0185c1b9891cebf Mon Sep 17 00:00:00 2001 From: jack zhang <1098626505@qq.com> Date: Thu, 14 Mar 2024 14:30:02 +0800 Subject: [PATCH 12/15] fix: block template (#3714) --- packages/core/client/src/schema-settings/SchemaSettings.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/client/src/schema-settings/SchemaSettings.tsx b/packages/core/client/src/schema-settings/SchemaSettings.tsx index ac0b8fbb1..223007b7a 100644 --- a/packages/core/client/src/schema-settings/SchemaSettings.tsx +++ b/packages/core/client/src/schema-settings/SchemaSettings.tsx @@ -424,6 +424,7 @@ export const SchemaSettingsFormItemTemplate = function FormItemTemplate(props) { collectionName, resourceName, componentName, + dataSourceKey: collection.dataSource, name: values.name, uid: gridSchema['x-uid'], }); From ba1e44c527f8f6b72d0ecf2907fe80a887530bfc Mon Sep 17 00:00:00 2001 From: Zeke Zhang <958414905@qq.com> Date: Thu, 14 Mar 2024 18:10:54 +0800 Subject: [PATCH 13/15] feat: support to set data loading mode (#3712) * feat: add setDataLoadingModeSettingItem * feat: support to set data loading mode * chore: add translation * chore: refresh the block immediately after the configuration has been changed * feat: the data loading mode should also work for the filter buttons * feat: support old version * fix: data scope * fix: fix known bugs * fix: add setting for table selector * test: fix e2e --- .../block-provider/DetailsBlockProvider.tsx | 4 +- .../src/block-provider/TableBlockProvider.tsx | 13 +++- .../src/block-provider/TableFieldProvider.tsx | 2 +- .../block-provider/TableSelectorProvider.tsx | 11 ++- .../client/src/block-provider/hooks/index.ts | 19 ++++- .../data-block/DataBlockProvider.tsx | 1 + .../data-block/DataBlockRequestProvider.tsx | 6 +- .../src/filter-provider/FilterProvider.tsx | 23 ++++-- packages/core/client/src/index.ts | 1 + packages/core/client/src/locale/en_US.json | 4 ++ packages/core/client/src/locale/es_ES.json | 4 ++ packages/core/client/src/locale/fr_FR.json | 4 ++ packages/core/client/src/locale/ja_JP.json | 4 ++ packages/core/client/src/locale/ko_KR.json | 4 ++ packages/core/client/src/locale/pt_BR.json | 4 ++ packages/core/client/src/locale/ru_RU.json | 6 +- packages/core/client/src/locale/tr_TR.json | 6 +- packages/core/client/src/locale/uk_UA.json | 4 ++ packages/core/client/src/locale/zh-CN.json | 4 ++ packages/core/client/src/locale/zh-TW.json | 4 ++ ...s.ts => multiDataDetailsBlockSettings.tsx} | 9 ++- .../setDataLoadingModeSettingsItem.tsx | 71 +++++++++++++++++++ .../grid-card/gridCardBlockSettings.ts | 3 +- .../data-blocks/list/listBlockSettings.ts | 2 + .../tableSelectorBlockSettings.ts | 11 ++- .../data-blocks/table/tableBlockSettings.tsx | 15 ++-- .../antd/filter/useFilterActionProps.ts | 21 +++++- .../antd/form-v2/Form.Settings.tsx | 2 + .../antd/grid-card/GridCard.Decorator.tsx | 2 +- .../antd/grid-card/GridCard.Designer.tsx | 2 + .../antd/list/List.Decorator.tsx | 2 +- .../antd/list/List.Designer.tsx | 2 + .../antd/table-v2/TableBlockDesigner.tsx | 5 +- .../antd/table-v2/TableSelectorDesigner.tsx | 2 + .../src/client/Gantt.Settings.tsx | 17 ++++- .../src/client/block/MapBlock.Settings.tsx | 17 +++-- 36 files changed, 275 insertions(+), 36 deletions(-) rename packages/core/client/src/modules/blocks/data-blocks/details-multi/{multiDataDetailsBlockSettings.ts => multiDataDetailsBlockSettings.tsx} (95%) create mode 100644 packages/core/client/src/modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem.tsx diff --git a/packages/core/client/src/block-provider/DetailsBlockProvider.tsx b/packages/core/client/src/block-provider/DetailsBlockProvider.tsx index 4f228ab21..36a2a95b0 100644 --- a/packages/core/client/src/block-provider/DetailsBlockProvider.tsx +++ b/packages/core/client/src/block-provider/DetailsBlockProvider.tsx @@ -38,7 +38,7 @@ const InternalDetailsBlockProvider = (props) => { filterOption: service?.params?.[0]?.filter, }); useEffect(() => { - if (!_.isEmpty(filter)) { + if (!_.isEmpty(filter) && !service.loading) { service?.run({ ...service?.params?.[0], filter }); } }, [JSON.stringify(filter)]); @@ -80,7 +80,7 @@ export const useDetailsBlockProps = () => { }) .catch(console.error); } - }, [ctx.service.loading]); + }, [ctx.form, ctx.service?.data?.data, ctx.service.loading]); return { form: ctx.form, }; diff --git a/packages/core/client/src/block-provider/TableBlockProvider.tsx b/packages/core/client/src/block-provider/TableBlockProvider.tsx index 517ef47a2..34170f93e 100644 --- a/packages/core/client/src/block-provider/TableBlockProvider.tsx +++ b/packages/core/client/src/block-provider/TableBlockProvider.tsx @@ -145,7 +145,15 @@ export const useTableBlockProps = () => { field.componentProps.pagination.total = ctx?.service?.data?.meta?.count; field.componentProps.pagination.current = ctx?.service?.data?.meta?.page; } - }, [ctx?.service?.loading]); + }, [ + ctx?.field?.data?.selectedRowKeys, + ctx?.service?.data?.data, + ctx?.service?.data?.meta?.count, + ctx?.service?.data?.meta?.page, + ctx?.service?.data?.meta?.pageSize, + ctx?.service?.loading, + field, + ]); return { childrenColumnName: ctx.childrenColumnName, loading: ctx?.service?.loading, @@ -199,6 +207,9 @@ export const useTableBlockProps = () => { const storedFilter = block.service.params?.[1]?.filters || {}; if (selectedRow.includes(record[ctx.rowKey])) { + if (block.dataLoadingMode === 'manual') { + return block.clearData(); + } delete storedFilter[uid]; } else { storedFilter[uid] = { diff --git a/packages/core/client/src/block-provider/TableFieldProvider.tsx b/packages/core/client/src/block-provider/TableFieldProvider.tsx index 6b14b2e3f..18966e757 100644 --- a/packages/core/client/src/block-provider/TableFieldProvider.tsx +++ b/packages/core/client/src/block-provider/TableFieldProvider.tsx @@ -148,7 +148,7 @@ export const useTableFieldProps = () => { field.data = field.data || {}; field.data.selectedRowKeys = ctx?.field?.data?.selectedRowKeys; } - }, [ctx?.service?.loading]); + }, [ctx?.field?.data?.selectedRowKeys, ctx?.service?.data?.data, ctx?.service?.loading, field]); return { size: 'middle', loading: ctx?.service?.loading, diff --git a/packages/core/client/src/block-provider/TableSelectorProvider.tsx b/packages/core/client/src/block-provider/TableSelectorProvider.tsx index 4d422b8e8..11f3903e0 100644 --- a/packages/core/client/src/block-provider/TableSelectorProvider.tsx +++ b/packages/core/client/src/block-provider/TableSelectorProvider.tsx @@ -290,7 +290,16 @@ export const useTableSelectorProps = () => { field.componentProps.pagination.total = ctx?.service?.data?.meta?.count; field.componentProps.pagination.current = ctx?.service?.data?.meta?.page; } - }, [ctx?.service?.loading]); + }, [ + collectionField?.foreignKey, + ctx?.field?.data?.selectedRowKeys, + ctx?.service?.data?.data, + ctx?.service?.data?.meta?.count, + ctx?.service?.data?.meta?.page, + ctx?.service?.data?.meta?.pageSize, + ctx?.service?.loading, + field, + ]); return { loading: ctx?.service?.loading, showIndex: false, diff --git a/packages/core/client/src/block-provider/hooks/index.ts b/packages/core/client/src/block-provider/hooks/index.ts index 1a7efc58c..a7747989d 100644 --- a/packages/core/client/src/block-provider/hooks/index.ts +++ b/packages/core/client/src/block-provider/hooks/index.ts @@ -11,6 +11,7 @@ import { useReactToPrint } from 'react-to-print'; import { AssociationFilter, useCollectionRecord, + useDataLoadingMode, useDataSourceHeaders, useFormActiveFields, useFormBlockContext, @@ -198,6 +199,10 @@ export const useCreateActionProps = () => { const collectValues = useCollectValuesToSubmit(); const action = record.isNew ? actionField.componentProps.saveMode || 'create' : 'update'; const filterKeys = actionField.componentProps.filterKeys?.checked || []; + const dataLoadingMode = useDataLoadingMode(); + + console.log('dataLoadingMode', dataLoadingMode); + return { async onClick() { const { onSuccess, skipValidator, triggerWorkflows } = actionSchema?.['x-action-settings'] ?? {}; @@ -426,6 +431,10 @@ export const useFilterBlockActionProps = () => { block.defaultFilter, ]); + if (block.dataLoadingMode === 'manual' && _.isEmpty(mergedFilter)) { + return block.clearData(); + } + return block.doFilter( { ...param, @@ -436,11 +445,10 @@ export const useFilterBlockActionProps = () => { ); }), ); - actionField.data.loading = false; } catch (error) { console.error(error); - actionField.data.loading = false; } + actionField.data.loading = false; }, }; }; @@ -466,6 +474,10 @@ export const useResetBlockActionProps = () => { const target = targets.find((target) => target.uid === block.uid); if (!target) return; + if (block.dataLoadingMode === 'manual') { + return block.clearData(); + } + const param = block.service.params?.[0] || {}; // 保留原有的 filter const storedFilter = block.service.params?.[1]?.filters || {}; @@ -1208,6 +1220,9 @@ export const useAssociationFilterBlockProps = () => { [filterKey]: value, }; } else { + if (block.dataLoadingMode === 'manual') { + return block.clearData(); + } delete storedFilter[key]; } diff --git a/packages/core/client/src/data-source/data-block/DataBlockProvider.tsx b/packages/core/client/src/data-source/data-block/DataBlockProvider.tsx index cb1ea1170..6936566d6 100644 --- a/packages/core/client/src/data-source/data-block/DataBlockProvider.tsx +++ b/packages/core/client/src/data-source/data-block/DataBlockProvider.tsx @@ -24,6 +24,7 @@ export interface AllDataBlockProps { parentRecord?: CollectionRecord; requestService?: UseRequestService; requestOptions?: UseRequestOptions; + dataLoadingMode?: 'auto' | 'manual'; [index: string]: any; } diff --git a/packages/core/client/src/data-source/data-block/DataBlockRequestProvider.tsx b/packages/core/client/src/data-source/data-block/DataBlockRequestProvider.tsx index 45759d922..37c88569c 100644 --- a/packages/core/client/src/data-source/data-block/DataBlockRequestProvider.tsx +++ b/packages/core/client/src/data-source/data-block/DataBlockRequestProvider.tsx @@ -6,11 +6,13 @@ import { CollectionRecordProvider, CollectionRecord } from '../collection-record import { AllDataBlockProps, useDataBlockProps } from './DataBlockProvider'; import { useDataBlockResource } from './DataBlockResourceProvider'; import { useDataSourceHeaders } from '../utils'; +import { useDataLoadingMode } from '../../modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem'; export const BlockRequestContext = createContext>(null); BlockRequestContext.displayName = 'BlockRequestContext'; function useCurrentRequest(options: Omit) { + const dataLoadingMode = useDataLoadingMode(); const resource = useDataBlockResource(); const { action, params = {}, record, requestService, requestOptions } = options; if (params.filterByTk === undefined) { @@ -36,13 +38,13 @@ function useCurrentRequest(options: Omit) { // 因为修改 Schema 会导致 params 对象发生变化,所以这里使用 `DeepCompare` useDeepCompareEffect(() => { - if (action) { + if (action && dataLoadingMode === 'auto') { request.run(); } }, [params, action, record]); useUpdateEffect(() => { - if (action) { + if (action && dataLoadingMode === 'auto') { request.run(); } }, [resource]); diff --git a/packages/core/client/src/filter-provider/FilterProvider.tsx b/packages/core/client/src/filter-provider/FilterProvider.tsx index faaa7aee0..cf24dba71 100644 --- a/packages/core/client/src/filter-provider/FilterProvider.tsx +++ b/packages/core/client/src/filter-provider/FilterProvider.tsx @@ -1,10 +1,12 @@ import { useField, useFieldSchema } from '@formily/react'; import { uniqBy } from 'lodash'; -import React, { createContext, useEffect, useRef } from 'react'; +import React, { createContext, useCallback, useEffect, useRef } from 'react'; import { useBlockRequestContext } from '../block-provider/BlockProvider'; import { CollectionFieldOptions_deprecated, useCollection_deprecated } from '../collection-manager'; import { removeNullCondition } from '../schema-component'; import { mergeFilter, useAssociatedFields } from './utils'; +import { useDataLoadingMode } from '../modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem'; +import { GeneralField } from '@formily/core'; enum FILTER_OPERATOR { AND = '$and', @@ -40,6 +42,8 @@ export interface DataBlock { doFilter: (params: any, params2?: any) => Promise; /** 清除筛选区块设置的筛选参数 */ clearFilter: (uid: string) => void; + /** 将数据区块的数据置为空 */ + clearData: () => void; /** 数据区块表中所有的关系字段 */ associatedFields?: CollectionFieldOptions_deprecated[]; /** 数据区块表中所有的外键字段 */ @@ -50,6 +54,11 @@ export interface DataBlock { service?: any; /** 数据区块所的 DOM 容器 */ dom: HTMLElement; + /** + * auto: 数据区块会在初始渲染时请求数据 + * manual: 只有当点击了筛选按钮,才会请求数据 + */ + dataLoadingMode?: 'auto' | 'manual'; } interface FilterContextValue { @@ -89,13 +98,14 @@ export const DataBlockCollector = ({ const fieldSchema = useFieldSchema(); const associatedFields = useAssociatedFields(); const container = useRef(null); + const dataLoadingMode = useDataLoadingMode(); const shouldApplyFilter = field.decoratorType !== 'FilterFormBlockProvider' && field.decoratorType !== 'FormBlockProvider' && field.decoratorProps.blockType !== 'filter'; - const addBlockToDataBlocks = () => { + const addBlockToDataBlocks = useCallback(() => { recordDataBlocks({ uid: fieldSchema['x-uid'], title: field.componentProps.title, @@ -106,6 +116,7 @@ export const DataBlockCollector = ({ defaultFilter: params?.filter || {}, service, dom: container.current, + dataLoadingMode, clearFilter(uid: string) { const param = this.service.params?.[0] || {}; const storedFilter = this.service.params?.[1]?.filters || {}; @@ -124,12 +135,15 @@ export const DataBlockCollector = ({ { filters: storedFilter }, ); }, + clearData() { + this.service.mutate(undefined); + }, }); - }; + }, [associatedFields, collection, dataLoadingMode, field, fieldSchema, params?.filter, recordDataBlocks, service]); useEffect(() => { if (shouldApplyFilter) addBlockToDataBlocks(); - }, [params?.filter, service]); + }, [params.filter, service, dataLoadingMode, shouldApplyFilter, addBlockToDataBlocks]); useEffect(() => { return () => { @@ -163,6 +177,7 @@ export const useFilterBlock = () => { // 这里的值有可能会变化,所以需要更新 existingBlock.service = block.service; existingBlock.defaultFilter = block.defaultFilter; + existingBlock.dataLoadingMode = block.dataLoadingMode; return; } // 由于 setDataBlocks 是异步操作,所以上面的 existingBlock 在判断时有可能用的是旧的 dataBlocks,所以下面还需要根据 uid 进行去重操作 diff --git a/packages/core/client/src/index.ts b/packages/core/client/src/index.ts index 64bcbcdff..7f62193cc 100644 --- a/packages/core/client/src/index.ts +++ b/packages/core/client/src/index.ts @@ -58,3 +58,4 @@ export * from './modules/blocks/BlockSchemaToolbar'; export * from './modules/blocks/data-blocks/table'; export * from './modules/blocks/data-blocks/form'; export * from './modules/blocks/data-blocks/table-selector'; +export * from './modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem'; diff --git a/packages/core/client/src/locale/en_US.json b/packages/core/client/src/locale/en_US.json index f9e39fb4f..e3c4e97b4 100644 --- a/packages/core/client/src/locale/en_US.json +++ b/packages/core/client/src/locale/en_US.json @@ -104,6 +104,10 @@ "Submit": "Submit", "Close": "Close", "Set the data scope": "Set the data scope", + "Set data loading mode": "Set data loading mode", + "Automatically load data": "Automatically load data", + "Load data after filtering": "Load data after filtering", + "Data loading mode": "Data loading mode", "Data blocks": "Data blocks", "Filter blocks": "Filter blocks", "Table": "Table", diff --git a/packages/core/client/src/locale/es_ES.json b/packages/core/client/src/locale/es_ES.json index 6bbf0c913..af55655a2 100644 --- a/packages/core/client/src/locale/es_ES.json +++ b/packages/core/client/src/locale/es_ES.json @@ -99,6 +99,10 @@ "Submit": "Enviar", "Close": "Cerrar", "Set the data scope": "Establecer el ámbito de los datos", + "Data loading mode": "Modo de carga de datos", + "Set data loading mode": "Establecer el modo de carga de datos", + "Automatically load data": "Cargar datos", + "Load data after filtering": "Cargar datos después de filtrar", "Data blocks": "Bloques de datos", "Filter blocks": "Bloques de filtro", "Table": "Tabla", diff --git a/packages/core/client/src/locale/fr_FR.json b/packages/core/client/src/locale/fr_FR.json index a81918bae..852c37671 100644 --- a/packages/core/client/src/locale/fr_FR.json +++ b/packages/core/client/src/locale/fr_FR.json @@ -99,6 +99,10 @@ "Submit": "Envoyer", "Close": "Fermer", "Set the data scope": "Définir la portée des données", + "Data loading mode": "Mode de chargement des données", + "Set data loading mode": "Définir le mode de chargement des données", + "Automatically load data": "Charger automatiquement les données", + "Load data after filtering": "Charger les données après filtrage", "Data blocks": "Blocs de données", "Filter blocks": "Blocs de filtre", "Table": "Tableau", diff --git a/packages/core/client/src/locale/ja_JP.json b/packages/core/client/src/locale/ja_JP.json index c5d8fc488..f70622c4c 100644 --- a/packages/core/client/src/locale/ja_JP.json +++ b/packages/core/client/src/locale/ja_JP.json @@ -102,6 +102,10 @@ "Submit": "送信", "Close": "閉じる", "Set the data scope": "データ範囲の設定", + "Data loading mode": "データ読み込みモード", + "Set data loading mode": "データ読み込みモードの設定", + "Automatically load data": "データを自動的に読み込む", + "Load data after filtering": "フィルタリング後にデータを読み込む", "Data blocks": "データブロック", "Filter blocks": "フィルターブロック", "Table OID(Inheritance)": "データテーブルOID(継承)", diff --git a/packages/core/client/src/locale/ko_KR.json b/packages/core/client/src/locale/ko_KR.json index e92098e09..5d0da90cd 100644 --- a/packages/core/client/src/locale/ko_KR.json +++ b/packages/core/client/src/locale/ko_KR.json @@ -122,6 +122,10 @@ "Submit": "제출", "Close": "닫기", "Set the data scope": "데이터 범위 설정", + "Data loading mode": "데이터 로드 모드", + "Set data loading mode": "데이터 로드 모드 설정", + "Automatically load data": "데이터 자동 로드", + "Load data after filtering": "필터링 후 데이터 로드", "Block": "블록", "Data blocks": "데이터 블록", "Filter blocks": "필터 블록", diff --git a/packages/core/client/src/locale/pt_BR.json b/packages/core/client/src/locale/pt_BR.json index 5a0075d59..956dbd6ff 100644 --- a/packages/core/client/src/locale/pt_BR.json +++ b/packages/core/client/src/locale/pt_BR.json @@ -73,6 +73,10 @@ "Submit": "Enviar", "Close": "Fechar", "Set the data scope": "Definir o escopo de dados", + "Data loading mode": "Modo de carregamento de dados", + "Set data loading mode": "Definir modo de carregamento de dados", + "Automatically load data": "Carregar dados automaticamente", + "Load data after filtering": "Carregar dados após filtragem", "Data blocks": "Blocos de dados", "Filter blocks": "Blocos de filtro", "Table": "Tabela", diff --git a/packages/core/client/src/locale/ru_RU.json b/packages/core/client/src/locale/ru_RU.json index a53571217..cc7aac53f 100644 --- a/packages/core/client/src/locale/ru_RU.json +++ b/packages/core/client/src/locale/ru_RU.json @@ -69,6 +69,10 @@ "Submit": "Отправить", "Close": "Закрыть", "Set the data scope": "Установить область данных", + "Data loading mode": "Режим загрузки данных", + "Set data loading mode": "Установить режим загрузки данных", + "Automatically load data": "Автоматически загружать данные", + "Load data after filtering": "Загружать данные после фильтрации", "Data blocks": "Блоки данных", "Filter blocks": "Просеивающие блоки", "Table": "Таблица", @@ -555,4 +559,4 @@ "Home page": "Домашняя страница", "Handbook": "Руководство пользователя", "License": "Лицензия" -} \ No newline at end of file +} diff --git a/packages/core/client/src/locale/tr_TR.json b/packages/core/client/src/locale/tr_TR.json index 47acb64db..6a16fc2bd 100644 --- a/packages/core/client/src/locale/tr_TR.json +++ b/packages/core/client/src/locale/tr_TR.json @@ -69,6 +69,10 @@ "Submit": "Gönder", "Close": "Kapat", "Set the data scope": "Veri kapsamını ayarla", + "Data loading mode": "Veri yükleme modu", + "Set data loading mode": "Veri yükleme modunu ayarla", + "Automatically load data": "Veriyi otomatik yükle", + "Load data after filtering": "Filtrelemeden sonra veriyi yükle", "Data blocks": "Veri Blokları", "Filter blocks": "Filtre blokları", "Table": "Tablo", @@ -552,4 +556,4 @@ "Home page": "Anasayfa", "Handbook": "Kullanıcı kılavuzu", "License": "Lisans" -} \ No newline at end of file +} diff --git a/packages/core/client/src/locale/uk_UA.json b/packages/core/client/src/locale/uk_UA.json index 2aceca92b..a9fcf430b 100644 --- a/packages/core/client/src/locale/uk_UA.json +++ b/packages/core/client/src/locale/uk_UA.json @@ -99,6 +99,10 @@ "Submit": "Відправити", "Close": "Закрити", "Set the data scope": "Встановити обсяг даних", + "Data loading mode": "Режим завантаження даних", + "Set data loading mode": "Встановити режим завантаження даних", + "Automatically load data": "Автоматично завантажувати дані", + "Load data after filtering": "Завантажувати дані після фільтрації", "Data blocks": "Блоки даних", "Filter blocks": "Блоки фільтрів", "Table": "Таблиця", diff --git a/packages/core/client/src/locale/zh-CN.json b/packages/core/client/src/locale/zh-CN.json index 13f2b191e..d4ad16f75 100644 --- a/packages/core/client/src/locale/zh-CN.json +++ b/packages/core/client/src/locale/zh-CN.json @@ -122,6 +122,10 @@ "Submit": "提交", "Close": "关闭", "Set the data scope": "设置数据范围", + "Data loading mode": "数据加载方式", + "Set data loading mode": "设置数据加载方式", + "Automatically load data": "自动加载数据", + "Load data after filtering": "筛选后才加载数据", "Block": "区块", "Data blocks": "数据区块", "Filter blocks": "筛选区块", diff --git a/packages/core/client/src/locale/zh-TW.json b/packages/core/client/src/locale/zh-TW.json index 14aed365a..5af1598dc 100644 --- a/packages/core/client/src/locale/zh-TW.json +++ b/packages/core/client/src/locale/zh-TW.json @@ -122,6 +122,10 @@ "Submit": "提交", "Close": "關閉", "Set the data scope": "設定資料範圍", + "Data loading mode": "資料加載方式", + "Set data loading mode": "設定資料加載方式", + "Automatically load data": "自動加載資料", + "Load data after filtering": "篩選後才加載資料", "Block": "區塊", "Data blocks": "資料區塊", "Filter blocks": "篩選區塊", diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-multi/multiDataDetailsBlockSettings.ts b/packages/core/client/src/modules/blocks/data-blocks/details-multi/multiDataDetailsBlockSettings.tsx similarity index 95% rename from packages/core/client/src/modules/blocks/data-blocks/details-multi/multiDataDetailsBlockSettings.ts rename to packages/core/client/src/modules/blocks/data-blocks/details-multi/multiDataDetailsBlockSettings.tsx index d2cd919c9..d4a8601ef 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/details-multi/multiDataDetailsBlockSettings.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/details-multi/multiDataDetailsBlockSettings.tsx @@ -8,6 +8,7 @@ import { useCollection_deprecated, useSortFields } from '../../../../collection- import { removeNullCondition, useDesignable } from '../../../../schema-component'; import { SchemaSettingsBlockTitleItem, SchemaSettingsTemplate } from '../../../../schema-settings'; import { SchemaSettingsDataScope } from '../../../../schema-settings/SchemaSettingsDataScope'; +import { setDataLoadingModeSettingsItem, useDataLoadingMode } from './setDataLoadingModeSettingsItem'; export const multiDataDetailsBlockSettings = new SchemaSettings({ name: 'blockSettings:multiDataDetails', @@ -26,6 +27,7 @@ export const multiDataDetailsBlockSettings = new SchemaSettings({ const field = useField(); const { service } = useDetailsBlockContext(); const { dn } = useDesignable(); + const dataLoadingMode = useDataLoadingMode(); return { collectionName: name, defaultFilter: fieldSchema?.['x-decorator-props']?.params?.filter || {}, @@ -36,7 +38,11 @@ export const multiDataDetailsBlockSettings = new SchemaSettings({ params.filter = filter; field.decoratorProps.params = params; fieldSchema['x-decorator-props']['params'] = params; - service.run({ ...service.params?.[0], filter }); + + if (dataLoadingMode === 'auto') { + service.run({ ...service.params?.[0], filter }); + } + dn.emit('patch', { schema: { ['x-uid']: fieldSchema['x-uid'], @@ -164,6 +170,7 @@ export const multiDataDetailsBlockSettings = new SchemaSettings({ }; }, }, + setDataLoadingModeSettingsItem, { name: 'template', Component: SchemaSettingsTemplate, diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem.tsx b/packages/core/client/src/modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem.tsx new file mode 100644 index 000000000..20707d7c1 --- /dev/null +++ b/packages/core/client/src/modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem.tsx @@ -0,0 +1,71 @@ +import { ISchema, useField, useFieldSchema } from '@formily/react'; +import _ from 'lodash'; +import React from 'react'; +import { useTranslation } from 'react-i18next'; +import { useDesignable } from '../../../../schema-component'; +import { SchemaSettingsModalItem, useCollectionState } from '../../../../schema-settings'; +import { useCollection_deprecated } from '../../../../collection-manager/hooks/useCollection_deprecated'; +import { useDataBlockProps, useDataBlockRequest } from '../../../../data-source'; + +export const setDataLoadingModeSettingsItem = { + name: 'setDataLoadingMode', + Component: SetDataLoadingMode, +}; + +export function useDataLoadingMode() { + const { dataLoadingMode } = useDataBlockProps() || {}; + return dataLoadingMode || 'auto'; +} + +export function SetDataLoadingMode() { + const { dn } = useDesignable(); + const { t } = useTranslation(); + const field = useField(); + const fieldSchema = useFieldSchema(); + const { name } = useCollection_deprecated(); + const { getEnableFieldTree, getOnLoadData } = useCollectionState(name); + const request = useDataBlockRequest(); + + return ( + { + _.set(fieldSchema, 'x-decorator-props.dataLoadingMode', dataLoadingMode); + field.decoratorProps.dataLoadingMode = dataLoadingMode; + dn.emit('patch', { + schema: { + ['x-uid']: fieldSchema['x-uid'], + 'x-decorator-props': { + ...fieldSchema['x-decorator-props'], + }, + }, + }); + dn.refresh(); + + if (dataLoadingMode === 'auto') { + request.run(); + } else { + request.mutate(undefined); + } + }} + /> + ); +} diff --git a/packages/core/client/src/modules/blocks/data-blocks/grid-card/gridCardBlockSettings.ts b/packages/core/client/src/modules/blocks/data-blocks/grid-card/gridCardBlockSettings.ts index cc8a796f6..11938ba5b 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/grid-card/gridCardBlockSettings.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/grid-card/gridCardBlockSettings.ts @@ -18,6 +18,7 @@ import { import { SchemaSettingsTemplate } from '../../../../schema-settings'; import { columnCountMarks } from './utils'; import { SchemaSettingsDataScope } from '../../../../schema-settings/SchemaSettingsDataScope'; +import { setDataLoadingModeSettingsItem } from '../details-multi/setDataLoadingModeSettingsItem'; export const gridCardBlockSettings = new SchemaSettings({ name: 'blockSettings:gridCard', @@ -90,7 +91,6 @@ export const gridCardBlockSettings = new SchemaSettings({ const { form } = useFormBlockContext(); const field = useField(); const { dn } = useDesignable(); - const defaultSort = fieldSchema?.['x-decorator-props']?.params?.sort || []; return { collectionName: name, @@ -224,6 +224,7 @@ export const gridCardBlockSettings = new SchemaSettings({ }; }, }, + setDataLoadingModeSettingsItem, { name: 'RecordsPerPage', type: 'select', diff --git a/packages/core/client/src/modules/blocks/data-blocks/list/listBlockSettings.ts b/packages/core/client/src/modules/blocks/data-blocks/list/listBlockSettings.ts index 3f73310bb..32b4b179b 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/list/listBlockSettings.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/list/listBlockSettings.ts @@ -8,6 +8,7 @@ import { useCollection_deprecated, useSortFields } from '../../../../collection- import { removeNullCondition, useDesignable } from '../../../../schema-component'; import { SchemaSettingsBlockTitleItem, SchemaSettingsTemplate } from '../../../../schema-settings'; import { SchemaSettingsDataScope } from '../../../../schema-settings/SchemaSettingsDataScope'; +import { setDataLoadingModeSettingsItem } from '../details-multi/setDataLoadingModeSettingsItem'; export const listBlockSettings = new SchemaSettings({ name: 'blockSettings:list', @@ -156,6 +157,7 @@ export const listBlockSettings = new SchemaSettings({ }; }, }, + setDataLoadingModeSettingsItem, { name: 'RecordsPerPage', type: 'select', diff --git a/packages/core/client/src/modules/blocks/data-blocks/table-selector/tableSelectorBlockSettings.ts b/packages/core/client/src/modules/blocks/data-blocks/table-selector/tableSelectorBlockSettings.ts index ff736f6ef..3960b9ff6 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table-selector/tableSelectorBlockSettings.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/table-selector/tableSelectorBlockSettings.ts @@ -12,6 +12,7 @@ import { } from '../../../../collection-manager'; import { removeNullCondition, useDesignable } from '../../../../schema-component'; import { SchemaSettingsDataScope } from '../../../../schema-settings/SchemaSettingsDataScope'; +import { setDataLoadingModeSettingsItem, useDataLoadingMode } from '../details-multi/setDataLoadingModeSettingsItem'; export const tableSelectorBlockSettings = new SchemaSettings({ name: 'blockSettings:tableSelector', @@ -26,6 +27,7 @@ export const tableSelectorBlockSettings = new SchemaSettings({ const { form } = useFormBlockContext(); const { service, extraFilter } = useTableSelectorContext(); const { dn } = useDesignable(); + const dataLoadingMode = useDataLoadingMode(); const onDataScopeSubmit = useCallback( ({ filter }) => { filter = removeNullCondition(filter); @@ -43,7 +45,11 @@ export const tableSelectorBlockSettings = new SchemaSettings({ serviceFilter = extraFilter; } } - service.run({ ...service.params?.[0], filter: serviceFilter, page: 1 }); + + if (dataLoadingMode === 'auto') { + service.run({ ...service.params?.[0], filter: serviceFilter, page: 1 }); + } + dn.emit('patch', { schema: { ['x-uid']: fieldSchema['x-uid'], @@ -51,7 +57,7 @@ export const tableSelectorBlockSettings = new SchemaSettings({ }, }); }, - [dn, field.decoratorProps, fieldSchema, service, extraFilter], + [field.decoratorProps, fieldSchema, extraFilter, dataLoadingMode, dn, service], ); return { @@ -223,6 +229,7 @@ export const tableSelectorBlockSettings = new SchemaSettings({ return !dragSort; }, }, + setDataLoadingModeSettingsItem, { name: 'RecordsPerPage', type: 'select', diff --git a/packages/core/client/src/modules/blocks/data-blocks/table/tableBlockSettings.tsx b/packages/core/client/src/modules/blocks/data-blocks/table/tableBlockSettings.tsx index 1a97d3374..3d9cdd7dc 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table/tableBlockSettings.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/table/tableBlockSettings.tsx @@ -21,6 +21,7 @@ import { useTranslation } from 'react-i18next'; import { ArrayItems } from '@formily/antd-v5'; import { FixedBlockDesignerItem } from '../../../../schema-component/antd/page/FixedBlockDesignerItem'; import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; +import { setDataLoadingModeSettingsItem, useDataLoadingMode } from '../details-multi/setDataLoadingModeSettingsItem'; export const tableBlockSettings = new SchemaSettings({ name: 'blockSettings:table', @@ -138,6 +139,7 @@ export const tableBlockSettings = new SchemaSettings({ const { form } = useFormBlockContext(); const { service } = useTableBlockContext(); const { dn } = useDesignable(); + const dataLoadingMode = useDataLoadingMode(); const onDataScopeSubmit = useCallback( ({ filter }) => { filter = removeNullCondition(filter); @@ -146,10 +148,14 @@ export const tableBlockSettings = new SchemaSettings({ field.decoratorProps.params = params; fieldSchema['x-decorator-props']['params'] = params; const filters = service.params?.[1]?.filters || {}; - service.run( - { ...service.params?.[0], filter: mergeFilter([...Object.values(filters), filter]), page: 1 }, - { filters }, - ); + + if (dataLoadingMode === 'auto') { + service.run( + { ...service.params?.[0], filter: mergeFilter([...Object.values(filters), filter]), page: 1 }, + { filters }, + ); + } + dn.emit('patch', { schema: { ['x-uid']: fieldSchema['x-uid'], @@ -290,6 +296,7 @@ export const tableBlockSettings = new SchemaSettings({ return !dragSort; }, }, + setDataLoadingModeSettingsItem, { name: 'RecordsPerPage', type: 'select', diff --git a/packages/core/client/src/schema-component/antd/filter/useFilterActionProps.ts b/packages/core/client/src/schema-component/antd/filter/useFilterActionProps.ts index fa89c4a11..6deb6d2a4 100644 --- a/packages/core/client/src/schema-component/antd/filter/useFilterActionProps.ts +++ b/packages/core/client/src/schema-component/antd/filter/useFilterActionProps.ts @@ -5,6 +5,8 @@ import { useTranslation } from 'react-i18next'; import { useBlockRequestContext } from '../../../block-provider'; import { useCollection_deprecated, useCollectionManager_deprecated } from '../../../collection-manager'; import { mergeFilter } from '../../../filter-provider/utils'; +import { useDataLoadingMode } from '../../../modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem'; +import _ from 'lodash'; export const useGetFilterOptions = () => { const { getCollectionFields } = useCollectionManager_deprecated(); @@ -168,6 +170,8 @@ export const useFilterActionProps = () => { export const useFilterFieldProps = ({ options, service, params }) => { const { t } = useTranslation(); const field = useField(); + const dataLoadingMode = useDataLoadingMode(); + return { options, onSubmit(values) { @@ -176,6 +180,10 @@ export const useFilterFieldProps = ({ options, service, params }) => { // filter parameter for the filter action const filter = removeNullCondition(values?.filter); + if (dataLoadingMode === 'manual' && _.isEmpty(filter)) { + return service.mutate(undefined); + } + const filters = service.params?.[1]?.filters || {}; filters[`filterAction`] = filter; service.run( @@ -193,15 +201,24 @@ export const useFilterFieldProps = ({ options, service, params }) => { const filter = params.filter; const filters = service.params?.[1]?.filters || {}; delete filters[`filterAction`]; - service.run( + + const newParams = [ { ...service.params?.[0], filter: mergeFilter([...Object.values(filters), filter]), page: 1, }, { filters }, - ); + ]; + field.title = t('Filter'); + + if (dataLoadingMode === 'manual') { + service.params = newParams; + return service.mutate(undefined); + } + + service.run(...newParams); }, }; }; diff --git a/packages/core/client/src/schema-component/antd/form-v2/Form.Settings.tsx b/packages/core/client/src/schema-component/antd/form-v2/Form.Settings.tsx index 463fcf5aa..55c57c97f 100644 --- a/packages/core/client/src/schema-component/antd/form-v2/Form.Settings.tsx +++ b/packages/core/client/src/schema-component/antd/form-v2/Form.Settings.tsx @@ -16,6 +16,7 @@ import { import { SchemaSettingsDataScope } from '../../../schema-settings/SchemaSettingsDataScope'; import { useDesignable } from '../../hooks'; import { removeNullCondition } from '../filter'; +import { setDataLoadingModeSettingsItem } from '../../../modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem'; /** * @deprecated @@ -169,6 +170,7 @@ export const formDetailsSettings = new SchemaSettings({ }; }, }, + setDataLoadingModeSettingsItem, { name: 'sortingRules', type: 'modal', diff --git a/packages/core/client/src/schema-component/antd/grid-card/GridCard.Decorator.tsx b/packages/core/client/src/schema-component/antd/grid-card/GridCard.Decorator.tsx index 18384d580..ecb1c0fe5 100644 --- a/packages/core/client/src/schema-component/antd/grid-card/GridCard.Decorator.tsx +++ b/packages/core/client/src/schema-component/antd/grid-card/GridCard.Decorator.tsx @@ -22,7 +22,7 @@ const InternalGridCardBlockProvider = (props) => { if (!service?.loading) { form.setValuesIn(field.address.concat('list').toString(), service?.data?.data); } - }, [service?.data?.data, service?.loading]); + }, [field.address, form, service?.data?.data, service?.loading]); return wrapSSR( { obj[cur] = cur; @@ -209,6 +210,7 @@ export const GridCardDesigner = () => { }); }} /> + { if (!service?.loading) { form.setValuesIn(field.address.concat('list').toString(), service?.data?.data); } - }, [service?.data?.data, service?.loading]); + }, [field.address, form, service?.data?.data, service?.loading]); return ( { }); }} /> + { const { fields } = useCollection_deprecated(); @@ -66,7 +67,7 @@ export const EditSortField = () => { }; export const TableBlockDesigner = () => { - const { name, title, sortable } = useCollection_deprecated(); + const { name, title } = useCollection_deprecated(); const { getCollectionField, getCollection } = useCollectionManager_deprecated(); const field = useField(); const fieldSchema = useFieldSchema(); @@ -75,7 +76,6 @@ export const TableBlockDesigner = () => { const { service } = useTableBlockContext(); const { t } = useTranslation(); const { dn } = useDesignable(); - const record = useRecord(); const defaultSort = fieldSchema?.['x-decorator-props']?.params?.sort || []; const defaultResource = fieldSchema?.['x-decorator-props']?.resource; @@ -268,6 +268,7 @@ export const TableBlockDesigner = () => { }} /> )} + { const { name, title } = useCollection_deprecated(); @@ -126,6 +127,7 @@ export const TableSelectorDesigner = () => { }} /> )} + {!dragSort && ( Date: Thu, 14 Mar 2024 19:20:02 +0800 Subject: [PATCH 14/15] refactor: add blocks in a unified way (#3668) * refactor: rename filterMenuItemChildren to filterCollections * refactor: revert parameters to destructured object * refactor(Details): unify details block between page and popup * refactor(Form): refactor(Details): unify form block between page and popup * refactor: table & list & grid card * refactor: form * refactor: association details * chore: useVisible * refactor: calendar * chore: remove relationshipBlocks * refactor: unify Details schema * fix: avoid error * chore: add translate * chore: add tag to association fields * fix: add block useChildren and children merge * test: fix e2e * test: fix e2e * fix: fix Calendar * fix: fix search * test: add e2e for search * fix: fix T-3554 * fix: fix T-3551 * feat: add no data for details block * chore: fix unit test * chore: fix unit test * chore: change text * chore: optimize text * chore: add translation * style: fix memu item style * refactor: rename * test: fix e2e * test: fix e2e --------- Co-authored-by: dream2023 <1098626505@qq.com> --- .../components/SchemaInitializerChildren.tsx | 5 +- .../components/SchemaInitializerSubMenu.tsx | 3 + .../schema-initializer/hooks/index.tsx | 2 + .../components/SchemaSettingsChildren.tsx | 5 +- .../src/block-provider/BlockProvider.tsx | 2 +- .../block-provider/DetailsBlockProvider.tsx | 12 +- .../data-block/DataBlockRequestProvider.tsx | 4 - packages/core/client/src/locale/en_US.json | 4 + packages/core/client/src/locale/es_ES.json | 4 + packages/core/client/src/locale/fr_FR.json | 4 + packages/core/client/src/locale/ja_JP.json | 4 + packages/core/client/src/locale/ko_KR.json | 4 + packages/core/client/src/locale/pt_BR.json | 4 + packages/core/client/src/locale/ru_RU.json | 4 + packages/core/client/src/locale/tr_TR.json | 4 + packages/core/client/src/locale/uk_UA.json | 4 + packages/core/client/src/locale/zh-CN.json | 4 + packages/core/client/src/locale/zh-TW.json | 4 + .../details-multi/DetailsBlockInitializer.tsx | 44 +- .../__e2e__/schemaInitializer.test.ts | 6 +- .../__e2e__/schemaSettings.test.ts | 3 +- .../RecordReadPrettyFormBlockInitializer.tsx | 122 ++-- .../__e2e__/schemaInitializer.test.ts | 22 +- .../data-blocks/form/FormBlockInitializer.tsx | 70 ++- .../form/RecordFormBlockInitializer.tsx | 96 ++-- .../form-create/schemaSettings.test.ts | 2 +- .../__e2e__/form-create/templatesOfBug.ts | 18 +- .../grid-card/GridCardBlockInitializer.tsx | 37 +- .../data-blocks/list/ListBlockInitializer.tsx | 37 +- .../table/TableBlockInitializer.tsx | 32 +- .../FilterCollapseBlockInitializer.tsx | 11 +- .../form/FilterFormBlockInitializer.tsx | 25 +- .../dialog/__e2e__/schemaInitializer.test.ts | 76 ++- .../component/DatePicker/__e2e__/utils.ts | 12 +- .../Picker/TableSelectorInitializers.tsx | 8 +- .../page/__e2e__/blockInitializers.test.ts | 12 + .../schema-component/antd/details/Details.tsx | 15 +- .../antd/details/__tests__/details.test.tsx | 3 +- .../buttons/RecordBlockInitializers.tsx | 539 ++++++++++-------- .../client/src/schema-initializer/index.ts | 1 + .../items/DataBlockInitializer.tsx | 112 ++-- .../RecordAssociationBlockInitializer.tsx | 29 +- ...cordAssociationDetailsBlockInitializer.tsx | 27 +- .../RecordAssociationFormBlockInitializer.tsx | 75 ++- ...ordAssociationGridCardBlockInitializer.tsx | 30 +- .../RecordAssociationListBlockInitializer.tsx | 27 +- ...dPrettyAssociationFormBlockInitializer.tsx | 69 ++- .../client/src/schema-initializer/utils.ts | 275 +++++++-- .../plugin-calendar/src/client/index.tsx | 41 +- .../items/CalendarBlockInitializer.tsx | 24 +- ...ordAssociationCalendarBlockInitializer.tsx | 83 +++ .../fields/manyToOne/templatesOfBug.ts | 6 +- .../src/client/index.ts | 14 +- .../src/client/instruction/forms/create.tsx | 2 +- .../src/client/instruction/forms/update.tsx | 2 +- 55 files changed, 1511 insertions(+), 573 deletions(-) create mode 100644 packages/core/client/src/modules/page/__e2e__/blockInitializers.test.ts diff --git a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerChildren.tsx b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerChildren.tsx index fb4342981..8a0642af4 100644 --- a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerChildren.tsx +++ b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerChildren.tsx @@ -49,7 +49,10 @@ export const SchemaInitializerChild: FC = memo((props const componentVal = Component || component; const isBuiltType = !componentVal && type && typeComponentMap[type]; - const componentChildren = useChildrenRes || children; + const componentChildren = useMemo(() => { + const res = [...(useChildrenRes || []), ...(children || [])]; + return res.length === 0 ? undefined : res; + }, [useChildrenRes, children]); const contextValue = useMemo(() => { return { ...others, diff --git a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerSubMenu.tsx b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerSubMenu.tsx index 98daa7019..bbbad5035 100644 --- a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerSubMenu.tsx +++ b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerSubMenu.tsx @@ -50,6 +50,9 @@ export const SchemaInitializerMenu: FC = (props) => { .ant-menu-sub { max-height: 50vh !important; } + .ant-menu-item { + margin-block: 0; + } .ant-menu-root { margin: 0 -${token.margin}px; .ant-menu-submenu-title { diff --git a/packages/core/client/src/application/schema-initializer/hooks/index.tsx b/packages/core/client/src/application/schema-initializer/hooks/index.tsx index f534e9e3d..64cd3d30f 100644 --- a/packages/core/client/src/application/schema-initializer/hooks/index.tsx +++ b/packages/core/client/src/application/schema-initializer/hooks/index.tsx @@ -41,6 +41,7 @@ export function useGetSchemaInitializerMenuItems(onClick?: (args: any) => void) return { key: item.key, label: element, + associationField: item.associationField, }; } if (item.type === 'itemGroup') { @@ -73,6 +74,7 @@ export function useGetSchemaInitializerMenuItems(onClick?: (args: any) => void) return { key, label, + associationField: item.associationField, onClick: (info) => { if (info.key !== key) return; if (item.onClick) { diff --git a/packages/core/client/src/application/schema-settings/components/SchemaSettingsChildren.tsx b/packages/core/client/src/application/schema-settings/components/SchemaSettingsChildren.tsx index 1db8f2feb..bbf4a5859 100644 --- a/packages/core/client/src/application/schema-settings/components/SchemaSettingsChildren.tsx +++ b/packages/core/client/src/application/schema-settings/components/SchemaSettingsChildren.tsx @@ -84,7 +84,10 @@ export const SchemaSettingsChild: FC = memo((props) => { const useChildrenRes = useChildren(); const useComponentPropsRes = useComponentProps(); const findComponent = useFindComponent(); - const componentChildren = useChildrenRes || children; + const componentChildren = useMemo(() => { + const res = [...(useChildrenRes || []), ...(children || [])]; + return res.length === 0 ? undefined : res; + }, [useChildrenRes, children]); const visibleResult = useVisible(); const ComponentValue = useMemo(() => { return !Component && type && typeComponentMap[type] ? typeComponentMap[type] : Component; diff --git a/packages/core/client/src/block-provider/BlockProvider.tsx b/packages/core/client/src/block-provider/BlockProvider.tsx index 13f2229b6..483d48b20 100644 --- a/packages/core/client/src/block-provider/BlockProvider.tsx +++ b/packages/core/client/src/block-provider/BlockProvider.tsx @@ -346,7 +346,7 @@ export const useParamsFromRecord = () => { const obj = { filterByTk: filterByTk, }; - if (record.__collection && !['oho', 'm2o', 'obo'].includes(collectionField?.interface)) { + if (record.__collection && collectionField && !['oho', 'm2o', 'obo'].includes(collectionField.interface)) { obj['targetCollection'] = record.__collection; } if (!filterByTk) { diff --git a/packages/core/client/src/block-provider/DetailsBlockProvider.tsx b/packages/core/client/src/block-provider/DetailsBlockProvider.tsx index 36a2a95b0..97edf2075 100644 --- a/packages/core/client/src/block-provider/DetailsBlockProvider.tsx +++ b/packages/core/client/src/block-provider/DetailsBlockProvider.tsx @@ -19,11 +19,11 @@ const InternalDetailsBlockProvider = (props) => { createForm({ readPretty, }), - [], + [readPretty], ); const { resource, service } = useBlockRequestContext(); const parentRecord = useCollectionParentRecord(); - const currentRecord = service?.data?.data?.[0] || {}; + const currentRecord = (action === 'list' ? service?.data?.data?.[0] : service?.data?.data) || {}; const detailsBLockValue = useMemo(() => { return { action, @@ -65,6 +65,9 @@ export const DetailsBlockProvider = (props) => { ); }; +/** + * @deprecated + */ export const useDetailsBlockContext = () => { return useContext(DetailsBlockContext); }; @@ -73,14 +76,15 @@ export const useDetailsBlockProps = () => { const ctx = useDetailsBlockContext(); useEffect(() => { if (!ctx.service.loading) { + const data = ctx.action === 'list' ? ctx.service?.data?.data?.[0] : ctx.service?.data?.data; ctx.form .reset() .then(() => { - ctx.form.setValues(ctx.service?.data?.data?.[0] || {}); + ctx.form.setValues(data || {}); }) .catch(console.error); } - }, [ctx.form, ctx.service?.data?.data, ctx.service.loading]); + }, [ctx.action, ctx.form, ctx.service?.data?.data, ctx.service.loading]); return { form: ctx.form, }; diff --git a/packages/core/client/src/data-source/data-block/DataBlockRequestProvider.tsx b/packages/core/client/src/data-source/data-block/DataBlockRequestProvider.tsx index 37c88569c..c8d361d61 100644 --- a/packages/core/client/src/data-source/data-block/DataBlockRequestProvider.tsx +++ b/packages/core/client/src/data-source/data-block/DataBlockRequestProvider.tsx @@ -133,9 +133,5 @@ export const BlockRequestProvider: FC = ({ children }) => { export const useDataBlockRequest = (): UseRequestResult<{ data: T }> => { const context = useContext(BlockRequestContext); - if (!context) { - throw new Error('useDataBlockRequest() must be used within a DataBlockRequestProvider'); - } - return context; }; diff --git a/packages/core/client/src/locale/en_US.json b/packages/core/client/src/locale/en_US.json index e3c4e97b4..cc614f0c9 100644 --- a/packages/core/client/src/locale/en_US.json +++ b/packages/core/client/src/locale/en_US.json @@ -358,6 +358,10 @@ "Add tab": "Add tab", "Disable tabs": "Disable tabs", "Details": "Details", + "Edit form": "Edit form", + "Create form": "Create form", + "Form (Edit)": "Form (Edit)", + "Form (Add new)": "Form (Add new)", "Edit tab": "Edit tab", "Relationship blocks": "Relationship blocks", "Select record": "Select record", diff --git a/packages/core/client/src/locale/es_ES.json b/packages/core/client/src/locale/es_ES.json index af55655a2..d60ad1632 100644 --- a/packages/core/client/src/locale/es_ES.json +++ b/packages/core/client/src/locale/es_ES.json @@ -331,6 +331,10 @@ "Add tab": "Añadir pestaña", "Disable tabs": "Desactivar pestañas", "Details": "Detalles", + "Edit form": "Editar formulario", + "Create form": "Crear formulario", + "Form (Edit)": "Formulario (Editar)", + "Form (Add new)": "Formulario (Añadir nuevo)", "Edit tab": "Editar pestaña", "Relationship blocks": "Bloques de relación", "Select record": "Seleccionar registro", diff --git a/packages/core/client/src/locale/fr_FR.json b/packages/core/client/src/locale/fr_FR.json index 852c37671..257ae5c2d 100644 --- a/packages/core/client/src/locale/fr_FR.json +++ b/packages/core/client/src/locale/fr_FR.json @@ -346,6 +346,10 @@ "Add tab": "Ajouter un onglet", "Disable tabs": "Désactiver les onglets", "Details": "Détails", + "Edit form": "Modifier le formulaire", + "Create form": "Créer un formulaire", + "Form (Edit)": "Formulaire (Modifier)", + "Form (Add new)": "Formulaire (Ajouter nouveau)", "Edit tab": "Modifier l'onglet", "Relationship blocks": "Blocs de relations", "Select record": "Sélectionner un enregistrement", diff --git a/packages/core/client/src/locale/ja_JP.json b/packages/core/client/src/locale/ja_JP.json index f70622c4c..b6bd69884 100644 --- a/packages/core/client/src/locale/ja_JP.json +++ b/packages/core/client/src/locale/ja_JP.json @@ -293,6 +293,10 @@ "Add tab": "タブを追加", "Disable tabs": "タブを無効にする", "Details": "詳細", + "Edit form": "フォームを編集", + "Create form": "フォームを作成", + "Form (Edit)": "フォーム (編集)", + "Form (Add new)": "フォーム (新規追加)", "Edit tab": "タブを編集", "Relationship blocks": "関連付けされたブロック", "Select record": "レコードを選択", diff --git a/packages/core/client/src/locale/ko_KR.json b/packages/core/client/src/locale/ko_KR.json index 5d0da90cd..f3c00c4e8 100644 --- a/packages/core/client/src/locale/ko_KR.json +++ b/packages/core/client/src/locale/ko_KR.json @@ -378,6 +378,10 @@ "Add tab": "탭 추가", "Disable tabs": "탭 비활성화", "Details": "세부 정보", + "Edit form": "폼 편집", + "Create form": "폼 생성", + "Form (Edit)": "폼 (편집)", + "Form (Add new)": "폼 (새로 추가)", "Edit tab": "탭 편집", "Relationship blocks": "관계 데이터 블록", "Select record": "레코드 선택", diff --git a/packages/core/client/src/locale/pt_BR.json b/packages/core/client/src/locale/pt_BR.json index 956dbd6ff..642e79221 100644 --- a/packages/core/client/src/locale/pt_BR.json +++ b/packages/core/client/src/locale/pt_BR.json @@ -295,6 +295,10 @@ "Add tab": "Adicionar guia", "Disable tabs": "Desativar guias", "Details": "Detalhes", + "Edit form": "Editar formulário", + "Create form": "Criar formulário", + "Form (Edit)": "Formulário (Editar)", + "Form (Add new)": "Formulário (Adicionar novo)", "Edit tab": "Editar guia", "Relationship blocks": "Blocos de relacionamento", "Select record": "Selecionar registro", diff --git a/packages/core/client/src/locale/ru_RU.json b/packages/core/client/src/locale/ru_RU.json index cc7aac53f..3411341e1 100644 --- a/packages/core/client/src/locale/ru_RU.json +++ b/packages/core/client/src/locale/ru_RU.json @@ -233,6 +233,10 @@ "Add tab": "Добавить вкладку", "Disable tabs": "Запретить вкладки", "Details": "Подробности", + "Edit form": "Изменить форму", + "Create form": "Создать форму", + "Form (Edit)": "Форма (Изменить)", + "Form (Add new)": "Форма (Добавить новый)", "Edit tab": "Изменить вкладку", "Relationship blocks": "Блоки отношений", "Select record": "Выбрать запись", diff --git a/packages/core/client/src/locale/tr_TR.json b/packages/core/client/src/locale/tr_TR.json index 6a16fc2bd..ec2c67ee5 100644 --- a/packages/core/client/src/locale/tr_TR.json +++ b/packages/core/client/src/locale/tr_TR.json @@ -233,6 +233,10 @@ "Add tab": "Sekme ekle", "Disable tabs": "Sekmeleri pasifleştir", "Details": "Detaylar", + "Edit form": "Formu düzenle", + "Create form": "Form oluştur", + "Form (Edit)": "Form (Düzenle)", + "Form (Add new)": "Form (Yeni ekle)", "Edit tab": "Sekme düzenle", "Relationship blocks": "İlişki blokları", "Select record": "Kayıt seç", diff --git a/packages/core/client/src/locale/uk_UA.json b/packages/core/client/src/locale/uk_UA.json index a9fcf430b..da860d5da 100644 --- a/packages/core/client/src/locale/uk_UA.json +++ b/packages/core/client/src/locale/uk_UA.json @@ -348,6 +348,10 @@ "Add tab": "Додати вкладку", "Disable tabs": "Вимкнути вкладки", "Details": "Деталі", + "Edit form": "Редагувати форму", + "Create form": "Створити форму", + "Form (Edit)": "Форма (Редагувати)", + "Form (Add new)": "Форма (Додати новий)", "Edit tab": "Редагувати вкладку", "Relationship blocks": "Блоки відношень", "Select record": "Вибрати запис", diff --git a/packages/core/client/src/locale/zh-CN.json b/packages/core/client/src/locale/zh-CN.json index d4ad16f75..2a5c4c32c 100644 --- a/packages/core/client/src/locale/zh-CN.json +++ b/packages/core/client/src/locale/zh-CN.json @@ -379,6 +379,10 @@ "Add tab": "添加标签页", "Disable tabs": "禁用标签页", "Details": "详情", + "Edit form": "编辑表单", + "Create form": "创建表单", + "Form (Edit)": "表单(编辑)", + "Form (Add new)": "表单(添加)", "Edit tab": "编辑标签页", "Relationship blocks": "关系数据区块", "Select record": "选择数据", diff --git a/packages/core/client/src/locale/zh-TW.json b/packages/core/client/src/locale/zh-TW.json index 5af1598dc..4f8c1727a 100644 --- a/packages/core/client/src/locale/zh-TW.json +++ b/packages/core/client/src/locale/zh-TW.json @@ -378,6 +378,10 @@ "Add tab": "新增標籤頁", "Disable tabs": "停用標籤頁", "Details": "詳情", + "Edit form": "編輯表單", + "Create form": "建立表單", + "Form (Edit)": "表單(編輯)", + "Form (Add new)": "表單(添加)", "Edit tab": "編輯標籤頁", "Relationship blocks": "關聯資料區塊", "Select record": "選擇資料", diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-multi/DetailsBlockInitializer.tsx b/packages/core/client/src/modules/blocks/data-blocks/details-multi/DetailsBlockInitializer.tsx index ae075be78..361f73521 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/details-multi/DetailsBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/details-multi/DetailsBlockInitializer.tsx @@ -4,8 +4,36 @@ import { useSchemaInitializer, useSchemaInitializerItem } from '../../../../appl import { useCollectionManager_deprecated } from '../../../../collection-manager'; import { createDetailsBlockSchema } from '../../../../schema-initializer/utils'; import { DataBlockInitializer } from '../../../../schema-initializer/items/DataBlockInitializer'; +import { Collection, CollectionFieldOptions } from '../../../../data-source/collection/Collection'; -export const DetailsBlockInitializer = () => { +export const DetailsBlockInitializer = ({ + filterCollections, + onlyCurrentDataSource, + hideSearch, + componentType = 'Details', + createBlockSchema, + templateWrap, + showAssociationFields, +}: { + filterCollections: (options: { collection?: Collection; associationField?: CollectionFieldOptions }) => boolean; + onlyCurrentDataSource: boolean; + hideSearch?: boolean; + /** + * 页面中的详情区块类型是 Details,弹窗中的详情区块类型是 ReadPrettyFormItem; + * 虽然这里的命名现在看起来比较奇怪,但为了兼容旧版本的 template,暂时保留这个命名。 + */ + componentType?: 'Details' | 'ReadPrettyFormItem'; + createBlockSchema?: (options: any) => any; + templateWrap?: ( + templateSchema: any, + { + item, + }: { + item: any; + }, + ) => any; + showAssociationFields?: boolean; +}) => { const { insert } = useSchemaInitializer(); const { getCollection } = useCollectionManager_deprecated(); const itemConfig = useSchemaInitializerItem(); @@ -13,8 +41,13 @@ export const DetailsBlockInitializer = () => { } - componentType={'Details'} - onCreateBlockSchema={async ({ item }) => { + componentType={componentType} + onCreateBlockSchema={async (options) => { + if (createBlockSchema) { + return createBlockSchema(options); + } + + const { item } = options; const collection = getCollection(item.name, item.dataSource); const schema = createDetailsBlockSchema({ collection: item.name, @@ -28,6 +61,11 @@ export const DetailsBlockInitializer = () => { }); insert(schema); }} + onlyCurrentDataSource={!!onlyCurrentDataSource} + hideSearch={hideSearch} + filter={filterCollections} + templateWrap={templateWrap} + showAssociationFields={showAssociationFields} /> ); }; diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-multi/__e2e__/schemaInitializer.test.ts b/packages/core/client/src/modules/blocks/data-blocks/details-multi/__e2e__/schemaInitializer.test.ts index bfaa5c77d..3e1243559 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/details-multi/__e2e__/schemaInitializer.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/details-multi/__e2e__/schemaInitializer.test.ts @@ -10,8 +10,9 @@ test.describe('where multi data details block can be added', () => { }); test.describe('configure fields', () => { - test('display collection fields & display association fields & add text', async ({ page, mockPage }) => { + test('display collection fields & display association fields & add text', async ({ page, mockPage, mockRecord }) => { await mockPage(oneEmptyDetailsBlock).goto(); + await mockRecord('general'); const formItemInitializer = page.getByLabel('schema-initializer-Grid-details:configureFields-general'); @@ -60,8 +61,9 @@ test.describe('configure fields', () => { }); test.describe('configure actions', () => { - test('edit & delete & duplicate', async ({ page, mockPage }) => { + test('edit & delete & duplicate', async ({ page, mockPage, mockRecord }) => { await mockPage(oneEmptyDetailsBlock).goto(); + await mockRecord('general'); await page.getByLabel('schema-initializer-ActionBar-detailsWithPaging:configureActions-general').hover(); await page.getByRole('menuitem', { name: 'Edit' }).click(); diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-multi/__e2e__/schemaSettings.test.ts b/packages/core/client/src/modules/blocks/data-blocks/details-multi/__e2e__/schemaSettings.test.ts index 2ba21a02d..d2acc5228 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/details-multi/__e2e__/schemaSettings.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/details-multi/__e2e__/schemaSettings.test.ts @@ -29,8 +29,9 @@ test.describe('multi data details block schema settings', () => { }); test.describe('actions schema settings', () => { - test('edit & delete & duplicate', async ({ page, mockPage }) => { + test('edit & delete & duplicate', async ({ page, mockPage, mockRecord }) => { await mockPage(oneEmptyDetailsBlock).goto(); + await mockRecord('general'); // 创建 Edit & Delete 两个按钮 await page.getByLabel('schema-initializer-ActionBar-detailsWithPaging:configureActions-general').hover(); diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-single/RecordReadPrettyFormBlockInitializer.tsx b/packages/core/client/src/modules/blocks/data-blocks/details-single/RecordReadPrettyFormBlockInitializer.tsx index 946574ee1..35782e788 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/details-single/RecordReadPrettyFormBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/details-single/RecordReadPrettyFormBlockInitializer.tsx @@ -1,75 +1,85 @@ import { FormOutlined } from '@ant-design/icons'; -import React from 'react'; +import React, { useCallback } from 'react'; import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../../../application'; import { useBlockAssociationContext, useBlockRequestContext } from '../../../../block-provider'; import { useCollection_deprecated } from '../../../../collection-manager'; import { useSchemaTemplateManager } from '../../../../schema-templates'; -import { - createReadPrettyFormBlockSchema, - useRecordCollectionDataSourceItems, -} from '../../../../schema-initializer/utils'; +import { createDetailsBlockSchema, useRecordCollectionDataSourceItems } from '../../../../schema-initializer/utils'; export const RecordReadPrettyFormBlockInitializer = () => { const itemConfig = useSchemaInitializerItem(); - const { - onCreateBlockSchema, - componentType, - createBlockSchema, - icon = true, - targetCollection, - ...others - } = itemConfig; - const { insert } = useSchemaInitializer(); - const { getTemplateSchemaByMode } = useSchemaTemplateManager(); + const { icon = true, targetCollection, ...others } = itemConfig; const currentCollection = useCollection_deprecated(); const collection = targetCollection || currentCollection; - const association = useBlockAssociationContext(); - const { block } = useBlockRequestContext(); - const actionInitializers = - block !== 'TableField' ? itemConfig.actionInitializers || 'details:configureActions' : null; + const { createSingleDetailsSchema } = useCreateSingleDetailsSchema(); return ( } {...others} - onClick={async ({ item }) => { - if (item.template) { - const s = await getTemplateSchemaByMode(item); - if (item.template.componentName === 'ReadPrettyFormItem') { - const blockSchema = createReadPrettyFormBlockSchema({ - actionInitializers, - association, - collection: collection.name, - dataSource: collection.dataSource, - action: 'get', - useSourceId: '{{ useSourceIdFromParentRecord }}', - useParams: '{{ useParamsFromRecord }}', - template: s, - settings: 'blockSettings:singleDataDetails', - }); - if (item.mode === 'reference') { - blockSchema['x-template-key'] = item.template.key; - } - insert(blockSchema); - } else { - insert(s); - } - } else { - insert( - createReadPrettyFormBlockSchema({ - actionInitializers, - association, - collection: collection.name, - dataSource: collection.dataSource, - action: 'get', - useSourceId: '{{ useSourceIdFromParentRecord }}', - useParams: '{{ useParamsFromRecord }}', - settings: 'blockSettings:singleDataDetails', - }), - ); - } - }} + onClick={(options) => createSingleDetailsSchema(options)} items={useRecordCollectionDataSourceItems('ReadPrettyFormItem', null, collection?.name)} /> ); }; + +export function useCreateSingleDetailsSchema() { + const itemConfig = useSchemaInitializerItem(); + const { insert } = useSchemaInitializer(); + const { getTemplateSchemaByMode } = useSchemaTemplateManager(); + const association = useBlockAssociationContext(); + const { block } = useBlockRequestContext(); + const actionInitializers = + block !== 'TableField' ? itemConfig.actionInitializers || 'details:configureActions' : null; + + const templateWrap = useCallback( + (templateSchema, options) => { + const { item } = options; + if (item.template.componentName === 'ReadPrettyFormItem') { + const blockSchema = createDetailsBlockSchema({ + actionInitializers, + association, + collection: item.collectionName || item.name, + dataSource: item.dataSource, + action: 'get', + useSourceId: '{{ useSourceIdFromParentRecord }}', + useParams: '{{ useParamsFromRecord }}', + template: templateSchema, + settings: 'blockSettings:singleDataDetails', + }); + if (item.mode === 'reference') { + blockSchema['x-template-key'] = item.template.key; + } + return blockSchema; + } else { + return templateSchema; + } + }, + [actionInitializers, association], + ); + + const createSingleDetailsSchema = useCallback( + async ({ item }) => { + if (item.template) { + const template = await getTemplateSchemaByMode(item); + insert(templateWrap(template, { item })); + } else { + insert( + createDetailsBlockSchema({ + actionInitializers, + association, + collection: item.collectionName || item.name, + dataSource: item.dataSource, + action: 'get', + useSourceId: '{{ useSourceIdFromParentRecord }}', + useParams: '{{ useParamsFromRecord }}', + settings: 'blockSettings:singleDataDetails', + }), + ); + } + }, + [actionInitializers, association, getTemplateSchemaByMode, insert, templateWrap], + ); + + return { createSingleDetailsSchema, templateWrap }; +} diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-single/__e2e__/schemaInitializer.test.ts b/packages/core/client/src/modules/blocks/data-blocks/details-single/__e2e__/schemaInitializer.test.ts index afcef7dfb..811248edc 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/details-single/__e2e__/schemaInitializer.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/details-single/__e2e__/schemaInitializer.test.ts @@ -8,10 +8,11 @@ test.describe('where single data details block can be added', () => { await page.getByLabel('action-Action.Link-View-view-general-table-0').click(); await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover(); - await page.getByRole('menuitem', { name: 'Details' }).click(); + await page.getByRole('menuitem', { name: 'Details' }).hover(); + await page.getByRole('menuitem', { name: 'General' }).click(); await page.mouse.move(300, 0); - await expect(page.getByLabel('block-item-CardItem-general-form')).toBeVisible(); + await expect(page.getByLabel('block-item-CardItem-general-details')).toBeVisible(); }); }); @@ -23,38 +24,39 @@ test.describe('configure actions', () => { await page.getByLabel('action-Action.Link-View-view-general-table-0').click(); await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover(); - await page.getByRole('menuitem', { name: 'Details' }).click(); + await page.getByRole('menuitem', { name: 'Details' }).hover(); + await page.getByRole('menuitem', { name: 'General' }).click(); await page.mouse.move(300, 0); // create edit ------------------------------------------------------------------------------------ await createAction(page, 'Edit'); - await expect(page.getByLabel('action-Action-Edit-update-general-form-0')).toBeVisible(); + await expect(page.getByLabel('action-Action-Edit-update-')).toBeVisible(); await expectSettingsMenu({ page, showMenu: async () => { - await page.getByLabel('action-Action-Edit-update-general-form-0').hover(); + await page.getByLabel('action-Action-Edit-update-').hover(); await page.getByRole('button', { name: 'designer-schema-settings-Action-actionSettings:edit-general' }).hover(); }, supportedOptions: ['Edit button', 'Linkage rules', 'Open mode', 'Popup size', 'Delete'], }); - await deleteAction(page, 'action-Action-Edit-update-general-form-0'); + await deleteAction(page, 'action-Action-Edit-update-'); // create delete ------------------------------------------------------------------------------------ await createAction(page, 'Delete'); - await expect(page.getByLabel('action-Action-Delete-destroy-general-form-0')).toBeVisible(); + await expect(page.getByLabel('action-Action-Delete-destroy-general-details-')).toBeVisible(); // create print await createAction(page, 'Print'); - await expect(page.getByLabel('action-Action-Print-print-general-form-0')).toBeVisible(); + await expect(page.getByLabel('action-Action-Print-print-')).toBeVisible(); // create customize actions ---------------------------------------------------------------------------- // Popup await createCustomAction(page, 'Popup'); - await expect(page.getByLabel('action-Action-Popup-customize:popup-general-form-0')).toBeVisible(); + await expect(page.getByLabel('action-Action-Popup-customize')).toBeVisible(); // Update record await createCustomAction(page, 'Update record'); - await expect(page.getByLabel('action-Action-Update record-customize:update-general-form-0')).toBeVisible(); + await expect(page.getByLabel('action-Action-Update record-')).toBeVisible(); }); }); diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/FormBlockInitializer.tsx b/packages/core/client/src/modules/blocks/data-blocks/form/FormBlockInitializer.tsx index 96d53e497..1e195fe5c 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/FormBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/form/FormBlockInitializer.tsx @@ -1,19 +1,69 @@ import { FormOutlined } from '@ant-design/icons'; -import React from 'react'; -import { useSchemaInitializerItem } from '../../../../application'; +import React, { useCallback } from 'react'; +import { useSchemaInitializer, useSchemaInitializerItem } from '../../../../application'; import { createFormBlockSchema } from '../../../../schema-initializer/utils'; import { DataBlockInitializer } from '../../../../schema-initializer/items/DataBlockInitializer'; +import { Collection, CollectionFieldOptions } from '../../../../data-source/collection/Collection'; -export const FormBlockInitializer = () => { +export const FormBlockInitializer = ({ + filterCollections, + onlyCurrentDataSource, + hideSearch, + createBlockSchema, + componentType = 'FormItem', + templateWrap, + showAssociationFields, +}: { + filterCollections: (options: { collection?: Collection; associationField?: CollectionFieldOptions }) => boolean; + onlyCurrentDataSource: boolean; + hideSearch?: boolean; + createBlockSchema?: (options: any) => any; + /** + * 虽然这里的命名现在看起来比较奇怪,但为了兼容旧版本的 template,暂时保留这个命名。 + */ + componentType?: 'FormItem'; + templateWrap?: ( + templateSchema: any, + { + item, + }: { + item: any; + }, + ) => any; + showAssociationFields?: boolean; +}) => { + const { insert } = useSchemaInitializer(); const itemConfig = useSchemaInitializerItem(); const { isCusomeizeCreate } = itemConfig; + const onCreateFormBlockSchema = useCallback( + ({ item }) => { + if (createBlockSchema) { + return createBlockSchema({ item }); + } + + insert( + createFormBlockSchema({ + collection: item.collectionName || item.name, + dataSource: item.dataSource, + isCusomeizeCreate, + settings: 'blockSettings:createForm', + }), + ); + }, + [createBlockSchema, insert, isCusomeizeCreate], + ); + return ( } - componentType={'FormItem'} + componentType={componentType} templateWrap={(templateSchema, { item }) => { - const s = createFormBlockSchema({ + if (templateWrap) { + return templateWrap(templateSchema, { item }); + } + + const schema = createFormBlockSchema({ isCusomeizeCreate, dataSource: item.dataSource, template: templateSchema, @@ -21,11 +71,15 @@ export const FormBlockInitializer = () => { settings: 'blockSettings:createForm', }); if (item.template && item.mode === 'reference') { - s['x-template-key'] = item.template.key; + schema['x-template-key'] = item.template.key; } - return s; + return schema; }} - createBlockSchema={createFormBlockSchema} + onCreateBlockSchema={onCreateFormBlockSchema} + filter={filterCollections} + onlyCurrentDataSource={onlyCurrentDataSource} + hideSearch={hideSearch} + showAssociationFields={showAssociationFields} /> ); }; diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/RecordFormBlockInitializer.tsx b/packages/core/client/src/modules/blocks/data-blocks/form/RecordFormBlockInitializer.tsx index 3fa04e006..a080b596d 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/RecordFormBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/form/RecordFormBlockInitializer.tsx @@ -1,61 +1,87 @@ import { FormOutlined } from '@ant-design/icons'; -import React from 'react'; +import React, { useCallback } from 'react'; import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../../../application'; import { useBlockAssociationContext } from '../../../../block-provider'; import { useCollection_deprecated } from '../../../../collection-manager'; import { useSchemaTemplateManager } from '../../../../schema-templates'; import { createFormBlockSchema, useRecordCollectionDataSourceItems } from '../../../../schema-initializer/utils'; +/** + * @deprecated + */ export const RecordFormBlockInitializer = () => { const itemConfig = useSchemaInitializerItem(); - const { onCreateBlockSchema, componentType, createBlockSchema, targetCollection, ...others } = itemConfig; + const { targetCollection, ...others } = itemConfig; const { insert } = useSchemaInitializer(); const { getTemplateSchemaByMode } = useSchemaTemplateManager(); const currentCollection = useCollection_deprecated(); const collection = targetCollection || currentCollection; - const association = useBlockAssociationContext(); + + const { createEditFormBlock, templateWrap } = useCreateEditFormBlock(); + return ( } {...others} onClick={async ({ item }) => { if (item.template) { - const s = await getTemplateSchemaByMode(item); - if (item.template.componentName === 'FormItem') { - const blockSchema = createFormBlockSchema({ - association, - collection: collection.name, - dataSource: collection.dataSource, - action: 'get', - useSourceId: '{{ useSourceIdFromParentRecord }}', - useParams: '{{ useParamsFromRecord }}', - actionInitializers: 'editForm:configureActions', - template: s, - settings: 'blockSettings:editForm', - }); - if (item.mode === 'reference') { - blockSchema['x-template-key'] = item.template.key; - } - insert(blockSchema); - } else { - insert(s); - } + const template = await getTemplateSchemaByMode(item); + insert(templateWrap(template, { item })); } else { - insert( - createFormBlockSchema({ - association, - collection: collection.name, - dataSource: collection.dataSource, - action: 'get', - useSourceId: '{{ useSourceIdFromParentRecord }}', - useParams: '{{ useParamsFromRecord }}', - actionInitializers: 'editForm:configureActions', - settings: 'blockSettings:editForm', - }), - ); + createEditFormBlock({ item }); } }} items={useRecordCollectionDataSourceItems('FormItem', null, collection?.name)} /> ); }; + +export function useCreateEditFormBlock() { + const { insert } = useSchemaInitializer(); + const association = useBlockAssociationContext(); + + const createEditFormBlock = useCallback( + ({ item }) => { + insert( + createFormBlockSchema({ + association, + collection: item.collectionName || item.name, + dataSource: item.dataSource, + action: 'get', + useSourceId: '{{ useSourceIdFromParentRecord }}', + useParams: '{{ useParamsFromRecord }}', + actionInitializers: 'editForm:configureActions', + settings: 'blockSettings:editForm', + }), + ); + }, + [association, insert], + ); + + const templateWrap = useCallback( + (templateSchema, { item }) => { + if (item.template.componentName === 'FormItem') { + const blockSchema = createFormBlockSchema({ + association, + collection: item.collectionName || item.name, + dataSource: item.dataSource, + action: 'get', + useSourceId: '{{ useSourceIdFromParentRecord }}', + useParams: '{{ useParamsFromRecord }}', + actionInitializers: 'editForm:configureActions', + template: templateSchema, + settings: 'blockSettings:editForm', + }); + if (item.mode === 'reference') { + blockSchema['x-template-key'] = item.template.key; + } + return blockSchema; + } else { + return templateSchema; + } + }, + [association], + ); + + return { createEditFormBlock, templateWrap }; +} diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaSettings.test.ts b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaSettings.test.ts index cb311d787..738b7d6a1 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaSettings.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaSettings.test.ts @@ -1183,7 +1183,7 @@ test.describe('creation form block schema settings', () => { //在编辑操作中使用引用模板 await page.getByLabel('action-Action.Link-Edit-update-users-table-0').click(); await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-users').click(); - await page.getByRole('menuitem', { name: 'form Form' }).first().hover(); + await page.getByRole('menuitem', { name: 'form Form (Edit)' }).first().hover(); await page.getByRole('menuitem', { name: 'Reference template' }).hover(); await page.getByRole('menuitem', { name: 'Users_Form (Fields only)' }).first().click(); await page.mouse.move(300, 0); diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/templatesOfBug.ts b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/templatesOfBug.ts index 41afc0d6d..adf352e49 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/templatesOfBug.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/templatesOfBug.ts @@ -5499,7 +5499,7 @@ export const T3469: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', 'x-index': 1, properties: { isaxpp1w32b: { @@ -5551,7 +5551,7 @@ export const T3469: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', 'x-index': 1, properties: { e4ke3wqxm2o: { @@ -5710,7 +5710,7 @@ export const T3529: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { l62athlwjbe: { _isJSONSchemaObject: true, @@ -5752,7 +5752,7 @@ export const T3529: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -5767,7 +5767,7 @@ export const T3529: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -5786,7 +5786,7 @@ export const T3529: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { '7glkmum3znh': { _isJSONSchemaObject: true, @@ -5847,7 +5847,7 @@ export const T3529: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'RecordBlockInitializers', + 'x-initializer': 'popup:common:addBlock', properties: { '5ubuvb82lbu': { _isJSONSchemaObject: true, @@ -5898,7 +5898,7 @@ export const T3529: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', 'x-uid': 'aigmsbzdyeb', 'x-async': false, 'x-index': 1, @@ -5907,7 +5907,7 @@ export const T3529: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'CreateFormActionInitializers', + 'x-initializer': 'createForm:configureActions', 'x-component': 'ActionBar', 'x-component-props': { layout: 'one-column', diff --git a/packages/core/client/src/modules/blocks/data-blocks/grid-card/GridCardBlockInitializer.tsx b/packages/core/client/src/modules/blocks/data-blocks/grid-card/GridCardBlockInitializer.tsx index d8c41e53f..c483b9710 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/grid-card/GridCardBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/grid-card/GridCardBlockInitializer.tsx @@ -4,8 +4,35 @@ import { useSchemaInitializer, useSchemaInitializerItem } from '../../../../appl import { useCollectionManager_deprecated } from '../../../../collection-manager'; import { createGridCardBlockSchema } from '../../../../schema-initializer/utils'; import { DataBlockInitializer } from '../../../../schema-initializer/items/DataBlockInitializer'; +import { Collection, CollectionFieldOptions } from '../../../../data-source/collection/Collection'; -export const GridCardBlockInitializer = () => { +export const GridCardBlockInitializer = ({ + filterCollections, + onlyCurrentDataSource, + hideSearch, + createBlockSchema, + componentType = 'FormItem', + templateWrap, + showAssociationFields, +}: { + filterCollections: (options: { collection?: Collection; associationField?: CollectionFieldOptions }) => boolean; + onlyCurrentDataSource: boolean; + hideSearch?: boolean; + createBlockSchema?: (options: any) => any; + /** + * 虽然这里的命名现在看起来比较奇怪,但为了兼容旧版本的 template,暂时保留这个命名。 + */ + componentType?: 'FormItem'; + templateWrap?: ( + templateSchema: any, + { + item, + }: { + item: any; + }, + ) => any; + showAssociationFields?: boolean; +}) => { const { insert } = useSchemaInitializer(); const { getCollection } = useCollectionManager_deprecated(); const itemConfig = useSchemaInitializerItem(); @@ -15,6 +42,10 @@ export const GridCardBlockInitializer = () => { icon={} componentType={'GridCard'} onCreateBlockSchema={async ({ item }) => { + if (createBlockSchema) { + return createBlockSchema({ item }); + } + const collection = getCollection(item.name, item.dataSource); const schema = createGridCardBlockSchema({ collection: item.name, @@ -24,6 +55,10 @@ export const GridCardBlockInitializer = () => { }); insert(schema); }} + onlyCurrentDataSource={onlyCurrentDataSource} + hideSearch={hideSearch} + filter={filterCollections} + showAssociationFields={showAssociationFields} /> ); }; diff --git a/packages/core/client/src/modules/blocks/data-blocks/list/ListBlockInitializer.tsx b/packages/core/client/src/modules/blocks/data-blocks/list/ListBlockInitializer.tsx index 9271db04f..cd74176d2 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/list/ListBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/list/ListBlockInitializer.tsx @@ -4,8 +4,35 @@ import { useSchemaInitializer, useSchemaInitializerItem } from '../../../../appl import { useCollectionManager_deprecated } from '../../../../collection-manager'; import { createListBlockSchema } from '../../../../schema-initializer/utils'; import { DataBlockInitializer } from '../../../../schema-initializer/items/DataBlockInitializer'; +import { Collection, CollectionFieldOptions } from '../../../../data-source/collection/Collection'; -export const ListBlockInitializer = () => { +export const ListBlockInitializer = ({ + filterCollections, + onlyCurrentDataSource, + hideSearch, + createBlockSchema, + componentType = 'FormItem', + templateWrap, + showAssociationFields, +}: { + filterCollections: (options: { collection?: Collection; associationField?: CollectionFieldOptions }) => boolean; + onlyCurrentDataSource: boolean; + hideSearch?: boolean; + createBlockSchema?: (options: any) => any; + /** + * 虽然这里的命名现在看起来比较奇怪,但为了兼容旧版本的 template,暂时保留这个命名。 + */ + componentType?: 'FormItem'; + templateWrap?: ( + templateSchema: any, + { + item, + }: { + item: any; + }, + ) => any; + showAssociationFields?: boolean; +}) => { const { getCollection } = useCollectionManager_deprecated(); const { insert } = useSchemaInitializer(); const itemConfig = useSchemaInitializerItem(); @@ -15,6 +42,10 @@ export const ListBlockInitializer = () => { icon={} componentType={'List'} onCreateBlockSchema={async ({ item }) => { + if (createBlockSchema) { + return createBlockSchema({ item }); + } + const collection = getCollection(item.name, item.dataSource); const schema = createListBlockSchema({ collection: item.name, @@ -24,6 +55,10 @@ export const ListBlockInitializer = () => { }); insert(schema); }} + onlyCurrentDataSource={onlyCurrentDataSource} + hideSearch={hideSearch} + filter={filterCollections} + showAssociationFields={showAssociationFields} /> ); }; diff --git a/packages/core/client/src/modules/blocks/data-blocks/table/TableBlockInitializer.tsx b/packages/core/client/src/modules/blocks/data-blocks/table/TableBlockInitializer.tsx index 7bdd89c42..56d38dfc9 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table/TableBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/table/TableBlockInitializer.tsx @@ -4,8 +4,30 @@ import { useCollectionManager_deprecated } from '../../../../collection-manager/ import { DataBlockInitializer } from '../../../../schema-initializer/items/DataBlockInitializer'; import { createTableBlockSchema } from '../../../../schema-initializer/utils'; import React from 'react'; +import { Collection, CollectionFieldOptions } from '../../../../data-source/collection/Collection'; -export const TableBlockInitializer = () => { +export const TableBlockInitializer = ({ + filterCollections, + onlyCurrentDataSource, + hideSearch, + createBlockSchema, + templateWrap, + showAssociationFields, +}: { + filterCollections: (options: { collection?: Collection; associationField?: CollectionFieldOptions }) => boolean; + onlyCurrentDataSource: boolean; + hideSearch?: boolean; + createBlockSchema?: (options: any) => any; + templateWrap?: ( + templateSchema: any, + { + item, + }: { + item: any; + }, + ) => any; + showAssociationFields?: boolean; +}) => { const { insert } = useSchemaInitializer(); const { getCollection } = useCollectionManager_deprecated(); const itemConfig = useSchemaInitializerItem(); @@ -15,6 +37,10 @@ export const TableBlockInitializer = () => { icon={} componentType={'Table'} onCreateBlockSchema={async ({ item }) => { + if (createBlockSchema) { + return createBlockSchema({ item }); + } + const collection = getCollection(item.name, item.dataSource); const schema = createTableBlockSchema({ collection: item.name, @@ -23,6 +49,10 @@ export const TableBlockInitializer = () => { }); insert(schema); }} + onlyCurrentDataSource={onlyCurrentDataSource} + hideSearch={hideSearch} + filter={filterCollections} + showAssociationFields={showAssociationFields} /> ); }; diff --git a/packages/core/client/src/modules/blocks/filter-blocks/collapse/FilterCollapseBlockInitializer.tsx b/packages/core/client/src/modules/blocks/filter-blocks/collapse/FilterCollapseBlockInitializer.tsx index a7e7ad999..d5879ddd5 100644 --- a/packages/core/client/src/modules/blocks/filter-blocks/collapse/FilterCollapseBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/filter-blocks/collapse/FilterCollapseBlockInitializer.tsx @@ -4,14 +4,16 @@ import React from 'react'; import { useSchemaInitializer, useSchemaInitializerItem } from '../../../../application'; import { createCollapseBlockSchema } from '../../../../schema-initializer/utils'; import { DataBlockInitializer } from '../../../../schema-initializer/items/DataBlockInitializer'; -import { Collection } from '../../../../data-source'; +import { Collection, CollectionFieldOptions } from '../../../../data-source'; export const FilterCollapseBlockInitializer = ({ - filterMenuItemChildren, + filterCollections, onlyCurrentDataSource, + showChildren, }: { - filterMenuItemChildren: (collection: Collection) => boolean; + filterCollections: (options: { collection?: Collection; associationField?: CollectionFieldOptions }) => boolean; onlyCurrentDataSource: boolean; + showChildren?: boolean; }) => { const itemConfig = useSchemaInitializerItem(); const { insert } = useSchemaInitializer(); @@ -31,7 +33,8 @@ export const FilterCollapseBlockInitializer = ({ }); insert(schema); }} - filter={filterMenuItemChildren} + filter={filterCollections} + showChildren={showChildren} /> ); }; diff --git a/packages/core/client/src/modules/blocks/filter-blocks/form/FilterFormBlockInitializer.tsx b/packages/core/client/src/modules/blocks/filter-blocks/form/FilterFormBlockInitializer.tsx index a6aa6e28f..60a966017 100644 --- a/packages/core/client/src/modules/blocks/filter-blocks/form/FilterFormBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/filter-blocks/form/FilterFormBlockInitializer.tsx @@ -1,18 +1,21 @@ import { FormOutlined } from '@ant-design/icons'; import React from 'react'; -import { useSchemaInitializerItem } from '../../../../application'; +import { useSchemaInitializer, useSchemaInitializerItem } from '../../../../application'; import { createFilterFormBlockSchema } from '../../../../schema-initializer/utils'; import { FilterBlockInitializer } from '../../../../schema-initializer/items/FilterBlockInitializer'; -import { Collection } from '../../../../data-source'; +import { Collection, CollectionFieldOptions } from '../../../../data-source'; export const FilterFormBlockInitializer = ({ - filterMenuItemChildren, + filterCollections, onlyCurrentDataSource, + showChildren, }: { - filterMenuItemChildren: (collection: Collection) => boolean; + filterCollections: (options: { collection?: Collection; associationField?: CollectionFieldOptions }) => boolean; onlyCurrentDataSource: boolean; + showChildren?: boolean; }) => { const itemConfig = useSchemaInitializerItem(); + const { insert } = useSchemaInitializer(); return ( { - options = { ...options, settings: 'blockSettings:filterForm' }; - return createFilterFormBlockSchema(options); + onCreateBlockSchema={({ item }) => { + return insert( + createFilterFormBlockSchema({ + collection: item.collectionName || item.name, + dataSource: item.dataSource, + settings: 'blockSettings:filterForm', + }), + ); }} - filter={filterMenuItemChildren} + filter={filterCollections} + showChildren={showChildren} /> ); }; diff --git a/packages/core/client/src/modules/dialog/__e2e__/schemaInitializer.test.ts b/packages/core/client/src/modules/dialog/__e2e__/schemaInitializer.test.ts index 47f4e2567..210eb77e0 100644 --- a/packages/core/client/src/modules/dialog/__e2e__/schemaInitializer.test.ts +++ b/packages/core/client/src/modules/dialog/__e2e__/schemaInitializer.test.ts @@ -77,10 +77,9 @@ test.describe('where to open a popup and what can be added to it', () => { await expect(page.getByText('test8')).toBeVisible(); // add blocks - await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover(); - await page.getByRole('menuitem', { name: 'Details' }).click(); - await page.getByText('Form').first().click(); - await page.getByRole('menuitem', { name: 'Markdown' }).click(); + await addBlock(['table Details right', 'General']); + await addBlock(['form Form (Edit)']); + await addBlock(['Markdown']); await expect(page.getByText('GeneralConfigure actionsConfigure fields')).toBeVisible(); await expect(page.getByText('GeneralConfigure fieldsConfigure actions')).toBeVisible(); @@ -106,26 +105,18 @@ test.describe('where to open a popup and what can be added to it', () => { await page.getByRole('button', { name: 'OK', exact: true }).click(); // add relationship blocks - await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover(); - await page.getByRole('menuitem', { name: 'Many to one' }).hover(); - await page.getByRole('menuitem', { name: 'Details' }).click(); - - await page.mouse.move(300, 0); - - await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover(); - await page.getByRole('menuitem', { name: 'One to many' }).hover(); - - // 下拉列表中,可选择以下区块进行创建 - await expect(page.getByText('Table')).toBeVisible(); - await expect(page.getByRole('menuitem', { name: 'Details' }).nth(1)).toBeVisible(); - await expect(page.getByRole('menuitem', { name: 'List' })).toBeVisible(); - await expect(page.getByRole('menuitem', { name: 'Grid Card' })).toBeVisible(); - await expect(page.getByText('Form').nth(1)).toBeVisible(); - await expect(page.getByRole('menuitem', { name: 'Calendar' })).toBeVisible(); - - await page.getByText('Table').click(); - await page.mouse.move(300, 0); + await addBlock(['table Details right', 'Many to one']); + await expect(page.getByLabel('block-item-CardItem-users-')).toBeVisible(); + await addBlock(['table Table right', 'One to many']); await expect(page.getByLabel('block-item-CardItem-users-table')).toBeVisible(); + + async function addBlock(names: string[]) { + await page.getByLabel('schema-initializer-Grid-popup').hover(); + for (const name of names) { + await page.getByRole('menuitem', { name }).click(); + } + await page.mouse.move(300, 0); + } }); test('bulk edit', async ({ page, mockPage }) => { @@ -171,8 +162,11 @@ test.describe('where to open a popup and what can be added to it', () => { // add blocks await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover(); - await page.getByRole('menuitem', { name: 'Details' }).click(); - await page.getByText('Form').first().click(); + await page.getByRole('menuitem', { name: 'Details' }).hover(); + await page.getByRole('menuitem', { name: 'General' }).click(); + await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover(); + await page.getByRole('menuitem', { name: 'form Form (Edit)' }).first().click(); + await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover(); await page.getByRole('menuitem', { name: 'Markdown' }).click(); await page.mouse.move(300, 0); @@ -181,27 +175,27 @@ test.describe('where to open a popup and what can be added to it', () => { await expect(page.getByLabel('block-item-Markdown.Void-general-markdown')).toBeVisible(); // add relationship blocks - await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover(); - await page.getByRole('menuitem', { name: 'Many to one' }).hover(); - await page.getByRole('menuitem', { name: 'Details' }).click(); - await page.mouse.move(300, 0); - - await expect(page.getByLabel('block-item-CardItem-general-').nth(2)).toBeVisible(); - - await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover(); - await page.getByRole('menuitem', { name: 'One to many' }).hover(); - // 下拉列表中,可选择以下区块进行创建 - await expect(page.getByText('Table')).toBeVisible(); - await expect(page.getByRole('menuitem', { name: 'Details' }).nth(1)).toBeVisible(); - await expect(page.getByRole('menuitem', { name: 'List' })).toBeVisible(); - await expect(page.getByRole('menuitem', { name: 'Grid Card' })).toBeVisible(); - await expect(page.getByText('Form').nth(1)).toBeVisible(); + await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover(); + await expect(page.getByRole('menuitem', { name: 'table Details right' })).toBeVisible(); + await expect(page.getByRole('menuitem', { name: 'form Form (Edit)' })).toBeVisible(); + await expect(page.getByRole('menuitem', { name: 'form Form (Add new) right' })).toBeVisible(); + await expect(page.getByRole('menuitem', { name: 'form Form (Add new) right' })).toBeVisible(); + await expect(page.getByRole('menuitem', { name: 'table Table right' })).toBeVisible(); + await expect(page.getByRole('menuitem', { name: 'ordered-list List right' })).toBeVisible(); + await expect(page.getByRole('menuitem', { name: 'ordered-list Grid Card right' })).toBeVisible(); await expect(page.getByRole('menuitem', { name: 'Calendar' })).toBeVisible(); - await page.getByText('Table').click(); + await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover(); + await page.getByRole('menuitem', { name: 'Details' }).hover(); + await page.getByRole('menuitem', { name: 'Many to one' }).click(); await page.mouse.move(300, 0); + await expect(page.getByLabel('block-item-CardItem-users-')).toBeVisible(); + await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover(); + await page.getByRole('menuitem', { name: 'table Table right' }).hover(); + await page.getByRole('menuitem', { name: 'One to many' }).click(); + await page.mouse.move(300, 0); await expect(page.getByLabel('block-item-CardItem-users-table')).toBeVisible(); // 屏幕上没有显示错误提示 await expect(page.locator('.ant-notification-notice').first()).toBeHidden({ timeout: 1000 }); diff --git a/packages/core/client/src/modules/fields/component/DatePicker/__e2e__/utils.ts b/packages/core/client/src/modules/fields/component/DatePicker/__e2e__/utils.ts index e583bac73..2b89970b4 100644 --- a/packages/core/client/src/modules/fields/component/DatePicker/__e2e__/utils.ts +++ b/packages/core/client/src/modules/fields/component/DatePicker/__e2e__/utils.ts @@ -16,7 +16,7 @@ export const oneTableBlockWithDatetimeFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { irc4mhtog83: { _isJSONSchemaObject: true, @@ -58,7 +58,7 @@ export const oneTableBlockWithDatetimeFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'void', - 'x-initializer': 'TableActionInitializers', + 'x-initializer': 'table:configureActions', 'x-component': 'ActionBar', 'x-component-props': { style: { @@ -73,7 +73,7 @@ export const oneTableBlockWithDatetimeFields: PageConfig = { _isJSONSchemaObject: true, version: '2.0', type: 'array', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-component': 'TableV2', 'x-component-props': { rowKey: 'id', @@ -92,7 +92,7 @@ export const oneTableBlockWithDatetimeFields: PageConfig = { 'x-decorator': 'TableV2.Column.ActionBar', 'x-component': 'TableV2.Column', 'x-designer': 'TableV2.ActionColumnDesigner', - 'x-initializer': 'TableActionColumnInitializers', + 'x-initializer': 'table:configureItemActions', properties: { gk4b4e4wp8b: { _isJSONSchemaObject: true, @@ -192,7 +192,7 @@ export const oneFormBlockWithDatetimeFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { annx4g65mtu: { _isJSONSchemaObject: true, @@ -239,7 +239,7 @@ export const oneFormBlockWithDatetimeFields: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { '269bdhc35j2': { _isJSONSchemaObject: true, diff --git a/packages/core/client/src/modules/fields/component/Picker/TableSelectorInitializers.tsx b/packages/core/client/src/modules/fields/component/Picker/TableSelectorInitializers.tsx index defd4cf93..403ea1d41 100644 --- a/packages/core/client/src/modules/fields/component/Picker/TableSelectorInitializers.tsx +++ b/packages/core/client/src/modules/fields/component/Picker/TableSelectorInitializers.tsx @@ -35,7 +35,7 @@ export const tableSelectorInitializers_deprecated = new CompatibleSchemaInitiali title: '{{t("Form")}}', Component: 'FilterFormBlockInitializer', componentProps: { - filterMenuItemChildren() { + filterCollections() { return false; }, onlyCurrentDataSource: true, @@ -48,7 +48,7 @@ export const tableSelectorInitializers_deprecated = new CompatibleSchemaInitiali title: '{{t("Collapse")}}', Component: 'FilterCollapseBlockInitializer', componentProps: { - filterMenuItemChildren() { + filterCollections() { return false; }, onlyCurrentDataSource: true, @@ -117,7 +117,7 @@ export const tableSelectorInitializers = new CompatibleSchemaInitializer( title: '{{t("Form")}}', Component: 'FilterFormBlockInitializer', componentProps: { - filterMenuItemChildren() { + filterCollections() { return false; }, onlyCurrentDataSource: true, @@ -130,7 +130,7 @@ export const tableSelectorInitializers = new CompatibleSchemaInitializer( title: '{{t("Collapse")}}', Component: 'FilterCollapseBlockInitializer', componentProps: { - filterMenuItemChildren() { + filterCollections() { return false; }, onlyCurrentDataSource: true, diff --git a/packages/core/client/src/modules/page/__e2e__/blockInitializers.test.ts b/packages/core/client/src/modules/page/__e2e__/blockInitializers.test.ts new file mode 100644 index 000000000..40e17d3cb --- /dev/null +++ b/packages/core/client/src/modules/page/__e2e__/blockInitializers.test.ts @@ -0,0 +1,12 @@ +import { test, expect } from '@nocobase/test/e2e'; + +test.describe('page:addBlock', () => { + test('当搜索不到数据时显示空状态', async ({ page, mockPage }) => { + await mockPage().goto(); + await page.getByLabel('schema-initializer-Grid-').hover(); + await page.getByRole('menuitem', { name: 'table Table right' }).hover(); + await page.getByRole('textbox', { name: 'Search and select collection' }).fill('no match'); + + await expect(page.getByRole('menuitem', { name: 'No data' })).toBeVisible(); + }); +}); diff --git a/packages/core/client/src/schema-component/antd/details/Details.tsx b/packages/core/client/src/schema-component/antd/details/Details.tsx index ef97a6a1e..14025ff9b 100644 --- a/packages/core/client/src/schema-component/antd/details/Details.tsx +++ b/packages/core/client/src/schema-component/antd/details/Details.tsx @@ -1,3 +1,16 @@ +import React from 'react'; import { FormV2 } from '../form-v2'; +import { useDetailsBlockContext } from '../../../block-provider/DetailsBlockProvider'; +import _ from 'lodash'; +import { Empty } from 'antd'; +import { useDataBlockRequest } from '../../../data-source'; -export const Details = FormV2; +export const Details = (props) => { + const request = useDataBlockRequest(); + + if (!request?.loading && _.isEmpty(request?.data?.data)) { + return ; + } + + return ; +}; diff --git a/packages/core/client/src/schema-component/antd/details/__tests__/details.test.tsx b/packages/core/client/src/schema-component/antd/details/__tests__/details.test.tsx index f55293290..5c38bb711 100644 --- a/packages/core/client/src/schema-component/antd/details/__tests__/details.test.tsx +++ b/packages/core/client/src/schema-component/antd/details/__tests__/details.test.tsx @@ -6,7 +6,6 @@ describe('Details', () => { it('should render correctly', () => { render(); - expect(screen.getByText('this is name')).toBeInTheDocument(); - expect(screen.getByText('this is age')).toBeInTheDocument(); + expect(screen.getByText('No data')).toBeInTheDocument(); }); }); diff --git a/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx index 141b070fb..e9fce3aad 100644 --- a/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx +++ b/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx @@ -1,9 +1,20 @@ -import { Schema, useFieldSchema } from '@formily/react'; -import { useMemo } from 'react'; -import { useCollectionManager_deprecated, useCollection_deprecated } from '../..'; -import { SchemaInitializerItemType, useSchemaInitializer } from '../../application'; +import { Schema } from '@formily/react'; +import { useCallback, useMemo } from 'react'; +import { + useCollection, + useCollectionManager_deprecated, + useCollection_deprecated, + useCreateAssociationDetailsBlock, + useCreateAssociationDetailsWithoutPagination, + useCreateAssociationFormBlock, + useCreateAssociationGridCardBlock, + useCreateAssociationListBlock, + useCreateAssociationTableBlock, + useCreateEditFormBlock, +} from '../..'; import { CompatibleSchemaInitializer } from '../../application/schema-initializer/CompatibleSchemaInitializer'; import { gridRowColWrap } from '../utils'; +import { useCreateSingleDetailsSchema } from '../../modules/blocks/data-blocks/details-single/RecordReadPrettyFormBlockInitializer'; const recursiveParent = (schema: Schema) => { if (!schema) return null; @@ -15,223 +26,233 @@ const recursiveParent = (schema: Schema) => { } }; -const useRelationFields = () => { - const fieldSchema = useFieldSchema(); - const { getCollectionFields } = useCollectionManager_deprecated(); - const collection = useCollection_deprecated(); - let fields = []; - - if (fieldSchema['x-initializer']) { - fields = collection.fields; - } else { - const collection = recursiveParent(fieldSchema.parent); - if (collection) { - fields = getCollectionFields(collection); - } - } - - const relationFields = fields - .filter((field) => ['linkTo', 'subTable', 'o2m', 'm2m', 'obo', 'oho', 'o2o', 'm2o'].includes(field.interface)) - .map((field) => { - if (['hasOne', 'belongsTo'].includes(field.type)) { - return { - name: field.name, - type: 'subMenu', - title: field?.uiSchema?.title || field.name, - children: [ - { - name: `${field.name}_details`, - type: 'item', - title: '{{t("Details")}}', - field, - Component: 'RecordReadPrettyAssociationFormBlockInitializer', - }, - // { - // name: `${field.name}_form`, - // type: 'item', - // title: '{{t("Form")}}', - // field, - // component: 'RecordAssociationFormBlockInitializer', - // }, - ], - }; - } - - if (['hasMany', 'belongsToMany'].includes(field.type)) { - return { - name: field.name, - type: 'subMenu', - title: field?.uiSchema?.title || field.name, - children: [ - { - name: `${field.name}_table`, - type: 'item', - title: '{{t("Table")}}', - field, - Component: 'RecordAssociationBlockInitializer', - }, - { - name: `${field.name}_details`, - type: 'item', - title: '{{t("Details")}}', - field, - Component: 'RecordAssociationDetailsBlockInitializer', - }, - { - name: `${field.name}_list`, - type: 'item', - title: '{{t("List")}}', - field, - Component: 'RecordAssociationListBlockInitializer', - }, - { - name: `${field.name}_grid_card`, - type: 'item', - title: '{{t("Grid Card")}}', - field, - Component: 'RecordAssociationGridCardBlockInitializer', - }, - { - name: `${field.name}_form`, - type: 'item', - title: '{{t("Form")}}', - field, - Component: 'RecordAssociationFormBlockInitializer', - }, - // TODO: This one should be append in the calendar plugin - { - name: `${field.name}_calendar`, - type: 'item', - title: '{{t("Calendar")}}', - field, - Component: 'RecordAssociationCalendarBlockInitializer', - }, - ], - }; - } - - return { - name: field.name, - type: 'item', - field, - title: field?.uiSchema?.title || field.name, - Component: 'RecordAssociationBlockInitializer', - }; - }) as any; - - return relationFields; -}; - -const useDetailCollections = (props) => { - const { actionInitializers, childrenCollections, collection } = props; - const detailCollections = [ - { - name: collection.name, - type: 'item', - title: collection?.title || collection.name, - Component: 'RecordReadPrettyFormBlockInitializer', - icon: false, - targetCollection: collection, - actionInitializers, - }, - ].concat( - childrenCollections.map((c) => { - return { - name: c.name, - type: 'item', - title: c?.title || c.name, - Component: 'RecordReadPrettyFormBlockInitializer', - icon: false, - targetCollection: c, - actionInitializers, - }; - }), - ) as SchemaInitializerItemType[]; - return detailCollections; -}; - -const useFormCollections = (props) => { - const { actionInitializers, childrenCollections, collection } = props; - const formCollections = [ - { - name: collection.name, - type: 'item', - title: collection?.title || collection.name, - Component: 'RecordFormBlockInitializer', - icon: false, - targetCollection: collection, - actionInitializers, - }, - ].concat( - childrenCollections.map((c) => { - return { - name: c.name, - type: 'item', - title: c?.title || c.name, - Component: 'RecordFormBlockInitializer', - icon: false, - targetCollection: c, - actionInitializers, - }; - }), - ) as SchemaInitializerItemType[]; - - return formCollections; +export const canMakeAssociationBlock = (field) => { + return ['linkTo', 'subTable', 'o2m', 'm2m', 'obo', 'oho', 'o2o', 'm2o'].includes(field.interface); }; function useRecordBlocks() { - const { options } = useSchemaInitializer(); - const { actionInitializers } = options; const collection = useCollection_deprecated(); const { getChildrenCollections } = useCollectionManager_deprecated(); const collectionsWithView = getChildrenCollections(collection.name, true, collection.dataSource).filter( (v) => v?.filterTargetKey, ); - const hasChildCollection = collectionsWithView?.length > 0; - const modifyFlag = (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; - const detailChildren = useDetailCollections({ - ...options, - childrenCollections: collectionsWithView, - collection, - }); - const formChildren = useFormCollections({ - ...options, - childrenCollections: collectionsWithView, - collection, - }); - const res = []; - if (hasChildCollection) { - res.push({ - name: 'details', - type: 'subMenu', - title: '{{t("Details")}}', - children: detailChildren, - }); - } else { - res.push({ + const res: any[] = [ + { name: 'details', title: '{{t("Details")}}', - Component: 'RecordReadPrettyFormBlockInitializer', - actionInitializers, - }); - } + Component: 'DetailsBlockInitializer', + collectionName: collection.name, + dataSource: collection.dataSource, + useComponentProps() { + const currentCollection = useCollection_deprecated(); + const { createSingleDetailsSchema, templateWrap } = useCreateSingleDetailsSchema(); + const { createAssociationDetailsBlock } = useCreateAssociationDetailsBlock(); + const { + createAssociationDetailsWithoutPagination, + templateWrap: templateWrapOfAssociationDetailsWithoutPagination, + } = useCreateAssociationDetailsWithoutPagination(); + const collectionsNeedToDisplay = [currentCollection, ...collectionsWithView]; + const createBlockSchema = useCallback( + ({ item }) => { + if (item.associationField) { + if (['hasOne', 'belongsTo'].includes(item.associationField.type)) { + return createAssociationDetailsWithoutPagination({ item }); + } + return createAssociationDetailsBlock({ item }); + } + return createSingleDetailsSchema({ item }); + }, + [createAssociationDetailsBlock, createAssociationDetailsWithoutPagination, createSingleDetailsSchema], + ); + return { + filterCollections({ collection, associationField }) { + if (collection) { + return collectionsNeedToDisplay.some((c) => c.name === collection.name); + } + if (associationField) { + return true; + } + return false; + }, + onlyCurrentDataSource: true, + // hideSearch: true, + componentType: 'ReadPrettyFormItem', + createBlockSchema, + templateWrap: useCallback( + (templateSchema, { item }) => { + if (item.associationField) { + if (['hasOne', 'belongsTo'].includes(item.associationField.type)) { + return templateWrapOfAssociationDetailsWithoutPagination(templateSchema, { item }); + } + return templateSchema; + } + return templateWrap(templateSchema, { item }); + }, + [templateWrap, templateWrapOfAssociationDetailsWithoutPagination], + ), + showAssociationFields: true, + }; + }, + }, + { + name: 'editForm', + title: '{{t("Form (Edit)")}}', + Component: 'FormBlockInitializer', + collectionName: collection.name, + dataSource: collection.dataSource, + useComponentProps() { + const currentCollection = useCollection_deprecated(); + const { createEditFormBlock, templateWrap } = useCreateEditFormBlock(); + const collectionsNeedToDisplay = [currentCollection, ...collectionsWithView]; - if (hasChildCollection) { - res.push({ - name: 'form', - type: 'subMenu', - title: '{{t("Form")}}', - children: formChildren, - }); - } else { - modifyFlag && - res.push({ - name: 'form', - title: '{{t("Form")}}', - Component: 'RecordFormBlockInitializer', - }); - } + return { + filterCollections({ collection }) { + if (collection) { + return collectionsNeedToDisplay.some((c) => c.name === collection.name); + } + return false; + }, + onlyCurrentDataSource: true, + // hideSearch: true, + componentType: 'FormItem', + createBlockSchema: createEditFormBlock, + templateWrap: templateWrap, + showAssociationFields: true, + }; + }, + useVisible() { + return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; + }, + }, + { + name: 'createForm', + title: '{{t("Form (Add new)")}}', + Component: 'FormBlockInitializer', + collectionName: collection.name, + dataSource: collection.dataSource, + useComponentProps() { + const { createAssociationFormBlock, templateWrap } = useCreateAssociationFormBlock(); + return { + filterCollections({ collection, associationField }) { + if (associationField) { + return ['hasMany', 'belongsToMany'].includes(associationField.type); + } + return false; + }, + onlyCurrentDataSource: true, + // hideSearch: true, + componentType: 'FormItem', + createBlockSchema: createAssociationFormBlock, + templateWrap: templateWrap, + showAssociationFields: true, + }; + }, + useVisible() { + const collection = useCollection(); + return useMemo( + () => + collection.fields.some( + (field) => canMakeAssociationBlock(field) && ['hasMany', 'belongsToMany'].includes(field.type), + ), + [collection.fields], + ); + }, + }, + { + name: 'table', + title: '{{t("Table")}}', + Component: 'TableBlockInitializer', + useVisible() { + const collection = useCollection(); + return useMemo( + () => + collection.fields.some( + (field) => canMakeAssociationBlock(field) && ['hasMany', 'belongsToMany'].includes(field.type), + ), + [collection.fields], + ); + }, + useComponentProps() { + const { createAssociationTableBlock } = useCreateAssociationTableBlock(); + + return { + // hideSearch: true, + onlyCurrentDataSource: true, + filterCollections({ associationField }) { + if (associationField) { + return ['hasMany', 'belongsToMany'].includes(associationField.type); + } + return false; + }, + createBlockSchema: createAssociationTableBlock, + showAssociationFields: true, + }; + }, + }, + { + name: 'list', + title: '{{t("List")}}', + Component: 'ListBlockInitializer', + useVisible() { + const collection = useCollection(); + return useMemo( + () => + collection.fields.some( + (field) => canMakeAssociationBlock(field) && ['hasMany', 'belongsToMany'].includes(field.type), + ), + [collection.fields], + ); + }, + useComponentProps() { + const { createAssociationListBlock } = useCreateAssociationListBlock(); + + return { + // hideSearch: true, + onlyCurrentDataSource: true, + filterCollections({ associationField }) { + if (associationField) { + return ['hasMany', 'belongsToMany'].includes(associationField.type); + } + return false; + }, + createBlockSchema: createAssociationListBlock, + showAssociationFields: true, + }; + }, + }, + { + name: 'gridCard', + title: '{{t("Grid Card")}}', + Component: 'GridCardBlockInitializer', + useVisible() { + const collection = useCollection(); + return useMemo( + () => + collection.fields.some( + (field) => canMakeAssociationBlock(field) && ['hasMany', 'belongsToMany'].includes(field.type), + ), + [collection.fields], + ); + }, + useComponentProps() { + const { createAssociationGridCardBlock } = useCreateAssociationGridCardBlock(); + + return { + // hideSearch: true, + onlyCurrentDataSource: true, + filterCollections({ associationField }) { + if (associationField) { + return ['hasMany', 'belongsToMany'].includes(associationField.type); + } + return false; + }, + createBlockSchema: createAssociationGridCardBlock, + showAssociationFields: true, + }; + }, + }, + ]; return res; } @@ -247,8 +268,8 @@ export const recordBlockInitializers_deprecated = new CompatibleSchemaInitialize items: [ { type: 'itemGroup', - name: 'currentRecordBlocks', - title: '{{t("Current record blocks")}}', + name: 'dataBlocks', + title: '{{t("Data blocks")}}', useChildren: useRecordBlocks, }, { @@ -256,8 +277,14 @@ export const recordBlockInitializers_deprecated = new CompatibleSchemaInitialize title: '{{t("Filter blocks")}}', type: 'itemGroup', useVisible() { - const collection = useCollection_deprecated(); - return collection.fields.some((field) => ['hasMany', 'belongsToMany'].includes(field.type)); + const collection = useCollection(); + return useMemo( + () => + collection.fields.some( + (field) => canMakeAssociationBlock(field) && ['hasMany', 'belongsToMany'].includes(field.type), + ), + [collection.fields], + ); }, children: [ { @@ -272,10 +299,13 @@ export const recordBlockInitializers_deprecated = new CompatibleSchemaInitialize ); return { - filterMenuItemChildren(collection) { - return toManyField.some((field) => field.target === collection.name); + filterCollections({ collection }) { + if (collection) { + return toManyField.some((field) => field.target === collection.name); + } }, onlyCurrentDataSource: true, + showChildren: true, }; }, }, @@ -284,32 +314,35 @@ export const recordBlockInitializers_deprecated = new CompatibleSchemaInitialize title: '{{t("Collapse")}}', Component: 'FilterCollapseBlockInitializer', useComponentProps() { - const collection = useCollection_deprecated(); + const collection = useCollection(); const toManyField = useMemo( () => collection.fields.filter((field) => ['hasMany', 'belongsToMany'].includes(field.type)), [collection.fields], ); return { - filterMenuItemChildren(collection) { - return toManyField.some((field) => field.target === collection.name); + filterCollections({ collection }) { + if (collection) { + return toManyField.some((field) => field.target === collection.name); + } }, onlyCurrentDataSource: true, + showChildren: true, }; }, }, ], }, - { - type: 'itemGroup', - name: 'relationshipBlocks', - title: '{{t("Relationship blocks")}}', - useChildren: useRelationFields, - useVisible() { - const res = useRelationFields(); - return res.length > 0; - }, - }, + // { + // type: 'itemGroup', + // name: 'relationshipBlocks', + // title: '{{t("Relationship blocks")}}', + // useChildren: useRelationFields, + // useVisible() { + // const res = useRelationFields(); + // return res.length > 0; + // }, + // }, { type: 'itemGroup', name: 'otherBlocks', @@ -334,8 +367,8 @@ export const recordBlockInitializers = new CompatibleSchemaInitializer( items: [ { type: 'itemGroup', - name: 'currentRecordBlocks', - title: '{{t("Current record blocks")}}', + name: 'dataBlocks', + title: '{{t("Data blocks")}}', useChildren: useRecordBlocks, }, { @@ -343,8 +376,14 @@ export const recordBlockInitializers = new CompatibleSchemaInitializer( title: '{{t("Filter blocks")}}', type: 'itemGroup', useVisible() { - const collection = useCollection_deprecated(); - return collection.fields.some((field) => ['hasMany', 'belongsToMany'].includes(field.type)); + const collection = useCollection(); + return useMemo( + () => + collection.fields.some( + (field) => canMakeAssociationBlock(field) && ['hasMany', 'belongsToMany'].includes(field.type), + ), + [collection.fields], + ); }, children: [ { @@ -359,10 +398,13 @@ export const recordBlockInitializers = new CompatibleSchemaInitializer( ); return { - filterMenuItemChildren(collection) { - return toManyField.some((field) => field.target === collection.name); + filterCollections({ collection }) { + if (collection) { + return toManyField.some((field) => field.target === collection.name); + } }, onlyCurrentDataSource: true, + showChildren: true, }; }, }, @@ -371,32 +413,35 @@ export const recordBlockInitializers = new CompatibleSchemaInitializer( title: '{{t("Collapse")}}', Component: 'FilterCollapseBlockInitializer', useComponentProps() { - const collection = useCollection_deprecated(); + const collection = useCollection(); const toManyField = useMemo( () => collection.fields.filter((field) => ['hasMany', 'belongsToMany'].includes(field.type)), [collection.fields], ); return { - filterMenuItemChildren(collection) { - return toManyField.some((field) => field.target === collection.name); + filterCollections({ collection }) { + if (collection) { + return toManyField.some((field) => field.target === collection.name); + } }, onlyCurrentDataSource: true, + showChildren: true, }; }, }, ], }, - { - type: 'itemGroup', - name: 'relationshipBlocks', - title: '{{t("Relationship blocks")}}', - useChildren: useRelationFields, - useVisible() { - const res = useRelationFields(); - return res.length > 0; - }, - }, + // { + // type: 'itemGroup', + // name: 'relationshipBlocks', + // title: '{{t("Relationship blocks")}}', + // useChildren: useRelationFields, + // useVisible() { + // const res = useRelationFields(); + // return res.length > 0; + // }, + // }, { type: 'itemGroup', name: 'otherBlocks', diff --git a/packages/core/client/src/schema-initializer/index.ts b/packages/core/client/src/schema-initializer/index.ts index cc68d9725..e8e9b2006 100644 --- a/packages/core/client/src/schema-initializer/index.ts +++ b/packages/core/client/src/schema-initializer/index.ts @@ -124,6 +124,7 @@ export { createFilterFormBlockSchema, createFormBlockSchema, createReadPrettyFormBlockSchema, + createDetailsBlockSchema, createTableBlockSchema, gridRowColWrap, itemsMerge, diff --git a/packages/core/client/src/schema-initializer/items/DataBlockInitializer.tsx b/packages/core/client/src/schema-initializer/items/DataBlockInitializer.tsx index 61263af92..98dc3c113 100644 --- a/packages/core/client/src/schema-initializer/items/DataBlockInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/DataBlockInitializer.tsx @@ -8,7 +8,7 @@ import { useGetSchemaInitializerMenuItems, useSchemaInitializer, } from '../../application'; -import { Collection } from '../../data-source/collection/Collection'; +import { Collection, CollectionFieldOptions } from '../../data-source/collection/Collection'; import { useCompile } from '../../schema-component'; import { useSchemaTemplateManager } from '../../schema-templates'; import { useCollectionDataSourceItems } from '../utils'; @@ -109,7 +109,17 @@ const LoadingItem = ({ loadMore, maxHeight }) => { ); }; -export function useMenuSearch(data: any[], openKeys: string[], showType?: boolean) { +export function useMenuSearch({ + data, + openKeys, + showType, + hideSearch, +}: { + data: any[]; + openKeys: string[]; + showType?: boolean; + hideSearch?: boolean; +}) { const [searchValue, setSearchValue] = useState(''); const [count, setCount] = useState(STEP); @@ -154,28 +164,31 @@ export function useMenuSearch(data: any[], openKeys: string[], showType?: boolea // 最终的返回结果 const resultItems = useMemo(() => { - // isMenuType 为了 `useSchemaInitializerMenuItems()` 里面处理判断标识的 - const res: any[] = [ + const res = []; + if (!hideSearch) { // 开头:搜索框 - Object.assign( - { - key: 'search', - label: ( - { - setCount(STEP); - setSearchValue(val); - }} - /> - ), - onClick({ domEvent }) { - domEvent.stopPropagation(); + res.push( + Object.assign( + { + key: 'search', + label: ( + { + setCount(STEP); + setSearchValue(val); + }} + /> + ), + onClick({ domEvent }) { + domEvent.stopPropagation(); + }, }, - }, - showType ? { isMenuType: true } : {}, - ), - ]; + // isMenuType 为了 `useSchemaInitializerMenuItems()` 里面处理判断标识的 + showType ? { isMenuType: true } : {}, + ), + ); + } // 中间:搜索的数据 if (limitedSearchedItems.length > 0) { @@ -220,7 +233,7 @@ export function useMenuSearch(data: any[], openKeys: string[], showType?: boolea } return res; - }, [limitedSearchedItems, searchValue, shouldLoadMore, showType]); + }, [hideSearch, limitedSearchedItems, searchValue, shouldLoadMore, showType]); const res = useMemo(() => { if (!isMuliSource) return resultItems; @@ -237,7 +250,7 @@ export function useMenuSearch(data: any[], openKeys: string[], showType?: boolea }; } }); - }, [data, openKey, resultItems]); + }, [data, isMuliSource, openKey, resultItems]); return res; } @@ -252,13 +265,16 @@ export interface DataBlockInitializerProps { ) => any; onCreateBlockSchema?: (args: any) => void; createBlockSchema?: (args: any) => any; - isCusomeizeCreate?: boolean; icon?: string | React.ReactNode; name: string; title: string; - filter?: (collection: Collection) => boolean; + filter?: (options: { collection: Collection; associationField: CollectionFieldOptions }) => boolean; componentType: string; onlyCurrentDataSource?: boolean; + hideSearch?: boolean; + showAssociationFields?: boolean; + /** 即使 children 只有一个时,也显示出来 */ + showChildren?: boolean; } export const DataBlockInitializer = (props: DataBlockInitializerProps) => { @@ -266,13 +282,14 @@ export const DataBlockInitializer = (props: DataBlockInitializerProps) => { templateWrap, onCreateBlockSchema, componentType, - createBlockSchema, - isCusomeizeCreate, icon = TableOutlined, name, title, filter, onlyCurrentDataSource, + hideSearch, + showAssociationFields, + showChildren, } = props; const { insert, setVisible } = useSchemaInitializer(); const compile = useCompile(); @@ -285,30 +302,34 @@ export const DataBlockInitializer = (props: DataBlockInitializerProps) => { } else { if (onCreateBlockSchema) { onCreateBlockSchema({ item }); - } else if (createBlockSchema) { - insert( - createBlockSchema({ - collection: item.collectionName || item.name, - dataSource: item.dataSource, - isCusomeizeCreate, - settings: 'blockSettings:createForm', - }), - ); } } setVisible(false); }, - [createBlockSchema, getTemplateSchemaByMode, insert, isCusomeizeCreate, onCreateBlockSchema, templateWrap], + [getTemplateSchemaByMode, insert, onCreateBlockSchema, setVisible, templateWrap], ); - const items = useCollectionDataSourceItems(componentType, filter, onlyCurrentDataSource); + const items = useCollectionDataSourceItems({ + componentName: componentType, + filter, + onlyCurrentDataSource, + showAssociationFields, + }); const getMenuItems = useGetSchemaInitializerMenuItems(onClick); const childItems = useMemo(() => { return getMenuItems(items, name); }, [getMenuItems, items, name]); const [openMenuKeys, setOpenMenuKeys] = useState([]); - const searchedChildren = useMenuSearch(childItems, openMenuKeys); - const compiledMenuItems = useMemo( - () => [ + const searchedChildren = useMenuSearch({ data: childItems, openKeys: openMenuKeys, hideSearch }); + const compiledMenuItems = useMemo(() => { + let children = searchedChildren.filter((item) => item.key !== 'search' && item.key !== 'empty'); + const hasAssociationField = children.some((item) => item.associationField); + if (!showChildren && !hasAssociationField && children.length === 1) { + // 只有一项可选时,直接展开 + children = children[0].children; + } else { + children = searchedChildren; + } + return [ { key: name, label: compile(title), @@ -317,11 +338,10 @@ export const DataBlockInitializer = (props: DataBlockInitializerProps) => { if (info.key !== name) return; onClick({ ...info, item: props }); }, - children: searchedChildren, + children, }, - ], - [name, compile, title, icon, childItems, onClick, props], - ); + ]; + }, [name, compile, title, icon, searchedChildren, onClick, props]); if (childItems.length > 1 || (childItems.length === 1 && childItems[0].children?.length > 0)) { return ( diff --git a/packages/core/client/src/schema-initializer/items/RecordAssociationBlockInitializer.tsx b/packages/core/client/src/schema-initializer/items/RecordAssociationBlockInitializer.tsx index 2f6ef29ee..2d6e0d5ff 100644 --- a/packages/core/client/src/schema-initializer/items/RecordAssociationBlockInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/RecordAssociationBlockInitializer.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useCallback } from 'react'; import { TableOutlined } from '@ant-design/icons'; import { useCollectionManager_deprecated } from '../../collection-manager'; @@ -6,6 +6,9 @@ import { useSchemaTemplateManager } from '../../schema-templates'; import { createTableBlockSchema, useRecordCollectionDataSourceItems } from '../utils'; import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../application'; +/** + * @deprecated + */ export const RecordAssociationBlockInitializer = () => { const itemConfig = useSchemaInitializerItem(); const { onCreateBlockSchema, componentType, createBlockSchema, ...others } = itemConfig; @@ -39,3 +42,27 @@ export const RecordAssociationBlockInitializer = () => { /> ); }; + +export function useCreateAssociationTableBlock() { + const { insert } = useSchemaInitializer(); + const { getCollection } = useCollectionManager_deprecated(); + + const createAssociationTableBlock = useCallback( + ({ item }) => { + const field = item.associationField; + const collection = getCollection(field.target); + + insert( + createTableBlockSchema({ + rowKey: collection.filterTargetKey, + collection: field.target, + dataSource: collection.dataSource, + association: `${field.collectionName}.${field.name}`, + }), + ); + }, + [getCollection, insert], + ); + + return { createAssociationTableBlock }; +} diff --git a/packages/core/client/src/schema-initializer/items/RecordAssociationDetailsBlockInitializer.tsx b/packages/core/client/src/schema-initializer/items/RecordAssociationDetailsBlockInitializer.tsx index d4e5ee200..ded2bf3cc 100644 --- a/packages/core/client/src/schema-initializer/items/RecordAssociationDetailsBlockInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/RecordAssociationDetailsBlockInitializer.tsx @@ -1,5 +1,5 @@ import { FormOutlined } from '@ant-design/icons'; -import React from 'react'; +import React, { useCallback } from 'react'; import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../application'; import { useCollectionManager_deprecated } from '../../collection-manager'; @@ -40,3 +40,28 @@ export const RecordAssociationDetailsBlockInitializer = () => { /> ); }; + +export function useCreateAssociationDetailsBlock() { + const { insert } = useSchemaInitializer(); + const { getCollection } = useCollectionManager_deprecated(); + + const createAssociationDetailsBlock = useCallback( + ({ item }) => { + const field = item.associationField; + const collection = getCollection(field.target); + + insert( + createDetailsBlockSchema({ + collection: field.target, + dataSource: collection.dataSource, + association: `${field.collectionName}.${field.name}`, + rowKey: collection.filterTargetKey || 'id', + settings: 'blockSettings:multiDataDetails', + }), + ); + }, + [getCollection, insert], + ); + + return { createAssociationDetailsBlock }; +} diff --git a/packages/core/client/src/schema-initializer/items/RecordAssociationFormBlockInitializer.tsx b/packages/core/client/src/schema-initializer/items/RecordAssociationFormBlockInitializer.tsx index 274f94941..9b73c2ae4 100644 --- a/packages/core/client/src/schema-initializer/items/RecordAssociationFormBlockInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/RecordAssociationFormBlockInitializer.tsx @@ -1,4 +1,4 @@ -import React, { useMemo } from 'react'; +import React, { useCallback, useMemo } from 'react'; import { FormOutlined } from '@ant-design/icons'; import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../application'; @@ -6,6 +6,9 @@ import { useSchemaTemplateManager } from '../../schema-templates'; import { createFormBlockSchema, useRecordCollectionDataSourceItems } from '../utils'; import { useCollectionManager_deprecated } from '../../collection-manager'; +/** + * @deprecated + */ export const RecordAssociationFormBlockInitializer = () => { const itemConfig = useSchemaInitializerItem(); const { onCreateBlockSchema, componentType, createBlockSchema, ...others } = itemConfig; @@ -27,7 +30,7 @@ export const RecordAssociationFormBlockInitializer = () => { : 'createForm:configureActions'; if (item.template) { - const s = await getTemplateSchemaByMode(item); + const template = await getTemplateSchemaByMode(item); if (item.template.componentName === 'FormItem') { const blockSchema = createFormBlockSchema({ collection: collectionName, @@ -38,7 +41,7 @@ export const RecordAssociationFormBlockInitializer = () => { useSourceId: '{{ useSourceIdFromParentRecord }}', useParams: '{{ useParamsFromRecord }}', actionInitializers, - template: s, + template: template, settings: 'blockSettings:createForm', }); if (item.mode === 'reference') { @@ -46,7 +49,7 @@ export const RecordAssociationFormBlockInitializer = () => { } insert(blockSchema); } else { - insert(s); + insert(template); } } else { insert( @@ -68,3 +71,67 @@ export const RecordAssociationFormBlockInitializer = () => { /> ); }; + +export function useCreateAssociationFormBlock() { + const { insert } = useSchemaInitializer(); + const { getCollection } = useCollectionManager_deprecated(); + + const createAssociationFormBlock = useCallback( + ({ item }) => { + const field = item.associationField; + const collection = getCollection(field.target); + const action = ['hasOne', 'belongsTo'].includes(field.type) ? 'get' : null; + const actionInitializers = ['hasOne', 'belongsTo'].includes(field.type) + ? 'editForm:configureActions' + : 'createForm:configureActions'; + + insert( + createFormBlockSchema({ + collection: field.target, + dataSource: collection.dataSource, + association: `${field.collectionName}.${field.name}`, + action, + useSourceId: '{{ useSourceIdFromParentRecord }}', + useParams: '{{ useParamsFromRecord }}', + actionInitializers, + settings: 'blockSettings:createForm', + }), + ); + }, + [getCollection, insert], + ); + + const templateWrap = useCallback( + (templateSchema, { item }) => { + const field = item.associationField; + const action = ['hasOne', 'belongsTo'].includes(field.type) ? 'get' : null; + const collection = getCollection(field.target); + const actionInitializers = ['hasOne', 'belongsTo'].includes(field.type) + ? 'editForm:configureActions' + : 'createForm:configureActions'; + + if (item.template.componentName === 'FormItem') { + const blockSchema = createFormBlockSchema({ + collection: field.target, + dataSource: collection.dataSource, + association: `${field.collectionName}.${field.name}`, + action, + useSourceId: '{{ useSourceIdFromParentRecord }}', + useParams: '{{ useParamsFromRecord }}', + actionInitializers, + template: templateSchema, + settings: 'blockSettings:createForm', + }); + if (item.mode === 'reference') { + blockSchema['x-template-key'] = item.template.key; + } + return blockSchema; + } else { + return templateSchema; + } + }, + [getCollection], + ); + + return { createAssociationFormBlock, templateWrap }; +} diff --git a/packages/core/client/src/schema-initializer/items/RecordAssociationGridCardBlockInitializer.tsx b/packages/core/client/src/schema-initializer/items/RecordAssociationGridCardBlockInitializer.tsx index 48942cc1b..eec7ef3d7 100644 --- a/packages/core/client/src/schema-initializer/items/RecordAssociationGridCardBlockInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/RecordAssociationGridCardBlockInitializer.tsx @@ -1,11 +1,14 @@ import { TableOutlined } from '@ant-design/icons'; -import React from 'react'; +import React, { useCallback } from 'react'; import { useCollectionManager_deprecated } from '../../collection-manager'; import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../application'; import { useSchemaTemplateManager } from '../../schema-templates'; import { createGridCardBlockSchema, useRecordCollectionDataSourceItems } from '../utils'; +/** + * @deprecated + */ export const RecordAssociationGridCardBlockInitializer = () => { const itemConfig = useSchemaInitializerItem(); const { onCreateBlockSchema, componentType, createBlockSchema, ...others } = itemConfig; @@ -41,3 +44,28 @@ export const RecordAssociationGridCardBlockInitializer = () => { /> ); }; + +export function useCreateAssociationGridCardBlock() { + const { insert } = useSchemaInitializer(); + const { getCollection } = useCollectionManager_deprecated(); + + const createAssociationGridCardBlock = useCallback( + ({ item }) => { + const field = item.associationField; + const collection = getCollection(field.target); + + insert( + createGridCardBlockSchema({ + rowKey: collection.filterTargetKey, + collection: field.target, + dataSource: collection.dataSource, + association: `${field.collectionName}.${field.name}`, + settings: 'blockSettings:gridCard', + }), + ); + }, + [getCollection, insert], + ); + + return { createAssociationGridCardBlock }; +} diff --git a/packages/core/client/src/schema-initializer/items/RecordAssociationListBlockInitializer.tsx b/packages/core/client/src/schema-initializer/items/RecordAssociationListBlockInitializer.tsx index 4dc50011e..444841954 100644 --- a/packages/core/client/src/schema-initializer/items/RecordAssociationListBlockInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/RecordAssociationListBlockInitializer.tsx @@ -1,5 +1,5 @@ import { TableOutlined } from '@ant-design/icons'; -import React from 'react'; +import React, { useCallback } from 'react'; import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../application'; import { useCollectionManager_deprecated } from '../../collection-manager'; @@ -41,3 +41,28 @@ export const RecordAssociationListBlockInitializer = () => { /> ); }; + +export function useCreateAssociationListBlock() { + const { insert } = useSchemaInitializer(); + const { getCollection } = useCollectionManager_deprecated(); + + const createAssociationListBlock = useCallback( + ({ item }) => { + const field = item.associationField; + const collection = getCollection(field.target); + + insert( + createListBlockSchema({ + rowKey: collection.filterTargetKey, + collection: field.target, + dataSource: collection.dataSource, + association: `${field.collectionName}.${field.name}`, + settings: 'blockSettings:list', + }), + ); + }, + [getCollection, insert], + ); + + return { createAssociationListBlock }; +} diff --git a/packages/core/client/src/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.tsx b/packages/core/client/src/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.tsx index 83b662f17..936fdc08f 100644 --- a/packages/core/client/src/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.tsx @@ -1,12 +1,15 @@ import { FormOutlined } from '@ant-design/icons'; -import React from 'react'; +import React, { useCallback } from 'react'; import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../application'; import { useBlockRequestContext } from '../../block-provider'; import { useSchemaTemplateManager } from '../../schema-templates'; -import { createReadPrettyFormBlockSchema, useRecordCollectionDataSourceItems } from '../utils'; +import { createDetailsBlockSchema, useRecordCollectionDataSourceItems } from '../utils'; import { useCollectionManager_deprecated } from '../../collection-manager'; +/** + * @deprecated + */ export const RecordReadPrettyAssociationFormBlockInitializer = () => { const itemConfig = useSchemaInitializerItem(); const { onCreateBlockSchema, componentType, createBlockSchema, ...others } = itemConfig; @@ -30,7 +33,7 @@ export const RecordReadPrettyAssociationFormBlockInitializer = () => { if (item.template) { const s = await getTemplateSchemaByMode(item); if (item.template.componentName === 'ReadPrettyFormItem') { - const blockSchema = createReadPrettyFormBlockSchema({ + const blockSchema = createDetailsBlockSchema({ actionInitializers, collection: collectionName, dataSource: collection.dataSource, @@ -51,7 +54,7 @@ export const RecordReadPrettyAssociationFormBlockInitializer = () => { } } else { insert( - createReadPrettyFormBlockSchema({ + createDetailsBlockSchema({ actionInitializers, collection: collectionName, resource, @@ -69,3 +72,61 @@ export const RecordReadPrettyAssociationFormBlockInitializer = () => { /> ); }; + +export function useCreateAssociationDetailsWithoutPagination() { + const { insert } = useSchemaInitializer(); + const { getCollection } = useCollectionManager_deprecated(); + const { block } = useBlockRequestContext(); + const actionInitializers = block !== 'TableField' ? 'details:configureActions' : null; + + const createAssociationDetailsWithoutPagination = useCallback( + ({ item }) => { + const field = item.associationField; + const collection = getCollection(field.target); + + insert( + createDetailsBlockSchema({ + actionInitializers, + collection: field.target, + dataSource: collection.dataSource, + association: `${field.collectionName}.${field.name}`, + action: 'get', + useSourceId: '{{ useSourceIdFromParentRecord }}', + useParams: '{{ useParamsFromRecord }}', + settings: 'blockSettings:singleDataDetails', + }), + ); + }, + [actionInitializers, getCollection, insert], + ); + + const templateWrap = useCallback( + (templateSchema, { item }) => { + const field = item.associationField; + const collection = getCollection(field.target); + + if (item.template.componentName === 'ReadPrettyFormItem') { + const blockSchema = createDetailsBlockSchema({ + actionInitializers, + collection: field.target, + dataSource: collection.dataSource, + association: `${field.collectionName}.${field.name}`, + action: 'get', + useSourceId: '{{ useSourceIdFromParentRecord }}', + useParams: '{{ useParamsFromRecord }}', + template: templateSchema, + settings: 'blockSettings:singleDataDetails', + }); + if (item.mode === 'reference') { + blockSchema['x-template-key'] = item.template.key; + } + return blockSchema; + } else { + return templateSchema; + } + }, + [actionInitializers, getCollection], + ); + + return { createAssociationDetailsWithoutPagination, templateWrap }; +} diff --git a/packages/core/client/src/schema-initializer/utils.ts b/packages/core/client/src/schema-initializer/utils.ts index 34411a58e..913780650 100644 --- a/packages/core/client/src/schema-initializer/utils.ts +++ b/packages/core/client/src/schema-initializer/utils.ts @@ -3,14 +3,21 @@ import { ISchema, Schema, useFieldSchema, useForm } from '@formily/react'; import { uid } from '@formily/shared'; import { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; -import { SchemaInitializerItemType, useDataSourceKey, useFormActiveFields, useFormBlockContext } from '../'; +import { + SchemaInitializerItemType, + useCollection, + useCollectionManager, + useDataSourceKey, + useFormActiveFields, + useFormBlockContext, +} from '../'; import { FieldOptions, useCollection_deprecated, useCollectionManager_deprecated } from '../collection-manager'; import { isAssocField } from '../filter-provider/utils'; -import { useActionContext, useDesignable } from '../schema-component'; +import { useActionContext, useCompile, useDesignable } from '../schema-component'; import { useSchemaTemplateManager } from '../schema-templates'; -import { Collection } from '../data-source/collection/Collection'; +import { Collection, CollectionFieldOptions } from '../data-source/collection/Collection'; import { useDataSourceManager } from '../data-source/data-source/DataSourceManagerProvider'; -import { DataSourceManager } from '../data-source/data-source/DataSourceManager'; +import _ from 'lodash'; export const itemsMerge = (items1) => { return items1; @@ -750,6 +757,10 @@ export const useCurrentSchema = (action: string, key: string, find = findSchema, }; }; +/** + * @deprecated + * 待统一区块的创建之后,将废弃该方法 + */ export const useRecordCollectionDataSourceItems = ( componentName, item = null, @@ -822,15 +833,29 @@ export const useRecordCollectionDataSourceItems = ( ]; }; -export const useCollectionDataSourceItems = ( +export const useCollectionDataSourceItems = ({ componentName, - filter: (collection: Collection) => boolean = () => true, + filter = () => true, onlyCurrentDataSource = false, -) => { + showAssociationFields, +}: { + componentName; + filter?: (options: { collection?: Collection; associationField?: CollectionFieldOptions }) => boolean; + onlyCurrentDataSource?: boolean; + showAssociationFields?: boolean; +}) => { const { t } = useTranslation(); const dm = useDataSourceManager(); const dataSourceKey = useDataSourceKey(); - let allCollections = dm.getAllCollections(filter); + const collection = useCollection(); + const associationFields = useAssociationFields({ componentName, filterCollections: filter, showAssociationFields }); + + let allCollections = dm.getAllCollections((collection) => { + if (onlyCurrentDataSource && collection.dataSource !== dataSourceKey) { + return false; + } + return filter({ collection }); + }); if (onlyCurrentDataSource) { allCollections = allCollections.filter((collection) => collection.key === dataSourceKey); } @@ -841,16 +866,23 @@ export const useCollectionDataSourceItems = ( name: key, label: displayName, type: 'subMenu', - children: getChildren({ - collections, - componentName, - searchValue: '', - dataSource: key, - getTemplatesByCollection, - t, - }), + children: [ + ...getChildren({ + collections, + componentName, + searchValue: '', + dataSource: key, + getTemplatesByCollection, + t, + }).sort((item) => { + // fix https://nocobase.height.app/T-3551 + const inherits = _.toArray(collection?.inherits || []); + if (item.name === collection?.name || inherits.some((inheritName) => inheritName === item.name)) return -1; + }), + ...associationFields, + ], })); - }, [allCollections, componentName, dm, getTemplatesByCollection, t]); + }, [allCollections, associationFields, componentName, getTemplatesByCollection, t]); return res; }; @@ -862,27 +894,29 @@ export const createDetailsBlockSchema = (options) => { collection, dataSource, association, - resource, template, settings, + action = 'list', ...others } = options; - const resourceName = resource || association || collection; + const resourceName = association || collection; const schema: ISchema = { type: 'void', - 'x-acl-action': `${resourceName}:view`, + 'x-acl-action': action === 'get' ? `${resourceName}:get` : `${resourceName}:view`, 'x-decorator': 'DetailsBlockProvider', 'x-decorator-props': { - resource: resourceName, dataSource, collection, association, readPretty: true, - action: 'list', - params: { - pageSize: 1, - }, - // useParams: '{{ useParamsFromRecord }}', + action, + ...(action === 'list' + ? { + params: { + pageSize: 1, + }, + } + : {}), ...others, }, 'x-toolbar': 'BlockSchemaToolbar', @@ -914,13 +948,17 @@ export const createDetailsBlockSchema = (options) => { 'x-initializer': formItemInitializers, properties: {}, }, - pagination: { - type: 'void', - 'x-component': 'Pagination', - 'x-component-props': { - useProps: '{{ useDetailsPaginationProps }}', - }, - }, + ...(action === 'list' + ? { + pagination: { + type: 'void', + 'x-component': 'Pagination', + 'x-component-props': { + useProps: '{{ useDetailsPaginationProps }}', + }, + }, + } + : {}), }, }, }, @@ -936,18 +974,16 @@ export const createListBlockSchema = (options) => { collection, dataSource, association, - resource, template, settings, ...others } = options; - const resourceName = resource || association || collection; + const resourceName = association || collection; const schema: ISchema = { type: 'void', 'x-acl-action': `${resourceName}:view`, 'x-decorator': 'List.Decorator', 'x-decorator-props': { - resource: resourceName, collection, dataSource, association, @@ -1025,19 +1061,17 @@ export const createGridCardBlockSchema = (options) => { itemActionInitializers = 'gridCard:configureItemActions', collection, association, - resource, template, dataSource, settings, ...others } = options; - const resourceName = resource || association || collection; + const resourceName = association || collection; const schema: ISchema = { type: 'void', 'x-acl-action': `${resourceName}:view`, 'x-decorator': 'GridCard.Decorator', 'x-decorator-props': { - resource: resourceName, collection, association, dataSource, @@ -1248,6 +1282,12 @@ export const createFilterFormBlockSchema = (options) => { return schema; }; +/** + * @deprecated + * 已弃用,可以使用 createDetailsBlockSchema 替换 + * @param options + * @returns + */ export const createReadPrettyFormBlockSchema = (options) => { const { formItemInitializers = 'details:configureFields', @@ -1315,7 +1355,6 @@ export const createReadPrettyFormBlockSchema = (options) => { export const createTableBlockSchema = (options) => { const { collection, - resource, rowKey, tableActionInitializers, tableColumnInitializers, @@ -1330,11 +1369,10 @@ export const createTableBlockSchema = (options) => { const schema: ISchema = { type: 'void', 'x-decorator': tableBlockProvider ?? 'TableBlockProvider', - 'x-acl-action': `${resource || collection}:list`, + 'x-acl-action': `${collection}:list`, 'x-decorator-props': { collection, dataSource, - resource: resource || collection, action: 'list', params: { pageSize, @@ -1526,7 +1564,9 @@ const getChildren = ({ return ( componentName && template.componentName === componentName && - (!template.resourceName || template.resourceName === item.name) + (['FormItem', 'ReadPrettyFormItem'].includes(componentName) || + !template.resourceName || + template.resourceName === item.name) ); }); if (!templates.length) { @@ -1560,8 +1600,9 @@ const getChildren = ({ dataSource, title: t('Duplicate template'), children: templates.map((template) => { - const templateName = - template?.componentName === 'FormItem' ? `${template?.name} ${t('(Fields only)')}` : template?.name; + const templateName = ['FormItem', 'ReadPrettyFormItem'].includes(template?.componentName) + ? `${template?.name} ${t('(Fields only)')}` + : template?.name; return { type: 'item', mode: 'copy', @@ -1579,8 +1620,9 @@ const getChildren = ({ dataSource, title: t('Reference template'), children: templates.map((template) => { - const templateName = - template?.componentName === 'FormItem' ? `${template?.name} ${t('(Fields only)')}` : template?.name; + const templateName = ['FormItem', 'ReadPrettyFormItem'].includes(template?.componentName) + ? `${template?.name} ${t('(Fields only)')}` + : template?.name; return { type: 'item', mode: 'reference', @@ -1595,3 +1637,142 @@ const getChildren = ({ }; }); }; + +function useAssociationFields({ + componentName, + filterCollections, + showAssociationFields, +}: { + componentName: string; + filterCollections: (options: { collection?: Collection; associationField?: CollectionFieldOptions }) => boolean; + showAssociationFields?: boolean; +}) { + const fieldSchema = useFieldSchema(); + const { getCollectionFields } = useCollectionManager_deprecated(); + const collection = useCollection_deprecated(); + const cm = useCollectionManager(); + const dataSource = useDataSourceKey(); + const { getTemplatesByCollection } = useSchemaTemplateManager(); + const { t } = useTranslation(); + const compile = useCompile(); + + return useMemo(() => { + if (!showAssociationFields) { + return []; + } + + let fields: CollectionFieldOptions[] = []; + + if (fieldSchema['x-initializer']) { + fields = collection.fields; + } else { + const collection = recursiveParent(fieldSchema.parent); + if (collection) { + fields = getCollectionFields(collection); + } + } + + return fields + .filter((field) => ['linkTo', 'subTable', 'o2m', 'm2m', 'obo', 'oho', 'o2o', 'm2o'].includes(field.interface)) + .filter((field) => filterCollections({ associationField: field })) + .map((field, index) => { + const targetCollection = cm.getCollection(field.target); + const title = `${compile(field.uiSchema.title || field.name)} -> ${compile(targetCollection.title)}`; + const templates = getTemplatesByCollection(dataSource, field.target).filter((template) => { + return ( + componentName && + template.componentName === componentName && + (['FormItem', 'ReadPrettyFormItem'].includes(componentName) || + !template.resourceName || + template.resourceName === `${field.collectionName}.${field.name}`) + ); + }); + if (!templates.length) { + return { + type: 'item', + name: `${field.collectionName}.${field.name}`, + collectionName: field.target, + title, + dataSource, + associationField: field, + }; + } + return { + key: `${componentName}_table_subMenu_${index}`, + type: 'subMenu', + name: `${field.target}_${index}`, + title, + dataSource, + children: [ + { + type: 'item', + name: `${field.collectionName}.${field.name}`, + collectionName: field.target, + dataSource, + title: t('Blank block'), + associationField: field, + }, + { + type: 'divider', + }, + { + key: `${componentName}_table_subMenu_${index}_copy`, + type: 'subMenu', + name: 'copy', + dataSource, + title: t('Duplicate template'), + children: templates.map((template) => { + const templateName = ['FormItem', 'ReadPrettyFormItem'].includes(template?.componentName) + ? `${template?.name} ${t('(Fields only)')}` + : template?.name; + return { + type: 'item', + mode: 'copy', + name: `${field.collectionName}.${field.name}`, + collectionName: field.target, + template, + dataSource, + title: templateName || t('Untitled'), + associationField: field, + }; + }), + }, + { + key: `${componentName}_table_subMenu_${index}_ref`, + type: 'subMenu', + name: 'ref', + dataSource, + title: t('Reference template'), + children: templates.map((template) => { + const templateName = ['FormItem', 'ReadPrettyFormItem'].includes(template?.componentName) + ? `${template?.name} ${t('(Fields only)')}` + : template?.name; + return { + type: 'item', + mode: 'reference', + name: `${field.collectionName}.${field.name}`, + collectionName: field.target, + template, + dataSource, + title: templateName || t('Untitled'), + associationField: field, + }; + }), + }, + ], + }; + }); + }, [ + cm, + collection.fields, + compile, + componentName, + dataSource, + fieldSchema, + filterCollections, + getCollectionFields, + getTemplatesByCollection, + showAssociationFields, + t, + ]); +} diff --git a/packages/plugins/@nocobase/plugin-calendar/src/client/index.tsx b/packages/plugins/@nocobase/plugin-calendar/src/client/index.tsx index de7d6fbd1..49e4680f0 100644 --- a/packages/plugins/@nocobase/plugin-calendar/src/client/index.tsx +++ b/packages/plugins/@nocobase/plugin-calendar/src/client/index.tsx @@ -1,4 +1,4 @@ -import { Plugin } from '@nocobase/client'; +import { Plugin, canMakeAssociationBlock, useCollection } from '@nocobase/client'; import { generateNTemplate } from '../locale'; import { CalendarV2 } from './calendar'; import { calendarBlockSettings } from './calendar/Calender.Settings'; @@ -10,7 +10,12 @@ import { calendarActionInitializers, deleteEventActionInitializer, } from './schema-initializer/initializers'; -import { CalendarBlockInitializer, RecordAssociationCalendarBlockInitializer } from './schema-initializer/items'; +import { + CalendarBlockInitializer, + RecordAssociationCalendarBlockInitializer, + useCreateAssociationCalendarBlock, +} from './schema-initializer/items'; +import { useMemo } from 'react'; export class PluginCalendarClient extends Plugin { async load() { @@ -19,9 +24,39 @@ export class PluginCalendarClient extends Plugin { title: generateNTemplate('Calendar'), Component: 'CalendarBlockInitializer', }); + this.app.schemaInitializerManager.addItem('popup:common:addBlock', 'dataBlocks.calendar', { + title: generateNTemplate('Calendar'), + Component: 'CalendarBlockInitializer', + useVisible() { + const collection = useCollection(); + return useMemo( + () => + collection.fields.some( + (field) => canMakeAssociationBlock(field) && ['hasMany', 'belongsToMany'].includes(field.type), + ), + [collection.fields], + ); + }, + useComponentProps() { + const { createAssociationCalendarBlock } = useCreateAssociationCalendarBlock(); + + return { + onlyCurrentDataSource: true, + filterCollections({ associationField }) { + if (associationField) { + return ['hasMany', 'belongsToMany'].includes(associationField.type); + } + return false; + }, + createBlockSchema: createAssociationCalendarBlock, + showAssociationFields: true, + }; + }, + }); + this.app.addComponents({ CalendarBlockProvider, - CalendarBlockInitializer, + CalendarBlockInitializer: CalendarBlockInitializer as any, RecordAssociationCalendarBlockInitializer, CalendarV2, }); diff --git a/packages/plugins/@nocobase/plugin-calendar/src/client/schema-initializer/items/CalendarBlockInitializer.tsx b/packages/plugins/@nocobase/plugin-calendar/src/client/schema-initializer/items/CalendarBlockInitializer.tsx index 9c4d2dfb3..8995f0e4a 100644 --- a/packages/plugins/@nocobase/plugin-calendar/src/client/schema-initializer/items/CalendarBlockInitializer.tsx +++ b/packages/plugins/@nocobase/plugin-calendar/src/client/schema-initializer/items/CalendarBlockInitializer.tsx @@ -2,6 +2,8 @@ import { FormOutlined } from '@ant-design/icons'; import { FormLayout } from '@formily/antd-v5'; import { SchemaOptionsContext } from '@formily/react'; import { + Collection, + CollectionFieldOptions, DataBlockInitializer, FormDialog, SchemaComponent, @@ -15,7 +17,19 @@ import React, { useContext } from 'react'; import { createCalendarBlockSchema } from '../utils'; import { useTranslation } from '../../../locale'; -export const CalendarBlockInitializer = () => { +export const CalendarBlockInitializer = ({ + filterCollections, + onlyCurrentDataSource, + hideSearch, + createBlockSchema, + showAssociationFields, +}: { + filterCollections: (options: { collection?: Collection; associationField?: CollectionFieldOptions }) => boolean; + onlyCurrentDataSource: boolean; + hideSearch?: boolean; + createBlockSchema?: (options: any) => any; + showAssociationFields?: boolean; +}) => { const { insert } = useSchemaInitializer(); const { t } = useTranslation(); const { getCollectionField, getCollectionFieldsOptions } = useCollectionManager_deprecated(); @@ -29,6 +43,10 @@ export const CalendarBlockInitializer = () => { componentType={'Calendar'} icon={} onCreateBlockSchema={async ({ item }) => { + if (createBlockSchema) { + return createBlockSchema({ item }); + } + const stringFieldsOptions = getCollectionFieldsOptions(item.name, 'string', { dataSource: item.dataSource }); const dateFieldsOptions = getCollectionFieldsOptions(item.name, 'date', { association: ['o2o', 'obo', 'oho', 'm2o'], @@ -87,6 +105,10 @@ export const CalendarBlockInitializer = () => { }), ); }} + onlyCurrentDataSource={onlyCurrentDataSource} + hideSearch={hideSearch} + filter={filterCollections} + showAssociationFields={showAssociationFields} /> ); }; diff --git a/packages/plugins/@nocobase/plugin-calendar/src/client/schema-initializer/items/RecordAssociationCalendarBlockInitializer.tsx b/packages/plugins/@nocobase/plugin-calendar/src/client/schema-initializer/items/RecordAssociationCalendarBlockInitializer.tsx index f7b357bf9..6a2b20ec7 100644 --- a/packages/plugins/@nocobase/plugin-calendar/src/client/schema-initializer/items/RecordAssociationCalendarBlockInitializer.tsx +++ b/packages/plugins/@nocobase/plugin-calendar/src/client/schema-initializer/items/RecordAssociationCalendarBlockInitializer.tsx @@ -113,3 +113,86 @@ export const RecordAssociationCalendarBlockInitializer = () => { /> ); }; + +export function useCreateAssociationCalendarBlock() { + const { insert } = useSchemaInitializer(); + const { getCollection } = useCollectionManager_deprecated(); + const { t } = useTranslation(); + const options = useContext(SchemaOptionsContext); + const { theme } = useGlobalTheme(); + + const createAssociationCalendarBlock = async ({ item }) => { + const field = item.associationField; + const collection = getCollection(field.target); + + const stringFields = collection?.fields + ?.filter((field) => field.type === 'string') + ?.map((field) => { + return { + label: field?.uiSchema?.title, + value: field.name, + }; + }); + const dateFields = collection?.fields + ?.filter((field) => field.type === 'date') + ?.map((field) => { + return { + label: field?.uiSchema?.title, + value: field.name, + }; + }); + const values = await FormDialog( + t('Create calendar block'), + () => { + return ( + + + + + + ); + }, + theme, + ).open({ + initialValues: {}, + }); + insert( + createCalendarBlockSchema({ + collection: field.target, + association: `${field.collectionName}.${field.name}`, + fieldNames: { + ...values, + }, + settings: 'blockSettings:calendar', + }), + ); + }; + + return { createAssociationCalendarBlock }; +} diff --git a/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/manyToOne/templatesOfBug.ts b/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/manyToOne/templatesOfBug.ts index 1ddc7b732..5e9fa3af1 100644 --- a/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/manyToOne/templatesOfBug.ts +++ b/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/manyToOne/templatesOfBug.ts @@ -13,7 +13,7 @@ export const T3377: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'BlockInitializers', + 'x-initializer': 'page:addBlock', properties: { dtuo84w9hyg: { _isJSONSchemaObject: true, @@ -60,7 +60,7 @@ export const T3377: PageConfig = { version: '2.0', type: 'void', 'x-component': 'Grid', - 'x-initializer': 'FormItemInitializers', + 'x-initializer': 'form:configureFields', properties: { '729znsrntep': { _isJSONSchemaObject: true, @@ -98,7 +98,7 @@ export const T3377: PageConfig = { version: '2.0', type: 'void', 'x-component': 'AssociationField.SubTable', - 'x-initializer': 'TableColumnInitializers', + 'x-initializer': 'table:configureColumns', 'x-initializer-props': { action: false, }, diff --git a/packages/plugins/@nocobase/plugin-workflow-action-trigger/src/client/index.ts b/packages/plugins/@nocobase/plugin-workflow-action-trigger/src/client/index.ts index 53af3ba02..e629579b3 100644 --- a/packages/plugins/@nocobase/plugin-workflow-action-trigger/src/client/index.ts +++ b/packages/plugins/@nocobase/plugin-workflow-action-trigger/src/client/index.ts @@ -76,25 +76,25 @@ export default class extends Plugin { const FormActionInitializers = this.app.schemaInitializerManager.get('FormActionInitializers'); FormActionInitializers.add('customize.submitToWorkflow', submitToWorkflowActionInitializer); - const CreateFormActionInitializers = this.app.schemaInitializerManager.get('CreateFormActionInitializers'); + const CreateFormActionInitializers = this.app.schemaInitializerManager.get('createForm:configureActions'); CreateFormActionInitializers.add('customize.submitToWorkflow', submitToWorkflowActionInitializer); - const UpdateFormActionInitializers = this.app.schemaInitializerManager.get('UpdateFormActionInitializers'); + const UpdateFormActionInitializers = this.app.schemaInitializerManager.get('editForm:configureActions'); UpdateFormActionInitializers.add('customize.submitToWorkflow', submitToWorkflowActionInitializer); - const DetailsActionInitializers = this.app.schemaInitializerManager.get('DetailsActionInitializers'); + const DetailsActionInitializers = this.app.schemaInitializerManager.get('detailsWithPaging:configureActions'); DetailsActionInitializers.add('customize.submitToWorkflow', recordTriggerWorkflowActionInitializer); - const ReadPrettyFormActionInitializers = this.app.schemaInitializerManager.get('ReadPrettyFormActionInitializers'); + const ReadPrettyFormActionInitializers = this.app.schemaInitializerManager.get('details:configureActions'); ReadPrettyFormActionInitializers.add('customize.submitToWorkflow', recordTriggerWorkflowActionInitializer); - const TableActionColumnInitializers = this.app.schemaInitializerManager.get('TableActionColumnInitializers'); + const TableActionColumnInitializers = this.app.schemaInitializerManager.get('table:configureItemActions'); TableActionColumnInitializers.add('customize.submitToWorkflow', recordTriggerWorkflowActionLinkInitializer); - const GridCardItemActionInitializers = this.app.schemaInitializerManager.get('GridCardItemActionInitializers'); + const GridCardItemActionInitializers = this.app.schemaInitializerManager.get('gridCard:configureItemActions'); GridCardItemActionInitializers.add('customize.submitToWorkflow', recordTriggerWorkflowActionLinkInitializer); - const ListItemActionInitializers = this.app.schemaInitializerManager.get('ListItemActionInitializers'); + const ListItemActionInitializers = this.app.schemaInitializerManager.get('list:configureItemActions'); ListItemActionInitializers.add('customize.submitToWorkflow', recordTriggerWorkflowActionLinkInitializer); } } diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/forms/create.tsx b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/forms/create.tsx index 86284b5ef..113193eeb 100644 --- a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/forms/create.tsx +++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/forms/create.tsx @@ -65,7 +65,7 @@ export default { [allCollections], ); const [openMenuKeys, setOpenMenuKeys] = useState([]); - const searchedChildren = useMenuSearch(childItems, openMenuKeys); + const searchedChildren = useMenuSearch({ data: childItems, openKeys: openMenuKeys }); return { name: 'createRecordForm', diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/forms/update.tsx b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/forms/update.tsx index 0db045c25..20443e907 100644 --- a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/forms/update.tsx +++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/forms/update.tsx @@ -101,7 +101,7 @@ export default { [allCollections], ); const [openMenuKeys, setOpenMenuKeys] = useState([]); - const searchedChildren = useMenuSearch(childItems, openMenuKeys); + const searchedChildren = useMenuSearch({ data: childItems, openKeys: openMenuKeys }); return { name: 'updateRecordForm', key: 'updateRecordForm', From 032352985bac4dd34e0af9a1f15d68dc1a7777e9 Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Thu, 14 Mar 2024 21:51:48 +0800 Subject: [PATCH 15/15] refactor: view collection set name as default title when title is missing (#3719) --- .../templates/components/PreviewFields.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/core/client/src/collection-manager/templates/components/PreviewFields.tsx b/packages/core/client/src/collection-manager/templates/components/PreviewFields.tsx index b3b71c560..9a2209167 100644 --- a/packages/core/client/src/collection-manager/templates/components/PreviewFields.tsx +++ b/packages/core/client/src/collection-manager/templates/components/PreviewFields.tsx @@ -84,10 +84,16 @@ const PreviewCom = (props) => { const fieldsData = Object.values(data?.data?.fields)?.map((v: any) => { if (v.source) { const option = fields?.data.find((h) => h.name === v.name) || v; - return { ...v, uiSchema: omit(option.uiSchema, 'rawTitle') }; + return { + ...v, + uiSchema: { ...omit(option.uiSchema, 'rawTitle'), title: option.uiSchema?.title || option.name }, + }; } else { const option = fields?.data.find((h) => h.name === v.name) || v; - return { ...option, uiSchema: omit(option.uiSchema, 'rawTitle') }; + return { + ...option, + uiSchema: { ...omit(option.uiSchema, 'rawTitle'), title: option.uiSchema?.title || option.name }, + }; } }); field.value = fieldsData;