/** * @param {Element} element to get the name for * @returns {string} the name assigned to the element */ export function getName(element: Element): string; /** * @param {Element} element to get the binder names for * @returns {Array<{jsonPointer: string, attribute: string}>} */ export function getAttributeBinders(element: Element): Array<{ jsonPointer: string; attribute: string; }>; /** * @param {Element} element to get the binder names for * @returns {Array<{jsonPointer: string, property: string}>} */ export function getPropertyBinders(element: Element): Array<{ jsonPointer: string; property: string; }>; /** @template TData */ export class FormBinder extends HTMLElement { /** Initialize */ constructor(); /** @param {object} data to bind to the form controls. A copy of the data is taken. */ set data(arg: any); /** @returns {object} that is being bound to the form controls */ get data(): any; _data: any; _originalData: object; /** @inheritdoc */ connectedCallback(): void; mutationObserver: ShadowDomMutationObserver; /** @inheritdoc */ disconnectedCallback(): void; /** @type {Map} */ registeredControlBinders: Map; /** * @private * @type {Set} controls the user has interacted with */ private _visitedControls; /** * @private * @type {Map} controls whose values have been changed by the user */ private _updatedControls; /** * @private * @type {Partial} */ private _patch; /** @private guard to prevent nested reportValidity processes */ private _reportValidityRequested; /** * @protected * Marks a JSON Pointer and value as changed and also updates the value in the data. * @param {string} jsonPointer to the property to set the value * @param {unknown} newValue to assign to the pointer */ protected _patchValue(jsonPointer: string, newValue: unknown): void; /** @returns {Partial} data changed as a partial object */ getPatch(): Partial; /** @returns {Map} data changed as Map of JSONPointer/value pairs */ getPatchAsMap(): Map; /** @returns {JSONPointerValueTuple} data changed as Array of JSONPointer/value pairs */ getPatchAsArray(): JSONPointerValueTuple; /** * Updates the form data with a partial object. * @param {Partial|Map|JSONPointerValueTuple} [partialData] that will be used to update the current form data. Can be a partial object of a Map or JSON pointers and new values. */ patch(partialData?: Partial | Map | JSONPointerValueTuple): void; /** * Clears the currently recorded changes and sets the current state as the new baseline. It does not clear the data changes themselves. * You might use this if the user saves the form and you want to mark the form as . * If reset() is called the form will be reverted to the last time commitChanges() was called. */ commit(): void; /** * Resets the form back to original status. All controls are marked unchanged. All patches are cleared. * Clears the data to the initial data value set. Reverts the data to the last time the data was set or commitChanges was called. */ rollback(): void; /** @deprecated use rollback */ reset(): void; /** @returns {Array} controls that have been bound to the form */ getControls(): Array; /** @param {Element} controlCandidate to bind to the form data */ addControl(controlCandidate: Element): void; /** * Update a controls model binder and attribute binders * @param {Element} control to update the value of. If control has been visited then validation is invoked. */ updateControlValue(control: Element): void; /** * Updates the values of all control values * @param {Array} [jsonPointers] only update controls using the passed jsonPointers */ updateControlValues(jsonPointers?: Array): void; /** * @param {ControlElement} control * @param {any} value * @param {import('../lib/binder-registry').OnValueChangeCallbackOptions} [options] */ handleControlValueChange(control: ControlElement, value: any, options?: import('../lib/binder-registry').OnValueChangeCallbackOptions): Promise; /** * @param {ControlElement} controlElement that was visited * @returns {Promise} form validity result */ controlVisited(controlElement: ControlElement): Promise; /** * @param {ValidationElement} control * @param {any} [value] to validate against the control. If not supplied then the value is taken from the backing data. * @returns {Promise} if valid */ validateControlValue(control: ValidationElement, value?: any): Promise; /** * @param {Array} [controls] to validate. if not supplied then all controls are validated. * @returns {Promise} result of the forms current validity */ validate(controls?: Array): Promise; /** * @param {Array} [controls] to validate. if not supplied then all controls are validated. * @returns {Promise} if the control/controls in the form are all valid */ checkValidity(controls?: Array): Promise; /** * @param {Array} [controls] to validate. if not supplied then all controls are validated. * @returns {Promise} if the control/controls in the form are all valid */ reportValidity(controls?: Array): Promise; /** @param {FormValidationResult} validationResults that to be displayed */ reportErrors(validationResults: FormValidationResult): void; /** Clears validation errors on all controls. Dispatches a cancelable * 'form-binder:clear-validity' event. If not cancelled, clears errors * via binder reportValidity with empty results. */ clearValidity(): void; } export type JSONPointerValueTuple = Array & { 0: string; 1: any; length: 2; }>; export type FormBinderChangeEventDetail = { data: TData; jsonPointer: string; value: any; validationResults: FormValidationResult; }; export type FormBinderChangeEvent = CustomEvent>; export type ControlBinding = import('../lib/control-binding.js').ControlBinding; export type ControlElement = import("../lib/binder-registry.js").ControlElement; export type ValidationControlResult = import("../lib/validator-registry.js").ValidationControlResult; export type ValidationElement = import("../lib/validator-registry.js").ValidationElement; export type ValidationResults = import("../lib/validator-registry.js").ValidationResults; export type FormValidationResult = import("../lib/validator-registry.js").FormValidationResult; import { ShadowDomMutationObserver } from "../lib/observer.js";