primevue-mirror/components/lib/panelmenu/PanelMenu.d.ts

415 lines
10 KiB
TypeScript
Raw Normal View History

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';
import { DefineComponent, DesignToken, EmitFn, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
2022-09-06 12:03:37 +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 {
/**
* Defines instance.
*/
2023-07-06 12:01:33 +00:00
instance: any;
/**
* Defines valid properties.
*/
2023-04-26 09:58:36 +00:00
props: PanelMenuProps;
/**
* Defines current inline state.
*/
2023-04-26 09:58:36 +00:00
state: PanelMenuState;
/**
* Defines current options.
*/
context: PanelMenuContext;
/**
* Defines valid attributes.
*/
attrs: any;
/**
* Defines parent options.
*/
parent: any;
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 {
/**
* Used to pass attributes to the root's DOM element.
2023-04-26 09:58:36 +00:00
*/
root?: PanelMenuPassThroughOptionType;
/**
* Used to pass attributes to the panel's DOM element.
2023-04-26 09:58:36 +00:00
*/
panel?: PanelMenuPassThroughOptionType;
/**
* Used to pass attributes to the header's DOM element.
2023-04-26 09:58:36 +00:00
*/
header?: PanelMenuPassThroughOptionType;
/**
* Used to pass attributes to the header content's DOM element.
2023-04-26 09:58:36 +00:00
*/
headerContent?: PanelMenuPassThroughOptionType;
/**
* Used to pass attributes to the header link's DOM element.
2023-04-26 09:58:36 +00:00
*/
headerLink?: PanelMenuPassThroughOptionType;
2023-04-26 09:58:36 +00:00
/**
* Used to pass attributes to the submenuIcon's DOM element.
2023-04-26 09:58:36 +00:00
*/
submenuIcon?: PanelMenuPassThroughOptionType;
/**
* 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
/**
* 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
/**
* Used to pass attributes to the content container's DOM element.
2023-04-26 09:58:36 +00:00
*/
contentContainer?: PanelMenuPassThroughOptionType;
2023-04-26 09:58:36 +00:00
/**
* Used to pass attributes to the content's DOM element.
2023-04-26 09:58:36 +00:00
*/
content?: PanelMenuPassThroughOptionType;
2023-04-26 09:58:36 +00:00
/**
* Used to pass attributes to the root list's DOM element.
2023-04-26 09:58:36 +00:00
*/
rootList?: PanelMenuPassThroughOptionType;
2023-04-26 09:58:36 +00:00
/**
* Used to pass attributes to the list item's DOM element.
2023-04-26 09:58:36 +00:00
*/
menuitem?: PanelMenuPassThroughOptionType;
/**
* Used to pass attributes to the item content's DOM element.
2023-04-26 09:58:36 +00:00
*/
itemContent?: PanelMenuPassThroughOptionType;
2023-04-26 09:58:36 +00:00
/**
* Used to pass attributes to the item link's DOM element.
2023-04-26 09:58:36 +00:00
*/
itemLink?: PanelMenuPassThroughOptionType;
2023-04-26 09:58:36 +00:00
/**
* Used to pass attributes to the item icon's DOM element.
2023-04-26 09:58:36 +00:00
*/
itemIcon?: PanelMenuPassThroughOptionType;
2023-04-26 09:58:36 +00:00
/**
* Used to pass attributes to the item label's DOM element.
2023-04-26 09:58:36 +00:00
*/
2024-05-06 13:10:13 +00:00
itemLabel?: PanelMenuPassThroughOptionType;
2023-05-30 08:25:54 +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
/**
* 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[];
}
/**
* 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;
/**
* Current active state of menuitem as a boolean.
* @defaultValue false
*/
active: boolean;
/**
* Current focused state of menuitem as a boolean.
* @defaultValue false
*/
focused: boolean;
/**
* Current disabled state of menuitem as a boolean.
* @defaultValue false
*/
disabled: boolean;
}
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.
2024-05-16 14:05:43 +00:00
* @see {@link PanelMenuEmitsOptions['panel-open']}
2023-03-01 13:04:32 +00:00
*/
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.
2024-05-16 14:05:43 +00:00
* @see {@link PanelMenuEmitsOptions['panel-close']}
2022-12-08 11:04:25 +00:00
* @extends {PanelMenuPanelOpenEvent}
*/
export interface PanelMenuPanelCloseEvent extends PanelMenuPanelOpenEvent {}
/**
* 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-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;
/**
* When enabled, multiple root menuitems can be activated at the same time.
* @defaultValue false
*/
multiple?: boolean | undefined;
2022-12-08 11:04:25 +00:00
/**
* Index of the element in tabbing order.
*/
tabindex?: number | string | undefined;
/**
* It generates scoped CSS variables using design tokens for the component.
*/
dt?: DesignToken<any>;
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}
*/
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;
/**
* Whether there is a root menuitem
*/
root: boolean;
/**
* Current active state of the menuitem
*/
2023-11-09 08:42:17 +00:00
active: 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
*/
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[];
/**
* Custom submenu icon template.
2023-08-17 07:16:25 +00:00
* @param {Object} scope - submenuicon slot's params.
*/
submenuicon(scope: {
/**
* Whether item is active
*/
active: boolean;
}): VNode[];
/**
* 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.
*/
2024-05-16 14:05:43 +00:00
export interface PanelMenuEmitsOptions {
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
export declare type PanelMenuEmits = EmitFn<PanelMenuEmitsOptions>;
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
*
*/
declare const PanelMenu: DefineComponent<PanelMenuProps, PanelMenuSlots, PanelMenuEmits>;
2022-09-06 12:03:37 +00:00
declare module 'vue' {
export interface GlobalComponents {
PanelMenu: GlobalComponentConstructor<PanelMenuProps, PanelMenuSlots, PanelMenuEmits>;
2022-09-06 12:03:37 +00:00
}
}
export default PanelMenu;