@signalplus/params-about 1.0.26-alpha → 1.0.26-alpha10

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 CHANGED
@@ -92,6 +92,7 @@ interface ParamFormProps {
92
92
  groupEditable?: boolean;
93
93
  onChange?(data: ParamFormData): void;
94
94
  onSubmit?(data: ParamFormData): any;
95
+ onModalWidthChange?(width: number): any;
95
96
  }
96
97
  declare class ParamForm extends PureComponent<ParamFormProps> {
97
98
  ref: React.RefObject<any>;
@@ -110,12 +111,13 @@ declare class ParamFormModalEl extends PureComponent<ParamFormProps & Required<P
110
111
  state: {
111
112
  visible: boolean;
112
113
  pending: boolean;
114
+ width: number | undefined;
113
115
  };
114
116
  get isEdit(): boolean;
115
117
  onShow: () => void;
116
118
  onHide: () => void;
117
119
  onSubmit: () => any;
118
- width: string | null;
120
+ handleModalWidthChange: (width: number) => void;
119
121
  render(): JSX.Element;
120
122
  }
121
123
  declare class ParamFormModal {
@@ -139,6 +141,7 @@ interface ParamValueEditorProps {
139
141
  initialValues: ParamValueEditorData;
140
142
  onChange?(data: ParamValueEditorData): void;
141
143
  onSubmit?(data: ParamValueEditorData): any;
144
+ onModalWidthChange(width: number): void;
142
145
  }
143
146
  declare class ParamValueEditor extends PureComponent<ParamValueEditorProps> {
144
147
  ref: React.RefObject<any>;
@@ -158,10 +161,12 @@ declare class ParamValueEditorModalEl extends PureComponent<ParamValueEditorProp
158
161
  state: {
159
162
  visible: boolean;
160
163
  pending: boolean;
164
+ width: number;
161
165
  };
162
166
  onShow: () => void;
163
167
  onHide: () => void;
164
168
  onSubmit: () => any;
169
+ handleModalWidthChange: (width: number) => void;
165
170
  render(): JSX.Element;
166
171
  }
167
172
  declare class ParamValueEditorModal {
package/lib/es/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Bundle of @signalplus/params-about
3
- * Generated: 2025-10-15
4
- * Version: 1.0.26-alpha
3
+ * Generated: 2025-11-06
4
+ * Version: 1.0.26-alpha10
5
5
  * License: MIT
6
6
  * Author: 2631541504@qq.com
7
7
  */
@@ -629,7 +629,7 @@ var NumRange = /*#__PURE__*/function (_PureComponent) {
629
629
  }, this.props.className),
630
630
  style: this.props.style
631
631
  }, this.props.readonly ? '(' : '', /*#__PURE__*/React.createElement(Num, {
632
- placeholder: 'Min',
632
+ placeholder: this.props.minName || 'Min',
633
633
  value: (_this$props$value = this.props.value) === null || _this$props$value === void 0 ? void 0 : _this$props$value.min,
634
634
  onChange: this.onChange.bind(null, 'min'),
635
635
  isPercentage: this.props.isPercentage,
@@ -642,7 +642,7 @@ var NumRange = /*#__PURE__*/function (_PureComponent) {
642
642
  marginRight: 4
643
643
  } : undefined
644
644
  }, this.props.readonly ? ',' : '~'), /*#__PURE__*/React.createElement(Num, {
645
- placeholder: 'Max',
645
+ placeholder: this.props.maxName || 'Max',
646
646
  value: (_this$props$value2 = this.props.value) === null || _this$props$value2 === void 0 ? void 0 : _this$props$value2.max,
647
647
  onChange: this.onChange.bind(null, 'max'),
648
648
  isPercentage: this.props.isPercentage,
@@ -2504,6 +2504,118 @@ var TenorBucketHandlerList = /*#__PURE__*/function (_PureComponent) {
2504
2504
  return TenorBucketHandlerList;
2505
2505
  }(PureComponent);
2506
2506
 
2507
+ var NumRangeFromTo = /*#__PURE__*/function (_PureComponent) {
2508
+ _inherits(NumRangeFromTo, _PureComponent);
2509
+
2510
+ var _super = _createSuper(NumRangeFromTo);
2511
+
2512
+ function NumRangeFromTo() {
2513
+ var _this;
2514
+
2515
+ _classCallCheck(this, NumRangeFromTo);
2516
+
2517
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2518
+ args[_key] = arguments[_key];
2519
+ }
2520
+
2521
+ _this = _super.call.apply(_super, [this].concat(args));
2522
+
2523
+ _defineProperty(_assertThisInitialized(_this), "onChange", function (key, val) {
2524
+ var _this$props$onChange, _this$props;
2525
+
2526
+ var value = _objectSpread2({}, _this.props.value);
2527
+
2528
+ value[key] = val;
2529
+ (_this$props$onChange = (_this$props = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props, value);
2530
+ });
2531
+
2532
+ return _this;
2533
+ }
2534
+
2535
+ _createClass(NumRangeFromTo, [{
2536
+ key: "render",
2537
+ value: function render() {
2538
+ var _this$props$value, _this$props$value2;
2539
+
2540
+ return /*#__PURE__*/React.createElement("div", {
2541
+ className: classNames('param-number-range', {
2542
+ readonly: this.props.readonly
2543
+ }, this.props.className),
2544
+ style: this.props.style
2545
+ }, this.props.readonly ? '(' : '', /*#__PURE__*/React.createElement(Num, {
2546
+ placeholder: 'From',
2547
+ value: (_this$props$value = this.props.value) === null || _this$props$value === void 0 ? void 0 : _this$props$value.from,
2548
+ onChange: this.onChange.bind(null, 'from'),
2549
+ isPercentage: this.props.isPercentage,
2550
+ readonly: this.props.readonly,
2551
+ onBlur: this.props.onBlur
2552
+ }), /*#__PURE__*/React.createElement("span", {
2553
+ className: "param-number-range-sep",
2554
+ style: this.props.readonly ? {
2555
+ marginLeft: 0,
2556
+ marginRight: 4
2557
+ } : undefined
2558
+ }, this.props.readonly ? ',' : '~'), /*#__PURE__*/React.createElement(Num, {
2559
+ placeholder: 'To',
2560
+ value: (_this$props$value2 = this.props.value) === null || _this$props$value2 === void 0 ? void 0 : _this$props$value2.to,
2561
+ onChange: this.onChange.bind(null, 'to'),
2562
+ isPercentage: this.props.isPercentage,
2563
+ readonly: this.props.readonly,
2564
+ onBlur: this.props.onBlur
2565
+ }), this.props.readonly ? ')' : '');
2566
+ }
2567
+ }]);
2568
+
2569
+ return NumRangeFromTo;
2570
+ }(PureComponent);
2571
+
2572
+ function hasRangeOverlap(range1, range2) {
2573
+ var _range1$min, _range1$max, _range2$min, _range2$max;
2574
+
2575
+ var min1 = (_range1$min = range1.min) !== null && _range1$min !== void 0 ? _range1$min : -Infinity;
2576
+ var max1 = (_range1$max = range1.max) !== null && _range1$max !== void 0 ? _range1$max : Infinity;
2577
+ var min2 = (_range2$min = range2.min) !== null && _range2$min !== void 0 ? _range2$min : -Infinity;
2578
+ var max2 = (_range2$max = range2.max) !== null && _range2$max !== void 0 ? _range2$max : Infinity; // 边界相等不算重叠,所以用严格比较
2579
+
2580
+ return min1 < max2 && min2 < max1;
2581
+ }
2582
+ /**
2583
+ * 检查VegaRules数组是否合法
2584
+ */
2585
+
2586
+
2587
+ function validateVegaRules(rules) {
2588
+ for (var i = 0; i < rules.length; i++) {
2589
+ var _currentRule$optionTy;
2590
+
2591
+ var currentRule = rules[i];
2592
+ var currentType = (_currentRule$optionTy = currentRule.optionType) !== null && _currentRule$optionTy !== void 0 ? _currentRule$optionTy : 'Both'; // 默认按Both处理
2593
+
2594
+ for (var j = i + 1; j < rules.length; j++) {
2595
+ var _compareRule$optionTy;
2596
+
2597
+ var compareRule = rules[j];
2598
+ var compareType = (_compareRule$optionTy = compareRule.optionType) !== null && _compareRule$optionTy !== void 0 ? _compareRule$optionTy : 'Both'; // 检查是否需要比较这两个规则
2599
+
2600
+ var shouldCompare = false;
2601
+
2602
+ if (currentType === 'Both' || compareType === 'Both') {
2603
+ // 任意一个是Both,就需要比较
2604
+ shouldCompare = true;
2605
+ } else if (currentType === compareType) {
2606
+ // 类型相同(都是Call或都是Put),需要比较
2607
+ shouldCompare = true;
2608
+ } // 类型不同(一个Call一个Put),不需要比较
2609
+
2610
+
2611
+ if (shouldCompare && hasRangeOverlap(currentRule.deltaRange, compareRule.deltaRange)) {
2612
+ return false; // 发现重叠,不合法
2613
+ }
2614
+ }
2615
+ }
2616
+
2617
+ return true; // 没有发现重叠,合法
2618
+ }
2507
2619
  var ExpiryVegaAlphaByEdgeList = /*#__PURE__*/function (_PureComponent) {
2508
2620
  _inherits(ExpiryVegaAlphaByEdgeList, _PureComponent);
2509
2621
 
@@ -2526,7 +2638,7 @@ var ExpiryVegaAlphaByEdgeList = /*#__PURE__*/function (_PureComponent) {
2526
2638
  var _item$vegaRules, _item$expiry;
2527
2639
 
2528
2640
  var vegaRulesValid = item.vegaRules ? (_item$vegaRules = item.vegaRules) === null || _item$vegaRules === void 0 ? void 0 : _item$vegaRules.find(function (it) {
2529
- return it.deltaRange.min || it.deltaRange.max || it.bidEdgeRange.min || it.bidEdgeRange.max || it.askEdgeRange.min || it.askEdgeRange.max;
2641
+ return it.deltaRange.min || it.deltaRange.max || it.bidEdgeSpan.from || it.bidEdgeSpan.to || it.askEdgeSpan.from || it.askEdgeSpan.to;
2530
2642
  }) : true;
2531
2643
  return !((_item$expiry = item.expiry) === null || _item$expiry === void 0 ? void 0 : _item$expiry.trim()) && !item.vegaTarget && !!vegaRulesValid;
2532
2644
  });
@@ -2545,13 +2657,13 @@ var ExpiryVegaAlphaByEdgeList = /*#__PURE__*/function (_PureComponent) {
2545
2657
  min: undefined,
2546
2658
  max: undefined
2547
2659
  },
2548
- bidEdgeRange: {
2549
- min: undefined,
2550
- max: undefined
2660
+ bidEdgeSpan: {
2661
+ from: undefined,
2662
+ to: undefined
2551
2663
  },
2552
- askEdgeRange: {
2553
- min: undefined,
2554
- max: undefined
2664
+ askEdgeSpan: {
2665
+ from: undefined,
2666
+ to: undefined
2555
2667
  },
2556
2668
  allowTaker: false,
2557
2669
  disable: false
@@ -2560,38 +2672,38 @@ var ExpiryVegaAlphaByEdgeList = /*#__PURE__*/function (_PureComponent) {
2560
2672
 
2561
2673
  if (key) {
2562
2674
  if (subKey && typeof k === 'number') {
2563
- if (subKey === 'optionType') {
2564
- // console.log('changeValue==========================', value, i, val, key, k, subKey);
2565
- if (val === 'Both') {
2566
- value[i].vegaRules = [_objectSpread2(_objectSpread2({}, value[i].vegaRules[k]), {}, {
2567
- optionType: 'Both'
2568
- })];
2569
- } else {
2570
- var _value$i$vegaRules;
2571
-
2572
- if (((_value$i$vegaRules = value[i].vegaRules) === null || _value$i$vegaRules === void 0 ? void 0 : _value$i$vegaRules.length) <= 1) value[i].vegaRules = [_objectSpread2(_objectSpread2({}, value[i].vegaRules[k]), {}, {
2573
- optionType: val
2574
- }), {
2575
- optionType: val === 'Call' ? 'Put' : 'Call',
2576
- deltaRange: {
2577
- min: undefined,
2578
- max: undefined
2579
- },
2580
- bidEdgeRange: {
2581
- min: undefined,
2582
- max: undefined
2583
- },
2584
- askEdgeRange: {
2585
- min: undefined,
2586
- max: undefined
2587
- },
2588
- allowTaker: false,
2589
- disable: false
2590
- }];else value[i].vegaRules[k][subKey] = val;
2591
- }
2592
- } else {
2593
- value[i].vegaRules[k][subKey] = val;
2594
- }
2675
+ // if (subKey === 'optionType') {
2676
+ // // console.log('changeValue==========================', value, i, val, key, k, subKey);
2677
+ // if (val === 'Both') {
2678
+ // value[i].vegaRules = [{ ...value[i].vegaRules[k], optionType: 'Both' }];
2679
+ // } else {
2680
+ // if (value[i].vegaRules?.length <= 1)
2681
+ // value[i].vegaRules = [
2682
+ // { ...value[i].vegaRules[k], optionType: val },
2683
+ // {
2684
+ // optionType: val === 'Call' ? 'Put' : 'Call',
2685
+ // deltaRange: {
2686
+ // min: undefined,
2687
+ // max: undefined,
2688
+ // },
2689
+ // bidEdgeSpan: {
2690
+ // from: undefined,
2691
+ // to: undefined,
2692
+ // },
2693
+ // askEdgeSpan: {
2694
+ // from: undefined,
2695
+ // to: undefined,
2696
+ // },
2697
+ // allowTaker: false,
2698
+ // disable: false,
2699
+ // },
2700
+ // ];
2701
+ // else value[i].vegaRules[k][subKey] = val as never;
2702
+ // }
2703
+ // } else {
2704
+ // value[i].vegaRules[k][subKey] = val as never;
2705
+ // }
2706
+ value[i].vegaRules[k][subKey] = val;
2595
2707
  } else {
2596
2708
  value[i][key] = val;
2597
2709
  }
@@ -2616,13 +2728,13 @@ var ExpiryVegaAlphaByEdgeList = /*#__PURE__*/function (_PureComponent) {
2616
2728
  min: undefined,
2617
2729
  max: undefined
2618
2730
  },
2619
- bidEdgeRange: {
2620
- min: undefined,
2621
- max: undefined
2731
+ bidEdgeSpan: {
2732
+ from: undefined,
2733
+ to: undefined
2622
2734
  },
2623
- askEdgeRange: {
2624
- min: undefined,
2625
- max: undefined
2735
+ askEdgeSpan: {
2736
+ from: undefined,
2737
+ to: undefined
2626
2738
  },
2627
2739
  allowTaker: false,
2628
2740
  disable: false
@@ -2632,16 +2744,52 @@ var ExpiryVegaAlphaByEdgeList = /*#__PURE__*/function (_PureComponent) {
2632
2744
  (_this$props$onBlur = (_this$props3 = _this.props).onBlur) === null || _this$props$onBlur === void 0 ? void 0 : _this$props$onBlur.call(_this$props3);
2633
2745
  });
2634
2746
 
2635
- _defineProperty(_assertThisInitialized(_this), "onDel", function (i) {
2747
+ _defineProperty(_assertThisInitialized(_this), "onAddRule", function (i, k) {
2636
2748
  var _this$props$onChange3, _this$props4, _this$props$onBlur2, _this$props5;
2637
2749
 
2638
2750
  var value = _toConsumableArray(_this.value);
2639
2751
 
2640
- value.splice(i, 1);
2641
- (_this$props$onChange3 = (_this$props4 = _this.props).onChange) === null || _this$props$onChange3 === void 0 ? void 0 : _this$props$onChange3.call(_this$props4, value.length === 1 && _this.isEmptyItem(value[0]) ? [] : value);
2752
+ value[i].vegaRules.splice(k + 1, 0, {
2753
+ optionType: undefined,
2754
+ deltaRange: {
2755
+ min: undefined,
2756
+ max: undefined
2757
+ },
2758
+ bidEdgeSpan: {
2759
+ from: undefined,
2760
+ to: undefined
2761
+ },
2762
+ askEdgeSpan: {
2763
+ from: undefined,
2764
+ to: undefined
2765
+ },
2766
+ allowTaker: false,
2767
+ disable: false
2768
+ });
2769
+ (_this$props$onChange3 = (_this$props4 = _this.props).onChange) === null || _this$props$onChange3 === void 0 ? void 0 : _this$props$onChange3.call(_this$props4, value);
2642
2770
  (_this$props$onBlur2 = (_this$props5 = _this.props).onBlur) === null || _this$props$onBlur2 === void 0 ? void 0 : _this$props$onBlur2.call(_this$props5);
2643
2771
  });
2644
2772
 
2773
+ _defineProperty(_assertThisInitialized(_this), "onDel", function (i) {
2774
+ var _this$props$onChange4, _this$props6, _this$props$onBlur3, _this$props7;
2775
+
2776
+ var value = _toConsumableArray(_this.value);
2777
+
2778
+ value.splice(i, 1);
2779
+ (_this$props$onChange4 = (_this$props6 = _this.props).onChange) === null || _this$props$onChange4 === void 0 ? void 0 : _this$props$onChange4.call(_this$props6, value.length === 1 && _this.isEmptyItem(value[0]) ? [] : value);
2780
+ (_this$props$onBlur3 = (_this$props7 = _this.props).onBlur) === null || _this$props$onBlur3 === void 0 ? void 0 : _this$props$onBlur3.call(_this$props7);
2781
+ });
2782
+
2783
+ _defineProperty(_assertThisInitialized(_this), "onDelRule", function (i, k) {
2784
+ var _this$props$onChange5, _this$props8, _this$props$onBlur4, _this$props9;
2785
+
2786
+ var value = _toConsumableArray(_this.value);
2787
+
2788
+ value[i].vegaRules.splice(k, 1);
2789
+ (_this$props$onChange5 = (_this$props8 = _this.props).onChange) === null || _this$props$onChange5 === void 0 ? void 0 : _this$props$onChange5.call(_this$props8, value.length === 1 && _this.isEmptyItem(value[0]) ? [] : value);
2790
+ (_this$props$onBlur4 = (_this$props9 = _this.props).onBlur) === null || _this$props$onBlur4 === void 0 ? void 0 : _this$props$onBlur4.call(_this$props9);
2791
+ });
2792
+
2645
2793
  return _this;
2646
2794
  }
2647
2795
 
@@ -2664,13 +2812,13 @@ var ExpiryVegaAlphaByEdgeList = /*#__PURE__*/function (_PureComponent) {
2664
2812
  min: undefined,
2665
2813
  max: undefined
2666
2814
  },
2667
- bidEdgeRange: {
2668
- min: undefined,
2669
- max: undefined
2815
+ bidEdgeSpan: {
2816
+ from: undefined,
2817
+ to: undefined
2670
2818
  },
2671
- askEdgeRange: {
2672
- min: undefined,
2673
- max: undefined
2819
+ askEdgeSpan: {
2820
+ from: undefined,
2821
+ to: undefined
2674
2822
  },
2675
2823
  allowTaker: false,
2676
2824
  disable: false
@@ -2689,7 +2837,7 @@ var ExpiryVegaAlphaByEdgeList = /*#__PURE__*/function (_PureComponent) {
2689
2837
  }, it.expiry, /*#__PURE__*/React.createElement("span", null, "/"), !isNullLike(it.vegaTarget) ? it.vegaTarget : '-', /*#__PURE__*/React.createElement("span", null, "/"), it.vegaRules.map(function ($it, $i) {
2690
2838
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
2691
2839
  key: $i
2692
- }, !isNullLike($it.optionType) ? $it.optionType : '-', /*#__PURE__*/React.createElement("span", null, "/"), !isNullLike($it.deltaRange.min) && !isNullLike($it.deltaRange.max) ? "(".concat($it.deltaRange.min, ", ").concat($it.deltaRange.max, ")") : '-', /*#__PURE__*/React.createElement("span", null, "/"), !isNullLike($it.bidEdgeRange.min) && !isNullLike($it.bidEdgeRange.max) ? "(".concat(NumCvt.show($it.bidEdgeRange.min, true), "%, ").concat(NumCvt.show($it.bidEdgeRange.max, true), "%)") : '-', /*#__PURE__*/React.createElement("span", null, "/"), !isNullLike($it.askEdgeRange.min) && !isNullLike($it.askEdgeRange.max) ? "(".concat(NumCvt.show($it.askEdgeRange.min, true), "%, ").concat(NumCvt.show($it.askEdgeRange.max, true), "%)") : '-', /*#__PURE__*/React.createElement("span", null, "/"), typeof $it.allowTaker === 'boolean' ? $it.allowTaker.toString().toUpperCase() : '-', /*#__PURE__*/React.createElement("span", null, "/"), typeof $it.disable === 'boolean' ? $it.disable.toString().toUpperCase() : '-'), /*#__PURE__*/React.createElement("br", null));
2840
+ }, !isNullLike($it.optionType) ? $it.optionType : '-', /*#__PURE__*/React.createElement("span", null, "/"), !isNullLike($it.deltaRange.min) && !isNullLike($it.deltaRange.max) ? "(".concat($it.deltaRange.min, ", ").concat($it.deltaRange.max, ")") : '-', /*#__PURE__*/React.createElement("span", null, "/"), !isNullLike($it.bidEdgeSpan.from) && !isNullLike($it.bidEdgeSpan.to) ? "(".concat(NumCvt.show($it.bidEdgeSpan.from, true), "%, ").concat(NumCvt.show($it.bidEdgeSpan.to, true), "%)") : '-', /*#__PURE__*/React.createElement("span", null, "/"), !isNullLike($it.askEdgeSpan.from) && !isNullLike($it.askEdgeSpan.to) ? "(".concat(NumCvt.show($it.askEdgeSpan.from, true), "%, ").concat(NumCvt.show($it.askEdgeSpan.to, true), "%)") : '-', /*#__PURE__*/React.createElement("span", null, "/"), typeof $it.allowTaker === 'boolean' ? $it.allowTaker.toString().toUpperCase() : '-', /*#__PURE__*/React.createElement("span", null, "/"), typeof $it.disable === 'boolean' ? $it.disable.toString().toUpperCase() : '-'), /*#__PURE__*/React.createElement("br", null));
2693
2841
  })), /*#__PURE__*/React.createElement("br", null));
2694
2842
  }) : '-' : /*#__PURE__*/React.createElement("div", {
2695
2843
  className: "param-expiries-limit-inputs",
@@ -2748,8 +2896,13 @@ var ExpiryVegaAlphaByEdgeList = /*#__PURE__*/function (_PureComponent) {
2748
2896
  gridTemplateColumns: 'auto auto auto auto auto auto'
2749
2897
  }
2750
2898
  }, it.vegaRules.map(function (rule, k) {
2899
+ var _it$vegaRules;
2900
+
2751
2901
  return /*#__PURE__*/React.createElement(React.Fragment, null, i === 0 && k === 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
2752
- className: "param-number-range readonly"
2902
+ className: "param-number-range readonly",
2903
+ style: {
2904
+ paddingLeft: 36
2905
+ }
2753
2906
  }, "Call/Put/Call"), /*#__PURE__*/React.createElement("div", {
2754
2907
  className: "param-number-range readonly"
2755
2908
  }, "Delta Range"), /*#__PURE__*/React.createElement("div", {
@@ -2760,7 +2913,23 @@ var ExpiryVegaAlphaByEdgeList = /*#__PURE__*/function (_PureComponent) {
2760
2913
  className: "param-number-range readonly"
2761
2914
  }, "Allow Taker"), /*#__PURE__*/React.createElement("div", {
2762
2915
  className: "param-number-range readonly"
2763
- }, "Disabled")) : /*#__PURE__*/React.createElement(React.Fragment, null), /*#__PURE__*/React.createElement(TextSelector, {
2916
+ }, "Disabled")) : /*#__PURE__*/React.createElement(React.Fragment, null), /*#__PURE__*/React.createElement("div", {
2917
+ style: {
2918
+ display: 'flex',
2919
+ width: 116
2920
+ }
2921
+ }, /*#__PURE__*/React.createElement("div", {
2922
+ className: "param-arr-ops",
2923
+ style: {
2924
+ visibility: k === ((_it$vegaRules = it.vegaRules) === null || _it$vegaRules === void 0 ? void 0 : _it$vegaRules.length) - 1 ? 'visible' : 'hidden'
2925
+ }
2926
+ }, /*#__PURE__*/React.createElement(PlusOutlined, {
2927
+ className: "param-arr-ops-add",
2928
+ onClick: _this2.onAddRule.bind(null, i, k),
2929
+ style: {
2930
+ width: 18
2931
+ }
2932
+ })), /*#__PURE__*/React.createElement(TextSelector, {
2764
2933
  style: {
2765
2934
  width: 88,
2766
2935
  minWidth: 0,
@@ -2774,7 +2943,7 @@ var ExpiryVegaAlphaByEdgeList = /*#__PURE__*/function (_PureComponent) {
2774
2943
  } // onBlur={this.props.onBlur}
2775
2944
  ,
2776
2945
  options: ['Both', 'Call', 'Put']
2777
- }), /*#__PURE__*/React.createElement(NumRange, {
2946
+ })), /*#__PURE__*/React.createElement(NumRange, {
2778
2947
  value: {
2779
2948
  min: rule.deltaRange.min,
2780
2949
  max: rule.deltaRange.max
@@ -2783,23 +2952,23 @@ var ExpiryVegaAlphaByEdgeList = /*#__PURE__*/function (_PureComponent) {
2783
2952
  return _this2.onChange(i, val, 'vegaRules', k, 'deltaRange');
2784
2953
  },
2785
2954
  onBlur: _this2.props.onBlur
2786
- }), /*#__PURE__*/React.createElement(NumRange, {
2955
+ }), /*#__PURE__*/React.createElement(NumRangeFromTo, {
2787
2956
  value: {
2788
- min: rule.bidEdgeRange.min,
2789
- max: rule.bidEdgeRange.max
2957
+ from: rule.bidEdgeSpan.from,
2958
+ to: rule.bidEdgeSpan.to
2790
2959
  },
2791
2960
  onChange: function onChange(val) {
2792
- return _this2.onChange(i, val, 'vegaRules', k, 'bidEdgeRange');
2961
+ return _this2.onChange(i, val, 'vegaRules', k, 'bidEdgeSpan');
2793
2962
  },
2794
2963
  isPercentage: true,
2795
2964
  onBlur: _this2.props.onBlur
2796
- }), /*#__PURE__*/React.createElement(NumRange, {
2965
+ }), /*#__PURE__*/React.createElement(NumRangeFromTo, {
2797
2966
  value: {
2798
- min: rule.askEdgeRange.min,
2799
- max: rule.askEdgeRange.max
2967
+ from: rule.askEdgeSpan.from,
2968
+ to: rule.askEdgeSpan.to
2800
2969
  },
2801
2970
  onChange: function onChange(val) {
2802
- return _this2.onChange(i, val, 'vegaRules', k, 'askEdgeRange');
2971
+ return _this2.onChange(i, val, 'vegaRules', k, 'askEdgeSpan');
2803
2972
  },
2804
2973
  isPercentage: true,
2805
2974
  onBlur: _this2.props.onBlur
@@ -2825,7 +2994,18 @@ var ExpiryVegaAlphaByEdgeList = /*#__PURE__*/function (_PureComponent) {
2825
2994
  onChange: function onChange(e) {
2826
2995
  return _this2.onChange(i, e.target.checked, 'vegaRules', k, 'disable');
2827
2996
  }
2828
- })));
2997
+ }), /*#__PURE__*/React.createElement("div", {
2998
+ className: "param-arr-ops",
2999
+ style: {
3000
+ position: 'absolute',
3001
+ top: -4,
3002
+ right: -36,
3003
+ visibility: k === 0 ? 'hidden' : 'visible'
3004
+ }
3005
+ }, /*#__PURE__*/React.createElement(DeleteOutlined, {
3006
+ className: "param-arr-ops-del",
3007
+ onClick: _this2.onDelRule.bind(null, i, k)
3008
+ }))));
2829
3009
  })), /*#__PURE__*/React.createElement("div", {
2830
3010
  className: "param-arr-ops"
2831
3011
  }, /*#__PURE__*/React.createElement(PlusOutlined, {
@@ -2856,6 +3036,10 @@ function emptyErrText(index, key) {
2856
3036
  return "The ".concat(index + 1).concat(index === 0 ? 'st' : index === 1 ? 'nd' : index === 2 ? 'rd' : 'th', " item: ").concat(key ? key + ' ' : '', "should not be empty");
2857
3037
  }
2858
3038
 
3039
+ function zeroErrText(index, key, type) {
3040
+ return "The ".concat(index + 1).concat(index === 0 ? 'st' : index === 1 ? 'nd' : index === 2 ? 'rd' : 'th', " item: ").concat(key ? key + ' ' : '', "should be ").concat(type === 'min' ? '<' : '>', " 0");
3041
+ }
3042
+
2859
3043
  var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig, ParamType.ParamGroup, {
2860
3044
  name: '参数组',
2861
3045
  Comp: function Comp() {
@@ -3168,7 +3352,7 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
3168
3352
  sort: 17
3169
3353
  }), _defineProperty(_ParamTypeConfig, ParamType.ExpiryVegaAlphaByEdgeList, {
3170
3354
  name: 'ExpiryVegaAlphaByEdgeList',
3171
- key: 'ExpiryVegaAlphaByEdgeList',
3355
+ key: 'expiryVegaAlphaByEdgeList',
3172
3356
  Comp: ExpiryVegaAlphaByEdgeList,
3173
3357
  validator: function validator($val) {
3174
3358
  if (!($val === null || $val === void 0 ? void 0 : $val.length)) return '';
@@ -3185,6 +3369,10 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
3185
3369
  return emptyErrText(i, 'vegaTarget');
3186
3370
  }
3187
3371
 
3372
+ if (Number(val.vegaTarget) === 0) {
3373
+ return "The ".concat(i + 1).concat(i === 0 ? 'st' : i === 1 ? 'nd' : i === 2 ? 'rd' : 'th', " item: vega target can not be 0");
3374
+ }
3375
+
3188
3376
  var $$val = val.vegaRules || [];
3189
3377
 
3190
3378
  for (var k = 0; k < $$val.length; k++) {
@@ -3202,20 +3390,56 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
3202
3390
  return emptyErrText(i, "delta range's max");
3203
3391
  }
3204
3392
 
3205
- if (isEmpty(vegaRule.bidEdgeRange.min)) {
3206
- return emptyErrText(i, "bid edge range's min");
3393
+ if (isEmpty(vegaRule.bidEdgeSpan.from)) {
3394
+ return emptyErrText(i, "bid edge range's from");
3395
+ }
3396
+
3397
+ if (isEmpty(vegaRule.bidEdgeSpan.to)) {
3398
+ return emptyErrText(i, "bid edge range's to");
3207
3399
  }
3208
3400
 
3209
- if (isEmpty(vegaRule.bidEdgeRange.max)) {
3210
- return emptyErrText(i, "bid edge range's max");
3401
+ if (isEmpty(vegaRule.askEdgeSpan.from)) {
3402
+ return emptyErrText(i, "ask edge range's from");
3211
3403
  }
3212
3404
 
3213
- if (isEmpty(vegaRule.askEdgeRange.min)) {
3214
- return emptyErrText(i, "ask edge range's min");
3405
+ if (isEmpty(vegaRule.askEdgeSpan.to)) {
3406
+ return emptyErrText(i, "ask edge range's to");
3215
3407
  }
3216
3408
 
3217
- if (isEmpty(vegaRule.askEdgeRange.max)) {
3218
- return emptyErrText(i, "ask edge range's max");
3409
+ if (Number(val.vegaTarget) > 0) {
3410
+ if (Number(vegaRule.bidEdgeSpan.from) <= 0) {
3411
+ return zeroErrText(i, "bid edge range's from", 'max');
3412
+ }
3413
+
3414
+ if (Number(vegaRule.bidEdgeSpan.to) <= 0) {
3415
+ return zeroErrText(i, "bid edge range's to", 'max');
3416
+ }
3417
+
3418
+ if (Number(vegaRule.askEdgeSpan.from) <= 0) {
3419
+ return zeroErrText(i, "ask edge range's from", 'max');
3420
+ }
3421
+
3422
+ if (Number(vegaRule.askEdgeSpan.to) <= 0) {
3423
+ return zeroErrText(i, "ask edge range's to", 'max');
3424
+ }
3425
+ }
3426
+
3427
+ if (Number(val.vegaTarget) < 0) {
3428
+ if (Number(vegaRule.bidEdgeSpan.from) >= 0) {
3429
+ return zeroErrText(i, "bid edge range's from", 'min');
3430
+ }
3431
+
3432
+ if (Number(vegaRule.bidEdgeSpan.to) >= 0) {
3433
+ return zeroErrText(i, "bid edge range's to", 'min');
3434
+ }
3435
+
3436
+ if (Number(vegaRule.askEdgeSpan.from) >= 0) {
3437
+ return zeroErrText(i, "ask edge range's from", 'min');
3438
+ }
3439
+
3440
+ if (Number(vegaRule.askEdgeSpan.to) >= 0) {
3441
+ return zeroErrText(i, "ask edge range's to", 'min');
3442
+ }
3219
3443
  }
3220
3444
  } // if (expiries.includes(val.expiry)) {
3221
3445
  // return `The ${i + 1} ${
@@ -3226,6 +3450,8 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
3226
3450
  // }
3227
3451
 
3228
3452
 
3453
+ var hasOverRange = validateVegaRules($$val);
3454
+ if (!hasOverRange) return "The ".concat(i + 1).concat(i === 0 ? 'st' : i === 1 ? 'nd' : i === 2 ? 'rd' : 'th', " item: delta range overlap");
3229
3455
  expiries.push(val.expiry);
3230
3456
  }
3231
3457
 
@@ -3402,10 +3628,11 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
3402
3628
  (_this$props$onChange = (_this$props = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props, $data);
3403
3629
 
3404
3630
  if ('valueType' in changed) {
3405
- var _this$ref$current$get, _this$ref$current, _this$props$initialVa;
3631
+ var _this$ref$current$get, _this$ref$current, _this$props$initialVa, _this$props$onModalWi, _this$props2, _config$modalWidth;
3406
3632
 
3407
3633
  var config = ParamTypeConfig[(_this$ref$current$get = (_this$ref$current = _this.ref.current) === null || _this$ref$current === void 0 ? void 0 : _this$ref$current.getFieldValue('valueType')) !== null && _this$ref$current$get !== void 0 ? _this$ref$current$get : (_this$props$initialVa = _this.props.initialValues) === null || _this$props$initialVa === void 0 ? void 0 : _this$props$initialVa.valueType];
3408
- localStorage.setItem('__editParamModalWidth', String(config.modalWidth) || '0');
3634
+ localStorage.setItem('__editParamModalWidth', config.modalWidth ? String(config.modalWidth) : '740');
3635
+ (_this$props$onModalWi = (_this$props2 = _this.props).onModalWidthChange) === null || _this$props$onModalWi === void 0 ? void 0 : _this$props$onModalWi.call(_this$props2, (_config$modalWidth = config.modalWidth) !== null && _config$modalWidth !== void 0 ? _config$modalWidth : 740);
3409
3636
 
3410
3637
  _this.forceUpdate();
3411
3638
  }
@@ -3424,7 +3651,6 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
3424
3651
 
3425
3652
  var valueType = (_this$ref$current$get2 = (_this$ref$current2 = this.ref.current) === null || _this$ref$current2 === void 0 ? void 0 : _this$ref$current2.getFieldValue('valueType')) !== null && _this$ref$current$get2 !== void 0 ? _this$ref$current$get2 : (_this$props$initialVa2 = this.props.initialValues) === null || _this$props$initialVa2 === void 0 ? void 0 : _this$props$initialVa2.valueType;
3426
3653
  var config = ParamTypeConfig[valueType];
3427
- localStorage.setItem('__editParamModalWidth', String(config.modalWidth) || '0');
3428
3654
  return [{
3429
3655
  label: '所属分组',
3430
3656
  name: 'parentId',
@@ -3553,6 +3779,8 @@ var ParamFormModalEl = /*#__PURE__*/function (_PureComponent2) {
3553
3779
  var _super2 = _createSuper(ParamFormModalEl);
3554
3780
 
3555
3781
  function ParamFormModalEl() {
3782
+ var _this4$props$initialV, _ParamTypeConfig$_thi, _this4$props$initialV2;
3783
+
3556
3784
  var _this4;
3557
3785
 
3558
3786
  _classCallCheck(this, ParamFormModalEl);
@@ -3567,7 +3795,8 @@ var ParamFormModalEl = /*#__PURE__*/function (_PureComponent2) {
3567
3795
 
3568
3796
  _defineProperty(_assertThisInitialized(_this4), "state", {
3569
3797
  visible: false,
3570
- pending: false
3798
+ pending: false,
3799
+ width: ((_this4$props$initialV = _this4.props.initialValues) === null || _this4$props$initialV === void 0 ? void 0 : _this4$props$initialV.valueType) ? (_ParamTypeConfig$_thi = ParamTypeConfig[(_this4$props$initialV2 = _this4.props.initialValues) === null || _this4$props$initialV2 === void 0 ? void 0 : _this4$props$initialV2.valueType]) === null || _ParamTypeConfig$_thi === void 0 ? void 0 : _ParamTypeConfig$_thi.modalWidth : 740
3571
3800
  });
3572
3801
 
3573
3802
  _defineProperty(_assertThisInitialized(_this4), "onShow", function () {
@@ -3604,7 +3833,11 @@ var ParamFormModalEl = /*#__PURE__*/function (_PureComponent2) {
3604
3833
  });
3605
3834
  });
3606
3835
 
3607
- _defineProperty(_assertThisInitialized(_this4), "width", localStorage.getItem('__editParamModalWidth'));
3836
+ _defineProperty(_assertThisInitialized(_this4), "handleModalWidthChange", function (width) {
3837
+ _this4.setState({
3838
+ width: width
3839
+ });
3840
+ });
3608
3841
 
3609
3842
  return _this4;
3610
3843
  }
@@ -3621,7 +3854,7 @@ var ParamFormModalEl = /*#__PURE__*/function (_PureComponent2) {
3621
3854
  value: function render() {
3622
3855
  return /*#__PURE__*/React.createElement(Modal, {
3623
3856
  key: String(this.state.visible),
3624
- width: Number(this.width) || 740,
3857
+ width: this.state.width || 740,
3625
3858
  closable: false,
3626
3859
  title: !this.isEdit ? '新增参数' : '修改参数',
3627
3860
  visible: this.state.visible,
@@ -3634,7 +3867,8 @@ var ParamFormModalEl = /*#__PURE__*/function (_PureComponent2) {
3634
3867
  }, "\u786E\u8BA4"))
3635
3868
  }, /*#__PURE__*/React.createElement(ParamForm, Object.assign({}, this.props, {
3636
3869
  ref: this.ref,
3637
- onSubmit: undefined
3870
+ onSubmit: undefined,
3871
+ onModalWidthChange: this.handleModalWidthChange
3638
3872
  })));
3639
3873
  }
3640
3874
  }]);
@@ -3689,9 +3923,18 @@ var ParamValueEditor = /*#__PURE__*/function (_PureComponent) {
3689
3923
  _defineProperty(_assertThisInitialized(_this), "ref", React.createRef());
3690
3924
 
3691
3925
  _defineProperty(_assertThisInitialized(_this), "onChange", function (changed, data) {
3692
- var _this$props$onChange, _this$props;
3926
+ var _this$props$onChange, _this$props2;
3693
3927
 
3694
- (_this$props$onChange = (_this$props = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props, data);
3928
+ if ('valueType' in changed) {
3929
+ var _this$ref$current$get, _this$ref$current, _this$props$onModalWi, _this$props, _config$modalWidth;
3930
+
3931
+ var config = ParamTypeConfig[(_this$ref$current$get = (_this$ref$current = _this.ref.current) === null || _this$ref$current === void 0 ? void 0 : _this$ref$current.getFieldValue('valueType')) !== null && _this$ref$current$get !== void 0 ? _this$ref$current$get : _this.props.valueType];
3932
+ (_this$props$onModalWi = (_this$props = _this.props).onModalWidthChange) === null || _this$props$onModalWi === void 0 ? void 0 : _this$props$onModalWi.call(_this$props, (_config$modalWidth = config.modalWidth) !== null && _config$modalWidth !== void 0 ? _config$modalWidth : 740);
3933
+
3934
+ _this.forceUpdate();
3935
+ }
3936
+
3937
+ (_this$props$onChange = (_this$props2 = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props2, data);
3695
3938
  });
3696
3939
 
3697
3940
  return _this;
@@ -3819,7 +4062,8 @@ var ParamValueEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
3819
4062
 
3820
4063
  _defineProperty(_assertThisInitialized(_this3), "state", {
3821
4064
  visible: false,
3822
- pending: false
4065
+ pending: false,
4066
+ width: ParamTypeConfig[_this3.props.valueType].modalWidth || 740
3823
4067
  });
3824
4068
 
3825
4069
  _defineProperty(_assertThisInitialized(_this3), "onShow", function () {
@@ -3856,6 +4100,12 @@ var ParamValueEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
3856
4100
  });
3857
4101
  });
3858
4102
 
4103
+ _defineProperty(_assertThisInitialized(_this3), "handleModalWidthChange", function (width) {
4104
+ _this3.setState({
4105
+ width: width
4106
+ });
4107
+ });
4108
+
3859
4109
  return _this3;
3860
4110
  }
3861
4111
 
@@ -3864,7 +4114,7 @@ var ParamValueEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
3864
4114
  value: function render() {
3865
4115
  return /*#__PURE__*/React.createElement(Modal, {
3866
4116
  key: String(this.state.visible),
3867
- width: 740,
4117
+ width: this.state.width || 740,
3868
4118
  title: 'Edit Value',
3869
4119
  closable: false,
3870
4120
  visible: this.state.visible,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalplus/params-about",
3
- "version": "1.0.26-alpha",
3
+ "version": "1.0.26-alpha10",
4
4
  "description": "A description for the module",
5
5
  "main": "./lib/umd/index.js",
6
6
  "module": "./lib/es/index.js",