@signalplus/params-about 1.0.25-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 +11 -1
- package/lib/es/index.js +726 -105
- package/package.json +2 -2
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;
|
|
@@ -90,6 +92,7 @@ interface ParamFormProps {
|
|
|
90
92
|
groupEditable?: boolean;
|
|
91
93
|
onChange?(data: ParamFormData): void;
|
|
92
94
|
onSubmit?(data: ParamFormData): any;
|
|
95
|
+
onModalWidthChange?(width: number): any;
|
|
93
96
|
}
|
|
94
97
|
declare class ParamForm extends PureComponent<ParamFormProps> {
|
|
95
98
|
ref: React.RefObject<any>;
|
|
@@ -108,11 +111,13 @@ declare class ParamFormModalEl extends PureComponent<ParamFormProps & Required<P
|
|
|
108
111
|
state: {
|
|
109
112
|
visible: boolean;
|
|
110
113
|
pending: boolean;
|
|
114
|
+
width: number | undefined;
|
|
111
115
|
};
|
|
112
116
|
get isEdit(): boolean;
|
|
113
117
|
onShow: () => void;
|
|
114
118
|
onHide: () => void;
|
|
115
119
|
onSubmit: () => any;
|
|
120
|
+
handleModalWidthChange: (width: number) => void;
|
|
116
121
|
render(): JSX.Element;
|
|
117
122
|
}
|
|
118
123
|
declare class ParamFormModal {
|
|
@@ -136,6 +141,7 @@ interface ParamValueEditorProps {
|
|
|
136
141
|
initialValues: ParamValueEditorData;
|
|
137
142
|
onChange?(data: ParamValueEditorData): void;
|
|
138
143
|
onSubmit?(data: ParamValueEditorData): any;
|
|
144
|
+
onModalWidthChange(width: number): void;
|
|
139
145
|
}
|
|
140
146
|
declare class ParamValueEditor extends PureComponent<ParamValueEditorProps> {
|
|
141
147
|
ref: React.RefObject<any>;
|
|
@@ -155,10 +161,12 @@ declare class ParamValueEditorModalEl extends PureComponent<ParamValueEditorProp
|
|
|
155
161
|
state: {
|
|
156
162
|
visible: boolean;
|
|
157
163
|
pending: boolean;
|
|
164
|
+
width: number;
|
|
158
165
|
};
|
|
159
166
|
onShow: () => void;
|
|
160
167
|
onHide: () => void;
|
|
161
168
|
onSubmit: () => any;
|
|
169
|
+
handleModalWidthChange: (width: number) => void;
|
|
162
170
|
render(): JSX.Element;
|
|
163
171
|
}
|
|
164
172
|
declare class ParamValueEditorModal {
|
|
@@ -318,6 +326,7 @@ declare const ParamTypeConfig: Record<ParamType, {
|
|
|
318
326
|
validator?(value: any, enableEmpty?: boolean): string;
|
|
319
327
|
required?: boolean;
|
|
320
328
|
sort: number;
|
|
329
|
+
modalWidth?: number;
|
|
321
330
|
}>;
|
|
322
331
|
declare function paramValidator(val: any, values: {
|
|
323
332
|
valueType: ParamType;
|
|
@@ -332,6 +341,7 @@ declare const ParamTypeOptions: {
|
|
|
332
341
|
validator?(value: any, enableEmpty?: boolean | undefined): string;
|
|
333
342
|
required?: boolean | undefined;
|
|
334
343
|
sort: number;
|
|
344
|
+
modalWidth?: number | undefined;
|
|
335
345
|
}[];
|
|
336
346
|
|
|
337
347
|
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-
|
|
4
|
-
* Version: 1.0.
|
|
3
|
+
* Generated: 2025-11-06
|
|
4
|
+
* Version: 1.0.26-alpha10
|
|
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 {
|
|
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) {
|
|
@@ -628,7 +629,7 @@ var NumRange = /*#__PURE__*/function (_PureComponent) {
|
|
|
628
629
|
}, this.props.className),
|
|
629
630
|
style: this.props.style
|
|
630
631
|
}, this.props.readonly ? '(' : '', /*#__PURE__*/React.createElement(Num, {
|
|
631
|
-
placeholder: 'Min',
|
|
632
|
+
placeholder: this.props.minName || 'Min',
|
|
632
633
|
value: (_this$props$value = this.props.value) === null || _this$props$value === void 0 ? void 0 : _this$props$value.min,
|
|
633
634
|
onChange: this.onChange.bind(null, 'min'),
|
|
634
635
|
isPercentage: this.props.isPercentage,
|
|
@@ -641,7 +642,7 @@ var NumRange = /*#__PURE__*/function (_PureComponent) {
|
|
|
641
642
|
marginRight: 4
|
|
642
643
|
} : undefined
|
|
643
644
|
}, this.props.readonly ? ',' : '~'), /*#__PURE__*/React.createElement(Num, {
|
|
644
|
-
placeholder: 'Max',
|
|
645
|
+
placeholder: this.props.maxName || 'Max',
|
|
645
646
|
value: (_this$props$value2 = this.props.value) === null || _this$props$value2 === void 0 ? void 0 : _this$props$value2.max,
|
|
646
647
|
onChange: this.onChange.bind(null, 'max'),
|
|
647
648
|
isPercentage: this.props.isPercentage,
|
|
@@ -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
|
|
805
|
-
|
|
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
|
|
865
|
-
|
|
868
|
+
var _this$props$options2,
|
|
869
|
+
_this3 = this;
|
|
866
870
|
|
|
867
|
-
|
|
868
|
-
""
|
|
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
|
-
|
|
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
|
-
|
|
877
|
-
/*#__PURE__*/
|
|
878
|
-
|
|
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,12 +2504,542 @@ var TenorBucketHandlerList = /*#__PURE__*/function (_PureComponent) {
|
|
|
2557
2504
|
return TenorBucketHandlerList;
|
|
2558
2505
|
}(PureComponent);
|
|
2559
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
|
+
}
|
|
2619
|
+
var ExpiryVegaAlphaByEdgeList = /*#__PURE__*/function (_PureComponent) {
|
|
2620
|
+
_inherits(ExpiryVegaAlphaByEdgeList, _PureComponent);
|
|
2621
|
+
|
|
2622
|
+
var _super = _createSuper(ExpiryVegaAlphaByEdgeList);
|
|
2623
|
+
|
|
2624
|
+
function ExpiryVegaAlphaByEdgeList() {
|
|
2625
|
+
var _this;
|
|
2626
|
+
|
|
2627
|
+
_classCallCheck(this, ExpiryVegaAlphaByEdgeList);
|
|
2628
|
+
|
|
2629
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2630
|
+
args[_key] = arguments[_key];
|
|
2631
|
+
}
|
|
2632
|
+
|
|
2633
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
2634
|
+
|
|
2635
|
+
_defineProperty(_assertThisInitialized(_this), "value", []);
|
|
2636
|
+
|
|
2637
|
+
_defineProperty(_assertThisInitialized(_this), "isEmptyItem", function (item) {
|
|
2638
|
+
var _item$vegaRules, _item$expiry;
|
|
2639
|
+
|
|
2640
|
+
var vegaRulesValid = item.vegaRules ? (_item$vegaRules = item.vegaRules) === null || _item$vegaRules === void 0 ? void 0 : _item$vegaRules.find(function (it) {
|
|
2641
|
+
return it.deltaRange.min || it.deltaRange.max || it.bidEdgeSpan.from || it.bidEdgeSpan.to || it.askEdgeSpan.from || it.askEdgeSpan.to;
|
|
2642
|
+
}) : true;
|
|
2643
|
+
return !((_item$expiry = item.expiry) === null || _item$expiry === void 0 ? void 0 : _item$expiry.trim()) && !item.vegaTarget && !!vegaRulesValid;
|
|
2644
|
+
});
|
|
2645
|
+
|
|
2646
|
+
_defineProperty(_assertThisInitialized(_this), "onChange", function (i, val, key, k, subKey) {
|
|
2647
|
+
var _this$props$onChange, _this$props;
|
|
2648
|
+
|
|
2649
|
+
var value = _toConsumableArray(_this.value);
|
|
2650
|
+
|
|
2651
|
+
if (!value[i]) value[i] = {
|
|
2652
|
+
expiry: undefined,
|
|
2653
|
+
vegaTarget: undefined,
|
|
2654
|
+
vegaRules: [{
|
|
2655
|
+
optionType: undefined,
|
|
2656
|
+
deltaRange: {
|
|
2657
|
+
min: undefined,
|
|
2658
|
+
max: undefined
|
|
2659
|
+
},
|
|
2660
|
+
bidEdgeSpan: {
|
|
2661
|
+
from: undefined,
|
|
2662
|
+
to: undefined
|
|
2663
|
+
},
|
|
2664
|
+
askEdgeSpan: {
|
|
2665
|
+
from: undefined,
|
|
2666
|
+
to: undefined
|
|
2667
|
+
},
|
|
2668
|
+
allowTaker: false,
|
|
2669
|
+
disable: false
|
|
2670
|
+
}]
|
|
2671
|
+
};
|
|
2672
|
+
|
|
2673
|
+
if (key) {
|
|
2674
|
+
if (subKey && typeof k === 'number') {
|
|
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;
|
|
2707
|
+
} else {
|
|
2708
|
+
value[i][key] = val;
|
|
2709
|
+
}
|
|
2710
|
+
} else {
|
|
2711
|
+
value[i] = _objectSpread2(_objectSpread2({}, value[i]), val);
|
|
2712
|
+
}
|
|
2713
|
+
|
|
2714
|
+
(_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);
|
|
2715
|
+
});
|
|
2716
|
+
|
|
2717
|
+
_defineProperty(_assertThisInitialized(_this), "onAdd", function (i) {
|
|
2718
|
+
var _this$props$onChange2, _this$props2, _this$props$onBlur, _this$props3;
|
|
2719
|
+
|
|
2720
|
+
var value = _toConsumableArray(_this.value);
|
|
2721
|
+
|
|
2722
|
+
value.splice(i + 1, 0, {
|
|
2723
|
+
expiry: undefined,
|
|
2724
|
+
vegaTarget: undefined,
|
|
2725
|
+
vegaRules: [{
|
|
2726
|
+
optionType: undefined,
|
|
2727
|
+
deltaRange: {
|
|
2728
|
+
min: undefined,
|
|
2729
|
+
max: undefined
|
|
2730
|
+
},
|
|
2731
|
+
bidEdgeSpan: {
|
|
2732
|
+
from: undefined,
|
|
2733
|
+
to: undefined
|
|
2734
|
+
},
|
|
2735
|
+
askEdgeSpan: {
|
|
2736
|
+
from: undefined,
|
|
2737
|
+
to: undefined
|
|
2738
|
+
},
|
|
2739
|
+
allowTaker: false,
|
|
2740
|
+
disable: false
|
|
2741
|
+
}]
|
|
2742
|
+
});
|
|
2743
|
+
(_this$props$onChange2 = (_this$props2 = _this.props).onChange) === null || _this$props$onChange2 === void 0 ? void 0 : _this$props$onChange2.call(_this$props2, value);
|
|
2744
|
+
(_this$props$onBlur = (_this$props3 = _this.props).onBlur) === null || _this$props$onBlur === void 0 ? void 0 : _this$props$onBlur.call(_this$props3);
|
|
2745
|
+
});
|
|
2746
|
+
|
|
2747
|
+
_defineProperty(_assertThisInitialized(_this), "onAddRule", function (i, k) {
|
|
2748
|
+
var _this$props$onChange3, _this$props4, _this$props$onBlur2, _this$props5;
|
|
2749
|
+
|
|
2750
|
+
var value = _toConsumableArray(_this.value);
|
|
2751
|
+
|
|
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);
|
|
2770
|
+
(_this$props$onBlur2 = (_this$props5 = _this.props).onBlur) === null || _this$props$onBlur2 === void 0 ? void 0 : _this$props$onBlur2.call(_this$props5);
|
|
2771
|
+
});
|
|
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
|
+
|
|
2793
|
+
return _this;
|
|
2794
|
+
}
|
|
2795
|
+
|
|
2796
|
+
_createClass(ExpiryVegaAlphaByEdgeList, [{
|
|
2797
|
+
key: "render",
|
|
2798
|
+
value: function render() {
|
|
2799
|
+
var _this$props$value,
|
|
2800
|
+
_this$props$value2,
|
|
2801
|
+
_this2 = this;
|
|
2802
|
+
|
|
2803
|
+
this.value = ((_this$props$value = this.props.value) === null || _this$props$value === void 0 ? void 0 : _this$props$value.filter(function (it) {
|
|
2804
|
+
return !isExpired(it.expiry);
|
|
2805
|
+
})) || [];
|
|
2806
|
+
if (!this.value.length) this.value.push({
|
|
2807
|
+
expiry: undefined,
|
|
2808
|
+
vegaTarget: undefined,
|
|
2809
|
+
vegaRules: [{
|
|
2810
|
+
optionType: undefined,
|
|
2811
|
+
deltaRange: {
|
|
2812
|
+
min: undefined,
|
|
2813
|
+
max: undefined
|
|
2814
|
+
},
|
|
2815
|
+
bidEdgeSpan: {
|
|
2816
|
+
from: undefined,
|
|
2817
|
+
to: undefined
|
|
2818
|
+
},
|
|
2819
|
+
askEdgeSpan: {
|
|
2820
|
+
from: undefined,
|
|
2821
|
+
to: undefined
|
|
2822
|
+
},
|
|
2823
|
+
allowTaker: false,
|
|
2824
|
+
disable: false
|
|
2825
|
+
}]
|
|
2826
|
+
});
|
|
2827
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
2828
|
+
className: classNames('param-expiries-limit', {
|
|
2829
|
+
readonly: this.props.readonly
|
|
2830
|
+
}, this.props.className),
|
|
2831
|
+
style: this.props.style
|
|
2832
|
+
}, 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) {
|
|
2833
|
+
return it.expiry;
|
|
2834
|
+
}).map(function (it, i) {
|
|
2835
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
2836
|
+
key: i
|
|
2837
|
+
}, it.expiry, /*#__PURE__*/React.createElement("span", null, "/"), !isNullLike(it.vegaTarget) ? it.vegaTarget : '-', /*#__PURE__*/React.createElement("span", null, "/"), it.vegaRules.map(function ($it, $i) {
|
|
2838
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
2839
|
+
key: $i
|
|
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));
|
|
2841
|
+
})), /*#__PURE__*/React.createElement("br", null));
|
|
2842
|
+
}) : '-' : /*#__PURE__*/React.createElement("div", {
|
|
2843
|
+
className: "param-expiries-limit-inputs",
|
|
2844
|
+
style: {
|
|
2845
|
+
gridTemplateColumns: '110px 100px auto auto'
|
|
2846
|
+
}
|
|
2847
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
2848
|
+
className: "param-number-range readonly"
|
|
2849
|
+
}, "Expiry"), /*#__PURE__*/React.createElement("div", {
|
|
2850
|
+
className: "param-number-range readonly"
|
|
2851
|
+
}, "Vega Target"), /*#__PURE__*/React.createElement("div", {
|
|
2852
|
+
className: "param-number-range readonly"
|
|
2853
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
2854
|
+
className: "param-number-range readonly"
|
|
2855
|
+
}), this.value.map(function (it, i) {
|
|
2856
|
+
var _this2$props$value, _this2$props$value$i;
|
|
2857
|
+
|
|
2858
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
2859
|
+
key: i
|
|
2860
|
+
}, /*#__PURE__*/React.createElement(Expiries, {
|
|
2861
|
+
style: {
|
|
2862
|
+
width: 110,
|
|
2863
|
+
minWidth: 0,
|
|
2864
|
+
position: 'relative',
|
|
2865
|
+
top: i > 0 ? -30 : 0
|
|
2866
|
+
},
|
|
2867
|
+
multiple: false,
|
|
2868
|
+
options: _this2.props.options,
|
|
2869
|
+
value: [it.expiry || ''],
|
|
2870
|
+
onChange: function onChange(val) {
|
|
2871
|
+
return _this2.onChange(i, val[0], 'expiry');
|
|
2872
|
+
} // calcDisabled={(expiry) =>
|
|
2873
|
+
// this.value.some((item) => item !== it && item.expiry === expiry)
|
|
2874
|
+
// }
|
|
2875
|
+
,
|
|
2876
|
+
onBlur: _this2.props.onBlur
|
|
2877
|
+
}), /*#__PURE__*/React.createElement(Num, {
|
|
2878
|
+
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,
|
|
2879
|
+
onChange: function onChange(val) {
|
|
2880
|
+
return _this2.onChange(i, val, 'vegaTarget');
|
|
2881
|
+
},
|
|
2882
|
+
isPercentage: false,
|
|
2883
|
+
readonly: _this2.props.readonly,
|
|
2884
|
+
onBlur: _this2.props.onBlur,
|
|
2885
|
+
style: {
|
|
2886
|
+
height: 30,
|
|
2887
|
+
position: 'relative',
|
|
2888
|
+
top: i > 0 ? -30 : 0
|
|
2889
|
+
}
|
|
2890
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
2891
|
+
className: "param-expiries-limit-inputs",
|
|
2892
|
+
style: {
|
|
2893
|
+
position: 'relative',
|
|
2894
|
+
top: -30,
|
|
2895
|
+
width: 734,
|
|
2896
|
+
gridTemplateColumns: 'auto auto auto auto auto auto'
|
|
2897
|
+
}
|
|
2898
|
+
}, it.vegaRules.map(function (rule, k) {
|
|
2899
|
+
var _it$vegaRules;
|
|
2900
|
+
|
|
2901
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, i === 0 && k === 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
2902
|
+
className: "param-number-range readonly",
|
|
2903
|
+
style: {
|
|
2904
|
+
paddingLeft: 36
|
|
2905
|
+
}
|
|
2906
|
+
}, "Call/Put/Call"), /*#__PURE__*/React.createElement("div", {
|
|
2907
|
+
className: "param-number-range readonly"
|
|
2908
|
+
}, "Delta Range"), /*#__PURE__*/React.createElement("div", {
|
|
2909
|
+
className: "param-number-range readonly"
|
|
2910
|
+
}, "Bid Edge Range"), /*#__PURE__*/React.createElement("div", {
|
|
2911
|
+
className: "param-number-range readonly"
|
|
2912
|
+
}, "Ask Edge Range"), /*#__PURE__*/React.createElement("div", {
|
|
2913
|
+
className: "param-number-range readonly"
|
|
2914
|
+
}, "Allow Taker"), /*#__PURE__*/React.createElement("div", {
|
|
2915
|
+
className: "param-number-range readonly"
|
|
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, {
|
|
2933
|
+
style: {
|
|
2934
|
+
width: 88,
|
|
2935
|
+
minWidth: 0,
|
|
2936
|
+
padding: '0 10px',
|
|
2937
|
+
height: 30
|
|
2938
|
+
},
|
|
2939
|
+
multiple: false,
|
|
2940
|
+
value: [rule.optionType || ''],
|
|
2941
|
+
onChange: function onChange(val) {
|
|
2942
|
+
return _this2.onChange(i, val[0], 'vegaRules', k, 'optionType');
|
|
2943
|
+
} // onBlur={this.props.onBlur}
|
|
2944
|
+
,
|
|
2945
|
+
options: ['Both', 'Call', 'Put']
|
|
2946
|
+
})), /*#__PURE__*/React.createElement(NumRange, {
|
|
2947
|
+
value: {
|
|
2948
|
+
min: rule.deltaRange.min,
|
|
2949
|
+
max: rule.deltaRange.max
|
|
2950
|
+
},
|
|
2951
|
+
onChange: function onChange(val) {
|
|
2952
|
+
return _this2.onChange(i, val, 'vegaRules', k, 'deltaRange');
|
|
2953
|
+
},
|
|
2954
|
+
onBlur: _this2.props.onBlur
|
|
2955
|
+
}), /*#__PURE__*/React.createElement(NumRangeFromTo, {
|
|
2956
|
+
value: {
|
|
2957
|
+
from: rule.bidEdgeSpan.from,
|
|
2958
|
+
to: rule.bidEdgeSpan.to
|
|
2959
|
+
},
|
|
2960
|
+
onChange: function onChange(val) {
|
|
2961
|
+
return _this2.onChange(i, val, 'vegaRules', k, 'bidEdgeSpan');
|
|
2962
|
+
},
|
|
2963
|
+
isPercentage: true,
|
|
2964
|
+
onBlur: _this2.props.onBlur
|
|
2965
|
+
}), /*#__PURE__*/React.createElement(NumRangeFromTo, {
|
|
2966
|
+
value: {
|
|
2967
|
+
from: rule.askEdgeSpan.from,
|
|
2968
|
+
to: rule.askEdgeSpan.to
|
|
2969
|
+
},
|
|
2970
|
+
onChange: function onChange(val) {
|
|
2971
|
+
return _this2.onChange(i, val, 'vegaRules', k, 'askEdgeSpan');
|
|
2972
|
+
},
|
|
2973
|
+
isPercentage: true,
|
|
2974
|
+
onBlur: _this2.props.onBlur
|
|
2975
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
2976
|
+
style: {
|
|
2977
|
+
width: 74,
|
|
2978
|
+
position: 'relative',
|
|
2979
|
+
top: 4
|
|
2980
|
+
}
|
|
2981
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
2982
|
+
checked: rule.allowTaker,
|
|
2983
|
+
onChange: function onChange(e) {
|
|
2984
|
+
return _this2.onChange(i, e.target.checked, 'vegaRules', k, 'allowTaker');
|
|
2985
|
+
}
|
|
2986
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
2987
|
+
style: {
|
|
2988
|
+
width: 74,
|
|
2989
|
+
position: 'relative',
|
|
2990
|
+
top: 4
|
|
2991
|
+
}
|
|
2992
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
2993
|
+
checked: rule.disable,
|
|
2994
|
+
onChange: function onChange(e) {
|
|
2995
|
+
return _this2.onChange(i, e.target.checked, 'vegaRules', k, 'disable');
|
|
2996
|
+
}
|
|
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
|
+
}))));
|
|
3009
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
3010
|
+
className: "param-arr-ops"
|
|
3011
|
+
}, /*#__PURE__*/React.createElement(PlusOutlined, {
|
|
3012
|
+
className: "param-arr-ops-add",
|
|
3013
|
+
onClick: _this2.onAdd.bind(null, i),
|
|
3014
|
+
style: {
|
|
3015
|
+
position: 'relative',
|
|
3016
|
+
top: i > 0 ? -30 : 0
|
|
3017
|
+
}
|
|
3018
|
+
}), /*#__PURE__*/React.createElement(DeleteOutlined, {
|
|
3019
|
+
className: "param-arr-ops-del",
|
|
3020
|
+
onClick: _this2.onDel.bind(null, i),
|
|
3021
|
+
style: {
|
|
3022
|
+
position: 'relative',
|
|
3023
|
+
top: i > 0 ? -30 : 0
|
|
3024
|
+
}
|
|
3025
|
+
})));
|
|
3026
|
+
})));
|
|
3027
|
+
}
|
|
3028
|
+
}]);
|
|
3029
|
+
|
|
3030
|
+
return ExpiryVegaAlphaByEdgeList;
|
|
3031
|
+
}(PureComponent);
|
|
3032
|
+
|
|
2560
3033
|
var _ParamTypeConfig;
|
|
2561
3034
|
|
|
2562
3035
|
function emptyErrText(index, key) {
|
|
2563
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");
|
|
2564
3037
|
}
|
|
2565
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
|
+
|
|
2566
3043
|
var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig, ParamType.ParamGroup, {
|
|
2567
3044
|
name: '参数组',
|
|
2568
3045
|
Comp: function Comp() {
|
|
@@ -2873,6 +3350,115 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
|
|
|
2873
3350
|
return '';
|
|
2874
3351
|
},
|
|
2875
3352
|
sort: 17
|
|
3353
|
+
}), _defineProperty(_ParamTypeConfig, ParamType.ExpiryVegaAlphaByEdgeList, {
|
|
3354
|
+
name: 'ExpiryVegaAlphaByEdgeList',
|
|
3355
|
+
key: 'expiryVegaAlphaByEdgeList',
|
|
3356
|
+
Comp: ExpiryVegaAlphaByEdgeList,
|
|
3357
|
+
validator: function validator($val) {
|
|
3358
|
+
if (!($val === null || $val === void 0 ? void 0 : $val.length)) return '';
|
|
3359
|
+
var expiries = [];
|
|
3360
|
+
|
|
3361
|
+
for (var i = 0; i < $val.length; i++) {
|
|
3362
|
+
var val = $val[i];
|
|
3363
|
+
|
|
3364
|
+
if (isEmpty(val.expiry)) {
|
|
3365
|
+
return emptyErrText(i, 'expiry');
|
|
3366
|
+
}
|
|
3367
|
+
|
|
3368
|
+
if (isEmpty(val.vegaTarget)) {
|
|
3369
|
+
return emptyErrText(i, 'vegaTarget');
|
|
3370
|
+
}
|
|
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
|
+
|
|
3376
|
+
var $$val = val.vegaRules || [];
|
|
3377
|
+
|
|
3378
|
+
for (var k = 0; k < $$val.length; k++) {
|
|
3379
|
+
var vegaRule = $$val[k];
|
|
3380
|
+
|
|
3381
|
+
if (isEmpty(vegaRule.optionType)) {
|
|
3382
|
+
return emptyErrText(i, 'optionType');
|
|
3383
|
+
}
|
|
3384
|
+
|
|
3385
|
+
if (isEmpty(vegaRule.deltaRange.min)) {
|
|
3386
|
+
return emptyErrText(i, "delta range's min");
|
|
3387
|
+
}
|
|
3388
|
+
|
|
3389
|
+
if (isEmpty(vegaRule.deltaRange.max)) {
|
|
3390
|
+
return emptyErrText(i, "delta range's max");
|
|
3391
|
+
}
|
|
3392
|
+
|
|
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");
|
|
3399
|
+
}
|
|
3400
|
+
|
|
3401
|
+
if (isEmpty(vegaRule.askEdgeSpan.from)) {
|
|
3402
|
+
return emptyErrText(i, "ask edge range's from");
|
|
3403
|
+
}
|
|
3404
|
+
|
|
3405
|
+
if (isEmpty(vegaRule.askEdgeSpan.to)) {
|
|
3406
|
+
return emptyErrText(i, "ask edge range's to");
|
|
3407
|
+
}
|
|
3408
|
+
|
|
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
|
+
}
|
|
3443
|
+
}
|
|
3444
|
+
} // if (expiries.includes(val.expiry)) {
|
|
3445
|
+
// return `The ${i + 1} ${
|
|
3446
|
+
// i === 0 ? 'st' : i === 1 ? 'nd' : i === 2 ? 'rd' : 'th'
|
|
3447
|
+
// } expiry is same as the ${expiries.indexOf(val.expiry) + 1} ${
|
|
3448
|
+
// i === 0 ? 'st' : i === 1 ? 'nd' : i === 2 ? 'rd' : 'th'
|
|
3449
|
+
// }`;
|
|
3450
|
+
// }
|
|
3451
|
+
|
|
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");
|
|
3455
|
+
expiries.push(val.expiry);
|
|
3456
|
+
}
|
|
3457
|
+
|
|
3458
|
+
return '';
|
|
3459
|
+
},
|
|
3460
|
+
sort: 18,
|
|
3461
|
+
modalWidth: 1280
|
|
2876
3462
|
}), _ParamTypeConfig);
|
|
2877
3463
|
function paramValidator(val, values, enableEmpty) {
|
|
2878
3464
|
var _config$validator;
|
|
@@ -3040,7 +3626,16 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
3040
3626
|
return !!it.key;
|
|
3041
3627
|
}) : data;
|
|
3042
3628
|
(_this$props$onChange = (_this$props = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props, $data);
|
|
3043
|
-
|
|
3629
|
+
|
|
3630
|
+
if ('valueType' in changed) {
|
|
3631
|
+
var _this$ref$current$get, _this$ref$current, _this$props$initialVa, _this$props$onModalWi, _this$props2, _config$modalWidth;
|
|
3632
|
+
|
|
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];
|
|
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);
|
|
3636
|
+
|
|
3637
|
+
_this.forceUpdate();
|
|
3638
|
+
}
|
|
3044
3639
|
});
|
|
3045
3640
|
|
|
3046
3641
|
return _this;
|
|
@@ -3049,12 +3644,12 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
3049
3644
|
_createClass(ParamForm, [{
|
|
3050
3645
|
key: "formItems",
|
|
3051
3646
|
get: function get() {
|
|
3052
|
-
var _this$ref$current$
|
|
3053
|
-
_this$ref$
|
|
3054
|
-
_this$props$
|
|
3647
|
+
var _this$ref$current$get2,
|
|
3648
|
+
_this$ref$current2,
|
|
3649
|
+
_this$props$initialVa2,
|
|
3055
3650
|
_this2 = this;
|
|
3056
3651
|
|
|
3057
|
-
var valueType = (_this$ref$current$
|
|
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;
|
|
3058
3653
|
var config = ParamTypeConfig[valueType];
|
|
3059
3654
|
return [{
|
|
3060
3655
|
label: '所属分组',
|
|
@@ -3166,7 +3761,7 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
3166
3761
|
return Promise.resolve();
|
|
3167
3762
|
}
|
|
3168
3763
|
}],
|
|
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'
|
|
3764
|
+
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
3765
|
}, /*#__PURE__*/React.createElement(it.Comp, null));
|
|
3171
3766
|
}), this.props.onSubmit && /*#__PURE__*/React.createElement(Button, {
|
|
3172
3767
|
type: "primary",
|
|
@@ -3184,6 +3779,8 @@ var ParamFormModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
|
3184
3779
|
var _super2 = _createSuper(ParamFormModalEl);
|
|
3185
3780
|
|
|
3186
3781
|
function ParamFormModalEl() {
|
|
3782
|
+
var _this4$props$initialV, _ParamTypeConfig$_thi, _this4$props$initialV2;
|
|
3783
|
+
|
|
3187
3784
|
var _this4;
|
|
3188
3785
|
|
|
3189
3786
|
_classCallCheck(this, ParamFormModalEl);
|
|
@@ -3198,7 +3795,8 @@ var ParamFormModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
|
3198
3795
|
|
|
3199
3796
|
_defineProperty(_assertThisInitialized(_this4), "state", {
|
|
3200
3797
|
visible: false,
|
|
3201
|
-
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
|
|
3202
3800
|
});
|
|
3203
3801
|
|
|
3204
3802
|
_defineProperty(_assertThisInitialized(_this4), "onShow", function () {
|
|
@@ -3235,22 +3833,28 @@ var ParamFormModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
|
3235
3833
|
});
|
|
3236
3834
|
});
|
|
3237
3835
|
|
|
3836
|
+
_defineProperty(_assertThisInitialized(_this4), "handleModalWidthChange", function (width) {
|
|
3837
|
+
_this4.setState({
|
|
3838
|
+
width: width
|
|
3839
|
+
});
|
|
3840
|
+
});
|
|
3841
|
+
|
|
3238
3842
|
return _this4;
|
|
3239
3843
|
}
|
|
3240
3844
|
|
|
3241
3845
|
_createClass(ParamFormModalEl, [{
|
|
3242
3846
|
key: "isEdit",
|
|
3243
3847
|
get: function get() {
|
|
3244
|
-
var _this$props$
|
|
3848
|
+
var _this$props$initialVa3;
|
|
3245
3849
|
|
|
3246
|
-
return Boolean((_this$props$
|
|
3850
|
+
return Boolean((_this$props$initialVa3 = this.props.initialValues) === null || _this$props$initialVa3 === void 0 ? void 0 : _this$props$initialVa3.$paramId);
|
|
3247
3851
|
}
|
|
3248
3852
|
}, {
|
|
3249
3853
|
key: "render",
|
|
3250
3854
|
value: function render() {
|
|
3251
3855
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
3252
3856
|
key: String(this.state.visible),
|
|
3253
|
-
width: 740,
|
|
3857
|
+
width: this.state.width || 740,
|
|
3254
3858
|
closable: false,
|
|
3255
3859
|
title: !this.isEdit ? '新增参数' : '修改参数',
|
|
3256
3860
|
visible: this.state.visible,
|
|
@@ -3263,7 +3867,8 @@ var ParamFormModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
|
3263
3867
|
}, "\u786E\u8BA4"))
|
|
3264
3868
|
}, /*#__PURE__*/React.createElement(ParamForm, Object.assign({}, this.props, {
|
|
3265
3869
|
ref: this.ref,
|
|
3266
|
-
onSubmit: undefined
|
|
3870
|
+
onSubmit: undefined,
|
|
3871
|
+
onModalWidthChange: this.handleModalWidthChange
|
|
3267
3872
|
})));
|
|
3268
3873
|
}
|
|
3269
3874
|
}]);
|
|
@@ -3318,9 +3923,18 @@ var ParamValueEditor = /*#__PURE__*/function (_PureComponent) {
|
|
|
3318
3923
|
_defineProperty(_assertThisInitialized(_this), "ref", React.createRef());
|
|
3319
3924
|
|
|
3320
3925
|
_defineProperty(_assertThisInitialized(_this), "onChange", function (changed, data) {
|
|
3321
|
-
var _this$props$onChange, _this$
|
|
3926
|
+
var _this$props$onChange, _this$props2;
|
|
3322
3927
|
|
|
3323
|
-
|
|
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);
|
|
3324
3938
|
});
|
|
3325
3939
|
|
|
3326
3940
|
return _this;
|
|
@@ -3448,7 +4062,8 @@ var ParamValueEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
|
3448
4062
|
|
|
3449
4063
|
_defineProperty(_assertThisInitialized(_this3), "state", {
|
|
3450
4064
|
visible: false,
|
|
3451
|
-
pending: false
|
|
4065
|
+
pending: false,
|
|
4066
|
+
width: ParamTypeConfig[_this3.props.valueType].modalWidth || 740
|
|
3452
4067
|
});
|
|
3453
4068
|
|
|
3454
4069
|
_defineProperty(_assertThisInitialized(_this3), "onShow", function () {
|
|
@@ -3485,6 +4100,12 @@ var ParamValueEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
|
3485
4100
|
});
|
|
3486
4101
|
});
|
|
3487
4102
|
|
|
4103
|
+
_defineProperty(_assertThisInitialized(_this3), "handleModalWidthChange", function (width) {
|
|
4104
|
+
_this3.setState({
|
|
4105
|
+
width: width
|
|
4106
|
+
});
|
|
4107
|
+
});
|
|
4108
|
+
|
|
3488
4109
|
return _this3;
|
|
3489
4110
|
}
|
|
3490
4111
|
|
|
@@ -3493,7 +4114,7 @@ var ParamValueEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
|
3493
4114
|
value: function render() {
|
|
3494
4115
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
3495
4116
|
key: String(this.state.visible),
|
|
3496
|
-
width: 740,
|
|
4117
|
+
width: this.state.width || 740,
|
|
3497
4118
|
title: 'Edit Value',
|
|
3498
4119
|
closable: false,
|
|
3499
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.
|
|
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",
|
|
@@ -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": "^
|
|
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",
|