From def7530d149bfc5f4e6a16c2cca4f6ab64d56a53 Mon Sep 17 00:00:00 2001 From: Zeke Zhang <958414905@qq.com> Date: Sat, 27 Apr 2024 14:06:42 +0800 Subject: [PATCH] chore: add e2e (#4184) * test: schemaInitializer of map * test: settings of map block * refactor: extract common options * chore: test filter blocks in page * chore: test filter block in popup * chore: add e2e for inherit fields * chore: attachement field * chore: file block * chore: should use beforEach instead of beforAll * chore: make e2e pass * chore: only run map e2e * Revert "chore: only run map e2e" This reverts commit fbdae1a5733e38d0d29f8084019ca44b671d1032. --- .../src/common/useFieldComponentName.tsx | 2 +- .../form-create/schemaInitializer.test.ts | 18 +- .../__e2e__/form-create/templatesOfBug.ts | 143 ++ .../__e2e__/schemaInitializer.test.ts | 24 +- .../grid-card/__e2e__/templatesOfBug.ts | 177 ++ .../table/TableColumnInitializers.tsx | 73 +- .../table/__e2e__/schemaInitializer.test.ts | 16 +- .../table/__e2e__/templatesOfBug.ts | 174 ++ .../__e2e__/schemaInitializer.test.ts | 197 ++ .../__e2e__/schemaSettings.test.ts | 0 .../blocks/filter-blocks/__e2e__/templates.ts | 2171 +++++++++++++++++ .../form/__e2e__/schemaInitializer.test.ts | 21 +- .../form/__e2e__/templatesOfBug.ts | 141 ++ .../previewComponentFieldSettings.tsx | 50 + ...uploadAttachmentComponentFieldSettings.tsx | 6 +- .../antd/form-item/FormItem.Settings.tsx | 5 +- .../buttons/RecordBlockInitializers.tsx | 141 +- .../client/src/schema-initializer/utils.ts | 6 +- .../schema-settings/SchemaSettingsPlugin.ts | 2 + packages/core/test/src/e2e/e2eUtils.ts | 8 +- .../fields/attachment/schemaSettings.test.ts | 1 + .../src/client/__e2e__/block.test.ts | 678 +++++ .../client/__e2e__/schemaInitializer.test.ts | 50 + .../src/client/__e2e__/schemaSettings.test.ts | 52 + .../src/client/__e2e__/templates.ts | 511 ++++ 25 files changed, 4461 insertions(+), 206 deletions(-) create mode 100644 packages/core/client/src/modules/blocks/filter-blocks/__e2e__/schemaInitializer.test.ts create mode 100644 packages/core/client/src/modules/blocks/filter-blocks/__e2e__/schemaSettings.test.ts create mode 100644 packages/core/client/src/modules/blocks/filter-blocks/__e2e__/templates.ts create mode 100644 packages/core/client/src/modules/fields/component/FileManager/previewComponentFieldSettings.tsx create mode 100644 packages/plugins/@nocobase/plugin-file-manager/src/client/__e2e__/block.test.ts create mode 100644 packages/plugins/@nocobase/plugin-map/src/client/__e2e__/schemaInitializer.test.ts create mode 100644 packages/plugins/@nocobase/plugin-map/src/client/__e2e__/schemaSettings.test.ts create mode 100644 packages/plugins/@nocobase/plugin-map/src/client/__e2e__/templates.ts diff --git a/packages/core/client/src/common/useFieldComponentName.tsx b/packages/core/client/src/common/useFieldComponentName.tsx index 61b5edf926..cdb05c506a 100644 --- a/packages/core/client/src/common/useFieldComponentName.tsx +++ b/packages/core/client/src/common/useFieldComponentName.tsx @@ -1,8 +1,8 @@ import { Field } from '@formily/core'; import { useField, useFieldSchema } from '@formily/react'; +import { useCollectionField } from '../data-source/collection-field/CollectionFieldProvider'; import { useIsFileField } from '../schema-component/antd/form-item/FormItem.Settings'; import { useColumnSchema } from '../schema-component/antd/table-v2/Table.Column.Decorator'; -import { useCollectionField } from '../data-source/collection-field/CollectionFieldProvider'; export function useFieldComponentName(): string { const { fieldSchema: tableColumnSchema, collectionField: tableColumnField } = useColumnSchema(); 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 fcece0f2e8..c37523c8f2 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 @@ -1,7 +1,7 @@ import { uid } from '@formily/shared'; import { createBlockInPage, expect, oneEmptyForm, test } from '@nocobase/test/e2e'; import { oneEmptyTableWithUsers } from '../../../details-multi/__e2e__/templatesOfBug'; -import { T3106, T3469 } from './templatesOfBug'; +import { T3106, T3469, oneFormWithInheritFields } from './templatesOfBug'; test.describe('where creation form block can be added', () => { test('page', async ({ page, mockPage }) => { @@ -77,7 +77,21 @@ test.describe('configure fields', () => { await expect(page.getByLabel('block-item-Markdown.Void-general-form')).toBeVisible(); }); - test.pgOnly('display inherit fields', async ({ page, mockPage }) => {}); + test.pgOnly('display inherit fields', async ({ page, mockPage }) => { + await mockPage(oneFormWithInheritFields).goto(); + + // 在表单中选择继承的字段 + await page.getByLabel('schema-initializer-Grid-form:').hover(); + await page.getByRole('menuitem', { name: 'parentField1' }).click(); + await page.getByRole('menuitem', { name: 'parentField2' }).click(); + await page.mouse.move(300, 0); + await expect( + page.getByLabel('block-item-CollectionField-child-form-child.parentField1-parentField1').getByRole('textbox'), + ).toBeVisible(); + await expect( + page.getByLabel('block-item-CollectionField-child-form-child.parentField2-parentField2').getByRole('textbox'), + ).toBeVisible(); + }); }); test.describe('configure actions', () => { 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 936a84bcf6..b1eaef81da 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 @@ -9173,3 +9173,146 @@ export const oneFormAndOneTableWithUsers: PageConfig = { 'x-async': true, }, }; +export const oneFormWithInheritFields = { + collections: [ + { + name: 'parent', + fields: [ + { + name: 'parentField1', + interface: 'input', + }, + { + name: 'parentField2', + interface: 'input', + }, + ], + }, + { + name: 'child', + fields: [ + { + name: 'childField1', + interface: 'input', + }, + { + name: 'childField2', + interface: 'input', + }, + ], + inherits: ['parent'], + }, + ], + pageSchema: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Page', + properties: { + '79kw0s9hd2t': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'page:addBlock', + properties: { + '736hw3rfbbo': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + properties: { + thsaywe90f0: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + properties: { + e1wo8fptwxq: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-acl-action-props': { + skipScopeCheck: true, + }, + 'x-acl-action': 'child:create', + 'x-decorator': 'FormBlockProvider', + 'x-use-decorator-props': 'useCreateFormBlockDecoratorProps', + 'x-decorator-props': { + dataSource: 'main', + collection: 'child', + }, + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:createForm', + 'x-component': 'CardItem', + 'x-app-version': '0.21.0-alpha.15', + properties: { + '8f3ol7eyevs': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'FormV2', + 'x-use-component-props': 'useCreateFormBlockProps', + 'x-app-version': '0.21.0-alpha.15', + properties: { + grid: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'form:configureFields', + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'hpydlgpgdyp', + 'x-async': false, + 'x-index': 1, + }, + lmexf0nzjgb: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-initializer': 'createForm:configureActions', + 'x-component': 'ActionBar', + 'x-component-props': { + layout: 'one-column', + style: { + marginTop: 24, + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'i818vw5tv0g', + 'x-async': false, + 'x-index': 2, + }, + }, + 'x-uid': 'xkj4q44w6ym', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 't6ajhkkuys0', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'm6wz53dmfdu', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '8x6245ii9nu', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'xtmna5prya7', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'cossd0o2fyh', + 'x-async': true, + 'x-index': 1, + }, +}; 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 d0959d720d..ddc4759358 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 @@ -1,5 +1,6 @@ import { createBlockInPage, expect, oneEmptyGridCardBlock, test } from '@nocobase/test/e2e'; import { oneEmptyTableWithUsers } from '../../details-multi/__e2e__/templatesOfBug'; +import { oneGridCardWithInheritFields } from './templatesOfBug'; test.describe('where grid card block can be added', () => { test('page', async ({ page, mockPage }) => { @@ -187,5 +188,26 @@ test.describe('configure fields', () => { await expect(page.getByLabel('block-item-Markdown.Void-general-grid-card').first()).toBeVisible(); }); - test.pgOnly('display inherit fields', async () => {}); + + test.pgOnly('display inherit fields', async ({ page, mockPage, mockRecord }) => { + const nocoPage = await mockPage(oneGridCardWithInheritFields).waitForInit(); + const record = await mockRecord('child'); + await nocoPage.goto(); + + // 选择继承的字段 + await page.getByLabel('schema-initializer-Grid-details:configureFields-child').hover(); + await page.getByRole('menuitem', { name: 'parentField1' }).click(); + await page.getByRole('menuitem', { name: 'parentField2' }).click(); + await page.mouse.move(300, 0); + await expect( + page + .getByLabel('block-item-CollectionField-child-grid-card-child.parentField1-parentField1') + .getByText(record.parentField1), + ).toBeVisible(); + await expect( + page + .getByLabel('block-item-CollectionField-child-grid-card-child.parentField2-parentField2') + .getByText(record.parentField2), + ).toBeVisible(); + }); }); diff --git a/packages/core/client/src/modules/blocks/data-blocks/grid-card/__e2e__/templatesOfBug.ts b/packages/core/client/src/modules/blocks/data-blocks/grid-card/__e2e__/templatesOfBug.ts index 958c5dc85d..4912ca56ab 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/grid-card/__e2e__/templatesOfBug.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/grid-card/__e2e__/templatesOfBug.ts @@ -149,3 +149,180 @@ export const T3813: PageConfig = { 'x-async': true, }, }; +export const oneGridCardWithInheritFields = { + collections: [ + { + name: 'parent', + fields: [ + { + name: 'parentField1', + interface: 'input', + }, + { + name: 'parentField2', + interface: 'input', + }, + ], + }, + { + name: 'child', + fields: [ + { + name: 'childField1', + interface: 'input', + }, + { + name: 'childField2', + interface: 'input', + }, + ], + inherits: ['parent'], + }, + ], + pageSchema: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Page', + properties: { + '6dd4jp5aty3': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'page:addBlock', + properties: { + '6j297qld7k5': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + properties: { + '5ntnn78ittz': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + properties: { + d5hfemedgra: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-acl-action': 'child:view', + 'x-decorator': 'GridCard.Decorator', + 'x-use-decorator-props': 'useGridCardBlockDecoratorProps', + 'x-decorator-props': { + collection: 'child', + dataSource: 'main', + readPretty: true, + action: 'list', + params: { + pageSize: 12, + }, + runWhenParamsChanged: true, + rowKey: 'id', + }, + 'x-component': 'BlockItem', + 'x-use-component-props': 'useGridCardBlockItemProps', + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:gridCard', + 'x-app-version': '0.21.0-alpha.15', + properties: { + actionBar: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-initializer': 'gridCard:configureActions', + 'x-component': 'ActionBar', + 'x-component-props': { + style: { + marginBottom: 'var(--nb-spacing)', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'wwi5qc647uo', + 'x-async': false, + 'x-index': 1, + }, + list: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'array', + 'x-component': 'GridCard', + 'x-use-component-props': 'useGridCardBlockProps', + 'x-app-version': '0.21.0-alpha.15', + properties: { + item: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'object', + 'x-component': 'GridCard.Item', + 'x-read-pretty': true, + 'x-use-component-props': 'useGridCardItemProps', + 'x-app-version': '0.21.0-alpha.15', + properties: { + grid: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'details:configureFields', + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'l3t86n7gvzx', + 'x-async': false, + 'x-index': 1, + }, + actionBar: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-align': 'left', + 'x-initializer': 'gridCard:configureItemActions', + 'x-component': 'ActionBar', + 'x-use-component-props': 'useGridCardActionBarProps', + 'x-component-props': { + layout: 'one-column', + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': '82xmd28rt6w', + 'x-async': false, + 'x-index': 2, + }, + }, + 'x-uid': 'byt0acukow5', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '93fip5eoty5', + 'x-async': false, + 'x-index': 2, + }, + }, + 'x-uid': 'd7g6lotr67g', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'j0d554opvl6', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'y89y6kpb09t', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'z2h5z9118ck', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'nf4ji8havvf', + 'x-async': true, + 'x-index': 1, + }, +}; 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 d14295a499..ac8fb85696 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 @@ -47,12 +47,7 @@ const AssociatedFields = () => { return {schema}; }; -/** - * @deprecated - * use `tableColumnInitializers` instead - */ -export const tableColumnInitializers_deprecated = new CompatibleSchemaInitializer({ - name: 'TableColumnInitializers', +const commonOptions = { insertPosition: 'beforeEnd', icon: 'SettingOutlined', title: '{{t("Configure columns")}}', @@ -109,67 +104,21 @@ export const tableColumnInitializers_deprecated = new CompatibleSchemaInitialize }, }, ], +}; + +/** + * @deprecated + * use `tableColumnInitializers` instead + */ +export const tableColumnInitializers_deprecated = new CompatibleSchemaInitializer({ + name: 'TableColumnInitializers', + ...commonOptions, }); 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'; - }, - }, - ], + ...commonOptions, }, tableColumnInitializers_deprecated, ); 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 23c6823ff3..330aab77b0 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 @@ -1,5 +1,5 @@ import { createBlockInPage, expect, oneEmptyTable, test } from '@nocobase/test/e2e'; -import { T3686, T4005 } from './templatesOfBug'; +import { T3686, T4005, oneTableWithInheritFields } from './templatesOfBug'; test.describe('where table block can be added', () => { test('page', async ({ page, mockPage }) => { @@ -246,7 +246,19 @@ test.describe('configure columns', () => { await expect(page.getByRole('button', { name: 'Nickname', exact: true })).not.toBeVisible(); }); - test.pgOnly('display inherit fields', async ({ page, mockPage }) => {}); + test.pgOnly('display inherit fields', async ({ page, mockPage, mockRecord }) => { + const nocoPage = await mockPage(oneTableWithInheritFields).waitForInit(); + const record = await mockRecord('child'); + await nocoPage.goto(); + + // 选择继承字段 + await page.getByLabel('schema-initializer-TableV2-').hover(); + await page.getByRole('menuitem', { name: 'parentField1' }).click(); + await page.getByRole('menuitem', { name: 'parentField2' }).click(); + await page.mouse.move(300, 0); + await expect(page.getByLabel('block-item-CardItem-child-').getByText(record.parentField1)).toBeVisible(); + await expect(page.getByLabel('block-item-CardItem-child-').getByText(record.parentField2)).toBeVisible(); + }); }); test.describe('configure actions column', () => { 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 b6245eec22..b015d092b5 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 @@ -2688,3 +2688,177 @@ export const oneTableWithUpdateRecord = { 'x-async': true, }, }; +export const oneTableWithInheritFields = { + collections: [ + { + name: 'parent', + fields: [ + { + name: 'parentField1', + interface: 'input', + }, + { + name: 'parentField2', + interface: 'input', + }, + ], + }, + { + name: 'child', + fields: [ + { + name: 'childField1', + interface: 'input', + }, + { + name: 'childField2', + interface: 'input', + }, + ], + inherits: ['parent'], + }, + ], + pageSchema: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Page', + properties: { + '2c65dc2ect7': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'page:addBlock', + properties: { + u6fd3y5jsw4: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + properties: { + '0cftszpeysq': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + properties: { + zkqmsvk69kb: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-decorator': 'TableBlockProvider', + 'x-acl-action': 'child:list', + 'x-use-decorator-props': 'useTableBlockDecoratorProps', + 'x-decorator-props': { + collection: 'child', + dataSource: 'main', + action: 'list', + params: { + pageSize: 20, + }, + rowKey: 'id', + showIndex: true, + dragSort: false, + }, + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:table', + 'x-component': 'CardItem', + 'x-filter-targets': [], + 'x-app-version': '0.21.0-alpha.15', + properties: { + actions: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-initializer': 'table:configureActions', + 'x-component': 'ActionBar', + 'x-component-props': { + style: { + marginBottom: 'var(--nb-spacing)', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'iwm93jhfwrx', + 'x-async': false, + 'x-index': 1, + }, + pglwezl7vl4: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'array', + 'x-initializer': 'table:configureColumns', + 'x-component': 'TableV2', + 'x-use-component-props': 'useTableBlockProps', + 'x-component-props': { + rowKey: 'id', + rowSelection: { + type: 'checkbox', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + properties: { + actions: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + title: '{{ t("Actions") }}', + 'x-action-column': 'actions', + 'x-decorator': 'TableV2.Column.ActionBar', + 'x-component': 'TableV2.Column', + 'x-designer': 'TableV2.ActionColumnDesigner', + 'x-initializer': 'table:configureItemActions', + 'x-app-version': '0.21.0-alpha.15', + properties: { + '91704g8ido3': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-decorator': 'DndContext', + 'x-component': 'Space', + 'x-component-props': { + split: '|', + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'qg83y0l4rvz', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '3v1d4gomwrc', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'r3si3q9zpil', + 'x-async': false, + 'x-index': 2, + }, + }, + 'x-uid': 'upsr773evx4', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'sf3i4eqykta', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 've6jepsuju1', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '89f529bg5kn', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'hfgygvnm6sc', + 'x-async': true, + 'x-index': 1, + }, +}; diff --git a/packages/core/client/src/modules/blocks/filter-blocks/__e2e__/schemaInitializer.test.ts b/packages/core/client/src/modules/blocks/filter-blocks/__e2e__/schemaInitializer.test.ts new file mode 100644 index 0000000000..fa104eddd9 --- /dev/null +++ b/packages/core/client/src/modules/blocks/filter-blocks/__e2e__/schemaInitializer.test.ts @@ -0,0 +1,197 @@ +import { expect, test } from '@nocobase/test/e2e'; +import { detailsTableListGridCardInPopup, tableDetailsListGridCardWithUsers } from './templates'; + +test.describe('where filter block can be added', () => { + test('page', async ({ page, mockPage, mockRecords }) => { + const nocoPage = await mockPage(tableDetailsListGridCardWithUsers).waitForInit(); + const newUserRecords = await mockRecords('users', 3); + await nocoPage.goto(); + + // 1. 页面中创建一个 filter form,一个 filter collapse + await page.getByLabel('schema-initializer-Grid-page:').hover(); + await page.getByRole('menuitem', { name: 'form Form right' }).nth(1).hover(); + await page.getByRole('menuitem', { name: 'Users' }).click(); + await page.getByLabel('schema-initializer-Grid-page:').hover(); + await page.getByRole('menuitem', { name: 'table Collapse right' }).hover(); + await page.getByRole('menuitem', { name: 'Users' }).click(); + + // 2. 区块中能正常创建字段和按钮,且能正常显示字段值 + await page.getByLabel('schema-initializer-Grid-filterForm:configureFields-users').hover(); + await page.getByRole('menuitem', { name: 'Nickname' }).click(); + await page.getByLabel('schema-initializer-ActionBar-filterForm:configureActions-users').hover(); + await page.getByRole('menuitem', { name: 'Filter' }).click(); + await page.getByRole('menuitem', { name: 'Reset' }).click(); + await page.getByLabel('schema-initializer-AssociationFilter-filterCollapse:configureFields-users').hover(); + await page.getByRole('menuitem', { name: 'Roles' }).click(); + + // 3. 与 Table、Details、List、GridCard 等区块建立连接 + const connectByForm = async (name: string) => { + await page.getByLabel('block-item-CardItem-users-filter-form').hover(); + await page.getByLabel('designer-schema-settings-CardItem-blockSettings:filterForm-users').hover(); + await page.getByRole('menuitem', { name: 'Connect data blocks right' }).hover(); + await page.getByRole('menuitem', { name }).click(); + }; + const connectByCollapse = async (name: string) => { + await page.getByLabel('block-item-CardItem-users-filter-collapse').hover(); + await page.getByLabel('designer-schema-settings-CardItem-blockSettings:filterCollapse-users').hover(); + await page.getByRole('menuitem', { name: 'Connect data blocks right' }).hover(); + await page.getByRole('menuitem', { name }).click(); + }; + await connectByForm('Users #79xm'); + await connectByForm('Users #4whf'); + await connectByForm('Users #qztm'); + await connectByForm('Users #2nig'); + await connectByCollapse('Users #79xm'); + await connectByCollapse('Users #4whf'); + await connectByCollapse('Users #qztm'); + await connectByCollapse('Users #2nig'); + + // 4. 筛选区块能正常筛选数据 + await page + .getByLabel('block-item-CollectionField-users-filter-form-users.nickname-Nickname') + .getByRole('textbox') + .fill(newUserRecords[0].nickname); + + // filter + await page.getByLabel('action-Action-Filter-submit-').click({ position: { x: 10, y: 10 } }); + await page.waitForLoadState('networkidle'); + for (const record of newUserRecords) { + await expect(page.getByLabel('block-item-CardItem-users-table').getByText(record.nickname)).toBeVisible({ + visible: record === newUserRecords[0], + }); + await expect(page.getByLabel('block-item-CardItem-users-details').getByText(record.nickname)).toBeVisible({ + visible: record === newUserRecords[0], + }); + await expect(page.getByLabel('block-item-CardItem-users-list').getByText(record.nickname)).toBeVisible({ + visible: record === newUserRecords[0], + }); + await expect(page.getByLabel('block-item-BlockItem-users-grid').getByText(record.nickname)).toBeVisible({ + visible: record === newUserRecords[0], + }); + } + + // reset + await page.getByLabel('action-Action-Reset-users-').click({ position: { x: 10, y: 10 } }); + await page.waitForLoadState('networkidle'); + for (const record of newUserRecords) { + await expect(page.getByLabel('block-item-CardItem-users-table').getByText(record.nickname)).toBeVisible(); + await expect(page.getByLabel('block-item-CardItem-users-list').getByText(record.nickname)).toBeVisible(); + await expect(page.getByLabel('block-item-BlockItem-users-grid').getByText(record.nickname)).toBeVisible(); + } + }); + + test('popup', async ({ page, mockPage, mockRecords }) => { + const nocoPage = await mockPage(detailsTableListGridCardInPopup).waitForInit(); + const usersRecords = await mockRecords('users', 3); + await nocoPage.goto(); + + // 1. 测试用表单筛选关系区块 + await page.getByLabel('action-Action.Link-View record-view-users-table-1').click(); + await page.getByLabel('schema-initializer-Grid-popup').hover(); + await page.getByRole('menuitem', { name: 'form Form right' }).hover(); + await page.getByRole('menuitem', { name: 'Roles' }).click(); + await page.getByLabel('schema-initializer-Grid-filterForm:configureFields-roles').hover(); + await page.getByRole('menuitem', { name: 'Role UID' }).click(); + await page.getByLabel('schema-initializer-ActionBar-filterForm:configureActions-roles').hover(); + await page.getByRole('menuitem', { name: 'Filter' }).click(); + await page.getByRole('menuitem', { name: 'Reset' }).click(); + + const conenctToAssociationBlock = async (name: string) => { + await page.getByLabel('block-item-CardItem-roles-filter-form').hover(); + await page.getByLabel('designer-schema-settings-CardItem-blockSettings:filterForm-roles').hover(); + await page.getByRole('menuitem', { name: 'Connect data blocks right' }).hover(); + await page.getByRole('menuitem', { name }).click(); + }; + await conenctToAssociationBlock('Roles #as4s'); + await conenctToAssociationBlock('Roles #vp3q'); + await conenctToAssociationBlock('Roles #ug18'); + await conenctToAssociationBlock('Roles #q6hq'); + + await page + .getByLabel('block-item-CardItem-roles-filter-form') + .getByRole('textbox') + .fill(usersRecords[0].roles[0].name); + await page.getByLabel('action-Action-Filter-submit-').click({ position: { x: 10, y: 10 } }); + await page.waitForLoadState('networkidle'); + + for (const record of usersRecords[0].roles) { + await expect(page.getByLabel('block-item-CardItem-roles-details').getByText(record.name)).toBeVisible({ + visible: record.name === usersRecords[0].roles[0].name, + }); + await expect(page.getByLabel('block-item-CardItem-roles-table').getByText(record.name)).toBeVisible({ + visible: record.name === usersRecords[0].roles[0].name, + }); + await expect(page.getByLabel('block-item-CardItem-roles-list').getByText(record.name)).toBeVisible({ + visible: record.name === usersRecords[0].roles[0].name, + }); + await expect(page.getByLabel('block-item-BlockItem-roles-').getByText(record.name)).toBeVisible({ + visible: record.name === usersRecords[0].roles[0].name, + }); + } + + await page.getByLabel('action-Action-Reset-roles-').click({ position: { x: 10, y: 10 } }); + await page.waitForLoadState('networkidle'); + for (const record of usersRecords[0].roles) { + await expect(page.getByLabel('block-item-CardItem-roles-table').getByText(record.name)).toBeVisible(); + await expect(page.getByLabel('block-item-CardItem-roles-list').getByText(record.name)).toBeVisible(); + await expect(page.getByLabel('block-item-BlockItem-roles-').getByText(record.name)).toBeVisible(); + } + + // 2. 测试用表单筛选其它区块 + await page.getByLabel('schema-initializer-Grid-popup').hover(); + await page.getByRole('menuitem', { name: 'form Form right' }).hover(); + await page.getByRole('menuitem', { name: 'Users' }).click(); + await page.getByLabel('schema-initializer-Grid-filterForm:configureFields-users').hover(); + await page.getByRole('menuitem', { name: 'Nickname' }).click(); + await page.getByLabel('schema-initializer-ActionBar-filterForm:configureActions-users').hover(); + await page.getByRole('menuitem', { name: 'Filter' }).click(); + await page.getByRole('menuitem', { name: 'Reset' }).click(); + + const conenctToOtherBlock = async (name: string) => { + await page.getByLabel('block-item-CardItem-users-filter-form').hover(); + await page.getByLabel('designer-schema-settings-CardItem-blockSettings:filterForm-users').hover(); + await page.getByRole('menuitem', { name: 'Connect data blocks right' }).hover(); + await page.getByRole('menuitem', { name }).click(); + }; + await conenctToOtherBlock('Users #iwq7'); + await conenctToOtherBlock('Users #1xi2'); + await conenctToOtherBlock('Users #11h7'); + await conenctToOtherBlock('Users #o1nq'); + + await page.getByLabel('block-item-CardItem-users-filter-form').getByRole('textbox').fill(usersRecords[0].nickname); + await page.getByLabel('action-Action-Filter-submit-users-filter-form-').click({ position: { x: 10, y: 10 } }); + await page.waitForLoadState('networkidle'); + for (const record of usersRecords) { + await expect(page.getByLabel('block-item-CardItem-users-details').getByText(record.nickname)).toBeVisible({ + visible: record === usersRecords[0], + }); + await expect( + page + .getByTestId('drawer-Action.Container-users-View record') + .getByLabel('block-item-CardItem-users-table') + .getByText(record.nickname), + ).toBeVisible({ + visible: record === usersRecords[0], + }); + await expect(page.getByLabel('block-item-CardItem-users-list').getByText(record.nickname)).toBeVisible({ + visible: record === usersRecords[0], + }); + await expect(page.getByLabel('block-item-BlockItem-users-grid').getByText(record.nickname)).toBeVisible({ + visible: record === usersRecords[0], + }); + } + + await page.getByLabel('action-Action-Reset-users-').click({ position: { x: 10, y: 10 } }); + await page.waitForLoadState('networkidle'); + for (const record of usersRecords) { + await expect( + page + .getByTestId('drawer-Action.Container-users-View record') + .getByLabel('block-item-CardItem-users-table') + .getByText(record.nickname), + ).toBeVisible(); + await expect(page.getByLabel('block-item-CardItem-users-list').getByText(record.nickname)).toBeVisible(); + await expect(page.getByLabel('block-item-BlockItem-users-grid').getByText(record.nickname)).toBeVisible(); + } + }); +}); diff --git a/packages/core/client/src/modules/blocks/filter-blocks/__e2e__/schemaSettings.test.ts b/packages/core/client/src/modules/blocks/filter-blocks/__e2e__/schemaSettings.test.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/core/client/src/modules/blocks/filter-blocks/__e2e__/templates.ts b/packages/core/client/src/modules/blocks/filter-blocks/__e2e__/templates.ts new file mode 100644 index 0000000000..66c7cffa4f --- /dev/null +++ b/packages/core/client/src/modules/blocks/filter-blocks/__e2e__/templates.ts @@ -0,0 +1,2171 @@ +export const tableDetailsListGridCardWithUsers = { + pageSchema: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Page', + 'x-app-version': '0.21.0-alpha.15', + properties: { + '9uvv7ydmvmd': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'page:addBlock', + 'x-app-version': '0.21.0-alpha.15', + properties: { + voe1jn124m6: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + properties: { + ykfrrluma0h: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + properties: { + '5ovawvsk2m1': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-decorator': 'TableBlockProvider', + 'x-acl-action': 'users:list', + 'x-use-decorator-props': 'useTableBlockDecoratorProps', + 'x-decorator-props': { + collection: 'users', + dataSource: 'main', + action: 'list', + params: { + pageSize: 20, + }, + rowKey: 'id', + showIndex: true, + dragSort: false, + }, + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:table', + 'x-component': 'CardItem', + 'x-filter-targets': [], + 'x-app-version': '0.21.0-alpha.15', + properties: { + actions: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-initializer': 'table:configureActions', + 'x-component': 'ActionBar', + 'x-component-props': { + style: { + marginBottom: 'var(--nb-spacing)', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'gthqv4uaubi', + 'x-async': false, + 'x-index': 1, + }, + '2cptag71atw': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'array', + 'x-initializer': 'table:configureColumns', + 'x-component': 'TableV2', + 'x-use-component-props': 'useTableBlockProps', + 'x-component-props': { + rowKey: 'id', + rowSelection: { + type: 'checkbox', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + properties: { + actions: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + title: '{{ t("Actions") }}', + 'x-action-column': 'actions', + 'x-decorator': 'TableV2.Column.ActionBar', + 'x-component': 'TableV2.Column', + 'x-designer': 'TableV2.ActionColumnDesigner', + 'x-initializer': 'table:configureItemActions', + 'x-app-version': '0.21.0-alpha.15', + properties: { + xbfvdqe0lcs: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-decorator': 'DndContext', + 'x-component': 'Space', + 'x-component-props': { + split: '|', + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'tzkjed29ec4', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'a3us1cfrwia', + 'x-async': false, + 'x-index': 1, + }, + '7mr9bnpcrwm': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-decorator': 'TableV2.Column.Decorator', + 'x-toolbar': 'TableColumnSchemaToolbar', + 'x-settings': 'fieldSettings:TableColumn', + 'x-component': 'TableV2.Column', + 'x-app-version': '0.21.0-alpha.15', + properties: { + nickname: { + _isJSONSchemaObject: true, + version: '2.0', + 'x-collection-field': 'users.nickname', + 'x-component': 'CollectionField', + 'x-component-props': { + ellipsis: true, + }, + 'x-read-pretty': true, + 'x-decorator': null, + 'x-decorator-props': { + labelStyle: { + display: 'none', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'rydna464x7i', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'gejlmm27aa7', + 'x-async': false, + 'x-index': 2, + }, + }, + 'x-uid': 'x6ktlhol700', + 'x-async': false, + 'x-index': 2, + }, + }, + 'x-uid': '79xmcus0pn8', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '1vwn4akg64m', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'ld956ku384v', + 'x-async': false, + 'x-index': 1, + }, + ij9nh362xlx: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + properties: { + q853rp6cv2o: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + properties: { + '0rancu18c3t': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-acl-action': 'users:view', + 'x-decorator': 'DetailsBlockProvider', + 'x-use-decorator-props': 'useDetailsWithPaginationDecoratorProps', + 'x-decorator-props': { + dataSource: 'main', + collection: 'users', + readPretty: true, + action: 'list', + params: { + pageSize: 1, + }, + }, + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:detailsWithPagination', + 'x-component': 'CardItem', + 'x-app-version': '0.21.0-alpha.15', + properties: { + k0gp4d6bp47: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Details', + 'x-read-pretty': true, + 'x-use-component-props': 'useDetailsWithPaginationProps', + 'x-app-version': '0.21.0-alpha.15', + properties: { + '46w4xjjxqsr': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-initializer': 'details:configureActions', + 'x-component': 'ActionBar', + 'x-component-props': { + style: { + marginBottom: 24, + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'beelkbsivi8', + 'x-async': false, + 'x-index': 1, + }, + grid: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'details:configureFields', + 'x-app-version': '0.21.0-alpha.15', + properties: { + tht6lqgyku1: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + properties: { + '0k4bzq9ci5i': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + properties: { + nickname: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'string', + 'x-toolbar': 'FormItemSchemaToolbar', + 'x-settings': 'fieldSettings:FormItem', + 'x-component': 'CollectionField', + 'x-decorator': 'FormItem', + 'x-collection-field': 'users.nickname', + 'x-component-props': {}, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'pl3owbdqfo3', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'bjv8hi7diq2', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'x3wmij5qx8a', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '1x30b6yfx99', + 'x-async': false, + 'x-index': 2, + }, + pagination: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Pagination', + 'x-use-component-props': 'useDetailsPaginationProps', + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': '23jk7ja9jkk', + 'x-async': false, + 'x-index': 3, + }, + }, + 'x-uid': 'juczg2jh500', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '4whfpb90dn7', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'vvbsg0s5tcr', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'ttr211kqcox', + 'x-async': false, + 'x-index': 2, + }, + vgr33x8jh3a: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + properties: { + w7yqoi8316a: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + properties: { + '210p1dq7a1s': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-acl-action': 'users:view', + 'x-decorator': 'List.Decorator', + 'x-use-decorator-props': 'useListBlockDecoratorProps', + 'x-decorator-props': { + collection: 'users', + dataSource: 'main', + readPretty: true, + action: 'list', + params: { + pageSize: 10, + }, + runWhenParamsChanged: true, + rowKey: 'id', + }, + 'x-component': 'CardItem', + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:list', + 'x-app-version': '0.21.0-alpha.15', + properties: { + actionBar: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-initializer': 'list:configureActions', + 'x-component': 'ActionBar', + 'x-component-props': { + style: { + marginBottom: 'var(--nb-spacing)', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'b43enq6x37m', + 'x-async': false, + 'x-index': 1, + }, + list: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'array', + 'x-component': 'List', + 'x-use-component-props': 'useListBlockProps', + 'x-app-version': '0.21.0-alpha.15', + properties: { + item: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'object', + 'x-component': 'List.Item', + 'x-read-pretty': true, + 'x-use-component-props': 'useListItemProps', + 'x-app-version': '0.21.0-alpha.15', + properties: { + grid: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'details:configureFields', + 'x-app-version': '0.21.0-alpha.15', + properties: { + t4iiyx5kwxc: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + properties: { + xg6b36sfo0j: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + properties: { + nickname: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'string', + 'x-toolbar': 'FormItemSchemaToolbar', + 'x-settings': 'fieldSettings:FormItem', + 'x-component': 'CollectionField', + 'x-decorator': 'FormItem', + 'x-collection-field': 'users.nickname', + 'x-component-props': {}, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'xxf3ntw195s', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'd22jvs6ynfn', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'zke7r8kitk6', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'o0dlql5q0dc', + 'x-async': false, + 'x-index': 1, + }, + actionBar: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-align': 'left', + 'x-initializer': 'list:configureItemActions', + 'x-component': 'ActionBar', + 'x-use-component-props': 'useListActionBarProps', + 'x-component-props': { + layout: 'one-column', + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'pl9nyokfl7u', + 'x-async': false, + 'x-index': 2, + }, + }, + 'x-uid': '1hr9dfxpxo2', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'sh38xfoaerm', + 'x-async': false, + 'x-index': 2, + }, + }, + 'x-uid': 'qztm5xvlwxu', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'fvmc5rku8b8', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '1weaufeee1b', + 'x-async': false, + 'x-index': 3, + }, + '11o6g2p2ynq': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + properties: { + '852c7m9e5we': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + properties: { + zw3qynnh2w9: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-acl-action': 'users:view', + 'x-decorator': 'GridCard.Decorator', + 'x-use-decorator-props': 'useGridCardBlockDecoratorProps', + 'x-decorator-props': { + collection: 'users', + dataSource: 'main', + readPretty: true, + action: 'list', + params: { + pageSize: 12, + }, + runWhenParamsChanged: true, + rowKey: 'id', + }, + 'x-component': 'BlockItem', + 'x-use-component-props': 'useGridCardBlockItemProps', + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:gridCard', + 'x-app-version': '0.21.0-alpha.15', + properties: { + actionBar: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-initializer': 'gridCard:configureActions', + 'x-component': 'ActionBar', + 'x-component-props': { + style: { + marginBottom: 'var(--nb-spacing)', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'y4r3n4ux6yi', + 'x-async': false, + 'x-index': 1, + }, + list: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'array', + 'x-component': 'GridCard', + 'x-use-component-props': 'useGridCardBlockProps', + 'x-app-version': '0.21.0-alpha.15', + properties: { + item: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'object', + 'x-component': 'GridCard.Item', + 'x-read-pretty': true, + 'x-use-component-props': 'useGridCardItemProps', + 'x-app-version': '0.21.0-alpha.15', + properties: { + grid: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'details:configureFields', + 'x-app-version': '0.21.0-alpha.15', + properties: { + t8dr9bz30ic: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + properties: { + l2y9n9omym2: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + properties: { + nickname: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'string', + 'x-toolbar': 'FormItemSchemaToolbar', + 'x-settings': 'fieldSettings:FormItem', + 'x-component': 'CollectionField', + 'x-decorator': 'FormItem', + 'x-collection-field': 'users.nickname', + 'x-component-props': {}, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'mmve9lw6hq5', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'nddibjuay67', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '42wqrm3gumo', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'uxbrmj5gov0', + 'x-async': false, + 'x-index': 1, + }, + actionBar: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-align': 'left', + 'x-initializer': 'gridCard:configureItemActions', + 'x-component': 'ActionBar', + 'x-use-component-props': 'useGridCardActionBarProps', + 'x-component-props': { + layout: 'one-column', + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'nz3gam7wfcp', + 'x-async': false, + 'x-index': 2, + }, + }, + 'x-uid': '549z367nhtq', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '8jqbs62h8al', + 'x-async': false, + 'x-index': 2, + }, + }, + 'x-uid': '2nigd3g90cu', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'r04q13e4bae', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'kjouclctu40', + 'x-async': false, + 'x-index': 4, + }, + }, + 'x-uid': 'dcjkmu3qkal', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'ifbigjtfclg', + 'x-async': true, + 'x-index': 1, + }, + keepUid: true, +}; +export const detailsTableListGridCardInPopup = { + pageSchema: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Page', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + mvuyz1mgstk: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'page:addBlock', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + woexs8tqxb1: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + tmxv3l829di: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + '6x2w9162eng': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-decorator': 'TableBlockProvider', + 'x-acl-action': 'users:list', + 'x-use-decorator-props': 'useTableBlockDecoratorProps', + 'x-decorator-props': { + collection: 'users', + dataSource: 'main', + action: 'list', + params: { + pageSize: 20, + }, + rowKey: 'id', + showIndex: true, + dragSort: false, + }, + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:table', + 'x-component': 'CardItem', + 'x-filter-targets': [], + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + actions: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-initializer': 'table:configureActions', + 'x-component': 'ActionBar', + 'x-component-props': { + style: { + marginBottom: 'var(--nb-spacing)', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + 'x-uid': 'lg8ox84e2yj', + 'x-async': false, + }, + rl3jmqxyb8r: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'array', + 'x-initializer': 'table:configureColumns', + 'x-component': 'TableV2', + 'x-use-component-props': 'useTableBlockProps', + 'x-component-props': { + rowKey: 'id', + rowSelection: { + type: 'checkbox', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 2, + properties: { + actions: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + title: '{{ t("Actions") }}', + 'x-action-column': 'actions', + 'x-decorator': 'TableV2.Column.ActionBar', + 'x-component': 'TableV2.Column', + 'x-designer': 'TableV2.ActionColumnDesigner', + 'x-initializer': 'table:configureItemActions', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + n69pgzca87s: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-decorator': 'DndContext', + 'x-component': 'Space', + 'x-component-props': { + split: '|', + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + hihiwavggft: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + title: 'View record', + 'x-action': 'view', + 'x-toolbar': 'ActionSchemaToolbar', + 'x-settings': 'actionSettings:view', + 'x-component': 'Action.Link', + 'x-component-props': { + openMode: 'drawer', + danger: false, + }, + 'x-decorator': 'ACLActionProvider', + 'x-designer-props': { + linkageAction: true, + }, + 'x-index': 1, + properties: { + drawer: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + title: '{{ t("View record") }}', + 'x-component': 'Action.Container', + 'x-component-props': { + className: 'nb-action-popup', + }, + 'x-index': 1, + properties: { + tabs: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Tabs', + 'x-component-props': {}, + 'x-initializer': 'popup:addTab', + 'x-index': 1, + properties: { + tab1: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + title: '{{t("Details")}}', + 'x-component': 'Tabs.TabPane', + 'x-designer': 'Tabs.Designer', + 'x-component-props': {}, + 'x-index': 1, + properties: { + grid: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'popup:common:addBlock', + 'x-index': 1, + properties: { + '7c9cnouotll': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + zhyzowuuom8: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + xwlsydiovoz: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-acl-action': 'users.roles:view', + 'x-decorator': 'DetailsBlockProvider', + 'x-use-decorator-props': + 'useDetailsWithPaginationDecoratorProps', + 'x-decorator-props': { + dataSource: 'main', + association: 'users.roles', + readPretty: true, + action: 'list', + params: { + pageSize: 1, + }, + }, + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:detailsWithPagination', + 'x-component': 'CardItem', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + '5nz3tnm18s5': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Details', + 'x-read-pretty': true, + 'x-use-component-props': + 'useDetailsWithPaginationProps', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + '7l2wnp2u2p0': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-initializer': 'details:configureActions', + 'x-component': 'ActionBar', + 'x-component-props': { + style: { + marginBottom: 24, + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + 'x-uid': 'a1wrnq3wl89', + 'x-async': false, + }, + grid: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'details:configureFields', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 2, + properties: { + '74it50iqg6m': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + properties: { + z4ft3bbl2k3: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + properties: { + name: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'string', + 'x-toolbar': + 'FormItemSchemaToolbar', + 'x-settings': + 'fieldSettings:FormItem', + 'x-component': 'CollectionField', + 'x-decorator': 'FormItem', + 'x-collection-field': 'roles.name', + 'x-component-props': {}, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'qijbpeoib4a', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'jz6jqgievn7', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'vwlkijbckjy', + 'x-async': false, + 'x-index': 2, + }, + }, + 'x-uid': 'mbdi5dp0uy9', + 'x-async': false, + }, + pagination: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Pagination', + 'x-use-component-props': + 'useDetailsPaginationProps', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 3, + 'x-uid': 'esorm0agfd7', + 'x-async': false, + }, + }, + 'x-uid': 'zllcmkba4ag', + 'x-async': false, + }, + }, + 'x-uid': 'as4sc43hmo6', + 'x-async': false, + }, + }, + 'x-uid': 'x2hydkcig3j', + 'x-async': false, + }, + }, + 'x-uid': 'wr0h16g0agh', + 'x-async': false, + }, + k9hwxfpvs5z: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 2, + properties: { + '8071u6sqhjx': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + '2ddo3f0gkzu': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-acl-action': 'users:view', + 'x-decorator': 'DetailsBlockProvider', + 'x-use-decorator-props': + 'useDetailsWithPaginationDecoratorProps', + 'x-decorator-props': { + dataSource: 'main', + collection: 'users', + readPretty: true, + action: 'list', + params: { + pageSize: 1, + }, + }, + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:detailsWithPagination', + 'x-component': 'CardItem', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + qi41mfgv9k6: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Details', + 'x-read-pretty': true, + 'x-use-component-props': + 'useDetailsWithPaginationProps', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + '1l8wiojvy33': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-initializer': 'details:configureActions', + 'x-component': 'ActionBar', + 'x-component-props': { + style: { + marginBottom: 24, + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + 'x-uid': '9m35j2awac8', + 'x-async': false, + }, + grid: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'details:configureFields', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 2, + properties: { + spw1xven1tm: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + '10o4mgxz8ya': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + nickname: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'string', + 'x-toolbar': + 'FormItemSchemaToolbar', + 'x-settings': + 'fieldSettings:FormItem', + 'x-component': 'CollectionField', + 'x-decorator': 'FormItem', + 'x-collection-field': + 'users.nickname', + 'x-component-props': {}, + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + 'x-uid': 'heu60o0fjvw', + 'x-async': false, + }, + }, + 'x-uid': 'eu466gnly83', + 'x-async': false, + }, + }, + 'x-uid': 'rkrmqf4qtvt', + 'x-async': false, + }, + }, + 'x-uid': 'zqd7wt6x7sf', + 'x-async': false, + }, + pagination: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Pagination', + 'x-use-component-props': + 'useDetailsPaginationProps', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 3, + 'x-uid': '6ks5zlg89ug', + 'x-async': false, + }, + }, + 'x-uid': '340j1itrpoq', + 'x-async': false, + }, + }, + 'x-uid': 'iwq7us57r9v', + 'x-async': false, + }, + }, + 'x-uid': 'akdgr36tk4p', + 'x-async': false, + }, + }, + 'x-uid': '082x4pgh4o5', + 'x-async': false, + }, + '9a5au8wklr7': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 3, + properties: { + l19mz03ow8s: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + '9mo13nzc1ac': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-decorator': 'TableBlockProvider', + 'x-acl-action': 'users.roles:list', + 'x-use-decorator-props': 'useTableBlockDecoratorProps', + 'x-decorator-props': { + association: 'users.roles', + dataSource: 'main', + action: 'list', + params: { + pageSize: 20, + }, + rowKey: 'name', + showIndex: true, + dragSort: false, + }, + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:table', + 'x-component': 'CardItem', + 'x-filter-targets': [], + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + actions: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-initializer': 'table:configureActions', + 'x-component': 'ActionBar', + 'x-component-props': { + style: { + marginBottom: 'var(--nb-spacing)', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + 'x-uid': 'i880m2zvoci', + 'x-async': false, + }, + xv44zf1hv4q: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'array', + 'x-initializer': 'table:configureColumns', + 'x-component': 'TableV2', + 'x-use-component-props': 'useTableBlockProps', + 'x-component-props': { + rowKey: 'id', + rowSelection: { + type: 'checkbox', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 2, + properties: { + actions: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + title: '{{ t("Actions") }}', + 'x-action-column': 'actions', + 'x-decorator': 'TableV2.Column.ActionBar', + 'x-component': 'TableV2.Column', + 'x-designer': 'TableV2.ActionColumnDesigner', + 'x-initializer': 'table:configureItemActions', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + r3t97c5zx23: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-decorator': 'DndContext', + 'x-component': 'Space', + 'x-component-props': { + split: '|', + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + 'x-uid': 'xpt2zxugy1d', + 'x-async': false, + }, + }, + 'x-uid': '31d900yerb0', + 'x-async': false, + }, + '2kv9mbp8cpu': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-decorator': 'TableV2.Column.Decorator', + 'x-toolbar': 'TableColumnSchemaToolbar', + 'x-settings': 'fieldSettings:TableColumn', + 'x-component': 'TableV2.Column', + 'x-app-version': '0.21.0-alpha.15', + properties: { + name: { + _isJSONSchemaObject: true, + version: '2.0', + 'x-collection-field': 'roles.name', + 'x-component': 'CollectionField', + 'x-component-props': { + ellipsis: true, + }, + 'x-read-pretty': true, + 'x-decorator': null, + 'x-decorator-props': { + labelStyle: { + display: 'none', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': '9r6tnnrmpp6', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '5ooizbci5fl', + 'x-async': false, + 'x-index': 3, + }, + }, + 'x-uid': 'andayw3gea9', + 'x-async': false, + }, + }, + 'x-uid': 'vp3qggdfnyi', + 'x-async': false, + }, + }, + 'x-uid': 'e14xrj73u6q', + 'x-async': false, + }, + }, + 'x-uid': '2yddfu4h6lf', + 'x-async': false, + }, + '8wk52v941az': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 4, + properties: { + '023qd6oiek8': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + eo2vyqropkd: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-decorator': 'TableBlockProvider', + 'x-acl-action': 'users:list', + 'x-use-decorator-props': 'useTableBlockDecoratorProps', + 'x-decorator-props': { + collection: 'users', + dataSource: 'main', + action: 'list', + params: { + pageSize: 20, + }, + rowKey: 'id', + showIndex: true, + dragSort: false, + }, + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:table', + 'x-component': 'CardItem', + 'x-filter-targets': [], + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + actions: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-initializer': 'table:configureActions', + 'x-component': 'ActionBar', + 'x-component-props': { + style: { + marginBottom: 'var(--nb-spacing)', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + 'x-uid': 'jwlkscns8n1', + 'x-async': false, + }, + kl7mhxaxc9v: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'array', + 'x-initializer': 'table:configureColumns', + 'x-component': 'TableV2', + 'x-use-component-props': 'useTableBlockProps', + 'x-component-props': { + rowKey: 'id', + rowSelection: { + type: 'checkbox', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 2, + properties: { + actions: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + title: '{{ t("Actions") }}', + 'x-action-column': 'actions', + 'x-decorator': 'TableV2.Column.ActionBar', + 'x-component': 'TableV2.Column', + 'x-designer': 'TableV2.ActionColumnDesigner', + 'x-initializer': 'table:configureItemActions', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + '18yq55t8ykl': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-decorator': 'DndContext', + 'x-component': 'Space', + 'x-component-props': { + split: '|', + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + 'x-uid': 'r3grinc8qmo', + 'x-async': false, + }, + }, + 'x-uid': 'jrcvgt0k2p6', + 'x-async': false, + }, + n6txkckkail: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-decorator': 'TableV2.Column.Decorator', + 'x-toolbar': 'TableColumnSchemaToolbar', + 'x-settings': 'fieldSettings:TableColumn', + 'x-component': 'TableV2.Column', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 2, + properties: { + nickname: { + _isJSONSchemaObject: true, + version: '2.0', + 'x-collection-field': 'users.nickname', + 'x-component': 'CollectionField', + 'x-component-props': { + ellipsis: true, + }, + 'x-read-pretty': true, + 'x-decorator': null, + 'x-decorator-props': { + labelStyle: { + display: 'none', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + 'x-uid': 'mk5u3buadol', + 'x-async': false, + }, + }, + 'x-uid': 'meiilye1qxl', + 'x-async': false, + }, + }, + 'x-uid': 'inawtjdt0h0', + 'x-async': false, + }, + }, + 'x-uid': '1xi2yzl1ucm', + 'x-async': false, + }, + }, + 'x-uid': '820i9h1lo87', + 'x-async': false, + }, + }, + 'x-uid': 'yb0ff65qc9j', + 'x-async': false, + }, + hr7odqbec30: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 5, + properties: { + fr3nnhqw07g: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + mjq22s4f33o: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-acl-action': 'users.roles:view', + 'x-decorator': 'List.Decorator', + 'x-use-decorator-props': 'useListBlockDecoratorProps', + 'x-decorator-props': { + dataSource: 'main', + association: 'users.roles', + readPretty: true, + action: 'list', + params: { + pageSize: 10, + }, + runWhenParamsChanged: true, + rowKey: 'name', + }, + 'x-component': 'CardItem', + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:list', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + actionBar: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-initializer': 'list:configureActions', + 'x-component': 'ActionBar', + 'x-component-props': { + style: { + marginBottom: 'var(--nb-spacing)', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + 'x-uid': '3qyl0zrs1hf', + 'x-async': false, + }, + list: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'array', + 'x-component': 'List', + 'x-use-component-props': 'useListBlockProps', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 2, + properties: { + item: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'object', + 'x-component': 'List.Item', + 'x-read-pretty': true, + 'x-use-component-props': 'useListItemProps', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + grid: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'details:configureFields', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + rjjmaae8cfx: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + properties: { + '8t1ntiodcnk': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + properties: { + name: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'string', + 'x-toolbar': + 'FormItemSchemaToolbar', + 'x-settings': + 'fieldSettings:FormItem', + 'x-component': + 'CollectionField', + 'x-decorator': 'FormItem', + 'x-collection-field': + 'roles.name', + 'x-component-props': {}, + 'x-app-version': + '0.21.0-alpha.15', + 'x-uid': '927dha2yk9s', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'rwd5op8ebfj', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '42otwbvbbmh', + 'x-async': false, + 'x-index': 2, + }, + }, + 'x-uid': '4ud8e4vc6mf', + 'x-async': false, + }, + actionBar: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-align': 'left', + 'x-initializer': + 'list:configureItemActions', + 'x-component': 'ActionBar', + 'x-use-component-props': + 'useListActionBarProps', + 'x-component-props': { + layout: 'one-column', + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 2, + 'x-uid': '2qjdc5cr2jt', + 'x-async': false, + }, + }, + 'x-uid': '43q5c032qiq', + 'x-async': false, + }, + }, + 'x-uid': '3yccsc0r847', + 'x-async': false, + }, + }, + 'x-uid': 'ug1879fox45', + 'x-async': false, + }, + }, + 'x-uid': '2c2do8t3mt9', + 'x-async': false, + }, + }, + 'x-uid': 'ry956fcb84v', + 'x-async': false, + }, + ninas5j5lzk: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 6, + properties: { + '1oyvrccw9oi': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + wpqarouweuz: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-acl-action': 'users:view', + 'x-decorator': 'List.Decorator', + 'x-use-decorator-props': 'useListBlockDecoratorProps', + 'x-decorator-props': { + collection: 'users', + dataSource: 'main', + readPretty: true, + action: 'list', + params: { + pageSize: 10, + }, + runWhenParamsChanged: true, + rowKey: 'id', + }, + 'x-component': 'CardItem', + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:list', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + actionBar: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-initializer': 'list:configureActions', + 'x-component': 'ActionBar', + 'x-component-props': { + style: { + marginBottom: 'var(--nb-spacing)', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + 'x-uid': 'c6z1pzg0v6a', + 'x-async': false, + }, + list: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'array', + 'x-component': 'List', + 'x-use-component-props': 'useListBlockProps', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 2, + properties: { + item: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'object', + 'x-component': 'List.Item', + 'x-read-pretty': true, + 'x-use-component-props': 'useListItemProps', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + grid: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'details:configureFields', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + tdecsbp01um: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + ac7y78x5i7a: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + nickname: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'string', + 'x-toolbar': + 'FormItemSchemaToolbar', + 'x-settings': + 'fieldSettings:FormItem', + 'x-component': + 'CollectionField', + 'x-decorator': 'FormItem', + 'x-collection-field': + 'users.nickname', + 'x-component-props': {}, + 'x-app-version': + '0.21.0-alpha.15', + 'x-index': 1, + 'x-uid': 'pqbn37xtayx', + 'x-async': false, + }, + }, + 'x-uid': 'ayauhbosgfe', + 'x-async': false, + }, + }, + 'x-uid': '5783fsm1rpw', + 'x-async': false, + }, + }, + 'x-uid': 'b0ntistsq0k', + 'x-async': false, + }, + actionBar: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-align': 'left', + 'x-initializer': + 'list:configureItemActions', + 'x-component': 'ActionBar', + 'x-use-component-props': + 'useListActionBarProps', + 'x-component-props': { + layout: 'one-column', + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 2, + 'x-uid': 'ul1egwbtuie', + 'x-async': false, + }, + }, + 'x-uid': '9bqpvytl8b6', + 'x-async': false, + }, + }, + 'x-uid': 'n7u7ief7ae1', + 'x-async': false, + }, + }, + 'x-uid': '11h7ijtwywv', + 'x-async': false, + }, + }, + 'x-uid': 'tzq2ojbsdbr', + 'x-async': false, + }, + }, + 'x-uid': 'qvfqywpcskh', + 'x-async': false, + }, + '3ybhnijplde': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 7, + properties: { + wy0pasojwjc: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + wuz3txf0ar4: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-acl-action': 'users.roles:view', + 'x-decorator': 'GridCard.Decorator', + 'x-use-decorator-props': + 'useGridCardBlockDecoratorProps', + 'x-decorator-props': { + association: 'users.roles', + dataSource: 'main', + readPretty: true, + action: 'list', + params: { + pageSize: 12, + }, + runWhenParamsChanged: true, + rowKey: 'name', + }, + 'x-component': 'BlockItem', + 'x-use-component-props': 'useGridCardBlockItemProps', + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:gridCard', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + actionBar: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-initializer': 'gridCard:configureActions', + 'x-component': 'ActionBar', + 'x-component-props': { + style: { + marginBottom: 'var(--nb-spacing)', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + 'x-uid': 'q8kg5szzqyp', + 'x-async': false, + }, + list: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'array', + 'x-component': 'GridCard', + 'x-use-component-props': 'useGridCardBlockProps', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 2, + properties: { + item: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'object', + 'x-component': 'GridCard.Item', + 'x-read-pretty': true, + 'x-use-component-props': 'useGridCardItemProps', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + grid: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'details:configureFields', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + nt8y1viliug: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + properties: { + em5myw2xcf7: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + properties: { + name: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'string', + 'x-toolbar': + 'FormItemSchemaToolbar', + 'x-settings': + 'fieldSettings:FormItem', + 'x-component': + 'CollectionField', + 'x-decorator': 'FormItem', + 'x-collection-field': + 'roles.name', + 'x-component-props': {}, + 'x-app-version': + '0.21.0-alpha.15', + 'x-uid': 'fzb5micv3dk', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'rqhvky214t1', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'yytayazos33', + 'x-async': false, + 'x-index': 2, + }, + }, + 'x-uid': '9w7tzn0fcdu', + 'x-async': false, + }, + actionBar: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-align': 'left', + 'x-initializer': + 'gridCard:configureItemActions', + 'x-component': 'ActionBar', + 'x-use-component-props': + 'useGridCardActionBarProps', + 'x-component-props': { + layout: 'one-column', + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 2, + 'x-uid': 'o7j7byoqyn2', + 'x-async': false, + }, + }, + 'x-uid': 'xevh2ziaxkm', + 'x-async': false, + }, + }, + 'x-uid': '407s8o0t4fc', + 'x-async': false, + }, + }, + 'x-uid': 'q6hqfnkkr6p', + 'x-async': false, + }, + }, + 'x-uid': '9zx4l2mstkl', + 'x-async': false, + }, + }, + 'x-uid': 'wkr57mhtvlo', + 'x-async': false, + }, + i0uj0t3cvly: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 8, + properties: { + m39rv4nfrw1: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + '1nr97kxg60h': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-acl-action': 'users:view', + 'x-decorator': 'GridCard.Decorator', + 'x-use-decorator-props': + 'useGridCardBlockDecoratorProps', + 'x-decorator-props': { + collection: 'users', + dataSource: 'main', + readPretty: true, + action: 'list', + params: { + pageSize: 12, + }, + runWhenParamsChanged: true, + rowKey: 'id', + }, + 'x-component': 'BlockItem', + 'x-use-component-props': 'useGridCardBlockItemProps', + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:gridCard', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + actionBar: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-initializer': 'gridCard:configureActions', + 'x-component': 'ActionBar', + 'x-component-props': { + style: { + marginBottom: 'var(--nb-spacing)', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + 'x-uid': 'efqh1behkbd', + 'x-async': false, + }, + list: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'array', + 'x-component': 'GridCard', + 'x-use-component-props': 'useGridCardBlockProps', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 2, + properties: { + item: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'object', + 'x-component': 'GridCard.Item', + 'x-read-pretty': true, + 'x-use-component-props': 'useGridCardItemProps', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + grid: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'details:configureFields', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + io80apkug3q: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + sx8h26dxc5s: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 1, + properties: { + nickname: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'string', + 'x-toolbar': + 'FormItemSchemaToolbar', + 'x-settings': + 'fieldSettings:FormItem', + 'x-component': + 'CollectionField', + 'x-decorator': 'FormItem', + 'x-collection-field': + 'users.nickname', + 'x-component-props': {}, + 'x-app-version': + '0.21.0-alpha.15', + 'x-index': 1, + 'x-uid': '6hq7aihqc9t', + 'x-async': false, + }, + }, + 'x-uid': 'sax7hjy7fyc', + 'x-async': false, + }, + }, + 'x-uid': '2uwt2a22r5p', + 'x-async': false, + }, + }, + 'x-uid': '65nejltnsco', + 'x-async': false, + }, + actionBar: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-align': 'left', + 'x-initializer': + 'gridCard:configureItemActions', + 'x-component': 'ActionBar', + 'x-use-component-props': + 'useGridCardActionBarProps', + 'x-component-props': { + layout: 'one-column', + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-index': 2, + 'x-uid': '9x26208x0pm', + 'x-async': false, + }, + }, + 'x-uid': 'eiu6r7z2p1c', + 'x-async': false, + }, + }, + 'x-uid': 'q0h0ynhhpcn', + 'x-async': false, + }, + }, + 'x-uid': 'o1nqvxhyuze', + 'x-async': false, + }, + }, + 'x-uid': 'vz4codfqjao', + 'x-async': false, + }, + }, + 'x-uid': 'xzpmxf4e11e', + 'x-async': false, + }, + }, + 'x-uid': '7to7okwtaa5', + 'x-async': false, + }, + }, + 'x-uid': 'k9msdtdomeu', + 'x-async': false, + }, + }, + 'x-uid': '0qgodqhza93', + 'x-async': false, + }, + }, + 'x-uid': '1jtu40ldbr7', + 'x-async': false, + }, + }, + 'x-uid': '6v9eio5wgf8', + 'x-async': false, + }, + }, + 'x-uid': 'ji8z4q5fzeb', + 'x-async': false, + }, + }, + 'x-uid': 'myttymhbq4i', + 'x-async': false, + }, + }, + 'x-uid': 'cpxxz872w05', + 'x-async': false, + }, + }, + 'x-uid': 'vg6yxbl1suf', + 'x-async': false, + }, + }, + 'x-uid': '6hrmi93pzky', + 'x-async': false, + }, + }, + 'x-uid': '4nfpp7jigmt', + 'x-async': false, + }, + }, + 'x-uid': 'kxlzdetp52z', + 'x-async': false, + }, + }, + 'x-uid': 'i56buxw1y1s', + 'x-async': true, + }, + keepUid: true, +}; 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 3870fa5c2a..a9f740db72 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 @@ -1,4 +1,5 @@ import { createBlockInPage, expect, oneEmptyFilterFormBlock, test } from '@nocobase/test/e2e'; +import { oneFilterFormWithInherit } from './templatesOfBug'; test.describe('where filter form block can be added', () => { test('page', async ({ page, mockPage }) => { @@ -65,7 +66,25 @@ test.describe('configure fields', () => { await expect(page.getByLabel('block-item-Markdown.Void-general-filter-form')).toBeVisible(); }); - test.pgOnly('display inherit fields', async ({ page, mockPage }) => {}); + test.pgOnly('display inherit fields', async ({ page, mockPage }) => { + await mockPage(oneFilterFormWithInherit).goto(); + + // 选择继承的字段 + await page.getByLabel('schema-initializer-Grid-filterForm:configureFields-child').hover(); + await page.getByRole('menuitem', { name: 'parentField1' }).click(); + await page.getByRole('menuitem', { name: 'parentField2' }).click(); + await page.mouse.move(300, 0); + await expect( + page + .getByLabel('block-item-CollectionField-child-filter-form-child.parentField1-parentField1') + .getByRole('textbox'), + ).toBeVisible(); + await expect( + page + .getByLabel('block-item-CollectionField-child-filter-form-child.parentField2-parentField2') + .getByRole('textbox'), + ).toBeVisible(); + }); }); test.describe('configure actions', () => { diff --git a/packages/core/client/src/modules/blocks/filter-blocks/form/__e2e__/templatesOfBug.ts b/packages/core/client/src/modules/blocks/filter-blocks/form/__e2e__/templatesOfBug.ts index e69de29bb2..44579ec4c9 100644 --- a/packages/core/client/src/modules/blocks/filter-blocks/form/__e2e__/templatesOfBug.ts +++ b/packages/core/client/src/modules/blocks/filter-blocks/form/__e2e__/templatesOfBug.ts @@ -0,0 +1,141 @@ +export const oneFilterFormWithInherit = { + collections: [ + { + name: 'parent', + fields: [ + { + name: 'parentField1', + interface: 'input', + }, + { + name: 'parentField2', + interface: 'input', + }, + ], + }, + { + name: 'child', + fields: [ + { + name: 'childField1', + interface: 'input', + }, + { + name: 'childField2', + interface: 'input', + }, + ], + inherits: ['parent'], + }, + ], + pageSchema: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Page', + properties: { + kq51phui0q9: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'page:addBlock', + properties: { + pp7ov10hhjj: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + properties: { + nz5peics4uj: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + properties: { + ibeh994er9g: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-decorator': 'FilterFormBlockProvider', + 'x-use-decorator-props': 'useFilterFormBlockDecoratorProps', + 'x-decorator-props': { + dataSource: 'main', + collection: 'child', + }, + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:filterForm', + 'x-component': 'CardItem', + 'x-filter-targets': [], + 'x-filter-operators': {}, + 'x-app-version': '0.21.0-alpha.15', + properties: { + al2miukt2y0: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'FormV2', + 'x-use-component-props': 'useFilterFormBlockProps', + 'x-app-version': '0.21.0-alpha.15', + properties: { + grid: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'filterForm:configureFields', + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'fs8883bxalw', + 'x-async': false, + 'x-index': 1, + }, + ni40rr6efvb: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-initializer': 'filterForm:configureActions', + 'x-component': 'ActionBar', + 'x-component-props': { + layout: 'one-column', + style: { + float: 'right', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'jhtfu538zve', + 'x-async': false, + 'x-index': 2, + }, + }, + 'x-uid': 'krv6g3fyqwu', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'zne83pn4hvx', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '7s8os6m891x', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'chovlhzi0ee', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '9xzpdna59re', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'oxtr4rkwpwy', + 'x-async': true, + 'x-index': 1, + }, +}; diff --git a/packages/core/client/src/modules/fields/component/FileManager/previewComponentFieldSettings.tsx b/packages/core/client/src/modules/fields/component/FileManager/previewComponentFieldSettings.tsx new file mode 100644 index 0000000000..90417fb545 --- /dev/null +++ b/packages/core/client/src/modules/fields/component/FileManager/previewComponentFieldSettings.tsx @@ -0,0 +1,50 @@ +import { Field } from '@formily/core'; +import { useField, useFieldSchema } from '@formily/react'; +import { useTranslation } from 'react-i18next'; +import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; +import { useColumnSchema } from '../../../../schema-component/antd/table/Table.Column.Decorator'; +import { useDesignable } from '../../../../schema-component/hooks/useDesignable'; + +export const previewComponentFieldSettings = new SchemaSettings({ + name: 'fieldSettings:component:Preview', + items: [ + { + name: 'size', + type: 'select', + useVisible() { + const { fieldSchema: tableColumnSchema } = useColumnSchema(); + const isInTable = tableColumnSchema?.parent?.['x-component'] === 'TableV2.Column'; + return !isInTable; + }, + useComponentProps() { + const { t } = useTranslation(); + const field = useField(); + const fieldSchema = useFieldSchema(); + const { dn } = useDesignable(); + return { + title: t('Size'), + options: [ + { label: t('Large'), value: 'large' }, + { label: t('Default'), value: 'default' }, + { label: t('Small'), value: 'small' }, + ], + value: field?.componentProps?.size || 'default', + onChange(size) { + const schema = { + ['x-uid']: fieldSchema['x-uid'], + }; + fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {}; + fieldSchema['x-component-props']['size'] = size; + schema['x-component-props'] = fieldSchema['x-component-props']; + field.componentProps = field.componentProps || {}; + field.componentProps.size = size; + dn.emit('patch', { + schema, + }); + dn.refresh(); + }, + }; + }, + }, + ], +}); diff --git a/packages/core/client/src/modules/fields/component/FileManager/uploadAttachmentComponentFieldSettings.tsx b/packages/core/client/src/modules/fields/component/FileManager/uploadAttachmentComponentFieldSettings.tsx index 25a6db2f8b..a790703783 100644 --- a/packages/core/client/src/modules/fields/component/FileManager/uploadAttachmentComponentFieldSettings.tsx +++ b/packages/core/client/src/modules/fields/component/FileManager/uploadAttachmentComponentFieldSettings.tsx @@ -2,7 +2,7 @@ import { Field } from '@formily/core'; import { useField, useFieldSchema } from '@formily/react'; import { useTranslation } from 'react-i18next'; import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; -import { useDesignable } from '../../../../schema-component'; +import { useColumnSchema, useDesignable } from '../../../../schema-component'; import { useIsFieldReadPretty } from '../../../../schema-component/antd/form-item/FormItem.Settings'; export const uploadAttachmentComponentFieldSettings = new SchemaSettings({ @@ -12,8 +12,10 @@ export const uploadAttachmentComponentFieldSettings = new SchemaSettings({ name: 'size', type: 'select', useVisible() { + const { fieldSchema: tableColumnSchema } = useColumnSchema(); + const isInTable = tableColumnSchema?.parent?.['x-component'] === 'TableV2.Column'; const readPretty = useIsFieldReadPretty(); - return readPretty; + return readPretty && !isInTable; }, useComponentProps() { const { t } = useTranslation(); 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 e3e9f5df69..86d0ac0945 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 @@ -12,6 +12,7 @@ import { useCollectionManager_deprecated, useCollection_deprecated, } from '../../../collection-manager'; +import { useCollectionManager } from '../../../data-source'; import { useFlag } from '../../../flag-provider'; import { useRecord } from '../../../record-provider'; import { useColumnSchema } from '../../../schema-component/antd/table-v2/Table.Column.Decorator'; @@ -979,9 +980,9 @@ export function useIsAssociationField() { } export function useIsFileField() { - const { getCollection } = useCollectionManager_deprecated(); + const cm = useCollectionManager(); const collectionField = useFormItemCollectionField(); - const targetCollection = getCollection(collectionField?.target); + const targetCollection = cm.getCollection(collectionField?.target); const isFileField = isFileCollection(targetCollection as any); return isFileField; } diff --git a/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx index fc7e215b55..67ee5bd96e 100644 --- a/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx +++ b/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx @@ -261,12 +261,7 @@ function useRecordBlocks() { return res; } -/** - * @deprecated - * use `recordBlockInitializers` instead - */ -export const recordBlockInitializers_deprecated = new CompatibleSchemaInitializer({ - name: 'RecordBlockInitializers', +const commonOptions = { wrap: gridRowColWrap, title: '{{t("Add block")}}', icon: 'PlusOutlined', @@ -297,19 +292,10 @@ export const recordBlockInitializers_deprecated = new CompatibleSchemaInitialize 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 { filterCollections({ collection }) { - if (collection) { - return toManyField.some((field) => field.target === collection.name); - } + return true; }, - onlyCurrentDataSource: true, }; }, }, @@ -318,34 +304,15 @@ export const recordBlockInitializers_deprecated = new CompatibleSchemaInitialize title: '{{t("Collapse")}}', Component: 'FilterCollapseBlockInitializer', useComponentProps() { - const collection = useCollection(); - const toManyField = useMemo( - () => collection.fields.filter((field) => ['hasMany', 'belongsToMany'].includes(field.type)), - [collection.fields], - ); - return { filterCollections({ collection }) { - if (collection) { - return toManyField.some((field) => field.target === collection.name); - } + return true; }, - onlyCurrentDataSource: true, }; }, }, ], }, - // { - // type: 'itemGroup', - // name: 'relationshipBlocks', - // title: '{{t("Relationship blocks")}}', - // useChildren: useRelationFields, - // useVisible() { - // const res = useRelationFields(); - // return res.length > 0; - // }, - // }, { type: 'itemGroup', name: 'otherBlocks', @@ -359,103 +326,21 @@ export const recordBlockInitializers_deprecated = new CompatibleSchemaInitialize ], }, ], +}; + +/** + * @deprecated + * use `recordBlockInitializers` instead + */ +export const recordBlockInitializers_deprecated = new CompatibleSchemaInitializer({ + name: 'RecordBlockInitializers', + ...commonOptions, }); export const recordBlockInitializers = new CompatibleSchemaInitializer( { name: 'popup:common:addBlock', - wrap: gridRowColWrap, - title: '{{t("Add block")}}', - icon: 'PlusOutlined', - items: [ - { - type: 'itemGroup', - name: 'dataBlocks', - title: '{{t("Data blocks")}}', - useChildren: useRecordBlocks, - }, - { - name: 'filterBlocks', - title: '{{t("Filter blocks")}}', - type: 'itemGroup', - useVisible() { - const collection = useCollection(); - return useMemo( - () => - collection.fields.some( - (field) => canMakeAssociationBlock(field) && ['hasMany', 'belongsToMany'].includes(field.type), - ), - [collection.fields], - ); - }, - 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 { - filterCollections({ collection }) { - if (collection) { - return toManyField.some((field) => field.target === collection.name); - } - }, - onlyCurrentDataSource: true, - }; - }, - }, - { - name: 'filterCollapse', - title: '{{t("Collapse")}}', - Component: 'FilterCollapseBlockInitializer', - useComponentProps() { - const collection = useCollection(); - const toManyField = useMemo( - () => collection.fields.filter((field) => ['hasMany', 'belongsToMany'].includes(field.type)), - [collection.fields], - ); - - return { - filterCollections({ collection }) { - if (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', - }, - ], - }, - ], + ...commonOptions, }, recordBlockInitializers_deprecated, ); diff --git a/packages/core/client/src/schema-initializer/utils.ts b/packages/core/client/src/schema-initializer/utils.ts index e4abb5b84c..79854f6e0e 100644 --- a/packages/core/client/src/schema-initializer/utils.ts +++ b/packages/core/client/src/schema-initializer/utils.ts @@ -110,6 +110,8 @@ export const useTableColumnInitializerFields = () => { .map((field) => { const interfaceConfig = getInterface(field.interface); const isFileCollection = field?.target && getCollection(field?.target)?.template === 'file'; + const isPreviewComponent = field?.uiSchema?.['x-component'] === 'Preview'; + const schema = { name: field.name, 'x-collection-field': `${name}.${field.name}`, @@ -121,7 +123,9 @@ export const useTableColumnInitializerFields = () => { value: 'id', }, } - : {}, + : isPreviewComponent + ? { size: 'small' } + : {}, 'x-read-pretty': isReadPretty || field.uiSchema?.['x-read-pretty'], 'x-decorator': isSubTable ? quickEditField.includes(field.interface) || isFileCollection diff --git a/packages/core/client/src/schema-settings/SchemaSettingsPlugin.ts b/packages/core/client/src/schema-settings/SchemaSettingsPlugin.ts index 46ddbd60c0..83325557e2 100644 --- a/packages/core/client/src/schema-settings/SchemaSettingsPlugin.ts +++ b/packages/core/client/src/schema-settings/SchemaSettingsPlugin.ts @@ -39,6 +39,7 @@ import { markdownBlockSettings } from '../modules/blocks/other-blocks/markdown/m import { cascadeSelectComponentFieldSettings } from '../modules/fields/component/CascadeSelect/cascadeSelectComponentFieldSettings'; import { datePickerComponentFieldSettings } from '../modules/fields/component/DatePicker/datePickerComponentFieldSettings'; import { fileManagerComponentFieldSettings } from '../modules/fields/component/FileManager/fileManagerComponentFieldSettings'; +import { previewComponentFieldSettings } from '../modules/fields/component/FileManager/previewComponentFieldSettings'; import { uploadAttachmentComponentFieldSettings } from '../modules/fields/component/FileManager/uploadAttachmentComponentFieldSettings'; import { inputNumberComponentFieldSettings } from '../modules/fields/component/InputNumber/inputNumberComponentFieldSettings'; import { subformComponentFieldSettings } from '../modules/fields/component/Nester/subformComponentFieldSettings'; @@ -105,5 +106,6 @@ export class SchemaSettingsPlugin extends Plugin { this.schemaSettingsManager.add(tagComponentFieldSettings); this.schemaSettingsManager.add(cascadeSelectComponentFieldSettings); this.schemaSettingsManager.add(uploadAttachmentComponentFieldSettings); + this.schemaSettingsManager.add(previewComponentFieldSettings); } } diff --git a/packages/core/test/src/e2e/e2eUtils.ts b/packages/core/test/src/e2e/e2eUtils.ts index fee2386cf8..78bd753f4a 100644 --- a/packages/core/test/src/e2e/e2eUtils.ts +++ b/packages/core/test/src/e2e/e2eUtils.ts @@ -216,12 +216,12 @@ interface ExtendUtils { /** * @param collectionName 数据表名称 * @param data 自定义的数据,缺失时会生成随机数据 - * @param maxDepth - 生成的数据的最大深度,默认为 4,当不想生成太多数据时可以设置一个较低的值 + * @param maxDepth - 生成的数据的最大深度,默认为 1,当想生成多层级数据时可以设置一个较高的值 */ (collectionName: string, data?: any, maxDepth?: number): Promise; /** * @param collectionName 数据表名称 - * @param maxDepth - 生成的数据的最大深度,默认为 4,当不想生成太多数据时可以设置一个较低的值 + * @param maxDepth - 生成的数据的最大深度,默认为 1,当想生成多层级数据时可以设置一个较高的值 */ (collectionName: string, maxDepth?: number): Promise; }; @@ -232,13 +232,13 @@ interface ExtendUtils { /** * @param collectionName - 数据表名称 * @param count - 生成的数据条数 - * @param maxDepth - 生成的数据的最大深度,默认为 4,当不想生成太多数据时可以设置一个较低的值 + * @param maxDepth - 生成的数据的最大深度,默认为 1,当想生成多层级数据时可以设置一个较高的值 */ (collectionName: string, count?: number, maxDepth?: number): Promise; /** * @param collectionName - 数据表名称 * @param data - 指定生成的数据 - * @param maxDepth - 生成的数据的最大深度,默认为 4,当不想生成太多数据时可以设置一个较低的值 + * @param maxDepth - 生成的数据的最大深度,默认为 1,当想生成多层级数据时可以设置一个较高的值 */ (collectionName: string, data?: any[], maxDepth?: number): Promise; }; diff --git a/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/attachment/schemaSettings.test.ts b/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/attachment/schemaSettings.test.ts index d6fc5b61ec..4a3b3bde06 100644 --- a/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/attachment/schemaSettings.test.ts +++ b/packages/plugins/@nocobase/plugin-collection-manager/src/client/__e2e__/fields/attachment/schemaSettings.test.ts @@ -281,6 +281,7 @@ test.describe('table column & table', () => { await showSettingsMenu(page, 'attachment'); }, supportedOptions: ['Custom column title', 'Column width', 'Delete'], + unsupportedOptions: ['Size'], }); }); }); diff --git a/packages/plugins/@nocobase/plugin-file-manager/src/client/__e2e__/block.test.ts b/packages/plugins/@nocobase/plugin-file-manager/src/client/__e2e__/block.test.ts new file mode 100644 index 0000000000..4718b3e684 --- /dev/null +++ b/packages/plugins/@nocobase/plugin-file-manager/src/client/__e2e__/block.test.ts @@ -0,0 +1,678 @@ +import { expect, test } from '@nocobase/test/e2e'; + +test.describe('file collection block', () => { + test('What blocks are supported', async ({ page, mockPage }) => { + await mockPage({ + collections: [ + { + name: 'files', + template: 'file', + }, + ], + }).goto(); + + const supportedBlocks = async (blockNameList: string[]) => { + for (const blockName of blockNameList) { + await page.getByLabel('schema-initializer-Grid-page:').hover(); + await page.getByRole('menuitem', { name: ` ${blockName} right` }).hover(); + await expect(page.getByRole('menuitem', { name: 'files' })).toBeVisible(); + await page.mouse.move(300, 0); + } + }; + const unsupportedBlocks = async (blockNameList: string[]) => { + for (const blockName of blockNameList) { + await page.getByLabel('schema-initializer-Grid-page:').hover(); + if (blockName === 'Filter form') { + await page.getByRole('menuitem', { name: ` Form right` }).nth(1).hover(); + } else { + await page + .getByRole('menuitem', { name: ` ${blockName} right` }) + .first() + .hover(); + } + await expect(page.getByRole('menuitem', { name: 'files' })).not.toBeVisible(); + await page.mouse.move(300, 0); + } + }; + + await supportedBlocks(['Table', 'List', 'Details', 'Grid Card', 'Map', 'Gantt']); + await unsupportedBlocks(['Form', 'Calendar', 'Kanban', 'Filter form']); + }); + + test('correctly size', async ({ page, mockPage, mockRecord }) => { + const nocoPage = await mockPage({ + collections: [ + { + name: 'files', + template: 'file', + }, + ], + pageSchema: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Page', + 'x-app-version': '0.21.0-alpha.15', + properties: { + wwro4dlw5z4: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'page:addBlock', + 'x-app-version': '0.21.0-alpha.15', + properties: { + rmicwcxvg20: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + properties: { + q1zio1glrlv: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + properties: { + s81y458aw3z: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-decorator': 'TableBlockProvider', + 'x-acl-action': 'files:list', + 'x-use-decorator-props': 'useTableBlockDecoratorProps', + 'x-decorator-props': { + collection: 'files', + dataSource: 'main', + action: 'list', + params: { + pageSize: 20, + }, + rowKey: 'id', + showIndex: true, + dragSort: false, + }, + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:table', + 'x-component': 'CardItem', + 'x-filter-targets': [], + 'x-app-version': '0.21.0-alpha.15', + properties: { + actions: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-initializer': 'table:configureActions', + 'x-component': 'ActionBar', + 'x-component-props': { + style: { + marginBottom: 'var(--nb-spacing)', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + properties: { + '5jd25vufv4c': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-action': 'create', + title: "{{t('Upload')}}", + 'x-designer': 'Action.Designer', + 'x-component': 'Action', + 'x-decorator': 'ACLActionProvider', + 'x-component-props': { + openMode: 'drawer', + type: 'primary', + icon: 'UploadOutlined', + }, + 'x-align': 'right', + 'x-acl-action-props': { + skipScopeCheck: true, + }, + 'x-app-version': '0.21.0-alpha.15', + properties: { + drawer: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + title: '{{ t("Upload files") }}', + 'x-component': 'Action.Container', + 'x-app-version': '0.21.0-alpha.15', + properties: { + upload: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + title: '{{ t("Upload files") }}', + 'x-component': 'Upload.DraggerV2', + 'x-use-component-props': 'useUploadFiles', + 'x-component-props': { + height: '50vh', + multiple: true, + listType: 'picture', + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': '78szpjgvsdd', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'ukcboyk7lvd', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '0ztmt5lqupg', + 'x-async': false, + 'x-index': 1, + }, + fxdalnlkfu2: { + _isJSONSchemaObject: true, + version: '2.0', + title: '{{ t("Refresh") }}', + 'x-action': 'refresh', + 'x-component': 'Action', + 'x-use-component-props': 'useRefreshActionProps', + 'x-toolbar': 'ActionSchemaToolbar', + 'x-settings': 'actionSettings:refresh', + 'x-component-props': { + icon: 'ReloadOutlined', + }, + 'x-align': 'right', + type: 'void', + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'n4wj5dah2q5', + 'x-async': false, + 'x-index': 2, + }, + }, + 'x-uid': 'mv96b9p9evn', + 'x-async': false, + 'x-index': 1, + }, + udpxydv6won: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'array', + 'x-initializer': 'table:configureColumns', + 'x-component': 'TableV2', + 'x-use-component-props': 'useTableBlockProps', + 'x-component-props': { + rowKey: 'id', + rowSelection: { + type: 'checkbox', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + properties: { + actions: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + title: '{{ t("Actions") }}', + 'x-action-column': 'actions', + 'x-decorator': 'TableV2.Column.ActionBar', + 'x-component': 'TableV2.Column', + 'x-designer': 'TableV2.ActionColumnDesigner', + 'x-initializer': 'table:configureItemActions', + 'x-app-version': '0.21.0-alpha.15', + properties: { + e2tsz0ma2tu: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-decorator': 'DndContext', + 'x-component': 'Space', + 'x-component-props': { + split: '|', + }, + 'x-app-version': '0.21.0-alpha.15', + properties: { + pfqfjnvom21: { + 'x-uid': '5nm9q24py65', + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + title: 'View record', + 'x-action': 'view', + 'x-toolbar': 'ActionSchemaToolbar', + 'x-settings': 'actionSettings:view', + 'x-component': 'Action.Link', + 'x-component-props': { + openMode: 'drawer', + danger: false, + }, + 'x-decorator': 'ACLActionProvider', + 'x-designer-props': { + linkageAction: true, + }, + properties: { + drawer: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + title: '{{ t("View record") }}', + 'x-component': 'Action.Container', + 'x-component-props': { + className: 'nb-action-popup', + }, + properties: { + tabs: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Tabs', + 'x-component-props': {}, + 'x-initializer': 'popup:addTab', + properties: { + tab1: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + title: '{{t("Details")}}', + 'x-component': 'Tabs.TabPane', + 'x-designer': 'Tabs.Designer', + 'x-component-props': {}, + properties: { + grid: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'popup:common:addBlock', + properties: { + zfx6jwsh2px: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + properties: { + ctt6x9ye302: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + properties: { + lk6ha5ivn6a: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-acl-action': 'files:get', + 'x-decorator': 'DetailsBlockProvider', + 'x-use-decorator-props': 'useDetailsDecoratorProps', + 'x-decorator-props': { + dataSource: 'main', + collection: 'files', + readPretty: true, + action: 'get', + }, + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:details', + 'x-component': 'CardItem', + 'x-app-version': '0.21.0-alpha.15', + properties: { + oqj95jew00z: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Details', + 'x-read-pretty': true, + 'x-use-component-props': 'useDetailsProps', + 'x-app-version': '0.21.0-alpha.15', + properties: { + rmh89kta0hf: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-initializer': 'details:configureActions', + 'x-component': 'ActionBar', + 'x-component-props': { + style: { + marginBottom: 24, + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'tkbp2h8w1cb', + 'x-async': false, + 'x-index': 1, + }, + grid: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'details:configureFields', + 'x-app-version': '0.21.0-alpha.15', + properties: { + s3f1ea1t2u2: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + properties: { + '7toegj7j80s': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + properties: { + url: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'string', + 'x-toolbar': + 'FormItemSchemaToolbar', + 'x-settings': + 'fieldSettings:FormItem', + 'x-component': + 'CollectionField', + 'x-decorator': 'FormItem', + 'x-collection-field': + 'files.url', + 'x-component-props': {}, + 'x-read-pretty': true, + 'x-app-version': + '0.21.0-alpha.15', + 'x-uid': 'gw6ycf9v9ck', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'ez3kik8rxh5', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'bwlyo0c4lws', + 'x-async': false, + 'x-index': 1, + }, + '70iulv6ohmn': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + properties: { + jbfkqnfdn2t: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + properties: { + preview: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'string', + 'x-toolbar': + 'FormItemSchemaToolbar', + 'x-settings': + 'fieldSettings:FormItem', + 'x-component': + 'CollectionField', + 'x-decorator': 'FormItem', + 'x-collection-field': + 'files.preview', + 'x-component-props': {}, + 'x-read-pretty': true, + 'x-app-version': + '0.21.0-alpha.15', + 'x-uid': 'banact1d7ul', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'j0vyqltznqj', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '1qxmx7wh972', + 'x-async': false, + 'x-index': 2, + }, + ezht5tlzcyo: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + properties: { + ehtzpty1p3n: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + properties: { + title: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'string', + 'x-toolbar': + 'FormItemSchemaToolbar', + 'x-settings': + 'fieldSettings:FormItem', + 'x-component': + 'CollectionField', + 'x-decorator': 'FormItem', + 'x-collection-field': + 'files.title', + 'x-component-props': {}, + 'x-app-version': + '0.21.0-alpha.15', + 'x-uid': 'sfx8flbjouu', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'woyeu6p657c', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '1t97xmqbmmc', + 'x-async': false, + 'x-index': 3, + }, + cous2frggb8: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + properties: { + ujbv7ewhh02: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + properties: { + filename: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'string', + 'x-toolbar': + 'FormItemSchemaToolbar', + 'x-settings': + 'fieldSettings:FormItem', + 'x-component': + 'CollectionField', + 'x-decorator': 'FormItem', + 'x-collection-field': + 'files.filename', + 'x-component-props': {}, + 'x-read-pretty': true, + 'x-app-version': + '0.21.0-alpha.15', + 'x-uid': 'igx2cic3z3s', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'v2262zi9s0y', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'mtsr0vhvhev', + 'x-async': false, + 'x-index': 4, + }, + }, + 'x-uid': 'h9wowg4qxn9', + 'x-async': false, + 'x-index': 2, + }, + }, + 'x-uid': 'abgy70jw6bh', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'd6tclnc3x23', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '0mdhu8myu0t', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'tj8uc5x6zpo', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'pg8y0y4tfec', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '41f7jmnvqfr', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '9vfhihve2qu', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'u877bdnvwkd', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'z4ivtq1l8eu', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'o1jn2s0q214', + 'x-async': false, + 'x-index': 1, + }, + l0n1yivozlj: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-decorator': 'TableV2.Column.Decorator', + 'x-toolbar': 'TableColumnSchemaToolbar', + 'x-settings': 'fieldSettings:TableColumn', + 'x-component': 'TableV2.Column', + 'x-app-version': '0.21.0-alpha.15', + properties: { + preview: { + _isJSONSchemaObject: true, + version: '2.0', + 'x-collection-field': 'files.preview', + 'x-component': 'CollectionField', + 'x-component-props': { + size: 'small', + }, + 'x-read-pretty': true, + 'x-decorator': null, + 'x-decorator-props': { + labelStyle: { + display: 'none', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'qfdgjele52k', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'xupdn9xh709', + 'x-async': false, + 'x-index': 2, + }, + }, + 'x-uid': '1y8n3yv9ldo', + 'x-async': false, + 'x-index': 2, + }, + }, + 'x-uid': 'l6g95h45jvn', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'vmavmabildh', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '4tbjevh15ob', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'wa1dmifukx3', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'wj7bzobpx0q', + 'x-async': true, + 'x-index': 1, + }, + }).waitForInit(); + await mockRecord('files'); + await nocoPage.goto(); + + // 1. Table 中没有 size 选项,并且应该显示小尺寸的图片 + await page.getByRole('button', { name: 'Preview' }).hover(); + await page.getByLabel('designer-schema-settings-TableV2.Column-fieldSettings:TableColumn-files').hover(); + await expect(page.getByRole('menuitem', { name: 'Custom column title' })).toBeVisible(); + await expect(page.getByRole('menuitem', { name: 'Column width' })).toBeVisible(); + await expect(page.getByRole('menuitem', { name: 'Size' })).not.toBeVisible(); + + const imgBox = await page.getByLabel('block-item-CardItem-').locator('.ant-upload-list-item-image').boundingBox(); + expect(imgBox.width).toBeLessThanOrEqual(24); + + // 2. 弹窗中应该可以配置图片尺寸 + await page.getByLabel('action-Action.Link-View').click(); + await page.getByLabel('block-item-CollectionField-files-details-files.preview-Preview').hover(); + await page + .getByLabel('designer-schema-settings-CollectionField-fieldSettings:FormItem-files-files.preview', { + exact: true, + }) + .hover(); + await expect(page.getByRole('menuitem', { name: 'Size' })).toBeVisible(); + }); +}); diff --git a/packages/plugins/@nocobase/plugin-map/src/client/__e2e__/schemaInitializer.test.ts b/packages/plugins/@nocobase/plugin-map/src/client/__e2e__/schemaInitializer.test.ts new file mode 100644 index 0000000000..92f37431fa --- /dev/null +++ b/packages/plugins/@nocobase/plugin-map/src/client/__e2e__/schemaInitializer.test.ts @@ -0,0 +1,50 @@ +import { expect, test } from '@nocobase/test/e2e'; +import { oneTableWithMap } from './templates'; + +test.afterEach(async ({ page }) => { + await page.goto('/admin/settings/map'); + await page.getByRole('button', { name: 'Edit' }).click(); + await page.getByLabel('Access key').clear(); + await page.getByLabel('securityJsCode or serviceHost').clear(); + await page.getByRole('button', { name: 'Save' }).click(); + await expect(page.locator('.ant-message-notice').getByText('Saved successfully')).toBeVisible(); +}); + +test.describe('where map block can be added', () => { + test('page & popup', async ({ page, mockPage }) => { + const nocoPage = await mockPage(oneTableWithMap).waitForInit(); + await nocoPage.goto(); + + // 1. 在页面中添加地图区块,因为没有配置 Access key 等信息,所以会显示错误提示 + await page.getByLabel('schema-initializer-Grid-page:').hover(); + await page.getByRole('menuitem', { name: 'table Map right' }).hover(); + await page.getByRole('menuitem', { name: 'map', exact: true }).click(); + await page.getByRole('button', { name: 'OK', exact: true }).click(); + await expect( + page + .getByLabel('block-item-CardItem-map-map') + .getByText('Please configure the AccessKey and SecurityJsCode first'), + ).toBeVisible(); + + // 2. 点击跳转按钮去配置页面,配置好后返回刚才的页面,应该能正常显示地图 + await page.getByRole('button', { name: 'Go to the configuration page' }).click(); + await page.waitForLoadState('networkidle'); + if (await page.getByRole('button', { name: 'Edit' }).isVisible()) { + await page.getByRole('button', { name: 'Edit' }).click(); + } + await page.getByLabel('Access key').click(); + await page.getByLabel('Access key').fill('9717a70e44273882bcf5489f72b4e261'); + await page.getByLabel('securityJsCode or serviceHost').click(); + await page.getByLabel('securityJsCode or serviceHost').fill('6876ed2d3a6168b75c4fba852e16c99c'); + await page.getByRole('button', { name: 'Save' }).click(); + await expect(page.locator('.ant-message-notice').getByText('Saved successfully')).toBeVisible(); + await nocoPage.goto(); + await expect(page.getByLabel('block-item-CardItem-map-map').locator('.amap-layer')).toBeAttached(); + + // 3. 在弹窗中添加地图区块,应该能正常显示地图 + await page.getByLabel('block-item-CardItem-map-table').getByLabel('action-Action-Add new-create-').click(); + await page.getByLabel('schema-initializer-Grid-form:').hover(); + await page.getByRole('menuitem', { name: 'point' }).click(); + await expect(page.getByLabel('block-item-CollectionField-').locator('.amap-layer')).toBeAttached(); + }); +}); diff --git a/packages/plugins/@nocobase/plugin-map/src/client/__e2e__/schemaSettings.test.ts b/packages/plugins/@nocobase/plugin-map/src/client/__e2e__/schemaSettings.test.ts new file mode 100644 index 0000000000..eef50c82bf --- /dev/null +++ b/packages/plugins/@nocobase/plugin-map/src/client/__e2e__/schemaSettings.test.ts @@ -0,0 +1,52 @@ +import { expect, expectSettingsMenu, test } from '@nocobase/test/e2e'; +import { oneMapUsedToTestSettings } from './templates'; + +test.beforeEach(async ({ page }) => { + await page.goto('/admin/settings/map'); + await page.waitForLoadState('networkidle'); + if (await page.getByRole('button', { name: 'Edit' }).isVisible()) { + await page.getByRole('button', { name: 'Edit' }).click(); + } + await page.getByLabel('Access key').click(); + await page.getByLabel('Access key').fill('9717a70e44273882bcf5489f72b4e261'); + await page.getByLabel('securityJsCode or serviceHost').click(); + await page.getByLabel('securityJsCode or serviceHost').fill('6876ed2d3a6168b75c4fba852e16c99c'); + await page.getByRole('button', { name: 'Save' }).click(); + await expect(page.locator('.ant-message-notice').getByText('Saved successfully')).toBeVisible(); +}); + +test.afterEach(async ({ page }) => { + await page.goto('/admin/settings/map'); + await page.getByRole('button', { name: 'Edit' }).click(); + await page.getByLabel('Access key').clear(); + await page.getByLabel('securityJsCode or serviceHost').clear(); + await page.getByRole('button', { name: 'Save' }).click(); + await expect(page.locator('.ant-message-notice').getByText('Saved successfully')).toBeVisible(); +}); + +test.describe('schema settings', () => { + test('what settings can be used in map block', async ({ page, mockPage }) => { + await mockPage(oneMapUsedToTestSettings).goto(); + + await expectSettingsMenu({ + page, + showMenu: async () => { + await page.getByLabel('block-item-CardItem-map-map').hover(); + await page.getByLabel('designer-schema-settings-CardItem-blockSettings:map-map').hover(); + }, + supportedOptions: [ + 'Edit block title', + 'Fix block', + 'Map field', + 'Marker field', + 'Concatenation order field', + 'Set data loading mode', + 'The default zoom level of the map', + 'Set the data scope', + 'Connect data blocks', + 'Save as template', + 'Delete', + ], + }); + }); +}); diff --git a/packages/plugins/@nocobase/plugin-map/src/client/__e2e__/templates.ts b/packages/plugins/@nocobase/plugin-map/src/client/__e2e__/templates.ts new file mode 100644 index 0000000000..1ed610c755 --- /dev/null +++ b/packages/plugins/@nocobase/plugin-map/src/client/__e2e__/templates.ts @@ -0,0 +1,511 @@ +export const oneTableWithMap = { + collections: [ + { + name: 'map', + fields: [ + { + name: 'point', + interface: 'point', + }, + ], + }, + ], + pageSchema: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Page', + 'x-app-version': '0.21.0-alpha.15', + properties: { + kkw0yhoj2v7: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'page:addBlock', + 'x-app-version': '0.21.0-alpha.15', + properties: { + '9i8fyfb05dd': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + properties: { + '608qygaww2u': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + properties: { + nokibo5w37z: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-decorator': 'TableBlockProvider', + 'x-acl-action': 'map:list', + 'x-use-decorator-props': 'useTableBlockDecoratorProps', + 'x-decorator-props': { + collection: 'map', + dataSource: 'main', + action: 'list', + params: { + pageSize: 20, + }, + rowKey: 'id', + showIndex: true, + dragSort: false, + }, + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:table', + 'x-component': 'CardItem', + 'x-filter-targets': [], + 'x-app-version': '0.21.0-alpha.15', + properties: { + actions: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-initializer': 'table:configureActions', + 'x-component': 'ActionBar', + 'x-component-props': { + style: { + marginBottom: 'var(--nb-spacing)', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + properties: { + uip6al0wpnq: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-action': 'create', + 'x-acl-action': 'create', + title: "{{t('Add new')}}", + 'x-toolbar': 'ActionSchemaToolbar', + 'x-settings': 'actionSettings:addNew', + 'x-component': 'Action', + 'x-decorator': 'ACLActionProvider', + 'x-component-props': { + openMode: 'drawer', + type: 'primary', + component: 'CreateRecordAction', + icon: 'PlusOutlined', + }, + 'x-align': 'right', + 'x-acl-action-props': { + skipScopeCheck: true, + }, + 'x-app-version': '0.21.0-alpha.15', + properties: { + drawer: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + title: '{{ t("Add record") }}', + 'x-component': 'Action.Container', + 'x-component-props': { + className: 'nb-action-popup', + }, + 'x-app-version': '0.21.0-alpha.15', + properties: { + tabs: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Tabs', + 'x-component-props': {}, + 'x-initializer': 'popup:addTab', + 'x-initializer-props': { + gridInitializer: 'popup:addNew:addBlock', + }, + 'x-app-version': '0.21.0-alpha.15', + properties: { + tab1: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + title: '{{t("Add new")}}', + 'x-component': 'Tabs.TabPane', + 'x-designer': 'Tabs.Designer', + 'x-component-props': {}, + 'x-app-version': '0.21.0-alpha.15', + properties: { + grid: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'popup:addNew:addBlock', + 'x-app-version': '0.21.0-alpha.15', + properties: { + kb4pfm2qld1: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + properties: { + hoexd0g3zng: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + properties: { + '3dmeorgypjr': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-acl-action-props': { + skipScopeCheck: true, + }, + 'x-acl-action': 'map:create', + 'x-decorator': 'FormBlockProvider', + 'x-use-decorator-props': 'useCreateFormBlockDecoratorProps', + 'x-decorator-props': { + dataSource: 'main', + collection: 'map', + }, + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:createForm', + 'x-component': 'CardItem', + 'x-app-version': '0.21.0-alpha.15', + properties: { + '8ijqvnv7ipr': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'FormV2', + 'x-use-component-props': 'useCreateFormBlockProps', + 'x-app-version': '0.21.0-alpha.15', + properties: { + grid: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'form:configureFields', + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'nhb5ckrojg8', + 'x-async': false, + 'x-index': 1, + }, + cn3spxefyf0: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-initializer': 'createForm:configureActions', + 'x-component': 'ActionBar', + 'x-component-props': { + layout: 'one-column', + style: { + marginTop: 24, + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'rowvzprfdip', + 'x-async': false, + 'x-index': 2, + }, + }, + 'x-uid': 't3zwje8con4', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'hzqxhqtd8md', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'q6urn5p0yw4', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '5209bo4teha', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '50pylphuf3x', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '45exb2qrbi9', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'ut9rhesppap', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'aiwsk6sq0wx', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'f04owvm9t0f', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'nmpjxsgfxgc', + 'x-async': false, + 'x-index': 1, + }, + fll1bh8w93y: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'array', + 'x-initializer': 'table:configureColumns', + 'x-component': 'TableV2', + 'x-use-component-props': 'useTableBlockProps', + 'x-component-props': { + rowKey: 'id', + rowSelection: { + type: 'checkbox', + }, + }, + 'x-app-version': '0.21.0-alpha.15', + properties: { + actions: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + title: '{{ t("Actions") }}', + 'x-action-column': 'actions', + 'x-decorator': 'TableV2.Column.ActionBar', + 'x-component': 'TableV2.Column', + 'x-designer': 'TableV2.ActionColumnDesigner', + 'x-initializer': 'table:configureItemActions', + 'x-app-version': '0.21.0-alpha.15', + properties: { + qyh8y3u567i: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-decorator': 'DndContext', + 'x-component': 'Space', + 'x-component-props': { + split: '|', + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'suuyf9afqcg', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'l49nwyyppfy', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'vrdlfpoa7c6', + 'x-async': false, + 'x-index': 2, + }, + }, + 'x-uid': 'ifxjep3ugit', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'tnw8n4rbwhh', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'yrjjp3jl2rg', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'sp05st5arhk', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '4h4z7pw7j7v', + 'x-async': true, + 'x-index': 1, + }, +}; +export const oneMapUsedToTestSettings = { + collections: [ + { + name: 'map', + fields: [ + { + name: 'point', + interface: 'point', + }, + ], + }, + ], + pageSchema: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Page', + properties: { + '8d5kk0rt54w': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'page:addBlock', + properties: { + '8sia51xaucx': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Row', + 'x-app-version': '0.21.0-alpha.15', + properties: { + elij0klumzf: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid.Col', + 'x-app-version': '0.21.0-alpha.15', + properties: { + '05gsh93kbeg': { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-acl-action': 'map:list', + 'x-decorator': 'MapBlockProvider', + 'x-decorator-props': { + collection: 'map', + dataSource: 'main', + action: 'list', + fieldNames: { + field: ['point'], + }, + params: { + paginate: false, + }, + }, + 'x-toolbar': 'BlockSchemaToolbar', + 'x-settings': 'blockSettings:map', + 'x-component': 'CardItem', + 'x-filter-targets': [], + 'x-app-version': '0.21.0-alpha.15', + properties: { + actions: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-initializer': 'map:configureActions', + 'x-component': 'ActionBar', + 'x-component-props': { + style: { + marginBottom: 16, + }, + }, + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'je3ohoqzqt6', + 'x-async': false, + 'x-index': 1, + }, + vdsw8i32n94: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'MapBlock', + 'x-use-component-props': 'useMapBlockProps', + 'x-app-version': '0.21.0-alpha.15', + properties: { + drawer: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Action.Drawer', + 'x-component-props': { + className: 'nb-action-popup', + }, + title: '{{ t("View record") }}', + 'x-app-version': '0.21.0-alpha.15', + properties: { + tabs: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Tabs', + 'x-component-props': {}, + 'x-initializer': 'popup:addTab', + 'x-app-version': '0.21.0-alpha.15', + properties: { + tab1: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + title: '{{t("Details")}}', + 'x-component': 'Tabs.TabPane', + 'x-designer': 'Tabs.Designer', + 'x-component-props': {}, + 'x-app-version': '0.21.0-alpha.15', + properties: { + grid: { + _isJSONSchemaObject: true, + version: '2.0', + type: 'void', + 'x-component': 'Grid', + 'x-initializer': 'popup:common:addBlock', + 'x-app-version': '0.21.0-alpha.15', + 'x-uid': 'g5d6t1hpvo8', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'hq5j3w8d8db', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'x0ne9tq1bdf', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'micohua87kv', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'e7hfatz8fxx', + 'x-async': false, + 'x-index': 2, + }, + }, + 'x-uid': 'g2n2rqidaem', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'zmrjvgpsgeh', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'q81voyltwkn', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': 'lyadz9knnnm', + 'x-async': false, + 'x-index': 1, + }, + }, + 'x-uid': '5b3qaiczmyv', + 'x-async': true, + 'x-index': 1, + }, +};