fix: actions schema key should be uid (#3570)
* fix: actions in table column should be uid * fix: actins name in form block * fix: actions schema key should be uid * fix: actions schema key should be uid
This commit is contained in:
parent
0e728ca5a5
commit
28222fce99
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
|
||||
import { uid } from '@formily/shared';
|
||||
import { InitializerWithSwitch } from './InitializerWithSwitch';
|
||||
import { useSchemaInitializerItem } from '../../application';
|
||||
|
||||
@ -13,7 +13,7 @@ export const TableActionColumnInitializer = () => {
|
||||
'x-initializer': 'TableActionColumnInitializers',
|
||||
'x-action-column': 'actions',
|
||||
properties: {
|
||||
actions: {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
'x-decorator': 'DndContext',
|
||||
'x-component': 'Space',
|
||||
|
@ -1193,7 +1193,7 @@ export const createFormBlockSchema = (options) => {
|
||||
'x-initializer': formItemInitializers,
|
||||
properties: {},
|
||||
},
|
||||
actions: {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
'x-initializer': actionInitializers,
|
||||
'x-component': 'ActionBar',
|
||||
@ -1254,7 +1254,7 @@ export const createFilterFormBlockSchema = (options) => {
|
||||
'x-initializer': formItemInitializers,
|
||||
properties: {},
|
||||
},
|
||||
actions: {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
'x-initializer': actionInitializers,
|
||||
'x-component': 'ActionBar',
|
||||
@ -1308,7 +1308,7 @@ export const createReadPrettyFormBlockSchema = (options) => {
|
||||
useProps: '{{ useFormBlockProps }}',
|
||||
},
|
||||
properties: {
|
||||
actions: {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
'x-initializer': actionInitializers,
|
||||
'x-component': 'ActionBar',
|
||||
@ -1402,7 +1402,7 @@ export const createTableBlockSchema = (options) => {
|
||||
'x-designer': 'TableV2.ActionColumnDesigner',
|
||||
'x-initializer': tableActionColumnInitializers ?? 'TableActionColumnInitializers',
|
||||
properties: {
|
||||
actions: {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
'x-decorator': 'DndContext',
|
||||
'x-component': 'Space',
|
||||
@ -1470,7 +1470,7 @@ export const createTableSelectorSchema = (options) => {
|
||||
'x-designer': 'TableSelectorDesigner',
|
||||
'x-component': 'CardItem',
|
||||
properties: {
|
||||
actions: {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
'x-initializer': 'TableActionInitializers',
|
||||
'x-component': 'ActionBar',
|
||||
|
@ -46,8 +46,12 @@ function InternalFormBlockInitializer({ schema, ...others }) {
|
||||
delete result['x-acl-action-props'];
|
||||
delete result['x-acl-action'];
|
||||
const [formKey] = Object.keys(result.properties);
|
||||
result.properties[formKey].properties.actions['x-decorator'] = 'ActionBarProvider';
|
||||
result.properties[formKey].properties.actions['x-component-props'].style = {
|
||||
//获取actionBar的schemakey
|
||||
const actionKey =
|
||||
Object.entries(result.properties[formKey].properties).find(([key, f]) => f['x-component'] === 'ActionBar')?.[0] ||
|
||||
'actions';
|
||||
result.properties[formKey].properties[actionKey]['x-decorator'] = 'ActionBarProvider';
|
||||
result.properties[formKey].properties[actionKey]['x-component-props'].style = {
|
||||
marginTop: '1.5em',
|
||||
flexWrap: 'wrap',
|
||||
};
|
||||
|
@ -87,10 +87,13 @@ export default {
|
||||
formBlocks.forEach((formBlock) => {
|
||||
const [formKey] = Object.keys(formBlock.properties);
|
||||
const formSchema = formBlock.properties[formKey];
|
||||
//获取actionBar的schemakey
|
||||
const actionKey =
|
||||
Object.entries(formSchema.properties).find(([key, f]) => f['x-component'] === 'ActionBar')?.[0] || 'actions';
|
||||
forms[formKey] = {
|
||||
type: 'create',
|
||||
title: formBlock['x-component-props']?.title || formKey,
|
||||
actions: findSchema(formSchema.properties.actions, (item) => item['x-component'] === 'Action').map(
|
||||
actions: findSchema(formSchema.properties[actionKey], (item) => item['x-component'] === 'Action').map(
|
||||
(item) => ({
|
||||
status: item['x-decorator-props'].value,
|
||||
values: item['x-action-settings']?.assignedValues?.values,
|
||||
|
@ -378,10 +378,13 @@ export default {
|
||||
formBlock['x-decorator-props'].collection.fields = fields.map(
|
||||
(field) => field['x-component-props']?.field ?? field['x-interface-options'],
|
||||
);
|
||||
//获取actionBar的schemakey
|
||||
const actionKey =
|
||||
Object.entries(formSchema.properties).find(([key, f]) => f['x-component'] === 'ActionBar')?.[0] || 'actions';
|
||||
forms[formKey] = {
|
||||
type: 'custom',
|
||||
title: formBlock['x-component-props']?.title || formKey,
|
||||
actions: findSchema(formSchema.properties.actions, (item) => item['x-component'] === 'Action').map(
|
||||
actions: findSchema(formSchema.properties[actionKey], (item) => item['x-component'] === 'Action').map(
|
||||
(item) => ({
|
||||
status: item['x-decorator-props'].value,
|
||||
values: item['x-action-settings']?.assignedValues?.values,
|
||||
|
@ -125,11 +125,14 @@ export default {
|
||||
formBlocks.forEach((formBlock) => {
|
||||
const [formKey] = Object.keys(formBlock.properties);
|
||||
const formSchema = formBlock.properties[formKey];
|
||||
//获取actionBar的schemakey
|
||||
const actionKey =
|
||||
Object.entries(formSchema.properties).find(([key, f]) => f['x-component'] === 'ActionBar')?.[0] || 'actions';
|
||||
forms[formKey] = {
|
||||
...formBlock['x-decorator-props'],
|
||||
type: 'update',
|
||||
title: formBlock['x-component-props']?.title || formKey,
|
||||
actions: findSchema(formSchema.properties.actions, (item) => item['x-component'] === 'Action').map(
|
||||
actions: findSchema(formSchema.properties[actionKey], (item) => item['x-component'] === 'Action').map(
|
||||
(item) => ({
|
||||
status: item['x-decorator-props'].value,
|
||||
values: item['x-action-settings']?.assignedValues?.values,
|
||||
|
Loading…
Reference in New Issue
Block a user