amis2/schemas/crud.json
2020-08-21 15:28:22 +08:00

234 lines
7.5 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"$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"
}