2023-03-01 13:04:25 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Menubar is a horizontal menu component.
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/menubar/)
|
|
|
|
*
|
|
|
|
* @module menubar
|
|
|
|
*
|
|
|
|
*/
|
2022-12-08 11:04:25 +00:00
|
|
|
import { ButtonHTMLAttributes, VNode } from 'vue';
|
2022-09-06 12:03:37 +00:00
|
|
|
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:58:22 +00:00
|
|
|
export declare type MenubarPassThroughOptionType = MenubarPassThroughAttributes | ((options: MenubarPassThroughMethodOptions) => MenubarPassThroughAttributes) | null | undefined;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface MenubarPassThroughMethodOptions {
|
|
|
|
props: MenubarProps;
|
|
|
|
state: MenubarState;
|
2023-04-28 10:15:44 +00:00
|
|
|
context: MenubarContext;
|
2023-04-26 09:58:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link MenubarProps.pt}
|
|
|
|
*/
|
|
|
|
export interface MenubarPassThroughOptions {
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the root's DOM element.
|
|
|
|
*/
|
|
|
|
root?: MenubarPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the list's DOM element.
|
|
|
|
*/
|
|
|
|
menu?: MenubarPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the list item's DOM element.
|
|
|
|
*/
|
|
|
|
menuitem?: MenubarPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the content's DOM element.
|
|
|
|
*/
|
|
|
|
content?: MenubarPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the action's DOM element.
|
|
|
|
*/
|
|
|
|
action?: MenubarPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the icon's DOM element.
|
|
|
|
*/
|
|
|
|
icon?: MenubarPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the label's DOM element.
|
|
|
|
*/
|
|
|
|
label?: MenubarPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the submenu icon's DOM element.
|
|
|
|
*/
|
|
|
|
submenuicon?: MenubarPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the separator's DOM element.
|
|
|
|
*/
|
|
|
|
separator?: MenubarPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the mobile popup menu button's DOM element.
|
|
|
|
*/
|
|
|
|
button?: MenubarPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the mobile popup menu button icon's DOM element.
|
|
|
|
*/
|
|
|
|
popupIcon?: MenubarPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the start of the component.
|
|
|
|
*/
|
|
|
|
start?: MenubarPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the end of the component.
|
|
|
|
*/
|
|
|
|
end?: MenubarPassThroughOptionType;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough attributes for each DOM elements
|
|
|
|
*/
|
|
|
|
export interface MenubarPassThroughAttributes {
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines focused item info
|
|
|
|
*/
|
|
|
|
export interface MenubarFocusedItemInfo {
|
|
|
|
/**
|
|
|
|
* Active item index
|
|
|
|
*/
|
|
|
|
index: number;
|
|
|
|
/**
|
|
|
|
* Active item level
|
|
|
|
*/
|
|
|
|
level: number;
|
|
|
|
/**
|
|
|
|
* Parent key info
|
|
|
|
*/
|
|
|
|
parentKey: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines current inline state in Menubar component.
|
|
|
|
*/
|
|
|
|
export interface MenubarState {
|
|
|
|
/**
|
|
|
|
* Current id state as a string.
|
|
|
|
*/
|
|
|
|
id: string;
|
|
|
|
/**
|
|
|
|
* Current mobile menu active state as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
mobileActive: boolean;
|
|
|
|
/**
|
|
|
|
* Current focus state as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
focused: boolean;
|
|
|
|
/**
|
|
|
|
* Current focused item info.
|
|
|
|
* @type {MenubarFocusedItemInfo}
|
|
|
|
*/
|
|
|
|
focusedItemInfo: MenubarFocusedItemInfo;
|
|
|
|
/**
|
|
|
|
* Active item path.
|
|
|
|
* @type {MenubarFocusedItemInfo}
|
|
|
|
*/
|
|
|
|
activeItemPath: MenubarFocusedItemInfo[];
|
|
|
|
}
|
|
|
|
|
2023-04-27 14:16:09 +00:00
|
|
|
/**
|
|
|
|
* Defines current options in Menubar component.
|
|
|
|
*/
|
2023-04-28 10:15:44 +00:00
|
|
|
export interface MenubarContext {
|
2023-04-27 14:16:09 +00:00
|
|
|
/**
|
|
|
|
* 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:25 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties in Menubar component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface MenubarProps {
|
|
|
|
/**
|
|
|
|
* An array of menuitems.
|
|
|
|
*/
|
|
|
|
model?: MenuItem[] | undefined;
|
|
|
|
/**
|
|
|
|
* Whether to apply 'router-link-active-exact' class if route exactly matches the item path.
|
2023-03-01 13:04:25 +00:00
|
|
|
* @defaultValue true
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
exact?: boolean | undefined;
|
2022-12-08 11:04:25 +00:00
|
|
|
/**
|
|
|
|
* Uses to pass all properties of the HTMLButtonElement to the menu button.
|
|
|
|
*/
|
|
|
|
buttonProps?: ButtonHTMLAttributes | undefined;
|
|
|
|
/**
|
|
|
|
* Defines a string value that labels an interactive element.
|
|
|
|
*/
|
|
|
|
'aria-label'?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Identifier of the underlying input element.
|
|
|
|
*/
|
|
|
|
'aria-labelledby'?: string | undefined;
|
2023-04-26 09:58:22 +00:00
|
|
|
/**
|
|
|
|
* Uses to pass attributes to DOM elements inside the component.
|
|
|
|
* @type {MenubarPassThroughOptions}
|
|
|
|
*/
|
|
|
|
pt?: MenubarPassThroughOptions;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 13:04:25 +00:00
|
|
|
/**
|
|
|
|
* Defines valid slots in Menubar component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface MenubarSlots {
|
|
|
|
/**
|
|
|
|
* Custom start template.
|
|
|
|
*/
|
2023-03-01 13:04:25 +00:00
|
|
|
start(): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Custom end template.
|
|
|
|
*/
|
2023-03-01 13:04:25 +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:25 +00:00
|
|
|
item(scope: {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Menuitem instance
|
|
|
|
*/
|
|
|
|
item: MenuItem;
|
2023-03-01 13:04:25 +00:00
|
|
|
}): VNode[];
|
2023-04-05 11:56:52 +00:00
|
|
|
/**
|
2023-04-18 10:50:13 +00:00
|
|
|
* Custom popup icon template on responsive mode.
|
2023-04-05 11:56:52 +00:00
|
|
|
*/
|
2023-04-18 10:50:13 +00:00
|
|
|
popupicon(): VNode[];
|
2023-04-05 11:56:52 +00:00
|
|
|
/**
|
|
|
|
* Custom submenu icon template.
|
|
|
|
*/
|
|
|
|
submenuicon(scope: {
|
|
|
|
/**
|
|
|
|
* Whether item is root
|
|
|
|
*/
|
|
|
|
root: boolean;
|
|
|
|
/**
|
|
|
|
* Whether item is active
|
|
|
|
*/
|
|
|
|
active: boolean;
|
|
|
|
}): VNode[];
|
2023-04-17 06:10:56 +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:25 +00:00
|
|
|
/**
|
|
|
|
* Defines valid emits in Menubar component.
|
|
|
|
*/
|
|
|
|
export interface MenubarEmits {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 13:04:25 +00:00
|
|
|
/**
|
|
|
|
* **PrimeVue - Menubar**
|
|
|
|
*
|
|
|
|
* _Menubar is a horizontal menu component._
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/menubar/)
|
|
|
|
* --- ---
|
2023-03-03 10:55:20 +00:00
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
2023-03-01 13:04:25 +00:00
|
|
|
*
|
|
|
|
* @group Component
|
|
|
|
*
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
declare class Menubar extends ClassComponent<MenubarProps, MenubarSlots, MenubarEmits> {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
declare module '@vue/runtime-core' {
|
|
|
|
interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
Menubar: GlobalComponentConstructor<Menubar>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Menubar;
|