Zeke Zhang ec558e3b98
refactor: flatten and merge Actions (#4336)
* chore: remove switch

* refactor: ensure compatibility with old code

* refactor: flatten Actions

* refactor: extract options

* refactor: remove isCusomeizeCreate

* refactor: merge addNew and addRecord actions

* refactor: merge Submit and Save record actions

* refactor: extract common options

* feat: add tow props called 'currentText' and 'otherText'

* chore: fix failed tests

* refactor: add ActionInitializerItem to replace ActionInitializer

* chore: fix failed tests

* fix: fix T-4284

* fix: fix inherit

* chore: fix failed test

* chore: add Switch

* chore: add Switch for delete button

* test: e2ePageObjectModel

---------

Co-authored-by: hongboji <j414562100@qq.com>
2024-05-17 09:37:23 +08:00

98 lines
2.3 KiB
TypeScript

/**
* This file is part of the NocoBase (R) project.
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
* Authors: NocoBase Team.
*
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
import { CompatibleSchemaInitializer, SchemaInitializer, gridRowColWrap } from '@nocobase/client';
import { CreateFormBulkEditBlockInitializer } from './CreateFormBulkEditBlockInitializer';
/**
* @deprecated
* 之所以还保留,仅是为了兼容旧版 schema
*/
export const CreateFormBulkEditBlockInitializers: SchemaInitializer = new SchemaInitializer({
name: 'CreateFormBulkEditBlockInitializers',
wrap: gridRowColWrap,
title: '{{t("Add block")}}',
icon: 'PlusOutlined',
items: [
{
type: 'itemGroup',
title: '{{t("Data blocks")}}',
name: 'dataBlocks',
children: [
{
name: 'form',
title: '{{t("Form")}}',
Component: CreateFormBulkEditBlockInitializer,
},
],
},
{
type: 'itemGroup',
title: '{{t("Other blocks")}}',
name: 'otherBlocks',
children: [
{
name: 'markdown',
title: '{{t("Markdown")}}',
Component: 'MarkdownBlockInitializer',
},
],
},
],
});
const commonOptions = {
wrap: gridRowColWrap,
title: '{{t("Add block")}}',
icon: 'PlusOutlined',
items: [
{
type: 'itemGroup',
title: '{{t("Data blocks")}}',
name: 'dataBlocks',
children: [
{
name: 'form',
title: '{{t("Form")}}',
Component: CreateFormBulkEditBlockInitializer,
},
],
},
{
type: 'itemGroup',
title: '{{t("Other blocks")}}',
name: 'otherBlocks',
children: [
{
name: 'markdown',
title: '{{t("Markdown")}}',
Component: 'MarkdownBlockInitializer',
},
],
},
],
};
/**
* @deprecated
* use `bulkEditBlockInitializers` instead
*/
export const BulkEditBlockInitializers_deprecated = new CompatibleSchemaInitializer({
name: 'BulkEditBlockInitializers',
...commonOptions,
});
export const bulkEditBlockInitializers = new CompatibleSchemaInitializer(
{
name: 'popup:bulkEdit:addBlock',
...commonOptions,
},
BulkEditBlockInitializers_deprecated,
);