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/select/index.es.js
CHANGED
|
@@ -33,10 +33,10 @@ var __publicField = (obj, key, value) => {
|
|
|
33
33
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
34
34
|
return value;
|
|
35
35
|
};
|
|
36
|
-
import { defineComponent, watch, provide, reactive, toRefs, createVNode, onUnmounted, Transition, mergeProps, ref, unref, nextTick, withModifiers, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode,
|
|
36
|
+
import { defineComponent, watch, provide, reactive, toRefs, createVNode, onUnmounted, Transition, mergeProps, ref, computed, unref, nextTick, withModifiers, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, onMounted, Teleport, createTextVNode, onBeforeUnmount, toRef, onBeforeMount, vShow, resolveComponent, getCurrentInstance, render, resolveDirective } from "vue";
|
|
37
37
|
import { onClickOutside } from "@vueuse/core";
|
|
38
38
|
import "clipboard";
|
|
39
|
-
import { offset,
|
|
39
|
+
import { offset, flip, arrow, computePosition } from "@floating-ui/dom";
|
|
40
40
|
function className(classStr, classOpt) {
|
|
41
41
|
let classname = classStr;
|
|
42
42
|
if (typeof classOpt === "object") {
|
|
@@ -3916,7 +3916,7 @@ var lodash = { exports: {} };
|
|
|
3916
3916
|
var delay = baseRest(function(func, wait, args) {
|
|
3917
3917
|
return baseDelay(func, toNumber(wait) || 0, args);
|
|
3918
3918
|
});
|
|
3919
|
-
function
|
|
3919
|
+
function flip2(func) {
|
|
3920
3920
|
return createWrap(func, WRAP_FLIP_FLAG);
|
|
3921
3921
|
}
|
|
3922
3922
|
function memoize(func, resolver) {
|
|
@@ -5040,7 +5040,7 @@ var lodash = { exports: {} };
|
|
|
5040
5040
|
lodash2.flatten = flatten;
|
|
5041
5041
|
lodash2.flattenDeep = flattenDeep;
|
|
5042
5042
|
lodash2.flattenDepth = flattenDepth;
|
|
5043
|
-
lodash2.flip =
|
|
5043
|
+
lodash2.flip = flip2;
|
|
5044
5044
|
lodash2.flow = flow;
|
|
5045
5045
|
lodash2.flowRight = flowRight;
|
|
5046
5046
|
lodash2.fromPairs = fromPairs;
|
|
@@ -5833,18 +5833,12 @@ const flexibleOverlayProps = {
|
|
|
5833
5833
|
clickEventBubble: {
|
|
5834
5834
|
type: Boolean,
|
|
5835
5835
|
default: false
|
|
5836
|
+
},
|
|
5837
|
+
fitOriginWidth: {
|
|
5838
|
+
type: Boolean,
|
|
5839
|
+
default: false
|
|
5836
5840
|
}
|
|
5837
5841
|
};
|
|
5838
|
-
function getScrollParent(element) {
|
|
5839
|
-
const overflowRegex = /(auto|scroll|hidden)/;
|
|
5840
|
-
for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
|
|
5841
|
-
const style = window.getComputedStyle(parent);
|
|
5842
|
-
if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
|
|
5843
|
-
return parent;
|
|
5844
|
-
}
|
|
5845
|
-
}
|
|
5846
|
-
return window;
|
|
5847
|
-
}
|
|
5848
5842
|
function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
5849
5843
|
let { x, y } = point;
|
|
5850
5844
|
if (!isArrowCenter) {
|
|
@@ -5865,9 +5859,18 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
|
5865
5859
|
return { x, y };
|
|
5866
5860
|
}
|
|
5867
5861
|
function useOverlay(props, emit) {
|
|
5862
|
+
const { fitOriginWidth, position, showArrow } = toRefs(props);
|
|
5868
5863
|
const overlayRef = ref();
|
|
5869
5864
|
const arrowRef = ref();
|
|
5870
|
-
|
|
5865
|
+
const overlayWidth = ref(0);
|
|
5866
|
+
let originObserver;
|
|
5867
|
+
const styles = computed(() => {
|
|
5868
|
+
if (fitOriginWidth.value) {
|
|
5869
|
+
return { width: overlayWidth.value + "px" };
|
|
5870
|
+
} else {
|
|
5871
|
+
return {};
|
|
5872
|
+
}
|
|
5873
|
+
});
|
|
5871
5874
|
const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
|
|
5872
5875
|
const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
|
|
5873
5876
|
const staticSide = {
|
|
@@ -5888,54 +5891,67 @@ function useOverlay(props, emit) {
|
|
|
5888
5891
|
const hostEl = props.origin;
|
|
5889
5892
|
const overlayEl = unref(overlayRef.value);
|
|
5890
5893
|
const arrowEl = unref(arrowRef.value);
|
|
5891
|
-
const
|
|
5892
|
-
|
|
5893
|
-
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
})
|
|
5897
|
-
];
|
|
5898
|
-
props.showArrow && middleware.push(arrow({ element: arrowEl }));
|
|
5899
|
-
props.shiftOffset !== void 0 && middleware.push(shift());
|
|
5900
|
-
if (!overlayEl) {
|
|
5901
|
-
return;
|
|
5894
|
+
const [mainPosition, ...fallbackPosition] = position.value;
|
|
5895
|
+
const middleware = [offset(props.offset)];
|
|
5896
|
+
middleware.push(fallbackPosition.length ? flip({ fallbackPlacements: fallbackPosition }) : flip());
|
|
5897
|
+
if (showArrow.value) {
|
|
5898
|
+
middleware.push(arrow({ element: arrowRef.value }));
|
|
5902
5899
|
}
|
|
5903
5900
|
const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
|
|
5904
5901
|
strategy: "fixed",
|
|
5902
|
+
placement: mainPosition,
|
|
5905
5903
|
middleware
|
|
5906
5904
|
});
|
|
5907
5905
|
let applyX = x;
|
|
5908
5906
|
let applyY = y;
|
|
5909
|
-
if (props.shiftOffset !== void 0) {
|
|
5910
|
-
const { x: shiftX, y: shiftY } = middlewareData.shift;
|
|
5911
|
-
shiftX < 0 && (applyX -= props.shiftOffset);
|
|
5912
|
-
shiftX > 0 && (applyX += props.shiftOffset);
|
|
5913
|
-
shiftY < 0 && (applyY -= props.shiftOffset);
|
|
5914
|
-
shiftY > 0 && (applyY += props.shiftOffset);
|
|
5915
|
-
}
|
|
5916
5907
|
emit("positionChange", placement);
|
|
5917
5908
|
Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
|
|
5918
5909
|
props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
|
|
5919
5910
|
};
|
|
5911
|
+
const scrollCallback = (e) => {
|
|
5912
|
+
var _a, _b;
|
|
5913
|
+
const scrollElement = e.target;
|
|
5914
|
+
if (scrollElement == null ? void 0 : scrollElement.contains((_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin)) {
|
|
5915
|
+
updatePosition();
|
|
5916
|
+
}
|
|
5917
|
+
};
|
|
5918
|
+
const updateWidth = (originEl) => {
|
|
5919
|
+
overlayWidth.value = originEl.getBoundingClientRect().width;
|
|
5920
|
+
updatePosition();
|
|
5921
|
+
};
|
|
5922
|
+
const observeOrigin = () => {
|
|
5923
|
+
var _a, _b;
|
|
5924
|
+
if (fitOriginWidth.value && typeof window !== "undefined") {
|
|
5925
|
+
const originEl = (_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin;
|
|
5926
|
+
if (originEl) {
|
|
5927
|
+
originObserver = new window.ResizeObserver(() => updateWidth(originEl));
|
|
5928
|
+
originObserver.observe(originEl);
|
|
5929
|
+
}
|
|
5930
|
+
}
|
|
5931
|
+
};
|
|
5932
|
+
const unobserveOrigin = () => {
|
|
5933
|
+
var _a, _b;
|
|
5934
|
+
const originEl = (_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin;
|
|
5935
|
+
originEl && (originObserver == null ? void 0 : originObserver.unobserve(originEl));
|
|
5936
|
+
};
|
|
5920
5937
|
watch(() => props.modelValue, () => {
|
|
5921
5938
|
if (props.modelValue && props.origin) {
|
|
5922
|
-
originParent = getScrollParent(props.origin);
|
|
5923
5939
|
nextTick(updatePosition);
|
|
5924
|
-
|
|
5925
|
-
originParent !== window && window.addEventListener("scroll", updatePosition);
|
|
5940
|
+
window.addEventListener("scroll", scrollCallback, true);
|
|
5926
5941
|
window.addEventListener("resize", updatePosition);
|
|
5942
|
+
observeOrigin();
|
|
5927
5943
|
} else {
|
|
5928
|
-
|
|
5929
|
-
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
5944
|
+
window.removeEventListener("scroll", scrollCallback, true);
|
|
5930
5945
|
window.removeEventListener("resize", updatePosition);
|
|
5946
|
+
unobserveOrigin();
|
|
5931
5947
|
}
|
|
5932
5948
|
});
|
|
5933
5949
|
onUnmounted(() => {
|
|
5934
|
-
|
|
5935
|
-
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
5950
|
+
window.removeEventListener("scroll", scrollCallback, true);
|
|
5936
5951
|
window.removeEventListener("resize", updatePosition);
|
|
5952
|
+
unobserveOrigin();
|
|
5937
5953
|
});
|
|
5938
|
-
return { arrowRef, overlayRef, updatePosition };
|
|
5954
|
+
return { arrowRef, overlayRef, styles, updatePosition };
|
|
5939
5955
|
}
|
|
5940
5956
|
var flexibleOverlay = "";
|
|
5941
5957
|
const FlexibleOverlay = defineComponent({
|
|
@@ -5956,6 +5972,7 @@ const FlexibleOverlay = defineComponent({
|
|
|
5956
5972
|
const {
|
|
5957
5973
|
arrowRef,
|
|
5958
5974
|
overlayRef,
|
|
5975
|
+
styles,
|
|
5959
5976
|
updatePosition
|
|
5960
5977
|
} = useOverlay(props, emit);
|
|
5961
5978
|
expose({
|
|
@@ -5965,7 +5982,8 @@ const FlexibleOverlay = defineComponent({
|
|
|
5965
5982
|
var _a;
|
|
5966
5983
|
return props.modelValue && createVNode("div", mergeProps({
|
|
5967
5984
|
"ref": overlayRef,
|
|
5968
|
-
"class": ns2.b()
|
|
5985
|
+
"class": ns2.b(),
|
|
5986
|
+
"style": styles.value
|
|
5969
5987
|
}, attrs, {
|
|
5970
5988
|
"onClick": withModifiers(() => ({}), [clickEventBubble.value ? "" : "stop"]),
|
|
5971
5989
|
"onPointerup": withModifiers(() => ({}), ["stop"])
|
|
@@ -8242,6 +8260,13 @@ const selectProps = {
|
|
|
8242
8260
|
showGlowStyle: {
|
|
8243
8261
|
type: Boolean,
|
|
8244
8262
|
default: true
|
|
8263
|
+
},
|
|
8264
|
+
menuClass: {
|
|
8265
|
+
type: String,
|
|
8266
|
+
default: ""
|
|
8267
|
+
},
|
|
8268
|
+
maxLength: {
|
|
8269
|
+
type: Number
|
|
8245
8270
|
}
|
|
8246
8271
|
};
|
|
8247
8272
|
const optionProps = {
|
|
@@ -9232,6 +9257,7 @@ function useSelectContent() {
|
|
|
9232
9257
|
}
|
|
9233
9258
|
};
|
|
9234
9259
|
return {
|
|
9260
|
+
select: select2,
|
|
9235
9261
|
searchQuery,
|
|
9236
9262
|
selectedData,
|
|
9237
9263
|
isSelectDisable,
|
|
@@ -9267,6 +9293,7 @@ var SelectContent = defineComponent({
|
|
|
9267
9293
|
const multipleCls = ns2.e("multiple");
|
|
9268
9294
|
const multipleInputCls = ns2.em("multiple", "input");
|
|
9269
9295
|
const {
|
|
9296
|
+
select: select2,
|
|
9270
9297
|
searchQuery,
|
|
9271
9298
|
selectedData,
|
|
9272
9299
|
isSelectDisable,
|
|
@@ -9330,6 +9357,7 @@ var SelectContent = defineComponent({
|
|
|
9330
9357
|
"placeholder": placeholder.value,
|
|
9331
9358
|
"readonly": isReadOnly.value,
|
|
9332
9359
|
"disabled": isSelectDisable.value,
|
|
9360
|
+
"maxlength": select2 == null ? void 0 : select2.maxLength,
|
|
9333
9361
|
"onInput": queryFilter,
|
|
9334
9362
|
"onFocus": onFocus,
|
|
9335
9363
|
"onBlur": onBlur
|
|
@@ -9341,6 +9369,7 @@ var SelectContent = defineComponent({
|
|
|
9341
9369
|
"placeholder": placeholder.value,
|
|
9342
9370
|
"readonly": isReadOnly.value,
|
|
9343
9371
|
"disabled": isSelectDisable.value,
|
|
9372
|
+
"maxlength": select2 == null ? void 0 : select2.maxLength,
|
|
9344
9373
|
"onFocus": onFocus,
|
|
9345
9374
|
"onBlur": onBlur,
|
|
9346
9375
|
"onInput": queryFilter
|
|
@@ -9639,7 +9668,6 @@ var Select = defineComponent({
|
|
|
9639
9668
|
const isRender = ref(false);
|
|
9640
9669
|
const currentPosition = ref("bottom");
|
|
9641
9670
|
const position = ref(["bottom-start", "top-start"]);
|
|
9642
|
-
const dropdownWidth = ref("0");
|
|
9643
9671
|
const handlePositionChange = (pos) => {
|
|
9644
9672
|
currentPosition.value = pos.split("-")[0] === "top" ? "top" : "bottom";
|
|
9645
9673
|
};
|
|
@@ -9647,14 +9675,9 @@ var Select = defineComponent({
|
|
|
9647
9675
|
transformOrigin: currentPosition.value === "top" ? "0% 100%" : "0% 0%",
|
|
9648
9676
|
"z-index": "var(--devui-z-index-dropdown, 1052)"
|
|
9649
9677
|
}));
|
|
9650
|
-
const updateDropdownWidth = () => {
|
|
9651
|
-
var _a;
|
|
9652
|
-
dropdownWidth.value = ((_a = originRef == null ? void 0 : originRef.value) == null ? void 0 : _a.clientWidth) ? originRef.value.clientWidth + "px" : "100%";
|
|
9653
|
-
};
|
|
9654
9678
|
watch(selectRef, (val) => {
|
|
9655
9679
|
if (val) {
|
|
9656
9680
|
originRef.value = val.$el;
|
|
9657
|
-
updateDropdownWidth();
|
|
9658
9681
|
}
|
|
9659
9682
|
});
|
|
9660
9683
|
const scrollToBottom = () => {
|
|
@@ -9666,15 +9689,11 @@ var Select = defineComponent({
|
|
|
9666
9689
|
};
|
|
9667
9690
|
onMounted(() => {
|
|
9668
9691
|
isRender.value = true;
|
|
9669
|
-
updateDropdownWidth();
|
|
9670
|
-
window.addEventListener("resize", updateDropdownWidth);
|
|
9671
9692
|
nextTick(() => {
|
|
9672
|
-
|
|
9693
|
+
var _a;
|
|
9694
|
+
(_a = dropdownContainer.value) == null ? void 0 : _a.addEventListener("scroll", scrollToBottom);
|
|
9673
9695
|
});
|
|
9674
9696
|
});
|
|
9675
|
-
onUnmounted(() => {
|
|
9676
|
-
window.removeEventListener("resize", updateDropdownWidth);
|
|
9677
|
-
});
|
|
9678
9697
|
provide(SELECT_TOKEN, reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
|
|
9679
9698
|
selectDisabled,
|
|
9680
9699
|
selectSize,
|
|
@@ -9710,17 +9729,16 @@ var Select = defineComponent({
|
|
|
9710
9729
|
"origin": originRef.value,
|
|
9711
9730
|
"align": "start",
|
|
9712
9731
|
"offset": 4,
|
|
9732
|
+
"fit-origin-width": true,
|
|
9713
9733
|
"position": position.value,
|
|
9714
9734
|
"onPositionChange": handlePositionChange,
|
|
9715
|
-
"style": styles.value
|
|
9735
|
+
"style": styles.value,
|
|
9736
|
+
"class": props.menuClass
|
|
9716
9737
|
}, {
|
|
9717
9738
|
default: () => {
|
|
9718
9739
|
var _a, _b, _c, _d;
|
|
9719
9740
|
return [withDirectives(createVNode("div", {
|
|
9720
|
-
"class": dropdownCls
|
|
9721
|
-
"style": {
|
|
9722
|
-
width: `${dropdownWidth.value}`
|
|
9723
|
-
}
|
|
9741
|
+
"class": dropdownCls
|
|
9724
9742
|
}, [withDirectives(createVNode("ul", {
|
|
9725
9743
|
"class": listCls,
|
|
9726
9744
|
"ref": dropdownContainer
|