primevue-mirror/components/lib/tieredmenu/TieredMenu.d.ts

409 lines
9.7 KiB
TypeScript
Raw Normal View History

2023-03-03 08:31:20 +00:00
/**
*
* TieredMenu displays submenus in nested overlays.
*
* [Live Demo](https://www.primevue.org/menu/)
*
* @module tieredmenu
*
*/
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 { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
2022-09-06 12:03:37 +00:00
export declare type TieredMenuPassThroughOptionType = TieredMenuPassThroughAttributes | ((options: TieredMenuPassThroughMethodOptions) => TieredMenuPassThroughAttributes | string) | string | null | undefined;
2023-04-26 09:59:21 +00:00
2023-08-02 14:07:22 +00:00
export declare type TieredMenuPassThroughTransitionType = TransitionProps | ((options: TieredMenuPassThroughMethodOptions) => TransitionProps) | undefined;
2023-04-26 09:59:21 +00:00
/**
* Custom passthrough(pt) option method.
*/
export interface TieredMenuPassThroughMethodOptions {
/**
* Defines instance.
*/
2023-07-06 12:01:33 +00:00
instance: any;
/**
* Defines valid properties.
*/
2023-04-26 09:59:21 +00:00
props: TieredMenuProps;
/**
* Defines current inline state.
*/
2023-04-26 09:59:21 +00:00
state: TieredMenuState;
/**
* Defines current options.
*/
context: TieredMenuContext;
2023-09-05 08:50:46 +00:00
/**
* Defines passthrough(pt) options in global config.
*/
global: object | undefined;
2023-04-26 09:59:21 +00:00
}
/**
* Custom passthrough(pt) options.
* @see {@link TieredMenuProps.pt}
*/
export interface TieredMenuPassThroughOptions {
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the root's DOM element.
2023-04-26 09:59:21 +00:00
*/
root?: TieredMenuPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the list's DOM element.
2023-04-26 09:59:21 +00:00
*/
menu?: TieredMenuPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the list item's DOM element.
2023-04-26 09:59:21 +00:00
*/
menuitem?: TieredMenuPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the content's DOM element.
2023-04-26 09:59:21 +00:00
*/
content?: TieredMenuPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the action's DOM element.
2023-04-26 09:59:21 +00:00
*/
action?: TieredMenuPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the icon's DOM element.
2023-04-26 09:59:21 +00:00
*/
icon?: TieredMenuPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the label's DOM element.
2023-04-26 09:59:21 +00:00
*/
label?: TieredMenuPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the submenu icon's DOM element.
2023-04-26 09:59:21 +00:00
*/
submenuIcon?: TieredMenuPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the separator's DOM element.
2023-04-26 09:59:21 +00:00
*/
separator?: TieredMenuPassThroughOptionType;
2023-05-29 12:31:43 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the submenu's DOM element.
2023-05-29 12:31:43 +00:00
*/
2023-05-31 10:48:03 +00:00
submenu?: TieredMenuPassThroughOptionType;
2023-07-06 11:09:01 +00:00
/**
2023-08-01 14:01:12 +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:51 +00:00
/**
* Used to control Vue Transition API.
*/
2023-08-02 14:07:22 +00:00
transition?: TieredMenuPassThroughTransitionType;
2023-04-26 09:59:21 +00:00
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface TieredMenuPassThroughAttributes {
[key: string]: any;
}
/**
* Defines focused item info
*/
export interface TieredMenuFocusedItemInfo {
/**
* Active item index
*/
index: number;
/**
* Active item level
*/
level: number;
/**
* Parent key info
*/
parentKey: string;
}
/**
* Defines current inline state in TieredMenu component.
*/
export interface TieredMenuState {
/**
* Current id state as a string.
*/
id: string;
/**
* Current focus state as a boolean.
* @defaultValue false
*/
focused: boolean;
/**
* Current focused item info.
* @type {TieredMenuFocusedItemInfo}
*/
focusedItemInfo: TieredMenuFocusedItemInfo;
/**
* Active item path.
* @type {TieredMenuFocusedItemInfo}
*/
activeItemPath: TieredMenuFocusedItemInfo[];
/**
* Current visible state as a boolean.
* @defaultValue true
*/
visible: boolean;
}
2023-04-27 14:16:09 +00:00
/**
* Defines current options in TieredMenu component.
*/
export interface TieredMenuContext {
2023-07-25 09:12:10 +00:00
/**
* Current menuitem
*/
item: any;
/**
* Index of the menuitem.
*/
index: number;
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;
/**
* Current disabled state of menuitem as a boolean.
* @defaultValue false
*/
disabled: boolean;
2023-04-27 14:16:09 +00:00
}
/**
2023-10-31 13:36:13 +00:00
* Defines valid router binding props in TieredMenu component.
*/
2023-10-31 13:36:13 +00:00
export interface TieredMenuRouterBindProps {
/**
* Action element binding
*/
action: object;
/**
* Icon element binding
*/
icon: object;
/**
* Label element binding
*/
label: object;
/**
* Submenuicon elemnt binding
*/
submenuicon: object;
}
2023-03-03 08:31:20 +00:00
/**
* Defines valid properties in TieredMenuMenu component.
*/
2022-09-06 12:03:37 +00:00
export interface TieredMenuProps {
/**
* An array of menuitems.
*/
model?: MenuItem[] | undefined;
/**
* Defines if menu would displayed as a popup.
2023-03-10 14:00:58 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
popup?: boolean | undefined;
/**
* A valid query selector or an HTMLElement to specify where the overlay gets attached.
2023-03-08 10:51:52 +00:00
* @defaultValue body
2022-09-06 12:03:37 +00:00
*/
2023-03-03 08:31:20 +00:00
appendTo?: 'body' | 'self' | string | undefined | HTMLElement;
2022-09-06 12:03:37 +00:00
/**
* Whether to automatically manage layering.
2023-03-03 08:31:20 +00:00
* @defaultValue true
2022-09-06 12:03:37 +00:00
*/
autoZIndex?: boolean | undefined;
/**
* Base zIndex value to use in layering.
2023-03-03 08:31:20 +00:00
* @defaultValue 0
2022-09-06 12:03:37 +00:00
*/
baseZIndex?: number | undefined;
/**
* Whether to apply 'router-link-active-exact' class if route exactly matches the item path.
2023-03-03 08:31:20 +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-10 14:00:58 +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:59:21 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to DOM elements inside the component.
2023-04-26 09:59:21 +00:00
* @type {TieredMenuPassThroughOptions}
*/
pt?: PassThrough<TieredMenuPassThroughOptions>;
2023-09-05 08:50:46 +00:00
/**
* Used to configure passthrough(pt) options of the component.
* @type {PassThroughOptions}
*/
ptOptions?: PassThroughOptions;
2023-05-31 10:48:03 +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-03 08:31:20 +00:00
/**
* Defines valid slots in TieredMenuMenu component.
*/
2022-09-06 12:03:37 +00:00
export interface TieredMenuSlots {
/**
* Custom content for each item.
* @param {Object} scope - item slot's params.
*/
2023-03-03 08:31:20 +00:00
item(scope: {
2022-09-06 12:03:37 +00:00
/**
* Menuitem instance
*/
item: MenuItem;
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-10-31 13:36:13 +00:00
props: TieredMenuRouterBindProps;
2023-08-30 13:28:00 +00:00
/**
* Whether or not there is a submenu
*/
hasSubmenu: boolean;
2023-03-03 08:31:20 +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 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[];
/**
* Custom start template.
*/
start(): VNode[];
/**
* Custom end template.
*/
end(): VNode[];
2022-09-06 12:03:37 +00:00
}
2023-03-03 08:31:20 +00:00
/**
* Defines valid emits in TieredMenuMenu component.
*/
export interface TieredMenuEmits {
2022-12-08 11:04:25 +00:00
/**
* Callback to invoke when the component receives focus.
* @param {Event} event - Browser event.
*/
2023-03-03 08:31:20 +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-03 08:31:20 +00:00
blur(event: Event): void;
2022-12-08 11:04:25 +00:00
/**
* Callback to invoke before the popup is shown.
*/
2023-03-03 08:31:20 +00:00
'before-show'(): void;
2022-12-08 11:04:25 +00:00
/**
* Callback to invoke before the popup is hidden.
*/
2023-03-03 08:31:20 +00:00
'before-hide'(): void;
2022-12-08 11:04:25 +00:00
/**
* Callback to invoke when the popup is shown.
*/
2023-03-03 08:31:20 +00:00
show(): void;
2022-12-08 11:04:25 +00:00
/**
* Callback to invoke when the popup is hidden.
*/
2023-03-03 08:31:20 +00:00
hide(): void;
}
2022-09-06 12:03:37 +00:00
2023-03-03 08:31:20 +00:00
/**
2023-03-03 10:46:46 +00:00
* **PrimeVue - TieredMenu**
2023-03-03 08:31:20 +00:00
*
* _TieredMenu displays submenus in nested overlays._
*
* [Live Demo](https://www.primevue.org/tieredmenu/)
* --- ---
2023-03-03 10:55:20 +00:00
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
2023-03-03 08:31:20 +00:00
*
* @group Component
*
*/
2022-09-06 12:03:37 +00:00
declare class TieredMenu extends ClassComponent<TieredMenuProps, TieredMenuSlots, TieredMenuEmits> {
/**
* Toggles the visibility of the overlay.
* @param {Event} event - Browser event
*
* @memberof TieredMenu
*/
toggle: (event: Event) => void;
/**
* Shows the overlay.
* @param {Event} event - Browser event
*
* @memberof TieredMenu
*/
2022-12-08 11:04:25 +00:00
show: (event: Event) => void;
2022-09-06 12:03:37 +00:00
/**
* Hides the overlay.
*
* @memberof TieredMenu
*/
hide(): void;
}
declare module '@vue/runtime-core' {
interface GlobalComponents {
2022-09-14 11:26:01 +00:00
TieredMenu: GlobalComponentConstructor<TieredMenu>;
2022-09-06 12:03:37 +00:00
}
}
export default TieredMenu;