UNPKG

igniteui-webcomponents

Version:

Ignite UI for Web Components is a complete library of UI components, giving you the ability to build modern web applications using encapsulation and the concept of reusable components in a dependency-free approach.

93 lines (92 loc) 3.86 kB
import type { LitElement } from 'lit'; import type { Validator } from '../validators.js'; import type { Constructor } from './constructor.js'; export declare class FormAssociatedElementInterface { static readonly formAssociated: boolean; private __internals; protected get __validators(): Validator[]; protected _disabled: boolean; protected _invalid: boolean; protected _dirty: boolean; /** * The default value of the control at "creation" time. * * @remarks * This is set by default on `connectedCallback` through the `setDefaultValue` call. * It expects the component to have either a `checked` or a `value` property and binds it to the initial value of the * respective property. * * In use-cases where additional customization is required, make sure to override the `setDefaultValue` method. */ protected _defaultValue: unknown; /** * Applies the {@link FormAssociatedElementInterface.invalid | `invalid`} attribute on the control and the associated styles * if the element has completed the first update cycle or it has been interacted with by the user. * * Usually, it should be called after {@link FormAssociatedElementInterface.updateValidity | `updateValidity()`} */ protected setInvalidState(): void; /** * Executes the component validators and updates the internal validity state. */ protected updateValidity(message?: string): void; /** * Saves the initial value/checked state of the control. * * Called on connectedCallback. */ protected setDefaultValue(): void; /** * Called when the parent form is reset. * * Restores the initially bound value/checked state of the control. */ protected restoreDefaultValue(): void; protected setFormValue(value: string | File | FormData | null, state?: string | File | FormData | null | undefined): void; protected setValidity(flags?: ValidityStateFlags | undefined, message?: string | undefined, anchor?: HTMLElement | undefined): void; protected formResetCallback(): void; protected formDisabledCallback(state: boolean): void; protected formStateRestoreCallback(state: string | FormData | File, mode: 'autocomplete' | 'restore'): void; /** * The disabled state of the component * @attr [disabled=false] */ disabled: boolean; /** * Control the validity of the control. * @attr */ invalid: boolean; /** * The name attribute of the control. * @attr */ name: string; /** Returns the HTMLFormElement associated with this element. */ get form(): HTMLFormElement | null; /** * Returns a ValidityState object which represents the different validity states * the element can be in, with respect to constraint validation. */ get validity(): ValidityState; /** A string containing the validation message of this element. */ get validationMessage(): string; /** * A boolean value which returns true if the element is a submittable element * that is a candidate for constraint validation. */ get willValidate(): boolean; /** Checks for validity of the control and emits the invalid event if it invalid. */ checkValidity(): boolean; /** Checks for validity of the control and shows the browser message if it invalid. */ reportValidity(): boolean; /** * Sets a custom validation message for the control. * As long as `message` is not empty, the control is considered invalid. */ setCustomValidity(message: string): void; } /** * Turns the passed class element into a Form Associated Custom Element. */ export declare function FormAssociatedMixin<T extends Constructor<LitElement>>(superClass: T): Constructor<FormAssociatedElementInterface> & T;