@edugouvfr/ngx-dsfr
Version:
NgxDsfr est un portage Angular des éléments d'interface du Système de Design de l'État Français (DSFR).
58 lines (57 loc) • 2.46 kB
TypeScript
import { ControlValueAccessor } from '@angular/forms';
import * as i0 from "@angular/core";
/**
* Base class for all ControlValueAccessor classes defined in Forms package. Contains common logic and utility functions.
* Le type de `value` est : T | undefined, undefined par défaut. Par exemple si on manipule un input de type number, celui-ci
* sera initialisé à undefined par défaut.
*/
export declare abstract class DefaultValueAccessorComponent<T> implements ControlValueAccessor {
/**
* Permet de désactiver le champ.
*/
disabled: boolean;
private _value;
get value(): T | undefined;
/**
* La valeur gérée par le champ de formulaire.
*/
set value(value: T | undefined);
/**
* Writes a new value to the element.
* This method is called by the forms API to write to the view when programmatic changes from model to view are requested.
*
* @internal
*/
writeValue(value: T | undefined): void;
/**
* Registers a callback function that is called when the control's value changes in the UI.
* When the value changes in the UI, call the registered function to allow the forms API to update itself:
* host: {
* '(change)': '_onChange($event.target.value)'
* }
* @internal
*/
registerOnChange(fn: (_: any) => void): void;
/**
* Registers a callback function that is called by the forms API on initialization to update the form model on blur.
* On blur (or equivalent), your class should call the registered function to allow the forms API to update itself:
* host: {
* '(blur)': '_onTouched()'
* }
* @internal
*/
registerOnTouched(fn: () => void): void;
/**
* Function that is called by the forms API when the control status changes to or from 'DISABLED'.
* Depending on the status, it enables or disables the appropriate DOM element.
*
* @internal
*/
setDisabledState?(isDisabled: boolean): void;
/** @internal */
fnOnChange: (_: T | undefined) => void;
/** @internal */
fnOnTouched: () => void;
static ɵfac: i0.ɵɵFactoryDeclaration<DefaultValueAccessorComponent<any>, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<DefaultValueAccessorComponent<any>, "ng-component", never, { "disabled": { "alias": "disabled"; "required": false; }; "value": { "alias": "value"; "required": false; }; }, {}, never, never, false, never>;
}