primevue-mirror/components/lib/tabmenu/TabMenu.d.ts

279 lines
6.4 KiB
TypeScript
Raw Normal View History

2023-03-01 13:04:44 +00:00
/**
*
* TabMenu is a navigation component that displays items as tab headers. Example below uses nested routes with TabMenu.
*
* [Live Demo](https://www.primevue.org/tabmenu/)
*
* @module tabmenu
*
*/
2022-09-06 12:03:37 +00:00
import { 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 TabMenuPassThroughOptionType = TabMenuPassThroughAttributes | ((options: TabMenuPassThroughMethodOptions) => TabMenuPassThroughAttributes | string) | string | null | undefined;
2023-04-26 09:59:02 +00:00
/**
* Custom passthrough(pt) option method.
*/
export interface TabMenuPassThroughMethodOptions {
/**
* Defines instance.
*/
2023-07-06 12:01:33 +00:00
instance: any;
/**
* Defines valid properties.
*/
2023-04-26 09:59:02 +00:00
props: TabMenuProps;
/**
* Defines current inline state.
*/
2023-04-26 09:59:02 +00:00
state: TabMenuState;
/**
* Defines current options.
*/
context: TabMenuContext;
/**
* 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:59:02 +00:00
}
/**
* Custom passthrough(pt) options.
* @see {@link TabMenuProps.pt}
*/
export interface TabMenuPassThroughOptions {
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the root's DOM element.
2023-04-26 09:59:02 +00:00
*/
root?: TabMenuPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the list's DOM element.
2023-04-26 09:59:02 +00:00
*/
menu?: TabMenuPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the list item's DOM element.
2023-04-26 09:59:02 +00:00
*/
menuitem?: TabMenuPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the action's DOM element.
2023-04-26 09:59:02 +00:00
*/
action?: TabMenuPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the icon's DOM element.
2023-04-26 09:59:02 +00:00
*/
icon?: TabMenuPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the label's DOM element.
2023-04-26 09:59:02 +00:00
*/
label?: TabMenuPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the inkbar's DOM element.
2023-04-26 09:59:02 +00:00
*/
inkbar?: TabMenuPassThroughOptionType;
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-04-26 09:59:02 +00:00
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface TabMenuPassThroughAttributes {
[key: string]: any;
}
/**
* Defines current inline state in TabMenu component.
*/
export interface TabMenuState {
/**
* Current active index state as a number.
* @defaulValue 0
*/
d_activeIndex: number;
}
2023-04-28 07:23:20 +00:00
/**
* Defines current options in TabMenu component.
*/
export interface TabMenuContext {
2023-07-25 09:11:57 +00:00
/**
* Current menuitem
*/
item: any;
2023-04-28 07:23:20 +00:00
/**
2023-07-24 11:12:43 +00:00
* Index of the menuitem
2023-04-28 07:23:20 +00:00
*/
2023-07-24 11:12:43 +00:00
index: number;
2023-04-28 07:23:20 +00:00
}
2023-03-01 13:04:44 +00:00
/**
* Custom change event.
* @see {@link TabMenuEmits['tab-change']}
*/
2022-09-06 12:03:37 +00:00
export interface TabMenuChangeEvent {
/**
* Browser event
*/
originalEvent: Event;
/**
* Index of the selected tab
*/
index: number;
}
/**
* Defines valid router binding props in TabMenu component.
*/
export interface TabMenuRouterBindProps {
/**
* Action element binding
*/
action: object;
/**
* Icon element binding
*/
icon: object;
/**
* Label element binding
*/
label: object;
}
2023-03-01 13:04:44 +00:00
/**
* Defines valid properties in TabMenu component.
*/
2022-09-06 12:03:37 +00:00
export interface TabMenuProps {
/**
* An array of menuitems.
*/
model?: MenuItem[] | undefined;
/**
* Defines if active route highlight should match the exact route path.
2023-11-08 12:49:46 +00:00
* @deprecated since v3.40.0.
2023-03-01 13:04:44 +00:00
* @defaultValue true
2022-09-06 12:03:37 +00:00
*/
exact?: boolean | undefined;
/**
* Active index of menuitem.
2023-03-01 13:04:44 +00:00
* @defaultValue 0
2022-09-06 12:03:37 +00:00
*/
activeIndex?: number | undefined;
2022-12-08 11:04:25 +00:00
/**
* Defines a string value that labels an interactive element.
*/
2023-11-24 12:21:54 +00:00
ariaLabel?: string | undefined;
2022-12-08 11:04:25 +00:00
/**
* Identifier of the underlying input element.
*/
2023-11-24 12:21:54 +00:00
ariaLabelledby?: string | undefined;
2023-04-26 09:59:02 +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:02 +00:00
* @type {TabMenuPassThroughOptions}
*/
pt?: PassThrough<TabMenuPassThroughOptions>;
2023-09-05 08:50:46 +00:00
/**
* Used to configure passthrough(pt) options of the component.
* @type {PassThroughOptions}
*/
ptOptions?: PassThroughOptions;
2023-05-30 11:43:52 +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:44 +00:00
/**
* Defines valid slots in TabMenu component.
*/
2022-09-06 12:03:37 +00:00
export interface TabMenuSlots {
/**
* Custom content for each item.
* @param {Object} scope - item slot's params.
*/
2023-03-01 13:04:44 +00:00
item(scope: {
2022-09-06 12:03:37 +00:00
/**
* Menuitem instance
*/
item: MenuItem;
/**
* Index of the menuitem
*/
index: number;
/**
* Current active state of the menuitem
*/
active: boolean;
2023-08-31 13:08:40 +00:00
/**
* Label property of the menuitem
*/
label: string | ((...args: any) => string) | undefined;
/**
* Binding properties of the menuitem
*/
props: TabMenuRouterBindProps;
2023-03-01 13:04:44 +00:00
}): 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:44 +00:00
/**
* Defines valid emits in TabMenu component.
*/
export interface TabMenuEmits {
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when an active tab is changed.
* @param {TabMenuChangeEvent} event - Custom tab change event.
*/
2023-03-01 13:04:44 +00:00
'tab-change'(event: TabMenuChangeEvent): void;
}
2022-09-06 12:03:37 +00:00
2023-03-01 13:04:44 +00:00
/**
* **PrimeVue - TabMenu**
*
* _TabMenu is a navigation component that displays items as tab headers. Example below uses nested routes with TabMenu._
*
* [Live Demo](https://www.primevue.org/tabmenu/)
* --- ---
2023-03-03 10:55:20 +00:00
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
2023-03-01 13:04:44 +00:00
*
* @group Component
*
*/
2022-09-14 11:26:01 +00:00
declare class TabMenu extends ClassComponent<TabMenuProps, TabMenuSlots, TabMenuEmits> {}
2022-09-06 12:03:37 +00:00
declare module '@vue/runtime-core' {
interface GlobalComponents {
2022-09-14 11:26:01 +00:00
TabMenu: GlobalComponentConstructor<TabMenu>;
2022-09-06 12:03:37 +00:00
}
}
export default TabMenu;