@wfrog/vc-ui 1.11.10 → 1.11.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/dist/es/chunk/Bw0Rhd-r.mjs +110 -0
  2. package/dist/es/chunk/CqTdDZkE.mjs +31 -0
  3. package/dist/es/chunk/{DAnWZLYj.mjs → CzWfBa_8.mjs} +96 -2
  4. package/dist/es/chunk/D229kQ56.mjs +28 -0
  5. package/dist/es/chunk/{Cxx_YWUC.mjs → DcouM6gM.mjs} +6 -548
  6. package/dist/es/chunk/Fo0dZYnz.mjs +128 -0
  7. package/dist/es/chunk/KanuIcmc.mjs +412 -0
  8. package/dist/es/chunk/{B71xEPfK.mjs → uuUHUjSk.mjs} +4 -35
  9. package/dist/es/components/backbottom/backbottom.mjs +3 -2
  10. package/dist/es/components/button/button.mjs +14 -13
  11. package/dist/es/components/choice/choice.mjs +11 -9
  12. package/dist/es/components/choice/index.css +1 -1
  13. package/dist/es/components/choice-boolean/choice-boolean.mjs +3 -3
  14. package/dist/es/components/color-switch/color-switch.mjs +73 -1046
  15. package/dist/es/components/color-switch/index.css +1 -1
  16. package/dist/es/components/cropper/cropper.mjs +11 -117
  17. package/dist/es/components/cropper/index.css +1 -1
  18. package/dist/es/components/currency/currency.mjs +10 -12
  19. package/dist/es/components/daterange-picker/daterange-picker.mjs +10 -6255
  20. package/dist/es/components/dialog/dialog.mjs +14 -408
  21. package/dist/es/components/dialog/index.css +1 -1
  22. package/dist/es/components/dialog-camera-upload/dialog-camera-upload.mjs +11 -14
  23. package/dist/es/components/dialog-map-point/dialog-map-point.mjs +4 -4
  24. package/dist/es/components/dialog-upload-images/dialog-upload-images.mjs +14 -1380
  25. package/dist/es/components/dialog-upload-images/index.css +1 -1
  26. package/dist/es/components/drag-verify/drag-verify.mjs +3 -2
  27. package/dist/es/components/drawer/drawer.mjs +16 -359
  28. package/dist/es/components/drawer/index.css +3 -3
  29. package/dist/es/components/easy-pagination/easy-pagination.mjs +3 -2
  30. package/dist/es/components/explorer/explorer.mjs +8 -8
  31. package/dist/es/components/explorer-column-table/explorer-column-table.mjs +5 -7
  32. package/dist/es/components/explorer-column-table/index.css +1 -1
  33. package/dist/es/components/explorer-container/explorer-container.d.ts +1 -1
  34. package/dist/es/components/explorer-container/explorer-container.mjs +4 -3
  35. package/dist/es/components/explorer-filter/explorer-filter.mjs +5 -4
  36. package/dist/es/components/explorer-footer/explorer-footer.mjs +4 -8
  37. package/dist/es/components/explorer-form/explorer-form.mjs +4 -3
  38. package/dist/es/components/explorer-list/explorer-list.mjs +18 -13
  39. package/dist/es/components/explorer-list/explorer-list.vue.d.ts +1 -1
  40. package/dist/es/components/explorer-list/index.css +16 -16
  41. package/dist/es/components/explorer-modal-form/explorer-modal-form.mjs +8 -7
  42. package/dist/es/components/explorer-panel/explorer-panel.mjs +3 -3
  43. package/dist/es/components/explorer-query/explorer-query.mjs +9 -2201
  44. package/dist/es/components/explorer-query/index.css +1 -1
  45. package/dist/es/components/explorer-table/explorer-table.mjs +5 -8
  46. package/dist/es/components/explorer-tools/explorer-tools.mjs +23 -271
  47. package/dist/es/components/explorer-tools/index.css +9 -9
  48. package/dist/es/components/explorer-tree/explorer-tree.mjs +4 -5
  49. package/dist/es/components/explorer-tree/explorer-tree.vue.d.ts +1 -1
  50. package/dist/es/components/form-item/form-item.mjs +3 -3
  51. package/dist/es/components/icon-picker/icon-picker.mjs +8 -12
  52. package/dist/es/components/image/image.mjs +4 -4
  53. package/dist/es/components/info-tooltip/info-tooltip.mjs +336 -4
  54. package/dist/es/components/input/input.mjs +3 -2
  55. package/dist/es/components/input-number/input-number.mjs +3 -3
  56. package/dist/es/components/pca-picker/index.css +1 -1
  57. package/dist/es/components/pca-picker/pca-picker.mjs +443 -601
  58. package/dist/es/components/screenfull/screenfull.mjs +4 -3
  59. package/dist/es/components/scrollbar/index.css +1 -1
  60. package/dist/es/components/scrollbar/scrollbar.mjs +10 -10
  61. package/dist/es/components/select/index.css +1 -1
  62. package/dist/es/components/select/select.mjs +9 -10
  63. package/dist/es/components/single-player/index.css +1 -1
  64. package/dist/es/components/single-player/single-player.mjs +10 -1087
  65. package/dist/es/components/splitter/splitter.mjs +3 -3
  66. package/dist/es/components/splitter-panel/splitter-panel.mjs +3 -3
  67. package/dist/es/components/switch/index.css +1 -1
  68. package/dist/es/components/switch/switch.mjs +9 -395
  69. package/dist/es/components/tags/tags.mjs +7 -9
  70. package/dist/es/components/text-ellipsis/text-ellipsis.mjs +3 -3
  71. package/dist/es/components/thousand-input/thousand-input.mjs +39 -8
  72. package/dist/es/components/tinymce/tinymce.mjs +4 -3
  73. package/dist/es/components/transfer/transfer.mjs +3 -4
  74. package/dist/es/components/transfer-panel/transfer-panel.mjs +5 -4
  75. package/dist/es/components/tree-picker/popover-cascader.css +1 -1
  76. package/dist/es/components/tree-picker/tree-picker.mjs +5 -10
  77. package/dist/es/index.mjs +1 -1
  78. package/dist/index.css +41 -68
  79. package/package.json +1 -1
  80. package/dist/es/chunk/B-rxnVJv.mjs +0 -3
  81. package/dist/es/chunk/B5HpgPRt.mjs +0 -69
  82. package/dist/es/chunk/BBhZKpIc.mjs +0 -2179
  83. package/dist/es/chunk/BDcsaNYa.mjs +0 -59
  84. package/dist/es/chunk/BTSSEFfD.mjs +0 -319
  85. package/dist/es/chunk/BTpNRPQW.mjs +0 -55
  86. package/dist/es/chunk/BVBK1U57.mjs +0 -96
  87. package/dist/es/chunk/Bc6yUGLs.mjs +0 -45
  88. package/dist/es/chunk/BjVI1XMz.mjs +0 -40
  89. package/dist/es/chunk/BlzQCBDu.mjs +0 -5741
  90. package/dist/es/chunk/BpJKnxlF.mjs +0 -476
  91. package/dist/es/chunk/Brp-qSBw.mjs +0 -2003
  92. package/dist/es/chunk/BunQI8Jb.mjs +0 -390
  93. package/dist/es/chunk/C0XgBrDz.mjs +0 -775
  94. package/dist/es/chunk/C0pTANRX.mjs +0 -109
  95. package/dist/es/chunk/CBMjhoFP.mjs +0 -101
  96. package/dist/es/chunk/CBiNtNvQ.mjs +0 -242
  97. package/dist/es/chunk/CBlJeNBO.mjs +0 -890
  98. package/dist/es/chunk/CCVL_Zj-.mjs +0 -427
  99. package/dist/es/chunk/CEl4MyfJ.mjs +0 -252
  100. package/dist/es/chunk/CJK5_jsA.mjs +0 -53
  101. package/dist/es/chunk/CKOcwq5V.mjs +0 -44
  102. package/dist/es/chunk/COs9dJZa.mjs +0 -66
  103. package/dist/es/chunk/CPt6MxJW.mjs +0 -375
  104. package/dist/es/chunk/CVqW0jzp.mjs +0 -107
  105. package/dist/es/chunk/CccIsEqA.mjs +0 -128
  106. package/dist/es/chunk/CjLR27-a.mjs +0 -582
  107. package/dist/es/chunk/CoGexPPD.mjs +0 -2192
  108. package/dist/es/chunk/CsLIbnzG.mjs +0 -64
  109. package/dist/es/chunk/Ct6q2FXg.mjs +0 -5
  110. package/dist/es/chunk/Cuq5meQh.mjs +0 -184
  111. package/dist/es/chunk/CvYIOfT1.mjs +0 -23
  112. package/dist/es/chunk/CxHJBf4l.mjs +0 -31
  113. package/dist/es/chunk/CzdaOBtA.mjs +0 -66
  114. package/dist/es/chunk/D0QTifnI.mjs +0 -54
  115. package/dist/es/chunk/D1QnA2iT.mjs +0 -229
  116. package/dist/es/chunk/D3AvJlVX.mjs +0 -188
  117. package/dist/es/chunk/D9Lr0Bzb.mjs +0 -1136
  118. package/dist/es/chunk/DCkPv0hy.mjs +0 -29
  119. package/dist/es/chunk/DRwwUUhy.mjs +0 -49
  120. package/dist/es/chunk/DX-2VRY2.mjs +0 -836
  121. package/dist/es/chunk/DZ2oTFad.mjs +0 -687
  122. package/dist/es/chunk/D_bou1py.mjs +0 -55
  123. package/dist/es/chunk/Da199A5L.mjs +0 -314
  124. package/dist/es/chunk/DbhQlaOz.mjs +0 -94
  125. package/dist/es/chunk/Dgu95mOy.mjs +0 -237
  126. package/dist/es/chunk/DhGOsWxx.mjs +0 -6
  127. package/dist/es/chunk/Dm_Sj5aH.mjs +0 -487
  128. package/dist/es/chunk/Dmi-1GRO.mjs +0 -163
  129. package/dist/es/chunk/DodoD9a9.mjs +0 -52
  130. package/dist/es/chunk/DrrVDcwm.mjs +0 -955
  131. package/dist/es/chunk/Du_zJ1Fz.mjs +0 -49
  132. package/dist/es/chunk/DxxbB5jY.mjs +0 -34
  133. package/dist/es/chunk/Gk1J52Yw.mjs +0 -207
  134. package/dist/es/chunk/NsldgdCh.mjs +0 -704
  135. package/dist/es/chunk/V6KjsUQN.mjs +0 -35
  136. package/dist/es/chunk/eEsLFV3s.mjs +0 -76
  137. package/dist/es/chunk/fqiLhk0V.mjs +0 -2065
  138. package/dist/es/chunk/nxVM7re4.mjs +0 -35
  139. package/dist/es/chunk/s7HLrANj.mjs +0 -215
  140. package/dist/es/chunk/vPhxogl3.mjs +0 -19
  141. package/dist/es/components/icon/icon2.mjs +0 -27
@@ -1,2192 +0,0 @@
1
- import { defineComponent, renderSlot, createBlock, openBlock, Teleport as Teleport$1, ref, computed, provide, inject, onBeforeUnmount, createElementBlock, normalizeStyle, normalizeClass, unref, withDirectives, cloneVNode, Comment, Fragment, Text, createVNode, onMounted, watch, createCommentVNode, mergeProps, withCtx, nextTick, shallowRef, getCurrentInstance, toRef, onBeforeMount, Transition, vShow, readonly, onDeactivated, toDisplayString } from 'vue';
2
- import { b as buildProps, d as definePropType, u as useNamespace, N as NOOP, a as debugWarn, j as isObject, i as isString, l as fromPairs, m as buildProp, f as isFunction, c as isArray, n as useGetDerivedNamespace } from './Gk1J52Yw.mjs';
3
- import { _ as _export_sfc, w as withInstall } from './V6KjsUQN.mjs';
4
- import { unrefElement, isClient, tryOnScopeDispose, computedEager, onClickOutside } from '@vueuse/core';
5
- import { f as isElement, i as isNil, b as isNumber, d as isBoolean } from './Bc6yUGLs.mjs';
6
- import { u as useAriaProps } from './BunQI8Jb.mjs';
7
- import { g as getEventCode, E as EVENT_CODE, c as composeEventHandlers } from './BTpNRPQW.mjs';
8
- import { a as isFocusable, f as focusElement } from './CsLIbnzG.mjs';
9
- import { a as formItemContextKey, b as useIdInjection, u as useId } from './nxVM7re4.mjs';
10
- import { u as useZIndex } from './BjVI1XMz.mjs';
11
-
12
- /**
13
- * Checks if `value` is `undefined`.
14
- *
15
- * @static
16
- * @since 0.1.0
17
- * @memberOf _
18
- * @category Lang
19
- * @param {*} value The value to check.
20
- * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
21
- * @example
22
- *
23
- * _.isUndefined(void 0);
24
- * // => true
25
- *
26
- * _.isUndefined(null);
27
- * // => false
28
- */
29
- function isUndefined(value) {
30
- return value === undefined;
31
- }
32
-
33
- const teleportProps = buildProps({
34
- to: {
35
- type: definePropType([String, Object]),
36
- required: true
37
- },
38
- disabled: Boolean
39
- });
40
-
41
- const _sfc_main$8 = defineComponent({
42
- __name: "teleport",
43
- props: teleportProps,
44
- setup(__props) {
45
- return (_ctx, _cache) => {
46
- return _ctx.disabled ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(), createBlock(Teleport$1, {
47
- key: 1,
48
- to: _ctx.to
49
- }, [
50
- renderSlot(_ctx.$slots, "default")
51
- ], 8, ["to"]));
52
- };
53
- }
54
- });
55
- var Teleport = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/teleport/src/teleport.vue"]]);
56
-
57
- const ElTeleport = withInstall(Teleport);
58
-
59
- const POPPER_INJECTION_KEY = Symbol("popper");
60
- const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
61
-
62
- const roleTypes = [
63
- "dialog",
64
- "grid",
65
- "group",
66
- "listbox",
67
- "menu",
68
- "navigation",
69
- "tooltip",
70
- "tree"
71
- ];
72
- const popperProps = buildProps({
73
- role: {
74
- type: String,
75
- values: roleTypes,
76
- default: "tooltip"
77
- }
78
- });
79
-
80
- const _sfc_main$7 = defineComponent({
81
- ...{
82
- name: "ElPopper",
83
- inheritAttrs: false
84
- },
85
- __name: "popper",
86
- props: popperProps,
87
- setup(__props, { expose: __expose }) {
88
- const props = __props;
89
- const triggerRef = ref();
90
- const popperInstanceRef = ref();
91
- const contentRef = ref();
92
- const referenceRef = ref();
93
- const role = computed(() => props.role);
94
- const popperProvides = {
95
- triggerRef,
96
- popperInstanceRef,
97
- contentRef,
98
- referenceRef,
99
- role
100
- };
101
- __expose(popperProvides);
102
- provide(POPPER_INJECTION_KEY, popperProvides);
103
- return (_ctx, _cache) => {
104
- return renderSlot(_ctx.$slots, "default");
105
- };
106
- }
107
- });
108
- var Popper = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/popper.vue"]]);
109
-
110
- const _sfc_main$6 = defineComponent({
111
- ...{
112
- name: "ElPopperArrow",
113
- inheritAttrs: false
114
- },
115
- __name: "arrow",
116
- setup(__props, { expose: __expose }) {
117
- const ns = useNamespace("popper");
118
- const { arrowRef, arrowStyle } = inject(
119
- POPPER_CONTENT_INJECTION_KEY,
120
- void 0
121
- );
122
- onBeforeUnmount(() => {
123
- arrowRef.value = void 0;
124
- });
125
- __expose({
126
- arrowRef
127
- });
128
- return (_ctx, _cache) => {
129
- return openBlock(), createElementBlock(
130
- "span",
131
- {
132
- ref_key: "arrowRef",
133
- ref: arrowRef,
134
- class: normalizeClass(unref(ns).e("arrow")),
135
- style: normalizeStyle(unref(arrowStyle)),
136
- "data-popper-arrow": ""
137
- },
138
- null,
139
- 6
140
- );
141
- };
142
- }
143
- });
144
- var ElPopperArrow = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/arrow.vue"]]);
145
-
146
- const popperTriggerProps = buildProps({
147
- virtualRef: {
148
- type: definePropType(Object)
149
- },
150
- virtualTriggering: Boolean,
151
- onMouseenter: {
152
- type: definePropType(Function)
153
- },
154
- onMouseleave: {
155
- type: definePropType(Function)
156
- },
157
- onClick: {
158
- type: definePropType(Function)
159
- },
160
- onKeydown: {
161
- type: definePropType(Function)
162
- },
163
- onFocus: {
164
- type: definePropType(Function)
165
- },
166
- onBlur: {
167
- type: definePropType(Function)
168
- },
169
- onContextmenu: {
170
- type: definePropType(Function)
171
- },
172
- id: String,
173
- open: Boolean
174
- });
175
-
176
- const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
177
- const useForwardRef = (forwardRef) => {
178
- const setForwardRef = (el) => {
179
- forwardRef.value = el;
180
- };
181
- provide(FORWARD_REF_INJECTION_KEY, {
182
- setForwardRef
183
- });
184
- };
185
- const useForwardRefDirective = (setForwardRef) => {
186
- return {
187
- mounted(el) {
188
- setForwardRef(el);
189
- },
190
- updated(el) {
191
- setForwardRef(el);
192
- },
193
- unmounted() {
194
- setForwardRef(null);
195
- }
196
- };
197
- };
198
-
199
- const NAME = "ElOnlyChild";
200
- const OnlyChild = defineComponent({
201
- name: NAME,
202
- setup(_, {
203
- slots,
204
- attrs
205
- }) {
206
- var _a;
207
- const forwardRefInjection = inject(FORWARD_REF_INJECTION_KEY);
208
- const forwardRefDirective = useForwardRefDirective((_a = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a : NOOP);
209
- return () => {
210
- var _a2;
211
- const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots, attrs);
212
- if (!defaultSlot)
213
- return null;
214
- const [firstLegitNode, length] = findFirstLegitChild(defaultSlot);
215
- if (!firstLegitNode) {
216
- debugWarn(NAME, "no valid child node found");
217
- return null;
218
- }
219
- if (length > 1) {
220
- debugWarn(NAME, "requires exact only one valid child.");
221
- }
222
- return withDirectives(cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
223
- };
224
- }
225
- });
226
- function findFirstLegitChild(node) {
227
- if (!node)
228
- return [null, 0];
229
- const children = node;
230
- const len = children.filter((c) => c.type !== Comment).length;
231
- for (const child of children) {
232
- if (isObject(child)) {
233
- switch (child.type) {
234
- case Comment:
235
- continue;
236
- case Text:
237
- case "svg":
238
- return [wrapTextContent(child), len];
239
- case Fragment:
240
- return findFirstLegitChild(child.children);
241
- default:
242
- return [child, len];
243
- }
244
- }
245
- return [wrapTextContent(child), len];
246
- }
247
- return [null, 0];
248
- }
249
- function wrapTextContent(s) {
250
- const ns = useNamespace("only-child");
251
- return createVNode("span", {
252
- "class": ns.e("content")
253
- }, [s]);
254
- }
255
-
256
- const _sfc_main$5 = defineComponent({
257
- ...{
258
- name: "ElPopperTrigger",
259
- inheritAttrs: false
260
- },
261
- __name: "trigger",
262
- props: popperTriggerProps,
263
- setup(__props, { expose: __expose }) {
264
- const props = __props;
265
- const { role, triggerRef } = inject(POPPER_INJECTION_KEY, void 0);
266
- useForwardRef(triggerRef);
267
- const ariaControls = computed(() => {
268
- return ariaHaspopup.value ? props.id : void 0;
269
- });
270
- const ariaDescribedby = computed(() => {
271
- if (role && role.value === "tooltip") {
272
- return props.open && props.id ? props.id : void 0;
273
- }
274
- return void 0;
275
- });
276
- const ariaHaspopup = computed(() => {
277
- if (role && role.value !== "tooltip") {
278
- return role.value;
279
- }
280
- return void 0;
281
- });
282
- const ariaExpanded = computed(() => {
283
- return ariaHaspopup.value ? `${props.open}` : void 0;
284
- });
285
- let virtualTriggerAriaStopWatch = void 0;
286
- const TRIGGER_ELE_EVENTS = [
287
- "onMouseenter",
288
- "onMouseleave",
289
- "onClick",
290
- "onKeydown",
291
- "onFocus",
292
- "onBlur",
293
- "onContextmenu"
294
- ];
295
- onMounted(() => {
296
- watch(
297
- () => props.virtualRef,
298
- (virtualEl) => {
299
- if (virtualEl) {
300
- triggerRef.value = unrefElement(virtualEl);
301
- }
302
- },
303
- {
304
- immediate: true
305
- }
306
- );
307
- watch(
308
- triggerRef,
309
- (el, prevEl) => {
310
- virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
311
- virtualTriggerAriaStopWatch = void 0;
312
- if (isElement(prevEl)) {
313
- TRIGGER_ELE_EVENTS.forEach((eventName) => {
314
- const handler = props[eventName];
315
- if (handler) {
316
- prevEl.removeEventListener(
317
- eventName.slice(2).toLowerCase(),
318
- handler,
319
- ["onFocus", "onBlur"].includes(eventName)
320
- );
321
- }
322
- });
323
- }
324
- if (isElement(el)) {
325
- TRIGGER_ELE_EVENTS.forEach((eventName) => {
326
- const handler = props[eventName];
327
- if (handler) {
328
- el.addEventListener(
329
- eventName.slice(2).toLowerCase(),
330
- handler,
331
- ["onFocus", "onBlur"].includes(eventName)
332
- );
333
- }
334
- });
335
- if (isFocusable(el)) {
336
- virtualTriggerAriaStopWatch = watch(
337
- [ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded],
338
- (watches) => {
339
- [
340
- "aria-controls",
341
- "aria-describedby",
342
- "aria-haspopup",
343
- "aria-expanded"
344
- ].forEach((key, idx) => {
345
- isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
346
- });
347
- },
348
- { immediate: true }
349
- );
350
- }
351
- }
352
- if (isElement(prevEl) && isFocusable(prevEl)) {
353
- [
354
- "aria-controls",
355
- "aria-describedby",
356
- "aria-haspopup",
357
- "aria-expanded"
358
- ].forEach((key) => prevEl.removeAttribute(key));
359
- }
360
- },
361
- {
362
- immediate: true
363
- }
364
- );
365
- });
366
- onBeforeUnmount(() => {
367
- virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
368
- virtualTriggerAriaStopWatch = void 0;
369
- if (triggerRef.value && isElement(triggerRef.value)) {
370
- const el = triggerRef.value;
371
- TRIGGER_ELE_EVENTS.forEach((eventName) => {
372
- const handler = props[eventName];
373
- if (handler) {
374
- el.removeEventListener(
375
- eventName.slice(2).toLowerCase(),
376
- handler,
377
- ["onFocus", "onBlur"].includes(eventName)
378
- );
379
- }
380
- });
381
- triggerRef.value = void 0;
382
- }
383
- });
384
- __expose({
385
- triggerRef
386
- });
387
- return (_ctx, _cache) => {
388
- return !_ctx.virtualTriggering ? (openBlock(), createBlock(unref(OnlyChild), mergeProps({ key: 0 }, _ctx.$attrs, {
389
- "aria-controls": ariaControls.value,
390
- "aria-describedby": ariaDescribedby.value,
391
- "aria-expanded": ariaExpanded.value,
392
- "aria-haspopup": ariaHaspopup.value
393
- }), {
394
- default: withCtx(() => [
395
- renderSlot(_ctx.$slots, "default")
396
- ]),
397
- _: 3
398
- }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : createCommentVNode("v-if", true);
399
- };
400
- }
401
- });
402
- var ElPopperTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/trigger.vue"]]);
403
-
404
- const FOCUS_AFTER_TRAPPED = "focus-trap.focus-after-trapped";
405
- const FOCUS_AFTER_RELEASED = "focus-trap.focus-after-released";
406
- const FOCUSOUT_PREVENTED = "focus-trap.focusout-prevented";
407
- const FOCUS_AFTER_TRAPPED_OPTS = {
408
- cancelable: true,
409
- bubbles: false
410
- };
411
- const FOCUSOUT_PREVENTED_OPTS = {
412
- cancelable: true,
413
- bubbles: false
414
- };
415
- const ON_TRAP_FOCUS_EVT = "focusAfterTrapped";
416
- const ON_RELEASE_FOCUS_EVT = "focusAfterReleased";
417
- const FOCUS_TRAP_INJECTION_KEY = Symbol("elFocusTrap");
418
-
419
- const focusReason = ref();
420
- const lastUserFocusTimestamp = ref(0);
421
- const lastAutomatedFocusTimestamp = ref(0);
422
- let focusReasonUserCount = 0;
423
- const obtainAllFocusableElements = (element) => {
424
- const nodes = [];
425
- const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, {
426
- acceptNode: (node) => {
427
- const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
428
- if (node.disabled || node.hidden || isHiddenInput)
429
- return NodeFilter.FILTER_SKIP;
430
- return node.tabIndex >= 0 || node === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
431
- }
432
- });
433
- while (walker.nextNode())
434
- nodes.push(walker.currentNode);
435
- return nodes;
436
- };
437
- const getVisibleElement = (elements, container) => {
438
- for (const element of elements) {
439
- if (!isHidden(element, container))
440
- return element;
441
- }
442
- };
443
- const isHidden = (element, container) => {
444
- if (process.env.NODE_ENV === "test")
445
- return false;
446
- if (getComputedStyle(element).visibility === "hidden")
447
- return true;
448
- while (element) {
449
- if (container && element === container)
450
- return false;
451
- if (getComputedStyle(element).display === "none")
452
- return true;
453
- element = element.parentElement;
454
- }
455
- return false;
456
- };
457
- const getEdges = (container) => {
458
- const focusable = obtainAllFocusableElements(container);
459
- const first = getVisibleElement(focusable, container);
460
- const last = getVisibleElement(focusable.reverse(), container);
461
- return [first, last];
462
- };
463
- const isSelectable = (element) => {
464
- return element instanceof HTMLInputElement && "select" in element;
465
- };
466
- const tryFocus = (element, shouldSelect) => {
467
- if (element) {
468
- const prevFocusedElement = document.activeElement;
469
- focusElement(element, { preventScroll: true });
470
- lastAutomatedFocusTimestamp.value = window.performance.now();
471
- if (element !== prevFocusedElement && isSelectable(element) && shouldSelect) {
472
- element.select();
473
- }
474
- }
475
- };
476
- function removeFromStack(list, item) {
477
- const copy = [...list];
478
- const idx = list.indexOf(item);
479
- if (idx !== -1) {
480
- copy.splice(idx, 1);
481
- }
482
- return copy;
483
- }
484
- const createFocusableStack = () => {
485
- let stack = [];
486
- const push = (layer) => {
487
- const currentLayer = stack[0];
488
- if (currentLayer && layer !== currentLayer) {
489
- currentLayer.pause();
490
- }
491
- stack = removeFromStack(stack, layer);
492
- stack.unshift(layer);
493
- };
494
- const remove = (layer) => {
495
- var _a, _b;
496
- stack = removeFromStack(stack, layer);
497
- (_b = (_a = stack[0]) == null ? void 0 : _a.resume) == null ? void 0 : _b.call(_a);
498
- };
499
- return {
500
- push,
501
- remove
502
- };
503
- };
504
- const focusFirstDescendant = (elements, shouldSelect = false) => {
505
- const prevFocusedElement = document.activeElement;
506
- for (const element of elements) {
507
- tryFocus(element, shouldSelect);
508
- if (document.activeElement !== prevFocusedElement)
509
- return;
510
- }
511
- };
512
- const focusableStack = createFocusableStack();
513
- const isFocusCausedByUserEvent = () => {
514
- return lastUserFocusTimestamp.value > lastAutomatedFocusTimestamp.value;
515
- };
516
- const notifyFocusReasonPointer = () => {
517
- focusReason.value = "pointer";
518
- lastUserFocusTimestamp.value = window.performance.now();
519
- };
520
- const notifyFocusReasonKeydown = () => {
521
- focusReason.value = "keyboard";
522
- lastUserFocusTimestamp.value = window.performance.now();
523
- };
524
- const useFocusReason = () => {
525
- onMounted(() => {
526
- if (focusReasonUserCount === 0) {
527
- document.addEventListener("mousedown", notifyFocusReasonPointer);
528
- document.addEventListener("touchstart", notifyFocusReasonPointer);
529
- document.addEventListener("keydown", notifyFocusReasonKeydown);
530
- }
531
- focusReasonUserCount++;
532
- });
533
- onBeforeUnmount(() => {
534
- focusReasonUserCount--;
535
- if (focusReasonUserCount <= 0) {
536
- document.removeEventListener("mousedown", notifyFocusReasonPointer);
537
- document.removeEventListener("touchstart", notifyFocusReasonPointer);
538
- document.removeEventListener("keydown", notifyFocusReasonKeydown);
539
- }
540
- });
541
- return {
542
- focusReason,
543
- lastUserFocusTimestamp,
544
- lastAutomatedFocusTimestamp
545
- };
546
- };
547
- const createFocusOutPreventedEvent = (detail) => {
548
- return new CustomEvent(FOCUSOUT_PREVENTED, {
549
- ...FOCUSOUT_PREVENTED_OPTS,
550
- detail
551
- });
552
- };
553
-
554
- let registeredEscapeHandlers = [];
555
- const cachedHandler = (event) => {
556
- const code = getEventCode(event);
557
- if (code === EVENT_CODE.esc) {
558
- registeredEscapeHandlers.forEach(
559
- (registeredHandler) => registeredHandler(event)
560
- );
561
- }
562
- };
563
- const useEscapeKeydown = (handler) => {
564
- onMounted(() => {
565
- if (registeredEscapeHandlers.length === 0) {
566
- document.addEventListener("keydown", cachedHandler);
567
- }
568
- if (isClient)
569
- registeredEscapeHandlers.push(handler);
570
- });
571
- onBeforeUnmount(() => {
572
- registeredEscapeHandlers = registeredEscapeHandlers.filter(
573
- (registeredHandler) => registeredHandler !== handler
574
- );
575
- if (registeredEscapeHandlers.length === 0) {
576
- if (isClient)
577
- document.removeEventListener("keydown", cachedHandler);
578
- }
579
- });
580
- };
581
-
582
- const _sfc_main$4 = defineComponent({
583
- name: "ElFocusTrap",
584
- inheritAttrs: false,
585
- props: {
586
- loop: Boolean,
587
- trapped: Boolean,
588
- focusTrapEl: Object,
589
- focusStartEl: {
590
- type: [Object, String],
591
- default: "first"
592
- }
593
- },
594
- emits: [
595
- ON_TRAP_FOCUS_EVT,
596
- ON_RELEASE_FOCUS_EVT,
597
- "focusin",
598
- "focusout",
599
- "focusout-prevented",
600
- "release-requested"
601
- ],
602
- setup(props, { emit }) {
603
- const forwardRef = ref();
604
- let lastFocusBeforeTrapped;
605
- let lastFocusAfterTrapped;
606
- const { focusReason } = useFocusReason();
607
- useEscapeKeydown((event) => {
608
- if (props.trapped && !focusLayer.paused) {
609
- emit("release-requested", event);
610
- }
611
- });
612
- const focusLayer = {
613
- paused: false,
614
- pause() {
615
- this.paused = true;
616
- },
617
- resume() {
618
- this.paused = false;
619
- }
620
- };
621
- const onKeydown = (e) => {
622
- if (!props.loop && !props.trapped)
623
- return;
624
- if (focusLayer.paused)
625
- return;
626
- const { altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
627
- const { loop } = props;
628
- const code = getEventCode(e);
629
- const isTabbing = code === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
630
- const currentFocusingEl = document.activeElement;
631
- if (isTabbing && currentFocusingEl) {
632
- const container = currentTarget;
633
- const [first, last] = getEdges(container);
634
- const isTabbable = first && last;
635
- if (!isTabbable) {
636
- if (currentFocusingEl === container) {
637
- const focusoutPreventedEvent = createFocusOutPreventedEvent({
638
- focusReason: focusReason.value
639
- });
640
- emit("focusout-prevented", focusoutPreventedEvent);
641
- if (!focusoutPreventedEvent.defaultPrevented) {
642
- e.preventDefault();
643
- }
644
- }
645
- } else {
646
- if (!shiftKey && currentFocusingEl === last) {
647
- const focusoutPreventedEvent = createFocusOutPreventedEvent({
648
- focusReason: focusReason.value
649
- });
650
- emit("focusout-prevented", focusoutPreventedEvent);
651
- if (!focusoutPreventedEvent.defaultPrevented) {
652
- e.preventDefault();
653
- if (loop)
654
- tryFocus(first, true);
655
- }
656
- } else if (shiftKey && [first, container].includes(currentFocusingEl)) {
657
- const focusoutPreventedEvent = createFocusOutPreventedEvent({
658
- focusReason: focusReason.value
659
- });
660
- emit("focusout-prevented", focusoutPreventedEvent);
661
- if (!focusoutPreventedEvent.defaultPrevented) {
662
- e.preventDefault();
663
- if (loop)
664
- tryFocus(last, true);
665
- }
666
- }
667
- }
668
- }
669
- };
670
- provide(FOCUS_TRAP_INJECTION_KEY, {
671
- focusTrapRef: forwardRef,
672
- onKeydown
673
- });
674
- watch(
675
- () => props.focusTrapEl,
676
- (focusTrapEl) => {
677
- if (focusTrapEl) {
678
- forwardRef.value = focusTrapEl;
679
- }
680
- },
681
- { immediate: true }
682
- );
683
- watch([forwardRef], ([forwardRef2], [oldForwardRef]) => {
684
- if (forwardRef2) {
685
- forwardRef2.addEventListener("keydown", onKeydown);
686
- forwardRef2.addEventListener("focusin", onFocusIn);
687
- forwardRef2.addEventListener("focusout", onFocusOut);
688
- }
689
- if (oldForwardRef) {
690
- oldForwardRef.removeEventListener("keydown", onKeydown);
691
- oldForwardRef.removeEventListener("focusin", onFocusIn);
692
- oldForwardRef.removeEventListener("focusout", onFocusOut);
693
- }
694
- });
695
- const trapOnFocus = (e) => {
696
- emit(ON_TRAP_FOCUS_EVT, e);
697
- };
698
- const releaseOnFocus = (e) => emit(ON_RELEASE_FOCUS_EVT, e);
699
- const onFocusIn = (e) => {
700
- const trapContainer = unref(forwardRef);
701
- if (!trapContainer)
702
- return;
703
- const target = e.target;
704
- const relatedTarget = e.relatedTarget;
705
- const isFocusedInTrap = target && trapContainer.contains(target);
706
- if (!props.trapped) {
707
- const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget);
708
- if (!isPrevFocusedInTrap) {
709
- lastFocusBeforeTrapped = relatedTarget;
710
- }
711
- }
712
- if (isFocusedInTrap)
713
- emit("focusin", e);
714
- if (focusLayer.paused)
715
- return;
716
- if (props.trapped) {
717
- if (isFocusedInTrap) {
718
- lastFocusAfterTrapped = target;
719
- } else {
720
- tryFocus(lastFocusAfterTrapped, true);
721
- }
722
- }
723
- };
724
- const onFocusOut = (e) => {
725
- const trapContainer = unref(forwardRef);
726
- if (focusLayer.paused || !trapContainer)
727
- return;
728
- if (props.trapped) {
729
- const relatedTarget = e.relatedTarget;
730
- if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {
731
- setTimeout(() => {
732
- if (!focusLayer.paused && props.trapped) {
733
- const focusoutPreventedEvent = createFocusOutPreventedEvent({
734
- focusReason: focusReason.value
735
- });
736
- emit("focusout-prevented", focusoutPreventedEvent);
737
- if (!focusoutPreventedEvent.defaultPrevented) {
738
- tryFocus(lastFocusAfterTrapped, true);
739
- }
740
- }
741
- }, 0);
742
- }
743
- } else {
744
- const target = e.target;
745
- const isFocusedInTrap = target && trapContainer.contains(target);
746
- if (!isFocusedInTrap)
747
- emit("focusout", e);
748
- }
749
- };
750
- async function startTrap() {
751
- await nextTick();
752
- const trapContainer = unref(forwardRef);
753
- if (trapContainer) {
754
- focusableStack.push(focusLayer);
755
- const prevFocusedElement = trapContainer.contains(
756
- document.activeElement
757
- ) ? lastFocusBeforeTrapped : document.activeElement;
758
- lastFocusBeforeTrapped = prevFocusedElement;
759
- const isPrevFocusContained = trapContainer.contains(prevFocusedElement);
760
- if (!isPrevFocusContained) {
761
- const focusEvent = new Event(
762
- FOCUS_AFTER_TRAPPED,
763
- FOCUS_AFTER_TRAPPED_OPTS
764
- );
765
- trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
766
- trapContainer.dispatchEvent(focusEvent);
767
- if (!focusEvent.defaultPrevented) {
768
- nextTick(() => {
769
- let focusStartEl = props.focusStartEl;
770
- if (!isString(focusStartEl)) {
771
- tryFocus(focusStartEl);
772
- if (document.activeElement !== focusStartEl) {
773
- focusStartEl = "first";
774
- }
775
- }
776
- if (focusStartEl === "first") {
777
- focusFirstDescendant(
778
- obtainAllFocusableElements(trapContainer),
779
- true
780
- );
781
- }
782
- if (document.activeElement === prevFocusedElement || focusStartEl === "container") {
783
- tryFocus(trapContainer);
784
- }
785
- });
786
- }
787
- }
788
- }
789
- }
790
- function stopTrap() {
791
- const trapContainer = unref(forwardRef);
792
- if (trapContainer) {
793
- trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
794
- const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {
795
- ...FOCUS_AFTER_TRAPPED_OPTS,
796
- detail: {
797
- focusReason: focusReason.value
798
- }
799
- });
800
- trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
801
- trapContainer.dispatchEvent(releasedEvent);
802
- if (!releasedEvent.defaultPrevented && (focusReason.value == "keyboard" || !isFocusCausedByUserEvent() || trapContainer.contains(document.activeElement))) {
803
- tryFocus(lastFocusBeforeTrapped != null ? lastFocusBeforeTrapped : document.body);
804
- }
805
- trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
806
- focusableStack.remove(focusLayer);
807
- lastFocusBeforeTrapped = null;
808
- lastFocusAfterTrapped = null;
809
- }
810
- }
811
- onMounted(() => {
812
- if (props.trapped) {
813
- startTrap();
814
- }
815
- watch(
816
- () => props.trapped,
817
- (trapped) => {
818
- if (trapped) {
819
- startTrap();
820
- } else {
821
- stopTrap();
822
- }
823
- }
824
- );
825
- });
826
- onBeforeUnmount(() => {
827
- if (props.trapped) {
828
- stopTrap();
829
- }
830
- if (forwardRef.value) {
831
- forwardRef.value.removeEventListener("keydown", onKeydown);
832
- forwardRef.value.removeEventListener("focusin", onFocusIn);
833
- forwardRef.value.removeEventListener("focusout", onFocusOut);
834
- forwardRef.value = void 0;
835
- }
836
- lastFocusBeforeTrapped = null;
837
- lastFocusAfterTrapped = null;
838
- });
839
- return {
840
- onKeydown
841
- };
842
- }
843
- });
844
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
845
- return renderSlot(_ctx.$slots, "default", { handleKeydown: _ctx.onKeydown });
846
- }
847
- var ElFocusTrap = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/focus-trap/src/focus-trap.vue"]]);
848
-
849
- var E="top",R="bottom",W="right",P="left",me="auto",G=[E,R,W,P],U="start",J="end",Xe="clippingParents",je="viewport",K="popper",Ye="reference",De=G.reduce(function(t,e){return t.concat([e+"-"+U,e+"-"+J])},[]),Ee=[].concat(G,[me]).reduce(function(t,e){return t.concat([e,e+"-"+U,e+"-"+J])},[]),Ge="beforeRead",Je="read",Ke="afterRead",Qe="beforeMain",Ze="main",et="afterMain",tt="beforeWrite",nt="write",rt="afterWrite",ot=[Ge,Je,Ke,Qe,Ze,et,tt,nt,rt];function C(t){return t?(t.nodeName||"").toLowerCase():null}function H(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Q(t){var e=H(t).Element;return t instanceof e||t instanceof Element}function B(t){var e=H(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Pe(t){if(typeof ShadowRoot=="undefined")return false;var e=H(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function Mt(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},o=e.attributes[n]||{},i=e.elements[n];!B(i)||!C(i)||(Object.assign(i.style,r),Object.keys(o).forEach(function(a){var s=o[a];s===false?i.removeAttribute(a):i.setAttribute(a,s===true?"":s);}));});}function Rt(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var o=e.elements[r],i=e.attributes[r]||{},a=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),s=a.reduce(function(f,c){return f[c]="",f},{});!B(o)||!C(o)||(Object.assign(o.style,s),Object.keys(i).forEach(function(f){o.removeAttribute(f);}));});}}var Ae={name:"applyStyles",enabled:true,phase:"write",fn:Mt,effect:Rt,requires:["computeStyles"]};function q(t){return t.split("-")[0]}var X=Math.max,ve=Math.min,Z=Math.round;function ee(t,e){e===void 0&&(e=false);var n=t.getBoundingClientRect(),r=1,o=1;if(B(t)&&e){var i=t.offsetHeight,a=t.offsetWidth;a>0&&(r=Z(n.width)/a||1),i>0&&(o=Z(n.height)/i||1);}return {width:n.width/r,height:n.height/o,top:n.top/o,right:n.right/r,bottom:n.bottom/o,left:n.left/r,x:n.left/r,y:n.top/o}}function ke(t){var e=ee(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function it(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return true;if(n&&Pe(n)){var r=e;do{if(r&&t.isSameNode(r))return true;r=r.parentNode||r.host;}while(r)}return false}function N(t){return H(t).getComputedStyle(t)}function Wt(t){return ["table","td","th"].indexOf(C(t))>=0}function I(t){return ((Q(t)?t.ownerDocument:t.document)||window.document).documentElement}function ge(t){return C(t)==="html"?t:t.assignedSlot||t.parentNode||(Pe(t)?t.host:null)||I(t)}function at(t){return !B(t)||N(t).position==="fixed"?null:t.offsetParent}function Bt(t){var e=navigator.userAgent.toLowerCase().indexOf("firefox")!==-1,n=navigator.userAgent.indexOf("Trident")!==-1;if(n&&B(t)){var r=N(t);if(r.position==="fixed")return null}var o=ge(t);for(Pe(o)&&(o=o.host);B(o)&&["html","body"].indexOf(C(o))<0;){var i=N(o);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||e&&i.willChange==="filter"||e&&i.filter&&i.filter!=="none")return o;o=o.parentNode;}return null}function se(t){for(var e=H(t),n=at(t);n&&Wt(n)&&N(n).position==="static";)n=at(n);return n&&(C(n)==="html"||C(n)==="body"&&N(n).position==="static")?e:n||Bt(t)||e}function Le(t){return ["top","bottom"].indexOf(t)>=0?"x":"y"}function fe(t,e,n){return X(t,ve(e,n))}function St(t,e,n){var r=fe(t,e,n);return r>n?n:r}function st(){return {top:0,right:0,bottom:0,left:0}}function ft(t){return Object.assign({},st(),t)}function ct(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var Tt=function(t,e){return t=typeof t=="function"?t(Object.assign({},e.rects,{placement:e.placement})):t,ft(typeof t!="number"?t:ct(t,G))};function Ht(t){var e,n=t.state,r=t.name,o=t.options,i=n.elements.arrow,a=n.modifiersData.popperOffsets,s=q(n.placement),f=Le(s),c=[P,W].indexOf(s)>=0,u=c?"height":"width";if(!(!i||!a)){var m=Tt(o.padding,n),v=ke(i),l=f==="y"?E:P,h=f==="y"?R:W,p=n.rects.reference[u]+n.rects.reference[f]-a[f]-n.rects.popper[u],g=a[f]-n.rects.reference[f],x=se(i),y=x?f==="y"?x.clientHeight||0:x.clientWidth||0:0,$=p/2-g/2,d=m[l],b=y-v[u]-m[h],w=y/2-v[u]/2+$,O=fe(d,w,b),j=f;n.modifiersData[r]=(e={},e[j]=O,e.centerOffset=O-w,e);}}function Ct(t){var e=t.state,n=t.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=e.elements.popper.querySelector(o),!o)||!it(e.elements.popper,o)||(e.elements.arrow=o));}var pt={name:"arrow",enabled:true,phase:"main",fn:Ht,effect:Ct,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function te(t){return t.split("-")[1]}var qt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Vt(t){var e=t.x,n=t.y,r=window,o=r.devicePixelRatio||1;return {x:Z(e*o)/o||0,y:Z(n*o)/o||0}}function ut(t){var e,n=t.popper,r=t.popperRect,o=t.placement,i=t.variation,a=t.offsets,s=t.position,f=t.gpuAcceleration,c=t.adaptive,u=t.roundOffsets,m=t.isFixed,v=a.x,l=v===void 0?0:v,h=a.y,p=h===void 0?0:h,g=typeof u=="function"?u({x:l,y:p}):{x:l,y:p};l=g.x,p=g.y;var x=a.hasOwnProperty("x"),y=a.hasOwnProperty("y"),$=P,d=E,b=window;if(c){var w=se(n),O="clientHeight",j="clientWidth";if(w===H(n)&&(w=I(n),N(w).position!=="static"&&s==="absolute"&&(O="scrollHeight",j="scrollWidth")),w=w,o===E||(o===P||o===W)&&i===J){d=R;var A=m&&w===b&&b.visualViewport?b.visualViewport.height:w[O];p-=A-r.height,p*=f?1:-1;}if(o===P||(o===E||o===R)&&i===J){$=W;var k=m&&w===b&&b.visualViewport?b.visualViewport.width:w[j];l-=k-r.width,l*=f?1:-1;}}var D=Object.assign({position:s},c&&qt),S=u===true?Vt({x:l,y:p}):{x:l,y:p};if(l=S.x,p=S.y,f){var L;return Object.assign({},D,(L={},L[d]=y?"0":"",L[$]=x?"0":"",L.transform=(b.devicePixelRatio||1)<=1?"translate("+l+"px, "+p+"px)":"translate3d("+l+"px, "+p+"px, 0)",L))}return Object.assign({},D,(e={},e[d]=y?p+"px":"",e[$]=x?l+"px":"",e.transform="",e))}function Nt(t){var e=t.state,n=t.options,r=n.gpuAcceleration,o=r===void 0?true:r,i=n.adaptive,a=i===void 0?true:i,s=n.roundOffsets,f=s===void 0?true:s,c={placement:q(e.placement),variation:te(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:o,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,ut(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:a,roundOffsets:f})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,ut(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:false,roundOffsets:f})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement});}var Me={name:"computeStyles",enabled:true,phase:"beforeWrite",fn:Nt,data:{}},ye={passive:true};function It(t){var e=t.state,n=t.instance,r=t.options,o=r.scroll,i=o===void 0?true:o,a=r.resize,s=a===void 0?true:a,f=H(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&c.forEach(function(u){u.addEventListener("scroll",n.update,ye);}),s&&f.addEventListener("resize",n.update,ye),function(){i&&c.forEach(function(u){u.removeEventListener("scroll",n.update,ye);}),s&&f.removeEventListener("resize",n.update,ye);}}var Re={name:"eventListeners",enabled:true,phase:"write",fn:function(){},effect:It,data:{}},_t={left:"right",right:"left",bottom:"top",top:"bottom"};function be(t){return t.replace(/left|right|bottom|top/g,function(e){return _t[e]})}var zt={start:"end",end:"start"};function lt(t){return t.replace(/start|end/g,function(e){return zt[e]})}function We(t){var e=H(t),n=e.pageXOffset,r=e.pageYOffset;return {scrollLeft:n,scrollTop:r}}function Be(t){return ee(I(t)).left+We(t).scrollLeft}function Ft(t){var e=H(t),n=I(t),r=e.visualViewport,o=n.clientWidth,i=n.clientHeight,a=0,s=0;return r&&(o=r.width,i=r.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=r.offsetLeft,s=r.offsetTop)),{width:o,height:i,x:a+Be(t),y:s}}function Ut(t){var e,n=I(t),r=We(t),o=(e=t.ownerDocument)==null?void 0:e.body,i=X(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=X(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-r.scrollLeft+Be(t),f=-r.scrollTop;return N(o||n).direction==="rtl"&&(s+=X(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:a,x:s,y:f}}function Se(t){var e=N(t),n=e.overflow,r=e.overflowX,o=e.overflowY;return /auto|scroll|overlay|hidden/.test(n+o+r)}function dt(t){return ["html","body","#document"].indexOf(C(t))>=0?t.ownerDocument.body:B(t)&&Se(t)?t:dt(ge(t))}function ce(t,e){var n;e===void 0&&(e=[]);var r=dt(t),o=r===((n=t.ownerDocument)==null?void 0:n.body),i=H(r),a=o?[i].concat(i.visualViewport||[],Se(r)?r:[]):r,s=e.concat(a);return o?s:s.concat(ce(ge(a)))}function Te(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function Xt(t){var e=ee(t);return e.top=e.top+t.clientTop,e.left=e.left+t.clientLeft,e.bottom=e.top+t.clientHeight,e.right=e.left+t.clientWidth,e.width=t.clientWidth,e.height=t.clientHeight,e.x=e.left,e.y=e.top,e}function ht(t,e){return e===je?Te(Ft(t)):Q(e)?Xt(e):Te(Ut(I(t)))}function Yt(t){var e=ce(ge(t)),n=["absolute","fixed"].indexOf(N(t).position)>=0,r=n&&B(t)?se(t):t;return Q(r)?e.filter(function(o){return Q(o)&&it(o,r)&&C(o)!=="body"}):[]}function Gt(t,e,n){var r=e==="clippingParents"?Yt(t):[].concat(e),o=[].concat(r,[n]),i=o[0],a=o.reduce(function(s,f){var c=ht(t,f);return s.top=X(c.top,s.top),s.right=ve(c.right,s.right),s.bottom=ve(c.bottom,s.bottom),s.left=X(c.left,s.left),s},ht(t,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function mt(t){var e=t.reference,n=t.element,r=t.placement,o=r?q(r):null,i=r?te(r):null,a=e.x+e.width/2-n.width/2,s=e.y+e.height/2-n.height/2,f;switch(o){case E:f={x:a,y:e.y-n.height};break;case R:f={x:a,y:e.y+e.height};break;case W:f={x:e.x+e.width,y:s};break;case P:f={x:e.x-n.width,y:s};break;default:f={x:e.x,y:e.y};}var c=o?Le(o):null;if(c!=null){var u=c==="y"?"height":"width";switch(i){case U:f[c]=f[c]-(e[u]/2-n[u]/2);break;case J:f[c]=f[c]+(e[u]/2-n[u]/2);break}}return f}function ne(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=r===void 0?t.placement:r,i=n.boundary,a=i===void 0?Xe:i,s=n.rootBoundary,f=s===void 0?je:s,c=n.elementContext,u=c===void 0?K:c,m=n.altBoundary,v=m===void 0?false:m,l=n.padding,h=l===void 0?0:l,p=ft(typeof h!="number"?h:ct(h,G)),g=u===K?Ye:K,x=t.rects.popper,y=t.elements[v?g:u],$=Gt(Q(y)?y:y.contextElement||I(t.elements.popper),a,f),d=ee(t.elements.reference),b=mt({reference:d,element:x,placement:o}),w=Te(Object.assign({},x,b)),O=u===K?w:d,j={top:$.top-O.top+p.top,bottom:O.bottom-$.bottom+p.bottom,left:$.left-O.left+p.left,right:O.right-$.right+p.right},A=t.modifiersData.offset;if(u===K&&A){var k=A[o];Object.keys(j).forEach(function(D){var S=[W,R].indexOf(D)>=0?1:-1,L=[E,R].indexOf(D)>=0?"y":"x";j[D]+=k[L]*S;});}return j}function Jt(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=n.boundary,i=n.rootBoundary,a=n.padding,s=n.flipVariations,f=n.allowedAutoPlacements,c=f===void 0?Ee:f,u=te(r),m=u?s?De:De.filter(function(h){return te(h)===u}):G,v=m.filter(function(h){return c.indexOf(h)>=0});v.length===0&&(v=m);var l=v.reduce(function(h,p){return h[p]=ne(t,{placement:p,boundary:o,rootBoundary:i,padding:a})[q(p)],h},{});return Object.keys(l).sort(function(h,p){return l[h]-l[p]})}function Kt(t){if(q(t)===me)return [];var e=be(t);return [lt(t),e,lt(e)]}function Qt(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var o=n.mainAxis,i=o===void 0?true:o,a=n.altAxis,s=a===void 0?true:a,f=n.fallbackPlacements,c=n.padding,u=n.boundary,m=n.rootBoundary,v=n.altBoundary,l=n.flipVariations,h=l===void 0?true:l,p=n.allowedAutoPlacements,g=e.options.placement,x=q(g),y=x===g,$=f||(y||!h?[be(g)]:Kt(g)),d=[g].concat($).reduce(function(z,V){return z.concat(q(V)===me?Jt(e,{placement:V,boundary:u,rootBoundary:m,padding:c,flipVariations:h,allowedAutoPlacements:p}):V)},[]),b=e.rects.reference,w=e.rects.popper,O=new Map,j=true,A=d[0],k=0;k<d.length;k++){var D=d[k],S=q(D),L=te(D)===U,re=[E,R].indexOf(S)>=0,oe=re?"width":"height",M=ne(e,{placement:D,boundary:u,rootBoundary:m,altBoundary:v,padding:c}),T=re?L?W:P:L?R:E;b[oe]>w[oe]&&(T=be(T));var pe=be(T),_=[];if(i&&_.push(M[S]<=0),s&&_.push(M[T]<=0,M[pe]<=0),_.every(function(z){return z})){A=D,j=false;break}O.set(D,_);}if(j)for(var ue=h?3:1,xe=function(z){var V=d.find(function(de){var ae=O.get(de);if(ae)return ae.slice(0,z).every(function(Y){return Y})});if(V)return A=V,"break"},ie=ue;ie>0;ie--){var le=xe(ie);if(le==="break")break}e.placement!==A&&(e.modifiersData[r]._skip=true,e.placement=A,e.reset=true);}}var vt={name:"flip",enabled:true,phase:"main",fn:Qt,requiresIfExists:["offset"],data:{_skip:false}};function gt(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function yt(t){return [E,W,R,P].some(function(e){return t[e]>=0})}function Zt(t){var e=t.state,n=t.name,r=e.rects.reference,o=e.rects.popper,i=e.modifiersData.preventOverflow,a=ne(e,{elementContext:"reference"}),s=ne(e,{altBoundary:true}),f=gt(a,r),c=gt(s,o,i),u=yt(f),m=yt(c);e.modifiersData[n]={referenceClippingOffsets:f,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:m},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":m});}var bt={name:"hide",enabled:true,phase:"main",requiresIfExists:["preventOverflow"],fn:Zt};function en(t,e,n){var r=q(t),o=[P,E].indexOf(r)>=0?-1:1,i=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,a=i[0],s=i[1];return a=a||0,s=(s||0)*o,[P,W].indexOf(r)>=0?{x:s,y:a}:{x:a,y:s}}function tn(t){var e=t.state,n=t.options,r=t.name,o=n.offset,i=o===void 0?[0,0]:o,a=Ee.reduce(function(u,m){return u[m]=en(m,e.rects,i),u},{}),s=a[e.placement],f=s.x,c=s.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=f,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=a;}var wt={name:"offset",enabled:true,phase:"main",requires:["popperOffsets"],fn:tn};function nn(t){var e=t.state,n=t.name;e.modifiersData[n]=mt({reference:e.rects.reference,element:e.rects.popper,placement:e.placement});}var He={name:"popperOffsets",enabled:true,phase:"read",fn:nn,data:{}};function rn(t){return t==="x"?"y":"x"}function on(t){var e=t.state,n=t.options,r=t.name,o=n.mainAxis,i=o===void 0?true:o,a=n.altAxis,s=a===void 0?false:a,f=n.boundary,c=n.rootBoundary,u=n.altBoundary,m=n.padding,v=n.tether,l=v===void 0?true:v,h=n.tetherOffset,p=h===void 0?0:h,g=ne(e,{boundary:f,rootBoundary:c,padding:m,altBoundary:u}),x=q(e.placement),y=te(e.placement),$=!y,d=Le(x),b=rn(d),w=e.modifiersData.popperOffsets,O=e.rects.reference,j=e.rects.popper,A=typeof p=="function"?p(Object.assign({},e.rects,{placement:e.placement})):p,k=typeof A=="number"?{mainAxis:A,altAxis:A}:Object.assign({mainAxis:0,altAxis:0},A),D=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,S={x:0,y:0};if(w){if(i){var L,re=d==="y"?E:P,oe=d==="y"?R:W,M=d==="y"?"height":"width",T=w[d],pe=T+g[re],_=T-g[oe],ue=l?-j[M]/2:0,xe=y===U?O[M]:j[M],ie=y===U?-j[M]:-O[M],le=e.elements.arrow,z=l&&le?ke(le):{width:0,height:0},V=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:st(),de=V[re],ae=V[oe],Y=fe(0,O[M],z[M]),jt=$?O[M]/2-ue-Y-de-k.mainAxis:xe-Y-de-k.mainAxis,Dt=$?-O[M]/2+ue+Y+ae+k.mainAxis:ie+Y+ae+k.mainAxis,Oe=e.elements.arrow&&se(e.elements.arrow),Et=Oe?d==="y"?Oe.clientTop||0:Oe.clientLeft||0:0,Ce=(L=D==null?void 0:D[d])!=null?L:0,Pt=T+jt-Ce-Et,At=T+Dt-Ce,qe=fe(l?ve(pe,Pt):pe,T,l?X(_,At):_);w[d]=qe,S[d]=qe-T;}if(s){var Ve,kt=d==="x"?E:P,Lt=d==="x"?R:W,F=w[b],he=b==="y"?"height":"width",Ne=F+g[kt],Ie=F-g[Lt],$e=[E,P].indexOf(x)!==-1,_e=(Ve=D==null?void 0:D[b])!=null?Ve:0,ze=$e?Ne:F-O[he]-j[he]-_e+k.altAxis,Fe=$e?F+O[he]+j[he]-_e-k.altAxis:Ie,Ue=l&&$e?St(ze,F,Fe):fe(l?ze:Ne,F,l?Fe:Ie);w[b]=Ue,S[b]=Ue-F;}e.modifiersData[r]=S;}}var xt={name:"preventOverflow",enabled:true,phase:"main",fn:on,requiresIfExists:["offset"]};function an(t){return {scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function sn(t){return t===H(t)||!B(t)?We(t):an(t)}function fn(t){var e=t.getBoundingClientRect(),n=Z(e.width)/t.offsetWidth||1,r=Z(e.height)/t.offsetHeight||1;return n!==1||r!==1}function cn(t,e,n){n===void 0&&(n=false);var r=B(e),o=B(e)&&fn(e),i=I(e),a=ee(t,o),s={scrollLeft:0,scrollTop:0},f={x:0,y:0};return (r||!r&&!n)&&((C(e)!=="body"||Se(i))&&(s=sn(e)),B(e)?(f=ee(e,true),f.x+=e.clientLeft,f.y+=e.clientTop):i&&(f.x=Be(i))),{x:a.left+s.scrollLeft-f.x,y:a.top+s.scrollTop-f.y,width:a.width,height:a.height}}function pn(t){var e=new Map,n=new Set,r=[];t.forEach(function(i){e.set(i.name,i);});function o(i){n.add(i.name);var a=[].concat(i.requires||[],i.requiresIfExists||[]);a.forEach(function(s){if(!n.has(s)){var f=e.get(s);f&&o(f);}}),r.push(i);}return t.forEach(function(i){n.has(i.name)||o(i);}),r}function un(t){var e=pn(t);return ot.reduce(function(n,r){return n.concat(e.filter(function(o){return o.phase===r}))},[])}function ln(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t());});})),e}}function dn(t){var e=t.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var Ot={placement:"bottom",modifiers:[],strategy:"absolute"};function $t(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return !e.some(function(r){return !(r&&typeof r.getBoundingClientRect=="function")})}function we(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,o=e.defaultOptions,i=o===void 0?Ot:o;return function(a,s,f){f===void 0&&(f=i);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},Ot,i),modifiersData:{},elements:{reference:a,popper:s},attributes:{},styles:{}},u=[],m=false,v={state:c,setOptions:function(p){var g=typeof p=="function"?p(c.options):p;h(),c.options=Object.assign({},i,c.options,g),c.scrollParents={reference:Q(a)?ce(a):a.contextElement?ce(a.contextElement):[],popper:ce(s)};var x=un(dn([].concat(r,c.options.modifiers)));return c.orderedModifiers=x.filter(function(y){return y.enabled}),l(),v.update()},forceUpdate:function(){if(!m){var p=c.elements,g=p.reference,x=p.popper;if($t(g,x)){c.rects={reference:cn(g,se(x),c.options.strategy==="fixed"),popper:ke(x)},c.reset=false,c.placement=c.options.placement,c.orderedModifiers.forEach(function(j){return c.modifiersData[j.name]=Object.assign({},j.data)});for(var y=0;y<c.orderedModifiers.length;y++){if(c.reset===true){c.reset=false,y=-1;continue}var $=c.orderedModifiers[y],d=$.fn,b=$.options,w=b===void 0?{}:b,O=$.name;typeof d=="function"&&(c=d({state:c,options:w,name:O,instance:v})||c);}}}},update:ln(function(){return new Promise(function(p){v.forceUpdate(),p(c);})}),destroy:function(){h(),m=true;}};if(!$t(a,s))return v;v.setOptions(f).then(function(p){!m&&f.onFirstUpdate&&f.onFirstUpdate(p);});function l(){c.orderedModifiers.forEach(function(p){var g=p.name,x=p.options,y=x===void 0?{}:x,$=p.effect;if(typeof $=="function"){var d=$({state:c,name:g,instance:v,options:y}),b=function(){};u.push(d||b);}});}function h(){u.forEach(function(p){return p()}),u=[];}return v}}we();var mn=[Re,He,Me,Ae];we({defaultModifiers:mn});var gn=[Re,He,Me,Ae,wt,vt,xt,pt,bt],yn=we({defaultModifiers:gn});
850
-
851
- const popperArrowProps = buildProps({
852
- arrowOffset: {
853
- type: Number,
854
- default: 5
855
- }
856
- });
857
-
858
- const POSITIONING_STRATEGIES = ["fixed", "absolute"];
859
- const popperCoreConfigProps = buildProps({
860
- boundariesPadding: {
861
- type: Number,
862
- default: 0
863
- },
864
- fallbackPlacements: {
865
- type: definePropType(Array),
866
- default: void 0
867
- },
868
- gpuAcceleration: {
869
- type: Boolean,
870
- default: true
871
- },
872
- offset: {
873
- type: Number,
874
- default: 12
875
- },
876
- placement: {
877
- type: String,
878
- values: Ee,
879
- default: "bottom"
880
- },
881
- popperOptions: {
882
- type: definePropType(Object),
883
- default: () => ({})
884
- },
885
- strategy: {
886
- type: String,
887
- values: POSITIONING_STRATEGIES,
888
- default: "absolute"
889
- }
890
- });
891
- const popperContentProps = buildProps({
892
- ...popperCoreConfigProps,
893
- ...popperArrowProps,
894
- id: String,
895
- style: {
896
- type: definePropType([String, Array, Object])
897
- },
898
- className: {
899
- type: definePropType([String, Array, Object])
900
- },
901
- effect: {
902
- type: definePropType(String),
903
- default: "dark"
904
- },
905
- visible: Boolean,
906
- enterable: {
907
- type: Boolean,
908
- default: true
909
- },
910
- pure: Boolean,
911
- focusOnShow: Boolean,
912
- trapping: Boolean,
913
- popperClass: {
914
- type: definePropType([String, Array, Object])
915
- },
916
- popperStyle: {
917
- type: definePropType([String, Array, Object])
918
- },
919
- referenceEl: {
920
- type: definePropType(Object)
921
- },
922
- triggerTargetEl: {
923
- type: definePropType(Object)
924
- },
925
- stopPopperMouseEvent: {
926
- type: Boolean,
927
- default: true
928
- },
929
- virtualTriggering: Boolean,
930
- zIndex: Number,
931
- ...useAriaProps(["ariaLabel"]),
932
- loop: Boolean
933
- });
934
- const popperContentEmits = {
935
- mouseenter: (evt) => evt instanceof MouseEvent,
936
- mouseleave: (evt) => evt instanceof MouseEvent,
937
- focus: () => true,
938
- blur: () => true,
939
- close: () => true
940
- };
941
-
942
- const usePopperContentFocusTrap = (props, emit) => {
943
- const trapped = ref(false);
944
- const focusStartRef = ref();
945
- const onFocusAfterTrapped = () => {
946
- emit("focus");
947
- };
948
- const onFocusAfterReleased = (event) => {
949
- var _a;
950
- if (((_a = event.detail) == null ? void 0 : _a.focusReason) !== "pointer") {
951
- focusStartRef.value = "first";
952
- emit("blur");
953
- }
954
- };
955
- const onFocusInTrap = (event) => {
956
- if (props.visible && !trapped.value) {
957
- if (event.target) {
958
- focusStartRef.value = event.target;
959
- }
960
- trapped.value = true;
961
- }
962
- };
963
- const onFocusoutPrevented = (event) => {
964
- if (!props.trapping) {
965
- if (event.detail.focusReason === "pointer") {
966
- event.preventDefault();
967
- }
968
- trapped.value = false;
969
- }
970
- };
971
- const onReleaseRequested = () => {
972
- trapped.value = false;
973
- emit("close");
974
- };
975
- onBeforeUnmount(() => {
976
- focusStartRef.value = void 0;
977
- });
978
- return {
979
- focusStartRef,
980
- trapped,
981
- onFocusAfterReleased,
982
- onFocusAfterTrapped,
983
- onFocusInTrap,
984
- onFocusoutPrevented,
985
- onReleaseRequested
986
- };
987
- };
988
-
989
- const buildPopperOptions = (props, modifiers = []) => {
990
- const { placement, strategy, popperOptions } = props;
991
- const options = {
992
- placement,
993
- strategy,
994
- ...popperOptions,
995
- modifiers: [...genModifiers(props), ...modifiers]
996
- };
997
- deriveExtraModifiers(options, popperOptions == null ? void 0 : popperOptions.modifiers);
998
- return options;
999
- };
1000
- const unwrapMeasurableEl = ($el) => {
1001
- if (!isClient)
1002
- return;
1003
- return unrefElement($el);
1004
- };
1005
- function genModifiers(options) {
1006
- const { offset, gpuAcceleration, fallbackPlacements } = options;
1007
- return [
1008
- {
1009
- name: "offset",
1010
- options: {
1011
- offset: [0, offset != null ? offset : 12]
1012
- }
1013
- },
1014
- {
1015
- name: "preventOverflow",
1016
- options: {
1017
- padding: {
1018
- top: 0,
1019
- bottom: 0,
1020
- left: 0,
1021
- right: 0
1022
- }
1023
- }
1024
- },
1025
- {
1026
- name: "flip",
1027
- options: {
1028
- padding: 5,
1029
- fallbackPlacements
1030
- }
1031
- },
1032
- {
1033
- name: "computeStyles",
1034
- options: {
1035
- gpuAcceleration
1036
- }
1037
- }
1038
- ];
1039
- }
1040
- function deriveExtraModifiers(options, modifiers) {
1041
- if (modifiers) {
1042
- options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
1043
- }
1044
- }
1045
-
1046
- const usePopper = (referenceElementRef, popperElementRef, opts = {}) => {
1047
- const stateUpdater = {
1048
- name: "updateState",
1049
- enabled: true,
1050
- phase: "write",
1051
- fn: ({ state }) => {
1052
- const derivedState = deriveState(state);
1053
- Object.assign(states.value, derivedState);
1054
- },
1055
- requires: ["computeStyles"]
1056
- };
1057
- const options = computed(() => {
1058
- const { onFirstUpdate, placement, strategy, modifiers } = unref(opts);
1059
- return {
1060
- onFirstUpdate,
1061
- placement: placement || "bottom",
1062
- strategy: strategy || "absolute",
1063
- modifiers: [
1064
- ...modifiers || [],
1065
- stateUpdater,
1066
- { name: "applyStyles", enabled: false }
1067
- ]
1068
- };
1069
- });
1070
- const instanceRef = shallowRef();
1071
- const states = ref({
1072
- styles: {
1073
- popper: {
1074
- position: unref(options).strategy,
1075
- left: "0",
1076
- top: "0"
1077
- },
1078
- arrow: {
1079
- position: "absolute"
1080
- }
1081
- },
1082
- attributes: {}
1083
- });
1084
- const destroy = () => {
1085
- if (!instanceRef.value)
1086
- return;
1087
- instanceRef.value.destroy();
1088
- instanceRef.value = void 0;
1089
- };
1090
- watch(
1091
- options,
1092
- (newOptions) => {
1093
- const instance = unref(instanceRef);
1094
- if (instance) {
1095
- instance.setOptions(newOptions);
1096
- }
1097
- },
1098
- {
1099
- deep: true
1100
- }
1101
- );
1102
- watch(
1103
- [referenceElementRef, popperElementRef],
1104
- ([referenceElement, popperElement]) => {
1105
- destroy();
1106
- if (!referenceElement || !popperElement)
1107
- return;
1108
- instanceRef.value = yn(
1109
- referenceElement,
1110
- popperElement,
1111
- unref(options)
1112
- );
1113
- }
1114
- );
1115
- onBeforeUnmount(() => {
1116
- destroy();
1117
- });
1118
- return {
1119
- state: computed(() => {
1120
- var _a;
1121
- return { ...((_a = unref(instanceRef)) == null ? void 0 : _a.state) || {} };
1122
- }),
1123
- styles: computed(() => unref(states).styles),
1124
- attributes: computed(() => unref(states).attributes),
1125
- update: () => {
1126
- var _a;
1127
- return (_a = unref(instanceRef)) == null ? void 0 : _a.update();
1128
- },
1129
- forceUpdate: () => {
1130
- var _a;
1131
- return (_a = unref(instanceRef)) == null ? void 0 : _a.forceUpdate();
1132
- },
1133
- instanceRef: computed(() => unref(instanceRef))
1134
- };
1135
- };
1136
- function deriveState(state) {
1137
- const elements = Object.keys(state.elements);
1138
- const styles = fromPairs(
1139
- elements.map(
1140
- (element) => [element, state.styles[element] || {}]
1141
- )
1142
- );
1143
- const attributes = fromPairs(
1144
- elements.map(
1145
- (element) => [element, state.attributes[element]]
1146
- )
1147
- );
1148
- return {
1149
- styles,
1150
- attributes
1151
- };
1152
- }
1153
-
1154
- const DEFAULT_ARROW_OFFSET = 0;
1155
- const usePopperContent = (props) => {
1156
- const { popperInstanceRef, contentRef, triggerRef, role } = inject(
1157
- POPPER_INJECTION_KEY,
1158
- void 0
1159
- );
1160
- const arrowRef = ref();
1161
- const arrowOffset = computed(() => props.arrowOffset);
1162
- const eventListenerModifier = computed(() => {
1163
- return {
1164
- name: "eventListeners",
1165
- enabled: !!props.visible
1166
- };
1167
- });
1168
- const arrowModifier = computed(() => {
1169
- var _a;
1170
- const arrowEl = unref(arrowRef);
1171
- const offset = (_a = unref(arrowOffset)) != null ? _a : DEFAULT_ARROW_OFFSET;
1172
- return {
1173
- name: "arrow",
1174
- enabled: !isUndefined(arrowEl),
1175
- options: {
1176
- element: arrowEl,
1177
- padding: offset
1178
- }
1179
- };
1180
- });
1181
- const options = computed(() => {
1182
- return {
1183
- onFirstUpdate: () => {
1184
- update();
1185
- },
1186
- ...buildPopperOptions(props, [
1187
- unref(arrowModifier),
1188
- unref(eventListenerModifier)
1189
- ])
1190
- };
1191
- });
1192
- const computedReference = computed(
1193
- () => unwrapMeasurableEl(props.referenceEl) || unref(triggerRef)
1194
- );
1195
- const { attributes, state, styles, update, forceUpdate, instanceRef } = usePopper(computedReference, contentRef, options);
1196
- watch(instanceRef, (instance) => popperInstanceRef.value = instance, {
1197
- flush: "sync"
1198
- });
1199
- onMounted(() => {
1200
- watch(
1201
- () => {
1202
- var _a, _b;
1203
- return (_b = (_a = unref(computedReference)) == null ? void 0 : _a.getBoundingClientRect) == null ? void 0 : _b.call(_a);
1204
- },
1205
- () => {
1206
- update();
1207
- }
1208
- );
1209
- });
1210
- onBeforeUnmount(() => {
1211
- popperInstanceRef.value = void 0;
1212
- });
1213
- return {
1214
- attributes,
1215
- arrowRef,
1216
- contentRef,
1217
- instanceRef,
1218
- state,
1219
- styles,
1220
- role,
1221
- forceUpdate,
1222
- update
1223
- };
1224
- };
1225
-
1226
- const usePopperContentDOM = (props, {
1227
- attributes,
1228
- styles,
1229
- role
1230
- }) => {
1231
- const { nextZIndex } = useZIndex();
1232
- const ns = useNamespace("popper");
1233
- const contentAttrs = computed(() => unref(attributes).popper);
1234
- const contentZIndex = ref(
1235
- isNumber(props.zIndex) ? props.zIndex : nextZIndex()
1236
- );
1237
- const contentClass = computed(() => [
1238
- ns.b(),
1239
- ns.is("pure", props.pure),
1240
- ns.is(props.effect),
1241
- props.popperClass
1242
- ]);
1243
- const contentStyle = computed(() => {
1244
- return [
1245
- { zIndex: unref(contentZIndex) },
1246
- unref(styles).popper,
1247
- props.popperStyle || {}
1248
- ];
1249
- });
1250
- const ariaModal = computed(
1251
- () => role.value === "dialog" ? "false" : void 0
1252
- );
1253
- const arrowStyle = computed(
1254
- () => unref(styles).arrow || {}
1255
- );
1256
- const updateZIndex = () => {
1257
- contentZIndex.value = isNumber(props.zIndex) ? props.zIndex : nextZIndex();
1258
- };
1259
- return {
1260
- ariaModal,
1261
- arrowStyle,
1262
- contentAttrs,
1263
- contentClass,
1264
- contentStyle,
1265
- contentZIndex,
1266
- updateZIndex
1267
- };
1268
- };
1269
-
1270
- const _sfc_main$3 = defineComponent({
1271
- ...{
1272
- name: "ElPopperContent"
1273
- },
1274
- __name: "content",
1275
- props: popperContentProps,
1276
- emits: popperContentEmits,
1277
- setup(__props, { expose: __expose, emit: __emit }) {
1278
- const emit = __emit;
1279
- const props = __props;
1280
- const {
1281
- focusStartRef,
1282
- trapped,
1283
- onFocusAfterReleased,
1284
- onFocusAfterTrapped,
1285
- onFocusInTrap,
1286
- onFocusoutPrevented,
1287
- onReleaseRequested
1288
- } = usePopperContentFocusTrap(props, emit);
1289
- const { attributes, arrowRef, contentRef, styles, instanceRef, role, update } = usePopperContent(props);
1290
- const {
1291
- ariaModal,
1292
- arrowStyle,
1293
- contentAttrs,
1294
- contentClass,
1295
- contentStyle,
1296
- updateZIndex
1297
- } = usePopperContentDOM(props, {
1298
- styles,
1299
- attributes,
1300
- role
1301
- });
1302
- const formItemContext = inject(formItemContextKey, void 0);
1303
- provide(POPPER_CONTENT_INJECTION_KEY, {
1304
- arrowStyle,
1305
- arrowRef
1306
- });
1307
- if (formItemContext) {
1308
- provide(formItemContextKey, {
1309
- ...formItemContext,
1310
- addInputId: NOOP,
1311
- removeInputId: NOOP
1312
- });
1313
- }
1314
- let triggerTargetAriaStopWatch = void 0;
1315
- const updatePopper = (shouldUpdateZIndex = true) => {
1316
- update();
1317
- shouldUpdateZIndex && updateZIndex();
1318
- };
1319
- const togglePopperAlive = () => {
1320
- updatePopper(false);
1321
- if (props.visible && props.focusOnShow) {
1322
- trapped.value = true;
1323
- } else if (props.visible === false) {
1324
- trapped.value = false;
1325
- }
1326
- };
1327
- onMounted(() => {
1328
- watch(
1329
- () => props.triggerTargetEl,
1330
- (triggerTargetEl, prevTriggerTargetEl) => {
1331
- triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
1332
- triggerTargetAriaStopWatch = void 0;
1333
- const el = unref(triggerTargetEl || contentRef.value);
1334
- const prevEl = unref(prevTriggerTargetEl || contentRef.value);
1335
- if (isElement(el)) {
1336
- triggerTargetAriaStopWatch = watch(
1337
- [role, () => props.ariaLabel, ariaModal, () => props.id],
1338
- (watches) => {
1339
- ["role", "aria-label", "aria-modal", "id"].forEach((key, idx) => {
1340
- isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
1341
- });
1342
- },
1343
- { immediate: true }
1344
- );
1345
- }
1346
- if (prevEl !== el && isElement(prevEl)) {
1347
- ["role", "aria-label", "aria-modal", "id"].forEach((key) => {
1348
- prevEl.removeAttribute(key);
1349
- });
1350
- }
1351
- },
1352
- { immediate: true }
1353
- );
1354
- watch(() => props.visible, togglePopperAlive, { immediate: true });
1355
- });
1356
- onBeforeUnmount(() => {
1357
- triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
1358
- triggerTargetAriaStopWatch = void 0;
1359
- contentRef.value = void 0;
1360
- });
1361
- __expose({
1362
- popperContentRef: contentRef,
1363
- popperInstanceRef: instanceRef,
1364
- updatePopper,
1365
- contentStyle
1366
- });
1367
- return (_ctx, _cache) => {
1368
- return openBlock(), createElementBlock(
1369
- "div",
1370
- mergeProps({
1371
- ref_key: "contentRef",
1372
- ref: contentRef
1373
- }, unref(contentAttrs), {
1374
- style: unref(contentStyle),
1375
- class: unref(contentClass),
1376
- tabindex: "-1",
1377
- onMouseenter: _cache[0] || (_cache[0] = (e) => _ctx.$emit("mouseenter", e)),
1378
- onMouseleave: _cache[1] || (_cache[1] = (e) => _ctx.$emit("mouseleave", e))
1379
- }),
1380
- [
1381
- createVNode(unref(ElFocusTrap), {
1382
- loop: _ctx.loop,
1383
- trapped: unref(trapped),
1384
- "trap-on-focus-in": true,
1385
- "focus-trap-el": unref(contentRef),
1386
- "focus-start-el": unref(focusStartRef),
1387
- onFocusAfterTrapped: unref(onFocusAfterTrapped),
1388
- onFocusAfterReleased: unref(onFocusAfterReleased),
1389
- onFocusin: unref(onFocusInTrap),
1390
- onFocusoutPrevented: unref(onFocusoutPrevented),
1391
- onReleaseRequested: unref(onReleaseRequested)
1392
- }, {
1393
- default: withCtx(() => [
1394
- renderSlot(_ctx.$slots, "default")
1395
- ]),
1396
- _: 3
1397
- }, 8, ["loop", "trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
1398
- ],
1399
- 16
1400
- );
1401
- };
1402
- }
1403
- });
1404
- var ElPopperContent = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/content.vue"]]);
1405
-
1406
- const ElPopper = withInstall(Popper);
1407
-
1408
- const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
1409
-
1410
- function useTimeout() {
1411
- let timeoutHandle;
1412
- const registerTimeout = (fn, delay) => {
1413
- cancelTimeout();
1414
- timeoutHandle = window.setTimeout(fn, delay);
1415
- };
1416
- const cancelTimeout = () => window.clearTimeout(timeoutHandle);
1417
- tryOnScopeDispose(() => cancelTimeout());
1418
- return {
1419
- registerTimeout,
1420
- cancelTimeout
1421
- };
1422
- }
1423
-
1424
- const useDelayedToggleProps = buildProps({
1425
- showAfter: {
1426
- type: Number,
1427
- default: 0
1428
- },
1429
- hideAfter: {
1430
- type: Number,
1431
- default: 200
1432
- },
1433
- autoClose: {
1434
- type: Number,
1435
- default: 0
1436
- }
1437
- });
1438
- const useDelayedToggle = ({
1439
- showAfter,
1440
- hideAfter,
1441
- autoClose,
1442
- open,
1443
- close
1444
- }) => {
1445
- const { registerTimeout } = useTimeout();
1446
- const {
1447
- registerTimeout: registerTimeoutForAutoClose,
1448
- cancelTimeout: cancelTimeoutForAutoClose
1449
- } = useTimeout();
1450
- const onOpen = (event, delay = unref(showAfter)) => {
1451
- registerTimeout(() => {
1452
- open(event);
1453
- const _autoClose = unref(autoClose);
1454
- if (isNumber(_autoClose) && _autoClose > 0) {
1455
- registerTimeoutForAutoClose(() => {
1456
- close(event);
1457
- }, _autoClose);
1458
- }
1459
- }, delay);
1460
- };
1461
- const onClose = (event, delay = unref(hideAfter)) => {
1462
- cancelTimeoutForAutoClose();
1463
- registerTimeout(() => {
1464
- close(event);
1465
- }, delay);
1466
- };
1467
- return {
1468
- onOpen,
1469
- onClose
1470
- };
1471
- };
1472
-
1473
- const useTooltipContentProps = buildProps({
1474
- ...useDelayedToggleProps,
1475
- ...popperContentProps,
1476
- appendTo: {
1477
- type: teleportProps.to.type
1478
- },
1479
- content: {
1480
- type: String,
1481
- default: ""
1482
- },
1483
- rawContent: Boolean,
1484
- persistent: Boolean,
1485
- visible: {
1486
- type: definePropType(Boolean),
1487
- default: null
1488
- },
1489
- transition: String,
1490
- teleported: {
1491
- type: Boolean,
1492
- default: true
1493
- },
1494
- disabled: Boolean,
1495
- ...useAriaProps(["ariaLabel"])
1496
- });
1497
-
1498
- const useTooltipTriggerProps = buildProps({
1499
- ...popperTriggerProps,
1500
- disabled: Boolean,
1501
- trigger: {
1502
- type: definePropType([String, Array]),
1503
- default: "hover"
1504
- },
1505
- triggerKeys: {
1506
- type: definePropType(Array),
1507
- default: () => [EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space]
1508
- },
1509
- focusOnTarget: Boolean
1510
- });
1511
-
1512
- const _prop = buildProp({
1513
- type: definePropType(Boolean),
1514
- default: null
1515
- });
1516
- const _event = buildProp({
1517
- type: definePropType(Function)
1518
- });
1519
- const createModelToggleComposable = (name) => {
1520
- const updateEventKey = `update:${name}`;
1521
- const updateEventKeyRaw = `onUpdate:${name}`;
1522
- const useModelToggleEmits2 = [updateEventKey];
1523
- const useModelToggleProps2 = {
1524
- [name]: _prop,
1525
- [updateEventKeyRaw]: _event
1526
- };
1527
- const useModelToggle2 = ({
1528
- indicator,
1529
- toggleReason,
1530
- shouldHideWhenRouteChanges,
1531
- shouldProceed,
1532
- onShow,
1533
- onHide
1534
- }) => {
1535
- const instance = getCurrentInstance();
1536
- const { emit } = instance;
1537
- const props = instance.props;
1538
- const hasUpdateHandler = computed(
1539
- () => isFunction(props[updateEventKeyRaw])
1540
- );
1541
- const isModelBindingAbsent = computed(() => props[name] === null);
1542
- const doShow = (event) => {
1543
- if (indicator.value === true) {
1544
- return;
1545
- }
1546
- indicator.value = true;
1547
- if (toggleReason) {
1548
- toggleReason.value = event;
1549
- }
1550
- if (isFunction(onShow)) {
1551
- onShow(event);
1552
- }
1553
- };
1554
- const doHide = (event) => {
1555
- if (indicator.value === false) {
1556
- return;
1557
- }
1558
- indicator.value = false;
1559
- if (toggleReason) {
1560
- toggleReason.value = event;
1561
- }
1562
- if (isFunction(onHide)) {
1563
- onHide(event);
1564
- }
1565
- };
1566
- const show = (event) => {
1567
- if (props.disabled === true || isFunction(shouldProceed) && !shouldProceed())
1568
- return;
1569
- const shouldEmit = hasUpdateHandler.value && isClient;
1570
- if (shouldEmit) {
1571
- emit(updateEventKey, true);
1572
- }
1573
- if (isModelBindingAbsent.value || !shouldEmit) {
1574
- doShow(event);
1575
- }
1576
- };
1577
- const hide = (event) => {
1578
- if (props.disabled === true || !isClient)
1579
- return;
1580
- const shouldEmit = hasUpdateHandler.value && isClient;
1581
- if (shouldEmit) {
1582
- emit(updateEventKey, false);
1583
- }
1584
- if (isModelBindingAbsent.value || !shouldEmit) {
1585
- doHide(event);
1586
- }
1587
- };
1588
- const onChange = (val) => {
1589
- if (!isBoolean(val))
1590
- return;
1591
- if (props.disabled && val) {
1592
- if (hasUpdateHandler.value) {
1593
- emit(updateEventKey, false);
1594
- }
1595
- } else if (indicator.value !== val) {
1596
- if (val) {
1597
- doShow();
1598
- } else {
1599
- doHide();
1600
- }
1601
- }
1602
- };
1603
- const toggle = () => {
1604
- if (indicator.value) {
1605
- hide();
1606
- } else {
1607
- show();
1608
- }
1609
- };
1610
- watch(() => props[name], onChange);
1611
- if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
1612
- watch(
1613
- () => ({
1614
- ...instance.proxy.$route
1615
- }),
1616
- () => {
1617
- if (shouldHideWhenRouteChanges.value && indicator.value) {
1618
- hide();
1619
- }
1620
- }
1621
- );
1622
- }
1623
- onMounted(() => {
1624
- onChange(props[name]);
1625
- });
1626
- return {
1627
- hide,
1628
- show,
1629
- toggle,
1630
- hasUpdateHandler
1631
- };
1632
- };
1633
- return {
1634
- useModelToggle: useModelToggle2,
1635
- useModelToggleProps: useModelToggleProps2,
1636
- useModelToggleEmits: useModelToggleEmits2
1637
- };
1638
- };
1639
-
1640
- const {
1641
- useModelToggleProps: useTooltipModelToggleProps,
1642
- useModelToggleEmits: useTooltipModelToggleEmits,
1643
- useModelToggle: useTooltipModelToggle
1644
- } = createModelToggleComposable("visible");
1645
- const useTooltipProps = buildProps({
1646
- ...popperProps,
1647
- ...useTooltipModelToggleProps,
1648
- ...useTooltipContentProps,
1649
- ...useTooltipTriggerProps,
1650
- ...popperArrowProps,
1651
- showArrow: {
1652
- type: Boolean,
1653
- default: true
1654
- }
1655
- });
1656
- const tooltipEmits = [
1657
- ...useTooltipModelToggleEmits,
1658
- "before-show",
1659
- "before-hide",
1660
- "show",
1661
- "hide",
1662
- "open",
1663
- "close"
1664
- ];
1665
-
1666
- const isTriggerType = (trigger, type) => {
1667
- if (isArray(trigger)) {
1668
- return trigger.includes(type);
1669
- }
1670
- return trigger === type;
1671
- };
1672
- const whenTrigger = (trigger, type, handler) => {
1673
- return (e) => {
1674
- isTriggerType(unref(trigger), type) && handler(e);
1675
- };
1676
- };
1677
-
1678
- const _sfc_main$2 = defineComponent({
1679
- ...{
1680
- name: "ElTooltipTrigger"
1681
- },
1682
- __name: "trigger",
1683
- props: useTooltipTriggerProps,
1684
- setup(__props, { expose: __expose }) {
1685
- const props = __props;
1686
- const ns = useNamespace("tooltip");
1687
- const { controlled, id, open, onOpen, onClose, onToggle } = inject(
1688
- TOOLTIP_INJECTION_KEY,
1689
- void 0
1690
- );
1691
- const triggerRef = ref(null);
1692
- const stopWhenControlledOrDisabled = () => {
1693
- if (unref(controlled) || props.disabled) {
1694
- return true;
1695
- }
1696
- };
1697
- const trigger = toRef(props, "trigger");
1698
- const onMouseenter = composeEventHandlers(
1699
- stopWhenControlledOrDisabled,
1700
- whenTrigger(trigger, "hover", (e) => {
1701
- onOpen(e);
1702
- if (props.focusOnTarget && e.target) {
1703
- nextTick(() => {
1704
- focusElement(e.target, { preventScroll: true });
1705
- });
1706
- }
1707
- })
1708
- );
1709
- const onMouseleave = composeEventHandlers(
1710
- stopWhenControlledOrDisabled,
1711
- whenTrigger(trigger, "hover", onClose)
1712
- );
1713
- const onClick = composeEventHandlers(
1714
- stopWhenControlledOrDisabled,
1715
- whenTrigger(trigger, "click", (e) => {
1716
- if (e.button === 0) {
1717
- onToggle(e);
1718
- }
1719
- })
1720
- );
1721
- const onFocus = composeEventHandlers(
1722
- stopWhenControlledOrDisabled,
1723
- whenTrigger(trigger, "focus", onOpen)
1724
- );
1725
- const onBlur = composeEventHandlers(
1726
- stopWhenControlledOrDisabled,
1727
- whenTrigger(trigger, "focus", onClose)
1728
- );
1729
- const onContextMenu = composeEventHandlers(
1730
- stopWhenControlledOrDisabled,
1731
- whenTrigger(trigger, "contextmenu", (e) => {
1732
- e.preventDefault();
1733
- onToggle(e);
1734
- })
1735
- );
1736
- const onKeydown = composeEventHandlers(
1737
- stopWhenControlledOrDisabled,
1738
- (e) => {
1739
- const code = getEventCode(e);
1740
- if (props.triggerKeys.includes(code)) {
1741
- e.preventDefault();
1742
- onToggle(e);
1743
- }
1744
- }
1745
- );
1746
- __expose({
1747
- triggerRef
1748
- });
1749
- return (_ctx, _cache) => {
1750
- return openBlock(), createBlock(unref(ElPopperTrigger), {
1751
- id: unref(id),
1752
- "virtual-ref": _ctx.virtualRef,
1753
- open: unref(open),
1754
- "virtual-triggering": _ctx.virtualTriggering,
1755
- class: normalizeClass(unref(ns).e("trigger")),
1756
- onBlur: unref(onBlur),
1757
- onClick: unref(onClick),
1758
- onContextmenu: unref(onContextMenu),
1759
- onFocus: unref(onFocus),
1760
- onMouseenter: unref(onMouseenter),
1761
- onMouseleave: unref(onMouseleave),
1762
- onKeydown: unref(onKeydown)
1763
- }, {
1764
- default: withCtx(() => [
1765
- renderSlot(_ctx.$slots, "default")
1766
- ]),
1767
- _: 3
1768
- }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
1769
- };
1770
- }
1771
- });
1772
- var ElTooltipTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/trigger.vue"]]);
1773
-
1774
- const usePopperContainerId = () => {
1775
- const namespace = useGetDerivedNamespace();
1776
- const idInjection = useIdInjection();
1777
- const id = computed(() => {
1778
- return `${namespace.value}-popper-container-${idInjection.prefix}`;
1779
- });
1780
- const selector = computed(() => `#${id.value}`);
1781
- return {
1782
- id,
1783
- selector
1784
- };
1785
- };
1786
- const createContainer = (id) => {
1787
- const container = document.createElement("div");
1788
- container.id = id;
1789
- document.body.appendChild(container);
1790
- return container;
1791
- };
1792
- const usePopperContainer = () => {
1793
- const { id, selector } = usePopperContainerId();
1794
- onBeforeMount(() => {
1795
- if (!isClient)
1796
- return;
1797
- if (process.env.NODE_ENV === "test" || !document.body.querySelector(selector.value)) {
1798
- createContainer(id.value);
1799
- }
1800
- });
1801
- return {
1802
- id,
1803
- selector
1804
- };
1805
- };
1806
-
1807
- const unique = (arr) => [...new Set(arr)];
1808
- const extractFirst = (arr) => {
1809
- return isArray(arr) ? arr[0] : arr;
1810
- };
1811
- const castArray = (arr) => {
1812
- if (!arr && arr !== 0)
1813
- return [];
1814
- return isArray(arr) ? arr : [arr];
1815
- };
1816
-
1817
- const _sfc_main$1 = defineComponent({
1818
- ...{
1819
- name: "ElTooltipContent",
1820
- inheritAttrs: false
1821
- },
1822
- __name: "content",
1823
- props: useTooltipContentProps,
1824
- setup(__props, { expose: __expose }) {
1825
- const props = __props;
1826
- const { selector } = usePopperContainerId();
1827
- const ns = useNamespace("tooltip");
1828
- const contentRef = ref();
1829
- const popperContentRef = computedEager(() => {
1830
- var _a;
1831
- return (_a = contentRef.value) == null ? void 0 : _a.popperContentRef;
1832
- });
1833
- let stopHandle;
1834
- const {
1835
- controlled,
1836
- id,
1837
- open,
1838
- trigger,
1839
- onClose,
1840
- onOpen,
1841
- onShow,
1842
- onHide,
1843
- onBeforeShow,
1844
- onBeforeHide
1845
- } = inject(TOOLTIP_INJECTION_KEY, void 0);
1846
- const transitionClass = computed(() => {
1847
- return props.transition || `${ns.namespace.value}-fade-in-linear`;
1848
- });
1849
- const persistentRef = computed(() => {
1850
- if (process.env.NODE_ENV === "test") {
1851
- if (!process.env.RUN_TEST_WITH_PERSISTENT) {
1852
- return true;
1853
- }
1854
- }
1855
- return props.persistent;
1856
- });
1857
- onBeforeUnmount(() => {
1858
- stopHandle == null ? void 0 : stopHandle();
1859
- });
1860
- const shouldRender = computed(() => {
1861
- return unref(persistentRef) ? true : unref(open);
1862
- });
1863
- const shouldShow = computed(() => {
1864
- return props.disabled ? false : unref(open);
1865
- });
1866
- const appendTo = computed(() => {
1867
- return props.appendTo || selector.value;
1868
- });
1869
- const contentStyle = computed(() => {
1870
- var _a;
1871
- return (_a = props.style) != null ? _a : {};
1872
- });
1873
- const ariaHidden = ref(true);
1874
- const onTransitionLeave = () => {
1875
- onHide();
1876
- isFocusInsideContent() && focusElement(document.body, { preventScroll: true });
1877
- ariaHidden.value = true;
1878
- };
1879
- const stopWhenControlled = () => {
1880
- if (unref(controlled))
1881
- return true;
1882
- };
1883
- const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
1884
- if (props.enterable && isTriggerType(unref(trigger), "hover")) {
1885
- onOpen();
1886
- }
1887
- });
1888
- const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
1889
- if (isTriggerType(unref(trigger), "hover")) {
1890
- onClose();
1891
- }
1892
- });
1893
- const onBeforeEnter = () => {
1894
- var _a, _b;
1895
- (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
1896
- onBeforeShow == null ? void 0 : onBeforeShow();
1897
- };
1898
- const onBeforeLeave = () => {
1899
- onBeforeHide == null ? void 0 : onBeforeHide();
1900
- };
1901
- const onAfterShow = () => {
1902
- onShow();
1903
- };
1904
- const onBlur = () => {
1905
- if (!props.virtualTriggering) {
1906
- onClose();
1907
- }
1908
- };
1909
- const isFocusInsideContent = (event) => {
1910
- var _a;
1911
- const popperContent = (_a = contentRef.value) == null ? void 0 : _a.popperContentRef;
1912
- const activeElement = (event == null ? void 0 : event.relatedTarget) || document.activeElement;
1913
- return popperContent == null ? void 0 : popperContent.contains(activeElement);
1914
- };
1915
- watch(
1916
- () => unref(open),
1917
- (val) => {
1918
- if (!val) {
1919
- stopHandle == null ? void 0 : stopHandle();
1920
- } else {
1921
- ariaHidden.value = false;
1922
- stopHandle = onClickOutside(
1923
- popperContentRef,
1924
- () => {
1925
- if (unref(controlled))
1926
- return;
1927
- const needClose = castArray(unref(trigger)).every((item) => {
1928
- return item !== "hover" && item !== "focus";
1929
- });
1930
- if (needClose) {
1931
- onClose();
1932
- }
1933
- },
1934
- { detectIframe: true }
1935
- );
1936
- }
1937
- },
1938
- {
1939
- flush: "post"
1940
- }
1941
- );
1942
- watch(
1943
- () => props.content,
1944
- () => {
1945
- var _a, _b;
1946
- (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
1947
- }
1948
- );
1949
- __expose({
1950
- contentRef,
1951
- isFocusInsideContent
1952
- });
1953
- return (_ctx, _cache) => {
1954
- return openBlock(), createBlock(unref(ElTeleport), {
1955
- disabled: !_ctx.teleported,
1956
- to: appendTo.value
1957
- }, {
1958
- default: withCtx(() => [
1959
- shouldRender.value || !ariaHidden.value ? (openBlock(), createBlock(Transition, {
1960
- key: 0,
1961
- name: transitionClass.value,
1962
- appear: !persistentRef.value,
1963
- onAfterLeave: onTransitionLeave,
1964
- onBeforeEnter,
1965
- onAfterEnter: onAfterShow,
1966
- onBeforeLeave,
1967
- persisted: ""
1968
- }, {
1969
- default: withCtx(() => [
1970
- withDirectives(createVNode(unref(ElPopperContent), mergeProps({
1971
- id: unref(id),
1972
- ref_key: "contentRef",
1973
- ref: contentRef
1974
- }, _ctx.$attrs, {
1975
- "aria-label": _ctx.ariaLabel,
1976
- "aria-hidden": ariaHidden.value,
1977
- "boundaries-padding": _ctx.boundariesPadding,
1978
- "fallback-placements": _ctx.fallbackPlacements,
1979
- "gpu-acceleration": _ctx.gpuAcceleration,
1980
- offset: _ctx.offset,
1981
- placement: _ctx.placement,
1982
- "popper-options": _ctx.popperOptions,
1983
- "arrow-offset": _ctx.arrowOffset,
1984
- strategy: _ctx.strategy,
1985
- effect: _ctx.effect,
1986
- enterable: _ctx.enterable,
1987
- pure: _ctx.pure,
1988
- "popper-class": _ctx.popperClass,
1989
- "popper-style": [_ctx.popperStyle, contentStyle.value],
1990
- "reference-el": _ctx.referenceEl,
1991
- "trigger-target-el": _ctx.triggerTargetEl,
1992
- visible: shouldShow.value,
1993
- "z-index": _ctx.zIndex,
1994
- loop: _ctx.loop,
1995
- onMouseenter: unref(onContentEnter),
1996
- onMouseleave: unref(onContentLeave),
1997
- onBlur,
1998
- onClose: unref(onClose)
1999
- }), {
2000
- default: withCtx(() => [
2001
- renderSlot(_ctx.$slots, "default")
2002
- ]),
2003
- _: 3
2004
- }, 16, ["id", "aria-label", "aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "arrow-offset", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "trigger-target-el", "visible", "z-index", "loop", "onMouseenter", "onMouseleave", "onClose"]), [
2005
- [vShow, shouldShow.value]
2006
- ])
2007
- ]),
2008
- _: 3
2009
- }, 8, ["name", "appear"])) : createCommentVNode("v-if", true)
2010
- ]),
2011
- _: 3
2012
- }, 8, ["disabled", "to"]);
2013
- };
2014
- }
2015
- });
2016
- var ElTooltipContent = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/content.vue"]]);
2017
-
2018
- const _hoisted_1 = ["innerHTML"];
2019
- const _hoisted_2 = { key: 1 };
2020
- const _sfc_main = defineComponent({
2021
- ...{
2022
- name: "ElTooltip"
2023
- },
2024
- __name: "tooltip",
2025
- props: useTooltipProps,
2026
- emits: tooltipEmits,
2027
- setup(__props, { expose: __expose, emit: __emit }) {
2028
- const props = __props;
2029
- const emit = __emit;
2030
- usePopperContainer();
2031
- const ns = useNamespace("tooltip");
2032
- const id = useId();
2033
- const popperRef = ref();
2034
- const contentRef = ref();
2035
- const updatePopper = () => {
2036
- var _a;
2037
- const popperComponent = unref(popperRef);
2038
- if (popperComponent) {
2039
- (_a = popperComponent.popperInstanceRef) == null ? void 0 : _a.update();
2040
- }
2041
- };
2042
- const open = ref(false);
2043
- const toggleReason = ref();
2044
- const { show, hide, hasUpdateHandler } = useTooltipModelToggle({
2045
- indicator: open,
2046
- toggleReason
2047
- });
2048
- const { onOpen, onClose } = useDelayedToggle({
2049
- showAfter: toRef(props, "showAfter"),
2050
- hideAfter: toRef(props, "hideAfter"),
2051
- autoClose: toRef(props, "autoClose"),
2052
- open: show,
2053
- close: hide
2054
- });
2055
- const controlled = computed(
2056
- () => isBoolean(props.visible) && !hasUpdateHandler.value
2057
- );
2058
- const kls = computed(() => {
2059
- return [ns.b(), props.popperClass];
2060
- });
2061
- provide(TOOLTIP_INJECTION_KEY, {
2062
- controlled,
2063
- id,
2064
- open: readonly(open),
2065
- trigger: toRef(props, "trigger"),
2066
- onOpen,
2067
- onClose,
2068
- onToggle: (event) => {
2069
- if (unref(open)) {
2070
- onClose(event);
2071
- } else {
2072
- onOpen(event);
2073
- }
2074
- },
2075
- onShow: () => {
2076
- emit("show", toggleReason.value);
2077
- },
2078
- onHide: () => {
2079
- emit("hide", toggleReason.value);
2080
- },
2081
- onBeforeShow: () => {
2082
- emit("before-show", toggleReason.value);
2083
- },
2084
- onBeforeHide: () => {
2085
- emit("before-hide", toggleReason.value);
2086
- },
2087
- updatePopper
2088
- });
2089
- watch(
2090
- () => props.disabled,
2091
- (disabled) => {
2092
- if (disabled && open.value) {
2093
- open.value = false;
2094
- }
2095
- }
2096
- );
2097
- const isFocusInsideContent = (event) => {
2098
- var _a;
2099
- return (_a = contentRef.value) == null ? void 0 : _a.isFocusInsideContent(event);
2100
- };
2101
- onDeactivated(() => open.value && hide());
2102
- onBeforeUnmount(() => {
2103
- toggleReason.value = void 0;
2104
- });
2105
- __expose({
2106
- popperRef,
2107
- contentRef,
2108
- isFocusInsideContent,
2109
- updatePopper,
2110
- onOpen,
2111
- onClose,
2112
- hide
2113
- });
2114
- return (_ctx, _cache) => {
2115
- return openBlock(), createBlock(unref(ElPopper), {
2116
- ref_key: "popperRef",
2117
- ref: popperRef,
2118
- role: _ctx.role
2119
- }, {
2120
- default: withCtx(() => [
2121
- createVNode(ElTooltipTrigger, {
2122
- disabled: _ctx.disabled,
2123
- trigger: _ctx.trigger,
2124
- "trigger-keys": _ctx.triggerKeys,
2125
- "virtual-ref": _ctx.virtualRef,
2126
- "virtual-triggering": _ctx.virtualTriggering,
2127
- "focus-on-target": _ctx.focusOnTarget
2128
- }, {
2129
- default: withCtx(() => [
2130
- _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
2131
- ]),
2132
- _: 3
2133
- }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering", "focus-on-target"]),
2134
- createVNode(ElTooltipContent, {
2135
- ref_key: "contentRef",
2136
- ref: contentRef,
2137
- "aria-label": _ctx.ariaLabel,
2138
- "boundaries-padding": _ctx.boundariesPadding,
2139
- content: _ctx.content,
2140
- disabled: _ctx.disabled,
2141
- effect: _ctx.effect,
2142
- enterable: _ctx.enterable,
2143
- "fallback-placements": _ctx.fallbackPlacements,
2144
- "hide-after": _ctx.hideAfter,
2145
- "gpu-acceleration": _ctx.gpuAcceleration,
2146
- offset: _ctx.offset,
2147
- persistent: _ctx.persistent,
2148
- "popper-class": kls.value,
2149
- "popper-style": _ctx.popperStyle,
2150
- placement: _ctx.placement,
2151
- "popper-options": _ctx.popperOptions,
2152
- "arrow-offset": _ctx.arrowOffset,
2153
- pure: _ctx.pure,
2154
- "raw-content": _ctx.rawContent,
2155
- "reference-el": _ctx.referenceEl,
2156
- "trigger-target-el": _ctx.triggerTargetEl,
2157
- "show-after": _ctx.showAfter,
2158
- strategy: _ctx.strategy,
2159
- teleported: _ctx.teleported,
2160
- transition: _ctx.transition,
2161
- "virtual-triggering": _ctx.virtualTriggering,
2162
- "z-index": _ctx.zIndex,
2163
- "append-to": _ctx.appendTo,
2164
- loop: _ctx.loop
2165
- }, {
2166
- default: withCtx(() => [
2167
- renderSlot(_ctx.$slots, "content", {}, () => [
2168
- _ctx.rawContent ? (openBlock(), createElementBlock("span", {
2169
- key: 0,
2170
- innerHTML: _ctx.content
2171
- }, null, 8, _hoisted_1)) : (openBlock(), createElementBlock(
2172
- "span",
2173
- _hoisted_2,
2174
- toDisplayString(_ctx.content),
2175
- 1
2176
- ))
2177
- ]),
2178
- _ctx.showArrow ? (openBlock(), createBlock(unref(ElPopperArrow), { key: 0 })) : createCommentVNode("v-if", true)
2179
- ]),
2180
- _: 3
2181
- }, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "arrow-offset", "pure", "raw-content", "reference-el", "trigger-target-el", "show-after", "strategy", "teleported", "transition", "virtual-triggering", "z-index", "append-to", "loop"])
2182
- ]),
2183
- _: 3
2184
- }, 8, ["role"]);
2185
- };
2186
- }
2187
- });
2188
- var Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/tooltip.vue"]]);
2189
-
2190
- const ElTooltip = withInstall(Tooltip);
2191
-
2192
- export { Ee as E, FOCUS_TRAP_INJECTION_KEY as F, ElTooltip as a, ElTeleport as b, castArray as c, ElFocusTrap as d, extractFirst as e, useTooltipTriggerProps as f, unique as g, roleTypes as r, teleportProps as t, useTooltipContentProps as u };