primevue-mirror/components/menu/Menu.d.ts

144 lines
3.3 KiB
TypeScript
Raw Normal View History

2023-03-01 13:04:19 +00:00
/**
*
* Menu is a navigation / command component that supports dynamic and static positioning.
*
* [Live Demo](https://www.primevue.org/menu/)
*
* @module menu
*
*/
2022-09-06 12:03:37 +00:00
import { VNode } from 'vue';
import { MenuItem } from '../menuitem';
2022-12-08 11:04:25 +00:00
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
2022-09-06 12:03:37 +00:00
2023-03-01 13:04:19 +00:00
/**
* Defines valid properties in Menu component.
*/
2022-09-06 12:03:37 +00:00
export interface MenuProps {
/**
* An array of menuitems.
*/
model?: MenuItem[] | undefined;
/**
* Defines if menu would displayed as a popup.
2023-03-01 13:04:19 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
popup?: boolean | undefined;
/**
* A valid query selector or an HTMLElement to specify where the overlay gets attached.
2023-03-08 10:51:52 +00:00
* @defaultValue body
2022-09-06 12:03:37 +00:00
*/
2023-03-01 13:04:19 +00:00
appendTo?: 'body' | 'self' | string | undefined | HTMLElement;
2022-09-06 12:03:37 +00:00
/**
* Whether to automatically manage layering.
2023-03-01 13:04:19 +00:00
* @defaultValue true
2022-09-06 12:03:37 +00:00
*/
autoZIndex?: boolean | undefined;
/**
* Base zIndex value to use in layering.
2023-03-01 13:04:19 +00:00
* @defaultValue 0
2022-09-06 12:03:37 +00:00
*/
baseZIndex?: number | undefined;
/**
* Whether to apply 'router-link-active-exact' class if route exactly matches the item path.
2023-03-01 13:04:19 +00:00
* @defaultValue true
2022-09-06 12:03:37 +00:00
*/
exact?: boolean | undefined;
2022-12-08 11:04:25 +00:00
/**
* Index of the element in tabbing order.
*/
tabindex?: number | string | undefined;
/**
* Defines a string value that labels an interactive element.
*/
'aria-label'?: string | undefined;
/**
* Identifier of the underlying input element.
*/
'aria-labelledby'?: string | undefined;
2022-09-06 12:03:37 +00:00
}
2023-03-01 13:04:19 +00:00
/**
* Defines valid slots in Menu component.
*/
2022-09-06 12:03:37 +00:00
export interface MenuSlots {
/**
* Custom start template.
*/
2023-03-01 13:04:19 +00:00
start(): VNode[];
/**
* Custom end template.
*/
2023-03-01 13:04:19 +00:00
end(): VNode[];
2022-09-06 12:03:37 +00:00
/**
* Custom item template.
* @param {Object} scope - item slot's params.
*/
2023-03-01 13:04:19 +00:00
item(scope: {
/**
* Menuitem instance
*/
item: MenuItem;
}): VNode[];
2022-09-06 12:03:37 +00:00
}
2023-03-01 13:04:19 +00:00
/**
* Defines valid emits in Menu component.
*/
export interface MenuEmits {
2022-12-08 11:04:25 +00:00
/**
* Callback to invoke when the component receives focus.
* @param {Event} event - Browser event.
*/
2023-03-01 13:04:19 +00:00
focus(event: Event): void;
2022-12-08 11:04:25 +00:00
/**
* Callback to invoke when the component loses focus.
* @param {Event} event - Browser event.
*/
2023-03-01 13:04:19 +00:00
blur(event: Event): void;
}
2022-09-06 12:03:37 +00:00
2023-03-01 13:04:19 +00:00
/**
* **PrimeVue - Menu**
*
* _Menu is a navigation / command component that supports dynamic and static positioning._
*
* [Live Demo](https://www.primevue.org/menu/)
* --- ---
2023-03-03 10:55:20 +00:00
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
2023-03-01 13:04:19 +00:00
*
* @group Component
*
*/
2022-09-06 12:03:37 +00:00
declare class Menu extends ClassComponent<MenuProps, MenuSlots, MenuEmits> {
/**
* Toggles the visibility of the overlay.
* @param {Event} event - Browser event.
*
* @memberof Menu
*/
2023-03-01 13:04:19 +00:00
toggle(event: Event): void;
2022-09-06 12:03:37 +00:00
/**
* Shows the overlay.
* @param {Event} event - Browser event.
2023-03-01 13:04:19 +00:00
* @param {*} [target] - Target element
2022-09-06 12:03:37 +00:00
*
* @memberof Menu
*/
2023-03-01 13:04:19 +00:00
show(event: Event, target?: any): void;
2022-09-06 12:03:37 +00:00
/**
* Hides the overlay.
*
* @memberof Menu
*/
hide(): void;
}
declare module '@vue/runtime-core' {
interface GlobalComponents {
2022-09-14 11:26:01 +00:00
Menu: GlobalComponentConstructor<Menu>;
2022-09-06 12:03:37 +00:00
}
}
export default Menu;