vue-devui 1.0.0-beta.18 → 1.0.0-beta.19
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/README.md +200 -187
- package/accordion/index.es.js +221 -6
- package/accordion/index.umd.js +1 -1
- package/alert/index.es.js +28 -30
- package/alert/index.umd.js +1 -1
- package/auto-complete/index.es.js +131 -269
- package/auto-complete/index.umd.js +1 -1
- package/auto-complete/style.css +1 -1
- package/back-top/index.es.js +4 -2
- package/badge/index.es.js +13 -19
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/breadcrumb/index.es.js +2 -1
- package/button/index.es.js +39 -40
- package/button/index.umd.js +1 -1
- package/carousel/index.es.js +38 -53
- package/carousel/index.umd.js +1 -1
- package/cascader/index.es.js +16 -8
- package/cascader/style.css +1 -1
- package/color-picker/index.es.js +97 -89
- package/color-picker/index.umd.js +7 -7
- package/countdown/index.es.js +2 -1
- package/date-picker/index.es.js +40 -57
- package/date-picker/index.umd.js +1 -1
- package/date-picker/style.css +1 -1
- package/drawer/index.es.js +162 -5741
- package/drawer/index.umd.js +1 -27
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +459 -301
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +6 -3
- package/form/index.es.js +1953 -1550
- package/form/index.umd.js +18 -18
- package/form/style.css +1 -1
- package/fullscreen/index.es.js +112 -133
- package/fullscreen/index.umd.js +1 -1
- package/fullscreen/style.css +1 -1
- package/icon/index.es.js +39 -57
- package/icon/index.umd.js +1 -1
- package/image-preview/index.es.js +2 -1
- package/input/style.css +1 -1
- package/input-icon/index.es.js +38 -37
- package/input-icon/index.umd.js +1 -1
- package/input-icon/style.css +1 -1
- package/input-number/index.es.js +46 -57
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/{time-axis → list}/index.d.ts +0 -0
- package/list/index.es.js +39 -0
- package/list/index.umd.js +1 -0
- package/{toast → list}/package.json +1 -1
- package/list/style.css +1 -0
- package/modal/index.es.js +300 -934
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/{toast → notification}/index.d.ts +0 -0
- package/notification/index.es.js +284 -0
- package/notification/index.umd.js +1 -0
- package/notification/package.json +7 -0
- package/notification/style.css +1 -0
- package/nuxt/components/DropdownMenu.js +3 -0
- package/nuxt/components/IFileOptions.js +3 -0
- package/nuxt/components/IUploadOptions.js +3 -0
- package/nuxt/components/List.js +3 -0
- package/nuxt/components/ListItem.js +3 -0
- package/nuxt/components/Notification.js +3 -0
- package/nuxt/components/NotificationService.js +3 -0
- package/nuxt/components/PanelBody.js +3 -0
- package/nuxt/components/PanelFooter.js +3 -0
- package/nuxt/components/PanelHeader.js +3 -0
- package/nuxt/components/Timeline.js +3 -0
- package/nuxt/components/TimelineItem.js +3 -0
- package/nuxt/components/UploadStatus.js +3 -0
- package/nuxt/components/alertProps.js +3 -0
- package/nuxt/components/badgeProps.js +3 -0
- package/nuxt/components/dropdownMenuProps.js +3 -0
- package/nuxt/components/fixedOverlayProps.js +3 -0
- package/nuxt/components/flexibleOverlayProps.js +3 -0
- package/nuxt/components/fullscreenProps.js +3 -0
- package/nuxt/components/iconProps.js +2 -0
- package/nuxt/components/notificationProps.js +3 -0
- package/nuxt/components/overlayEmits.js +3 -0
- package/nuxt/components/overlayProps.js +3 -0
- package/nuxt/components/paginationProps.js +3 -0
- package/nuxt/components/panelProps.js +3 -0
- package/nuxt/components/popoverProps.js +3 -0
- package/nuxt/components/searchProps.js +3 -0
- package/nuxt/components/tooltipProps.js +3 -0
- package/nuxt/components/uploadProps.js +3 -0
- package/overlay/index.es.js +152 -198
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +40 -87
- package/pagination/index.es.js +10 -12
- package/pagination/index.umd.js +1 -1
- package/panel/index.es.js +45 -32
- package/panel/index.umd.js +1 -1
- package/popover/index.es.js +5954 -201
- package/popover/index.umd.js +27 -1
- package/popover/style.css +1 -1
- package/read-tip/index.es.js +6 -3
- package/result/index.es.js +38 -53
- package/result/index.umd.js +1 -1
- package/ripple/index.es.js +9 -5
- package/search/index.es.js +19 -29
- package/search/index.umd.js +6 -6
- package/search/style.css +1 -1
- package/select/index.es.js +42 -42
- package/select/index.umd.js +1 -1
- package/select/style.css +1 -1
- package/skeleton/index.es.js +17 -17
- package/skeleton/index.umd.js +1 -1
- package/slider/index.es.js +2 -1
- package/splitter/index.es.js +5814 -98
- package/splitter/index.umd.js +27 -1
- package/splitter/style.css +1 -1
- package/status/index.es.js +1 -4
- package/status/index.umd.js +1 -1
- package/status/style.css +1 -1
- package/steps-guide/index.es.js +6 -3
- package/style.css +1 -1
- package/table/index.es.js +456 -299
- package/table/index.umd.js +1 -1
- package/table/style.css +1 -1
- package/tabs/index.es.js +3 -4
- package/tabs/index.umd.js +1 -1
- package/tag/index.es.js +2 -1
- package/tag-input/index.es.js +4 -2
- package/textarea/style.css +1 -1
- package/time-picker/index.es.js +43 -42
- package/time-picker/index.umd.js +1 -1
- package/timeline/index.d.ts +7 -0
- package/{time-axis → timeline}/index.es.js +65 -78
- package/timeline/index.umd.js +1 -0
- package/{time-axis → timeline}/package.json +1 -1
- package/timeline/style.css +1 -0
- package/tooltip/index.es.js +5804 -94
- package/tooltip/index.umd.js +27 -1
- package/tooltip/style.css +1 -1
- package/transfer/index.es.js +440 -165
- package/transfer/index.umd.js +17 -17
- package/transfer/style.css +1 -1
- package/tree/index.es.js +12 -7
- package/tree/index.umd.js +10 -10
- package/tree-select/index.es.js +10 -6
- package/tree-select/index.umd.js +1 -1
- package/upload/index.es.js +335 -6068
- package/upload/index.umd.js +1 -27
- package/upload/style.css +1 -1
- package/vue-devui.es.js +2555 -2799
- package/vue-devui.umd.js +16 -16
- package/nuxt/components/TimeAxis.js +0 -3
- package/nuxt/components/TimeAxisItem.js +0 -3
- package/nuxt/components/Toast.js +0 -3
- package/nuxt/components/ToastService.js +0 -3
- package/time-axis/index.umd.js +0 -1
- package/time-axis/style.css +0 -1
- package/toast/index.es.js +0 -5918
- package/toast/index.umd.js +0 -27
- package/toast/style.css +0 -1
|
@@ -18,7 +18,8 @@ var __publicField = (obj, key, value) => {
|
|
|
18
18
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
19
19
|
return value;
|
|
20
20
|
};
|
|
21
|
-
import { ref, nextTick, defineComponent, createVNode, h, render, inject, withDirectives, createTextVNode, resolveDirective, vShow,
|
|
21
|
+
import { ref, nextTick, defineComponent, createVNode, h, render, inject, withDirectives, createTextVNode, resolveDirective, vShow, unref, watch, onUnmounted, mergeProps, toRefs, provide, reactive, isVNode, Transition } from "vue";
|
|
22
|
+
import { shift, offset, autoPlacement, arrow, computePosition } from "@floating-ui/dom";
|
|
22
23
|
const defaultFormatter = (item) => item ? item.label || item.toString() : "";
|
|
23
24
|
const defaultValueParse = (item) => item;
|
|
24
25
|
const autoCompleteProps = {
|
|
@@ -282,8 +283,9 @@ function useLazyHandle(props, ctx2, handleSearch) {
|
|
|
282
283
|
const showLoading = ref(false);
|
|
283
284
|
const dropDownRef = ref();
|
|
284
285
|
const loadMore = () => {
|
|
285
|
-
if (!props.enableLazyLoad && showLoading)
|
|
286
|
+
if (!props.enableLazyLoad && showLoading) {
|
|
286
287
|
return;
|
|
288
|
+
}
|
|
287
289
|
const dropDownValue = dropDownRef.value;
|
|
288
290
|
const height = dropDownValue.scrollHeight;
|
|
289
291
|
const scrollTop = dropDownValue.clientHeight + dropDownValue.scrollTop;
|
|
@@ -679,298 +681,158 @@ const clickoutsideDirective = {
|
|
|
679
681
|
delete el[ctx];
|
|
680
682
|
}
|
|
681
683
|
};
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
685
|
-
}
|
|
686
|
-
const CommonOverlay = defineComponent({
|
|
687
|
-
setup(props, ctx2) {
|
|
688
|
-
return () => {
|
|
689
|
-
let _slot;
|
|
690
|
-
return createVNode(Teleport, {
|
|
691
|
-
"to": "#d-overlay-anchor"
|
|
692
|
-
}, {
|
|
693
|
-
default: () => [createVNode(Transition, {
|
|
694
|
-
"name": "devui-overlay-fade"
|
|
695
|
-
}, _isSlot$1(_slot = renderSlot(ctx2.slots, "default")) ? _slot : {
|
|
696
|
-
default: () => [_slot]
|
|
697
|
-
})]
|
|
698
|
-
});
|
|
699
|
-
};
|
|
700
|
-
}
|
|
701
|
-
});
|
|
702
|
-
const overlayProps = {
|
|
703
|
-
visible: {
|
|
704
|
-
type: Boolean
|
|
705
|
-
},
|
|
706
|
-
backgroundBlock: {
|
|
684
|
+
const flexibleOverlayProps = {
|
|
685
|
+
modelValue: {
|
|
707
686
|
type: Boolean,
|
|
708
687
|
default: false
|
|
709
688
|
},
|
|
710
|
-
|
|
711
|
-
type:
|
|
712
|
-
|
|
689
|
+
origin: {
|
|
690
|
+
type: Object,
|
|
691
|
+
require: true
|
|
713
692
|
},
|
|
714
|
-
|
|
715
|
-
type:
|
|
693
|
+
position: {
|
|
694
|
+
type: Array,
|
|
695
|
+
default: ["bottom"]
|
|
716
696
|
},
|
|
717
|
-
|
|
718
|
-
type:
|
|
697
|
+
offset: {
|
|
698
|
+
type: [Number, Object],
|
|
699
|
+
default: 8
|
|
700
|
+
},
|
|
701
|
+
align: {
|
|
702
|
+
type: String,
|
|
703
|
+
default: null
|
|
719
704
|
},
|
|
720
|
-
|
|
705
|
+
showArrow: {
|
|
721
706
|
type: Boolean,
|
|
722
|
-
default:
|
|
707
|
+
default: false
|
|
723
708
|
},
|
|
724
|
-
|
|
709
|
+
isArrowCenter: {
|
|
725
710
|
type: Boolean,
|
|
726
711
|
default: true
|
|
727
712
|
}
|
|
728
713
|
};
|
|
729
|
-
|
|
730
|
-
const
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
type: Object,
|
|
737
|
-
default: () => ({
|
|
738
|
-
originX: "left",
|
|
739
|
-
originY: "top",
|
|
740
|
-
overlayX: "left",
|
|
741
|
-
overlayY: "top"
|
|
742
|
-
})
|
|
714
|
+
function getScrollParent(element) {
|
|
715
|
+
const overflowRegex = /(auto|scroll|hidden)/;
|
|
716
|
+
for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
|
|
717
|
+
const style = window.getComputedStyle(parent);
|
|
718
|
+
if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
|
|
719
|
+
return parent;
|
|
720
|
+
}
|
|
743
721
|
}
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
});
|
|
753
|
-
const overlayClass = computed(() => {
|
|
754
|
-
return "devui-overlay";
|
|
755
|
-
});
|
|
756
|
-
const handleBackdropClick = (event) => {
|
|
757
|
-
var _a;
|
|
758
|
-
event.preventDefault();
|
|
759
|
-
(_a = props.onBackdropClick) == null ? void 0 : _a.call(props);
|
|
760
|
-
if (props.backdropClose) {
|
|
761
|
-
ctx2.emit("update:visible", false);
|
|
722
|
+
return window;
|
|
723
|
+
}
|
|
724
|
+
function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
725
|
+
let { x, y } = point;
|
|
726
|
+
if (!isArrowCenter) {
|
|
727
|
+
const { width, height } = originRect;
|
|
728
|
+
if (x && placement.includes("start")) {
|
|
729
|
+
x = 12;
|
|
762
730
|
}
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
731
|
+
if (x && placement.includes("end")) {
|
|
732
|
+
x = Math.round(width - 24);
|
|
733
|
+
}
|
|
734
|
+
if (y && placement.includes("start")) {
|
|
735
|
+
y = 10;
|
|
736
|
+
}
|
|
737
|
+
if (y && placement.includes("end")) {
|
|
738
|
+
y = height - 14;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
return { x, y };
|
|
742
|
+
}
|
|
743
|
+
function useOverlay(props, emit) {
|
|
744
|
+
const overlayRef = ref();
|
|
745
|
+
const arrowRef = ref();
|
|
746
|
+
const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
|
|
747
|
+
const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
|
|
748
|
+
const staticSide = {
|
|
749
|
+
top: "bottom",
|
|
750
|
+
right: "left",
|
|
751
|
+
bottom: "top",
|
|
752
|
+
left: "right"
|
|
753
|
+
}[placement.split("-")[0]];
|
|
754
|
+
Object.assign(arrowEl.style, {
|
|
755
|
+
left: x ? `${x}px` : "",
|
|
756
|
+
top: y ? `${y}px` : "",
|
|
757
|
+
right: "",
|
|
758
|
+
bottom: "",
|
|
759
|
+
[staticSide]: "-4px"
|
|
783
760
|
});
|
|
784
|
-
|
|
785
|
-
|
|
761
|
+
};
|
|
762
|
+
const updatePosition = async () => {
|
|
763
|
+
const hostEl = props.origin;
|
|
764
|
+
const overlayEl = unref(overlayRef.value);
|
|
765
|
+
const arrowEl = unref(arrowRef.value);
|
|
766
|
+
const middleware = [
|
|
767
|
+
shift(),
|
|
768
|
+
offset(props.offset),
|
|
769
|
+
autoPlacement({
|
|
770
|
+
alignment: props.align,
|
|
771
|
+
allowedPlacements: props.position
|
|
772
|
+
})
|
|
773
|
+
];
|
|
774
|
+
props.showArrow && middleware.push(arrow({ element: arrowEl }));
|
|
775
|
+
const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
|
|
776
|
+
strategy: "fixed",
|
|
777
|
+
middleware
|
|
786
778
|
});
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
overlayClass,
|
|
791
|
-
handleBackdropClick,
|
|
792
|
-
handleOverlayBubbleCancel
|
|
779
|
+
emit("positionChange", placement);
|
|
780
|
+
Object.assign(overlayEl.style, { top: `${y}px`, left: `${x}px` });
|
|
781
|
+
props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
|
|
793
782
|
};
|
|
783
|
+
watch(() => props.modelValue, () => {
|
|
784
|
+
const originParent = getScrollParent(props.origin);
|
|
785
|
+
if (props.modelValue && props.origin) {
|
|
786
|
+
nextTick(updatePosition);
|
|
787
|
+
originParent.addEventListener("scroll", updatePosition);
|
|
788
|
+
originParent !== window && window.addEventListener("scroll", updatePosition);
|
|
789
|
+
window.addEventListener("resize", updatePosition);
|
|
790
|
+
} else {
|
|
791
|
+
originParent.removeEventListener("scroll", updatePosition);
|
|
792
|
+
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
793
|
+
window.removeEventListener("resize", updatePosition);
|
|
794
|
+
}
|
|
795
|
+
});
|
|
796
|
+
onUnmounted(() => {
|
|
797
|
+
const originParent = getScrollParent(props.origin);
|
|
798
|
+
originParent.removeEventListener("scroll", updatePosition);
|
|
799
|
+
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
800
|
+
window.removeEventListener("resize", updatePosition);
|
|
801
|
+
});
|
|
802
|
+
return { arrowRef, overlayRef, updatePosition };
|
|
794
803
|
}
|
|
795
|
-
|
|
796
|
-
return !!(target == null ? void 0 : target.$el);
|
|
797
|
-
}
|
|
798
|
-
function getElement(element) {
|
|
799
|
-
if (element instanceof Element) {
|
|
800
|
-
return element;
|
|
801
|
-
}
|
|
802
|
-
if (element && typeof element === "object" && element.$el instanceof Element) {
|
|
803
|
-
return element.$el;
|
|
804
|
-
}
|
|
805
|
-
return null;
|
|
806
|
-
}
|
|
804
|
+
var flexibleOverlay = "";
|
|
807
805
|
const FlexibleOverlay = defineComponent({
|
|
808
806
|
name: "DFlexibleOverlay",
|
|
807
|
+
inheritAttrs: false,
|
|
809
808
|
props: flexibleOverlayProps,
|
|
810
|
-
emits:
|
|
811
|
-
setup(props,
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
const handleRectChange = (position, rect, origin) => {
|
|
818
|
-
const point = calculatePosition(position, rect, origin);
|
|
819
|
-
positionedStyle.left = `${point.x}px`;
|
|
820
|
-
positionedStyle.top = `${point.y}px`;
|
|
821
|
-
};
|
|
822
|
-
const locationElements = computed(() => {
|
|
823
|
-
const overlay2 = overlayRef.value;
|
|
824
|
-
const origin = getOrigin(props.origin);
|
|
825
|
-
if (!overlay2 || !origin) {
|
|
826
|
-
return;
|
|
827
|
-
}
|
|
828
|
-
return {
|
|
829
|
-
origin,
|
|
830
|
-
overlay: overlay2
|
|
831
|
-
};
|
|
832
|
-
});
|
|
833
|
-
const visibleRef = toRef(props, "visible");
|
|
834
|
-
const positionRef = toRef(props, "position");
|
|
835
|
-
watch([locationElements, visibleRef, positionRef], async ([locationElements2, visible, position], ov, onInvalidate) => {
|
|
836
|
-
if (!visible || !locationElements2) {
|
|
837
|
-
return;
|
|
838
|
-
}
|
|
839
|
-
const {
|
|
840
|
-
origin,
|
|
841
|
-
overlay: overlay2
|
|
842
|
-
} = locationElements2;
|
|
843
|
-
handleRectChange(position, overlay2.getBoundingClientRect(), origin);
|
|
844
|
-
const unsubscriptions = [subscribeLayoutEvent(() => handleRectChange(position, overlay2.getBoundingClientRect(), origin)), subscribeOverlayResize(overlay2, (entries) => handleRectChange(position, entries[0].contentRect, origin)), subscribeOriginResize(origin, () => handleRectChange(position, overlay2.getBoundingClientRect(), origin))];
|
|
845
|
-
onInvalidate(() => {
|
|
846
|
-
unsubscriptions.forEach((fn) => fn());
|
|
847
|
-
});
|
|
848
|
-
});
|
|
849
|
-
});
|
|
809
|
+
emits: ["update:modelValue", "positionChange"],
|
|
810
|
+
setup(props, {
|
|
811
|
+
slots,
|
|
812
|
+
attrs,
|
|
813
|
+
emit,
|
|
814
|
+
expose
|
|
815
|
+
}) {
|
|
850
816
|
const {
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
default: () => [withDirectives(createVNode("div", {
|
|
858
|
-
"style": props.backgroundStyle,
|
|
859
|
-
"class": backgroundClass.value,
|
|
860
|
-
"onClick": handleBackdropClick
|
|
861
|
-
}, [createVNode("div", {
|
|
862
|
-
"ref": overlayRef,
|
|
863
|
-
"class": overlayClass.value,
|
|
864
|
-
"style": positionedStyle,
|
|
865
|
-
"onClick": handleOverlayBubbleCancel
|
|
866
|
-
}, [renderSlot(ctx2.slots, "default")])]), [[vShow, props.visible]])]
|
|
817
|
+
arrowRef,
|
|
818
|
+
overlayRef,
|
|
819
|
+
updatePosition
|
|
820
|
+
} = useOverlay(props, emit);
|
|
821
|
+
expose({
|
|
822
|
+
updatePosition
|
|
867
823
|
});
|
|
824
|
+
return () => {
|
|
825
|
+
var _a;
|
|
826
|
+
return props.modelValue && createVNode("div", mergeProps({
|
|
827
|
+
"ref": overlayRef,
|
|
828
|
+
"class": "devui-flexible-overlay"
|
|
829
|
+
}, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
|
|
830
|
+
"ref": arrowRef,
|
|
831
|
+
"class": "devui-flexible-overlay-arrow"
|
|
832
|
+
}, null)]);
|
|
833
|
+
};
|
|
868
834
|
}
|
|
869
835
|
});
|
|
870
|
-
function getOrigin(origin) {
|
|
871
|
-
if (origin instanceof Element) {
|
|
872
|
-
return origin;
|
|
873
|
-
}
|
|
874
|
-
if (isRef(origin)) {
|
|
875
|
-
return getElement(origin.value);
|
|
876
|
-
}
|
|
877
|
-
if (isComponent(origin)) {
|
|
878
|
-
return getElement(origin);
|
|
879
|
-
}
|
|
880
|
-
return origin;
|
|
881
|
-
}
|
|
882
|
-
function calculatePosition(position, rect, origin) {
|
|
883
|
-
const originRect = getOriginRect(origin);
|
|
884
|
-
const originPoint = getOriginRelativePoint(originRect, position);
|
|
885
|
-
return getOverlayPoint(originPoint, rect, position);
|
|
886
|
-
}
|
|
887
|
-
function getOriginRect(origin) {
|
|
888
|
-
if (origin instanceof Element) {
|
|
889
|
-
return origin.getBoundingClientRect();
|
|
890
|
-
}
|
|
891
|
-
const width = origin.width || 0;
|
|
892
|
-
const height = origin.height || 0;
|
|
893
|
-
return {
|
|
894
|
-
top: origin.y,
|
|
895
|
-
bottom: origin.y + height,
|
|
896
|
-
left: origin.x,
|
|
897
|
-
right: origin.x + width,
|
|
898
|
-
height,
|
|
899
|
-
width
|
|
900
|
-
};
|
|
901
|
-
}
|
|
902
|
-
function getOverlayPoint(originPoint, rect, position) {
|
|
903
|
-
let x;
|
|
904
|
-
const {
|
|
905
|
-
width,
|
|
906
|
-
height
|
|
907
|
-
} = rect;
|
|
908
|
-
if (position.overlayX == "center") {
|
|
909
|
-
x = originPoint.x - width / 2;
|
|
910
|
-
} else {
|
|
911
|
-
x = position.overlayX == "left" ? originPoint.x : originPoint.x - width;
|
|
912
|
-
}
|
|
913
|
-
let y;
|
|
914
|
-
if (position.overlayY == "center") {
|
|
915
|
-
y = originPoint.y - height / 2;
|
|
916
|
-
} else {
|
|
917
|
-
y = position.overlayY == "top" ? originPoint.y : originPoint.y - height;
|
|
918
|
-
}
|
|
919
|
-
return {
|
|
920
|
-
x,
|
|
921
|
-
y
|
|
922
|
-
};
|
|
923
|
-
}
|
|
924
|
-
function getOriginRelativePoint(originRect, position) {
|
|
925
|
-
let x;
|
|
926
|
-
if (position.originX == "center") {
|
|
927
|
-
x = originRect.left + originRect.width / 2;
|
|
928
|
-
} else {
|
|
929
|
-
const startX = originRect.left;
|
|
930
|
-
const endX = originRect.right;
|
|
931
|
-
x = position.originX == "left" ? startX : endX;
|
|
932
|
-
}
|
|
933
|
-
let y;
|
|
934
|
-
if (position.originY == "center") {
|
|
935
|
-
y = originRect.top + originRect.height / 2;
|
|
936
|
-
} else {
|
|
937
|
-
y = position.originY == "top" ? originRect.top : originRect.bottom;
|
|
938
|
-
}
|
|
939
|
-
return {
|
|
940
|
-
x,
|
|
941
|
-
y
|
|
942
|
-
};
|
|
943
|
-
}
|
|
944
|
-
function subscribeLayoutEvent(event) {
|
|
945
|
-
window.addEventListener("scroll", event, true);
|
|
946
|
-
window.addEventListener("resize", event);
|
|
947
|
-
window.addEventListener("orientationchange", event);
|
|
948
|
-
return () => {
|
|
949
|
-
window.removeEventListener("scroll", event, true);
|
|
950
|
-
window.removeEventListener("resize", event);
|
|
951
|
-
window.removeEventListener("orientationchange", event);
|
|
952
|
-
};
|
|
953
|
-
}
|
|
954
|
-
function subscribeOverlayResize(overlay2, callback) {
|
|
955
|
-
if (overlay2 instanceof Element) {
|
|
956
|
-
const resizeObserver = new ResizeObserver(callback);
|
|
957
|
-
resizeObserver.observe(overlay2);
|
|
958
|
-
return () => resizeObserver.disconnect();
|
|
959
|
-
}
|
|
960
|
-
return () => {
|
|
961
|
-
};
|
|
962
|
-
}
|
|
963
|
-
function subscribeOriginResize(origin, callback) {
|
|
964
|
-
if (origin instanceof Element) {
|
|
965
|
-
const observer = new MutationObserver(callback);
|
|
966
|
-
observer.observe(origin, {
|
|
967
|
-
attributeFilter: ["style"]
|
|
968
|
-
});
|
|
969
|
-
return () => observer.disconnect();
|
|
970
|
-
}
|
|
971
|
-
return () => {
|
|
972
|
-
};
|
|
973
|
-
}
|
|
974
836
|
function _isSlot(s) {
|
|
975
837
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
976
838
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var Ue=Object.defineProperty;var re=Object.getOwnPropertySymbols;var qe=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable;var j=(m,t,w)=>t in m?Ue(m,t,{enumerable:!0,configurable:!0,writable:!0,value:w}):m[t]=w,D=(m,t)=>{for(var w in t||(t={}))qe.call(t,w)&&j(m,w,t[w]);if(re)for(var w of re(t))Ge.call(t,w)&&j(m,w,t[w]);return m};var S=(m,t,w)=>(j(m,typeof t!="symbol"?t+"":t,w),w);(function(m,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(m=typeof globalThis!="undefined"?globalThis:m||self,t(m.index={},m.Vue))})(this,function(m,t){"use strict";const se={modelValue:{type:String,default:""},source:{type:Array,default:null},allowEmptyValueSearch:{type:Boolean,default:!1},appendToBody:{type:Boolean,default:!1},appendToBodyDirections:{type:Object,default:()=>({originX:"left",originY:"bottom",overlayX:"left",overlayY:"top"})},disabled:{type:Boolean,default:!1},delay:{type:Number,default:300},disabledKey:{type:String,default:null},formatter:{type:Function,default:e=>e?e.label||e.toString():""},isSearching:{type:Boolean,default:!1},sceneType:{type:String,default:null},searchFn:{type:Function,default:null},tipsText:{type:String,default:"\u6700\u8FD1\u8F93\u5165"},latestSource:{type:Array,default:null},valueParser:{type:Function,default:e=>e},enableLazyLoad:{type:Boolean,default:!1},dAutoCompleteWidth:{type:Number,default:null},showAnimation:{type:Boolean,default:!0},maxHeight:{type:Number,default:300},transInputFocusEmit:{type:Function,default:null},selectValue:{type:Function,default:null},loadMore:{type:Function,default:null}},M=Symbol("DropdownPropsKey");function ie(e,n){const o=(a,c)=>{const i={item:a,index:c};return e.slots.itemTemplate?e.slots.itemTemplate(i):null},l=()=>e.slots.noResultItemTemplate?e.slots.noResultItemTemplate(n.value):null,r=()=>e.slots.searchingTemplate?e.slots.searchingTemplate(n.value):null;return{customRenderSolts:()=>{const a={};return e.slots.itemTemplate&&(a.itemTemplate=o),e.slots.noResultItemTemplate&&(a.noResultItemTemplate=l),e.slots.searchingTemplate&&(a.searchingTemplate=r),a}}}function ue(e,n,o,l,r){const s=t.ref([]),a=t.ref(!1);return{handleSearch:async(u,f)=>{if(u==""&&!n.value){s.value=[],a.value=!1;return}let y=[];u=u.toLowerCase(),f?y=o.value:l.value?y=await l.value(u):o.value.forEach(d=>{let p=r.value(d);p=p.toLowerCase(),p.startsWith(u)&&y.push(d)}),s.value=y,s.value.length==0?a.value=!0:a.value=!1},recentlyFocus:u=>{u&&(s.value=u)},searchList:s,showNoResultItemTemplate:a}}function ce(e,n,o,l,r,s,a,c,i,u){const f=t.ref(!1),y=t.ref(),d=t.ref(!1),g=((k,O)=>{let b;return(...V)=>{b&&clearTimeout(b),b=setTimeout(async()=>{d.value=!0,await k(...V),d.value=!1},O)}})(async k=>{await a(k),f.value=!0},s.value),T=k=>{const O=k.target;d.value=!1,o.value=!1,e.emit("update:modelValue",O.value),g(O.value)},C=()=>{a(l.value),i(u.value),c.value&&c.value()},h=()=>{f.value=!1,d.value=!1,o.value=!1};return{handleClose:h,toggleMenu:()=>{r.value||(f.value?h():(f.value=!0,e.slots.noResultItemTemplate&&n.value.length==0&&l.value.trim()!=""&&(o.value=!0)))},onInput:T,onFocus:C,inputRef:y,visible:f,searchStatus:d}}function de(e,n,o,l,r,s){const a=t.ref(0),c=u=>{if(n.value.length==0)return 0;const f=n.value.indexOf(u);return f==-1?0:f};return{selectedIndex:a,selectOptionClick:async u=>{const f=r.value(u);e.emit("update:modelValue",f),s(),await l(f),a.value=c(f),o.value&&o.value()}}}function fe(e,n,o){const l=t.ref(!1),r=t.ref(),s=()=>{if(!e.enableLazyLoad&&l)return;const c=r.value,i=c.scrollHeight,u=c.clientHeight+c.scrollTop;u>=i&&u>=e.maxHeight&&(e.loadMore(),l.value=!0)};n.expose({loadFinish:a});async function a(){await o(e.modelValue,e.enableLazyLoad),l.value=!1}return{showLoading:l,dropDownRef:r,loadMore:s}}function pe(e,n,o,l,r,s,a,c){var y;const i=t.ref((y=l.value)!=null?y:0),u=d=>{const p=e.value,v=p.children[d];t.nextTick(()=>{if(v.scrollIntoViewIfNeeded)v.scrollIntoViewIfNeeded(!1);else{const g=p.getBoundingClientRect(),T=v.getBoundingClientRect();(T.bottom>g.bottom||T.top<g.top)&&v.scrollIntoView(!1)}})};return{hoverIndex:i,handlekeyDown:d=>{var g;const p=d.key||d.code;if(p==="Escape"&&(n.value&&o.value.length||r.value||s.value)){c();return}const v=n.value&&o.value.length&&!r.value&&!s.value;if(p==="ArrowDown"&&v){if(i.value===o.value.length-1){i.value=0,u(i.value);return}i.value=i.value+1,u(i.value)}else if(p==="ArrowUp"&&v){if(i.value===0){i.value=o.value.length-1,u(i.value);return}i.value=i.value-1,u(i.value)}if(p==="Enter"&&v){a(o.value[i.value]),i.value=(g=l.value)!=null?g:0;return}}}}var Qe="";class P{constructor(){S(this,"top","50%");S(this,"left","50%")}}const ve={message:String,backdrop:Boolean,view:{type:Object,default:()=>new P},zIndex:Number,isFull:{type:Boolean,default:!1}};class ye{constructor(){S(this,"target");S(this,"message");S(this,"loadingTemplateRef");S(this,"backdrop",!0);S(this,"positionType","relative");S(this,"view",new P);S(this,"zIndex")}}var Ze="",me=t.defineComponent({name:"DLoading",inheritAttrs:!1,props:ve,setup(e){const n={top:e.view.top,left:e.view.left,zIndex:e.zIndex};e.message||(n.background="none");const o=t.ref(!1);return{style:n,isShow:o,open:()=>{o.value=!0},close:()=>{o.value=!1}}},render(){var a;const{isShow:e,isFull:n,backdrop:o,style:l,message:r,$slots:s}=this;return e&&t.createVNode("div",{class:["devui-loading-contanier",n?"devui-loading--full":""]},[((a=s.default)==null?void 0:a.call(s))||t.createVNode("div",{class:"devui-loading-wrapper"},[o?t.createVNode("div",{class:"devui-loading-mask"},null):null,t.createVNode("div",{style:l,class:"devui-loading-area"},[t.createVNode("div",{class:"devui-busy-default-spinner"},[t.createVNode("div",{class:"devui-loading-bar1"},null),t.createVNode("div",{class:"devui-loading-bar2"},null),t.createVNode("div",{class:"devui-loading-bar3"},null),t.createVNode("div",{class:"devui-loading-bar4"},null)]),r?t.createVNode("span",{class:"devui-loading-text"},[r]):null])])])}});const z=Symbol("dev_component_container");function ge(e,n,o=null){const l=t.h(e,D({},n),o),r=document.createElement("div");return l[z]=r,t.render(l,r),l.component}function he(e){t.render(null,e==null?void 0:e.vnode[z])}const be=t.defineComponent(me),I=new WeakSet,E=e=>{if(!e)return!0;if(Array.isArray(e))return e.length===0;if(e instanceof Set||e instanceof Map)return e.size===0;if(e instanceof Promise)return!1;if(typeof e=="object")try{return Object.keys(e).length===0}catch{return!1}return!1},_=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase(),we=e=>{switch(_(e)){case"promise":return[e];case"array":return e.some(o=>_(o)!=="promise")?(console.error(new TypeError("Binding values should all be of type Promise")),"error"):e;default:return!1}},H=e=>{I.delete(e),e.instance.proxy.close(),he(e.instance)},Y=(e,n)=>{if(n.value){const o=we(n.value);if(o==="error")return;e.instance.proxy.open(),e.appendChild(e.mask),I.add(e),o&&Promise.all(o).catch(l=>{console.error(new Error("Promise handling errors"),l)}).finally(()=>{H(e)})}else H(e)},X=e=>{e.removeAttribute("zindex"),e.removeAttribute("positiontype"),e.removeAttribute("backdrop"),e.removeAttribute("message"),e.removeAttribute("view"),e.removeAttribute("loadingtemplateref")},$=(e,n)=>{const o=D(D({},new ye),n),l=o.loadingTemplateRef,r=ge(be,D({},o),l?()=>l:null);e.style.position=o.positionType,e.options=o,e.instance=r,e.mask=r.proxy.$el},Ce={mounted:function(e,n,o){$(e,o.props),X(e),!E(n.value)&&Y(e,n)},updated:function(e,n,o){!E(n.value)&&I.has(e)||E(n.value)&&!I.has(e)||(!I.has(e)&&$(e,o.props),X(e),Y(e,n))}};var K=t.defineComponent({name:"DAutoCompleteDropdown",directives:{dLoading:Ce},setup(e,n){const o=t.inject(M),{visible:l,selectedIndex:r,selectOptionClick:s,searchList:a,searchStatus:c,dropDownRef:i,loadMore:u,showLoading:f,showNoResultItemTemplate:y,latestSource:d,modelValue:p,hoverIndex:v}=o,{disabled:g,maxHeight:T,appendToBody:C,formatter:h,disabledKey:N,isSearching:k}=o.props,O=b=>{b[N]||s(b)};return()=>t.withDirectives(t.createVNode("div",{class:["devui-dropdown-menu",C&&"devui-dropdown-menu-cdk",g&&"disabled",d.value&&"devui-dropdown-latestSource"]},[t.createVNode("ul",{ref:i,class:"devui-list-unstyled scroll-height",style:{maxHeight:`${T}px`},onScroll:u},[k&&n.slots.searchingTemplate&&c.value&&t.createVNode("li",{class:"devui-is-searching-template"},[t.createVNode("div",{class:"devui-no-data-tip"},[n.slots.searchingTemplate()])]),d.value&&!p.value&&t.createVNode("li",{class:"devui-popup-tips"},[t.createTextVNode("\u6700\u8FD1\u8F93\u5165")]),!y.value&&!c.value&&a!=null&&a.value.length>0&&a.value.map((b,V)=>t.createVNode("li",{onClick:()=>O(b),class:["devui-dropdown-item",r.value==V&&"selected",{disabled:N&&b[N]},{"devui-dropdown-bg":v.value==V}],title:h(b),key:h(b)},[n.slots.itemTemplate?n.slots.itemTemplate(b,V):h(b)])),!c.value&&a.value.length==0&&n.slots.noResultItemTemplate&&y.value&&t.createVNode("li",{class:"devui-no-result-template"},[t.createVNode("div",{class:"devui-no-data-tip"},[n.slots.noResultItemTemplate()])])])]),[[t.resolveDirective("dLoading"),f.value],[t.vShow,l.value&&a.value.length>0||n.slots.noResultItemTemplate&&y.value||k&&n.slots.searchingTemplate&&c.value]])}});const ke=typeof window!="undefined";function W(e,n,o){document.addEventListener?e&&n&&o&&e.addEventListener(n,o,!1):e&&n&&o&&e.attachEvent("on"+n,o)}const B=Symbol("@@clickoutside"),L=new Map;let U,A=0,q=!0;function G(e,n,o){return ke&&q&&(q=!1,W(document,"mousedown",l=>{U=l}),W(document,"mouseup",l=>{for(const[r,s]of L)s[B].documentHandler(l,U)})),function(l,r){!o||!n.instance||!l.target||!r.target||e.contains(l.target)||e.contains(r.target)||e===l.target||e[B].bindingFn&&e[B].bindingFn()}}const Te={beforeMount:function(e,n,o){A++,L.set(A,e),e[B]={nid:A,documentHandler:G(e,n,o),bindingFn:n.value}},updated:function(e,n,o){e[B].documentHandler=G(e,n,o),e[B].bindingFn=n.value},unmounted:function(e){L.delete(e[B].nid),delete e[B]}};var et="";function Ve(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}const Se=t.defineComponent({setup(e,n){return()=>{let o;return t.createVNode(t.Teleport,{to:"#d-overlay-anchor"},{default:()=>[t.createVNode(t.Transition,{name:"devui-overlay-fade"},Ve(o=t.renderSlot(n.slots,"default"))?o:{default:()=>[o]})]})}}}),Be={visible:{type:Boolean},backgroundBlock:{type:Boolean,default:!1},backgroundClass:{type:String,default:""},backgroundStyle:{type:[String,Object]},onBackdropClick:{type:Function},backdropClose:{type:Boolean,default:!0},hasBackdrop:{type:Boolean,default:!0}},Ne=["update:visible","backdropClick"],Oe=D({origin:{type:Object,require:!0},position:{type:Object,default:()=>({originX:"left",originY:"top",overlayX:"left",overlayY:"top"})}},Be);function Re(e,n){const o=t.computed(()=>["devui-overlay-background",e.backgroundClass,e.hasBackdrop?"devui-overlay-background__color":"devui-overlay-background__disabled"]),l=t.computed(()=>"devui-overlay"),r=a=>{var c;a.preventDefault(),(c=e.onBackdropClick)==null||c.call(e),e.backdropClose&&n.emit("update:visible",!1)},s=a=>a.cancelBubble=!0;return t.onMounted(()=>{const a=document.body,c=a.style.overflow,i=a.style.position;t.watch([()=>e.visible,()=>e.backgroundBlock],([u,f])=>{if(f){const y=a.getBoundingClientRect().y;u?(a.style.overflowY="scroll",a.style.position=u?"fixed":"",a.style.top=`${y}px`):(a.style.overflowY=c,a.style.position=i,a.style.top="",window.scrollTo(0,-y))}}),t.onUnmounted(()=>{document.body.style.overflow=c})}),{backgroundClass:o,overlayClass:l,handleBackdropClick:r,handleOverlayBubbleCancel:s}}function De(e){return!!(e==null?void 0:e.$el)}function J(e){return e instanceof Element?e:e&&typeof e=="object"&&e.$el instanceof Element?e.$el:null}const Ie=t.defineComponent({name:"DFlexibleOverlay",props:Oe,emits:Ne,setup(e,n){const o=t.ref(null),l=t.reactive({position:"absolute"});t.onMounted(async()=>{const i=(d,p,v)=>{const g=Ee(d,p,v);l.left=`${g.x}px`,l.top=`${g.y}px`},u=t.computed(()=>{const d=o.value,p=Fe(e.origin);if(!(!d||!p))return{origin:p,overlay:d}}),f=t.toRef(e,"visible"),y=t.toRef(e,"position");t.watch([u,f,y],async([d,p,v],g,T)=>{if(!p||!d)return;const{origin:C,overlay:h}=d;i(v,h.getBoundingClientRect(),C);const N=[je(()=>i(v,h.getBoundingClientRect(),C)),Me(h,k=>i(v,k[0].contentRect,C)),Pe(C,()=>i(v,h.getBoundingClientRect(),C))];T(()=>{N.forEach(k=>k())})})});const{backgroundClass:r,overlayClass:s,handleBackdropClick:a,handleOverlayBubbleCancel:c}=Re(e,n);return()=>t.createVNode(Se,null,{default:()=>[t.withDirectives(t.createVNode("div",{style:e.backgroundStyle,class:r.value,onClick:a},[t.createVNode("div",{ref:o,class:s.value,style:l,onClick:c},[t.renderSlot(n.slots,"default")])]),[[t.vShow,e.visible]])]})}});function Fe(e){return e instanceof Element?e:t.isRef(e)?J(e.value):De(e)?J(e):e}function Ee(e,n,o){const l=Le(o),r=xe(l,e);return Ae(r,n,e)}function Le(e){if(e instanceof Element)return e.getBoundingClientRect();const n=e.width||0,o=e.height||0;return{top:e.y,bottom:e.y+o,left:e.x,right:e.x+n,height:o,width:n}}function Ae(e,n,o){let l;const{width:r,height:s}=n;o.overlayX=="center"?l=e.x-r/2:l=o.overlayX=="left"?e.x:e.x-r;let a;return o.overlayY=="center"?a=e.y-s/2:a=o.overlayY=="top"?e.y:e.y-s,{x:l,y:a}}function xe(e,n){let o;if(n.originX=="center")o=e.left+e.width/2;else{const r=e.left,s=e.right;o=n.originX=="left"?r:s}let l;return n.originY=="center"?l=e.top+e.height/2:l=n.originY=="top"?e.top:e.bottom,{x:o,y:l}}function je(e){return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),window.addEventListener("orientationchange",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e)}}function Me(e,n){if(e instanceof Element){const o=new ResizeObserver(n);return o.observe(e),()=>o.disconnect()}return()=>{}}function Pe(e,n){if(e instanceof Element){const o=new MutationObserver(n);return o.observe(e,{attributeFilter:["style"]}),()=>o.disconnect()}return()=>{}}function Q(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}var F=t.defineComponent({name:"DAutoComplete",directives:{ClickOutside:Te},props:se,emits:["update:modelValue"],setup(e,n){const{disabled:o,modelValue:l,appendToBody:r,dAutoCompleteWidth:s,delay:a,allowEmptyValueSearch:c,formatter:i,transInputFocusEmit:u,selectValue:f,source:y,searchFn:d,appendToBodyDirections:p,latestSource:v,showAnimation:g}=t.toRefs(e),{handleSearch:T,searchList:C,showNoResultItemTemplate:h,recentlyFocus:N}=ue(n,c,y,d,i),{onInput:k,onFocus:O,inputRef:b,visible:V,searchStatus:Z,handleClose:x,toggleMenu:_e}=ce(n,C,h,l,o,a,T,u,N,v),{selectedIndex:ee,selectOptionClick:te}=de(n,C,f,T,i,x),{showLoading:He,dropDownRef:oe,loadMore:Ye}=fe(e,n,T),{customRenderSolts:ne}=ie(n,l),{hoverIndex:Xe,handlekeyDown:$e}=pe(oe,V,C,ee,Z,h,te,x);t.provide(M,{props:e,visible:V,term:"",searchList:C,selectedIndex:ee,searchStatus:Z,selectOptionClick:te,dropDownRef:oe,showLoading:He,loadMore:Ye,latestSource:v,modelValue:l,showNoResultItemTemplate:h,hoverIndex:Xe});const le=t.ref(),ae=t.reactive({appendToBodyDirections:{}});ae.appendToBodyDirections=p;const Ke=()=>{if(r.value){let R;return t.createVNode(Ie,{hasBackdrop:!1,origin:le,position:ae.appendToBodyDirections,visible:V.value,"onUpdate:visible":We=>V.value=We},{default:()=>[t.createVNode("div",{class:"devui-dropdown devui-auto-complete-menu",style:{width:s.value>0&&s.value+"px"}},[t.createVNode(K,null,Q(R=ne())?R:{default:()=>[R]})])]})}else{let R;return t.createVNode("div",{class:"devui-dropdown",style:{width:s.value>0&&s.value+"px"}},[t.createVNode(t.Transition,{name:g?"fade":""},{default:()=>[t.createVNode(K,null,Q(R=ne())?R:{default:()=>[R]})]})])}};return()=>t.withDirectives(t.createVNode("div",{class:["devui-auto-complete","devui-form-group","devui-has-feedback",V.value&&"devui-select-open"],ref:le,style:{width:s.value>0&&s.value+"px"}},[t.createVNode("input",{disabled:o.value,type:"text",onClick:_e,class:["devui-form-control","devui-dropdown-origin","devui-dropdown-origin-open",o.value&&"disabled"],placeholder:"Search",onInput:k,onFocus:O,value:l.value,ref:b,onKeydown:$e},null),Ke()]),[[t.resolveDirective("click-outside"),x]])}});F.install=function(e){e.component(F.name,F)};var ze={title:"AutoComplete \u81EA\u52A8\u8865\u5168",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(e){e.use(F)}};m.AutoComplete=F,m.default=ze,Object.defineProperty(m,"__esModule",{value:!0}),m[Symbol.toStringTag]="Module"});
|
|
1
|
+
var Be=Object.defineProperty;var re=Object.getOwnPropertySymbols;var Oe=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable;var O=(p,t,m)=>t in p?Be(p,t,{enumerable:!0,configurable:!0,writable:!0,value:m}):p[t]=m,E=(p,t)=>{for(var m in t||(t={}))Oe.call(t,m)&&O(p,m,t[m]);if(re)for(var m of re(t))je.call(t,m)&&O(p,m,t[m]);return p};var C=(p,t,m)=>(O(p,typeof t!="symbol"?t+"":t,m),m);(function(p,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue"),require("@floating-ui/dom")):typeof define=="function"&&define.amd?define(["exports","vue","@floating-ui/dom"],t):(p=typeof globalThis!="undefined"?globalThis:p||self,t(p.index={},p.Vue,p.dom))})(this,function(p,t,m){"use strict";const se={modelValue:{type:String,default:""},source:{type:Array,default:null},allowEmptyValueSearch:{type:Boolean,default:!1},appendToBody:{type:Boolean,default:!1},appendToBodyDirections:{type:Object,default:()=>({originX:"left",originY:"bottom",overlayX:"left",overlayY:"top"})},disabled:{type:Boolean,default:!1},delay:{type:Number,default:300},disabledKey:{type:String,default:null},formatter:{type:Function,default:e=>e?e.label||e.toString():""},isSearching:{type:Boolean,default:!1},sceneType:{type:String,default:null},searchFn:{type:Function,default:null},tipsText:{type:String,default:"\u6700\u8FD1\u8F93\u5165"},latestSource:{type:Array,default:null},valueParser:{type:Function,default:e=>e},enableLazyLoad:{type:Boolean,default:!1},dAutoCompleteWidth:{type:Number,default:null},showAnimation:{type:Boolean,default:!0},maxHeight:{type:Number,default:300},transInputFocusEmit:{type:Function,default:null},selectValue:{type:Function,default:null},loadMore:{type:Function,default:null}},j=Symbol("DropdownPropsKey");function ie(e,n){const o=(r,u)=>{const i={item:r,index:u};return e.slots.itemTemplate?e.slots.itemTemplate(i):null},l=()=>e.slots.noResultItemTemplate?e.slots.noResultItemTemplate(n.value):null,s=()=>e.slots.searchingTemplate?e.slots.searchingTemplate(n.value):null;return{customRenderSolts:()=>{const r={};return e.slots.itemTemplate&&(r.itemTemplate=o),e.slots.noResultItemTemplate&&(r.noResultItemTemplate=l),e.slots.searchingTemplate&&(r.searchingTemplate=s),r}}}function ue(e,n,o,l,s){const a=t.ref([]),r=t.ref(!1);return{handleSearch:async(d,c)=>{if(d==""&&!n.value){a.value=[],r.value=!1;return}let v=[];d=d.toLowerCase(),c?v=o.value:l.value?v=await l.value(d):o.value.forEach(f=>{let y=s.value(f);y=y.toLowerCase(),y.startsWith(d)&&v.push(f)}),a.value=v,a.value.length==0?r.value=!0:r.value=!1},recentlyFocus:d=>{d&&(a.value=d)},searchList:a,showNoResultItemTemplate:r}}function de(e,n,o,l,s,a,r,u,i,d){const c=t.ref(!1),v=t.ref(),f=t.ref(!1),h=((S,D)=>{let g;return(...b)=>{g&&clearTimeout(g),g=setTimeout(async()=>{f.value=!0,await S(...b),f.value=!1},D)}})(async S=>{await r(S),c.value=!0},a.value),T=S=>{const D=S.target;f.value=!1,o.value=!1,e.emit("update:modelValue",D.value),h(D.value)},A=()=>{r(l.value),i(d.value),u.value&&u.value()},V=()=>{c.value=!1,f.value=!1,o.value=!1};return{handleClose:V,toggleMenu:()=>{s.value||(c.value?V():(c.value=!0,e.slots.noResultItemTemplate&&n.value.length==0&&l.value.trim()!=""&&(o.value=!0)))},onInput:T,onFocus:A,inputRef:v,visible:c,searchStatus:f}}function ce(e,n,o,l,s,a){const r=t.ref(0),u=d=>{if(n.value.length==0)return 0;const c=n.value.indexOf(d);return c==-1?0:c};return{selectedIndex:r,selectOptionClick:async d=>{const c=s.value(d);e.emit("update:modelValue",c),a(),await l(c),r.value=u(c),o.value&&o.value()}}}function fe(e,n,o){const l=t.ref(!1),s=t.ref(),a=()=>{if(!e.enableLazyLoad&&l)return;const u=s.value,i=u.scrollHeight,d=u.clientHeight+u.scrollTop;d>=i&&d>=e.maxHeight&&(e.loadMore(),l.value=!0)};n.expose({loadFinish:r});async function r(){await o(e.modelValue,e.enableLazyLoad),l.value=!1}return{showLoading:l,dropDownRef:s,loadMore:a}}function pe(e,n,o,l,s,a,r,u){var v;const i=t.ref((v=l.value)!=null?v:0),d=f=>{const y=e.value,w=y.children[f];t.nextTick(()=>{if(w.scrollIntoViewIfNeeded)w.scrollIntoViewIfNeeded(!1);else{const h=y.getBoundingClientRect(),T=w.getBoundingClientRect();(T.bottom>h.bottom||T.top<h.top)&&w.scrollIntoView(!1)}})};return{hoverIndex:i,handlekeyDown:f=>{var h;const y=f.key||f.code;if(y==="Escape"&&(n.value&&o.value.length||s.value||a.value)){u();return}const w=n.value&&o.value.length&&!s.value&&!a.value;if(y==="ArrowDown"&&w){if(i.value===o.value.length-1){i.value=0,d(i.value);return}i.value=i.value+1,d(i.value)}else if(y==="ArrowUp"&&w){if(i.value===0){i.value=o.value.length-1,d(i.value);return}i.value=i.value-1,d(i.value)}if(y==="Enter"&&w){r(o.value[i.value]),i.value=(h=l.value)!=null?h:0;return}}}}var ze="";class M{constructor(){C(this,"top","50%");C(this,"left","50%")}}const ve={message:String,backdrop:Boolean,view:{type:Object,default:()=>new M},zIndex:Number,isFull:{type:Boolean,default:!1}};class me{constructor(){C(this,"target");C(this,"message");C(this,"loadingTemplateRef");C(this,"backdrop",!0);C(this,"positionType","relative");C(this,"view",new M);C(this,"zIndex")}}var _e="",ye=t.defineComponent({name:"DLoading",inheritAttrs:!1,props:ve,setup(e){const n={top:e.view.top,left:e.view.left,zIndex:e.zIndex};e.message||(n.background="none");const o=t.ref(!1);return{style:n,isShow:o,open:()=>{o.value=!0},close:()=>{o.value=!1}}},render(){var r;const{isShow:e,isFull:n,backdrop:o,style:l,message:s,$slots:a}=this;return e&&t.createVNode("div",{class:["devui-loading-contanier",n?"devui-loading--full":""]},[((r=a.default)==null?void 0:r.call(a))||t.createVNode("div",{class:"devui-loading-wrapper"},[o?t.createVNode("div",{class:"devui-loading-mask"},null):null,t.createVNode("div",{style:l,class:"devui-loading-area"},[t.createVNode("div",{class:"devui-busy-default-spinner"},[t.createVNode("div",{class:"devui-loading-bar1"},null),t.createVNode("div",{class:"devui-loading-bar2"},null),t.createVNode("div",{class:"devui-loading-bar3"},null),t.createVNode("div",{class:"devui-loading-bar4"},null)]),s?t.createVNode("span",{class:"devui-loading-text"},[s]):null])])])}});const H=Symbol("dev_component_container");function ge(e,n,o=null){const l=t.h(e,E({},n),o),s=document.createElement("div");return l[H]=s,t.render(l,s),l.component}function we(e){t.render(null,e==null?void 0:e.vnode[H])}const he=t.defineComponent(ye),F=new WeakSet,R=e=>{if(!e)return!0;if(Array.isArray(e))return e.length===0;if(e instanceof Set||e instanceof Map)return e.size===0;if(e instanceof Promise)return!1;if(typeof e=="object")try{return Object.keys(e).length===0}catch{return!1}return!1},z=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase(),be=e=>{switch(z(e)){case"promise":return[e];case"array":return e.some(o=>z(o)!=="promise")?(console.error(new TypeError("Binding values should all be of type Promise")),"error"):e;default:return!1}},_=e=>{F.delete(e),e.instance.proxy.close(),we(e.instance)},K=(e,n)=>{if(n.value){const o=be(n.value);if(o==="error")return;e.instance.proxy.open(),e.appendChild(e.mask),F.add(e),o&&Promise.all(o).catch(l=>{console.error(new Error("Promise handling errors"),l)}).finally(()=>{_(e)})}else _(e)},$=e=>{e.removeAttribute("zindex"),e.removeAttribute("positiontype"),e.removeAttribute("backdrop"),e.removeAttribute("message"),e.removeAttribute("view"),e.removeAttribute("loadingtemplateref")},W=(e,n)=>{const o=E(E({},new me),n),l=o.loadingTemplateRef,s=ge(he,E({},o),l?()=>l:null);e.style.position=o.positionType,e.options=o,e.instance=s,e.mask=s.proxy.$el},Te={mounted:function(e,n,o){W(e,o.props),$(e),!R(n.value)&&K(e,n)},updated:function(e,n,o){!R(n.value)&&F.has(e)||R(n.value)&&!F.has(e)||(!F.has(e)&&W(e,o.props),$(e),K(e,n))}};var Y=t.defineComponent({name:"DAutoCompleteDropdown",directives:{dLoading:Te},setup(e,n){const o=t.inject(j),{visible:l,selectedIndex:s,selectOptionClick:a,searchList:r,searchStatus:u,dropDownRef:i,loadMore:d,showLoading:c,showNoResultItemTemplate:v,latestSource:f,modelValue:y,hoverIndex:w}=o,{disabled:h,maxHeight:T,appendToBody:A,formatter:V,disabledKey:k,isSearching:S}=o.props,D=g=>{g[k]||a(g)};return()=>t.withDirectives(t.createVNode("div",{class:["devui-dropdown-menu",A&&"devui-dropdown-menu-cdk",h&&"disabled",f.value&&"devui-dropdown-latestSource"]},[t.createVNode("ul",{ref:i,class:"devui-list-unstyled scroll-height",style:{maxHeight:`${T}px`},onScroll:d},[S&&n.slots.searchingTemplate&&u.value&&t.createVNode("li",{class:"devui-is-searching-template"},[t.createVNode("div",{class:"devui-no-data-tip"},[n.slots.searchingTemplate()])]),f.value&&!y.value&&t.createVNode("li",{class:"devui-popup-tips"},[t.createTextVNode("\u6700\u8FD1\u8F93\u5165")]),!v.value&&!u.value&&r!=null&&r.value.length>0&&r.value.map((g,b)=>t.createVNode("li",{onClick:()=>D(g),class:["devui-dropdown-item",s.value==b&&"selected",{disabled:k&&g[k]},{"devui-dropdown-bg":w.value==b}],title:V(g),key:V(g)},[n.slots.itemTemplate?n.slots.itemTemplate(g,b):V(g)])),!u.value&&r.value.length==0&&n.slots.noResultItemTemplate&&v.value&&t.createVNode("li",{class:"devui-no-result-template"},[t.createVNode("div",{class:"devui-no-data-tip"},[n.slots.noResultItemTemplate()])])])]),[[t.resolveDirective("dLoading"),c.value],[t.vShow,l.value&&r.value.length>0||n.slots.noResultItemTemplate&&v.value||S&&n.slots.searchingTemplate&&u.value]])}});const Ve=typeof window!="undefined";function q(e,n,o){document.addEventListener?e&&n&&o&&e.addEventListener(n,o,!1):e&&n&&o&&e.attachEvent("on"+n,o)}const N=Symbol("@@clickoutside"),x=new Map;let U,P=0,X=!0;function G(e,n,o){return Ve&&X&&(X=!1,q(document,"mousedown",l=>{U=l}),q(document,"mouseup",l=>{for(const[s,a]of x)a[N].documentHandler(l,U)})),function(l,s){!o||!n.instance||!l.target||!s.target||e.contains(l.target)||e.contains(s.target)||e===l.target||e[N].bindingFn&&e[N].bindingFn()}}const Se={beforeMount:function(e,n,o){P++,x.set(P,e),e[N]={nid:P,documentHandler:G(e,n,o),bindingFn:n.value}},updated:function(e,n,o){e[N].documentHandler=G(e,n,o),e[N].bindingFn=n.value},unmounted:function(e){x.delete(e[N].nid),delete e[N]}},Ce={modelValue:{type:Boolean,default:!1},origin:{type:Object,require:!0},position:{type:Array,default:["bottom"]},offset:{type:[Number,Object],default:8},align:{type:String,default:null},showArrow:{type:Boolean,default:!1},isArrowCenter:{type:Boolean,default:!0}};function J(e){const n=/(auto|scroll|hidden)/;for(let o=e;o=o.parentElement;o.parentElement!==document.body){const l=window.getComputedStyle(o);if(n.test(l.overflow+l.overflowX+l.overflowY))return o}return window}function Ne(e,n,o,l){let{x:s,y:a}=n;if(!e){const{width:r,height:u}=l;s&&o.includes("start")&&(s=12),s&&o.includes("end")&&(s=Math.round(r-24)),a&&o.includes("start")&&(a=10),a&&o.includes("end")&&(a=u-14)}return{x:s,y:a}}function Ae(e,n){const o=t.ref(),l=t.ref(),s=(r,u,i,d)=>{const{x:c,y:v}=Ne(e.isArrowCenter,i,u,d.getBoundingClientRect()),f={top:"bottom",right:"left",bottom:"top",left:"right"}[u.split("-")[0]];Object.assign(r.style,{left:c?`${c}px`:"",top:v?`${v}px`:"",right:"",bottom:"",[f]:"-4px"})},a=async()=>{const r=e.origin,u=t.unref(o.value),i=t.unref(l.value),d=[m.shift(),m.offset(e.offset),m.autoPlacement({alignment:e.align,allowedPlacements:e.position})];e.showArrow&&d.push(m.arrow({element:i}));const{x:c,y:v,placement:f,middlewareData:y}=await m.computePosition(r,u,{strategy:"fixed",middleware:d});n("positionChange",f),Object.assign(u.style,{top:`${v}px`,left:`${c}px`}),e.showArrow&&s(i,f,y.arrow,u)};return t.watch(()=>e.modelValue,()=>{const r=J(e.origin);e.modelValue&&e.origin?(t.nextTick(a),r.addEventListener("scroll",a),r!==window&&window.addEventListener("scroll",a),window.addEventListener("resize",a)):(r.removeEventListener("scroll",a),r!==window&&window.removeEventListener("scroll",a),window.removeEventListener("resize",a))}),t.onUnmounted(()=>{const r=J(e.origin);r.removeEventListener("scroll",a),r!==window&&window.removeEventListener("scroll",a),window.removeEventListener("resize",a)}),{arrowRef:l,overlayRef:o,updatePosition:a}}var Ke="";const De=t.defineComponent({name:"DFlexibleOverlay",inheritAttrs:!1,props:Ce,emits:["update:modelValue","positionChange"],setup(e,{slots:n,attrs:o,emit:l,expose:s}){const{arrowRef:a,overlayRef:r,updatePosition:u}=Ae(e,l);return s({updatePosition:u}),()=>{var i;return e.modelValue&&t.createVNode("div",t.mergeProps({ref:r,class:"devui-flexible-overlay"},o),[(i=n.default)==null?void 0:i.call(n),e.showArrow&&t.createVNode("div",{ref:a,class:"devui-flexible-overlay-arrow"},null)])}}});function Q(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}var L=t.defineComponent({name:"DAutoComplete",directives:{ClickOutside:Se},props:se,emits:["update:modelValue"],setup(e,n){const{disabled:o,modelValue:l,appendToBody:s,dAutoCompleteWidth:a,delay:r,allowEmptyValueSearch:u,formatter:i,transInputFocusEmit:d,selectValue:c,source:v,searchFn:f,appendToBodyDirections:y,latestSource:w,showAnimation:h}=t.toRefs(e),{handleSearch:T,searchList:A,showNoResultItemTemplate:V,recentlyFocus:k}=ue(n,u,v,f,i),{onInput:S,onFocus:D,inputRef:g,visible:b,searchStatus:Z,handleClose:B,toggleMenu:ke}=de(n,A,V,l,o,r,T,d,k,w),{selectedIndex:ee,selectOptionClick:te}=ce(n,A,c,T,i,B),{showLoading:Fe,dropDownRef:oe,loadMore:Le}=fe(e,n,T),{customRenderSolts:ne}=ie(n,l),{hoverIndex:Ee,handlekeyDown:Re}=pe(oe,b,A,ee,Z,V,te,B);t.provide(j,{props:e,visible:b,term:"",searchList:A,selectedIndex:ee,searchStatus:Z,selectOptionClick:te,dropDownRef:oe,showLoading:Fe,loadMore:Le,latestSource:w,modelValue:l,showNoResultItemTemplate:V,hoverIndex:Ee});const le=t.ref(),ae=t.reactive({appendToBodyDirections:{}});ae.appendToBodyDirections=y;const xe=()=>{if(s.value){let I;return t.createVNode(De,{hasBackdrop:!1,origin:le,position:ae.appendToBodyDirections,visible:b.value,"onUpdate:visible":Pe=>b.value=Pe},{default:()=>[t.createVNode("div",{class:"devui-dropdown devui-auto-complete-menu",style:{width:a.value>0&&a.value+"px"}},[t.createVNode(Y,null,Q(I=ne())?I:{default:()=>[I]})])]})}else{let I;return t.createVNode("div",{class:"devui-dropdown",style:{width:a.value>0&&a.value+"px"}},[t.createVNode(t.Transition,{name:h?"fade":""},{default:()=>[t.createVNode(Y,null,Q(I=ne())?I:{default:()=>[I]})]})])}};return()=>t.withDirectives(t.createVNode("div",{class:["devui-auto-complete","devui-form-group","devui-has-feedback",b.value&&"devui-select-open"],ref:le,style:{width:a.value>0&&a.value+"px"}},[t.createVNode("input",{disabled:o.value,type:"text",onClick:ke,class:["devui-form-control","devui-dropdown-origin","devui-dropdown-origin-open",o.value&&"disabled"],placeholder:"Search",onInput:S,onFocus:D,value:l.value,ref:g,onKeydown:Re},null),xe()]),[[t.resolveDirective("click-outside"),B]])}});L.install=function(e){e.component(L.name,L)};var Ie={title:"AutoComplete \u81EA\u52A8\u8865\u5168",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(e){e.use(L)}};p.AutoComplete=L,p.default=Ie,Object.defineProperty(p,"__esModule",{value:!0}),p[Symbol.toStringTag]="Module"});
|
package/auto-complete/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.devui-auto-complete .devui-dropdown-menu,.devui-auto-complete-menu .devui-dropdown-menu{left:0!important;top:0!important}.devui-auto-complete .active{background:var(--devui-list-item-hover-bg, #f2f5fc)}.devui-auto-complete .devui-dropdown-menu{width:100%;display:block}.devui-auto-complete .devui-dropdown-menu-cdk{position:static}.devui-auto-complete .devui-dropdown-item{cursor:pointer;display:block;width:100%;padding:8px 12px;clear:both;border:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:14px}.devui-auto-complete .devui-dropdown-menu .devui-dropdown-item:not(.disabled).selected{color:var(--devui-list-item-active-text, #ffffff);background-color:var(--devui-list-item-active-bg, #5e7ce0)}.devui-auto-complete .devui-no-result-template,.devui-auto-complete .devui-is-searching-template{display:block;width:100%;padding:8px 12px;clear:both;border:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:not-allowed;background-color:var(--devui-disabled-bg, #f5f5f6);color:var(--devui-disabled-text, #adb0b8);line-height:14px}.devui-auto-complete .devui-no-result-template:hover,.devui-auto-complete .devui-no-result-template:active,.devui-auto-complete .devui-no-result-template:hover:active,.devui-auto-complete .devui-is-searching-template:hover,.devui-auto-complete .devui-is-searching-template:active,.devui-auto-complete .devui-is-searching-template:hover:active{background-color:var(--devui-unavailable, #f5f5f6)}.devui-auto-complete .devui-dropdown-item.disabled,.devui-auto-complete .devui-dropdown-item.disabled:hover{cursor:not-allowed;color:var(--devui-disabled-text, #adb0b8)}.devui-auto-complete ul.devui-list-unstyled{margin:0;overflow-y:auto}.devui-auto-complete .devui-dropdown-bg{background:var(--devui-list-item-hover-bg, #f2f5fc);color:var(--devui-list-item-hover-text, #526ecc)}.devui-auto-complete .devui-popup-tips{color:var(--devui-text-weak, #575d6c);padding:4px 12px}.devui-auto-complete .devui-dropdown-latestSource ul{line-height:initial!important}@keyframes devui-busy-spinner-anim{0%{transform:rotate(0) scale(1)}50%{transform:rotate(135deg) scale(1.5)}to{transform:rotate(270deg) scale(1)}}.devui-loading-mask{position:absolute;left:0;right:0;bottom:0;top:0;background-color:var(--devui-line, #adb0b8);opacity:.3}.devui-loading-wrapper{text-align:center}.devui-loading--full{position:fixed;left:0;right:0;bottom:0;top:0;z-index:9999}.devui-loading--hidden{overflow:hidden}.devui-loading-text{margin-left:10px}.devui-loading-area{position:absolute;transform:translate(-50%,-50%);padding:12px 14px;background:var(--devui-base-bg, #ffffff);border-radius:var(--devui-border-radius-card, 6px)}.devui-busy-default-spinner{position:relative;display:inline-block;width:15px;height:15px;animation:devui-busy-spinner-anim 1s linear infinite}.devui-busy-default-spinner div{position:absolute;left:44.5%;top:37%;width:6px;height:6px;border-radius:50%}.devui-busy-default-spinner .devui-loading-bar1{top:0;left:0;background:#5e7ce0;background:var(--devui-brand, #5e7ce0)}.devui-busy-default-spinner .devui-loading-bar2{top:0;left:9px;background:#859bff;background:var(--devui-brand-foil, #859bff)}.devui-busy-default-spinner .devui-loading-bar3{top:9px;left:0;background:#859bff;background:var(--devui-brand-foil, #859bff)}.devui-busy-default-spinner .devui-loading-bar4{top:9px;left:9px;background:#5e7ce0;background:var(--devui-brand, #5e7ce0)}.devui-overlay
|
|
1
|
+
@charset "UTF-8";.devui-auto-complete .devui-dropdown-menu,.devui-auto-complete-menu .devui-dropdown-menu{left:0!important;top:0!important}.devui-auto-complete .active{background:var(--devui-list-item-hover-bg, #f2f5fc)}.devui-auto-complete .devui-dropdown-menu{width:100%;display:block}.devui-auto-complete .devui-dropdown-menu-cdk{position:static}.devui-auto-complete .devui-dropdown-item{cursor:pointer;display:block;width:100%;padding:8px 12px;clear:both;border:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:14px}.devui-auto-complete .devui-dropdown-menu .devui-dropdown-item:not(.disabled).selected{color:var(--devui-list-item-active-text, #ffffff);background-color:var(--devui-list-item-active-bg, #5e7ce0)}.devui-auto-complete .devui-no-result-template,.devui-auto-complete .devui-is-searching-template{display:block;width:100%;padding:8px 12px;clear:both;border:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:not-allowed;background-color:var(--devui-disabled-bg, #f5f5f6);color:var(--devui-disabled-text, #adb0b8);line-height:14px}.devui-auto-complete .devui-no-result-template:hover,.devui-auto-complete .devui-no-result-template:active,.devui-auto-complete .devui-no-result-template:hover:active,.devui-auto-complete .devui-is-searching-template:hover,.devui-auto-complete .devui-is-searching-template:active,.devui-auto-complete .devui-is-searching-template:hover:active{background-color:var(--devui-unavailable, #f5f5f6)}.devui-auto-complete .devui-dropdown-item.disabled,.devui-auto-complete .devui-dropdown-item.disabled:hover{cursor:not-allowed;color:var(--devui-disabled-text, #adb0b8)}.devui-auto-complete ul.devui-list-unstyled{margin:0;overflow-y:auto}.devui-auto-complete .devui-dropdown-bg{background:var(--devui-list-item-hover-bg, #f2f5fc);color:var(--devui-list-item-hover-text, #526ecc)}.devui-auto-complete .devui-popup-tips{color:var(--devui-text-weak, #575d6c);padding:4px 12px}.devui-auto-complete .devui-dropdown-latestSource ul{line-height:initial!important}@keyframes devui-busy-spinner-anim{0%{transform:rotate(0) scale(1)}50%{transform:rotate(135deg) scale(1.5)}to{transform:rotate(270deg) scale(1)}}.devui-loading-mask{position:absolute;left:0;right:0;bottom:0;top:0;background-color:var(--devui-line, #adb0b8);opacity:.3}.devui-loading-wrapper{text-align:center}.devui-loading--full{position:fixed;left:0;right:0;bottom:0;top:0;z-index:9999}.devui-loading--hidden{overflow:hidden}.devui-loading-text{margin-left:10px}.devui-loading-area{position:absolute;transform:translate(-50%,-50%);padding:12px 14px;background:var(--devui-base-bg, #ffffff);border-radius:var(--devui-border-radius-card, 6px)}.devui-busy-default-spinner{position:relative;display:inline-block;width:15px;height:15px;animation:devui-busy-spinner-anim 1s linear infinite}.devui-busy-default-spinner div{position:absolute;left:44.5%;top:37%;width:6px;height:6px;border-radius:50%}.devui-busy-default-spinner .devui-loading-bar1{top:0;left:0;background:#5e7ce0;background:var(--devui-brand, #5e7ce0)}.devui-busy-default-spinner .devui-loading-bar2{top:0;left:9px;background:#859bff;background:var(--devui-brand-foil, #859bff)}.devui-busy-default-spinner .devui-loading-bar3{top:9px;left:0;background:#859bff;background:var(--devui-brand-foil, #859bff)}.devui-busy-default-spinner .devui-loading-bar4{top:9px;left:9px;background:#5e7ce0;background:var(--devui-brand, #5e7ce0)}.devui-flexible-overlay{position:fixed;border-radius:var(--devui-border-radius, 2px);background-color:var(--devui-connected-overlay-bg, #ffffff);box-shadow:var(--devui-shadow-connected-overlay, 0 2px 8px 0) var(--devui-shadow, rgba(0, 0, 0, .2));z-index:1000}.devui-flexible-overlay-arrow{position:absolute;width:8px;height:8px;transform:rotate(45deg);background-color:inherit}
|
package/back-top/index.es.js
CHANGED
|
@@ -47,8 +47,9 @@ function useTarget(props, backTopRef) {
|
|
|
47
47
|
const target = props.target;
|
|
48
48
|
const getTargetEl = () => {
|
|
49
49
|
const targetEl = document.querySelector(target);
|
|
50
|
-
if (!targetEl)
|
|
50
|
+
if (!targetEl) {
|
|
51
51
|
throw new Error(`props ${target} is not existed`);
|
|
52
|
+
}
|
|
52
53
|
targetEl.parentElement.style.position = "relative";
|
|
53
54
|
backTopRef.value.style.position = "absolute";
|
|
54
55
|
return targetEl;
|
|
@@ -71,8 +72,9 @@ function useVisibility(props, backTopRef) {
|
|
|
71
72
|
return isVisible;
|
|
72
73
|
}
|
|
73
74
|
function useEventListener(target, event, cb) {
|
|
74
|
-
if (target)
|
|
75
|
+
if (target) {
|
|
75
76
|
target.addEventListener(event, cb);
|
|
77
|
+
}
|
|
76
78
|
}
|
|
77
79
|
function useThrottle(fn, delay) {
|
|
78
80
|
let last = null;
|
package/badge/index.es.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { defineComponent, computed, createVNode } from "vue";
|
|
2
|
-
|
|
3
|
-
const badgeStatusType = ["danger", "warning", "waiting", "success", "info"];
|
|
2
|
+
const badgeStatusType = ["danger", "warning", "waiting", "success", "info", "common"];
|
|
4
3
|
const badgePositionType = ["top-left", "top-right", "bottom-left", "bottom-right"];
|
|
5
4
|
const badgeProps = {
|
|
6
5
|
count: {
|
|
@@ -18,12 +17,12 @@ const badgeProps = {
|
|
|
18
17
|
type: String,
|
|
19
18
|
validator: (val) => badgeStatusType.includes(val)
|
|
20
19
|
},
|
|
21
|
-
|
|
20
|
+
position: {
|
|
22
21
|
type: String,
|
|
23
22
|
default: "top-right",
|
|
24
23
|
validator: (val) => badgePositionType.includes(val)
|
|
25
24
|
},
|
|
26
|
-
|
|
25
|
+
offset: {
|
|
27
26
|
type: Array
|
|
28
27
|
},
|
|
29
28
|
bgColor: {
|
|
@@ -33,29 +32,27 @@ const badgeProps = {
|
|
|
33
32
|
type: String
|
|
34
33
|
}
|
|
35
34
|
};
|
|
35
|
+
var badge = "";
|
|
36
36
|
var Badge = defineComponent({
|
|
37
37
|
name: "DBadge",
|
|
38
38
|
props: badgeProps,
|
|
39
|
-
emits: [],
|
|
40
39
|
setup(props, ctx) {
|
|
41
40
|
const className = computed(() => {
|
|
42
41
|
const base = "devui-badge-content";
|
|
43
|
-
return [base, props.showDot ? `${base}-dot` : `${base}-count`, props.status && `${base}-${props.status}`, ctx.slots.default && props.
|
|
42
|
+
return [base, props.showDot ? `${base}-dot` : `${base}-count`, props.status && `${base}-${props.status}`, ctx.slots.default && props.position && `${base}-${props.position}`, ctx.slots.default && `${base}-fixed`].join(" ");
|
|
44
43
|
});
|
|
45
44
|
const style = computed(() => {
|
|
46
45
|
const styleMap = {
|
|
47
46
|
bgColor: "background",
|
|
48
47
|
textColor: "color"
|
|
49
48
|
};
|
|
50
|
-
const ret = Object.keys(styleMap).reduce((
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
return ret2;
|
|
49
|
+
const ret = Object.keys(styleMap).reduce((result, key) => {
|
|
50
|
+
props[key] && (result[styleMap[key]] = props[key]);
|
|
51
|
+
return result;
|
|
55
52
|
}, {});
|
|
56
|
-
if (ctx.slots.default && props.
|
|
57
|
-
const [x, y] = props.
|
|
58
|
-
const [yName, xName] = props.
|
|
53
|
+
if (ctx.slots.default && props.offset) {
|
|
54
|
+
const [x, y] = props.offset;
|
|
55
|
+
const [yName, xName] = props.position.split("-");
|
|
59
56
|
ret[yName] = y + "px";
|
|
60
57
|
ret[xName] = x + "px";
|
|
61
58
|
}
|
|
@@ -81,15 +78,12 @@ var Badge = defineComponent({
|
|
|
81
78
|
};
|
|
82
79
|
}
|
|
83
80
|
});
|
|
84
|
-
Badge.install = function(app) {
|
|
85
|
-
app.component(Badge.name, Badge);
|
|
86
|
-
};
|
|
87
81
|
var index = {
|
|
88
82
|
title: "Badge \u5FBD\u6807",
|
|
89
83
|
category: "\u6570\u636E\u5C55\u793A",
|
|
90
84
|
status: "100%",
|
|
91
85
|
install(app) {
|
|
92
|
-
app.
|
|
86
|
+
app.component(Badge.name, Badge);
|
|
93
87
|
}
|
|
94
88
|
};
|
|
95
|
-
export { Badge, index as default };
|
|
89
|
+
export { Badge, badgeProps, index as default };
|