@signalplus/params-about 0.1.1 → 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/index.d.ts +63 -4
- package/lib/css/Expiries.scss +5 -3
- package/lib/css/Num.scss +1 -4
- package/lib/css/NumRange.scss +0 -3
- package/lib/css/ParamForm/index.scss +20 -17
- package/lib/css/TextArray.scss +7 -7
- package/lib/css/index.css +1 -1
- package/lib/css/index.scss +2 -1
- package/lib/css/var.scss +1 -0
- package/lib/es/index.js +560 -223
- package/package.json +10 -4
package/lib/es/index.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Bundle of @signalplus/params-about
|
|
3
|
-
* Generated: 2022-04-
|
|
4
|
-
* Version: 0.1.
|
|
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
|
|
@@ -549,12 +552,13 @@ var NumCvt = /*#__PURE__*/function () {
|
|
|
549
552
|
key: "show",
|
|
550
553
|
value: function show(val, isPercentage) {
|
|
551
554
|
if (val && isPercentage) return Big(val).times(100).valueOf();
|
|
552
|
-
return val;
|
|
555
|
+
return String(val !== null && val !== void 0 ? val : '');
|
|
553
556
|
}
|
|
554
557
|
}, {
|
|
555
558
|
key: "emit",
|
|
556
559
|
value: function emit(val, isPercentage) {
|
|
557
|
-
if (!val
|
|
560
|
+
if (!val) return undefined;
|
|
561
|
+
if (!isPercentage) return +val;
|
|
558
562
|
return +Big(val).div(100);
|
|
559
563
|
}
|
|
560
564
|
}]);
|
|
@@ -588,16 +592,19 @@ var Num = /*#__PURE__*/function (_PureComponent) {
|
|
|
588
592
|
_defineProperty(_assertThisInitialized(_this), "state", initState(_this.props));
|
|
589
593
|
|
|
590
594
|
_defineProperty(_assertThisInitialized(_this), "onChange", function (e) {
|
|
591
|
-
var _this$props$onChange, _this$props;
|
|
592
|
-
|
|
593
595
|
var $value = e.target.value;
|
|
594
596
|
var $val = $value.replace(/^(-?\d+(\.\d*)?|-?\d*).*$/, '$1');
|
|
595
597
|
if ($val !== $value) e.target.value = $val;
|
|
596
598
|
var value = NumCvt.emit($val, _this.props.isPercentage);
|
|
597
|
-
|
|
599
|
+
|
|
600
|
+
_this.setState(function (pre) {
|
|
598
601
|
return _objectSpread2(_objectSpread2({}, pre), {}, {
|
|
599
602
|
tempValue: e.target.value
|
|
600
603
|
});
|
|
604
|
+
}, function () {
|
|
605
|
+
var _this$props$onChange, _this$props;
|
|
606
|
+
|
|
607
|
+
if (value !== _this.props.value) (_this$props$onChange = (_this$props = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props, value);
|
|
601
608
|
});
|
|
602
609
|
});
|
|
603
610
|
|
|
@@ -609,28 +616,28 @@ var Num = /*#__PURE__*/function (_PureComponent) {
|
|
|
609
616
|
value: function render() {
|
|
610
617
|
var _this$state$tempValue;
|
|
611
618
|
|
|
612
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
619
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
613
620
|
className: classNames('param-number', {
|
|
614
621
|
readonly: this.props.readonly
|
|
615
622
|
}, this.props.className),
|
|
616
623
|
style: this.props.style
|
|
617
|
-
}, this.props.readonly ? /*#__PURE__*/React.createElement("span", {
|
|
624
|
+
}, this.props.readonly ? /*#__PURE__*/React$1.createElement("span", {
|
|
618
625
|
className: "param-number-val"
|
|
619
|
-
}, (_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", {
|
|
620
627
|
className: "param-number-val",
|
|
621
628
|
type: "text",
|
|
622
629
|
placeholder: this.props.placeholder || 'Value',
|
|
623
630
|
value: this.state.tempValue || '',
|
|
624
631
|
onChange: this.onChange,
|
|
625
632
|
onBlur: this.props.onBlur
|
|
626
|
-
}), this.props.isPercentage && /*#__PURE__*/React.createElement("span", {
|
|
633
|
+
}), this.props.isPercentage && /*#__PURE__*/React$1.createElement("span", {
|
|
627
634
|
className: "param-number-suffix"
|
|
628
635
|
}, "%"));
|
|
629
636
|
}
|
|
630
637
|
}], [{
|
|
631
638
|
key: "getDerivedStateFromProps",
|
|
632
639
|
value: function getDerivedStateFromProps(props, state) {
|
|
633
|
-
if (props.value !== state.preProps.value) {
|
|
640
|
+
if (props.value !== state.preProps.value && parseFloat(state.tempValue) !== props.value) {
|
|
634
641
|
state.tempValue = NumCvt.show(props.value, props.isPercentage);
|
|
635
642
|
}
|
|
636
643
|
|
|
@@ -676,25 +683,25 @@ var NumRange = /*#__PURE__*/function (_PureComponent) {
|
|
|
676
683
|
value: function render() {
|
|
677
684
|
var _this$props$value, _this$props$value2;
|
|
678
685
|
|
|
679
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
686
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
680
687
|
className: classNames('param-number-range', {
|
|
681
688
|
readonly: this.props.readonly
|
|
682
689
|
}, this.props.className),
|
|
683
690
|
style: this.props.style
|
|
684
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
691
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
685
692
|
className: "param-number-range-prefix"
|
|
686
|
-
}, "Min"), /*#__PURE__*/React.createElement(Num, {
|
|
693
|
+
}, "Min"), /*#__PURE__*/React$1.createElement(Num, {
|
|
687
694
|
placeholder: 'Min',
|
|
688
695
|
value: (_this$props$value = this.props.value) === null || _this$props$value === void 0 ? void 0 : _this$props$value.min,
|
|
689
696
|
onChange: this.onChange.bind(null, 'min'),
|
|
690
697
|
isPercentage: this.props.isPercentage,
|
|
691
698
|
readonly: this.props.readonly,
|
|
692
699
|
onBlur: this.props.onBlur
|
|
693
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
700
|
+
}), /*#__PURE__*/React$1.createElement("span", {
|
|
694
701
|
className: "param-number-range-sep"
|
|
695
|
-
}, this.props.readonly ? ',' : '-'), /*#__PURE__*/React.createElement("span", {
|
|
702
|
+
}, this.props.readonly ? ',' : '-'), /*#__PURE__*/React$1.createElement("span", {
|
|
696
703
|
className: "param-number-range-prefix"
|
|
697
|
-
}, "Max"), /*#__PURE__*/React.createElement(Num, {
|
|
704
|
+
}, "Max"), /*#__PURE__*/React$1.createElement(Num, {
|
|
698
705
|
placeholder: 'Max',
|
|
699
706
|
value: (_this$props$value2 = this.props.value) === null || _this$props$value2 === void 0 ? void 0 : _this$props$value2.max,
|
|
700
707
|
onChange: this.onChange.bind(null, 'max'),
|
|
@@ -750,7 +757,7 @@ var TextArray = /*#__PURE__*/function (_PureComponent) {
|
|
|
750
757
|
var value = _toConsumableArray(_this.value);
|
|
751
758
|
|
|
752
759
|
value[i] = val;
|
|
753
|
-
(_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);
|
|
754
761
|
});
|
|
755
762
|
|
|
756
763
|
_defineProperty(_assertThisInitialized(_this), "onAdd", function (i) {
|
|
@@ -768,7 +775,7 @@ var TextArray = /*#__PURE__*/function (_PureComponent) {
|
|
|
768
775
|
var value = _toConsumableArray(_this.value);
|
|
769
776
|
|
|
770
777
|
value.splice(i, 1);
|
|
771
|
-
(_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);
|
|
772
779
|
});
|
|
773
780
|
|
|
774
781
|
return _this;
|
|
@@ -781,29 +788,29 @@ var TextArray = /*#__PURE__*/function (_PureComponent) {
|
|
|
781
788
|
|
|
782
789
|
this.value = this.props.value || [];
|
|
783
790
|
if (!this.value.length) this.value.push('');
|
|
784
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
791
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
785
792
|
className: classNames('param-text-array', {
|
|
786
793
|
readonly: this.props.readonly
|
|
787
794
|
}, this.props.className),
|
|
788
795
|
style: this.props.style
|
|
789
|
-
}, this.props.readonly ? /*#__PURE__*/React.createElement("span", {
|
|
796
|
+
}, this.props.readonly ? /*#__PURE__*/React$1.createElement("span", {
|
|
790
797
|
className: "param-text-array-val"
|
|
791
798
|
}, this.value.filter(Boolean).join(', ') || '-') : this.value.map(function (it, i) {
|
|
792
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
799
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
793
800
|
className: "param-arr-item",
|
|
794
801
|
key: i
|
|
795
|
-
}, /*#__PURE__*/React.createElement("input", {
|
|
802
|
+
}, /*#__PURE__*/React$1.createElement("input", {
|
|
796
803
|
type: "text",
|
|
797
804
|
placeholder: "Phone",
|
|
798
805
|
value: it,
|
|
799
806
|
onChange: _this2.onChange.bind(null, i),
|
|
800
807
|
onBlur: _this2.props.onBlur
|
|
801
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
808
|
+
}), /*#__PURE__*/React$1.createElement("div", {
|
|
802
809
|
className: "param-arr-ops"
|
|
803
|
-
}, /*#__PURE__*/React.createElement(PlusOutlined, {
|
|
810
|
+
}, /*#__PURE__*/React$1.createElement(PlusOutlined, {
|
|
804
811
|
className: "param-arr-ops-add",
|
|
805
812
|
onClick: _this2.onAdd.bind(null, i)
|
|
806
|
-
}), /*#__PURE__*/React.createElement(DeleteOutlined, {
|
|
813
|
+
}), /*#__PURE__*/React$1.createElement(DeleteOutlined, {
|
|
807
814
|
className: "param-arr-ops-del",
|
|
808
815
|
onClick: _this2.onDel.bind(null, i)
|
|
809
816
|
})));
|
|
@@ -873,12 +880,12 @@ var Expiries = /*#__PURE__*/function (_PureComponent) {
|
|
|
873
880
|
});
|
|
874
881
|
|
|
875
882
|
if (this.props.readonly) {
|
|
876
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
883
|
+
return /*#__PURE__*/React$1.createElement("span", {
|
|
877
884
|
className: "param-expiries-val"
|
|
878
885
|
}, (value === null || value === void 0 ? void 0 : value.join(', ')) || '-');
|
|
879
886
|
}
|
|
880
887
|
|
|
881
|
-
var placeholder = /*#__PURE__*/React.createElement("span", {
|
|
888
|
+
var placeholder = /*#__PURE__*/React$1.createElement("span", {
|
|
882
889
|
className: "param-expiries-placeholder"
|
|
883
890
|
}, "Choose an expiry");
|
|
884
891
|
|
|
@@ -887,20 +894,20 @@ var Expiries = /*#__PURE__*/function (_PureComponent) {
|
|
|
887
894
|
|
|
888
895
|
var _val = (_this$props$value2 = this.props.value) === null || _this$props$value2 === void 0 ? void 0 : _this$props$value2[0];
|
|
889
896
|
|
|
890
|
-
return !_val || isExpired(_val) ? placeholder : /*#__PURE__*/React.createElement("span", {
|
|
897
|
+
return !_val || isExpired(_val) ? placeholder : /*#__PURE__*/React$1.createElement("span", {
|
|
891
898
|
className: "param-expiries-val"
|
|
892
899
|
}, _val);
|
|
893
900
|
}
|
|
894
901
|
|
|
895
902
|
if (!(value === null || value === void 0 ? void 0 : value.length)) return placeholder;
|
|
896
903
|
return value.map(function (it) {
|
|
897
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
904
|
+
return /*#__PURE__*/React$1.createElement("span", {
|
|
898
905
|
className: "param-expiries-multi-val",
|
|
899
906
|
key: it,
|
|
900
907
|
onClick: function onClick(e) {
|
|
901
908
|
return e.stopPropagation();
|
|
902
909
|
}
|
|
903
|
-
}, it, /*#__PURE__*/React.createElement(CloseOutlined, {
|
|
910
|
+
}, it, /*#__PURE__*/React$1.createElement(CloseOutlined, {
|
|
904
911
|
onClick: _this2.onChange.bind(null, it)
|
|
905
912
|
}));
|
|
906
913
|
});
|
|
@@ -911,7 +918,7 @@ var Expiries = /*#__PURE__*/function (_PureComponent) {
|
|
|
911
918
|
var _this$props$options,
|
|
912
919
|
_this3 = this;
|
|
913
920
|
|
|
914
|
-
return /*#__PURE__*/React.createElement(Popover, {
|
|
921
|
+
return /*#__PURE__*/React$1.createElement(Popover, {
|
|
915
922
|
overlayClassName: "param-expiries-popover",
|
|
916
923
|
trigger: 'click',
|
|
917
924
|
placement: 'bottomLeft',
|
|
@@ -922,22 +929,22 @@ var Expiries = /*#__PURE__*/function (_PureComponent) {
|
|
|
922
929
|
|
|
923
930
|
var checked = (_this3$props$value = _this3.props.value) === null || _this3$props$value === void 0 ? void 0 : _this3$props$value.includes(it);
|
|
924
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);
|
|
925
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
932
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
926
933
|
className: classNames('param-expiries-option', {
|
|
927
934
|
'param-expiries-option-checked': checked,
|
|
928
935
|
'param-expiries-option-disabled': disabled
|
|
929
936
|
}),
|
|
930
937
|
key: it,
|
|
931
938
|
onClick: disabled ? undefined : (_this3$onChange = _this3.onChange) === null || _this3$onChange === void 0 ? void 0 : _this3$onChange.bind(null, it)
|
|
932
|
-
}, it, checked && /*#__PURE__*/React.createElement(CheckOutlined, null));
|
|
939
|
+
}, it, checked && /*#__PURE__*/React$1.createElement(CheckOutlined, null));
|
|
933
940
|
})
|
|
934
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
941
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
935
942
|
className: classNames('param-expiries', {
|
|
936
943
|
readonly: this.props.readonly,
|
|
937
944
|
multiple: this.props.multiple !== false
|
|
938
945
|
}, this.props.className),
|
|
939
946
|
style: this.props.style
|
|
940
|
-
}, 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, {
|
|
941
948
|
className: "param-expiries-arrow"
|
|
942
949
|
})));
|
|
943
950
|
}
|
|
@@ -973,7 +980,7 @@ var ExpiriesLimit = /*#__PURE__*/function (_PureComponent) {
|
|
|
973
980
|
expiry: ''
|
|
974
981
|
};
|
|
975
982
|
if (key) value[i][key] = val;else value[i] = _objectSpread2(_objectSpread2({}, value[i]), val);
|
|
976
|
-
(_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);
|
|
977
984
|
});
|
|
978
985
|
|
|
979
986
|
_defineProperty(_assertThisInitialized(_this), "onAdd", function (i) {
|
|
@@ -994,7 +1001,7 @@ var ExpiriesLimit = /*#__PURE__*/function (_PureComponent) {
|
|
|
994
1001
|
var value = _toConsumableArray(_this.value);
|
|
995
1002
|
|
|
996
1003
|
value.splice(i, 1);
|
|
997
|
-
(_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);
|
|
998
1005
|
(_this$props$onBlur2 = (_this$props5 = _this.props).onBlur) === null || _this$props$onBlur2 === void 0 ? void 0 : _this$props$onBlur2.call(_this$props5);
|
|
999
1006
|
});
|
|
1000
1007
|
|
|
@@ -1014,7 +1021,7 @@ var ExpiriesLimit = /*#__PURE__*/function (_PureComponent) {
|
|
|
1014
1021
|
if (!this.value.length) this.value.push({
|
|
1015
1022
|
expiry: ''
|
|
1016
1023
|
});
|
|
1017
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
1024
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
1018
1025
|
className: classNames('param-expiries-limit', {
|
|
1019
1026
|
readonly: this.props.readonly
|
|
1020
1027
|
}, this.props.className),
|
|
@@ -1022,30 +1029,30 @@ var ExpiriesLimit = /*#__PURE__*/function (_PureComponent) {
|
|
|
1022
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) {
|
|
1023
1030
|
return it.expiry;
|
|
1024
1031
|
}).map(function (it, i) {
|
|
1025
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
1032
|
+
return /*#__PURE__*/React$1.createElement("span", {
|
|
1026
1033
|
className: "param-expiries-limit-val",
|
|
1027
1034
|
key: i
|
|
1028
|
-
}, it.expiry, /*#__PURE__*/React.createElement("span", {
|
|
1035
|
+
}, it.expiry, /*#__PURE__*/React$1.createElement("span", {
|
|
1029
1036
|
className: "param-expiries-limit-val-sep"
|
|
1030
|
-
}, "/"), 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", {
|
|
1031
1038
|
className: "param-expiries-limit-val-sep"
|
|
1032
1039
|
}, "/"), it.minAbs && it.maxAbs ? "(".concat(it.minAbs, ", ").concat(it.maxAbs, ")") : '-');
|
|
1033
|
-
}) : '-' : /*#__PURE__*/React.createElement("div", {
|
|
1040
|
+
}) : '-' : /*#__PURE__*/React$1.createElement("div", {
|
|
1034
1041
|
className: "param-expiries-limit-inputs"
|
|
1035
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
1042
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
1036
1043
|
className: "param-expiries readonly"
|
|
1037
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
1044
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
1038
1045
|
className: "param-expiries-val"
|
|
1039
|
-
}, "Expiry")), /*#__PURE__*/React.createElement("div", {
|
|
1046
|
+
}, "Expiry")), /*#__PURE__*/React$1.createElement("div", {
|
|
1040
1047
|
className: "param-number-range readonly"
|
|
1041
|
-
}, "Limit(% of AUM)"), /*#__PURE__*/React.createElement("div", {
|
|
1048
|
+
}, "Limit(% of AUM)"), /*#__PURE__*/React$1.createElement("div", {
|
|
1042
1049
|
className: "param-number-range readonly"
|
|
1043
|
-
}, "Limit(ABS)"), /*#__PURE__*/React.createElement("div", {
|
|
1050
|
+
}, "Limit(ABS)"), /*#__PURE__*/React$1.createElement("div", {
|
|
1044
1051
|
className: "param-arr-ops readonly"
|
|
1045
1052
|
}), this.value.map(function (it, i) {
|
|
1046
|
-
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
1053
|
+
return /*#__PURE__*/React$1.createElement(React$1.Fragment, {
|
|
1047
1054
|
key: i
|
|
1048
|
-
}, /*#__PURE__*/React.createElement(Expiries, {
|
|
1055
|
+
}, /*#__PURE__*/React$1.createElement(Expiries, {
|
|
1049
1056
|
multiple: false,
|
|
1050
1057
|
options: _this2.props.options,
|
|
1051
1058
|
value: [it.expiry],
|
|
@@ -1058,7 +1065,7 @@ var ExpiriesLimit = /*#__PURE__*/function (_PureComponent) {
|
|
|
1058
1065
|
});
|
|
1059
1066
|
},
|
|
1060
1067
|
onBlur: _this2.props.onBlur
|
|
1061
|
-
}), /*#__PURE__*/React.createElement(NumRange, {
|
|
1068
|
+
}), /*#__PURE__*/React$1.createElement(NumRange, {
|
|
1062
1069
|
value: {
|
|
1063
1070
|
min: it.minAumPercentage,
|
|
1064
1071
|
max: it.maxAumPercentage
|
|
@@ -1071,7 +1078,7 @@ var ExpiriesLimit = /*#__PURE__*/function (_PureComponent) {
|
|
|
1071
1078
|
},
|
|
1072
1079
|
isPercentage: true,
|
|
1073
1080
|
onBlur: _this2.props.onBlur
|
|
1074
|
-
}), /*#__PURE__*/React.createElement(NumRange, {
|
|
1081
|
+
}), /*#__PURE__*/React$1.createElement(NumRange, {
|
|
1075
1082
|
value: {
|
|
1076
1083
|
min: it.minAbs,
|
|
1077
1084
|
max: it.maxAbs
|
|
@@ -1083,12 +1090,12 @@ var ExpiriesLimit = /*#__PURE__*/function (_PureComponent) {
|
|
|
1083
1090
|
});
|
|
1084
1091
|
},
|
|
1085
1092
|
onBlur: _this2.props.onBlur
|
|
1086
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
1093
|
+
}), /*#__PURE__*/React$1.createElement("div", {
|
|
1087
1094
|
className: "param-arr-ops"
|
|
1088
|
-
}, /*#__PURE__*/React.createElement(PlusOutlined, {
|
|
1095
|
+
}, /*#__PURE__*/React$1.createElement(PlusOutlined, {
|
|
1089
1096
|
className: "param-arr-ops-add",
|
|
1090
1097
|
onClick: _this2.onAdd.bind(null, i)
|
|
1091
|
-
}), /*#__PURE__*/React.createElement(DeleteOutlined, {
|
|
1098
|
+
}), /*#__PURE__*/React$1.createElement(DeleteOutlined, {
|
|
1092
1099
|
className: "param-arr-ops-del",
|
|
1093
1100
|
onClick: _this2.onDel.bind(null, i)
|
|
1094
1101
|
})));
|
|
@@ -1103,7 +1110,7 @@ var _ParamTypeConfig;
|
|
|
1103
1110
|
var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig, ParamType.ParamGroup, {
|
|
1104
1111
|
name: '参数组',
|
|
1105
1112
|
Comp: function Comp() {
|
|
1106
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
1113
|
+
return /*#__PURE__*/React$1.createElement(React$1.Fragment, null);
|
|
1107
1114
|
}
|
|
1108
1115
|
}), _defineProperty(_ParamTypeConfig, ParamType.Number, {
|
|
1109
1116
|
name: '普通数值',
|
|
@@ -1114,7 +1121,7 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
|
|
|
1114
1121
|
name: '百分比数值',
|
|
1115
1122
|
key: 'number',
|
|
1116
1123
|
Comp: function Comp(props) {
|
|
1117
|
-
return /*#__PURE__*/React.createElement(Num, Object.assign({}, props, {
|
|
1124
|
+
return /*#__PURE__*/React$1.createElement(Num, Object.assign({}, props, {
|
|
1118
1125
|
isPercentage: true
|
|
1119
1126
|
}));
|
|
1120
1127
|
},
|
|
@@ -1133,7 +1140,7 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
|
|
|
1133
1140
|
name: '百分比范围',
|
|
1134
1141
|
key: 'range',
|
|
1135
1142
|
Comp: function Comp(props) {
|
|
1136
|
-
return /*#__PURE__*/React.createElement(NumRange, Object.assign({}, props, {
|
|
1143
|
+
return /*#__PURE__*/React$1.createElement(NumRange, Object.assign({}, props, {
|
|
1137
1144
|
isPercentage: true
|
|
1138
1145
|
}));
|
|
1139
1146
|
},
|
|
@@ -1244,7 +1251,8 @@ var ParamRenderer = /*#__PURE__*/function (_PureComponent) {
|
|
|
1244
1251
|
key: "render",
|
|
1245
1252
|
value: function render() {
|
|
1246
1253
|
var Comp = this.typeConfig.Comp;
|
|
1247
|
-
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,
|
|
1248
1256
|
value: this.value,
|
|
1249
1257
|
onChange: this.onChange,
|
|
1250
1258
|
className: classNames('param-renderer', this.props.className)
|
|
@@ -1266,8 +1274,8 @@ function ParentSelector(props) {
|
|
|
1266
1274
|
|
|
1267
1275
|
var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
1268
1276
|
$value[index] = item.value;
|
|
1269
|
-
if (String(item.value) === String(props.value)) return true;
|
|
1270
1277
|
$value.length = index + 1;
|
|
1278
|
+
if (String(item.value) === String(props.value)) return true;
|
|
1271
1279
|
return Boolean((_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.some(function (it) {
|
|
1272
1280
|
return find(it, index + 1);
|
|
1273
1281
|
}));
|
|
@@ -1279,7 +1287,8 @@ function ParentSelector(props) {
|
|
|
1279
1287
|
if (!matched) return [];
|
|
1280
1288
|
return $value;
|
|
1281
1289
|
}, [props.parentOptions, props.value]);
|
|
1282
|
-
return /*#__PURE__*/React.createElement(Cascader,
|
|
1290
|
+
return /*#__PURE__*/React$1.createElement(Cascader, {
|
|
1291
|
+
style: props.style,
|
|
1283
1292
|
disabled: props.readonly,
|
|
1284
1293
|
placeholder: '请选择',
|
|
1285
1294
|
options: props.parentOptions,
|
|
@@ -1292,7 +1301,7 @@ function ParentSelector(props) {
|
|
|
1292
1301
|
|
|
1293
1302
|
return (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, val.pop());
|
|
1294
1303
|
}
|
|
1295
|
-
})
|
|
1304
|
+
});
|
|
1296
1305
|
}
|
|
1297
1306
|
|
|
1298
1307
|
var ParamForm = /*#__PURE__*/function (_PureComponent) {
|
|
@@ -1311,69 +1320,7 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
1311
1320
|
|
|
1312
1321
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
1313
1322
|
|
|
1314
|
-
_defineProperty(_assertThisInitialized(_this), "ref", React.createRef());
|
|
1315
|
-
|
|
1316
|
-
_defineProperty(_assertThisInitialized(_this), "formItems", [{
|
|
1317
|
-
label: '所属分组',
|
|
1318
|
-
name: 'parentId',
|
|
1319
|
-
Comp: ParentSelector,
|
|
1320
|
-
required: true,
|
|
1321
|
-
validator: validatorCvt(function (val) {
|
|
1322
|
-
return emptyValidator(val);
|
|
1323
|
-
})
|
|
1324
|
-
}, {
|
|
1325
|
-
label: '参数 Key',
|
|
1326
|
-
name: 'key',
|
|
1327
|
-
Comp: function Comp(props) {
|
|
1328
|
-
return /*#__PURE__*/React.createElement(Input, Object.assign({
|
|
1329
|
-
placeholder: '请输入'
|
|
1330
|
-
}, props));
|
|
1331
|
-
},
|
|
1332
|
-
required: true,
|
|
1333
|
-
validator: validatorCvt(keyValidator)
|
|
1334
|
-
}, {
|
|
1335
|
-
label: '参数名称',
|
|
1336
|
-
name: 'name',
|
|
1337
|
-
Comp: function Comp(props) {
|
|
1338
|
-
return /*#__PURE__*/React.createElement(Input, Object.assign({
|
|
1339
|
-
placeholder: '请输入'
|
|
1340
|
-
}, props));
|
|
1341
|
-
}
|
|
1342
|
-
}, {
|
|
1343
|
-
label: '参数类型',
|
|
1344
|
-
name: 'valueType',
|
|
1345
|
-
Comp: function Comp(props) {
|
|
1346
|
-
return /*#__PURE__*/React.createElement(Select, Object.assign({
|
|
1347
|
-
placeholder: '请选择'
|
|
1348
|
-
}, props, {
|
|
1349
|
-
options: undefined
|
|
1350
|
-
}), ParamTypeOptions.map(function (it) {
|
|
1351
|
-
return /*#__PURE__*/React.createElement(Select.Option, {
|
|
1352
|
-
key: it.value,
|
|
1353
|
-
value: it.value
|
|
1354
|
-
}, it.label);
|
|
1355
|
-
}));
|
|
1356
|
-
},
|
|
1357
|
-
required: true,
|
|
1358
|
-
validator: validatorCvt(function (val) {
|
|
1359
|
-
return emptyValidator(val);
|
|
1360
|
-
})
|
|
1361
|
-
}, {
|
|
1362
|
-
label: '默认值',
|
|
1363
|
-
name: 'defaultValue',
|
|
1364
|
-
Comp: ParamRenderer,
|
|
1365
|
-
validator: validatorCvt(paramValidator, function () {
|
|
1366
|
-
return _this.ref.current;
|
|
1367
|
-
})
|
|
1368
|
-
}, {
|
|
1369
|
-
label: '参数说明',
|
|
1370
|
-
name: 'description',
|
|
1371
|
-
Comp: function Comp(props) {
|
|
1372
|
-
return /*#__PURE__*/React.createElement(Input.TextArea, Object.assign({
|
|
1373
|
-
placeholder: '请输入'
|
|
1374
|
-
}, props));
|
|
1375
|
-
}
|
|
1376
|
-
}]);
|
|
1323
|
+
_defineProperty(_assertThisInitialized(_this), "ref", React$1.createRef());
|
|
1377
1324
|
|
|
1378
1325
|
_defineProperty(_assertThisInitialized(_this), "onChange", function (changed, data) {
|
|
1379
1326
|
var _this$props$onChange, _this$props;
|
|
@@ -1386,11 +1333,85 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
1386
1333
|
}
|
|
1387
1334
|
|
|
1388
1335
|
_createClass(ParamForm, [{
|
|
1389
|
-
key: "
|
|
1390
|
-
|
|
1336
|
+
key: "formItems",
|
|
1337
|
+
get: function get() {
|
|
1391
1338
|
var _this2 = this;
|
|
1392
1339
|
|
|
1393
|
-
return
|
|
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, {
|
|
1394
1415
|
className: "param-form",
|
|
1395
1416
|
ref: this.ref,
|
|
1396
1417
|
key: JSON.stringify(this.props.initialValues),
|
|
@@ -1398,9 +1419,7 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
1398
1419
|
onFinish: this.props.onSubmit,
|
|
1399
1420
|
onValuesChange: this.onChange
|
|
1400
1421
|
}, this.formItems.map(function (it) {
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
return /*#__PURE__*/React.createElement(Form.Item, {
|
|
1422
|
+
return /*#__PURE__*/React$1.createElement(Form.Item, {
|
|
1404
1423
|
key: it.name,
|
|
1405
1424
|
label: it.label,
|
|
1406
1425
|
name: it.name,
|
|
@@ -1412,12 +1431,8 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
1412
1431
|
}
|
|
1413
1432
|
}],
|
|
1414
1433
|
validateTrigger: 'onBlur'
|
|
1415
|
-
}, /*#__PURE__*/React.createElement(it.Comp,
|
|
1416
|
-
|
|
1417
|
-
options: _this2.props.expiriesOptions,
|
|
1418
|
-
valueType: (_this2$ref$current = _this2.ref.current) === null || _this2$ref$current === void 0 ? void 0 : _this2$ref$current.getFieldValue('valueType')
|
|
1419
|
-
}));
|
|
1420
|
-
}), this.props.onSubmit && /*#__PURE__*/React.createElement(Button, {
|
|
1434
|
+
}, /*#__PURE__*/React$1.createElement(it.Comp, null));
|
|
1435
|
+
}), this.props.onSubmit && /*#__PURE__*/React$1.createElement(Button, {
|
|
1421
1436
|
type: "primary",
|
|
1422
1437
|
htmlType: "submit"
|
|
1423
1438
|
}, "\u63D0\u4EA4"));
|
|
@@ -1443,10 +1458,11 @@ var ParamFormModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
|
1443
1458
|
|
|
1444
1459
|
_this3 = _super2.call.apply(_super2, [this].concat(args));
|
|
1445
1460
|
|
|
1446
|
-
_defineProperty(_assertThisInitialized(_this3), "ref", React.createRef());
|
|
1461
|
+
_defineProperty(_assertThisInitialized(_this3), "ref", React$1.createRef());
|
|
1447
1462
|
|
|
1448
1463
|
_defineProperty(_assertThisInitialized(_this3), "state", {
|
|
1449
|
-
visible: false
|
|
1464
|
+
visible: false,
|
|
1465
|
+
pending: false
|
|
1450
1466
|
});
|
|
1451
1467
|
|
|
1452
1468
|
_defineProperty(_assertThisInitialized(_this3), "onShow", function () {
|
|
@@ -1464,30 +1480,52 @@ var ParamFormModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
|
1464
1480
|
_defineProperty(_assertThisInitialized(_this3), "onSubmit", function () {
|
|
1465
1481
|
var form = _this3.ref.current.ref.current;
|
|
1466
1482
|
return form.validateFields().then(function () {
|
|
1467
|
-
return _this3.
|
|
1468
|
-
|
|
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
|
+
});
|
|
1469
1500
|
});
|
|
1470
1501
|
|
|
1471
1502
|
return _this3;
|
|
1472
1503
|
}
|
|
1473
1504
|
|
|
1474
1505
|
_createClass(ParamFormModalEl, [{
|
|
1475
|
-
key: "
|
|
1476
|
-
|
|
1506
|
+
key: "isEdit",
|
|
1507
|
+
get: function get() {
|
|
1477
1508
|
var _this$props$initialVa;
|
|
1478
1509
|
|
|
1479
|
-
return
|
|
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, {
|
|
1516
|
+
key: String(this.state.visible),
|
|
1480
1517
|
width: 640,
|
|
1481
1518
|
closable: false,
|
|
1482
|
-
title: !
|
|
1519
|
+
title: !this.isEdit ? '新增参数' : '修改参数',
|
|
1483
1520
|
visible: this.state.visible,
|
|
1484
|
-
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, {
|
|
1485
1522
|
onClick: this.onHide
|
|
1486
|
-
}, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
|
|
1523
|
+
}, "\u53D6\u6D88"), /*#__PURE__*/React$1.createElement(Button, {
|
|
1487
1524
|
type: "primary",
|
|
1488
|
-
onClick: this.onSubmit
|
|
1525
|
+
onClick: this.onSubmit,
|
|
1526
|
+
loading: this.state.pending
|
|
1489
1527
|
}, "\u786E\u8BA4"))
|
|
1490
|
-
}, /*#__PURE__*/React.createElement(ParamForm, Object.assign({}, this.props, {
|
|
1528
|
+
}, /*#__PURE__*/React$1.createElement(ParamForm, Object.assign({}, this.props, {
|
|
1491
1529
|
ref: this.ref,
|
|
1492
1530
|
onSubmit: undefined
|
|
1493
1531
|
})));
|
|
@@ -1539,47 +1577,7 @@ var ParamValueEditor = /*#__PURE__*/function (_PureComponent) {
|
|
|
1539
1577
|
|
|
1540
1578
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
1541
1579
|
|
|
1542
|
-
_defineProperty(_assertThisInitialized(_this), "ref", React.createRef());
|
|
1543
|
-
|
|
1544
|
-
_defineProperty(_assertThisInitialized(_this), "formItems", [{
|
|
1545
|
-
label: 'Parameter',
|
|
1546
|
-
name: 'paramId',
|
|
1547
|
-
Comp: function Comp(props) {
|
|
1548
|
-
return /*#__PURE__*/React.createElement(ParentSelector, Object.assign({}, props, {
|
|
1549
|
-
readonly: true
|
|
1550
|
-
}));
|
|
1551
|
-
}
|
|
1552
|
-
}, {
|
|
1553
|
-
label: 'Description',
|
|
1554
|
-
name: 'description',
|
|
1555
|
-
Comp: function Comp(props) {
|
|
1556
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
1557
|
-
className: "param-value-editor-desc",
|
|
1558
|
-
style: {
|
|
1559
|
-
lineHeight: '20px',
|
|
1560
|
-
padding: '10px 0'
|
|
1561
|
-
}
|
|
1562
|
-
}, props.value || '-');
|
|
1563
|
-
}
|
|
1564
|
-
}, {
|
|
1565
|
-
label: 'Value before',
|
|
1566
|
-
name: 'valueBefore',
|
|
1567
|
-
Comp: function Comp(props) {
|
|
1568
|
-
return /*#__PURE__*/React.createElement(ParamRenderer, Object.assign({}, props, {
|
|
1569
|
-
readonly: true
|
|
1570
|
-
}));
|
|
1571
|
-
}
|
|
1572
|
-
}, {
|
|
1573
|
-
label: 'Value after',
|
|
1574
|
-
name: 'value',
|
|
1575
|
-
Comp: ParamRenderer,
|
|
1576
|
-
required: true,
|
|
1577
|
-
validator: validatorCvt(function (val) {
|
|
1578
|
-
return paramValidator(val, {
|
|
1579
|
-
valueType: _this.props.valueType
|
|
1580
|
-
});
|
|
1581
|
-
})
|
|
1582
|
-
}]);
|
|
1580
|
+
_defineProperty(_assertThisInitialized(_this), "ref", React$1.createRef());
|
|
1583
1581
|
|
|
1584
1582
|
_defineProperty(_assertThisInitialized(_this), "onChange", function (changed, data) {
|
|
1585
1583
|
var _this$props$onChange, _this$props;
|
|
@@ -1591,11 +1589,60 @@ var ParamValueEditor = /*#__PURE__*/function (_PureComponent) {
|
|
|
1591
1589
|
}
|
|
1592
1590
|
|
|
1593
1591
|
_createClass(ParamValueEditor, [{
|
|
1594
|
-
key: "
|
|
1595
|
-
|
|
1592
|
+
key: "formItems",
|
|
1593
|
+
get: function get() {
|
|
1596
1594
|
var _this2 = this;
|
|
1597
1595
|
|
|
1598
|
-
return
|
|
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
|
+
}];
|
|
1641
|
+
}
|
|
1642
|
+
}, {
|
|
1643
|
+
key: "render",
|
|
1644
|
+
value: function render() {
|
|
1645
|
+
return /*#__PURE__*/React$1.createElement(Form, {
|
|
1599
1646
|
className: "param-value-editor",
|
|
1600
1647
|
ref: this.ref,
|
|
1601
1648
|
key: this.props.valueType,
|
|
@@ -1603,7 +1650,7 @@ var ParamValueEditor = /*#__PURE__*/function (_PureComponent) {
|
|
|
1603
1650
|
onFinish: this.props.onSubmit,
|
|
1604
1651
|
onValuesChange: this.onChange
|
|
1605
1652
|
}, this.formItems.map(function (it) {
|
|
1606
|
-
return /*#__PURE__*/React.createElement(Form.Item, {
|
|
1653
|
+
return /*#__PURE__*/React$1.createElement(Form.Item, {
|
|
1607
1654
|
key: it.name,
|
|
1608
1655
|
label: it.label,
|
|
1609
1656
|
name: it.name,
|
|
@@ -1615,11 +1662,8 @@ var ParamValueEditor = /*#__PURE__*/function (_PureComponent) {
|
|
|
1615
1662
|
}
|
|
1616
1663
|
}],
|
|
1617
1664
|
validateTrigger: 'onBlur'
|
|
1618
|
-
}, /*#__PURE__*/React.createElement(it.Comp,
|
|
1619
|
-
|
|
1620
|
-
valueType: _this2.props.valueType
|
|
1621
|
-
}));
|
|
1622
|
-
}), this.props.onSubmit && /*#__PURE__*/React.createElement(Button, {
|
|
1665
|
+
}, /*#__PURE__*/React$1.createElement(it.Comp, null));
|
|
1666
|
+
}), this.props.onSubmit && /*#__PURE__*/React$1.createElement(Button, {
|
|
1623
1667
|
type: "primary",
|
|
1624
1668
|
htmlType: "submit"
|
|
1625
1669
|
}, "\u63D0\u4EA4"));
|
|
@@ -1644,10 +1688,11 @@ var ParamValueEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
|
1644
1688
|
|
|
1645
1689
|
_this3 = _super2.call.apply(_super2, [this].concat(args));
|
|
1646
1690
|
|
|
1647
|
-
_defineProperty(_assertThisInitialized(_this3), "ref", React.createRef());
|
|
1691
|
+
_defineProperty(_assertThisInitialized(_this3), "ref", React$1.createRef());
|
|
1648
1692
|
|
|
1649
1693
|
_defineProperty(_assertThisInitialized(_this3), "state", {
|
|
1650
|
-
visible: false
|
|
1694
|
+
visible: false,
|
|
1695
|
+
pending: false
|
|
1651
1696
|
});
|
|
1652
1697
|
|
|
1653
1698
|
_defineProperty(_assertThisInitialized(_this3), "onShow", function () {
|
|
@@ -1665,8 +1710,23 @@ var ParamValueEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
|
1665
1710
|
_defineProperty(_assertThisInitialized(_this3), "onSubmit", function () {
|
|
1666
1711
|
var form = _this3.ref.current.ref.current;
|
|
1667
1712
|
return form.validateFields().then(function () {
|
|
1668
|
-
return _this3.
|
|
1669
|
-
|
|
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
|
+
});
|
|
1670
1730
|
});
|
|
1671
1731
|
|
|
1672
1732
|
return _this3;
|
|
@@ -1675,18 +1735,20 @@ var ParamValueEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
|
1675
1735
|
_createClass(ParamValueEditorModalEl, [{
|
|
1676
1736
|
key: "render",
|
|
1677
1737
|
value: function render() {
|
|
1678
|
-
return /*#__PURE__*/React.createElement(Modal, {
|
|
1738
|
+
return /*#__PURE__*/React$1.createElement(Modal, {
|
|
1739
|
+
key: String(this.state.visible),
|
|
1679
1740
|
width: 640,
|
|
1680
1741
|
title: 'Edit Value',
|
|
1681
1742
|
closable: false,
|
|
1682
1743
|
visible: this.state.visible,
|
|
1683
|
-
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, {
|
|
1684
1745
|
onClick: this.onHide
|
|
1685
|
-
}, "Cancel"), /*#__PURE__*/React.createElement(Button, {
|
|
1746
|
+
}, "Cancel"), /*#__PURE__*/React$1.createElement(Button, {
|
|
1686
1747
|
type: "primary",
|
|
1687
|
-
onClick: this.onSubmit
|
|
1748
|
+
onClick: this.onSubmit,
|
|
1749
|
+
loading: this.state.pending
|
|
1688
1750
|
}, "Submit"))
|
|
1689
|
-
}, /*#__PURE__*/React.createElement(ParamValueEditor, Object.assign({}, this.props, {
|
|
1751
|
+
}, /*#__PURE__*/React$1.createElement(ParamValueEditor, Object.assign({}, this.props, {
|
|
1690
1752
|
ref: this.ref,
|
|
1691
1753
|
onSubmit: undefined
|
|
1692
1754
|
})));
|
|
@@ -1721,4 +1783,279 @@ var ParamValueEditorModal = /*#__PURE__*/function () {
|
|
|
1721
1783
|
|
|
1722
1784
|
_defineProperty(ParamValueEditorModal, "el", new ReactGlobalComp('param-value-editor-modal', ParamValueEditorModalEl));
|
|
1723
1785
|
|
|
1724
|
-
|
|
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 };
|