primevue-mirror/components/menuitem/MenuItem.d.ts

83 lines
1.9 KiB
TypeScript
Raw Normal View History

2022-09-14 11:26:01 +00:00
import { RouteLocationRaw } from 'vue-router';
2022-09-06 12:03:37 +00:00
type MenuItemLabelType = string | ((...args: any) => string) | undefined;
type MenuItemDisabledType = boolean | ((...args: any) => boolean) | undefined;
type MenuItemVisibleType = boolean | ((...args: any) => boolean) | undefined;
export interface MenuItemCommandEvent {
/**
* Browser event.
*/
originalEvent: Event;
/**
* Menuitem instance.
*/
item: MenuItem;
/**
* Optional
*/
[key: string]: any;
}
export interface MenuItem {
/**
* Property name or getter function to use as the label of an item.
*/
label?: MenuItemLabelType;
/**
* Icon of the item.
*/
icon?: string | undefined;
/**
* Route configuration such as path, name and parameters.
*/
to?: RouteLocationRaw | undefined;
/**
* Callback to execute when item is clicked.
* @param {@link MenuItemCommandEvent} event - Custom command event.
*/
command?: (event: MenuItemCommandEvent) => void;
/**
* 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.
*/
disabled?: MenuItemDisabledType;
/**
* A boolean or a function to return a boolean to specify if the item is visible.
*/
visible?: MenuItemVisibleType;
/**
* Specifies where to open the linked document.
*/
target?: string | undefined;
/**
* Defines the item as a separator.
*/
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;
}