diff --git a/packages/core/client/src/modules/actions/ActionSchemaToolbar.tsx b/packages/core/client/src/modules/actions/ActionSchemaToolbar.tsx index 3435f5b824..eacda1c5c5 100644 --- a/packages/core/client/src/modules/actions/ActionSchemaToolbar.tsx +++ b/packages/core/client/src/modules/actions/ActionSchemaToolbar.tsx @@ -7,19 +7,9 @@ * For more information, please refer to: https://www.nocobase.com/agreement. */ -import { useFieldSchema } from '@formily/react'; import React from 'react'; import { SchemaToolbar } from '../../schema-settings/GeneralSchemaDesigner'; export const ActionSchemaToolbar = (props) => { - const fieldSchema = useFieldSchema(); - return ( - - ); + return ; }; diff --git a/packages/core/client/src/schema-component/antd/action/Action.tsx b/packages/core/client/src/schema-component/antd/action/Action.tsx index ff9768fac1..9d5ddc1814 100644 --- a/packages/core/client/src/schema-component/antd/action/Action.tsx +++ b/packages/core/client/src/schema-component/antd/action/Action.tsx @@ -82,7 +82,7 @@ export const Action: ComposedAction = withDynamicSchemaProps( const recordData = useCollectionRecordData(); const parentRecordData = useCollectionParentRecordData(); const collection = useCollection(); - const designerProps = fieldSchema['x-designer-props']; + const designerProps = fieldSchema['x-toolbar-props'] || fieldSchema['x-designer-props']; const openMode = fieldSchema?.['x-component-props']?.['openMode']; const openSize = fieldSchema?.['x-component-props']?.['openSize']; const refreshDataBlockRequest = fieldSchema?.['x-component-props']?.['refreshDataBlockRequest']; diff --git a/packages/core/client/src/schema-component/antd/action/__tests__/Action.Designer.test.tsx b/packages/core/client/src/schema-component/antd/action/__tests__/Action.Designer.test.tsx index 3c47e349ae..2dd8a59f09 100644 --- a/packages/core/client/src/schema-component/antd/action/__tests__/Action.Designer.test.tsx +++ b/packages/core/client/src/schema-component/antd/action/__tests__/Action.Designer.test.tsx @@ -7,7 +7,7 @@ * For more information, please refer to: https://www.nocobase.com/agreement. */ -import { screen, checkSettings, renderSingleSettings, checkModalSetting } from '@nocobase/test/client'; +import { checkModalSetting, renderSingleSettings } from '@nocobase/test/client'; import { ButtonEditor } from '../Action.Designer'; describe('Action.Designer', () => { diff --git a/packages/core/client/src/schema-component/antd/action/demos/new-demos/schema-toolbar.tsx b/packages/core/client/src/schema-component/antd/action/demos/new-demos/schema-toolbar.tsx index e9e7dd48a6..88825b5d7d 100644 --- a/packages/core/client/src/schema-component/antd/action/demos/new-demos/schema-toolbar.tsx +++ b/packages/core/client/src/schema-component/antd/action/demos/new-demos/schema-toolbar.tsx @@ -9,6 +9,7 @@ import { SchemaSettings } from '@nocobase/client'; import { getAppComponent } from '@nocobase/test/web'; +import React from 'react'; const myActionSettings = new SchemaSettings({ name: 'myActionSettings', @@ -20,6 +21,8 @@ const myActionSettings = new SchemaSettings({ ], }); +const MyToolbar = (props) => {props.title}; + const App = getAppComponent({ schema: { type: 'void', @@ -60,12 +63,23 @@ const App = getAppComponent({ 'x-align': 'left', 'x-settings': 'myActionSettings', }, + a5: { + title: '', + 'x-component': 'Action', + 'x-action': 'a5', + 'x-align': 'left', + 'x-toolbar': 'MyToolbar', + 'x-toolbar-props': { + title: 'MyTitle', + }, + }, }, }, }, }, appOptions: { schemaSettings: [myActionSettings], + components: { MyToolbar }, }, designable: true, });