@wibetter/json-editor 5.1.13 → 5.1.17

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.13
2
+ * @wibetter/json-editor v5.1.17
3
3
  * author: wibetter
4
4
  * build tool: AKFun
5
- * build time: Mon Jan 20 2025 16:58:20 GMT+0800 (中国标准时间)
5
+ * build time: Tue Jan 21 2025 18:42:46 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.13
2
+ * @wibetter/json-editor v5.1.17
3
3
  * author: wibetter
4
4
  * build tool: AKFun
5
- * build time: Mon Jan 20 2025 16:58:20 GMT+0800 (中国标准时间)
5
+ * build time: Tue Jan 21 2025 18:42:46 GMT+0800 (中国标准时间)
6
6
  * build tool info: https://github.com/wibetter/akfun
7
7
  */
8
8
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -2868,7 +2868,7 @@ var ObjectSchema = /*#__PURE__*/function (_React$PureComponent) {
2868
2868
  var _valueSchema = targetJsonSchema.properties['value'];
2869
2869
  if (['select', 'radio', 'checkboxes'].includes(_valueSchema.type) && _valueSchema.options && _valueSchema.options.length > 0) {
2870
2870
  // range 和 value 复用 options
2871
- 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);
2872
2872
  }
2873
2873
  }
2874
2874
  }
@@ -7904,9 +7904,11 @@ __webpack_require__.r(__webpack_exports__);
7904
7904
  /* harmony export */ formatOptions: function() { return /* binding */ formatOptions; },
7905
7905
  /* harmony export */ formatOptions1: function() { return /* binding */ formatOptions1; },
7906
7906
  /* harmony export */ getExprProperties: function() { return /* binding */ getExprProperties; },
7907
+ /* harmony export */ getObjectTitle: function() { return /* binding */ getObjectTitle; },
7907
7908
  /* harmony export */ getParams: function() { return /* binding */ getParams; },
7908
7909
  /* harmony export */ getURLParam: function() { return /* binding */ getURLParam; },
7909
7910
  /* harmony export */ getWebCacheData: function() { return /* binding */ getWebCacheData; },
7911
+ /* harmony export */ getWrapOptions: function() { return /* binding */ getWrapOptions; },
7910
7912
  /* harmony export */ hasProperties: function() { return /* binding */ hasProperties; },
7911
7913
  /* harmony export */ isBaseSchemaElem: function() { return /* binding */ isBaseSchemaElem; },
7912
7914
  /* harmony export */ isBoxSchemaElem: function() { return /* binding */ isBoxSchemaElem; },
@@ -8182,6 +8184,45 @@ function formatOptions1(options) {
8182
8184
  optionValue: optionValue
8183
8185
  };
8184
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
+ * options 数据处理
8207
+ * 将 options 列表中的普通 option 自动包裹一层:
8208
+ * 比如:[{label: 'xxLabel', value: 123}] => [{label: 'xxLabel', value: {label: 'xxLabel', value: 123}}]
8209
+ */
8210
+ function getWrapOptions(options) {
8211
+ var curOptions = [];
8212
+ if ((0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_0__.isArray)(options)) {
8213
+ options.forEach(function (option) {
8214
+ if ((0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_0__.isObject)(option)) {
8215
+ curOptions.push({
8216
+ label: getObjectTitle(option),
8217
+ value: option // isObject(option.value) ? option.value : option,
8218
+ });
8219
+ } else {
8220
+ curOptions.push(option);
8221
+ }
8222
+ });
8223
+ }
8224
+ return curOptions;
8225
+ }
8185
8226
 
8186
8227
  /***/ }),
8187
8228
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wibetter/json-editor",
3
- "version": "5.1.13",
3
+ "version": "5.1.17",
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.13
2
+ * @wibetter/json-editor v5.1.17
3
3
  * author: wibetter
4
4
  * build tool: AKFun
5
- * build time: Mon Jan 20 2025 16:57:33 GMT+0800 (中国标准时间)
5
+ * build time: Tue Jan 21 2025 18:42:58 GMT+0800 (中国标准时间)
6
6
  * build tool info: https://github.com/wibetter/akfun
7
7
  */
8
8
  /*!*********************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\