From 60d669bd24570be39e26c705fc66212af0e72044 Mon Sep 17 00:00:00 2001 From: chenos Date: Mon, 26 Dec 2022 13:45:04 +0800 Subject: [PATCH] feat(demos): action bar Initializer example --- .../antd/action/demos/demo6.tsx | 86 +++++++++++++++++++ .../src/schema-component/antd/action/index.md | 4 + 2 files changed, 90 insertions(+) create mode 100644 packages/core/client/src/schema-component/antd/action/demos/demo6.tsx diff --git a/packages/core/client/src/schema-component/antd/action/demos/demo6.tsx b/packages/core/client/src/schema-component/antd/action/demos/demo6.tsx new file mode 100644 index 000000000..d6e5ac3a3 --- /dev/null +++ b/packages/core/client/src/schema-component/antd/action/demos/demo6.tsx @@ -0,0 +1,86 @@ +import { ISchema } from '@formily/react'; +import { uid } from '@formily/shared'; +import { + Action, + ActionBar, + SchemaComponent, + SchemaComponentProvider, + SchemaInitializer, + SchemaInitializerProvider +} from '@nocobase/client'; +import React from 'react'; + +export const AddActionButton = (props: any) => { + const { insertPosition, component } = props; + return ( + + ); +}; + +const schema: ISchema = { + type: 'object', + properties: { + actions: { + type: 'void', + 'x-component': 'ActionBar', + 'x-initializer': 'AddActionButton', + 'x-uid': uid(), + properties: { + a1: { + title: 'Action 1', + 'x-component': 'Action', + 'x-action': 'action1', + 'x-align': 'left', + }, + }, + }, + }, +}; + +export default function App() { + return ( + + + + + + ); +} diff --git a/packages/core/client/src/schema-component/antd/action/index.md b/packages/core/client/src/schema-component/antd/action/index.md index 539e33fe0..29d8079a4 100644 --- a/packages/core/client/src/schema-component/antd/action/index.md +++ b/packages/core/client/src/schema-component/antd/action/index.md @@ -42,3 +42,7 @@ group: + +### ActionBar + +