fix: missing toolbar props (#4291)

This commit is contained in:
chenos 2024-05-08 23:47:11 +08:00 committed by GitHub
parent 8de00afd12
commit 1604a4fdb6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 13 deletions

View File

@ -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 (
<SchemaToolbar
initializer={false}
showBorder={false}
showBackground
{...props}
{...fieldSchema['x-toolbar-props']}
/>
);
return <SchemaToolbar initializer={false} showBorder={false} showBackground {...props} />;
};

View File

@ -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'];

View File

@ -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', () => {

View File

@ -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) => <span>{props.title}</span>;
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,
});