@wibetter/json-editor 5.0.26 → 5.0.29

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.28
3
3
  * author: wibetter
4
4
  * build tool: AKFun
5
- * build time: Thu Jan 02 2025 17:13:11 GMT+0800 (中国标准时间)
5
+ * build time: Tue Jan 07 2025 14:49:17 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.28
3
3
  * author: wibetter
4
4
  * build tool: AKFun
5
- * build time: Thu Jan 02 2025 17:13:11 GMT+0800 (中国标准时间)
5
+ * build time: Tue Jan 07 2025 14:49:17 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
  // 获取前端缓存中的折叠数据
@@ -3912,13 +3916,14 @@ var InputImageSchema = /*#__PURE__*/function (_React$PureComponent) {
3912
3916
  var _ref3 = schemaStore || {},
3913
3917
  pageScreen = _ref3.pageScreen;
3914
3918
  var _ref4 = jsonStore || {},
3915
- getJSONDataByKeyRoute = _ref4.getJSONDataByKeyRoute;
3919
+ getJSONDataByKeyRoute = _ref4.getJSONDataByKeyRoute,
3920
+ _options = _ref4.options;
3916
3921
  var _this$props4 = this.props,
3917
3922
  nodeKey = _this$props4.nodeKey,
3918
3923
  jsonKey = _this$props4.jsonKey,
3919
3924
  keyRoute = _this$props4.keyRoute,
3920
3925
  targetJsonSchema = _this$props4.targetJsonSchema;
3921
- var options = this.props.options || {};
3926
+ var options = _options || {};
3922
3927
  var loading = this.state.loading;
3923
3928
  // 从jsonData中获取对应的数值
3924
3929
  var curJsonData = keyRoute && getJSONDataByKeyRoute(keyRoute);
@@ -6841,7 +6846,12 @@ var JSONEditorStore = (_dec = mobx__WEBPACK_IMPORTED_MODULE_4__.action.bound, _d
6841
6846
  // 2. 获取父级数据对象
6842
6847
  var parentJsonDataObj = (0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_6__.getJsonDataByKeyRoute)(parentKeyRoute, this.jsonData);
6843
6848
  // 3. 数值更新
6844
- parentJsonDataObj[curKey] = newVal;
6849
+ if (parentJsonDataObj) {
6850
+ parentJsonDataObj[curKey] = newVal;
6851
+ } else {
6852
+ var _this$updateFormValue;
6853
+ this.updateFormValueData(parentKeyRoute, (_this$updateFormValue = {}, _this$updateFormValue[curKey] = newVal, _this$updateFormValue));
6854
+ }
6845
6855
  } else {
6846
6856
  // 当keyRoute为空时直接修改当前schemaData
6847
6857
  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.29",
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.28
3
3
  * author: wibetter
4
4
  * build tool: AKFun
5
- * build time: Thu Jan 02 2025 17:13:23 GMT+0800 (中国标准时间)
5
+ * build time: Tue Jan 07 2025 14:49:38 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.28
3
3
  * author: wibetter
4
4
  * build tool: AKFun
5
- * build time: Thu Jan 02 2025 17:13:23 GMT+0800 (中国标准时间)
5
+ * build time: Tue Jan 07 2025 14:49:38 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
  // 获取前端缓存中的折叠数据
@@ -70298,13 +70302,14 @@ var InputImageSchema = /*#__PURE__*/function (_React$PureComponent) {
70298
70302
  var _ref3 = schemaStore || {},
70299
70303
  pageScreen = _ref3.pageScreen;
70300
70304
  var _ref4 = jsonStore || {},
70301
- getJSONDataByKeyRoute = _ref4.getJSONDataByKeyRoute;
70305
+ getJSONDataByKeyRoute = _ref4.getJSONDataByKeyRoute,
70306
+ _options = _ref4.options;
70302
70307
  var _this$props4 = this.props,
70303
70308
  nodeKey = _this$props4.nodeKey,
70304
70309
  jsonKey = _this$props4.jsonKey,
70305
70310
  keyRoute = _this$props4.keyRoute,
70306
70311
  targetJsonSchema = _this$props4.targetJsonSchema;
70307
- var options = this.props.options || {};
70312
+ var options = _options || {};
70308
70313
  var loading = this.state.loading;
70309
70314
  // 从jsonData中获取对应的数值
70310
70315
  var curJsonData = keyRoute && getJSONDataByKeyRoute(keyRoute);
@@ -73155,7 +73160,12 @@ var JSONEditorStore = (_dec = mobx__WEBPACK_IMPORTED_MODULE_4__.action.bound, _d
73155
73160
  // 2. 获取父级数据对象
73156
73161
  var parentJsonDataObj = (0,_wibetter_json_utils__WEBPACK_IMPORTED_MODULE_5__.getJsonDataByKeyRoute)(parentKeyRoute, this.jsonData);
73157
73162
  // 3. 数值更新
73158
- parentJsonDataObj[curKey] = newVal;
73163
+ if (parentJsonDataObj) {
73164
+ parentJsonDataObj[curKey] = newVal;
73165
+ } else {
73166
+ var _this$updateFormValue;
73167
+ this.updateFormValueData(parentKeyRoute, (_this$updateFormValue = {}, _this$updateFormValue[curKey] = newVal, _this$updateFormValue));
73168
+ }
73159
73169
  } else {
73160
73170
  // 当keyRoute为空时直接修改当前schemaData
73161
73171
  this.jsonData = newVal;