Files
element-plus/packages/components/carousel/src/constants.ts
热爱vue的小菜鸟 cd306117ae feat(components): [carousel] If the carousel height is auto apply item height (#12388)
* 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
2023-05-14 17:47:43 +08:00

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')