devextreme
Version:
HTML5 JavaScript Component Suite for Responsive Web Development
96 lines (86 loc) • 4.05 kB
TypeScript
/**
* DevExtreme (ui/context_menu.d.ts)
* Version: 20.1.7
* Build date: Tue Aug 25 2020
*
* Copyright (c) 2012 - 2020 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
import {
positionConfig
} from '../animation/position';
import '../jquery_augmentation';
import {
dxElement
} from '../core/element';
import DataSource, {
DataSourceOptions
} from '../data/data_source';
import {
event
} from '../events/index';
import dxMenuBase, {
dxMenuBaseOptions
} from './context_menu/ui.menu_base';
import {
dxMenuBaseItem
} from './menu';
/** Warning! This type is used for internal purposes. Do not import it directly. */
export interface dxContextMenuOptions extends dxMenuBaseOptions<dxContextMenu> {
/** Specifies whether to close the ContextMenu if a user clicks outside it. */
closeOnOutsideClick?: boolean | ((event: event) => boolean);
/** Binds the widget to data. */
dataSource?: string | Array<dxContextMenuItem> | DataSource | DataSourceOptions;
/** Holds an array of menu items. */
items?: Array<dxContextMenuItem>;
/** A function that is executed after the ContextMenu is hidden. */
onHidden?: ((e: { component?: dxContextMenu, element?: dxElement, model?: any }) => any);
/** A function that is executed before the ContextMenu is hidden. */
onHiding?: ((e: { component?: dxContextMenu, element?: dxElement, model?: any, cancel?: boolean }) => any);
/** A function that is executed before the ContextMenu is positioned. */
onPositioning?: ((e: { component?: dxContextMenu, element?: dxElement, model?: any, jQueryEvent?: JQueryEventObject, event?: event, position?: positionConfig }) => any);
/** A function that is executed before the ContextMenu is shown. */
onShowing?: ((e: { component?: dxContextMenu, element?: dxElement, model?: any, cancel?: boolean }) => any);
/** A function that is executed after the ContextMenu is shown. */
onShown?: ((e: { component?: dxContextMenu, element?: dxElement, model?: any }) => any);
/** An object defining widget positioning options. */
position?: positionConfig;
/** Specifies options for displaying the widget. */
showEvent?: { delay?: number, name?: string } | string;
/** Specifies the direction at which submenus are displayed. */
submenuDirection?: 'auto' | 'left' | 'right';
/** The target element associated with the context menu. */
target?: string | Element | JQuery;
/** A Boolean value specifying whether or not the widget is visible. */
visible?: boolean;
}
/** The ContextMenu widget 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 extends dxMenuBase {
constructor(element: Element, options?: dxContextMenuOptions)
constructor(element: JQuery, options?: dxContextMenuOptions)
/** Hides the widget. */
hide(): Promise<void> & JQueryPromise<void>;
/** Shows the widget. */
show(): Promise<void> & JQueryPromise<void>;
/** Shows or hides the widget depending on the argument. */
toggle(showing: boolean): Promise<void> & JQueryPromise<void>;
}
/** Warning! This type is used for internal purposes. Do not import it directly. */
export interface dxContextMenuItem extends dxMenuBaseItem {
/** Specifies nested menu items. */
items?: Array<dxContextMenuItem>;
}
declare global {
interface JQuery {
dxContextMenu(): JQuery;
dxContextMenu(options: "instance"): dxContextMenu;
dxContextMenu(options: string): any;
dxContextMenu(options: string, ...params: any[]): any;
dxContextMenu(options: dxContextMenuOptions): JQuery;
}
}
/** Warning! This type is used for internal purposes. Do not import it directly. */
export type Options = dxContextMenuOptions;
/** @deprecated use Options instead */
/** Warning! This type is used for internal purposes. Do not import it directly. */
export type IOptions = dxContextMenuOptions;