devextreme
Version:
HTML5 JavaScript Component Suite for Responsive Web Development
231 lines (193 loc) • 7.22 kB
TypeScript
/**
* DevExtreme (ui/select_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 {
UserDefinedElement,
DxElement,
} from '../core/element';
import {
template,
} from '../common';
import {
EventInfo,
NativeEventInfo,
InitializedEventInfo,
ChangedOptionInfo,
ItemInfo,
} from '../common/core/events';
import {
DropDownButtonTemplateDataModel,
} from './drop_down_editor/ui.drop_down_editor';
import dxDropDownList, {
dxDropDownListOptions,
SelectionChangedInfo,
} from './drop_down_editor/ui.drop_down_list';
import {
ValueChangedInfo,
} from './editor/editor';
import {
Properties as PopupProperties,
} from './popup';
/**
*
* @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 CustomItemCreatingInfo {
/**
*
*/
readonly text?: string;
/**
*
*/
customItem?: string | any | PromiseLike<any>;
}
/**
* The type of the change event handler's argument.
*/
export type ChangeEvent = NativeEventInfo<dxSelectBox, Event>;
/**
* The type of the closed event handler's argument.
*/
export type ClosedEvent = EventInfo<dxSelectBox>;
/**
* The type of the contentReady event handler's argument.
*/
export type ContentReadyEvent = EventInfo<dxSelectBox>;
/**
* The type of the copy event handler's argument.
*/
export type CopyEvent = NativeEventInfo<dxSelectBox, ClipboardEvent>;
/**
* The type of the customItemCreating event handler's argument.
*/
export type CustomItemCreatingEvent = EventInfo<dxSelectBox> & CustomItemCreatingInfo;
/**
* The type of the cut event handler's argument.
*/
export type CutEvent = NativeEventInfo<dxSelectBox, ClipboardEvent>;
/**
* The type of the disposing event handler's argument.
*/
export type DisposingEvent = EventInfo<dxSelectBox>;
/**
* The type of the enterKey event handler's argument.
*/
export type EnterKeyEvent = NativeEventInfo<dxSelectBox, KeyboardEvent>;
/**
* The type of the focusIn event handler's argument.
*/
export type FocusInEvent = NativeEventInfo<dxSelectBox, FocusEvent>;
/**
* The type of the focusOut event handler's argument.
*/
export type FocusOutEvent = NativeEventInfo<dxSelectBox, FocusEvent>;
/**
* The type of the initialized event handler's argument.
*/
export type InitializedEvent = InitializedEventInfo<dxSelectBox>;
/**
* The type of the input event handler's argument.
*/
export type InputEvent = NativeEventInfo<dxSelectBox, UIEvent & { target: HTMLInputElement }>;
/**
* The type of the itemClick event handler's argument.
*/
export type ItemClickEvent = NativeEventInfo<dxSelectBox, KeyboardEvent | MouseEvent | PointerEvent> & ItemInfo;
/**
* The type of the keyDown event handler's argument.
*/
export type KeyDownEvent = NativeEventInfo<dxSelectBox, KeyboardEvent>;
export type KeyPressEvent = NativeEventInfo<dxSelectBox, KeyboardEvent>;
/**
* The type of the keyUp event handler's argument.
*/
export type KeyUpEvent = NativeEventInfo<dxSelectBox, KeyboardEvent>;
/**
* The type of the opened event handler's argument.
*/
export type OpenedEvent = EventInfo<dxSelectBox>;
/**
* The type of the optionChanged event handler's argument.
*/
export type OptionChangedEvent = EventInfo<dxSelectBox> & ChangedOptionInfo;
/**
* The type of the paste event handler's argument.
*/
export type PasteEvent = NativeEventInfo<dxSelectBox, ClipboardEvent>;
/**
* The type of the selectionChanged event handler's argument.
*/
export type SelectionChangedEvent = EventInfo<dxSelectBox> & SelectionChangedInfo;
/**
* The type of the valueChanged event handler's argument.
*/
export type ValueChangedEvent = NativeEventInfo<dxSelectBox, KeyboardEvent | MouseEvent | Event> & ValueChangedInfo;
export type DropDownButtonTemplateData = DropDownButtonTemplateDataModel;
/**
*
* @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 dxSelectBoxOptions<TComponent> extends dxDropDownListOptions<TComponent> {
/**
* Specifies whether the UI component allows a user to enter a custom value. Requires the onCustomItemCreating handler implementation.
*/
acceptCustomValue?: boolean;
/**
* Specifies a custom template for the text field. Must contain the TextBox UI component.
*/
fieldTemplate?: template | ((selectedItem: any, fieldElement: DxElement) => string | UserDefinedElement);
/**
* A function that is executed when a user adds a custom item. Requires acceptCustomValue to be set to true.
*/
onCustomItemCreating?: ((e: EventInfo<TComponent> & CustomItemCreatingInfo) => void);
/**
* Specifies whether a user can open the drop-down list by clicking a text field.
*/
openOnFieldClick?: boolean;
/**
* The text that is provided as a hint in the select box editor.
*/
placeholder?: string;
/**
* Specifies whether the drop-down button is visible.
*/
showDropDownButton?: boolean;
/**
* Specifies whether or not to display selection controls.
*/
showSelectionControls?: boolean;
/**
* Specifies the DOM events after which the UI component's value should be updated. Applies only if acceptCustomValue is set to true.
* @deprecated Use the customItemCreateEvent option instead.
*/
valueChangeEvent?: string;
/**
* Specifies the DOM event after which the custom item should be created. Applies only if acceptCustomValue is enabled.
*/
customItemCreateEvent?: string;
/**
* Configures the drop-down field which holds the content.
*/
dropDownOptions?: PopupProperties;
}
/**
* The SelectBox UI component is an editor that allows an end user to select an item from a drop-down list.
*/
export default class dxSelectBox<TProperties = Properties> extends dxDropDownList<TProperties> { }
/**
* @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.
*/
interface SelectBoxInstance extends dxSelectBox<Properties> { }
export type Properties = dxSelectBoxOptions<SelectBoxInstance>;
/**
* @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 = Properties;