@signalplus/params-about 0.1.4 → 0.1.7

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.
Files changed (3) hide show
  1. package/index.d.ts +68 -9
  2. package/lib/es/index.js +401 -119
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -49,9 +49,12 @@ declare class ParamRenderer extends PureComponent<ParamRendererProps> {
49
49
  }
50
50
 
51
51
  interface ParentSelectorOption {
52
- label: string;
53
- value: string;
52
+ $paramId: string | number;
53
+ name: string;
54
+ disabled?: boolean;
55
+ valueType?: ParamType;
54
56
  children?: ParentSelectorOption[];
57
+ [key: string]: any;
55
58
  }
56
59
  interface ParentSelectorProps extends BaseInputProps {
57
60
  parentOptions?: ParentSelectorOption[];
@@ -74,9 +77,9 @@ interface ParamFormData {
74
77
  interface ParamFormProps {
75
78
  parentOptions: ParentSelectorProps['parentOptions'];
76
79
  expiriesOptions: string[];
77
- initialValues?: ParamFormData;
80
+ initialValues?: Partial<ParamFormData>;
78
81
  onChange?(data: ParamFormData): void;
79
- onSubmit?(data: ParamFormData): Promise<any>;
82
+ onSubmit?(data: ParamFormData): any;
80
83
  }
81
84
  declare class ParamForm extends PureComponent<ParamFormProps> {
82
85
  ref: React.RefObject<any>;
@@ -126,7 +129,7 @@ interface ParamValueEditorProps {
126
129
  valueType: ParamType;
127
130
  initialValues: ParamValueEditorData;
128
131
  onChange?(data: ParamValueEditorData): void;
129
- onSubmit?(data: ParamValueEditorData): Promise<any>;
132
+ onSubmit?(data: ParamValueEditorData): any;
130
133
  }
131
134
  declare class ParamValueEditor extends PureComponent<ParamValueEditorProps> {
132
135
  ref: React.RefObject<any>;
@@ -177,10 +180,10 @@ interface ParamGroupEditorProps extends Required<Pick<ImageUploadProps, 'getSign
177
180
  /**
178
181
  * 传了表示为有父级
179
182
  * */
180
- allParams?: ParentSelectorProps['parentOptions'];
181
- initialValues?: ParamGroupEditorData;
183
+ parentOptions?: ParentSelectorProps['parentOptions'];
184
+ initialValues?: Partial<ParamGroupEditorData>;
182
185
  onChange?(data: ParamGroupEditorData): void;
183
- onSubmit?(data: ParamGroupEditorData): Promise<any>;
186
+ onSubmit?(data: ParamGroupEditorData): any;
184
187
  }
185
188
  declare class ParamGroupEditor extends PureComponent<ParamGroupEditorProps> {
186
189
  ref: React.RefObject<any>;
@@ -212,6 +215,62 @@ declare class ParamGroupEditorModal {
212
215
  static hide(): Promise<void>;
213
216
  }
214
217
 
218
+ interface ParamMoverData {
219
+ parentId: string;
220
+ }
221
+ interface ParamMoverProps {
222
+ /**
223
+ * 需要确保 targetParams 的元素之间无父子或者祖先子孙关系
224
+ * */
225
+ targetParams: string[];
226
+ allParams: NonNullable<ParentSelectorProps['parentOptions']>;
227
+ onSubmit?(params: NonNullable<ParentSelectorProps['parentOptions']>): any;
228
+ }
229
+ declare function initState(props: ParamMoverProps): {
230
+ preProps: ParamMoverProps;
231
+ options: any[];
232
+ paramsMap: Record<string, ParentSelectorOption>;
233
+ };
234
+ declare type ParamMoverState = ReturnType<typeof initState>;
235
+ declare class ParamMover extends PureComponent<ParamMoverProps, ParamMoverState> {
236
+ static getDerivedStateFromProps(props: ParamMoverProps, state: ParamMoverState): {
237
+ preProps: ParamMoverProps;
238
+ options: any[];
239
+ paramsMap: Record<string, ParentSelectorOption>;
240
+ };
241
+ get newParams(): ParentSelectorOption[];
242
+ state: {
243
+ preProps: ParamMoverProps;
244
+ options: any[];
245
+ paramsMap: Record<string, ParentSelectorOption>;
246
+ };
247
+ ref: React.RefObject<any>;
248
+ get formItems(): {
249
+ label: string;
250
+ name: string;
251
+ Comp: React.ComponentType<BaseInputProps>;
252
+ required?: boolean | undefined;
253
+ validator?(_: any, val: any): Promise<any>;
254
+ }[];
255
+ render(): JSX.Element;
256
+ }
257
+ declare class ParamMoverModalEl extends PureComponent<ParamMoverProps & Required<Pick<ParamMoverProps, 'onSubmit'>>> {
258
+ ref: React.RefObject<ParamMover>;
259
+ state: {
260
+ visible: boolean;
261
+ pending: boolean;
262
+ };
263
+ onShow: () => void;
264
+ onHide: () => void;
265
+ onSubmit: () => any;
266
+ render(): JSX.Element;
267
+ }
268
+ declare class ParamMoverModal {
269
+ static el: ReactGlobalComp<ParamMoverProps & Required<Pick<ParamMoverProps, "onSubmit">>>;
270
+ static show(props: Omit<ComponentProps<typeof ParamMoverModalEl>, 'visible'>): Promise<void>;
271
+ static hide(): Promise<void>;
272
+ }
273
+
215
274
  declare const ParamTypeConfig: Record<ParamType, {
216
275
  name: string;
217
276
  key?: string;
@@ -245,4 +304,4 @@ declare function keyValidator(val: string): "Should not be empty" | "" | "Out of
245
304
  declare function isExpired(val?: string): boolean;
246
305
  declare function validatorCvt(validator: (val: any, values: any) => ValidateInfo['string'], form?: () => any): (_: any, val: any) => Promise<any>;
247
306
 
248
- export { BaseInputProps, ParamForm, ParamFormData, ParamFormModal, ParamFormProps, ParamGroupEditor, ParamGroupEditorData, ParamGroupEditorModal, ParamGroupEditorModalEl, ParamGroupEditorProps, ParamRenderer, ParamRendererProps, ParamType, ParamTypeConfig, ParamTypeOptions, ParamValueEditor, ParamValueEditorData, ParamValueEditorModal, ParamValueEditorModalEl, ParamValueEditorProps, ParamValueStruct, ValidateInfo, emptyValidator, expiriesValidator, expiryValidator, formatNum, isExpired, isNullLike, keyValidator, numRangeValidator, paramValidator, validatorCvt };
307
+ export { BaseInputProps, ParamForm, ParamFormData, ParamFormModal, ParamFormProps, ParamGroupEditor, ParamGroupEditorData, ParamGroupEditorModal, ParamGroupEditorModalEl, ParamGroupEditorProps, ParamMover, ParamMoverData, ParamMoverModal, ParamMoverModalEl, ParamMoverProps, ParamMoverState, ParamRenderer, ParamRendererProps, ParamType, ParamTypeConfig, ParamTypeOptions, ParamValueEditor, ParamValueEditorData, ParamValueEditorModal, ParamValueEditorModalEl, ParamValueEditorProps, ParamValueStruct, ValidateInfo, emptyValidator, expiriesValidator, expiryValidator, formatNum, isExpired, isNullLike, keyValidator, numRangeValidator, paramValidator, validatorCvt };
package/lib/es/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * Bundle of @signalplus/params-about
3
3
  * Generated: 2022-04-08
4
- * Version: 0.1.4
4
+ * Version: 0.1.7
5
5
  * License: MIT
6
6
  * Author: 2631541504@qq.com
7
7
  */
8
8
 
9
- import React$1, { PureComponent, useMemo, useState, useEffect } from 'react';
9
+ import React, { 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';
@@ -463,41 +463,41 @@ var Bool = /*#__PURE__*/function (_PureComponent) {
463
463
  value: false
464
464
  }]);
465
465
 
466
- _defineProperty(_assertThisInitialized(_this), "RadioChecked", /*#__PURE__*/React$1.createElement("svg", {
466
+ _defineProperty(_assertThisInitialized(_this), "RadioChecked", /*#__PURE__*/React.createElement("svg", {
467
467
  width: "16",
468
468
  height: "17",
469
469
  viewBox: "0 0 16 17",
470
470
  fill: "none",
471
471
  xmlns: "http://www.w3.org/2000/svg"
472
- }, /*#__PURE__*/React$1.createElement("g", {
472
+ }, /*#__PURE__*/React.createElement("g", {
473
473
  clipPath: "url(#clip0_0_7934)"
474
- }, /*#__PURE__*/React$1.createElement("circle", {
474
+ }, /*#__PURE__*/React.createElement("circle", {
475
475
  cx: "8",
476
476
  cy: "8.5",
477
477
  r: "7.5",
478
478
  fill: "none",
479
479
  stroke: "currentColor"
480
- }), /*#__PURE__*/React$1.createElement("circle", {
480
+ }), /*#__PURE__*/React.createElement("circle", {
481
481
  cx: "8",
482
482
  cy: "8.5",
483
483
  r: "4",
484
484
  fill: "currentColor"
485
- })), /*#__PURE__*/React$1.createElement("defs", null, /*#__PURE__*/React$1.createElement("clipPath", {
485
+ })), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
486
486
  id: "clip0_0_7934"
487
- }, /*#__PURE__*/React$1.createElement("rect", {
487
+ }, /*#__PURE__*/React.createElement("rect", {
488
488
  width: "16",
489
489
  height: "16",
490
490
  fill: "white",
491
491
  transform: "translate(0 0.5)"
492
492
  })))));
493
493
 
494
- _defineProperty(_assertThisInitialized(_this), "RadioUnchecked", /*#__PURE__*/React$1.createElement("svg", {
494
+ _defineProperty(_assertThisInitialized(_this), "RadioUnchecked", /*#__PURE__*/React.createElement("svg", {
495
495
  width: "16",
496
496
  height: "17",
497
497
  viewBox: "0 0 16 17",
498
498
  fill: "none",
499
499
  xmlns: "http://www.w3.org/2000/svg"
500
- }, /*#__PURE__*/React$1.createElement("circle", {
500
+ }, /*#__PURE__*/React.createElement("circle", {
501
501
  cx: "8",
502
502
  cy: "8.5",
503
503
  r: "7.5",
@@ -520,16 +520,16 @@ var Bool = /*#__PURE__*/function (_PureComponent) {
520
520
  value: function render() {
521
521
  var _this2 = this;
522
522
 
523
- return /*#__PURE__*/React$1.createElement("div", {
523
+ return /*#__PURE__*/React.createElement("div", {
524
524
  className: classNames('param-bool', {
525
525
  readonly: this.props.readonly
526
526
  }, this.props.className),
527
527
  style: this.props.style
528
- }, this.props.readonly ? /*#__PURE__*/React$1.createElement("span", {
528
+ }, this.props.readonly ? /*#__PURE__*/React.createElement("span", {
529
529
  className: "param-bool-val"
530
530
  }, !isNullLike(this.props.value) ? String(this.props.value).toUpperCase() : '-') : this.options.map(function (it) {
531
531
  var active = it.value === _this2.props.value;
532
- return /*#__PURE__*/React$1.createElement("div", {
532
+ return /*#__PURE__*/React.createElement("div", {
533
533
  key: String(it.value),
534
534
  className: classNames('param-bool-option', {
535
535
  active: active
@@ -566,7 +566,7 @@ var NumCvt = /*#__PURE__*/function () {
566
566
  return NumCvt;
567
567
  }();
568
568
 
569
- function initState(props) {
569
+ function initState$1(props) {
570
570
  return {
571
571
  preProps: props,
572
572
  tempValue: NumCvt.show(props.value, props.isPercentage)
@@ -589,7 +589,7 @@ var Num = /*#__PURE__*/function (_PureComponent) {
589
589
 
590
590
  _this = _super.call.apply(_super, [this].concat(args));
591
591
 
592
- _defineProperty(_assertThisInitialized(_this), "state", initState(_this.props));
592
+ _defineProperty(_assertThisInitialized(_this), "state", initState$1(_this.props));
593
593
 
594
594
  _defineProperty(_assertThisInitialized(_this), "onChange", function (e) {
595
595
  var $value = e.target.value;
@@ -616,21 +616,21 @@ var Num = /*#__PURE__*/function (_PureComponent) {
616
616
  value: function render() {
617
617
  var _this$state$tempValue;
618
618
 
619
- return /*#__PURE__*/React$1.createElement("div", {
619
+ return /*#__PURE__*/React.createElement("div", {
620
620
  className: classNames('param-number', {
621
621
  readonly: this.props.readonly
622
622
  }, this.props.className),
623
623
  style: this.props.style
624
- }, this.props.readonly ? /*#__PURE__*/React$1.createElement("span", {
624
+ }, this.props.readonly ? /*#__PURE__*/React.createElement("span", {
625
625
  className: "param-number-val"
626
- }, (_this$state$tempValue = this.state.tempValue) !== null && _this$state$tempValue !== void 0 ? _this$state$tempValue : '-') : /*#__PURE__*/React$1.createElement("input", {
626
+ }, (_this$state$tempValue = this.state.tempValue) !== null && _this$state$tempValue !== void 0 ? _this$state$tempValue : '-') : /*#__PURE__*/React.createElement("input", {
627
627
  className: "param-number-val",
628
628
  type: "text",
629
629
  placeholder: this.props.placeholder || 'Value',
630
630
  value: this.state.tempValue || '',
631
631
  onChange: this.onChange,
632
632
  onBlur: this.props.onBlur
633
- }), this.props.isPercentage && /*#__PURE__*/React$1.createElement("span", {
633
+ }), this.props.isPercentage && /*#__PURE__*/React.createElement("span", {
634
634
  className: "param-number-suffix"
635
635
  }, "%"));
636
636
  }
@@ -683,25 +683,25 @@ var NumRange = /*#__PURE__*/function (_PureComponent) {
683
683
  value: function render() {
684
684
  var _this$props$value, _this$props$value2;
685
685
 
686
- return /*#__PURE__*/React$1.createElement("div", {
686
+ return /*#__PURE__*/React.createElement("div", {
687
687
  className: classNames('param-number-range', {
688
688
  readonly: this.props.readonly
689
689
  }, this.props.className),
690
690
  style: this.props.style
691
- }, /*#__PURE__*/React$1.createElement("span", {
691
+ }, /*#__PURE__*/React.createElement("span", {
692
692
  className: "param-number-range-prefix"
693
- }, "Min"), /*#__PURE__*/React$1.createElement(Num, {
693
+ }, "Min"), /*#__PURE__*/React.createElement(Num, {
694
694
  placeholder: 'Min',
695
695
  value: (_this$props$value = this.props.value) === null || _this$props$value === void 0 ? void 0 : _this$props$value.min,
696
696
  onChange: this.onChange.bind(null, 'min'),
697
697
  isPercentage: this.props.isPercentage,
698
698
  readonly: this.props.readonly,
699
699
  onBlur: this.props.onBlur
700
- }), /*#__PURE__*/React$1.createElement("span", {
700
+ }), /*#__PURE__*/React.createElement("span", {
701
701
  className: "param-number-range-sep"
702
- }, this.props.readonly ? ',' : '-'), /*#__PURE__*/React$1.createElement("span", {
702
+ }, this.props.readonly ? ',' : '-'), /*#__PURE__*/React.createElement("span", {
703
703
  className: "param-number-range-prefix"
704
- }, "Max"), /*#__PURE__*/React$1.createElement(Num, {
704
+ }, "Max"), /*#__PURE__*/React.createElement(Num, {
705
705
  placeholder: 'Max',
706
706
  value: (_this$props$value2 = this.props.value) === null || _this$props$value2 === void 0 ? void 0 : _this$props$value2.max,
707
707
  onChange: this.onChange.bind(null, 'max'),
@@ -788,29 +788,29 @@ var TextArray = /*#__PURE__*/function (_PureComponent) {
788
788
 
789
789
  this.value = this.props.value || [];
790
790
  if (!this.value.length) this.value.push('');
791
- return /*#__PURE__*/React$1.createElement("div", {
791
+ return /*#__PURE__*/React.createElement("div", {
792
792
  className: classNames('param-text-array', {
793
793
  readonly: this.props.readonly
794
794
  }, this.props.className),
795
795
  style: this.props.style
796
- }, this.props.readonly ? /*#__PURE__*/React$1.createElement("span", {
796
+ }, this.props.readonly ? /*#__PURE__*/React.createElement("span", {
797
797
  className: "param-text-array-val"
798
798
  }, this.value.filter(Boolean).join(', ') || '-') : this.value.map(function (it, i) {
799
- return /*#__PURE__*/React$1.createElement("div", {
799
+ return /*#__PURE__*/React.createElement("div", {
800
800
  className: "param-arr-item",
801
801
  key: i
802
- }, /*#__PURE__*/React$1.createElement("input", {
802
+ }, /*#__PURE__*/React.createElement("input", {
803
803
  type: "text",
804
804
  placeholder: "Phone",
805
805
  value: it,
806
806
  onChange: _this2.onChange.bind(null, i),
807
807
  onBlur: _this2.props.onBlur
808
- }), /*#__PURE__*/React$1.createElement("div", {
808
+ }), /*#__PURE__*/React.createElement("div", {
809
809
  className: "param-arr-ops"
810
- }, /*#__PURE__*/React$1.createElement(PlusOutlined, {
810
+ }, /*#__PURE__*/React.createElement(PlusOutlined, {
811
811
  className: "param-arr-ops-add",
812
812
  onClick: _this2.onAdd.bind(null, i)
813
- }), /*#__PURE__*/React$1.createElement(DeleteOutlined, {
813
+ }), /*#__PURE__*/React.createElement(DeleteOutlined, {
814
814
  className: "param-arr-ops-del",
815
815
  onClick: _this2.onDel.bind(null, i)
816
816
  })));
@@ -880,12 +880,12 @@ var Expiries = /*#__PURE__*/function (_PureComponent) {
880
880
  });
881
881
 
882
882
  if (this.props.readonly) {
883
- return /*#__PURE__*/React$1.createElement("span", {
883
+ return /*#__PURE__*/React.createElement("span", {
884
884
  className: "param-expiries-val"
885
885
  }, (value === null || value === void 0 ? void 0 : value.join(', ')) || '-');
886
886
  }
887
887
 
888
- var placeholder = /*#__PURE__*/React$1.createElement("span", {
888
+ var placeholder = /*#__PURE__*/React.createElement("span", {
889
889
  className: "param-expiries-placeholder"
890
890
  }, "Choose an expiry");
891
891
 
@@ -894,20 +894,20 @@ var Expiries = /*#__PURE__*/function (_PureComponent) {
894
894
 
895
895
  var _val = (_this$props$value2 = this.props.value) === null || _this$props$value2 === void 0 ? void 0 : _this$props$value2[0];
896
896
 
897
- return !_val || isExpired(_val) ? placeholder : /*#__PURE__*/React$1.createElement("span", {
897
+ return !_val || isExpired(_val) ? placeholder : /*#__PURE__*/React.createElement("span", {
898
898
  className: "param-expiries-val"
899
899
  }, _val);
900
900
  }
901
901
 
902
902
  if (!(value === null || value === void 0 ? void 0 : value.length)) return placeholder;
903
903
  return value.map(function (it) {
904
- return /*#__PURE__*/React$1.createElement("span", {
904
+ return /*#__PURE__*/React.createElement("span", {
905
905
  className: "param-expiries-multi-val",
906
906
  key: it,
907
907
  onClick: function onClick(e) {
908
908
  return e.stopPropagation();
909
909
  }
910
- }, it, /*#__PURE__*/React$1.createElement(CloseOutlined, {
910
+ }, it, /*#__PURE__*/React.createElement(CloseOutlined, {
911
911
  onClick: _this2.onChange.bind(null, it)
912
912
  }));
913
913
  });
@@ -918,7 +918,7 @@ var Expiries = /*#__PURE__*/function (_PureComponent) {
918
918
  var _this$props$options,
919
919
  _this3 = this;
920
920
 
921
- return /*#__PURE__*/React$1.createElement(Popover, {
921
+ return /*#__PURE__*/React.createElement(Popover, {
922
922
  overlayClassName: "param-expiries-popover",
923
923
  trigger: 'click',
924
924
  placement: 'bottomLeft',
@@ -929,22 +929,22 @@ var Expiries = /*#__PURE__*/function (_PureComponent) {
929
929
 
930
930
  var checked = (_this3$props$value = _this3.props.value) === null || _this3$props$value === void 0 ? void 0 : _this3$props$value.includes(it);
931
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);
932
- return /*#__PURE__*/React$1.createElement("div", {
932
+ return /*#__PURE__*/React.createElement("div", {
933
933
  className: classNames('param-expiries-option', {
934
934
  'param-expiries-option-checked': checked,
935
935
  'param-expiries-option-disabled': disabled
936
936
  }),
937
937
  key: it,
938
938
  onClick: disabled ? undefined : (_this3$onChange = _this3.onChange) === null || _this3$onChange === void 0 ? void 0 : _this3$onChange.bind(null, it)
939
- }, it, checked && /*#__PURE__*/React$1.createElement(CheckOutlined, null));
939
+ }, it, checked && /*#__PURE__*/React.createElement(CheckOutlined, null));
940
940
  })
941
- }, /*#__PURE__*/React$1.createElement("div", {
941
+ }, /*#__PURE__*/React.createElement("div", {
942
942
  className: classNames('param-expiries', {
943
943
  readonly: this.props.readonly,
944
944
  multiple: this.props.multiple !== false
945
945
  }, this.props.className),
946
946
  style: this.props.style
947
- }, this.renderValue(), !this.props.readonly && this.props.options && /*#__PURE__*/React$1.createElement(DownOutlined, {
947
+ }, this.renderValue(), !this.props.readonly && this.props.options && /*#__PURE__*/React.createElement(DownOutlined, {
948
948
  className: "param-expiries-arrow"
949
949
  })));
950
950
  }
@@ -1021,7 +1021,7 @@ var ExpiriesLimit = /*#__PURE__*/function (_PureComponent) {
1021
1021
  if (!this.value.length) this.value.push({
1022
1022
  expiry: ''
1023
1023
  });
1024
- return /*#__PURE__*/React$1.createElement("div", {
1024
+ return /*#__PURE__*/React.createElement("div", {
1025
1025
  className: classNames('param-expiries-limit', {
1026
1026
  readonly: this.props.readonly
1027
1027
  }, this.props.className),
@@ -1029,30 +1029,30 @@ var ExpiriesLimit = /*#__PURE__*/function (_PureComponent) {
1029
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) {
1030
1030
  return it.expiry;
1031
1031
  }).map(function (it, i) {
1032
- return /*#__PURE__*/React$1.createElement("span", {
1032
+ return /*#__PURE__*/React.createElement("span", {
1033
1033
  className: "param-expiries-limit-val",
1034
1034
  key: i
1035
- }, it.expiry, /*#__PURE__*/React$1.createElement("span", {
1035
+ }, it.expiry, /*#__PURE__*/React.createElement("span", {
1036
1036
  className: "param-expiries-limit-val-sep"
1037
- }, "/"), it.minAumPercentage && it.maxAumPercentage ? "(".concat(NumCvt.show(it.minAumPercentage, true), "%, ").concat(NumCvt.show(it.maxAumPercentage, true), "%)") : '-', /*#__PURE__*/React$1.createElement("span", {
1037
+ }, "/"), it.minAumPercentage && it.maxAumPercentage ? "(".concat(NumCvt.show(it.minAumPercentage, true), "%, ").concat(NumCvt.show(it.maxAumPercentage, true), "%)") : '-', /*#__PURE__*/React.createElement("span", {
1038
1038
  className: "param-expiries-limit-val-sep"
1039
1039
  }, "/"), it.minAbs && it.maxAbs ? "(".concat(it.minAbs, ", ").concat(it.maxAbs, ")") : '-');
1040
- }) : '-' : /*#__PURE__*/React$1.createElement("div", {
1040
+ }) : '-' : /*#__PURE__*/React.createElement("div", {
1041
1041
  className: "param-expiries-limit-inputs"
1042
- }, /*#__PURE__*/React$1.createElement("div", {
1042
+ }, /*#__PURE__*/React.createElement("div", {
1043
1043
  className: "param-expiries readonly"
1044
- }, /*#__PURE__*/React$1.createElement("span", {
1044
+ }, /*#__PURE__*/React.createElement("span", {
1045
1045
  className: "param-expiries-val"
1046
- }, "Expiry")), /*#__PURE__*/React$1.createElement("div", {
1046
+ }, "Expiry")), /*#__PURE__*/React.createElement("div", {
1047
1047
  className: "param-number-range readonly"
1048
- }, "Limit(% of AUM)"), /*#__PURE__*/React$1.createElement("div", {
1048
+ }, "Limit(% of AUM)"), /*#__PURE__*/React.createElement("div", {
1049
1049
  className: "param-number-range readonly"
1050
- }, "Limit(ABS)"), /*#__PURE__*/React$1.createElement("div", {
1050
+ }, "Limit(ABS)"), /*#__PURE__*/React.createElement("div", {
1051
1051
  className: "param-arr-ops readonly"
1052
1052
  }), this.value.map(function (it, i) {
1053
- return /*#__PURE__*/React$1.createElement(React$1.Fragment, {
1053
+ return /*#__PURE__*/React.createElement(React.Fragment, {
1054
1054
  key: i
1055
- }, /*#__PURE__*/React$1.createElement(Expiries, {
1055
+ }, /*#__PURE__*/React.createElement(Expiries, {
1056
1056
  multiple: false,
1057
1057
  options: _this2.props.options,
1058
1058
  value: [it.expiry],
@@ -1065,7 +1065,7 @@ var ExpiriesLimit = /*#__PURE__*/function (_PureComponent) {
1065
1065
  });
1066
1066
  },
1067
1067
  onBlur: _this2.props.onBlur
1068
- }), /*#__PURE__*/React$1.createElement(NumRange, {
1068
+ }), /*#__PURE__*/React.createElement(NumRange, {
1069
1069
  value: {
1070
1070
  min: it.minAumPercentage,
1071
1071
  max: it.maxAumPercentage
@@ -1078,7 +1078,7 @@ var ExpiriesLimit = /*#__PURE__*/function (_PureComponent) {
1078
1078
  },
1079
1079
  isPercentage: true,
1080
1080
  onBlur: _this2.props.onBlur
1081
- }), /*#__PURE__*/React$1.createElement(NumRange, {
1081
+ }), /*#__PURE__*/React.createElement(NumRange, {
1082
1082
  value: {
1083
1083
  min: it.minAbs,
1084
1084
  max: it.maxAbs
@@ -1090,12 +1090,12 @@ var ExpiriesLimit = /*#__PURE__*/function (_PureComponent) {
1090
1090
  });
1091
1091
  },
1092
1092
  onBlur: _this2.props.onBlur
1093
- }), /*#__PURE__*/React$1.createElement("div", {
1093
+ }), /*#__PURE__*/React.createElement("div", {
1094
1094
  className: "param-arr-ops"
1095
- }, /*#__PURE__*/React$1.createElement(PlusOutlined, {
1095
+ }, /*#__PURE__*/React.createElement(PlusOutlined, {
1096
1096
  className: "param-arr-ops-add",
1097
1097
  onClick: _this2.onAdd.bind(null, i)
1098
- }), /*#__PURE__*/React$1.createElement(DeleteOutlined, {
1098
+ }), /*#__PURE__*/React.createElement(DeleteOutlined, {
1099
1099
  className: "param-arr-ops-del",
1100
1100
  onClick: _this2.onDel.bind(null, i)
1101
1101
  })));
@@ -1110,7 +1110,7 @@ var _ParamTypeConfig;
1110
1110
  var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig, ParamType.ParamGroup, {
1111
1111
  name: '参数组',
1112
1112
  Comp: function Comp() {
1113
- return /*#__PURE__*/React$1.createElement(React$1.Fragment, null);
1113
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
1114
1114
  }
1115
1115
  }), _defineProperty(_ParamTypeConfig, ParamType.Number, {
1116
1116
  name: '普通数值',
@@ -1121,7 +1121,7 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
1121
1121
  name: '百分比数值',
1122
1122
  key: 'number',
1123
1123
  Comp: function Comp(props) {
1124
- return /*#__PURE__*/React$1.createElement(Num, Object.assign({}, props, {
1124
+ return /*#__PURE__*/React.createElement(Num, Object.assign({}, props, {
1125
1125
  isPercentage: true
1126
1126
  }));
1127
1127
  },
@@ -1140,7 +1140,7 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
1140
1140
  name: '百分比范围',
1141
1141
  key: 'range',
1142
1142
  Comp: function Comp(props) {
1143
- return /*#__PURE__*/React$1.createElement(NumRange, Object.assign({}, props, {
1143
+ return /*#__PURE__*/React.createElement(NumRange, Object.assign({}, props, {
1144
1144
  isPercentage: true
1145
1145
  }));
1146
1146
  },
@@ -1251,7 +1251,7 @@ var ParamRenderer = /*#__PURE__*/function (_PureComponent) {
1251
1251
  key: "render",
1252
1252
  value: function render() {
1253
1253
  var Comp = this.typeConfig.Comp;
1254
- return /*#__PURE__*/React$1.createElement(Comp, Object.assign({}, this.props, {
1254
+ return /*#__PURE__*/React.createElement(Comp, Object.assign({}, this.props, {
1255
1255
  options: this.props.expiriesOptions,
1256
1256
  value: this.value,
1257
1257
  onChange: this.onChange,
@@ -1264,11 +1264,23 @@ var ParamRenderer = /*#__PURE__*/function (_PureComponent) {
1264
1264
  }(PureComponent);
1265
1265
 
1266
1266
  function ParentSelector(props) {
1267
- var value = useMemo(function () {
1267
+ var _useMemo = useMemo(function () {
1268
1268
  var _props$parentOptions;
1269
1269
 
1270
1270
  var $value = [];
1271
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
+
1272
1284
  var find = function find(item) {
1273
1285
  var _item$children;
1274
1286
 
@@ -1281,17 +1293,26 @@ function ParentSelector(props) {
1281
1293
  }));
1282
1294
  };
1283
1295
 
1284
- var matched = props.value && ((_props$parentOptions = props.parentOptions) === null || _props$parentOptions === void 0 ? void 0 : _props$parentOptions.some(function (it) {
1296
+ var matched = props.value && $options.some(function (it) {
1285
1297
  return find(it);
1286
- }));
1287
- if (!matched) return [];
1288
- return $value;
1289
- }, [props.parentOptions, props.value]);
1290
- return /*#__PURE__*/React$1.createElement(Cascader, {
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.createElement(Cascader, {
1291
1312
  style: props.style,
1292
1313
  disabled: props.readonly,
1293
1314
  placeholder: '请选择',
1294
- options: props.parentOptions,
1315
+ options: options,
1295
1316
  className: classNames('param-parent-selector', {
1296
1317
  readonly: props.readonly
1297
1318
  }, props.className),
@@ -1320,7 +1341,7 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
1320
1341
 
1321
1342
  _this = _super.call.apply(_super, [this].concat(args));
1322
1343
 
1323
- _defineProperty(_assertThisInitialized(_this), "ref", React$1.createRef());
1344
+ _defineProperty(_assertThisInitialized(_this), "ref", React.createRef());
1324
1345
 
1325
1346
  _defineProperty(_assertThisInitialized(_this), "onChange", function (changed, data) {
1326
1347
  var _this$props$onChange, _this$props;
@@ -1341,7 +1362,7 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
1341
1362
  label: '所属分组',
1342
1363
  name: 'parentId',
1343
1364
  Comp: function Comp(props) {
1344
- return /*#__PURE__*/React$1.createElement(ParentSelector, Object.assign({}, props, {
1365
+ return /*#__PURE__*/React.createElement(ParentSelector, Object.assign({}, props, {
1345
1366
  parentOptions: _this2.props.parentOptions
1346
1367
  }));
1347
1368
  },
@@ -1353,7 +1374,7 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
1353
1374
  label: '参数 Key',
1354
1375
  name: 'key',
1355
1376
  Comp: function Comp(props) {
1356
- return /*#__PURE__*/React$1.createElement(Input, Object.assign({
1377
+ return /*#__PURE__*/React.createElement(Input, Object.assign({
1357
1378
  placeholder: '请输入'
1358
1379
  }, props));
1359
1380
  },
@@ -1363,7 +1384,7 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
1363
1384
  label: '参数名称',
1364
1385
  name: 'name',
1365
1386
  Comp: function Comp(props) {
1366
- return /*#__PURE__*/React$1.createElement(Input, Object.assign({
1387
+ return /*#__PURE__*/React.createElement(Input, Object.assign({
1367
1388
  placeholder: '请输入'
1368
1389
  }, props));
1369
1390
  }
@@ -1371,10 +1392,10 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
1371
1392
  label: '参数类型',
1372
1393
  name: 'valueType',
1373
1394
  Comp: function Comp(props) {
1374
- return /*#__PURE__*/React$1.createElement(Select, Object.assign({
1395
+ return /*#__PURE__*/React.createElement(Select, Object.assign({
1375
1396
  placeholder: '请选择'
1376
1397
  }, props), ParamTypeOptions.map(function (it) {
1377
- return /*#__PURE__*/React$1.createElement(Select.Option, {
1398
+ return /*#__PURE__*/React.createElement(Select.Option, {
1378
1399
  key: it.value,
1379
1400
  value: it.value
1380
1401
  }, it.label);
@@ -1390,7 +1411,7 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
1390
1411
  Comp: function Comp(props) {
1391
1412
  var _this2$ref$current;
1392
1413
 
1393
- return /*#__PURE__*/React$1.createElement(ParamRenderer, Object.assign({}, props, {
1414
+ return /*#__PURE__*/React.createElement(ParamRenderer, Object.assign({}, props, {
1394
1415
  expiriesOptions: _this2.props.expiriesOptions,
1395
1416
  valueType: (_this2$ref$current = _this2.ref.current) === null || _this2$ref$current === void 0 ? void 0 : _this2$ref$current.getFieldValue('valueType')
1396
1417
  }));
@@ -1402,7 +1423,7 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
1402
1423
  label: '参数说明',
1403
1424
  name: 'description',
1404
1425
  Comp: function Comp(props) {
1405
- return /*#__PURE__*/React$1.createElement(Input.TextArea, Object.assign({
1426
+ return /*#__PURE__*/React.createElement(Input.TextArea, Object.assign({
1406
1427
  placeholder: '请输入'
1407
1428
  }, props));
1408
1429
  }
@@ -1411,7 +1432,7 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
1411
1432
  }, {
1412
1433
  key: "render",
1413
1434
  value: function render() {
1414
- return /*#__PURE__*/React$1.createElement(Form, {
1435
+ return /*#__PURE__*/React.createElement(Form, {
1415
1436
  className: "param-form",
1416
1437
  ref: this.ref,
1417
1438
  key: JSON.stringify(this.props.initialValues),
@@ -1419,7 +1440,7 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
1419
1440
  onFinish: this.props.onSubmit,
1420
1441
  onValuesChange: this.onChange
1421
1442
  }, this.formItems.map(function (it) {
1422
- return /*#__PURE__*/React$1.createElement(Form.Item, {
1443
+ return /*#__PURE__*/React.createElement(Form.Item, {
1423
1444
  key: it.name,
1424
1445
  label: it.label,
1425
1446
  name: it.name,
@@ -1431,8 +1452,8 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
1431
1452
  }
1432
1453
  }],
1433
1454
  validateTrigger: 'onBlur'
1434
- }, /*#__PURE__*/React$1.createElement(it.Comp, null));
1435
- }), this.props.onSubmit && /*#__PURE__*/React$1.createElement(Button, {
1455
+ }, /*#__PURE__*/React.createElement(it.Comp, null));
1456
+ }), this.props.onSubmit && /*#__PURE__*/React.createElement(Button, {
1436
1457
  type: "primary",
1437
1458
  htmlType: "submit"
1438
1459
  }, "\u63D0\u4EA4"));
@@ -1458,7 +1479,7 @@ var ParamFormModalEl = /*#__PURE__*/function (_PureComponent2) {
1458
1479
 
1459
1480
  _this3 = _super2.call.apply(_super2, [this].concat(args));
1460
1481
 
1461
- _defineProperty(_assertThisInitialized(_this3), "ref", React$1.createRef());
1482
+ _defineProperty(_assertThisInitialized(_this3), "ref", React.createRef());
1462
1483
 
1463
1484
  _defineProperty(_assertThisInitialized(_this3), "state", {
1464
1485
  visible: false,
@@ -1512,20 +1533,20 @@ var ParamFormModalEl = /*#__PURE__*/function (_PureComponent2) {
1512
1533
  }, {
1513
1534
  key: "render",
1514
1535
  value: function render() {
1515
- return /*#__PURE__*/React$1.createElement(Modal, {
1536
+ return /*#__PURE__*/React.createElement(Modal, {
1516
1537
  key: String(this.state.visible),
1517
1538
  width: 640,
1518
1539
  closable: false,
1519
1540
  title: !this.isEdit ? '新增参数' : '修改参数',
1520
1541
  visible: this.state.visible,
1521
- footer: /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(Button, {
1542
+ footer: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
1522
1543
  onClick: this.onHide
1523
- }, "\u53D6\u6D88"), /*#__PURE__*/React$1.createElement(Button, {
1544
+ }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
1524
1545
  type: "primary",
1525
1546
  onClick: this.onSubmit,
1526
1547
  loading: this.state.pending
1527
1548
  }, "\u786E\u8BA4"))
1528
- }, /*#__PURE__*/React$1.createElement(ParamForm, Object.assign({}, this.props, {
1549
+ }, /*#__PURE__*/React.createElement(ParamForm, Object.assign({}, this.props, {
1529
1550
  ref: this.ref,
1530
1551
  onSubmit: undefined
1531
1552
  })));
@@ -1577,7 +1598,7 @@ var ParamValueEditor = /*#__PURE__*/function (_PureComponent) {
1577
1598
 
1578
1599
  _this = _super.call.apply(_super, [this].concat(args));
1579
1600
 
1580
- _defineProperty(_assertThisInitialized(_this), "ref", React$1.createRef());
1601
+ _defineProperty(_assertThisInitialized(_this), "ref", React.createRef());
1581
1602
 
1582
1603
  _defineProperty(_assertThisInitialized(_this), "onChange", function (changed, data) {
1583
1604
  var _this$props$onChange, _this$props;
@@ -1597,7 +1618,7 @@ var ParamValueEditor = /*#__PURE__*/function (_PureComponent) {
1597
1618
  label: 'Parameter',
1598
1619
  name: 'paramId',
1599
1620
  Comp: function Comp(props) {
1600
- return /*#__PURE__*/React$1.createElement(ParentSelector, Object.assign({}, props, {
1621
+ return /*#__PURE__*/React.createElement(ParentSelector, Object.assign({}, props, {
1601
1622
  readonly: true
1602
1623
  }));
1603
1624
  }
@@ -1605,7 +1626,7 @@ var ParamValueEditor = /*#__PURE__*/function (_PureComponent) {
1605
1626
  label: 'Description',
1606
1627
  name: 'description',
1607
1628
  Comp: function Comp(props) {
1608
- return /*#__PURE__*/React$1.createElement("span", {
1629
+ return /*#__PURE__*/React.createElement("span", {
1609
1630
  className: "param-value-editor-desc",
1610
1631
  style: {
1611
1632
  lineHeight: '20px',
@@ -1617,7 +1638,7 @@ var ParamValueEditor = /*#__PURE__*/function (_PureComponent) {
1617
1638
  label: 'Value before',
1618
1639
  name: 'valueBefore',
1619
1640
  Comp: function Comp(props) {
1620
- return /*#__PURE__*/React$1.createElement(ParamRenderer, Object.assign({}, props, {
1641
+ return /*#__PURE__*/React.createElement(ParamRenderer, Object.assign({}, props, {
1621
1642
  readonly: true,
1622
1643
  parentOptions: _this2.props.allParams
1623
1644
  }));
@@ -1626,7 +1647,7 @@ var ParamValueEditor = /*#__PURE__*/function (_PureComponent) {
1626
1647
  label: 'Value after',
1627
1648
  name: 'value',
1628
1649
  Comp: function Comp(props) {
1629
- return /*#__PURE__*/React$1.createElement(ParamRenderer, Object.assign({}, props, {
1650
+ return /*#__PURE__*/React.createElement(ParamRenderer, Object.assign({}, props, {
1630
1651
  expiriesOptions: _this2.props.expiriesOptions,
1631
1652
  valueType: _this2.props.valueType
1632
1653
  }));
@@ -1642,7 +1663,7 @@ var ParamValueEditor = /*#__PURE__*/function (_PureComponent) {
1642
1663
  }, {
1643
1664
  key: "render",
1644
1665
  value: function render() {
1645
- return /*#__PURE__*/React$1.createElement(Form, {
1666
+ return /*#__PURE__*/React.createElement(Form, {
1646
1667
  className: "param-value-editor",
1647
1668
  ref: this.ref,
1648
1669
  key: this.props.valueType,
@@ -1650,7 +1671,7 @@ var ParamValueEditor = /*#__PURE__*/function (_PureComponent) {
1650
1671
  onFinish: this.props.onSubmit,
1651
1672
  onValuesChange: this.onChange
1652
1673
  }, this.formItems.map(function (it) {
1653
- return /*#__PURE__*/React$1.createElement(Form.Item, {
1674
+ return /*#__PURE__*/React.createElement(Form.Item, {
1654
1675
  key: it.name,
1655
1676
  label: it.label,
1656
1677
  name: it.name,
@@ -1662,8 +1683,8 @@ var ParamValueEditor = /*#__PURE__*/function (_PureComponent) {
1662
1683
  }
1663
1684
  }],
1664
1685
  validateTrigger: 'onBlur'
1665
- }, /*#__PURE__*/React$1.createElement(it.Comp, null));
1666
- }), this.props.onSubmit && /*#__PURE__*/React$1.createElement(Button, {
1686
+ }, /*#__PURE__*/React.createElement(it.Comp, null));
1687
+ }), this.props.onSubmit && /*#__PURE__*/React.createElement(Button, {
1667
1688
  type: "primary",
1668
1689
  htmlType: "submit"
1669
1690
  }, "\u63D0\u4EA4"));
@@ -1688,7 +1709,7 @@ var ParamValueEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
1688
1709
 
1689
1710
  _this3 = _super2.call.apply(_super2, [this].concat(args));
1690
1711
 
1691
- _defineProperty(_assertThisInitialized(_this3), "ref", React$1.createRef());
1712
+ _defineProperty(_assertThisInitialized(_this3), "ref", React.createRef());
1692
1713
 
1693
1714
  _defineProperty(_assertThisInitialized(_this3), "state", {
1694
1715
  visible: false,
@@ -1735,20 +1756,20 @@ var ParamValueEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
1735
1756
  _createClass(ParamValueEditorModalEl, [{
1736
1757
  key: "render",
1737
1758
  value: function render() {
1738
- return /*#__PURE__*/React$1.createElement(Modal, {
1759
+ return /*#__PURE__*/React.createElement(Modal, {
1739
1760
  key: String(this.state.visible),
1740
1761
  width: 640,
1741
1762
  title: 'Edit Value',
1742
1763
  closable: false,
1743
1764
  visible: this.state.visible,
1744
- footer: /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(Button, {
1765
+ footer: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
1745
1766
  onClick: this.onHide
1746
- }, "Cancel"), /*#__PURE__*/React$1.createElement(Button, {
1767
+ }, "Cancel"), /*#__PURE__*/React.createElement(Button, {
1747
1768
  type: "primary",
1748
1769
  onClick: this.onSubmit,
1749
1770
  loading: this.state.pending
1750
1771
  }, "Submit"))
1751
- }, /*#__PURE__*/React$1.createElement(ParamValueEditor, Object.assign({}, this.props, {
1772
+ }, /*#__PURE__*/React.createElement(ParamValueEditor, Object.assign({}, this.props, {
1752
1773
  ref: this.ref,
1753
1774
  onSubmit: undefined
1754
1775
  })));
@@ -1849,7 +1870,7 @@ var ParamGroupEditor = /*#__PURE__*/function (_PureComponent) {
1849
1870
 
1850
1871
  _this = _super.call.apply(_super, [this].concat(args));
1851
1872
 
1852
- _defineProperty(_assertThisInitialized(_this), "ref", React$1.createRef());
1873
+ _defineProperty(_assertThisInitialized(_this), "ref", React.createRef());
1853
1874
 
1854
1875
  _defineProperty(_assertThisInitialized(_this), "onChange", function (changed, data) {
1855
1876
  var _this$props$onChange, _this$props;
@@ -1866,12 +1887,12 @@ var ParamGroupEditor = /*#__PURE__*/function (_PureComponent) {
1866
1887
  var _this$props$initialVa,
1867
1888
  _this2 = this;
1868
1889
 
1869
- var isFirstLevel = !this.props.allParams && !((_this$props$initialVa = this.props.initialValues) === null || _this$props$initialVa === void 0 ? void 0 : _this$props$initialVa.parentId);
1890
+ var isFirstLevel = !this.props.parentOptions && !((_this$props$initialVa = this.props.initialValues) === null || _this$props$initialVa === void 0 ? void 0 : _this$props$initialVa.parentId);
1870
1891
  var items = [{
1871
1892
  label: '参数组名称',
1872
1893
  name: 'name',
1873
1894
  Comp: function Comp(props) {
1874
- return /*#__PURE__*/React$1.createElement(Input, Object.assign({}, props, {
1895
+ return /*#__PURE__*/React.createElement(Input, Object.assign({}, props, {
1875
1896
  placeholder: '请输入'
1876
1897
  }));
1877
1898
  },
@@ -1882,7 +1903,7 @@ var ParamGroupEditor = /*#__PURE__*/function (_PureComponent) {
1882
1903
  label: '业务流程图',
1883
1904
  name: 'descriptionUrl',
1884
1905
  Comp: function Comp(props) {
1885
- return /*#__PURE__*/React$1.createElement(ImageUpload, Object.assign({}, props, {
1906
+ return /*#__PURE__*/React.createElement(ImageUpload, Object.assign({}, props, {
1886
1907
  getSignedUrl: _this2.props.getSignedUrl,
1887
1908
  handleUpload: _this2.props.handleUpload
1888
1909
  }));
@@ -1897,8 +1918,8 @@ var ParamGroupEditor = /*#__PURE__*/function (_PureComponent) {
1897
1918
  label: '父级参数组',
1898
1919
  name: 'parentId',
1899
1920
  Comp: function Comp(props) {
1900
- return /*#__PURE__*/React$1.createElement(ParentSelector, Object.assign({}, props, {
1901
- parentOptions: _this2.props.allParams
1921
+ return /*#__PURE__*/React.createElement(ParentSelector, Object.assign({}, props, {
1922
+ parentOptions: _this2.props.parentOptions
1902
1923
  }));
1903
1924
  }
1904
1925
  });
@@ -1909,14 +1930,14 @@ var ParamGroupEditor = /*#__PURE__*/function (_PureComponent) {
1909
1930
  }, {
1910
1931
  key: "render",
1911
1932
  value: function render() {
1912
- return /*#__PURE__*/React$1.createElement(Form, {
1933
+ return /*#__PURE__*/React.createElement(Form, {
1913
1934
  className: "param-value-editor",
1914
1935
  ref: this.ref,
1915
1936
  initialValues: this.props.initialValues,
1916
1937
  onFinish: this.props.onSubmit,
1917
1938
  onValuesChange: this.onChange
1918
1939
  }, this.formItems.map(function (it) {
1919
- return /*#__PURE__*/React$1.createElement(Form.Item, {
1940
+ return /*#__PURE__*/React.createElement(Form.Item, {
1920
1941
  key: it.name,
1921
1942
  label: it.label,
1922
1943
  name: it.name,
@@ -1928,8 +1949,8 @@ var ParamGroupEditor = /*#__PURE__*/function (_PureComponent) {
1928
1949
  }
1929
1950
  }],
1930
1951
  validateTrigger: 'onBlur'
1931
- }, /*#__PURE__*/React$1.createElement(it.Comp, null));
1932
- }), this.props.onSubmit && /*#__PURE__*/React$1.createElement(Button, {
1952
+ }, /*#__PURE__*/React.createElement(it.Comp, null));
1953
+ }), this.props.onSubmit && /*#__PURE__*/React.createElement(Button, {
1933
1954
  type: "primary",
1934
1955
  htmlType: "submit"
1935
1956
  }, "\u63D0\u4EA4"));
@@ -1954,7 +1975,7 @@ var ParamGroupEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
1954
1975
 
1955
1976
  _this3 = _super2.call.apply(_super2, [this].concat(args));
1956
1977
 
1957
- _defineProperty(_assertThisInitialized(_this3), "ref", React$1.createRef());
1978
+ _defineProperty(_assertThisInitialized(_this3), "ref", React.createRef());
1958
1979
 
1959
1980
  _defineProperty(_assertThisInitialized(_this3), "state", {
1960
1981
  visible: false,
@@ -2010,20 +2031,20 @@ var ParamGroupEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
2010
2031
  value: function render() {
2011
2032
  var _this$props$initialVa3;
2012
2033
 
2013
- return /*#__PURE__*/React$1.createElement(Modal, {
2034
+ return /*#__PURE__*/React.createElement(Modal, {
2014
2035
  key: String(this.state.visible),
2015
2036
  width: 640,
2016
2037
  title: ((_this$props$initialVa3 = this.props.initialValues) === null || _this$props$initialVa3 === void 0 ? void 0 : _this$props$initialVa3.paramId) ? '编辑参数组' : '新增参数组',
2017
2038
  closable: false,
2018
2039
  visible: this.state.visible,
2019
- footer: /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(Button, {
2040
+ footer: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
2020
2041
  onClick: this.onHide
2021
- }, "Cancel"), /*#__PURE__*/React$1.createElement(Button, {
2042
+ }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
2022
2043
  type: "primary",
2023
2044
  onClick: this.onSubmit,
2024
2045
  loading: this.state.pending
2025
- }, "Submit"))
2026
- }, /*#__PURE__*/React$1.createElement(ParamGroupEditor, Object.assign({}, this.props, {
2046
+ }, "\u786E\u5B9A"))
2047
+ }, /*#__PURE__*/React.createElement(ParamGroupEditor, Object.assign({}, this.props, {
2027
2048
  ref: this.ref,
2028
2049
  onSubmit: undefined
2029
2050
  })));
@@ -2058,4 +2079,265 @@ var ParamGroupEditorModal = /*#__PURE__*/function () {
2058
2079
 
2059
2080
  _defineProperty(ParamGroupEditorModal, "el", new ReactGlobalComp('param-group-editor-modal', ParamGroupEditorModalEl));
2060
2081
 
2061
- export { ParamForm, ParamFormModal, ParamGroupEditor, ParamGroupEditorModal, ParamGroupEditorModalEl, ParamRenderer, ParamType, ParamTypeConfig, ParamTypeOptions, ParamValueEditor, ParamValueEditorModal, ParamValueEditorModalEl, emptyValidator, expiriesValidator, expiryValidator, formatNum, isExpired, isNullLike, keyValidator, numRangeValidator, paramValidator, validatorCvt };
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.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 _objectSpread2(_objectSpread2({}, _this2.state.paramsMap[$paramId]), {}, {
2165
+ parentId: it.$paramId
2166
+ });
2167
+ }))
2168
+ });
2169
+ }
2170
+
2171
+ return _objectSpread2(_objectSpread2({}, it), {}, {
2172
+ children: (_it$children3 = it.children) === null || _it$children3 === void 0 ? void 0 : _it$children3.filter(filter).map(map)
2173
+ });
2174
+ };
2175
+
2176
+ return this.props.allParams.filter(filter).map(map);
2177
+ }
2178
+ }, {
2179
+ key: "formItems",
2180
+ get: function get() {
2181
+ var _this3 = this;
2182
+
2183
+ var items = [{
2184
+ label: '选择分组',
2185
+ name: 'parentId',
2186
+ Comp: function Comp(props) {
2187
+ return /*#__PURE__*/React.createElement(ParentSelector, Object.assign({}, props, {
2188
+ parentOptions: _this3.state.options
2189
+ }));
2190
+ }
2191
+ }];
2192
+ return items;
2193
+ }
2194
+ }, {
2195
+ key: "render",
2196
+ value: function render() {
2197
+ return /*#__PURE__*/React.createElement(Form, {
2198
+ className: "param-value-editor",
2199
+ ref: this.ref,
2200
+ onFinish: this.props.onSubmit
2201
+ }, this.formItems.map(function (it) {
2202
+ return /*#__PURE__*/React.createElement(Form.Item, {
2203
+ key: it.name,
2204
+ label: it.label,
2205
+ name: it.name,
2206
+ required: it.required,
2207
+ requiredMark: true,
2208
+ rules: [{
2209
+ validator: it.validator || function () {
2210
+ return Promise.resolve();
2211
+ }
2212
+ }],
2213
+ validateTrigger: 'onBlur'
2214
+ }, /*#__PURE__*/React.createElement(it.Comp, null));
2215
+ }), this.props.onSubmit && /*#__PURE__*/React.createElement(Button, {
2216
+ type: "primary",
2217
+ htmlType: "submit"
2218
+ }, "\u63D0\u4EA4"));
2219
+ }
2220
+ }], [{
2221
+ key: "getDerivedStateFromProps",
2222
+ value: function getDerivedStateFromProps(props, state) {
2223
+ if (props.allParams !== state.preProps.allParams) {
2224
+ state.paramsMap = genParamsMap(props);
2225
+
2226
+ if (props.targetParams !== state.preProps.targetParams) {
2227
+ state.options = genOptions(props);
2228
+ }
2229
+ }
2230
+
2231
+ return _objectSpread2(_objectSpread2({}, state), {}, {
2232
+ preProps: props
2233
+ });
2234
+ }
2235
+ }]);
2236
+
2237
+ return ParamMover;
2238
+ }(PureComponent);
2239
+ var ParamMoverModalEl = /*#__PURE__*/function (_PureComponent2) {
2240
+ _inherits(ParamMoverModalEl, _PureComponent2);
2241
+
2242
+ var _super2 = _createSuper(ParamMoverModalEl);
2243
+
2244
+ function ParamMoverModalEl() {
2245
+ var _this4;
2246
+
2247
+ _classCallCheck(this, ParamMoverModalEl);
2248
+
2249
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
2250
+ args[_key2] = arguments[_key2];
2251
+ }
2252
+
2253
+ _this4 = _super2.call.apply(_super2, [this].concat(args));
2254
+
2255
+ _defineProperty(_assertThisInitialized(_this4), "ref", React.createRef());
2256
+
2257
+ _defineProperty(_assertThisInitialized(_this4), "state", {
2258
+ visible: false,
2259
+ pending: false
2260
+ });
2261
+
2262
+ _defineProperty(_assertThisInitialized(_this4), "onShow", function () {
2263
+ return _this4.setState({
2264
+ visible: true
2265
+ });
2266
+ });
2267
+
2268
+ _defineProperty(_assertThisInitialized(_this4), "onHide", function () {
2269
+ return _this4.setState({
2270
+ visible: false
2271
+ });
2272
+ });
2273
+
2274
+ _defineProperty(_assertThisInitialized(_this4), "onSubmit", function () {
2275
+ var form = _this4.ref.current.ref.current;
2276
+ return form.validateFields().then(function () {
2277
+ return _this4.setState({
2278
+ pending: true
2279
+ });
2280
+ }).then(function () {
2281
+ return _this4.props.onSubmit(_this4.ref.current.newParams);
2282
+ }).then(_this4.onHide).finally(function () {
2283
+ return _this4.setState({
2284
+ pending: false
2285
+ });
2286
+ });
2287
+ });
2288
+
2289
+ return _this4;
2290
+ }
2291
+
2292
+ _createClass(ParamMoverModalEl, [{
2293
+ key: "render",
2294
+ value: function render() {
2295
+ return /*#__PURE__*/React.createElement(Modal, {
2296
+ key: String(this.state.visible),
2297
+ width: 640,
2298
+ title: '移动参数',
2299
+ closable: false,
2300
+ visible: this.state.visible,
2301
+ footer: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
2302
+ onClick: this.onHide
2303
+ }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
2304
+ type: "primary",
2305
+ onClick: this.onSubmit,
2306
+ loading: this.state.pending
2307
+ }, "\u786E\u5B9A"))
2308
+ }, /*#__PURE__*/React.createElement(ParamMover, Object.assign({}, this.props, {
2309
+ ref: this.ref,
2310
+ onSubmit: undefined
2311
+ })));
2312
+ }
2313
+ }]);
2314
+
2315
+ return ParamMoverModalEl;
2316
+ }(PureComponent);
2317
+ var ParamMoverModal = /*#__PURE__*/function () {
2318
+ function ParamMoverModal() {
2319
+ _classCallCheck(this, ParamMoverModal);
2320
+ }
2321
+
2322
+ _createClass(ParamMoverModal, null, [{
2323
+ key: "show",
2324
+ value: function show(props) {
2325
+ return ParamMoverModal.el.render(props).then(function () {
2326
+ ParamMoverModal.el.ref.onShow();
2327
+ });
2328
+ }
2329
+ }, {
2330
+ key: "hide",
2331
+ value: function hide() {
2332
+ return ParamMoverModal.el.render().then(function () {
2333
+ ParamMoverModal.el.ref.onHide();
2334
+ });
2335
+ }
2336
+ }]);
2337
+
2338
+ return ParamMoverModal;
2339
+ }();
2340
+
2341
+ _defineProperty(ParamMoverModal, "el", new ReactGlobalComp('param-mover-modal', ParamMoverModalEl));
2342
+
2343
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalplus/params-about",
3
- "version": "0.1.4",
3
+ "version": "0.1.7",
4
4
  "description": "A description for the module",
5
5
  "main": "./lib/umd/index.js",
6
6
  "module": "./lib/es/index.js",