element-plus 2.2.11 → 2.2.12

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 (280) hide show
  1. package/README.md +0 -5
  2. package/dist/index.css +1 -1
  3. package/dist/index.full.js +60 -42
  4. package/dist/index.full.min.js +11 -11
  5. package/dist/index.full.min.js.map +1 -1
  6. package/dist/index.full.min.mjs +12 -12
  7. package/dist/index.full.min.mjs.map +1 -1
  8. package/dist/index.full.mjs +60 -42
  9. package/dist/locale/af.js +1 -1
  10. package/dist/locale/af.min.js +1 -1
  11. package/dist/locale/af.min.mjs +1 -1
  12. package/dist/locale/af.mjs +1 -1
  13. package/dist/locale/ar.js +1 -1
  14. package/dist/locale/ar.min.js +1 -1
  15. package/dist/locale/ar.min.mjs +1 -1
  16. package/dist/locale/ar.mjs +1 -1
  17. package/dist/locale/az.js +1 -1
  18. package/dist/locale/az.min.js +1 -1
  19. package/dist/locale/az.min.mjs +1 -1
  20. package/dist/locale/az.mjs +1 -1
  21. package/dist/locale/bg.js +1 -1
  22. package/dist/locale/bg.min.js +1 -1
  23. package/dist/locale/bg.min.mjs +1 -1
  24. package/dist/locale/bg.mjs +1 -1
  25. package/dist/locale/bn.js +1 -1
  26. package/dist/locale/bn.min.js +1 -1
  27. package/dist/locale/bn.min.mjs +1 -1
  28. package/dist/locale/bn.mjs +1 -1
  29. package/dist/locale/ca.js +1 -1
  30. package/dist/locale/ca.min.js +1 -1
  31. package/dist/locale/ca.min.mjs +1 -1
  32. package/dist/locale/ca.mjs +1 -1
  33. package/dist/locale/cs.js +1 -1
  34. package/dist/locale/cs.min.js +1 -1
  35. package/dist/locale/cs.min.mjs +1 -1
  36. package/dist/locale/cs.mjs +1 -1
  37. package/dist/locale/da.js +1 -1
  38. package/dist/locale/da.min.js +1 -1
  39. package/dist/locale/da.min.mjs +1 -1
  40. package/dist/locale/da.mjs +1 -1
  41. package/dist/locale/de.js +1 -1
  42. package/dist/locale/de.min.js +1 -1
  43. package/dist/locale/de.min.mjs +1 -1
  44. package/dist/locale/de.mjs +1 -1
  45. package/dist/locale/el.js +1 -1
  46. package/dist/locale/el.min.js +1 -1
  47. package/dist/locale/el.min.mjs +1 -1
  48. package/dist/locale/el.mjs +1 -1
  49. package/dist/locale/en.js +1 -1
  50. package/dist/locale/en.min.js +1 -1
  51. package/dist/locale/en.min.mjs +1 -1
  52. package/dist/locale/en.mjs +1 -1
  53. package/dist/locale/eo.js +1 -1
  54. package/dist/locale/eo.min.js +1 -1
  55. package/dist/locale/eo.min.mjs +1 -1
  56. package/dist/locale/eo.mjs +1 -1
  57. package/dist/locale/es.js +1 -1
  58. package/dist/locale/es.min.js +1 -1
  59. package/dist/locale/es.min.mjs +1 -1
  60. package/dist/locale/es.mjs +1 -1
  61. package/dist/locale/et.js +1 -1
  62. package/dist/locale/et.min.js +1 -1
  63. package/dist/locale/et.min.mjs +1 -1
  64. package/dist/locale/et.mjs +1 -1
  65. package/dist/locale/eu.js +1 -1
  66. package/dist/locale/eu.min.js +1 -1
  67. package/dist/locale/eu.min.mjs +1 -1
  68. package/dist/locale/eu.mjs +1 -1
  69. package/dist/locale/fa.js +1 -1
  70. package/dist/locale/fa.min.js +1 -1
  71. package/dist/locale/fa.min.mjs +1 -1
  72. package/dist/locale/fa.mjs +1 -1
  73. package/dist/locale/fi.js +1 -1
  74. package/dist/locale/fi.min.js +1 -1
  75. package/dist/locale/fi.min.mjs +1 -1
  76. package/dist/locale/fi.mjs +1 -1
  77. package/dist/locale/fr.js +1 -1
  78. package/dist/locale/fr.min.js +1 -1
  79. package/dist/locale/fr.min.mjs +1 -1
  80. package/dist/locale/fr.mjs +1 -1
  81. package/dist/locale/he.js +1 -1
  82. package/dist/locale/he.min.js +1 -1
  83. package/dist/locale/he.min.mjs +1 -1
  84. package/dist/locale/he.mjs +1 -1
  85. package/dist/locale/hr.js +1 -1
  86. package/dist/locale/hr.min.js +1 -1
  87. package/dist/locale/hr.min.mjs +1 -1
  88. package/dist/locale/hr.mjs +1 -1
  89. package/dist/locale/hu.js +1 -1
  90. package/dist/locale/hu.min.js +1 -1
  91. package/dist/locale/hu.min.mjs +1 -1
  92. package/dist/locale/hu.mjs +1 -1
  93. package/dist/locale/hy-am.js +1 -1
  94. package/dist/locale/hy-am.min.js +1 -1
  95. package/dist/locale/hy-am.min.mjs +1 -1
  96. package/dist/locale/hy-am.mjs +1 -1
  97. package/dist/locale/id.js +1 -1
  98. package/dist/locale/id.min.js +1 -1
  99. package/dist/locale/id.min.mjs +1 -1
  100. package/dist/locale/id.mjs +1 -1
  101. package/dist/locale/it.js +1 -1
  102. package/dist/locale/it.min.js +1 -1
  103. package/dist/locale/it.min.mjs +1 -1
  104. package/dist/locale/it.mjs +1 -1
  105. package/dist/locale/ja.js +1 -1
  106. package/dist/locale/ja.min.js +1 -1
  107. package/dist/locale/ja.min.mjs +1 -1
  108. package/dist/locale/ja.mjs +1 -1
  109. package/dist/locale/kk.js +1 -1
  110. package/dist/locale/kk.min.js +1 -1
  111. package/dist/locale/kk.min.mjs +1 -1
  112. package/dist/locale/kk.mjs +1 -1
  113. package/dist/locale/km.js +1 -1
  114. package/dist/locale/km.min.js +1 -1
  115. package/dist/locale/km.min.mjs +1 -1
  116. package/dist/locale/km.mjs +1 -1
  117. package/dist/locale/ko.js +1 -1
  118. package/dist/locale/ko.min.js +1 -1
  119. package/dist/locale/ko.min.mjs +1 -1
  120. package/dist/locale/ko.mjs +1 -1
  121. package/dist/locale/ku.js +1 -1
  122. package/dist/locale/ku.min.js +1 -1
  123. package/dist/locale/ku.min.mjs +1 -1
  124. package/dist/locale/ku.mjs +1 -1
  125. package/dist/locale/ky.js +1 -1
  126. package/dist/locale/ky.min.js +1 -1
  127. package/dist/locale/ky.min.mjs +1 -1
  128. package/dist/locale/ky.mjs +1 -1
  129. package/dist/locale/lt.js +1 -1
  130. package/dist/locale/lt.min.js +1 -1
  131. package/dist/locale/lt.min.mjs +1 -1
  132. package/dist/locale/lt.mjs +1 -1
  133. package/dist/locale/lv.js +1 -1
  134. package/dist/locale/lv.min.js +1 -1
  135. package/dist/locale/lv.min.mjs +1 -1
  136. package/dist/locale/lv.mjs +1 -1
  137. package/dist/locale/mg.js +1 -1
  138. package/dist/locale/mg.min.js +1 -1
  139. package/dist/locale/mg.min.mjs +1 -1
  140. package/dist/locale/mg.mjs +1 -1
  141. package/dist/locale/mn.js +1 -1
  142. package/dist/locale/mn.min.js +1 -1
  143. package/dist/locale/mn.min.mjs +1 -1
  144. package/dist/locale/mn.mjs +1 -1
  145. package/dist/locale/nb-no.js +1 -1
  146. package/dist/locale/nb-no.min.js +1 -1
  147. package/dist/locale/nb-no.min.mjs +1 -1
  148. package/dist/locale/nb-no.mjs +1 -1
  149. package/dist/locale/nl.js +1 -1
  150. package/dist/locale/nl.min.js +1 -1
  151. package/dist/locale/nl.min.mjs +1 -1
  152. package/dist/locale/nl.mjs +1 -1
  153. package/dist/locale/pa.js +1 -1
  154. package/dist/locale/pa.min.js +1 -1
  155. package/dist/locale/pa.min.mjs +1 -1
  156. package/dist/locale/pa.mjs +1 -1
  157. package/dist/locale/pl.js +1 -1
  158. package/dist/locale/pl.min.js +1 -1
  159. package/dist/locale/pl.min.mjs +1 -1
  160. package/dist/locale/pl.mjs +1 -1
  161. package/dist/locale/pt-br.js +1 -1
  162. package/dist/locale/pt-br.min.js +1 -1
  163. package/dist/locale/pt-br.min.mjs +1 -1
  164. package/dist/locale/pt-br.mjs +1 -1
  165. package/dist/locale/pt.js +1 -1
  166. package/dist/locale/pt.min.js +1 -1
  167. package/dist/locale/pt.min.mjs +1 -1
  168. package/dist/locale/pt.mjs +1 -1
  169. package/dist/locale/ro.js +1 -1
  170. package/dist/locale/ro.min.js +1 -1
  171. package/dist/locale/ro.min.mjs +1 -1
  172. package/dist/locale/ro.mjs +1 -1
  173. package/dist/locale/ru.js +1 -1
  174. package/dist/locale/ru.min.js +1 -1
  175. package/dist/locale/ru.min.mjs +1 -1
  176. package/dist/locale/ru.mjs +1 -1
  177. package/dist/locale/sk.js +1 -1
  178. package/dist/locale/sk.min.js +1 -1
  179. package/dist/locale/sk.min.mjs +1 -1
  180. package/dist/locale/sk.mjs +1 -1
  181. package/dist/locale/sl.js +1 -1
  182. package/dist/locale/sl.min.js +1 -1
  183. package/dist/locale/sl.min.mjs +1 -1
  184. package/dist/locale/sl.mjs +1 -1
  185. package/dist/locale/sr.js +1 -1
  186. package/dist/locale/sr.min.js +1 -1
  187. package/dist/locale/sr.min.mjs +1 -1
  188. package/dist/locale/sr.mjs +1 -1
  189. package/dist/locale/sv.js +1 -1
  190. package/dist/locale/sv.min.js +1 -1
  191. package/dist/locale/sv.min.mjs +1 -1
  192. package/dist/locale/sv.mjs +1 -1
  193. package/dist/locale/ta.js +1 -1
  194. package/dist/locale/ta.min.js +1 -1
  195. package/dist/locale/ta.min.mjs +1 -1
  196. package/dist/locale/ta.mjs +1 -1
  197. package/dist/locale/th.js +1 -1
  198. package/dist/locale/th.min.js +1 -1
  199. package/dist/locale/th.min.mjs +1 -1
  200. package/dist/locale/th.mjs +1 -1
  201. package/dist/locale/tk.js +1 -1
  202. package/dist/locale/tk.min.js +1 -1
  203. package/dist/locale/tk.min.mjs +1 -1
  204. package/dist/locale/tk.mjs +1 -1
  205. package/dist/locale/tr.js +1 -1
  206. package/dist/locale/tr.min.js +1 -1
  207. package/dist/locale/tr.min.mjs +1 -1
  208. package/dist/locale/tr.mjs +1 -1
  209. package/dist/locale/ug-cn.js +1 -1
  210. package/dist/locale/ug-cn.min.js +1 -1
  211. package/dist/locale/ug-cn.min.mjs +1 -1
  212. package/dist/locale/ug-cn.mjs +1 -1
  213. package/dist/locale/uk.js +1 -1
  214. package/dist/locale/uk.min.js +1 -1
  215. package/dist/locale/uk.min.mjs +1 -1
  216. package/dist/locale/uk.mjs +1 -1
  217. package/dist/locale/uz-uz.js +1 -1
  218. package/dist/locale/uz-uz.min.js +1 -1
  219. package/dist/locale/uz-uz.min.mjs +1 -1
  220. package/dist/locale/uz-uz.mjs +1 -1
  221. package/dist/locale/vi.js +1 -1
  222. package/dist/locale/vi.min.js +1 -1
  223. package/dist/locale/vi.min.mjs +1 -1
  224. package/dist/locale/vi.mjs +1 -1
  225. package/dist/locale/zh-cn.js +1 -1
  226. package/dist/locale/zh-cn.min.js +1 -1
  227. package/dist/locale/zh-cn.min.mjs +1 -1
  228. package/dist/locale/zh-cn.mjs +1 -1
  229. package/dist/locale/zh-tw.js +1 -1
  230. package/dist/locale/zh-tw.min.js +1 -1
  231. package/dist/locale/zh-tw.min.mjs +1 -1
  232. package/dist/locale/zh-tw.mjs +1 -1
  233. package/es/components/carousel/index.d.ts +1 -1
  234. package/es/components/carousel/src/carousel.vue.d.ts +1 -1
  235. package/es/components/carousel/src/carousel2.mjs +10 -3
  236. package/es/components/carousel/src/carousel2.mjs.map +1 -1
  237. package/es/components/color-picker/src/draggable.mjs +2 -2
  238. package/es/components/color-picker/src/draggable.mjs.map +1 -1
  239. package/es/components/menu/src/menu.mjs +1 -2
  240. package/es/components/menu/src/menu.mjs.map +1 -1
  241. package/es/components/notification/src/notify.mjs +1 -1
  242. package/es/components/notification/src/notify.mjs.map +1 -1
  243. package/es/components/space/src/space.mjs +33 -25
  244. package/es/components/space/src/space.mjs.map +1 -1
  245. package/es/components/table/src/table/style-helper.mjs +6 -6
  246. package/es/components/table/src/table/style-helper.mjs.map +1 -1
  247. package/es/components/transfer/src/transfer.vue.d.ts +45 -45
  248. package/es/hooks/use-namespace/index.mjs +6 -2
  249. package/es/hooks/use-namespace/index.mjs.map +1 -1
  250. package/es/version.d.ts +1 -1
  251. package/es/version.mjs +1 -1
  252. package/es/version.mjs.map +1 -1
  253. package/lib/components/carousel/index.d.ts +1 -1
  254. package/lib/components/carousel/src/carousel.vue.d.ts +1 -1
  255. package/lib/components/carousel/src/carousel2.js +10 -3
  256. package/lib/components/carousel/src/carousel2.js.map +1 -1
  257. package/lib/components/color-picker/src/draggable.js +2 -2
  258. package/lib/components/color-picker/src/draggable.js.map +1 -1
  259. package/lib/components/menu/src/menu.js +1 -2
  260. package/lib/components/menu/src/menu.js.map +1 -1
  261. package/lib/components/notification/src/notify.js +1 -1
  262. package/lib/components/notification/src/notify.js.map +1 -1
  263. package/lib/components/space/src/space.js +32 -24
  264. package/lib/components/space/src/space.js.map +1 -1
  265. package/lib/components/table/src/table/style-helper.js +6 -6
  266. package/lib/components/table/src/table/style-helper.js.map +1 -1
  267. package/lib/components/transfer/src/transfer.vue.d.ts +45 -45
  268. package/lib/hooks/use-namespace/index.js +6 -2
  269. package/lib/hooks/use-namespace/index.js.map +1 -1
  270. package/lib/version.d.ts +1 -1
  271. package/lib/version.js +1 -1
  272. package/lib/version.js.map +1 -1
  273. package/package.json +2 -2
  274. package/theme-chalk/el-menu.css +1 -1
  275. package/theme-chalk/el-message.css +1 -1
  276. package/theme-chalk/index.css +1 -1
  277. package/theme-chalk/src/common/var.scss +1 -2
  278. package/theme-chalk/src/menu.scss +1 -0
  279. package/theme-chalk/src/message.scss +3 -4
  280. package/web-types.json +1 -1
@@ -1,2 +1,2 @@
1
- /*! Element Plus v2.2.11 */var u={name:"zh-cn",el:{colorpicker:{confirm:"\u786E\u5B9A",clear:"\u6E05\u7A7A"},datepicker:{now:"\u6B64\u523B",today:"\u4ECA\u5929",cancel:"\u53D6\u6D88",clear:"\u6E05\u7A7A",confirm:"\u786E\u5B9A",selectDate:"\u9009\u62E9\u65E5\u671F",selectTime:"\u9009\u62E9\u65F6\u95F4",startDate:"\u5F00\u59CB\u65E5\u671F",startTime:"\u5F00\u59CB\u65F6\u95F4",endDate:"\u7ED3\u675F\u65E5\u671F",endTime:"\u7ED3\u675F\u65F6\u95F4",prevYear:"\u524D\u4E00\u5E74",nextYear:"\u540E\u4E00\u5E74",prevMonth:"\u4E0A\u4E2A\u6708",nextMonth:"\u4E0B\u4E2A\u6708",year:"\u5E74",month1:"1 \u6708",month2:"2 \u6708",month3:"3 \u6708",month4:"4 \u6708",month5:"5 \u6708",month6:"6 \u6708",month7:"7 \u6708",month8:"8 \u6708",month9:"9 \u6708",month10:"10 \u6708",month11:"11 \u6708",month12:"12 \u6708",weeks:{sun:"\u65E5",mon:"\u4E00",tue:"\u4E8C",wed:"\u4E09",thu:"\u56DB",fri:"\u4E94",sat:"\u516D"},months:{jan:"\u4E00\u6708",feb:"\u4E8C\u6708",mar:"\u4E09\u6708",apr:"\u56DB\u6708",may:"\u4E94\u6708",jun:"\u516D\u6708",jul:"\u4E03\u6708",aug:"\u516B\u6708",sep:"\u4E5D\u6708",oct:"\u5341\u6708",nov:"\u5341\u4E00\u6708",dec:"\u5341\u4E8C\u6708"}},select:{loading:"\u52A0\u8F7D\u4E2D",noMatch:"\u65E0\u5339\u914D\u6570\u636E",noData:"\u65E0\u6570\u636E",placeholder:"\u8BF7\u9009\u62E9"},cascader:{noMatch:"\u65E0\u5339\u914D\u6570\u636E",loading:"\u52A0\u8F7D\u4E2D",placeholder:"\u8BF7\u9009\u62E9",noData:"\u6682\u65E0\u6570\u636E"},pagination:{goto:"\u524D\u5F80",pagesize:"\u6761/\u9875",total:"\u5171 {total} \u6761",pageClassifier:"\u9875",deprecationWarning:"\u4F60\u4F7F\u7528\u4E86\u4E00\u4E9B\u5DF2\u88AB\u5E9F\u5F03\u7684\u7528\u6CD5\uFF0C\u8BF7\u53C2\u8003 el-pagination \u7684\u5B98\u65B9\u6587\u6863"},messagebox:{title:"\u63D0\u793A",confirm:"\u786E\u5B9A",cancel:"\u53D6\u6D88",error:"\u8F93\u5165\u7684\u6570\u636E\u4E0D\u5408\u6CD5!"},upload:{deleteTip:"\u6309 delete \u952E\u53EF\u5220\u9664",delete:"\u5220\u9664",preview:"\u67E5\u770B\u56FE\u7247",continue:"\u7EE7\u7EED\u4E0A\u4F20"},table:{emptyText:"\u6682\u65E0\u6570\u636E",confirmFilter:"\u7B5B\u9009",resetFilter:"\u91CD\u7F6E",clearFilter:"\u5168\u90E8",sumText:"\u5408\u8BA1"},tree:{emptyText:"\u6682\u65E0\u6570\u636E"},transfer:{noMatch:"\u65E0\u5339\u914D\u6570\u636E",noData:"\u65E0\u6570\u636E",titles:["\u5217\u8868 1","\u5217\u8868 2"],filterPlaceholder:"\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",noCheckedFormat:"\u5171 {total} \u9879",hasCheckedFormat:"\u5DF2\u9009 {checked}/{total} \u9879"},image:{error:"\u52A0\u8F7D\u5931\u8D25"},pageHeader:{title:"\u8FD4\u56DE"},popconfirm:{confirmButtonText:"\u786E\u5B9A",cancelButtonText:"\u53D6\u6D88"}}};export{u as default};
1
+ /*! Element Plus v2.2.12 */var u={name:"zh-cn",el:{colorpicker:{confirm:"\u786E\u5B9A",clear:"\u6E05\u7A7A"},datepicker:{now:"\u6B64\u523B",today:"\u4ECA\u5929",cancel:"\u53D6\u6D88",clear:"\u6E05\u7A7A",confirm:"\u786E\u5B9A",selectDate:"\u9009\u62E9\u65E5\u671F",selectTime:"\u9009\u62E9\u65F6\u95F4",startDate:"\u5F00\u59CB\u65E5\u671F",startTime:"\u5F00\u59CB\u65F6\u95F4",endDate:"\u7ED3\u675F\u65E5\u671F",endTime:"\u7ED3\u675F\u65F6\u95F4",prevYear:"\u524D\u4E00\u5E74",nextYear:"\u540E\u4E00\u5E74",prevMonth:"\u4E0A\u4E2A\u6708",nextMonth:"\u4E0B\u4E2A\u6708",year:"\u5E74",month1:"1 \u6708",month2:"2 \u6708",month3:"3 \u6708",month4:"4 \u6708",month5:"5 \u6708",month6:"6 \u6708",month7:"7 \u6708",month8:"8 \u6708",month9:"9 \u6708",month10:"10 \u6708",month11:"11 \u6708",month12:"12 \u6708",weeks:{sun:"\u65E5",mon:"\u4E00",tue:"\u4E8C",wed:"\u4E09",thu:"\u56DB",fri:"\u4E94",sat:"\u516D"},months:{jan:"\u4E00\u6708",feb:"\u4E8C\u6708",mar:"\u4E09\u6708",apr:"\u56DB\u6708",may:"\u4E94\u6708",jun:"\u516D\u6708",jul:"\u4E03\u6708",aug:"\u516B\u6708",sep:"\u4E5D\u6708",oct:"\u5341\u6708",nov:"\u5341\u4E00\u6708",dec:"\u5341\u4E8C\u6708"}},select:{loading:"\u52A0\u8F7D\u4E2D",noMatch:"\u65E0\u5339\u914D\u6570\u636E",noData:"\u65E0\u6570\u636E",placeholder:"\u8BF7\u9009\u62E9"},cascader:{noMatch:"\u65E0\u5339\u914D\u6570\u636E",loading:"\u52A0\u8F7D\u4E2D",placeholder:"\u8BF7\u9009\u62E9",noData:"\u6682\u65E0\u6570\u636E"},pagination:{goto:"\u524D\u5F80",pagesize:"\u6761/\u9875",total:"\u5171 {total} \u6761",pageClassifier:"\u9875",deprecationWarning:"\u4F60\u4F7F\u7528\u4E86\u4E00\u4E9B\u5DF2\u88AB\u5E9F\u5F03\u7684\u7528\u6CD5\uFF0C\u8BF7\u53C2\u8003 el-pagination \u7684\u5B98\u65B9\u6587\u6863"},messagebox:{title:"\u63D0\u793A",confirm:"\u786E\u5B9A",cancel:"\u53D6\u6D88",error:"\u8F93\u5165\u7684\u6570\u636E\u4E0D\u5408\u6CD5!"},upload:{deleteTip:"\u6309 delete \u952E\u53EF\u5220\u9664",delete:"\u5220\u9664",preview:"\u67E5\u770B\u56FE\u7247",continue:"\u7EE7\u7EED\u4E0A\u4F20"},table:{emptyText:"\u6682\u65E0\u6570\u636E",confirmFilter:"\u7B5B\u9009",resetFilter:"\u91CD\u7F6E",clearFilter:"\u5168\u90E8",sumText:"\u5408\u8BA1"},tree:{emptyText:"\u6682\u65E0\u6570\u636E"},transfer:{noMatch:"\u65E0\u5339\u914D\u6570\u636E",noData:"\u65E0\u6570\u636E",titles:["\u5217\u8868 1","\u5217\u8868 2"],filterPlaceholder:"\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",noCheckedFormat:"\u5171 {total} \u9879",hasCheckedFormat:"\u5DF2\u9009 {checked}/{total} \u9879"},image:{error:"\u52A0\u8F7D\u5931\u8D25"},pageHeader:{title:"\u8FD4\u56DE"},popconfirm:{confirmButtonText:"\u786E\u5B9A",cancelButtonText:"\u53D6\u6D88"}}};export{u as default};
2
2
  //# sourceMappingURL=zh-cn.min.mjs.map
@@ -1,4 +1,4 @@
1
- /*! Element Plus v2.2.11 */
1
+ /*! Element Plus v2.2.12 */
2
2
 
3
3
  var zhCn = {
4
4
  name: "zh-cn",
@@ -1,4 +1,4 @@
1
- /*! Element Plus v2.2.11 */
1
+ /*! Element Plus v2.2.12 */
2
2
 
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -1,2 +1,2 @@
1
- /*! Element Plus v2.2.11 */(function(u,e){typeof exports=="object"&&typeof module!="undefined"?module.exports=e():typeof define=="function"&&define.amd?define(e):(u=typeof globalThis!="undefined"?globalThis:u||self,u.ElementPlusLocaleZhTw=e())})(this,function(){"use strict";var u={name:"zh-tw",el:{colorpicker:{confirm:"\u78BA\u8A8D",clear:"\u6E05\u7A7A"},datepicker:{now:"\u73FE\u5728",today:"\u4ECA\u5929",cancel:"\u53D6\u6D88",clear:"\u6E05\u7A7A",confirm:"\u78BA\u8A8D",selectDate:"\u9078\u64C7\u65E5\u671F",selectTime:"\u9078\u64C7\u6642\u9593",startDate:"\u958B\u59CB\u65E5\u671F",startTime:"\u958B\u59CB\u6642\u9593",endDate:"\u7D50\u675F\u65E5\u671F",endTime:"\u7D50\u675F\u6642\u9593",prevYear:"\u524D\u4E00\u5E74",nextYear:"\u5F8C\u4E00\u5E74",prevMonth:"\u4E0A\u500B\u6708",nextMonth:"\u4E0B\u500B\u6708",year:"\u5E74",month1:"1 \u6708",month2:"2 \u6708",month3:"3 \u6708",month4:"4 \u6708",month5:"5 \u6708",month6:"6 \u6708",month7:"7 \u6708",month8:"8 \u6708",month9:"9 \u6708",month10:"10 \u6708",month11:"11 \u6708",month12:"12 \u6708",weeks:{sun:"\u65E5",mon:"\u4E00",tue:"\u4E8C",wed:"\u4E09",thu:"\u56DB",fri:"\u4E94",sat:"\u516D"},months:{jan:"\u4E00\u6708",feb:"\u4E8C\u6708",mar:"\u4E09\u6708",apr:"\u56DB\u6708",may:"\u4E94\u6708",jun:"\u516D\u6708",jul:"\u4E03\u6708",aug:"\u516B\u6708",sep:"\u4E5D\u6708",oct:"\u5341\u6708",nov:"\u5341\u4E00\u6708",dec:"\u5341\u4E8C\u6708"}},select:{loading:"\u52A0\u8F09\u4E2D",noMatch:"\u7121\u5339\u914D\u8CC7\u6599",noData:"\u7121\u8CC7\u6599",placeholder:"\u8ACB\u9078\u64C7"},cascader:{noMatch:"\u7121\u5339\u914D\u8CC7\u6599",loading:"\u52A0\u8F09\u4E2D",placeholder:"\u8ACB\u9078\u64C7",noData:"\u7121\u8CC7\u6599"},pagination:{goto:"\u524D\u5F80",pagesize:"\u9805/\u9801",total:"\u5171 {total} \u9805",pageClassifier:"\u9801"},messagebox:{title:"\u63D0\u793A",confirm:"\u78BA\u5B9A",cancel:"\u53D6\u6D88",error:"\u8F38\u5165\u7684\u8CC7\u6599\u4E0D\u7B26\u898F\u5B9A!"},upload:{deleteTip:"\u6309 delete \u9375\u53EF\u522A\u9664",delete:"\u522A\u9664",preview:"\u67E5\u770B\u5716\u7247",continue:"\u7E7C\u7E8C\u4E0A\u50B3"},table:{emptyText:"\u66AB\u7121\u8CC7\u6599",confirmFilter:"\u7BE9\u9078",resetFilter:"\u91CD\u7F6E",clearFilter:"\u5168\u90E8",sumText:"\u5408\u8A08"},tree:{emptyText:"\u66AB\u7121\u8CC7\u6599"},transfer:{noMatch:"\u7121\u5339\u914D\u8CC7\u6599",noData:"\u7121\u8CC7\u6599",titles:["\u5217\u8868 1","\u5217\u8868 2"],filterPlaceholder:"\u8ACB\u8F38\u5165\u641C\u7D22\u5167\u5BB9",noCheckedFormat:"\u5171 {total} \u9805",hasCheckedFormat:"\u5DF2\u9078 {checked}/{total} \u9805"},image:{error:"\u52A0\u8F09\u5931\u6557"},pageHeader:{title:"\u8FD4\u56DE"},popconfirm:{confirmButtonText:"\u78BA\u8A8D",cancelButtonText:"\u53D6\u6D88"}}};return u});
1
+ /*! Element Plus v2.2.12 */(function(u,e){typeof exports=="object"&&typeof module!="undefined"?module.exports=e():typeof define=="function"&&define.amd?define(e):(u=typeof globalThis!="undefined"?globalThis:u||self,u.ElementPlusLocaleZhTw=e())})(this,function(){"use strict";var u={name:"zh-tw",el:{colorpicker:{confirm:"\u78BA\u8A8D",clear:"\u6E05\u7A7A"},datepicker:{now:"\u73FE\u5728",today:"\u4ECA\u5929",cancel:"\u53D6\u6D88",clear:"\u6E05\u7A7A",confirm:"\u78BA\u8A8D",selectDate:"\u9078\u64C7\u65E5\u671F",selectTime:"\u9078\u64C7\u6642\u9593",startDate:"\u958B\u59CB\u65E5\u671F",startTime:"\u958B\u59CB\u6642\u9593",endDate:"\u7D50\u675F\u65E5\u671F",endTime:"\u7D50\u675F\u6642\u9593",prevYear:"\u524D\u4E00\u5E74",nextYear:"\u5F8C\u4E00\u5E74",prevMonth:"\u4E0A\u500B\u6708",nextMonth:"\u4E0B\u500B\u6708",year:"\u5E74",month1:"1 \u6708",month2:"2 \u6708",month3:"3 \u6708",month4:"4 \u6708",month5:"5 \u6708",month6:"6 \u6708",month7:"7 \u6708",month8:"8 \u6708",month9:"9 \u6708",month10:"10 \u6708",month11:"11 \u6708",month12:"12 \u6708",weeks:{sun:"\u65E5",mon:"\u4E00",tue:"\u4E8C",wed:"\u4E09",thu:"\u56DB",fri:"\u4E94",sat:"\u516D"},months:{jan:"\u4E00\u6708",feb:"\u4E8C\u6708",mar:"\u4E09\u6708",apr:"\u56DB\u6708",may:"\u4E94\u6708",jun:"\u516D\u6708",jul:"\u4E03\u6708",aug:"\u516B\u6708",sep:"\u4E5D\u6708",oct:"\u5341\u6708",nov:"\u5341\u4E00\u6708",dec:"\u5341\u4E8C\u6708"}},select:{loading:"\u52A0\u8F09\u4E2D",noMatch:"\u7121\u5339\u914D\u8CC7\u6599",noData:"\u7121\u8CC7\u6599",placeholder:"\u8ACB\u9078\u64C7"},cascader:{noMatch:"\u7121\u5339\u914D\u8CC7\u6599",loading:"\u52A0\u8F09\u4E2D",placeholder:"\u8ACB\u9078\u64C7",noData:"\u7121\u8CC7\u6599"},pagination:{goto:"\u524D\u5F80",pagesize:"\u9805/\u9801",total:"\u5171 {total} \u9805",pageClassifier:"\u9801"},messagebox:{title:"\u63D0\u793A",confirm:"\u78BA\u5B9A",cancel:"\u53D6\u6D88",error:"\u8F38\u5165\u7684\u8CC7\u6599\u4E0D\u7B26\u898F\u5B9A!"},upload:{deleteTip:"\u6309 delete \u9375\u53EF\u522A\u9664",delete:"\u522A\u9664",preview:"\u67E5\u770B\u5716\u7247",continue:"\u7E7C\u7E8C\u4E0A\u50B3"},table:{emptyText:"\u66AB\u7121\u8CC7\u6599",confirmFilter:"\u7BE9\u9078",resetFilter:"\u91CD\u7F6E",clearFilter:"\u5168\u90E8",sumText:"\u5408\u8A08"},tree:{emptyText:"\u66AB\u7121\u8CC7\u6599"},transfer:{noMatch:"\u7121\u5339\u914D\u8CC7\u6599",noData:"\u7121\u8CC7\u6599",titles:["\u5217\u8868 1","\u5217\u8868 2"],filterPlaceholder:"\u8ACB\u8F38\u5165\u641C\u7D22\u5167\u5BB9",noCheckedFormat:"\u5171 {total} \u9805",hasCheckedFormat:"\u5DF2\u9078 {checked}/{total} \u9805"},image:{error:"\u52A0\u8F09\u5931\u6557"},pageHeader:{title:"\u8FD4\u56DE"},popconfirm:{confirmButtonText:"\u78BA\u8A8D",cancelButtonText:"\u53D6\u6D88"}}};return u});
2
2
  //# sourceMappingURL=zh-tw.min.js.map
@@ -1,2 +1,2 @@
1
- /*! Element Plus v2.2.11 */var u={name:"zh-tw",el:{colorpicker:{confirm:"\u78BA\u8A8D",clear:"\u6E05\u7A7A"},datepicker:{now:"\u73FE\u5728",today:"\u4ECA\u5929",cancel:"\u53D6\u6D88",clear:"\u6E05\u7A7A",confirm:"\u78BA\u8A8D",selectDate:"\u9078\u64C7\u65E5\u671F",selectTime:"\u9078\u64C7\u6642\u9593",startDate:"\u958B\u59CB\u65E5\u671F",startTime:"\u958B\u59CB\u6642\u9593",endDate:"\u7D50\u675F\u65E5\u671F",endTime:"\u7D50\u675F\u6642\u9593",prevYear:"\u524D\u4E00\u5E74",nextYear:"\u5F8C\u4E00\u5E74",prevMonth:"\u4E0A\u500B\u6708",nextMonth:"\u4E0B\u500B\u6708",year:"\u5E74",month1:"1 \u6708",month2:"2 \u6708",month3:"3 \u6708",month4:"4 \u6708",month5:"5 \u6708",month6:"6 \u6708",month7:"7 \u6708",month8:"8 \u6708",month9:"9 \u6708",month10:"10 \u6708",month11:"11 \u6708",month12:"12 \u6708",weeks:{sun:"\u65E5",mon:"\u4E00",tue:"\u4E8C",wed:"\u4E09",thu:"\u56DB",fri:"\u4E94",sat:"\u516D"},months:{jan:"\u4E00\u6708",feb:"\u4E8C\u6708",mar:"\u4E09\u6708",apr:"\u56DB\u6708",may:"\u4E94\u6708",jun:"\u516D\u6708",jul:"\u4E03\u6708",aug:"\u516B\u6708",sep:"\u4E5D\u6708",oct:"\u5341\u6708",nov:"\u5341\u4E00\u6708",dec:"\u5341\u4E8C\u6708"}},select:{loading:"\u52A0\u8F09\u4E2D",noMatch:"\u7121\u5339\u914D\u8CC7\u6599",noData:"\u7121\u8CC7\u6599",placeholder:"\u8ACB\u9078\u64C7"},cascader:{noMatch:"\u7121\u5339\u914D\u8CC7\u6599",loading:"\u52A0\u8F09\u4E2D",placeholder:"\u8ACB\u9078\u64C7",noData:"\u7121\u8CC7\u6599"},pagination:{goto:"\u524D\u5F80",pagesize:"\u9805/\u9801",total:"\u5171 {total} \u9805",pageClassifier:"\u9801"},messagebox:{title:"\u63D0\u793A",confirm:"\u78BA\u5B9A",cancel:"\u53D6\u6D88",error:"\u8F38\u5165\u7684\u8CC7\u6599\u4E0D\u7B26\u898F\u5B9A!"},upload:{deleteTip:"\u6309 delete \u9375\u53EF\u522A\u9664",delete:"\u522A\u9664",preview:"\u67E5\u770B\u5716\u7247",continue:"\u7E7C\u7E8C\u4E0A\u50B3"},table:{emptyText:"\u66AB\u7121\u8CC7\u6599",confirmFilter:"\u7BE9\u9078",resetFilter:"\u91CD\u7F6E",clearFilter:"\u5168\u90E8",sumText:"\u5408\u8A08"},tree:{emptyText:"\u66AB\u7121\u8CC7\u6599"},transfer:{noMatch:"\u7121\u5339\u914D\u8CC7\u6599",noData:"\u7121\u8CC7\u6599",titles:["\u5217\u8868 1","\u5217\u8868 2"],filterPlaceholder:"\u8ACB\u8F38\u5165\u641C\u7D22\u5167\u5BB9",noCheckedFormat:"\u5171 {total} \u9805",hasCheckedFormat:"\u5DF2\u9078 {checked}/{total} \u9805"},image:{error:"\u52A0\u8F09\u5931\u6557"},pageHeader:{title:"\u8FD4\u56DE"},popconfirm:{confirmButtonText:"\u78BA\u8A8D",cancelButtonText:"\u53D6\u6D88"}}};export{u as default};
1
+ /*! Element Plus v2.2.12 */var u={name:"zh-tw",el:{colorpicker:{confirm:"\u78BA\u8A8D",clear:"\u6E05\u7A7A"},datepicker:{now:"\u73FE\u5728",today:"\u4ECA\u5929",cancel:"\u53D6\u6D88",clear:"\u6E05\u7A7A",confirm:"\u78BA\u8A8D",selectDate:"\u9078\u64C7\u65E5\u671F",selectTime:"\u9078\u64C7\u6642\u9593",startDate:"\u958B\u59CB\u65E5\u671F",startTime:"\u958B\u59CB\u6642\u9593",endDate:"\u7D50\u675F\u65E5\u671F",endTime:"\u7D50\u675F\u6642\u9593",prevYear:"\u524D\u4E00\u5E74",nextYear:"\u5F8C\u4E00\u5E74",prevMonth:"\u4E0A\u500B\u6708",nextMonth:"\u4E0B\u500B\u6708",year:"\u5E74",month1:"1 \u6708",month2:"2 \u6708",month3:"3 \u6708",month4:"4 \u6708",month5:"5 \u6708",month6:"6 \u6708",month7:"7 \u6708",month8:"8 \u6708",month9:"9 \u6708",month10:"10 \u6708",month11:"11 \u6708",month12:"12 \u6708",weeks:{sun:"\u65E5",mon:"\u4E00",tue:"\u4E8C",wed:"\u4E09",thu:"\u56DB",fri:"\u4E94",sat:"\u516D"},months:{jan:"\u4E00\u6708",feb:"\u4E8C\u6708",mar:"\u4E09\u6708",apr:"\u56DB\u6708",may:"\u4E94\u6708",jun:"\u516D\u6708",jul:"\u4E03\u6708",aug:"\u516B\u6708",sep:"\u4E5D\u6708",oct:"\u5341\u6708",nov:"\u5341\u4E00\u6708",dec:"\u5341\u4E8C\u6708"}},select:{loading:"\u52A0\u8F09\u4E2D",noMatch:"\u7121\u5339\u914D\u8CC7\u6599",noData:"\u7121\u8CC7\u6599",placeholder:"\u8ACB\u9078\u64C7"},cascader:{noMatch:"\u7121\u5339\u914D\u8CC7\u6599",loading:"\u52A0\u8F09\u4E2D",placeholder:"\u8ACB\u9078\u64C7",noData:"\u7121\u8CC7\u6599"},pagination:{goto:"\u524D\u5F80",pagesize:"\u9805/\u9801",total:"\u5171 {total} \u9805",pageClassifier:"\u9801"},messagebox:{title:"\u63D0\u793A",confirm:"\u78BA\u5B9A",cancel:"\u53D6\u6D88",error:"\u8F38\u5165\u7684\u8CC7\u6599\u4E0D\u7B26\u898F\u5B9A!"},upload:{deleteTip:"\u6309 delete \u9375\u53EF\u522A\u9664",delete:"\u522A\u9664",preview:"\u67E5\u770B\u5716\u7247",continue:"\u7E7C\u7E8C\u4E0A\u50B3"},table:{emptyText:"\u66AB\u7121\u8CC7\u6599",confirmFilter:"\u7BE9\u9078",resetFilter:"\u91CD\u7F6E",clearFilter:"\u5168\u90E8",sumText:"\u5408\u8A08"},tree:{emptyText:"\u66AB\u7121\u8CC7\u6599"},transfer:{noMatch:"\u7121\u5339\u914D\u8CC7\u6599",noData:"\u7121\u8CC7\u6599",titles:["\u5217\u8868 1","\u5217\u8868 2"],filterPlaceholder:"\u8ACB\u8F38\u5165\u641C\u7D22\u5167\u5BB9",noCheckedFormat:"\u5171 {total} \u9805",hasCheckedFormat:"\u5DF2\u9078 {checked}/{total} \u9805"},image:{error:"\u52A0\u8F09\u5931\u6557"},pageHeader:{title:"\u8FD4\u56DE"},popconfirm:{confirmButtonText:"\u78BA\u8A8D",cancelButtonText:"\u53D6\u6D88"}}};export{u as default};
2
2
  //# sourceMappingURL=zh-tw.min.mjs.map
@@ -1,4 +1,4 @@
1
- /*! Element Plus v2.2.11 */
1
+ /*! Element Plus v2.2.12 */
2
2
 
3
3
  var zhTw = {
4
4
  name: "zh-tw",
@@ -78,7 +78,6 @@ export declare const ElCarousel: import("element-plus/es/utils").SFCWithInstall<
78
78
  translateItem: (index: number, activeIndex: number, oldIndex?: number | undefined) => void;
79
79
  }[]>;
80
80
  arrowDisplay: import("vue").ComputedRef<boolean>;
81
- interval: import("vue").ComputedRef<number>;
82
81
  hasLabel: import("vue").ComputedRef<boolean>;
83
82
  carouselClasses: import("vue").ComputedRef<string[]>;
84
83
  indicatorsClasses: import("vue").ComputedRef<string[]>;
@@ -102,6 +101,7 @@ export declare const ElCarousel: import("element-plus/es/utils").SFCWithInstall<
102
101
  handleIndicatorHover: (index: number) => void;
103
102
  prev: () => void;
104
103
  next: () => void;
104
+ resetTimer: () => void;
105
105
  resizeObserver: import("vue").ShallowRef<{
106
106
  isSupported: boolean | undefined;
107
107
  stop: () => void;
@@ -79,7 +79,6 @@ declare const _default: import("vue").DefineComponent<{
79
79
  translateItem: (index: number, activeIndex: number, oldIndex?: number | undefined) => void;
80
80
  }[]>;
81
81
  arrowDisplay: import("vue").ComputedRef<boolean>;
82
- interval: import("vue").ComputedRef<number>;
83
82
  hasLabel: import("vue").ComputedRef<boolean>;
84
83
  carouselClasses: import("vue").ComputedRef<string[]>;
85
84
  indicatorsClasses: import("vue").ComputedRef<string[]>;
@@ -103,6 +102,7 @@ declare const _default: import("vue").DefineComponent<{
103
102
  handleIndicatorHover: (index: number) => void;
104
103
  prev: () => void;
105
104
  next: () => void;
105
+ resetTimer: () => void;
106
106
  resizeObserver: import("vue").ShallowRef<{
107
107
  isSupported: boolean | undefined;
108
108
  stop: () => void;
@@ -34,7 +34,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
34
34
  const root = ref();
35
35
  const items = ref([]);
36
36
  const arrowDisplay = computed(() => props.arrow !== "never" && !unref(isVertical));
37
- const interval = computed(() => props.interval);
38
37
  const hasLabel = computed(() => {
39
38
  return items.value.some((item) => item.props.label.toString().length > 0);
40
39
  });
@@ -70,9 +69,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
70
69
  }
71
70
  }
72
71
  function startTimer() {
73
- if (interval.value <= 0 || !props.autoplay || timer.value)
72
+ if (props.interval <= 0 || !props.autoplay || timer.value)
74
73
  return;
75
- timer.value = setInterval(() => playSlides(), interval.value);
74
+ timer.value = setInterval(() => playSlides(), props.interval);
76
75
  }
77
76
  const playSlides = () => {
78
77
  if (activeIndex.value < items.value.length - 1) {
@@ -105,6 +104,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
105
104
  if (oldIndex === activeIndex.value) {
106
105
  resetItemPosition(oldIndex);
107
106
  }
107
+ resetTimer();
108
108
  }
109
109
  function resetItemPosition(oldIndex) {
110
110
  items.value.forEach((item, index) => {
@@ -182,6 +182,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
182
182
  function next() {
183
183
  setActiveItem(activeIndex.value + 1);
184
184
  }
185
+ function resetTimer() {
186
+ pauseTimer();
187
+ startTimer();
188
+ }
185
189
  watch(() => activeIndex.value, (current, prev2) => {
186
190
  resetItemPosition(prev2);
187
191
  if (prev2 > -1) {
@@ -194,6 +198,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
194
198
  watch(() => props.loop, () => {
195
199
  setActiveItem(activeIndex.value);
196
200
  });
201
+ watch(() => props.interval, () => {
202
+ resetTimer();
203
+ });
197
204
  const resizeObserver = shallowRef();
198
205
  onMounted(async () => {
199
206
  await nextTick();
@@ -1 +1 @@
1
- {"version":3,"file":"carousel2.mjs","sources":["../../../../../../packages/components/carousel/src/carousel.vue"],"sourcesContent":["<template>\n <div\n ref=\"root\"\n :class=\"carouselClasses\"\n @mouseenter.stop=\"handleMouseEnter\"\n @mouseleave.stop=\"handleMouseLeave\"\n >\n <div :class=\"ns.e('container')\" :style=\"{ height: height }\">\n <transition v-if=\"arrowDisplay\" name=\"carousel-arrow-left\">\n <button\n v-show=\"\n (arrow === 'always' || hover) && (props.loop || activeIndex > 0)\n \"\n type=\"button\"\n :class=\"[ns.e('arrow'), ns.em('arrow', 'left')]\"\n @mouseenter=\"handleButtonEnter('left')\"\n @mouseleave=\"handleButtonLeave\"\n @click.stop=\"throttledArrowClick(activeIndex - 1)\"\n >\n <ElIcon>\n <ArrowLeft />\n </ElIcon>\n </button>\n </transition>\n <transition v-if=\"arrowDisplay\" name=\"carousel-arrow-right\">\n <button\n v-show=\"\n (arrow === 'always' || hover) &&\n (props.loop || activeIndex < items.length - 1)\n \"\n type=\"button\"\n :class=\"[ns.e('arrow'), ns.em('arrow', 'right')]\"\n @mouseenter=\"handleButtonEnter('right')\"\n @mouseleave=\"handleButtonLeave\"\n @click.stop=\"throttledArrowClick(activeIndex + 1)\"\n >\n <ElIcon>\n <ArrowRight />\n </ElIcon>\n </button>\n </transition>\n <slot />\n </div>\n <ul v-if=\"indicatorPosition !== 'none'\" :class=\"indicatorsClasses\">\n <li\n v-for=\"(item, index) in items\"\n :key=\"index\"\n :class=\"[\n ns.e('indicator'),\n ns.em('indicator', direction),\n ns.is('active', index === activeIndex),\n ]\"\n @mouseenter=\"throttledIndicatorHover(index)\"\n @click.stop=\"handleIndicatorClick(index)\"\n >\n <button :class=\"ns.e('button')\">\n <span v-if=\"hasLabel\">{{ item.props.label }}</span>\n </button>\n </li>\n </ul>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n nextTick,\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 { ElIcon } from '@element-plus/components/icon'\nimport { ArrowLeft, ArrowRight } from '@element-plus/icons-vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { carouselContextKey } from '@element-plus/tokens'\nimport { carouselEmits, carouselProps } from './carousel'\nimport type { CarouselItemContext } from '@element-plus/tokens'\n\ndefineOptions({\n name: 'ElCarousel',\n})\n\nconst props = defineProps(carouselProps)\nconst emit = defineEmits(carouselEmits)\nconst ns = useNamespace('carousel')\nconst COMPONENT_NAME = 'ElCarousel'\nconst THROTTLE_TIME = 300\n\n// refs\nconst activeIndex = ref(-1)\nconst timer = ref<ReturnType<typeof setInterval> | null>(null)\nconst hover = ref(false)\nconst root = ref<HTMLDivElement>()\nconst items = ref<Array<CarouselItemContext>>([])\n\n// computed\nconst arrowDisplay = computed(\n () => props.arrow !== 'never' && !unref(isVertical)\n)\nconst interval = computed(() => props.interval)\n\nconst hasLabel = computed(() => {\n return items.value.some((item) => item.props.label.toString().length > 0)\n})\n\nconst carouselClasses = computed(() => {\n const classes = [ns.b(), ns.m(props.direction)]\n if (unref(isCardType)) {\n classes.push(ns.m('card'))\n }\n return classes\n})\n\nconst indicatorsClasses = computed(() => {\n const classes = [ns.e('indicators'), ns.em('indicators', props.direction)]\n if (hasLabel.value) {\n classes.push(ns.em('indicators', 'labels'))\n }\n if (props.indicatorPosition === 'outside' || unref(isCardType)) {\n classes.push(ns.em('indicators', 'outside'))\n }\n return classes\n})\n\nconst isCardType = computed(() => props.type === 'card')\nconst isVertical = computed(() => props.direction === 'vertical')\n\n// methods\nconst throttledArrowClick = throttle(\n (index: number) => {\n setActiveItem(index)\n },\n THROTTLE_TIME,\n { trailing: true }\n)\n\nconst throttledIndicatorHover = throttle((index: number) => {\n handleIndicatorHover(index)\n}, THROTTLE_TIME)\n\nfunction pauseTimer() {\n if (timer.value) {\n clearInterval(timer.value)\n timer.value = null\n }\n}\n\nfunction startTimer() {\n if (interval.value <= 0 || !props.autoplay || timer.value) return\n timer.value = setInterval(() => playSlides(), interval.value)\n}\n\nconst 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\nfunction 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(COMPONENT_NAME, '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}\n\nfunction resetItemPosition(oldIndex?: number) {\n items.value.forEach((item, index) => {\n item.translateItem(index, activeIndex.value, oldIndex)\n })\n}\n\nfunction addItem(item: CarouselItemContext) {\n items.value.push(item)\n}\n\nfunction removeItem(uid?: number) {\n const index = items.value.findIndex((item) => item.uid === uid)\n if (index !== -1) {\n items.value.splice(index, 1)\n if (activeIndex.value === index) next()\n }\n}\n\nfunction 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\nfunction handleMouseEnter() {\n hover.value = true\n if (props.pauseOnHover) {\n pauseTimer()\n }\n}\n\nfunction handleMouseLeave() {\n hover.value = false\n startTimer()\n}\n\nfunction 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\nfunction handleButtonLeave() {\n if (unref(isVertical)) return\n items.value.forEach((item) => {\n item.states.hover = false\n })\n}\n\nfunction handleIndicatorClick(index: number) {\n activeIndex.value = index\n}\n\nfunction handleIndicatorHover(index: number) {\n if (props.trigger === 'hover' && index !== activeIndex.value) {\n activeIndex.value = index\n }\n}\n\nfunction prev() {\n setActiveItem(activeIndex.value - 1)\n}\n\nfunction next() {\n setActiveItem(activeIndex.value + 1)\n}\n\n// watch\nwatch(\n () => activeIndex.value,\n (current, prev) => {\n resetItemPosition(prev)\n if (prev > -1) {\n emit('change', current, prev)\n }\n }\n)\nwatch(\n () => props.autoplay,\n (autoplay) => {\n autoplay ? startTimer() : pauseTimer()\n }\n)\nwatch(\n () => props.loop,\n () => {\n setActiveItem(activeIndex.value)\n }\n)\n\nconst resizeObserver = shallowRef<ReturnType<typeof useResizeObserver>>()\n// lifecycle\nonMounted(async () => {\n await nextTick()\n\n resizeObserver.value = useResizeObserver(root.value, () => {\n resetItemPosition()\n })\n if (props.initialIndex < items.value.length && props.initialIndex >= 0) {\n activeIndex.value = props.initialIndex\n }\n startTimer()\n})\n\nonBeforeUnmount(() => {\n pauseTimer()\n if (root.value && resizeObserver.value) resizeObserver.value.stop()\n})\n\n// provide\nprovide(carouselContextKey, {\n root,\n isCardType,\n isVertical,\n items,\n loop: props.loop,\n addItem,\n removeItem,\n setActiveItem,\n})\n\ndefineExpose({\n /** @description manually switch slide */\n setActiveItem,\n /** @description switch to the previous slide */\n prev,\n /** @description switch to the next slide */\n next,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2FA,IAAA,MAAA,EAAA,GAAA,aAAA,UAAA,CAAA,CAAA;AACA,IAAA,MAAA,cAAA,GAAA,YAAA,CAAA;AACA,IAAA,MAAA,aAAA,GAAA,GAAA,CAAA;AAGA,IAA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A,MACA,UAAA;AAAA,MACA,aAAA;AAEA,KAAA,CAAA,CAAA;AAAA,IAEA,MAAA,CAAA;AAAA,MAEA,aAAA;AAAA,MAEA,IAAA;AAAA,MACA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"carousel2.mjs","sources":["../../../../../../packages/components/carousel/src/carousel.vue"],"sourcesContent":["<template>\n <div\n ref=\"root\"\n :class=\"carouselClasses\"\n @mouseenter.stop=\"handleMouseEnter\"\n @mouseleave.stop=\"handleMouseLeave\"\n >\n <div :class=\"ns.e('container')\" :style=\"{ height: height }\">\n <transition v-if=\"arrowDisplay\" name=\"carousel-arrow-left\">\n <button\n v-show=\"\n (arrow === 'always' || hover) && (props.loop || activeIndex > 0)\n \"\n type=\"button\"\n :class=\"[ns.e('arrow'), ns.em('arrow', 'left')]\"\n @mouseenter=\"handleButtonEnter('left')\"\n @mouseleave=\"handleButtonLeave\"\n @click.stop=\"throttledArrowClick(activeIndex - 1)\"\n >\n <ElIcon>\n <ArrowLeft />\n </ElIcon>\n </button>\n </transition>\n <transition v-if=\"arrowDisplay\" name=\"carousel-arrow-right\">\n <button\n v-show=\"\n (arrow === 'always' || hover) &&\n (props.loop || activeIndex < items.length - 1)\n \"\n type=\"button\"\n :class=\"[ns.e('arrow'), ns.em('arrow', 'right')]\"\n @mouseenter=\"handleButtonEnter('right')\"\n @mouseleave=\"handleButtonLeave\"\n @click.stop=\"throttledArrowClick(activeIndex + 1)\"\n >\n <ElIcon>\n <ArrowRight />\n </ElIcon>\n </button>\n </transition>\n <slot />\n </div>\n <ul v-if=\"indicatorPosition !== 'none'\" :class=\"indicatorsClasses\">\n <li\n v-for=\"(item, index) in items\"\n :key=\"index\"\n :class=\"[\n ns.e('indicator'),\n ns.em('indicator', direction),\n ns.is('active', index === activeIndex),\n ]\"\n @mouseenter=\"throttledIndicatorHover(index)\"\n @click.stop=\"handleIndicatorClick(index)\"\n >\n <button :class=\"ns.e('button')\">\n <span v-if=\"hasLabel\">{{ item.props.label }}</span>\n </button>\n </li>\n </ul>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n nextTick,\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 { ElIcon } from '@element-plus/components/icon'\nimport { ArrowLeft, ArrowRight } from '@element-plus/icons-vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { carouselContextKey } from '@element-plus/tokens'\nimport { carouselEmits, carouselProps } from './carousel'\nimport type { CarouselItemContext } from '@element-plus/tokens'\n\ndefineOptions({\n name: 'ElCarousel',\n})\n\nconst props = defineProps(carouselProps)\nconst emit = defineEmits(carouselEmits)\nconst ns = useNamespace('carousel')\nconst COMPONENT_NAME = 'ElCarousel'\nconst THROTTLE_TIME = 300\n\n// refs\nconst activeIndex = ref(-1)\nconst timer = ref<ReturnType<typeof setInterval> | null>(null)\nconst hover = ref(false)\nconst root = ref<HTMLDivElement>()\nconst items = ref<Array<CarouselItemContext>>([])\n\n// computed\nconst arrowDisplay = computed(\n () => props.arrow !== 'never' && !unref(isVertical)\n)\n\nconst hasLabel = computed(() => {\n return items.value.some((item) => item.props.label.toString().length > 0)\n})\n\nconst carouselClasses = computed(() => {\n const classes = [ns.b(), ns.m(props.direction)]\n if (unref(isCardType)) {\n classes.push(ns.m('card'))\n }\n return classes\n})\n\nconst indicatorsClasses = computed(() => {\n const classes = [ns.e('indicators'), ns.em('indicators', props.direction)]\n if (hasLabel.value) {\n classes.push(ns.em('indicators', 'labels'))\n }\n if (props.indicatorPosition === 'outside' || unref(isCardType)) {\n classes.push(ns.em('indicators', 'outside'))\n }\n return classes\n})\n\nconst isCardType = computed(() => props.type === 'card')\nconst isVertical = computed(() => props.direction === 'vertical')\n\n// methods\nconst throttledArrowClick = throttle(\n (index: number) => {\n setActiveItem(index)\n },\n THROTTLE_TIME,\n { trailing: true }\n)\n\nconst throttledIndicatorHover = throttle((index: number) => {\n handleIndicatorHover(index)\n}, THROTTLE_TIME)\n\nfunction pauseTimer() {\n if (timer.value) {\n clearInterval(timer.value)\n timer.value = null\n }\n}\n\nfunction startTimer() {\n if (props.interval <= 0 || !props.autoplay || timer.value) return\n timer.value = setInterval(() => playSlides(), props.interval)\n}\n\nconst 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\nfunction 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(COMPONENT_NAME, '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\nfunction resetItemPosition(oldIndex?: number) {\n items.value.forEach((item, index) => {\n item.translateItem(index, activeIndex.value, oldIndex)\n })\n}\n\nfunction addItem(item: CarouselItemContext) {\n items.value.push(item)\n}\n\nfunction removeItem(uid?: number) {\n const index = items.value.findIndex((item) => item.uid === uid)\n if (index !== -1) {\n items.value.splice(index, 1)\n if (activeIndex.value === index) next()\n }\n}\n\nfunction 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\nfunction handleMouseEnter() {\n hover.value = true\n if (props.pauseOnHover) {\n pauseTimer()\n }\n}\n\nfunction handleMouseLeave() {\n hover.value = false\n startTimer()\n}\n\nfunction 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\nfunction handleButtonLeave() {\n if (unref(isVertical)) return\n items.value.forEach((item) => {\n item.states.hover = false\n })\n}\n\nfunction handleIndicatorClick(index: number) {\n activeIndex.value = index\n}\n\nfunction handleIndicatorHover(index: number) {\n if (props.trigger === 'hover' && index !== activeIndex.value) {\n activeIndex.value = index\n }\n}\n\nfunction prev() {\n setActiveItem(activeIndex.value - 1)\n}\n\nfunction next() {\n setActiveItem(activeIndex.value + 1)\n}\n\nfunction resetTimer() {\n pauseTimer()\n startTimer()\n}\n\n// watch\nwatch(\n () => activeIndex.value,\n (current, prev) => {\n resetItemPosition(prev)\n if (prev > -1) {\n emit('change', current, prev)\n }\n }\n)\nwatch(\n () => props.autoplay,\n (autoplay) => {\n autoplay ? startTimer() : pauseTimer()\n }\n)\nwatch(\n () => props.loop,\n () => {\n setActiveItem(activeIndex.value)\n }\n)\n\nwatch(\n () => props.interval,\n () => {\n resetTimer()\n }\n)\n\nconst resizeObserver = shallowRef<ReturnType<typeof useResizeObserver>>()\n// lifecycle\nonMounted(async () => {\n await nextTick()\n\n resizeObserver.value = useResizeObserver(root.value, () => {\n resetItemPosition()\n })\n if (props.initialIndex < items.value.length && props.initialIndex >= 0) {\n activeIndex.value = props.initialIndex\n }\n startTimer()\n})\n\nonBeforeUnmount(() => {\n pauseTimer()\n if (root.value && resizeObserver.value) resizeObserver.value.stop()\n})\n\n// provide\nprovide(carouselContextKey, {\n root,\n isCardType,\n isVertical,\n items,\n loop: props.loop,\n addItem,\n removeItem,\n setActiveItem,\n})\n\ndefineExpose({\n /** @description manually switch slide */\n setActiveItem,\n /** @description switch to the previous slide */\n prev,\n /** @description switch to the next slide */\n next,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2FA,IAAA,MAAA,EAAA,GAAA,aAAA,UAAA,CAAA,CAAA;AACA,IAAA,MAAA,cAAA,GAAA,YAAA,CAAA;AACA,IAAA,MAAA,aAAA,GAAA,GAAA,CAAA;AAGA,IAAA,MAAA,WAAA,GAAA,IAAA,CAAA,CAAA,CAAA,CAAA;AACA,IAAA,MAAA,KAAA,GAAA,IAAA,IAAA,CAAA,CAAA;AACA,IAAA,MAAA,KAAA,GAAA,IAAA,KAAA,CAAA,CAAA;AACA,IAAA,MAAA,OAAA,GAAA,EAAA,CAAA;AACA,IAAA,MAAA,KAAA,GAAA,GAAA,CAAA,EAAA,CAAA,CAAA;AAGA,IAAA,MAAA,YAAA,GAAA,SACA,MAAA,KAAA,CAAA,UAAA,OAAA,IAAA,CAAA,KAAA,CAAA,UAAA,CACA,CAAA,CAAA;AAEA,IAAA,MAAA,QAAA,GAAA,SAAA,MAAA;AACA,MAAA,OAAA,KAAA,CAAA,KAAA,CAAA,IAAA,CAAA,CAAA,IAAA,KAAA,IAAA,CAAA,KAAA,CAAA,KAAA,CAAA,QAAA,EAAA,CAAA,MAAA,GAAA,CAAA,CAAA,CAAA;AAAA,KACA,CAAA,CAAA;AAEA,IAAA,MAAA,eAAA,GAAA,SAAA,MAAA;AACA,MAAA,MAAA,OAAA,GAAA,CAAA,EAAA,CAAA,CAAA,IAAA,EAAA,CAAA,CAAA,CAAA,KAAA,CAAA,SAAA,CAAA,CAAA,CAAA;A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,CAAA,KAAA,EAAA,MAAA;AAAA,QACA,iBAAA,EAAA,CAAA;AACA,OAAA,CAAA,CAAA;AACA,MAAA,IAAA,KAAA,CAAA,YAAA,GAAA,KAAA,CAAA,KAAA,CAAA,MAAA,IAAA,KAAA,CAAA,YAAA,IAAA,CAAA,EAAA;AAAA,QACA,WAAA,CAAA,KAAA,GAAA,KAAA,CAAA,YAAA,CAAA;AACA,OAAA;AAAA,MACA,UAAA,EAAA,CAAA;AAEA,KAAA,CAAA,CAAA;AACA,IAAA,eAAA,CAAA,MAAA;AACA,MAAA;AAAA,MAAA,IAAA,IAAA,CAAA,KAAA,kBAAA,CAAA,KAAA;AAAA,QACA,cAAA,CAAA,KAAA,CAAA,IAAA,EAAA,CAAA;AAGA,KAAA,CAAA,CAAA;AAAA,IACA,OAAA,CAAA,kBAAA,EAAA;AAAA,MACA,IAAA;AAAA,MACA,UAAA;AAAA,MACA,UAAA;AAAA,MACA;AAAA,MACA,IAAA,EAAA,KAAA,CAAA,IAAA;AAAA,MACA,OAAA;AAAA,MACA,UAAA;AAAA,MACA,aAAA;AAEA,KAAA,CAAA,CAAA;AAAA,IAEA,MAAA,CAAA;AAAA,MAEA,aAAA;AAAA,MAEA,IAAA;AAAA,MACA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -33,8 +33,8 @@ function draggable(element, options) {
33
33
  isDragging = true;
34
34
  (_a = options.start) == null ? void 0 : _a.call(options, event);
35
35
  };
36
- document.addEventListener("mousedown", downFn);
37
- document.addEventListener("touchstart", downFn);
36
+ element.addEventListener("mousedown", downFn);
37
+ element.addEventListener("touchstart", downFn);
38
38
  }
39
39
 
40
40
  export { draggable as default };
@@ -1 +1 @@
1
- {"version":3,"file":"draggable.mjs","sources":["../../../../../../packages/components/color-picker/src/draggable.ts"],"sourcesContent":["import { isClient } from '@vueuse/core'\n\nlet isDragging = false\n\nexport declare interface IOptions {\n drag?: (event: Event) => void\n start?: (event: Event) => void\n end?: (event: Event) => void\n}\n\nexport default function (element: HTMLElement, options: IOptions) {\n if (!isClient) return\n\n const moveFn = function (event: Event) {\n options.drag?.(event)\n }\n\n const upFn = function (event: Event) {\n document.removeEventListener('mousemove', moveFn)\n document.removeEventListener('mouseup', upFn)\n document.removeEventListener('touchmove', moveFn)\n document.removeEventListener('touchend', upFn)\n document.onselectstart = null\n document.ondragstart = null\n\n isDragging = false\n\n options.end?.(event)\n }\n\n const downFn = function (event: Event) {\n if (isDragging) return\n event.preventDefault()\n document.onselectstart = () => false\n document.ondragstart = () => false\n document.addEventListener('mousemove', moveFn)\n document.addEventListener('mouseup', upFn)\n document.addEventListener('touchmove', moveFn)\n document.addEventListener('touchend', upFn)\n\n isDragging = true\n\n options.start?.(event)\n }\n\n document.addEventListener('mousedown', downFn)\n document.addEventListener('touchstart', downFn)\n}\n"],"names":[],"mappings":";;AACA,IAAI,UAAU,GAAG,KAAK,CAAC;AACR,kBAAQ,CAAC,OAAO,EAAE,OAAO,EAAE;AAC1C,EAAE,IAAI,CAAC,QAAQ;AACf,IAAI,OAAO;AACX,EAAE,MAAM,MAAM,GAAG,SAAS,KAAK,EAAE;AACjC,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACnE,GAAG,CAAC;AACJ,EAAE,MAAM,IAAI,GAAG,SAAS,KAAK,EAAE;AAC/B,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;AACtD,IAAI,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAClD,IAAI,QAAQ,CAAC,mBAAmB,CAA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,gBAAgB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AAClD;;;;"}
1
+ {"version":3,"file":"draggable.mjs","sources":["../../../../../../packages/components/color-picker/src/draggable.ts"],"sourcesContent":["import { isClient } from '@vueuse/core'\n\nlet isDragging = false\n\nexport declare interface IOptions {\n drag?: (event: Event) => void\n start?: (event: Event) => void\n end?: (event: Event) => void\n}\n\nexport default function (element: HTMLElement, options: IOptions) {\n if (!isClient) return\n\n const moveFn = function (event: Event) {\n options.drag?.(event)\n }\n\n const upFn = function (event: Event) {\n document.removeEventListener('mousemove', moveFn)\n document.removeEventListener('mouseup', upFn)\n document.removeEventListener('touchmove', moveFn)\n document.removeEventListener('touchend', upFn)\n document.onselectstart = null\n document.ondragstart = null\n\n isDragging = false\n\n options.end?.(event)\n }\n\n const downFn = function (event: Event) {\n if (isDragging) return\n event.preventDefault()\n document.onselectstart = () => false\n document.ondragstart = () => false\n document.addEventListener('mousemove', moveFn)\n document.addEventListener('mouseup', upFn)\n document.addEventListener('touchmove', moveFn)\n document.addEventListener('touchend', upFn)\n\n isDragging = true\n\n options.start?.(event)\n }\n\n element.addEventListener('mousedown', downFn)\n element.addEventListener('touchstart', downFn)\n}\n"],"names":[],"mappings":";;AACA,IAAI,UAAU,GAAG,KAAK,CAAC;AACR,kBAAQ,CAAC,OAAO,EAAE,OAAO,EAAE;AAC1C,EAAE,IAAI,CAAC,QAAQ;AACf,IAAI,OAAO;AACX,EAAE,MAAM,MAAM,GAAG,SAAS,KAAK,EAAE;AACjC,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACnE,GAAG,CAAC;AACJ,EAAE,MAAM,IAAI,GAAG,SAAS,KAAK,EAAE;AAC/B,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,QAAQ,CAAC,mBAAmB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C,OAAO,EAAE,KAAK,CAAC,CAAC;AACpE,GAAG,CAAC;AACJ,EAAE,OAAO,CAAC,gBAAgB,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;AAChD,EAAE,OAAO,CAAC,gBAAgB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AACjD;;;;"}
@@ -132,7 +132,6 @@ var Menu = defineComponent({
132
132
  const item = itemsInData[val] || activeIndex.value && itemsInData[activeIndex.value] || itemsInData[props.defaultActive];
133
133
  if (item) {
134
134
  activeIndex.value = item.index;
135
- initMenu();
136
135
  } else {
137
136
  activeIndex.value = val;
138
137
  }
@@ -150,6 +149,7 @@ var Menu = defineComponent({
150
149
  if (value)
151
150
  openedMenus.value = [];
152
151
  });
152
+ watch(items.value, initMenu);
153
153
  let resizeStopper;
154
154
  watchEffect(() => {
155
155
  if (props.mode === "horizontal" && props.ellipsis)
@@ -194,7 +194,6 @@ var Menu = defineComponent({
194
194
  });
195
195
  }
196
196
  onMounted(() => {
197
- initMenu();
198
197
  if (props.mode === "horizontal") {
199
198
  new Menu$1(instance.vnode.el, nsMenu.namespace.value);
200
199
  }
@@ -1 +1 @@
1
- {"version":3,"file":"menu.mjs","sources":["../../../../../../packages/components/menu/src/menu.ts"],"sourcesContent":["import {\n computed,\n defineComponent,\n getCurrentInstance,\n h,\n nextTick,\n onMounted,\n provide,\n reactive,\n ref,\n watch,\n watchEffect,\n} from 'vue'\nimport { useResizeObserver } from '@vueuse/core'\nimport ElIcon from '@element-plus/components/icon'\nimport { More } from '@element-plus/icons-vue'\nimport {\n buildProps,\n definePropType,\n isObject,\n isString,\n mutable,\n} from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport Menubar from './utils/menu-bar'\nimport ElMenuCollapseTransition from './menu-collapse-transition.vue'\nimport ElSubMenu from './sub-menu'\nimport { useMenuCssVar } from './use-menu-css-var'\n\nimport type { MenuItemClicked, MenuProvider, SubMenuProvider } from './types'\nimport type { NavigationFailure, Router } from 'vue-router'\nimport type { ExtractPropTypes, VNode, VNodeNormalizedChildren } from 'vue'\nimport type { UseResizeObserverReturn } from '@vueuse/core'\n\nexport const menuProps = buildProps({\n mode: {\n type: String,\n values: ['horizontal', 'vertical'],\n default: 'vertical',\n },\n defaultActive: {\n type: String,\n default: '',\n },\n defaultOpeneds: {\n type: definePropType<string[]>(Array),\n default: () => mutable([] as const),\n },\n uniqueOpened: Boolean,\n router: Boolean,\n menuTrigger: {\n type: String,\n values: ['hover', 'click'],\n default: 'hover',\n },\n collapse: Boolean,\n backgroundColor: String,\n textColor: String,\n activeTextColor: String,\n collapseTransition: {\n type: Boolean,\n default: true,\n },\n ellipsis: {\n type: Boolean,\n default: true,\n },\n} as const)\nexport type MenuProps = ExtractPropTypes<typeof menuProps>\n\nconst checkIndexPath = (indexPath: unknown): indexPath is string[] =>\n Array.isArray(indexPath) && indexPath.every((path) => isString(path))\n\nexport const menuEmits = {\n close: (index: string, indexPath: string[]) =>\n isString(index) && checkIndexPath(indexPath),\n\n open: (index: string, indexPath: string[]) =>\n isString(index) && checkIndexPath(indexPath),\n\n select: (\n index: string,\n indexPath: string[],\n item: MenuItemClicked,\n routerResult?: Promise<void | NavigationFailure>\n ) =>\n isString(index) &&\n checkIndexPath(indexPath) &&\n isObject(item) &&\n (routerResult === undefined || routerResult instanceof Promise),\n}\nexport type MenuEmits = typeof menuEmits\n\nexport default defineComponent({\n name: 'ElMenu',\n\n props: menuProps,\n emits: menuEmits,\n\n setup(props, { emit, slots, expose }) {\n const instance = getCurrentInstance()!\n const router = instance.appContext.config.globalProperties.$router as Router\n const menu = ref<HTMLUListElement>()\n const nsMenu = useNamespace('menu')\n const nsSubMenu = useNamespace('sub-menu')\n\n // data\n const openedMenus = ref<MenuProvider['openedMenus']>(\n props.defaultOpeneds && !props.collapse\n ? props.defaultOpeneds.slice(0)\n : []\n )\n const activeIndex = ref<MenuProvider['activeIndex']>(props.defaultActive)\n const items = ref<MenuProvider['items']>({})\n const subMenus = ref<MenuProvider['subMenus']>({})\n\n // computed\n const isMenuPopup = computed<MenuProvider['isMenuPopup']>(() => {\n return (\n props.mode === 'horizontal' ||\n (props.mode === 'vertical' && props.collapse)\n )\n })\n\n // methods\n const initMenu = () => {\n const activeItem = activeIndex.value && items.value[activeIndex.value]\n if (!activeItem || props.mode === 'horizontal' || props.collapse) return\n\n const indexPath = activeItem.indexPath\n\n // 展开该菜单项的路径上所有子菜单\n // expand all subMenus of the menu item\n indexPath.forEach((index) => {\n const subMenu = subMenus.value[index]\n subMenu && openMenu(index, subMenu.indexPath)\n })\n }\n\n const openMenu: MenuProvider['openMenu'] = (index, indexPath) => {\n if (openedMenus.value.includes(index)) return\n // 将不在该菜单路径下的其余菜单收起\n // collapse all menu that are not under current menu item\n if (props.uniqueOpened) {\n openedMenus.value = openedMenus.value.filter((index: string) =>\n indexPath.includes(index)\n )\n }\n openedMenus.value.push(index)\n emit('open', index, indexPath)\n }\n\n const closeMenu: MenuProvider['closeMenu'] = (index, indexPath) => {\n const i = openedMenus.value.indexOf(index)\n if (i !== -1) {\n openedMenus.value.splice(i, 1)\n }\n emit('close', index, indexPath)\n }\n\n const handleSubMenuClick: MenuProvider['handleSubMenuClick'] = ({\n index,\n indexPath,\n }) => {\n const isOpened = openedMenus.value.includes(index)\n\n if (isOpened) {\n closeMenu(index, indexPath)\n } else {\n openMenu(index, indexPath)\n }\n }\n\n const handleMenuItemClick: MenuProvider['handleMenuItemClick'] = (\n menuItem\n ) => {\n if (props.mode === 'horizontal' || props.collapse) {\n openedMenus.value = []\n }\n\n const { index, indexPath } = menuItem\n if (index === undefined || indexPath === undefined) return\n\n if (props.router && router) {\n const route = menuItem.route || index\n const routerResult = router.push(route).then((res) => {\n if (!res) activeIndex.value = index\n return res\n })\n emit(\n 'select',\n index,\n indexPath,\n { index, indexPath, route },\n routerResult\n )\n } else {\n activeIndex.value = index\n emit('select', index, indexPath, { index, indexPath })\n }\n }\n\n const updateActiveIndex = (val: string) => {\n const itemsInData = items.value\n const item =\n itemsInData[val] ||\n (activeIndex.value && itemsInData[activeIndex.value]) ||\n itemsInData[props.defaultActive]\n\n if (item) {\n activeIndex.value = item.index\n initMenu()\n } else {\n activeIndex.value = val\n }\n }\n\n const handleResize = () => {\n nextTick(() => instance.proxy!.$forceUpdate())\n }\n\n watch(\n () => props.defaultActive,\n (currentActive) => {\n if (!items.value[currentActive]) {\n activeIndex.value = ''\n }\n updateActiveIndex(currentActive)\n }\n )\n\n watch(\n () => props.collapse,\n (value) => {\n if (value) openedMenus.value = []\n }\n )\n\n let resizeStopper: UseResizeObserverReturn['stop']\n watchEffect(() => {\n if (props.mode === 'horizontal' && props.ellipsis)\n resizeStopper = useResizeObserver(menu, handleResize).stop\n else resizeStopper?.()\n })\n\n // provide\n {\n const addSubMenu: MenuProvider['addSubMenu'] = (item) => {\n subMenus.value[item.index] = item\n }\n\n const removeSubMenu: MenuProvider['removeSubMenu'] = (item) => {\n delete subMenus.value[item.index]\n }\n\n const addMenuItem: MenuProvider['addMenuItem'] = (item) => {\n items.value[item.index] = item\n }\n\n const removeMenuItem: MenuProvider['removeMenuItem'] = (item) => {\n delete items.value[item.index]\n }\n provide<MenuProvider>(\n 'rootMenu',\n reactive({\n props,\n openedMenus,\n items,\n subMenus,\n activeIndex,\n isMenuPopup,\n\n addMenuItem,\n removeMenuItem,\n addSubMenu,\n removeSubMenu,\n openMenu,\n closeMenu,\n handleMenuItemClick,\n handleSubMenuClick,\n })\n )\n provide<SubMenuProvider>(`subMenu:${instance.uid}`, {\n addSubMenu,\n removeSubMenu,\n mouseInChild: ref(false),\n level: 0,\n })\n }\n\n // lifecycle\n onMounted(() => {\n initMenu()\n if (props.mode === 'horizontal') {\n new Menubar(instance.vnode.el!, nsMenu.namespace.value)\n }\n })\n\n {\n const open = (index: string) => {\n const { indexPath } = subMenus.value[index]\n indexPath.forEach((i) => openMenu(i, indexPath))\n }\n expose({\n open,\n close: closeMenu,\n handleResize,\n })\n }\n\n const flattedChildren = (children: VNodeNormalizedChildren) => {\n const vnodes = Array.isArray(children) ? children : [children]\n const result: any[] = []\n vnodes.forEach((child: any) => {\n if (Array.isArray(child.children)) {\n result.push(...flattedChildren(child.children))\n } else {\n result.push(child)\n }\n })\n return result\n }\n\n return () => {\n let slot = slots.default?.() ?? []\n const vShowMore: VNode[] = []\n\n if (props.mode === 'horizontal' && menu.value) {\n const items = Array.from(menu.value?.childNodes ?? []).filter(\n (item) => item.nodeName !== '#text' || item.nodeValue\n ) as HTMLElement[]\n const originalSlot = flattedChildren(slot)\n const moreItemWidth = 64\n const paddingLeft = Number.parseInt(\n getComputedStyle(menu.value).paddingLeft,\n 10\n )\n const paddingRight = Number.parseInt(\n getComputedStyle(menu.value).paddingRight,\n 10\n )\n const menuWidth = menu.value.clientWidth - paddingLeft - paddingRight\n let calcWidth = 0\n let sliceIndex = 0\n items.forEach((item, index) => {\n calcWidth += item.offsetWidth || 0\n if (calcWidth <= menuWidth - moreItemWidth) {\n sliceIndex = index + 1\n }\n })\n const slotDefault = originalSlot.slice(0, sliceIndex)\n const slotMore = originalSlot.slice(sliceIndex)\n if (slotMore?.length && props.ellipsis) {\n slot = slotDefault\n vShowMore.push(\n h(\n ElSubMenu,\n {\n index: 'sub-menu-more',\n class: nsSubMenu.e('hide-arrow'),\n },\n {\n title: () =>\n h(\n ElIcon,\n {\n class: nsSubMenu.e('icon-more'),\n },\n { default: () => h(More) }\n ),\n default: () => slotMore,\n }\n )\n )\n }\n }\n\n const ulStyle = useMenuCssVar(props, 0)\n\n const vMenu = h(\n 'ul',\n {\n key: String(props.collapse),\n role: 'menubar',\n ref: menu,\n style: ulStyle.value,\n class: {\n [nsMenu.b()]: true,\n [nsMenu.m(props.mode)]: true,\n [nsMenu.m('collapse')]: props.collapse,\n },\n },\n [...slot, ...vShowMore]\n )\n\n if (props.collapseTransition && props.mode === 'vertical') {\n return h(ElMenuCollapseTransition, () => vMenu)\n }\n\n return vMenu\n }\n },\n})\n"],"names":["Menubar","ElSubMenu"],"mappings":";;;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,QAAQ,OAAO,CAAC,CAAC,wBAAwB,EAAE,MAAM,KAAK,CAAC,CAAC;AACxD,OAAO;AACP,MAAM,OAAO,KAAK,CAAC;AACnB,KAAK,CAAC;AACN,GAAG;AACH,CAAC,CAAC;;;;"}
1
+ {"version":3,"file":"menu.mjs","sources":["../../../../../../packages/components/menu/src/menu.ts"],"sourcesContent":["import {\n computed,\n defineComponent,\n getCurrentInstance,\n h,\n nextTick,\n onMounted,\n provide,\n reactive,\n ref,\n watch,\n watchEffect,\n} from 'vue'\nimport { useResizeObserver } from '@vueuse/core'\nimport ElIcon from '@element-plus/components/icon'\nimport { More } from '@element-plus/icons-vue'\nimport {\n buildProps,\n definePropType,\n isObject,\n isString,\n mutable,\n} from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport Menubar from './utils/menu-bar'\nimport ElMenuCollapseTransition from './menu-collapse-transition.vue'\nimport ElSubMenu from './sub-menu'\nimport { useMenuCssVar } from './use-menu-css-var'\n\nimport type { MenuItemClicked, MenuProvider, SubMenuProvider } from './types'\nimport type { NavigationFailure, Router } from 'vue-router'\nimport type { ExtractPropTypes, VNode, VNodeNormalizedChildren } from 'vue'\nimport type { UseResizeObserverReturn } from '@vueuse/core'\n\nexport const menuProps = buildProps({\n mode: {\n type: String,\n values: ['horizontal', 'vertical'],\n default: 'vertical',\n },\n defaultActive: {\n type: String,\n default: '',\n },\n defaultOpeneds: {\n type: definePropType<string[]>(Array),\n default: () => mutable([] as const),\n },\n uniqueOpened: Boolean,\n router: Boolean,\n menuTrigger: {\n type: String,\n values: ['hover', 'click'],\n default: 'hover',\n },\n collapse: Boolean,\n backgroundColor: String,\n textColor: String,\n activeTextColor: String,\n collapseTransition: {\n type: Boolean,\n default: true,\n },\n ellipsis: {\n type: Boolean,\n default: true,\n },\n} as const)\nexport type MenuProps = ExtractPropTypes<typeof menuProps>\n\nconst checkIndexPath = (indexPath: unknown): indexPath is string[] =>\n Array.isArray(indexPath) && indexPath.every((path) => isString(path))\n\nexport const menuEmits = {\n close: (index: string, indexPath: string[]) =>\n isString(index) && checkIndexPath(indexPath),\n\n open: (index: string, indexPath: string[]) =>\n isString(index) && checkIndexPath(indexPath),\n\n select: (\n index: string,\n indexPath: string[],\n item: MenuItemClicked,\n routerResult?: Promise<void | NavigationFailure>\n ) =>\n isString(index) &&\n checkIndexPath(indexPath) &&\n isObject(item) &&\n (routerResult === undefined || routerResult instanceof Promise),\n}\nexport type MenuEmits = typeof menuEmits\n\nexport default defineComponent({\n name: 'ElMenu',\n\n props: menuProps,\n emits: menuEmits,\n\n setup(props, { emit, slots, expose }) {\n const instance = getCurrentInstance()!\n const router = instance.appContext.config.globalProperties.$router as Router\n const menu = ref<HTMLUListElement>()\n const nsMenu = useNamespace('menu')\n const nsSubMenu = useNamespace('sub-menu')\n\n // data\n const openedMenus = ref<MenuProvider['openedMenus']>(\n props.defaultOpeneds && !props.collapse\n ? props.defaultOpeneds.slice(0)\n : []\n )\n const activeIndex = ref<MenuProvider['activeIndex']>(props.defaultActive)\n const items = ref<MenuProvider['items']>({})\n const subMenus = ref<MenuProvider['subMenus']>({})\n\n // computed\n const isMenuPopup = computed<MenuProvider['isMenuPopup']>(() => {\n return (\n props.mode === 'horizontal' ||\n (props.mode === 'vertical' && props.collapse)\n )\n })\n\n // methods\n const initMenu = () => {\n const activeItem = activeIndex.value && items.value[activeIndex.value]\n if (!activeItem || props.mode === 'horizontal' || props.collapse) return\n\n const indexPath = activeItem.indexPath\n\n // 展开该菜单项的路径上所有子菜单\n // expand all subMenus of the menu item\n indexPath.forEach((index) => {\n const subMenu = subMenus.value[index]\n subMenu && openMenu(index, subMenu.indexPath)\n })\n }\n\n const openMenu: MenuProvider['openMenu'] = (index, indexPath) => {\n if (openedMenus.value.includes(index)) return\n // 将不在该菜单路径下的其余菜单收起\n // collapse all menu that are not under current menu item\n if (props.uniqueOpened) {\n openedMenus.value = openedMenus.value.filter((index: string) =>\n indexPath.includes(index)\n )\n }\n openedMenus.value.push(index)\n emit('open', index, indexPath)\n }\n\n const closeMenu: MenuProvider['closeMenu'] = (index, indexPath) => {\n const i = openedMenus.value.indexOf(index)\n if (i !== -1) {\n openedMenus.value.splice(i, 1)\n }\n emit('close', index, indexPath)\n }\n\n const handleSubMenuClick: MenuProvider['handleSubMenuClick'] = ({\n index,\n indexPath,\n }) => {\n const isOpened = openedMenus.value.includes(index)\n\n if (isOpened) {\n closeMenu(index, indexPath)\n } else {\n openMenu(index, indexPath)\n }\n }\n\n const handleMenuItemClick: MenuProvider['handleMenuItemClick'] = (\n menuItem\n ) => {\n if (props.mode === 'horizontal' || props.collapse) {\n openedMenus.value = []\n }\n\n const { index, indexPath } = menuItem\n if (index === undefined || indexPath === undefined) return\n\n if (props.router && router) {\n const route = menuItem.route || index\n const routerResult = router.push(route).then((res) => {\n if (!res) activeIndex.value = index\n return res\n })\n emit(\n 'select',\n index,\n indexPath,\n { index, indexPath, route },\n routerResult\n )\n } else {\n activeIndex.value = index\n emit('select', index, indexPath, { index, indexPath })\n }\n }\n\n const updateActiveIndex = (val: string) => {\n const itemsInData = items.value\n const item =\n itemsInData[val] ||\n (activeIndex.value && itemsInData[activeIndex.value]) ||\n itemsInData[props.defaultActive]\n\n if (item) {\n activeIndex.value = item.index\n } else {\n activeIndex.value = val\n }\n }\n\n const handleResize = () => {\n nextTick(() => instance.proxy!.$forceUpdate())\n }\n\n watch(\n () => props.defaultActive,\n (currentActive) => {\n if (!items.value[currentActive]) {\n activeIndex.value = ''\n }\n updateActiveIndex(currentActive)\n }\n )\n\n watch(\n () => props.collapse,\n (value) => {\n if (value) openedMenus.value = []\n }\n )\n\n watch(items.value, initMenu)\n\n let resizeStopper: UseResizeObserverReturn['stop']\n watchEffect(() => {\n if (props.mode === 'horizontal' && props.ellipsis)\n resizeStopper = useResizeObserver(menu, handleResize).stop\n else resizeStopper?.()\n })\n\n // provide\n {\n const addSubMenu: MenuProvider['addSubMenu'] = (item) => {\n subMenus.value[item.index] = item\n }\n\n const removeSubMenu: MenuProvider['removeSubMenu'] = (item) => {\n delete subMenus.value[item.index]\n }\n\n const addMenuItem: MenuProvider['addMenuItem'] = (item) => {\n items.value[item.index] = item\n }\n\n const removeMenuItem: MenuProvider['removeMenuItem'] = (item) => {\n delete items.value[item.index]\n }\n provide<MenuProvider>(\n 'rootMenu',\n reactive({\n props,\n openedMenus,\n items,\n subMenus,\n activeIndex,\n isMenuPopup,\n\n addMenuItem,\n removeMenuItem,\n addSubMenu,\n removeSubMenu,\n openMenu,\n closeMenu,\n handleMenuItemClick,\n handleSubMenuClick,\n })\n )\n provide<SubMenuProvider>(`subMenu:${instance.uid}`, {\n addSubMenu,\n removeSubMenu,\n mouseInChild: ref(false),\n level: 0,\n })\n }\n\n // lifecycle\n onMounted(() => {\n if (props.mode === 'horizontal') {\n new Menubar(instance.vnode.el!, nsMenu.namespace.value)\n }\n })\n\n {\n const open = (index: string) => {\n const { indexPath } = subMenus.value[index]\n indexPath.forEach((i) => openMenu(i, indexPath))\n }\n expose({\n open,\n close: closeMenu,\n handleResize,\n })\n }\n\n const flattedChildren = (children: VNodeNormalizedChildren) => {\n const vnodes = Array.isArray(children) ? children : [children]\n const result: any[] = []\n vnodes.forEach((child: any) => {\n if (Array.isArray(child.children)) {\n result.push(...flattedChildren(child.children))\n } else {\n result.push(child)\n }\n })\n return result\n }\n\n return () => {\n let slot = slots.default?.() ?? []\n const vShowMore: VNode[] = []\n\n if (props.mode === 'horizontal' && menu.value) {\n const items = Array.from(menu.value?.childNodes ?? []).filter(\n (item) => item.nodeName !== '#text' || item.nodeValue\n ) as HTMLElement[]\n const originalSlot = flattedChildren(slot)\n const moreItemWidth = 64\n const paddingLeft = Number.parseInt(\n getComputedStyle(menu.value).paddingLeft,\n 10\n )\n const paddingRight = Number.parseInt(\n getComputedStyle(menu.value).paddingRight,\n 10\n )\n const menuWidth = menu.value.clientWidth - paddingLeft - paddingRight\n let calcWidth = 0\n let sliceIndex = 0\n items.forEach((item, index) => {\n calcWidth += item.offsetWidth || 0\n if (calcWidth <= menuWidth - moreItemWidth) {\n sliceIndex = index + 1\n }\n })\n const slotDefault = originalSlot.slice(0, sliceIndex)\n const slotMore = originalSlot.slice(sliceIndex)\n if (slotMore?.length && props.ellipsis) {\n slot = slotDefault\n vShowMore.push(\n h(\n ElSubMenu,\n {\n index: 'sub-menu-more',\n class: nsSubMenu.e('hide-arrow'),\n },\n {\n title: () =>\n h(\n ElIcon,\n {\n class: nsSubMenu.e('icon-more'),\n },\n { default: () => h(More) }\n ),\n default: () => slotMore,\n }\n )\n )\n }\n }\n\n const ulStyle = useMenuCssVar(props, 0)\n\n const vMenu = h(\n 'ul',\n {\n key: String(props.collapse),\n role: 'menubar',\n ref: menu,\n style: ulStyle.value,\n class: {\n [nsMenu.b()]: true,\n [nsMenu.m(props.mode)]: true,\n [nsMenu.m('collapse')]: props.collapse,\n },\n },\n [...slot, ...vShowMore]\n )\n\n if (props.collapseTransition && props.mode === 'vertical') {\n return h(ElMenuCollapseTransition, () => vMenu)\n }\n\n return vMenu\n }\n },\n})\n"],"names":["Menubar","ElSubMenu"],"mappings":";;;;;;;;;;;;;;;AA4BY,MAAC,SAAS,GAAG,UAAU,CAAC;AACpC,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,YAAY,EAAE,UAAU,CAAC;AACtC,IAAI,OAAO,EAAE,UAAU;AACvB,GAAG;AACH,EAAE,aAAa,EAAE;AACjB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,cAAc,EAAE;AAClB,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,MAAM,OAAO,CAAC,EAAE,CAAC;AAC9B,GAAG;AACH,EAAE,YAAY,EAAE,OAAO;AACvB,EAAE,MAAM,EAAE,OAAO;AACjB,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,MAAM;AAChB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AAO,GAAG,aAAa,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;AAC9C,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,IAAI,EAAE;AAC5B,QAAQ,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC;AACnC,QAAQ,IAAI,EAAE,SAAS;AACvB,QAAQ,GAAG,EAAE,IAAI;AACjB,QAAQ,KAAK,EAAE,OAAO,CAAC,KAAK;AAC5B,QAAQ,KAAK,EAAE;AACf,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,IAAI;AAC5B,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI;AACtC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ;AAChD,SAAS;AACT,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC;AAClC,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE;AACjE,QAAQ,OAAO,CAAC,CAAC,wBAAwB,EAAE,MAAM,KAAK,CAAC,CAAC;AACxD,OAAO;AACP,MAAM,OAAO,KAAK,CAAC;AACnB,KAAK,CAAC;AACN,GAAG;AACH,CAAC,CAAC;;;;"}
@@ -34,9 +34,9 @@ const notify = function(options = {}, context = null) {
34
34
  const id = `notification_${seed++}`;
35
35
  const userOnClose = options.onClose;
36
36
  const props = {
37
+ ...options,
37
38
  zIndex: nextZIndex(),
38
39
  offset: verticalOffset,
39
- ...options,
40
40
  id,
41
41
  onClose: () => {
42
42
  close(id, position, userOnClose);
@@ -1 +1 @@
1
- {"version":3,"file":"notify.mjs","sources":["../../../../../../packages/components/notification/src/notify.ts"],"sourcesContent":["import { createVNode, render } from 'vue'\nimport { isClient } from '@vueuse/core'\nimport { useZIndex } from '@element-plus/hooks'\nimport { debugWarn, isElement, isString, isVNode } from '@element-plus/utils'\nimport NotificationConstructor from './notification.vue'\nimport { notificationTypes } from './notification'\n\nimport type { AppContext, ComponentPublicInstance, VNode } from 'vue'\nimport type {\n NotificationOptions,\n NotificationProps,\n NotificationQueue,\n Notify,\n NotifyFn,\n} from './notification'\n\n// This should be a queue but considering there were `non-autoclosable` notifications.\nconst notifications: Record<\n NotificationOptions['position'],\n NotificationQueue\n> = {\n 'top-left': [],\n 'top-right': [],\n 'bottom-left': [],\n 'bottom-right': [],\n}\n\n// the gap size between each notification\nconst GAP_SIZE = 16\nlet seed = 1\n\nconst notify: NotifyFn & Partial<Notify> & { _context: AppContext | null } =\n function (options = {}, context: AppContext | null = null) {\n if (!isClient) return { close: () => undefined }\n\n if (typeof options === 'string' || isVNode(options)) {\n options = { message: options }\n }\n\n const position = options.position || 'top-right'\n\n let verticalOffset = options.offset || 0\n notifications[position].forEach(({ vm }) => {\n verticalOffset += (vm.el?.offsetHeight || 0) + GAP_SIZE\n })\n verticalOffset += GAP_SIZE\n\n const { nextZIndex } = useZIndex()\n\n const id = `notification_${seed++}`\n const userOnClose = options.onClose\n const props: Partial<NotificationProps> = {\n // default options end\n zIndex: nextZIndex(),\n offset: verticalOffset,\n ...options,\n id,\n onClose: () => {\n close(id, position, userOnClose)\n },\n }\n\n let appendTo: HTMLElement | null = document.body\n if (isElement(options.appendTo)) {\n appendTo = options.appendTo\n } else if (isString(options.appendTo)) {\n appendTo = document.querySelector(options.appendTo)\n }\n\n // should fallback to default value with a warning\n if (!isElement(appendTo)) {\n debugWarn(\n 'ElNotification',\n 'the appendTo option is not an HTMLElement. Falling back to document.body.'\n )\n appendTo = document.body\n }\n\n const container = document.createElement('div')\n\n const vm = createVNode(\n NotificationConstructor,\n props,\n isVNode(props.message)\n ? {\n default: () => props.message,\n }\n : null\n )\n vm.appContext = context ?? notify._context\n\n // clean notification element preventing mem leak\n vm.props!.onDestroy = () => {\n render(null, container)\n }\n\n // instances will remove this item when close function gets called. So we do not need to worry about it.\n render(vm, container)\n notifications[position].push({ vm })\n appendTo.appendChild(container.firstElementChild!)\n\n return {\n // instead of calling the onClose function directly, setting this value so that we can have the full lifecycle\n // for out component, so that all closing steps will not be skipped.\n close: () => {\n ;(\n vm.component!.proxy as ComponentPublicInstance<{ visible: boolean }>\n ).visible = false\n },\n }\n }\nnotificationTypes.forEach((type) => {\n notify[type] = (options = {}) => {\n if (typeof options === 'string' || isVNode(options)) {\n options = {\n message: options,\n }\n }\n return notify({\n ...options,\n type,\n })\n }\n})\n\n/**\n * This function gets called when user click `x` button or press `esc` or the time reached its limitation.\n * Emitted by transition@before-leave event so that we can fetch the current notification.offsetHeight, if this was called\n * by @after-leave the DOM element will be removed from the page thus we can no longer fetch the offsetHeight.\n * @param {String} id notification id to be closed\n * @param {Position} position the positioning strategy\n * @param {Function} userOnClose the callback called when close passed by user\n */\nexport function close(\n id: string,\n position: NotificationOptions['position'],\n userOnClose?: (vm: VNode) => void\n): void {\n // maybe we can store the index when inserting the vm to notification list.\n const orientedNotifications = notifications[position]\n const idx = orientedNotifications.findIndex(\n ({ vm }) => vm.component?.props.id === id\n )\n if (idx === -1) return\n const { vm } = orientedNotifications[idx]\n if (!vm) return\n // calling user's on close function before notification gets removed from DOM.\n userOnClose?.(vm)\n\n // note that this is called @before-leave, that's why we were able to fetch this property.\n const removedHeight = vm.el!.offsetHeight\n const verticalPos = position.split('-')[0]\n orientedNotifications.splice(idx, 1)\n const len = orientedNotifications.length\n if (len < 1) return\n // starting from the removing item.\n for (let i = idx; i < len; i++) {\n // new position equals the current offsetTop minus removed height plus 16px(the gap size between each item)\n const { el, component } = orientedNotifications[i].vm\n const pos =\n Number.parseInt(el!.style[verticalPos], 10) - removedHeight - GAP_SIZE\n component!.props.offset = pos\n }\n}\n\nexport function closeAll(): void {\n // loop through all directions, close them at once.\n for (const orientedNotifications of Object.values(notifications)) {\n orientedNotifications.forEach(({ vm }) => {\n // same as the previous close method, we'd like to make sure lifecycle gets handle properly.\n ;(\n vm.component!.proxy as ComponentPublicInstance<{ visible: boolean }>\n ).visible = false\n })\n }\n}\n\nnotify.closeAll = closeAll\nnotify._context = null\n\nexport default notify as Notify\n"],"names":[],"mappings":";;;;;;;;;;;AAMA,MAAM,aAAa,GAAG;AACtB,EAAE,UAAU,EAAE,EAAE;AAChB,EAAE,WAAW,EAAE,EAAE;AACjB,EAAE,aAAa,EAAE,EAAE;AACnB,EAAE,cAAc,EAAE,EAAE;AACpB,CAAC,CAAC;AACF,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,IAAI,IAAI,GAAG,CAAC,CAAC;AACR,MAAC,MAAM,GAAG,SAAS,OAAO,GAAG,EAAE,EAAE,OAAO,GAAG,IAAI,EAAE;AACtD,EAAE,IAAI,CAAC,QAAQ;AACf,IAAI,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC,EAAE,CAAC;AACnC,EAAE,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;AACvD,IAAI,OAAO,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AACnC,GAAG;AACH,EAAE,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,WAAW,CAAC;AACnD,EAAE,IAAI,cAAc,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;AAC3C,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK;AACnD,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,cAAc,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,YAAY,KAAK,CAAC,IAAI,QAAQ,CAAC;AAC3F,GAAG,CAAC,CAAC;AACL,EAAE,cAAc,IAAI,QAAQ,CAAC;AAC7B,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,SAAS,EAAE,CAAC;AACrC,EAAE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,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE;AACpE,IAAI,qBAAqB,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK;AAC9C,MAAM,CAAC;AACP,MAAM,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;AACzC,KAAK,CAAC,CAAC;AACP,GAAG;AACH,CAAC;AACD,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC3B,MAAM,CAAC,QAAQ,GAAG,IAAI;;;;"}
1
+ {"version":3,"file":"notify.mjs","sources":["../../../../../../packages/components/notification/src/notify.ts"],"sourcesContent":["import { createVNode, render } from 'vue'\nimport { isClient } from '@vueuse/core'\nimport { useZIndex } from '@element-plus/hooks'\nimport { debugWarn, isElement, isString, isVNode } from '@element-plus/utils'\nimport NotificationConstructor from './notification.vue'\nimport { notificationTypes } from './notification'\n\nimport type { AppContext, ComponentPublicInstance, VNode } from 'vue'\nimport type {\n NotificationOptions,\n NotificationProps,\n NotificationQueue,\n Notify,\n NotifyFn,\n} from './notification'\n\n// This should be a queue but considering there were `non-autoclosable` notifications.\nconst notifications: Record<\n NotificationOptions['position'],\n NotificationQueue\n> = {\n 'top-left': [],\n 'top-right': [],\n 'bottom-left': [],\n 'bottom-right': [],\n}\n\n// the gap size between each notification\nconst GAP_SIZE = 16\nlet seed = 1\n\nconst notify: NotifyFn & Partial<Notify> & { _context: AppContext | null } =\n function (options = {}, context: AppContext | null = null) {\n if (!isClient) return { close: () => undefined }\n\n if (typeof options === 'string' || isVNode(options)) {\n options = { message: options }\n }\n\n const position = options.position || 'top-right'\n\n let verticalOffset = options.offset || 0\n notifications[position].forEach(({ vm }) => {\n verticalOffset += (vm.el?.offsetHeight || 0) + GAP_SIZE\n })\n verticalOffset += GAP_SIZE\n\n const { nextZIndex } = useZIndex()\n\n const id = `notification_${seed++}`\n const userOnClose = options.onClose\n const props: Partial<NotificationProps> = {\n ...options,\n zIndex: nextZIndex(),\n offset: verticalOffset,\n id,\n onClose: () => {\n close(id, position, userOnClose)\n },\n }\n\n let appendTo: HTMLElement | null = document.body\n if (isElement(options.appendTo)) {\n appendTo = options.appendTo\n } else if (isString(options.appendTo)) {\n appendTo = document.querySelector(options.appendTo)\n }\n\n // should fallback to default value with a warning\n if (!isElement(appendTo)) {\n debugWarn(\n 'ElNotification',\n 'the appendTo option is not an HTMLElement. Falling back to document.body.'\n )\n appendTo = document.body\n }\n\n const container = document.createElement('div')\n\n const vm = createVNode(\n NotificationConstructor,\n props,\n isVNode(props.message)\n ? {\n default: () => props.message,\n }\n : null\n )\n vm.appContext = context ?? notify._context\n\n // clean notification element preventing mem leak\n vm.props!.onDestroy = () => {\n render(null, container)\n }\n\n // instances will remove this item when close function gets called. So we do not need to worry about it.\n render(vm, container)\n notifications[position].push({ vm })\n appendTo.appendChild(container.firstElementChild!)\n\n return {\n // instead of calling the onClose function directly, setting this value so that we can have the full lifecycle\n // for out component, so that all closing steps will not be skipped.\n close: () => {\n ;(\n vm.component!.proxy as ComponentPublicInstance<{ visible: boolean }>\n ).visible = false\n },\n }\n }\nnotificationTypes.forEach((type) => {\n notify[type] = (options = {}) => {\n if (typeof options === 'string' || isVNode(options)) {\n options = {\n message: options,\n }\n }\n return notify({\n ...options,\n type,\n })\n }\n})\n\n/**\n * This function gets called when user click `x` button or press `esc` or the time reached its limitation.\n * Emitted by transition@before-leave event so that we can fetch the current notification.offsetHeight, if this was called\n * by @after-leave the DOM element will be removed from the page thus we can no longer fetch the offsetHeight.\n * @param {String} id notification id to be closed\n * @param {Position} position the positioning strategy\n * @param {Function} userOnClose the callback called when close passed by user\n */\nexport function close(\n id: string,\n position: NotificationOptions['position'],\n userOnClose?: (vm: VNode) => void\n): void {\n // maybe we can store the index when inserting the vm to notification list.\n const orientedNotifications = notifications[position]\n const idx = orientedNotifications.findIndex(\n ({ vm }) => vm.component?.props.id === id\n )\n if (idx === -1) return\n const { vm } = orientedNotifications[idx]\n if (!vm) return\n // calling user's on close function before notification gets removed from DOM.\n userOnClose?.(vm)\n\n // note that this is called @before-leave, that's why we were able to fetch this property.\n const removedHeight = vm.el!.offsetHeight\n const verticalPos = position.split('-')[0]\n orientedNotifications.splice(idx, 1)\n const len = orientedNotifications.length\n if (len < 1) return\n // starting from the removing item.\n for (let i = idx; i < len; i++) {\n // new position equals the current offsetTop minus removed height plus 16px(the gap size between each item)\n const { el, component } = orientedNotifications[i].vm\n const pos =\n Number.parseInt(el!.style[verticalPos], 10) - removedHeight - GAP_SIZE\n component!.props.offset = pos\n }\n}\n\nexport function closeAll(): void {\n // loop through all directions, close them at once.\n for (const orientedNotifications of Object.values(notifications)) {\n orientedNotifications.forEach(({ vm }) => {\n // same as the previous close method, we'd like to make sure lifecycle gets handle properly.\n ;(\n vm.component!.proxy as ComponentPublicInstance<{ visible: boolean }>\n ).visible = false\n })\n }\n}\n\nnotify.closeAll = closeAll\nnotify._context = null\n\nexport default notify as Notify\n"],"names":[],"mappings":";;;;;;;;;;;AAMA,MAAM,aAAa,GAAG;AACtB,EAAE,UAAU,EAAE,EAAE;AAChB,EAAE,WAAW,EAAE,EAAE;AACjB,EAAE,aAAa,EAAE,EAAE;AACnB,EAAE,cAAc,EAAE,EAAE;AACpB,CAAC,CAAC;AACF,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,IAAI,IAAI,GAAG,CAAC,CAAC;AACR,MAAC,MAAM,GAAG,SAAS,OAAO,GAAG,EAAE,EAAE,OAAO,GAAG,IAAI,EAAE;AACtD,EAAE,IAAI,CAAC,QAAQ;AACf,IAAI,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC,EAAE,CAAC;AACnC,EAAE,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;AACvD,IAAI,OAAO,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AACnC,GAAG;AACH,EAAE,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,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AAC;AACb,IAAI,OAAO;AACX,EAAE,KAAK,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;AAClC,IAAI,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1D,IAAI,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,GAAG,aAAa,GAAG,QAAQ,CAAC;AACtF,IAAI,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC;AACjC,GAAG;AACH,CAAC;AACM,SAAS,QAAQ,GAAG;AAC3B,EAAE,KAAK,MAAM,qBAAqB,IAAI,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE;AACpE,IAAI,qBAAqB,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK;AAC9C,MAAM,CAAC;AACP,MAAM,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;AACzC,KAAK,CAAC,CAAC;AACP,GAAG;AACH,CAAC;AACD,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC3B,MAAM,CAAC,QAAQ,GAAG,IAAI;;;;"}
@@ -1,4 +1,4 @@
1
- import { isVNode, defineComponent, renderSlot, createVNode, createTextVNode } from 'vue';
1
+ import { isVNode, defineComponent, createVNode, renderSlot, createTextVNode } from 'vue';
2
2
  import { isString, isArray } from '@vue/shared';
3
3
  import '../../../utils/index.mjs';
4
4
  import '../../../constants/index.mjs';
@@ -58,37 +58,45 @@ var Space = defineComponent({
58
58
  props: spaceProps,
59
59
  setup(props, { slots }) {
60
60
  const { classes, containerStyle, itemStyle } = useSpace(props);
61
- return () => {
62
- var _a;
63
- const { spacer, prefixCls, direction } = props;
64
- const children = renderSlot(slots, "default", { key: 0 }, () => []);
65
- if (((_a = children.children) != null ? _a : []).length === 0)
66
- return null;
67
- if (isArray(children.children)) {
68
- let extractedChildren = [];
69
- children.children.forEach((child, loopKey) => {
70
- if (isFragment(child)) {
71
- if (isArray(child.children)) {
72
- child.children.forEach((nested, key) => {
61
+ function extractChildren(children, parentKey = "", extractedChildren = []) {
62
+ const { prefixCls } = props;
63
+ children.forEach((child, loopKey) => {
64
+ if (isFragment(child)) {
65
+ if (isArray(child.children)) {
66
+ child.children.forEach((nested, key) => {
67
+ if (isFragment(nested) && isArray(nested.children)) {
68
+ extractChildren(nested.children, `${parentKey + key}-`, extractedChildren);
69
+ } else {
73
70
  extractedChildren.push(createVNode(SpaceItem, {
74
71
  style: itemStyle.value,
75
72
  prefixCls,
76
- key: `nested-${key}`
73
+ key: `nested-${parentKey + key}`
77
74
  }, {
78
75
  default: () => [nested]
79
76
  }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
80
- });
81
- }
82
- } else if (isValidElementNode(child)) {
83
- extractedChildren.push(createVNode(SpaceItem, {
84
- style: itemStyle.value,
85
- prefixCls,
86
- key: `LoopKey${loopKey}`
87
- }, {
88
- default: () => [child]
89
- }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
77
+ }
78
+ });
90
79
  }
91
- });
80
+ } else if (isValidElementNode(child)) {
81
+ extractedChildren.push(createVNode(SpaceItem, {
82
+ style: itemStyle.value,
83
+ prefixCls,
84
+ key: `LoopKey${parentKey + loopKey}`
85
+ }, {
86
+ default: () => [child]
87
+ }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
88
+ }
89
+ });
90
+ return extractedChildren;
91
+ }
92
+ return () => {
93
+ var _a;
94
+ const { spacer, direction } = props;
95
+ const children = renderSlot(slots, "default", { key: 0 }, () => []);
96
+ if (((_a = children.children) != null ? _a : []).length === 0)
97
+ return null;
98
+ if (isArray(children.children)) {
99
+ let extractedChildren = extractChildren(children.children);
92
100
  if (spacer) {
93
101
  const len = extractedChildren.length - 1;
94
102
  extractedChildren = extractedChildren.reduce((acc, child, idx) => {