@signalplus/params-about 1.0.26-alpha7 → 1.0.26-alpha8

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 (2) hide show
  1. package/lib/es/index.js +150 -40
  2. package/package.json +1 -1
package/lib/es/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Bundle of @signalplus/params-about
3
- * Generated: 2025-11-03
4
- * Version: 1.0.26-alpha7
3
+ * Generated: 2025-11-06
4
+ * Version: 1.0.26-alpha8
5
5
  * License: MIT
6
6
  * Author: 2631541504@qq.com
7
7
  */
@@ -2569,6 +2569,53 @@ var NumRangeFromTo = /*#__PURE__*/function (_PureComponent) {
2569
2569
  return NumRangeFromTo;
2570
2570
  }(PureComponent);
2571
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
+ }
2572
2619
  var ExpiryVegaAlphaByEdgeList = /*#__PURE__*/function (_PureComponent) {
2573
2620
  _inherits(ExpiryVegaAlphaByEdgeList, _PureComponent);
2574
2621
 
@@ -2625,38 +2672,38 @@ var ExpiryVegaAlphaByEdgeList = /*#__PURE__*/function (_PureComponent) {
2625
2672
 
2626
2673
  if (key) {
2627
2674
  if (subKey && typeof k === 'number') {
2628
- if (subKey === 'optionType') {
2629
- // console.log('changeValue==========================', value, i, val, key, k, subKey);
2630
- if (val === 'Both') {
2631
- value[i].vegaRules = [_objectSpread2(_objectSpread2({}, value[i].vegaRules[k]), {}, {
2632
- optionType: 'Both'
2633
- })];
2634
- } else {
2635
- var _value$i$vegaRules;
2636
-
2637
- 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]), {}, {
2638
- optionType: val
2639
- }), {
2640
- optionType: val === 'Call' ? 'Put' : 'Call',
2641
- deltaRange: {
2642
- min: undefined,
2643
- max: undefined
2644
- },
2645
- bidEdgeSpan: {
2646
- from: undefined,
2647
- to: undefined
2648
- },
2649
- askEdgeSpan: {
2650
- from: undefined,
2651
- to: undefined
2652
- },
2653
- allowTaker: false,
2654
- disable: false
2655
- }];else value[i].vegaRules[k][subKey] = val;
2656
- }
2657
- } else {
2658
- value[i].vegaRules[k][subKey] = val;
2659
- }
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;
2660
2707
  } else {
2661
2708
  value[i][key] = val;
2662
2709
  }
@@ -2697,16 +2744,52 @@ var ExpiryVegaAlphaByEdgeList = /*#__PURE__*/function (_PureComponent) {
2697
2744
  (_this$props$onBlur = (_this$props3 = _this.props).onBlur) === null || _this$props$onBlur === void 0 ? void 0 : _this$props$onBlur.call(_this$props3);
2698
2745
  });
2699
2746
 
2700
- _defineProperty(_assertThisInitialized(_this), "onDel", function (i) {
2747
+ _defineProperty(_assertThisInitialized(_this), "onAddRule", function (i, k) {
2701
2748
  var _this$props$onChange3, _this$props4, _this$props$onBlur2, _this$props5;
2702
2749
 
2703
2750
  var value = _toConsumableArray(_this.value);
2704
2751
 
2705
- value.splice(i, 1);
2706
- (_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);
2707
2770
  (_this$props$onBlur2 = (_this$props5 = _this.props).onBlur) === null || _this$props$onBlur2 === void 0 ? void 0 : _this$props$onBlur2.call(_this$props5);
2708
2771
  });
2709
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
+
2710
2793
  return _this;
2711
2794
  }
2712
2795
 
@@ -2814,7 +2897,10 @@ var ExpiryVegaAlphaByEdgeList = /*#__PURE__*/function (_PureComponent) {
2814
2897
  }
2815
2898
  }, it.vegaRules.map(function (rule, k) {
2816
2899
  return /*#__PURE__*/React.createElement(React.Fragment, null, i === 0 && k === 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
2817
- className: "param-number-range readonly"
2900
+ className: "param-number-range readonly",
2901
+ style: {
2902
+ paddingLeft: 36
2903
+ }
2818
2904
  }, "Call/Put/Call"), /*#__PURE__*/React.createElement("div", {
2819
2905
  className: "param-number-range readonly"
2820
2906
  }, "Delta Range"), /*#__PURE__*/React.createElement("div", {
@@ -2825,7 +2911,29 @@ var ExpiryVegaAlphaByEdgeList = /*#__PURE__*/function (_PureComponent) {
2825
2911
  className: "param-number-range readonly"
2826
2912
  }, "Allow Taker"), /*#__PURE__*/React.createElement("div", {
2827
2913
  className: "param-number-range readonly"
2828
- }, "Disabled")) : /*#__PURE__*/React.createElement(React.Fragment, null), /*#__PURE__*/React.createElement(TextSelector, {
2914
+ }, "Disabled")) : /*#__PURE__*/React.createElement(React.Fragment, null), /*#__PURE__*/React.createElement("div", {
2915
+ style: {
2916
+ display: 'flex'
2917
+ }
2918
+ }, /*#__PURE__*/React.createElement("div", {
2919
+ className: "param-arr-ops"
2920
+ }, /*#__PURE__*/React.createElement(PlusOutlined, {
2921
+ className: "param-arr-ops-add",
2922
+ onClick: _this2.onAddRule.bind(null, i, k),
2923
+ style: {
2924
+ position: 'relative',
2925
+ top: i > 0 ? -30 : 0,
2926
+ width: 18
2927
+ }
2928
+ }), /*#__PURE__*/React.createElement(DeleteOutlined, {
2929
+ className: "param-arr-ops-del",
2930
+ onClick: _this2.onDelRule.bind(null, i, k),
2931
+ style: {
2932
+ position: 'relative',
2933
+ top: i > 0 ? -30 : 0,
2934
+ width: 18
2935
+ }
2936
+ })), /*#__PURE__*/React.createElement(TextSelector, {
2829
2937
  style: {
2830
2938
  width: 88,
2831
2939
  minWidth: 0,
@@ -2839,7 +2947,7 @@ var ExpiryVegaAlphaByEdgeList = /*#__PURE__*/function (_PureComponent) {
2839
2947
  } // onBlur={this.props.onBlur}
2840
2948
  ,
2841
2949
  options: ['Both', 'Call', 'Put']
2842
- }), /*#__PURE__*/React.createElement(NumRange, {
2950
+ })), /*#__PURE__*/React.createElement(NumRange, {
2843
2951
  value: {
2844
2952
  min: rule.deltaRange.min,
2845
2953
  max: rule.deltaRange.max
@@ -3335,6 +3443,8 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
3335
3443
  // }
3336
3444
 
3337
3445
 
3446
+ var hasOverRange = validateVegaRules($$val);
3447
+ if (!hasOverRange) return "The ".concat(i + 1).concat(i === 0 ? 'st' : i === 1 ? 'nd' : i === 2 ? 'rd' : 'th', " item: delta range overlap");
3338
3448
  expiries.push(val.expiry);
3339
3449
  }
3340
3450
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalplus/params-about",
3
- "version": "1.0.26-alpha7",
3
+ "version": "1.0.26-alpha8",
4
4
  "description": "A description for the module",
5
5
  "main": "./lib/umd/index.js",
6
6
  "module": "./lib/es/index.js",