primevue-mirror/components/lib/tabview/TabView.d.ts

247 lines
6.5 KiB
TypeScript
Raw Normal View History

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-05-24 07:07:13 +00:00
import { TabPanelPassThroughOptionType } from '../tabpanel';
2022-09-06 12:03:37 +00:00
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
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
/**
* 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.
*/
2023-04-19 08:00:52 +00:00
navContainer?: TabViewPassThroughOptionType;
/**
* Uses to pass attributes to the nav content's DOM element.
*/
2023-04-19 08:00:52 +00:00
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.
*/
2023-04-19 08:00:52 +00:00
previousButton?: TabViewPassThroughOptionType;
/**
* Uses to pass attributes to the previous button icon's DOM element.
*/
2023-04-19 08:00:52 +00:00
previousIcon?: TabViewPassThroughOptionType;
/**
2023-04-19 08:07:18 +00:00
* Uses to pass attributes to the next button's DOM element.
*/
2023-04-19 08:00:52 +00:00
nextButton?: TabViewPassThroughOptionType;
/**
* Uses to pass attributes to the next button icon's DOM element.
*/
2023-04-19 08:00:52 +00:00
nextIcon?: TabViewPassThroughOptionType;
/**
* Uses to pass attributes to the panel's DOM element.
*/
2023-04-19 08:00:52 +00:00
panelContainer?: TabViewPassThroughOptionType;
2023-06-02 11:55:13 +00:00
/**
* Uses to pass attributes to TabPanel helper components.
*/
tab?: TabPanelPassThroughOptionType;
2023-07-06 11:09:01 +00:00
/**
* Uses to manage all lifecycle hooks
* @see {@link BaseComponent.ComponentHooks}
*/
hooks?: ComponentHooks;
}
/**
* 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.
*/
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
*/
isPrevButtonDisabled: boolean;
/**
* Current state of the next button.
2023-03-24 15:06:26 +00:00
* @defaultValue false
*/
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.
* @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.
* @deprecated since v3.26.0. Use 'pt' property instead.
2022-09-14 11:26:01 +00:00
*/
nextButtonProps?: ButtonHTMLAttributes | undefined;
/**
* Previous icon of the scrollable tabview.
* @deprecated since v3.27.0. Use 'previousicon' slot.
*/
prevIcon?: string | undefined;
/**
* Next icon of the scrollable tabview.
* @deprecated since v3.27.0. Use 'next' slot.
*/
nextIcon?: string | undefined;
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {TabViewPassThroughOptions}
*/
pt?: TabViewPassThroughOptions;
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[];
/**
* Previous button icon template for the scrollable component.
*/
previousicon(): VNode[];
/**
* 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;