@signalplus/params-about 1.0.25-alpha → 1.0.26-alpha2

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
@@ -19,7 +19,8 @@ declare enum ParamType {
19
19
  HardLimitHandler = 15,
20
20
  InstrumentArray = 14,
21
21
  OneWayHandler = 16,
22
- TenorBucketHandlerList = 17
22
+ TenorBucketHandlerList = 17,
23
+ ExpiryVegaAlphaByEdgeList = 18
23
24
  }
24
25
  interface BaseInputProps {
25
26
  value?: any;
@@ -51,6 +52,7 @@ declare class ParamRenderer extends PureComponent<ParamRendererProps> {
51
52
  validator?(value: any, enableEmpty?: boolean | undefined): string;
52
53
  required?: boolean | undefined;
53
54
  sort: number;
55
+ modalWidth?: number | undefined;
54
56
  };
55
57
  get value(): any;
56
58
  onChange: (val: any) => void;
@@ -113,6 +115,7 @@ declare class ParamFormModalEl extends PureComponent<ParamFormProps & Required<P
113
115
  onShow: () => void;
114
116
  onHide: () => void;
115
117
  onSubmit: () => any;
118
+ width: string | null;
116
119
  render(): JSX.Element;
117
120
  }
118
121
  declare class ParamFormModal {
@@ -318,6 +321,7 @@ declare const ParamTypeConfig: Record<ParamType, {
318
321
  validator?(value: any, enableEmpty?: boolean): string;
319
322
  required?: boolean;
320
323
  sort: number;
324
+ modalWidth?: number;
321
325
  }>;
322
326
  declare function paramValidator(val: any, values: {
323
327
  valueType: ParamType;
@@ -332,6 +336,7 @@ declare const ParamTypeOptions: {
332
336
  validator?(value: any, enableEmpty?: boolean | undefined): string;
333
337
  required?: boolean | undefined;
334
338
  sort: number;
339
+ modalWidth?: number | undefined;
335
340
  }[];
336
341
 
337
342
  declare function formatNum(val: string): number | undefined;
package/lib/es/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Bundle of @signalplus/params-about
3
- * Generated: 2025-05-07
4
- * Version: 1.0.25-alpha
3
+ * Generated: 2025-10-15
4
+ * Version: 1.0.26-alpha2
5
5
  * License: MIT
6
6
  * Author: 2631541504@qq.com
7
7
  */
@@ -11,7 +11,7 @@ import classNames from 'classnames';
11
11
  import dayjs from 'dayjs';
12
12
  import Big from 'big.js';
13
13
  import { PlusOutlined, DeleteOutlined, CloseOutlined, CheckOutlined, DownOutlined } from '@ant-design/icons';
14
- import { Select, Popover, Cascader, Input, Form, Button, message, Modal } from 'antd';
14
+ import { Popover, Cascader, Checkbox, Input, Select, Form, Button, message, Modal } from 'antd';
15
15
  import { isArray, capitalize, isEqual } from 'lodash-es';
16
16
  import ReactGlobalComp from 'react-global-comp';
17
17
  import ReactFileInput from '@livelybone/react-file-input';
@@ -201,6 +201,7 @@ var ParamType;
201
201
  ParamType[ParamType["InstrumentArray"] = 14] = "InstrumentArray";
202
202
  ParamType[ParamType["OneWayHandler"] = 16] = "OneWayHandler";
203
203
  ParamType[ParamType["TenorBucketHandlerList"] = 17] = "TenorBucketHandlerList";
204
+ ParamType[ParamType["ExpiryVegaAlphaByEdgeList"] = 18] = "ExpiryVegaAlphaByEdgeList";
204
205
  })(ParamType || (ParamType = {}));
205
206
 
206
207
  function _arrayWithHoles(arr) {
@@ -801,8 +802,11 @@ var Expiries = /*#__PURE__*/function (_PureComponent) {
801
802
  return (_this$props$options = _this.props.options) === null || _this$props$options === void 0 ? void 0 : _this$props$options.includes(item);
802
803
  })) || []);
803
804
 
804
- if (_this.props.multiple !== false || Array.isArray(val)) {
805
- value = val;
805
+ if (_this.props.multiple !== false) {
806
+ var index = value.findIndex(function (it) {
807
+ return it === val;
808
+ });
809
+ if (index > -1) value.splice(index, 1);else value.push(val);
806
810
  } else {
807
811
  value = [val];
808
812
  }
@@ -861,94 +865,37 @@ var Expiries = /*#__PURE__*/function (_PureComponent) {
861
865
  }, {
862
866
  key: "render",
863
867
  value: function render() {
864
- var _this3 = this,
865
- _this$props$options2;
868
+ var _this$props$options2,
869
+ _this3 = this;
866
870
 
867
- for (var i = 0; i < 100000; i++) {
868
- "".concat(i.toString(36)).concat(i);
869
- }
871
+ return /*#__PURE__*/React.createElement(Popover, {
872
+ overlayClassName: "param-expiries-popover",
873
+ trigger: 'click',
874
+ placement: 'bottomLeft',
875
+ visible: !this.props.readonly && this.state.visible,
876
+ onVisibleChange: this.handleVisibleChange,
877
+ content: (_this$props$options2 = this.props.options) === null || _this$props$options2 === void 0 ? void 0 : _this$props$options2.map(function (it) {
878
+ var _this3$props$value, _this3$props$calcDisa, _this3$props, _this3$onChange;
870
879
 
871
- return this.props.readonly ? /*#__PURE__*/React.createElement("div", {
880
+ var checked = (_this3$props$value = _this3.props.value) === null || _this3$props$value === void 0 ? void 0 : _this3$props$value.includes(it);
881
+ 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);
882
+ return /*#__PURE__*/React.createElement("div", {
883
+ className: classNames('param-expiries-option', {
884
+ 'param-expiries-option-checked': checked,
885
+ 'param-expiries-option-disabled': disabled
886
+ }),
887
+ key: it,
888
+ onClick: disabled ? undefined : (_this3$onChange = _this3.onChange) === null || _this3$onChange === void 0 ? void 0 : _this3$onChange.bind(null, it)
889
+ }, it, checked && /*#__PURE__*/React.createElement(CheckOutlined, null));
890
+ })
891
+ }, /*#__PURE__*/React.createElement("div", {
872
892
  className: classNames('param-expiries', {
873
893
  readonly: this.props.readonly,
874
894
  multiple: this.props.multiple !== false
875
- }, this.props.className)
876
- }, this.renderValue()) :
877
- /*#__PURE__*/
878
- // <Popover
879
- // overlayClassName="param-expiries-popover"
880
- // trigger={'click'}
881
- // placement={'bottomLeft'}
882
- // visible={!this.props.readonly && this.state.visible}
883
- // onVisibleChange={this.handleVisibleChange}
884
- // content={this.props.options?.map((it) => {
885
- // const checked = this.props.value?.includes(it);
886
- // const disabled = this.props.calcDisabled?.(it);
887
- // return (
888
- // <div
889
- // className={classNames('param-expiries-option', {
890
- // 'param-expiries-option-checked': checked,
891
- // 'param-expiries-option-disabled': disabled,
892
- // })}
893
- // key={it}
894
- // onClick={disabled ? undefined : this.onChange?.bind(null, it)}
895
- // >
896
- // {it}
897
- // {checked && <CheckOutlined />}
898
- // </div>
899
- // );
900
- // })}
901
- // >
902
- // <div
903
- // className={classNames(
904
- // 'param-expiries',
905
- // { readonly: this.props.readonly, multiple: this.props.multiple !== false },
906
- // this.props.className,
907
- // )}
908
- // style={this.props.style}
909
- // >
910
- // {this.renderValue()}
911
- // {!this.props.readonly && this.props.options && (
912
- // <DownOutlined className="param-expiries-arrow" />
913
- // )}
914
- // </div>
915
- // </Popover>
916
- // <Select
917
- // mode={this.props.multiple ? 'multiple' : undefined}
918
- // style={{ width: '100%' }}
919
- // placeholder="Choose"
920
- // onSelect={(v: string) => this.onChange?.bind(null, v)}
921
- // value={this.props.value}
922
- // options={
923
- // this.props.options?.map((expiry) => ({
924
- // value: expiry,
925
- // label: expiry,
926
- // disabled: this.props.calcDisabled?.(expiry),
927
- // })) || []
928
- // }
929
- // />
930
- React.createElement("div", {
931
- className: "param-expiries-select"
932
- }, /*#__PURE__*/React.createElement(Select, {
933
- mode: this.props.multiple === false ? undefined : 'multiple',
934
- style: {
935
- width: '100%'
936
- },
937
- placeholder: "Choose",
938
- value: this.props.value,
939
- onChange: function onChange(values) {
940
- var _this3$onChange;
941
-
942
- return (_this3$onChange = _this3.onChange) === null || _this3$onChange === void 0 ? void 0 : _this3$onChange.call(_this3, values);
943
- }
944
- }, (_this$props$options2 = this.props.options) === null || _this$props$options2 === void 0 ? void 0 : _this$props$options2.map(function (option) {
945
- var _this3$props$calcDisa, _this3$props;
946
-
947
- return /*#__PURE__*/React.createElement(Select.Option, {
948
- key: option,
949
- value: option,
950
- disabled: (_this3$props$calcDisa = (_this3$props = _this3.props).calcDisabled) === null || _this3$props$calcDisa === void 0 ? void 0 : _this3$props$calcDisa.call(_this3$props, option)
951
- }, option);
895
+ }, this.props.className),
896
+ style: this.props.style
897
+ }, this.renderValue(), !this.props.readonly && this.props.options && /*#__PURE__*/React.createElement(DownOutlined, {
898
+ className: "param-expiries-arrow"
952
899
  })));
953
900
  }
954
901
  }]);
@@ -2557,6 +2504,352 @@ var TenorBucketHandlerList = /*#__PURE__*/function (_PureComponent) {
2557
2504
  return TenorBucketHandlerList;
2558
2505
  }(PureComponent);
2559
2506
 
2507
+ var ExpiryVegaAlphaByEdgeList = /*#__PURE__*/function (_PureComponent) {
2508
+ _inherits(ExpiryVegaAlphaByEdgeList, _PureComponent);
2509
+
2510
+ var _super = _createSuper(ExpiryVegaAlphaByEdgeList);
2511
+
2512
+ function ExpiryVegaAlphaByEdgeList() {
2513
+ var _this;
2514
+
2515
+ _classCallCheck(this, ExpiryVegaAlphaByEdgeList);
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), "value", []);
2524
+
2525
+ _defineProperty(_assertThisInitialized(_this), "isEmptyItem", function (item) {
2526
+ var _item$vegaRules, _item$expiry;
2527
+
2528
+ 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;
2530
+ }) : true;
2531
+ return !((_item$expiry = item.expiry) === null || _item$expiry === void 0 ? void 0 : _item$expiry.trim()) && !item.vegaTarget && !!vegaRulesValid;
2532
+ });
2533
+
2534
+ _defineProperty(_assertThisInitialized(_this), "onChange", function (i, val, key, k, subKey) {
2535
+ var _this$props$onChange, _this$props;
2536
+
2537
+ var value = _toConsumableArray(_this.value);
2538
+
2539
+ if (!value[i]) value[i] = {
2540
+ expiry: undefined,
2541
+ vegaTarget: undefined,
2542
+ vegaRules: [{
2543
+ optionType: undefined,
2544
+ deltaRange: {
2545
+ min: undefined,
2546
+ max: undefined
2547
+ },
2548
+ bidEdgeRange: {
2549
+ min: undefined,
2550
+ max: undefined
2551
+ },
2552
+ askEdgeRange: {
2553
+ min: undefined,
2554
+ max: undefined
2555
+ },
2556
+ allowTaker: false,
2557
+ disable: false
2558
+ }]
2559
+ };
2560
+
2561
+ if (key) {
2562
+ 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
+ }
2595
+ } else {
2596
+ value[i][key] = val;
2597
+ }
2598
+ } else {
2599
+ value[i] = _objectSpread2(_objectSpread2({}, value[i]), val);
2600
+ }
2601
+
2602
+ (_this$props$onChange = (_this$props = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props, value.length === 1 && _this.isEmptyItem(value[0]) ? [] : value);
2603
+ });
2604
+
2605
+ _defineProperty(_assertThisInitialized(_this), "onAdd", function (i) {
2606
+ var _this$props$onChange2, _this$props2, _this$props$onBlur, _this$props3;
2607
+
2608
+ var value = _toConsumableArray(_this.value);
2609
+
2610
+ value.splice(i + 1, 0, {
2611
+ expiry: undefined,
2612
+ vegaTarget: undefined,
2613
+ vegaRules: [{
2614
+ optionType: undefined,
2615
+ deltaRange: {
2616
+ min: undefined,
2617
+ max: undefined
2618
+ },
2619
+ bidEdgeRange: {
2620
+ min: undefined,
2621
+ max: undefined
2622
+ },
2623
+ askEdgeRange: {
2624
+ min: undefined,
2625
+ max: undefined
2626
+ },
2627
+ allowTaker: false,
2628
+ disable: false
2629
+ }]
2630
+ });
2631
+ (_this$props$onChange2 = (_this$props2 = _this.props).onChange) === null || _this$props$onChange2 === void 0 ? void 0 : _this$props$onChange2.call(_this$props2, value);
2632
+ (_this$props$onBlur = (_this$props3 = _this.props).onBlur) === null || _this$props$onBlur === void 0 ? void 0 : _this$props$onBlur.call(_this$props3);
2633
+ });
2634
+
2635
+ _defineProperty(_assertThisInitialized(_this), "onDel", function (i) {
2636
+ var _this$props$onChange3, _this$props4, _this$props$onBlur2, _this$props5;
2637
+
2638
+ var value = _toConsumableArray(_this.value);
2639
+
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);
2642
+ (_this$props$onBlur2 = (_this$props5 = _this.props).onBlur) === null || _this$props$onBlur2 === void 0 ? void 0 : _this$props$onBlur2.call(_this$props5);
2643
+ });
2644
+
2645
+ return _this;
2646
+ }
2647
+
2648
+ _createClass(ExpiryVegaAlphaByEdgeList, [{
2649
+ key: "render",
2650
+ value: function render() {
2651
+ var _this$props$value,
2652
+ _this$props$value2,
2653
+ _this2 = this;
2654
+
2655
+ this.value = ((_this$props$value = this.props.value) === null || _this$props$value === void 0 ? void 0 : _this$props$value.filter(function (it) {
2656
+ return !isExpired(it.expiry);
2657
+ })) || [];
2658
+ if (!this.value.length) this.value.push({
2659
+ expiry: undefined,
2660
+ vegaTarget: undefined,
2661
+ vegaRules: [{
2662
+ optionType: undefined,
2663
+ deltaRange: {
2664
+ min: undefined,
2665
+ max: undefined
2666
+ },
2667
+ bidEdgeRange: {
2668
+ min: undefined,
2669
+ max: undefined
2670
+ },
2671
+ askEdgeRange: {
2672
+ min: undefined,
2673
+ max: undefined
2674
+ },
2675
+ allowTaker: false,
2676
+ disable: false
2677
+ }]
2678
+ });
2679
+ return /*#__PURE__*/React.createElement("div", {
2680
+ className: classNames('param-expiries-limit', {
2681
+ readonly: this.props.readonly
2682
+ }, this.props.className),
2683
+ style: this.props.style
2684
+ }, 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) {
2685
+ return it.expiry;
2686
+ }).map(function (it, i) {
2687
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
2688
+ key: i
2689
+ }, it.expiry, /*#__PURE__*/React.createElement("span", null, "/"), !isNullLike(it.vegaTarget) ? it.vegaTarget : '-', /*#__PURE__*/React.createElement("span", null, "/"), it.vegaRules.map(function ($it, $i) {
2690
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
2691
+ 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));
2693
+ })), /*#__PURE__*/React.createElement("br", null));
2694
+ }) : '-' : /*#__PURE__*/React.createElement("div", {
2695
+ className: "param-expiries-limit-inputs",
2696
+ style: {
2697
+ gridTemplateColumns: '110px 100px auto auto'
2698
+ }
2699
+ }, /*#__PURE__*/React.createElement("div", {
2700
+ className: "param-number-range readonly"
2701
+ }, "Expiry"), /*#__PURE__*/React.createElement("div", {
2702
+ className: "param-number-range readonly"
2703
+ }, "Vega Target"), /*#__PURE__*/React.createElement("div", {
2704
+ className: "param-number-range readonly"
2705
+ }), /*#__PURE__*/React.createElement("div", {
2706
+ className: "param-number-range readonly"
2707
+ }), this.value.map(function (it, i) {
2708
+ var _this2$props$value, _this2$props$value$i;
2709
+
2710
+ return /*#__PURE__*/React.createElement(React.Fragment, {
2711
+ key: i
2712
+ }, /*#__PURE__*/React.createElement(Expiries, {
2713
+ style: {
2714
+ width: 110,
2715
+ minWidth: 0,
2716
+ position: 'relative',
2717
+ top: i > 0 ? -30 : 0
2718
+ },
2719
+ multiple: false,
2720
+ options: _this2.props.options,
2721
+ value: [it.expiry || ''],
2722
+ onChange: function onChange(val) {
2723
+ return _this2.onChange(i, val[0], 'expiry');
2724
+ } // calcDisabled={(expiry) =>
2725
+ // this.value.some((item) => item !== it && item.expiry === expiry)
2726
+ // }
2727
+ ,
2728
+ onBlur: _this2.props.onBlur
2729
+ }), /*#__PURE__*/React.createElement(Num, {
2730
+ value: (_this2$props$value = _this2.props.value) === null || _this2$props$value === void 0 ? void 0 : (_this2$props$value$i = _this2$props$value[i]) === null || _this2$props$value$i === void 0 ? void 0 : _this2$props$value$i.vegaTarget,
2731
+ onChange: function onChange(val) {
2732
+ return _this2.onChange(i, val, 'vegaTarget');
2733
+ },
2734
+ isPercentage: false,
2735
+ readonly: _this2.props.readonly,
2736
+ onBlur: _this2.props.onBlur,
2737
+ style: {
2738
+ height: 30,
2739
+ position: 'relative',
2740
+ top: i > 0 ? -30 : 0
2741
+ }
2742
+ }), /*#__PURE__*/React.createElement("div", {
2743
+ className: "param-expiries-limit-inputs",
2744
+ style: {
2745
+ position: 'relative',
2746
+ top: -30,
2747
+ width: 734,
2748
+ gridTemplateColumns: 'auto auto auto auto auto auto'
2749
+ }
2750
+ }, it.vegaRules.map(function (rule, k) {
2751
+ 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"
2753
+ }, "Call/Put/Call"), /*#__PURE__*/React.createElement("div", {
2754
+ className: "param-number-range readonly"
2755
+ }, "Delta Range"), /*#__PURE__*/React.createElement("div", {
2756
+ className: "param-number-range readonly"
2757
+ }, "Bid Edge Range"), /*#__PURE__*/React.createElement("div", {
2758
+ className: "param-number-range readonly"
2759
+ }, "Ask Edge Range"), /*#__PURE__*/React.createElement("div", {
2760
+ className: "param-number-range readonly"
2761
+ }, "Allow Taker"), /*#__PURE__*/React.createElement("div", {
2762
+ className: "param-number-range readonly"
2763
+ }, "Disabled")) : /*#__PURE__*/React.createElement(React.Fragment, null), /*#__PURE__*/React.createElement(TextSelector, {
2764
+ style: {
2765
+ width: 88,
2766
+ minWidth: 0,
2767
+ padding: '0 10px',
2768
+ height: 30
2769
+ },
2770
+ multiple: false,
2771
+ value: [rule.optionType || ''],
2772
+ onChange: function onChange(val) {
2773
+ return _this2.onChange(i, val[0], 'vegaRules', k, 'optionType');
2774
+ } // onBlur={this.props.onBlur}
2775
+ ,
2776
+ options: ['Both', 'Call', 'Put']
2777
+ }), /*#__PURE__*/React.createElement(NumRange, {
2778
+ value: {
2779
+ min: rule.deltaRange.min,
2780
+ max: rule.deltaRange.max
2781
+ },
2782
+ onChange: function onChange(val) {
2783
+ return _this2.onChange(i, val, 'vegaRules', k, 'deltaRange');
2784
+ },
2785
+ onBlur: _this2.props.onBlur
2786
+ }), /*#__PURE__*/React.createElement(NumRange, {
2787
+ value: {
2788
+ min: rule.bidEdgeRange.min,
2789
+ max: rule.bidEdgeRange.max
2790
+ },
2791
+ onChange: function onChange(val) {
2792
+ return _this2.onChange(i, val, 'vegaRules', k, 'bidEdgeRange');
2793
+ },
2794
+ isPercentage: true,
2795
+ onBlur: _this2.props.onBlur
2796
+ }), /*#__PURE__*/React.createElement(NumRange, {
2797
+ value: {
2798
+ min: rule.askEdgeRange.min,
2799
+ max: rule.askEdgeRange.max
2800
+ },
2801
+ onChange: function onChange(val) {
2802
+ return _this2.onChange(i, val, 'vegaRules', k, 'askEdgeRange');
2803
+ },
2804
+ isPercentage: true,
2805
+ onBlur: _this2.props.onBlur
2806
+ }), /*#__PURE__*/React.createElement("div", {
2807
+ style: {
2808
+ width: 74,
2809
+ position: 'relative',
2810
+ top: 4
2811
+ }
2812
+ }, /*#__PURE__*/React.createElement(Checkbox, {
2813
+ checked: rule.allowTaker,
2814
+ onChange: function onChange(e) {
2815
+ return _this2.onChange(i, e.target.checked, 'vegaRules', k, 'allowTaker');
2816
+ }
2817
+ })), /*#__PURE__*/React.createElement("div", {
2818
+ style: {
2819
+ width: 74,
2820
+ position: 'relative',
2821
+ top: 4
2822
+ }
2823
+ }, /*#__PURE__*/React.createElement(Checkbox, {
2824
+ checked: rule.disable,
2825
+ onChange: function onChange(e) {
2826
+ return _this2.onChange(i, e.target.checked, 'vegaRules', k, 'disable');
2827
+ }
2828
+ })));
2829
+ })), /*#__PURE__*/React.createElement("div", {
2830
+ className: "param-arr-ops"
2831
+ }, /*#__PURE__*/React.createElement(PlusOutlined, {
2832
+ className: "param-arr-ops-add",
2833
+ onClick: _this2.onAdd.bind(null, i),
2834
+ style: {
2835
+ position: 'relative',
2836
+ top: i > 0 ? -30 : 0
2837
+ }
2838
+ }), /*#__PURE__*/React.createElement(DeleteOutlined, {
2839
+ className: "param-arr-ops-del",
2840
+ onClick: _this2.onDel.bind(null, i),
2841
+ style: {
2842
+ position: 'relative',
2843
+ top: i > 0 ? -30 : 0
2844
+ }
2845
+ })));
2846
+ })));
2847
+ }
2848
+ }]);
2849
+
2850
+ return ExpiryVegaAlphaByEdgeList;
2851
+ }(PureComponent);
2852
+
2560
2853
  var _ParamTypeConfig;
2561
2854
 
2562
2855
  function emptyErrText(index, key) {
@@ -2873,6 +3166,73 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
2873
3166
  return '';
2874
3167
  },
2875
3168
  sort: 17
3169
+ }), _defineProperty(_ParamTypeConfig, ParamType.ExpiryVegaAlphaByEdgeList, {
3170
+ name: 'ExpiryVegaAlphaByEdgeList',
3171
+ key: 'expiryVegaAlphaByEdgeList',
3172
+ Comp: ExpiryVegaAlphaByEdgeList,
3173
+ validator: function validator($val) {
3174
+ if (!($val === null || $val === void 0 ? void 0 : $val.length)) return '';
3175
+ var expiries = [];
3176
+
3177
+ for (var i = 0; i < $val.length; i++) {
3178
+ var val = $val[i];
3179
+
3180
+ if (isEmpty(val.expiry)) {
3181
+ return emptyErrText(i, 'expiry');
3182
+ }
3183
+
3184
+ if (isEmpty(val.vegaTarget)) {
3185
+ return emptyErrText(i, 'vegaTarget');
3186
+ }
3187
+
3188
+ var $$val = val.vegaRules || [];
3189
+
3190
+ for (var k = 0; k < $$val.length; k++) {
3191
+ var vegaRule = $$val[k];
3192
+
3193
+ if (isEmpty(vegaRule.optionType)) {
3194
+ return emptyErrText(i, 'optionType');
3195
+ }
3196
+
3197
+ if (isEmpty(vegaRule.deltaRange.min)) {
3198
+ return emptyErrText(i, "delta range's min");
3199
+ }
3200
+
3201
+ if (isEmpty(vegaRule.deltaRange.max)) {
3202
+ return emptyErrText(i, "delta range's max");
3203
+ }
3204
+
3205
+ if (isEmpty(vegaRule.bidEdgeRange.min)) {
3206
+ return emptyErrText(i, "bid edge range's min");
3207
+ }
3208
+
3209
+ if (isEmpty(vegaRule.bidEdgeRange.max)) {
3210
+ return emptyErrText(i, "bid edge range's max");
3211
+ }
3212
+
3213
+ if (isEmpty(vegaRule.askEdgeRange.min)) {
3214
+ return emptyErrText(i, "ask edge range's min");
3215
+ }
3216
+
3217
+ if (isEmpty(vegaRule.askEdgeRange.max)) {
3218
+ return emptyErrText(i, "ask edge range's max");
3219
+ }
3220
+ } // if (expiries.includes(val.expiry)) {
3221
+ // return `The ${i + 1} ${
3222
+ // i === 0 ? 'st' : i === 1 ? 'nd' : i === 2 ? 'rd' : 'th'
3223
+ // } expiry is same as the ${expiries.indexOf(val.expiry) + 1} ${
3224
+ // i === 0 ? 'st' : i === 1 ? 'nd' : i === 2 ? 'rd' : 'th'
3225
+ // }`;
3226
+ // }
3227
+
3228
+
3229
+ expiries.push(val.expiry);
3230
+ }
3231
+
3232
+ return '';
3233
+ },
3234
+ sort: 18,
3235
+ modalWidth: 1280
2876
3236
  }), _ParamTypeConfig);
2877
3237
  function paramValidator(val, values, enableEmpty) {
2878
3238
  var _config$validator;
@@ -3040,7 +3400,15 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
3040
3400
  return !!it.key;
3041
3401
  }) : data;
3042
3402
  (_this$props$onChange = (_this$props = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props, $data);
3043
- if ('valueType' in changed) _this.forceUpdate();
3403
+
3404
+ if ('valueType' in changed) {
3405
+ var _this$ref$current$get, _this$ref$current, _this$props$initialVa;
3406
+
3407
+ 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');
3409
+
3410
+ _this.forceUpdate();
3411
+ }
3044
3412
  });
3045
3413
 
3046
3414
  return _this;
@@ -3049,13 +3417,14 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
3049
3417
  _createClass(ParamForm, [{
3050
3418
  key: "formItems",
3051
3419
  get: function get() {
3052
- var _this$ref$current$get,
3053
- _this$ref$current,
3054
- _this$props$initialVa,
3420
+ var _this$ref$current$get2,
3421
+ _this$ref$current2,
3422
+ _this$props$initialVa2,
3055
3423
  _this2 = this;
3056
3424
 
3057
- var valueType = (_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;
3425
+ 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;
3058
3426
  var config = ParamTypeConfig[valueType];
3427
+ localStorage.setItem('__editParamModalWidth', String(config.modalWidth) || '0');
3059
3428
  return [{
3060
3429
  label: '所属分组',
3061
3430
  name: 'parentId',
@@ -3166,7 +3535,7 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
3166
3535
  return Promise.resolve();
3167
3536
  }
3168
3537
  }],
3169
- validateTrigger: it.name === 'defaultValue' && [4, 5, 6, 10, 11].includes((_this3$ref$current = _this3.ref.current) === null || _this3$ref$current === void 0 ? void 0 : _this3$ref$current.getFieldValue('valueType')) ? 'onSubmit' : 'onBlur'
3538
+ validateTrigger: it.name === 'defaultValue' && [4, 5, 6, 10, 11, 18].includes((_this3$ref$current = _this3.ref.current) === null || _this3$ref$current === void 0 ? void 0 : _this3$ref$current.getFieldValue('valueType')) ? 'onSubmit' : 'onBlur'
3170
3539
  }, /*#__PURE__*/React.createElement(it.Comp, null));
3171
3540
  }), this.props.onSubmit && /*#__PURE__*/React.createElement(Button, {
3172
3541
  type: "primary",
@@ -3235,22 +3604,24 @@ var ParamFormModalEl = /*#__PURE__*/function (_PureComponent2) {
3235
3604
  });
3236
3605
  });
3237
3606
 
3607
+ _defineProperty(_assertThisInitialized(_this4), "width", localStorage.getItem('__editParamModalWidth'));
3608
+
3238
3609
  return _this4;
3239
3610
  }
3240
3611
 
3241
3612
  _createClass(ParamFormModalEl, [{
3242
3613
  key: "isEdit",
3243
3614
  get: function get() {
3244
- var _this$props$initialVa2;
3615
+ var _this$props$initialVa3;
3245
3616
 
3246
- return Boolean((_this$props$initialVa2 = this.props.initialValues) === null || _this$props$initialVa2 === void 0 ? void 0 : _this$props$initialVa2.$paramId);
3617
+ return Boolean((_this$props$initialVa3 = this.props.initialValues) === null || _this$props$initialVa3 === void 0 ? void 0 : _this$props$initialVa3.$paramId);
3247
3618
  }
3248
3619
  }, {
3249
3620
  key: "render",
3250
3621
  value: function render() {
3251
3622
  return /*#__PURE__*/React.createElement(Modal, {
3252
3623
  key: String(this.state.visible),
3253
- width: 740,
3624
+ width: Number(this.width) || 740,
3254
3625
  closable: false,
3255
3626
  title: !this.isEdit ? '新增参数' : '修改参数',
3256
3627
  visible: this.state.visible,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalplus/params-about",
3
- "version": "1.0.25-alpha",
3
+ "version": "1.0.26-alpha2",
4
4
  "description": "A description for the module",
5
5
  "main": "./lib/umd/index.js",
6
6
  "module": "./lib/es/index.js",
@@ -48,7 +48,7 @@
48
48
  "@types/react": "^16.8.23",
49
49
  "@types/react-dom": "^16.8.5",
50
50
  "ahooks": "^3.3.0",
51
- "antd": "^5.24.9",
51
+ "antd": "^4.19.5",
52
52
  "babel-plugin-istanbul": "^5.1.4",
53
53
  "babel-preset-react-app": "^9.0.0",
54
54
  "big.js": "^6.1.1",