2022-03-25 15:35:56 +08:00
|
|
|
import type { TabPaneProps, TabsProps } from '@element-plus/components/tabs'
|
2021-11-12 05:38:50 +08:00
|
|
|
import type {
|
|
|
|
ComponentInternalInstance,
|
|
|
|
ComputedRef,
|
|
|
|
InjectionKey,
|
2022-03-25 15:35:56 +08:00
|
|
|
Ref,
|
2021-11-12 05:38:50 +08:00
|
|
|
ShallowReactive,
|
2022-03-25 15:35:56 +08:00
|
|
|
UnwrapRef,
|
2021-11-12 05:38:50 +08:00
|
|
|
} from 'vue'
|
|
|
|
|
|
|
|
export type TabsPaneContext = UnwrapRef<{
|
|
|
|
uid: number
|
|
|
|
instance: ShallowReactive<ComponentInternalInstance>
|
|
|
|
props: TabPaneProps
|
2022-02-10 23:25:39 +08:00
|
|
|
paneName: ComputedRef<string | number | undefined>
|
2021-11-12 05:38:50 +08:00
|
|
|
active: ComputedRef<boolean>
|
|
|
|
index: Ref<string | undefined>
|
|
|
|
isClosable: ComputedRef<boolean>
|
|
|
|
}>
|
|
|
|
|
|
|
|
export interface TabsRootContext {
|
|
|
|
props: TabsProps
|
2022-02-10 23:25:39 +08:00
|
|
|
currentName: Ref<string | number>
|
2021-11-12 05:38:50 +08:00
|
|
|
updatePaneState: (pane: TabsPaneContext) => void
|
|
|
|
}
|
|
|
|
|
|
|
|
export const tabsRootContextKey: InjectionKey<TabsRootContext> =
|
|
|
|
Symbol('tabsRootContextKey')
|