@histoire/vendors 0.8.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/LICENSE +21 -0
- package/dist/client/floating-vue.d.ts +2 -0
- package/dist/client/floating-vue.js +3346 -0
- package/dist/client/iconify.d.ts +1 -0
- package/dist/client/iconify.js +2070 -0
- package/dist/client/index.js +27 -0
- package/dist/client/index2.js +168 -0
- package/dist/client/pinia.d.ts +1 -0
- package/dist/client/pinia.js +1936 -0
- package/dist/client/scroll.d.ts +1 -0
- package/dist/client/scroll.js +64 -0
- package/dist/client/shiki.d.ts +1 -0
- package/dist/client/shiki.js +2301 -0
- package/dist/client/vue-router.d.ts +1 -0
- package/dist/client/vue-router.js +3465 -0
- package/dist/client/vue-use.d.ts +1 -0
- package/dist/client/vue-use.js +6891 -0
- package/dist/client/vue.d.ts +1 -0
- package/dist/client/vue.js +1 -0
- package/dist/client/vue.runtime.esm-bundler.js +11548 -0
- package/entries.js +10 -0
- package/package.json +43 -0
- package/rollup.config.js +37 -0
- package/src/client/floating-vue.ts +2 -0
- package/src/client/iconify.ts +1 -0
- package/src/client/pinia.ts +1 -0
- package/src/client/scroll.ts +1 -0
- package/src/client/shiki.ts +1 -0
- package/src/client/vue-router.ts +1 -0
- package/src/client/vue-use.ts +1 -0
- package/src/client/vue.ts +1 -0
- package/tsconfig.json +36 -0
|
@@ -0,0 +1,3346 @@
|
|
|
1
|
+
import { d as defineComponent, o as openBlock, c as createElementBlock, m as mergeProps, r as renderSlot, n as normalizeProps, g as guardReactiveProps, a as nextTick, w as withScopeId, p as pushScopeId, b as popScopeId, e as createBlock, f as createBaseVNode, h as resolveComponent, i as normalizeClass, j as normalizeStyle, k as withKeys, F as Fragment, l as createCommentVNode, q as withCtx, s as createVNode, t as toDisplayString, u as ref, v as createApp, x as h } from './vue.runtime.esm-bundler.js';
|
|
2
|
+
|
|
3
|
+
function getBasePlacement(placement) {
|
|
4
|
+
return placement.split('-')[0];
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function getAlignment(placement) {
|
|
8
|
+
return placement.split('-')[1];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function getMainAxisFromPlacement(placement) {
|
|
12
|
+
return ['top', 'bottom'].includes(getBasePlacement(placement)) ? 'x' : 'y';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function getLengthFromAxis(axis) {
|
|
16
|
+
return axis === 'y' ? 'height' : 'width';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function computeCoordsFromPlacement(_ref) {
|
|
20
|
+
let {
|
|
21
|
+
reference,
|
|
22
|
+
floating,
|
|
23
|
+
placement
|
|
24
|
+
} = _ref;
|
|
25
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
26
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
27
|
+
let coords;
|
|
28
|
+
|
|
29
|
+
switch (getBasePlacement(placement)) {
|
|
30
|
+
case 'top':
|
|
31
|
+
coords = {
|
|
32
|
+
x: commonX,
|
|
33
|
+
y: reference.y - floating.height
|
|
34
|
+
};
|
|
35
|
+
break;
|
|
36
|
+
|
|
37
|
+
case 'bottom':
|
|
38
|
+
coords = {
|
|
39
|
+
x: commonX,
|
|
40
|
+
y: reference.y + reference.height
|
|
41
|
+
};
|
|
42
|
+
break;
|
|
43
|
+
|
|
44
|
+
case 'right':
|
|
45
|
+
coords = {
|
|
46
|
+
x: reference.x + reference.width,
|
|
47
|
+
y: commonY
|
|
48
|
+
};
|
|
49
|
+
break;
|
|
50
|
+
|
|
51
|
+
case 'left':
|
|
52
|
+
coords = {
|
|
53
|
+
x: reference.x - floating.width,
|
|
54
|
+
y: commonY
|
|
55
|
+
};
|
|
56
|
+
break;
|
|
57
|
+
|
|
58
|
+
default:
|
|
59
|
+
coords = {
|
|
60
|
+
x: reference.x,
|
|
61
|
+
y: reference.y
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const mainAxis = getMainAxisFromPlacement(placement);
|
|
66
|
+
const length = getLengthFromAxis(mainAxis);
|
|
67
|
+
|
|
68
|
+
switch (getAlignment(placement)) {
|
|
69
|
+
case 'start':
|
|
70
|
+
coords[mainAxis] = coords[mainAxis] - (reference[length] / 2 - floating[length] / 2);
|
|
71
|
+
break;
|
|
72
|
+
|
|
73
|
+
case 'end':
|
|
74
|
+
coords[mainAxis] = coords[mainAxis] + (reference[length] / 2 - floating[length] / 2);
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return coords;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const computePosition$1 = async (reference, floating, config) => {
|
|
82
|
+
const {
|
|
83
|
+
placement = 'bottom',
|
|
84
|
+
strategy = 'absolute',
|
|
85
|
+
middleware = [],
|
|
86
|
+
platform
|
|
87
|
+
} = config;
|
|
88
|
+
|
|
89
|
+
if (process.env.NODE_ENV !== "production") {
|
|
90
|
+
if (platform == null) {
|
|
91
|
+
console.error(['Floating UI: `platform` property was not passed to config. If you', 'want to use Floating UI on the web, install @floating-ui/dom', 'instead of the /core package. Otherwise, you can create your own', '`platform`: https://floating-ui.com/docs/platform'].join(' '));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (middleware.filter(_ref => {
|
|
95
|
+
let {
|
|
96
|
+
name
|
|
97
|
+
} = _ref;
|
|
98
|
+
return name === 'autoPlacement' || name === 'flip';
|
|
99
|
+
}).length > 1) {
|
|
100
|
+
throw new Error(['Floating UI: duplicate `flip` and/or `autoPlacement`', 'middleware detected. This will lead to an infinite loop. Ensure only', 'one of either has been passed to the `middleware` array.'].join(' '));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
let rects = await platform.getElementRects({
|
|
105
|
+
reference,
|
|
106
|
+
floating,
|
|
107
|
+
strategy
|
|
108
|
+
});
|
|
109
|
+
let {
|
|
110
|
+
x,
|
|
111
|
+
y
|
|
112
|
+
} = computeCoordsFromPlacement({ ...rects,
|
|
113
|
+
placement
|
|
114
|
+
});
|
|
115
|
+
let statefulPlacement = placement;
|
|
116
|
+
let middlewareData = {};
|
|
117
|
+
let _debug_loop_count_ = 0;
|
|
118
|
+
|
|
119
|
+
for (let i = 0; i < middleware.length; i++) {
|
|
120
|
+
if (process.env.NODE_ENV !== "production") {
|
|
121
|
+
_debug_loop_count_++;
|
|
122
|
+
|
|
123
|
+
if (_debug_loop_count_ > 100) {
|
|
124
|
+
throw new Error(['Floating UI: The middleware lifecycle appears to be', 'running in an infinite loop. This is usually caused by a `reset`', 'continually being returned without a break condition.'].join(' '));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const {
|
|
129
|
+
name,
|
|
130
|
+
fn
|
|
131
|
+
} = middleware[i];
|
|
132
|
+
const {
|
|
133
|
+
x: nextX,
|
|
134
|
+
y: nextY,
|
|
135
|
+
data,
|
|
136
|
+
reset
|
|
137
|
+
} = await fn({
|
|
138
|
+
x,
|
|
139
|
+
y,
|
|
140
|
+
initialPlacement: placement,
|
|
141
|
+
placement: statefulPlacement,
|
|
142
|
+
strategy,
|
|
143
|
+
middlewareData,
|
|
144
|
+
rects,
|
|
145
|
+
platform,
|
|
146
|
+
elements: {
|
|
147
|
+
reference,
|
|
148
|
+
floating
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
x = nextX != null ? nextX : x;
|
|
152
|
+
y = nextY != null ? nextY : y;
|
|
153
|
+
middlewareData = { ...middlewareData,
|
|
154
|
+
[name]: data != null ? data : {}
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
if (reset) {
|
|
158
|
+
if (typeof reset === 'object') {
|
|
159
|
+
if (reset.placement) {
|
|
160
|
+
statefulPlacement = reset.placement;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (reset.rects) {
|
|
164
|
+
rects = reset.rects === true ? await platform.getElementRects({
|
|
165
|
+
reference,
|
|
166
|
+
floating,
|
|
167
|
+
strategy
|
|
168
|
+
}) : reset.rects;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
({
|
|
172
|
+
x,
|
|
173
|
+
y
|
|
174
|
+
} = computeCoordsFromPlacement({ ...rects,
|
|
175
|
+
placement: statefulPlacement
|
|
176
|
+
}));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
i = -1;
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return {
|
|
185
|
+
x,
|
|
186
|
+
y,
|
|
187
|
+
placement: statefulPlacement,
|
|
188
|
+
strategy,
|
|
189
|
+
middlewareData
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
function expandPaddingObject(padding) {
|
|
194
|
+
return {
|
|
195
|
+
top: 0,
|
|
196
|
+
right: 0,
|
|
197
|
+
bottom: 0,
|
|
198
|
+
left: 0,
|
|
199
|
+
...padding
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function getSideObjectFromPadding(padding) {
|
|
204
|
+
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
|
|
205
|
+
top: padding,
|
|
206
|
+
right: padding,
|
|
207
|
+
bottom: padding,
|
|
208
|
+
left: padding
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function rectToClientRect(rect) {
|
|
213
|
+
return { ...rect,
|
|
214
|
+
top: rect.y,
|
|
215
|
+
left: rect.x,
|
|
216
|
+
right: rect.x + rect.width,
|
|
217
|
+
bottom: rect.y + rect.height
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
async function detectOverflow(middlewareArguments, options) {
|
|
222
|
+
if (options === void 0) {
|
|
223
|
+
options = {};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const {
|
|
227
|
+
x,
|
|
228
|
+
y,
|
|
229
|
+
platform,
|
|
230
|
+
rects,
|
|
231
|
+
elements,
|
|
232
|
+
strategy
|
|
233
|
+
} = middlewareArguments;
|
|
234
|
+
const {
|
|
235
|
+
boundary = 'clippingParents',
|
|
236
|
+
rootBoundary = 'viewport',
|
|
237
|
+
elementContext = 'floating',
|
|
238
|
+
altBoundary = false,
|
|
239
|
+
padding = 0
|
|
240
|
+
} = options;
|
|
241
|
+
const paddingObject = getSideObjectFromPadding(padding);
|
|
242
|
+
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
|
|
243
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
244
|
+
const clippingClientRect = await platform.getClippingClientRect({
|
|
245
|
+
element: (await platform.isElement(element)) ? element : element.contextElement || (await platform.getDocumentElement({
|
|
246
|
+
element: elements.floating
|
|
247
|
+
})),
|
|
248
|
+
boundary,
|
|
249
|
+
rootBoundary
|
|
250
|
+
});
|
|
251
|
+
const elementClientRect = rectToClientRect(await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
252
|
+
rect: elementContext === 'floating' ? { ...rects.floating,
|
|
253
|
+
x,
|
|
254
|
+
y
|
|
255
|
+
} : rects.reference,
|
|
256
|
+
offsetParent: await platform.getOffsetParent({
|
|
257
|
+
element: elements.floating
|
|
258
|
+
}),
|
|
259
|
+
strategy
|
|
260
|
+
})); // positive = overflowing the clipping rect
|
|
261
|
+
// 0 or negative = within the clipping rect
|
|
262
|
+
|
|
263
|
+
return {
|
|
264
|
+
top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
|
|
265
|
+
bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
|
|
266
|
+
left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
|
|
267
|
+
right: elementClientRect.right - clippingClientRect.right + paddingObject.right
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const min$1 = Math.min;
|
|
272
|
+
const max$1 = Math.max;
|
|
273
|
+
|
|
274
|
+
function within(min$1$1, value, max$1$1) {
|
|
275
|
+
return max$1(min$1$1, min$1(value, max$1$1));
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const arrow = options => ({
|
|
279
|
+
name: 'arrow',
|
|
280
|
+
options,
|
|
281
|
+
|
|
282
|
+
async fn(middlewareArguments) {
|
|
283
|
+
// Since `element` is required, we don't Partial<> the type
|
|
284
|
+
const {
|
|
285
|
+
element,
|
|
286
|
+
padding = 0
|
|
287
|
+
} = options != null ? options : {};
|
|
288
|
+
const {
|
|
289
|
+
x,
|
|
290
|
+
y,
|
|
291
|
+
placement,
|
|
292
|
+
rects,
|
|
293
|
+
platform
|
|
294
|
+
} = middlewareArguments;
|
|
295
|
+
|
|
296
|
+
if (element == null) {
|
|
297
|
+
if (process.env.NODE_ENV !== "production") {
|
|
298
|
+
console.warn('Floating UI: No `element` was passed to the `arrow` middleware.');
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return {};
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const paddingObject = getSideObjectFromPadding(padding);
|
|
305
|
+
const coords = {
|
|
306
|
+
x,
|
|
307
|
+
y
|
|
308
|
+
};
|
|
309
|
+
const basePlacement = getBasePlacement(placement);
|
|
310
|
+
const axis = getMainAxisFromPlacement(basePlacement);
|
|
311
|
+
const length = getLengthFromAxis(axis);
|
|
312
|
+
const arrowDimensions = await platform.getDimensions({
|
|
313
|
+
element
|
|
314
|
+
});
|
|
315
|
+
const minProp = axis === 'y' ? 'top' : 'left';
|
|
316
|
+
const maxProp = axis === 'y' ? 'bottom' : 'right';
|
|
317
|
+
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
|
|
318
|
+
const startDiff = coords[axis] - rects.reference[axis];
|
|
319
|
+
const arrowOffsetParent = await platform.getOffsetParent({
|
|
320
|
+
element
|
|
321
|
+
});
|
|
322
|
+
const clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
|
|
323
|
+
const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
|
|
324
|
+
// point is outside of the floating element's bounds
|
|
325
|
+
|
|
326
|
+
const min = paddingObject[minProp];
|
|
327
|
+
const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
|
|
328
|
+
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
329
|
+
const offset = within(min, center, max);
|
|
330
|
+
return {
|
|
331
|
+
data: {
|
|
332
|
+
[axis]: offset,
|
|
333
|
+
centerOffset: center - offset
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
const hash$1 = {
|
|
341
|
+
left: 'right',
|
|
342
|
+
right: 'left',
|
|
343
|
+
bottom: 'top',
|
|
344
|
+
top: 'bottom'
|
|
345
|
+
};
|
|
346
|
+
function getOppositePlacement(placement) {
|
|
347
|
+
return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
function getAlignmentSides(placement, rects) {
|
|
351
|
+
const isStart = getAlignment(placement) === 'start';
|
|
352
|
+
const mainAxis = getMainAxisFromPlacement(placement);
|
|
353
|
+
const length = getLengthFromAxis(mainAxis);
|
|
354
|
+
let mainAlignmentSide = mainAxis === 'x' ? isStart ? 'right' : 'left' : isStart ? 'bottom' : 'top';
|
|
355
|
+
|
|
356
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
357
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
return {
|
|
361
|
+
main: mainAlignmentSide,
|
|
362
|
+
cross: getOppositePlacement(mainAlignmentSide)
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
const hash = {
|
|
367
|
+
start: 'end',
|
|
368
|
+
end: 'start'
|
|
369
|
+
};
|
|
370
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
371
|
+
return placement.replace(/start|end/g, matched => hash[matched]);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
const basePlacements = ['top', 'right', 'bottom', 'left'];
|
|
375
|
+
const allPlacements = /*#__PURE__*/basePlacements.reduce((acc, basePlacement) => acc.concat(basePlacement, basePlacement + "-start", basePlacement + "-end"), []);
|
|
376
|
+
|
|
377
|
+
function getPlacementList(alignment, autoAlignment, allowedPlacements) {
|
|
378
|
+
const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getBasePlacement(placement) === placement);
|
|
379
|
+
return allowedPlacementsSortedByAlignment.filter(placement => {
|
|
380
|
+
if (alignment) {
|
|
381
|
+
return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
return true;
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
const autoPlacement = function (options) {
|
|
388
|
+
if (options === void 0) {
|
|
389
|
+
options = {};
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
return {
|
|
393
|
+
name: 'autoPlacement',
|
|
394
|
+
options,
|
|
395
|
+
|
|
396
|
+
async fn(middlewareArguments) {
|
|
397
|
+
var _middlewareData$autoP, _middlewareData$autoP2, _middlewareData$autoP3, _middlewareData$autoP4, _middlewareData$autoP5, _placementsSortedByLe;
|
|
398
|
+
|
|
399
|
+
const {
|
|
400
|
+
x,
|
|
401
|
+
y,
|
|
402
|
+
rects,
|
|
403
|
+
middlewareData,
|
|
404
|
+
placement
|
|
405
|
+
} = middlewareArguments;
|
|
406
|
+
const {
|
|
407
|
+
alignment = null,
|
|
408
|
+
allowedPlacements = allPlacements,
|
|
409
|
+
autoAlignment = true,
|
|
410
|
+
...detectOverflowOptions
|
|
411
|
+
} = options;
|
|
412
|
+
|
|
413
|
+
if ((_middlewareData$autoP = middlewareData.autoPlacement) != null && _middlewareData$autoP.skip) {
|
|
414
|
+
return {};
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
const placements = getPlacementList(alignment, autoAlignment, allowedPlacements);
|
|
418
|
+
const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
|
|
419
|
+
const currentIndex = (_middlewareData$autoP2 = (_middlewareData$autoP3 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP3.index) != null ? _middlewareData$autoP2 : 0;
|
|
420
|
+
const currentPlacement = placements[currentIndex];
|
|
421
|
+
const {
|
|
422
|
+
main,
|
|
423
|
+
cross
|
|
424
|
+
} = getAlignmentSides(currentPlacement, rects); // Make `computeCoords` start from the right place
|
|
425
|
+
|
|
426
|
+
if (placement !== currentPlacement) {
|
|
427
|
+
return {
|
|
428
|
+
x,
|
|
429
|
+
y,
|
|
430
|
+
reset: {
|
|
431
|
+
placement: placements[0]
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
const currentOverflows = [overflow[getBasePlacement(currentPlacement)], overflow[main], overflow[cross]];
|
|
437
|
+
const allOverflows = [...((_middlewareData$autoP4 = (_middlewareData$autoP5 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP5.overflows) != null ? _middlewareData$autoP4 : []), {
|
|
438
|
+
placement: currentPlacement,
|
|
439
|
+
overflows: currentOverflows
|
|
440
|
+
}];
|
|
441
|
+
const nextPlacement = placements[currentIndex + 1]; // There are more placements to check
|
|
442
|
+
|
|
443
|
+
if (nextPlacement) {
|
|
444
|
+
return {
|
|
445
|
+
data: {
|
|
446
|
+
index: currentIndex + 1,
|
|
447
|
+
overflows: allOverflows
|
|
448
|
+
},
|
|
449
|
+
reset: {
|
|
450
|
+
placement: nextPlacement
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
const placementsSortedByLeastOverflow = allOverflows.slice().sort((a, b) => a.overflows[0] - b.overflows[0]);
|
|
456
|
+
const placementThatFitsOnAllSides = (_placementsSortedByLe = placementsSortedByLeastOverflow.find(_ref => {
|
|
457
|
+
let {
|
|
458
|
+
overflows
|
|
459
|
+
} = _ref;
|
|
460
|
+
return overflows.every(overflow => overflow <= 0);
|
|
461
|
+
})) == null ? void 0 : _placementsSortedByLe.placement;
|
|
462
|
+
return {
|
|
463
|
+
data: {
|
|
464
|
+
skip: true
|
|
465
|
+
},
|
|
466
|
+
reset: {
|
|
467
|
+
placement: placementThatFitsOnAllSides != null ? placementThatFitsOnAllSides : placementsSortedByLeastOverflow[0].placement
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
};
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
function getExpandedPlacements(placement) {
|
|
476
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
477
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
const flip = function (options) {
|
|
481
|
+
if (options === void 0) {
|
|
482
|
+
options = {};
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
return {
|
|
486
|
+
name: 'flip',
|
|
487
|
+
options,
|
|
488
|
+
|
|
489
|
+
async fn(middlewareArguments) {
|
|
490
|
+
var _middlewareData$flip, _middlewareData$flip2;
|
|
491
|
+
|
|
492
|
+
const {
|
|
493
|
+
placement,
|
|
494
|
+
middlewareData,
|
|
495
|
+
rects,
|
|
496
|
+
initialPlacement
|
|
497
|
+
} = middlewareArguments;
|
|
498
|
+
|
|
499
|
+
if ((_middlewareData$flip = middlewareData.flip) != null && _middlewareData$flip.skip) {
|
|
500
|
+
return {};
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
const {
|
|
504
|
+
mainAxis: checkMainAxis = true,
|
|
505
|
+
crossAxis: checkCrossAxis = true,
|
|
506
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
507
|
+
fallbackStrategy = 'bestFit',
|
|
508
|
+
flipAlignment = true,
|
|
509
|
+
...detectOverflowOptions
|
|
510
|
+
} = options;
|
|
511
|
+
const basePlacement = getBasePlacement(placement);
|
|
512
|
+
const isBasePlacement = basePlacement === initialPlacement;
|
|
513
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
514
|
+
const placements = [initialPlacement, ...fallbackPlacements];
|
|
515
|
+
const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
|
|
516
|
+
const overflows = [];
|
|
517
|
+
let overflowsData = ((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.overflows) || [];
|
|
518
|
+
|
|
519
|
+
if (checkMainAxis) {
|
|
520
|
+
overflows.push(overflow[basePlacement]);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
if (checkCrossAxis) {
|
|
524
|
+
const {
|
|
525
|
+
main,
|
|
526
|
+
cross
|
|
527
|
+
} = getAlignmentSides(placement, rects);
|
|
528
|
+
overflows.push(overflow[main], overflow[cross]);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
overflowsData = [...overflowsData, {
|
|
532
|
+
placement,
|
|
533
|
+
overflows
|
|
534
|
+
}]; // One or more sides is overflowing
|
|
535
|
+
|
|
536
|
+
if (!overflows.every(side => side <= 0)) {
|
|
537
|
+
var _middlewareData$flip$, _middlewareData$flip3;
|
|
538
|
+
|
|
539
|
+
const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip3 = middlewareData.flip) == null ? void 0 : _middlewareData$flip3.index) != null ? _middlewareData$flip$ : 0) + 1;
|
|
540
|
+
const nextPlacement = placements[nextIndex];
|
|
541
|
+
|
|
542
|
+
if (nextPlacement) {
|
|
543
|
+
// Try next placement and re-run the lifecycle
|
|
544
|
+
return {
|
|
545
|
+
data: {
|
|
546
|
+
index: nextIndex,
|
|
547
|
+
overflows: overflowsData
|
|
548
|
+
},
|
|
549
|
+
reset: {
|
|
550
|
+
placement: nextPlacement
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
let resetPlacement = 'bottom';
|
|
556
|
+
|
|
557
|
+
switch (fallbackStrategy) {
|
|
558
|
+
case 'bestFit':
|
|
559
|
+
{
|
|
560
|
+
var _overflowsData$slice$;
|
|
561
|
+
|
|
562
|
+
const placement = (_overflowsData$slice$ = overflowsData.slice().sort((a, b) => a.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0) - b.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0))[0]) == null ? void 0 : _overflowsData$slice$.placement;
|
|
563
|
+
|
|
564
|
+
if (placement) {
|
|
565
|
+
resetPlacement = placement;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
break;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
case 'initialPlacement':
|
|
572
|
+
resetPlacement = initialPlacement;
|
|
573
|
+
break;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
return {
|
|
577
|
+
data: {
|
|
578
|
+
skip: true
|
|
579
|
+
},
|
|
580
|
+
reset: {
|
|
581
|
+
placement: resetPlacement
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
return {};
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
};
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
function getSideOffsets(overflow, rect) {
|
|
593
|
+
return {
|
|
594
|
+
top: overflow.top - rect.height,
|
|
595
|
+
right: overflow.right - rect.width,
|
|
596
|
+
bottom: overflow.bottom - rect.height,
|
|
597
|
+
left: overflow.left - rect.width
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
function isAnySideFullyClipped(overflow) {
|
|
602
|
+
return basePlacements.some(side => overflow[side] >= 0);
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
const hide = () => ({
|
|
606
|
+
name: 'hide',
|
|
607
|
+
|
|
608
|
+
async fn(modifierArguments) {
|
|
609
|
+
const referenceOverflow = await detectOverflow(modifierArguments, {
|
|
610
|
+
elementContext: 'reference'
|
|
611
|
+
});
|
|
612
|
+
const floatingAltOverflow = await detectOverflow(modifierArguments, {
|
|
613
|
+
altBoundary: true
|
|
614
|
+
});
|
|
615
|
+
const referenceHiddenOffsets = getSideOffsets(referenceOverflow, modifierArguments.rects.reference);
|
|
616
|
+
const escapedOffsets = getSideOffsets(floatingAltOverflow, modifierArguments.rects.floating);
|
|
617
|
+
const referenceHidden = isAnySideFullyClipped(referenceHiddenOffsets);
|
|
618
|
+
const escaped = isAnySideFullyClipped(escapedOffsets);
|
|
619
|
+
return {
|
|
620
|
+
data: {
|
|
621
|
+
referenceHidden,
|
|
622
|
+
referenceHiddenOffsets,
|
|
623
|
+
escaped,
|
|
624
|
+
escapedOffsets
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
});
|
|
630
|
+
|
|
631
|
+
function convertValueToCoords(_ref) {
|
|
632
|
+
let {
|
|
633
|
+
placement,
|
|
634
|
+
rects,
|
|
635
|
+
value
|
|
636
|
+
} = _ref;
|
|
637
|
+
const basePlacement = getBasePlacement(placement);
|
|
638
|
+
const multiplier = ['left', 'top'].includes(basePlacement) ? -1 : 1;
|
|
639
|
+
const rawValue = typeof value === 'function' ? value({ ...rects,
|
|
640
|
+
placement
|
|
641
|
+
}) : value;
|
|
642
|
+
const {
|
|
643
|
+
mainAxis,
|
|
644
|
+
crossAxis
|
|
645
|
+
} = typeof rawValue === 'number' ? {
|
|
646
|
+
mainAxis: rawValue,
|
|
647
|
+
crossAxis: 0
|
|
648
|
+
} : {
|
|
649
|
+
mainAxis: 0,
|
|
650
|
+
crossAxis: 0,
|
|
651
|
+
...rawValue
|
|
652
|
+
};
|
|
653
|
+
return getMainAxisFromPlacement(basePlacement) === 'x' ? {
|
|
654
|
+
x: crossAxis,
|
|
655
|
+
y: mainAxis * multiplier
|
|
656
|
+
} : {
|
|
657
|
+
x: mainAxis * multiplier,
|
|
658
|
+
y: crossAxis
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
const offset = function (value) {
|
|
662
|
+
if (value === void 0) {
|
|
663
|
+
value = 0;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
return {
|
|
667
|
+
name: 'offset',
|
|
668
|
+
options: value,
|
|
669
|
+
|
|
670
|
+
fn(middlewareArguments) {
|
|
671
|
+
const {
|
|
672
|
+
x,
|
|
673
|
+
y,
|
|
674
|
+
placement,
|
|
675
|
+
rects
|
|
676
|
+
} = middlewareArguments;
|
|
677
|
+
const diffCoords = convertValueToCoords({
|
|
678
|
+
placement,
|
|
679
|
+
rects,
|
|
680
|
+
value
|
|
681
|
+
});
|
|
682
|
+
return {
|
|
683
|
+
x: x + diffCoords.x,
|
|
684
|
+
y: y + diffCoords.y,
|
|
685
|
+
data: diffCoords
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
};
|
|
690
|
+
};
|
|
691
|
+
|
|
692
|
+
function getCrossAxis(axis) {
|
|
693
|
+
return axis === 'x' ? 'y' : 'x';
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
const shift = function (options) {
|
|
697
|
+
if (options === void 0) {
|
|
698
|
+
options = {};
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
return {
|
|
702
|
+
name: 'shift',
|
|
703
|
+
options,
|
|
704
|
+
|
|
705
|
+
async fn(middlewareArguments) {
|
|
706
|
+
const {
|
|
707
|
+
x,
|
|
708
|
+
y,
|
|
709
|
+
placement
|
|
710
|
+
} = middlewareArguments;
|
|
711
|
+
const {
|
|
712
|
+
mainAxis: checkMainAxis = true,
|
|
713
|
+
crossAxis: checkCrossAxis = false,
|
|
714
|
+
limiter = {
|
|
715
|
+
fn: _ref => {
|
|
716
|
+
let {
|
|
717
|
+
x,
|
|
718
|
+
y
|
|
719
|
+
} = _ref;
|
|
720
|
+
return {
|
|
721
|
+
x,
|
|
722
|
+
y
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
},
|
|
726
|
+
...detectOverflowOptions
|
|
727
|
+
} = options;
|
|
728
|
+
const coords = {
|
|
729
|
+
x,
|
|
730
|
+
y
|
|
731
|
+
};
|
|
732
|
+
const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
|
|
733
|
+
const mainAxis = getMainAxisFromPlacement(getBasePlacement(placement));
|
|
734
|
+
const crossAxis = getCrossAxis(mainAxis);
|
|
735
|
+
let mainAxisCoord = coords[mainAxis];
|
|
736
|
+
let crossAxisCoord = coords[crossAxis];
|
|
737
|
+
|
|
738
|
+
if (checkMainAxis) {
|
|
739
|
+
const minSide = mainAxis === 'y' ? 'top' : 'left';
|
|
740
|
+
const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
|
|
741
|
+
const min = mainAxisCoord + overflow[minSide];
|
|
742
|
+
const max = mainAxisCoord - overflow[maxSide];
|
|
743
|
+
mainAxisCoord = within(min, mainAxisCoord, max);
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
if (checkCrossAxis) {
|
|
747
|
+
const minSide = crossAxis === 'y' ? 'top' : 'left';
|
|
748
|
+
const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
|
|
749
|
+
const min = crossAxisCoord + overflow[minSide];
|
|
750
|
+
const max = crossAxisCoord - overflow[maxSide];
|
|
751
|
+
crossAxisCoord = within(min, crossAxisCoord, max);
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
const limitedCoords = limiter.fn({ ...middlewareArguments,
|
|
755
|
+
[mainAxis]: mainAxisCoord,
|
|
756
|
+
[crossAxis]: crossAxisCoord
|
|
757
|
+
});
|
|
758
|
+
return { ...limitedCoords,
|
|
759
|
+
data: {
|
|
760
|
+
x: limitedCoords.x - x,
|
|
761
|
+
y: limitedCoords.y - y
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
};
|
|
767
|
+
};
|
|
768
|
+
const limitShift = function (options) {
|
|
769
|
+
if (options === void 0) {
|
|
770
|
+
options = {};
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
return {
|
|
774
|
+
options,
|
|
775
|
+
|
|
776
|
+
fn(middlewareArguments) {
|
|
777
|
+
const {
|
|
778
|
+
x,
|
|
779
|
+
y,
|
|
780
|
+
placement,
|
|
781
|
+
rects,
|
|
782
|
+
middlewareData
|
|
783
|
+
} = middlewareArguments;
|
|
784
|
+
const {
|
|
785
|
+
offset = 0,
|
|
786
|
+
mainAxis: checkMainAxis = true,
|
|
787
|
+
crossAxis: checkCrossAxis = true
|
|
788
|
+
} = options;
|
|
789
|
+
const coords = {
|
|
790
|
+
x,
|
|
791
|
+
y
|
|
792
|
+
};
|
|
793
|
+
const mainAxis = getMainAxisFromPlacement(placement);
|
|
794
|
+
const crossAxis = getCrossAxis(mainAxis);
|
|
795
|
+
let mainAxisCoord = coords[mainAxis];
|
|
796
|
+
let crossAxisCoord = coords[crossAxis];
|
|
797
|
+
const rawOffset = typeof offset === 'function' ? offset({ ...rects,
|
|
798
|
+
placement
|
|
799
|
+
}) : offset;
|
|
800
|
+
const computedOffset = typeof rawOffset === 'number' ? {
|
|
801
|
+
mainAxis: rawOffset,
|
|
802
|
+
crossAxis: 0
|
|
803
|
+
} : {
|
|
804
|
+
mainAxis: 0,
|
|
805
|
+
crossAxis: 0,
|
|
806
|
+
...rawOffset
|
|
807
|
+
};
|
|
808
|
+
|
|
809
|
+
if (checkMainAxis) {
|
|
810
|
+
const len = mainAxis === 'y' ? 'height' : 'width';
|
|
811
|
+
const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
|
|
812
|
+
const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
|
|
813
|
+
|
|
814
|
+
if (mainAxisCoord < limitMin) {
|
|
815
|
+
mainAxisCoord = limitMin;
|
|
816
|
+
} else if (mainAxisCoord > limitMax) {
|
|
817
|
+
mainAxisCoord = limitMax;
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
if (checkCrossAxis) {
|
|
822
|
+
var _middlewareData$offse, _middlewareData$offse2, _middlewareData$offse3, _middlewareData$offse4;
|
|
823
|
+
|
|
824
|
+
const len = mainAxis === 'y' ? 'width' : 'height';
|
|
825
|
+
const isOriginSide = ['top', 'left'].includes(getBasePlacement(placement));
|
|
826
|
+
const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? (_middlewareData$offse = (_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) != null ? _middlewareData$offse : 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
|
|
827
|
+
const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : (_middlewareData$offse3 = (_middlewareData$offse4 = middlewareData.offset) == null ? void 0 : _middlewareData$offse4[crossAxis]) != null ? _middlewareData$offse3 : 0) - (isOriginSide ? computedOffset.crossAxis : 0);
|
|
828
|
+
|
|
829
|
+
if (crossAxisCoord < limitMin) {
|
|
830
|
+
crossAxisCoord = limitMin;
|
|
831
|
+
} else if (crossAxisCoord > limitMax) {
|
|
832
|
+
crossAxisCoord = limitMax;
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
return {
|
|
837
|
+
[mainAxis]: mainAxisCoord,
|
|
838
|
+
[crossAxis]: crossAxisCoord
|
|
839
|
+
};
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
};
|
|
843
|
+
};
|
|
844
|
+
|
|
845
|
+
const size = function (options) {
|
|
846
|
+
if (options === void 0) {
|
|
847
|
+
options = {};
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
return {
|
|
851
|
+
name: 'size',
|
|
852
|
+
options,
|
|
853
|
+
|
|
854
|
+
async fn(middlewareArguments) {
|
|
855
|
+
var _middlewareData$size;
|
|
856
|
+
|
|
857
|
+
const {
|
|
858
|
+
placement,
|
|
859
|
+
rects,
|
|
860
|
+
middlewareData
|
|
861
|
+
} = middlewareArguments;
|
|
862
|
+
const {
|
|
863
|
+
apply,
|
|
864
|
+
...detectOverflowOptions
|
|
865
|
+
} = options;
|
|
866
|
+
|
|
867
|
+
if ((_middlewareData$size = middlewareData.size) != null && _middlewareData$size.skip) {
|
|
868
|
+
return {};
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
|
|
872
|
+
const basePlacement = getBasePlacement(placement);
|
|
873
|
+
const isEnd = getAlignment(placement) === 'end';
|
|
874
|
+
let heightSide;
|
|
875
|
+
let widthSide;
|
|
876
|
+
|
|
877
|
+
if (basePlacement === 'top' || basePlacement === 'bottom') {
|
|
878
|
+
heightSide = basePlacement;
|
|
879
|
+
widthSide = isEnd ? 'left' : 'right';
|
|
880
|
+
} else {
|
|
881
|
+
widthSide = basePlacement;
|
|
882
|
+
heightSide = isEnd ? 'top' : 'bottom';
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
const xMin = max$1(overflow.left, 0);
|
|
886
|
+
const xMax = max$1(overflow.right, 0);
|
|
887
|
+
const yMin = max$1(overflow.top, 0);
|
|
888
|
+
const yMax = max$1(overflow.bottom, 0);
|
|
889
|
+
const dimensions = {
|
|
890
|
+
height: rects.floating.height - (['left', 'right'].includes(placement) ? 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max$1(overflow.top, overflow.bottom)) : overflow[heightSide]),
|
|
891
|
+
width: rects.floating.width - (['top', 'bottom'].includes(placement) ? 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max$1(overflow.left, overflow.right)) : overflow[widthSide])
|
|
892
|
+
};
|
|
893
|
+
apply == null ? void 0 : apply({ ...dimensions,
|
|
894
|
+
...rects
|
|
895
|
+
});
|
|
896
|
+
return {
|
|
897
|
+
data: {
|
|
898
|
+
skip: true
|
|
899
|
+
},
|
|
900
|
+
reset: {
|
|
901
|
+
rects: true
|
|
902
|
+
}
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
};
|
|
907
|
+
};
|
|
908
|
+
|
|
909
|
+
const inline = function (options) {
|
|
910
|
+
if (options === void 0) {
|
|
911
|
+
options = {};
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
return {
|
|
915
|
+
name: 'inline',
|
|
916
|
+
options,
|
|
917
|
+
|
|
918
|
+
async fn(middlewareArguments) {
|
|
919
|
+
var _middlewareData$inlin, _await$platform$getCl;
|
|
920
|
+
|
|
921
|
+
const {
|
|
922
|
+
placement,
|
|
923
|
+
elements,
|
|
924
|
+
rects,
|
|
925
|
+
platform,
|
|
926
|
+
strategy,
|
|
927
|
+
middlewareData
|
|
928
|
+
} = middlewareArguments; // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
|
|
929
|
+
// ClientRect's bounds, despite the event listener being triggered. A
|
|
930
|
+
// padding of 2 seems to handle this issue.
|
|
931
|
+
|
|
932
|
+
const {
|
|
933
|
+
padding = 2,
|
|
934
|
+
x,
|
|
935
|
+
y
|
|
936
|
+
} = options;
|
|
937
|
+
|
|
938
|
+
if ((_middlewareData$inlin = middlewareData.inline) != null && _middlewareData$inlin.skip) {
|
|
939
|
+
return {};
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
const fallback = rectToClientRect(await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
943
|
+
rect: rects.reference,
|
|
944
|
+
offsetParent: await platform.getOffsetParent({
|
|
945
|
+
element: elements.floating
|
|
946
|
+
}),
|
|
947
|
+
strategy
|
|
948
|
+
}));
|
|
949
|
+
const clientRects = Array.from((_await$platform$getCl = await (platform.getClientRects == null ? void 0 : platform.getClientRects({
|
|
950
|
+
element: elements.reference
|
|
951
|
+
}))) != null ? _await$platform$getCl : []);
|
|
952
|
+
const paddingObject = getSideObjectFromPadding(padding);
|
|
953
|
+
|
|
954
|
+
function getBoundingClientRect() {
|
|
955
|
+
// There are two rects and they are disjoined
|
|
956
|
+
if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
|
|
957
|
+
var _clientRects$find;
|
|
958
|
+
|
|
959
|
+
// Find the first rect in which the point is fully inside
|
|
960
|
+
return (_clientRects$find = clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom)) != null ? _clientRects$find : fallback;
|
|
961
|
+
} // There are 2 or more connected rects
|
|
962
|
+
|
|
963
|
+
|
|
964
|
+
if (clientRects.length >= 2) {
|
|
965
|
+
if (getMainAxisFromPlacement(placement) === 'x') {
|
|
966
|
+
const firstRect = clientRects[0];
|
|
967
|
+
const lastRect = clientRects[clientRects.length - 1];
|
|
968
|
+
const isTop = getBasePlacement(placement) === 'top';
|
|
969
|
+
const top = firstRect.top;
|
|
970
|
+
const bottom = lastRect.bottom;
|
|
971
|
+
const left = isTop ? firstRect.left : lastRect.left;
|
|
972
|
+
const right = isTop ? firstRect.right : lastRect.right;
|
|
973
|
+
const width = right - left;
|
|
974
|
+
const height = bottom - top;
|
|
975
|
+
return {
|
|
976
|
+
top,
|
|
977
|
+
bottom,
|
|
978
|
+
left,
|
|
979
|
+
right,
|
|
980
|
+
width,
|
|
981
|
+
height,
|
|
982
|
+
x: left,
|
|
983
|
+
y: top
|
|
984
|
+
};
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
const isLeftPlacement = getBasePlacement(placement) === 'left';
|
|
988
|
+
const maxRight = max$1(...clientRects.map(rect => rect.right));
|
|
989
|
+
const minLeft = min$1(...clientRects.map(rect => rect.left));
|
|
990
|
+
const measureRects = clientRects.filter(rect => isLeftPlacement ? rect.left === minLeft : rect.right === maxRight);
|
|
991
|
+
const top = measureRects[0].top;
|
|
992
|
+
const bottom = measureRects[measureRects.length - 1].bottom;
|
|
993
|
+
const left = minLeft;
|
|
994
|
+
const right = maxRight;
|
|
995
|
+
const width = right - left;
|
|
996
|
+
const height = bottom - top;
|
|
997
|
+
return {
|
|
998
|
+
top,
|
|
999
|
+
bottom,
|
|
1000
|
+
left,
|
|
1001
|
+
right,
|
|
1002
|
+
width,
|
|
1003
|
+
height,
|
|
1004
|
+
x: left,
|
|
1005
|
+
y: top
|
|
1006
|
+
};
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
return fallback;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
return {
|
|
1013
|
+
data: {
|
|
1014
|
+
skip: true
|
|
1015
|
+
},
|
|
1016
|
+
reset: {
|
|
1017
|
+
rects: await platform.getElementRects({
|
|
1018
|
+
reference: {
|
|
1019
|
+
getBoundingClientRect
|
|
1020
|
+
},
|
|
1021
|
+
floating: elements.floating,
|
|
1022
|
+
strategy
|
|
1023
|
+
})
|
|
1024
|
+
}
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
};
|
|
1029
|
+
};
|
|
1030
|
+
|
|
1031
|
+
function isWindow(value) {
|
|
1032
|
+
return (value == null ? void 0 : value.toString()) === '[object Window]';
|
|
1033
|
+
}
|
|
1034
|
+
function getWindow(node) {
|
|
1035
|
+
if (node == null) {
|
|
1036
|
+
return window;
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
if (!isWindow(node)) {
|
|
1040
|
+
const ownerDocument = node.ownerDocument;
|
|
1041
|
+
return ownerDocument ? ownerDocument.defaultView || window : window;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
return node;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
function getComputedStyle$1(element) {
|
|
1048
|
+
return getWindow(element).getComputedStyle(element);
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
function getNodeName(node) {
|
|
1052
|
+
return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
function isHTMLElement(value) {
|
|
1056
|
+
return value instanceof getWindow(value).HTMLElement;
|
|
1057
|
+
}
|
|
1058
|
+
function isElement(value) {
|
|
1059
|
+
return value instanceof getWindow(value).Element;
|
|
1060
|
+
}
|
|
1061
|
+
function isNode(value) {
|
|
1062
|
+
return value instanceof getWindow(value).Node;
|
|
1063
|
+
}
|
|
1064
|
+
function isShadowRoot(node) {
|
|
1065
|
+
const OwnElement = getWindow(node).ShadowRoot;
|
|
1066
|
+
return node instanceof OwnElement || node instanceof ShadowRoot;
|
|
1067
|
+
}
|
|
1068
|
+
function isScrollParent(element) {
|
|
1069
|
+
// Firefox wants us to check `-x` and `-y` variations as well
|
|
1070
|
+
const {
|
|
1071
|
+
overflow,
|
|
1072
|
+
overflowX,
|
|
1073
|
+
overflowY
|
|
1074
|
+
} = getComputedStyle$1(element);
|
|
1075
|
+
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
|
|
1076
|
+
}
|
|
1077
|
+
function isTableElement(element) {
|
|
1078
|
+
return ['table', 'td', 'th'].includes(getNodeName(element));
|
|
1079
|
+
}
|
|
1080
|
+
function isContainingBlock(element) {
|
|
1081
|
+
// TODO: Try and use feature detection here instead
|
|
1082
|
+
const isFirefox = navigator.userAgent.toLowerCase().includes('firefox');
|
|
1083
|
+
const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that
|
|
1084
|
+
// create a containing block.
|
|
1085
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
1086
|
+
|
|
1087
|
+
return css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false);
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
const min = Math.min;
|
|
1091
|
+
const max = Math.max;
|
|
1092
|
+
const round = Math.round;
|
|
1093
|
+
|
|
1094
|
+
function getBoundingClientRect(element, includeScale) {
|
|
1095
|
+
if (includeScale === void 0) {
|
|
1096
|
+
includeScale = false;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
const clientRect = element.getBoundingClientRect();
|
|
1100
|
+
let scaleX = 1;
|
|
1101
|
+
let scaleY = 1;
|
|
1102
|
+
|
|
1103
|
+
if (includeScale && isHTMLElement(element)) {
|
|
1104
|
+
scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
|
|
1105
|
+
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
return {
|
|
1109
|
+
width: clientRect.width / scaleX,
|
|
1110
|
+
height: clientRect.height / scaleY,
|
|
1111
|
+
top: clientRect.top / scaleY,
|
|
1112
|
+
right: clientRect.right / scaleX,
|
|
1113
|
+
bottom: clientRect.bottom / scaleY,
|
|
1114
|
+
left: clientRect.left / scaleX,
|
|
1115
|
+
x: clientRect.left / scaleX,
|
|
1116
|
+
y: clientRect.top / scaleY
|
|
1117
|
+
};
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
function getDocumentElement(node) {
|
|
1121
|
+
return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
function getNodeScroll(element) {
|
|
1125
|
+
if (isWindow(element)) {
|
|
1126
|
+
return {
|
|
1127
|
+
scrollLeft: element.pageXOffset,
|
|
1128
|
+
scrollTop: element.pageYOffset
|
|
1129
|
+
};
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
return {
|
|
1133
|
+
scrollLeft: element.scrollLeft,
|
|
1134
|
+
scrollTop: element.scrollTop
|
|
1135
|
+
};
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
function getWindowScrollBarX(element) {
|
|
1139
|
+
// If <html> has a CSS width greater than the viewport, then this will be
|
|
1140
|
+
// incorrect for RTL.
|
|
1141
|
+
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
function isScaled(element) {
|
|
1145
|
+
const rect = getBoundingClientRect(element);
|
|
1146
|
+
return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
1150
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1151
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
1152
|
+
const rect = getBoundingClientRect(element, isOffsetParentAnElement && isScaled(offsetParent));
|
|
1153
|
+
let scroll = {
|
|
1154
|
+
scrollLeft: 0,
|
|
1155
|
+
scrollTop: 0
|
|
1156
|
+
};
|
|
1157
|
+
const offsets = {
|
|
1158
|
+
x: 0,
|
|
1159
|
+
y: 0
|
|
1160
|
+
};
|
|
1161
|
+
|
|
1162
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
|
|
1163
|
+
if (getNodeName(offsetParent) !== 'body' || isScrollParent(documentElement)) {
|
|
1164
|
+
scroll = getNodeScroll(offsetParent);
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
if (isHTMLElement(offsetParent)) {
|
|
1168
|
+
const offsetRect = getBoundingClientRect(offsetParent, true);
|
|
1169
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1170
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1171
|
+
} else if (documentElement) {
|
|
1172
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
return {
|
|
1177
|
+
x: rect.left + scroll.scrollLeft - offsets.x,
|
|
1178
|
+
y: rect.top + scroll.scrollTop - offsets.y,
|
|
1179
|
+
width: rect.width,
|
|
1180
|
+
height: rect.height
|
|
1181
|
+
};
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
function getParentNode(node) {
|
|
1185
|
+
if (getNodeName(node) === 'html') {
|
|
1186
|
+
return node;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
|
|
1190
|
+
// @ts-ignore
|
|
1191
|
+
node.assignedSlot || // step into the shadow DOM of the parent of a slotted node
|
|
1192
|
+
node.parentNode || ( // DOM Element detected
|
|
1193
|
+
isShadowRoot(node) ? node.host : null) || // ShadowRoot detected
|
|
1194
|
+
getDocumentElement(node) // fallback
|
|
1195
|
+
|
|
1196
|
+
);
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
function getTrueOffsetParent(element) {
|
|
1200
|
+
if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
|
|
1201
|
+
return null;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
return element.offsetParent;
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
function getContainingBlock(element) {
|
|
1208
|
+
let currentNode = getParentNode(element);
|
|
1209
|
+
|
|
1210
|
+
while (isHTMLElement(currentNode) && !['html', 'body'].includes(getNodeName(currentNode))) {
|
|
1211
|
+
if (isContainingBlock(currentNode)) {
|
|
1212
|
+
return currentNode;
|
|
1213
|
+
} else {
|
|
1214
|
+
currentNode = currentNode.parentNode;
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
return null;
|
|
1219
|
+
} // Gets the closest ancestor positioned element. Handles some edge cases,
|
|
1220
|
+
// such as table ancestors and cross browser bugs.
|
|
1221
|
+
|
|
1222
|
+
|
|
1223
|
+
function getOffsetParent(element) {
|
|
1224
|
+
const window = getWindow(element);
|
|
1225
|
+
let offsetParent = getTrueOffsetParent(element);
|
|
1226
|
+
|
|
1227
|
+
while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
|
|
1228
|
+
offsetParent = getTrueOffsetParent(offsetParent);
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
|
|
1232
|
+
return window;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
return offsetParent || getContainingBlock(element) || window;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
function getDimensions(element) {
|
|
1239
|
+
return {
|
|
1240
|
+
width: element.offsetWidth,
|
|
1241
|
+
height: element.offsetHeight
|
|
1242
|
+
};
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
1246
|
+
let {
|
|
1247
|
+
rect,
|
|
1248
|
+
offsetParent,
|
|
1249
|
+
strategy
|
|
1250
|
+
} = _ref;
|
|
1251
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1252
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
1253
|
+
|
|
1254
|
+
if (offsetParent === documentElement) {
|
|
1255
|
+
return rect;
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
let scroll = {
|
|
1259
|
+
scrollLeft: 0,
|
|
1260
|
+
scrollTop: 0
|
|
1261
|
+
};
|
|
1262
|
+
const offsets = {
|
|
1263
|
+
x: 0,
|
|
1264
|
+
y: 0
|
|
1265
|
+
};
|
|
1266
|
+
|
|
1267
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
|
|
1268
|
+
if (getNodeName(offsetParent) !== 'body' || isScrollParent(documentElement)) {
|
|
1269
|
+
scroll = getNodeScroll(offsetParent);
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
if (isHTMLElement(offsetParent)) {
|
|
1273
|
+
const offsetRect = getBoundingClientRect(offsetParent, true);
|
|
1274
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1275
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1276
|
+
} // This doesn't appear to be need to be negated.
|
|
1277
|
+
// else if (documentElement) {
|
|
1278
|
+
// offsets.x = getWindowScrollBarX(documentElement);
|
|
1279
|
+
// }
|
|
1280
|
+
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
return { ...rect,
|
|
1284
|
+
x: rect.x - scroll.scrollLeft + offsets.x,
|
|
1285
|
+
y: rect.y - scroll.scrollTop + offsets.y
|
|
1286
|
+
};
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
function getViewportRect(element) {
|
|
1290
|
+
const win = getWindow(element);
|
|
1291
|
+
const html = getDocumentElement(element);
|
|
1292
|
+
const visualViewport = win.visualViewport;
|
|
1293
|
+
let width = html.clientWidth;
|
|
1294
|
+
let height = html.clientHeight;
|
|
1295
|
+
let x = 0;
|
|
1296
|
+
let y = 0;
|
|
1297
|
+
|
|
1298
|
+
if (visualViewport) {
|
|
1299
|
+
width = visualViewport.width;
|
|
1300
|
+
height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
|
|
1301
|
+
// In Chrome, it returns a value very close to 0 (+/-) but contains rounding
|
|
1302
|
+
// errors due to floating point numbers, so we need to check precision.
|
|
1303
|
+
// Safari returns a number <= 0, usually < -1 when pinch-zoomed
|
|
1304
|
+
|
|
1305
|
+
if (Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) < 0.01) {
|
|
1306
|
+
x = visualViewport.offsetLeft;
|
|
1307
|
+
y = visualViewport.offsetTop;
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
return {
|
|
1312
|
+
width,
|
|
1313
|
+
height,
|
|
1314
|
+
x,
|
|
1315
|
+
y
|
|
1316
|
+
};
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
// of the `<html>` and `<body>` rect bounds if horizontally scrollable
|
|
1320
|
+
|
|
1321
|
+
function getDocumentRect(element) {
|
|
1322
|
+
var _element$ownerDocumen;
|
|
1323
|
+
|
|
1324
|
+
const html = getDocumentElement(element);
|
|
1325
|
+
const scroll = getNodeScroll(element);
|
|
1326
|
+
const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
|
1327
|
+
const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
|
1328
|
+
const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
|
1329
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
1330
|
+
const y = -scroll.scrollTop;
|
|
1331
|
+
|
|
1332
|
+
if (getComputedStyle$1(body || html).direction === 'rtl') {
|
|
1333
|
+
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
return {
|
|
1337
|
+
width,
|
|
1338
|
+
height,
|
|
1339
|
+
x,
|
|
1340
|
+
y
|
|
1341
|
+
};
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
function getScrollParent(node) {
|
|
1345
|
+
if (['html', 'body', '#document'].includes(getNodeName(node))) {
|
|
1346
|
+
// @ts-ignore assume body is always available
|
|
1347
|
+
return node.ownerDocument.body;
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
if (isHTMLElement(node) && isScrollParent(node)) {
|
|
1351
|
+
return node;
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
return getScrollParent(getParentNode(node));
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
function getScrollParents(node, list) {
|
|
1358
|
+
var _node$ownerDocument;
|
|
1359
|
+
|
|
1360
|
+
if (list === void 0) {
|
|
1361
|
+
list = [];
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
const scrollParent = getScrollParent(node);
|
|
1365
|
+
const isBody = scrollParent === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
|
|
1366
|
+
const win = getWindow(scrollParent);
|
|
1367
|
+
const target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
|
|
1368
|
+
const updatedList = list.concat(target);
|
|
1369
|
+
return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
|
|
1370
|
+
updatedList.concat(getScrollParents(getParentNode(target)));
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
function contains(parent, child) {
|
|
1374
|
+
const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
|
|
1375
|
+
|
|
1376
|
+
if (parent.contains(child)) {
|
|
1377
|
+
return true;
|
|
1378
|
+
} // then fallback to custom implementation with Shadow DOM support
|
|
1379
|
+
else if (rootNode && isShadowRoot(rootNode)) {
|
|
1380
|
+
let next = child;
|
|
1381
|
+
|
|
1382
|
+
do {
|
|
1383
|
+
// use `===` replace node.isSameNode()
|
|
1384
|
+
if (next && parent === next) {
|
|
1385
|
+
return true;
|
|
1386
|
+
} // @ts-ignore: need a better way to handle this...
|
|
1387
|
+
|
|
1388
|
+
|
|
1389
|
+
next = next.parentNode || next.host;
|
|
1390
|
+
} while (next);
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
return false;
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
function getInnerBoundingClientRect(element) {
|
|
1397
|
+
const clientRect = getBoundingClientRect(element);
|
|
1398
|
+
const top = clientRect.top + element.clientTop;
|
|
1399
|
+
const left = clientRect.left + element.clientLeft;
|
|
1400
|
+
return {
|
|
1401
|
+
top,
|
|
1402
|
+
left,
|
|
1403
|
+
x: left,
|
|
1404
|
+
y: top,
|
|
1405
|
+
right: left + element.clientWidth,
|
|
1406
|
+
bottom: top + element.clientHeight,
|
|
1407
|
+
width: element.clientWidth,
|
|
1408
|
+
height: element.clientHeight
|
|
1409
|
+
};
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
function getClientRectFromClippingParent(element, clippingParent) {
|
|
1413
|
+
if (clippingParent === 'viewport') {
|
|
1414
|
+
return rectToClientRect(getViewportRect(element));
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
if (isElement(clippingParent)) {
|
|
1418
|
+
return getInnerBoundingClientRect(clippingParent);
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
return rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
|
1422
|
+
} // A "clipping parent" is an overflowable container with the characteristic of
|
|
1423
|
+
// clipping (or hiding) overflowing elements with a position different from
|
|
1424
|
+
// `initial`
|
|
1425
|
+
|
|
1426
|
+
|
|
1427
|
+
function getClippingParents(element) {
|
|
1428
|
+
const clippingParents = getScrollParents(getParentNode(element));
|
|
1429
|
+
const canEscapeClipping = ['absolute', 'fixed'].includes(getComputedStyle$1(element).position);
|
|
1430
|
+
const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
|
|
1431
|
+
|
|
1432
|
+
if (!isElement(clipperElement)) {
|
|
1433
|
+
return [];
|
|
1434
|
+
} // @ts-ignore isElement check ensures we return Array<Element>
|
|
1435
|
+
|
|
1436
|
+
|
|
1437
|
+
return clippingParents.filter(clippingParent => isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body');
|
|
1438
|
+
} // Gets the maximum area that the element is visible in due to any number of
|
|
1439
|
+
// clipping parents
|
|
1440
|
+
|
|
1441
|
+
|
|
1442
|
+
function getClippingClientRect(_ref) {
|
|
1443
|
+
let {
|
|
1444
|
+
element,
|
|
1445
|
+
boundary,
|
|
1446
|
+
rootBoundary
|
|
1447
|
+
} = _ref;
|
|
1448
|
+
const mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
|
|
1449
|
+
const clippingParents = [...mainClippingParents, rootBoundary];
|
|
1450
|
+
const firstClippingParent = clippingParents[0];
|
|
1451
|
+
const clippingRect = clippingParents.reduce((accRect, clippingParent) => {
|
|
1452
|
+
const rect = getClientRectFromClippingParent(element, clippingParent);
|
|
1453
|
+
accRect.top = max(rect.top, accRect.top);
|
|
1454
|
+
accRect.right = min(rect.right, accRect.right);
|
|
1455
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
1456
|
+
accRect.left = max(rect.left, accRect.left);
|
|
1457
|
+
return accRect;
|
|
1458
|
+
}, getClientRectFromClippingParent(element, firstClippingParent));
|
|
1459
|
+
clippingRect.width = clippingRect.right - clippingRect.left;
|
|
1460
|
+
clippingRect.height = clippingRect.bottom - clippingRect.top;
|
|
1461
|
+
clippingRect.x = clippingRect.left;
|
|
1462
|
+
clippingRect.y = clippingRect.top;
|
|
1463
|
+
return clippingRect;
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
const platform = {
|
|
1467
|
+
getElementRects: _ref => {
|
|
1468
|
+
let {
|
|
1469
|
+
reference,
|
|
1470
|
+
floating,
|
|
1471
|
+
strategy
|
|
1472
|
+
} = _ref;
|
|
1473
|
+
return {
|
|
1474
|
+
reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
|
|
1475
|
+
floating: { ...getDimensions(floating),
|
|
1476
|
+
x: 0,
|
|
1477
|
+
y: 0
|
|
1478
|
+
}
|
|
1479
|
+
};
|
|
1480
|
+
},
|
|
1481
|
+
convertOffsetParentRelativeRectToViewportRelativeRect: args => convertOffsetParentRelativeRectToViewportRelativeRect(args),
|
|
1482
|
+
getOffsetParent: _ref2 => {
|
|
1483
|
+
let {
|
|
1484
|
+
element
|
|
1485
|
+
} = _ref2;
|
|
1486
|
+
return getOffsetParent(element);
|
|
1487
|
+
},
|
|
1488
|
+
isElement: value => isElement(value),
|
|
1489
|
+
getDocumentElement: _ref3 => {
|
|
1490
|
+
let {
|
|
1491
|
+
element
|
|
1492
|
+
} = _ref3;
|
|
1493
|
+
return getDocumentElement(element);
|
|
1494
|
+
},
|
|
1495
|
+
getClippingClientRect: args => getClippingClientRect(args),
|
|
1496
|
+
getDimensions: _ref4 => {
|
|
1497
|
+
let {
|
|
1498
|
+
element
|
|
1499
|
+
} = _ref4;
|
|
1500
|
+
return getDimensions(element);
|
|
1501
|
+
},
|
|
1502
|
+
getClientRects: _ref5 => {
|
|
1503
|
+
let {
|
|
1504
|
+
element
|
|
1505
|
+
} = _ref5;
|
|
1506
|
+
return element.getClientRects();
|
|
1507
|
+
}
|
|
1508
|
+
};
|
|
1509
|
+
|
|
1510
|
+
const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
|
|
1511
|
+
platform,
|
|
1512
|
+
...options
|
|
1513
|
+
});
|
|
1514
|
+
|
|
1515
|
+
var __defProp = Object.defineProperty;
|
|
1516
|
+
var __defProps = Object.defineProperties;
|
|
1517
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
1518
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
1519
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1520
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
1521
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1522
|
+
var __spreadValues = (a, b) => {
|
|
1523
|
+
for (var prop in b || (b = {}))
|
|
1524
|
+
if (__hasOwnProp.call(b, prop))
|
|
1525
|
+
__defNormalProp(a, prop, b[prop]);
|
|
1526
|
+
if (__getOwnPropSymbols)
|
|
1527
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
1528
|
+
if (__propIsEnum.call(b, prop))
|
|
1529
|
+
__defNormalProp(a, prop, b[prop]);
|
|
1530
|
+
}
|
|
1531
|
+
return a;
|
|
1532
|
+
};
|
|
1533
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
1534
|
+
function assign(to, from) {
|
|
1535
|
+
for (const key in from) {
|
|
1536
|
+
if (Object.prototype.hasOwnProperty.call(from, key)) {
|
|
1537
|
+
if (typeof from[key] === "object" && to[key]) {
|
|
1538
|
+
assign(to[key], from[key]);
|
|
1539
|
+
} else {
|
|
1540
|
+
to[key] = from[key];
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
const config = {
|
|
1546
|
+
disabled: false,
|
|
1547
|
+
distance: 5,
|
|
1548
|
+
skidding: 0,
|
|
1549
|
+
container: "body",
|
|
1550
|
+
boundary: void 0,
|
|
1551
|
+
instantMove: false,
|
|
1552
|
+
disposeTimeout: 5e3,
|
|
1553
|
+
popperTriggers: [],
|
|
1554
|
+
strategy: "absolute",
|
|
1555
|
+
preventOverflow: true,
|
|
1556
|
+
flip: true,
|
|
1557
|
+
shift: true,
|
|
1558
|
+
overflowPadding: 0,
|
|
1559
|
+
arrowPadding: 0,
|
|
1560
|
+
arrowOverflow: true,
|
|
1561
|
+
themes: {
|
|
1562
|
+
tooltip: {
|
|
1563
|
+
placement: "top",
|
|
1564
|
+
triggers: ["hover", "focus", "touch"],
|
|
1565
|
+
hideTriggers: (events) => [...events, "click"],
|
|
1566
|
+
delay: {
|
|
1567
|
+
show: 200,
|
|
1568
|
+
hide: 0
|
|
1569
|
+
},
|
|
1570
|
+
handleResize: false,
|
|
1571
|
+
html: false,
|
|
1572
|
+
loadingContent: "..."
|
|
1573
|
+
},
|
|
1574
|
+
dropdown: {
|
|
1575
|
+
placement: "bottom",
|
|
1576
|
+
triggers: ["click"],
|
|
1577
|
+
delay: 0,
|
|
1578
|
+
handleResize: true,
|
|
1579
|
+
autoHide: true
|
|
1580
|
+
},
|
|
1581
|
+
menu: {
|
|
1582
|
+
$extend: "dropdown",
|
|
1583
|
+
triggers: ["hover", "focus"],
|
|
1584
|
+
popperTriggers: ["hover", "focus"],
|
|
1585
|
+
delay: {
|
|
1586
|
+
show: 0,
|
|
1587
|
+
hide: 400
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
};
|
|
1592
|
+
function getDefaultConfig(theme, key) {
|
|
1593
|
+
let themeConfig = config.themes[theme] || {};
|
|
1594
|
+
let value;
|
|
1595
|
+
do {
|
|
1596
|
+
value = themeConfig[key];
|
|
1597
|
+
if (typeof value === "undefined") {
|
|
1598
|
+
if (themeConfig.$extend) {
|
|
1599
|
+
themeConfig = config.themes[themeConfig.$extend] || {};
|
|
1600
|
+
} else {
|
|
1601
|
+
themeConfig = null;
|
|
1602
|
+
value = config[key];
|
|
1603
|
+
}
|
|
1604
|
+
} else {
|
|
1605
|
+
themeConfig = null;
|
|
1606
|
+
}
|
|
1607
|
+
} while (themeConfig);
|
|
1608
|
+
return value;
|
|
1609
|
+
}
|
|
1610
|
+
function getThemeClasses(theme) {
|
|
1611
|
+
const result = [theme];
|
|
1612
|
+
let themeConfig = config.themes[theme] || {};
|
|
1613
|
+
do {
|
|
1614
|
+
if (themeConfig.$extend && !themeConfig.$resetCss) {
|
|
1615
|
+
result.push(themeConfig.$extend);
|
|
1616
|
+
themeConfig = config.themes[themeConfig.$extend] || {};
|
|
1617
|
+
} else {
|
|
1618
|
+
themeConfig = null;
|
|
1619
|
+
}
|
|
1620
|
+
} while (themeConfig);
|
|
1621
|
+
return result.map((c) => `v-popper--theme-${c}`);
|
|
1622
|
+
}
|
|
1623
|
+
function getAllParentThemes(theme) {
|
|
1624
|
+
const result = [theme];
|
|
1625
|
+
let themeConfig = config.themes[theme] || {};
|
|
1626
|
+
do {
|
|
1627
|
+
if (themeConfig.$extend) {
|
|
1628
|
+
result.push(themeConfig.$extend);
|
|
1629
|
+
themeConfig = config.themes[themeConfig.$extend] || {};
|
|
1630
|
+
} else {
|
|
1631
|
+
themeConfig = null;
|
|
1632
|
+
}
|
|
1633
|
+
} while (themeConfig);
|
|
1634
|
+
return result;
|
|
1635
|
+
}
|
|
1636
|
+
var vueResize = "";
|
|
1637
|
+
let supportsPassive = false;
|
|
1638
|
+
if (typeof window !== "undefined") {
|
|
1639
|
+
supportsPassive = false;
|
|
1640
|
+
try {
|
|
1641
|
+
const opts = Object.defineProperty({}, "passive", {
|
|
1642
|
+
get() {
|
|
1643
|
+
supportsPassive = true;
|
|
1644
|
+
}
|
|
1645
|
+
});
|
|
1646
|
+
window.addEventListener("test", null, opts);
|
|
1647
|
+
} catch (e) {
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
let isIOS = false;
|
|
1651
|
+
if (typeof window !== "undefined" && typeof navigator !== "undefined") {
|
|
1652
|
+
isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
|
|
1653
|
+
}
|
|
1654
|
+
const placements = ["auto", "top", "bottom", "left", "right"].reduce((acc, base) => acc.concat([
|
|
1655
|
+
base,
|
|
1656
|
+
`${base}-start`,
|
|
1657
|
+
`${base}-end`
|
|
1658
|
+
]), []);
|
|
1659
|
+
const SHOW_EVENT_MAP = {
|
|
1660
|
+
hover: "mouseenter",
|
|
1661
|
+
focus: "focus",
|
|
1662
|
+
click: "click",
|
|
1663
|
+
touch: "touchstart"
|
|
1664
|
+
};
|
|
1665
|
+
const HIDE_EVENT_MAP = {
|
|
1666
|
+
hover: "mouseleave",
|
|
1667
|
+
focus: "blur",
|
|
1668
|
+
click: "click",
|
|
1669
|
+
touch: "touchend"
|
|
1670
|
+
};
|
|
1671
|
+
function removeFromArray(array, item) {
|
|
1672
|
+
const index = array.indexOf(item);
|
|
1673
|
+
if (index !== -1) {
|
|
1674
|
+
array.splice(index, 1);
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
function nextFrame() {
|
|
1678
|
+
return new Promise((resolve) => requestAnimationFrame(() => {
|
|
1679
|
+
requestAnimationFrame(resolve);
|
|
1680
|
+
}));
|
|
1681
|
+
}
|
|
1682
|
+
const shownPoppers = [];
|
|
1683
|
+
let hidingPopper = null;
|
|
1684
|
+
const shownPoppersByTheme = {};
|
|
1685
|
+
function getShownPoppersByTheme(theme) {
|
|
1686
|
+
let list = shownPoppersByTheme[theme];
|
|
1687
|
+
if (!list) {
|
|
1688
|
+
list = shownPoppersByTheme[theme] = [];
|
|
1689
|
+
}
|
|
1690
|
+
return list;
|
|
1691
|
+
}
|
|
1692
|
+
let Element = function() {
|
|
1693
|
+
};
|
|
1694
|
+
if (typeof window !== "undefined") {
|
|
1695
|
+
Element = window.Element;
|
|
1696
|
+
}
|
|
1697
|
+
function defaultPropFactory(prop) {
|
|
1698
|
+
return function(props) {
|
|
1699
|
+
return getDefaultConfig(props.theme, prop);
|
|
1700
|
+
};
|
|
1701
|
+
}
|
|
1702
|
+
const PROVIDE_KEY = "__floating-vue__popper";
|
|
1703
|
+
var PrivatePopper = () => defineComponent({
|
|
1704
|
+
name: "VPopper",
|
|
1705
|
+
provide() {
|
|
1706
|
+
return {
|
|
1707
|
+
[PROVIDE_KEY]: {
|
|
1708
|
+
parentPopper: this
|
|
1709
|
+
}
|
|
1710
|
+
};
|
|
1711
|
+
},
|
|
1712
|
+
inject: {
|
|
1713
|
+
[PROVIDE_KEY]: { default: null }
|
|
1714
|
+
},
|
|
1715
|
+
props: {
|
|
1716
|
+
theme: {
|
|
1717
|
+
type: String,
|
|
1718
|
+
required: true
|
|
1719
|
+
},
|
|
1720
|
+
targetNodes: {
|
|
1721
|
+
type: Function,
|
|
1722
|
+
required: true
|
|
1723
|
+
},
|
|
1724
|
+
referenceNode: {
|
|
1725
|
+
type: Function,
|
|
1726
|
+
required: true
|
|
1727
|
+
},
|
|
1728
|
+
popperNode: {
|
|
1729
|
+
type: Function,
|
|
1730
|
+
required: true
|
|
1731
|
+
},
|
|
1732
|
+
shown: {
|
|
1733
|
+
type: Boolean,
|
|
1734
|
+
default: false
|
|
1735
|
+
},
|
|
1736
|
+
showGroup: {
|
|
1737
|
+
type: String,
|
|
1738
|
+
default: null
|
|
1739
|
+
},
|
|
1740
|
+
ariaId: {
|
|
1741
|
+
default: null
|
|
1742
|
+
},
|
|
1743
|
+
disabled: {
|
|
1744
|
+
type: Boolean,
|
|
1745
|
+
default: defaultPropFactory("disabled")
|
|
1746
|
+
},
|
|
1747
|
+
positioningDisabled: {
|
|
1748
|
+
type: Boolean,
|
|
1749
|
+
default: defaultPropFactory("positioningDisabled")
|
|
1750
|
+
},
|
|
1751
|
+
placement: {
|
|
1752
|
+
type: String,
|
|
1753
|
+
default: defaultPropFactory("placement"),
|
|
1754
|
+
validator: (value) => placements.includes(value)
|
|
1755
|
+
},
|
|
1756
|
+
delay: {
|
|
1757
|
+
type: [String, Number, Object],
|
|
1758
|
+
default: defaultPropFactory("delay")
|
|
1759
|
+
},
|
|
1760
|
+
distance: {
|
|
1761
|
+
type: [Number, String],
|
|
1762
|
+
default: defaultPropFactory("distance")
|
|
1763
|
+
},
|
|
1764
|
+
skidding: {
|
|
1765
|
+
type: [Number, String],
|
|
1766
|
+
default: defaultPropFactory("skidding")
|
|
1767
|
+
},
|
|
1768
|
+
triggers: {
|
|
1769
|
+
type: Array,
|
|
1770
|
+
default: defaultPropFactory("triggers")
|
|
1771
|
+
},
|
|
1772
|
+
showTriggers: {
|
|
1773
|
+
type: [Array, Function],
|
|
1774
|
+
default: defaultPropFactory("showTriggers")
|
|
1775
|
+
},
|
|
1776
|
+
hideTriggers: {
|
|
1777
|
+
type: [Array, Function],
|
|
1778
|
+
default: defaultPropFactory("hideTriggers")
|
|
1779
|
+
},
|
|
1780
|
+
popperTriggers: {
|
|
1781
|
+
type: Array,
|
|
1782
|
+
default: defaultPropFactory("popperTriggers")
|
|
1783
|
+
},
|
|
1784
|
+
popperShowTriggers: {
|
|
1785
|
+
type: [Array, Function],
|
|
1786
|
+
default: defaultPropFactory("popperShowTriggers")
|
|
1787
|
+
},
|
|
1788
|
+
popperHideTriggers: {
|
|
1789
|
+
type: [Array, Function],
|
|
1790
|
+
default: defaultPropFactory("popperHideTriggers")
|
|
1791
|
+
},
|
|
1792
|
+
container: {
|
|
1793
|
+
type: [String, Object, Element, Boolean],
|
|
1794
|
+
default: defaultPropFactory("container")
|
|
1795
|
+
},
|
|
1796
|
+
boundary: {
|
|
1797
|
+
type: [String, Element],
|
|
1798
|
+
default: defaultPropFactory("boundary")
|
|
1799
|
+
},
|
|
1800
|
+
strategy: {
|
|
1801
|
+
type: String,
|
|
1802
|
+
validator: (value) => ["absolute", "fixed"].includes(value),
|
|
1803
|
+
default: defaultPropFactory("strategy")
|
|
1804
|
+
},
|
|
1805
|
+
autoHide: {
|
|
1806
|
+
type: [Boolean, Function],
|
|
1807
|
+
default: defaultPropFactory("autoHide")
|
|
1808
|
+
},
|
|
1809
|
+
handleResize: {
|
|
1810
|
+
type: Boolean,
|
|
1811
|
+
default: defaultPropFactory("handleResize")
|
|
1812
|
+
},
|
|
1813
|
+
instantMove: {
|
|
1814
|
+
type: Boolean,
|
|
1815
|
+
default: defaultPropFactory("instantMove")
|
|
1816
|
+
},
|
|
1817
|
+
eagerMount: {
|
|
1818
|
+
type: Boolean,
|
|
1819
|
+
default: defaultPropFactory("eagerMount")
|
|
1820
|
+
},
|
|
1821
|
+
popperClass: {
|
|
1822
|
+
type: [String, Array, Object],
|
|
1823
|
+
default: defaultPropFactory("popperClass")
|
|
1824
|
+
},
|
|
1825
|
+
computeTransformOrigin: {
|
|
1826
|
+
type: Boolean,
|
|
1827
|
+
default: defaultPropFactory("computeTransformOrigin")
|
|
1828
|
+
},
|
|
1829
|
+
autoMinSize: {
|
|
1830
|
+
type: Boolean,
|
|
1831
|
+
default: defaultPropFactory("autoMinSize")
|
|
1832
|
+
},
|
|
1833
|
+
autoSize: {
|
|
1834
|
+
type: [Boolean, String],
|
|
1835
|
+
default: defaultPropFactory("autoSize")
|
|
1836
|
+
},
|
|
1837
|
+
autoMaxSize: {
|
|
1838
|
+
type: Boolean,
|
|
1839
|
+
default: defaultPropFactory("autoMaxSize")
|
|
1840
|
+
},
|
|
1841
|
+
autoBoundaryMaxSize: {
|
|
1842
|
+
type: Boolean,
|
|
1843
|
+
default: defaultPropFactory("autoBoundaryMaxSize")
|
|
1844
|
+
},
|
|
1845
|
+
preventOverflow: {
|
|
1846
|
+
type: Boolean,
|
|
1847
|
+
default: defaultPropFactory("preventOverflow")
|
|
1848
|
+
},
|
|
1849
|
+
overflowPadding: {
|
|
1850
|
+
type: [Number, String],
|
|
1851
|
+
default: defaultPropFactory("overflowPadding")
|
|
1852
|
+
},
|
|
1853
|
+
arrowPadding: {
|
|
1854
|
+
type: [Number, String],
|
|
1855
|
+
default: defaultPropFactory("arrowPadding")
|
|
1856
|
+
},
|
|
1857
|
+
arrowOverflow: {
|
|
1858
|
+
type: Boolean,
|
|
1859
|
+
default: defaultPropFactory("arrowOverflow")
|
|
1860
|
+
},
|
|
1861
|
+
flip: {
|
|
1862
|
+
type: Boolean,
|
|
1863
|
+
default: defaultPropFactory("flip")
|
|
1864
|
+
},
|
|
1865
|
+
shift: {
|
|
1866
|
+
type: Boolean,
|
|
1867
|
+
default: defaultPropFactory("shift")
|
|
1868
|
+
},
|
|
1869
|
+
shiftCrossAxis: {
|
|
1870
|
+
type: Boolean,
|
|
1871
|
+
default: defaultPropFactory("shiftCrossAxis")
|
|
1872
|
+
}
|
|
1873
|
+
},
|
|
1874
|
+
emits: [
|
|
1875
|
+
"show",
|
|
1876
|
+
"hide",
|
|
1877
|
+
"update:shown",
|
|
1878
|
+
"apply-show",
|
|
1879
|
+
"apply-hide",
|
|
1880
|
+
"close-group",
|
|
1881
|
+
"close-directive",
|
|
1882
|
+
"auto-hide",
|
|
1883
|
+
"resize",
|
|
1884
|
+
"dispose"
|
|
1885
|
+
],
|
|
1886
|
+
data() {
|
|
1887
|
+
return {
|
|
1888
|
+
isShown: false,
|
|
1889
|
+
isMounted: false,
|
|
1890
|
+
skipTransition: false,
|
|
1891
|
+
classes: {
|
|
1892
|
+
showFrom: false,
|
|
1893
|
+
showTo: false,
|
|
1894
|
+
hideFrom: false,
|
|
1895
|
+
hideTo: true
|
|
1896
|
+
},
|
|
1897
|
+
result: {
|
|
1898
|
+
x: 0,
|
|
1899
|
+
y: 0,
|
|
1900
|
+
placement: "",
|
|
1901
|
+
strategy: this.strategy,
|
|
1902
|
+
arrow: {
|
|
1903
|
+
x: 0,
|
|
1904
|
+
y: 0,
|
|
1905
|
+
centerOffset: 0
|
|
1906
|
+
},
|
|
1907
|
+
transformOrigin: null
|
|
1908
|
+
},
|
|
1909
|
+
shownChildren: new Set(),
|
|
1910
|
+
lastAutoHide: true
|
|
1911
|
+
};
|
|
1912
|
+
},
|
|
1913
|
+
computed: {
|
|
1914
|
+
popperId() {
|
|
1915
|
+
return this.ariaId != null ? this.ariaId : this.randomId;
|
|
1916
|
+
},
|
|
1917
|
+
shouldMountContent() {
|
|
1918
|
+
return this.eagerMount || this.isMounted;
|
|
1919
|
+
},
|
|
1920
|
+
slotData() {
|
|
1921
|
+
return {
|
|
1922
|
+
popperId: this.popperId,
|
|
1923
|
+
isShown: this.isShown,
|
|
1924
|
+
shouldMountContent: this.shouldMountContent,
|
|
1925
|
+
skipTransition: this.skipTransition,
|
|
1926
|
+
autoHide: typeof this.autoHide === "function" ? this.lastAutoHide : this.autoHide,
|
|
1927
|
+
show: this.show,
|
|
1928
|
+
hide: this.hide,
|
|
1929
|
+
handleResize: this.handleResize,
|
|
1930
|
+
onResize: this.onResize,
|
|
1931
|
+
classes: __spreadProps(__spreadValues({}, this.classes), {
|
|
1932
|
+
popperClass: this.popperClass
|
|
1933
|
+
}),
|
|
1934
|
+
result: this.positioningDisabled ? null : this.result,
|
|
1935
|
+
attrs: this.$attrs
|
|
1936
|
+
};
|
|
1937
|
+
},
|
|
1938
|
+
parentPopper() {
|
|
1939
|
+
var _a;
|
|
1940
|
+
return (_a = this[PROVIDE_KEY]) == null ? void 0 : _a.parentPopper;
|
|
1941
|
+
},
|
|
1942
|
+
hasPopperShowTriggerHover() {
|
|
1943
|
+
var _a, _b;
|
|
1944
|
+
return ((_a = this.popperTriggers) == null ? void 0 : _a.includes("hover")) || ((_b = this.popperShowTriggers) == null ? void 0 : _b.includes("hover"));
|
|
1945
|
+
}
|
|
1946
|
+
},
|
|
1947
|
+
watch: __spreadValues(__spreadValues({
|
|
1948
|
+
shown: "$_autoShowHide",
|
|
1949
|
+
disabled(value) {
|
|
1950
|
+
if (value) {
|
|
1951
|
+
this.dispose();
|
|
1952
|
+
} else {
|
|
1953
|
+
this.init();
|
|
1954
|
+
}
|
|
1955
|
+
},
|
|
1956
|
+
async container() {
|
|
1957
|
+
if (this.isShown) {
|
|
1958
|
+
this.$_ensureTeleport();
|
|
1959
|
+
await this.$_computePosition();
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
}, [
|
|
1963
|
+
"triggers",
|
|
1964
|
+
"positioningDisabled"
|
|
1965
|
+
].reduce((acc, prop) => {
|
|
1966
|
+
acc[prop] = "$_refreshListeners";
|
|
1967
|
+
return acc;
|
|
1968
|
+
}, {})), [
|
|
1969
|
+
"placement",
|
|
1970
|
+
"distance",
|
|
1971
|
+
"skidding",
|
|
1972
|
+
"boundary",
|
|
1973
|
+
"strategy",
|
|
1974
|
+
"overflowPadding",
|
|
1975
|
+
"arrowPadding",
|
|
1976
|
+
"preventOverflow",
|
|
1977
|
+
"shift",
|
|
1978
|
+
"shiftCrossAxis",
|
|
1979
|
+
"flip"
|
|
1980
|
+
].reduce((acc, prop) => {
|
|
1981
|
+
acc[prop] = "$_computePosition";
|
|
1982
|
+
return acc;
|
|
1983
|
+
}, {})),
|
|
1984
|
+
created() {
|
|
1985
|
+
this.$_isDisposed = true;
|
|
1986
|
+
this.randomId = `popper_${[Math.random(), Date.now()].map((n) => n.toString(36).substring(2, 10)).join("_")}`;
|
|
1987
|
+
if (this.autoMinSize) {
|
|
1988
|
+
console.warn('[floating-vue] `autoMinSize` option is deprecated. Use `autoSize="min"` instead.');
|
|
1989
|
+
}
|
|
1990
|
+
if (this.autoMaxSize) {
|
|
1991
|
+
console.warn("[floating-vue] `autoMaxSize` option is deprecated. Use `autoBoundaryMaxSize` instead.");
|
|
1992
|
+
}
|
|
1993
|
+
},
|
|
1994
|
+
mounted() {
|
|
1995
|
+
this.init();
|
|
1996
|
+
this.$_detachPopperNode();
|
|
1997
|
+
},
|
|
1998
|
+
activated() {
|
|
1999
|
+
this.$_autoShowHide();
|
|
2000
|
+
},
|
|
2001
|
+
deactivated() {
|
|
2002
|
+
this.hide();
|
|
2003
|
+
},
|
|
2004
|
+
beforeUnmount() {
|
|
2005
|
+
this.dispose();
|
|
2006
|
+
},
|
|
2007
|
+
methods: {
|
|
2008
|
+
show({ event = null, skipDelay = false, force = false } = {}) {
|
|
2009
|
+
var _a, _b;
|
|
2010
|
+
if (((_a = this.parentPopper) == null ? void 0 : _a.lockedChild) && this.parentPopper.lockedChild !== this)
|
|
2011
|
+
return;
|
|
2012
|
+
this.$_pendingHide = false;
|
|
2013
|
+
if (force || !this.disabled) {
|
|
2014
|
+
if (((_b = this.parentPopper) == null ? void 0 : _b.lockedChild) === this) {
|
|
2015
|
+
this.parentPopper.lockedChild = null;
|
|
2016
|
+
}
|
|
2017
|
+
this.$_scheduleShow(event, skipDelay);
|
|
2018
|
+
this.$emit("show");
|
|
2019
|
+
this.$_showFrameLocked = true;
|
|
2020
|
+
requestAnimationFrame(() => {
|
|
2021
|
+
this.$_showFrameLocked = false;
|
|
2022
|
+
});
|
|
2023
|
+
}
|
|
2024
|
+
this.$emit("update:shown", true);
|
|
2025
|
+
},
|
|
2026
|
+
hide({ event = null, skipDelay = false } = {}) {
|
|
2027
|
+
var _a;
|
|
2028
|
+
if (this.$_hideInProgress)
|
|
2029
|
+
return;
|
|
2030
|
+
if (this.shownChildren.size > 0) {
|
|
2031
|
+
this.$_pendingHide = true;
|
|
2032
|
+
return;
|
|
2033
|
+
}
|
|
2034
|
+
if (this.hasPopperShowTriggerHover && this.$_isAimingPopper()) {
|
|
2035
|
+
if (this.parentPopper) {
|
|
2036
|
+
this.parentPopper.lockedChild = this;
|
|
2037
|
+
clearTimeout(this.parentPopper.lockedChildTimer);
|
|
2038
|
+
this.parentPopper.lockedChildTimer = setTimeout(() => {
|
|
2039
|
+
if (this.parentPopper.lockedChild === this) {
|
|
2040
|
+
this.parentPopper.lockedChild.hide({ skipDelay });
|
|
2041
|
+
this.parentPopper.lockedChild = null;
|
|
2042
|
+
}
|
|
2043
|
+
}, 1e3);
|
|
2044
|
+
}
|
|
2045
|
+
return;
|
|
2046
|
+
}
|
|
2047
|
+
if (((_a = this.parentPopper) == null ? void 0 : _a.lockedChild) === this) {
|
|
2048
|
+
this.parentPopper.lockedChild = null;
|
|
2049
|
+
}
|
|
2050
|
+
this.$_pendingHide = false;
|
|
2051
|
+
this.$_scheduleHide(event, skipDelay);
|
|
2052
|
+
this.$emit("hide");
|
|
2053
|
+
this.$emit("update:shown", false);
|
|
2054
|
+
},
|
|
2055
|
+
init() {
|
|
2056
|
+
if (!this.$_isDisposed)
|
|
2057
|
+
return;
|
|
2058
|
+
this.$_isDisposed = false;
|
|
2059
|
+
this.isMounted = false;
|
|
2060
|
+
this.$_events = [];
|
|
2061
|
+
this.$_preventShow = false;
|
|
2062
|
+
this.$_referenceNode = this.referenceNode();
|
|
2063
|
+
this.$_targetNodes = this.targetNodes().filter((e) => e.nodeType === e.ELEMENT_NODE);
|
|
2064
|
+
this.$_popperNode = this.popperNode();
|
|
2065
|
+
this.$_innerNode = this.$_popperNode.querySelector(".v-popper__inner");
|
|
2066
|
+
this.$_arrowNode = this.$_popperNode.querySelector(".v-popper__arrow-container");
|
|
2067
|
+
this.$_swapTargetAttrs("title", "data-original-title");
|
|
2068
|
+
this.$_detachPopperNode();
|
|
2069
|
+
if (this.triggers.length) {
|
|
2070
|
+
this.$_addEventListeners();
|
|
2071
|
+
}
|
|
2072
|
+
if (this.shown) {
|
|
2073
|
+
this.show();
|
|
2074
|
+
}
|
|
2075
|
+
},
|
|
2076
|
+
dispose() {
|
|
2077
|
+
if (this.$_isDisposed)
|
|
2078
|
+
return;
|
|
2079
|
+
this.$_isDisposed = true;
|
|
2080
|
+
this.$_removeEventListeners();
|
|
2081
|
+
this.hide({ skipDelay: true });
|
|
2082
|
+
this.$_detachPopperNode();
|
|
2083
|
+
this.isMounted = false;
|
|
2084
|
+
this.isShown = false;
|
|
2085
|
+
this.$_updateParentShownChildren(false);
|
|
2086
|
+
this.$_swapTargetAttrs("data-original-title", "title");
|
|
2087
|
+
this.$emit("dispose");
|
|
2088
|
+
},
|
|
2089
|
+
async onResize() {
|
|
2090
|
+
if (this.isShown) {
|
|
2091
|
+
await this.$_computePosition();
|
|
2092
|
+
this.$emit("resize");
|
|
2093
|
+
}
|
|
2094
|
+
},
|
|
2095
|
+
async $_computePosition() {
|
|
2096
|
+
var _a;
|
|
2097
|
+
if (this.$_isDisposed || this.positioningDisabled)
|
|
2098
|
+
return;
|
|
2099
|
+
const options2 = {
|
|
2100
|
+
strategy: this.strategy,
|
|
2101
|
+
middleware: []
|
|
2102
|
+
};
|
|
2103
|
+
if (this.distance || this.skidding) {
|
|
2104
|
+
options2.middleware.push(offset({
|
|
2105
|
+
mainAxis: this.distance,
|
|
2106
|
+
crossAxis: this.skidding
|
|
2107
|
+
}));
|
|
2108
|
+
}
|
|
2109
|
+
const isPlacementAuto = this.placement.startsWith("auto");
|
|
2110
|
+
if (isPlacementAuto) {
|
|
2111
|
+
options2.middleware.push(autoPlacement({
|
|
2112
|
+
alignment: (_a = this.placement.split("-")[1]) != null ? _a : ""
|
|
2113
|
+
}));
|
|
2114
|
+
} else {
|
|
2115
|
+
options2.placement = this.placement;
|
|
2116
|
+
}
|
|
2117
|
+
if (this.preventOverflow) {
|
|
2118
|
+
if (this.shift) {
|
|
2119
|
+
options2.middleware.push(shift({
|
|
2120
|
+
padding: this.overflowPadding,
|
|
2121
|
+
boundary: this.boundary,
|
|
2122
|
+
crossAxis: this.shiftCrossAxis
|
|
2123
|
+
}));
|
|
2124
|
+
}
|
|
2125
|
+
if (!isPlacementAuto && this.flip) {
|
|
2126
|
+
options2.middleware.push(flip({
|
|
2127
|
+
padding: this.overflowPadding,
|
|
2128
|
+
boundary: this.boundary
|
|
2129
|
+
}));
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
options2.middleware.push(arrow({
|
|
2133
|
+
element: this.$_arrowNode,
|
|
2134
|
+
padding: this.arrowPadding
|
|
2135
|
+
}));
|
|
2136
|
+
if (this.arrowOverflow) {
|
|
2137
|
+
options2.middleware.push({
|
|
2138
|
+
name: "arrowOverflow",
|
|
2139
|
+
fn: ({ placement, rects, middlewareData }) => {
|
|
2140
|
+
let overflow;
|
|
2141
|
+
const { centerOffset } = middlewareData.arrow;
|
|
2142
|
+
if (placement.startsWith("top") || placement.startsWith("bottom")) {
|
|
2143
|
+
overflow = Math.abs(centerOffset) > rects.reference.width / 2;
|
|
2144
|
+
} else {
|
|
2145
|
+
overflow = Math.abs(centerOffset) > rects.reference.height / 2;
|
|
2146
|
+
}
|
|
2147
|
+
return {
|
|
2148
|
+
data: {
|
|
2149
|
+
overflow
|
|
2150
|
+
}
|
|
2151
|
+
};
|
|
2152
|
+
}
|
|
2153
|
+
});
|
|
2154
|
+
}
|
|
2155
|
+
if (this.autoMinSize || this.autoSize) {
|
|
2156
|
+
const autoSize = this.autoSize ? this.autoSize : this.autoMinSize ? "min" : null;
|
|
2157
|
+
options2.middleware.push({
|
|
2158
|
+
name: "autoSize",
|
|
2159
|
+
fn: ({ rects, placement, middlewareData }) => {
|
|
2160
|
+
var _a2;
|
|
2161
|
+
if ((_a2 = middlewareData.autoSize) == null ? void 0 : _a2.skip) {
|
|
2162
|
+
return {};
|
|
2163
|
+
}
|
|
2164
|
+
let width;
|
|
2165
|
+
let height;
|
|
2166
|
+
if (placement.startsWith("top") || placement.startsWith("bottom")) {
|
|
2167
|
+
width = rects.reference.width;
|
|
2168
|
+
} else {
|
|
2169
|
+
height = rects.reference.height;
|
|
2170
|
+
}
|
|
2171
|
+
this.$_innerNode.style[autoSize === "min" ? "minWidth" : autoSize === "max" ? "maxWidth" : "width"] = width != null ? `${width}px` : null;
|
|
2172
|
+
this.$_innerNode.style[autoSize === "min" ? "minHeight" : autoSize === "max" ? "maxHeight" : "height"] = height != null ? `${height}px` : null;
|
|
2173
|
+
return {
|
|
2174
|
+
data: {
|
|
2175
|
+
skip: true
|
|
2176
|
+
},
|
|
2177
|
+
reset: {
|
|
2178
|
+
rects: true
|
|
2179
|
+
}
|
|
2180
|
+
};
|
|
2181
|
+
}
|
|
2182
|
+
});
|
|
2183
|
+
}
|
|
2184
|
+
if (this.autoMaxSize || this.autoBoundaryMaxSize) {
|
|
2185
|
+
this.$_innerNode.style.maxWidth = null;
|
|
2186
|
+
this.$_innerNode.style.maxHeight = null;
|
|
2187
|
+
options2.middleware.push(size({
|
|
2188
|
+
boundary: this.boundary,
|
|
2189
|
+
padding: this.overflowPadding,
|
|
2190
|
+
apply: ({ width, height }) => {
|
|
2191
|
+
this.$_innerNode.style.maxWidth = width != null ? `${width}px` : null;
|
|
2192
|
+
this.$_innerNode.style.maxHeight = height != null ? `${height}px` : null;
|
|
2193
|
+
}
|
|
2194
|
+
}));
|
|
2195
|
+
}
|
|
2196
|
+
const data = await computePosition(this.$_referenceNode, this.$_popperNode, options2);
|
|
2197
|
+
Object.assign(this.result, {
|
|
2198
|
+
x: data.x,
|
|
2199
|
+
y: data.y,
|
|
2200
|
+
placement: data.placement,
|
|
2201
|
+
strategy: data.strategy,
|
|
2202
|
+
arrow: __spreadValues(__spreadValues({}, data.middlewareData.arrow), data.middlewareData.arrowOverflow)
|
|
2203
|
+
});
|
|
2204
|
+
},
|
|
2205
|
+
$_scheduleShow(event = null, skipDelay = false) {
|
|
2206
|
+
this.$_updateParentShownChildren(true);
|
|
2207
|
+
this.$_hideInProgress = false;
|
|
2208
|
+
clearTimeout(this.$_scheduleTimer);
|
|
2209
|
+
if (hidingPopper && this.instantMove && hidingPopper.instantMove && hidingPopper !== this.parentPopper) {
|
|
2210
|
+
hidingPopper.$_applyHide(true);
|
|
2211
|
+
this.$_applyShow(true);
|
|
2212
|
+
return;
|
|
2213
|
+
}
|
|
2214
|
+
if (skipDelay) {
|
|
2215
|
+
this.$_applyShow();
|
|
2216
|
+
} else {
|
|
2217
|
+
this.$_scheduleTimer = setTimeout(this.$_applyShow.bind(this), this.$_computeDelay("show"));
|
|
2218
|
+
}
|
|
2219
|
+
},
|
|
2220
|
+
$_scheduleHide(event = null, skipDelay = false) {
|
|
2221
|
+
if (this.shownChildren.size > 0) {
|
|
2222
|
+
this.$_pendingHide = true;
|
|
2223
|
+
return;
|
|
2224
|
+
}
|
|
2225
|
+
this.$_updateParentShownChildren(false);
|
|
2226
|
+
this.$_hideInProgress = true;
|
|
2227
|
+
clearTimeout(this.$_scheduleTimer);
|
|
2228
|
+
if (this.isShown) {
|
|
2229
|
+
hidingPopper = this;
|
|
2230
|
+
}
|
|
2231
|
+
if (skipDelay) {
|
|
2232
|
+
this.$_applyHide();
|
|
2233
|
+
} else {
|
|
2234
|
+
this.$_scheduleTimer = setTimeout(this.$_applyHide.bind(this), this.$_computeDelay("hide"));
|
|
2235
|
+
}
|
|
2236
|
+
},
|
|
2237
|
+
$_computeDelay(type) {
|
|
2238
|
+
const delay = this.delay;
|
|
2239
|
+
return parseInt(delay && delay[type] || delay || 0);
|
|
2240
|
+
},
|
|
2241
|
+
async $_applyShow(skipTransition = false) {
|
|
2242
|
+
clearTimeout(this.$_disposeTimer);
|
|
2243
|
+
clearTimeout(this.$_scheduleTimer);
|
|
2244
|
+
this.skipTransition = skipTransition;
|
|
2245
|
+
if (this.isShown) {
|
|
2246
|
+
return;
|
|
2247
|
+
}
|
|
2248
|
+
this.$_ensureTeleport();
|
|
2249
|
+
await nextFrame();
|
|
2250
|
+
await this.$_computePosition();
|
|
2251
|
+
await this.$_applyShowEffect();
|
|
2252
|
+
if (!this.positioningDisabled) {
|
|
2253
|
+
this.$_registerEventListeners([
|
|
2254
|
+
...getScrollParents(this.$_referenceNode),
|
|
2255
|
+
...getScrollParents(this.$_popperNode)
|
|
2256
|
+
], "scroll", () => {
|
|
2257
|
+
this.$_computePosition();
|
|
2258
|
+
});
|
|
2259
|
+
}
|
|
2260
|
+
},
|
|
2261
|
+
async $_applyShowEffect() {
|
|
2262
|
+
if (this.$_hideInProgress)
|
|
2263
|
+
return;
|
|
2264
|
+
if (this.computeTransformOrigin) {
|
|
2265
|
+
const bounds = this.$_referenceNode.getBoundingClientRect();
|
|
2266
|
+
const popperWrapper = this.$_popperNode.querySelector(".v-popper__wrapper");
|
|
2267
|
+
const parentBounds = popperWrapper.parentNode.getBoundingClientRect();
|
|
2268
|
+
const x = bounds.x + bounds.width / 2 - (parentBounds.left + popperWrapper.offsetLeft);
|
|
2269
|
+
const y = bounds.y + bounds.height / 2 - (parentBounds.top + popperWrapper.offsetTop);
|
|
2270
|
+
this.result.transformOrigin = `${x}px ${y}px`;
|
|
2271
|
+
}
|
|
2272
|
+
this.isShown = true;
|
|
2273
|
+
this.$_applyAttrsToTarget({
|
|
2274
|
+
"aria-describedby": this.popperId,
|
|
2275
|
+
"data-popper-shown": ""
|
|
2276
|
+
});
|
|
2277
|
+
const showGroup = this.showGroup;
|
|
2278
|
+
if (showGroup) {
|
|
2279
|
+
let popover;
|
|
2280
|
+
for (let i = 0; i < shownPoppers.length; i++) {
|
|
2281
|
+
popover = shownPoppers[i];
|
|
2282
|
+
if (popover.showGroup !== showGroup) {
|
|
2283
|
+
popover.hide();
|
|
2284
|
+
popover.$emit("close-group");
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
shownPoppers.push(this);
|
|
2289
|
+
document.body.classList.add("v-popper--some-open");
|
|
2290
|
+
for (const theme of getAllParentThemes(this.theme)) {
|
|
2291
|
+
getShownPoppersByTheme(theme).push(this);
|
|
2292
|
+
document.body.classList.add(`v-popper--some-open--${theme}`);
|
|
2293
|
+
}
|
|
2294
|
+
this.$emit("apply-show");
|
|
2295
|
+
this.classes.showFrom = true;
|
|
2296
|
+
this.classes.showTo = false;
|
|
2297
|
+
this.classes.hideFrom = false;
|
|
2298
|
+
this.classes.hideTo = false;
|
|
2299
|
+
await nextFrame();
|
|
2300
|
+
this.classes.showFrom = false;
|
|
2301
|
+
this.classes.showTo = true;
|
|
2302
|
+
this.$_popperNode.focus();
|
|
2303
|
+
},
|
|
2304
|
+
async $_applyHide(skipTransition = false) {
|
|
2305
|
+
if (this.shownChildren.size > 0) {
|
|
2306
|
+
this.$_pendingHide = true;
|
|
2307
|
+
this.$_hideInProgress = false;
|
|
2308
|
+
return;
|
|
2309
|
+
}
|
|
2310
|
+
clearTimeout(this.$_scheduleTimer);
|
|
2311
|
+
if (!this.isShown) {
|
|
2312
|
+
return;
|
|
2313
|
+
}
|
|
2314
|
+
this.skipTransition = skipTransition;
|
|
2315
|
+
removeFromArray(shownPoppers, this);
|
|
2316
|
+
if (shownPoppers.length === 0) {
|
|
2317
|
+
document.body.classList.remove("v-popper--some-open");
|
|
2318
|
+
}
|
|
2319
|
+
for (const theme of getAllParentThemes(this.theme)) {
|
|
2320
|
+
const list = getShownPoppersByTheme(theme);
|
|
2321
|
+
removeFromArray(list, this);
|
|
2322
|
+
if (list.length === 0) {
|
|
2323
|
+
document.body.classList.remove(`v-popper--some-open--${theme}`);
|
|
2324
|
+
}
|
|
2325
|
+
}
|
|
2326
|
+
if (hidingPopper === this) {
|
|
2327
|
+
hidingPopper = null;
|
|
2328
|
+
}
|
|
2329
|
+
this.isShown = false;
|
|
2330
|
+
this.$_applyAttrsToTarget({
|
|
2331
|
+
"aria-describedby": void 0,
|
|
2332
|
+
"data-popper-shown": void 0
|
|
2333
|
+
});
|
|
2334
|
+
clearTimeout(this.$_disposeTimer);
|
|
2335
|
+
const disposeTime = getDefaultConfig(this.theme, "disposeTimeout");
|
|
2336
|
+
if (disposeTime !== null) {
|
|
2337
|
+
this.$_disposeTimer = setTimeout(() => {
|
|
2338
|
+
if (this.$_popperNode) {
|
|
2339
|
+
this.$_detachPopperNode();
|
|
2340
|
+
this.isMounted = false;
|
|
2341
|
+
}
|
|
2342
|
+
}, disposeTime);
|
|
2343
|
+
}
|
|
2344
|
+
this.$_removeEventListeners("scroll");
|
|
2345
|
+
this.$emit("apply-hide");
|
|
2346
|
+
this.classes.showFrom = false;
|
|
2347
|
+
this.classes.showTo = false;
|
|
2348
|
+
this.classes.hideFrom = true;
|
|
2349
|
+
this.classes.hideTo = false;
|
|
2350
|
+
await nextFrame();
|
|
2351
|
+
this.classes.hideFrom = false;
|
|
2352
|
+
this.classes.hideTo = true;
|
|
2353
|
+
},
|
|
2354
|
+
$_autoShowHide() {
|
|
2355
|
+
if (this.shown) {
|
|
2356
|
+
this.show();
|
|
2357
|
+
} else {
|
|
2358
|
+
this.hide();
|
|
2359
|
+
}
|
|
2360
|
+
},
|
|
2361
|
+
$_ensureTeleport() {
|
|
2362
|
+
if (this.$_isDisposed)
|
|
2363
|
+
return;
|
|
2364
|
+
let container = this.container;
|
|
2365
|
+
if (typeof container === "string") {
|
|
2366
|
+
container = window.document.querySelector(container);
|
|
2367
|
+
} else if (container === false) {
|
|
2368
|
+
container = this.$_targetNodes[0].parentNode;
|
|
2369
|
+
}
|
|
2370
|
+
if (!container) {
|
|
2371
|
+
throw new Error("No container for popover: " + this.container);
|
|
2372
|
+
}
|
|
2373
|
+
container.appendChild(this.$_popperNode);
|
|
2374
|
+
this.isMounted = true;
|
|
2375
|
+
},
|
|
2376
|
+
$_addEventListeners() {
|
|
2377
|
+
const handleShow = (event) => {
|
|
2378
|
+
if (this.isShown && !this.$_hideInProgress) {
|
|
2379
|
+
return;
|
|
2380
|
+
}
|
|
2381
|
+
event.usedByTooltip = true;
|
|
2382
|
+
!this.$_preventShow && this.show({ event });
|
|
2383
|
+
};
|
|
2384
|
+
this.$_registerTriggerListeners(this.$_targetNodes, SHOW_EVENT_MAP, this.triggers, this.showTriggers, handleShow);
|
|
2385
|
+
this.$_registerTriggerListeners([this.$_popperNode], SHOW_EVENT_MAP, this.popperTriggers, this.popperShowTriggers, handleShow);
|
|
2386
|
+
const handleHide = (event) => {
|
|
2387
|
+
if (event.usedByTooltip) {
|
|
2388
|
+
return;
|
|
2389
|
+
}
|
|
2390
|
+
this.hide({ event });
|
|
2391
|
+
};
|
|
2392
|
+
this.$_registerTriggerListeners(this.$_targetNodes, HIDE_EVENT_MAP, this.triggers, this.hideTriggers, handleHide);
|
|
2393
|
+
this.$_registerTriggerListeners([this.$_popperNode], HIDE_EVENT_MAP, this.popperTriggers, this.popperHideTriggers, handleHide);
|
|
2394
|
+
},
|
|
2395
|
+
$_registerEventListeners(targetNodes, eventType, handler) {
|
|
2396
|
+
this.$_events.push({ targetNodes, eventType, handler });
|
|
2397
|
+
targetNodes.forEach((node) => node.addEventListener(eventType, handler, supportsPassive ? {
|
|
2398
|
+
passive: true
|
|
2399
|
+
} : void 0));
|
|
2400
|
+
},
|
|
2401
|
+
$_registerTriggerListeners(targetNodes, eventMap, commonTriggers, customTrigger, handler) {
|
|
2402
|
+
let triggers = commonTriggers;
|
|
2403
|
+
if (customTrigger != null) {
|
|
2404
|
+
triggers = typeof customTrigger === "function" ? customTrigger(triggers) : customTrigger;
|
|
2405
|
+
}
|
|
2406
|
+
triggers.forEach((trigger) => {
|
|
2407
|
+
const eventType = eventMap[trigger];
|
|
2408
|
+
if (eventType) {
|
|
2409
|
+
this.$_registerEventListeners(targetNodes, eventType, handler);
|
|
2410
|
+
}
|
|
2411
|
+
});
|
|
2412
|
+
},
|
|
2413
|
+
$_removeEventListeners(filterEventType) {
|
|
2414
|
+
const newList = [];
|
|
2415
|
+
this.$_events.forEach((listener) => {
|
|
2416
|
+
const { targetNodes, eventType, handler } = listener;
|
|
2417
|
+
if (!filterEventType || filterEventType === eventType) {
|
|
2418
|
+
targetNodes.forEach((node) => node.removeEventListener(eventType, handler));
|
|
2419
|
+
} else {
|
|
2420
|
+
newList.push(listener);
|
|
2421
|
+
}
|
|
2422
|
+
});
|
|
2423
|
+
this.$_events = newList;
|
|
2424
|
+
},
|
|
2425
|
+
$_refreshListeners() {
|
|
2426
|
+
if (!this.$_isDisposed) {
|
|
2427
|
+
this.$_removeEventListeners();
|
|
2428
|
+
this.$_addEventListeners();
|
|
2429
|
+
}
|
|
2430
|
+
},
|
|
2431
|
+
$_handleGlobalClose(event, touch = false) {
|
|
2432
|
+
if (this.$_showFrameLocked)
|
|
2433
|
+
return;
|
|
2434
|
+
this.hide({ event });
|
|
2435
|
+
if (event.closePopover) {
|
|
2436
|
+
this.$emit("close-directive");
|
|
2437
|
+
} else {
|
|
2438
|
+
this.$emit("auto-hide");
|
|
2439
|
+
}
|
|
2440
|
+
if (touch) {
|
|
2441
|
+
this.$_preventShow = true;
|
|
2442
|
+
setTimeout(() => {
|
|
2443
|
+
this.$_preventShow = false;
|
|
2444
|
+
}, 300);
|
|
2445
|
+
}
|
|
2446
|
+
},
|
|
2447
|
+
$_detachPopperNode() {
|
|
2448
|
+
this.$_popperNode.parentNode && this.$_popperNode.parentNode.removeChild(this.$_popperNode);
|
|
2449
|
+
},
|
|
2450
|
+
$_swapTargetAttrs(attrFrom, attrTo) {
|
|
2451
|
+
for (const el of this.$_targetNodes) {
|
|
2452
|
+
const value = el.getAttribute(attrFrom);
|
|
2453
|
+
if (value) {
|
|
2454
|
+
el.removeAttribute(attrFrom);
|
|
2455
|
+
el.setAttribute(attrTo, value);
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
},
|
|
2459
|
+
$_applyAttrsToTarget(attrs) {
|
|
2460
|
+
for (const el of this.$_targetNodes) {
|
|
2461
|
+
for (const n in attrs) {
|
|
2462
|
+
const value = attrs[n];
|
|
2463
|
+
if (value == null) {
|
|
2464
|
+
el.removeAttribute(n);
|
|
2465
|
+
} else {
|
|
2466
|
+
el.setAttribute(n, value);
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
},
|
|
2471
|
+
$_updateParentShownChildren(value) {
|
|
2472
|
+
let parent = this.parentPopper;
|
|
2473
|
+
while (parent) {
|
|
2474
|
+
if (value) {
|
|
2475
|
+
parent.shownChildren.add(this.randomId);
|
|
2476
|
+
} else {
|
|
2477
|
+
parent.shownChildren.delete(this.randomId);
|
|
2478
|
+
if (parent.$_pendingHide) {
|
|
2479
|
+
parent.hide();
|
|
2480
|
+
}
|
|
2481
|
+
}
|
|
2482
|
+
parent = parent.parentPopper;
|
|
2483
|
+
}
|
|
2484
|
+
},
|
|
2485
|
+
$_isAimingPopper() {
|
|
2486
|
+
const referenceBounds = this.$_referenceNode.getBoundingClientRect();
|
|
2487
|
+
if (mouseX >= referenceBounds.left && mouseX <= referenceBounds.right && mouseY >= referenceBounds.top && mouseY <= referenceBounds.bottom) {
|
|
2488
|
+
const popperBounds = this.$_popperNode.getBoundingClientRect();
|
|
2489
|
+
const vectorX = mouseX - mousePreviousX;
|
|
2490
|
+
const vectorY = mouseY - mousePreviousY;
|
|
2491
|
+
const distance = popperBounds.left + popperBounds.width / 2 - mousePreviousX + (popperBounds.top + popperBounds.height / 2) - mousePreviousY;
|
|
2492
|
+
const newVectorLength = distance + popperBounds.width + popperBounds.height;
|
|
2493
|
+
const edgeX = mousePreviousX + vectorX * newVectorLength;
|
|
2494
|
+
const edgeY = mousePreviousY + vectorY * newVectorLength;
|
|
2495
|
+
return lineIntersectsLine(mousePreviousX, mousePreviousY, edgeX, edgeY, popperBounds.left, popperBounds.top, popperBounds.left, popperBounds.bottom) || lineIntersectsLine(mousePreviousX, mousePreviousY, edgeX, edgeY, popperBounds.left, popperBounds.top, popperBounds.right, popperBounds.top) || lineIntersectsLine(mousePreviousX, mousePreviousY, edgeX, edgeY, popperBounds.right, popperBounds.top, popperBounds.right, popperBounds.bottom) || lineIntersectsLine(mousePreviousX, mousePreviousY, edgeX, edgeY, popperBounds.left, popperBounds.bottom, popperBounds.right, popperBounds.bottom);
|
|
2496
|
+
}
|
|
2497
|
+
return false;
|
|
2498
|
+
}
|
|
2499
|
+
},
|
|
2500
|
+
render() {
|
|
2501
|
+
return this.$slots.default(this.slotData);
|
|
2502
|
+
}
|
|
2503
|
+
});
|
|
2504
|
+
if (typeof document !== "undefined" && typeof window !== "undefined") {
|
|
2505
|
+
if (isIOS) {
|
|
2506
|
+
document.addEventListener("touchstart", handleGlobalMousedown, supportsPassive ? {
|
|
2507
|
+
passive: true,
|
|
2508
|
+
capture: true
|
|
2509
|
+
} : true);
|
|
2510
|
+
document.addEventListener("touchend", handleGlobalTouchend, supportsPassive ? {
|
|
2511
|
+
passive: true,
|
|
2512
|
+
capture: true
|
|
2513
|
+
} : true);
|
|
2514
|
+
} else {
|
|
2515
|
+
window.addEventListener("mousedown", handleGlobalMousedown, true);
|
|
2516
|
+
window.addEventListener("click", handleGlobalClick, true);
|
|
2517
|
+
}
|
|
2518
|
+
window.addEventListener("resize", computePositionAllShownPoppers);
|
|
2519
|
+
}
|
|
2520
|
+
function handleGlobalMousedown(event) {
|
|
2521
|
+
for (let i = 0; i < shownPoppers.length; i++) {
|
|
2522
|
+
const popper = shownPoppers[i];
|
|
2523
|
+
try {
|
|
2524
|
+
const popperContent = popper.popperNode();
|
|
2525
|
+
popper.$_mouseDownContains = popperContent.contains(event.target);
|
|
2526
|
+
} catch (e) {
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
}
|
|
2530
|
+
function handleGlobalClick(event) {
|
|
2531
|
+
handleGlobalClose(event);
|
|
2532
|
+
}
|
|
2533
|
+
function handleGlobalTouchend(event) {
|
|
2534
|
+
handleGlobalClose(event, true);
|
|
2535
|
+
}
|
|
2536
|
+
function handleGlobalClose(event, touch = false) {
|
|
2537
|
+
const preventClose = {};
|
|
2538
|
+
for (let i = shownPoppers.length - 1; i >= 0; i--) {
|
|
2539
|
+
const popper = shownPoppers[i];
|
|
2540
|
+
try {
|
|
2541
|
+
const contains = popper.$_containsGlobalTarget = isContainingEventTarget(popper, event);
|
|
2542
|
+
popper.$_pendingHide = false;
|
|
2543
|
+
requestAnimationFrame(() => {
|
|
2544
|
+
popper.$_pendingHide = false;
|
|
2545
|
+
if (preventClose[popper.randomId])
|
|
2546
|
+
return;
|
|
2547
|
+
if (shouldAutoHide(popper, contains, event)) {
|
|
2548
|
+
popper.$_handleGlobalClose(event, touch);
|
|
2549
|
+
if (!event.closeAllPopover && event.closePopover && contains) {
|
|
2550
|
+
let parent2 = popper.parentPopper;
|
|
2551
|
+
while (parent2) {
|
|
2552
|
+
preventClose[parent2.randomId] = true;
|
|
2553
|
+
parent2 = parent2.parentPopper;
|
|
2554
|
+
}
|
|
2555
|
+
return;
|
|
2556
|
+
}
|
|
2557
|
+
let parent = popper.parentPopper;
|
|
2558
|
+
while (parent) {
|
|
2559
|
+
if (shouldAutoHide(parent, parent.$_containsGlobalTarget, event)) {
|
|
2560
|
+
parent.$_handleGlobalClose(event, touch);
|
|
2561
|
+
} else {
|
|
2562
|
+
break;
|
|
2563
|
+
}
|
|
2564
|
+
parent = parent.parentPopper;
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
});
|
|
2568
|
+
} catch (e) {
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
}
|
|
2572
|
+
function isContainingEventTarget(popper, event) {
|
|
2573
|
+
const popperContent = popper.popperNode();
|
|
2574
|
+
return popper.$_mouseDownContains || popperContent.contains(event.target);
|
|
2575
|
+
}
|
|
2576
|
+
function shouldAutoHide(popper, contains, event) {
|
|
2577
|
+
return event.closeAllPopover || event.closePopover && contains || getAutoHideResult(popper, event) && !contains;
|
|
2578
|
+
}
|
|
2579
|
+
function getAutoHideResult(popper, event) {
|
|
2580
|
+
if (typeof popper.autoHide === "function") {
|
|
2581
|
+
const result = popper.autoHide(event);
|
|
2582
|
+
popper.lastAutoHide = result;
|
|
2583
|
+
return result;
|
|
2584
|
+
}
|
|
2585
|
+
return popper.autoHide;
|
|
2586
|
+
}
|
|
2587
|
+
function computePositionAllShownPoppers(event) {
|
|
2588
|
+
for (let i = 0; i < shownPoppers.length; i++) {
|
|
2589
|
+
const popper = shownPoppers[i];
|
|
2590
|
+
popper.$_computePosition(event);
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2593
|
+
function hideAllPoppers() {
|
|
2594
|
+
for (let i = 0; i < shownPoppers.length; i++) {
|
|
2595
|
+
const popper = shownPoppers[i];
|
|
2596
|
+
popper.hide();
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
let mousePreviousX = 0;
|
|
2600
|
+
let mousePreviousY = 0;
|
|
2601
|
+
let mouseX = 0;
|
|
2602
|
+
let mouseY = 0;
|
|
2603
|
+
if (typeof window !== "undefined") {
|
|
2604
|
+
window.addEventListener("mousemove", (event) => {
|
|
2605
|
+
mousePreviousX = mouseX;
|
|
2606
|
+
mousePreviousY = mouseY;
|
|
2607
|
+
mouseX = event.clientX;
|
|
2608
|
+
mouseY = event.clientY;
|
|
2609
|
+
}, supportsPassive ? {
|
|
2610
|
+
passive: true
|
|
2611
|
+
} : void 0);
|
|
2612
|
+
}
|
|
2613
|
+
function lineIntersectsLine(x1, y1, x2, y2, x3, y3, x4, y4) {
|
|
2614
|
+
const uA = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / ((y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1));
|
|
2615
|
+
const uB = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / ((y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1));
|
|
2616
|
+
return uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1;
|
|
2617
|
+
}
|
|
2618
|
+
var _export_sfc = (sfc, props) => {
|
|
2619
|
+
const target = sfc.__vccOpts || sfc;
|
|
2620
|
+
for (const [key, val] of props) {
|
|
2621
|
+
target[key] = val;
|
|
2622
|
+
}
|
|
2623
|
+
return target;
|
|
2624
|
+
};
|
|
2625
|
+
const _sfc_main$6 = {
|
|
2626
|
+
extends: PrivatePopper()
|
|
2627
|
+
};
|
|
2628
|
+
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2629
|
+
return openBlock(), createElementBlock("div", mergeProps({
|
|
2630
|
+
ref: "reference",
|
|
2631
|
+
class: "v-popper"
|
|
2632
|
+
}, _ctx.$attrs, {
|
|
2633
|
+
class: {
|
|
2634
|
+
"v-popper--shown": _ctx.slotData.isShown
|
|
2635
|
+
}
|
|
2636
|
+
}), [
|
|
2637
|
+
renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(_ctx.slotData)))
|
|
2638
|
+
], 16);
|
|
2639
|
+
}
|
|
2640
|
+
var Popper$1 = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$3]]);
|
|
2641
|
+
function getInternetExplorerVersion() {
|
|
2642
|
+
var ua = window.navigator.userAgent;
|
|
2643
|
+
var msie = ua.indexOf("MSIE ");
|
|
2644
|
+
if (msie > 0) {
|
|
2645
|
+
return parseInt(ua.substring(msie + 5, ua.indexOf(".", msie)), 10);
|
|
2646
|
+
}
|
|
2647
|
+
var trident = ua.indexOf("Trident/");
|
|
2648
|
+
if (trident > 0) {
|
|
2649
|
+
var rv = ua.indexOf("rv:");
|
|
2650
|
+
return parseInt(ua.substring(rv + 3, ua.indexOf(".", rv)), 10);
|
|
2651
|
+
}
|
|
2652
|
+
var edge = ua.indexOf("Edge/");
|
|
2653
|
+
if (edge > 0) {
|
|
2654
|
+
return parseInt(ua.substring(edge + 5, ua.indexOf(".", edge)), 10);
|
|
2655
|
+
}
|
|
2656
|
+
return -1;
|
|
2657
|
+
}
|
|
2658
|
+
let isIE;
|
|
2659
|
+
function initCompat() {
|
|
2660
|
+
if (!initCompat.init) {
|
|
2661
|
+
initCompat.init = true;
|
|
2662
|
+
isIE = getInternetExplorerVersion() !== -1;
|
|
2663
|
+
}
|
|
2664
|
+
}
|
|
2665
|
+
var script = {
|
|
2666
|
+
name: "ResizeObserver",
|
|
2667
|
+
props: {
|
|
2668
|
+
emitOnMount: {
|
|
2669
|
+
type: Boolean,
|
|
2670
|
+
default: false
|
|
2671
|
+
},
|
|
2672
|
+
ignoreWidth: {
|
|
2673
|
+
type: Boolean,
|
|
2674
|
+
default: false
|
|
2675
|
+
},
|
|
2676
|
+
ignoreHeight: {
|
|
2677
|
+
type: Boolean,
|
|
2678
|
+
default: false
|
|
2679
|
+
}
|
|
2680
|
+
},
|
|
2681
|
+
emits: [
|
|
2682
|
+
"notify"
|
|
2683
|
+
],
|
|
2684
|
+
mounted() {
|
|
2685
|
+
initCompat();
|
|
2686
|
+
nextTick(() => {
|
|
2687
|
+
this._w = this.$el.offsetWidth;
|
|
2688
|
+
this._h = this.$el.offsetHeight;
|
|
2689
|
+
if (this.emitOnMount) {
|
|
2690
|
+
this.emitSize();
|
|
2691
|
+
}
|
|
2692
|
+
});
|
|
2693
|
+
const object = document.createElement("object");
|
|
2694
|
+
this._resizeObject = object;
|
|
2695
|
+
object.setAttribute("aria-hidden", "true");
|
|
2696
|
+
object.setAttribute("tabindex", -1);
|
|
2697
|
+
object.onload = this.addResizeHandlers;
|
|
2698
|
+
object.type = "text/html";
|
|
2699
|
+
if (isIE) {
|
|
2700
|
+
this.$el.appendChild(object);
|
|
2701
|
+
}
|
|
2702
|
+
object.data = "about:blank";
|
|
2703
|
+
if (!isIE) {
|
|
2704
|
+
this.$el.appendChild(object);
|
|
2705
|
+
}
|
|
2706
|
+
},
|
|
2707
|
+
beforeUnmount() {
|
|
2708
|
+
this.removeResizeHandlers();
|
|
2709
|
+
},
|
|
2710
|
+
methods: {
|
|
2711
|
+
compareAndNotify() {
|
|
2712
|
+
if (!this.ignoreWidth && this._w !== this.$el.offsetWidth || !this.ignoreHeight && this._h !== this.$el.offsetHeight) {
|
|
2713
|
+
this._w = this.$el.offsetWidth;
|
|
2714
|
+
this._h = this.$el.offsetHeight;
|
|
2715
|
+
this.emitSize();
|
|
2716
|
+
}
|
|
2717
|
+
},
|
|
2718
|
+
emitSize() {
|
|
2719
|
+
this.$emit("notify", {
|
|
2720
|
+
width: this._w,
|
|
2721
|
+
height: this._h
|
|
2722
|
+
});
|
|
2723
|
+
},
|
|
2724
|
+
addResizeHandlers() {
|
|
2725
|
+
this._resizeObject.contentDocument.defaultView.addEventListener("resize", this.compareAndNotify);
|
|
2726
|
+
this.compareAndNotify();
|
|
2727
|
+
},
|
|
2728
|
+
removeResizeHandlers() {
|
|
2729
|
+
if (this._resizeObject && this._resizeObject.onload) {
|
|
2730
|
+
if (!isIE && this._resizeObject.contentDocument) {
|
|
2731
|
+
this._resizeObject.contentDocument.defaultView.removeEventListener("resize", this.compareAndNotify);
|
|
2732
|
+
}
|
|
2733
|
+
this.$el.removeChild(this._resizeObject);
|
|
2734
|
+
this._resizeObject.onload = null;
|
|
2735
|
+
this._resizeObject = null;
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
};
|
|
2740
|
+
const _withId = /* @__PURE__ */ withScopeId("data-v-b329ee4c");
|
|
2741
|
+
pushScopeId("data-v-b329ee4c");
|
|
2742
|
+
const _hoisted_1$2 = {
|
|
2743
|
+
class: "resize-observer",
|
|
2744
|
+
tabindex: "-1"
|
|
2745
|
+
};
|
|
2746
|
+
popScopeId();
|
|
2747
|
+
const render = /* @__PURE__ */ _withId((_ctx, _cache, $props, $setup, $data, $options) => {
|
|
2748
|
+
return openBlock(), createBlock("div", _hoisted_1$2);
|
|
2749
|
+
});
|
|
2750
|
+
script.render = render;
|
|
2751
|
+
script.__scopeId = "data-v-b329ee4c";
|
|
2752
|
+
script.__file = "src/components/ResizeObserver.vue";
|
|
2753
|
+
var PrivateThemeClass = (prop = "theme") => ({
|
|
2754
|
+
computed: {
|
|
2755
|
+
themeClass() {
|
|
2756
|
+
return getThemeClasses(this[prop]);
|
|
2757
|
+
}
|
|
2758
|
+
}
|
|
2759
|
+
});
|
|
2760
|
+
var PopperContent_vue_vue_type_style_index_0_lang = "";
|
|
2761
|
+
const _sfc_main$5 = defineComponent({
|
|
2762
|
+
name: "VPopperContent",
|
|
2763
|
+
components: {
|
|
2764
|
+
ResizeObserver: script
|
|
2765
|
+
},
|
|
2766
|
+
mixins: [
|
|
2767
|
+
PrivateThemeClass()
|
|
2768
|
+
],
|
|
2769
|
+
props: {
|
|
2770
|
+
popperId: String,
|
|
2771
|
+
theme: String,
|
|
2772
|
+
shown: Boolean,
|
|
2773
|
+
mounted: Boolean,
|
|
2774
|
+
skipTransition: Boolean,
|
|
2775
|
+
autoHide: Boolean,
|
|
2776
|
+
handleResize: Boolean,
|
|
2777
|
+
classes: Object,
|
|
2778
|
+
result: Object
|
|
2779
|
+
},
|
|
2780
|
+
emits: [
|
|
2781
|
+
"hide",
|
|
2782
|
+
"resize"
|
|
2783
|
+
],
|
|
2784
|
+
methods: {
|
|
2785
|
+
toPx(value) {
|
|
2786
|
+
if (value != null && !isNaN(value)) {
|
|
2787
|
+
return `${value}px`;
|
|
2788
|
+
}
|
|
2789
|
+
return null;
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
});
|
|
2793
|
+
const _hoisted_1$1 = ["id", "aria-hidden", "tabindex", "data-popper-placement"];
|
|
2794
|
+
const _hoisted_2$1 = {
|
|
2795
|
+
ref: "inner",
|
|
2796
|
+
class: "v-popper__inner"
|
|
2797
|
+
};
|
|
2798
|
+
const _hoisted_3 = /* @__PURE__ */ createBaseVNode("div", { class: "v-popper__arrow-outer" }, null, -1);
|
|
2799
|
+
const _hoisted_4 = /* @__PURE__ */ createBaseVNode("div", { class: "v-popper__arrow-inner" }, null, -1);
|
|
2800
|
+
const _hoisted_5 = [
|
|
2801
|
+
_hoisted_3,
|
|
2802
|
+
_hoisted_4
|
|
2803
|
+
];
|
|
2804
|
+
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2805
|
+
const _component_ResizeObserver = resolveComponent("ResizeObserver");
|
|
2806
|
+
return openBlock(), createElementBlock("div", {
|
|
2807
|
+
id: _ctx.popperId,
|
|
2808
|
+
ref: "popover",
|
|
2809
|
+
class: normalizeClass(["v-popper__popper", [
|
|
2810
|
+
_ctx.themeClass,
|
|
2811
|
+
_ctx.classes.popperClass,
|
|
2812
|
+
{
|
|
2813
|
+
"v-popper__popper--shown": _ctx.shown,
|
|
2814
|
+
"v-popper__popper--hidden": !_ctx.shown,
|
|
2815
|
+
"v-popper__popper--show-from": _ctx.classes.showFrom,
|
|
2816
|
+
"v-popper__popper--show-to": _ctx.classes.showTo,
|
|
2817
|
+
"v-popper__popper--hide-from": _ctx.classes.hideFrom,
|
|
2818
|
+
"v-popper__popper--hide-to": _ctx.classes.hideTo,
|
|
2819
|
+
"v-popper__popper--skip-transition": _ctx.skipTransition,
|
|
2820
|
+
"v-popper__popper--arrow-overflow": _ctx.result && _ctx.result.arrow.overflow,
|
|
2821
|
+
"v-popper__popper--no-positioning": !_ctx.result
|
|
2822
|
+
}
|
|
2823
|
+
]]),
|
|
2824
|
+
style: normalizeStyle(_ctx.result ? {
|
|
2825
|
+
position: _ctx.result.strategy,
|
|
2826
|
+
transform: `translate3d(${Math.round(_ctx.result.x)}px,${Math.round(_ctx.result.y)}px,0)`
|
|
2827
|
+
} : void 0),
|
|
2828
|
+
"aria-hidden": _ctx.shown ? "false" : "true",
|
|
2829
|
+
tabindex: _ctx.autoHide ? 0 : void 0,
|
|
2830
|
+
"data-popper-placement": _ctx.result ? _ctx.result.placement : void 0,
|
|
2831
|
+
onKeyup: _cache[2] || (_cache[2] = withKeys(($event) => _ctx.autoHide && _ctx.$emit("hide"), ["esc"]))
|
|
2832
|
+
}, [
|
|
2833
|
+
createBaseVNode("div", {
|
|
2834
|
+
class: "v-popper__backdrop",
|
|
2835
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.autoHide && _ctx.$emit("hide"))
|
|
2836
|
+
}),
|
|
2837
|
+
createBaseVNode("div", {
|
|
2838
|
+
class: "v-popper__wrapper",
|
|
2839
|
+
style: normalizeStyle(_ctx.result ? {
|
|
2840
|
+
transformOrigin: _ctx.result.transformOrigin
|
|
2841
|
+
} : void 0)
|
|
2842
|
+
}, [
|
|
2843
|
+
createBaseVNode("div", _hoisted_2$1, [
|
|
2844
|
+
_ctx.mounted ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2845
|
+
createBaseVNode("div", null, [
|
|
2846
|
+
renderSlot(_ctx.$slots, "default")
|
|
2847
|
+
]),
|
|
2848
|
+
_ctx.handleResize ? (openBlock(), createBlock(_component_ResizeObserver, {
|
|
2849
|
+
key: 0,
|
|
2850
|
+
onNotify: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("resize", $event))
|
|
2851
|
+
})) : createCommentVNode("", true)
|
|
2852
|
+
], 64)) : createCommentVNode("", true)
|
|
2853
|
+
], 512),
|
|
2854
|
+
createBaseVNode("div", {
|
|
2855
|
+
ref: "arrow",
|
|
2856
|
+
class: "v-popper__arrow-container",
|
|
2857
|
+
style: normalizeStyle(_ctx.result ? {
|
|
2858
|
+
left: _ctx.toPx(_ctx.result.arrow.x),
|
|
2859
|
+
top: _ctx.toPx(_ctx.result.arrow.y)
|
|
2860
|
+
} : void 0)
|
|
2861
|
+
}, _hoisted_5, 4)
|
|
2862
|
+
], 4)
|
|
2863
|
+
], 46, _hoisted_1$1);
|
|
2864
|
+
}
|
|
2865
|
+
var PrivatePopperContent = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$2]]);
|
|
2866
|
+
var PrivatePopperMethods = {
|
|
2867
|
+
methods: {
|
|
2868
|
+
show(...args) {
|
|
2869
|
+
return this.$refs.popper.show(...args);
|
|
2870
|
+
},
|
|
2871
|
+
hide(...args) {
|
|
2872
|
+
return this.$refs.popper.hide(...args);
|
|
2873
|
+
},
|
|
2874
|
+
dispose(...args) {
|
|
2875
|
+
return this.$refs.popper.dispose(...args);
|
|
2876
|
+
},
|
|
2877
|
+
onResize(...args) {
|
|
2878
|
+
return this.$refs.popper.onResize(...args);
|
|
2879
|
+
}
|
|
2880
|
+
}
|
|
2881
|
+
};
|
|
2882
|
+
const _sfc_main$4 = defineComponent({
|
|
2883
|
+
name: "VPopperWrapper",
|
|
2884
|
+
components: {
|
|
2885
|
+
Popper: Popper$1,
|
|
2886
|
+
PopperContent: PrivatePopperContent
|
|
2887
|
+
},
|
|
2888
|
+
mixins: [
|
|
2889
|
+
PrivatePopperMethods,
|
|
2890
|
+
PrivateThemeClass("finalTheme")
|
|
2891
|
+
],
|
|
2892
|
+
props: {
|
|
2893
|
+
theme: {
|
|
2894
|
+
type: String,
|
|
2895
|
+
default: null
|
|
2896
|
+
}
|
|
2897
|
+
},
|
|
2898
|
+
computed: {
|
|
2899
|
+
finalTheme() {
|
|
2900
|
+
var _a;
|
|
2901
|
+
return (_a = this.theme) != null ? _a : this.$options.vPopperTheme;
|
|
2902
|
+
}
|
|
2903
|
+
},
|
|
2904
|
+
methods: {
|
|
2905
|
+
getTargetNodes() {
|
|
2906
|
+
return Array.from(this.$refs.popper.$el.children).filter((node) => node !== this.$refs.popperContent.$el);
|
|
2907
|
+
}
|
|
2908
|
+
}
|
|
2909
|
+
});
|
|
2910
|
+
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2911
|
+
const _component_PopperContent = resolveComponent("PopperContent");
|
|
2912
|
+
const _component_Popper = resolveComponent("Popper");
|
|
2913
|
+
return openBlock(), createBlock(_component_Popper, {
|
|
2914
|
+
ref: "popper",
|
|
2915
|
+
theme: _ctx.finalTheme,
|
|
2916
|
+
"target-nodes": _ctx.getTargetNodes,
|
|
2917
|
+
"reference-node": () => _ctx.$refs.popper.$el,
|
|
2918
|
+
"popper-node": () => _ctx.$refs.popperContent.$el,
|
|
2919
|
+
class: normalizeClass([
|
|
2920
|
+
_ctx.themeClass
|
|
2921
|
+
])
|
|
2922
|
+
}, {
|
|
2923
|
+
default: withCtx(({
|
|
2924
|
+
popperId,
|
|
2925
|
+
isShown,
|
|
2926
|
+
shouldMountContent,
|
|
2927
|
+
skipTransition,
|
|
2928
|
+
autoHide,
|
|
2929
|
+
show,
|
|
2930
|
+
hide,
|
|
2931
|
+
handleResize,
|
|
2932
|
+
onResize,
|
|
2933
|
+
classes,
|
|
2934
|
+
result
|
|
2935
|
+
}) => [
|
|
2936
|
+
renderSlot(_ctx.$slots, "default", {
|
|
2937
|
+
shown: isShown,
|
|
2938
|
+
show,
|
|
2939
|
+
hide
|
|
2940
|
+
}),
|
|
2941
|
+
createVNode(_component_PopperContent, {
|
|
2942
|
+
ref: "popperContent",
|
|
2943
|
+
"popper-id": popperId,
|
|
2944
|
+
theme: _ctx.finalTheme,
|
|
2945
|
+
shown: isShown,
|
|
2946
|
+
mounted: shouldMountContent,
|
|
2947
|
+
"skip-transition": skipTransition,
|
|
2948
|
+
"auto-hide": autoHide,
|
|
2949
|
+
"handle-resize": handleResize,
|
|
2950
|
+
classes,
|
|
2951
|
+
result,
|
|
2952
|
+
onHide: hide,
|
|
2953
|
+
onResize
|
|
2954
|
+
}, {
|
|
2955
|
+
default: withCtx(() => [
|
|
2956
|
+
renderSlot(_ctx.$slots, "popper", {
|
|
2957
|
+
shown: isShown,
|
|
2958
|
+
hide
|
|
2959
|
+
})
|
|
2960
|
+
]),
|
|
2961
|
+
_: 2
|
|
2962
|
+
}, 1032, ["popper-id", "theme", "shown", "mounted", "skip-transition", "auto-hide", "handle-resize", "classes", "result", "onHide", "onResize"])
|
|
2963
|
+
]),
|
|
2964
|
+
_: 3
|
|
2965
|
+
}, 8, ["theme", "target-nodes", "reference-node", "popper-node", "class"]);
|
|
2966
|
+
}
|
|
2967
|
+
var PrivatePopperWrapper = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$1]]);
|
|
2968
|
+
var Dropdown_vue_vue_type_style_index_0_lang = "";
|
|
2969
|
+
const _sfc_main$3 = defineComponent(__spreadProps(__spreadValues({}, PrivatePopperWrapper), {
|
|
2970
|
+
name: "VDropdown",
|
|
2971
|
+
vPopperTheme: "dropdown"
|
|
2972
|
+
}));
|
|
2973
|
+
const _sfc_main$2 = defineComponent(__spreadProps(__spreadValues({}, PrivatePopperWrapper), {
|
|
2974
|
+
name: "VMenu",
|
|
2975
|
+
vPopperTheme: "menu"
|
|
2976
|
+
}));
|
|
2977
|
+
var Tooltip_vue_vue_type_style_index_0_lang = "";
|
|
2978
|
+
const _sfc_main$1 = defineComponent(__spreadProps(__spreadValues({}, PrivatePopperWrapper), {
|
|
2979
|
+
name: "VTooltip",
|
|
2980
|
+
vPopperTheme: "tooltip"
|
|
2981
|
+
}));
|
|
2982
|
+
const _sfc_main = defineComponent({
|
|
2983
|
+
name: "VTooltipDirective",
|
|
2984
|
+
components: {
|
|
2985
|
+
Popper: PrivatePopper(),
|
|
2986
|
+
PopperContent: PrivatePopperContent
|
|
2987
|
+
},
|
|
2988
|
+
mixins: [
|
|
2989
|
+
PrivatePopperMethods
|
|
2990
|
+
],
|
|
2991
|
+
inheritAttrs: false,
|
|
2992
|
+
props: {
|
|
2993
|
+
theme: {
|
|
2994
|
+
type: String,
|
|
2995
|
+
default: "tooltip"
|
|
2996
|
+
},
|
|
2997
|
+
html: {
|
|
2998
|
+
type: Boolean,
|
|
2999
|
+
default: (props) => getDefaultConfig(props.theme, "html")
|
|
3000
|
+
},
|
|
3001
|
+
content: {
|
|
3002
|
+
type: [String, Number, Function],
|
|
3003
|
+
default: null
|
|
3004
|
+
},
|
|
3005
|
+
loadingContent: {
|
|
3006
|
+
type: String,
|
|
3007
|
+
default: (props) => getDefaultConfig(props.theme, "loadingContent")
|
|
3008
|
+
}
|
|
3009
|
+
},
|
|
3010
|
+
data() {
|
|
3011
|
+
return {
|
|
3012
|
+
asyncContent: null
|
|
3013
|
+
};
|
|
3014
|
+
},
|
|
3015
|
+
computed: {
|
|
3016
|
+
isContentAsync() {
|
|
3017
|
+
return typeof this.content === "function";
|
|
3018
|
+
},
|
|
3019
|
+
loading() {
|
|
3020
|
+
return this.isContentAsync && this.asyncContent == null;
|
|
3021
|
+
},
|
|
3022
|
+
finalContent() {
|
|
3023
|
+
if (this.isContentAsync) {
|
|
3024
|
+
return this.loading ? this.loadingContent : this.asyncContent;
|
|
3025
|
+
}
|
|
3026
|
+
return this.content;
|
|
3027
|
+
}
|
|
3028
|
+
},
|
|
3029
|
+
watch: {
|
|
3030
|
+
content: {
|
|
3031
|
+
handler() {
|
|
3032
|
+
this.fetchContent(true);
|
|
3033
|
+
},
|
|
3034
|
+
immediate: true
|
|
3035
|
+
},
|
|
3036
|
+
async finalContent() {
|
|
3037
|
+
await this.$nextTick();
|
|
3038
|
+
this.$refs.popper.onResize();
|
|
3039
|
+
}
|
|
3040
|
+
},
|
|
3041
|
+
created() {
|
|
3042
|
+
this.$_fetchId = 0;
|
|
3043
|
+
},
|
|
3044
|
+
methods: {
|
|
3045
|
+
fetchContent(force) {
|
|
3046
|
+
if (typeof this.content === "function" && this.$_isShown && (force || !this.$_loading && this.asyncContent == null)) {
|
|
3047
|
+
this.asyncContent = null;
|
|
3048
|
+
this.$_loading = true;
|
|
3049
|
+
const fetchId = ++this.$_fetchId;
|
|
3050
|
+
const result = this.content(this);
|
|
3051
|
+
if (result.then) {
|
|
3052
|
+
result.then((res) => this.onResult(fetchId, res));
|
|
3053
|
+
} else {
|
|
3054
|
+
this.onResult(fetchId, result);
|
|
3055
|
+
}
|
|
3056
|
+
}
|
|
3057
|
+
},
|
|
3058
|
+
onResult(fetchId, result) {
|
|
3059
|
+
if (fetchId !== this.$_fetchId)
|
|
3060
|
+
return;
|
|
3061
|
+
this.$_loading = false;
|
|
3062
|
+
this.asyncContent = result;
|
|
3063
|
+
},
|
|
3064
|
+
onShow() {
|
|
3065
|
+
this.$_isShown = true;
|
|
3066
|
+
this.fetchContent();
|
|
3067
|
+
},
|
|
3068
|
+
onHide() {
|
|
3069
|
+
this.$_isShown = false;
|
|
3070
|
+
}
|
|
3071
|
+
}
|
|
3072
|
+
});
|
|
3073
|
+
const _hoisted_1 = ["innerHTML"];
|
|
3074
|
+
const _hoisted_2 = ["textContent"];
|
|
3075
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3076
|
+
const _component_PopperContent = resolveComponent("PopperContent");
|
|
3077
|
+
const _component_Popper = resolveComponent("Popper");
|
|
3078
|
+
return openBlock(), createBlock(_component_Popper, mergeProps({ ref: "popper" }, _ctx.$attrs, {
|
|
3079
|
+
theme: _ctx.theme,
|
|
3080
|
+
"popper-node": () => _ctx.$refs.popperContent.$el,
|
|
3081
|
+
onApplyShow: _ctx.onShow,
|
|
3082
|
+
onApplyHide: _ctx.onHide
|
|
3083
|
+
}), {
|
|
3084
|
+
default: withCtx(({
|
|
3085
|
+
popperId,
|
|
3086
|
+
isShown,
|
|
3087
|
+
shouldMountContent,
|
|
3088
|
+
skipTransition,
|
|
3089
|
+
autoHide,
|
|
3090
|
+
hide,
|
|
3091
|
+
handleResize,
|
|
3092
|
+
onResize,
|
|
3093
|
+
classes,
|
|
3094
|
+
result
|
|
3095
|
+
}) => [
|
|
3096
|
+
createVNode(_component_PopperContent, {
|
|
3097
|
+
ref: "popperContent",
|
|
3098
|
+
class: normalizeClass({
|
|
3099
|
+
"v-popper--tooltip-loading": _ctx.loading
|
|
3100
|
+
}),
|
|
3101
|
+
"popper-id": popperId,
|
|
3102
|
+
theme: _ctx.theme,
|
|
3103
|
+
shown: isShown,
|
|
3104
|
+
mounted: shouldMountContent,
|
|
3105
|
+
"skip-transition": skipTransition,
|
|
3106
|
+
"auto-hide": autoHide,
|
|
3107
|
+
"handle-resize": handleResize,
|
|
3108
|
+
classes,
|
|
3109
|
+
result,
|
|
3110
|
+
onHide: hide,
|
|
3111
|
+
onResize
|
|
3112
|
+
}, {
|
|
3113
|
+
default: withCtx(() => [
|
|
3114
|
+
_ctx.html ? (openBlock(), createElementBlock("div", {
|
|
3115
|
+
key: 0,
|
|
3116
|
+
innerHTML: _ctx.finalContent
|
|
3117
|
+
}, null, 8, _hoisted_1)) : (openBlock(), createElementBlock("div", {
|
|
3118
|
+
key: 1,
|
|
3119
|
+
textContent: toDisplayString(_ctx.finalContent)
|
|
3120
|
+
}, null, 8, _hoisted_2))
|
|
3121
|
+
]),
|
|
3122
|
+
_: 2
|
|
3123
|
+
}, 1032, ["class", "popper-id", "theme", "shown", "mounted", "skip-transition", "auto-hide", "handle-resize", "classes", "result", "onHide", "onResize"])
|
|
3124
|
+
]),
|
|
3125
|
+
_: 1
|
|
3126
|
+
}, 16, ["theme", "popper-node", "onApplyShow", "onApplyHide"]);
|
|
3127
|
+
}
|
|
3128
|
+
var PrivateTooltipDirective = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
3129
|
+
const TARGET_CLASS = "v-popper--has-tooltip";
|
|
3130
|
+
function getPlacement(options2, modifiers) {
|
|
3131
|
+
let result = options2.placement;
|
|
3132
|
+
if (!result && modifiers) {
|
|
3133
|
+
for (const pos of placements) {
|
|
3134
|
+
if (modifiers[pos]) {
|
|
3135
|
+
result = pos;
|
|
3136
|
+
}
|
|
3137
|
+
}
|
|
3138
|
+
}
|
|
3139
|
+
if (!result) {
|
|
3140
|
+
result = getDefaultConfig(options2.theme || "tooltip", "placement");
|
|
3141
|
+
}
|
|
3142
|
+
return result;
|
|
3143
|
+
}
|
|
3144
|
+
function getOptions(el, value, modifiers) {
|
|
3145
|
+
let options2;
|
|
3146
|
+
const type = typeof value;
|
|
3147
|
+
if (type === "string") {
|
|
3148
|
+
options2 = { content: value };
|
|
3149
|
+
} else if (value && type === "object") {
|
|
3150
|
+
options2 = value;
|
|
3151
|
+
} else {
|
|
3152
|
+
options2 = { content: false };
|
|
3153
|
+
}
|
|
3154
|
+
options2.placement = getPlacement(options2, modifiers);
|
|
3155
|
+
options2.targetNodes = () => [el];
|
|
3156
|
+
options2.referenceNode = () => el;
|
|
3157
|
+
return options2;
|
|
3158
|
+
}
|
|
3159
|
+
let directiveApp;
|
|
3160
|
+
let directives;
|
|
3161
|
+
let uid = 0;
|
|
3162
|
+
function ensureDirectiveApp() {
|
|
3163
|
+
if (directiveApp)
|
|
3164
|
+
return;
|
|
3165
|
+
directives = ref([]);
|
|
3166
|
+
directiveApp = createApp({
|
|
3167
|
+
name: "VTooltipDirectiveApp",
|
|
3168
|
+
setup() {
|
|
3169
|
+
return {
|
|
3170
|
+
directives
|
|
3171
|
+
};
|
|
3172
|
+
},
|
|
3173
|
+
render() {
|
|
3174
|
+
return this.directives.map((directive) => {
|
|
3175
|
+
return h(PrivateTooltipDirective, __spreadProps(__spreadValues({}, directive.options), {
|
|
3176
|
+
shown: directive.shown || directive.options.shown,
|
|
3177
|
+
key: directive.id
|
|
3178
|
+
}));
|
|
3179
|
+
});
|
|
3180
|
+
},
|
|
3181
|
+
devtools: {
|
|
3182
|
+
hide: true
|
|
3183
|
+
}
|
|
3184
|
+
});
|
|
3185
|
+
const mountTarget = document.createElement("div");
|
|
3186
|
+
document.body.appendChild(mountTarget);
|
|
3187
|
+
directiveApp.mount(mountTarget);
|
|
3188
|
+
}
|
|
3189
|
+
function createTooltip(el, value, modifiers) {
|
|
3190
|
+
ensureDirectiveApp();
|
|
3191
|
+
const options2 = ref(getOptions(el, value, modifiers));
|
|
3192
|
+
const shown = ref(false);
|
|
3193
|
+
const item = {
|
|
3194
|
+
id: uid++,
|
|
3195
|
+
options: options2,
|
|
3196
|
+
shown
|
|
3197
|
+
};
|
|
3198
|
+
directives.value.push(item);
|
|
3199
|
+
if (el.classList) {
|
|
3200
|
+
el.classList.add(TARGET_CLASS);
|
|
3201
|
+
}
|
|
3202
|
+
const result = el.$_popper = {
|
|
3203
|
+
options: options2,
|
|
3204
|
+
item,
|
|
3205
|
+
show() {
|
|
3206
|
+
shown.value = true;
|
|
3207
|
+
},
|
|
3208
|
+
hide() {
|
|
3209
|
+
shown.value = false;
|
|
3210
|
+
}
|
|
3211
|
+
};
|
|
3212
|
+
return result;
|
|
3213
|
+
}
|
|
3214
|
+
function destroyTooltip(el) {
|
|
3215
|
+
if (el.$_popper) {
|
|
3216
|
+
const index = directives.value.indexOf(el.$_popper.item);
|
|
3217
|
+
if (index !== -1)
|
|
3218
|
+
directives.value.splice(index, 1);
|
|
3219
|
+
delete el.$_popper;
|
|
3220
|
+
delete el.$_popperOldShown;
|
|
3221
|
+
delete el.$_popperMountTarget;
|
|
3222
|
+
}
|
|
3223
|
+
if (el.classList) {
|
|
3224
|
+
el.classList.remove(TARGET_CLASS);
|
|
3225
|
+
}
|
|
3226
|
+
}
|
|
3227
|
+
function bind(el, { value, modifiers }) {
|
|
3228
|
+
const options2 = getOptions(el, value, modifiers);
|
|
3229
|
+
if (!options2.content || getDefaultConfig(options2.theme || "tooltip", "disabled")) {
|
|
3230
|
+
destroyTooltip(el);
|
|
3231
|
+
} else {
|
|
3232
|
+
let directive;
|
|
3233
|
+
if (el.$_popper) {
|
|
3234
|
+
directive = el.$_popper;
|
|
3235
|
+
directive.options.value = options2;
|
|
3236
|
+
} else {
|
|
3237
|
+
directive = createTooltip(el, value, modifiers);
|
|
3238
|
+
}
|
|
3239
|
+
if (typeof value.shown !== "undefined" && value.shown !== el.$_popperOldShown) {
|
|
3240
|
+
el.$_popperOldShown = value.shown;
|
|
3241
|
+
value.shown ? directive.show() : directive.hide();
|
|
3242
|
+
}
|
|
3243
|
+
}
|
|
3244
|
+
}
|
|
3245
|
+
var PrivateVTooltip = {
|
|
3246
|
+
beforeMount: bind,
|
|
3247
|
+
updated: bind,
|
|
3248
|
+
beforeUnmount(el) {
|
|
3249
|
+
destroyTooltip(el);
|
|
3250
|
+
}
|
|
3251
|
+
};
|
|
3252
|
+
function addListeners(el) {
|
|
3253
|
+
el.addEventListener("click", onClick);
|
|
3254
|
+
el.addEventListener("touchstart", onTouchStart, supportsPassive ? {
|
|
3255
|
+
passive: true
|
|
3256
|
+
} : false);
|
|
3257
|
+
}
|
|
3258
|
+
function removeListeners(el) {
|
|
3259
|
+
el.removeEventListener("click", onClick);
|
|
3260
|
+
el.removeEventListener("touchstart", onTouchStart);
|
|
3261
|
+
el.removeEventListener("touchend", onTouchEnd);
|
|
3262
|
+
el.removeEventListener("touchcancel", onTouchCancel);
|
|
3263
|
+
}
|
|
3264
|
+
function onClick(event) {
|
|
3265
|
+
const el = event.currentTarget;
|
|
3266
|
+
event.closePopover = !el.$_vclosepopover_touch;
|
|
3267
|
+
event.closeAllPopover = el.$_closePopoverModifiers && !!el.$_closePopoverModifiers.all;
|
|
3268
|
+
}
|
|
3269
|
+
function onTouchStart(event) {
|
|
3270
|
+
if (event.changedTouches.length === 1) {
|
|
3271
|
+
const el = event.currentTarget;
|
|
3272
|
+
el.$_vclosepopover_touch = true;
|
|
3273
|
+
const touch = event.changedTouches[0];
|
|
3274
|
+
el.$_vclosepopover_touchPoint = touch;
|
|
3275
|
+
el.addEventListener("touchend", onTouchEnd);
|
|
3276
|
+
el.addEventListener("touchcancel", onTouchCancel);
|
|
3277
|
+
}
|
|
3278
|
+
}
|
|
3279
|
+
function onTouchEnd(event) {
|
|
3280
|
+
const el = event.currentTarget;
|
|
3281
|
+
el.$_vclosepopover_touch = false;
|
|
3282
|
+
if (event.changedTouches.length === 1) {
|
|
3283
|
+
const touch = event.changedTouches[0];
|
|
3284
|
+
const firstTouch = el.$_vclosepopover_touchPoint;
|
|
3285
|
+
event.closePopover = Math.abs(touch.screenY - firstTouch.screenY) < 20 && Math.abs(touch.screenX - firstTouch.screenX) < 20;
|
|
3286
|
+
event.closeAllPopover = el.$_closePopoverModifiers && !!el.$_closePopoverModifiers.all;
|
|
3287
|
+
}
|
|
3288
|
+
}
|
|
3289
|
+
function onTouchCancel(event) {
|
|
3290
|
+
const el = event.currentTarget;
|
|
3291
|
+
el.$_vclosepopover_touch = false;
|
|
3292
|
+
}
|
|
3293
|
+
var PrivateVClosePopper = {
|
|
3294
|
+
beforeMount(el, { value, modifiers }) {
|
|
3295
|
+
el.$_closePopoverModifiers = modifiers;
|
|
3296
|
+
if (typeof value === "undefined" || value) {
|
|
3297
|
+
addListeners(el);
|
|
3298
|
+
}
|
|
3299
|
+
},
|
|
3300
|
+
updated(el, { value, oldValue, modifiers }) {
|
|
3301
|
+
el.$_closePopoverModifiers = modifiers;
|
|
3302
|
+
if (value !== oldValue) {
|
|
3303
|
+
if (typeof value === "undefined" || value) {
|
|
3304
|
+
addListeners(el);
|
|
3305
|
+
} else {
|
|
3306
|
+
removeListeners(el);
|
|
3307
|
+
}
|
|
3308
|
+
}
|
|
3309
|
+
},
|
|
3310
|
+
beforeUnmount(el) {
|
|
3311
|
+
removeListeners(el);
|
|
3312
|
+
}
|
|
3313
|
+
};
|
|
3314
|
+
const options = config;
|
|
3315
|
+
const VTooltip = PrivateVTooltip;
|
|
3316
|
+
const VClosePopper = PrivateVClosePopper;
|
|
3317
|
+
const Dropdown = _sfc_main$3;
|
|
3318
|
+
const Menu = _sfc_main$2;
|
|
3319
|
+
const Popper = PrivatePopper;
|
|
3320
|
+
const PopperContent = PrivatePopperContent;
|
|
3321
|
+
const PopperMethods = PrivatePopperMethods;
|
|
3322
|
+
const PopperWrapper = PrivatePopperWrapper;
|
|
3323
|
+
const ThemeClass = PrivateThemeClass;
|
|
3324
|
+
const Tooltip = _sfc_main$1;
|
|
3325
|
+
const TooltipDirective = PrivateTooltipDirective;
|
|
3326
|
+
function install(app, options2 = {}) {
|
|
3327
|
+
if (app.$_vTooltipInstalled)
|
|
3328
|
+
return;
|
|
3329
|
+
app.$_vTooltipInstalled = true;
|
|
3330
|
+
assign(config, options2);
|
|
3331
|
+
app.directive("tooltip", PrivateVTooltip);
|
|
3332
|
+
app.directive("close-popper", PrivateVClosePopper);
|
|
3333
|
+
app.component("v-tooltip", _sfc_main$1);
|
|
3334
|
+
app.component("VTooltip", _sfc_main$1);
|
|
3335
|
+
app.component("v-dropdown", _sfc_main$3);
|
|
3336
|
+
app.component("VDropdown", _sfc_main$3);
|
|
3337
|
+
app.component("v-menu", _sfc_main$2);
|
|
3338
|
+
app.component("VMenu", _sfc_main$2);
|
|
3339
|
+
}
|
|
3340
|
+
const plugin = {
|
|
3341
|
+
version: "2.0.0-beta.17",
|
|
3342
|
+
install,
|
|
3343
|
+
options: config
|
|
3344
|
+
};
|
|
3345
|
+
|
|
3346
|
+
export { Dropdown, plugin as FloatingVue, HIDE_EVENT_MAP, Menu, Popper, PopperContent, PopperMethods, PopperWrapper, SHOW_EVENT_MAP, ThemeClass, Tooltip, TooltipDirective, VClosePopper, VTooltip, createTooltip, destroyTooltip, hideAllPoppers, install, options, placements };
|