@wibetter/json-editor 5.1.12 → 5.1.16

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/lib/index.css CHANGED
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * @wibetter/json-editor v5.1.12
2
+ * @wibetter/json-editor v5.1.16
3
3
  * author: wibetter
4
4
  * build tool: AKFun
5
- * build time: Fri Jan 17 2025 15:43:17 GMT+0800 (中国标准时间)
5
+ * build time: Tue Jan 21 2025 18:00:43 GMT+0800 (中国标准时间)
6
6
  * build tool info: https://github.com/wibetter/akfun
7
7
  */
8
8
  /*!*********************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
package/lib/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * @wibetter/json-editor v5.1.12
2
+ * @wibetter/json-editor v5.1.16
3
3
  * author: wibetter
4
4
  * build tool: AKFun
5
- * build time: Fri Jan 17 2025 15:43:17 GMT+0800 (中国标准时间)
5
+ * build time: Tue Jan 21 2025 18:00:43 GMT+0800 (中国标准时间)
6
6
  * build tool info: https://github.com/wibetter/akfun
7
7
  */
8
8
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -2863,11 +2863,12 @@ var ObjectSchema = /*#__PURE__*/function (_React$PureComponent) {
2863
2863
  }
2864
2864
  }
2865
2865
  if (currentJsonKey === 'range') {
2866
- if (curJsonData.valueType === 'select' && (curJsonData.type === 'ContentStaticConfig' || curJsonData.type === 'ResourceCenter')) {
2866
+ if (curJsonData.valueType === 'select' && (!currentSchemaData.options || currentSchemaData.options.length === 0) && (curJsonData.type === 'ContentStaticConfig' || curJsonData.type === 'ResourceCenter')) {
2867
+ // 如果 range 没有可选项则从 value 中获取可选项
2867
2868
  var _valueSchema = targetJsonSchema.properties['value'];
2868
2869
  if (['select', 'radio', 'checkboxes'].includes(_valueSchema.type) && _valueSchema.options && _valueSchema.options.length > 0) {
2869
2870
  // range 和 value 复用 options
2870
- currentSchemaData.options = (0,$utils_index__WEBPACK_IMPORTED_MODULE_8__.objClone)(_valueSchema.options);
2871
+ currentSchemaData.options = (0,$utils_index__WEBPACK_IMPORTED_MODULE_8__.getWrapOptions)(_valueSchema.options);
2871
2872
  }
2872
2873
  }
2873
2874
  }
@@ -7903,9 +7904,11 @@ __webpack_require__.r(__webpack_exports__);
7903
7904
  /* harmony export */ formatOptions: function() { return /* binding */ formatOptions; },
7904
7905
  /* harmony export */ formatOptions1: function() { return /* binding */ formatOptions1; },
7905
7906
  /* harmony export */ getExprProperties: function() { return /* binding */ getExprProperties; },
7907
+ /* harmony export */ getObjectTitle: function() { return /* binding */ getObjectTitle; },
7906
7908
  /* harmony export */ getParams: function() { return /* binding */ getParams; },
7907
7909
  /* harmony export */ getURLParam: function() { return /* binding */ getURLParam; },
7908
7910
  /* harmony export */ getWebCacheData: function() { return /* binding */ getWebCacheData; },
7911
+ /* harmony export */ getWrapOptions: function() { return /* binding */ getWrapOptions; },
7909
7912
  /* harmony export */ hasProperties: function() { return /* binding */ hasProperties; },
7910
7913
  /* harmony export */ isBaseSchemaElem: function() { return /* binding */ isBaseSchemaElem; },
7911
7914
  /* harmony export */ isBoxSchemaElem: function() { return /* binding */ isBoxSchemaElem; },
@@ -8181,6 +8184,46 @@ function formatOptions1(options) {
8181
8184
  optionValue: optionValue
8182
8185
  };
8183
8186
  }
8187
+ function getObjectTitle(objItem) {
8188
+ if (objItem && (0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_0__.isObject)(objItem)) {
8189
+ var curObjectTitle = objItem.label || objItem.title || objItem.description || objItem.desc;
8190
+ if (curObjectTitle) {
8191
+ return curObjectTitle;
8192
+ }
8193
+ var objItemKeys = Object.keys(objItem);
8194
+ for (var index = 0, size = objItemKeys.length; index < size; index++) {
8195
+ var itemVal = objItem[objItemKeys[index]];
8196
+ if (itemVal && (0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_0__.isString)(itemVal) && !(0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_0__.isURL)(itemVal) && !(0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_0__.isColor)(itemVal)) {
8197
+ return itemVal;
8198
+ }
8199
+ }
8200
+ } else {
8201
+ return objItem;
8202
+ }
8203
+ }
8204
+ ;
8205
+
8206
+ /**
8207
+ * options 数据处理
8208
+ * 将 options 列表中的普通 option 自动包裹一层:
8209
+ * 比如:[{label: 'xxLabel', value: 123}] => [{label: 'xxLabel', value: {label: 'xxLabel', value: 123}}]
8210
+ */
8211
+ function getWrapOptions(options) {
8212
+ var curOptions = [];
8213
+ if ((0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_0__.isArray)(options)) {
8214
+ options.forEach(function (option) {
8215
+ if ((0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_0__.isObject)(option)) {
8216
+ curOptions.push({
8217
+ label: getObjectTitle(option),
8218
+ value: (0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_0__.isObject)(option.value) ? option.value : option
8219
+ });
8220
+ } else {
8221
+ curOptions.push(option);
8222
+ }
8223
+ });
8224
+ }
8225
+ return curOptions;
8226
+ }
8184
8227
 
8185
8228
  /***/ }),
8186
8229
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wibetter/json-editor",
3
- "version": "5.1.12",
3
+ "version": "5.1.16",
4
4
  "description": "JSON数据可视化/JSONEditor, 可视化界面编辑json数据",
5
5
  "keywords": [
6
6
  "json",
package/sdk/index.css CHANGED
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * @wibetter/json-editor v5.1.12
2
+ * @wibetter/json-editor v5.1.16
3
3
  * author: wibetter
4
4
  * build tool: AKFun
5
- * build time: Fri Jan 17 2025 15:43:26 GMT+0800 (中国标准时间)
5
+ * build time: Tue Jan 21 2025 18:00:52 GMT+0800 (中国标准时间)
6
6
  * build tool info: https://github.com/wibetter/akfun
7
7
  */
8
8
  /*!*********************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
package/sdk/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * @wibetter/json-editor v5.1.12
2
+ * @wibetter/json-editor v5.1.16
3
3
  * author: wibetter
4
4
  * build tool: AKFun
5
- * build time: Fri Jan 17 2025 15:43:26 GMT+0800 (中国标准时间)
5
+ * build time: Tue Jan 21 2025 18:00:52 GMT+0800 (中国标准时间)
6
6
  * build tool info: https://github.com/wibetter/akfun
7
7
  */
8
8
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -69271,11 +69271,12 @@ var ObjectSchema = /*#__PURE__*/function (_React$PureComponent) {
69271
69271
  }
69272
69272
  }
69273
69273
  if (currentJsonKey === 'range') {
69274
- if (curJsonData.valueType === 'select' && (curJsonData.type === 'ContentStaticConfig' || curJsonData.type === 'ResourceCenter')) {
69274
+ if (curJsonData.valueType === 'select' && (!currentSchemaData.options || currentSchemaData.options.length === 0) && (curJsonData.type === 'ContentStaticConfig' || curJsonData.type === 'ResourceCenter')) {
69275
+ // 如果 range 没有可选项则从 value 中获取可选项
69275
69276
  var _valueSchema = targetJsonSchema.properties['value'];
69276
69277
  if (['select', 'radio', 'checkboxes'].includes(_valueSchema.type) && _valueSchema.options && _valueSchema.options.length > 0) {
69277
69278
  // range 和 value 复用 options
69278
- currentSchemaData.options = (0,$utils_index__WEBPACK_IMPORTED_MODULE_4__.objClone)(_valueSchema.options);
69279
+ currentSchemaData.options = (0,$utils_index__WEBPACK_IMPORTED_MODULE_4__.getWrapOptions)(_valueSchema.options);
69279
69280
  }
69280
69281
  }
69281
69282
  }
@@ -74200,9 +74201,11 @@ __webpack_require__.r(__webpack_exports__);
74200
74201
  /* harmony export */ formatOptions: function() { return /* binding */ formatOptions; },
74201
74202
  /* harmony export */ formatOptions1: function() { return /* binding */ formatOptions1; },
74202
74203
  /* harmony export */ getExprProperties: function() { return /* binding */ getExprProperties; },
74204
+ /* harmony export */ getObjectTitle: function() { return /* binding */ getObjectTitle; },
74203
74205
  /* harmony export */ getParams: function() { return /* binding */ getParams; },
74204
74206
  /* harmony export */ getURLParam: function() { return /* binding */ getURLParam; },
74205
74207
  /* harmony export */ getWebCacheData: function() { return /* binding */ getWebCacheData; },
74208
+ /* harmony export */ getWrapOptions: function() { return /* binding */ getWrapOptions; },
74206
74209
  /* harmony export */ hasProperties: function() { return /* binding */ hasProperties; },
74207
74210
  /* harmony export */ isBaseSchemaElem: function() { return /* binding */ isBaseSchemaElem; },
74208
74211
  /* harmony export */ isBoxSchemaElem: function() { return /* binding */ isBoxSchemaElem; },
@@ -74477,6 +74480,46 @@ function formatOptions1(options) {
74477
74480
  optionValue: optionValue
74478
74481
  };
74479
74482
  }
74483
+ function getObjectTitle(objItem) {
74484
+ if (objItem && (0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_0__.isObject)(objItem)) {
74485
+ var curObjectTitle = objItem.label || objItem.title || objItem.description || objItem.desc;
74486
+ if (curObjectTitle) {
74487
+ return curObjectTitle;
74488
+ }
74489
+ var objItemKeys = Object.keys(objItem);
74490
+ for (var index = 0, size = objItemKeys.length; index < size; index++) {
74491
+ var itemVal = objItem[objItemKeys[index]];
74492
+ if (itemVal && (0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_0__.isString)(itemVal) && !(0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_0__.isURL)(itemVal) && !(0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_0__.isColor)(itemVal)) {
74493
+ return itemVal;
74494
+ }
74495
+ }
74496
+ } else {
74497
+ return objItem;
74498
+ }
74499
+ }
74500
+ ;
74501
+
74502
+ /**
74503
+ * options 数据处理
74504
+ * 将 options 列表中的普通 option 自动包裹一层:
74505
+ * 比如:[{label: 'xxLabel', value: 123}] => [{label: 'xxLabel', value: {label: 'xxLabel', value: 123}}]
74506
+ */
74507
+ function getWrapOptions(options) {
74508
+ var curOptions = [];
74509
+ if ((0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_0__.isArray)(options)) {
74510
+ options.forEach(function (option) {
74511
+ if ((0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_0__.isObject)(option)) {
74512
+ curOptions.push({
74513
+ label: getObjectTitle(option),
74514
+ value: (0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_0__.isObject)(option.value) ? option.value : option
74515
+ });
74516
+ } else {
74517
+ curOptions.push(option);
74518
+ }
74519
+ });
74520
+ }
74521
+ return curOptions;
74522
+ }
74480
74523
 
74481
74524
  /***/ }),
74482
74525
 
@@ -268508,7 +268551,7 @@ var initRadioData = {
268508
268551
  value: 'c',
268509
268552
  },
268510
268553
  ],
268511
- default: 'a',
268554
+ // default: 'a',
268512
268555
  description: '',
268513
268556
  };
268514
268557
 
@@ -268538,7 +268581,7 @@ var initSelectData = {
268538
268581
  value: 'c',
268539
268582
  },
268540
268583
  ],
268541
- default: 'a',
268584
+ // default: 'a',
268542
268585
  description: '',
268543
268586
  };
268544
268587
 
@@ -269701,9 +269744,14 @@ var initSohuSourceData = {
269701
269744
  title: '数据来源',
269702
269745
  isConditionProp: true,
269703
269746
  options: [
269747
+ /*
269748
+ {
269749
+ label: '模板直接配置',
269750
+ value: "DevDefaults",
269751
+ },
269752
+ */
269704
269753
  {
269705
- label: '模板直接配置',
269706
- // value: "DevDefaults",
269754
+ label: '模板自定义数据源',
269707
269755
  value: 'RuntimeDataSelfDefine',
269708
269756
  },
269709
269757
  {
@@ -269719,7 +269767,7 @@ var initSohuSourceData = {
269719
269767
  value: 'ResourceCenter',
269720
269768
  },
269721
269769
  ],
269722
- default: 'ContentStaticConfig',
269770
+ default: 'RuntimeDataSelfDefine',
269723
269771
  description: '',
269724
269772
  },
269725
269773
  description: {
@@ -269962,18 +270010,19 @@ var initSohuSourceData = {
269962
270010
  description: '',
269963
270011
  placeholder: '',
269964
270012
  },
269965
- CODE: {
269966
- title: 'Code参数',
269967
- type: 'input',
269968
- description: '',
269969
- placeholder: '',
269970
- },
269971
270013
  URL: {
269972
270014
  type: 'url',
269973
270015
  title: '跳转链接',
269974
270016
  description: '',
269975
270017
  placeholder: '',
269976
270018
  },
270019
+ CODE: {
270020
+ title: 'Code参数',
270021
+ type: 'input',
270022
+ description: '',
270023
+ placeholder: '',
270024
+ onShow: false,
270025
+ },
269977
270026
  },
269978
270027
  propertyOrder: ['SIZE', 'TITLE', 'URL', 'CODE'],
269979
270028
  showCodeViewBtn: false,