@exadel/esl
Version:
Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components
74 lines (73 loc) • 2.78 kB
TypeScript
import { ESLBaseElement } from '../../../esl-base-element/core';
/** Interface for option definition */
export interface ESLSelectOption {
/** Label text of the option */
text: string;
/** Value of the option */
value: string;
/** Disabled marker */
disabled: boolean;
/** Selected marker */
selected: boolean;
/** Initially selected marker */
defaultSelected: boolean;
}
/** Interface to declare options source for select components */
export interface ESLSelectModel {
/** Allow multiple items */
multiple: boolean;
/** Get list of options */
options: ESLSelectOption[];
/** Get list of selected options */
selectedOptions: ESLSelectOption[];
/** Toggle option with passed value to the state */
setSelected(value: string, state: boolean): void;
/** Check selected state*/
isSelected(value: string): boolean;
/** Has selected options */
hasSelected(): boolean;
/** Check that all options are selected */
isAllSelected(): boolean;
/** Toggle all options to the state */
setAllSelected(state: boolean): void;
}
/**
* Base class for {@link HTMLSelectElement} wrapper element, implements {@link ESLSelectModel} options source
*/
export declare abstract class ESLSelectWrapper extends ESLBaseElement implements ESLSelectModel {
protected static observationConfig: MutationObserverInit;
private _$select;
private _mutationObserver;
/** Native select that is wrapped */
get $select(): HTMLSelectElement;
set $select(select: HTMLSelectElement);
protected connectedCallback(): void;
protected disconnectedCallback(): void;
protected _onChange(event?: Event): void;
protected _onListChange(): void;
protected _onTargetChange(newTarget: HTMLSelectElement | undefined, oldTarget: HTMLSelectElement | undefined): void;
protected _onTargetMutation(changes: MutationRecord[]): void;
protected _onReset(event: Event): void;
get multiple(): boolean;
get options(): ESLSelectOption[];
get selectedOptions(): ESLSelectOption[];
protected getOption(value: string): ESLSelectOption | undefined;
setSelected(value: string, state: boolean): void;
isSelected(value: string): boolean;
hasSelected(): boolean;
isAllSelected(): boolean;
setAllSelected(state: boolean): void;
get value(): string | undefined;
get values(): string[];
get form(): HTMLFormElement | null;
get name(): string;
set name(name: string);
get required(): boolean;
set required(required: boolean);
get validity(): ValidityState;
get validationMessage(): string;
get willValidate(): boolean;
checkValidity(): boolean;
reportValidity(): boolean;
setCustomValidity(error: string): void;
}