devextreme-angular
Version:
Angular UI and visualization components based on DevExtreme widgets
653 lines (483 loc) • 25.6 kB
TypeScript
/*!
* devextreme-angular
* Version: 24.2.6
* Build date: Mon Mar 17 2025
*
* Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file in the root of the project for details.
*
* https://github.com/DevExpress/devextreme-angular
*/
import { TransferState, ElementRef, NgZone, OnDestroy, EventEmitter, OnChanges, DoCheck, SimpleChanges, QueryList } from '@angular/core';
import { TextBoxPredefinedButton, TextEditorButton, LabelMode, MaskMode, EditorStyle, ValidationMessageMode, Position, ValidationStatus } from 'devextreme/common';
import { TextBoxType, ChangeEvent, ContentReadyEvent, CopyEvent, CutEvent, DisposingEvent, EnterKeyEvent, FocusInEvent, FocusOutEvent, InitializedEvent, InputEvent, KeyDownEvent, KeyUpEvent, OptionChangedEvent, PasteEvent, ValueChangedEvent } from 'devextreme/ui/text_box';
import DxTextBox from 'devextreme/ui/text_box';
import { ControlValueAccessor } from '@angular/forms';
import { DxComponent, DxTemplateHost, NestedOptionHost, IterableDifferHelper, WatcherHelper } from 'devextreme-angular/core';
import { DxiButtonComponent } from 'devextreme-angular/ui/nested';
import { DxiTextBoxButtonComponent } from 'devextreme-angular/ui/text-box/nested';
import type * as DxTextBoxTypes from "devextreme/ui/text_box_types";
import * as i0 from "@angular/core";
import * as i1 from "devextreme-angular/ui/nested";
import * as i2 from "devextreme-angular/ui/text-box/nested";
import * as i3 from "devextreme-angular/core";
/**
* The TextBox is a UI component that enables a user to enter and edit a single line of text.
*/
export declare class DxTextBoxComponent extends DxComponent implements OnDestroy, ControlValueAccessor, OnChanges, DoCheck {
private _watcherHelper;
private _idh;
instance: DxTextBox;
/**
* Specifies the shortcut key that sets focus on the UI component.
*/
get accessKey(): string | undefined;
set accessKey(value: string | undefined);
/**
* Specifies whether the UI component changes its visual state as a result of user interaction.
*/
get activeStateEnabled(): boolean;
set activeStateEnabled(value: boolean);
/**
* Allows you to add custom buttons to the input text field.
*/
get buttons(): Array<string | TextBoxPredefinedButton | TextEditorButton>;
set buttons(value: Array<string | TextBoxPredefinedButton | TextEditorButton>);
/**
* Specifies whether the UI component responds to user interaction.
*/
get disabled(): boolean;
set disabled(value: boolean);
/**
* Specifies the global attributes to be attached to the UI component's container element.
*/
get elementAttr(): Record<string, any>;
set elementAttr(value: Record<string, any>);
/**
* Specifies whether the UI component can be focused using keyboard navigation.
*/
get focusStateEnabled(): boolean;
set focusStateEnabled(value: boolean);
/**
* Specifies the UI component's height.
*/
get height(): (() => number | string) | number | string | undefined;
set height(value: (() => number | string) | number | string | undefined);
/**
* Specifies text for a hint that appears when a user pauses on the UI component.
*/
get hint(): string | undefined;
set hint(value: string | undefined);
/**
* Specifies whether the UI component changes its state when a user pauses on it.
*/
get hoverStateEnabled(): boolean;
set hoverStateEnabled(value: boolean);
/**
* Specifies the attributes to be passed on to the underlying HTML element.
*/
get inputAttr(): any;
set inputAttr(value: any);
/**
* Specifies whether the component's current value differs from the initial value.
*/
get isDirty(): boolean;
set isDirty(value: boolean);
/**
* Specifies or indicates whether the editor's value is valid.
*/
get isValid(): boolean;
set isValid(value: boolean);
/**
* Specifies a text string used to annotate the editor's value.
*/
get label(): string;
set label(value: string);
/**
* Specifies the label's display mode.
*/
get labelMode(): LabelMode;
set labelMode(value: LabelMode);
/**
* The editor mask that specifies the custom format of the entered string.
*/
get mask(): string;
set mask(value: string);
/**
* Specifies a mask placeholder. A single character is recommended.
*/
get maskChar(): string;
set maskChar(value: string);
/**
* A message displayed when the entered text does not match the specified pattern.
*/
get maskInvalidMessage(): string;
set maskInvalidMessage(value: string);
/**
* Specifies custom mask rules.
*/
get maskRules(): any;
set maskRules(value: any);
/**
* Specifies the maximum number of characters you can enter into the textbox.
*/
get maxLength(): number | string;
set maxLength(value: number | string);
/**
* The 'mode' attribute value of the actual HTML input element representing the text box.
*/
get mode(): TextBoxType;
set mode(value: TextBoxType);
/**
* The value to be assigned to the `name` attribute of the underlying HTML element.
*/
get name(): string;
set name(value: string);
/**
* Specifies a text string displayed when the editor's value is empty.
*/
get placeholder(): string;
set placeholder(value: string);
/**
* Specifies whether the editor is read-only.
*/
get readOnly(): boolean;
set readOnly(value: boolean);
/**
* Switches the UI component to a right-to-left representation.
*/
get rtlEnabled(): boolean;
set rtlEnabled(value: boolean);
/**
* Specifies whether to display the Clear button in the UI component.
*/
get showClearButton(): boolean;
set showClearButton(value: boolean);
/**
* Specifies when the UI component shows the mask. Applies only if useMaskedValue is true.
*/
get showMaskMode(): MaskMode;
set showMaskMode(value: MaskMode);
/**
* Specifies whether or not the UI component checks the inner text for spelling mistakes.
*/
get spellcheck(): boolean;
set spellcheck(value: boolean);
/**
* Specifies how the UI component's text field is styled.
*/
get stylingMode(): EditorStyle;
set stylingMode(value: EditorStyle);
/**
* Specifies the number of the element when the Tab key is used for navigating.
*/
get tabIndex(): number;
set tabIndex(value: number);
/**
* The read-only property that holds the text displayed by the UI component input element.
*/
get text(): string;
set text(value: string);
/**
* Specifies whether the value should contain mask characters or not.
*/
get useMaskedValue(): boolean;
set useMaskedValue(value: boolean);
/**
* Information on the broken validation rule. Contains the first item from the validationErrors array.
*/
get validationError(): any;
set validationError(value: any);
/**
* An array of the validation rules that failed.
*/
get validationErrors(): Array<any>;
set validationErrors(value: Array<any>);
/**
* Specifies how the message about the validation rules that are not satisfied by this editor's value is displayed.
*/
get validationMessageMode(): ValidationMessageMode;
set validationMessageMode(value: ValidationMessageMode);
/**
* Specifies the position of a validation message relative to the component. The validation message describes the validation rules that this component's value does not satisfy.
*/
get validationMessagePosition(): Position;
set validationMessagePosition(value: Position);
/**
* Indicates or specifies the current validation status.
*/
get validationStatus(): ValidationStatus;
set validationStatus(value: ValidationStatus);
/**
* Specifies a value the UI component displays.
*/
get value(): string;
set value(value: string);
/**
* Specifies the DOM events after which the UI component's value should be updated.
*/
get valueChangeEvent(): string;
set valueChangeEvent(value: string);
/**
* Specifies whether the UI component is visible.
*/
get visible(): boolean;
set visible(value: boolean);
/**
* Specifies the UI component's width.
*/
get width(): (() => number | string) | number | string | undefined;
set width(value: (() => number | string) | number | string | undefined);
/**
* A function that is executed when the UI component loses focus after the text field's content was changed using the keyboard.
*/
onChange: EventEmitter<ChangeEvent>;
/**
* A function that is executed when the UI component is rendered and each time the component is repainted.
*/
onContentReady: EventEmitter<ContentReadyEvent>;
/**
* A function that is executed when the UI component's input has been copied.
*/
onCopy: EventEmitter<CopyEvent>;
/**
* A function that is executed when the UI component's input has been cut.
*/
onCut: EventEmitter<CutEvent>;
/**
* A function that is executed before the UI component is disposed of.
*/
onDisposing: EventEmitter<DisposingEvent>;
/**
* A function that is executed when the Enter key has been pressed while the UI component is focused.
*/
onEnterKey: EventEmitter<EnterKeyEvent>;
/**
* A function that is executed when the UI component gets focus.
*/
onFocusIn: EventEmitter<FocusInEvent>;
/**
* A function that is executed when the UI component loses focus.
*/
onFocusOut: EventEmitter<FocusOutEvent>;
/**
* A function used in JavaScript frameworks to save the UI component instance.
*/
onInitialized: EventEmitter<InitializedEvent>;
/**
* A function that is executed each time the UI component's input is changed while the UI component is focused.
*/
onInput: EventEmitter<InputEvent>;
/**
* A function that is executed when a user is pressing a key on the keyboard.
*/
onKeyDown: EventEmitter<KeyDownEvent>;
/**
* A function that is executed when a user releases a key on the keyboard.
*/
onKeyUp: EventEmitter<KeyUpEvent>;
/**
* A function that is executed after a UI component property is changed.
*/
onOptionChanged: EventEmitter<OptionChangedEvent>;
/**
* A function that is executed when the UI component's input has been pasted.
*/
onPaste: EventEmitter<PasteEvent>;
/**
* A function that is executed after the UI component's value is changed.
*/
onValueChanged: EventEmitter<ValueChangedEvent>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
accessKeyChange: EventEmitter<string | undefined>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
activeStateEnabledChange: EventEmitter<boolean>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
buttonsChange: EventEmitter<Array<string | TextBoxPredefinedButton | TextEditorButton>>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
disabledChange: EventEmitter<boolean>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
elementAttrChange: EventEmitter<Record<string, any>>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
focusStateEnabledChange: EventEmitter<boolean>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
heightChange: EventEmitter<(() => number | string) | number | string | undefined>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
hintChange: EventEmitter<string | undefined>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
hoverStateEnabledChange: EventEmitter<boolean>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
inputAttrChange: EventEmitter<any>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
isDirtyChange: EventEmitter<boolean>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
isValidChange: EventEmitter<boolean>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
labelChange: EventEmitter<string>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
labelModeChange: EventEmitter<LabelMode>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
maskChange: EventEmitter<string>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
maskCharChange: EventEmitter<string>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
maskInvalidMessageChange: EventEmitter<string>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
maskRulesChange: EventEmitter<any>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
maxLengthChange: EventEmitter<number | string>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
modeChange: EventEmitter<TextBoxType>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
nameChange: EventEmitter<string>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
placeholderChange: EventEmitter<string>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
readOnlyChange: EventEmitter<boolean>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
rtlEnabledChange: EventEmitter<boolean>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
showClearButtonChange: EventEmitter<boolean>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
showMaskModeChange: EventEmitter<MaskMode>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
spellcheckChange: EventEmitter<boolean>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
stylingModeChange: EventEmitter<EditorStyle>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
tabIndexChange: EventEmitter<number>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
textChange: EventEmitter<string>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
useMaskedValueChange: EventEmitter<boolean>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
validationErrorChange: EventEmitter<any>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
validationErrorsChange: EventEmitter<Array<any>>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
validationMessageModeChange: EventEmitter<ValidationMessageMode>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
validationMessagePositionChange: EventEmitter<Position>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
validationStatusChange: EventEmitter<ValidationStatus>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
valueChange: EventEmitter<string>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
valueChangeEventChange: EventEmitter<string>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
visibleChange: EventEmitter<boolean>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
widthChange: EventEmitter<(() => number | string) | number | string | undefined>;
/**
*
*/
onBlur: EventEmitter<any>;
change(_: any): void;
touched: (_: any) => void;
get buttonsChildren(): QueryList<DxiTextBoxButtonComponent>;
set buttonsChildren(value: QueryList<DxiTextBoxButtonComponent>);
get buttonsLegacyChildren(): QueryList<DxiButtonComponent>;
set buttonsLegacyChildren(value: QueryList<DxiButtonComponent>);
constructor(elementRef: ElementRef, ngZone: NgZone, templateHost: DxTemplateHost, _watcherHelper: WatcherHelper, _idh: IterableDifferHelper, optionHost: NestedOptionHost, transferState: TransferState, platformId: any);
protected _createInstance(element: any, options: any): DxTextBox<any>;
writeValue(value: any): void;
setDisabledState(isDisabled: boolean): void;
registerOnChange(fn: (_: any) => void): void;
registerOnTouched(fn: () => void): void;
_createWidget(element: any): void;
ngOnDestroy(): void;
ngOnChanges(changes: SimpleChanges): void;
setupChanges(prop: string, changes: SimpleChanges): void;
ngDoCheck(): void;
_setOption(name: string, value: any): void;
static ɵfac: i0.ɵɵFactoryDeclaration<DxTextBoxComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<DxTextBoxComponent, "dx-text-box", never, { "accessKey": { "alias": "accessKey"; "required": false; }; "activeStateEnabled": { "alias": "activeStateEnabled"; "required": false; }; "buttons": { "alias": "buttons"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "elementAttr": { "alias": "elementAttr"; "required": false; }; "focusStateEnabled": { "alias": "focusStateEnabled"; "required": false; }; "height": { "alias": "height"; "required": false; }; "hint": { "alias": "hint"; "required": false; }; "hoverStateEnabled": { "alias": "hoverStateEnabled"; "required": false; }; "inputAttr": { "alias": "inputAttr"; "required": false; }; "isDirty": { "alias": "isDirty"; "required": false; }; "isValid": { "alias": "isValid"; "required": false; }; "label": { "alias": "label"; "required": false; }; "labelMode": { "alias": "labelMode"; "required": false; }; "mask": { "alias": "mask"; "required": false; }; "maskChar": { "alias": "maskChar"; "required": false; }; "maskInvalidMessage": { "alias": "maskInvalidMessage"; "required": false; }; "maskRules": { "alias": "maskRules"; "required": false; }; "maxLength": { "alias": "maxLength"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; "name": { "alias": "name"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "readOnly": { "alias": "readOnly"; "required": false; }; "rtlEnabled": { "alias": "rtlEnabled"; "required": false; }; "showClearButton": { "alias": "showClearButton"; "required": false; }; "showMaskMode": { "alias": "showMaskMode"; "required": false; }; "spellcheck": { "alias": "spellcheck"; "required": false; }; "stylingMode": { "alias": "stylingMode"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; "text": { "alias": "text"; "required": false; }; "useMaskedValue": { "alias": "useMaskedValue"; "required": false; }; "validationError": { "alias": "validationError"; "required": false; }; "validationErrors": { "alias": "validationErrors"; "required": false; }; "validationMessageMode": { "alias": "validationMessageMode"; "required": false; }; "validationMessagePosition": { "alias": "validationMessagePosition"; "required": false; }; "validationStatus": { "alias": "validationStatus"; "required": false; }; "value": { "alias": "value"; "required": false; }; "valueChangeEvent": { "alias": "valueChangeEvent"; "required": false; }; "visible": { "alias": "visible"; "required": false; }; "width": { "alias": "width"; "required": false; }; }, { "onChange": "onChange"; "onContentReady": "onContentReady"; "onCopy": "onCopy"; "onCut": "onCut"; "onDisposing": "onDisposing"; "onEnterKey": "onEnterKey"; "onFocusIn": "onFocusIn"; "onFocusOut": "onFocusOut"; "onInitialized": "onInitialized"; "onInput": "onInput"; "onKeyDown": "onKeyDown"; "onKeyUp": "onKeyUp"; "onOptionChanged": "onOptionChanged"; "onPaste": "onPaste"; "onValueChanged": "onValueChanged"; "accessKeyChange": "accessKeyChange"; "activeStateEnabledChange": "activeStateEnabledChange"; "buttonsChange": "buttonsChange"; "disabledChange": "disabledChange"; "elementAttrChange": "elementAttrChange"; "focusStateEnabledChange": "focusStateEnabledChange"; "heightChange": "heightChange"; "hintChange": "hintChange"; "hoverStateEnabledChange": "hoverStateEnabledChange"; "inputAttrChange": "inputAttrChange"; "isDirtyChange": "isDirtyChange"; "isValidChange": "isValidChange"; "labelChange": "labelChange"; "labelModeChange": "labelModeChange"; "maskChange": "maskChange"; "maskCharChange": "maskCharChange"; "maskInvalidMessageChange": "maskInvalidMessageChange"; "maskRulesChange": "maskRulesChange"; "maxLengthChange": "maxLengthChange"; "modeChange": "modeChange"; "nameChange": "nameChange"; "placeholderChange": "placeholderChange"; "readOnlyChange": "readOnlyChange"; "rtlEnabledChange": "rtlEnabledChange"; "showClearButtonChange": "showClearButtonChange"; "showMaskModeChange": "showMaskModeChange"; "spellcheckChange": "spellcheckChange"; "stylingModeChange": "stylingModeChange"; "tabIndexChange": "tabIndexChange"; "textChange": "textChange"; "useMaskedValueChange": "useMaskedValueChange"; "validationErrorChange": "validationErrorChange"; "validationErrorsChange": "validationErrorsChange"; "validationMessageModeChange": "validationMessageModeChange"; "validationMessagePositionChange": "validationMessagePositionChange"; "validationStatusChange": "validationStatusChange"; "valueChange": "valueChange"; "valueChangeEventChange": "valueChangeEventChange"; "visibleChange": "visibleChange"; "widthChange": "widthChange"; "onBlur": "onBlur"; }, ["buttonsChildren", "buttonsLegacyChildren"], never, false, never>;
}
export declare class DxTextBoxModule {
static ɵfac: i0.ɵɵFactoryDeclaration<DxTextBoxModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<DxTextBoxModule, [typeof DxTextBoxComponent], [typeof i1.DxiButtonModule, typeof i1.DxoOptionsModule, typeof i2.DxiTextBoxButtonModule, typeof i2.DxoTextBoxOptionsModule, typeof i3.DxIntegrationModule, typeof i3.DxTemplateModule], [typeof DxTextBoxComponent, typeof i1.DxiButtonModule, typeof i1.DxoOptionsModule, typeof i2.DxiTextBoxButtonModule, typeof i2.DxoTextBoxOptionsModule, typeof i3.DxTemplateModule]>;
static ɵinj: i0.ɵɵInjectorDeclaration<DxTextBoxModule>;
}
export { DxTextBoxTypes };