@signalplus/params-about 0.1.3 → 0.1.4

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/es/index.js CHANGED
@@ -1,18 +1,21 @@
1
1
  /**
2
2
  * Bundle of @signalplus/params-about
3
- * Generated: 2022-04-07
4
- * Version: 0.1.3
3
+ * Generated: 2022-04-08
4
+ * Version: 0.1.4
5
5
  * License: MIT
6
6
  * Author: 2631541504@qq.com
7
7
  */
8
8
 
9
- import React, { PureComponent, useMemo } from 'react';
9
+ import React$1, { PureComponent, useMemo, useState, useEffect } from 'react';
10
10
  import classNames from 'classnames';
11
11
  import dayjs from 'dayjs';
12
12
  import Big from 'big.js';
13
13
  import { PlusOutlined, DeleteOutlined, CloseOutlined, CheckOutlined, DownOutlined } from '@ant-design/icons';
14
- import { Popover, Cascader, Input, Select, Form, Button, Modal } from 'antd';
14
+ import { Popover, Cascader, Input, Select, Form, Button, message, Modal } from 'antd';
15
15
  import ReactGlobalComp from 'react-global-comp';
16
+ import { isEqual } from 'lodash-es';
17
+ import ReactFileInput from '@livelybone/react-file-input';
18
+ import { useRequest } from 'ahooks';
16
19
 
17
20
  function _defineProperty(obj, key, value) {
18
21
  if (key in obj) {
@@ -460,41 +463,41 @@ var Bool = /*#__PURE__*/function (_PureComponent) {
460
463
  value: false
461
464
  }]);
462
465
 
463
- _defineProperty(_assertThisInitialized(_this), "RadioChecked", /*#__PURE__*/React.createElement("svg", {
466
+ _defineProperty(_assertThisInitialized(_this), "RadioChecked", /*#__PURE__*/React$1.createElement("svg", {
464
467
  width: "16",
465
468
  height: "17",
466
469
  viewBox: "0 0 16 17",
467
470
  fill: "none",
468
471
  xmlns: "http://www.w3.org/2000/svg"
469
- }, /*#__PURE__*/React.createElement("g", {
472
+ }, /*#__PURE__*/React$1.createElement("g", {
470
473
  clipPath: "url(#clip0_0_7934)"
471
- }, /*#__PURE__*/React.createElement("circle", {
474
+ }, /*#__PURE__*/React$1.createElement("circle", {
472
475
  cx: "8",
473
476
  cy: "8.5",
474
477
  r: "7.5",
475
478
  fill: "none",
476
479
  stroke: "currentColor"
477
- }), /*#__PURE__*/React.createElement("circle", {
480
+ }), /*#__PURE__*/React$1.createElement("circle", {
478
481
  cx: "8",
479
482
  cy: "8.5",
480
483
  r: "4",
481
484
  fill: "currentColor"
482
- })), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
485
+ })), /*#__PURE__*/React$1.createElement("defs", null, /*#__PURE__*/React$1.createElement("clipPath", {
483
486
  id: "clip0_0_7934"
484
- }, /*#__PURE__*/React.createElement("rect", {
487
+ }, /*#__PURE__*/React$1.createElement("rect", {
485
488
  width: "16",
486
489
  height: "16",
487
490
  fill: "white",
488
491
  transform: "translate(0 0.5)"
489
492
  })))));
490
493
 
491
- _defineProperty(_assertThisInitialized(_this), "RadioUnchecked", /*#__PURE__*/React.createElement("svg", {
494
+ _defineProperty(_assertThisInitialized(_this), "RadioUnchecked", /*#__PURE__*/React$1.createElement("svg", {
492
495
  width: "16",
493
496
  height: "17",
494
497
  viewBox: "0 0 16 17",
495
498
  fill: "none",
496
499
  xmlns: "http://www.w3.org/2000/svg"
497
- }, /*#__PURE__*/React.createElement("circle", {
500
+ }, /*#__PURE__*/React$1.createElement("circle", {
498
501
  cx: "8",
499
502
  cy: "8.5",
500
503
  r: "7.5",
@@ -517,16 +520,16 @@ var Bool = /*#__PURE__*/function (_PureComponent) {
517
520
  value: function render() {
518
521
  var _this2 = this;
519
522
 
520
- return /*#__PURE__*/React.createElement("div", {
523
+ return /*#__PURE__*/React$1.createElement("div", {
521
524
  className: classNames('param-bool', {
522
525
  readonly: this.props.readonly
523
526
  }, this.props.className),
524
527
  style: this.props.style
525
- }, this.props.readonly ? /*#__PURE__*/React.createElement("span", {
528
+ }, this.props.readonly ? /*#__PURE__*/React$1.createElement("span", {
526
529
  className: "param-bool-val"
527
530
  }, !isNullLike(this.props.value) ? String(this.props.value).toUpperCase() : '-') : this.options.map(function (it) {
528
531
  var active = it.value === _this2.props.value;
529
- return /*#__PURE__*/React.createElement("div", {
532
+ return /*#__PURE__*/React$1.createElement("div", {
530
533
  key: String(it.value),
531
534
  className: classNames('param-bool-option', {
532
535
  active: active
@@ -613,21 +616,21 @@ var Num = /*#__PURE__*/function (_PureComponent) {
613
616
  value: function render() {
614
617
  var _this$state$tempValue;
615
618
 
616
- return /*#__PURE__*/React.createElement("div", {
619
+ return /*#__PURE__*/React$1.createElement("div", {
617
620
  className: classNames('param-number', {
618
621
  readonly: this.props.readonly
619
622
  }, this.props.className),
620
623
  style: this.props.style
621
- }, this.props.readonly ? /*#__PURE__*/React.createElement("span", {
624
+ }, this.props.readonly ? /*#__PURE__*/React$1.createElement("span", {
622
625
  className: "param-number-val"
623
- }, (_this$state$tempValue = this.state.tempValue) !== null && _this$state$tempValue !== void 0 ? _this$state$tempValue : '-') : /*#__PURE__*/React.createElement("input", {
626
+ }, (_this$state$tempValue = this.state.tempValue) !== null && _this$state$tempValue !== void 0 ? _this$state$tempValue : '-') : /*#__PURE__*/React$1.createElement("input", {
624
627
  className: "param-number-val",
625
628
  type: "text",
626
629
  placeholder: this.props.placeholder || 'Value',
627
630
  value: this.state.tempValue || '',
628
631
  onChange: this.onChange,
629
632
  onBlur: this.props.onBlur
630
- }), this.props.isPercentage && /*#__PURE__*/React.createElement("span", {
633
+ }), this.props.isPercentage && /*#__PURE__*/React$1.createElement("span", {
631
634
  className: "param-number-suffix"
632
635
  }, "%"));
633
636
  }
@@ -680,25 +683,25 @@ var NumRange = /*#__PURE__*/function (_PureComponent) {
680
683
  value: function render() {
681
684
  var _this$props$value, _this$props$value2;
682
685
 
683
- return /*#__PURE__*/React.createElement("div", {
686
+ return /*#__PURE__*/React$1.createElement("div", {
684
687
  className: classNames('param-number-range', {
685
688
  readonly: this.props.readonly
686
689
  }, this.props.className),
687
690
  style: this.props.style
688
- }, /*#__PURE__*/React.createElement("span", {
691
+ }, /*#__PURE__*/React$1.createElement("span", {
689
692
  className: "param-number-range-prefix"
690
- }, "Min"), /*#__PURE__*/React.createElement(Num, {
693
+ }, "Min"), /*#__PURE__*/React$1.createElement(Num, {
691
694
  placeholder: 'Min',
692
695
  value: (_this$props$value = this.props.value) === null || _this$props$value === void 0 ? void 0 : _this$props$value.min,
693
696
  onChange: this.onChange.bind(null, 'min'),
694
697
  isPercentage: this.props.isPercentage,
695
698
  readonly: this.props.readonly,
696
699
  onBlur: this.props.onBlur
697
- }), /*#__PURE__*/React.createElement("span", {
700
+ }), /*#__PURE__*/React$1.createElement("span", {
698
701
  className: "param-number-range-sep"
699
- }, this.props.readonly ? ',' : '-'), /*#__PURE__*/React.createElement("span", {
702
+ }, this.props.readonly ? ',' : '-'), /*#__PURE__*/React$1.createElement("span", {
700
703
  className: "param-number-range-prefix"
701
- }, "Max"), /*#__PURE__*/React.createElement(Num, {
704
+ }, "Max"), /*#__PURE__*/React$1.createElement(Num, {
702
705
  placeholder: 'Max',
703
706
  value: (_this$props$value2 = this.props.value) === null || _this$props$value2 === void 0 ? void 0 : _this$props$value2.max,
704
707
  onChange: this.onChange.bind(null, 'max'),
@@ -754,7 +757,7 @@ var TextArray = /*#__PURE__*/function (_PureComponent) {
754
757
  var value = _toConsumableArray(_this.value);
755
758
 
756
759
  value[i] = val;
757
- (_this$props$onChange = (_this$props = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props, value);
760
+ (_this$props$onChange = (_this$props = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props, value.length === 1 && !value[0] ? undefined : value);
758
761
  });
759
762
 
760
763
  _defineProperty(_assertThisInitialized(_this), "onAdd", function (i) {
@@ -772,7 +775,7 @@ var TextArray = /*#__PURE__*/function (_PureComponent) {
772
775
  var value = _toConsumableArray(_this.value);
773
776
 
774
777
  value.splice(i, 1);
775
- (_this$props$onChange3 = (_this$props3 = _this.props).onChange) === null || _this$props$onChange3 === void 0 ? void 0 : _this$props$onChange3.call(_this$props3, value);
778
+ (_this$props$onChange3 = (_this$props3 = _this.props).onChange) === null || _this$props$onChange3 === void 0 ? void 0 : _this$props$onChange3.call(_this$props3, value.length ? value : undefined);
776
779
  });
777
780
 
778
781
  return _this;
@@ -785,29 +788,29 @@ var TextArray = /*#__PURE__*/function (_PureComponent) {
785
788
 
786
789
  this.value = this.props.value || [];
787
790
  if (!this.value.length) this.value.push('');
788
- return /*#__PURE__*/React.createElement("div", {
791
+ return /*#__PURE__*/React$1.createElement("div", {
789
792
  className: classNames('param-text-array', {
790
793
  readonly: this.props.readonly
791
794
  }, this.props.className),
792
795
  style: this.props.style
793
- }, this.props.readonly ? /*#__PURE__*/React.createElement("span", {
796
+ }, this.props.readonly ? /*#__PURE__*/React$1.createElement("span", {
794
797
  className: "param-text-array-val"
795
798
  }, this.value.filter(Boolean).join(', ') || '-') : this.value.map(function (it, i) {
796
- return /*#__PURE__*/React.createElement("div", {
799
+ return /*#__PURE__*/React$1.createElement("div", {
797
800
  className: "param-arr-item",
798
801
  key: i
799
- }, /*#__PURE__*/React.createElement("input", {
802
+ }, /*#__PURE__*/React$1.createElement("input", {
800
803
  type: "text",
801
804
  placeholder: "Phone",
802
805
  value: it,
803
806
  onChange: _this2.onChange.bind(null, i),
804
807
  onBlur: _this2.props.onBlur
805
- }), /*#__PURE__*/React.createElement("div", {
808
+ }), /*#__PURE__*/React$1.createElement("div", {
806
809
  className: "param-arr-ops"
807
- }, /*#__PURE__*/React.createElement(PlusOutlined, {
810
+ }, /*#__PURE__*/React$1.createElement(PlusOutlined, {
808
811
  className: "param-arr-ops-add",
809
812
  onClick: _this2.onAdd.bind(null, i)
810
- }), /*#__PURE__*/React.createElement(DeleteOutlined, {
813
+ }), /*#__PURE__*/React$1.createElement(DeleteOutlined, {
811
814
  className: "param-arr-ops-del",
812
815
  onClick: _this2.onDel.bind(null, i)
813
816
  })));
@@ -877,12 +880,12 @@ var Expiries = /*#__PURE__*/function (_PureComponent) {
877
880
  });
878
881
 
879
882
  if (this.props.readonly) {
880
- return /*#__PURE__*/React.createElement("span", {
883
+ return /*#__PURE__*/React$1.createElement("span", {
881
884
  className: "param-expiries-val"
882
885
  }, (value === null || value === void 0 ? void 0 : value.join(', ')) || '-');
883
886
  }
884
887
 
885
- var placeholder = /*#__PURE__*/React.createElement("span", {
888
+ var placeholder = /*#__PURE__*/React$1.createElement("span", {
886
889
  className: "param-expiries-placeholder"
887
890
  }, "Choose an expiry");
888
891
 
@@ -891,20 +894,20 @@ var Expiries = /*#__PURE__*/function (_PureComponent) {
891
894
 
892
895
  var _val = (_this$props$value2 = this.props.value) === null || _this$props$value2 === void 0 ? void 0 : _this$props$value2[0];
893
896
 
894
- return !_val || isExpired(_val) ? placeholder : /*#__PURE__*/React.createElement("span", {
897
+ return !_val || isExpired(_val) ? placeholder : /*#__PURE__*/React$1.createElement("span", {
895
898
  className: "param-expiries-val"
896
899
  }, _val);
897
900
  }
898
901
 
899
902
  if (!(value === null || value === void 0 ? void 0 : value.length)) return placeholder;
900
903
  return value.map(function (it) {
901
- return /*#__PURE__*/React.createElement("span", {
904
+ return /*#__PURE__*/React$1.createElement("span", {
902
905
  className: "param-expiries-multi-val",
903
906
  key: it,
904
907
  onClick: function onClick(e) {
905
908
  return e.stopPropagation();
906
909
  }
907
- }, it, /*#__PURE__*/React.createElement(CloseOutlined, {
910
+ }, it, /*#__PURE__*/React$1.createElement(CloseOutlined, {
908
911
  onClick: _this2.onChange.bind(null, it)
909
912
  }));
910
913
  });
@@ -915,7 +918,7 @@ var Expiries = /*#__PURE__*/function (_PureComponent) {
915
918
  var _this$props$options,
916
919
  _this3 = this;
917
920
 
918
- return /*#__PURE__*/React.createElement(Popover, {
921
+ return /*#__PURE__*/React$1.createElement(Popover, {
919
922
  overlayClassName: "param-expiries-popover",
920
923
  trigger: 'click',
921
924
  placement: 'bottomLeft',
@@ -926,22 +929,22 @@ var Expiries = /*#__PURE__*/function (_PureComponent) {
926
929
 
927
930
  var checked = (_this3$props$value = _this3.props.value) === null || _this3$props$value === void 0 ? void 0 : _this3$props$value.includes(it);
928
931
  var disabled = (_this3$props$calcDisa = (_this3$props = _this3.props).calcDisabled) === null || _this3$props$calcDisa === void 0 ? void 0 : _this3$props$calcDisa.call(_this3$props, it);
929
- return /*#__PURE__*/React.createElement("div", {
932
+ return /*#__PURE__*/React$1.createElement("div", {
930
933
  className: classNames('param-expiries-option', {
931
934
  'param-expiries-option-checked': checked,
932
935
  'param-expiries-option-disabled': disabled
933
936
  }),
934
937
  key: it,
935
938
  onClick: disabled ? undefined : (_this3$onChange = _this3.onChange) === null || _this3$onChange === void 0 ? void 0 : _this3$onChange.bind(null, it)
936
- }, it, checked && /*#__PURE__*/React.createElement(CheckOutlined, null));
939
+ }, it, checked && /*#__PURE__*/React$1.createElement(CheckOutlined, null));
937
940
  })
938
- }, /*#__PURE__*/React.createElement("div", {
941
+ }, /*#__PURE__*/React$1.createElement("div", {
939
942
  className: classNames('param-expiries', {
940
943
  readonly: this.props.readonly,
941
944
  multiple: this.props.multiple !== false
942
945
  }, this.props.className),
943
946
  style: this.props.style
944
- }, this.renderValue(), !this.props.readonly && this.props.options && /*#__PURE__*/React.createElement(DownOutlined, {
947
+ }, this.renderValue(), !this.props.readonly && this.props.options && /*#__PURE__*/React$1.createElement(DownOutlined, {
945
948
  className: "param-expiries-arrow"
946
949
  })));
947
950
  }
@@ -977,7 +980,7 @@ var ExpiriesLimit = /*#__PURE__*/function (_PureComponent) {
977
980
  expiry: ''
978
981
  };
979
982
  if (key) value[i][key] = val;else value[i] = _objectSpread2(_objectSpread2({}, value[i]), val);
980
- (_this$props$onChange = (_this$props = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props, value);
983
+ (_this$props$onChange = (_this$props = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props, value.length === 1 && !value[0].expiry && !value[0].minAumPercentage && !value[0].maxAumPercentage && !value[0].minAbs && !value[0].maxAbs ? undefined : value);
981
984
  });
982
985
 
983
986
  _defineProperty(_assertThisInitialized(_this), "onAdd", function (i) {
@@ -998,7 +1001,7 @@ var ExpiriesLimit = /*#__PURE__*/function (_PureComponent) {
998
1001
  var value = _toConsumableArray(_this.value);
999
1002
 
1000
1003
  value.splice(i, 1);
1001
- (_this$props$onChange3 = (_this$props4 = _this.props).onChange) === null || _this$props$onChange3 === void 0 ? void 0 : _this$props$onChange3.call(_this$props4, value);
1004
+ (_this$props$onChange3 = (_this$props4 = _this.props).onChange) === null || _this$props$onChange3 === void 0 ? void 0 : _this$props$onChange3.call(_this$props4, value.length ? value : undefined);
1002
1005
  (_this$props$onBlur2 = (_this$props5 = _this.props).onBlur) === null || _this$props$onBlur2 === void 0 ? void 0 : _this$props$onBlur2.call(_this$props5);
1003
1006
  });
1004
1007
 
@@ -1018,7 +1021,7 @@ var ExpiriesLimit = /*#__PURE__*/function (_PureComponent) {
1018
1021
  if (!this.value.length) this.value.push({
1019
1022
  expiry: ''
1020
1023
  });
1021
- return /*#__PURE__*/React.createElement("div", {
1024
+ return /*#__PURE__*/React$1.createElement("div", {
1022
1025
  className: classNames('param-expiries-limit', {
1023
1026
  readonly: this.props.readonly
1024
1027
  }, this.props.className),
@@ -1026,30 +1029,30 @@ var ExpiriesLimit = /*#__PURE__*/function (_PureComponent) {
1026
1029
  }, this.props.readonly ? ((_this$props$value2 = this.props.value) === null || _this$props$value2 === void 0 ? void 0 : _this$props$value2.length) ? this.value.filter(function (it) {
1027
1030
  return it.expiry;
1028
1031
  }).map(function (it, i) {
1029
- return /*#__PURE__*/React.createElement("span", {
1032
+ return /*#__PURE__*/React$1.createElement("span", {
1030
1033
  className: "param-expiries-limit-val",
1031
1034
  key: i
1032
- }, it.expiry, /*#__PURE__*/React.createElement("span", {
1035
+ }, it.expiry, /*#__PURE__*/React$1.createElement("span", {
1033
1036
  className: "param-expiries-limit-val-sep"
1034
- }, "/"), it.minAumPercentage && it.maxAumPercentage ? "(".concat(NumCvt.show(it.minAumPercentage, true), "%, ").concat(NumCvt.show(it.maxAumPercentage, true), "%)") : '-', /*#__PURE__*/React.createElement("span", {
1037
+ }, "/"), it.minAumPercentage && it.maxAumPercentage ? "(".concat(NumCvt.show(it.minAumPercentage, true), "%, ").concat(NumCvt.show(it.maxAumPercentage, true), "%)") : '-', /*#__PURE__*/React$1.createElement("span", {
1035
1038
  className: "param-expiries-limit-val-sep"
1036
1039
  }, "/"), it.minAbs && it.maxAbs ? "(".concat(it.minAbs, ", ").concat(it.maxAbs, ")") : '-');
1037
- }) : '-' : /*#__PURE__*/React.createElement("div", {
1040
+ }) : '-' : /*#__PURE__*/React$1.createElement("div", {
1038
1041
  className: "param-expiries-limit-inputs"
1039
- }, /*#__PURE__*/React.createElement("div", {
1042
+ }, /*#__PURE__*/React$1.createElement("div", {
1040
1043
  className: "param-expiries readonly"
1041
- }, /*#__PURE__*/React.createElement("span", {
1044
+ }, /*#__PURE__*/React$1.createElement("span", {
1042
1045
  className: "param-expiries-val"
1043
- }, "Expiry")), /*#__PURE__*/React.createElement("div", {
1046
+ }, "Expiry")), /*#__PURE__*/React$1.createElement("div", {
1044
1047
  className: "param-number-range readonly"
1045
- }, "Limit(% of AUM)"), /*#__PURE__*/React.createElement("div", {
1048
+ }, "Limit(% of AUM)"), /*#__PURE__*/React$1.createElement("div", {
1046
1049
  className: "param-number-range readonly"
1047
- }, "Limit(ABS)"), /*#__PURE__*/React.createElement("div", {
1050
+ }, "Limit(ABS)"), /*#__PURE__*/React$1.createElement("div", {
1048
1051
  className: "param-arr-ops readonly"
1049
1052
  }), this.value.map(function (it, i) {
1050
- return /*#__PURE__*/React.createElement(React.Fragment, {
1053
+ return /*#__PURE__*/React$1.createElement(React$1.Fragment, {
1051
1054
  key: i
1052
- }, /*#__PURE__*/React.createElement(Expiries, {
1055
+ }, /*#__PURE__*/React$1.createElement(Expiries, {
1053
1056
  multiple: false,
1054
1057
  options: _this2.props.options,
1055
1058
  value: [it.expiry],
@@ -1062,7 +1065,7 @@ var ExpiriesLimit = /*#__PURE__*/function (_PureComponent) {
1062
1065
  });
1063
1066
  },
1064
1067
  onBlur: _this2.props.onBlur
1065
- }), /*#__PURE__*/React.createElement(NumRange, {
1068
+ }), /*#__PURE__*/React$1.createElement(NumRange, {
1066
1069
  value: {
1067
1070
  min: it.minAumPercentage,
1068
1071
  max: it.maxAumPercentage
@@ -1075,7 +1078,7 @@ var ExpiriesLimit = /*#__PURE__*/function (_PureComponent) {
1075
1078
  },
1076
1079
  isPercentage: true,
1077
1080
  onBlur: _this2.props.onBlur
1078
- }), /*#__PURE__*/React.createElement(NumRange, {
1081
+ }), /*#__PURE__*/React$1.createElement(NumRange, {
1079
1082
  value: {
1080
1083
  min: it.minAbs,
1081
1084
  max: it.maxAbs
@@ -1087,12 +1090,12 @@ var ExpiriesLimit = /*#__PURE__*/function (_PureComponent) {
1087
1090
  });
1088
1091
  },
1089
1092
  onBlur: _this2.props.onBlur
1090
- }), /*#__PURE__*/React.createElement("div", {
1093
+ }), /*#__PURE__*/React$1.createElement("div", {
1091
1094
  className: "param-arr-ops"
1092
- }, /*#__PURE__*/React.createElement(PlusOutlined, {
1095
+ }, /*#__PURE__*/React$1.createElement(PlusOutlined, {
1093
1096
  className: "param-arr-ops-add",
1094
1097
  onClick: _this2.onAdd.bind(null, i)
1095
- }), /*#__PURE__*/React.createElement(DeleteOutlined, {
1098
+ }), /*#__PURE__*/React$1.createElement(DeleteOutlined, {
1096
1099
  className: "param-arr-ops-del",
1097
1100
  onClick: _this2.onDel.bind(null, i)
1098
1101
  })));
@@ -1107,7 +1110,7 @@ var _ParamTypeConfig;
1107
1110
  var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig, ParamType.ParamGroup, {
1108
1111
  name: '参数组',
1109
1112
  Comp: function Comp() {
1110
- return /*#__PURE__*/React.createElement(React.Fragment, null);
1113
+ return /*#__PURE__*/React$1.createElement(React$1.Fragment, null);
1111
1114
  }
1112
1115
  }), _defineProperty(_ParamTypeConfig, ParamType.Number, {
1113
1116
  name: '普通数值',
@@ -1118,7 +1121,7 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
1118
1121
  name: '百分比数值',
1119
1122
  key: 'number',
1120
1123
  Comp: function Comp(props) {
1121
- return /*#__PURE__*/React.createElement(Num, Object.assign({}, props, {
1124
+ return /*#__PURE__*/React$1.createElement(Num, Object.assign({}, props, {
1122
1125
  isPercentage: true
1123
1126
  }));
1124
1127
  },
@@ -1137,7 +1140,7 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
1137
1140
  name: '百分比范围',
1138
1141
  key: 'range',
1139
1142
  Comp: function Comp(props) {
1140
- return /*#__PURE__*/React.createElement(NumRange, Object.assign({}, props, {
1143
+ return /*#__PURE__*/React$1.createElement(NumRange, Object.assign({}, props, {
1141
1144
  isPercentage: true
1142
1145
  }));
1143
1146
  },
@@ -1248,7 +1251,8 @@ var ParamRenderer = /*#__PURE__*/function (_PureComponent) {
1248
1251
  key: "render",
1249
1252
  value: function render() {
1250
1253
  var Comp = this.typeConfig.Comp;
1251
- return /*#__PURE__*/React.createElement(Comp, Object.assign({}, this.props, {
1254
+ return /*#__PURE__*/React$1.createElement(Comp, Object.assign({}, this.props, {
1255
+ options: this.props.expiriesOptions,
1252
1256
  value: this.value,
1253
1257
  onChange: this.onChange,
1254
1258
  className: classNames('param-renderer', this.props.className)
@@ -1283,7 +1287,8 @@ function ParentSelector(props) {
1283
1287
  if (!matched) return [];
1284
1288
  return $value;
1285
1289
  }, [props.parentOptions, props.value]);
1286
- return /*#__PURE__*/React.createElement(Cascader, Object.assign({}, props, {
1290
+ return /*#__PURE__*/React$1.createElement(Cascader, {
1291
+ style: props.style,
1287
1292
  disabled: props.readonly,
1288
1293
  placeholder: '请选择',
1289
1294
  options: props.parentOptions,
@@ -1296,7 +1301,7 @@ function ParentSelector(props) {
1296
1301
 
1297
1302
  return (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, val.pop());
1298
1303
  }
1299
- }));
1304
+ });
1300
1305
  }
1301
1306
 
1302
1307
  var ParamForm = /*#__PURE__*/function (_PureComponent) {
@@ -1315,69 +1320,7 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
1315
1320
 
1316
1321
  _this = _super.call.apply(_super, [this].concat(args));
1317
1322
 
1318
- _defineProperty(_assertThisInitialized(_this), "ref", React.createRef());
1319
-
1320
- _defineProperty(_assertThisInitialized(_this), "formItems", [{
1321
- label: '所属分组',
1322
- name: 'parentId',
1323
- Comp: ParentSelector,
1324
- required: true,
1325
- validator: validatorCvt(function (val) {
1326
- return emptyValidator(val);
1327
- })
1328
- }, {
1329
- label: '参数 Key',
1330
- name: 'key',
1331
- Comp: function Comp(props) {
1332
- return /*#__PURE__*/React.createElement(Input, Object.assign({
1333
- placeholder: '请输入'
1334
- }, props));
1335
- },
1336
- required: true,
1337
- validator: validatorCvt(keyValidator)
1338
- }, {
1339
- label: '参数名称',
1340
- name: 'name',
1341
- Comp: function Comp(props) {
1342
- return /*#__PURE__*/React.createElement(Input, Object.assign({
1343
- placeholder: '请输入'
1344
- }, props));
1345
- }
1346
- }, {
1347
- label: '参数类型',
1348
- name: 'valueType',
1349
- Comp: function Comp(props) {
1350
- return /*#__PURE__*/React.createElement(Select, Object.assign({
1351
- placeholder: '请选择'
1352
- }, props, {
1353
- options: undefined
1354
- }), ParamTypeOptions.map(function (it) {
1355
- return /*#__PURE__*/React.createElement(Select.Option, {
1356
- key: it.value,
1357
- value: it.value
1358
- }, it.label);
1359
- }));
1360
- },
1361
- required: true,
1362
- validator: validatorCvt(function (val) {
1363
- return emptyValidator(val);
1364
- })
1365
- }, {
1366
- label: '默认值',
1367
- name: 'defaultValue',
1368
- Comp: ParamRenderer,
1369
- validator: validatorCvt(paramValidator, function () {
1370
- return _this.ref.current;
1371
- })
1372
- }, {
1373
- label: '参数说明',
1374
- name: 'description',
1375
- Comp: function Comp(props) {
1376
- return /*#__PURE__*/React.createElement(Input.TextArea, Object.assign({
1377
- placeholder: '请输入'
1378
- }, props));
1379
- }
1380
- }]);
1323
+ _defineProperty(_assertThisInitialized(_this), "ref", React$1.createRef());
1381
1324
 
1382
1325
  _defineProperty(_assertThisInitialized(_this), "onChange", function (changed, data) {
1383
1326
  var _this$props$onChange, _this$props;
@@ -1390,11 +1333,85 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
1390
1333
  }
1391
1334
 
1392
1335
  _createClass(ParamForm, [{
1393
- key: "render",
1394
- value: function render() {
1336
+ key: "formItems",
1337
+ get: function get() {
1395
1338
  var _this2 = this;
1396
1339
 
1397
- return /*#__PURE__*/React.createElement(Form, {
1340
+ return [{
1341
+ label: '所属分组',
1342
+ name: 'parentId',
1343
+ Comp: function Comp(props) {
1344
+ return /*#__PURE__*/React$1.createElement(ParentSelector, Object.assign({}, props, {
1345
+ parentOptions: _this2.props.parentOptions
1346
+ }));
1347
+ },
1348
+ required: true,
1349
+ validator: validatorCvt(function (val) {
1350
+ return emptyValidator(val);
1351
+ })
1352
+ }, {
1353
+ label: '参数 Key',
1354
+ name: 'key',
1355
+ Comp: function Comp(props) {
1356
+ return /*#__PURE__*/React$1.createElement(Input, Object.assign({
1357
+ placeholder: '请输入'
1358
+ }, props));
1359
+ },
1360
+ required: true,
1361
+ validator: validatorCvt(keyValidator)
1362
+ }, {
1363
+ label: '参数名称',
1364
+ name: 'name',
1365
+ Comp: function Comp(props) {
1366
+ return /*#__PURE__*/React$1.createElement(Input, Object.assign({
1367
+ placeholder: '请输入'
1368
+ }, props));
1369
+ }
1370
+ }, {
1371
+ label: '参数类型',
1372
+ name: 'valueType',
1373
+ Comp: function Comp(props) {
1374
+ return /*#__PURE__*/React$1.createElement(Select, Object.assign({
1375
+ placeholder: '请选择'
1376
+ }, props), ParamTypeOptions.map(function (it) {
1377
+ return /*#__PURE__*/React$1.createElement(Select.Option, {
1378
+ key: it.value,
1379
+ value: it.value
1380
+ }, it.label);
1381
+ }));
1382
+ },
1383
+ required: true,
1384
+ validator: validatorCvt(function (val) {
1385
+ return emptyValidator(val);
1386
+ })
1387
+ }, {
1388
+ label: '默认值',
1389
+ name: 'defaultValue',
1390
+ Comp: function Comp(props) {
1391
+ var _this2$ref$current;
1392
+
1393
+ return /*#__PURE__*/React$1.createElement(ParamRenderer, Object.assign({}, props, {
1394
+ expiriesOptions: _this2.props.expiriesOptions,
1395
+ valueType: (_this2$ref$current = _this2.ref.current) === null || _this2$ref$current === void 0 ? void 0 : _this2$ref$current.getFieldValue('valueType')
1396
+ }));
1397
+ },
1398
+ validator: validatorCvt(paramValidator, function () {
1399
+ return _this2.ref.current;
1400
+ })
1401
+ }, {
1402
+ label: '参数说明',
1403
+ name: 'description',
1404
+ Comp: function Comp(props) {
1405
+ return /*#__PURE__*/React$1.createElement(Input.TextArea, Object.assign({
1406
+ placeholder: '请输入'
1407
+ }, props));
1408
+ }
1409
+ }];
1410
+ }
1411
+ }, {
1412
+ key: "render",
1413
+ value: function render() {
1414
+ return /*#__PURE__*/React$1.createElement(Form, {
1398
1415
  className: "param-form",
1399
1416
  ref: this.ref,
1400
1417
  key: JSON.stringify(this.props.initialValues),
@@ -1402,9 +1419,7 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
1402
1419
  onFinish: this.props.onSubmit,
1403
1420
  onValuesChange: this.onChange
1404
1421
  }, this.formItems.map(function (it) {
1405
- var _this2$ref$current;
1406
-
1407
- return /*#__PURE__*/React.createElement(Form.Item, {
1422
+ return /*#__PURE__*/React$1.createElement(Form.Item, {
1408
1423
  key: it.name,
1409
1424
  label: it.label,
1410
1425
  name: it.name,
@@ -1416,12 +1431,8 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
1416
1431
  }
1417
1432
  }],
1418
1433
  validateTrigger: 'onBlur'
1419
- }, /*#__PURE__*/React.createElement(it.Comp, {
1420
- parentOptions: _this2.props.parentOptions,
1421
- options: _this2.props.expiriesOptions,
1422
- valueType: (_this2$ref$current = _this2.ref.current) === null || _this2$ref$current === void 0 ? void 0 : _this2$ref$current.getFieldValue('valueType')
1423
- }));
1424
- }), this.props.onSubmit && /*#__PURE__*/React.createElement(Button, {
1434
+ }, /*#__PURE__*/React$1.createElement(it.Comp, null));
1435
+ }), this.props.onSubmit && /*#__PURE__*/React$1.createElement(Button, {
1425
1436
  type: "primary",
1426
1437
  htmlType: "submit"
1427
1438
  }, "\u63D0\u4EA4"));
@@ -1447,10 +1458,11 @@ var ParamFormModalEl = /*#__PURE__*/function (_PureComponent2) {
1447
1458
 
1448
1459
  _this3 = _super2.call.apply(_super2, [this].concat(args));
1449
1460
 
1450
- _defineProperty(_assertThisInitialized(_this3), "ref", React.createRef());
1461
+ _defineProperty(_assertThisInitialized(_this3), "ref", React$1.createRef());
1451
1462
 
1452
1463
  _defineProperty(_assertThisInitialized(_this3), "state", {
1453
- visible: false
1464
+ visible: false,
1465
+ pending: false
1454
1466
  });
1455
1467
 
1456
1468
  _defineProperty(_assertThisInitialized(_this3), "onShow", function () {
@@ -1468,31 +1480,52 @@ var ParamFormModalEl = /*#__PURE__*/function (_PureComponent2) {
1468
1480
  _defineProperty(_assertThisInitialized(_this3), "onSubmit", function () {
1469
1481
  var form = _this3.ref.current.ref.current;
1470
1482
  return form.validateFields().then(function () {
1471
- return _this3.props.onSubmit(form.getFieldsValue());
1472
- }).then(_this3.onHide);
1483
+ return _this3.setState({
1484
+ pending: true
1485
+ });
1486
+ }).then(function () {
1487
+ var data = _objectSpread2(_objectSpread2({}, _this3.props.initialValues), form.getFieldsValue());
1488
+
1489
+ if (_this3.isEdit && isEqual(data, _this3.props.initialValues)) {
1490
+ message.warning('请修改后再提交');
1491
+ return Promise.reject();
1492
+ }
1493
+
1494
+ return _this3.props.onSubmit(data);
1495
+ }).then(_this3.onHide).finally(function () {
1496
+ return _this3.setState({
1497
+ pending: false
1498
+ });
1499
+ });
1473
1500
  });
1474
1501
 
1475
1502
  return _this3;
1476
1503
  }
1477
1504
 
1478
1505
  _createClass(ParamFormModalEl, [{
1479
- key: "render",
1480
- value: function render() {
1506
+ key: "isEdit",
1507
+ get: function get() {
1481
1508
  var _this$props$initialVa;
1482
1509
 
1483
- return /*#__PURE__*/React.createElement(Modal, {
1510
+ return Boolean((_this$props$initialVa = this.props.initialValues) === null || _this$props$initialVa === void 0 ? void 0 : _this$props$initialVa.paramId);
1511
+ }
1512
+ }, {
1513
+ key: "render",
1514
+ value: function render() {
1515
+ return /*#__PURE__*/React$1.createElement(Modal, {
1484
1516
  key: String(this.state.visible),
1485
1517
  width: 640,
1486
1518
  closable: false,
1487
- title: !((_this$props$initialVa = this.props.initialValues) === null || _this$props$initialVa === void 0 ? void 0 : _this$props$initialVa.paramId) ? '新增参数' : '修改参数',
1519
+ title: !this.isEdit ? '新增参数' : '修改参数',
1488
1520
  visible: this.state.visible,
1489
- footer: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
1521
+ footer: /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(Button, {
1490
1522
  onClick: this.onHide
1491
- }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
1523
+ }, "\u53D6\u6D88"), /*#__PURE__*/React$1.createElement(Button, {
1492
1524
  type: "primary",
1493
- onClick: this.onSubmit
1525
+ onClick: this.onSubmit,
1526
+ loading: this.state.pending
1494
1527
  }, "\u786E\u8BA4"))
1495
- }, /*#__PURE__*/React.createElement(ParamForm, Object.assign({}, this.props, {
1528
+ }, /*#__PURE__*/React$1.createElement(ParamForm, Object.assign({}, this.props, {
1496
1529
  ref: this.ref,
1497
1530
  onSubmit: undefined
1498
1531
  })));
@@ -1544,47 +1577,7 @@ var ParamValueEditor = /*#__PURE__*/function (_PureComponent) {
1544
1577
 
1545
1578
  _this = _super.call.apply(_super, [this].concat(args));
1546
1579
 
1547
- _defineProperty(_assertThisInitialized(_this), "ref", React.createRef());
1548
-
1549
- _defineProperty(_assertThisInitialized(_this), "formItems", [{
1550
- label: 'Parameter',
1551
- name: 'paramId',
1552
- Comp: function Comp(props) {
1553
- return /*#__PURE__*/React.createElement(ParentSelector, Object.assign({}, props, {
1554
- readonly: true
1555
- }));
1556
- }
1557
- }, {
1558
- label: 'Description',
1559
- name: 'description',
1560
- Comp: function Comp(props) {
1561
- return /*#__PURE__*/React.createElement("span", {
1562
- className: "param-value-editor-desc",
1563
- style: {
1564
- lineHeight: '20px',
1565
- padding: '10px 0'
1566
- }
1567
- }, props.value || '-');
1568
- }
1569
- }, {
1570
- label: 'Value before',
1571
- name: 'valueBefore',
1572
- Comp: function Comp(props) {
1573
- return /*#__PURE__*/React.createElement(ParamRenderer, Object.assign({}, props, {
1574
- readonly: true
1575
- }));
1576
- }
1577
- }, {
1578
- label: 'Value after',
1579
- name: 'value',
1580
- Comp: ParamRenderer,
1581
- required: true,
1582
- validator: validatorCvt(function (val) {
1583
- return paramValidator(val, {
1584
- valueType: _this.props.valueType
1585
- });
1586
- })
1587
- }]);
1580
+ _defineProperty(_assertThisInitialized(_this), "ref", React$1.createRef());
1588
1581
 
1589
1582
  _defineProperty(_assertThisInitialized(_this), "onChange", function (changed, data) {
1590
1583
  var _this$props$onChange, _this$props;
@@ -1596,16 +1589,60 @@ var ParamValueEditor = /*#__PURE__*/function (_PureComponent) {
1596
1589
  }
1597
1590
 
1598
1591
  _createClass(ParamValueEditor, [{
1599
- key: "componentDidMount",
1600
- value: function componentDidMount() {
1601
- console.log(1111, 'mounted');
1592
+ key: "formItems",
1593
+ get: function get() {
1594
+ var _this2 = this;
1595
+
1596
+ return [{
1597
+ label: 'Parameter',
1598
+ name: 'paramId',
1599
+ Comp: function Comp(props) {
1600
+ return /*#__PURE__*/React$1.createElement(ParentSelector, Object.assign({}, props, {
1601
+ readonly: true
1602
+ }));
1603
+ }
1604
+ }, {
1605
+ label: 'Description',
1606
+ name: 'description',
1607
+ Comp: function Comp(props) {
1608
+ return /*#__PURE__*/React$1.createElement("span", {
1609
+ className: "param-value-editor-desc",
1610
+ style: {
1611
+ lineHeight: '20px',
1612
+ padding: '10px 0'
1613
+ }
1614
+ }, props.value || '-');
1615
+ }
1616
+ }, {
1617
+ label: 'Value before',
1618
+ name: 'valueBefore',
1619
+ Comp: function Comp(props) {
1620
+ return /*#__PURE__*/React$1.createElement(ParamRenderer, Object.assign({}, props, {
1621
+ readonly: true,
1622
+ parentOptions: _this2.props.allParams
1623
+ }));
1624
+ }
1625
+ }, {
1626
+ label: 'Value after',
1627
+ name: 'value',
1628
+ Comp: function Comp(props) {
1629
+ return /*#__PURE__*/React$1.createElement(ParamRenderer, Object.assign({}, props, {
1630
+ expiriesOptions: _this2.props.expiriesOptions,
1631
+ valueType: _this2.props.valueType
1632
+ }));
1633
+ },
1634
+ required: true,
1635
+ validator: validatorCvt(function (val) {
1636
+ return paramValidator(val, {
1637
+ valueType: _this2.props.valueType
1638
+ });
1639
+ })
1640
+ }];
1602
1641
  }
1603
1642
  }, {
1604
1643
  key: "render",
1605
1644
  value: function render() {
1606
- var _this2 = this;
1607
-
1608
- return /*#__PURE__*/React.createElement(Form, {
1645
+ return /*#__PURE__*/React$1.createElement(Form, {
1609
1646
  className: "param-value-editor",
1610
1647
  ref: this.ref,
1611
1648
  key: this.props.valueType,
@@ -1613,7 +1650,7 @@ var ParamValueEditor = /*#__PURE__*/function (_PureComponent) {
1613
1650
  onFinish: this.props.onSubmit,
1614
1651
  onValuesChange: this.onChange
1615
1652
  }, this.formItems.map(function (it) {
1616
- return /*#__PURE__*/React.createElement(Form.Item, {
1653
+ return /*#__PURE__*/React$1.createElement(Form.Item, {
1617
1654
  key: it.name,
1618
1655
  label: it.label,
1619
1656
  name: it.name,
@@ -1625,11 +1662,8 @@ var ParamValueEditor = /*#__PURE__*/function (_PureComponent) {
1625
1662
  }
1626
1663
  }],
1627
1664
  validateTrigger: 'onBlur'
1628
- }, /*#__PURE__*/React.createElement(it.Comp, {
1629
- parentOptions: _this2.props.allParams,
1630
- valueType: _this2.props.valueType
1631
- }));
1632
- }), this.props.onSubmit && /*#__PURE__*/React.createElement(Button, {
1665
+ }, /*#__PURE__*/React$1.createElement(it.Comp, null));
1666
+ }), this.props.onSubmit && /*#__PURE__*/React$1.createElement(Button, {
1633
1667
  type: "primary",
1634
1668
  htmlType: "submit"
1635
1669
  }, "\u63D0\u4EA4"));
@@ -1654,10 +1688,11 @@ var ParamValueEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
1654
1688
 
1655
1689
  _this3 = _super2.call.apply(_super2, [this].concat(args));
1656
1690
 
1657
- _defineProperty(_assertThisInitialized(_this3), "ref", React.createRef());
1691
+ _defineProperty(_assertThisInitialized(_this3), "ref", React$1.createRef());
1658
1692
 
1659
1693
  _defineProperty(_assertThisInitialized(_this3), "state", {
1660
- visible: false
1694
+ visible: false,
1695
+ pending: false
1661
1696
  });
1662
1697
 
1663
1698
  _defineProperty(_assertThisInitialized(_this3), "onShow", function () {
@@ -1675,8 +1710,23 @@ var ParamValueEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
1675
1710
  _defineProperty(_assertThisInitialized(_this3), "onSubmit", function () {
1676
1711
  var form = _this3.ref.current.ref.current;
1677
1712
  return form.validateFields().then(function () {
1678
- return _this3.props.onSubmit(form.getFieldsValue());
1679
- }).then(_this3.onHide);
1713
+ return _this3.setState({
1714
+ pending: true
1715
+ });
1716
+ }).then(function () {
1717
+ var data = _objectSpread2(_objectSpread2({}, _this3.props.initialValues), form.getFieldsValue());
1718
+
1719
+ if (isEqual(data, _this3.props.initialValues)) {
1720
+ message.warning('请修改后再提交');
1721
+ return Promise.reject();
1722
+ }
1723
+
1724
+ return _this3.props.onSubmit(data);
1725
+ }).then(_this3.onHide).finally(function () {
1726
+ return _this3.setState({
1727
+ pending: false
1728
+ });
1729
+ });
1680
1730
  });
1681
1731
 
1682
1732
  return _this3;
@@ -1685,19 +1735,20 @@ var ParamValueEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
1685
1735
  _createClass(ParamValueEditorModalEl, [{
1686
1736
  key: "render",
1687
1737
  value: function render() {
1688
- return /*#__PURE__*/React.createElement(Modal, {
1738
+ return /*#__PURE__*/React$1.createElement(Modal, {
1689
1739
  key: String(this.state.visible),
1690
1740
  width: 640,
1691
1741
  title: 'Edit Value',
1692
1742
  closable: false,
1693
1743
  visible: this.state.visible,
1694
- footer: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
1744
+ footer: /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(Button, {
1695
1745
  onClick: this.onHide
1696
- }, "Cancel"), /*#__PURE__*/React.createElement(Button, {
1746
+ }, "Cancel"), /*#__PURE__*/React$1.createElement(Button, {
1697
1747
  type: "primary",
1698
- onClick: this.onSubmit
1748
+ onClick: this.onSubmit,
1749
+ loading: this.state.pending
1699
1750
  }, "Submit"))
1700
- }, /*#__PURE__*/React.createElement(ParamValueEditor, Object.assign({}, this.props, {
1751
+ }, /*#__PURE__*/React$1.createElement(ParamValueEditor, Object.assign({}, this.props, {
1701
1752
  ref: this.ref,
1702
1753
  onSubmit: undefined
1703
1754
  })));
@@ -1732,4 +1783,279 @@ var ParamValueEditorModal = /*#__PURE__*/function () {
1732
1783
 
1733
1784
  _defineProperty(ParamValueEditorModal, "el", new ReactGlobalComp('param-value-editor-modal', ParamValueEditorModalEl));
1734
1785
 
1735
- export { ParamForm, ParamFormModal, ParamRenderer, ParamType, ParamTypeConfig, ParamTypeOptions, ParamValueEditor, ParamValueEditorModal, ParamValueEditorModalEl, emptyValidator, expiriesValidator, expiryValidator, formatNum, isExpired, isNullLike, keyValidator, numRangeValidator, paramValidator, validatorCvt };
1786
+ var ImageUpload = function ImageUpload(props) {
1787
+ var _useRequest = useRequest(function () {
1788
+ var _props$getSignedUrl;
1789
+
1790
+ return Promise.resolve(props.value && ((_props$getSignedUrl = props.getSignedUrl) === null || _props$getSignedUrl === void 0 ? void 0 : _props$getSignedUrl.call(props, props.value)));
1791
+ }, {
1792
+ refreshDeps: [props.value]
1793
+ }),
1794
+ url = _useRequest.data;
1795
+
1796
+ var _useState = useState(function () {
1797
+ return url ? [{
1798
+ url: url
1799
+ }] : [];
1800
+ }),
1801
+ _useState2 = _slicedToArray(_useState, 2),
1802
+ files = _useState2[0],
1803
+ setFiles = _useState2[1];
1804
+
1805
+ useEffect(function () {
1806
+ return setFiles(url ? [{
1807
+ url: url
1808
+ }] : []);
1809
+ }, [url]);
1810
+
1811
+ var _useRequest2 = useRequest(function ($files) {
1812
+ var _$files$, _props$handleUpload, _props$onChange2;
1813
+
1814
+ setFiles($files);
1815
+ var file = (_$files$ = $files[0]) === null || _$files$ === void 0 ? void 0 : _$files$.file;
1816
+ if (file) return (_props$handleUpload = props.handleUpload) === null || _props$handleUpload === void 0 ? void 0 : _props$handleUpload.call(props, file).then(function (key) {
1817
+ var _props$onChange;
1818
+
1819
+ return (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, key);
1820
+ });
1821
+ return Promise.resolve((_props$onChange2 = props.onChange) === null || _props$onChange2 === void 0 ? void 0 : _props$onChange2.call(props, undefined));
1822
+ }, {
1823
+ manual: true
1824
+ }),
1825
+ run = _useRequest2.run,
1826
+ loading = _useRequest2.loading;
1827
+
1828
+ return /*#__PURE__*/React.createElement(ReactFileInput, Object.assign({}, props, {
1829
+ uploading: loading,
1830
+ className: classNames(props.className, 'param-image-upload'),
1831
+ files: files,
1832
+ onChange: run
1833
+ }));
1834
+ };
1835
+
1836
+ var ParamGroupEditor = /*#__PURE__*/function (_PureComponent) {
1837
+ _inherits(ParamGroupEditor, _PureComponent);
1838
+
1839
+ var _super = _createSuper(ParamGroupEditor);
1840
+
1841
+ function ParamGroupEditor() {
1842
+ var _this;
1843
+
1844
+ _classCallCheck(this, ParamGroupEditor);
1845
+
1846
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1847
+ args[_key] = arguments[_key];
1848
+ }
1849
+
1850
+ _this = _super.call.apply(_super, [this].concat(args));
1851
+
1852
+ _defineProperty(_assertThisInitialized(_this), "ref", React$1.createRef());
1853
+
1854
+ _defineProperty(_assertThisInitialized(_this), "onChange", function (changed, data) {
1855
+ var _this$props$onChange, _this$props;
1856
+
1857
+ (_this$props$onChange = (_this$props = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props, data);
1858
+ });
1859
+
1860
+ return _this;
1861
+ }
1862
+
1863
+ _createClass(ParamGroupEditor, [{
1864
+ key: "formItems",
1865
+ get: function get() {
1866
+ var _this$props$initialVa,
1867
+ _this2 = this;
1868
+
1869
+ var isFirstLevel = !this.props.allParams && !((_this$props$initialVa = this.props.initialValues) === null || _this$props$initialVa === void 0 ? void 0 : _this$props$initialVa.parentId);
1870
+ var items = [{
1871
+ label: '参数组名称',
1872
+ name: 'name',
1873
+ Comp: function Comp(props) {
1874
+ return /*#__PURE__*/React$1.createElement(Input, Object.assign({}, props, {
1875
+ placeholder: '请输入'
1876
+ }));
1877
+ },
1878
+ validator: validatorCvt(function (val) {
1879
+ return emptyValidator(val);
1880
+ })
1881
+ }, {
1882
+ label: '业务流程图',
1883
+ name: 'descriptionUrl',
1884
+ Comp: function Comp(props) {
1885
+ return /*#__PURE__*/React$1.createElement(ImageUpload, Object.assign({}, props, {
1886
+ getSignedUrl: _this2.props.getSignedUrl,
1887
+ handleUpload: _this2.props.handleUpload
1888
+ }));
1889
+ },
1890
+ validator: isFirstLevel ? validatorCvt(function (val) {
1891
+ return emptyValidator(val);
1892
+ }) : undefined
1893
+ }];
1894
+
1895
+ if (!isFirstLevel) {
1896
+ items.unshift({
1897
+ label: '父级参数组',
1898
+ name: 'parentId',
1899
+ Comp: function Comp(props) {
1900
+ return /*#__PURE__*/React$1.createElement(ParentSelector, Object.assign({}, props, {
1901
+ parentOptions: _this2.props.allParams
1902
+ }));
1903
+ }
1904
+ });
1905
+ }
1906
+
1907
+ return items;
1908
+ }
1909
+ }, {
1910
+ key: "render",
1911
+ value: function render() {
1912
+ return /*#__PURE__*/React$1.createElement(Form, {
1913
+ className: "param-value-editor",
1914
+ ref: this.ref,
1915
+ initialValues: this.props.initialValues,
1916
+ onFinish: this.props.onSubmit,
1917
+ onValuesChange: this.onChange
1918
+ }, this.formItems.map(function (it) {
1919
+ return /*#__PURE__*/React$1.createElement(Form.Item, {
1920
+ key: it.name,
1921
+ label: it.label,
1922
+ name: it.name,
1923
+ required: it.required,
1924
+ requiredMark: true,
1925
+ rules: [{
1926
+ validator: it.validator || function () {
1927
+ return Promise.resolve();
1928
+ }
1929
+ }],
1930
+ validateTrigger: 'onBlur'
1931
+ }, /*#__PURE__*/React$1.createElement(it.Comp, null));
1932
+ }), this.props.onSubmit && /*#__PURE__*/React$1.createElement(Button, {
1933
+ type: "primary",
1934
+ htmlType: "submit"
1935
+ }, "\u63D0\u4EA4"));
1936
+ }
1937
+ }]);
1938
+
1939
+ return ParamGroupEditor;
1940
+ }(PureComponent);
1941
+ var ParamGroupEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
1942
+ _inherits(ParamGroupEditorModalEl, _PureComponent2);
1943
+
1944
+ var _super2 = _createSuper(ParamGroupEditorModalEl);
1945
+
1946
+ function ParamGroupEditorModalEl() {
1947
+ var _this3;
1948
+
1949
+ _classCallCheck(this, ParamGroupEditorModalEl);
1950
+
1951
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1952
+ args[_key2] = arguments[_key2];
1953
+ }
1954
+
1955
+ _this3 = _super2.call.apply(_super2, [this].concat(args));
1956
+
1957
+ _defineProperty(_assertThisInitialized(_this3), "ref", React$1.createRef());
1958
+
1959
+ _defineProperty(_assertThisInitialized(_this3), "state", {
1960
+ visible: false,
1961
+ pending: false
1962
+ });
1963
+
1964
+ _defineProperty(_assertThisInitialized(_this3), "onShow", function () {
1965
+ return _this3.setState({
1966
+ visible: true
1967
+ });
1968
+ });
1969
+
1970
+ _defineProperty(_assertThisInitialized(_this3), "onHide", function () {
1971
+ return _this3.setState({
1972
+ visible: false
1973
+ });
1974
+ });
1975
+
1976
+ _defineProperty(_assertThisInitialized(_this3), "onSubmit", function () {
1977
+ var form = _this3.ref.current.ref.current;
1978
+ return form.validateFields().then(function () {
1979
+ return _this3.setState({
1980
+ pending: true
1981
+ });
1982
+ }).then(function () {
1983
+ var data = _objectSpread2(_objectSpread2({}, _this3.props.initialValues), form.getFieldsValue());
1984
+
1985
+ if (_this3.isEdit && isEqual(data, _this3.props.initialValues)) {
1986
+ message.warning('请修改后再提交');
1987
+ return Promise.reject();
1988
+ }
1989
+
1990
+ return _this3.props.onSubmit(data);
1991
+ }).then(_this3.onHide).finally(function () {
1992
+ return _this3.setState({
1993
+ pending: false
1994
+ });
1995
+ });
1996
+ });
1997
+
1998
+ return _this3;
1999
+ }
2000
+
2001
+ _createClass(ParamGroupEditorModalEl, [{
2002
+ key: "isEdit",
2003
+ get: function get() {
2004
+ var _this$props$initialVa2;
2005
+
2006
+ return Boolean((_this$props$initialVa2 = this.props.initialValues) === null || _this$props$initialVa2 === void 0 ? void 0 : _this$props$initialVa2.paramId);
2007
+ }
2008
+ }, {
2009
+ key: "render",
2010
+ value: function render() {
2011
+ var _this$props$initialVa3;
2012
+
2013
+ return /*#__PURE__*/React$1.createElement(Modal, {
2014
+ key: String(this.state.visible),
2015
+ width: 640,
2016
+ title: ((_this$props$initialVa3 = this.props.initialValues) === null || _this$props$initialVa3 === void 0 ? void 0 : _this$props$initialVa3.paramId) ? '编辑参数组' : '新增参数组',
2017
+ closable: false,
2018
+ visible: this.state.visible,
2019
+ footer: /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(Button, {
2020
+ onClick: this.onHide
2021
+ }, "Cancel"), /*#__PURE__*/React$1.createElement(Button, {
2022
+ type: "primary",
2023
+ onClick: this.onSubmit,
2024
+ loading: this.state.pending
2025
+ }, "Submit"))
2026
+ }, /*#__PURE__*/React$1.createElement(ParamGroupEditor, Object.assign({}, this.props, {
2027
+ ref: this.ref,
2028
+ onSubmit: undefined
2029
+ })));
2030
+ }
2031
+ }]);
2032
+
2033
+ return ParamGroupEditorModalEl;
2034
+ }(PureComponent);
2035
+ var ParamGroupEditorModal = /*#__PURE__*/function () {
2036
+ function ParamGroupEditorModal() {
2037
+ _classCallCheck(this, ParamGroupEditorModal);
2038
+ }
2039
+
2040
+ _createClass(ParamGroupEditorModal, null, [{
2041
+ key: "show",
2042
+ value: function show(props) {
2043
+ return ParamGroupEditorModal.el.render(props).then(function () {
2044
+ ParamGroupEditorModal.el.ref.onShow();
2045
+ });
2046
+ }
2047
+ }, {
2048
+ key: "hide",
2049
+ value: function hide() {
2050
+ return ParamGroupEditorModal.el.render().then(function () {
2051
+ ParamGroupEditorModal.el.ref.onHide();
2052
+ });
2053
+ }
2054
+ }]);
2055
+
2056
+ return ParamGroupEditorModal;
2057
+ }();
2058
+
2059
+ _defineProperty(ParamGroupEditorModal, "el", new ReactGlobalComp('param-group-editor-modal', ParamGroupEditorModalEl));
2060
+
2061
+ export { ParamForm, ParamFormModal, ParamGroupEditor, ParamGroupEditorModal, ParamGroupEditorModalEl, ParamRenderer, ParamType, ParamTypeConfig, ParamTypeOptions, ParamValueEditor, ParamValueEditorModal, ParamValueEditorModalEl, emptyValidator, expiriesValidator, expiryValidator, formatNum, isExpired, isNullLike, keyValidator, numRangeValidator, paramValidator, validatorCvt };