From b529ca272e8d0ef955993be55ab82a14380f0eab Mon Sep 17 00:00:00 2001 From: mertsincan Date: Wed, 1 Dec 2021 16:25:02 +0300 Subject: [PATCH] Fixed #1836 - For ContextMenu --- src/components/contextmenu/ContextMenu.d.ts | 104 +++++++++++++++++--- 1 file changed, 88 insertions(+), 16 deletions(-) diff --git a/src/components/contextmenu/ContextMenu.d.ts b/src/components/contextmenu/ContextMenu.d.ts index 2e45a08bf..176ad61bd 100755 --- a/src/components/contextmenu/ContextMenu.d.ts +++ b/src/components/contextmenu/ContextMenu.d.ts @@ -1,26 +1,98 @@ import { VNode } from 'vue'; +import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; +import { MenuItem } from '../menuitem'; -interface ContextMenuProps { - model?: any[]; - appendTo?: string; - autoZIndex?: boolean; - baseZIndex?: number; - global?: boolean; - exact?: boolean; +type ContextMenuAppendTo = 'body' | 'self' | string | undefined; + +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; } -interface ContextMenuItemSlotInterface { - item: object; +export interface ContextMenuSlots { + /** + * Custom item template. + * @param {Object} scope - item slot's params. + */ + item: (scope: { + /** + * Menuitem instance + */ + item: MenuItem; + }) => VNode[]; } -declare class ContextMenu { - $props: ContextMenuProps; - $slots: { - item: ContextMenuItemSlotInterface; +export declare type ContextMenuEmits = { +} + +declare class ContextMenu extends ClassComponent { + /** + * 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 { + ContextMenu: GlobalComponentConstructor } - toggle(event: Event): void; - show(event: Event, target?: any): void; - hide(): void; } +/** + * + * 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: + * + * - [MenuItem](https://www.primefaces.org/primevue/showcase/#/menumodel) + * + * Demos: + * + * - [ContextMenu](https://www.primefaces.org/primevue/showcase/#/contextmenu) + * + */ export default ContextMenu;