devextreme
Version:
HTML5 JavaScript Component Suite for Responsive Web Development
178 lines (151 loc) • 5.33 kB
TypeScript
/**
* DevExtreme (ui/number_box.d.ts)
* Version: 24.2.6
* Build date: Mon Mar 17 2025
*
* Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
import {
EventInfo,
NativeEventInfo,
InitializedEventInfo,
ChangedOptionInfo,
} from '../common/core/events';
import {
TextEditorButton,
} from '../common';
import dxTextEditor, {
dxTextEditorOptions,
} from './text_box/ui.text_editor.base';
import {
ValueChangedInfo,
} from './editor/editor';
import {
Format,
} from '../localization';
export type NumberBoxPredefinedButton = 'clear' | 'spins';
export type NumberBoxType = 'number' | 'text' | 'tel';
/**
* The type of the change event handler's argument.
*/
export type ChangeEvent = NativeEventInfo<dxNumberBox, Event>;
/**
* The type of the contentReady event handler's argument.
*/
export type ContentReadyEvent = EventInfo<dxNumberBox>;
/**
* The type of the copy event handler's argument.
*/
export type CopyEvent = NativeEventInfo<dxNumberBox, ClipboardEvent>;
/**
* The type of the cut event handler's argument.
*/
export type CutEvent = NativeEventInfo<dxNumberBox, ClipboardEvent>;
/**
* The type of the disposing event handler's argument.
*/
export type DisposingEvent = EventInfo<dxNumberBox>;
/**
* The type of the enterKey event handler's argument.
*/
export type EnterKeyEvent = NativeEventInfo<dxNumberBox, KeyboardEvent>;
/**
* The type of the focusIn event handler's argument.
*/
export type FocusInEvent = NativeEventInfo<dxNumberBox, FocusEvent>;
/**
* The type of the focusOut event handler's argument.
*/
export type FocusOutEvent = NativeEventInfo<dxNumberBox, FocusEvent>;
/**
* The type of the initialized event handler's argument.
*/
export type InitializedEvent = InitializedEventInfo<dxNumberBox>;
/**
* The type of the input event handler's argument.
*/
export type InputEvent = NativeEventInfo<dxNumberBox, UIEvent & { target: HTMLInputElement }>;
/**
* The type of the keyDown event handler's argument.
*/
export type KeyDownEvent = NativeEventInfo<dxNumberBox, KeyboardEvent>;
export type KeyPressEvent = NativeEventInfo<dxNumberBox, KeyboardEvent>;
/**
* The type of the keyUp event handler's argument.
*/
export type KeyUpEvent = NativeEventInfo<dxNumberBox, KeyboardEvent>;
/**
* The type of the optionChanged event handler's argument.
*/
export type OptionChangedEvent = EventInfo<dxNumberBox> & ChangedOptionInfo;
/**
* The type of the paste event handler's argument.
*/
export type PasteEvent = NativeEventInfo<dxNumberBox, ClipboardEvent>;
/**
* The type of the valueChanged event handler's argument.
*/
export type ValueChangedEvent = NativeEventInfo<dxNumberBox, KeyboardEvent | MouseEvent | PointerEvent | TouchEvent | Event> & ValueChangedInfo;
/**
*
* @deprecated
* @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution.
*/
export interface dxNumberBoxOptions extends dxTextEditorOptions<dxNumberBox> {
/**
* Allows you to add custom buttons to the input text field.
*/
buttons?: Array<NumberBoxPredefinedButton | TextEditorButton>;
/**
* Specifies the value's display format and controls user input accordingly.
*/
format?: Format;
/**
* Specifies the text of the message displayed if the specified value is not a number.
*/
invalidValueMessage?: string;
/**
* The maximum value accepted by the number box.
*/
max?: number | undefined;
/**
* The minimum value accepted by the number box.
*/
min?: number | undefined;
/**
* Specifies the value to be passed to the type attribute of the underlying `` element.
*/
mode?: NumberBoxType;
/**
* Specifies whether to show the buttons that change the value by a step.
*/
showSpinButtons?: boolean;
/**
* Specifies how much the UI component's value changes when using the spin buttons, Up/Down arrow keys, or mouse wheel.
*/
step?: number;
/**
* Specifies whether to use touch friendly spin buttons. Applies only if showSpinButtons is true.
*/
useLargeSpinButtons?: boolean;
/**
* The current number box value.
*/
value?: number;
}
/**
* The NumberBox is a UI component that displays a numeric value and allows a user to modify it by typing in a value, and incrementing or decrementing it using the keyboard or mouse.
*/
export default class dxNumberBox extends dxTextEditor<dxNumberBoxOptions> {
/**
* Resets the value property to the value passed as an argument.
*/
reset(value?: number): void;
}
export type Properties = dxNumberBoxOptions;
/**
* @deprecated use Properties instead
* @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution.
*/
export type Options = dxNumberBoxOptions;