refactor(SchemaInitializers): unify naming style (#3604)
* refactor(SchemaSettings): unify naming style * refactor(SchemaInitializers): unify naming stle * refactor: replace CreateFormBlockInitializers to blockInitializers:createForm * refactor: replace to blockInitializers:customizeCreateForm * refactor: replace block intializers name * refactor: replace action initializers name * refactor: replace field initializers name * style: fix hover style for column action (T-3297) * refactor: revert some codes * chore: update comment * chore: replace iframeBlockSchemaSettings to blockSettings:iframe * chore: delete pro-packages * feat: add CompatibleSchemaInitializer * test: add unit tests * chore: add @internal for CompatibleSchemaInitializer * chore: block * chore: field * chore: ations * fix: build * chore: typo * fix: fix unit tests * test: fix e2e * chore: remove igone * refactor: page:addBlock * refactor: popup:addNew:addBlock * fix: fix max call stack * refactor: popup:addRecord:addBlock * refactor: remove blockInitializers:recordForm * refactor: popup:tableSelector:addBlock * refactor: popup:view:addBlock * refactor: popup:bulkEdit:addBlock & charts:addBlock * refactor: mobilePage:addBlock * refactor: popup:snapshot:addBlock * refactor: popup:workflowManual:configureUserInterface:addBlock * fix: avoid crashing * chore: optimize * refactor: popup:common:addBlock * refactor: workflowManual:popup:configureUserInterface:addBlock * refactor: details:configureFields * refactor: form:configureFields * refactor: table:configureColumns * refactor: filterForm:configureFields * refactor: associationFilterInitializer * refactor: assignFieldValuesForm:configureFields * refactor: bulkEditForm:configureFields * refactor: auditLogsTable:configureColumns * refactor: chartFilterForm:configureFields * refactor: kanban:configureItemFields * refactor: workflowManual:customForm:configureFields * refactor: detailsWithPaging:configureActions * refactor: details:configureActions * refactor: createForm:configureActions * refactor: editForm:configureActions * refactor: gridCard:configureActions * refactor: gridCard:configureItemActions * refactor: list:configureActions * refactor: list:configureItemActions * refactor: table:configureItemActions * refactor: table:configureActions * refactor: filterForm:configureActions * refactor: subTable:configureActions * refactor: bulkEditForm:configureActions * refactor: auditLogsTable:configureItemActions * refactor: auditLogsTable:configureActions * refactor: calendar:configureActions * refactor: chartFilterForm:configureActions * refactor: gantt:configureActions * refactor: kanban:configureActions * refactor: map:configureActions * refactor: workflowManual:form:configureActions * feat: use 'createForm:configureActions' in page * feat: use 'details:configureActions' in Calendar * feat: register deleteEvent initializer in calendar plugin * fix: fix delete event action * test: fix e2e * test: fix e2e * chore: only run workflow's e2e * Revert "chore: only run workflow's e2e" This reverts commit 9e5b4af41e40e8d616007a5ab97291fb2370d88a. * fix: use isInitializersSame to fix some case
This commit is contained in:
parent
ca01bdc306
commit
51de34251a
@ -0,0 +1,66 @@
|
||||
import { CompatibleSchemaInitializer, isInitializersSame } from '../schema-initializer/CompatibleSchemaInitializer';
|
||||
|
||||
describe('CompatibleSchemaInitializer', () => {
|
||||
it('should synchronize add operations between instances', () => {
|
||||
const first = new CompatibleSchemaInitializer({ type: 'item', items: [], name: 'firstSchema' });
|
||||
const second = new CompatibleSchemaInitializer({ type: 'item', items: [], name: 'secondSchema' }, first);
|
||||
first.add('item1', { type: 'item', test: true });
|
||||
expect(second.items).toContainEqual({ type: 'item', name: 'item1', test: true });
|
||||
expect(first.items).toContainEqual({ type: 'item', name: 'item1', test: true });
|
||||
});
|
||||
|
||||
it('should synchronize remove operations between instances', () => {
|
||||
const first = new CompatibleSchemaInitializer({
|
||||
type: 'item',
|
||||
items: [{ type: 'item', name: 'toRemove', test: true }],
|
||||
name: 'firstSchema',
|
||||
});
|
||||
const second = new CompatibleSchemaInitializer(
|
||||
{ type: 'item', items: [{ type: 'item', name: 'toRemove', test: true }], name: 'secondSchema' },
|
||||
first,
|
||||
);
|
||||
first.remove('toRemove');
|
||||
expect(first.items).not.toContainEqual({ type: 'item', name: 'toRemove', test: true });
|
||||
expect(second.items).not.toContainEqual({ type: 'item', name: 'toRemove', test: true });
|
||||
});
|
||||
});
|
||||
|
||||
describe('isInitializersSame', () => {
|
||||
test('should return true for matching old and new names directly', () => {
|
||||
expect(isInitializersSame('page:addBlock', 'page:addBlock')).toBeTruthy();
|
||||
});
|
||||
|
||||
test('should return true for an old name matching a new name via the mapping', () => {
|
||||
expect(isInitializersSame('BlockInitializers', 'page:addBlock')).toBeTruthy();
|
||||
});
|
||||
|
||||
test('should return false when old name does not match and is not found in mapping', () => {
|
||||
expect(isInitializersSame('NonExistentInitializer', 'page:addBlock')).toBeFalsy();
|
||||
});
|
||||
|
||||
test('should handle case where old name is in the map but does not match the new name', () => {
|
||||
expect(isInitializersSame('BlockInitializers', 'mobilePage:addBlock')).toBeFalsy();
|
||||
});
|
||||
|
||||
test('should return true for complex name structures that match through the mapping', () => {
|
||||
expect(isInitializersSame('CreateFormBlockInitializers', 'popup:addNew:addBlock')).toBeTruthy();
|
||||
});
|
||||
|
||||
test('should return false for complex name structures that do not match any new name', () => {
|
||||
expect(isInitializersSame('CreateFormBlockInitializers', 'nonExistentAction')).toBeFalsy();
|
||||
});
|
||||
|
||||
test('should return true for new names that match directly and are not in the mapping', () => {
|
||||
expect(isInitializersSame('unmappedNewInitializer:action', 'unmappedNewInitializer:action')).toBeTruthy();
|
||||
});
|
||||
|
||||
test('should return false for old names trying to match to unrelated new names', () => {
|
||||
expect(isInitializersSame('BlockInitializers', 'unrelatedNewInitializer:action')).toBeFalsy();
|
||||
});
|
||||
|
||||
test('should handle empty strings', () => {
|
||||
expect(isInitializersSame('', '')).toBeTruthy();
|
||||
expect(isInitializersSame('', 'page:addBlock')).toBeFalsy();
|
||||
expect(isInitializersSame('BlockInitializers', '')).toBeFalsy();
|
||||
});
|
||||
});
|
@ -0,0 +1,74 @@
|
||||
import { SchemaInitializer } from '../schema-initializer/SchemaInitializer';
|
||||
|
||||
describe('SchemaInitializer', () => {
|
||||
it('should initialize with default items when no options provided', () => {
|
||||
const schema = new SchemaInitializer({ name: 'schema0' });
|
||||
expect(schema.items).toEqual([]);
|
||||
});
|
||||
|
||||
it('should initialize with provided items', () => {
|
||||
const schema = new SchemaInitializer({ type: 'item', items: [{ name: 'test', type: 'item' }], name: 'schema1' });
|
||||
expect(schema.items).toEqual([{ type: 'item', name: 'test' }]);
|
||||
});
|
||||
|
||||
it('should add item with unique name', () => {
|
||||
const schema = new SchemaInitializer({ items: [], name: 'schema2' });
|
||||
schema.add('item1', { type: 'item', test: true });
|
||||
expect(schema.items).toContainEqual({ type: 'item', name: 'item1', test: true });
|
||||
});
|
||||
|
||||
it('should replace item with same name', () => {
|
||||
const schema = new SchemaInitializer({
|
||||
type: 'item',
|
||||
items: [{ type: 'item', name: 'item1', test: false }],
|
||||
name: 'schema3',
|
||||
});
|
||||
schema.add('item1', { type: 'item', test: true });
|
||||
expect(schema.items).toContainEqual({ type: 'item', name: 'item1', test: true });
|
||||
expect(schema.items.length).toBe(1);
|
||||
});
|
||||
|
||||
it('should add children to the specified parent item', () => {
|
||||
const schema = new SchemaInitializer({
|
||||
type: 'item',
|
||||
items: [{ type: 'item', name: 'parent', children: [] }],
|
||||
name: 'schema4',
|
||||
});
|
||||
schema.add('parent.child', { type: 'item', test: true });
|
||||
expect(schema.get('parent').children).toContainEqual({ type: 'item', name: 'child', test: true });
|
||||
});
|
||||
|
||||
it('should get the item by nested name', () => {
|
||||
const schema = new SchemaInitializer({
|
||||
type: 'item',
|
||||
items: [{ type: 'item', name: 'parent', children: [{ type: 'item', name: 'child', test: true }] }],
|
||||
name: 'schema5',
|
||||
});
|
||||
expect(schema.get('parent.child')).toEqual({ type: 'item', name: 'child', test: true });
|
||||
});
|
||||
|
||||
it('should return undefined for non-existent item', () => {
|
||||
const schema = new SchemaInitializer({ type: 'item', items: [], name: 'schema6' });
|
||||
expect(schema.get('nonexistent')).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should remove the specified item', () => {
|
||||
const schema = new SchemaInitializer({
|
||||
type: 'item',
|
||||
items: [{ type: 'item', name: 'toRemove', test: true }],
|
||||
name: 'schema7',
|
||||
});
|
||||
schema.remove('toRemove');
|
||||
expect(schema.items).not.toContainEqual({ type: 'item', name: 'toRemove', test: true });
|
||||
});
|
||||
|
||||
it('should remove the specified nested item', () => {
|
||||
const schema = new SchemaInitializer({
|
||||
type: 'item',
|
||||
items: [{ type: 'item', name: 'parent', children: [{ type: 'item', name: 'toRemove', test: true }] }],
|
||||
name: 'schema8',
|
||||
});
|
||||
schema.remove('parent.toRemove');
|
||||
expect(schema.get('parent').children).not.toContainEqual({ type: 'item', name: 'toRemove', test: true });
|
||||
});
|
||||
});
|
@ -0,0 +1,99 @@
|
||||
import { SchemaInitializer } from './SchemaInitializer';
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* 因为需要把 SchemaInitializer 的 name 统一为一致的命名风格,统一之后新创建的 Schema 将
|
||||
* 使用新的命名风格,而旧的 Schema 仍然使用旧的命名风格,这样会导致一些问题。所以需要有一个方法
|
||||
* 可以确保旧版的 name 也可以正常工作,直到旧的 Schema 被移除。该类就是用来兼容旧 name 的:
|
||||
*
|
||||
* 1. 在新版实例中通过接收旧版 name 的实例,在新版实例变更后,同步变更旧版实例;
|
||||
* 2. 在旧版实例中也接收新版 name 的实例,当旧版实例变更后,同步变更新版实例,这样可以保证在插件中即使不把旧版改成新版也能正常运行;
|
||||
*/
|
||||
export class CompatibleSchemaInitializer extends SchemaInitializer {
|
||||
/**
|
||||
* 需要同步变更的另一个实例
|
||||
*/
|
||||
otherInstance: CompatibleSchemaInitializer = null;
|
||||
|
||||
constructor(options: any, otherInstance?: CompatibleSchemaInitializer) {
|
||||
super(options);
|
||||
if (otherInstance) {
|
||||
this.otherInstance = otherInstance;
|
||||
otherInstance.otherInstance = this;
|
||||
}
|
||||
}
|
||||
|
||||
add(name: string, item: any) {
|
||||
if (super.get(name)) return;
|
||||
|
||||
super.add(name, item);
|
||||
if (this.otherInstance) {
|
||||
this.otherInstance.add(name, item);
|
||||
}
|
||||
}
|
||||
|
||||
remove(nestedName: string): void {
|
||||
if (!super.get(nestedName)) return;
|
||||
|
||||
super.remove(nestedName);
|
||||
if (this.otherInstance) {
|
||||
this.otherInstance.remove(nestedName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const oldToNewNameMap = {
|
||||
BlockInitializers: 'page:addBlock',
|
||||
MBlockInitializers: 'mobilePage:addBlock',
|
||||
CreateFormBlockInitializers: 'popup:addNew:addBlock',
|
||||
CusomeizeCreateFormBlockInitializers: 'popup:addRecord:addBlock',
|
||||
RecordBlockInitializers: 'popup:common:addBlock',
|
||||
BulkEditBlockInitializers: 'popup:bulkEdit:addBlock',
|
||||
TableColumnInitializers: 'table:configureColumns',
|
||||
TableActionColumnInitializers: 'table:configureItemActions',
|
||||
TableActionInitializers: 'table:configureActions',
|
||||
SubTableActionInitializers: 'subTable:configureActions',
|
||||
FormItemInitializers: 'form:configureFields',
|
||||
CreateFormActionInitializers: 'createForm:configureActions',
|
||||
UpdateFormActionInitializers: 'editForm:configureActions',
|
||||
ReadPrettyFormItemInitializers: 'details:configureFields',
|
||||
DetailsActionInitializers: 'detailsWithPaging:configureActions',
|
||||
ReadPrettyFormActionInitializers: 'details:configureActions',
|
||||
KanbanCardInitializers: 'kanban:configureItemFields',
|
||||
KanbanActionInitializers: 'kanban:configureActions',
|
||||
GridCardActionInitializers: 'gridCard:configureActions',
|
||||
GridCardItemActionInitializers: 'gridCard:configureItemActions',
|
||||
ListActionInitializers: 'list:configureActions',
|
||||
ListItemActionInitializers: 'list:configureItemActions',
|
||||
CalendarActionInitializers: 'calendar:configureActions',
|
||||
GanttActionInitializers: 'gantt:configureActions',
|
||||
MapActionInitializers: 'map:configureActions',
|
||||
TableSelectorInitializers: 'popup:tableSelector:addBlock',
|
||||
ChartInitializers: 'charts:addBlock',
|
||||
ChartFilterItemInitializers: 'chartFilterForm:configureFields',
|
||||
ChartFilterActionInitializers: 'chartFilterForm:configureActions',
|
||||
AssociationFilterInitializers: 'filterCollapse:configureFields',
|
||||
FilterFormItemInitializers: 'filterForm:configureFields',
|
||||
FilterFormActionInitializers: 'filterForm:configureActions',
|
||||
CustomFormItemInitializers: 'assignFieldValuesForm:configureFields',
|
||||
BulkEditFormItemInitializers: 'bulkEditForm:configureFields',
|
||||
BulkEditFormActionInitializers: 'bulkEditForm:configureActions',
|
||||
AuditLogsTableColumnInitializers: 'auditLogsTable:configureColumns',
|
||||
AuditLogsTableActionColumnInitializers: 'auditLogsTable:configureItemActions',
|
||||
AuditLogsTableActionInitializers: 'auditLogsTable:configureActions',
|
||||
SnapshotBlockInitializers: 'popup:snapshot:addBlock',
|
||||
AddBlockButton: 'workflowManual:popup:configureUserInterface:addBlock',
|
||||
AddCustomFormField: 'workflowManual:customForm:configureFields',
|
||||
AddActionButton: 'workflowManual:form:configureActions',
|
||||
};
|
||||
|
||||
/**
|
||||
* 由于旧版的 schema 的 x-initializer 的值是旧的命名风格,当其与新的命名比较时就存在问题,
|
||||
* 这里通过将新版命名转换为旧版命名再进行比较,已解决这个问题。
|
||||
* @param oldOrNewName x-initializer 的值
|
||||
* @param newName 新的命名
|
||||
*/
|
||||
export function isInitializersSame(oldOrNewName: string, newName: string) {
|
||||
return oldOrNewName === newName || oldToNewNameMap[oldOrNewName] === newName;
|
||||
}
|
@ -4,4 +4,5 @@ export * from './types';
|
||||
export * from './context';
|
||||
export * from './components';
|
||||
export * from './SchemaInitializer';
|
||||
export * from './CompatibleSchemaInitializer';
|
||||
export * from './SchemaInitializerManager';
|
||||
|
@ -40,7 +40,7 @@ const schema: ISchema = {
|
||||
type: 'void',
|
||||
'x-component': Grid,
|
||||
'x-read-pretty': true,
|
||||
'x-initializer': 'AddFieldButton',
|
||||
'x-initializer': 'addFieldButton',
|
||||
'x-uid': uid(),
|
||||
properties: {},
|
||||
},
|
||||
@ -124,7 +124,7 @@ const FormItemInitializer = () => {
|
||||
};
|
||||
|
||||
const addFieldButton = new SchemaInitializer({
|
||||
name: 'AddFieldButton',
|
||||
name: 'addFieldButton',
|
||||
// 正常情况下这个值为 false,通过点击页面左上角的设计按钮切换,这里为了显示设置为 true
|
||||
designable: true,
|
||||
// 按钮标题标题
|
||||
|
@ -398,7 +398,7 @@ export const recordPickerViewer = {
|
||||
grid: {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'RecordBlockInitializers',
|
||||
'x-initializer': 'popup:common:addBlock',
|
||||
properties: {},
|
||||
},
|
||||
},
|
||||
|
@ -42,13 +42,13 @@ export class SubTableFieldInterface extends CollectionFieldInterface {
|
||||
properties: {
|
||||
actions: {
|
||||
type: 'void',
|
||||
'x-initializer': 'SubTableActionInitializers',
|
||||
'x-initializer': 'subTable:configureActions',
|
||||
'x-component': 'TableField.ActionBar',
|
||||
'x-component-props': {},
|
||||
},
|
||||
[field.name]: {
|
||||
type: 'array',
|
||||
'x-initializer': 'TableColumnInitializers',
|
||||
'x-initializer': 'table:configureColumns',
|
||||
'x-component': 'TableV2',
|
||||
'x-component-props': {
|
||||
rowSelection: {
|
||||
|
@ -41,7 +41,7 @@ export const CreateChildInitializer = (props) => {
|
||||
grid: {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'CreateFormBlockInitializers',
|
||||
'x-initializer': 'popup:addNew:addBlock',
|
||||
properties: {},
|
||||
},
|
||||
},
|
||||
|
@ -43,7 +43,7 @@ export const CreateActionInitializer = () => {
|
||||
grid: {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'CreateFormBlockInitializers',
|
||||
'x-initializer': 'popup:addNew:addBlock',
|
||||
properties: {},
|
||||
},
|
||||
},
|
||||
|
@ -1,7 +1,10 @@
|
||||
import { SchemaInitializer } from '../../../application/schema-initializer/SchemaInitializer';
|
||||
import { CompatibleSchemaInitializer } from '../../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
import { gridRowColWrap } from '../../../schema-initializer/utils';
|
||||
|
||||
export const createFormBlockInitializers = new SchemaInitializer({
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const createFormBlockInitializers_deprecated = new CompatibleSchemaInitializer({
|
||||
name: 'CreateFormBlockInitializers',
|
||||
wrap: gridRowColWrap,
|
||||
title: '{{t("Add block")}}',
|
||||
@ -33,3 +36,39 @@ export const createFormBlockInitializers = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const createFormBlockInitializers = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'popup:addNew:addBlock',
|
||||
wrap: gridRowColWrap,
|
||||
title: '{{t("Add block")}}',
|
||||
icon: 'PlusOutlined',
|
||||
items: [
|
||||
{
|
||||
type: 'itemGroup',
|
||||
title: '{{t("Data blocks")}}',
|
||||
name: 'dataBlocks',
|
||||
children: [
|
||||
{
|
||||
name: 'form',
|
||||
title: '{{t("Form")}}',
|
||||
Component: 'CreateFormBlockInitializer',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'itemGroup',
|
||||
title: '{{t("Other blocks")}}',
|
||||
name: 'otherBlocks',
|
||||
children: [
|
||||
{
|
||||
name: 'markdown',
|
||||
title: '{{t("Markdown")}}',
|
||||
Component: 'MarkdownBlockInitializer',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
createFormBlockInitializers_deprecated,
|
||||
);
|
||||
|
@ -29,7 +29,7 @@ export const CustomizeAddRecordActionInitializer = () => {
|
||||
'x-component-props': {},
|
||||
'x-initializer': 'TabPaneInitializersForCreateFormBlock',
|
||||
'x-initializer-props': {
|
||||
gridInitializer: 'CusomeizeCreateFormBlockInitializers',
|
||||
gridInitializer: 'popup:addRecord:addBlock',
|
||||
},
|
||||
properties: {
|
||||
tab1: {
|
||||
@ -42,7 +42,7 @@ export const CustomizeAddRecordActionInitializer = () => {
|
||||
grid: {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'CusomeizeCreateFormBlockInitializers',
|
||||
'x-initializer': 'popup:addRecord:addBlock',
|
||||
properties: {},
|
||||
},
|
||||
},
|
||||
|
@ -1,7 +1,10 @@
|
||||
import { SchemaInitializer } from '../../../application/schema-initializer/SchemaInitializer';
|
||||
import { CompatibleSchemaInitializer } from '../../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
import { gridRowColWrap } from '../../../schema-initializer/utils';
|
||||
|
||||
export const customizeCreateFormBlockInitializers = new SchemaInitializer({
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const customizeCreateFormBlockInitializers_deprecated = new CompatibleSchemaInitializer({
|
||||
name: 'CusomeizeCreateFormBlockInitializers',
|
||||
wrap: gridRowColWrap,
|
||||
title: '{{t("Add block")}}',
|
||||
@ -34,3 +37,40 @@ export const customizeCreateFormBlockInitializers = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const customizeCreateFormBlockInitializers = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'popup:addRecord:addBlock',
|
||||
wrap: gridRowColWrap,
|
||||
title: '{{t("Add block")}}',
|
||||
icon: 'PlusOutlined',
|
||||
items: [
|
||||
{
|
||||
type: 'itemGroup',
|
||||
title: '{{t("Data blocks")}}',
|
||||
name: 'dataBlocks',
|
||||
children: [
|
||||
{
|
||||
name: 'form',
|
||||
title: '{{t("Form")}}',
|
||||
Component: 'FormBlockInitializer',
|
||||
isCusomeizeCreate: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'itemGroup',
|
||||
title: '{{t("Other blocks")}}',
|
||||
name: 'otherBlocks',
|
||||
children: [
|
||||
{
|
||||
name: 'markdown',
|
||||
title: '{{t("Markdown")}}',
|
||||
Component: 'MarkdownBlockInitializer',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
customizeCreateFormBlockInitializers_deprecated,
|
||||
);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { useFieldSchema } from '@formily/react';
|
||||
import { isValid } from '@formily/shared';
|
||||
import { useSchemaToolbar } from '../../../application';
|
||||
import { isInitializersSame, useSchemaToolbar } from '../../../application';
|
||||
import { SchemaSettings } from '../../../application/schema-settings/SchemaSettings';
|
||||
import {
|
||||
ButtonEditor,
|
||||
@ -45,7 +45,6 @@ export const updateSubmitActionSettings = new SchemaSettings({
|
||||
],
|
||||
});
|
||||
|
||||
// TODO: 0.20 发版之前后移除
|
||||
export const submitActionSettings = new SchemaSettings({
|
||||
name: 'actionSettings:submit',
|
||||
items: [
|
||||
@ -76,7 +75,7 @@ export const submitActionSettings = new SchemaSettings({
|
||||
const fieldSchema = useFieldSchema();
|
||||
return (
|
||||
fieldSchema['x-action'] === 'submit' &&
|
||||
fieldSchema.parent?.['x-initializer'] === 'CreateFormActionInitializers'
|
||||
isInitializersSame(fieldSchema.parent?.['x-initializer'], 'createForm:configureActions')
|
||||
);
|
||||
},
|
||||
},
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { BlockInitializer } from '../../../schema-initializer/items';
|
||||
import { useSchemaInitializerItem } from '../../../application';
|
||||
import { BlockInitializer } from '../../../schema-initializer/items';
|
||||
|
||||
export const PopupActionInitializer = (props) => {
|
||||
const schema = {
|
||||
@ -38,7 +38,7 @@ export const PopupActionInitializer = (props) => {
|
||||
grid: {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'RecordBlockInitializers',
|
||||
'x-initializer': 'popup:common:addBlock',
|
||||
properties: {},
|
||||
},
|
||||
},
|
||||
|
@ -1,6 +1,9 @@
|
||||
import { SchemaInitializer } from '../../../application/schema-initializer/SchemaInitializer';
|
||||
import { gridRowColWrap } from '../../../schema-initializer/utils';
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const recordFormBlockInitializers = new SchemaInitializer({
|
||||
name: 'RecordFormBlockInitializers',
|
||||
title: '{{ t("Add block") }}',
|
||||
|
@ -39,7 +39,7 @@ export const UpdateActionInitializer = (props) => {
|
||||
grid: {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'RecordBlockInitializers',
|
||||
'x-initializer': 'popup:common:addBlock',
|
||||
properties: {},
|
||||
},
|
||||
},
|
||||
|
@ -38,7 +38,7 @@ export const ViewActionInitializer = (props) => {
|
||||
grid: {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'RecordBlockInitializers',
|
||||
'x-initializer': 'popup:common:addBlock',
|
||||
properties: {},
|
||||
},
|
||||
},
|
||||
|
@ -1,7 +1,10 @@
|
||||
import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer';
|
||||
import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
|
||||
// 表单的操作配置
|
||||
export const detailsActionInitializers = new SchemaInitializer({
|
||||
/**
|
||||
* @deprecated
|
||||
* 表单的操作配置
|
||||
*/
|
||||
export const detailsActionInitializers_deprecated = new CompatibleSchemaInitializer({
|
||||
name: 'DetailsActionInitializers',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
@ -49,3 +52,45 @@ export const detailsActionInitializers = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const detailsActionInitializers = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'detailsWithPaging:configureActions',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
style: {
|
||||
marginLeft: 8,
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: 'itemGroup',
|
||||
title: '{{t("Enable actions")}}',
|
||||
name: 'enableActions',
|
||||
children: [
|
||||
{
|
||||
name: 'edit',
|
||||
title: '{{t("Edit")}}',
|
||||
Component: 'UpdateActionInitializer',
|
||||
schema: {
|
||||
'x-component': 'Action',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
'x-component-props': {
|
||||
type: 'primary',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'delete',
|
||||
title: '{{t("Delete")}}',
|
||||
Component: 'DestroyActionInitializer',
|
||||
schema: {
|
||||
'x-component': 'Action',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
detailsActionInitializers_deprecated,
|
||||
);
|
||||
|
@ -23,7 +23,7 @@ export const DetailsBlockInitializer = () => {
|
||||
actionInitializers:
|
||||
(collection.template !== 'view' || collection?.writableView) &&
|
||||
collection.template !== 'sql' &&
|
||||
'DetailsActionInitializers',
|
||||
'detailsWithPaging:configureActions',
|
||||
settings: 'blockSettings:multiDataDetails',
|
||||
});
|
||||
insert(schema);
|
||||
|
@ -3,7 +3,7 @@ import { createBlockInPage, expect, oneEmptyDetailsBlock, test } from '@nocobase
|
||||
test.describe('where multi data details block can be added', () => {
|
||||
test('page', async ({ page, mockPage }) => {
|
||||
await mockPage().goto();
|
||||
await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-page:addBlock').hover();
|
||||
await createBlockInPage(page, 'Details');
|
||||
await expect(page.getByLabel('block-item-CardItem-users-details')).toBeVisible();
|
||||
});
|
||||
@ -13,7 +13,7 @@ test.describe('configure fields', () => {
|
||||
test('display collection fields & display association fields & add text', async ({ page, mockPage }) => {
|
||||
await mockPage(oneEmptyDetailsBlock).goto();
|
||||
|
||||
const formItemInitializer = page.getByLabel('schema-initializer-Grid-ReadPrettyFormItemInitializers-general');
|
||||
const formItemInitializer = page.getByLabel('schema-initializer-Grid-details:configureFields-general');
|
||||
|
||||
// add fields
|
||||
await formItemInitializer.hover();
|
||||
@ -63,7 +63,7 @@ test.describe('configure actions', () => {
|
||||
test('edit & delete & duplicate', async ({ page, mockPage }) => {
|
||||
await mockPage(oneEmptyDetailsBlock).goto();
|
||||
|
||||
await page.getByLabel('schema-initializer-ActionBar-DetailsActionInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-detailsWithPaging:configureActions-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'Edit' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Delete' }).click();
|
||||
|
||||
@ -75,7 +75,7 @@ test.describe('configure actions', () => {
|
||||
await expect(page.getByRole('button', { name: 'Delete' })).toBeVisible();
|
||||
|
||||
// delete buttons
|
||||
await page.getByLabel('schema-initializer-ActionBar-DetailsActionInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-detailsWithPaging:configureActions-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'Edit' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Delete' }).click();
|
||||
|
||||
|
@ -33,7 +33,7 @@ test.describe('actions schema settings', () => {
|
||||
await mockPage(oneEmptyDetailsBlock).goto();
|
||||
|
||||
// 创建 Edit & Delete 两个按钮
|
||||
await page.getByLabel('schema-initializer-ActionBar-DetailsActionInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-detailsWithPaging:configureActions-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'Edit' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Delete' }).click();
|
||||
await page.mouse.move(0, 300);
|
||||
|
@ -1,12 +1,16 @@
|
||||
import { useCollection_deprecated } from '../../../..';
|
||||
import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer';
|
||||
import { useCollection_deprecated } from '../../../../collection-manager/hooks/useCollection_deprecated';
|
||||
import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
|
||||
const useVisibleCollection = () => {
|
||||
const collection = useCollection_deprecated();
|
||||
return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql';
|
||||
};
|
||||
// 表单的操作配置
|
||||
export const readPrettyFormActionInitializers = new SchemaInitializer({
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* 表单的操作配置
|
||||
*/
|
||||
export const readPrettyFormActionInitializers_deprecated = new CompatibleSchemaInitializer({
|
||||
name: 'ReadPrettyFormActionInitializers',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
@ -84,3 +88,85 @@ export const readPrettyFormActionInitializers = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const readPrettyFormActionInitializers = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'details:configureActions',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
style: {
|
||||
marginLeft: 8,
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: 'itemGroup',
|
||||
name: 'enableActions',
|
||||
title: '{{t("Enable actions")}}',
|
||||
children: [
|
||||
{
|
||||
title: '{{t("Edit")}}',
|
||||
name: 'edit',
|
||||
Component: 'UpdateActionInitializer',
|
||||
schema: {
|
||||
'x-component': 'Action',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
'x-component-props': {
|
||||
type: 'primary',
|
||||
},
|
||||
},
|
||||
useVisible: useVisibleCollection,
|
||||
},
|
||||
{
|
||||
title: '{{t("Delete")}}',
|
||||
name: 'delete',
|
||||
Component: 'DestroyActionInitializer',
|
||||
schema: {
|
||||
'x-component': 'Action',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
},
|
||||
useVisible: useVisibleCollection,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'divider',
|
||||
type: 'divider',
|
||||
},
|
||||
{
|
||||
type: 'subMenu',
|
||||
name: 'customize',
|
||||
title: '{{t("Customize")}}',
|
||||
children: [
|
||||
{
|
||||
name: 'popup',
|
||||
title: '{{t("Popup")}}',
|
||||
Component: 'PopupActionInitializer',
|
||||
useComponentProps() {
|
||||
return {
|
||||
'x-component': 'Action',
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'updateRecord',
|
||||
title: '{{t("Update record")}}',
|
||||
Component: 'UpdateRecordActionInitializer',
|
||||
useComponentProps() {
|
||||
return {
|
||||
'x-component': 'Action',
|
||||
};
|
||||
},
|
||||
visible: useVisibleCollection,
|
||||
},
|
||||
{
|
||||
name: 'customRequest',
|
||||
title: '{{t("Custom request")}}',
|
||||
Component: 'CustomRequestInitializer',
|
||||
useVisible: useVisibleCollection,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
readPrettyFormActionInitializers_deprecated,
|
||||
);
|
||||
|
@ -1,7 +1,6 @@
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { SchemaInitializerChildren } from '../../../../application';
|
||||
import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer';
|
||||
import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
import { useCompile } from '../../../../schema-component';
|
||||
import {
|
||||
gridRowColWrap,
|
||||
@ -9,6 +8,7 @@ import {
|
||||
useFormItemInitializerFields,
|
||||
useInheritsFormItemInitializerFields,
|
||||
} from '../../../../schema-initializer/utils';
|
||||
import { SchemaInitializerChildren } from '../../../../application/schema-initializer/components/SchemaInitializerChildren';
|
||||
|
||||
const ParentCollectionFields = () => {
|
||||
const inheritFields = useInheritsFormItemInitializerFields();
|
||||
@ -45,7 +45,10 @@ const AssociatedFields = () => {
|
||||
return <SchemaInitializerChildren>{schema}</SchemaInitializerChildren>;
|
||||
};
|
||||
|
||||
export const readPrettyFormItemInitializers = new SchemaInitializer({
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const readPrettyFormItemInitializers_deprecated = new CompatibleSchemaInitializer({
|
||||
name: 'ReadPrettyFormItemInitializers',
|
||||
wrap: gridRowColWrap,
|
||||
icon: 'SettingOutlined',
|
||||
@ -88,3 +91,50 @@ export const readPrettyFormItemInitializers = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const readPrettyFormItemInitializers = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'details:configureFields',
|
||||
wrap: gridRowColWrap,
|
||||
icon: 'SettingOutlined',
|
||||
title: '{{t("Configure fields")}}',
|
||||
items: [
|
||||
{
|
||||
type: 'itemGroup',
|
||||
name: 'displayFields',
|
||||
title: '{{t("Display fields")}}',
|
||||
useChildren: useFormItemInitializerFields,
|
||||
},
|
||||
{
|
||||
name: 'parentCollectionFields',
|
||||
Component: ParentCollectionFields,
|
||||
},
|
||||
{
|
||||
name: 'associationFields',
|
||||
Component: AssociatedFields,
|
||||
},
|
||||
{
|
||||
name: 'divider',
|
||||
type: 'divider',
|
||||
},
|
||||
{
|
||||
name: 'addText',
|
||||
title: '{{t("Add text")}}',
|
||||
Component: 'BlockItemInitializer',
|
||||
schema: {
|
||||
type: 'void',
|
||||
'x-editable': false,
|
||||
'x-decorator': 'FormItem',
|
||||
// 'x-designer': 'Markdown.Void.Designer',
|
||||
'x-toolbar': 'BlockSchemaToolbar',
|
||||
'x-settings': 'blockSettings:markdown',
|
||||
'x-component': 'Markdown.Void',
|
||||
'x-component-props': {
|
||||
content: '{{t("This is a demo text, **supports Markdown syntax**.")}}',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
readPrettyFormItemInitializers_deprecated,
|
||||
);
|
||||
|
@ -26,7 +26,7 @@ export const RecordReadPrettyFormBlockInitializer = () => {
|
||||
const association = useBlockAssociationContext();
|
||||
const { block } = useBlockRequestContext();
|
||||
const actionInitializers =
|
||||
block !== 'TableField' ? itemConfig.actionInitializers || 'ReadPrettyFormActionInitializers' : null;
|
||||
block !== 'TableField' ? itemConfig.actionInitializers || 'details:configureActions' : null;
|
||||
|
||||
return (
|
||||
<SchemaInitializerItem
|
||||
|
@ -7,7 +7,7 @@ test.describe('where single data details block can be added', () => {
|
||||
await nocoPage.goto();
|
||||
|
||||
await page.getByLabel('action-Action.Link-View-view-general-table-0').click();
|
||||
await page.getByLabel('schema-initializer-Grid-RecordBlockInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'Details' }).click();
|
||||
await page.mouse.move(300, 0);
|
||||
|
||||
@ -22,7 +22,7 @@ test.describe('configure actions', () => {
|
||||
await nocoPage.goto();
|
||||
|
||||
await page.getByLabel('action-Action.Link-View-view-general-table-0').click();
|
||||
await page.getByLabel('schema-initializer-Grid-RecordBlockInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'Details' }).click();
|
||||
await page.mouse.move(300, 0);
|
||||
|
||||
@ -61,14 +61,14 @@ test.describe('configure actions', () => {
|
||||
test.describe('configure fields', () => {});
|
||||
|
||||
async function createAction(page: Page, name: string) {
|
||||
await page.getByLabel('schema-initializer-ActionBar-ReadPrettyFormActionInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-details:configureActions-general').hover();
|
||||
await page.getByRole('menuitem', { name: name }).click();
|
||||
await expect(page.getByRole('menuitem', { name: name }).getByRole('switch')).toBeChecked();
|
||||
await page.mouse.move(300, 0);
|
||||
}
|
||||
|
||||
async function createCustomAction(page: Page, name: string) {
|
||||
await page.getByLabel('schema-initializer-ActionBar-ReadPrettyFormActionInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-details:configureActions-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'Customize' }).hover();
|
||||
await page.getByRole('menuitem', { name: name }).click();
|
||||
await page.mouse.move(0, 400);
|
||||
|
@ -24,7 +24,7 @@ export const CreateFormBlockInitializer = () => {
|
||||
const s = await getTemplateSchemaByMode(item);
|
||||
if (item.template.componentName === 'FormItem') {
|
||||
const blockSchema = createFormBlockSchema({
|
||||
actionInitializers: 'CreateFormActionInitializers',
|
||||
actionInitializers: 'createForm:configureActions',
|
||||
association,
|
||||
dataSource: collection.dataSource,
|
||||
collection: collection.name,
|
||||
@ -41,7 +41,7 @@ export const CreateFormBlockInitializer = () => {
|
||||
} else {
|
||||
insert(
|
||||
createFormBlockSchema({
|
||||
actionInitializers: 'CreateFormActionInitializers',
|
||||
actionInitializers: 'createForm:configureActions',
|
||||
association,
|
||||
dataSource: collection.dataSource,
|
||||
collection: collection.name,
|
||||
|
@ -29,7 +29,7 @@ export const RecordFormBlockInitializer = () => {
|
||||
action: 'get',
|
||||
useSourceId: '{{ useSourceIdFromParentRecord }}',
|
||||
useParams: '{{ useParamsFromRecord }}',
|
||||
actionInitializers: 'UpdateFormActionInitializers',
|
||||
actionInitializers: 'editForm:configureActions',
|
||||
template: s,
|
||||
settings: 'blockSettings:editForm',
|
||||
});
|
||||
@ -49,7 +49,7 @@ export const RecordFormBlockInitializer = () => {
|
||||
action: 'get',
|
||||
useSourceId: '{{ useSourceIdFromParentRecord }}',
|
||||
useParams: '{{ useParamsFromRecord }}',
|
||||
actionInitializers: 'UpdateFormActionInitializers',
|
||||
actionInitializers: 'editForm:configureActions',
|
||||
settings: 'blockSettings:editForm',
|
||||
}),
|
||||
);
|
||||
|
@ -2,7 +2,7 @@ import { expect, oneFormBlockBasedOnUsers, test } from '@nocobase/test/e2e';
|
||||
|
||||
test('fields', async ({ page, mockPage }) => {
|
||||
await mockPage(oneFormBlockBasedOnUsers).goto();
|
||||
await page.getByLabel('schema-initializer-Grid-FormItemInitializers-users').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-form:configureFields-users').hover();
|
||||
await page.getByRole('menuitem', { name: 'Nickname' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Username' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Email' }).click();
|
||||
|
@ -282,7 +282,7 @@ test.describe('association fields', () => {
|
||||
await expect(page.getByLabel('Member')).toBeHidden();
|
||||
await expect(page.getByLabel('Root')).toBeVisible();
|
||||
|
||||
await page.getByLabel('schema-initializer-Grid-FormItemInitializers-users').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-form:configureFields-users').hover();
|
||||
await page.getByRole('menuitem', { name: 'Nickname' }).click();
|
||||
|
||||
await page.mouse.move(200, 0);
|
||||
|
@ -6,7 +6,7 @@ test.describe('where creation form block can be added', () => {
|
||||
test('page', async ({ page, mockPage }) => {
|
||||
await mockPage().goto();
|
||||
|
||||
await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-page:addBlock').hover();
|
||||
await createBlockInPage(page, 'Form');
|
||||
await expect(page.getByLabel('block-item-CardItem-users-form')).toBeVisible();
|
||||
});
|
||||
@ -17,7 +17,7 @@ test.describe('configure fields', () => {
|
||||
await mockPage(oneEmptyForm).goto();
|
||||
|
||||
// collection fields
|
||||
await page.getByLabel('schema-initializer-Grid-FormItemInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'ID', exact: true }).click();
|
||||
await expect(page.getByRole('menuitem', { name: 'ID', exact: true }).getByRole('switch')).toBeChecked();
|
||||
|
||||
@ -33,7 +33,7 @@ test.describe('configure fields', () => {
|
||||
await expect(page.getByLabel('block-item-CollectionField-general-form-general.manyToOne.nickname')).toBeVisible();
|
||||
|
||||
// delete fields
|
||||
await page.getByLabel('schema-initializer-Grid-FormItemInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'ID', exact: true }).click();
|
||||
await expect(page.getByRole('menuitem', { name: 'ID', exact: true }).getByRole('switch')).not.toBeChecked();
|
||||
|
||||
@ -50,7 +50,7 @@ test.describe('configure fields', () => {
|
||||
).not.toBeVisible();
|
||||
|
||||
// add text
|
||||
await page.getByLabel('schema-initializer-Grid-FormItemInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-form:configureFields-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'Text' }).click();
|
||||
await expect(page.getByLabel('block-item-Markdown.Void-general-form')).toBeVisible();
|
||||
});
|
||||
@ -62,7 +62,7 @@ test.describe('configure actions', () => {
|
||||
test('submit', async ({ page, mockPage }) => {
|
||||
await mockPage(oneEmptyForm).goto();
|
||||
|
||||
await page.getByLabel('schema-initializer-ActionBar-FormActionInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-createForm:configureActions-general').hover();
|
||||
|
||||
// add button
|
||||
await page.getByRole('menuitem', { name: 'Submit' }).click();
|
||||
@ -72,7 +72,7 @@ test.describe('configure actions', () => {
|
||||
await expect(page.getByRole('button', { name: 'Submit' })).toBeVisible();
|
||||
|
||||
// delete button
|
||||
await page.getByLabel('schema-initializer-ActionBar-FormActionInitializers-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();
|
||||
|
||||
@ -137,7 +137,7 @@ test.describe('configure actions', () => {
|
||||
test('customize: save record', async ({ page, mockPage }) => {
|
||||
await mockPage(oneEmptyForm).goto();
|
||||
|
||||
await page.getByLabel('schema-initializer-ActionBar-FormActionInitializers-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();
|
||||
|
||||
|
@ -350,7 +350,7 @@ test.describe('creation form block schema settings', () => {
|
||||
await expect(page.getByRole('menuitem', { name: 'Convert reference to duplicate' })).toBeVisible();
|
||||
|
||||
// 创建区块的时候,可以选择刚才保存的模板 --------------------------------------------------
|
||||
await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-page:addBlock').hover();
|
||||
await page.getByRole('menuitem', { name: 'form Form right' }).first().hover();
|
||||
await page.getByRole('menuitem', { name: 'General right' }).hover();
|
||||
|
||||
@ -359,7 +359,7 @@ test.describe('creation form block schema settings', () => {
|
||||
await page.getByRole('menuitem', { name: 'new_form_template (Fields only)' }).click();
|
||||
|
||||
// Reference template
|
||||
await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-page:addBlock').hover();
|
||||
await page.getByRole('menuitem', { name: 'form Form right' }).first().hover();
|
||||
await page.getByRole('menuitem', { name: 'General right' }).hover();
|
||||
await page.getByRole('menuitem', { name: 'General right' }).click();
|
||||
@ -549,7 +549,7 @@ test.describe('creation form block schema settings', () => {
|
||||
.hover();
|
||||
await page.mouse.move(100, 0);
|
||||
|
||||
await page.getByLabel('schema-initializer-Grid-FormItemInitializers-users').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-form:configureFields-users').hover();
|
||||
await page.getByRole('menuitem', { name: 'Nickname' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Username' }).click();
|
||||
|
||||
@ -622,7 +622,7 @@ test.describe('creation form block schema settings', () => {
|
||||
.hover();
|
||||
await page.mouse.move(100, 0);
|
||||
|
||||
await page.getByLabel('schema-initializer-AssociationField.SubTable-TableColumnInitializers-users').hover();
|
||||
await page.getByLabel('schema-initializer-AssociationField.SubTable-table:configureColumns-users').hover();
|
||||
await page.getByRole('menuitem', { name: 'Nickname' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Username' }).click();
|
||||
|
||||
@ -719,7 +719,7 @@ test.describe('creation form block schema settings', () => {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'BlockInitializers',
|
||||
'x-initializer': 'page:addBlock',
|
||||
properties: {
|
||||
gdj0ceke8ac: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -764,7 +764,7 @@ test.describe('creation form block schema settings', () => {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'FormItemInitializers',
|
||||
'x-initializer': 'form:configureFields',
|
||||
properties: {
|
||||
gnw25oyqe56: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -810,7 +810,7 @@ test.describe('creation form block schema settings', () => {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'FormActionInitializers',
|
||||
'x-initializer': 'createForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
@ -879,7 +879,7 @@ test.describe('creation form block schema settings', () => {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'BlockInitializers',
|
||||
'x-initializer': 'page:addBlock',
|
||||
properties: {
|
||||
ibb0kjq3kyl: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -919,7 +919,7 @@ test.describe('creation form block schema settings', () => {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'TableActionInitializers',
|
||||
'x-initializer': 'table:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
style: {
|
||||
@ -980,7 +980,7 @@ test.describe('creation form block schema settings', () => {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'CreateFormBlockInitializers',
|
||||
'x-initializer': 'popup:addNew:addBlock',
|
||||
'x-uid': 'w224zhqyair',
|
||||
'x-async': false,
|
||||
'x-index': 1,
|
||||
@ -1014,7 +1014,7 @@ test.describe('creation form block schema settings', () => {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'array',
|
||||
'x-initializer': 'TableColumnInitializers',
|
||||
'x-initializer': 'table:configureColumns',
|
||||
'x-component': 'TableV2',
|
||||
'x-component-props': {
|
||||
rowKey: 'id',
|
||||
@ -1033,7 +1033,7 @@ test.describe('creation form block schema settings', () => {
|
||||
'x-decorator': 'TableV2.Column.ActionBar',
|
||||
'x-component': 'TableV2.Column',
|
||||
'x-designer': 'TableV2.ActionColumnDesigner',
|
||||
'x-initializer': 'TableActionColumnInitializers',
|
||||
'x-initializer': 'table:configureItemActions',
|
||||
properties: {
|
||||
actions: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -1094,7 +1094,7 @@ test.describe('creation form block schema settings', () => {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'RecordBlockInitializers',
|
||||
'x-initializer': 'popup:common:addBlock',
|
||||
'x-uid': 's49vs6v3qs0',
|
||||
'x-async': false,
|
||||
'x-index': 1,
|
||||
@ -1160,7 +1160,7 @@ test.describe('creation form block schema settings', () => {
|
||||
'x-index': 1,
|
||||
},
|
||||
}).goto();
|
||||
await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-page:addBlock').hover();
|
||||
//使用复制模板
|
||||
await page.getByRole('menuitem', { name: 'form Form' }).first().hover();
|
||||
await page.getByRole('menuitem', { name: 'Users' }).hover();
|
||||
@ -1171,25 +1171,25 @@ test.describe('creation form block schema settings', () => {
|
||||
|
||||
//在新建操作中使用引用模板
|
||||
await page.getByLabel('action-Action-Add new-create-users-table').click();
|
||||
await page.getByLabel('schema-initializer-Grid-CreateFormBlockInitializers-users').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-popup:addNew:addBlock-users').hover();
|
||||
await page.getByRole('menuitem', { name: 'form Form' }).first().hover();
|
||||
await page.getByRole('menuitem', { name: 'Reference template' }).hover();
|
||||
await page.getByRole('menuitem', { name: 'Users_Form (Fields only)' }).first().click();
|
||||
await page.mouse.move(300, 0);
|
||||
await page.getByLabel('schema-initializer-Grid-CreateFormBlockInitializers-users').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-popup:addNew:addBlock-users').hover();
|
||||
await expect(page.locator('.ant-drawer').getByLabel('block-item-CardItem-users-form')).toBeVisible();
|
||||
await page.locator('.ant-drawer-mask').click();
|
||||
|
||||
//在编辑操作中使用引用模板
|
||||
await page.getByLabel('action-Action.Link-Edit-update-users-table-0').click();
|
||||
await page.getByLabel('schema-initializer-Grid-RecordBlockInitializers-users').click();
|
||||
await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-users').click();
|
||||
await page.getByRole('menuitem', { name: 'form Form' }).first().hover();
|
||||
await page.getByRole('menuitem', { name: 'Reference template' }).hover();
|
||||
await page.getByRole('menuitem', { name: 'Users_Form (Fields only)' }).first().click();
|
||||
await page.mouse.move(300, 0);
|
||||
|
||||
//修改引用模板
|
||||
await page.locator('.ant-drawer').getByLabel('schema-initializer-Grid-FormItemInitializers-users').hover();
|
||||
await page.locator('.ant-drawer').getByLabel('schema-initializer-Grid-form:configureFields-users').hover();
|
||||
await page.getByRole('menuitem', { name: 'Phone' }).click();
|
||||
await page.locator('.ant-drawer-mask').click();
|
||||
//复制模板不同步,引用模板同步
|
||||
|
@ -12,7 +12,7 @@ export const T2165 = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'BlockInitializers',
|
||||
'x-initializer': 'page:addBlock',
|
||||
properties: {
|
||||
psn8ekavlq6: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -58,7 +58,7 @@ export const T2165 = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'FormItemInitializers',
|
||||
'x-initializer': 'form:configureFields',
|
||||
'x-linkage-rules': [
|
||||
{
|
||||
condition: {
|
||||
@ -235,7 +235,7 @@ export const T2165 = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'FormActionInitializers',
|
||||
'x-initializer': 'createForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
@ -291,7 +291,7 @@ export const T2174 = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'BlockInitializers',
|
||||
'x-initializer': 'page:addBlock',
|
||||
'x-index': 1,
|
||||
properties: {
|
||||
ppgwx2drpng: {
|
||||
@ -335,7 +335,7 @@ export const T2174 = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'TableActionInitializers',
|
||||
'x-initializer': 'table:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
style: {
|
||||
@ -350,7 +350,7 @@ export const T2174 = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'array',
|
||||
'x-initializer': 'TableColumnInitializers',
|
||||
'x-initializer': 'table:configureColumns',
|
||||
'x-component': 'TableV2',
|
||||
'x-component-props': {
|
||||
rowKey: 'id',
|
||||
@ -370,7 +370,7 @@ export const T2174 = {
|
||||
'x-decorator': 'TableV2.Column.ActionBar',
|
||||
'x-component': 'TableV2.Column',
|
||||
'x-designer': 'TableV2.ActionColumnDesigner',
|
||||
'x-initializer': 'TableActionColumnInitializers',
|
||||
'x-initializer': 'table:configureItemActions',
|
||||
'x-index': 1,
|
||||
properties: {
|
||||
actions: {
|
||||
@ -438,7 +438,7 @@ export const T2174 = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'RecordBlockInitializers',
|
||||
'x-initializer': 'popup:common:addBlock',
|
||||
'x-index': 1,
|
||||
properties: {
|
||||
g8w7wq09bgo: {
|
||||
@ -492,7 +492,7 @@ export const T2174 = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'FormItemInitializers',
|
||||
'x-initializer': 'form:configureFields',
|
||||
'x-index': 1,
|
||||
properties: {
|
||||
s3hhb0ohnv1: {
|
||||
@ -543,7 +543,7 @@ export const T2174 = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'CreateFormActionInitializers',
|
||||
'x-initializer': 'createForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
@ -722,7 +722,7 @@ export const T2174 = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'RecordBlockInitializers',
|
||||
'x-initializer': 'popup:common:addBlock',
|
||||
'x-index': 1,
|
||||
'x-uid': 'roog7uz0d2o',
|
||||
'x-async': false,
|
||||
@ -888,7 +888,7 @@ export const T2614: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'BlockInitializers',
|
||||
'x-initializer': 'page:addBlock',
|
||||
properties: {
|
||||
vv0l8wohslb: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -928,7 +928,7 @@ export const T2614: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'TableActionInitializers',
|
||||
'x-initializer': 'table:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
style: {
|
||||
@ -943,7 +943,7 @@ export const T2614: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'array',
|
||||
'x-initializer': 'TableColumnInitializers',
|
||||
'x-initializer': 'table:configureColumns',
|
||||
'x-component': 'TableV2',
|
||||
'x-component-props': {
|
||||
rowKey: 'id',
|
||||
@ -962,7 +962,7 @@ export const T2614: PageConfig = {
|
||||
'x-decorator': 'TableV2.Column.ActionBar',
|
||||
'x-component': 'TableV2.Column',
|
||||
'x-designer': 'TableV2.ActionColumnDesigner',
|
||||
'x-initializer': 'TableActionColumnInitializers',
|
||||
'x-initializer': 'table:configureItemActions',
|
||||
properties: {
|
||||
actions: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -1024,7 +1024,7 @@ export const T2614: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'RecordBlockInitializers',
|
||||
'x-initializer': 'popup:common:addBlock',
|
||||
properties: {
|
||||
qbl84fadyr0: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -1069,8 +1069,7 @@ export const T2614: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer':
|
||||
'ReadPrettyFormActionInitializers',
|
||||
'x-initializer': 'details:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
style: {
|
||||
@ -1086,8 +1085,7 @@ export const T2614: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer':
|
||||
'ReadPrettyFormItemInitializers',
|
||||
'x-initializer': 'details:configureFields',
|
||||
properties: {
|
||||
i39cn9ve66b: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -1128,7 +1126,7 @@ export const T2614: PageConfig = {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer':
|
||||
'FormItemInitializers',
|
||||
'form:configureFields',
|
||||
properties: {
|
||||
e5kqdzyj562: {
|
||||
_isJSONSchemaObject:
|
||||
@ -1355,7 +1353,7 @@ export const T2614: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'RecordBlockInitializers',
|
||||
'x-initializer': 'popup:common:addBlock',
|
||||
properties: {
|
||||
z79dioevb4n: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -1403,7 +1401,7 @@ export const T2614: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'FormItemInitializers',
|
||||
'x-initializer': 'form:configureFields',
|
||||
properties: {
|
||||
j9egu0k0tkq: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -1444,7 +1442,7 @@ export const T2614: PageConfig = {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer':
|
||||
'FormItemInitializers',
|
||||
'form:configureFields',
|
||||
properties: {
|
||||
esgv9d2n3jl: {
|
||||
_isJSONSchemaObject:
|
||||
@ -1581,7 +1579,7 @@ export const T2614: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'UpdateFormActionInitializers',
|
||||
'x-initializer': 'editForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
@ -1724,7 +1722,7 @@ export const T2993: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'BlockInitializers',
|
||||
'x-initializer': 'page:addBlock',
|
||||
'x-index': 1,
|
||||
properties: {
|
||||
vv0l8wohslb: {
|
||||
@ -1768,7 +1766,7 @@ export const T2993: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'TableActionInitializers',
|
||||
'x-initializer': 'table:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
style: {
|
||||
@ -1830,7 +1828,7 @@ export const T2993: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'CreateFormBlockInitializers',
|
||||
'x-initializer': 'popup:addNew:addBlock',
|
||||
properties: {
|
||||
kvyqrrxvggn: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -1875,7 +1873,7 @@ export const T2993: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'FormItemInitializers',
|
||||
'x-initializer': 'form:configureFields',
|
||||
properties: {
|
||||
itg7al9oxaw: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -1917,7 +1915,7 @@ export const T2993: PageConfig = {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer':
|
||||
'FormItemInitializers',
|
||||
'form:configureFields',
|
||||
properties: {
|
||||
um4p1ariq2x: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -2017,7 +2015,7 @@ export const T2993: PageConfig = {
|
||||
'x-component':
|
||||
'Grid',
|
||||
'x-initializer':
|
||||
'FormItemInitializers',
|
||||
'form:configureFields',
|
||||
properties: {
|
||||
uscd5l8tu2t:
|
||||
{
|
||||
@ -2136,7 +2134,7 @@ export const T2993: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'CreateFormActionInitializers',
|
||||
'x-initializer': 'createForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
@ -2201,7 +2199,7 @@ export const T2993: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'array',
|
||||
'x-initializer': 'TableColumnInitializers',
|
||||
'x-initializer': 'table:configureColumns',
|
||||
'x-component': 'TableV2',
|
||||
'x-component-props': {
|
||||
rowKey: 'id',
|
||||
@ -2221,7 +2219,7 @@ export const T2993: PageConfig = {
|
||||
'x-decorator': 'TableV2.Column.ActionBar',
|
||||
'x-component': 'TableV2.Column',
|
||||
'x-designer': 'TableV2.ActionColumnDesigner',
|
||||
'x-initializer': 'TableActionColumnInitializers',
|
||||
'x-initializer': 'table:configureItemActions',
|
||||
'x-index': 1,
|
||||
properties: {
|
||||
actions: {
|
||||
@ -2311,7 +2309,7 @@ export const T2615: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'BlockInitializers',
|
||||
'x-initializer': 'page:addBlock',
|
||||
properties: {
|
||||
'1valv0kj8vs': {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -2351,7 +2349,7 @@ export const T2615: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'TableActionInitializers',
|
||||
'x-initializer': 'table:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
style: {
|
||||
@ -2412,7 +2410,7 @@ export const T2615: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'CreateFormBlockInitializers',
|
||||
'x-initializer': 'popup:addNew:addBlock',
|
||||
properties: {
|
||||
'8ei3tsaojf6': {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -2457,7 +2455,7 @@ export const T2615: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'FormItemInitializers',
|
||||
'x-initializer': 'form:configureFields',
|
||||
properties: {
|
||||
i7cb2o172ey: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -2546,7 +2544,7 @@ export const T2615: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'CreateFormActionInitializers',
|
||||
'x-initializer': 'createForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
@ -2612,7 +2610,7 @@ export const T2615: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'array',
|
||||
'x-initializer': 'TableColumnInitializers',
|
||||
'x-initializer': 'table:configureColumns',
|
||||
'x-component': 'TableV2',
|
||||
'x-component-props': {
|
||||
rowKey: 'id',
|
||||
@ -2631,7 +2629,7 @@ export const T2615: PageConfig = {
|
||||
'x-decorator': 'TableV2.Column.ActionBar',
|
||||
'x-component': 'TableV2.Column',
|
||||
'x-designer': 'TableV2.ActionColumnDesigner',
|
||||
'x-initializer': 'TableActionColumnInitializers',
|
||||
'x-initializer': 'table:configureItemActions',
|
||||
properties: {
|
||||
actions: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -2693,7 +2691,7 @@ export const T2615: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'RecordBlockInitializers',
|
||||
'x-initializer': 'popup:common:addBlock',
|
||||
properties: {
|
||||
l79xm6sfjst: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -2741,7 +2739,7 @@ export const T2615: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'FormItemInitializers',
|
||||
'x-initializer': 'form:configureFields',
|
||||
properties: {
|
||||
'7eayo28dgzo': {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -2830,7 +2828,7 @@ export const T2615: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'UpdateFormActionInitializers',
|
||||
'x-initializer': 'editForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
@ -2936,7 +2934,7 @@ export const T2615: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'RecordBlockInitializers',
|
||||
'x-initializer': 'popup:common:addBlock',
|
||||
properties: {
|
||||
nlnfd9hnl53: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -2981,8 +2979,7 @@ export const T2615: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer':
|
||||
'ReadPrettyFormActionInitializers',
|
||||
'x-initializer': 'details:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
style: {
|
||||
@ -2998,8 +2995,7 @@ export const T2615: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer':
|
||||
'ReadPrettyFormItemInitializers',
|
||||
'x-initializer': 'details:configureFields',
|
||||
properties: {
|
||||
j9mxulol74m: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -3215,7 +3211,7 @@ export const T2845: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'BlockInitializers',
|
||||
'x-initializer': 'page:addBlock',
|
||||
'x-index': 1,
|
||||
properties: {
|
||||
'1valv0kj8vs': {
|
||||
@ -3259,7 +3255,7 @@ export const T2845: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'TableActionInitializers',
|
||||
'x-initializer': 'table:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
style: {
|
||||
@ -3325,7 +3321,7 @@ export const T2845: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'CreateFormBlockInitializers',
|
||||
'x-initializer': 'popup:addNew:addBlock',
|
||||
'x-index': 1,
|
||||
properties: {
|
||||
'8ei3tsaojf6': {
|
||||
@ -3375,7 +3371,7 @@ export const T2845: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'FormItemInitializers',
|
||||
'x-initializer': 'form:configureFields',
|
||||
'x-index': 1,
|
||||
properties: {
|
||||
i7cb2o172ey: {
|
||||
@ -3463,7 +3459,7 @@ export const T2845: PageConfig = {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer':
|
||||
'FormItemInitializers',
|
||||
'form:configureFields',
|
||||
properties: {
|
||||
'3wg2gga1tgx': {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -3564,7 +3560,7 @@ export const T2845: PageConfig = {
|
||||
'x-component':
|
||||
'Grid',
|
||||
'x-initializer':
|
||||
'RecordBlockInitializers',
|
||||
'popup:common:addBlock',
|
||||
'x-uid':
|
||||
'fen65isdi05',
|
||||
'x-async':
|
||||
@ -3650,7 +3646,7 @@ export const T2845: PageConfig = {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer':
|
||||
'RecordBlockInitializers',
|
||||
'popup:common:addBlock',
|
||||
properties: {
|
||||
dksoesw9cnq: {
|
||||
_isJSONSchemaObject:
|
||||
@ -3728,7 +3724,7 @@ export const T2845: PageConfig = {
|
||||
'x-component':
|
||||
'Grid',
|
||||
'x-initializer':
|
||||
'FormItemInitializers',
|
||||
'form:configureFields',
|
||||
'x-uid':
|
||||
'slesgjv4uxx',
|
||||
'x-async':
|
||||
@ -3743,7 +3739,7 @@ export const T2845: PageConfig = {
|
||||
'2.0',
|
||||
type: 'void',
|
||||
'x-initializer':
|
||||
'UpdateFormActionInitializers',
|
||||
'editForm:configureActions',
|
||||
'x-component':
|
||||
'ActionBar',
|
||||
'x-component-props':
|
||||
@ -3824,7 +3820,7 @@ export const T2845: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'CreateFormActionInitializers',
|
||||
'x-initializer': 'createForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
@ -3880,7 +3876,7 @@ export const T2845: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'array',
|
||||
'x-initializer': 'TableColumnInitializers',
|
||||
'x-initializer': 'table:configureColumns',
|
||||
'x-component': 'TableV2',
|
||||
'x-component-props': {
|
||||
rowKey: 'id',
|
||||
@ -3900,7 +3896,7 @@ export const T2845: PageConfig = {
|
||||
'x-decorator': 'TableV2.Column.ActionBar',
|
||||
'x-component': 'TableV2.Column',
|
||||
'x-designer': 'TableV2.ActionColumnDesigner',
|
||||
'x-initializer': 'TableActionColumnInitializers',
|
||||
'x-initializer': 'table:configureItemActions',
|
||||
'x-index': 1,
|
||||
properties: {
|
||||
actions: {
|
||||
@ -3967,7 +3963,7 @@ export const T2845: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'RecordBlockInitializers',
|
||||
'x-initializer': 'popup:common:addBlock',
|
||||
'x-index': 1,
|
||||
properties: {
|
||||
l79xm6sfjst: {
|
||||
@ -4020,7 +4016,7 @@ export const T2845: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'FormItemInitializers',
|
||||
'x-initializer': 'form:configureFields',
|
||||
'x-index': 1,
|
||||
properties: {
|
||||
'7eayo28dgzo': {
|
||||
@ -4107,7 +4103,7 @@ export const T2845: PageConfig = {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer':
|
||||
'FormItemInitializers',
|
||||
'form:configureFields',
|
||||
properties: {
|
||||
ddo3fvkz6hw: {
|
||||
_isJSONSchemaObject:
|
||||
@ -4235,7 +4231,7 @@ export const T2845: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'UpdateFormActionInitializers',
|
||||
'x-initializer': 'editForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
@ -4336,7 +4332,7 @@ export const T2845: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'RecordBlockInitializers',
|
||||
'x-initializer': 'popup:common:addBlock',
|
||||
'x-index': 1,
|
||||
properties: {
|
||||
nlnfd9hnl53: {
|
||||
@ -4386,8 +4382,7 @@ export const T2845: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer':
|
||||
'ReadPrettyFormActionInitializers',
|
||||
'x-initializer': 'details:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
style: {
|
||||
@ -4403,8 +4398,7 @@ export const T2845: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer':
|
||||
'ReadPrettyFormItemInitializers',
|
||||
'x-initializer': 'details:configureFields',
|
||||
'x-index': 2,
|
||||
properties: {
|
||||
j9mxulol74m: {
|
||||
@ -4491,7 +4485,7 @@ export const T2845: PageConfig = {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer':
|
||||
'FormItemInitializers',
|
||||
'form:configureFields',
|
||||
properties: {
|
||||
c5mcb8foh05: {
|
||||
_isJSONSchemaObject:
|
||||
@ -4697,7 +4691,7 @@ export const T2200 = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'BlockInitializers',
|
||||
'x-initializer': 'page:addBlock',
|
||||
properties: {
|
||||
ai6ojrzwkiv: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -4737,7 +4731,7 @@ export const T2200 = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'TableActionInitializers',
|
||||
'x-initializer': 'table:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
style: {
|
||||
@ -4752,7 +4746,7 @@ export const T2200 = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'array',
|
||||
'x-initializer': 'TableColumnInitializers',
|
||||
'x-initializer': 'table:configureColumns',
|
||||
'x-component': 'TableV2',
|
||||
'x-component-props': {
|
||||
rowKey: 'id',
|
||||
@ -4771,7 +4765,7 @@ export const T2200 = {
|
||||
'x-decorator': 'TableV2.Column.ActionBar',
|
||||
'x-component': 'TableV2.Column',
|
||||
'x-designer': 'TableV2.ActionColumnDesigner',
|
||||
'x-initializer': 'TableActionColumnInitializers',
|
||||
'x-initializer': 'table:configureItemActions',
|
||||
properties: {
|
||||
actions: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -4832,7 +4826,7 @@ export const T2200 = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'RecordBlockInitializers',
|
||||
'x-initializer': 'popup:common:addBlock',
|
||||
properties: {
|
||||
dv88ljcl0qw: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -4880,7 +4874,7 @@ export const T2200 = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'FormItemInitializers',
|
||||
'x-initializer': 'form:configureFields',
|
||||
properties: {
|
||||
'3i87cpmv87x': {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -4926,7 +4920,7 @@ export const T2200 = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'UpdateFormActionInitializers',
|
||||
'x-initializer': 'editForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
@ -5039,7 +5033,7 @@ export const T3106: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'BlockInitializers',
|
||||
'x-initializer': 'page:addBlock',
|
||||
'x-index': 1,
|
||||
properties: {
|
||||
cxk2aa058lc: {
|
||||
@ -5089,7 +5083,7 @@ export const T3106: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'FormItemInitializers',
|
||||
'x-initializer': 'form:configureFields',
|
||||
'x-index': 1,
|
||||
properties: {
|
||||
wbvuzjzl83g: {
|
||||
@ -5123,7 +5117,7 @@ export const T3106: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'AssociationField.SubTable',
|
||||
'x-initializer': 'TableColumnInitializers',
|
||||
'x-initializer': 'table:configureColumns',
|
||||
'x-initializer-props': {
|
||||
action: false,
|
||||
},
|
||||
@ -5187,7 +5181,7 @@ export const T3106: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'FormActionInitializers',
|
||||
'x-initializer': 'createForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
@ -5259,7 +5253,7 @@ export const T3251: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'BlockInitializers',
|
||||
'x-initializer': 'page:addBlock',
|
||||
properties: {
|
||||
xovhjqo0uig: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -5305,7 +5299,7 @@ export const T3251: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'FormItemInitializers',
|
||||
'x-initializer': 'form:configureFields',
|
||||
'x-linkage-rules': [
|
||||
{
|
||||
condition: {
|
||||
@ -5448,7 +5442,7 @@ export const T3251: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'FormActionInitializers',
|
||||
'x-initializer': 'createForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
|
@ -7,7 +7,7 @@ test.describe('where edit form block can be added', () => {
|
||||
await nocoPage.goto();
|
||||
|
||||
await page.getByLabel('action-Action.Link-Edit-update-general-table-0').click();
|
||||
await page.getByLabel('schema-initializer-Grid-RecordBlockInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover();
|
||||
await page.getByText('Form').first().click();
|
||||
await page.mouse.move(300, 0);
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer';
|
||||
import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
|
||||
export const createFormActionInitializers = new SchemaInitializer({
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const createFormActionInitializers_deprecated = new CompatibleSchemaInitializer({
|
||||
name: 'CreateFormActionInitializers',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
@ -43,3 +46,50 @@ export const createFormActionInitializers = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const createFormActionInitializers = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'createForm:configureActions',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
items: [
|
||||
{
|
||||
type: 'itemGroup',
|
||||
title: '{{t("Enable actions")}}',
|
||||
name: 'enableActions',
|
||||
children: [
|
||||
{
|
||||
name: 'submit',
|
||||
title: '{{t("Submit")}}',
|
||||
Component: 'CreateSubmitActionInitializer',
|
||||
schema: {
|
||||
'x-action-settings': {},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'divider',
|
||||
type: 'divider',
|
||||
},
|
||||
{
|
||||
type: 'subMenu',
|
||||
title: '{{t("Customize")}}',
|
||||
name: 'customize',
|
||||
children: [
|
||||
{
|
||||
name: 'saveRecord',
|
||||
title: '{{t("Save record")}}',
|
||||
Component: 'SaveRecordActionInitializer',
|
||||
},
|
||||
{
|
||||
name: 'customRequest',
|
||||
title: '{{t("Custom request")}}',
|
||||
Component: 'CustomRequestInitializer',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
createFormActionInitializers_deprecated,
|
||||
);
|
||||
|
@ -1,7 +1,9 @@
|
||||
import { SchemaInitializerItemType } from '../../../../application';
|
||||
import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer';
|
||||
|
||||
// 表单的操作配置
|
||||
/**
|
||||
* @deprecated
|
||||
* 表单的操作配置
|
||||
*/
|
||||
export const formActionInitializers = new SchemaInitializer({
|
||||
name: 'FormActionInitializers',
|
||||
title: '{{t("Configure actions")}}',
|
||||
@ -27,7 +29,7 @@ export const formActionInitializers = new SchemaInitializer({
|
||||
type: 'divider',
|
||||
},
|
||||
{
|
||||
name: 'custom',
|
||||
name: 'customize',
|
||||
type: 'subMenu',
|
||||
title: '{{t("Customize")}}',
|
||||
children: [
|
||||
|
@ -1,10 +1,12 @@
|
||||
import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer';
|
||||
import { gridRowColWrap, useFormItemInitializerFields } from '../../../../schema-initializer/utils';
|
||||
import { ParentCollectionFields, AssociatedFields } from '../../../../schema-initializer/buttons/FormItemInitializers';
|
||||
import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
|
||||
// 表单里配置字段
|
||||
|
||||
export const formItemInitializers = new SchemaInitializer({
|
||||
/**
|
||||
* @deprecated
|
||||
* 表单里配置字段
|
||||
*/
|
||||
export const formItemInitializers_deprecated = new CompatibleSchemaInitializer({
|
||||
name: 'FormItemInitializers',
|
||||
wrap: gridRowColWrap,
|
||||
icon: 'SettingOutlined',
|
||||
@ -35,3 +37,38 @@ export const formItemInitializers = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const formItemInitializers = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'form:configureFields',
|
||||
wrap: gridRowColWrap,
|
||||
icon: 'SettingOutlined',
|
||||
title: '{{t("Configure fields")}}',
|
||||
items: [
|
||||
{
|
||||
type: 'itemGroup',
|
||||
name: 'displayFields',
|
||||
title: '{{t("Display fields")}}',
|
||||
useChildren: useFormItemInitializerFields,
|
||||
},
|
||||
{
|
||||
name: 'parentCollectionFields',
|
||||
Component: ParentCollectionFields,
|
||||
},
|
||||
{
|
||||
name: 'associationFields',
|
||||
Component: AssociatedFields,
|
||||
},
|
||||
{
|
||||
name: 'divider',
|
||||
type: 'divider',
|
||||
},
|
||||
{
|
||||
name: 'addText',
|
||||
title: '{{t("Add text")}}',
|
||||
Component: 'MarkdownFormItemInitializer',
|
||||
},
|
||||
],
|
||||
},
|
||||
formItemInitializers_deprecated,
|
||||
);
|
||||
|
@ -1,6 +1,9 @@
|
||||
import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer';
|
||||
import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
|
||||
export const updateFormActionInitializers = new SchemaInitializer({
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const updateFormActionInitializers_deprecated = new CompatibleSchemaInitializer({
|
||||
name: 'UpdateFormActionInitializers',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
@ -54,3 +57,61 @@ export const updateFormActionInitializers = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const updateFormActionInitializers = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'editForm:configureActions',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
items: [
|
||||
{
|
||||
type: 'itemGroup',
|
||||
title: '{{t("Enable actions")}}',
|
||||
name: 'enableActions',
|
||||
children: [
|
||||
{
|
||||
name: 'submit',
|
||||
title: '{{t("Submit")}}',
|
||||
Component: 'UpdateSubmitActionInitializer',
|
||||
schema: {
|
||||
'x-action-settings': {},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'divider',
|
||||
type: 'divider',
|
||||
},
|
||||
{
|
||||
type: 'subMenu',
|
||||
title: '{{t("Customize")}}',
|
||||
name: 'customize',
|
||||
children: [
|
||||
{
|
||||
name: 'popup',
|
||||
title: '{{t("Popup")}}',
|
||||
Component: 'PopupActionInitializer',
|
||||
useComponentProps() {
|
||||
return {
|
||||
'x-component': 'Action',
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'saveRecord',
|
||||
title: '{{t("Save record")}}',
|
||||
Component: 'SaveRecordActionInitializer',
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
name: 'customRequest',
|
||||
title: '{{t("Custom request")}}',
|
||||
Component: 'CustomRequestInitializer',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
updateFormActionInitializers_deprecated,
|
||||
);
|
||||
|
@ -1,8 +1,10 @@
|
||||
import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer';
|
||||
import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
import { useCollection_deprecated } from '../../../../collection-manager';
|
||||
|
||||
// 表单的操作配置
|
||||
export const gridCardActionInitializers = new SchemaInitializer({
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const gridCardActionInitializers_deprecated = new CompatibleSchemaInitializer({
|
||||
name: 'GridCardActionInitializers',
|
||||
title: "{{t('Configure actions')}}",
|
||||
icon: 'SettingOutlined',
|
||||
@ -80,3 +82,85 @@ export const gridCardActionInitializers = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const gridCardActionInitializers = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'gridCard:configureActions',
|
||||
title: "{{t('Configure actions')}}",
|
||||
icon: 'SettingOutlined',
|
||||
style: {
|
||||
marginLeft: 8,
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: 'itemGroup',
|
||||
title: "{{t('Enable actions')}}",
|
||||
name: 'enableActions',
|
||||
children: [
|
||||
{
|
||||
name: 'filter',
|
||||
title: "{{t('Filter')}}",
|
||||
Component: 'FilterActionInitializer',
|
||||
schema: {
|
||||
'x-align': 'left',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'addNew',
|
||||
title: "{{t('Add new')}}",
|
||||
Component: 'CreateActionInitializer',
|
||||
schema: {
|
||||
'x-align': 'right',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
'x-acl-action-props': {
|
||||
skipScopeCheck: true,
|
||||
},
|
||||
},
|
||||
useVisible() {
|
||||
const collection = useCollection_deprecated();
|
||||
return !['view', 'file', 'sql'].includes(collection.template) || collection?.writableView;
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'refresh',
|
||||
title: "{{t('Refresh')}}",
|
||||
Component: 'RefreshActionInitializer',
|
||||
schema: {
|
||||
'x-align': 'right',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'import',
|
||||
title: "{{t('Import')}}",
|
||||
Component: 'ImportActionInitializer',
|
||||
schema: {
|
||||
'x-align': 'right',
|
||||
'x-acl-action': 'importXlsx',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
'x-acl-action-props': {
|
||||
skipScopeCheck: true,
|
||||
},
|
||||
},
|
||||
useVisible() {
|
||||
const collection = useCollection_deprecated();
|
||||
return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql';
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'export',
|
||||
title: "{{t('Export')}}",
|
||||
Component: 'ExportActionInitializer',
|
||||
schema: {
|
||||
'x-align': 'right',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
'x-acl-action-props': {
|
||||
skipScopeCheck: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
gridCardActionInitializers_deprecated,
|
||||
);
|
||||
|
@ -4,7 +4,7 @@ test.describe('where grid card block can be added', () => {
|
||||
test('page', async ({ page, mockPage }) => {
|
||||
await mockPage().goto();
|
||||
|
||||
await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-page:addBlock').hover();
|
||||
await createBlockInPage(page, 'Grid Card');
|
||||
await expect(page.getByLabel('block-item-BlockItem-users-grid-card')).toBeVisible();
|
||||
});
|
||||
@ -16,7 +16,7 @@ test.describe('configure global actions', () => {
|
||||
test('filter & add new & refresh', async ({ page, mockPage }) => {
|
||||
await mockPage(oneEmptyGridCardBlock).goto();
|
||||
|
||||
await page.getByLabel('schema-initializer-ActionBar-GridCardActionInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-gridCard:configureActions-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'Filter' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Add new' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Refresh' }).click();
|
||||
@ -31,7 +31,7 @@ test.describe('configure global actions', () => {
|
||||
await expect(page.getByRole('button', { name: 'Refresh' })).toBeVisible();
|
||||
|
||||
// delete buttons
|
||||
await page.getByLabel('schema-initializer-ActionBar-GridCardActionInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-gridCard:configureActions-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'Filter' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Add new' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Refresh' }).click();
|
||||
@ -53,7 +53,7 @@ test.describe('configure item actions', () => {
|
||||
await mockRecord('general');
|
||||
await nocoPage.goto();
|
||||
|
||||
await page.getByLabel('schema-initializer-ActionBar-GridCardItemActionInitializers-general').first().hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-gridCard:configureItemActions-general').first().hover();
|
||||
await page.getByRole('menuitem', { name: 'View' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Edit' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Delete' }).click();
|
||||
@ -68,7 +68,7 @@ test.describe('configure item actions', () => {
|
||||
await expect(page.getByLabel('action-Action.Link-Delete-destroy-general-grid-card').first()).toBeVisible();
|
||||
|
||||
// delete buttons
|
||||
await page.getByLabel('schema-initializer-ActionBar-GridCardItemActionInitializers-general').first().hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-gridCard:configureItemActions-general').first().hover();
|
||||
await page.getByRole('menuitem', { name: 'View' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Edit' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Delete' }).click();
|
||||
@ -88,7 +88,7 @@ test.describe('configure item actions', () => {
|
||||
await mockRecord('general');
|
||||
await nocoPage.goto();
|
||||
|
||||
await page.getByLabel('schema-initializer-ActionBar-GridCardItemActionInitializers-general').first().hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-gridCard:configureItemActions-general').first().hover();
|
||||
await page.getByRole('menuitem', { name: 'Customize' }).hover();
|
||||
await page.getByRole('menuitem', { name: 'Popup' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Update record' }).click();
|
||||
@ -107,9 +107,7 @@ test.describe('configure fields', () => {
|
||||
await mockRecord('general');
|
||||
await nocoPage.goto();
|
||||
|
||||
const formItemInitializer = page
|
||||
.getByLabel('schema-initializer-Grid-ReadPrettyFormItemInitializers-general')
|
||||
.first();
|
||||
const formItemInitializer = page.getByLabel('schema-initializer-Grid-details:configureFields-general').first();
|
||||
|
||||
await formItemInitializer.hover();
|
||||
await page.getByRole('menuitem', { name: 'ID', exact: true }).click();
|
||||
|
@ -1,7 +1,10 @@
|
||||
import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer';
|
||||
import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
import { useCollection_deprecated } from '../../../../collection-manager';
|
||||
|
||||
export const gridCardItemActionInitializers = new SchemaInitializer({
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const gridCardItemActionInitializers_deprecated = new CompatibleSchemaInitializer({
|
||||
name: 'GridCardItemActionInitializers',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
@ -98,3 +101,104 @@ export const gridCardItemActionInitializers = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const gridCardItemActionInitializers = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'gridCard:configureItemActions',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
items: [
|
||||
{
|
||||
type: 'itemGroup',
|
||||
title: '{{t("Enable actions")}}',
|
||||
name: 'enable-actions',
|
||||
children: [
|
||||
{
|
||||
name: 'view',
|
||||
title: '{{t("View")}}',
|
||||
Component: 'ViewActionInitializer',
|
||||
schema: {
|
||||
'x-component': 'Action.Link',
|
||||
'x-action': 'view',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
'x-align': 'left',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
title: '{{t("Edit")}}',
|
||||
Component: 'UpdateActionInitializer',
|
||||
schema: {
|
||||
'x-component': 'Action.Link',
|
||||
'x-action': 'update',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
'x-align': 'left',
|
||||
},
|
||||
useVisible() {
|
||||
const collection = useCollection_deprecated();
|
||||
return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql';
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'delete',
|
||||
title: '{{t("Delete")}}',
|
||||
Component: 'DestroyActionInitializer',
|
||||
schema: {
|
||||
'x-component': 'Action.Link',
|
||||
'x-action': 'destroy',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
'x-align': 'left',
|
||||
},
|
||||
useVisible() {
|
||||
const collection = useCollection_deprecated();
|
||||
return collection.template !== 'sql';
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'divider',
|
||||
type: 'divider',
|
||||
},
|
||||
{
|
||||
type: 'subMenu',
|
||||
title: '{{t("Customize")}}',
|
||||
name: 'customize',
|
||||
children: [
|
||||
{
|
||||
name: 'popup',
|
||||
title: '{{t("Popup")}}',
|
||||
Component: 'PopupActionInitializer',
|
||||
useComponentProps() {
|
||||
return {
|
||||
'x-component': 'Action.Link',
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'update-record',
|
||||
title: '{{t("Update record")}}',
|
||||
Component: 'UpdateRecordActionInitializer',
|
||||
useVisible() {
|
||||
const collection = useCollection_deprecated();
|
||||
return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql';
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'customRequest',
|
||||
title: '{{t("Custom request")}}',
|
||||
Component: 'CustomRequestInitializer',
|
||||
schema: {
|
||||
'x-action': 'customize:table:request',
|
||||
},
|
||||
useVisible() {
|
||||
const collection = useCollection_deprecated();
|
||||
return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql';
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
gridCardItemActionInitializers_deprecated,
|
||||
);
|
||||
|
@ -1,8 +1,11 @@
|
||||
import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer';
|
||||
import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
import { useCollection_deprecated } from '../../../../collection-manager';
|
||||
|
||||
// 表单的操作配置
|
||||
export const listActionInitializers = new SchemaInitializer({
|
||||
/**
|
||||
* @deprecated
|
||||
* 表单的操作配置
|
||||
*/
|
||||
export const listActionInitializers_deprecated = new CompatibleSchemaInitializer({
|
||||
name: 'ListActionInitializers',
|
||||
title: "{{t('Configure actions')}}",
|
||||
icon: 'SettingOutlined',
|
||||
@ -84,3 +87,89 @@ export const listActionInitializers = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const listActionInitializers = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'list:configureActions',
|
||||
title: "{{t('Configure actions')}}",
|
||||
icon: 'SettingOutlined',
|
||||
style: {
|
||||
marginLeft: 8,
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: 'itemGroup',
|
||||
name: 'enableActions',
|
||||
title: "{{t('Enable actions')}}",
|
||||
children: [
|
||||
{
|
||||
name: 'filter',
|
||||
title: "{{t('Filter')}}",
|
||||
Component: 'FilterActionInitializer',
|
||||
schema: {
|
||||
'x-align': 'left',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'addNew',
|
||||
title: "{{t('Add new')}}",
|
||||
Component: 'CreateActionInitializer',
|
||||
schema: {
|
||||
'x-align': 'right',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
'x-acl-action-props': {
|
||||
skipScopeCheck: true,
|
||||
},
|
||||
},
|
||||
useVisible() {
|
||||
const collection = useCollection_deprecated();
|
||||
return (
|
||||
(collection.template !== 'view' || collection?.writableView) &&
|
||||
collection.template !== 'file' &&
|
||||
collection.template !== 'sql'
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'refresh',
|
||||
title: "{{t('Refresh')}}",
|
||||
Component: 'RefreshActionInitializer',
|
||||
schema: {
|
||||
'x-align': 'right',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'import',
|
||||
title: "{{t('Import')}}",
|
||||
Component: 'ImportActionInitializer',
|
||||
schema: {
|
||||
'x-align': 'right',
|
||||
'x-acl-action': 'importXlsx',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
'x-acl-action-props': {
|
||||
skipScopeCheck: true,
|
||||
},
|
||||
},
|
||||
useVisible() {
|
||||
const collection = useCollection_deprecated();
|
||||
return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql';
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'export',
|
||||
title: "{{t('Export')}}",
|
||||
Component: 'ExportActionInitializer',
|
||||
schema: {
|
||||
'x-align': 'right',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
'x-acl-action-props': {
|
||||
skipScopeCheck: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
listActionInitializers_deprecated,
|
||||
);
|
||||
|
@ -4,7 +4,7 @@ test.describe('where list block can be added', () => {
|
||||
test('page', async ({ page, mockPage }) => {
|
||||
await mockPage().goto();
|
||||
|
||||
await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-page:addBlock').hover();
|
||||
await createBlockInPage(page, 'List');
|
||||
await expect(page.getByLabel('block-item-CardItem-users-list')).toBeVisible();
|
||||
});
|
||||
@ -14,7 +14,7 @@ test.describe('configure global actions', () => {
|
||||
test('filter & add new & refresh', async ({ page, mockPage }) => {
|
||||
await mockPage(oneEmptyListBlock).goto();
|
||||
|
||||
await page.getByLabel('schema-initializer-ActionBar-ListActionInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-list:configureActions-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'Filter' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Add new' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Refresh' }).click();
|
||||
@ -29,7 +29,7 @@ test.describe('configure global actions', () => {
|
||||
await expect(page.getByRole('button', { name: 'Refresh' })).toBeVisible();
|
||||
|
||||
// delete buttons
|
||||
await page.getByLabel('schema-initializer-ActionBar-ListActionInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-list:configureActions-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'Filter' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Add new' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Refresh' }).click();
|
||||
@ -51,7 +51,7 @@ test.describe('configure item actions', () => {
|
||||
await mockRecord('general');
|
||||
await nocoPage.goto();
|
||||
|
||||
await page.getByLabel('schema-initializer-ActionBar-ListItemActionInitializers-general').first().hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-list:configureItemActions-general').first().hover();
|
||||
await page.getByRole('menuitem', { name: 'View' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Edit' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Delete' }).click();
|
||||
@ -66,7 +66,7 @@ test.describe('configure item actions', () => {
|
||||
await expect(page.getByLabel('action-Action.Link-Delete-destroy-general-list').first()).toBeVisible();
|
||||
|
||||
// delete buttons
|
||||
await page.getByLabel('schema-initializer-ActionBar-ListItemActionInitializers-general').first().hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-list:configureItemActions-general').first().hover();
|
||||
await page.getByRole('menuitem', { name: 'View' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Edit' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Delete' }).click();
|
||||
@ -86,7 +86,7 @@ test.describe('configure item actions', () => {
|
||||
await mockRecord('general');
|
||||
await nocoPage.goto();
|
||||
|
||||
await page.getByLabel('schema-initializer-ActionBar-ListItemActionInitializers-general').first().hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-list:configureItemActions-general').first().hover();
|
||||
await page.getByRole('menuitem', { name: 'Customize' }).hover();
|
||||
await page.getByRole('menuitem', { name: 'Popup' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Update record' }).click();
|
||||
@ -105,9 +105,7 @@ test.describe('configure fields', () => {
|
||||
await mockRecord('general');
|
||||
await nocoPage.goto();
|
||||
|
||||
const formItemInitializer = page
|
||||
.getByLabel('schema-initializer-Grid-ReadPrettyFormItemInitializers-general')
|
||||
.first();
|
||||
const formItemInitializer = page.getByLabel('schema-initializer-Grid-details:configureFields-general').first();
|
||||
|
||||
// add fields
|
||||
await formItemInitializer.hover();
|
||||
|
@ -1,7 +1,10 @@
|
||||
import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer';
|
||||
import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
import { useCollection_deprecated } from '../../../../collection-manager';
|
||||
|
||||
export const listItemActionInitializers = new SchemaInitializer({
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const listItemActionInitializers_deprecated = new CompatibleSchemaInitializer({
|
||||
name: 'ListItemActionInitializers',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
@ -98,3 +101,104 @@ export const listItemActionInitializers = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const listItemActionInitializers = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'list:configureItemActions',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
items: [
|
||||
{
|
||||
type: 'itemGroup',
|
||||
name: 'enableActions',
|
||||
title: '{{t("Enable actions")}}',
|
||||
children: [
|
||||
{
|
||||
name: 'view',
|
||||
title: '{{t("View")}}',
|
||||
Component: 'ViewActionInitializer',
|
||||
schema: {
|
||||
'x-component': 'Action.Link',
|
||||
'x-action': 'view',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
'x-align': 'left',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
title: '{{t("Edit")}}',
|
||||
Component: 'UpdateActionInitializer',
|
||||
schema: {
|
||||
'x-component': 'Action.Link',
|
||||
'x-action': 'update',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
'x-align': 'left',
|
||||
},
|
||||
useVisible() {
|
||||
const collection = useCollection_deprecated();
|
||||
return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql';
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'delete',
|
||||
title: '{{t("Delete")}}',
|
||||
Component: 'DestroyActionInitializer',
|
||||
schema: {
|
||||
'x-component': 'Action.Link',
|
||||
'x-action': 'destroy',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
'x-align': 'left',
|
||||
},
|
||||
useVisible() {
|
||||
const collection = useCollection_deprecated();
|
||||
return collection.template !== 'sql';
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'divider',
|
||||
type: 'divider',
|
||||
},
|
||||
{
|
||||
type: 'subMenu',
|
||||
title: '{{t("Customize")}}',
|
||||
name: 'customize',
|
||||
children: [
|
||||
{
|
||||
name: 'popup',
|
||||
title: '{{t("Popup")}}',
|
||||
Component: 'PopupActionInitializer',
|
||||
useComponentProps() {
|
||||
return {
|
||||
'x-component': 'Action.Link',
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'updateRecord',
|
||||
title: '{{t("Update record")}}',
|
||||
Component: 'UpdateRecordActionInitializer',
|
||||
useVisible() {
|
||||
const collection = useCollection_deprecated();
|
||||
return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql';
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'customRequest',
|
||||
title: '{{t("Custom request")}}',
|
||||
Component: 'CustomRequestInitializer',
|
||||
schema: {
|
||||
'x-action': 'customize:table:request',
|
||||
},
|
||||
useVisible() {
|
||||
const collection = useCollection_deprecated();
|
||||
return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql';
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
listItemActionInitializers_deprecated,
|
||||
);
|
||||
|
@ -20,7 +20,7 @@ test.describe('configure actions', () => {
|
||||
await createTable({ page, mockPage, fieldName: 'manyToOne' });
|
||||
|
||||
// add buttons
|
||||
await page.getByLabel('schema-initializer-ActionBar-TableActionInitializers-users').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-table:configureActions-users').hover();
|
||||
await page.getByRole('menuitem', { name: 'Filter' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Add new' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Delete' }).click();
|
||||
@ -38,7 +38,7 @@ test.describe('configure actions', () => {
|
||||
await expect(page.getByRole('button', { name: 'Refresh' })).toBeVisible();
|
||||
|
||||
// delete buttons
|
||||
await page.getByLabel('schema-initializer-ActionBar-TableActionInitializers-users').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-table:configureActions-users').hover();
|
||||
await page.getByRole('menuitem', { name: 'Filter' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Add new' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Delete' }).click();
|
||||
@ -59,7 +59,7 @@ test.describe('configure actions', () => {
|
||||
test('customize: bulk update', async ({ page, mockPage }) => {
|
||||
await createTable({ page, mockPage, fieldName: 'manyToOne' });
|
||||
|
||||
await page.getByLabel('schema-initializer-ActionBar-TableActionInitializers-users').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-table:configureActions-users').hover();
|
||||
await page.getByRole('menuitem', { name: 'Customize' }).hover();
|
||||
await page.getByRole('menuitem', { name: 'Bulk update' }).click();
|
||||
|
||||
@ -99,6 +99,6 @@ test.describe('configure actions column', () => {
|
||||
});
|
||||
|
||||
async function createActionColumn(page: Page) {
|
||||
await page.getByLabel('schema-initializer-TableV2.Selector-TableColumnInitializers-users').hover();
|
||||
await page.getByLabel('schema-initializer-TableV2.Selector-table:configureColumns-users').hover();
|
||||
await page.getByRole('menuitem', { name: 'Action column' }).click();
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ export async function createTable({
|
||||
.click();
|
||||
|
||||
// create a table block
|
||||
await page.getByLabel('schema-initializer-Grid-TableSelectorInitializers-users').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-popup:tableSelector:addBlock-users').hover();
|
||||
await page.getByRole('menuitem', { name: 'form Table' }).click();
|
||||
await page.mouse.move(300, 0);
|
||||
}
|
||||
|
@ -4,11 +4,13 @@ import _ from 'lodash';
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useAPIClient } from '../../../../api-client';
|
||||
import { SchemaInitializerActionModal, SchemaInitializerItem, useSchemaInitializer } from '../../../../application';
|
||||
import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer';
|
||||
import { useCollection_deprecated } from '../../../../collection-manager';
|
||||
import { createDesignable, useDesignable } from '../../../../schema-component';
|
||||
import { useGetAriaLabelOfDesigner } from '../../../../schema-settings/hooks/useGetAriaLabelOfDesigner';
|
||||
import { SchemaInitializerActionModal } from '../../../../application/schema-initializer/components/SchemaInitializerActionModal';
|
||||
import { useSchemaInitializer } from '../../../../application/schema-initializer/context';
|
||||
import { SchemaInitializerItem } from '../../../../application/schema-initializer/components/SchemaInitializerItem';
|
||||
import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
|
||||
export const Resizable = () => {
|
||||
const { t } = useTranslation();
|
||||
@ -63,7 +65,10 @@ export const Resizable = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export const tableActionColumnInitializers = new SchemaInitializer({
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const tableActionColumnInitializers_deprecated = new CompatibleSchemaInitializer({
|
||||
name: 'TableActionColumnInitializers',
|
||||
insertPosition: 'beforeEnd',
|
||||
useInsert: function useInsert() {
|
||||
@ -221,3 +226,165 @@ export const tableActionColumnInitializers = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const tableActionColumnInitializers = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'table:configureItemActions',
|
||||
insertPosition: 'beforeEnd',
|
||||
useInsert: function useInsert() {
|
||||
const { refresh } = useDesignable();
|
||||
const fieldSchema = useFieldSchema();
|
||||
const api = useAPIClient();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return function insert(schema) {
|
||||
const spaceSchema = fieldSchema.reduceProperties((buf, schema) => {
|
||||
if (schema['x-component'] === 'Space') {
|
||||
return schema;
|
||||
}
|
||||
return buf;
|
||||
}, null);
|
||||
if (!spaceSchema) {
|
||||
return;
|
||||
}
|
||||
_.set(schema, 'x-designer-props.linkageAction', true);
|
||||
const dn = createDesignable({
|
||||
t,
|
||||
api,
|
||||
refresh,
|
||||
current: spaceSchema,
|
||||
});
|
||||
dn.loadAPIClientEvents();
|
||||
dn.insertBeforeEnd(schema);
|
||||
};
|
||||
},
|
||||
Component: (props: any) => {
|
||||
const { getAriaLabel } = useGetAriaLabelOfDesigner();
|
||||
return (
|
||||
<MenuOutlined
|
||||
{...props}
|
||||
role="button"
|
||||
aria-label={getAriaLabel('schema-settings')}
|
||||
style={{ cursor: 'pointer' }}
|
||||
/>
|
||||
);
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: 'itemGroup',
|
||||
name: 'actions',
|
||||
title: '{{t("Enable actions")}}',
|
||||
children: [
|
||||
{
|
||||
type: 'item',
|
||||
title: '{{t("View")}}',
|
||||
name: 'view',
|
||||
Component: 'ViewActionInitializer',
|
||||
schema: {
|
||||
'x-component': 'Action.Link',
|
||||
'x-action': 'view',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
name: 'edit',
|
||||
title: '{{t("Edit")}}',
|
||||
Component: 'UpdateActionInitializer',
|
||||
schema: {
|
||||
'x-component': 'Action.Link',
|
||||
'x-action': 'update',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
},
|
||||
useVisible() {
|
||||
const collection = useCollection_deprecated();
|
||||
return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql';
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
title: '{{t("Delete")}}',
|
||||
name: 'delete',
|
||||
Component: 'DestroyActionInitializer',
|
||||
schema: {
|
||||
'x-component': 'Action.Link',
|
||||
'x-action': 'destroy',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
},
|
||||
useVisible() {
|
||||
const collection = useCollection_deprecated();
|
||||
return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql';
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
title: '{{t("Add child")}}',
|
||||
name: 'addChildren',
|
||||
Component: 'CreateChildInitializer',
|
||||
schema: {
|
||||
'x-component': 'Action.Link',
|
||||
'x-action': 'create',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
},
|
||||
useVisible() {
|
||||
const fieldSchema = useFieldSchema();
|
||||
const collection = useCollection_deprecated();
|
||||
const { treeTable } = fieldSchema?.parent?.parent['x-decorator-props'] || {};
|
||||
return collection.tree && treeTable !== false;
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'divider',
|
||||
type: 'divider',
|
||||
},
|
||||
{
|
||||
type: 'subMenu',
|
||||
title: '{{t("Customize")}}',
|
||||
name: 'customize',
|
||||
children: [
|
||||
{
|
||||
type: 'item',
|
||||
title: '{{t("Popup")}}',
|
||||
name: 'popup',
|
||||
Component: 'PopupActionInitializer',
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
title: '{{t("Update record")}}',
|
||||
name: 'updateRecord',
|
||||
Component: 'UpdateRecordActionInitializer',
|
||||
useVisible() {
|
||||
const collection = useCollection_deprecated();
|
||||
return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql';
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'customRequest',
|
||||
title: '{{t("Custom request")}}',
|
||||
Component: 'CustomRequestInitializer',
|
||||
schema: {
|
||||
'x-action': 'customize:table:request',
|
||||
},
|
||||
useVisible() {
|
||||
const collection = useCollection_deprecated();
|
||||
return (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql';
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'divider2',
|
||||
type: 'divider',
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
name: 'columnWidth',
|
||||
title: 't("Column width")',
|
||||
Component: Resizable,
|
||||
},
|
||||
],
|
||||
},
|
||||
tableActionColumnInitializers_deprecated,
|
||||
);
|
||||
|
@ -1,9 +1,12 @@
|
||||
import { useFieldSchema } from '@formily/react';
|
||||
import { useCollection_deprecated } from '../../../..';
|
||||
import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer';
|
||||
import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
import { useCollection_deprecated } from '../../../../collection-manager/hooks/useCollection_deprecated';
|
||||
|
||||
// 表格操作配置
|
||||
export const tableActionInitializers = new SchemaInitializer({
|
||||
/**
|
||||
* @deprecated
|
||||
* 表格操作配置
|
||||
*/
|
||||
export const tableActionInitializers_deprecated = new CompatibleSchemaInitializer({
|
||||
name: 'TableActionInitializers',
|
||||
title: "{{t('Configure actions')}}",
|
||||
icon: 'SettingOutlined',
|
||||
@ -116,3 +119,120 @@ export const tableActionInitializers = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const tableActionInitializers = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'table:configureActions',
|
||||
title: "{{t('Configure actions')}}",
|
||||
icon: 'SettingOutlined',
|
||||
style: {
|
||||
marginLeft: 8,
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: 'itemGroup',
|
||||
name: 'enableActions',
|
||||
title: "{{t('Enable actions')}}",
|
||||
children: [
|
||||
{
|
||||
type: 'item',
|
||||
name: 'filter',
|
||||
title: "{{t('Filter')}}",
|
||||
Component: 'FilterActionInitializer',
|
||||
schema: {
|
||||
'x-align': 'left',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
title: "{{t('Add new')}}",
|
||||
name: 'addNew',
|
||||
Component: 'CreateActionInitializer',
|
||||
schema: {
|
||||
'x-align': 'right',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
'x-acl-action-props': {
|
||||
skipScopeCheck: true,
|
||||
},
|
||||
},
|
||||
useVisible() {
|
||||
const collection = useCollection_deprecated();
|
||||
return !['view', 'file', 'sql'].includes(collection.template) || collection?.writableView;
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
title: "{{t('Delete')}}",
|
||||
name: 'delete',
|
||||
Component: 'BulkDestroyActionInitializer',
|
||||
schema: {
|
||||
'x-align': 'right',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
},
|
||||
useVisible() {
|
||||
const collection = useCollection_deprecated();
|
||||
return !['view', 'sql'].includes(collection.template) || collection?.writableView;
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
title: "{{t('Refresh')}}",
|
||||
name: 'refresh',
|
||||
Component: 'RefreshActionInitializer',
|
||||
schema: {
|
||||
'x-align': 'right',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'toggle',
|
||||
title: "{{t('Expand/Collapse')}}",
|
||||
Component: 'ExpandableActionInitializer',
|
||||
schema: {
|
||||
'x-align': 'right',
|
||||
},
|
||||
useVisible() {
|
||||
const schema = useFieldSchema();
|
||||
const collection = useCollection_deprecated();
|
||||
const { treeTable } = schema?.parent?.['x-decorator-props'] || {};
|
||||
return collection.tree && treeTable !== false;
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'divider',
|
||||
type: 'divider',
|
||||
useVisible() {
|
||||
const collection = useCollection_deprecated();
|
||||
return !['view', 'sql'].includes(collection.template) || collection?.writableView;
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'subMenu',
|
||||
name: 'customize',
|
||||
title: '{{t("Customize")}}',
|
||||
children: [
|
||||
{
|
||||
type: 'item',
|
||||
title: '{{t("Add record")}}',
|
||||
name: 'addRecord',
|
||||
Component: 'CustomizeAddRecordActionInitializer',
|
||||
schema: {
|
||||
'x-align': 'right',
|
||||
'x-decorator': 'ACLActionProvider',
|
||||
'x-acl-action': 'create',
|
||||
'x-acl-action-props': {
|
||||
skipScopeCheck: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
useVisible() {
|
||||
const collection = useCollection_deprecated();
|
||||
return !['view', 'sql'].includes(collection.template) || collection?.writableView;
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
tableActionInitializers_deprecated,
|
||||
);
|
||||
|
@ -1,14 +1,14 @@
|
||||
import { useFieldSchema } from '@formily/react';
|
||||
import React, { useMemo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { SchemaInitializerChildren } from '../../../../application';
|
||||
import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer';
|
||||
import { useCompile } from '../../../../schema-component';
|
||||
import {
|
||||
useAssociatedTableColumnInitializerFields,
|
||||
useInheritsTableColumnInitializerFields,
|
||||
useTableColumnInitializerFields,
|
||||
} from '../../../../schema-initializer/utils';
|
||||
import { SchemaInitializerChildren } from '../../../../application/schema-initializer/components/SchemaInitializerChildren';
|
||||
import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
|
||||
// 表格列配置
|
||||
const ParentCollectionFields = () => {
|
||||
@ -47,7 +47,10 @@ const AssociatedFields = () => {
|
||||
return <SchemaInitializerChildren>{schema}</SchemaInitializerChildren>;
|
||||
};
|
||||
|
||||
export const tableColumnInitializers = new SchemaInitializer({
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const tableColumnInitializers_deprecated = new CompatibleSchemaInitializer({
|
||||
name: 'TableColumnInitializers',
|
||||
insertPosition: 'beforeEnd',
|
||||
icon: 'SettingOutlined',
|
||||
@ -106,3 +109,66 @@ export const tableColumnInitializers = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const tableColumnInitializers = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'table:configureColumns',
|
||||
insertPosition: 'beforeEnd',
|
||||
icon: 'SettingOutlined',
|
||||
title: '{{t("Configure columns")}}',
|
||||
wrap: (s, { isInSubTable }) => {
|
||||
if (s['x-action-column']) {
|
||||
return s;
|
||||
}
|
||||
return {
|
||||
type: 'void',
|
||||
'x-decorator': 'TableV2.Column.Decorator',
|
||||
// 'x-designer': 'TableV2.Column.Designer',
|
||||
'x-toolbar': 'TableColumnSchemaToolbar',
|
||||
'x-settings': 'fieldSettings:TableColumn',
|
||||
'x-component': 'TableV2.Column',
|
||||
properties: {
|
||||
[s.name]: {
|
||||
...s,
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
items: [
|
||||
{
|
||||
name: 'displayFields',
|
||||
type: 'itemGroup',
|
||||
title: '{{t("Display fields")}}',
|
||||
// children: DisplayFields,
|
||||
useChildren: useTableColumnInitializerFields,
|
||||
},
|
||||
{
|
||||
name: 'parentCollectionFields',
|
||||
Component: ParentCollectionFields,
|
||||
},
|
||||
{
|
||||
name: 'associationFields',
|
||||
Component: AssociatedFields,
|
||||
},
|
||||
{
|
||||
name: 'divider',
|
||||
type: 'divider',
|
||||
useVisible() {
|
||||
const fieldSchema = useFieldSchema();
|
||||
return fieldSchema['x-component'] !== 'AssociationField.SubTable';
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
name: 'add',
|
||||
title: '{{t("Action column")}}',
|
||||
Component: 'TableActionColumnInitializer',
|
||||
useVisible() {
|
||||
const fieldSchema = useFieldSchema();
|
||||
return fieldSchema['x-component'] !== 'AssociationField.SubTable';
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
tableColumnInitializers_deprecated,
|
||||
);
|
||||
|
@ -2,7 +2,7 @@ import { expect, oneEmptyTableBlockBasedOnUsers, test } from '@nocobase/test/e2e
|
||||
|
||||
test('actions', async ({ page, mockPage }) => {
|
||||
await mockPage(oneEmptyTableBlockBasedOnUsers).goto();
|
||||
await page.getByLabel('schema-initializer-ActionBar-TableActionInitializers-users').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-table:configureActions-users').hover();
|
||||
//添加按钮
|
||||
await page.getByRole('menuitem', { name: 'Add new' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Delete' }).click();
|
||||
|
@ -4,7 +4,7 @@ test.describe('where table block can be added', () => {
|
||||
test('page', async ({ page, mockPage }) => {
|
||||
await mockPage().goto();
|
||||
|
||||
await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-page:addBlock').hover();
|
||||
await createBlockInPage(page, 'Table');
|
||||
await expect(page.getByLabel('block-item-CardItem-users-table')).toBeVisible();
|
||||
});
|
||||
@ -17,7 +17,7 @@ test.describe('configure actions', () => {
|
||||
await mockPage(oneEmptyTable).goto();
|
||||
|
||||
// add buttons
|
||||
await page.getByLabel('schema-initializer-ActionBar-TableActionInitializers-t_unp4scqamw9').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-table:configureActions-t_unp4scqamw9').hover();
|
||||
await page.getByRole('menuitem', { name: 'Filter' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Add new' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Delete' }).click();
|
||||
@ -35,7 +35,7 @@ test.describe('configure actions', () => {
|
||||
await expect(page.getByRole('button', { name: 'Refresh' })).toBeVisible();
|
||||
|
||||
// delete buttons
|
||||
await page.getByLabel('schema-initializer-ActionBar-TableActionInitializers-t_unp4scqamw9').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-table:configureActions-t_unp4scqamw9').hover();
|
||||
await page.getByRole('menuitem', { name: 'Filter' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Add new' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Delete' }).click();
|
||||
@ -56,7 +56,7 @@ test.describe('configure actions', () => {
|
||||
test('customize: add record', async ({ page, mockPage }) => {
|
||||
await mockPage(oneEmptyTable).goto();
|
||||
|
||||
await page.getByLabel('schema-initializer-ActionBar-TableActionInitializers-t_unp4scqamw9').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-table:configureActions-t_unp4scqamw9').hover();
|
||||
await page.getByRole('menuitem', { name: 'Customize' }).hover();
|
||||
await page.getByRole('menuitem', { name: 'add record' }).click();
|
||||
|
||||
@ -70,7 +70,7 @@ test.describe('configure columns', () => {
|
||||
test.describe.configure({ retries: process.env.CI ? 4 : 0 });
|
||||
test('action column & display collection fields & display association fields', async ({ page, mockPage }) => {
|
||||
await mockPage(oneEmptyTable).goto();
|
||||
const configureColumnButton = page.getByLabel('schema-initializer-TableV2-TableColumnInitializers-t_unp4scqamw9');
|
||||
const configureColumnButton = page.getByLabel('schema-initializer-TableV2-table:configureColumns-t_unp4scqamw9');
|
||||
|
||||
// Action column -------------------------------------------------------------
|
||||
// 1. 点击开关,可以开启和关闭 Action column
|
||||
|
@ -101,7 +101,7 @@ test.describe('table block schema settings', () => {
|
||||
).toBeChecked();
|
||||
await expect(page.getByRole('menuitem', { name: 'Set default sorting rules' })).toBeHidden();
|
||||
// 显示出来 email 和 ID
|
||||
await page.getByLabel('schema-initializer-TableV2-TableColumnInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-TableV2-table:configureColumns-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'email' }).click();
|
||||
await page.getByRole('menuitem', { name: 'ID', exact: true }).click();
|
||||
await page.getByLabel('schema-initializer-TableV2-').click();
|
||||
@ -141,7 +141,7 @@ test.describe('table block schema settings', () => {
|
||||
}
|
||||
|
||||
async function createColumnItem(page: Page, fieldName: string) {
|
||||
await page.getByLabel('schema-initializer-TableV2-TableColumnInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-TableV2-table:configureColumns-general').hover();
|
||||
await page.getByRole('menuitem', { name: fieldName, exact: true }).click();
|
||||
await page.mouse.move(300, 0);
|
||||
}
|
||||
@ -213,7 +213,7 @@ test.describe('table block schema settings', () => {
|
||||
await page.getByRole('button', { name: 'OK', exact: true }).click();
|
||||
|
||||
// 显示出来 email 和 ID
|
||||
await page.getByLabel('schema-initializer-TableV2-TableColumnInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-TableV2-table:configureColumns-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'email' }).click();
|
||||
await page.getByRole('menuitem', { name: 'ID', exact: true }).click();
|
||||
await page.mouse.move(300, 0);
|
||||
@ -567,7 +567,7 @@ test.describe('actions schema settings', () => {
|
||||
test.describe('popup', () => {
|
||||
const addSomeCustomActions = async (page: Page) => {
|
||||
// 先删除掉之前的 actions
|
||||
await page.getByRole('button', { name: 'Actions' }).hover();
|
||||
await page.getByRole('button', { name: 'Actions', exact: true }).hover();
|
||||
await page.getByLabel('designer-schema-settings-TableV2.Column-TableV2.ActionColumnDesigner-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'View' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Edit' }).click();
|
||||
@ -624,7 +624,7 @@ test.describe('actions schema settings', () => {
|
||||
test.describe('update record', () => {
|
||||
const addSomeCustomActions = async (page: Page) => {
|
||||
// 先删除掉之前的 actions
|
||||
await page.getByRole('button', { name: 'Actions' }).hover();
|
||||
await page.getByRole('button', { name: 'Actions', exact: true }).hover();
|
||||
await page.getByLabel('designer-schema-settings-TableV2.Column-TableV2.ActionColumnDesigner-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'View' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Edit' }).click();
|
||||
@ -677,13 +677,13 @@ test.describe('actions schema settings', () => {
|
||||
|
||||
// 添加一行数据
|
||||
// TODO: 使用 mockRecord 为 tree 表添加一行数据无效
|
||||
await page.getByLabel('schema-initializer-ActionBar-TableActionInitializers-treeCollection').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-table:configureActions-treeCollection').hover();
|
||||
await page.getByRole('menuitem', { name: 'Add new' }).click();
|
||||
await page.getByRole('button', { name: 'Add new' }).click();
|
||||
await page.getByLabel('schema-initializer-Grid-CreateFormBlockInitializers-treeCollection').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-popup:addNew:addBlock-treeCollection').hover();
|
||||
await page.getByRole('menuitem', { name: 'form Form' }).click();
|
||||
await page.mouse.move(300, 0);
|
||||
await page.getByLabel('schema-initializer-ActionBar-CreateFormActionInitializers-treeCollection').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-createForm:configureActions-treeCollection').hover();
|
||||
await page.getByRole('menuitem', { name: 'Submit' }).click();
|
||||
await page.mouse.move(300, 0);
|
||||
await page.getByRole('button', { name: 'Submit' }).click();
|
||||
|
@ -10,7 +10,7 @@ export const T2183 = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'BlockInitializers',
|
||||
'x-initializer': 'page:addBlock',
|
||||
properties: {
|
||||
'1n5r9s23amo': {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -50,7 +50,7 @@ export const T2183 = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'TableActionInitializers',
|
||||
'x-initializer': 'table:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
style: {
|
||||
@ -87,7 +87,7 @@ export const T2183 = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'array',
|
||||
'x-initializer': 'TableColumnInitializers',
|
||||
'x-initializer': 'table:configureColumns',
|
||||
'x-component': 'TableV2',
|
||||
'x-component-props': {
|
||||
rowKey: 'id',
|
||||
@ -106,7 +106,7 @@ export const T2183 = {
|
||||
'x-decorator': 'TableV2.Column.ActionBar',
|
||||
'x-component': 'TableV2.Column',
|
||||
'x-designer': 'TableV2.ActionColumnDesigner',
|
||||
'x-initializer': 'TableActionColumnInitializers',
|
||||
'x-initializer': 'table:configureItemActions',
|
||||
properties: {
|
||||
actions: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -169,7 +169,7 @@ export const T2186 = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'BlockInitializers',
|
||||
'x-initializer': 'page:addBlock',
|
||||
properties: {
|
||||
'0r1mwh6fgdj': {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -209,7 +209,7 @@ export const T2186 = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'TableActionInitializers',
|
||||
'x-initializer': 'table:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
style: {
|
||||
@ -246,7 +246,7 @@ export const T2186 = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'array',
|
||||
'x-initializer': 'TableColumnInitializers',
|
||||
'x-initializer': 'table:configureColumns',
|
||||
'x-component': 'TableV2',
|
||||
'x-component-props': {
|
||||
rowKey: 'id',
|
||||
@ -265,7 +265,7 @@ export const T2186 = {
|
||||
'x-decorator': 'TableV2.Column.ActionBar',
|
||||
'x-component': 'TableV2.Column',
|
||||
'x-designer': 'TableV2.ActionColumnDesigner',
|
||||
'x-initializer': 'TableActionColumnInitializers',
|
||||
'x-initializer': 'table:configureItemActions',
|
||||
properties: {
|
||||
actions: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -328,7 +328,7 @@ export const T2187 = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'BlockInitializers',
|
||||
'x-initializer': 'page:addBlock',
|
||||
properties: {
|
||||
zp24b63pujf: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -368,7 +368,7 @@ export const T2187 = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'TableActionInitializers',
|
||||
'x-initializer': 'table:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
style: {
|
||||
@ -383,7 +383,7 @@ export const T2187 = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'array',
|
||||
'x-initializer': 'TableColumnInitializers',
|
||||
'x-initializer': 'table:configureColumns',
|
||||
'x-component': 'TableV2',
|
||||
'x-component-props': {
|
||||
rowKey: 'id',
|
||||
@ -402,7 +402,7 @@ export const T2187 = {
|
||||
'x-decorator': 'TableV2.Column.ActionBar',
|
||||
'x-component': 'TableV2.Column',
|
||||
'x-designer': 'TableV2.ActionColumnDesigner',
|
||||
'x-initializer': 'TableActionColumnInitializers',
|
||||
'x-initializer': 'table:configureItemActions',
|
||||
properties: {
|
||||
actions: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -468,7 +468,7 @@ export const T2187 = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'CreateFormBlockInitializers',
|
||||
'x-initializer': 'popup:addNew:addBlock',
|
||||
properties: {
|
||||
qvyfk3a9a2g: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -513,7 +513,7 @@ export const T2187 = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'FormItemInitializers',
|
||||
'x-initializer': 'form:configureFields',
|
||||
properties: {
|
||||
h191s1ni4am: {
|
||||
_isJSONSchemaObject: true,
|
||||
@ -573,7 +573,7 @@ export const T2187 = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'CreateFormActionInitializers',
|
||||
'x-initializer': 'createForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
|
@ -4,7 +4,7 @@ test.describe('where collapse block can be added', () => {
|
||||
test('page', async ({ page, mockPage }) => {
|
||||
await mockPage().goto();
|
||||
|
||||
await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-page:addBlock').hover();
|
||||
await createBlockInPage(page, 'Collapse');
|
||||
await expect(page.getByLabel('block-item-CardItem-users-filter-collapse')).toBeVisible();
|
||||
});
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer';
|
||||
import { useOptionalFieldList } from '../../../../block-provider/hooks';
|
||||
import { useCollectionManager_deprecated } from '../../../../collection-manager';
|
||||
@ -80,8 +81,10 @@ export const associationFilterFilterBlockInitializer = new SchemaInitializer({
|
||||
],
|
||||
});
|
||||
|
||||
export const filterCollapseItemInitializer = new SchemaInitializer({
|
||||
// name: 'AssociationFilter.FilterBlockInitializer',
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const filterCollapseItemInitializer_deprecated = new CompatibleSchemaInitializer({
|
||||
name: 'AssociationFilterInitializers',
|
||||
style: { marginTop: 16 },
|
||||
icon: 'SettingOutlined',
|
||||
@ -155,3 +158,81 @@ export const filterCollapseItemInitializer = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const filterCollapseItemInitializer = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'filterCollapse:configureFields',
|
||||
style: { marginTop: 16 },
|
||||
icon: 'SettingOutlined',
|
||||
title: '{{t("Configure fields")}}',
|
||||
items: [
|
||||
{
|
||||
type: 'itemGroup',
|
||||
name: 'associationFields',
|
||||
title: '{{t("Association fields")}}',
|
||||
useChildren() {
|
||||
const associatedFields = useAssociatedFields();
|
||||
const useProps = '{{useAssociationFilterBlockProps}}';
|
||||
const cm = useCollectionManager_deprecated();
|
||||
const children = associatedFields.map((field) => ({
|
||||
name: field.key,
|
||||
title: field.uiSchema?.title,
|
||||
Component: 'AssociationFilterDesignerDisplayField',
|
||||
schema: {
|
||||
name: field.name,
|
||||
title: field.uiSchema?.title,
|
||||
type: 'void',
|
||||
// 'x-designer': 'AssociationFilter.Item.Designer',
|
||||
'x-toolbar': 'CollapseItemSchemaToolbar',
|
||||
'x-settings': 'fieldSettings:FilterCollapseItem',
|
||||
'x-component': 'AssociationFilter.Item',
|
||||
'x-component-props': {
|
||||
fieldNames: {
|
||||
label: cm.getCollection(field.target)?.getPrimaryKey() || 'id',
|
||||
},
|
||||
useProps,
|
||||
},
|
||||
properties: {},
|
||||
},
|
||||
}));
|
||||
return children;
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'choicesFields',
|
||||
type: 'itemGroup',
|
||||
title: '{{t("Choices fields")}}',
|
||||
hideIfNoChildren: true,
|
||||
useChildren() {
|
||||
const optionalList = useOptionalFieldList();
|
||||
const useProps = '{{useAssociationFilterBlockProps}}';
|
||||
const optionalChildren = optionalList.map((field) => ({
|
||||
name: field.key,
|
||||
title: field.uiSchema.title,
|
||||
Component: 'AssociationFilterDesignerDisplayField',
|
||||
schema: {
|
||||
name: field.name,
|
||||
title: field.uiSchema.title,
|
||||
interface: field.interface,
|
||||
type: 'void',
|
||||
// 'x-designer': 'AssociationFilter.Item.Designer',
|
||||
'x-toolbar': 'CollapseItemSchemaToolbar',
|
||||
'x-settings': 'fieldSettings:FilterCollapseItem',
|
||||
'x-component': 'AssociationFilter.Item',
|
||||
'x-component-props': {
|
||||
fieldNames: {
|
||||
label: field.name,
|
||||
},
|
||||
useProps,
|
||||
},
|
||||
properties: {},
|
||||
},
|
||||
}));
|
||||
|
||||
return optionalChildren;
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
filterCollapseItemInitializer_deprecated,
|
||||
);
|
||||
|
@ -1,7 +1,10 @@
|
||||
import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer';
|
||||
import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
|
||||
// 表单的操作配置
|
||||
export const filterFormActionInitializers = new SchemaInitializer({
|
||||
/**
|
||||
* @deprecated
|
||||
* 表单的操作配置
|
||||
*/
|
||||
export const filterFormActionInitializers_deprecated = new CompatibleSchemaInitializer({
|
||||
name: 'FilterFormActionInitializers',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
@ -31,3 +34,37 @@ export const filterFormActionInitializers = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const filterFormActionInitializers = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'filterForm:configureActions',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
items: [
|
||||
{
|
||||
type: 'itemGroup',
|
||||
title: '{{t("Enable actions")}}',
|
||||
name: 'enableActions',
|
||||
children: [
|
||||
{
|
||||
name: 'filter',
|
||||
title: '{{t("Filter")}}',
|
||||
Component: 'CreateFilterActionInitializer',
|
||||
schema: {
|
||||
'x-action-settings': {},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'reset',
|
||||
title: '{{t("Reset")}}',
|
||||
Component: 'CreateResetActionInitializer',
|
||||
schema: {
|
||||
'x-action-settings': {},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
filterFormActionInitializers_deprecated,
|
||||
);
|
||||
|
@ -4,7 +4,7 @@ test.describe('where filter form block can be added', () => {
|
||||
test('page', async ({ page, mockPage }) => {
|
||||
await mockPage().goto();
|
||||
|
||||
await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-page:addBlock').hover();
|
||||
await createBlockInPage(page, 'Filter form');
|
||||
await expect(page.getByLabel('block-item-CardItem-users-filter-form')).toBeVisible();
|
||||
});
|
||||
@ -14,7 +14,7 @@ test.describe('configure fields', () => {
|
||||
test('display collection fields & display association fields & add text', async ({ page, mockPage }) => {
|
||||
await mockPage(oneEmptyFilterFormBlock).goto();
|
||||
|
||||
const formItemInitializer = page.getByLabel('schema-initializer-Grid-FilterFormItemInitializers-general');
|
||||
const formItemInitializer = page.getByLabel('schema-initializer-Grid-filterForm:configureFields-general');
|
||||
|
||||
// add fields
|
||||
await formItemInitializer.hover();
|
||||
@ -72,7 +72,7 @@ test.describe('configure actions', () => {
|
||||
test('filter & reset', async ({ page, mockPage }) => {
|
||||
await mockPage(oneEmptyFilterFormBlock).goto();
|
||||
|
||||
await page.getByLabel('schema-initializer-ActionBar-FilterFormActionInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-filterForm:configureActions-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'Filter' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Reset' }).click();
|
||||
|
||||
@ -84,7 +84,7 @@ test.describe('configure actions', () => {
|
||||
await expect(page.getByLabel('action-Action-Reset-general-filter-form')).toBeVisible();
|
||||
|
||||
// delete buttons
|
||||
await page.getByLabel('schema-initializer-ActionBar-FilterFormActionInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-filterForm:configureActions-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'Filter' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Reset' }).click();
|
||||
|
||||
|
@ -81,7 +81,7 @@ test.describe('actions schema settings', () => {
|
||||
await mockPage(oneEmptyFilterFormBlock).goto();
|
||||
|
||||
// 创建 Filter & Reset 两个按钮
|
||||
await page.getByLabel('schema-initializer-ActionBar-FilterFormActionInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-ActionBar-filterForm:configureActions-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'Filter' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Reset' }).click();
|
||||
|
||||
|
@ -1,11 +1,14 @@
|
||||
import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer';
|
||||
import { gridRowColWrap, useFilterFormItemInitializerFields } from '../../../../schema-initializer/utils';
|
||||
import {
|
||||
FilterParentCollectionFields,
|
||||
FilterAssociatedFields,
|
||||
} from '../../../../schema-initializer/buttons/FormItemInitializers';
|
||||
import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
|
||||
export const filterFormItemInitializers = new SchemaInitializer({
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const filterFormItemInitializers_deprecated = new CompatibleSchemaInitializer({
|
||||
name: 'FilterFormItemInitializers',
|
||||
wrap: gridRowColWrap,
|
||||
icon: 'SettingOutlined',
|
||||
@ -36,3 +39,38 @@ export const filterFormItemInitializers = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const filterFormItemInitializers = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'filterForm:configureFields',
|
||||
wrap: gridRowColWrap,
|
||||
icon: 'SettingOutlined',
|
||||
title: '{{t("Configure fields")}}',
|
||||
items: [
|
||||
{
|
||||
type: 'itemGroup',
|
||||
name: 'displayFields',
|
||||
title: '{{t("Display fields")}}',
|
||||
useChildren: useFilterFormItemInitializerFields,
|
||||
},
|
||||
{
|
||||
name: 'parentCollectionFields',
|
||||
Component: FilterParentCollectionFields,
|
||||
},
|
||||
{
|
||||
name: 'associationFields',
|
||||
Component: FilterAssociatedFields,
|
||||
},
|
||||
{
|
||||
name: 'divider',
|
||||
type: 'divider',
|
||||
},
|
||||
{
|
||||
title: '{{t("Add text")}}',
|
||||
Component: 'MarkdownFormItemInitializer',
|
||||
name: 'addText',
|
||||
},
|
||||
],
|
||||
},
|
||||
filterFormItemInitializers_deprecated,
|
||||
);
|
||||
|
@ -4,7 +4,7 @@ test.describe('where markdown block can be added', () => {
|
||||
test('page', async ({ page, mockPage }) => {
|
||||
await mockPage().goto();
|
||||
|
||||
await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-page:addBlock').hover();
|
||||
await createBlockInPage(page, 'Markdown');
|
||||
await expect(page.getByLabel('block-item-Markdown.Void-markdown')).toBeVisible();
|
||||
});
|
||||
|
@ -23,7 +23,7 @@ test.describe('where to open a popup and what can be added to it', () => {
|
||||
await expect(page.getByText('test123')).toBeVisible();
|
||||
|
||||
// add blocks
|
||||
await page.getByLabel('schema-initializer-Grid-CreateFormBlockInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-popup:addNew:addBlock-general').hover();
|
||||
await page.getByText('Form').click();
|
||||
await page.getByText('Markdown').click();
|
||||
|
||||
@ -48,12 +48,12 @@ test.describe('where to open a popup and what can be added to it', () => {
|
||||
await expect(page.getByText('test7')).toBeVisible();
|
||||
|
||||
// add blocks
|
||||
await page.getByLabel('schema-initializer-Grid-CusomeizeCreateFormBlockInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-popup:addRecord:addBlock-general').hover();
|
||||
await page.getByText('Form').hover();
|
||||
await page.getByRole('menuitem', { name: 'Users' }).click();
|
||||
|
||||
// add Markdown
|
||||
await page.getByLabel('schema-initializer-Grid-CusomeizeCreateFormBlockInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-popup:addRecord:addBlock-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'Markdown' }).click();
|
||||
|
||||
await expect(page.getByLabel('block-item-CardItem-users-form')).toBeVisible();
|
||||
@ -77,7 +77,7 @@ test.describe('where to open a popup and what can be added to it', () => {
|
||||
await expect(page.getByText('test8')).toBeVisible();
|
||||
|
||||
// add blocks
|
||||
await page.getByLabel('schema-initializer-Grid-RecordBlockInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'Details' }).click();
|
||||
await page.getByText('Form').first().click();
|
||||
await page.getByRole('menuitem', { name: 'Markdown' }).click();
|
||||
@ -106,13 +106,13 @@ test.describe('where to open a popup and what can be added to it', () => {
|
||||
await page.getByRole('button', { name: 'OK', exact: true }).click();
|
||||
|
||||
// add relationship blocks
|
||||
await page.getByLabel('schema-initializer-Grid-RecordBlockInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'Many to one' }).hover();
|
||||
await page.getByRole('menuitem', { name: 'Details' }).click();
|
||||
|
||||
await page.mouse.move(300, 0);
|
||||
|
||||
await page.getByLabel('schema-initializer-Grid-RecordBlockInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'One to many' }).hover();
|
||||
|
||||
// 下拉列表中,可选择以下区块进行创建
|
||||
@ -141,7 +141,7 @@ test.describe('where to open a popup and what can be added to it', () => {
|
||||
await expect(page.getByText('test1')).toBeVisible();
|
||||
|
||||
// add blocks
|
||||
await page.getByLabel('schema-initializer-Grid-BulkEditBlockInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-popup:bulkEdit:addBlock-general').hover();
|
||||
await page.getByText('Form').click();
|
||||
await page.getByRole('menuitem', { name: 'Markdown' }).click();
|
||||
await page.mouse.move(300, 0);
|
||||
@ -170,7 +170,7 @@ test.describe('where to open a popup and what can be added to it', () => {
|
||||
await expect(page.getByText('test8')).toBeVisible();
|
||||
|
||||
// add blocks
|
||||
await page.getByLabel('schema-initializer-Grid-RecordBlockInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'Details' }).click();
|
||||
await page.getByText('Form').first().click();
|
||||
await page.getByRole('menuitem', { name: 'Markdown' }).click();
|
||||
@ -181,14 +181,14 @@ test.describe('where to open a popup and what can be added to it', () => {
|
||||
await expect(page.getByLabel('block-item-Markdown.Void-general-markdown')).toBeVisible();
|
||||
|
||||
// add relationship blocks
|
||||
await page.getByLabel('schema-initializer-Grid-RecordBlockInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'Many to one' }).hover();
|
||||
await page.getByRole('menuitem', { name: 'Details' }).click();
|
||||
await page.mouse.move(300, 0);
|
||||
|
||||
await expect(page.getByLabel('block-item-CardItem-general-').nth(2)).toBeVisible();
|
||||
|
||||
await page.getByLabel('schema-initializer-Grid-RecordBlockInitializers-general').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-popup:common:addBlock-general').hover();
|
||||
await page.getByRole('menuitem', { name: 'One to many' }).hover();
|
||||
|
||||
// 下拉列表中,可选择以下区块进行创建
|
||||
@ -225,7 +225,7 @@ test.describe('where to open a popup and what can be added to it', () => {
|
||||
await expect(page.getByLabel('block-item-Markdown.Void-roles-form')).toBeVisible();
|
||||
|
||||
async function addBlock(name: string) {
|
||||
await page.getByLabel('schema-initializer-Grid-TableSelectorInitializers-roles').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-popup:tableSelector:addBlock-roles').hover();
|
||||
await page.getByRole('menuitem', { name }).click();
|
||||
await page.mouse.move(300, 0);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ export const T2797: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'BlockInitializers',
|
||||
'x-initializer': 'page:addBlock',
|
||||
'x-index': 1,
|
||||
properties: {
|
||||
'921il71tsii': {
|
||||
@ -59,7 +59,7 @@ export const T2797: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'TableActionInitializers',
|
||||
'x-initializer': 'table:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
style: {
|
||||
@ -74,7 +74,7 @@ export const T2797: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'array',
|
||||
'x-initializer': 'TableColumnInitializers',
|
||||
'x-initializer': 'table:configureColumns',
|
||||
'x-component': 'TableV2',
|
||||
'x-component-props': {
|
||||
rowKey: 'id',
|
||||
@ -94,7 +94,7 @@ export const T2797: PageConfig = {
|
||||
'x-decorator': 'TableV2.Column.ActionBar',
|
||||
'x-component': 'TableV2.Column',
|
||||
'x-designer': 'TableV2.ActionColumnDesigner',
|
||||
'x-initializer': 'TableActionColumnInitializers',
|
||||
'x-initializer': 'table:configureItemActions',
|
||||
'x-index': 1,
|
||||
properties: {
|
||||
actions: {
|
||||
@ -161,7 +161,7 @@ export const T2797: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'RecordBlockInitializers',
|
||||
'x-initializer': 'popup:common:addBlock',
|
||||
'x-index': 1,
|
||||
properties: {
|
||||
uq6k35ibdum: {
|
||||
@ -214,7 +214,7 @@ export const T2797: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'FormItemInitializers',
|
||||
'x-initializer': 'form:configureFields',
|
||||
'x-index': 1,
|
||||
'x-uid': '1d3zru9pi2o',
|
||||
'x-async': false,
|
||||
@ -223,7 +223,7 @@ export const T2797: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'UpdateFormActionInitializers',
|
||||
'x-initializer': 'editForm:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
layout: 'one-column',
|
||||
@ -286,7 +286,7 @@ export const T2797: PageConfig = {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer':
|
||||
'RecordBlockInitializers',
|
||||
'popup:common:addBlock',
|
||||
'x-index': 1,
|
||||
properties: {
|
||||
i7919iug0zf: {
|
||||
@ -367,7 +367,7 @@ export const T2797: PageConfig = {
|
||||
'x-component':
|
||||
'Grid',
|
||||
'x-initializer':
|
||||
'FormItemInitializers',
|
||||
'form:configureFields',
|
||||
'x-index': 1,
|
||||
'x-uid':
|
||||
'k9p2rqt49v1',
|
||||
@ -382,7 +382,7 @@ export const T2797: PageConfig = {
|
||||
'2.0',
|
||||
type: 'void',
|
||||
'x-initializer':
|
||||
'UpdateFormActionInitializers',
|
||||
'editForm:configureActions',
|
||||
'x-component':
|
||||
'ActionBar',
|
||||
'x-component-props':
|
||||
@ -594,7 +594,7 @@ export const T2838: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'BlockInitializers',
|
||||
'x-initializer': 'page:addBlock',
|
||||
'x-index': 1,
|
||||
properties: {
|
||||
ocvzef7y4nh: {
|
||||
@ -638,7 +638,7 @@ export const T2838: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer': 'TableActionInitializers',
|
||||
'x-initializer': 'table:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
style: {
|
||||
@ -653,7 +653,7 @@ export const T2838: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'array',
|
||||
'x-initializer': 'TableColumnInitializers',
|
||||
'x-initializer': 'table:configureColumns',
|
||||
'x-component': 'TableV2',
|
||||
'x-component-props': {
|
||||
rowKey: 'id',
|
||||
@ -673,7 +673,7 @@ export const T2838: PageConfig = {
|
||||
'x-decorator': 'TableV2.Column.ActionBar',
|
||||
'x-component': 'TableV2.Column',
|
||||
'x-designer': 'TableV2.ActionColumnDesigner',
|
||||
'x-initializer': 'TableActionColumnInitializers',
|
||||
'x-initializer': 'table:configureItemActions',
|
||||
'x-index': 1,
|
||||
properties: {
|
||||
actions: {
|
||||
@ -740,7 +740,7 @@ export const T2838: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'RecordBlockInitializers',
|
||||
'x-initializer': 'popup:common:addBlock',
|
||||
'x-index': 1,
|
||||
properties: {
|
||||
w9u8i9nzh10: {
|
||||
@ -791,8 +791,7 @@ export const T2838: PageConfig = {
|
||||
_isJSONSchemaObject: true,
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-initializer':
|
||||
'ReadPrettyFormActionInitializers',
|
||||
'x-initializer': 'details:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
style: {
|
||||
@ -856,7 +855,7 @@ export const T2838: PageConfig = {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer':
|
||||
'RecordBlockInitializers',
|
||||
'popup:common:addBlock',
|
||||
'x-index': 1,
|
||||
properties: {
|
||||
nclrn6m8w40: {
|
||||
@ -935,7 +934,7 @@ export const T2838: PageConfig = {
|
||||
'2.0',
|
||||
type: 'void',
|
||||
'x-initializer':
|
||||
'ReadPrettyFormActionInitializers',
|
||||
'details:configureActions',
|
||||
'x-component':
|
||||
'ActionBar',
|
||||
'x-component-props':
|
||||
@ -1039,7 +1038,7 @@ export const T2838: PageConfig = {
|
||||
'x-component':
|
||||
'Grid',
|
||||
'x-initializer':
|
||||
'RecordBlockInitializers',
|
||||
'popup:common:addBlock',
|
||||
'x-index': 1,
|
||||
properties:
|
||||
{
|
||||
@ -1133,7 +1132,7 @@ export const T2838: PageConfig = {
|
||||
'x-component':
|
||||
'Grid',
|
||||
'x-initializer':
|
||||
'FormItemInitializers',
|
||||
'form:configureFields',
|
||||
'x-index': 1,
|
||||
properties:
|
||||
{
|
||||
@ -1222,7 +1221,7 @@ export const T2838: PageConfig = {
|
||||
'2.0',
|
||||
type: 'void',
|
||||
'x-initializer':
|
||||
'UpdateFormActionInitializers',
|
||||
'editForm:configureActions',
|
||||
'x-component':
|
||||
'ActionBar',
|
||||
'x-component-props':
|
||||
@ -1344,7 +1343,7 @@ export const T2838: PageConfig = {
|
||||
'x-component':
|
||||
'Grid',
|
||||
'x-initializer':
|
||||
'ReadPrettyFormItemInitializers',
|
||||
'details:configureFields',
|
||||
'x-index': 2,
|
||||
'x-uid':
|
||||
'1et421zrsz4',
|
||||
@ -1400,8 +1399,7 @@ export const T2838: PageConfig = {
|
||||
version: '2.0',
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer':
|
||||
'ReadPrettyFormItemInitializers',
|
||||
'x-initializer': 'details:configureFields',
|
||||
'x-index': 2,
|
||||
'x-uid': 'j4qxeoy1pqw',
|
||||
'x-async': false,
|
||||
|
@ -1,8 +1,11 @@
|
||||
import { useCollection_deprecated } from '../../../..';
|
||||
import { SchemaInitializer } from '../../../../application/schema-initializer/SchemaInitializer';
|
||||
import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
import { gridRowColWrap } from '../../../../schema-initializer/utils';
|
||||
|
||||
export const tableSelectorInitializers = new SchemaInitializer({
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const tableSelectorInitializers_deprecated = new CompatibleSchemaInitializer({
|
||||
name: 'TableSelectorInitializers',
|
||||
wrap: gridRowColWrap,
|
||||
title: '{{t("Add block")}}',
|
||||
@ -82,3 +85,87 @@ export const tableSelectorInitializers = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const tableSelectorInitializers = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'popup:tableSelector:addBlock',
|
||||
wrap: gridRowColWrap,
|
||||
title: '{{t("Add block")}}',
|
||||
icon: 'PlusOutlined',
|
||||
items: [
|
||||
{
|
||||
type: 'itemGroup',
|
||||
title: '{{t("Selector")}}',
|
||||
name: 'selector',
|
||||
children: [
|
||||
{
|
||||
name: 'title',
|
||||
title: 'Table',
|
||||
Component: 'TableSelectorInitializer',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'itemGroup',
|
||||
title: '{{t("Filter blocks")}}',
|
||||
name: 'filterBlocks',
|
||||
useChildren() {
|
||||
const { name, dataSource } = useCollection_deprecated();
|
||||
return [
|
||||
{
|
||||
name: 'filterFormBlockInTableSelector',
|
||||
title: '{{t("Form")}}',
|
||||
Component: 'FilterFormBlockInitializer',
|
||||
componentProps: {
|
||||
filterMenuItemChildren() {
|
||||
return false;
|
||||
},
|
||||
onlyCurrentDataSource: true,
|
||||
},
|
||||
collectionName: name,
|
||||
dataSource,
|
||||
},
|
||||
{
|
||||
name: 'filterCollapseBlockInTableSelector',
|
||||
title: '{{t("Collapse")}}',
|
||||
Component: 'FilterCollapseBlockInitializer',
|
||||
componentProps: {
|
||||
filterMenuItemChildren() {
|
||||
return false;
|
||||
},
|
||||
onlyCurrentDataSource: true,
|
||||
},
|
||||
collectionName: name,
|
||||
dataSource,
|
||||
},
|
||||
];
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'itemGroup',
|
||||
title: '{{t("Other blocks")}}',
|
||||
name: 'otherBlocks',
|
||||
children: [
|
||||
{
|
||||
title: '{{t("Add text")}}',
|
||||
Component: 'BlockItemInitializer',
|
||||
name: 'addText',
|
||||
schema: {
|
||||
type: 'void',
|
||||
'x-editable': false,
|
||||
'x-decorator': 'BlockItem',
|
||||
// 'x-designer': 'Markdown.Void.Designer',
|
||||
'x-toolbar': 'BlockSchemaToolbar',
|
||||
'x-settings': 'blockSettings:markdown',
|
||||
'x-component': 'Markdown.Void',
|
||||
'x-component-props': {
|
||||
content: '{{t("This is a demo text, **supports Markdown syntax**.")}}',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
tableSelectorInitializers_deprecated,
|
||||
);
|
||||
|
@ -3,9 +3,9 @@ import { SchemaOptionsContext } from '@formily/react';
|
||||
import { uid } from '@formily/shared';
|
||||
import React, { useCallback, useContext } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { FormDialog, SchemaComponent, SchemaComponentOptions } from '../../schema-component';
|
||||
import { SchemaInitializerItem, useSchemaInitializer } from '../../application';
|
||||
import { useGlobalTheme } from '../../global-theme';
|
||||
import { FormDialog, SchemaComponent, SchemaComponentOptions } from '../../schema-component';
|
||||
import { useStyles } from '../../schema-component/antd/menu/MenuItemInitializers';
|
||||
|
||||
export const PageMenuItem = () => {
|
||||
@ -75,7 +75,7 @@ export const PageMenuItem = () => {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'BlockInitializers',
|
||||
'x-initializer': 'page:addBlock',
|
||||
properties: {},
|
||||
},
|
||||
},
|
||||
|
@ -3,7 +3,10 @@ import { LinkMenuItem } from './LinkMenuItem';
|
||||
import { PageMenuItem } from './PageMenuItem';
|
||||
import { GroupItem } from './GroupItem';
|
||||
|
||||
export const menuItemInitializer = new SchemaInitializer({
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const menuItemInitializer_deprecated = new SchemaInitializer({
|
||||
name: 'MenuItemInitializers',
|
||||
insertPosition: 'beforeEnd',
|
||||
icon: 'PlusOutlined',
|
||||
@ -26,3 +29,24 @@ export const menuItemInitializer = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const menuItemInitializer = new SchemaInitializer({
|
||||
name: 'menuInitializers:menuItem',
|
||||
insertPosition: 'beforeEnd',
|
||||
icon: 'PlusOutlined',
|
||||
title: '{{t("Add menu item")}}',
|
||||
items: [
|
||||
{
|
||||
name: 'group',
|
||||
Component: GroupItem,
|
||||
},
|
||||
{
|
||||
name: 'page',
|
||||
Component: PageMenuItem,
|
||||
},
|
||||
{
|
||||
name: 'link',
|
||||
Component: LinkMenuItem,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
@ -1,7 +1,10 @@
|
||||
import { SchemaInitializer } from '../../application/schema-initializer/SchemaInitializer';
|
||||
import { CompatibleSchemaInitializer } from '../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
import { gridRowColWrap } from '../../schema-initializer/utils';
|
||||
|
||||
export const blockInitializers = new SchemaInitializer({
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const blockInitializers_deprecated = new CompatibleSchemaInitializer({
|
||||
name: 'BlockInitializers',
|
||||
title: '{{t("Add block")}}',
|
||||
icon: 'PlusOutlined',
|
||||
@ -70,3 +73,76 @@ export const blockInitializers = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const blockInitializers = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'page:addBlock',
|
||||
title: '{{t("Add block")}}',
|
||||
icon: 'PlusOutlined',
|
||||
wrap: gridRowColWrap,
|
||||
items: [
|
||||
{
|
||||
name: 'dataBlocks',
|
||||
title: '{{t("Data blocks")}}',
|
||||
type: 'itemGroup',
|
||||
children: [
|
||||
{
|
||||
name: 'table',
|
||||
title: '{{t("Table")}}',
|
||||
Component: 'TableBlockInitializer',
|
||||
},
|
||||
{
|
||||
name: 'form',
|
||||
title: '{{t("Form")}}',
|
||||
Component: 'FormBlockInitializer',
|
||||
},
|
||||
{
|
||||
name: 'details',
|
||||
title: '{{t("Details")}}',
|
||||
Component: 'DetailsBlockInitializer',
|
||||
},
|
||||
{
|
||||
name: 'list',
|
||||
title: '{{t("List")}}',
|
||||
Component: 'ListBlockInitializer',
|
||||
},
|
||||
{
|
||||
name: 'gridCard',
|
||||
title: '{{t("Grid Card")}}',
|
||||
Component: 'GridCardBlockInitializer',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'filterBlocks',
|
||||
title: '{{t("Filter blocks")}}',
|
||||
type: 'itemGroup',
|
||||
children: [
|
||||
{
|
||||
name: 'filterForm',
|
||||
title: '{{t("Form")}}',
|
||||
Component: 'FilterFormBlockInitializer',
|
||||
},
|
||||
{
|
||||
name: 'filterCollapse',
|
||||
title: '{{t("Collapse")}}',
|
||||
Component: 'FilterCollapseBlockInitializer',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'otherBlocks',
|
||||
type: 'itemGroup',
|
||||
title: '{{t("Other blocks")}}',
|
||||
children: [
|
||||
{
|
||||
name: 'markdown',
|
||||
title: '{{t("Markdown")}}',
|
||||
Component: 'MarkdownBlockInitializer',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
blockInitializers_deprecated,
|
||||
);
|
||||
|
@ -2,7 +2,7 @@ import { Page, expect, test } from '@nocobase/test/e2e';
|
||||
|
||||
test.describe('page schema settings', () => {
|
||||
const showMenu = async (page: Page) => {
|
||||
await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-page:addBlock').hover();
|
||||
await page.getByLabel('designer-schema-settings-Page').hover();
|
||||
};
|
||||
|
||||
@ -68,7 +68,7 @@ test.describe('tabs schema settings', () => {
|
||||
}
|
||||
|
||||
async function enablePageTabs(page) {
|
||||
await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover();
|
||||
await page.getByLabel('schema-initializer-Grid-page:addBlock').hover();
|
||||
await page.getByRole('button', { name: 'designer-schema-settings-Page' }).hover();
|
||||
await page.getByRole('menuitem', { name: 'Enable page tabs' }).click();
|
||||
await page.mouse.move(300, 0);
|
||||
|
@ -6,7 +6,7 @@ import { Alert, Flex, ModalProps, Tag } from 'antd';
|
||||
import React, { useCallback, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { RemoteSelect, useCompile, useDesignable } from '../..';
|
||||
import { useApp } from '../../../application';
|
||||
import { isInitializersSame, useApp } from '../../../application';
|
||||
import { usePlugin } from '../../../application/hooks';
|
||||
import { SchemaSettingOptions, SchemaSettings } from '../../../application/schema-settings';
|
||||
import { useSchemaToolbar } from '../../../application/schema-toolbar';
|
||||
@ -139,7 +139,7 @@ export function AssignedFieldValues() {
|
||||
type: 'void',
|
||||
'x-uid': uid(),
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'CustomFormItemInitializers',
|
||||
'x-initializer': 'assignFieldValuesForm:configureFields',
|
||||
};
|
||||
const tips = {
|
||||
'customize:update': t(
|
||||
@ -671,7 +671,7 @@ export const actionSettingsItems: SchemaSettingOptions['items'] = [
|
||||
const fieldSchema = useFieldSchema();
|
||||
return (
|
||||
fieldSchema['x-action'] === 'submit' &&
|
||||
fieldSchema.parent?.['x-initializer'] === 'CreateFormActionInitializers'
|
||||
isInitializersSame(fieldSchema.parent?.['x-initializer'], 'createForm:configureActions')
|
||||
);
|
||||
},
|
||||
},
|
||||
@ -745,6 +745,10 @@ export function SecondConFirm() {
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const actionSettings = new SchemaSettings({
|
||||
name: 'ActionSettings',
|
||||
items: actionSettingsItems,
|
||||
|
@ -13,7 +13,7 @@ import {
|
||||
import React from 'react';
|
||||
|
||||
const addActionButton = new SchemaInitializer({
|
||||
name: 'AddActionButton',
|
||||
name: 'addActionButton',
|
||||
designable: true,
|
||||
title: 'Configure actions',
|
||||
style: {
|
||||
@ -58,7 +58,7 @@ const schema: ISchema = {
|
||||
actions: {
|
||||
type: 'void',
|
||||
'x-component': 'ActionBar',
|
||||
'x-initializer': 'AddActionButton',
|
||||
'x-initializer': 'addActionButton',
|
||||
'x-uid': uid(),
|
||||
properties: {
|
||||
a1: {
|
||||
|
@ -6,7 +6,7 @@ export default {
|
||||
grid: {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'FormItemInitializers',
|
||||
'x-initializer': 'form:configureFields',
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -35,7 +35,7 @@ export default {
|
||||
grid: {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'CreateFormBlockInitializers',
|
||||
'x-initializer': 'popup:addNew:addBlock',
|
||||
properties: {},
|
||||
},
|
||||
},
|
||||
@ -55,7 +55,7 @@ export default {
|
||||
grid: {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'TableSelectorInitializers',
|
||||
'x-initializer': 'popup:tableSelector:addBlock',
|
||||
properties: {},
|
||||
},
|
||||
footer: {
|
||||
@ -73,7 +73,7 @@ export default {
|
||||
'x-component': 'Action',
|
||||
// 'x-designer': 'Action.Designer',
|
||||
'x-toolbar': 'ActionSchemaToolbar',
|
||||
'x-settings': 'actionSettings:updateSubmit',
|
||||
'x-settings': 'actionSettings:submit',
|
||||
'x-component-props': {
|
||||
type: 'primary',
|
||||
htmlType: 'submit',
|
||||
@ -110,7 +110,7 @@ export default {
|
||||
grid: {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'RecordBlockInitializers',
|
||||
'x-initializer': 'popup:common:addBlock',
|
||||
properties: {},
|
||||
},
|
||||
},
|
||||
@ -122,7 +122,7 @@ export default {
|
||||
SubTable: {
|
||||
type: 'void',
|
||||
'x-component': 'AssociationField.SubTable',
|
||||
'x-initializer': 'TableColumnInitializers',
|
||||
'x-initializer': 'table:configureColumns',
|
||||
'x-initializer-props': {
|
||||
action: false,
|
||||
},
|
||||
|
@ -7,6 +7,11 @@ import { useBlockRequestContext } from '../../../block-provider';
|
||||
import { mergeFilter } from '../../../filter-provider/utils';
|
||||
import { ActionInitializer } from '../../../schema-initializer/items/ActionInitializer';
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param props
|
||||
* @returns
|
||||
*/
|
||||
export const ActionBarAssociationFilterAction = (props) => {
|
||||
const { refresh } = useContext(SchemaComponentContext);
|
||||
const fieldSchema = useFieldSchema();
|
||||
|
@ -1,7 +1,10 @@
|
||||
import { SchemaInitializerItemType } from '../../../application';
|
||||
import { SchemaInitializer } from '../../../application/schema-initializer/SchemaInitializer';
|
||||
import { SchemaInitializerItemType } from '../../../application/schema-initializer/types';
|
||||
import { useAssociatedFields } from '../../../filter-provider/utils';
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const associationFilterInitializer = new SchemaInitializer({
|
||||
name: 'AssociationFilter.Initializer',
|
||||
style: {
|
||||
|
@ -15,6 +15,7 @@ import { Plugin } from '../../../application/Plugin';
|
||||
import {
|
||||
associationFilterFilterBlockInitializer,
|
||||
filterCollapseItemInitializer,
|
||||
filterCollapseItemInitializer_deprecated,
|
||||
} from '../../../modules/blocks/filter-blocks/collapse/filterCollapseItemInitializer';
|
||||
import { associationFilterInitializer } from './AssociationFilter.Initializer';
|
||||
|
||||
@ -104,6 +105,7 @@ AssociationFilter.useAssociationField = () => {
|
||||
export class AssociationFilterPlugin extends Plugin {
|
||||
async load() {
|
||||
this.app.schemaInitializerManager.add(associationFilterFilterBlockInitializer);
|
||||
this.app.schemaInitializerManager.add(filterCollapseItemInitializer_deprecated);
|
||||
this.app.schemaInitializerManager.add(filterCollapseItemInitializer);
|
||||
this.app.schemaInitializerManager.add(associationFilterInitializer);
|
||||
}
|
||||
|
@ -32,6 +32,9 @@ import { getTempFieldState } from '../form-v2/utils';
|
||||
import { useColorFields } from '../table-v2/Table.Column.Designer';
|
||||
import { useColumnSchema } from '../../../schema-component/antd/table-v2/Table.Column.Decorator';
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const formItemSettings = new SchemaSettings({
|
||||
name: 'FormItemSettings',
|
||||
items: [
|
||||
|
@ -17,6 +17,9 @@ import { SchemaSettingsDataScope } from '../../../schema-settings/SchemaSettings
|
||||
import { useDesignable } from '../../hooks';
|
||||
import { removeNullCondition } from '../filter';
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const formSettings = new SchemaSettings({
|
||||
name: 'FormSettings',
|
||||
items: [
|
||||
@ -83,6 +86,9 @@ export const formSettings = new SchemaSettings({
|
||||
],
|
||||
});
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const readPrettyFormSettings = new SchemaSettings({
|
||||
name: 'ReadPrettyFormSettings',
|
||||
items: [
|
||||
@ -122,6 +128,9 @@ export const readPrettyFormSettings = new SchemaSettings({
|
||||
],
|
||||
});
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const formDetailsSettings = new SchemaSettings({
|
||||
name: 'FormDetailsSettings',
|
||||
items: [
|
||||
|
@ -2,6 +2,9 @@ import { SchemaSettings } from '../../../application/schema-settings';
|
||||
import { useCollection_deprecated } from '../../../collection-manager';
|
||||
import { SchemaSettingsTemplate } from '../../../schema-settings/SchemaSettings';
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const formV1Settings = new SchemaSettings({
|
||||
name: 'FormV1Settings',
|
||||
items: [
|
||||
|
@ -30,7 +30,7 @@ const gridRowColWrap = (schema) => {
|
||||
};
|
||||
|
||||
export const addBlockButton = new SchemaInitializer({
|
||||
name: 'AddBlockButton',
|
||||
name: 'addBlockButton',
|
||||
title: 'Add block',
|
||||
wrap: gridRowColWrap,
|
||||
items: [
|
||||
@ -55,7 +55,7 @@ const schema: ISchema = {
|
||||
grid: {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'AddBlockButton',
|
||||
'x-initializer': 'addBlockButton',
|
||||
'x-uid': uid(),
|
||||
properties: {},
|
||||
},
|
||||
|
@ -147,7 +147,7 @@ const InsertMenuItems = (props) => {
|
||||
grid: {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'BlockInitializers',
|
||||
'x-initializer': 'page:addBlock',
|
||||
properties: {},
|
||||
},
|
||||
},
|
||||
|
@ -9,6 +9,9 @@ function useNotDisableHeader() {
|
||||
return !fieldSchema['x-component-props']?.disablePageHeader;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const pageSettings = new SchemaSettings({
|
||||
name: 'PageSettings',
|
||||
items: [
|
||||
|
@ -146,7 +146,7 @@ export const Page = (props) => {
|
||||
title,
|
||||
'x-icon': icon,
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'BlockInitializers',
|
||||
'x-initializer': 'page:addBlock',
|
||||
properties: {},
|
||||
});
|
||||
}}
|
||||
|
@ -5,6 +5,9 @@ import { useDesignable } from '../../hooks';
|
||||
import { useSchemaToolbar } from '../../../application/schema-toolbar';
|
||||
import { SchemaSettings } from '../../../application/schema-settings/SchemaSettings';
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const pageTabSettings = new SchemaSettings({
|
||||
name: 'PageTabSettings',
|
||||
items: [
|
||||
|
@ -1,9 +1,9 @@
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { SchemaInitializerChildren } from '../../application';
|
||||
import { SchemaInitializer } from '../../application/schema-initializer/SchemaInitializer';
|
||||
import { useCompile } from '../../schema-component';
|
||||
import { gridRowColWrap, useCustomFormItemInitializerFields, useInheritsFormItemInitializerFields } from '../utils';
|
||||
import { SchemaInitializerChildren } from '../../application/schema-initializer/components/SchemaInitializerChildren';
|
||||
import { CompatibleSchemaInitializer } from '../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
|
||||
// 表单里配置字段
|
||||
const ParentCollectionFields = () => {
|
||||
@ -24,7 +24,10 @@ const ParentCollectionFields = () => {
|
||||
return <SchemaInitializerChildren>{res}</SchemaInitializerChildren>;
|
||||
};
|
||||
|
||||
export const customFormItemInitializers = new SchemaInitializer({
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const customFormItemInitializers_deprecated = new CompatibleSchemaInitializer({
|
||||
name: 'CustomFormItemInitializers',
|
||||
wrap: gridRowColWrap,
|
||||
icon: 'SettingOutlined',
|
||||
@ -42,3 +45,25 @@ export const customFormItemInitializers = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const customFormItemInitializers = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'assignFieldValuesForm:configureFields',
|
||||
wrap: gridRowColWrap,
|
||||
icon: 'SettingOutlined',
|
||||
title: '{{t("Configure fields")}}',
|
||||
items: [
|
||||
{
|
||||
type: 'itemGroup',
|
||||
title: '{{t("Configure fields")}}',
|
||||
name: 'configureFields',
|
||||
useChildren: useCustomFormItemInitializerFields,
|
||||
},
|
||||
{
|
||||
name: 'parentCollectionFields',
|
||||
Component: ParentCollectionFields,
|
||||
},
|
||||
],
|
||||
},
|
||||
customFormItemInitializers_deprecated,
|
||||
);
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { Schema, useFieldSchema } from '@formily/react';
|
||||
import { useMemo } from 'react';
|
||||
import { useCollection_deprecated, useCollectionManager_deprecated } from '../..';
|
||||
import { useCollectionManager_deprecated, useCollection_deprecated } from '../..';
|
||||
import { SchemaInitializerItemType, useSchemaInitializer } from '../../application';
|
||||
import { SchemaInitializer } from '../../application/schema-initializer/SchemaInitializer';
|
||||
import { CompatibleSchemaInitializer } from '../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
import { gridRowColWrap } from '../utils';
|
||||
|
||||
const recursiveParent = (schema: Schema) => {
|
||||
@ -236,7 +236,10 @@ function useRecordBlocks() {
|
||||
return res;
|
||||
}
|
||||
|
||||
export const recordBlockInitializers = new SchemaInitializer({
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const recordBlockInitializers_deprecated = new CompatibleSchemaInitializer({
|
||||
name: 'RecordBlockInitializers',
|
||||
wrap: gridRowColWrap,
|
||||
title: '{{t("Add block")}}',
|
||||
@ -321,3 +324,92 @@ export const recordBlockInitializers = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const recordBlockInitializers = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'popup:common:addBlock',
|
||||
wrap: gridRowColWrap,
|
||||
title: '{{t("Add block")}}',
|
||||
icon: 'PlusOutlined',
|
||||
items: [
|
||||
{
|
||||
type: 'itemGroup',
|
||||
name: 'currentRecordBlocks',
|
||||
title: '{{t("Current record blocks")}}',
|
||||
useChildren: useRecordBlocks,
|
||||
},
|
||||
{
|
||||
name: 'filterBlocks',
|
||||
title: '{{t("Filter blocks")}}',
|
||||
type: 'itemGroup',
|
||||
useVisible() {
|
||||
const collection = useCollection_deprecated();
|
||||
return collection.fields.some((field) => ['hasMany', 'belongsToMany'].includes(field.type));
|
||||
},
|
||||
children: [
|
||||
{
|
||||
name: 'filterForm',
|
||||
title: '{{t("Form")}}',
|
||||
Component: 'FilterFormBlockInitializer',
|
||||
useComponentProps() {
|
||||
const collection = useCollection_deprecated();
|
||||
const toManyField = useMemo(
|
||||
() => collection.fields.filter((field) => ['hasMany', 'belongsToMany'].includes(field.type)),
|
||||
[collection.fields],
|
||||
);
|
||||
|
||||
return {
|
||||
filterMenuItemChildren(collection) {
|
||||
return toManyField.some((field) => field.target === collection.name);
|
||||
},
|
||||
onlyCurrentDataSource: true,
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'filterCollapse',
|
||||
title: '{{t("Collapse")}}',
|
||||
Component: 'FilterCollapseBlockInitializer',
|
||||
useComponentProps() {
|
||||
const collection = useCollection_deprecated();
|
||||
const toManyField = useMemo(
|
||||
() => collection.fields.filter((field) => ['hasMany', 'belongsToMany'].includes(field.type)),
|
||||
[collection.fields],
|
||||
);
|
||||
|
||||
return {
|
||||
filterMenuItemChildren(collection) {
|
||||
return toManyField.some((field) => field.target === collection.name);
|
||||
},
|
||||
onlyCurrentDataSource: true,
|
||||
};
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'itemGroup',
|
||||
name: 'relationshipBlocks',
|
||||
title: '{{t("Relationship blocks")}}',
|
||||
useChildren: useRelationFields,
|
||||
useVisible() {
|
||||
const res = useRelationFields();
|
||||
return res.length > 0;
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'itemGroup',
|
||||
name: 'otherBlocks',
|
||||
title: '{{t("Other blocks")}}',
|
||||
children: [
|
||||
{
|
||||
name: 'markdown',
|
||||
title: '{{t("Markdown")}}',
|
||||
Component: 'MarkdownBlockInitializer',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
recordBlockInitializers_deprecated,
|
||||
);
|
||||
|
@ -1,7 +1,10 @@
|
||||
import { SchemaInitializer } from '../../application/schema-initializer/SchemaInitializer';
|
||||
import { CompatibleSchemaInitializer } from '../../application/schema-initializer/CompatibleSchemaInitializer';
|
||||
|
||||
// 表格操作配置
|
||||
export const subTableActionInitializers = new SchemaInitializer({
|
||||
/**
|
||||
* @deprecated
|
||||
* 表格操作配置
|
||||
*/
|
||||
export const subTableActionInitializers_deprecated = new CompatibleSchemaInitializer({
|
||||
name: 'SubTableActionInitializers',
|
||||
title: "{{t('Configure actions')}}",
|
||||
icon: 'SettingOutlined',
|
||||
@ -34,3 +37,40 @@ export const subTableActionInitializers = new SchemaInitializer({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const subTableActionInitializers = new CompatibleSchemaInitializer(
|
||||
{
|
||||
name: 'subTable:configureActions',
|
||||
title: "{{t('Configure actions')}}",
|
||||
icon: 'SettingOutlined',
|
||||
style: {
|
||||
marginLeft: 8,
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: 'itemGroup',
|
||||
title: "{{t('Enable actions')}}",
|
||||
name: 'enableActions',
|
||||
children: [
|
||||
{
|
||||
name: 'addNew',
|
||||
title: "{{t('Add new')}}",
|
||||
Component: 'CreateActionInitializer',
|
||||
schema: {
|
||||
'x-align': 'right',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'delete',
|
||||
title: "{{t('Delete')}}",
|
||||
Component: 'BulkDestroyActionInitializer',
|
||||
schema: {
|
||||
'x-align': 'right',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
subTableActionInitializers_deprecated,
|
||||
);
|
||||
|
@ -16,11 +16,11 @@ export const TabPaneInitializers = (props?: any) => {
|
||||
const ctx = useActionContext();
|
||||
let initializer = gridInitializer;
|
||||
if (!initializer) {
|
||||
initializer = 'RecordBlockInitializers';
|
||||
initializer = 'popup:common:addBlock';
|
||||
if (isCreate || !record) {
|
||||
initializer = 'CreateFormBlockInitializers';
|
||||
initializer = 'popup:addNew:addBlock';
|
||||
} else if (isBulkEdit) {
|
||||
initializer = 'BulkEditBlockInitializers';
|
||||
initializer = 'popup:bulkEdit:addBlock';
|
||||
}
|
||||
}
|
||||
return {
|
||||
@ -138,18 +138,27 @@ export const TabPaneInitializersForBulkEditFormBlock = (props) => {
|
||||
return <TabPaneInitializers {...props} isBulkEdit />;
|
||||
};
|
||||
|
||||
export const tabPaneInitializers = new SchemaInitializer({
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const tabPaneInitializers_deprecated = new SchemaInitializer({
|
||||
name: 'TabPaneInitializers',
|
||||
Component: TabPaneInitializers,
|
||||
popover: false,
|
||||
});
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const tabPaneInitializersForRecordBlock = new SchemaInitializer({
|
||||
name: 'TabPaneInitializersForCreateFormBlock',
|
||||
Component: TabPaneInitializersForCreateFormBlock,
|
||||
popover: false,
|
||||
});
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export const tabPaneInitializersForBulkEditFormBlock = new SchemaInitializer({
|
||||
name: 'TabPaneInitializersForBulkEditFormBlock',
|
||||
Component: TabPaneInitializersForBulkEditFormBlock,
|
||||
|
@ -8,7 +8,7 @@ import {
|
||||
import React from 'react';
|
||||
|
||||
const myInitializer = new SchemaInitializer({
|
||||
name: 'MyInitializer',
|
||||
name: 'myInitializer',
|
||||
// 正常情况下这个值为 false,通过点击页面左上角的设计按钮切换,这里为了显示设置为 true
|
||||
designable: true,
|
||||
// 按钮标题标题
|
||||
@ -27,7 +27,7 @@ const myInitializer = new SchemaInitializer({
|
||||
});
|
||||
|
||||
const Root = () => {
|
||||
const { render } = useSchemaInitializerRender('MyInitializer');
|
||||
const { render } = useSchemaInitializerRender('myInitializer');
|
||||
return <div>{render()}</div>;
|
||||
};
|
||||
|
||||
@ -45,7 +45,7 @@ class MyPlugin extends Plugin {
|
||||
|
||||
class MyPlugin2 extends Plugin {
|
||||
async load() {
|
||||
const myInitializer = this.app.schemaInitializerManager.get('MyInitializer');
|
||||
const myInitializer = this.app.schemaInitializerManager.get('myInitializer');
|
||||
|
||||
// 添加或者修改 schema initializer 的 items
|
||||
myInitializer.add('demo3', {
|
||||
|
@ -8,7 +8,7 @@ import {
|
||||
import React from 'react';
|
||||
|
||||
const myInitializer = new SchemaInitializer({
|
||||
name: 'MyInitializer',
|
||||
name: 'myInitializer',
|
||||
designable: true,
|
||||
title: 'Button Text',
|
||||
items: [
|
||||
@ -61,7 +61,7 @@ const myInitializer = new SchemaInitializer({
|
||||
});
|
||||
|
||||
const Root = () => {
|
||||
const { render } = useSchemaInitializerRender('MyInitializer');
|
||||
const { render } = useSchemaInitializerRender('myInitializer');
|
||||
return <div>{render()}</div>;
|
||||
};
|
||||
|
||||
|
@ -4,7 +4,7 @@ import { PlusOutlined } from '@ant-design/icons';
|
||||
import { Divider, Avatar, AvatarProps } from 'antd';
|
||||
|
||||
const myInitializer = new SchemaInitializer<AvatarProps>({
|
||||
name: 'MyInitializer',
|
||||
name: 'myInitializer',
|
||||
designable: true,
|
||||
// 使用自定义组件代替默认的 Button
|
||||
Component: (props) => (
|
||||
@ -25,7 +25,7 @@ const myInitializer = new SchemaInitializer<AvatarProps>({
|
||||
});
|
||||
|
||||
const Root = () => {
|
||||
const { exists, render } = useSchemaInitializerRender('MyInitializer');
|
||||
const { exists, render } = useSchemaInitializerRender('myInitializer');
|
||||
if (!exists) return null;
|
||||
return (
|
||||
<div>
|
||||
|
@ -38,7 +38,7 @@ const CustomListGridMenu: FC<SchemaInitializerItemsProps<ButtonProps, ListProps<
|
||||
};
|
||||
|
||||
const myInitializer = new SchemaInitializer({
|
||||
name: 'MyInitializer',
|
||||
name: 'myInitializer',
|
||||
designable: true,
|
||||
title: 'Button Text',
|
||||
ItemsComponent: CustomItemsMenu,
|
||||
@ -58,7 +58,7 @@ const myInitializer = new SchemaInitializer({
|
||||
});
|
||||
|
||||
const Root = () => {
|
||||
const { exists, render } = useSchemaInitializerRender('MyInitializer');
|
||||
const { exists, render } = useSchemaInitializerRender('myInitializer');
|
||||
if (!exists) return null;
|
||||
return (
|
||||
<div>
|
||||
|
@ -8,7 +8,7 @@ import {
|
||||
import React from 'react';
|
||||
|
||||
const myInitializer = new SchemaInitializer({
|
||||
name: 'MyInitializer',
|
||||
name: 'myInitializer',
|
||||
designable: true,
|
||||
title: 'Button Text',
|
||||
items: [
|
||||
@ -59,7 +59,7 @@ const myInitializer = new SchemaInitializer({
|
||||
});
|
||||
|
||||
const Root = () => {
|
||||
const { render } = useSchemaInitializerRender('MyInitializer');
|
||||
const { render } = useSchemaInitializerRender('myInitializer');
|
||||
return <div>{render()}</div>;
|
||||
};
|
||||
|
||||
|
@ -12,7 +12,7 @@ import {
|
||||
import React from 'react';
|
||||
|
||||
const addActionInitializer = new SchemaInitializer({
|
||||
name: 'AddAction',
|
||||
name: 'addAction',
|
||||
title: 'Configure actions',
|
||||
// 插入位置
|
||||
insertPosition: 'beforeEnd',
|
||||
@ -65,7 +65,7 @@ const Root = () => {
|
||||
// 指定初始化的按钮组件,
|
||||
// Table、Form、Details、Calendar、Kanban 等等不同区块
|
||||
// 可以根据情况组装自己的 initializer
|
||||
'x-initializer': 'AddAction',
|
||||
'x-initializer': 'addAction',
|
||||
properties: {
|
||||
action1: {
|
||||
type: 'void',
|
||||
|
@ -36,7 +36,7 @@ function Demo() {
|
||||
}
|
||||
|
||||
const myInitializer = new SchemaInitializer({
|
||||
name: 'MyInitializer',
|
||||
name: 'myInitializer',
|
||||
title: 'Add Block',
|
||||
// 插入位置
|
||||
insertPosition: 'beforeEnd',
|
||||
@ -55,7 +55,7 @@ const myInitializer = new SchemaInitializer({
|
||||
});
|
||||
|
||||
const AddBlockButton = observer(() => {
|
||||
const { render } = useSchemaInitializerRender('MyInitializer');
|
||||
const { render } = useSchemaInitializerRender('myInitializer');
|
||||
return render();
|
||||
});
|
||||
|
||||
|
@ -67,7 +67,7 @@ const TextInitializer: FC = () => {
|
||||
};
|
||||
|
||||
const addFormItemInitializer = new SchemaInitializer({
|
||||
name: 'AddFormItem',
|
||||
name: 'addFormItem',
|
||||
title: 'Configure actions',
|
||||
insertPosition: 'beforeEnd',
|
||||
items: [
|
||||
@ -91,7 +91,7 @@ const addFormItemInitializer = new SchemaInitializer({
|
||||
});
|
||||
|
||||
const Page = (props) => {
|
||||
const { render } = useSchemaInitializerRender('AddFormItem');
|
||||
const { render } = useSchemaInitializerRender('addFormItem');
|
||||
return (
|
||||
<div>
|
||||
{props.children}
|
||||
|
@ -69,7 +69,7 @@ const Demo = () => {
|
||||
};
|
||||
|
||||
const myInitializer = new SchemaInitializer({
|
||||
name: 'MyInitializer',
|
||||
name: 'myInitializer',
|
||||
designable: true,
|
||||
title: 'Button Text',
|
||||
items: [
|
||||
@ -99,7 +99,7 @@ const myInitializer = new SchemaInitializer({
|
||||
});
|
||||
|
||||
const Root = () => {
|
||||
const { render } = useSchemaInitializerRender('MyInitializer');
|
||||
const { render } = useSchemaInitializerRender('myInitializer');
|
||||
return <div>{render()}</div>;
|
||||
};
|
||||
|
||||
@ -115,7 +115,7 @@ class MyPlugin extends Plugin {
|
||||
|
||||
class MyPlugin2 extends Plugin {
|
||||
async load() {
|
||||
const myInitializer = this.app.schemaInitializerManager.get('MyInitializer');
|
||||
const myInitializer = this.app.schemaInitializerManager.get('myInitializer');
|
||||
|
||||
// 嵌套添加
|
||||
myInitializer.add('a.a4', {
|
||||
|
@ -1,9 +1,15 @@
|
||||
import { Plugin } from '../application/Plugin';
|
||||
import { CreateChildInitializer } from '../modules/actions/add-child/CreateChildInitializer';
|
||||
import { CreateActionInitializer } from '../modules/actions/add-new/CreateActionInitializer';
|
||||
import { createFormBlockInitializers } from '../modules/actions/add-new/createFormBlockInitializers';
|
||||
import {
|
||||
createFormBlockInitializers,
|
||||
createFormBlockInitializers_deprecated,
|
||||
} from '../modules/actions/add-new/createFormBlockInitializers';
|
||||
import { CustomizeAddRecordActionInitializer } from '../modules/actions/add-record/CustomizeAddRecordActionInitializer';
|
||||
import { customizeCreateFormBlockInitializers } from '../modules/actions/add-record/customizeCreateFormBlockInitializers';
|
||||
import {
|
||||
customizeCreateFormBlockInitializers,
|
||||
customizeCreateFormBlockInitializers_deprecated,
|
||||
} from '../modules/actions/add-record/customizeCreateFormBlockInitializers';
|
||||
import { BulkDestroyActionInitializer } from '../modules/actions/bulk-destroy/BulkDestroyActionInitializer';
|
||||
import { DestroyActionInitializer } from '../modules/actions/delete/DestroyActionInitializer';
|
||||
import { ExpandableActionInitializer } from '../modules/actions/expand-collapse/ExpandableActionInitializer';
|
||||
@ -17,47 +23,98 @@ import { PopupActionInitializer } from '../modules/actions/view-edit-popup/Popup
|
||||
import { recordFormBlockInitializers } from '../modules/actions/view-edit-popup/RecordFormBlockInitializers';
|
||||
import { UpdateActionInitializer } from '../modules/actions/view-edit-popup/UpdateActionInitializer';
|
||||
import { ViewActionInitializer } from '../modules/actions/view-edit-popup/ViewActionInitializer';
|
||||
import { detailsActionInitializers } from '../modules/blocks/data-blocks/details-multi/DetailsActionInitializers';
|
||||
import {
|
||||
detailsActionInitializers,
|
||||
detailsActionInitializers_deprecated,
|
||||
} from '../modules/blocks/data-blocks/details-multi/DetailsActionInitializers';
|
||||
import { DetailsBlockInitializer } from '../modules/blocks/data-blocks/details-multi/DetailsBlockInitializer';
|
||||
import { readPrettyFormActionInitializers } from '../modules/blocks/data-blocks/details-single/ReadPrettyFormActionInitializers';
|
||||
import { readPrettyFormItemInitializers } from '../modules/blocks/data-blocks/details-single/ReadPrettyFormItemInitializers';
|
||||
import {
|
||||
readPrettyFormActionInitializers,
|
||||
readPrettyFormActionInitializers_deprecated,
|
||||
} from '../modules/blocks/data-blocks/details-single/ReadPrettyFormActionInitializers';
|
||||
import {
|
||||
readPrettyFormItemInitializers,
|
||||
readPrettyFormItemInitializers_deprecated,
|
||||
} from '../modules/blocks/data-blocks/details-single/ReadPrettyFormItemInitializers';
|
||||
import { RecordReadPrettyFormBlockInitializer } from '../modules/blocks/data-blocks/details-single/RecordReadPrettyFormBlockInitializer';
|
||||
import { CreateFormBlockInitializer } from '../modules/blocks/data-blocks/form/CreateFormBlockInitializer';
|
||||
import { FormBlockInitializer } from '../modules/blocks/data-blocks/form/FormBlockInitializer';
|
||||
import { RecordFormBlockInitializer } from '../modules/blocks/data-blocks/form/RecordFormBlockInitializer';
|
||||
import { createFormActionInitializers } from '../modules/blocks/data-blocks/form/createFormActionInitializers';
|
||||
import {
|
||||
createFormActionInitializers,
|
||||
createFormActionInitializers_deprecated,
|
||||
} from '../modules/blocks/data-blocks/form/createFormActionInitializers';
|
||||
import { formActionInitializers } from '../modules/blocks/data-blocks/form/formActionInitializers';
|
||||
import { formItemInitializers } from '../modules/blocks/data-blocks/form/formItemInitializers';
|
||||
import { updateFormActionInitializers } from '../modules/blocks/data-blocks/form/updateFormActionInitializers';
|
||||
import { gridCardActionInitializers } from '../modules/blocks/data-blocks/grid-card/GridCardActionInitializers';
|
||||
import {
|
||||
formItemInitializers,
|
||||
formItemInitializers_deprecated,
|
||||
} from '../modules/blocks/data-blocks/form/formItemInitializers';
|
||||
import {
|
||||
updateFormActionInitializers,
|
||||
updateFormActionInitializers_deprecated,
|
||||
} from '../modules/blocks/data-blocks/form/updateFormActionInitializers';
|
||||
import {
|
||||
gridCardActionInitializers,
|
||||
gridCardActionInitializers_deprecated,
|
||||
} from '../modules/blocks/data-blocks/grid-card/GridCardActionInitializers';
|
||||
import { GridCardBlockInitializer } from '../modules/blocks/data-blocks/grid-card/GridCardBlockInitializer';
|
||||
import { gridCardItemActionInitializers } from '../modules/blocks/data-blocks/grid-card/gridCardItemActionInitializers';
|
||||
import { listActionInitializers } from '../modules/blocks/data-blocks/list/ListActionInitializers';
|
||||
import {
|
||||
gridCardItemActionInitializers,
|
||||
gridCardItemActionInitializers_deprecated,
|
||||
} from '../modules/blocks/data-blocks/grid-card/gridCardItemActionInitializers';
|
||||
import {
|
||||
listActionInitializers,
|
||||
listActionInitializers_deprecated,
|
||||
} from '../modules/blocks/data-blocks/list/ListActionInitializers';
|
||||
import { ListBlockInitializer } from '../modules/blocks/data-blocks/list/ListBlockInitializer';
|
||||
import { listItemActionInitializers } from '../modules/blocks/data-blocks/list/listItemActionInitializers';
|
||||
import {
|
||||
listItemActionInitializers,
|
||||
listItemActionInitializers_deprecated,
|
||||
} from '../modules/blocks/data-blocks/list/listItemActionInitializers';
|
||||
import { TableSelectorInitializer } from '../modules/blocks/data-blocks/table-selector/TableSelectorInitializer';
|
||||
import { tableActionColumnInitializers } from '../modules/blocks/data-blocks/table/TableActionColumnInitializers';
|
||||
import { tableActionInitializers } from '../modules/blocks/data-blocks/table/TableActionInitializers';
|
||||
import {
|
||||
tableActionColumnInitializers,
|
||||
tableActionColumnInitializers_deprecated,
|
||||
} from '../modules/blocks/data-blocks/table/TableActionColumnInitializers';
|
||||
import {
|
||||
tableActionInitializers,
|
||||
tableActionInitializers_deprecated,
|
||||
} from '../modules/blocks/data-blocks/table/TableActionInitializers';
|
||||
import { TableBlockInitializer } from '../modules/blocks/data-blocks/table/TableBlockInitializer';
|
||||
import { tableColumnInitializers } from '../modules/blocks/data-blocks/table/TableColumnInitializers';
|
||||
import {
|
||||
tableColumnInitializers,
|
||||
tableColumnInitializers_deprecated,
|
||||
} from '../modules/blocks/data-blocks/table/TableColumnInitializers';
|
||||
import { FilterCollapseBlockInitializer } from '../modules/blocks/filter-blocks/collapse/FilterCollapseBlockInitializer';
|
||||
import { filterFormActionInitializers } from '../modules/blocks/filter-blocks/form/FilterFormActionInitializers';
|
||||
import {
|
||||
filterFormActionInitializers,
|
||||
filterFormActionInitializers_deprecated,
|
||||
} from '../modules/blocks/filter-blocks/form/FilterFormActionInitializers';
|
||||
import { FilterFormBlockInitializer } from '../modules/blocks/filter-blocks/form/FilterFormBlockInitializer';
|
||||
import { filterFormItemInitializers } from '../modules/blocks/filter-blocks/form/filterFormItemInitializers';
|
||||
import {
|
||||
filterFormItemInitializers,
|
||||
filterFormItemInitializers_deprecated,
|
||||
} from '../modules/blocks/filter-blocks/form/filterFormItemInitializers';
|
||||
import { MarkdownBlockInitializer } from '../modules/blocks/other-blocks/markdown/MarkdownBlockInitializer';
|
||||
import { MarkdownFormItemInitializer } from '../modules/blocks/other-blocks/markdown/MarkdownFormItemInitializer';
|
||||
import { tableSelectorInitializers } from '../modules/fields/component/Picker/TableSelectorInitializers';
|
||||
import {
|
||||
tableSelectorInitializers,
|
||||
tableSelectorInitializers_deprecated,
|
||||
} from '../modules/fields/component/Picker/TableSelectorInitializers';
|
||||
import { CollectionFieldInitializer } from '../modules/fields/initializer/CollectionFieldInitializer';
|
||||
import { TableCollectionFieldInitializer } from '../modules/fields/initializer/TableCollectionFieldInitializer';
|
||||
import { menuItemInitializer } from '../modules/menu/menuItemInitializer';
|
||||
import { blockInitializers } from '../modules/page/BlockInitializers';
|
||||
import { menuItemInitializer, menuItemInitializer_deprecated } from '../modules/menu/menuItemInitializer';
|
||||
import { blockInitializers, blockInitializers_deprecated } from '../modules/page/BlockInitializers';
|
||||
import {
|
||||
customFormItemInitializers,
|
||||
customFormItemInitializers_deprecated,
|
||||
recordBlockInitializers,
|
||||
recordBlockInitializers_deprecated,
|
||||
subTableActionInitializers,
|
||||
tabPaneInitializers,
|
||||
subTableActionInitializers_deprecated,
|
||||
tabPaneInitializersForBulkEditFormBlock,
|
||||
tabPaneInitializersForRecordBlock,
|
||||
tabPaneInitializers_deprecated,
|
||||
} from './buttons';
|
||||
import * as initializerComponents from './components';
|
||||
import * as items from './items';
|
||||
@ -118,35 +175,57 @@ export class SchemaInitializerPlugin extends Plugin {
|
||||
RefreshActionInitializer,
|
||||
} as any);
|
||||
|
||||
this.app.schemaInitializerManager.add(blockInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(blockInitializers);
|
||||
this.app.schemaInitializerManager.add(tableActionInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(tableActionInitializers);
|
||||
this.app.schemaInitializerManager.add(tableColumnInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(tableColumnInitializers);
|
||||
this.app.schemaInitializerManager.add(tableActionColumnInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(tableActionColumnInitializers);
|
||||
this.app.schemaInitializerManager.add(formItemInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(formItemInitializers);
|
||||
this.app.schemaInitializerManager.add(formActionInitializers);
|
||||
this.app.schemaInitializerManager.add(detailsActionInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(detailsActionInitializers);
|
||||
this.app.schemaInitializerManager.add(readPrettyFormItemInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(readPrettyFormItemInitializers);
|
||||
this.app.schemaInitializerManager.add(readPrettyFormActionInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(readPrettyFormActionInitializers);
|
||||
this.app.schemaInitializerManager.add(createFormBlockInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(createFormBlockInitializers);
|
||||
this.app.schemaInitializerManager.add(customizeCreateFormBlockInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(customizeCreateFormBlockInitializers);
|
||||
this.app.schemaInitializerManager.add(customFormItemInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(customFormItemInitializers);
|
||||
this.app.schemaInitializerManager.add(filterFormActionInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(filterFormActionInitializers);
|
||||
this.app.schemaInitializerManager.add(createFormActionInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(createFormActionInitializers);
|
||||
this.app.schemaInitializerManager.add(updateFormActionInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(updateFormActionInitializers);
|
||||
this.app.schemaInitializerManager.add(filterFormItemInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(filterFormItemInitializers);
|
||||
this.app.schemaInitializerManager.add(gridCardActionInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(gridCardActionInitializers);
|
||||
this.app.schemaInitializerManager.add(gridCardItemActionInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(gridCardItemActionInitializers);
|
||||
|
||||
this.app.schemaInitializerManager.add(listActionInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(listActionInitializers);
|
||||
this.app.schemaInitializerManager.add(listItemActionInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(listItemActionInitializers);
|
||||
this.app.schemaInitializerManager.add(recordBlockInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(recordBlockInitializers);
|
||||
this.app.schemaInitializerManager.add(recordFormBlockInitializers);
|
||||
this.app.schemaInitializerManager.add(subTableActionInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(subTableActionInitializers);
|
||||
this.app.schemaInitializerManager.add(tableSelectorInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(tableSelectorInitializers);
|
||||
this.app.schemaInitializerManager.add(tabPaneInitializers);
|
||||
this.app.schemaInitializerManager.add(tabPaneInitializers_deprecated);
|
||||
this.app.schemaInitializerManager.add(tabPaneInitializersForRecordBlock);
|
||||
this.app.schemaInitializerManager.add(tabPaneInitializersForBulkEditFormBlock);
|
||||
this.app.schemaInitializerManager.add(createFormBlockInitializers);
|
||||
this.app.schemaInitializerManager.add(menuItemInitializer_deprecated);
|
||||
this.app.schemaInitializerManager.add(menuItemInitializer);
|
||||
}
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ export const RecordAssociationFormBlockInitializer = () => {
|
||||
onClick={async ({ item }) => {
|
||||
const action = ['hasOne', 'belongsTo'].includes(field.type) ? 'get' : null;
|
||||
const actionInitializers = ['hasOne', 'belongsTo'].includes(field.type)
|
||||
? 'UpdateFormActionInitializers'
|
||||
: 'CreateFormActionInitializers';
|
||||
? 'editForm:configureActions'
|
||||
: 'createForm:configureActions';
|
||||
|
||||
if (item.template) {
|
||||
const s = await getTemplateSchemaByMode(item);
|
||||
|
@ -20,7 +20,7 @@ export const RecordReadPrettyAssociationFormBlockInitializer = () => {
|
||||
|
||||
const resource = `${field.collectionName}.${field.name}`;
|
||||
const { block } = useBlockRequestContext();
|
||||
const actionInitializers = block !== 'TableField' ? 'ReadPrettyFormActionInitializers' : null;
|
||||
const actionInitializers = block !== 'TableField' ? 'details:configureActions' : null;
|
||||
|
||||
return (
|
||||
<SchemaInitializerItem
|
||||
|
@ -23,7 +23,7 @@ export const SelectActionInitializer = (props) => {
|
||||
grid: {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'TableSelectorInitializers',
|
||||
'x-initializer': 'popup:tableSelector:addBlock',
|
||||
properties: {},
|
||||
},
|
||||
footer: {
|
||||
@ -41,7 +41,7 @@ export const SelectActionInitializer = (props) => {
|
||||
'x-component': 'Action',
|
||||
// 'x-designer': 'Action.Designer',
|
||||
'x-toolbar': 'ActionSchemaToolbar',
|
||||
'x-settings': 'actionSettings:updateSubmit',
|
||||
'x-settings': 'actionSettings:submit',
|
||||
'x-component-props': {
|
||||
type: 'primary',
|
||||
htmlType: 'submit',
|
||||
|
@ -9,7 +9,7 @@ export const SubmitActionInitializer = (props) => {
|
||||
'x-component': 'Action',
|
||||
// 'x-designer': 'Action.Designer',
|
||||
'x-toolbar': 'ActionSchemaToolbar',
|
||||
'x-settings': 'actionSettings:updateSubmit',
|
||||
'x-settings': 'actionSettings:submit',
|
||||
'x-component-props': {
|
||||
type: 'primary',
|
||||
htmlType: 'submit',
|
||||
|
@ -10,7 +10,7 @@ export const TableActionColumnInitializer = () => {
|
||||
'x-decorator': 'TableV2.Column.ActionBar',
|
||||
'x-component': 'TableV2.Column',
|
||||
'x-designer': 'TableV2.ActionColumnDesigner',
|
||||
'x-initializer': 'TableActionColumnInitializers',
|
||||
'x-initializer': 'table:configureItemActions',
|
||||
'x-action-column': 'actions',
|
||||
properties: {
|
||||
[uid()]: {
|
||||
|
@ -857,8 +857,8 @@ export const useCollectionDataSourceItems = (
|
||||
|
||||
export const createDetailsBlockSchema = (options) => {
|
||||
const {
|
||||
formItemInitializers = 'ReadPrettyFormItemInitializers',
|
||||
actionInitializers = 'DetailsActionInitializers',
|
||||
formItemInitializers = 'details:configureFields',
|
||||
actionInitializers = 'detailsWithPaging:configureActions',
|
||||
collection,
|
||||
dataSource,
|
||||
association,
|
||||
@ -930,9 +930,9 @@ export const createDetailsBlockSchema = (options) => {
|
||||
|
||||
export const createListBlockSchema = (options) => {
|
||||
const {
|
||||
formItemInitializers = 'ReadPrettyFormItemInitializers',
|
||||
actionInitializers = 'ListActionInitializers',
|
||||
itemActionInitializers = 'ListItemActionInitializers',
|
||||
formItemInitializers = 'details:configureFields',
|
||||
actionInitializers = 'list:configureActions',
|
||||
itemActionInitializers = 'list:configureItemActions',
|
||||
collection,
|
||||
dataSource,
|
||||
association,
|
||||
@ -1020,9 +1020,9 @@ export const createListBlockSchema = (options) => {
|
||||
|
||||
export const createGridCardBlockSchema = (options) => {
|
||||
const {
|
||||
formItemInitializers = 'ReadPrettyFormItemInitializers',
|
||||
actionInitializers = 'GridCardActionInitializers',
|
||||
itemActionInitializers = 'GridCardItemActionInitializers',
|
||||
formItemInitializers = 'details:configureFields',
|
||||
actionInitializers = 'gridCard:configureActions',
|
||||
itemActionInitializers = 'gridCard:configureItemActions',
|
||||
collection,
|
||||
association,
|
||||
resource,
|
||||
@ -1112,8 +1112,8 @@ export const createGridCardBlockSchema = (options) => {
|
||||
};
|
||||
export const createFormBlockSchema = (options) => {
|
||||
const {
|
||||
formItemInitializers = 'FormItemInitializers',
|
||||
actionInitializers = 'FormActionInitializers',
|
||||
formItemInitializers = 'form:configureFields',
|
||||
actionInitializers = 'createForm:configureActions',
|
||||
collection,
|
||||
resource,
|
||||
dataSource,
|
||||
@ -1185,8 +1185,8 @@ export const createFormBlockSchema = (options) => {
|
||||
|
||||
export const createFilterFormBlockSchema = (options) => {
|
||||
const {
|
||||
formItemInitializers = 'FilterFormItemInitializers',
|
||||
actionInitializers = 'FilterFormActionInitializers',
|
||||
formItemInitializers = 'filterForm:configureFields',
|
||||
actionInitializers = 'filterForm:configureActions',
|
||||
collection,
|
||||
resource,
|
||||
association,
|
||||
@ -1250,8 +1250,8 @@ export const createFilterFormBlockSchema = (options) => {
|
||||
|
||||
export const createReadPrettyFormBlockSchema = (options) => {
|
||||
const {
|
||||
formItemInitializers = 'ReadPrettyFormItemInitializers',
|
||||
actionInitializers = 'ReadPrettyFormActionInitializers',
|
||||
formItemInitializers = 'details:configureFields',
|
||||
actionInitializers = 'details:configureActions',
|
||||
collection,
|
||||
association,
|
||||
dataSource,
|
||||
@ -1353,7 +1353,7 @@ export const createTableBlockSchema = (options) => {
|
||||
properties: {
|
||||
actions: {
|
||||
type: 'void',
|
||||
'x-initializer': tableActionInitializers ?? 'TableActionInitializers',
|
||||
'x-initializer': tableActionInitializers ?? 'table:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
style: {
|
||||
@ -1364,7 +1364,7 @@ export const createTableBlockSchema = (options) => {
|
||||
},
|
||||
[uid()]: {
|
||||
type: 'array',
|
||||
'x-initializer': tableColumnInitializers ?? 'TableColumnInitializers',
|
||||
'x-initializer': tableColumnInitializers ?? 'table:configureColumns',
|
||||
'x-component': 'TableV2',
|
||||
'x-component-props': {
|
||||
rowKey: 'id',
|
||||
@ -1381,7 +1381,7 @@ export const createTableBlockSchema = (options) => {
|
||||
'x-decorator': 'TableV2.Column.ActionBar',
|
||||
'x-component': 'TableV2.Column',
|
||||
'x-designer': 'TableV2.ActionColumnDesigner',
|
||||
'x-initializer': tableActionColumnInitializers ?? 'TableActionColumnInitializers',
|
||||
'x-initializer': tableActionColumnInitializers ?? 'table:configureItemActions',
|
||||
properties: {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
@ -1424,7 +1424,7 @@ export const createCollapseBlockSchema = (options) => {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
'x-action': 'associateFilter',
|
||||
'x-initializer': 'AssociationFilterInitializers',
|
||||
'x-initializer': 'filterCollapse:configureFields',
|
||||
'x-component': 'AssociationFilter',
|
||||
properties: {},
|
||||
},
|
||||
@ -1457,7 +1457,7 @@ export const createTableSelectorSchema = (options) => {
|
||||
properties: {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
'x-initializer': 'TableActionInitializers',
|
||||
'x-initializer': 'table:configureActions',
|
||||
'x-component': 'ActionBar',
|
||||
'x-component-props': {
|
||||
style: {
|
||||
@ -1468,7 +1468,7 @@ export const createTableSelectorSchema = (options) => {
|
||||
},
|
||||
value: {
|
||||
type: 'array',
|
||||
'x-initializer': 'TableColumnInitializers',
|
||||
'x-initializer': 'table:configureColumns',
|
||||
'x-component': 'TableV2.Selector',
|
||||
'x-component-props': {
|
||||
rowSelection: {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user