mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
* fix(components): [carousel] :height is auto and card direction vertical * fix(components): [carousel] :height is auto and card direction vertical * fix(components): [carousel] :height is auto and card direction 垂直 * feat(components): [carousel] height is adaptive when height is auto * feat(components): [carousel] height is adaptive when height is auto * fix(components): [carousel] :height is auto and card direction 垂直 * fix(components): [carousel] :height is auto and card direction 垂直 * fix(components): [carousel] :height is auto test.tsx * fix(components): [carousel] :height is auto and card direction * fix: delete zIndex * fix: delete ts type * fix: add test * fix: css modification * fix: delete doc inside * fix: Revise card width not adaptive * fix: Modify calcCardTranslate * fix: test * fix: calcCardTranslate * fix: remove redundant code
36 lines
905 B
TypeScript
36 lines
905 B
TypeScript
import type { InjectionKey, Ref } from 'vue'
|
|
|
|
import type { CarouselItemProps } from './carousel-item'
|
|
|
|
export type CarouselItemStates = {
|
|
hover: boolean
|
|
translate: number
|
|
scale: number
|
|
active: boolean
|
|
ready: boolean
|
|
inStage: boolean
|
|
animating: boolean
|
|
}
|
|
|
|
export type CarouselItemContext = {
|
|
props: CarouselItemProps
|
|
states: CarouselItemStates
|
|
uid: number
|
|
translateItem: (index: number, activeIndex: number, oldIndex?: number) => void
|
|
}
|
|
|
|
export type CarouselContext = {
|
|
root: Ref<HTMLElement | undefined>
|
|
items: Ref<CarouselItemContext[]>
|
|
isCardType: Ref<boolean>
|
|
isVertical: Ref<boolean>
|
|
loop: boolean
|
|
addItem: (item: CarouselItemContext) => void
|
|
removeItem: (uid: number) => void
|
|
setActiveItem: (index: number) => void
|
|
setContainerHeight: (height: number) => void
|
|
}
|
|
|
|
export const carouselContextKey: InjectionKey<CarouselContext> =
|
|
Symbol('carouselContextKey')
|