amis/schemas/form/file.json

169 lines
6.7 KiB
JSON
Raw Permalink 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/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"
}