2022-09-06 12:03:37 +00:00
|
|
|
import { VNode } from 'vue';
|
|
|
|
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
|
|
|
import { MenuItem } from '../menuitem';
|
|
|
|
|
|
|
|
type ContextMenuAppendTo = 'body' | 'self' | string | undefined | HTMLElement;
|
|
|
|
|
|
|
|
export interface ContextMenuProps {
|
|
|
|
/**
|
|
|
|
* An array of menuitems.
|
|
|
|
*/
|
|
|
|
model?: MenuItem[] | undefined;
|
|
|
|
/**
|
|
|
|
* A valid query selector or an HTMLElement to specify where the overlay gets attached.
|
|
|
|
* @see ContextMenuAppendTo
|
|
|
|
* Default value is 'body'
|
|
|
|
*/
|
|
|
|
appendTo?: ContextMenuAppendTo;
|
|
|
|
/**
|
|
|
|
* Whether to automatically manage layering.
|
|
|
|
* Default value is true.
|
|
|
|
*/
|
|
|
|
autoZIndex?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Base zIndex value to use in layering.
|
|
|
|
* Default value is 0.
|
|
|
|
*/
|
|
|
|
baseZIndex?: number | undefined;
|
|
|
|
/**
|
|
|
|
* Attaches the menu to document instead of a particular item.
|
|
|
|
*/
|
|
|
|
global?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Whether to apply 'router-link-active-exact' class if route exactly matches the item path.
|
|
|
|
* Default value is true.
|
|
|
|
*/
|
|
|
|
exact?: boolean | undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ContextMenuSlots {
|
|
|
|
/**
|
|
|
|
* Custom item template.
|
|
|
|
* @param {Object} scope - item slot's params.
|
|
|
|
*/
|
|
|
|
item: (scope: {
|
|
|
|
/**
|
|
|
|
* Menuitem instance
|
|
|
|
*/
|
|
|
|
item: MenuItem;
|
|
|
|
}) => VNode[];
|
|
|
|
}
|
|
|
|
|
2022-09-14 11:26:01 +00:00
|
|
|
export declare type ContextMenuEmits = {};
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
declare class ContextMenu extends ClassComponent<ContextMenuProps, ContextMenuSlots, ContextMenuEmits> {
|
|
|
|
/**
|
|
|
|
* Toggles the visibility of the menu.
|
|
|
|
* @param {Event} event - Browser event.
|
|
|
|
*
|
|
|
|
* @memberof ContextMenu
|
|
|
|
*/
|
|
|
|
toggle: (event: Event) => void;
|
|
|
|
/**
|
|
|
|
* Shows the menu.
|
|
|
|
* @param {Event} event - Browser event.
|
|
|
|
*
|
|
|
|
* @memberof ContextMenu
|
|
|
|
*/
|
|
|
|
show: (event: Event) => void;
|
|
|
|
/**
|
|
|
|
* Hides the menu.
|
|
|
|
*
|
|
|
|
* @memberof ContextMenu
|
|
|
|
*/
|
|
|
|
hide: () => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
declare module '@vue/runtime-core' {
|
|
|
|
interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
ContextMenu: GlobalComponentConstructor<ContextMenu>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* ContextMenu displays an overlay menu on right click of its target. Note that components like DataTable has special integration with ContextMenu.
|
|
|
|
* Refer to documentation of the individual documentation of the with context menu support.
|
|
|
|
*
|
|
|
|
* Helper API:
|
|
|
|
*
|
2022-09-14 11:26:01 +00:00
|
|
|
* - [MenuItem](https://www.primefaces.org/primevue/menumodel)
|
2022-09-06 12:03:37 +00:00
|
|
|
*
|
|
|
|
* Demos:
|
|
|
|
*
|
2022-09-14 11:26:01 +00:00
|
|
|
* - [ContextMenu](https://www.primefaces.org/primevue/contextmenu)
|
2022-09-06 12:03:37 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
export default ContextMenu;
|