amis/schemas/form/image.json
2020-05-27 14:57:40 +08:00

209 lines
9.8 KiB
JSON

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