@element-plus/nightly 0.0.20241113 → 0.0.20241115

Sign up to get free protection for your applications and to get access to all the features.
Files changed (440) hide show
  1. package/dist/index.full.js +131 -130
  2. package/dist/index.full.min.js +11 -11
  3. package/dist/index.full.min.js.map +1 -1
  4. package/dist/index.full.min.mjs +11 -11
  5. package/dist/index.full.min.mjs.map +1 -1
  6. package/dist/index.full.mjs +131 -130
  7. package/dist/locale/af.js +1 -1
  8. package/dist/locale/af.min.js +1 -1
  9. package/dist/locale/af.min.mjs +1 -1
  10. package/dist/locale/af.mjs +1 -1
  11. package/dist/locale/ar-eg.js +1 -1
  12. package/dist/locale/ar-eg.min.js +1 -1
  13. package/dist/locale/ar-eg.min.mjs +1 -1
  14. package/dist/locale/ar-eg.mjs +1 -1
  15. package/dist/locale/ar.js +1 -1
  16. package/dist/locale/ar.min.js +1 -1
  17. package/dist/locale/ar.min.mjs +1 -1
  18. package/dist/locale/ar.mjs +1 -1
  19. package/dist/locale/az.js +1 -1
  20. package/dist/locale/az.min.js +1 -1
  21. package/dist/locale/az.min.mjs +1 -1
  22. package/dist/locale/az.mjs +1 -1
  23. package/dist/locale/bg.js +1 -1
  24. package/dist/locale/bg.min.js +1 -1
  25. package/dist/locale/bg.min.mjs +1 -1
  26. package/dist/locale/bg.mjs +1 -1
  27. package/dist/locale/bn.js +1 -1
  28. package/dist/locale/bn.min.js +1 -1
  29. package/dist/locale/bn.min.mjs +1 -1
  30. package/dist/locale/bn.mjs +1 -1
  31. package/dist/locale/ca.js +1 -1
  32. package/dist/locale/ca.min.js +1 -1
  33. package/dist/locale/ca.min.mjs +1 -1
  34. package/dist/locale/ca.mjs +1 -1
  35. package/dist/locale/ckb.js +1 -1
  36. package/dist/locale/ckb.min.js +1 -1
  37. package/dist/locale/ckb.min.mjs +1 -1
  38. package/dist/locale/ckb.mjs +1 -1
  39. package/dist/locale/cs.js +1 -1
  40. package/dist/locale/cs.min.js +1 -1
  41. package/dist/locale/cs.min.mjs +1 -1
  42. package/dist/locale/cs.mjs +1 -1
  43. package/dist/locale/da.js +1 -1
  44. package/dist/locale/da.min.js +1 -1
  45. package/dist/locale/da.min.mjs +1 -1
  46. package/dist/locale/da.mjs +1 -1
  47. package/dist/locale/de.js +1 -1
  48. package/dist/locale/de.min.js +1 -1
  49. package/dist/locale/de.min.mjs +1 -1
  50. package/dist/locale/de.mjs +1 -1
  51. package/dist/locale/el.js +1 -1
  52. package/dist/locale/el.min.js +1 -1
  53. package/dist/locale/el.min.mjs +1 -1
  54. package/dist/locale/el.mjs +1 -1
  55. package/dist/locale/en.js +1 -1
  56. package/dist/locale/en.min.js +1 -1
  57. package/dist/locale/en.min.mjs +1 -1
  58. package/dist/locale/en.mjs +1 -1
  59. package/dist/locale/eo.js +1 -1
  60. package/dist/locale/eo.min.js +1 -1
  61. package/dist/locale/eo.min.mjs +1 -1
  62. package/dist/locale/eo.mjs +1 -1
  63. package/dist/locale/es.js +1 -1
  64. package/dist/locale/es.min.js +1 -1
  65. package/dist/locale/es.min.mjs +1 -1
  66. package/dist/locale/es.mjs +1 -1
  67. package/dist/locale/et.js +1 -1
  68. package/dist/locale/et.min.js +1 -1
  69. package/dist/locale/et.min.mjs +1 -1
  70. package/dist/locale/et.mjs +1 -1
  71. package/dist/locale/eu.js +1 -1
  72. package/dist/locale/eu.min.js +1 -1
  73. package/dist/locale/eu.min.mjs +1 -1
  74. package/dist/locale/eu.mjs +1 -1
  75. package/dist/locale/fa.js +1 -1
  76. package/dist/locale/fa.min.js +1 -1
  77. package/dist/locale/fa.min.mjs +1 -1
  78. package/dist/locale/fa.mjs +1 -1
  79. package/dist/locale/fi.js +1 -1
  80. package/dist/locale/fi.min.js +1 -1
  81. package/dist/locale/fi.min.mjs +1 -1
  82. package/dist/locale/fi.mjs +1 -1
  83. package/dist/locale/fr.js +1 -1
  84. package/dist/locale/fr.min.js +1 -1
  85. package/dist/locale/fr.min.mjs +1 -1
  86. package/dist/locale/fr.mjs +1 -1
  87. package/dist/locale/he.js +1 -1
  88. package/dist/locale/he.min.js +1 -1
  89. package/dist/locale/he.min.mjs +1 -1
  90. package/dist/locale/he.mjs +1 -1
  91. package/dist/locale/hr.js +1 -1
  92. package/dist/locale/hr.min.js +1 -1
  93. package/dist/locale/hr.min.mjs +1 -1
  94. package/dist/locale/hr.mjs +1 -1
  95. package/dist/locale/hu.js +1 -1
  96. package/dist/locale/hu.min.js +1 -1
  97. package/dist/locale/hu.min.mjs +1 -1
  98. package/dist/locale/hu.mjs +1 -1
  99. package/dist/locale/hy-am.js +1 -1
  100. package/dist/locale/hy-am.min.js +1 -1
  101. package/dist/locale/hy-am.min.mjs +1 -1
  102. package/dist/locale/hy-am.mjs +1 -1
  103. package/dist/locale/id.js +1 -1
  104. package/dist/locale/id.min.js +1 -1
  105. package/dist/locale/id.min.mjs +1 -1
  106. package/dist/locale/id.mjs +1 -1
  107. package/dist/locale/it.js +1 -1
  108. package/dist/locale/it.min.js +1 -1
  109. package/dist/locale/it.min.mjs +1 -1
  110. package/dist/locale/it.mjs +1 -1
  111. package/dist/locale/ja.js +1 -1
  112. package/dist/locale/ja.min.js +1 -1
  113. package/dist/locale/ja.min.mjs +1 -1
  114. package/dist/locale/ja.mjs +1 -1
  115. package/dist/locale/kk.js +1 -1
  116. package/dist/locale/kk.min.js +1 -1
  117. package/dist/locale/kk.min.mjs +1 -1
  118. package/dist/locale/kk.mjs +1 -1
  119. package/dist/locale/km.js +1 -1
  120. package/dist/locale/km.min.js +1 -1
  121. package/dist/locale/km.min.mjs +1 -1
  122. package/dist/locale/km.mjs +1 -1
  123. package/dist/locale/ko.js +1 -1
  124. package/dist/locale/ko.min.js +1 -1
  125. package/dist/locale/ko.min.mjs +1 -1
  126. package/dist/locale/ko.mjs +1 -1
  127. package/dist/locale/ku.js +1 -1
  128. package/dist/locale/ku.min.js +1 -1
  129. package/dist/locale/ku.min.mjs +1 -1
  130. package/dist/locale/ku.mjs +1 -1
  131. package/dist/locale/ky.js +1 -1
  132. package/dist/locale/ky.min.js +1 -1
  133. package/dist/locale/ky.min.mjs +1 -1
  134. package/dist/locale/ky.mjs +1 -1
  135. package/dist/locale/lt.js +1 -1
  136. package/dist/locale/lt.min.js +1 -1
  137. package/dist/locale/lt.min.mjs +1 -1
  138. package/dist/locale/lt.mjs +1 -1
  139. package/dist/locale/lv.js +1 -1
  140. package/dist/locale/lv.min.js +1 -1
  141. package/dist/locale/lv.min.mjs +1 -1
  142. package/dist/locale/lv.mjs +1 -1
  143. package/dist/locale/mg.js +1 -1
  144. package/dist/locale/mg.min.js +1 -1
  145. package/dist/locale/mg.min.mjs +1 -1
  146. package/dist/locale/mg.mjs +1 -1
  147. package/dist/locale/mn.js +1 -1
  148. package/dist/locale/mn.min.js +1 -1
  149. package/dist/locale/mn.min.mjs +1 -1
  150. package/dist/locale/mn.mjs +1 -1
  151. package/dist/locale/my.js +1 -1
  152. package/dist/locale/my.min.js +1 -1
  153. package/dist/locale/my.min.mjs +1 -1
  154. package/dist/locale/my.mjs +1 -1
  155. package/dist/locale/nb-no.js +1 -1
  156. package/dist/locale/nb-no.min.js +1 -1
  157. package/dist/locale/nb-no.min.mjs +1 -1
  158. package/dist/locale/nb-no.mjs +1 -1
  159. package/dist/locale/nl.js +1 -1
  160. package/dist/locale/nl.min.js +1 -1
  161. package/dist/locale/nl.min.mjs +1 -1
  162. package/dist/locale/nl.mjs +1 -1
  163. package/dist/locale/pa.js +1 -1
  164. package/dist/locale/pa.min.js +1 -1
  165. package/dist/locale/pa.min.mjs +1 -1
  166. package/dist/locale/pa.mjs +1 -1
  167. package/dist/locale/pl.js +1 -1
  168. package/dist/locale/pl.min.js +1 -1
  169. package/dist/locale/pl.min.mjs +1 -1
  170. package/dist/locale/pl.mjs +1 -1
  171. package/dist/locale/pt-br.js +1 -1
  172. package/dist/locale/pt-br.min.js +1 -1
  173. package/dist/locale/pt-br.min.mjs +1 -1
  174. package/dist/locale/pt-br.mjs +1 -1
  175. package/dist/locale/pt.js +1 -1
  176. package/dist/locale/pt.min.js +1 -1
  177. package/dist/locale/pt.min.mjs +1 -1
  178. package/dist/locale/pt.mjs +1 -1
  179. package/dist/locale/ro.js +1 -1
  180. package/dist/locale/ro.min.js +1 -1
  181. package/dist/locale/ro.min.mjs +1 -1
  182. package/dist/locale/ro.mjs +1 -1
  183. package/dist/locale/ru.js +1 -1
  184. package/dist/locale/ru.min.js +1 -1
  185. package/dist/locale/ru.min.mjs +1 -1
  186. package/dist/locale/ru.mjs +1 -1
  187. package/dist/locale/sk.js +1 -1
  188. package/dist/locale/sk.min.js +1 -1
  189. package/dist/locale/sk.min.mjs +1 -1
  190. package/dist/locale/sk.mjs +1 -1
  191. package/dist/locale/sl.js +1 -1
  192. package/dist/locale/sl.min.js +1 -1
  193. package/dist/locale/sl.min.mjs +1 -1
  194. package/dist/locale/sl.mjs +1 -1
  195. package/dist/locale/sr.js +1 -1
  196. package/dist/locale/sr.min.js +1 -1
  197. package/dist/locale/sr.min.mjs +1 -1
  198. package/dist/locale/sr.mjs +1 -1
  199. package/dist/locale/sv.js +1 -1
  200. package/dist/locale/sv.min.js +1 -1
  201. package/dist/locale/sv.min.mjs +1 -1
  202. package/dist/locale/sv.mjs +1 -1
  203. package/dist/locale/sw.js +1 -1
  204. package/dist/locale/sw.min.js +1 -1
  205. package/dist/locale/sw.min.mjs +1 -1
  206. package/dist/locale/sw.mjs +1 -1
  207. package/dist/locale/ta.js +1 -1
  208. package/dist/locale/ta.min.js +1 -1
  209. package/dist/locale/ta.min.mjs +1 -1
  210. package/dist/locale/ta.mjs +1 -1
  211. package/dist/locale/th.js +1 -1
  212. package/dist/locale/th.min.js +1 -1
  213. package/dist/locale/th.min.mjs +1 -1
  214. package/dist/locale/th.mjs +1 -1
  215. package/dist/locale/tk.js +1 -1
  216. package/dist/locale/tk.min.js +1 -1
  217. package/dist/locale/tk.min.mjs +1 -1
  218. package/dist/locale/tk.mjs +1 -1
  219. package/dist/locale/tr.js +1 -1
  220. package/dist/locale/tr.min.js +1 -1
  221. package/dist/locale/tr.min.mjs +1 -1
  222. package/dist/locale/tr.mjs +1 -1
  223. package/dist/locale/ug-cn.js +1 -1
  224. package/dist/locale/ug-cn.min.js +1 -1
  225. package/dist/locale/ug-cn.min.mjs +1 -1
  226. package/dist/locale/ug-cn.mjs +1 -1
  227. package/dist/locale/uk.js +1 -1
  228. package/dist/locale/uk.min.js +1 -1
  229. package/dist/locale/uk.min.mjs +1 -1
  230. package/dist/locale/uk.mjs +1 -1
  231. package/dist/locale/uz-uz.js +1 -1
  232. package/dist/locale/uz-uz.min.js +1 -1
  233. package/dist/locale/uz-uz.min.mjs +1 -1
  234. package/dist/locale/uz-uz.mjs +1 -1
  235. package/dist/locale/vi.js +1 -1
  236. package/dist/locale/vi.min.js +1 -1
  237. package/dist/locale/vi.min.mjs +1 -1
  238. package/dist/locale/vi.mjs +1 -1
  239. package/dist/locale/zh-cn.js +1 -1
  240. package/dist/locale/zh-cn.min.js +1 -1
  241. package/dist/locale/zh-cn.min.mjs +1 -1
  242. package/dist/locale/zh-cn.mjs +1 -1
  243. package/dist/locale/zh-tw.js +1 -1
  244. package/dist/locale/zh-tw.min.js +1 -1
  245. package/dist/locale/zh-tw.min.mjs +1 -1
  246. package/dist/locale/zh-tw.mjs +1 -1
  247. package/es/components/carousel/index.mjs +2 -2
  248. package/es/components/carousel/src/carousel-item.mjs +8 -70
  249. package/es/components/carousel/src/carousel-item.mjs.map +1 -1
  250. package/es/components/carousel/src/carousel-item2.mjs +70 -8
  251. package/es/components/carousel/src/carousel-item2.mjs.map +1 -1
  252. package/es/components/cascader/index.mjs +2 -2
  253. package/es/components/cascader/src/cascader.mjs +83 -627
  254. package/es/components/cascader/src/cascader.mjs.map +1 -1
  255. package/es/components/cascader/src/cascader2.mjs +629 -83
  256. package/es/components/cascader/src/cascader2.mjs.map +1 -1
  257. package/es/components/cascader-panel/src/index.mjs +1 -0
  258. package/es/components/cascader-panel/src/index.mjs.map +1 -1
  259. package/es/components/collapse/index.mjs +2 -2
  260. package/es/components/collapse/src/collapse.mjs +18 -28
  261. package/es/components/collapse/src/collapse.mjs.map +1 -1
  262. package/es/components/collapse/src/collapse2.mjs +28 -18
  263. package/es/components/collapse/src/collapse2.mjs.map +1 -1
  264. package/es/components/color-picker/src/color-picker2.mjs +1 -0
  265. package/es/components/color-picker/src/color-picker2.mjs.map +1 -1
  266. package/es/components/countdown/index.mjs +2 -2
  267. package/es/components/countdown/src/countdown.mjs +79 -23
  268. package/es/components/countdown/src/countdown.mjs.map +1 -1
  269. package/es/components/countdown/src/countdown2.mjs +23 -79
  270. package/es/components/countdown/src/countdown2.mjs.map +1 -1
  271. package/es/components/dropdown/src/dropdown-item-impl.mjs +2 -3
  272. package/es/components/dropdown/src/dropdown-item-impl.mjs.map +1 -1
  273. package/es/components/dropdown/src/dropdown-menu.mjs +1 -1
  274. package/es/components/dropdown/src/dropdown2.mjs +7 -2
  275. package/es/components/dropdown/src/dropdown2.mjs.map +1 -1
  276. package/es/components/dropdown/src/useDropdown.mjs +1 -1
  277. package/es/components/dropdown/src/useDropdown.mjs.map +1 -1
  278. package/es/components/focus-trap/src/focus-trap.mjs +2 -2
  279. package/es/components/focus-trap/src/focus-trap.mjs.map +1 -1
  280. package/es/components/index.mjs +7 -7
  281. package/es/components/mention/src/mention2.mjs +51 -45
  282. package/es/components/mention/src/mention2.mjs.map +1 -1
  283. package/es/components/menu/src/utils/menu-item.mjs +1 -0
  284. package/es/components/menu/src/utils/menu-item.mjs.map +1 -1
  285. package/es/components/menu/src/utils/submenu.mjs +1 -0
  286. package/es/components/menu/src/utils/submenu.mjs.map +1 -1
  287. package/es/components/pagination/src/components/prev.mjs +36 -18
  288. package/es/components/pagination/src/components/prev.mjs.map +1 -1
  289. package/es/components/pagination/src/components/prev2.mjs +18 -36
  290. package/es/components/pagination/src/components/prev2.mjs.map +1 -1
  291. package/es/components/pagination/src/pagination.mjs +1 -1
  292. package/es/components/roving-focus-group/index.mjs +3 -3
  293. package/es/components/roving-focus-group/src/roving-focus-group-impl.mjs +1 -1
  294. package/es/components/roving-focus-group/src/roving-focus-group.mjs +29 -27
  295. package/es/components/roving-focus-group/src/roving-focus-group.mjs.map +1 -1
  296. package/es/components/roving-focus-group/src/roving-focus-group2.mjs +27 -29
  297. package/es/components/roving-focus-group/src/roving-focus-group2.mjs.map +1 -1
  298. package/es/components/roving-focus-group/src/roving-focus-item.mjs +3 -3
  299. package/es/components/roving-focus-group/src/roving-focus-item.mjs.map +1 -1
  300. package/es/components/roving-focus-group/src/utils.mjs +1 -1
  301. package/es/components/roving-focus-group/src/utils.mjs.map +1 -1
  302. package/es/components/scrollbar/index.mjs +2 -2
  303. package/es/components/scrollbar/src/scrollbar.mjs +55 -171
  304. package/es/components/scrollbar/src/scrollbar.mjs.map +1 -1
  305. package/es/components/scrollbar/src/scrollbar2.mjs +171 -55
  306. package/es/components/scrollbar/src/scrollbar2.mjs.map +1 -1
  307. package/es/components/segmented/index.mjs +2 -2
  308. package/es/components/segmented/src/segmented.mjs +34 -169
  309. package/es/components/segmented/src/segmented.mjs.map +1 -1
  310. package/es/components/segmented/src/segmented2.mjs +169 -34
  311. package/es/components/segmented/src/segmented2.mjs.map +1 -1
  312. package/es/components/select-v2/src/select-dropdown.mjs +7 -9
  313. package/es/components/select-v2/src/select-dropdown.mjs.map +1 -1
  314. package/es/components/select-v2/src/useSelect.mjs +2 -1
  315. package/es/components/select-v2/src/useSelect.mjs.map +1 -1
  316. package/es/components/slider/src/composables/use-slider-button.mjs +24 -15
  317. package/es/components/slider/src/composables/use-slider-button.mjs.map +1 -1
  318. package/es/components/steps/index.mjs +2 -2
  319. package/es/components/steps/src/item.mjs +191 -19
  320. package/es/components/steps/src/item.mjs.map +1 -1
  321. package/es/components/steps/src/item2.mjs +19 -191
  322. package/es/components/steps/src/item2.mjs.map +1 -1
  323. package/es/components/table/src/table/style-helper.d.ts +0 -10
  324. package/es/components/table/src/table/style-helper.mjs +0 -14
  325. package/es/components/table/src/table/style-helper.mjs.map +1 -1
  326. package/es/components/table/src/table.mjs +2 -5
  327. package/es/components/table/src/table.mjs.map +1 -1
  328. package/es/components/table/src/table.vue.d.ts +0 -10
  329. package/es/components/tabs/src/tab-nav.mjs +21 -25
  330. package/es/components/tabs/src/tab-nav.mjs.map +1 -1
  331. package/es/components/tabs/src/tabs.mjs +1 -1
  332. package/es/components/tabs/src/tabs.mjs.map +1 -1
  333. package/es/components/tooltip/src/trigger.mjs +1 -1
  334. package/es/components/tooltip/src/trigger.mjs.map +1 -1
  335. package/es/components/tree/src/model/useKeydown.mjs +1 -1
  336. package/es/components/tree/src/model/useKeydown.mjs.map +1 -1
  337. package/es/hooks/use-escape-keydown/index.mjs +2 -3
  338. package/es/hooks/use-escape-keydown/index.mjs.map +1 -1
  339. package/es/index.mjs +7 -7
  340. package/es/version.d.ts +1 -1
  341. package/es/version.mjs +1 -1
  342. package/es/version.mjs.map +1 -1
  343. package/lib/components/carousel/index.js +2 -2
  344. package/lib/components/carousel/src/carousel-item.js +8 -70
  345. package/lib/components/carousel/src/carousel-item.js.map +1 -1
  346. package/lib/components/carousel/src/carousel-item2.js +70 -8
  347. package/lib/components/carousel/src/carousel-item2.js.map +1 -1
  348. package/lib/components/cascader/index.js +2 -2
  349. package/lib/components/cascader/src/cascader.js +84 -627
  350. package/lib/components/cascader/src/cascader.js.map +1 -1
  351. package/lib/components/cascader/src/cascader2.js +629 -84
  352. package/lib/components/cascader/src/cascader2.js.map +1 -1
  353. package/lib/components/cascader-panel/src/index.js +1 -0
  354. package/lib/components/cascader-panel/src/index.js.map +1 -1
  355. package/lib/components/collapse/index.js +2 -2
  356. package/lib/components/collapse/src/collapse.js +20 -28
  357. package/lib/components/collapse/src/collapse.js.map +1 -1
  358. package/lib/components/collapse/src/collapse2.js +28 -20
  359. package/lib/components/collapse/src/collapse2.js.map +1 -1
  360. package/lib/components/color-picker/src/color-picker2.js +1 -0
  361. package/lib/components/color-picker/src/color-picker2.js.map +1 -1
  362. package/lib/components/countdown/index.js +2 -2
  363. package/lib/components/countdown/src/countdown.js +79 -24
  364. package/lib/components/countdown/src/countdown.js.map +1 -1
  365. package/lib/components/countdown/src/countdown2.js +24 -79
  366. package/lib/components/countdown/src/countdown2.js.map +1 -1
  367. package/lib/components/dropdown/src/dropdown-item-impl.js +2 -3
  368. package/lib/components/dropdown/src/dropdown-item-impl.js.map +1 -1
  369. package/lib/components/dropdown/src/dropdown-menu.js +1 -1
  370. package/lib/components/dropdown/src/dropdown2.js +7 -2
  371. package/lib/components/dropdown/src/dropdown2.js.map +1 -1
  372. package/lib/components/dropdown/src/useDropdown.js +1 -1
  373. package/lib/components/dropdown/src/useDropdown.js.map +1 -1
  374. package/lib/components/focus-trap/src/focus-trap.js +2 -2
  375. package/lib/components/focus-trap/src/focus-trap.js.map +1 -1
  376. package/lib/components/index.js +7 -7
  377. package/lib/components/mention/src/mention2.js +51 -45
  378. package/lib/components/mention/src/mention2.js.map +1 -1
  379. package/lib/components/menu/src/utils/menu-item.js +1 -0
  380. package/lib/components/menu/src/utils/menu-item.js.map +1 -1
  381. package/lib/components/menu/src/utils/submenu.js +1 -0
  382. package/lib/components/menu/src/utils/submenu.js.map +1 -1
  383. package/lib/components/pagination/src/components/prev.js +36 -19
  384. package/lib/components/pagination/src/components/prev.js.map +1 -1
  385. package/lib/components/pagination/src/components/prev2.js +19 -36
  386. package/lib/components/pagination/src/components/prev2.js.map +1 -1
  387. package/lib/components/pagination/src/pagination.js +1 -1
  388. package/lib/components/roving-focus-group/index.js +2 -2
  389. package/lib/components/roving-focus-group/src/roving-focus-group-impl.js +1 -1
  390. package/lib/components/roving-focus-group/src/roving-focus-group.js +33 -27
  391. package/lib/components/roving-focus-group/src/roving-focus-group.js.map +1 -1
  392. package/lib/components/roving-focus-group/src/roving-focus-group2.js +27 -33
  393. package/lib/components/roving-focus-group/src/roving-focus-group2.js.map +1 -1
  394. package/lib/components/roving-focus-group/src/roving-focus-item.js +3 -3
  395. package/lib/components/roving-focus-group/src/roving-focus-item.js.map +1 -1
  396. package/lib/components/roving-focus-group/src/utils.js +1 -1
  397. package/lib/components/roving-focus-group/src/utils.js.map +1 -1
  398. package/lib/components/scrollbar/index.js +2 -2
  399. package/lib/components/scrollbar/src/scrollbar.js +56 -171
  400. package/lib/components/scrollbar/src/scrollbar.js.map +1 -1
  401. package/lib/components/scrollbar/src/scrollbar2.js +171 -56
  402. package/lib/components/scrollbar/src/scrollbar2.js.map +1 -1
  403. package/lib/components/segmented/index.js +2 -2
  404. package/lib/components/segmented/src/segmented.js +34 -168
  405. package/lib/components/segmented/src/segmented.js.map +1 -1
  406. package/lib/components/segmented/src/segmented2.js +168 -34
  407. package/lib/components/segmented/src/segmented2.js.map +1 -1
  408. package/lib/components/select-v2/src/select-dropdown.js +7 -9
  409. package/lib/components/select-v2/src/select-dropdown.js.map +1 -1
  410. package/lib/components/select-v2/src/useSelect.js +2 -1
  411. package/lib/components/select-v2/src/useSelect.js.map +1 -1
  412. package/lib/components/slider/src/composables/use-slider-button.js +24 -15
  413. package/lib/components/slider/src/composables/use-slider-button.js.map +1 -1
  414. package/lib/components/steps/index.js +2 -2
  415. package/lib/components/steps/src/item.js +191 -19
  416. package/lib/components/steps/src/item.js.map +1 -1
  417. package/lib/components/steps/src/item2.js +19 -191
  418. package/lib/components/steps/src/item2.js.map +1 -1
  419. package/lib/components/table/src/table/style-helper.d.ts +0 -10
  420. package/lib/components/table/src/table/style-helper.js +0 -14
  421. package/lib/components/table/src/table/style-helper.js.map +1 -1
  422. package/lib/components/table/src/table.js +2 -5
  423. package/lib/components/table/src/table.js.map +1 -1
  424. package/lib/components/table/src/table.vue.d.ts +0 -10
  425. package/lib/components/tabs/src/tab-nav.js +21 -25
  426. package/lib/components/tabs/src/tab-nav.js.map +1 -1
  427. package/lib/components/tabs/src/tabs.js +1 -1
  428. package/lib/components/tabs/src/tabs.js.map +1 -1
  429. package/lib/components/tooltip/src/trigger.js +1 -1
  430. package/lib/components/tooltip/src/trigger.js.map +1 -1
  431. package/lib/components/tree/src/model/useKeydown.js +1 -1
  432. package/lib/components/tree/src/model/useKeydown.js.map +1 -1
  433. package/lib/hooks/use-escape-keydown/index.js +2 -3
  434. package/lib/hooks/use-escape-keydown/index.js.map +1 -1
  435. package/lib/index.js +7 -7
  436. package/lib/version.d.ts +1 -1
  437. package/lib/version.js +1 -1
  438. package/lib/version.js.map +1 -1
  439. package/package.json +2 -2
  440. package/web-types.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"focus-trap.js","sources":["../../../../../../packages/components/focus-trap/src/focus-trap.vue"],"sourcesContent":["<template>\n <slot :handle-keydown=\"onKeydown\" />\n</template>\n<script lang=\"ts\">\nimport {\n defineComponent,\n nextTick,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n unref,\n watch,\n} from 'vue'\nimport { isNil } from 'lodash-unified'\nimport { EVENT_CODE } from '@element-plus/constants'\nimport { useEscapeKeydown } from '@element-plus/hooks'\nimport { isString } from '@element-plus/utils'\nimport {\n createFocusOutPreventedEvent,\n focusFirstDescendant,\n focusableStack,\n getEdges,\n isFocusCausedByUserEvent,\n obtainAllFocusableElements,\n tryFocus,\n useFocusReason,\n} from './utils'\nimport {\n FOCUS_AFTER_RELEASED,\n FOCUS_AFTER_TRAPPED,\n FOCUS_AFTER_TRAPPED_OPTS,\n FOCUS_TRAP_INJECTION_KEY,\n ON_RELEASE_FOCUS_EVT,\n ON_TRAP_FOCUS_EVT,\n} from './tokens'\n\nimport type { PropType } from 'vue'\nimport type { FocusLayer } from './utils'\n\nexport default defineComponent({\n name: 'ElFocusTrap',\n inheritAttrs: false,\n props: {\n loop: Boolean,\n trapped: Boolean,\n focusTrapEl: Object as PropType<HTMLElement>,\n focusStartEl: {\n type: [Object, String] as PropType<'container' | 'first' | HTMLElement>,\n default: 'first',\n },\n },\n emits: [\n ON_TRAP_FOCUS_EVT,\n ON_RELEASE_FOCUS_EVT,\n 'focusin',\n 'focusout',\n 'focusout-prevented',\n 'release-requested',\n ],\n setup(props, { emit }) {\n const forwardRef = ref<HTMLElement | undefined>()\n let lastFocusBeforeTrapped: HTMLElement | null\n let lastFocusAfterTrapped: HTMLElement | null\n\n const { focusReason } = useFocusReason()\n\n useEscapeKeydown((event) => {\n if (props.trapped && !focusLayer.paused) {\n emit('release-requested', event)\n }\n })\n\n const focusLayer: FocusLayer = {\n paused: false,\n pause() {\n this.paused = true\n },\n resume() {\n this.paused = false\n },\n }\n\n const onKeydown = (e: KeyboardEvent) => {\n if (!props.loop && !props.trapped) return\n if (focusLayer.paused) return\n\n const { key, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e\n const { loop } = props\n const isTabbing =\n key === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey\n\n const currentFocusingEl = document.activeElement\n if (isTabbing && currentFocusingEl) {\n const container = currentTarget as HTMLElement\n const [first, last] = getEdges(container)\n const isTabbable = first && last\n if (!isTabbable) {\n if (currentFocusingEl === container) {\n const focusoutPreventedEvent = createFocusOutPreventedEvent({\n focusReason: focusReason.value,\n })\n emit('focusout-prevented', focusoutPreventedEvent)\n if (!focusoutPreventedEvent.defaultPrevented) {\n e.preventDefault()\n }\n }\n } else {\n if (!shiftKey && currentFocusingEl === last) {\n const focusoutPreventedEvent = createFocusOutPreventedEvent({\n focusReason: focusReason.value,\n })\n emit('focusout-prevented', focusoutPreventedEvent)\n if (!focusoutPreventedEvent.defaultPrevented) {\n e.preventDefault()\n if (loop) tryFocus(first, true)\n }\n } else if (\n shiftKey &&\n [first, container].includes(currentFocusingEl as HTMLElement)\n ) {\n const focusoutPreventedEvent = createFocusOutPreventedEvent({\n focusReason: focusReason.value,\n })\n emit('focusout-prevented', focusoutPreventedEvent)\n if (!focusoutPreventedEvent.defaultPrevented) {\n e.preventDefault()\n if (loop) tryFocus(last, true)\n }\n }\n }\n }\n }\n\n provide(FOCUS_TRAP_INJECTION_KEY, {\n focusTrapRef: forwardRef,\n onKeydown,\n })\n\n watch(\n () => props.focusTrapEl,\n (focusTrapEl) => {\n if (focusTrapEl) {\n forwardRef.value = focusTrapEl\n }\n },\n { immediate: true }\n )\n\n watch([forwardRef], ([forwardRef], [oldForwardRef]) => {\n if (forwardRef) {\n forwardRef.addEventListener('keydown', onKeydown)\n forwardRef.addEventListener('focusin', onFocusIn)\n forwardRef.addEventListener('focusout', onFocusOut)\n }\n if (oldForwardRef) {\n oldForwardRef.removeEventListener('keydown', onKeydown)\n oldForwardRef.removeEventListener('focusin', onFocusIn)\n oldForwardRef.removeEventListener('focusout', onFocusOut)\n }\n })\n\n const trapOnFocus = (e: Event) => {\n emit(ON_TRAP_FOCUS_EVT, e)\n }\n const releaseOnFocus = (e: Event) => emit(ON_RELEASE_FOCUS_EVT, e)\n\n const onFocusIn = (e: FocusEvent) => {\n const trapContainer = unref(forwardRef)\n if (!trapContainer) return\n\n const target = e.target as HTMLElement | null\n const relatedTarget = e.relatedTarget as HTMLElement | null\n const isFocusedInTrap = target && trapContainer.contains(target)\n\n if (!props.trapped) {\n const isPrevFocusedInTrap =\n relatedTarget && trapContainer.contains(relatedTarget)\n if (!isPrevFocusedInTrap) {\n lastFocusBeforeTrapped = relatedTarget\n }\n }\n\n if (isFocusedInTrap) emit('focusin', e)\n\n if (focusLayer.paused) return\n\n if (props.trapped) {\n if (isFocusedInTrap) {\n lastFocusAfterTrapped = target\n } else {\n tryFocus(lastFocusAfterTrapped, true)\n }\n }\n }\n\n const onFocusOut = (e: Event) => {\n const trapContainer = unref(forwardRef)\n if (focusLayer.paused || !trapContainer) return\n\n if (props.trapped) {\n const relatedTarget = (e as FocusEvent)\n .relatedTarget as HTMLElement | null\n if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {\n // Give embedded focus layer time to pause this layer before reclaiming focus\n // And only reclaim focus if it should currently be trapping\n setTimeout(() => {\n if (!focusLayer.paused && props.trapped) {\n const focusoutPreventedEvent = createFocusOutPreventedEvent({\n focusReason: focusReason.value,\n })\n emit('focusout-prevented', focusoutPreventedEvent)\n if (!focusoutPreventedEvent.defaultPrevented) {\n tryFocus(lastFocusAfterTrapped, true)\n }\n }\n }, 0)\n }\n } else {\n const target = e.target as HTMLElement | null\n const isFocusedInTrap = target && trapContainer.contains(target)\n if (!isFocusedInTrap) emit('focusout', e)\n }\n }\n\n async function startTrap() {\n // Wait for forwardRef to resolve\n await nextTick()\n const trapContainer = unref(forwardRef)\n if (trapContainer) {\n focusableStack.push(focusLayer)\n const prevFocusedElement = trapContainer.contains(\n document.activeElement\n )\n ? lastFocusBeforeTrapped\n : document.activeElement\n lastFocusBeforeTrapped = prevFocusedElement as HTMLElement | null\n const isPrevFocusContained = trapContainer.contains(prevFocusedElement)\n if (!isPrevFocusContained) {\n const focusEvent = new Event(\n FOCUS_AFTER_TRAPPED,\n FOCUS_AFTER_TRAPPED_OPTS\n )\n trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus)\n trapContainer.dispatchEvent(focusEvent)\n if (!focusEvent.defaultPrevented) {\n nextTick(() => {\n let focusStartEl = props.focusStartEl\n if (!isString(focusStartEl)) {\n tryFocus(focusStartEl)\n if (document.activeElement !== focusStartEl) {\n focusStartEl = 'first'\n }\n }\n if (focusStartEl === 'first') {\n focusFirstDescendant(\n obtainAllFocusableElements(trapContainer),\n true\n )\n }\n if (\n document.activeElement === prevFocusedElement ||\n focusStartEl === 'container'\n ) {\n tryFocus(trapContainer)\n }\n })\n }\n }\n }\n }\n\n function stopTrap() {\n const trapContainer = unref(forwardRef)\n\n if (trapContainer) {\n trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus)\n\n const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {\n ...FOCUS_AFTER_TRAPPED_OPTS,\n detail: {\n focusReason: focusReason.value,\n },\n })\n trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus)\n trapContainer.dispatchEvent(releasedEvent)\n if (\n !releasedEvent.defaultPrevented &&\n (focusReason.value == 'keyboard' ||\n !isFocusCausedByUserEvent() ||\n trapContainer.contains(document.activeElement))\n ) {\n tryFocus(lastFocusBeforeTrapped ?? document.body)\n }\n\n trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus)\n focusableStack.remove(focusLayer)\n }\n }\n\n onMounted(() => {\n if (props.trapped) {\n startTrap()\n }\n\n watch(\n () => props.trapped,\n (trapped) => {\n if (trapped) {\n startTrap()\n } else {\n stopTrap()\n }\n }\n )\n })\n\n onBeforeUnmount(() => {\n if (props.trapped) {\n stopTrap()\n }\n\n if (forwardRef.value) {\n forwardRef.value.removeEventListener('keydown', onKeydown)\n forwardRef.value.removeEventListener('focusin', onFocusIn)\n forwardRef.value.removeEventListener('focusout', onFocusOut)\n forwardRef.value = undefined\n }\n })\n\n return {\n onKeydown,\n }\n },\n})\n</script>\n"],"names":["defineComponent","ON_TRAP_FOCUS_EVT","ON_RELEASE_FOCUS_EVT","ref","useFocusReason","useEscapeKeydown","EVENT_CODE","getEdges","createFocusOutPreventedEvent","tryFocus","provide","FOCUS_TRAP_INJECTION_KEY","watch","forwardRef","unref","isNil","nextTick","focusableStack","FOCUS_AFTER_TRAPPED","FOCUS_AFTER_TRAPPED_OPTS","isString","focusFirstDescendant","obtainAllFocusableElements","FOCUS_AFTER_RELEASED","isFocusCausedByUserEvent","onMounted","onBeforeUnmount","_renderSlot","_export_sfc"],"mappings":";;;;;;;;;;;;;;;;AAwCA,MAAK,YAAaA,mBAAa,CAAA;AAAA,EAC7B,IAAM,EAAA,aAAA;AAAA,EACN,YAAc,EAAA,KAAA;AAAA,EACd,KAAO,EAAA;AAAA,IACL,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,OAAA;AAAA,IACT,WAAa,EAAA,MAAA;AAAA,IACb,YAAc,EAAA;AAAA,MACZ,IAAA,EAAM,CAAC,MAAA,EAAQ,MAAM,CAAA;AAAA,MACrB,OAAS,EAAA,OAAA;AAAA,KACX;AAAA,GACF;AAAA,EACA,KAAO,EAAA;AAAA,IACLC,wBAAA;AAAA,IACAC,2BAAA;AAAA,IACA,SAAA;AAAA,IACA,UAAA;AAAA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AAA;AACX,MAAW,SAAA;AACX,KAAW,CAAA;AACX,GAAA;AAAmB,CACrB,CAAA,CAAA;AAGF,SAAO,WAAA,CAAA,IAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,KAAA,EAAA,QAAA,EAAA;AAAA,EACL,OAAAC,cAAA,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAAA,aAAA,EAAA,IAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAA,CACF;AAEJ,kBAAC,gBAAAC,iCAAA,CAAA,SAAA,EAAA,CAAA,CAAA,QAAA,EAAA,WAAA,CAAA,EAAA,CAAA,QAAA,EAAA,gBAAA,CAAA,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"focus-trap.js","sources":["../../../../../../packages/components/focus-trap/src/focus-trap.vue"],"sourcesContent":["<template>\n <slot :handle-keydown=\"onKeydown\" />\n</template>\n<script lang=\"ts\">\nimport {\n defineComponent,\n nextTick,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n unref,\n watch,\n} from 'vue'\nimport { isNil } from 'lodash-unified'\nimport { EVENT_CODE } from '@element-plus/constants'\nimport { useEscapeKeydown } from '@element-plus/hooks'\nimport { isString } from '@element-plus/utils'\nimport {\n createFocusOutPreventedEvent,\n focusFirstDescendant,\n focusableStack,\n getEdges,\n isFocusCausedByUserEvent,\n obtainAllFocusableElements,\n tryFocus,\n useFocusReason,\n} from './utils'\nimport {\n FOCUS_AFTER_RELEASED,\n FOCUS_AFTER_TRAPPED,\n FOCUS_AFTER_TRAPPED_OPTS,\n FOCUS_TRAP_INJECTION_KEY,\n ON_RELEASE_FOCUS_EVT,\n ON_TRAP_FOCUS_EVT,\n} from './tokens'\n\nimport type { PropType } from 'vue'\nimport type { FocusLayer } from './utils'\n\nexport default defineComponent({\n name: 'ElFocusTrap',\n inheritAttrs: false,\n props: {\n loop: Boolean,\n trapped: Boolean,\n focusTrapEl: Object as PropType<HTMLElement>,\n focusStartEl: {\n type: [Object, String] as PropType<'container' | 'first' | HTMLElement>,\n default: 'first',\n },\n },\n emits: [\n ON_TRAP_FOCUS_EVT,\n ON_RELEASE_FOCUS_EVT,\n 'focusin',\n 'focusout',\n 'focusout-prevented',\n 'release-requested',\n ],\n setup(props, { emit }) {\n const forwardRef = ref<HTMLElement | undefined>()\n let lastFocusBeforeTrapped: HTMLElement | null\n let lastFocusAfterTrapped: HTMLElement | null\n\n const { focusReason } = useFocusReason()\n\n useEscapeKeydown((event) => {\n if (props.trapped && !focusLayer.paused) {\n emit('release-requested', event)\n }\n })\n\n const focusLayer: FocusLayer = {\n paused: false,\n pause() {\n this.paused = true\n },\n resume() {\n this.paused = false\n },\n }\n\n const onKeydown = (e: KeyboardEvent) => {\n if (!props.loop && !props.trapped) return\n if (focusLayer.paused) return\n\n const { code, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e\n const { loop } = props\n const isTabbing =\n code === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey\n\n const currentFocusingEl = document.activeElement\n if (isTabbing && currentFocusingEl) {\n const container = currentTarget as HTMLElement\n const [first, last] = getEdges(container)\n const isTabbable = first && last\n if (!isTabbable) {\n if (currentFocusingEl === container) {\n const focusoutPreventedEvent = createFocusOutPreventedEvent({\n focusReason: focusReason.value,\n })\n emit('focusout-prevented', focusoutPreventedEvent)\n if (!focusoutPreventedEvent.defaultPrevented) {\n e.preventDefault()\n }\n }\n } else {\n if (!shiftKey && currentFocusingEl === last) {\n const focusoutPreventedEvent = createFocusOutPreventedEvent({\n focusReason: focusReason.value,\n })\n emit('focusout-prevented', focusoutPreventedEvent)\n if (!focusoutPreventedEvent.defaultPrevented) {\n e.preventDefault()\n if (loop) tryFocus(first, true)\n }\n } else if (\n shiftKey &&\n [first, container].includes(currentFocusingEl as HTMLElement)\n ) {\n const focusoutPreventedEvent = createFocusOutPreventedEvent({\n focusReason: focusReason.value,\n })\n emit('focusout-prevented', focusoutPreventedEvent)\n if (!focusoutPreventedEvent.defaultPrevented) {\n e.preventDefault()\n if (loop) tryFocus(last, true)\n }\n }\n }\n }\n }\n\n provide(FOCUS_TRAP_INJECTION_KEY, {\n focusTrapRef: forwardRef,\n onKeydown,\n })\n\n watch(\n () => props.focusTrapEl,\n (focusTrapEl) => {\n if (focusTrapEl) {\n forwardRef.value = focusTrapEl\n }\n },\n { immediate: true }\n )\n\n watch([forwardRef], ([forwardRef], [oldForwardRef]) => {\n if (forwardRef) {\n forwardRef.addEventListener('keydown', onKeydown)\n forwardRef.addEventListener('focusin', onFocusIn)\n forwardRef.addEventListener('focusout', onFocusOut)\n }\n if (oldForwardRef) {\n oldForwardRef.removeEventListener('keydown', onKeydown)\n oldForwardRef.removeEventListener('focusin', onFocusIn)\n oldForwardRef.removeEventListener('focusout', onFocusOut)\n }\n })\n\n const trapOnFocus = (e: Event) => {\n emit(ON_TRAP_FOCUS_EVT, e)\n }\n const releaseOnFocus = (e: Event) => emit(ON_RELEASE_FOCUS_EVT, e)\n\n const onFocusIn = (e: FocusEvent) => {\n const trapContainer = unref(forwardRef)\n if (!trapContainer) return\n\n const target = e.target as HTMLElement | null\n const relatedTarget = e.relatedTarget as HTMLElement | null\n const isFocusedInTrap = target && trapContainer.contains(target)\n\n if (!props.trapped) {\n const isPrevFocusedInTrap =\n relatedTarget && trapContainer.contains(relatedTarget)\n if (!isPrevFocusedInTrap) {\n lastFocusBeforeTrapped = relatedTarget\n }\n }\n\n if (isFocusedInTrap) emit('focusin', e)\n\n if (focusLayer.paused) return\n\n if (props.trapped) {\n if (isFocusedInTrap) {\n lastFocusAfterTrapped = target\n } else {\n tryFocus(lastFocusAfterTrapped, true)\n }\n }\n }\n\n const onFocusOut = (e: Event) => {\n const trapContainer = unref(forwardRef)\n if (focusLayer.paused || !trapContainer) return\n\n if (props.trapped) {\n const relatedTarget = (e as FocusEvent)\n .relatedTarget as HTMLElement | null\n if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {\n // Give embedded focus layer time to pause this layer before reclaiming focus\n // And only reclaim focus if it should currently be trapping\n setTimeout(() => {\n if (!focusLayer.paused && props.trapped) {\n const focusoutPreventedEvent = createFocusOutPreventedEvent({\n focusReason: focusReason.value,\n })\n emit('focusout-prevented', focusoutPreventedEvent)\n if (!focusoutPreventedEvent.defaultPrevented) {\n tryFocus(lastFocusAfterTrapped, true)\n }\n }\n }, 0)\n }\n } else {\n const target = e.target as HTMLElement | null\n const isFocusedInTrap = target && trapContainer.contains(target)\n if (!isFocusedInTrap) emit('focusout', e)\n }\n }\n\n async function startTrap() {\n // Wait for forwardRef to resolve\n await nextTick()\n const trapContainer = unref(forwardRef)\n if (trapContainer) {\n focusableStack.push(focusLayer)\n const prevFocusedElement = trapContainer.contains(\n document.activeElement\n )\n ? lastFocusBeforeTrapped\n : document.activeElement\n lastFocusBeforeTrapped = prevFocusedElement as HTMLElement | null\n const isPrevFocusContained = trapContainer.contains(prevFocusedElement)\n if (!isPrevFocusContained) {\n const focusEvent = new Event(\n FOCUS_AFTER_TRAPPED,\n FOCUS_AFTER_TRAPPED_OPTS\n )\n trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus)\n trapContainer.dispatchEvent(focusEvent)\n if (!focusEvent.defaultPrevented) {\n nextTick(() => {\n let focusStartEl = props.focusStartEl\n if (!isString(focusStartEl)) {\n tryFocus(focusStartEl)\n if (document.activeElement !== focusStartEl) {\n focusStartEl = 'first'\n }\n }\n if (focusStartEl === 'first') {\n focusFirstDescendant(\n obtainAllFocusableElements(trapContainer),\n true\n )\n }\n if (\n document.activeElement === prevFocusedElement ||\n focusStartEl === 'container'\n ) {\n tryFocus(trapContainer)\n }\n })\n }\n }\n }\n }\n\n function stopTrap() {\n const trapContainer = unref(forwardRef)\n\n if (trapContainer) {\n trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus)\n\n const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {\n ...FOCUS_AFTER_TRAPPED_OPTS,\n detail: {\n focusReason: focusReason.value,\n },\n })\n trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus)\n trapContainer.dispatchEvent(releasedEvent)\n if (\n !releasedEvent.defaultPrevented &&\n (focusReason.value == 'keyboard' ||\n !isFocusCausedByUserEvent() ||\n trapContainer.contains(document.activeElement))\n ) {\n tryFocus(lastFocusBeforeTrapped ?? document.body)\n }\n\n trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus)\n focusableStack.remove(focusLayer)\n }\n }\n\n onMounted(() => {\n if (props.trapped) {\n startTrap()\n }\n\n watch(\n () => props.trapped,\n (trapped) => {\n if (trapped) {\n startTrap()\n } else {\n stopTrap()\n }\n }\n )\n })\n\n onBeforeUnmount(() => {\n if (props.trapped) {\n stopTrap()\n }\n\n if (forwardRef.value) {\n forwardRef.value.removeEventListener('keydown', onKeydown)\n forwardRef.value.removeEventListener('focusin', onFocusIn)\n forwardRef.value.removeEventListener('focusout', onFocusOut)\n forwardRef.value = undefined\n }\n })\n\n return {\n onKeydown,\n }\n },\n})\n</script>\n"],"names":["defineComponent","ON_TRAP_FOCUS_EVT","ON_RELEASE_FOCUS_EVT","ref","useFocusReason","useEscapeKeydown","EVENT_CODE","getEdges","createFocusOutPreventedEvent","tryFocus","provide","FOCUS_TRAP_INJECTION_KEY","watch","forwardRef","unref","isNil","nextTick","focusableStack","FOCUS_AFTER_TRAPPED","FOCUS_AFTER_TRAPPED_OPTS","isString","focusFirstDescendant","obtainAllFocusableElements","FOCUS_AFTER_RELEASED","isFocusCausedByUserEvent","onMounted","onBeforeUnmount","_renderSlot","_export_sfc"],"mappings":";;;;;;;;;;;;;;;;AAwCA,MAAK,YAAaA,mBAAa,CAAA;AAAA,EAC7B,IAAM,EAAA,aAAA;AAAA,EACN,YAAc,EAAA,KAAA;AAAA,EACd,KAAO,EAAA;AAAA,IACL,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,OAAA;AAAA,IACT,WAAa,EAAA,MAAA;AAAA,IACb,YAAc,EAAA;AAAA,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AAA,CAAA,CAAA;AACpB,QAAA,UAAmB,CAAA,KAAA,CAAA,mBAAA,CAAA,UAAA,EAAA,UAAA,CAAA,CAAA;AACjB,QAAS,UAAA,CAAA,KAAA,GAAA,KAAA,CAAA,CAAA;AAAA,OACX;AAEA,KAAA,CAAA,CAAA;AACE,IAAW,OAAA;AACX,MAAW,SAAA;AACX,KAAW,CAAA;AACX,GAAA;AAAmB,CACrB,CAAA,CAAA;AAGF,SAAO,WAAA,CAAA,IAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,KAAA,EAAA,QAAA,EAAA;AAAA,EACL,OAAAC,cAAA,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAAA,aAAA,EAAA,IAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAA,CACF;AAEJ,kBAAC,gBAAAC,iCAAA,CAAA,SAAA,EAAA,CAAA,CAAA,QAAA,EAAA,WAAA,CAAA,EAAA,CAAA,QAAA,EAAA,gBAAA,CAAA,CAAA,CAAA;;;;"}
@@ -98,9 +98,9 @@ var constants$1 = require('./button/src/constants.js');
98
98
  var calendar = require('./calendar/src/calendar.js');
99
99
  var card = require('./card/src/card.js');
100
100
  var carousel = require('./carousel/src/carousel.js');
101
- var carouselItem = require('./carousel/src/carousel-item2.js');
101
+ var carouselItem = require('./carousel/src/carousel-item.js');
102
102
  var constants$2 = require('./carousel/src/constants.js');
103
- var cascader = require('./cascader/src/cascader2.js');
103
+ var cascader = require('./cascader/src/cascader.js');
104
104
  var types = require('./cascader-panel/src/types.js');
105
105
  var config = require('./cascader-panel/src/config.js');
106
106
  var checkTag = require('./check-tag/src/check-tag.js');
@@ -108,7 +108,7 @@ var checkboxGroup = require('./checkbox/src/checkbox-group.js');
108
108
  var checkbox = require('./checkbox/src/checkbox.js');
109
109
  var constants$3 = require('./checkbox/src/constants.js');
110
110
  var col = require('./col/src/col.js');
111
- var collapse = require('./collapse/src/collapse2.js');
111
+ var collapse = require('./collapse/src/collapse.js');
112
112
  var collapseItem = require('./collapse/src/collapse-item.js');
113
113
  var constants$4 = require('./collapse/src/constants.js');
114
114
  var colorPicker = require('./color-picker/src/color-picker.js');
@@ -116,7 +116,7 @@ var configProvider = require('./config-provider/src/config-provider.js');
116
116
  var configProviderProps = require('./config-provider/src/config-provider-props.js');
117
117
  var constants$5 = require('./config-provider/src/constants.js');
118
118
  var useGlobalConfig = require('./config-provider/src/hooks/use-global-config.js');
119
- var countdown = require('./countdown/src/countdown.js');
119
+ var countdown = require('./countdown/src/countdown2.js');
120
120
  var constants$6 = require('./date-picker/src/constants.js');
121
121
  var datePicker = require('./date-picker/src/props/date-picker.js');
122
122
  var description = require('./descriptions/src/description.js');
@@ -167,7 +167,7 @@ var result = require('./result/src/result.js');
167
167
  var row = require('./row/src/row.js');
168
168
  var constants$c = require('./row/src/constants.js');
169
169
  var util = require('./scrollbar/src/util.js');
170
- var scrollbar = require('./scrollbar/src/scrollbar2.js');
170
+ var scrollbar = require('./scrollbar/src/scrollbar.js');
171
171
  var thumb = require('./scrollbar/src/thumb.js');
172
172
  var constants$d = require('./scrollbar/src/constants.js');
173
173
  var token = require('./select/src/token.js');
@@ -180,7 +180,7 @@ var space = require('./space/src/space.js');
180
180
  var item = require('./space/src/item.js');
181
181
  var useSpace = require('./space/src/use-space.js');
182
182
  var statistic = require('./statistic/src/statistic.js');
183
- var item$1 = require('./steps/src/item.js');
183
+ var item$1 = require('./steps/src/item2.js');
184
184
  var steps = require('./steps/src/steps.js');
185
185
  var _switch = require('./switch/src/switch.js');
186
186
  var constants$f = require('./table-v2/src/constants.js');
@@ -223,7 +223,7 @@ var tour = require('./tour/src/tour.js');
223
223
  var step = require('./tour/src/step.js');
224
224
  var content$3 = require('./tour/src/content.js');
225
225
  var anchor = require('./anchor/src/anchor.js');
226
- var segmented = require('./segmented/src/segmented2.js');
226
+ var segmented = require('./segmented/src/segmented.js');
227
227
  var mention = require('./mention/src/mention.js');
228
228
  var directive = require('./loading/src/directive.js');
229
229
  var service = require('./loading/src/service.js');
@@ -18,6 +18,7 @@ var input = require('../../input/src/input.js');
18
18
  var index = require('../../../hooks/use-namespace/index.js');
19
19
  var useFormCommonProps = require('../../form/src/hooks/use-form-common-props.js');
20
20
  var index$1 = require('../../../hooks/use-id/index.js');
21
+ var aria = require('../../../constants/aria.js');
21
22
  var shared = require('@vue/shared');
22
23
  var event = require('../../../constants/event.js');
23
24
  var index$2 = require('../../../hooks/use-focus-controller/index.js');
@@ -61,55 +62,60 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
61
62
  emit("update:modelValue", value);
62
63
  syncAfterCursorMove();
63
64
  };
64
- const handleInputKeyDown = (e) => {
65
+ const handleInputKeyDown = (event$1) => {
65
66
  var _a, _b, _c, _d;
66
- if (!("key" in e))
67
+ if (!("code" in event$1) || ((_a = elInputRef.value) == null ? void 0 : _a.isComposing))
67
68
  return;
68
- if ((_a = elInputRef.value) == null ? void 0 : _a.isComposing)
69
- return;
70
- if (["ArrowLeft", "ArrowRight"].includes(e.key)) {
71
- syncAfterCursorMove();
72
- } else if (["ArrowUp", "ArrowDown"].includes(e.key)) {
73
- if (!visible.value)
74
- return;
75
- e.preventDefault();
76
- const direction = e.key === "ArrowUp" ? "prev" : "next";
77
- (_b = dropdownRef.value) == null ? void 0 : _b.navigateOptions(direction);
78
- } else if (["Enter"].includes(e.key)) {
79
- if (!visible.value)
80
- return;
81
- e.preventDefault();
82
- if ((_c = dropdownRef.value) == null ? void 0 : _c.hoverOption) {
83
- (_d = dropdownRef.value) == null ? void 0 : _d.selectHoverOption();
84
- } else {
85
- visible.value = false;
86
- }
87
- } else if (["Escape"].includes(e.key)) {
88
- if (!visible.value)
89
- return;
90
- e.preventDefault();
91
- visible.value = false;
92
- } else if (["Backspace"].includes(e.key)) {
93
- if (props.whole && mentionCtx.value) {
94
- const { splitIndex, selectionEnd, pattern, prefixIndex, prefix } = mentionCtx.value;
95
- const inputEl = getInputEl();
96
- if (!inputEl)
69
+ switch (event$1.code) {
70
+ case aria.EVENT_CODE.left:
71
+ case aria.EVENT_CODE.right:
72
+ syncAfterCursorMove();
73
+ break;
74
+ case aria.EVENT_CODE.up:
75
+ case aria.EVENT_CODE.down:
76
+ if (!visible.value)
97
77
  return;
98
- const inputValue = inputEl.value;
99
- const matchOption = props.options.find((item) => item.value === pattern);
100
- const isWhole = shared.isFunction(props.checkIsWhole) ? props.checkIsWhole(pattern, prefix) : matchOption;
101
- if (isWhole && splitIndex !== -1 && splitIndex + 1 === selectionEnd) {
102
- e.preventDefault();
103
- const newValue = inputValue.slice(0, prefixIndex) + inputValue.slice(splitIndex + 1);
104
- emit(event.UPDATE_MODEL_EVENT, newValue);
105
- const newSelectionEnd = prefixIndex;
106
- vue.nextTick(() => {
107
- inputEl.selectionStart = newSelectionEnd;
108
- inputEl.selectionEnd = newSelectionEnd;
109
- syncDropdownVisible();
110
- });
78
+ event$1.preventDefault();
79
+ (_b = dropdownRef.value) == null ? void 0 : _b.navigateOptions(event$1.code === aria.EVENT_CODE.up ? "prev" : "next");
80
+ break;
81
+ case aria.EVENT_CODE.enter:
82
+ case aria.EVENT_CODE.numpadEnter:
83
+ if (!visible.value)
84
+ return;
85
+ event$1.preventDefault();
86
+ if ((_c = dropdownRef.value) == null ? void 0 : _c.hoverOption) {
87
+ (_d = dropdownRef.value) == null ? void 0 : _d.selectHoverOption();
88
+ } else {
89
+ visible.value = false;
90
+ }
91
+ break;
92
+ case aria.EVENT_CODE.esc:
93
+ if (!visible.value)
94
+ return;
95
+ event$1.preventDefault();
96
+ visible.value = false;
97
+ break;
98
+ case aria.EVENT_CODE.backspace:
99
+ if (props.whole && mentionCtx.value) {
100
+ const { splitIndex, selectionEnd, pattern, prefixIndex, prefix } = mentionCtx.value;
101
+ const inputEl = getInputEl();
102
+ if (!inputEl)
103
+ return;
104
+ const inputValue = inputEl.value;
105
+ const matchOption = props.options.find((item) => item.value === pattern);
106
+ const isWhole = shared.isFunction(props.checkIsWhole) ? props.checkIsWhole(pattern, prefix) : matchOption;
107
+ if (isWhole && splitIndex !== -1 && splitIndex + 1 === selectionEnd) {
108
+ event$1.preventDefault();
109
+ const newValue = inputValue.slice(0, prefixIndex) + inputValue.slice(splitIndex + 1);
110
+ emit(event.UPDATE_MODEL_EVENT, newValue);
111
+ const newSelectionEnd = prefixIndex;
112
+ vue.nextTick(() => {
113
+ inputEl.selectionStart = newSelectionEnd;
114
+ inputEl.selectionEnd = newSelectionEnd;
115
+ syncDropdownVisible();
116
+ });
117
+ }
111
118
  }
112
- }
113
119
  }
114
120
  };
115
121
  const { wrapperRef } = index$2.useFocusController(elInputRef, {
@@ -1 +1 @@
1
- {"version":3,"file":"mention2.js","sources":["../../../../../../packages/components/mention/src/mention.vue"],"sourcesContent":["<template>\n <div ref=\"wrapperRef\" :class=\"ns.b()\">\n <el-input\n v-bind=\"mergeProps(passInputProps, $attrs)\"\n ref=\"elInputRef\"\n :model-value=\"modelValue\"\n :disabled=\"disabled\"\n :role=\"dropdownVisible ? 'combobox' : undefined\"\n :aria-activedescendant=\"dropdownVisible ? hoveringId || '' : undefined\"\n :aria-controls=\"dropdownVisible ? contentId : undefined\"\n :aria-expanded=\"dropdownVisible || undefined\"\n :aria-label=\"ariaLabel\"\n :aria-autocomplete=\"dropdownVisible ? 'none' : undefined\"\n :aria-haspopup=\"dropdownVisible ? 'listbox' : undefined\"\n @input=\"handleInputChange\"\n @keydown=\"handleInputKeyDown\"\n @mousedown=\"handleInputMouseDown\"\n >\n <template v-for=\"(_, name) in $slots\" #[name]=\"slotProps\">\n <slot :name=\"name\" v-bind=\"slotProps\" />\n </template>\n </el-input>\n <el-tooltip\n ref=\"tooltipRef\"\n :visible=\"dropdownVisible\"\n :popper-class=\"[ns.e('popper'), popperClass]\"\n :popper-options=\"popperOptions\"\n :placement=\"computedPlacement\"\n :fallback-placements=\"computedFallbackPlacements\"\n effect=\"light\"\n pure\n :offset=\"offset\"\n :show-arrow=\"showArrow\"\n >\n <template #default>\n <div :style=\"cursorStyle\" />\n </template>\n <template #content>\n <el-mention-dropdown\n ref=\"dropdownRef\"\n :options=\"filteredOptions\"\n :disabled=\"disabled\"\n :loading=\"loading\"\n :content-id=\"contentId\"\n :aria-label=\"ariaLabel\"\n @select=\"handleSelect\"\n @click.stop=\"elInputRef?.focus\"\n >\n <template v-for=\"(_, name) in $slots\" #[name]=\"slotProps\">\n <slot :name=\"name\" v-bind=\"slotProps\" />\n </template>\n </el-mention-dropdown>\n </template>\n </el-tooltip>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, mergeProps, nextTick, ref } from 'vue'\nimport { pick } from 'lodash-unified'\nimport { useFocusController, useId, useNamespace } from '@element-plus/hooks'\nimport ElInput, { inputProps } from '@element-plus/components/input'\nimport ElTooltip from '@element-plus/components/tooltip'\nimport { UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { useFormDisabled } from '@element-plus/components/form'\nimport { isFunction } from '@element-plus/utils'\nimport { mentionEmits, mentionProps } from './mention'\nimport { getCursorPosition, getMentionCtx } from './helper'\nimport ElMentionDropdown from './mention-dropdown.vue'\n\nimport type { Placement } from '@popperjs/core'\nimport type { CSSProperties } from 'vue'\nimport type { InputInstance } from '@element-plus/components/input'\nimport type { TooltipInstance } from '@element-plus/components/tooltip'\nimport type { MentionCtx, MentionOption } from './types'\n\ndefineOptions({\n name: 'ElMention',\n inheritAttrs: false,\n})\n\nconst props = defineProps(mentionProps)\nconst emit = defineEmits(mentionEmits)\n\nconst passInputProps = computed(() => pick(props, Object.keys(inputProps)))\n\nconst ns = useNamespace('mention')\nconst disabled = useFormDisabled()\nconst contentId = useId()\n\nconst elInputRef = ref<InputInstance>()\nconst tooltipRef = ref<TooltipInstance>()\nconst dropdownRef = ref<InstanceType<typeof ElMentionDropdown>>()\n\nconst visible = ref(false)\nconst cursorStyle = ref<CSSProperties>()\nconst mentionCtx = ref<MentionCtx>()\n\nconst computedPlacement = computed<Placement>(() =>\n props.showArrow ? props.placement : `${props.placement}-start`\n)\n\nconst computedFallbackPlacements = computed<Placement[]>(() =>\n props.showArrow ? ['bottom', 'top'] : ['bottom-start', 'top-start']\n)\n\nconst filteredOptions = computed(() => {\n const { filterOption, options } = props\n if (!mentionCtx.value || !filterOption) return options\n return options.filter((option) =>\n filterOption(mentionCtx.value!.pattern, option)\n )\n})\n\nconst dropdownVisible = computed(() => {\n return visible.value && (!!filteredOptions.value.length || props.loading)\n})\n\nconst hoveringId = computed(() => {\n return `${contentId.value}-${dropdownRef.value?.hoveringIndex}`\n})\n\nconst handleInputChange = (value: string) => {\n emit('update:modelValue', value)\n syncAfterCursorMove()\n}\n\nconst handleInputKeyDown = (e: KeyboardEvent | Event) => {\n if (!('key' in e)) return\n if (elInputRef.value?.isComposing) return\n if (['ArrowLeft', 'ArrowRight'].includes(e.key)) {\n syncAfterCursorMove()\n } else if (['ArrowUp', 'ArrowDown'].includes(e.key)) {\n if (!visible.value) return\n e.preventDefault()\n const direction = e.key === 'ArrowUp' ? 'prev' : 'next'\n dropdownRef.value?.navigateOptions(direction)\n } else if (['Enter'].includes(e.key)) {\n if (!visible.value) return\n e.preventDefault()\n if (dropdownRef.value?.hoverOption) {\n dropdownRef.value?.selectHoverOption()\n } else {\n visible.value = false\n }\n } else if (['Escape'].includes(e.key)) {\n if (!visible.value) return\n e.preventDefault()\n visible.value = false\n } else if (['Backspace'].includes(e.key)) {\n if (props.whole && mentionCtx.value) {\n const { splitIndex, selectionEnd, pattern, prefixIndex, prefix } =\n mentionCtx.value\n const inputEl = getInputEl()\n if (!inputEl) return\n const inputValue = inputEl.value\n const matchOption = props.options.find((item) => item.value === pattern)\n const isWhole = isFunction(props.checkIsWhole)\n ? props.checkIsWhole(pattern, prefix)\n : matchOption\n if (isWhole && splitIndex !== -1 && splitIndex + 1 === selectionEnd) {\n e.preventDefault()\n const newValue =\n inputValue.slice(0, prefixIndex) + inputValue.slice(splitIndex + 1)\n emit(UPDATE_MODEL_EVENT, newValue)\n\n const newSelectionEnd = prefixIndex\n nextTick(() => {\n // input value is updated\n inputEl.selectionStart = newSelectionEnd\n inputEl.selectionEnd = newSelectionEnd\n syncDropdownVisible()\n })\n }\n }\n }\n}\n\nconst { wrapperRef } = useFocusController(elInputRef, {\n beforeFocus() {\n return disabled.value\n },\n afterFocus() {\n syncAfterCursorMove()\n },\n beforeBlur(event) {\n return tooltipRef.value?.isFocusInsideContent(event)\n },\n afterBlur() {\n visible.value = false\n },\n})\n\nconst handleInputMouseDown = () => {\n syncAfterCursorMove()\n}\n\nconst handleSelect = (item: MentionOption) => {\n if (!mentionCtx.value) return\n const inputEl = getInputEl()\n if (!inputEl) return\n const inputValue = inputEl.value\n const { split } = props\n\n const newEndPart = inputValue.slice(mentionCtx.value.end)\n const alreadySeparated = newEndPart.startsWith(split)\n const newMiddlePart = `${item.value}${alreadySeparated ? '' : split}`\n\n const newValue =\n inputValue.slice(0, mentionCtx.value.start) + newMiddlePart + newEndPart\n\n emit(UPDATE_MODEL_EVENT, newValue)\n emit('select', item, mentionCtx.value.prefix)\n\n const newSelectionEnd =\n mentionCtx.value.start + newMiddlePart.length + (alreadySeparated ? 1 : 0)\n\n nextTick(() => {\n // input value is updated\n inputEl.selectionStart = newSelectionEnd\n inputEl.selectionEnd = newSelectionEnd\n inputEl.focus()\n syncDropdownVisible()\n })\n}\n\nconst getInputEl = () =>\n props.type === 'textarea'\n ? elInputRef.value?.textarea\n : elInputRef.value?.input\n\nconst syncAfterCursorMove = () => {\n // can't use nextTick(), get cursor position will be wrong\n setTimeout(() => {\n syncCursor()\n syncDropdownVisible()\n nextTick(() => tooltipRef.value?.updatePopper())\n }, 0)\n}\n\nconst syncCursor = () => {\n const inputEl = getInputEl()\n if (!inputEl) return\n\n const caretPosition = getCursorPosition(inputEl)\n const inputRect = inputEl.getBoundingClientRect()\n const elInputRect = elInputRef.value!.$el.getBoundingClientRect()\n\n cursorStyle.value = {\n position: 'absolute',\n width: 0,\n height: `${caretPosition.height}px`,\n left: `${caretPosition.left + inputRect.left - elInputRect.left}px`,\n top: `${caretPosition.top + inputRect.top - elInputRect.top}px`,\n }\n}\n\nconst syncDropdownVisible = () => {\n const inputEl = getInputEl()\n if (document.activeElement !== inputEl) {\n visible.value = false\n return\n }\n const { prefix, split } = props\n mentionCtx.value = getMentionCtx(inputEl, prefix, split)\n if (mentionCtx.value && mentionCtx.value.splitIndex === -1) {\n visible.value = true\n emit('search', mentionCtx.value.pattern, mentionCtx.value.prefix)\n return\n }\n visible.value = false\n}\n\ndefineExpose({\n input: elInputRef,\n tooltip: tooltipRef,\n dropdownVisible,\n})\n</script>\n"],"names":["computed","pick","inputProps","useNamespace","useFormDisabled","useId","ref","isFunction","UPDATE_MODEL_EVENT","nextTick","useFocusController"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;uCA4Ec,CAAA;AAAA,EACZ,IAAM,EAAA,WAAA;AAAA,EACN,YAAc,EAAA,KAAA;AAChB,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAM,MAAA,cAAA,GAAiBA,aAAS,MAAMC,kBAAA,CAAK,OAAO,MAAO,CAAA,IAAA,CAAKC,gBAAU,CAAC,CAAC,CAAA,CAAA;AAE1E,IAAM,MAAA,EAAA,GAAKC,mBAAa,SAAS,CAAA,CAAA;AACjC,IAAA,MAAM,WAAWC,kCAAgB,EAAA,CAAA;AACjC,IAAA,MAAM,YAAYC,aAAM,EAAA,CAAA;AAExB,IAAA,MAAM,aAAaC,OAAmB,EAAA,CAAA;AACtC,IAAA,MAAM,aAAaA,OAAqB,EAAA,CAAA;AACxC,IAAA,MAAM,cAAcA,OAA4C,EAAA,CAAA;AAEhE,IAAM,MAAA,OAAA,GAAUA,QAAI,KAAK,CAAA,CAAA;AACzB,IAAA,MAAM,cAAcA,OAAmB,EAAA,CAAA;AACvC,IAAA,MAAM,aAAaA,OAAgB,EAAA,CAAA;AAEnC,IAAA,MAAM,iBAAoB,GAAAN,YAAA,CAAA,MAAA,KAAA,CAAA,SAAA,GAAA,KAAA,CAAA,SAAA,GAAA,CAAA,EAAA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;;;;;;;;"}
1
+ {"version":3,"file":"mention2.js","sources":["../../../../../../packages/components/mention/src/mention.vue"],"sourcesContent":["<template>\n <div ref=\"wrapperRef\" :class=\"ns.b()\">\n <el-input\n v-bind=\"mergeProps(passInputProps, $attrs)\"\n ref=\"elInputRef\"\n :model-value=\"modelValue\"\n :disabled=\"disabled\"\n :role=\"dropdownVisible ? 'combobox' : undefined\"\n :aria-activedescendant=\"dropdownVisible ? hoveringId || '' : undefined\"\n :aria-controls=\"dropdownVisible ? contentId : undefined\"\n :aria-expanded=\"dropdownVisible || undefined\"\n :aria-label=\"ariaLabel\"\n :aria-autocomplete=\"dropdownVisible ? 'none' : undefined\"\n :aria-haspopup=\"dropdownVisible ? 'listbox' : undefined\"\n @input=\"handleInputChange\"\n @keydown=\"handleInputKeyDown\"\n @mousedown=\"handleInputMouseDown\"\n >\n <template v-for=\"(_, name) in $slots\" #[name]=\"slotProps\">\n <slot :name=\"name\" v-bind=\"slotProps\" />\n </template>\n </el-input>\n <el-tooltip\n ref=\"tooltipRef\"\n :visible=\"dropdownVisible\"\n :popper-class=\"[ns.e('popper'), popperClass]\"\n :popper-options=\"popperOptions\"\n :placement=\"computedPlacement\"\n :fallback-placements=\"computedFallbackPlacements\"\n effect=\"light\"\n pure\n :offset=\"offset\"\n :show-arrow=\"showArrow\"\n >\n <template #default>\n <div :style=\"cursorStyle\" />\n </template>\n <template #content>\n <el-mention-dropdown\n ref=\"dropdownRef\"\n :options=\"filteredOptions\"\n :disabled=\"disabled\"\n :loading=\"loading\"\n :content-id=\"contentId\"\n :aria-label=\"ariaLabel\"\n @select=\"handleSelect\"\n @click.stop=\"elInputRef?.focus\"\n >\n <template v-for=\"(_, name) in $slots\" #[name]=\"slotProps\">\n <slot :name=\"name\" v-bind=\"slotProps\" />\n </template>\n </el-mention-dropdown>\n </template>\n </el-tooltip>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, mergeProps, nextTick, ref } from 'vue'\nimport { pick } from 'lodash-unified'\nimport { useFocusController, useId, useNamespace } from '@element-plus/hooks'\nimport ElInput, { inputProps } from '@element-plus/components/input'\nimport ElTooltip from '@element-plus/components/tooltip'\nimport { EVENT_CODE, UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { useFormDisabled } from '@element-plus/components/form'\nimport { isFunction } from '@element-plus/utils'\nimport { mentionEmits, mentionProps } from './mention'\nimport { getCursorPosition, getMentionCtx } from './helper'\nimport ElMentionDropdown from './mention-dropdown.vue'\n\nimport type { Placement } from '@popperjs/core'\nimport type { CSSProperties } from 'vue'\nimport type { InputInstance } from '@element-plus/components/input'\nimport type { TooltipInstance } from '@element-plus/components/tooltip'\nimport type { MentionCtx, MentionOption } from './types'\n\ndefineOptions({\n name: 'ElMention',\n inheritAttrs: false,\n})\n\nconst props = defineProps(mentionProps)\nconst emit = defineEmits(mentionEmits)\n\nconst passInputProps = computed(() => pick(props, Object.keys(inputProps)))\n\nconst ns = useNamespace('mention')\nconst disabled = useFormDisabled()\nconst contentId = useId()\n\nconst elInputRef = ref<InputInstance>()\nconst tooltipRef = ref<TooltipInstance>()\nconst dropdownRef = ref<InstanceType<typeof ElMentionDropdown>>()\n\nconst visible = ref(false)\nconst cursorStyle = ref<CSSProperties>()\nconst mentionCtx = ref<MentionCtx>()\n\nconst computedPlacement = computed<Placement>(() =>\n props.showArrow ? props.placement : `${props.placement}-start`\n)\n\nconst computedFallbackPlacements = computed<Placement[]>(() =>\n props.showArrow ? ['bottom', 'top'] : ['bottom-start', 'top-start']\n)\n\nconst filteredOptions = computed(() => {\n const { filterOption, options } = props\n if (!mentionCtx.value || !filterOption) return options\n return options.filter((option) =>\n filterOption(mentionCtx.value!.pattern, option)\n )\n})\n\nconst dropdownVisible = computed(() => {\n return visible.value && (!!filteredOptions.value.length || props.loading)\n})\n\nconst hoveringId = computed(() => {\n return `${contentId.value}-${dropdownRef.value?.hoveringIndex}`\n})\n\nconst handleInputChange = (value: string) => {\n emit('update:modelValue', value)\n syncAfterCursorMove()\n}\n\nconst handleInputKeyDown = (event: KeyboardEvent | Event) => {\n if (!('code' in event) || elInputRef.value?.isComposing) return\n\n switch (event.code) {\n case EVENT_CODE.left:\n case EVENT_CODE.right:\n syncAfterCursorMove()\n break\n case EVENT_CODE.up:\n case EVENT_CODE.down:\n if (!visible.value) return\n event.preventDefault()\n dropdownRef.value?.navigateOptions(\n event.code === EVENT_CODE.up ? 'prev' : 'next'\n )\n break\n case EVENT_CODE.enter:\n case EVENT_CODE.numpadEnter:\n if (!visible.value) return\n event.preventDefault()\n if (dropdownRef.value?.hoverOption) {\n dropdownRef.value?.selectHoverOption()\n } else {\n visible.value = false\n }\n break\n case EVENT_CODE.esc:\n if (!visible.value) return\n event.preventDefault()\n visible.value = false\n break\n case EVENT_CODE.backspace:\n if (props.whole && mentionCtx.value) {\n const { splitIndex, selectionEnd, pattern, prefixIndex, prefix } =\n mentionCtx.value\n const inputEl = getInputEl()\n if (!inputEl) return\n const inputValue = inputEl.value\n const matchOption = props.options.find((item) => item.value === pattern)\n const isWhole = isFunction(props.checkIsWhole)\n ? props.checkIsWhole(pattern, prefix)\n : matchOption\n if (isWhole && splitIndex !== -1 && splitIndex + 1 === selectionEnd) {\n event.preventDefault()\n const newValue =\n inputValue.slice(0, prefixIndex) + inputValue.slice(splitIndex + 1)\n emit(UPDATE_MODEL_EVENT, newValue)\n\n const newSelectionEnd = prefixIndex\n nextTick(() => {\n // input value is updated\n inputEl.selectionStart = newSelectionEnd\n inputEl.selectionEnd = newSelectionEnd\n syncDropdownVisible()\n })\n }\n }\n }\n}\n\nconst { wrapperRef } = useFocusController(elInputRef, {\n beforeFocus() {\n return disabled.value\n },\n afterFocus() {\n syncAfterCursorMove()\n },\n beforeBlur(event) {\n return tooltipRef.value?.isFocusInsideContent(event)\n },\n afterBlur() {\n visible.value = false\n },\n})\n\nconst handleInputMouseDown = () => {\n syncAfterCursorMove()\n}\n\nconst handleSelect = (item: MentionOption) => {\n if (!mentionCtx.value) return\n const inputEl = getInputEl()\n if (!inputEl) return\n const inputValue = inputEl.value\n const { split } = props\n\n const newEndPart = inputValue.slice(mentionCtx.value.end)\n const alreadySeparated = newEndPart.startsWith(split)\n const newMiddlePart = `${item.value}${alreadySeparated ? '' : split}`\n\n const newValue =\n inputValue.slice(0, mentionCtx.value.start) + newMiddlePart + newEndPart\n\n emit(UPDATE_MODEL_EVENT, newValue)\n emit('select', item, mentionCtx.value.prefix)\n\n const newSelectionEnd =\n mentionCtx.value.start + newMiddlePart.length + (alreadySeparated ? 1 : 0)\n\n nextTick(() => {\n // input value is updated\n inputEl.selectionStart = newSelectionEnd\n inputEl.selectionEnd = newSelectionEnd\n inputEl.focus()\n syncDropdownVisible()\n })\n}\n\nconst getInputEl = () =>\n props.type === 'textarea'\n ? elInputRef.value?.textarea\n : elInputRef.value?.input\n\nconst syncAfterCursorMove = () => {\n // can't use nextTick(), get cursor position will be wrong\n setTimeout(() => {\n syncCursor()\n syncDropdownVisible()\n nextTick(() => tooltipRef.value?.updatePopper())\n }, 0)\n}\n\nconst syncCursor = () => {\n const inputEl = getInputEl()\n if (!inputEl) return\n\n const caretPosition = getCursorPosition(inputEl)\n const inputRect = inputEl.getBoundingClientRect()\n const elInputRect = elInputRef.value!.$el.getBoundingClientRect()\n\n cursorStyle.value = {\n position: 'absolute',\n width: 0,\n height: `${caretPosition.height}px`,\n left: `${caretPosition.left + inputRect.left - elInputRect.left}px`,\n top: `${caretPosition.top + inputRect.top - elInputRect.top}px`,\n }\n}\n\nconst syncDropdownVisible = () => {\n const inputEl = getInputEl()\n if (document.activeElement !== inputEl) {\n visible.value = false\n return\n }\n const { prefix, split } = props\n mentionCtx.value = getMentionCtx(inputEl, prefix, split)\n if (mentionCtx.value && mentionCtx.value.splitIndex === -1) {\n visible.value = true\n emit('search', mentionCtx.value.pattern, mentionCtx.value.prefix)\n return\n }\n visible.value = false\n}\n\ndefineExpose({\n input: elInputRef,\n tooltip: tooltipRef,\n dropdownVisible,\n})\n</script>\n"],"names":["computed","pick","inputProps","useNamespace","useFormDisabled","useId","ref","event","EVENT_CODE","isFunction","UPDATE_MODEL_EVENT","nextTick","useFocusController","getCursorPosition","getMentionCtx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;uCA4Ec,CAAA;AAAA,EACZ,IAAM,EAAA,WAAA;AAAA,EACN,YAAc,EAAA,KAAA;AAChB,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAM,MAAA,cAAA,GAAiBA,aAAS,MAAMC,kBAAA,CAAK,OAAO,MAAO,CAAA,IAAA,CAAKC,gBAAU,CAAC,CAAC,CAAA,CAAA;AAE1E,IAAM,MAAA,EAAA,GAAKC,mBAAa,SAAS,CAAA,CAAA;AACjC,IAAA,MAAM,WAAWC,kCAAgB,EAAA,CAAA;AACjC,IAAA,MAAM,YAAYC,aAAM,EAAA,CAAA;AAExB,IAAA,MAAM,aAAaC,OAAmB,EAAA,CAAA;AACtC,IAAA,MAAM,aAAaA,OAAqB,EAAA,CAAA;AACxC,IAAA,MAAM,cAAcA,OAA4C,EAAA,CAAA;AAEhE,IAAM,MAAA,OAAA,GAAUA,QAAI,KAAK,CAAA,CAAA;AACzB,IAAA,MAAM,cAAcA,OAAmB,EAAA,CAAA;AACvC,IAAA,MAAM,aAAaA,OAAgB,EAAA,CAAA;AAEnC,IAAA,MAAM,iBAAoB,GAAAN,YAAA,CAAA,MAAA,KAAA,CAAA,SAAA,GAAA,KAAA,CAAA,SAAA,GAAA,CAAA,EAAA,KAAA,CAAA,SAAA,CAAA,MAAA,CAAA,CAAA,CAAA;AAAA,IAAA,gCACA,GAAYA,YAAA,CAAA,WAAkB,CAAA,SAAA,GAAA,CAAA,QAAA,EAAA,KAAA,CAAA,GAAA,CAAA,cAAA,EAAA,WAAA,CAAA,CAAA,CAAA;AAAA,IACxD,MAAA,eAAA,GAAAA,YAAA,CAAA,MAAA;AAEA,MAAA,MAAmC,EAAA,YAAA,EAAA,OAAA,EAAA,GAAA,KAAA,CAAA;AAAA,MAAsB,IAAA,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;
49
50
  event.currentTarget.click();
@@ -1 +1 @@
1
- {"version":3,"file":"menu-item.js","sources":["../../../../../../../packages/components/menu/src/utils/menu-item.ts"],"sourcesContent":["// @ts-nocheck\nimport { triggerEvent } from '@element-plus/utils'\nimport { EVENT_CODE } from '@element-plus/constants'\nimport SubMenu from './submenu'\n\nclass MenuItem {\n public submenu: SubMenu = null\n constructor(public domNode: HTMLElement, namespace: string) {\n this.submenu = null\n this.init(namespace)\n }\n\n init(namespace: string): void {\n this.domNode.setAttribute('tabindex', '0')\n const menuChild = this.domNode.querySelector(`.${namespace}-menu`)\n if (menuChild) {\n this.submenu = new SubMenu(this, menuChild)\n }\n this.addListeners()\n }\n\n addListeners(): void {\n this.domNode.addEventListener('keydown', (event: KeyboardEvent) => {\n let prevDef = false\n switch (event.code) {\n case EVENT_CODE.down: {\n triggerEvent(event.currentTarget as HTMLElement, 'mouseenter')\n this.submenu && this.submenu.gotoSubIndex(0)\n prevDef = true\n break\n }\n case EVENT_CODE.up: {\n triggerEvent(event.currentTarget as HTMLElement, 'mouseenter')\n this.submenu &&\n this.submenu.gotoSubIndex(this.submenu.subMenuItems.length - 1)\n prevDef = true\n break\n }\n case EVENT_CODE.tab: {\n triggerEvent(event.currentTarget as HTMLElement, 'mouseleave')\n break\n }\n case EVENT_CODE.enter:\n case EVENT_CODE.space: {\n prevDef = true\n ;(event.currentTarget as HTMLElement).click()\n break\n }\n }\n if (prevDef) {\n event.preventDefault()\n }\n })\n }\n}\n\nexport default MenuItem\n"],"names":["SubMenu","EVENT_CODE","triggerEvent"],"mappings":";;;;;;;;;;AAGA,MAAM,QAAQ,CAAC;AACf,EAAE,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE;AAClC,IAAI,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AAC3B,IAAI,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;AACxB,IAAI,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;AACxB,IAAI,IAAI,CAAC,IAAI,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,QAAQ,KAAKD,eAAU,CAAC,GAAG,EAAE;AAC7B,UAAUC,mBAAY,CAAC,KAAK,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;AAC1D,UAAU,MAAM;AAChB,SAAS;AACT,QAAQ,KAAKD,eAAU,CAAC,KAAK,CAAC;AAC9B,QAAQ,KAAKA,eAAU,CAAC,KAAK,EAAE;AAC/B,UAAU,OAAO,GAAG,IAAI,CAAC;AACzB,UAAU,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;AACtC,UAAU,MAAM;AAChB,SAAS;AACT,OAAO;AACP,MAAM,IAAI,OAAO,EAAE;AACnB,QAAQ,KAAK,CAAC,cAAc,EAAE,CAAC;AAC/B,OAAO;AACP,KAAK,CAAC,CAAC;AACP,GAAG;AACH;;;;"}
1
+ {"version":3,"file":"menu-item.js","sources":["../../../../../../../packages/components/menu/src/utils/menu-item.ts"],"sourcesContent":["// @ts-nocheck\nimport { triggerEvent } from '@element-plus/utils'\nimport { EVENT_CODE } from '@element-plus/constants'\nimport SubMenu from './submenu'\n\nclass MenuItem {\n public submenu: SubMenu = null\n constructor(public domNode: HTMLElement, namespace: string) {\n this.submenu = null\n this.init(namespace)\n }\n\n init(namespace: string): void {\n this.domNode.setAttribute('tabindex', '0')\n const menuChild = this.domNode.querySelector(`.${namespace}-menu`)\n if (menuChild) {\n this.submenu = new SubMenu(this, menuChild)\n }\n this.addListeners()\n }\n\n addListeners(): void {\n this.domNode.addEventListener('keydown', (event: KeyboardEvent) => {\n let prevDef = false\n switch (event.code) {\n case EVENT_CODE.down: {\n triggerEvent(event.currentTarget as HTMLElement, 'mouseenter')\n this.submenu && this.submenu.gotoSubIndex(0)\n prevDef = true\n break\n }\n case EVENT_CODE.up: {\n triggerEvent(event.currentTarget as HTMLElement, 'mouseenter')\n this.submenu &&\n this.submenu.gotoSubIndex(this.submenu.subMenuItems.length - 1)\n prevDef = true\n break\n }\n case EVENT_CODE.tab: {\n triggerEvent(event.currentTarget as HTMLElement, 'mouseleave')\n break\n }\n case EVENT_CODE.enter:\n case EVENT_CODE.numpadEnter:\n case EVENT_CODE.space: {\n prevDef = true\n ;(event.currentTarget as HTMLElement).click()\n break\n }\n }\n if (prevDef) {\n event.preventDefault()\n }\n })\n }\n}\n\nexport default MenuItem\n"],"names":["SubMenu","EVENT_CODE","triggerEvent"],"mappings":";;;;;;;;;;AAGA,MAAM,QAAQ,CAAC;AACf,EAAE,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE;AAClC,IAAI,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AAC3B,IAAI,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;AACxB,IAAI,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;AACxB,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACzB,GAAG;AACH,EAAE,IAAI,CAAC,SAAS,EAAE;AAClB,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;AAC/C,IAAI,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;AACvE,IAAI,IAAI,SAAS,EAAE;AACnB,MAAM,IAAI,CAAC,OAAO,GAAG,IAAIA,kBAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAClD,KAAK;AACL,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;AACxB,GAAG;AACH,EAAE,YAAY,GAAG;AACjB,IAAI,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,KAAK,KAAK;AACxD,MAAM,IAAI,OAAO,GAAG,KAAK,CAAC;AAC1B,MAAM,QAAQ,KAAK,CAAC,IAAI;AACxB,QAAQ,KAAKC,eAAU,CAAC,IAAI,EAAE;AAC9B,UAAUC,mBAAY,CAAC,KAAK,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;AAC1D,UAAU,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;AACvD,UAAU,OAAO,GAAG,IAAI,CAAC;AACzB,UAAU,MAAM;AAChB,SAAS;AACT,QAAQ,KAAKD,eAAU,CAAC,EAAE,EAAE;AAC5B,UAAUC,mBAAY,CAAC,KAAK,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;AAC1D,UAAU,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAC1F,UAAU,OAAO,GAAG,IAAI,CAAC;AACzB,UAAU,MAAM;AAChB,SAAS;AACT,QAAQ,KAAKD,eAAU,CAAC,GAAG,EAAE;AAC7B,UAAUC,mBAAY,CAAC,KAAK,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;AAC1D,UAAU,MAAM;AAChB,SAAS;AACT,QAAQ,KAAKD,eAAU,CAAC,KAAK,CAAC;AAC9B,QAAQ,KAAKA,eAAU,CAAC,WAAW,CAAC;AACpC,QAAQ,KAAKA,eAAU,CAAC,KAAK,EAAE;AAC/B,UAAU,OAAO,GAAG,IAAI,CAAC;AACzB,UAAU,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;AACtC,UAAU,MAAM;AAChB,SAAS;AACT,OAAO;AACP,MAAM,IAAI,OAAO,EAAE;AACnB,QAAQ,KAAK,CAAC,cAAc,EAAE,CAAC;AAC/B,OAAO;AACP,KAAK,CAAC,CAAC;AACP,GAAG;AACH;;;;"}
@@ -50,6 +50,7 @@ class SubMenu {
50
50
  break;
51
51
  }
52
52
  case aria.EVENT_CODE.enter:
53
+ case aria.EVENT_CODE.numpadEnter:
53
54
  case aria.EVENT_CODE.space: {
54
55
  prevDef = true;
55
56
  event.currentTarget.click();
@@ -1 +1 @@
1
- {"version":3,"file":"submenu.js","sources":["../../../../../../../packages/components/menu/src/utils/submenu.ts"],"sourcesContent":["// @ts-nocheck\nimport { triggerEvent } from '@element-plus/utils'\nimport { EVENT_CODE } from '@element-plus/constants'\nimport type MenuItem from './menu-item'\n\nclass SubMenu {\n public subMenuItems: NodeList\n public subIndex = 0\n constructor(public parent: MenuItem, public domNode: ParentNode) {\n this.subIndex = 0\n this.init()\n }\n\n init(): void {\n this.subMenuItems = this.domNode.querySelectorAll('li')\n this.addListeners()\n }\n\n gotoSubIndex(idx: number): void {\n if (idx === this.subMenuItems.length) {\n idx = 0\n } else if (idx < 0) {\n idx = this.subMenuItems.length - 1\n }\n ;(this.subMenuItems[idx] as HTMLElement).focus()\n this.subIndex = idx\n }\n\n addListeners(): void {\n const parentNode = this.parent.domNode\n Array.prototype.forEach.call(this.subMenuItems, (el: Element) => {\n el.addEventListener('keydown', (event: KeyboardEvent) => {\n let prevDef = false\n switch (event.code) {\n case EVENT_CODE.down: {\n this.gotoSubIndex(this.subIndex + 1)\n prevDef = true\n break\n }\n case EVENT_CODE.up: {\n this.gotoSubIndex(this.subIndex - 1)\n prevDef = true\n break\n }\n case EVENT_CODE.tab: {\n triggerEvent(parentNode as HTMLElement, 'mouseleave')\n break\n }\n case EVENT_CODE.enter:\n case EVENT_CODE.space: {\n prevDef = true\n ;(event.currentTarget as HTMLElement).click()\n break\n }\n }\n if (prevDef) {\n event.preventDefault()\n event.stopPropagation()\n }\n return false\n })\n })\n }\n}\n\nexport default SubMenu\n"],"names":["EVENT_CODE","triggerEvent"],"mappings":";;;;;;;;;AAEA,MAAM,OAAO,CAAC;AACd,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE;AAC/B,IAAI,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACzB,IAAI,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AAC3B,IAAI,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;AACtB,IAAI,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;AACtB,IAAI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AC,YAAY,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;AACjD,YAAY,OAAO,GAAG,IAAI,CAAC;AAC3B,YAAY,MAAM;AAClB,WAAW;AACX,UAAU,KAAKA,eAAU,CAAC,GAAG,EAAE;AAC/B,YAAYC,mBAAY,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AACnD,YAAY,MAAM;AAClB,WAAW;AACX,UAAU,KAAKD,eAAU,CAAC,KAAK,CAAC;AAChC,UAAU,KAAKA,eAAU,CAAC,KAAK,EAAE;AACjC,YAAY,OAAO,GAAG,IAAI,CAAC;AAC3B,YAAY,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;AACxC,YAAY,MAAM;AAClB,WAAW;AACX,SAAS;AACT,QAAQ,IAAI,OAAO,EAAE;AACrB,UAAU,KAAK,CAAC,cAAc,EAAE,CAAC;AACjC,UAAU,KAAK,CAAC,eAAe,EAAE,CAAC;AAClC,SAAS;AACT,QAAQ,OAAO,KAAK,CAAC;AACrB,OAAO,CAAC,CAAC;AACT,KAAK,CAAC,CAAC;AACP,GAAG;AACH;;;;"}
1
+ {"version":3,"file":"submenu.js","sources":["../../../../../../../packages/components/menu/src/utils/submenu.ts"],"sourcesContent":["// @ts-nocheck\nimport { triggerEvent } from '@element-plus/utils'\nimport { EVENT_CODE } from '@element-plus/constants'\nimport type MenuItem from './menu-item'\n\nclass SubMenu {\n public subMenuItems: NodeList\n public subIndex = 0\n constructor(public parent: MenuItem, public domNode: ParentNode) {\n this.subIndex = 0\n this.init()\n }\n\n init(): void {\n this.subMenuItems = this.domNode.querySelectorAll('li')\n this.addListeners()\n }\n\n gotoSubIndex(idx: number): void {\n if (idx === this.subMenuItems.length) {\n idx = 0\n } else if (idx < 0) {\n idx = this.subMenuItems.length - 1\n }\n ;(this.subMenuItems[idx] as HTMLElement).focus()\n this.subIndex = idx\n }\n\n addListeners(): void {\n const parentNode = this.parent.domNode\n Array.prototype.forEach.call(this.subMenuItems, (el: Element) => {\n el.addEventListener('keydown', (event: KeyboardEvent) => {\n let prevDef = false\n switch (event.code) {\n case EVENT_CODE.down: {\n this.gotoSubIndex(this.subIndex + 1)\n prevDef = true\n break\n }\n case EVENT_CODE.up: {\n this.gotoSubIndex(this.subIndex - 1)\n prevDef = true\n break\n }\n case EVENT_CODE.tab: {\n triggerEvent(parentNode as HTMLElement, 'mouseleave')\n break\n }\n case EVENT_CODE.enter:\n case EVENT_CODE.numpadEnter:\n case EVENT_CODE.space: {\n prevDef = true\n ;(event.currentTarget as HTMLElement).click()\n break\n }\n }\n if (prevDef) {\n event.preventDefault()\n event.stopPropagation()\n }\n return false\n })\n })\n }\n}\n\nexport default SubMenu\n"],"names":["EVENT_CODE","triggerEvent"],"mappings":";;;;;;;;;AAEA,MAAM,OAAO,CAAC;AACd,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE;AAC/B,IAAI,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACzB,IAAI,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AAC3B,IAAI,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;AACtB,IAAI,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;AACtB,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;AAChB,GAAG;AACH,EAAE,IAAI,GAAG;AACT,IAAI,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;AAC5D,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;AACxB,GAAG;AACH,EAAE,YAAY,CAAC,GAAG,EAAE;AACpB,IAAI,IAAI,GAAG,KAAK,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;AAC1C,MAAM,GAAG,GAAG,CAAC,CAAC;AACd,KAAK,MAAM,IAAI,GAAG,GAAG,CAAC,EAAE;AACxB,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;AACz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C;AACxC,YAAY,MAAM;AAClB,WAAW;AACX,SAAS;AACT,QAAQ,IAAI,OAAO,EAAE;AACrB,UAAU,KAAK,CAAC,cAAc,EAAE,CAAC;AACjC,UAAU,KAAK,CAAC,eAAe,EAAE,CAAC;AAClC,SAAS;AACT,QAAQ,OAAO,KAAK,CAAC;AACrB,OAAO,CAAC,CAAC;AACT,KAAK,CAAC,CAAC;AACP,GAAG;AACH;;;;"}
@@ -2,27 +2,44 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('../../../../utils/index.js');
6
- var runtime = require('../../../../utils/vue/props/runtime.js');
7
- var icon = require('../../../../utils/vue/icon.js');
5
+ var vue = require('vue');
6
+ require('../../../../hooks/index.js');
7
+ var index$1 = require('../../../icon/index.js');
8
+ var prev = require('./prev2.js');
9
+ var pluginVue_exportHelper = require('../../../../_virtual/plugin-vue_export-helper.js');
10
+ var index = require('../../../../hooks/use-locale/index.js');
8
11
 
9
- const paginationPrevProps = runtime.buildProps({
10
- disabled: Boolean,
11
- currentPage: {
12
- type: Number,
13
- default: 1
14
- },
15
- prevText: {
16
- type: String
17
- },
18
- prevIcon: {
19
- type: icon.iconPropType
12
+ const __default__ = vue.defineComponent({
13
+ name: "ElPaginationPrev"
14
+ });
15
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
16
+ ...__default__,
17
+ props: prev.paginationPrevProps,
18
+ emits: prev.paginationPrevEmits,
19
+ setup(__props) {
20
+ const props = __props;
21
+ const { t } = index.useLocale();
22
+ const internalDisabled = vue.computed(() => props.disabled || props.currentPage <= 1);
23
+ return (_ctx, _cache) => {
24
+ return vue.openBlock(), vue.createElementBlock("button", {
25
+ type: "button",
26
+ class: "btn-prev",
27
+ disabled: vue.unref(internalDisabled),
28
+ "aria-label": _ctx.prevText || vue.unref(t)("el.pagination.prev"),
29
+ "aria-disabled": vue.unref(internalDisabled),
30
+ onClick: ($event) => _ctx.$emit("click", $event)
31
+ }, [
32
+ _ctx.prevText ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(_ctx.prevText), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(index$1.ElIcon), { key: 1 }, {
33
+ default: vue.withCtx(() => [
34
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prevIcon)))
35
+ ]),
36
+ _: 1
37
+ }))
38
+ ], 8, ["disabled", "aria-label", "aria-disabled", "onClick"]);
39
+ };
20
40
  }
21
41
  });
22
- const paginationPrevEmits = {
23
- click: (evt) => evt instanceof MouseEvent
24
- };
42
+ var Prev = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "prev.vue"]]);
25
43
 
26
- exports.paginationPrevEmits = paginationPrevEmits;
27
- exports.paginationPrevProps = paginationPrevProps;
44
+ exports["default"] = Prev;
28
45
  //# sourceMappingURL=prev.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prev.js","sources":["../../../../../../../packages/components/pagination/src/components/prev.ts"],"sourcesContent":["import { buildProps, iconPropType } from '@element-plus/utils'\nimport type { ExtractPropTypes } from 'vue'\nimport type Prev from './prev.vue'\n\nexport const paginationPrevProps = buildProps({\n disabled: Boolean,\n currentPage: {\n type: Number,\n default: 1,\n },\n prevText: {\n type: String,\n },\n prevIcon: {\n type: iconPropType,\n },\n} as const)\n\nexport const paginationPrevEmits = {\n click: (evt: MouseEvent) => evt instanceof MouseEvent,\n}\n\nexport type PaginationPrevProps = ExtractPropTypes<typeof paginationPrevProps>\n\nexport type PrevInstance = InstanceType<typeof Prev>\n"],"names":["buildProps","iconPropType"],"mappings":";;;;;;;;AACY,MAAC,mBAAmB,GAAGA,kBAAU,CAAC;AAC9C,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAEC,iBAAY;AACtB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,mBAAmB,GAAG;AACnC,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,GAAG,YAAY,UAAU;AAC3C;;;;;"}
1
+ {"version":3,"file":"prev.js","sources":["../../../../../../../packages/components/pagination/src/components/prev.vue"],"sourcesContent":["<template>\n <button\n type=\"button\"\n class=\"btn-prev\"\n :disabled=\"internalDisabled\"\n :aria-label=\"prevText || t('el.pagination.prev')\"\n :aria-disabled=\"internalDisabled\"\n @click=\"$emit('click', $event)\"\n >\n <span v-if=\"prevText\">{{ prevText }}</span>\n <el-icon v-else>\n <component :is=\"prevIcon\" />\n </el-icon>\n </button>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\nimport { useLocale } from '@element-plus/hooks'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { paginationPrevEmits, paginationPrevProps } from './prev'\n\ndefineOptions({\n name: 'ElPaginationPrev',\n})\n\nconst props = defineProps(paginationPrevProps)\ndefineEmits(paginationPrevEmits)\n\nconst { t } = useLocale()\n\nconst internalDisabled = computed(\n () => props.disabled || props.currentPage <= 1\n)\n</script>\n"],"names":["useLocale","computed","_openBlock","_createElementBlock"],"mappings":";;;;;;;;;;;uCAsBc,CAAA;AAAA,EACZ,IAAM,EAAA,kBAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAM,MAAA,EAAE,CAAE,EAAA,GAAIA,eAAU,EAAA,CAAA;AAExB,IAAA,MAAM,gBAAmB,GAAAC,YAAA,CAAA,MAAA,KAAA,CAAA,QAAA,IAAA,KAAA,CAAA,WAAA,IAAA,CAAA,CAAA,CAAA;AAAA,IAAA,OACjB,CAAA,IAAA,EAAM,MAAY,KAAA;AAAqB,MAC/C,OAAAC,aAAA,EAAA,EAAAC,sBAAA,CAAA,QAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;"}
@@ -2,44 +2,27 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var vue = require('vue');
6
- require('../../../../hooks/index.js');
7
- var index$1 = require('../../../icon/index.js');
8
- var prev = require('./prev.js');
9
- var pluginVue_exportHelper = require('../../../../_virtual/plugin-vue_export-helper.js');
10
- var index = require('../../../../hooks/use-locale/index.js');
5
+ require('../../../../utils/index.js');
6
+ var runtime = require('../../../../utils/vue/props/runtime.js');
7
+ var icon = require('../../../../utils/vue/icon.js');
11
8
 
12
- const __default__ = vue.defineComponent({
13
- name: "ElPaginationPrev"
14
- });
15
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
16
- ...__default__,
17
- props: prev.paginationPrevProps,
18
- emits: prev.paginationPrevEmits,
19
- setup(__props) {
20
- const props = __props;
21
- const { t } = index.useLocale();
22
- const internalDisabled = vue.computed(() => props.disabled || props.currentPage <= 1);
23
- return (_ctx, _cache) => {
24
- return vue.openBlock(), vue.createElementBlock("button", {
25
- type: "button",
26
- class: "btn-prev",
27
- disabled: vue.unref(internalDisabled),
28
- "aria-label": _ctx.prevText || vue.unref(t)("el.pagination.prev"),
29
- "aria-disabled": vue.unref(internalDisabled),
30
- onClick: ($event) => _ctx.$emit("click", $event)
31
- }, [
32
- _ctx.prevText ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(_ctx.prevText), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(index$1.ElIcon), { key: 1 }, {
33
- default: vue.withCtx(() => [
34
- (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prevIcon)))
35
- ]),
36
- _: 1
37
- }))
38
- ], 8, ["disabled", "aria-label", "aria-disabled", "onClick"]);
39
- };
9
+ const paginationPrevProps = runtime.buildProps({
10
+ disabled: Boolean,
11
+ currentPage: {
12
+ type: Number,
13
+ default: 1
14
+ },
15
+ prevText: {
16
+ type: String
17
+ },
18
+ prevIcon: {
19
+ type: icon.iconPropType
40
20
  }
41
21
  });
42
- var Prev = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "prev.vue"]]);
22
+ const paginationPrevEmits = {
23
+ click: (evt) => evt instanceof MouseEvent
24
+ };
43
25
 
44
- exports["default"] = Prev;
26
+ exports.paginationPrevEmits = paginationPrevEmits;
27
+ exports.paginationPrevProps = paginationPrevProps;
45
28
  //# sourceMappingURL=prev2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prev2.js","sources":["../../../../../../../packages/components/pagination/src/components/prev.vue"],"sourcesContent":["<template>\n <button\n type=\"button\"\n class=\"btn-prev\"\n :disabled=\"internalDisabled\"\n :aria-label=\"prevText || t('el.pagination.prev')\"\n :aria-disabled=\"internalDisabled\"\n @click=\"$emit('click', $event)\"\n >\n <span v-if=\"prevText\">{{ prevText }}</span>\n <el-icon v-else>\n <component :is=\"prevIcon\" />\n </el-icon>\n </button>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\nimport { useLocale } from '@element-plus/hooks'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { paginationPrevEmits, paginationPrevProps } from './prev'\n\ndefineOptions({\n name: 'ElPaginationPrev',\n})\n\nconst props = defineProps(paginationPrevProps)\ndefineEmits(paginationPrevEmits)\n\nconst { t } = useLocale()\n\nconst internalDisabled = computed(\n () => props.disabled || props.currentPage <= 1\n)\n</script>\n"],"names":["useLocale","computed","_openBlock","_createElementBlock"],"mappings":";;;;;;;;;;;uCAsBc,CAAA;AAAA,EACZ,IAAM,EAAA,kBAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAM,MAAA,EAAE,CAAE,EAAA,GAAIA,eAAU,EAAA,CAAA;AAExB,IAAA,MAAM,gBAAmB,GAAAC,YAAA,CAAA,MAAA,KAAA,CAAA,QAAA,IAAA,KAAA,CAAA,WAAA,IAAA,CAAA,CAAA,CAAA;AAAA,IAAA,OACjB,CAAA,IAAA,EAAM,MAAY,KAAA;AAAqB,MAC/C,OAAAC,aAAA,EAAA,EAAAC,sBAAA,CAAA,QAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"prev2.js","sources":["../../../../../../../packages/components/pagination/src/components/prev.ts"],"sourcesContent":["import { buildProps, iconPropType } from '@element-plus/utils'\nimport type { ExtractPropTypes } from 'vue'\nimport type Prev from './prev.vue'\n\nexport const paginationPrevProps = buildProps({\n disabled: Boolean,\n currentPage: {\n type: Number,\n default: 1,\n },\n prevText: {\n type: String,\n },\n prevIcon: {\n type: iconPropType,\n },\n} as const)\n\nexport const paginationPrevEmits = {\n click: (evt: MouseEvent) => evt instanceof MouseEvent,\n}\n\nexport type PaginationPrevProps = ExtractPropTypes<typeof paginationPrevProps>\n\nexport type PrevInstance = InstanceType<typeof Prev>\n"],"names":["buildProps","iconPropType"],"mappings":";;;;;;;;AACY,MAAC,mBAAmB,GAAGA,kBAAU,CAAC;AAC9C,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAEC,iBAAY;AACtB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,mBAAmB,GAAG;AACnC,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,GAAG,YAAY,UAAU;AAC3C;;;;;"}
@@ -7,7 +7,7 @@ var iconsVue = require('@element-plus/icons-vue');
7
7
  require('../../../utils/index.js');
8
8
  require('../../../hooks/index.js');
9
9
  var constants = require('./constants.js');
10
- var prev = require('./components/prev2.js');
10
+ var prev = require('./components/prev.js');
11
11
  var next = require('./components/next2.js');
12
12
  var sizes = require('./components/sizes2.js');
13
13
  var jumper = require('./components/jumper2.js');
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var rovingFocusGroup = require('./src/roving-focus-group.js');
5
+ var rovingFocusGroup = require('./src/roving-focus-group2.js');
6
6
  var rovingFocusItem = require('./src/roving-focus-item.js');
7
7
  var tokens = require('./src/tokens.js');
8
8
  var utils = require('./src/utils.js');
9
- var rovingFocusGroup$1 = require('./src/roving-focus-group2.js');
9
+ var rovingFocusGroup$1 = require('./src/roving-focus-group.js');
10
10
 
11
11
 
12
12
 
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var vue = require('vue');
6
6
  var core = require('@vueuse/core');
7
7
  require('../../../utils/index.js');
8
- var rovingFocusGroup = require('./roving-focus-group2.js');
8
+ var rovingFocusGroup = require('./roving-focus-group.js');
9
9
  var tokens = require('./tokens.js');
10
10
  var utils = require('./utils.js');
11
11
  var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');