@muziehdesign/forms 0.0.1-348 → 0.0.1-372
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/esm2020/lib/masks.mjs +9 -1
- package/esm2020/lib/ngform-model-state.mjs +19 -2
- package/fesm2015/muziehdesign-forms.mjs +41 -15
- package/fesm2015/muziehdesign-forms.mjs.map +1 -1
- package/fesm2020/muziehdesign-forms.mjs +27 -2
- package/fesm2020/muziehdesign-forms.mjs.map +1 -1
- package/lib/masks.d.ts +8 -0
- package/lib/ngform-model-state.d.ts +3 -0
- package/package.json +1 -1
package/esm2020/lib/masks.mjs
CHANGED
|
@@ -57,4 +57,12 @@ export const currencyOptions = {
|
|
|
57
57
|
},
|
|
58
58
|
},
|
|
59
59
|
};
|
|
60
|
-
|
|
60
|
+
export const integerOptions = {
|
|
61
|
+
mask: Number,
|
|
62
|
+
scale: 0,
|
|
63
|
+
thousandsSeparator: ',',
|
|
64
|
+
padFractionalZeros: true,
|
|
65
|
+
radix: '.',
|
|
66
|
+
mapToRadix: ['.'],
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFza3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9tdXppZWhkZXNpZ24vZm9ybXMvc3JjL2xpYi9tYXNrcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsTUFBTSxFQUFFLE9BQU8sRUFBRSxLQUFLLEVBQUUsTUFBTSxVQUFVLENBQUM7QUFDbEQsT0FBTyxLQUFLLEtBQUssTUFBTSxPQUFPLENBQUM7QUFFL0IsTUFBTSxDQUFDLE1BQU0sZUFBZSxHQUFHO0lBQzdCLElBQUksRUFBRSxZQUFZO0lBQ2xCLE1BQU0sRUFBRSxDQUFDLElBQXNCLEVBQVUsRUFBRT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FxufTtcblxuZXhwb3J0IGNvbnN0IHBob25lTnVtYmVyT3B0aW9ucyA9IHtcbiAgbWFzazogJygwMDApIDAwMC0wMDAwJyxcbn07XG5cbmV4cG9ydCBjb25zdCBjdXJyZW5jeU9wdGlvbnMgPSB7XG4gIG1hc2s6ICdudW0nLFxuICBsYXp5OiBmYWxzZSxcbiAgYmxvY2tzOiB7XG4gICAgbnVtOiB7XG4gICAgICBtYXNrOiBOdW1iZXIsXG4gICAgICBzY2FsZTogMixcbiAgICAgIHRob3VzYW5kc1NlcGFyYXRvcjogJywnLFxuICAgICAgcGFkRnJhY3Rpb25hbFplcm9zOiB0cnVlLFxuICAgICAgcmFkaXg6ICcuJyxcbiAgICAgIG1hcFRvUmFkaXg6IFsnLiddLFxuICAgIH0sXG4gIH0sXG59O1xuXG5leHBvcnQgY29uc3QgaW50ZWdlck9wdGlvbnMgPSB7XG4gIG1hc2s6IE51bWJlcixcbiAgc2NhbGU6IDAsXG4gIHRob3VzYW5kc1NlcGFyYXRvcjogJywnLFxuICBwYWRGcmFjdGlvbmFsWmVyb3M6IHRydWUsXG4gIHJhZGl4OiAnLicsXG4gIG1hcFRvUmFkaXg6IFsnLiddLFxufTsiXX0=
|
|
@@ -16,13 +16,31 @@ export class NgFormModelState {
|
|
|
16
16
|
getCurrent() {
|
|
17
17
|
return this.changesSubject.value;
|
|
18
18
|
}
|
|
19
|
+
setState(model, errors) {
|
|
20
|
+
const state = {
|
|
21
|
+
model: model,
|
|
22
|
+
errors: errors,
|
|
23
|
+
valid: errors.length === 0,
|
|
24
|
+
};
|
|
25
|
+
this.setStateInternal(state);
|
|
26
|
+
}
|
|
19
27
|
setErrors(errors) {
|
|
20
28
|
//this.errors.next(errors);
|
|
21
29
|
throw new Error('needs implementation');
|
|
22
30
|
}
|
|
31
|
+
appendErrors(errors, skipEmit) {
|
|
32
|
+
const allErrors = [...(this.changesSubject.value?.errors || []), ...errors];
|
|
33
|
+
const state = { ...this.changesSubject.value };
|
|
34
|
+
state.errors = allErrors;
|
|
35
|
+
this.setStateInternal(state);
|
|
36
|
+
}
|
|
23
37
|
async validate() {
|
|
24
38
|
const model = this.form.value;
|
|
25
39
|
const state = await this.runValidations(model, this.options?.onValidate);
|
|
40
|
+
this.setStateInternal(state);
|
|
41
|
+
return state;
|
|
42
|
+
}
|
|
43
|
+
setStateInternal(state) {
|
|
26
44
|
this.deleteFormErrors();
|
|
27
45
|
const grouped = state.errors.reduce((grouped, v) => grouped.set(v.path, [...(grouped.get(v.path) || []), v]), new Map());
|
|
28
46
|
grouped.forEach((value, path) => {
|
|
@@ -37,7 +55,6 @@ export class NgFormModelState {
|
|
|
37
55
|
}
|
|
38
56
|
});
|
|
39
57
|
this.changesSubject.next(state);
|
|
40
|
-
return state;
|
|
41
58
|
}
|
|
42
59
|
deleteFormErrors() {
|
|
43
60
|
this.deleteErrors(this.form.form);
|
|
@@ -85,4 +102,4 @@ export class NgFormModelState {
|
|
|
85
102
|
};
|
|
86
103
|
}
|
|
87
104
|
}
|
|
88
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmdmb3JtLW1vZGVsLXN0YXRlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvbXV6aWVoZGVzaWduL2Zvcm1zL3NyYy9saWIvbmdmb3JtLW1vZGVsLXN0YXRlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBbUIsU0FBUyxFQUFFLFNBQVMsRUFBMEMsTUFBTSxnQkFBZ0IsQ0FBQztBQUMvRyxPQUFPLEVBQUUsZUFBZSxFQUF3QixJQUFJLEVBQUUsU0FBUyxFQUFFLE1BQU0sTUFBTSxDQUFDO0FBTTlFLE1BQU0sT0FBTyxnQkFBZ0I7SUFJM0IsWUFBb0IsSUFBWSxFQUFVLGNBQWlDLEVBQVUsT0FBMkI7UUFBNUYsU0FBSSxHQ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vcm1BcnJheSkge1xuICAgIGZvcm1BcnJheS5jb250cm9scy5mb3JFYWNoKChjb250cm9sLCBpbmRleCkgPT4ge1xuICAgICAgaWYgKCF0aGlzLmlzUGFyZW50Q29udHJvbChjb250cm9sKSkge1xuICAgICAgICB0aGlzLmRlbGV0ZUVycm9yc0Zyb21Db250cm9sKGluZGV4LCBjb250cm9sKTtcbiAgICAgIH0gZWxzZSBpZiAoY29udHJvbCBpbnN0YW5jZW9mIEZvcm1Hcm91cCkge1xuICAgICAgICB0aGlzLmRlbGV0ZUVycm9ycyhjb250cm9sIGFzIEZvcm1Hcm91cCk7XG4gICAgICB9IGVsc2UgaWYgKGNvbnRyb2wgaW5zdGFuY2VvZiBGb3JtQXJyYXkpIHtcbiAgICAgICAgdGhpcy5sb29wRm9ybUFycmF5KGNvbnRyb2wgYXMgRm9ybUFycmF5KTtcbiAgICAgIH1cbiAgICB9KTtcbiAgfVxuXG4gIHByaXZhdGUgYXN5bmMgcnVuVmFsaWRhdGlvbnM8VD4obW9kZWw6IFQsIGNhbGxiYWNrPzogKGxpc3Q6IEZpZWxkRXJyb3JbXSkgPT4gRmllbGRFcnJvcltdKTogUHJvbWlzZTxNb2RlbFN0YXRlUmVzdWx0PFQ+PiB7XG4gICAgY29uc3QgbGlzdCA9IGF3YWl0IHRoaXMubW9kZWxWYWxpZGF0b3IudmFsaWRhdGUobW9kZWwpO1xuICAgIGNvbnN0IGZpbmFsID0gY2FsbGJhY2s/LihsaXN0KSB8fCBsaXN0O1xuICAgIHJldHVybiB7XG4gICAgICB2YWxpZDogZmluYWwubGVuZ3RoID09PSAwLFxuICAgICAgZXJyb3JzOiBmaW5hbCxcbiAgICAgIG1vZGVsOiBtb2RlbCxcbiAgICB9O1xuICB9XG59XG4iXX0=
|
|
@@ -283,32 +283,50 @@ class NgFormModelState {
|
|
|
283
283
|
getCurrent() {
|
|
284
284
|
return this.changesSubject.value;
|
|
285
285
|
}
|
|
286
|
+
setState(model, errors) {
|
|
287
|
+
const state = {
|
|
288
|
+
model: model,
|
|
289
|
+
errors: errors,
|
|
290
|
+
valid: errors.length === 0,
|
|
291
|
+
};
|
|
292
|
+
this.setStateInternal(state);
|
|
293
|
+
}
|
|
286
294
|
setErrors(errors) {
|
|
287
295
|
//this.errors.next(errors);
|
|
288
296
|
throw new Error('needs implementation');
|
|
289
297
|
}
|
|
298
|
+
appendErrors(errors, skipEmit) {
|
|
299
|
+
var _a;
|
|
300
|
+
const allErrors = [...(((_a = this.changesSubject.value) === null || _a === void 0 ? void 0 : _a.errors) || []), ...errors];
|
|
301
|
+
const state = Object.assign({}, this.changesSubject.value);
|
|
302
|
+
state.errors = allErrors;
|
|
303
|
+
this.setStateInternal(state);
|
|
304
|
+
}
|
|
290
305
|
validate() {
|
|
291
306
|
var _a;
|
|
292
307
|
return __awaiter(this, void 0, void 0, function* () {
|
|
293
308
|
const model = this.form.value;
|
|
294
309
|
const state = yield this.runValidations(model, (_a = this.options) === null || _a === void 0 ? void 0 : _a.onValidate);
|
|
295
|
-
this.
|
|
296
|
-
const grouped = state.errors.reduce((grouped, v) => grouped.set(v.path, [...(grouped.get(v.path) || []), v]), new Map());
|
|
297
|
-
grouped.forEach((value, path) => {
|
|
298
|
-
let validationErrors = {};
|
|
299
|
-
value.forEach((v) => (validationErrors[v.type] = v.message));
|
|
300
|
-
const control = this.form.form.get(path);
|
|
301
|
-
if (!control) {
|
|
302
|
-
// TODO: use actual logging service
|
|
303
|
-
}
|
|
304
|
-
else {
|
|
305
|
-
control.setErrors(validationErrors);
|
|
306
|
-
}
|
|
307
|
-
});
|
|
308
|
-
this.changesSubject.next(state);
|
|
310
|
+
this.setStateInternal(state);
|
|
309
311
|
return state;
|
|
310
312
|
});
|
|
311
313
|
}
|
|
314
|
+
setStateInternal(state) {
|
|
315
|
+
this.deleteFormErrors();
|
|
316
|
+
const grouped = state.errors.reduce((grouped, v) => grouped.set(v.path, [...(grouped.get(v.path) || []), v]), new Map());
|
|
317
|
+
grouped.forEach((value, path) => {
|
|
318
|
+
let validationErrors = {};
|
|
319
|
+
value.forEach((v) => (validationErrors[v.type] = v.message));
|
|
320
|
+
const control = this.form.form.get(path);
|
|
321
|
+
if (!control) {
|
|
322
|
+
// TODO: use actual logging service
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
control.setErrors(validationErrors);
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
this.changesSubject.next(state);
|
|
329
|
+
}
|
|
312
330
|
deleteFormErrors() {
|
|
313
331
|
this.deleteErrors(this.form.form);
|
|
314
332
|
}
|
|
@@ -433,6 +451,14 @@ const currencyOptions = {
|
|
|
433
451
|
},
|
|
434
452
|
},
|
|
435
453
|
};
|
|
454
|
+
const integerOptions = {
|
|
455
|
+
mask: Number,
|
|
456
|
+
scale: 0,
|
|
457
|
+
thousandsSeparator: ',',
|
|
458
|
+
padFractionalZeros: true,
|
|
459
|
+
radix: '.',
|
|
460
|
+
mapToRadix: ['.'],
|
|
461
|
+
};
|
|
436
462
|
|
|
437
463
|
/*
|
|
438
464
|
* Public API Surface of forms
|
|
@@ -442,5 +468,5 @@ const currencyOptions = {
|
|
|
442
468
|
* Generated bundle index. Do not edit.
|
|
443
469
|
*/
|
|
444
470
|
|
|
445
|
-
export { BooleanType, ConstraintType, DateType, FieldErrorsComponent, FormsModule, ModelSchemaFactory, ModelValidator, NgFormModelState, NgFormModelStateFactory, NumberType, ObjectType, StringType, currencyOptions, dateMaskOptions, equals, length, max, maxLength, min, minLength, ofValues, pattern, phoneNumberOptions, required, test };
|
|
471
|
+
export { BooleanType, ConstraintType, DateType, FieldErrorsComponent, FormsModule, ModelSchemaFactory, ModelValidator, NgFormModelState, NgFormModelStateFactory, NumberType, ObjectType, StringType, currencyOptions, dateMaskOptions, equals, integerOptions, length, max, maxLength, min, minLength, ofValues, pattern, phoneNumberOptions, required, test };
|
|
446
472
|
//# sourceMappingURL=muziehdesign-forms.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"muziehdesign-forms.mjs","sources":["../../../../projects/muziehdesign/forms/src/lib/model-validator.ts","../../../../projects/muziehdesign/forms/src/lib/constants.ts","../../../../projects/muziehdesign/forms/src/lib/type-annotations.ts","../../../../projects/muziehdesign/forms/src/lib/model-schema.factory.ts","../../../../projects/muziehdesign/forms/src/lib/field-errors/field-errors.component.ts","../../../../projects/muziehdesign/forms/src/lib/field-errors/field-errors.component.html","../../../../projects/muziehdesign/forms/src/lib/forms.module.ts","../../../../projects/muziehdesign/forms/src/lib/ngform-model-state.ts","../../../../projects/muziehdesign/forms/src/lib/ng-form-model-state.service.ts","../../../../projects/muziehdesign/forms/src/lib/masks.ts","../../../../projects/muziehdesign/forms/src/public-api.ts","../../../../projects/muziehdesign/forms/src/muziehdesign-forms.ts"],"sourcesContent":["import { SchemaOf, ValidationError } from 'yup';\nimport { FieldError } from './field-error';\n\nexport class ModelValidator<T> {\n private schema: SchemaOf<T>;\n constructor(modelSchema: SchemaOf<T>) {\n this.schema = modelSchema;\n }\n\n validate<T>(model: T): Promise<FieldError[]> {\n return this.schema\n .validate(model, { abortEarly: false })\n .then(() => {\n return [];\n })\n .catch((e: ValidationError) => {\n return e.inner.map((error) => <FieldError>{ path: error.path, type: error.type, message: error.message });\n });\n }\n}\n","export const SCHEMA_METADATA_NAMESPACE = 'custom:muziehdesign:annotations';\n","import 'reflect-metadata';\n\nconst METADATA_KEY = 'custom:muziehdesign:annotations';\n\nexport enum ConstraintType {\n string,\n boolean,\n date,\n object,\n number,\n}\n\nexport interface ConstraintAnnotations {\n constraintType: ConstraintType;\n}\n\nexport interface StringTypeAnnotations extends ConstraintAnnotations {\n required?: RequiredAnnotation;\n length?: LengthAnnotation;\n pattern?: PatternAnnotation;\n maxLength?: MaxLengthAnnotation;\n minLength?: MinLengthAnnotation;\n}\n\nexport interface BooleanTypeAnnotations extends ConstraintAnnotations {\n required?: RequiredAnnotation;\n equals?: EqualsAnnotation<boolean>;\n}\n\nexport interface DateTypeAnnotations extends ConstraintAnnotations {\n required?: RequiredAnnotation;\n min?: MinimumAnnotation<Date>;\n max?: MaximumAnnotation<Date>;\n test?: TestAnnotation<Date>;\n}\n\nexport interface ObjectTypeAnnotations extends ConstraintAnnotations {\n required?: RequiredAnnotation;\n getInstance: () => any;\n}\n\nexport interface NumberTypeAnnotations extends ConstraintAnnotations {\n required?: RequiredAnnotation;\n}\n\nexport interface ValidationAnnotation {\n message?: string;\n}\n\nexport interface RequiredAnnotation extends ValidationAnnotation {\n required: boolean;\n}\n\nexport interface LengthAnnotation extends ValidationAnnotation {\n length: number;\n}\n\nexport interface PatternAnnotation extends ValidationAnnotation {\n pattern: RegExp;\n}\n\nexport interface OfValuesAnnotation extends ValidationAnnotation {\n values: [];\n}\n\nexport interface EqualsAnnotation<T> extends ValidationAnnotation {\n equals: T;\n}\n\nexport interface MinimumAnnotation<T> extends ValidationAnnotation {\n min: T;\n}\n\nexport interface MaximumAnnotation<T> extends ValidationAnnotation {\n max: T;\n}\n\nexport interface TestAnnotation<T> extends ValidationAnnotation {\n test: (d: T) => boolean;\n name: string;\n}\n\nexport interface MaxLengthAnnotation extends ValidationAnnotation {\n maxLength: number;\n}\n\nexport interface MinLengthAnnotation extends ValidationAnnotation {\n minLength: number;\n}\n\nconst registerMetadata = (target: Object, propertyKey: string, constraint: ConstraintAnnotations) => {\n const metadata: Map<string, any> = Reflect.getMetadata(METADATA_KEY, target) || new Map<string, any>();\n metadata.set(propertyKey, constraint);\n Reflect.defineMetadata(METADATA_KEY, metadata, target);\n};\n\nexport function StringType(...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations) as StringTypeAnnotations;\n o.constraintType = ConstraintType.string;\n registerMetadata(target, propertyKey, o);\n };\n}\n\nexport function BooleanType(...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations) as BooleanTypeAnnotations;\n o.constraintType = ConstraintType.boolean;\n registerMetadata(target, propertyKey, o);\n };\n}\n\nexport function DateType(...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations) as DateTypeAnnotations;\n o.constraintType = ConstraintType.date;\n registerMetadata(target, propertyKey, o);\n };\n}\n\nexport function NumberType(...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations) as NumberTypeAnnotations;\n o.constraintType = ConstraintType.number;\n registerMetadata(target, propertyKey, o);\n };\n}\n\nexport function ObjectType<T>(type: { new (): T }, ...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations, { getInstance: () => new type() } as Partial<ObjectTypeAnnotations>) as ObjectTypeAnnotations;\n o.constraintType = ConstraintType.object;\n registerMetadata(target, propertyKey, o);\n };\n}\n\nexport function required(message?: string): { [key: string]: RequiredAnnotation } {\n return { required: { required: true, message: message } };\n}\n\nexport function pattern(regex: RegExp, message?: string): { [key: string]: PatternAnnotation } {\n return { pattern: { pattern: regex, message: message } };\n}\n\nexport function length(length: number, message?: string): { [key: string]: LengthAnnotation } {\n return { length: { length: length, message: message } };\n}\n\nexport function maxLength(maxLength: number, message?: string): { [key: string]: MaxLengthAnnotation } {\n return { maxLength: { maxLength: maxLength, message: message } };\n}\n\nexport function minLength(minLength: number, message?: string): { [key: string]: MinLengthAnnotation } {\n return { minLength: { minLength: minLength, message: message } };\n}\n\nexport function ofValues(values: [], message?: string): { [key: string]: OfValuesAnnotation } {\n return { ofValues: { values: values, message: message } };\n}\n\nexport function equals<T>(value: T, message?: string): { [key: string]: EqualsAnnotation<T> } {\n return { equals: { equals: value, message: message } };\n}\n\nexport function min<T>(value: T, message?: string): { [key: string]: MinimumAnnotation<T> } {\n return { min: { min: value, message: message } };\n}\n\nexport function max<T>(value: T, message?: string): { [key: string]: MaximumAnnotation<T> } {\n return { max: { max: value, message: message } };\n}\n\nexport function test<T>(name: string, test: (d: T) => boolean, message?: string): { [key: string]: TestAnnotation<T> } {\n return { test: { name: name, test: test, message: message } };\n}\n","import { Injectable } from '@angular/core';\nimport { object, SchemaOf } from 'yup';\nimport { ModelValidator } from './model-validator';\nimport { SCHEMA_METADATA_NAMESPACE } from './constants';\nimport { ObjectShape } from 'yup/lib/object';\nimport { BooleanTypeAnnotations, ConstraintAnnotations, ConstraintType, DateTypeAnnotations, ObjectTypeAnnotations, NumberTypeAnnotations, StringTypeAnnotations } from './type-annotations';\nimport * as Yup from 'yup';\n\n/*\nSchema rules need to be built in the order they need to be evaluated in.\nFor example,\n ```\n schema.required().max(...).matches(...);\n ```\nevaluates the 3 rules in this order\n - required\n - max\n - matches\n*/\n\n@Injectable({\n providedIn: 'root',\n})\nexport class ModelSchemaFactory {\n constructor() {}\n\n build<T>(model: T): ModelValidator<T> {\n const schema = this.buildObjectSchema(model);\n return new ModelValidator(schema);\n }\n\n private buildObjectSchema<T>(model: T) {\n const metadata: Map<string, ConstraintAnnotations> = Reflect.getMetadata(SCHEMA_METADATA_NAMESPACE, model);\n let shape: ObjectShape = {};\n metadata.forEach((value, key) => {\n if (value.constraintType == ConstraintType.string) {\n shape[key] = this.buildStringSchema(value as StringTypeAnnotations);\n } else if (value.constraintType == ConstraintType.boolean) {\n shape[key] = this.buildBooleanSchema(value as BooleanTypeAnnotations);\n } else if (value.constraintType == ConstraintType.date) {\n shape[key] = this.buildDateSchema(value as DateTypeAnnotations);\n } else if(value.constraintType == ConstraintType.object) {\n shape[key] = this.buildNestedObjectSchema(value as ObjectTypeAnnotations);\n } else if (value.constraintType == ConstraintType.number) {\n shape[key] = this.buildNumberSchema(value as NumberTypeAnnotations);\n }\n });\n return object(shape) as SchemaOf<T>;\n }\n\n private buildStringSchema(options: StringTypeAnnotations) {\n let schema = Yup.string();\n if (options.required) {\n schema = schema.required(options.required.message);\n }\n if (options.length) {\n schema = schema.length(options.length.length, options.length.message);\n }\n\n if (options.maxLength) {\n schema = schema.max(options.maxLength.maxLength, options.maxLength.message);\n }\n\n if (options.minLength) {\n schema = schema.min(options.minLength.minLength, options.minLength.message);\n }\n\n if (options.pattern) {\n schema = schema.matches(options.pattern.pattern, { message: options.pattern.message, excludeEmptyString: true });\n }\n\n return schema;\n }\n\n private buildBooleanSchema(options: BooleanTypeAnnotations) {\n let schema = Yup.boolean();\n if (options.required) {\n schema = schema.required(options.required.message);\n }\n if (options.equals) {\n if (options.equals.equals) {\n schema = schema.isTrue(options.equals.message);\n } else {\n schema = schema.isFalse(options.equals.message);\n }\n }\n\n return schema;\n }\n\n private buildDateSchema(options: DateTypeAnnotations) {\n let schema = Yup.date();\n \n if (options.required) {\n schema = schema.required(options.required.message);\n }\n if (options.min) {\n schema = schema.min(options.min.min, options.min.message);\n }\n if (options.max) {\n schema = schema.max(options.max.max, options.max.message);\n }\n if (options.test) {\n schema = schema.test({\n name: options.test.name,\n message: options.test.message,\n test: (d?: Date, context?: any) => {\n return options.test!.test(d!);\n }});\n }\n\n return schema;\n }\n\n private buildNumberSchema(options: NumberTypeAnnotations) {\n let schema = Yup.number();\n if (options.required) {\n schema = schema.required(options.required.message);\n }\n\n return schema;\n }\n\n private buildNestedObjectSchema(options: ObjectTypeAnnotations) {\n\n let nestedSchema = this.buildObjectSchema(options.getInstance());\n if(options.required) {\n nestedSchema = nestedSchema.required();\n }\n\n return nestedSchema;\n }\n}\n","import { Component, Input, OnInit } from '@angular/core';\nimport { NgControl, ValidationErrors } from '@angular/forms';\n\n@Component({\n selector: 'mz-field-errors',\n templateUrl: './field-errors.component.html',\n styleUrls: ['./field-errors.component.css'],\n})\nexport class FieldErrorsComponent {\n @Input() field?: NgControl;\n\n get errorMessage(): string {\n const errorKeys = Object.keys(this.field?.errors || {});\n return errorKeys.length > 0 ? (this.field?.errors as ValidationErrors)[errorKeys[0]] : '';\n }\n}\n","<div class=\"field-error\" *ngIf=\"errorMessage\">{{ errorMessage }}</div>\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { FieldErrorsComponent } from './field-errors/field-errors.component';\n\n\n\n@NgModule({\n providers: [],\n declarations: [\n FieldErrorsComponent\n ],\n exports: [\n FieldErrorsComponent\n ],\n imports: [\n CommonModule // TODO: can remove once done with temp error displaying\n ]\n})\nexport class FormsModule { }\n","import { AbstractControl, FormArray, FormGroup, NgForm, NgModelGroup, ValidationErrors } from '@angular/forms';\nimport { BehaviorSubject, distinctUntilChanged, from, switchMap } from 'rxjs';\nimport { FieldError } from './field-error';\nimport { ModelStateOptions } from './model-state-options';\nimport { ModelStateResult } from './model-state-result';\nimport { ModelValidator } from './model-validator';\n\nexport class NgFormModelState<T> {\n private changesSubject = new BehaviorSubject<ModelStateResult<T> | undefined>(undefined);\n public readonly changes = this.changesSubject.asObservable();\n\n constructor(private form: NgForm, private modelValidator: ModelValidator<T>, private options?: ModelStateOptions) {\n this.form.form.valueChanges\n .pipe(\n switchMap(async (x) => {\n return from(this.validate());\n })\n )\n .subscribe();\n }\n\n getCurrent(): ModelStateResult<T> | undefined {\n return this.changesSubject.value;\n }\n\n setErrors(errors: FieldError[]) {\n //this.errors.next(errors);\n throw new Error('needs implementation');\n }\n\n async validate(): Promise<ModelStateResult<T>> {\n const model = this.form.value;\n const state = await this.runValidations(model, this.options?.onValidate);\n this.deleteFormErrors();\n\n const grouped = state.errors.reduce((grouped, v) => grouped.set(v.path, [...(grouped.get(v.path) || []), v]), new Map<string, FieldError[]>());\n grouped.forEach((value, path) => {\n let validationErrors = <ValidationErrors>{};\n value.forEach((v) => (validationErrors[v.type] = v.message));\n\n const control = this.form.form.get(path);\n if (!control) {\n // TODO: use actual logging service\n } else {\n control.setErrors(validationErrors);\n }\n });\n\n this.changesSubject.next(state);\n return state;\n }\n\n private deleteFormErrors() {\n this.deleteErrors(this.form.form);\n }\n\n private deleteErrors(rootFormGroup: FormGroup) {\n Object.keys(rootFormGroup.controls).forEach((key) => {\n const control = rootFormGroup.controls[key];\n\n if (!this.isParentControl(control)) {\n this.deleteErrorsFromControl(key, control);\n } else if (control instanceof FormGroup) {\n this.deleteErrors(control as FormGroup);\n } else if (control instanceof FormArray) {\n this.loopFormArray(control as FormArray);\n }\n });\n }\n\n private deleteErrorsFromControl(key: string | number, control: AbstractControl) {\n control.setErrors(null);\n }\n\n private isParentControl(control: AbstractControl) {\n return control instanceof FormGroup || control instanceof FormArray;\n }\n\n private loopFormArray(formArray: FormArray) {\n formArray.controls.forEach((control, index) => {\n if (!this.isParentControl(control)) {\n this.deleteErrorsFromControl(index, control);\n } else if (control instanceof FormGroup) {\n this.deleteErrors(control as FormGroup);\n } else if (control instanceof FormArray) {\n this.loopFormArray(control as FormArray);\n }\n });\n }\n\n private async runValidations<T>(model: T, callback?: (list: FieldError[]) => FieldError[]): Promise<ModelStateResult<T>> {\n const list = await this.modelValidator.validate(model);\n const final = callback?.(list) || list;\n return {\n valid: final.length === 0,\n errors: final,\n model: model,\n };\n }\n}\n","import { Injectable, NO_ERRORS_SCHEMA } from '@angular/core';\nimport { NgForm, ValidationErrors } from '@angular/forms';\nimport { BehaviorSubject, filter, from, switchMap } from 'rxjs';\nimport { FieldError } from './field-error';\nimport { ModelSchemaFactory } from './model-schema.factory';\nimport { ModelStateOptions } from './model-state-options';\nimport { ModelValidator } from './model-validator';\nimport { NgFormModelState } from './ngform-model-state';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class NgFormModelStateFactory {\n constructor(private factory: ModelSchemaFactory) {}\n\n create<T>(form: NgForm, model: T, options?: ModelStateOptions) {\n const modelState = new NgFormModelState<T>(form, this.factory.build(model), options);\n return modelState;\n }\n}\n","import { format, isValid, parse } from 'date-fns';\nimport * as IMask from 'imask';\n\nexport const dateMaskOptions = {\n mask: 'MM/dd/yyyy',\n format: (date: Date | undefined): string => {\n if (!date) {\n return '';\n }\n return format(date, 'MM/dd/yyyy');\n },\n parse: (str: string): Date | undefined => {\n const dateRegex = /(0[1-9]|1[0-2])\\/(0[1-9]|[12]\\d|3[01])\\/([12]\\d{3})/;\n if (!str.match(dateRegex)) {\n return undefined;\n }\n const parsed = parse(str, 'MM/dd/yyyy', new Date());\n if (isValid(parsed)) {\n return parsed;\n }\n return undefined;\n },\n blocks: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n MM: {\n mask: IMask.MaskedRange,\n from: 1,\n to: 12,\n },\n // eslint-disable-next-line @typescript-eslint/naming-convention\n dd: {\n mask: IMask.MaskedRange,\n from: 1,\n to: 31,\n },\n // eslint-disable-next-line @typescript-eslint/naming-convention\n yyyy: {\n mask: IMask.MaskedRange,\n from: 1000,\n to: 9999,\n },\n },\n};\n\nexport const phoneNumberOptions = {\n mask: '(000) 000-0000',\n};\n\nexport const currencyOptions = {\n mask: 'num',\n lazy: false,\n blocks: {\n num: {\n mask: Number,\n scale: 2,\n thousandsSeparator: ',',\n padFractionalZeros: true,\n radix: '.',\n mapToRadix: ['.'],\n },\n },\n};\n","/*\n * Public API Surface of forms\n */\nexport * from './lib/field-error';\nexport * from './lib/model-state-result';\nexport * from './lib/model-schema.factory';\nexport * from './lib/model-validator';\nexport * from './lib/type-annotations';\nexport * from './lib/forms.module';\nexport * from './lib/ng-form-model-state.service';\nexport * from './lib/ngform-model-state';\nexport * from './lib/field-errors/field-errors.component';\nexport * from './lib/masks';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.ModelSchemaFactory"],"mappings":";;;;;;;;;;;;;MAGa,cAAc,CAAA;AAEzB,IAAA,WAAA,CAAY,WAAwB,EAAA;AAClC,QAAA,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC;KAC3B;AAED,IAAA,QAAQ,CAAI,KAAQ,EAAA;QAClB,OAAO,IAAI,CAAC,MAAM;aACf,QAAQ,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;aACtC,IAAI,CAAC,MAAK;AACT,YAAA,OAAO,EAAE,CAAC;AACZ,SAAC,CAAC;AACD,aAAA,KAAK,CAAC,CAAC,CAAkB,KAA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AAM;AACZ,YAAA,KAAK,EAAE,CAAC;AACR,YAAA,kBAAkB,EAAE,GAAG;AACvB,YAAA,kBAAkB,EAAE,IAAI;AACxB,YAAA,KAAK,EAAE,GAAG;YACV,UAAU,EAAE,CAAC,GAAG,CAAC;AAClB,SAAA;AACF,KAAA;;;AC5DH;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"muziehdesign-forms.mjs","sources":["../../../../projects/muziehdesign/forms/src/lib/model-validator.ts","../../../../projects/muziehdesign/forms/src/lib/constants.ts","../../../../projects/muziehdesign/forms/src/lib/type-annotations.ts","../../../../projects/muziehdesign/forms/src/lib/model-schema.factory.ts","../../../../projects/muziehdesign/forms/src/lib/field-errors/field-errors.component.ts","../../../../projects/muziehdesign/forms/src/lib/field-errors/field-errors.component.html","../../../../projects/muziehdesign/forms/src/lib/forms.module.ts","../../../../projects/muziehdesign/forms/src/lib/ngform-model-state.ts","../../../../projects/muziehdesign/forms/src/lib/ng-form-model-state.service.ts","../../../../projects/muziehdesign/forms/src/lib/masks.ts","../../../../projects/muziehdesign/forms/src/public-api.ts","../../../../projects/muziehdesign/forms/src/muziehdesign-forms.ts"],"sourcesContent":["import { SchemaOf, ValidationError } from 'yup';\nimport { FieldError } from './field-error';\n\nexport class ModelValidator<T> {\n private schema: SchemaOf<T>;\n constructor(modelSchema: SchemaOf<T>) {\n this.schema = modelSchema;\n }\n\n validate<T>(model: T): Promise<FieldError[]> {\n return this.schema\n .validate(model, { abortEarly: false })\n .then(() => {\n return [];\n })\n .catch((e: ValidationError) => {\n return e.inner.map((error) => <FieldError>{ path: error.path, type: error.type, message: error.message });\n });\n }\n}\n","export const SCHEMA_METADATA_NAMESPACE = 'custom:muziehdesign:annotations';\n","import 'reflect-metadata';\n\nconst METADATA_KEY = 'custom:muziehdesign:annotations';\n\nexport enum ConstraintType {\n string,\n boolean,\n date,\n object,\n number,\n}\n\nexport interface ConstraintAnnotations {\n constraintType: ConstraintType;\n}\n\nexport interface StringTypeAnnotations extends ConstraintAnnotations {\n required?: RequiredAnnotation;\n length?: LengthAnnotation;\n pattern?: PatternAnnotation;\n maxLength?: MaxLengthAnnotation;\n minLength?: MinLengthAnnotation;\n}\n\nexport interface BooleanTypeAnnotations extends ConstraintAnnotations {\n required?: RequiredAnnotation;\n equals?: EqualsAnnotation<boolean>;\n}\n\nexport interface DateTypeAnnotations extends ConstraintAnnotations {\n required?: RequiredAnnotation;\n min?: MinimumAnnotation<Date>;\n max?: MaximumAnnotation<Date>;\n test?: TestAnnotation<Date>;\n}\n\nexport interface ObjectTypeAnnotations extends ConstraintAnnotations {\n required?: RequiredAnnotation;\n getInstance: () => any;\n}\n\nexport interface NumberTypeAnnotations extends ConstraintAnnotations {\n required?: RequiredAnnotation;\n}\n\nexport interface ValidationAnnotation {\n message?: string;\n}\n\nexport interface RequiredAnnotation extends ValidationAnnotation {\n required: boolean;\n}\n\nexport interface LengthAnnotation extends ValidationAnnotation {\n length: number;\n}\n\nexport interface PatternAnnotation extends ValidationAnnotation {\n pattern: RegExp;\n}\n\nexport interface OfValuesAnnotation extends ValidationAnnotation {\n values: [];\n}\n\nexport interface EqualsAnnotation<T> extends ValidationAnnotation {\n equals: T;\n}\n\nexport interface MinimumAnnotation<T> extends ValidationAnnotation {\n min: T;\n}\n\nexport interface MaximumAnnotation<T> extends ValidationAnnotation {\n max: T;\n}\n\nexport interface TestAnnotation<T> extends ValidationAnnotation {\n test: (d: T) => boolean;\n name: string;\n}\n\nexport interface MaxLengthAnnotation extends ValidationAnnotation {\n maxLength: number;\n}\n\nexport interface MinLengthAnnotation extends ValidationAnnotation {\n minLength: number;\n}\n\nconst registerMetadata = (target: Object, propertyKey: string, constraint: ConstraintAnnotations) => {\n const metadata: Map<string, any> = Reflect.getMetadata(METADATA_KEY, target) || new Map<string, any>();\n metadata.set(propertyKey, constraint);\n Reflect.defineMetadata(METADATA_KEY, metadata, target);\n};\n\nexport function StringType(...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations) as StringTypeAnnotations;\n o.constraintType = ConstraintType.string;\n registerMetadata(target, propertyKey, o);\n };\n}\n\nexport function BooleanType(...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations) as BooleanTypeAnnotations;\n o.constraintType = ConstraintType.boolean;\n registerMetadata(target, propertyKey, o);\n };\n}\n\nexport function DateType(...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations) as DateTypeAnnotations;\n o.constraintType = ConstraintType.date;\n registerMetadata(target, propertyKey, o);\n };\n}\n\nexport function NumberType(...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations) as NumberTypeAnnotations;\n o.constraintType = ConstraintType.number;\n registerMetadata(target, propertyKey, o);\n };\n}\n\nexport function ObjectType<T>(type: { new (): T }, ...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations, { getInstance: () => new type() } as Partial<ObjectTypeAnnotations>) as ObjectTypeAnnotations;\n o.constraintType = ConstraintType.object;\n registerMetadata(target, propertyKey, o);\n };\n}\n\nexport function required(message?: string): { [key: string]: RequiredAnnotation } {\n return { required: { required: true, message: message } };\n}\n\nexport function pattern(regex: RegExp, message?: string): { [key: string]: PatternAnnotation } {\n return { pattern: { pattern: regex, message: message } };\n}\n\nexport function length(length: number, message?: string): { [key: string]: LengthAnnotation } {\n return { length: { length: length, message: message } };\n}\n\nexport function maxLength(maxLength: number, message?: string): { [key: string]: MaxLengthAnnotation } {\n return { maxLength: { maxLength: maxLength, message: message } };\n}\n\nexport function minLength(minLength: number, message?: string): { [key: string]: MinLengthAnnotation } {\n return { minLength: { minLength: minLength, message: message } };\n}\n\nexport function ofValues(values: [], message?: string): { [key: string]: OfValuesAnnotation } {\n return { ofValues: { values: values, message: message } };\n}\n\nexport function equals<T>(value: T, message?: string): { [key: string]: EqualsAnnotation<T> } {\n return { equals: { equals: value, message: message } };\n}\n\nexport function min<T>(value: T, message?: string): { [key: string]: MinimumAnnotation<T> } {\n return { min: { min: value, message: message } };\n}\n\nexport function max<T>(value: T, message?: string): { [key: string]: MaximumAnnotation<T> } {\n return { max: { max: value, message: message } };\n}\n\nexport function test<T>(name: string, test: (d: T) => boolean, message?: string): { [key: string]: TestAnnotation<T> } {\n return { test: { name: name, test: test, message: message } };\n}\n","import { Injectable } from '@angular/core';\nimport { object, SchemaOf } from 'yup';\nimport { ModelValidator } from './model-validator';\nimport { SCHEMA_METADATA_NAMESPACE } from './constants';\nimport { ObjectShape } from 'yup/lib/object';\nimport { BooleanTypeAnnotations, ConstraintAnnotations, ConstraintType, DateTypeAnnotations, ObjectTypeAnnotations, NumberTypeAnnotations, StringTypeAnnotations } from './type-annotations';\nimport * as Yup from 'yup';\n\n/*\nSchema rules need to be built in the order they need to be evaluated in.\nFor example,\n ```\n schema.required().max(...).matches(...);\n ```\nevaluates the 3 rules in this order\n - required\n - max\n - matches\n*/\n\n@Injectable({\n providedIn: 'root',\n})\nexport class ModelSchemaFactory {\n constructor() {}\n\n build<T>(model: T): ModelValidator<T> {\n const schema = this.buildObjectSchema(model);\n return new ModelValidator(schema);\n }\n\n private buildObjectSchema<T>(model: T) {\n const metadata: Map<string, ConstraintAnnotations> = Reflect.getMetadata(SCHEMA_METADATA_NAMESPACE, model);\n let shape: ObjectShape = {};\n metadata.forEach((value, key) => {\n if (value.constraintType == ConstraintType.string) {\n shape[key] = this.buildStringSchema(value as StringTypeAnnotations);\n } else if (value.constraintType == ConstraintType.boolean) {\n shape[key] = this.buildBooleanSchema(value as BooleanTypeAnnotations);\n } else if (value.constraintType == ConstraintType.date) {\n shape[key] = this.buildDateSchema(value as DateTypeAnnotations);\n } else if(value.constraintType == ConstraintType.object) {\n shape[key] = this.buildNestedObjectSchema(value as ObjectTypeAnnotations);\n } else if (value.constraintType == ConstraintType.number) {\n shape[key] = this.buildNumberSchema(value as NumberTypeAnnotations);\n }\n });\n return object(shape) as SchemaOf<T>;\n }\n\n private buildStringSchema(options: StringTypeAnnotations) {\n let schema = Yup.string();\n if (options.required) {\n schema = schema.required(options.required.message);\n }\n if (options.length) {\n schema = schema.length(options.length.length, options.length.message);\n }\n\n if (options.maxLength) {\n schema = schema.max(options.maxLength.maxLength, options.maxLength.message);\n }\n\n if (options.minLength) {\n schema = schema.min(options.minLength.minLength, options.minLength.message);\n }\n\n if (options.pattern) {\n schema = schema.matches(options.pattern.pattern, { message: options.pattern.message, excludeEmptyString: true });\n }\n\n return schema;\n }\n\n private buildBooleanSchema(options: BooleanTypeAnnotations) {\n let schema = Yup.boolean();\n if (options.required) {\n schema = schema.required(options.required.message);\n }\n if (options.equals) {\n if (options.equals.equals) {\n schema = schema.isTrue(options.equals.message);\n } else {\n schema = schema.isFalse(options.equals.message);\n }\n }\n\n return schema;\n }\n\n private buildDateSchema(options: DateTypeAnnotations) {\n let schema = Yup.date();\n \n if (options.required) {\n schema = schema.required(options.required.message);\n }\n if (options.min) {\n schema = schema.min(options.min.min, options.min.message);\n }\n if (options.max) {\n schema = schema.max(options.max.max, options.max.message);\n }\n if (options.test) {\n schema = schema.test({\n name: options.test.name,\n message: options.test.message,\n test: (d?: Date, context?: any) => {\n return options.test!.test(d!);\n }});\n }\n\n return schema;\n }\n\n private buildNumberSchema(options: NumberTypeAnnotations) {\n let schema = Yup.number();\n if (options.required) {\n schema = schema.required(options.required.message);\n }\n\n return schema;\n }\n\n private buildNestedObjectSchema(options: ObjectTypeAnnotations) {\n\n let nestedSchema = this.buildObjectSchema(options.getInstance());\n if(options.required) {\n nestedSchema = nestedSchema.required();\n }\n\n return nestedSchema;\n }\n}\n","import { Component, Input, OnInit } from '@angular/core';\nimport { NgControl, ValidationErrors } from '@angular/forms';\n\n@Component({\n selector: 'mz-field-errors',\n templateUrl: './field-errors.component.html',\n styleUrls: ['./field-errors.component.css'],\n})\nexport class FieldErrorsComponent {\n @Input() field?: NgControl;\n\n get errorMessage(): string {\n const errorKeys = Object.keys(this.field?.errors || {});\n return errorKeys.length > 0 ? (this.field?.errors as ValidationErrors)[errorKeys[0]] : '';\n }\n}\n","<div class=\"field-error\" *ngIf=\"errorMessage\">{{ errorMessage }}</div>\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { FieldErrorsComponent } from './field-errors/field-errors.component';\n\n\n\n@NgModule({\n providers: [],\n declarations: [\n FieldErrorsComponent\n ],\n exports: [\n FieldErrorsComponent\n ],\n imports: [\n CommonModule // TODO: can remove once done with temp error displaying\n ]\n})\nexport class FormsModule { }\n","import { AbstractControl, FormArray, FormGroup, NgForm, NgModelGroup, ValidationErrors } from '@angular/forms';\nimport { BehaviorSubject, distinctUntilChanged, from, switchMap } from 'rxjs';\nimport { FieldError } from './field-error';\nimport { ModelStateOptions } from './model-state-options';\nimport { ModelStateResult } from './model-state-result';\nimport { ModelValidator } from './model-validator';\n\nexport class NgFormModelState<T> {\n private changesSubject = new BehaviorSubject<ModelStateResult<T> | undefined>(undefined);\n public readonly changes = this.changesSubject.asObservable();\n\n constructor(private form: NgForm, private modelValidator: ModelValidator<T>, private options?: ModelStateOptions) {\n this.form.form.valueChanges\n .pipe(\n switchMap(async (x) => {\n return from(this.validate());\n })\n )\n .subscribe();\n }\n\n getCurrent(): ModelStateResult<T> | undefined {\n return this.changesSubject.value;\n }\n\n setState(model: T, errors: FieldError[]) {\n const state = {\n model: model,\n errors: errors,\n valid: errors.length === 0,\n } as ModelStateResult<T>;\n this.setStateInternal(state);\n }\n\n setErrors(errors: FieldError[]) {\n //this.errors.next(errors);\n throw new Error('needs implementation');\n }\n\n appendErrors(errors: FieldError[], skipEmit?: boolean) {\n const allErrors = [...(this.changesSubject.value?.errors || []), ...errors];\n const state = { ...this.changesSubject.value } as ModelStateResult<T>;\n state.errors = allErrors;\n this.setStateInternal(state);\n }\n\n async validate(): Promise<ModelStateResult<T>> {\n const model = this.form.value;\n const state = await this.runValidations(model, this.options?.onValidate);\n this.setStateInternal(state);\n return state;\n }\n\n private setStateInternal(state: ModelStateResult<T>) {\n this.deleteFormErrors();\n\n const grouped = state.errors.reduce((grouped, v) => grouped.set(v.path, [...(grouped.get(v.path) || []), v]), new Map<string, FieldError[]>());\n grouped.forEach((value, path) => {\n let validationErrors = <ValidationErrors>{};\n value.forEach((v) => (validationErrors[v.type] = v.message));\n\n const control = this.form.form.get(path);\n if (!control) {\n // TODO: use actual logging service\n } else {\n control.setErrors(validationErrors);\n }\n });\n\n this.changesSubject.next(state);\n }\n\n private deleteFormErrors() {\n this.deleteErrors(this.form.form);\n }\n\n private deleteErrors(rootFormGroup: FormGroup) {\n Object.keys(rootFormGroup.controls).forEach((key) => {\n const control = rootFormGroup.controls[key];\n\n if (!this.isParentControl(control)) {\n this.deleteErrorsFromControl(key, control);\n } else if (control instanceof FormGroup) {\n this.deleteErrors(control as FormGroup);\n } else if (control instanceof FormArray) {\n this.loopFormArray(control as FormArray);\n }\n });\n }\n\n private deleteErrorsFromControl(key: string | number, control: AbstractControl) {\n control.setErrors(null);\n }\n\n private isParentControl(control: AbstractControl) {\n return control instanceof FormGroup || control instanceof FormArray;\n }\n\n private loopFormArray(formArray: FormArray) {\n formArray.controls.forEach((control, index) => {\n if (!this.isParentControl(control)) {\n this.deleteErrorsFromControl(index, control);\n } else if (control instanceof FormGroup) {\n this.deleteErrors(control as FormGroup);\n } else if (control instanceof FormArray) {\n this.loopFormArray(control as FormArray);\n }\n });\n }\n\n private async runValidations<T>(model: T, callback?: (list: FieldError[]) => FieldError[]): Promise<ModelStateResult<T>> {\n const list = await this.modelValidator.validate(model);\n const final = callback?.(list) || list;\n return {\n valid: final.length === 0,\n errors: final,\n model: model,\n };\n }\n}\n","import { Injectable, NO_ERRORS_SCHEMA } from '@angular/core';\nimport { NgForm, ValidationErrors } from '@angular/forms';\nimport { BehaviorSubject, filter, from, switchMap } from 'rxjs';\nimport { FieldError } from './field-error';\nimport { ModelSchemaFactory } from './model-schema.factory';\nimport { ModelStateOptions } from './model-state-options';\nimport { ModelValidator } from './model-validator';\nimport { NgFormModelState } from './ngform-model-state';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class NgFormModelStateFactory {\n constructor(private factory: ModelSchemaFactory) {}\n\n create<T>(form: NgForm, model: T, options?: ModelStateOptions) {\n const modelState = new NgFormModelState<T>(form, this.factory.build(model), options);\n return modelState;\n }\n}\n","import { format, isValid, parse } from 'date-fns';\nimport * as IMask from 'imask';\n\nexport const dateMaskOptions = {\n mask: 'MM/dd/yyyy',\n format: (date: Date | undefined): string => {\n if (!date) {\n return '';\n }\n return format(date, 'MM/dd/yyyy');\n },\n parse: (str: string): Date | undefined => {\n const dateRegex = /(0[1-9]|1[0-2])\\/(0[1-9]|[12]\\d|3[01])\\/([12]\\d{3})/;\n if (!str.match(dateRegex)) {\n return undefined;\n }\n const parsed = parse(str, 'MM/dd/yyyy', new Date());\n if (isValid(parsed)) {\n return parsed;\n }\n return undefined;\n },\n blocks: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n MM: {\n mask: IMask.MaskedRange,\n from: 1,\n to: 12,\n },\n // eslint-disable-next-line @typescript-eslint/naming-convention\n dd: {\n mask: IMask.MaskedRange,\n from: 1,\n to: 31,\n },\n // eslint-disable-next-line @typescript-eslint/naming-convention\n yyyy: {\n mask: IMask.MaskedRange,\n from: 1000,\n to: 9999,\n },\n },\n};\n\nexport const phoneNumberOptions = {\n mask: '(000) 000-0000',\n};\n\nexport const currencyOptions = {\n mask: 'num',\n lazy: false,\n blocks: {\n num: {\n mask: Number,\n scale: 2,\n thousandsSeparator: ',',\n padFractionalZeros: true,\n radix: '.',\n mapToRadix: ['.'],\n },\n },\n};\n\nexport const integerOptions = {\n mask: Number,\n scale: 0,\n thousandsSeparator: ',',\n padFractionalZeros: true,\n radix: '.',\n mapToRadix: ['.'],\n};","/*\n * Public API Surface of forms\n */\nexport * from './lib/field-error';\nexport * from './lib/model-state-result';\nexport * from './lib/model-schema.factory';\nexport * from './lib/model-validator';\nexport * from './lib/type-annotations';\nexport * from './lib/forms.module';\nexport * from './lib/ng-form-model-state.service';\nexport * from './lib/ngform-model-state';\nexport * from './lib/field-errors/field-errors.component';\nexport * from './lib/masks';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.ModelSchemaFactory"],"mappings":";;;;;;;;;;;;;MAGa,cAAc,CAAA;AAEzB,IAAA,WAAA,CAAY,WAAwB,EAAA;AAClC,QAAA,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC;KAC3B;AAED,IAAA,QAAQ,CAAI,KAAQ,EAAA;QAClB,OAAO,IAAI,CAAC,MAAM;aACf,QAAQ,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;aACtC,IAAI,CAAC,MAAK;AACT,YAAA,OAAO,EAAE,CAAC;AACZ,SAAC,CAAC;AACD,aAAA,KAAK,CAAC,CAAC,CAAkB,KAAI;AAC5B,YAAA,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,MAAiB,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAA,CAAC,CAAC;AAC5G,SAAC,CAAC,CAAC;KACN;AACF;;ACnBM,MAAM,yBAAyB,GAAG,iCAAiC;;ACE1E,MAAM,YAAY,GAAG,iCAAiC,CAAC;AAE3C,IAAA,eAMX;AAND,CAAA,UAAY,cAAc,EAAA;IACxB,cAAA,CAAA,cAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAM,CAAA;IACN,cAAA,CAAA,cAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAO,CAAA;IACP,cAAA,CAAA,cAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,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AAEW,MAAA,kBAAkB,GAAG;AAChC,IAAA,IAAI,EAAE,gBAAgB;EACtB;AAEW,MAAA,eAAe,GAAG;AAC7B,IAAA,IAAI,EAAE,KAAK;AACX,IAAA,IAAI,EAAE,KAAK;AACX,IAAA,MAAM,EAAE;AACN,QAAA,GAAG,EAAE;AACH,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,KAAK,EAAE,CAAC;AACR,YAAA,kBAAkB,EAAE,GAAG;AACvB,YAAA,kBAAkB,EAAE,IAAI;AACxB,YAAA,KAAK,EAAE,GAAG;YACV,UAAU,EAAE,CAAC,GAAG,CAAC;AAClB,SAAA;AACF,KAAA;EACD;AAEW,MAAA,cAAc,GAAG;AAC5B,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,KAAK,EAAE,CAAC;AACR,IAAA,kBAAkB,EAAE,GAAG;AACvB,IAAA,kBAAkB,EAAE,IAAI;AACxB,IAAA,KAAK,EAAE,GAAG;IACV,UAAU,EAAE,CAAC,GAAG,CAAC;;;ACrEnB;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -281,13 +281,31 @@ class NgFormModelState {
|
|
|
281
281
|
getCurrent() {
|
|
282
282
|
return this.changesSubject.value;
|
|
283
283
|
}
|
|
284
|
+
setState(model, errors) {
|
|
285
|
+
const state = {
|
|
286
|
+
model: model,
|
|
287
|
+
errors: errors,
|
|
288
|
+
valid: errors.length === 0,
|
|
289
|
+
};
|
|
290
|
+
this.setStateInternal(state);
|
|
291
|
+
}
|
|
284
292
|
setErrors(errors) {
|
|
285
293
|
//this.errors.next(errors);
|
|
286
294
|
throw new Error('needs implementation');
|
|
287
295
|
}
|
|
296
|
+
appendErrors(errors, skipEmit) {
|
|
297
|
+
const allErrors = [...(this.changesSubject.value?.errors || []), ...errors];
|
|
298
|
+
const state = { ...this.changesSubject.value };
|
|
299
|
+
state.errors = allErrors;
|
|
300
|
+
this.setStateInternal(state);
|
|
301
|
+
}
|
|
288
302
|
async validate() {
|
|
289
303
|
const model = this.form.value;
|
|
290
304
|
const state = await this.runValidations(model, this.options?.onValidate);
|
|
305
|
+
this.setStateInternal(state);
|
|
306
|
+
return state;
|
|
307
|
+
}
|
|
308
|
+
setStateInternal(state) {
|
|
291
309
|
this.deleteFormErrors();
|
|
292
310
|
const grouped = state.errors.reduce((grouped, v) => grouped.set(v.path, [...(grouped.get(v.path) || []), v]), new Map());
|
|
293
311
|
grouped.forEach((value, path) => {
|
|
@@ -302,7 +320,6 @@ class NgFormModelState {
|
|
|
302
320
|
}
|
|
303
321
|
});
|
|
304
322
|
this.changesSubject.next(state);
|
|
305
|
-
return state;
|
|
306
323
|
}
|
|
307
324
|
deleteFormErrors() {
|
|
308
325
|
this.deleteErrors(this.form.form);
|
|
@@ -426,6 +443,14 @@ const currencyOptions = {
|
|
|
426
443
|
},
|
|
427
444
|
},
|
|
428
445
|
};
|
|
446
|
+
const integerOptions = {
|
|
447
|
+
mask: Number,
|
|
448
|
+
scale: 0,
|
|
449
|
+
thousandsSeparator: ',',
|
|
450
|
+
padFractionalZeros: true,
|
|
451
|
+
radix: '.',
|
|
452
|
+
mapToRadix: ['.'],
|
|
453
|
+
};
|
|
429
454
|
|
|
430
455
|
/*
|
|
431
456
|
* Public API Surface of forms
|
|
@@ -435,5 +460,5 @@ const currencyOptions = {
|
|
|
435
460
|
* Generated bundle index. Do not edit.
|
|
436
461
|
*/
|
|
437
462
|
|
|
438
|
-
export { BooleanType, ConstraintType, DateType, FieldErrorsComponent, FormsModule, ModelSchemaFactory, ModelValidator, NgFormModelState, NgFormModelStateFactory, NumberType, ObjectType, StringType, currencyOptions, dateMaskOptions, equals, length, max, maxLength, min, minLength, ofValues, pattern, phoneNumberOptions, required, test };
|
|
463
|
+
export { BooleanType, ConstraintType, DateType, FieldErrorsComponent, FormsModule, ModelSchemaFactory, ModelValidator, NgFormModelState, NgFormModelStateFactory, NumberType, ObjectType, StringType, currencyOptions, dateMaskOptions, equals, integerOptions, length, max, maxLength, min, minLength, ofValues, pattern, phoneNumberOptions, required, test };
|
|
439
464
|
//# sourceMappingURL=muziehdesign-forms.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"muziehdesign-forms.mjs","sources":["../../../../projects/muziehdesign/forms/src/lib/model-validator.ts","../../../../projects/muziehdesign/forms/src/lib/constants.ts","../../../../projects/muziehdesign/forms/src/lib/type-annotations.ts","../../../../projects/muziehdesign/forms/src/lib/model-schema.factory.ts","../../../../projects/muziehdesign/forms/src/lib/field-errors/field-errors.component.ts","../../../../projects/muziehdesign/forms/src/lib/field-errors/field-errors.component.html","../../../../projects/muziehdesign/forms/src/lib/forms.module.ts","../../../../projects/muziehdesign/forms/src/lib/ngform-model-state.ts","../../../../projects/muziehdesign/forms/src/lib/ng-form-model-state.service.ts","../../../../projects/muziehdesign/forms/src/lib/masks.ts","../../../../projects/muziehdesign/forms/src/public-api.ts","../../../../projects/muziehdesign/forms/src/muziehdesign-forms.ts"],"sourcesContent":["import { SchemaOf, ValidationError } from 'yup';\nimport { FieldError } from './field-error';\n\nexport class ModelValidator<T> {\n private schema: SchemaOf<T>;\n constructor(modelSchema: SchemaOf<T>) {\n this.schema = modelSchema;\n }\n\n validate<T>(model: T): Promise<FieldError[]> {\n return this.schema\n .validate(model, { abortEarly: false })\n .then(() => {\n return [];\n })\n .catch((e: ValidationError) => {\n return e.inner.map((error) => <FieldError>{ path: error.path, type: error.type, message: error.message });\n });\n }\n}\n","export const SCHEMA_METADATA_NAMESPACE = 'custom:muziehdesign:annotations';\n","import 'reflect-metadata';\n\nconst METADATA_KEY = 'custom:muziehdesign:annotations';\n\nexport enum ConstraintType {\n string,\n boolean,\n date,\n object,\n number,\n}\n\nexport interface ConstraintAnnotations {\n constraintType: ConstraintType;\n}\n\nexport interface StringTypeAnnotations extends ConstraintAnnotations {\n required?: RequiredAnnotation;\n length?: LengthAnnotation;\n pattern?: PatternAnnotation;\n maxLength?: MaxLengthAnnotation;\n minLength?: MinLengthAnnotation;\n}\n\nexport interface BooleanTypeAnnotations extends ConstraintAnnotations {\n required?: RequiredAnnotation;\n equals?: EqualsAnnotation<boolean>;\n}\n\nexport interface DateTypeAnnotations extends ConstraintAnnotations {\n required?: RequiredAnnotation;\n min?: MinimumAnnotation<Date>;\n max?: MaximumAnnotation<Date>;\n test?: TestAnnotation<Date>;\n}\n\nexport interface ObjectTypeAnnotations extends ConstraintAnnotations {\n required?: RequiredAnnotation;\n getInstance: () => any;\n}\n\nexport interface NumberTypeAnnotations extends ConstraintAnnotations {\n required?: RequiredAnnotation;\n}\n\nexport interface ValidationAnnotation {\n message?: string;\n}\n\nexport interface RequiredAnnotation extends ValidationAnnotation {\n required: boolean;\n}\n\nexport interface LengthAnnotation extends ValidationAnnotation {\n length: number;\n}\n\nexport interface PatternAnnotation extends ValidationAnnotation {\n pattern: RegExp;\n}\n\nexport interface OfValuesAnnotation extends ValidationAnnotation {\n values: [];\n}\n\nexport interface EqualsAnnotation<T> extends ValidationAnnotation {\n equals: T;\n}\n\nexport interface MinimumAnnotation<T> extends ValidationAnnotation {\n min: T;\n}\n\nexport interface MaximumAnnotation<T> extends ValidationAnnotation {\n max: T;\n}\n\nexport interface TestAnnotation<T> extends ValidationAnnotation {\n test: (d: T) => boolean;\n name: string;\n}\n\nexport interface MaxLengthAnnotation extends ValidationAnnotation {\n maxLength: number;\n}\n\nexport interface MinLengthAnnotation extends ValidationAnnotation {\n minLength: number;\n}\n\nconst registerMetadata = (target: Object, propertyKey: string, constraint: ConstraintAnnotations) => {\n const metadata: Map<string, any> = Reflect.getMetadata(METADATA_KEY, target) || new Map<string, any>();\n metadata.set(propertyKey, constraint);\n Reflect.defineMetadata(METADATA_KEY, metadata, target);\n};\n\nexport function StringType(...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations) as StringTypeAnnotations;\n o.constraintType = ConstraintType.string;\n registerMetadata(target, propertyKey, o);\n };\n}\n\nexport function BooleanType(...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations) as BooleanTypeAnnotations;\n o.constraintType = ConstraintType.boolean;\n registerMetadata(target, propertyKey, o);\n };\n}\n\nexport function DateType(...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations) as DateTypeAnnotations;\n o.constraintType = ConstraintType.date;\n registerMetadata(target, propertyKey, o);\n };\n}\n\nexport function NumberType(...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations) as NumberTypeAnnotations;\n o.constraintType = ConstraintType.number;\n registerMetadata(target, propertyKey, o);\n };\n}\n\nexport function ObjectType<T>(type: { new (): T }, ...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations, { getInstance: () => new type() } as Partial<ObjectTypeAnnotations>) as ObjectTypeAnnotations;\n o.constraintType = ConstraintType.object;\n registerMetadata(target, propertyKey, o);\n };\n}\n\nexport function required(message?: string): { [key: string]: RequiredAnnotation } {\n return { required: { required: true, message: message } };\n}\n\nexport function pattern(regex: RegExp, message?: string): { [key: string]: PatternAnnotation } {\n return { pattern: { pattern: regex, message: message } };\n}\n\nexport function length(length: number, message?: string): { [key: string]: LengthAnnotation } {\n return { length: { length: length, message: message } };\n}\n\nexport function maxLength(maxLength: number, message?: string): { [key: string]: MaxLengthAnnotation } {\n return { maxLength: { maxLength: maxLength, message: message } };\n}\n\nexport function minLength(minLength: number, message?: string): { [key: string]: MinLengthAnnotation } {\n return { minLength: { minLength: minLength, message: message } };\n}\n\nexport function ofValues(values: [], message?: string): { [key: string]: OfValuesAnnotation } {\n return { ofValues: { values: values, message: message } };\n}\n\nexport function equals<T>(value: T, message?: string): { [key: string]: EqualsAnnotation<T> } {\n return { equals: { equals: value, message: message } };\n}\n\nexport function min<T>(value: T, message?: string): { [key: string]: MinimumAnnotation<T> } {\n return { min: { min: value, message: message } };\n}\n\nexport function max<T>(value: T, message?: string): { [key: string]: MaximumAnnotation<T> } {\n return { max: { max: value, message: message } };\n}\n\nexport function test<T>(name: string, test: (d: T) => boolean, message?: string): { [key: string]: TestAnnotation<T> } {\n return { test: { name: name, test: test, message: message } };\n}\n","import { Injectable } from '@angular/core';\nimport { object, SchemaOf } from 'yup';\nimport { ModelValidator } from './model-validator';\nimport { SCHEMA_METADATA_NAMESPACE } from './constants';\nimport { ObjectShape } from 'yup/lib/object';\nimport { BooleanTypeAnnotations, ConstraintAnnotations, ConstraintType, DateTypeAnnotations, ObjectTypeAnnotations, NumberTypeAnnotations, StringTypeAnnotations } from './type-annotations';\nimport * as Yup from 'yup';\n\n/*\nSchema rules need to be built in the order they need to be evaluated in.\nFor example,\n ```\n schema.required().max(...).matches(...);\n ```\nevaluates the 3 rules in this order\n - required\n - max\n - matches\n*/\n\n@Injectable({\n providedIn: 'root',\n})\nexport class ModelSchemaFactory {\n constructor() {}\n\n build<T>(model: T): ModelValidator<T> {\n const schema = this.buildObjectSchema(model);\n return new ModelValidator(schema);\n }\n\n private buildObjectSchema<T>(model: T) {\n const metadata: Map<string, ConstraintAnnotations> = Reflect.getMetadata(SCHEMA_METADATA_NAMESPACE, model);\n let shape: ObjectShape = {};\n metadata.forEach((value, key) => {\n if (value.constraintType == ConstraintType.string) {\n shape[key] = this.buildStringSchema(value as StringTypeAnnotations);\n } else if (value.constraintType == ConstraintType.boolean) {\n shape[key] = this.buildBooleanSchema(value as BooleanTypeAnnotations);\n } else if (value.constraintType == ConstraintType.date) {\n shape[key] = this.buildDateSchema(value as DateTypeAnnotations);\n } else if(value.constraintType == ConstraintType.object) {\n shape[key] = this.buildNestedObjectSchema(value as ObjectTypeAnnotations);\n } else if (value.constraintType == ConstraintType.number) {\n shape[key] = this.buildNumberSchema(value as NumberTypeAnnotations);\n }\n });\n return object(shape) as SchemaOf<T>;\n }\n\n private buildStringSchema(options: StringTypeAnnotations) {\n let schema = Yup.string();\n if (options.required) {\n schema = schema.required(options.required.message);\n }\n if (options.length) {\n schema = schema.length(options.length.length, options.length.message);\n }\n\n if (options.maxLength) {\n schema = schema.max(options.maxLength.maxLength, options.maxLength.message);\n }\n\n if (options.minLength) {\n schema = schema.min(options.minLength.minLength, options.minLength.message);\n }\n\n if (options.pattern) {\n schema = schema.matches(options.pattern.pattern, { message: options.pattern.message, excludeEmptyString: true });\n }\n\n return schema;\n }\n\n private buildBooleanSchema(options: BooleanTypeAnnotations) {\n let schema = Yup.boolean();\n if (options.required) {\n schema = schema.required(options.required.message);\n }\n if (options.equals) {\n if (options.equals.equals) {\n schema = schema.isTrue(options.equals.message);\n } else {\n schema = schema.isFalse(options.equals.message);\n }\n }\n\n return schema;\n }\n\n private buildDateSchema(options: DateTypeAnnotations) {\n let schema = Yup.date();\n \n if (options.required) {\n schema = schema.required(options.required.message);\n }\n if (options.min) {\n schema = schema.min(options.min.min, options.min.message);\n }\n if (options.max) {\n schema = schema.max(options.max.max, options.max.message);\n }\n if (options.test) {\n schema = schema.test({\n name: options.test.name,\n message: options.test.message,\n test: (d?: Date, context?: any) => {\n return options.test!.test(d!);\n }});\n }\n\n return schema;\n }\n\n private buildNumberSchema(options: NumberTypeAnnotations) {\n let schema = Yup.number();\n if (options.required) {\n schema = schema.required(options.required.message);\n }\n\n return schema;\n }\n\n private buildNestedObjectSchema(options: ObjectTypeAnnotations) {\n\n let nestedSchema = this.buildObjectSchema(options.getInstance());\n if(options.required) {\n nestedSchema = nestedSchema.required();\n }\n\n return nestedSchema;\n }\n}\n","import { Component, Input, OnInit } from '@angular/core';\nimport { NgControl, ValidationErrors } from '@angular/forms';\n\n@Component({\n selector: 'mz-field-errors',\n templateUrl: './field-errors.component.html',\n styleUrls: ['./field-errors.component.css'],\n})\nexport class FieldErrorsComponent {\n @Input() field?: NgControl;\n\n get errorMessage(): string {\n const errorKeys = Object.keys(this.field?.errors || {});\n return errorKeys.length > 0 ? (this.field?.errors as ValidationErrors)[errorKeys[0]] : '';\n }\n}\n","<div class=\"field-error\" *ngIf=\"errorMessage\">{{ errorMessage }}</div>\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { FieldErrorsComponent } from './field-errors/field-errors.component';\n\n\n\n@NgModule({\n providers: [],\n declarations: [\n FieldErrorsComponent\n ],\n exports: [\n FieldErrorsComponent\n ],\n imports: [\n CommonModule // TODO: can remove once done with temp error displaying\n ]\n})\nexport class FormsModule { }\n","import { AbstractControl, FormArray, FormGroup, NgForm, NgModelGroup, ValidationErrors } from '@angular/forms';\nimport { BehaviorSubject, distinctUntilChanged, from, switchMap } from 'rxjs';\nimport { FieldError } from './field-error';\nimport { ModelStateOptions } from './model-state-options';\nimport { ModelStateResult } from './model-state-result';\nimport { ModelValidator } from './model-validator';\n\nexport class NgFormModelState<T> {\n private changesSubject = new BehaviorSubject<ModelStateResult<T> | undefined>(undefined);\n public readonly changes = this.changesSubject.asObservable();\n\n constructor(private form: NgForm, private modelValidator: ModelValidator<T>, private options?: ModelStateOptions) {\n this.form.form.valueChanges\n .pipe(\n switchMap(async (x) => {\n return from(this.validate());\n })\n )\n .subscribe();\n }\n\n getCurrent(): ModelStateResult<T> | undefined {\n return this.changesSubject.value;\n }\n\n setErrors(errors: FieldError[]) {\n //this.errors.next(errors);\n throw new Error('needs implementation');\n }\n\n async validate(): Promise<ModelStateResult<T>> {\n const model = this.form.value;\n const state = await this.runValidations(model, this.options?.onValidate);\n this.deleteFormErrors();\n\n const grouped = state.errors.reduce((grouped, v) => grouped.set(v.path, [...(grouped.get(v.path) || []), v]), new Map<string, FieldError[]>());\n grouped.forEach((value, path) => {\n let validationErrors = <ValidationErrors>{};\n value.forEach((v) => (validationErrors[v.type] = v.message));\n\n const control = this.form.form.get(path);\n if (!control) {\n // TODO: use actual logging service\n } else {\n control.setErrors(validationErrors);\n }\n });\n\n this.changesSubject.next(state);\n return state;\n }\n\n private deleteFormErrors() {\n this.deleteErrors(this.form.form);\n }\n\n private deleteErrors(rootFormGroup: FormGroup) {\n Object.keys(rootFormGroup.controls).forEach((key) => {\n const control = rootFormGroup.controls[key];\n\n if (!this.isParentControl(control)) {\n this.deleteErrorsFromControl(key, control);\n } else if (control instanceof FormGroup) {\n this.deleteErrors(control as FormGroup);\n } else if (control instanceof FormArray) {\n this.loopFormArray(control as FormArray);\n }\n });\n }\n\n private deleteErrorsFromControl(key: string | number, control: AbstractControl) {\n control.setErrors(null);\n }\n\n private isParentControl(control: AbstractControl) {\n return control instanceof FormGroup || control instanceof FormArray;\n }\n\n private loopFormArray(formArray: FormArray) {\n formArray.controls.forEach((control, index) => {\n if (!this.isParentControl(control)) {\n this.deleteErrorsFromControl(index, control);\n } else if (control instanceof FormGroup) {\n this.deleteErrors(control as FormGroup);\n } else if (control instanceof FormArray) {\n this.loopFormArray(control as FormArray);\n }\n });\n }\n\n private async runValidations<T>(model: T, callback?: (list: FieldError[]) => FieldError[]): Promise<ModelStateResult<T>> {\n const list = await this.modelValidator.validate(model);\n const final = callback?.(list) || list;\n return {\n valid: final.length === 0,\n errors: final,\n model: model,\n };\n }\n}\n","import { Injectable, NO_ERRORS_SCHEMA } from '@angular/core';\nimport { NgForm, ValidationErrors } from '@angular/forms';\nimport { BehaviorSubject, filter, from, switchMap } from 'rxjs';\nimport { FieldError } from './field-error';\nimport { ModelSchemaFactory } from './model-schema.factory';\nimport { ModelStateOptions } from './model-state-options';\nimport { ModelValidator } from './model-validator';\nimport { NgFormModelState } from './ngform-model-state';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class NgFormModelStateFactory {\n constructor(private factory: ModelSchemaFactory) {}\n\n create<T>(form: NgForm, model: T, options?: ModelStateOptions) {\n const modelState = new NgFormModelState<T>(form, this.factory.build(model), options);\n return modelState;\n }\n}\n","import { format, isValid, parse } from 'date-fns';\nimport * as IMask from 'imask';\n\nexport const dateMaskOptions = {\n mask: 'MM/dd/yyyy',\n format: (date: Date | undefined): string => {\n if (!date) {\n return '';\n }\n return format(date, 'MM/dd/yyyy');\n },\n parse: (str: string): Date | undefined => {\n const dateRegex = /(0[1-9]|1[0-2])\\/(0[1-9]|[12]\\d|3[01])\\/([12]\\d{3})/;\n if (!str.match(dateRegex)) {\n return undefined;\n }\n const parsed = parse(str, 'MM/dd/yyyy', new Date());\n if (isValid(parsed)) {\n return parsed;\n }\n return undefined;\n },\n blocks: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n MM: {\n mask: IMask.MaskedRange,\n from: 1,\n to: 12,\n },\n // eslint-disable-next-line @typescript-eslint/naming-convention\n dd: {\n mask: IMask.MaskedRange,\n from: 1,\n to: 31,\n },\n // eslint-disable-next-line @typescript-eslint/naming-convention\n yyyy: {\n mask: IMask.MaskedRange,\n from: 1000,\n to: 9999,\n },\n },\n};\n\nexport const phoneNumberOptions = {\n mask: '(000) 000-0000',\n};\n\nexport const currencyOptions = {\n mask: 'num',\n lazy: false,\n blocks: {\n num: {\n mask: Number,\n scale: 2,\n thousandsSeparator: ',',\n padFractionalZeros: true,\n radix: '.',\n mapToRadix: ['.'],\n },\n },\n};\n","/*\n * Public API Surface of forms\n */\nexport * from './lib/field-error';\nexport * from './lib/model-state-result';\nexport * from './lib/model-schema.factory';\nexport * from './lib/model-validator';\nexport * from './lib/type-annotations';\nexport * from './lib/forms.module';\nexport * from './lib/ng-form-model-state.service';\nexport * from './lib/ngform-model-state';\nexport * from './lib/field-errors/field-errors.component';\nexport * from './lib/masks';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.ModelSchemaFactory"],"mappings":";;;;;;;;;;;;MAGa,cAAc,CAAA;AAEzB,IAAA,WAAA,CAAY,WAAwB,EAAA;AAClC,QAAA,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC;KAC3B;AAED,IAAA,QAAQ,CAAI,KAAQ,EAAA;QAClB,OAAO,IAAI,CAAC,MAAM;aACf,QAAQ,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;aACtC,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"muziehdesign-forms.mjs","sources":["../../../../projects/muziehdesign/forms/src/lib/model-validator.ts","../../../../projects/muziehdesign/forms/src/lib/constants.ts","../../../../projects/muziehdesign/forms/src/lib/type-annotations.ts","../../../../projects/muziehdesign/forms/src/lib/model-schema.factory.ts","../../../../projects/muziehdesign/forms/src/lib/field-errors/field-errors.component.ts","../../../../projects/muziehdesign/forms/src/lib/field-errors/field-errors.component.html","../../../../projects/muziehdesign/forms/src/lib/forms.module.ts","../../../../projects/muziehdesign/forms/src/lib/ngform-model-state.ts","../../../../projects/muziehdesign/forms/src/lib/ng-form-model-state.service.ts","../../../../projects/muziehdesign/forms/src/lib/masks.ts","../../../../projects/muziehdesign/forms/src/public-api.ts","../../../../projects/muziehdesign/forms/src/muziehdesign-forms.ts"],"sourcesContent":["import { SchemaOf, ValidationError } from 'yup';\nimport { FieldError } from './field-error';\n\nexport class ModelValidator<T> {\n private schema: SchemaOf<T>;\n constructor(modelSchema: SchemaOf<T>) {\n this.schema = modelSchema;\n }\n\n validate<T>(model: T): Promise<FieldError[]> {\n return this.schema\n .validate(model, { abortEarly: false })\n .then(() => {\n return [];\n })\n .catch((e: ValidationError) => {\n return e.inner.map((error) => <FieldError>{ path: error.path, type: error.type, message: error.message });\n });\n }\n}\n","export const SCHEMA_METADATA_NAMESPACE = 'custom:muziehdesign:annotations';\n","import 'reflect-metadata';\n\nconst METADATA_KEY = 'custom:muziehdesign:annotations';\n\nexport enum ConstraintType {\n string,\n boolean,\n date,\n object,\n number,\n}\n\nexport interface ConstraintAnnotations {\n constraintType: ConstraintType;\n}\n\nexport interface StringTypeAnnotations extends ConstraintAnnotations {\n required?: RequiredAnnotation;\n length?: LengthAnnotation;\n pattern?: PatternAnnotation;\n maxLength?: MaxLengthAnnotation;\n minLength?: MinLengthAnnotation;\n}\n\nexport interface BooleanTypeAnnotations extends ConstraintAnnotations {\n required?: RequiredAnnotation;\n equals?: EqualsAnnotation<boolean>;\n}\n\nexport interface DateTypeAnnotations extends ConstraintAnnotations {\n required?: RequiredAnnotation;\n min?: MinimumAnnotation<Date>;\n max?: MaximumAnnotation<Date>;\n test?: TestAnnotation<Date>;\n}\n\nexport interface ObjectTypeAnnotations extends ConstraintAnnotations {\n required?: RequiredAnnotation;\n getInstance: () => any;\n}\n\nexport interface NumberTypeAnnotations extends ConstraintAnnotations {\n required?: RequiredAnnotation;\n}\n\nexport interface ValidationAnnotation {\n message?: string;\n}\n\nexport interface RequiredAnnotation extends ValidationAnnotation {\n required: boolean;\n}\n\nexport interface LengthAnnotation extends ValidationAnnotation {\n length: number;\n}\n\nexport interface PatternAnnotation extends ValidationAnnotation {\n pattern: RegExp;\n}\n\nexport interface OfValuesAnnotation extends ValidationAnnotation {\n values: [];\n}\n\nexport interface EqualsAnnotation<T> extends ValidationAnnotation {\n equals: T;\n}\n\nexport interface MinimumAnnotation<T> extends ValidationAnnotation {\n min: T;\n}\n\nexport interface MaximumAnnotation<T> extends ValidationAnnotation {\n max: T;\n}\n\nexport interface TestAnnotation<T> extends ValidationAnnotation {\n test: (d: T) => boolean;\n name: string;\n}\n\nexport interface MaxLengthAnnotation extends ValidationAnnotation {\n maxLength: number;\n}\n\nexport interface MinLengthAnnotation extends ValidationAnnotation {\n minLength: number;\n}\n\nconst registerMetadata = (target: Object, propertyKey: string, constraint: ConstraintAnnotations) => {\n const metadata: Map<string, any> = Reflect.getMetadata(METADATA_KEY, target) || new Map<string, any>();\n metadata.set(propertyKey, constraint);\n Reflect.defineMetadata(METADATA_KEY, metadata, target);\n};\n\nexport function StringType(...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations) as StringTypeAnnotations;\n o.constraintType = ConstraintType.string;\n registerMetadata(target, propertyKey, o);\n };\n}\n\nexport function BooleanType(...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations) as BooleanTypeAnnotations;\n o.constraintType = ConstraintType.boolean;\n registerMetadata(target, propertyKey, o);\n };\n}\n\nexport function DateType(...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations) as DateTypeAnnotations;\n o.constraintType = ConstraintType.date;\n registerMetadata(target, propertyKey, o);\n };\n}\n\nexport function NumberType(...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations) as NumberTypeAnnotations;\n o.constraintType = ConstraintType.number;\n registerMetadata(target, propertyKey, o);\n };\n}\n\nexport function ObjectType<T>(type: { new (): T }, ...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations, { getInstance: () => new type() } as Partial<ObjectTypeAnnotations>) as ObjectTypeAnnotations;\n o.constraintType = ConstraintType.object;\n registerMetadata(target, propertyKey, o);\n };\n}\n\nexport function required(message?: string): { [key: string]: RequiredAnnotation } {\n return { required: { required: true, message: message } };\n}\n\nexport function pattern(regex: RegExp, message?: string): { [key: string]: PatternAnnotation } {\n return { pattern: { pattern: regex, message: message } };\n}\n\nexport function length(length: number, message?: string): { [key: string]: LengthAnnotation } {\n return { length: { length: length, message: message } };\n}\n\nexport function maxLength(maxLength: number, message?: string): { [key: string]: MaxLengthAnnotation } {\n return { maxLength: { maxLength: maxLength, message: message } };\n}\n\nexport function minLength(minLength: number, message?: string): { [key: string]: MinLengthAnnotation } {\n return { minLength: { minLength: minLength, message: message } };\n}\n\nexport function ofValues(values: [], message?: string): { [key: string]: OfValuesAnnotation } {\n return { ofValues: { values: values, message: message } };\n}\n\nexport function equals<T>(value: T, message?: string): { [key: string]: EqualsAnnotation<T> } {\n return { equals: { equals: value, message: message } };\n}\n\nexport function min<T>(value: T, message?: string): { [key: string]: MinimumAnnotation<T> } {\n return { min: { min: value, message: message } };\n}\n\nexport function max<T>(value: T, message?: string): { [key: string]: MaximumAnnotation<T> } {\n return { max: { max: value, message: message } };\n}\n\nexport function test<T>(name: string, test: (d: T) => boolean, message?: string): { [key: string]: TestAnnotation<T> } {\n return { test: { name: name, test: test, message: message } };\n}\n","import { Injectable } from '@angular/core';\nimport { object, SchemaOf } from 'yup';\nimport { ModelValidator } from './model-validator';\nimport { SCHEMA_METADATA_NAMESPACE } from './constants';\nimport { ObjectShape } from 'yup/lib/object';\nimport { BooleanTypeAnnotations, ConstraintAnnotations, ConstraintType, DateTypeAnnotations, ObjectTypeAnnotations, NumberTypeAnnotations, StringTypeAnnotations } from './type-annotations';\nimport * as Yup from 'yup';\n\n/*\nSchema rules need to be built in the order they need to be evaluated in.\nFor example,\n ```\n schema.required().max(...).matches(...);\n ```\nevaluates the 3 rules in this order\n - required\n - max\n - matches\n*/\n\n@Injectable({\n providedIn: 'root',\n})\nexport class ModelSchemaFactory {\n constructor() {}\n\n build<T>(model: T): ModelValidator<T> {\n const schema = this.buildObjectSchema(model);\n return new ModelValidator(schema);\n }\n\n private buildObjectSchema<T>(model: T) {\n const metadata: Map<string, ConstraintAnnotations> = Reflect.getMetadata(SCHEMA_METADATA_NAMESPACE, model);\n let shape: ObjectShape = {};\n metadata.forEach((value, key) => {\n if (value.constraintType == ConstraintType.string) {\n shape[key] = this.buildStringSchema(value as StringTypeAnnotations);\n } else if (value.constraintType == ConstraintType.boolean) {\n shape[key] = this.buildBooleanSchema(value as BooleanTypeAnnotations);\n } else if (value.constraintType == ConstraintType.date) {\n shape[key] = this.buildDateSchema(value as DateTypeAnnotations);\n } else if(value.constraintType == ConstraintType.object) {\n shape[key] = this.buildNestedObjectSchema(value as ObjectTypeAnnotations);\n } else if (value.constraintType == ConstraintType.number) {\n shape[key] = this.buildNumberSchema(value as NumberTypeAnnotations);\n }\n });\n return object(shape) as SchemaOf<T>;\n }\n\n private buildStringSchema(options: StringTypeAnnotations) {\n let schema = Yup.string();\n if (options.required) {\n schema = schema.required(options.required.message);\n }\n if (options.length) {\n schema = schema.length(options.length.length, options.length.message);\n }\n\n if (options.maxLength) {\n schema = schema.max(options.maxLength.maxLength, options.maxLength.message);\n }\n\n if (options.minLength) {\n schema = schema.min(options.minLength.minLength, options.minLength.message);\n }\n\n if (options.pattern) {\n schema = schema.matches(options.pattern.pattern, { message: options.pattern.message, excludeEmptyString: true });\n }\n\n return schema;\n }\n\n private buildBooleanSchema(options: BooleanTypeAnnotations) {\n let schema = Yup.boolean();\n if (options.required) {\n schema = schema.required(options.required.message);\n }\n if (options.equals) {\n if (options.equals.equals) {\n schema = schema.isTrue(options.equals.message);\n } else {\n schema = schema.isFalse(options.equals.message);\n }\n }\n\n return schema;\n }\n\n private buildDateSchema(options: DateTypeAnnotations) {\n let schema = Yup.date();\n \n if (options.required) {\n schema = schema.required(options.required.message);\n }\n if (options.min) {\n schema = schema.min(options.min.min, options.min.message);\n }\n if (options.max) {\n schema = schema.max(options.max.max, options.max.message);\n }\n if (options.test) {\n schema = schema.test({\n name: options.test.name,\n message: options.test.message,\n test: (d?: Date, context?: any) => {\n return options.test!.test(d!);\n }});\n }\n\n return schema;\n }\n\n private buildNumberSchema(options: NumberTypeAnnotations) {\n let schema = Yup.number();\n if (options.required) {\n schema = schema.required(options.required.message);\n }\n\n return schema;\n }\n\n private buildNestedObjectSchema(options: ObjectTypeAnnotations) {\n\n let nestedSchema = this.buildObjectSchema(options.getInstance());\n if(options.required) {\n nestedSchema = nestedSchema.required();\n }\n\n return nestedSchema;\n }\n}\n","import { Component, Input, OnInit } from '@angular/core';\nimport { NgControl, ValidationErrors } from '@angular/forms';\n\n@Component({\n selector: 'mz-field-errors',\n templateUrl: './field-errors.component.html',\n styleUrls: ['./field-errors.component.css'],\n})\nexport class FieldErrorsComponent {\n @Input() field?: NgControl;\n\n get errorMessage(): string {\n const errorKeys = Object.keys(this.field?.errors || {});\n return errorKeys.length > 0 ? (this.field?.errors as ValidationErrors)[errorKeys[0]] : '';\n }\n}\n","<div class=\"field-error\" *ngIf=\"errorMessage\">{{ errorMessage }}</div>\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { FieldErrorsComponent } from './field-errors/field-errors.component';\n\n\n\n@NgModule({\n providers: [],\n declarations: [\n FieldErrorsComponent\n ],\n exports: [\n FieldErrorsComponent\n ],\n imports: [\n CommonModule // TODO: can remove once done with temp error displaying\n ]\n})\nexport class FormsModule { }\n","import { AbstractControl, FormArray, FormGroup, NgForm, NgModelGroup, ValidationErrors } from '@angular/forms';\nimport { BehaviorSubject, distinctUntilChanged, from, switchMap } from 'rxjs';\nimport { FieldError } from './field-error';\nimport { ModelStateOptions } from './model-state-options';\nimport { ModelStateResult } from './model-state-result';\nimport { ModelValidator } from './model-validator';\n\nexport class NgFormModelState<T> {\n private changesSubject = new BehaviorSubject<ModelStateResult<T> | undefined>(undefined);\n public readonly changes = this.changesSubject.asObservable();\n\n constructor(private form: NgForm, private modelValidator: ModelValidator<T>, private options?: ModelStateOptions) {\n this.form.form.valueChanges\n .pipe(\n switchMap(async (x) => {\n return from(this.validate());\n })\n )\n .subscribe();\n }\n\n getCurrent(): ModelStateResult<T> | undefined {\n return this.changesSubject.value;\n }\n\n setState(model: T, errors: FieldError[]) {\n const state = {\n model: model,\n errors: errors,\n valid: errors.length === 0,\n } as ModelStateResult<T>;\n this.setStateInternal(state);\n }\n\n setErrors(errors: FieldError[]) {\n //this.errors.next(errors);\n throw new Error('needs implementation');\n }\n\n appendErrors(errors: FieldError[], skipEmit?: boolean) {\n const allErrors = [...(this.changesSubject.value?.errors || []), ...errors];\n const state = { ...this.changesSubject.value } as ModelStateResult<T>;\n state.errors = allErrors;\n this.setStateInternal(state);\n }\n\n async validate(): Promise<ModelStateResult<T>> {\n const model = this.form.value;\n const state = await this.runValidations(model, this.options?.onValidate);\n this.setStateInternal(state);\n return state;\n }\n\n private setStateInternal(state: ModelStateResult<T>) {\n this.deleteFormErrors();\n\n const grouped = state.errors.reduce((grouped, v) => grouped.set(v.path, [...(grouped.get(v.path) || []), v]), new Map<string, FieldError[]>());\n grouped.forEach((value, path) => {\n let validationErrors = <ValidationErrors>{};\n value.forEach((v) => (validationErrors[v.type] = v.message));\n\n const control = this.form.form.get(path);\n if (!control) {\n // TODO: use actual logging service\n } else {\n control.setErrors(validationErrors);\n }\n });\n\n this.changesSubject.next(state);\n }\n\n private deleteFormErrors() {\n this.deleteErrors(this.form.form);\n }\n\n private deleteErrors(rootFormGroup: FormGroup) {\n Object.keys(rootFormGroup.controls).forEach((key) => {\n const control = rootFormGroup.controls[key];\n\n if (!this.isParentControl(control)) {\n this.deleteErrorsFromControl(key, control);\n } else if (control instanceof FormGroup) {\n this.deleteErrors(control as FormGroup);\n } else if (control instanceof FormArray) {\n this.loopFormArray(control as FormArray);\n }\n });\n }\n\n private deleteErrorsFromControl(key: string | number, control: AbstractControl) {\n control.setErrors(null);\n }\n\n private isParentControl(control: AbstractControl) {\n return control instanceof FormGroup || control instanceof FormArray;\n }\n\n private loopFormArray(formArray: FormArray) {\n formArray.controls.forEach((control, index) => {\n if (!this.isParentControl(control)) {\n this.deleteErrorsFromControl(index, control);\n } else if (control instanceof FormGroup) {\n this.deleteErrors(control as FormGroup);\n } else if (control instanceof FormArray) {\n this.loopFormArray(control as FormArray);\n }\n });\n }\n\n private async runValidations<T>(model: T, callback?: (list: FieldError[]) => FieldError[]): Promise<ModelStateResult<T>> {\n const list = await this.modelValidator.validate(model);\n const final = callback?.(list) || list;\n return {\n valid: final.length === 0,\n errors: final,\n model: model,\n };\n }\n}\n","import { Injectable, NO_ERRORS_SCHEMA } from '@angular/core';\nimport { NgForm, ValidationErrors } from '@angular/forms';\nimport { BehaviorSubject, filter, from, switchMap } from 'rxjs';\nimport { FieldError } from './field-error';\nimport { ModelSchemaFactory } from './model-schema.factory';\nimport { ModelStateOptions } from './model-state-options';\nimport { ModelValidator } from './model-validator';\nimport { NgFormModelState } from './ngform-model-state';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class NgFormModelStateFactory {\n constructor(private factory: ModelSchemaFactory) {}\n\n create<T>(form: NgForm, model: T, options?: ModelStateOptions) {\n const modelState = new NgFormModelState<T>(form, this.factory.build(model), options);\n return modelState;\n }\n}\n","import { format, isValid, parse } from 'date-fns';\nimport * as IMask from 'imask';\n\nexport const dateMaskOptions = {\n mask: 'MM/dd/yyyy',\n format: (date: Date | undefined): string => {\n if (!date) {\n return '';\n }\n return format(date, 'MM/dd/yyyy');\n },\n parse: (str: string): Date | undefined => {\n const dateRegex = /(0[1-9]|1[0-2])\\/(0[1-9]|[12]\\d|3[01])\\/([12]\\d{3})/;\n if (!str.match(dateRegex)) {\n return undefined;\n }\n const parsed = parse(str, 'MM/dd/yyyy', new Date());\n if (isValid(parsed)) {\n return parsed;\n }\n return undefined;\n },\n blocks: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n MM: {\n mask: IMask.MaskedRange,\n from: 1,\n to: 12,\n },\n // eslint-disable-next-line @typescript-eslint/naming-convention\n dd: {\n mask: IMask.MaskedRange,\n from: 1,\n to: 31,\n },\n // eslint-disable-next-line @typescript-eslint/naming-convention\n yyyy: {\n mask: IMask.MaskedRange,\n from: 1000,\n to: 9999,\n },\n },\n};\n\nexport const phoneNumberOptions = {\n mask: '(000) 000-0000',\n};\n\nexport const currencyOptions = {\n mask: 'num',\n lazy: false,\n blocks: {\n num: {\n mask: Number,\n scale: 2,\n thousandsSeparator: ',',\n padFractionalZeros: true,\n radix: '.',\n mapToRadix: ['.'],\n },\n },\n};\n\nexport const integerOptions = {\n mask: Number,\n scale: 0,\n thousandsSeparator: ',',\n padFractionalZeros: true,\n radix: '.',\n mapToRadix: ['.'],\n};","/*\n * Public API Surface of forms\n */\nexport * from './lib/field-error';\nexport * from './lib/model-state-result';\nexport * from './lib/model-schema.factory';\nexport * from './lib/model-validator';\nexport * from './lib/type-annotations';\nexport * from './lib/forms.module';\nexport * from './lib/ng-form-model-state.service';\nexport * from './lib/ngform-model-state';\nexport * from './lib/field-errors/field-errors.component';\nexport * from './lib/masks';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1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d.ts
CHANGED
|
@@ -38,3 +38,11 @@ export declare const currencyOptions: {
|
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
|
+
export declare const integerOptions: {
|
|
42
|
+
mask: NumberConstructor;
|
|
43
|
+
scale: number;
|
|
44
|
+
thousandsSeparator: string;
|
|
45
|
+
padFractionalZeros: boolean;
|
|
46
|
+
radix: string;
|
|
47
|
+
mapToRadix: string[];
|
|
48
|
+
};
|
|
@@ -11,8 +11,11 @@ export declare class NgFormModelState<T> {
|
|
|
11
11
|
readonly changes: import("rxjs").Observable<ModelStateResult<T> | undefined>;
|
|
12
12
|
constructor(form: NgForm, modelValidator: ModelValidator<T>, options?: ModelStateOptions | undefined);
|
|
13
13
|
getCurrent(): ModelStateResult<T> | undefined;
|
|
14
|
+
setState(model: T, errors: FieldError[]): void;
|
|
14
15
|
setErrors(errors: FieldError[]): void;
|
|
16
|
+
appendErrors(errors: FieldError[], skipEmit?: boolean): void;
|
|
15
17
|
validate(): Promise<ModelStateResult<T>>;
|
|
18
|
+
private setStateInternal;
|
|
16
19
|
private deleteFormErrors;
|
|
17
20
|
private deleteErrors;
|
|
18
21
|
private deleteErrorsFromControl;
|