devextreme-angular
Version:
Angular UI and visualization components based on DevExtreme widgets
560 lines (425 loc) • 24.2 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 DataSource from 'devextreme/data/data_source';
import { AnimationConfig, PositionConfig } from 'devextreme/common/core/animation';
import { event } from 'devextreme/events/events.types';
import { dxContextMenuItem, ContentReadyEvent, DisposingEvent, HiddenEvent, HidingEvent, InitializedEvent, ItemClickEvent, ItemContextMenuEvent, ItemRenderedEvent, OptionChangedEvent, PositioningEvent, SelectionChangedEvent, ShowingEvent, ShownEvent, ContextSubmenuDirection } from 'devextreme/ui/context_menu';
import { DataSourceOptions } from 'devextreme/data/data_source';
import { Store } from 'devextreme/data/store';
import { SingleOrNone, SubmenuShowMode } from 'devextreme/common';
import DxContextMenu from 'devextreme/ui/context_menu';
import { DxComponent, DxTemplateHost, NestedOptionHost, IterableDifferHelper, WatcherHelper } from 'devextreme-angular/core';
import { DxiItemComponent } from 'devextreme-angular/ui/nested';
import { DxiContextMenuItemComponent } from 'devextreme-angular/ui/context-menu/nested';
import type * as DxContextMenuTypes from "devextreme/ui/context_menu_types";
import * as i0 from "@angular/core";
import * as i1 from "devextreme-angular/ui/nested";
import * as i2 from "devextreme-angular/ui/context-menu/nested";
import * as i3 from "devextreme-angular/core";
export { ExplicitTypes } from 'devextreme/ui/context_menu';
/**
* 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 declare class DxContextMenuComponent<TKey = any> extends DxComponent implements OnDestroy, OnChanges, DoCheck {
private _watcherHelper;
private _idh;
instance: DxContextMenu<TKey>;
/**
* 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);
/**
* Configures UI component visibility animations. This object contains two fields: show and hide.
*/
get animation(): {
hide?: AnimationConfig;
show?: AnimationConfig;
};
set animation(value: {
hide?: AnimationConfig;
show?: AnimationConfig;
});
/**
* Specifies whether to close the UI component if a user clicks outside it.
* @deprecated Use the hideOnOutsideClick option instead.
*/
get closeOnOutsideClick(): boolean | ((event: event) => boolean);
set closeOnOutsideClick(value: boolean | ((event: event) => boolean));
/**
* Specifies the name of the CSS class to be applied to the root menu level and all submenus.
*/
get cssClass(): string;
set cssClass(value: string);
/**
* Binds the UI component to data.
*/
get dataSource(): Array<dxContextMenuItem> | DataSource | DataSourceOptions | null | Store | string;
set dataSource(value: Array<dxContextMenuItem> | DataSource | DataSourceOptions | null | Store | string);
/**
* Specifies whether the UI component responds to user interaction.
*/
get disabled(): boolean;
set disabled(value: boolean);
/**
* Specifies the name of the data source item field whose value defines whether or not the corresponding UI component item is disabled.
*/
get disabledExpr(): Function | string;
set disabledExpr(value: Function | string);
/**
* Specifies the data field whose values should be displayed.
*/
get displayExpr(): ((item: any) => string) | string;
set displayExpr(value: ((item: any) => string) | string);
/**
* 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 whether to hide the UI component if a user clicks outside it.
*/
get hideOnOutsideClick(): boolean | ((event: event) => boolean);
set hideOnOutsideClick(value: boolean | ((event: event) => boolean));
/**
* 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);
/**
* Holds an array of menu items.
*/
get items(): Array<dxContextMenuItem>;
set items(value: Array<dxContextMenuItem>);
/**
* Specifies which data field contains nested items.
*/
get itemsExpr(): Function | string;
set itemsExpr(value: Function | string);
/**
* Specifies a custom template for items.
*/
get itemTemplate(): any;
set itemTemplate(value: any);
/**
* An object defining UI component positioning properties.
*/
get position(): PositionConfig;
set position(value: PositionConfig);
/**
* Switches the UI component to a right-to-left representation.
*/
get rtlEnabled(): boolean;
set rtlEnabled(value: boolean);
/**
* Specifies whether an item is selected if a user clicks it.
*/
get selectByClick(): boolean;
set selectByClick(value: boolean);
/**
* Specifies the name of the data source item field whose value defines whether or not the corresponding UI component items is selected.
*/
get selectedExpr(): Function | string;
set selectedExpr(value: Function | string);
/**
* The selected item object.
*/
get selectedItem(): any;
set selectedItem(value: any);
/**
* Specifies the selection mode supported by the menu.
*/
get selectionMode(): SingleOrNone;
set selectionMode(value: SingleOrNone);
/**
* Specifies properties for displaying the UI component.
*/
get showEvent(): string | {
delay?: number | undefined;
name?: string | undefined;
};
set showEvent(value: string | {
delay?: number | undefined;
name?: string | undefined;
});
/**
* Specifies properties of submenu showing and hiding.
*/
get showSubmenuMode(): SubmenuShowMode | {
delay?: number | {
hide?: number;
show?: number;
};
name?: SubmenuShowMode;
};
set showSubmenuMode(value: SubmenuShowMode | {
delay?: number | {
hide?: number;
show?: number;
};
name?: SubmenuShowMode;
});
/**
* Specifies the direction at which submenus are displayed.
*/
get submenuDirection(): ContextSubmenuDirection;
set submenuDirection(value: ContextSubmenuDirection);
/**
* Specifies the number of the element when the Tab key is used for navigating.
*/
get tabIndex(): number;
set tabIndex(value: number);
/**
* The target element associated with the context menu.
*/
get target(): any | string | undefined;
set target(value: any | string | undefined);
/**
* A Boolean value specifying whether or not 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 is rendered and each time the component is repainted.
*/
onContentReady: EventEmitter<ContentReadyEvent>;
/**
* A function that is executed before the UI component is disposed of.
*/
onDisposing: EventEmitter<DisposingEvent>;
/**
* A function that is executed after the ContextMenu is hidden.
*/
onHidden: EventEmitter<HiddenEvent>;
/**
* A function that is executed before the ContextMenu is hidden.
*/
onHiding: EventEmitter<HidingEvent>;
/**
* A function used in JavaScript frameworks to save the UI component instance.
*/
onInitialized: EventEmitter<InitializedEvent>;
/**
* A function that is executed when a collection item is clicked or tapped.
*/
onItemClick: EventEmitter<ItemClickEvent>;
/**
* A function that is executed when a collection item is right-clicked or pressed.
*/
onItemContextMenu: EventEmitter<ItemContextMenuEvent>;
/**
* A function that is executed after a collection item is rendered.
*/
onItemRendered: EventEmitter<ItemRenderedEvent>;
/**
* A function that is executed after a UI component property is changed.
*/
onOptionChanged: EventEmitter<OptionChangedEvent>;
/**
* A function that is executed before the ContextMenu is positioned.
*/
onPositioning: EventEmitter<PositioningEvent>;
/**
* A function that is executed when a collection item is selected or selection is canceled.
*/
onSelectionChanged: EventEmitter<SelectionChangedEvent>;
/**
* A function that is executed before the ContextMenu is shown.
*/
onShowing: EventEmitter<ShowingEvent>;
/**
* A function that is executed after the ContextMenu is shown.
*/
onShown: EventEmitter<ShownEvent>;
/**
* 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.
*/
animationChange: EventEmitter<{
hide?: AnimationConfig;
show?: AnimationConfig;
}>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
closeOnOutsideClickChange: EventEmitter<boolean | ((event: event) => boolean)>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
cssClassChange: EventEmitter<string>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
dataSourceChange: EventEmitter<Array<dxContextMenuItem> | DataSource | DataSourceOptions | null | Store | string>;
/**
* 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.
*/
disabledExprChange: EventEmitter<Function | string>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
displayExprChange: EventEmitter<((item: any) => string) | string>;
/**
* 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.
*/
hideOnOutsideClickChange: EventEmitter<boolean | ((event: event) => boolean)>;
/**
* 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.
*/
itemsChange: EventEmitter<Array<dxContextMenuItem>>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
itemsExprChange: EventEmitter<Function | string>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
itemTemplateChange: EventEmitter<any>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
positionChange: EventEmitter<PositionConfig>;
/**
* 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.
*/
selectByClickChange: EventEmitter<boolean>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
selectedExprChange: EventEmitter<Function | string>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
selectedItemChange: EventEmitter<any>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
selectionModeChange: EventEmitter<SingleOrNone>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
showEventChange: EventEmitter<string | {
delay?: number | undefined;
name?: string | undefined;
}>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
showSubmenuModeChange: EventEmitter<SubmenuShowMode | {
delay?: number | {
hide?: number;
show?: number;
};
name?: SubmenuShowMode;
}>;
/**
* This member supports the internal infrastructure and is not intended to be used directly from your code.
*/
submenuDirectionChange: EventEmitter<ContextSubmenuDirection>;
/**
* 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.
*/
targetChange: EventEmitter<any | string | undefined>;
/**
* 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>;
get itemsChildren(): QueryList<DxiContextMenuItemComponent>;
set itemsChildren(value: QueryList<DxiContextMenuItemComponent>);
get itemsLegacyChildren(): QueryList<DxiItemComponent>;
set itemsLegacyChildren(value: QueryList<DxiItemComponent>);
constructor(elementRef: ElementRef, ngZone: NgZone, templateHost: DxTemplateHost, _watcherHelper: WatcherHelper, _idh: IterableDifferHelper, optionHost: NestedOptionHost, transferState: TransferState, platformId: any);
protected _createInstance(element: any, options: any): DxContextMenu<any>;
ngOnDestroy(): void;
ngOnChanges(changes: SimpleChanges): void;
setupChanges(prop: string, changes: SimpleChanges): void;
ngDoCheck(): void;
_setOption(name: string, value: any): void;
static ɵfac: i0.ɵɵFactoryDeclaration<DxContextMenuComponent<any>, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<DxContextMenuComponent<any>, "dx-context-menu", never, { "accessKey": { "alias": "accessKey"; "required": false; }; "activeStateEnabled": { "alias": "activeStateEnabled"; "required": false; }; "animation": { "alias": "animation"; "required": false; }; "closeOnOutsideClick": { "alias": "closeOnOutsideClick"; "required": false; }; "cssClass": { "alias": "cssClass"; "required": false; }; "dataSource": { "alias": "dataSource"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "disabledExpr": { "alias": "disabledExpr"; "required": false; }; "displayExpr": { "alias": "displayExpr"; "required": false; }; "elementAttr": { "alias": "elementAttr"; "required": false; }; "focusStateEnabled": { "alias": "focusStateEnabled"; "required": false; }; "height": { "alias": "height"; "required": false; }; "hideOnOutsideClick": { "alias": "hideOnOutsideClick"; "required": false; }; "hint": { "alias": "hint"; "required": false; }; "hoverStateEnabled": { "alias": "hoverStateEnabled"; "required": false; }; "items": { "alias": "items"; "required": false; }; "itemsExpr": { "alias": "itemsExpr"; "required": false; }; "itemTemplate": { "alias": "itemTemplate"; "required": false; }; "position": { "alias": "position"; "required": false; }; "rtlEnabled": { "alias": "rtlEnabled"; "required": false; }; "selectByClick": { "alias": "selectByClick"; "required": false; }; "selectedExpr": { "alias": "selectedExpr"; "required": false; }; "selectedItem": { "alias": "selectedItem"; "required": false; }; "selectionMode": { "alias": "selectionMode"; "required": false; }; "showEvent": { "alias": "showEvent"; "required": false; }; "showSubmenuMode": { "alias": "showSubmenuMode"; "required": false; }; "submenuDirection": { "alias": "submenuDirection"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; "target": { "alias": "target"; "required": false; }; "visible": { "alias": "visible"; "required": false; }; "width": { "alias": "width"; "required": false; }; }, { "onContentReady": "onContentReady"; "onDisposing": "onDisposing"; "onHidden": "onHidden"; "onHiding": "onHiding"; "onInitialized": "onInitialized"; "onItemClick": "onItemClick"; "onItemContextMenu": "onItemContextMenu"; "onItemRendered": "onItemRendered"; "onOptionChanged": "onOptionChanged"; "onPositioning": "onPositioning"; "onSelectionChanged": "onSelectionChanged"; "onShowing": "onShowing"; "onShown": "onShown"; "accessKeyChange": "accessKeyChange"; "activeStateEnabledChange": "activeStateEnabledChange"; "animationChange": "animationChange"; "closeOnOutsideClickChange": "closeOnOutsideClickChange"; "cssClassChange": "cssClassChange"; "dataSourceChange": "dataSourceChange"; "disabledChange": "disabledChange"; "disabledExprChange": "disabledExprChange"; "displayExprChange": "displayExprChange"; "elementAttrChange": "elementAttrChange"; "focusStateEnabledChange": "focusStateEnabledChange"; "heightChange": "heightChange"; "hideOnOutsideClickChange": "hideOnOutsideClickChange"; "hintChange": "hintChange"; "hoverStateEnabledChange": "hoverStateEnabledChange"; "itemsChange": "itemsChange"; "itemsExprChange": "itemsExprChange"; "itemTemplateChange": "itemTemplateChange"; "positionChange": "positionChange"; "rtlEnabledChange": "rtlEnabledChange"; "selectByClickChange": "selectByClickChange"; "selectedExprChange": "selectedExprChange"; "selectedItemChange": "selectedItemChange"; "selectionModeChange": "selectionModeChange"; "showEventChange": "showEventChange"; "showSubmenuModeChange": "showSubmenuModeChange"; "submenuDirectionChange": "submenuDirectionChange"; "tabIndexChange": "tabIndexChange"; "targetChange": "targetChange"; "visibleChange": "visibleChange"; "widthChange": "widthChange"; }, ["itemsChildren", "itemsLegacyChildren"], never, false, never>;
}
export declare class DxContextMenuModule {
static ɵfac: i0.ɵɵFactoryDeclaration<DxContextMenuModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<DxContextMenuModule, [typeof DxContextMenuComponent], [typeof i1.DxoAnimationModule, typeof i1.DxoHideModule, typeof i1.DxoFromModule, typeof i1.DxoPositionModule, typeof i1.DxoAtModule, typeof i1.DxoBoundaryOffsetModule, typeof i1.DxoCollisionModule, typeof i1.DxoMyModule, typeof i1.DxoOffsetModule, typeof i1.DxoToModule, typeof i1.DxoShowModule, typeof i1.DxiItemModule, typeof i1.DxoShowEventModule, typeof i1.DxoShowSubmenuModeModule, typeof i1.DxoDelayModule, typeof i2.DxoContextMenuAnimationModule, typeof i2.DxoContextMenuAtModule, typeof i2.DxoContextMenuBoundaryOffsetModule, typeof i2.DxoContextMenuCollisionModule, typeof i2.DxoContextMenuDelayModule, typeof i2.DxoContextMenuFromModule, typeof i2.DxoContextMenuHideModule, typeof i2.DxiContextMenuItemModule, typeof i2.DxoContextMenuMyModule, typeof i2.DxoContextMenuOffsetModule, typeof i2.DxoContextMenuPositionModule, typeof i2.DxoContextMenuShowModule, typeof i2.DxoContextMenuShowEventModule, typeof i2.DxoContextMenuShowSubmenuModeModule, typeof i2.DxoContextMenuToModule, typeof i3.DxIntegrationModule, typeof i3.DxTemplateModule], [typeof DxContextMenuComponent, typeof i1.DxoAnimationModule, typeof i1.DxoHideModule, typeof i1.DxoFromModule, typeof i1.DxoPositionModule, typeof i1.DxoAtModule, typeof i1.DxoBoundaryOffsetModule, typeof i1.DxoCollisionModule, typeof i1.DxoMyModule, typeof i1.DxoOffsetModule, typeof i1.DxoToModule, typeof i1.DxoShowModule, typeof i1.DxiItemModule, typeof i1.DxoShowEventModule, typeof i1.DxoShowSubmenuModeModule, typeof i1.DxoDelayModule, typeof i2.DxoContextMenuAnimationModule, typeof i2.DxoContextMenuAtModule, typeof i2.DxoContextMenuBoundaryOffsetModule, typeof i2.DxoContextMenuCollisionModule, typeof i2.DxoContextMenuDelayModule, typeof i2.DxoContextMenuFromModule, typeof i2.DxoContextMenuHideModule, typeof i2.DxiContextMenuItemModule, typeof i2.DxoContextMenuMyModule, typeof i2.DxoContextMenuOffsetModule, typeof i2.DxoContextMenuPositionModule, typeof i2.DxoContextMenuShowModule, typeof i2.DxoContextMenuShowEventModule, typeof i2.DxoContextMenuShowSubmenuModeModule, typeof i2.DxoContextMenuToModule, typeof i3.DxTemplateModule]>;
static ɵinj: i0.ɵɵInjectorDeclaration<DxContextMenuModule>;
}
export { DxContextMenuTypes };