tools-min-ns 1.9.0 → 1.9.2
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/README.md +8 -0
- package/esm/check/CheckUtil.d.ts +10 -3
- package/esm/check/CheckUtil.js +2 -4
- package/lib/check/CheckUtil.d.ts +10 -3
- package/lib/check/CheckUtil.js +2 -4
- package/package.json +1 -1
package/README.md
CHANGED
package/esm/check/CheckUtil.d.ts
CHANGED
|
@@ -101,11 +101,18 @@ declare namespace CheckUtil {
|
|
|
101
101
|
* @param type 类型
|
|
102
102
|
* @param options
|
|
103
103
|
*/
|
|
104
|
-
function getFormItemRules
|
|
104
|
+
function getFormItemRules(type: StrType, options?: {
|
|
105
105
|
label?: string;
|
|
106
106
|
required?: boolean;
|
|
107
107
|
errMsg?: string;
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
}): ({
|
|
109
|
+
required: boolean;
|
|
110
|
+
message: string;
|
|
111
|
+
validator?: undefined;
|
|
112
|
+
} | {
|
|
113
|
+
validator: (_: any, value: string, c: any) => Promise<void>;
|
|
114
|
+
required?: undefined;
|
|
115
|
+
message?: undefined;
|
|
116
|
+
})[];
|
|
110
117
|
}
|
|
111
118
|
export default CheckUtil;
|
package/esm/check/CheckUtil.js
CHANGED
|
@@ -489,15 +489,13 @@ var CheckUtil;
|
|
|
489
489
|
function getFormItemRules(type, options) {
|
|
490
490
|
var _this = this;
|
|
491
491
|
var msg = (options === null || options === void 0 ? void 0 : options.label) || STR_TYPE[type];
|
|
492
|
-
return __spreadArray(__spreadArray([], __read((options === null || options === void 0 ? void 0 : options.required)
|
|
492
|
+
return __spreadArray(__spreadArray([], __read((options === null || options === void 0 ? void 0 : options.required) ? [{
|
|
493
493
|
required: true,
|
|
494
494
|
message: "".concat(msg, "\u4E0D\u80FD\u4E3A\u7A7A")
|
|
495
495
|
}] : []), false), [{
|
|
496
496
|
validator: function validator(_, value, c) {
|
|
497
497
|
return __awaiter(_this, void 0, void 0, function () {
|
|
498
|
-
|
|
499
|
-
return __generator(this, function (_b) {
|
|
500
|
-
(_a = options === null || options === void 0 ? void 0 : options._validator) === null || _a === void 0 ? void 0 : _a.call(options, _, value, c);
|
|
498
|
+
return __generator(this, function (_a) {
|
|
501
499
|
if (!value || CheckUtil.checkAny(value, type)) return [2 /*return*/, Promise.resolve()];
|
|
502
500
|
if (type === 'LOGIN_NAME') {
|
|
503
501
|
return [2 /*return*/, Promise.reject(new Error((options === null || options === void 0 ? void 0 : options.errMsg) || "".concat(msg, "\u53EA\u5305\u542B\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u4E0B\u5212\u7EBF\u6216\u51CF\u53F7\uFF1B\u9996\u5B57\u6BCD\u5FC5\u987B\u4E3A\u5B57\u6BCD\uFF1B\u957F\u5EA6\u4E3A6-18\u4E2A\u5B57\u7B26\uFF1B\u4E0D\u80FD\u5305\u542B\u7279\u6B8A\u5B57\u7B26")))];
|
package/lib/check/CheckUtil.d.ts
CHANGED
|
@@ -101,11 +101,18 @@ declare namespace CheckUtil {
|
|
|
101
101
|
* @param type 类型
|
|
102
102
|
* @param options
|
|
103
103
|
*/
|
|
104
|
-
function getFormItemRules
|
|
104
|
+
function getFormItemRules(type: StrType, options?: {
|
|
105
105
|
label?: string;
|
|
106
106
|
required?: boolean;
|
|
107
107
|
errMsg?: string;
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
}): ({
|
|
109
|
+
required: boolean;
|
|
110
|
+
message: string;
|
|
111
|
+
validator?: undefined;
|
|
112
|
+
} | {
|
|
113
|
+
validator: (_: any, value: string, c: any) => Promise<void>;
|
|
114
|
+
required?: undefined;
|
|
115
|
+
message?: undefined;
|
|
116
|
+
})[];
|
|
110
117
|
}
|
|
111
118
|
export default CheckUtil;
|
package/lib/check/CheckUtil.js
CHANGED
|
@@ -499,15 +499,13 @@ var CheckUtil;
|
|
|
499
499
|
function getFormItemRules(type, options) {
|
|
500
500
|
var _this = this;
|
|
501
501
|
var msg = (options === null || options === void 0 ? void 0 : options.label) || common_1.STR_TYPE[type];
|
|
502
|
-
return __spreadArray(__spreadArray([], __read((options === null || options === void 0 ? void 0 : options.required)
|
|
502
|
+
return __spreadArray(__spreadArray([], __read((options === null || options === void 0 ? void 0 : options.required) ? [{
|
|
503
503
|
required: true,
|
|
504
504
|
message: "".concat(msg, "\u4E0D\u80FD\u4E3A\u7A7A")
|
|
505
505
|
}] : []), false), [{
|
|
506
506
|
validator: function validator(_, value, c) {
|
|
507
507
|
return __awaiter(_this, void 0, void 0, function () {
|
|
508
|
-
|
|
509
|
-
return __generator(this, function (_b) {
|
|
510
|
-
(_a = options === null || options === void 0 ? void 0 : options._validator) === null || _a === void 0 ? void 0 : _a.call(options, _, value, c);
|
|
508
|
+
return __generator(this, function (_a) {
|
|
511
509
|
if (!value || CheckUtil.checkAny(value, type)) return [2 /*return*/, Promise.resolve()];
|
|
512
510
|
if (type === 'LOGIN_NAME') {
|
|
513
511
|
return [2 /*return*/, Promise.reject(new Error((options === null || options === void 0 ? void 0 : options.errMsg) || "".concat(msg, "\u53EA\u5305\u542B\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u4E0B\u5212\u7EBF\u6216\u51CF\u53F7\uFF1B\u9996\u5B57\u6BCD\u5FC5\u987B\u4E3A\u5B57\u6BCD\uFF1B\u957F\u5EA6\u4E3A6-18\u4E2A\u5B57\u7B26\uFF1B\u4E0D\u80FD\u5305\u542B\u7279\u6B8A\u5B57\u7B26")))];
|