UNPKG

@playcanvas/pcui

Version:

User interface component library for the web

76 lines (75 loc) 2.84 kB
import { Element, ElementArgs, IBindable, IBindableArgs, IFocusable, IPlaceholder, IPlaceholderArgs } from '../Element'; /** * The arguments for the {@link InputElement} constructor. */ interface InputElementArgs extends ElementArgs, IBindableArgs, IPlaceholderArgs { /** * Sets whether pressing Enter will blur (unfocus) the field. Defaults to `true`. */ blurOnEnter?: boolean; /** * Sets whether pressing Escape will blur (unfocus) the field. Defaults to `true`. */ blurOnEscape?: boolean; /** * Sets whether any key up event will cause a change event to be fired. */ keyChange?: boolean; /** * The input element to associate this {@link InputElement} with. If not supplied one will be created instead. */ input?: HTMLInputElement; } /** * The InputElement is an abstract class that manages an input DOM element. It is the superclass of * {@link TextInput} and {@link NumericInput}. It is not intended to be used directly. */ declare abstract class InputElement extends Element implements IBindable, IFocusable, IPlaceholder { /** * Determines whether the input should blur when the enter key is pressed. */ blurOnEnter: boolean; /** * Determines whether the input should blur when the escape key is pressed. */ blurOnEscape: boolean; protected _domInput: HTMLInputElement; protected _suspendInputChangeEvt: boolean; protected _prevValue: string; protected _keyChange: boolean; protected _renderChanges: boolean; protected _onInputKeyDownEvt: (evt: KeyboardEvent) => void; protected _onInputChangeEvt: (evt: Event) => void; constructor(args?: InputElementArgs); destroy(): void; protected _onInputFocus: (evt: FocusEvent) => void; protected _onInputBlur: (evt: FocusEvent) => void; protected _onInputKeyDown(evt: KeyboardEvent): void; protected _onInputChange(evt: Event): void; protected _onInputKeyUp: (evt: KeyboardEvent) => void; protected _onInputCtxMenu: (evt: MouseEvent) => void; protected _updateInputReadOnly: () => void; focus(select?: boolean): void; blur(): void; set placeholder(value: string); get placeholder(): string; /** * Sets the method to call when keyup is called on the input DOM element. */ set keyChange(value: boolean); /** * Gets the method to call when keyup is called on the input DOM element. */ get keyChange(): boolean; /** * Gets the input DOM element. */ get input(): HTMLInputElement; abstract set value(value: any); abstract get value(): any; abstract set values(value: Array<any>); abstract get values(): Array<any>; set renderChanges(value: boolean); get renderChanges(): boolean; } export { InputElement, InputElementArgs };