@element-plus/nightly 0.0.20221023 → 0.0.20221024
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.full.js +253 -215
- package/dist/index.full.min.js +12 -12
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +10 -10
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +253 -215
- package/dist/locale/af.js +1 -1
- package/dist/locale/af.min.js +1 -1
- package/dist/locale/af.min.mjs +1 -1
- package/dist/locale/af.mjs +1 -1
- package/dist/locale/ar.js +1 -1
- package/dist/locale/ar.min.js +1 -1
- package/dist/locale/ar.min.mjs +1 -1
- package/dist/locale/ar.mjs +1 -1
- package/dist/locale/az.js +1 -1
- package/dist/locale/az.min.js +1 -1
- package/dist/locale/az.min.mjs +1 -1
- package/dist/locale/az.mjs +1 -1
- package/dist/locale/bg.js +1 -1
- package/dist/locale/bg.min.js +1 -1
- package/dist/locale/bg.min.mjs +1 -1
- package/dist/locale/bg.mjs +1 -1
- package/dist/locale/bn.js +1 -1
- package/dist/locale/bn.min.js +1 -1
- package/dist/locale/bn.min.mjs +1 -1
- package/dist/locale/bn.mjs +1 -1
- package/dist/locale/ca.js +1 -1
- package/dist/locale/ca.min.js +1 -1
- package/dist/locale/ca.min.mjs +1 -1
- package/dist/locale/ca.mjs +1 -1
- package/dist/locale/cs.js +1 -1
- package/dist/locale/cs.min.js +1 -1
- package/dist/locale/cs.min.mjs +1 -1
- package/dist/locale/cs.mjs +1 -1
- package/dist/locale/da.js +1 -1
- package/dist/locale/da.min.js +1 -1
- package/dist/locale/da.min.mjs +1 -1
- package/dist/locale/da.mjs +1 -1
- package/dist/locale/de.js +1 -1
- package/dist/locale/de.min.js +1 -1
- package/dist/locale/de.min.mjs +1 -1
- package/dist/locale/de.mjs +1 -1
- package/dist/locale/el.js +1 -1
- package/dist/locale/el.min.js +1 -1
- package/dist/locale/el.min.mjs +1 -1
- package/dist/locale/el.mjs +1 -1
- package/dist/locale/en.js +1 -1
- package/dist/locale/en.min.js +1 -1
- package/dist/locale/en.min.mjs +1 -1
- package/dist/locale/en.mjs +1 -1
- package/dist/locale/eo.js +1 -1
- package/dist/locale/eo.min.js +1 -1
- package/dist/locale/eo.min.mjs +1 -1
- package/dist/locale/eo.mjs +1 -1
- package/dist/locale/es.js +1 -1
- package/dist/locale/es.min.js +1 -1
- package/dist/locale/es.min.mjs +1 -1
- package/dist/locale/es.mjs +1 -1
- package/dist/locale/et.js +1 -1
- package/dist/locale/et.min.js +1 -1
- package/dist/locale/et.min.mjs +1 -1
- package/dist/locale/et.mjs +1 -1
- package/dist/locale/eu.js +1 -1
- package/dist/locale/eu.min.js +1 -1
- package/dist/locale/eu.min.mjs +1 -1
- package/dist/locale/eu.mjs +1 -1
- package/dist/locale/fa.js +1 -1
- package/dist/locale/fa.min.js +1 -1
- package/dist/locale/fa.min.mjs +1 -1
- package/dist/locale/fa.mjs +1 -1
- package/dist/locale/fi.js +1 -1
- package/dist/locale/fi.min.js +1 -1
- package/dist/locale/fi.min.mjs +1 -1
- package/dist/locale/fi.mjs +1 -1
- package/dist/locale/fr.js +1 -1
- package/dist/locale/fr.min.js +1 -1
- package/dist/locale/fr.min.mjs +1 -1
- package/dist/locale/fr.mjs +1 -1
- package/dist/locale/he.js +1 -1
- package/dist/locale/he.min.js +1 -1
- package/dist/locale/he.min.mjs +1 -1
- package/dist/locale/he.mjs +1 -1
- package/dist/locale/hr.js +1 -1
- package/dist/locale/hr.min.js +1 -1
- package/dist/locale/hr.min.mjs +1 -1
- package/dist/locale/hr.mjs +1 -1
- package/dist/locale/hu.js +1 -1
- package/dist/locale/hu.min.js +1 -1
- package/dist/locale/hu.min.mjs +1 -1
- package/dist/locale/hu.mjs +1 -1
- package/dist/locale/hy-am.js +1 -1
- package/dist/locale/hy-am.min.js +1 -1
- package/dist/locale/hy-am.min.mjs +1 -1
- package/dist/locale/hy-am.mjs +1 -1
- package/dist/locale/id.js +1 -1
- package/dist/locale/id.min.js +1 -1
- package/dist/locale/id.min.mjs +1 -1
- package/dist/locale/id.mjs +1 -1
- package/dist/locale/it.js +1 -1
- package/dist/locale/it.min.js +1 -1
- package/dist/locale/it.min.mjs +1 -1
- package/dist/locale/it.mjs +1 -1
- package/dist/locale/ja.js +1 -1
- package/dist/locale/ja.min.js +1 -1
- package/dist/locale/ja.min.mjs +1 -1
- package/dist/locale/ja.mjs +1 -1
- package/dist/locale/kk.js +1 -1
- package/dist/locale/kk.min.js +1 -1
- package/dist/locale/kk.min.mjs +1 -1
- package/dist/locale/kk.mjs +1 -1
- package/dist/locale/km.js +1 -1
- package/dist/locale/km.min.js +1 -1
- package/dist/locale/km.min.mjs +1 -1
- package/dist/locale/km.mjs +1 -1
- package/dist/locale/ko.js +1 -1
- package/dist/locale/ko.min.js +1 -1
- package/dist/locale/ko.min.mjs +1 -1
- package/dist/locale/ko.mjs +1 -1
- package/dist/locale/ku.js +1 -1
- package/dist/locale/ku.min.js +1 -1
- package/dist/locale/ku.min.mjs +1 -1
- package/dist/locale/ku.mjs +1 -1
- package/dist/locale/ky.js +1 -1
- package/dist/locale/ky.min.js +1 -1
- package/dist/locale/ky.min.mjs +1 -1
- package/dist/locale/ky.mjs +1 -1
- package/dist/locale/lt.js +1 -1
- package/dist/locale/lt.min.js +1 -1
- package/dist/locale/lt.min.mjs +1 -1
- package/dist/locale/lt.mjs +1 -1
- package/dist/locale/lv.js +1 -1
- package/dist/locale/lv.min.js +1 -1
- package/dist/locale/lv.min.mjs +1 -1
- package/dist/locale/lv.mjs +1 -1
- package/dist/locale/mg.js +1 -1
- package/dist/locale/mg.min.js +1 -1
- package/dist/locale/mg.min.mjs +1 -1
- package/dist/locale/mg.mjs +1 -1
- package/dist/locale/mn.js +1 -1
- package/dist/locale/mn.min.js +1 -1
- package/dist/locale/mn.min.mjs +1 -1
- package/dist/locale/mn.mjs +1 -1
- package/dist/locale/nb-no.js +1 -1
- package/dist/locale/nb-no.min.js +1 -1
- package/dist/locale/nb-no.min.mjs +1 -1
- package/dist/locale/nb-no.mjs +1 -1
- package/dist/locale/nl.js +1 -1
- package/dist/locale/nl.min.js +1 -1
- package/dist/locale/nl.min.mjs +1 -1
- package/dist/locale/nl.mjs +1 -1
- package/dist/locale/pa.js +1 -1
- package/dist/locale/pa.min.js +1 -1
- package/dist/locale/pa.min.mjs +1 -1
- package/dist/locale/pa.mjs +1 -1
- package/dist/locale/pl.js +1 -1
- package/dist/locale/pl.min.js +1 -1
- package/dist/locale/pl.min.mjs +1 -1
- package/dist/locale/pl.mjs +1 -1
- package/dist/locale/pt-br.js +1 -1
- package/dist/locale/pt-br.min.js +1 -1
- package/dist/locale/pt-br.min.mjs +1 -1
- package/dist/locale/pt-br.mjs +1 -1
- package/dist/locale/pt.js +1 -1
- package/dist/locale/pt.min.js +1 -1
- package/dist/locale/pt.min.mjs +1 -1
- package/dist/locale/pt.mjs +1 -1
- package/dist/locale/ro.js +1 -1
- package/dist/locale/ro.min.js +1 -1
- package/dist/locale/ro.min.mjs +1 -1
- package/dist/locale/ro.mjs +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/ru.min.js +1 -1
- package/dist/locale/ru.min.mjs +1 -1
- package/dist/locale/ru.mjs +1 -1
- package/dist/locale/sk.js +1 -1
- package/dist/locale/sk.min.js +1 -1
- package/dist/locale/sk.min.mjs +1 -1
- package/dist/locale/sk.mjs +1 -1
- package/dist/locale/sl.js +1 -1
- package/dist/locale/sl.min.js +1 -1
- package/dist/locale/sl.min.mjs +1 -1
- package/dist/locale/sl.mjs +1 -1
- package/dist/locale/sr.js +1 -1
- package/dist/locale/sr.min.js +1 -1
- package/dist/locale/sr.min.mjs +1 -1
- package/dist/locale/sr.mjs +1 -1
- package/dist/locale/sv.js +1 -1
- package/dist/locale/sv.min.js +1 -1
- package/dist/locale/sv.min.mjs +1 -1
- package/dist/locale/sv.mjs +1 -1
- package/dist/locale/ta.js +1 -1
- package/dist/locale/ta.min.js +1 -1
- package/dist/locale/ta.min.mjs +1 -1
- package/dist/locale/ta.mjs +1 -1
- package/dist/locale/th.js +1 -1
- package/dist/locale/th.min.js +1 -1
- package/dist/locale/th.min.mjs +1 -1
- package/dist/locale/th.mjs +1 -1
- package/dist/locale/tk.js +1 -1
- package/dist/locale/tk.min.js +1 -1
- package/dist/locale/tk.min.mjs +1 -1
- package/dist/locale/tk.mjs +1 -1
- package/dist/locale/tr.js +1 -1
- package/dist/locale/tr.min.js +1 -1
- package/dist/locale/tr.min.mjs +1 -1
- package/dist/locale/tr.mjs +1 -1
- package/dist/locale/ug-cn.js +1 -1
- package/dist/locale/ug-cn.min.js +1 -1
- package/dist/locale/ug-cn.min.mjs +1 -1
- package/dist/locale/ug-cn.mjs +1 -1
- package/dist/locale/uk.js +1 -1
- package/dist/locale/uk.min.js +1 -1
- package/dist/locale/uk.min.mjs +1 -1
- package/dist/locale/uk.mjs +1 -1
- package/dist/locale/uz-uz.js +1 -1
- package/dist/locale/uz-uz.min.js +1 -1
- package/dist/locale/uz-uz.min.mjs +1 -1
- package/dist/locale/uz-uz.mjs +1 -1
- package/dist/locale/vi.js +1 -1
- package/dist/locale/vi.min.js +1 -1
- package/dist/locale/vi.min.mjs +1 -1
- package/dist/locale/vi.mjs +1 -1
- package/dist/locale/zh-cn.js +1 -1
- package/dist/locale/zh-cn.min.js +1 -1
- package/dist/locale/zh-cn.min.mjs +1 -1
- package/dist/locale/zh-cn.mjs +1 -1
- package/dist/locale/zh-tw.js +1 -1
- package/dist/locale/zh-tw.min.js +1 -1
- package/dist/locale/zh-tw.min.mjs +1 -1
- package/dist/locale/zh-tw.mjs +1 -1
- package/es/components/carousel/index.d.ts +18 -34
- package/es/components/carousel/index.mjs.map +1 -1
- package/es/components/carousel/src/carousel.d.ts +0 -2
- package/es/components/carousel/src/carousel.mjs.map +1 -1
- package/es/components/carousel/src/carousel.vue.d.ts +66 -84
- package/es/components/carousel/src/carousel2.mjs +40 -207
- package/es/components/carousel/src/carousel2.mjs.map +1 -1
- package/es/components/carousel/src/instance.d.ts +2 -0
- package/es/components/carousel/src/instance.mjs +2 -0
- package/es/components/carousel/src/instance.mjs.map +1 -0
- package/es/components/carousel/src/use-carousel.d.ts +21 -0
- package/es/components/carousel/src/use-carousel.mjs +210 -0
- package/es/components/carousel/src/use-carousel.mjs.map +1 -0
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/carousel/index.d.ts +18 -34
- package/lib/components/carousel/index.js.map +1 -1
- package/lib/components/carousel/src/carousel.d.ts +0 -2
- package/lib/components/carousel/src/carousel.js.map +1 -1
- package/lib/components/carousel/src/carousel.vue.d.ts +66 -84
- package/lib/components/carousel/src/carousel2.js +42 -209
- package/lib/components/carousel/src/carousel2.js.map +1 -1
- package/lib/components/carousel/src/instance.d.ts +2 -0
- package/lib/components/carousel/src/instance.js +3 -0
- package/lib/components/carousel/src/instance.js.map +1 -0
- package/lib/components/carousel/src/use-carousel.d.ts +21 -0
- package/lib/components/carousel/src/use-carousel.js +214 -0
- package/lib/components/carousel/src/use-carousel.js.map +1 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +2 -2
- package/web-types.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { SetupContext } from 'vue';
|
|
2
|
+
import type { CarouselItemContext } from 'element-plus/es/tokens';
|
|
3
|
+
import type { CarouselEmits, CarouselProps } from './carousel';
|
|
4
|
+
export declare const useCarousel: (props: CarouselProps, emit: SetupContext<CarouselEmits>['emit'], componentName: string) => {
|
|
5
|
+
activeIndex: import("vue").Ref<number>;
|
|
6
|
+
arrowDisplay: import("vue").ComputedRef<boolean>;
|
|
7
|
+
hasLabel: import("vue").ComputedRef<boolean>;
|
|
8
|
+
hover: import("vue").Ref<boolean>;
|
|
9
|
+
isCardType: import("vue").ComputedRef<boolean>;
|
|
10
|
+
items: import("vue").ShallowRef<CarouselItemContext[]>;
|
|
11
|
+
handleButtonEnter: (arrow: 'left' | 'right') => void;
|
|
12
|
+
handleButtonLeave: () => void;
|
|
13
|
+
handleIndicatorClick: (index: number) => void;
|
|
14
|
+
handleMouseEnter: () => void;
|
|
15
|
+
handleMouseLeave: () => void;
|
|
16
|
+
setActiveItem: (index: number | string) => void;
|
|
17
|
+
prev: () => void;
|
|
18
|
+
next: () => void;
|
|
19
|
+
throttledArrowClick: import("lodash").DebouncedFunc<(index: number) => void>;
|
|
20
|
+
throttledIndicatorHover: import("lodash").DebouncedFunc<(index: number) => void>;
|
|
21
|
+
};
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { getCurrentInstance, ref, computed, unref, watch, shallowRef, onMounted, onBeforeUnmount, provide } from 'vue';
|
|
2
|
+
import { throttle } from 'lodash-unified';
|
|
3
|
+
import { useResizeObserver } from '@vueuse/core';
|
|
4
|
+
import '../../../utils/index.mjs';
|
|
5
|
+
import '../../../tokens/index.mjs';
|
|
6
|
+
import '../../../hooks/index.mjs';
|
|
7
|
+
import { useOrderedChildren } from '../../../hooks/use-ordered-children/index.mjs';
|
|
8
|
+
import { isString } from '@vue/shared';
|
|
9
|
+
import { debugWarn } from '../../../utils/error.mjs';
|
|
10
|
+
import { carouselContextKey } from '../../../tokens/carousel.mjs';
|
|
11
|
+
|
|
12
|
+
const THROTTLE_TIME = 300;
|
|
13
|
+
const useCarousel = (props, emit, componentName) => {
|
|
14
|
+
const {
|
|
15
|
+
children: items,
|
|
16
|
+
addChild: addItem,
|
|
17
|
+
removeChild: removeItem
|
|
18
|
+
} = useOrderedChildren(getCurrentInstance(), "ElCarouselItem");
|
|
19
|
+
const activeIndex = ref(-1);
|
|
20
|
+
const timer = ref(null);
|
|
21
|
+
const hover = ref(false);
|
|
22
|
+
const root = ref();
|
|
23
|
+
const arrowDisplay = computed(() => props.arrow !== "never" && !unref(isVertical));
|
|
24
|
+
const hasLabel = computed(() => {
|
|
25
|
+
return items.value.some((item) => item.props.label.toString().length > 0);
|
|
26
|
+
});
|
|
27
|
+
const isCardType = computed(() => props.type === "card");
|
|
28
|
+
const isVertical = computed(() => props.direction === "vertical");
|
|
29
|
+
const throttledArrowClick = throttle((index) => {
|
|
30
|
+
setActiveItem(index);
|
|
31
|
+
}, THROTTLE_TIME, { trailing: true });
|
|
32
|
+
const throttledIndicatorHover = throttle((index) => {
|
|
33
|
+
handleIndicatorHover(index);
|
|
34
|
+
}, THROTTLE_TIME);
|
|
35
|
+
function pauseTimer() {
|
|
36
|
+
if (timer.value) {
|
|
37
|
+
clearInterval(timer.value);
|
|
38
|
+
timer.value = null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function startTimer() {
|
|
42
|
+
if (props.interval <= 0 || !props.autoplay || timer.value)
|
|
43
|
+
return;
|
|
44
|
+
timer.value = setInterval(() => playSlides(), props.interval);
|
|
45
|
+
}
|
|
46
|
+
const playSlides = () => {
|
|
47
|
+
if (activeIndex.value < items.value.length - 1) {
|
|
48
|
+
activeIndex.value = activeIndex.value + 1;
|
|
49
|
+
} else if (props.loop) {
|
|
50
|
+
activeIndex.value = 0;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
function setActiveItem(index) {
|
|
54
|
+
if (isString(index)) {
|
|
55
|
+
const filteredItems = items.value.filter((item) => item.props.name === index);
|
|
56
|
+
if (filteredItems.length > 0) {
|
|
57
|
+
index = items.value.indexOf(filteredItems[0]);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
index = Number(index);
|
|
61
|
+
if (Number.isNaN(index) || index !== Math.floor(index)) {
|
|
62
|
+
debugWarn(componentName, "index must be integer.");
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const itemCount = items.value.length;
|
|
66
|
+
const oldIndex = activeIndex.value;
|
|
67
|
+
if (index < 0) {
|
|
68
|
+
activeIndex.value = props.loop ? itemCount - 1 : 0;
|
|
69
|
+
} else if (index >= itemCount) {
|
|
70
|
+
activeIndex.value = props.loop ? 0 : itemCount - 1;
|
|
71
|
+
} else {
|
|
72
|
+
activeIndex.value = index;
|
|
73
|
+
}
|
|
74
|
+
if (oldIndex === activeIndex.value) {
|
|
75
|
+
resetItemPosition(oldIndex);
|
|
76
|
+
}
|
|
77
|
+
resetTimer();
|
|
78
|
+
}
|
|
79
|
+
function resetItemPosition(oldIndex) {
|
|
80
|
+
items.value.forEach((item, index) => {
|
|
81
|
+
item.translateItem(index, activeIndex.value, oldIndex);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function itemInStage(item, index) {
|
|
85
|
+
var _a, _b, _c, _d;
|
|
86
|
+
const _items = unref(items);
|
|
87
|
+
const itemCount = _items.length;
|
|
88
|
+
if (itemCount === 0 || !item.states.inStage)
|
|
89
|
+
return false;
|
|
90
|
+
const nextItemIndex = index + 1;
|
|
91
|
+
const prevItemIndex = index - 1;
|
|
92
|
+
const lastItemIndex = itemCount - 1;
|
|
93
|
+
const isLastItemActive = _items[lastItemIndex].states.active;
|
|
94
|
+
const isFirstItemActive = _items[0].states.active;
|
|
95
|
+
const isNextItemActive = (_b = (_a = _items[nextItemIndex]) == null ? void 0 : _a.states) == null ? void 0 : _b.active;
|
|
96
|
+
const isPrevItemActive = (_d = (_c = _items[prevItemIndex]) == null ? void 0 : _c.states) == null ? void 0 : _d.active;
|
|
97
|
+
if (index === lastItemIndex && isFirstItemActive || isNextItemActive) {
|
|
98
|
+
return "left";
|
|
99
|
+
} else if (index === 0 && isLastItemActive || isPrevItemActive) {
|
|
100
|
+
return "right";
|
|
101
|
+
}
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
function handleMouseEnter() {
|
|
105
|
+
hover.value = true;
|
|
106
|
+
if (props.pauseOnHover) {
|
|
107
|
+
pauseTimer();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function handleMouseLeave() {
|
|
111
|
+
hover.value = false;
|
|
112
|
+
startTimer();
|
|
113
|
+
}
|
|
114
|
+
function handleButtonEnter(arrow) {
|
|
115
|
+
if (unref(isVertical))
|
|
116
|
+
return;
|
|
117
|
+
items.value.forEach((item, index) => {
|
|
118
|
+
if (arrow === itemInStage(item, index)) {
|
|
119
|
+
item.states.hover = true;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function handleButtonLeave() {
|
|
124
|
+
if (unref(isVertical))
|
|
125
|
+
return;
|
|
126
|
+
items.value.forEach((item) => {
|
|
127
|
+
item.states.hover = false;
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function handleIndicatorClick(index) {
|
|
131
|
+
activeIndex.value = index;
|
|
132
|
+
}
|
|
133
|
+
function handleIndicatorHover(index) {
|
|
134
|
+
if (props.trigger === "hover" && index !== activeIndex.value) {
|
|
135
|
+
activeIndex.value = index;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function prev() {
|
|
139
|
+
setActiveItem(activeIndex.value - 1);
|
|
140
|
+
}
|
|
141
|
+
function next() {
|
|
142
|
+
setActiveItem(activeIndex.value + 1);
|
|
143
|
+
}
|
|
144
|
+
function resetTimer() {
|
|
145
|
+
pauseTimer();
|
|
146
|
+
startTimer();
|
|
147
|
+
}
|
|
148
|
+
watch(() => activeIndex.value, (current, prev2) => {
|
|
149
|
+
resetItemPosition(prev2);
|
|
150
|
+
if (prev2 > -1) {
|
|
151
|
+
emit("change", current, prev2);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
watch(() => props.autoplay, (autoplay) => {
|
|
155
|
+
autoplay ? startTimer() : pauseTimer();
|
|
156
|
+
});
|
|
157
|
+
watch(() => props.loop, () => {
|
|
158
|
+
setActiveItem(activeIndex.value);
|
|
159
|
+
});
|
|
160
|
+
watch(() => props.interval, () => {
|
|
161
|
+
resetTimer();
|
|
162
|
+
});
|
|
163
|
+
watch(() => items.value, () => {
|
|
164
|
+
if (items.value.length > 0)
|
|
165
|
+
setActiveItem(props.initialIndex);
|
|
166
|
+
});
|
|
167
|
+
const resizeObserver = shallowRef();
|
|
168
|
+
onMounted(() => {
|
|
169
|
+
resizeObserver.value = useResizeObserver(root.value, () => {
|
|
170
|
+
resetItemPosition();
|
|
171
|
+
});
|
|
172
|
+
startTimer();
|
|
173
|
+
});
|
|
174
|
+
onBeforeUnmount(() => {
|
|
175
|
+
pauseTimer();
|
|
176
|
+
if (root.value && resizeObserver.value)
|
|
177
|
+
resizeObserver.value.stop();
|
|
178
|
+
});
|
|
179
|
+
provide(carouselContextKey, {
|
|
180
|
+
root,
|
|
181
|
+
isCardType,
|
|
182
|
+
isVertical,
|
|
183
|
+
items,
|
|
184
|
+
loop: props.loop,
|
|
185
|
+
addItem,
|
|
186
|
+
removeItem,
|
|
187
|
+
setActiveItem
|
|
188
|
+
});
|
|
189
|
+
return {
|
|
190
|
+
activeIndex,
|
|
191
|
+
arrowDisplay,
|
|
192
|
+
hasLabel,
|
|
193
|
+
hover,
|
|
194
|
+
isCardType,
|
|
195
|
+
items,
|
|
196
|
+
handleButtonEnter,
|
|
197
|
+
handleButtonLeave,
|
|
198
|
+
handleIndicatorClick,
|
|
199
|
+
handleMouseEnter,
|
|
200
|
+
handleMouseLeave,
|
|
201
|
+
setActiveItem,
|
|
202
|
+
prev,
|
|
203
|
+
next,
|
|
204
|
+
throttledArrowClick,
|
|
205
|
+
throttledIndicatorHover
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
export { useCarousel };
|
|
210
|
+
//# sourceMappingURL=use-carousel.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-carousel.mjs","sources":["../../../../../../packages/components/carousel/src/use-carousel.ts"],"sourcesContent":["import {\n computed,\n getCurrentInstance,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n shallowRef,\n unref,\n watch,\n} from 'vue'\nimport { throttle } from 'lodash-unified'\nimport { useResizeObserver } from '@vueuse/core'\nimport { debugWarn, isString } from '@element-plus/utils'\nimport { carouselContextKey } from '@element-plus/tokens'\nimport { useOrderedChildren } from '@element-plus/hooks'\n\nimport type { SetupContext } from 'vue'\nimport type { CarouselItemContext } from '@element-plus/tokens'\nimport type { CarouselEmits, CarouselProps } from './carousel'\n\nconst THROTTLE_TIME = 300\n\nexport const useCarousel = (\n props: CarouselProps,\n emit: SetupContext<CarouselEmits>['emit'],\n componentName: string\n) => {\n const {\n children: items,\n addChild: addItem,\n removeChild: removeItem,\n } = useOrderedChildren<CarouselItemContext>(\n getCurrentInstance()!,\n 'ElCarouselItem'\n )\n\n // refs\n const activeIndex = ref(-1)\n const timer = ref<ReturnType<typeof setInterval> | null>(null)\n const hover = ref(false)\n const root = ref<HTMLDivElement>()\n\n // computed\n const arrowDisplay = computed(\n () => props.arrow !== 'never' && !unref(isVertical)\n )\n\n const hasLabel = computed(() => {\n return items.value.some((item) => item.props.label.toString().length > 0)\n })\n\n const isCardType = computed(() => props.type === 'card')\n const isVertical = computed(() => props.direction === 'vertical')\n\n // methods\n const throttledArrowClick = throttle(\n (index: number) => {\n setActiveItem(index)\n },\n THROTTLE_TIME,\n { trailing: true }\n )\n\n const throttledIndicatorHover = throttle((index: number) => {\n handleIndicatorHover(index)\n }, THROTTLE_TIME)\n\n function pauseTimer() {\n if (timer.value) {\n clearInterval(timer.value)\n timer.value = null\n }\n }\n\n function startTimer() {\n if (props.interval <= 0 || !props.autoplay || timer.value) return\n timer.value = setInterval(() => playSlides(), props.interval)\n }\n\n const playSlides = () => {\n if (activeIndex.value < items.value.length - 1) {\n activeIndex.value = activeIndex.value + 1\n } else if (props.loop) {\n activeIndex.value = 0\n }\n }\n\n function setActiveItem(index: number | string) {\n if (isString(index)) {\n const filteredItems = items.value.filter(\n (item) => item.props.name === index\n )\n if (filteredItems.length > 0) {\n index = items.value.indexOf(filteredItems[0])\n }\n }\n index = Number(index)\n if (Number.isNaN(index) || index !== Math.floor(index)) {\n debugWarn(componentName, 'index must be integer.')\n return\n }\n const itemCount = items.value.length\n const oldIndex = activeIndex.value\n if (index < 0) {\n activeIndex.value = props.loop ? itemCount - 1 : 0\n } else if (index >= itemCount) {\n activeIndex.value = props.loop ? 0 : itemCount - 1\n } else {\n activeIndex.value = index\n }\n if (oldIndex === activeIndex.value) {\n resetItemPosition(oldIndex)\n }\n resetTimer()\n }\n\n function resetItemPosition(oldIndex?: number) {\n items.value.forEach((item, index) => {\n item.translateItem(index, activeIndex.value, oldIndex)\n })\n }\n\n function itemInStage(item: CarouselItemContext, index: number) {\n const _items = unref(items)\n const itemCount = _items.length\n if (itemCount === 0 || !item.states.inStage) return false\n const nextItemIndex = index + 1\n const prevItemIndex = index - 1\n const lastItemIndex = itemCount - 1\n const isLastItemActive = _items[lastItemIndex].states.active\n const isFirstItemActive = _items[0].states.active\n const isNextItemActive = _items[nextItemIndex]?.states?.active\n const isPrevItemActive = _items[prevItemIndex]?.states?.active\n\n if ((index === lastItemIndex && isFirstItemActive) || isNextItemActive) {\n return 'left'\n } else if ((index === 0 && isLastItemActive) || isPrevItemActive) {\n return 'right'\n }\n return false\n }\n\n function handleMouseEnter() {\n hover.value = true\n if (props.pauseOnHover) {\n pauseTimer()\n }\n }\n\n function handleMouseLeave() {\n hover.value = false\n startTimer()\n }\n\n function handleButtonEnter(arrow: 'left' | 'right') {\n if (unref(isVertical)) return\n items.value.forEach((item, index) => {\n if (arrow === itemInStage(item, index)) {\n item.states.hover = true\n }\n })\n }\n\n function handleButtonLeave() {\n if (unref(isVertical)) return\n items.value.forEach((item) => {\n item.states.hover = false\n })\n }\n\n function handleIndicatorClick(index: number) {\n activeIndex.value = index\n }\n\n function handleIndicatorHover(index: number) {\n if (props.trigger === 'hover' && index !== activeIndex.value) {\n activeIndex.value = index\n }\n }\n\n function prev() {\n setActiveItem(activeIndex.value - 1)\n }\n\n function next() {\n setActiveItem(activeIndex.value + 1)\n }\n\n function resetTimer() {\n pauseTimer()\n startTimer()\n }\n\n // watch\n watch(\n () => activeIndex.value,\n (current, prev) => {\n resetItemPosition(prev)\n if (prev > -1) {\n emit('change', current, prev)\n }\n }\n )\n watch(\n () => props.autoplay,\n (autoplay) => {\n autoplay ? startTimer() : pauseTimer()\n }\n )\n watch(\n () => props.loop,\n () => {\n setActiveItem(activeIndex.value)\n }\n )\n\n watch(\n () => props.interval,\n () => {\n resetTimer()\n }\n )\n\n watch(\n () => items.value,\n () => {\n if (items.value.length > 0) setActiveItem(props.initialIndex)\n }\n )\n\n const resizeObserver = shallowRef<ReturnType<typeof useResizeObserver>>()\n // lifecycle\n onMounted(() => {\n resizeObserver.value = useResizeObserver(root.value, () => {\n resetItemPosition()\n })\n startTimer()\n })\n\n onBeforeUnmount(() => {\n pauseTimer()\n if (root.value && resizeObserver.value) resizeObserver.value.stop()\n })\n\n // provide\n provide(carouselContextKey, {\n root,\n isCardType,\n isVertical,\n items,\n loop: props.loop,\n addItem,\n removeItem,\n setActiveItem,\n })\n\n return {\n activeIndex,\n arrowDisplay,\n hasLabel,\n hover,\n isCardType,\n items,\n handleButtonEnter,\n handleButtonLeave,\n handleIndicatorClick,\n handleMouseEnter,\n handleMouseLeave,\n setActiveItem,\n prev,\n next,\n throttledArrowClick,\n throttledIndicatorHover,\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAgBA,MAAM,aAAa,GAAG,GAAG,CAAC;AACd,MAAC,WAAW,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,aAAa,KAAK;AAC3D,EAAE,MAAM;AACR,IAAI,QAAQ,EAAE,KAAK;AACnB,IAAI,QAAQ,EAAE,OAAO;AACrB,IAAI,WAAW,EAAE,UAAU;AAC3B,GAAG,GAAG,kBAAkB,CAAC,kBAAkB,EAAE,EAAE,gBAAgB,CAAC,CAAC;AACjE,EAAE,MAAM,WAAW,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9B,EAAE,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;AAC1B,EAAE,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;AAC3B,EAAE,MAAM,IAAI,GAA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K;AAC1C,MAAM,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;AAClC,GAAG,CAAC,CAAC;AACL,EAAE,OAAO,CAAC,kBAAkB,EAAE;AAC9B,IAAI,IAAI;AACR,IAAI,UAAU;AACd,IAAI,UAAU;AACd,IAAI,KAAK;AACT,IAAI,IAAI,EAAE,KAAK,CAAC,IAAI;AACpB,IAAI,OAAO;AACX,IAAI,UAAU;AACd,IAAI,aAAa;AACjB,GAAG,CAAC,CAAC;AACL,EAAE,OAAO;AACT,IAAI,WAAW;AACf,IAAI,YAAY;AAChB,IAAI,QAAQ;AACZ,IAAI,KAAK;AACT,IAAI,UAAU;AACd,IAAI,KAAK;AACT,IAAI,iBAAiB;AACrB,IAAI,iBAAiB;AACrB,IAAI,oBAAoB;AACxB,IAAI,gBAAgB;AACpB,IAAI,gBAAgB;AACpB,IAAI,aAAa;AACjB,IAAI,IAAI;AACR,IAAI,IAAI;AACR,IAAI,mBAAmB;AACvB,IAAI,uBAAuB;AAC3B,GAAG,CAAC;AACJ;;;;"}
|
package/es/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.0.
|
|
1
|
+
export declare const version = "0.0.20221024";
|
package/es/version.mjs
CHANGED
package/es/version.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.mjs","sources":["../../../packages/element-plus/version.ts"],"sourcesContent":["export const version = '0.0.
|
|
1
|
+
{"version":3,"file":"version.mjs","sources":["../../../packages/element-plus/version.ts"],"sourcesContent":["export const version = '0.0.20221024'\n"],"names":[],"mappings":"AAAY,MAAC,OAAO,GAAG;;;;"}
|
|
@@ -12,6 +12,7 @@ export declare const ElCarousel: import("element-plus/es/utils").SFCWithInstall<
|
|
|
12
12
|
readonly direction: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "vertical" | "horizontal", unknown, "horizontal", boolean>;
|
|
13
13
|
readonly pauseOnHover: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
14
14
|
}, {
|
|
15
|
+
COMPONENT_NAME: string;
|
|
15
16
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
16
17
|
readonly initialIndex: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
|
|
17
18
|
readonly height: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
@@ -29,6 +30,22 @@ export declare const ElCarousel: import("element-plus/es/utils").SFCWithInstall<
|
|
|
29
30
|
onChange?: ((current: number, prev: number) => any) | undefined;
|
|
30
31
|
}>>;
|
|
31
32
|
emit: (event: "change", current: number, prev: number) => void;
|
|
33
|
+
activeIndex: import("vue").Ref<number>;
|
|
34
|
+
arrowDisplay: import("vue").ComputedRef<boolean>;
|
|
35
|
+
hasLabel: import("vue").ComputedRef<boolean>;
|
|
36
|
+
hover: import("vue").Ref<boolean>;
|
|
37
|
+
isCardType: import("vue").ComputedRef<boolean>;
|
|
38
|
+
items: import("vue").ShallowRef<import("../..").CarouselItemContext[]>;
|
|
39
|
+
handleButtonEnter: (arrow: "left" | "right") => void;
|
|
40
|
+
handleButtonLeave: () => void;
|
|
41
|
+
handleIndicatorClick: (index: number) => void;
|
|
42
|
+
handleMouseEnter: () => void;
|
|
43
|
+
handleMouseLeave: () => void;
|
|
44
|
+
setActiveItem: (index: string | number) => void;
|
|
45
|
+
prev: () => void;
|
|
46
|
+
next: () => void;
|
|
47
|
+
throttledArrowClick: import("lodash").DebouncedFunc<(index: number) => void>;
|
|
48
|
+
throttledIndicatorHover: import("lodash").DebouncedFunc<(index: number) => void>;
|
|
32
49
|
ns: {
|
|
33
50
|
namespace: import("vue").Ref<string>;
|
|
34
51
|
b: (blockSuffix?: string) => string;
|
|
@@ -47,42 +64,8 @@ export declare const ElCarousel: import("element-plus/es/utils").SFCWithInstall<
|
|
|
47
64
|
cssVarBlock: (object: Record<string, string>) => Record<string, string>;
|
|
48
65
|
cssVarBlockName: (name: string) => string;
|
|
49
66
|
};
|
|
50
|
-
COMPONENT_NAME: string;
|
|
51
|
-
THROTTLE_TIME: number;
|
|
52
|
-
items: import("vue").ShallowRef<import("../..").CarouselItemContext[]>;
|
|
53
|
-
addItem: (child: import("../..").CarouselItemContext) => void;
|
|
54
|
-
removeItem: (uid: number) => void;
|
|
55
|
-
activeIndex: import("vue").Ref<number>;
|
|
56
|
-
timer: import("vue").Ref<number | null>;
|
|
57
|
-
hover: import("vue").Ref<boolean>;
|
|
58
|
-
root: import("vue").Ref<HTMLDivElement | undefined>;
|
|
59
|
-
arrowDisplay: import("vue").ComputedRef<boolean>;
|
|
60
|
-
hasLabel: import("vue").ComputedRef<boolean>;
|
|
61
67
|
carouselClasses: import("vue").ComputedRef<string[]>;
|
|
62
68
|
indicatorsClasses: import("vue").ComputedRef<string[]>;
|
|
63
|
-
isCardType: import("vue").ComputedRef<boolean>;
|
|
64
|
-
isVertical: import("vue").ComputedRef<boolean>;
|
|
65
|
-
throttledArrowClick: import("lodash").DebouncedFunc<(index: number) => void>;
|
|
66
|
-
throttledIndicatorHover: import("lodash").DebouncedFunc<(index: number) => void>;
|
|
67
|
-
pauseTimer: () => void;
|
|
68
|
-
startTimer: () => void;
|
|
69
|
-
playSlides: () => void;
|
|
70
|
-
setActiveItem: (index: string | number) => void;
|
|
71
|
-
resetItemPosition: (oldIndex?: number | undefined) => void;
|
|
72
|
-
itemInStage: (item: import("../..").CarouselItemContext, index: number) => false | "left" | "right";
|
|
73
|
-
handleMouseEnter: () => void;
|
|
74
|
-
handleMouseLeave: () => void;
|
|
75
|
-
handleButtonEnter: (arrow: "left" | "right") => void;
|
|
76
|
-
handleButtonLeave: () => void;
|
|
77
|
-
handleIndicatorClick: (index: number) => void;
|
|
78
|
-
handleIndicatorHover: (index: number) => void;
|
|
79
|
-
prev: () => void;
|
|
80
|
-
next: () => void;
|
|
81
|
-
resetTimer: () => void;
|
|
82
|
-
resizeObserver: import("vue").ShallowRef<{
|
|
83
|
-
isSupported: import("vue").Ref<boolean>;
|
|
84
|
-
stop: () => void;
|
|
85
|
-
} | undefined>;
|
|
86
69
|
ElIcon: import("element-plus/es/utils").SFCWithInstall<import("vue").DefineComponent<{
|
|
87
70
|
readonly size: {
|
|
88
71
|
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | number) & {}) | (() => string | number) | ((new (...args: any[]) => (string | number) & {}) | (() => string | number))[], unknown, unknown>>;
|
|
@@ -291,3 +274,4 @@ export declare const ElCarouselItem: import("element-plus/es/utils").SFCWithInst
|
|
|
291
274
|
}>>;
|
|
292
275
|
export * from './src/carousel';
|
|
293
276
|
export * from './src/carousel-item';
|
|
277
|
+
export type { CarouselInstance } from './src/instance';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../packages/components/carousel/index.ts"],"sourcesContent":["import { withInstall, withNoopInstall } from '@element-plus/utils'\nimport Carousel from './src/carousel.vue'\nimport CarouselItem from './src/carousel-item.vue'\n\nexport const ElCarousel = withInstall(Carousel, {\n CarouselItem,\n})\n\nexport default ElCarousel\n\nexport const ElCarouselItem = withNoopInstall(CarouselItem)\n\nexport * from './src/carousel'\nexport * from './src/carousel-item'\n"],"names":["withInstall","Carousel","CarouselItem","withNoopInstall"],"mappings":";;;;;;;;;;;AAGY,MAAC,UAAU,GAAGA,mBAAW,CAACC,qBAAQ,EAAE;AAChD,gBAAEC,yBAAY;AACd,CAAC,EAAE;AAES,MAAC,cAAc,GAAGC,uBAAe,CAACD,yBAAY;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../packages/components/carousel/index.ts"],"sourcesContent":["import { withInstall, withNoopInstall } from '@element-plus/utils'\nimport Carousel from './src/carousel.vue'\nimport CarouselItem from './src/carousel-item.vue'\n\nexport const ElCarousel = withInstall(Carousel, {\n CarouselItem,\n})\n\nexport default ElCarousel\n\nexport const ElCarouselItem = withNoopInstall(CarouselItem)\n\nexport * from './src/carousel'\nexport * from './src/carousel-item'\n\nexport type { CarouselInstance } from './src/instance'\n"],"names":["withInstall","Carousel","CarouselItem","withNoopInstall"],"mappings":";;;;;;;;;;;AAGY,MAAC,UAAU,GAAGA,mBAAW,CAACC,qBAAQ,EAAE;AAChD,gBAAEC,yBAAY;AACd,CAAC,EAAE;AAES,MAAC,cAAc,GAAGC,uBAAe,CAACD,yBAAY;;;;;;;;;"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ExtractPropTypes } from 'vue';
|
|
2
|
-
import type Carousel from './carousel.vue';
|
|
3
2
|
export declare const carouselProps: {
|
|
4
3
|
readonly initialIndex: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
|
|
5
4
|
readonly height: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
@@ -19,4 +18,3 @@ export declare const carouselEmits: {
|
|
|
19
18
|
};
|
|
20
19
|
export declare type CarouselProps = ExtractPropTypes<typeof carouselProps>;
|
|
21
20
|
export declare type CarouselEmits = typeof carouselEmits;
|
|
22
|
-
export declare type CarouselInstance = InstanceType<typeof Carousel>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.js","sources":["../../../../../../packages/components/carousel/src/carousel.ts"],"sourcesContent":["import { buildProps, isNumber } from '@element-plus/utils'\nimport type { ExtractPropTypes } from 'vue'\
|
|
1
|
+
{"version":3,"file":"carousel.js","sources":["../../../../../../packages/components/carousel/src/carousel.ts"],"sourcesContent":["import { buildProps, isNumber } from '@element-plus/utils'\nimport type { ExtractPropTypes } from 'vue'\n\nexport const carouselProps = buildProps({\n initialIndex: {\n type: Number,\n default: 0,\n },\n height: {\n type: String,\n default: '',\n },\n trigger: {\n type: String,\n values: ['hover', 'click'],\n default: 'hover',\n },\n autoplay: {\n type: Boolean,\n default: true,\n },\n interval: {\n type: Number,\n default: 3000,\n },\n indicatorPosition: {\n type: String,\n values: ['', 'none', 'outside'],\n default: '',\n },\n indicator: {\n type: Boolean,\n default: true,\n },\n arrow: {\n type: String,\n values: ['always', 'hover', 'never'],\n default: 'hover',\n },\n type: {\n type: String,\n values: ['', 'card'],\n default: '',\n },\n loop: {\n type: Boolean,\n default: true,\n },\n direction: {\n type: String,\n values: ['horizontal', 'vertical'],\n default: 'horizontal',\n },\n pauseOnHover: {\n type: Boolean,\n default: true,\n },\n} as const)\n\nexport const carouselEmits = {\n change: (current: number, prev: number) => [current, prev].every(isNumber),\n}\n\nexport type CarouselProps = ExtractPropTypes<typeof carouselProps>\nexport type CarouselEmits = typeof carouselEmits\n"],"names":["buildProps","isNumber"],"mappings":";;;;;;;;AACY,MAAC,aAAa,GAAGA,kBAAU,CAAC;AACxC,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;AAC9B,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,GAAG;AAChB,GAAG;AACH,EAAE,iBAAiB,EAAE;AACrB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,CAAC;AACnC,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC;AACxC,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC;AACxB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,YAAY,EAAE,UAAU,CAAC;AACtC,IAAI,OAAO,EAAE,YAAY;AACzB,GAAG;AACH,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,aAAa,GAAG;AAC7B,EAAE,MAAM,EAAE,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,KAAK,CAACC,aAAQ,CAAC;AAC5D;;;;;"}
|
|
@@ -1,35 +1,51 @@
|
|
|
1
|
-
import type { CarouselItemContext } from 'element-plus/es/tokens';
|
|
2
1
|
declare const _default: import("vue").DefineComponent<{
|
|
3
|
-
readonly initialIndex: import("
|
|
4
|
-
readonly height: import("
|
|
5
|
-
readonly trigger: import("
|
|
6
|
-
readonly autoplay: import("
|
|
7
|
-
readonly interval: import("
|
|
8
|
-
readonly indicatorPosition: import("
|
|
9
|
-
readonly indicator: import("
|
|
10
|
-
readonly arrow: import("
|
|
11
|
-
readonly type: import("
|
|
12
|
-
readonly loop: import("
|
|
13
|
-
readonly direction: import("
|
|
14
|
-
readonly pauseOnHover: import("
|
|
2
|
+
readonly initialIndex: import("../../../utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
|
|
3
|
+
readonly height: import("../../../utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
4
|
+
readonly trigger: import("../../../utils").EpPropFinalized<StringConstructor, "hover" | "click", unknown, "hover", boolean>;
|
|
5
|
+
readonly autoplay: import("../../../utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
6
|
+
readonly interval: import("../../../utils").EpPropFinalized<NumberConstructor, unknown, unknown, 3000, boolean>;
|
|
7
|
+
readonly indicatorPosition: import("../../../utils").EpPropFinalized<StringConstructor, "" | "none" | "outside", unknown, "", boolean>;
|
|
8
|
+
readonly indicator: import("../../../utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
9
|
+
readonly arrow: import("../../../utils").EpPropFinalized<StringConstructor, "hover" | "always" | "never", unknown, "hover", boolean>;
|
|
10
|
+
readonly type: import("../../../utils").EpPropFinalized<StringConstructor, "" | "card", unknown, "", boolean>;
|
|
11
|
+
readonly loop: import("../../../utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
12
|
+
readonly direction: import("../../../utils").EpPropFinalized<StringConstructor, "vertical" | "horizontal", unknown, "horizontal", boolean>;
|
|
13
|
+
readonly pauseOnHover: import("../../../utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
15
14
|
}, {
|
|
15
|
+
COMPONENT_NAME: string;
|
|
16
16
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
17
|
-
readonly initialIndex: import("
|
|
18
|
-
readonly height: import("
|
|
19
|
-
readonly trigger: import("
|
|
20
|
-
readonly autoplay: import("
|
|
21
|
-
readonly interval: import("
|
|
22
|
-
readonly indicatorPosition: import("
|
|
23
|
-
readonly indicator: import("
|
|
24
|
-
readonly arrow: import("
|
|
25
|
-
readonly type: import("
|
|
26
|
-
readonly loop: import("
|
|
27
|
-
readonly direction: import("
|
|
28
|
-
readonly pauseOnHover: import("
|
|
17
|
+
readonly initialIndex: import("../../../utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
|
|
18
|
+
readonly height: import("../../../utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
19
|
+
readonly trigger: import("../../../utils").EpPropFinalized<StringConstructor, "hover" | "click", unknown, "hover", boolean>;
|
|
20
|
+
readonly autoplay: import("../../../utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
21
|
+
readonly interval: import("../../../utils").EpPropFinalized<NumberConstructor, unknown, unknown, 3000, boolean>;
|
|
22
|
+
readonly indicatorPosition: import("../../../utils").EpPropFinalized<StringConstructor, "" | "none" | "outside", unknown, "", boolean>;
|
|
23
|
+
readonly indicator: import("../../../utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
24
|
+
readonly arrow: import("../../../utils").EpPropFinalized<StringConstructor, "hover" | "always" | "never", unknown, "hover", boolean>;
|
|
25
|
+
readonly type: import("../../../utils").EpPropFinalized<StringConstructor, "" | "card", unknown, "", boolean>;
|
|
26
|
+
readonly loop: import("../../../utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
27
|
+
readonly direction: import("../../../utils").EpPropFinalized<StringConstructor, "vertical" | "horizontal", unknown, "horizontal", boolean>;
|
|
28
|
+
readonly pauseOnHover: import("../../../utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
29
29
|
}>> & {
|
|
30
30
|
onChange?: ((current: number, prev: number) => any) | undefined;
|
|
31
31
|
}>>;
|
|
32
32
|
emit: (event: "change", current: number, prev: number) => void;
|
|
33
|
+
activeIndex: import("vue").Ref<number>;
|
|
34
|
+
arrowDisplay: import("vue").ComputedRef<boolean>;
|
|
35
|
+
hasLabel: import("vue").ComputedRef<boolean>;
|
|
36
|
+
hover: import("vue").Ref<boolean>;
|
|
37
|
+
isCardType: import("vue").ComputedRef<boolean>;
|
|
38
|
+
items: import("vue").ShallowRef<import("../../..").CarouselItemContext[]>;
|
|
39
|
+
handleButtonEnter: (arrow: "left" | "right") => void;
|
|
40
|
+
handleButtonLeave: () => void;
|
|
41
|
+
handleIndicatorClick: (index: number) => void;
|
|
42
|
+
handleMouseEnter: () => void;
|
|
43
|
+
handleMouseLeave: () => void;
|
|
44
|
+
setActiveItem: (index: string | number) => void;
|
|
45
|
+
prev: () => void;
|
|
46
|
+
next: () => void;
|
|
47
|
+
throttledArrowClick: import("lodash").DebouncedFunc<(index: number) => void>;
|
|
48
|
+
throttledIndicatorHover: import("lodash").DebouncedFunc<(index: number) => void>;
|
|
33
49
|
ns: {
|
|
34
50
|
namespace: import("vue").Ref<string>;
|
|
35
51
|
b: (blockSuffix?: string) => string;
|
|
@@ -48,45 +64,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
48
64
|
cssVarBlock: (object: Record<string, string>) => Record<string, string>;
|
|
49
65
|
cssVarBlockName: (name: string) => string;
|
|
50
66
|
};
|
|
51
|
-
COMPONENT_NAME: string;
|
|
52
|
-
THROTTLE_TIME: number;
|
|
53
|
-
items: import("vue").ShallowRef<CarouselItemContext[]>;
|
|
54
|
-
addItem: (child: CarouselItemContext) => void;
|
|
55
|
-
removeItem: (uid: number) => void;
|
|
56
|
-
activeIndex: import("vue").Ref<number>;
|
|
57
|
-
timer: import("vue").Ref<number | null>;
|
|
58
|
-
hover: import("vue").Ref<boolean>;
|
|
59
|
-
root: import("vue").Ref<HTMLDivElement | undefined>;
|
|
60
|
-
arrowDisplay: import("vue").ComputedRef<boolean>;
|
|
61
|
-
hasLabel: import("vue").ComputedRef<boolean>;
|
|
62
67
|
carouselClasses: import("vue").ComputedRef<string[]>;
|
|
63
68
|
indicatorsClasses: import("vue").ComputedRef<string[]>;
|
|
64
|
-
|
|
65
|
-
isVertical: import("vue").ComputedRef<boolean>;
|
|
66
|
-
throttledArrowClick: import("lodash").DebouncedFunc<(index: number) => void>;
|
|
67
|
-
throttledIndicatorHover: import("lodash").DebouncedFunc<(index: number) => void>;
|
|
68
|
-
pauseTimer: () => void;
|
|
69
|
-
startTimer: () => void;
|
|
70
|
-
playSlides: () => void;
|
|
71
|
-
setActiveItem: (index: number | string) => void;
|
|
72
|
-
resetItemPosition: (oldIndex?: number | undefined) => void;
|
|
73
|
-
itemInStage: (item: CarouselItemContext, index: number) => false | "left" | "right";
|
|
74
|
-
handleMouseEnter: () => void;
|
|
75
|
-
handleMouseLeave: () => void;
|
|
76
|
-
handleButtonEnter: (arrow: 'left' | 'right') => void;
|
|
77
|
-
handleButtonLeave: () => void;
|
|
78
|
-
handleIndicatorClick: (index: number) => void;
|
|
79
|
-
handleIndicatorHover: (index: number) => void;
|
|
80
|
-
prev: () => void;
|
|
81
|
-
next: () => void;
|
|
82
|
-
resetTimer: () => void;
|
|
83
|
-
resizeObserver: import("vue").ShallowRef<{
|
|
84
|
-
isSupported: import("vue").Ref<boolean>;
|
|
85
|
-
stop: () => void;
|
|
86
|
-
} | undefined>;
|
|
87
|
-
ElIcon: import("element-plus/es/utils").SFCWithInstall<import("vue").DefineComponent<{
|
|
69
|
+
ElIcon: import("../../../utils").SFCWithInstall<import("vue").DefineComponent<{
|
|
88
70
|
readonly size: {
|
|
89
|
-
readonly type: import("vue").PropType<import("
|
|
71
|
+
readonly type: import("vue").PropType<import("../../../utils").EpPropMergeType<(new (...args: any[]) => (string | number) & {}) | (() => string | number) | ((new (...args: any[]) => (string | number) & {}) | (() => string | number))[], unknown, unknown>>;
|
|
90
72
|
readonly required: false;
|
|
91
73
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
92
74
|
__epPropKey: true;
|
|
@@ -100,7 +82,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
100
82
|
}, {
|
|
101
83
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
102
84
|
readonly size: {
|
|
103
|
-
readonly type: import("vue").PropType<import("
|
|
85
|
+
readonly type: import("vue").PropType<import("../../../utils").EpPropMergeType<(new (...args: any[]) => (string | number) & {}) | (() => string | number) | ((new (...args: any[]) => (string | number) & {}) | (() => string | number))[], unknown, unknown>>;
|
|
104
86
|
readonly required: false;
|
|
105
87
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
106
88
|
__epPropKey: true;
|
|
@@ -135,7 +117,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
135
117
|
style: import("vue").ComputedRef<import("vue").CSSProperties>;
|
|
136
118
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
137
119
|
readonly size: {
|
|
138
|
-
readonly type: import("vue").PropType<import("
|
|
120
|
+
readonly type: import("vue").PropType<import("../../../utils").EpPropMergeType<(new (...args: any[]) => (string | number) & {}) | (() => string | number) | ((new (...args: any[]) => (string | number) & {}) | (() => string | number))[], unknown, unknown>>;
|
|
139
121
|
readonly required: false;
|
|
140
122
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
141
123
|
__epPropKey: true;
|
|
@@ -152,32 +134,32 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
152
134
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
153
135
|
change: (current: number, prev: number) => boolean;
|
|
154
136
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
155
|
-
readonly initialIndex: import("
|
|
156
|
-
readonly height: import("
|
|
157
|
-
readonly trigger: import("
|
|
158
|
-
readonly autoplay: import("
|
|
159
|
-
readonly interval: import("
|
|
160
|
-
readonly indicatorPosition: import("
|
|
161
|
-
readonly indicator: import("
|
|
162
|
-
readonly arrow: import("
|
|
163
|
-
readonly type: import("
|
|
164
|
-
readonly loop: import("
|
|
165
|
-
readonly direction: import("
|
|
166
|
-
readonly pauseOnHover: import("
|
|
137
|
+
readonly initialIndex: import("../../../utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
|
|
138
|
+
readonly height: import("../../../utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
139
|
+
readonly trigger: import("../../../utils").EpPropFinalized<StringConstructor, "hover" | "click", unknown, "hover", boolean>;
|
|
140
|
+
readonly autoplay: import("../../../utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
141
|
+
readonly interval: import("../../../utils").EpPropFinalized<NumberConstructor, unknown, unknown, 3000, boolean>;
|
|
142
|
+
readonly indicatorPosition: import("../../../utils").EpPropFinalized<StringConstructor, "" | "none" | "outside", unknown, "", boolean>;
|
|
143
|
+
readonly indicator: import("../../../utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
144
|
+
readonly arrow: import("../../../utils").EpPropFinalized<StringConstructor, "hover" | "always" | "never", unknown, "hover", boolean>;
|
|
145
|
+
readonly type: import("../../../utils").EpPropFinalized<StringConstructor, "" | "card", unknown, "", boolean>;
|
|
146
|
+
readonly loop: import("../../../utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
147
|
+
readonly direction: import("../../../utils").EpPropFinalized<StringConstructor, "vertical" | "horizontal", unknown, "horizontal", boolean>;
|
|
148
|
+
readonly pauseOnHover: import("../../../utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
167
149
|
}>> & {
|
|
168
150
|
onChange?: ((current: number, prev: number) => any) | undefined;
|
|
169
151
|
}, {
|
|
170
|
-
readonly type: import("
|
|
171
|
-
readonly trigger: import("
|
|
152
|
+
readonly type: import("../../../utils").EpPropMergeType<StringConstructor, "" | "card", unknown>;
|
|
153
|
+
readonly trigger: import("../../../utils").EpPropMergeType<StringConstructor, "hover" | "click", unknown>;
|
|
172
154
|
readonly height: string;
|
|
173
|
-
readonly direction: import("
|
|
174
|
-
readonly indicator: import("
|
|
175
|
-
readonly loop: import("
|
|
155
|
+
readonly direction: import("../../../utils").EpPropMergeType<StringConstructor, "vertical" | "horizontal", unknown>;
|
|
156
|
+
readonly indicator: import("../../../utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
157
|
+
readonly loop: import("../../../utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
176
158
|
readonly initialIndex: number;
|
|
177
|
-
readonly autoplay: import("
|
|
159
|
+
readonly autoplay: import("../../../utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
178
160
|
readonly interval: number;
|
|
179
|
-
readonly indicatorPosition: import("
|
|
180
|
-
readonly arrow: import("
|
|
181
|
-
readonly pauseOnHover: import("
|
|
161
|
+
readonly indicatorPosition: import("../../../utils").EpPropMergeType<StringConstructor, "" | "none" | "outside", unknown>;
|
|
162
|
+
readonly arrow: import("../../../utils").EpPropMergeType<StringConstructor, "hover" | "always" | "never", unknown>;
|
|
163
|
+
readonly pauseOnHover: import("../../../utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
182
164
|
}>;
|
|
183
165
|
export default _default;
|