@signalplus/params-about 0.1.2 → 0.1.5
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 +121 -6
- package/lib/css/Expiries.scss +3 -3
- package/lib/css/Num.scss +0 -3
- 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/es/index.js +839 -228
- package/package.json +8 -1
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.5
|
|
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
|
|
@@ -563,7 +566,7 @@ var NumCvt = /*#__PURE__*/function () {
|
|
|
563
566
|
return NumCvt;
|
|
564
567
|
}();
|
|
565
568
|
|
|
566
|
-
function initState(props) {
|
|
569
|
+
function initState$1(props) {
|
|
567
570
|
return {
|
|
568
571
|
preProps: props,
|
|
569
572
|
tempValue: NumCvt.show(props.value, props.isPercentage)
|
|
@@ -586,7 +589,7 @@ var Num = /*#__PURE__*/function (_PureComponent) {
|
|
|
586
589
|
|
|
587
590
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
588
591
|
|
|
589
|
-
_defineProperty(_assertThisInitialized(_this), "state", initState(_this.props));
|
|
592
|
+
_defineProperty(_assertThisInitialized(_this), "state", initState$1(_this.props));
|
|
590
593
|
|
|
591
594
|
_defineProperty(_assertThisInitialized(_this), "onChange", function (e) {
|
|
592
595
|
var $value = e.target.value;
|
|
@@ -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)
|
|
@@ -1260,33 +1264,55 @@ var ParamRenderer = /*#__PURE__*/function (_PureComponent) {
|
|
|
1260
1264
|
}(PureComponent);
|
|
1261
1265
|
|
|
1262
1266
|
function ParentSelector(props) {
|
|
1263
|
-
var
|
|
1267
|
+
var _useMemo = useMemo(function () {
|
|
1264
1268
|
var _props$parentOptions;
|
|
1265
1269
|
|
|
1266
1270
|
var $value = [];
|
|
1267
1271
|
|
|
1272
|
+
var cvt = function cvt(it) {
|
|
1273
|
+
var _it$children;
|
|
1274
|
+
|
|
1275
|
+
return _objectSpread2(_objectSpread2({}, it), {}, {
|
|
1276
|
+
label: it.name,
|
|
1277
|
+
value: String(it.$paramId),
|
|
1278
|
+
children: (_it$children = it.children) === null || _it$children === void 0 ? void 0 : _it$children.map(cvt)
|
|
1279
|
+
});
|
|
1280
|
+
};
|
|
1281
|
+
|
|
1282
|
+
var $options = ((_props$parentOptions = props.parentOptions) === null || _props$parentOptions === void 0 ? void 0 : _props$parentOptions.map(cvt)) || [];
|
|
1283
|
+
|
|
1268
1284
|
var find = function find(item) {
|
|
1269
1285
|
var _item$children;
|
|
1270
1286
|
|
|
1271
1287
|
var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
1272
1288
|
$value[index] = item.value;
|
|
1273
|
-
if (String(item.value) === String(props.value)) return true;
|
|
1274
1289
|
$value.length = index + 1;
|
|
1290
|
+
if (String(item.value) === String(props.value)) return true;
|
|
1275
1291
|
return Boolean((_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.some(function (it) {
|
|
1276
1292
|
return find(it, index + 1);
|
|
1277
1293
|
}));
|
|
1278
1294
|
};
|
|
1279
1295
|
|
|
1280
|
-
var matched = props.value &&
|
|
1296
|
+
var matched = props.value && $options.some(function (it) {
|
|
1281
1297
|
return find(it);
|
|
1282
|
-
})
|
|
1283
|
-
if (!matched) return
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1298
|
+
});
|
|
1299
|
+
if (!matched) return {
|
|
1300
|
+
value: [],
|
|
1301
|
+
options: $options
|
|
1302
|
+
};
|
|
1303
|
+
return {
|
|
1304
|
+
value: $value,
|
|
1305
|
+
options: $options
|
|
1306
|
+
};
|
|
1307
|
+
}, [props.parentOptions, props.value]),
|
|
1308
|
+
value = _useMemo.value,
|
|
1309
|
+
options = _useMemo.options;
|
|
1310
|
+
|
|
1311
|
+
return /*#__PURE__*/React$1.createElement(Cascader, {
|
|
1312
|
+
style: props.style,
|
|
1287
1313
|
disabled: props.readonly,
|
|
1288
1314
|
placeholder: '请选择',
|
|
1289
|
-
options:
|
|
1315
|
+
options: options,
|
|
1290
1316
|
className: classNames('param-parent-selector', {
|
|
1291
1317
|
readonly: props.readonly
|
|
1292
1318
|
}, props.className),
|
|
@@ -1296,7 +1322,7 @@ function ParentSelector(props) {
|
|
|
1296
1322
|
|
|
1297
1323
|
return (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, val.pop());
|
|
1298
1324
|
}
|
|
1299
|
-
})
|
|
1325
|
+
});
|
|
1300
1326
|
}
|
|
1301
1327
|
|
|
1302
1328
|
var ParamForm = /*#__PURE__*/function (_PureComponent) {
|
|
@@ -1315,69 +1341,7 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
1315
1341
|
|
|
1316
1342
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
1317
1343
|
|
|
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
|
-
}]);
|
|
1344
|
+
_defineProperty(_assertThisInitialized(_this), "ref", React$1.createRef());
|
|
1381
1345
|
|
|
1382
1346
|
_defineProperty(_assertThisInitialized(_this), "onChange", function (changed, data) {
|
|
1383
1347
|
var _this$props$onChange, _this$props;
|
|
@@ -1390,11 +1354,85 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
1390
1354
|
}
|
|
1391
1355
|
|
|
1392
1356
|
_createClass(ParamForm, [{
|
|
1393
|
-
key: "
|
|
1394
|
-
|
|
1357
|
+
key: "formItems",
|
|
1358
|
+
get: function get() {
|
|
1395
1359
|
var _this2 = this;
|
|
1396
1360
|
|
|
1397
|
-
return
|
|
1361
|
+
return [{
|
|
1362
|
+
label: '所属分组',
|
|
1363
|
+
name: 'parentId',
|
|
1364
|
+
Comp: function Comp(props) {
|
|
1365
|
+
return /*#__PURE__*/React$1.createElement(ParentSelector, Object.assign({}, props, {
|
|
1366
|
+
parentOptions: _this2.props.parentOptions
|
|
1367
|
+
}));
|
|
1368
|
+
},
|
|
1369
|
+
required: true,
|
|
1370
|
+
validator: validatorCvt(function (val) {
|
|
1371
|
+
return emptyValidator(val);
|
|
1372
|
+
})
|
|
1373
|
+
}, {
|
|
1374
|
+
label: '参数 Key',
|
|
1375
|
+
name: 'key',
|
|
1376
|
+
Comp: function Comp(props) {
|
|
1377
|
+
return /*#__PURE__*/React$1.createElement(Input, Object.assign({
|
|
1378
|
+
placeholder: '请输入'
|
|
1379
|
+
}, props));
|
|
1380
|
+
},
|
|
1381
|
+
required: true,
|
|
1382
|
+
validator: validatorCvt(keyValidator)
|
|
1383
|
+
}, {
|
|
1384
|
+
label: '参数名称',
|
|
1385
|
+
name: 'name',
|
|
1386
|
+
Comp: function Comp(props) {
|
|
1387
|
+
return /*#__PURE__*/React$1.createElement(Input, Object.assign({
|
|
1388
|
+
placeholder: '请输入'
|
|
1389
|
+
}, props));
|
|
1390
|
+
}
|
|
1391
|
+
}, {
|
|
1392
|
+
label: '参数类型',
|
|
1393
|
+
name: 'valueType',
|
|
1394
|
+
Comp: function Comp(props) {
|
|
1395
|
+
return /*#__PURE__*/React$1.createElement(Select, Object.assign({
|
|
1396
|
+
placeholder: '请选择'
|
|
1397
|
+
}, props), ParamTypeOptions.map(function (it) {
|
|
1398
|
+
return /*#__PURE__*/React$1.createElement(Select.Option, {
|
|
1399
|
+
key: it.value,
|
|
1400
|
+
value: it.value
|
|
1401
|
+
}, it.label);
|
|
1402
|
+
}));
|
|
1403
|
+
},
|
|
1404
|
+
required: true,
|
|
1405
|
+
validator: validatorCvt(function (val) {
|
|
1406
|
+
return emptyValidator(val);
|
|
1407
|
+
})
|
|
1408
|
+
}, {
|
|
1409
|
+
label: '默认值',
|
|
1410
|
+
name: 'defaultValue',
|
|
1411
|
+
Comp: function Comp(props) {
|
|
1412
|
+
var _this2$ref$current;
|
|
1413
|
+
|
|
1414
|
+
return /*#__PURE__*/React$1.createElement(ParamRenderer, Object.assign({}, props, {
|
|
1415
|
+
expiriesOptions: _this2.props.expiriesOptions,
|
|
1416
|
+
valueType: (_this2$ref$current = _this2.ref.current) === null || _this2$ref$current === void 0 ? void 0 : _this2$ref$current.getFieldValue('valueType')
|
|
1417
|
+
}));
|
|
1418
|
+
},
|
|
1419
|
+
validator: validatorCvt(paramValidator, function () {
|
|
1420
|
+
return _this2.ref.current;
|
|
1421
|
+
})
|
|
1422
|
+
}, {
|
|
1423
|
+
label: '参数说明',
|
|
1424
|
+
name: 'description',
|
|
1425
|
+
Comp: function Comp(props) {
|
|
1426
|
+
return /*#__PURE__*/React$1.createElement(Input.TextArea, Object.assign({
|
|
1427
|
+
placeholder: '请输入'
|
|
1428
|
+
}, props));
|
|
1429
|
+
}
|
|
1430
|
+
}];
|
|
1431
|
+
}
|
|
1432
|
+
}, {
|
|
1433
|
+
key: "render",
|
|
1434
|
+
value: function render() {
|
|
1435
|
+
return /*#__PURE__*/React$1.createElement(Form, {
|
|
1398
1436
|
className: "param-form",
|
|
1399
1437
|
ref: this.ref,
|
|
1400
1438
|
key: JSON.stringify(this.props.initialValues),
|
|
@@ -1402,9 +1440,7 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
1402
1440
|
onFinish: this.props.onSubmit,
|
|
1403
1441
|
onValuesChange: this.onChange
|
|
1404
1442
|
}, this.formItems.map(function (it) {
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
return /*#__PURE__*/React.createElement(Form.Item, {
|
|
1443
|
+
return /*#__PURE__*/React$1.createElement(Form.Item, {
|
|
1408
1444
|
key: it.name,
|
|
1409
1445
|
label: it.label,
|
|
1410
1446
|
name: it.name,
|
|
@@ -1416,12 +1452,8 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
1416
1452
|
}
|
|
1417
1453
|
}],
|
|
1418
1454
|
validateTrigger: 'onBlur'
|
|
1419
|
-
}, /*#__PURE__*/React.createElement(it.Comp,
|
|
1420
|
-
|
|
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, {
|
|
1455
|
+
}, /*#__PURE__*/React$1.createElement(it.Comp, null));
|
|
1456
|
+
}), this.props.onSubmit && /*#__PURE__*/React$1.createElement(Button, {
|
|
1425
1457
|
type: "primary",
|
|
1426
1458
|
htmlType: "submit"
|
|
1427
1459
|
}, "\u63D0\u4EA4"));
|
|
@@ -1447,10 +1479,11 @@ var ParamFormModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
|
1447
1479
|
|
|
1448
1480
|
_this3 = _super2.call.apply(_super2, [this].concat(args));
|
|
1449
1481
|
|
|
1450
|
-
_defineProperty(_assertThisInitialized(_this3), "ref", React.createRef());
|
|
1482
|
+
_defineProperty(_assertThisInitialized(_this3), "ref", React$1.createRef());
|
|
1451
1483
|
|
|
1452
1484
|
_defineProperty(_assertThisInitialized(_this3), "state", {
|
|
1453
|
-
visible: false
|
|
1485
|
+
visible: false,
|
|
1486
|
+
pending: false
|
|
1454
1487
|
});
|
|
1455
1488
|
|
|
1456
1489
|
_defineProperty(_assertThisInitialized(_this3), "onShow", function () {
|
|
@@ -1468,31 +1501,52 @@ var ParamFormModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
|
1468
1501
|
_defineProperty(_assertThisInitialized(_this3), "onSubmit", function () {
|
|
1469
1502
|
var form = _this3.ref.current.ref.current;
|
|
1470
1503
|
return form.validateFields().then(function () {
|
|
1471
|
-
return _this3.
|
|
1472
|
-
|
|
1504
|
+
return _this3.setState({
|
|
1505
|
+
pending: true
|
|
1506
|
+
});
|
|
1507
|
+
}).then(function () {
|
|
1508
|
+
var data = _objectSpread2(_objectSpread2({}, _this3.props.initialValues), form.getFieldsValue());
|
|
1509
|
+
|
|
1510
|
+
if (_this3.isEdit && isEqual(data, _this3.props.initialValues)) {
|
|
1511
|
+
message.warning('请修改后再提交');
|
|
1512
|
+
return Promise.reject();
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
return _this3.props.onSubmit(data);
|
|
1516
|
+
}).then(_this3.onHide).finally(function () {
|
|
1517
|
+
return _this3.setState({
|
|
1518
|
+
pending: false
|
|
1519
|
+
});
|
|
1520
|
+
});
|
|
1473
1521
|
});
|
|
1474
1522
|
|
|
1475
1523
|
return _this3;
|
|
1476
1524
|
}
|
|
1477
1525
|
|
|
1478
1526
|
_createClass(ParamFormModalEl, [{
|
|
1479
|
-
key: "
|
|
1480
|
-
|
|
1527
|
+
key: "isEdit",
|
|
1528
|
+
get: function get() {
|
|
1481
1529
|
var _this$props$initialVa;
|
|
1482
1530
|
|
|
1483
|
-
return
|
|
1531
|
+
return Boolean((_this$props$initialVa = this.props.initialValues) === null || _this$props$initialVa === void 0 ? void 0 : _this$props$initialVa.paramId);
|
|
1532
|
+
}
|
|
1533
|
+
}, {
|
|
1534
|
+
key: "render",
|
|
1535
|
+
value: function render() {
|
|
1536
|
+
return /*#__PURE__*/React$1.createElement(Modal, {
|
|
1537
|
+
key: String(this.state.visible),
|
|
1484
1538
|
width: 640,
|
|
1485
1539
|
closable: false,
|
|
1486
|
-
title: !
|
|
1540
|
+
title: !this.isEdit ? '新增参数' : '修改参数',
|
|
1487
1541
|
visible: this.state.visible,
|
|
1488
|
-
footer: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
1542
|
+
footer: /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(Button, {
|
|
1489
1543
|
onClick: this.onHide
|
|
1490
|
-
}, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
|
|
1544
|
+
}, "\u53D6\u6D88"), /*#__PURE__*/React$1.createElement(Button, {
|
|
1491
1545
|
type: "primary",
|
|
1492
|
-
onClick: this.onSubmit
|
|
1546
|
+
onClick: this.onSubmit,
|
|
1547
|
+
loading: this.state.pending
|
|
1493
1548
|
}, "\u786E\u8BA4"))
|
|
1494
|
-
}, /*#__PURE__*/React.createElement(ParamForm, Object.assign({}, this.props, {
|
|
1495
|
-
key: String(this.state.visible),
|
|
1549
|
+
}, /*#__PURE__*/React$1.createElement(ParamForm, Object.assign({}, this.props, {
|
|
1496
1550
|
ref: this.ref,
|
|
1497
1551
|
onSubmit: undefined
|
|
1498
1552
|
})));
|
|
@@ -1544,47 +1598,7 @@ var ParamValueEditor = /*#__PURE__*/function (_PureComponent) {
|
|
|
1544
1598
|
|
|
1545
1599
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
1546
1600
|
|
|
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
|
-
}]);
|
|
1601
|
+
_defineProperty(_assertThisInitialized(_this), "ref", React$1.createRef());
|
|
1588
1602
|
|
|
1589
1603
|
_defineProperty(_assertThisInitialized(_this), "onChange", function (changed, data) {
|
|
1590
1604
|
var _this$props$onChange, _this$props;
|
|
@@ -1596,11 +1610,60 @@ var ParamValueEditor = /*#__PURE__*/function (_PureComponent) {
|
|
|
1596
1610
|
}
|
|
1597
1611
|
|
|
1598
1612
|
_createClass(ParamValueEditor, [{
|
|
1599
|
-
key: "
|
|
1600
|
-
|
|
1613
|
+
key: "formItems",
|
|
1614
|
+
get: function get() {
|
|
1601
1615
|
var _this2 = this;
|
|
1602
1616
|
|
|
1603
|
-
return
|
|
1617
|
+
return [{
|
|
1618
|
+
label: 'Parameter',
|
|
1619
|
+
name: 'paramId',
|
|
1620
|
+
Comp: function Comp(props) {
|
|
1621
|
+
return /*#__PURE__*/React$1.createElement(ParentSelector, Object.assign({}, props, {
|
|
1622
|
+
readonly: true
|
|
1623
|
+
}));
|
|
1624
|
+
}
|
|
1625
|
+
}, {
|
|
1626
|
+
label: 'Description',
|
|
1627
|
+
name: 'description',
|
|
1628
|
+
Comp: function Comp(props) {
|
|
1629
|
+
return /*#__PURE__*/React$1.createElement("span", {
|
|
1630
|
+
className: "param-value-editor-desc",
|
|
1631
|
+
style: {
|
|
1632
|
+
lineHeight: '20px',
|
|
1633
|
+
padding: '10px 0'
|
|
1634
|
+
}
|
|
1635
|
+
}, props.value || '-');
|
|
1636
|
+
}
|
|
1637
|
+
}, {
|
|
1638
|
+
label: 'Value before',
|
|
1639
|
+
name: 'valueBefore',
|
|
1640
|
+
Comp: function Comp(props) {
|
|
1641
|
+
return /*#__PURE__*/React$1.createElement(ParamRenderer, Object.assign({}, props, {
|
|
1642
|
+
readonly: true,
|
|
1643
|
+
parentOptions: _this2.props.allParams
|
|
1644
|
+
}));
|
|
1645
|
+
}
|
|
1646
|
+
}, {
|
|
1647
|
+
label: 'Value after',
|
|
1648
|
+
name: 'value',
|
|
1649
|
+
Comp: function Comp(props) {
|
|
1650
|
+
return /*#__PURE__*/React$1.createElement(ParamRenderer, Object.assign({}, props, {
|
|
1651
|
+
expiriesOptions: _this2.props.expiriesOptions,
|
|
1652
|
+
valueType: _this2.props.valueType
|
|
1653
|
+
}));
|
|
1654
|
+
},
|
|
1655
|
+
required: true,
|
|
1656
|
+
validator: validatorCvt(function (val) {
|
|
1657
|
+
return paramValidator(val, {
|
|
1658
|
+
valueType: _this2.props.valueType
|
|
1659
|
+
});
|
|
1660
|
+
})
|
|
1661
|
+
}];
|
|
1662
|
+
}
|
|
1663
|
+
}, {
|
|
1664
|
+
key: "render",
|
|
1665
|
+
value: function render() {
|
|
1666
|
+
return /*#__PURE__*/React$1.createElement(Form, {
|
|
1604
1667
|
className: "param-value-editor",
|
|
1605
1668
|
ref: this.ref,
|
|
1606
1669
|
key: this.props.valueType,
|
|
@@ -1608,7 +1671,7 @@ var ParamValueEditor = /*#__PURE__*/function (_PureComponent) {
|
|
|
1608
1671
|
onFinish: this.props.onSubmit,
|
|
1609
1672
|
onValuesChange: this.onChange
|
|
1610
1673
|
}, this.formItems.map(function (it) {
|
|
1611
|
-
return /*#__PURE__*/React.createElement(Form.Item, {
|
|
1674
|
+
return /*#__PURE__*/React$1.createElement(Form.Item, {
|
|
1612
1675
|
key: it.name,
|
|
1613
1676
|
label: it.label,
|
|
1614
1677
|
name: it.name,
|
|
@@ -1620,11 +1683,8 @@ var ParamValueEditor = /*#__PURE__*/function (_PureComponent) {
|
|
|
1620
1683
|
}
|
|
1621
1684
|
}],
|
|
1622
1685
|
validateTrigger: 'onBlur'
|
|
1623
|
-
}, /*#__PURE__*/React.createElement(it.Comp,
|
|
1624
|
-
|
|
1625
|
-
valueType: _this2.props.valueType
|
|
1626
|
-
}));
|
|
1627
|
-
}), this.props.onSubmit && /*#__PURE__*/React.createElement(Button, {
|
|
1686
|
+
}, /*#__PURE__*/React$1.createElement(it.Comp, null));
|
|
1687
|
+
}), this.props.onSubmit && /*#__PURE__*/React$1.createElement(Button, {
|
|
1628
1688
|
type: "primary",
|
|
1629
1689
|
htmlType: "submit"
|
|
1630
1690
|
}, "\u63D0\u4EA4"));
|
|
@@ -1649,10 +1709,11 @@ var ParamValueEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
|
1649
1709
|
|
|
1650
1710
|
_this3 = _super2.call.apply(_super2, [this].concat(args));
|
|
1651
1711
|
|
|
1652
|
-
_defineProperty(_assertThisInitialized(_this3), "ref", React.createRef());
|
|
1712
|
+
_defineProperty(_assertThisInitialized(_this3), "ref", React$1.createRef());
|
|
1653
1713
|
|
|
1654
1714
|
_defineProperty(_assertThisInitialized(_this3), "state", {
|
|
1655
|
-
visible: false
|
|
1715
|
+
visible: false,
|
|
1716
|
+
pending: false
|
|
1656
1717
|
});
|
|
1657
1718
|
|
|
1658
1719
|
_defineProperty(_assertThisInitialized(_this3), "onShow", function () {
|
|
@@ -1670,8 +1731,23 @@ var ParamValueEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
|
1670
1731
|
_defineProperty(_assertThisInitialized(_this3), "onSubmit", function () {
|
|
1671
1732
|
var form = _this3.ref.current.ref.current;
|
|
1672
1733
|
return form.validateFields().then(function () {
|
|
1673
|
-
return _this3.
|
|
1674
|
-
|
|
1734
|
+
return _this3.setState({
|
|
1735
|
+
pending: true
|
|
1736
|
+
});
|
|
1737
|
+
}).then(function () {
|
|
1738
|
+
var data = _objectSpread2(_objectSpread2({}, _this3.props.initialValues), form.getFieldsValue());
|
|
1739
|
+
|
|
1740
|
+
if (isEqual(data, _this3.props.initialValues)) {
|
|
1741
|
+
message.warning('请修改后再提交');
|
|
1742
|
+
return Promise.reject();
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
return _this3.props.onSubmit(data);
|
|
1746
|
+
}).then(_this3.onHide).finally(function () {
|
|
1747
|
+
return _this3.setState({
|
|
1748
|
+
pending: false
|
|
1749
|
+
});
|
|
1750
|
+
});
|
|
1675
1751
|
});
|
|
1676
1752
|
|
|
1677
1753
|
return _this3;
|
|
@@ -1680,19 +1756,20 @@ var ParamValueEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
|
1680
1756
|
_createClass(ParamValueEditorModalEl, [{
|
|
1681
1757
|
key: "render",
|
|
1682
1758
|
value: function render() {
|
|
1683
|
-
return /*#__PURE__*/React.createElement(Modal, {
|
|
1759
|
+
return /*#__PURE__*/React$1.createElement(Modal, {
|
|
1760
|
+
key: String(this.state.visible),
|
|
1684
1761
|
width: 640,
|
|
1685
1762
|
title: 'Edit Value',
|
|
1686
1763
|
closable: false,
|
|
1687
1764
|
visible: this.state.visible,
|
|
1688
|
-
footer: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
1765
|
+
footer: /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(Button, {
|
|
1689
1766
|
onClick: this.onHide
|
|
1690
|
-
}, "Cancel"), /*#__PURE__*/React.createElement(Button, {
|
|
1767
|
+
}, "Cancel"), /*#__PURE__*/React$1.createElement(Button, {
|
|
1691
1768
|
type: "primary",
|
|
1692
|
-
onClick: this.onSubmit
|
|
1769
|
+
onClick: this.onSubmit,
|
|
1770
|
+
loading: this.state.pending
|
|
1693
1771
|
}, "Submit"))
|
|
1694
|
-
}, /*#__PURE__*/React.createElement(ParamValueEditor, Object.assign({}, this.props, {
|
|
1695
|
-
key: String(this.state.visible),
|
|
1772
|
+
}, /*#__PURE__*/React$1.createElement(ParamValueEditor, Object.assign({}, this.props, {
|
|
1696
1773
|
ref: this.ref,
|
|
1697
1774
|
onSubmit: undefined
|
|
1698
1775
|
})));
|
|
@@ -1727,4 +1804,538 @@ var ParamValueEditorModal = /*#__PURE__*/function () {
|
|
|
1727
1804
|
|
|
1728
1805
|
_defineProperty(ParamValueEditorModal, "el", new ReactGlobalComp('param-value-editor-modal', ParamValueEditorModalEl));
|
|
1729
1806
|
|
|
1730
|
-
|
|
1807
|
+
var ImageUpload = function ImageUpload(props) {
|
|
1808
|
+
var _useRequest = useRequest(function () {
|
|
1809
|
+
var _props$getSignedUrl;
|
|
1810
|
+
|
|
1811
|
+
return Promise.resolve(props.value && ((_props$getSignedUrl = props.getSignedUrl) === null || _props$getSignedUrl === void 0 ? void 0 : _props$getSignedUrl.call(props, props.value)));
|
|
1812
|
+
}, {
|
|
1813
|
+
refreshDeps: [props.value]
|
|
1814
|
+
}),
|
|
1815
|
+
url = _useRequest.data;
|
|
1816
|
+
|
|
1817
|
+
var _useState = useState(function () {
|
|
1818
|
+
return url ? [{
|
|
1819
|
+
url: url
|
|
1820
|
+
}] : [];
|
|
1821
|
+
}),
|
|
1822
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1823
|
+
files = _useState2[0],
|
|
1824
|
+
setFiles = _useState2[1];
|
|
1825
|
+
|
|
1826
|
+
useEffect(function () {
|
|
1827
|
+
return setFiles(url ? [{
|
|
1828
|
+
url: url
|
|
1829
|
+
}] : []);
|
|
1830
|
+
}, [url]);
|
|
1831
|
+
|
|
1832
|
+
var _useRequest2 = useRequest(function ($files) {
|
|
1833
|
+
var _$files$, _props$handleUpload, _props$onChange2;
|
|
1834
|
+
|
|
1835
|
+
setFiles($files);
|
|
1836
|
+
var file = (_$files$ = $files[0]) === null || _$files$ === void 0 ? void 0 : _$files$.file;
|
|
1837
|
+
if (file) return (_props$handleUpload = props.handleUpload) === null || _props$handleUpload === void 0 ? void 0 : _props$handleUpload.call(props, file).then(function (key) {
|
|
1838
|
+
var _props$onChange;
|
|
1839
|
+
|
|
1840
|
+
return (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, key);
|
|
1841
|
+
});
|
|
1842
|
+
return Promise.resolve((_props$onChange2 = props.onChange) === null || _props$onChange2 === void 0 ? void 0 : _props$onChange2.call(props, undefined));
|
|
1843
|
+
}, {
|
|
1844
|
+
manual: true
|
|
1845
|
+
}),
|
|
1846
|
+
run = _useRequest2.run,
|
|
1847
|
+
loading = _useRequest2.loading;
|
|
1848
|
+
|
|
1849
|
+
return /*#__PURE__*/React.createElement(ReactFileInput, Object.assign({}, props, {
|
|
1850
|
+
uploading: loading,
|
|
1851
|
+
className: classNames(props.className, 'param-image-upload'),
|
|
1852
|
+
files: files,
|
|
1853
|
+
onChange: run
|
|
1854
|
+
}));
|
|
1855
|
+
};
|
|
1856
|
+
|
|
1857
|
+
var ParamGroupEditor = /*#__PURE__*/function (_PureComponent) {
|
|
1858
|
+
_inherits(ParamGroupEditor, _PureComponent);
|
|
1859
|
+
|
|
1860
|
+
var _super = _createSuper(ParamGroupEditor);
|
|
1861
|
+
|
|
1862
|
+
function ParamGroupEditor() {
|
|
1863
|
+
var _this;
|
|
1864
|
+
|
|
1865
|
+
_classCallCheck(this, ParamGroupEditor);
|
|
1866
|
+
|
|
1867
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1868
|
+
args[_key] = arguments[_key];
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
1872
|
+
|
|
1873
|
+
_defineProperty(_assertThisInitialized(_this), "ref", React$1.createRef());
|
|
1874
|
+
|
|
1875
|
+
_defineProperty(_assertThisInitialized(_this), "onChange", function (changed, data) {
|
|
1876
|
+
var _this$props$onChange, _this$props;
|
|
1877
|
+
|
|
1878
|
+
(_this$props$onChange = (_this$props = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props, data);
|
|
1879
|
+
});
|
|
1880
|
+
|
|
1881
|
+
return _this;
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
_createClass(ParamGroupEditor, [{
|
|
1885
|
+
key: "formItems",
|
|
1886
|
+
get: function get() {
|
|
1887
|
+
var _this$props$initialVa,
|
|
1888
|
+
_this2 = this;
|
|
1889
|
+
|
|
1890
|
+
var isFirstLevel = !this.props.allParams && !((_this$props$initialVa = this.props.initialValues) === null || _this$props$initialVa === void 0 ? void 0 : _this$props$initialVa.parentId);
|
|
1891
|
+
var items = [{
|
|
1892
|
+
label: '参数组名称',
|
|
1893
|
+
name: 'name',
|
|
1894
|
+
Comp: function Comp(props) {
|
|
1895
|
+
return /*#__PURE__*/React$1.createElement(Input, Object.assign({}, props, {
|
|
1896
|
+
placeholder: '请输入'
|
|
1897
|
+
}));
|
|
1898
|
+
},
|
|
1899
|
+
validator: validatorCvt(function (val) {
|
|
1900
|
+
return emptyValidator(val);
|
|
1901
|
+
})
|
|
1902
|
+
}, {
|
|
1903
|
+
label: '业务流程图',
|
|
1904
|
+
name: 'descriptionUrl',
|
|
1905
|
+
Comp: function Comp(props) {
|
|
1906
|
+
return /*#__PURE__*/React$1.createElement(ImageUpload, Object.assign({}, props, {
|
|
1907
|
+
getSignedUrl: _this2.props.getSignedUrl,
|
|
1908
|
+
handleUpload: _this2.props.handleUpload
|
|
1909
|
+
}));
|
|
1910
|
+
},
|
|
1911
|
+
validator: isFirstLevel ? validatorCvt(function (val) {
|
|
1912
|
+
return emptyValidator(val);
|
|
1913
|
+
}) : undefined
|
|
1914
|
+
}];
|
|
1915
|
+
|
|
1916
|
+
if (!isFirstLevel) {
|
|
1917
|
+
items.unshift({
|
|
1918
|
+
label: '父级参数组',
|
|
1919
|
+
name: 'parentId',
|
|
1920
|
+
Comp: function Comp(props) {
|
|
1921
|
+
return /*#__PURE__*/React$1.createElement(ParentSelector, Object.assign({}, props, {
|
|
1922
|
+
parentOptions: _this2.props.allParams
|
|
1923
|
+
}));
|
|
1924
|
+
}
|
|
1925
|
+
});
|
|
1926
|
+
}
|
|
1927
|
+
|
|
1928
|
+
return items;
|
|
1929
|
+
}
|
|
1930
|
+
}, {
|
|
1931
|
+
key: "render",
|
|
1932
|
+
value: function render() {
|
|
1933
|
+
return /*#__PURE__*/React$1.createElement(Form, {
|
|
1934
|
+
className: "param-value-editor",
|
|
1935
|
+
ref: this.ref,
|
|
1936
|
+
initialValues: this.props.initialValues,
|
|
1937
|
+
onFinish: this.props.onSubmit,
|
|
1938
|
+
onValuesChange: this.onChange
|
|
1939
|
+
}, this.formItems.map(function (it) {
|
|
1940
|
+
return /*#__PURE__*/React$1.createElement(Form.Item, {
|
|
1941
|
+
key: it.name,
|
|
1942
|
+
label: it.label,
|
|
1943
|
+
name: it.name,
|
|
1944
|
+
required: it.required,
|
|
1945
|
+
requiredMark: true,
|
|
1946
|
+
rules: [{
|
|
1947
|
+
validator: it.validator || function () {
|
|
1948
|
+
return Promise.resolve();
|
|
1949
|
+
}
|
|
1950
|
+
}],
|
|
1951
|
+
validateTrigger: 'onBlur'
|
|
1952
|
+
}, /*#__PURE__*/React$1.createElement(it.Comp, null));
|
|
1953
|
+
}), this.props.onSubmit && /*#__PURE__*/React$1.createElement(Button, {
|
|
1954
|
+
type: "primary",
|
|
1955
|
+
htmlType: "submit"
|
|
1956
|
+
}, "\u63D0\u4EA4"));
|
|
1957
|
+
}
|
|
1958
|
+
}]);
|
|
1959
|
+
|
|
1960
|
+
return ParamGroupEditor;
|
|
1961
|
+
}(PureComponent);
|
|
1962
|
+
var ParamGroupEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
1963
|
+
_inherits(ParamGroupEditorModalEl, _PureComponent2);
|
|
1964
|
+
|
|
1965
|
+
var _super2 = _createSuper(ParamGroupEditorModalEl);
|
|
1966
|
+
|
|
1967
|
+
function ParamGroupEditorModalEl() {
|
|
1968
|
+
var _this3;
|
|
1969
|
+
|
|
1970
|
+
_classCallCheck(this, ParamGroupEditorModalEl);
|
|
1971
|
+
|
|
1972
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
1973
|
+
args[_key2] = arguments[_key2];
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
_this3 = _super2.call.apply(_super2, [this].concat(args));
|
|
1977
|
+
|
|
1978
|
+
_defineProperty(_assertThisInitialized(_this3), "ref", React$1.createRef());
|
|
1979
|
+
|
|
1980
|
+
_defineProperty(_assertThisInitialized(_this3), "state", {
|
|
1981
|
+
visible: false,
|
|
1982
|
+
pending: false
|
|
1983
|
+
});
|
|
1984
|
+
|
|
1985
|
+
_defineProperty(_assertThisInitialized(_this3), "onShow", function () {
|
|
1986
|
+
return _this3.setState({
|
|
1987
|
+
visible: true
|
|
1988
|
+
});
|
|
1989
|
+
});
|
|
1990
|
+
|
|
1991
|
+
_defineProperty(_assertThisInitialized(_this3), "onHide", function () {
|
|
1992
|
+
return _this3.setState({
|
|
1993
|
+
visible: false
|
|
1994
|
+
});
|
|
1995
|
+
});
|
|
1996
|
+
|
|
1997
|
+
_defineProperty(_assertThisInitialized(_this3), "onSubmit", function () {
|
|
1998
|
+
var form = _this3.ref.current.ref.current;
|
|
1999
|
+
return form.validateFields().then(function () {
|
|
2000
|
+
return _this3.setState({
|
|
2001
|
+
pending: true
|
|
2002
|
+
});
|
|
2003
|
+
}).then(function () {
|
|
2004
|
+
var data = _objectSpread2(_objectSpread2({}, _this3.props.initialValues), form.getFieldsValue());
|
|
2005
|
+
|
|
2006
|
+
if (_this3.isEdit && isEqual(data, _this3.props.initialValues)) {
|
|
2007
|
+
message.warning('请修改后再提交');
|
|
2008
|
+
return Promise.reject();
|
|
2009
|
+
}
|
|
2010
|
+
|
|
2011
|
+
return _this3.props.onSubmit(data);
|
|
2012
|
+
}).then(_this3.onHide).finally(function () {
|
|
2013
|
+
return _this3.setState({
|
|
2014
|
+
pending: false
|
|
2015
|
+
});
|
|
2016
|
+
});
|
|
2017
|
+
});
|
|
2018
|
+
|
|
2019
|
+
return _this3;
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
_createClass(ParamGroupEditorModalEl, [{
|
|
2023
|
+
key: "isEdit",
|
|
2024
|
+
get: function get() {
|
|
2025
|
+
var _this$props$initialVa2;
|
|
2026
|
+
|
|
2027
|
+
return Boolean((_this$props$initialVa2 = this.props.initialValues) === null || _this$props$initialVa2 === void 0 ? void 0 : _this$props$initialVa2.paramId);
|
|
2028
|
+
}
|
|
2029
|
+
}, {
|
|
2030
|
+
key: "render",
|
|
2031
|
+
value: function render() {
|
|
2032
|
+
var _this$props$initialVa3;
|
|
2033
|
+
|
|
2034
|
+
return /*#__PURE__*/React$1.createElement(Modal, {
|
|
2035
|
+
key: String(this.state.visible),
|
|
2036
|
+
width: 640,
|
|
2037
|
+
title: ((_this$props$initialVa3 = this.props.initialValues) === null || _this$props$initialVa3 === void 0 ? void 0 : _this$props$initialVa3.paramId) ? '编辑参数组' : '新增参数组',
|
|
2038
|
+
closable: false,
|
|
2039
|
+
visible: this.state.visible,
|
|
2040
|
+
footer: /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(Button, {
|
|
2041
|
+
onClick: this.onHide
|
|
2042
|
+
}, "\u53D6\u6D88"), /*#__PURE__*/React$1.createElement(Button, {
|
|
2043
|
+
type: "primary",
|
|
2044
|
+
onClick: this.onSubmit,
|
|
2045
|
+
loading: this.state.pending
|
|
2046
|
+
}, "\u786E\u5B9A"))
|
|
2047
|
+
}, /*#__PURE__*/React$1.createElement(ParamGroupEditor, Object.assign({}, this.props, {
|
|
2048
|
+
ref: this.ref,
|
|
2049
|
+
onSubmit: undefined
|
|
2050
|
+
})));
|
|
2051
|
+
}
|
|
2052
|
+
}]);
|
|
2053
|
+
|
|
2054
|
+
return ParamGroupEditorModalEl;
|
|
2055
|
+
}(PureComponent);
|
|
2056
|
+
var ParamGroupEditorModal = /*#__PURE__*/function () {
|
|
2057
|
+
function ParamGroupEditorModal() {
|
|
2058
|
+
_classCallCheck(this, ParamGroupEditorModal);
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2061
|
+
_createClass(ParamGroupEditorModal, null, [{
|
|
2062
|
+
key: "show",
|
|
2063
|
+
value: function show(props) {
|
|
2064
|
+
return ParamGroupEditorModal.el.render(props).then(function () {
|
|
2065
|
+
ParamGroupEditorModal.el.ref.onShow();
|
|
2066
|
+
});
|
|
2067
|
+
}
|
|
2068
|
+
}, {
|
|
2069
|
+
key: "hide",
|
|
2070
|
+
value: function hide() {
|
|
2071
|
+
return ParamGroupEditorModal.el.render().then(function () {
|
|
2072
|
+
ParamGroupEditorModal.el.ref.onHide();
|
|
2073
|
+
});
|
|
2074
|
+
}
|
|
2075
|
+
}]);
|
|
2076
|
+
|
|
2077
|
+
return ParamGroupEditorModal;
|
|
2078
|
+
}();
|
|
2079
|
+
|
|
2080
|
+
_defineProperty(ParamGroupEditorModal, "el", new ReactGlobalComp('param-group-editor-modal', ParamGroupEditorModalEl));
|
|
2081
|
+
|
|
2082
|
+
function genOptions(props) {
|
|
2083
|
+
var filter = function filter(it) {
|
|
2084
|
+
return it.valueType !== ParamType.ParamGroup;
|
|
2085
|
+
};
|
|
2086
|
+
|
|
2087
|
+
var cvt = function cvt(it) {
|
|
2088
|
+
var _it$children;
|
|
2089
|
+
|
|
2090
|
+
return _objectSpread2(_objectSpread2({}, it), {}, {
|
|
2091
|
+
disabled: props.targetParams.includes(String(it.$paramId)),
|
|
2092
|
+
children: (_it$children = it.children) === null || _it$children === void 0 ? void 0 : _it$children.filter(filter).map(cvt)
|
|
2093
|
+
});
|
|
2094
|
+
};
|
|
2095
|
+
|
|
2096
|
+
return props.allParams.map(cvt) || [];
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2099
|
+
function genParamsMap(props) {
|
|
2100
|
+
var map = {};
|
|
2101
|
+
|
|
2102
|
+
var append = function append(it) {
|
|
2103
|
+
var _it$children2;
|
|
2104
|
+
|
|
2105
|
+
map[it.$paramId] = _objectSpread2(_objectSpread2({}, it), {}, {
|
|
2106
|
+
disabled: props.targetParams.includes(String(it.$paramId))
|
|
2107
|
+
});
|
|
2108
|
+
(_it$children2 = it.children) === null || _it$children2 === void 0 ? void 0 : _it$children2.forEach(append);
|
|
2109
|
+
};
|
|
2110
|
+
|
|
2111
|
+
props.allParams.forEach(append);
|
|
2112
|
+
return map;
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2115
|
+
function initState(props) {
|
|
2116
|
+
return {
|
|
2117
|
+
preProps: props,
|
|
2118
|
+
options: genOptions(props),
|
|
2119
|
+
paramsMap: genParamsMap(props)
|
|
2120
|
+
};
|
|
2121
|
+
}
|
|
2122
|
+
|
|
2123
|
+
var ParamMover = /*#__PURE__*/function (_PureComponent) {
|
|
2124
|
+
_inherits(ParamMover, _PureComponent);
|
|
2125
|
+
|
|
2126
|
+
var _super = _createSuper(ParamMover);
|
|
2127
|
+
|
|
2128
|
+
function ParamMover() {
|
|
2129
|
+
var _this;
|
|
2130
|
+
|
|
2131
|
+
_classCallCheck(this, ParamMover);
|
|
2132
|
+
|
|
2133
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2134
|
+
args[_key] = arguments[_key];
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
2138
|
+
|
|
2139
|
+
_defineProperty(_assertThisInitialized(_this), "state", initState(_this.props));
|
|
2140
|
+
|
|
2141
|
+
_defineProperty(_assertThisInitialized(_this), "ref", React$1.createRef());
|
|
2142
|
+
|
|
2143
|
+
return _this;
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
_createClass(ParamMover, [{
|
|
2147
|
+
key: "newParams",
|
|
2148
|
+
get: function get() {
|
|
2149
|
+
var _this2 = this;
|
|
2150
|
+
|
|
2151
|
+
var _getFieldsValue = this.ref.current.getFieldsValue(),
|
|
2152
|
+
parentId = _getFieldsValue.parentId;
|
|
2153
|
+
|
|
2154
|
+
var filter = function filter(it) {
|
|
2155
|
+
return !_this2.props.targetParams.includes(String(it.$paramId));
|
|
2156
|
+
};
|
|
2157
|
+
|
|
2158
|
+
var map = function map(it) {
|
|
2159
|
+
var _it$children3;
|
|
2160
|
+
|
|
2161
|
+
if (it.$paramId === parentId) {
|
|
2162
|
+
return _objectSpread2(_objectSpread2({}, it), {}, {
|
|
2163
|
+
children: (it.children || []).concat(_this2.props.targetParams.map(function ($paramId) {
|
|
2164
|
+
return _this2.state.paramsMap[$paramId];
|
|
2165
|
+
}))
|
|
2166
|
+
});
|
|
2167
|
+
}
|
|
2168
|
+
|
|
2169
|
+
return _objectSpread2(_objectSpread2({}, it), {}, {
|
|
2170
|
+
children: (_it$children3 = it.children) === null || _it$children3 === void 0 ? void 0 : _it$children3.filter(filter).map(map)
|
|
2171
|
+
});
|
|
2172
|
+
};
|
|
2173
|
+
|
|
2174
|
+
return this.props.allParams.filter(filter).map(map);
|
|
2175
|
+
}
|
|
2176
|
+
}, {
|
|
2177
|
+
key: "formItems",
|
|
2178
|
+
get: function get() {
|
|
2179
|
+
var _this3 = this;
|
|
2180
|
+
|
|
2181
|
+
var items = [{
|
|
2182
|
+
label: '选择分组',
|
|
2183
|
+
name: 'parentId',
|
|
2184
|
+
Comp: function Comp(props) {
|
|
2185
|
+
return /*#__PURE__*/React$1.createElement(ParentSelector, Object.assign({}, props, {
|
|
2186
|
+
parentOptions: _this3.state.options
|
|
2187
|
+
}));
|
|
2188
|
+
}
|
|
2189
|
+
}];
|
|
2190
|
+
return items;
|
|
2191
|
+
}
|
|
2192
|
+
}, {
|
|
2193
|
+
key: "render",
|
|
2194
|
+
value: function render() {
|
|
2195
|
+
return /*#__PURE__*/React$1.createElement(Form, {
|
|
2196
|
+
className: "param-value-editor",
|
|
2197
|
+
ref: this.ref,
|
|
2198
|
+
onFinish: this.props.onSubmit
|
|
2199
|
+
}, this.formItems.map(function (it) {
|
|
2200
|
+
return /*#__PURE__*/React$1.createElement(Form.Item, {
|
|
2201
|
+
key: it.name,
|
|
2202
|
+
label: it.label,
|
|
2203
|
+
name: it.name,
|
|
2204
|
+
required: it.required,
|
|
2205
|
+
requiredMark: true,
|
|
2206
|
+
rules: [{
|
|
2207
|
+
validator: it.validator || function () {
|
|
2208
|
+
return Promise.resolve();
|
|
2209
|
+
}
|
|
2210
|
+
}],
|
|
2211
|
+
validateTrigger: 'onBlur'
|
|
2212
|
+
}, /*#__PURE__*/React$1.createElement(it.Comp, null));
|
|
2213
|
+
}), this.props.onSubmit && /*#__PURE__*/React$1.createElement(Button, {
|
|
2214
|
+
type: "primary",
|
|
2215
|
+
htmlType: "submit"
|
|
2216
|
+
}, "\u63D0\u4EA4"));
|
|
2217
|
+
}
|
|
2218
|
+
}], [{
|
|
2219
|
+
key: "getDerivedStateFromProps",
|
|
2220
|
+
value: function getDerivedStateFromProps(props, state) {
|
|
2221
|
+
if (props.allParams !== state.preProps.allParams) {
|
|
2222
|
+
state.paramsMap = genParamsMap(props);
|
|
2223
|
+
|
|
2224
|
+
if (props.targetParams !== state.preProps.targetParams) {
|
|
2225
|
+
state.options = genOptions(props);
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
return _objectSpread2(_objectSpread2({}, state), {}, {
|
|
2230
|
+
preProps: props
|
|
2231
|
+
});
|
|
2232
|
+
}
|
|
2233
|
+
}]);
|
|
2234
|
+
|
|
2235
|
+
return ParamMover;
|
|
2236
|
+
}(PureComponent);
|
|
2237
|
+
var ParamMoverModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
2238
|
+
_inherits(ParamMoverModalEl, _PureComponent2);
|
|
2239
|
+
|
|
2240
|
+
var _super2 = _createSuper(ParamMoverModalEl);
|
|
2241
|
+
|
|
2242
|
+
function ParamMoverModalEl() {
|
|
2243
|
+
var _this4;
|
|
2244
|
+
|
|
2245
|
+
_classCallCheck(this, ParamMoverModalEl);
|
|
2246
|
+
|
|
2247
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
2248
|
+
args[_key2] = arguments[_key2];
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
_this4 = _super2.call.apply(_super2, [this].concat(args));
|
|
2252
|
+
|
|
2253
|
+
_defineProperty(_assertThisInitialized(_this4), "ref", React$1.createRef());
|
|
2254
|
+
|
|
2255
|
+
_defineProperty(_assertThisInitialized(_this4), "state", {
|
|
2256
|
+
visible: false,
|
|
2257
|
+
pending: false
|
|
2258
|
+
});
|
|
2259
|
+
|
|
2260
|
+
_defineProperty(_assertThisInitialized(_this4), "onShow", function () {
|
|
2261
|
+
return _this4.setState({
|
|
2262
|
+
visible: true
|
|
2263
|
+
});
|
|
2264
|
+
});
|
|
2265
|
+
|
|
2266
|
+
_defineProperty(_assertThisInitialized(_this4), "onHide", function () {
|
|
2267
|
+
return _this4.setState({
|
|
2268
|
+
visible: false
|
|
2269
|
+
});
|
|
2270
|
+
});
|
|
2271
|
+
|
|
2272
|
+
_defineProperty(_assertThisInitialized(_this4), "onSubmit", function () {
|
|
2273
|
+
var form = _this4.ref.current.ref.current;
|
|
2274
|
+
return form.validateFields().then(function () {
|
|
2275
|
+
return _this4.setState({
|
|
2276
|
+
pending: true
|
|
2277
|
+
});
|
|
2278
|
+
}).then(function () {
|
|
2279
|
+
return _this4.props.onSubmit(_this4.ref.current.newParams);
|
|
2280
|
+
}).then(_this4.onHide).finally(function () {
|
|
2281
|
+
return _this4.setState({
|
|
2282
|
+
pending: false
|
|
2283
|
+
});
|
|
2284
|
+
});
|
|
2285
|
+
});
|
|
2286
|
+
|
|
2287
|
+
return _this4;
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2290
|
+
_createClass(ParamMoverModalEl, [{
|
|
2291
|
+
key: "render",
|
|
2292
|
+
value: function render() {
|
|
2293
|
+
return /*#__PURE__*/React$1.createElement(Modal, {
|
|
2294
|
+
key: String(this.state.visible),
|
|
2295
|
+
width: 640,
|
|
2296
|
+
title: '移动参数',
|
|
2297
|
+
closable: false,
|
|
2298
|
+
visible: this.state.visible,
|
|
2299
|
+
footer: /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(Button, {
|
|
2300
|
+
onClick: this.onHide
|
|
2301
|
+
}, "\u53D6\u6D88"), /*#__PURE__*/React$1.createElement(Button, {
|
|
2302
|
+
type: "primary",
|
|
2303
|
+
onClick: this.onSubmit,
|
|
2304
|
+
loading: this.state.pending
|
|
2305
|
+
}, "\u786E\u5B9A"))
|
|
2306
|
+
}, /*#__PURE__*/React$1.createElement(ParamMover, Object.assign({}, this.props, {
|
|
2307
|
+
ref: this.ref,
|
|
2308
|
+
onSubmit: undefined
|
|
2309
|
+
})));
|
|
2310
|
+
}
|
|
2311
|
+
}]);
|
|
2312
|
+
|
|
2313
|
+
return ParamMoverModalEl;
|
|
2314
|
+
}(PureComponent);
|
|
2315
|
+
var ParamMoverModal = /*#__PURE__*/function () {
|
|
2316
|
+
function ParamMoverModal() {
|
|
2317
|
+
_classCallCheck(this, ParamMoverModal);
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2320
|
+
_createClass(ParamMoverModal, null, [{
|
|
2321
|
+
key: "show",
|
|
2322
|
+
value: function show(props) {
|
|
2323
|
+
return ParamMoverModal.el.render(props).then(function () {
|
|
2324
|
+
ParamMoverModal.el.ref.onShow();
|
|
2325
|
+
});
|
|
2326
|
+
}
|
|
2327
|
+
}, {
|
|
2328
|
+
key: "hide",
|
|
2329
|
+
value: function hide() {
|
|
2330
|
+
return ParamMoverModal.el.render().then(function () {
|
|
2331
|
+
ParamMoverModal.el.ref.onHide();
|
|
2332
|
+
});
|
|
2333
|
+
}
|
|
2334
|
+
}]);
|
|
2335
|
+
|
|
2336
|
+
return ParamMoverModal;
|
|
2337
|
+
}();
|
|
2338
|
+
|
|
2339
|
+
_defineProperty(ParamMoverModal, "el", new ReactGlobalComp('param-mover-modal', ParamMoverModalEl));
|
|
2340
|
+
|
|
2341
|
+
export { ParamForm, ParamFormModal, ParamGroupEditor, ParamGroupEditorModal, ParamGroupEditorModalEl, ParamMover, ParamMoverModal, ParamMoverModalEl, ParamRenderer, ParamType, ParamTypeConfig, ParamTypeOptions, ParamValueEditor, ParamValueEditorModal, ParamValueEditorModalEl, emptyValidator, expiriesValidator, expiryValidator, formatNum, isExpired, isNullLike, keyValidator, numRangeValidator, paramValidator, validatorCvt };
|