@signalplus/params-about 0.1.26 → 0.1.29
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 +18 -6
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -77,6 +77,7 @@ interface ParamFormData {
|
|
|
77
77
|
}
|
|
78
78
|
interface ParamFormProps {
|
|
79
79
|
parentOptions: ParentSelectorProps['parentOptions'];
|
|
80
|
+
allKeys: string[];
|
|
80
81
|
expiriesOptions: string[];
|
|
81
82
|
initialValues?: Partial<ParamFormData>;
|
|
82
83
|
groupEditable?: boolean;
|
|
@@ -308,7 +309,7 @@ declare function numRangeValidator(val: {
|
|
|
308
309
|
}, enableEmpty?: boolean): string;
|
|
309
310
|
declare function expiryValidator(val: string, enableEmpty?: boolean): "Should not be empty" | "" | "Out of format";
|
|
310
311
|
declare function expiriesValidator(val: string[]): string;
|
|
311
|
-
declare function keyValidator(val: string): "Should not be empty" | "" | "Out of format: should be a combination of the following chars `_.0-9a-zA-Z`";
|
|
312
|
+
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";
|
|
312
313
|
declare function isExpired(val?: string): boolean;
|
|
313
314
|
declare function validatorCvt(validator: (val: any, values: any) => ValidateInfo['string'], form?: () => any): (_: any, val: any) => Promise<any>;
|
|
314
315
|
|
package/lib/es/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Bundle of @signalplus/params-about
|
|
3
3
|
* Generated: 2022-04-12
|
|
4
|
-
* Version: 0.1.
|
|
4
|
+
* Version: 0.1.29
|
|
5
5
|
* License: MIT
|
|
6
6
|
* Author: 2631541504@qq.com
|
|
7
7
|
*/
|
|
@@ -409,10 +409,19 @@ function expiriesValidator(val) {
|
|
|
409
409
|
|
|
410
410
|
return '';
|
|
411
411
|
}
|
|
412
|
-
function keyValidator(val) {
|
|
412
|
+
function keyValidator(val, allKeys) {
|
|
413
413
|
var error = emptyValidator(val);
|
|
414
414
|
if (error) return error;
|
|
415
|
-
|
|
415
|
+
|
|
416
|
+
if (!/^[_.a-zA-Z0-9]+$/.test(val)) {
|
|
417
|
+
return 'Out of format: should be a combination of the following chars `_.0-9a-zA-Z`';
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
var has = allKeys.some(function (it) {
|
|
421
|
+
return val === it;
|
|
422
|
+
});
|
|
423
|
+
if (has) return 'This key has been used';
|
|
424
|
+
return '';
|
|
416
425
|
}
|
|
417
426
|
function isExpired(val) {
|
|
418
427
|
if (!val) return false;
|
|
@@ -790,9 +799,10 @@ var TextArray = /*#__PURE__*/function (_PureComponent) {
|
|
|
790
799
|
_createClass(TextArray, [{
|
|
791
800
|
key: "render",
|
|
792
801
|
value: function render() {
|
|
793
|
-
var
|
|
802
|
+
var _this$props$value,
|
|
803
|
+
_this2 = this;
|
|
794
804
|
|
|
795
|
-
this.value = this.props.value || [];
|
|
805
|
+
this.value = ((_this$props$value = this.props.value) === null || _this$props$value === void 0 ? void 0 : _this$props$value.slice()) || [];
|
|
796
806
|
if (!this.value.length) this.value.push('');
|
|
797
807
|
return /*#__PURE__*/React.createElement("div", {
|
|
798
808
|
className: classNames('param-text-array', {
|
|
@@ -1402,7 +1412,9 @@ var ParamForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
1402
1412
|
}, props));
|
|
1403
1413
|
},
|
|
1404
1414
|
required: true,
|
|
1405
|
-
validator: validatorCvt(
|
|
1415
|
+
validator: validatorCvt(function (val) {
|
|
1416
|
+
return keyValidator(val, _this2.props.allKeys);
|
|
1417
|
+
})
|
|
1406
1418
|
}, {
|
|
1407
1419
|
label: '参数名称',
|
|
1408
1420
|
name: 'name',
|