UNPKG

2.78 kBTypeScriptView Raw
1import { TextBase } from '../text-base';
2import { Color } from '../../color';
3import { FormattedString } from '../text-base/formatted-string';
4import { Style } from '../styling/style';
5import { Property, CssProperty } from '../core/properties';
6import { CoreTypes } from '../../core-types';
7
8/**
9 * Represents the base class for all editable text views.
10 */
11export class EditableTextBase extends TextBase {
12 public static blurEvent: string;
13 public static focusEvent: string;
14 public static textChangeEvent: string;
15
16 /**
17 * Gets or sets the soft keyboard type.
18 */
19 keyboardType: CoreTypes.KeyboardInputType;
20
21 /**
22 * Gets or sets the soft keyboard return key flavor.
23 */
24 returnKeyType: CoreTypes.ReturnKeyButtonType;
25
26 /**
27 * Gets or sets a value indicating when the text property will be updated.
28 */
29 updateTextTrigger: CoreTypes.UpdateTextTriggerType;
30
31 /**
32 * Gets or sets the autocapitalization type.
33 */
34 autocapitalizationType: CoreTypes.AutocapitalizationInputType;
35
36 /**
37 * Gets or sets the autofill type.
38 */
39 autofillType: CoreTypes.AutofillType;
40
41 /**
42 * Gets or sets whether the instance is editable.
43 */
44 editable: boolean;
45
46 /**
47 * Enables or disables autocorrection.
48 */
49 autocorrect: boolean;
50
51 /**
52 * Gets or sets the placeholder text.
53 */
54 hint: string;
55
56 /**
57 * Limits input to a certain number of characters.
58 */
59 maxLength: number;
60
61 /**
62 * Format input values
63 * Note: useful for input masking/formatting
64 */
65 valueFormatter: (value: string) => string;
66
67 /**
68 * Hides the soft input method, ususally a soft keyboard.
69 */
70 dismissSoftInput(): void;
71
72 //@private
73 /**
74 * @private
75 */
76 public _setInputType(inputType: number): void;
77 //@endprivate
78
79 /**
80 * Set the selection anchor to start and the selection edge to stop
81 */
82 public setSelection(start: number, stop?: number);
83}
84
85export const keyboardTypeProperty: Property<EditableTextBase, CoreTypes.KeyboardInputType>;
86export const returnKeyTypeProperty: Property<EditableTextBase, CoreTypes.ReturnKeyButtonType>;
87export const editableProperty: Property<EditableTextBase, boolean>;
88export const updateTextTriggerProperty: Property<EditableTextBase, CoreTypes.UpdateTextTriggerType>;
89export const autocapitalizationTypeProperty: Property<EditableTextBase, CoreTypes.AutocapitalizationInputType>;
90export const autocorrectProperty: Property<EditableTextBase, boolean>;
91export const hintProperty: Property<EditableTextBase, string>;
92export const placeholderColorProperty: CssProperty<Style, Color>;
93export const maxLengthProperty: Property<EditableTextBase, number>;
94
95//@private
96/**
97 * @private
98 */
99export function _updateCharactersInRangeReplacementString(formattedText: FormattedString, rangeLocation: number, rangeLength: number, replacementString: string): void;
100//@endprivate