From 235fbaebee4f24b3e0cc8b7fc9e76789c764b3bc Mon Sep 17 00:00:00 2001 From: baozhoutao Date: Fri, 11 Dec 2020 22:30:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=96=B0=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9A=84schema=E6=96=87=E4=BB=B6=20#1158?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - field.yml - button.yml - listview.yml - permission.yml - permissionset.yml - profile.yml --- .vscode/settings.json | 6 + .../.vscode/settings.json | 6 + packages/schemas/button/schema.json | 73 ++++ packages/schemas/field/schema.json | 405 ++++++++++++++++++ packages/schemas/listview/schema.json | 111 +++++ packages/schemas/permission/schema.json | 89 ++++ packages/schemas/permissionset/schema.json | 49 +++ packages/schemas/profile/schema.json | 62 +++ .../permissions/admin.permission.yml | 2 +- 9 files changed, 802 insertions(+), 1 deletion(-) create mode 100644 packages/schemas/button/schema.json create mode 100644 packages/schemas/field/schema.json create mode 100644 packages/schemas/listview/schema.json create mode 100644 packages/schemas/permission/schema.json create mode 100644 packages/schemas/permissionset/schema.json create mode 100644 packages/schemas/profile/schema.json diff --git a/.vscode/settings.json b/.vscode/settings.json index fb0f22c79b..7ab5ef8671 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,6 +11,12 @@ "yaml.schemas": { "./packages/schemas/app/schema.json": "/*.app.yml", "./packages/schemas/object/schema.json": "/*.object.yml", + "./packages/schemas/field/schema.json": "/*.field.yml", + "./packages/schemas/button/schema.json": "/*.button.yml", + "./packages/schemas/listview/schema.json": "/*.listview.yml", + "./packages/schemas/permission/schema.json": "/*.permission.yml", + "./packages/schemas/permissionset/schema.json": "/*.permissionset.yml", + "./packages/schemas/profile/schema.json": "/*.profile.yml", "./packages/schemas/dashboard/schema.json": "/*.dashboard.yml" } } \ No newline at end of file diff --git a/packages/project-template-empty/.vscode/settings.json b/packages/project-template-empty/.vscode/settings.json index bff5dae81e..530c83bfcd 100644 --- a/packages/project-template-empty/.vscode/settings.json +++ b/packages/project-template-empty/.vscode/settings.json @@ -6,6 +6,12 @@ "yaml.schemas": { "./node_modules/@steedos/schemas/app/schema.json": "/*.app.yml", "./node_modules/@steedos/schemas/object/schema.json": "/*.object.yml", + "./node_modules/@steedos/schemas/field/schema.json": "/*.field.yml", + "./node_modules/@steedos/schemas/button/schema.json": "/*.button.yml", + "./node_modules/@steedos/schemas/listview/schema.json": "/*.listview.yml", + "./node_modules/@steedos/schemas/permission/schema.json": "/*.permission.yml", + "./node_modules/@steedos/schemas/permissionset/schema.json": "/*.permissionset.yml", + "./node_modules/@steedos/schemas/profile/schema.json": "/*.profile.yml", "./node_modules/@steedos/schemas/dashboard/schema.json": "/*.dashboard.yml" } } \ No newline at end of file diff --git a/packages/schemas/button/schema.json b/packages/schemas/button/schema.json new file mode 100644 index 0000000000..3a94bfc448 --- /dev/null +++ b/packages/schemas/button/schema.json @@ -0,0 +1,73 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "name": "steedos-schema_object_field", + "type": "object", + "additionalProperties": false, + "oneOf": [ + { + "properties": { + "type": { + "enum": [ + "library" + ] + } + }, + "required": [ + "type", + "name" + ] + }, + { + "properties": { + "type": { + "not": { + "enum": [ + "library" + ] + } + } + } + } + ], + "properties": { + "name": { + "type": "string", + "description": "API 名称" + }, + "label": { + "type": "string", + "description": "按钮显示名称" + }, + "is_enable": { + "type": "boolean", + "description": "是否启用" + }, + "visible": { + "type": [ + "string", + "boolean" + ], + "description": "是否有效" + }, + "on": { + "type": "string", + "description": "显示位置, list: 只显示在列表右上角; record: 显示在记录查看页右上角,以及列表视图中每项的下拉菜单中; record_more: 显示在记录查看页右上角的“更多”下拉菜单中,以及列表视图中每项的下拉菜单中; list_item: 只显示在列表视图中每项的下拉菜单中; record_only: 只显示在记录查看页右上角;record_only_more: 只显示在记录查看页右上角的“更多”下拉菜单中", + "enum": [ + "list", + "record", + "record_more", + "list_item", + "record_only", + "record_only_more" + ] + }, + "todo": { + "type": "string", + "description": "执行的脚本" + }, + "sort": { + "type": "number", + "description": "显示顺序" + } + } +} \ No newline at end of file diff --git a/packages/schemas/field/schema.json b/packages/schemas/field/schema.json new file mode 100644 index 0000000000..fc949dcdb7 --- /dev/null +++ b/packages/schemas/field/schema.json @@ -0,0 +1,405 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "name": "steedos-schema_object_field", + "type": "object", + "additionalProperties": false, + "oneOf": [ + { + "properties": { + "type": { + "enum": [ + "library" + ] + } + }, + "required": [ + "type", + "name" + ] + }, + { + "properties": { + "type": { + "not": { + "enum": [ + "library" + ] + } + } + } + } + ], + "properties": { + "name": { + "type": "string", + "description": "字段名称" + }, + "label": { + "type": "string", + "description": "字段显示名称" + }, + "is_name": { + "type": "boolean", + "description": "将当前字段叫标记为name字段,用于选择数据时的显示名称" + }, + "column_name": { + "type": "string", + "description": "数据库字段名" + }, + "object": { + "type": "string", + "description": "字段所属对象" + }, + "type": { + "type": "string", + "description": "字段类型", + "anyOf": [ + { + "enum": [ + "text", + "textarea", + "html", + "select", + "boolean", + "toggle", + "date", + "datetime", + "number", + "currency", + "percent", + "password", + "lookup", + "master_detail", + "grid", + "url", + "email", + "avatar", + "location", + "image", + "object", + "[object]", + "[Object]", + "[grid]", + "[text]", + "selectCity", + "audio", + "filesize", + "file", + "code", + "autonumber", + "markdown", + "formula", + "summary" + ] + } + ] + }, + "sort_no": { + "type": "integer", + "description": "排序号, 默认值100" + }, + "group": { + "type": "string", + "description": "分组名称" + }, + "defaultValue": { + "type": [ + "string", + "boolean", + "array", + "integer" + ], + "description": "默认值" + }, + "allowedValues": { + "type": [ + "string", + "boolean", + "array" + ], + "description": "允许的值" + }, + "multiple": { + "type": "boolean", + "description": "支持多选" + }, + "required": { + "type": "boolean", + "description": "是否必填" + }, + "is_wide": { + "type": "boolean", + "description": "是否宽字段,如果为true,则在详细页面,一个字段占一行" + }, + "readonly": { + "type": "boolean", + "description": "是否只读" + }, + "hidden": { + "type": "boolean", + "description": "是否隐藏" + }, + "omit": { + "type": "boolean", + "description": "忽略此字段" + }, + "index": { + "type": "boolean", + "description": "创建索引" + }, + "searchable": { + "type": "boolean", + "description": "允许搜索" + }, + "sortable": { + "type": "boolean", + "description": "允许排序" + }, + "precision": { + "type": "integer", + "description": "数值类型字段的最大长度,默认值18" + }, + "scale": { + "type": "integer", + "description": "数值类型的小数位数,默认值2" + }, + "reference_to": { + "type": [ + "string", + "array" + ], + "description": "引用的对象" + }, + "reference_to_field": { + "type": "string", + "description": "引用的对象的字段,按照此字段去查找相关记录" + }, + "rows": { + "type": "integer", + "description": "多行文本默认行数" + }, + "firstOption": { + "type": "boolean" + }, + "options": { + "anyOf": [ + { + "items": { + "type": "string", + "pattern": "^[^:]+(:[^:]+)?(:[0-9a-fA-F]{6})?$" + }, + "type": "array", + "title": "One option per line. Three definition formats are supported. value, label:value, label:value:FFFFFF, the third format can set the color of each option, if supply as a string array." + }, + { + "items": { + "type": "object", + "required": ["label", "value"], + "additionalProperties": false, + "properties": { + "label" : { + "type": "string", + "title": "Options display name" + }, + "value" : { + "type": "string", + "title": "Options value saved as" + }, + "color" : { + "title": "Options color showed as background", + "anyOf": [{ + "type": "string", + "pattern": "^[0-9a-fA-F]{6}$" + }] + } + } + }, + "type": "array", + "title": "The label and value propertie is required if supply as a object array." + }, + { + "type": "string", + "title": "Only support a function string if supply as a string." + } + ], + "description": "字段选项" + }, + "description": { + "type": "string", + "description": "字段描述" + }, + "filterable": { + "type": "boolean", + "description": "过滤器默认字段" + }, + "inlineHelpText": { + "type": "string", + "description": "提示文本" + }, + "unique": { + "type": "boolean", + "description": "重复" + }, + "optionsFunction": { + "type": "string", + "description": "字段选项函数名称" + }, + "min": { + "type": ["integer", "string"], + "description": "最小长度。支持字符串,数字,金额,日期类型字段" + }, + "max": { + "type": ["integer", "string"], + "description": "最大长度。支持字符串,数字,金额,日期类型字段" + }, + "blackbox": { + "type": "boolean", + "description": "不校验字段类型" + }, + "disabled": { + "type": "boolean", + "description": "禁用" + }, + "reference_sort": { + "type": "object", + "description": "排序方式" + }, + "reference_limit": { + "type": "number", + "description": "一次最多显示数据" + }, + "is_company_only": { + "type": "boolean", + "description": "本公司" + }, + "is_company_limited": { + "type": ["boolean", "string"], + "description": "本公司" + }, + "system": { + "type": "string" + }, + "depend_on": { + "type": "array" + }, + "defaultIcon": { + "type": "string" + }, + "showIcon": { + "type": "boolean" + }, + "primary": { + "type": "boolean", + "description": "主键" + }, + "generated": { + "type": "boolean", + "description": "自增" + }, + "fieldDBType": { + "type": "string", + "description": "字段数据库类型" + }, + "collection": { + "type": "string", + "description": "对应对象名" + }, + "language": { + "type": "string", + "description": "模板名" + }, + "create": { + "type": "boolean", + "description": "关联时是否允许创建" + }, + "regEx": { + "type": "object", + "description": "正则表达式" + }, + "formula": { + "type": "string", + "description": "公式" + }, + "data_type": { + "type": "string", + "description": "数据类型", + "anyOf": [ + { + "enum": [ + "text", + "boolean", + "date", + "datetime", + "number", + "currency", + "percent" + ] + } + ] + }, + "summary_object": { + "type": "string", + "description": "要汇总的对象" + }, + "summary_type": { + "type": "string", + "description": "汇总类型", + "anyOf": [ + { + "enum": [ + "count", + "sum", + "min", + "max" + ] + } + ] + }, + "summary_field": { + "type": "string", + "description": "要聚合的字段" + }, + "summary_filters": { + "type": [ + "array", + "string" + ], + "description": "要汇总的子表记录的过滤条件" + }, + "formula_blank_value": { + "type": "string", + "description": "空白字段处理,zeroes表示将空白字段视为零,blanks表示将空白字段视为空白,默认为zeroes", + "anyOf": [ + { + "enum": [ + "zeroes", + "blanks" + ] + } + ] + }, + "filters": { + "type": [ + "array", + "string" + ], + "description": "过滤条件" + }, + "filtersFunction": { + "type": "string", + "description": "过滤条件函数名称" + }, + "sharing": { + "type": "string", + "description": "配置当用户对主表记录有何种权限时对本表记录可以增删改", + "enum": [ + "masterRead", + "masterWrite" + ] + }, + "relatedList": { + "type": "boolean", + "description": "用于表示是否在相关表的详细页面中作为子表显示" + } + } +} \ No newline at end of file diff --git a/packages/schemas/listview/schema.json b/packages/schemas/listview/schema.json new file mode 100644 index 0000000000..dde8e9e41a --- /dev/null +++ b/packages/schemas/listview/schema.json @@ -0,0 +1,111 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "name": "steedos-schema_object_field", + "type": "object", + "additionalProperties": false, + "oneOf": [ + { + "properties": { + "type": { + "enum": [ + "library" + ] + } + }, + "required": [ + "name", + "columns" + ] + }, + { + "properties": { + "type": { + "not": { + "enum": [ + "library" + ] + } + } + } + } + ], + "properties": { + "name": { + "type": "string", + "description": "API 名称" + }, + "label": { + "type": "string", + "description": "视图显示名称" + }, + "type": { + "type": "string", + "description": "列表显示类型,默认为grid", + "enum": [ + "grid", + "calendar" + ] + }, + "filter_scope": { + "type": "string", + "description": "范围", + "enum": [ + "space", + "mine", + "all" + ] + }, + "columns": { + "type": "array", + "description": "列表显示的字段" + }, + "mobile_columns": { + "type": "array", + "description": "手机模式下列表显示的字段" + }, + "extra_columns": { + "type": "array", + "description": "额外在列表显示的字段" + }, + "order": { + "type": "array", + "description": "排序" + }, + "filters": { + "type": [ + "array", + "string" + ], + "description": "过滤条件" + }, + "filter_fields": { + "type": "array", + "description": "过滤的字段" + }, + "sort": { + "type": "array", + "description": "排序" + }, + "options": { + "type": "object", + "description": "额外选项" + }, + "show_count": { + "type": "boolean", + "description": "显示条目数" + }, + "shared":{ + "type": "boolean", + "description": "是否共享" + }, + "scrolling_mode":{ + "type":"string", + "description": "滚动条样式", + "enum": [ + "standard", + "virtual", + "infinite" + ] + } + } +} \ No newline at end of file diff --git a/packages/schemas/permission/schema.json b/packages/schemas/permission/schema.json new file mode 100644 index 0000000000..5d187ee09a --- /dev/null +++ b/packages/schemas/permission/schema.json @@ -0,0 +1,89 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "name": "steedos-schema_object_field", + "type": "object", + "additionalProperties": false, + "oneOf": [ + { + "properties": { + "type": { + "enum": [ + "library" + ] + } + }, + "required": [ + "name" + ] + }, + { + "properties": { + "type": { + "not": { + "enum": [ + "library" + ] + } + } + } + } + ], + "properties": { + "allowRead": { + "type": "boolean", + "description": "允许查看" + }, + "allowCreate": { + "type": "boolean", + "description": "允许创建" + }, + "allowEdit": { + "type": "boolean", + "description": "允许修改" + }, + "allowDelete": { + "type": "boolean", + "description": "允许删除" + }, + "viewAllRecords": { + "type": "boolean", + "description": "查看所有记录" + }, + "modifyAllRecords": { + "type": "boolean", + "description": "修改所有记录" + }, + "viewCompanyRecords": { + "type": "boolean", + "description": "查看本分部" + }, + "modifyCompanyRecords": { + "type": "boolean", + "description": "修改本分部" + }, + "disabled_list_views": { + "type": "array", + "description": "禁用对象列表视图" + }, + "disabled_actions": { + "type": "array", + "description": "禁用操作按钮" + }, + "unreadable_fields": { + "type": "array", + "description": "不可见字段" + }, + "uneditable_fields": { + "type": "array", + "description": "不可编辑字段" + }, + "unrelated_objects": { + "type": "array", + "description": "禁用关联对象" + }, + "uneditable_related_list": { + "type": "array", + "description": "关联对象只读" + } + } +} \ No newline at end of file diff --git a/packages/schemas/permissionset/schema.json b/packages/schemas/permissionset/schema.json new file mode 100644 index 0000000000..b320893e66 --- /dev/null +++ b/packages/schemas/permissionset/schema.json @@ -0,0 +1,49 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "name": "steedos-schema_object_field", + "type": "object", + "additionalProperties": false, + "oneOf": [ + { + "properties": { + "type": { + "enum": [ + "library" + ] + } + }, + "required": [ + "name" + ] + }, + { + "properties": { + "type": { + "not": { + "enum": [ + "library" + ] + } + } + } + } + ], + "properties": { + "name": { + "type": "string", + "description": "API 名称" + }, + "label": { + "type": "string", + "description": "显示名称" + }, + "license": { + "type": "boolean", + "description": "许可证" + }, + "assigned_apps": { + "type": "array", + "description": "授权应用" + } + } +} \ No newline at end of file diff --git a/packages/schemas/profile/schema.json b/packages/schemas/profile/schema.json new file mode 100644 index 0000000000..215c660a88 --- /dev/null +++ b/packages/schemas/profile/schema.json @@ -0,0 +1,62 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "name": "steedos-schema_object_field", + "type": "object", + "additionalProperties": false, + "oneOf": [ + { + "properties": { + "type": { + "enum": [ + "library" + ] + } + }, + "required": [ + "name", + "license" + ] + }, + { + "properties": { + "type": { + "not": { + "enum": [ + "library" + ] + } + } + } + } + ], + "properties": { + "name": { + "type": "string", + "description": "API 名称" + }, + "label": { + "type": "string", + "description": "显示名称" + }, + "license": { + "type": "boolean", + "description": "许可证" + }, + "assigned_apps": { + "type": "array", + "description": "授权应用" + }, + "password_history": { + "type": "string", + "description": "强制密码历史。默认值3" + }, + "max_login_attempts": { + "type": "string", + "description": "最大无效登录尝试次数。默认值10" + }, + "lockout_interval": { + "type": "string", + "description": "锁定有效期间。默认值15" + } + } +} \ No newline at end of file diff --git a/packages/standard-objects/packages-app/main/default/objects/imported_package/permissions/admin.permission.yml b/packages/standard-objects/packages-app/main/default/objects/imported_package/permissions/admin.permission.yml index 87ad97b22a..58abada25d 100644 --- a/packages/standard-objects/packages-app/main/default/objects/imported_package/permissions/admin.permission.yml +++ b/packages/standard-objects/packages-app/main/default/objects/imported_package/permissions/admin.permission.yml @@ -5,4 +5,4 @@ allowRead: true modifyAllRecords: false modifyCompanyRecords: false viewAllRecords: true -viewCompanyRecords: false +viewCompanyRecords: false \ No newline at end of file