tachybase_todo/packages/plugins/@tachybase/plugin-custom-request/src/client/schemaSettings.ts
wjh c3c8b5b655 feat: 添加下载文档和显示数据按钮 (#1370)
Reviewed-on: daoyoucloud/tachybase#1370
Co-authored-by: wjh <wwwjh0710@163.com>
Co-committed-by: wjh <wwwjh0710@163.com>
2024-07-25 10:53:27 +08:00

88 lines
2.0 KiB
TypeScript

import {
AfterSuccess,
ButtonEditor,
IsDownLoad,
RemoveButton,
SchemaSettings,
SchemaSettingsLinkageRules,
SecondConFirm,
SettingDownTitle,
ShowData,
useCollection,
useSchemaToolbar,
} from '@tachybase/client';
import { useFieldSchema } from '@tachybase/schema';
import { CustomRequestACL, CustomRequestSettingsItem } from './components/CustomRequestActionDesigner';
export const customizeCustomRequestActionSettings = new SchemaSettings({
name: 'actionSettings:customRequest',
items: [
{
name: 'editButton',
Component: ButtonEditor,
useComponentProps() {
const { buttonEditorProps } = useSchemaToolbar();
return {
isLink: true,
...buttonEditorProps,
};
},
},
{
name: 'linkageRules',
Component: SchemaSettingsLinkageRules,
useComponentProps() {
const { name } = useCollection();
const { linkageRulesProps } = useSchemaToolbar();
return {
...linkageRulesProps,
collectionName: name,
};
},
},
{
name: 'secondConFirm',
Component: SecondConFirm,
},
{
name: 'isDownLoad',
Component: IsDownLoad,
},
{
name: 'settingDownTitle',
Component: SettingDownTitle,
useVisible() {
const fieldSchema = useFieldSchema();
const down = fieldSchema?.['x-action-settings']?.onSuccess?.down;
return down;
},
},
{
name: 'showData',
Component: ShowData,
},
{
name: 'afterSuccessfulSubmission',
Component: AfterSuccess,
},
{
name: 'request settings',
Component: CustomRequestSettingsItem,
},
{
name: 'accessControl',
Component: CustomRequestACL,
},
{
name: 'delete',
sort: 100,
Component: RemoveButton as any,
useComponentProps() {
const { removeButtonProps } = useSchemaToolbar();
return removeButtonProps;
},
},
],
});