@signalplus/params-about 1.0.18 → 1.0.20-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 +2 -1
- package/lib/es/index.js +175 -6
- package/package.json +1 -1
package/index.d.ts
CHANGED
package/lib/es/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Bundle of @signalplus/params-about
|
|
3
|
-
* Generated: 2024-
|
|
4
|
-
* Version: 1.0.
|
|
3
|
+
* Generated: 2024-05-06
|
|
4
|
+
* Version: 1.0.20-alpha
|
|
5
5
|
* License: MIT
|
|
6
6
|
* Author: 2631541504@qq.com
|
|
7
7
|
*/
|
|
@@ -200,6 +200,7 @@ var ParamType;
|
|
|
200
200
|
ParamType[ParamType["HardLimitHandler"] = 15] = "HardLimitHandler";
|
|
201
201
|
ParamType[ParamType["InstrumentArray"] = 14] = "InstrumentArray";
|
|
202
202
|
ParamType[ParamType["OneWayHandler"] = 16] = "OneWayHandler";
|
|
203
|
+
ParamType[ParamType["TenorBucketHandlerList"] = 17] = "TenorBucketHandlerList";
|
|
203
204
|
})(ParamType || (ParamType = {}));
|
|
204
205
|
|
|
205
206
|
function _arrayWithHoles(arr) {
|
|
@@ -2201,7 +2202,7 @@ var OneWayHandlerList = /*#__PURE__*/function (_PureComponent) {
|
|
|
2201
2202
|
expiry: '',
|
|
2202
2203
|
oneWayMode: '',
|
|
2203
2204
|
optionType: 'Both',
|
|
2204
|
-
offloadRisk:
|
|
2205
|
+
offloadRisk: false
|
|
2205
2206
|
};
|
|
2206
2207
|
if (key) value[i][key] = val;else value[i] = _objectSpread2(_objectSpread2({}, value[i]), val);
|
|
2207
2208
|
(_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);
|
|
@@ -2216,7 +2217,7 @@ var OneWayHandlerList = /*#__PURE__*/function (_PureComponent) {
|
|
|
2216
2217
|
expiry: '',
|
|
2217
2218
|
oneWayMode: '',
|
|
2218
2219
|
optionType: 'Both',
|
|
2219
|
-
offloadRisk:
|
|
2220
|
+
offloadRisk: false
|
|
2220
2221
|
});
|
|
2221
2222
|
(_this$props$onChange2 = (_this$props2 = _this.props).onChange) === null || _this$props$onChange2 === void 0 ? void 0 : _this$props$onChange2.call(_this$props2, value);
|
|
2222
2223
|
(_this$props$onBlur = (_this$props3 = _this.props).onBlur) === null || _this$props$onBlur === void 0 ? void 0 : _this$props$onBlur.call(_this$props3);
|
|
@@ -2249,7 +2250,7 @@ var OneWayHandlerList = /*#__PURE__*/function (_PureComponent) {
|
|
|
2249
2250
|
expiry: '',
|
|
2250
2251
|
oneWayMode: '',
|
|
2251
2252
|
optionType: 'Both',
|
|
2252
|
-
offloadRisk:
|
|
2253
|
+
offloadRisk: false
|
|
2253
2254
|
});
|
|
2254
2255
|
return /*#__PURE__*/React.createElement("div", {
|
|
2255
2256
|
className: classNames('param-expiries-limit', {
|
|
@@ -2361,6 +2362,144 @@ var OneWayHandlerList = /*#__PURE__*/function (_PureComponent) {
|
|
|
2361
2362
|
return OneWayHandlerList;
|
|
2362
2363
|
}(PureComponent);
|
|
2363
2364
|
|
|
2365
|
+
var TenorBucketHandlerList = /*#__PURE__*/function (_PureComponent) {
|
|
2366
|
+
_inherits(TenorBucketHandlerList, _PureComponent);
|
|
2367
|
+
|
|
2368
|
+
var _super = _createSuper(TenorBucketHandlerList);
|
|
2369
|
+
|
|
2370
|
+
function TenorBucketHandlerList() {
|
|
2371
|
+
var _this;
|
|
2372
|
+
|
|
2373
|
+
_classCallCheck(this, TenorBucketHandlerList);
|
|
2374
|
+
|
|
2375
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2376
|
+
args[_key] = arguments[_key];
|
|
2377
|
+
}
|
|
2378
|
+
|
|
2379
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
2380
|
+
|
|
2381
|
+
_defineProperty(_assertThisInitialized(_this), "value", []);
|
|
2382
|
+
|
|
2383
|
+
_defineProperty(_assertThisInitialized(_this), "isEmptyItem", function (item) {
|
|
2384
|
+
return isEmpty(item.key) && isNullLike(item.value);
|
|
2385
|
+
});
|
|
2386
|
+
|
|
2387
|
+
_defineProperty(_assertThisInitialized(_this), "onChange", function (i, val, key) {
|
|
2388
|
+
var _this$props$onChange, _this$props;
|
|
2389
|
+
|
|
2390
|
+
var value = _toConsumableArray(_this.value);
|
|
2391
|
+
|
|
2392
|
+
if (!value[i]) value[i] = {
|
|
2393
|
+
key: ''
|
|
2394
|
+
};
|
|
2395
|
+
if (key) value[i][key] = val;else value[i] = _objectSpread2(_objectSpread2({}, value[i]), val);
|
|
2396
|
+
(_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.filter(function (it) {
|
|
2397
|
+
return !!it.key;
|
|
2398
|
+
}));
|
|
2399
|
+
});
|
|
2400
|
+
|
|
2401
|
+
_defineProperty(_assertThisInitialized(_this), "onAdd", function (i) {
|
|
2402
|
+
var _this$props$onChange2, _this$props2, _this$props$onBlur, _this$props3;
|
|
2403
|
+
|
|
2404
|
+
var value = _toConsumableArray(_this.value);
|
|
2405
|
+
|
|
2406
|
+
value.splice(i + 1, 0, {
|
|
2407
|
+
key: ''
|
|
2408
|
+
});
|
|
2409
|
+
(_this$props$onChange2 = (_this$props2 = _this.props).onChange) === null || _this$props$onChange2 === void 0 ? void 0 : _this$props$onChange2.call(_this$props2, value);
|
|
2410
|
+
(_this$props$onBlur = (_this$props3 = _this.props).onBlur) === null || _this$props$onBlur === void 0 ? void 0 : _this$props$onBlur.call(_this$props3);
|
|
2411
|
+
});
|
|
2412
|
+
|
|
2413
|
+
_defineProperty(_assertThisInitialized(_this), "onDel", function (i) {
|
|
2414
|
+
var _this$props$onChange3, _this$props4, _this$props$onBlur2, _this$props5;
|
|
2415
|
+
|
|
2416
|
+
var value = _toConsumableArray(_this.value);
|
|
2417
|
+
|
|
2418
|
+
value.splice(i, 1);
|
|
2419
|
+
(_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);
|
|
2420
|
+
(_this$props$onBlur2 = (_this$props5 = _this.props).onBlur) === null || _this$props$onBlur2 === void 0 ? void 0 : _this$props$onBlur2.call(_this$props5);
|
|
2421
|
+
});
|
|
2422
|
+
|
|
2423
|
+
return _this;
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
_createClass(TenorBucketHandlerList, [{
|
|
2427
|
+
key: "render",
|
|
2428
|
+
value: function render() {
|
|
2429
|
+
var _this$props$value,
|
|
2430
|
+
_this2 = this;
|
|
2431
|
+
|
|
2432
|
+
this.value = this.props.value || [];
|
|
2433
|
+
if (!this.value.length) this.value.push({
|
|
2434
|
+
key: ''
|
|
2435
|
+
});
|
|
2436
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
2437
|
+
className: classNames('param-expiries-limit', {
|
|
2438
|
+
readonly: this.props.readonly
|
|
2439
|
+
}, this.props.className),
|
|
2440
|
+
style: this.props.style
|
|
2441
|
+
}, this.props.readonly ? ((_this$props$value = this.props.value) === null || _this$props$value === void 0 ? void 0 : _this$props$value.length) ? this.value.filter(function (it) {
|
|
2442
|
+
return it.key;
|
|
2443
|
+
}).map(function (it, i) {
|
|
2444
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
2445
|
+
className: "param-expiries-limit-val",
|
|
2446
|
+
key: i
|
|
2447
|
+
}, it.key, ['Short', 'Long'].includes(it.key) ? ' Term' : '', /*#__PURE__*/React.createElement("span", {
|
|
2448
|
+
className: "param-expiries-limit-val-sep"
|
|
2449
|
+
}, "/"), !isNullLike(it.value) ? _this2.props.isPercentage ? "".concat(+Big(Number(it.value)).times(100), "%") : it.value : '-');
|
|
2450
|
+
}) : '-' : /*#__PURE__*/React.createElement("div", {
|
|
2451
|
+
className: "param-expiries-limit-inputs"
|
|
2452
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
2453
|
+
className: "param-expiries readonly"
|
|
2454
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
2455
|
+
className: "param-expiries-val"
|
|
2456
|
+
}, "Key")), /*#__PURE__*/React.createElement("div", {
|
|
2457
|
+
className: "param-number-range readonly"
|
|
2458
|
+
}, "Value"), /*#__PURE__*/React.createElement("div", {
|
|
2459
|
+
className: "param-arr-ops readonly"
|
|
2460
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
2461
|
+
className: "param-arr-ops readonly"
|
|
2462
|
+
}), this.value.map(function (it, i) {
|
|
2463
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
2464
|
+
key: i
|
|
2465
|
+
}, /*#__PURE__*/React.createElement(TextSelector, {
|
|
2466
|
+
multiple: false,
|
|
2467
|
+
value: [it.key || ''],
|
|
2468
|
+
onChange: function onChange(v) {
|
|
2469
|
+
return _this2.onChange(i, v[0] === '' ? undefined : v[0].split(' ')[0], 'key');
|
|
2470
|
+
},
|
|
2471
|
+
options: ['Daily', 'Short Term', 'Regular', 'Long Term']
|
|
2472
|
+
}), /*#__PURE__*/React.createElement(Num, {
|
|
2473
|
+
style: {
|
|
2474
|
+
height: 30,
|
|
2475
|
+
width: 180
|
|
2476
|
+
},
|
|
2477
|
+
value: it.value,
|
|
2478
|
+
onChange: function onChange(val) {
|
|
2479
|
+
return _this2.onChange(i, {
|
|
2480
|
+
value: val
|
|
2481
|
+
});
|
|
2482
|
+
},
|
|
2483
|
+
onBlur: _this2.props.onBlur,
|
|
2484
|
+
isPercentage: _this2.props.isPercentage
|
|
2485
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
2486
|
+
className: "param-arr-ops readonly"
|
|
2487
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
2488
|
+
className: "param-arr-ops"
|
|
2489
|
+
}, /*#__PURE__*/React.createElement(PlusOutlined, {
|
|
2490
|
+
className: "param-arr-ops-add",
|
|
2491
|
+
onClick: _this2.onAdd.bind(null, i)
|
|
2492
|
+
}), /*#__PURE__*/React.createElement(DeleteOutlined, {
|
|
2493
|
+
className: "param-arr-ops-del",
|
|
2494
|
+
onClick: _this2.onDel.bind(null, i)
|
|
2495
|
+
})));
|
|
2496
|
+
})));
|
|
2497
|
+
}
|
|
2498
|
+
}]);
|
|
2499
|
+
|
|
2500
|
+
return TenorBucketHandlerList;
|
|
2501
|
+
}(PureComponent);
|
|
2502
|
+
|
|
2364
2503
|
var _ParamTypeConfig;
|
|
2365
2504
|
|
|
2366
2505
|
function emptyErrText(index, key) {
|
|
@@ -2635,7 +2774,7 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
|
|
|
2635
2774
|
}
|
|
2636
2775
|
|
|
2637
2776
|
if (expiries.includes(val.expiry)) {
|
|
2638
|
-
return "The ".concat(i + 1, " ").concat(i === 0 ? 'st' : i === 1 ? 'nd' : i === 2 ? 'rd' : 'th', " expiry is same as the ").concat(expiries.indexOf(val.expiry), " ").concat(i === 0 ? 'st' : i === 1 ? 'nd' : i === 2 ? 'rd' : 'th');
|
|
2777
|
+
return "The ".concat(i + 1, " ").concat(i === 0 ? 'st' : i === 1 ? 'nd' : i === 2 ? 'rd' : 'th', " expiry is same as the ").concat(expiries.indexOf(val.expiry) + 1, " ").concat(i === 0 ? 'st' : i === 1 ? 'nd' : i === 2 ? 'rd' : 'th');
|
|
2639
2778
|
}
|
|
2640
2779
|
|
|
2641
2780
|
expiries.push(val.expiry);
|
|
@@ -2644,6 +2783,36 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
|
|
|
2644
2783
|
return '';
|
|
2645
2784
|
},
|
|
2646
2785
|
sort: 16
|
|
2786
|
+
}), _defineProperty(_ParamTypeConfig, ParamType.TenorBucketHandlerList, {
|
|
2787
|
+
name: 'TenorBucketHandlerList',
|
|
2788
|
+
key: 'tenorBucketHandlerList',
|
|
2789
|
+
Comp: TenorBucketHandlerList,
|
|
2790
|
+
validator: function validator($val) {
|
|
2791
|
+
if (!($val === null || $val === void 0 ? void 0 : $val.length)) return '';
|
|
2792
|
+
var keys = [];
|
|
2793
|
+
|
|
2794
|
+
for (var i = 0; i < $val.length; i++) {
|
|
2795
|
+
var val = $val[i];
|
|
2796
|
+
if (isEmpty(val.key) && isNullLike(val.value)) return '';
|
|
2797
|
+
|
|
2798
|
+
if (isNullLike(val.key) && !isNullLike(val.value)) {
|
|
2799
|
+
return emptyErrText(i, 'key');
|
|
2800
|
+
}
|
|
2801
|
+
|
|
2802
|
+
if (!isNullLike(val.key) && isNullLike(val.value)) {
|
|
2803
|
+
return emptyErrText(i, 'value');
|
|
2804
|
+
}
|
|
2805
|
+
|
|
2806
|
+
if (keys.includes(val.key)) {
|
|
2807
|
+
return "The ".concat(i + 1, " ").concat(i === 0 ? 'st' : i === 1 ? 'nd' : i === 2 ? 'rd' : 'th', " key is same as the ").concat(keys.indexOf(val.key) + 1, " ").concat(i === 0 ? 'st' : i === 1 ? 'nd' : i === 2 ? 'rd' : 'th');
|
|
2808
|
+
}
|
|
2809
|
+
|
|
2810
|
+
keys.push(val.key);
|
|
2811
|
+
}
|
|
2812
|
+
|
|
2813
|
+
return '';
|
|
2814
|
+
},
|
|
2815
|
+
sort: 17
|
|
2647
2816
|
}), _ParamTypeConfig);
|
|
2648
2817
|
function paramValidator(val, values, enableEmpty) {
|
|
2649
2818
|
var _config$validator;
|