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/input/index.es.js
CHANGED
|
@@ -31,7 +31,7 @@ var __objRest = (source, exclude) => {
|
|
|
31
31
|
};
|
|
32
32
|
import { defineComponent, toRefs, computed, createVNode, resolveDynamicComponent, mergeProps, watch, provide, reactive, onUnmounted, Transition, ref, unref, nextTick, withModifiers, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, onMounted, Teleport, createTextVNode, onBeforeUnmount, getCurrentInstance, shallowRef, resolveDirective } from "vue";
|
|
33
33
|
import "clipboard";
|
|
34
|
-
import { offset,
|
|
34
|
+
import { offset, flip, arrow, computePosition } from "@floating-ui/dom";
|
|
35
35
|
const DEFAULT_PREFIX = "icon";
|
|
36
36
|
const iconProps = {
|
|
37
37
|
name: {
|
|
@@ -4305,7 +4305,7 @@ var lodash = { exports: {} };
|
|
|
4305
4305
|
var delay = baseRest(function(func, wait, args) {
|
|
4306
4306
|
return baseDelay(func, toNumber(wait) || 0, args);
|
|
4307
4307
|
});
|
|
4308
|
-
function
|
|
4308
|
+
function flip2(func) {
|
|
4309
4309
|
return createWrap(func, WRAP_FLIP_FLAG);
|
|
4310
4310
|
}
|
|
4311
4311
|
function memoize(func, resolver) {
|
|
@@ -5429,7 +5429,7 @@ var lodash = { exports: {} };
|
|
|
5429
5429
|
lodash2.flatten = flatten;
|
|
5430
5430
|
lodash2.flattenDeep = flattenDeep;
|
|
5431
5431
|
lodash2.flattenDepth = flattenDepth;
|
|
5432
|
-
lodash2.flip =
|
|
5432
|
+
lodash2.flip = flip2;
|
|
5433
5433
|
lodash2.flow = flow;
|
|
5434
5434
|
lodash2.flowRight = flowRight;
|
|
5435
5435
|
lodash2.fromPairs = fromPairs;
|
|
@@ -6069,18 +6069,12 @@ const flexibleOverlayProps = {
|
|
|
6069
6069
|
clickEventBubble: {
|
|
6070
6070
|
type: Boolean,
|
|
6071
6071
|
default: false
|
|
6072
|
+
},
|
|
6073
|
+
fitOriginWidth: {
|
|
6074
|
+
type: Boolean,
|
|
6075
|
+
default: false
|
|
6072
6076
|
}
|
|
6073
6077
|
};
|
|
6074
|
-
function getScrollParent(element) {
|
|
6075
|
-
const overflowRegex = /(auto|scroll|hidden)/;
|
|
6076
|
-
for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
|
|
6077
|
-
const style = window.getComputedStyle(parent);
|
|
6078
|
-
if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
|
|
6079
|
-
return parent;
|
|
6080
|
-
}
|
|
6081
|
-
}
|
|
6082
|
-
return window;
|
|
6083
|
-
}
|
|
6084
6078
|
function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
6085
6079
|
let { x, y } = point;
|
|
6086
6080
|
if (!isArrowCenter) {
|
|
@@ -6101,9 +6095,18 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
|
6101
6095
|
return { x, y };
|
|
6102
6096
|
}
|
|
6103
6097
|
function useOverlay(props, emit) {
|
|
6098
|
+
const { fitOriginWidth, position, showArrow } = toRefs(props);
|
|
6104
6099
|
const overlayRef = ref();
|
|
6105
6100
|
const arrowRef = ref();
|
|
6106
|
-
|
|
6101
|
+
const overlayWidth = ref(0);
|
|
6102
|
+
let originObserver;
|
|
6103
|
+
const styles = computed(() => {
|
|
6104
|
+
if (fitOriginWidth.value) {
|
|
6105
|
+
return { width: overlayWidth.value + "px" };
|
|
6106
|
+
} else {
|
|
6107
|
+
return {};
|
|
6108
|
+
}
|
|
6109
|
+
});
|
|
6107
6110
|
const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
|
|
6108
6111
|
const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
|
|
6109
6112
|
const staticSide = {
|
|
@@ -6124,54 +6127,67 @@ function useOverlay(props, emit) {
|
|
|
6124
6127
|
const hostEl = props.origin;
|
|
6125
6128
|
const overlayEl = unref(overlayRef.value);
|
|
6126
6129
|
const arrowEl = unref(arrowRef.value);
|
|
6127
|
-
const
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
})
|
|
6133
|
-
];
|
|
6134
|
-
props.showArrow && middleware.push(arrow({ element: arrowEl }));
|
|
6135
|
-
props.shiftOffset !== void 0 && middleware.push(shift());
|
|
6136
|
-
if (!overlayEl) {
|
|
6137
|
-
return;
|
|
6130
|
+
const [mainPosition, ...fallbackPosition] = position.value;
|
|
6131
|
+
const middleware = [offset(props.offset)];
|
|
6132
|
+
middleware.push(fallbackPosition.length ? flip({ fallbackPlacements: fallbackPosition }) : flip());
|
|
6133
|
+
if (showArrow.value) {
|
|
6134
|
+
middleware.push(arrow({ element: arrowRef.value }));
|
|
6138
6135
|
}
|
|
6139
6136
|
const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
|
|
6140
6137
|
strategy: "fixed",
|
|
6138
|
+
placement: mainPosition,
|
|
6141
6139
|
middleware
|
|
6142
6140
|
});
|
|
6143
6141
|
let applyX = x;
|
|
6144
6142
|
let applyY = y;
|
|
6145
|
-
if (props.shiftOffset !== void 0) {
|
|
6146
|
-
const { x: shiftX, y: shiftY } = middlewareData.shift;
|
|
6147
|
-
shiftX < 0 && (applyX -= props.shiftOffset);
|
|
6148
|
-
shiftX > 0 && (applyX += props.shiftOffset);
|
|
6149
|
-
shiftY < 0 && (applyY -= props.shiftOffset);
|
|
6150
|
-
shiftY > 0 && (applyY += props.shiftOffset);
|
|
6151
|
-
}
|
|
6152
6143
|
emit("positionChange", placement);
|
|
6153
6144
|
Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
|
|
6154
6145
|
props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
|
|
6155
6146
|
};
|
|
6147
|
+
const scrollCallback = (e) => {
|
|
6148
|
+
var _a, _b;
|
|
6149
|
+
const scrollElement = e.target;
|
|
6150
|
+
if (scrollElement == null ? void 0 : scrollElement.contains((_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin)) {
|
|
6151
|
+
updatePosition();
|
|
6152
|
+
}
|
|
6153
|
+
};
|
|
6154
|
+
const updateWidth = (originEl) => {
|
|
6155
|
+
overlayWidth.value = originEl.getBoundingClientRect().width;
|
|
6156
|
+
updatePosition();
|
|
6157
|
+
};
|
|
6158
|
+
const observeOrigin = () => {
|
|
6159
|
+
var _a, _b;
|
|
6160
|
+
if (fitOriginWidth.value && typeof window !== "undefined") {
|
|
6161
|
+
const originEl = (_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin;
|
|
6162
|
+
if (originEl) {
|
|
6163
|
+
originObserver = new window.ResizeObserver(() => updateWidth(originEl));
|
|
6164
|
+
originObserver.observe(originEl);
|
|
6165
|
+
}
|
|
6166
|
+
}
|
|
6167
|
+
};
|
|
6168
|
+
const unobserveOrigin = () => {
|
|
6169
|
+
var _a, _b;
|
|
6170
|
+
const originEl = (_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin;
|
|
6171
|
+
originEl && (originObserver == null ? void 0 : originObserver.unobserve(originEl));
|
|
6172
|
+
};
|
|
6156
6173
|
watch(() => props.modelValue, () => {
|
|
6157
6174
|
if (props.modelValue && props.origin) {
|
|
6158
|
-
originParent = getScrollParent(props.origin);
|
|
6159
6175
|
nextTick(updatePosition);
|
|
6160
|
-
|
|
6161
|
-
originParent !== window && window.addEventListener("scroll", updatePosition);
|
|
6176
|
+
window.addEventListener("scroll", scrollCallback, true);
|
|
6162
6177
|
window.addEventListener("resize", updatePosition);
|
|
6178
|
+
observeOrigin();
|
|
6163
6179
|
} else {
|
|
6164
|
-
|
|
6165
|
-
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
6180
|
+
window.removeEventListener("scroll", scrollCallback, true);
|
|
6166
6181
|
window.removeEventListener("resize", updatePosition);
|
|
6182
|
+
unobserveOrigin();
|
|
6167
6183
|
}
|
|
6168
6184
|
});
|
|
6169
6185
|
onUnmounted(() => {
|
|
6170
|
-
|
|
6171
|
-
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
6186
|
+
window.removeEventListener("scroll", scrollCallback, true);
|
|
6172
6187
|
window.removeEventListener("resize", updatePosition);
|
|
6188
|
+
unobserveOrigin();
|
|
6173
6189
|
});
|
|
6174
|
-
return { arrowRef, overlayRef, updatePosition };
|
|
6190
|
+
return { arrowRef, overlayRef, styles, updatePosition };
|
|
6175
6191
|
}
|
|
6176
6192
|
var flexibleOverlay = "";
|
|
6177
6193
|
const FlexibleOverlay = defineComponent({
|
|
@@ -6192,6 +6208,7 @@ const FlexibleOverlay = defineComponent({
|
|
|
6192
6208
|
const {
|
|
6193
6209
|
arrowRef,
|
|
6194
6210
|
overlayRef,
|
|
6211
|
+
styles,
|
|
6195
6212
|
updatePosition
|
|
6196
6213
|
} = useOverlay(props, emit);
|
|
6197
6214
|
expose({
|
|
@@ -6201,7 +6218,8 @@ const FlexibleOverlay = defineComponent({
|
|
|
6201
6218
|
var _a;
|
|
6202
6219
|
return props.modelValue && createVNode("div", mergeProps({
|
|
6203
6220
|
"ref": overlayRef,
|
|
6204
|
-
"class": ns2.b()
|
|
6221
|
+
"class": ns2.b(),
|
|
6222
|
+
"style": styles.value
|
|
6205
6223
|
}, attrs, {
|
|
6206
6224
|
"onClick": withModifiers(() => ({}), [clickEventBubble.value ? "" : "stop"]),
|
|
6207
6225
|
"onPointerup": withModifiers(() => ({}), ["stop"])
|