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

308 lines
7.7 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
*
*/
2022-09-06 12:03:37 +00:00
import { VNode } from 'vue';
2023-07-06 11:09:01 +00:00
import { ComponentHooks } from '../basecomponent/BaseComponent';
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:36 +00:00
export declare type PanelMenuPassThroughOptionType = PanelMenuPassThroughAttributes | ((options: PanelMenuPassThroughMethodOptions) => PanelMenuPassThroughAttributes) | null | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface PanelMenuPassThroughMethodOptions {
props: PanelMenuProps;
state: PanelMenuState;
context: PanelMenuContext;
2023-04-26 09:58:36 +00:00
}
/**
* Custom passthrough(pt) options.
* @see {@link PanelMenuProps.pt}
*/
export interface PanelMenuPassThroughOptions {
/**
* Uses to pass attributes to the root's DOM element.
*/
root?: PanelMenuPassThroughOptionType;
/**
* Uses to pass attributes to the panel's DOM element.
*/
panel?: PanelMenuPassThroughOptionType;
/**
* Uses to pass attributes to the header's DOM element.
*/
header?: PanelMenuPassThroughOptionType;
/**
* Uses to pass attributes to the header content's DOM element.
*/
headerContent?: PanelMenuPassThroughOptionType;
/**
* Uses to pass attributes to the header action's DOM element.
*/
headerAction?: PanelMenuPassThroughOptionType;
/**
* Uses to pass attributes to the submenuIcon's DOM element.
*/
submenuIcon?: PanelMenuPassThroughOptionType;
/**
2023-05-03 14:14:33 +00:00
* Uses 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-05-03 14:14:33 +00:00
* Uses 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
/**
* Uses to pass attributes to the toggleable content's DOM element.
*/
toggleableContent?: PanelMenuPassThroughOptionType;
/**
* Uses to pass attributes to the menu content's DOM element.
*/
menuContent?: PanelMenuPassThroughOptionType;
/**
* Uses to pass attributes to the list's DOM element.
*/
menu?: PanelMenuPassThroughOptionType;
/**
* Uses to pass attributes to the list item's DOM element.
*/
menuitem?: PanelMenuPassThroughOptionType;
/**
* Uses to pass attributes to the content's DOM element.
*/
content?: PanelMenuPassThroughOptionType;
/**
* Uses to pass attributes to the action's DOM element.
*/
action?: PanelMenuPassThroughOptionType;
/**
* Uses to pass attributes to the icon's DOM element.
*/
icon?: PanelMenuPassThroughOptionType;
/**
* Uses to pass attributes to the label's DOM element.
*/
label?: PanelMenuPassThroughOptionType;
2023-05-30 08:25:54 +00:00
/**
* Uses to pass attributes to the submenu's DOM element.
*/
submenu?: PanelMenuPassThroughOptionType;
2023-04-26 09:58:36 +00:00
/**
* Uses to pass attributes to the separator's DOM element.
*/
separator?: PanelMenuPassThroughOptionType;
2023-07-06 11:09:01 +00:00
/**
* Uses to manage all lifecycle hooks
* @see {@link BaseComponent.ComponentHooks}
*/
hooks?: ComponentHooks;
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 {
/**
* 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: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-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-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
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {PanelMenuPassThroughOptions}
*/
pt?: PanelMenuPassThroughOptions;
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-03-01 13:04:32 +00:00
}): VNode[];
/**
* Custom submenu icon template.
*/
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.
*/
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;