diff --git a/schemas/action.json b/schemas/action.json new file mode 100644 index 00000000..68d035d9 --- /dev/null +++ b/schemas/action.json @@ -0,0 +1,465 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/action.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|type|label|block|icon|iconClassName|className|size|level|block|primary|tooltip|tooltipPlacement|actionType|api|dialog|drawer|link|url|target|reload|confirmText|copy|disabled|disabledOn|disabledTip|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "description": "指定为按钮", + "enum": [ + "button", + "submit", + "reset" + ], + "type": "string" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "AMis Action 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#action", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#/definitions/baseButton" + }, + { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#/definitions/baseAction" + } + ] + }, + "ajaxAction": { + "description": "当前 Action 为 ajax 类型,用来发送 ajax 请求。", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "actionType": { + "description": "当前 Action 为 ajax 类型,用来发送 ajax 请求。", + "enum": [ + "ajax" + ], + "type": "string" + }, + "api": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "当按钮为 ajax 类型时,用来配置 ajax 发送得目标地址" + }, + "confirmText": { + "description": "操作前的确认文字设置。", + "type": "string" + }, + "feedback": { + "$ref": "https://houtai.baidu.com/v2/schemas/dialog.json", + "description": "配置 action 结束后的反馈行为。通过配置此属性,可以自动弹出一个 dialog 继续操作。" + }, + "optimistic": { + "description": "是否启用乐观模式", + "type": "boolean" + }, + "reload": { + "description": "指定此次 Action 之后,需要刷新的组件名字。请填入目标组件的 name 值。", + "type": "string" + } + }, + "required": [ + "actionType", + "api" + ], + "type": "object" + }, + "baseAction": { + "if": { + "properties": { + "actionType": { + "const": "ajax" + } + } + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#/definitions/ajaxAction" + }, + "else": { + "if": { + "properties": { + "actionType": { + "const": "url" + } + } + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#/definitions/urlAction" + }, + "else": { + "if": { + "properties": { + "actionType": { + "const": "dialog" + } + } + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#/definitions/dialogAction" + }, + "else": { + "if": { + "properties": { + "actionType": { + "const": "drawer" + } + } + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#/definitions/drawerAction" + }, + "else": { + "if": { + "properties": { + "actionType": { + "const": "copy" + } + } + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#/definitions/copyAction" + }, + "else": { + "if": { + "properties": { + "actionType": { + "const": "reload" + } + } + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#/definitions/reloadAction" + }, + "else": { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#/definitions/otherAction" + } + } + } + } + } + } + }, + "baseButton": { + "properties": { + "block": { + "default": false, + "description": "是否独占一行 `display: block`", + "type": "boolean" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "disabled": { + "description": "是否为禁用状态。", + "type": "boolean" + }, + "disabledOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前表单项的禁用状态。" + }, + "hidden": { + "type": "boolean", + "description": "设置是否隐藏" + }, + "hiddenOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前表单项是否隐藏。" + }, + "icon": { + "description": "按钮图标,请查看 fontAwesome http://fontawesome.io/icons/", + "type": "string" + }, + "iconClassName": { + "type": "string", + "description": "icon 上面的 css 类名" + }, + "label": { + "description": "按钮名字", + "type": "string" + }, + "level": { + "description": "按钮级别", + "enum": [ + "info", + "success", + "warning", + "danger", + "link", + "primary" + ], + "type": "string" + }, + "primary": { + "default": false, + "description": "按钮是否为主按钮,影响样式。", + "type": "boolean" + }, + "size": { + "description": "按钮大小", + "enum": [ + "xs", + "sm", + "md", + "lg", + "" + ], + "type": "string" + }, + "tooltip": { + "description": "按钮提示文字,hover 时显示", + "type": "string" + }, + "tooltipPlacement": { + "default": "top", + "description": "按钮提示文字显示的位置", + "enum": [ + "left", + "top", + "right", + "bottom" + ], + "type": "string" + }, + "type": { + "description": "按钮类型", + "enum": [ + "button", + "submit", + "reset" + ], + "type": "string" + }, + "visible": { + "type": "boolean", + "description": "设置是否显示" + }, + "visibleOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前表单项是否显示" + } + }, + "type": "object" + }, + "otherAction": { + "properties": { + "actionType": { + "description": "Action 类型", + "enum": [ + "prev", + "next", + "cancel", + "close", + "submit", + "confirm", + "" + ], + "type": "string" + }, + "confirmText": { + "description": "操作前的确认文字设置。", + "type": "string" + }, + "target": { + "type": "string", + "description": "可以指定由目标来相应这个事件" + } + }, + "type": "object" + }, + "copyAction": { + "description": "当前 Action 为 copy 类型,用来复制内容到剪切板。", + "properties": { + "actionType": { + "description": "当前 Action 为 copy 类型,用来复制内容到剪切板。", + "enum": [ + "copy" + ], + "type": "string" + }, + "copy": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/tpl", + "description": "copy 到剪切板的内容" + } + }, + "required": [ + "actionType", + "copy" + ], + "type": "object" + }, + "dialogAction": { + "description": "当前 Action 为 dialog 类型,用来做弹窗操作。", + "properties": { + "actionType": { + "description": "当前 Action 为 dialog 类型,用来做弹窗操作。", + "enum": [ + "dialog" + ], + "type": "string" + }, + "dialog": { + "$ref": "https://houtai.baidu.com/v2/schemas/dialog.json#/definitions/common", + "description": "dialog的展示schema" + }, + "nextCondition": { + "description": "下一个的条件,写法类似于 disabledOn、visibleOn 等等,用来判断是否还有下一条数据,只有 crud 中才有用。", + "type": "string" + }, + "reload": { + "description": "指定此次 Action 之后,需要刷新的组件名字。请填入目标组件的 name 值。", + "type": "string" + } + }, + "required": [ + "actionType", + "dialog" + ], + "type": "object" + }, + "drawerAction": { + "description": "当前 Action 为 drawer 类型,用来做抽出式弹窗操作。", + "properties": { + "actionType": { + "description": "当前 Action 为 drawer 类型,用来做抽出式弹窗操作。", + "enum": [ + "drawer" + ], + "type": "string" + }, + "drawer": { + "$ref": "https://houtai.baidu.com/v2/schemas/drawer.json#/definitions/common", + "description": "drawer的展示schema" + }, + "nextCondition": { + "description": "下一个的条件,写法类似于 disabledOn、visibleOn 等等,用来判断是否还有下一条数据,只有 crud 中才有用。", + "type": "string" + }, + "reload": { + "description": "指定此次 Action 之后,需要刷新的组件名字。请填入目标组件的 name 值。", + "type": "string" + } + }, + "required": [ + "actionType", + "drawer" + ], + "type": "object" + }, + "linkAction": { + "description": "当前 Action 为 link 类型, 用来做站内跳转。", + "properties": { + "actionType": { + "description": "当前 Action 为 link 类型, 用来做站内跳转。", + "enum": [ + "link" + ], + "type": "string" + }, + "confirmText": { + "description": "操作前的确认文字设置。", + "type": "string" + }, + "link": { + "description": "站内地址,支持相对路径和绝对路径。同时还支持 `$varName` 或者 `${varName}` 取值。", + "type": "string" + } + }, + "required": [ + "actionType", + "link" + ], + "type": "object" + }, + "reloadAction": { + "description": "当前 Action 为 reload 类型,用来让目标组件刷新数据。", + "properties": { + "actionType": { + "description": "当前 Action 为 reload 类型,用来让目标组件刷新数据。", + "enum": [ + "reload" + ], + "type": "string" + }, + "confirmText": { + "description": "操作前的确认文字设置。", + "type": "string" + }, + "target": { + "description": "reload 的目标对象,用 name 来指定,支持用 . 来指定更详细的路径如: aform.acontrol", + "type": "string" + } + }, + "required": [ + "actionType", + "reload" + ], + "type": "object" + }, + "urlAction": { + "description": "当前 Action 为 url 类型,用来做站外跳转。", + "properties": { + "actionType": { + "description": "当前 Action 为 url 类型,用来做站外跳转。", + "enum": [ + "url" + ], + "type": "string" + }, + "blank": { + "default": true, + "description": "是否在新页面打开", + "type": "boolean" + }, + "confirmText": { + "description": "操作前的确认文字设置。", + "type": "string" + }, + "url": { + "description": "跳转地址", + "patten": "^https?://", + "type": "string" + } + }, + "required": [ + "actionType", + "url" + ], + "type": "object" + }, + "test": { + "properties": { + "type": { + "enum": [ + "button", + "submit", + "reset" + ] + } + } + } + }, + "description": "AMis Action 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#action", + "type": "object" +} \ No newline at end of file diff --git a/schemas/alert.json b/schemas/alert.json new file mode 100644 index 00000000..b66abcda --- /dev/null +++ b/schemas/alert.json @@ -0,0 +1,72 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/alert.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/alert.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|className|body|level|showCloseButton)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "alert", + "description": "指定为提示框类型", + "type": "string" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "AMis Wrapper 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers/Alert", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "body": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "description": "内容区域" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置外层 className" + }, + "level": { + "description": "提示类型", + "enum": [ + "info", + "success", + "warning", + "danger" + ] + }, + "showCloseButton": { + "description": "是否显示关闭按钮", + "type": "boolean" + } + } + }, + "test": { + "properties": { + "type": { + "const": "alert" + } + } + } + }, + "description": "AMis Alert 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers/Alert", + "type": "object" +} \ No newline at end of file diff --git a/schemas/audio.json b/schemas/audio.json new file mode 100644 index 00000000..62c4d5a9 --- /dev/null +++ b/schemas/audio.json @@ -0,0 +1,92 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/audio.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|type|className|name|inline|src|loop|autoPlay|rates|controls)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "audio", + "description": "指定为音频类型", + "type": "string" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "AMis Audio 渲染器,用来生成音频播放器", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "inline": { + "type": "boolean", + "description": "是否是内联模式" + }, + "src": { + "description": "视频播放地址, 支持 $ 取变量。", + "type": "string" + }, + "loop": { + "type": "boolean", + "description": "是否循环播放" + }, + "autoPlay": { + "type": "boolean", + "description": "是否自动播放" + }, + "rates": { + "type": "array", + "description": "配置可选播放倍速", + "items": { + "type": "number" + } + }, + "controls": { + "type": "array", + "description": "可以配置控制器", + "items": { + "type": "string", + "enum": [ + "rates", + "play", + "time", + "process", + "volume" + ] + } + } + } + }, + "test": { + "properties": { + "type": { + "const": "audio" + } + } + } + }, + "description": "AMis Audio 渲染器,用来生成视频播放器", + "id": "https://houtai.baidu.com/v2/schemas/audio.json#", + "type": "object" +} \ No newline at end of file diff --git a/schemas/button-group.json b/schemas/button-group.json new file mode 100644 index 00000000..082fafb9 --- /dev/null +++ b/schemas/button-group.json @@ -0,0 +1,92 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/button-group.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/button-group.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|btnClassName|buttons|className|size|disabled|disabledOn|hiddenOn|hidden|visible|visbileOn)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "button-group", + "description": "指定为提交按钮类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "test": { + "properties": { + "type": { + "const": "button-group" + } + } + }, + "common": { + "description": "AMis Button Group 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#buttongroup", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "btnClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "给 Button 配置 className。" + }, + "buttons": { + "description": "按钮集合", + "items": { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#" + }, + "type": "array" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "disabled": { + "description": "是否为禁用状态。", + "type": "boolean" + }, + "disabledOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前表单项的禁用状态。" + }, + "hiddenOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前表单项是否隐藏。" + }, + "visibleOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前表单项是否显示" + }, + "size": { + "description": "按钮大小", + "enum": [ + "xs", + "sm", + "md", + "lg" + ], + "type": "string" + } + }, + "type": "object" + } + }, + "description": "AMis Button Group 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#buttongroup", + "type": "object" +} \ No newline at end of file diff --git a/schemas/card.json b/schemas/card.json new file mode 100644 index 00000000..d1569df2 --- /dev/null +++ b/schemas/card.json @@ -0,0 +1,93 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/card.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/card.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|name|className|header|body|bodyClassName|actions)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "card", + "description": "指定为 card 类型", + "type": "string" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "AMis Card 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers/Card", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "header": { + "description": "头部内容设置", + "type": "object" + }, + "header": { + "properties": { + "className": { + "description": "类名", + "type": "string" + }, + "title": { + "description": "标题", + "type": "string" + }, + "subTitle": { + "description": "副标题", + "type": "string" + }, + "avatar": { + "description": "图片", + "type": "string" + }, + "avatarClassName": { + "description": "图片类名", + "type": "string" + }, + "highlight": { + "description": "是否点亮", + "type": "boolean" + } + }, + "type": "object" + }, + "actions": { + "description": "按钮", + "type": "array" + } + } + }, + "test": { + "properties": { + "type": { + "const": "card" + } + } + } + }, + "description": "AMis Card 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers/Card", + "type": "object" +} \ No newline at end of file diff --git a/schemas/cards.json b/schemas/cards.json new file mode 100644 index 00000000..18d155a4 --- /dev/null +++ b/schemas/cards.json @@ -0,0 +1,384 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/cards.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/cards.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|showHeader|showFooter|card|title|source|placeholder|className|headerClassName|footerClassName|itemClassName|)$": {} + }, + "properties": { + "$schema": { + "description": "绑定 JSON 格式说明,可忽略!", + "format": "uri", + "type": "string" + }, + "type": { + "const": "cards", + "description": "指定为 cards 类型", + "type": "string" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "body": { + "description": "内容容器", + "oneOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/cards.json#/definitions/field" + }, + { + "items": { + "oneOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/cards.json#/definitions/field" + }, + { + "description": "**不推荐使用数组,请用 hbox 包裹**", + "items": { + "$ref": "https://houtai.baidu.com/v2/schemas/cards.json#/definitions/field" + }, + "type": "array" + } + ] + }, + "type": "array" + } + ] + }, + "card": { + "type": "object", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "type": { + "const": "card", + "description": "指定为 card 渲染器" + }, + "actions": { + "items": { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#" + }, + "type": "array" + }, + "actionsCount": { + "description": "卡片一行最多能放按钮个数", + "type": "number" + }, + "avatarClassName": { + "description": "图片 CSS 类名", + "type": "string" + }, + "body": { + "$ref": "https://houtai.baidu.com/v2/schemas/cards.json#/definitions/body" + }, + "bodyClassName": { + "description": "内容区 CSS 类名", + "type": "string" + }, + "className": { + "description": "外层 CSS 类名", + "type": "string" + }, + "descClassName": { + "description": "描述 CSS 类名", + "type": "string" + }, + "header": { + "description": "头部内容", + "properties": { + "avatar": { + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/tpl", + "description": "头像,支持tpl" + }, + "desc": { + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/tpl", + "description": "描述,支持tpl" + }, + "descClassName": { + "description": "描述 CSS 类名", + "type": "string" + }, + "header": { + "description": "头部内容", + "properties": { + "avatar": { + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/tpl", + "description": "头像,支持tpl" + }, + "desc": { + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/tpl", + "description": "描述,支持tpl" + }, + "highlight": { + "description": "是否高亮表达式", + "type": "string" + }, + "subTitle": { + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/tpl", + "description": "副标题, 支持tpl" + }, + "title": { + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/tpl", + "description": "标题, 支持tpl" + } + }, + "type": "object" + }, + "higlight": { + "description": "是否高亮表达式", + "type": "string" + }, + "subTitle": { + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/tpl", + "description": "副标题, 支持tpl" + }, + "title": { + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/tpl", + "description": "标题, 支持tpl" + } + }, + "type": "object" + }, + "highlightClassName": { + "description": "高亮 CSS 类名", + "type": "string" + }, + "subTitleClassName": { + "description": "副标题 CSS 类名", + "type": "string" + }, + "titleClassName": { + "description": "标题 CSS 类名", + "type": "string" + } + } + }, + "common": { + "description": "AMis cards 渲染器格式说明。", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "card": { + "$ref": "https://houtai.baidu.com/v2/schemas/cards.json#/definitions/card", + "type": "object" + }, + "className": { + "description": "外层 CSS 类名", + "type": "string" + }, + "footerClassName": { + "description": "底部 CSS 类名", + "type": "string" + }, + "headerClassName": { + "description": "头部 CSS 类名", + "type": "string" + }, + "itemClassName": { + "default": "col-sm-4 col-md-3", + "description": "卡片 CSS 类名", + "type": "string" + }, + "placeholder": { + "default": "暂无数据", + "description": "无数据提示", + "type": "string" + }, + "showFooter": { + "default": true, + "description": "是否显示底部", + "type": "boolean" + }, + "showHeader": { + "default": true, + "description": "是否显示头部", + "type": "boolean" + }, + "source": { + "default": "${items}", + "description": "数据源: 绑定当前环境变量", + "type": "string" + }, + "title": { + "description": "标题", + "type": "string" + } + }, + "type": "object" + }, + "field": { + "allOf": [ + { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/image.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/image.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/date.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/date.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/status.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/status.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/mapping.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/mapping.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/progress.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/progress.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/switch.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/switch.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/hbox.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/hbox.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/grid.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/grid.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/json.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/json.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/list.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/list.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/operation.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/operation.json#/definitions/common" + }, + "else": { + "$ref": "https://houtai.baidu.com/v2/schemas/plain.json#/definitions/common" + } + } + } + } + } + } + } + } + } + } + } + } + }, + { + "properties": { + "label": { + "description": "字段名称", + "type": "string" + }, + "name": { + "description": "绑定字段名", + "type": "string" + }, + "popOver": { + "description": "配置查看详情功能", + "oneOf": [ + { + "type": "boolean" + }, + { + "properties": {}, + "type": "object" + } + ] + }, + "quickEdit": { + "description": "配置快速编辑功能", + "oneOf": [ + { + "type": "boolean" + }, + { + "properties": {}, + "type": "object" + } + ] + }, + "copyable": { + "description": "配置点击复制功能", + "oneOf": [ + { + "type": "boolean" + }, + { + "properties": {}, + "type": "object" + } + ] + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "cards" + } + } + } + }, + "description": "AMis cards 渲染器格式说明。", + "type": "object" +} \ No newline at end of file diff --git a/schemas/carousel.json b/schemas/carousel.json new file mode 100644 index 00000000..a065ade1 --- /dev/null +++ b/schemas/carousel.json @@ -0,0 +1,140 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/carousel.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|name|animation|auto|interval|duration|className|width|height|controlsTheme|controls|placeholder|options|visibleOn|visible|hidden|hiddenOn)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "carousel", + "description": "指定为轮播图类型", + "type": "string" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "AMis Video 渲染器,用来生成视频播放器", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "auto": { + "description": "是否自动播放", + "type": "boolean" + }, + "interval": { + "type": "number", + "description": "轮播间隔时间" + }, + "duration": { + "type": "number", + "description": "动画时长" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "width": { + + "description": "设置宽度", + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ] + }, + "height": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "设置高度" + }, + "controlsTheme": { + "type": "string", + "enum": ["light", "dark"] + }, + "placeholder": { + "type": "string", + "description": "占位" + }, + "controls": { + "description": "配置控件内容", + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "const": [ + "dots", + "arrows" + ] + } + }, + + { + "type": "string" + } + ] + }, + "animation": { + "type": "string", + "description": "动画类型", + "enum": [ + "fade", + "slide" + ] + }, + "itemSchema": { + "type": "object", + "description": "配置单条呈现模板" + }, + "name": { + "type": "string", + "description": "绑定变量" + }, + "options": { + "type": "array", + "description": "配置固定值", + "items": { + "type": "object" + } + } + } + }, + "test": { + "properties": { + "type": { + "const": "video" + } + } + } + }, + "description": "AMis 轮播渲染器", + "id": "https://houtai.baidu.com/v2/schemas/carousel.json#", + "type": "object" +} \ No newline at end of file diff --git a/schemas/chart.json b/schemas/chart.json new file mode 100644 index 00000000..fe899f14 --- /dev/null +++ b/schemas/chart.json @@ -0,0 +1,112 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/chart.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/chart.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|name|className|api|initFetch|initFetchOn|fetchOn|interval|style|config|width|height|messages)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "chart", + "description": "指定为 chart 类型", + "type": "string" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "AMis Chart 渲染器,采用echarts渲染,格式说明。https://baidu.github.io/amis/docs/renderers#chart", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "api": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "页面初始化的时候,可以设置一个 API 让其取拉取配置" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "config": { + "description": "配置echart的config", + "type": "object" + }, + "fetchOn": { + "default": true, + "description": "是否拉取?通过表达式来决定, 条件满足才会拉取", + "type": "string" + }, + "height": { + "description": "宽度设置" + }, + "initFetch": { + "default": true, + "description": "是否默认就拉取?", + "type": "boolean" + }, + "initFetchOn": { + "default": true, + "description": "是否默认就拉取?通过表达式来决定", + "type": "string" + }, + "interval": { + "default": 0, + "description": "刷新时间", + "type": "number" + }, + "messages": { + "additionalProperties": false, + "properties": { + "fetchFailed": { + "description": "用来配置当 api 拉取失败时提示的信息", + "type": "string" + }, + "fetchSuccess": { + "description": "用来配置当 api 拉取成功时提示的信息,当然不设置的话就不会提示。", + "type": "string" + } + }, + "type": "object" + }, + "name": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/name", + "description": "给当前组件设定一个名,方便其他组件引用。" + }, + "style": { + "description": "style样式", + "type": "object" + }, + "width": { + "description": "宽度设置" + } + } + }, + "test": { + "properties": { + "type": { + "const": "chart" + } + } + } + }, + "description": "AMis Chart 渲染器,采用echarts渲染,格式说明。https://baidu.github.io/amis/docs/renderers#chart", + "type": "object" +} \ No newline at end of file diff --git a/schemas/collapse.json b/schemas/collapse.json new file mode 100644 index 00000000..e7b3280b --- /dev/null +++ b/schemas/collapse.json @@ -0,0 +1,81 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/collapse.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/collapse.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|title|collapsable|collapsed|body|bodyClassName|className|headingClassName)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "collapse", + "description": "指定为折叠器类型", + "type": "string" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "AMis collapse 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#wrapper", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "body": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "description": "内容区域" + }, + "bodyClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置 Body 容器 className" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "default": "bg-white wrapper", + "description": "配置容器 className" + }, + "collapsable": { + "description": "是否可折叠", + "type": "boolean" + }, + "collapsed": { + "description": "默认是否折叠", + "type": "boolean" + }, + "headingClassName": { + "default": "font-thin b-b b-light text-lg p-b-xs", + "description": "标题 CSS 类名", + "type": "string" + }, + "title": { + "description": "标题", + "type": "string" + } + } + }, + "test": { + "properties": { + "type": { + "const": "collapse" + } + } + } + }, + "description": "AMis collapse 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#wrapper", + "type": "object" +} \ No newline at end of file diff --git a/schemas/container.json b/schemas/container.json new file mode 100644 index 00000000..6f5bc7b6 --- /dev/null +++ b/schemas/container.json @@ -0,0 +1,66 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/container.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/container.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|body|className)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "container", + "description": "指定为 container 类型", + "type": "string" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "body": { + "description": "集合", + "type": "array" + }, + "common": { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "body": { + "description": "内容", + "type": "object" + }, + "bodyClassName": { + "description": "body 类名", + "type": "string" + } + } + }, + "test": { + "properties": { + "type": { + "const": "container" + } + } + } + }, + "description": "AMis container 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers/Types#container", + "type": "object" +} \ No newline at end of file diff --git a/schemas/convert.js b/schemas/convert.js new file mode 100644 index 00000000..d602257f --- /dev/null +++ b/schemas/convert.js @@ -0,0 +1,196 @@ +// page SubRenderer 类型 +(function() { + const renderers = [ + 'https://houtai.baidu.com/v2/schemas/action.json#', + 'https://houtai.baidu.com/v2/schemas/button-group.json#', + 'https://houtai.baidu.com/v2/schemas/cards.json#', + 'https://houtai.baidu.com/v2/schemas/chart.json#', + 'https://houtai.baidu.com/v2/schemas/collapse.json#', + 'https://houtai.baidu.com/v2/schemas/divider.json#', + 'https://houtai.baidu.com/v2/schemas/crud.json#', + 'https://houtai.baidu.com/v2/schemas/date.json#', + // 'https://houtai.baidu.com/v2/schemas/dialog.json#', + // 'https://houtai.baidu.com/v2/schemas/drawer.json#', + 'https://houtai.baidu.com/v2/schemas/dropdown-button.json#', + 'https://houtai.baidu.com/v2/schemas/form.json#', + 'https://houtai.baidu.com/v2/schemas/grid.json#', + 'https://houtai.baidu.com/v2/schemas/hbox.json#', + 'https://houtai.baidu.com/v2/schemas/iframe.json#', + 'https://houtai.baidu.com/v2/schemas/image.json#', + 'https://houtai.baidu.com/v2/schemas/json.json#', + 'https://houtai.baidu.com/v2/schemas/list.json#', + 'https://houtai.baidu.com/v2/schemas/mapping.json#', + 'https://houtai.baidu.com/v2/schemas/nav.json#', + 'https://houtai.baidu.com/v2/schemas/operation.json#', + // 自己不能放在其他地方 'https://houtai.baidu.com/v2/schemas/page.json#', + 'https://houtai.baidu.com/v2/schemas/panel.json#', + 'https://houtai.baidu.com/v2/schemas/plain.json#', + 'https://houtai.baidu.com/v2/schemas/progress.json#', + 'https://houtai.baidu.com/v2/schemas/service.json#', + 'https://houtai.baidu.com/v2/schemas/status.json#', + 'https://houtai.baidu.com/v2/schemas/switch.json#', + 'https://houtai.baidu.com/v2/schemas/table.json#', + 'https://houtai.baidu.com/v2/schemas/tabs.json#', + 'https://houtai.baidu.com/v2/schemas/tasks.json#', + 'https://houtai.baidu.com/v2/schemas/tpl.json#', + 'https://houtai.baidu.com/v2/schemas/video.json#', + 'https://houtai.baidu.com/v2/schemas/wizard.json#', + 'https://houtai.baidu.com/v2/schemas/wrapper.json#', + 'https://houtai.baidu.com/v2/schemas/page.json#/definitions/customRenderer' + ]; + + const root = {}; + let last = renderers.pop(); + let current = root; + + while(renderers.length) { + const renderer = renderers.shift().replace(/#$/, ''); + + current.if = { + '$ref': `${renderer}#/definitions/test` + }; + + current.then = { + '$ref': `${renderer}#/definitions/common` + }; + + current = current.else = {}; + } + + current['$ref'] = last; + + console.log(JSON.stringify(root, null, 4)); +})(); + +// Cards 里面 field 类型 +(function() { + const renderers = [ + 'https://houtai.baidu.com/v2/schemas/tpl.json#', + 'https://houtai.baidu.com/v2/schemas/image.json#', + 'https://houtai.baidu.com/v2/schemas/date.json#', + 'https://houtai.baidu.com/v2/schemas/status.json#', + 'https://houtai.baidu.com/v2/schemas/mapping.json#', + 'https://houtai.baidu.com/v2/schemas/progress.json#', + 'https://houtai.baidu.com/v2/schemas/switch.json#', + 'https://houtai.baidu.com/v2/schemas/hbox.json#', + 'https://houtai.baidu.com/v2/schemas/grid.json#', + 'https://houtai.baidu.com/v2/schemas/json.json#', + 'https://houtai.baidu.com/v2/schemas/list.json#', + 'https://houtai.baidu.com/v2/schemas/operation.json#', + 'https://houtai.baidu.com/v2/schemas/plain.json#' + ]; + + const root = {}; + let last = renderers.pop().replace(/#$/, ''); + let current = root; + + while(renderers.length) { + const renderer = renderers.shift().replace(/#$/, ''); + + current.if = { + '$ref': `${renderer}#/definitions/test` + }; + + current.then = { + '$ref': `${renderer}#/definitions/common` + }; + + current = current.else = {}; + } + + current['$ref'] = `${last}#/definitions/common`; + + console.log(JSON.stringify(root, null, 4)); +})(); + + +// Control 里面各种类型 +(function() { + const renderers = [ + 'https://houtai.baidu.com/v2/schemas/form/array.json#', + 'https://houtai.baidu.com/v2/schemas/form/button-group.json#', + 'https://houtai.baidu.com/v2/schemas/form/button-toolbar.json#', + 'https://houtai.baidu.com/v2/schemas/form/button.json#', + 'https://houtai.baidu.com/v2/schemas/form/chained-select.json#', + 'https://houtai.baidu.com/v2/schemas/form/checkbox.json#', + 'https://houtai.baidu.com/v2/schemas/form/checkboxes.json#', + 'https://houtai.baidu.com/v2/schemas/form/color.json#', + 'https://houtai.baidu.com/v2/schemas/form/combo.json#', + 'https://houtai.baidu.com/v2/schemas/form/control.json#', + 'https://houtai.baidu.com/v2/schemas/form/date-range.json#', + 'https://houtai.baidu.com/v2/schemas/form/date.json#', + 'https://houtai.baidu.com/v2/schemas/form/datetime.json#', + 'https://houtai.baidu.com/v2/schemas/form/editor.json#', + 'https://houtai.baidu.com/v2/schemas/form/email.json#', + 'https://houtai.baidu.com/v2/schemas/form/fieldSet.json#', + 'https://houtai.baidu.com/v2/schemas/form/file.json#', + 'https://houtai.baidu.com/v2/schemas/form/formula.json#', + 'https://houtai.baidu.com/v2/schemas/form/grid.json#', + 'https://houtai.baidu.com/v2/schemas/form/group.json#', + 'https://houtai.baidu.com/v2/schemas/form/hbox.json#', + 'https://houtai.baidu.com/v2/schemas/form/hidden.json#', + 'https://houtai.baidu.com/v2/schemas/form/image.json#', + 'https://houtai.baidu.com/v2/schemas/form/list.json#', + 'https://houtai.baidu.com/v2/schemas/form/matrix.json#', + 'https://houtai.baidu.com/v2/schemas/form/number.json#', + 'https://houtai.baidu.com/v2/schemas/form/tag.json#', + 'https://houtai.baidu.com/v2/schemas/form/panel.json#', + 'https://houtai.baidu.com/v2/schemas/form/password.json#', + 'https://houtai.baidu.com/v2/schemas/form/picker.json#', + 'https://houtai.baidu.com/v2/schemas/form/radios.json#', + 'https://houtai.baidu.com/v2/schemas/form/range.json#', + 'https://houtai.baidu.com/v2/schemas/form/repeat.json#', + 'https://houtai.baidu.com/v2/schemas/form/reset.json#', + 'https://houtai.baidu.com/v2/schemas/form/rich-text.json#', + 'https://houtai.baidu.com/v2/schemas/form/select.json#', + 'https://houtai.baidu.com/v2/schemas/form/service.json#', + 'https://houtai.baidu.com/v2/schemas/form/static.json#', + 'https://houtai.baidu.com/v2/schemas/form/sub-form.json#', + 'https://houtai.baidu.com/v2/schemas/form/submit.json#', + 'https://houtai.baidu.com/v2/schemas/form/switch.json#', + 'https://houtai.baidu.com/v2/schemas/form/table.json#', + 'https://houtai.baidu.com/v2/schemas/form/tabs.json#', + 'https://houtai.baidu.com/v2/schemas/form/text.json#', + 'https://houtai.baidu.com/v2/schemas/form/textarea.json#', + 'https://houtai.baidu.com/v2/schemas/form/time.json#', + 'https://houtai.baidu.com/v2/schemas/form/tree-select.json#', + 'https://houtai.baidu.com/v2/schemas/form/tree.json#', + 'https://houtai.baidu.com/v2/schemas/form/url.json#', + + // 其他 renderers + 'https://houtai.baidu.com/v2/schemas/divider.json#', + 'https://houtai.baidu.com/v2/schemas/cards.json#', + 'https://houtai.baidu.com/v2/schemas/chart.json#', + 'https://houtai.baidu.com/v2/schemas/collapse.json#', + 'https://houtai.baidu.com/v2/schemas/crud.json#', + 'https://houtai.baidu.com/v2/schemas/iframe.json#', + 'https://houtai.baidu.com/v2/schemas/nav.json#', + 'https://houtai.baidu.com/v2/schemas/tasks.json#', + 'https://houtai.baidu.com/v2/schemas/video.json#', + 'https://houtai.baidu.com/v2/schemas/wrapper.json#', + + 'https://houtai.baidu.com/v2/schemas/form.json#/definitions/customControlItem' + ]; + + const root = {}; + let last = renderers.pop().replace(/#$/, ''); + let current = root; + + while(renderers.length) { + const renderer = renderers.shift().replace(/#$/, ''); + + current.if = { + '$ref': `${renderer}#/definitions/test` + }; + + current.then = { + '$ref': `${renderer}#/definitions/common` + }; + + current = current.else = {}; + } + + current['$ref'] = `${last}`; + + console.log(JSON.stringify(root, null, 4)); +})(); \ No newline at end of file diff --git a/schemas/crud.json b/schemas/crud.json new file mode 100644 index 00000000..125db12a --- /dev/null +++ b/schemas/crud.json @@ -0,0 +1,240 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/crud.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/crud.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|syncLocation|messages|masonryLayout|footable|title|name|perPageField|mode|api|orderField|initFetcch|filter|bulkActions|defaultParams|quickSaveApi|quickSaveItemApi|columns|card|listItem|draggable|innerClassName|itemChecckableOn|itemClassName|itemUncheckableOn|innerClassName|saveOrderApi|showFooter|showHeader|toolbar|toolbarClassName|toolbarInline|headerToolbar|footerToolbar)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "enum": [ + "crud" + ], + "type": "string" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "AMis crud 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#crud", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/crud.json#/definitions/commonProps" + }, + { + "if": { + "properties": { + "mode": { + "const": "list" + } + } + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/list.json#/definitions/common" + }, + "else": { + "if": { + "properties": { + "mode": { + "enum": [ + "cards", + "grid" + ] + } + } + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/cards.json#/definitions/common" + }, + "else": { + "$ref": "https://houtai.baidu.com/v2/schemas/table.json#/definitions/common" + } + } + } + ] + }, + "commonProps": { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "api": { + "description": "初始化数据 API", + "type": "string" + }, + "bulkActions": { + "description": "批量操作", + "items": { + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#/definitions/baseAction" + }, + { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#/definitions/baseButton" + } + ] + }, + "type": "array" + }, + "defaultParams": { + "description": "可以默认给定初始参数如: {\"perPage\": 24}", + "type": "object" + }, + "draggable": { + "description": "是否可通过拖拽排序", + "type": "boolean" + }, + "name": { + "description": "取个名字方便别的组件联动", + "type": "string" + }, + "draggableOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "Js 表达式。如 data.type == 1,用表达式来配置是否可拖拽排序" + }, + "filter": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/common", + "description": "过滤器表单" + }, + "initFetch": { + "default": true, + "description": "初始是否拉取", + "type": "boolean" + }, + "initFetchOn": { + "description": "初始是否拉取, 用表达式来设置", + "type": "string" + }, + "innerClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置内部 DOM 的 className" + }, + "interval": { + "description": "设置自动刷新时间", + "type": "number" + }, + "itemCheckableOn": { + "description": "用来表达式来确定当前行是否可以点击", + "type": "string" + }, + "itemClassName": { + "description": "用来配置行数据的类名,支持表达式如:`text-<%= data.id > 10 ? 'danger' : 'info'%>`", + "type": "string" + }, + "itemUncheckableOn": { + "description": "用来表达式来确定当前行是否不可以点击", + "type": "string" + }, + "orderField": { + "description": "设置用来确定位置的字段名,设置后新的顺序将被赋值到该字段中。", + "type": "string" + }, + "pageField": { + "description": "设置分页页码字段名。", + "type": "string" + }, + "perPageField": { + "description": "设置分页一页显示的多少条数据的字段名。", + "type": "string" + }, + "quickSaveApi": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "快速编辑后用来批量保存的 API" + }, + "quickSaveItemApi": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "快速编辑配置成及时保存时使用的 API" + }, + "saveOrderApi": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "保存排序的 api" + }, + "showFooter": { + "default": true, + "description": "是否显示 footer", + "type": "boolean" + }, + "showHeader": { + "default": true, + "description": "是否显示 header", + "type": "boolean" + }, + "syncLocation": { + "description": "是否将过滤条件的参数同步到地址栏,默认为true", + "type": "boolean" + }, + "toolbar": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "description": "CRUD 中可以在 toolbar 中额外加入内容,默认将独占一行,如果想和批量操作,分页放在一起,请设置 toolbarInline" + }, + "toolbarClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置 toolbar 的 class" + }, + "toolbarInline": { + "default": false, + "description": "是否让 toolbar 区域独占一行。", + "type": "boolean" + }, + "headerToolbar": { + "description": "顶部工具栏", + "type": "array", + "items": { + "oneOf": [ + { + "type": "object" + }, + + { + "type": "string" + } + ] + } + }, + + "footerToolbar": { + "description": "顶部工具栏", + "type": "array", + "items": { + "oneOf": [ + { + "type": "object" + }, + + { + "type": "string" + } + ] + } + } + }, + "type": "object" + }, + "test": { + "properties": { + "type": { + "const": "crud" + } + } + } + }, + "description": "AMis crud 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#crud", + "type": "object" +} \ No newline at end of file diff --git a/schemas/date.json b/schemas/date.json new file mode 100644 index 00000000..e61c5901 --- /dev/null +++ b/schemas/date.json @@ -0,0 +1,76 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/date.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/date.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|className|format|valueFormat|placeholder|label|name|popOver|quickEdit|sortable|searchable|toggled|fixed)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "description": "指定为日期展示类型", + "enum": [ + "date", + "datetime", + "time" + ], + "type": "string" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "AMis date 渲染器格式说明。", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "format": { + "description": "展示的时间格式,参考 moment 中的格式说明。", + "type": "string" + }, + "placeholder": { + "description": "占位符", + "type": "string" + }, + "valueFormat": { + "description": "值的时间格式,参考 moment 中的格式说明。", + "type": "string" + } + } + }, + "test": { + "properties": { + "type": { + "enum": [ + "date", + "datetime", + "time" + ] + } + } + } + }, + "description": "AMis date 渲染器格式说明。", + "type": "object" +} \ No newline at end of file diff --git a/schemas/dialog.json b/schemas/dialog.json new file mode 100644 index 00000000..47e376ae --- /dev/null +++ b/schemas/dialog.json @@ -0,0 +1,112 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/dialog.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/dialog.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(className|initApi|initFetch|name|bodyClassName|title|body|size|actions|colseOnEsc|messages)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "dialog", + "description": "指定为 dialog 弹框渲染器", + "type": "string" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "AMis Dialog 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#dialog", + "properties": { + "actions": { + "description": "默认不用填写,自动会创建确认和取消按钮。", + "items": { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#" + }, + "type": "array" + }, + "body": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "description": "内容区域" + }, + "bodyClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置 Body 容器 className" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "closeOnEsc": { + "default": false, + "description": "是否支持按 ESC 关闭 Dialog", + "type": "boolean" + }, + "initApi": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "页面初始化的时候,可以设置一个 API 让其取拉取,发送数据会携带当前 data 数据(包含地址栏参数),获取得数据会合并到 data 中,供组件内使用。" + }, + "initFetch": { + "default": true, + "description": "是否默认就拉取?", + "type": "boolean" + }, + "messages": { + "additionalProperties": false, + "properties": { + "fetchFailed": { + "description": "用来配置当 initApi 拉取失败时提示的信息", + "type": "string" + }, + "fetchSuccess": { + "description": "用来配置当 initApi 拉取成功时提示的信息,当然不设置的话就不会提示。", + "type": "string" + } + }, + "type": "object" + }, + "name": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/name", + "description": "给当前 dialog 取个名字,可用来跟其他 Renderer 交互。" + }, + "size": { + "description": "Dialog 大小", + "enum": [ + "xs", + "sm", + "md", + "lg" + ] + }, + "title": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "default": "请通过配置 title 设置标题", + "description": "Dialog 标题" + } + } + }, + "test": { + "properties": { + "type": { + "const": "dialog" + } + } + } + }, + "description": "AMis Dialog 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#dialog", + "type": "object" +} \ No newline at end of file diff --git a/schemas/divider.json b/schemas/divider.json new file mode 100644 index 00000000..3125a6d6 --- /dev/null +++ b/schemas/divider.json @@ -0,0 +1,57 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/divider.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/divider.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|className|type)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "description": "指定为分隔符", + "const": "divider", + "type": "string" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "AMis plain 渲染器格式说明。", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + } + } + }, + "test": { + "properties": { + "type": { + "enum": [ + "divider" + ] + } + } + } + }, + "description": "AMis plain 渲染器格式说明。", + "type": "object" +} \ No newline at end of file diff --git a/schemas/drawer.json b/schemas/drawer.json new file mode 100644 index 00000000..a0ac9639 --- /dev/null +++ b/schemas/drawer.json @@ -0,0 +1,113 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/drawer.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/drawer.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(className|initApi|initFetch|name|bodyClassName|title|body|size|actions|colseOnEsc|messages)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "drawer", + "description": "指定为 drawer 弹框渲染器", + "type": "string" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "AMis drawer 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#drawer", + "properties": { + "actions": { + "description": "默认不用填写,自动会创建确认和取消按钮。", + "items": { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#" + }, + "type": "array" + }, + "body": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "description": "内容区域" + }, + "bodyClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置 Body 容器 className" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "closeOnEsc": { + "default": false, + "description": "是否支持按 ESC 关闭 drawer", + "type": "boolean" + }, + "initApi": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "页面初始化的时候,可以设置一个 API 让其取拉取,发送数据会携带当前 data 数据(包含地址栏参数),获取得数据会合并到 data 中,供组件内使用。" + }, + "initFetch": { + "default": true, + "description": "是否默认就拉取?", + "type": "boolean" + }, + "messages": { + "additionalProperties": false, + "properties": { + "fetchFailed": { + "description": "用来配置当 initApi 拉取失败时提示的信息", + "type": "string" + }, + "fetchSuccess": { + "description": "用来配置当 initApi 拉取成功时提示的信息,当然不设置的话就不会提示。", + "type": "string" + } + }, + "type": "object" + }, + "name": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/name", + "description": "给当前 drawer 取个名字,可用来跟其他 Renderer 交互。" + }, + "size": { + "description": "drawer 大小", + "enum": [ + "xs", + "sm", + "md", + "lg", + "xl" + ] + }, + "title": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "default": "请通过配置 title 设置标题", + "description": "drawer 标题" + } + } + }, + "test": { + "properties": { + "type": { + "const": "drawer" + } + } + } + }, + "description": "AMis drawer 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#drawer", + "type": "object" +} \ No newline at end of file diff --git a/schemas/dropdown-button.json b/schemas/dropdown-button.json new file mode 100644 index 00000000..da39610f --- /dev/null +++ b/schemas/dropdown-button.json @@ -0,0 +1,174 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/dropdown-button.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/dropdown-button.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|label|closeOnOutside|closeOnClick|block|btnClassName|level|size|primary|tooltip|buttons|className|disabled|disabledOn|hiddenOn|hidden|visible|visbileOn)$": {} + }, + "properties": { + "$schema": { + "description": "绑定 JSON 格式说明,可忽略!", + "format": "uri", + "type": "string" + }, + "type": { + "const": "dropdown-button", + "description": "指定为 DropDown Button 类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "AMis Dropdown Button 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#dropdown-button", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "block": { + "default": false, + "description": "是否独占一行 `display: block`", + "type": "boolean" + }, + "btnClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "给 Button 配置 className。" + }, + "buttons": { + "description": "按钮集合", + "items": { + "allOf": [ + { + "oneOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#/definitions/baseAction" + }, + + { + "type": "object", + "properties": { + "type": { + "const": "divider" + } + }, + "additionalProperties": false, + "description": "分割符号" + } + ] + }, + { + "properties": { + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "icon": { + "description": "按钮图标,请查看 fontAwesome http://fontawesome.io/icons/", + "type": "string" + }, + "label": { + "description": "按钮名字", + "type": "string" + } + }, + "type": "object" + } + ] + }, + "type": "array" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "disabled": { + "description": "是否为禁用状态。", + "type": "boolean" + }, + "disabledOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前表单项的禁用状态。" + }, + "hiddenOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前表单项是否隐藏。" + }, + "label": { + "description": "按钮文字", + "type": "string" + }, + "level": { + "description": "按钮级别", + "enum": [ + "info", + "success", + "warning", + "danger", + "link", + "primary" + ], + "type": "string" + }, + "primary": { + "default": false, + "description": "按钮是否为主按钮,影响样式。", + "type": "boolean" + }, + "size": { + "description": "按钮大小", + "enum": [ + "xs", + "sm", + "md", + "lg", + "", + "base" + ], + "type": "string" + }, + "tooltip": { + "description": "按钮提示文字,hover 时显示", + "type": "string" + }, + "type": { + "enum": [ + "dropdown-button" + ], + "type": "string" + }, + "visibleOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前表单项是否显示" + }, + "closeOnOutside": { + "type": "boolean", + "description": "点击外部是否关闭" + }, + "closeOnClick": { + "type": "boolean", + "description": "点击内容是否关闭" + } + }, + "type": "object" + }, + "test": { + "properties": { + "type": { + "const": "dropdown-button" + } + } + } + }, + "dependencies": {}, + "description": "AMis Dropdown Button 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#dropdown-button" +} \ No newline at end of file diff --git a/schemas/each.json b/schemas/each.json new file mode 100644 index 00000000..2469755c --- /dev/null +++ b/schemas/each.json @@ -0,0 +1,60 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/each.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/each.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|className|name|items)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "each", + "description": "指定为each展示类型", + "type": "string" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "AMis each 渲染器格式说明。", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "name": { + "description": "字段名", + "type": "string" + } + } + }, + "test": { + "properties": { + "type": { + "const": "each" + } + } + } + }, + "description": "AMis each 渲染器格式说明。", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form.json b/schemas/form.json new file mode 100644 index 00000000..1e5eead8 --- /dev/null +++ b/schemas/form.json @@ -0,0 +1,1268 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(?:type|\\$ref|debug|api|redirect|reload|debug|name|initApi|initAsyncApi|initFetch|initSchemaFetch|initFinishedField|initCheckInterval|schemaApi|asyncApi|checkInterval|finishedField|primaryField|className|panelClassName|title|mode|horizontal|columnClassName|horizontalDeeper|controls|submitText|submitOnChange|collapsable|data|persistData|clearPersistDataAfterSubmit|resetAfterSubmit|submitOnInit|wrapWithPanel|actions|fieldSet|target|tabs|footer|footerClassName|autoFocus|attachChanged|changedKey|changedTrueValue|changedFalseValue|messages|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "form", + "description": "指定为 Form 表单类型" + } + }, + "required": ["type"], + "type": "object" + } + ], + "definitions": { + "test": { + "properties": { + "type": { + "const": "form" + } + } + }, + "common": { + "description": "AMis Form 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#form", + "dependencies": { + "checkInterval": ["asyncApi"], + "finishedField": ["asyncApi"] + }, + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "actions": { + "items": { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#" + }, + "type": "array" + }, + "size": { + "type": "string", + "description": "表单项大小设置", + "enum": ["xs", "sm", "md", "lg", "full", ""] + }, + "remark": { + "oneOf": [ + { + "type": "string", + "description": "显示一个小图标, 鼠标放上去的时候显示提示内容" + }, + + { + "type": "object", + "properties": { + "title": { + "type": "string", + "description": "标题" + }, + "content": { + "type": "string", + "description": "内容" + }, + "position": { + "type": "string", + "description": "弹出位置", + "enum": ["left", "right", "top", "bottom"] + }, + "icon": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "图标的 CSS 类名", + "default": "fa fa-question-circle" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "trigger": { + "type": "array", + "description": "触发方式", + "items": { + "type": "string", + "enum": ["hover", "focus", "click"] + } + }, + "rootClose": { + "type": "boolean", + "description": "是否点击其他位置关闭提示,触发方式使用 click 时有用。" + } + } + } + ] + }, + "labelRemark": { + "oneOf": [ + { + "type": "string", + "description": "label 旁显示一个小图标, 鼠标放上去的时候显示提示内容" + }, + + { + "type": "object", + "properties": { + "title": { + "type": "string", + "description": "标题" + }, + "content": { + "type": "string", + "description": "内容" + }, + "position": { + "type": "string", + "description": "弹出位置", + "enum": ["left", "right", "top", "bottom"] + }, + "icon": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "图标的 CSS 类名", + "default": "fa fa-question-circle" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "trigger": { + "type": "array", + "description": "触发方式", + "items": { + "type": "string", + "enum": ["hover", "focus", "click"] + } + }, + "rootClose": { + "type": "boolean", + "description": "是否点击其他位置关闭提示,触发方式使用 click 时有用。" + } + } + } + ] + }, + "hint": { + "type": "string", + "description": "输入提示,聚焦的时候显示" + }, + "api": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "Form 用来保存数据的 api。[详情](https://baidu.github.io/amis/docs/api#form)" + }, + "asyncApi": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "设置此属性后,表单提交发送保存接口后,还会继续轮训请求该接口,直到返回 finished 属性为 true 才 结束。[详情](https://baidu.github.io/amis/docs/api#form)" + }, + "autoFocus": { + "default": true, + "description": "是否自动将第一个表单元素聚焦。", + "type": "boolean" + }, + "checkInterval": { + "default": 3000, + "description": "轮训请求的时间间隔,默认为 3秒。设置 asyncApi 才有效", + "minimum": 1000, + "type": "number" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "collapsable": { + "default": false, + "description": "当通过 fieldSet 方式设置 [FormItem](https://baidu.github.io/amis/docs/renderers#formitem) 时有效。开启可收起与展开功能。", + "type": "boolean" + }, + "controls": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/controls", + "description": "FormItem 集合" + }, + "data": { + "description": "初始数据,设置得值可用于组件内部模板使用。", + "type": "object" + }, + "debug": { + "default": false, + "description": "开启后可查看 form 数据", + "type": "boolean" + }, + "fieldSet": { + "description": "deprecated, 请在 controls 中使用 type: 'fieldSet' 代替" + }, + "finishedField": { + "default": "finished", + "description": "如果决定结束的字段名不是 `finished` 请设置此属性,比如 `is_success`", + "type": "string" + }, + "footer": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "description": "Footer 区域" + }, + "footerClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "Footer 区域 className" + }, + "horizontal": { + "additionalProperties": false, + "default": { + "left": 2 + }, + "description": "当 mode 为 horizontal 时有用,用来控制 label 和 input 的宽度占比。", + "properties": { + "left": { + "type": ["string", "number"] + }, + "leftFixed": { + "oneOf": [ + { + "type": "string", + "enum": ["", "xs", "sm", "md", "lg"] + }, + { + "type": "boolean" + } + ] + }, + "right": { + "type": ["string", "number"] + }, + "offset": { + "type": ["string", "number"] + } + }, + "type": "object" + }, + "initApi": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "Form 用来获取初始数据的 api。[详情](https://baidu.github.io/amis/docs/api#form)" + }, + "initAsyncApi": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "Form 用来获取初始数据的 api,与initApi不同的是,会一直轮训请求该接口,直到返回 finished 属性为 true 才 结束。[详情](https://baidu.github.io/amis/docs/api#form)" + }, + "initCheckInterval": { + "default": 3000, + "description": "设置了initAsyncApi以后,默认拉取的时间间隔", + "type": "number" + }, + "initFetch": { + "default": true, + "description": "设置了initApi或者initAsyncApi后,默认会开始就发请求,设置为false后就不会起始就请求接口", + "type": "boolean" + }, + "initFinishedField": { + "default": "finished", + "description": "设置了initAsyncApi后,默认会从返回数据的data.finished来判断是否完成,也可以设置成其他的xxx,就会从data.xxx中获取", + "type": "string" + }, + "persistData": { + "default": false, + "description": "是否开启本地缓存", + "type": "boolean" + }, + "clearPersistDataAfterSubmit": { + "default": false, + "description": "提交成功后清空本地缓存", + "type": "boolean" + }, + "resetAfterSubmit": { + "default": false, + "description": "提交完后重置表单", + "type": "boolean" + }, + "messages": { + "description": "接口返回消息提示", + "additionalProperties": false, + "properties": { + "fetchFailed": { + "description": "获取失败时提示", + "type": "string" + }, + "fetchSuccess": { + "description": "获取成功时提示", + "type": "string" + }, + "saveFailed": { + "description": "保存成功时提示", + "type": "string" + }, + "saveSuccess": { + "description": "保存失败时提示", + "type": "string" + } + }, + "type": "object" + }, + "mode": { + "default": "normal", + "description": "表单展示方式,可以是:normal、horizontal 或者 inline。示例:https://baidu.github.io/amis/docs/demo/forms/mode", + "enum": ["normal", "horizontal", "inline"], + "type": "string" + }, + "name": { + "description": "可以取个名字,方便其他组件引用", + "type": "string" + }, + "panelClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 panel className" + }, + "primaryField": { + "default": "id", + "description": "设置主键 id, 当设置后,检测表单是否完成时(asyncApi),只会携带此数据。", + "type": "string" + }, + "redirect": { + "description": "保存完后,可以指定跳转地址,支持相对路径和组内绝对路径,同时可以通过 $xxx 使用变量", + "type": "string" + }, + "reload": { + "description": "保存完后,可以指定目标组件刷新", + "type": "string" + }, + "submitOnChange": { + "default": false, + "description": "表单修改即提交", + "type": "boolean" + }, + "submitOnInit": { + "default": false, + "description": "表单初始先提交一次,联动的时候有用", + "type": "boolean" + }, + "submitText": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/stringOrNull", + "default": "提交", + "description": "默认的提交按钮名称,如果设置成空,则可以把默认按钮去掉。" + }, + "tabs": { + "description": "deprecated, 请再 controls 里面添加 type:tabs 节点代替" + }, + "target": { + "description": "默认表单提交自己会通过发送 api 保存数据,但是也可以设定另外一个 form 的 name 值,或者另外一个 `CRUD` 模型的 name 值。 如果 target 目标是一个 `Form` ,则目标 `Form` 会重新触发 `initApi` 和 `schemaApi`,api 可以拿到当前 form 数据。如果目标是一个 `CRUD` 模型,则目标模型会重新触发搜索,参数为当前 Form 数据。", + "type": "string" + }, + "title": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/stringOrNull", + "default": "表单", + "description": "表单标题" + }, + "type": { + "const": "form", + "description": "指定为表单类型", + "type": "string" + }, + "wrapWithPanel": { + "default": false, + "description": "是否用 panel 包裹起来", + "type": "boolean" + } + }, + "type": "object" + }, + "customControlItem": { + "description": "自定组件,非系统组件,请确保你已在自定义组件中添加了对应的组件。", + "properties": { + "type": { + "pattern": "^(?!^(?:text|control|form|color|formula|plain|number|url|email|hidden|password|textarea|select|multi-select|chained-select|nested-select|checkbox|checkboxes|radios|switch|date|datetime|time|date-range|image|file|picker|rich-text|editor|diff-editor|.*-editor|repeat|tree|city|rating|form|range|list|matrix|combo|divider|static|table|button|button-group|dropdown-button|button-toolbar|panel|hbox|grid|tpl|plain|html|submit|reset|fieldSet|tabs|group|static|static-.*)$)", + "type": "string" + } + }, + "required": ["type"], + "type": "object" + }, + "controlItem": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/array.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/array.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/button-group.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/button-group.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/button-toolbar.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/button-toolbar.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/button.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/button.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/chained-select.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/chained-select.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/checkbox.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/checkbox.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/checkboxes.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/checkboxes.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/color.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/color.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/combo.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/combo.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/control.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/control.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/date-range.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/date-range.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/date.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/date.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/datetime.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/datetime.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/editor.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/editor.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/email.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/email.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/fieldSet.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/fieldSet.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/file.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/file.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/formula.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/formula.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/grid.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/grid.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/group.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/group.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/hbox.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/hbox.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/hidden.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/hidden.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/image.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/image.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/list.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/list.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/matrix.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/matrix.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/number.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/number.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/panel.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/panel.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/password.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/password.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/picker.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/picker.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/radios.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/radios.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/range.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/range.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/repeat.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/repeat.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/reset.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/reset.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/rich-text.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/rich-text.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/select.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/select.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/service.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/service.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/static.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/static.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/sub-form.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/sub-form.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/submit.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/submit.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/switch.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/switch.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/table.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/table.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/tabs.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/tabs.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/text.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/text.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/textarea.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/textarea.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/time.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/time.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/tree-select.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/tree-select.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/tree.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/tree.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/url.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/url.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/divider.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/divider.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/cards.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/cards.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/chart.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/chart.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/collapse.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/collapse.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/crud.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/crud.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/iframe.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/iframe.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/nav.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/nav.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/tasks.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/tasks.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/video.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/video.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/wrapper.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/wrapper.json#/definitions/common" + }, + "else": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/customControlItem" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + }, + "controls": { + "items": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/controlItem" + }, + "type": "array" + }, + "item": { + "properties": { + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "desc": { + "description": "请改用 description", + "type": "string" + }, + "validateOnChange": { + "type": "boolean", + "description": "不设置时,当表单提交过后表单项每次修改都会触发重新验证,如果设置了,则由此配置项来决定要不要每次修改都触发验证。" + }, + "description": { + "description": "描述内容,支持 Html 片段。", + "type": "string" + }, + "descriptionClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置描述上的 className" + }, + "disabled": { + "description": "是否禁用", + "type": "boolean" + }, + "disabledOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前表单项是否禁用。" + }, + "hidden": { + "description": "是否隐藏", + "type": "boolean" + }, + "hiddenOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前表单项是否隐藏。" + }, + "horizontal": { + "additionalProperties": false, + "default": { + "left": 2 + }, + "description": "当表单的展示方式为水平方式时,用来控制 label 和 input 的宽度占比。", + "properties": { + "right": { + "type": "number" + }, + "left": { + "type": "number" + }, + "leftFixed": { + "oneOf": [ + { + "type": ["string", "number"] + }, + { + "type": "boolean" + } + ] + } + }, + "type": "object" + }, + "mode": { + "description": "配置当前表单项展示模式", + "type": "string", + "enum": ["normal", "inline", "horizontal"] + }, + "inline": { + "description": "是否为 inline 模式。", + "type": "boolean" + }, + "inputClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置 input className" + }, + "label": { + "description": "描述标题", + "onOf": [ + { + "type": "string" + }, + { + "enum": [false] + } + ] + }, + "labelClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置 label className" + }, + "name": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/name", + "description": "字段名,表单提交时的 key" + }, + "placeholder": { + "description": "占位符", + "type": "string" + }, + "required": { + "description": "是否为必填", + "type": "boolean" + }, + "submitOnChange": { + "description": "是否一修改就提交。", + "type": "boolean" + }, + "validationErrors": { + "description": "验证失败的提示信息", + "properties": { + "isAlpha": { + "default": "请输入字母", + "type": "string" + }, + "isAlphanumeric": { + "default": "请输入字母或者数字", + "type": "string" + }, + "isEmail": { + "default": "Email 格式不正确", + "type": "string" + }, + "isFloat": { + "default": "请输入浮点型数值", + "type": "string" + }, + "isInt": { + "default": "请输入整形数字", + "type": "string" + }, + "isJson": { + "default": "请检查 Json 格式。", + "type": "string" + }, + "isLength": { + "default": "请输入长度为 $1 的内容", + "type": "string" + }, + "isNumeric": { + "default": "请输入数字", + "type": "string" + }, + "isRequired": { + "default": "这是必填项", + "type": "string" + }, + "isUrl": { + "default": "Url 格式不正确", + "type": "string" + }, + "matchRegexp": { + "type": "string" + }, + "matchRegexp2": { + "type": "string" + }, + "matchRegexp3": { + "type": "string" + }, + "matchRegexp4": { + "type": "string" + }, + "matchRegexp5": { + "type": "string" + }, + "maxLength": { + "default": "请控制内容长度, 请不要输入 $1 个字符以上", + "type": "string" + }, + "maximum": { + "default": "当前输入值超出最大值 $1,请检查", + "type": "string" + }, + "minLength": { + "default": "请输入更多的内容,至少输入 $1 个字符。", + "type": "string" + }, + "minimum": { + "default": "当前输入值低于最小值 $1,请检查", + "type": "string" + } + }, + "type": "object" + }, + "validations": { + "description": "验证器", + "oneOf": [ + { + "type": "string" + }, + { + "properties": { + "isAlpha": { + "description": "是否是字母", + "type": "boolean" + }, + "isAlphanumeric": { + "description": "是否为字母数字", + "type": "boolean" + }, + "isEmail": { + "description": "是否为邮箱地址", + "type": "boolean" + }, + "isFloat": { + "description": "是否为浮点型", + "type": "boolean" + }, + "isInt": { + "description": "是否为整型", + "type": "boolean" + }, + "isJson": { + "description": "是否为 json", + "type": "number" + }, + "isLength": { + "description": "长度等于指定值", + "type": "number" + }, + "isNumeric": { + "description": "是否为数字", + "type": "boolean" + }, + "isRequired": { + "description": "是否为必填", + "type": "boolean" + }, + "isUrl": { + "description": "是否为 URL 地址", + "type": "boolean" + }, + "matchRegexp": { + "description": "内容命中指定正则", + "type": "string" + }, + "matchRegexp2": { + "description": "内容命中指定正则", + "type": "string" + }, + "matchRegexp3": { + "description": "内容命中指定正则", + "type": "string" + }, + "matchRegexp4": { + "description": "内容命中指定正则", + "type": "string" + }, + "matchRegexp5": { + "description": "内容命中指定正则", + "type": "string" + }, + "maxLength": { + "description": "最大长度为指定值", + "type": "number" + }, + "maximum": { + "description": "最大值为指定值", + "type": "number" + }, + "minLength": { + "description": "最小长度为指定值", + "type": "number" + }, + "minimum": { + "description": "最小值为指定值", + "type": "number" + } + }, + "type": "object" + } + ] + }, + "value": { + "description": "默认值,不支持变量。" + }, + "visible": { + "description": "是否显示", + "type": "boolean" + }, + "visibleOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前表单项是否显示" + } + }, + "type": "object" + }, + "name": { + "description": "变量名称", + "pattern": "^\\S+$", + "type": "string" + }, + "nestedOptionsType": { + "items": { + "description": "选项", + "properties": { + "children": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/nestedOptionsType" + }, + "disabled": { + "default": false, + "description": "配置当前值是否可选", + "type": "boolean" + }, + "label": { + "description": "用来显示的值", + "type": "string" + }, + "value": { + "description": "用来存储的值", + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "object" + } + ] + } + }, + "required": ["label", "value"], + "type": "object" + }, + "type": "array" + }, + "optionsType": { + "oneOf": [ + { + "description": "多个选项,请用 `,` 英文逗号隔开。", + "type": "string" + }, + { + "description": "key 是值,value 是展示信息。", + "type": "object" + }, + { + "items": { + "oneOf": [ + { + "description": "选项值", + "type": "string" + }, + { + "description": "选项", + "properties": { + "disabled": { + "default": false, + "description": "配置当前值是否可选", + "type": "boolean" + }, + "disabledOn": { + "description": "可通过表达是配置是否禁用", + "type": "string" + }, + "hiddenOn": { + "description": "可通过表达是配置是否隐藏", + "type": "string" + }, + "icon": { + "description": "图标", + "type": "string" + }, + "label": { + "description": "用来显示的值", + "type": "string" + }, + "value": { + "description": "用来存储的值", + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "object" + } + ] + }, + "visibleOn": { + "description": "可通过表达是配置是否可见", + "type": "string" + } + }, + "required": ["value"], + "type": "object" + } + ] + }, + "type": "array" + }, + { + "description": "key 为保存的值,value 为展示的值。", + "type": "object" + } + ] + } + }, + "description": "AMis Form 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#form", + "type": "object" +} diff --git a/schemas/form/array.json b/schemas/form/array.json new file mode 100644 index 00000000..253a9eee --- /dev/null +++ b/schemas/form/array.json @@ -0,0 +1,146 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/array.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/array.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|addButtonClassName|addButtonText|addable|items|draggable|maxLength|minLength|removeAble|subFormMode|conditions|formClassName|typeSwitchable|deleteApi|deleteConfirmText|noBorder|dragIcon|deleteIcon|scaffold|multiple|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "array", + "description": "指定为数组输入框类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "数组输入框框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "scaffold": { + "description": "单组表单项初始值。默认为 `{}`", + "type": "object" + }, + "deleteIcon": { + "description": "删除按钮的图标", + "type": "string" + }, + "dragIcon": { + "description": "拖动按钮的图标", + "type": "string" + }, + "noBorder": { + "default": "true", + "description": "是否含有边框", + "type": "boolean" + }, + "deleteConfirmText": { + "description": "确认删除时的提示", + "type": "string" + }, + "deleteApi": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "删除时调用的api" + }, + "typeSwitchable": { + "default": "false", + "description": "是否可切换条件,配合`conditions`使用", + "type": "boolean" + }, + "conditions": { + "description": "符合某类条件后才渲染的schema", + "type": "array" + }, + "formClassName": { + "description": "内部单组表单项的类名", + "type": "string" + }, + "addButtonClassName": { + "description": "新增按钮CSS类名", + "type": "string" + }, + "addButtonText": { + "default": "新增", + "description": "新增按钮文字", + "type": "string" + }, + "addable": { + "description": "是否可新增", + "type": "boolean" + }, + "items": { + "description": "数组输入框的子项", + "items": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/controlItem" + }, + "type": "array" + }, + "draggable": { + "description": "是否可拖拽排序", + "type": "boolean" + }, + "maxLength": { + "description": "限制最大个数", + "type": "number" + }, + "minLength": { + "description": "限制最小个数", + "type": "number" + }, + "multiple": { + "description": "是否可多选", + "type": "boolean" + }, + "removeAble": { + "description": "是否可删除", + "type": "boolean" + }, + "subFormMode": { + "default": "normal", + "description": "设置 form 的模式", + "enum": [ + "normal", + "horizontal", + "inline" + ], + "type": "string" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "array" + } + } + } + }, + "description": "数组输入框框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/button-group.json b/schemas/form/button-group.json new file mode 100644 index 00000000..a562b434 --- /dev/null +++ b/schemas/form/button-group.json @@ -0,0 +1,125 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/button-group.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/button-group.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|buttons|source|options|clearable|size|btnClassName|btnActiveClassName|vertical|multiple|joinValues|delimiter|extractValue|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|validations|validationErrors|validateOnChange|className|inputClassName|labelClassName|descriptionClassName|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "button-group", + "description": "指定为按钮组" + } + }, + "type": "object" + } + ], + "definitions": { + "common": { + "description": "按钮组格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "source": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "获取选项的接口" + }, + "btnActiveClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "default": "btn-default active", + "description": "配置选中按钮 className" + }, + "btnClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "default": "btn-default", + "description": "配置按钮 className" + }, + "buttons": { + "description": "按钮集合", + "items": { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#" + }, + "type": "array" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置 dom className" + }, + "clearable": { + "default": false, + "description": "是否可清空", + "type": "boolean" + }, + "options": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/optionsType", + "description": "选项集合" + }, + "multiple": { + "default": false, + "description": "是否为多选", + "type": "boolean" + }, + "joinValues": { + "default": true, + "description": "* 单选模式:当用户选中某个选项时,选项中的 value 将被作为该表单项的值提交,否则,整个选项对象都会作为该表单项的值提交。\n* 多选模式:选中的多个选项的 `value` 会通过 `delimiter` 连接起来,否则直接将以数组的形式提交值。", + "type": "boolean" + }, + "delimiter": { + "default": ",", + "description": "分割符", + "type": "string" + }, + "extractValue": { + "default": true, + "description": "开启后将选中的选项 value 的值封装为数组,作为当前表单项的值。", + "type": "boolean" + }, + "vertical": { + "default": "false", + "description": "垂直排列", + "type": "boolean" + }, + "size": { + "default": "md", + "description": "设置大小", + "enum": [ + "xs", + "sm", + "md", + "lg" + ], + "type": "string" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "button-group" + } + } + } + }, + "description": "按钮组格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/button-toolbar.json b/schemas/form/button-toolbar.json new file mode 100644 index 00000000..b85d3eff --- /dev/null +++ b/schemas/form/button-toolbar.json @@ -0,0 +1,64 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/button-toolbar.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/button-toolbar.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|buttons|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|inputClassName|labelClassName|descriptionClassName|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "button-toolbar", + "description": "指定为按钮工具栏" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "按钮工具栏格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "buttons": { + "items": { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#" + }, + "type": "array" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "button-toolbar" + } + } + } + }, + "description": "按钮工具栏格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/button.json b/schemas/form/button.json new file mode 100644 index 00000000..9200c953 --- /dev/null +++ b/schemas/form/button.json @@ -0,0 +1,118 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/button.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/button.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|icon|size|level|iconOnly|href|action|tooltip|tooltipPlacement|disabledTip|actionType|api|target|reload|url|link|dialog|drawer|content|feedback|confirmText|blank|nextCondition|name|value|placeholder|label|remark|labelRemark|desc|description|className|inputClassName|labelClassName|descriptionClassName|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "button", + "description": "指定为提交按钮类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "按钮格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#/definitions/baseAction" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "icon": { + "description": "按钮图标,请查看 fontAwesome http://fontawesome.io/icons/", + "type": "string" + }, + "label": { + "description": "按钮名字", + "type": "string" + }, + "level": { + "description": "按钮级别", + "enum": [ + "info", + "success", + "warning", + "danger", + "link", + "primary" + ], + "type": "string" + }, + "size": { + "description": "按钮大小", + "enum": [ + "xs", + "sm", + "md", + "lg" + ], + "type": "string" + }, + "href": { + "description": "链接", + "type": "string" + }, + "feedback": { + "description": "请求返回的响应,内部schema格式同dialog", + "type": "object" + }, + "tooltip": { + "description": "按钮提示文字,hover 时显示", + "type": "string" + }, + "disabledTip": { + "description": "禁用时按钮提示文字,hover 时显示", + "type": "string" + }, + "tooltipPlacement": { + "default": "top", + "description": "按钮提示文字显示的位置", + "enum": [ + "left", + "top", + "right", + "bottom" + ], + "type": "string" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "button" + } + } + } + }, + "description": "按钮格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/chained-select.json b/schemas/form/chained-select.json new file mode 100644 index 00000000..d9e59ae8 --- /dev/null +++ b/schemas/form/chained-select.json @@ -0,0 +1,86 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/chained-select.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|options|source|multiple|joinValues|delimiter|extractValue|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "chained-select", + "description": "指定为级联选择框" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "级联选择框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "source": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "可用来通过 API 拉取 options。详情:https://baidu.github.io/amis/docs/api#formitem,也可以从当前作用域拉取数据 $typeOptions" + }, + "options": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/optionsType", + "description": "选项集合" + }, + "multiple": { + "default": false, + "description": "是否为多选", + "type": "boolean" + }, + "joinValues": { + "default": true, + "description": "* 单选模式:当用户选中某个选项时,选项中的 value 将被作为该表单项的值提交,否则,整个选项对象都会作为该表单项的值提交。\n* 多选模式:选中的多个选项的 `value` 会通过 `delimiter` 连接起来,否则直接将以数组的形式提交值。", + "type": "boolean" + }, + "delimiter": { + "default": ",", + "description": "分割符", + "type": "string" + }, + "extractValue": { + "default": true, + "description": "开启后将选中的选项 value 的值封装为数组,作为当前表单项的值。", + "type": "boolean" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "chained-select" + } + } + } + }, + "description": "级联选择框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/checkbox.json b/schemas/form/checkbox.json new file mode 100644 index 00000000..41a83f39 --- /dev/null +++ b/schemas/form/checkbox.json @@ -0,0 +1,70 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/checkbox.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/checkbox.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|trueValue|falseValue|option|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "checkbox", + "description": "指定为勾选框" + } + }, + "type": "object", + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "Checkbox 勾选框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "falseValue": { + "default": false, + "description": "未勾选值" + }, + "option": { + "description": "选项说明", + "type": "string" + }, + "trueValue": { + "default": true, + "description": "勾选值" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "checkbox" + } + } + } + }, + "description": "Checkbox 勾选框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/checkboxes.json b/schemas/form/checkboxes.json new file mode 100644 index 00000000..3ccc3383 --- /dev/null +++ b/schemas/form/checkboxes.json @@ -0,0 +1,89 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/checkboxes.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/checkboxes.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|options|source|defaultCheckAll|checkAll|joinValues|delimiter|columnsCount|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "checkboxes", + "description": "指定为复选框" + } + }, + "type": "object", + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "复选框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "checkAll": { + "description": "是否开启全选功能", + "type": "boolean" + }, + "defaultCheckAll": { + "description": "是否默认全选", + "type": "boolean" + }, + "columnsCount": { + "default": 1, + "description": "每行显示多少个", + "type": "number" + }, + "delimiter": { + "default": ",", + "description": "分割符", + "type": "string" + }, + "joinValues": { + "default": false, + "description": "* 单选模式:当用户选中某个选项时,选项中的 value 将被作为该表单项的值提交,否则,整个选项对象都会作为该表单项的值提交。\n* 多选模式:选中的多个选项的 `value` 会通过 `delimiter` 连接起来,否则直接将以数组的形式提交值。", + "type": "boolean" + }, + "options": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/optionsType", + "description": "选项集合" + }, + "source": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "可用来通过 API 拉取 options。详情:https://baidu.github.io/amis/docs/api#formitem ,也可以从当前作用域拉取数据 $typeOptions" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "checkboxes" + } + } + } + }, + "description": "复选框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/city.json b/schemas/form/city.json new file mode 100644 index 00000000..af7bc4ed --- /dev/null +++ b/schemas/form/city.json @@ -0,0 +1,83 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/city.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/city.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|allowCity|allowDistrict|joinValues|delimiter|extractValue|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "city", + "description": "指定为 city 类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "城市输入框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "allowCity": { + "default": true, + "description": "是否允许选择城市", + "type": "boolean" + }, + "allowDistrict": { + "default": true, + "description": "是否允许选择区域", + "type": "boolean" + }, + "delimiter": { + "default": ",", + "description": "分割符", + "type": "string" + }, + "joinValues": { + "default": true, + "description": "选中的多个选项的 `value` 会通过 `delimiter` 连接起来", + "type": "boolean" + }, + "extractValue": { + "default": true, + "description": "开启后将选中的选项 value 的值封装为数组,作为当前表单项的值。", + "type": "boolean" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "city" + } + } + } + }, + "description": "城市选择格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/color.json b/schemas/form/color.json new file mode 100644 index 00000000..b9a113e3 --- /dev/null +++ b/schemas/form/color.json @@ -0,0 +1,73 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/color.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/color.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|format|clearable|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "color", + "description": "指定为 color 类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "颜色输入框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "clearable": { + "default": true, + "description": "是否显示清除按钮", + "type": "boolean" + }, + "format": { + "description": "颜色格式", + "enum": [ + "hex", + "rgb", + "rgba", + "hls" + ], + "type": "string" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "color" + } + } + } + }, + "description": "颜色输入框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/combo.json b/schemas/form/combo.json new file mode 100644 index 00000000..cf7a3e2c --- /dev/null +++ b/schemas/form/combo.json @@ -0,0 +1,166 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/combo.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/combo.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|addButtonClassName|addButtonText|addable|controls|draggable|maxLength|minLength|multiLine|removeAble|subFormMode|flat|conditions|formClassName|typeSwitchable|deleteApi|deleteConfirmText|noBorder|dragIcon|deleteIcon|scaffold|multiple|joinValues|delimiter|extractValue|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "combo", + "description": "指定为组合输入框类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "数组输入框框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "scaffold": { + "description": "单组表单项初始值。默认为 `{}`", + "type": "object" + }, + "deleteIcon": { + "description": "删除按钮的图标", + "type": "string" + }, + "dragIcon": { + "description": "拖动按钮的图标", + "type": "string" + }, + "noBorder": { + "default": "true", + "description": "是否含有边框", + "type": "boolean" + }, + "deleteConfirmText": { + "description": "确认删除时的提示", + "type": "string" + }, + "deleteApi": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "删除时调用的api" + }, + "typeSwitchable": { + "default": "false", + "description": "是否可切换条件,配合`conditions`使用", + "type": "boolean" + }, + "conditions": { + "description": "符合某类条件后才渲染的schema", + "type": "array" + }, + "formClassName": { + "description": "内部单组表单项的类名", + "type": "string" + }, + "addButtonClassName": { + "description": "新增按钮CSS类名", + "type": "string" + }, + "addButtonText": { + "default": "新增", + "description": "新增按钮文字", + "type": "string" + }, + "addable": { + "description": "是否可新增", + "type": "boolean" + }, + "controls": { + "description": "数组输入框的子项", + "items": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/controlItem" + }, + "type": "array" + }, + "delimiter": { + "default": ",", + "description": "当扁平化开启并且joinValues为true时,用什么分隔符", + "type": "string" + }, + "draggable": { + "description": "是否可拖拽排序", + "type": "boolean" + }, + "flat": { + "default": false, + "description": "是否将结果扁平化(去掉name),只有当controls的length为1且multiple为true的时候才有效", + "type": "boolean" + }, + "joinValues": { + "default": true, + "description": "当扁平化开启的时候,是否用分隔符的形式发送给后端,否则采用array的方式", + "type": "boolean" + }, + "maxLength": { + "description": "限制最大个数", + "type": "number" + }, + "minLength": { + "description": "限制最小个数", + "type": "number" + }, + "multiLine": { + "default": false, + "description": "是否多行模式,默认一行展示完", + "type": "boolean" + }, + "multiple": { + "description": "是否可多选", + "type": "boolean" + }, + "removeAble": { + "description": "是否可删除", + "type": "boolean" + }, + "subFormMode": { + "default": "normal", + "description": "设置 form 的模式", + "enum": [ + "normal", + "horizontal", + "inline" + ], + "type": "string" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "combo" + } + } + } + }, + "description": "数组输入框框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/control.json b/schemas/form/control.json new file mode 100644 index 00000000..f7680f79 --- /dev/null +++ b/schemas/form/control.json @@ -0,0 +1,66 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/control.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/control.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|control)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "control", + "description": "指定为 Control 表单输入项" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "隐藏域格式说明", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "$schema": { + "description": "绑定 JSON 格式说明,可忽略!", + "format": "uri", + "type": "string" + }, + "control": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/controlItem" + }, + "type": { + "const": "control", + "description": "指定为输入框" + } + }, + "required": [ + "type" + ], + "type": "object" + }, + "test": { + "properties": { + "type": { + "const": "control" + } + } + } + }, + "description": "隐藏域格式说明" + +} \ No newline at end of file diff --git a/schemas/form/date-range.json b/schemas/form/date-range.json new file mode 100644 index 00000000..4b2c2d9e --- /dev/null +++ b/schemas/form/date-range.json @@ -0,0 +1,89 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/date-range.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|format|inputFormat|minDate|maxDate|joinValues|delimiter|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "date-range", + "description": "指定为日期范围输入类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "日期范围格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/date-range.json#/definitions/common" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "delimiter": { + "default": ",", + "description": "分割符", + "type": "string" + }, + "format": { + "default": "X", + "description": "默认 `X` 即时间戳格式,用来提交的时间格式。更多格式类型请参考 moment.", + "type": "string" + }, + "inputFormat": { + "default": "YYYY-MM-DD", + "description": "默认 `YYYY-MM-DD` 用来配置显示的时间格式。", + "type": "string" + }, + "joinValues": { + "default": true, + "description": "开启后将选中的选项 value 的值用连接符拼接起来,作为当前表单项的值。如: `value1,value2` 否则为 `[value1, value2]`", + "type": "boolean" + }, + "maxDate": { + "description": "最大日期限制,支持变量 $xxx 来取值,或者用相对值如:* `-2mins` 2分钟前\n * `+2days` 2天后\n* `-10week` 十周前\n可用单位: `min`、`hour`、`day`、`week`、`month`、`year`。所有单位支持复数形式。", + "type": "string" + }, + "minDate": { + "description": "最小日期限制,支持变量 $xxx 来取值,或者用相对值如:* `-2mins` 2分钟前\n * `+2days` 2天后\n* `-10week` 十周前\n可用单位: `min`、`hour`、`day`、`week`、`month`、`year`。所有单位支持复数形式。", + "type": "string" + }, + "value": { + "description": "这里面 value 需要特殊说明一下,因为支持相对值。* `-2mins` 2分钟前\n * `+2days` 2天后\n* `-10week` 十周前\n可用单位: `min`、`hour`、`day`、`week`、`month`、`year`。所有单位支持复数形式。" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "date-range" + } + } + } + }, + "description": "日期范围格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/date.json b/schemas/form/date.json new file mode 100644 index 00000000..9dc3f7a5 --- /dev/null +++ b/schemas/form/date.json @@ -0,0 +1,84 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/date.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/date.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|format|inputFormat|minDate|maxDate|clearable|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "date", + "description": "指定为日期输入类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "日期输入框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "clearable": { + "default": true, + "description": "是否显示清除按钮", + "type": "boolean" + }, + "format": { + "default": "X", + "description": "默认 `X` 即时间戳格式,用来提交的时间格式。更多格式类型请参考 moment.", + "type": "string" + }, + "inputFormat": { + "default": "YYYY-MM-DD", + "description": "默认 `YYYY-MM-DD` 用来配置显示的时间格式。", + "type": "string" + }, + "maxDate": { + "description": "最大日期限制,支持变量 $xxx 来取值,或者用相对值如:* `-2mins` 2分钟前\n * `+2days` 2天后\n* `-10week` 十周前\n可用单位: `min`、`hour`、`day`、`week`、`month`、`year`。所有单位支持复数形式。", + "type": "string" + }, + "minDate": { + "description": "最小日期限制,支持变量 $xxx 来取值,或者用相对值如:* `-2mins` 2分钟前\n * `+2days` 2天后\n* `-10week` 十周前\n可用单位: `min`、`hour`、`day`、`week`、`month`、`year`。所有单位支持复数形式。", + "type": "string" + }, + "value": { + "description": "这里面 value 需要特殊说明一下,因为支持相对值。* `-2mins` 2分钟前\n * `+2days` 2天后\n* `-10week` 十周前\n可用单位: `min`、`hour`、`day`、`week`、`month`、`year`。所有单位支持复数形式。" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "date" + } + } + } + }, + "description": "日期输入框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/datetime.json b/schemas/form/datetime.json new file mode 100644 index 00000000..a101513b --- /dev/null +++ b/schemas/form/datetime.json @@ -0,0 +1,89 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/datetime.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/datetime.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|format|inputFormat|timeFormat|minDate|maxDate|clearable|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "datetime", + "description": "指定为日期时间输入类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "日期时间输入框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "clearable": { + "default": true, + "description": "是否显示清除按钮", + "type": "boolean" + }, + "format": { + "default": "X", + "description": "默认 `X` 即时间戳格式,用来提交的时间格式。更多格式类型请参考 moment.", + "type": "string" + }, + "inputFormat": { + "default": "YYYY-MM-DD HH:mm:ss", + "description": "默认 `YYYY-MM-DD` 用来配置显示的datetime格式。", + "type": "string" + }, + "timeFormat": { + "default": "HH:mm:ss", + "description": "默认 `HH:mm:ss` 用来配置显示的time格式。", + "type": "string" + }, + "maxDate": { + "description": "最大日期限制,支持变量 $xxx 来取值,或者用相对值如:* `-2mins` 2分钟前\n * `+2days` 2天后\n* `-10week` 十周前\n可用单位: `min`、`hour`、`day`、`week`、`month`、`year`。所有单位支持复数形式。", + "type": "string" + }, + "minDate": { + "description": "最小日期限制,支持变量 $xxx 来取值,或者用相对值如:* `-2mins` 2分钟前\n * `+2days` 2天后\n* `-10week` 十周前\n可用单位: `min`、`hour`、`day`、`week`、`month`、`year`。所有单位支持复数形式。", + "type": "string" + }, + "value": { + "description": "这里面 value 需要特殊说明一下,因为支持相对值。* `-2mins` 2分钟前\n * `+2days` 2天后\n* `-10week` 十周前\n可用单位: `min`、`hour`、`day`、`week`、`month`、`year`。所有单位支持复数形式。" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "date-time" + } + } + } + }, + "description": "日期时间输入框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/diff-editor.json b/schemas/form/diff-editor.json new file mode 100644 index 00000000..73229e29 --- /dev/null +++ b/schemas/form/diff-editor.json @@ -0,0 +1,123 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/diff-editor.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/diff-editor.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|language|diffValue|theme|disabled|size|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "description": "指定为编辑器类型", + "const": "diff-editor" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "编辑器格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "language": { + "const": [ + "bat", + "c", + "coffeescript", + "cpp", + "csharp", + "css", + "dockerfile", + "fsharp", + "go", + "handlebars", + "html", + "ini", + "java", + "javascript", + "json", + "less", + "lua", + "markdown", + "msdax", + "objective-c", + "php", + "plaintext", + "postiats", + "powershell", + "pug", + "python", + "r", + "razor", + "ruby", + "sb", + "scss", + "sol", + "sql", + "swift", + "typescript", + "vb", + "xml", + "yaml" + ], + "default": "javascript", + "description": "语言类型", + "type": "string" + }, + "size": { + "default": "sm", + "description": "设置编辑器的大小", + "enum": [ + "sm", + "md", + "lg", + "xl", + "xxl" + ], + "type": "string" + }, + "theme": { + "description": "主题", + "type": "string" + }, + "diffValue": { + "description": "左侧值", + "type": "string" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "diff-editor" + } + } + } + }, + "description": "编辑器格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/editor.json b/schemas/form/editor.json new file mode 100644 index 00000000..9b5e9c87 --- /dev/null +++ b/schemas/form/editor.json @@ -0,0 +1,197 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/editor.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/editor.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|language|size|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "description": "指定为编辑器类型", + "enum": [ + "editor", + "bat-editor", + "c-editor", + "coffeescript-editor", + "cpp-editor", + "csharp-editor", + "css-editor", + "dockerfile-editor", + "fsharp-editor", + "go-editor", + "handlebars-editor", + "html-editor", + "ini-editor", + "java-editor", + "javascript-editor", + "json-editor", + "less-editor", + "lua-editor", + "markdown-editor", + "msdax-editor", + "objective-c-editor", + "php-editor", + "plaintext-editor", + "postiats-editor", + "powershell-editor", + "pug-editor", + "python-editor", + "r-editor", + "razor-editor", + "ruby-editor", + "sb-editor", + "scss-editor", + "sol-editor", + "sql-editor", + "swift-editor", + "typescript-editor", + "vb-editor", + "xml-editor", + "yaml-editor", + "js-editor" + ] + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "编辑器格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "language": { + "const": [ + "bat", + "c", + "coffeescript", + "cpp", + "csharp", + "css", + "dockerfile", + "fsharp", + "go", + "handlebars", + "html", + "ini", + "java", + "javascript", + "json", + "less", + "lua", + "markdown", + "msdax", + "objective-c", + "php", + "plaintext", + "postiats", + "powershell", + "pug", + "python", + "r", + "razor", + "ruby", + "sb", + "scss", + "sol", + "sql", + "swift", + "typescript", + "vb", + "xml", + "yaml" + ], + "default": "javascript", + "description": "语言类型", + "type": "string" + }, + "size": { + "default": "sm", + "description": "设置编辑器的大小", + "enum": [ + "sm", + "md", + "lg", + "xl", + "xxl" + ], + "type": "string" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "enum": [ + "editor", + "bat-editor", + "c-editor", + "coffeescript-editor", + "cpp-editor", + "csharp-editor", + "css-editor", + "dockerfile-editor", + "fsharp-editor", + "go-editor", + "handlebars-editor", + "html-editor", + "ini-editor", + "java-editor", + "javascript-editor", + "json-editor", + "less-editor", + "lua-editor", + "markdown-editor", + "msdax-editor", + "objective-c-editor", + "php-editor", + "plaintext-editor", + "postiats-editor", + "powershell-editor", + "pug-editor", + "python-editor", + "r-editor", + "razor-editor", + "ruby-editor", + "sb-editor", + "scss-editor", + "sol-editor", + "sql-editor", + "swift-editor", + "typescript-editor", + "vb-editor", + "xml-editor", + "yaml-editor", + "js-editor" + ] + } + } + } + }, + "description": "编辑器格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/email.json b/schemas/form/email.json new file mode 100644 index 00000000..42c66c69 --- /dev/null +++ b/schemas/form/email.json @@ -0,0 +1,170 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/email.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|options|source|autoComplete|clearable|resetValue|hint|trimContents|addOn|size|multiple|joinValues|delimiter|extractValue|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "email", + "description": "指定为邮箱输入框" + } + }, + "type": "object", + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "邮箱输入框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "hint": { + "description": "当输入框获得焦点的时候显示,用来提示用户输入内容", + "type": "string" + }, + "trimContents": { + "default": "false", + "description": "是否去除首尾空白", + "type": "boolean" + }, + "size": { + "default": "full", + "description": "表单项大小,可以是:xs, sm, base, md, lg。", + "enum": [ + "xs", + "sm", + "base", + "md", + "lg" + ], + "type": "string" + }, + "addOn": { + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#/definitions/baseAction" + }, + { + "properties": { + "icon": { + "description": "按钮图标,请查看 fontAwesome http://fontawesome.io/icons/", + "type": "string" + }, + "label": { + "description": "文本", + "type": "string" + }, + "level": { + "description": "按钮级别", + "enum": [ + "info", + "success", + "warning", + "danger", + "link", + "primary" + ], + "type": "string" + }, + "type": { + "description": "定义类型,只支持:text、button和submit。", + "enum": [ + "text", + "button", + "submit" + ], + "type": "string" + }, + "position": { + "description": "addOn 的位置", + "type": "string", + "enum": [ + "left", + "right" + ] + } + }, + "type": "object" + } + ], + "description": "输入框附加组件", + "type": "object" + }, + "source": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "可用来通过 API 拉取 options。详情:https://baidu.github.io/amis/docs/api#formitem,也可以从当前作用域拉取数据 $typeOptions" + }, + "autoComplete": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "跟 source 不同的是,每次用户输入都会去接口获取提示,请不要跟 source 同时使用。" + }, + "options": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/optionsType", + "description": "选项集合" + }, + "multiple": { + "default": false, + "description": "是否为多选", + "type": "boolean" + }, + "joinValues": { + "default": true, + "description": "* 单选模式:当用户选中某个选项时,选项中的 value 将被作为该表单项的值提交,否则,整个选项对象都会作为该表单项的值提交。\n* 多选模式:选中的多个选项的 `value` 会通过 `delimiter` 连接起来,否则直接将以数组的形式提交值。", + "type": "boolean" + }, + "delimiter": { + "default": ",", + "description": "分割符", + "type": "string" + }, + "extractValue": { + "default": true, + "description": "开启后将选中的选项 value 的值封装为数组,作为当前表单项的值。", + "type": "boolean" + }, + "resetValue": { + "default": "", + "description": "清除时设置的值" + }, + "clearValue": { + "description": "是否显示清除按钮", + "type": "boolean" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "email" + } + } + } + }, + "description": "邮箱输入框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/fieldSet.json b/schemas/form/fieldSet.json new file mode 100644 index 00000000..7c056915 --- /dev/null +++ b/schemas/form/fieldSet.json @@ -0,0 +1,141 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/fieldSet.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/fieldSet.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|title|className|body|size|controls|collapsed|collapsable|mode|horizontal|hiddenOn|visibleOn|visible|hidden)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "fieldSet", + "description": "指定为 fieldSet 类型渲染器" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "AMis FieldSet 渲染器格式说明", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "body": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "title": "内容区域" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 fieldSet className" + }, + "collapsable": { + "type": "boolean", + "description": "是否可折叠" + }, + "collapsed": { + "default": false, + "description": "是否默认收起来", + "type": "boolean" + }, + "controls": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/controls", + "description": "FormItem 集合" + }, + "hiddenOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前表单项是否隐藏。" + }, + "hidden": { + "type": "boolean", + "description": "是否隐藏" + }, + "title": { + "description": "标题", + "type": "string" + }, + "visibleOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前表单项是否显示" + }, + "visible": { + "type": "boolean", + "description": "是否显示" + }, + "size": { + "description": "大小", + "enum": [ + "xs", + "sm", + "md", + "lg" + ], + "type": "string" + }, + "horizontal": { + "additionalProperties": false, + "default": { + "left": 2 + }, + "description": "当表单的展示方式为水平方式时,用来控制 label 和 input 的宽度占比。", + "properties": { + "left": { + "type": "number" + }, + "leftFixed": { + "oneOf": [ + { + "type":"string", + "const": [ + "", + "xs", + "sm", + "md", + "lg" + ] + }, + { + "type":"boolean" + } + ] + } + }, + "type": "object" + }, + "mode": { + "description": "配置当前表单项展示模式", + "type": "string", + "enum": [ + "normal", + "inline", + "horizontal" + ] + } + }, + "type": "object" + }, + "test": { + "properties": { + "type": { + "const": "fieldSet" + } + } + } + }, + "description": "AMis FieldSet 渲染器格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/file.json b/schemas/form/file.json new file mode 100644 index 00000000..2c6846d8 --- /dev/null +++ b/schemas/form/file.json @@ -0,0 +1,168 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/file.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/file.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|btnClassName|btnUploadClassName|maxSize|maxLength|btnLabel|reciever|fileField|useChunk|chunkSize|startChunkApi|chunkApi|finishChunkApi|accept|autoUpload|hideUploadButton|asBase64|multiple|joinValues|delimiter|extractValue|resetValue|downloadUrl|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "file", + "description": "指定为文件上传类型" + } + }, + "required": ["type"], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "文件上传格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "btnLabel": { + "default": "请选择文件", + "description": "上传文件按钮说明", + "type": "string" + }, + "accept": { + "default": "text/plain", + "description": "默认只支持纯文本,要支持其他类型,请配置此属性。", + "type": "string" + }, + "asBase64": { + "default": false, + "description": "如果上传的文件比较小可以设置此选项来简单的把文件 base64 的值给 form 一起提交,目前不支持多选。", + "type": "boolean" + }, + "autoUpload": { + "default": true, + "description": "是否自动开始上传", + "type": "boolean" + }, + "chunkApi": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "default": "/api/upload/chunk", + "description": "默认 `/api/upload/chunk` 想自己存储时才需要关注。" + }, + "chunkSize": { + "default": 5242880, + "description": "分块大小,默认为 5M.", + "type": "number" + }, + "delimiter": { + "default": ",", + "description": "分割符", + "type": "string" + }, + "downloadUrl": { + "description": "默认显示文件路径的时候会支持直接下载,可以支持加前缀如:`http://xx.dom/filename=` ,如果不希望这样,可以把当前配置项设置为 `false`。", + "type": "string" + }, + "fileField": { + "default": "file", + "description": "默认 `file`, 如果你不想自己存储,则可以忽略此属性。", + "type": "string" + }, + "finishChunkApi": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "default": "/api/upload/finishChunkApi", + "description": "默认 `/api/upload/finishChunkApi` 想自己存储时才需要关注。" + }, + "hideUploadButton": { + "default": true, + "description": "是否隐藏上传按钮", + "type": "boolean" + }, + "maxLength": { + "description": "最多的个数", + "type": "number" + }, + "maxSize": { + "default": 0, + "description": "默认没有限制,当设置后,文件大小大于此值将不允许上传。", + "type": "number" + }, + "reciever": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "default": "/api/upload/file", + "description": "默认 `/api/upload/file` 如果想自己存储,请设置此选项。" + }, + "startChunkApi": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "default": "/api/upload/startChunk", + "description": "默认 `/api/upload/startChunk` 想自己存储时才需要关注。" + }, + "useChunk": { + "default": "auto", + "description": "默认为 'auto' amis 所在服务器,限制了文件上传大小不得超出10M,所以 amis 在用户选择大文件的时候,自动会改成分块上传模式。", + "oneOf": [ + { + "enum": ["auto"] + }, + { + "type": "boolean" + } + ] + }, + "btnClassName": { + "type": "string", + "description": "按钮 CSS 类名" + }, + "btnUploadClassName": { + "type": "string", + "description": "上传按钮 CSS 类名" + }, + "multiple": { + "default": false, + "description": "是否为多选", + "type": "boolean" + }, + "joinValues": { + "default": true, + "description": "* 单选模式:当用户选中某个选项时,选项中的 value 将被作为该表单项的值提交,否则,整个选项对象都会作为该表单项的值提交。\n* 多选模式:选中的多个选项的 `value` 会通过 `delimiter` 连接起来,否则直接将以数组的形式提交值。", + "type": "boolean" + }, + "extractValue": { + "default": true, + "description": "开启后将选中的选项 value 的值封装为数组,作为当前表单项的值。", + "type": "boolean" + }, + "resetValue": { + "default": "", + "description": "清除时设置的值" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "file" + } + } + } + }, + "description": "文件上传格式说明", + "type": "object" +} diff --git a/schemas/form/formula.json b/schemas/form/formula.json new file mode 100644 index 00000000..789557f3 --- /dev/null +++ b/schemas/form/formula.json @@ -0,0 +1,77 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/formula.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/formula.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|name|formula|value|initSet|autoSet|id|condition)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "formula", + "description": "指定为公式功能框" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "隐藏域格式说明", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "id": { + "description": "当某个按钮的目标指定为此值后,会触发一次公式应用。这个机制可以在 autoSet 为 false 时用来手动触发", + "type": "string" + }, + "condition": { + "description": "触发公式的作用条件,如 data.xxx == \"a\" 或者 ${xx} ", + "type": "string" + }, + "autoSet": { + "description": "是否自动应用", + "type": "boolean" + }, + "formula": { + "description": "公式", + "type": "string" + }, + "initSet": { + "description": "是否初始应用", + "type": "boolean" + }, + "name": { + "description": "字段名,公式结果将作用到此处指定的变量中去", + "type": "string" + }, + "value": { + "description": "默认值" + } + } + }, + "test": { + "properties": { + "type": { + "const": "formula" + } + } + } + }, + "description": "隐藏域格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/grid.json b/schemas/form/grid.json new file mode 100644 index 00000000..25a31935 --- /dev/null +++ b/schemas/form/grid.json @@ -0,0 +1,95 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/grid.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/text.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|columns|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "description": "绑定 JSON 格式说明,可忽略!", + "format": "uri", + "type": "string" + }, + "type": { + "const": "grid", + "description": "指定为grid类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "column": { + "allOf": [ + { + "oneOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/subRenderer" + }, + + { + "type": "object", + "properties": { + "controls": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/controls", + "description": "FormItem 集合" + } + } + } + ] + }, + { + "$ref": "https://houtai.baidu.com/v2/schemas/grid.json#/definitions/commonColumn" + } + ], + "description": "列" + }, + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "columns": { + "description": "列集合", + "items": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/grid.json#/definitions/column" + }, + "type": "array" + }, + "common": { + "description": "Grid 格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "columns": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/grid.json#/definitions/columns", + "description": "列集合" + } + }, + "type": "object" + } + ], + "type": "object" + }, + "test": { + "properties": { + "type": { + "const": "grid" + } + } + } + }, + "description": "Grid 格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/group.json b/schemas/form/group.json new file mode 100644 index 00000000..315c49f5 --- /dev/null +++ b/schemas/form/group.json @@ -0,0 +1,126 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/group.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/group.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|label|remark|labelRemark|gap|desc|description|className|horizontal|mode|controls|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "group", + "description": "指定渲染器类型为表单 Input Group 类型,能让多个表单在一行。" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "AMis 表单集合渲染器格式说明,能让多个表单在一行显示", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 Group className" + }, + "controls": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/controls", + "description": "FormItem 集合" + }, + "hiddenOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前表单项是否隐藏。" + }, + "visibleOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前表单项是否显示" + }, + "label": { + "description": "描述标题", + "oneOf": [ + { + "type": "string" + }, + { + "enum": [ + false + ] + } + ] + }, + "labelClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置 label className" + }, + "description": { + "description": "描述内容,支持 Html 片段。", + "type": "string" + }, + "descriptionClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置描述上的 className" + }, + "horizontal": { + "additionalProperties": false, + "default": { + "left": 2 + }, + "description": "当表单的展示方式为水平方式时,用来控制 label 和 input 的宽度占比。", + "properties": { + "right": { + "type": "number" + }, + "left": { + "type": "number" + }, + "leftFixed": { + "oneOf": [ + { + "type": ["string", "number"] + }, + { + "type":"boolean" + } + ] + } + }, + "type": "object" + }, + "mode": { + "description": "配置当前表单项展示模式", + "type": "string", + "enum": [ + "normal", + "inline", + "horizontal" + ] + } + }, + "type": "object" + }, + "test": { + "properties": { + "type": { + "const": "group" + } + } + } + }, + "description": "AMis 表单集合渲染器格式说明,能让多个表单在一行显示", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/hbox.json b/schemas/form/hbox.json new file mode 100644 index 00000000..eeb5c54d --- /dev/null +++ b/schemas/form/hbox.json @@ -0,0 +1,102 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/hbox.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/text.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|columns|gap|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "description": "绑定 JSON 格式说明,可忽略!", + "format": "uri", + "type": "string" + }, + "type": { + "const": "hbox", + "description": "指定为hbox类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "column": { + "allOf": [ + { + "oneOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/subRenderer" + }, + + { + "type": "object", + "properties": { + "controls": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/controls", + "description": "FormItem 集合" + } + } + } + ] + }, + { + "$ref": "https://houtai.baidu.com/v2/schemas/grid.json#/definitions/commonColumn" + } + ], + "description": "列" + }, + "columns": { + "description": "列集合", + "items": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/hbox.json#/definitions/column" + }, + "type": "array" + }, + "common": { + "description": "HBox 格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "columns": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/hbox.json#/definitions/columns", + "description": "列集合" + }, + "gap": { + "type": "string", + "enum": [ + "xs", "sm", "" + ], + "description": "间隔大小" + } + }, + "type": "object" + } + ], + "type": "object" + }, + "test": { + "properties": { + "type": { + "const": "hbox" + } + } + } + }, + "description": "HBox 格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/hidden.json b/schemas/form/hidden.json new file mode 100644 index 00000000..71d7393b --- /dev/null +++ b/schemas/form/hidden.json @@ -0,0 +1,57 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/hidden.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/hidden.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|name|formula|value)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "hidden", + "description": "指定为隐藏域" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "隐藏域格式说明", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "name": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/name", + "description": "字段名,表单提交时的 key" + }, + "value": { + "description": "默认值,不支持变量。" + } + } + }, + "test": { + "properties": { + "type": { + "const": "hidden" + } + } + } + }, + "description": "隐藏域格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/image.json b/schemas/form/image.json new file mode 100644 index 00000000..76f04a62 --- /dev/null +++ b/schemas/form/image.json @@ -0,0 +1,209 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/image.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/image.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|reciever|accept|btnUploadClassName|btnClassName|imageClassName|src|hideUploadButton|autoUpload|maxLength|maxSize|compress|compressOptions|showCompressOptions|crop|allowInput|limit|multiple|joinValues|delimiter|extractValue|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "image", + "description": "指定为图片上传类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "图片上传框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "src": { + "description": "默认展示图片的链接", + "type": "string" + }, + "imageClassName": { + "description": "默认展示图片的类名", + "type": "string" + }, + "accept": { + "description": "配置接收的图片类型 MimeTypes", + "type": "string" + }, + "allowInput": { + "default": false, + "description": "默认都是通过用户选择图片后上传返回图片地址,如果开启此选项,则可以允许用户图片地址。", + "type": "boolean" + }, + "autoUpload": { + "default": true, + "description": "是否自动开始上传", + "type": "boolean" + }, + "btnClassName": { + "default": "btn-info btn-sm", + "description": "选择图片按钮的 CSS 类名", + "type": "string" + }, + "btnUploadClassName": { + "default": "btn-success", + "description": "上传按钮的 CSS 类名", + "type": "string" + }, + "compress": { + "default": true, + "description": "如果想默认压缩请开启", + "type": "boolean" + }, + "compressOptions": { + "description": "压缩属性", + "properties": { + "maxHeight": { + "description": "设置最大高度", + "type": "number" + }, + "maxWidth": { + "description": "设置最大宽度", + "type": "number" + } + }, + "type": "object" + }, + "crop": { + "description": "用来设置是否支持裁剪。", + "oneOf": [ + { + "type": "boolean" + }, + { + "properties": { + "aspectRatio": { + "default": 1, + "description": "默认 `1` 即 `1:1`", + "type": "number" + } + }, + "type": "object" + } + ] + }, + "hideUploadButton": { + "default": true, + "description": "是否隐藏上传按钮", + "type": "boolean" + }, + "limit": { + "description": "限制图片大小,超出不让上传。", + "properties": { + "height": { + "description": "限制图片高度", + "type": "number" + }, + "maxHeight": { + "description": "限制图片最大高度", + "type": "number" + }, + "maxWidth": { + "description": "限制图片最大宽度", + "type": "number" + }, + "minHeight": { + "description": "限制图片最小高度", + "type": "number" + }, + "minWidth": { + "description": "限制图片最小宽度", + "type": "number" + }, + "width": { + "description": "限制图片宽度", + "type": "number" + } + }, + "type": "object" + }, + "maxLength": { + "description": "最多的个数", + "type": "number" + }, + "maxSize": { + "default": 0, + "description": "默认没有限制,当设置后,文件大小大于此值将不允许上传。", + "type": "number" + }, + "reciever": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "default": "/api/upload", + "description": "默认 `/api/upload` 如果想自己存储,请设置此选项。" + }, + "showCompressOptions": { + "default": false, + "description": "默认为 false, 开启后,允许用户输入压缩选项。", + "type": "boolean" + }, + "multiple": { + "default": false, + "description": "是否为多选", + "type": "boolean" + }, + "joinValues": { + "default": true, + "description": "* 单选模式:当用户选中某个选项时,选项中的 value 将被作为该表单项的值提交,否则,整个选项对象都会作为该表单项的值提交。\n* 多选模式:选中的多个选项的 `value` 会通过 `delimiter` 连接起来,否则直接将以数组的形式提交值。", + "type": "boolean" + }, + "delimiter": { + "default": ",", + "description": "分割符", + "type": "string" + }, + "extractValue": { + "default": true, + "description": "开启后将选中的选项 value 的值封装为数组,作为当前表单项的值。", + "type": "boolean" + }, + "resetValue": { + "default": "", + "description": "清除时设置的值" + }, + "clearValue": { + "description": "是否显示清除按钮", + "type": "boolean" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "image" + } + } + } + }, + "description": "图片上传框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/input-group.json b/schemas/form/input-group.json new file mode 100644 index 00000000..124beea4 --- /dev/null +++ b/schemas/form/input-group.json @@ -0,0 +1,75 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/input-group.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/input-group.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|size|controls|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "input-group", + "description": "指定为数字输入框" + } + }, + "type": "object", + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "输入组合框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "size": { + "default": "full", + "description": "表单项大小,可以是:xs, sm, base, md, lg。", + "enum": [ + "xs", + "sm", + "base", + "md", + "lg", + "full" + ], + "type": "string" + }, + "controls": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/controls", + "description": "FormItem 集合" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "input-group" + } + } + } + }, + "description": "输入组合框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/list.json b/schemas/form/list.json new file mode 100644 index 00000000..54c57d3e --- /dev/null +++ b/schemas/form/list.json @@ -0,0 +1,99 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/list.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/list.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|options|source|multiple|joinValues|delimiter|extractValue|clearable|submitOnDBClick|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "list", + "description": "指定为列表选择框" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "列表选择框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "multiple": { + "default": false, + "description": "是否为多选", + "type": "boolean" + }, + "joinValues": { + "default": true, + "description": "* 单选模式:当用户选中某个选项时,选项中的 value 将被作为该表单项的值提交,否则,整个选项对象都会作为该表单项的值提交。\n* 多选模式:选中的多个选项的 `value` 会通过 `delimiter` 连接起来,否则直接将以数组的形式提交值。", + "type": "boolean" + }, + "delimiter": { + "default": ",", + "description": "分割符", + "type": "string" + }, + "extractValue": { + "default": true, + "description": "开启后将选中的选项 value 的值封装为数组,作为当前表单项的值。", + "type": "boolean" + }, + "resetValue": { + "default": "", + "description": "清除时设置的值" + }, + "clearValue": { + "description": "是否显示清除按钮", + "type": "boolean" + }, + "options": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/optionsType", + "description": "选项集合" + }, + "source": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "可用来通过 API 拉取 options。详情:https://baidu.github.io/amis/docs/api#formitem,也可以从当前作用域拉取数据 $typeOptions" + }, + "submitOnDBClick": { + "default": "false", + "description": "双击触发表单数据提交", + "type": "boolean" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "list" + } + } + } + }, + "description": "列表选择框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/matrix.json b/schemas/form/matrix.json new file mode 100644 index 00000000..0e7451ce --- /dev/null +++ b/schemas/form/matrix.json @@ -0,0 +1,111 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/matrix.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/matrix.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|source|rows|columns|rowLabel|singleSelectMode|multiple|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "matrix", + "description": "指定为 matrix 类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "Matrix 矩阵勾选框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "multiple": { + "default": true, + "description": "配置singleSelectMode时设置为false", + "type": "boolean" + }, + "singleSelectMode": { + "description": "设置单选模式,multiple为false时有效", + "enum": [ + "cell", + "row", + "column" + ], + "type": "string" + }, + "columns": { + "description": "列信息列表", + "items": { + "properties": { + "label": { + "type": "string" + } + }, + "required": [ + "label" + ], + "type": "object" + }, + "type": "array" + }, + "rowLabel": { + "description": "行标题说明", + "type": "string" + }, + "rows": { + "description": "行信息列表", + "items": { + "properties": { + "label": { + "type": "string" + } + }, + "required": [ + "label" + ], + "type": "object" + }, + "type": "array" + }, + "source": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "可用来通过 API 拉取 options。详情:https://baidu.github.io/amis/docs/api#matrix,也可以从当前作用域拉取数据 $typeOptions" + } + }, + "type": "object" + } + ], + "type": "object" + }, + "test": { + "properties": { + "type": { + "const": "matrix" + } + } + } + }, + "description": "Matrix 矩阵勾选框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/nested-select.json b/schemas/form/nested-select.json new file mode 100644 index 00000000..ddaf4d83 --- /dev/null +++ b/schemas/form/nested-select.json @@ -0,0 +1,94 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/nested-select.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/nested-select.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|options|source|size|multiple|joinValues|delimiter|extractValue|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "nested-select", + "description": "指定为 nested-select 选择框" + } + }, + "type": "object", + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "nested-select 选择框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "multiple": { + "default": false, + "description": "是否为多选", + "type": "boolean" + }, + "joinValues": { + "default": true, + "description": "* 单选模式:当用户选中某个选项时,选项中的 value 将被作为该表单项的值提交,否则,整个选项对象都会作为该表单项的值提交。\n* 多选模式:选中的多个选项的 `value` 会通过 `delimiter` 连接起来,否则直接将以数组的形式提交值。", + "type": "boolean" + }, + "delimiter": { + "default": ",", + "description": "分割符", + "type": "string" + }, + "extractValue": { + "default": true, + "description": "开启后将选中的选项 value 的值封装为数组,作为当前表单项的值。", + "type": "boolean" + }, + "resetValue": { + "default": "", + "description": "清除时设置的值" + }, + "clearValue": { + "description": "是否显示清除按钮", + "type": "boolean" + }, + "options": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/optionsType", + "description": "选项集合" + }, + "source": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "可用来通过 API 拉取 options。详情:https://baidu.github.io/amis/docs/api#formitem,也可以从当前作用域拉取数据 $typeOptions" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "nested-select" + } + } + } + }, + "description": "nested-select 选择框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/number.json b/schemas/form/number.json new file mode 100644 index 00000000..eb283387 --- /dev/null +++ b/schemas/form/number.json @@ -0,0 +1,75 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/number.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/number.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|min|step|max|precision|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "number", + "description": "指定为数字输入框" + } + }, + "type": "object", + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "数字输入框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "max": { + "description": "最大值", + "type": "number" + }, + "min": { + "description": "最小值", + "type": "number" + }, + "step": { + "default": 1, + "description": "步长", + "type": "number" + }, + "precision": { + "description": "精度", + "type": "number" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "number" + } + } + } + }, + "description": "数字输入框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/panel.json b/schemas/form/panel.json new file mode 100644 index 00000000..27df1195 --- /dev/null +++ b/schemas/form/panel.json @@ -0,0 +1,92 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/panel.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/panel.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|bodyClassName|className|affixFooter|body|header|title|tabs|actions|footer|visible|visibleOn|hidden|hiddenOn)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "panel", + "description": "指定为面板类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "Panel 格式说明", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "actions": { + "items": { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#" + }, + "type": "array" + }, + "body": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "title": "页面内容区域" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "bodyClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置body容器 className" + }, + "footer": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "description": "Footer 区域" + }, + "header": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "title": "顶部内容区域,跟 title 二选一" + }, + "tabs": { + "description": "tabs集合", + "items": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/tabs.json#/definitions/tab" + }, + "type": "array" + }, + "title": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/string", + "description": "Panel 标题" + }, + "affixFooter": { + "description": "固定底部", + "type": "boolean" + } + }, + "type": "object" + }, + "test": { + "properties": { + "type": { + "const": "panel" + } + } + } + }, + "description": "Panel 格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/password.json b/schemas/form/password.json new file mode 100644 index 00000000..85291a14 --- /dev/null +++ b/schemas/form/password.json @@ -0,0 +1,170 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/password.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/password.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|options|source|autoComplete|clearValue|resetValue|hint|trimContents|addOn|size|multiple|joinValues|delimiter|extractValue|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "password", + "description": "指定为密码输入框" + } + }, + "type": "object", + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "密码框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "hint": { + "description": "当输入框获得焦点的时候显示,用来提示用户输入内容", + "type": "string" + }, + "trimContents": { + "default": "false", + "description": "是否去除首尾空白", + "type": "boolean" + }, + "size": { + "default": "full", + "description": "表单项大小,可以是:xs, sm, base, md, lg。", + "enum": [ + "xs", + "sm", + "base", + "md", + "lg" + ], + "type": "string" + }, + "addOn": { + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#/definitions/baseAction" + }, + { + "properties": { + "icon": { + "description": "按钮图标,请查看 fontAwesome http://fontawesome.io/icons/", + "type": "string" + }, + "label": { + "description": "文本", + "type": "string" + }, + "level": { + "description": "按钮级别", + "enum": [ + "info", + "success", + "warning", + "danger", + "link", + "primary" + ], + "type": "string" + }, + "type": { + "description": "定义类型,只支持:text、button和submit。", + "enum": [ + "text", + "button", + "submit" + ], + "type": "string" + }, + "position": { + "description": "addOn 的位置", + "type": "string", + "enum": [ + "left", + "right" + ] + } + }, + "type": "object" + } + ], + "description": "输入框附加组件", + "type": "object" + }, + "source": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "可用来通过 API 拉取 options。详情:https://baidu.github.io/amis/docs/api#formitem,也可以从当前作用域拉取数据 $typeOptions" + }, + "autoComplete": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "跟 source 不同的是,每次用户输入都会去接口获取提示,请不要跟 source 同时使用。" + }, + "options": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/optionsType", + "description": "选项集合" + }, + "multiple": { + "default": false, + "description": "是否为多选", + "type": "boolean" + }, + "joinValues": { + "default": true, + "description": "* 单选模式:当用户选中某个选项时,选项中的 value 将被作为该表单项的值提交,否则,整个选项对象都会作为该表单项的值提交。\n* 多选模式:选中的多个选项的 `value` 会通过 `delimiter` 连接起来,否则直接将以数组的形式提交值。", + "type": "boolean" + }, + "delimiter": { + "default": ",", + "description": "分割符", + "type": "string" + }, + "extractValue": { + "default": true, + "description": "开启后将选中的选项 value 的值封装为数组,作为当前表单项的值。", + "type": "boolean" + }, + "resetValue": { + "default": "", + "description": "清除时设置的值" + }, + "clearValue": { + "description": "是否显示清除按钮", + "type": "boolean" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "password" + } + } + } + }, + "description": "密码框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/picker.json b/schemas/form/picker.json new file mode 100644 index 00000000..b4bfe3b6 --- /dev/null +++ b/schemas/form/picker.json @@ -0,0 +1,118 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/picker.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/picker.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|embed|delimiter|joinValues|multiple|modalMode|options|pickerSchema|valueField|labelField|size|source|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "picker", + "description": "指定为选项器类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "Text文本框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "delimiter": { + "default": ",", + "description": "分割符", + "type": "string" + }, + "embed": { + "default": false, + "description": "是否开启内嵌模式,内嵌模式时,picker 直接显示选项提供选择", + "type": "boolean" + }, + "joinValues": { + "default": true, + "description": "* 单选模式:当用户选中某个选项时,选项中的 value 将被作为该表单项的值提交,否则,整个选项对象都会作为该表单项的值提交。\n* 多选模式:选中的多个选项的 `value` 会通过 `delimiter` 连接起来,否则直接将以数组的形式提交值。", + "type": "boolean" + }, + "modalMode": { + "default": "dialog", + "enum": [ + "dialog", + "drawer" + ], + "type": "string" + }, + "multiple": { + "description": "是否可多选", + "type": "boolean" + }, + "options": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/optionsType", + "description": "选项集合" + }, + "valueField": { + "description": "value匹配的字段", + "type": "string" + }, + "labelField": { + "description": "label匹配的字段", + "type": "string" + }, + "size": { + "description": "value匹配的字段", + "enum": [ + "xs", + "sm", + "base", + "md", + "lg" + ], + "type": "string" + }, + "pickerSchema": { + "$ref": "https://houtai.baidu.com/v2/schemas/crud.json#/definitions/common", + "description": "配置选框详情", + "type": "object" + }, + "source": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "可用来通过 API 拉取 options。详情:https://baidu.github.io/amis/docs/api#formitem,也可以从当前作用域拉取数据 $typeOptions" + } + }, + "type": "object" + } + ], + "type": "object" + }, + "test": { + "properties": { + "type": { + "const": "picker" + } + } + } + }, + "description": "Text文本框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/radios.json b/schemas/form/radios.json new file mode 100644 index 00000000..1192d7d7 --- /dev/null +++ b/schemas/form/radios.json @@ -0,0 +1,71 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/radios.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/radios.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|options|source|columnsCount|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "radios", + "description": "指定为单选框" + } + }, + "type": "object", + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "单选框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "columnsCount": { + "default": 1, + "description": "每行显示多少个", + "type": "number" + }, + "options": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/optionsType", + "description": "选项集合" + }, + "source": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "可用来通过 API 拉取 options。详情:https://baidu.github.io/amis/docs/api#formitem,也可以从当前作用域拉取数据 $typeOptions" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "radios" + } + } + } + }, + "description": "单选框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/range.json b/schemas/form/range.json new file mode 100644 index 00000000..a83e594e --- /dev/null +++ b/schemas/form/range.json @@ -0,0 +1,96 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/range.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/range.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|min|max|step|unit|showInput|multiple|joinValues|delimiter|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "range", + "description": "指定为数字范围类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "数字范围框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "max": { + "default": 100, + "description": "最大值", + "type": "number" + }, + "min": { + "default": 1, + "description": "最小值", + "type": "number" + }, + "step": { + "default": 1, + "description": "每次操作的值", + "type": "number" + }, + "unit": { + "description": "单位", + "type": "string" + }, + "showInput": { + "description": "是否显示输入框", + "type": "boolean" + }, + "multiple": { + "default": false, + "description": "是否为选择范围", + "type": "boolean" + }, + "joinValues": { + "default": true, + "description": "选中的多个选项的 `value` 会通过 `delimiter` 连接起来,否则直接将以数组的形式提交值。", + "type": "boolean" + }, + "delimiter": { + "default": ",", + "description": "分割符", + "type": "string" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "range" + } + } + } + }, + "description": "数字范围框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/rating.json b/schemas/form/rating.json new file mode 100644 index 00000000..d5ae158c --- /dev/null +++ b/schemas/form/rating.json @@ -0,0 +1,73 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/rating.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/color.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|count|readOnly|half|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "rating", + "description": "指定为 rating 类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "评分格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "readOnly": { + "default": true, + "description": "是否只读", + "type": "boolean" + }, + "half": { + "default": true, + "description": "允许选择半星", + "type": "boolean" + }, + "count": { + "default": 5, + "description": "最大值", + "type": "number" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "rating" + } + } + } + }, + "description": "评分格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/repeat.json b/schemas/form/repeat.json new file mode 100644 index 00000000..82c3860e --- /dev/null +++ b/schemas/form/repeat.json @@ -0,0 +1,63 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/repeat.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/repeat.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|options|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "repeat", + "description": "指定为周期框类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "Text文本框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "options": { + "default": "hourly,daily,weekly,monthly", + "description": "配置周期参数,支持:secondly,minutely,hourly,daily,weekdays,weekly,monthly,yearly", + "type": "string" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "repeat" + } + } + } + }, + "description": "Text文本框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/reset.json b/schemas/form/reset.json new file mode 100644 index 00000000..5fc8dcdd --- /dev/null +++ b/schemas/form/reset.json @@ -0,0 +1,107 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/reset.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/reset.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|icon|size|level|iconOnly|action|tooltip|tooltipPlacement|disabledTip|actionType|api|target|reload|url|link|dialog|drawer|content|feedback|confirmText|blank|nextCondition|name|value|placeholder|label|remark|labelRemark|desc|description|className|inputClassName|labelClassName|descriptionClassName|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "reset", + "description": "指定为重置按钮类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "Reset 按钮格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "icon": { + "description": "按钮图标,请查看 fontAwesome http://fontawesome.io/icons/", + "type": "string" + }, + "label": { + "description": "按钮名字", + "type": "string" + }, + "level": { + "description": "按钮级别", + "enum": [ + "info", + "success", + "warning", + "danger", + "link", + "primary" + ], + "type": "string" + }, + "size": { + "description": "按钮大小", + "enum": [ + "xs", + "sm", + "md", + "lg" + ], + "type": "string" + }, + "tooltip": { + "description": "按钮提示文字,hover 时显示", + "type": "string" + }, + "tooltipPlacement": { + "default": "top", + "description": "按钮提示文字显示的位置", + "enum": [ + "left", + "top", + "right", + "bottom" + ], + "type": "string" + }, + "disabledTip": { + "description": "禁用时按钮提示文字,hover 时显示", + "type": "string" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "reset" + } + } + } + }, + "description": "Reset 按钮格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/rich-text.json b/schemas/form/rich-text.json new file mode 100644 index 00000000..6b82dbf5 --- /dev/null +++ b/schemas/form/rich-text.json @@ -0,0 +1,66 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/rich-text.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/rich-text.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|receiver|options|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "rich-text", + "description": "指定为富文本类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "富文本框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "options": { + "description": "请参考 https://www.froala.com/wysiwyg-editor/docs/options 的配置说明。", + "type": "object" + }, + "reciever": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "用来负责图片存储" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "rich-text" + } + } + } + }, + "description": "富文本框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/select.json b/schemas/form/select.json new file mode 100644 index 00000000..2e90257e --- /dev/null +++ b/schemas/form/select.json @@ -0,0 +1,117 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/select.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/select.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|options|source|autoComplete|multiple|joinValues|delimiter|extractValue|clearable|resetValue|searchable|checkAll|checkAllLabel|defaultCheckAll|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "select", + "description": "指定为Select选择框" + } + }, + "type": "object", + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "Select选择框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "autoComplete": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "自动完成接口,请不要跟 source 同时使用。" + }, + "options": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/optionsType", + "description": "选项集合" + }, + "searchable": { + "default": false, + "description": "是否可以搜索值", + "type": "boolean" + }, + "source": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "可用来通过 API 拉取 options。详情:https://baidu.github.io/amis/docs/api#formitem,也可以从当前作用域拉取数据 $typeOptions" + }, + "multiple": { + "default": false, + "description": "是否为多选", + "type": "boolean" + }, + "joinValues": { + "default": true, + "description": "* 单选模式:当用户选中某个选项时,选项中的 value 将被作为该表单项的值提交,否则,整个选项对象都会作为该表单项的值提交。\n* 多选模式:选中的多个选项的 `value` 会通过 `delimiter` 连接起来,否则直接将以数组的形式提交值。", + "type": "boolean" + }, + "delimiter": { + "default": ",", + "description": "分割符", + "type": "string" + }, + "extractValue": { + "default": true, + "description": "开启后将选中的选项 value 的值封装为数组,作为当前表单项的值。", + "type": "boolean" + }, + "resetValue": { + "default": "", + "description": "清除时设置的值" + }, + "clearValue": { + "description": "是否显示清除按钮", + "type": "boolean" + }, + "checkAll": { + "default": "false", + "description": "开启后支持全选", + "type": "boolean" + }, + "checkAllLabel": { + "description": "默认为 全选, 全选的文字", + "type": "string" + }, + "defaultCheckAll": { + "default": "false", + "description": "是否默认全选", + "type": "boolean" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "select" + } + } + } + }, + "description": "Select选择框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/service.json b/schemas/form/service.json new file mode 100644 index 00000000..99b6a04d --- /dev/null +++ b/schemas/form/service.json @@ -0,0 +1,96 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/service.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/service.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|className|api|body|schemaApi|initFetch|fetchOn|messages|visible|visibleOn|hidden|hiddenOn)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "service", + "description": "指定为文本类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "Service格式说明", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "api": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "页面初始化的时候,可以设置一个 API 让其取拉取,发送数据会携带当前 data 数据(包含地址栏参数),获取得数据会合并到 data 中,供组件内使用。" + }, + "body": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "description": "内容区域" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "fetchOn": { + "default": true, + "description": "是否要拉取?通过表达式来决定", + "type": "string" + }, + "initFetch": { + "default": true, + "description": "是否默认就拉取?", + "type": "boolean" + }, + "initFetchOn": { + "default": true, + "description": "是否默认就拉取?通过表达式来决定", + "type": "string" + }, + "messages": { + "additionalProperties": false, + "properties": { + "fetchFailed": { + "description": "用来配置当 api 拉取失败时提示的信息", + "type": "string" + }, + "fetchSuccess": { + "description": "用来配置当 api 拉取成功时提示的信息,当然不设置的话就不会提示。", + "type": "string" + } + }, + "type": "object" + }, + "schemaApi": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "用来获取远程 Schema 的 api" + } + }, + "type": "object" + }, + "test": { + "properties": { + "type": { + "const": "service" + } + } + } + }, + "description": "Service格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/static.json b/schemas/form/static.json new file mode 100644 index 00000000..ad5d9337 --- /dev/null +++ b/schemas/form/static.json @@ -0,0 +1,91 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/static.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/static.json#/definitions/common" + }, + { + "dependencies": { + "value": [ + "name" + ] + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "description": "指定为静态类型", + "enum": [ + "static", + "static-plain", + "static-tpl", + "static-image", + "static-progress", + "static-date", + "static-mapping", + "static-status", + "static-list", + "static-hbox" + ] + } + }, + "type": "object", + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "Static FormItem 渲染器格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "text": { + "description": "不支持模板,要使用变量,请使用 tpl 渲染器。", + "title": "Text 字符串", + "type": "string" + }, + "tpl": { + "description": "支持模板, 可通过 $xxx 或者 ${xxx} 取值,或者直接用 lodash.tempalte 模板引擎。详情: https://baidu.github.io/amis/docs/renderers#tpl", + "title": "模板", + "type": "string" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "enum": [ + "static", + "static-plain", + "static-tpl", + "static-image", + "static-progress", + "static-date", + "static-mapping", + "static-status", + "static-list", + "static-hbox" + ] + } + } + } + }, + "description": "Static FormItem 渲染器格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/sub-form.json b/schemas/form/sub-form.json new file mode 100644 index 00000000..8e8e62ce --- /dev/null +++ b/schemas/form/sub-form.json @@ -0,0 +1,100 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/sub-form.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/sub-form.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|controls|addButtonClassName|btnClassName|btnLabel|editButtonClassName|form|labelField|maxLength|minLength|multiple|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "form", + "description": "指定为子表单类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "Text文本框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "controls": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/controls", + "description": "FormItem 集合" + }, + "addButtonClassName": { + "description": "新增按钮CSS类名", + "type": "string" + }, + "btnClassName": { + "description": "按钮CSS类名", + "type": "string" + }, + "btnLabel": { + "default": "点击设置", + "description": "按钮默认文字", + "type": "string" + }, + "editButtonClassName": { + "description": "编辑按钮CSS类名", + "type": "string" + }, + "form": { + "description": "字表单项设置" + }, + "labelField": { + "default": "label", + "description": "按钮默认显示的字段", + "type": "string" + }, + "maxLength": { + "description": "限制最大个数", + "type": "number" + }, + "minLength": { + "description": "限制最小个数", + "type": "number" + }, + "multiple": { + "description": "是否可多选", + "type": "boolean" + } + }, + "type": "object" + } + ], + "type": "object" + }, + "test": { + "properties": { + "type": { + "const": "form" + } + } + } + }, + "description": "Text文本框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/submit.json b/schemas/form/submit.json new file mode 100644 index 00000000..69a31173 --- /dev/null +++ b/schemas/form/submit.json @@ -0,0 +1,107 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/submit.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/submit.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|icon|size|level|iconOnly|action|tooltip|tooltipPlacement|disabledTip|actionType|api|target|reload|url|link|dialog|drawer|content|feedback|confirmText|blank|nextCondition|name|value|placeholder|label|remark|labelRemark|desc|description|className|inputClassName|labelClassName|descriptionClassName|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "submit", + "description": "指定为提交按钮类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "提交按钮格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "icon": { + "description": "按钮图标,请查看 fontAwesome http://fontawesome.io/icons/", + "type": "string" + }, + "label": { + "description": "按钮名字", + "type": "string" + }, + "level": { + "description": "按钮级别", + "enum": [ + "info", + "success", + "warning", + "danger", + "link", + "primary" + ], + "type": "string" + }, + "size": { + "description": "按钮大小", + "enum": [ + "xs", + "sm", + "md", + "lg" + ], + "type": "string" + }, + "tooltip": { + "description": "按钮提示文字,hover 时显示", + "type": "string" + }, + "tooltipPlacement": { + "default": "top", + "description": "按钮提示文字显示的位置", + "enum": [ + "left", + "top", + "right", + "bottom" + ], + "type": "string" + }, + "disabledTip": { + "description": "禁用时按钮提示文字,hover 时显示", + "type": "string" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "submit" + } + } + } + }, + "description": "提交按钮格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/switch.json b/schemas/form/switch.json new file mode 100644 index 00000000..8544b9dd --- /dev/null +++ b/schemas/form/switch.json @@ -0,0 +1,75 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/switch.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/switch.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|trueValue|falseValue|option|optionAtLeft|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "switch", + "description": "指定为开关" + } + }, + "type": "object", + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "开关格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "falseValue": { + "default": false, + "description": "未勾选值" + }, + "trueValue": { + "default": true, + "description": "勾选值" + }, + "option": { + "description": "选项说明", + "type": "string" + }, + "optionAtLeft": { + "default": "false", + "description": "选项说明放在左边,默认在右边", + "type": "boolean" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "switch" + } + } + } + }, + "description": "开关格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/table.json b/schemas/form/table.json new file mode 100644 index 00000000..305ef1b5 --- /dev/null +++ b/schemas/form/table.json @@ -0,0 +1,146 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/table.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/table.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|columns|addable|addApi|addBtnLabel|addBtnIcon|showAddBtn|removable|deleteApi|editable|updateBtnLabel|updateBtnIcon|confirmBtnLabel|confirmBtnIcon|cancelBtnLabel|cancelBtnIcon|deleteBtnLabel|deleteBtnIcon|updateApi|scaffold|deleteConfirmText|valueField|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "table", + "description": "指定为表格编辑类型" + } + }, + "type": "object", + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "Text文本框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "addable": { + "type": "boolean", + "description": "是否可新增" + }, + "removable": { + "type": "boolean", + "description": "是否可删除" + }, + "editable": { + "type": "boolean", + "description": "是否可修改" + }, + "draggable": { + "type": "boolean", + "description": "是否可拖拽排序" + }, + "columns": { + "description": "列信息配置" + }, + "addApi": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "添加API" + }, + "addBtnLabel": { + "description": "添加按钮文字", + "type": "string" + }, + "addBtnIcon": { + "description": "添加按钮图标", + "type": "string" + }, + "showAddBtn": { + "description": "是否显示添加按钮", + "type": "boolean" + }, + "deleteApi": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "删除API" + }, + "updateBtnLabel": { + "description": "编辑按钮文字", + "type": "string" + }, + "updateBtnIcon": { + "description": "编辑按钮图标", + "type": "string" + }, + "confirmBtnLabel": { + "description": "确认按钮文字", + "type": "string" + }, + "confirmBtnIcon": { + "description": "确认按钮图标", + "type": "string" + }, + "cancelBtnLabel": { + "description": "取消按钮文字", + "type": "string" + }, + "cancelBtnIcon": { + "description": "取消按钮图标", + "type": "string" + }, + "deleteBtnLabel": { + "description": "删除按钮文字", + "type": "string" + }, + "deleteBtnIcon": { + "description": "删除按钮图标", + "type": "string" + }, + "updateApi": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "更新API" + }, + "deleteConfirmText": { + "description": "确认删除文字", + "type": "string" + }, + "valueField": { + "description": "value的替代键值,默认为value", + "type": "string" + }, + "scaffold": { + "description": "初始值", + "type": "object" + } + }, + "type": "object" + } + ], + "type": "object" + }, + "test": { + "properties": { + "type": { + "const": "table" + } + } + } + }, + "description": "Text文本框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/tabs.json b/schemas/form/tabs.json new file mode 100644 index 00000000..2b3d99a5 --- /dev/null +++ b/schemas/form/tabs.json @@ -0,0 +1,147 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/tabs.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/tabs.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|className|hiddenOn|tabClassName|tabs|visibleOn|visible|hidden)$": {} + }, + "properties": { + "$schema": { + "description": "绑定 JSON 格式说明,可忽略!", + "format": "uri", + "type": "string" + }, + "type": { + "const": "tabs", + "description": "指定当前 JSON 为 tabs 渲染器。" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "AMis Tabs 渲染器格式说明", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 Tabs className" + }, + "hiddenOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前表单项是否隐藏。" + }, + "tabClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 Tab className" + }, + "tabs": { + "description": "选项卡信息", + "items": { + "$ref": "https://houtai.baidu.com/v2/schemas/form/tabs.json#/definitions/tab", + "type": ["object"] + }, + "type": "array" + }, + "visibleOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前表单项是否显示" + } + }, + "type": "object" + }, + "tab": { + "additionalProperties": false, + "properties": { + "body": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "title": "内容区域" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 fieldSet className" + }, + "controls": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/controls", + "description": "FormItem 集合" + }, + "disabledOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前 Tab 是否禁用。" + }, + "hiddenOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前 Tab 是否隐藏。" + }, + "horizontal": { + "additionalProperties": false, + "default": { + "left": "col-sm-2", + "offset": "col-sm-offset-2", + "right": "col-sm-10" + }, + "description": "当 mode 为 horizontal 时有用,用来控制 label 和 input 的宽度占比。", + "properties": { + "left": { + "type": "string" + }, + "offset": { + "type": "string" + }, + "right": { + "type": "string" + } + }, + "type": "object" + }, + "icon": { + "description": "图标", + "type": "string" + }, + "mode": { + "default": "normal", + "description": "表单展示方式,可以是:normal、horizontal 或者 inline。示例:https://baidu.github.io/amis/docs/demo/forms/mode", + "enum": [ + "normal", + "horizontal", + "inline" + ], + "type": "string" + }, + "title": { + "description": "标题", + "type": "string" + }, + "hash": { + "description": "链接中的hash", + "type": "string" + }, + "visibleOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前 Tab 是否显示" + } + }, + "type": "object" + }, + "test": { + "properties": { + "type": { + "const": "tabs" + } + } + } + }, + "description": "AMis Tabs 渲染器格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/tag.json b/schemas/form/tag.json new file mode 100644 index 00000000..94a35214 --- /dev/null +++ b/schemas/form/tag.json @@ -0,0 +1,98 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/tag.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/text.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|options|source|optionsTip|clearable|resetValue|hint|joinValues|delimiter|extractValue|name|value|placeholder|label|remark|labelRemark|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "description": "绑定 JSON 格式说明,可忽略!", + "format": "uri", + "type": "string" + }, + "type": { + "const": "tag", + "description": "指定为标签类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "Tag标签输入格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "hint": { + "description": "当输入框获得焦点的时候显示,用来提示用户输入内容", + "type": "string" + }, + "optionsTip": { + "description": "选项提示", + "type": "string" + }, + "source": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "可用来通过 API 拉取 options。详情:https://baidu.github.io/amis/docs/api#formitem,也可以从当前作用域拉取数据 $typeOptions" + }, + "options": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/optionsType", + "description": "选项集合" + }, + "joinValues": { + "default": true, + "description": "* 单选模式:当用户选中某个选项时,选项中的 value 将被作为该表单项的值提交,否则,整个选项对象都会作为该表单项的值提交。\n* 多选模式:选中的多个选项的 `value` 会通过 `delimiter` 连接起来,否则直接将以数组的形式提交值。", + "type": "boolean" + }, + "delimiter": { + "default": ",", + "description": "分割符", + "type": "string" + }, + "extractValue": { + "default": true, + "description": "开启后将选中的选项 value 的值封装为数组,作为当前表单项的值。", + "type": "boolean" + }, + "resetValue": { + "default": "", + "description": "清除时设置的值" + }, + "clearValue": { + "description": "是否显示清除按钮", + "type": "boolean" + } + }, + "type": "object" + } + ], + "type": "object" + }, + "test": { + "properties": { + "type": { + "const": "text" + } + } + } + }, + "description": "Text文本框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/text.json b/schemas/form/text.json new file mode 100644 index 00000000..203c7eaf --- /dev/null +++ b/schemas/form/text.json @@ -0,0 +1,181 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/text.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/text.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|options|source|autoComplete|clearable|resetValue|inputOnly|readOnly|hint|trimContents|addOn|size|multiple|joinValues|delimiter|extractValue|name|value|placeholder|label|remark|labelRemark|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "description": "绑定 JSON 格式说明,可忽略!", + "format": "uri", + "type": "string" + }, + "type": { + "const": "text", + "description": "指定为文本类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "Text文本框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "hint": { + "description": "当输入框获得焦点的时候显示,用来提示用户输入内容", + "type": "string" + }, + "inputOnly": { + "default": "false", + "description": "是否只有输入框,没有label和addOn", + "type": "boolean" + }, + "readOnly": { + "default": "false", + "description": "是否只读", + "type": "boolean" + }, + "trimContents": { + "default": "false", + "description": "是否去除首尾空白", + "type": "boolean" + }, + "size": { + "default": "full", + "description": "表单项大小,可以是:xs, sm, base, md, lg。", + "enum": [ + "xs", + "sm", + "base", + "md", + "lg" + ], + "type": "string" + }, + "addOn": { + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#/definitions/baseAction" + }, + { + "properties": { + "icon": { + "description": "按钮图标,请查看 fontAwesome http://fontawesome.io/icons/", + "type": "string" + }, + "label": { + "description": "文本", + "type": "string" + }, + "level": { + "description": "按钮级别", + "enum": [ + "info", + "success", + "warning", + "danger", + "link", + "primary" + ], + "type": "string" + }, + "type": { + "description": "定义类型,只支持:text、button和submit。", + "enum": [ + "text", + "button", + "submit" + ], + "type": "string" + }, + "position": { + "description": "addOn 的位置", + "type": "string", + "enum": [ + "left", + "right" + ] + } + }, + "type": "object" + } + ], + "description": "输入框附加组件", + "type": "object" + }, + "source": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "可用来通过 API 拉取 options。详情:https://baidu.github.io/amis/docs/api#formitem,也可以从当前作用域拉取数据 $typeOptions" + }, + "autoComplete": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "跟 source 不同的是,每次用户输入都会去接口获取提示,请不要跟 source 同时使用。" + }, + "options": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/optionsType", + "description": "选项集合" + }, + "multiple": { + "default": false, + "description": "是否为多选", + "type": "boolean" + }, + "joinValues": { + "default": true, + "description": "* 单选模式:当用户选中某个选项时,选项中的 value 将被作为该表单项的值提交,否则,整个选项对象都会作为该表单项的值提交。\n* 多选模式:选中的多个选项的 `value` 会通过 `delimiter` 连接起来,否则直接将以数组的形式提交值。", + "type": "boolean" + }, + "delimiter": { + "default": ",", + "description": "分割符", + "type": "string" + }, + "extractValue": { + "default": true, + "description": "开启后将选中的选项 value 的值封装为数组,作为当前表单项的值。", + "type": "boolean" + }, + "resetValue": { + "default": "", + "description": "清除时设置的值" + }, + "clearValue": { + "description": "是否显示清除按钮", + "type": "boolean" + } + }, + "type": "object" + } + ], + "type": "object" + }, + "test": { + "properties": { + "type": { + "const": "text" + } + } + } + }, + "description": "Text文本框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/textarea.json b/schemas/form/textarea.json new file mode 100644 index 00000000..e034fa0a --- /dev/null +++ b/schemas/form/textarea.json @@ -0,0 +1,77 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/textarea.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/textarea.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|minRows|maxRows|hint|trimContents|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "textarea", + "description": "指定为多行文本框" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "Textarea多行文本框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "hint": { + "description": "当输入框获得焦点的时候显示,用来提示用户输入内容", + "type": "string" + }, + "trimContents": { + "default": "false", + "description": "是否去除首尾空白", + "type": "boolean" + }, + "maxRows": { + "default": 20, + "description": "最大行数", + "type": "number" + }, + "minRows": { + "default": 3, + "description": "最小行数", + "type": "number" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "textarea" + } + } + } + }, + "description": "Textarea多行文本框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/time.json b/schemas/form/time.json new file mode 100644 index 00000000..69a7368d --- /dev/null +++ b/schemas/form/time.json @@ -0,0 +1,81 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/time.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/time.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|format|inputFormat|timeFormat|clearable|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "time", + "description": "指定为时间输入类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "时间输入框格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "clearable": { + "default": true, + "description": "是否显示清除按钮", + "type": "boolean" + }, + "format": { + "default": "X", + "description": "默认 `X` 即时间戳格式,用来提交的时间格式。更多格式类型请参考 moment.", + "type": "string" + }, + "inputFormat": { + "default": "HH:mm", + "description": "默认 `HH:mm` 用来配置显示的时间格式。", + "type": "string" + }, + "timeFormat": { + "default": "HH:mm", + "description": "默认 `HH:mm` 用来配置选择的时间格式。", + "type": "string" + }, + "value": { + "description": "这里面 value 需要特殊说明一下,因为支持相对值。* `-2mins` 2分钟前\n * `+2days` 2天后\n* `-10week` 十周前\n可用单位: `min`、`hour`、`day`、`week`、`month`、`year`。所有单位支持复数形式。" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "time" + } + } + } + }, + "description": "时间输入框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/tree-select.json b/schemas/form/tree-select.json new file mode 100644 index 00000000..8f289fc7 --- /dev/null +++ b/schemas/form/tree-select.json @@ -0,0 +1,129 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/tree-select.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/tree.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|hideRoot|rootLabel|showIcon|showRadio|cascade|withChildren|rootValue|options|source|multiple|joinValues|delimiter|extractValue|clearable|resetValue|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "tree-select", + "description": "指定为树形选择输入框类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "TreeSelect 格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "hideRoot": { + "default": false, + "description": "是否显示顶级节点", + "type": "boolean" + }, + "rootLabel": { + "description": "顶级节点显示名称", + "type": "string" + }, + "rootValue": { + "description": "顶级节点值", + "type": "string" + }, + "showIcon": { + "default": "false", + "description": "是否只有选项前的图标", + "type": "boolean" + }, + "showRadio": { + "default": "false", + "description": "是否单选框", + "type": "boolean" + }, + "label": { + "description": "文本", + "type": "string" + }, + "source": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "可用来通过 API 拉取 options。详情:https://baidu.github.io/amis/docs/api#formitem" + }, + "options": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/nestedOptionsType", + "description": "选项集合" + }, + "cascade": { + "type": "boolean", + "description": "不自动选中子节点?" + }, + "withChildren": { + "type": "boolean", + "description": "数值是否携带子节点" + }, + "multiple": { + "default": false, + "description": "是否为多选", + "type": "boolean" + }, + "joinValues": { + "default": true, + "description": "* 单选模式:当用户选中某个选项时,选项中的 value 将被作为该表单项的值提交,否则,整个选项对象都会作为该表单项的值提交。\n* 多选模式:选中的多个选项的 `value` 会通过 `delimiter` 连接起来,否则直接将以数组的形式提交值。", + "type": "boolean" + }, + "delimiter": { + "default": ",", + "description": "分割符", + "type": "string" + }, + "extractValue": { + "default": true, + "description": "开启后将选中的选项 value 的值封装为数组,作为当前表单项的值。", + "type": "boolean" + }, + "resetValue": { + "default": "", + "description": "清除时设置的值" + }, + "clearValue": { + "description": "是否显示清除按钮", + "type": "boolean" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "tree-select" + } + } + } + }, + "description": "TreeSelect 格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/tree.json b/schemas/form/tree.json new file mode 100644 index 00000000..0fa76c45 --- /dev/null +++ b/schemas/form/tree.json @@ -0,0 +1,129 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/tree.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/tree.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|hideRoot|rootLabel|showIcon|showRadio|cascade|withChildren|rootValue|options|source|multiple|joinValues|delimiter|extractValue|clearable|resetValue|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "tree", + "description": "指定为树形输入框类型" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "Tree 格式说明", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "hideRoot": { + "default": false, + "description": "是否显示顶级节点", + "type": "boolean" + }, + "rootLabel": { + "description": "顶级节点显示名称", + "type": "string" + }, + "rootValue": { + "description": "顶级节点值", + "type": "string" + }, + "showIcon": { + "default": "false", + "description": "是否只有选项前的图标", + "type": "boolean" + }, + "showRadio": { + "default": "false", + "description": "是否单选框", + "type": "boolean" + }, + "label": { + "description": "文本", + "type": "string" + }, + "source": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "可用来通过 API 拉取 options。详情:https://baidu.github.io/amis/docs/api#formitem" + }, + "options": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/nestedOptionsType", + "description": "选项集合" + }, + "cascade": { + "type": "boolean", + "description": "不自动选中子节点?" + }, + "withChildren": { + "type": "boolean", + "description": "数值是否携带子节点" + }, + "multiple": { + "default": false, + "description": "是否为多选", + "type": "boolean" + }, + "joinValues": { + "default": true, + "description": "* 单选模式:当用户选中某个选项时,选项中的 value 将被作为该表单项的值提交,否则,整个选项对象都会作为该表单项的值提交。\n* 多选模式:选中的多个选项的 `value` 会通过 `delimiter` 连接起来,否则直接将以数组的形式提交值。", + "type": "boolean" + }, + "delimiter": { + "default": ",", + "description": "分割符", + "type": "string" + }, + "extractValue": { + "default": true, + "description": "开启后将选中的选项 value 的值封装为数组,作为当前表单项的值。", + "type": "boolean" + }, + "resetValue": { + "default": "", + "description": "清除时设置的值" + }, + "clearValue": { + "description": "是否显示清除按钮", + "type": "boolean" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "tree" + } + } + } + }, + "description": "Tree 格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/form/url.json b/schemas/form/url.json new file mode 100644 index 00000000..fc36e7f4 --- /dev/null +++ b/schemas/form/url.json @@ -0,0 +1,157 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/form/url.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form/url.json#/definitions/common" + }, + { + "additionalProperties": false, + "patternProperties": { + "^(\\$ref|options|source|autoComplete|clearable|resetValue|hint|trimContents|addOn|size|multiple|joinValues|delimiter|extractValue|name|value|placeholder|label|remark|labelRemark|desc|description|inline|mode|horizontal|className|labelClassName|inputClassName|descriptionClassName|validations|validationErrors|validateOnChange|submitOnChange|disabled|disabledOn|visible|visibleOn|hidden|hiddenOn|required)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "url", + "description": "指定为 Url 输入框" + } + }, + "type": "object", + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item" + }, + { + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "addOn": { + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#/definitions/baseAction" + }, + { + "properties": { + "trimContents": { + "default": "false", + "description": "是否去除首尾空白", + "type": "boolean" + }, + "icon": { + "description": "按钮图标,请查看 fontAwesome http://fontawesome.io/icons/", + "type": "string" + }, + "label": { + "description": "文本", + "type": "string" + }, + "level": { + "description": "按钮级别", + "enum": [ + "info", + "success", + "warning", + "danger", + "link", + "primary" + ], + "type": "string" + }, + "type": { + "description": "定义类型,只支持:text、button和submit。", + "enum": [ + "text", + "button", + "submit" + ], + "type": "string" + }, + "position": { + "description": "AddOn 的位置", + "type": "string", + "enum": [ + "left", + "right" + ] + } + }, + "type": "object" + } + ], + "description": "输入框附加组件", + "type": "object" + }, + "hint": { + "description": "当输入框获得焦点的时候显示,用来提示用户输入内容", + "type": "string" + }, + "source": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "可用来通过 API 拉取 options。详情:https://baidu.github.io/amis/docs/api#formitem,也可以从当前作用域拉取数据 $typeOptions" + }, + "autoComplete": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "跟 source 不同的是,每次用户输入都会去接口获取提示,请不要跟 source 同时使用。" + }, + "options": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/optionsType", + "description": "选项集合" + }, + "multiple": { + "default": false, + "description": "是否为多选", + "type": "boolean" + }, + "joinValues": { + "default": true, + "description": "* 单选模式:当用户选中某个选项时,选项中的 value 将被作为该表单项的值提交,否则,整个选项对象都会作为该表单项的值提交。\n* 多选模式:选中的多个选项的 `value` 会通过 `delimiter` 连接起来,否则直接将以数组的形式提交值。", + "type": "boolean" + }, + "delimiter": { + "default": ",", + "description": "分割符", + "type": "string" + }, + "extractValue": { + "default": true, + "description": "开启后将选中的选项 value 的值封装为数组,作为当前表单项的值。", + "type": "boolean" + }, + "resetValue": { + "default": "", + "description": "清除时设置的值" + }, + "clearValue": { + "description": "是否显示清除按钮", + "type": "boolean" + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "url" + } + } + } + }, + "description": "Url 输入框格式说明", + "type": "object" +} \ No newline at end of file diff --git a/schemas/grid.json b/schemas/grid.json new file mode 100644 index 00000000..34f78f26 --- /dev/null +++ b/schemas/grid.json @@ -0,0 +1,208 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/grid.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/grid.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|columns|className)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "grid", + "type": "string" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "column": { + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/subRenderer" + }, + { + "$ref": "https://houtai.baidu.com/v2/schemas/grid.json#/definitions/commonColumn" + } + ], + "description": "列" + }, + "columns": { + "description": "列集合", + "items": { + "oneOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/grid.json#/definitions/column" + }, + { + "$ref": "https://houtai.baidu.com/v2/schemas/grid.json#/definitions/columns", + "description": "列集合, 不推荐,建议再包一个 grid 如果真有必要。" + } + ] + }, + "type": "array" + }, + "common": { + "description": "AMis Grid 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#grid", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "className": { + "description": "外层 CSS 类名", + "type": "string" + }, + "columns": { + "$ref": "https://houtai.baidu.com/v2/schemas/grid.json#/definitions/columns" + } + }, + "type": "object" + }, + "commonColumn": { + "properties": { + "columnClassName": { + "description": "列类名" + }, + "lg": { + "description": "大屏时(>=1200px)宽度占比", + "maximum": 12, + "minimum": 1, + "type": "integer" + }, + "lgHidden": { + "default": false, + "description": "大屏时(>=1200px)是否隐藏该列", + "type": "boolean" + }, + "lgOffset": { + "description": "大屏时(>=1200px)宽度偏移量", + "maximum": 12, + "minimum": 1, + "type": "integer" + }, + "lgPull": { + "description": "大屏时(>=1200px)宽度右偏移量", + "maximum": 12, + "minimum": 1, + "type": "integer" + }, + "lgPush": { + "description": "大屏时(>=1200px)宽度左偏移量", + "maximum": 12, + "minimum": 1, + "type": "integer" + }, + "md": { + "description": "中屏时(>=992px)宽度占比", + "maximum": 12, + "minimum": 1, + "type": "integer" + }, + "mdHidden": { + "default": false, + "description": "中屏时(>=992px)是否隐藏该列", + "type": "boolean" + }, + "mdOffset": { + "description": "中屏时(>=992px)宽度偏移量", + "maximum": 12, + "minimum": 1, + "type": "integer" + }, + "mdPull": { + "description": "中屏时(>=992px)宽度右偏移量", + "maximum": 12, + "minimum": 1, + "type": "integer" + }, + "mdPush": { + "description": "中屏时(>=992px)宽度左偏移量", + "maximum": 12, + "minimum": 1, + "type": "integer" + }, + "sm": { + "description": "小屏时(>=768px)宽度占比", + "maximum": 12, + "minimum": 1, + "type": "integer" + }, + "smHidden": { + "default": false, + "description": "小屏时(>=768px)是否隐藏该列", + "type": "boolean" + }, + "smOffset": { + "description": "小屏时(>=768px)宽度偏移量", + "maximum": 12, + "minimum": 1, + "type": "integer" + }, + "smPull": { + "description": "小屏时(>=768px)宽度右偏移量", + "maximum": 12, + "minimum": 1, + "type": "integer" + }, + "smPush": { + "description": "小屏时(>=768px)宽度左偏移量", + "maximum": 12, + "minimum": 1, + "type": "integer" + }, + "xs": { + "description": "极小屏(<768px)时宽度占比", + "maximum": 12, + "minimum": 1, + "type": "integer" + }, + "xsHidden": { + "default": false, + "description": "极小屏(<768px)时是否隐藏该列", + "type": "boolean" + }, + "xsOffset": { + "description": "极小屏(<768px)时宽度偏移量", + "maximum": 12, + "minimum": 1, + "type": "integer" + }, + "xsPull": { + "description": "极小屏(<768px)时宽度右偏移量", + "maximum": 12, + "minimum": 1, + "type": "integer" + }, + "xsPush": { + "description": "极小屏(<768px)时宽度左偏移量", + "maximum": 12, + "minimum": 1, + "type": "integer" + } + }, + "type": "object" + }, + "test": { + "properties": { + "type": { + "const": "grid" + } + } + } + }, + "description": "AMis Grid 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#grid", + "type": "object" +} \ No newline at end of file diff --git a/schemas/hbox.json b/schemas/hbox.json new file mode 100644 index 00000000..e99db1a0 --- /dev/null +++ b/schemas/hbox.json @@ -0,0 +1,85 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/hbox.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/hbox.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|columns|className)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "hbox", + "description": "指定为 hbox 类型", + "type": "string" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "column": { + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/subRenderer" + }, + { + "$ref": "https://houtai.baidu.com/v2/schemas/grid.json#/definitions/commonColumn" + } + ], + "description": "列" + }, + "columns": { + "description": "列集合", + "items": { + "$ref": "https://houtai.baidu.com/v2/schemas/hbox.json#/definitions/column" + }, + "type": "array" + }, + "common": { + "description": "AMis Grid 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#hbox", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "columns": { + "$ref": "https://houtai.baidu.com/v2/schemas/hbox.json#/definitions/columns", + "description": "列集合" + } + } + }, + "commonColumn": { + "properties": { + "columnClassName": { + "description": "列类名" + } + }, + "type": "object" + }, + "test": { + "properties": { + "type": { + "const": "hbox" + } + } + } + }, + "description": "AMis Grid 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#hbox", + "type": "object" +} \ No newline at end of file diff --git a/schemas/iframe.json b/schemas/iframe.json new file mode 100644 index 00000000..19437271 --- /dev/null +++ b/schemas/iframe.json @@ -0,0 +1,84 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/iframe.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/iframe.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|src|style|className|bodyClassName|body|size)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "iframe", + "description": "指定为iframe类型", + "type": "string" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "AMis iframe 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#iframe", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "src": { + "type": "string", + "description": "iframe 地址" + }, + "width": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ], + "description": "iframe 的宽度" + }, + "height": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ], + "description": "iframe 的高度" + }, + "style": { + "description": "样式表" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + } + } + }, + "test": { + "properties": { + "type": { + "const": "iframe" + } + } + } + }, + "description": "AMis iframe 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#iframe", + "type": "object" +} \ No newline at end of file diff --git a/schemas/image.json b/schemas/image.json new file mode 100644 index 00000000..942bbfef --- /dev/null +++ b/schemas/image.json @@ -0,0 +1,72 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/image.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/image.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|className|title|description|defaultImage|src|label|name|popOver|quickEdit|sortable|searchable|toggled|fixed)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "image", + "description": "指定为图片展示类型", + "type": "string" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "AMis image 渲染器格式说明。", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "defaultImage": { + "description": "默认图片地址", + "type": "string" + }, + "description": { + "description": "图片标题", + "type": "string" + }, + "src": { + "description": "固定图片地址", + "type": "string" + }, + "title": { + "description": "图片标题", + "type": "string" + } + } + }, + "test": { + "properties": { + "type": { + "const": "image" + } + } + } + }, + "description": "AMis image 渲染器格式说明。", + "type": "object" +} \ No newline at end of file diff --git a/schemas/json.json b/schemas/json.json new file mode 100644 index 00000000..4cd3c5fe --- /dev/null +++ b/schemas/json.json @@ -0,0 +1,60 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/json.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/json.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|className|title|description|defaultImage|src|label|name|popOver|quickEdit|sortable|searchable|toggled|fixed)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "json", + "description": "指定为Json展示类型", + "type": "string" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "AMis Json 渲染器格式说明。", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "levelExpand": { + "type": "number", + "description": "默认展开的级别" + } + } + }, + "test": { + "properties": { + "type": { + "const": "json" + } + } + } + }, + "description": "AMis Json 渲染器格式说明。", + "type": "object" +} \ No newline at end of file diff --git a/schemas/list.json b/schemas/list.json new file mode 100644 index 00000000..5cf82fef --- /dev/null +++ b/schemas/list.json @@ -0,0 +1,306 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/list.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/table.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|showHeader|showFooter|listItem|data|className|footerClassName|headerClassName|placeholder|source|title|toolbarClassName|header|footer)$": {} + }, + "properties": { + "$schema": { + "description": "绑定 JSON 格式说明,可忽略!", + "format": "uri", + "type": "string" + }, + "type": { + "const": "list", + "description": "指定为 list 类型", + "type": "string" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "body": { + "description": "内容容器", + "oneOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/list.json#/definitions/field" + }, + { + "items": { + "oneOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/list.json#/definitions/field" + }, + { + "description": "**不推荐使用数组,请用 hbox 包裹**", + "items": { + "$ref": "https://houtai.baidu.com/v2/schemas/list.json#/definitions/field" + }, + "type": "array" + } + ] + }, + "type": "array" + } + ] + }, + "common": { + "description": "AMis list 渲染器格式说明。", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "className": { + "default": "panel-default", + "description": "外层 CSS 类名", + "type": "string" + }, + "data": { + "description": "默认的数据" + }, + "footer": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "description": "底部容器" + }, + "footerClassName": { + "default": "crud-list-footer", + "description": "底部外层 CSS 类名", + "type": "string" + }, + "header": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "description": "顶部容器" + }, + "headerClassName": { + "default": "amis-list-header", + "description": "顶部外层 CSS 类名", + "type": "string" + }, + "listItem": { + "description": "成员内容配置", + "properties": { + "actions": { + "items": { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#" + }, + "type": "array" + }, + "avatar": { + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/tpl", + "description": "头像,支持tpl" + }, + "body": { + "$ref": "https://houtai.baidu.com/v2/schemas/list.json#/definitions/body" + }, + "desc": { + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/tpl", + "description": "描述,支持tpl" + }, + "remark": { + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/tpl", + "description": "tooltip 说明" + }, + "subTitle": { + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/tpl", + "description": "副标题, 支持tpl" + }, + "title": { + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/tpl", + "description": "标题, 支持tpl" + } + }, + "type": "object" + }, + "placeholder": { + "description": "占位符" + }, + "showFooter": { + "default": true, + "description": "是否显示底部", + "type": "boolean" + }, + "showHeader": { + "default": true, + "description": "是否显示头部", + "type": "boolean" + }, + "source": { + "description": "数据源:绑定当前环境变量" + } + }, + "type": "object" + }, + "field": { + "allOf": [ + { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/image.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/image.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/date.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/date.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/status.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/status.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/mapping.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/mapping.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/progress.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/progress.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/switch.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/switch.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/hbox.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/hbox.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/grid.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/grid.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/json.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/json.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/list.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/list.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/operation.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/operation.json#/definitions/common" + }, + "else": { + "$ref": "https://houtai.baidu.com/v2/schemas/plain.json#/definitions/common" + } + } + } + } + } + } + } + } + } + } + } + } + }, + { + "properties": { + "label": { + "description": "字段名称", + "type": "string" + }, + "name": { + "description": "绑定字段名", + "type": "string" + }, + "popOver": { + "description": "配置查看详情功能", + "oneOf": [ + { + "type": "boolean" + }, + { + "properties": {}, + "type": "object" + } + ] + }, + "quickEdit": { + "description": "配置快速编辑功能", + "oneOf": [ + { + "type": "boolean" + }, + { + "properties": {}, + "type": "object" + } + ] + }, + "copyable": { + "description": "配置点击复制功能", + "oneOf": [ + { + "type": "boolean" + }, + { + "properties": {}, + "type": "object" + } + ] + } + }, + "type": "object" + } + ] + }, + "test": { + "properties": { + "type": { + "const": "list" + } + } + } + }, + "description": "AMis list 渲染器格式说明。", + "type": "object" +} \ No newline at end of file diff --git a/schemas/mapping.json b/schemas/mapping.json new file mode 100644 index 00000000..1f5e57b7 --- /dev/null +++ b/schemas/mapping.json @@ -0,0 +1,75 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/mapping.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/mapping.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|className|map|placeholder|label|name|popOver|quickEdit|sortable|searchable|toggled|fixed)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "description": "指定为映射展示类型", + "enum": [ + "mapping", + "map" + ], + "type": "string" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "AMis mapping 渲染器格式说明。", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "map": { + "description": "当值命中左侧 Key 时,展示右侧内容,当没有命中时,默认实现 Key 为 *的内容", + "patternProperties": { + ".*": { + "type": "string" + } + }, + "type": "object" + }, + "placeholder": { + "description": "占位符", + "type": "string" + } + } + }, + "test": { + "properties": { + "type": { + "enum": [ + "map", + "mapping" + ] + } + } + } + }, + "description": "AMis mapping 渲染器格式说明。", + "type": "object" +} \ No newline at end of file diff --git a/schemas/nav.json b/schemas/nav.json new file mode 100644 index 00000000..7ac1d96b --- /dev/null +++ b/schemas/nav.json @@ -0,0 +1,79 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/nav.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/nav.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|className|stacked|links)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "nav", + "description": "指定为导航类型", + "type": "string" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "AMis Nav 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#nav", + "properties": { + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "links": { + "items": { + "properties": { + "icon": { + "description": "图标类名,参考 fontawesome。", + "type": "string" + }, + "label": { + "description": "文字说明", + "type": "string" + }, + "to": { + "description": "Link 地址。", + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + }, + "stacked": { + "description": "true 为垂直排列,false 为水平排列类似如 tabs。", + "type": "boolean" + } + } + }, + "test": { + "properties": { + "type": { + "enum": ["nav", "navigation"] + } + } + } + }, + "description": "AMis Nav 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#nav", + "type": "object" +} \ No newline at end of file diff --git a/schemas/operation.json b/schemas/operation.json new file mode 100644 index 00000000..bd776774 --- /dev/null +++ b/schemas/operation.json @@ -0,0 +1,63 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/operation.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/operation.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(className|buttons|placeholder|label|name|popOver|quickEdit|sortable|searchable|toggled|fixed)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "operation", + "description": "指定为状态展示类型", + "type": "string" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "AMis operation 渲染器格式说明。", + "properties": { + "buttons": { + "description": "操作按钮集合", + "items": { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#" + }, + "type": "array" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "placeholder": { + "description": "占位符", + "type": "string" + } + } + }, + "test": { + "properties": { + "type": { + "const": "operation" + } + } + } + }, + "description": "AMis operation 渲染器格式说明。", + "type": "object" +} \ No newline at end of file diff --git a/schemas/page.json b/schemas/page.json new file mode 100644 index 00000000..3c05fe7c --- /dev/null +++ b/schemas/page.json @@ -0,0 +1,507 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/page.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "additionalProperties": false, + "definitions": { + "$ref": { + "description": "引用page下已经定义好的类型", + "type": "string" + }, + "api": { + "description": "服务端 API 地址, 可以配置 `$varName` 做变量替换", + "oneOf": [ + { + "descriptions": "例如: `get:http://www.baidu.com/` 可以使用 $var 或者 ${var} 从容器 data 中获取变量。\n 注意:为了不暴露 API 地址,默认会被替换成 AMis 中转,如果不想被转义请这样配置 `raw:http://www.baidu.com` \n 另外,如果代理的话,默认只能请求内网服务,如需访问外网服务,请这样配置 `external:http://www.com/api/doXX`", + "type": "string" + }, + { + "additionalProperties": false, + "properties": { + "data": { + "default": { + "&": "$$" + }, + "description": "用来控制携带数据. 当key 为 `&` 值为 `$$` 时, 将所有原始数据打平设置到 data 中. 当值为 $$ 将所有原始数据赋值到对应的 key 中. 当值为 $ 打头时, 将变量值设置到 key 中.", + "type": "object" + }, + "dataType": { + "default": "json", + "description": "发送体的格式", + "enum": [ + "form-data", + "json" + ], + "type": "string" + }, + "responseType": { + "default": "", + "description": "接口返回数据类型,当做文件下载时请配置为 blob。", + "enum": [ + "blob" + ], + "type": "string" + }, + "headers": { + "description": "携带 headers,用法和 data 一样,可以用变量。", + "type": "object" + }, + "method": { + "default": "get", + "enum": [ + "get", + "post", + "put", + "delete" + ] + }, + "url": { + "$ref": "#/definitions/url", + "description": "当 url 中存在 $$ 会被替换成所有的值 json 序列化. 当 $key 时替换成对应的值." + }, + "sendOn": { + "type": "string", + "description": "设置发送条件" + } + }, + "required": [ + "url" + ], + "type": "object" + } + ] + }, + "className": { + "description": "用来配置 dom class 名字", + "pattern": "^([a-zA-Z][a-zA-Z0-9\\-_]*(?:\\s+|$))*$", + "type": "string" + }, + "container": { + "oneOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/string", + "description": "当值为字符串时会被当做模板来处理,要指定其他渲染类型请使用对象定义如:\n{\n\n\t \"type\": \"form\" \n } \n 可通过 $xxx 或者 ${xxx} 取值,或者直接用 lodash.template 模板引擎。\n\n详情: https://baidu.github.io/amis/docs/renderers#tpl" + }, + { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/subRenderer" + }, + { + "items": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container" + }, + "type": "array" + } + ] + }, + "expression": { + "description": "Js 表达式。如 data.type == 1", + "type": "string" + }, + "name": { + "description": "变量名称", + "pattern": "^[a-zA-Z_][a-zA-Z0-9_\\-]*$", + "type": "string" + }, + "string": { + "description": "支持模板, 可通过 $xxx 或者 ${xxx} 取值,或者直接用 lodash.template 模板引擎。详情: https://baidu.github.io/amis/docs/renderers#tpl", + "type": "string" + }, + "stringOrNull": { + "description": "字符或者 null", + "oneOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "customRenderer": { + "description": "自定组件,非系统组件,请确保你已在自定义组件中添加了对应的组件。", + "properties": { + "type": { + "type": "string" + } + }, + "required": [ + "type" + ], + "title": "自定义渲染器", + "type": "object" + }, + "subRenderer": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/button-group.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/button-group.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/cards.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/cards.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/chart.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/chart.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/collapse.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/collapse.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/divider.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/divider.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/crud.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/crud.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/date.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/date.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/dropdown-button.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/dropdown-button.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/grid.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/grid.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/hbox.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/hbox.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/iframe.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/iframe.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/image.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/image.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/json.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/json.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/list.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/list.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/mapping.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/mapping.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/nav.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/nav.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/operation.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/operation.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/panel.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/panel.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/plain.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/plain.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/progress.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/progress.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/service.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/service.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/status.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/status.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/switch.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/switch.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/table.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/table.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/tabs.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/tabs.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/tasks.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/tasks.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/video.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/video.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/wizard.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/wizard.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/wrapper.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/wrapper.json#/definitions/common" + }, + "else": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/customRenderer" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + }, + "tpl": { + "description": "支持模板, 可通过 $xxx 或者 ${xxx} 取值,或者直接用 lodash.template 模板引擎。详情: https://baidu.github.io/amis/docs/renderers#tpl", + "title": "模板", + "type": "string" + }, + "url": { + "_pattern": "^(?:raw)?(?:https?:\\/\\/[^\\/]+|[A-Z][A-Z_0-9]*)?(?:\\/(?:\\w)*)+(?:\\?.*)?$", + "type": "string" + }, + "varName": { + "description": "变量名称", + "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$", + "type": "string" + } + }, + "description": "AMis Page 渲染器。详情请见:https://baidu.github.io/amis/docs/renderers#page", + "properties": { + "$schema": { + "description": "绑定 JSON 格式说明,可忽略!", + "format": "uri", + "type": "string" + }, + "aside": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "title": "左边栏容器" + }, + "asideClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置 aside 容器 className" + }, + "body": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "title": "页面内容区域" + }, + "bodyClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置 body 容器 className" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "data": { + "description": "初始数据,设置得值可用于组件内部模板使用。", + "type": "object" + }, + "headerClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置 header 容器 className" + }, + "initApi": { + "$ref": "#/definitions/api", + "description": "页面初始化的时候,可以设置一个 API 让其取拉取,发送数据会携带当前 data 数据(包含地址栏参数),获取得数据会合并到 data 中,供组件内使用。" + }, + "initFetch": { + "default": true, + "description": "是否默认就拉取?", + "type": "boolean" + }, + "initFetchOn": { + "description": "是否默认就拉取?通过表达式来决定", + "type": "string" + }, + "messages": { + "additionalProperties": false, + "properties": { + "fetchFailed": { + "description": "用来配置当 initApi 拉取失败时提示的信息", + "type": "string" + }, + "fetchSuccess": { + "description": "用来配置当 initApi 拉取成功时提示的信息,当然不设置的话就不会提示。", + "type": "string" + } + }, + "type": "object" + }, + "name": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/name", + "description": "给当前组件设定一个名,方便其他组件引用。" + }, + "remark": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/stringOrNull", + "description": "页面描述" + }, + "subTitle": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/stringOrNull", + "description": "页面副标题" + }, + "title": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/stringOrNull", + "description": "页面标题" + }, + "toolbar": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "description": "页面顶部区域,当存在 title 时在右上角显示。" + }, + "toolbarClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置 toolbar 容器 className" + }, + "type": { + "const": "page", + "description": "指定为 page 渲染器。", + "type": "string" + }, + "definitions": { + "type": "object", + "description": "定义可复用类型,方便子节点引用" + } + }, + "required": [ + "$schema", + "type" + ], + "type": "object" +} \ No newline at end of file diff --git a/schemas/panel.json b/schemas/panel.json new file mode 100644 index 00000000..7092103f --- /dev/null +++ b/schemas/panel.json @@ -0,0 +1,98 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/panel.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/panel.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|className|affixFooter|bodyClassName|body|title|headerClassName|header|footer|footerClassName|actionsClassName|actions)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "panel", + "description": "指定为 Panel 类型", + "type": "string" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "AMis Panel 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#panel", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "actions": { + "items": { + "$ref": "https://houtai.baidu.com/v2/schemas/action.json#" + }, + "type": "array" + }, + "actionsClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置 actions 容器 className" + }, + "body": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "description": "内容区域" + }, + "bodyClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置 Body 容器 className" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "footer": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "description": "footer 内容区域" + }, + "footerClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置 footer 容器 className" + }, + "header": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "description": "头部内容, 和 title 二选一。" + }, + "headerClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置 header 容器 className" + }, + "title": { + "description": "Panel 标题", + "type": "string" + }, + "affixFooter": { + "description": "固定底部", + "type": "boolean" + } + } + }, + "test": { + "properties": { + "type": { + "const": "panel" + } + } + } + }, + "description": "AMis Panel 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#panel", + "title": "Panel", + "type": "object" +} \ No newline at end of file diff --git a/schemas/plain.json b/schemas/plain.json new file mode 100644 index 00000000..b972e1be --- /dev/null +++ b/schemas/plain.json @@ -0,0 +1,79 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/plain.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/plain.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|className|text|tpl|inline|wrapperComponent|label|name|popOver|quickEdit|sortable|searchable|toggled|fixed)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "description": "指定为纯文本类型的渲染器,不支持 html 标签。", + "enum": [ + "plain", + "text" + ], + "type": "string" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "AMis plain 渲染器格式说明。", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "inline": { + "description": "是否为 inline 模式", + "type": "boolean" + }, + "text": { + "description": "不支持 html 标签。", + "title": "文本", + "type": "string" + }, + "tpl": { + "description": "支持模板, 可通过 $xxx 或者 ${xxx} 取值,或者直接用 lodash.template 模板引擎。详情: https://baidu.github.io/amis/docs/renderers#tpl", + "title": "模板", + "type": "string" + }, + "wrapperComponent": { + "description": "外层用什么标签?默认根据 inline来定,内嵌用 span,非内联用 div", + "type": "string" + } + } + }, + "test": { + "properties": { + "type": { + "enum": [ + "plain", + "text" + ] + } + } + } + }, + "description": "AMis plain 渲染器格式说明。", + "type": "object" +} \ No newline at end of file diff --git a/schemas/progress.json b/schemas/progress.json new file mode 100644 index 00000000..065fefe5 --- /dev/null +++ b/schemas/progress.json @@ -0,0 +1,75 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/progress.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/progress.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|className|showLabel|map|progressClassName|progressBarClassName|label|name|popOver|quickEdit|sortable|searchable|toggled|fixed)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "progress", + "description": "指定为图片展示类型", + "type": "string" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "AMis progress 渲染器格式说明。", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "map": { + "description": "配置不通的值段,用不通的样式提示用户", + "items": { + "type": "string" + }, + "type": "array" + }, + "progressBarClassName": { + "description": "进度条 CSS 类名", + "type": "string" + }, + "progressClassName": { + "description": "进度外层 CSS 类名", + "type": "string" + }, + "showLabel": { + "description": "是否显示文字", + "type": "boolean" + } + } + }, + "test": { + "properties": { + "type": { + "const": "progress" + } + } + } + }, + "description": "AMis progress 渲染器格式说明。", + "type": "object" +} \ No newline at end of file diff --git a/schemas/service.json b/schemas/service.json new file mode 100644 index 00000000..e4e77c0f --- /dev/null +++ b/schemas/service.json @@ -0,0 +1,102 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/service.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/service.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|api|body|className|fetchOn|initFetch|initFetchOn|messages|name|schemaApi)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "service", + "description": "指定为 service 类型", + "type": "string" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "AMis Service 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#service", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "api": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "页面初始化的时候,可以设置一个 API 让其取拉取,发送数据会携带当前 data 数据(包含地址栏参数),获取得数据会合并到 data 中,供组件内使用。" + }, + "body": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "description": "内容区域" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "fetchOn": { + "default": true, + "description": "是否要拉取?通过表达式来决定", + "type": "string" + }, + "initFetch": { + "default": true, + "description": "是否默认就拉取?", + "type": "boolean" + }, + "initFetchOn": { + "default": true, + "description": "是否默认就拉取?通过表达式来决定", + "type": "string" + }, + "messages": { + "additionalProperties": false, + "properties": { + "fetchFailed": { + "description": "用来配置当 api 拉取失败时提示的信息", + "type": "string" + }, + "fetchSuccess": { + "description": "用来配置当 api 拉取成功时提示的信息,当然不设置的话就不会提示。", + "type": "string" + } + }, + "type": "object" + }, + "name": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/name", + "description": "给当前组件设定一个名,方便其他组件引用。" + }, + "schemaApi": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "用来获取远程 Schema 的 api" + } + }, + "type": "object" + }, + "test": { + "properties": { + "type": { + "const": "service" + } + } + } + }, + "description": "AMis Service 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#service", + "type": "object" +} \ No newline at end of file diff --git a/schemas/status.json b/schemas/status.json new file mode 100644 index 00000000..f8c96f9e --- /dev/null +++ b/schemas/status.json @@ -0,0 +1,67 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/status.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/status.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|className|map|placeholder|label|name|popOver|quickEdit|sortable|searchable|toggled|fixed)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "status", + "description": "指定为状态展示类型", + "type": "string" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "AMis status 渲染器格式说明。", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "map": { + "description": "配置不通的值段,用不通的样式提示用户", + "items": { + "type": "string" + }, + "type": "array" + }, + "placeholder": { + "description": "占位符", + "type": "string" + } + } + }, + "test": { + "properties": { + "type": { + "const": "status" + } + } + } + }, + "description": "AMis status 渲染器格式说明。", + "type": "object" +} \ No newline at end of file diff --git a/schemas/switch.json b/schemas/switch.json new file mode 100644 index 00000000..c87f31be --- /dev/null +++ b/schemas/switch.json @@ -0,0 +1,72 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/switch.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/switch.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|className|trueValue|falseValue|option|placeholder|label|name|popOver|quickEdit|sortable|searchable|toggled|fixed)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "switch", + "description": "指定为开关展示类型", + "type": "string" + } + }, + "required": [ + "type" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "AMis switch 渲染器格式说明。", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "falseValue": { + "default": false, + "description": "未勾选值" + }, + "option": { + "description": "选项说明", + "type": "string" + }, + "placeholder": { + "description": "占位符", + "type": "string" + }, + "trueValue": { + "default": true, + "description": "勾选值" + } + } + }, + "test": { + "properties": { + "type": { + "const": "status" + } + } + } + }, + "description": "AMis switch 渲染器格式说明。", + "type": "object" +} \ No newline at end of file diff --git a/schemas/table.json b/schemas/table.json new file mode 100644 index 00000000..8fe5c93d --- /dev/null +++ b/schemas/table.json @@ -0,0 +1,330 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/table.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/table.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|showHeader|footable|footable|showFooter|columns|tableClassName|data|affixHeader|columnsTogglable|className|footerClassName|headerClassName|placeholder|source|tableClassName|title|toolbarClassName|)$": {} + }, + "properties": { + "$schema": { + "description": "绑定 JSON 格式说明,可忽略!", + "format": "uri", + "type": "string" + }, + "type": { + "const": "table", + "description": "指定为 tabel 类型", + "type": "string" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "columns": { + "description": "列配置", + "items": { + "allOf": [ + { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/image.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/image.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/date.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/date.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/status.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/status.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/mapping.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/mapping.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/progress.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/progress.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/switch.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/switch.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/hbox.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/hbox.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/grid.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/grid.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/json.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/json.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/list.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/list.json#/definitions/common" + }, + "else": { + "if": { + "$ref": "https://houtai.baidu.com/v2/schemas/operation.json#/definitions/test" + }, + "then": { + "$ref": "https://houtai.baidu.com/v2/schemas/operation.json#/definitions/common" + }, + "else": { + "$ref": "https://houtai.baidu.com/v2/schemas/plain.json#/definitions/common" + } + } + } + } + } + } + } + } + } + } + } + } + }, + { + "properties": { + "fixed": { + "description": "配置是否固定当前列", + "enum": [ + "left", + "right", + "none" + ], + "type": "string" + }, + "label": { + "description": "列标题", + "type": "string" + }, + "name": { + "description": "绑定字段名", + "type": "string" + }, + "popOver": { + "description": "配置查看详情功能", + "oneOf": [ + { + "type": "boolean" + }, + { + "properties": {}, + "type": "object" + } + ] + }, + "quickEdit": { + "description": "配置快速编辑功能", + "oneOf": [ + { + "type": "boolean" + }, + { + "properties": {}, + "type": "object" + } + ] + }, + "copyable": { + "description": "配置点击复制功能", + "oneOf": [ + { + "type": "boolean" + }, + { + "properties": {}, + "type": "object" + } + ] + }, + "sortable": { + "description": "配置是否可以排序", + "type": "boolean" + }, + "toggled": { + "description": "配置是否默认展示", + "type": "boolean" + }, + "width": { + "description": "列宽度", + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "breakpoint": { + "type": "string", + "description": "填写 *、xs、sm、md、lg指定 footable 的触发条件,可以填写多个用空格隔开" + } + }, + "type": "object" + } + ] + }, + "type": "array" + }, + "common": { + "description": "AMis table 渲染器格式说明。", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "affixHeader": { + "description": "是否固定表头", + "type": "boolean" + }, + "className": { + "default": "panel-default", + "description": "外层 CSS 类名", + "type": "string" + }, + "columns": { + "$ref": "https://houtai.baidu.com/v2/schemas/table.json#/definitions/columns" + }, + "columnsTogglable": { + "description": "展示列显示开关,自动即:列数量大于或等于5个时自动开启", + "oneOf": [ + { + "type": "boolean" + }, + { + "const": "auto" + } + ] + }, + "data": { + "description": "默认的数据" + }, + "footable": { + "oneOf": [ + { + "description": "是否开启底部展示功能,适合移动端展示", + "type": "boolean" + }, + { + "properties": { + "expand": { + "description": "设置默认展开情况", + "enum": [ + "first", + "all", + "none" + ], + "type": "string" + } + }, + "type": "object" + } + ] + }, + "footerClassName": { + "default": "crud-table-footer", + "description": "底部外层 CSS 类名", + "type": "string" + }, + "headerClassName": { + "default": "crud-table-header", + "description": "顶部外层 CSS 类名", + "type": "string" + }, + "placeholder": { + "description": "占位符" + }, + "showFooter": { + "default": true, + "description": "是否显示底部", + "type": "boolean" + }, + "showHeader": { + "default": true, + "description": "是否显示头部", + "type": "boolean" + }, + "source": { + "description": "数据源:绑定当前环境变量" + }, + "tableClassName": { + "default": "table-db table-striped", + "description": "表格 CSS 类名", + "type": "string" + }, + "title": { + "description": "标题", + "type": "string" + }, + "toolbarClassName": { + "default": "crud-table-toolbar", + "description": "工具栏 CSS 类名", + "type": "string" + } + }, + "required": [ + "type" + ] + }, + "test": { + "properties": { + "type": { + "const": "table" + } + } + } + }, + "description": "AMis table 渲染器格式说明。", + "type": "object" +} \ No newline at end of file diff --git a/schemas/tabs.json b/schemas/tabs.json new file mode 100644 index 00000000..249e17d6 --- /dev/null +++ b/schemas/tabs.json @@ -0,0 +1,136 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/tabs.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/tabs.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|className|tabsClassName|defaultActiveKey|tabs|completeIcon|unCompleteIcon)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "tabs", + "description": "指定为 tabs 选项卡渲染器", + "type": "string" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "AMis Tabs 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#tabs", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "completeIcon": { + "description": "可以用来设置完成图标,请给 tab 属性添加 complete 属性,或者 completeOn 属性", + "type": "string" + }, + "defaultActiveKey": { + "default": 0, + "description": "配置默认第几个 tab 展示", + "type": "integer" + }, + "tabs": { + "description": "tabs集合", + "items": { + "$ref": "https://houtai.baidu.com/v2/schemas/tabs.json#/definitions/tab" + }, + "type": "array" + }, + "tabsClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置 tabs 容器 className" + }, + "unCompleteIcon": { + "description": "可以用来设置完成图标,请给 tab 属性添加 complete 属性,或者 completeOn 属性", + "type": "string" + } + } + }, + "tab": { + "description": "Tab", + "properties": { + "badge": { + "description": "徽标", + "type": "string" + }, + "complete": { + "description": "标记为完成状态", + "type": "boolean" + }, + "completeOn": { + "description": "通过表达式来标记当前 tab 是否完成", + "type": "string" + }, + "hash": { + "description": "设置以后将跟url的hash对应", + "type": "string" + }, + "hiddenOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前表单项是否隐藏。" + }, + "icon": { + "description": "按钮图标,请查看 fontAwesome http://fontawesome.io/icons/", + "type": "string" + }, + "reload": { + "description": "设置以后内容每次都会重新渲染", + "type": "boolean" + }, + "tab": { + "anyOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container" + } + ] + }, + "title": { + "description": "Tab 标题", + "type": "string" + }, + "toolbar": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "description": "Tab 的顶部位置内容配置" + }, + "toolbarClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "visibleOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前表单项是否显示" + } + }, + "type": "object" + }, + "test": { + "properties": { + "type": { + "const": "tabs" + } + } + } + }, + "description": "AMis Tabs 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#tabs", + "type": "object" +} \ No newline at end of file diff --git a/schemas/tasks.json b/schemas/tasks.json new file mode 100644 index 00000000..b6c0c161 --- /dev/null +++ b/schemas/tasks.json @@ -0,0 +1,175 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/tasks.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/tasks.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|remarkLabel|btnText|retryBtnText|btnClassName|statusLabelMap|statusTextMap|retryBtnClassName|name|className|tableClassName|checkApi|submitApi|reSubmitApi|items|interval|taskNameLabel|operationLabel|statusLabel)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "tasks", + "description": "指定为任务类型", + "type": "string" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "AMis Tasks 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#tasks", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "btnClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "default": "btn-sm btn-default", + "description": "配置容器按钮 className" + }, + "btnText": { + "default": "上线", + "description": "操作按钮文字", + "type": "string" + }, + "checkApi": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "用来获取任务状态的 API,当没有进行时任务时不会发送。" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "default": "b-a bg-white table-responsive", + "description": "配置容器 className" + }, + "interval": { + "default": 3000, + "description": "当有任务进行中,会每隔一段时间再次检测,而时间间隔就是通过此项配置,默认 3s。", + "type": "number" + }, + "items": { + "items": { + "key": { + "description": "任务键值,请唯一区分", + "type": "string" + }, + "label": { + "description": "任务名称", + "type": "string" + }, + "remark": { + "description": "当前任务状态,支持 html", + "type": "string" + }, + "status": { + "description": "任务状态: \n0: 初始状态,不可操作。\n1: 就绪,可操作状态。\n2: 进行中,还没有结束。\n3:有错误,不可重试。\n4: 已正常结束。\n5:有错误,且可以重试。", + "enum": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "type": "number" + } + }, + "type": "array" + }, + "name": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/name", + "description": "给当前组件设定一个名,方便其他组件引用。" + }, + "operationLabel": { + "default": "操作", + "description": "操作列说明", + "type": "string" + }, + "reSubmitApi": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "如果任务失败,且可以重试,提交的时候会使用此 API" + }, + "remarkLabel": { + "default": "备注", + "description": "备注列说明", + "type": "string" + }, + "retryBtnClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "default": "btn-sm btn-danger", + "description": "配置容器重试按钮 className" + }, + "retryBtnText": { + "default": "重试", + "description": "重试操作按钮文字", + "type": "string" + }, + "statusLabel": { + "default": "状态", + "description": "状态列说明", + "type": "string" + }, + "statusLabelMap": { + "default": [ + "label-warning", + "label-info", + "label-success", + "label-danger", + "label-default", + "label-danger" + ], + "description": "状态显示对应的类名配置。", + "type": "array" + }, + "statusTextMap": { + "default": [ + "未开始", + "就绪", + "进行中", + "出错", + "已完成", + "出错" + ], + "description": "状态显示对应的文字显示配置。", + "type": "array" + }, + "submitApi": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "提交任务使用的 API" + }, + "tableClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "default": "table table-striped m-b-none", + "description": "配置 table className" + }, + "taskNameLabel": { + "default": "任务名称", + "description": "任务名称列说明", + "type": "string" + } + } + }, + "test": { + "properties": { + "type": { + "const": "tasks" + } + } + } + }, + "description": "AMis Tasks 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#tasks", + "type": "object" +} \ No newline at end of file diff --git a/schemas/tpl.json b/schemas/tpl.json new file mode 100644 index 00000000..6059915c --- /dev/null +++ b/schemas/tpl.json @@ -0,0 +1,96 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/tpl.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "dependencies": {}, + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|className|name|label|html|text|raw|tpl|inline|wrapperComponent)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "description": "指定为 TPL 类型的渲染器", + "enum": [ + "tpl", + "html" + ], + "type": "string" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "AMis Tpl 渲染器格式说明。https://baidu.github.io/amis/docs/renderers#tpl", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "html": { + "description": "支持模板, 可通过 $xxx 或者 ${xxx} 取值,或者直接用 lodash.template 模板引擎。详情: https://baidu.github.io/amis/docs/renderers#tpl", + "title": "HTML 片段", + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/tpl" + }, + "inline": { + "description": "是否为 inline 模式", + "type": "boolean" + }, + "text": { + "description": "不支持 html 标签。", + "title": "文本", + "type": "string" + }, + "tpl": { + "title": "模板", + "$ref": "https://houtai.baidu.com/v2/schemas/tpl.json#/definitions/tpl" + }, + "wrapperComponent": { + "description": "外层用什么标签?默认根据 inline来定,内嵌用 span,非内联用 div", + "type": "string" + }, + "$schema": { + "enum": [ + "https://houtai.baidu.com/v2/schemas/tpl.json#", + "https://houtai.baidu.com/v2/schemas/tpl.json" + ], + "description": "绑定 JSON 格式说明" + } + } + }, + "test": { + "properties": { + "type": { + "description": "指定为 TPL 类型的渲染器", + "enum": [ + "tpl", + "html" + ], + "type": "string" + } + } + }, + "tpl": { + "description": "支持模板, 可通过 $xxx 或者 ${xxx} 取值,或者直接用 lodash.template 模板引擎。详情: https://baidu.github.io/amis/docs/renderers#tpl", + "type": "string" + } + }, + "description": "AMis Tpl 渲染器格式说明。https://baidu.github.io/amis/docs/renderers#tpl" +} \ No newline at end of file diff --git a/schemas/video.json b/schemas/video.json new file mode 100644 index 00000000..70d2e200 --- /dev/null +++ b/schemas/video.json @@ -0,0 +1,132 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/video.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|className|aspectRatio|rates|playerClassName|framesClassName|src|poster|muted|isLive|jumpFrame|videoType|autoPlay|splitPoster|minPosterDimension|minVideoDuration|frames|columnsCount|visible|visibleOn|disabled|disabledOn)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "video", + "description": "指定为视频类型", + "type": "string" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "AMis Video 渲染器,用来生成视频播放器", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "autoPlay": { + "description": "是否自动播放", + "type": "boolean" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "columnsCount": { + "default": 8, + "description": "如果显示切帧,通过此配置项可以控制每行显示多少帧" + }, + "frames": { + "description": "设置后,可以显示切帧" + }, + "framesClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置帧列表容器className" + }, + "isLive": { + "description": "如果是实时的,请标记一下", + "type": "boolean" + }, + "jumpFrame": { + "default": true, + "description": "点击帧画面时是否跳转视频对应的点", + "type": "boolean" + }, + "minPosterDimension": { + "description": "设置最小尺寸提示,低于设置的值,会高亮显示", + "properties": { + "height": { + "description": "高度", + "type": "number" + }, + "width": { + "description": "宽度", + "type": "number" + } + }, + "type": "object" + }, + "minVideoDuration": { + "description": "视频最低时长提示", + "type": "number" + }, + "muted": { + "description": "是否初始静音", + "type": "boolean" + }, + "playerClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置播放器 className" + }, + "poster": { + "description": "视频封面地址", + "type": "string" + }, + "splitPoster": { + "description": "是否将视频和封面分开显示", + "type": "boolean" + }, + "src": { + "description": "视频播放地址", + "type": "string" + }, + "videoType": { + "description": "视频类型如: video/x-flv", + "type": "string" + }, + "aspectRatio": { + "description": "视频比率", + "enum": ["auto", "", "4:3", "16:9"] + }, + "rates": { + "description": "视频速率", + "type": "array", + "items": { + "type": "number" + } + } + } + }, + "test": { + "properties": { + "type": { + "const": "video" + } + } + } + }, + "description": "AMis Video 渲染器,用来生成视频播放器", + "id": "https://houtai.baidu.com/v2/schemas/video.json#", + "type": "object" +} \ No newline at end of file diff --git a/schemas/wizard.json b/schemas/wizard.json new file mode 100644 index 00000000..d3595a40 --- /dev/null +++ b/schemas/wizard.json @@ -0,0 +1,198 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/wizard.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/wizard.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|mode|disabled|disabledOn|visible|visibleOn|readOnly|redirect|steps|name|className|actionClassName|actionPrevLabel|target|reload|actionNextlabel|actionNextSaveLabel|actionFinishLabel|bulkSubmit|initApi|api|messages)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "wizard", + "description": "指定为 service 类型", + "type": "string" + } + }, + "required": [ + "type", + "steps" + ], + "type": "object" + } + ], + "definitions": { + "common": { + "description": "AMis Wizard 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#wizard", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "actionClassName": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置按钮 className" + }, + "actionFinishLabel": { + "description": "完成按钮的文字描述", + "type": "string" + }, + "actionNextLabel": { + "description": "下一步按钮的文字描述", + "type": "string" + }, + "actionNextSaveLabel": { + "description": "下一步并且保存按钮的文字描述", + "type": "string" + }, + "actionPrevLabel": { + "description": "上一步按钮的文字描述", + "type": "string" + }, + "api": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "Wizard 用来保存数据的 api。[详情](https://baidu.github.io/amis/docs/api#wizard)" + }, + "bulkSubmit": { + "default": false, + "description": "是否合并后再提交", + "type": "boolean" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className" + }, + "disabled": { + "description": "是否为禁用状态。", + "type": "boolean" + }, + "disabledOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前表单项的禁用状态。" + }, + "hiddenOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前表单项是否隐藏。" + }, + "initApi": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "Wizard 用来获取初始数据的 api。[详情](https://baidu.github.io/amis/docs/api#wizard)" + }, + "messages": { + "additionalProperties": false, + "properties": { + "fetchFailed": { + "description": "获取失败时提示", + "type": "string" + }, + "fetchSuccess": { + "description": "获取成功时提示", + "type": "string" + }, + "saveFailed": { + "description": "保存成功时提示", + "type": "string" + }, + "saveSuccess": { + "description": "保存失败时提示", + "type": "string" + } + }, + "type": "object" + }, + "mode": { + "enum": [ + "vertical", + "horizontal" + ], + "default": "horizontal", + "description": "展示模式", + "type": "string" + }, + "name": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/name", + "description": "给当前 wizard 取个名字,可用来跟其他 Renderer 交互。" + }, + "readOnly": { + "description": "是否为只读模式。", + "type": "boolean" + }, + "redirect": { + "description": "保存完后,可以指定跳转地址,支持相对路径和组内绝对路径,同时可以通过 $xxx 使用变量", + "type": "string" + }, + "reload": { + "description": "保存完后,可以通过配置此属性来让其他组件刷新", + "type": "string" + }, + "steps": { + "description": "步骤集合, 每一个配置同 form 渲染器。", + "items": { + "allOf": [ + { + "properties": { + "api": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "当前步骤用来保存数据的 api。[详情](https://baidu.github.io/amis/docs/api#form)" + }, + "initApi": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/api", + "description": "当前步骤用来获取初始数据的 api。[详情](https://baidu.github.io/amis/docs/api#form)" + }, + "jumpable": { + "description": "是否可直接跳转到该步骤,一般编辑模式需要可直接跳转查看。", + "type": "boolean" + }, + "jumpableOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前步骤可否被直接跳转到。" + }, + "label": { + "description": "Step 标题 title 别名,推荐直接用 title", + "type": "string" + }, + "title": { + "description": "Step 标题", + "type": "string" + } + }, + "type": "object" + }, + { + "$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/common" + } + ], + "description": "步骤详情" + }, + "type": "array" + }, + "target": { + "description": "默认表单提交自己会通过发送 api 保存数据,但是也可以设定另外一个 form 的 name 值,或者另外一个 `CRUD` 模型的 name 值。 如果 target 目标是一个 `Form` ,则目标 `Form` 会重新触发 `initApi` 和 `schemaApi`,api 可以拿到当前 form 数据。如果目标是一个 `CRUD` 模型,则目标模型会重新触发搜索,参数为当前 Form 数据。", + "type": "string" + }, + "visibleOn": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/expression", + "description": "通过 JS 表达式来配置当前表单项是否显示" + } + } + }, + "test": { + "properties": { + "type": { + "const": "wizard" + } + } + } + }, + "description": "AMis Wizard 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers#wizard", + "type": "object" +} \ No newline at end of file diff --git a/schemas/wrapper.json b/schemas/wrapper.json new file mode 100644 index 00000000..ef68b054 --- /dev/null +++ b/schemas/wrapper.json @@ -0,0 +1,71 @@ +{ + "$id": "https://houtai.baidu.com/v2/schemas/wrapper.json#", + "$schema": "http://json-schema.org/draft-07/schema#", + "allOf": [ + { + "$ref": "https://houtai.baidu.com/v2/schemas/wrapper.json#/definitions/common" + }, + { + "additionalProperties": false, + "dependencies": {}, + "patternProperties": { + "^(\\$ref|className|bodyClassName|body|size|visibleOn|hiddenOn|visible|hidden)$": {} + }, + "properties": { + "$schema": { + "format": "uri", + "type": "string", + "description": "绑定 JSON 格式说明,可忽略!" + }, + "type": { + "const": "wrapper", + "description": "指定为容器类型", + "type": "string" + } + }, + "required": [ + "type" + ] + } + ], + "definitions": { + "common": { + "description": "AMis Wrapper 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers/Wrapper", + "properties": { + "$ref": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/$ref", + "description": "引用页面中的定义" + }, + "body": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/container", + "description": "内容区域" + }, + "className": { + "$ref": "https://houtai.baidu.com/v2/schemas/page.json#/definitions/className", + "description": "配置容器 className", + "default": "bg-white" + }, + "size": { + "description": "容器内边距大小", + "enum": [ + "xs", + "sm", + "md", + "lg", + "none", + "" + ] + } + } + }, + "test": { + "properties": { + "type": { + "const": "wrapper" + } + } + } + }, + "description": "AMis Wrapper 渲染器,格式说明。https://baidu.github.io/amis/docs/renderers/Wrapper", + "type": "object" +} \ No newline at end of file