vue-devui 1.0.0-rc.0 → 1.0.0-rc.11
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 +78 -116
- package/alert/index.es.js +74 -45
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/auto-complete/index.es.js +8190 -296
- package/auto-complete/index.umd.js +29 -1
- package/auto-complete/style.css +1 -1
- package/avatar/index.es.js +153 -146
- package/avatar/index.umd.js +1 -1
- package/avatar/style.css +1 -1
- package/badge/index.es.js +34 -5
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.es.js +5741 -127
- package/button/index.umd.js +27 -1
- package/button/style.css +1 -1
- package/card/index.es.js +63 -35
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.es.js +8068 -255
- package/checkbox/index.umd.js +27 -1
- package/checkbox/style.css +1 -1
- package/{accordion → collapse}/index.d.ts +0 -0
- package/collapse/index.es.js +379 -0
- package/collapse/index.umd.js +1 -0
- package/{anchor → collapse}/package.json +1 -1
- package/collapse/style.css +1 -0
- package/countdown/index.es.js +5 -7
- package/countdown/index.umd.js +1 -1
- package/date-picker/index.es.js +8167 -288
- package/date-picker/index.umd.js +27 -1
- package/date-picker/style.css +1 -1
- package/drawer/index.es.js +31 -4
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +297 -181
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +525 -154
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.es.js +1048 -1176
- package/form/index.umd.js +16 -16
- package/form/style.css +1 -1
- package/fullscreen/index.es.js +42 -21
- package/fullscreen/index.umd.js +1 -1
- package/fullscreen/style.css +1 -1
- package/grid/index.es.js +101 -86
- package/grid/index.umd.js +1 -1
- package/grid/style.css +1 -1
- package/icon/index.es.js +197 -56
- package/icon/index.umd.js +1 -1
- package/icon/style.css +1 -0
- package/image-preview/index.es.js +55 -31
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/input/index.es.js +8074 -144
- package/input/index.umd.js +27 -1
- package/input/style.css +1 -1
- package/input-number/index.es.js +269 -183
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.es.js +40 -25
- package/layout/index.umd.js +1 -1
- package/layout/style.css +1 -1
- package/loading/index.es.js +74 -35
- package/loading/index.umd.js +1 -1
- package/loading/style.css +1 -1
- package/modal/index.es.js +412 -204
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +307 -57
- package/notification/index.umd.js +1 -1
- package/notification/style.css +1 -1
- package/nuxt/components/ButtonGroup.js +3 -0
- package/nuxt/components/CheckboxButton.js +3 -0
- package/nuxt/components/CheckboxGroup.js +3 -0
- package/nuxt/components/Collapse.js +3 -0
- package/nuxt/components/CollapseItem.js +3 -0
- package/nuxt/components/DropdownPropsKey.js +3 -0
- package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
- package/nuxt/components/FORM_TOKEN.js +3 -0
- package/nuxt/components/Icon.js +1 -0
- package/nuxt/components/IconGroup.js +3 -0
- package/nuxt/components/LABEL_DATA.js +3 -0
- package/nuxt/components/LoadingOptions.js +3 -0
- package/nuxt/components/Option.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/RadioButton.js +3 -0
- package/nuxt/components/TABLE_TOKEN.js +3 -0
- package/nuxt/components/Tab.js +3 -0
- package/nuxt/components/TimeSelect.js +3 -0
- package/nuxt/components/Timeline.js +3 -0
- package/nuxt/components/TimelineItem.js +3 -0
- package/nuxt/components/alertProps.js +3 -0
- package/nuxt/components/autoCompleteProps.js +3 -0
- package/nuxt/components/avatarProps.js +3 -0
- package/nuxt/components/buttonGroupInjectionKey.js +3 -0
- package/nuxt/components/buttonGroupProps.js +3 -0
- package/nuxt/components/cardProps.js +3 -0
- package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
- package/nuxt/components/checkboxGroupProps.js +3 -0
- package/nuxt/components/checkboxProps.js +3 -0
- package/nuxt/components/colProps.js +3 -0
- package/nuxt/components/colPropsBaseClass.js +3 -0
- package/nuxt/components/colPropsBaseStyle.js +3 -0
- package/nuxt/components/collapseItemProps.js +3 -0
- package/nuxt/components/collapseProps.js +3 -0
- package/nuxt/components/countdownProps.js +3 -0
- package/nuxt/components/editableSelectProps.js +3 -0
- package/nuxt/components/formItemProps.js +3 -0
- package/nuxt/components/formProps.js +3 -0
- package/nuxt/components/fullscreenProps.js +3 -0
- package/nuxt/components/iconProps.js +3 -0
- package/nuxt/components/imagePreviewProps.js +3 -0
- package/nuxt/components/inputProps.js +3 -0
- package/nuxt/components/loadingProps.js +3 -0
- package/nuxt/components/modalProps.js +3 -0
- package/nuxt/components/paginationProps.js +3 -0
- package/nuxt/components/panelProps.js +3 -0
- package/nuxt/components/progressProps.js +3 -0
- package/nuxt/components/rateProps.js +3 -0
- package/nuxt/components/resultProps.js +3 -0
- package/nuxt/components/rowProps.js +3 -0
- package/nuxt/components/screenSizes.js +3 -0
- package/nuxt/components/searchProps.js +3 -0
- package/nuxt/components/skeletonProps.js +3 -0
- package/nuxt/components/sliderProps.js +3 -0
- package/nuxt/components/splitterProps.js +3 -0
- package/nuxt/components/statisticProps.js +3 -0
- package/nuxt/components/svgIconProps.js +3 -0
- package/nuxt/components/switchProps.js +3 -0
- package/nuxt/components/tableProps.js +3 -0
- package/nuxt/components/tabsProps.js +3 -0
- package/nuxt/components/tagProps.js +3 -0
- package/nuxt/components/textareaProps.js +3 -0
- package/nuxt/components/timeAxisProps.js +3 -0
- package/nuxt/components/treeProps.js +3 -0
- package/overlay/index.es.js +127 -149
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +11 -44
- package/pagination/index.es.js +158 -148
- package/pagination/index.umd.js +1 -1
- package/pagination/style.css +1 -1
- package/panel/index.es.js +45 -32
- package/panel/index.umd.js +1 -1
- package/panel/style.css +1 -1
- package/popover/index.es.js +317 -246
- package/popover/index.umd.js +15 -15
- package/popover/style.css +1 -1
- package/progress/index.es.js +110 -56
- package/progress/index.umd.js +3 -3
- package/progress/style.css +1 -1
- package/radio/index.es.js +7972 -157
- package/radio/index.umd.js +27 -1
- package/radio/style.css +1 -1
- package/rate/index.es.js +77 -55
- package/rate/index.umd.js +1 -1
- package/rate/style.css +1 -1
- package/result/index.es.js +184 -57
- package/result/index.umd.js +1 -1
- package/result/style.css +1 -1
- package/ripple/index.es.js +47 -42
- package/ripple/index.umd.js +1 -1
- package/search/index.es.js +3653 -1122
- package/search/index.umd.js +18 -18
- package/search/style.css +1 -1
- package/select/index.es.js +9170 -596
- package/select/index.umd.js +27 -1
- package/select/style.css +1 -1
- package/skeleton/index.es.js +63 -41
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.es.js +144 -137
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.es.js +469 -349
- package/splitter/index.umd.js +15 -15
- package/splitter/style.css +1 -1
- package/statistic/index.es.js +41 -34
- package/statistic/index.umd.js +1 -1
- package/statistic/style.css +1 -1
- package/status/index.es.js +27 -6
- package/status/index.umd.js +1 -1
- package/status/style.css +1 -1
- package/style.css +1 -1
- package/switch/index.es.js +7802 -64
- package/switch/index.umd.js +27 -1
- package/switch/style.css +1 -1
- package/table/index.es.js +10459 -1511
- package/table/index.umd.js +27 -1
- package/table/style.css +1 -1
- package/tabs/index.es.js +344 -141
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.es.js +49 -24
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/textarea/index.es.js +7921 -83
- package/textarea/index.umd.js +35 -1
- package/textarea/style.css +1 -1
- package/{anchor → time-select}/index.d.ts +0 -0
- package/{color-picker → time-select}/index.es.js +4171 -2898
- package/time-select/index.umd.js +27 -0
- package/{breadcrumb → time-select}/package.json +1 -1
- package/time-select/style.css +1 -0
- package/{back-top → timeline}/index.d.ts +0 -0
- package/timeline/index.es.js +425 -0
- package/timeline/index.umd.js +1 -0
- package/{back-top → timeline}/package.json +1 -1
- package/timeline/style.css +1 -0
- package/tooltip/index.es.js +308 -236
- package/tooltip/index.umd.js +15 -15
- package/tooltip/style.css +1 -1
- package/tree/index.es.js +5198 -1850
- package/tree/index.umd.js +18 -18
- package/tree/style.css +1 -1
- package/upload/index.es.js +427 -132
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +12064 -15841
- package/vue-devui.umd.js +30 -20
- package/accordion/index.es.js +0 -720
- package/accordion/index.umd.js +0 -1
- package/accordion/package.json +0 -7
- package/accordion/style.css +0 -1
- package/anchor/index.es.js +0 -263
- package/anchor/index.umd.js +0 -1
- package/anchor/style.css +0 -1
- package/back-top/index.es.js +0 -128
- package/back-top/index.umd.js +0 -1
- package/back-top/style.css +0 -1
- package/breadcrumb/index.d.ts +0 -7
- package/breadcrumb/index.es.js +0 -127
- package/breadcrumb/index.umd.js +0 -1
- package/breadcrumb/style.css +0 -1
- package/carousel/index.d.ts +0 -7
- package/carousel/index.es.js +0 -329
- package/carousel/index.umd.js +0 -1
- package/carousel/package.json +0 -7
- package/carousel/style.css +0 -1
- package/cascader/index.d.ts +0 -7
- package/cascader/index.es.js +0 -5963
- package/cascader/index.umd.js +0 -27
- package/cascader/package.json +0 -7
- package/cascader/style.css +0 -1
- package/color-picker/index.d.ts +0 -7
- package/color-picker/index.umd.js +0 -27
- package/color-picker/package.json +0 -7
- package/color-picker/style.css +0 -1
- package/comment/index.d.ts +0 -7
- package/comment/index.es.js +0 -86
- package/comment/index.umd.js +0 -1
- package/comment/package.json +0 -7
- package/comment/style.css +0 -1
- package/dragdrop/index.d.ts +0 -7
- package/dragdrop/index.es.js +0 -157
- package/dragdrop/index.umd.js +0 -1
- package/dragdrop/package.json +0 -7
- package/gantt/index.d.ts +0 -7
- package/gantt/index.es.js +0 -523
- package/gantt/index.umd.js +0 -1
- package/gantt/package.json +0 -7
- package/gantt/style.css +0 -1
- package/input-icon/index.d.ts +0 -7
- package/input-icon/index.es.js +0 -331
- package/input-icon/index.umd.js +0 -1
- package/input-icon/package.json +0 -7
- package/input-icon/style.css +0 -1
- package/list/index.d.ts +0 -7
- package/list/index.es.js +0 -39
- package/list/index.umd.js +0 -1
- package/list/package.json +0 -7
- package/list/style.css +0 -1
- package/nav-sprite/index.d.ts +0 -7
- package/nav-sprite/index.es.js +0 -68
- package/nav-sprite/index.umd.js +0 -1
- package/nav-sprite/package.json +0 -7
- package/nuxt/components/Accordion.js +0 -3
- package/nuxt/components/Anchor.js +0 -3
- package/nuxt/components/BackTop.js +0 -3
- package/nuxt/components/Breadcrumb.js +0 -3
- package/nuxt/components/Carousel.js +0 -3
- package/nuxt/components/CarouselItem.js +0 -3
- package/nuxt/components/Cascader.js +0 -3
- package/nuxt/components/ColorPicker.js +0 -3
- package/nuxt/components/Comment.js +0 -3
- package/nuxt/components/FormControl.js +0 -3
- package/nuxt/components/FormLabel.js +0 -3
- package/nuxt/components/Gantt.js +0 -3
- package/nuxt/components/InputIcon.js +0 -3
- package/nuxt/components/List.js +0 -3
- package/nuxt/components/ListItem.js +0 -3
- package/nuxt/components/NavSprite.js +0 -2
- package/nuxt/components/QuadrantDiagram.js +0 -3
- package/nuxt/components/ReadTip.js +0 -3
- package/nuxt/components/StepsGuide.js +0 -3
- package/nuxt/components/Sticky.js +0 -2
- package/nuxt/components/TagInput.js +0 -3
- package/nuxt/components/TimeAxis.js +0 -3
- package/nuxt/components/TimeAxisItem.js +0 -3
- package/nuxt/components/TimePicker.js +0 -3
- package/nuxt/components/Transfer.js +0 -3
- package/nuxt/components/TreeSelect.js +0 -3
- package/nuxt/components/overlayEmits.js +0 -3
- package/nuxt/components/overlayProps.js +0 -3
- package/quadrant-diagram/index.d.ts +0 -7
- package/quadrant-diagram/index.es.js +0 -5728
- package/quadrant-diagram/index.umd.js +0 -27
- package/quadrant-diagram/package.json +0 -7
- package/quadrant-diagram/style.css +0 -1
- package/read-tip/index.d.ts +0 -7
- package/read-tip/index.es.js +0 -258
- package/read-tip/index.umd.js +0 -1
- package/read-tip/package.json +0 -7
- package/read-tip/style.css +0 -1
- package/steps-guide/index.d.ts +0 -7
- package/steps-guide/index.es.js +0 -239
- package/steps-guide/index.umd.js +0 -1
- package/steps-guide/package.json +0 -7
- package/steps-guide/style.css +0 -1
- package/sticky/index.d.ts +0 -7
- package/sticky/index.es.js +0 -197
- package/sticky/index.umd.js +0 -1
- package/sticky/package.json +0 -7
- package/tag-input/index.d.ts +0 -7
- package/tag-input/index.es.js +0 -329
- package/tag-input/index.umd.js +0 -1
- package/tag-input/package.json +0 -7
- package/tag-input/style.css +0 -1
- package/time-axis/index.d.ts +0 -7
- package/time-axis/index.es.js +0 -299
- package/time-axis/index.umd.js +0 -1
- package/time-axis/package.json +0 -7
- package/time-axis/style.css +0 -1
- package/time-picker/index.d.ts +0 -7
- package/time-picker/index.es.js +0 -1237
- package/time-picker/index.umd.js +0 -1
- package/time-picker/package.json +0 -7
- package/time-picker/style.css +0 -1
- package/transfer/index.d.ts +0 -7
- package/transfer/index.es.js +0 -7608
- package/transfer/index.umd.js +0 -27
- package/transfer/package.json +0 -7
- package/transfer/style.css +0 -1
- package/tree-select/index.d.ts +0 -7
- package/tree-select/index.es.js +0 -623
- package/tree-select/index.umd.js +0 -1
- package/tree-select/package.json +0 -7
- package/tree-select/style.css +0 -1
package/dropdown/index.es.js
CHANGED
|
@@ -17,8 +17,8 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import { toRefs, watch, onMounted, onUnmounted, defineComponent, createVNode,
|
|
21
|
-
import { offset, autoPlacement, arrow, computePosition } from "@floating-ui/dom";
|
|
20
|
+
import { toRefs, watch, onMounted, onUnmounted, ref, computed, defineComponent, createVNode, Transition, mergeProps, unref, nextTick, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, provide, Teleport, vShow } from "vue";
|
|
21
|
+
import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
|
|
22
22
|
import { onClickOutside } from "@vueuse/core";
|
|
23
23
|
const dropdownProps = {
|
|
24
24
|
visible: {
|
|
@@ -45,11 +45,27 @@ const dropdownProps = {
|
|
|
45
45
|
type: [Number, Object],
|
|
46
46
|
default: 4
|
|
47
47
|
},
|
|
48
|
+
shiftOffset: {
|
|
49
|
+
type: Number
|
|
50
|
+
},
|
|
48
51
|
closeOnMouseLeaveMenu: {
|
|
49
52
|
type: Boolean,
|
|
50
53
|
default: false
|
|
54
|
+
},
|
|
55
|
+
showAnimation: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: true
|
|
58
|
+
},
|
|
59
|
+
overlayClass: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: ""
|
|
62
|
+
},
|
|
63
|
+
destroyOnHide: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: true
|
|
51
66
|
}
|
|
52
67
|
};
|
|
68
|
+
const POPPER_TRIGGER_TOKEN = Symbol("popper-trigger");
|
|
53
69
|
function getElement(element) {
|
|
54
70
|
if (element instanceof Element) {
|
|
55
71
|
return element;
|
|
@@ -74,12 +90,12 @@ const useDropdownEvent = ({ id, isOpen, origin, dropdownRef, props, emit }) => {
|
|
|
74
90
|
isOpen.value = status;
|
|
75
91
|
emit("toggle", isOpen.value);
|
|
76
92
|
};
|
|
77
|
-
const handleLeave = async (elementType,
|
|
93
|
+
const handleLeave = async (elementType, closeAll) => {
|
|
78
94
|
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
79
95
|
if (elementType === "origin" && overlayEnter || elementType === "dropdown" && originEnter) {
|
|
80
96
|
return;
|
|
81
97
|
}
|
|
82
|
-
if (
|
|
98
|
+
if (closeAll) {
|
|
83
99
|
[...dropdownMap.values()].reverse().forEach((item) => {
|
|
84
100
|
setTimeout(() => {
|
|
85
101
|
var _a;
|
|
@@ -95,7 +111,7 @@ const useDropdownEvent = ({ id, isOpen, origin, dropdownRef, props, emit }) => {
|
|
|
95
111
|
setTimeout(() => {
|
|
96
112
|
subscriptions.push(subscribeEvent(document, "click", (e) => {
|
|
97
113
|
const dropdownValues = [...dropdownMap.values()];
|
|
98
|
-
if (!isOpen.value || closeScope.value === "none" || dropdownEl.contains(e.target) && closeScope.value === "blank" || dropdownValues.some((item) => {
|
|
114
|
+
if (!isOpen.value || closeScope.value === "none" || (dropdownEl == null ? void 0 : dropdownEl.contains(e.target)) && closeScope.value === "blank" || dropdownValues.some((item) => {
|
|
99
115
|
var _a;
|
|
100
116
|
return (_a = item.toggleEl) == null ? void 0 : _a.contains(e.target);
|
|
101
117
|
}) && dropdownValues.some((item) => {
|
|
@@ -119,7 +135,7 @@ const useDropdownEvent = ({ id, isOpen, origin, dropdownRef, props, emit }) => {
|
|
|
119
135
|
subscriptions.push(subscribeEvent(originEl, "click", () => toggle(!isOpen.value)), subscribeEvent(dropdownEl, "mouseleave", (e) => {
|
|
120
136
|
var _a;
|
|
121
137
|
if (closeOnMouseLeaveMenu.value && !((_a = dropdownMap.get(id).child) == null ? void 0 : _a.contains(e.relatedTarget))) {
|
|
122
|
-
handleLeave("dropdown",
|
|
138
|
+
handleLeave("dropdown", true);
|
|
123
139
|
}
|
|
124
140
|
}));
|
|
125
141
|
} else if (triggerVal === "hover") {
|
|
@@ -138,7 +154,7 @@ const useDropdownEvent = ({ id, isOpen, origin, dropdownRef, props, emit }) => {
|
|
|
138
154
|
if (e.relatedTarget && ((originEl == null ? void 0 : originEl.contains(e.relatedTarget)) || ((_a = dropdownMap.get(id).child) == null ? void 0 : _a.contains(e.relatedTarget)))) {
|
|
139
155
|
return;
|
|
140
156
|
}
|
|
141
|
-
handleLeave("dropdown",
|
|
157
|
+
handleLeave("dropdown", true);
|
|
142
158
|
}));
|
|
143
159
|
}
|
|
144
160
|
onInvalidate(() => subscriptions.forEach((v) => v()));
|
|
@@ -189,58 +205,131 @@ function useDropdown(id, visible, isOpen, origin, dropdownRef, popDirection, emi
|
|
|
189
205
|
dropdownMap.delete(id);
|
|
190
206
|
});
|
|
191
207
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
208
|
+
function useOverlayProps(props, currentPosition, isOpen) {
|
|
209
|
+
const { showAnimation, overlayClass, destroyOnHide } = toRefs(props);
|
|
210
|
+
const overlayModelValue = ref(false);
|
|
211
|
+
const overlayShowValue = ref(false);
|
|
212
|
+
const styles = computed(() => ({
|
|
213
|
+
transformOrigin: currentPosition.value === "top" ? "0% 100%" : "0% 0%"
|
|
214
|
+
}));
|
|
215
|
+
const classes = computed(() => ({
|
|
216
|
+
"fade-in-bottom": showAnimation.value && isOpen.value && currentPosition.value === "bottom",
|
|
217
|
+
"fade-in-top": showAnimation.value && isOpen.value && currentPosition.value === "top",
|
|
218
|
+
[`${overlayClass.value}`]: true
|
|
219
|
+
}));
|
|
220
|
+
const handlePositionChange = (pos) => {
|
|
221
|
+
currentPosition.value = pos.includes("top") || pos.includes("end") ? "top" : "bottom";
|
|
222
|
+
};
|
|
223
|
+
watch(isOpen, (isOpenVal) => {
|
|
224
|
+
overlayModelValue.value = destroyOnHide.value ? isOpenVal : true;
|
|
225
|
+
overlayShowValue.value = isOpenVal;
|
|
226
|
+
});
|
|
227
|
+
return { overlayModelValue, overlayShowValue, styles, classes, handlePositionChange };
|
|
195
228
|
}
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
return () => {
|
|
199
|
-
let _slot;
|
|
200
|
-
return createVNode(Teleport, {
|
|
201
|
-
"to": "#d-overlay-anchor"
|
|
202
|
-
}, {
|
|
203
|
-
default: () => [createVNode(Transition, {
|
|
204
|
-
"name": "devui-overlay-fade"
|
|
205
|
-
}, _isSlot(_slot = renderSlot(ctx.slots, "default")) ? _slot : {
|
|
206
|
-
default: () => [_slot]
|
|
207
|
-
})]
|
|
208
|
-
});
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
const overlayProps = {
|
|
213
|
-
visible: {
|
|
214
|
-
type: Boolean
|
|
215
|
-
},
|
|
216
|
-
backgroundBlock: {
|
|
229
|
+
const fixedOverlayProps = {
|
|
230
|
+
modelValue: {
|
|
217
231
|
type: Boolean,
|
|
218
232
|
default: false
|
|
219
233
|
},
|
|
220
|
-
|
|
221
|
-
type: String,
|
|
222
|
-
default: ""
|
|
223
|
-
},
|
|
224
|
-
backgroundStyle: {
|
|
225
|
-
type: [String, Object]
|
|
226
|
-
},
|
|
227
|
-
onBackdropClick: {
|
|
228
|
-
type: Function
|
|
229
|
-
},
|
|
230
|
-
backdropClose: {
|
|
234
|
+
lockScroll: {
|
|
231
235
|
type: Boolean,
|
|
232
236
|
default: true
|
|
233
237
|
},
|
|
234
|
-
|
|
238
|
+
closeOnClickOverlay: {
|
|
235
239
|
type: Boolean,
|
|
236
240
|
default: true
|
|
237
241
|
}
|
|
238
242
|
};
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
243
|
+
function lockScroll() {
|
|
244
|
+
if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
|
|
245
|
+
const scrollTop = document.documentElement.scrollTop;
|
|
246
|
+
const style = document.documentElement.getAttribute("style");
|
|
247
|
+
document.documentElement.style.position = "fixed";
|
|
248
|
+
document.documentElement.style.top = `-${scrollTop}px`;
|
|
249
|
+
document.documentElement.style.width = document.documentElement.style.width || "100%";
|
|
250
|
+
document.documentElement.style.overflowY = "scroll";
|
|
251
|
+
return () => {
|
|
252
|
+
if (style) {
|
|
253
|
+
document.documentElement.setAttribute("style", style);
|
|
254
|
+
} else {
|
|
255
|
+
document.documentElement.removeAttribute("style");
|
|
256
|
+
}
|
|
257
|
+
document.documentElement.scrollTop = scrollTop;
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
function useFixedOverlay(props, ctx) {
|
|
263
|
+
let lockScrollCb;
|
|
264
|
+
const onClick = (event) => {
|
|
265
|
+
event.preventDefault();
|
|
266
|
+
ctx.emit("click", event);
|
|
267
|
+
if (props.closeOnClickOverlay) {
|
|
268
|
+
ctx.emit("update:modelValue", false);
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
const removeBodyAdditions = () => {
|
|
272
|
+
lockScrollCb == null ? void 0 : lockScrollCb();
|
|
273
|
+
};
|
|
274
|
+
watch(() => props.modelValue, (val) => {
|
|
275
|
+
if (val) {
|
|
276
|
+
props.lockScroll && (lockScrollCb = lockScroll());
|
|
277
|
+
} else {
|
|
278
|
+
removeBodyAdditions();
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
onUnmounted(removeBodyAdditions);
|
|
282
|
+
return { onClick };
|
|
283
|
+
}
|
|
284
|
+
function createBem(namespace, element, modifier) {
|
|
285
|
+
let cls = namespace;
|
|
286
|
+
if (element) {
|
|
287
|
+
cls += `__${element}`;
|
|
288
|
+
}
|
|
289
|
+
if (modifier) {
|
|
290
|
+
cls += `--${modifier}`;
|
|
291
|
+
}
|
|
292
|
+
return cls;
|
|
293
|
+
}
|
|
294
|
+
function useNamespace(block, needDot = false) {
|
|
295
|
+
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
296
|
+
const b = () => createBem(namespace);
|
|
297
|
+
const e = (element) => element ? createBem(namespace, element) : "";
|
|
298
|
+
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
299
|
+
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
300
|
+
return {
|
|
301
|
+
b,
|
|
302
|
+
e,
|
|
303
|
+
m,
|
|
304
|
+
em
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
var fixedOverlay = "";
|
|
308
|
+
defineComponent({
|
|
309
|
+
name: "DFixedOverlay",
|
|
310
|
+
inheritAttrs: false,
|
|
311
|
+
props: fixedOverlayProps,
|
|
312
|
+
emits: ["update:modelValue", "click"],
|
|
313
|
+
setup(props, ctx) {
|
|
314
|
+
const {
|
|
315
|
+
modelValue
|
|
316
|
+
} = toRefs(props);
|
|
317
|
+
const ns2 = useNamespace("fixed-overlay");
|
|
318
|
+
const {
|
|
319
|
+
onClick
|
|
320
|
+
} = useFixedOverlay(props, ctx);
|
|
321
|
+
return () => createVNode(Transition, {
|
|
322
|
+
"name": ns2.m("fade")
|
|
323
|
+
}, {
|
|
324
|
+
default: () => {
|
|
325
|
+
var _a, _b;
|
|
326
|
+
return [modelValue.value && createVNode("div", mergeProps({
|
|
327
|
+
"class": ns2.b()
|
|
328
|
+
}, ctx.attrs, {
|
|
329
|
+
"onClick": onClick
|
|
330
|
+
}), [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])];
|
|
331
|
+
}
|
|
332
|
+
});
|
|
244
333
|
}
|
|
245
334
|
});
|
|
246
335
|
const flexibleOverlayProps = {
|
|
@@ -260,6 +349,9 @@ const flexibleOverlayProps = {
|
|
|
260
349
|
type: [Number, Object],
|
|
261
350
|
default: 8
|
|
262
351
|
},
|
|
352
|
+
shiftOffset: {
|
|
353
|
+
type: Number
|
|
354
|
+
},
|
|
263
355
|
align: {
|
|
264
356
|
type: String,
|
|
265
357
|
default: null
|
|
@@ -273,80 +365,6 @@ const flexibleOverlayProps = {
|
|
|
273
365
|
default: true
|
|
274
366
|
}
|
|
275
367
|
};
|
|
276
|
-
function useOverlayLogic(props, ctx) {
|
|
277
|
-
const backgroundClass = computed(() => {
|
|
278
|
-
return [
|
|
279
|
-
"devui-overlay-background",
|
|
280
|
-
props.backgroundClass,
|
|
281
|
-
!props.hasBackdrop ? "devui-overlay-background__disabled" : "devui-overlay-background__color"
|
|
282
|
-
];
|
|
283
|
-
});
|
|
284
|
-
const overlayClass = computed(() => {
|
|
285
|
-
return "devui-overlay";
|
|
286
|
-
});
|
|
287
|
-
const handleBackdropClick = (event) => {
|
|
288
|
-
var _a;
|
|
289
|
-
event.preventDefault();
|
|
290
|
-
(_a = props.onBackdropClick) == null ? void 0 : _a.call(props);
|
|
291
|
-
if (props.backdropClose) {
|
|
292
|
-
ctx.emit("update:visible", false);
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
const handleOverlayBubbleCancel = (event) => event.cancelBubble = true;
|
|
296
|
-
onMounted(() => {
|
|
297
|
-
const body = document.body;
|
|
298
|
-
const originOverflow = body.style.overflow;
|
|
299
|
-
const originPosition = body.style.position;
|
|
300
|
-
watch([() => props.visible, () => props.backgroundBlock], ([visible, backgroundBlock]) => {
|
|
301
|
-
if (backgroundBlock) {
|
|
302
|
-
const top = body.getBoundingClientRect().y;
|
|
303
|
-
if (visible) {
|
|
304
|
-
body.style.overflowY = "scroll";
|
|
305
|
-
body.style.position = visible ? "fixed" : "";
|
|
306
|
-
body.style.top = `${top}px`;
|
|
307
|
-
} else {
|
|
308
|
-
body.style.overflowY = originOverflow;
|
|
309
|
-
body.style.position = originPosition;
|
|
310
|
-
body.style.top = "";
|
|
311
|
-
window.scrollTo(0, -top);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
onUnmounted(() => {
|
|
316
|
-
document.body.style.overflow = originOverflow;
|
|
317
|
-
});
|
|
318
|
-
});
|
|
319
|
-
return {
|
|
320
|
-
backgroundClass,
|
|
321
|
-
overlayClass,
|
|
322
|
-
handleBackdropClick,
|
|
323
|
-
handleOverlayBubbleCancel
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
defineComponent({
|
|
327
|
-
name: "DFixedOverlay",
|
|
328
|
-
props: fixedOverlayProps,
|
|
329
|
-
emits: overlayEmits,
|
|
330
|
-
setup(props, ctx) {
|
|
331
|
-
const {
|
|
332
|
-
backgroundClass,
|
|
333
|
-
overlayClass,
|
|
334
|
-
handleBackdropClick,
|
|
335
|
-
handleOverlayBubbleCancel
|
|
336
|
-
} = useOverlayLogic(props, ctx);
|
|
337
|
-
return () => createVNode(CommonOverlay, null, {
|
|
338
|
-
default: () => [props.visible && createVNode("div", {
|
|
339
|
-
"class": backgroundClass.value,
|
|
340
|
-
"style": props.backgroundStyle,
|
|
341
|
-
"onClick": handleBackdropClick
|
|
342
|
-
}, [createVNode("div", {
|
|
343
|
-
"class": overlayClass.value,
|
|
344
|
-
"style": props.overlayStyle,
|
|
345
|
-
"onClick": handleOverlayBubbleCancel
|
|
346
|
-
}, [renderSlot(ctx.slots, "default")])])]
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
368
|
function getScrollParent(element) {
|
|
351
369
|
const overflowRegex = /(auto|scroll|hidden)/;
|
|
352
370
|
for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
|
|
@@ -379,6 +397,7 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
|
379
397
|
function useOverlay(props, emit) {
|
|
380
398
|
const overlayRef = ref();
|
|
381
399
|
const arrowRef = ref();
|
|
400
|
+
let originParent = null;
|
|
382
401
|
const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
|
|
383
402
|
const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
|
|
384
403
|
const staticSide = {
|
|
@@ -407,34 +426,43 @@ function useOverlay(props, emit) {
|
|
|
407
426
|
})
|
|
408
427
|
];
|
|
409
428
|
props.showArrow && middleware.push(arrow({ element: arrowEl }));
|
|
429
|
+
props.shiftOffset !== void 0 && middleware.push(shift());
|
|
410
430
|
const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
|
|
411
431
|
strategy: "fixed",
|
|
412
432
|
middleware
|
|
413
433
|
});
|
|
434
|
+
let applyX = x;
|
|
435
|
+
let applyY = y;
|
|
436
|
+
if (props.shiftOffset !== void 0) {
|
|
437
|
+
const { x: shiftX, y: shiftY } = middlewareData.shift;
|
|
438
|
+
shiftX < 0 && (applyX -= props.shiftOffset);
|
|
439
|
+
shiftX > 0 && (applyX += props.shiftOffset);
|
|
440
|
+
shiftY < 0 && (applyY -= props.shiftOffset);
|
|
441
|
+
shiftY > 0 && (applyY += props.shiftOffset);
|
|
442
|
+
}
|
|
414
443
|
emit("positionChange", placement);
|
|
415
|
-
Object.assign(overlayEl.style, { top: `${
|
|
444
|
+
Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
|
|
416
445
|
props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
|
|
417
446
|
};
|
|
418
447
|
watch(() => props.modelValue, () => {
|
|
419
|
-
const originParent = getScrollParent(props.origin);
|
|
420
448
|
if (props.modelValue && props.origin) {
|
|
449
|
+
originParent = getScrollParent(props.origin);
|
|
421
450
|
nextTick(updatePosition);
|
|
422
|
-
originParent.addEventListener("scroll", updatePosition);
|
|
451
|
+
originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
|
|
423
452
|
originParent !== window && window.addEventListener("scroll", updatePosition);
|
|
424
453
|
window.addEventListener("resize", updatePosition);
|
|
425
454
|
} else {
|
|
426
|
-
originParent.removeEventListener("scroll", updatePosition);
|
|
455
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
427
456
|
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
428
457
|
window.removeEventListener("resize", updatePosition);
|
|
429
458
|
}
|
|
430
459
|
});
|
|
431
460
|
onUnmounted(() => {
|
|
432
|
-
|
|
433
|
-
originParent.removeEventListener("scroll", updatePosition);
|
|
461
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
434
462
|
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
435
463
|
window.removeEventListener("resize", updatePosition);
|
|
436
464
|
});
|
|
437
|
-
return { arrowRef, overlayRef };
|
|
465
|
+
return { arrowRef, overlayRef, updatePosition };
|
|
438
466
|
}
|
|
439
467
|
var flexibleOverlay = "";
|
|
440
468
|
const FlexibleOverlay = defineComponent({
|
|
@@ -445,24 +473,85 @@ const FlexibleOverlay = defineComponent({
|
|
|
445
473
|
setup(props, {
|
|
446
474
|
slots,
|
|
447
475
|
attrs,
|
|
448
|
-
emit
|
|
476
|
+
emit,
|
|
477
|
+
expose
|
|
449
478
|
}) {
|
|
479
|
+
const ns2 = useNamespace("flexible-overlay");
|
|
450
480
|
const {
|
|
451
481
|
arrowRef,
|
|
452
|
-
overlayRef
|
|
482
|
+
overlayRef,
|
|
483
|
+
updatePosition
|
|
453
484
|
} = useOverlay(props, emit);
|
|
485
|
+
expose({
|
|
486
|
+
updatePosition
|
|
487
|
+
});
|
|
454
488
|
return () => {
|
|
455
489
|
var _a;
|
|
456
490
|
return props.modelValue && createVNode("div", mergeProps({
|
|
457
491
|
"ref": overlayRef,
|
|
458
|
-
"class":
|
|
492
|
+
"class": ns2.b()
|
|
459
493
|
}, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
|
|
460
494
|
"ref": arrowRef,
|
|
461
|
-
"class": "
|
|
495
|
+
"class": ns2.e("arrow")
|
|
462
496
|
}, null)]);
|
|
463
497
|
};
|
|
464
498
|
}
|
|
465
499
|
});
|
|
500
|
+
const isObject = (val) => val !== null && typeof val === "object";
|
|
501
|
+
const ns = useNamespace("popper-trigger");
|
|
502
|
+
function wrapContent(content) {
|
|
503
|
+
return h("span", { class: ns.b() }, content);
|
|
504
|
+
}
|
|
505
|
+
function getFirstValidChild(nodes) {
|
|
506
|
+
for (const child of nodes) {
|
|
507
|
+
if (isObject(child)) {
|
|
508
|
+
if (child.type === Comment) {
|
|
509
|
+
continue;
|
|
510
|
+
}
|
|
511
|
+
if (child.type === "svg" || child.type === Text) {
|
|
512
|
+
return wrapContent(child);
|
|
513
|
+
}
|
|
514
|
+
if (child.type === Fragment) {
|
|
515
|
+
return getFirstValidChild(child.children);
|
|
516
|
+
}
|
|
517
|
+
return child;
|
|
518
|
+
}
|
|
519
|
+
return wrapContent(child);
|
|
520
|
+
}
|
|
521
|
+
return null;
|
|
522
|
+
}
|
|
523
|
+
var PopperTrigger = defineComponent({
|
|
524
|
+
name: "DPopperTrigger",
|
|
525
|
+
setup(_, ctx) {
|
|
526
|
+
const {
|
|
527
|
+
slots,
|
|
528
|
+
attrs
|
|
529
|
+
} = ctx;
|
|
530
|
+
return () => {
|
|
531
|
+
var _a;
|
|
532
|
+
const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots, attrs);
|
|
533
|
+
const triggerRef = inject(POPPER_TRIGGER_TOKEN);
|
|
534
|
+
if (!defaultSlot) {
|
|
535
|
+
return null;
|
|
536
|
+
}
|
|
537
|
+
const firstValidChild = getFirstValidChild(defaultSlot);
|
|
538
|
+
if (!firstValidChild) {
|
|
539
|
+
return null;
|
|
540
|
+
}
|
|
541
|
+
return withDirectives(cloneVNode(firstValidChild, attrs), [[{
|
|
542
|
+
mounted(el) {
|
|
543
|
+
triggerRef.value = el;
|
|
544
|
+
},
|
|
545
|
+
updated(el) {
|
|
546
|
+
triggerRef.value = el;
|
|
547
|
+
},
|
|
548
|
+
unmounted() {
|
|
549
|
+
triggerRef.value = null;
|
|
550
|
+
}
|
|
551
|
+
}]]);
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
});
|
|
466
555
|
var dropdown = "";
|
|
467
556
|
let dropdownId = 1;
|
|
468
557
|
var Dropdown = defineComponent({
|
|
@@ -473,29 +562,26 @@ var Dropdown = defineComponent({
|
|
|
473
562
|
setup(props, {
|
|
474
563
|
slots,
|
|
475
564
|
attrs,
|
|
476
|
-
emit
|
|
565
|
+
emit,
|
|
566
|
+
expose
|
|
477
567
|
}) {
|
|
478
568
|
const {
|
|
479
569
|
visible,
|
|
480
570
|
position,
|
|
481
571
|
align,
|
|
482
|
-
offset: offset2
|
|
572
|
+
offset: offset2,
|
|
573
|
+
destroyOnHide,
|
|
574
|
+
shiftOffset,
|
|
575
|
+
showAnimation
|
|
483
576
|
} = toRefs(props);
|
|
484
577
|
const origin = ref();
|
|
485
578
|
const dropdownRef = ref();
|
|
579
|
+
const overlayRef = ref();
|
|
486
580
|
const id = `dropdown_${dropdownId++}`;
|
|
487
581
|
const isOpen = ref(false);
|
|
488
582
|
const currentPosition = ref("bottom");
|
|
489
|
-
const
|
|
490
|
-
|
|
491
|
-
};
|
|
492
|
-
const styles = computed(() => ({
|
|
493
|
-
transformOrigin: currentPosition.value === "top" ? "0% 100%" : "0% 0%"
|
|
494
|
-
}));
|
|
495
|
-
const classes = computed(() => ({
|
|
496
|
-
"fade-in-bottom": isOpen.value && currentPosition.value === "bottom",
|
|
497
|
-
"fade-in-top": isOpen.value && currentPosition.value === "top"
|
|
498
|
-
}));
|
|
583
|
+
const ns2 = useNamespace("dropdown");
|
|
584
|
+
provide(POPPER_TRIGGER_TOKEN, origin);
|
|
499
585
|
useDropdownEvent({
|
|
500
586
|
id,
|
|
501
587
|
isOpen,
|
|
@@ -505,39 +591,57 @@ var Dropdown = defineComponent({
|
|
|
505
591
|
emit
|
|
506
592
|
});
|
|
507
593
|
useDropdown(id, visible, isOpen, origin, dropdownRef, currentPosition, emit);
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
594
|
+
const {
|
|
595
|
+
overlayModelValue,
|
|
596
|
+
overlayShowValue,
|
|
597
|
+
styles,
|
|
598
|
+
classes,
|
|
599
|
+
handlePositionChange
|
|
600
|
+
} = useOverlayProps(props, currentPosition, isOpen);
|
|
601
|
+
watch(overlayShowValue, (overlayShowValueVal) => {
|
|
602
|
+
nextTick(() => {
|
|
603
|
+
if (!destroyOnHide.value && overlayShowValueVal) {
|
|
604
|
+
overlayRef.value.updatePosition();
|
|
605
|
+
}
|
|
606
|
+
});
|
|
607
|
+
});
|
|
608
|
+
expose({
|
|
609
|
+
updatePosition: () => overlayRef.value.updatePosition()
|
|
610
|
+
});
|
|
611
|
+
return () => createVNode(Fragment, null, [createVNode(PopperTrigger, null, {
|
|
612
|
+
default: () => {
|
|
613
|
+
var _a;
|
|
614
|
+
return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
|
|
615
|
+
}
|
|
616
|
+
}), createVNode(Teleport, {
|
|
617
|
+
"to": "body"
|
|
618
|
+
}, {
|
|
619
|
+
default: () => [createVNode(Transition, {
|
|
620
|
+
"name": showAnimation.value ? ns2.m(`fade-${currentPosition.value}`) : ""
|
|
515
621
|
}, {
|
|
516
|
-
default: () => [createVNode(
|
|
517
|
-
"
|
|
622
|
+
default: () => [withDirectives(createVNode(FlexibleOverlay, {
|
|
623
|
+
"modelValue": overlayModelValue.value,
|
|
624
|
+
"onUpdate:modelValue": ($event) => overlayModelValue.value = $event,
|
|
625
|
+
"ref": overlayRef,
|
|
626
|
+
"origin": origin.value,
|
|
627
|
+
"position": position.value,
|
|
628
|
+
"align": align.value,
|
|
629
|
+
"offset": offset2.value,
|
|
630
|
+
"shiftOffset": shiftOffset == null ? void 0 : shiftOffset.value,
|
|
631
|
+
"onPositionChange": handlePositionChange,
|
|
632
|
+
"class": classes.value,
|
|
633
|
+
"style": styles.value
|
|
518
634
|
}, {
|
|
519
|
-
default: () =>
|
|
520
|
-
|
|
521
|
-
"
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
}, {
|
|
530
|
-
default: () => {
|
|
531
|
-
var _a2;
|
|
532
|
-
return [createVNode("div", mergeProps({
|
|
533
|
-
"ref": dropdownRef,
|
|
534
|
-
"class": "devui-dropdown-menu-wrap"
|
|
535
|
-
}, attrs), [(_a2 = slots.menu) == null ? void 0 : _a2.call(slots)])];
|
|
536
|
-
}
|
|
537
|
-
})]
|
|
538
|
-
})]
|
|
539
|
-
})]);
|
|
540
|
-
};
|
|
635
|
+
default: () => {
|
|
636
|
+
var _a;
|
|
637
|
+
return [createVNode("div", mergeProps({
|
|
638
|
+
"ref": dropdownRef,
|
|
639
|
+
"class": ns2.e("menu-wrap")
|
|
640
|
+
}, attrs), [(_a = slots.menu) == null ? void 0 : _a.call(slots)])];
|
|
641
|
+
}
|
|
642
|
+
}), [[vShow, overlayShowValue.value]])]
|
|
643
|
+
})]
|
|
644
|
+
})]);
|
|
541
645
|
}
|
|
542
646
|
});
|
|
543
647
|
const dropdownMenuProps = {
|
|
@@ -564,6 +668,14 @@ const dropdownMenuProps = {
|
|
|
564
668
|
clickOutside: {
|
|
565
669
|
type: Function,
|
|
566
670
|
default: () => true
|
|
671
|
+
},
|
|
672
|
+
showAnimation: {
|
|
673
|
+
type: Boolean,
|
|
674
|
+
default: true
|
|
675
|
+
},
|
|
676
|
+
overlayClass: {
|
|
677
|
+
type: String,
|
|
678
|
+
default: ""
|
|
567
679
|
}
|
|
568
680
|
};
|
|
569
681
|
var DropdownMenu = defineComponent({
|
|
@@ -582,12 +694,15 @@ var DropdownMenu = defineComponent({
|
|
|
582
694
|
position,
|
|
583
695
|
align,
|
|
584
696
|
offset: offset2,
|
|
585
|
-
clickOutside
|
|
697
|
+
clickOutside,
|
|
698
|
+
showAnimation,
|
|
699
|
+
overlayClass
|
|
586
700
|
} = toRefs(props);
|
|
587
701
|
const dropdownMenuRef = ref(null);
|
|
702
|
+
const ns2 = useNamespace("dropdown");
|
|
588
703
|
onClickOutside(dropdownMenuRef, (value) => {
|
|
589
|
-
var _a;
|
|
590
|
-
if (((_a = clickOutside.value) == null ? void 0 : _a.call(clickOutside)) && !origin.value.contains(value.target)) {
|
|
704
|
+
var _a, _b;
|
|
705
|
+
if (((_a = clickOutside.value) == null ? void 0 : _a.call(clickOutside)) && !((_b = origin == null ? void 0 : origin.value) == null ? void 0 : _b.contains(value.target))) {
|
|
591
706
|
emit("update:modelValue", false);
|
|
592
707
|
}
|
|
593
708
|
});
|
|
@@ -602,7 +717,7 @@ var DropdownMenu = defineComponent({
|
|
|
602
717
|
"to": "body"
|
|
603
718
|
}, {
|
|
604
719
|
default: () => [createVNode(Transition, {
|
|
605
|
-
"name": `
|
|
720
|
+
"name": showAnimation.value ? ns2.m(`fade-${currentPosition.value}`) : ""
|
|
606
721
|
}, {
|
|
607
722
|
default: () => [createVNode(FlexibleOverlay, {
|
|
608
723
|
"modelValue": modelValue.value,
|
|
@@ -612,13 +727,14 @@ var DropdownMenu = defineComponent({
|
|
|
612
727
|
"align": align.value,
|
|
613
728
|
"offset": offset2.value,
|
|
614
729
|
"onPositionChange": handlePositionChange,
|
|
730
|
+
"class": overlayClass.value,
|
|
615
731
|
"style": styles.value
|
|
616
732
|
}, {
|
|
617
733
|
default: () => {
|
|
618
734
|
var _a;
|
|
619
735
|
return [createVNode("div", mergeProps({
|
|
620
736
|
"ref": dropdownMenuRef,
|
|
621
|
-
"class": "
|
|
737
|
+
"class": ns2.e("menu-wrap")
|
|
622
738
|
}, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots)])];
|
|
623
739
|
}
|
|
624
740
|
})]
|