feat: add internal parameter to collection options

This commit is contained in:
chenos 2020-12-11 10:31:00 +08:00
parent f12c619603
commit 880737c5c8
10 changed files with 24 additions and 7 deletions

View File

@ -3,6 +3,7 @@ import { TableOptions } from '@nocobase/database';
export default { export default {
name: 'actions', name: 'actions',
title: '操作配置', title: '操作配置',
internal: true,
draggable: true, draggable: true,
model: 'ActionModel', model: 'ActionModel',
developerMode: true, developerMode: true,

View File

@ -3,6 +3,7 @@ import { TableOptions } from '@nocobase/database';
export default { export default {
name: 'collections', name: 'collections',
title: '数据表配置', title: '数据表配置',
internal: true,
sortable: true, sortable: true,
draggable: true, draggable: true,
model: 'CollectionModel', model: 'CollectionModel',
@ -160,6 +161,17 @@ export default {
type: 'hidden', type: 'hidden',
}, },
}, },
{
interface: 'boolean',
type: 'boolean',
name: 'internal',
title: '系统内置',
defaultValue: false,
developerMode: true,
component: {
type: 'boolean',
},
},
{ {
interface: 'linkTo', interface: 'linkTo',
type: 'hasMany', type: 'hasMany',

View File

@ -4,6 +4,7 @@ import { options } from '../interfaces';
export default { export default {
name: 'fields', name: 'fields',
title: '字段配置', title: '字段配置',
internal: true,
draggable: true, draggable: true,
model: 'FieldModel', model: 'FieldModel',
developerMode: true, developerMode: true,

View File

@ -3,6 +3,7 @@ import { TableOptions } from '@nocobase/database';
export default { export default {
name: 'tabs', name: 'tabs',
title: '标签配置', title: '标签配置',
internal: true,
sortable: true, sortable: true,
model: 'TabModel', model: 'TabModel',
developerMode: true, developerMode: true,

View File

@ -3,6 +3,7 @@ import { TableOptions } from '@nocobase/database';
export default { export default {
name: 'views', name: 'views',
title: '视图配置', title: '视图配置',
internal: true,
sortable: true, sortable: true,
model: 'ViewModel', model: 'ViewModel',
developerMode: true, developerMode: true,

View File

@ -440,7 +440,6 @@ export const sort = {
interface: 'sort', interface: 'sort',
type: 'integer', type: 'integer',
required: true, required: true,
developerMode: true,
component: { component: {
type: 'sort', type: 'sort',
showInTable: true, showInTable: true,
@ -453,7 +452,6 @@ export const password = {
options: { options: {
interface: 'password', interface: 'password',
type: 'password', type: 'password',
developerMode: true,
hidden: true, // hidden 用来控制 api 不输出这个字段,但是可能这个字段显示在表单里 showInForm hidden: true, // hidden 用来控制 api 不输出这个字段,但是可能这个字段显示在表单里 showInForm
component: { component: {
type: 'password', type: 'password',

View File

@ -3,6 +3,7 @@ import { TableOptions } from '@nocobase/database';
export default { export default {
name: 'attachments', name: 'attachments',
title: '文件管理器', title: '文件管理器',
internal: true,
fields: [ fields: [
{ {
type: 'string', type: 'string',

View File

@ -4,6 +4,7 @@ export default {
name: 'pages', name: 'pages',
title: '页面配置', title: '页面配置',
model: 'BaseModel', model: 'BaseModel',
internal: true,
developerMode: true, developerMode: true,
fields: [ fields: [
{ {

View File

@ -22,9 +22,9 @@ export default async function (options = {}) {
const [Collection, Page] = database.getModels(['collections', 'pages']); const [Collection, Page] = database.getModels(['collections', 'pages']);
async function createCollectionPage(model) { async function createCollectionPage(model) {
// if (!model.get('showInDataMenu')) { if (model.get('internal')) {
// return; return;
// } }
const parent = await Page.findOne({ const parent = await Page.findOne({
where: { where: {
path: '/collections', path: '/collections',

View File

@ -4,6 +4,7 @@ export default {
name: 'users', name: 'users',
title: '用户', title: '用户',
developerMode: true, developerMode: true,
internal: true,
fields: [ fields: [
{ {
interface: 'string', interface: 'string',
@ -55,14 +56,14 @@ export default {
}, },
}, },
{ {
interface: 'password', interface: 'string',
type: 'string', type: 'string',
name: 'token', name: 'token',
title: 'Token', title: 'Token',
unique: true, unique: true,
hidden: true, hidden: true,
component: { component: {
type: 'hidden', type: 'string',
}, },
}, },
], ],