2023-03-01 12:27:37 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* PrimeVue menu components share a common api to specify the menuitems and submenus.
|
|
|
|
*
|
|
|
|
* @module menuitem
|
|
|
|
*
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
import { RouteLocationRaw } from 'vue-router';
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 12:27:37 +00:00
|
|
|
/**
|
|
|
|
* Custom command event.
|
2023-03-12 11:06:00 +00:00
|
|
|
* @todo next release should be able to change see menuItem.command
|
2023-03-01 12:27:37 +00:00
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface MenuItemCommandEvent {
|
|
|
|
/**
|
|
|
|
* Browser event.
|
|
|
|
*/
|
|
|
|
originalEvent: Event;
|
|
|
|
/**
|
|
|
|
* Menuitem instance.
|
|
|
|
*/
|
|
|
|
item: MenuItem;
|
|
|
|
/**
|
|
|
|
* Optional
|
|
|
|
*/
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
2023-03-01 12:27:37 +00:00
|
|
|
/**
|
|
|
|
* Defines model of MenuItem API.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface MenuItem {
|
|
|
|
/**
|
|
|
|
* Property name or getter function to use as the label of an item.
|
|
|
|
*/
|
2023-03-01 12:27:37 +00:00
|
|
|
label?: string | ((...args: any) => string) | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Icon of the item.
|
|
|
|
*/
|
|
|
|
icon?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Route configuration such as path, name and parameters.
|
2023-09-01 06:31:02 +00:00
|
|
|
* @deprecated since v3.33.0.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
to?: RouteLocationRaw | undefined;
|
|
|
|
/**
|
|
|
|
* Callback to execute when item is clicked.
|
2023-03-01 12:27:37 +00:00
|
|
|
* @param {MenuItemCommandEvent} event - Custom command event.
|
2023-03-07 22:49:05 +00:00
|
|
|
* @todo next release should be able to change
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-03-07 22:49:05 +00:00
|
|
|
command?: (event: MenuItemCommandEvent) => void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* External link to navigate when item is clicked.
|
|
|
|
*/
|
|
|
|
url?: string | undefined;
|
|
|
|
/**
|
|
|
|
* An array of children menuitems.
|
|
|
|
*/
|
|
|
|
items?: MenuItem[] | undefined;
|
|
|
|
/**
|
|
|
|
* A boolean or a function to return a boolean to specify if the item is disabled.
|
2023-03-01 12:27:37 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-03-01 12:27:37 +00:00
|
|
|
disabled?: boolean | ((...args: any) => boolean) | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* A boolean or a function to return a boolean to specify if the item is visible.
|
2023-03-01 12:27:37 +00:00
|
|
|
* @defaultValue true
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-03-01 12:27:37 +00:00
|
|
|
visible?: boolean | ((...args: any) => boolean) | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Specifies where to open the linked document.
|
|
|
|
*/
|
|
|
|
target?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Defines the item as a separator.
|
2023-03-01 12:27:37 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
separator?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Inline style of the menuitem.
|
|
|
|
*/
|
|
|
|
style?: any;
|
|
|
|
/**
|
|
|
|
* Style class of the menuitem.
|
|
|
|
*/
|
|
|
|
class?: any;
|
|
|
|
/**
|
|
|
|
* Unique identifier of an item.
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
key?: string | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Optional
|
|
|
|
*/
|
|
|
|
[key: string]: any;
|
|
|
|
}
|