import { FieldBehaviorConfiguration, FieldConfiguration, FieldFetchConfiguration, FieldIoConfiguration } from './FieldConfigurationTypes'; import { Observer, Subject } from './ObserverPatternTypes'; /** * This class represents a generic Input in a form. * In particular it is a generic input element, whose behavior is based on element.value property */ declare class DynamicElement implements Observer { /** @param {object} config - the element configuration */ readonly config: FieldConfiguration; /** @param {NodeList} htmlElement - the HTML Element returned by querySelectorAll. If more than one exists, the element is a NodeList */ readonly htmlElement: NodeList; /** @param {string} name - the element name */ readonly name: string; /** @param {FieldIoConfiguration} io - object which groups some properties related to field input/output */ io: FieldIoConfiguration; /** @param {FieldFetchConfiguration} fetch - object which groups some properties related to remote calls */ fetch: FieldFetchConfiguration; /** @param {FieldBehaviorConfiguration} behavior - object which groups some properties related to field behavior */ behavior: FieldBehaviorConfiguration; /** @param {string} event - the event to listen to */ event: string; /** @param {object} defaultConfig - property with default configuration values */ static defaultConfig: { io: { event: string; }; }; /** * Class constructor * @param {FieldConfiguration} config the element configuration * @param {Subject} subject the subject to notify when changes occour (according to Observer pattern) * @param {NodeList} htmlElement the html element(s) returned by querySelectorAll * @async */ constructor(config: FieldConfiguration, htmlElement: NodeList); private getHtmlInputElementOrList; attach(subject: Subject): void; /** * Method to get the field value * @returns {string} the value */ get(): any; /** * Method to set the field value * @param {string} value new value to set */ set(value: string): void; /** * Method to clear this element from its content */ clear(): void; /** * Method which updates the element (observer) status after a change on the observed subject * @param {object} data data useful to the element's status change * @param {string|null} subjectName name of the changed subject * * @returns a Promise in fulfilled state when element status has been updated * * @async */ update(data: object, subjectName: string | null): Promise; /** * Method executed before the status update. If it returns false, the update is aborted. * @param {object} data data useful to the element's status change * @param {string|null} subjectName name of the changed subject * @returns false to abort the update, true otherwise */ protected beforeUpdate(data: object, subjectName: string | null): boolean; /** * Method to update the DynamicElement status. * @param {object} data data useful to the element's status change * @param {string|null} subjectName name of the changed subject */ protected updateStatus(data: object, subjectName: string | null): Promise; /** * Method executed after the status update. It is executed also if the update is aborted. * @param {object} data data useful to the element's status change * @param {string|null} subjectName name of the changed subject */ protected afterUpdate(data: object, subjectName: string | null): boolean; } export default DynamicElement;