-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d7d5a4
commit 01e5aa6
Showing
1 changed file
with
73 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,81 @@ | ||
import { VNode } from 'vue'; | ||
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; | ||
|
||
interface TabViewProps { | ||
activeIndex?: number; | ||
lazy?: boolean; | ||
scrollable?: boolean; | ||
export interface TabViewChangeEvent { | ||
/** | ||
* Browser event | ||
*/ | ||
originalEvent: Event; | ||
/** | ||
* Index of the selected tab | ||
*/ | ||
index: number; | ||
} | ||
|
||
declare class TabView { | ||
$props: TabViewProps; | ||
$emit(eventName: 'update:modelValue', value: number): this; | ||
$emit(eventName: 'tab-change', e: { originalEvent: Event, index: number }): this; | ||
$emit(eventName: 'tab-click', e: { originalEvent: Event, index: number }): this; | ||
$slots: { | ||
'': VNode[]; | ||
/** | ||
* @extends TabViewChangeEvent | ||
*/ | ||
export interface TabViewClickEvent extends TabViewChangeEvent { } | ||
|
||
export interface TabViewProps { | ||
/** | ||
* Index of the active tab. | ||
*/ | ||
activeIndex?: number | undefined; | ||
/** | ||
* When enabled, hidden tabs are not rendered at all. Defaults to false that hides tabs with css. | ||
*/ | ||
lazy?: boolean | undefined; | ||
/** | ||
* When enabled displays buttons at each side of the tab headers to scroll the tab list. | ||
*/ | ||
scrollable?: boolean | undefined; | ||
} | ||
|
||
export interface TabViewSlots { | ||
/** | ||
* Default slot to detect TabPanel components. | ||
*/ | ||
default: () => VNode[]; | ||
} | ||
|
||
export declare type TabViewEmits = { | ||
/** | ||
* Emitted when the value changes. | ||
* @param {number} value - New value. | ||
*/ | ||
'update:modelValue': (value: number) => void; | ||
/** | ||
* Callback to invoke when an active tab is changed. | ||
* @param {TabViewChangeEvent} event - Custom tab change event. | ||
*/ | ||
'tab-change': (event: TabViewChangeEvent) => void; | ||
/** | ||
* Callback to invoke when an active tab is clicked. | ||
* @param {TabViewClickEvent} event - Custom tab click event. | ||
*/ | ||
'tab-click': (event: TabViewClickEvent) => void; | ||
} | ||
|
||
declare class TabView extends ClassComponent<TabViewProps, TabViewSlots, TabViewEmits> { } | ||
|
||
declare module '@vue/runtime-core' { | ||
interface GlobalComponents { | ||
TabView: GlobalComponentConstructor<TabView> | ||
} | ||
} | ||
|
||
/** | ||
* | ||
* TabView is a container component to group content with tabs. | ||
* | ||
* Helper Components: | ||
* | ||
* - TabPanel | ||
* | ||
* Demos: | ||
* | ||
* - [TabView](https://www.primefaces.org/primevue/showcase/#/tabview) | ||
* | ||
*/ | ||
export default TabView; |