{"version":3,"file":"ngxtension-control-error.mjs","sources":["../../../../libs/ngxtension/control-error/src/control-error.ts","../../../../libs/ngxtension/control-error/src/ngxtension-control-error.ts"],"sourcesContent":["import {\n\tDirective,\n\tEmbeddedViewRef,\n\tInjectionToken,\n\tInput,\n\tTemplateRef,\n\tViewContainerRef,\n\tinject,\n\tsignal,\n\tuntracked,\n\ttype Provider,\n} from '@angular/core';\nimport {\n\ttakeUntilDestroyed,\n\ttoObservable,\n\ttoSignal,\n} from '@angular/core/rxjs-interop';\nimport {\n\tAbstractControl,\n\tControlContainer,\n\tFormGroupDirective,\n\tNgForm,\n\ttype ValidationErrors,\n} from '@angular/forms';\nimport { filterNil } from 'ngxtension/filter-nil';\nimport { allEventsObservable } from 'ngxtension/form-events';\nimport {\n\tObservable,\n\tcombineLatest,\n\tdistinctUntilChanged,\n\tmap,\n\tof,\n\tshareReplay,\n\tstartWith,\n\tswitchMap,\n} from 'rxjs';\n\nexport const dirty$ = (control: AbstractControl) =>\n\tallEventsObservable(control).pipe(\n\t\tmap((events) => events.dirty),\n\t\tdistinctUntilChanged(),\n\t);\nexport const touched$ = (control: AbstractControl) =>\n\tallEventsObservable(control).pipe(\n\t\tmap((events) => events.touched),\n\t\tdistinctUntilChanged(),\n\t);\n\n/**\n *  Defines when a {@link AbstractControl control} is in an *state*.\n */\nexport type StateMatcher = (\n\tcontrol: AbstractControl,\n\tparent?: FormGroupDirective | NgForm,\n) => Observable<boolean>;\n\n/**\n * Emits whenever the value, status, touched/untouched state of the control changes or the parent submits.\n *\n * Evaluates to `true` when the control status is `INVALID` and it is `touched` or the parent is `submitted`.\n */\nexport const NGX_DEFAULT_CONTROL_ERROR_STATE_MATCHER: StateMatcher = (\n\tcontrol,\n\tparent,\n) =>\n\tcombineLatest(\n\t\t[\n\t\t\tcontrol.valueChanges.pipe(startWith(control.value)),\n\t\t\tcontrol.statusChanges.pipe(\n\t\t\t\tstartWith(control.status),\n\t\t\t\tdistinctUntilChanged(),\n\t\t\t),\n\t\t\ttouched$(control),\n\t\t\tparent?.ngSubmit.pipe(\n\t\t\t\tmap(() => true),\n\t\t\t\tstartWith(parent.submitted),\n\t\t\t\tdistinctUntilChanged(),\n\t\t\t) ?? of(false),\n\t\t],\n\t\t(value, status, touched, submitted) =>\n\t\t\tstatus === 'INVALID' && (touched || submitted),\n\t);\n\nexport const NGX_CONTROL_ERROR_STATE_MATCHER = new InjectionToken<StateMatcher>(\n\t'NGX_CONTROL_ERROR_STATE_MATCHER',\n\t{ factory: () => NGX_DEFAULT_CONTROL_ERROR_STATE_MATCHER },\n);\n\nexport const NGX_CONTROL_ERROR_PARENT = new InjectionToken<\n\tFormGroupDirective | NgForm\n>('NGX_CONTROL_ERROR_PARENT');\n\n/**\n * Configures {@link NgxControlError}.\n */\nexport const provideNgxControlError = (options?: {\n\terrorStateMatcher?: () => StateMatcher;\n\tparent?: () => NgForm | FormGroupDirective;\n}): Provider[] => {\n\tconst provider = [];\n\n\tif (options?.errorStateMatcher)\n\t\tprovider.push({\n\t\t\tprovide: NGX_CONTROL_ERROR_STATE_MATCHER,\n\t\t\tuseFactory: options.errorStateMatcher,\n\t\t});\n\n\tif (options?.parent)\n\t\tprovider.push({\n\t\t\tprovide: NGX_CONTROL_ERROR_PARENT,\n\t\t\tuseFactory: options.parent,\n\t\t});\n\n\treturn provider;\n};\n\n/**\n * Represents the context of the template the {@link NgxControlError} sits on.\n */\nexport interface NgxControlErrorContext {\n\t/**\n\t * Reference to the `errors` of {@link NgxControlError.control}\n\t */\n\t$implicit: ValidationErrors;\n\n\t/**\n\t * Reference to {@link NgxControlError.control}\n\t */\n\tcontrol: AbstractControl;\n\n\t/**\n\t * Reference to {@link NgxControlError.track}\n\t */\n\ttrack: string | string[];\n}\n\n/**\n * Structural directive for displaying form control errors consistently and reduce boilerplate.\n *\n * ## Usage\n *\n * ```html\n * <label>\n * \t<b>Name</b>\n * \t<input type=\"text\" [formControl]=\"name\" />\n * \t<strong *ngxControlError=\"name; track: 'required'\">Name is required.</strong>\n * </label>\n * ```\n *\n * The template will be rendered, when the control is in an [_error state_](#configuration) and its errors include the tracked error(s).\n *\n * without `NgxControlError`:\n *\n * ```html\n * <label>\n * \t<b>Name</b>\n * \t<input type=\"text\" [formControl]=\"name\" />\n * \t@if (name.hasError('required') && (name.touched || form.submitted)) {\n * \t<strong>Name is required.</strong>\n * \t}\n * </label>\n * ```\n *\n * ## Configuration\n *\n * A `StateMatcher` defines when the provided control is in an _error state_.\n * A `StateMatcher` is a function which returns an observable. Every time the `StateMatcher` emits a value, the directive checks whether it should render or hide its template:\n * The directive renders its template when the `StateMatcher` emits `true` and the errors of the control include at least 1 tracked error, else its template will be hidden.\n *\n * ```ts\n * export type StateMatcher = (\n * control: AbstractControl,\n * parent?: FormGroupDirective | NgForm,\n * ) => Observable<boolean>;\n * ```\n *\n * Per default the control is considered in an _error state_ when 1. its status is `INVALID` and 2. it is `touched` or its form has been `submitted`.\n *\n * You can override this behavior:\n *\n * ```ts\n * //\n * // A control is in an error state when its status is invalid.\n * // Emits whenever statusChanges emits.\n * // You may want to add more sources, such as valueChanges.\n * //\n * export const customErrorStateMatcher: StateMatcher = (control) =>\n * control.statusChanges.pipe(\n * startWith(control.status),\n * map((status) => status === 'INVALID'),\n * );\n * ```\n *\n * ### Via DI\n *\n * ```ts\n * provideNgxControlError({ errorStateMatcher: customErrorStateMatcher });\n * ```\n *\n * ### Via Input\n *\n * ```html\n * <label>\n * \t<b>Name</b>\n * \t<input type=\"text\" [formControl]=\"name\" />\n * \t<strong *ngxControlError=\"name; track: 'required'; errorStateMatcher: customErrorStateMatcher\">Name is required.</strong>\n * </label>\n * ```\n *\n * ## Integration\n *\n * ### [NGX Translate](https://github.com/ngx-translate/core)\n *\n * You can iterate over all possible errors and pass the `errors` to the translate pipe:\n *\n * ```html\n * <label>\n * \t<b>Mail</b>\n * \t<input type=\"email\" [formControl]=\"mail\" />\n * \t@for (error of ['required', 'email', 'myCustomError']; track error) {\n * \t<strong *ngxControlError=\"mail; track: error\">{{ \"PATH.TO.MAIL_CONTROL.ERRORS.\" + error | translate: mail.errors }}</strong>\n * \t}\n * </label>\n * ```\n *\n * ### [Angular Material](https://github.com/angular/components)\n *\n * ```html\n * <mat-form-field>\n * \t<mat-label>Name</mat-label>\n * \t<input matInput [formControl]=\"name\" />\n * \t<mat-error *ngxControlError=\"name; track: 'required'\">Name is required.</mat-error>\n * </mat-form-field>\n * ```\n */\n@Directive({\n\tselector: '[ngxControlError]',\n\tstandalone: true,\n})\nexport class NgxControlError {\n\t/** @ignore */\n\tprivate readonly templateRef = inject(TemplateRef);\n\n\t/** @ignore */\n\tprivate readonly viewContainerRef = inject(ViewContainerRef);\n\n\tpublic constructor() {\n\t\t// Whenever one of the tracked errors are included in the controls errors and the control is in an error state, render this template.\n\t\tcombineLatest(\n\t\t\t[toObservable(this.track$), toObservable(this.control$), this._hasError$],\n\t\t\t(track, control, hasError) => {\n\t\t\t\tthis.viewContainerRef.clear();\n\n\t\t\t\tif (hasError && control != null && track != null)\n\t\t\t\t\tthis.viewContainerRef.createEmbeddedView(this.templateRef, {\n\t\t\t\t\t\t$implicit: control.errors ?? {},\n\t\t\t\t\t\ttrack,\n\t\t\t\t\t\tcontrol,\n\t\t\t\t\t} satisfies NgxControlErrorContext);\n\t\t\t},\n\t\t)\n\t\t\t.pipe(takeUntilDestroyed())\n\t\t\t.subscribe();\n\t}\n\n\t/**\n\t * The errors this directive tracks, when a {@link control$ control} is provided.\n\t */\n\t@Input({ alias: 'ngxControlErrorTrack', required: true })\n\tpublic set track(track) {\n\t\tthis.track$.set(track);\n\t}\n\n\tpublic get track() {\n\t\treturn untracked(this.track$);\n\t}\n\n\t/**\n\t * The control which `errors` are tracked. Either a control instance or the name of the control when used in a form.\n\t *\n\t * @see {@link AbstractControl.errors}\n\t */\n\tpublic set control(control) {\n\t\tthis.control$.set(control);\n\t}\n\n\tpublic get control() {\n\t\treturn untracked(this.control$);\n\t}\n\n\t/**\n\t * The control which `errors` are tracked. Either a control instance or the name of the control when used in a form.\n\t *\n\t * @see {@link AbstractControl.errors}\n\t */\n\t@Input({ alias: 'ngxControlError', required: true })\n\tpublic set controlInput(control: AbstractControl | string) {\n\t\tif (control instanceof AbstractControl) {\n\t\t\tthis.control$.set(control);\n\t\t\treturn;\n\t\t}\n\n\t\tconst directParentControl = this.controlContainer?.control;\n\n\t\tif (!directParentControl) {\n\t\t\tthrow new Error(\n\t\t\t\t`[NgxControlError]: A control name cannot be specified without a parent FormGroup.`,\n\t\t\t);\n\t\t}\n\n\t\tconst controlInstance = directParentControl.get(control);\n\n\t\tif (!controlInstance) {\n\t\t\tthrow new Error(\n\t\t\t\t`[NgxControlError]: Cannot find control with name '${control}'.`,\n\t\t\t);\n\t\t}\n\n\t\tthis.control$.set(controlInstance);\n\t}\n\n\t/**\n\t *  A `StateMatcher` which defines when this {@link control$ control} is in an *error state*.\n\t *  This directive **ONLY** renders this template when the `StateMatcher` evaluates to `true`.\n\t *\n\t *  Defaults to {@link NGX_CONTROL_ERROR_STATE_MATCHER}.\n\t */\n\t@Input({ alias: 'ngxControlErrorErrorStateMatcher' })\n\tpublic set errorStateMatcher(errorStateMatcher: StateMatcher) {\n\t\tthis.errorStateMatcher$.set(errorStateMatcher);\n\t}\n\n\tpublic get errorStateMatcher() {\n\t\treturn untracked(this.errorStateMatcher$);\n\t}\n\n\t/**\n\t * The top level parent of this {@link control$ control}.\n\t *\n\t * NOTE: Might not be the control referenced by {@link AbstractControl.parent parent} of this {@link control$ control}.\n\t */\n\t@Input({ alias: 'ngxControlErrorParent' })\n\tpublic set parent(parent) {\n\t\tthis.parent$.set(parent);\n\t}\n\n\tpublic get parent() {\n\t\treturn untracked(this.parent$);\n\t}\n\n\t/**\n\t * The errors this directive tracks, when a {@link control$ control} is provided.\n\t */\n\tpublic readonly track$ = signal<undefined | string | string[]>(undefined);\n\n\t/**\n\t * The top level parent of this {@link control$ control}.\n\t *\n\t * NOTE: Might not be the control referenced by {@link AbstractControl.parent parent} of this {@link control$ control}.\n\t */\n\tpublic readonly parent$ = signal(\n\t\tinject(NGX_CONTROL_ERROR_PARENT, { optional: true }) ??\n\t\t\tinject(FormGroupDirective, { optional: true }) ??\n\t\t\tinject(NgForm, { optional: true }) ??\n\t\t\tundefined,\n\t);\n\n\t/**\n\t * The direct parent form group directive of this control.\n\t */\n\tprivate readonly controlContainer = inject(ControlContainer, {\n\t\toptional: true,\n\t});\n\n\t/**\n\t * The control which `errors` are tracked.\n\t *\n\t * @see {@link AbstractControl.errors}\n\t */\n\tpublic readonly control$ = signal<AbstractControl | undefined>(undefined);\n\n\t/**\n\t *  A `StateMatcher` which defines when this {@link control$ control} is in an *error state*.\n\t *  This directive **ONLY** renders this template when the `StateMatcher` evaluates to `true`.\n\t *\n\t *  Defaults to {@link NGX_CONTROL_ERROR_STATE_MATCHER}.\n\t */\n\tpublic readonly errorStateMatcher$ = signal(\n\t\tinject(NGX_CONTROL_ERROR_STATE_MATCHER),\n\t);\n\n\t/**\n\t * The context of this template.\n\t */\n\tpublic get context() {\n\t\treturn (\n\t\t\tthis.viewContainerRef.get(0) as EmbeddedViewRef<NgxControlErrorContext>\n\t\t)?.context;\n\t}\n\n\t/**\n\t * Whether this {@link control$ control's} errors include one of the {@link track$ tracked errors} and whether it is in an *{@link errorState$ error state}*.\n\t */\n\tprivate readonly _hasError$ = combineLatest([\n\t\ttoObservable(this.track$),\n\t\ttoObservable(this.errorStateMatcher$),\n\t\ttoObservable(this.control$).pipe(filterNil()),\n\t\ttoObservable(this.parent$),\n\t]).pipe(\n\t\tswitchMap(([track, errorStateMatcher, control, parent]) =>\n\t\t\terrorStateMatcher(control, parent).pipe(\n\t\t\t\tmap(\n\t\t\t\t\t(errorState) =>\n\t\t\t\t\t\terrorState &&\n\t\t\t\t\t\ttrack != null &&\n\t\t\t\t\t\tcontrol != null &&\n\t\t\t\t\t\t(typeof track === 'string'\n\t\t\t\t\t\t\t? control.hasError(track)\n\t\t\t\t\t\t\t: track.some((x) => control.hasError(x))),\n\t\t\t\t),\n\t\t\t),\n\t\t),\n\t\tshareReplay(1), // cache the latest errorStateMatcher computation\n\t);\n\n\t/**\n\t * Whether this {@link control$ control's} errors include one of the {@link track$ tracked errors} and whether it is in an *{@link errorState$ error state}*.\n\t */\n\tpublic readonly hasError$ = toSignal(this._hasError$, {\n\t\tinitialValue: false,\n\t});\n\n\t/** @ignore */\n\tpublic static ngTemplateContextGuard = (\n\t\tdirective: NgxControlError,\n\t\tcontext: unknown,\n\t): context is NgxControlErrorContext => true;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAqCO,MAAM,MAAM,GAAG,CAAC,OAAwB,KAC9C,mBAAmB,CAAC,OAAO,CAAC,CAAC,IAAI,CAChC,GAAG,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,KAAK,CAAC,EAC7B,oBAAoB,EAAE,EACrB;AACI,MAAM,QAAQ,GAAG,CAAC,OAAwB,KAChD,mBAAmB,CAAC,OAAO,CAAC,CAAC,IAAI,CAChC,GAAG,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,OAAO,CAAC,EAC/B,oBAAoB,EAAE,EACrB;AAUH;;;;AAIG;AACI,MAAM,uCAAuC,GAAiB,CACpE,OAAO,EACP,MAAM,KAEN,aAAa,CACZ;IACC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACnD,IAAA,OAAO,CAAC,aAAa,CAAC,IAAI,CACzB,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,EACzB,oBAAoB,EAAE,CACtB;IACD,QAAQ,CAAC,OAAO,CAAC;IACjB,MAAM,EAAE,QAAQ,CAAC,IAAI,CACpB,GAAG,CAAC,MAAM,IAAI,CAAC,EACf,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,EAC3B,oBAAoB,EAAE,CACtB,IAAI,EAAE,CAAC,KAAK,CAAC;CACd,EACD,CAAC,KAAK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