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/tree/index.es.js
CHANGED
|
@@ -31,7 +31,7 @@ var __objRest = (source, exclude) => {
|
|
|
31
31
|
};
|
|
32
32
|
import { ref, onUnmounted, computed, reactive, createVNode, defineComponent, toRefs, inject, getCurrentInstance, watch, provide, Transition, mergeProps, unref, nextTick, withModifiers, Comment, Text, h, Fragment, withDirectives, cloneVNode, onMounted, Teleport, createTextVNode, onBeforeUnmount, toRef, renderSlot, useSlots, resolveComponent, isVNode, onUpdated, shallowRef, toRaw, watchEffect, TransitionGroup } from "vue";
|
|
33
33
|
import "clipboard";
|
|
34
|
-
import { offset,
|
|
34
|
+
import { offset, flip, arrow, computePosition } from "@floating-ui/dom";
|
|
35
35
|
const USE_TREE_TOKEN = "use-tree-token";
|
|
36
36
|
const TREE_INSTANCE = "tree-instance";
|
|
37
37
|
const NODE_HEIGHT = 30;
|
|
@@ -5562,7 +5562,7 @@ var lodash = { exports: {} };
|
|
|
5562
5562
|
var delay = baseRest(function(func, wait, args) {
|
|
5563
5563
|
return baseDelay(func, toNumber(wait) || 0, args);
|
|
5564
5564
|
});
|
|
5565
|
-
function
|
|
5565
|
+
function flip2(func) {
|
|
5566
5566
|
return createWrap(func, WRAP_FLIP_FLAG);
|
|
5567
5567
|
}
|
|
5568
5568
|
function memoize(func, resolver) {
|
|
@@ -6686,7 +6686,7 @@ var lodash = { exports: {} };
|
|
|
6686
6686
|
lodash2.flatten = flatten;
|
|
6687
6687
|
lodash2.flattenDeep = flattenDeep;
|
|
6688
6688
|
lodash2.flattenDepth = flattenDepth;
|
|
6689
|
-
lodash2.flip =
|
|
6689
|
+
lodash2.flip = flip2;
|
|
6690
6690
|
lodash2.flow = flow;
|
|
6691
6691
|
lodash2.flowRight = flowRight;
|
|
6692
6692
|
lodash2.fromPairs = fromPairs;
|
|
@@ -8082,18 +8082,12 @@ const flexibleOverlayProps = {
|
|
|
8082
8082
|
clickEventBubble: {
|
|
8083
8083
|
type: Boolean,
|
|
8084
8084
|
default: false
|
|
8085
|
+
},
|
|
8086
|
+
fitOriginWidth: {
|
|
8087
|
+
type: Boolean,
|
|
8088
|
+
default: false
|
|
8085
8089
|
}
|
|
8086
8090
|
};
|
|
8087
|
-
function getScrollParent(element) {
|
|
8088
|
-
const overflowRegex = /(auto|scroll|hidden)/;
|
|
8089
|
-
for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
|
|
8090
|
-
const style = window.getComputedStyle(parent);
|
|
8091
|
-
if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
|
|
8092
|
-
return parent;
|
|
8093
|
-
}
|
|
8094
|
-
}
|
|
8095
|
-
return window;
|
|
8096
|
-
}
|
|
8097
8091
|
function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
8098
8092
|
let { x, y } = point;
|
|
8099
8093
|
if (!isArrowCenter) {
|
|
@@ -8114,9 +8108,18 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
|
8114
8108
|
return { x, y };
|
|
8115
8109
|
}
|
|
8116
8110
|
function useOverlay(props, emit) {
|
|
8111
|
+
const { fitOriginWidth, position, showArrow } = toRefs(props);
|
|
8117
8112
|
const overlayRef = ref();
|
|
8118
8113
|
const arrowRef = ref();
|
|
8119
|
-
|
|
8114
|
+
const overlayWidth = ref(0);
|
|
8115
|
+
let originObserver;
|
|
8116
|
+
const styles = computed(() => {
|
|
8117
|
+
if (fitOriginWidth.value) {
|
|
8118
|
+
return { width: overlayWidth.value + "px" };
|
|
8119
|
+
} else {
|
|
8120
|
+
return {};
|
|
8121
|
+
}
|
|
8122
|
+
});
|
|
8120
8123
|
const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
|
|
8121
8124
|
const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
|
|
8122
8125
|
const staticSide = {
|
|
@@ -8137,54 +8140,67 @@ function useOverlay(props, emit) {
|
|
|
8137
8140
|
const hostEl = props.origin;
|
|
8138
8141
|
const overlayEl = unref(overlayRef.value);
|
|
8139
8142
|
const arrowEl = unref(arrowRef.value);
|
|
8140
|
-
const
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
|
|
8145
|
-
})
|
|
8146
|
-
];
|
|
8147
|
-
props.showArrow && middleware.push(arrow({ element: arrowEl }));
|
|
8148
|
-
props.shiftOffset !== void 0 && middleware.push(shift());
|
|
8149
|
-
if (!overlayEl) {
|
|
8150
|
-
return;
|
|
8143
|
+
const [mainPosition, ...fallbackPosition] = position.value;
|
|
8144
|
+
const middleware = [offset(props.offset)];
|
|
8145
|
+
middleware.push(fallbackPosition.length ? flip({ fallbackPlacements: fallbackPosition }) : flip());
|
|
8146
|
+
if (showArrow.value) {
|
|
8147
|
+
middleware.push(arrow({ element: arrowRef.value }));
|
|
8151
8148
|
}
|
|
8152
8149
|
const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
|
|
8153
8150
|
strategy: "fixed",
|
|
8151
|
+
placement: mainPosition,
|
|
8154
8152
|
middleware
|
|
8155
8153
|
});
|
|
8156
8154
|
let applyX = x;
|
|
8157
8155
|
let applyY = y;
|
|
8158
|
-
if (props.shiftOffset !== void 0) {
|
|
8159
|
-
const { x: shiftX, y: shiftY } = middlewareData.shift;
|
|
8160
|
-
shiftX < 0 && (applyX -= props.shiftOffset);
|
|
8161
|
-
shiftX > 0 && (applyX += props.shiftOffset);
|
|
8162
|
-
shiftY < 0 && (applyY -= props.shiftOffset);
|
|
8163
|
-
shiftY > 0 && (applyY += props.shiftOffset);
|
|
8164
|
-
}
|
|
8165
8156
|
emit("positionChange", placement);
|
|
8166
8157
|
Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
|
|
8167
8158
|
props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
|
|
8168
8159
|
};
|
|
8160
|
+
const scrollCallback = (e) => {
|
|
8161
|
+
var _a, _b;
|
|
8162
|
+
const scrollElement = e.target;
|
|
8163
|
+
if (scrollElement == null ? void 0 : scrollElement.contains((_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin)) {
|
|
8164
|
+
updatePosition();
|
|
8165
|
+
}
|
|
8166
|
+
};
|
|
8167
|
+
const updateWidth = (originEl) => {
|
|
8168
|
+
overlayWidth.value = originEl.getBoundingClientRect().width;
|
|
8169
|
+
updatePosition();
|
|
8170
|
+
};
|
|
8171
|
+
const observeOrigin = () => {
|
|
8172
|
+
var _a, _b;
|
|
8173
|
+
if (fitOriginWidth.value && typeof window !== "undefined") {
|
|
8174
|
+
const originEl = (_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin;
|
|
8175
|
+
if (originEl) {
|
|
8176
|
+
originObserver = new window.ResizeObserver(() => updateWidth(originEl));
|
|
8177
|
+
originObserver.observe(originEl);
|
|
8178
|
+
}
|
|
8179
|
+
}
|
|
8180
|
+
};
|
|
8181
|
+
const unobserveOrigin = () => {
|
|
8182
|
+
var _a, _b;
|
|
8183
|
+
const originEl = (_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin;
|
|
8184
|
+
originEl && (originObserver == null ? void 0 : originObserver.unobserve(originEl));
|
|
8185
|
+
};
|
|
8169
8186
|
watch(() => props.modelValue, () => {
|
|
8170
8187
|
if (props.modelValue && props.origin) {
|
|
8171
|
-
originParent = getScrollParent(props.origin);
|
|
8172
8188
|
nextTick(updatePosition);
|
|
8173
|
-
|
|
8174
|
-
originParent !== window && window.addEventListener("scroll", updatePosition);
|
|
8189
|
+
window.addEventListener("scroll", scrollCallback, true);
|
|
8175
8190
|
window.addEventListener("resize", updatePosition);
|
|
8191
|
+
observeOrigin();
|
|
8176
8192
|
} else {
|
|
8177
|
-
|
|
8178
|
-
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
8193
|
+
window.removeEventListener("scroll", scrollCallback, true);
|
|
8179
8194
|
window.removeEventListener("resize", updatePosition);
|
|
8195
|
+
unobserveOrigin();
|
|
8180
8196
|
}
|
|
8181
8197
|
});
|
|
8182
8198
|
onUnmounted(() => {
|
|
8183
|
-
|
|
8184
|
-
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
8199
|
+
window.removeEventListener("scroll", scrollCallback, true);
|
|
8185
8200
|
window.removeEventListener("resize", updatePosition);
|
|
8201
|
+
unobserveOrigin();
|
|
8186
8202
|
});
|
|
8187
|
-
return { arrowRef, overlayRef, updatePosition };
|
|
8203
|
+
return { arrowRef, overlayRef, styles, updatePosition };
|
|
8188
8204
|
}
|
|
8189
8205
|
var flexibleOverlay = "";
|
|
8190
8206
|
const FlexibleOverlay = defineComponent({
|
|
@@ -8205,6 +8221,7 @@ const FlexibleOverlay = defineComponent({
|
|
|
8205
8221
|
const {
|
|
8206
8222
|
arrowRef,
|
|
8207
8223
|
overlayRef,
|
|
8224
|
+
styles,
|
|
8208
8225
|
updatePosition
|
|
8209
8226
|
} = useOverlay(props, emit);
|
|
8210
8227
|
expose({
|
|
@@ -8214,7 +8231,8 @@ const FlexibleOverlay = defineComponent({
|
|
|
8214
8231
|
var _a;
|
|
8215
8232
|
return props.modelValue && createVNode("div", mergeProps({
|
|
8216
8233
|
"ref": overlayRef,
|
|
8217
|
-
"class": ns2.b()
|
|
8234
|
+
"class": ns2.b(),
|
|
8235
|
+
"style": styles.value
|
|
8218
8236
|
}, attrs, {
|
|
8219
8237
|
"onClick": withModifiers(() => ({}), [clickEventBubble.value ? "" : "stop"]),
|
|
8220
8238
|
"onPointerup": withModifiers(() => ({}), ["stop"])
|