/** * DevExtreme (ui/context_menu.d.ts) * Version: 25.1.7 * Build date: Mon Nov 10 2025 * * Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ import { DataSourceLike } from '../data/data_source'; import { PositionConfig, } from '../common/core/animation'; import { UserDefinedElement, } from '../core/element'; import { DxPromise, } from '../core/utils/deferred'; import { Cancelable, EventInfo, NativeEventInfo, InitializedEventInfo, ChangedOptionInfo, ItemInfo, DxEvent, PointerInteractionEvent, } from '../events'; import dxMenuBase, { dxMenuBaseOptions, } from './context_menu/ui.menu_base'; import { dxMenuBaseItem, } from './menu'; import { SelectionChangeInfo, } from './collection/ui.collection_widget.base'; export type ContextSubmenuDirection = 'auto' | 'left' | 'right'; /** * The type of the contentReady event handler's argument. */ export type ContentReadyEvent = EventInfo>; /** * The type of the disposing event handler's argument. */ export type DisposingEvent = EventInfo>; /** * The type of the hidden event handler's argument. */ export type HiddenEvent = EventInfo>; /** * The type of the hiding event handler's argument. */ export type HidingEvent = Cancelable & EventInfo>; /** * The type of the initialized event handler's argument. */ export type InitializedEvent = InitializedEventInfo>; /** * The type of the itemClick event handler's argument. */ export type ItemClickEvent = NativeEventInfo, KeyboardEvent | MouseEvent | PointerEvent> & ItemInfo; /** * The type of the itemContextMenu event handler's argument. */ export type ItemContextMenuEvent = NativeEventInfo, PointerInteractionEvent> & ItemInfo; /** * The type of the itemRendered event handler's argument. */ export type ItemRenderedEvent = EventInfo> & ItemInfo; /** * The type of the optionChanged event handler's argument. */ export type OptionChangedEvent = EventInfo> & ChangedOptionInfo; /** * The type of the positioning event handler's argument. */ export type PositioningEvent = NativeEventInfo, PointerInteractionEvent> & { /** * */ readonly position: PositionConfig; }; /** * The type of the selectionChanged event handler's argument. */ export type SelectionChangedEvent = EventInfo> & SelectionChangeInfo; /** * The type of the showing event handler's argument. */ export type ShowingEvent = Cancelable & EventInfo>; /** * The type of the shown event handler's argument. */ export type ShownEvent = EventInfo>; /** * * @deprecated */ export interface dxContextMenuOptions< TKey = any, > extends dxMenuBaseOptions, dxContextMenuItem, TKey> { /** * Binds the UI component to data. */ dataSource?: DataSourceLike | null; /** * Specifies whether to hide the UI component if a user clicks outside it. */ hideOnOutsideClick?: boolean | ((event: DxEvent) => boolean); /** * Holds an array of menu items. */ items?: Array; /** * A function that is executed after the ContextMenu is hidden. */ onHidden?: ((e: HiddenEvent) => void); /** * A function that is executed before the ContextMenu is hidden. */ onHiding?: ((e: HidingEvent) => void); /** * A function that is executed before the ContextMenu is positioned. */ onPositioning?: ((e: PositioningEvent) => void); /** * A function that is executed before the ContextMenu is shown. */ onShowing?: ((e: ShowingEvent) => void); /** * A function that is executed after the ContextMenu is shown. */ onShown?: ((e: ShownEvent) => void); /** * An object defining UI component positioning properties. */ position?: PositionConfig; /** * Specifies properties used to display the UI component. */ showEvent?: { /** * The delay in milliseconds after which the UI component is displayed. */ delay?: number | undefined; /** * Specifies the event names on which the UI component is shown. */ name?: string | undefined; } | string; /** * Specifies the direction at which submenus are displayed. */ submenuDirection?: ContextSubmenuDirection; /** * The target element associated with the context menu. */ target?: string | UserDefinedElement | undefined; /** * A Boolean value specifying whether or not the UI component is visible. */ visible?: boolean; } /** * The ContextMenu UI component displays a single- or multi-level context menu. An end user invokes this menu by a right click or a long press. */ export default class dxContextMenu< TKey = any, > extends dxMenuBase, dxContextMenuItem, TKey> { /** * Hides the UI component. */ hide(): DxPromise; /** * Shows the UI component. */ show(): DxPromise; /** * Shows or hides the UI component depending on the argument. */ toggle(showing: boolean): DxPromise; } export type Item = dxContextMenuItem; /** * @deprecated Use Item 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 interface dxContextMenuItem extends dxMenuBaseItem { /** * Specifies nested menu items. */ items?: Array; } export type ExplicitTypes = { Properties: Properties; ContentReadyEvent: ContentReadyEvent; DisposingEvent: DisposingEvent; HiddenEvent: HiddenEvent; HidingEvent: HidingEvent; InitializedEvent: InitializedEvent; ItemClickEvent: ItemClickEvent; ItemContextMenuEvent: ItemContextMenuEvent; ItemRenderedEvent: ItemRenderedEvent; OptionChangedEvent: OptionChangedEvent; PositioningEvent: PositioningEvent; SelectionChangedEvent: SelectionChangedEvent; ShowingEvent: ShowingEvent; ShownEvent: ShownEvent; }; export type Properties = dxContextMenuOptions; /** * @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;