import { TableOptions } from '@nocobase/database'; export default { name: 'views', title: '视图配置', internal: true, sortable: true, model: 'ViewModel', developerMode: true, fields: [ { interface: 'sort', type: 'sort', name: 'sort', scope: ['collection'], title: '排序', component: { type: 'sort', className: 'drag-visible', width: 60, showInTable: true, }, }, { interface: 'string', type: 'string', name: 'title', title: '视图名称', required: true, component: { type: 'string', className: 'drag-visible', showInTable: true, showInDetail: true, showInForm: true, }, }, { interface: 'string', type: 'string', name: 'name', title: '标识', component: { type: 'string', showInTable: true, showInDetail: true, showInForm: true, }, }, { interface: 'radio', type: 'string', name: 'type', title: '视图类型', required: true, dataSource: [ { label: '表格', value: 'table' }, // { label: '表单', value: 'form' }, { label: '看板', value: 'kanban', disabled: true }, { label: '日历', value: 'calendar', disabled: true }, { label: '地图', value: 'map', disabled: true }, ], component: { type: 'radio', showInTable: true, showInDetail: true, showInForm: true, default: 'table', "x-linkages": [ { "type": "value:visible", "target": "filter", "condition": "{{ $self.value !== 'form' }}" }, ], }, }, { interface: 'json', type: 'json', name: 'filter', title: '筛选数据', developerMode: false, mode: 'replace', defaultValue: {}, component: { type: 'filter', showInForm: true, }, }, { interface: 'select', type: 'string', name: 'template', title: '模板', required: true, dataSource: [ // { label: '表单', value: 'DrawerForm' }, { label: '常规表格', value: 'Table' }, { label: '简易表格', value: 'SimpleTable' }, ], component: { type: 'string', default: 'Table', showInTable: true, showInDetail: true, showInForm: true, }, }, { interface: 'radio', type: 'virtual', name: 'defaultPerPage', title: '每页显示几行数据', defaultValue: 50, dataSource: [ {label: '20', value: 20}, {label: '50', value: 50}, {label: '100', value: 100}, ], component: { type: 'radio', showInForm: true, showInDetail: true, }, }, { interface: 'boolean', type: 'virtual', name: 'draggable', title: '支持拖拽数据排序', showInForm: true, showInDetail: true, component: { type: 'checkbox', showInForm: true, showInDetail: true, }, }, { interface: 'boolean', type: 'boolean', name: 'default', title: '默认视图', defaultValue: false, component: { type: 'checkbox', showInTable: true, showInDetail: true, showInForm: true, }, }, { interface: 'boolean', type: 'boolean', name: 'showInDataMenu', title: '作为数据表子菜单', defaultValue: false, component: { type: 'checkbox', showInTable: true, showInDetail: true, showInForm: true, }, }, { interface: 'boolean', type: 'boolean', name: 'developerMode', title: '开发者模式', defaultValue: false, component: { type: 'boolean', }, }, { interface: 'linkTo', type: 'belongsTo', name: 'collection', title: '所属数据表', target: 'collections', targetKey: 'name', component: { type: 'drawerSelect', }, }, { interface: 'json', type: 'json', name: 'options', title: '配置信息', defaultValue: {}, component: { type: 'hidden', }, }, // 以下暂不考虑 // { // type: 'belongsToMany', // name: 'fields', // component: { // type: 'drawerSelect', // }, // }, // { // type: 'belongsToMany', // name: 'actions', // component: { // type: 'drawerSelect', // }, // }, ], actions: [ { type: 'list', name: 'list', title: '查看', }, { type: 'create', name: 'create', title: '新增', viewName: 'form', }, { type: 'update', name: 'update', title: '编辑', viewName: 'form', }, { type: 'destroy', name: 'destroy', title: '删除', }, ], views: [ { type: 'form', name: 'form', title: '表单', template: 'DrawerForm', developerMode: true, }, { type: 'details', name: 'details', title: '详情', template: 'Details', actionNames: ['update'], developerMode: true, }, { type: 'table', name: 'simple', title: '简易模式', template: 'SimpleTable', default: true, actionNames: ['create', 'destroy'], detailsViewName: 'details', updateViewName: 'form', paginated: false, draggable: true, }, ], } as TableOptions;