tachybase_todo/packages/plugins/export/src/client/ExportInitializerProvider.tsx
SemmyWong d831a9b889
feat: plugin export (#479)
* feat: init export plugin

* feat: add client export

* fix: fix the word spell

* feat: export plugin done

* feat: init export plugin

* feat: add client export

* fix: fix the word spell

* feat: export plugin done

* ci: change plugin-export version

* refactor: renders add ctx params

* fix: fix select and multipleSelect export

* fix: array convert string

* refactor: move SchemaInitializerPluginProvider

* fix: build error

* fix: change umijs config

* fix: update SchemaInitializerPluginProvider

* fix: import server

* fix: fix some bug

* fix: fix some bug

* refactor: export plugin refactor

* refactor: create all export fields by default

* fix: fix export plugin bug

* fix(plugin-collection-manager): uiSchema toJSON

* fix: update yarn.lock

* fix: fix init fields bug

* refactor: enum params pass by client

* fix: fix export table header title

* refactor: refactor dataIndex

* fix: fix dataIndex maybe complex object

* fix: add checkboxGroup in export plugin

* fix: add checkbox and i18n

* feat: improve code

Co-authored-by: chenos <chenlinxh@gmail.com>
2022-06-14 15:01:53 +08:00

24 lines
771 B
TypeScript

import { SchemaInitializerContext } from '@nocobase/client';
import { useContext } from 'react';
export const ExportInitializerProvider = (props: any) => {
const initializes = useContext(SchemaInitializerContext);
const hasExportAction = initializes.TableActionInitializers.items[0].children.some(
(initialize) => initialize.component === 'ExportActionInitializer',
);
!hasExportAction &&
initializes.TableActionInitializers.items[0].children.push({
type: 'item',
title: "{{t('Export')}}",
component: 'ExportActionInitializer',
schema: {
'x-align': 'right',
'x-decorator': 'ACLActionProvider',
'x-acl-action-props': {
skipScopeCheck: true,
},
},
});
return props.children;
};