@element-plus/nightly 0.0.20241121 → 0.0.20241123

Sign up to get free protection for your applications and to get access to all the features.
Files changed (352) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/index.full.js +27 -20
  3. package/dist/index.full.min.js +15 -15
  4. package/dist/index.full.min.js.map +1 -1
  5. package/dist/index.full.min.mjs +15 -15
  6. package/dist/index.full.min.mjs.map +1 -1
  7. package/dist/index.full.mjs +27 -21
  8. package/dist/locale/af.js +1 -1
  9. package/dist/locale/af.min.js +1 -1
  10. package/dist/locale/af.min.mjs +1 -1
  11. package/dist/locale/af.mjs +1 -1
  12. package/dist/locale/ar-eg.js +1 -1
  13. package/dist/locale/ar-eg.min.js +1 -1
  14. package/dist/locale/ar-eg.min.mjs +1 -1
  15. package/dist/locale/ar-eg.mjs +1 -1
  16. package/dist/locale/ar.js +1 -1
  17. package/dist/locale/ar.min.js +1 -1
  18. package/dist/locale/ar.min.mjs +1 -1
  19. package/dist/locale/ar.mjs +1 -1
  20. package/dist/locale/az.js +1 -1
  21. package/dist/locale/az.min.js +1 -1
  22. package/dist/locale/az.min.mjs +1 -1
  23. package/dist/locale/az.mjs +1 -1
  24. package/dist/locale/bg.js +1 -1
  25. package/dist/locale/bg.min.js +1 -1
  26. package/dist/locale/bg.min.mjs +1 -1
  27. package/dist/locale/bg.mjs +1 -1
  28. package/dist/locale/bn.js +1 -1
  29. package/dist/locale/bn.min.js +1 -1
  30. package/dist/locale/bn.min.mjs +1 -1
  31. package/dist/locale/bn.mjs +1 -1
  32. package/dist/locale/ca.js +1 -1
  33. package/dist/locale/ca.min.js +1 -1
  34. package/dist/locale/ca.min.mjs +1 -1
  35. package/dist/locale/ca.mjs +1 -1
  36. package/dist/locale/ckb.js +1 -1
  37. package/dist/locale/ckb.min.js +1 -1
  38. package/dist/locale/ckb.min.mjs +1 -1
  39. package/dist/locale/ckb.mjs +1 -1
  40. package/dist/locale/cs.js +1 -1
  41. package/dist/locale/cs.min.js +1 -1
  42. package/dist/locale/cs.min.mjs +1 -1
  43. package/dist/locale/cs.mjs +1 -1
  44. package/dist/locale/da.js +1 -1
  45. package/dist/locale/da.min.js +1 -1
  46. package/dist/locale/da.min.mjs +1 -1
  47. package/dist/locale/da.mjs +1 -1
  48. package/dist/locale/de.js +1 -1
  49. package/dist/locale/de.min.js +1 -1
  50. package/dist/locale/de.min.mjs +1 -1
  51. package/dist/locale/de.mjs +1 -1
  52. package/dist/locale/el.js +1 -1
  53. package/dist/locale/el.min.js +1 -1
  54. package/dist/locale/el.min.mjs +1 -1
  55. package/dist/locale/el.mjs +1 -1
  56. package/dist/locale/en.js +1 -1
  57. package/dist/locale/en.min.js +1 -1
  58. package/dist/locale/en.min.mjs +1 -1
  59. package/dist/locale/en.mjs +1 -1
  60. package/dist/locale/eo.js +1 -1
  61. package/dist/locale/eo.min.js +1 -1
  62. package/dist/locale/eo.min.mjs +1 -1
  63. package/dist/locale/eo.mjs +1 -1
  64. package/dist/locale/es.js +1 -1
  65. package/dist/locale/es.min.js +1 -1
  66. package/dist/locale/es.min.mjs +1 -1
  67. package/dist/locale/es.mjs +1 -1
  68. package/dist/locale/et.js +1 -1
  69. package/dist/locale/et.min.js +1 -1
  70. package/dist/locale/et.min.mjs +1 -1
  71. package/dist/locale/et.mjs +1 -1
  72. package/dist/locale/eu.js +1 -1
  73. package/dist/locale/eu.min.js +1 -1
  74. package/dist/locale/eu.min.mjs +1 -1
  75. package/dist/locale/eu.mjs +1 -1
  76. package/dist/locale/fa.js +1 -1
  77. package/dist/locale/fa.min.js +1 -1
  78. package/dist/locale/fa.min.mjs +1 -1
  79. package/dist/locale/fa.mjs +1 -1
  80. package/dist/locale/fi.js +1 -1
  81. package/dist/locale/fi.min.js +1 -1
  82. package/dist/locale/fi.min.mjs +1 -1
  83. package/dist/locale/fi.mjs +1 -1
  84. package/dist/locale/fr.js +1 -1
  85. package/dist/locale/fr.min.js +1 -1
  86. package/dist/locale/fr.min.mjs +1 -1
  87. package/dist/locale/fr.mjs +1 -1
  88. package/dist/locale/he.js +1 -1
  89. package/dist/locale/he.min.js +1 -1
  90. package/dist/locale/he.min.mjs +1 -1
  91. package/dist/locale/he.mjs +1 -1
  92. package/dist/locale/hr.js +1 -1
  93. package/dist/locale/hr.min.js +1 -1
  94. package/dist/locale/hr.min.mjs +1 -1
  95. package/dist/locale/hr.mjs +1 -1
  96. package/dist/locale/hu.js +1 -1
  97. package/dist/locale/hu.min.js +1 -1
  98. package/dist/locale/hu.min.mjs +1 -1
  99. package/dist/locale/hu.mjs +1 -1
  100. package/dist/locale/hy-am.js +1 -1
  101. package/dist/locale/hy-am.min.js +1 -1
  102. package/dist/locale/hy-am.min.mjs +1 -1
  103. package/dist/locale/hy-am.mjs +1 -1
  104. package/dist/locale/id.js +1 -1
  105. package/dist/locale/id.min.js +1 -1
  106. package/dist/locale/id.min.mjs +1 -1
  107. package/dist/locale/id.mjs +1 -1
  108. package/dist/locale/it.js +1 -1
  109. package/dist/locale/it.min.js +1 -1
  110. package/dist/locale/it.min.mjs +1 -1
  111. package/dist/locale/it.mjs +1 -1
  112. package/dist/locale/ja.js +1 -1
  113. package/dist/locale/ja.min.js +1 -1
  114. package/dist/locale/ja.min.mjs +1 -1
  115. package/dist/locale/ja.mjs +1 -1
  116. package/dist/locale/kk.js +1 -1
  117. package/dist/locale/kk.min.js +1 -1
  118. package/dist/locale/kk.min.mjs +1 -1
  119. package/dist/locale/kk.mjs +1 -1
  120. package/dist/locale/km.js +1 -1
  121. package/dist/locale/km.min.js +1 -1
  122. package/dist/locale/km.min.mjs +1 -1
  123. package/dist/locale/km.mjs +1 -1
  124. package/dist/locale/ko.js +1 -1
  125. package/dist/locale/ko.min.js +1 -1
  126. package/dist/locale/ko.min.mjs +1 -1
  127. package/dist/locale/ko.mjs +1 -1
  128. package/dist/locale/ku.js +1 -1
  129. package/dist/locale/ku.min.js +1 -1
  130. package/dist/locale/ku.min.mjs +1 -1
  131. package/dist/locale/ku.mjs +1 -1
  132. package/dist/locale/ky.js +1 -1
  133. package/dist/locale/ky.min.js +1 -1
  134. package/dist/locale/ky.min.mjs +1 -1
  135. package/dist/locale/ky.mjs +1 -1
  136. package/dist/locale/lt.js +1 -1
  137. package/dist/locale/lt.min.js +1 -1
  138. package/dist/locale/lt.min.mjs +1 -1
  139. package/dist/locale/lt.mjs +1 -1
  140. package/dist/locale/lv.js +1 -1
  141. package/dist/locale/lv.min.js +1 -1
  142. package/dist/locale/lv.min.mjs +1 -1
  143. package/dist/locale/lv.mjs +1 -1
  144. package/dist/locale/mg.js +1 -1
  145. package/dist/locale/mg.min.js +1 -1
  146. package/dist/locale/mg.min.mjs +1 -1
  147. package/dist/locale/mg.mjs +1 -1
  148. package/dist/locale/mn.js +1 -1
  149. package/dist/locale/mn.min.js +1 -1
  150. package/dist/locale/mn.min.mjs +1 -1
  151. package/dist/locale/mn.mjs +1 -1
  152. package/dist/locale/ms.js +1 -1
  153. package/dist/locale/ms.min.js +1 -1
  154. package/dist/locale/ms.min.mjs +1 -1
  155. package/dist/locale/ms.mjs +1 -1
  156. package/dist/locale/my.js +1 -1
  157. package/dist/locale/my.min.js +1 -1
  158. package/dist/locale/my.min.mjs +1 -1
  159. package/dist/locale/my.mjs +1 -1
  160. package/dist/locale/nb-no.js +1 -1
  161. package/dist/locale/nb-no.min.js +1 -1
  162. package/dist/locale/nb-no.min.mjs +1 -1
  163. package/dist/locale/nb-no.mjs +1 -1
  164. package/dist/locale/nl.js +1 -1
  165. package/dist/locale/nl.min.js +1 -1
  166. package/dist/locale/nl.min.mjs +1 -1
  167. package/dist/locale/nl.mjs +1 -1
  168. package/dist/locale/pa.js +1 -1
  169. package/dist/locale/pa.min.js +1 -1
  170. package/dist/locale/pa.min.mjs +1 -1
  171. package/dist/locale/pa.mjs +1 -1
  172. package/dist/locale/pl.js +1 -1
  173. package/dist/locale/pl.min.js +1 -1
  174. package/dist/locale/pl.min.mjs +1 -1
  175. package/dist/locale/pl.mjs +1 -1
  176. package/dist/locale/pt-br.js +1 -1
  177. package/dist/locale/pt-br.min.js +1 -1
  178. package/dist/locale/pt-br.min.mjs +1 -1
  179. package/dist/locale/pt-br.mjs +1 -1
  180. package/dist/locale/pt.js +1 -1
  181. package/dist/locale/pt.min.js +1 -1
  182. package/dist/locale/pt.min.mjs +1 -1
  183. package/dist/locale/pt.mjs +1 -1
  184. package/dist/locale/ro.js +1 -1
  185. package/dist/locale/ro.min.js +1 -1
  186. package/dist/locale/ro.min.mjs +1 -1
  187. package/dist/locale/ro.mjs +1 -1
  188. package/dist/locale/ru.js +1 -1
  189. package/dist/locale/ru.min.js +1 -1
  190. package/dist/locale/ru.min.mjs +1 -1
  191. package/dist/locale/ru.mjs +1 -1
  192. package/dist/locale/sk.js +1 -1
  193. package/dist/locale/sk.min.js +1 -1
  194. package/dist/locale/sk.min.mjs +1 -1
  195. package/dist/locale/sk.mjs +1 -1
  196. package/dist/locale/sl.js +1 -1
  197. package/dist/locale/sl.min.js +1 -1
  198. package/dist/locale/sl.min.mjs +1 -1
  199. package/dist/locale/sl.mjs +1 -1
  200. package/dist/locale/sr.js +1 -1
  201. package/dist/locale/sr.min.js +1 -1
  202. package/dist/locale/sr.min.mjs +1 -1
  203. package/dist/locale/sr.mjs +1 -1
  204. package/dist/locale/sv.js +1 -1
  205. package/dist/locale/sv.min.js +1 -1
  206. package/dist/locale/sv.min.mjs +1 -1
  207. package/dist/locale/sv.mjs +1 -1
  208. package/dist/locale/sw.js +1 -1
  209. package/dist/locale/sw.min.js +1 -1
  210. package/dist/locale/sw.min.mjs +1 -1
  211. package/dist/locale/sw.mjs +1 -1
  212. package/dist/locale/ta.js +1 -1
  213. package/dist/locale/ta.min.js +1 -1
  214. package/dist/locale/ta.min.mjs +1 -1
  215. package/dist/locale/ta.mjs +1 -1
  216. package/dist/locale/th.js +1 -1
  217. package/dist/locale/th.min.js +1 -1
  218. package/dist/locale/th.min.mjs +1 -1
  219. package/dist/locale/th.mjs +1 -1
  220. package/dist/locale/tk.js +1 -1
  221. package/dist/locale/tk.min.js +1 -1
  222. package/dist/locale/tk.min.mjs +1 -1
  223. package/dist/locale/tk.mjs +1 -1
  224. package/dist/locale/tr.js +1 -1
  225. package/dist/locale/tr.min.js +1 -1
  226. package/dist/locale/tr.min.mjs +1 -1
  227. package/dist/locale/tr.mjs +1 -1
  228. package/dist/locale/ug-cn.js +1 -1
  229. package/dist/locale/ug-cn.min.js +1 -1
  230. package/dist/locale/ug-cn.min.mjs +1 -1
  231. package/dist/locale/ug-cn.mjs +1 -1
  232. package/dist/locale/uk.js +1 -1
  233. package/dist/locale/uk.min.js +1 -1
  234. package/dist/locale/uk.min.mjs +1 -1
  235. package/dist/locale/uk.mjs +1 -1
  236. package/dist/locale/uz-uz.js +1 -1
  237. package/dist/locale/uz-uz.min.js +1 -1
  238. package/dist/locale/uz-uz.min.mjs +1 -1
  239. package/dist/locale/uz-uz.mjs +1 -1
  240. package/dist/locale/vi.js +1 -1
  241. package/dist/locale/vi.min.js +1 -1
  242. package/dist/locale/vi.min.mjs +1 -1
  243. package/dist/locale/vi.mjs +1 -1
  244. package/dist/locale/zh-cn.js +1 -1
  245. package/dist/locale/zh-cn.min.js +1 -1
  246. package/dist/locale/zh-cn.min.mjs +1 -1
  247. package/dist/locale/zh-cn.mjs +1 -1
  248. package/dist/locale/zh-tw.js +1 -1
  249. package/dist/locale/zh-tw.min.js +1 -1
  250. package/dist/locale/zh-tw.min.mjs +1 -1
  251. package/dist/locale/zh-tw.mjs +1 -1
  252. package/es/components/calendar/src/date-table2.mjs +9 -4
  253. package/es/components/calendar/src/date-table2.mjs.map +1 -1
  254. package/es/components/cascader/src/cascader2.mjs +2 -2
  255. package/es/components/cascader/src/cascader2.mjs.map +1 -1
  256. package/es/components/date-picker/src/date-picker.d.ts +12 -11
  257. package/es/components/date-picker/src/date-picker.mjs.map +1 -1
  258. package/es/components/index.mjs +5 -5
  259. package/es/components/popper/index.mjs +2 -2
  260. package/es/components/popper/src/content.mjs +93 -137
  261. package/es/components/popper/src/content.mjs.map +1 -1
  262. package/es/components/popper/src/content2.mjs +137 -93
  263. package/es/components/popper/src/content2.mjs.map +1 -1
  264. package/es/components/scrollbar/index.mjs +2 -2
  265. package/es/components/scrollbar/src/scrollbar.mjs +171 -55
  266. package/es/components/scrollbar/src/scrollbar.mjs.map +1 -1
  267. package/es/components/scrollbar/src/scrollbar2.mjs +55 -171
  268. package/es/components/scrollbar/src/scrollbar2.mjs.map +1 -1
  269. package/es/components/select/src/select2.mjs +3 -4
  270. package/es/components/select/src/select2.mjs.map +1 -1
  271. package/es/components/select-v2/src/select.mjs +3 -4
  272. package/es/components/select-v2/src/select.mjs.map +1 -1
  273. package/es/components/switch/index.mjs +2 -2
  274. package/es/components/switch/src/switch.mjs +72 -229
  275. package/es/components/switch/src/switch.mjs.map +1 -1
  276. package/es/components/switch/src/switch2.mjs +229 -72
  277. package/es/components/switch/src/switch2.mjs.map +1 -1
  278. package/es/components/teleport/index.mjs +2 -2
  279. package/es/components/teleport/src/teleport.mjs +18 -9
  280. package/es/components/teleport/src/teleport.mjs.map +1 -1
  281. package/es/components/teleport/src/teleport2.mjs +9 -18
  282. package/es/components/teleport/src/teleport2.mjs.map +1 -1
  283. package/es/components/time-picker/index.mjs +1 -1
  284. package/es/components/time-picker/src/common/picker.mjs +5 -5
  285. package/es/components/time-picker/src/common/picker.mjs.map +1 -1
  286. package/es/components/time-picker/src/utils.d.ts +2 -0
  287. package/es/components/time-picker/src/utils.mjs +4 -1
  288. package/es/components/time-picker/src/utils.mjs.map +1 -1
  289. package/es/components/tooltip/src/content.mjs +1 -1
  290. package/es/components/tooltip/src/content2.mjs +1 -1
  291. package/es/components/tree-select/src/tree-select.mjs +1 -1
  292. package/es/components/tree-select/src/tree-select.mjs.map +1 -1
  293. package/es/index.mjs +5 -5
  294. package/es/version.d.ts +1 -1
  295. package/es/version.mjs +1 -1
  296. package/es/version.mjs.map +1 -1
  297. package/lib/components/calendar/src/date-table2.js +8 -3
  298. package/lib/components/calendar/src/date-table2.js.map +1 -1
  299. package/lib/components/cascader/src/cascader2.js +2 -2
  300. package/lib/components/cascader/src/cascader2.js.map +1 -1
  301. package/lib/components/date-picker/src/date-picker.d.ts +12 -11
  302. package/lib/components/date-picker/src/date-picker.js.map +1 -1
  303. package/lib/components/index.js +5 -4
  304. package/lib/components/index.js.map +1 -1
  305. package/lib/components/popper/index.js +2 -2
  306. package/lib/components/popper/src/content.js +98 -137
  307. package/lib/components/popper/src/content.js.map +1 -1
  308. package/lib/components/popper/src/content2.js +137 -98
  309. package/lib/components/popper/src/content2.js.map +1 -1
  310. package/lib/components/scrollbar/index.js +2 -2
  311. package/lib/components/scrollbar/src/scrollbar.js +171 -56
  312. package/lib/components/scrollbar/src/scrollbar.js.map +1 -1
  313. package/lib/components/scrollbar/src/scrollbar2.js +56 -171
  314. package/lib/components/scrollbar/src/scrollbar2.js.map +1 -1
  315. package/lib/components/select/src/select2.js +3 -4
  316. package/lib/components/select/src/select2.js.map +1 -1
  317. package/lib/components/select-v2/src/select.js +3 -4
  318. package/lib/components/select-v2/src/select.js.map +1 -1
  319. package/lib/components/switch/index.js +2 -2
  320. package/lib/components/switch/src/switch.js +72 -228
  321. package/lib/components/switch/src/switch.js.map +1 -1
  322. package/lib/components/switch/src/switch2.js +228 -72
  323. package/lib/components/switch/src/switch2.js.map +1 -1
  324. package/lib/components/teleport/index.js +2 -2
  325. package/lib/components/teleport/src/teleport.js +18 -9
  326. package/lib/components/teleport/src/teleport.js.map +1 -1
  327. package/lib/components/teleport/src/teleport2.js +9 -18
  328. package/lib/components/teleport/src/teleport2.js.map +1 -1
  329. package/lib/components/time-picker/index.js +1 -0
  330. package/lib/components/time-picker/index.js.map +1 -1
  331. package/lib/components/time-picker/src/common/picker.js +4 -4
  332. package/lib/components/time-picker/src/common/picker.js.map +1 -1
  333. package/lib/components/time-picker/src/utils.d.ts +2 -0
  334. package/lib/components/time-picker/src/utils.js +4 -0
  335. package/lib/components/time-picker/src/utils.js.map +1 -1
  336. package/lib/components/tooltip/src/content.js +1 -1
  337. package/lib/components/tooltip/src/content2.js +1 -1
  338. package/lib/components/tree-select/src/tree-select.js +1 -1
  339. package/lib/components/tree-select/src/tree-select.js.map +1 -1
  340. package/lib/index.js +5 -4
  341. package/lib/index.js.map +1 -1
  342. package/lib/version.d.ts +1 -1
  343. package/lib/version.js +1 -1
  344. package/lib/version.js.map +1 -1
  345. package/package.json +2 -2
  346. package/theme-chalk/el-button.css +1 -1
  347. package/theme-chalk/el-cascader.css +1 -1
  348. package/theme-chalk/index.css +1 -1
  349. package/theme-chalk/src/cascader.scss +18 -4
  350. package/theme-chalk/src/common/var.scss +42 -1
  351. package/theme-chalk/src/segmented.scss +1 -1
  352. package/web-types.json +1 -1
@@ -1,143 +1,99 @@
1
- import { defineComponent, inject, ref, provide, onMounted, watch, unref, onBeforeUnmount, openBlock, createElementBlock, mergeProps, createVNode, withCtx, renderSlot } from 'vue';
2
- import { isNil } from 'lodash-unified';
1
+ import { placements } from '@popperjs/core';
3
2
  import '../../../utils/index.mjs';
4
- import '../../focus-trap/index.mjs';
5
- import '../../form/index.mjs';
6
- import { POPPER_CONTENT_INJECTION_KEY } from './constants.mjs';
7
- import { popperContentProps, popperContentEmits } from './content2.mjs';
8
- import './composables/index.mjs';
9
- import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
10
- import { usePopperContentFocusTrap } from './composables/use-focus-trap.mjs';
11
- import { usePopperContent } from './composables/use-content.mjs';
12
- import { usePopperContentDOM } from './composables/use-content-dom.mjs';
13
- import { formItemContextKey } from '../../form/src/constants.mjs';
14
- import { NOOP } from '@vue/shared';
15
- import { isElement } from '../../../utils/types.mjs';
16
- import ElFocusTrap from '../../focus-trap/src/focus-trap.mjs';
3
+ import '../../../hooks/index.mjs';
4
+ import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
5
+ import { useAriaProps } from '../../../hooks/use-aria/index.mjs';
17
6
 
18
- const __default__ = defineComponent({
19
- name: "ElPopperContent"
20
- });
21
- const _sfc_main = /* @__PURE__ */ defineComponent({
22
- ...__default__,
23
- props: popperContentProps,
24
- emits: popperContentEmits,
25
- setup(__props, { expose, emit }) {
26
- const props = __props;
27
- const {
28
- focusStartRef,
29
- trapped,
30
- onFocusAfterReleased,
31
- onFocusAfterTrapped,
32
- onFocusInTrap,
33
- onFocusoutPrevented,
34
- onReleaseRequested
35
- } = usePopperContentFocusTrap(props, emit);
36
- const { attributes, arrowRef, contentRef, styles, instanceRef, role, update } = usePopperContent(props);
37
- const {
38
- ariaModal,
39
- arrowStyle,
40
- contentAttrs,
41
- contentClass,
42
- contentStyle,
43
- updateZIndex
44
- } = usePopperContentDOM(props, {
45
- styles,
46
- attributes,
47
- role
48
- });
49
- const formItemContext = inject(formItemContextKey, void 0);
50
- const arrowOffset = ref();
51
- provide(POPPER_CONTENT_INJECTION_KEY, {
52
- arrowStyle,
53
- arrowRef,
54
- arrowOffset
55
- });
56
- if (formItemContext) {
57
- provide(formItemContextKey, {
58
- ...formItemContext,
59
- addInputId: NOOP,
60
- removeInputId: NOOP
61
- });
62
- }
63
- let triggerTargetAriaStopWatch = void 0;
64
- const updatePopper = (shouldUpdateZIndex = true) => {
65
- update();
66
- shouldUpdateZIndex && updateZIndex();
67
- };
68
- const togglePopperAlive = () => {
69
- updatePopper(false);
70
- if (props.visible && props.focusOnShow) {
71
- trapped.value = true;
72
- } else if (props.visible === false) {
73
- trapped.value = false;
74
- }
75
- };
76
- onMounted(() => {
77
- watch(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => {
78
- triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
79
- triggerTargetAriaStopWatch = void 0;
80
- const el = unref(triggerTargetEl || contentRef.value);
81
- const prevEl = unref(prevTriggerTargetEl || contentRef.value);
82
- if (isElement(el)) {
83
- triggerTargetAriaStopWatch = watch([role, () => props.ariaLabel, ariaModal, () => props.id], (watches) => {
84
- ;
85
- ["role", "aria-label", "aria-modal", "id"].forEach((key, idx) => {
86
- isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
87
- });
88
- }, { immediate: true });
89
- }
90
- if (prevEl !== el && isElement(prevEl)) {
91
- ;
92
- ["role", "aria-label", "aria-modal", "id"].forEach((key) => {
93
- prevEl.removeAttribute(key);
94
- });
95
- }
96
- }, { immediate: true });
97
- watch(() => props.visible, togglePopperAlive, { immediate: true });
98
- });
99
- onBeforeUnmount(() => {
100
- triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
101
- triggerTargetAriaStopWatch = void 0;
102
- });
103
- expose({
104
- popperContentRef: contentRef,
105
- popperInstanceRef: instanceRef,
106
- updatePopper,
107
- contentStyle
108
- });
109
- return (_ctx, _cache) => {
110
- return openBlock(), createElementBlock("div", mergeProps({
111
- ref_key: "contentRef",
112
- ref: contentRef
113
- }, unref(contentAttrs), {
114
- style: unref(contentStyle),
115
- class: unref(contentClass),
116
- tabindex: "-1",
117
- onMouseenter: (e) => _ctx.$emit("mouseenter", e),
118
- onMouseleave: (e) => _ctx.$emit("mouseleave", e)
119
- }), [
120
- createVNode(unref(ElFocusTrap), {
121
- trapped: unref(trapped),
122
- "trap-on-focus-in": true,
123
- "focus-trap-el": unref(contentRef),
124
- "focus-start-el": unref(focusStartRef),
125
- onFocusAfterTrapped: unref(onFocusAfterTrapped),
126
- onFocusAfterReleased: unref(onFocusAfterReleased),
127
- onFocusin: unref(onFocusInTrap),
128
- onFocusoutPrevented: unref(onFocusoutPrevented),
129
- onReleaseRequested: unref(onReleaseRequested)
130
- }, {
131
- default: withCtx(() => [
132
- renderSlot(_ctx.$slots, "default")
133
- ]),
134
- _: 3
135
- }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
136
- ], 16, ["onMouseenter", "onMouseleave"]);
137
- };
7
+ const POSITIONING_STRATEGIES = ["fixed", "absolute"];
8
+ const popperCoreConfigProps = buildProps({
9
+ boundariesPadding: {
10
+ type: Number,
11
+ default: 0
12
+ },
13
+ fallbackPlacements: {
14
+ type: definePropType(Array),
15
+ default: void 0
16
+ },
17
+ gpuAcceleration: {
18
+ type: Boolean,
19
+ default: true
20
+ },
21
+ offset: {
22
+ type: Number,
23
+ default: 12
24
+ },
25
+ placement: {
26
+ type: String,
27
+ values: placements,
28
+ default: "bottom"
29
+ },
30
+ popperOptions: {
31
+ type: definePropType(Object),
32
+ default: () => ({})
33
+ },
34
+ strategy: {
35
+ type: String,
36
+ values: POSITIONING_STRATEGIES,
37
+ default: "absolute"
138
38
  }
139
39
  });
140
- var ElPopperContent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "content.vue"]]);
40
+ const popperContentProps = buildProps({
41
+ ...popperCoreConfigProps,
42
+ id: String,
43
+ style: {
44
+ type: definePropType([String, Array, Object])
45
+ },
46
+ className: {
47
+ type: definePropType([String, Array, Object])
48
+ },
49
+ effect: {
50
+ type: definePropType(String),
51
+ default: "dark"
52
+ },
53
+ visible: Boolean,
54
+ enterable: {
55
+ type: Boolean,
56
+ default: true
57
+ },
58
+ pure: Boolean,
59
+ focusOnShow: {
60
+ type: Boolean,
61
+ default: false
62
+ },
63
+ trapping: {
64
+ type: Boolean,
65
+ default: false
66
+ },
67
+ popperClass: {
68
+ type: definePropType([String, Array, Object])
69
+ },
70
+ popperStyle: {
71
+ type: definePropType([String, Array, Object])
72
+ },
73
+ referenceEl: {
74
+ type: definePropType(Object)
75
+ },
76
+ triggerTargetEl: {
77
+ type: definePropType(Object)
78
+ },
79
+ stopPopperMouseEvent: {
80
+ type: Boolean,
81
+ default: true
82
+ },
83
+ virtualTriggering: Boolean,
84
+ zIndex: Number,
85
+ ...useAriaProps(["ariaLabel"])
86
+ });
87
+ const popperContentEmits = {
88
+ mouseenter: (evt) => evt instanceof MouseEvent,
89
+ mouseleave: (evt) => evt instanceof MouseEvent,
90
+ focus: () => true,
91
+ blur: () => true,
92
+ close: () => true
93
+ };
94
+ const usePopperCoreConfigProps = popperCoreConfigProps;
95
+ const usePopperContentProps = popperContentProps;
96
+ const usePopperContentEmits = popperContentEmits;
141
97
 
142
- export { ElPopperContent as default };
98
+ export { popperContentEmits, popperContentProps, popperCoreConfigProps, usePopperContentEmits, usePopperContentProps, usePopperCoreConfigProps };
143
99
  //# sourceMappingURL=content.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"content.mjs","sources":["../../../../../../packages/components/popper/src/content.vue"],"sourcesContent":["<template>\n <div\n ref=\"contentRef\"\n v-bind=\"contentAttrs\"\n :style=\"contentStyle\"\n :class=\"contentClass\"\n tabindex=\"-1\"\n @mouseenter=\"(e) => $emit('mouseenter', e)\"\n @mouseleave=\"(e) => $emit('mouseleave', e)\"\n >\n <el-focus-trap\n :trapped=\"trapped\"\n :trap-on-focus-in=\"true\"\n :focus-trap-el=\"contentRef\"\n :focus-start-el=\"focusStartRef\"\n @focus-after-trapped=\"onFocusAfterTrapped\"\n @focus-after-released=\"onFocusAfterReleased\"\n @focusin=\"onFocusInTrap\"\n @focusout-prevented=\"onFocusoutPrevented\"\n @release-requested=\"onReleaseRequested\"\n >\n <slot />\n </el-focus-trap>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n unref,\n watch,\n} from 'vue'\nimport { isNil } from 'lodash-unified'\nimport { NOOP, isElement } from '@element-plus/utils'\nimport ElFocusTrap from '@element-plus/components/focus-trap'\nimport { formItemContextKey } from '@element-plus/components/form'\nimport { POPPER_CONTENT_INJECTION_KEY } from './constants'\nimport { popperContentEmits, popperContentProps } from './content'\nimport {\n usePopperContent,\n usePopperContentDOM,\n usePopperContentFocusTrap,\n} from './composables'\n\nimport type { WatchStopHandle } from 'vue'\n\ndefineOptions({\n name: 'ElPopperContent',\n})\n\nconst emit = defineEmits(popperContentEmits)\n\nconst props = defineProps(popperContentProps)\n\nconst {\n focusStartRef,\n trapped,\n\n onFocusAfterReleased,\n onFocusAfterTrapped,\n onFocusInTrap,\n onFocusoutPrevented,\n onReleaseRequested,\n} = usePopperContentFocusTrap(props, emit)\n\nconst { attributes, arrowRef, contentRef, styles, instanceRef, role, update } =\n usePopperContent(props)\n\nconst {\n ariaModal,\n arrowStyle,\n contentAttrs,\n contentClass,\n contentStyle,\n updateZIndex,\n} = usePopperContentDOM(props, {\n styles,\n attributes,\n role,\n})\n\nconst formItemContext = inject(formItemContextKey, undefined)\nconst arrowOffset = ref<number>()\n\nprovide(POPPER_CONTENT_INJECTION_KEY, {\n arrowStyle,\n arrowRef,\n arrowOffset,\n})\n\nif (formItemContext) {\n // disallow auto-id from inside popper content\n provide(formItemContextKey, {\n ...formItemContext,\n addInputId: NOOP,\n removeInputId: NOOP,\n })\n}\n\nlet triggerTargetAriaStopWatch: WatchStopHandle | undefined = undefined\n\nconst updatePopper = (shouldUpdateZIndex = true) => {\n update()\n shouldUpdateZIndex && updateZIndex()\n}\n\nconst togglePopperAlive = () => {\n updatePopper(false)\n if (props.visible && props.focusOnShow) {\n trapped.value = true\n } else if (props.visible === false) {\n trapped.value = false\n }\n}\n\nonMounted(() => {\n watch(\n () => props.triggerTargetEl,\n (triggerTargetEl, prevTriggerTargetEl) => {\n triggerTargetAriaStopWatch?.()\n triggerTargetAriaStopWatch = undefined\n\n const el = unref(triggerTargetEl || contentRef.value)\n const prevEl = unref(prevTriggerTargetEl || contentRef.value)\n\n if (isElement(el)) {\n triggerTargetAriaStopWatch = watch(\n [role, () => props.ariaLabel, ariaModal, () => props.id],\n (watches) => {\n ;['role', 'aria-label', 'aria-modal', 'id'].forEach((key, idx) => {\n isNil(watches[idx])\n ? el.removeAttribute(key)\n : el.setAttribute(key, watches[idx]!)\n })\n },\n { immediate: true }\n )\n }\n if (prevEl !== el && isElement(prevEl)) {\n ;['role', 'aria-label', 'aria-modal', 'id'].forEach((key) => {\n prevEl.removeAttribute(key)\n })\n }\n },\n { immediate: true }\n )\n\n watch(() => props.visible, togglePopperAlive, { immediate: true })\n})\n\nonBeforeUnmount(() => {\n triggerTargetAriaStopWatch?.()\n triggerTargetAriaStopWatch = undefined\n})\n\ndefineExpose({\n /**\n * @description popper content element\n */\n popperContentRef: contentRef,\n /**\n * @description popperjs instance\n */\n popperInstanceRef: instanceRef,\n /**\n * @description method for updating popper\n */\n updatePopper,\n\n /**\n * @description content style\n */\n contentStyle,\n})\n</script>\n"],"names":["_openBlock","_createElementBlock","_mergeProps","_unref","_createVNode"],"mappings":";;;;;;;;;;;;;;;;;mCAkDc,CAAA;AAAA,EACZ,IAAM,EAAA,iBAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAMA,IAAM,MAAA;AAAA,MACJ,aAAA;AAAA,MACA,OAAA;AAAA,MAEA,oBAAA;AAAA,MACA,mBAAA;AAAA,MACA,aAAA;AAAA,MACA,mBAAA;AAAA,MACA,kBAAA;AAAA,KACF,GAAI,yBAA0B,CAAA,KAAA,EAAO,IAAI,CAAA,CAAA;AAEzC,IAAM,MAAA,EAAE,UAAY,EAAA,QAAA,EAAU,UAAY,EAAA,MAAA,EAAQ,aAAa,IAAM,EAAA,MAAA,EACnE,GAAA,gBAAA,CAAiB,KAAK,CAAA,CAAA;AAExB,IAAM,MAAA;AAAA,MACJ,SAAA;AAAA,MACA,UAAA;AAAA,MACA,YAAA;AAAA,MACA,YAAA;AAAA,MACA,YAAA;AAAA,MACA,YAAA;AAAA,KACF,GAAI,oBAAoB,KAAO,EAAA;AAAA,MAC7B,MAAA;AAAA,MACA,UAAA;AAAA,MACA,IAAA;AAAA,KACD,CAAA,CAAA;AAED,IAAM,MAAA,eAAA,GAAkB,MAAO,CAAA,kBAAA,EAAoB,KAAS,CAAA,CAAA,CAAA;AAC5D,IAAA,MAAM,cAAc,GAAY,EAAA,CAAA;AAEhC,IAAA,OAAA,CAAQ,4BAA8B,EAAA;AAAA,MACpC,UAAA;AAAA,MACA,QAAA;AAAA,MACA,WAAA;AAAA,KACD,CAAA,CAAA;AAED,IAAA,IAAI,eAAiB,EAAA;AAEnB,MAA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A;AAAA,MAC9B,OAAAA,SAAA,EAAA,EAAAC,kBAAA,CAAA,KAAA,EAAAC,UAAA,CAAA;AAED,QAAa,OAAA,EAAA,YAAA;AAAA,QAAA,GAAA,EAAA,UAAA;AAAA,OAAA,EAAAC,KAAA,CAAA,YAAA,CAAA,EAAA;AAAA,QAAA,KAAA,EAAAA,KAAA,CAAA,YAAA,CAAA;AAAA,QAIO,KAAA,EAAAA,KAAA,CAAA,YAAA,CAAA;AAAA,QAAA,QAAA,EAAA,IAAA;AAAA,QAAA,YAAA,EAAA,CAAA,CAAA,KAAA,IAAA,CAAA,KAAA,CAAA,YAAA,EAAA,CAAA,CAAA;AAAA,QAAA,YAAA,EAAA,CAAA,CAAA,KAAA,IAAA,CAAA,KAAA,CAAA,YAAA,EAAA,CAAA,CAAA;AAAA,OAIC,CAAA,EAAA;AAAA,QAAAC,WAAA,CAAAD,KAAA,CAAA,WAAA,CAAA,EAAA;AAAA,UAAA,OAAA,EAAAA,KAAA,CAAA,OAAA,CAAA;AAAA,UAAA,kBAAA,EAAA,IAAA;AAAA,UAInB,eAAA,EAAAA,KAAA,CAAA,UAAA,CAAA;AAAA,UAAA,gBAAA,EAAAA,KAAA,CAAA,aAAA,CAAA;AAAA,UAAA,mBAAA,EAAAA,KAAA,CAAA,mBAAA,CAAA;AAAA,UAAA,oBAAA,EAAAA,KAAA,CAAA,oBAAA,CAAA;AAAA,UAKA,SAAA,EAAAA,KAAA,CAAA,aAAA,CAAA;AAAA,UACD,mBAAA,EAAAA,KAAA,CAAA,mBAAA,CAAA;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"content.mjs","sources":["../../../../../../packages/components/popper/src/content.ts"],"sourcesContent":["import { placements } from '@popperjs/core'\nimport { buildProps, definePropType } from '@element-plus/utils'\nimport { useAriaProps } from '@element-plus/hooks'\n\nimport type { PopperEffect } from './popper'\nimport type { ExtractPropTypes, StyleValue } from 'vue'\nimport type { Options, Placement } from '@popperjs/core'\nimport type { Measurable } from './constants'\nimport type Content from './content.vue'\n\ntype ClassObjectType = Record<string, boolean>\ntype ClassType = string | ClassObjectType | ClassType[]\n\nconst POSITIONING_STRATEGIES = ['fixed', 'absolute'] as const\n\nexport interface CreatePopperInstanceParams {\n referenceEl: Measurable\n popperContentEl: HTMLElement\n arrowEl: HTMLElement | undefined\n}\n\nexport const popperCoreConfigProps = buildProps({\n boundariesPadding: {\n type: Number,\n default: 0,\n },\n fallbackPlacements: {\n type: definePropType<Placement[]>(Array),\n default: undefined,\n },\n gpuAcceleration: {\n type: Boolean,\n default: true,\n },\n /**\n * @description offset of the Tooltip\n */\n offset: {\n type: Number,\n default: 12,\n },\n /**\n * @description position of Tooltip\n */\n placement: {\n type: String,\n values: placements,\n default: 'bottom',\n },\n /**\n * @description [popper.js](https://popper.js.org/docs/v2/) parameters\n */\n popperOptions: {\n type: definePropType<Partial<Options>>(Object),\n default: () => ({}),\n },\n strategy: {\n type: String,\n values: POSITIONING_STRATEGIES,\n default: 'absolute',\n },\n} as const)\nexport type PopperCoreConfigProps = ExtractPropTypes<\n typeof popperCoreConfigProps\n>\n\nexport const popperContentProps = buildProps({\n ...popperCoreConfigProps,\n id: String,\n style: {\n type: definePropType<StyleValue>([String, Array, Object]),\n },\n className: {\n type: definePropType<ClassType>([String, Array, Object]),\n },\n effect: {\n type: definePropType<PopperEffect | string>(String),\n default: 'dark',\n },\n visible: Boolean,\n enterable: {\n type: Boolean,\n default: true,\n },\n pure: Boolean,\n focusOnShow: {\n type: Boolean,\n default: false,\n },\n trapping: {\n type: Boolean,\n default: false,\n },\n popperClass: {\n type: definePropType<ClassType>([String, Array, Object]),\n },\n popperStyle: {\n type: definePropType<StyleValue>([String, Array, Object]),\n },\n referenceEl: {\n type: definePropType<HTMLElement>(Object),\n },\n triggerTargetEl: {\n type: definePropType<HTMLElement>(Object),\n },\n stopPopperMouseEvent: {\n type: Boolean,\n default: true,\n },\n virtualTriggering: Boolean,\n zIndex: Number,\n ...useAriaProps(['ariaLabel']),\n} as const)\nexport type PopperContentProps = ExtractPropTypes<typeof popperContentProps>\n\nexport const popperContentEmits = {\n mouseenter: (evt: MouseEvent) => evt instanceof MouseEvent,\n mouseleave: (evt: MouseEvent) => evt instanceof MouseEvent,\n focus: () => true,\n blur: () => true,\n close: () => true,\n}\nexport type PopperContentEmits = typeof popperContentEmits\n\nexport type PopperContentInstance = InstanceType<typeof Content>\n\n/** @deprecated use `popperCoreConfigProps` instead, and it will be deprecated in the next major version */\nexport const usePopperCoreConfigProps = popperCoreConfigProps\n\n/** @deprecated use `popperContentProps` instead, and it will be deprecated in the next major version */\nexport const usePopperContentProps = popperContentProps\n\n/** @deprecated use `popperContentEmits` instead, and it will be deprecated in the next major version */\nexport const usePopperContentEmits = popperContentEmits\n\n/** @deprecated use `PopperCoreConfigProps` instead, and it will be deprecated in the next major version */\nexport type UsePopperCoreConfigProps = PopperCoreConfigProps\n\n/** @deprecated use `PopperContentProps` instead, and it will be deprecated in the next major version */\nexport type UsePopperContentProps = PopperContentProps\n\n/** @deprecated use `PopperContentInstance` instead, and it will be deprecated in the next major version */\nexport type ElPopperArrowContent = PopperContentInstance\n"],"names":[],"mappings":";;;;;;AAGA,MAAM,sBAAsB,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;AACzC,MAAC,qBAAqB,GAAG,UAAU,CAAC;AAChD,EAAE,iBAAiB,EAAE;AACrB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,kBAAkB,EAAE;AACtB,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,eAAe,EAAE;AACnB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;A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c,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AACjD,GAAG;AACH,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AACjD,GAAG;AACH,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,eAAe,EAAE;AACnB,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,oBAAoB,EAAE;AACxB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,iBAAiB,EAAE,OAAO;AAC5B,EAAE,MAAM,EAAE,MAAM;AAChB,EAAE,GAAG,YAAY,CAAC,CAAC,WAAW,CAAC,CAAC;AAChC,CAAC,EAAE;AACS,MAAC,kBAAkB,GAAG;AAClC,EAAE,UAAU,EAAE,CAAC,GAAG,KAAK,GAAG,YAAY,UAAU;AAChD,EAAE,UAAU,EAAE,CAAC,GAAG,KAAK,GAAG,YAAY,UAAU;AAChD,EAAE,KAAK,EAAE,MAAM,IAAI;AACnB,EAAE,IAAI,EAAE,MAAM,IAAI;AAClB,EAAE,KAAK,EAAE,MAAM,IAAI;AACnB,EAAE;AACU,MAAC,wBAAwB,GAAG,sBAAsB;AAClD,MAAC,qBAAqB,GAAG,mBAAmB;AAC5C,MAAC,qBAAqB,GAAG;;;;"}
@@ -1,99 +1,143 @@
1
- import { placements } from '@popperjs/core';
1
+ import { defineComponent, inject, ref, provide, onMounted, watch, unref, onBeforeUnmount, openBlock, createElementBlock, mergeProps, createVNode, withCtx, renderSlot } from 'vue';
2
+ import { isNil } from 'lodash-unified';
2
3
  import '../../../utils/index.mjs';
3
- import '../../../hooks/index.mjs';
4
- import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
5
- import { useAriaProps } from '../../../hooks/use-aria/index.mjs';
4
+ import '../../focus-trap/index.mjs';
5
+ import '../../form/index.mjs';
6
+ import { POPPER_CONTENT_INJECTION_KEY } from './constants.mjs';
7
+ import { popperContentProps, popperContentEmits } from './content.mjs';
8
+ import './composables/index.mjs';
9
+ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
10
+ import { usePopperContentFocusTrap } from './composables/use-focus-trap.mjs';
11
+ import { usePopperContent } from './composables/use-content.mjs';
12
+ import { usePopperContentDOM } from './composables/use-content-dom.mjs';
13
+ import { formItemContextKey } from '../../form/src/constants.mjs';
14
+ import { NOOP } from '@vue/shared';
15
+ import { isElement } from '../../../utils/types.mjs';
16
+ import ElFocusTrap from '../../focus-trap/src/focus-trap.mjs';
6
17
 
7
- const POSITIONING_STRATEGIES = ["fixed", "absolute"];
8
- const popperCoreConfigProps = buildProps({
9
- boundariesPadding: {
10
- type: Number,
11
- default: 0
12
- },
13
- fallbackPlacements: {
14
- type: definePropType(Array),
15
- default: void 0
16
- },
17
- gpuAcceleration: {
18
- type: Boolean,
19
- default: true
20
- },
21
- offset: {
22
- type: Number,
23
- default: 12
24
- },
25
- placement: {
26
- type: String,
27
- values: placements,
28
- default: "bottom"
29
- },
30
- popperOptions: {
31
- type: definePropType(Object),
32
- default: () => ({})
33
- },
34
- strategy: {
35
- type: String,
36
- values: POSITIONING_STRATEGIES,
37
- default: "absolute"
38
- }
18
+ const __default__ = defineComponent({
19
+ name: "ElPopperContent"
39
20
  });
40
- const popperContentProps = buildProps({
41
- ...popperCoreConfigProps,
42
- id: String,
43
- style: {
44
- type: definePropType([String, Array, Object])
45
- },
46
- className: {
47
- type: definePropType([String, Array, Object])
48
- },
49
- effect: {
50
- type: definePropType(String),
51
- default: "dark"
52
- },
53
- visible: Boolean,
54
- enterable: {
55
- type: Boolean,
56
- default: true
57
- },
58
- pure: Boolean,
59
- focusOnShow: {
60
- type: Boolean,
61
- default: false
62
- },
63
- trapping: {
64
- type: Boolean,
65
- default: false
66
- },
67
- popperClass: {
68
- type: definePropType([String, Array, Object])
69
- },
70
- popperStyle: {
71
- type: definePropType([String, Array, Object])
72
- },
73
- referenceEl: {
74
- type: definePropType(Object)
75
- },
76
- triggerTargetEl: {
77
- type: definePropType(Object)
78
- },
79
- stopPopperMouseEvent: {
80
- type: Boolean,
81
- default: true
82
- },
83
- virtualTriggering: Boolean,
84
- zIndex: Number,
85
- ...useAriaProps(["ariaLabel"])
21
+ const _sfc_main = /* @__PURE__ */ defineComponent({
22
+ ...__default__,
23
+ props: popperContentProps,
24
+ emits: popperContentEmits,
25
+ setup(__props, { expose, emit }) {
26
+ const props = __props;
27
+ const {
28
+ focusStartRef,
29
+ trapped,
30
+ onFocusAfterReleased,
31
+ onFocusAfterTrapped,
32
+ onFocusInTrap,
33
+ onFocusoutPrevented,
34
+ onReleaseRequested
35
+ } = usePopperContentFocusTrap(props, emit);
36
+ const { attributes, arrowRef, contentRef, styles, instanceRef, role, update } = usePopperContent(props);
37
+ const {
38
+ ariaModal,
39
+ arrowStyle,
40
+ contentAttrs,
41
+ contentClass,
42
+ contentStyle,
43
+ updateZIndex
44
+ } = usePopperContentDOM(props, {
45
+ styles,
46
+ attributes,
47
+ role
48
+ });
49
+ const formItemContext = inject(formItemContextKey, void 0);
50
+ const arrowOffset = ref();
51
+ provide(POPPER_CONTENT_INJECTION_KEY, {
52
+ arrowStyle,
53
+ arrowRef,
54
+ arrowOffset
55
+ });
56
+ if (formItemContext) {
57
+ provide(formItemContextKey, {
58
+ ...formItemContext,
59
+ addInputId: NOOP,
60
+ removeInputId: NOOP
61
+ });
62
+ }
63
+ let triggerTargetAriaStopWatch = void 0;
64
+ const updatePopper = (shouldUpdateZIndex = true) => {
65
+ update();
66
+ shouldUpdateZIndex && updateZIndex();
67
+ };
68
+ const togglePopperAlive = () => {
69
+ updatePopper(false);
70
+ if (props.visible && props.focusOnShow) {
71
+ trapped.value = true;
72
+ } else if (props.visible === false) {
73
+ trapped.value = false;
74
+ }
75
+ };
76
+ onMounted(() => {
77
+ watch(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => {
78
+ triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
79
+ triggerTargetAriaStopWatch = void 0;
80
+ const el = unref(triggerTargetEl || contentRef.value);
81
+ const prevEl = unref(prevTriggerTargetEl || contentRef.value);
82
+ if (isElement(el)) {
83
+ triggerTargetAriaStopWatch = watch([role, () => props.ariaLabel, ariaModal, () => props.id], (watches) => {
84
+ ;
85
+ ["role", "aria-label", "aria-modal", "id"].forEach((key, idx) => {
86
+ isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
87
+ });
88
+ }, { immediate: true });
89
+ }
90
+ if (prevEl !== el && isElement(prevEl)) {
91
+ ;
92
+ ["role", "aria-label", "aria-modal", "id"].forEach((key) => {
93
+ prevEl.removeAttribute(key);
94
+ });
95
+ }
96
+ }, { immediate: true });
97
+ watch(() => props.visible, togglePopperAlive, { immediate: true });
98
+ });
99
+ onBeforeUnmount(() => {
100
+ triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
101
+ triggerTargetAriaStopWatch = void 0;
102
+ });
103
+ expose({
104
+ popperContentRef: contentRef,
105
+ popperInstanceRef: instanceRef,
106
+ updatePopper,
107
+ contentStyle
108
+ });
109
+ return (_ctx, _cache) => {
110
+ return openBlock(), createElementBlock("div", mergeProps({
111
+ ref_key: "contentRef",
112
+ ref: contentRef
113
+ }, unref(contentAttrs), {
114
+ style: unref(contentStyle),
115
+ class: unref(contentClass),
116
+ tabindex: "-1",
117
+ onMouseenter: (e) => _ctx.$emit("mouseenter", e),
118
+ onMouseleave: (e) => _ctx.$emit("mouseleave", e)
119
+ }), [
120
+ createVNode(unref(ElFocusTrap), {
121
+ trapped: unref(trapped),
122
+ "trap-on-focus-in": true,
123
+ "focus-trap-el": unref(contentRef),
124
+ "focus-start-el": unref(focusStartRef),
125
+ onFocusAfterTrapped: unref(onFocusAfterTrapped),
126
+ onFocusAfterReleased: unref(onFocusAfterReleased),
127
+ onFocusin: unref(onFocusInTrap),
128
+ onFocusoutPrevented: unref(onFocusoutPrevented),
129
+ onReleaseRequested: unref(onReleaseRequested)
130
+ }, {
131
+ default: withCtx(() => [
132
+ renderSlot(_ctx.$slots, "default")
133
+ ]),
134
+ _: 3
135
+ }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
136
+ ], 16, ["onMouseenter", "onMouseleave"]);
137
+ };
138
+ }
86
139
  });
87
- const popperContentEmits = {
88
- mouseenter: (evt) => evt instanceof MouseEvent,
89
- mouseleave: (evt) => evt instanceof MouseEvent,
90
- focus: () => true,
91
- blur: () => true,
92
- close: () => true
93
- };
94
- const usePopperCoreConfigProps = popperCoreConfigProps;
95
- const usePopperContentProps = popperContentProps;
96
- const usePopperContentEmits = popperContentEmits;
140
+ var ElPopperContent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "content.vue"]]);
97
141
 
98
- export { popperContentEmits, popperContentProps, popperCoreConfigProps, usePopperContentEmits, usePopperContentProps, usePopperCoreConfigProps };
142
+ export { ElPopperContent as default };
99
143
  //# sourceMappingURL=content2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"content2.mjs","sources":["../../../../../../packages/components/popper/src/content.ts"],"sourcesContent":["import { placements } from '@popperjs/core'\nimport { buildProps, definePropType } from '@element-plus/utils'\nimport { useAriaProps } from '@element-plus/hooks'\n\nimport type { PopperEffect } from './popper'\nimport type { ExtractPropTypes, StyleValue } from 'vue'\nimport type { Options, Placement } from '@popperjs/core'\nimport type { Measurable } from './constants'\nimport type Content from './content.vue'\n\ntype ClassObjectType = Record<string, boolean>\ntype ClassType = string | ClassObjectType | ClassType[]\n\nconst POSITIONING_STRATEGIES = ['fixed', 'absolute'] as const\n\nexport interface CreatePopperInstanceParams {\n referenceEl: Measurable\n popperContentEl: HTMLElement\n arrowEl: HTMLElement | undefined\n}\n\nexport const popperCoreConfigProps = buildProps({\n boundariesPadding: {\n type: Number,\n default: 0,\n },\n fallbackPlacements: {\n type: definePropType<Placement[]>(Array),\n default: undefined,\n },\n gpuAcceleration: {\n type: Boolean,\n default: true,\n },\n /**\n * @description offset of the Tooltip\n */\n offset: {\n type: Number,\n default: 12,\n },\n /**\n * @description position of Tooltip\n */\n placement: {\n type: String,\n values: placements,\n default: 'bottom',\n },\n /**\n * @description [popper.js](https://popper.js.org/docs/v2/) parameters\n */\n popperOptions: {\n type: definePropType<Partial<Options>>(Object),\n default: () => ({}),\n },\n strategy: {\n type: String,\n values: POSITIONING_STRATEGIES,\n default: 'absolute',\n },\n} as const)\nexport type PopperCoreConfigProps = ExtractPropTypes<\n typeof popperCoreConfigProps\n>\n\nexport const popperContentProps = buildProps({\n ...popperCoreConfigProps,\n id: String,\n style: {\n type: definePropType<StyleValue>([String, Array, Object]),\n },\n className: {\n type: definePropType<ClassType>([String, Array, Object]),\n },\n effect: {\n type: definePropType<PopperEffect | string>(String),\n default: 'dark',\n },\n visible: Boolean,\n enterable: {\n type: Boolean,\n default: true,\n },\n pure: Boolean,\n focusOnShow: {\n type: Boolean,\n default: false,\n },\n trapping: {\n type: Boolean,\n default: false,\n },\n popperClass: {\n type: definePropType<ClassType>([String, Array, Object]),\n },\n popperStyle: {\n type: definePropType<StyleValue>([String, Array, Object]),\n },\n referenceEl: {\n type: definePropType<HTMLElement>(Object),\n },\n triggerTargetEl: {\n type: definePropType<HTMLElement>(Object),\n },\n stopPopperMouseEvent: {\n type: Boolean,\n default: true,\n },\n virtualTriggering: Boolean,\n zIndex: Number,\n ...useAriaProps(['ariaLabel']),\n} as const)\nexport type PopperContentProps = ExtractPropTypes<typeof popperContentProps>\n\nexport const popperContentEmits = {\n mouseenter: (evt: MouseEvent) => evt instanceof MouseEvent,\n mouseleave: (evt: MouseEvent) => evt instanceof MouseEvent,\n focus: () => true,\n blur: () => true,\n close: () => true,\n}\nexport type PopperContentEmits = typeof popperContentEmits\n\nexport type PopperContentInstance = InstanceType<typeof Content>\n\n/** @deprecated use `popperCoreConfigProps` instead, and it will be deprecated in the next major version */\nexport const usePopperCoreConfigProps = popperCoreConfigProps\n\n/** @deprecated use `popperContentProps` instead, and it will be deprecated in the next major version */\nexport const usePopperContentProps = popperContentProps\n\n/** @deprecated use `popperContentEmits` instead, and it will be deprecated in the next major version */\nexport const usePopperContentEmits = popperContentEmits\n\n/** @deprecated use `PopperCoreConfigProps` instead, and it will be deprecated in the next major version */\nexport type UsePopperCoreConfigProps = PopperCoreConfigProps\n\n/** @deprecated use `PopperContentProps` instead, and it will be deprecated in the next major version */\nexport type UsePopperContentProps = PopperContentProps\n\n/** @deprecated use `PopperContentInstance` instead, and it will be deprecated in the next major version */\nexport type ElPopperArrowContent = PopperContentInstance\n"],"names":[],"mappings":";;;;;;AAGA,MAAM,sBAAsB,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;AACzC,MAAC,qBAAqB,GAAG,UAAU,CAAC;AAChD,EAAE,iBAAiB,EAAE;AACrB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,kBAAkB,EAAE;AACtB,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,eAAe,EAAE;AACnB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,UAAU;AACtB,IAAI,OAAO,EAAE,QAAQ;AACrB,GAAG;AACH,EAAE,aAAa,EAAE;AACjB,IAAI,IAAI,EAAE,cAAc,CAAC,M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G;AACH,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,eAAe,EAAE;AACnB,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,oBAAoB,EAAE;AACxB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,iBAAiB,EAAE,OAAO;AAC5B,EAAE,MAAM,EAAE,MAAM;AAChB,EAAE,GAAG,YAAY,CAAC,CAAC,WAAW,CAAC,CAAC;AAChC,CAAC,EAAE;AACS,MAAC,kBAAkB,GAAG;AAClC,EAAE,UAAU,EAAE,CAAC,GAAG,KAAK,GAAG,YAAY,UAAU;AAChD,EAAE,UAAU,EAAE,CAAC,GAAG,KAAK,GAAG,YAAY,UAAU;AAChD,EAAE,KAAK,EAAE,MAAM,IAAI;AACnB,EAAE,IAAI,EAAE,MAAM,IAAI;AAClB,EAAE,KAAK,EAAE,MAAM,IAAI;AACnB,EAAE;AACU,MAAC,wBAAwB,GAAG,sBAAsB;AAClD,MAAC,qBAAqB,GAAG,mBAAmB;AAC5C,MAAC,qBAAqB,GAAG;;;;"}
1
+ {"version":3,"file":"content2.mjs","sources":["../../../../../../packages/components/popper/src/content.vue"],"sourcesContent":["<template>\n <div\n ref=\"contentRef\"\n v-bind=\"contentAttrs\"\n :style=\"contentStyle\"\n :class=\"contentClass\"\n tabindex=\"-1\"\n @mouseenter=\"(e) => $emit('mouseenter', e)\"\n @mouseleave=\"(e) => $emit('mouseleave', e)\"\n >\n <el-focus-trap\n :trapped=\"trapped\"\n :trap-on-focus-in=\"true\"\n :focus-trap-el=\"contentRef\"\n :focus-start-el=\"focusStartRef\"\n @focus-after-trapped=\"onFocusAfterTrapped\"\n @focus-after-released=\"onFocusAfterReleased\"\n @focusin=\"onFocusInTrap\"\n @focusout-prevented=\"onFocusoutPrevented\"\n @release-requested=\"onReleaseRequested\"\n >\n <slot />\n </el-focus-trap>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n unref,\n watch,\n} from 'vue'\nimport { isNil } from 'lodash-unified'\nimport { NOOP, isElement } from '@element-plus/utils'\nimport ElFocusTrap from '@element-plus/components/focus-trap'\nimport { formItemContextKey } from '@element-plus/components/form'\nimport { POPPER_CONTENT_INJECTION_KEY } from './constants'\nimport { popperContentEmits, popperContentProps } from './content'\nimport {\n usePopperContent,\n usePopperContentDOM,\n usePopperContentFocusTrap,\n} from './composables'\n\nimport type { WatchStopHandle } from 'vue'\n\ndefineOptions({\n name: 'ElPopperContent',\n})\n\nconst emit = defineEmits(popperContentEmits)\n\nconst props = defineProps(popperContentProps)\n\nconst {\n focusStartRef,\n trapped,\n\n onFocusAfterReleased,\n onFocusAfterTrapped,\n onFocusInTrap,\n onFocusoutPrevented,\n onReleaseRequested,\n} = usePopperContentFocusTrap(props, emit)\n\nconst { attributes, arrowRef, contentRef, styles, instanceRef, role, update } =\n usePopperContent(props)\n\nconst {\n ariaModal,\n arrowStyle,\n contentAttrs,\n contentClass,\n contentStyle,\n updateZIndex,\n} = usePopperContentDOM(props, {\n styles,\n attributes,\n role,\n})\n\nconst formItemContext = inject(formItemContextKey, undefined)\nconst arrowOffset = ref<number>()\n\nprovide(POPPER_CONTENT_INJECTION_KEY, {\n arrowStyle,\n arrowRef,\n arrowOffset,\n})\n\nif (formItemContext) {\n // disallow auto-id from inside popper content\n provide(formItemContextKey, {\n ...formItemContext,\n addInputId: NOOP,\n removeInputId: NOOP,\n })\n}\n\nlet triggerTargetAriaStopWatch: WatchStopHandle | undefined = undefined\n\nconst updatePopper = (shouldUpdateZIndex = true) => {\n update()\n shouldUpdateZIndex && updateZIndex()\n}\n\nconst togglePopperAlive = () => {\n updatePopper(false)\n if (props.visible && props.focusOnShow) {\n trapped.value = true\n } else if (props.visible === false) {\n trapped.value = false\n }\n}\n\nonMounted(() => {\n watch(\n () => props.triggerTargetEl,\n (triggerTargetEl, prevTriggerTargetEl) => {\n triggerTargetAriaStopWatch?.()\n triggerTargetAriaStopWatch = undefined\n\n const el = unref(triggerTargetEl || contentRef.value)\n const prevEl = unref(prevTriggerTargetEl || contentRef.value)\n\n if (isElement(el)) {\n triggerTargetAriaStopWatch = watch(\n [role, () => props.ariaLabel, ariaModal, () => props.id],\n (watches) => {\n ;['role', 'aria-label', 'aria-modal', 'id'].forEach((key, idx) => {\n isNil(watches[idx])\n ? el.removeAttribute(key)\n : el.setAttribute(key, watches[idx]!)\n })\n },\n { immediate: true }\n )\n }\n if (prevEl !== el && isElement(prevEl)) {\n ;['role', 'aria-label', 'aria-modal', 'id'].forEach((key) => {\n prevEl.removeAttribute(key)\n })\n }\n },\n { immediate: true }\n )\n\n watch(() => props.visible, togglePopperAlive, { immediate: true })\n})\n\nonBeforeUnmount(() => {\n triggerTargetAriaStopWatch?.()\n triggerTargetAriaStopWatch = undefined\n})\n\ndefineExpose({\n /**\n * @description popper content element\n */\n popperContentRef: contentRef,\n /**\n * @description popperjs instance\n */\n popperInstanceRef: instanceRef,\n /**\n * @description method for updating popper\n */\n updatePopper,\n\n /**\n * @description content style\n */\n contentStyle,\n})\n</script>\n"],"names":["_openBlock","_createElementBlock","_mergeProps","_unref","_createVNode"],"mappings":";;;;;;;;;;;;;;;;;mCAkDc,CAAA;AAAA,EACZ,IAAM,EAAA,iBAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAMA,IAAM,MAAA;AAAA,MACJ,aAAA;AAAA,MACA,OAAA;AAAA,MAEA,oBAAA;AAAA,MACA,mBAAA;AAAA,MACA,aAAA;AAAA,MACA,mBAAA;AAAA,MACA,kBAAA;AAAA,KACF,GAAI,yBAA0B,CAAA,KAAA,EAAO,IAAI,CAAA,CAAA;AAEzC,IAAM,MAAA,EAAE,UAAY,EAAA,QAAA,EAAU,UAAY,EAAA,MAAA,EAAQ,aAAa,IAAM,EAAA,MAAA,E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A,EAAAA,KAAA,CAAA,UAAA,CAAA;AAAA,UAAA,gBAAA,EAAAA,KAAA,CAAA,aAAA,CAAA;AAAA,UAAA,mBAAA,EAAAA,KAAA,CAAA,mBAAA,CAAA;AAAA,UAAA,oBAAA,EAAAA,KAAA,CAAA,oBAAA,CAAA;AAAA,UAKA,SAAA,EAAAA,KAAA,CAAA,aAAA,CAAA;AAAA,UACD,mBAAA,EAAAA,KAAA,CAAA,mBAAA,CAAA;;;;;;;;;;;;;;;;"}
@@ -1,7 +1,7 @@
1
1
  import '../../utils/index.mjs';
2
- import Scrollbar from './src/scrollbar2.mjs';
2
+ import Scrollbar from './src/scrollbar.mjs';
3
3
  export { BAR_MAP, GAP, renderThumbStyle } from './src/util.mjs';
4
- export { scrollbarEmits, scrollbarProps } from './src/scrollbar.mjs';
4
+ export { scrollbarEmits, scrollbarProps } from './src/scrollbar2.mjs';
5
5
  export { thumbProps } from './src/thumb.mjs';
6
6
  export { scrollbarContextKey } from './src/constants.mjs';
7
7
  import { withInstall } from '../../utils/vue/install.mjs';