UNPKG

@zarlex/ngx-accessor

Version:

This library provides an adapter to interact with Angular forms. It also provides an adapter to work with object signals and forms

35 lines (34 loc) 1.83 kB
import { ControlValueAccessor, NgControl } from '@angular/forms'; import { AccessorConfig } from './accessors/abstract-accessor'; import { ValidatorError } from './errors/validator-error'; import { SimplePath } from './type-utils'; import { IValidator } from './validation/interface'; import { CheckboxValueAccessorDirective, RadioControlValueAccessorDirective } from './directives/accessors'; export declare const BUILTIN_ACCESSORS: (typeof CheckboxValueAccessorDirective | typeof RadioControlValueAccessorDirective)[]; /** * Adapted code from https://github.com/angular/angular/blob/6789c7ef947952551d7598fe37a3d86093b75720/packages/forms/src/directives/shared.ts#L367 * * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ export declare function isBuiltInAccessor(valueAccessor: ControlValueAccessor): boolean; /** * Adapted code from https://github.com/angular/angular/blob/6789c7ef947952551d7598fe37a3d86093b75720/packages/forms/src/directives/shared.ts#L388 * * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ export declare function selectValueAccessor(dir: NgControl, valueAccessors: ControlValueAccessor[]): ControlValueAccessor | null; export declare function getValidatorError(key: any, value: any, validator: IValidator): { [key: string]: ValidatorError; }; export declare function keyValidatorsFromAccessorConfig<TProperties extends object>(config: AccessorConfig<TProperties>): { [key in SimplePath<TProperties>]?: Array<IValidator>; }; export declare function isEqual(val1: unknown, val2: unknown): boolean;