mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 14:26:36 +00:00
feat: use 'createForm:configureActions' in page
This commit is contained in:
parent
81c9032d63
commit
1b71763acf
@ -61,7 +61,7 @@ test.describe('configure actions', () => {
|
||||
test('submit', async ({ page, mockPage }) => {
|
||||
await mockPage(oneEmptyForm).goto();
|
||||
|
||||
await page.getByLabel('schema-initializer-ActionBar-actionInitializers:form-general').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-createForm:configureActions-general').hover();
|
||||
|
||||
// add button
|
||||
await page.getByRole('menuitem', { name: 'Submit' }).click();
|
||||
@ -71,7 +71,7 @@ test.describe('configure actions', () => {
|
||||
await expect(page.getByRole('button', { name: 'Submit' })).toBeVisible();
|
||||
|
||||
// delete button
|
||||
await page.getByLabel('schema-initializer-ActionBar-actionInitializers:form-general').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-createForm:configureActions-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'Submit' }).click();
|
||||
await expect(page.getByRole('menuitem', { name: 'Submit' }).getByRole('switch')).not.toBeChecked();
|
||||
|
||||
@ -104,7 +104,7 @@ test.describe('configure actions', () => {
|
||||
test('customize: save record', async ({ page, mockPage }) => {
|
||||
await mockPage(oneEmptyForm).goto();
|
||||
|
||||
await page.getByLabel('schema-initializer-ActionBar-actionInitializers:form-general').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-createForm:configureActions-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'Customize' }).hover();
|
||||
await page.getByRole('menuitem', { name: 'Save record' }).click();
|
||||
|
||||
|
@ -810,7 +810,7 @@ test.describe('creation form block schema settings', () => {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'actionInitializers:form',
|
||||
'x-initializer': 'createForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
|
@ -235,7 +235,7 @@ export const T2165 = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'actionInitializers:form',
|
||||
'x-initializer': 'createForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
@ -5181,7 +5181,7 @@ export const T3106: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'actionInitializers:form',
|
||||
'x-initializer': 'createForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
@ -5442,7 +5442,7 @@ export const T3251: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'actionInitializers:form',
|
||||
'x-initializer': 'createForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer';
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* 表单的操作配置
|
||||
*/
|
||||
export const formActionInitializers_deprecated = new CompatibleSchemaInitializer({
|
||||
export const formActionInitializers = new SchemaInitializer({
|
||||
name: 'FormActionInitializers',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
@ -47,50 +47,3 @@ export const formActionInitializers_deprecated = new CompatibleSchemaInitializer
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const formActionInitializers = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'actionInitializers:form',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
items: [
|
||||
{
|
||||
type: 'itemGroup',
|
||||
name: 'enableActions',
|
||||
title: '{{t("Enable actions")}}',
|
||||
children: [
|
||||
{
|
||||
name: 'submit',
|
||||
title: '{{t("Submit")}}',
|
||||
Component: 'CreateSubmitActionInitializer',
|
||||
schema: {
|
||||
'x-action-settings': {},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'divider',
|
||||
type: 'divider',
|
||||
},
|
||||
{
|
||||
name: 'custom',
|
||||
type: 'subMenu',
|
||||
title: '{{t("Customize")}}',
|
||||
children: [
|
||||
{
|
||||
name: 'saveRecord',
|
||||
title: '{{t("Save record")}}',
|
||||
Component: 'SaveRecordActionInitializer',
|
||||
},
|
||||
{
|
||||
name: 'customRequest',
|
||||
title: '{{t("Custom request")}}',
|
||||
Component: 'CustomRequestInitializer',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
formActionInitializers_deprecated,
|
||||
);
|
||||
|
@ -44,10 +44,7 @@ import {
|
||||
createFormActionInitializers,
|
||||
createFormActionInitializers_deprecated,
|
||||
} from '../modules/blocks/data-blocks/form/createFormActionInitializers';
|
||||
import {
|
||||
formActionInitializers,
|
||||
formActionInitializers_deprecated,
|
||||
} from '../modules/blocks/data-blocks/form/formActionInitializers';
|
||||
import { formActionInitializers } from '../modules/blocks/data-blocks/form/formActionInitializers';
|
||||
import {
|
||||
formItemInitializers,
|
||||
formItemInitializers_deprecated,
|
||||
@ -188,7 +185,6 @@ export class SchemaInitializerPlugin extends Plugin {
|
||||
this.app.schemaInitializerManager.add(tableActionColumnInitializers);
|
||||
this.app.schemaInitializerManager.add(formItemInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(formItemInitializers);
|
||||
this.app.schemaInitializerManager.add(formActionInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(formActionInitializers);
|
||||
this.app.schemaInitializerManager.add(detailsActionInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(detailsActionInitializers);
|
||||
|
@ -1114,7 +1114,7 @@ export const createGridCardBlockSchema = (options) => {
|
||||
export const createFormBlockSchema = (options) => {
|
||||
const {
|
||||
formItemInitializers = 'form:configureFields',
|
||||
actionInitializers = 'actionInitializers:form',
|
||||
actionInitializers = 'createForm:configureActions',
|
||||
collection,
|
||||
resource,
|
||||
dataSource,
|
||||
|
@ -349,7 +349,7 @@ export const oneEmptyForm: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'actionInitializers:form',
|
||||
'x-initializer': 'createForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
@ -459,7 +459,7 @@ export const oneEmptyFormWithActions: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'actionInitializers:form',
|
||||
'x-initializer': 'createForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
@ -2182,7 +2182,7 @@ export const oneTableBlockWithActionsAndFormBlocks: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'actionInitializers:form',
|
||||
'x-initializer': 'createForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
@ -3042,7 +3042,7 @@ export const oneFormBlockWithRolesFieldBasedUsers: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'actionInitializers:form',
|
||||
'x-initializer': 'createForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
@ -3671,7 +3671,7 @@ export const oneFormBlockWithAllAssociationFieldsAndSelectorMode: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'actionInitializers:form',
|
||||
'x-initializer': 'createForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
@ -14999,7 +14999,7 @@ export const oneFormWithMultiLevelAssociationFields: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'actionInitializers:form',
|
||||
'x-initializer': 'createForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
@ -15316,7 +15316,7 @@ export const oneSubformWithMultiLevelAssociationFields: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'actionInitializers:form',
|
||||
'x-initializer': 'createForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
@ -18712,7 +18712,7 @@ export const oneFormBlockBasedOnUsers: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'actionInitializers:form',
|
||||
'x-initializer': 'createForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
|
Loading…
Reference in New Issue
Block a user