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 {
name: 'actions',
title: '操作配置',
internal: true,
draggable: true,
model: 'ActionModel',
developerMode: true,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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