feat: improve Table.Operation
This commit is contained in:
parent
90f8f721b7
commit
3e5e9c194c
@ -92,14 +92,13 @@ const useActionPermissionResource = ({ onSuccess }) => {
|
||||
console.log('actionPermissions', data);
|
||||
onSuccess({
|
||||
actionPermissions: data.map((permission) => {
|
||||
const item: any = {}
|
||||
Object.keys(permission).forEach(key => {
|
||||
const item: any = {};
|
||||
Object.keys(permission).forEach((key) => {
|
||||
if (isValid(permission[key])) {
|
||||
item[key] = permission[key];
|
||||
}
|
||||
});
|
||||
item.fields =
|
||||
permission?.fields.map((field) => field.key) || [];
|
||||
item.fields = permission?.fields.map((field) => field.key) || [];
|
||||
return item;
|
||||
}),
|
||||
});
|
||||
@ -162,34 +161,51 @@ const collectionSchema: ISchema = {
|
||||
collectionName: 'collections',
|
||||
},
|
||||
properties: {
|
||||
[uid()]: {
|
||||
column1: {
|
||||
type: 'void',
|
||||
title: '数据表名称',
|
||||
'x-component': 'Table.Column',
|
||||
properties: {
|
||||
title: {
|
||||
type: 'string',
|
||||
'x-component': 'Input',
|
||||
'x-read-pretty': true,
|
||||
},
|
||||
},
|
||||
},
|
||||
column2: {
|
||||
type: 'void',
|
||||
title: '数据表标识',
|
||||
'x-component': 'Table.Column',
|
||||
properties: {
|
||||
name: {
|
||||
type: 'string',
|
||||
'x-component': 'Input',
|
||||
'x-read-pretty': true,
|
||||
},
|
||||
},
|
||||
},
|
||||
column3: {
|
||||
type: 'void',
|
||||
title: '操作',
|
||||
'x-component': 'Table.Operation',
|
||||
'x-component': 'Table.Column',
|
||||
'x-component-props': {
|
||||
className: 'nb-table-operation',
|
||||
width: 60,
|
||||
},
|
||||
properties: {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
'x-component': 'Action',
|
||||
'x-component': 'Action.Group',
|
||||
'x-component-props': {
|
||||
icon: 'EllipsisOutlined',
|
||||
type: 'link',
|
||||
},
|
||||
properties: {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
'x-component': 'Action.Dropdown',
|
||||
'x-component-props': {},
|
||||
properties: {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
title: '配置',
|
||||
'x-component': 'Menu.Action',
|
||||
'x-component': 'Action',
|
||||
'x-component-props': {
|
||||
style: {
|
||||
minWidth: 150,
|
||||
},
|
||||
type: 'link',
|
||||
},
|
||||
'x-action-type': 'view',
|
||||
properties: {
|
||||
@ -218,32 +234,6 @@ const collectionSchema: ISchema = {
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
column1: {
|
||||
type: 'void',
|
||||
title: '数据表名称',
|
||||
'x-component': 'Table.Column',
|
||||
properties: {
|
||||
title: {
|
||||
type: 'string',
|
||||
'x-component': 'Input',
|
||||
'x-read-pretty': true,
|
||||
},
|
||||
},
|
||||
},
|
||||
column2: {
|
||||
type: 'void',
|
||||
title: '数据表标识',
|
||||
'x-component': 'Table.Column',
|
||||
properties: {
|
||||
name: {
|
||||
type: 'string',
|
||||
'x-component': 'Input',
|
||||
'x-read-pretty': true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const menuSchema: ISchema = {
|
||||
@ -342,34 +332,51 @@ const schema: ISchema = {
|
||||
},
|
||||
},
|
||||
},
|
||||
column1: {
|
||||
type: 'void',
|
||||
title: '权限名称',
|
||||
'x-component': 'Table.Column',
|
||||
properties: {
|
||||
title: {
|
||||
type: 'string',
|
||||
'x-component': 'Input',
|
||||
'x-read-pretty': true,
|
||||
},
|
||||
},
|
||||
},
|
||||
column2: {
|
||||
type: 'void',
|
||||
title: '权限标识',
|
||||
'x-component': 'Table.Column',
|
||||
properties: {
|
||||
name: {
|
||||
type: 'string',
|
||||
'x-component': 'Input',
|
||||
'x-read-pretty': true,
|
||||
},
|
||||
},
|
||||
},
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
title: '操作',
|
||||
'x-component': 'Table.Operation',
|
||||
'x-component': 'Table.Column',
|
||||
'x-component-props': {
|
||||
className: 'nb-table-operation',
|
||||
width: 160,
|
||||
},
|
||||
properties: {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
'x-component': 'Action',
|
||||
'x-component': 'Action.Group',
|
||||
'x-component-props': {
|
||||
icon: 'EllipsisOutlined',
|
||||
type: 'link',
|
||||
},
|
||||
properties: {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
'x-component': 'Action.Dropdown',
|
||||
'x-component-props': {},
|
||||
properties: {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
title: '配置',
|
||||
'x-component': 'Menu.Action',
|
||||
'x-component': 'Action',
|
||||
'x-component-props': {
|
||||
style: {
|
||||
minWidth: 150,
|
||||
},
|
||||
type: 'link',
|
||||
},
|
||||
'x-action-type': 'view',
|
||||
properties: {
|
||||
@ -416,7 +423,10 @@ const schema: ISchema = {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
title: '编辑',
|
||||
'x-component': 'Menu.Action',
|
||||
'x-component': 'Action',
|
||||
'x-component-props': {
|
||||
type: 'link',
|
||||
},
|
||||
'x-action-type': 'update',
|
||||
properties: {
|
||||
[uid()]: {
|
||||
@ -444,10 +454,11 @@ const schema: ISchema = {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
title: '删除',
|
||||
'x-component': 'Menu.Action',
|
||||
'x-component': 'Action',
|
||||
'x-designable-bar': 'Table.Action.DesignableBar',
|
||||
'x-action-type': 'destroy',
|
||||
'x-component-props': {
|
||||
type: 'link',
|
||||
useAction: '{{ Table.useTableDestroyAction }}',
|
||||
},
|
||||
},
|
||||
@ -457,32 +468,6 @@ const schema: ISchema = {
|
||||
},
|
||||
},
|
||||
},
|
||||
column1: {
|
||||
type: 'void',
|
||||
title: '权限名称',
|
||||
'x-component': 'Table.Column',
|
||||
properties: {
|
||||
title: {
|
||||
type: 'string',
|
||||
'x-component': 'Input',
|
||||
'x-read-pretty': true,
|
||||
},
|
||||
},
|
||||
},
|
||||
column2: {
|
||||
type: 'void',
|
||||
title: '权限标识',
|
||||
'x-component': 'Table.Column',
|
||||
properties: {
|
||||
name: {
|
||||
type: 'string',
|
||||
'x-component': 'Input',
|
||||
'x-read-pretty': true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -196,7 +196,7 @@ function generateCardItemSchema(component) {
|
||||
type: 'void',
|
||||
title: '新增数据',
|
||||
'x-decorator': 'Form',
|
||||
'x-component': 'Action.Modal',
|
||||
'x-component': 'Action.Drawer',
|
||||
'x-component-props': {
|
||||
useOkAction: '{{ Table.useTableCreateAction }}',
|
||||
},
|
||||
@ -217,52 +217,32 @@ function generateCardItemSchema(component) {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
title: '操作',
|
||||
'x-component': 'Table.Operation',
|
||||
'x-component-props': {
|
||||
className: 'nb-table-operation',
|
||||
},
|
||||
'x-component': 'Table.Column',
|
||||
'x-component-props': {},
|
||||
'x-designable-bar': 'Table.Operation.DesignableBar',
|
||||
properties: {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
'x-component': 'Action',
|
||||
'x-component': 'Action.Group',
|
||||
'x-component-props': {
|
||||
icon: 'EllipsisOutlined',
|
||||
type: 'link',
|
||||
},
|
||||
properties: {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
'x-component': 'Action.Dropdown',
|
||||
'x-component-props': {},
|
||||
properties: {
|
||||
// [uid()]: {
|
||||
// type: 'void',
|
||||
// title: '操作 1',
|
||||
// 'x-component': 'Menu.Action',
|
||||
// 'x-component-props': {
|
||||
// style: {
|
||||
// minWidth: 150,
|
||||
// },
|
||||
// disabled: true,
|
||||
// },
|
||||
// },
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
name: 'action1',
|
||||
title: '查看',
|
||||
'x-component': 'Menu.Action',
|
||||
'x-component': 'Action',
|
||||
'x-component-props': {
|
||||
style: {
|
||||
minWidth: 150,
|
||||
},
|
||||
type: 'link',
|
||||
},
|
||||
'x-designable-bar': 'Table.Action.DesignableBar',
|
||||
'x-action-type': 'view',
|
||||
properties: {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
title: '查看',
|
||||
'x-component': 'Action.Modal',
|
||||
title: '查看数据',
|
||||
'x-component': 'Action.Drawer',
|
||||
'x-component-props': {
|
||||
bodyStyle: {
|
||||
background: '#f0f2f5',
|
||||
@ -278,8 +258,7 @@ function generateCardItemSchema(component) {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
title: '详情',
|
||||
'x-designable-bar':
|
||||
'Tabs.TabPane.DesignableBar',
|
||||
'x-designable-bar': 'Tabs.TabPane.DesignableBar',
|
||||
'x-component': 'Tabs.TabPane',
|
||||
'x-component-props': {},
|
||||
properties: {
|
||||
@ -301,7 +280,10 @@ function generateCardItemSchema(component) {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
title: '编辑',
|
||||
'x-component': 'Menu.Action',
|
||||
'x-component': 'Action',
|
||||
'x-component-props': {
|
||||
type: 'link',
|
||||
},
|
||||
'x-designable-bar': 'Table.Action.DesignableBar',
|
||||
'x-action-type': 'update',
|
||||
properties: {
|
||||
@ -313,7 +295,7 @@ function generateCardItemSchema(component) {
|
||||
useResource: '{{ Table.useResource }}',
|
||||
useValues: '{{ Table.useTableRowRecord }}',
|
||||
},
|
||||
'x-component': 'Action.Modal',
|
||||
'x-component': 'Action.Drawer',
|
||||
'x-component-props': {
|
||||
useOkAction: '{{ Table.useTableUpdateAction }}',
|
||||
},
|
||||
@ -332,10 +314,11 @@ function generateCardItemSchema(component) {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
title: '删除',
|
||||
'x-component': 'Menu.Action',
|
||||
'x-component': 'Action',
|
||||
'x-designable-bar': 'Table.Action.DesignableBar',
|
||||
'x-action-type': 'destroy',
|
||||
'x-component-props': {
|
||||
type: 'link',
|
||||
useAction: '{{ Table.useTableDestroyAction }}',
|
||||
},
|
||||
},
|
||||
@ -345,8 +328,6 @@ function generateCardItemSchema(component) {
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Form: {
|
||||
type: 'void',
|
||||
name: uid(),
|
||||
@ -471,34 +452,81 @@ function generateCardItemSchema(component) {
|
||||
},
|
||||
},
|
||||
},
|
||||
column1: {
|
||||
type: 'void',
|
||||
title: '操作时间',
|
||||
'x-component': 'Table.Column',
|
||||
properties: {
|
||||
created_at: {
|
||||
type: 'string',
|
||||
'x-component': 'DatePicker',
|
||||
'x-read-pretty': true,
|
||||
'x-component-props': {
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
column2: {
|
||||
type: 'void',
|
||||
title: '操作用户',
|
||||
'x-component': 'Table.Column',
|
||||
properties: {
|
||||
'user.nickname': {
|
||||
type: 'string',
|
||||
'x-component': 'Input',
|
||||
'x-read-pretty': true,
|
||||
},
|
||||
},
|
||||
},
|
||||
column3: {
|
||||
type: 'void',
|
||||
title: '所属数据表',
|
||||
'x-component': 'Table.Column',
|
||||
properties: {
|
||||
'collection.title': {
|
||||
type: 'string',
|
||||
'x-component': 'Input',
|
||||
'x-read-pretty': true,
|
||||
},
|
||||
},
|
||||
},
|
||||
column4: {
|
||||
type: 'void',
|
||||
title: '操作类型',
|
||||
'x-component': 'Table.Column',
|
||||
properties: {
|
||||
type: {
|
||||
type: 'string',
|
||||
'x-component': 'Select',
|
||||
'x-read-pretty': true,
|
||||
enum: [
|
||||
{ label: '新增', value: 'create', color: 'green' },
|
||||
{ label: '更新', value: 'update', color: 'blue' },
|
||||
{ label: '删除', value: 'destroy', color: 'red' },
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
title: '操作',
|
||||
'x-component': 'Table.Operation',
|
||||
'x-component': 'Table.Column',
|
||||
'x-component-props': {
|
||||
className: 'nb-table-operation',
|
||||
width: 60,
|
||||
align: 'center',
|
||||
},
|
||||
properties: {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
'x-component': 'Action',
|
||||
'x-component-props': {
|
||||
icon: 'EllipsisOutlined',
|
||||
},
|
||||
properties: {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
'x-component': 'Action.Dropdown',
|
||||
'x-component-props': {},
|
||||
properties: {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
name: 'action1',
|
||||
title: '查看',
|
||||
'x-component': 'Menu.Action',
|
||||
'x-component': 'Action',
|
||||
'x-component-props': {
|
||||
type: 'link',
|
||||
style: {
|
||||
minWidth: 150,
|
||||
padding: '0',
|
||||
height: 'auto',
|
||||
},
|
||||
},
|
||||
'x-action-type': 'view',
|
||||
@ -509,8 +537,7 @@ function generateCardItemSchema(component) {
|
||||
'x-read-pretty': true,
|
||||
'x-decorator': 'Form',
|
||||
'x-decorator-props': {
|
||||
useResource:
|
||||
'{{ Table.useActionLogDetailsResource }}',
|
||||
useResource: '{{ Table.useActionLogDetailsResource }}',
|
||||
},
|
||||
'x-component': 'Action.Drawer',
|
||||
'x-component-props': {
|
||||
@ -642,66 +669,6 @@ function generateCardItemSchema(component) {
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
column1: {
|
||||
type: 'void',
|
||||
title: '操作时间',
|
||||
'x-component': 'Table.Column',
|
||||
properties: {
|
||||
created_at: {
|
||||
type: 'string',
|
||||
'x-component': 'DatePicker',
|
||||
'x-read-pretty': true,
|
||||
'x-component-props': {
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
column2: {
|
||||
type: 'void',
|
||||
title: '操作用户',
|
||||
'x-component': 'Table.Column',
|
||||
properties: {
|
||||
'user.nickname': {
|
||||
type: 'string',
|
||||
'x-component': 'Input',
|
||||
'x-read-pretty': true,
|
||||
},
|
||||
},
|
||||
},
|
||||
column3: {
|
||||
type: 'void',
|
||||
title: '所属数据表',
|
||||
'x-component': 'Table.Column',
|
||||
properties: {
|
||||
'collection.title': {
|
||||
type: 'string',
|
||||
'x-component': 'Input',
|
||||
'x-read-pretty': true,
|
||||
},
|
||||
},
|
||||
},
|
||||
column4: {
|
||||
type: 'void',
|
||||
title: '操作类型',
|
||||
'x-component': 'Table.Column',
|
||||
properties: {
|
||||
type: {
|
||||
type: 'string',
|
||||
'x-component': 'Select',
|
||||
'x-read-pretty': true,
|
||||
enum: [
|
||||
{ label: '新增', value: 'create', color: 'green' },
|
||||
{ label: '更新', value: 'update', color: 'blue' },
|
||||
{ label: '删除', value: 'destroy', color: 'red' },
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
return defaults[component];
|
||||
}
|
||||
@ -935,7 +902,11 @@ AddNew.CardItem = observer((props: any) => {
|
||||
{ghost ? (
|
||||
<PlusOutlined />
|
||||
) : (
|
||||
<Button type={'dashed'} className={'designable-btn designable-btn-dash'} icon={<PlusOutlined />}>
|
||||
<Button
|
||||
type={'dashed'}
|
||||
className={'designable-btn designable-btn-dash'}
|
||||
icon={<PlusOutlined />}
|
||||
>
|
||||
新增区块
|
||||
</Button>
|
||||
)}
|
||||
@ -1122,7 +1093,11 @@ AddNew.FormItem = observer((props: any) => {
|
||||
{ghost ? (
|
||||
<PlusOutlined />
|
||||
) : (
|
||||
<Button type={'dashed'} className={'designable-btn designable-btn-dash'} icon={<SettingOutlined />}>
|
||||
<Button
|
||||
type={'dashed'}
|
||||
className={'designable-btn designable-btn-dash'}
|
||||
icon={<SettingOutlined />}
|
||||
>
|
||||
配置字段
|
||||
</Button>
|
||||
)}
|
||||
@ -1326,7 +1301,12 @@ AddNew.PaneItem = observer((props: any) => {
|
||||
{ghost ? (
|
||||
<PlusOutlined />
|
||||
) : (
|
||||
<Button block className={'designable-btn designable-btn-dash'} type={'dashed'} icon={<PlusOutlined />}>
|
||||
<Button
|
||||
block
|
||||
className={'designable-btn designable-btn-dash'}
|
||||
type={'dashed'}
|
||||
icon={<PlusOutlined />}
|
||||
>
|
||||
新增区块
|
||||
</Button>
|
||||
)}
|
||||
|
@ -370,7 +370,7 @@ const useTableColumns = () => {
|
||||
|
||||
const { getField } = useCollectionContext();
|
||||
|
||||
const operation = useTableOperation();
|
||||
// const operation = useTableOperation();
|
||||
|
||||
const columnSchemas = schema.reduceProperties((columns, current) => {
|
||||
if (isColumn(current)) {
|
||||
@ -379,7 +379,7 @@ const useTableColumns = () => {
|
||||
return [...columns];
|
||||
}, []);
|
||||
|
||||
const columns: any[] = [operation].concat(
|
||||
const columns: any[] = [].concat(
|
||||
columnSchemas.map((column: Schema) => {
|
||||
const columnProps = column['x-component-props'] || {};
|
||||
const collectionField = getField(columnProps.fieldName);
|
||||
@ -905,7 +905,7 @@ function generateActionSchema(type) {
|
||||
type: 'void',
|
||||
title: '新增数据',
|
||||
'x-decorator': 'Form',
|
||||
'x-component': 'Action.Modal',
|
||||
'x-component': 'Action.Drawer',
|
||||
'x-component-props': {
|
||||
useOkAction: '{{ Table.useTableCreateAction }}',
|
||||
},
|
||||
@ -951,14 +951,17 @@ function generateMenuActionSchema(type) {
|
||||
name: uid(),
|
||||
type: 'void',
|
||||
title: '查看',
|
||||
'x-component': 'Menu.Action',
|
||||
'x-component': 'Action',
|
||||
'x-component-props': {
|
||||
type: 'link',
|
||||
},
|
||||
'x-designable-bar': 'Table.Action.DesignableBar',
|
||||
'x-action-type': 'view',
|
||||
properties: {
|
||||
[uid()]: {
|
||||
type: 'void',
|
||||
title: '查看数据',
|
||||
'x-component': 'Action.Modal',
|
||||
'x-component': 'Action.Drawer',
|
||||
'x-component-props': {
|
||||
bodyStyle: {
|
||||
background: '#f0f2f5',
|
||||
@ -998,7 +1001,10 @@ function generateMenuActionSchema(type) {
|
||||
name: uid(),
|
||||
type: 'void',
|
||||
title: '编辑',
|
||||
'x-component': 'Menu.Action',
|
||||
'x-component': 'Action',
|
||||
'x-component-props': {
|
||||
type: 'link',
|
||||
},
|
||||
'x-designable-bar': 'Table.Action.DesignableBar',
|
||||
'x-action-type': 'update',
|
||||
properties: {
|
||||
@ -1010,7 +1016,7 @@ function generateMenuActionSchema(type) {
|
||||
useResource: '{{ Table.useResource }}',
|
||||
useValues: '{{ Table.useTableRowRecord }}',
|
||||
},
|
||||
'x-component': 'Action.Modal',
|
||||
'x-component': 'Action.Drawer',
|
||||
'x-component-props': {
|
||||
useOkAction: '{{ Table.useTableUpdateAction }}',
|
||||
},
|
||||
@ -1031,11 +1037,12 @@ function generateMenuActionSchema(type) {
|
||||
name: uid(),
|
||||
type: 'void',
|
||||
title: '删除',
|
||||
'x-component': 'Menu.Action',
|
||||
'x-component': 'Action',
|
||||
'x-designable-bar': 'Table.Action.DesignableBar',
|
||||
'x-action-type': 'destroy',
|
||||
'x-component-props': {
|
||||
useAction: '{{ Table.useTableDestroyAction }}',
|
||||
type: 'link',
|
||||
},
|
||||
},
|
||||
};
|
||||
@ -1611,15 +1618,12 @@ Table.Operation.Cell = observer((props: any) => {
|
||||
);
|
||||
});
|
||||
|
||||
Table.Operation.DesignableBar = (props) => {
|
||||
const { designable, schema, remove, refresh, appendChild } = useDesignable(
|
||||
props.path,
|
||||
);
|
||||
Table.Operation.DesignableBar = () => {
|
||||
const { schema: columnSchema } = useDesignable();
|
||||
const groupSchema = Object.values(columnSchema.properties || {}).shift();
|
||||
const groupPath = getSchemaPath(groupSchema);
|
||||
const { schema, remove, refresh, appendChild } = useDesignable(groupPath);
|
||||
const [visible, setVisible] = useState(false);
|
||||
if (!designable || !schema?.parent?.parent['x-designable-bar']) {
|
||||
return null;
|
||||
}
|
||||
console.log('Table.Operation.DesignableBar', schema?.parent?.parent);
|
||||
const map = new Map();
|
||||
schema.mapProperties((s) => {
|
||||
if (!s['x-action-type']) {
|
||||
@ -1627,6 +1631,7 @@ Table.Operation.DesignableBar = (props) => {
|
||||
}
|
||||
map.set(s['x-action-type'], s.name);
|
||||
});
|
||||
const path = getSchemaPath(schema);
|
||||
return (
|
||||
<div className={cls('designable-bar', { active: visible })}>
|
||||
<span
|
||||
@ -1661,10 +1666,7 @@ Table.Operation.DesignableBar = (props) => {
|
||||
const data = appendChild(s);
|
||||
await createSchema(data);
|
||||
} else if (map.get(item.name)) {
|
||||
const removed = remove([
|
||||
...props.path,
|
||||
map.get(item.name),
|
||||
]);
|
||||
const removed = remove([...path, map.get(item.name)]);
|
||||
await removeSchema(removed);
|
||||
}
|
||||
}}
|
||||
@ -1672,7 +1674,7 @@ Table.Operation.DesignableBar = (props) => {
|
||||
))}
|
||||
</Menu.ItemGroup>
|
||||
<Menu.Divider />
|
||||
<Menu.SubMenu title={'自定义'}>
|
||||
<Menu.SubMenu disabled title={'自定义'}>
|
||||
<Menu.Item style={{ minWidth: 120 }}>函数操作</Menu.Item>
|
||||
<Menu.Item>弹窗表单</Menu.Item>
|
||||
<Menu.Item>复杂弹窗</Menu.Item>
|
||||
@ -1694,9 +1696,11 @@ Table.Action.DesignableBar = () => {
|
||||
const { schema, remove, refresh, insertAfter } = useDesignable();
|
||||
const [visible, setVisible] = useState(false);
|
||||
const isPopup = Object.keys(schema.properties || {}).length > 0;
|
||||
const popupSchema = Object.values(schema.properties || {}).shift();
|
||||
const inActionBar = schema.parent['x-component'] === 'Table.ActionBar';
|
||||
const displayed = useDisplayedMapContext();
|
||||
const field = useField();
|
||||
const popupComponent = popupSchema?.['x-component'] || 'Action.Drawer';
|
||||
return (
|
||||
<div className={cls('designable-bar', { active: visible })}>
|
||||
<span
|
||||
@ -1764,7 +1768,7 @@ Table.Action.DesignableBar = () => {
|
||||
<Select
|
||||
bordered={false}
|
||||
size={'small'}
|
||||
defaultValue={'Action.Modal'}
|
||||
defaultValue={popupComponent}
|
||||
onChange={(value) => {
|
||||
const s = Object.values(schema.properties).shift();
|
||||
s['x-component'] = value;
|
||||
|
Loading…
Reference in New Issue
Block a user