import InputControl from "./InputControl"; import { ComponentFactory, ValueOrAsync } from "../../ComponentFactory"; import TextLabelFactory from "../../TextLabelFactory"; import { KeyEventSignal, KeyHandler } from "../../DOMEvents"; /** Represents a single- or multi-line text input field control (default 100% width) */ export declare class TextField extends InputControl { /** Create a text field */ constructor(name?: string, label?: string | TextLabelFactory, textareaLines?: number); /** Initialize a text field control factory with given values */ static with: (values: TextField.Initializer) => ComponentFactory; /** Initialize a text field control factory with given name, label, and placeholder */ static withName(name: string, label?: string | TextLabelFactory, placeholderText?: string | TextLabelFactory): ComponentFactory; /** Initialize with given (observable) values; returns this */ initializeWith: (values: TextField.Initializer) => this; /** Number of rows for a multiline text field, default 0 (NOT observed) */ textareaLines: number; /** Text field type (text, password, number, etc.; observed) */ type: TextField.Type; /** Current input value (read/write), observable value changes only on blur or enter press, but textField.value always returns live value */ value: string; /** Placeholder text (observed) */ placeholderText: string; /** Select (a part of) the text in this text field, returns this */ selectText(start?: number, end?: number): this | undefined; /** Returns an object containing all current values of input elements (observable) */ getFormValues(result?: {}): {}; /** Sets all input values by element name (will not trigger observable) */ setFormValues(values: any): void; /** Signal emitted after a character key is pressed (while focused) */ readonly KeyPress: KeyEventSignal; /** Signal emitted after a character key is released (while focused) */ readonly KeyUp: KeyEventSignal; /** Signal emitted after the enter key is pressed (while focused), with current input value */ readonly EnterPress: KeyEventSignal; protected focus(): void; protected blur(): void; private _inputElement; private _labelElement; private _observedValue; private _initValueSet; } export declare namespace TextField { /** Text field type options (e.g. Text, Password, Email etc.) */ enum Type { Text = 0, Password = 1, DateTime = 2, Date = 3, Month = 4, Time = 5, Week = 6, Number = 7, Email = 8, Url = 9, Search = 10, Tel = 11, Color = 12, } } export declare namespace TextField { /** Initializer for .with({ ... }) */ interface Initializer extends InputControl.Initializer { /** Property initializer */ textareaLines?: ValueOrAsync; /** Property initializer */ type?: ValueOrAsync; /** Property initializer */ placeholderText?: ValueOrAsync; /** Signal initializer: method name or handler */ KeyPress?: string | KeyHandler; /** Signal initializer: method name or handler */ KeyUp?: string | KeyHandler; /** Signal initializer: method name or handler */ EnterPress?: string | KeyHandler; } } export default TextField;