@signalplus/params-about 1.0.24 → 1.0.26-alpha
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 +7 -2
- package/lib/es/index.js +445 -18
- package/package.json +1 -1
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;
|
|
@@ -342,7 +347,7 @@ declare function numRangeValidator(val: {
|
|
|
342
347
|
min?: string;
|
|
343
348
|
max?: string;
|
|
344
349
|
}, enableEmpty?: boolean): string;
|
|
345
|
-
declare function expiryValidator(val: string, enableEmpty?: boolean): "Should not be empty" | ""
|
|
350
|
+
declare function expiryValidator(val: string, enableEmpty?: boolean): "Should not be empty" | "";
|
|
346
351
|
declare function expiriesValidator(val: string[]): string;
|
|
347
352
|
declare function keyValidator(val: string, allKeys: string[]): "Should not be empty" | "" | "Out of format: should be a combination of the following chars `_.0-9a-zA-Z`" | "This key has been used";
|
|
348
353
|
declare function isExpired(val?: string): boolean;
|
package/lib/es/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Bundle of @signalplus/params-about
|
|
3
|
-
* Generated:
|
|
4
|
-
* Version: 1.0.
|
|
3
|
+
* Generated: 2025-10-15
|
|
4
|
+
* Version: 1.0.26-alpha
|
|
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 { Popover, Cascader, Input, Select, 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) {
|
|
@@ -293,16 +294,18 @@ function numRangeValidator(val, enableEmpty) {
|
|
|
293
294
|
}
|
|
294
295
|
function expiryValidator(val, enableEmpty) {
|
|
295
296
|
var error = emptyValidator(val, enableEmpty);
|
|
296
|
-
if (error) return error;
|
|
297
|
-
|
|
298
|
-
|
|
297
|
+
if (error) return error; // const $val = dayjs(val.replace(/([a-zA-Z]+)/, ' $1 '), 'D MMM YY')
|
|
298
|
+
// .format('DMMMYY')
|
|
299
|
+
// .toUpperCase();
|
|
300
|
+
// if ($val !== val && `0${$val}` !== val) return 'Out of format';
|
|
301
|
+
|
|
299
302
|
return '';
|
|
300
303
|
}
|
|
301
304
|
function expiriesValidator(val) {
|
|
302
305
|
if (!(val === null || val === void 0 ? void 0 : val.length)) return '';
|
|
303
306
|
|
|
304
307
|
for (var i = 0; i < val.length; i++) {
|
|
305
|
-
var error =
|
|
308
|
+
var error = emptyValidator(val[i]);
|
|
306
309
|
|
|
307
310
|
if (error) {
|
|
308
311
|
// return { [i]: error }
|
|
@@ -2501,6 +2504,352 @@ var TenorBucketHandlerList = /*#__PURE__*/function (_PureComponent) {
|
|
|
2501
2504
|
return TenorBucketHandlerList;
|
|
2502
2505
|
}(PureComponent);
|
|
2503
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
|
+
|
|
2504
2853
|
var _ParamTypeConfig;
|
|
2505
2854
|
|
|
2506
2855
|
function emptyErrText(index, key) {
|
|
@@ -2590,7 +2939,7 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
|
|
|
2590
2939
|
|
|
2591
2940
|
for (var i = 0; i < $val.length; i++) {
|
|
2592
2941
|
var val = $val[i];
|
|
2593
|
-
var error =
|
|
2942
|
+
var error = emptyValidator(val === null || val === void 0 ? void 0 : val.expiry);
|
|
2594
2943
|
if (isEmpty(val.expiry) && isNullLike(val.value)) return '';
|
|
2595
2944
|
|
|
2596
2945
|
if (error) {
|
|
@@ -2618,7 +2967,7 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
|
|
|
2618
2967
|
|
|
2619
2968
|
for (var i = 0; i < $val.length; i++) {
|
|
2620
2969
|
var val = $val[i];
|
|
2621
|
-
var error =
|
|
2970
|
+
var error = emptyValidator(val === null || val === void 0 ? void 0 : val.expiry);
|
|
2622
2971
|
|
|
2623
2972
|
if (error) {
|
|
2624
2973
|
// return { [i]: { expire: error } }
|
|
@@ -2817,6 +3166,73 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
|
|
|
2817
3166
|
return '';
|
|
2818
3167
|
},
|
|
2819
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
|
|
2820
3236
|
}), _ParamTypeConfig);
|
|
2821
3237
|
function paramValidator(val, values, enableEmpty) {
|
|
2822
3238
|
var _config$validator;
|
|
@@ -2984,7 +3400,15 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
2984
3400
|
return !!it.key;
|
|
2985
3401
|
}) : data;
|
|
2986
3402
|
(_this$props$onChange = (_this$props = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props, $data);
|
|
2987
|
-
|
|
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
|
+
}
|
|
2988
3412
|
});
|
|
2989
3413
|
|
|
2990
3414
|
return _this;
|
|
@@ -2993,13 +3417,14 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
2993
3417
|
_createClass(ParamForm, [{
|
|
2994
3418
|
key: "formItems",
|
|
2995
3419
|
get: function get() {
|
|
2996
|
-
var _this$ref$current$
|
|
2997
|
-
_this$ref$
|
|
2998
|
-
_this$props$
|
|
3420
|
+
var _this$ref$current$get2,
|
|
3421
|
+
_this$ref$current2,
|
|
3422
|
+
_this$props$initialVa2,
|
|
2999
3423
|
_this2 = this;
|
|
3000
3424
|
|
|
3001
|
-
var valueType = (_this$ref$current$
|
|
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;
|
|
3002
3426
|
var config = ParamTypeConfig[valueType];
|
|
3427
|
+
localStorage.setItem('__editParamModalWidth', String(config.modalWidth) || '0');
|
|
3003
3428
|
return [{
|
|
3004
3429
|
label: '所属分组',
|
|
3005
3430
|
name: 'parentId',
|
|
@@ -3110,7 +3535,7 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
3110
3535
|
return Promise.resolve();
|
|
3111
3536
|
}
|
|
3112
3537
|
}],
|
|
3113
|
-
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'
|
|
3114
3539
|
}, /*#__PURE__*/React.createElement(it.Comp, null));
|
|
3115
3540
|
}), this.props.onSubmit && /*#__PURE__*/React.createElement(Button, {
|
|
3116
3541
|
type: "primary",
|
|
@@ -3179,22 +3604,24 @@ var ParamFormModalEl = /*#__PURE__*/function (_PureComponent2) {
|
|
|
3179
3604
|
});
|
|
3180
3605
|
});
|
|
3181
3606
|
|
|
3607
|
+
_defineProperty(_assertThisInitialized(_this4), "width", localStorage.getItem('__editParamModalWidth'));
|
|
3608
|
+
|
|
3182
3609
|
return _this4;
|
|
3183
3610
|
}
|
|
3184
3611
|
|
|
3185
3612
|
_createClass(ParamFormModalEl, [{
|
|
3186
3613
|
key: "isEdit",
|
|
3187
3614
|
get: function get() {
|
|
3188
|
-
var _this$props$
|
|
3615
|
+
var _this$props$initialVa3;
|
|
3189
3616
|
|
|
3190
|
-
return Boolean((_this$props$
|
|
3617
|
+
return Boolean((_this$props$initialVa3 = this.props.initialValues) === null || _this$props$initialVa3 === void 0 ? void 0 : _this$props$initialVa3.$paramId);
|
|
3191
3618
|
}
|
|
3192
3619
|
}, {
|
|
3193
3620
|
key: "render",
|
|
3194
3621
|
value: function render() {
|
|
3195
3622
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
3196
3623
|
key: String(this.state.visible),
|
|
3197
|
-
width: 740,
|
|
3624
|
+
width: Number(this.width) || 740,
|
|
3198
3625
|
closable: false,
|
|
3199
3626
|
title: !this.isEdit ? '新增参数' : '修改参数',
|
|
3200
3627
|
visible: this.state.visible,
|