import type { BaseParams } from '@ariestools/sdk'; import { ModuleBaseEmitter } from '@xyo-network/sdk'; import type { ControlSerializeSettings, ControlValueAccessor, SetOptions } from './ControlValueAccessor.js'; import type { ValidControlValue } from './ValidControlValue.js'; /** Configuration for {@link ControlValueAccessorBase} event emission. */ export interface ControlValueAccessorBaseConfig { disableEvents?: boolean; } /** Default options used when setting a control value. */ export declare const DefaultSetOptions: SetOptions; /** Events emitted when a control value, error, or touched state changes. */ export interface ControlValueAccessorBaseEvents { [key: PropertyKey]: string | number | object; errorChanged: { error: string; }; touchChanged: { touched: boolean; }; valueChanged: { value: TValue; }; } /** * The base class for control value accessors interface */ export declare class ControlValueAccessorBase = ControlValueAccessorBaseEvents> extends ModuleBaseEmitter implements ControlValueAccessor { private _error; private _previousValue; private _serializeSettings; private _touched; private _value; private config; constructor(config: ControlValueAccessorBaseConfig); /** * The error message for the control. */ get error(): string; /** * The "previous value" of the input element. */ get previousValue(): TValue; /** * The serialize settings of the input element. */ get serializeSettings(): ControlSerializeSettings; /** * The "touched" state of the input element. */ get touched(): boolean; /** * The current value of the input element. */ get value(): TValue; /** * The registered callback function called when a change or input event occurs on the input * element. */ onChange: (_: TValue) => void; /** * Registers a function called when the control error changes. */ onErrorChange: (error: string) => void; /** * The registered callback function called when a blur event occurs on the input element. */ onTouched: (_isTouched: boolean) => void; /** * Registers a function called when the control value changes. * @param {(_value:ValidControlValue)=>void} fn * @returns void */ registerOnChange(fn: (_value: TValue) => void): void; /** * Registers a function called when the control error changes. * @param {(error:string)=>void} fn */ registerOnErrorChange(fn: (error: string) => void): void; /** * Registers a function called when the control is touched. * @param {(isTouched:boolean)=>void} fn * @returns void */ registerOnTouched(fn: (isTouched: boolean) => void): void; /** * Sets the "touched" state of the input element. * @param {boolean} isTouched */ setTouched(isTouched: boolean): void; /** * Sets the "value" property on the input element. * @param {ValidControlValue} value * @returns void */ setValue(value: TValue, options?: SetOptions): void; /** * Set the error message for the control. * @param {string} error */ protected setError(error: string): void; /** * Sets the "previous value" of the input element. * @param {ValidControlValue} value * @returns void */ protected setPreviousValue(value: TValue): void; /** * Sets the serialize settings of the input element. * @param {ControlSerializeSettings} settings */ protected setSerializeSettings(settings: ControlSerializeSettings): void; } //# sourceMappingURL=ControlValueAccessorBase.d.ts.map