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
|
|
|
|
|
|
|
type TieredMenuAppandToType = 'body' | 'self' | string | undefined | HTMLElement;
|
|
|
|
|
|
|
|
export interface TieredMenuProps {
|
|
|
|
/**
|
|
|
|
* An array of menuitems.
|
|
|
|
*/
|
|
|
|
model?: MenuItem[] | undefined;
|
|
|
|
/**
|
|
|
|
* Defines if menu would displayed as a popup.
|
|
|
|
*/
|
|
|
|
popup?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* A valid query selector or an HTMLElement to specify where the overlay gets attached.
|
|
|
|
* @see TieredMenuAppandToType
|
|
|
|
* Default value is 'body'.
|
|
|
|
*/
|
|
|
|
appendTo?: TieredMenuAppandToType;
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
/**
|
|
|
|
* Whether to apply 'router-link-active-exact' class if route exactly matches the item path.
|
|
|
|
* Default value is true.
|
|
|
|
*/
|
|
|
|
exact?: boolean | undefined;
|
2022-12-08 11:04:25 +00:00
|
|
|
/**
|
|
|
|
* When present, it specifies that the component should be disabled.
|
|
|
|
*/
|
|
|
|
disabled?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* 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 menu element.
|
|
|
|
*/
|
|
|
|
'aria-labelledby'?: string | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface TieredMenuSlots {
|
|
|
|
/**
|
|
|
|
* Custom content for each item.
|
|
|
|
* @param {Object} scope - item slot's params.
|
|
|
|
*/
|
|
|
|
item: (scope: {
|
|
|
|
/**
|
|
|
|
* Menuitem instance
|
|
|
|
*/
|
|
|
|
item: MenuItem;
|
|
|
|
}) => VNode[];
|
|
|
|
}
|
|
|
|
|
2022-12-08 11:04:25 +00:00
|
|
|
export declare type TieredMenuEmits = {
|
|
|
|
/**
|
|
|
|
* Callback to invoke when the component receives focus.
|
|
|
|
* @param {Event} event - Browser event.
|
|
|
|
*/
|
|
|
|
focus: (event: Event) => void;
|
|
|
|
/**
|
|
|
|
* Callback to invoke when the component loses focus.
|
|
|
|
* @param {Event} event - Browser event.
|
|
|
|
*/
|
|
|
|
blur: (event: Event) => void;
|
|
|
|
/**
|
|
|
|
* Callback to invoke before the popup is shown.
|
|
|
|
*/
|
|
|
|
'before-show': () => void;
|
|
|
|
/**
|
|
|
|
* Callback to invoke before the popup is hidden.
|
|
|
|
*/
|
|
|
|
'before-hide': () => void;
|
|
|
|
/**
|
|
|
|
* Callback to invoke when the popup is shown.
|
|
|
|
*/
|
|
|
|
show: () => void;
|
|
|
|
/**
|
|
|
|
* Callback to invoke when the popup is hidden.
|
|
|
|
*/
|
|
|
|
hide: () => void;
|
|
|
|
};
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
declare class TieredMenu extends ClassComponent<TieredMenuProps, TieredMenuSlots, TieredMenuEmits> {
|
|
|
|
/**
|
|
|
|
* Toggles the visibility of the overlay.
|
|
|
|
* @param {Event} event - Browser event
|
|
|
|
*
|
|
|
|
* @memberof TieredMenu
|
|
|
|
*/
|
|
|
|
toggle: (event: Event) => void;
|
|
|
|
/**
|
|
|
|
* Shows the overlay.
|
|
|
|
* @param {Event} event - Browser event
|
|
|
|
*
|
|
|
|
* @memberof TieredMenu
|
|
|
|
*/
|
2022-12-08 11:04:25 +00:00
|
|
|
show: (event: Event) => void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Hides the overlay.
|
|
|
|
*
|
|
|
|
* @memberof TieredMenu
|
|
|
|
*/
|
|
|
|
hide(): void;
|
|
|
|
}
|
|
|
|
|
|
|
|
declare module '@vue/runtime-core' {
|
|
|
|
interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
TieredMenu: GlobalComponentConstructor<TieredMenu>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* TieredMenu displays submenus in nested overlays.
|
|
|
|
*
|
|
|
|
* Helper API:
|
|
|
|
*
|
2023-03-02 09:22:22 +00:00
|
|
|
* - [MenuItem](https://primevue.org/menumodel)
|
2022-09-06 12:03:37 +00:00
|
|
|
*
|
|
|
|
* Demos:
|
|
|
|
*
|
2023-03-02 09:22:22 +00:00
|
|
|
* - [TieredMenu](https://primevue.org/tieredmenu)
|
2022-09-06 12:03:37 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
export default TieredMenu;
|