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/overlay/index.es.js
CHANGED
|
@@ -1,76 +1,109 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import { defineComponent, createVNode, Teleport, Transition, renderSlot, isVNode, computed, onMounted, watch, onUnmounted, ref, nextTick, unref, mergeProps } from "vue";
|
|
21
|
-
import { offset, autoPlacement, arrow, computePosition } from "@floating-ui/dom";
|
|
22
|
-
var overlay = "";
|
|
23
|
-
function _isSlot(s) {
|
|
24
|
-
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
25
|
-
}
|
|
26
|
-
const CommonOverlay = defineComponent({
|
|
27
|
-
setup(props, ctx) {
|
|
28
|
-
return () => {
|
|
29
|
-
let _slot;
|
|
30
|
-
return createVNode(Teleport, {
|
|
31
|
-
"to": "#d-overlay-anchor"
|
|
32
|
-
}, {
|
|
33
|
-
default: () => [createVNode(Transition, {
|
|
34
|
-
"name": "devui-overlay-fade"
|
|
35
|
-
}, _isSlot(_slot = renderSlot(ctx.slots, "default")) ? _slot : {
|
|
36
|
-
default: () => [_slot]
|
|
37
|
-
})]
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
const overlayProps = {
|
|
43
|
-
visible: {
|
|
44
|
-
type: Boolean
|
|
45
|
-
},
|
|
46
|
-
backgroundBlock: {
|
|
1
|
+
import { watch, onUnmounted, defineComponent, toRefs, createVNode, Transition, mergeProps, ref, unref, nextTick } from "vue";
|
|
2
|
+
import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
|
|
3
|
+
const fixedOverlayProps = {
|
|
4
|
+
modelValue: {
|
|
47
5
|
type: Boolean,
|
|
48
6
|
default: false
|
|
49
7
|
},
|
|
50
|
-
|
|
51
|
-
type: String,
|
|
52
|
-
default: ""
|
|
53
|
-
},
|
|
54
|
-
backgroundStyle: {
|
|
55
|
-
type: [String, Object]
|
|
56
|
-
},
|
|
57
|
-
onBackdropClick: {
|
|
58
|
-
type: Function
|
|
59
|
-
},
|
|
60
|
-
backdropClose: {
|
|
8
|
+
lockScroll: {
|
|
61
9
|
type: Boolean,
|
|
62
10
|
default: true
|
|
63
11
|
},
|
|
64
|
-
|
|
12
|
+
closeOnClickOverlay: {
|
|
65
13
|
type: Boolean,
|
|
66
14
|
default: true
|
|
67
15
|
}
|
|
68
16
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
17
|
+
function lockScroll() {
|
|
18
|
+
if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
|
|
19
|
+
const scrollTop = document.documentElement.scrollTop;
|
|
20
|
+
const style = document.documentElement.getAttribute("style");
|
|
21
|
+
document.documentElement.style.position = "fixed";
|
|
22
|
+
document.documentElement.style.top = `-${scrollTop}px`;
|
|
23
|
+
document.documentElement.style.width = document.documentElement.style.width || "100%";
|
|
24
|
+
document.documentElement.style.overflowY = "scroll";
|
|
25
|
+
return () => {
|
|
26
|
+
if (style) {
|
|
27
|
+
document.documentElement.setAttribute("style", style);
|
|
28
|
+
} else {
|
|
29
|
+
document.documentElement.removeAttribute("style");
|
|
30
|
+
}
|
|
31
|
+
document.documentElement.scrollTop = scrollTop;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
function useFixedOverlay(props, ctx) {
|
|
37
|
+
let lockScrollCb;
|
|
38
|
+
const onClick = (event) => {
|
|
39
|
+
event.preventDefault();
|
|
40
|
+
ctx.emit("click", event);
|
|
41
|
+
if (props.closeOnClickOverlay) {
|
|
42
|
+
ctx.emit("update:modelValue", false);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const removeBodyAdditions = () => {
|
|
46
|
+
lockScrollCb == null ? void 0 : lockScrollCb();
|
|
47
|
+
};
|
|
48
|
+
watch(() => props.modelValue, (val) => {
|
|
49
|
+
if (val) {
|
|
50
|
+
props.lockScroll && (lockScrollCb = lockScroll());
|
|
51
|
+
} else {
|
|
52
|
+
removeBodyAdditions();
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
onUnmounted(removeBodyAdditions);
|
|
56
|
+
return { onClick };
|
|
57
|
+
}
|
|
58
|
+
function createBem(namespace, element, modifier) {
|
|
59
|
+
let cls = namespace;
|
|
60
|
+
if (element) {
|
|
61
|
+
cls += `__${element}`;
|
|
62
|
+
}
|
|
63
|
+
if (modifier) {
|
|
64
|
+
cls += `--${modifier}`;
|
|
65
|
+
}
|
|
66
|
+
return cls;
|
|
67
|
+
}
|
|
68
|
+
function useNamespace(block, needDot = false) {
|
|
69
|
+
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
70
|
+
const b = () => createBem(namespace);
|
|
71
|
+
const e = (element) => element ? createBem(namespace, element) : "";
|
|
72
|
+
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
73
|
+
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
74
|
+
return {
|
|
75
|
+
b,
|
|
76
|
+
e,
|
|
77
|
+
m,
|
|
78
|
+
em
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
var fixedOverlay = "";
|
|
82
|
+
const FixedOverlay = defineComponent({
|
|
83
|
+
name: "DFixedOverlay",
|
|
84
|
+
inheritAttrs: false,
|
|
85
|
+
props: fixedOverlayProps,
|
|
86
|
+
emits: ["update:modelValue", "click"],
|
|
87
|
+
setup(props, ctx) {
|
|
88
|
+
const {
|
|
89
|
+
modelValue
|
|
90
|
+
} = toRefs(props);
|
|
91
|
+
const ns = useNamespace("fixed-overlay");
|
|
92
|
+
const {
|
|
93
|
+
onClick
|
|
94
|
+
} = useFixedOverlay(props, ctx);
|
|
95
|
+
return () => createVNode(Transition, {
|
|
96
|
+
"name": ns.m("fade")
|
|
97
|
+
}, {
|
|
98
|
+
default: () => {
|
|
99
|
+
var _a, _b;
|
|
100
|
+
return [modelValue.value && createVNode("div", mergeProps({
|
|
101
|
+
"class": ns.b()
|
|
102
|
+
}, ctx.attrs, {
|
|
103
|
+
"onClick": onClick
|
|
104
|
+
}), [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])];
|
|
105
|
+
}
|
|
106
|
+
});
|
|
74
107
|
}
|
|
75
108
|
});
|
|
76
109
|
const flexibleOverlayProps = {
|
|
@@ -90,6 +123,9 @@ const flexibleOverlayProps = {
|
|
|
90
123
|
type: [Number, Object],
|
|
91
124
|
default: 8
|
|
92
125
|
},
|
|
126
|
+
shiftOffset: {
|
|
127
|
+
type: Number
|
|
128
|
+
},
|
|
93
129
|
align: {
|
|
94
130
|
type: String,
|
|
95
131
|
default: null
|
|
@@ -103,80 +139,6 @@ const flexibleOverlayProps = {
|
|
|
103
139
|
default: true
|
|
104
140
|
}
|
|
105
141
|
};
|
|
106
|
-
function useOverlayLogic(props, ctx) {
|
|
107
|
-
const backgroundClass = computed(() => {
|
|
108
|
-
return [
|
|
109
|
-
"devui-overlay-background",
|
|
110
|
-
props.backgroundClass,
|
|
111
|
-
!props.hasBackdrop ? "devui-overlay-background__disabled" : "devui-overlay-background__color"
|
|
112
|
-
];
|
|
113
|
-
});
|
|
114
|
-
const overlayClass = computed(() => {
|
|
115
|
-
return "devui-overlay";
|
|
116
|
-
});
|
|
117
|
-
const handleBackdropClick = (event) => {
|
|
118
|
-
var _a;
|
|
119
|
-
event.preventDefault();
|
|
120
|
-
(_a = props.onBackdropClick) == null ? void 0 : _a.call(props);
|
|
121
|
-
if (props.backdropClose) {
|
|
122
|
-
ctx.emit("update:visible", false);
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
const handleOverlayBubbleCancel = (event) => event.cancelBubble = true;
|
|
126
|
-
onMounted(() => {
|
|
127
|
-
const body = document.body;
|
|
128
|
-
const originOverflow = body.style.overflow;
|
|
129
|
-
const originPosition = body.style.position;
|
|
130
|
-
watch([() => props.visible, () => props.backgroundBlock], ([visible, backgroundBlock]) => {
|
|
131
|
-
if (backgroundBlock) {
|
|
132
|
-
const top = body.getBoundingClientRect().y;
|
|
133
|
-
if (visible) {
|
|
134
|
-
body.style.overflowY = "scroll";
|
|
135
|
-
body.style.position = visible ? "fixed" : "";
|
|
136
|
-
body.style.top = `${top}px`;
|
|
137
|
-
} else {
|
|
138
|
-
body.style.overflowY = originOverflow;
|
|
139
|
-
body.style.position = originPosition;
|
|
140
|
-
body.style.top = "";
|
|
141
|
-
window.scrollTo(0, -top);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
onUnmounted(() => {
|
|
146
|
-
document.body.style.overflow = originOverflow;
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
return {
|
|
150
|
-
backgroundClass,
|
|
151
|
-
overlayClass,
|
|
152
|
-
handleBackdropClick,
|
|
153
|
-
handleOverlayBubbleCancel
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
const FixedOverlay = defineComponent({
|
|
157
|
-
name: "DFixedOverlay",
|
|
158
|
-
props: fixedOverlayProps,
|
|
159
|
-
emits: overlayEmits,
|
|
160
|
-
setup(props, ctx) {
|
|
161
|
-
const {
|
|
162
|
-
backgroundClass,
|
|
163
|
-
overlayClass,
|
|
164
|
-
handleBackdropClick,
|
|
165
|
-
handleOverlayBubbleCancel
|
|
166
|
-
} = useOverlayLogic(props, ctx);
|
|
167
|
-
return () => createVNode(CommonOverlay, null, {
|
|
168
|
-
default: () => [props.visible && createVNode("div", {
|
|
169
|
-
"class": backgroundClass.value,
|
|
170
|
-
"style": props.backgroundStyle,
|
|
171
|
-
"onClick": handleBackdropClick
|
|
172
|
-
}, [createVNode("div", {
|
|
173
|
-
"class": overlayClass.value,
|
|
174
|
-
"style": props.overlayStyle,
|
|
175
|
-
"onClick": handleOverlayBubbleCancel
|
|
176
|
-
}, [renderSlot(ctx.slots, "default")])])]
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
142
|
function getScrollParent(element) {
|
|
181
143
|
const overflowRegex = /(auto|scroll|hidden)/;
|
|
182
144
|
for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
|
|
@@ -209,6 +171,7 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
|
209
171
|
function useOverlay(props, emit) {
|
|
210
172
|
const overlayRef = ref();
|
|
211
173
|
const arrowRef = ref();
|
|
174
|
+
let originParent = null;
|
|
212
175
|
const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
|
|
213
176
|
const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
|
|
214
177
|
const staticSide = {
|
|
@@ -237,34 +200,43 @@ function useOverlay(props, emit) {
|
|
|
237
200
|
})
|
|
238
201
|
];
|
|
239
202
|
props.showArrow && middleware.push(arrow({ element: arrowEl }));
|
|
203
|
+
props.shiftOffset !== void 0 && middleware.push(shift());
|
|
240
204
|
const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
|
|
241
205
|
strategy: "fixed",
|
|
242
206
|
middleware
|
|
243
207
|
});
|
|
208
|
+
let applyX = x;
|
|
209
|
+
let applyY = y;
|
|
210
|
+
if (props.shiftOffset !== void 0) {
|
|
211
|
+
const { x: shiftX, y: shiftY } = middlewareData.shift;
|
|
212
|
+
shiftX < 0 && (applyX -= props.shiftOffset);
|
|
213
|
+
shiftX > 0 && (applyX += props.shiftOffset);
|
|
214
|
+
shiftY < 0 && (applyY -= props.shiftOffset);
|
|
215
|
+
shiftY > 0 && (applyY += props.shiftOffset);
|
|
216
|
+
}
|
|
244
217
|
emit("positionChange", placement);
|
|
245
|
-
Object.assign(overlayEl.style, { top: `${
|
|
218
|
+
Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
|
|
246
219
|
props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
|
|
247
220
|
};
|
|
248
221
|
watch(() => props.modelValue, () => {
|
|
249
|
-
const originParent = getScrollParent(props.origin);
|
|
250
222
|
if (props.modelValue && props.origin) {
|
|
223
|
+
originParent = getScrollParent(props.origin);
|
|
251
224
|
nextTick(updatePosition);
|
|
252
|
-
originParent.addEventListener("scroll", updatePosition);
|
|
225
|
+
originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
|
|
253
226
|
originParent !== window && window.addEventListener("scroll", updatePosition);
|
|
254
227
|
window.addEventListener("resize", updatePosition);
|
|
255
228
|
} else {
|
|
256
|
-
originParent.removeEventListener("scroll", updatePosition);
|
|
229
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
257
230
|
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
258
231
|
window.removeEventListener("resize", updatePosition);
|
|
259
232
|
}
|
|
260
233
|
});
|
|
261
234
|
onUnmounted(() => {
|
|
262
|
-
|
|
263
|
-
originParent.removeEventListener("scroll", updatePosition);
|
|
235
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
264
236
|
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
265
237
|
window.removeEventListener("resize", updatePosition);
|
|
266
238
|
});
|
|
267
|
-
return { arrowRef, overlayRef };
|
|
239
|
+
return { arrowRef, overlayRef, updatePosition };
|
|
268
240
|
}
|
|
269
241
|
var flexibleOverlay = "";
|
|
270
242
|
const FlexibleOverlay = defineComponent({
|
|
@@ -275,20 +247,26 @@ const FlexibleOverlay = defineComponent({
|
|
|
275
247
|
setup(props, {
|
|
276
248
|
slots,
|
|
277
249
|
attrs,
|
|
278
|
-
emit
|
|
250
|
+
emit,
|
|
251
|
+
expose
|
|
279
252
|
}) {
|
|
253
|
+
const ns = useNamespace("flexible-overlay");
|
|
280
254
|
const {
|
|
281
255
|
arrowRef,
|
|
282
|
-
overlayRef
|
|
256
|
+
overlayRef,
|
|
257
|
+
updatePosition
|
|
283
258
|
} = useOverlay(props, emit);
|
|
259
|
+
expose({
|
|
260
|
+
updatePosition
|
|
261
|
+
});
|
|
284
262
|
return () => {
|
|
285
263
|
var _a;
|
|
286
264
|
return props.modelValue && createVNode("div", mergeProps({
|
|
287
265
|
"ref": overlayRef,
|
|
288
|
-
"class":
|
|
266
|
+
"class": ns.b()
|
|
289
267
|
}, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
|
|
290
268
|
"ref": arrowRef,
|
|
291
|
-
"class": "
|
|
269
|
+
"class": ns.e("arrow")
|
|
292
270
|
}, null)]);
|
|
293
271
|
};
|
|
294
272
|
}
|
|
@@ -312,4 +290,4 @@ var index = {
|
|
|
312
290
|
}
|
|
313
291
|
}
|
|
314
292
|
};
|
|
315
|
-
export { FixedOverlay, FlexibleOverlay, index as default, fixedOverlayProps, flexibleOverlayProps
|
|
293
|
+
export { FixedOverlay, FlexibleOverlay, index as default, fixedOverlayProps, flexibleOverlayProps };
|