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';
|
2022-09-06 12:03:37 +00:00
|
|
|
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
|
|
|
|
2023-03-24 06:46:57 +00:00
|
|
|
export declare type TabViewPassThroughOptionType = TabViewPassThroughAttributes | ((options: { props: TabViewProps; state: TabViewState }) => TabViewPassThroughAttributes) | null | undefined;
|
|
|
|
|
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 {
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the root's DOM element.
|
|
|
|
*/
|
|
|
|
root?: TabViewPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the nav container's DOM element.
|
|
|
|
*/
|
|
|
|
navcontainer?: TabViewPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the nav content's DOM element.
|
|
|
|
*/
|
|
|
|
navcontent?: TabViewPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the list's DOM element.
|
|
|
|
*/
|
|
|
|
nav?: TabViewPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the inkbar's DOM element.
|
|
|
|
*/
|
|
|
|
inkbar?: TabViewPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the previous button's DOM element.
|
|
|
|
*/
|
|
|
|
prevbutton?: TabViewPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the previous button icon's DOM element.
|
|
|
|
*/
|
|
|
|
previcon?: TabViewPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the nex button's DOM element.
|
|
|
|
*/
|
|
|
|
nextbutton?: TabViewPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the next button icon's DOM element.
|
|
|
|
*/
|
|
|
|
nexticon?: TabViewPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the panel's DOM element.
|
|
|
|
*/
|
2023-03-24 13:19:23 +00:00
|
|
|
panelcontainer?: TabViewPassThroughOptionType;
|
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;
|
|
|
|
/**
|
|
|
|
* Uses 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;
|
|
|
|
/**
|
|
|
|
* Uses 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
|
|
|
/**
|
|
|
|
* Uses to pass attributes to DOM elements inside the component.
|
|
|
|
* @type {TabViewPassThroughOptions}
|
|
|
|
*/
|
|
|
|
pt?: TabViewPassThroughOptions;
|
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
|
|
|
|
|
|
|
declare module '@vue/runtime-core' {
|
|
|
|
interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
TabView: GlobalComponentConstructor<TabView>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default TabView;
|