@wibetter/json-schema-editor 7.0.2 → 7.0.3
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 +11 -12
- package/lib/index.css +2 -2
- package/lib/index.js +3051 -1
- package/lib/index.js.LICENSE.txt +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# json-schema-editor
|
|
2
2
|
|
|
3
|
-
> JSON数据可视化/
|
|
3
|
+
> JSON数据可视化/SchemaEditor,以表单的形式编辑 schema 数据,可用于在线设计页面/组件的配置面板。
|
|
4
4
|
|
|
5
5
|
### 技术栈
|
|
6
6
|
React/Mobx/Ant Design
|
|
@@ -9,15 +9,14 @@ React/Mobx/Ant Design
|
|
|
9
9
|
1. 支持14种基础类型组件(input、boolean、 date、date-time、 time、 url、
|
|
10
10
|
textarea、number、color、radio、 checkboxes、select、cascader、input-image)
|
|
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
|
-
3.
|
|
13
|
-
4.
|
|
14
|
-
5.
|
|
15
|
-
6.
|
|
16
|
-
7.
|
|
17
|
-
8. 支持添加自定义 Schema
|
|
12
|
+
3. 支持拖拽排序、删除、复制、高级配置等功能
|
|
13
|
+
4. 支持无限嵌套
|
|
14
|
+
5. 支持通过表达式进行配置联动
|
|
15
|
+
6. 支持源码模式切换(开启源码模式后可以开启编辑模式)
|
|
16
|
+
7. 支持添加自定义类型
|
|
18
17
|
|
|
19
18
|
### 特别说明
|
|
20
|
-
|
|
19
|
+
SchemaEditor仅用于生成结构化的json数据,还需要配合JSONEditor([git地址](https://github.com/wibetter/json-editor))渲染其内容。
|
|
21
20
|
|
|
22
21
|
|
|
23
22
|
## 安装
|
|
@@ -71,7 +70,7 @@ class IndexDemo extends React.PureComponent {
|
|
|
71
70
|
| `data` | object | {} | 必填项,json schema(带结构的json数据) |
|
|
72
71
|
| `onChange` | function | () => {} | schemaData内容变动时会触发onChange |
|
|
73
72
|
|
|
74
|
-
##
|
|
73
|
+
## 如何添加自定义类型?
|
|
75
74
|
|
|
76
75
|
从 v7.0.0 起,支持通过 `SchemaDescriptor` 描述文件注册自定义 Schema 类型。注册后,自定义类型会出现在类型选择下拉列表中,并在编辑区以自定义渲染器或通用渲染器呈现。
|
|
77
76
|
|
|
@@ -91,9 +90,9 @@ class IndexDemo extends React.PureComponent {
|
|
|
91
90
|
| `readOnly` | boolean | ❌ | 是否只读(不可编辑) |
|
|
92
91
|
| `hideOperaBtn` | boolean | ❌ | 是否隐藏操作按钮(增删复制拖拽) |
|
|
93
92
|
|
|
94
|
-
###
|
|
93
|
+
### 注册自定义类型 示例
|
|
95
94
|
|
|
96
|
-
以下示例展示如何注册一个 `
|
|
95
|
+
以下示例展示如何注册一个 `color-picker`(颜色选择器)类型的自定义类型:
|
|
97
96
|
|
|
98
97
|
**第一步:创建描述文件 `colorPickerPlugin.ts`**
|
|
99
98
|
|
|
@@ -123,7 +122,7 @@ registerSchema(colorPickerDescriptor);
|
|
|
123
122
|
**第二步:在入口文件中引入插件(确保注册在 `JSONSchemaEditor` 渲染前执行)**
|
|
124
123
|
|
|
125
124
|
```js
|
|
126
|
-
import './
|
|
125
|
+
import './colorPickerPlugin'; // 引入即触发注册
|
|
127
126
|
import JSONSchemaEditor from '@wibetter/json-schema-editor';
|
|
128
127
|
```
|
|
129
128
|
|
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.2
|
|
3
3
|
* author: wibetter
|
|
4
4
|
* build tool: AKFun
|
|
5
|
-
* build time:
|
|
5
|
+
* build time: Sun Mar 22 2026 19:15:58 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}
|