@das-fed/ui 1.1.4 → 6.3.0-beta.0
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.
- package/global/icons/index.local.js +1 -1
- package/global/style/index.css +1 -1
- package/global/style/scrollbar.css +22 -22
- package/global/theme/index.js +12 -12
- package/global/theme/module/color.js +31 -31
- package/global/theme/module/fontSize.js +5 -5
- package/global/theme/module/scrollbar.js +6 -6
- package/package.json +13 -7
- package/packages/business-components/app-container/index.js +154 -147
- package/packages/business-components/change-enterprises/index.css +1 -0
- package/packages/business-components/change-enterprises/index.js +241 -0
- package/packages/business-components/change-pwd/index.css +1 -0
- package/packages/business-components/change-pwd/index.js +330 -0
- package/packages/business-components/currency-page/index.css +1 -0
- package/packages/business-components/currency-page/index.js +99 -0
- package/packages/business-components/device-panel/index.css +1 -0
- package/packages/business-components/device-panel/index.js +115939 -0
- package/packages/business-components/echarts/index.js +93 -122
- package/packages/business-components/export-button/index.js +73 -66
- package/packages/business-components/import-button/index.js +213 -170
- package/packages/business-components/index.js +8 -1
- package/packages/business-components/layout-breadcrumb/index.js +82 -66
- package/packages/business-components/model-table-dialog/index.js +299 -289
- package/packages/business-components/process-configuration/index.css +1 -0
- package/packages/business-components/process-configuration/index.js +612 -0
- package/packages/business-components/process-form/index.css +1 -0
- package/packages/business-components/process-form/index.js +524 -0
- package/packages/business-components/process-search-form/index.js +73 -315
- package/packages/business-components/process-table/index.css +1 -1
- package/packages/business-components/process-table/index.js +186 -152
- package/packages/business-components/urgent-panel/index.css +1 -0
- package/packages/business-components/urgent-panel/index.js +3914 -0
- package/packages/business-components/user-org-dialog/index.js +466 -375
- package/packages/business-components/video-dialog/index.css +1 -0
- package/packages/business-components/video-dialog/index.js +1041 -0
- package/packages/business.js +1 -2
- package/packages/components/alert/index.js +449 -633
- package/packages/components/audio-video/index.css +1 -1
- package/packages/components/audio-video/index.js +312 -126
- package/packages/components/autocomplete/index.css +1 -1
- package/packages/components/autocomplete/index.js +312 -2923
- package/packages/components/breadcrumb/index.js +97 -82
- package/packages/components/button/index.css +1 -1
- package/packages/components/button/index.js +646 -787
- package/packages/components/calendar/index.css +1 -1
- package/packages/components/calendar/index.js +655 -3879
- package/packages/components/cascader/index.js +209 -203
- package/packages/components/checkbox/index.css +1 -1
- package/packages/components/checkbox/index.js +710 -872
- package/packages/components/collapse-panel/index.css +1 -1
- package/packages/components/collapse-panel/index.js +419 -601
- package/packages/components/collapse-transition/index.js +23 -21
- package/packages/components/collaspe/index.css +1 -1
- package/packages/components/collaspe/index.js +413 -595
- package/packages/components/color-picker/index.css +1 -1
- package/packages/components/color-picker/index.js +176 -133
- package/packages/components/custom-search-item/index.js +43 -37
- package/packages/components/date-picker/index.js +1338 -1459
- package/packages/components/dialog/index.js +441 -241
- package/packages/components/dimple-layout/index.css +1 -1
- package/packages/components/dimple-layout/index.js +1298 -1794
- package/packages/components/drawer/index.js +116 -101
- package/packages/components/dropdown/index.js +129 -109
- package/packages/components/edit-table/index.css +1 -1
- package/packages/components/edit-table/index.js +868 -752
- package/packages/components/empty/index.js +83 -78
- package/packages/components/form/index.js +22 -15
- package/packages/components/form-item/index.css +1 -1
- package/packages/components/form-item/index.js +601 -440
- package/packages/components/icon/index.css +1 -1
- package/packages/components/icon/index.js +38 -22
- package/packages/components/image-preview/index.css +1 -0
- package/packages/components/image-preview/index.js +2714 -0
- package/packages/components/image-upload/index.js +601 -765
- package/packages/components/image-viewer/index.css +1 -1
- package/packages/components/image-viewer/index.js +909 -990
- package/packages/components/index.js +2 -2
- package/packages/components/input/index.css +1 -1
- package/packages/components/input/index.js +284 -256
- package/packages/components/input-dialog-select/index.css +1 -1
- package/packages/components/input-dialog-select/index.js +179 -156
- package/packages/components/input-number/index.css +1 -1
- package/packages/components/input-number/index.js +157 -170
- package/packages/components/live-player/index.css +1 -0
- package/packages/components/live-player/index.js +170 -0
- package/packages/components/loading/index.js +17 -26
- package/packages/components/map/index.css +1 -1
- package/packages/components/map/index.js +18913 -461
- package/packages/components/menu-aside/index.css +1 -1
- package/packages/components/menu-aside/index.js +648 -713
- package/packages/components/menu-header/index.js +446 -629
- package/packages/components/message/index.js +25 -16
- package/packages/components/notification/index.js +386 -575
- package/packages/components/overlay/index.js +112 -103
- package/packages/components/pagination/index.js +260 -330
- package/packages/components/popover/index.js +104 -93
- package/packages/components/popup-mask/index.css +1 -1
- package/packages/components/popup-mask/index.js +77 -72
- package/packages/components/preview/index.js +33 -28
- package/packages/components/progress/index.js +214 -221
- package/packages/components/radio/index.css +1 -1
- package/packages/components/radio/index.js +699 -862
- package/packages/components/radio-tabs/index.js +144 -107
- package/packages/components/rich-editor/index.css +1 -1
- package/packages/components/rich-editor/index.js +105 -106
- package/packages/components/scrollbar/index.css +3 -2
- package/packages/components/scrollbar/index.js +2262 -1201
- package/packages/components/search/index.js +500 -664
- package/packages/components/search-form/index.css +1 -1
- package/packages/components/search-form/index.js +724 -626
- package/packages/components/select/index.css +1 -1
- package/packages/components/select/index.js +1052 -950
- package/packages/components/select-input/index.js +63 -53
- package/packages/components/select-list/index.css +1 -1
- package/packages/components/select-list/index.js +258 -235
- package/packages/components/special-range-picker-month/index.css +1 -1
- package/packages/components/special-range-picker-month/index.js +3068 -72555
- package/packages/components/special-range-picker-year/index.css +1 -1
- package/packages/components/special-range-picker-year/index.js +345 -339
- package/packages/components/spin/index.js +415 -594
- package/packages/components/split-panel/index.css +1 -1
- package/packages/components/split-panel/index.js +146 -127
- package/packages/components/step/index.js +414 -597
- package/packages/components/steps/index.js +407 -590
- package/packages/components/switch/index.js +23 -23
- package/packages/components/table/index.css +1 -1
- package/packages/components/table/index.js +80813 -27734
- package/packages/components/tabs/index.css +1 -1
- package/packages/components/tabs/index.js +620 -813
- package/packages/components/tag/index.js +63 -63
- package/packages/components/text-tooltip/index.css +9 -0
- package/packages/components/text-tooltip/index.js +2739 -33
- package/packages/components/time-line/index.js +464 -643
- package/packages/components/tooltip/index.css +1 -1
- package/packages/components/tooltip/index.js +108 -79
- package/packages/components/tree/index.css +1 -1
- package/packages/components/tree/index.js +840 -809
- package/packages/components/tree-select/index.js +271 -303
- package/packages/components/tree-table/index.js +461 -352
- package/packages/components/upload/index.js +682 -858
- package/packages/components/virtual-tree/index.css +1 -1
- package/packages/components/virtual-tree/index.js +144 -126
- package/packages/index.d.ts +1 -0
- package/packages/index.js +2 -2
- package/style/business.css +11 -4
- package/style/index.css +55 -45
- package/packages/business-components/low-code/index.css +0 -1
- package/packages/business-components/low-code/index.js +0 -60
- package/packages/components/audio-video-player/index.css +0 -1
- package/packages/components/audio-video-player/index.js +0 -83
- package/packages/components/table-column/index.css +0 -1
- package/packages/components/table-column/index.js +0 -82021
|
@@ -1,2810 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { withInstall
|
|
3
|
-
import { DasInput, vDasTooltip, vOverlay } from '@das-fed/ui';
|
|
1
|
+
import { defineComponent, computed, ref, watch, onMounted, onUnmounted, nextTick, resolveComponent, openBlock, createElementBlock, normalizeStyle, createVNode, withCtx, createElementVNode, withModifiers, mergeProps, createSlots, renderList, renderSlot, withDirectives, createBlock, normalizeClass, createTextVNode, toDisplayString, vShow, createCommentVNode } from 'vue';
|
|
2
|
+
import { withInstall } from '@das-fed/utils';
|
|
3
|
+
import { DasInput, vDasTooltip, vOverlay, DasTree } from '@das-fed/ui';
|
|
4
4
|
import { useModelValue } from '@das-fed/utils/vue';
|
|
5
|
-
import {
|
|
5
|
+
import { RecycleScroller } from 'vue-virtual-scroller';
|
|
6
|
+
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css';
|
|
6
7
|
import '@das-fed/ui/global/theme';
|
|
7
8
|
|
|
8
|
-
const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
|
|
9
|
-
const handleEvent = (event) => {
|
|
10
|
-
const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event);
|
|
11
|
-
if (checkForDefaultPrevented === false || !shouldPrevent) {
|
|
12
|
-
return oursHandler == null ? void 0 : oursHandler(event);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
return handleEvent;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
var _a;
|
|
19
|
-
const isClient = typeof window !== "undefined";
|
|
20
|
-
const isString$1 = (val) => typeof val === "string";
|
|
21
|
-
const noop = () => {
|
|
22
|
-
};
|
|
23
|
-
const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
24
|
-
|
|
25
|
-
function resolveUnref(r) {
|
|
26
|
-
return typeof r === "function" ? r() : unref(r);
|
|
27
|
-
}
|
|
28
|
-
function identity(arg) {
|
|
29
|
-
return arg;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function tryOnScopeDispose(fn) {
|
|
33
|
-
if (getCurrentScope()) {
|
|
34
|
-
onScopeDispose(fn);
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function unrefElement(elRef) {
|
|
41
|
-
var _a;
|
|
42
|
-
const plain = resolveUnref(elRef);
|
|
43
|
-
return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const defaultWindow = isClient ? window : void 0;
|
|
47
|
-
|
|
48
|
-
function useEventListener(...args) {
|
|
49
|
-
let target;
|
|
50
|
-
let events;
|
|
51
|
-
let listeners;
|
|
52
|
-
let options;
|
|
53
|
-
if (isString$1(args[0]) || Array.isArray(args[0])) {
|
|
54
|
-
[events, listeners, options] = args;
|
|
55
|
-
target = defaultWindow;
|
|
56
|
-
} else {
|
|
57
|
-
[target, events, listeners, options] = args;
|
|
58
|
-
}
|
|
59
|
-
if (!target)
|
|
60
|
-
return noop;
|
|
61
|
-
if (!Array.isArray(events))
|
|
62
|
-
events = [events];
|
|
63
|
-
if (!Array.isArray(listeners))
|
|
64
|
-
listeners = [listeners];
|
|
65
|
-
const cleanups = [];
|
|
66
|
-
const cleanup = () => {
|
|
67
|
-
cleanups.forEach((fn) => fn());
|
|
68
|
-
cleanups.length = 0;
|
|
69
|
-
};
|
|
70
|
-
const register = (el, event, listener, options2) => {
|
|
71
|
-
el.addEventListener(event, listener, options2);
|
|
72
|
-
return () => el.removeEventListener(event, listener, options2);
|
|
73
|
-
};
|
|
74
|
-
const stopWatch = watch(() => [unrefElement(target), resolveUnref(options)], ([el, options2]) => {
|
|
75
|
-
cleanup();
|
|
76
|
-
if (!el)
|
|
77
|
-
return;
|
|
78
|
-
cleanups.push(...events.flatMap((event) => {
|
|
79
|
-
return listeners.map((listener) => register(el, event, listener, options2));
|
|
80
|
-
}));
|
|
81
|
-
}, { immediate: true, flush: "post" });
|
|
82
|
-
const stop = () => {
|
|
83
|
-
stopWatch();
|
|
84
|
-
cleanup();
|
|
85
|
-
};
|
|
86
|
-
tryOnScopeDispose(stop);
|
|
87
|
-
return stop;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
let _iOSWorkaround = false;
|
|
91
|
-
function onClickOutside(target, handler, options = {}) {
|
|
92
|
-
const { window = defaultWindow, ignore = [], capture = true, detectIframe = false } = options;
|
|
93
|
-
if (!window)
|
|
94
|
-
return;
|
|
95
|
-
if (isIOS && !_iOSWorkaround) {
|
|
96
|
-
_iOSWorkaround = true;
|
|
97
|
-
Array.from(window.document.body.children).forEach((el) => el.addEventListener("click", noop));
|
|
98
|
-
}
|
|
99
|
-
let shouldListen = true;
|
|
100
|
-
const shouldIgnore = (event) => {
|
|
101
|
-
return ignore.some((target2) => {
|
|
102
|
-
if (typeof target2 === "string") {
|
|
103
|
-
return Array.from(window.document.querySelectorAll(target2)).some((el) => el === event.target || event.composedPath().includes(el));
|
|
104
|
-
} else {
|
|
105
|
-
const el = unrefElement(target2);
|
|
106
|
-
return el && (event.target === el || event.composedPath().includes(el));
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
};
|
|
110
|
-
const listener = (event) => {
|
|
111
|
-
const el = unrefElement(target);
|
|
112
|
-
if (!el || el === event.target || event.composedPath().includes(el))
|
|
113
|
-
return;
|
|
114
|
-
if (event.detail === 0)
|
|
115
|
-
shouldListen = !shouldIgnore(event);
|
|
116
|
-
if (!shouldListen) {
|
|
117
|
-
shouldListen = true;
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
handler(event);
|
|
121
|
-
};
|
|
122
|
-
const cleanup = [
|
|
123
|
-
useEventListener(window, "click", listener, { passive: true, capture }),
|
|
124
|
-
useEventListener(window, "pointerdown", (e) => {
|
|
125
|
-
const el = unrefElement(target);
|
|
126
|
-
if (el)
|
|
127
|
-
shouldListen = !e.composedPath().includes(el) && !shouldIgnore(e);
|
|
128
|
-
}, { passive: true }),
|
|
129
|
-
detectIframe && useEventListener(window, "blur", (event) => {
|
|
130
|
-
var _a;
|
|
131
|
-
const el = unrefElement(target);
|
|
132
|
-
if (((_a = window.document.activeElement) == null ? void 0 : _a.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(window.document.activeElement)))
|
|
133
|
-
handler(event);
|
|
134
|
-
})
|
|
135
|
-
].filter(Boolean);
|
|
136
|
-
const stop = () => cleanup.forEach((fn) => fn());
|
|
137
|
-
return stop;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
141
|
-
const globalKey = "__vueuse_ssr_handlers__";
|
|
142
|
-
_global[globalKey] = _global[globalKey] || {};
|
|
143
|
-
|
|
144
|
-
var SwipeDirection;
|
|
145
|
-
(function(SwipeDirection2) {
|
|
146
|
-
SwipeDirection2["UP"] = "UP";
|
|
147
|
-
SwipeDirection2["RIGHT"] = "RIGHT";
|
|
148
|
-
SwipeDirection2["DOWN"] = "DOWN";
|
|
149
|
-
SwipeDirection2["LEFT"] = "LEFT";
|
|
150
|
-
SwipeDirection2["NONE"] = "NONE";
|
|
151
|
-
})(SwipeDirection || (SwipeDirection = {}));
|
|
152
|
-
|
|
153
|
-
var __defProp = Object.defineProperty;
|
|
154
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
155
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
156
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
157
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
158
|
-
var __spreadValues = (a, b) => {
|
|
159
|
-
for (var prop in b || (b = {}))
|
|
160
|
-
if (__hasOwnProp.call(b, prop))
|
|
161
|
-
__defNormalProp(a, prop, b[prop]);
|
|
162
|
-
if (__getOwnPropSymbols)
|
|
163
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
164
|
-
if (__propIsEnum.call(b, prop))
|
|
165
|
-
__defNormalProp(a, prop, b[prop]);
|
|
166
|
-
}
|
|
167
|
-
return a;
|
|
168
|
-
};
|
|
169
|
-
const _TransitionPresets = {
|
|
170
|
-
easeInSine: [0.12, 0, 0.39, 0],
|
|
171
|
-
easeOutSine: [0.61, 1, 0.88, 1],
|
|
172
|
-
easeInOutSine: [0.37, 0, 0.63, 1],
|
|
173
|
-
easeInQuad: [0.11, 0, 0.5, 0],
|
|
174
|
-
easeOutQuad: [0.5, 1, 0.89, 1],
|
|
175
|
-
easeInOutQuad: [0.45, 0, 0.55, 1],
|
|
176
|
-
easeInCubic: [0.32, 0, 0.67, 0],
|
|
177
|
-
easeOutCubic: [0.33, 1, 0.68, 1],
|
|
178
|
-
easeInOutCubic: [0.65, 0, 0.35, 1],
|
|
179
|
-
easeInQuart: [0.5, 0, 0.75, 0],
|
|
180
|
-
easeOutQuart: [0.25, 1, 0.5, 1],
|
|
181
|
-
easeInOutQuart: [0.76, 0, 0.24, 1],
|
|
182
|
-
easeInQuint: [0.64, 0, 0.78, 0],
|
|
183
|
-
easeOutQuint: [0.22, 1, 0.36, 1],
|
|
184
|
-
easeInOutQuint: [0.83, 0, 0.17, 1],
|
|
185
|
-
easeInExpo: [0.7, 0, 0.84, 0],
|
|
186
|
-
easeOutExpo: [0.16, 1, 0.3, 1],
|
|
187
|
-
easeInOutExpo: [0.87, 0, 0.13, 1],
|
|
188
|
-
easeInCirc: [0.55, 0, 1, 0.45],
|
|
189
|
-
easeOutCirc: [0, 0.55, 0.45, 1],
|
|
190
|
-
easeInOutCirc: [0.85, 0, 0.15, 1],
|
|
191
|
-
easeInBack: [0.36, 0, 0.66, -0.56],
|
|
192
|
-
easeOutBack: [0.34, 1.56, 0.64, 1],
|
|
193
|
-
easeInOutBack: [0.68, -0.6, 0.32, 1.6]
|
|
194
|
-
};
|
|
195
|
-
__spreadValues({
|
|
196
|
-
linear: identity
|
|
197
|
-
}, _TransitionPresets);
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* @vue/shared v3.4.21
|
|
201
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
202
|
-
* @license MIT
|
|
203
|
-
**/
|
|
204
|
-
|
|
205
|
-
!!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
|
|
206
|
-
!!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
|
|
207
|
-
const NOOP = () => {
|
|
208
|
-
};
|
|
209
|
-
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
210
|
-
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
|
211
|
-
const isArray = Array.isArray;
|
|
212
|
-
const isFunction = (val) => typeof val === "function";
|
|
213
|
-
const isString = (val) => typeof val === "string";
|
|
214
|
-
const isObject = (val) => val !== null && typeof val === "object";
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* The inverse of `_.toPairs`; this method returns an object composed
|
|
218
|
-
* from key-value `pairs`.
|
|
219
|
-
*
|
|
220
|
-
* @static
|
|
221
|
-
* @memberOf _
|
|
222
|
-
* @since 4.0.0
|
|
223
|
-
* @category Array
|
|
224
|
-
* @param {Array} pairs The key-value pairs.
|
|
225
|
-
* @returns {Object} Returns the new object.
|
|
226
|
-
* @example
|
|
227
|
-
*
|
|
228
|
-
* _.fromPairs([['a', 1], ['b', 2]]);
|
|
229
|
-
* // => { 'a': 1, 'b': 2 }
|
|
230
|
-
*/
|
|
231
|
-
function fromPairs(pairs) {
|
|
232
|
-
var index = -1,
|
|
233
|
-
length = pairs == null ? 0 : pairs.length,
|
|
234
|
-
result = {};
|
|
235
|
-
|
|
236
|
-
while (++index < length) {
|
|
237
|
-
var pair = pairs[index];
|
|
238
|
-
result[pair[0]] = pair[1];
|
|
239
|
-
}
|
|
240
|
-
return result;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Checks if `value` is `null` or `undefined`.
|
|
245
|
-
*
|
|
246
|
-
* @static
|
|
247
|
-
* @memberOf _
|
|
248
|
-
* @since 4.0.0
|
|
249
|
-
* @category Lang
|
|
250
|
-
* @param {*} value The value to check.
|
|
251
|
-
* @returns {boolean} Returns `true` if `value` is nullish, else `false`.
|
|
252
|
-
* @example
|
|
253
|
-
*
|
|
254
|
-
* _.isNil(null);
|
|
255
|
-
* // => true
|
|
256
|
-
*
|
|
257
|
-
* _.isNil(void 0);
|
|
258
|
-
* // => true
|
|
259
|
-
*
|
|
260
|
-
* _.isNil(NaN);
|
|
261
|
-
* // => false
|
|
262
|
-
*/
|
|
263
|
-
function isNil(value) {
|
|
264
|
-
return value == null;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Checks if `value` is `undefined`.
|
|
269
|
-
*
|
|
270
|
-
* @static
|
|
271
|
-
* @since 0.1.0
|
|
272
|
-
* @memberOf _
|
|
273
|
-
* @category Lang
|
|
274
|
-
* @param {*} value The value to check.
|
|
275
|
-
* @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
|
|
276
|
-
* @example
|
|
277
|
-
*
|
|
278
|
-
* _.isUndefined(void 0);
|
|
279
|
-
* // => true
|
|
280
|
-
*
|
|
281
|
-
* _.isUndefined(null);
|
|
282
|
-
* // => false
|
|
283
|
-
*/
|
|
284
|
-
function isUndefined(value) {
|
|
285
|
-
return value === undefined;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
const isBoolean = (val) => typeof val === "boolean";
|
|
289
|
-
const isNumber = (val) => typeof val === "number";
|
|
290
|
-
const isElement = (e) => {
|
|
291
|
-
if (typeof Element === "undefined")
|
|
292
|
-
return false;
|
|
293
|
-
return e instanceof Element;
|
|
294
|
-
};
|
|
295
|
-
const isStringNumber = (val) => {
|
|
296
|
-
if (!isString(val)) {
|
|
297
|
-
return false;
|
|
298
|
-
}
|
|
299
|
-
return !Number.isNaN(Number(val));
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
class ElementPlusError extends Error {
|
|
303
|
-
constructor(m) {
|
|
304
|
-
super(m);
|
|
305
|
-
this.name = "ElementPlusError";
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
function debugWarn(scope, message) {
|
|
309
|
-
if (process.env.NODE_ENV !== "production") {
|
|
310
|
-
const error = isString(scope) ? new ElementPlusError(`[${scope}] ${message}`) : scope;
|
|
311
|
-
console.warn(error);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
const SCOPE = "utils/dom/style";
|
|
316
|
-
function addUnit(value, defaultUnit = "px") {
|
|
317
|
-
if (!value)
|
|
318
|
-
return "";
|
|
319
|
-
if (isNumber(value) || isStringNumber(value)) {
|
|
320
|
-
return `${value}${defaultUnit}`;
|
|
321
|
-
} else if (isString(value)) {
|
|
322
|
-
return value;
|
|
323
|
-
}
|
|
324
|
-
debugWarn(SCOPE, "binding value must be a string or number");
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
const epPropKey = "__epPropKey";
|
|
328
|
-
const definePropType = (val) => val;
|
|
329
|
-
const isEpProp = (val) => isObject(val) && !!val[epPropKey];
|
|
330
|
-
const buildProp = (prop, key) => {
|
|
331
|
-
if (!isObject(prop) || isEpProp(prop))
|
|
332
|
-
return prop;
|
|
333
|
-
const { values, required, default: defaultValue, type, validator } = prop;
|
|
334
|
-
const _validator = values || validator ? (val) => {
|
|
335
|
-
let valid = false;
|
|
336
|
-
let allowedValues = [];
|
|
337
|
-
if (values) {
|
|
338
|
-
allowedValues = Array.from(values);
|
|
339
|
-
if (hasOwn(prop, "default")) {
|
|
340
|
-
allowedValues.push(defaultValue);
|
|
341
|
-
}
|
|
342
|
-
valid || (valid = allowedValues.includes(val));
|
|
343
|
-
}
|
|
344
|
-
if (validator)
|
|
345
|
-
valid || (valid = validator(val));
|
|
346
|
-
if (!valid && allowedValues.length > 0) {
|
|
347
|
-
const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
|
|
348
|
-
warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
|
|
349
|
-
}
|
|
350
|
-
return valid;
|
|
351
|
-
} : void 0;
|
|
352
|
-
const epProp = {
|
|
353
|
-
type,
|
|
354
|
-
required: !!required,
|
|
355
|
-
validator: _validator,
|
|
356
|
-
[epPropKey]: true
|
|
357
|
-
};
|
|
358
|
-
if (hasOwn(prop, "default"))
|
|
359
|
-
epProp.default = defaultValue;
|
|
360
|
-
return epProp;
|
|
361
|
-
};
|
|
362
|
-
const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
|
|
363
|
-
key,
|
|
364
|
-
buildProp(option, key)
|
|
365
|
-
]));
|
|
366
|
-
|
|
367
|
-
const iconPropType = definePropType([
|
|
368
|
-
String,
|
|
369
|
-
Object,
|
|
370
|
-
Function
|
|
371
|
-
]);
|
|
372
|
-
|
|
373
|
-
const withInstall = (main, extra) => {
|
|
374
|
-
main.install = (app) => {
|
|
375
|
-
for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
|
|
376
|
-
app.component(comp.name, comp);
|
|
377
|
-
}
|
|
378
|
-
};
|
|
379
|
-
if (extra) {
|
|
380
|
-
for (const [key, comp] of Object.entries(extra)) {
|
|
381
|
-
main[key] = comp;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
return main;
|
|
385
|
-
};
|
|
386
|
-
const withInstallDirective = (directive, name) => {
|
|
387
|
-
directive.install = (app) => {
|
|
388
|
-
app.directive(name, directive);
|
|
389
|
-
};
|
|
390
|
-
return directive;
|
|
391
|
-
};
|
|
392
|
-
|
|
393
|
-
const EVENT_CODE = {
|
|
394
|
-
tab: "Tab",
|
|
395
|
-
enter: "Enter",
|
|
396
|
-
space: "Space",
|
|
397
|
-
left: "ArrowLeft",
|
|
398
|
-
up: "ArrowUp",
|
|
399
|
-
right: "ArrowRight",
|
|
400
|
-
down: "ArrowDown",
|
|
401
|
-
esc: "Escape",
|
|
402
|
-
delete: "Delete",
|
|
403
|
-
backspace: "Backspace",
|
|
404
|
-
numpadEnter: "NumpadEnter",
|
|
405
|
-
pageUp: "PageUp",
|
|
406
|
-
pageDown: "PageDown",
|
|
407
|
-
home: "Home",
|
|
408
|
-
end: "End"
|
|
409
|
-
};
|
|
410
|
-
|
|
411
|
-
const defaultNamespace = "el";
|
|
412
|
-
const statePrefix = "is-";
|
|
413
|
-
const _bem = (namespace, block, blockSuffix, element, modifier) => {
|
|
414
|
-
let cls = `${namespace}-${block}`;
|
|
415
|
-
if (blockSuffix) {
|
|
416
|
-
cls += `-${blockSuffix}`;
|
|
417
|
-
}
|
|
418
|
-
if (element) {
|
|
419
|
-
cls += `__${element}`;
|
|
420
|
-
}
|
|
421
|
-
if (modifier) {
|
|
422
|
-
cls += `--${modifier}`;
|
|
423
|
-
}
|
|
424
|
-
return cls;
|
|
425
|
-
};
|
|
426
|
-
const namespaceContextKey = Symbol("namespaceContextKey");
|
|
427
|
-
const useGetDerivedNamespace = (namespaceOverrides) => {
|
|
428
|
-
const derivedNamespace = namespaceOverrides || (getCurrentInstance() ? inject(namespaceContextKey, ref(defaultNamespace)) : ref(defaultNamespace));
|
|
429
|
-
const namespace = computed(() => {
|
|
430
|
-
return unref$1(derivedNamespace) || defaultNamespace;
|
|
431
|
-
});
|
|
432
|
-
return namespace;
|
|
433
|
-
};
|
|
434
|
-
const useNamespace = (block, namespaceOverrides) => {
|
|
435
|
-
const namespace = useGetDerivedNamespace(namespaceOverrides);
|
|
436
|
-
const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
|
|
437
|
-
const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
|
|
438
|
-
const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
|
|
439
|
-
const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
|
|
440
|
-
const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
|
|
441
|
-
const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
|
|
442
|
-
const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
|
|
443
|
-
const is = (name, ...args) => {
|
|
444
|
-
const state = args.length >= 1 ? args[0] : true;
|
|
445
|
-
return name && state ? `${statePrefix}${name}` : "";
|
|
446
|
-
};
|
|
447
|
-
const cssVar = (object) => {
|
|
448
|
-
const styles = {};
|
|
449
|
-
for (const key in object) {
|
|
450
|
-
if (object[key]) {
|
|
451
|
-
styles[`--${namespace.value}-${key}`] = object[key];
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
return styles;
|
|
455
|
-
};
|
|
456
|
-
const cssVarBlock = (object) => {
|
|
457
|
-
const styles = {};
|
|
458
|
-
for (const key in object) {
|
|
459
|
-
if (object[key]) {
|
|
460
|
-
styles[`--${namespace.value}-${block}-${key}`] = object[key];
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
return styles;
|
|
464
|
-
};
|
|
465
|
-
const cssVarName = (name) => `--${namespace.value}-${name}`;
|
|
466
|
-
const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
|
|
467
|
-
return {
|
|
468
|
-
namespace,
|
|
469
|
-
b,
|
|
470
|
-
e,
|
|
471
|
-
m,
|
|
472
|
-
be,
|
|
473
|
-
em,
|
|
474
|
-
bm,
|
|
475
|
-
bem,
|
|
476
|
-
is,
|
|
477
|
-
cssVar,
|
|
478
|
-
cssVarName,
|
|
479
|
-
cssVarBlock,
|
|
480
|
-
cssVarBlockName
|
|
481
|
-
};
|
|
482
|
-
};
|
|
483
|
-
|
|
484
|
-
const _prop = buildProp({
|
|
485
|
-
type: definePropType(Boolean),
|
|
486
|
-
default: null
|
|
487
|
-
});
|
|
488
|
-
const _event = buildProp({
|
|
489
|
-
type: definePropType(Function)
|
|
490
|
-
});
|
|
491
|
-
const createModelToggleComposable = (name) => {
|
|
492
|
-
const updateEventKey = `update:${name}`;
|
|
493
|
-
const updateEventKeyRaw = `onUpdate:${name}`;
|
|
494
|
-
const useModelToggleEmits2 = [updateEventKey];
|
|
495
|
-
const useModelToggleProps2 = {
|
|
496
|
-
[name]: _prop,
|
|
497
|
-
[updateEventKeyRaw]: _event
|
|
498
|
-
};
|
|
499
|
-
const useModelToggle2 = ({
|
|
500
|
-
indicator,
|
|
501
|
-
toggleReason,
|
|
502
|
-
shouldHideWhenRouteChanges,
|
|
503
|
-
shouldProceed,
|
|
504
|
-
onShow,
|
|
505
|
-
onHide
|
|
506
|
-
}) => {
|
|
507
|
-
const instance = getCurrentInstance();
|
|
508
|
-
const { emit } = instance;
|
|
509
|
-
const props = instance.props;
|
|
510
|
-
const hasUpdateHandler = computed(() => isFunction(props[updateEventKeyRaw]));
|
|
511
|
-
const isModelBindingAbsent = computed(() => props[name] === null);
|
|
512
|
-
const doShow = (event) => {
|
|
513
|
-
if (indicator.value === true) {
|
|
514
|
-
return;
|
|
515
|
-
}
|
|
516
|
-
indicator.value = true;
|
|
517
|
-
if (toggleReason) {
|
|
518
|
-
toggleReason.value = event;
|
|
519
|
-
}
|
|
520
|
-
if (isFunction(onShow)) {
|
|
521
|
-
onShow(event);
|
|
522
|
-
}
|
|
523
|
-
};
|
|
524
|
-
const doHide = (event) => {
|
|
525
|
-
if (indicator.value === false) {
|
|
526
|
-
return;
|
|
527
|
-
}
|
|
528
|
-
indicator.value = false;
|
|
529
|
-
if (toggleReason) {
|
|
530
|
-
toggleReason.value = event;
|
|
531
|
-
}
|
|
532
|
-
if (isFunction(onHide)) {
|
|
533
|
-
onHide(event);
|
|
534
|
-
}
|
|
535
|
-
};
|
|
536
|
-
const show = (event) => {
|
|
537
|
-
if (props.disabled === true || isFunction(shouldProceed) && !shouldProceed())
|
|
538
|
-
return;
|
|
539
|
-
const shouldEmit = hasUpdateHandler.value && isClient;
|
|
540
|
-
if (shouldEmit) {
|
|
541
|
-
emit(updateEventKey, true);
|
|
542
|
-
}
|
|
543
|
-
if (isModelBindingAbsent.value || !shouldEmit) {
|
|
544
|
-
doShow(event);
|
|
545
|
-
}
|
|
546
|
-
};
|
|
547
|
-
const hide = (event) => {
|
|
548
|
-
if (props.disabled === true || !isClient)
|
|
549
|
-
return;
|
|
550
|
-
const shouldEmit = hasUpdateHandler.value && isClient;
|
|
551
|
-
if (shouldEmit) {
|
|
552
|
-
emit(updateEventKey, false);
|
|
553
|
-
}
|
|
554
|
-
if (isModelBindingAbsent.value || !shouldEmit) {
|
|
555
|
-
doHide(event);
|
|
556
|
-
}
|
|
557
|
-
};
|
|
558
|
-
const onChange = (val) => {
|
|
559
|
-
if (!isBoolean(val))
|
|
560
|
-
return;
|
|
561
|
-
if (props.disabled && val) {
|
|
562
|
-
if (hasUpdateHandler.value) {
|
|
563
|
-
emit(updateEventKey, false);
|
|
564
|
-
}
|
|
565
|
-
} else if (indicator.value !== val) {
|
|
566
|
-
if (val) {
|
|
567
|
-
doShow();
|
|
568
|
-
} else {
|
|
569
|
-
doHide();
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
};
|
|
573
|
-
const toggle = () => {
|
|
574
|
-
if (indicator.value) {
|
|
575
|
-
hide();
|
|
576
|
-
} else {
|
|
577
|
-
show();
|
|
578
|
-
}
|
|
579
|
-
};
|
|
580
|
-
watch$1(() => props[name], onChange);
|
|
581
|
-
if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
|
|
582
|
-
watch$1(() => ({
|
|
583
|
-
...instance.proxy.$route
|
|
584
|
-
}), () => {
|
|
585
|
-
if (shouldHideWhenRouteChanges.value && indicator.value) {
|
|
586
|
-
hide();
|
|
587
|
-
}
|
|
588
|
-
});
|
|
589
|
-
}
|
|
590
|
-
onMounted(() => {
|
|
591
|
-
onChange(props[name]);
|
|
592
|
-
});
|
|
593
|
-
return {
|
|
594
|
-
hide,
|
|
595
|
-
show,
|
|
596
|
-
toggle,
|
|
597
|
-
hasUpdateHandler
|
|
598
|
-
};
|
|
599
|
-
};
|
|
600
|
-
return {
|
|
601
|
-
useModelToggle: useModelToggle2,
|
|
602
|
-
useModelToggleProps: useModelToggleProps2,
|
|
603
|
-
useModelToggleEmits: useModelToggleEmits2
|
|
604
|
-
};
|
|
605
|
-
};
|
|
606
|
-
createModelToggleComposable("modelValue");
|
|
607
|
-
|
|
608
|
-
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 !1;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===!1?i.removeAttribute(a):i.setAttribute(a,s===!0?"":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:!0,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=!1);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 !0;if(n&&Pe(n)){var r=e;do{if(r&&t.isSameNode(r))return !0;r=r.parentNode||r.host;}while(r)}return !1}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:!0,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===!0?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?!0:r,i=n.adaptive,a=i===void 0?!0:i,s=n.roundOffsets,f=s===void 0?!0: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:!1,roundOffsets:f})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement});}var Me={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Nt,data:{}},ye={passive:!0};function It(t){var e=t.state,n=t.instance,r=t.options,o=r.scroll,i=o===void 0?!0:o,a=r.resize,s=a===void 0?!0: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:!0,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?!1: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,strategy:"absolute",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?!0:o,a=n.altAxis,s=a===void 0?!0:a,f=n.fallbackPlacements,c=n.padding,u=n.boundary,m=n.rootBoundary,v=n.altBoundary,l=n.flipVariations,h=l===void 0?!0: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=!0,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=!1;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=!0,e.placement=A,e.reset=!0);}}var vt={name:"flip",enabled:!0,phase:"main",fn:Qt,requiresIfExists:["offset"],data:{_skip:!1}};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:!0}),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:!0,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:!0,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,strategy:"absolute",placement:e.placement});}var He={name:"popperOffsets",enabled:!0,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?!0:o,a=n.altAxis,s=a===void 0?!1:a,f=n.boundary,c=n.rootBoundary,u=n.altBoundary,m=n.padding,v=n.tether,l=v===void 0?!0: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:!0,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=!1);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,!0),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=!1,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=!1,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===!0){c.reset=!1,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=!0;}};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});
|
|
609
|
-
|
|
610
|
-
const usePopper = (referenceElementRef, popperElementRef, opts = {}) => {
|
|
611
|
-
const stateUpdater = {
|
|
612
|
-
name: "updateState",
|
|
613
|
-
enabled: true,
|
|
614
|
-
phase: "write",
|
|
615
|
-
fn: ({ state }) => {
|
|
616
|
-
const derivedState = deriveState(state);
|
|
617
|
-
Object.assign(states.value, derivedState);
|
|
618
|
-
},
|
|
619
|
-
requires: ["computeStyles"]
|
|
620
|
-
};
|
|
621
|
-
const options = computed(() => {
|
|
622
|
-
const { onFirstUpdate, placement, strategy, modifiers } = unref$1(opts);
|
|
623
|
-
return {
|
|
624
|
-
onFirstUpdate,
|
|
625
|
-
placement: placement || "bottom",
|
|
626
|
-
strategy: strategy || "absolute",
|
|
627
|
-
modifiers: [
|
|
628
|
-
...modifiers || [],
|
|
629
|
-
stateUpdater,
|
|
630
|
-
{ name: "applyStyles", enabled: false }
|
|
631
|
-
]
|
|
632
|
-
};
|
|
633
|
-
});
|
|
634
|
-
const instanceRef = shallowRef();
|
|
635
|
-
const states = ref({
|
|
636
|
-
styles: {
|
|
637
|
-
popper: {
|
|
638
|
-
position: unref$1(options).strategy,
|
|
639
|
-
left: "0",
|
|
640
|
-
top: "0"
|
|
641
|
-
},
|
|
642
|
-
arrow: {
|
|
643
|
-
position: "absolute"
|
|
644
|
-
}
|
|
645
|
-
},
|
|
646
|
-
attributes: {}
|
|
647
|
-
});
|
|
648
|
-
const destroy = () => {
|
|
649
|
-
if (!instanceRef.value)
|
|
650
|
-
return;
|
|
651
|
-
instanceRef.value.destroy();
|
|
652
|
-
instanceRef.value = void 0;
|
|
653
|
-
};
|
|
654
|
-
watch$1(options, (newOptions) => {
|
|
655
|
-
const instance = unref$1(instanceRef);
|
|
656
|
-
if (instance) {
|
|
657
|
-
instance.setOptions(newOptions);
|
|
658
|
-
}
|
|
659
|
-
}, {
|
|
660
|
-
deep: true
|
|
661
|
-
});
|
|
662
|
-
watch$1([referenceElementRef, popperElementRef], ([referenceElement, popperElement]) => {
|
|
663
|
-
destroy();
|
|
664
|
-
if (!referenceElement || !popperElement)
|
|
665
|
-
return;
|
|
666
|
-
instanceRef.value = yn(referenceElement, popperElement, unref$1(options));
|
|
667
|
-
});
|
|
668
|
-
onBeforeUnmount(() => {
|
|
669
|
-
destroy();
|
|
670
|
-
});
|
|
671
|
-
return {
|
|
672
|
-
state: computed(() => {
|
|
673
|
-
var _a;
|
|
674
|
-
return { ...((_a = unref$1(instanceRef)) == null ? void 0 : _a.state) || {} };
|
|
675
|
-
}),
|
|
676
|
-
styles: computed(() => unref$1(states).styles),
|
|
677
|
-
attributes: computed(() => unref$1(states).attributes),
|
|
678
|
-
update: () => {
|
|
679
|
-
var _a;
|
|
680
|
-
return (_a = unref$1(instanceRef)) == null ? void 0 : _a.update();
|
|
681
|
-
},
|
|
682
|
-
forceUpdate: () => {
|
|
683
|
-
var _a;
|
|
684
|
-
return (_a = unref$1(instanceRef)) == null ? void 0 : _a.forceUpdate();
|
|
685
|
-
},
|
|
686
|
-
instanceRef: computed(() => unref$1(instanceRef))
|
|
687
|
-
};
|
|
688
|
-
};
|
|
689
|
-
function deriveState(state) {
|
|
690
|
-
const elements = Object.keys(state.elements);
|
|
691
|
-
const styles = fromPairs(elements.map((element) => [element, state.styles[element] || {}]));
|
|
692
|
-
const attributes = fromPairs(elements.map((element) => [element, state.attributes[element]]));
|
|
693
|
-
return {
|
|
694
|
-
styles,
|
|
695
|
-
attributes
|
|
696
|
-
};
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
function useTimeout() {
|
|
700
|
-
let timeoutHandle;
|
|
701
|
-
const registerTimeout = (fn, delay) => {
|
|
702
|
-
cancelTimeout();
|
|
703
|
-
timeoutHandle = window.setTimeout(fn, delay);
|
|
704
|
-
};
|
|
705
|
-
const cancelTimeout = () => window.clearTimeout(timeoutHandle);
|
|
706
|
-
tryOnScopeDispose(() => cancelTimeout());
|
|
707
|
-
return {
|
|
708
|
-
registerTimeout,
|
|
709
|
-
cancelTimeout
|
|
710
|
-
};
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
const defaultIdInjection = {
|
|
714
|
-
prefix: Math.floor(Math.random() * 1e4),
|
|
715
|
-
current: 0
|
|
716
|
-
};
|
|
717
|
-
const ID_INJECTION_KEY = Symbol("elIdInjection");
|
|
718
|
-
const useIdInjection = () => {
|
|
719
|
-
return getCurrentInstance() ? inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
|
|
720
|
-
};
|
|
721
|
-
const useId = (deterministicId) => {
|
|
722
|
-
const idInjection = useIdInjection();
|
|
723
|
-
if (!isClient && idInjection === defaultIdInjection) {
|
|
724
|
-
debugWarn("IdInjection", `Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed
|
|
725
|
-
usage: app.provide(ID_INJECTION_KEY, {
|
|
726
|
-
prefix: number,
|
|
727
|
-
current: number,
|
|
728
|
-
})`);
|
|
729
|
-
}
|
|
730
|
-
const namespace = useGetDerivedNamespace();
|
|
731
|
-
const idRef = computed(() => unref$1(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
|
|
732
|
-
return idRef;
|
|
733
|
-
};
|
|
734
|
-
|
|
735
|
-
let registeredEscapeHandlers = [];
|
|
736
|
-
const cachedHandler = (e) => {
|
|
737
|
-
const event = e;
|
|
738
|
-
if (event.key === EVENT_CODE.esc) {
|
|
739
|
-
registeredEscapeHandlers.forEach((registeredHandler) => registeredHandler(event));
|
|
740
|
-
}
|
|
741
|
-
};
|
|
742
|
-
const useEscapeKeydown = (handler) => {
|
|
743
|
-
onMounted(() => {
|
|
744
|
-
if (registeredEscapeHandlers.length === 0) {
|
|
745
|
-
document.addEventListener("keydown", cachedHandler);
|
|
746
|
-
}
|
|
747
|
-
if (isClient)
|
|
748
|
-
registeredEscapeHandlers.push(handler);
|
|
749
|
-
});
|
|
750
|
-
onBeforeUnmount(() => {
|
|
751
|
-
registeredEscapeHandlers = registeredEscapeHandlers.filter((registeredHandler) => registeredHandler !== handler);
|
|
752
|
-
if (registeredEscapeHandlers.length === 0) {
|
|
753
|
-
if (isClient)
|
|
754
|
-
document.removeEventListener("keydown", cachedHandler);
|
|
755
|
-
}
|
|
756
|
-
});
|
|
757
|
-
};
|
|
758
|
-
|
|
759
|
-
let cachedContainer;
|
|
760
|
-
const usePopperContainerId = () => {
|
|
761
|
-
const namespace = useGetDerivedNamespace();
|
|
762
|
-
const idInjection = useIdInjection();
|
|
763
|
-
const id = computed(() => {
|
|
764
|
-
return `${namespace.value}-popper-container-${idInjection.prefix}`;
|
|
765
|
-
});
|
|
766
|
-
const selector = computed(() => `#${id.value}`);
|
|
767
|
-
return {
|
|
768
|
-
id,
|
|
769
|
-
selector
|
|
770
|
-
};
|
|
771
|
-
};
|
|
772
|
-
const createContainer = (id) => {
|
|
773
|
-
const container = document.createElement("div");
|
|
774
|
-
container.id = id;
|
|
775
|
-
document.body.appendChild(container);
|
|
776
|
-
return container;
|
|
777
|
-
};
|
|
778
|
-
const usePopperContainer = () => {
|
|
779
|
-
const { id, selector } = usePopperContainerId();
|
|
780
|
-
onBeforeMount(() => {
|
|
781
|
-
if (!isClient)
|
|
782
|
-
return;
|
|
783
|
-
if (process.env.NODE_ENV === "test" || !cachedContainer && !document.body.querySelector(selector.value)) {
|
|
784
|
-
cachedContainer = createContainer(id.value);
|
|
785
|
-
}
|
|
786
|
-
});
|
|
787
|
-
return {
|
|
788
|
-
id,
|
|
789
|
-
selector
|
|
790
|
-
};
|
|
791
|
-
};
|
|
792
|
-
|
|
793
|
-
const useDelayedToggleProps = buildProps({
|
|
794
|
-
showAfter: {
|
|
795
|
-
type: Number,
|
|
796
|
-
default: 0
|
|
797
|
-
},
|
|
798
|
-
hideAfter: {
|
|
799
|
-
type: Number,
|
|
800
|
-
default: 200
|
|
801
|
-
},
|
|
802
|
-
autoClose: {
|
|
803
|
-
type: Number,
|
|
804
|
-
default: 0
|
|
805
|
-
}
|
|
806
|
-
});
|
|
807
|
-
const useDelayedToggle = ({
|
|
808
|
-
showAfter,
|
|
809
|
-
hideAfter,
|
|
810
|
-
autoClose,
|
|
811
|
-
open,
|
|
812
|
-
close
|
|
813
|
-
}) => {
|
|
814
|
-
const { registerTimeout } = useTimeout();
|
|
815
|
-
const {
|
|
816
|
-
registerTimeout: registerTimeoutForAutoClose,
|
|
817
|
-
cancelTimeout: cancelTimeoutForAutoClose
|
|
818
|
-
} = useTimeout();
|
|
819
|
-
const onOpen = (event) => {
|
|
820
|
-
registerTimeout(() => {
|
|
821
|
-
open(event);
|
|
822
|
-
const _autoClose = unref$1(autoClose);
|
|
823
|
-
if (isNumber(_autoClose) && _autoClose > 0) {
|
|
824
|
-
registerTimeoutForAutoClose(() => {
|
|
825
|
-
close(event);
|
|
826
|
-
}, _autoClose);
|
|
827
|
-
}
|
|
828
|
-
}, unref$1(showAfter));
|
|
829
|
-
};
|
|
830
|
-
const onClose = (event) => {
|
|
831
|
-
cancelTimeoutForAutoClose();
|
|
832
|
-
registerTimeout(() => {
|
|
833
|
-
close(event);
|
|
834
|
-
}, unref$1(hideAfter));
|
|
835
|
-
};
|
|
836
|
-
return {
|
|
837
|
-
onOpen,
|
|
838
|
-
onClose
|
|
839
|
-
};
|
|
840
|
-
};
|
|
841
|
-
|
|
842
|
-
const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
|
|
843
|
-
const useForwardRef = (forwardRef) => {
|
|
844
|
-
const setForwardRef = (el) => {
|
|
845
|
-
forwardRef.value = el;
|
|
846
|
-
};
|
|
847
|
-
provide(FORWARD_REF_INJECTION_KEY, {
|
|
848
|
-
setForwardRef
|
|
849
|
-
});
|
|
850
|
-
};
|
|
851
|
-
const useForwardRefDirective = (setForwardRef) => {
|
|
852
|
-
return {
|
|
853
|
-
mounted(el) {
|
|
854
|
-
setForwardRef(el);
|
|
855
|
-
},
|
|
856
|
-
updated(el) {
|
|
857
|
-
setForwardRef(el);
|
|
858
|
-
},
|
|
859
|
-
unmounted() {
|
|
860
|
-
setForwardRef(null);
|
|
861
|
-
}
|
|
862
|
-
};
|
|
863
|
-
};
|
|
864
|
-
|
|
865
|
-
const zIndex = ref(0);
|
|
866
|
-
const defaultInitialZIndex = 2e3;
|
|
867
|
-
const zIndexContextKey = Symbol("zIndexContextKey");
|
|
868
|
-
const useZIndex = (zIndexOverrides) => {
|
|
869
|
-
const zIndexInjection = zIndexOverrides || (getCurrentInstance() ? inject(zIndexContextKey, void 0) : void 0);
|
|
870
|
-
const initialZIndex = computed(() => {
|
|
871
|
-
const zIndexFromInjection = unref$1(zIndexInjection);
|
|
872
|
-
return isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
|
|
873
|
-
});
|
|
874
|
-
const currentZIndex = computed(() => initialZIndex.value + zIndex.value);
|
|
875
|
-
const nextZIndex = () => {
|
|
876
|
-
zIndex.value++;
|
|
877
|
-
return currentZIndex.value;
|
|
878
|
-
};
|
|
879
|
-
return {
|
|
880
|
-
initialZIndex,
|
|
881
|
-
currentZIndex,
|
|
882
|
-
nextZIndex
|
|
883
|
-
};
|
|
884
|
-
};
|
|
885
|
-
|
|
886
|
-
var _export_sfc$1 = (sfc, props) => {
|
|
887
|
-
const target = sfc.__vccOpts || sfc;
|
|
888
|
-
for (const [key, val] of props) {
|
|
889
|
-
target[key] = val;
|
|
890
|
-
}
|
|
891
|
-
return target;
|
|
892
|
-
};
|
|
893
|
-
|
|
894
|
-
const formItemContextKey = Symbol("formItemContextKey");
|
|
895
|
-
|
|
896
|
-
const POPPER_INJECTION_KEY = Symbol("popper");
|
|
897
|
-
const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
|
|
898
|
-
|
|
899
|
-
const roleTypes = [
|
|
900
|
-
"dialog",
|
|
901
|
-
"grid",
|
|
902
|
-
"group",
|
|
903
|
-
"listbox",
|
|
904
|
-
"menu",
|
|
905
|
-
"navigation",
|
|
906
|
-
"tooltip",
|
|
907
|
-
"tree"
|
|
908
|
-
];
|
|
909
|
-
const popperProps = buildProps({
|
|
910
|
-
role: {
|
|
911
|
-
type: String,
|
|
912
|
-
values: roleTypes,
|
|
913
|
-
default: "tooltip"
|
|
914
|
-
}
|
|
915
|
-
});
|
|
916
|
-
|
|
917
|
-
const __default__$7 = defineComponent({
|
|
918
|
-
name: "ElPopper",
|
|
919
|
-
inheritAttrs: false
|
|
920
|
-
});
|
|
921
|
-
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
922
|
-
...__default__$7,
|
|
923
|
-
props: popperProps,
|
|
924
|
-
setup(__props, { expose }) {
|
|
925
|
-
const props = __props;
|
|
926
|
-
const triggerRef = ref();
|
|
927
|
-
const popperInstanceRef = ref();
|
|
928
|
-
const contentRef = ref();
|
|
929
|
-
const referenceRef = ref();
|
|
930
|
-
const role = computed(() => props.role);
|
|
931
|
-
const popperProvides = {
|
|
932
|
-
triggerRef,
|
|
933
|
-
popperInstanceRef,
|
|
934
|
-
contentRef,
|
|
935
|
-
referenceRef,
|
|
936
|
-
role
|
|
937
|
-
};
|
|
938
|
-
expose(popperProvides);
|
|
939
|
-
provide(POPPER_INJECTION_KEY, popperProvides);
|
|
940
|
-
return (_ctx, _cache) => {
|
|
941
|
-
return renderSlot(_ctx.$slots, "default");
|
|
942
|
-
};
|
|
943
|
-
}
|
|
944
|
-
});
|
|
945
|
-
var Popper = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/popper.vue"]]);
|
|
946
|
-
|
|
947
|
-
const popperArrowProps = buildProps({
|
|
948
|
-
arrowOffset: {
|
|
949
|
-
type: Number,
|
|
950
|
-
default: 5
|
|
951
|
-
}
|
|
952
|
-
});
|
|
953
|
-
|
|
954
|
-
const __default__$6 = defineComponent({
|
|
955
|
-
name: "ElPopperArrow",
|
|
956
|
-
inheritAttrs: false
|
|
957
|
-
});
|
|
958
|
-
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
959
|
-
...__default__$6,
|
|
960
|
-
props: popperArrowProps,
|
|
961
|
-
setup(__props, { expose }) {
|
|
962
|
-
const props = __props;
|
|
963
|
-
const ns = useNamespace("popper");
|
|
964
|
-
const { arrowOffset, arrowRef, arrowStyle } = inject(POPPER_CONTENT_INJECTION_KEY, void 0);
|
|
965
|
-
watch$1(() => props.arrowOffset, (val) => {
|
|
966
|
-
arrowOffset.value = val;
|
|
967
|
-
});
|
|
968
|
-
onBeforeUnmount(() => {
|
|
969
|
-
arrowRef.value = void 0;
|
|
970
|
-
});
|
|
971
|
-
expose({
|
|
972
|
-
arrowRef
|
|
973
|
-
});
|
|
974
|
-
return (_ctx, _cache) => {
|
|
975
|
-
return openBlock(), createElementBlock("span", {
|
|
976
|
-
ref_key: "arrowRef",
|
|
977
|
-
ref: arrowRef,
|
|
978
|
-
class: normalizeClass(unref$1(ns).e("arrow")),
|
|
979
|
-
style: normalizeStyle(unref$1(arrowStyle)),
|
|
980
|
-
"data-popper-arrow": ""
|
|
981
|
-
}, null, 6);
|
|
982
|
-
};
|
|
983
|
-
}
|
|
984
|
-
});
|
|
985
|
-
var ElPopperArrow = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/arrow.vue"]]);
|
|
986
|
-
|
|
987
|
-
const NAME = "ElOnlyChild";
|
|
988
|
-
const OnlyChild = defineComponent({
|
|
989
|
-
name: NAME,
|
|
990
|
-
setup(_, {
|
|
991
|
-
slots,
|
|
992
|
-
attrs
|
|
993
|
-
}) {
|
|
994
|
-
var _a;
|
|
995
|
-
const forwardRefInjection = inject(FORWARD_REF_INJECTION_KEY);
|
|
996
|
-
const forwardRefDirective = useForwardRefDirective((_a = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a : NOOP);
|
|
997
|
-
return () => {
|
|
998
|
-
var _a2;
|
|
999
|
-
const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots, attrs);
|
|
1000
|
-
if (!defaultSlot)
|
|
1001
|
-
return null;
|
|
1002
|
-
if (defaultSlot.length > 1) {
|
|
1003
|
-
debugWarn(NAME, "requires exact only one valid child.");
|
|
1004
|
-
return null;
|
|
1005
|
-
}
|
|
1006
|
-
const firstLegitNode = findFirstLegitChild(defaultSlot);
|
|
1007
|
-
if (!firstLegitNode) {
|
|
1008
|
-
debugWarn(NAME, "no valid child node found");
|
|
1009
|
-
return null;
|
|
1010
|
-
}
|
|
1011
|
-
return withDirectives(cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
|
|
1012
|
-
};
|
|
1013
|
-
}
|
|
1014
|
-
});
|
|
1015
|
-
function findFirstLegitChild(node) {
|
|
1016
|
-
if (!node)
|
|
1017
|
-
return null;
|
|
1018
|
-
const children = node;
|
|
1019
|
-
for (const child of children) {
|
|
1020
|
-
if (isObject(child)) {
|
|
1021
|
-
switch (child.type) {
|
|
1022
|
-
case Comment:
|
|
1023
|
-
continue;
|
|
1024
|
-
case Text:
|
|
1025
|
-
case "svg":
|
|
1026
|
-
return wrapTextContent(child);
|
|
1027
|
-
case Fragment:
|
|
1028
|
-
return findFirstLegitChild(child.children);
|
|
1029
|
-
default:
|
|
1030
|
-
return child;
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
return wrapTextContent(child);
|
|
1034
|
-
}
|
|
1035
|
-
return null;
|
|
1036
|
-
}
|
|
1037
|
-
function wrapTextContent(s) {
|
|
1038
|
-
const ns = useNamespace("only-child");
|
|
1039
|
-
return createVNode("span", {
|
|
1040
|
-
"class": ns.e("content")
|
|
1041
|
-
}, [s]);
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
const popperTriggerProps = buildProps({
|
|
1045
|
-
virtualRef: {
|
|
1046
|
-
type: definePropType(Object)
|
|
1047
|
-
},
|
|
1048
|
-
virtualTriggering: Boolean,
|
|
1049
|
-
onMouseenter: {
|
|
1050
|
-
type: definePropType(Function)
|
|
1051
|
-
},
|
|
1052
|
-
onMouseleave: {
|
|
1053
|
-
type: definePropType(Function)
|
|
1054
|
-
},
|
|
1055
|
-
onClick: {
|
|
1056
|
-
type: definePropType(Function)
|
|
1057
|
-
},
|
|
1058
|
-
onKeydown: {
|
|
1059
|
-
type: definePropType(Function)
|
|
1060
|
-
},
|
|
1061
|
-
onFocus: {
|
|
1062
|
-
type: definePropType(Function)
|
|
1063
|
-
},
|
|
1064
|
-
onBlur: {
|
|
1065
|
-
type: definePropType(Function)
|
|
1066
|
-
},
|
|
1067
|
-
onContextmenu: {
|
|
1068
|
-
type: definePropType(Function)
|
|
1069
|
-
},
|
|
1070
|
-
id: String,
|
|
1071
|
-
open: Boolean
|
|
1072
|
-
});
|
|
1073
|
-
|
|
1074
|
-
const __default__$5 = defineComponent({
|
|
1075
|
-
name: "ElPopperTrigger",
|
|
1076
|
-
inheritAttrs: false
|
|
1077
|
-
});
|
|
1078
|
-
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
1079
|
-
...__default__$5,
|
|
1080
|
-
props: popperTriggerProps,
|
|
1081
|
-
setup(__props, { expose }) {
|
|
1082
|
-
const props = __props;
|
|
1083
|
-
const { role, triggerRef } = inject(POPPER_INJECTION_KEY, void 0);
|
|
1084
|
-
useForwardRef(triggerRef);
|
|
1085
|
-
const ariaControls = computed(() => {
|
|
1086
|
-
return ariaHaspopup.value ? props.id : void 0;
|
|
1087
|
-
});
|
|
1088
|
-
const ariaDescribedby = computed(() => {
|
|
1089
|
-
if (role && role.value === "tooltip") {
|
|
1090
|
-
return props.open && props.id ? props.id : void 0;
|
|
1091
|
-
}
|
|
1092
|
-
return void 0;
|
|
1093
|
-
});
|
|
1094
|
-
const ariaHaspopup = computed(() => {
|
|
1095
|
-
if (role && role.value !== "tooltip") {
|
|
1096
|
-
return role.value;
|
|
1097
|
-
}
|
|
1098
|
-
return void 0;
|
|
1099
|
-
});
|
|
1100
|
-
const ariaExpanded = computed(() => {
|
|
1101
|
-
return ariaHaspopup.value ? `${props.open}` : void 0;
|
|
1102
|
-
});
|
|
1103
|
-
let virtualTriggerAriaStopWatch = void 0;
|
|
1104
|
-
onMounted(() => {
|
|
1105
|
-
watch$1(() => props.virtualRef, (virtualEl) => {
|
|
1106
|
-
if (virtualEl) {
|
|
1107
|
-
triggerRef.value = unrefElement(virtualEl);
|
|
1108
|
-
}
|
|
1109
|
-
}, {
|
|
1110
|
-
immediate: true
|
|
1111
|
-
});
|
|
1112
|
-
watch$1(triggerRef, (el, prevEl) => {
|
|
1113
|
-
virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
|
|
1114
|
-
virtualTriggerAriaStopWatch = void 0;
|
|
1115
|
-
if (isElement(el)) {
|
|
1116
|
-
[
|
|
1117
|
-
"onMouseenter",
|
|
1118
|
-
"onMouseleave",
|
|
1119
|
-
"onClick",
|
|
1120
|
-
"onKeydown",
|
|
1121
|
-
"onFocus",
|
|
1122
|
-
"onBlur",
|
|
1123
|
-
"onContextmenu"
|
|
1124
|
-
].forEach((eventName) => {
|
|
1125
|
-
var _a;
|
|
1126
|
-
const handler = props[eventName];
|
|
1127
|
-
if (handler) {
|
|
1128
|
-
el.addEventListener(eventName.slice(2).toLowerCase(), handler);
|
|
1129
|
-
(_a = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a.call(prevEl, eventName.slice(2).toLowerCase(), handler);
|
|
1130
|
-
}
|
|
1131
|
-
});
|
|
1132
|
-
virtualTriggerAriaStopWatch = watch$1([ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded], (watches) => {
|
|
1133
|
-
[
|
|
1134
|
-
"aria-controls",
|
|
1135
|
-
"aria-describedby",
|
|
1136
|
-
"aria-haspopup",
|
|
1137
|
-
"aria-expanded"
|
|
1138
|
-
].forEach((key, idx) => {
|
|
1139
|
-
isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
|
|
1140
|
-
});
|
|
1141
|
-
}, { immediate: true });
|
|
1142
|
-
}
|
|
1143
|
-
if (isElement(prevEl)) {
|
|
1144
|
-
[
|
|
1145
|
-
"aria-controls",
|
|
1146
|
-
"aria-describedby",
|
|
1147
|
-
"aria-haspopup",
|
|
1148
|
-
"aria-expanded"
|
|
1149
|
-
].forEach((key) => prevEl.removeAttribute(key));
|
|
1150
|
-
}
|
|
1151
|
-
}, {
|
|
1152
|
-
immediate: true
|
|
1153
|
-
});
|
|
1154
|
-
});
|
|
1155
|
-
onBeforeUnmount(() => {
|
|
1156
|
-
virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
|
|
1157
|
-
virtualTriggerAriaStopWatch = void 0;
|
|
1158
|
-
});
|
|
1159
|
-
expose({
|
|
1160
|
-
triggerRef
|
|
1161
|
-
});
|
|
1162
|
-
return (_ctx, _cache) => {
|
|
1163
|
-
return !_ctx.virtualTriggering ? (openBlock(), createBlock(unref$1(OnlyChild), mergeProps({ key: 0 }, _ctx.$attrs, {
|
|
1164
|
-
"aria-controls": unref$1(ariaControls),
|
|
1165
|
-
"aria-describedby": unref$1(ariaDescribedby),
|
|
1166
|
-
"aria-expanded": unref$1(ariaExpanded),
|
|
1167
|
-
"aria-haspopup": unref$1(ariaHaspopup)
|
|
1168
|
-
}), {
|
|
1169
|
-
default: withCtx(() => [
|
|
1170
|
-
renderSlot(_ctx.$slots, "default")
|
|
1171
|
-
]),
|
|
1172
|
-
_: 3
|
|
1173
|
-
}, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : createCommentVNode("v-if", true);
|
|
1174
|
-
};
|
|
1175
|
-
}
|
|
1176
|
-
});
|
|
1177
|
-
var ElPopperTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/trigger.vue"]]);
|
|
1178
|
-
|
|
1179
|
-
const FOCUS_AFTER_TRAPPED = "focus-trap.focus-after-trapped";
|
|
1180
|
-
const FOCUS_AFTER_RELEASED = "focus-trap.focus-after-released";
|
|
1181
|
-
const FOCUSOUT_PREVENTED = "focus-trap.focusout-prevented";
|
|
1182
|
-
const FOCUS_AFTER_TRAPPED_OPTS = {
|
|
1183
|
-
cancelable: true,
|
|
1184
|
-
bubbles: false
|
|
1185
|
-
};
|
|
1186
|
-
const FOCUSOUT_PREVENTED_OPTS = {
|
|
1187
|
-
cancelable: true,
|
|
1188
|
-
bubbles: false
|
|
1189
|
-
};
|
|
1190
|
-
const ON_TRAP_FOCUS_EVT = "focusAfterTrapped";
|
|
1191
|
-
const ON_RELEASE_FOCUS_EVT = "focusAfterReleased";
|
|
1192
|
-
const FOCUS_TRAP_INJECTION_KEY = Symbol("elFocusTrap");
|
|
1193
|
-
|
|
1194
|
-
const focusReason = ref();
|
|
1195
|
-
const lastUserFocusTimestamp = ref(0);
|
|
1196
|
-
const lastAutomatedFocusTimestamp = ref(0);
|
|
1197
|
-
let focusReasonUserCount = 0;
|
|
1198
|
-
const obtainAllFocusableElements = (element) => {
|
|
1199
|
-
const nodes = [];
|
|
1200
|
-
const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, {
|
|
1201
|
-
acceptNode: (node) => {
|
|
1202
|
-
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
|
1203
|
-
if (node.disabled || node.hidden || isHiddenInput)
|
|
1204
|
-
return NodeFilter.FILTER_SKIP;
|
|
1205
|
-
return node.tabIndex >= 0 || node === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
1206
|
-
}
|
|
1207
|
-
});
|
|
1208
|
-
while (walker.nextNode())
|
|
1209
|
-
nodes.push(walker.currentNode);
|
|
1210
|
-
return nodes;
|
|
1211
|
-
};
|
|
1212
|
-
const getVisibleElement = (elements, container) => {
|
|
1213
|
-
for (const element of elements) {
|
|
1214
|
-
if (!isHidden(element, container))
|
|
1215
|
-
return element;
|
|
1216
|
-
}
|
|
1217
|
-
};
|
|
1218
|
-
const isHidden = (element, container) => {
|
|
1219
|
-
if (process.env.NODE_ENV === "test")
|
|
1220
|
-
return false;
|
|
1221
|
-
if (getComputedStyle(element).visibility === "hidden")
|
|
1222
|
-
return true;
|
|
1223
|
-
while (element) {
|
|
1224
|
-
if (container && element === container)
|
|
1225
|
-
return false;
|
|
1226
|
-
if (getComputedStyle(element).display === "none")
|
|
1227
|
-
return true;
|
|
1228
|
-
element = element.parentElement;
|
|
1229
|
-
}
|
|
1230
|
-
return false;
|
|
1231
|
-
};
|
|
1232
|
-
const getEdges = (container) => {
|
|
1233
|
-
const focusable = obtainAllFocusableElements(container);
|
|
1234
|
-
const first = getVisibleElement(focusable, container);
|
|
1235
|
-
const last = getVisibleElement(focusable.reverse(), container);
|
|
1236
|
-
return [first, last];
|
|
1237
|
-
};
|
|
1238
|
-
const isSelectable = (element) => {
|
|
1239
|
-
return element instanceof HTMLInputElement && "select" in element;
|
|
1240
|
-
};
|
|
1241
|
-
const tryFocus = (element, shouldSelect) => {
|
|
1242
|
-
if (element && element.focus) {
|
|
1243
|
-
const prevFocusedElement = document.activeElement;
|
|
1244
|
-
element.focus({ preventScroll: true });
|
|
1245
|
-
lastAutomatedFocusTimestamp.value = window.performance.now();
|
|
1246
|
-
if (element !== prevFocusedElement && isSelectable(element) && shouldSelect) {
|
|
1247
|
-
element.select();
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
};
|
|
1251
|
-
function removeFromStack(list, item) {
|
|
1252
|
-
const copy = [...list];
|
|
1253
|
-
const idx = list.indexOf(item);
|
|
1254
|
-
if (idx !== -1) {
|
|
1255
|
-
copy.splice(idx, 1);
|
|
1256
|
-
}
|
|
1257
|
-
return copy;
|
|
1258
|
-
}
|
|
1259
|
-
const createFocusableStack = () => {
|
|
1260
|
-
let stack = [];
|
|
1261
|
-
const push = (layer) => {
|
|
1262
|
-
const currentLayer = stack[0];
|
|
1263
|
-
if (currentLayer && layer !== currentLayer) {
|
|
1264
|
-
currentLayer.pause();
|
|
1265
|
-
}
|
|
1266
|
-
stack = removeFromStack(stack, layer);
|
|
1267
|
-
stack.unshift(layer);
|
|
1268
|
-
};
|
|
1269
|
-
const remove = (layer) => {
|
|
1270
|
-
var _a, _b;
|
|
1271
|
-
stack = removeFromStack(stack, layer);
|
|
1272
|
-
(_b = (_a = stack[0]) == null ? void 0 : _a.resume) == null ? void 0 : _b.call(_a);
|
|
1273
|
-
};
|
|
1274
|
-
return {
|
|
1275
|
-
push,
|
|
1276
|
-
remove
|
|
1277
|
-
};
|
|
1278
|
-
};
|
|
1279
|
-
const focusFirstDescendant = (elements, shouldSelect = false) => {
|
|
1280
|
-
const prevFocusedElement = document.activeElement;
|
|
1281
|
-
for (const element of elements) {
|
|
1282
|
-
tryFocus(element, shouldSelect);
|
|
1283
|
-
if (document.activeElement !== prevFocusedElement)
|
|
1284
|
-
return;
|
|
1285
|
-
}
|
|
1286
|
-
};
|
|
1287
|
-
const focusableStack = createFocusableStack();
|
|
1288
|
-
const isFocusCausedByUserEvent = () => {
|
|
1289
|
-
return lastUserFocusTimestamp.value > lastAutomatedFocusTimestamp.value;
|
|
1290
|
-
};
|
|
1291
|
-
const notifyFocusReasonPointer = () => {
|
|
1292
|
-
focusReason.value = "pointer";
|
|
1293
|
-
lastUserFocusTimestamp.value = window.performance.now();
|
|
1294
|
-
};
|
|
1295
|
-
const notifyFocusReasonKeydown = () => {
|
|
1296
|
-
focusReason.value = "keyboard";
|
|
1297
|
-
lastUserFocusTimestamp.value = window.performance.now();
|
|
1298
|
-
};
|
|
1299
|
-
const useFocusReason = () => {
|
|
1300
|
-
onMounted(() => {
|
|
1301
|
-
if (focusReasonUserCount === 0) {
|
|
1302
|
-
document.addEventListener("mousedown", notifyFocusReasonPointer);
|
|
1303
|
-
document.addEventListener("touchstart", notifyFocusReasonPointer);
|
|
1304
|
-
document.addEventListener("keydown", notifyFocusReasonKeydown);
|
|
1305
|
-
}
|
|
1306
|
-
focusReasonUserCount++;
|
|
1307
|
-
});
|
|
1308
|
-
onBeforeUnmount(() => {
|
|
1309
|
-
focusReasonUserCount--;
|
|
1310
|
-
if (focusReasonUserCount <= 0) {
|
|
1311
|
-
document.removeEventListener("mousedown", notifyFocusReasonPointer);
|
|
1312
|
-
document.removeEventListener("touchstart", notifyFocusReasonPointer);
|
|
1313
|
-
document.removeEventListener("keydown", notifyFocusReasonKeydown);
|
|
1314
|
-
}
|
|
1315
|
-
});
|
|
1316
|
-
return {
|
|
1317
|
-
focusReason,
|
|
1318
|
-
lastUserFocusTimestamp,
|
|
1319
|
-
lastAutomatedFocusTimestamp
|
|
1320
|
-
};
|
|
1321
|
-
};
|
|
1322
|
-
const createFocusOutPreventedEvent = (detail) => {
|
|
1323
|
-
return new CustomEvent(FOCUSOUT_PREVENTED, {
|
|
1324
|
-
...FOCUSOUT_PREVENTED_OPTS,
|
|
1325
|
-
detail
|
|
1326
|
-
});
|
|
1327
|
-
};
|
|
1328
|
-
|
|
1329
|
-
const _sfc_main$8 = defineComponent({
|
|
1330
|
-
name: "ElFocusTrap",
|
|
1331
|
-
inheritAttrs: false,
|
|
1332
|
-
props: {
|
|
1333
|
-
loop: Boolean,
|
|
1334
|
-
trapped: Boolean,
|
|
1335
|
-
focusTrapEl: Object,
|
|
1336
|
-
focusStartEl: {
|
|
1337
|
-
type: [Object, String],
|
|
1338
|
-
default: "first"
|
|
1339
|
-
}
|
|
1340
|
-
},
|
|
1341
|
-
emits: [
|
|
1342
|
-
ON_TRAP_FOCUS_EVT,
|
|
1343
|
-
ON_RELEASE_FOCUS_EVT,
|
|
1344
|
-
"focusin",
|
|
1345
|
-
"focusout",
|
|
1346
|
-
"focusout-prevented",
|
|
1347
|
-
"release-requested"
|
|
1348
|
-
],
|
|
1349
|
-
setup(props, { emit }) {
|
|
1350
|
-
const forwardRef = ref();
|
|
1351
|
-
let lastFocusBeforeTrapped;
|
|
1352
|
-
let lastFocusAfterTrapped;
|
|
1353
|
-
const { focusReason } = useFocusReason();
|
|
1354
|
-
useEscapeKeydown((event) => {
|
|
1355
|
-
if (props.trapped && !focusLayer.paused) {
|
|
1356
|
-
emit("release-requested", event);
|
|
1357
|
-
}
|
|
1358
|
-
});
|
|
1359
|
-
const focusLayer = {
|
|
1360
|
-
paused: false,
|
|
1361
|
-
pause() {
|
|
1362
|
-
this.paused = true;
|
|
1363
|
-
},
|
|
1364
|
-
resume() {
|
|
1365
|
-
this.paused = false;
|
|
1366
|
-
}
|
|
1367
|
-
};
|
|
1368
|
-
const onKeydown = (e) => {
|
|
1369
|
-
if (!props.loop && !props.trapped)
|
|
1370
|
-
return;
|
|
1371
|
-
if (focusLayer.paused)
|
|
1372
|
-
return;
|
|
1373
|
-
const { key, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
|
|
1374
|
-
const { loop } = props;
|
|
1375
|
-
const isTabbing = key === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
|
|
1376
|
-
const currentFocusingEl = document.activeElement;
|
|
1377
|
-
if (isTabbing && currentFocusingEl) {
|
|
1378
|
-
const container = currentTarget;
|
|
1379
|
-
const [first, last] = getEdges(container);
|
|
1380
|
-
const isTabbable = first && last;
|
|
1381
|
-
if (!isTabbable) {
|
|
1382
|
-
if (currentFocusingEl === container) {
|
|
1383
|
-
const focusoutPreventedEvent = createFocusOutPreventedEvent({
|
|
1384
|
-
focusReason: focusReason.value
|
|
1385
|
-
});
|
|
1386
|
-
emit("focusout-prevented", focusoutPreventedEvent);
|
|
1387
|
-
if (!focusoutPreventedEvent.defaultPrevented) {
|
|
1388
|
-
e.preventDefault();
|
|
1389
|
-
}
|
|
1390
|
-
}
|
|
1391
|
-
} else {
|
|
1392
|
-
if (!shiftKey && currentFocusingEl === last) {
|
|
1393
|
-
const focusoutPreventedEvent = createFocusOutPreventedEvent({
|
|
1394
|
-
focusReason: focusReason.value
|
|
1395
|
-
});
|
|
1396
|
-
emit("focusout-prevented", focusoutPreventedEvent);
|
|
1397
|
-
if (!focusoutPreventedEvent.defaultPrevented) {
|
|
1398
|
-
e.preventDefault();
|
|
1399
|
-
if (loop)
|
|
1400
|
-
tryFocus(first, true);
|
|
1401
|
-
}
|
|
1402
|
-
} else if (shiftKey && [first, container].includes(currentFocusingEl)) {
|
|
1403
|
-
const focusoutPreventedEvent = createFocusOutPreventedEvent({
|
|
1404
|
-
focusReason: focusReason.value
|
|
1405
|
-
});
|
|
1406
|
-
emit("focusout-prevented", focusoutPreventedEvent);
|
|
1407
|
-
if (!focusoutPreventedEvent.defaultPrevented) {
|
|
1408
|
-
e.preventDefault();
|
|
1409
|
-
if (loop)
|
|
1410
|
-
tryFocus(last, true);
|
|
1411
|
-
}
|
|
1412
|
-
}
|
|
1413
|
-
}
|
|
1414
|
-
}
|
|
1415
|
-
};
|
|
1416
|
-
provide(FOCUS_TRAP_INJECTION_KEY, {
|
|
1417
|
-
focusTrapRef: forwardRef,
|
|
1418
|
-
onKeydown
|
|
1419
|
-
});
|
|
1420
|
-
watch$1(() => props.focusTrapEl, (focusTrapEl) => {
|
|
1421
|
-
if (focusTrapEl) {
|
|
1422
|
-
forwardRef.value = focusTrapEl;
|
|
1423
|
-
}
|
|
1424
|
-
}, { immediate: true });
|
|
1425
|
-
watch$1([forwardRef], ([forwardRef2], [oldForwardRef]) => {
|
|
1426
|
-
if (forwardRef2) {
|
|
1427
|
-
forwardRef2.addEventListener("keydown", onKeydown);
|
|
1428
|
-
forwardRef2.addEventListener("focusin", onFocusIn);
|
|
1429
|
-
forwardRef2.addEventListener("focusout", onFocusOut);
|
|
1430
|
-
}
|
|
1431
|
-
if (oldForwardRef) {
|
|
1432
|
-
oldForwardRef.removeEventListener("keydown", onKeydown);
|
|
1433
|
-
oldForwardRef.removeEventListener("focusin", onFocusIn);
|
|
1434
|
-
oldForwardRef.removeEventListener("focusout", onFocusOut);
|
|
1435
|
-
}
|
|
1436
|
-
});
|
|
1437
|
-
const trapOnFocus = (e) => {
|
|
1438
|
-
emit(ON_TRAP_FOCUS_EVT, e);
|
|
1439
|
-
};
|
|
1440
|
-
const releaseOnFocus = (e) => emit(ON_RELEASE_FOCUS_EVT, e);
|
|
1441
|
-
const onFocusIn = (e) => {
|
|
1442
|
-
const trapContainer = unref$1(forwardRef);
|
|
1443
|
-
if (!trapContainer)
|
|
1444
|
-
return;
|
|
1445
|
-
const target = e.target;
|
|
1446
|
-
const relatedTarget = e.relatedTarget;
|
|
1447
|
-
const isFocusedInTrap = target && trapContainer.contains(target);
|
|
1448
|
-
if (!props.trapped) {
|
|
1449
|
-
const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget);
|
|
1450
|
-
if (!isPrevFocusedInTrap) {
|
|
1451
|
-
lastFocusBeforeTrapped = relatedTarget;
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
if (isFocusedInTrap)
|
|
1455
|
-
emit("focusin", e);
|
|
1456
|
-
if (focusLayer.paused)
|
|
1457
|
-
return;
|
|
1458
|
-
if (props.trapped) {
|
|
1459
|
-
if (isFocusedInTrap) {
|
|
1460
|
-
lastFocusAfterTrapped = target;
|
|
1461
|
-
} else {
|
|
1462
|
-
tryFocus(lastFocusAfterTrapped, true);
|
|
1463
|
-
}
|
|
1464
|
-
}
|
|
1465
|
-
};
|
|
1466
|
-
const onFocusOut = (e) => {
|
|
1467
|
-
const trapContainer = unref$1(forwardRef);
|
|
1468
|
-
if (focusLayer.paused || !trapContainer)
|
|
1469
|
-
return;
|
|
1470
|
-
if (props.trapped) {
|
|
1471
|
-
const relatedTarget = e.relatedTarget;
|
|
1472
|
-
if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {
|
|
1473
|
-
setTimeout(() => {
|
|
1474
|
-
if (!focusLayer.paused && props.trapped) {
|
|
1475
|
-
const focusoutPreventedEvent = createFocusOutPreventedEvent({
|
|
1476
|
-
focusReason: focusReason.value
|
|
1477
|
-
});
|
|
1478
|
-
emit("focusout-prevented", focusoutPreventedEvent);
|
|
1479
|
-
if (!focusoutPreventedEvent.defaultPrevented) {
|
|
1480
|
-
tryFocus(lastFocusAfterTrapped, true);
|
|
1481
|
-
}
|
|
1482
|
-
}
|
|
1483
|
-
}, 0);
|
|
1484
|
-
}
|
|
1485
|
-
} else {
|
|
1486
|
-
const target = e.target;
|
|
1487
|
-
const isFocusedInTrap = target && trapContainer.contains(target);
|
|
1488
|
-
if (!isFocusedInTrap)
|
|
1489
|
-
emit("focusout", e);
|
|
1490
|
-
}
|
|
1491
|
-
};
|
|
1492
|
-
async function startTrap() {
|
|
1493
|
-
await nextTick();
|
|
1494
|
-
const trapContainer = unref$1(forwardRef);
|
|
1495
|
-
if (trapContainer) {
|
|
1496
|
-
focusableStack.push(focusLayer);
|
|
1497
|
-
const prevFocusedElement = trapContainer.contains(document.activeElement) ? lastFocusBeforeTrapped : document.activeElement;
|
|
1498
|
-
lastFocusBeforeTrapped = prevFocusedElement;
|
|
1499
|
-
const isPrevFocusContained = trapContainer.contains(prevFocusedElement);
|
|
1500
|
-
if (!isPrevFocusContained) {
|
|
1501
|
-
const focusEvent = new Event(FOCUS_AFTER_TRAPPED, FOCUS_AFTER_TRAPPED_OPTS);
|
|
1502
|
-
trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
|
|
1503
|
-
trapContainer.dispatchEvent(focusEvent);
|
|
1504
|
-
if (!focusEvent.defaultPrevented) {
|
|
1505
|
-
nextTick(() => {
|
|
1506
|
-
let focusStartEl = props.focusStartEl;
|
|
1507
|
-
if (!isString(focusStartEl)) {
|
|
1508
|
-
tryFocus(focusStartEl);
|
|
1509
|
-
if (document.activeElement !== focusStartEl) {
|
|
1510
|
-
focusStartEl = "first";
|
|
1511
|
-
}
|
|
1512
|
-
}
|
|
1513
|
-
if (focusStartEl === "first") {
|
|
1514
|
-
focusFirstDescendant(obtainAllFocusableElements(trapContainer), true);
|
|
1515
|
-
}
|
|
1516
|
-
if (document.activeElement === prevFocusedElement || focusStartEl === "container") {
|
|
1517
|
-
tryFocus(trapContainer);
|
|
1518
|
-
}
|
|
1519
|
-
});
|
|
1520
|
-
}
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
}
|
|
1524
|
-
function stopTrap() {
|
|
1525
|
-
const trapContainer = unref$1(forwardRef);
|
|
1526
|
-
if (trapContainer) {
|
|
1527
|
-
trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
|
|
1528
|
-
const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {
|
|
1529
|
-
...FOCUS_AFTER_TRAPPED_OPTS,
|
|
1530
|
-
detail: {
|
|
1531
|
-
focusReason: focusReason.value
|
|
1532
|
-
}
|
|
1533
|
-
});
|
|
1534
|
-
trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
|
|
1535
|
-
trapContainer.dispatchEvent(releasedEvent);
|
|
1536
|
-
if (!releasedEvent.defaultPrevented && (focusReason.value == "keyboard" || !isFocusCausedByUserEvent() || trapContainer.contains(document.activeElement))) {
|
|
1537
|
-
tryFocus(lastFocusBeforeTrapped != null ? lastFocusBeforeTrapped : document.body);
|
|
1538
|
-
}
|
|
1539
|
-
trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
|
|
1540
|
-
focusableStack.remove(focusLayer);
|
|
1541
|
-
}
|
|
1542
|
-
}
|
|
1543
|
-
onMounted(() => {
|
|
1544
|
-
if (props.trapped) {
|
|
1545
|
-
startTrap();
|
|
1546
|
-
}
|
|
1547
|
-
watch$1(() => props.trapped, (trapped) => {
|
|
1548
|
-
if (trapped) {
|
|
1549
|
-
startTrap();
|
|
1550
|
-
} else {
|
|
1551
|
-
stopTrap();
|
|
1552
|
-
}
|
|
1553
|
-
});
|
|
1554
|
-
});
|
|
1555
|
-
onBeforeUnmount(() => {
|
|
1556
|
-
if (props.trapped) {
|
|
1557
|
-
stopTrap();
|
|
1558
|
-
}
|
|
1559
|
-
});
|
|
1560
|
-
return {
|
|
1561
|
-
onKeydown
|
|
1562
|
-
};
|
|
1563
|
-
}
|
|
1564
|
-
});
|
|
1565
|
-
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1566
|
-
return renderSlot(_ctx.$slots, "default", { handleKeydown: _ctx.onKeydown });
|
|
1567
|
-
}
|
|
1568
|
-
var ElFocusTrap = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["render", _sfc_render$2], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/focus-trap/src/focus-trap.vue"]]);
|
|
1569
|
-
|
|
1570
|
-
const POSITIONING_STRATEGIES = ["fixed", "absolute"];
|
|
1571
|
-
const popperCoreConfigProps = buildProps({
|
|
1572
|
-
boundariesPadding: {
|
|
1573
|
-
type: Number,
|
|
1574
|
-
default: 0
|
|
1575
|
-
},
|
|
1576
|
-
fallbackPlacements: {
|
|
1577
|
-
type: definePropType(Array),
|
|
1578
|
-
default: void 0
|
|
1579
|
-
},
|
|
1580
|
-
gpuAcceleration: {
|
|
1581
|
-
type: Boolean,
|
|
1582
|
-
default: true
|
|
1583
|
-
},
|
|
1584
|
-
offset: {
|
|
1585
|
-
type: Number,
|
|
1586
|
-
default: 12
|
|
1587
|
-
},
|
|
1588
|
-
placement: {
|
|
1589
|
-
type: String,
|
|
1590
|
-
values: Ee,
|
|
1591
|
-
default: "bottom"
|
|
1592
|
-
},
|
|
1593
|
-
popperOptions: {
|
|
1594
|
-
type: definePropType(Object),
|
|
1595
|
-
default: () => ({})
|
|
1596
|
-
},
|
|
1597
|
-
strategy: {
|
|
1598
|
-
type: String,
|
|
1599
|
-
values: POSITIONING_STRATEGIES,
|
|
1600
|
-
default: "absolute"
|
|
1601
|
-
}
|
|
1602
|
-
});
|
|
1603
|
-
const popperContentProps = buildProps({
|
|
1604
|
-
...popperCoreConfigProps,
|
|
1605
|
-
id: String,
|
|
1606
|
-
style: {
|
|
1607
|
-
type: definePropType([String, Array, Object])
|
|
1608
|
-
},
|
|
1609
|
-
className: {
|
|
1610
|
-
type: definePropType([String, Array, Object])
|
|
1611
|
-
},
|
|
1612
|
-
effect: {
|
|
1613
|
-
type: String,
|
|
1614
|
-
default: "dark"
|
|
1615
|
-
},
|
|
1616
|
-
visible: Boolean,
|
|
1617
|
-
enterable: {
|
|
1618
|
-
type: Boolean,
|
|
1619
|
-
default: true
|
|
1620
|
-
},
|
|
1621
|
-
pure: Boolean,
|
|
1622
|
-
focusOnShow: {
|
|
1623
|
-
type: Boolean,
|
|
1624
|
-
default: false
|
|
1625
|
-
},
|
|
1626
|
-
trapping: {
|
|
1627
|
-
type: Boolean,
|
|
1628
|
-
default: false
|
|
1629
|
-
},
|
|
1630
|
-
popperClass: {
|
|
1631
|
-
type: definePropType([String, Array, Object])
|
|
1632
|
-
},
|
|
1633
|
-
popperStyle: {
|
|
1634
|
-
type: definePropType([String, Array, Object])
|
|
1635
|
-
},
|
|
1636
|
-
referenceEl: {
|
|
1637
|
-
type: definePropType(Object)
|
|
1638
|
-
},
|
|
1639
|
-
triggerTargetEl: {
|
|
1640
|
-
type: definePropType(Object)
|
|
1641
|
-
},
|
|
1642
|
-
stopPopperMouseEvent: {
|
|
1643
|
-
type: Boolean,
|
|
1644
|
-
default: true
|
|
1645
|
-
},
|
|
1646
|
-
ariaLabel: {
|
|
1647
|
-
type: String,
|
|
1648
|
-
default: void 0
|
|
1649
|
-
},
|
|
1650
|
-
virtualTriggering: Boolean,
|
|
1651
|
-
zIndex: Number
|
|
1652
|
-
});
|
|
1653
|
-
const popperContentEmits = {
|
|
1654
|
-
mouseenter: (evt) => evt instanceof MouseEvent,
|
|
1655
|
-
mouseleave: (evt) => evt instanceof MouseEvent,
|
|
1656
|
-
focus: () => true,
|
|
1657
|
-
blur: () => true,
|
|
1658
|
-
close: () => true
|
|
1659
|
-
};
|
|
1660
|
-
|
|
1661
|
-
const buildPopperOptions = (props, modifiers = []) => {
|
|
1662
|
-
const { placement, strategy, popperOptions } = props;
|
|
1663
|
-
const options = {
|
|
1664
|
-
placement,
|
|
1665
|
-
strategy,
|
|
1666
|
-
...popperOptions,
|
|
1667
|
-
modifiers: [...genModifiers(props), ...modifiers]
|
|
1668
|
-
};
|
|
1669
|
-
deriveExtraModifiers(options, popperOptions == null ? void 0 : popperOptions.modifiers);
|
|
1670
|
-
return options;
|
|
1671
|
-
};
|
|
1672
|
-
const unwrapMeasurableEl = ($el) => {
|
|
1673
|
-
if (!isClient)
|
|
1674
|
-
return;
|
|
1675
|
-
return unrefElement($el);
|
|
1676
|
-
};
|
|
1677
|
-
function genModifiers(options) {
|
|
1678
|
-
const { offset, gpuAcceleration, fallbackPlacements } = options;
|
|
1679
|
-
return [
|
|
1680
|
-
{
|
|
1681
|
-
name: "offset",
|
|
1682
|
-
options: {
|
|
1683
|
-
offset: [0, offset != null ? offset : 12]
|
|
1684
|
-
}
|
|
1685
|
-
},
|
|
1686
|
-
{
|
|
1687
|
-
name: "preventOverflow",
|
|
1688
|
-
options: {
|
|
1689
|
-
padding: {
|
|
1690
|
-
top: 2,
|
|
1691
|
-
bottom: 2,
|
|
1692
|
-
left: 5,
|
|
1693
|
-
right: 5
|
|
1694
|
-
}
|
|
1695
|
-
}
|
|
1696
|
-
},
|
|
1697
|
-
{
|
|
1698
|
-
name: "flip",
|
|
1699
|
-
options: {
|
|
1700
|
-
padding: 5,
|
|
1701
|
-
fallbackPlacements
|
|
1702
|
-
}
|
|
1703
|
-
},
|
|
1704
|
-
{
|
|
1705
|
-
name: "computeStyles",
|
|
1706
|
-
options: {
|
|
1707
|
-
gpuAcceleration
|
|
1708
|
-
}
|
|
1709
|
-
}
|
|
1710
|
-
];
|
|
1711
|
-
}
|
|
1712
|
-
function deriveExtraModifiers(options, modifiers) {
|
|
1713
|
-
if (modifiers) {
|
|
1714
|
-
options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
|
|
1715
|
-
}
|
|
1716
|
-
}
|
|
1717
|
-
|
|
1718
|
-
const DEFAULT_ARROW_OFFSET = 0;
|
|
1719
|
-
const usePopperContent = (props) => {
|
|
1720
|
-
const { popperInstanceRef, contentRef, triggerRef, role } = inject(POPPER_INJECTION_KEY, void 0);
|
|
1721
|
-
const arrowRef = ref();
|
|
1722
|
-
const arrowOffset = ref();
|
|
1723
|
-
const eventListenerModifier = computed(() => {
|
|
1724
|
-
return {
|
|
1725
|
-
name: "eventListeners",
|
|
1726
|
-
enabled: !!props.visible
|
|
1727
|
-
};
|
|
1728
|
-
});
|
|
1729
|
-
const arrowModifier = computed(() => {
|
|
1730
|
-
var _a;
|
|
1731
|
-
const arrowEl = unref$1(arrowRef);
|
|
1732
|
-
const offset = (_a = unref$1(arrowOffset)) != null ? _a : DEFAULT_ARROW_OFFSET;
|
|
1733
|
-
return {
|
|
1734
|
-
name: "arrow",
|
|
1735
|
-
enabled: !isUndefined(arrowEl),
|
|
1736
|
-
options: {
|
|
1737
|
-
element: arrowEl,
|
|
1738
|
-
padding: offset
|
|
1739
|
-
}
|
|
1740
|
-
};
|
|
1741
|
-
});
|
|
1742
|
-
const options = computed(() => {
|
|
1743
|
-
return {
|
|
1744
|
-
onFirstUpdate: () => {
|
|
1745
|
-
update();
|
|
1746
|
-
},
|
|
1747
|
-
...buildPopperOptions(props, [
|
|
1748
|
-
unref$1(arrowModifier),
|
|
1749
|
-
unref$1(eventListenerModifier)
|
|
1750
|
-
])
|
|
1751
|
-
};
|
|
1752
|
-
});
|
|
1753
|
-
const computedReference = computed(() => unwrapMeasurableEl(props.referenceEl) || unref$1(triggerRef));
|
|
1754
|
-
const { attributes, state, styles, update, forceUpdate, instanceRef } = usePopper(computedReference, contentRef, options);
|
|
1755
|
-
watch$1(instanceRef, (instance) => popperInstanceRef.value = instance);
|
|
1756
|
-
onMounted(() => {
|
|
1757
|
-
watch$1(() => {
|
|
1758
|
-
var _a;
|
|
1759
|
-
return (_a = unref$1(computedReference)) == null ? void 0 : _a.getBoundingClientRect();
|
|
1760
|
-
}, () => {
|
|
1761
|
-
update();
|
|
1762
|
-
});
|
|
1763
|
-
});
|
|
1764
|
-
return {
|
|
1765
|
-
attributes,
|
|
1766
|
-
arrowRef,
|
|
1767
|
-
contentRef,
|
|
1768
|
-
instanceRef,
|
|
1769
|
-
state,
|
|
1770
|
-
styles,
|
|
1771
|
-
role,
|
|
1772
|
-
forceUpdate,
|
|
1773
|
-
update
|
|
1774
|
-
};
|
|
1775
|
-
};
|
|
1776
|
-
|
|
1777
|
-
const usePopperContentDOM = (props, {
|
|
1778
|
-
attributes,
|
|
1779
|
-
styles,
|
|
1780
|
-
role
|
|
1781
|
-
}) => {
|
|
1782
|
-
const { nextZIndex } = useZIndex();
|
|
1783
|
-
const ns = useNamespace("popper");
|
|
1784
|
-
const contentAttrs = computed(() => unref$1(attributes).popper);
|
|
1785
|
-
const contentZIndex = ref(isNumber(props.zIndex) ? props.zIndex : nextZIndex());
|
|
1786
|
-
const contentClass = computed(() => [
|
|
1787
|
-
ns.b(),
|
|
1788
|
-
ns.is("pure", props.pure),
|
|
1789
|
-
ns.is(props.effect),
|
|
1790
|
-
props.popperClass
|
|
1791
|
-
]);
|
|
1792
|
-
const contentStyle = computed(() => {
|
|
1793
|
-
return [
|
|
1794
|
-
{ zIndex: unref$1(contentZIndex) },
|
|
1795
|
-
unref$1(styles).popper,
|
|
1796
|
-
props.popperStyle || {}
|
|
1797
|
-
];
|
|
1798
|
-
});
|
|
1799
|
-
const ariaModal = computed(() => role.value === "dialog" ? "false" : void 0);
|
|
1800
|
-
const arrowStyle = computed(() => unref$1(styles).arrow || {});
|
|
1801
|
-
const updateZIndex = () => {
|
|
1802
|
-
contentZIndex.value = isNumber(props.zIndex) ? props.zIndex : nextZIndex();
|
|
1803
|
-
};
|
|
1804
|
-
return {
|
|
1805
|
-
ariaModal,
|
|
1806
|
-
arrowStyle,
|
|
1807
|
-
contentAttrs,
|
|
1808
|
-
contentClass,
|
|
1809
|
-
contentStyle,
|
|
1810
|
-
contentZIndex,
|
|
1811
|
-
updateZIndex
|
|
1812
|
-
};
|
|
1813
|
-
};
|
|
1814
|
-
|
|
1815
|
-
const usePopperContentFocusTrap = (props, emit) => {
|
|
1816
|
-
const trapped = ref(false);
|
|
1817
|
-
const focusStartRef = ref();
|
|
1818
|
-
const onFocusAfterTrapped = () => {
|
|
1819
|
-
emit("focus");
|
|
1820
|
-
};
|
|
1821
|
-
const onFocusAfterReleased = (event) => {
|
|
1822
|
-
var _a;
|
|
1823
|
-
if (((_a = event.detail) == null ? void 0 : _a.focusReason) !== "pointer") {
|
|
1824
|
-
focusStartRef.value = "first";
|
|
1825
|
-
emit("blur");
|
|
1826
|
-
}
|
|
1827
|
-
};
|
|
1828
|
-
const onFocusInTrap = (event) => {
|
|
1829
|
-
if (props.visible && !trapped.value) {
|
|
1830
|
-
if (event.target) {
|
|
1831
|
-
focusStartRef.value = event.target;
|
|
1832
|
-
}
|
|
1833
|
-
trapped.value = true;
|
|
1834
|
-
}
|
|
1835
|
-
};
|
|
1836
|
-
const onFocusoutPrevented = (event) => {
|
|
1837
|
-
if (!props.trapping) {
|
|
1838
|
-
if (event.detail.focusReason === "pointer") {
|
|
1839
|
-
event.preventDefault();
|
|
1840
|
-
}
|
|
1841
|
-
trapped.value = false;
|
|
1842
|
-
}
|
|
1843
|
-
};
|
|
1844
|
-
const onReleaseRequested = () => {
|
|
1845
|
-
trapped.value = false;
|
|
1846
|
-
emit("close");
|
|
1847
|
-
};
|
|
1848
|
-
return {
|
|
1849
|
-
focusStartRef,
|
|
1850
|
-
trapped,
|
|
1851
|
-
onFocusAfterReleased,
|
|
1852
|
-
onFocusAfterTrapped,
|
|
1853
|
-
onFocusInTrap,
|
|
1854
|
-
onFocusoutPrevented,
|
|
1855
|
-
onReleaseRequested
|
|
1856
|
-
};
|
|
1857
|
-
};
|
|
1858
|
-
|
|
1859
|
-
const __default__$4 = defineComponent({
|
|
1860
|
-
name: "ElPopperContent"
|
|
1861
|
-
});
|
|
1862
|
-
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
1863
|
-
...__default__$4,
|
|
1864
|
-
props: popperContentProps,
|
|
1865
|
-
emits: popperContentEmits,
|
|
1866
|
-
setup(__props, { expose, emit }) {
|
|
1867
|
-
const props = __props;
|
|
1868
|
-
const {
|
|
1869
|
-
focusStartRef,
|
|
1870
|
-
trapped,
|
|
1871
|
-
onFocusAfterReleased,
|
|
1872
|
-
onFocusAfterTrapped,
|
|
1873
|
-
onFocusInTrap,
|
|
1874
|
-
onFocusoutPrevented,
|
|
1875
|
-
onReleaseRequested
|
|
1876
|
-
} = usePopperContentFocusTrap(props, emit);
|
|
1877
|
-
const { attributes, arrowRef, contentRef, styles, instanceRef, role, update } = usePopperContent(props);
|
|
1878
|
-
const {
|
|
1879
|
-
ariaModal,
|
|
1880
|
-
arrowStyle,
|
|
1881
|
-
contentAttrs,
|
|
1882
|
-
contentClass,
|
|
1883
|
-
contentStyle,
|
|
1884
|
-
updateZIndex
|
|
1885
|
-
} = usePopperContentDOM(props, {
|
|
1886
|
-
styles,
|
|
1887
|
-
attributes,
|
|
1888
|
-
role
|
|
1889
|
-
});
|
|
1890
|
-
const formItemContext = inject(formItemContextKey, void 0);
|
|
1891
|
-
const arrowOffset = ref();
|
|
1892
|
-
provide(POPPER_CONTENT_INJECTION_KEY, {
|
|
1893
|
-
arrowStyle,
|
|
1894
|
-
arrowRef,
|
|
1895
|
-
arrowOffset
|
|
1896
|
-
});
|
|
1897
|
-
if (formItemContext && (formItemContext.addInputId || formItemContext.removeInputId)) {
|
|
1898
|
-
provide(formItemContextKey, {
|
|
1899
|
-
...formItemContext,
|
|
1900
|
-
addInputId: NOOP,
|
|
1901
|
-
removeInputId: NOOP
|
|
1902
|
-
});
|
|
1903
|
-
}
|
|
1904
|
-
let triggerTargetAriaStopWatch = void 0;
|
|
1905
|
-
const updatePopper = (shouldUpdateZIndex = true) => {
|
|
1906
|
-
update();
|
|
1907
|
-
shouldUpdateZIndex && updateZIndex();
|
|
1908
|
-
};
|
|
1909
|
-
const togglePopperAlive = () => {
|
|
1910
|
-
updatePopper(false);
|
|
1911
|
-
if (props.visible && props.focusOnShow) {
|
|
1912
|
-
trapped.value = true;
|
|
1913
|
-
} else if (props.visible === false) {
|
|
1914
|
-
trapped.value = false;
|
|
1915
|
-
}
|
|
1916
|
-
};
|
|
1917
|
-
onMounted(() => {
|
|
1918
|
-
watch$1(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => {
|
|
1919
|
-
triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
|
|
1920
|
-
triggerTargetAriaStopWatch = void 0;
|
|
1921
|
-
const el = unref$1(triggerTargetEl || contentRef.value);
|
|
1922
|
-
const prevEl = unref$1(prevTriggerTargetEl || contentRef.value);
|
|
1923
|
-
if (isElement(el)) {
|
|
1924
|
-
triggerTargetAriaStopWatch = watch$1([role, () => props.ariaLabel, ariaModal, () => props.id], (watches) => {
|
|
1925
|
-
["role", "aria-label", "aria-modal", "id"].forEach((key, idx) => {
|
|
1926
|
-
isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
|
|
1927
|
-
});
|
|
1928
|
-
}, { immediate: true });
|
|
1929
|
-
}
|
|
1930
|
-
if (prevEl !== el && isElement(prevEl)) {
|
|
1931
|
-
["role", "aria-label", "aria-modal", "id"].forEach((key) => {
|
|
1932
|
-
prevEl.removeAttribute(key);
|
|
1933
|
-
});
|
|
1934
|
-
}
|
|
1935
|
-
}, { immediate: true });
|
|
1936
|
-
watch$1(() => props.visible, togglePopperAlive, { immediate: true });
|
|
1937
|
-
});
|
|
1938
|
-
onBeforeUnmount(() => {
|
|
1939
|
-
triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
|
|
1940
|
-
triggerTargetAriaStopWatch = void 0;
|
|
1941
|
-
});
|
|
1942
|
-
expose({
|
|
1943
|
-
popperContentRef: contentRef,
|
|
1944
|
-
popperInstanceRef: instanceRef,
|
|
1945
|
-
updatePopper,
|
|
1946
|
-
contentStyle
|
|
1947
|
-
});
|
|
1948
|
-
return (_ctx, _cache) => {
|
|
1949
|
-
return openBlock(), createElementBlock("div", mergeProps({
|
|
1950
|
-
ref_key: "contentRef",
|
|
1951
|
-
ref: contentRef
|
|
1952
|
-
}, unref$1(contentAttrs), {
|
|
1953
|
-
style: unref$1(contentStyle),
|
|
1954
|
-
class: unref$1(contentClass),
|
|
1955
|
-
tabindex: "-1",
|
|
1956
|
-
onMouseenter: _cache[0] || (_cache[0] = (e) => _ctx.$emit("mouseenter", e)),
|
|
1957
|
-
onMouseleave: _cache[1] || (_cache[1] = (e) => _ctx.$emit("mouseleave", e))
|
|
1958
|
-
}), [
|
|
1959
|
-
createVNode(unref$1(ElFocusTrap), {
|
|
1960
|
-
trapped: unref$1(trapped),
|
|
1961
|
-
"trap-on-focus-in": true,
|
|
1962
|
-
"focus-trap-el": unref$1(contentRef),
|
|
1963
|
-
"focus-start-el": unref$1(focusStartRef),
|
|
1964
|
-
onFocusAfterTrapped: unref$1(onFocusAfterTrapped),
|
|
1965
|
-
onFocusAfterReleased: unref$1(onFocusAfterReleased),
|
|
1966
|
-
onFocusin: unref$1(onFocusInTrap),
|
|
1967
|
-
onFocusoutPrevented: unref$1(onFocusoutPrevented),
|
|
1968
|
-
onReleaseRequested: unref$1(onReleaseRequested)
|
|
1969
|
-
}, {
|
|
1970
|
-
default: withCtx(() => [
|
|
1971
|
-
renderSlot(_ctx.$slots, "default")
|
|
1972
|
-
]),
|
|
1973
|
-
_: 3
|
|
1974
|
-
}, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
|
|
1975
|
-
], 16);
|
|
1976
|
-
};
|
|
1977
|
-
}
|
|
1978
|
-
});
|
|
1979
|
-
var ElPopperContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/content.vue"]]);
|
|
1980
|
-
|
|
1981
|
-
const ElPopper = withInstall(Popper);
|
|
1982
|
-
|
|
1983
|
-
const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
|
|
1984
|
-
|
|
1985
|
-
const useTooltipContentProps = buildProps({
|
|
1986
|
-
...useDelayedToggleProps,
|
|
1987
|
-
...popperContentProps,
|
|
1988
|
-
appendTo: {
|
|
1989
|
-
type: definePropType([String, Object])
|
|
1990
|
-
},
|
|
1991
|
-
content: {
|
|
1992
|
-
type: String,
|
|
1993
|
-
default: ""
|
|
1994
|
-
},
|
|
1995
|
-
rawContent: {
|
|
1996
|
-
type: Boolean,
|
|
1997
|
-
default: false
|
|
1998
|
-
},
|
|
1999
|
-
persistent: Boolean,
|
|
2000
|
-
ariaLabel: String,
|
|
2001
|
-
visible: {
|
|
2002
|
-
type: definePropType(Boolean),
|
|
2003
|
-
default: null
|
|
2004
|
-
},
|
|
2005
|
-
transition: String,
|
|
2006
|
-
teleported: {
|
|
2007
|
-
type: Boolean,
|
|
2008
|
-
default: true
|
|
2009
|
-
},
|
|
2010
|
-
disabled: Boolean
|
|
2011
|
-
});
|
|
2012
|
-
|
|
2013
|
-
const useTooltipTriggerProps = buildProps({
|
|
2014
|
-
...popperTriggerProps,
|
|
2015
|
-
disabled: Boolean,
|
|
2016
|
-
trigger: {
|
|
2017
|
-
type: definePropType([String, Array]),
|
|
2018
|
-
default: "hover"
|
|
2019
|
-
},
|
|
2020
|
-
triggerKeys: {
|
|
2021
|
-
type: definePropType(Array),
|
|
2022
|
-
default: () => [EVENT_CODE.enter, EVENT_CODE.space]
|
|
2023
|
-
}
|
|
2024
|
-
});
|
|
2025
|
-
|
|
2026
|
-
const {
|
|
2027
|
-
useModelToggleProps: useTooltipModelToggleProps,
|
|
2028
|
-
useModelToggleEmits: useTooltipModelToggleEmits,
|
|
2029
|
-
useModelToggle: useTooltipModelToggle
|
|
2030
|
-
} = createModelToggleComposable("visible");
|
|
2031
|
-
const useTooltipProps = buildProps({
|
|
2032
|
-
...popperProps,
|
|
2033
|
-
...useTooltipModelToggleProps,
|
|
2034
|
-
...useTooltipContentProps,
|
|
2035
|
-
...useTooltipTriggerProps,
|
|
2036
|
-
...popperArrowProps,
|
|
2037
|
-
showArrow: {
|
|
2038
|
-
type: Boolean,
|
|
2039
|
-
default: true
|
|
2040
|
-
}
|
|
2041
|
-
});
|
|
2042
|
-
const tooltipEmits = [
|
|
2043
|
-
...useTooltipModelToggleEmits,
|
|
2044
|
-
"before-show",
|
|
2045
|
-
"before-hide",
|
|
2046
|
-
"show",
|
|
2047
|
-
"hide",
|
|
2048
|
-
"open",
|
|
2049
|
-
"close"
|
|
2050
|
-
];
|
|
2051
|
-
|
|
2052
|
-
const isTriggerType = (trigger, type) => {
|
|
2053
|
-
if (isArray(trigger)) {
|
|
2054
|
-
return trigger.includes(type);
|
|
2055
|
-
}
|
|
2056
|
-
return trigger === type;
|
|
2057
|
-
};
|
|
2058
|
-
const whenTrigger = (trigger, type, handler) => {
|
|
2059
|
-
return (e) => {
|
|
2060
|
-
isTriggerType(unref$1(trigger), type) && handler(e);
|
|
2061
|
-
};
|
|
2062
|
-
};
|
|
2063
|
-
|
|
2064
|
-
const __default__$3 = defineComponent({
|
|
2065
|
-
name: "ElTooltipTrigger"
|
|
2066
|
-
});
|
|
2067
|
-
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
2068
|
-
...__default__$3,
|
|
2069
|
-
props: useTooltipTriggerProps,
|
|
2070
|
-
setup(__props, { expose }) {
|
|
2071
|
-
const props = __props;
|
|
2072
|
-
const ns = useNamespace("tooltip");
|
|
2073
|
-
const { controlled, id, open, onOpen, onClose, onToggle } = inject(TOOLTIP_INJECTION_KEY, void 0);
|
|
2074
|
-
const triggerRef = ref(null);
|
|
2075
|
-
const stopWhenControlledOrDisabled = () => {
|
|
2076
|
-
if (unref$1(controlled) || props.disabled) {
|
|
2077
|
-
return true;
|
|
2078
|
-
}
|
|
2079
|
-
};
|
|
2080
|
-
const trigger = toRef(props, "trigger");
|
|
2081
|
-
const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onOpen));
|
|
2082
|
-
const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose));
|
|
2083
|
-
const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => {
|
|
2084
|
-
if (e.button === 0) {
|
|
2085
|
-
onToggle(e);
|
|
2086
|
-
}
|
|
2087
|
-
}));
|
|
2088
|
-
const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen));
|
|
2089
|
-
const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose));
|
|
2090
|
-
const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => {
|
|
2091
|
-
e.preventDefault();
|
|
2092
|
-
onToggle(e);
|
|
2093
|
-
}));
|
|
2094
|
-
const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
|
|
2095
|
-
const { code } = e;
|
|
2096
|
-
if (props.triggerKeys.includes(code)) {
|
|
2097
|
-
e.preventDefault();
|
|
2098
|
-
onToggle(e);
|
|
2099
|
-
}
|
|
2100
|
-
});
|
|
2101
|
-
expose({
|
|
2102
|
-
triggerRef
|
|
2103
|
-
});
|
|
2104
|
-
return (_ctx, _cache) => {
|
|
2105
|
-
return openBlock(), createBlock(unref$1(ElPopperTrigger), {
|
|
2106
|
-
id: unref$1(id),
|
|
2107
|
-
"virtual-ref": _ctx.virtualRef,
|
|
2108
|
-
open: unref$1(open),
|
|
2109
|
-
"virtual-triggering": _ctx.virtualTriggering,
|
|
2110
|
-
class: normalizeClass(unref$1(ns).e("trigger")),
|
|
2111
|
-
onBlur: unref$1(onBlur),
|
|
2112
|
-
onClick: unref$1(onClick),
|
|
2113
|
-
onContextmenu: unref$1(onContextMenu),
|
|
2114
|
-
onFocus: unref$1(onFocus),
|
|
2115
|
-
onMouseenter: unref$1(onMouseenter),
|
|
2116
|
-
onMouseleave: unref$1(onMouseleave),
|
|
2117
|
-
onKeydown: unref$1(onKeydown)
|
|
2118
|
-
}, {
|
|
2119
|
-
default: withCtx(() => [
|
|
2120
|
-
renderSlot(_ctx.$slots, "default")
|
|
2121
|
-
]),
|
|
2122
|
-
_: 3
|
|
2123
|
-
}, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
|
|
2124
|
-
};
|
|
2125
|
-
}
|
|
2126
|
-
});
|
|
2127
|
-
var ElTooltipTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$6, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/trigger.vue"]]);
|
|
2128
|
-
|
|
2129
|
-
const __default__$2 = defineComponent({
|
|
2130
|
-
name: "ElTooltipContent",
|
|
2131
|
-
inheritAttrs: false
|
|
2132
|
-
});
|
|
2133
|
-
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
2134
|
-
...__default__$2,
|
|
2135
|
-
props: useTooltipContentProps,
|
|
2136
|
-
setup(__props, { expose }) {
|
|
2137
|
-
const props = __props;
|
|
2138
|
-
const { selector } = usePopperContainerId();
|
|
2139
|
-
const ns = useNamespace("tooltip");
|
|
2140
|
-
const contentRef = ref(null);
|
|
2141
|
-
const destroyed = ref(false);
|
|
2142
|
-
const {
|
|
2143
|
-
controlled,
|
|
2144
|
-
id,
|
|
2145
|
-
open,
|
|
2146
|
-
trigger,
|
|
2147
|
-
onClose,
|
|
2148
|
-
onOpen,
|
|
2149
|
-
onShow,
|
|
2150
|
-
onHide,
|
|
2151
|
-
onBeforeShow,
|
|
2152
|
-
onBeforeHide
|
|
2153
|
-
} = inject(TOOLTIP_INJECTION_KEY, void 0);
|
|
2154
|
-
const transitionClass = computed(() => {
|
|
2155
|
-
return props.transition || `${ns.namespace.value}-fade-in-linear`;
|
|
2156
|
-
});
|
|
2157
|
-
const persistentRef = computed(() => {
|
|
2158
|
-
if (process.env.NODE_ENV === "test") {
|
|
2159
|
-
return true;
|
|
2160
|
-
}
|
|
2161
|
-
return props.persistent;
|
|
2162
|
-
});
|
|
2163
|
-
onBeforeUnmount(() => {
|
|
2164
|
-
destroyed.value = true;
|
|
2165
|
-
});
|
|
2166
|
-
const shouldRender = computed(() => {
|
|
2167
|
-
return unref$1(persistentRef) ? true : unref$1(open);
|
|
2168
|
-
});
|
|
2169
|
-
const shouldShow = computed(() => {
|
|
2170
|
-
return props.disabled ? false : unref$1(open);
|
|
2171
|
-
});
|
|
2172
|
-
const appendTo = computed(() => {
|
|
2173
|
-
return props.appendTo || selector.value;
|
|
2174
|
-
});
|
|
2175
|
-
const contentStyle = computed(() => {
|
|
2176
|
-
var _a;
|
|
2177
|
-
return (_a = props.style) != null ? _a : {};
|
|
2178
|
-
});
|
|
2179
|
-
const ariaHidden = computed(() => !unref$1(open));
|
|
2180
|
-
const onTransitionLeave = () => {
|
|
2181
|
-
onHide();
|
|
2182
|
-
};
|
|
2183
|
-
const stopWhenControlled = () => {
|
|
2184
|
-
if (unref$1(controlled))
|
|
2185
|
-
return true;
|
|
2186
|
-
};
|
|
2187
|
-
const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
|
|
2188
|
-
if (props.enterable && unref$1(trigger) === "hover") {
|
|
2189
|
-
onOpen();
|
|
2190
|
-
}
|
|
2191
|
-
});
|
|
2192
|
-
const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
|
|
2193
|
-
if (unref$1(trigger) === "hover") {
|
|
2194
|
-
onClose();
|
|
2195
|
-
}
|
|
2196
|
-
});
|
|
2197
|
-
const onBeforeEnter = () => {
|
|
2198
|
-
var _a, _b;
|
|
2199
|
-
(_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
|
|
2200
|
-
onBeforeShow == null ? void 0 : onBeforeShow();
|
|
2201
|
-
};
|
|
2202
|
-
const onBeforeLeave = () => {
|
|
2203
|
-
onBeforeHide == null ? void 0 : onBeforeHide();
|
|
2204
|
-
};
|
|
2205
|
-
const onAfterShow = () => {
|
|
2206
|
-
onShow();
|
|
2207
|
-
stopHandle = onClickOutside(computed(() => {
|
|
2208
|
-
var _a;
|
|
2209
|
-
return (_a = contentRef.value) == null ? void 0 : _a.popperContentRef;
|
|
2210
|
-
}), () => {
|
|
2211
|
-
if (unref$1(controlled))
|
|
2212
|
-
return;
|
|
2213
|
-
const $trigger = unref$1(trigger);
|
|
2214
|
-
if ($trigger !== "hover") {
|
|
2215
|
-
onClose();
|
|
2216
|
-
}
|
|
2217
|
-
});
|
|
2218
|
-
};
|
|
2219
|
-
const onBlur = () => {
|
|
2220
|
-
if (!props.virtualTriggering) {
|
|
2221
|
-
onClose();
|
|
2222
|
-
}
|
|
2223
|
-
};
|
|
2224
|
-
let stopHandle;
|
|
2225
|
-
watch$1(() => unref$1(open), (val) => {
|
|
2226
|
-
if (!val) {
|
|
2227
|
-
stopHandle == null ? void 0 : stopHandle();
|
|
2228
|
-
}
|
|
2229
|
-
}, {
|
|
2230
|
-
flush: "post"
|
|
2231
|
-
});
|
|
2232
|
-
watch$1(() => props.content, () => {
|
|
2233
|
-
var _a, _b;
|
|
2234
|
-
(_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
|
|
2235
|
-
});
|
|
2236
|
-
expose({
|
|
2237
|
-
contentRef
|
|
2238
|
-
});
|
|
2239
|
-
return (_ctx, _cache) => {
|
|
2240
|
-
return openBlock(), createBlock(Teleport, {
|
|
2241
|
-
disabled: !_ctx.teleported,
|
|
2242
|
-
to: unref$1(appendTo)
|
|
2243
|
-
}, [
|
|
2244
|
-
createVNode(Transition, {
|
|
2245
|
-
name: unref$1(transitionClass),
|
|
2246
|
-
onAfterLeave: onTransitionLeave,
|
|
2247
|
-
onBeforeEnter,
|
|
2248
|
-
onAfterEnter: onAfterShow,
|
|
2249
|
-
onBeforeLeave
|
|
2250
|
-
}, {
|
|
2251
|
-
default: withCtx(() => [
|
|
2252
|
-
unref$1(shouldRender) ? withDirectives((openBlock(), createBlock(unref$1(ElPopperContent), mergeProps({
|
|
2253
|
-
key: 0,
|
|
2254
|
-
id: unref$1(id),
|
|
2255
|
-
ref_key: "contentRef",
|
|
2256
|
-
ref: contentRef
|
|
2257
|
-
}, _ctx.$attrs, {
|
|
2258
|
-
"aria-label": _ctx.ariaLabel,
|
|
2259
|
-
"aria-hidden": unref$1(ariaHidden),
|
|
2260
|
-
"boundaries-padding": _ctx.boundariesPadding,
|
|
2261
|
-
"fallback-placements": _ctx.fallbackPlacements,
|
|
2262
|
-
"gpu-acceleration": _ctx.gpuAcceleration,
|
|
2263
|
-
offset: _ctx.offset,
|
|
2264
|
-
placement: _ctx.placement,
|
|
2265
|
-
"popper-options": _ctx.popperOptions,
|
|
2266
|
-
strategy: _ctx.strategy,
|
|
2267
|
-
effect: _ctx.effect,
|
|
2268
|
-
enterable: _ctx.enterable,
|
|
2269
|
-
pure: _ctx.pure,
|
|
2270
|
-
"popper-class": _ctx.popperClass,
|
|
2271
|
-
"popper-style": [_ctx.popperStyle, unref$1(contentStyle)],
|
|
2272
|
-
"reference-el": _ctx.referenceEl,
|
|
2273
|
-
"trigger-target-el": _ctx.triggerTargetEl,
|
|
2274
|
-
visible: unref$1(shouldShow),
|
|
2275
|
-
"z-index": _ctx.zIndex,
|
|
2276
|
-
onMouseenter: unref$1(onContentEnter),
|
|
2277
|
-
onMouseleave: unref$1(onContentLeave),
|
|
2278
|
-
onBlur,
|
|
2279
|
-
onClose: unref$1(onClose)
|
|
2280
|
-
}), {
|
|
2281
|
-
default: withCtx(() => [
|
|
2282
|
-
!destroyed.value ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
|
|
2283
|
-
]),
|
|
2284
|
-
_: 3
|
|
2285
|
-
}, 16, ["id", "aria-label", "aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "trigger-target-el", "visible", "z-index", "onMouseenter", "onMouseleave", "onClose"])), [
|
|
2286
|
-
[vShow, unref$1(shouldShow)]
|
|
2287
|
-
]) : createCommentVNode("v-if", true)
|
|
2288
|
-
]),
|
|
2289
|
-
_: 3
|
|
2290
|
-
}, 8, ["name"])
|
|
2291
|
-
], 8, ["disabled", "to"]);
|
|
2292
|
-
};
|
|
2293
|
-
}
|
|
2294
|
-
});
|
|
2295
|
-
var ElTooltipContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$5, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/content.vue"]]);
|
|
2296
|
-
|
|
2297
|
-
const _hoisted_1$1 = ["innerHTML"];
|
|
2298
|
-
const _hoisted_2$1 = { key: 1 };
|
|
2299
|
-
const __default__$1 = defineComponent({
|
|
2300
|
-
name: "ElTooltip"
|
|
2301
|
-
});
|
|
2302
|
-
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
2303
|
-
...__default__$1,
|
|
2304
|
-
props: useTooltipProps,
|
|
2305
|
-
emits: tooltipEmits,
|
|
2306
|
-
setup(__props, { expose, emit }) {
|
|
2307
|
-
const props = __props;
|
|
2308
|
-
usePopperContainer();
|
|
2309
|
-
const id = useId();
|
|
2310
|
-
const popperRef = ref();
|
|
2311
|
-
const contentRef = ref();
|
|
2312
|
-
const updatePopper = () => {
|
|
2313
|
-
var _a;
|
|
2314
|
-
const popperComponent = unref$1(popperRef);
|
|
2315
|
-
if (popperComponent) {
|
|
2316
|
-
(_a = popperComponent.popperInstanceRef) == null ? void 0 : _a.update();
|
|
2317
|
-
}
|
|
2318
|
-
};
|
|
2319
|
-
const open = ref(false);
|
|
2320
|
-
const toggleReason = ref();
|
|
2321
|
-
const { show, hide, hasUpdateHandler } = useTooltipModelToggle({
|
|
2322
|
-
indicator: open,
|
|
2323
|
-
toggleReason
|
|
2324
|
-
});
|
|
2325
|
-
const { onOpen, onClose } = useDelayedToggle({
|
|
2326
|
-
showAfter: toRef(props, "showAfter"),
|
|
2327
|
-
hideAfter: toRef(props, "hideAfter"),
|
|
2328
|
-
autoClose: toRef(props, "autoClose"),
|
|
2329
|
-
open: show,
|
|
2330
|
-
close: hide
|
|
2331
|
-
});
|
|
2332
|
-
const controlled = computed(() => isBoolean(props.visible) && !hasUpdateHandler.value);
|
|
2333
|
-
provide(TOOLTIP_INJECTION_KEY, {
|
|
2334
|
-
controlled,
|
|
2335
|
-
id,
|
|
2336
|
-
open: readonly(open),
|
|
2337
|
-
trigger: toRef(props, "trigger"),
|
|
2338
|
-
onOpen: (event) => {
|
|
2339
|
-
onOpen(event);
|
|
2340
|
-
},
|
|
2341
|
-
onClose: (event) => {
|
|
2342
|
-
onClose(event);
|
|
2343
|
-
},
|
|
2344
|
-
onToggle: (event) => {
|
|
2345
|
-
if (unref$1(open)) {
|
|
2346
|
-
onClose(event);
|
|
2347
|
-
} else {
|
|
2348
|
-
onOpen(event);
|
|
2349
|
-
}
|
|
2350
|
-
},
|
|
2351
|
-
onShow: () => {
|
|
2352
|
-
emit("show", toggleReason.value);
|
|
2353
|
-
},
|
|
2354
|
-
onHide: () => {
|
|
2355
|
-
emit("hide", toggleReason.value);
|
|
2356
|
-
},
|
|
2357
|
-
onBeforeShow: () => {
|
|
2358
|
-
emit("before-show", toggleReason.value);
|
|
2359
|
-
},
|
|
2360
|
-
onBeforeHide: () => {
|
|
2361
|
-
emit("before-hide", toggleReason.value);
|
|
2362
|
-
},
|
|
2363
|
-
updatePopper
|
|
2364
|
-
});
|
|
2365
|
-
watch$1(() => props.disabled, (disabled) => {
|
|
2366
|
-
if (disabled && open.value) {
|
|
2367
|
-
open.value = false;
|
|
2368
|
-
}
|
|
2369
|
-
});
|
|
2370
|
-
const isFocusInsideContent = (event) => {
|
|
2371
|
-
var _a, _b;
|
|
2372
|
-
const popperContent = (_b = (_a = contentRef.value) == null ? void 0 : _a.contentRef) == null ? void 0 : _b.popperContentRef;
|
|
2373
|
-
const activeElement = (event == null ? void 0 : event.relatedTarget) || document.activeElement;
|
|
2374
|
-
return popperContent && popperContent.contains(activeElement);
|
|
2375
|
-
};
|
|
2376
|
-
onDeactivated(() => open.value && hide());
|
|
2377
|
-
expose({
|
|
2378
|
-
popperRef,
|
|
2379
|
-
contentRef,
|
|
2380
|
-
isFocusInsideContent,
|
|
2381
|
-
updatePopper,
|
|
2382
|
-
onOpen,
|
|
2383
|
-
onClose,
|
|
2384
|
-
hide
|
|
2385
|
-
});
|
|
2386
|
-
return (_ctx, _cache) => {
|
|
2387
|
-
return openBlock(), createBlock(unref$1(ElPopper), {
|
|
2388
|
-
ref_key: "popperRef",
|
|
2389
|
-
ref: popperRef,
|
|
2390
|
-
role: _ctx.role
|
|
2391
|
-
}, {
|
|
2392
|
-
default: withCtx(() => [
|
|
2393
|
-
createVNode(ElTooltipTrigger, {
|
|
2394
|
-
disabled: _ctx.disabled,
|
|
2395
|
-
trigger: _ctx.trigger,
|
|
2396
|
-
"trigger-keys": _ctx.triggerKeys,
|
|
2397
|
-
"virtual-ref": _ctx.virtualRef,
|
|
2398
|
-
"virtual-triggering": _ctx.virtualTriggering
|
|
2399
|
-
}, {
|
|
2400
|
-
default: withCtx(() => [
|
|
2401
|
-
_ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
|
|
2402
|
-
]),
|
|
2403
|
-
_: 3
|
|
2404
|
-
}, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
|
|
2405
|
-
createVNode(ElTooltipContent, {
|
|
2406
|
-
ref_key: "contentRef",
|
|
2407
|
-
ref: contentRef,
|
|
2408
|
-
"aria-label": _ctx.ariaLabel,
|
|
2409
|
-
"boundaries-padding": _ctx.boundariesPadding,
|
|
2410
|
-
content: _ctx.content,
|
|
2411
|
-
disabled: _ctx.disabled,
|
|
2412
|
-
effect: _ctx.effect,
|
|
2413
|
-
enterable: _ctx.enterable,
|
|
2414
|
-
"fallback-placements": _ctx.fallbackPlacements,
|
|
2415
|
-
"hide-after": _ctx.hideAfter,
|
|
2416
|
-
"gpu-acceleration": _ctx.gpuAcceleration,
|
|
2417
|
-
offset: _ctx.offset,
|
|
2418
|
-
persistent: _ctx.persistent,
|
|
2419
|
-
"popper-class": _ctx.popperClass,
|
|
2420
|
-
"popper-style": _ctx.popperStyle,
|
|
2421
|
-
placement: _ctx.placement,
|
|
2422
|
-
"popper-options": _ctx.popperOptions,
|
|
2423
|
-
pure: _ctx.pure,
|
|
2424
|
-
"raw-content": _ctx.rawContent,
|
|
2425
|
-
"reference-el": _ctx.referenceEl,
|
|
2426
|
-
"trigger-target-el": _ctx.triggerTargetEl,
|
|
2427
|
-
"show-after": _ctx.showAfter,
|
|
2428
|
-
strategy: _ctx.strategy,
|
|
2429
|
-
teleported: _ctx.teleported,
|
|
2430
|
-
transition: _ctx.transition,
|
|
2431
|
-
"virtual-triggering": _ctx.virtualTriggering,
|
|
2432
|
-
"z-index": _ctx.zIndex,
|
|
2433
|
-
"append-to": _ctx.appendTo
|
|
2434
|
-
}, {
|
|
2435
|
-
default: withCtx(() => [
|
|
2436
|
-
renderSlot(_ctx.$slots, "content", {}, () => [
|
|
2437
|
-
_ctx.rawContent ? (openBlock(), createElementBlock("span", {
|
|
2438
|
-
key: 0,
|
|
2439
|
-
innerHTML: _ctx.content
|
|
2440
|
-
}, null, 8, _hoisted_1$1)) : (openBlock(), createElementBlock("span", _hoisted_2$1, toDisplayString(_ctx.content), 1))
|
|
2441
|
-
]),
|
|
2442
|
-
_ctx.showArrow ? (openBlock(), createBlock(unref$1(ElPopperArrow), {
|
|
2443
|
-
key: 0,
|
|
2444
|
-
"arrow-offset": _ctx.arrowOffset
|
|
2445
|
-
}, null, 8, ["arrow-offset"])) : createCommentVNode("v-if", true)
|
|
2446
|
-
]),
|
|
2447
|
-
_: 3
|
|
2448
|
-
}, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "pure", "raw-content", "reference-el", "trigger-target-el", "show-after", "strategy", "teleported", "transition", "virtual-triggering", "z-index", "append-to"])
|
|
2449
|
-
]),
|
|
2450
|
-
_: 3
|
|
2451
|
-
}, 8, ["role"]);
|
|
2452
|
-
};
|
|
2453
|
-
}
|
|
2454
|
-
});
|
|
2455
|
-
var Tooltip = /* @__PURE__ */ _export_sfc$1(_sfc_main$4, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/tooltip.vue"]]);
|
|
2456
|
-
|
|
2457
|
-
const ElTooltip = withInstall(Tooltip);
|
|
2458
|
-
|
|
2459
|
-
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
2460
|
-
inheritAttrs: false
|
|
2461
|
-
});
|
|
2462
|
-
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2463
|
-
return renderSlot(_ctx.$slots, "default");
|
|
2464
|
-
}
|
|
2465
|
-
var Collection = /* @__PURE__ */ _export_sfc$1(_sfc_main$3, [["render", _sfc_render$1], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/collection/src/collection.vue"]]);
|
|
2466
|
-
|
|
2467
|
-
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
2468
|
-
name: "ElCollectionItem",
|
|
2469
|
-
inheritAttrs: false
|
|
2470
|
-
});
|
|
2471
|
-
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2472
|
-
return renderSlot(_ctx.$slots, "default");
|
|
2473
|
-
}
|
|
2474
|
-
var CollectionItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$2, [["render", _sfc_render], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/collection/src/collection-item.vue"]]);
|
|
2475
|
-
|
|
2476
|
-
const COLLECTION_ITEM_SIGN = `data-el-collection-item`;
|
|
2477
|
-
const createCollectionWithScope = (name) => {
|
|
2478
|
-
const COLLECTION_NAME = `El${name}Collection`;
|
|
2479
|
-
const COLLECTION_ITEM_NAME = `${COLLECTION_NAME}Item`;
|
|
2480
|
-
const COLLECTION_INJECTION_KEY = Symbol(COLLECTION_NAME);
|
|
2481
|
-
const COLLECTION_ITEM_INJECTION_KEY = Symbol(COLLECTION_ITEM_NAME);
|
|
2482
|
-
const ElCollection = {
|
|
2483
|
-
...Collection,
|
|
2484
|
-
name: COLLECTION_NAME,
|
|
2485
|
-
setup() {
|
|
2486
|
-
const collectionRef = ref(null);
|
|
2487
|
-
const itemMap = /* @__PURE__ */ new Map();
|
|
2488
|
-
const getItems = () => {
|
|
2489
|
-
const collectionEl = unref$1(collectionRef);
|
|
2490
|
-
if (!collectionEl)
|
|
2491
|
-
return [];
|
|
2492
|
-
const orderedNodes = Array.from(collectionEl.querySelectorAll(`[${COLLECTION_ITEM_SIGN}]`));
|
|
2493
|
-
const items = [...itemMap.values()];
|
|
2494
|
-
return items.sort((a, b) => orderedNodes.indexOf(a.ref) - orderedNodes.indexOf(b.ref));
|
|
2495
|
-
};
|
|
2496
|
-
provide(COLLECTION_INJECTION_KEY, {
|
|
2497
|
-
itemMap,
|
|
2498
|
-
getItems,
|
|
2499
|
-
collectionRef
|
|
2500
|
-
});
|
|
2501
|
-
}
|
|
2502
|
-
};
|
|
2503
|
-
const ElCollectionItem = {
|
|
2504
|
-
...CollectionItem,
|
|
2505
|
-
name: COLLECTION_ITEM_NAME,
|
|
2506
|
-
setup(_, { attrs }) {
|
|
2507
|
-
const collectionItemRef = ref(null);
|
|
2508
|
-
const collectionInjection = inject(COLLECTION_INJECTION_KEY, void 0);
|
|
2509
|
-
provide(COLLECTION_ITEM_INJECTION_KEY, {
|
|
2510
|
-
collectionItemRef
|
|
2511
|
-
});
|
|
2512
|
-
onMounted(() => {
|
|
2513
|
-
const collectionItemEl = unref$1(collectionItemRef);
|
|
2514
|
-
if (collectionItemEl) {
|
|
2515
|
-
collectionInjection.itemMap.set(collectionItemEl, {
|
|
2516
|
-
ref: collectionItemEl,
|
|
2517
|
-
...attrs
|
|
2518
|
-
});
|
|
2519
|
-
}
|
|
2520
|
-
});
|
|
2521
|
-
onBeforeUnmount(() => {
|
|
2522
|
-
const collectionItemEl = unref$1(collectionItemRef);
|
|
2523
|
-
collectionInjection.itemMap.delete(collectionItemEl);
|
|
2524
|
-
});
|
|
2525
|
-
}
|
|
2526
|
-
};
|
|
2527
|
-
return {
|
|
2528
|
-
COLLECTION_INJECTION_KEY,
|
|
2529
|
-
COLLECTION_ITEM_INJECTION_KEY,
|
|
2530
|
-
ElCollection,
|
|
2531
|
-
ElCollectionItem
|
|
2532
|
-
};
|
|
2533
|
-
};
|
|
2534
|
-
|
|
2535
|
-
const dropdownProps = buildProps({
|
|
2536
|
-
trigger: useTooltipTriggerProps.trigger,
|
|
2537
|
-
effect: {
|
|
2538
|
-
...useTooltipContentProps.effect,
|
|
2539
|
-
default: "light"
|
|
2540
|
-
},
|
|
2541
|
-
type: {
|
|
2542
|
-
type: definePropType(String)
|
|
2543
|
-
},
|
|
2544
|
-
placement: {
|
|
2545
|
-
type: definePropType(String),
|
|
2546
|
-
default: "bottom"
|
|
2547
|
-
},
|
|
2548
|
-
popperOptions: {
|
|
2549
|
-
type: definePropType(Object),
|
|
2550
|
-
default: () => ({})
|
|
2551
|
-
},
|
|
2552
|
-
id: String,
|
|
2553
|
-
size: {
|
|
2554
|
-
type: String,
|
|
2555
|
-
default: ""
|
|
2556
|
-
},
|
|
2557
|
-
splitButton: Boolean,
|
|
2558
|
-
hideOnClick: {
|
|
2559
|
-
type: Boolean,
|
|
2560
|
-
default: true
|
|
2561
|
-
},
|
|
2562
|
-
loop: {
|
|
2563
|
-
type: Boolean,
|
|
2564
|
-
default: true
|
|
2565
|
-
},
|
|
2566
|
-
showTimeout: {
|
|
2567
|
-
type: Number,
|
|
2568
|
-
default: 150
|
|
2569
|
-
},
|
|
2570
|
-
hideTimeout: {
|
|
2571
|
-
type: Number,
|
|
2572
|
-
default: 150
|
|
2573
|
-
},
|
|
2574
|
-
tabindex: {
|
|
2575
|
-
type: definePropType([Number, String]),
|
|
2576
|
-
default: 0
|
|
2577
|
-
},
|
|
2578
|
-
maxHeight: {
|
|
2579
|
-
type: definePropType([Number, String]),
|
|
2580
|
-
default: ""
|
|
2581
|
-
},
|
|
2582
|
-
popperClass: {
|
|
2583
|
-
type: String,
|
|
2584
|
-
default: ""
|
|
2585
|
-
},
|
|
2586
|
-
disabled: {
|
|
2587
|
-
type: Boolean,
|
|
2588
|
-
default: false
|
|
2589
|
-
},
|
|
2590
|
-
role: {
|
|
2591
|
-
type: String,
|
|
2592
|
-
default: "menu"
|
|
2593
|
-
},
|
|
2594
|
-
buttonProps: {
|
|
2595
|
-
type: definePropType(Object)
|
|
2596
|
-
},
|
|
2597
|
-
teleported: useTooltipContentProps.teleported
|
|
2598
|
-
});
|
|
2599
|
-
buildProps({
|
|
2600
|
-
command: {
|
|
2601
|
-
type: [Object, String, Number],
|
|
2602
|
-
default: () => ({})
|
|
2603
|
-
},
|
|
2604
|
-
disabled: Boolean,
|
|
2605
|
-
divided: Boolean,
|
|
2606
|
-
textValue: String,
|
|
2607
|
-
icon: {
|
|
2608
|
-
type: iconPropType
|
|
2609
|
-
}
|
|
2610
|
-
});
|
|
2611
|
-
buildProps({
|
|
2612
|
-
onKeydown: { type: definePropType(Function) }
|
|
2613
|
-
});
|
|
2614
|
-
createCollectionWithScope("Dropdown");
|
|
2615
|
-
|
|
2616
|
-
const popoverProps = buildProps({
|
|
2617
|
-
trigger: useTooltipTriggerProps.trigger,
|
|
2618
|
-
placement: dropdownProps.placement,
|
|
2619
|
-
disabled: useTooltipTriggerProps.disabled,
|
|
2620
|
-
visible: useTooltipContentProps.visible,
|
|
2621
|
-
transition: useTooltipContentProps.transition,
|
|
2622
|
-
popperOptions: dropdownProps.popperOptions,
|
|
2623
|
-
tabindex: dropdownProps.tabindex,
|
|
2624
|
-
content: useTooltipContentProps.content,
|
|
2625
|
-
popperStyle: useTooltipContentProps.popperStyle,
|
|
2626
|
-
popperClass: useTooltipContentProps.popperClass,
|
|
2627
|
-
enterable: {
|
|
2628
|
-
...useTooltipContentProps.enterable,
|
|
2629
|
-
default: true
|
|
2630
|
-
},
|
|
2631
|
-
effect: {
|
|
2632
|
-
...useTooltipContentProps.effect,
|
|
2633
|
-
default: "light"
|
|
2634
|
-
},
|
|
2635
|
-
teleported: useTooltipContentProps.teleported,
|
|
2636
|
-
title: String,
|
|
2637
|
-
width: {
|
|
2638
|
-
type: [String, Number],
|
|
2639
|
-
default: 150
|
|
2640
|
-
},
|
|
2641
|
-
offset: {
|
|
2642
|
-
type: Number,
|
|
2643
|
-
default: void 0
|
|
2644
|
-
},
|
|
2645
|
-
showAfter: {
|
|
2646
|
-
type: Number,
|
|
2647
|
-
default: 0
|
|
2648
|
-
},
|
|
2649
|
-
hideAfter: {
|
|
2650
|
-
type: Number,
|
|
2651
|
-
default: 200
|
|
2652
|
-
},
|
|
2653
|
-
autoClose: {
|
|
2654
|
-
type: Number,
|
|
2655
|
-
default: 0
|
|
2656
|
-
},
|
|
2657
|
-
showArrow: {
|
|
2658
|
-
type: Boolean,
|
|
2659
|
-
default: true
|
|
2660
|
-
},
|
|
2661
|
-
persistent: {
|
|
2662
|
-
type: Boolean,
|
|
2663
|
-
default: true
|
|
2664
|
-
},
|
|
2665
|
-
"onUpdate:visible": {
|
|
2666
|
-
type: Function
|
|
2667
|
-
}
|
|
2668
|
-
});
|
|
2669
|
-
const popoverEmits = {
|
|
2670
|
-
"update:visible": (value) => isBoolean(value),
|
|
2671
|
-
"before-enter": () => true,
|
|
2672
|
-
"before-leave": () => true,
|
|
2673
|
-
"after-enter": () => true,
|
|
2674
|
-
"after-leave": () => true
|
|
2675
|
-
};
|
|
2676
|
-
|
|
2677
|
-
const updateEventKeyRaw = `onUpdate:visible`;
|
|
2678
|
-
const __default__ = defineComponent({
|
|
2679
|
-
name: "ElPopover"
|
|
2680
|
-
});
|
|
2681
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
2682
|
-
...__default__,
|
|
2683
|
-
props: popoverProps,
|
|
2684
|
-
emits: popoverEmits,
|
|
2685
|
-
setup(__props, { expose, emit }) {
|
|
2686
|
-
const props = __props;
|
|
2687
|
-
const onUpdateVisible = computed(() => {
|
|
2688
|
-
return props[updateEventKeyRaw];
|
|
2689
|
-
});
|
|
2690
|
-
const ns = useNamespace("popover");
|
|
2691
|
-
const tooltipRef = ref();
|
|
2692
|
-
const popperRef = computed(() => {
|
|
2693
|
-
var _a;
|
|
2694
|
-
return (_a = unref$1(tooltipRef)) == null ? void 0 : _a.popperRef;
|
|
2695
|
-
});
|
|
2696
|
-
const style = computed(() => {
|
|
2697
|
-
return [
|
|
2698
|
-
{
|
|
2699
|
-
width: addUnit(props.width)
|
|
2700
|
-
},
|
|
2701
|
-
props.popperStyle
|
|
2702
|
-
];
|
|
2703
|
-
});
|
|
2704
|
-
const kls = computed(() => {
|
|
2705
|
-
return [ns.b(), props.popperClass, { [ns.m("plain")]: !!props.content }];
|
|
2706
|
-
});
|
|
2707
|
-
const gpuAcceleration = computed(() => {
|
|
2708
|
-
return props.transition === `${ns.namespace.value}-fade-in-linear`;
|
|
2709
|
-
});
|
|
2710
|
-
const hide = () => {
|
|
2711
|
-
var _a;
|
|
2712
|
-
(_a = tooltipRef.value) == null ? void 0 : _a.hide();
|
|
2713
|
-
};
|
|
2714
|
-
const beforeEnter = () => {
|
|
2715
|
-
emit("before-enter");
|
|
2716
|
-
};
|
|
2717
|
-
const beforeLeave = () => {
|
|
2718
|
-
emit("before-leave");
|
|
2719
|
-
};
|
|
2720
|
-
const afterEnter = () => {
|
|
2721
|
-
emit("after-enter");
|
|
2722
|
-
};
|
|
2723
|
-
const afterLeave = () => {
|
|
2724
|
-
emit("update:visible", false);
|
|
2725
|
-
emit("after-leave");
|
|
2726
|
-
};
|
|
2727
|
-
expose({
|
|
2728
|
-
popperRef,
|
|
2729
|
-
hide
|
|
2730
|
-
});
|
|
2731
|
-
return (_ctx, _cache) => {
|
|
2732
|
-
return openBlock(), createBlock(unref$1(ElTooltip), mergeProps({
|
|
2733
|
-
ref_key: "tooltipRef",
|
|
2734
|
-
ref: tooltipRef
|
|
2735
|
-
}, _ctx.$attrs, {
|
|
2736
|
-
trigger: _ctx.trigger,
|
|
2737
|
-
placement: _ctx.placement,
|
|
2738
|
-
disabled: _ctx.disabled,
|
|
2739
|
-
visible: _ctx.visible,
|
|
2740
|
-
transition: _ctx.transition,
|
|
2741
|
-
"popper-options": _ctx.popperOptions,
|
|
2742
|
-
tabindex: _ctx.tabindex,
|
|
2743
|
-
content: _ctx.content,
|
|
2744
|
-
offset: _ctx.offset,
|
|
2745
|
-
"show-after": _ctx.showAfter,
|
|
2746
|
-
"hide-after": _ctx.hideAfter,
|
|
2747
|
-
"auto-close": _ctx.autoClose,
|
|
2748
|
-
"show-arrow": _ctx.showArrow,
|
|
2749
|
-
"aria-label": _ctx.title,
|
|
2750
|
-
effect: _ctx.effect,
|
|
2751
|
-
enterable: _ctx.enterable,
|
|
2752
|
-
"popper-class": unref$1(kls),
|
|
2753
|
-
"popper-style": unref$1(style),
|
|
2754
|
-
teleported: _ctx.teleported,
|
|
2755
|
-
persistent: _ctx.persistent,
|
|
2756
|
-
"gpu-acceleration": unref$1(gpuAcceleration),
|
|
2757
|
-
"onUpdate:visible": unref$1(onUpdateVisible),
|
|
2758
|
-
onBeforeShow: beforeEnter,
|
|
2759
|
-
onBeforeHide: beforeLeave,
|
|
2760
|
-
onShow: afterEnter,
|
|
2761
|
-
onHide: afterLeave
|
|
2762
|
-
}), {
|
|
2763
|
-
content: withCtx(() => [
|
|
2764
|
-
_ctx.title ? (openBlock(), createElementBlock("div", {
|
|
2765
|
-
key: 0,
|
|
2766
|
-
class: normalizeClass(unref$1(ns).e("title")),
|
|
2767
|
-
role: "title"
|
|
2768
|
-
}, toDisplayString(_ctx.title), 3)) : createCommentVNode("v-if", true),
|
|
2769
|
-
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
2770
|
-
createTextVNode(toDisplayString(_ctx.content), 1)
|
|
2771
|
-
])
|
|
2772
|
-
]),
|
|
2773
|
-
default: withCtx(() => [
|
|
2774
|
-
_ctx.$slots.reference ? renderSlot(_ctx.$slots, "reference", { key: 0 }) : createCommentVNode("v-if", true)
|
|
2775
|
-
]),
|
|
2776
|
-
_: 3
|
|
2777
|
-
}, 16, ["trigger", "placement", "disabled", "visible", "transition", "popper-options", "tabindex", "content", "offset", "show-after", "hide-after", "auto-close", "show-arrow", "aria-label", "effect", "enterable", "popper-class", "popper-style", "teleported", "persistent", "gpu-acceleration", "onUpdate:visible"]);
|
|
2778
|
-
};
|
|
2779
|
-
}
|
|
2780
|
-
});
|
|
2781
|
-
var Popover = /* @__PURE__ */ _export_sfc$1(_sfc_main$1, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popover/src/popover.vue"]]);
|
|
2782
|
-
|
|
2783
|
-
const attachEvents = (el, binding) => {
|
|
2784
|
-
const popperComponent = binding.arg || binding.value;
|
|
2785
|
-
const popover = popperComponent == null ? void 0 : popperComponent.popperRef;
|
|
2786
|
-
if (popover) {
|
|
2787
|
-
popover.triggerRef = el;
|
|
2788
|
-
}
|
|
2789
|
-
};
|
|
2790
|
-
var PopoverDirective = {
|
|
2791
|
-
mounted(el, binding) {
|
|
2792
|
-
attachEvents(el, binding);
|
|
2793
|
-
},
|
|
2794
|
-
updated(el, binding) {
|
|
2795
|
-
attachEvents(el, binding);
|
|
2796
|
-
}
|
|
2797
|
-
};
|
|
2798
|
-
const VPopover = "popover";
|
|
2799
|
-
|
|
2800
|
-
const ElPopoverDirective = withInstallDirective(PopoverDirective, VPopover);
|
|
2801
|
-
const ElPopover = withInstall(Popover, {
|
|
2802
|
-
directive: ElPopoverDirective
|
|
2803
|
-
});
|
|
2804
|
-
|
|
2805
|
-
const _hoisted_1 = ["onClick"];
|
|
2806
|
-
const _hoisted_2 = { style: { "display": "inline-block" } };
|
|
2807
|
-
const _hoisted_3 = { class: "slot-component-box" };
|
|
2808
9
|
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
2809
10
|
__name: "index",
|
|
2810
11
|
props: {
|
|
@@ -2816,39 +17,150 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2816
17
|
placement: { type: String, required: false, default: "bottom" },
|
|
2817
18
|
maxCount: { type: Number, required: false, default: 6 },
|
|
2818
19
|
offset: { type: Number, required: false, default: 0 },
|
|
2819
|
-
popperOptions: { type: Object, required: false, default: () => ({}) }
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
20
|
+
popperOptions: { type: Object, required: false, default: () => ({}) },
|
|
21
|
+
showFullPath: { type: Boolean, required: true, default: false },
|
|
22
|
+
fieldNames: { type: Object, required: false, default: () => ({
|
|
23
|
+
label: "value",
|
|
24
|
+
children: "children"
|
|
25
|
+
}) },
|
|
26
|
+
treeOptions: { type: null, required: false, default: () => ({}) },
|
|
27
|
+
path: { type: null, required: false },
|
|
28
|
+
nodeKey: { type: String, required: false },
|
|
29
|
+
mode: { type: String, required: true, default: "tree" }
|
|
30
|
+
},
|
|
31
|
+
emits: ["update:modelValue", "input", "change", "node-click", "update:path"],
|
|
32
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
33
|
+
__expose();
|
|
2823
34
|
const emits = __emit;
|
|
2824
35
|
const props = __props;
|
|
36
|
+
const nodeKey = computed(() => props.nodeKey || props.fieldNames.label);
|
|
37
|
+
const innerPath = ref("");
|
|
38
|
+
watch(
|
|
39
|
+
() => props.path,
|
|
40
|
+
(nval) => {
|
|
41
|
+
if (nval && nval !== innerPath.value) {
|
|
42
|
+
innerPath.value = nval;
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{ immediate: true }
|
|
46
|
+
);
|
|
47
|
+
const inputRef = ref(null);
|
|
48
|
+
function hidePopover() {
|
|
49
|
+
visible.value = false;
|
|
50
|
+
}
|
|
51
|
+
function emitHidePopover() {
|
|
52
|
+
document.documentElement.click();
|
|
53
|
+
}
|
|
54
|
+
onMounted(() => {
|
|
55
|
+
document.addEventListener("click", hidePopover);
|
|
56
|
+
});
|
|
57
|
+
onUnmounted(() => {
|
|
58
|
+
document.removeEventListener("click", hidePopover);
|
|
59
|
+
});
|
|
60
|
+
const loadFn = computed(() => props?.treeOptions?.load ?? void 0);
|
|
61
|
+
const isLazy = computed(() => props?.treeOptions?.lazy ?? loadFn.value);
|
|
62
|
+
const updateInputValue = async (val) => {
|
|
63
|
+
emits("update:path", val.path || "");
|
|
64
|
+
if (props.mode === "tree") {
|
|
65
|
+
if (isLazy.value) {
|
|
66
|
+
if (props.showFullPath) {
|
|
67
|
+
inputValue.value = val.pathName || "";
|
|
68
|
+
} else {
|
|
69
|
+
inputValue.value = val.name || "";
|
|
70
|
+
}
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
let node = treeRef.value.treeRef.getNode(val);
|
|
74
|
+
console.log("treeNodeClick\u56DE\u8C03:", val, node);
|
|
75
|
+
let res = [node.data[props.fieldNames.label] || ""];
|
|
76
|
+
if (props.showFullPath) {
|
|
77
|
+
while (node.parent && node.parent.data[props.fieldNames.label]) {
|
|
78
|
+
node = node.parent;
|
|
79
|
+
res.unshift(node.data[props.fieldNames.label]);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
inputValue.value = res.join("/");
|
|
83
|
+
} else {
|
|
84
|
+
let res = val[props.fieldNames.label] || "";
|
|
85
|
+
inputValue.value = res;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const treeNodeClick = (val) => {
|
|
89
|
+
updateInputValue(val);
|
|
90
|
+
emitHidePopover();
|
|
91
|
+
emits("node-click", val);
|
|
92
|
+
emits("update:modelValue", inputValue.value);
|
|
93
|
+
emits("change", inputValue.value);
|
|
94
|
+
};
|
|
95
|
+
const currentNodeKey = ref("");
|
|
2825
96
|
const domPopover = ref(null);
|
|
2826
97
|
const currentSize = useModelValue(props, "size");
|
|
2827
98
|
const currentIsView = useModelValue(props, "isView");
|
|
99
|
+
watch(
|
|
100
|
+
() => props.isView,
|
|
101
|
+
(nval) => {
|
|
102
|
+
if (nval) {
|
|
103
|
+
emitHidePopover();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
);
|
|
2828
107
|
const inputValue = useModelValue(props, "modelValue");
|
|
108
|
+
const treeRef = ref(null);
|
|
2829
109
|
const inputIng = (val) => {
|
|
110
|
+
hasInputValue.value = getInputValueStatus();
|
|
111
|
+
getSelectOptions().then((res) => {
|
|
112
|
+
checkPopoverVisible(res);
|
|
113
|
+
nextTick(() => {
|
|
114
|
+
domPopover.value?.popperRef?.popperInstanceRef?.forceUpdate();
|
|
115
|
+
});
|
|
116
|
+
});
|
|
2830
117
|
emits("update:modelValue", val);
|
|
118
|
+
emits("input", val);
|
|
119
|
+
};
|
|
120
|
+
const changeEvenet = (val) => {
|
|
2831
121
|
emits("change", val);
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
122
|
+
};
|
|
123
|
+
const inputClear = () => {
|
|
124
|
+
currentNodeKey.value = "";
|
|
125
|
+
hasInputValue.value = getInputValueStatus();
|
|
126
|
+
setTimeout(() => {
|
|
127
|
+
visible.value = true;
|
|
2835
128
|
});
|
|
2836
129
|
};
|
|
2837
|
-
const
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
130
|
+
const updateTreeSelectKey = () => {
|
|
131
|
+
if (props.showFullPath) {
|
|
132
|
+
let key = inputValue.value.split("/");
|
|
133
|
+
currentNodeKey.value = key[key.length - 1] || "";
|
|
134
|
+
} else {
|
|
135
|
+
currentNodeKey.value = inputValue.value || "";
|
|
136
|
+
}
|
|
2844
137
|
};
|
|
2845
|
-
const
|
|
2846
|
-
|
|
138
|
+
const checkPopoverVisible = (list) => {
|
|
139
|
+
if (list.length > 0) {
|
|
140
|
+
visible.value = !currentIsView.value && true;
|
|
141
|
+
selectOptions.value = list;
|
|
142
|
+
} else {
|
|
143
|
+
visible.value = false;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const visible = ref(false);
|
|
147
|
+
const hasInputValue = ref(false);
|
|
148
|
+
const getInputValueStatus = () => inputValue.value.length > 0;
|
|
149
|
+
const inputClick = () => {
|
|
150
|
+
hasInputValue.value = getInputValueStatus();
|
|
151
|
+
emitHidePopover();
|
|
152
|
+
getCurrentPopoverWidth();
|
|
153
|
+
getSelectOptions().then((res) => {
|
|
154
|
+
checkPopoverVisible(res);
|
|
155
|
+
});
|
|
2847
156
|
};
|
|
2848
|
-
const handleSelect = (item) => {
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
157
|
+
const handleSelect = async (item) => {
|
|
158
|
+
if (item.disabled) return;
|
|
159
|
+
updateInputValue(item);
|
|
160
|
+
emitHidePopover();
|
|
161
|
+
emits("node-click", item);
|
|
162
|
+
emits("update:modelValue", inputValue.value);
|
|
163
|
+
emits("change", inputValue.value);
|
|
2852
164
|
};
|
|
2853
165
|
const getCurrentWidth = (size) => {
|
|
2854
166
|
let width = 0;
|
|
@@ -2861,8 +173,33 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2861
173
|
}
|
|
2862
174
|
return width;
|
|
2863
175
|
};
|
|
2864
|
-
const
|
|
2865
|
-
|
|
176
|
+
const getList = (list, value) => {
|
|
177
|
+
if (!value) return list;
|
|
178
|
+
let res = [];
|
|
179
|
+
for (let i = 0; i < list.length; i++) {
|
|
180
|
+
if (list[i][props.fieldNames.label].includes(value)) {
|
|
181
|
+
res.push(list[i]);
|
|
182
|
+
}
|
|
183
|
+
if (list[i][props.fieldNames.children] && list[i][props.fieldNames.children].length > 0) {
|
|
184
|
+
res.push(...getList(list[i][props.fieldNames.children], value));
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return res;
|
|
188
|
+
};
|
|
189
|
+
const getSelectOptions = async () => {
|
|
190
|
+
updateTreeSelectKey();
|
|
191
|
+
let res = [];
|
|
192
|
+
if (!isLazy.value) {
|
|
193
|
+
res = getList(props.options, currentNodeKey.value);
|
|
194
|
+
} else {
|
|
195
|
+
if (!inputValue.value) {
|
|
196
|
+
res = getList([""], null);
|
|
197
|
+
} else {
|
|
198
|
+
let tmpArr = await props.treeOptions.search(currentNodeKey.value);
|
|
199
|
+
res = getList(tmpArr, currentNodeKey.value);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return res;
|
|
2866
203
|
};
|
|
2867
204
|
const selectOptions = ref([]);
|
|
2868
205
|
const currentWidth = computed(() => {
|
|
@@ -2878,105 +215,27 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2878
215
|
const value = $completeEL.value?.offsetWidth;
|
|
2879
216
|
currentPopoverWidth.value = value ? value + "px" : currentWidth.value;
|
|
2880
217
|
};
|
|
2881
|
-
watch
|
|
218
|
+
watch(
|
|
2882
219
|
() => props.options,
|
|
2883
220
|
() => {
|
|
2884
|
-
|
|
221
|
+
getSelectOptions().then((res) => {
|
|
222
|
+
selectOptions.value = res;
|
|
223
|
+
});
|
|
2885
224
|
}
|
|
2886
225
|
);
|
|
2887
|
-
|
|
2888
|
-
return
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
visible: visible.value,
|
|
2901
|
-
placement: _ctx.placement,
|
|
2902
|
-
width: currentPopoverWidth.value,
|
|
2903
|
-
"popper-class": "autocomplete-popover",
|
|
2904
|
-
"show-arrow": false,
|
|
2905
|
-
offset: _ctx.offset,
|
|
2906
|
-
"popper-options": _ctx.popperOptions
|
|
2907
|
-
}, {
|
|
2908
|
-
reference: withCtx(() => [
|
|
2909
|
-
createElementVNode("div", _hoisted_3, [
|
|
2910
|
-
createVNode(unref$1(DasInput), mergeProps({
|
|
2911
|
-
modelValue: unref$1(inputValue),
|
|
2912
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(inputValue) ? inputValue.value = $event : null),
|
|
2913
|
-
size: unref$1(currentSize),
|
|
2914
|
-
width: currentWidth.value,
|
|
2915
|
-
isView: unref$1(currentIsView)
|
|
2916
|
-
}, _ctx.$attrs, {
|
|
2917
|
-
onFocus: inputFocus,
|
|
2918
|
-
onBlur: inputBlur,
|
|
2919
|
-
onInput: inputIng
|
|
2920
|
-
}), createSlots({
|
|
2921
|
-
_: 2
|
|
2922
|
-
/* DYNAMIC */
|
|
2923
|
-
}, [
|
|
2924
|
-
renderList(_ctx.$slots, (_item, key, index) => {
|
|
2925
|
-
return {
|
|
2926
|
-
name: key,
|
|
2927
|
-
fn: withCtx(() => [
|
|
2928
|
-
renderSlot(_ctx.$slots, key, {}, void 0, true)
|
|
2929
|
-
])
|
|
2930
|
-
};
|
|
2931
|
-
})
|
|
2932
|
-
]), 1040, ["modelValue", "size", "width", "isView"])
|
|
2933
|
-
])
|
|
2934
|
-
]),
|
|
2935
|
-
default: withCtx(() => [
|
|
2936
|
-
withDirectives((openBlock(), createElementBlock(
|
|
2937
|
-
"div",
|
|
2938
|
-
{
|
|
2939
|
-
class: "autocomplete-select-box",
|
|
2940
|
-
style: normalizeStyle(`max-height: ${32 * _ctx.maxCount}px;`)
|
|
2941
|
-
},
|
|
2942
|
-
[
|
|
2943
|
-
(openBlock(true), createElementBlock(
|
|
2944
|
-
Fragment,
|
|
2945
|
-
null,
|
|
2946
|
-
renderList(selectOptions.value, (item) => {
|
|
2947
|
-
return openBlock(), createElementBlock("div", {
|
|
2948
|
-
onClick: ($event) => handleSelect(item),
|
|
2949
|
-
class: normalizeClass(["select-label", { "current-select-label": item.value === unref$1(inputValue) }])
|
|
2950
|
-
}, [
|
|
2951
|
-
withDirectives((openBlock(), createElementBlock("span", _hoisted_2, [
|
|
2952
|
-
createTextVNode(
|
|
2953
|
-
toDisplayString(item.value),
|
|
2954
|
-
1
|
|
2955
|
-
/* TEXT */
|
|
2956
|
-
)
|
|
2957
|
-
])), [
|
|
2958
|
-
[unref$1(vDasTooltip)]
|
|
2959
|
-
])
|
|
2960
|
-
], 10, _hoisted_1);
|
|
2961
|
-
}),
|
|
2962
|
-
256
|
|
2963
|
-
/* UNKEYED_FRAGMENT */
|
|
2964
|
-
))
|
|
2965
|
-
],
|
|
2966
|
-
4
|
|
2967
|
-
/* STYLE */
|
|
2968
|
-
)), [
|
|
2969
|
-
[unref$1(vOverlay)]
|
|
2970
|
-
])
|
|
2971
|
-
]),
|
|
2972
|
-
_: 3
|
|
2973
|
-
/* FORWARDED */
|
|
2974
|
-
}, 8, ["visible", "placement", "width", "offset", "popper-options"])
|
|
2975
|
-
],
|
|
2976
|
-
4
|
|
2977
|
-
/* STYLE */
|
|
2978
|
-
);
|
|
2979
|
-
};
|
|
226
|
+
const __returned__ = { emits, props, nodeKey, innerPath, inputRef, hidePopover, emitHidePopover, loadFn, isLazy, updateInputValue, treeNodeClick, currentNodeKey, domPopover, currentSize, currentIsView, inputValue, treeRef, inputIng, changeEvenet, inputClear, updateTreeSelectKey, checkPopoverVisible, visible, hasInputValue, getInputValueStatus, inputClick, handleSelect, getCurrentWidth, getList, getSelectOptions, selectOptions, currentWidth, $completeEL, currentPopoverWidth, getCurrentPopoverWidth, get DasInput() {
|
|
227
|
+
return DasInput;
|
|
228
|
+
}, get vDasTooltip() {
|
|
229
|
+
return vDasTooltip;
|
|
230
|
+
}, get vOverlay() {
|
|
231
|
+
return vOverlay;
|
|
232
|
+
}, get DasTree() {
|
|
233
|
+
return DasTree;
|
|
234
|
+
}, get RecycleScroller() {
|
|
235
|
+
return RecycleScroller;
|
|
236
|
+
} };
|
|
237
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
238
|
+
return __returned__;
|
|
2980
239
|
}
|
|
2981
240
|
});
|
|
2982
241
|
|
|
@@ -2988,9 +247,139 @@ var _export_sfc = (sfc, props) => {
|
|
|
2988
247
|
return target;
|
|
2989
248
|
};
|
|
2990
249
|
|
|
2991
|
-
|
|
250
|
+
const _hoisted_1 = ["onClick"];
|
|
251
|
+
const _hoisted_2 = { style: { "display": "inline-block" } };
|
|
252
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
253
|
+
const _component_el_popover = resolveComponent("el-popover");
|
|
254
|
+
return openBlock(), createElementBlock(
|
|
255
|
+
"div",
|
|
256
|
+
{
|
|
257
|
+
class: "autocomplete-page",
|
|
258
|
+
ref: "$completeEL",
|
|
259
|
+
style: normalizeStyle(`width:${$setup.currentWidth}`)
|
|
260
|
+
},
|
|
261
|
+
[
|
|
262
|
+
createVNode(_component_el_popover, {
|
|
263
|
+
ref: "domPopover",
|
|
264
|
+
visible: $setup.visible,
|
|
265
|
+
placement: $props.placement,
|
|
266
|
+
width: $setup.currentPopoverWidth,
|
|
267
|
+
"popper-class": "autocomplete-popover",
|
|
268
|
+
"show-arrow": false,
|
|
269
|
+
offset: $props.offset,
|
|
270
|
+
"popper-options": $props.popperOptions
|
|
271
|
+
}, {
|
|
272
|
+
reference: withCtx(() => [
|
|
273
|
+
createElementVNode("div", {
|
|
274
|
+
class: "slot-component-box",
|
|
275
|
+
onClick: withModifiers($setup.inputClick, ["stop"])
|
|
276
|
+
}, [
|
|
277
|
+
createVNode($setup["DasInput"], mergeProps({
|
|
278
|
+
ref: "inputRef",
|
|
279
|
+
modelValue: $setup.inputValue,
|
|
280
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $setup.inputValue = $event),
|
|
281
|
+
modelModifiers: { trim: true },
|
|
282
|
+
size: $setup.currentSize,
|
|
283
|
+
width: $setup.currentWidth,
|
|
284
|
+
isView: $setup.currentIsView
|
|
285
|
+
}, _ctx.$attrs, {
|
|
286
|
+
onClear: $setup.inputClear,
|
|
287
|
+
onInput: $setup.inputIng,
|
|
288
|
+
onChange: $setup.changeEvenet
|
|
289
|
+
}), createSlots({
|
|
290
|
+
_: 2
|
|
291
|
+
/* DYNAMIC */
|
|
292
|
+
}, [
|
|
293
|
+
renderList(_ctx.$slots, (_item, key, index) => {
|
|
294
|
+
return {
|
|
295
|
+
name: key,
|
|
296
|
+
fn: withCtx(() => [
|
|
297
|
+
renderSlot(_ctx.$slots, key, {}, void 0, true)
|
|
298
|
+
])
|
|
299
|
+
};
|
|
300
|
+
})
|
|
301
|
+
]), 1040, ["modelValue", "size", "width", "isView"])
|
|
302
|
+
])
|
|
303
|
+
]),
|
|
304
|
+
default: withCtx(() => [
|
|
305
|
+
withDirectives((openBlock(), createElementBlock(
|
|
306
|
+
"div",
|
|
307
|
+
{
|
|
308
|
+
class: "autocomplete-select-box",
|
|
309
|
+
style: normalizeStyle(`max-height: ${32 * $props.maxCount}px;`),
|
|
310
|
+
onClick: _cache[2] || (_cache[2] = withModifiers(() => {
|
|
311
|
+
}, ["stop"]))
|
|
312
|
+
},
|
|
313
|
+
[
|
|
314
|
+
withDirectives((openBlock(), createBlock($setup["RecycleScroller"], {
|
|
315
|
+
key: $setup.selectOptions.length,
|
|
316
|
+
items: $setup.selectOptions,
|
|
317
|
+
"item-size": 32,
|
|
318
|
+
"key-field": $props.fieldNames.value || $props.fieldNames.label,
|
|
319
|
+
class: "virtual-list"
|
|
320
|
+
}, {
|
|
321
|
+
default: withCtx(({ item, index }) => [
|
|
322
|
+
createElementVNode("div", {
|
|
323
|
+
onClick: ($event) => $setup.handleSelect(item),
|
|
324
|
+
class: normalizeClass([
|
|
325
|
+
"select-label",
|
|
326
|
+
{ "current-select-label": item[$props.fieldNames.label] === $setup.currentNodeKey },
|
|
327
|
+
{ "is-disabled": item.disabled }
|
|
328
|
+
])
|
|
329
|
+
}, [
|
|
330
|
+
withDirectives((openBlock(), createElementBlock("span", _hoisted_2, [
|
|
331
|
+
createTextVNode(
|
|
332
|
+
toDisplayString(item[$props.fieldNames.label]),
|
|
333
|
+
1
|
|
334
|
+
/* TEXT */
|
|
335
|
+
)
|
|
336
|
+
])), [
|
|
337
|
+
[$setup["vDasTooltip"]]
|
|
338
|
+
])
|
|
339
|
+
], 10, _hoisted_1)
|
|
340
|
+
]),
|
|
341
|
+
_: 1
|
|
342
|
+
/* STABLE */
|
|
343
|
+
}, 8, ["items", "key-field"])), [
|
|
344
|
+
[vShow, $setup.props.mode === "list" || $setup.hasInputValue]
|
|
345
|
+
]),
|
|
346
|
+
$setup.props.mode === "tree" ? withDirectives((openBlock(), createBlock($setup["DasTree"], mergeProps({
|
|
347
|
+
key: 0,
|
|
348
|
+
width: "120px",
|
|
349
|
+
filterMode: "input",
|
|
350
|
+
"node-key": $setup.nodeKey,
|
|
351
|
+
ref: "treeRef",
|
|
352
|
+
"is-ellipsis": "",
|
|
353
|
+
data: $setup.props.options,
|
|
354
|
+
showFilterInput: false
|
|
355
|
+
}, $props.treeOptions, {
|
|
356
|
+
props: { ...$props.fieldNames },
|
|
357
|
+
modelValue: $setup.currentNodeKey,
|
|
358
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $setup.currentNodeKey = $event),
|
|
359
|
+
path: $setup.innerPath,
|
|
360
|
+
"onUpdate:path": _cache[1] || (_cache[1] = ($event) => $setup.innerPath = $event),
|
|
361
|
+
onNodeClick: $setup.treeNodeClick
|
|
362
|
+
}), null, 16, ["node-key", "data", "props", "modelValue", "path"])), [
|
|
363
|
+
[vShow, !$setup.hasInputValue]
|
|
364
|
+
]) : createCommentVNode("v-if", true)
|
|
365
|
+
],
|
|
366
|
+
4
|
|
367
|
+
/* STYLE */
|
|
368
|
+
)), [
|
|
369
|
+
[$setup["vOverlay"]]
|
|
370
|
+
])
|
|
371
|
+
]),
|
|
372
|
+
_: 3
|
|
373
|
+
/* FORWARDED */
|
|
374
|
+
}, 8, ["visible", "placement", "width", "offset", "popper-options"])
|
|
375
|
+
],
|
|
376
|
+
4
|
|
377
|
+
/* STYLE */
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
var Autocomplete = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-171bc33d"], ["__file", "/Users/xiecp/das/das-fe/framework/packages/das-ui/packages/components/autocomplete/src/index.vue"]]);
|
|
2992
381
|
|
|
2993
382
|
const DasAutocompleteRef = () => ref(null);
|
|
2994
|
-
const DasAutocomplete = withInstall
|
|
383
|
+
const DasAutocomplete = withInstall(Autocomplete);
|
|
2995
384
|
|
|
2996
385
|
export { DasAutocomplete, DasAutocompleteRef, DasAutocomplete as default };
|