@wibetter/json-editor 5.0.7 → 5.0.9

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.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * @wibetter/json-editor v5.0.5
2
+ * @wibetter/json-editor v5.0.8
3
3
  * author: wibetter
4
4
  * build tool: AKFun
5
- * build time: Fri Dec 20 2024 23:28:02 GMT+0800 (中国标准时间)
5
+ * build time: Thu Dec 26 2024 13:18:12 GMT+0800 (中国标准时间)
6
6
  * build tool info: https://github.com/wibetter/akfun
7
7
  */
8
8
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -309,37 +309,46 @@
309
309
  // 是否显示code模式,默认不显示code模式
310
310
  viewStyle: _this.catchViewStyle(props.viewStyle), // 默认为fold(可折叠面板),可选:tabs:(tabs切换面板)
311
311
  };
312
+ var _ref = _this.props.schemaStore || {},
313
+ initJSONSchemaData = _ref.initJSONSchemaData,
314
+ setPageScreen = _ref.setPageScreen;
315
+ var _ref2 = _this.props.jsonStore || {},
316
+ initJSONData = _ref2.initJSONData,
317
+ initOnChange = _ref2.initOnChange,
318
+ setDynamicDataList = _ref2.setDynamicDataList,
319
+ setOptions = _ref2.setOptions;
320
+
312
321
  // 根据props.schemaData对jsonSchema进行初始化
313
322
  if (props.schemaData) {
314
- _this.props.initJSONSchemaData(props.schemaData);
323
+ initJSONSchemaData(props.schemaData);
315
324
  // 根据props.jsonData对jsonData进行初始化
316
- _this.props.initJSONData(props.jsonData);
325
+ initJSONData(props.jsonData);
317
326
  } else if (props.jsonData) {
318
327
  // schemaData为空,jsonData不为空时,尝试通过jsonData转jsonSchema
319
328
  var jsonSchema = (0,
320
329
  _wibetter_json_utils__WEBPACK_IMPORTED_MODULE_8__.json2schema)(
321
330
  props.jsonData,
322
331
  ); // 通过json转换schema
323
- _this.props.initJSONSchemaData(jsonSchema);
332
+ initJSONSchemaData(jsonSchema);
324
333
  // 根据props.jsonData对jsonData进行初始化
325
- _this.props.initJSONData(props.jsonData);
334
+ initJSONData(props.jsonData);
326
335
  }
327
336
  // 读取宽屏和小屏的配置
328
337
  if (props.wideScreen) {
329
- _this.props.setPageScreen(props.wideScreen);
338
+ setPageScreen(props.wideScreen);
330
339
  }
331
340
  // 记录onChange事件
332
341
  if (props.onChange) {
333
- _this.props.initOnChange(props.onChange);
342
+ initOnChange(props.onChange);
334
343
  }
335
344
 
336
345
  // 获取dynamicDataList(动态数据源)
337
346
  if (props.dynamicDataList) {
338
- _this.props.setDynamicDataList(props.dynamicDataList);
347
+ setDynamicDataList(props.dynamicDataList);
339
348
  }
340
349
  // 配置类数据
341
350
  if (props.options) {
342
- _this.props.setOptions(props.options);
351
+ setOptions(props.options);
343
352
  }
344
353
  return _this;
345
354
  }
@@ -350,6 +359,14 @@
350
359
  var _proto = JSONDataEditor.prototype;
351
360
  _proto.componentWillReceiveProps =
352
361
  function componentWillReceiveProps(nextProps) {
362
+ var _ref3 = this.props.schemaStore || {},
363
+ JSONSchemaChange = _ref3.JSONSchemaChange,
364
+ setPageScreen = _ref3.setPageScreen;
365
+ var _ref4 = this.props.jsonStore || {},
366
+ initJSONData = _ref4.initJSONData,
367
+ initOnChange = _ref4.initOnChange,
368
+ setDynamicDataList = _ref4.setDynamicDataList,
369
+ setOptions = _ref4.setOptions;
353
370
  /** 1. 先初始化schemaData,如果jsonData和schemaData的格式不一致,则以schemaData为准 */
354
371
  if (
355
372
  !(0, $utils_index__WEBPACK_IMPORTED_MODULE_7__.isEqual)(
@@ -357,7 +374,7 @@
357
374
  this.props.schemaData,
358
375
  )
359
376
  ) {
360
- this.props.JSONSchemaChange(nextProps.schemaData);
377
+ JSONSchemaChange(nextProps.schemaData);
361
378
  }
362
379
  /** 2. 初始化jsonData */
363
380
  if (
@@ -366,7 +383,7 @@
366
383
  this.props.jsonData,
367
384
  )
368
385
  ) {
369
- this.props.initJSONData(nextProps.jsonData);
386
+ initJSONData(nextProps.jsonData);
370
387
  }
371
388
  // 读取code模式配置
372
389
  if (
@@ -396,7 +413,7 @@
396
413
  this.props.wideScreen,
397
414
  )
398
415
  ) {
399
- this.props.setPageScreen(nextProps.wideScreen);
416
+ setPageScreen(nextProps.wideScreen);
400
417
  }
401
418
  // 记录onChange事件
402
419
  if (
@@ -405,7 +422,7 @@
405
422
  this.props.onChange,
406
423
  )
407
424
  ) {
408
- this.props.initOnChange(nextProps.onChange);
425
+ initOnChange(nextProps.onChange);
409
426
  }
410
427
 
411
428
  // 获取dynamicDataList(动态数据源)
@@ -415,7 +432,7 @@
415
432
  this.props.dynamicDataList,
416
433
  )
417
434
  ) {
418
- this.props.setDynamicDataList(nextProps.dynamicDataList);
435
+ setDynamicDataList(nextProps.dynamicDataList);
419
436
  }
420
437
  if (
421
438
  !(0, $utils_index__WEBPACK_IMPORTED_MODULE_7__.isEqual)(
@@ -423,18 +440,19 @@
423
440
  this.props.options,
424
441
  )
425
442
  ) {
426
- this.props.setOptions(nextProps.options);
443
+ setOptions(nextProps.options);
427
444
  }
428
445
  };
429
446
  _proto.render = function render() {
430
447
  var _this2 = this;
431
448
  var _this$props = this.props,
432
- jsonSchema = _this$props.jsonSchema,
433
- lastUpdateTime = _this$props.lastUpdateTime,
434
- jsonLastUpdateTime = _this$props.jsonLastUpdateTime,
435
- getJSONDataByKeyRoute = _this$props.getJSONDataByKeyRoute,
436
- keyRoute2indexRoute = _this$props.keyRoute2indexRoute,
437
- updateFormValueData = _this$props.updateFormValueData;
449
+ schemaStore = _this$props.schemaStore,
450
+ jsonStore = _this$props.jsonStore;
451
+ var _ref5 = schemaStore || {},
452
+ jsonSchema = _ref5.jsonSchema,
453
+ lastUpdateTime = _ref5.lastUpdateTime;
454
+ var _ref6 = jsonStore || {},
455
+ jsonLastUpdateTime = _ref6.lastUpdateTime;
438
456
  var _this$state = this.state,
439
457
  jsonView = _this$state.jsonView,
440
458
  viewStyle = _this$state.viewStyle;
@@ -522,10 +540,8 @@
522
540
  nodeKey: nodeKey,
523
541
  targetJsonSchema: currentSchemaData,
524
542
  isStructuredSchema: isStructured,
525
- getJSONDataByKeyRoute:
526
- getJSONDataByKeyRoute,
527
- keyRoute2indexRoute: keyRoute2indexRoute,
528
- updateFormValueData: updateFormValueData,
543
+ schemaStore: schemaStore,
544
+ jsonStore: jsonStore,
529
545
  }),
530
546
  );
531
547
  }
@@ -586,10 +602,8 @@
586
602
  nodeKey: nodeKey,
587
603
  targetJsonSchema: currentSchemaData,
588
604
  isStructuredSchema: isStructured,
589
- getJSONDataByKeyRoute:
590
- getJSONDataByKeyRoute,
591
- keyRoute2indexRoute: keyRoute2indexRoute,
592
- updateFormValueData: updateFormValueData,
605
+ schemaStore: schemaStore,
606
+ jsonStore: jsonStore,
593
607
  }),
594
608
  );
595
609
  }
@@ -611,9 +625,8 @@
611
625
  keyRoute: '',
612
626
  nodeKey: '',
613
627
  targetJsonSchema: jsonSchema,
614
- getJSONDataByKeyRoute: getJSONDataByKeyRoute,
615
- keyRoute2indexRoute: keyRoute2indexRoute,
616
- updateFormValueData: updateFormValueData,
628
+ schemaStore: schemaStore,
629
+ jsonStore: jsonStore,
617
630
  }),
618
631
  ),
619
632
  ),
@@ -648,20 +661,8 @@
648
661
  /* harmony default export */ __webpack_exports__['default'] = (0,
649
662
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
650
663
  return {
651
- jsonSchema: stores.JSONSchemaStore.jsonSchema,
652
- lastUpdateTime: stores.JSONSchemaStore.lastUpdateTime,
653
- jsonLastUpdateTime: stores.JSONEditorStore.lastUpdateTime,
654
- initJSONSchemaData: stores.JSONSchemaStore.initJSONSchemaData,
655
- JSONSchemaChange: stores.JSONSchemaStore.JSONSchemaChange,
656
- initJSONData: stores.JSONEditorStore.initJSONData,
657
- initOnChange: stores.JSONEditorStore.initOnChange,
658
- getJSONDataByKeyRoute:
659
- stores.JSONEditorStore.getJSONDataByKeyRoute,
660
- keyRoute2indexRoute: stores.JSONSchemaStore.keyRoute2indexRoute,
661
- setDynamicDataList: stores.JSONEditorStore.setDynamicDataList,
662
- setOptions: stores.JSONEditorStore.setOptions,
663
- setPageScreen: stores.JSONSchemaStore.setPageScreen,
664
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
664
+ schemaStore: stores.JSONSchemaStore,
665
+ jsonStore: stores.JSONEditorStore,
665
666
  };
666
667
  })(
667
668
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(
@@ -697,151 +698,169 @@
697
698
  /*#__PURE__*/ __webpack_require__.n(
698
699
  react__WEBPACK_IMPORTED_MODULE_1__,
699
700
  );
700
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ =
701
- __webpack_require__(/*! ../utils */ './src/utils/index.js');
702
- /* harmony import */ var $renderers_ArraySchema_index__WEBPACK_IMPORTED_MODULE_3__ =
701
+ /* harmony import */ var _wibetter_json_utils__WEBPACK_IMPORTED_MODULE_2__ =
702
+ __webpack_require__(
703
+ /*! @wibetter/json-utils */ '@wibetter/json-utils',
704
+ );
705
+ /* harmony import */ var _wibetter_json_utils__WEBPACK_IMPORTED_MODULE_2___default =
706
+ /*#__PURE__*/ __webpack_require__.n(
707
+ _wibetter_json_utils__WEBPACK_IMPORTED_MODULE_2__,
708
+ );
709
+ /* harmony import */ var $utils_index__WEBPACK_IMPORTED_MODULE_3__ =
710
+ __webpack_require__(/*! $utils/index */ './src/utils/index.js');
711
+ /* harmony import */ var $renderers_ArraySchema_index__WEBPACK_IMPORTED_MODULE_4__ =
703
712
  __webpack_require__(
704
713
  /*! $renderers/ArraySchema/index */ './src/renderers/ArraySchema/index.js',
705
714
  );
706
- /* harmony import */ var $renderers_ObjectSchema_index__WEBPACK_IMPORTED_MODULE_4__ =
715
+ /* harmony import */ var $renderers_ObjectSchema_index__WEBPACK_IMPORTED_MODULE_5__ =
707
716
  __webpack_require__(
708
717
  /*! $renderers/ObjectSchema/index */ './src/renderers/ObjectSchema/index.js',
709
718
  );
710
- /* harmony import */ var $renderers_DataSourceSchema_index__WEBPACK_IMPORTED_MODULE_5__ =
719
+ /* harmony import */ var $renderers_DataSourceSchema_index__WEBPACK_IMPORTED_MODULE_6__ =
711
720
  __webpack_require__(
712
721
  /*! $renderers/DataSourceSchema/index */ './src/renderers/DataSourceSchema/index.js',
713
722
  );
714
- /* harmony import */ var $renderers_DynamicDataSchema_index__WEBPACK_IMPORTED_MODULE_6__ =
723
+ /* harmony import */ var $renderers_DynamicDataSchema_index__WEBPACK_IMPORTED_MODULE_7__ =
715
724
  __webpack_require__(
716
725
  /*! $renderers/DynamicDataSchema/index */ './src/renderers/DynamicDataSchema/index.js',
717
726
  );
718
- /* harmony import */ var $renderers_EventSchema_index__WEBPACK_IMPORTED_MODULE_7__ =
727
+ /* harmony import */ var $renderers_EventSchema_index__WEBPACK_IMPORTED_MODULE_8__ =
719
728
  __webpack_require__(
720
729
  /*! $renderers/EventSchema/index */ './src/renderers/EventSchema/index.js',
721
730
  );
722
- /* harmony import */ var $renderers_QuantitySchema_index__WEBPACK_IMPORTED_MODULE_8__ =
731
+ /* harmony import */ var $renderers_QuantitySchema_index__WEBPACK_IMPORTED_MODULE_9__ =
723
732
  __webpack_require__(
724
733
  /*! $renderers/QuantitySchema/index */ './src/renderers/QuantitySchema/index.js',
725
734
  );
726
- /* harmony import */ var $renderers_BoxStyleSchema_index__WEBPACK_IMPORTED_MODULE_9__ =
735
+ /* harmony import */ var $renderers_BoxStyleSchema_index__WEBPACK_IMPORTED_MODULE_10__ =
727
736
  __webpack_require__(
728
737
  /*! $renderers/BoxStyleSchema/index */ './src/renderers/BoxStyleSchema/index.js',
729
738
  );
730
- /* harmony import */ var $renderers_RadioSchema_index__WEBPACK_IMPORTED_MODULE_10__ =
739
+ /* harmony import */ var $renderers_RadioSchema_index__WEBPACK_IMPORTED_MODULE_11__ =
731
740
  __webpack_require__(
732
741
  /*! $renderers/RadioSchema/index */ './src/renderers/RadioSchema/index.js',
733
742
  );
734
- /* harmony import */ var $renderers_CheckboxSchema_index__WEBPACK_IMPORTED_MODULE_11__ =
743
+ /* harmony import */ var $renderers_CheckboxSchema_index__WEBPACK_IMPORTED_MODULE_12__ =
735
744
  __webpack_require__(
736
745
  /*! $renderers/CheckboxSchema/index */ './src/renderers/CheckboxSchema/index.js',
737
746
  );
738
- /* harmony import */ var $renderers_InputFormSchema_index__WEBPACK_IMPORTED_MODULE_12__ =
747
+ /* harmony import */ var $renderers_InputFormSchema_index__WEBPACK_IMPORTED_MODULE_13__ =
739
748
  __webpack_require__(
740
749
  /*! $renderers/InputFormSchema/index */ './src/renderers/InputFormSchema/index.js',
741
750
  );
742
- /* harmony import */ var $renderers_TextAreaFormSchema_index__WEBPACK_IMPORTED_MODULE_13__ =
751
+ /* harmony import */ var $renderers_TextAreaFormSchema_index__WEBPACK_IMPORTED_MODULE_14__ =
743
752
  __webpack_require__(
744
753
  /*! $renderers/TextAreaFormSchema/index */ './src/renderers/TextAreaFormSchema/index.js',
745
754
  );
746
- /* harmony import */ var $renderers_TextEditorSchema_index__WEBPACK_IMPORTED_MODULE_14__ =
755
+ /* harmony import */ var $renderers_TextEditorSchema_index__WEBPACK_IMPORTED_MODULE_15__ =
747
756
  __webpack_require__(
748
757
  /*! $renderers/TextEditorSchema/index */ './src/renderers/TextEditorSchema/index.js',
749
758
  );
750
- /* harmony import */ var $renderers_NumberFormSchema_index__WEBPACK_IMPORTED_MODULE_15__ =
759
+ /* harmony import */ var $renderers_NumberFormSchema_index__WEBPACK_IMPORTED_MODULE_16__ =
751
760
  __webpack_require__(
752
761
  /*! $renderers/NumberFormSchema/index */ './src/renderers/NumberFormSchema/index.js',
753
762
  );
754
- /* harmony import */ var $renderers_BooleanFormSchema_index__WEBPACK_IMPORTED_MODULE_16__ =
763
+ /* harmony import */ var $renderers_BooleanFormSchema_index__WEBPACK_IMPORTED_MODULE_17__ =
755
764
  __webpack_require__(
756
765
  /*! $renderers/BooleanFormSchema/index */ './src/renderers/BooleanFormSchema/index.js',
757
766
  );
758
- /* harmony import */ var $renderers_DateTimeFormSchema_index__WEBPACK_IMPORTED_MODULE_17__ =
767
+ /* harmony import */ var $renderers_DateTimeFormSchema_index__WEBPACK_IMPORTED_MODULE_18__ =
759
768
  __webpack_require__(
760
769
  /*! $renderers/DateTimeFormSchema/index */ './src/renderers/DateTimeFormSchema/index.js',
761
770
  );
762
- /* harmony import */ var $renderers_TimeFormSchema_index__WEBPACK_IMPORTED_MODULE_18__ =
771
+ /* harmony import */ var $renderers_TimeFormSchema_index__WEBPACK_IMPORTED_MODULE_19__ =
763
772
  __webpack_require__(
764
773
  /*! $renderers/TimeFormSchema/index */ './src/renderers/TimeFormSchema/index.js',
765
774
  );
766
- /* harmony import */ var $renderers_URLFormSchema_index__WEBPACK_IMPORTED_MODULE_19__ =
775
+ /* harmony import */ var $renderers_URLFormSchema_index__WEBPACK_IMPORTED_MODULE_20__ =
767
776
  __webpack_require__(
768
777
  /*! $renderers/URLFormSchema/index */ './src/renderers/URLFormSchema/index.js',
769
778
  );
770
- /* harmony import */ var $renderers_ColorFormSchemaV3_index__WEBPACK_IMPORTED_MODULE_20__ =
779
+ /* harmony import */ var $renderers_ColorFormSchemaV3_index__WEBPACK_IMPORTED_MODULE_21__ =
771
780
  __webpack_require__(
772
781
  /*! $renderers/ColorFormSchemaV3/index */ './src/renderers/ColorFormSchemaV3/index.js',
773
782
  );
774
- /* harmony import */ var $renderers_JsonFormSchema_index__WEBPACK_IMPORTED_MODULE_21__ =
783
+ /* harmony import */ var $renderers_JsonFormSchema_index__WEBPACK_IMPORTED_MODULE_22__ =
775
784
  __webpack_require__(
776
785
  /*! $renderers/JsonFormSchema/index */ './src/renderers/JsonFormSchema/index.js',
777
786
  );
778
- /* harmony import */ var $renderers_CodeAreaFormSchema_index__WEBPACK_IMPORTED_MODULE_22__ =
787
+ /* harmony import */ var $renderers_CodeAreaFormSchema_index__WEBPACK_IMPORTED_MODULE_23__ =
779
788
  __webpack_require__(
780
789
  /*! $renderers/CodeAreaFormSchema/index */ './src/renderers/CodeAreaFormSchema/index.js',
781
790
  );
782
- /* harmony import */ var $renderers_HtmlAreaFormSchema_index__WEBPACK_IMPORTED_MODULE_23__ =
791
+ /* harmony import */ var $renderers_HtmlAreaFormSchema_index__WEBPACK_IMPORTED_MODULE_24__ =
783
792
  __webpack_require__(
784
793
  /*! $renderers/HtmlAreaFormSchema/index */ './src/renderers/HtmlAreaFormSchema/index.js',
785
794
  );
786
- /* harmony import */ var $renderers_SelectSchema_index__WEBPACK_IMPORTED_MODULE_24__ =
795
+ /* harmony import */ var $renderers_SelectSchema_index__WEBPACK_IMPORTED_MODULE_25__ =
787
796
  __webpack_require__(
788
797
  /*! $renderers/SelectSchema/index */ './src/renderers/SelectSchema/index.js',
789
798
  );
790
- /* harmony import */ var $renderers_DynamicConfigSchema_index__WEBPACK_IMPORTED_MODULE_25__ =
799
+ /* harmony import */ var $renderers_InputImageSchema_index__WEBPACK_IMPORTED_MODULE_26__ =
800
+ __webpack_require__(
801
+ /*! $renderers/InputImageSchema/index */ './src/renderers/InputImageSchema/index.js',
802
+ );
803
+ /* harmony import */ var $renderers_DynamicConfigSchema_index__WEBPACK_IMPORTED_MODULE_27__ =
791
804
  __webpack_require__(
792
805
  /*! $renderers/DynamicConfigSchema/index */ './src/renderers/DynamicConfigSchema/index.js',
793
806
  );
794
- /* harmony import */ var $renderers_SohuDataSourceSchema_index__WEBPACK_IMPORTED_MODULE_26__ =
807
+ /* harmony import */ var $renderers_SohuDataSourceSchema_index__WEBPACK_IMPORTED_MODULE_28__ =
795
808
  __webpack_require__(
796
809
  /*! $renderers/SohuDataSourceSchema/index */ './src/renderers/SohuDataSourceSchema/index.js',
797
810
  );
798
- /* harmony import */ var $renderers_SohuEventSchema_index__WEBPACK_IMPORTED_MODULE_27__ =
811
+ /* harmony import */ var $renderers_SohuEventSchema_index__WEBPACK_IMPORTED_MODULE_29__ =
799
812
  __webpack_require__(
800
813
  /*! $renderers/SohuEventSchema/index */ './src/renderers/SohuEventSchema/index.js',
801
814
  );
802
815
 
816
+ // import {omit} from 'lodash';
817
+
803
818
  /** 根据当前类型选择对应的组件进行渲染 */
804
819
  var MappingRender = function MappingRender(props) {
820
+ var _ref = props.schemaStore || {},
821
+ getSchemaByKeyRoute = _ref.getSchemaByKeyRoute;
822
+ var _ref2 = props.jsonStore || {},
823
+ getJSONDataByKeyRoute = _ref2.getJSONDataByKeyRoute;
805
824
  var nodeKey = props.nodeKey,
806
825
  jsonKey = props.jsonKey,
807
826
  keyRoute = props.keyRoute,
808
- targetJsonSchema = props.targetJsonSchema,
809
- getJSONDataByKeyRoute = props.getJSONDataByKeyRoute,
810
- keyRoute2indexRoute = props.keyRoute2indexRoute,
811
- updateFormValueData = props.updateFormValueData;
827
+ targetJsonSchema = props.targetJsonSchema;
812
828
  var curType = targetJsonSchema.type;
813
-
814
- // 获取当前字段的条件规则
815
- var hiddenRule = {};
816
- if (targetJsonSchema.hiddenRule) {
817
- hiddenRule = targetJsonSchema.hiddenRule;
818
- }
819
- var curConditionValue = '';
820
829
  var curNodeKey = nodeKey;
821
830
 
822
- // 隐藏条件成立则直接返回
831
+ // 支持显隐属性表达式
832
+ var parentKeyRoute = (0,
833
+ _wibetter_json_utils__WEBPACK_IMPORTED_MODULE_2__.getParentKeyRoute)(
834
+ keyRoute,
835
+ );
836
+ var parentData = getJSONDataByKeyRoute(parentKeyRoute) || {}; // 获取当前父级数据域
823
837
  if (
824
- hiddenRule.conditionProp &&
825
- (0, _utils__WEBPACK_IMPORTED_MODULE_2__.hasProperties)(
826
- hiddenRule.conditionValue,
827
- )
838
+ ((0, _wibetter_json_utils__WEBPACK_IMPORTED_MODULE_2__.isBoolean)(
839
+ targetJsonSchema.onShow,
840
+ ) &&
841
+ !targetJsonSchema.onShow) ||
842
+ ((0, _wibetter_json_utils__WEBPACK_IMPORTED_MODULE_2__.isString)(
843
+ targetJsonSchema.onShow,
844
+ ) &&
845
+ !(0,
846
+ _wibetter_json_utils__WEBPACK_IMPORTED_MODULE_2__.expressionOn)(
847
+ targetJsonSchema.onShow,
848
+ parentData,
849
+ ))
828
850
  ) {
829
- var curConditionProp = hiddenRule.conditionProp;
830
- var needConditionValue = hiddenRule.conditionValue; // 条件字段成立的条件值
831
- var curConditionKeyRoute = curConditionProp.keyRoute; // 条件字段的key值
832
-
833
- // 获取条件字段的数值
834
- curConditionValue = getJSONDataByKeyRoute(curConditionKeyRoute);
835
- if (needConditionValue === curConditionValue) {
836
- if (targetJsonSchema.clearValueOnHidden) {
837
- // 删除掉隐藏的表单项数值
838
- updateFormValueData(keyRoute, undefined);
839
- }
840
- return;
841
- }
851
+ return;
842
852
  }
843
- // 将条件字段的数值作为key的一部分
844
- curNodeKey = nodeKey + '-' + curConditionValue;
853
+
854
+ // 收集当前所有条件子字段
855
+ /*
856
+ const curData = getJSONDataByKeyRoute(keyRoute) || {};
857
+ const curConditionValue = schema2conditionValue(targetJsonSchema, curData);
858
+ // 将条件字段的数值作为key的一部分
859
+ if (curConditionValue) {
860
+ curNodeKey = `${nodeKey}-${curConditionValue}`;
861
+ }
862
+ */
863
+
845
864
  var newProps =
846
865
  _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
847
866
  {},
@@ -853,343 +872,194 @@
853
872
  switch (curType) {
854
873
  case 'object':
855
874
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
856
- $renderers_ObjectSchema_index__WEBPACK_IMPORTED_MODULE_4__[
875
+ $renderers_ObjectSchema_index__WEBPACK_IMPORTED_MODULE_5__[
857
876
  'default'
858
877
  ],
859
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
860
- {},
861
- newProps,
862
- {
863
- key: curNodeKey,
864
- },
865
- ),
878
+ newProps,
866
879
  );
867
880
  case 'dynamic-config':
868
881
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
869
- $renderers_DynamicConfigSchema_index__WEBPACK_IMPORTED_MODULE_25__[
882
+ $renderers_DynamicConfigSchema_index__WEBPACK_IMPORTED_MODULE_27__[
870
883
  'default'
871
884
  ],
872
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
873
- {},
874
- newProps,
875
- {
876
- key: curNodeKey,
877
- },
878
- ),
885
+ newProps,
879
886
  );
880
887
  case 'sohu-source':
881
888
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
882
- $renderers_SohuDataSourceSchema_index__WEBPACK_IMPORTED_MODULE_26__[
889
+ $renderers_SohuDataSourceSchema_index__WEBPACK_IMPORTED_MODULE_28__[
883
890
  'default'
884
891
  ],
885
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
886
- {},
887
- newProps,
888
- {
889
- key: curNodeKey,
890
- },
891
- ),
892
+ newProps,
892
893
  );
893
894
  case 'sohu-event':
894
895
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
895
- $renderers_SohuEventSchema_index__WEBPACK_IMPORTED_MODULE_27__[
896
+ $renderers_SohuEventSchema_index__WEBPACK_IMPORTED_MODULE_29__[
896
897
  'default'
897
898
  ],
898
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
899
- {},
900
- newProps,
901
- {
902
- key: curNodeKey,
903
- },
904
- ),
899
+ newProps,
905
900
  );
906
901
  case 'array':
907
902
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
908
- $renderers_ArraySchema_index__WEBPACK_IMPORTED_MODULE_3__[
903
+ $renderers_ArraySchema_index__WEBPACK_IMPORTED_MODULE_4__[
909
904
  'default'
910
905
  ],
911
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
912
- {},
913
- newProps,
914
- {
915
- key: curNodeKey,
916
- },
917
- ),
906
+ newProps,
918
907
  );
919
908
  case 'dynamic-data':
920
909
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
921
- $renderers_DynamicDataSchema_index__WEBPACK_IMPORTED_MODULE_6__[
910
+ $renderers_DynamicDataSchema_index__WEBPACK_IMPORTED_MODULE_7__[
922
911
  'default'
923
912
  ],
924
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
925
- {},
926
- newProps,
927
- {
928
- key: curNodeKey,
929
- },
930
- ),
913
+ newProps,
931
914
  );
932
915
  case 'datasource':
933
916
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
934
- $renderers_DataSourceSchema_index__WEBPACK_IMPORTED_MODULE_5__[
917
+ $renderers_DataSourceSchema_index__WEBPACK_IMPORTED_MODULE_6__[
935
918
  'default'
936
919
  ],
937
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
938
- {},
939
- newProps,
940
- {
941
- key: curNodeKey,
942
- },
943
- ),
920
+ newProps,
944
921
  );
945
922
  case 'event':
946
923
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
947
- $renderers_EventSchema_index__WEBPACK_IMPORTED_MODULE_7__[
924
+ $renderers_EventSchema_index__WEBPACK_IMPORTED_MODULE_8__[
948
925
  'default'
949
926
  ],
950
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
951
- {},
952
- newProps,
953
- {
954
- key: curNodeKey,
955
- },
956
- ),
927
+ newProps,
957
928
  );
958
929
  case 'quantity':
959
930
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
960
- $renderers_QuantitySchema_index__WEBPACK_IMPORTED_MODULE_8__[
931
+ $renderers_QuantitySchema_index__WEBPACK_IMPORTED_MODULE_9__[
961
932
  'default'
962
933
  ],
963
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
964
- {},
965
- newProps,
966
- {
967
- key: curNodeKey,
968
- },
969
- ),
934
+ newProps,
970
935
  );
971
936
  case 'box-style':
972
937
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
973
- $renderers_BoxStyleSchema_index__WEBPACK_IMPORTED_MODULE_9__[
938
+ $renderers_BoxStyleSchema_index__WEBPACK_IMPORTED_MODULE_10__[
974
939
  'default'
975
940
  ],
976
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
977
- {},
978
- newProps,
979
- {
980
- key: curNodeKey,
981
- },
982
- ),
941
+ newProps,
983
942
  );
984
943
  case 'radio':
985
944
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
986
- $renderers_RadioSchema_index__WEBPACK_IMPORTED_MODULE_10__[
945
+ $renderers_RadioSchema_index__WEBPACK_IMPORTED_MODULE_11__[
987
946
  'default'
988
947
  ],
989
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
990
- {},
991
- newProps,
992
- {
993
- key: curNodeKey,
994
- },
995
- ),
948
+ newProps,
996
949
  );
997
950
  case 'select':
998
951
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
999
- $renderers_SelectSchema_index__WEBPACK_IMPORTED_MODULE_24__[
952
+ $renderers_SelectSchema_index__WEBPACK_IMPORTED_MODULE_25__[
1000
953
  'default'
1001
954
  ],
1002
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
1003
- {},
1004
- newProps,
1005
- {
1006
- key: curNodeKey,
1007
- },
1008
- ),
955
+ newProps,
1009
956
  );
1010
957
  case 'checkboxes':
1011
958
  // 多选
1012
959
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
1013
- $renderers_CheckboxSchema_index__WEBPACK_IMPORTED_MODULE_11__[
960
+ $renderers_CheckboxSchema_index__WEBPACK_IMPORTED_MODULE_12__[
1014
961
  'default'
1015
962
  ],
1016
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
1017
- {},
1018
- newProps,
1019
- {
1020
- key: curNodeKey,
1021
- },
1022
- ),
963
+ newProps,
1023
964
  );
1024
965
  case 'input':
1025
966
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
1026
- $renderers_InputFormSchema_index__WEBPACK_IMPORTED_MODULE_12__[
967
+ $renderers_InputFormSchema_index__WEBPACK_IMPORTED_MODULE_13__[
1027
968
  'default'
1028
969
  ],
1029
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
1030
- {},
1031
- newProps,
1032
- {
1033
- key: curNodeKey,
1034
- },
1035
- ),
970
+ newProps,
1036
971
  );
1037
972
  case 'textarea':
1038
973
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
1039
- $renderers_TextAreaFormSchema_index__WEBPACK_IMPORTED_MODULE_13__[
974
+ $renderers_TextAreaFormSchema_index__WEBPACK_IMPORTED_MODULE_14__[
1040
975
  'default'
1041
976
  ],
1042
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
1043
- {},
1044
- newProps,
1045
- {
1046
- key: curNodeKey,
1047
- },
1048
- ),
977
+ newProps,
1049
978
  );
1050
979
  case 'text-editor':
1051
980
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
1052
- $renderers_TextEditorSchema_index__WEBPACK_IMPORTED_MODULE_14__[
981
+ $renderers_TextEditorSchema_index__WEBPACK_IMPORTED_MODULE_15__[
1053
982
  'default'
1054
983
  ],
1055
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
1056
- {},
1057
- newProps,
1058
- {
1059
- key: curNodeKey,
1060
- },
1061
- ),
984
+ newProps,
1062
985
  );
1063
986
  case 'number':
1064
987
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
1065
- $renderers_NumberFormSchema_index__WEBPACK_IMPORTED_MODULE_15__[
988
+ $renderers_NumberFormSchema_index__WEBPACK_IMPORTED_MODULE_16__[
1066
989
  'default'
1067
990
  ],
1068
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
1069
- {},
1070
- newProps,
1071
- {
1072
- key: curNodeKey,
1073
- },
1074
- ),
991
+ newProps,
1075
992
  );
1076
993
  case 'boolean':
1077
994
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
1078
- $renderers_BooleanFormSchema_index__WEBPACK_IMPORTED_MODULE_16__[
995
+ $renderers_BooleanFormSchema_index__WEBPACK_IMPORTED_MODULE_17__[
1079
996
  'default'
1080
997
  ],
1081
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
1082
- {},
1083
- newProps,
1084
- {
1085
- key: curNodeKey,
1086
- },
1087
- ),
998
+ newProps,
1088
999
  );
1089
1000
  case 'date':
1090
1001
  case 'date-time':
1091
1002
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
1092
- $renderers_DateTimeFormSchema_index__WEBPACK_IMPORTED_MODULE_17__[
1003
+ $renderers_DateTimeFormSchema_index__WEBPACK_IMPORTED_MODULE_18__[
1093
1004
  'default'
1094
1005
  ],
1095
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
1096
- {},
1097
- newProps,
1098
- {
1099
- key: curNodeKey,
1100
- },
1101
- ),
1006
+ newProps,
1102
1007
  );
1103
1008
  case 'time':
1104
1009
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
1105
- $renderers_TimeFormSchema_index__WEBPACK_IMPORTED_MODULE_18__[
1010
+ $renderers_TimeFormSchema_index__WEBPACK_IMPORTED_MODULE_19__[
1106
1011
  'default'
1107
1012
  ],
1108
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
1109
- {},
1110
- newProps,
1111
- {
1112
- key: curNodeKey,
1113
- },
1114
- ),
1013
+ newProps,
1115
1014
  );
1116
1015
  case 'url':
1117
1016
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
1118
- $renderers_URLFormSchema_index__WEBPACK_IMPORTED_MODULE_19__[
1017
+ $renderers_URLFormSchema_index__WEBPACK_IMPORTED_MODULE_20__[
1119
1018
  'default'
1120
1019
  ],
1121
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
1122
- {},
1123
- newProps,
1124
- {
1125
- key: curNodeKey,
1126
- },
1127
- ),
1020
+ newProps,
1128
1021
  );
1129
1022
  case 'color':
1130
1023
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
1131
- $renderers_ColorFormSchemaV3_index__WEBPACK_IMPORTED_MODULE_20__[
1024
+ $renderers_ColorFormSchemaV3_index__WEBPACK_IMPORTED_MODULE_21__[
1132
1025
  'default'
1133
1026
  ],
1134
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
1135
- {},
1136
- newProps,
1137
- {
1138
- key: curNodeKey,
1139
- },
1140
- ),
1027
+ newProps,
1028
+ );
1029
+ case 'input-image':
1030
+ return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
1031
+ $renderers_InputImageSchema_index__WEBPACK_IMPORTED_MODULE_26__[
1032
+ 'default'
1033
+ ],
1034
+ newProps,
1141
1035
  );
1142
1036
  case 'json':
1143
1037
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
1144
- $renderers_JsonFormSchema_index__WEBPACK_IMPORTED_MODULE_21__[
1038
+ $renderers_JsonFormSchema_index__WEBPACK_IMPORTED_MODULE_22__[
1145
1039
  'default'
1146
1040
  ],
1147
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
1148
- {},
1149
- newProps,
1150
- {
1151
- key: curNodeKey,
1152
- },
1153
- ),
1041
+ newProps,
1154
1042
  );
1155
1043
  case 'codearea':
1156
1044
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
1157
- $renderers_CodeAreaFormSchema_index__WEBPACK_IMPORTED_MODULE_22__[
1045
+ $renderers_CodeAreaFormSchema_index__WEBPACK_IMPORTED_MODULE_23__[
1158
1046
  'default'
1159
1047
  ],
1160
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
1161
- {},
1162
- newProps,
1163
- {
1164
- key: curNodeKey,
1165
- },
1166
- ),
1048
+ newProps,
1167
1049
  );
1168
1050
  case 'htmlarea':
1169
1051
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
1170
- $renderers_HtmlAreaFormSchema_index__WEBPACK_IMPORTED_MODULE_23__[
1052
+ $renderers_HtmlAreaFormSchema_index__WEBPACK_IMPORTED_MODULE_24__[
1171
1053
  'default'
1172
1054
  ],
1173
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
1174
- {},
1175
- newProps,
1176
- {
1177
- key: curNodeKey,
1178
- },
1179
- ),
1055
+ newProps,
1180
1056
  );
1181
1057
  default:
1182
1058
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
1183
- $renderers_InputFormSchema_index__WEBPACK_IMPORTED_MODULE_12__[
1059
+ $renderers_InputFormSchema_index__WEBPACK_IMPORTED_MODULE_13__[
1184
1060
  'default'
1185
1061
  ],
1186
- _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()(
1187
- {},
1188
- newProps,
1189
- {
1190
- key: curNodeKey,
1191
- },
1192
- ),
1062
+ newProps,
1193
1063
  );
1194
1064
  }
1195
1065
  };
@@ -1225,11 +1095,11 @@
1225
1095
  * getJSONDataByKeyRoute、getInitJsonDataByKeyRoute
1226
1096
  * */
1227
1097
  function catchJsonDataByWebCache(curKeyRoute) {
1228
- var _this$props = this.props,
1229
- targetJsonSchema = _this$props.targetJsonSchema,
1230
- getJSONDataByKeyRoute = _this$props.getJSONDataByKeyRoute,
1231
- getInitJsonDataByKeyRoute = _this$props.getInitJsonDataByKeyRoute,
1232
- updateFormValueData = _this$props.updateFormValueData;
1098
+ var targetJsonSchema = this.props.targetJsonSchema;
1099
+ var _ref = this.props.jsonStore || {},
1100
+ getJSONDataByKeyRoute = _ref.getJSONDataByKeyRoute,
1101
+ getInitJsonDataByKeyRoute = _ref.getInitJsonDataByKeyRoute,
1102
+ updateFormValueData = _ref.updateFormValueData;
1233
1103
  var curType = targetJsonSchema.type;
1234
1104
  var keyRoute = curKeyRoute || this.props.keyRoute;
1235
1105
  var backUpKeyRoute = (0,
@@ -1360,6 +1230,8 @@
1360
1230
  _this = _React$PureComponent.call(this, props) || this;
1361
1231
  /** 添加数组项 */
1362
1232
  _this.addArrayItem = function (keyRoute, curArr, curArrIndex) {
1233
+ var _ref = _this.props.jsonStore || {},
1234
+ addArrayItem = _ref.addArrayItem;
1363
1235
  var maximumChild =
1364
1236
  _this.props.targetJsonSchema['maximum-child'];
1365
1237
  if (curArr && maximumChild && curArr.length >= maximumChild) {
@@ -1369,11 +1241,13 @@
1369
1241
  '\u4E2A\u5B50\u9879',
1370
1242
  );
1371
1243
  } else {
1372
- _this.props.addArrayItem(keyRoute, curArrIndex);
1244
+ addArrayItem(keyRoute, curArrIndex);
1373
1245
  }
1374
1246
  };
1375
1247
  /** 删除数组项 */
1376
1248
  _this.deleteArrItem = function (keyRoute, arrIndex, curArr) {
1249
+ var _ref2 = _this.props.jsonStore || {},
1250
+ deleteArrayIndex = _ref2.deleteArrayIndex;
1377
1251
  var minimumChild =
1378
1252
  _this.props.targetJsonSchema['minimum-child'];
1379
1253
  if (curArr && minimumChild && curArr.length <= minimumChild) {
@@ -1383,7 +1257,7 @@
1383
1257
  '\u4E2A\u5B50\u9879',
1384
1258
  );
1385
1259
  } else {
1386
- _this.props.deleteArrayIndex(keyRoute, arrIndex);
1260
+ deleteArrayIndex(keyRoute, arrIndex);
1387
1261
  }
1388
1262
  };
1389
1263
  /**
@@ -1496,15 +1370,20 @@
1496
1370
  var _targetJsonSchema$sho,
1497
1371
  _this2 = this;
1498
1372
  var _this$props = this.props,
1499
- keyRoute = _this$props.keyRoute,
1500
- jsonKey = _this$props.jsonKey,
1501
- nodeKey = _this$props.nodeKey,
1502
- pageScreen = _this$props.pageScreen,
1503
- indexRoute = _this$props.indexRoute,
1504
- targetJsonSchema = _this$props.targetJsonSchema,
1505
- getJSONDataByKeyRoute = _this$props.getJSONDataByKeyRoute,
1506
- keyRoute2indexRoute = _this$props.keyRoute2indexRoute,
1507
- updateFormValueData = _this$props.updateFormValueData;
1373
+ schemaStore = _this$props.schemaStore,
1374
+ jsonStore = _this$props.jsonStore;
1375
+ var _ref3 = schemaStore || {},
1376
+ pageScreen = _ref3.pageScreen;
1377
+ var _ref4 = jsonStore || {},
1378
+ getJSONDataByKeyRoute = _ref4.getJSONDataByKeyRoute,
1379
+ sortArrayItem = _ref4.sortArrayItem,
1380
+ triggerChange = _ref4.triggerChange;
1381
+ var _this$props2 = this.props,
1382
+ keyRoute = _this$props2.keyRoute,
1383
+ jsonKey = _this$props2.jsonKey,
1384
+ nodeKey = _this$props2.nodeKey,
1385
+ indexRoute = _this$props2.indexRoute,
1386
+ targetJsonSchema = _this$props2.targetJsonSchema;
1508
1387
  var _this$state = this.state,
1509
1388
  jsonView = _this$state.jsonView,
1510
1389
  isClosed = _this$state.isClosed,
@@ -1528,7 +1407,7 @@
1528
1407
  pageScreen === 'wideScreen'
1529
1408
  ? 'wide-screen-element-warp'
1530
1409
  : 'mobile-screen-element-warp',
1531
- key: nodeKey,
1410
+ key: nodeKey + '-' + triggerChange,
1532
1411
  id: nodeKey,
1533
1412
  },
1534
1413
  /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1__.createElement(
@@ -1829,11 +1708,7 @@
1829
1708
  {
1830
1709
  className: 'array-operate-btn',
1831
1710
  onClick: function onClick(event) {
1832
- _this2.props.sortArrayItem(
1833
- keyRoute,
1834
- arrIndex,
1835
- 'up',
1836
- );
1711
+ sortArrayItem(keyRoute, arrIndex, 'up');
1837
1712
  event.preventDefault();
1838
1713
  event.stopPropagation();
1839
1714
  },
@@ -1851,7 +1726,7 @@
1851
1726
  {
1852
1727
  className: 'array-operate-btn',
1853
1728
  onClick: function onClick(event) {
1854
- _this2.props.sortArrayItem(
1729
+ sortArrayItem(
1855
1730
  keyRoute,
1856
1731
  arrIndex,
1857
1732
  'down',
@@ -1888,9 +1763,8 @@
1888
1763
  targetJsonSchema: arrayItemsDataObj,
1889
1764
  isArrayItem: true,
1890
1765
  arrIndex: arrIndex,
1891
- getJSONDataByKeyRoute: getJSONDataByKeyRoute,
1892
- keyRoute2indexRoute: keyRoute2indexRoute,
1893
- updateFormValueData: updateFormValueData,
1766
+ schemaStore: schemaStore,
1767
+ jsonStore: jsonStore,
1894
1768
  },
1895
1769
  ),
1896
1770
  ),
@@ -1923,17 +1797,8 @@
1923
1797
  /* harmony default export */ __webpack_exports__['default'] = (0,
1924
1798
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
1925
1799
  return {
1926
- triggerChange: stores.JSONEditorStore.triggerChange,
1927
- pageScreen: stores.JSONSchemaStore.pageScreen,
1928
- indexRoute2keyRoute: stores.JSONSchemaStore.indexRoute2keyRoute,
1929
- getJSONDataByKeyRoute:
1930
- stores.JSONEditorStore.getJSONDataByKeyRoute,
1931
- getInitJsonDataByKeyRoute:
1932
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
1933
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
1934
- deleteArrayIndex: stores.JSONEditorStore.deleteArrayIndex,
1935
- addArrayItem: stores.JSONEditorStore.addArrayItem,
1936
- sortArrayItem: stores.JSONEditorStore.sortArrayItem,
1800
+ schemaStore: stores.JSONSchemaStore,
1801
+ jsonStore: stores.JSONEditorStore,
1937
1802
  };
1938
1803
  })(
1939
1804
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(ArraySchema),
@@ -2009,7 +1874,9 @@
2009
1874
  _this.handleValueChange = function (checked) {
2010
1875
  var _this$props = _this.props,
2011
1876
  keyRoute = _this$props.keyRoute,
2012
- updateFormValueData = _this$props.updateFormValueData;
1877
+ jsonStore = _this$props.jsonStore;
1878
+ var _ref = jsonStore || {},
1879
+ updateFormValueData = _ref.updateFormValueData;
2013
1880
  updateFormValueData(keyRoute, checked); // 更新数值
2014
1881
  };
2015
1882
  _this.handleValueChange = _this.handleValueChange.bind(_this);
@@ -2038,12 +1905,17 @@
2038
1905
  };
2039
1906
  _proto.render = function render() {
2040
1907
  var _this$props2 = this.props,
2041
- keyRoute = _this$props2.keyRoute,
2042
- jsonKey = _this$props2.jsonKey,
2043
- nodeKey = _this$props2.nodeKey,
2044
- targetJsonSchema = _this$props2.targetJsonSchema,
2045
- pageScreen = _this$props2.pageScreen,
2046
- getJSONDataByKeyRoute = _this$props2.getJSONDataByKeyRoute;
1908
+ schemaStore = _this$props2.schemaStore,
1909
+ jsonStore = _this$props2.jsonStore;
1910
+ var _ref2 = schemaStore || {},
1911
+ pageScreen = _ref2.pageScreen;
1912
+ var _ref3 = jsonStore || {},
1913
+ getJSONDataByKeyRoute = _ref3.getJSONDataByKeyRoute;
1914
+ var _this$props3 = this.props,
1915
+ keyRoute = _this$props3.keyRoute,
1916
+ jsonKey = _this$props3.jsonKey,
1917
+ nodeKey = _this$props3.nodeKey,
1918
+ targetJsonSchema = _this$props3.targetJsonSchema;
2047
1919
  // 从jsonData中获取对应的数值
2048
1920
  var curJsonData = getJSONDataByKeyRoute(keyRoute);
2049
1921
  var isNeedTwoCol = (0,
@@ -2147,12 +2019,8 @@
2147
2019
  /* harmony default export */ __webpack_exports__['default'] = (0,
2148
2020
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
2149
2021
  return {
2150
- pageScreen: stores.JSONSchemaStore.pageScreen,
2151
- getJSONDataByKeyRoute:
2152
- stores.JSONEditorStore.getJSONDataByKeyRoute,
2153
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
2154
- getInitJsonDataByKeyRoute:
2155
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
2022
+ schemaStore: stores.JSONSchemaStore,
2023
+ jsonStore: stores.JSONEditorStore,
2156
2024
  };
2157
2025
  })(
2158
2026
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(
@@ -2237,10 +2105,12 @@
2237
2105
  };
2238
2106
  /** 初始化boxStyle的数值 */
2239
2107
  _this.initBoxStyle = function () {
2108
+ var jsonStore = _this.props.jsonStore;
2109
+ var _ref = jsonStore || {},
2110
+ getJSONDataByKeyRoute = _ref.getJSONDataByKeyRoute;
2240
2111
  var _this$props = _this.props,
2241
2112
  keyRoute = _this$props.keyRoute,
2242
- targetJsonSchema = _this$props.targetJsonSchema,
2243
- getJSONDataByKeyRoute = _this$props.getJSONDataByKeyRoute;
2113
+ targetJsonSchema = _this$props.targetJsonSchema;
2244
2114
  // 从jsonData中获取对应的数值
2245
2115
  var curJsonData = getJSONDataByKeyRoute(keyRoute);
2246
2116
  /** 获取quantity中的数值对象(默认第一个就是数值对象) */
@@ -2360,7 +2230,9 @@
2360
2230
  _this.updateBoxStyleState = function () {
2361
2231
  var _this$props2 = _this.props,
2362
2232
  keyRoute = _this$props2.keyRoute,
2363
- updateFormValueData = _this$props2.updateFormValueData;
2233
+ jsonStore = _this$props2.jsonStore;
2234
+ var _ref2 = jsonStore || {},
2235
+ updateFormValueData = _ref2.updateFormValueData;
2364
2236
  var renderAction = _this.state.renderAction;
2365
2237
  /** 获取布局容器的盒子模型数值 */
2366
2238
  var boxStyleUnit =
@@ -2404,8 +2276,12 @@
2404
2276
  var _this$props3 = this.props,
2405
2277
  nodeKey = _this$props3.nodeKey,
2406
2278
  jsonKey = _this$props3.jsonKey,
2407
- targetJsonSchema = _this$props3.targetJsonSchema,
2408
- pageScreen = _this$props3.pageScreen;
2279
+ targetJsonSchema = _this$props3.targetJsonSchema;
2280
+ var _this$props4 = this.props,
2281
+ schemaStore = _this$props4.schemaStore,
2282
+ jsonStore = _this$props4.jsonStore;
2283
+ var _ref3 = schemaStore || {},
2284
+ pageScreen = _ref3.pageScreen;
2409
2285
  var _this$state = this.state,
2410
2286
  renderAction = _this$state.renderAction,
2411
2287
  layoutStyleLock = _this$state.layoutStyleLock;
@@ -2638,12 +2514,8 @@
2638
2514
  /* harmony default export */ __webpack_exports__['default'] = (0,
2639
2515
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
2640
2516
  return {
2641
- pageScreen: stores.JSONSchemaStore.pageScreen,
2642
- getJSONDataByKeyRoute:
2643
- stores.JSONEditorStore.getJSONDataByKeyRoute,
2644
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
2645
- getInitJsonDataByKeyRoute:
2646
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
2517
+ schemaStore: stores.JSONSchemaStore,
2518
+ jsonStore: stores.JSONEditorStore,
2647
2519
  };
2648
2520
  })(
2649
2521
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(
@@ -2723,7 +2595,9 @@
2723
2595
  _this.handleValueChange = function (checkedValue) {
2724
2596
  var _this$props = _this.props,
2725
2597
  keyRoute = _this$props.keyRoute,
2726
- updateFormValueData = _this$props.updateFormValueData;
2598
+ jsonStore = _this$props.jsonStore;
2599
+ var _ref = jsonStore || {},
2600
+ updateFormValueData = _ref.updateFormValueData;
2727
2601
  updateFormValueData(keyRoute, checkedValue); // 更新数值
2728
2602
  };
2729
2603
  _this.handleValueChange = _this.handleValueChange.bind(_this);
@@ -2752,12 +2626,17 @@
2752
2626
  };
2753
2627
  _proto.render = function render() {
2754
2628
  var _this$props2 = this.props,
2755
- nodeKey = _this$props2.nodeKey,
2756
- jsonKey = _this$props2.jsonKey,
2757
- keyRoute = _this$props2.keyRoute,
2758
- targetJsonSchema = _this$props2.targetJsonSchema,
2759
- pageScreen = _this$props2.pageScreen,
2760
- getJSONDataByKeyRoute = _this$props2.getJSONDataByKeyRoute;
2629
+ schemaStore = _this$props2.schemaStore,
2630
+ jsonStore = _this$props2.jsonStore;
2631
+ var _ref2 = schemaStore || {},
2632
+ pageScreen = _ref2.pageScreen;
2633
+ var _ref3 = jsonStore || {},
2634
+ getJSONDataByKeyRoute = _ref3.getJSONDataByKeyRoute;
2635
+ var _this$props3 = this.props,
2636
+ nodeKey = _this$props3.nodeKey,
2637
+ jsonKey = _this$props3.jsonKey,
2638
+ keyRoute = _this$props3.keyRoute,
2639
+ targetJsonSchema = _this$props3.targetJsonSchema;
2761
2640
  // 从jsonData中获取对应的数值
2762
2641
  var curJsonData = getJSONDataByKeyRoute(keyRoute);
2763
2642
  var options = targetJsonSchema.options;
@@ -2884,12 +2763,8 @@
2884
2763
  /* harmony default export */ __webpack_exports__['default'] = (0,
2885
2764
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
2886
2765
  return {
2887
- pageScreen: stores.JSONSchemaStore.pageScreen,
2888
- getJSONDataByKeyRoute:
2889
- stores.JSONEditorStore.getJSONDataByKeyRoute,
2890
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
2891
- getInitJsonDataByKeyRoute:
2892
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
2766
+ schemaStore: stores.JSONSchemaStore,
2767
+ jsonStore: stores.JSONEditorStore,
2893
2768
  };
2894
2769
  })(
2895
2770
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(
@@ -2995,7 +2870,9 @@
2995
2870
  _this.handleValueChange = function (newJsonData) {
2996
2871
  var _this$props = _this.props,
2997
2872
  keyRoute = _this$props.keyRoute,
2998
- updateFormValueData = _this$props.updateFormValueData;
2873
+ jsonStore = _this$props.jsonStore;
2874
+ var _ref = jsonStore || {},
2875
+ updateFormValueData = _ref.updateFormValueData;
2999
2876
  updateFormValueData(keyRoute, newJsonData); // 更新数值
3000
2877
  };
3001
2878
  _this.state = {
@@ -3031,14 +2908,19 @@
3031
2908
  _proto.render = function render() {
3032
2909
  var _this2 = this;
3033
2910
  var _this$props2 = this.props,
3034
- isReadOnly = _this$props2.isReadOnly,
3035
- jsonKey = _this$props2.jsonKey,
3036
- isIgnoreWarn = _this$props2.isIgnoreWarn,
3037
- nodeKey = _this$props2.nodeKey,
3038
- keyRoute = _this$props2.keyRoute,
3039
- targetJsonSchema = _this$props2.targetJsonSchema,
3040
- pageScreen = _this$props2.pageScreen,
3041
- getJSONDataByKeyRoute = _this$props2.getJSONDataByKeyRoute;
2911
+ schemaStore = _this$props2.schemaStore,
2912
+ jsonStore = _this$props2.jsonStore;
2913
+ var _ref2 = schemaStore || {},
2914
+ pageScreen = _ref2.pageScreen;
2915
+ var _ref3 = jsonStore || {},
2916
+ getJSONDataByKeyRoute = _ref3.getJSONDataByKeyRoute;
2917
+ var _this$props3 = this.props,
2918
+ isReadOnly = _this$props3.isReadOnly,
2919
+ jsonKey = _this$props3.jsonKey,
2920
+ isIgnoreWarn = _this$props3.isIgnoreWarn,
2921
+ nodeKey = _this$props3.nodeKey,
2922
+ keyRoute = _this$props3.keyRoute,
2923
+ targetJsonSchema = _this$props3.targetJsonSchema;
3042
2924
  var _this$state = this.state,
3043
2925
  isShowWarn = _this$state.isShowWarn,
3044
2926
  warnText = _this$state.warnText;
@@ -3225,12 +3107,8 @@
3225
3107
  /* harmony default export */ __webpack_exports__['default'] = (0,
3226
3108
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
3227
3109
  return {
3228
- pageScreen: stores.JSONSchemaStore.pageScreen,
3229
- getJSONDataByKeyRoute:
3230
- stores.JSONEditorStore.getJSONDataByKeyRoute,
3231
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
3232
- getInitJsonDataByKeyRoute:
3233
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
3110
+ schemaStore: stores.JSONSchemaStore,
3111
+ jsonStore: stores.JSONEditorStore,
3234
3112
  };
3235
3113
  })(
3236
3114
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(
@@ -3326,6 +3204,11 @@
3326
3204
  _this = _React$PureComponent.call(this, props) || this;
3327
3205
  /** 数值变动事件处理器 */
3328
3206
  _this.handleValueChange = function (color) {
3207
+ var _this$props = _this.props,
3208
+ keyRoute = _this$props.keyRoute,
3209
+ jsonStore = _this$props.jsonStore;
3210
+ var _ref = jsonStore || {},
3211
+ updateFormValueData = _ref.updateFormValueData;
3329
3212
  var rgb = color.rgb; // hex,
3330
3213
  var rgbaVal =
3331
3214
  'rgba(' +
@@ -3337,9 +3220,6 @@
3337
3220
  ',' +
3338
3221
  rgb.a +
3339
3222
  ')';
3340
- var _this$props = _this.props,
3341
- keyRoute = _this$props.keyRoute,
3342
- updateFormValueData = _this$props.updateFormValueData;
3343
3223
  // updateFormValueData(keyRoute, hex); // 更新数值(#ffffff数据格式)
3344
3224
  updateFormValueData(keyRoute, rgbaVal); // 更新数值: rgba(255,255,255,100)
3345
3225
  // 主动触发更新的状态数据
@@ -3351,7 +3231,9 @@
3351
3231
  _this.deleteColor = function () {
3352
3232
  var _this$props2 = _this.props,
3353
3233
  keyRoute = _this$props2.keyRoute,
3354
- updateFormValueData = _this$props2.updateFormValueData;
3234
+ jsonStore = _this$props2.jsonStore;
3235
+ var _ref2 = jsonStore || {},
3236
+ updateFormValueData = _ref2.updateFormValueData;
3355
3237
  updateFormValueData(keyRoute, 'initial'); // 更新数值
3356
3238
  antd__WEBPACK_IMPORTED_MODULE_4__.message.success(
3357
3239
  '已移除当前设置的颜色值',
@@ -3394,12 +3276,17 @@
3394
3276
  _proto.render = function render() {
3395
3277
  var _this2 = this;
3396
3278
  var _this$props3 = this.props,
3397
- keyRoute = _this$props3.keyRoute,
3398
- jsonKey = _this$props3.jsonKey,
3399
- nodeKey = _this$props3.nodeKey,
3400
- targetJsonSchema = _this$props3.targetJsonSchema,
3401
- pageScreen = _this$props3.pageScreen,
3402
- getJSONDataByKeyRoute = _this$props3.getJSONDataByKeyRoute;
3279
+ schemaStore = _this$props3.schemaStore,
3280
+ jsonStore = _this$props3.jsonStore;
3281
+ var _ref3 = schemaStore || {},
3282
+ pageScreen = _ref3.pageScreen;
3283
+ var _ref4 = jsonStore || {},
3284
+ getJSONDataByKeyRoute = _ref4.getJSONDataByKeyRoute;
3285
+ var _this$props4 = this.props,
3286
+ keyRoute = _this$props4.keyRoute,
3287
+ jsonKey = _this$props4.jsonKey,
3288
+ nodeKey = _this$props4.nodeKey,
3289
+ targetJsonSchema = _this$props4.targetJsonSchema;
3403
3290
  var _this$state = this.state,
3404
3291
  renderState = _this$state.renderState,
3405
3292
  displayColorPicker = _this$state.displayColorPicker;
@@ -3554,12 +3441,8 @@
3554
3441
  /* harmony default export */ __webpack_exports__['default'] = (0,
3555
3442
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
3556
3443
  return {
3557
- pageScreen: stores.JSONSchemaStore.pageScreen,
3558
- getJSONDataByKeyRoute:
3559
- stores.JSONEditorStore.getJSONDataByKeyRoute,
3560
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
3561
- getInitJsonDataByKeyRoute:
3562
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
3444
+ schemaStore: stores.JSONSchemaStore,
3445
+ jsonStore: stores.JSONEditorStore,
3563
3446
  };
3564
3447
  })(
3565
3448
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(
@@ -3707,12 +3590,16 @@
3707
3590
  var _targetJsonSchema$sho,
3708
3591
  _this2 = this;
3709
3592
  var _this$props = this.props,
3710
- keyRoute = _this$props.keyRoute,
3711
- jsonKey = _this$props.jsonKey,
3712
- nodeKey = _this$props.nodeKey,
3713
- indexRoute = _this$props.indexRoute,
3714
- targetJsonSchema = _this$props.targetJsonSchema,
3715
- pageScreen = _this$props.pageScreen;
3593
+ schemaStore = _this$props.schemaStore,
3594
+ jsonStore = _this$props.jsonStore;
3595
+ var _ref = schemaStore || {},
3596
+ pageScreen = _ref.pageScreen;
3597
+ var _this$props2 = this.props,
3598
+ keyRoute = _this$props2.keyRoute,
3599
+ jsonKey = _this$props2.jsonKey,
3600
+ nodeKey = _this$props2.nodeKey,
3601
+ indexRoute = _this$props2.indexRoute,
3602
+ targetJsonSchema = _this$props2.targetJsonSchema;
3716
3603
  var _this$state = this.state,
3717
3604
  jsonView = _this$state.jsonView,
3718
3605
  isClosed = _this$state.isClosed,
@@ -4009,13 +3896,8 @@
4009
3896
  /* harmony default export */ __webpack_exports__['default'] = (0,
4010
3897
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
4011
3898
  return {
4012
- triggerChange: stores.JSONEditorStore.triggerChange,
4013
- pageScreen: stores.JSONSchemaStore.pageScreen,
4014
- getJSONDataByKeyRoute:
4015
- stores.JSONEditorStore.getJSONDataByKeyRoute,
4016
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
4017
- getInitJsonDataByKeyRoute:
4018
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
3899
+ schemaStore: stores.JSONSchemaStore,
3900
+ jsonStore: stores.JSONEditorStore,
4019
3901
  };
4020
3902
  })(
4021
3903
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(
@@ -4104,7 +3986,9 @@
4104
3986
  _this.handleValueChange = function (event, dateString) {
4105
3987
  var _this$props = _this.props,
4106
3988
  keyRoute = _this$props.keyRoute,
4107
- updateFormValueData = _this$props.updateFormValueData;
3989
+ jsonStore = _this$props.jsonStore;
3990
+ var _ref = jsonStore || {},
3991
+ updateFormValueData = _ref.updateFormValueData;
4108
3992
  updateFormValueData(keyRoute, dateString); // 更新数值
4109
3993
  };
4110
3994
  _this.handleValueChange = _this.handleValueChange.bind(_this);
@@ -4133,12 +4017,17 @@
4133
4017
  };
4134
4018
  _proto.render = function render() {
4135
4019
  var _this$props2 = this.props,
4136
- keyRoute = _this$props2.keyRoute,
4137
- jsonKey = _this$props2.jsonKey,
4138
- nodeKey = _this$props2.nodeKey,
4139
- targetJsonSchema = _this$props2.targetJsonSchema,
4140
- pageScreen = _this$props2.pageScreen,
4141
- getJSONDataByKeyRoute = _this$props2.getJSONDataByKeyRoute;
4020
+ schemaStore = _this$props2.schemaStore,
4021
+ jsonStore = _this$props2.jsonStore;
4022
+ var _ref2 = schemaStore || {},
4023
+ pageScreen = _ref2.pageScreen;
4024
+ var _ref3 = jsonStore || {},
4025
+ getJSONDataByKeyRoute = _ref3.getJSONDataByKeyRoute;
4026
+ var _this$props3 = this.props,
4027
+ keyRoute = _this$props3.keyRoute,
4028
+ jsonKey = _this$props3.jsonKey,
4029
+ nodeKey = _this$props3.nodeKey,
4030
+ targetJsonSchema = _this$props3.targetJsonSchema;
4142
4031
  var curType = targetJsonSchema.type;
4143
4032
  var readOnly = targetJsonSchema.readOnly || false; // 是否只读(默认可编辑)
4144
4033
  var isRequired = targetJsonSchema.isRequired || false; // 是否必填(默认非必填)
@@ -4260,12 +4149,8 @@
4260
4149
  /* harmony default export */ __webpack_exports__['default'] = (0,
4261
4150
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
4262
4151
  return {
4263
- pageScreen: stores.JSONSchemaStore.pageScreen,
4264
- getJSONDataByKeyRoute:
4265
- stores.JSONEditorStore.getJSONDataByKeyRoute,
4266
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
4267
- getInitJsonDataByKeyRoute:
4268
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
4152
+ schemaStore: stores.JSONSchemaStore,
4153
+ jsonStore: stores.JSONEditorStore,
4269
4154
  };
4270
4155
  })(
4271
4156
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(
@@ -4351,7 +4236,11 @@
4351
4236
  );
4352
4237
  /* harmony import */ var $mixins_index__WEBPACK_IMPORTED_MODULE_11__ =
4353
4238
  __webpack_require__(/*! $mixins/index */ './src/mixins/index.js');
4354
- /* harmony import */ var $assets_img_code_svg__WEBPACK_IMPORTED_MODULE_12__ =
4239
+ /* harmony import */ var $utils_webCache__WEBPACK_IMPORTED_MODULE_12__ =
4240
+ __webpack_require__(
4241
+ /*! $utils/webCache */ './src/utils/webCache.js',
4242
+ );
4243
+ /* harmony import */ var $assets_img_code_svg__WEBPACK_IMPORTED_MODULE_13__ =
4355
4244
  __webpack_require__(
4356
4245
  /*! $assets/img/code.svg */ './src/assets/img/code.svg',
4357
4246
  );
@@ -4365,6 +4254,7 @@
4365
4254
  // 是否显示code模式
4366
4255
  isClosed: false, // 是否为关闭状态,默认是开启状态
4367
4256
  };
4257
+ _this.collapseChange = _this.collapseChange.bind(_this);
4368
4258
  return _this;
4369
4259
  }
4370
4260
  _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_0___default()(
@@ -4388,25 +4278,45 @@
4388
4278
  );
4389
4279
  }
4390
4280
  };
4281
+ _proto.collapseChange = function collapseChange(event) {
4282
+ var keyRoute = this.props.keyRoute;
4283
+ var isClosed = this.state.isClosed;
4284
+ this.setState({
4285
+ isClosed: !isClosed,
4286
+ });
4287
+ event.preventDefault();
4288
+ event.stopPropagation();
4289
+
4290
+ // 缓存当前折叠状态
4291
+ (0,
4292
+ $utils_webCache__WEBPACK_IMPORTED_MODULE_12__.saveJSONEditorCache)(
4293
+ keyRoute,
4294
+ !isClosed,
4295
+ );
4296
+ };
4391
4297
  _proto.render = function render() {
4392
4298
  var _targetJsonSchema$sho,
4393
4299
  _this2 = this;
4394
4300
  var _this$props = this.props,
4395
- indexRoute = _this$props.indexRoute,
4396
- jsonKey = _this$props.jsonKey,
4397
- nodeKey = _this$props.nodeKey,
4398
- keyRoute = _this$props.keyRoute,
4399
- pageScreen = _this$props.pageScreen,
4400
- targetJsonSchema = _this$props.targetJsonSchema,
4401
- isArrayItem = _this$props.isArrayItem,
4402
- isStructuredSchema = _this$props.isStructuredSchema,
4403
- getJSONDataByKeyRoute = _this$props.getJSONDataByKeyRoute,
4404
- keyRoute2indexRoute = _this$props.keyRoute2indexRoute,
4405
- updateFormValueData = _this$props.updateFormValueData;
4301
+ schemaStore = _this$props.schemaStore,
4302
+ jsonStore = _this$props.jsonStore;
4303
+ var _ref = schemaStore || {},
4304
+ pageScreen = _ref.pageScreen;
4305
+ var _ref2 = jsonStore || {},
4306
+ _options = _ref2.options,
4307
+ getJSONDataByKeyRoute = _ref2.getJSONDataByKeyRoute;
4308
+ var _this$props2 = this.props,
4309
+ indexRoute = _this$props2.indexRoute,
4310
+ jsonKey = _this$props2.jsonKey,
4311
+ nodeKey = _this$props2.nodeKey,
4312
+ keyRoute = _this$props2.keyRoute,
4313
+ targetJsonSchema = _this$props2.targetJsonSchema,
4314
+ isArrayItem = _this$props2.isArrayItem,
4315
+ isStructuredSchema = _this$props2.isStructuredSchema;
4406
4316
  var _this$state = this.state,
4407
4317
  jsonView = _this$state.jsonView,
4408
- isClosed = _this$state.isClosed;
4409
- var options = this.props.options || {};
4318
+ _isClosed = _this$state.isClosed;
4319
+ var options = _options || {};
4410
4320
  // 判断是否结构化Schema,如果是则不显示Title,避免重复的title
4411
4321
  var isStructured = isStructuredSchema;
4412
4322
  // 是否显示源码切换按钮
@@ -4422,6 +4332,16 @@
4422
4332
  // 内容Meta数据
4423
4333
  var metaContentKeyList = options.metaContentKeyList || [];
4424
4334
  var globalMetaConfig = options.globalMetaConfig || [];
4335
+
4336
+ // 获取前端缓存中的折叠数据
4337
+ var isClosed = _isClosed;
4338
+ var collapseCacheData = (0,
4339
+ $utils_webCache__WEBPACK_IMPORTED_MODULE_12__.getJSONEditorCache)(
4340
+ keyRoute,
4341
+ );
4342
+ if (collapseCacheData !== undefined) {
4343
+ isClosed = collapseCacheData;
4344
+ }
4425
4345
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
4426
4346
  'div',
4427
4347
  {
@@ -4485,13 +4405,7 @@
4485
4405
  'div',
4486
4406
  {
4487
4407
  className: 'element-title',
4488
- onClick: function onClick(event) {
4489
- _this2.setState({
4490
- isClosed: !isClosed,
4491
- });
4492
- event.preventDefault();
4493
- event.stopPropagation();
4494
- },
4408
+ onClick: this.collapseChange,
4495
4409
  },
4496
4410
  /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
4497
4411
  'span',
@@ -4532,7 +4446,7 @@
4532
4446
  title: jsonView ? '关闭源码模式' : '开启源码模式',
4533
4447
  },
4534
4448
  /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
4535
- $assets_img_code_svg__WEBPACK_IMPORTED_MODULE_12__[
4449
+ $assets_img_code_svg__WEBPACK_IMPORTED_MODULE_13__[
4536
4450
  'default'
4537
4451
  ],
4538
4452
  {
@@ -4579,28 +4493,16 @@
4579
4493
  /** 5. 获取当前元素的id,用于做唯一标识 */
4580
4494
  var childNodeKey =
4581
4495
  nodeKey + '-' + curType + '-' + currentJsonKey;
4582
- var visibleOn = [
4583
- 'description',
4584
- 'valueType',
4585
- 'range',
4586
- 'value',
4587
- ].includes(currentJsonKey)
4588
- ? false
4589
- : true; // 是否显示当前元素
4590
4496
 
4591
4497
  // 补充动态配置类型相关显隐逻辑【定制逻辑】
4592
4498
  if (
4593
- (currentJsonKey === 'description' ||
4594
- currentJsonKey === 'valueType') &&
4499
+ currentJsonKey === 'valueType' &&
4595
4500
  (curJsonData.type === 'ContentStaticConfig' ||
4596
4501
  curJsonData.type === 'ResourceCenter')
4597
4502
  ) {
4598
- // 资源中心配置、mp后台配置 时显示 description(属性名称)、valueType(配置方式)配置项
4599
- visibleOn = true;
4600
4503
  var valueSchema =
4601
4504
  targetJsonSchema.properties['value'];
4602
4505
  if (
4603
- currentJsonKey === 'valueType' &&
4604
4506
  !['select', 'radio', 'checkboxes'].includes(
4605
4507
  valueSchema.type,
4606
4508
  )
@@ -4611,15 +4513,13 @@
4611
4513
  currentSchemaData.description =
4612
4514
  '当前数值没有可选项,不支持设置。';
4613
4515
  }
4614
- } else if (currentJsonKey === 'range') {
4516
+ }
4517
+ if (currentJsonKey === 'range') {
4615
4518
  if (
4616
4519
  curJsonData.valueType === 'select' &&
4617
4520
  (curJsonData.type === 'ContentStaticConfig' ||
4618
4521
  curJsonData.type === 'ResourceCenter')
4619
4522
  ) {
4620
- visibleOn = true;
4621
- }
4622
- if (visibleOn) {
4623
4523
  var _valueSchema =
4624
4524
  targetJsonSchema.properties['value'];
4625
4525
  if (
@@ -4636,14 +4536,6 @@
4636
4536
  );
4637
4537
  }
4638
4538
  }
4639
- } else if (
4640
- currentJsonKey === 'value' &&
4641
- (curJsonData.type === 'DevDefaults' ||
4642
- curJsonData.type === 'RuntimeConst' ||
4643
- curJsonData.type === 'Content')
4644
- ) {
4645
- // 全局配置数据、内容Meta数据 显示 数据值 配置项
4646
- visibleOn = true;
4647
4539
  }
4648
4540
  if (
4649
4541
  currentJsonKey === 'value' &&
@@ -4666,22 +4558,19 @@
4666
4558
  globalMetaConfig,
4667
4559
  );
4668
4560
  }
4669
- if (visibleOn) {
4670
- return (0,
4671
- $components_MappingRender__WEBPACK_IMPORTED_MODULE_9__[
4672
- 'default'
4673
- ])({
4674
- parentType: curType,
4675
- jsonKey: currentJsonKey,
4676
- indexRoute: currentIndexRoute,
4677
- keyRoute: currentKeyRoute,
4678
- nodeKey: childNodeKey,
4679
- targetJsonSchema: currentSchemaData,
4680
- getJSONDataByKeyRoute: getJSONDataByKeyRoute,
4681
- keyRoute2indexRoute: keyRoute2indexRoute,
4682
- updateFormValueData: updateFormValueData,
4683
- });
4684
- }
4561
+ return (0,
4562
+ $components_MappingRender__WEBPACK_IMPORTED_MODULE_9__[
4563
+ 'default'
4564
+ ])({
4565
+ parentType: curType,
4566
+ jsonKey: currentJsonKey,
4567
+ indexRoute: currentIndexRoute,
4568
+ keyRoute: currentKeyRoute,
4569
+ nodeKey: childNodeKey,
4570
+ targetJsonSchema: currentSchemaData,
4571
+ schemaStore: schemaStore,
4572
+ jsonStore: jsonStore,
4573
+ });
4685
4574
  }),
4686
4575
  jsonView &&
4687
4576
  /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
@@ -4715,13 +4604,8 @@
4715
4604
  /* harmony default export */ __webpack_exports__['default'] = (0,
4716
4605
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
4717
4606
  return {
4718
- pageScreen: stores.JSONSchemaStore.pageScreen,
4719
- options: stores.JSONEditorStore.options,
4720
- getJSONDataByKeyRoute:
4721
- stores.JSONEditorStore.getJSONDataByKeyRoute,
4722
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
4723
- getInitJsonDataByKeyRoute:
4724
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
4607
+ schemaStore: stores.JSONSchemaStore,
4608
+ jsonStore: stores.JSONEditorStore,
4725
4609
  };
4726
4610
  })(
4727
4611
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(ObjectSchema),
@@ -4838,7 +4722,8 @@
4838
4722
  _this = _React$PureComponent.call(this, props) || this;
4839
4723
  /** 数值变动事件处理器 */
4840
4724
  _this.handleValueChange = function (curKeyRoute, value) {
4841
- var updateFormValueData = _this.props.updateFormValueData;
4725
+ var _ref = _this.props.jsonStore || {},
4726
+ updateFormValueData = _ref.updateFormValueData;
4842
4727
  updateFormValueData(curKeyRoute, value); // 更新数值
4843
4728
  };
4844
4729
  // 显示和隐藏数据过滤器
@@ -4852,7 +4737,9 @@
4852
4737
  _this.tabChange = function (value) {
4853
4738
  var _this$props = _this.props,
4854
4739
  keyRoute = _this$props.keyRoute,
4855
- triggerChangeAction = _this$props.triggerChangeAction;
4740
+ jsonStore = _this$props.jsonStore;
4741
+ var _ref2 = jsonStore || {},
4742
+ triggerChangeAction = _ref2.triggerChangeAction;
4856
4743
  _this.handleValueChange(keyRoute + '-type', value);
4857
4744
  setTimeout(function () {
4858
4745
  triggerChangeAction();
@@ -4861,8 +4748,10 @@
4861
4748
  _this.dynamicDataChange = function (dynamicDataName) {
4862
4749
  var _this$props2 = _this.props,
4863
4750
  keyRoute = _this$props2.keyRoute,
4864
- dynamicDataObj = _this$props2.dynamicDataObj,
4865
- triggerChangeAction = _this$props2.triggerChangeAction;
4751
+ jsonStore = _this$props2.jsonStore;
4752
+ var _ref3 = jsonStore || {},
4753
+ triggerChangeAction = _ref3.triggerChangeAction,
4754
+ dynamicDataObj = _ref3.dynamicDataObj;
4866
4755
  var curDynamicData = (0,
4867
4756
  $utils_index__WEBPACK_IMPORTED_MODULE_14__.objClone)(
4868
4757
  (0, mobx__WEBPACK_IMPORTED_MODULE_16__.toJS)(
@@ -4894,8 +4783,10 @@
4894
4783
  _this.dataRouteChange = function (newDataRoute) {
4895
4784
  var _this$props3 = _this.props,
4896
4785
  keyRoute = _this$props3.keyRoute,
4897
- triggerChangeAction = _this$props3.triggerChangeAction,
4898
- updateFormValueData = _this$props3.updateFormValueData;
4786
+ jsonStore = _this$props3.jsonStore;
4787
+ var _ref4 = jsonStore || {},
4788
+ triggerChangeAction = _ref4.triggerChangeAction,
4789
+ updateFormValueData = _ref4.updateFormValueData;
4899
4790
  if (newDataRoute) {
4900
4791
  updateFormValueData(
4901
4792
  keyRoute + '-config-dataRoute',
@@ -4927,8 +4818,10 @@
4927
4818
  _this.paramsConfigChange = function (paramsKey, newParamsConfig) {
4928
4819
  var _this$props4 = _this.props,
4929
4820
  keyRoute = _this$props4.keyRoute,
4930
- triggerChangeAction = _this$props4.triggerChangeAction,
4931
- getJSONDataByKeyRoute = _this$props4.getJSONDataByKeyRoute;
4821
+ jsonStore = _this$props4.jsonStore;
4822
+ var _ref5 = jsonStore || {},
4823
+ triggerChangeAction = _ref5.triggerChangeAction,
4824
+ getJSONDataByKeyRoute = _ref5.getJSONDataByKeyRoute;
4932
4825
  var curParamsConfigData =
4933
4826
  getJSONDataByKeyRoute(
4934
4827
  keyRoute + '-config-body-' + paramsKey,
@@ -4972,16 +4865,21 @@
4972
4865
  _proto.render = function render() {
4973
4866
  var _this2 = this;
4974
4867
  var _this$props5 = this.props,
4975
- keyRoute = _this$props5.keyRoute,
4976
- jsonKey = _this$props5.jsonKey,
4977
- nodeKey = _this$props5.nodeKey,
4978
- indexRoute = _this$props5.indexRoute,
4979
- targetJsonSchema = _this$props5.targetJsonSchema,
4980
- dynamicDataList = _this$props5.dynamicDataList,
4981
- dynamicDataObj = _this$props5.dynamicDataObj,
4982
- dynamicDataApiScopeList = _this$props5.dynamicDataApiScopeList,
4983
- getJSONDataByKeyRoute = _this$props5.getJSONDataByKeyRoute,
4984
- pageScreen = _this$props5.pageScreen;
4868
+ schemaStore = _this$props5.schemaStore,
4869
+ jsonStore = _this$props5.jsonStore;
4870
+ var _ref6 = schemaStore || {},
4871
+ pageScreen = _ref6.pageScreen;
4872
+ var _ref7 = jsonStore || {},
4873
+ getJSONDataByKeyRoute = _ref7.getJSONDataByKeyRoute;
4874
+ var _this$props6 = this.props,
4875
+ keyRoute = _this$props6.keyRoute,
4876
+ jsonKey = _this$props6.jsonKey,
4877
+ nodeKey = _this$props6.nodeKey,
4878
+ indexRoute = _this$props6.indexRoute,
4879
+ targetJsonSchema = _this$props6.targetJsonSchema,
4880
+ dynamicDataList = _this$props6.dynamicDataList,
4881
+ dynamicDataObj = _this$props6.dynamicDataObj,
4882
+ dynamicDataApiScopeList = _this$props6.dynamicDataApiScopeList;
4985
4883
  var isShowFilter = this.state.isShowFilter;
4986
4884
  var curType = targetJsonSchema.type;
4987
4885
  // 从jsonData中获取对应的数值
@@ -5437,18 +5335,8 @@
5437
5335
  /* harmony default export */ __webpack_exports__['default'] = (0,
5438
5336
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
5439
5337
  return {
5440
- triggerChange: stores.JSONEditorStore.triggerChange,
5441
- triggerChangeAction: stores.JSONEditorStore.triggerChangeAction,
5442
- pageScreen: stores.JSONSchemaStore.pageScreen,
5443
- dynamicDataList: stores.JSONEditorStore.dynamicDataList,
5444
- dynamicDataObj: stores.JSONEditorStore.dynamicDataObj,
5445
- dynamicDataApiScopeList:
5446
- stores.JSONEditorStore.dynamicDataApiScopeList,
5447
- getJSONDataByKeyRoute:
5448
- stores.JSONEditorStore.getJSONDataByKeyRoute,
5449
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
5450
- getInitJsonDataByKeyRoute:
5451
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
5338
+ schemaStore: stores.JSONSchemaStore,
5339
+ jsonStore: stores.JSONEditorStore,
5452
5340
  };
5453
5341
  })(
5454
5342
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(
@@ -5575,12 +5463,16 @@
5575
5463
  var _targetJsonSchema$sho,
5576
5464
  _this2 = this;
5577
5465
  var _this$props = this.props,
5578
- keyRoute = _this$props.keyRoute,
5579
- jsonKey = _this$props.jsonKey,
5580
- nodeKey = _this$props.nodeKey,
5581
- indexRoute = _this$props.indexRoute,
5582
- targetJsonSchema = _this$props.targetJsonSchema,
5583
- pageScreen = _this$props.pageScreen;
5466
+ schemaStore = _this$props.schemaStore,
5467
+ jsonStore = _this$props.jsonStore;
5468
+ var _ref = schemaStore || {},
5469
+ pageScreen = _ref.pageScreen;
5470
+ var _this$props2 = this.props,
5471
+ keyRoute = _this$props2.keyRoute,
5472
+ jsonKey = _this$props2.jsonKey,
5473
+ nodeKey = _this$props2.nodeKey,
5474
+ indexRoute = _this$props2.indexRoute,
5475
+ targetJsonSchema = _this$props2.targetJsonSchema;
5584
5476
  var curType = targetJsonSchema.type;
5585
5477
  var _this$state = this.state,
5586
5478
  jsonView = _this$state.jsonView,
@@ -5843,13 +5735,8 @@
5843
5735
  /* harmony default export */ __webpack_exports__['default'] = (0,
5844
5736
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
5845
5737
  return {
5846
- triggerChange: stores.JSONEditorStore.triggerChange,
5847
- pageScreen: stores.JSONSchemaStore.pageScreen,
5848
- getJSONDataByKeyRoute:
5849
- stores.JSONEditorStore.getJSONDataByKeyRoute,
5850
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
5851
- getInitJsonDataByKeyRoute:
5852
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
5738
+ schemaStore: stores.JSONSchemaStore,
5739
+ jsonStore: stores.JSONEditorStore,
5853
5740
  };
5854
5741
  })(
5855
5742
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(EventSchema),
@@ -5953,7 +5840,9 @@
5953
5840
  _this.handleValueChange = function (newJsonData) {
5954
5841
  var _this$props = _this.props,
5955
5842
  keyRoute = _this$props.keyRoute,
5956
- updateFormValueData = _this$props.updateFormValueData;
5843
+ jsonStore = _this$props.jsonStore;
5844
+ var _ref = jsonStore || {},
5845
+ updateFormValueData = _ref.updateFormValueData;
5957
5846
  updateFormValueData(keyRoute, newJsonData); // 更新数值
5958
5847
  };
5959
5848
  _this.state = {
@@ -5989,12 +5878,17 @@
5989
5878
  _proto.render = function render() {
5990
5879
  var _this2 = this;
5991
5880
  var _this$props2 = this.props,
5992
- nodeKey = _this$props2.nodeKey,
5993
- jsonKey = _this$props2.jsonKey,
5994
- keyRoute = _this$props2.keyRoute,
5995
- targetJsonSchema = _this$props2.targetJsonSchema,
5996
- pageScreen = _this$props2.pageScreen,
5997
- getJSONDataByKeyRoute = _this$props2.getJSONDataByKeyRoute;
5881
+ schemaStore = _this$props2.schemaStore,
5882
+ jsonStore = _this$props2.jsonStore;
5883
+ var _ref2 = schemaStore || {},
5884
+ pageScreen = _ref2.pageScreen;
5885
+ var _ref3 = jsonStore || {},
5886
+ getJSONDataByKeyRoute = _ref3.getJSONDataByKeyRoute;
5887
+ var _this$props3 = this.props,
5888
+ nodeKey = _this$props3.nodeKey,
5889
+ jsonKey = _this$props3.jsonKey,
5890
+ keyRoute = _this$props3.keyRoute,
5891
+ targetJsonSchema = _this$props3.targetJsonSchema;
5998
5892
  var _this$state = this.state,
5999
5893
  isShowWarn = _this$state.isShowWarn,
6000
5894
  warnText = _this$state.warnText;
@@ -6178,12 +6072,8 @@
6178
6072
  /* harmony default export */ __webpack_exports__['default'] = (0,
6179
6073
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
6180
6074
  return {
6181
- pageScreen: stores.JSONSchemaStore.pageScreen,
6182
- getJSONDataByKeyRoute:
6183
- stores.JSONEditorStore.getJSONDataByKeyRoute,
6184
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
6185
- getInitJsonDataByKeyRoute:
6186
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
6075
+ schemaStore: stores.JSONSchemaStore,
6076
+ jsonStore: stores.JSONEditorStore,
6187
6077
  };
6188
6078
  })(
6189
6079
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(
@@ -6263,14 +6153,16 @@
6263
6153
  // static contextType = ThemeContext;
6264
6154
  /** 数值变动事件处理器 */
6265
6155
  _this.handleValueChange = function (event) {
6156
+ var _this$props = _this.props,
6157
+ keyRoute = _this$props.keyRoute,
6158
+ jsonStore = _this$props.jsonStore;
6159
+ var _ref = jsonStore || {},
6160
+ updateFormValueData = _ref.updateFormValueData;
6266
6161
  var value = event.target.value;
6267
6162
  if (_this.props.onChange) {
6268
6163
  // 如果有监听数据变动函数则优先触发
6269
6164
  _this.props.onChange(value);
6270
6165
  } else {
6271
- var _this$props = _this.props,
6272
- keyRoute = _this$props.keyRoute,
6273
- updateFormValueData = _this$props.updateFormValueData;
6274
6166
  updateFormValueData(keyRoute, value); // 更新数值
6275
6167
  }
6276
6168
  };
@@ -6300,12 +6192,17 @@
6300
6192
  };
6301
6193
  _proto.render = function render() {
6302
6194
  var _this$props2 = this.props,
6303
- nodeKey = _this$props2.nodeKey,
6304
- jsonKey = _this$props2.jsonKey,
6305
- keyRoute = _this$props2.keyRoute,
6306
- targetJsonSchema = _this$props2.targetJsonSchema,
6307
- pageScreen = _this$props2.pageScreen,
6308
- getJSONDataByKeyRoute = _this$props2.getJSONDataByKeyRoute;
6195
+ schemaStore = _this$props2.schemaStore,
6196
+ jsonStore = _this$props2.jsonStore;
6197
+ var _ref2 = schemaStore || {},
6198
+ pageScreen = _ref2.pageScreen;
6199
+ var _ref3 = jsonStore || {},
6200
+ getJSONDataByKeyRoute = _ref3.getJSONDataByKeyRoute;
6201
+ var _this$props3 = this.props,
6202
+ nodeKey = _this$props3.nodeKey,
6203
+ jsonKey = _this$props3.jsonKey,
6204
+ keyRoute = _this$props3.keyRoute,
6205
+ targetJsonSchema = _this$props3.targetJsonSchema;
6309
6206
  // 从jsonData中获取对应的数值
6310
6207
  var curJsonData = keyRoute && getJSONDataByKeyRoute(keyRoute);
6311
6208
  var readOnly = targetJsonSchema.readOnly || false; // 是否只读(默认可编辑)
@@ -6431,16 +6328,336 @@
6431
6328
  /* harmony default export */ __webpack_exports__['default'] = (0,
6432
6329
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
6433
6330
  return {
6434
- pageScreen: stores.JSONSchemaStore.pageScreen,
6435
- getJSONDataByKeyRoute:
6436
- stores.JSONEditorStore.getJSONDataByKeyRoute,
6437
- getInitJsonDataByKeyRoute:
6438
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
6439
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
6331
+ schemaStore: stores.JSONSchemaStore,
6332
+ jsonStore: stores.JSONEditorStore,
6333
+ };
6334
+ })(
6335
+ (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(
6336
+ InputFormSchema,
6337
+ ),
6338
+ );
6339
+
6340
+ /***/
6341
+ },
6342
+
6343
+ /***/ './src/renderers/InputImageSchema/index.js':
6344
+ /*!*************************************************!*\
6345
+ !*** ./src/renderers/InputImageSchema/index.js ***!
6346
+ \*************************************************/
6347
+ /***/ function (
6348
+ __unused_webpack_module,
6349
+ __webpack_exports__,
6350
+ __webpack_require__,
6351
+ ) {
6352
+ 'use strict';
6353
+ __webpack_require__.r(__webpack_exports__);
6354
+ /* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__ =
6355
+ __webpack_require__(
6356
+ /*! @babel/runtime/helpers/inheritsLoose */ '@babel/runtime/helpers/inheritsLoose',
6357
+ );
6358
+ /* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_0___default =
6359
+ /*#__PURE__*/ __webpack_require__.n(
6360
+ _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__,
6361
+ );
6362
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ =
6363
+ __webpack_require__(/*! react */ 'react');
6364
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default =
6365
+ /*#__PURE__*/ __webpack_require__.n(
6366
+ react__WEBPACK_IMPORTED_MODULE_1__,
6367
+ );
6368
+ /* harmony import */ var mobx_react__WEBPACK_IMPORTED_MODULE_2__ =
6369
+ __webpack_require__(/*! mobx-react */ 'mobx-react');
6370
+ /* harmony import */ var mobx_react__WEBPACK_IMPORTED_MODULE_2___default =
6371
+ /*#__PURE__*/ __webpack_require__.n(
6372
+ mobx_react__WEBPACK_IMPORTED_MODULE_2__,
6373
+ );
6374
+ /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_3__ =
6375
+ __webpack_require__(/*! prop-types */ 'prop-types');
6376
+ /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_3___default =
6377
+ /*#__PURE__*/ __webpack_require__.n(
6378
+ prop_types__WEBPACK_IMPORTED_MODULE_3__,
6379
+ );
6380
+ /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_4__ =
6381
+ __webpack_require__(/*! antd */ 'antd');
6382
+ /* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_4___default =
6383
+ /*#__PURE__*/ __webpack_require__.n(
6384
+ antd__WEBPACK_IMPORTED_MODULE_4__,
6385
+ );
6386
+ /* harmony import */ var _ant_design_icons__WEBPACK_IMPORTED_MODULE_5__ =
6387
+ __webpack_require__(/*! @ant-design/icons */ '@ant-design/icons');
6388
+ /* harmony import */ var _ant_design_icons__WEBPACK_IMPORTED_MODULE_5___default =
6389
+ /*#__PURE__*/ __webpack_require__.n(
6390
+ _ant_design_icons__WEBPACK_IMPORTED_MODULE_5__,
6391
+ );
6392
+ /* harmony import */ var _wibetter_json_utils__WEBPACK_IMPORTED_MODULE_6__ =
6393
+ __webpack_require__(
6394
+ /*! @wibetter/json-utils */ '@wibetter/json-utils',
6395
+ );
6396
+ /* harmony import */ var _wibetter_json_utils__WEBPACK_IMPORTED_MODULE_6___default =
6397
+ /*#__PURE__*/ __webpack_require__.n(
6398
+ _wibetter_json_utils__WEBPACK_IMPORTED_MODULE_6__,
6399
+ );
6400
+ /* harmony import */ var $mixins_index__WEBPACK_IMPORTED_MODULE_7__ =
6401
+ __webpack_require__(/*! $mixins/index */ './src/mixins/index.js');
6402
+
6403
+ var InputImageSchema = /*#__PURE__*/ (function (
6404
+ _React$PureComponent,
6405
+ ) {
6406
+ function InputImageSchema(props) {
6407
+ var _this;
6408
+ _this = _React$PureComponent.call(this, props) || this;
6409
+ _this.handleImageChange = function (fileInfo) {
6410
+ var _this$props = _this.props,
6411
+ keyRoute = _this$props.keyRoute,
6412
+ jsonStore = _this$props.jsonStore;
6413
+ var _ref = jsonStore || {},
6414
+ updateFormValueData = _ref.updateFormValueData;
6415
+ if (fileInfo.file.status === 'uploading') {
6416
+ _this.setState({
6417
+ loading: true,
6418
+ });
6419
+ return;
6420
+ }
6421
+ if (fileInfo.file.status === 'done') {
6422
+ var responseData = fileInfo.file.response || {};
6423
+ if (responseData.url) {
6424
+ updateFormValueData(keyRoute, responseData.url);
6425
+ }
6426
+ } else if (fileInfo.file.status === 'error') {
6427
+ antd__WEBPACK_IMPORTED_MODULE_4__.message.error(
6428
+ fileInfo.file.name +
6429
+ ' \u56FE\u7247\u4E0A\u4F20\u5931\u8D25\u3002',
6430
+ );
6431
+ }
6432
+ _this.setState({
6433
+ loading: false,
6434
+ });
6435
+ };
6436
+ _this.handleDeleteChange = function () {
6437
+ var _this$props2 = _this.props,
6438
+ keyRoute = _this$props2.keyRoute,
6439
+ jsonStore = _this$props2.jsonStore;
6440
+ var _ref2 = jsonStore || {},
6441
+ updateFormValueData = _ref2.updateFormValueData;
6442
+ updateFormValueData(keyRoute, '');
6443
+ };
6444
+ _this.state = {
6445
+ loading: false,
6446
+ };
6447
+ // 这边绑定是必要的,这样 `this` 才能在回调函数中使用
6448
+ _this.handleImageChange = _this.handleImageChange.bind(_this);
6449
+ _this.handleDeleteChange = _this.handleDeleteChange.bind(_this);
6450
+ return _this;
6451
+ }
6452
+
6453
+ // 方式1:在class组件中声明静态属性static,且必须是contextType,确保当前组件可以使用全局context中的数据(this.context不为空)
6454
+ // static contextType = ThemeContext;
6455
+ _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_0___default()(
6456
+ InputImageSchema,
6457
+ _React$PureComponent,
6458
+ );
6459
+ var _proto = InputImageSchema.prototype;
6460
+ _proto.componentWillMount = function componentWillMount() {
6461
+ // 从web缓存中获取数值
6462
+ $mixins_index__WEBPACK_IMPORTED_MODULE_7__.catchJsonDataByWebCache.call(
6463
+ this,
6464
+ );
6465
+ };
6466
+ _proto.componentWillReceiveProps =
6467
+ function componentWillReceiveProps(nextProps) {
6468
+ if (nextProps.keyRoute !== this.props.keyRoute) {
6469
+ /** 当key值路径发生变化时重新从web缓存中获取数值 */
6470
+ $mixins_index__WEBPACK_IMPORTED_MODULE_7__.catchJsonDataByWebCache.call(
6471
+ this,
6472
+ nextProps.keyRoute,
6473
+ );
6474
+ }
6475
+ };
6476
+ _proto.render = function render() {
6477
+ var _targetJsonSchema$lis;
6478
+ var _this$props3 = this.props,
6479
+ schemaStore = _this$props3.schemaStore,
6480
+ jsonStore = _this$props3.jsonStore;
6481
+ var _ref3 = schemaStore || {},
6482
+ pageScreen = _ref3.pageScreen;
6483
+ var _ref4 = jsonStore || {},
6484
+ getJSONDataByKeyRoute = _ref4.getJSONDataByKeyRoute;
6485
+ var _this$props4 = this.props,
6486
+ nodeKey = _this$props4.nodeKey,
6487
+ jsonKey = _this$props4.jsonKey,
6488
+ keyRoute = _this$props4.keyRoute,
6489
+ targetJsonSchema = _this$props4.targetJsonSchema;
6490
+ var options = this.props.options || {};
6491
+ var loading = this.state.loading;
6492
+ // 从jsonData中获取对应的数值
6493
+ var curJsonData = keyRoute && getJSONDataByKeyRoute(keyRoute);
6494
+ var readOnly = targetJsonSchema.readOnly || false; // 是否只读(默认可编辑)
6495
+ var isRequired = targetJsonSchema.isRequired || false; // 是否必填(默认非必填)
6496
+
6497
+ var uploadProps = {
6498
+ name: 'file',
6499
+ // targetJsonSchema.name || jsonKey || 'imgFile',
6500
+ action: targetJsonSchema.uploadAction || options.uploadAction,
6501
+ accept: targetJsonSchema.accept || options.uploadAccept,
6502
+ // multiple: targetJsonSchema.multiple ?? false,
6503
+ maxCount: targetJsonSchema.multiple
6504
+ ? targetJsonSchema.maxCount || 1
6505
+ : 1,
6506
+ // showUploadList: false,
6507
+ listType:
6508
+ (_targetJsonSchema$lis = targetJsonSchema.listType) != null
6509
+ ? _targetJsonSchema$lis
6510
+ : 'picture-card',
6511
+ headers: {
6512
+ authorization:
6513
+ targetJsonSchema.authorization || 'authorization-content',
6514
+ },
6515
+ onChange: this.handleImageChange,
6516
+ onRemove: this.handleDeleteChange,
6517
+ };
6518
+ return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1__.createElement(
6519
+ 'div',
6520
+ {
6521
+ className:
6522
+ pageScreen === 'wideScreen'
6523
+ ? 'wide-screen-element-warp'
6524
+ : 'mobile-screen-element-warp',
6525
+ key: nodeKey,
6526
+ id: nodeKey,
6527
+ },
6528
+ /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1__.createElement(
6529
+ 'div',
6530
+ {
6531
+ className: 'element-title',
6532
+ },
6533
+ /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1__.createElement(
6534
+ 'span',
6535
+ {
6536
+ className: 'title-text warning-text',
6537
+ },
6538
+ readOnly ? '[只读]' : '',
6539
+ ),
6540
+ /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1__.createElement(
6541
+ antd__WEBPACK_IMPORTED_MODULE_4__.Tooltip,
6542
+ {
6543
+ title:
6544
+ pageScreen === 'wideScreen'
6545
+ ? targetJsonSchema.description
6546
+ : '',
6547
+ placement: 'top',
6548
+ },
6549
+ /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1__.createElement(
6550
+ 'span',
6551
+ {
6552
+ className: 'title-text',
6553
+ title:
6554
+ pageScreen === 'wideScreen' &&
6555
+ targetJsonSchema.title &&
6556
+ targetJsonSchema.title.length > (readOnly ? 4 : 6)
6557
+ ? targetJsonSchema.title
6558
+ : '',
6559
+ },
6560
+ targetJsonSchema.title,
6561
+ targetJsonSchema.showKey &&
6562
+ /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1__.createElement(
6563
+ 'span',
6564
+ null,
6565
+ '\uFF08',
6566
+ (0,
6567
+ _wibetter_json_utils__WEBPACK_IMPORTED_MODULE_6__.truncate)(
6568
+ jsonKey,
6569
+ {
6570
+ length: 15,
6571
+ },
6572
+ ),
6573
+ '\uFF09',
6574
+ ),
6575
+ ),
6576
+ ),
6577
+ pageScreen === 'mobileScreen' &&
6578
+ targetJsonSchema.description &&
6579
+ /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1__.createElement(
6580
+ antd__WEBPACK_IMPORTED_MODULE_4__.Tooltip,
6581
+ {
6582
+ title: targetJsonSchema.description,
6583
+ placement: 'top',
6584
+ },
6585
+ /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1__.createElement(
6586
+ _ant_design_icons__WEBPACK_IMPORTED_MODULE_5__.InfoCircleOutlined,
6587
+ {
6588
+ className: 'info-icon',
6589
+ },
6590
+ ),
6591
+ ),
6592
+ ),
6593
+ /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1__.createElement(
6594
+ 'div',
6595
+ {
6596
+ className: 'content-item',
6597
+ },
6598
+ /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1__.createElement(
6599
+ 'div',
6600
+ {
6601
+ className: 'form-item-box',
6602
+ },
6603
+ /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1__.createElement(
6604
+ antd__WEBPACK_IMPORTED_MODULE_4__.Upload,
6605
+ uploadProps,
6606
+ /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1__.createElement(
6607
+ 'button',
6608
+ {
6609
+ style: {
6610
+ border: 0,
6611
+ background: 'none',
6612
+ cursor: 'pointer',
6613
+ },
6614
+ type: 'button',
6615
+ },
6616
+ loading
6617
+ ? /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1__.createElement(
6618
+ _ant_design_icons__WEBPACK_IMPORTED_MODULE_5__.LoadingOutlined,
6619
+ null,
6620
+ )
6621
+ : /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1__.createElement(
6622
+ _ant_design_icons__WEBPACK_IMPORTED_MODULE_5__.PlusOutlined,
6623
+ null,
6624
+ ),
6625
+ /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1__.createElement(
6626
+ 'div',
6627
+ {
6628
+ style: {
6629
+ marginTop: 8,
6630
+ },
6631
+ },
6632
+ '\u4E0A\u4F20\u56FE\u7247',
6633
+ ),
6634
+ ),
6635
+ ),
6636
+ ),
6637
+ ),
6638
+ );
6639
+ };
6640
+ return InputImageSchema;
6641
+ })(react__WEBPACK_IMPORTED_MODULE_1__.PureComponent);
6642
+ InputImageSchema.propTypes = {
6643
+ parentType: prop_types__WEBPACK_IMPORTED_MODULE_3___default().any,
6644
+ jsonKey: prop_types__WEBPACK_IMPORTED_MODULE_3___default().string,
6645
+ indexRoute: prop_types__WEBPACK_IMPORTED_MODULE_3___default().any,
6646
+ keyRoute: prop_types__WEBPACK_IMPORTED_MODULE_3___default().any,
6647
+ nodeKey: prop_types__WEBPACK_IMPORTED_MODULE_3___default().string,
6648
+ targetJsonSchema:
6649
+ prop_types__WEBPACK_IMPORTED_MODULE_3___default().any,
6650
+ onChange: prop_types__WEBPACK_IMPORTED_MODULE_3___default().any,
6651
+ };
6652
+ /* harmony default export */ __webpack_exports__['default'] = (0,
6653
+ mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
6654
+ return {
6655
+ schemaStore: stores.JSONSchemaStore,
6656
+ jsonStore: stores.JSONEditorStore,
6440
6657
  };
6441
6658
  })(
6442
6659
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(
6443
- InputFormSchema,
6660
+ InputImageSchema,
6444
6661
  ),
6445
6662
  );
6446
6663
 
@@ -6544,7 +6761,9 @@
6544
6761
  _this.handleValueChange = function (newJsonData) {
6545
6762
  var _this$props = _this.props,
6546
6763
  keyRoute = _this$props.keyRoute,
6547
- updateFormValueData = _this$props.updateFormValueData;
6764
+ jsonStore = _this$props.jsonStore;
6765
+ var _ref = jsonStore || {},
6766
+ updateFormValueData = _ref.updateFormValueData;
6548
6767
  if (newJsonData) {
6549
6768
  updateFormValueData(keyRoute, newJsonData); // 更新数值
6550
6769
  }
@@ -6584,12 +6803,17 @@
6584
6803
  _proto.render = function render() {
6585
6804
  var _this2 = this;
6586
6805
  var _this$props2 = this.props,
6587
- nodeKey = _this$props2.nodeKey,
6588
- jsonKey = _this$props2.jsonKey,
6589
- keyRoute = _this$props2.keyRoute,
6590
- targetJsonSchema = _this$props2.targetJsonSchema,
6591
- pageScreen = _this$props2.pageScreen,
6592
- getJSONDataByKeyRoute = _this$props2.getJSONDataByKeyRoute;
6806
+ schemaStore = _this$props2.schemaStore,
6807
+ jsonStore = _this$props2.jsonStore;
6808
+ var _ref2 = schemaStore || {},
6809
+ pageScreen = _ref2.pageScreen;
6810
+ var _ref3 = jsonStore || {},
6811
+ getJSONDataByKeyRoute = _ref3.getJSONDataByKeyRoute;
6812
+ var _this$props3 = this.props,
6813
+ nodeKey = _this$props3.nodeKey,
6814
+ jsonKey = _this$props3.jsonKey,
6815
+ keyRoute = _this$props3.keyRoute,
6816
+ targetJsonSchema = _this$props3.targetJsonSchema;
6593
6817
  var _this$state = this.state,
6594
6818
  isShowWarn = _this$state.isShowWarn,
6595
6819
  warnText = _this$state.warnText,
@@ -6772,13 +6996,8 @@
6772
6996
  /* harmony default export */ __webpack_exports__['default'] = (0,
6773
6997
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
6774
6998
  return {
6775
- pageScreen: stores.JSONSchemaStore.pageScreen,
6776
- getJSONDataByKeyRoute:
6777
- stores.JSONEditorStore.getJSONDataByKeyRoute,
6778
- getInitJsonDataByKeyRoute:
6779
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
6780
- indexRoute2keyRoute: stores.JSONSchemaStore.indexRoute2keyRoute,
6781
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
6999
+ schemaStore: stores.JSONSchemaStore,
7000
+ jsonStore: stores.JSONEditorStore,
6782
7001
  };
6783
7002
  })(
6784
7003
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(
@@ -6870,7 +7089,9 @@
6870
7089
  _this.handleValueChange = function (newJsonData) {
6871
7090
  var _this$props = _this.props,
6872
7091
  keyRoute = _this$props.keyRoute,
6873
- updateFormValueData = _this$props.updateFormValueData;
7092
+ jsonStore = _this$props.jsonStore;
7093
+ var _ref = jsonStore || {},
7094
+ updateFormValueData = _ref.updateFormValueData;
6874
7095
  if (newJsonData) {
6875
7096
  updateFormValueData(keyRoute, newJsonData); // 更新数值
6876
7097
  }
@@ -6884,11 +7105,12 @@
6884
7105
  );
6885
7106
  var _proto = JsonView.prototype;
6886
7107
  _proto.render = function render() {
7108
+ var _ref2 = this.props.jsonStore || {},
7109
+ getJSONDataByKeyRoute = _ref2.getJSONDataByKeyRoute;
6887
7110
  var _this$props2 = this.props,
6888
7111
  nodeKey = _this$props2.nodeKey,
6889
7112
  keyRoute = _this$props2.keyRoute,
6890
- targetJsonSchema = _this$props2.targetJsonSchema,
6891
- getJSONDataByKeyRoute = _this$props2.getJSONDataByKeyRoute;
7113
+ targetJsonSchema = _this$props2.targetJsonSchema;
6892
7114
  // 从jsonData中获取对应的数值
6893
7115
  var curJsonData = getJSONDataByKeyRoute(keyRoute);
6894
7116
 
@@ -6964,11 +7186,8 @@
6964
7186
  /* harmony default export */ __webpack_exports__['default'] = (0,
6965
7187
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
6966
7188
  return {
6967
- pageScreen: stores.JSONSchemaStore.pageScreen,
6968
- getJSONDataByKeyRoute:
6969
- stores.JSONEditorStore.getJSONDataByKeyRoute,
6970
- getInitJsonDataByKeyRoute:
6971
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
7189
+ schemaStore: stores.JSONSchemaStore,
7190
+ jsonStore: stores.JSONEditorStore,
6972
7191
  };
6973
7192
  })((0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(JsonView));
6974
7193
 
@@ -7049,8 +7268,10 @@
7049
7268
  _this.handleValueChange = function (newVal) {
7050
7269
  var _this$props = _this.props,
7051
7270
  keyRoute = _this$props.keyRoute,
7052
- targetJsonSchema = _this$props.targetJsonSchema,
7053
- updateFormValueData = _this$props.updateFormValueData;
7271
+ jsonStore = _this$props.jsonStore;
7272
+ var _ref = jsonStore || {},
7273
+ updateFormValueData = _ref.updateFormValueData;
7274
+ var targetJsonSchema = _this.props.targetJsonSchema;
7054
7275
  if (newVal < targetJsonSchema.minimum) {
7055
7276
  antd__WEBPACK_IMPORTED_MODULE_4__.message.warning(
7056
7277
  '\u5C0F\u4E8E\u8BBE\u5B9A\u7684\u6700\u5C0F\u6570\u503C' +
@@ -7115,12 +7336,17 @@
7115
7336
  _proto.render = function render() {
7116
7337
  var _this2 = this;
7117
7338
  var _this$props2 = this.props,
7118
- keyRoute = _this$props2.keyRoute,
7119
- jsonKey = _this$props2.jsonKey,
7120
- nodeKey = _this$props2.nodeKey,
7121
- targetJsonSchema = _this$props2.targetJsonSchema,
7122
- pageScreen = _this$props2.pageScreen,
7123
- getJSONDataByKeyRoute = _this$props2.getJSONDataByKeyRoute;
7339
+ schemaStore = _this$props2.schemaStore,
7340
+ jsonStore = _this$props2.jsonStore;
7341
+ var _ref2 = schemaStore || {},
7342
+ pageScreen = _ref2.pageScreen;
7343
+ var _ref3 = jsonStore || {},
7344
+ getJSONDataByKeyRoute = _ref3.getJSONDataByKeyRoute;
7345
+ var _this$props3 = this.props,
7346
+ keyRoute = _this$props3.keyRoute,
7347
+ jsonKey = _this$props3.jsonKey,
7348
+ nodeKey = _this$props3.nodeKey,
7349
+ targetJsonSchema = _this$props3.targetJsonSchema;
7124
7350
  var renderTime = this.state.renderTime;
7125
7351
  // 从jsonData中获取对应的数值
7126
7352
  var curJsonData = getJSONDataByKeyRoute(keyRoute);
@@ -7285,12 +7511,8 @@
7285
7511
  /* harmony default export */ __webpack_exports__['default'] = (0,
7286
7512
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
7287
7513
  return {
7288
- pageScreen: stores.JSONSchemaStore.pageScreen,
7289
- getJSONDataByKeyRoute:
7290
- stores.JSONEditorStore.getJSONDataByKeyRoute,
7291
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
7292
- getInitJsonDataByKeyRoute:
7293
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
7514
+ schemaStore: stores.JSONSchemaStore,
7515
+ jsonStore: stores.JSONEditorStore,
7294
7516
  };
7295
7517
  })(
7296
7518
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(
@@ -7368,17 +7590,21 @@
7368
7590
  );
7369
7591
  /* harmony import */ var $mixins_index__WEBPACK_IMPORTED_MODULE_9__ =
7370
7592
  __webpack_require__(/*! $mixins/index */ './src/mixins/index.js');
7371
- /* harmony import */ var $assets_img_code_svg__WEBPACK_IMPORTED_MODULE_10__ =
7593
+ /* harmony import */ var $utils_webCache__WEBPACK_IMPORTED_MODULE_10__ =
7594
+ __webpack_require__(
7595
+ /*! $utils/webCache */ './src/utils/webCache.js',
7596
+ );
7597
+ /* harmony import */ var $assets_img_code_svg__WEBPACK_IMPORTED_MODULE_11__ =
7372
7598
  __webpack_require__(
7373
7599
  /*! $assets/img/code.svg */ './src/assets/img/code.svg',
7374
7600
  );
7375
- /* harmony import */ var _index_scss__WEBPACK_IMPORTED_MODULE_11__ =
7601
+ /* harmony import */ var _index_scss__WEBPACK_IMPORTED_MODULE_12__ =
7376
7602
  __webpack_require__(
7377
7603
  /*! ./index.scss */ './src/renderers/ObjectSchema/index.scss',
7378
7604
  );
7379
- /* harmony import */ var _index_scss__WEBPACK_IMPORTED_MODULE_11___default =
7605
+ /* harmony import */ var _index_scss__WEBPACK_IMPORTED_MODULE_12___default =
7380
7606
  /*#__PURE__*/ __webpack_require__.n(
7381
- _index_scss__WEBPACK_IMPORTED_MODULE_11__,
7607
+ _index_scss__WEBPACK_IMPORTED_MODULE_12__,
7382
7608
  );
7383
7609
 
7384
7610
  var ObjectSchema = /*#__PURE__*/ (function (_React$PureComponent) {
@@ -7390,6 +7616,7 @@
7390
7616
  // 是否显示code模式
7391
7617
  isClosed: false, // 是否为关闭状态,默认是开启状态
7392
7618
  };
7619
+ _this.collapseChange = _this.collapseChange.bind(_this);
7393
7620
  return _this;
7394
7621
  }
7395
7622
  _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_0___default()(
@@ -7413,25 +7640,42 @@
7413
7640
  );
7414
7641
  }
7415
7642
  };
7643
+ _proto.collapseChange = function collapseChange(event) {
7644
+ var keyRoute = this.props.keyRoute;
7645
+ var isClosed = this.state.isClosed;
7646
+ this.setState({
7647
+ isClosed: !isClosed,
7648
+ });
7649
+ event.preventDefault();
7650
+ event.stopPropagation();
7651
+
7652
+ // 缓存当前折叠状态
7653
+ (0,
7654
+ $utils_webCache__WEBPACK_IMPORTED_MODULE_10__.saveJSONEditorCache)(
7655
+ keyRoute,
7656
+ !isClosed,
7657
+ );
7658
+ };
7416
7659
  _proto.render = function render() {
7417
7660
  var _targetJsonSchema$sho,
7418
7661
  _this2 = this;
7419
7662
  var _this$props = this.props,
7420
- indexRoute = _this$props.indexRoute,
7421
- jsonKey = _this$props.jsonKey,
7422
- nodeKey = _this$props.nodeKey,
7423
- keyRoute = _this$props.keyRoute,
7424
- pageScreen = _this$props.pageScreen,
7425
- targetJsonSchema = _this$props.targetJsonSchema,
7426
- isArrayItem = _this$props.isArrayItem,
7427
- arrIndex = _this$props.arrIndex,
7428
- isStructuredSchema = _this$props.isStructuredSchema,
7429
- getJSONDataByKeyRoute = _this$props.getJSONDataByKeyRoute,
7430
- keyRoute2indexRoute = _this$props.keyRoute2indexRoute,
7431
- updateFormValueData = _this$props.updateFormValueData;
7663
+ schemaStore = _this$props.schemaStore,
7664
+ jsonStore = _this$props.jsonStore;
7665
+ var _ref = schemaStore || {},
7666
+ pageScreen = _ref.pageScreen;
7667
+ var _this$props2 = this.props,
7668
+ indexRoute = _this$props2.indexRoute,
7669
+ jsonKey = _this$props2.jsonKey,
7670
+ nodeKey = _this$props2.nodeKey,
7671
+ keyRoute = _this$props2.keyRoute,
7672
+ targetJsonSchema = _this$props2.targetJsonSchema,
7673
+ isArrayItem = _this$props2.isArrayItem,
7674
+ arrIndex = _this$props2.arrIndex,
7675
+ isStructuredSchema = _this$props2.isStructuredSchema;
7432
7676
  var _this$state = this.state,
7433
7677
  jsonView = _this$state.jsonView,
7434
- isClosed = _this$state.isClosed;
7678
+ _isClosed = _this$state.isClosed;
7435
7679
  // 判断是否结构化Schema,如果是则不显示Title,避免重复的title
7436
7680
  var isStructured = isStructuredSchema;
7437
7681
  // 是否显示源码切换按钮
@@ -7440,6 +7684,16 @@
7440
7684
  null
7441
7685
  ? _targetJsonSchema$sho
7442
7686
  : true;
7687
+
7688
+ // 获取前端缓存中的折叠数据
7689
+ var isClosed = _isClosed;
7690
+ var collapseCacheData = (0,
7691
+ $utils_webCache__WEBPACK_IMPORTED_MODULE_10__.getJSONEditorCache)(
7692
+ keyRoute,
7693
+ );
7694
+ if (collapseCacheData !== undefined) {
7695
+ isClosed = collapseCacheData;
7696
+ }
7443
7697
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
7444
7698
  'div',
7445
7699
  {
@@ -7502,13 +7756,7 @@
7502
7756
  'div',
7503
7757
  {
7504
7758
  className: 'element-title',
7505
- onClick: function onClick(event) {
7506
- _this2.setState({
7507
- isClosed: !isClosed,
7508
- });
7509
- event.preventDefault();
7510
- event.stopPropagation();
7511
- },
7759
+ onClick: this.collapseChange,
7512
7760
  },
7513
7761
  /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
7514
7762
  'span',
@@ -7549,7 +7797,7 @@
7549
7797
  title: jsonView ? '关闭源码模式' : '开启源码模式',
7550
7798
  },
7551
7799
  /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
7552
- $assets_img_code_svg__WEBPACK_IMPORTED_MODULE_10__[
7800
+ $assets_img_code_svg__WEBPACK_IMPORTED_MODULE_11__[
7553
7801
  'default'
7554
7802
  ],
7555
7803
  {
@@ -7604,9 +7852,8 @@
7604
7852
  keyRoute: currentKeyRoute,
7605
7853
  nodeKey: childNodeKey,
7606
7854
  targetJsonSchema: currentSchemaData,
7607
- getJSONDataByKeyRoute: getJSONDataByKeyRoute,
7608
- keyRoute2indexRoute: keyRoute2indexRoute,
7609
- updateFormValueData: updateFormValueData,
7855
+ schemaStore: schemaStore,
7856
+ jsonStore: jsonStore,
7610
7857
  });
7611
7858
  }),
7612
7859
  jsonView &&
@@ -7641,12 +7888,8 @@
7641
7888
  /* harmony default export */ __webpack_exports__['default'] = (0,
7642
7889
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
7643
7890
  return {
7644
- pageScreen: stores.JSONSchemaStore.pageScreen,
7645
- getJSONDataByKeyRoute:
7646
- stores.JSONEditorStore.getJSONDataByKeyRoute,
7647
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
7648
- getInitJsonDataByKeyRoute:
7649
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
7891
+ schemaStore: stores.JSONSchemaStore,
7892
+ jsonStore: stores.JSONEditorStore,
7650
7893
  };
7651
7894
  })(
7652
7895
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(ObjectSchema),
@@ -7718,10 +7961,12 @@
7718
7961
  // 这边绑定是必要的,这样 `this` 才能在回调函数中使用
7719
7962
  /** 数值变动事件处理器 */
7720
7963
  _this.handleValueChange = function (event) {
7721
- var value = event.target.value;
7722
7964
  var _this$props = _this.props,
7723
7965
  keyRoute = _this$props.keyRoute,
7724
- updateFormValueData = _this$props.updateFormValueData;
7966
+ jsonStore = _this$props.jsonStore;
7967
+ var _ref = jsonStore || {},
7968
+ updateFormValueData = _ref.updateFormValueData;
7969
+ var value = event.target.value;
7725
7970
  var curKeyRoute = keyRoute ? keyRoute + '-unit' : 'unit';
7726
7971
  updateFormValueData(curKeyRoute, Number(value)); // 更新单位数值
7727
7972
  };
@@ -7751,12 +7996,17 @@
7751
7996
  };
7752
7997
  _proto.render = function render() {
7753
7998
  var _this$props2 = this.props,
7754
- keyRoute = _this$props2.keyRoute,
7755
- jsonKey = _this$props2.jsonKey,
7756
- nodeKey = _this$props2.nodeKey,
7757
- targetJsonSchema = _this$props2.targetJsonSchema,
7758
- pageScreen = _this$props2.pageScreen,
7759
- getJSONDataByKeyRoute = _this$props2.getJSONDataByKeyRoute;
7999
+ schemaStore = _this$props2.schemaStore,
8000
+ jsonStore = _this$props2.jsonStore;
8001
+ var _ref2 = schemaStore || {},
8002
+ pageScreen = _ref2.pageScreen;
8003
+ var _ref3 = jsonStore || {},
8004
+ getJSONDataByKeyRoute = _ref3.getJSONDataByKeyRoute;
8005
+ var _this$props3 = this.props,
8006
+ keyRoute = _this$props3.keyRoute,
8007
+ jsonKey = _this$props3.jsonKey,
8008
+ nodeKey = _this$props3.nodeKey,
8009
+ targetJsonSchema = _this$props3.targetJsonSchema;
7760
8010
  // 从jsonData中获取对应的数值
7761
8011
  var curJsonData = getJSONDataByKeyRoute(keyRoute);
7762
8012
  var readOnly = targetJsonSchema.readOnly || false; // 是否只读(默认可编辑)
@@ -7881,12 +8131,8 @@
7881
8131
  /* harmony default export */ __webpack_exports__['default'] = (0,
7882
8132
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
7883
8133
  return {
7884
- pageScreen: stores.JSONSchemaStore.pageScreen,
7885
- getJSONDataByKeyRoute:
7886
- stores.JSONEditorStore.getJSONDataByKeyRoute,
7887
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
7888
- getInitJsonDataByKeyRoute:
7889
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
8134
+ schemaStore: stores.JSONSchemaStore,
8135
+ jsonStore: stores.JSONEditorStore,
7890
8136
  };
7891
8137
  })(
7892
8138
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(
@@ -7964,10 +8210,12 @@
7964
8210
  // 这边绑定是必要的,这样 `this` 才能在回调函数中使用
7965
8211
  /** 数值变动事件处理器 */
7966
8212
  _this.handleValueChange = function (event) {
7967
- var value = event.target.value;
7968
8213
  var _this$props = _this.props,
7969
8214
  keyRoute = _this$props.keyRoute,
7970
- updateFormValueData = _this$props.updateFormValueData;
8215
+ jsonStore = _this$props.jsonStore;
8216
+ var _ref = jsonStore || {},
8217
+ updateFormValueData = _ref.updateFormValueData;
8218
+ var value = event.target.value;
7971
8219
  updateFormValueData(keyRoute, value); // 更新数值
7972
8220
  };
7973
8221
  _this.handleValueChange = _this.handleValueChange.bind(_this);
@@ -7996,12 +8244,17 @@
7996
8244
  };
7997
8245
  _proto.render = function render() {
7998
8246
  var _this$props2 = this.props,
7999
- nodeKey = _this$props2.nodeKey,
8000
- jsonKey = _this$props2.jsonKey,
8001
- keyRoute = _this$props2.keyRoute,
8002
- targetJsonSchema = _this$props2.targetJsonSchema,
8003
- pageScreen = _this$props2.pageScreen,
8004
- getJSONDataByKeyRoute = _this$props2.getJSONDataByKeyRoute;
8247
+ schemaStore = _this$props2.schemaStore,
8248
+ jsonStore = _this$props2.jsonStore;
8249
+ var _ref2 = schemaStore || {},
8250
+ pageScreen = _ref2.pageScreen;
8251
+ var _ref3 = jsonStore || {},
8252
+ getJSONDataByKeyRoute = _ref3.getJSONDataByKeyRoute;
8253
+ var _this$props3 = this.props,
8254
+ nodeKey = _this$props3.nodeKey,
8255
+ jsonKey = _this$props3.jsonKey,
8256
+ keyRoute = _this$props3.keyRoute,
8257
+ targetJsonSchema = _this$props3.targetJsonSchema;
8005
8258
  // 从jsonData中获取对应的数值
8006
8259
  var curJsonData = getJSONDataByKeyRoute(keyRoute);
8007
8260
  var options = targetJsonSchema.options;
@@ -8127,12 +8380,8 @@
8127
8380
  /* harmony default export */ __webpack_exports__['default'] = (0,
8128
8381
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
8129
8382
  return {
8130
- pageScreen: stores.JSONSchemaStore.pageScreen,
8131
- getJSONDataByKeyRoute:
8132
- stores.JSONEditorStore.getJSONDataByKeyRoute,
8133
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
8134
- getInitJsonDataByKeyRoute:
8135
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
8383
+ schemaStore: stores.JSONSchemaStore,
8384
+ jsonStore: stores.JSONEditorStore,
8136
8385
  };
8137
8386
  })(
8138
8387
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(RadioSchema),
@@ -8296,14 +8545,19 @@
8296
8545
  _proto.render = function render() {
8297
8546
  var _this2 = this;
8298
8547
  var _this$props = this.props,
8299
- pageScreen = _this$props.pageScreen,
8300
- curConfigData = _this$props.curConfigData,
8301
- nodeKey = _this$props.nodeKey,
8302
- keyRoute = _this$props.keyRoute,
8303
- dynamicDataList = _this$props.dynamicDataList,
8304
- dynamicDataObj = _this$props.dynamicDataObj,
8305
- dynamicDataApiScopeList = _this$props.dynamicDataApiScopeList,
8306
- getJSONDataByKeyRoute = _this$props.getJSONDataByKeyRoute;
8548
+ schemaStore = _this$props.schemaStore,
8549
+ jsonStore = _this$props.jsonStore;
8550
+ var _ref = schemaStore || {},
8551
+ pageScreen = _ref.pageScreen;
8552
+ var _ref2 = jsonStore || {},
8553
+ getJSONDataByKeyRoute = _ref2.getJSONDataByKeyRoute,
8554
+ dynamicDataApiScopeList = _ref2.dynamicDataApiScopeList,
8555
+ dynamicDataList = _ref2.dynamicDataList,
8556
+ dynamicDataObj = _ref2.dynamicDataObj;
8557
+ var _this$props2 = this.props,
8558
+ curConfigData = _this$props2.curConfigData,
8559
+ nodeKey = _this$props2.nodeKey,
8560
+ keyRoute = _this$props2.keyRoute;
8307
8561
  // 从jsonData中获取对应的数值
8308
8562
  var curJsonData = getJSONDataByKeyRoute(keyRoute) || {};
8309
8563
  var dataName = curConfigData.dataName; // 数据源名称
@@ -8563,13 +8817,8 @@
8563
8817
  /* harmony default export */ __webpack_exports__['default'] = (0,
8564
8818
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
8565
8819
  return {
8566
- pageScreen: stores.JSONSchemaStore.pageScreen,
8567
- dynamicDataList: stores.JSONEditorStore.dynamicDataList,
8568
- dynamicDataObj: stores.JSONEditorStore.dynamicDataObj,
8569
- dynamicDataApiScopeList:
8570
- stores.JSONEditorStore.dynamicDataApiScopeList,
8571
- getJSONDataByKeyRoute:
8572
- stores.JSONEditorStore.getJSONDataByKeyRoute,
8820
+ schemaStore: stores.JSONSchemaStore,
8821
+ jsonStore: stores.JSONEditorStore,
8573
8822
  };
8574
8823
  })(
8575
8824
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(
@@ -8664,7 +8913,9 @@
8664
8913
  _this.handleValueChange = function (value) {
8665
8914
  var _this$props = _this.props,
8666
8915
  keyRoute = _this$props.keyRoute,
8667
- updateFormValueData = _this$props.updateFormValueData;
8916
+ jsonStore = _this$props.jsonStore;
8917
+ var _ref = jsonStore || {},
8918
+ updateFormValueData = _ref.updateFormValueData;
8668
8919
  updateFormValueData(keyRoute, value); // 更新数值
8669
8920
  };
8670
8921
  _this.handleValueChange = _this.handleValueChange.bind(_this);
@@ -8693,12 +8944,17 @@
8693
8944
  };
8694
8945
  _proto.render = function render() {
8695
8946
  var _this$props2 = this.props,
8696
- nodeKey = _this$props2.nodeKey,
8697
- jsonKey = _this$props2.jsonKey,
8698
- keyRoute = _this$props2.keyRoute,
8699
- targetJsonSchema = _this$props2.targetJsonSchema,
8700
- pageScreen = _this$props2.pageScreen,
8701
- getJSONDataByKeyRoute = _this$props2.getJSONDataByKeyRoute;
8947
+ schemaStore = _this$props2.schemaStore,
8948
+ jsonStore = _this$props2.jsonStore;
8949
+ var _ref2 = schemaStore || {},
8950
+ pageScreen = _ref2.pageScreen;
8951
+ var _ref3 = jsonStore || {},
8952
+ getJSONDataByKeyRoute = _ref3.getJSONDataByKeyRoute;
8953
+ var _this$props3 = this.props,
8954
+ nodeKey = _this$props3.nodeKey,
8955
+ jsonKey = _this$props3.jsonKey,
8956
+ keyRoute = _this$props3.keyRoute,
8957
+ targetJsonSchema = _this$props3.targetJsonSchema;
8702
8958
  // 从jsonData中获取对应的数值
8703
8959
  var curJsonData = getJSONDataByKeyRoute(keyRoute);
8704
8960
  var options = targetJsonSchema.options;
@@ -8836,12 +9092,8 @@
8836
9092
  /* harmony default export */ __webpack_exports__['default'] = (0,
8837
9093
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
8838
9094
  return {
8839
- pageScreen: stores.JSONSchemaStore.pageScreen,
8840
- getJSONDataByKeyRoute:
8841
- stores.JSONEditorStore.getJSONDataByKeyRoute,
8842
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
8843
- getInitJsonDataByKeyRoute:
8844
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
9095
+ schemaStore: stores.JSONSchemaStore,
9096
+ jsonStore: stores.JSONEditorStore,
8845
9097
  };
8846
9098
  })(
8847
9099
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(SelectSchema),
@@ -8913,6 +9165,10 @@
8913
9165
  );
8914
9166
  /* harmony import */ var $mixins_index__WEBPACK_IMPORTED_MODULE_8__ =
8915
9167
  __webpack_require__(/*! $mixins/index */ './src/mixins/index.js');
9168
+ /* harmony import */ var $utils_webCache__WEBPACK_IMPORTED_MODULE_9__ =
9169
+ __webpack_require__(
9170
+ /*! $utils/webCache */ './src/utils/webCache.js',
9171
+ );
8916
9172
 
8917
9173
  var Panel = antd__WEBPACK_IMPORTED_MODULE_5__.Collapse.Panel;
8918
9174
 
@@ -8927,6 +9183,7 @@
8927
9183
  // 是否显示code模式
8928
9184
  isClosed: false, // 是否为关闭状态,默认是开启状态
8929
9185
  };
9186
+ _this.collapseChange = _this.collapseChange.bind(_this);
8930
9187
  return _this;
8931
9188
  }
8932
9189
  _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_0___default()(
@@ -8950,17 +9207,42 @@
8950
9207
  );
8951
9208
  }
8952
9209
  };
9210
+ _proto.collapseChange = function collapseChange(collapseData) {
9211
+ var keyRoute = this.props.keyRoute;
9212
+ // 缓存当前折叠状态
9213
+ (0,
9214
+ $utils_webCache__WEBPACK_IMPORTED_MODULE_9__.saveJSONEditorCache)(
9215
+ keyRoute,
9216
+ collapseData,
9217
+ );
9218
+ };
8953
9219
  _proto.render = function render() {
8954
9220
  var _this$props = this.props,
8955
- indexRoute = _this$props.indexRoute,
8956
- jsonKey = _this$props.jsonKey,
8957
- nodeKey = _this$props.nodeKey,
8958
- keyRoute = _this$props.keyRoute,
8959
- pageScreen = _this$props.pageScreen,
8960
- targetJsonSchema = _this$props.targetJsonSchema,
8961
- getJSONDataByKeyRoute = _this$props.getJSONDataByKeyRoute,
8962
- keyRoute2indexRoute = _this$props.keyRoute2indexRoute,
8963
- updateFormValueData = _this$props.updateFormValueData;
9221
+ schemaStore = _this$props.schemaStore,
9222
+ jsonStore = _this$props.jsonStore;
9223
+ var _ref = schemaStore || {},
9224
+ pageScreen = _ref.pageScreen;
9225
+ // const { getJSONDataByKeyRoute } = jsonStore || {};
9226
+ var _this$props2 = this.props,
9227
+ indexRoute = _this$props2.indexRoute,
9228
+ jsonKey = _this$props2.jsonKey,
9229
+ nodeKey = _this$props2.nodeKey,
9230
+ keyRoute = _this$props2.keyRoute,
9231
+ targetJsonSchema = _this$props2.targetJsonSchema;
9232
+ // 获取前端缓存中的折叠数据
9233
+ var collapseData = ['mainConfig'];
9234
+ var collapseCacheData = (0,
9235
+ $utils_webCache__WEBPACK_IMPORTED_MODULE_9__.getJSONEditorCache)(
9236
+ keyRoute,
9237
+ );
9238
+ if (
9239
+ collapseCacheData &&
9240
+ (0, _wibetter_json_utils__WEBPACK_IMPORTED_MODULE_6__.isArray)(
9241
+ collapseCacheData,
9242
+ )
9243
+ ) {
9244
+ collapseData = collapseCacheData;
9245
+ }
8964
9246
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
8965
9247
  'div',
8966
9248
  {
@@ -8969,7 +9251,7 @@
8969
9251
  (pageScreen === 'wideScreen'
8970
9252
  ? 'wide-screen-element-warp'
8971
9253
  : 'mobile-screen-element-warp'),
8972
- key: nodeKey,
9254
+ // key={nodeKey}
8973
9255
  id: nodeKey,
8974
9256
  },
8975
9257
  /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
@@ -9019,93 +9301,13 @@
9019
9301
  /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
9020
9302
  antd__WEBPACK_IMPORTED_MODULE_5__.Collapse,
9021
9303
  {
9022
- defaultActiveKey: ['mainConfig'],
9304
+ defaultActiveKey: collapseData,
9023
9305
  expandIconPosition: 'right',
9024
9306
  bordered: false,
9025
9307
  accordion: true,
9308
+ onChange: this.collapseChange,
9026
9309
  },
9027
- targetJsonSchema.properties['mainConfig'] &&
9028
- /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
9029
- Panel,
9030
- {
9031
- header:
9032
- targetJsonSchema.properties['mainConfig'].title,
9033
- key: 'mainConfig',
9034
- },
9035
- targetJsonSchema.properties[
9036
- 'mainConfig'
9037
- ].propertyOrder.map(function (key, index) {
9038
- /** 1. 获取当前元素的路径值 */
9039
- var currentIndexRoute = indexRoute
9040
- ? indexRoute + '-0-' + index
9041
- : '0-' + index;
9042
- var currentKeyRoute = keyRoute
9043
- ? keyRoute + '-mainConfig-' + key
9044
- : 'mainConfig-' + key; // key路径值,后续用于从jsonData中提取当前元素的数值
9045
- var mainConfigJsonData =
9046
- getJSONDataByKeyRoute(
9047
- keyRoute
9048
- ? keyRoute + '-mainConfig'
9049
- : 'mainConfig',
9050
- ) || {};
9051
- /** 2. 获取当前元素的key值 */
9052
- var currentJsonKey = key;
9053
- /** 3. 获取当前元素的json结构对象 */
9054
- var currentSchemaData = (0,
9055
- mobx__WEBPACK_IMPORTED_MODULE_3__.toJS)(
9056
- targetJsonSchema.properties['mainConfig']
9057
- .properties[currentJsonKey],
9058
- );
9059
- /** 4. 判断是否是容器类型元素,如果是则禁止选中 */
9060
- var curType = currentSchemaData.type;
9061
- /** 5. 获取当前元素的id,用于做唯一标识 */
9062
- var childNodeKey =
9063
- nodeKey + '-' + curType + '-' + currentJsonKey;
9064
- var visibleOn = [
9065
- 'description',
9066
- 'CONTENTID',
9067
- 'CONTENTTYPE',
9068
- ].includes(currentJsonKey)
9069
- ? false
9070
- : true; // 是否显示当前元素
9071
-
9072
- // 补充动态配置类型相关显隐逻辑【定制逻辑】
9073
- if (
9074
- currentJsonKey === 'description' &&
9075
- mainConfigJsonData.type === 'ContentStaticConfig'
9076
- ) {
9077
- // mp后台配置 时显示 description(属性名称)
9078
- visibleOn = true;
9079
- } else if (
9080
- (currentJsonKey === 'CONTENTID' ||
9081
- currentJsonKey === 'CONTENTTYPE') &&
9082
- mainConfigJsonData.type === 'RuntimeDataSelfDefine'
9083
- ) {
9084
- visibleOn = true;
9085
- }
9086
- if (visibleOn) {
9087
- return (0,
9088
- $components_MappingRender__WEBPACK_IMPORTED_MODULE_7__[
9089
- 'default'
9090
- ])({
9091
- parentType: curType,
9092
- jsonKey: currentJsonKey,
9093
- indexRoute: currentIndexRoute,
9094
- keyRoute: currentKeyRoute,
9095
- nodeKey: childNodeKey,
9096
- targetJsonSchema: currentSchemaData,
9097
- isArrayItem: true,
9098
- getJSONDataByKeyRoute: getJSONDataByKeyRoute,
9099
- keyRoute2indexRoute: keyRoute2indexRoute,
9100
- updateFormValueData: updateFormValueData,
9101
- });
9102
- }
9103
- }),
9104
- ),
9105
9310
  targetJsonSchema.propertyOrder.map(function (key, index) {
9106
- if (key === 'mainConfig') {
9107
- return;
9108
- }
9109
9311
  /** 1. 获取当前元素的路径值 */
9110
9312
  var currentIndexRoute = indexRoute
9111
9313
  ? indexRoute + '-' + index
@@ -9146,9 +9348,8 @@
9146
9348
  nodeKey: childNodeKey,
9147
9349
  targetJsonSchema: currentSchemaData,
9148
9350
  isArrayItem: true,
9149
- getJSONDataByKeyRoute: getJSONDataByKeyRoute,
9150
- keyRoute2indexRoute: keyRoute2indexRoute,
9151
- updateFormValueData: updateFormValueData,
9351
+ schemaStore: schemaStore,
9352
+ jsonStore: jsonStore,
9152
9353
  }),
9153
9354
  );
9154
9355
  }
@@ -9176,12 +9377,8 @@
9176
9377
  /* harmony default export */ __webpack_exports__['default'] = (0,
9177
9378
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
9178
9379
  return {
9179
- pageScreen: stores.JSONSchemaStore.pageScreen,
9180
- getJSONDataByKeyRoute:
9181
- stores.JSONEditorStore.getJSONDataByKeyRoute,
9182
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
9183
- getInitJsonDataByKeyRoute:
9184
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
9380
+ schemaStore: stores.JSONSchemaStore,
9381
+ jsonStore: stores.JSONEditorStore,
9185
9382
  };
9186
9383
  })(
9187
9384
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(
@@ -9251,13 +9448,17 @@
9251
9448
  );
9252
9449
  /* harmony import */ var $mixins_index__WEBPACK_IMPORTED_MODULE_7__ =
9253
9450
  __webpack_require__(/*! $mixins/index */ './src/mixins/index.js');
9254
- /* harmony import */ var _index_scss__WEBPACK_IMPORTED_MODULE_8__ =
9451
+ /* harmony import */ var $utils_webCache__WEBPACK_IMPORTED_MODULE_8__ =
9452
+ __webpack_require__(
9453
+ /*! $utils/webCache */ './src/utils/webCache.js',
9454
+ );
9455
+ /* harmony import */ var _index_scss__WEBPACK_IMPORTED_MODULE_9__ =
9255
9456
  __webpack_require__(
9256
9457
  /*! ./index.scss */ './src/renderers/SohuEventSchema/index.scss',
9257
9458
  );
9258
- /* harmony import */ var _index_scss__WEBPACK_IMPORTED_MODULE_8___default =
9459
+ /* harmony import */ var _index_scss__WEBPACK_IMPORTED_MODULE_9___default =
9259
9460
  /*#__PURE__*/ __webpack_require__.n(
9260
- _index_scss__WEBPACK_IMPORTED_MODULE_8__,
9461
+ _index_scss__WEBPACK_IMPORTED_MODULE_9__,
9261
9462
  );
9262
9463
 
9263
9464
  var Option = antd__WEBPACK_IMPORTED_MODULE_5__.Select.Option;
@@ -9268,11 +9469,14 @@
9268
9469
  var _this;
9269
9470
  _this = _React$PureComponent.call(this, props) || this;
9270
9471
  _this.handleEventTitleChange = function (eventCode, inputEvent) {
9271
- var newTitle = inputEvent.target.value;
9272
9472
  var _this$props = _this.props,
9273
9473
  keyRoute = _this$props.keyRoute,
9274
- updateFormValueData = _this$props.updateFormValueData,
9275
- getJSONDataByKeyRoute = _this$props.getJSONDataByKeyRoute;
9474
+ jsonStore = _this$props.jsonStore;
9475
+ var _ref = jsonStore || {},
9476
+ updateFormValueData = _ref.updateFormValueData,
9477
+ getJSONDataByKeyRoute = _ref.getJSONDataByKeyRoute,
9478
+ _options = _ref.options;
9479
+ var newTitle = inputEvent.target.value;
9276
9480
  var curJsonData = getJSONDataByKeyRoute(keyRoute) || {};
9277
9481
  var globalEventMap = Object.assign(
9278
9482
  {},
@@ -9290,9 +9494,12 @@
9290
9494
  ) {
9291
9495
  var _this$props2 = _this.props,
9292
9496
  keyRoute = _this$props2.keyRoute,
9293
- updateFormValueData = _this$props2.updateFormValueData,
9294
- getJSONDataByKeyRoute = _this$props2.getJSONDataByKeyRoute;
9295
- var options = _this.props.options || {};
9497
+ jsonStore = _this$props2.jsonStore;
9498
+ var _ref2 = jsonStore || {},
9499
+ updateFormValueData = _ref2.updateFormValueData,
9500
+ getJSONDataByKeyRoute = _ref2.getJSONDataByKeyRoute,
9501
+ _options = _ref2.options;
9502
+ var options = _options || {};
9296
9503
  var curKeyRout = keyRoute + '-event';
9297
9504
  var curJsonData = getJSONDataByKeyRoute(keyRoute) || {};
9298
9505
  var curEvent = [];
@@ -9325,6 +9532,7 @@
9325
9532
  // 是否显示code模式
9326
9533
  isClosed: false, // 是否为关闭状态,默认是开启状态
9327
9534
  };
9535
+ _this.collapseChange = _this.collapseChange.bind(_this);
9328
9536
  return _this;
9329
9537
  }
9330
9538
  _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_0___default()(
@@ -9348,19 +9556,32 @@
9348
9556
  );
9349
9557
  }
9350
9558
  };
9559
+ _proto.collapseChange = function collapseChange(collapseData) {
9560
+ var keyRoute = this.props.keyRoute;
9561
+ // 缓存当前折叠状态
9562
+ (0,
9563
+ $utils_webCache__WEBPACK_IMPORTED_MODULE_8__.saveJSONEditorCache)(
9564
+ keyRoute,
9565
+ collapseData,
9566
+ );
9567
+ };
9351
9568
  _proto.render = function render() {
9352
9569
  var _this2 = this;
9353
9570
  var _this$props3 = this.props,
9354
- indexRoute = _this$props3.indexRoute,
9355
- jsonKey = _this$props3.jsonKey,
9356
- nodeKey = _this$props3.nodeKey,
9357
- keyRoute = _this$props3.keyRoute,
9358
- pageScreen = _this$props3.pageScreen,
9359
- targetJsonSchema = _this$props3.targetJsonSchema,
9360
- getJSONDataByKeyRoute = _this$props3.getJSONDataByKeyRoute,
9361
- keyRoute2indexRoute = _this$props3.keyRoute2indexRoute,
9362
- updateFormValueData = _this$props3.updateFormValueData;
9363
- var options = this.props.options || {};
9571
+ schemaStore = _this$props3.schemaStore,
9572
+ jsonStore = _this$props3.jsonStore;
9573
+ var _ref3 = schemaStore || {},
9574
+ pageScreen = _ref3.pageScreen;
9575
+ var _ref4 = jsonStore || {},
9576
+ getJSONDataByKeyRoute = _ref4.getJSONDataByKeyRoute,
9577
+ _options = _ref4.options;
9578
+ var _this$props4 = this.props,
9579
+ indexRoute = _this$props4.indexRoute,
9580
+ jsonKey = _this$props4.jsonKey,
9581
+ nodeKey = _this$props4.nodeKey,
9582
+ keyRoute = _this$props4.keyRoute,
9583
+ targetJsonSchema = _this$props4.targetJsonSchema;
9584
+ var options = options || {};
9364
9585
  var curJsonData = getJSONDataByKeyRoute(keyRoute);
9365
9586
  var globalEventMap = curJsonData.globalEventMap || {}; // 全局事件列表
9366
9587
  var curEventList = curJsonData.event || []; // 当前组件事件列表
@@ -9374,6 +9595,21 @@
9374
9595
  widgetType !== 'page' &&
9375
9596
  eventEmitConfig.length === 0 &&
9376
9597
  eventListenConfig.length === 0;
9598
+
9599
+ // 获取前端缓存中的折叠数据
9600
+ var collapseData = [];
9601
+ var collapseCacheData = (0,
9602
+ $utils_webCache__WEBPACK_IMPORTED_MODULE_8__.getJSONEditorCache)(
9603
+ keyRoute,
9604
+ );
9605
+ if (
9606
+ collapseCacheData &&
9607
+ (0, _wibetter_json_utils__WEBPACK_IMPORTED_MODULE_6__.isArray)(
9608
+ collapseCacheData,
9609
+ )
9610
+ ) {
9611
+ collapseData = collapseCacheData;
9612
+ }
9377
9613
  return /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
9378
9614
  'div',
9379
9615
  {
@@ -9388,9 +9624,10 @@
9388
9624
  /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createElement(
9389
9625
  antd__WEBPACK_IMPORTED_MODULE_5__.Collapse,
9390
9626
  {
9391
- defaultActiveKey: ['mainConfig'],
9627
+ defaultActiveKey: collapseData,
9392
9628
  expandIconPosition: 'right',
9393
9629
  bordered: false,
9630
+ onChange: this.collapseChange,
9394
9631
  // accordion
9395
9632
  },
9396
9633
  eventListenConfig &&
@@ -9640,13 +9877,8 @@
9640
9877
  /* harmony default export */ __webpack_exports__['default'] = (0,
9641
9878
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
9642
9879
  return {
9643
- pageScreen: stores.JSONSchemaStore.pageScreen,
9644
- options: stores.JSONEditorStore.options,
9645
- getJSONDataByKeyRoute:
9646
- stores.JSONEditorStore.getJSONDataByKeyRoute,
9647
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
9648
- getInitJsonDataByKeyRoute:
9649
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
9880
+ schemaStore: stores.JSONSchemaStore,
9881
+ jsonStore: stores.JSONEditorStore,
9650
9882
  };
9651
9883
  })(
9652
9884
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(
@@ -9728,10 +9960,12 @@
9728
9960
  // 这边绑定是必要的,这样 `this` 才能在回调函数中使用
9729
9961
  /** 数值变动事件处理器 */
9730
9962
  _this.handleValueChange = function (event) {
9731
- var value = event.target.value;
9732
9963
  var _this$props = _this.props,
9733
9964
  keyRoute = _this$props.keyRoute,
9734
- updateFormValueData = _this$props.updateFormValueData;
9965
+ jsonStore = _this$props.jsonStore;
9966
+ var _ref = jsonStore || {},
9967
+ updateFormValueData = _ref.updateFormValueData;
9968
+ var value = event.target.value;
9735
9969
  updateFormValueData(keyRoute, value); // 更新数值
9736
9970
  };
9737
9971
  _this.handleValueChange = _this.handleValueChange.bind(_this);
@@ -9760,12 +9994,17 @@
9760
9994
  };
9761
9995
  _proto.render = function render() {
9762
9996
  var _this$props2 = this.props,
9763
- keyRoute = _this$props2.keyRoute,
9764
- jsonKey = _this$props2.jsonKey,
9765
- nodeKey = _this$props2.nodeKey,
9766
- targetJsonSchema = _this$props2.targetJsonSchema,
9767
- pageScreen = _this$props2.pageScreen,
9768
- getJSONDataByKeyRoute = _this$props2.getJSONDataByKeyRoute;
9997
+ schemaStore = _this$props2.schemaStore,
9998
+ jsonStore = _this$props2.jsonStore;
9999
+ var _ref2 = schemaStore || {},
10000
+ pageScreen = _ref2.pageScreen;
10001
+ var _ref3 = jsonStore || {},
10002
+ getJSONDataByKeyRoute = _ref3.getJSONDataByKeyRoute;
10003
+ var _this$props3 = this.props,
10004
+ keyRoute = _this$props3.keyRoute,
10005
+ jsonKey = _this$props3.jsonKey,
10006
+ nodeKey = _this$props3.nodeKey,
10007
+ targetJsonSchema = _this$props3.targetJsonSchema;
9769
10008
  // 从jsonData中获取对应的数值
9770
10009
  var curJsonData = getJSONDataByKeyRoute(keyRoute);
9771
10010
  var readOnly = targetJsonSchema.readOnly || false; // 是否只读(默认可编辑)
@@ -9893,12 +10132,8 @@
9893
10132
  /* harmony default export */ __webpack_exports__['default'] = (0,
9894
10133
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
9895
10134
  return {
9896
- pageScreen: stores.JSONSchemaStore.pageScreen,
9897
- getJSONDataByKeyRoute:
9898
- stores.JSONEditorStore.getJSONDataByKeyRoute,
9899
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
9900
- getInitJsonDataByKeyRoute:
9901
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
10135
+ schemaStore: stores.JSONSchemaStore,
10136
+ jsonStore: stores.JSONEditorStore,
9902
10137
  };
9903
10138
  })(
9904
10139
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(
@@ -10067,7 +10302,9 @@
10067
10302
  _this.handleEditorChange = function (editorState) {
10068
10303
  var _this$props = _this.props,
10069
10304
  keyRoute = _this$props.keyRoute,
10070
- updateFormValueData = _this$props.updateFormValueData;
10305
+ jsonStore = _this$props.jsonStore;
10306
+ var _ref = jsonStore || {},
10307
+ updateFormValueData = _ref.updateFormValueData;
10071
10308
  updateFormValueData(keyRoute, editorState.toHTML()); // 更新数值
10072
10309
  };
10073
10310
  _this.state = {
@@ -10129,14 +10366,13 @@
10129
10366
  );
10130
10367
  var _proto = TextEditorSchema.prototype;
10131
10368
  _proto.componentWillMount = function componentWillMount() {
10369
+ var _ref2 = this.props.schemaStore || {},
10370
+ pageScreen = _ref2.pageScreen;
10132
10371
  // 从web缓存中获取数值
10133
10372
  $mixins_index__WEBPACK_IMPORTED_MODULE_6__.catchJsonDataByWebCache.call(
10134
10373
  this,
10135
10374
  );
10136
- if (
10137
- this.props.pageScreen &&
10138
- this.props.pageScreen === 'wideScreen'
10139
- ) {
10375
+ if (pageScreen && pageScreen === 'wideScreen') {
10140
10376
  // 大屏幕时默认展开富文本编辑器
10141
10377
  this.setState({
10142
10378
  isClosed: false,
@@ -10151,10 +10387,13 @@
10151
10387
  this,
10152
10388
  nextProps.keyRoute,
10153
10389
  );
10154
- } else if (nextProps.pageScreen !== this.props.pageScreen) {
10390
+ } else if (
10391
+ nextProps.schemaStore.pageScreen !==
10392
+ this.props.schemaStore.pageScreen
10393
+ ) {
10155
10394
  if (
10156
- nextProps.pageScreen &&
10157
- nextProps.pageScreen === 'wideScreen'
10395
+ nextProps.schemaStore.pageScreen &&
10396
+ nextProps.schemaStore.pageScreen === 'wideScreen'
10158
10397
  ) {
10159
10398
  // 大屏幕时默认展开富文本编辑器
10160
10399
  this.setState({
@@ -10166,12 +10405,17 @@
10166
10405
  _proto.render = function render() {
10167
10406
  var _this2 = this;
10168
10407
  var _this$props2 = this.props,
10169
- keyRoute = _this$props2.keyRoute,
10170
- jsonKey = _this$props2.jsonKey,
10171
- nodeKey = _this$props2.nodeKey,
10172
- targetJsonSchema = _this$props2.targetJsonSchema,
10173
- pageScreen = _this$props2.pageScreen,
10174
- getJSONDataByKeyRoute = _this$props2.getJSONDataByKeyRoute;
10408
+ schemaStore = _this$props2.schemaStore,
10409
+ jsonStore = _this$props2.jsonStore;
10410
+ var _ref3 = schemaStore || {},
10411
+ pageScreen = _ref3.pageScreen;
10412
+ var _ref4 = jsonStore || {},
10413
+ getJSONDataByKeyRoute = _ref4.getJSONDataByKeyRoute;
10414
+ var _this$props3 = this.props,
10415
+ keyRoute = _this$props3.keyRoute,
10416
+ jsonKey = _this$props3.jsonKey,
10417
+ nodeKey = _this$props3.nodeKey,
10418
+ targetJsonSchema = _this$props3.targetJsonSchema;
10175
10419
  var isClosed = this.state.isClosed;
10176
10420
  var curJsonData = getJSONDataByKeyRoute(keyRoute); // 从jsonData中获取对应的html内容
10177
10421
  var editorState =
@@ -10323,12 +10567,8 @@
10323
10567
  /* harmony default export */ __webpack_exports__['default'] = (0,
10324
10568
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
10325
10569
  return {
10326
- pageScreen: stores.JSONSchemaStore.pageScreen,
10327
- getJSONDataByKeyRoute:
10328
- stores.JSONEditorStore.getJSONDataByKeyRoute,
10329
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
10330
- getInitJsonDataByKeyRoute:
10331
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
10570
+ schemaStore: stores.JSONSchemaStore,
10571
+ jsonStore: stores.JSONEditorStore,
10332
10572
  };
10333
10573
  })(
10334
10574
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(
@@ -10410,7 +10650,9 @@
10410
10650
  _this.handleValueChange = function (event, dateString) {
10411
10651
  var _this$props = _this.props,
10412
10652
  keyRoute = _this$props.keyRoute,
10413
- updateFormValueData = _this$props.updateFormValueData;
10653
+ jsonStore = _this$props.jsonStore;
10654
+ var _ref = jsonStore || {},
10655
+ updateFormValueData = _ref.updateFormValueData;
10414
10656
  updateFormValueData(keyRoute, dateString); // 更新数值
10415
10657
  };
10416
10658
  _this.handleValueChange = _this.handleValueChange.bind(_this);
@@ -10439,12 +10681,17 @@
10439
10681
  };
10440
10682
  _proto.render = function render() {
10441
10683
  var _this$props2 = this.props,
10442
- nodeKey = _this$props2.nodeKey,
10443
- jsonKey = _this$props2.jsonKey,
10444
- keyRoute = _this$props2.keyRoute,
10445
- targetJsonSchema = _this$props2.targetJsonSchema,
10446
- pageScreen = _this$props2.pageScreen,
10447
- getJSONDataByKeyRoute = _this$props2.getJSONDataByKeyRoute;
10684
+ schemaStore = _this$props2.schemaStore,
10685
+ jsonStore = _this$props2.jsonStore;
10686
+ var _ref2 = schemaStore || {},
10687
+ pageScreen = _ref2.pageScreen;
10688
+ var _ref3 = jsonStore || {},
10689
+ getJSONDataByKeyRoute = _ref3.getJSONDataByKeyRoute;
10690
+ var _this$props3 = this.props,
10691
+ nodeKey = _this$props3.nodeKey,
10692
+ jsonKey = _this$props3.jsonKey,
10693
+ keyRoute = _this$props3.keyRoute,
10694
+ targetJsonSchema = _this$props3.targetJsonSchema;
10448
10695
  // 从jsonData中获取对应的数值
10449
10696
  var curJsonData = getJSONDataByKeyRoute(keyRoute);
10450
10697
  var defaultTime = curJsonData || targetJsonSchema.default;
@@ -10562,12 +10809,8 @@
10562
10809
  /* harmony default export */ __webpack_exports__['default'] = (0,
10563
10810
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
10564
10811
  return {
10565
- pageScreen: stores.JSONSchemaStore.pageScreen,
10566
- getJSONDataByKeyRoute:
10567
- stores.JSONEditorStore.getJSONDataByKeyRoute,
10568
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
10569
- getInitJsonDataByKeyRoute:
10570
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
10812
+ schemaStore: stores.JSONSchemaStore,
10813
+ jsonStore: stores.JSONEditorStore,
10571
10814
  };
10572
10815
  })(
10573
10816
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(
@@ -10643,11 +10886,17 @@
10643
10886
  var _proto = TreeSelectFromSchema.prototype;
10644
10887
  _proto.render = function render() {
10645
10888
  var _this$props = this.props,
10646
- pageScreen = _this$props.pageScreen,
10647
- mockData = _this$props.mockData,
10648
- dataRoute = _this$props.dataRoute,
10649
- nodeKey = _this$props.nodeKey,
10650
- onChange = _this$props.onChange;
10889
+ schemaStore = _this$props.schemaStore,
10890
+ jsonStore = _this$props.jsonStore;
10891
+ var _ref = schemaStore || {},
10892
+ pageScreen = _ref.pageScreen;
10893
+ var _ref2 = jsonStore || {},
10894
+ getJSONDataByKeyRoute = _ref2.getJSONDataByKeyRoute;
10895
+ var _this$props2 = this.props,
10896
+ mockData = _this$props2.mockData,
10897
+ dataRoute = _this$props2.dataRoute,
10898
+ nodeKey = _this$props2.nodeKey,
10899
+ onChange = _this$props2.onChange;
10651
10900
  var treeData = [];
10652
10901
  if (mockData && JSON.stringify(mockData) !== '{}') {
10653
10902
  var mockObj = mockData;
@@ -10717,7 +10966,6 @@
10717
10966
  return TreeSelectFromSchema;
10718
10967
  })(react__WEBPACK_IMPORTED_MODULE_1__.PureComponent);
10719
10968
  TreeSelectFromSchema.propTypes = {
10720
- pageScreen: prop_types__WEBPACK_IMPORTED_MODULE_3___default().any,
10721
10969
  mockData: prop_types__WEBPACK_IMPORTED_MODULE_3___default().any,
10722
10970
  // 接口mock数据
10723
10971
  dataRoute: prop_types__WEBPACK_IMPORTED_MODULE_3___default().any,
@@ -10729,7 +10977,7 @@
10729
10977
  /* harmony default export */ __webpack_exports__['default'] = (0,
10730
10978
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
10731
10979
  return {
10732
- pageScreen: stores.JSONSchemaStore.pageScreen,
10980
+ schemaStore: stores.JSONSchemaStore,
10733
10981
  };
10734
10982
  })(
10735
10983
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(
@@ -10807,10 +11055,12 @@
10807
11055
  // 这边绑定是必要的,这样 `this` 才能在回调函数中使用
10808
11056
  /** 数值变动事件处理器 */
10809
11057
  _this.handleValueChange = function (event) {
10810
- var value = event.target.value;
10811
11058
  var _this$props = _this.props,
10812
11059
  keyRoute = _this$props.keyRoute,
10813
- updateFormValueData = _this$props.updateFormValueData;
11060
+ jsonStore = _this$props.jsonStore;
11061
+ var _ref = jsonStore || {},
11062
+ updateFormValueData = _ref.updateFormValueData;
11063
+ var value = event.target.value;
10814
11064
  updateFormValueData(keyRoute, value); // 更新数值
10815
11065
  };
10816
11066
  _this.handleValueChange = _this.handleValueChange.bind(_this);
@@ -10839,12 +11089,17 @@
10839
11089
  };
10840
11090
  _proto.render = function render() {
10841
11091
  var _this$props2 = this.props,
10842
- keyRoute = _this$props2.keyRoute,
10843
- jsonKey = _this$props2.jsonKey,
10844
- nodeKey = _this$props2.nodeKey,
10845
- targetJsonSchema = _this$props2.targetJsonSchema,
10846
- pageScreen = _this$props2.pageScreen,
10847
- getJSONDataByKeyRoute = _this$props2.getJSONDataByKeyRoute;
11092
+ schemaStore = _this$props2.schemaStore,
11093
+ jsonStore = _this$props2.jsonStore;
11094
+ var _ref2 = schemaStore || {},
11095
+ pageScreen = _ref2.pageScreen;
11096
+ var _ref3 = jsonStore || {},
11097
+ getJSONDataByKeyRoute = _ref3.getJSONDataByKeyRoute;
11098
+ var _this$props3 = this.props,
11099
+ keyRoute = _this$props3.keyRoute,
11100
+ jsonKey = _this$props3.jsonKey,
11101
+ nodeKey = _this$props3.nodeKey,
11102
+ targetJsonSchema = _this$props3.targetJsonSchema;
10848
11103
  // 从jsonData中获取对应的数值
10849
11104
  var curJsonData = getJSONDataByKeyRoute(keyRoute);
10850
11105
  var readOnly = targetJsonSchema.readOnly || false; // 是否只读(默认可编辑)
@@ -10971,12 +11226,8 @@
10971
11226
  /* harmony default export */ __webpack_exports__['default'] = (0,
10972
11227
  mobx_react__WEBPACK_IMPORTED_MODULE_2__.inject)(function (stores) {
10973
11228
  return {
10974
- pageScreen: stores.JSONSchemaStore.pageScreen,
10975
- getJSONDataByKeyRoute:
10976
- stores.JSONEditorStore.getJSONDataByKeyRoute,
10977
- updateFormValueData: stores.JSONEditorStore.updateFormValueData,
10978
- getInitJsonDataByKeyRoute:
10979
- stores.JSONEditorStore.getInitJsonDataByKeyRoute,
11229
+ schemaStore: stores.JSONSchemaStore,
11230
+ jsonStore: stores.JSONEditorStore,
10980
11231
  };
10981
11232
  })(
10982
11233
  (0, mobx_react__WEBPACK_IMPORTED_MODULE_2__.observer)(
@@ -11337,7 +11588,6 @@
11337
11588
  newVal,
11338
11589
  ignoreChange,
11339
11590
  ) {
11340
- var _this = this;
11341
11591
  if (keyRoute !== '') {
11342
11592
  // 1. 获取父级key路径和最近的有一个key
11343
11593
  var parentKeyRoute_CurKey = (0,
@@ -11358,14 +11608,7 @@
11358
11608
  // 当keyRoute为空时直接修改当前schemaData
11359
11609
  this.jsonData = newVal;
11360
11610
  }
11361
- if (
11362
- this.state.rootJSONStore.JSONSchemaStore &&
11363
- this.state.rootJSONStore.JSONSchemaStore.jsonSchema
11364
- ) {
11365
- // 获取当前schema的条件字段
11366
- var curJsonSchema =
11367
- this.state.rootJSONStore.JSONSchemaStore.jsonSchema;
11368
- var conditionProps = curJsonSchema.conditionProps;
11611
+ if (this.state.rootJSONStore.JSONSchemaStore) {
11369
11612
  // 备注:数组类型通过keyRoute获取schema对象会有异常
11370
11613
  var curElemSchema =
11371
11614
  this.state.rootJSONStore.JSONSchemaStore.getSchemaByKeyRoute(
@@ -11374,15 +11617,7 @@
11374
11617
  if (curElemSchema && curElemSchema.isConditionProp) {
11375
11618
  // 判断条件字段的快捷通道:如果是条件字段则更新LastInitTime
11376
11619
  this.updateLastTime();
11377
- } else if (conditionProps) {
11378
- // 判断当前字段是否为条件字段
11379
- Object.keys(conditionProps).map(function (propKey) {
11380
- var conditionItem = conditionProps[propKey];
11381
- if (conditionItem.keyRoute === keyRoute) {
11382
- // 更新LastInitTime
11383
- _this.updateLastTime();
11384
- }
11385
- });
11620
+ // this.triggerChangeAction(); // 用于主动触发组件更新
11386
11621
  }
11387
11622
  }
11388
11623
  if (!ignoreChange) {
@@ -12055,12 +12290,23 @@
12055
12290
  }
12056
12291
  var curJsonData =
12057
12292
  this.state.rootJSONStore.JSONEditorStore.jsonData;
12293
+ var newJsonData = {};
12058
12294
  /** 根据jsonSchema生成对应的最新jsonData */
12059
- var newJsonData = (0,
12060
- _wibetter_json_utils__WEBPACK_IMPORTED_MODULE_5__.schema2json)(
12061
- this.jsonSchema,
12062
- curJsonData,
12063
- );
12295
+ if (this.jsonSchema.reset) {
12296
+ // schema 变动不保留旧版 jsonData 数据
12297
+ newJsonData = (0,
12298
+ _wibetter_json_utils__WEBPACK_IMPORTED_MODULE_5__.schema2json)(
12299
+ this.jsonSchema,
12300
+ {},
12301
+ );
12302
+ } else {
12303
+ // 默认保留旧版jsonData数据
12304
+ newJsonData = (0,
12305
+ _wibetter_json_utils__WEBPACK_IMPORTED_MODULE_5__.schema2json)(
12306
+ this.jsonSchema,
12307
+ curJsonData,
12308
+ );
12309
+ }
12064
12310
  /** 更新当前的jsonData */
12065
12311
  this.state.rootJSONStore.JSONEditorStore.jsonData =
12066
12312
  newJsonData;
@@ -12355,15 +12601,35 @@
12355
12601
  },
12356
12602
  /* harmony export */
12357
12603
  });
12604
+ /* harmony import */ var _wibetter_json_utils__WEBPACK_IMPORTED_MODULE_0__ =
12605
+ __webpack_require__(
12606
+ /*! @wibetter/json-utils */ '@wibetter/json-utils',
12607
+ );
12608
+ /* harmony import */ var _wibetter_json_utils__WEBPACK_IMPORTED_MODULE_0___default =
12609
+ /*#__PURE__*/ __webpack_require__.n(
12610
+ _wibetter_json_utils__WEBPACK_IMPORTED_MODULE_0__,
12611
+ );
12612
+ /* harmony import */ var _webCache_js__WEBPACK_IMPORTED_MODULE_1__ =
12613
+ __webpack_require__(/*! ./webCache.js */ './src/utils/webCache.js');
12614
+
12358
12615
  /** js对象数据深拷贝,避免数据联动 */
12359
12616
  function objClone(targetObj) {
12360
- var newObj = JSON.stringify(targetObj);
12361
- return JSON.parse(newObj);
12617
+ // const newObj = JSON.stringify(targetObj);
12618
+ // return JSON.parse(newObj);
12619
+ return (0,
12620
+ _wibetter_json_utils__WEBPACK_IMPORTED_MODULE_0__.objClone)(
12621
+ targetObj,
12622
+ );
12362
12623
  }
12363
12624
 
12364
12625
  /** 对比两个json数据是否相等 */
12365
12626
  function isEqual(targetObj, nextTargetObj) {
12366
- return JSON.stringify(targetObj) === JSON.stringify(nextTargetObj);
12627
+ // return JSON.stringify(targetObj) === JSON.stringify(nextTargetObj);
12628
+ return (0,
12629
+ _wibetter_json_utils__WEBPACK_IMPORTED_MODULE_0__.isEqual)(
12630
+ targetObj,
12631
+ nextTargetObj,
12632
+ );
12367
12633
  }
12368
12634
 
12369
12635
  /** 判断当前属性是否存在
@@ -12497,29 +12763,35 @@
12497
12763
 
12498
12764
  /**
12499
12765
  * 将数据缓存到sessionStorage中
12500
- * */
12501
- function saveWebCacheData(cacheKey, targetSourceIndex) {
12502
- if (window.sessionStorage) {
12503
- window.sessionStorage.setItem(cacheKey, targetSourceIndex);
12504
- }
12766
+ */
12767
+ function saveWebCacheData(valueKey, value) {
12768
+ (0, _webCache_js__WEBPACK_IMPORTED_MODULE_1__.saveJSONEditorCache)(
12769
+ valueKey,
12770
+ value,
12771
+ 'json-editor-formData',
12772
+ );
12505
12773
  }
12506
12774
 
12507
12775
  /**
12508
12776
  * 从sessionStorage中读取此前缓存的数据
12509
- * */
12510
- function getWebCacheData(cacheKey) {
12511
- if (window.sessionStorage) {
12512
- return window.sessionStorage.getItem(cacheKey);
12513
- }
12777
+ */
12778
+ function getWebCacheData(valueKey) {
12779
+ return (0,
12780
+ _webCache_js__WEBPACK_IMPORTED_MODULE_1__.getJSONEditorCache)(
12781
+ valueKey,
12782
+ 'json-editor-formData',
12783
+ );
12514
12784
  }
12515
12785
 
12516
12786
  /**
12517
12787
  * 从sessionStorage中删除此前缓存的数据
12518
- * */
12519
- function deleteWebCacheData(cacheKey) {
12520
- if (window.sessionStorage) {
12521
- return window.sessionStorage.removeItem(cacheKey);
12522
- }
12788
+ */
12789
+ function deleteWebCacheData(valueKey) {
12790
+ (0,
12791
+ _webCache_js__WEBPACK_IMPORTED_MODULE_1__.deleteJSONEditorCache)(
12792
+ valueKey,
12793
+ 'json-editor-formData',
12794
+ );
12523
12795
  }
12524
12796
 
12525
12797
  /***/
@@ -12710,6 +12982,95 @@
12710
12982
  /***/
12711
12983
  },
12712
12984
 
12985
+ /***/ './src/utils/webCache.js':
12986
+ /*!*******************************!*\
12987
+ !*** ./src/utils/webCache.js ***!
12988
+ \*******************************/
12989
+ /***/ function (
12990
+ __unused_webpack_module,
12991
+ __webpack_exports__,
12992
+ __webpack_require__,
12993
+ ) {
12994
+ 'use strict';
12995
+ __webpack_require__.r(__webpack_exports__);
12996
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
12997
+ /* harmony export */ deleteJSONEditorCache: function () {
12998
+ return /* binding */ deleteJSONEditorCache;
12999
+ },
13000
+ /* harmony export */ getJSONEditorCache: function () {
13001
+ return /* binding */ getJSONEditorCache;
13002
+ },
13003
+ /* harmony export */ saveJSONEditorCache: function () {
13004
+ return /* binding */ saveJSONEditorCache;
13005
+ },
13006
+ /* harmony export */
13007
+ });
13008
+ /**
13009
+ * 将数据缓存到sessionStorage中
13010
+ * */
13011
+ function saveJSONEditorCache(key, value, cacheMark) {
13012
+ if (cacheMark === void 0) {
13013
+ cacheMark = 'json-editor-cache';
13014
+ }
13015
+ if (window.sessionStorage) {
13016
+ var cacheData = {};
13017
+ var cacheDataStr = window.sessionStorage.getItem(cacheMark);
13018
+ if (cacheDataStr) {
13019
+ cacheData = JSON.parse(cacheDataStr);
13020
+ }
13021
+ if (key) {
13022
+ cacheData[key] = value;
13023
+ }
13024
+ window.sessionStorage.setItem(
13025
+ cacheMark,
13026
+ JSON.stringify(cacheData),
13027
+ );
13028
+ }
13029
+ }
13030
+
13031
+ /**
13032
+ * 从sessionStorage中读取此前缓存的数据
13033
+ * */
13034
+ function getJSONEditorCache(valueKey, cacheMark) {
13035
+ if (cacheMark === void 0) {
13036
+ cacheMark = 'json-editor-cache';
13037
+ }
13038
+ var curKeyValue;
13039
+ if (window.sessionStorage) {
13040
+ var cacheData = {};
13041
+ var cacheDataStr = window.sessionStorage.getItem(cacheMark);
13042
+ if (cacheDataStr) {
13043
+ cacheData = JSON.parse(cacheDataStr);
13044
+ }
13045
+ if (valueKey) {
13046
+ curKeyValue = cacheData[valueKey];
13047
+ }
13048
+ }
13049
+ return curKeyValue;
13050
+ }
13051
+
13052
+ /**
13053
+ * 从sessionStorage中删除此前缓存的数据
13054
+ * */
13055
+ function deleteJSONEditorCache(valueKey, cacheMark) {
13056
+ if (cacheMark === void 0) {
13057
+ cacheMark = 'json-editor-cache';
13058
+ }
13059
+ if (window.sessionStorage) {
13060
+ var cacheData = {};
13061
+ var cacheDataStr = window.sessionStorage.getItem(cacheMark);
13062
+ if (cacheDataStr) {
13063
+ cacheData = JSON.parse(cacheDataStr);
13064
+ }
13065
+ if (valueKey) {
13066
+ cacheData[valueKey] = undefined;
13067
+ }
13068
+ }
13069
+ }
13070
+
13071
+ /***/
13072
+ },
13073
+
12713
13074
  /***/ '../../node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-11.use[1]!../../node_modules/css-loader/dist/cjs.js??clonedRuleSet-11.use[2]!../../node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-11.use[3]!../../node_modules/sass-loader/dist/cjs.js??clonedRuleSet-11.use[4]!../../node_modules/sass-resources-loader/lib/loader.js??clonedRuleSet-11.use[5]!./src/components/JSONDataEditor/index.scss':
12714
13075
  /*!***********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
12715
13076
  !*** ../../node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-11.use[1]!../../node_modules/css-loader/dist/cjs.js??clonedRuleSet-11.use[2]!../../node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-11.use[3]!../../node_modules/sass-loader/dist/cjs.js??clonedRuleSet-11.use[4]!../../node_modules/sass-resources-loader/lib/loader.js??clonedRuleSet-11.use[5]!./src/components/JSONDataEditor/index.scss ***!