vue-devui 1.6.14 → 1.6.16
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 +60 -42
- package/auto-complete/index.umd.js +13 -13
- package/breadcrumb/index.es.js +57 -39
- package/breadcrumb/index.umd.js +1 -1
- package/category-search/index.es.js +93 -44
- package/category-search/index.umd.js +21 -21
- package/checkbox/index.es.js +60 -42
- package/checkbox/index.umd.js +18 -18
- package/code-review/index.es.js +60 -42
- package/code-review/index.umd.js +20 -20
- package/data-grid/index.es.js +60 -42
- package/data-grid/index.umd.js +15 -15
- package/date-picker-pro/index.es.js +60 -42
- package/date-picker-pro/index.umd.js +13 -13
- package/dropdown/index.es.js +57 -39
- package/dropdown/index.umd.js +1 -1
- package/editable-select/index.es.js +66 -43
- package/editable-select/index.umd.js +10 -10
- package/editor-md/index.es.js +69 -44
- package/editor-md/index.umd.js +28 -28
- package/form/index.es.js +60 -42
- package/form/index.umd.js +17 -17
- package/input/index.es.js +59 -41
- package/input/index.umd.js +20 -20
- package/input-number/index.es.js +60 -42
- package/input-number/index.umd.js +19 -19
- package/mention/index.es.js +60 -42
- package/mention/index.umd.js +17 -17
- package/message/index.es.js +13 -13
- package/message/index.umd.js +1 -1
- package/modal/index.es.js +57 -39
- package/modal/index.umd.js +2 -2
- package/overlay/index.es.js +58 -40
- package/overlay/index.umd.js +1 -1
- package/package.json +3 -2
- package/pagination/index.es.js +77 -59
- package/pagination/index.umd.js +18 -18
- package/pagination/style.css +1 -1
- package/popover/index.es.js +60 -42
- package/popover/index.umd.js +15 -15
- package/radio/index.es.js +60 -42
- package/radio/index.umd.js +16 -16
- package/search/index.es.js +60 -42
- package/search/index.umd.js +16 -16
- package/select/index.es.js +77 -59
- package/select/index.umd.js +20 -20
- package/select/style.css +1 -1
- package/splitter/index.es.js +60 -42
- package/splitter/index.umd.js +14 -14
- package/style.css +1 -1
- package/switch/index.es.js +60 -42
- package/switch/index.umd.js +17 -17
- package/table/index.es.js +59 -41
- package/table/index.umd.js +16 -16
- package/textarea/index.es.js +60 -42
- package/textarea/index.umd.js +19 -19
- package/time-picker/index.es.js +59 -41
- package/time-picker/index.umd.js +14 -14
- package/time-select/index.es.js +77 -59
- package/time-select/index.umd.js +18 -18
- package/time-select/style.css +1 -1
- package/tooltip/index.es.js +60 -42
- package/tooltip/index.umd.js +15 -15
- package/tree/index.es.js +59 -41
- package/tree/index.umd.js +14 -14
- package/types/category-search/src/category-search-types.d.ts +5 -0
- package/types/editable-select/src/editable-select-types.d.ts +3 -0
- package/types/overlay/src/flexible-overlay/flexible-overlay-types.d.ts +5 -6
- package/types/overlay/src/flexible-overlay/index.d.ts +9 -0
- package/types/overlay/src/flexible-overlay/use-flexible-overlay.d.ts +11 -2
- package/types/select/src/composables/use-select-content.d.ts +21 -2
- package/types/select/src/select-types.d.ts +7 -44
- package/types/select/src/use-select.d.ts +26 -2
- package/vue-devui.es.js +138 -77
- package/vue-devui.umd.js +74 -74
package/table/index.es.js
CHANGED
|
@@ -35,7 +35,7 @@ var __publicField = (obj, key, value) => {
|
|
|
35
35
|
};
|
|
36
36
|
import { computed, ref, watchEffect, watch, getCurrentInstance, unref, defineComponent, inject, createVNode, mergeProps, toRefs, onMounted, onUnmounted, Transition, nextTick, withModifiers, Comment, Text, h, Fragment, withDirectives, cloneVNode, provide, Teleport, vShow, resolveDynamicComponent, render, reactive, resolveComponent, toRef, createTextVNode, onBeforeUnmount, isVNode, onBeforeMount, onUpdated, resolveDirective } from "vue";
|
|
37
37
|
import "clipboard";
|
|
38
|
-
import { offset,
|
|
38
|
+
import { offset, flip, arrow, computePosition } from "@floating-ui/dom";
|
|
39
39
|
import { onClickOutside } from "@vueuse/core";
|
|
40
40
|
const tableProps = {
|
|
41
41
|
data: {
|
|
@@ -1169,18 +1169,12 @@ const flexibleOverlayProps = {
|
|
|
1169
1169
|
clickEventBubble: {
|
|
1170
1170
|
type: Boolean,
|
|
1171
1171
|
default: false
|
|
1172
|
+
},
|
|
1173
|
+
fitOriginWidth: {
|
|
1174
|
+
type: Boolean,
|
|
1175
|
+
default: false
|
|
1172
1176
|
}
|
|
1173
1177
|
};
|
|
1174
|
-
function getScrollParent(element) {
|
|
1175
|
-
const overflowRegex = /(auto|scroll|hidden)/;
|
|
1176
|
-
for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
|
|
1177
|
-
const style = window.getComputedStyle(parent);
|
|
1178
|
-
if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
|
|
1179
|
-
return parent;
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
return window;
|
|
1183
|
-
}
|
|
1184
1178
|
function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
1185
1179
|
let { x, y } = point;
|
|
1186
1180
|
if (!isArrowCenter) {
|
|
@@ -1201,9 +1195,18 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
|
1201
1195
|
return { x, y };
|
|
1202
1196
|
}
|
|
1203
1197
|
function useOverlay(props, emit) {
|
|
1198
|
+
const { fitOriginWidth, position, showArrow } = toRefs(props);
|
|
1204
1199
|
const overlayRef = ref();
|
|
1205
1200
|
const arrowRef = ref();
|
|
1206
|
-
|
|
1201
|
+
const overlayWidth = ref(0);
|
|
1202
|
+
let originObserver;
|
|
1203
|
+
const styles = computed(() => {
|
|
1204
|
+
if (fitOriginWidth.value) {
|
|
1205
|
+
return { width: overlayWidth.value + "px" };
|
|
1206
|
+
} else {
|
|
1207
|
+
return {};
|
|
1208
|
+
}
|
|
1209
|
+
});
|
|
1207
1210
|
const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
|
|
1208
1211
|
const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
|
|
1209
1212
|
const staticSide = {
|
|
@@ -1224,54 +1227,67 @@ function useOverlay(props, emit) {
|
|
|
1224
1227
|
const hostEl = props.origin;
|
|
1225
1228
|
const overlayEl = unref(overlayRef.value);
|
|
1226
1229
|
const arrowEl = unref(arrowRef.value);
|
|
1227
|
-
const
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
})
|
|
1233
|
-
];
|
|
1234
|
-
props.showArrow && middleware.push(arrow({ element: arrowEl }));
|
|
1235
|
-
props.shiftOffset !== void 0 && middleware.push(shift());
|
|
1236
|
-
if (!overlayEl) {
|
|
1237
|
-
return;
|
|
1230
|
+
const [mainPosition, ...fallbackPosition] = position.value;
|
|
1231
|
+
const middleware = [offset(props.offset)];
|
|
1232
|
+
middleware.push(fallbackPosition.length ? flip({ fallbackPlacements: fallbackPosition }) : flip());
|
|
1233
|
+
if (showArrow.value) {
|
|
1234
|
+
middleware.push(arrow({ element: arrowRef.value }));
|
|
1238
1235
|
}
|
|
1239
1236
|
const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
|
|
1240
1237
|
strategy: "fixed",
|
|
1238
|
+
placement: mainPosition,
|
|
1241
1239
|
middleware
|
|
1242
1240
|
});
|
|
1243
1241
|
let applyX = x;
|
|
1244
1242
|
let applyY = y;
|
|
1245
|
-
if (props.shiftOffset !== void 0) {
|
|
1246
|
-
const { x: shiftX, y: shiftY } = middlewareData.shift;
|
|
1247
|
-
shiftX < 0 && (applyX -= props.shiftOffset);
|
|
1248
|
-
shiftX > 0 && (applyX += props.shiftOffset);
|
|
1249
|
-
shiftY < 0 && (applyY -= props.shiftOffset);
|
|
1250
|
-
shiftY > 0 && (applyY += props.shiftOffset);
|
|
1251
|
-
}
|
|
1252
1243
|
emit("positionChange", placement);
|
|
1253
1244
|
Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
|
|
1254
1245
|
props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
|
|
1255
1246
|
};
|
|
1247
|
+
const scrollCallback = (e) => {
|
|
1248
|
+
var _a, _b;
|
|
1249
|
+
const scrollElement = e.target;
|
|
1250
|
+
if (scrollElement == null ? void 0 : scrollElement.contains((_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin)) {
|
|
1251
|
+
updatePosition();
|
|
1252
|
+
}
|
|
1253
|
+
};
|
|
1254
|
+
const updateWidth = (originEl) => {
|
|
1255
|
+
overlayWidth.value = originEl.getBoundingClientRect().width;
|
|
1256
|
+
updatePosition();
|
|
1257
|
+
};
|
|
1258
|
+
const observeOrigin = () => {
|
|
1259
|
+
var _a, _b;
|
|
1260
|
+
if (fitOriginWidth.value && typeof window !== "undefined") {
|
|
1261
|
+
const originEl = (_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin;
|
|
1262
|
+
if (originEl) {
|
|
1263
|
+
originObserver = new window.ResizeObserver(() => updateWidth(originEl));
|
|
1264
|
+
originObserver.observe(originEl);
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
};
|
|
1268
|
+
const unobserveOrigin = () => {
|
|
1269
|
+
var _a, _b;
|
|
1270
|
+
const originEl = (_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin;
|
|
1271
|
+
originEl && (originObserver == null ? void 0 : originObserver.unobserve(originEl));
|
|
1272
|
+
};
|
|
1256
1273
|
watch(() => props.modelValue, () => {
|
|
1257
1274
|
if (props.modelValue && props.origin) {
|
|
1258
|
-
originParent = getScrollParent(props.origin);
|
|
1259
1275
|
nextTick(updatePosition);
|
|
1260
|
-
|
|
1261
|
-
originParent !== window && window.addEventListener("scroll", updatePosition);
|
|
1276
|
+
window.addEventListener("scroll", scrollCallback, true);
|
|
1262
1277
|
window.addEventListener("resize", updatePosition);
|
|
1278
|
+
observeOrigin();
|
|
1263
1279
|
} else {
|
|
1264
|
-
|
|
1265
|
-
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
1280
|
+
window.removeEventListener("scroll", scrollCallback, true);
|
|
1266
1281
|
window.removeEventListener("resize", updatePosition);
|
|
1282
|
+
unobserveOrigin();
|
|
1267
1283
|
}
|
|
1268
1284
|
});
|
|
1269
1285
|
onUnmounted(() => {
|
|
1270
|
-
|
|
1271
|
-
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
1286
|
+
window.removeEventListener("scroll", scrollCallback, true);
|
|
1272
1287
|
window.removeEventListener("resize", updatePosition);
|
|
1288
|
+
unobserveOrigin();
|
|
1273
1289
|
});
|
|
1274
|
-
return { arrowRef, overlayRef, updatePosition };
|
|
1290
|
+
return { arrowRef, overlayRef, styles, updatePosition };
|
|
1275
1291
|
}
|
|
1276
1292
|
var flexibleOverlay = "";
|
|
1277
1293
|
const FlexibleOverlay = defineComponent({
|
|
@@ -1292,6 +1308,7 @@ const FlexibleOverlay = defineComponent({
|
|
|
1292
1308
|
const {
|
|
1293
1309
|
arrowRef,
|
|
1294
1310
|
overlayRef,
|
|
1311
|
+
styles,
|
|
1295
1312
|
updatePosition
|
|
1296
1313
|
} = useOverlay(props, emit);
|
|
1297
1314
|
expose({
|
|
@@ -1301,7 +1318,8 @@ const FlexibleOverlay = defineComponent({
|
|
|
1301
1318
|
var _a;
|
|
1302
1319
|
return props.modelValue && createVNode("div", mergeProps({
|
|
1303
1320
|
"ref": overlayRef,
|
|
1304
|
-
"class": ns2.b()
|
|
1321
|
+
"class": ns2.b(),
|
|
1322
|
+
"style": styles.value
|
|
1305
1323
|
}, attrs, {
|
|
1306
1324
|
"onClick": withModifiers(() => ({}), [clickEventBubble.value ? "" : "stop"]),
|
|
1307
1325
|
"onPointerup": withModifiers(() => ({}), ["stop"])
|
|
@@ -5831,7 +5849,7 @@ var lodash = { exports: {} };
|
|
|
5831
5849
|
var delay = baseRest(function(func, wait, args) {
|
|
5832
5850
|
return baseDelay(func, toNumber(wait) || 0, args);
|
|
5833
5851
|
});
|
|
5834
|
-
function
|
|
5852
|
+
function flip2(func) {
|
|
5835
5853
|
return createWrap(func, WRAP_FLIP_FLAG);
|
|
5836
5854
|
}
|
|
5837
5855
|
function memoize(func, resolver) {
|
|
@@ -6955,7 +6973,7 @@ var lodash = { exports: {} };
|
|
|
6955
6973
|
lodash2.flatten = flatten;
|
|
6956
6974
|
lodash2.flattenDeep = flattenDeep;
|
|
6957
6975
|
lodash2.flattenDepth = flattenDepth;
|
|
6958
|
-
lodash2.flip =
|
|
6976
|
+
lodash2.flip = flip2;
|
|
6959
6977
|
lodash2.flow = flow;
|
|
6960
6978
|
lodash2.flowRight = flowRight;
|
|
6961
6979
|
lodash2.fromPairs = fromPairs;
|