@acorex/components 16.0.7 → 16.0.9
Sign up to get free protection for your applications and to get access to all the features.
@@ -47,14 +47,21 @@ export class AXValidationRuleComponent {
|
|
47
47
|
return new Promise((resolve) => {
|
48
48
|
switch (type) {
|
49
49
|
case 'required':
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
value != ''
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
50
|
+
if (typeof value === 'string') {
|
51
|
+
resolve({
|
52
|
+
message: message || AXTranslator.get('validation.messages.required'),
|
53
|
+
result: value.trim() != '',
|
54
|
+
});
|
55
|
+
}
|
56
|
+
else {
|
57
|
+
resolve({
|
58
|
+
message: message || AXTranslator.get('validation.messages.required'),
|
59
|
+
result: value != null &&
|
60
|
+
value != '' &&
|
61
|
+
(!Array.isArray(value) ||
|
62
|
+
(Array.isArray(value) && value.length > 0)),
|
63
|
+
});
|
64
|
+
}
|
58
65
|
break;
|
59
66
|
case 'regex':
|
60
67
|
const ex = new RegExp(ruleValue);
|
@@ -118,4 +125,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
118
125
|
}], enabled: [{
|
119
126
|
type: Input
|
120
127
|
}] } });
|
121
|
-
//# sourceMappingURL=data:application/json;base64,
|
128
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsaWRhdGlvbi1ydWxlLndpZGdldC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvY29tcG9uZW50cy9zcmMvbGliL3ZhbGlkYXRpb24vdmFsaWRhdGlvbi1ydWxlLndpZGdldC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sY0FBYyxDQUFDO0FBQzVDLE9BQU8sRUFBRSxTQUFTLEVBQUUsVUFBVSxFQUFFLE1BQU0sRUFBRSxLQUF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XNBcnJheSh2YWx1ZSkgfHxcbiAgICAgICAgICAgICAgICAgIChBcnJheS5pc0FycmF5KHZhbHVlKSAmJiB2YWx1ZS5sZW5ndGggPiAwKSksXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSAncmVnZXgnOlxuICAgICAgICAgIGNvbnN0IGV4ID0gbmV3IFJlZ0V4cChydWxlVmFsdWUpO1xuICAgICAgICAgIHJlc29sdmUoe1xuICAgICAgICAgICAgbWVzc2FnZTogbWVzc2FnZSB8fCBBWFRyYW5zbGF0b3IuZ2V0KCd2YWxpZGF0aW9uLm1lc3NhZ2VzLnJlZ2V4JyksXG4gICAgICAgICAgICByZXN1bHQ6IGV4LnRlc3QodmFsdWUpLFxuICAgICAgICAgIH0pO1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlICdjdXN0b20nOlxuICAgICAgICBjYXNlICdjYWxsYmFjayc6XG4gICAgICAgICAgaWYgKHR5cGVvZiBydWxlVmFsdWUgPT09ICdmdW5jdGlvbicpIHtcbiAgICAgICAgICAgIGNvbnN0IHJlczogYW55ID0ge307XG4gICAgICAgICAgICByZXMubWVzc2FnZSA9IG1lc3NhZ2U7XG4gICAgICAgICAgICBjb25zdCB2YWwgPSBydWxlVmFsdWUoeyB2YWx1ZSwgbWVzc2FnZSB9KTtcbiAgICAgICAgICAgIGlmICh2YWwgaW5zdGFuY2VvZiBQcm9taXNlKSB7XG4gICAgICAgICAgICAgIHZhbFxuICAgICAgICAgICAgICAgIC50aGVuKChjKSA9PiB7XG4gICAgICAgICAgICAgICAgICByZXMucmVzdWx0ID0gYztcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgIC5jYXRjaCgoYykgPT4ge1xuICAgICAgICAgICAgICAgICAgcmVzLnJlc3VsdCA9IGZhbHNlO1xuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgLmZpbmFsbHkoKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgcmVzb2x2ZShyZXMpO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgcmVzLnJlc3VsdCA9IHZhbDtcbiAgICAgICAgICAgICAgcmVzb2x2ZShyZXMpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXNvbHZlKHsgcmVzdWx0OiB0cnVlIH0pO1xuICAgICAgICAgIH1cbiAgICAgICAgICBicmVhaztcbiAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICByZXNvbHZlKHsgcmVzdWx0OiB0cnVlIH0pO1xuICAgICAgfVxuICAgIH0pO1xuICB9XG59XG4iXX0=
|
@@ -71,14 +71,21 @@ class AXValidationRuleComponent {
|
|
71
71
|
return new Promise((resolve) => {
|
72
72
|
switch (type) {
|
73
73
|
case 'required':
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
value != ''
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
74
|
+
if (typeof value === 'string') {
|
75
|
+
resolve({
|
76
|
+
message: message || AXTranslator.get('validation.messages.required'),
|
77
|
+
result: value.trim() != '',
|
78
|
+
});
|
79
|
+
}
|
80
|
+
else {
|
81
|
+
resolve({
|
82
|
+
message: message || AXTranslator.get('validation.messages.required'),
|
83
|
+
result: value != null &&
|
84
|
+
value != '' &&
|
85
|
+
(!Array.isArray(value) ||
|
86
|
+
(Array.isArray(value) && value.length > 0)),
|
87
|
+
});
|
88
|
+
}
|
82
89
|
break;
|
83
90
|
case 'regex':
|
84
91
|
const ex = new RegExp(ruleValue);
|