@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.
Files changed (264) hide show
  1. package/dist/index.full.js +253 -215
  2. package/dist/index.full.min.js +12 -12
  3. package/dist/index.full.min.js.map +1 -1
  4. package/dist/index.full.min.mjs +10 -10
  5. package/dist/index.full.min.mjs.map +1 -1
  6. package/dist/index.full.mjs +253 -215
  7. package/dist/locale/af.js +1 -1
  8. package/dist/locale/af.min.js +1 -1
  9. package/dist/locale/af.min.mjs +1 -1
  10. package/dist/locale/af.mjs +1 -1
  11. package/dist/locale/ar.js +1 -1
  12. package/dist/locale/ar.min.js +1 -1
  13. package/dist/locale/ar.min.mjs +1 -1
  14. package/dist/locale/ar.mjs +1 -1
  15. package/dist/locale/az.js +1 -1
  16. package/dist/locale/az.min.js +1 -1
  17. package/dist/locale/az.min.mjs +1 -1
  18. package/dist/locale/az.mjs +1 -1
  19. package/dist/locale/bg.js +1 -1
  20. package/dist/locale/bg.min.js +1 -1
  21. package/dist/locale/bg.min.mjs +1 -1
  22. package/dist/locale/bg.mjs +1 -1
  23. package/dist/locale/bn.js +1 -1
  24. package/dist/locale/bn.min.js +1 -1
  25. package/dist/locale/bn.min.mjs +1 -1
  26. package/dist/locale/bn.mjs +1 -1
  27. package/dist/locale/ca.js +1 -1
  28. package/dist/locale/ca.min.js +1 -1
  29. package/dist/locale/ca.min.mjs +1 -1
  30. package/dist/locale/ca.mjs +1 -1
  31. package/dist/locale/cs.js +1 -1
  32. package/dist/locale/cs.min.js +1 -1
  33. package/dist/locale/cs.min.mjs +1 -1
  34. package/dist/locale/cs.mjs +1 -1
  35. package/dist/locale/da.js +1 -1
  36. package/dist/locale/da.min.js +1 -1
  37. package/dist/locale/da.min.mjs +1 -1
  38. package/dist/locale/da.mjs +1 -1
  39. package/dist/locale/de.js +1 -1
  40. package/dist/locale/de.min.js +1 -1
  41. package/dist/locale/de.min.mjs +1 -1
  42. package/dist/locale/de.mjs +1 -1
  43. package/dist/locale/el.js +1 -1
  44. package/dist/locale/el.min.js +1 -1
  45. package/dist/locale/el.min.mjs +1 -1
  46. package/dist/locale/el.mjs +1 -1
  47. package/dist/locale/en.js +1 -1
  48. package/dist/locale/en.min.js +1 -1
  49. package/dist/locale/en.min.mjs +1 -1
  50. package/dist/locale/en.mjs +1 -1
  51. package/dist/locale/eo.js +1 -1
  52. package/dist/locale/eo.min.js +1 -1
  53. package/dist/locale/eo.min.mjs +1 -1
  54. package/dist/locale/eo.mjs +1 -1
  55. package/dist/locale/es.js +1 -1
  56. package/dist/locale/es.min.js +1 -1
  57. package/dist/locale/es.min.mjs +1 -1
  58. package/dist/locale/es.mjs +1 -1
  59. package/dist/locale/et.js +1 -1
  60. package/dist/locale/et.min.js +1 -1
  61. package/dist/locale/et.min.mjs +1 -1
  62. package/dist/locale/et.mjs +1 -1
  63. package/dist/locale/eu.js +1 -1
  64. package/dist/locale/eu.min.js +1 -1
  65. package/dist/locale/eu.min.mjs +1 -1
  66. package/dist/locale/eu.mjs +1 -1
  67. package/dist/locale/fa.js +1 -1
  68. package/dist/locale/fa.min.js +1 -1
  69. package/dist/locale/fa.min.mjs +1 -1
  70. package/dist/locale/fa.mjs +1 -1
  71. package/dist/locale/fi.js +1 -1
  72. package/dist/locale/fi.min.js +1 -1
  73. package/dist/locale/fi.min.mjs +1 -1
  74. package/dist/locale/fi.mjs +1 -1
  75. package/dist/locale/fr.js +1 -1
  76. package/dist/locale/fr.min.js +1 -1
  77. package/dist/locale/fr.min.mjs +1 -1
  78. package/dist/locale/fr.mjs +1 -1
  79. package/dist/locale/he.js +1 -1
  80. package/dist/locale/he.min.js +1 -1
  81. package/dist/locale/he.min.mjs +1 -1
  82. package/dist/locale/he.mjs +1 -1
  83. package/dist/locale/hr.js +1 -1
  84. package/dist/locale/hr.min.js +1 -1
  85. package/dist/locale/hr.min.mjs +1 -1
  86. package/dist/locale/hr.mjs +1 -1
  87. package/dist/locale/hu.js +1 -1
  88. package/dist/locale/hu.min.js +1 -1
  89. package/dist/locale/hu.min.mjs +1 -1
  90. package/dist/locale/hu.mjs +1 -1
  91. package/dist/locale/hy-am.js +1 -1
  92. package/dist/locale/hy-am.min.js +1 -1
  93. package/dist/locale/hy-am.min.mjs +1 -1
  94. package/dist/locale/hy-am.mjs +1 -1
  95. package/dist/locale/id.js +1 -1
  96. package/dist/locale/id.min.js +1 -1
  97. package/dist/locale/id.min.mjs +1 -1
  98. package/dist/locale/id.mjs +1 -1
  99. package/dist/locale/it.js +1 -1
  100. package/dist/locale/it.min.js +1 -1
  101. package/dist/locale/it.min.mjs +1 -1
  102. package/dist/locale/it.mjs +1 -1
  103. package/dist/locale/ja.js +1 -1
  104. package/dist/locale/ja.min.js +1 -1
  105. package/dist/locale/ja.min.mjs +1 -1
  106. package/dist/locale/ja.mjs +1 -1
  107. package/dist/locale/kk.js +1 -1
  108. package/dist/locale/kk.min.js +1 -1
  109. package/dist/locale/kk.min.mjs +1 -1
  110. package/dist/locale/kk.mjs +1 -1
  111. package/dist/locale/km.js +1 -1
  112. package/dist/locale/km.min.js +1 -1
  113. package/dist/locale/km.min.mjs +1 -1
  114. package/dist/locale/km.mjs +1 -1
  115. package/dist/locale/ko.js +1 -1
  116. package/dist/locale/ko.min.js +1 -1
  117. package/dist/locale/ko.min.mjs +1 -1
  118. package/dist/locale/ko.mjs +1 -1
  119. package/dist/locale/ku.js +1 -1
  120. package/dist/locale/ku.min.js +1 -1
  121. package/dist/locale/ku.min.mjs +1 -1
  122. package/dist/locale/ku.mjs +1 -1
  123. package/dist/locale/ky.js +1 -1
  124. package/dist/locale/ky.min.js +1 -1
  125. package/dist/locale/ky.min.mjs +1 -1
  126. package/dist/locale/ky.mjs +1 -1
  127. package/dist/locale/lt.js +1 -1
  128. package/dist/locale/lt.min.js +1 -1
  129. package/dist/locale/lt.min.mjs +1 -1
  130. package/dist/locale/lt.mjs +1 -1
  131. package/dist/locale/lv.js +1 -1
  132. package/dist/locale/lv.min.js +1 -1
  133. package/dist/locale/lv.min.mjs +1 -1
  134. package/dist/locale/lv.mjs +1 -1
  135. package/dist/locale/mg.js +1 -1
  136. package/dist/locale/mg.min.js +1 -1
  137. package/dist/locale/mg.min.mjs +1 -1
  138. package/dist/locale/mg.mjs +1 -1
  139. package/dist/locale/mn.js +1 -1
  140. package/dist/locale/mn.min.js +1 -1
  141. package/dist/locale/mn.min.mjs +1 -1
  142. package/dist/locale/mn.mjs +1 -1
  143. package/dist/locale/nb-no.js +1 -1
  144. package/dist/locale/nb-no.min.js +1 -1
  145. package/dist/locale/nb-no.min.mjs +1 -1
  146. package/dist/locale/nb-no.mjs +1 -1
  147. package/dist/locale/nl.js +1 -1
  148. package/dist/locale/nl.min.js +1 -1
  149. package/dist/locale/nl.min.mjs +1 -1
  150. package/dist/locale/nl.mjs +1 -1
  151. package/dist/locale/pa.js +1 -1
  152. package/dist/locale/pa.min.js +1 -1
  153. package/dist/locale/pa.min.mjs +1 -1
  154. package/dist/locale/pa.mjs +1 -1
  155. package/dist/locale/pl.js +1 -1
  156. package/dist/locale/pl.min.js +1 -1
  157. package/dist/locale/pl.min.mjs +1 -1
  158. package/dist/locale/pl.mjs +1 -1
  159. package/dist/locale/pt-br.js +1 -1
  160. package/dist/locale/pt-br.min.js +1 -1
  161. package/dist/locale/pt-br.min.mjs +1 -1
  162. package/dist/locale/pt-br.mjs +1 -1
  163. package/dist/locale/pt.js +1 -1
  164. package/dist/locale/pt.min.js +1 -1
  165. package/dist/locale/pt.min.mjs +1 -1
  166. package/dist/locale/pt.mjs +1 -1
  167. package/dist/locale/ro.js +1 -1
  168. package/dist/locale/ro.min.js +1 -1
  169. package/dist/locale/ro.min.mjs +1 -1
  170. package/dist/locale/ro.mjs +1 -1
  171. package/dist/locale/ru.js +1 -1
  172. package/dist/locale/ru.min.js +1 -1
  173. package/dist/locale/ru.min.mjs +1 -1
  174. package/dist/locale/ru.mjs +1 -1
  175. package/dist/locale/sk.js +1 -1
  176. package/dist/locale/sk.min.js +1 -1
  177. package/dist/locale/sk.min.mjs +1 -1
  178. package/dist/locale/sk.mjs +1 -1
  179. package/dist/locale/sl.js +1 -1
  180. package/dist/locale/sl.min.js +1 -1
  181. package/dist/locale/sl.min.mjs +1 -1
  182. package/dist/locale/sl.mjs +1 -1
  183. package/dist/locale/sr.js +1 -1
  184. package/dist/locale/sr.min.js +1 -1
  185. package/dist/locale/sr.min.mjs +1 -1
  186. package/dist/locale/sr.mjs +1 -1
  187. package/dist/locale/sv.js +1 -1
  188. package/dist/locale/sv.min.js +1 -1
  189. package/dist/locale/sv.min.mjs +1 -1
  190. package/dist/locale/sv.mjs +1 -1
  191. package/dist/locale/ta.js +1 -1
  192. package/dist/locale/ta.min.js +1 -1
  193. package/dist/locale/ta.min.mjs +1 -1
  194. package/dist/locale/ta.mjs +1 -1
  195. package/dist/locale/th.js +1 -1
  196. package/dist/locale/th.min.js +1 -1
  197. package/dist/locale/th.min.mjs +1 -1
  198. package/dist/locale/th.mjs +1 -1
  199. package/dist/locale/tk.js +1 -1
  200. package/dist/locale/tk.min.js +1 -1
  201. package/dist/locale/tk.min.mjs +1 -1
  202. package/dist/locale/tk.mjs +1 -1
  203. package/dist/locale/tr.js +1 -1
  204. package/dist/locale/tr.min.js +1 -1
  205. package/dist/locale/tr.min.mjs +1 -1
  206. package/dist/locale/tr.mjs +1 -1
  207. package/dist/locale/ug-cn.js +1 -1
  208. package/dist/locale/ug-cn.min.js +1 -1
  209. package/dist/locale/ug-cn.min.mjs +1 -1
  210. package/dist/locale/ug-cn.mjs +1 -1
  211. package/dist/locale/uk.js +1 -1
  212. package/dist/locale/uk.min.js +1 -1
  213. package/dist/locale/uk.min.mjs +1 -1
  214. package/dist/locale/uk.mjs +1 -1
  215. package/dist/locale/uz-uz.js +1 -1
  216. package/dist/locale/uz-uz.min.js +1 -1
  217. package/dist/locale/uz-uz.min.mjs +1 -1
  218. package/dist/locale/uz-uz.mjs +1 -1
  219. package/dist/locale/vi.js +1 -1
  220. package/dist/locale/vi.min.js +1 -1
  221. package/dist/locale/vi.min.mjs +1 -1
  222. package/dist/locale/vi.mjs +1 -1
  223. package/dist/locale/zh-cn.js +1 -1
  224. package/dist/locale/zh-cn.min.js +1 -1
  225. package/dist/locale/zh-cn.min.mjs +1 -1
  226. package/dist/locale/zh-cn.mjs +1 -1
  227. package/dist/locale/zh-tw.js +1 -1
  228. package/dist/locale/zh-tw.min.js +1 -1
  229. package/dist/locale/zh-tw.min.mjs +1 -1
  230. package/dist/locale/zh-tw.mjs +1 -1
  231. package/es/components/carousel/index.d.ts +18 -34
  232. package/es/components/carousel/index.mjs.map +1 -1
  233. package/es/components/carousel/src/carousel.d.ts +0 -2
  234. package/es/components/carousel/src/carousel.mjs.map +1 -1
  235. package/es/components/carousel/src/carousel.vue.d.ts +66 -84
  236. package/es/components/carousel/src/carousel2.mjs +40 -207
  237. package/es/components/carousel/src/carousel2.mjs.map +1 -1
  238. package/es/components/carousel/src/instance.d.ts +2 -0
  239. package/es/components/carousel/src/instance.mjs +2 -0
  240. package/es/components/carousel/src/instance.mjs.map +1 -0
  241. package/es/components/carousel/src/use-carousel.d.ts +21 -0
  242. package/es/components/carousel/src/use-carousel.mjs +210 -0
  243. package/es/components/carousel/src/use-carousel.mjs.map +1 -0
  244. package/es/version.d.ts +1 -1
  245. package/es/version.mjs +1 -1
  246. package/es/version.mjs.map +1 -1
  247. package/lib/components/carousel/index.d.ts +18 -34
  248. package/lib/components/carousel/index.js.map +1 -1
  249. package/lib/components/carousel/src/carousel.d.ts +0 -2
  250. package/lib/components/carousel/src/carousel.js.map +1 -1
  251. package/lib/components/carousel/src/carousel.vue.d.ts +66 -84
  252. package/lib/components/carousel/src/carousel2.js +42 -209
  253. package/lib/components/carousel/src/carousel2.js.map +1 -1
  254. package/lib/components/carousel/src/instance.d.ts +2 -0
  255. package/lib/components/carousel/src/instance.js +3 -0
  256. package/lib/components/carousel/src/instance.js.map +1 -0
  257. package/lib/components/carousel/src/use-carousel.d.ts +21 -0
  258. package/lib/components/carousel/src/use-carousel.js +214 -0
  259. package/lib/components/carousel/src/use-carousel.js.map +1 -0
  260. package/lib/version.d.ts +1 -1
  261. package/lib/version.js +1 -1
  262. package/lib/version.js.map +1 -1
  263. package/package.json +2 -2
  264. package/web-types.json +1 -1
@@ -1,4 +1,4 @@
1
- /*! Element Plus v0.0.20221023 */
1
+ /*! Element Plus v0.0.20221024 */
2
2
 
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) :
@@ -11072,7 +11072,7 @@
11072
11072
  };
11073
11073
  };
11074
11074
 
11075
- const version$1 = "0.0.20221023";
11075
+ const version$1 = "0.0.20221024";
11076
11076
 
11077
11077
  const makeInstaller = (components = []) => {
11078
11078
  const install = (app, options) => {
@@ -11121,9 +11121,9 @@
11121
11121
  return target;
11122
11122
  };
11123
11123
 
11124
- const COMPONENT_NAME$k = "ElAffix";
11124
+ const COMPONENT_NAME$l = "ElAffix";
11125
11125
  const __default__$1w = vue.defineComponent({
11126
- name: COMPONENT_NAME$k
11126
+ name: COMPONENT_NAME$l
11127
11127
  });
11128
11128
  const _sfc_main$2f = /* @__PURE__ */ vue.defineComponent({
11129
11129
  ...__default__$1w,
@@ -11199,7 +11199,7 @@
11199
11199
  if (props.target) {
11200
11200
  target.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
11201
11201
  if (!target.value)
11202
- throwError(COMPONENT_NAME$k, `Target is not existed: ${props.target}`);
11202
+ throwError(COMPONENT_NAME$l, `Target is not existed: ${props.target}`);
11203
11203
  } else {
11204
11204
  target.value = document.documentElement;
11205
11205
  }
@@ -11580,7 +11580,7 @@
11580
11580
 
11581
11581
  const _hoisted_1$13 = ["role"];
11582
11582
  const _hoisted_2$G = ["id", "type", "disabled", "formatter", "parser", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form"];
11583
- const _hoisted_3$l = ["id", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form"];
11583
+ const _hoisted_3$k = ["id", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form"];
11584
11584
  const __default__$1t = vue.defineComponent({
11585
11585
  name: "ElInput",
11586
11586
  inheritAttrs: false
@@ -11971,7 +11971,7 @@
11971
11971
  onBlur: handleBlur,
11972
11972
  onChange: handleChange,
11973
11973
  onKeydown: handleKeydown
11974
- }), null, 16, _hoisted_3$l),
11974
+ }), null, 16, _hoisted_3$k),
11975
11975
  vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
11976
11976
  key: 0,
11977
11977
  style: vue.normalizeStyle(countStyle.value),
@@ -12031,7 +12031,7 @@
12031
12031
  always: Boolean
12032
12032
  });
12033
12033
 
12034
- const COMPONENT_NAME$j = "Thumb";
12034
+ const COMPONENT_NAME$k = "Thumb";
12035
12035
  const _sfc_main$2b = /* @__PURE__ */ vue.defineComponent({
12036
12036
  __name: "thumb",
12037
12037
  props: thumbProps,
@@ -12040,7 +12040,7 @@
12040
12040
  const scrollbar = vue.inject(scrollbarContextKey);
12041
12041
  const ns = useNamespace("scrollbar");
12042
12042
  if (!scrollbar)
12043
- throwError(COMPONENT_NAME$j, "can not inject scrollbar context");
12043
+ throwError(COMPONENT_NAME$k, "can not inject scrollbar context");
12044
12044
  const instance = vue.ref();
12045
12045
  const thumb = vue.ref();
12046
12046
  const thumbState = vue.ref({});
@@ -13997,10 +13997,10 @@
13997
13997
 
13998
13998
  const _hoisted_1$11 = ["aria-expanded", "aria-owns"];
13999
13999
  const _hoisted_2$E = { key: 0 };
14000
- const _hoisted_3$k = ["id", "aria-selected", "onClick"];
14001
- const COMPONENT_NAME$i = "ElAutocomplete";
14000
+ const _hoisted_3$j = ["id", "aria-selected", "onClick"];
14001
+ const COMPONENT_NAME$j = "ElAutocomplete";
14002
14002
  const __default__$1k = vue.defineComponent({
14003
- name: COMPONENT_NAME$i,
14003
+ name: COMPONENT_NAME$j,
14004
14004
  inheritAttrs: false
14005
14005
  });
14006
14006
  const _sfc_main$20 = /* @__PURE__ */ vue.defineComponent({
@@ -14062,7 +14062,7 @@
14062
14062
  suggestions.value = suggestionList;
14063
14063
  highlightedIndex.value = props.highlightFirstItem ? 0 : -1;
14064
14064
  } else {
14065
- throwError(COMPONENT_NAME$i, "autocomplete suggestions must be an array");
14065
+ throwError(COMPONENT_NAME$j, "autocomplete suggestions must be an array");
14066
14066
  }
14067
14067
  };
14068
14068
  loading.value = true;
@@ -14260,7 +14260,7 @@
14260
14260
  vue.renderSlot(_ctx.$slots, "default", { item }, () => [
14261
14261
  vue.createTextVNode(vue.toDisplayString(item[_ctx.valueKey]), 1)
14262
14262
  ])
14263
- ], 10, _hoisted_3$k);
14263
+ ], 10, _hoisted_3$j);
14264
14264
  }), 128))
14265
14265
  ]),
14266
14266
  _: 3
@@ -14498,9 +14498,9 @@
14498
14498
  };
14499
14499
  };
14500
14500
 
14501
- const COMPONENT_NAME$h = "ElBacktop";
14501
+ const COMPONENT_NAME$i = "ElBacktop";
14502
14502
  const __default__$1i = vue.defineComponent({
14503
- name: COMPONENT_NAME$h
14503
+ name: COMPONENT_NAME$i
14504
14504
  });
14505
14505
  const _sfc_main$1_ = /* @__PURE__ */ vue.defineComponent({
14506
14506
  ...__default__$1i,
@@ -14509,7 +14509,7 @@
14509
14509
  setup(__props, { emit }) {
14510
14510
  const props = __props;
14511
14511
  const ns = useNamespace("backtop");
14512
- const { handleClick, visible } = useBackTop(props, emit, COMPONENT_NAME$h);
14512
+ const { handleClick, visible } = useBackTop(props, emit, COMPONENT_NAME$i);
14513
14513
  const backTopStyle = vue.computed(() => ({
14514
14514
  right: `${props.right}px`,
14515
14515
  bottom: `${props.bottom}px`
@@ -18525,9 +18525,9 @@
18525
18525
  [INPUT_EVENT]: (value) => isDate(value)
18526
18526
  };
18527
18527
 
18528
- const COMPONENT_NAME$g = "ElCalendar";
18528
+ const COMPONENT_NAME$h = "ElCalendar";
18529
18529
  const __default__$1a = vue.defineComponent({
18530
- name: COMPONENT_NAME$g
18530
+ name: COMPONENT_NAME$h
18531
18531
  });
18532
18532
  const _sfc_main$1P = /* @__PURE__ */ vue.defineComponent({
18533
18533
  ...__default__$1a,
@@ -18760,12 +18760,207 @@
18760
18760
  change: (current, prev) => [current, prev].every(isNumber)
18761
18761
  };
18762
18762
 
18763
- const _hoisted_1$V = ["onMouseenter", "onMouseleave"];
18764
- const _hoisted_2$A = ["onMouseenter", "onClick"];
18765
- const _hoisted_3$j = { key: 0 };
18766
18763
  const THROTTLE_TIME = 300;
18764
+ const useCarousel = (props, emit, componentName) => {
18765
+ const {
18766
+ children: items,
18767
+ addChild: addItem,
18768
+ removeChild: removeItem
18769
+ } = useOrderedChildren(vue.getCurrentInstance(), "ElCarouselItem");
18770
+ const activeIndex = vue.ref(-1);
18771
+ const timer = vue.ref(null);
18772
+ const hover = vue.ref(false);
18773
+ const root = vue.ref();
18774
+ const arrowDisplay = vue.computed(() => props.arrow !== "never" && !vue.unref(isVertical));
18775
+ const hasLabel = vue.computed(() => {
18776
+ return items.value.some((item) => item.props.label.toString().length > 0);
18777
+ });
18778
+ const isCardType = vue.computed(() => props.type === "card");
18779
+ const isVertical = vue.computed(() => props.direction === "vertical");
18780
+ const throttledArrowClick = throttle((index) => {
18781
+ setActiveItem(index);
18782
+ }, THROTTLE_TIME, { trailing: true });
18783
+ const throttledIndicatorHover = throttle((index) => {
18784
+ handleIndicatorHover(index);
18785
+ }, THROTTLE_TIME);
18786
+ function pauseTimer() {
18787
+ if (timer.value) {
18788
+ clearInterval(timer.value);
18789
+ timer.value = null;
18790
+ }
18791
+ }
18792
+ function startTimer() {
18793
+ if (props.interval <= 0 || !props.autoplay || timer.value)
18794
+ return;
18795
+ timer.value = setInterval(() => playSlides(), props.interval);
18796
+ }
18797
+ const playSlides = () => {
18798
+ if (activeIndex.value < items.value.length - 1) {
18799
+ activeIndex.value = activeIndex.value + 1;
18800
+ } else if (props.loop) {
18801
+ activeIndex.value = 0;
18802
+ }
18803
+ };
18804
+ function setActiveItem(index) {
18805
+ if (isString(index)) {
18806
+ const filteredItems = items.value.filter((item) => item.props.name === index);
18807
+ if (filteredItems.length > 0) {
18808
+ index = items.value.indexOf(filteredItems[0]);
18809
+ }
18810
+ }
18811
+ index = Number(index);
18812
+ if (Number.isNaN(index) || index !== Math.floor(index)) {
18813
+ return;
18814
+ }
18815
+ const itemCount = items.value.length;
18816
+ const oldIndex = activeIndex.value;
18817
+ if (index < 0) {
18818
+ activeIndex.value = props.loop ? itemCount - 1 : 0;
18819
+ } else if (index >= itemCount) {
18820
+ activeIndex.value = props.loop ? 0 : itemCount - 1;
18821
+ } else {
18822
+ activeIndex.value = index;
18823
+ }
18824
+ if (oldIndex === activeIndex.value) {
18825
+ resetItemPosition(oldIndex);
18826
+ }
18827
+ resetTimer();
18828
+ }
18829
+ function resetItemPosition(oldIndex) {
18830
+ items.value.forEach((item, index) => {
18831
+ item.translateItem(index, activeIndex.value, oldIndex);
18832
+ });
18833
+ }
18834
+ function itemInStage(item, index) {
18835
+ var _a, _b, _c, _d;
18836
+ const _items = vue.unref(items);
18837
+ const itemCount = _items.length;
18838
+ if (itemCount === 0 || !item.states.inStage)
18839
+ return false;
18840
+ const nextItemIndex = index + 1;
18841
+ const prevItemIndex = index - 1;
18842
+ const lastItemIndex = itemCount - 1;
18843
+ const isLastItemActive = _items[lastItemIndex].states.active;
18844
+ const isFirstItemActive = _items[0].states.active;
18845
+ const isNextItemActive = (_b = (_a = _items[nextItemIndex]) == null ? void 0 : _a.states) == null ? void 0 : _b.active;
18846
+ const isPrevItemActive = (_d = (_c = _items[prevItemIndex]) == null ? void 0 : _c.states) == null ? void 0 : _d.active;
18847
+ if (index === lastItemIndex && isFirstItemActive || isNextItemActive) {
18848
+ return "left";
18849
+ } else if (index === 0 && isLastItemActive || isPrevItemActive) {
18850
+ return "right";
18851
+ }
18852
+ return false;
18853
+ }
18854
+ function handleMouseEnter() {
18855
+ hover.value = true;
18856
+ if (props.pauseOnHover) {
18857
+ pauseTimer();
18858
+ }
18859
+ }
18860
+ function handleMouseLeave() {
18861
+ hover.value = false;
18862
+ startTimer();
18863
+ }
18864
+ function handleButtonEnter(arrow) {
18865
+ if (vue.unref(isVertical))
18866
+ return;
18867
+ items.value.forEach((item, index) => {
18868
+ if (arrow === itemInStage(item, index)) {
18869
+ item.states.hover = true;
18870
+ }
18871
+ });
18872
+ }
18873
+ function handleButtonLeave() {
18874
+ if (vue.unref(isVertical))
18875
+ return;
18876
+ items.value.forEach((item) => {
18877
+ item.states.hover = false;
18878
+ });
18879
+ }
18880
+ function handleIndicatorClick(index) {
18881
+ activeIndex.value = index;
18882
+ }
18883
+ function handleIndicatorHover(index) {
18884
+ if (props.trigger === "hover" && index !== activeIndex.value) {
18885
+ activeIndex.value = index;
18886
+ }
18887
+ }
18888
+ function prev() {
18889
+ setActiveItem(activeIndex.value - 1);
18890
+ }
18891
+ function next() {
18892
+ setActiveItem(activeIndex.value + 1);
18893
+ }
18894
+ function resetTimer() {
18895
+ pauseTimer();
18896
+ startTimer();
18897
+ }
18898
+ vue.watch(() => activeIndex.value, (current, prev2) => {
18899
+ resetItemPosition(prev2);
18900
+ if (prev2 > -1) {
18901
+ emit("change", current, prev2);
18902
+ }
18903
+ });
18904
+ vue.watch(() => props.autoplay, (autoplay) => {
18905
+ autoplay ? startTimer() : pauseTimer();
18906
+ });
18907
+ vue.watch(() => props.loop, () => {
18908
+ setActiveItem(activeIndex.value);
18909
+ });
18910
+ vue.watch(() => props.interval, () => {
18911
+ resetTimer();
18912
+ });
18913
+ vue.watch(() => items.value, () => {
18914
+ if (items.value.length > 0)
18915
+ setActiveItem(props.initialIndex);
18916
+ });
18917
+ const resizeObserver = vue.shallowRef();
18918
+ vue.onMounted(() => {
18919
+ resizeObserver.value = useResizeObserver(root.value, () => {
18920
+ resetItemPosition();
18921
+ });
18922
+ startTimer();
18923
+ });
18924
+ vue.onBeforeUnmount(() => {
18925
+ pauseTimer();
18926
+ if (root.value && resizeObserver.value)
18927
+ resizeObserver.value.stop();
18928
+ });
18929
+ vue.provide(carouselContextKey, {
18930
+ root,
18931
+ isCardType,
18932
+ isVertical,
18933
+ items,
18934
+ loop: props.loop,
18935
+ addItem,
18936
+ removeItem,
18937
+ setActiveItem
18938
+ });
18939
+ return {
18940
+ activeIndex,
18941
+ arrowDisplay,
18942
+ hasLabel,
18943
+ hover,
18944
+ isCardType,
18945
+ items,
18946
+ handleButtonEnter,
18947
+ handleButtonLeave,
18948
+ handleIndicatorClick,
18949
+ handleMouseEnter,
18950
+ handleMouseLeave,
18951
+ setActiveItem,
18952
+ prev,
18953
+ next,
18954
+ throttledArrowClick,
18955
+ throttledIndicatorHover
18956
+ };
18957
+ };
18958
+
18959
+ const _hoisted_1$V = ["onMouseenter", "onClick"];
18960
+ const _hoisted_2$A = { key: 0 };
18961
+ const COMPONENT_NAME$g = "ElCarousel";
18767
18962
  const __default__$18 = vue.defineComponent({
18768
- name: "ElCarousel"
18963
+ name: COMPONENT_NAME$g
18769
18964
  });
18770
18965
  const _sfc_main$1N = /* @__PURE__ */ vue.defineComponent({
18771
18966
  ...__default__$18,
@@ -18773,20 +18968,25 @@
18773
18968
  emits: carouselEmits,
18774
18969
  setup(__props, { expose, emit }) {
18775
18970
  const props = __props;
18776
- const ns = useNamespace("carousel");
18777
18971
  const {
18778
- children: items,
18779
- addChild: addItem,
18780
- removeChild: removeItem
18781
- } = useOrderedChildren(vue.getCurrentInstance(), "ElCarouselItem");
18782
- const activeIndex = vue.ref(-1);
18783
- const timer = vue.ref(null);
18784
- const hover = vue.ref(false);
18785
- const root = vue.ref();
18786
- const arrowDisplay = vue.computed(() => props.arrow !== "never" && !vue.unref(isVertical));
18787
- const hasLabel = vue.computed(() => {
18788
- return items.value.some((item) => item.props.label.toString().length > 0);
18789
- });
18972
+ activeIndex,
18973
+ arrowDisplay,
18974
+ hasLabel,
18975
+ hover,
18976
+ isCardType,
18977
+ items,
18978
+ handleButtonEnter,
18979
+ handleButtonLeave,
18980
+ handleIndicatorClick,
18981
+ handleMouseEnter,
18982
+ handleMouseLeave,
18983
+ setActiveItem,
18984
+ prev,
18985
+ next,
18986
+ throttledArrowClick,
18987
+ throttledIndicatorHover
18988
+ } = useCarousel(props, emit);
18989
+ const ns = useNamespace("carousel");
18790
18990
  const carouselClasses = vue.computed(() => {
18791
18991
  const classes = [ns.b(), ns.m(props.direction)];
18792
18992
  if (vue.unref(isCardType)) {
@@ -18796,7 +18996,7 @@
18796
18996
  });
18797
18997
  const indicatorsClasses = vue.computed(() => {
18798
18998
  const classes = [ns.e("indicators"), ns.em("indicators", props.direction)];
18799
- if (hasLabel.value) {
18999
+ if (vue.unref(hasLabel)) {
18800
19000
  classes.push(ns.em("indicators", "labels"));
18801
19001
  }
18802
19002
  if (props.indicatorPosition === "outside" || vue.unref(isCardType)) {
@@ -18804,167 +19004,6 @@
18804
19004
  }
18805
19005
  return classes;
18806
19006
  });
18807
- const isCardType = vue.computed(() => props.type === "card");
18808
- const isVertical = vue.computed(() => props.direction === "vertical");
18809
- const throttledArrowClick = throttle((index) => {
18810
- setActiveItem(index);
18811
- }, THROTTLE_TIME, { trailing: true });
18812
- const throttledIndicatorHover = throttle((index) => {
18813
- handleIndicatorHover(index);
18814
- }, THROTTLE_TIME);
18815
- function pauseTimer() {
18816
- if (timer.value) {
18817
- clearInterval(timer.value);
18818
- timer.value = null;
18819
- }
18820
- }
18821
- function startTimer() {
18822
- if (props.interval <= 0 || !props.autoplay || timer.value)
18823
- return;
18824
- timer.value = setInterval(() => playSlides(), props.interval);
18825
- }
18826
- const playSlides = () => {
18827
- if (activeIndex.value < items.value.length - 1) {
18828
- activeIndex.value = activeIndex.value + 1;
18829
- } else if (props.loop) {
18830
- activeIndex.value = 0;
18831
- }
18832
- };
18833
- function setActiveItem(index) {
18834
- if (isString(index)) {
18835
- const filteredItems = items.value.filter((item) => item.props.name === index);
18836
- if (filteredItems.length > 0) {
18837
- index = items.value.indexOf(filteredItems[0]);
18838
- }
18839
- }
18840
- index = Number(index);
18841
- if (Number.isNaN(index) || index !== Math.floor(index)) {
18842
- return;
18843
- }
18844
- const itemCount = items.value.length;
18845
- const oldIndex = activeIndex.value;
18846
- if (index < 0) {
18847
- activeIndex.value = props.loop ? itemCount - 1 : 0;
18848
- } else if (index >= itemCount) {
18849
- activeIndex.value = props.loop ? 0 : itemCount - 1;
18850
- } else {
18851
- activeIndex.value = index;
18852
- }
18853
- if (oldIndex === activeIndex.value) {
18854
- resetItemPosition(oldIndex);
18855
- }
18856
- resetTimer();
18857
- }
18858
- function resetItemPosition(oldIndex) {
18859
- items.value.forEach((item, index) => {
18860
- item.translateItem(index, activeIndex.value, oldIndex);
18861
- });
18862
- }
18863
- function itemInStage(item, index) {
18864
- var _a, _b, _c, _d;
18865
- const _items = vue.unref(items);
18866
- const itemCount = _items.length;
18867
- if (itemCount === 0 || !item.states.inStage)
18868
- return false;
18869
- const nextItemIndex = index + 1;
18870
- const prevItemIndex = index - 1;
18871
- const lastItemIndex = itemCount - 1;
18872
- const isLastItemActive = _items[lastItemIndex].states.active;
18873
- const isFirstItemActive = _items[0].states.active;
18874
- const isNextItemActive = (_b = (_a = _items[nextItemIndex]) == null ? void 0 : _a.states) == null ? void 0 : _b.active;
18875
- const isPrevItemActive = (_d = (_c = _items[prevItemIndex]) == null ? void 0 : _c.states) == null ? void 0 : _d.active;
18876
- if (index === lastItemIndex && isFirstItemActive || isNextItemActive) {
18877
- return "left";
18878
- } else if (index === 0 && isLastItemActive || isPrevItemActive) {
18879
- return "right";
18880
- }
18881
- return false;
18882
- }
18883
- function handleMouseEnter() {
18884
- hover.value = true;
18885
- if (props.pauseOnHover) {
18886
- pauseTimer();
18887
- }
18888
- }
18889
- function handleMouseLeave() {
18890
- hover.value = false;
18891
- startTimer();
18892
- }
18893
- function handleButtonEnter(arrow) {
18894
- if (vue.unref(isVertical))
18895
- return;
18896
- items.value.forEach((item, index) => {
18897
- if (arrow === itemInStage(item, index)) {
18898
- item.states.hover = true;
18899
- }
18900
- });
18901
- }
18902
- function handleButtonLeave() {
18903
- if (vue.unref(isVertical))
18904
- return;
18905
- items.value.forEach((item) => {
18906
- item.states.hover = false;
18907
- });
18908
- }
18909
- function handleIndicatorClick(index) {
18910
- activeIndex.value = index;
18911
- }
18912
- function handleIndicatorHover(index) {
18913
- if (props.trigger === "hover" && index !== activeIndex.value) {
18914
- activeIndex.value = index;
18915
- }
18916
- }
18917
- function prev() {
18918
- setActiveItem(activeIndex.value - 1);
18919
- }
18920
- function next() {
18921
- setActiveItem(activeIndex.value + 1);
18922
- }
18923
- function resetTimer() {
18924
- pauseTimer();
18925
- startTimer();
18926
- }
18927
- vue.watch(() => activeIndex.value, (current, prev2) => {
18928
- resetItemPosition(prev2);
18929
- if (prev2 > -1) {
18930
- emit("change", current, prev2);
18931
- }
18932
- });
18933
- vue.watch(() => props.autoplay, (autoplay) => {
18934
- autoplay ? startTimer() : pauseTimer();
18935
- });
18936
- vue.watch(() => props.loop, () => {
18937
- setActiveItem(activeIndex.value);
18938
- });
18939
- vue.watch(() => props.interval, () => {
18940
- resetTimer();
18941
- });
18942
- vue.watch(() => items.value, () => {
18943
- if (items.value.length > 0)
18944
- setActiveItem(props.initialIndex);
18945
- });
18946
- const resizeObserver = vue.shallowRef();
18947
- vue.onMounted(() => {
18948
- resizeObserver.value = useResizeObserver(root.value, () => {
18949
- resetItemPosition();
18950
- });
18951
- startTimer();
18952
- });
18953
- vue.onBeforeUnmount(() => {
18954
- pauseTimer();
18955
- if (root.value && resizeObserver.value)
18956
- resizeObserver.value.stop();
18957
- });
18958
- vue.provide(carouselContextKey, {
18959
- root,
18960
- isCardType,
18961
- isVertical,
18962
- items,
18963
- loop: props.loop,
18964
- addItem,
18965
- removeItem,
18966
- setActiveItem
18967
- });
18968
19007
  expose({
18969
19008
  setActiveItem,
18970
19009
  prev,
@@ -18972,11 +19011,10 @@
18972
19011
  });
18973
19012
  return (_ctx, _cache) => {
18974
19013
  return vue.openBlock(), vue.createElementBlock("div", {
18975
- ref_key: "root",
18976
- ref: root,
19014
+ ref: "root",
18977
19015
  class: vue.normalizeClass(vue.unref(carouselClasses)),
18978
- onMouseenter: vue.withModifiers(handleMouseEnter, ["stop"]),
18979
- onMouseleave: vue.withModifiers(handleMouseLeave, ["stop"])
19016
+ onMouseenter: _cache[6] || (_cache[6] = vue.withModifiers((...args) => vue.unref(handleMouseEnter) && vue.unref(handleMouseEnter)(...args), ["stop"])),
19017
+ onMouseleave: _cache[7] || (_cache[7] = vue.withModifiers((...args) => vue.unref(handleMouseLeave) && vue.unref(handleMouseLeave)(...args), ["stop"]))
18980
19018
  }, [
18981
19019
  vue.createElementVNode("div", {
18982
19020
  class: vue.normalizeClass(vue.unref(ns).e("container")),
@@ -18991,9 +19029,9 @@
18991
19029
  vue.withDirectives(vue.createElementVNode("button", {
18992
19030
  type: "button",
18993
19031
  class: vue.normalizeClass([vue.unref(ns).e("arrow"), vue.unref(ns).em("arrow", "left")]),
18994
- onMouseenter: _cache[0] || (_cache[0] = ($event) => handleButtonEnter("left")),
18995
- onMouseleave: handleButtonLeave,
18996
- onClick: _cache[1] || (_cache[1] = vue.withModifiers(($event) => vue.unref(throttledArrowClick)(activeIndex.value - 1), ["stop"]))
19032
+ onMouseenter: _cache[0] || (_cache[0] = ($event) => vue.unref(handleButtonEnter)("left")),
19033
+ onMouseleave: _cache[1] || (_cache[1] = (...args) => vue.unref(handleButtonLeave) && vue.unref(handleButtonLeave)(...args)),
19034
+ onClick: _cache[2] || (_cache[2] = vue.withModifiers(($event) => vue.unref(throttledArrowClick)(vue.unref(activeIndex) - 1), ["stop"]))
18997
19035
  }, [
18998
19036
  vue.createVNode(vue.unref(ElIcon), null, {
18999
19037
  default: vue.withCtx(() => [
@@ -19004,7 +19042,7 @@
19004
19042
  ], 34), [
19005
19043
  [
19006
19044
  vue.vShow,
19007
- (_ctx.arrow === "always" || hover.value) && (props.loop || activeIndex.value > 0)
19045
+ (_ctx.arrow === "always" || vue.unref(hover)) && (props.loop || vue.unref(activeIndex) > 0)
19008
19046
  ]
19009
19047
  ])
19010
19048
  ]),
@@ -19019,9 +19057,9 @@
19019
19057
  vue.withDirectives(vue.createElementVNode("button", {
19020
19058
  type: "button",
19021
19059
  class: vue.normalizeClass([vue.unref(ns).e("arrow"), vue.unref(ns).em("arrow", "right")]),
19022
- onMouseenter: _cache[2] || (_cache[2] = ($event) => handleButtonEnter("right")),
19023
- onMouseleave: handleButtonLeave,
19024
- onClick: _cache[3] || (_cache[3] = vue.withModifiers(($event) => vue.unref(throttledArrowClick)(activeIndex.value + 1), ["stop"]))
19060
+ onMouseenter: _cache[3] || (_cache[3] = ($event) => vue.unref(handleButtonEnter)("right")),
19061
+ onMouseleave: _cache[4] || (_cache[4] = (...args) => vue.unref(handleButtonLeave) && vue.unref(handleButtonLeave)(...args)),
19062
+ onClick: _cache[5] || (_cache[5] = vue.withModifiers(($event) => vue.unref(throttledArrowClick)(vue.unref(activeIndex) + 1), ["stop"]))
19025
19063
  }, [
19026
19064
  vue.createVNode(vue.unref(ElIcon), null, {
19027
19065
  default: vue.withCtx(() => [
@@ -19032,7 +19070,7 @@
19032
19070
  ], 34), [
19033
19071
  [
19034
19072
  vue.vShow,
19035
- (_ctx.arrow === "always" || hover.value) && (props.loop || activeIndex.value < vue.unref(items).length - 1)
19073
+ (_ctx.arrow === "always" || vue.unref(hover)) && (props.loop || vue.unref(activeIndex) < vue.unref(items).length - 1)
19036
19074
  ]
19037
19075
  ])
19038
19076
  ]),
@@ -19050,20 +19088,20 @@
19050
19088
  class: vue.normalizeClass([
19051
19089
  vue.unref(ns).e("indicator"),
19052
19090
  vue.unref(ns).em("indicator", _ctx.direction),
19053
- vue.unref(ns).is("active", index === activeIndex.value)
19091
+ vue.unref(ns).is("active", index === vue.unref(activeIndex))
19054
19092
  ]),
19055
19093
  onMouseenter: ($event) => vue.unref(throttledIndicatorHover)(index),
19056
- onClick: vue.withModifiers(($event) => handleIndicatorClick(index), ["stop"])
19094
+ onClick: vue.withModifiers(($event) => vue.unref(handleIndicatorClick)(index), ["stop"])
19057
19095
  }, [
19058
19096
  vue.createElementVNode("button", {
19059
19097
  class: vue.normalizeClass(vue.unref(ns).e("button"))
19060
19098
  }, [
19061
- vue.unref(hasLabel) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_3$j, vue.toDisplayString(item.props.label), 1)) : vue.createCommentVNode("v-if", true)
19099
+ vue.unref(hasLabel) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$A, vue.toDisplayString(item.props.label), 1)) : vue.createCommentVNode("v-if", true)
19062
19100
  ], 2)
19063
- ], 42, _hoisted_2$A);
19101
+ ], 42, _hoisted_1$V);
19064
19102
  }), 128))
19065
19103
  ], 2)) : vue.createCommentVNode("v-if", true)
19066
- ], 42, _hoisted_1$V);
19104
+ ], 34);
19067
19105
  };
19068
19106
  }
19069
19107
  });