element-pe 2.0.6 → 2.0.7

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 (302) hide show
  1. package/dist/index.full.js +1 -1
  2. package/dist/index.full.min.js +1 -1
  3. package/dist/index.full.min.js.map +1 -1
  4. package/dist/index.full.min.mjs +1 -1
  5. package/dist/index.full.min.mjs.map +1 -1
  6. package/dist/index.full.mjs +1 -1
  7. package/es/components/affix/index.mjs +2 -2
  8. package/es/components/affix/src/affix.mjs +114 -23
  9. package/es/components/affix/src/affix.mjs.map +1 -1
  10. package/es/components/affix/src/affix2.mjs +23 -114
  11. package/es/components/affix/src/affix2.mjs.map +1 -1
  12. package/es/components/autocomplete/index.mjs +2 -2
  13. package/es/components/autocomplete/src/autocomplete.mjs +325 -67
  14. package/es/components/autocomplete/src/autocomplete.mjs.map +1 -1
  15. package/es/components/autocomplete/src/autocomplete2.mjs +67 -325
  16. package/es/components/autocomplete/src/autocomplete2.mjs.map +1 -1
  17. package/es/components/backtop/index.mjs +2 -2
  18. package/es/components/backtop/src/backtop.mjs +100 -21
  19. package/es/components/backtop/src/backtop.mjs.map +1 -1
  20. package/es/components/backtop/src/backtop2.mjs +21 -100
  21. package/es/components/backtop/src/backtop2.mjs.map +1 -1
  22. package/es/components/breadcrumb/index.mjs +2 -2
  23. package/es/components/breadcrumb/src/breadcrumb-item.mjs +11 -57
  24. package/es/components/breadcrumb/src/breadcrumb-item.mjs.map +1 -1
  25. package/es/components/breadcrumb/src/breadcrumb-item2.mjs +57 -11
  26. package/es/components/breadcrumb/src/breadcrumb-item2.mjs.map +1 -1
  27. package/es/components/button/index.mjs +3 -3
  28. package/es/components/button/src/button-group.mjs +5 -30
  29. package/es/components/button/src/button-group.mjs.map +1 -1
  30. package/es/components/button/src/button-group2.mjs +30 -5
  31. package/es/components/button/src/button-group2.mjs.map +1 -1
  32. package/es/components/button/src/button.mjs +106 -51
  33. package/es/components/button/src/button.mjs.map +1 -1
  34. package/es/components/button/src/button2.mjs +51 -106
  35. package/es/components/button/src/button2.mjs.map +1 -1
  36. package/es/components/carousel/index.mjs +2 -2
  37. package/es/components/carousel/src/carousel.mjs +48 -319
  38. package/es/components/carousel/src/carousel.mjs.map +1 -1
  39. package/es/components/carousel/src/carousel2.mjs +319 -48
  40. package/es/components/carousel/src/carousel2.mjs.map +1 -1
  41. package/es/components/dialog/index.mjs +2 -2
  42. package/es/components/dialog/src/dialog.mjs +113 -70
  43. package/es/components/dialog/src/dialog.mjs.map +1 -1
  44. package/es/components/dialog/src/dialog2.mjs +70 -113
  45. package/es/components/dialog/src/dialog2.mjs.map +1 -1
  46. package/es/components/drawer/index.mjs +2 -2
  47. package/es/components/drawer/src/drawer.mjs +21 -126
  48. package/es/components/drawer/src/drawer.mjs.map +1 -1
  49. package/es/components/drawer/src/drawer2.mjs +126 -21
  50. package/es/components/drawer/src/drawer2.mjs.map +1 -1
  51. package/es/components/empty/index.mjs +2 -2
  52. package/es/components/empty/src/empty.mjs +11 -56
  53. package/es/components/empty/src/empty.mjs.map +1 -1
  54. package/es/components/empty/src/empty2.mjs +56 -11
  55. package/es/components/empty/src/empty2.mjs.map +1 -1
  56. package/es/components/form/index.mjs +2 -2
  57. package/es/components/form/src/form-item.mjs +43 -272
  58. package/es/components/form/src/form-item.mjs.map +1 -1
  59. package/es/components/form/src/form-item2.mjs +272 -43
  60. package/es/components/form/src/form-item2.mjs.map +1 -1
  61. package/es/components/icon/index.mjs +2 -2
  62. package/es/components/icon/src/icon.mjs +35 -8
  63. package/es/components/icon/src/icon.mjs.map +1 -1
  64. package/es/components/icon/src/icon2.mjs +8 -35
  65. package/es/components/icon/src/icon2.mjs.map +1 -1
  66. package/es/components/index.mjs +26 -26
  67. package/es/components/input/index.mjs +2 -2
  68. package/es/components/input/src/input.mjs +92 -433
  69. package/es/components/input/src/input.mjs.map +1 -1
  70. package/es/components/input/src/input2.mjs +433 -92
  71. package/es/components/input/src/input2.mjs.map +1 -1
  72. package/es/components/input-number/index.mjs +2 -2
  73. package/es/components/input-number/src/input-number.mjs +284 -53
  74. package/es/components/input-number/src/input-number.mjs.map +1 -1
  75. package/es/components/input-number/src/input-number2.mjs +53 -284
  76. package/es/components/input-number/src/input-number2.mjs.map +1 -1
  77. package/es/components/link/index.mjs +2 -2
  78. package/es/components/link/src/link.mjs +49 -22
  79. package/es/components/link/src/link.mjs.map +1 -1
  80. package/es/components/link/src/link2.mjs +22 -49
  81. package/es/components/link/src/link2.mjs.map +1 -1
  82. package/es/components/menu/index.mjs +2 -2
  83. package/es/components/menu/src/menu-item-group.mjs +4 -51
  84. package/es/components/menu/src/menu-item-group.mjs.map +1 -1
  85. package/es/components/menu/src/menu-item-group2.mjs +51 -4
  86. package/es/components/menu/src/menu-item-group2.mjs.map +1 -1
  87. package/es/components/page-header/index.mjs +2 -2
  88. package/es/components/page-header/src/page-header.mjs +60 -17
  89. package/es/components/page-header/src/page-header.mjs.map +1 -1
  90. package/es/components/page-header/src/page-header2.mjs +17 -60
  91. package/es/components/page-header/src/page-header2.mjs.map +1 -1
  92. package/es/components/popconfirm/index.mjs +2 -2
  93. package/es/components/popconfirm/src/popconfirm.mjs +52 -119
  94. package/es/components/popconfirm/src/popconfirm.mjs.map +1 -1
  95. package/es/components/popconfirm/src/popconfirm2.mjs +119 -52
  96. package/es/components/popconfirm/src/popconfirm2.mjs.map +1 -1
  97. package/es/components/popper/index.mjs +2 -2
  98. package/es/components/popper/src/arrow.mjs +37 -7
  99. package/es/components/popper/src/arrow.mjs.map +1 -1
  100. package/es/components/popper/src/arrow2.mjs +7 -37
  101. package/es/components/popper/src/arrow2.mjs.map +1 -1
  102. package/es/components/progress/index.mjs +2 -2
  103. package/es/components/progress/src/progress.mjs +230 -57
  104. package/es/components/progress/src/progress.mjs.map +1 -1
  105. package/es/components/progress/src/progress2.mjs +57 -230
  106. package/es/components/progress/src/progress2.mjs.map +1 -1
  107. package/es/components/radio/index.mjs +2 -2
  108. package/es/components/radio/src/radio-group.mjs +20 -84
  109. package/es/components/radio/src/radio-group.mjs.map +1 -1
  110. package/es/components/radio/src/radio-group2.mjs +84 -20
  111. package/es/components/radio/src/radio-group2.mjs.map +1 -1
  112. package/es/components/rate/index.mjs +2 -2
  113. package/es/components/rate/src/rate.mjs +239 -88
  114. package/es/components/rate/src/rate.mjs.map +1 -1
  115. package/es/components/rate/src/rate2.mjs +88 -239
  116. package/es/components/rate/src/rate2.mjs.map +1 -1
  117. package/es/components/skeleton/index.mjs +2 -2
  118. package/es/components/skeleton/src/skeleton-item.mjs +18 -23
  119. package/es/components/skeleton/src/skeleton-item.mjs.map +1 -1
  120. package/es/components/skeleton/src/skeleton-item2.mjs +23 -18
  121. package/es/components/skeleton/src/skeleton-item2.mjs.map +1 -1
  122. package/es/components/skeleton/src/skeleton.mjs +1 -1
  123. package/es/components/switch/index.mjs +2 -2
  124. package/es/components/switch/src/switch.mjs +250 -87
  125. package/es/components/switch/src/switch.mjs.map +1 -1
  126. package/es/components/switch/src/switch2.mjs +87 -250
  127. package/es/components/switch/src/switch2.mjs.map +1 -1
  128. package/es/components/tabs/index.mjs +3 -3
  129. package/es/components/tabs/src/tab-bar.mjs +76 -7
  130. package/es/components/tabs/src/tab-bar.mjs.map +1 -1
  131. package/es/components/tabs/src/tab-bar2.mjs +7 -76
  132. package/es/components/tabs/src/tab-bar2.mjs.map +1 -1
  133. package/es/components/tabs/src/tab-nav.mjs +1 -1
  134. package/es/components/tabs/src/tab-pane.mjs +60 -14
  135. package/es/components/tabs/src/tab-pane.mjs.map +1 -1
  136. package/es/components/tabs/src/tab-pane2.mjs +14 -60
  137. package/es/components/tabs/src/tab-pane2.mjs.map +1 -1
  138. package/es/components/teleport/index.mjs +2 -2
  139. package/es/components/teleport/src/teleport.mjs +18 -43
  140. package/es/components/teleport/src/teleport.mjs.map +1 -1
  141. package/es/components/teleport/src/teleport2.mjs +43 -18
  142. package/es/components/teleport/src/teleport2.mjs.map +1 -1
  143. package/es/components/tooltip/src/tooltip2.mjs +2 -2
  144. package/es/components/tooltip-v2/index.mjs +3 -3
  145. package/es/components/tooltip-v2/src/arrow.mjs +22 -38
  146. package/es/components/tooltip-v2/src/arrow.mjs.map +1 -1
  147. package/es/components/tooltip-v2/src/arrow2.mjs +38 -22
  148. package/es/components/tooltip-v2/src/arrow2.mjs.map +1 -1
  149. package/es/components/tooltip-v2/src/tooltip.mjs +20 -73
  150. package/es/components/tooltip-v2/src/tooltip.mjs.map +1 -1
  151. package/es/components/tooltip-v2/src/tooltip2.mjs +73 -20
  152. package/es/components/tooltip-v2/src/tooltip2.mjs.map +1 -1
  153. package/es/index.mjs +26 -26
  154. package/lib/components/affix/index.js +2 -2
  155. package/lib/components/affix/src/affix.js +114 -24
  156. package/lib/components/affix/src/affix.js.map +1 -1
  157. package/lib/components/affix/src/affix2.js +24 -114
  158. package/lib/components/affix/src/affix2.js.map +1 -1
  159. package/lib/components/autocomplete/index.js +2 -2
  160. package/lib/components/autocomplete/src/autocomplete.js +324 -67
  161. package/lib/components/autocomplete/src/autocomplete.js.map +1 -1
  162. package/lib/components/autocomplete/src/autocomplete2.js +67 -324
  163. package/lib/components/autocomplete/src/autocomplete2.js.map +1 -1
  164. package/lib/components/backtop/index.js +2 -2
  165. package/lib/components/backtop/src/backtop.js +100 -22
  166. package/lib/components/backtop/src/backtop.js.map +1 -1
  167. package/lib/components/backtop/src/backtop2.js +22 -100
  168. package/lib/components/backtop/src/backtop2.js.map +1 -1
  169. package/lib/components/breadcrumb/index.js +2 -2
  170. package/lib/components/breadcrumb/src/breadcrumb-item.js +11 -57
  171. package/lib/components/breadcrumb/src/breadcrumb-item.js.map +1 -1
  172. package/lib/components/breadcrumb/src/breadcrumb-item2.js +57 -11
  173. package/lib/components/breadcrumb/src/breadcrumb-item2.js.map +1 -1
  174. package/lib/components/button/index.js +3 -3
  175. package/lib/components/button/src/button-group.js +5 -30
  176. package/lib/components/button/src/button-group.js.map +1 -1
  177. package/lib/components/button/src/button-group2.js +30 -5
  178. package/lib/components/button/src/button-group2.js.map +1 -1
  179. package/lib/components/button/src/button.js +106 -54
  180. package/lib/components/button/src/button.js.map +1 -1
  181. package/lib/components/button/src/button2.js +54 -106
  182. package/lib/components/button/src/button2.js.map +1 -1
  183. package/lib/components/carousel/index.js +2 -2
  184. package/lib/components/carousel/src/carousel.js +49 -319
  185. package/lib/components/carousel/src/carousel.js.map +1 -1
  186. package/lib/components/carousel/src/carousel2.js +319 -49
  187. package/lib/components/carousel/src/carousel2.js.map +1 -1
  188. package/lib/components/dialog/index.js +2 -2
  189. package/lib/components/dialog/src/dialog.js +113 -71
  190. package/lib/components/dialog/src/dialog.js.map +1 -1
  191. package/lib/components/dialog/src/dialog2.js +71 -113
  192. package/lib/components/dialog/src/dialog2.js.map +1 -1
  193. package/lib/components/drawer/index.js +2 -2
  194. package/lib/components/drawer/src/drawer.js +22 -126
  195. package/lib/components/drawer/src/drawer.js.map +1 -1
  196. package/lib/components/drawer/src/drawer2.js +126 -22
  197. package/lib/components/drawer/src/drawer2.js.map +1 -1
  198. package/lib/components/empty/index.js +2 -2
  199. package/lib/components/empty/src/empty.js +11 -56
  200. package/lib/components/empty/src/empty.js.map +1 -1
  201. package/lib/components/empty/src/empty2.js +56 -11
  202. package/lib/components/empty/src/empty2.js.map +1 -1
  203. package/lib/components/form/index.js +2 -2
  204. package/lib/components/form/src/form-item.js +44 -276
  205. package/lib/components/form/src/form-item.js.map +1 -1
  206. package/lib/components/form/src/form-item2.js +276 -44
  207. package/lib/components/form/src/form-item2.js.map +1 -1
  208. package/lib/components/icon/index.js +2 -2
  209. package/lib/components/icon/src/icon.js +35 -8
  210. package/lib/components/icon/src/icon.js.map +1 -1
  211. package/lib/components/icon/src/icon2.js +8 -35
  212. package/lib/components/icon/src/icon2.js.map +1 -1
  213. package/lib/components/index.js +26 -26
  214. package/lib/components/input/index.js +2 -2
  215. package/lib/components/input/src/input.js +92 -432
  216. package/lib/components/input/src/input.js.map +1 -1
  217. package/lib/components/input/src/input2.js +432 -92
  218. package/lib/components/input/src/input2.js.map +1 -1
  219. package/lib/components/input-number/index.js +2 -2
  220. package/lib/components/input-number/src/input-number.js +284 -54
  221. package/lib/components/input-number/src/input-number.js.map +1 -1
  222. package/lib/components/input-number/src/input-number2.js +54 -284
  223. package/lib/components/input-number/src/input-number2.js.map +1 -1
  224. package/lib/components/link/index.js +2 -2
  225. package/lib/components/link/src/link.js +49 -23
  226. package/lib/components/link/src/link.js.map +1 -1
  227. package/lib/components/link/src/link2.js +23 -49
  228. package/lib/components/link/src/link2.js.map +1 -1
  229. package/lib/components/menu/index.js +2 -2
  230. package/lib/components/menu/src/menu-item-group.js +4 -51
  231. package/lib/components/menu/src/menu-item-group.js.map +1 -1
  232. package/lib/components/menu/src/menu-item-group2.js +51 -4
  233. package/lib/components/menu/src/menu-item-group2.js.map +1 -1
  234. package/lib/components/page-header/index.js +2 -2
  235. package/lib/components/page-header/src/page-header.js +60 -18
  236. package/lib/components/page-header/src/page-header.js.map +1 -1
  237. package/lib/components/page-header/src/page-header2.js +18 -60
  238. package/lib/components/page-header/src/page-header2.js.map +1 -1
  239. package/lib/components/popconfirm/index.js +2 -2
  240. package/lib/components/popconfirm/src/popconfirm.js +52 -119
  241. package/lib/components/popconfirm/src/popconfirm.js.map +1 -1
  242. package/lib/components/popconfirm/src/popconfirm2.js +119 -52
  243. package/lib/components/popconfirm/src/popconfirm2.js.map +1 -1
  244. package/lib/components/popper/index.js +2 -2
  245. package/lib/components/popper/src/arrow.js +37 -7
  246. package/lib/components/popper/src/arrow.js.map +1 -1
  247. package/lib/components/popper/src/arrow2.js +7 -37
  248. package/lib/components/popper/src/arrow2.js.map +1 -1
  249. package/lib/components/progress/index.js +2 -2
  250. package/lib/components/progress/src/progress.js +230 -57
  251. package/lib/components/progress/src/progress.js.map +1 -1
  252. package/lib/components/progress/src/progress2.js +57 -230
  253. package/lib/components/progress/src/progress2.js.map +1 -1
  254. package/lib/components/radio/index.js +2 -2
  255. package/lib/components/radio/src/radio-group.js +21 -84
  256. package/lib/components/radio/src/radio-group.js.map +1 -1
  257. package/lib/components/radio/src/radio-group2.js +84 -21
  258. package/lib/components/radio/src/radio-group2.js.map +1 -1
  259. package/lib/components/rate/index.js +2 -2
  260. package/lib/components/rate/src/rate.js +239 -89
  261. package/lib/components/rate/src/rate.js.map +1 -1
  262. package/lib/components/rate/src/rate2.js +89 -239
  263. package/lib/components/rate/src/rate2.js.map +1 -1
  264. package/lib/components/skeleton/index.js +2 -2
  265. package/lib/components/skeleton/src/skeleton-item.js +18 -23
  266. package/lib/components/skeleton/src/skeleton-item.js.map +1 -1
  267. package/lib/components/skeleton/src/skeleton-item2.js +23 -18
  268. package/lib/components/skeleton/src/skeleton-item2.js.map +1 -1
  269. package/lib/components/skeleton/src/skeleton.js +1 -1
  270. package/lib/components/switch/index.js +2 -2
  271. package/lib/components/switch/src/switch.js +249 -87
  272. package/lib/components/switch/src/switch.js.map +1 -1
  273. package/lib/components/switch/src/switch2.js +87 -249
  274. package/lib/components/switch/src/switch2.js.map +1 -1
  275. package/lib/components/tabs/index.js +3 -3
  276. package/lib/components/tabs/src/tab-bar.js +76 -7
  277. package/lib/components/tabs/src/tab-bar.js.map +1 -1
  278. package/lib/components/tabs/src/tab-bar2.js +7 -76
  279. package/lib/components/tabs/src/tab-bar2.js.map +1 -1
  280. package/lib/components/tabs/src/tab-nav.js +1 -1
  281. package/lib/components/tabs/src/tab-pane.js +60 -14
  282. package/lib/components/tabs/src/tab-pane.js.map +1 -1
  283. package/lib/components/tabs/src/tab-pane2.js +14 -60
  284. package/lib/components/tabs/src/tab-pane2.js.map +1 -1
  285. package/lib/components/teleport/index.js +2 -2
  286. package/lib/components/teleport/src/teleport.js +18 -43
  287. package/lib/components/teleport/src/teleport.js.map +1 -1
  288. package/lib/components/teleport/src/teleport2.js +43 -18
  289. package/lib/components/teleport/src/teleport2.js.map +1 -1
  290. package/lib/components/tooltip/src/tooltip2.js +2 -2
  291. package/lib/components/tooltip-v2/index.js +3 -3
  292. package/lib/components/tooltip-v2/src/arrow.js +23 -38
  293. package/lib/components/tooltip-v2/src/arrow.js.map +1 -1
  294. package/lib/components/tooltip-v2/src/arrow2.js +38 -23
  295. package/lib/components/tooltip-v2/src/arrow2.js.map +1 -1
  296. package/lib/components/tooltip-v2/src/tooltip.js +20 -73
  297. package/lib/components/tooltip-v2/src/tooltip.js.map +1 -1
  298. package/lib/components/tooltip-v2/src/tooltip2.js +73 -20
  299. package/lib/components/tooltip-v2/src/tooltip2.js.map +1 -1
  300. package/lib/index.js +26 -26
  301. package/package.json +1 -1
  302. package/web-types.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"button.mjs","sources":["../../../../../../packages/components/button/src/button.ts"],"sourcesContent":["import { useSizeProp } from '@element-plus/hooks'\nimport { buildProps, iconPropType } from '@element-plus/utils'\nimport { Loading } from '@element-plus/icons-vue'\nimport type { ExtractPropTypes } from 'vue'\nimport type button from './button.vue'\n\nexport const buttonTypes = [\n 'default',\n 'primary',\n 'success',\n 'warning',\n 'info',\n 'danger',\n 'text',\n '',\n] as const\nexport const buttonNativeTypes = ['button', 'submit', 'reset'] as const\n\nexport const buttonProps = buildProps({\n size: useSizeProp,\n disabled: Boolean,\n type: {\n type: String,\n values: buttonTypes,\n default: '',\n },\n icon: {\n type: iconPropType,\n default: '',\n },\n nativeType: {\n type: String,\n values: buttonNativeTypes,\n default: 'button',\n },\n loading: Boolean,\n loadingIcon: {\n type: iconPropType,\n default: () => Loading,\n },\n plain: Boolean,\n autofocus: Boolean,\n round: Boolean,\n circle: Boolean,\n color: String,\n dark: Boolean,\n autoInsertSpace: {\n type: Boolean,\n default: undefined,\n },\n} as const)\nexport const buttonEmits = {\n click: (evt: MouseEvent) => evt instanceof MouseEvent,\n}\n\nexport type ButtonProps = ExtractPropTypes<typeof buttonProps>\nexport type ButtonEmits = typeof buttonEmits\n\nexport type ButtonType = ButtonProps['type']\nexport type ButtonNativeType = ButtonProps['nativeType']\n\nexport type ButtonInstance = InstanceType<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AAE,CAAC,GAAG,KAAK,GAAG,YAAY,UAAU;AAC3C;;;;"}
1
+ {"version":3,"file":"button.mjs","sources":["../../../../../../packages/components/button/src/button.vue"],"sourcesContent":["<template>\n <button\n ref=\"_ref\"\n :class=\"[\n ns.b(),\n ns.m(_type),\n ns.m(_size),\n ns.is('disabled', _disabled),\n ns.is('loading', loading),\n ns.is('plain', plain),\n ns.is('round', round),\n ns.is('circle', circle),\n ]\"\n :disabled=\"_disabled || loading\"\n :autofocus=\"autofocus\"\n :type=\"nativeType\"\n :style=\"buttonStyle\"\n @click=\"handleClick\"\n >\n <template v-if=\"loading\">\n <slot v-if=\"$slots.loading\" name=\"loading\" />\n <el-icon v-else :class=\"ns.is('loading')\">\n <component :is=\"loadingIcon\" />\n </el-icon>\n </template>\n <el-icon v-else-if=\"icon || $slots.icon\">\n <component :is=\"icon\" v-if=\"icon\" />\n <slot v-else name=\"icon\" />\n </el-icon>\n <span\n v-if=\"$slots.default\"\n :class=\"{ [ns.em('text', 'expand')]: shouldAddSpace }\"\n >\n <slot />\n </span>\n </button>\n</template>\n\n<script lang=\"ts\" setup>\nimport { Text, computed, inject, ref, useSlots } from 'vue'\nimport { ElIcon } from '@element-plus/components/icon'\nimport {\n useDisabled,\n useFormItem,\n useGlobalConfig,\n useNamespace,\n useSize,\n} from '@element-plus/hooks'\nimport { buttonGroupContextKey } from '@element-plus/tokens'\nimport { buttonEmits, buttonProps } from './button'\nimport { useButtonCustomStyle } from './button-custom'\n\ndefineOptions({\n name: 'ElButton',\n})\n\nconst props = defineProps(buttonProps)\nconst emit = defineEmits(buttonEmits)\nconst slots = useSlots()\n\nconst buttonGroupContext = inject(buttonGroupContextKey, undefined)\nconst globalConfig = useGlobalConfig('button')\nconst ns = useNamespace('button')\nconst { form } = useFormItem()\nconst _size = useSize(computed(() => buttonGroupContext?.size))\nconst _disabled = useDisabled()\nconst _ref = ref<HTMLButtonElement>()\n\nconst _type = computed(() => props.type || buttonGroupContext?.type || '')\nconst autoInsertSpace = computed(\n () => props.autoInsertSpace ?? globalConfig.value?.autoInsertSpace ?? false\n)\n\n// add space between two characters in Chinese\nconst shouldAddSpace = computed(() => {\n const defaultSlot = slots.default?.()\n if (autoInsertSpace.value && defaultSlot?.length === 1) {\n const slot = defaultSlot[0]\n if (slot?.type === Text) {\n const text = slot.children as string\n return /^\\p{Unified_Ideograph}{2}$/u.test(text.trim())\n }\n }\n return false\n})\n\nconst buttonStyle = useButtonCustomStyle(props)\n\nconst handleClick = (evt: MouseEvent) => {\n if (props.nativeType === 'reset') {\n form?.resetFields()\n }\n emit('click', evt)\n}\n\ndefineExpose({\n /** @description button html element */\n ref: _ref,\n /** @description button size */\n size: _size,\n /** @description button type */\n type: _type,\n /** @description button disabled */\n disabled: _disabled,\n /** @description whether adding space */\n shouldAddSpace,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0DA,IAAA,MAAA,QAAA,QAAA,EAAA,CAAA;AAEA,IAAA,MAAA,kBAAA,GAAA,MAAA,CAAA,qBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AACA,IAAA,MAAA,YAAA,GAAA,gBAAA,QAAA,CAAA,CAAA;AACA,IAAA,MAAA,EAAA,GAAA,aAAA,QAAA,CAAA,CAAA;AACA,IAAA,MAAA,EAAA,SAAA,WAAA,EAAA,CAAA;AACA,IAAA,MAAA,QAAA,OAAA,CAAA,QAAA,CAAA,MAAA,kBAAA,QAAA,GAAA,KAAA,CAAA,GAAA,kBAAA,CAAA,IAAA,CAAA,CAAA,CAAA;AACA,IAAA,MAAA,YAAA,WAAA,EAAA,CAAA;AACA,IAAA,MAAA,OAAA,GAAA,EAAA,CAAA;AAEA,IAAA,MAAA,QAAA,QAAA,CAAA,MAAA,MAAA,IAAA,KAAA,kBAAA,WAAA,KAAA,CAAA,GAAA,kBAAA,CAAA,IAAA,CAAA,IAAA,EAAA,CAAA,CAAA;AACA,IAAA,MAAA,eAAA,GAAA,SACA,MAAA;AAIA,MAA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;AAAA,OAEA;AAAA,MAEA,IAAA,CAAA,OAAA,EAAA,GAAA,CAAA,CAAA;AAAA,KAAA,CAEA;AAAA,IAAA,MAEA,CAAA;AAAA,MAEA,GAAA,EAAA,IAAA;AAAA,MACA,IAAA,EAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,112 +1,57 @@
1
- import { defineComponent, useSlots, inject, computed, ref, Text, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, Fragment, renderSlot, createBlock, withCtx, resolveDynamicComponent, createCommentVNode } from 'vue';
2
- import { ElIcon } from '../../icon/index.mjs';
3
1
  import '../../../hooks/index.mjs';
4
- import '../../../tokens/index.mjs';
5
- import { buttonProps, buttonEmits } from './button.mjs';
6
- import { useButtonCustomStyle } from './button-custom.mjs';
7
- import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
8
- import { buttonGroupContextKey } from '../../../tokens/button.mjs';
9
- import { useGlobalConfig } from '../../../hooks/use-global-config/index.mjs';
10
- import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
11
- import { useFormItem } from '../../../hooks/use-form-item/index.mjs';
12
- import { useSize, useDisabled } from '../../../hooks/use-common-props/index.mjs';
2
+ import '../../../utils/index.mjs';
3
+ import { Loading } from '@element-plus/icons-vue';
4
+ import { buildProps } from '../../../utils/vue/props.mjs';
5
+ import { useSizeProp } from '../../../hooks/use-common-props/index.mjs';
6
+ import { iconPropType } from '../../../utils/vue/icon.mjs';
13
7
 
14
- const _hoisted_1 = ["disabled", "autofocus", "type"];
15
- const __default__ = {
16
- name: "ElButton"
17
- };
18
- const _sfc_main = /* @__PURE__ */ defineComponent({
19
- ...__default__,
20
- props: buttonProps,
21
- emits: buttonEmits,
22
- setup(__props, { expose, emit }) {
23
- const props = __props;
24
- const slots = useSlots();
25
- const buttonGroupContext = inject(buttonGroupContextKey, void 0);
26
- const globalConfig = useGlobalConfig("button");
27
- const ns = useNamespace("button");
28
- const { form } = useFormItem();
29
- const _size = useSize(computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
30
- const _disabled = useDisabled();
31
- const _ref = ref();
32
- const _type = computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
33
- const autoInsertSpace = computed(() => {
34
- var _a, _b, _c;
35
- return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.autoInsertSpace) != null ? _c : false;
36
- });
37
- const shouldAddSpace = computed(() => {
38
- var _a;
39
- const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots);
40
- if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
41
- const slot = defaultSlot[0];
42
- if ((slot == null ? void 0 : slot.type) === Text) {
43
- const text = slot.children;
44
- return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
45
- }
46
- }
47
- return false;
48
- });
49
- const buttonStyle = useButtonCustomStyle(props);
50
- const handleClick = (evt) => {
51
- if (props.nativeType === "reset") {
52
- form == null ? void 0 : form.resetFields();
53
- }
54
- emit("click", evt);
55
- };
56
- expose({
57
- ref: _ref,
58
- size: _size,
59
- type: _type,
60
- disabled: _disabled,
61
- shouldAddSpace
62
- });
63
- return (_ctx, _cache) => {
64
- return openBlock(), createElementBlock("button", {
65
- ref_key: "_ref",
66
- ref: _ref,
67
- class: normalizeClass([
68
- unref(ns).b(),
69
- unref(ns).m(unref(_type)),
70
- unref(ns).m(unref(_size)),
71
- unref(ns).is("disabled", unref(_disabled)),
72
- unref(ns).is("loading", _ctx.loading),
73
- unref(ns).is("plain", _ctx.plain),
74
- unref(ns).is("round", _ctx.round),
75
- unref(ns).is("circle", _ctx.circle)
76
- ]),
77
- disabled: unref(_disabled) || _ctx.loading,
78
- autofocus: _ctx.autofocus,
79
- type: _ctx.nativeType,
80
- style: normalizeStyle(unref(buttonStyle)),
81
- onClick: handleClick
82
- }, [
83
- _ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
84
- _ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
85
- key: 1,
86
- class: normalizeClass(unref(ns).is("loading"))
87
- }, {
88
- default: withCtx(() => [
89
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
90
- ]),
91
- _: 1
92
- }, 8, ["class"]))
93
- ], 2112)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
94
- default: withCtx(() => [
95
- _ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
96
- ]),
97
- _: 3
98
- })) : createCommentVNode("v-if", true),
99
- _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
100
- key: 2,
101
- class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
102
- }, [
103
- renderSlot(_ctx.$slots, "default")
104
- ], 2)) : createCommentVNode("v-if", true)
105
- ], 14, _hoisted_1);
106
- };
8
+ const buttonTypes = [
9
+ "default",
10
+ "primary",
11
+ "success",
12
+ "warning",
13
+ "info",
14
+ "danger",
15
+ "text",
16
+ ""
17
+ ];
18
+ const buttonNativeTypes = ["button", "submit", "reset"];
19
+ const buttonProps = buildProps({
20
+ size: useSizeProp,
21
+ disabled: Boolean,
22
+ type: {
23
+ type: String,
24
+ values: buttonTypes,
25
+ default: ""
26
+ },
27
+ icon: {
28
+ type: iconPropType,
29
+ default: ""
30
+ },
31
+ nativeType: {
32
+ type: String,
33
+ values: buttonNativeTypes,
34
+ default: "button"
35
+ },
36
+ loading: Boolean,
37
+ loadingIcon: {
38
+ type: iconPropType,
39
+ default: () => Loading
40
+ },
41
+ plain: Boolean,
42
+ autofocus: Boolean,
43
+ round: Boolean,
44
+ circle: Boolean,
45
+ color: String,
46
+ dark: Boolean,
47
+ autoInsertSpace: {
48
+ type: Boolean,
49
+ default: void 0
107
50
  }
108
51
  });
109
- var Button = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-pe/packages/components/button/src/button.vue"]]);
52
+ const buttonEmits = {
53
+ click: (evt) => evt instanceof MouseEvent
54
+ };
110
55
 
111
- export { Button as default };
56
+ export { buttonEmits, buttonNativeTypes, buttonProps, buttonTypes };
112
57
  //# sourceMappingURL=button2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"button2.mjs","sources":["../../../../../../packages/components/button/src/button.vue"],"sourcesContent":["<template>\n <button\n ref=\"_ref\"\n :class=\"[\n ns.b(),\n ns.m(_type),\n ns.m(_size),\n ns.is('disabled', _disabled),\n ns.is('loading', loading),\n ns.is('plain', plain),\n ns.is('round', round),\n ns.is('circle', circle),\n ]\"\n :disabled=\"_disabled || loading\"\n :autofocus=\"autofocus\"\n :type=\"nativeType\"\n :style=\"buttonStyle\"\n @click=\"handleClick\"\n >\n <template v-if=\"loading\">\n <slot v-if=\"$slots.loading\" name=\"loading\" />\n <el-icon v-else :class=\"ns.is('loading')\">\n <component :is=\"loadingIcon\" />\n </el-icon>\n </template>\n <el-icon v-else-if=\"icon || $slots.icon\">\n <component :is=\"icon\" v-if=\"icon\" />\n <slot v-else name=\"icon\" />\n </el-icon>\n <span\n v-if=\"$slots.default\"\n :class=\"{ [ns.em('text', 'expand')]: shouldAddSpace }\"\n >\n <slot />\n </span>\n </button>\n</template>\n\n<script lang=\"ts\" setup>\nimport { Text, computed, inject, ref, useSlots } from 'vue'\nimport { ElIcon } from '@element-plus/components/icon'\nimport {\n useDisabled,\n useFormItem,\n useGlobalConfig,\n useNamespace,\n useSize,\n} from '@element-plus/hooks'\nimport { buttonGroupContextKey } from '@element-plus/tokens'\nimport { buttonEmits, buttonProps } from './button'\nimport { useButtonCustomStyle } from './button-custom'\n\ndefineOptions({\n name: 'ElButton',\n})\n\nconst props = defineProps(buttonProps)\nconst emit = defineEmits(buttonEmits)\nconst slots = useSlots()\n\nconst buttonGroupContext = inject(buttonGroupContextKey, undefined)\nconst globalConfig = useGlobalConfig('button')\nconst ns = useNamespace('button')\nconst { form } = useFormItem()\nconst _size = useSize(computed(() => buttonGroupContext?.size))\nconst _disabled = useDisabled()\nconst _ref = ref<HTMLButtonElement>()\n\nconst _type = computed(() => props.type || buttonGroupContext?.type || '')\nconst autoInsertSpace = computed(\n () => props.autoInsertSpace ?? globalConfig.value?.autoInsertSpace ?? false\n)\n\n// add space between two characters in Chinese\nconst shouldAddSpace = computed(() => {\n const defaultSlot = slots.default?.()\n if (autoInsertSpace.value && defaultSlot?.length === 1) {\n const slot = defaultSlot[0]\n if (slot?.type === Text) {\n const text = slot.children as string\n return /^\\p{Unified_Ideograph}{2}$/u.test(text.trim())\n }\n }\n return false\n})\n\nconst buttonStyle = useButtonCustomStyle(props)\n\nconst handleClick = (evt: MouseEvent) => {\n if (props.nativeType === 'reset') {\n form?.resetFields()\n }\n emit('click', evt)\n}\n\ndefineExpose({\n /** @description button html element */\n ref: _ref,\n /** @description button size */\n size: _size,\n /** @description button type */\n type: _type,\n /** @description button disabled */\n disabled: _disabled,\n /** @description whether adding space */\n shouldAddSpace,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0DA,IAAA,MAAA,QAAA,QAAA,EAAA,CAAA;AAEA,IAAA,MAAA,kBAAA,GAAA,MAAA,CAAA,qBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AACA,IAAA,MAAA,YAAA,GAAA,gBAAA,QAAA,CAAA,CAAA;AACA,IAAA,MAAA,EAAA,GAAA,aAAA,QAAA,CAAA,CAAA;AACA,IAAA,MAAA,EAAA,SAAA,WAAA,EAAA,CAAA;AACA,IAAA,MAAA,QAAA,OAAA,CAAA,QAAA,CAAA,MAAA,kBAAA,QAAA,GAAA,KAAA,CAAA,GAAA,kBAAA,CAAA,IAAA,CAAA,CAAA,CAAA;AACA,IAAA,MAAA,YAAA,WAAA,EAAA,CAAA;AACA,IAAA,MAAA,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oBAAA,CAAA,KAAA,CAAA,CAAA;AACA,IAAA,MAAA,WAAA,GAAA,CAAA,GAAA,KAAA;AAAA,MACA,IAAA,KAAA,CAAA,UAAA,KAAA,OAAA,EAAA;AAEA,QAAA,IAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,IAAA,CAAA,WAAA,EAAA,CAAA;AAAA,OAEA;AAAA,MAEA,IAAA,CAAA,OAAA,EAAA,GAAA,CAAA,CAAA;AAAA,KAAA,CAEA;AAAA,IAAA,MAEA,CAAA;AAAA,MAEA,GAAA,EAAA,IAAA;AAAA,MACA,IAAA,EAAA,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"button2.mjs","sources":["../../../../../../packages/components/button/src/button.ts"],"sourcesContent":["import { useSizeProp } from '@element-plus/hooks'\nimport { buildProps, iconPropType } from '@element-plus/utils'\nimport { Loading } from '@element-plus/icons-vue'\nimport type { ExtractPropTypes } from 'vue'\nimport type button from './button.vue'\n\nexport const buttonTypes = [\n 'default',\n 'primary',\n 'success',\n 'warning',\n 'info',\n 'danger',\n 'text',\n '',\n] as const\nexport const buttonNativeTypes = ['button', 'submit', 'reset'] as const\n\nexport const buttonProps = buildProps({\n size: useSizeProp,\n disabled: Boolean,\n type: {\n type: String,\n values: buttonTypes,\n default: '',\n },\n icon: {\n type: iconPropType,\n default: '',\n },\n nativeType: {\n type: String,\n values: buttonNativeTypes,\n default: 'button',\n },\n loading: Boolean,\n loadingIcon: {\n type: iconPropType,\n default: () => Loading,\n },\n plain: Boolean,\n autofocus: Boolean,\n round: Boolean,\n circle: Boolean,\n color: String,\n dark: Boolean,\n autoInsertSpace: {\n type: Boolean,\n default: undefined,\n },\n} as const)\nexport const buttonEmits = {\n click: (evt: MouseEvent) => evt instanceof MouseEvent,\n}\n\nexport type ButtonProps = ExtractPropTypes<typeof buttonProps>\nexport type ButtonEmits = typeof buttonEmits\n\nexport type ButtonType = ButtonProps['type']\nexport type ButtonNativeType = ButtonProps['nativeType']\n\nexport type ButtonInstance = InstanceType<typeof button>\n\nexport interface ButtonConfigContext {\n autoInsertSpace?: boolean\n}\n"],"names":[],"mappings":";;;;;;;AAGY,MAAC,WAAW,GAAG;AAC3B,EAAE,SAAS;AACX,EAAE,SAAS;AACX,EAAE,SAAS;AACX,EAAE,SAAS;AACX,EAAE,MAAM;AACR,EAAE,QAAQ;AACV,EAAE,MAAM;AACR,EAAE,EAAE;AACJ,EAAE;AACU,MAAC,iBAAiB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE;AACnD,MAAC,WAAW,GAAG,UAAU,CAAC;AACtC,EAAE,IAAI,EAAE,WAAW;AACnB,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,WAAW;AACvB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,YAAY;AACtB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,iBAAiB;AAC7B,IAAI,OAAO,EAAE,QAAQ;AACrB,GAAG;AACH,EAAE,OAAO,EAAE,OAAO;AAClB,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,YAAY;AACtB,IAAI,OAAO,EAAE,MAAM,OAAO;AAC1B,GAAG;AACH,EAAE,KAAK,EAAE,OAAO;AAChB,EAAE,SAAS,EAAE,OAAO;AACpB,EAAE,KAAK,EAAE,OAAO;AAChB,EAAE,MAAM,EAAE,OAAO;AACjB,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,IAAI,EAAE,OAAO;AACf,EAAE,eAAe,EAAE;AACnB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,WAAW,GAAG;AAC3B,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,GAAG,YAAY,UAAU;AAC3C;;;;"}
@@ -1,7 +1,7 @@
1
1
  import '../../utils/index.mjs';
2
- import Carousel from './src/carousel.mjs';
2
+ import Carousel from './src/carousel2.mjs';
3
3
  import CarouselItem from './src/carousel-item.mjs';
4
- export { carouselEmits, carouselProps } from './src/carousel2.mjs';
4
+ export { carouselEmits, carouselProps } from './src/carousel.mjs';
5
5
  export { carouselItemProps } from './src/carousel-item2.mjs';
6
6
  import { withInstall, withNoopInstall } from '../../utils/vue/install.mjs';
7
7
 
@@ -1,325 +1,54 @@
1
- import { defineComponent, ref, computed, unref, watch, shallowRef, onMounted, nextTick, onBeforeUnmount, provide, openBlock, createElementBlock, normalizeClass, withModifiers, createElementVNode, normalizeStyle, createBlock, Transition, withCtx, withDirectives, createVNode, vShow, createCommentVNode, renderSlot, Fragment, renderList, toDisplayString } from 'vue';
2
- import { throttle } from 'lodash-unified';
3
- import { useResizeObserver } from '@vueuse/core';
4
1
  import '../../../utils/index.mjs';
5
- import { ElIcon } from '../../icon/index.mjs';
6
- import { ArrowLeft, ArrowRight } from '@element-plus/icons-vue';
7
- import '../../../hooks/index.mjs';
8
- import '../../../tokens/index.mjs';
9
- import { carouselProps, carouselEmits } from './carousel2.mjs';
10
- import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
11
- import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
12
- import { isString } from '@vue/shared';
13
- import { debugWarn } from '../../../utils/error.mjs';
14
- import { carouselContextKey } from '../../../tokens/carousel.mjs';
2
+ import { buildProps } from '../../../utils/vue/props.mjs';
3
+ import { isNumber } from '@vueuse/core';
15
4
 
16
- const _hoisted_1 = ["onMouseenter", "onMouseleave"];
17
- const _hoisted_2 = ["onMouseenter", "onClick"];
18
- const _hoisted_3 = { key: 0 };
19
- const __default__ = {
20
- name: "ElCarousel"
21
- };
22
- const _sfc_main = /* @__PURE__ */ defineComponent({
23
- ...__default__,
24
- props: carouselProps,
25
- emits: carouselEmits,
26
- setup(__props, { expose, emit }) {
27
- const props = __props;
28
- const ns = useNamespace("carousel");
29
- const COMPONENT_NAME = "ElCarousel";
30
- const THROTTLE_TIME = 300;
31
- const activeIndex = ref(-1);
32
- const timer = ref(null);
33
- const hover = ref(false);
34
- const root = ref();
35
- const items = ref([]);
36
- const arrowDisplay = computed(() => props.arrow !== "never" && !unref(isVertical));
37
- const hasLabel = computed(() => {
38
- return items.value.some((item) => item.props.label.toString().length > 0);
39
- });
40
- const carouselClasses = computed(() => {
41
- const classes = [ns.b(), ns.m(props.direction)];
42
- if (unref(isCardType)) {
43
- classes.push(ns.m("card"));
44
- }
45
- return classes;
46
- });
47
- const indicatorsClasses = computed(() => {
48
- const classes = [ns.e("indicators"), ns.em("indicators", props.direction)];
49
- if (hasLabel.value) {
50
- classes.push(ns.em("indicators", "labels"));
51
- }
52
- if (props.indicatorPosition === "outside" || unref(isCardType)) {
53
- classes.push(ns.em("indicators", "outside"));
54
- }
55
- return classes;
56
- });
57
- const isCardType = computed(() => props.type === "card");
58
- const isVertical = computed(() => props.direction === "vertical");
59
- const throttledArrowClick = throttle((index) => {
60
- setActiveItem(index);
61
- }, THROTTLE_TIME, { trailing: true });
62
- const throttledIndicatorHover = throttle((index) => {
63
- handleIndicatorHover(index);
64
- }, THROTTLE_TIME);
65
- function pauseTimer() {
66
- if (timer.value) {
67
- clearInterval(timer.value);
68
- timer.value = null;
69
- }
70
- }
71
- function startTimer() {
72
- if (props.interval <= 0 || !props.autoplay || timer.value)
73
- return;
74
- timer.value = setInterval(() => playSlides(), props.interval);
75
- }
76
- const playSlides = () => {
77
- if (activeIndex.value < items.value.length - 1) {
78
- activeIndex.value = activeIndex.value + 1;
79
- } else if (props.loop) {
80
- activeIndex.value = 0;
81
- }
82
- };
83
- function setActiveItem(index) {
84
- if (isString(index)) {
85
- const filteredItems = items.value.filter((item) => item.props.name === index);
86
- if (filteredItems.length > 0) {
87
- index = items.value.indexOf(filteredItems[0]);
88
- }
89
- }
90
- index = Number(index);
91
- if (Number.isNaN(index) || index !== Math.floor(index)) {
92
- debugWarn(COMPONENT_NAME, "index must be integer.");
93
- return;
94
- }
95
- const itemCount = items.value.length;
96
- const oldIndex = activeIndex.value;
97
- if (index < 0) {
98
- activeIndex.value = props.loop ? itemCount - 1 : 0;
99
- } else if (index >= itemCount) {
100
- activeIndex.value = props.loop ? 0 : itemCount - 1;
101
- } else {
102
- activeIndex.value = index;
103
- }
104
- if (oldIndex === activeIndex.value) {
105
- resetItemPosition(oldIndex);
106
- }
107
- }
108
- function resetItemPosition(oldIndex) {
109
- items.value.forEach((item, index) => {
110
- item.translateItem(index, activeIndex.value, oldIndex);
111
- });
112
- }
113
- function addItem(item) {
114
- items.value.push(item);
115
- }
116
- function removeItem(uid) {
117
- const index = items.value.findIndex((item) => item.uid === uid);
118
- if (index !== -1) {
119
- items.value.splice(index, 1);
120
- if (activeIndex.value === index)
121
- next();
122
- }
123
- }
124
- function itemInStage(item, index) {
125
- var _a, _b, _c, _d;
126
- const _items = unref(items);
127
- const itemCount = _items.length;
128
- if (itemCount === 0 || !item.states.inStage)
129
- return false;
130
- const nextItemIndex = index + 1;
131
- const prevItemIndex = index - 1;
132
- const lastItemIndex = itemCount - 1;
133
- const isLastItemActive = _items[lastItemIndex].states.active;
134
- const isFirstItemActive = _items[0].states.active;
135
- const isNextItemActive = (_b = (_a = _items[nextItemIndex]) == null ? void 0 : _a.states) == null ? void 0 : _b.active;
136
- const isPrevItemActive = (_d = (_c = _items[prevItemIndex]) == null ? void 0 : _c.states) == null ? void 0 : _d.active;
137
- if (index === lastItemIndex && isFirstItemActive || isNextItemActive) {
138
- return "left";
139
- } else if (index === 0 && isLastItemActive || isPrevItemActive) {
140
- return "right";
141
- }
142
- return false;
143
- }
144
- function handleMouseEnter() {
145
- hover.value = true;
146
- if (props.pauseOnHover) {
147
- pauseTimer();
148
- }
149
- }
150
- function handleMouseLeave() {
151
- hover.value = false;
152
- startTimer();
153
- }
154
- function handleButtonEnter(arrow) {
155
- if (unref(isVertical))
156
- return;
157
- items.value.forEach((item, index) => {
158
- if (arrow === itemInStage(item, index)) {
159
- item.states.hover = true;
160
- }
161
- });
162
- }
163
- function handleButtonLeave() {
164
- if (unref(isVertical))
165
- return;
166
- items.value.forEach((item) => {
167
- item.states.hover = false;
168
- });
169
- }
170
- function handleIndicatorClick(index) {
171
- activeIndex.value = index;
172
- }
173
- function handleIndicatorHover(index) {
174
- if (props.trigger === "hover" && index !== activeIndex.value) {
175
- activeIndex.value = index;
176
- }
177
- }
178
- function prev() {
179
- setActiveItem(activeIndex.value - 1);
180
- }
181
- function next() {
182
- setActiveItem(activeIndex.value + 1);
183
- }
184
- watch(() => activeIndex.value, (current, prev2) => {
185
- resetItemPosition(prev2);
186
- if (prev2 > -1) {
187
- emit("change", current, prev2);
188
- }
189
- });
190
- watch(() => props.autoplay, (autoplay) => {
191
- autoplay ? startTimer() : pauseTimer();
192
- });
193
- watch(() => props.loop, () => {
194
- setActiveItem(activeIndex.value);
195
- });
196
- const resizeObserver = shallowRef();
197
- onMounted(async () => {
198
- await nextTick();
199
- resizeObserver.value = useResizeObserver(root.value, () => {
200
- resetItemPosition();
201
- });
202
- if (props.initialIndex < items.value.length && props.initialIndex >= 0) {
203
- activeIndex.value = props.initialIndex;
204
- }
205
- startTimer();
206
- });
207
- onBeforeUnmount(() => {
208
- pauseTimer();
209
- if (root.value && resizeObserver.value)
210
- resizeObserver.value.stop();
211
- });
212
- provide(carouselContextKey, {
213
- root,
214
- isCardType,
215
- isVertical,
216
- items,
217
- loop: props.loop,
218
- addItem,
219
- removeItem,
220
- setActiveItem
221
- });
222
- expose({
223
- setActiveItem,
224
- prev,
225
- next
226
- });
227
- return (_ctx, _cache) => {
228
- return openBlock(), createElementBlock("div", {
229
- ref_key: "root",
230
- ref: root,
231
- class: normalizeClass(unref(carouselClasses)),
232
- onMouseenter: withModifiers(handleMouseEnter, ["stop"]),
233
- onMouseleave: withModifiers(handleMouseLeave, ["stop"])
234
- }, [
235
- createElementVNode("div", {
236
- class: normalizeClass(unref(ns).e("container")),
237
- style: normalizeStyle({ height: _ctx.height })
238
- }, [
239
- unref(arrowDisplay) ? (openBlock(), createBlock(Transition, {
240
- key: 0,
241
- name: "carousel-arrow-left"
242
- }, {
243
- default: withCtx(() => [
244
- withDirectives(createElementVNode("button", {
245
- type: "button",
246
- class: normalizeClass([unref(ns).e("arrow"), unref(ns).em("arrow", "left")]),
247
- onMouseenter: _cache[0] || (_cache[0] = ($event) => handleButtonEnter("left")),
248
- onMouseleave: handleButtonLeave,
249
- onClick: _cache[1] || (_cache[1] = withModifiers(($event) => unref(throttledArrowClick)(activeIndex.value - 1), ["stop"]))
250
- }, [
251
- createVNode(unref(ElIcon), null, {
252
- default: withCtx(() => [
253
- createVNode(unref(ArrowLeft))
254
- ]),
255
- _: 1
256
- })
257
- ], 34), [
258
- [
259
- vShow,
260
- (_ctx.arrow === "always" || hover.value) && (props.loop || activeIndex.value > 0)
261
- ]
262
- ])
263
- ]),
264
- _: 1
265
- })) : createCommentVNode("v-if", true),
266
- unref(arrowDisplay) ? (openBlock(), createBlock(Transition, {
267
- key: 1,
268
- name: "carousel-arrow-right"
269
- }, {
270
- default: withCtx(() => [
271
- withDirectives(createElementVNode("button", {
272
- type: "button",
273
- class: normalizeClass([unref(ns).e("arrow"), unref(ns).em("arrow", "right")]),
274
- onMouseenter: _cache[2] || (_cache[2] = ($event) => handleButtonEnter("right")),
275
- onMouseleave: handleButtonLeave,
276
- onClick: _cache[3] || (_cache[3] = withModifiers(($event) => unref(throttledArrowClick)(activeIndex.value + 1), ["stop"]))
277
- }, [
278
- createVNode(unref(ElIcon), null, {
279
- default: withCtx(() => [
280
- createVNode(unref(ArrowRight))
281
- ]),
282
- _: 1
283
- })
284
- ], 34), [
285
- [
286
- vShow,
287
- (_ctx.arrow === "always" || hover.value) && (props.loop || activeIndex.value < items.value.length - 1)
288
- ]
289
- ])
290
- ]),
291
- _: 1
292
- })) : createCommentVNode("v-if", true),
293
- renderSlot(_ctx.$slots, "default")
294
- ], 6),
295
- _ctx.indicatorPosition !== "none" ? (openBlock(), createElementBlock("ul", {
296
- key: 0,
297
- class: normalizeClass(unref(indicatorsClasses))
298
- }, [
299
- (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
300
- return openBlock(), createElementBlock("li", {
301
- key: index,
302
- class: normalizeClass([
303
- unref(ns).e("indicator"),
304
- unref(ns).em("indicator", _ctx.direction),
305
- unref(ns).is("active", index === activeIndex.value)
306
- ]),
307
- onMouseenter: ($event) => unref(throttledIndicatorHover)(index),
308
- onClick: withModifiers(($event) => handleIndicatorClick(index), ["stop"])
309
- }, [
310
- createElementVNode("button", {
311
- class: normalizeClass(unref(ns).e("button"))
312
- }, [
313
- unref(hasLabel) ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(item.props.label), 1)) : createCommentVNode("v-if", true)
314
- ], 2)
315
- ], 42, _hoisted_2);
316
- }), 128))
317
- ], 2)) : createCommentVNode("v-if", true)
318
- ], 42, _hoisted_1);
319
- };
5
+ const carouselProps = buildProps({
6
+ initialIndex: {
7
+ type: Number,
8
+ default: 0
9
+ },
10
+ height: { type: String, default: "" },
11
+ trigger: {
12
+ type: String,
13
+ default: "hover"
14
+ },
15
+ autoplay: {
16
+ type: Boolean,
17
+ default: true
18
+ },
19
+ interval: {
20
+ type: Number,
21
+ default: 3e3
22
+ },
23
+ indicatorPosition: { type: String, default: "" },
24
+ indicator: {
25
+ type: Boolean,
26
+ default: true
27
+ },
28
+ arrow: {
29
+ type: String,
30
+ default: "hover"
31
+ },
32
+ type: { type: String, default: "" },
33
+ loop: {
34
+ type: Boolean,
35
+ default: true
36
+ },
37
+ direction: {
38
+ type: String,
39
+ default: "horizontal",
40
+ validator(val) {
41
+ return ["horizontal", "vertical"].includes(val);
42
+ }
43
+ },
44
+ pauseOnHover: {
45
+ type: Boolean,
46
+ default: true
320
47
  }
321
48
  });
322
- var Carousel = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-pe/packages/components/carousel/src/carousel.vue"]]);
49
+ const carouselEmits = {
50
+ change: (current, prev) => [current, prev].every(isNumber)
51
+ };
323
52
 
324
- export { Carousel as default };
53
+ export { carouselEmits, carouselProps };
325
54
  //# sourceMappingURL=carousel.mjs.map