@wibetter/json-editor 5.0.26 → 5.0.28

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.0.26
2
+ * @wibetter/json-editor v5.0.27
3
3
  * author: wibetter
4
4
  * build tool: AKFun
5
- * build time: Thu Jan 02 2025 17:13:11 GMT+0800 (中国标准时间)
5
+ * build time: Mon Jan 06 2025 17:49:01 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.0.26
2
+ * @wibetter/json-editor v5.0.27
3
3
  * author: wibetter
4
4
  * build tool: AKFun
5
- * build time: Thu Jan 02 2025 17:13:11 GMT+0800 (中国标准时间)
5
+ * build time: Mon Jan 06 2025 17:49:01 GMT+0800 (中国标准时间)
6
6
  * build tool info: https://github.com/wibetter/akfun
7
7
  */
8
8
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -476,7 +476,7 @@ var MappingRender = function MappingRender(props) {
476
476
  var parentKeyRoute = (0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_2__.getParentKeyRoute)(keyRoute);
477
477
  var parentData = parentKeyRoute ? getJSONDataByKeyRoute(parentKeyRoute) || {} : {}; // 获取当前父级数据域
478
478
  var curData = Object.assign({}, JSONEditorObj, parentData);
479
- if (targetJsonSchema.onShow !== undefined && targetJsonSchema.onShow !== null && targetJsonSchema.onShow !== '' && ((0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_2__.isBoolean)(targetJsonSchema.onShow) && !targetJsonSchema.onShow || (0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_2__.isString)(targetJsonSchema.onShow) && !(0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_2__.evalExpression)(targetJsonSchema.onShow, curData))) {
479
+ if ((0,$utils_index__WEBPACK_IMPORTED_MODULE_3__.hasProperties)(targetJsonSchema.onShow) && targetJsonSchema.onShow !== '' && ((0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_2__.isBoolean)(targetJsonSchema.onShow) && !targetJsonSchema.onShow || (0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_2__.isString)(targetJsonSchema.onShow) && !(0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_2__.evalExpression)(targetJsonSchema.onShow, curData))) {
480
480
  return;
481
481
  }
482
482
  var curType = targetJsonSchema.typeOn ? (0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_2__.evalExpression)(targetJsonSchema.typeOn, curData) : targetJsonSchema.type;
@@ -873,6 +873,10 @@ var ArraySchema = /*#__PURE__*/function (_React$PureComponent) {
873
873
  var showCodeViewBtn = (_targetJsonSchema$sho = targetJsonSchema.showCodeViewBtn) != null ? _targetJsonSchema$sho : true;
874
874
  // 从jsonData中获取对应的数值
875
875
  var curJsonData = getJSONDataByKeyRoute(keyRoute); // json内容数据
876
+ if (!curJsonData || curJsonData.length === 0) {
877
+ // 添加一个默认的数组数据
878
+ curJsonData = [{}];
879
+ }
876
880
  var arrayItemsDataObj = targetJsonSchema.items; // schema数据
877
881
 
878
882
  // 获取前端缓存中的折叠数据
@@ -6841,7 +6845,12 @@ var JSONEditorStore = (_dec = mobx__WEBPACK_IMPORTED_MODULE_4__.action.bound, _d
6841
6845
  // 2. 获取父级数据对象
6842
6846
  var parentJsonDataObj = (0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_6__.getJsonDataByKeyRoute)(parentKeyRoute, this.jsonData);
6843
6847
  // 3. 数值更新
6844
- parentJsonDataObj[curKey] = newVal;
6848
+ if (parentJsonDataObj) {
6849
+ parentJsonDataObj[curKey] = newVal;
6850
+ } else {
6851
+ var _this$updateFormValue;
6852
+ this.updateFormValueData(parentKeyRoute, (_this$updateFormValue = {}, _this$updateFormValue[curKey] = newVal, _this$updateFormValue));
6853
+ }
6845
6854
  } else {
6846
6855
  // 当keyRoute为空时直接修改当前schemaData
6847
6856
  this.jsonData = newVal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wibetter/json-editor",
3
- "version": "5.0.26",
3
+ "version": "5.0.28",
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.0.26
2
+ * @wibetter/json-editor v5.0.27
3
3
  * author: wibetter
4
4
  * build tool: AKFun
5
- * build time: Thu Jan 02 2025 17:13:23 GMT+0800 (中国标准时间)
5
+ * build time: Mon Jan 06 2025 17:49:14 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.0.26
2
+ * @wibetter/json-editor v5.0.27
3
3
  * author: wibetter
4
4
  * build tool: AKFun
5
- * build time: Thu Jan 02 2025 17:13:23 GMT+0800 (中国标准时间)
5
+ * build time: Mon Jan 06 2025 17:49:14 GMT+0800 (中国标准时间)
6
6
  * build tool info: https://github.com/wibetter/akfun
7
7
  */
8
8
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -66926,7 +66926,7 @@ var MappingRender = function MappingRender(props) {
66926
66926
  var parentKeyRoute = (0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_2__.getParentKeyRoute)(keyRoute);
66927
66927
  var parentData = parentKeyRoute ? getJSONDataByKeyRoute(parentKeyRoute) || {} : {}; // 获取当前父级数据域
66928
66928
  var curData = Object.assign({}, JSONEditorObj, parentData);
66929
- if (targetJsonSchema.onShow !== undefined && targetJsonSchema.onShow !== null && targetJsonSchema.onShow !== '' && ((0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_2__.isBoolean)(targetJsonSchema.onShow) && !targetJsonSchema.onShow || (0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_2__.isString)(targetJsonSchema.onShow) && !(0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_2__.evalExpression)(targetJsonSchema.onShow, curData))) {
66929
+ if ((0,$utils_index__WEBPACK_IMPORTED_MODULE_3__.hasProperties)(targetJsonSchema.onShow) && targetJsonSchema.onShow !== '' && ((0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_2__.isBoolean)(targetJsonSchema.onShow) && !targetJsonSchema.onShow || (0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_2__.isString)(targetJsonSchema.onShow) && !(0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_2__.evalExpression)(targetJsonSchema.onShow, curData))) {
66930
66930
  return;
66931
66931
  }
66932
66932
  var curType = targetJsonSchema.typeOn ? (0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_2__.evalExpression)(targetJsonSchema.typeOn, curData) : targetJsonSchema.type;
@@ -67323,6 +67323,10 @@ var ArraySchema = /*#__PURE__*/function (_React$PureComponent) {
67323
67323
  var showCodeViewBtn = (_targetJsonSchema$sho = targetJsonSchema.showCodeViewBtn) != null ? _targetJsonSchema$sho : true;
67324
67324
  // 从jsonData中获取对应的数值
67325
67325
  var curJsonData = getJSONDataByKeyRoute(keyRoute); // json内容数据
67326
+ if (!curJsonData || curJsonData.length === 0) {
67327
+ // 添加一个默认的数组数据
67328
+ curJsonData = [{}];
67329
+ }
67326
67330
  var arrayItemsDataObj = targetJsonSchema.items; // schema数据
67327
67331
 
67328
67332
  // 获取前端缓存中的折叠数据
@@ -73155,7 +73159,12 @@ var JSONEditorStore = (_dec = mobx__WEBPACK_IMPORTED_MODULE_4__.action.bound, _d
73155
73159
  // 2. 获取父级数据对象
73156
73160
  var parentJsonDataObj = (0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_5__.getJsonDataByKeyRoute)(parentKeyRoute, this.jsonData);
73157
73161
  // 3. 数值更新
73158
- parentJsonDataObj[curKey] = newVal;
73162
+ if (parentJsonDataObj) {
73163
+ parentJsonDataObj[curKey] = newVal;
73164
+ } else {
73165
+ var _this$updateFormValue;
73166
+ this.updateFormValueData(parentKeyRoute, (_this$updateFormValue = {}, _this$updateFormValue[curKey] = newVal, _this$updateFormValue));
73167
+ }
73159
73168
  } else {
73160
73169
  // 当keyRoute为空时直接修改当前schemaData
73161
73170
  this.jsonData = newVal;