@stemy/ngx-dynamic-form 10.2.24 → 10.2.25
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/bundles/stemy-ngx-dynamic-form.umd.js +121 -33
- package/bundles/stemy-ngx-dynamic-form.umd.js.map +1 -1
- package/bundles/stemy-ngx-dynamic-form.umd.min.js +1 -15
- package/bundles/stemy-ngx-dynamic-form.umd.min.js.map +1 -1
- package/esm2015/ngx-dynamic-form/ngx-dynamic-form.module.js +15 -8
- package/esm2015/ngx-dynamic-form/services/dynamic-form.service.js +34 -11
- package/esm2015/ngx-dynamic-form/utils/validators.js +29 -1
- package/esm2015/stemy-ngx-dynamic-form.js +4 -3
- package/fesm2015/stemy-ngx-dynamic-form.js +74 -16
- package/fesm2015/stemy-ngx-dynamic-form.js.map +1 -1
- package/ngx-dynamic-form/services/dynamic-form.service.d.ts +2 -0
- package/ngx-dynamic-form/utils/validators.d.ts +5 -1
- package/package.json +1 -1
- package/stemy-ngx-dynamic-form.d.ts +3 -2
- package/stemy-ngx-dynamic-form.metadata.json +1 -1
|
@@ -163,9 +163,37 @@
|
|
|
163
163
|
return Promise.resolve(null);
|
|
164
164
|
var phoneRegexp = /^(?:\d){10,12}$/;
|
|
165
165
|
return phoneRegexp.test(value) ? null : { phone: true };
|
|
166
|
+
}
|
|
167
|
+
function validateItemsMinLength(minLength) {
|
|
168
|
+
return function (control) {
|
|
169
|
+
var value = control.value;
|
|
170
|
+
return (Array.isArray(value) && value.every(function (v) { return typeof v == "string" && v.length >= minLength; }))
|
|
171
|
+
? null : { itemsMinLength: minLength };
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
function validateItemsMaxLength(maxLength) {
|
|
175
|
+
return function (control) {
|
|
176
|
+
var value = control.value;
|
|
177
|
+
return (Array.isArray(value) && value.every(function (v) { return typeof v == "string" && v.length <= maxLength; }))
|
|
178
|
+
? null : { itemsMaxLength: maxLength };
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function validateItemsMinValue(min) {
|
|
182
|
+
return function (control) {
|
|
183
|
+
var value = control.value;
|
|
184
|
+
return (Array.isArray(value) && value.every(function (v) { return typeof v == "number" && v >= min; }))
|
|
185
|
+
? null : { itemsMinValue: min };
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
function validateItemsMaxValue(max) {
|
|
189
|
+
return function (control) {
|
|
190
|
+
var value = control.value;
|
|
191
|
+
return (Array.isArray(value) && value.every(function (v) { return typeof v == "number" && v <= max; }))
|
|
192
|
+
? null : { itemsMaxValue: max };
|
|
193
|
+
};
|
|
166
194
|
}
|
|
167
195
|
|
|
168
|
-
|
|
196
|
+
/******************************************************************************
|
|
169
197
|
Copyright (c) Microsoft Corporation.
|
|
170
198
|
|
|
171
199
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -189,6 +217,8 @@
|
|
|
189
217
|
return extendStatics(d, b);
|
|
190
218
|
};
|
|
191
219
|
function __extends(d, b) {
|
|
220
|
+
if (typeof b !== "function" && b !== null)
|
|
221
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
192
222
|
extendStatics(d, b);
|
|
193
223
|
function __() { this.constructor = d; }
|
|
194
224
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -325,7 +355,11 @@
|
|
|
325
355
|
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
326
356
|
if (k2 === undefined)
|
|
327
357
|
k2 = k;
|
|
328
|
-
Object.
|
|
358
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
359
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
360
|
+
desc = { enumerable: true, get: function () { return m[k]; } };
|
|
361
|
+
}
|
|
362
|
+
Object.defineProperty(o, k2, desc);
|
|
329
363
|
}) : (function (o, m, k, k2) {
|
|
330
364
|
if (k2 === undefined)
|
|
331
365
|
k2 = k;
|
|
@@ -374,11 +408,13 @@
|
|
|
374
408
|
}
|
|
375
409
|
return ar;
|
|
376
410
|
}
|
|
411
|
+
/** @deprecated */
|
|
377
412
|
function __spread() {
|
|
378
413
|
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
379
414
|
ar = ar.concat(__read(arguments[i]));
|
|
380
415
|
return ar;
|
|
381
416
|
}
|
|
417
|
+
/** @deprecated */
|
|
382
418
|
function __spreadArrays() {
|
|
383
419
|
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
384
420
|
s += arguments[i].length;
|
|
@@ -387,7 +423,17 @@
|
|
|
387
423
|
r[k] = a[j];
|
|
388
424
|
return r;
|
|
389
425
|
}
|
|
390
|
-
|
|
426
|
+
function __spreadArray(to, from, pack) {
|
|
427
|
+
if (pack || arguments.length === 2)
|
|
428
|
+
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
429
|
+
if (ar || !(i in from)) {
|
|
430
|
+
if (!ar)
|
|
431
|
+
ar = Array.prototype.slice.call(from, 0, i);
|
|
432
|
+
ar[i] = from[i];
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
436
|
+
}
|
|
391
437
|
function __await(v) {
|
|
392
438
|
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
393
439
|
}
|
|
@@ -452,18 +498,26 @@
|
|
|
452
498
|
function __importDefault(mod) {
|
|
453
499
|
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
454
500
|
}
|
|
455
|
-
function __classPrivateFieldGet(receiver,
|
|
456
|
-
if (!
|
|
457
|
-
throw new TypeError("
|
|
458
|
-
|
|
459
|
-
|
|
501
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
502
|
+
if (kind === "a" && !f)
|
|
503
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
504
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
505
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
506
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
460
507
|
}
|
|
461
|
-
function __classPrivateFieldSet(receiver,
|
|
462
|
-
if (
|
|
463
|
-
throw new TypeError("
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
508
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
509
|
+
if (kind === "m")
|
|
510
|
+
throw new TypeError("Private method is not writable");
|
|
511
|
+
if (kind === "a" && !f)
|
|
512
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
513
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
514
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
515
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
516
|
+
}
|
|
517
|
+
function __classPrivateFieldIn(state, receiver) {
|
|
518
|
+
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
|
|
519
|
+
throw new TypeError("Cannot use 'in' operator on non-object");
|
|
520
|
+
return typeof state === "function" ? receiver === state : state.has(receiver);
|
|
467
521
|
}
|
|
468
522
|
|
|
469
523
|
var FormSubject = /** @class */ (function (_super) {
|
|
@@ -814,6 +868,7 @@
|
|
|
814
868
|
inputType = "number";
|
|
815
869
|
break;
|
|
816
870
|
}
|
|
871
|
+
var sub = property.type == "array" ? property.items || property : property;
|
|
817
872
|
return Object.assign(this.getFormControlConfig(property, schema), {
|
|
818
873
|
inputType: inputType,
|
|
819
874
|
autoComplete: property.autoComplete || "off",
|
|
@@ -821,9 +876,9 @@
|
|
|
821
876
|
accept: ngxUtils.ObjectUtils.isString(property.accept) ? property.accept : null,
|
|
822
877
|
mask: ngxUtils.ObjectUtils.isString(property.mask) ? property.mask : null,
|
|
823
878
|
pattern: ngxUtils.ObjectUtils.isString(property.pattern) ? property.pattern : null,
|
|
824
|
-
step: isNaN(property.step) ? 1 : property.step,
|
|
825
|
-
min: isNaN(
|
|
826
|
-
max: isNaN(
|
|
879
|
+
step: isNaN(sub.step) ? (isNaN(property.step) ? 1 : property.step) : sub.step,
|
|
880
|
+
min: isNaN(sub.minimum) ? (isNaN(sub.minLength) ? Number.MIN_SAFE_INTEGER : sub.minLength) : sub.minimum,
|
|
881
|
+
max: isNaN(sub.maximum) ? (isNaN(sub.maxLength) ? Number.MAX_SAFE_INTEGER : sub.maxLength) : sub.maximum
|
|
827
882
|
});
|
|
828
883
|
};
|
|
829
884
|
DynamicFormService.prototype.getFormTextareaConfig = function (property, schema) {
|
|
@@ -957,24 +1012,46 @@
|
|
|
957
1012
|
if (ngxUtils.ObjectUtils.isArray(schema.required) && schema.required.indexOf(property.id) >= 0) {
|
|
958
1013
|
validators.required = null;
|
|
959
1014
|
}
|
|
960
|
-
|
|
1015
|
+
this.addPropertyValidators(validators, property);
|
|
1016
|
+
this.addItemsValidators(validators, property.items);
|
|
1017
|
+
return validators;
|
|
1018
|
+
};
|
|
1019
|
+
DynamicFormService.prototype.addPropertyValidators = function (validators, property) {
|
|
1020
|
+
if (!property)
|
|
1021
|
+
return;
|
|
1022
|
+
if (!isNaN(property.minLength)) {
|
|
961
1023
|
validators.minLength = property.minLength;
|
|
962
1024
|
}
|
|
963
|
-
if (property.maxLength) {
|
|
1025
|
+
if (!isNaN(property.maxLength)) {
|
|
964
1026
|
validators.maxLength = property.maxLength;
|
|
965
1027
|
}
|
|
966
|
-
if (property.
|
|
967
|
-
validators.min = property.
|
|
1028
|
+
if (!isNaN(property.minimum)) {
|
|
1029
|
+
validators.min = property.minimum;
|
|
968
1030
|
}
|
|
969
|
-
if (property.
|
|
970
|
-
validators.max = property.
|
|
1031
|
+
if (!isNaN(property.maximum)) {
|
|
1032
|
+
validators.max = property.maximum;
|
|
971
1033
|
}
|
|
972
1034
|
switch (property.format) {
|
|
973
1035
|
case "email":
|
|
974
1036
|
validators.email = null;
|
|
975
1037
|
break;
|
|
976
1038
|
}
|
|
977
|
-
|
|
1039
|
+
};
|
|
1040
|
+
DynamicFormService.prototype.addItemsValidators = function (validators, items) {
|
|
1041
|
+
if (!items)
|
|
1042
|
+
return;
|
|
1043
|
+
if (!isNaN(items.minLength)) {
|
|
1044
|
+
validators.itemsMinLength = items.minLength;
|
|
1045
|
+
}
|
|
1046
|
+
if (!isNaN(items.maxLength)) {
|
|
1047
|
+
validators.itemsMaxLength = items.maxLength;
|
|
1048
|
+
}
|
|
1049
|
+
if (!isNaN(items.minimum)) {
|
|
1050
|
+
validators.itemsMinValue = items.minimum;
|
|
1051
|
+
}
|
|
1052
|
+
if (!isNaN(items.maximum)) {
|
|
1053
|
+
validators.itemsMaxValue = items.maximum;
|
|
1054
|
+
}
|
|
978
1055
|
};
|
|
979
1056
|
return DynamicFormService;
|
|
980
1057
|
}(core.DynamicFormService));
|
|
@@ -1369,10 +1446,14 @@
|
|
|
1369
1446
|
];
|
|
1370
1447
|
// --- Pipes ---
|
|
1371
1448
|
var pipes = [];
|
|
1372
|
-
var ɵ0$1 = validateJSON, ɵ1 = validateRequiredTranslation, ɵ2 =
|
|
1373
|
-
["
|
|
1374
|
-
["
|
|
1375
|
-
["
|
|
1449
|
+
var ɵ0$1 = validateJSON, ɵ1 = validateRequiredTranslation, ɵ2 = validateItemsMinLength, ɵ3 = validateItemsMaxLength, ɵ4 = validateItemsMinValue, ɵ5 = validateItemsMaxValue, ɵ6 = new Map([
|
|
1450
|
+
["json", validateJSON],
|
|
1451
|
+
["requiredTranslation", validateRequiredTranslation],
|
|
1452
|
+
["phone", validatePhone],
|
|
1453
|
+
["itemsMinLength", validateItemsMinLength],
|
|
1454
|
+
["itemsMaxLength", validateItemsMaxLength],
|
|
1455
|
+
["itemsMinValue", validateItemsMinValue],
|
|
1456
|
+
["itemsMaxValue", validateItemsMaxValue],
|
|
1376
1457
|
]);
|
|
1377
1458
|
var NgxDynamicFormModule = /** @class */ (function () {
|
|
1378
1459
|
function NgxDynamicFormModule() {
|
|
@@ -1415,9 +1496,12 @@
|
|
|
1415
1496
|
{ provide: forms.NG_VALIDATORS, useValue: ɵ0$1, multi: true },
|
|
1416
1497
|
{ provide: forms.NG_VALIDATORS, useValue: ɵ1, multi: true },
|
|
1417
1498
|
{ provide: forms.NG_VALIDATORS, useValue: ɵ2, multi: true },
|
|
1499
|
+
{ provide: forms.NG_VALIDATORS, useValue: ɵ3, multi: true },
|
|
1500
|
+
{ provide: forms.NG_VALIDATORS, useValue: ɵ4, multi: true },
|
|
1501
|
+
{ provide: forms.NG_VALIDATORS, useValue: ɵ5, multi: true },
|
|
1418
1502
|
{
|
|
1419
1503
|
provide: core.DYNAMIC_VALIDATORS,
|
|
1420
|
-
useValue: ɵ
|
|
1504
|
+
useValue: ɵ6
|
|
1421
1505
|
}
|
|
1422
1506
|
])
|
|
1423
1507
|
},] }
|
|
@@ -1453,10 +1537,14 @@
|
|
|
1453
1537
|
exports.validateJSON = validateJSON;
|
|
1454
1538
|
exports.validatePhone = validatePhone;
|
|
1455
1539
|
exports.validateRequiredTranslation = validateRequiredTranslation;
|
|
1456
|
-
exports.ɵa =
|
|
1457
|
-
exports.ɵb =
|
|
1458
|
-
exports.ɵc =
|
|
1459
|
-
exports.ɵd =
|
|
1540
|
+
exports.ɵa = validateItemsMinLength;
|
|
1541
|
+
exports.ɵb = validateItemsMaxLength;
|
|
1542
|
+
exports.ɵc = validateItemsMinValue;
|
|
1543
|
+
exports.ɵd = validateItemsMaxValue;
|
|
1544
|
+
exports.ɵe = components;
|
|
1545
|
+
exports.ɵf = directives;
|
|
1546
|
+
exports.ɵg = pipes;
|
|
1547
|
+
exports.ɵh = DynamicFormValidationService;
|
|
1460
1548
|
|
|
1461
1549
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1462
1550
|
|