@muziehdesign/forms 0.0.640-alpha → 0.0.645-alpha
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/field-errors/field-errors.component.mjs +18 -0
- package/{esm2022 → esm2020}/lib/forms.module.mjs +7 -7
- package/esm2020/lib/model-schema.factory.mjs +158 -0
- package/esm2020/lib/ng-form-model-state.service.mjs +22 -0
- package/fesm2015/muziehdesign-forms.mjs +517 -0
- package/fesm2015/muziehdesign-forms.mjs.map +1 -0
- package/{fesm2022 → fesm2020}/muziehdesign-forms.mjs +16 -16
- package/fesm2020/muziehdesign-forms.mjs.map +1 -0
- package/lib/field-errors/field-errors.component.d.ts +1 -1
- package/lib/model-schema.factory.d.ts +1 -1
- package/lib/ng-form-model-state.service.d.ts +1 -1
- package/package.json +14 -8
- package/esm2022/lib/field-errors/field-errors.component.mjs +0 -18
- package/esm2022/lib/model-schema.factory.mjs +0 -158
- package/esm2022/lib/ng-form-model-state.service.mjs +0 -22
- package/fesm2022/muziehdesign-forms.mjs.map +0 -1
- /package/{esm2022 → esm2020}/lib/constants.mjs +0 -0
- /package/{esm2022 → esm2020}/lib/field-error.mjs +0 -0
- /package/{esm2022 → esm2020}/lib/masks.mjs +0 -0
- /package/{esm2022 → esm2020}/lib/model-state-options.mjs +0 -0
- /package/{esm2022 → esm2020}/lib/model-state-result.mjs +0 -0
- /package/{esm2022 → esm2020}/lib/model-validator.mjs +0 -0
- /package/{esm2022 → esm2020}/lib/ngform-model-state.mjs +0 -0
- /package/{esm2022 → esm2020}/lib/type-annotations.mjs +0 -0
- /package/{esm2022 → esm2020}/muziehdesign-forms.mjs +0 -0
- /package/{esm2022 → esm2020}/public-api.mjs +0 -0
|
@@ -265,10 +265,10 @@ class ModelSchemaFactory {
|
|
|
265
265
|
}
|
|
266
266
|
return schema;
|
|
267
267
|
}
|
|
268
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: ModelSchemaFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
269
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: ModelSchemaFactory, providedIn: 'root' }); }
|
|
270
268
|
}
|
|
271
|
-
i0.ɵɵ
|
|
269
|
+
ModelSchemaFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: ModelSchemaFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
270
|
+
ModelSchemaFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: ModelSchemaFactory, providedIn: 'root' });
|
|
271
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: ModelSchemaFactory, decorators: [{
|
|
272
272
|
type: Injectable,
|
|
273
273
|
args: [{
|
|
274
274
|
providedIn: 'root',
|
|
@@ -278,12 +278,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImpor
|
|
|
278
278
|
class FieldErrorsComponent {
|
|
279
279
|
get errorMessage() {
|
|
280
280
|
const errorKeys = Object.keys(this.field?.errors || {});
|
|
281
|
-
return errorKeys.length > 0 ?
|
|
281
|
+
return errorKeys.length > 0 ? this.field?.errors[errorKeys[0]] : '';
|
|
282
282
|
}
|
|
283
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: FieldErrorsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
284
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: FieldErrorsComponent, selector: "mz-field-errors", inputs: { field: "field" }, ngImport: i0, template: "<div class=\"field-error\" *ngIf=\"errorMessage\">{{ errorMessage }}</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
285
283
|
}
|
|
286
|
-
i0.ɵɵ
|
|
284
|
+
FieldErrorsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: FieldErrorsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
285
|
+
FieldErrorsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.5", type: FieldErrorsComponent, selector: "mz-field-errors", inputs: { field: "field" }, ngImport: i0, template: "<div class=\"field-error\" *ngIf=\"errorMessage\">{{ errorMessage }}</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
286
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: FieldErrorsComponent, decorators: [{
|
|
287
287
|
type: Component,
|
|
288
288
|
args: [{ selector: 'mz-field-errors', template: "<div class=\"field-error\" *ngIf=\"errorMessage\">{{ errorMessage }}</div>\n" }]
|
|
289
289
|
}], propDecorators: { field: [{
|
|
@@ -291,13 +291,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImpor
|
|
|
291
291
|
}] } });
|
|
292
292
|
|
|
293
293
|
class FormsModule {
|
|
294
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: FormsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
295
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.2", ngImport: i0, type: FormsModule, declarations: [FieldErrorsComponent], imports: [CommonModule // TODO: can remove once done with temp error displaying
|
|
296
|
-
], exports: [FieldErrorsComponent] }); }
|
|
297
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: FormsModule, imports: [CommonModule // TODO: can remove once done with temp error displaying
|
|
298
|
-
] }); }
|
|
299
294
|
}
|
|
300
|
-
i0.ɵɵ
|
|
295
|
+
FormsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: FormsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
296
|
+
FormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.5", ngImport: i0, type: FormsModule, declarations: [FieldErrorsComponent], imports: [CommonModule // TODO: can remove once done with temp error displaying
|
|
297
|
+
], exports: [FieldErrorsComponent] });
|
|
298
|
+
FormsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: FormsModule, imports: [CommonModule // TODO: can remove once done with temp error displaying
|
|
299
|
+
] });
|
|
300
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: FormsModule, decorators: [{
|
|
301
301
|
type: NgModule,
|
|
302
302
|
args: [{
|
|
303
303
|
providers: [],
|
|
@@ -424,10 +424,10 @@ class NgFormModelStateFactory {
|
|
|
424
424
|
const modelState = new NgFormModelState(form, this.factory.build(model), options);
|
|
425
425
|
return modelState;
|
|
426
426
|
}
|
|
427
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgFormModelStateFactory, deps: [{ token: ModelSchemaFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
428
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgFormModelStateFactory, providedIn: 'root' }); }
|
|
429
427
|
}
|
|
430
|
-
i0.ɵɵ
|
|
428
|
+
NgFormModelStateFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: NgFormModelStateFactory, deps: [{ token: ModelSchemaFactory }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
429
|
+
NgFormModelStateFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: NgFormModelStateFactory, providedIn: 'root' });
|
|
430
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.5", ngImport: i0, type: NgFormModelStateFactory, decorators: [{
|
|
431
431
|
type: Injectable,
|
|
432
432
|
args: [{
|
|
433
433
|
providedIn: 'root',
|
|
@@ -0,0 +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 array,\n file\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 min?: MinimumAnnotation<number>;\n max?: MaximumAnnotation<number>;\n}\n\nexport interface ArrayTypeAnnotations extends ConstraintAnnotations {\n min?: MinimumAnnotation<number>;\n max?: MaximumAnnotation<number>;\n}\n\nexport interface FileTypeAnnotations 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 ArrayType(...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations) as ArrayTypeAnnotations;\n o.constraintType = ConstraintType.array;\n registerMetadata(target, propertyKey, o);\n };\n}\n\nexport function FileType<T>(...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations) as FileTypeAnnotations;\n o.constraintType = ConstraintType.file;\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 {\n BooleanTypeAnnotations,\n ConstraintAnnotations,\n ConstraintType,\n DateTypeAnnotations,\n ObjectTypeAnnotations,\n NumberTypeAnnotations,\n StringTypeAnnotations,\n ArrayTypeAnnotations,\n FileTypeAnnotations,\n} 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 } else if (value.constraintType == ConstraintType.array) {\n shape[key] = this.buildArraySchema(value as ArrayTypeAnnotations);\n } else if (value.constraintType == ConstraintType.file) {\n shape[key] = this.buildFileSchema(value as FileTypeAnnotations);\n }\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\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 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\n return schema;\n }\n\n private buildArraySchema(options: ArrayTypeAnnotations) {\n let schema = Yup.array();\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\n return schema;\n }\n\n private buildNestedObjectSchema(options: ObjectTypeAnnotations) {\n let nestedSchema = this.buildObjectSchema(options.getInstance());\n if (options.required) {\n nestedSchema = nestedSchema.required();\n } else {\n nestedSchema = nestedSchema.notRequired().default(undefined);\n }\n\n return nestedSchema;\n }\n\n private buildFileSchema(options: FileTypeAnnotations) {\n let schema = Yup.mixed().nullable().optional();\n if (options.required) {\n schema = schema.required(options.required.message);\n }\n\n return schema;\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\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[]) => Promise<FieldError[]>): Promise<ModelStateResult<T>> {\n const list = await this.modelValidator.validate(model);\n const final = callback ? (await callback?.(list)) : list;\n return {\n valid: final.length === 0,\n errors: final,\n model: model,\n };\n }\n}\n","import { Injectable } from '@angular/core';\nimport { NgForm } from '@angular/forms';\nimport { ModelSchemaFactory } from './model-schema.factory';\nimport { ModelStateOptions } from './model-state-options';\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 ssnOptions = {\n mask: '000-00-0000',\n};\n\nexport const currencyOptions = {\n mask: Number,\n scale: 2,\n thousandsSeparator: ',',\n padFractionalZeros: true,\n radix: '.',\n mapToRadix: ['.'],\n};\n\nexport const integerOptions = {\n mask: Number,\n scale: 0,\n thousandsSeparator: ',',\n padFractionalZeros: true,\n radix: '.',\n mapToRadix: ['.'],\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,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;IAE3C,eAQX;AARD,CAAA,UAAY,cAAc,EAAA;AACxB,IAAA,cAAA,CAAA,cAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAM,CAAA;AACN,IAAA,cAAA,CAAA,cAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAO,CAAA;AACP,IAAA,cAAA,CAAA,cAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI,CAAA;AACJ,IAAA,cAAA,CAAA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,GAAG;IACV,UAAU,EAAE,CAAC,GAAG,CAAC;;;ACnEnB;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -4,5 +4,5 @@ export declare class FieldErrorsComponent {
|
|
|
4
4
|
field?: NgControl;
|
|
5
5
|
get errorMessage(): string;
|
|
6
6
|
static ɵfac: i0.ɵɵFactoryDeclaration<FieldErrorsComponent, never>;
|
|
7
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<FieldErrorsComponent, "mz-field-errors", never, { "field":
|
|
7
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FieldErrorsComponent, "mz-field-errors", never, { "field": "field"; }, {}, never, never, false>;
|
|
8
8
|
}
|
|
@@ -2,7 +2,7 @@ import { ModelValidator } from './model-validator';
|
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
export declare class ModelSchemaFactory {
|
|
4
4
|
constructor();
|
|
5
|
-
build<T
|
|
5
|
+
build<T>(model: T): ModelValidator<T>;
|
|
6
6
|
private buildObjectSchema;
|
|
7
7
|
private buildStringSchema;
|
|
8
8
|
private buildBooleanSchema;
|
|
@@ -6,7 +6,7 @@ import * as i0 from "@angular/core";
|
|
|
6
6
|
export declare class NgFormModelStateFactory {
|
|
7
7
|
private factory;
|
|
8
8
|
constructor(factory: ModelSchemaFactory);
|
|
9
|
-
create<T
|
|
9
|
+
create<T>(form: NgForm, model: T, options?: ModelStateOptions): NgFormModelState<T>;
|
|
10
10
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgFormModelStateFactory, never>;
|
|
11
11
|
static ɵprov: i0.ɵɵInjectableDeclaration<NgFormModelStateFactory>;
|
|
12
12
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@muziehdesign/forms",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.645-alpha",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@angular/common": "^
|
|
6
|
-
"@angular/core": "^
|
|
7
|
-
"@angular/forms": "^
|
|
5
|
+
"@angular/common": "^14.0.0",
|
|
6
|
+
"@angular/core": "^14.0.0",
|
|
7
|
+
"@angular/forms": "^14.0.0",
|
|
8
8
|
"date-fns": "^2.29.2",
|
|
9
9
|
"angular-imask": "^6.4.0",
|
|
10
10
|
"reflect-metadata": "^0.1.13",
|
|
@@ -13,7 +13,11 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"tslib": "^2.3.0"
|
|
15
15
|
},
|
|
16
|
-
"module": "
|
|
16
|
+
"module": "fesm2015/muziehdesign-forms.mjs",
|
|
17
|
+
"es2020": "fesm2020/muziehdesign-forms.mjs",
|
|
18
|
+
"esm2020": "esm2020/muziehdesign-forms.mjs",
|
|
19
|
+
"fesm2020": "fesm2020/muziehdesign-forms.mjs",
|
|
20
|
+
"fesm2015": "fesm2015/muziehdesign-forms.mjs",
|
|
17
21
|
"typings": "index.d.ts",
|
|
18
22
|
"exports": {
|
|
19
23
|
"./package.json": {
|
|
@@ -21,9 +25,11 @@
|
|
|
21
25
|
},
|
|
22
26
|
".": {
|
|
23
27
|
"types": "./index.d.ts",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
28
|
+
"esm2020": "./esm2020/muziehdesign-forms.mjs",
|
|
29
|
+
"es2020": "./fesm2020/muziehdesign-forms.mjs",
|
|
30
|
+
"es2015": "./fesm2015/muziehdesign-forms.mjs",
|
|
31
|
+
"node": "./fesm2015/muziehdesign-forms.mjs",
|
|
32
|
+
"default": "./fesm2020/muziehdesign-forms.mjs"
|
|
27
33
|
}
|
|
28
34
|
},
|
|
29
35
|
"sideEffects": false
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Component, Input } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
import * as i1 from "@angular/common";
|
|
4
|
-
export class FieldErrorsComponent {
|
|
5
|
-
get errorMessage() {
|
|
6
|
-
const errorKeys = Object.keys(this.field?.errors || {});
|
|
7
|
-
return errorKeys.length > 0 ? (this.field?.errors)[errorKeys[0]] : '';
|
|
8
|
-
}
|
|
9
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: FieldErrorsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
10
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: FieldErrorsComponent, selector: "mz-field-errors", inputs: { field: "field" }, ngImport: i0, template: "<div class=\"field-error\" *ngIf=\"errorMessage\">{{ errorMessage }}</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
11
|
-
}
|
|
12
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: FieldErrorsComponent, decorators: [{
|
|
13
|
-
type: Component,
|
|
14
|
-
args: [{ selector: 'mz-field-errors', template: "<div class=\"field-error\" *ngIf=\"errorMessage\">{{ errorMessage }}</div>\n" }]
|
|
15
|
-
}], propDecorators: { field: [{
|
|
16
|
-
type: Input
|
|
17
|
-
}] } });
|
|
18
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmllbGQtZXJyb3JzLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL211emllaGRlc2lnbi9mb3Jtcy9zcmMvbGliL2ZpZWxkLWVycm9ycy9maWVsZC1lcnJvcnMuY29tcG9uZW50LnRzIiwiLi4vLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvbXV6aWVoZGVzaWduL2Zvcm1zL3NyYy9saWIvZmllbGQtZXJyb3JzL2ZpZWxkLWVycm9ycy5jb21wb25lbnQuaHRtbCJdLCJuYW1lcyI6W10sIm1hcHBp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29udHJvbDtcblxuICBnZXQgZXJyb3JNZXNzYWdlKCk6IHN0cmluZyB7XG4gICAgY29uc3QgZXJyb3JLZXlzID0gT2JqZWN0LmtleXModGhpcy5maWVsZD8uZXJyb3JzIHx8IHt9KTtcbiAgICByZXR1cm4gZXJyb3JLZXlzLmxlbmd0aCA+IDAgPyAodGhpcy5maWVsZD8uZXJyb3JzIGFzIFZhbGlkYXRpb25FcnJvcnMpW2Vycm9yS2V5c1swXV0gOiAnJztcbiAgfVxufVxuIiwiPGRpdiBjbGFzcz1cImZpZWxkLWVycm9yXCIgKm5nSWY9XCJlcnJvck1lc3NhZ2VcIj57eyBlcnJvck1lc3NhZ2UgfX08L2Rpdj5cbiJdfQ==
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { object } from 'yup';
|
|
3
|
-
import { ModelValidator } from './model-validator';
|
|
4
|
-
import { SCHEMA_METADATA_NAMESPACE } from './constants';
|
|
5
|
-
import { ConstraintType, } from './type-annotations';
|
|
6
|
-
import * as Yup from 'yup';
|
|
7
|
-
import * as i0 from "@angular/core";
|
|
8
|
-
/*
|
|
9
|
-
Schema rules need to be built in the order they need to be evaluated in.
|
|
10
|
-
For example,
|
|
11
|
-
```
|
|
12
|
-
schema.required().max(...).matches(...);
|
|
13
|
-
```
|
|
14
|
-
evaluates the 3 rules in this order
|
|
15
|
-
- required
|
|
16
|
-
- max
|
|
17
|
-
- matches
|
|
18
|
-
*/
|
|
19
|
-
export class ModelSchemaFactory {
|
|
20
|
-
constructor() { }
|
|
21
|
-
build(model) {
|
|
22
|
-
const schema = this.buildObjectSchema(model);
|
|
23
|
-
return new ModelValidator(schema);
|
|
24
|
-
}
|
|
25
|
-
buildObjectSchema(model) {
|
|
26
|
-
const metadata = Reflect.getMetadata(SCHEMA_METADATA_NAMESPACE, model);
|
|
27
|
-
let shape = {};
|
|
28
|
-
metadata.forEach((value, key) => {
|
|
29
|
-
if (value.constraintType == ConstraintType.string) {
|
|
30
|
-
shape[key] = this.buildStringSchema(value);
|
|
31
|
-
}
|
|
32
|
-
else if (value.constraintType == ConstraintType.boolean) {
|
|
33
|
-
shape[key] = this.buildBooleanSchema(value);
|
|
34
|
-
}
|
|
35
|
-
else if (value.constraintType == ConstraintType.date) {
|
|
36
|
-
shape[key] = this.buildDateSchema(value);
|
|
37
|
-
}
|
|
38
|
-
else if (value.constraintType == ConstraintType.object) {
|
|
39
|
-
shape[key] = this.buildNestedObjectSchema(value);
|
|
40
|
-
}
|
|
41
|
-
else if (value.constraintType == ConstraintType.number) {
|
|
42
|
-
shape[key] = this.buildNumberSchema(value);
|
|
43
|
-
}
|
|
44
|
-
else if (value.constraintType == ConstraintType.array) {
|
|
45
|
-
shape[key] = this.buildArraySchema(value);
|
|
46
|
-
}
|
|
47
|
-
else if (value.constraintType == ConstraintType.file) {
|
|
48
|
-
shape[key] = this.buildFileSchema(value);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
return object(shape);
|
|
52
|
-
}
|
|
53
|
-
buildStringSchema(options) {
|
|
54
|
-
let schema = Yup.string();
|
|
55
|
-
if (options.required) {
|
|
56
|
-
schema = schema.required(options.required.message);
|
|
57
|
-
}
|
|
58
|
-
if (options.length) {
|
|
59
|
-
schema = schema.length(options.length.length, options.length.message);
|
|
60
|
-
}
|
|
61
|
-
if (options.maxLength) {
|
|
62
|
-
schema = schema.max(options.maxLength.maxLength, options.maxLength.message);
|
|
63
|
-
}
|
|
64
|
-
if (options.minLength) {
|
|
65
|
-
schema = schema.min(options.minLength.minLength, options.minLength.message);
|
|
66
|
-
}
|
|
67
|
-
if (options.pattern) {
|
|
68
|
-
schema = schema.matches(options.pattern.pattern, { message: options.pattern.message, excludeEmptyString: true });
|
|
69
|
-
}
|
|
70
|
-
return schema;
|
|
71
|
-
}
|
|
72
|
-
buildBooleanSchema(options) {
|
|
73
|
-
let schema = Yup.boolean();
|
|
74
|
-
if (options.required) {
|
|
75
|
-
schema = schema.required(options.required.message);
|
|
76
|
-
}
|
|
77
|
-
if (options.equals) {
|
|
78
|
-
if (options.equals.equals) {
|
|
79
|
-
schema = schema.isTrue(options.equals.message);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
schema = schema.isFalse(options.equals.message);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return schema;
|
|
86
|
-
}
|
|
87
|
-
buildDateSchema(options) {
|
|
88
|
-
let schema = Yup.date();
|
|
89
|
-
if (options.required) {
|
|
90
|
-
schema = schema.required(options.required.message);
|
|
91
|
-
}
|
|
92
|
-
if (options.min) {
|
|
93
|
-
schema = schema.min(options.min.min, options.min.message);
|
|
94
|
-
}
|
|
95
|
-
if (options.max) {
|
|
96
|
-
schema = schema.max(options.max.max, options.max.message);
|
|
97
|
-
}
|
|
98
|
-
if (options.test) {
|
|
99
|
-
schema = schema.test({
|
|
100
|
-
name: options.test.name,
|
|
101
|
-
message: options.test.message,
|
|
102
|
-
test: (d, context) => {
|
|
103
|
-
return options.test.test(d);
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
return schema;
|
|
108
|
-
}
|
|
109
|
-
buildNumberSchema(options) {
|
|
110
|
-
let schema = Yup.number();
|
|
111
|
-
if (options.required) {
|
|
112
|
-
schema = schema.required(options.required.message);
|
|
113
|
-
}
|
|
114
|
-
if (options.min) {
|
|
115
|
-
schema = schema.min(options.min.min, options.min.message);
|
|
116
|
-
}
|
|
117
|
-
if (options.max) {
|
|
118
|
-
schema = schema.max(options.max.max, options.max.message);
|
|
119
|
-
}
|
|
120
|
-
return schema;
|
|
121
|
-
}
|
|
122
|
-
buildArraySchema(options) {
|
|
123
|
-
let schema = Yup.array();
|
|
124
|
-
if (options.min) {
|
|
125
|
-
schema = schema.min(options.min.min, options.min.message);
|
|
126
|
-
}
|
|
127
|
-
if (options.max) {
|
|
128
|
-
schema = schema.max(options.max.max, options.max.message);
|
|
129
|
-
}
|
|
130
|
-
return schema;
|
|
131
|
-
}
|
|
132
|
-
buildNestedObjectSchema(options) {
|
|
133
|
-
let nestedSchema = this.buildObjectSchema(options.getInstance());
|
|
134
|
-
if (options.required) {
|
|
135
|
-
nestedSchema = nestedSchema.required();
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
nestedSchema = nestedSchema.notRequired().default(undefined);
|
|
139
|
-
}
|
|
140
|
-
return nestedSchema;
|
|
141
|
-
}
|
|
142
|
-
buildFileSchema(options) {
|
|
143
|
-
let schema = Yup.mixed().nullable().optional();
|
|
144
|
-
if (options.required) {
|
|
145
|
-
schema = schema.required(options.required.message);
|
|
146
|
-
}
|
|
147
|
-
return schema;
|
|
148
|
-
}
|
|
149
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: ModelSchemaFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
150
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: ModelSchemaFactory, providedIn: 'root' }); }
|
|
151
|
-
}
|
|
152
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: ModelSchemaFactory, decorators: [{
|
|
153
|
-
type: Injectable,
|
|
154
|
-
args: [{
|
|
155
|
-
providedIn: 'root',
|
|
156
|
-
}]
|
|
157
|
-
}], ctorParameters: function () { return []; } });
|
|
158
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kZWwtc2NoZW1hLmZhY3RvcnkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9tdXppZWhkZXNpZ24vZm9ybXMvc3JjL2xpYi9tb2RlbC1zY2hlbWEuZmFjdG9yeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBV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sZXQgc2NoZW1hID0gWXVwLm1peGVkKCkubnVsbGFibGUoKS5vcHRpb25hbCgpO1xuICAgIGlmIChvcHRpb25zLnJlcXVpcmVkKSB7XG4gICAgICBzY2hlbWEgPSBzY2hlbWEucmVxdWlyZWQob3B0aW9ucy5yZXF1aXJlZC5tZXNzYWdlKTtcbiAgICB9XG5cbiAgICByZXR1cm4gc2NoZW1hO1xuICB9XG59XG4iXX0=
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { NgFormModelState } from './ngform-model-state';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
import * as i1 from "./model-schema.factory";
|
|
5
|
-
export class NgFormModelStateFactory {
|
|
6
|
-
constructor(factory) {
|
|
7
|
-
this.factory = factory;
|
|
8
|
-
}
|
|
9
|
-
create(form, model, options) {
|
|
10
|
-
const modelState = new NgFormModelState(form, this.factory.build(model), options);
|
|
11
|
-
return modelState;
|
|
12
|
-
}
|
|
13
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgFormModelStateFactory, deps: [{ token: i1.ModelSchemaFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
14
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgFormModelStateFactory, providedIn: 'root' }); }
|
|
15
|
-
}
|
|
16
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: NgFormModelStateFactory, decorators: [{
|
|
17
|
-
type: Injectable,
|
|
18
|
-
args: [{
|
|
19
|
-
providedIn: 'root',
|
|
20
|
-
}]
|
|
21
|
-
}], ctorParameters: function () { return [{ type: i1.ModelSchemaFactory }]; } });
|
|
22
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmctZm9ybS1tb2RlbC1zdG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lbFN0YXRlT3B0aW9ucyB9IGZyb20gJy4vbW9kZWwtc3RhdGUtb3B0aW9ucyc7XG5pbXBvcnQgeyBOZ0Zvcm1Nb2RlbFN0YXRlIH0gZnJvbSAnLi9uZ2Zvcm0tbW9kZWwtc3RhdGUnO1xuXG5ASW5qZWN0YWJsZSh7XG4gIHByb3ZpZGVkSW46ICdyb290Jyxcbn0pXG5leHBvcnQgY2xhc3MgTmdGb3JtTW9kZWxTdGF0ZUZhY3Rvcnkge1xuICBjb25zdHJ1Y3Rvcihwcml2YXRlIGZhY3Rvcnk6IE1vZGVsU2NoZW1hRmFjdG9yeSkge31cblxuICBjcmVhdGU8VCBleHRlbmRzIG9iamVjdD4oZm9ybTogTmdGb3JtLCBtb2RlbDogVCwgb3B0aW9ucz86IE1vZGVsU3RhdGVPcHRpb25zKSB7XG4gICAgY29uc3QgbW9kZWxTdGF0ZSA9IG5ldyBOZ0Zvcm1Nb2RlbFN0YXRlPFQ+KGZvcm0sIHRoaXMuZmFjdG9yeS5idWlsZChtb2RlbCksIG9wdGlvbnMpO1xuICAgIHJldHVybiBtb2RlbFN0YXRlO1xuICB9XG59XG4iXX0=
|
|
@@ -1 +0,0 @@
|
|
|
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 array,\n file\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 min?: MinimumAnnotation<number>;\n max?: MaximumAnnotation<number>;\n}\n\nexport interface ArrayTypeAnnotations extends ConstraintAnnotations {\n min?: MinimumAnnotation<number>;\n max?: MaximumAnnotation<number>;\n}\n\nexport interface FileTypeAnnotations 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 ArrayType(...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations) as ArrayTypeAnnotations;\n o.constraintType = ConstraintType.array;\n registerMetadata(target, propertyKey, o);\n };\n}\n\nexport function FileType<T>(...annotations: { [key: string]: ValidationAnnotation }[]) {\n return function (target: Object, propertyKey: string) {\n const o = Object.assign({}, ...annotations) as FileTypeAnnotations;\n o.constraintType = ConstraintType.file;\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 {\n BooleanTypeAnnotations,\n ConstraintAnnotations,\n ConstraintType,\n DateTypeAnnotations,\n ObjectTypeAnnotations,\n NumberTypeAnnotations,\n StringTypeAnnotations,\n ArrayTypeAnnotations,\n FileTypeAnnotations,\n} 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 extends object>(model: T): ModelValidator<T> {\n const schema = this.buildObjectSchema(model);\n return new ModelValidator(schema);\n }\n\n private buildObjectSchema<T extends object>(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 } else if (value.constraintType == ConstraintType.array) {\n shape[key] = this.buildArraySchema(value as ArrayTypeAnnotations);\n } else if (value.constraintType == ConstraintType.file) {\n shape[key] = this.buildFileSchema(value as FileTypeAnnotations);\n }\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\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 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\n return schema;\n }\n\n private buildArraySchema(options: ArrayTypeAnnotations) {\n let schema = Yup.array();\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\n return schema;\n }\n\n private buildNestedObjectSchema(options: ObjectTypeAnnotations) {\n let nestedSchema = this.buildObjectSchema(options.getInstance());\n if (options.required) {\n nestedSchema = nestedSchema.required();\n } else {\n nestedSchema = nestedSchema.notRequired().default(undefined);\n }\n\n return nestedSchema;\n }\n\n private buildFileSchema(options: FileTypeAnnotations) {\n let schema = Yup.mixed().nullable().optional();\n if (options.required) {\n schema = schema.required(options.required.message);\n }\n\n return schema;\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\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[]) => Promise<FieldError[]>): Promise<ModelStateResult<T>> {\n const list = await this.modelValidator.validate(model);\n const final = callback ? (await callback?.(list)) : list;\n return {\n valid: final.length === 0,\n errors: final,\n model: model,\n };\n }\n}\n","import { Injectable } from '@angular/core';\nimport { NgForm } from '@angular/forms';\nimport { ModelSchemaFactory } from './model-schema.factory';\nimport { ModelStateOptions } from './model-state-options';\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 extends object>(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 ssnOptions = {\n mask: '000-00-0000',\n};\n\nexport const currencyOptions = {\n mask: Number,\n scale: 2,\n thousandsSeparator: ',',\n padFractionalZeros: true,\n radix: '.',\n mapToRadix: ['.'],\n};\n\nexport const integerOptions = {\n mask: Number,\n scale: 0,\n thousandsSeparator: ',',\n padFractionalZeros: true,\n radix: '.',\n mapToRadix: ['.'],\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,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,iCA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G;AACxB,IAAA,IAAI,EAAE,aAAa;EACnB;AAEW,MAAA,eAAe,GAAG;AAC7B,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;EACjB;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;;;ACnEnB;;AAEG;;ACFH;;AAEG;;;;"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|