fix: improve menu/view configuration

This commit is contained in:
chenos 2021-03-22 16:45:32 +08:00
parent e443857309
commit 55543fb46e
6 changed files with 156 additions and 37 deletions

View File

@ -28,7 +28,7 @@ export default function Table(props: SimpleTableProps) {
const { schema = {}, associatedKey, value, onChange, __parent } = props; const { schema = {}, associatedKey, value, onChange, __parent } = props;
console.log({props, associatedKey, schema, __parent}) console.log({props, associatedKey, schema, __parent})
const { collection_name, name } = schema; const { collection_name, name } = schema;
const viewName = `${collection_name}.${name}.table`; const viewName = `${collection_name}.${name}.${schema.viewName||'table'}`;
return ( return (
<> <>
<View <View

View File

@ -62,7 +62,7 @@ export default {
interface: 'string', interface: 'string',
type: 'string', type: 'string',
name: 'title', name: 'title',
title: '菜单名称', title: '菜单/页面名称',
required: true, required: true,
}, },
{ {
@ -320,7 +320,7 @@ export default {
}, },
], ],
// detailsOpenMode: 'drawer', // window // detailsOpenMode: 'drawer', // window
// details: ['permissions_form'], details: [],
sort: ['sort'], sort: ['sort'],
}, },
{ {

View File

@ -189,7 +189,7 @@ export default {
{ {
name: 'add', name: 'add',
type: 'add', type: 'add',
title: '新增', title: '选择',
transform: { transform: {
'data': 'view', 'data': 'view',
'data.title': 'title', 'data.title': 'title',
@ -205,7 +205,7 @@ export default {
{ {
name: 'destroy', name: 'destroy',
type: 'destroy', type: 'destroy',
title: '除', title: '除',
}, },
], ],
fields: [ fields: [

View File

@ -52,7 +52,7 @@ export default {
{ {
name: 'add', name: 'add',
type: 'add', type: 'add',
title: '新增', title: '选择',
transform: { transform: {
'data': 'view', 'data': 'view',
'data.title': 'title', 'data.title': 'title',
@ -69,7 +69,7 @@ export default {
{ {
name: 'destroy', name: 'destroy',
type: 'destroy', type: 'destroy',
title: '除', title: '除',
}, },
], ],
fields: [ fields: [

View File

@ -69,7 +69,7 @@ export default {
{ {
name: 'add', name: 'add',
type: 'add', type: 'add',
title: '新增', title: '选择',
transform: { transform: {
'data': 'field', 'data': 'field',
'data.title': 'title', 'data.title': 'title',
@ -79,7 +79,7 @@ export default {
{ {
name: 'destroy', name: 'destroy',
type: 'destroy', type: 'destroy',
title: '除', title: '除',
}, },
], ],
fields: [ fields: [
@ -95,6 +95,50 @@ export default {
type: 'form', type: 'form',
name: 'form', name: 'form',
title: '表单', title: '表单',
fields: [
'title',
'field',
'tooltip',
],
},
{
developerMode: true,
type: 'table',
name: 'tableForForm',
title: '全部数据',
labelField: 'title',
draggable: true,
actions: [
{
name: 'add',
type: 'add',
title: '选择',
transform: {
'data': 'field',
'data.title': 'title',
},
viewName: 'collections.fields.table',
},
{
name: 'destroy',
type: 'destroy',
title: '移除',
},
],
fields: [
'title',
'field',
'required',
],
detailsOpenMode: 'drawer', // window
details: ['formForForm'],
sort: ['id'],
},
{
developerMode: true,
type: 'form',
name: 'formForForm',
title: '表单',
fields: [ fields: [
'title', 'title',
'field', 'field',

View File

@ -51,6 +51,14 @@ export const form = {
// fields, // fields,
}, },
properties: { properties: {
info1: {
interface: 'description',
type: 'virtual',
title: '表单配置',
component: {
type: 'description',
},
},
fields: { fields: {
...fields, ...fields,
title: '显示在表单里的字段' title: '显示在表单里的字段'
@ -68,11 +76,27 @@ export const descriptions = {
// fields, // fields,
}, },
properties: { properties: {
actions, info1: {
interface: 'description',
type: 'virtual',
title: '详情配置',
component: {
type: 'description',
},
},
fields: { fields: {
...fields, ...fields,
title: '显示在详情里的字段' title: '显示在详情里的字段'
}, },
info2: {
interface: 'description',
type: 'virtual',
title: '操作按钮配置',
component: {
type: 'description',
},
},
actions,
}, },
linkages: { linkages: {
@ -93,27 +117,14 @@ export const table = {
// labelField, // labelField,
}, },
properties: { properties: {
// 数据配置 info1: {
filter: { interface: 'description',
interface: 'json',
type: 'virtual', type: 'virtual',
title: '只显示符合以下条件的数据', title: '表格配置',
mode: 'replace',
defaultValue: {},
component: { component: {
type: 'filter', type: 'description',
}, },
}, },
// sort: {
// interface: 'json',
// type: 'virtual',
// title: '默认排序',
// mode: 'replace',
// defaultValue: [],
// component: {
// type: 'string',
// },
// },
// 表格配置 // 表格配置
labelField: { labelField: {
interface: 'select', interface: 'select',
@ -153,9 +164,51 @@ export const table = {
type: 'virtual', type: 'virtual',
title: '表格里支持拖拽数据排序', title: '表格里支持拖拽数据排序',
}, },
// 操作配置 info2: {
interface: 'description',
type: 'virtual',
title: '数据配置',
component: {
type: 'description',
},
},
filter: {
interface: 'json',
type: 'virtual',
title: '只显示符合以下条件的数据',
mode: 'replace',
defaultValue: {},
component: {
type: 'filter',
},
},
// sort: {
// interface: 'json',
// type: 'virtual',
// title: '默认排序',
// mode: 'replace',
// defaultValue: [],
// component: {
// type: 'string',
// },
// },
info3: {
interface: 'description',
type: 'virtual',
title: '操作按钮配置',
component: {
type: 'description',
},
},
actions, actions,
// 详情配置 info4: {
interface: 'description',
type: 'virtual',
title: '单条数据页面配置',
component: {
type: 'description',
},
},
detailsOpenMode, detailsOpenMode,
details, details,
}, },
@ -174,15 +227,12 @@ export const calendar = {
// details, // details,
}, },
properties: { properties: {
// 数据配置 info1: {
filter: { interface: 'description',
interface: 'json',
type: 'virtual', type: 'virtual',
title: '只显示符合以下条件的数据', title: '日历配置',
mode: 'replace',
defaultValue: {},
component: { component: {
type: 'filter', type: 'description',
}, },
}, },
// 日历配置 // 日历配置
@ -234,7 +284,32 @@ export const calendar = {
}, },
}, },
}, },
// 详情配置 info2: {
interface: 'description',
type: 'virtual',
title: '数据配置',
component: {
type: 'description',
},
},
filter: {
interface: 'json',
type: 'virtual',
title: '只显示符合以下条件的数据',
mode: 'replace',
defaultValue: {},
component: {
type: 'filter',
},
},
info3: {
interface: 'description',
type: 'virtual',
title: '单条数据页面配置',
component: {
type: 'description',
},
},
detailsOpenMode, detailsOpenMode,
details, details,
}, },