amis/schemas/action.json

465 lines
18 KiB
JSON
Raw Normal View History

2020-05-27 14:57:40 +08:00
{
"$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"
}