2023-03-01 13:04:32 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* PanelMenu is a hybrid of Accordion and Tree components.
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/panelmenu/)
|
|
|
|
*
|
|
|
|
* @module panelmenu
|
|
|
|
*
|
|
|
|
*/
|
2023-08-02 14:07:22 +00:00
|
|
|
import { TransitionProps, VNode } from 'vue';
|
2023-07-06 11:17:08 +00:00
|
|
|
import { ComponentHooks } from '../basecomponent';
|
2022-09-06 12:03:37 +00:00
|
|
|
import { MenuItem } from '../menuitem';
|
2023-09-05 08:50:46 +00:00
|
|
|
import { PassThroughOptions } from '../passthrough';
|
2023-09-05 11:28:04 +00:00
|
|
|
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-07-11 22:42:43 +00:00
|
|
|
export declare type PanelMenuPassThroughOptionType = PanelMenuPassThroughAttributes | ((options: PanelMenuPassThroughMethodOptions) => PanelMenuPassThroughAttributes | string) | string | null | undefined;
|
2023-04-26 09:58:36 +00:00
|
|
|
|
2023-08-02 14:07:22 +00:00
|
|
|
export declare type PanelMenuPassThroughTransitionType = TransitionProps | ((options: PanelMenuPassThroughMethodOptions) => TransitionProps) | undefined;
|
|
|
|
|
2023-04-26 09:58:36 +00:00
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface PanelMenuPassThroughMethodOptions {
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines instance.
|
|
|
|
*/
|
2023-07-06 12:01:33 +00:00
|
|
|
instance: any;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties.
|
|
|
|
*/
|
2023-04-26 09:58:36 +00:00
|
|
|
props: PanelMenuProps;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines current inline state.
|
|
|
|
*/
|
2023-04-26 09:58:36 +00:00
|
|
|
state: PanelMenuState;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines current options.
|
|
|
|
*/
|
2023-04-28 10:15:44 +00:00
|
|
|
context: PanelMenuContext;
|
2023-09-05 08:50:46 +00:00
|
|
|
/**
|
|
|
|
* Defines passthrough(pt) options in global config.
|
|
|
|
*/
|
|
|
|
global: object | undefined;
|
2023-04-26 09:58:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link PanelMenuProps.pt}
|
|
|
|
*/
|
|
|
|
export interface PanelMenuPassThroughOptions {
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the root's DOM element.
|
2023-04-26 09:58:36 +00:00
|
|
|
*/
|
|
|
|
root?: PanelMenuPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the panel's DOM element.
|
2023-04-26 09:58:36 +00:00
|
|
|
*/
|
|
|
|
panel?: PanelMenuPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the header's DOM element.
|
2023-04-26 09:58:36 +00:00
|
|
|
*/
|
|
|
|
header?: PanelMenuPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the header content's DOM element.
|
2023-04-26 09:58:36 +00:00
|
|
|
*/
|
|
|
|
headerContent?: PanelMenuPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the header action's DOM element.
|
2023-04-26 09:58:36 +00:00
|
|
|
*/
|
|
|
|
headerAction?: PanelMenuPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the submenuIcon's DOM element.
|
2023-04-26 09:58:36 +00:00
|
|
|
*/
|
|
|
|
submenuIcon?: PanelMenuPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the header icon's DOM element.
|
2023-04-26 09:58:36 +00:00
|
|
|
*/
|
2023-05-03 14:14:33 +00:00
|
|
|
headerIcon?: PanelMenuPassThroughOptionType;
|
2023-04-26 09:58:36 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the header label's DOM element.
|
2023-04-26 09:58:36 +00:00
|
|
|
*/
|
2023-05-03 14:14:33 +00:00
|
|
|
headerLabel?: PanelMenuPassThroughOptionType;
|
2023-04-26 09:58:36 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the toggleable content's DOM element.
|
2023-04-26 09:58:36 +00:00
|
|
|
*/
|
|
|
|
toggleableContent?: PanelMenuPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the menu content's DOM element.
|
2023-04-26 09:58:36 +00:00
|
|
|
*/
|
|
|
|
menuContent?: PanelMenuPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the list's DOM element.
|
2023-04-26 09:58:36 +00:00
|
|
|
*/
|
|
|
|
menu?: PanelMenuPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the list item's DOM element.
|
2023-04-26 09:58:36 +00:00
|
|
|
*/
|
|
|
|
menuitem?: PanelMenuPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the content's DOM element.
|
2023-04-26 09:58:36 +00:00
|
|
|
*/
|
|
|
|
content?: PanelMenuPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the action's DOM element.
|
2023-04-26 09:58:36 +00:00
|
|
|
*/
|
|
|
|
action?: PanelMenuPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the icon's DOM element.
|
2023-04-26 09:58:36 +00:00
|
|
|
*/
|
|
|
|
icon?: PanelMenuPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the label's DOM element.
|
2023-04-26 09:58:36 +00:00
|
|
|
*/
|
|
|
|
label?: PanelMenuPassThroughOptionType;
|
2023-05-30 08:25:54 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the submenu's DOM element.
|
2023-05-30 08:25:54 +00:00
|
|
|
*/
|
|
|
|
submenu?: PanelMenuPassThroughOptionType;
|
2023-04-26 09:58:36 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the separator's DOM element.
|
2023-04-26 09:58:36 +00:00
|
|
|
*/
|
|
|
|
separator?: PanelMenuPassThroughOptionType;
|
2023-07-06 11:09:01 +00:00
|
|
|
/**
|
2023-11-07 06:16:39 +00:00
|
|
|
* Used to manage all lifecycle hooks.
|
2023-07-06 11:09:01 +00:00
|
|
|
* @see {@link BaseComponent.ComponentHooks}
|
|
|
|
*/
|
|
|
|
hooks?: ComponentHooks;
|
2023-08-02 12:02:08 +00:00
|
|
|
/**
|
|
|
|
* Used to control Vue Transition API.
|
|
|
|
*/
|
2023-08-02 14:07:22 +00:00
|
|
|
transition?: PanelMenuPassThroughTransitionType;
|
2023-04-26 09:58:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough attributes for each DOM elements
|
|
|
|
*/
|
|
|
|
export interface PanelMenuPassThroughAttributes {
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines current inline state in PanelMenu component.
|
|
|
|
*/
|
|
|
|
export interface PanelMenuState {
|
|
|
|
/**
|
|
|
|
* Current id state as a string.
|
|
|
|
*/
|
|
|
|
id: string;
|
|
|
|
/**
|
|
|
|
* Active item path.
|
|
|
|
* @type {MenuItem}
|
|
|
|
*/
|
|
|
|
activeItem: MenuItem[];
|
|
|
|
}
|
|
|
|
|
2023-04-28 10:15:44 +00:00
|
|
|
/**
|
|
|
|
* Defines current options in PanelMenu component.
|
|
|
|
*/
|
|
|
|
export interface PanelMenuContext {
|
2023-07-25 09:11:38 +00:00
|
|
|
/**
|
|
|
|
* Current menuitem
|
|
|
|
*/
|
|
|
|
item: any;
|
2023-07-24 10:48:47 +00:00
|
|
|
/**
|
|
|
|
* Index of the menuitem.
|
|
|
|
*/
|
|
|
|
index: number;
|
2023-04-28 10:15:44 +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-10-17 10:06:59 +00:00
|
|
|
/**
|
|
|
|
* Current disabled state of menuitem as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
disabled: boolean;
|
2023-04-28 10:15:44 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 13:04:32 +00:00
|
|
|
/**
|
|
|
|
* Custom expanded keys metadata.
|
|
|
|
* @see {@link PanelMenuProps.expandedKeys}
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface PanelMenuExpandedKeys {
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
2023-03-01 13:04:32 +00:00
|
|
|
/**
|
|
|
|
* Custom panel open event.
|
|
|
|
* @see {@link PanelMenuEmits['panel-open']}
|
|
|
|
*/
|
2022-12-08 11:04:25 +00:00
|
|
|
export interface PanelMenuPanelOpenEvent {
|
|
|
|
/**
|
|
|
|
* Browser mouse event.
|
|
|
|
* @type {MouseEvent}
|
|
|
|
*/
|
|
|
|
originalEvent: MouseEvent;
|
|
|
|
/**
|
|
|
|
* Current item.
|
|
|
|
*/
|
|
|
|
item: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2023-03-01 13:04:32 +00:00
|
|
|
* Custom panel close event.
|
|
|
|
* @see {@link PanelMenuEmits['panel-close']}
|
2022-12-08 11:04:25 +00:00
|
|
|
* @extends {PanelMenuPanelOpenEvent}
|
|
|
|
*/
|
|
|
|
export interface PanelMenuPanelCloseEvent extends PanelMenuPanelOpenEvent {}
|
|
|
|
|
2023-09-04 09:16:03 +00:00
|
|
|
/**
|
|
|
|
* Defines valid router binding props in PanelMenu component.
|
|
|
|
*/
|
|
|
|
export interface PanelMenuRouterBindProps {
|
|
|
|
/**
|
|
|
|
* Action element binding
|
|
|
|
*/
|
|
|
|
action: object;
|
|
|
|
/**
|
|
|
|
* Icon element binding
|
|
|
|
*/
|
|
|
|
icon: object;
|
|
|
|
/**
|
|
|
|
* Label element binding
|
|
|
|
*/
|
|
|
|
label: object;
|
|
|
|
/**
|
|
|
|
* Submenuicon elemnt binding
|
|
|
|
*/
|
|
|
|
submenuicon: object;
|
2023-10-17 09:55:48 +00:00
|
|
|
/**
|
|
|
|
* Header icon element binding
|
|
|
|
*/
|
|
|
|
headerIcon: object;
|
|
|
|
/**
|
|
|
|
* Header label element binding
|
|
|
|
*/
|
|
|
|
headerLabel: object;
|
2023-09-04 09:16:03 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 13:04:32 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties in PanelMenu component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface PanelMenuProps {
|
|
|
|
/**
|
|
|
|
* An array of menuitems.
|
|
|
|
*/
|
|
|
|
model?: MenuItem[] | undefined;
|
|
|
|
/**
|
|
|
|
* A map of keys to represent the expansion state in controlled mode.
|
2023-03-01 13:04:32 +00:00
|
|
|
* @type {PanelMenuExpandedKeys}
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
expandedKeys?: PanelMenuExpandedKeys;
|
|
|
|
/**
|
|
|
|
* Whether to apply 'router-link-active-exact' class if route exactly matches the item path.
|
2023-11-08 12:49:16 +00:00
|
|
|
* @deprecated since v3.40.0.
|
2023-03-01 13:04:32 +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;
|
2023-04-26 09:58:36 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to DOM elements inside the component.
|
2023-04-26 09:58:36 +00:00
|
|
|
* @type {PanelMenuPassThroughOptions}
|
|
|
|
*/
|
2023-09-05 11:28:04 +00:00
|
|
|
pt?: PassThrough<PanelMenuPassThroughOptions>;
|
2023-09-05 08:50:46 +00:00
|
|
|
/**
|
|
|
|
* Used to configure passthrough(pt) options of the component.
|
|
|
|
* @type {PassThroughOptions}
|
|
|
|
*/
|
|
|
|
ptOptions?: PassThroughOptions;
|
2023-05-30 08:25:54 +00:00
|
|
|
/**
|
|
|
|
* When enabled, it removes component related styles in the core.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
unstyled?: boolean;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 13:04:32 +00:00
|
|
|
/**
|
|
|
|
* Defines valid slots in PanelMenu component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface PanelMenuSlots {
|
|
|
|
/**
|
|
|
|
* Custom content for each item.
|
|
|
|
* @param {Object} scope - item slot's params.
|
|
|
|
*/
|
2023-03-01 13:04:32 +00:00
|
|
|
item(scope: {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Menuitem instance
|
|
|
|
*/
|
|
|
|
item: MenuItem;
|
2023-11-03 12:54:49 +00:00
|
|
|
/**
|
|
|
|
* Current active state of the menuitem
|
|
|
|
*/
|
|
|
|
isActive: boolean;
|
2023-08-30 13:28:00 +00:00
|
|
|
/**
|
|
|
|
* Label property of the menuitem
|
|
|
|
*/
|
|
|
|
label: string | ((...args: any) => string) | undefined;
|
|
|
|
/**
|
|
|
|
* Binding properties of the menuitem
|
|
|
|
*/
|
2023-09-04 09:16:03 +00:00
|
|
|
props: PanelMenuRouterBindProps;
|
2023-08-30 13:28:00 +00:00
|
|
|
/**
|
|
|
|
* Whether or not there is a submenu
|
|
|
|
*/
|
|
|
|
hasSubmenu: boolean;
|
2023-03-01 13:04:32 +00:00
|
|
|
}): VNode[];
|
2023-04-05 12:14:26 +00:00
|
|
|
/**
|
|
|
|
* Custom submenu icon template.
|
2023-08-17 07:16:25 +00:00
|
|
|
* @param {Object} scope - submenuicon slot's params.
|
2023-04-05 12:14:26 +00:00
|
|
|
*/
|
|
|
|
submenuicon(scope: {
|
|
|
|
/**
|
|
|
|
* Whether item is active
|
|
|
|
*/
|
|
|
|
active: boolean;
|
|
|
|
}): VNode[];
|
2023-04-17 06:30:28 +00:00
|
|
|
/**
|
|
|
|
* Custom header icon template.
|
|
|
|
* @param {Object} scope - header icon slot's params.
|
|
|
|
*/
|
|
|
|
headericon(scope: {
|
|
|
|
/**
|
|
|
|
* Menuitem instance
|
|
|
|
*/
|
|
|
|
item: MenuItem;
|
|
|
|
/**
|
|
|
|
* Style class of the item icon element.
|
|
|
|
*/
|
|
|
|
class: any;
|
|
|
|
}): VNode[];
|
|
|
|
/**
|
|
|
|
* 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:32 +00:00
|
|
|
/**
|
|
|
|
* Defines valid emits in PanelMenu component.
|
|
|
|
*/
|
|
|
|
export interface PanelMenuEmits {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Emitted when the expandedKeys changes.
|
|
|
|
* @param {*} value - New value.
|
|
|
|
*/
|
2023-03-01 13:04:32 +00:00
|
|
|
'update:expandedKeys'(value: any): void;
|
2022-12-08 11:04:25 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when a panel gets expanded.
|
|
|
|
* @param {PanelMenuPanelOpenEvent} event - Custom panel open event.
|
|
|
|
*/
|
2023-03-01 13:04:32 +00:00
|
|
|
'panel-open'(event: PanelMenuPanelOpenEvent): void;
|
2022-12-08 11:04:25 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when an active panel is collapsed by clicking on the header.
|
|
|
|
* @param {PanelMenuPanelCloseEvent} event - Custom panel close event.
|
|
|
|
*/
|
2023-03-01 13:04:32 +00:00
|
|
|
'panel-close'(event: PanelMenuPanelCloseEvent): void;
|
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 13:04:32 +00:00
|
|
|
/**
|
|
|
|
* **PrimeVue - PanelMenu**
|
|
|
|
*
|
|
|
|
* _PanelMenu is a hybrid of Accordion and Tree components._
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/panelmenu/)
|
|
|
|
* --- ---
|
2023-03-03 10:55:20 +00:00
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
2023-03-01 13:04:32 +00:00
|
|
|
*
|
|
|
|
* @group Component
|
|
|
|
*
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
declare class PanelMenu extends ClassComponent<PanelMenuProps, PanelMenuSlots, PanelMenuEmits> {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
declare module '@vue/runtime-core' {
|
|
|
|
interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
PanelMenu: GlobalComponentConstructor<PanelMenu>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default PanelMenu;
|