amis/schemas/cards.json
2020-09-03 11:45:31 +08:00

383 lines
11 KiB
JSON

{
"$id": "/schemas/cards.json#",
"$schema": "http://json-schema.org/draft-07/schema#",
"allOf": [
{
"$ref": "/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": "/schemas/cards.json#/definitions/field"
},
{
"items": {
"oneOf": [
{
"$ref": "/schemas/cards.json#/definitions/field"
},
{
"description": "**不推荐使用数组,请用 hbox 包裹**",
"items": {
"$ref": "/schemas/cards.json#/definitions/field"
},
"type": "array"
}
]
},
"type": "array"
}
]
},
"card": {
"type": "object",
"properties": {
"$ref": {
"$ref": "/schemas/page.json#/definitions/$ref",
"description": "引用页面中的定义"
},
"type": {
"const": "card",
"description": "指定为 card 渲染器"
},
"actions": {
"items": {
"$ref": "/schemas/action.json#"
},
"type": "array"
},
"actionsCount": {
"description": "卡片一行最多能放按钮个数",
"type": "number"
},
"avatarClassName": {
"description": "图片 CSS 类名",
"type": "string"
},
"body": {
"$ref": "/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": "/schemas/tpl.json#/definitions/tpl",
"description": "头像,支持tpl"
},
"desc": {
"$ref": "/schemas/tpl.json#/definitions/tpl",
"description": "描述,支持tpl"
},
"descClassName": {
"description": "描述 CSS 类名",
"type": "string"
},
"header": {
"description": "头部内容",
"properties": {
"avatar": {
"$ref": "/schemas/tpl.json#/definitions/tpl",
"description": "头像,支持tpl"
},
"desc": {
"$ref": "/schemas/tpl.json#/definitions/tpl",
"description": "描述,支持tpl"
},
"highlight": {
"description": "是否高亮表达式",
"type": "string"
},
"subTitle": {
"$ref": "/schemas/tpl.json#/definitions/tpl",
"description": "副标题, 支持tpl"
},
"title": {
"$ref": "/schemas/tpl.json#/definitions/tpl",
"description": "标题, 支持tpl"
}
},
"type": "object"
},
"higlight": {
"description": "是否高亮表达式",
"type": "string"
},
"subTitle": {
"$ref": "/schemas/tpl.json#/definitions/tpl",
"description": "副标题, 支持tpl"
},
"title": {
"$ref": "/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": "/schemas/page.json#/definitions/$ref",
"description": "引用页面中的定义"
},
"card": {
"$ref": "/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": "/schemas/tpl.json#/definitions/test"
},
"then": {
"$ref": "/schemas/tpl.json#/definitions/common"
},
"else": {
"if": {
"$ref": "/schemas/image.json#/definitions/test"
},
"then": {
"$ref": "/schemas/image.json#/definitions/common"
},
"else": {
"if": {
"$ref": "/schemas/date.json#/definitions/test"
},
"then": {
"$ref": "/schemas/date.json#/definitions/common"
},
"else": {
"if": {
"$ref": "/schemas/status.json#/definitions/test"
},
"then": {
"$ref": "/schemas/status.json#/definitions/common"
},
"else": {
"if": {
"$ref": "/schemas/mapping.json#/definitions/test"
},
"then": {
"$ref": "/schemas/mapping.json#/definitions/common"
},
"else": {
"if": {
"$ref": "/schemas/progress.json#/definitions/test"
},
"then": {
"$ref": "/schemas/progress.json#/definitions/common"
},
"else": {
"if": {
"$ref": "/schemas/switch.json#/definitions/test"
},
"then": {
"$ref": "/schemas/switch.json#/definitions/common"
},
"else": {
"if": {
"$ref": "/schemas/hbox.json#/definitions/test"
},
"then": {
"$ref": "/schemas/hbox.json#/definitions/common"
},
"else": {
"if": {
"$ref": "/schemas/grid.json#/definitions/test"
},
"then": {
"$ref": "/schemas/grid.json#/definitions/common"
},
"else": {
"if": {
"$ref": "/schemas/json.json#/definitions/test"
},
"then": {
"$ref": "/schemas/json.json#/definitions/common"
},
"else": {
"if": {
"$ref": "/schemas/list.json#/definitions/test"
},
"then": {
"$ref": "/schemas/list.json#/definitions/common"
},
"else": {
"if": {
"$ref": "/schemas/operation.json#/definitions/test"
},
"then": {
"$ref": "/schemas/operation.json#/definitions/common"
},
"else": {
"$ref": "/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"
}