2023-03-01 08:06:07 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* TabView is a container component to group content with tabs.
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/tabview/)
|
|
|
|
*
|
|
|
|
* @module tabview
|
|
|
|
*
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
import { ButtonHTMLAttributes, VNode } from 'vue';
|
2023-07-06 11:17:08 +00:00
|
|
|
import { ComponentHooks } from '../basecomponent';
|
2023-09-05 08:50:46 +00:00
|
|
|
import { PassThroughOptions } from '../passthrough';
|
2023-05-24 07:07:13 +00:00
|
|
|
import { TabPanelPassThroughOptionType } from '../tabpanel';
|
2023-09-05 11:28:04 +00:00
|
|
|
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2024-02-12 13:11:50 +00:00
|
|
|
export declare type TabViewPassThroughOptionType = TabViewPassThroughAttributes | ((options: TabViewPassThroughMethodOptions) => TabViewPassThroughAttributes | string) | string | null | undefined;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface TabViewPassThroughMethodOptions {
|
|
|
|
/**
|
|
|
|
* Defines instance.
|
|
|
|
*/
|
|
|
|
instance: any;
|
|
|
|
/**
|
|
|
|
* Defines valid properties.
|
|
|
|
*/
|
|
|
|
props: TabViewProps;
|
|
|
|
/**
|
|
|
|
* Defines current inline state.
|
|
|
|
*/
|
|
|
|
state: TabViewState;
|
|
|
|
/**
|
|
|
|
* Defines valid attributes.
|
|
|
|
*/
|
|
|
|
attrs: any;
|
|
|
|
/**
|
|
|
|
* Defines parent options.
|
|
|
|
*/
|
|
|
|
parent: any;
|
|
|
|
/**
|
|
|
|
* Defines passthrough(pt) options in global config.
|
|
|
|
*/
|
|
|
|
global: object | undefined;
|
|
|
|
}
|
2023-03-24 06:46:57 +00:00
|
|
|
|
2023-03-01 08:06:07 +00:00
|
|
|
/**
|
|
|
|
* Custom tab change event.
|
2023-03-06 20:35:39 +00:00
|
|
|
* @see {@link TabViewEmits['tab-change']}
|
2023-03-01 08:06:07 +00:00
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface TabViewChangeEvent {
|
|
|
|
/**
|
|
|
|
* Browser event
|
|
|
|
*/
|
|
|
|
originalEvent: Event;
|
|
|
|
/**
|
|
|
|
* Index of the selected tab
|
|
|
|
*/
|
|
|
|
index: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2023-03-01 08:06:07 +00:00
|
|
|
* Custom tab change event.
|
2023-03-06 20:35:39 +00:00
|
|
|
* @see {@link TabViewEmits['tab-click']}
|
2022-09-06 12:03:37 +00:00
|
|
|
* @extends TabViewChangeEvent
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
export interface TabViewClickEvent extends TabViewChangeEvent {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-24 06:46:57 +00:00
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link TabViewProps.pt}
|
|
|
|
*/
|
|
|
|
export interface TabViewPassThroughOptions {
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the root's DOM element.
|
2023-03-24 06:46:57 +00:00
|
|
|
*/
|
|
|
|
root?: TabViewPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the nav container's DOM element.
|
2023-03-24 06:46:57 +00:00
|
|
|
*/
|
2023-04-19 08:00:52 +00:00
|
|
|
navContainer?: TabViewPassThroughOptionType;
|
2023-03-24 06:46:57 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the nav content's DOM element.
|
2023-03-24 06:46:57 +00:00
|
|
|
*/
|
2023-04-19 08:00:52 +00:00
|
|
|
navContent?: TabViewPassThroughOptionType;
|
2023-03-24 06:46:57 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the list's DOM element.
|
2023-03-24 06:46:57 +00:00
|
|
|
*/
|
|
|
|
nav?: TabViewPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the inkbar's DOM element.
|
2023-03-24 06:46:57 +00:00
|
|
|
*/
|
|
|
|
inkbar?: TabViewPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the previous button's DOM element.
|
2023-03-24 06:46:57 +00:00
|
|
|
*/
|
2023-04-19 08:00:52 +00:00
|
|
|
previousButton?: TabViewPassThroughOptionType;
|
2023-03-24 06:46:57 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the previous button icon's DOM element.
|
2023-03-24 06:46:57 +00:00
|
|
|
*/
|
2023-04-19 08:00:52 +00:00
|
|
|
previousIcon?: TabViewPassThroughOptionType;
|
2023-03-24 06:46:57 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the next button's DOM element.
|
2023-03-24 06:46:57 +00:00
|
|
|
*/
|
2023-04-19 08:00:52 +00:00
|
|
|
nextButton?: TabViewPassThroughOptionType;
|
2023-03-24 06:46:57 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the next button icon's DOM element.
|
2023-03-24 06:46:57 +00:00
|
|
|
*/
|
2023-04-19 08:00:52 +00:00
|
|
|
nextIcon?: TabViewPassThroughOptionType;
|
2023-03-24 06:46:57 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the panel's DOM element.
|
2023-03-24 06:46:57 +00:00
|
|
|
*/
|
2023-04-19 08:00:52 +00:00
|
|
|
panelContainer?: TabViewPassThroughOptionType;
|
2023-06-02 11:55:13 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to TabPanel helper components.
|
2023-07-14 09:04:32 +00:00
|
|
|
* @deprecated since v3.30.1. Use 'tabpanel' property instead.
|
2023-06-02 11:55:13 +00:00
|
|
|
*/
|
|
|
|
tab?: TabPanelPassThroughOptionType;
|
2023-07-14 09:04:32 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to TabPanel helper components.
|
2023-07-14 09:04:32 +00:00
|
|
|
*/
|
|
|
|
tabpanel?: TabPanelPassThroughOptionType;
|
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-03-24 06:46:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough attributes for each DOM elements
|
|
|
|
*/
|
|
|
|
export interface TabViewPassThroughAttributes {
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines current inline state in TabView component.
|
|
|
|
*/
|
|
|
|
export interface TabViewState {
|
|
|
|
/**
|
2023-03-24 15:06:26 +00:00
|
|
|
* Current active index state.
|
2023-03-24 06:46:57 +00:00
|
|
|
*/
|
|
|
|
d_activeIndex: number;
|
|
|
|
/**
|
|
|
|
* Unique id for the TabView component.
|
|
|
|
*/
|
|
|
|
id: string;
|
|
|
|
/**
|
|
|
|
* Current state of previous button.
|
2023-03-24 15:06:26 +00:00
|
|
|
* @defaultValue true
|
2023-03-24 06:46:57 +00:00
|
|
|
*/
|
|
|
|
isPrevButtonDisabled: boolean;
|
|
|
|
/**
|
|
|
|
* Current state of the next button.
|
2023-03-24 15:06:26 +00:00
|
|
|
* @defaultValue false
|
2023-03-24 06:46:57 +00:00
|
|
|
*/
|
|
|
|
isNextButtonDisabled: boolean;
|
|
|
|
}
|
|
|
|
|
2023-03-01 08:06:07 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties in TabView component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface TabViewProps {
|
|
|
|
/**
|
|
|
|
* Index of the active tab.
|
2023-03-01 08:06:07 +00:00
|
|
|
* @defaultValue 0
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
activeIndex?: number | undefined;
|
|
|
|
/**
|
|
|
|
* When enabled, hidden tabs are not rendered at all. Defaults to false that hides tabs with css.
|
2023-03-01 08:06:07 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
lazy?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* When enabled displays buttons at each side of the tab headers to scroll the tab list.
|
2023-03-01 08:06:07 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
scrollable?: boolean | undefined;
|
2022-09-14 11:26:01 +00:00
|
|
|
/**
|
|
|
|
* Index of the element in tabbing order.
|
2023-03-01 08:06:07 +00:00
|
|
|
* @defaultValue 0
|
2022-09-14 11:26:01 +00:00
|
|
|
*/
|
|
|
|
tabindex?: number | undefined;
|
|
|
|
/**
|
|
|
|
* When enabled, the focused tab is activated.
|
2023-03-01 08:06:07 +00:00
|
|
|
* @defaultValue false
|
2022-09-14 11:26:01 +00:00
|
|
|
*/
|
|
|
|
selectOnFocus?: boolean | undefined;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass all properties of the HTMLButtonElement to the previous button.
|
2023-03-24 06:46:57 +00:00
|
|
|
* @deprecated since v3.26.0. Use 'pt' property instead.
|
2022-09-14 11:26:01 +00:00
|
|
|
*/
|
|
|
|
previousButtonProps?: ButtonHTMLAttributes | undefined;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass all properties of the HTMLButtonElement to the next button.
|
2023-03-24 06:46:57 +00:00
|
|
|
* @deprecated since v3.26.0. Use 'pt' property instead.
|
2022-09-14 11:26:01 +00:00
|
|
|
*/
|
|
|
|
nextButtonProps?: ButtonHTMLAttributes | undefined;
|
2023-04-11 07:32:40 +00:00
|
|
|
/**
|
2023-04-18 10:51:10 +00:00
|
|
|
* Previous icon of the scrollable tabview.
|
|
|
|
* @deprecated since v3.27.0. Use 'previousicon' slot.
|
2023-04-11 07:32:40 +00:00
|
|
|
*/
|
|
|
|
prevIcon?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Next icon of the scrollable tabview.
|
2023-04-18 10:51:10 +00:00
|
|
|
* @deprecated since v3.27.0. Use 'next' slot.
|
2023-04-11 07:32:40 +00:00
|
|
|
*/
|
|
|
|
nextIcon?: string | undefined;
|
2023-03-24 06:46:57 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to DOM elements inside the component.
|
2023-03-24 06:46:57 +00:00
|
|
|
* @type {TabViewPassThroughOptions}
|
|
|
|
*/
|
2023-09-05 11:28:04 +00:00
|
|
|
pt?: PassThrough<TabViewPassThroughOptions>;
|
2023-09-05 08:50:46 +00:00
|
|
|
/**
|
|
|
|
* Used to configure passthrough(pt) options of the component.
|
|
|
|
* @type {PassThroughOptions}
|
|
|
|
*/
|
|
|
|
ptOptions?: PassThroughOptions;
|
2023-05-24 06:24:33 +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 08:06:07 +00:00
|
|
|
/**
|
|
|
|
* Defines valid slots in TabView slots.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface TabViewSlots {
|
|
|
|
/**
|
|
|
|
* Default slot to detect TabPanel components.
|
|
|
|
*/
|
2023-03-01 08:06:07 +00:00
|
|
|
default(): VNode[];
|
2023-03-24 06:46:57 +00:00
|
|
|
/**
|
|
|
|
* Previous button icon template for the scrollable component.
|
|
|
|
*/
|
2023-04-18 10:51:10 +00:00
|
|
|
previousicon(): VNode[];
|
2023-03-24 06:46:57 +00:00
|
|
|
/**
|
|
|
|
* Next button icon template for the scrollable component.
|
|
|
|
*/
|
|
|
|
nexticon(): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 08:06:07 +00:00
|
|
|
/**
|
|
|
|
* Defines valid emits in TabView component.
|
|
|
|
*/
|
|
|
|
export interface TabViewEmits {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
2023-04-12 06:49:45 +00:00
|
|
|
* Emitted when the activeIndex changes.
|
|
|
|
* @param {number} index - Current activeIndex.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-04-12 06:49:45 +00:00
|
|
|
'update:activeIndex'(index: number): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when an active tab is changed.
|
|
|
|
* @param {TabViewChangeEvent} event - Custom tab change event.
|
|
|
|
*/
|
2023-03-01 08:06:07 +00:00
|
|
|
'tab-change'(event: TabViewChangeEvent): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when an active tab is clicked.
|
|
|
|
* @param {TabViewClickEvent} event - Custom tab click event.
|
|
|
|
*/
|
2023-03-01 08:06:07 +00:00
|
|
|
'tab-click'(event: TabViewClickEvent): void;
|
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 08:06:07 +00:00
|
|
|
/**
|
|
|
|
* **PrimeVue - TabView**
|
|
|
|
*
|
|
|
|
* _TabView is a container component to group content with tabs._
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/tabview/)
|
|
|
|
* --- ---
|
2023-03-03 10:55:20 +00:00
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
2023-03-01 08:06:07 +00:00
|
|
|
*
|
|
|
|
* @group Component
|
|
|
|
*
|
|
|
|
*/
|
2023-03-01 12:30:54 +00:00
|
|
|
declare class TabView extends ClassComponent<TabViewProps, TabViewSlots, TabViewEmits> {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2024-03-14 22:58:11 +00:00
|
|
|
declare module 'vue' {
|
|
|
|
export interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
TabView: GlobalComponentConstructor<TabView>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default TabView;
|