vue-devui 1.6.14 → 1.6.15
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/auto-complete/index.es.js +20 -39
- package/auto-complete/index.umd.js +10 -10
- package/breadcrumb/index.es.js +18 -37
- package/breadcrumb/index.umd.js +1 -1
- package/category-search/index.es.js +20 -39
- package/category-search/index.umd.js +12 -12
- package/checkbox/index.es.js +20 -39
- package/checkbox/index.umd.js +11 -11
- package/code-review/index.es.js +20 -39
- package/code-review/index.umd.js +17 -17
- package/data-grid/index.es.js +20 -39
- package/data-grid/index.umd.js +9 -9
- package/date-picker-pro/index.es.js +20 -39
- package/date-picker-pro/index.umd.js +13 -13
- package/dropdown/index.es.js +18 -37
- package/dropdown/index.umd.js +1 -1
- package/editable-select/index.es.js +20 -39
- package/editable-select/index.umd.js +14 -14
- package/editor-md/index.es.js +20 -39
- package/editor-md/index.umd.js +22 -22
- package/form/index.es.js +20 -39
- package/form/index.umd.js +12 -12
- package/input/index.es.js +20 -39
- package/input/index.umd.js +10 -10
- package/input-number/index.es.js +20 -39
- package/input-number/index.umd.js +18 -18
- package/mention/index.es.js +20 -39
- package/mention/index.umd.js +18 -18
- package/modal/index.es.js +18 -37
- package/modal/index.umd.js +2 -2
- package/overlay/index.es.js +18 -37
- package/overlay/index.umd.js +1 -1
- package/package.json +2 -2
- package/pagination/index.es.js +20 -39
- package/pagination/index.umd.js +10 -10
- package/popover/index.es.js +20 -39
- package/popover/index.umd.js +14 -14
- package/radio/index.es.js +20 -39
- package/radio/index.umd.js +17 -17
- package/search/index.es.js +20 -39
- package/search/index.umd.js +12 -12
- package/select/index.es.js +20 -39
- package/select/index.umd.js +16 -16
- package/splitter/index.es.js +20 -39
- package/splitter/index.umd.js +16 -16
- package/switch/index.es.js +20 -39
- package/switch/index.umd.js +12 -12
- package/table/index.es.js +20 -39
- package/table/index.umd.js +10 -10
- package/textarea/index.es.js +20 -39
- package/textarea/index.umd.js +15 -15
- package/time-picker/index.es.js +20 -39
- package/time-picker/index.umd.js +16 -16
- package/time-select/index.es.js +20 -39
- package/time-select/index.umd.js +10 -10
- package/tooltip/index.es.js +20 -39
- package/tooltip/index.umd.js +17 -17
- package/tree/index.es.js +20 -39
- package/tree/index.umd.js +12 -12
- package/vue-devui.es.js +19 -38
- package/vue-devui.umd.js +63 -63
package/popover/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { watch, onUnmounted, defineComponent, toRefs, createVNode, Transition, mergeProps, ref, unref, nextTick, withModifiers, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, computed, onMounted, provide, Teleport } from "vue";
|
|
2
|
-
import { offset,
|
|
2
|
+
import { offset, flip, arrow, computePosition } from "@floating-ui/dom";
|
|
3
3
|
const fixedOverlayProps = {
|
|
4
4
|
modelValue: {
|
|
5
5
|
type: Boolean,
|
|
@@ -143,16 +143,6 @@ const flexibleOverlayProps = {
|
|
|
143
143
|
default: false
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
|
-
function getScrollParent(element) {
|
|
147
|
-
const overflowRegex = /(auto|scroll|hidden)/;
|
|
148
|
-
for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
|
|
149
|
-
const style = window.getComputedStyle(parent);
|
|
150
|
-
if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
|
|
151
|
-
return parent;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
return window;
|
|
155
|
-
}
|
|
156
146
|
function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
157
147
|
let { x, y } = point;
|
|
158
148
|
if (!isArrowCenter) {
|
|
@@ -173,9 +163,9 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
|
173
163
|
return { x, y };
|
|
174
164
|
}
|
|
175
165
|
function useOverlay(props, emit) {
|
|
166
|
+
const { position, showArrow } = toRefs(props);
|
|
176
167
|
const overlayRef = ref();
|
|
177
168
|
const arrowRef = ref();
|
|
178
|
-
let originParent = null;
|
|
179
169
|
const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
|
|
180
170
|
const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
|
|
181
171
|
const staticSide = {
|
|
@@ -196,51 +186,42 @@ function useOverlay(props, emit) {
|
|
|
196
186
|
const hostEl = props.origin;
|
|
197
187
|
const overlayEl = unref(overlayRef.value);
|
|
198
188
|
const arrowEl = unref(arrowRef.value);
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
})
|
|
205
|
-
];
|
|
206
|
-
props.showArrow && middleware.push(arrow({ element: arrowEl }));
|
|
207
|
-
props.shiftOffset !== void 0 && middleware.push(shift());
|
|
208
|
-
if (!overlayEl) {
|
|
209
|
-
return;
|
|
189
|
+
const [mainPosition, ...fallbackPosition] = position.value;
|
|
190
|
+
const middleware = [offset(props.offset)];
|
|
191
|
+
middleware.push(fallbackPosition.length ? flip({ fallbackPlacements: fallbackPosition }) : flip());
|
|
192
|
+
if (showArrow.value) {
|
|
193
|
+
middleware.push(arrow({ element: arrowRef.value }));
|
|
210
194
|
}
|
|
211
195
|
const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
|
|
212
196
|
strategy: "fixed",
|
|
197
|
+
placement: mainPosition,
|
|
213
198
|
middleware
|
|
214
199
|
});
|
|
215
200
|
let applyX = x;
|
|
216
201
|
let applyY = y;
|
|
217
|
-
if (props.shiftOffset !== void 0) {
|
|
218
|
-
const { x: shiftX, y: shiftY } = middlewareData.shift;
|
|
219
|
-
shiftX < 0 && (applyX -= props.shiftOffset);
|
|
220
|
-
shiftX > 0 && (applyX += props.shiftOffset);
|
|
221
|
-
shiftY < 0 && (applyY -= props.shiftOffset);
|
|
222
|
-
shiftY > 0 && (applyY += props.shiftOffset);
|
|
223
|
-
}
|
|
224
202
|
emit("positionChange", placement);
|
|
225
203
|
Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
|
|
226
204
|
props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
|
|
227
205
|
};
|
|
206
|
+
const scrollCallback = (e) => {
|
|
207
|
+
var _a, _b;
|
|
208
|
+
const scrollElement = e.target;
|
|
209
|
+
if (scrollElement == null ? void 0 : scrollElement.contains((_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin)) {
|
|
210
|
+
updatePosition();
|
|
211
|
+
}
|
|
212
|
+
};
|
|
228
213
|
watch(() => props.modelValue, () => {
|
|
229
214
|
if (props.modelValue && props.origin) {
|
|
230
|
-
originParent = getScrollParent(props.origin);
|
|
231
215
|
nextTick(updatePosition);
|
|
232
|
-
|
|
233
|
-
originParent !== window && window.addEventListener("scroll", updatePosition);
|
|
216
|
+
window.addEventListener("scroll", scrollCallback, true);
|
|
234
217
|
window.addEventListener("resize", updatePosition);
|
|
235
218
|
} else {
|
|
236
|
-
|
|
237
|
-
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
219
|
+
window.removeEventListener("scroll", scrollCallback, true);
|
|
238
220
|
window.removeEventListener("resize", updatePosition);
|
|
239
221
|
}
|
|
240
222
|
});
|
|
241
223
|
onUnmounted(() => {
|
|
242
|
-
|
|
243
|
-
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
224
|
+
window.removeEventListener("scroll", scrollCallback, true);
|
|
244
225
|
window.removeEventListener("resize", updatePosition);
|
|
245
226
|
});
|
|
246
227
|
return { arrowRef, overlayRef, updatePosition };
|
|
@@ -4233,7 +4214,7 @@ var lodash = { exports: {} };
|
|
|
4233
4214
|
var delay = baseRest(function(func, wait, args) {
|
|
4234
4215
|
return baseDelay(func, toNumber(wait) || 0, args);
|
|
4235
4216
|
});
|
|
4236
|
-
function
|
|
4217
|
+
function flip2(func) {
|
|
4237
4218
|
return createWrap(func, WRAP_FLIP_FLAG);
|
|
4238
4219
|
}
|
|
4239
4220
|
function memoize(func, resolver) {
|
|
@@ -5357,7 +5338,7 @@ var lodash = { exports: {} };
|
|
|
5357
5338
|
lodash2.flatten = flatten;
|
|
5358
5339
|
lodash2.flattenDeep = flattenDeep;
|
|
5359
5340
|
lodash2.flattenDepth = flattenDepth;
|
|
5360
|
-
lodash2.flip =
|
|
5341
|
+
lodash2.flip = flip2;
|
|
5361
5342
|
lodash2.flow = flow;
|
|
5362
5343
|
lodash2.flowRight = flowRight;
|
|
5363
5344
|
lodash2.fromPairs = fromPairs;
|