@wibetter/json-schema-editor 7.0.3 → 7.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -2
- package/lib/index.css +2 -2
- package/lib/index.js +1 -3051
- package/lib/index.js.LICENSE.txt +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
React/Mobx/Ant Design
|
|
7
7
|
|
|
8
8
|
### 特点
|
|
9
|
-
1. 支持
|
|
10
|
-
textarea、number、color、radio、 checkboxes、select、cascader、input-image)
|
|
9
|
+
1. 支持16种基础类型组件(input、boolean、 date、date-time、 time、 url、
|
|
10
|
+
textarea、number、color、radio、 checkboxes、select、cascader、input-image、button-group-select、input-rate)
|
|
11
11
|
2. 支持8种特殊类型组件(object、array、json、codearea、htmlarea、text-editor([使用说明](https://github.com/wibetter/json-editor/blob/master/docs/TextEditor.md))、quantity、padding-margin)
|
|
12
12
|
3. 支持拖拽排序、删除、复制、高级配置等功能
|
|
13
13
|
4. 支持无限嵌套
|
|
@@ -126,6 +126,72 @@ import './colorPickerPlugin'; // 引入即触发注册
|
|
|
126
126
|
import JSONSchemaEditor from '@wibetter/json-schema-editor';
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
+
## button-group-select 类型说明
|
|
130
|
+
|
|
131
|
+
`button-group-select` 是按钮组单选类型,在 JSONEditor 中以按钮切换形式进行单击选中,交互体验类似 [amis button-group-select](https://aisuda.bce.baidu.com/amis/zh-CN/components/form/button-group-select)。
|
|
132
|
+
|
|
133
|
+
### schema 结构
|
|
134
|
+
|
|
135
|
+
`button-group-select` 的 schema 结构与 `radio`(单选)类型完全一致,支持 `options` 选项列表:
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"type": "button-group-select",
|
|
140
|
+
"title": "布局方向",
|
|
141
|
+
"options": [
|
|
142
|
+
{ "label": "水平", "value": "horizontal" },
|
|
143
|
+
{ "label": "垂直", "value": "vertical" },
|
|
144
|
+
{ "label": "自适应", "value": "auto" }
|
|
145
|
+
],
|
|
146
|
+
"default": "horizontal",
|
|
147
|
+
"description": "请选择布局方向"
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### 高级配置项
|
|
152
|
+
|
|
153
|
+
| 配置项 | 类型 | 默认值 | 说明 |
|
|
154
|
+
| ------------------------- | --------- | ------- | -------------------------------------- |
|
|
155
|
+
| `vertical` | boolean | false | 垂直模式,开启后按钮组垂直方向排列 |
|
|
156
|
+
| `readOnly` | boolean | false | 只读模式 |
|
|
157
|
+
| `isRequired` | boolean | false | 是否必填 |
|
|
158
|
+
| `defaultActiveFirstOption`| boolean | false | 是否默认高亮第一个选项 |
|
|
159
|
+
| `default` | string | '' | 默认选中项的 value 值 |
|
|
160
|
+
|
|
161
|
+
### 使用示例
|
|
162
|
+
|
|
163
|
+
```json
|
|
164
|
+
{
|
|
165
|
+
"type": "object",
|
|
166
|
+
"properties": {
|
|
167
|
+
"direction": {
|
|
168
|
+
"type": "button-group-select",
|
|
169
|
+
"title": "排列方向",
|
|
170
|
+
"options": [
|
|
171
|
+
{ "label": "水平", "value": "horizontal" },
|
|
172
|
+
{ "label": "垂直", "value": "vertical" }
|
|
173
|
+
],
|
|
174
|
+
"default": "horizontal",
|
|
175
|
+
"vertical": false
|
|
176
|
+
},
|
|
177
|
+
"align": {
|
|
178
|
+
"type": "button-group-select",
|
|
179
|
+
"title": "对齐方式(垂直)",
|
|
180
|
+
"options": [
|
|
181
|
+
{ "label": "左对齐", "value": "left" },
|
|
182
|
+
{ "label": "居中", "value": "center" },
|
|
183
|
+
{ "label": "右对齐", "value": "right" }
|
|
184
|
+
],
|
|
185
|
+
"default": "left",
|
|
186
|
+
"vertical": true
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"propertyOrder": ["direction", "align"]
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
***
|
|
194
|
+
|
|
129
195
|
### 访问 schemaRegistry
|
|
130
196
|
|
|
131
197
|
可通过 `schemaRegistry` 查询已注册的所有 Schema 类型:
|
package/lib/index.css
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @wibetter/json-schema-editor v7.0.
|
|
2
|
+
* @wibetter/json-schema-editor v7.0.5
|
|
3
3
|
* author: wibetter
|
|
4
4
|
* build tool: AKFun
|
|
5
|
-
* build time:
|
|
5
|
+
* build time: Mon Mar 23 2026 00:10:36 GMT+0800 (中国标准时间)
|
|
6
6
|
* build tool info: https://github.com/wibetter/akfun
|
|
7
7
|
*/.base-schema-box{-webkit-box-pack:center;-moz-box-pack:center;-ms-flex-pack:center;-webkit-box-align:center;-moz-box-align:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-justify-content:center;justify-content:center;min-height:35px;position:relative}.base-schema-box .warn-text{color:#ad4e00;width:100%}.base-schema-box .key-input-item{-webkit-box-flex:1;-moz-box-flex:1;-webkit-flex:1 1 200px;-ms-flex:1 1 200px;flex:1 1 200px;padding-right:8px}.base-schema-box .type-select-item{-webkit-box-flex:0;-moz-box-flex:0;-webkit-flex:0 1 120px;-ms-flex:0 1 120px;flex:0 1 120px;padding-right:8px}.base-schema-box .title-input-item{-webkit-box-flex:0;-moz-box-flex:0;-webkit-flex:0 1 200px;-ms-flex:0 1 200px;flex:0 1 200px}.base-schema-box .operate-item{-webkit-box-flex:0;-moz-box-flex:0;-webkit-box-pack:start;-moz-box-pack:start;-ms-flex-pack:start;-webkit-box-align:center;-moz-box-align:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;display:-webkit-inline-box;display:-webkit-inline-flex;display:-moz-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-flex:0 1 110px;-ms-flex:0 1 110px;flex:0 1 110px;-webkit-justify-content:flex-start;justify-content:flex-start;padding-left:10px}.base-schema-box .operate-item .operate-btn{-webkit-box-flex:0;-moz-box-flex:0;color:#2395f1;cursor:pointer!important;-webkit-flex:0 0 auto;-ms-flex:0 0 auto;flex:0 0 auto;margin-right:8px;width:15px}.base-schema-box .operate-item .delete-operate{color:#ff561b}.base-schema-box .operate-item .drag-btn{color:#8a8a8a}.base-schema-box .operate-item .drag-btn:hover{color:#2395f1}.json-view-box{position:relative}.json-view-box .json-view-ace{width:100%}.json-view-box .readOnly-btn{color:#ad6800;position:absolute;right:8px;top:0;z-index:100}.json-schema-container{padding:8px 10px;position:relative}.json-schema-container .schema-item-form{-webkit-box-pack:center;-moz-box-pack:center;-ms-flex-pack:center;-webkit-box-align:center;-moz-box-align:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-justify-content:center;justify-content:center;min-height:35px;position:relative}.json-schema-empty{height:50px;line-height:50px;position:relative}.ant-tree-list-holder-inner{-webkit-box-align:stretch;-moz-box-align:stretch;-ms-flex-align:stretch;-webkit-align-items:stretch;align-items:stretch}.ant-tree-switcher{-webkit-box-flex:0;-moz-box-flex:0;-webkit-flex:0 0 auto;-ms-flex:0 0 auto;flex:0 0 auto}.ant-tree-node-content-wrapper{-webkit-box-flex:1;-moz-box-flex:1;-webkit-flex:1 1 auto;-ms-flex:1 1 auto;flex:1 1 auto}.ant-modal-close-x,.ant-tree .ant-tree-switcher,.option-schema-box{-webkit-box-pack:center;-moz-box-pack:center;-ms-flex-pack:center;-webkit-box-align:center;-moz-box-align:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-justify-content:center;justify-content:center}.option-schema-box{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;min-height:35px;position:relative}.option-schema-box .key-input-item{-webkit-box-flex:1;-moz-box-flex:1;-webkit-flex:1 1 200px;-ms-flex:1 1 200px;flex:1 1 200px;padding-right:8px}.option-schema-box .type-select-item{-webkit-box-flex:0;-moz-box-flex:0;-webkit-flex:0 1 120px;-ms-flex:0 1 120px;flex:0 1 120px;padding-right:8px}.option-schema-box .title-input-item{-webkit-box-flex:0;-moz-box-flex:0;-webkit-flex:0 1 200px;-ms-flex:0 1 200px;flex:0 1 200px}.option-schema-box .operate-item{-webkit-box-flex:0;-moz-box-flex:0;-webkit-box-pack:start;-moz-box-pack:start;-ms-flex-pack:start;-webkit-box-align:center;-moz-box-align:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;display:-webkit-inline-box;display:-webkit-inline-flex;display:-moz-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-flex:0 1 110px;-ms-flex:0 1 110px;flex:0 1 110px;-webkit-justify-content:flex-start;justify-content:flex-start;padding-left:10px}.option-schema-box .operate-item .operate-btn{-webkit-box-flex:0;-moz-box-flex:0;color:#2395f1;cursor:pointer!important;-webkit-flex:0 0 auto;-ms-flex:0 0 auto;flex:0 0 auto;margin-right:8px;width:15px}.option-schema-box .operate-item .delete-operate{color:#ff561b}.typeSelect-schema-box{-webkit-box-pack:center;-moz-box-pack:center;-ms-flex-pack:center;-webkit-box-align:center;-moz-box-align:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-justify-content:center;justify-content:center;min-height:35px;position:relative}.typeSelect-schema-box .key-input-item{-webkit-box-flex:1;-moz-box-flex:1;-webkit-flex:1 1 200px;-ms-flex:1 1 200px;flex:1 1 200px;padding-right:8px}.typeSelect-schema-box .key-input-item .ant-select{display:block}.typeSelect-schema-box .type-select-item{-webkit-box-flex:0;-moz-box-flex:0;-webkit-flex:0 1 120px;-ms-flex:0 1 120px;flex:0 1 120px;padding-right:8px}.typeSelect-schema-box .title-input-item{-webkit-box-flex:0;-moz-box-flex:0;-webkit-flex:0 1 200px;-ms-flex:0 1 200px;flex:0 1 200px}.typeSelect-schema-box .operate-item{-webkit-box-flex:0;-moz-box-flex:0;-webkit-box-pack:start;-moz-box-pack:start;-ms-flex-pack:start;-webkit-box-align:center;-moz-box-align:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;display:-webkit-inline-box;display:-webkit-inline-flex;display:-moz-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-flex:0 1 110px;-ms-flex:0 1 110px;flex:0 1 110px;-webkit-justify-content:flex-start;justify-content:flex-start;padding-left:10px}.typeSelect-schema-box .operate-item .operate-btn{-webkit-box-flex:0;-moz-box-flex:0;color:#2395f1;cursor:pointer!important;-webkit-flex:0 0 auto;-ms-flex:0 0 auto;flex:0 0 auto;margin-right:8px;width:15px}.typeSelect-schema-box .operate-item .delete-operate{color:#ff561b}.typeSelect-schema-box .operate-item .drag-btn{background-image:url(//storage.jd.local/cdnnpm/jdw-web/img/drag-default.svg);background-size:contain;color:#8a8a8a;display:inline-block;height:18px;width:18px}
|