@signalplus/params-about 1.0.23 → 1.0.25-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 +1 -1
- package/lib/es/index.js +99 -43
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -342,7 +342,7 @@ declare function numRangeValidator(val: {
|
|
|
342
342
|
min?: string;
|
|
343
343
|
max?: string;
|
|
344
344
|
}, enableEmpty?: boolean): string;
|
|
345
|
-
declare function expiryValidator(val: string, enableEmpty?: boolean): "Should not be empty" | ""
|
|
345
|
+
declare function expiryValidator(val: string, enableEmpty?: boolean): "Should not be empty" | "";
|
|
346
346
|
declare function expiriesValidator(val: string[]): string;
|
|
347
347
|
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
348
|
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-05-07
|
|
4
|
+
* Version: 1.0.25-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,
|
|
14
|
+
import { Select, Popover, Cascader, Input, 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';
|
|
@@ -293,16 +293,18 @@ function numRangeValidator(val, enableEmpty) {
|
|
|
293
293
|
}
|
|
294
294
|
function expiryValidator(val, enableEmpty) {
|
|
295
295
|
var error = emptyValidator(val, enableEmpty);
|
|
296
|
-
if (error) return error;
|
|
297
|
-
|
|
298
|
-
|
|
296
|
+
if (error) return error; // const $val = dayjs(val.replace(/([a-zA-Z]+)/, ' $1 '), 'D MMM YY')
|
|
297
|
+
// .format('DMMMYY')
|
|
298
|
+
// .toUpperCase();
|
|
299
|
+
// if ($val !== val && `0${$val}` !== val) return 'Out of format';
|
|
300
|
+
|
|
299
301
|
return '';
|
|
300
302
|
}
|
|
301
303
|
function expiriesValidator(val) {
|
|
302
304
|
if (!(val === null || val === void 0 ? void 0 : val.length)) return '';
|
|
303
305
|
|
|
304
306
|
for (var i = 0; i < val.length; i++) {
|
|
305
|
-
var error =
|
|
307
|
+
var error = emptyValidator(val[i]);
|
|
306
308
|
|
|
307
309
|
if (error) {
|
|
308
310
|
// return { [i]: error }
|
|
@@ -799,11 +801,8 @@ var Expiries = /*#__PURE__*/function (_PureComponent) {
|
|
|
799
801
|
return (_this$props$options = _this.props.options) === null || _this$props$options === void 0 ? void 0 : _this$props$options.includes(item);
|
|
800
802
|
})) || []);
|
|
801
803
|
|
|
802
|
-
if (_this.props.multiple !== false) {
|
|
803
|
-
|
|
804
|
-
return it === val;
|
|
805
|
-
});
|
|
806
|
-
if (index > -1) value.splice(index, 1);else value.push(val);
|
|
804
|
+
if (_this.props.multiple !== false || Array.isArray(val)) {
|
|
805
|
+
value = val;
|
|
807
806
|
} else {
|
|
808
807
|
value = [val];
|
|
809
808
|
}
|
|
@@ -862,37 +861,94 @@ var Expiries = /*#__PURE__*/function (_PureComponent) {
|
|
|
862
861
|
}, {
|
|
863
862
|
key: "render",
|
|
864
863
|
value: function render() {
|
|
865
|
-
var
|
|
866
|
-
|
|
864
|
+
var _this3 = this,
|
|
865
|
+
_this$props$options2;
|
|
867
866
|
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
placement: 'bottomLeft',
|
|
872
|
-
visible: !this.props.readonly && this.state.visible,
|
|
873
|
-
onVisibleChange: this.handleVisibleChange,
|
|
874
|
-
content: (_this$props$options2 = this.props.options) === null || _this$props$options2 === void 0 ? void 0 : _this$props$options2.map(function (it) {
|
|
875
|
-
var _this3$props$value, _this3$props$calcDisa, _this3$props, _this3$onChange;
|
|
867
|
+
for (var i = 0; i < 100000; i++) {
|
|
868
|
+
"".concat(i.toString(36)).concat(i);
|
|
869
|
+
}
|
|
876
870
|
|
|
877
|
-
|
|
878
|
-
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);
|
|
879
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
880
|
-
className: classNames('param-expiries-option', {
|
|
881
|
-
'param-expiries-option-checked': checked,
|
|
882
|
-
'param-expiries-option-disabled': disabled
|
|
883
|
-
}),
|
|
884
|
-
key: it,
|
|
885
|
-
onClick: disabled ? undefined : (_this3$onChange = _this3.onChange) === null || _this3$onChange === void 0 ? void 0 : _this3$onChange.bind(null, it)
|
|
886
|
-
}, it, checked && /*#__PURE__*/React.createElement(CheckOutlined, null));
|
|
887
|
-
})
|
|
888
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
871
|
+
return this.props.readonly ? /*#__PURE__*/React.createElement("div", {
|
|
889
872
|
className: classNames('param-expiries', {
|
|
890
873
|
readonly: this.props.readonly,
|
|
891
874
|
multiple: this.props.multiple !== false
|
|
892
|
-
}, this.props.className)
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
875
|
+
}, this.props.className)
|
|
876
|
+
}, this.renderValue()) :
|
|
877
|
+
/*#__PURE__*/
|
|
878
|
+
// <Popover
|
|
879
|
+
// overlayClassName="param-expiries-popover"
|
|
880
|
+
// trigger={'click'}
|
|
881
|
+
// placement={'bottomLeft'}
|
|
882
|
+
// visible={!this.props.readonly && this.state.visible}
|
|
883
|
+
// onVisibleChange={this.handleVisibleChange}
|
|
884
|
+
// content={this.props.options?.map((it) => {
|
|
885
|
+
// const checked = this.props.value?.includes(it);
|
|
886
|
+
// const disabled = this.props.calcDisabled?.(it);
|
|
887
|
+
// return (
|
|
888
|
+
// <div
|
|
889
|
+
// className={classNames('param-expiries-option', {
|
|
890
|
+
// 'param-expiries-option-checked': checked,
|
|
891
|
+
// 'param-expiries-option-disabled': disabled,
|
|
892
|
+
// })}
|
|
893
|
+
// key={it}
|
|
894
|
+
// onClick={disabled ? undefined : this.onChange?.bind(null, it)}
|
|
895
|
+
// >
|
|
896
|
+
// {it}
|
|
897
|
+
// {checked && <CheckOutlined />}
|
|
898
|
+
// </div>
|
|
899
|
+
// );
|
|
900
|
+
// })}
|
|
901
|
+
// >
|
|
902
|
+
// <div
|
|
903
|
+
// className={classNames(
|
|
904
|
+
// 'param-expiries',
|
|
905
|
+
// { readonly: this.props.readonly, multiple: this.props.multiple !== false },
|
|
906
|
+
// this.props.className,
|
|
907
|
+
// )}
|
|
908
|
+
// style={this.props.style}
|
|
909
|
+
// >
|
|
910
|
+
// {this.renderValue()}
|
|
911
|
+
// {!this.props.readonly && this.props.options && (
|
|
912
|
+
// <DownOutlined className="param-expiries-arrow" />
|
|
913
|
+
// )}
|
|
914
|
+
// </div>
|
|
915
|
+
// </Popover>
|
|
916
|
+
// <Select
|
|
917
|
+
// mode={this.props.multiple ? 'multiple' : undefined}
|
|
918
|
+
// style={{ width: '100%' }}
|
|
919
|
+
// placeholder="Choose"
|
|
920
|
+
// onSelect={(v: string) => this.onChange?.bind(null, v)}
|
|
921
|
+
// value={this.props.value}
|
|
922
|
+
// options={
|
|
923
|
+
// this.props.options?.map((expiry) => ({
|
|
924
|
+
// value: expiry,
|
|
925
|
+
// label: expiry,
|
|
926
|
+
// disabled: this.props.calcDisabled?.(expiry),
|
|
927
|
+
// })) || []
|
|
928
|
+
// }
|
|
929
|
+
// />
|
|
930
|
+
React.createElement("div", {
|
|
931
|
+
className: "param-expiries-select"
|
|
932
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
933
|
+
mode: this.props.multiple === false ? undefined : 'multiple',
|
|
934
|
+
style: {
|
|
935
|
+
width: '100%'
|
|
936
|
+
},
|
|
937
|
+
placeholder: "Choose",
|
|
938
|
+
value: this.props.value,
|
|
939
|
+
onChange: function onChange(values) {
|
|
940
|
+
var _this3$onChange;
|
|
941
|
+
|
|
942
|
+
return (_this3$onChange = _this3.onChange) === null || _this3$onChange === void 0 ? void 0 : _this3$onChange.call(_this3, values);
|
|
943
|
+
}
|
|
944
|
+
}, (_this$props$options2 = this.props.options) === null || _this$props$options2 === void 0 ? void 0 : _this$props$options2.map(function (option) {
|
|
945
|
+
var _this3$props$calcDisa, _this3$props;
|
|
946
|
+
|
|
947
|
+
return /*#__PURE__*/React.createElement(Select.Option, {
|
|
948
|
+
key: option,
|
|
949
|
+
value: option,
|
|
950
|
+
disabled: (_this3$props$calcDisa = (_this3$props = _this3.props).calcDisabled) === null || _this3$props$calcDisa === void 0 ? void 0 : _this3$props$calcDisa.call(_this3$props, option)
|
|
951
|
+
}, option);
|
|
896
952
|
})));
|
|
897
953
|
}
|
|
898
954
|
}]);
|
|
@@ -971,7 +1027,7 @@ var ExpiriesLimit = /*#__PURE__*/function (_PureComponent) {
|
|
|
971
1027
|
this.value = ((_this$props$value = this.props.value) === null || _this$props$value === void 0 ? void 0 : _this$props$value.filter(function (it) {
|
|
972
1028
|
return !isExpired(it.expiry);
|
|
973
1029
|
})) || [];
|
|
974
|
-
if (!this.value.length) this.value.push({
|
|
1030
|
+
if (!this.value.length && !this.props.readonly) this.value.push({
|
|
975
1031
|
expiry: ''
|
|
976
1032
|
});
|
|
977
1033
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -1130,7 +1186,7 @@ var ExpiriesValueList = /*#__PURE__*/function (_PureComponent) {
|
|
|
1130
1186
|
this.value = ((_this$props$value = this.props.value) === null || _this$props$value === void 0 ? void 0 : _this$props$value.filter(function (it) {
|
|
1131
1187
|
return !isExpired(it.expiry);
|
|
1132
1188
|
})) || [];
|
|
1133
|
-
if (!this.value.length) this.value.push({
|
|
1189
|
+
if (!this.value.length && !this.props.readonly) this.value.push({
|
|
1134
1190
|
expiry: ''
|
|
1135
1191
|
});
|
|
1136
1192
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -1443,7 +1499,7 @@ var InstrumentsValueList = /*#__PURE__*/function (_PureComponent) {
|
|
|
1443
1499
|
_this2 = this;
|
|
1444
1500
|
|
|
1445
1501
|
this.value = this.props.value || [];
|
|
1446
|
-
if (!this.value.length) this.value.push({
|
|
1502
|
+
if (!this.value.length && !this.props.readonly) this.value.push({
|
|
1447
1503
|
instrument: ''
|
|
1448
1504
|
});
|
|
1449
1505
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -2590,7 +2646,7 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
|
|
|
2590
2646
|
|
|
2591
2647
|
for (var i = 0; i < $val.length; i++) {
|
|
2592
2648
|
var val = $val[i];
|
|
2593
|
-
var error =
|
|
2649
|
+
var error = emptyValidator(val === null || val === void 0 ? void 0 : val.expiry);
|
|
2594
2650
|
if (isEmpty(val.expiry) && isNullLike(val.value)) return '';
|
|
2595
2651
|
|
|
2596
2652
|
if (error) {
|
|
@@ -2618,7 +2674,7 @@ var ParamTypeConfig = (_ParamTypeConfig = {}, _defineProperty(_ParamTypeConfig,
|
|
|
2618
2674
|
|
|
2619
2675
|
for (var i = 0; i < $val.length; i++) {
|
|
2620
2676
|
var val = $val[i];
|
|
2621
|
-
var error =
|
|
2677
|
+
var error = emptyValidator(val === null || val === void 0 ? void 0 : val.expiry);
|
|
2622
2678
|
|
|
2623
2679
|
if (error) {
|
|
2624
2680
|
// return { [i]: { expire: error } }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signalplus/params-about",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.25-alpha",
|
|
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": "^5.24.9",
|
|
52
52
|
"babel-plugin-istanbul": "^5.1.4",
|
|
53
53
|
"babel-preset-react-app": "^9.0.0",
|
|
54
54
|
"big.js": "^6.1.1",
|