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

210 lines
5.0 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';
2022-12-08 11:04:25 +00:00
import { ClassComponent, GlobalComponentConstructor } 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 {
2023-07-06 12:01:33 +00:00
instance: any;
2023-04-26 09:59:02 +00:00
props: TabMenuProps;
state: TabMenuState;
context: TabMenuContext;
2023-04-26 09:59:02 +00:00
}
/**
* Custom passthrough(pt) options.
* @see {@link TabMenuProps.pt}
*/
export interface TabMenuPassThroughOptions {
/**
* Uses to pass attributes to the root's DOM element.
*/
root?: TabMenuPassThroughOptionType;
/**
* Uses to pass attributes to the list's DOM element.
*/
menu?: TabMenuPassThroughOptionType;
/**
* Uses to pass attributes to the list item's DOM element.
*/
menuitem?: TabMenuPassThroughOptionType;
/**
* Uses to pass attributes to the action's DOM element.
*/
action?: TabMenuPassThroughOptionType;
/**
* Uses to pass attributes to the icon's DOM element.
*/
icon?: TabMenuPassThroughOptionType;
/**
* Uses to pass attributes to the label's DOM element.
*/
label?: TabMenuPassThroughOptionType;
/**
* Uses to pass attributes to the inkbar's DOM element.
*/
inkbar?: TabMenuPassThroughOptionType;
2023-07-06 11:09:01 +00:00
/**
* Uses to manage all lifecycle hooks
* @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-04-28 07:23:20 +00:00
/**
* Order of the menuitem
*/
order: number;
}
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;
}
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-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.
*/
'aria-label'?: string | undefined;
/**
* Identifier of the underlying input element.
*/
'aria-labelledby'?: string | undefined;
2023-04-26 09:59:02 +00:00
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {TabMenuPassThroughOptions}
*/
pt?: TabMenuPassThroughOptions;
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;
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;