2023-03-01 13:04:12 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* MegaMenu is navigation component that displays submenus together.
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/megamenu/)
|
|
|
|
*
|
|
|
|
* @module megamenu
|
|
|
|
*
|
|
|
|
*/
|
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-04-26 09:57:55 +00:00
|
|
|
export declare type MegaMenuPassThroughOptionType = MegaMenuPassThroughAttributes | ((options: MegaMenuPassThroughMethodOptions) => MegaMenuPassThroughAttributes) | null | undefined;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface MegaMenuPassThroughMethodOptions {
|
|
|
|
props: MegaMenuProps;
|
|
|
|
state: MegaMenuState;
|
2023-04-27 14:16:09 +00:00
|
|
|
options: MegaMenuOptions;
|
2023-04-26 09:57:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link MegaMenuProps.pt}
|
|
|
|
*/
|
|
|
|
export interface MegaMenuPassThroughOptions {
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the root's DOM element.
|
|
|
|
*/
|
|
|
|
root?: MegaMenuPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the list's DOM element.
|
|
|
|
*/
|
|
|
|
menu?: MegaMenuPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the submenu header's DOM element.
|
|
|
|
*/
|
|
|
|
submenuHeader?: MegaMenuPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the list item's DOM element.
|
|
|
|
*/
|
|
|
|
menuitem?: MegaMenuPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the content's DOM element.
|
|
|
|
*/
|
|
|
|
content?: MegaMenuPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the action's DOM element.
|
|
|
|
*/
|
|
|
|
action?: MegaMenuPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the icon's DOM element.
|
|
|
|
*/
|
|
|
|
icon?: MegaMenuPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the label's DOM element.
|
|
|
|
*/
|
|
|
|
label?: MegaMenuPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the submenu icon's DOM element.
|
|
|
|
*/
|
|
|
|
submenuicon?: MegaMenuPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the panel's DOM element.
|
|
|
|
*/
|
|
|
|
panel?: MegaMenuPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the grid's DOM element.
|
|
|
|
*/
|
|
|
|
grid?: MegaMenuPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the column's DOM element.
|
|
|
|
*/
|
|
|
|
column?: MegaMenuPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the separator's DOM element.
|
|
|
|
*/
|
|
|
|
separator?: MegaMenuPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the start of the component.
|
|
|
|
*/
|
|
|
|
start?: MegaMenuPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the end of the component.
|
|
|
|
*/
|
|
|
|
end?: MegaMenuPassThroughOptionType;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough attributes for each DOM elements
|
|
|
|
*/
|
|
|
|
export interface MegaMenuPassThroughAttributes {
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines focused item info
|
|
|
|
*/
|
|
|
|
export interface MegaMenuFocusedItemInfo {
|
|
|
|
/**
|
|
|
|
* Active item index
|
|
|
|
*/
|
|
|
|
index: number;
|
|
|
|
/**
|
|
|
|
* Active item level
|
|
|
|
*/
|
|
|
|
level: number;
|
|
|
|
/**
|
|
|
|
* Parent key info
|
|
|
|
*/
|
|
|
|
parentKey: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines current inline state in MegaMenu component.
|
|
|
|
*/
|
|
|
|
export interface MegaMenuState {
|
|
|
|
/**
|
|
|
|
* Current id state as a string.
|
|
|
|
*/
|
|
|
|
id: string;
|
|
|
|
/**
|
|
|
|
* Current focus state as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
focused: boolean;
|
|
|
|
/**
|
|
|
|
* Current focused item info.
|
|
|
|
* @type {MegaMenuFocusedItemInfo}
|
|
|
|
*/
|
|
|
|
focusedItemInfo: MegaMenuFocusedItemInfo;
|
|
|
|
/**
|
|
|
|
* Active item path.
|
|
|
|
* @type {MenuItem}
|
|
|
|
*/
|
|
|
|
activeItem: MenuItem;
|
|
|
|
}
|
|
|
|
|
2023-04-27 14:16:09 +00:00
|
|
|
/**
|
|
|
|
* Defines current options in MegaMenu component.
|
|
|
|
*/
|
|
|
|
export interface MegaMenuOptions {
|
|
|
|
/**
|
|
|
|
* Current active state of menuitem as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
active: boolean;
|
|
|
|
/**
|
|
|
|
* Current focused state of menuitem as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
focused: boolean;
|
|
|
|
}
|
|
|
|
|
2023-03-01 13:04:12 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties in MegaMenu component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface MegaMenuProps {
|
|
|
|
/**
|
|
|
|
* An array of menuitems.
|
|
|
|
*/
|
|
|
|
model?: MenuItem[] | undefined;
|
|
|
|
/**
|
|
|
|
* Defines the orientation.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue horizontal
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-03-01 13:04:12 +00:00
|
|
|
orientation?: 'horizontal' | 'vertical' | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Whether to apply 'router-link-active-exact' class if route exactly matches the item path.
|
2023-03-01 13:04:12 +00:00
|
|
|
* @defaultValue true
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
exact?: boolean | undefined;
|
2022-12-08 11:04:25 +00:00
|
|
|
/**
|
|
|
|
* When present, it specifies that the component should be disabled.
|
2023-03-01 13:04:12 +00:00
|
|
|
* @defaultValue false
|
2022-12-08 11:04:25 +00:00
|
|
|
*/
|
|
|
|
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;
|
2023-04-26 09:57:55 +00:00
|
|
|
/**
|
|
|
|
* Uses to pass attributes to DOM elements inside the component.
|
|
|
|
* @type {MegaMenuPassThroughOptions}
|
|
|
|
*/
|
|
|
|
pt?: MegaMenuPassThroughOptions;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 13:04:12 +00:00
|
|
|
/**
|
|
|
|
* Defines valid slots in MegaMenu component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface MegaMenuSlots {
|
|
|
|
/**
|
|
|
|
* Custom start template.
|
|
|
|
*/
|
2023-03-01 13:04:12 +00:00
|
|
|
start(): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Custom end template.
|
|
|
|
*/
|
2023-03-01 13:04:12 +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:12 +00:00
|
|
|
item(scope: {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Menuitem instance
|
|
|
|
*/
|
|
|
|
item: MenuItem;
|
2023-03-01 13:04:12 +00:00
|
|
|
}): VNode[];
|
2023-04-05 11:56:29 +00:00
|
|
|
/**
|
|
|
|
* Custom submenu icon template.
|
|
|
|
*/
|
|
|
|
submenuicon(scope: {
|
|
|
|
/**
|
|
|
|
* Whether item is active
|
|
|
|
*/
|
|
|
|
active: boolean;
|
|
|
|
}): VNode[];
|
2023-04-17 06:14:45 +00:00
|
|
|
/**
|
|
|
|
* Custom item icon template.
|
|
|
|
* @param {Object} scope - item icon slot's params.
|
|
|
|
*/
|
|
|
|
itemicon(scope: {
|
|
|
|
/**
|
|
|
|
* Menuitem instance
|
|
|
|
*/
|
|
|
|
item: MenuItem;
|
|
|
|
/**
|
|
|
|
* Style class of the item icon element.
|
|
|
|
*/
|
|
|
|
class: any;
|
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 13:04:12 +00:00
|
|
|
/**
|
|
|
|
* Defines valid emits in MegaMenu component.
|
|
|
|
*/
|
|
|
|
export interface MegaMenuEmits {
|
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:12 +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:12 +00:00
|
|
|
blur(event: Event): void;
|
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 13:04:12 +00:00
|
|
|
/**
|
|
|
|
* **PrimeVue - MegaMenu**
|
|
|
|
*
|
|
|
|
* _MegaMenu is navigation component that displays submenus together._
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/megamenu/)
|
|
|
|
* --- ---
|
2023-03-03 10:55:20 +00:00
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
2023-03-01 13:04:12 +00:00
|
|
|
*
|
|
|
|
* @group Component
|
|
|
|
*
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
declare class MegaMenu extends ClassComponent<MegaMenuProps, MegaMenuSlots, MegaMenuEmits> {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
declare module '@vue/runtime-core' {
|
|
|
|
interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
MegaMenu: GlobalComponentConstructor<MegaMenu>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default MegaMenu;
|