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;
console.log({props, associatedKey, schema, __parent})
const { collection_name, name } = schema;
const viewName = `${collection_name}.${name}.table`;
const viewName = `${collection_name}.${name}.${schema.viewName||'table'}`;
return (
<>
<View

View File

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

View File

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

View File

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

View File

@ -69,7 +69,7 @@ export default {
{
name: 'add',
type: 'add',
title: '新增',
title: '选择',
transform: {
'data': 'field',
'data.title': 'title',
@ -79,7 +79,7 @@ export default {
{
name: 'destroy',
type: 'destroy',
title: '除',
title: '除',
},
],
fields: [
@ -95,6 +95,50 @@ export default {
type: 'form',
name: 'form',
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: [
'title',
'field',

View File

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