@varlet/ui 2.16.7 → 2.16.8-alpha.1695118057982
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/es/action-sheet/ActionSheet.mjs +97 -67
- package/es/action-sheet/index.mjs +43 -28
- package/es/action-sheet/props.mjs +39 -8
- package/es/app-bar/AppBar.mjs +129 -56
- package/es/app-bar/index.mjs +10 -5
- package/es/app-bar/props.mjs +6 -3
- package/es/avatar/Avatar.mjs +97 -87
- package/es/avatar/index.mjs +10 -5
- package/es/avatar/props.mjs +8 -5
- package/es/avatar-group/AvatarGroup.mjs +26 -20
- package/es/avatar-group/index.mjs +10 -5
- package/es/avatar-group/props.mjs +5 -2
- package/es/back-top/BackTop.mjs +71 -53
- package/es/back-top/index.mjs +10 -5
- package/es/back-top/props.mjs +6 -3
- package/es/badge/Badge.mjs +74 -46
- package/es/badge/index.mjs +10 -5
- package/es/badge/props.mjs +7 -4
- package/es/bottom-navigation/BottomNavigation.mjs +100 -97
- package/es/bottom-navigation/index.mjs +10 -5
- package/es/bottom-navigation/props.mjs +7 -4
- package/es/bottom-navigation/provide.mjs +13 -9
- package/es/bottom-navigation-item/BottomNavigationItem.mjs +93 -74
- package/es/bottom-navigation-item/index.mjs +10 -5
- package/es/bottom-navigation-item/props.mjs +7 -4
- package/es/bottom-navigation-item/provide.mjs +14 -11
- package/es/breadcrumb/Breadcrumb.mjs +51 -36
- package/es/breadcrumb/index.mjs +10 -5
- package/es/breadcrumb/props.mjs +6 -3
- package/es/breadcrumb/provide.mjs +12 -11
- package/es/breadcrumbs/Breadcrumbs.mjs +26 -24
- package/es/breadcrumbs/index.mjs +10 -5
- package/es/breadcrumbs/props.mjs +6 -3
- package/es/breadcrumbs/provide.mjs +11 -9
- package/es/button/Button.mjs +88 -90
- package/es/button/index.mjs +10 -5
- package/es/button/props.mjs +31 -10
- package/es/button/provide.mjs +8 -9
- package/es/button-group/ButtonGroup.mjs +38 -26
- package/es/button-group/index.mjs +8 -4
- package/es/button-group/props.mjs +8 -5
- package/es/button-group/provide.mjs +9 -9
- package/es/card/Card.mjs +292 -189
- package/es/card/index.mjs +10 -5
- package/es/card/props.mjs +9 -6
- package/es/cell/Cell.mjs +96 -52
- package/es/cell/index.mjs +10 -5
- package/es/cell/props.mjs +6 -3
- package/es/checkbox/Checkbox.mjs +136 -130
- package/es/checkbox/index.mjs +10 -5
- package/es/checkbox/props.mjs +9 -6
- package/es/checkbox/provide.mjs +10 -9
- package/es/checkbox-group/CheckboxGroup.mjs +63 -96
- package/es/checkbox-group/index.mjs +10 -5
- package/es/checkbox-group/props.mjs +9 -6
- package/es/checkbox-group/provide.mjs +11 -9
- package/es/chip/Chip.mjs +66 -50
- package/es/chip/index.mjs +10 -5
- package/es/chip/props.mjs +10 -7
- package/es/col/Col.mjs +60 -55
- package/es/col/index.mjs +10 -5
- package/es/col/props.mjs +7 -4
- package/es/col/provide.mjs +8 -9
- package/es/collapse/Collapse.mjs +70 -73
- package/es/collapse/index.mjs +10 -5
- package/es/collapse/props.mjs +7 -4
- package/es/collapse/provide.mjs +11 -9
- package/es/collapse-item/CollapseItem.mjs +156 -93
- package/es/collapse-item/index.mjs +10 -5
- package/es/collapse-item/props.mjs +6 -3
- package/es/collapse-item/provide.mjs +12 -11
- package/es/context/index.mjs +9 -5
- package/es/context/lock.mjs +18 -22
- package/es/context/zIndex.mjs +19 -16
- package/es/countdown/Countdown.mjs +73 -70
- package/es/countdown/index.mjs +10 -5
- package/es/countdown/props.mjs +7 -4
- package/es/counter/Counter.mjs +169 -173
- package/es/counter/index.mjs +10 -5
- package/es/counter/props.mjs +8 -5
- package/es/counter/provide.ts +3 -0
- package/es/date-picker/DatePicker.mjs +411 -304
- package/es/date-picker/index.mjs +10 -5
- package/es/date-picker/props.mjs +71 -45
- package/es/date-picker/src/day-picker-panel.mjs +270 -208
- package/es/date-picker/src/month-picker-panel.mjs +205 -175
- package/es/date-picker/src/panel-header.mjs +101 -83
- package/es/date-picker/src/year-picker-panel.mjs +64 -54
- package/es/dialog/Dialog.mjs +171 -106
- package/es/dialog/index.mjs +49 -33
- package/es/dialog/props.mjs +39 -9
- package/es/divider/Divider.mjs +56 -51
- package/es/divider/index.mjs +10 -5
- package/es/divider/props.mjs +5 -2
- package/es/drag/Drag.mjs +126 -144
- package/es/drag/index.mjs +10 -5
- package/es/drag/props.mjs +8 -5
- package/es/ellipsis/Ellipsis.mjs +81 -50
- package/es/ellipsis/index.mjs +8 -4
- package/es/ellipsis/props.mjs +5 -2
- package/es/fab/Fab.mjs +73 -75
- package/es/fab/index.mjs +8 -4
- package/es/fab/props.mjs +14 -11
- package/es/field-decorator/FieldDecorator.mjs +215 -110
- package/es/field-decorator/props.mjs +9 -6
- package/es/form/Form.mjs +69 -79
- package/es/form/index.mjs +11 -6
- package/es/form/props.mjs +6 -3
- package/es/form/provide.mjs +35 -22
- package/es/form-details/FormDetails.mjs +81 -39
- package/es/form-details/index.mjs +10 -5
- package/es/form-details/props.mjs +7 -4
- package/es/hover/index.mjs +37 -40
- package/es/hover-overlay/HoverOverlay.mjs +18 -14
- package/es/hover-overlay/index.mjs +13 -8
- package/es/hover-overlay/props.mjs +5 -2
- package/es/icon/Icon.mjs +50 -33
- package/es/icon/index.mjs +10 -5
- package/es/icon/props.mjs +7 -4
- package/es/image/Image.mjs +76 -82
- package/es/image/index.mjs +10 -5
- package/es/image/props.mjs +7 -4
- package/es/image-preview/ImagePreview.mjs +176 -193
- package/es/image-preview/index.mjs +44 -30
- package/es/image-preview/props.mjs +34 -9
- package/es/index-anchor/IndexAnchor.mjs +45 -42
- package/es/index-anchor/index.mjs +10 -5
- package/es/index-anchor/props.mjs +5 -2
- package/es/index-anchor/provide.mjs +12 -11
- package/es/index-bar/IndexBar.mjs +130 -131
- package/es/index-bar/index.mjs +10 -5
- package/es/index-bar/props.mjs +6 -3
- package/es/index-bar/provide.mjs +11 -9
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/input/Input.mjs +231 -247
- package/es/input/index.mjs +10 -5
- package/es/input/props.mjs +38 -8
- package/es/input/provide.ts +3 -0
- package/es/lazy/index.mjs +94 -87
- package/es/link/Link.mjs +39 -45
- package/es/link/index.mjs +10 -5
- package/es/link/props.mjs +8 -5
- package/es/list/List.mjs +144 -97
- package/es/list/index.mjs +10 -5
- package/es/list/props.mjs +8 -5
- package/es/list/provide.mjs +8 -9
- package/es/loading/Loading.mjs +165 -72
- package/es/loading/index.mjs +10 -5
- package/es/loading/props.mjs +7 -4
- package/es/loading-bar/LoadingBar.mjs +19 -16
- package/es/loading-bar/index.mjs +37 -30
- package/es/loading-bar/props.mjs +5 -2
- package/es/locale/en-US.mjs +76 -73
- package/es/locale/index.mjs +52 -41
- package/es/locale/zh-CN.mjs +76 -73
- package/es/menu/Menu.mjs +76 -57
- package/es/menu/index.mjs +10 -5
- package/es/menu/props.mjs +11 -8
- package/es/menu/usePopover.mjs +214 -207
- package/es/option/Option.mjs +86 -70
- package/es/option/index.mjs +10 -5
- package/es/option/props.mjs +5 -2
- package/es/option/provide.mjs +10 -11
- package/es/overlay/Overlay.mjs +29 -31
- package/es/overlay/index.mjs +10 -5
- package/es/overlay/props.mjs +7 -4
- package/es/pagination/Pagination.mjs +334 -202
- package/es/pagination/index.mjs +10 -5
- package/es/pagination/props.mjs +8 -5
- package/es/paper/Paper.mjs +43 -31
- package/es/paper/index.mjs +10 -5
- package/es/paper/props.mjs +6 -3
- package/es/picker/Picker.mjs +288 -224
- package/es/picker/index.mjs +24 -23
- package/es/picker/props.mjs +37 -7
- package/es/popup/Popup.mjs +68 -58
- package/es/popup/index.mjs +10 -5
- package/es/popup/props.mjs +9 -6
- package/es/popup/provide.mjs +12 -15
- package/es/progress/Progress.mjs +186 -114
- package/es/progress/index.mjs +10 -5
- package/es/progress/props.mjs +7 -4
- package/es/pull-refresh/PullRefresh.mjs +136 -116
- package/es/pull-refresh/index.mjs +10 -5
- package/es/pull-refresh/props.mjs +8 -5
- package/es/radio/Radio.mjs +122 -118
- package/es/radio/index.mjs +10 -5
- package/es/radio/props.mjs +8 -5
- package/es/radio/provide.mjs +8 -9
- package/es/radio-group/RadioGroup.mjs +50 -58
- package/es/radio-group/index.mjs +10 -5
- package/es/radio-group/props.mjs +10 -7
- package/es/radio-group/provide.mjs +11 -9
- package/es/rate/Rate.mjs +103 -132
- package/es/rate/index.mjs +10 -5
- package/es/rate/props.mjs +10 -7
- package/es/rate/provide.ts +3 -0
- package/es/result/Empty.mjs +21 -12
- package/es/result/Error.mjs +18 -9
- package/es/result/Info.mjs +18 -9
- package/es/result/Question.mjs +18 -9
- package/es/result/Result.mjs +102 -55
- package/es/result/Success.mjs +84 -40
- package/es/result/Warning.mjs +18 -9
- package/es/result/index.mjs +10 -5
- package/es/result/props.mjs +6 -3
- package/es/ripple/index.mjs +89 -101
- package/es/row/Row.mjs +40 -45
- package/es/row/index.mjs +10 -5
- package/es/row/props.mjs +8 -5
- package/es/row/provide.mjs +9 -9
- package/es/select/Select.mjs +308 -298
- package/es/select/index.mjs +10 -5
- package/es/select/props.mjs +40 -10
- package/es/select/provide.mjs +9 -9
- package/es/skeleton/Skeleton.mjs +182 -71
- package/es/skeleton/index.mjs +10 -5
- package/es/skeleton/props.mjs +5 -2
- package/es/slider/Slider.mjs +310 -260
- package/es/slider/index.mjs +10 -5
- package/es/slider/props.mjs +15 -11
- package/es/slider/provide.ts +3 -0
- package/es/snackbar/Snackbar.mjs +47 -34
- package/es/snackbar/core.mjs +140 -77
- package/es/snackbar/index.mjs +111 -97
- package/es/snackbar/props.mjs +35 -14
- package/es/space/Space.mjs +30 -28
- package/es/space/index.mjs +10 -5
- package/es/space/margin.mjs +22 -23
- package/es/space/props.mjs +8 -5
- package/es/step/Step.mjs +96 -74
- package/es/step/index.mjs +10 -5
- package/es/step/props.mjs +6 -3
- package/es/step/provide.mjs +10 -11
- package/es/steps/Steps.mjs +31 -30
- package/es/steps/index.mjs +10 -5
- package/es/steps/props.mjs +7 -4
- package/es/steps/provide.mjs +9 -8
- package/es/sticky/Sticky.mjs +104 -92
- package/es/sticky/index.mjs +10 -5
- package/es/sticky/props.mjs +6 -3
- package/es/style-provider/StyleProvider.mjs +19 -18
- package/es/style-provider/index.mjs +15 -11
- package/es/style-provider/props.mjs +6 -3
- package/es/swipe/Swipe.mjs +281 -268
- package/es/swipe/index.mjs +10 -5
- package/es/swipe/props.mjs +6 -3
- package/es/swipe/provide.mjs +11 -9
- package/es/swipe-item/SwipeItem.mjs +29 -29
- package/es/swipe-item/index.mjs +8 -4
- package/es/swipe-item/provide.mjs +10 -11
- package/es/switch/Switch.mjs +143 -103
- package/es/switch/index.mjs +10 -5
- package/es/switch/props.mjs +7 -4
- package/es/switch/provide.ts +3 -0
- package/es/tab/Tab.mjs +48 -61
- package/es/tab/index.mjs +10 -5
- package/es/tab/props.mjs +6 -3
- package/es/tab/provide.mjs +10 -11
- package/es/tab-item/TabItem.mjs +27 -32
- package/es/tab-item/index.mjs +10 -5
- package/es/tab-item/props.mjs +5 -2
- package/es/tab-item/provide.mjs +17 -18
- package/es/table/Table.mjs +54 -25
- package/es/table/index.mjs +10 -5
- package/es/table/props.mjs +6 -3
- package/es/tabs/Tabs.mjs +162 -134
- package/es/tabs/index.mjs +10 -5
- package/es/tabs/props.mjs +15 -12
- package/es/tabs/provide.mjs +9 -9
- package/es/tabs-items/TabsItems.mjs +61 -65
- package/es/tabs-items/index.mjs +10 -5
- package/es/tabs-items/props.mjs +7 -4
- package/es/tabs-items/provide.mjs +11 -9
- package/es/themes/dark/actionSheet.mjs +8 -5
- package/es/themes/dark/appBar.mjs +6 -3
- package/es/themes/dark/avatar.mjs +7 -4
- package/es/themes/dark/badge.mjs +6 -3
- package/es/themes/dark/bottomNavigation.mjs +7 -4
- package/es/themes/dark/bottomNavigationItem.mjs +6 -3
- package/es/themes/dark/breadcrumb.mjs +6 -3
- package/es/themes/dark/button.mjs +7 -4
- package/es/themes/dark/card.mjs +10 -7
- package/es/themes/dark/cell.mjs +7 -4
- package/es/themes/dark/checkbox.mjs +7 -4
- package/es/themes/dark/chip.mjs +7 -4
- package/es/themes/dark/collapse.mjs +8 -5
- package/es/themes/dark/countdown.mjs +6 -3
- package/es/themes/dark/datePicker.mjs +10 -7
- package/es/themes/dark/dialog.mjs +8 -5
- package/es/themes/dark/divider.mjs +7 -4
- package/es/themes/dark/fieldDecorator.mjs +7 -4
- package/es/themes/dark/index.mjs +69 -51
- package/es/themes/dark/link.mjs +6 -3
- package/es/themes/dark/menu.mjs +6 -3
- package/es/themes/dark/option.mjs +6 -3
- package/es/themes/dark/pagination.mjs +11 -8
- package/es/themes/dark/paper.mjs +6 -3
- package/es/themes/dark/picker.mjs +11 -8
- package/es/themes/dark/popup.mjs +6 -3
- package/es/themes/dark/progress.mjs +6 -3
- package/es/themes/dark/pullRefresh.mjs +6 -3
- package/es/themes/dark/radio.mjs +7 -4
- package/es/themes/dark/result.mjs +12 -9
- package/es/themes/dark/select.mjs +6 -3
- package/es/themes/dark/skeleton.mjs +11 -6
- package/es/themes/dark/steps.mjs +8 -5
- package/es/themes/dark/switch.mjs +7 -4
- package/es/themes/dark/tab.mjs +6 -3
- package/es/themes/dark/table.mjs +12 -9
- package/es/themes/dark/tabs.mjs +6 -3
- package/es/themes/dark/timePicker.mjs +9 -6
- package/es/themes/dark/uploader.mjs +10 -7
- package/es/themes/dark/watermark.mjs +6 -3
- package/es/themes/index.mjs +7 -5
- package/es/time-picker/TimePicker.mjs +297 -232
- package/es/time-picker/clock.mjs +222 -172
- package/es/time-picker/index.mjs +10 -5
- package/es/time-picker/props.mjs +14 -8
- package/es/time-picker/utils.mjs +46 -86
- package/es/tooltip/Tooltip.mjs +82 -62
- package/es/tooltip/index.mjs +10 -5
- package/es/tooltip/props.mjs +12 -9
- package/es/uploader/Uploader.mjs +315 -308
- package/es/uploader/index.mjs +10 -5
- package/es/uploader/props.mjs +10 -7
- package/es/uploader/provide.ts +3 -0
- package/es/utils/components.mjs +158 -127
- package/es/utils/elements.mjs +106 -123
- package/es/utils/logger.mjs +9 -5
- package/es/utils/shared.mjs +25 -23
- package/es/utils/test.mjs +105 -93
- package/es/varlet.esm.js +12464 -13425
- package/es/watermark/Watermark.mjs +191 -109
- package/es/watermark/index.mjs +8 -4
- package/es/watermark/props.mjs +8 -5
- package/highlight/web-types.en-US.json +3 -3
- package/highlight/web-types.zh-CN.json +2 -2
- package/lib/varlet.cjs.js +9187 -10199
- package/package.json +7 -7
- package/umd/varlet.js +4 -4
- package/es/counter/provide.mjs +0 -1
- package/es/input/provide.mjs +0 -1
- package/es/rate/provide.mjs +0 -1
- package/es/slider/provide.mjs +0 -1
- package/es/switch/provide.mjs +0 -1
- package/es/uploader/provide.mjs +0 -1
package/es/menu/usePopover.mjs
CHANGED
|
@@ -1,24 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
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
|
+
var __async = (__this, __arguments, generator) => {
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
var fulfilled = (value) => {
|
|
23
|
+
try {
|
|
24
|
+
step(generator.next(value));
|
|
25
|
+
} catch (e) {
|
|
26
|
+
reject(e);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var rejected = (value) => {
|
|
30
|
+
try {
|
|
31
|
+
step(generator.throw(value));
|
|
32
|
+
} catch (e) {
|
|
33
|
+
reject(e);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
37
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
20
38
|
});
|
|
21
|
-
|
|
39
|
+
};
|
|
40
|
+
import flip from "@popperjs/core/lib/modifiers/flip";
|
|
41
|
+
import offset from "@popperjs/core/lib/modifiers/offset";
|
|
42
|
+
import computeStyles from "@popperjs/core/lib/modifiers/computeStyles";
|
|
43
|
+
import { useClickOutside } from "@varlet/use";
|
|
44
|
+
import { doubleRaf, getStyle } from "@varlet/shared";
|
|
45
|
+
import { toPxNum } from "../utils/elements.mjs";
|
|
46
|
+
import { call, useVModel } from "../utils/components.mjs";
|
|
47
|
+
import { onMounted, onUnmounted, ref, watch } from "vue";
|
|
48
|
+
import { createPopper } from "@popperjs/core/lib/popper-lite";
|
|
49
|
+
import { useZIndex } from "../context/zIndex.mjs";
|
|
50
|
+
function usePopover(options) {
|
|
51
|
+
const host = ref(null);
|
|
52
|
+
const popover = ref(null);
|
|
53
|
+
const hostSize = ref({ width: 0, height: 0 });
|
|
54
|
+
const show = useVModel(options, "show", {
|
|
22
55
|
passive: true,
|
|
23
56
|
defaultValue: false,
|
|
24
57
|
emit(event, value) {
|
|
@@ -30,279 +63,250 @@ export function usePopover(options) {
|
|
|
30
63
|
}
|
|
31
64
|
}
|
|
32
65
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var computeHostSize = () => {
|
|
40
|
-
var {
|
|
41
|
-
width,
|
|
42
|
-
height
|
|
43
|
-
} = getStyle(host.value);
|
|
66
|
+
const { zIndex } = useZIndex(() => show.value, 1);
|
|
67
|
+
let popoverInstance = null;
|
|
68
|
+
let enterPopover = false;
|
|
69
|
+
let enterHost = false;
|
|
70
|
+
const computeHostSize = () => {
|
|
71
|
+
const { width, height } = getStyle(host.value);
|
|
44
72
|
hostSize.value = {
|
|
45
73
|
width: toPxNum(width),
|
|
46
74
|
height: toPxNum(height)
|
|
47
75
|
};
|
|
48
76
|
};
|
|
49
|
-
|
|
77
|
+
const getTransformOrigin = () => {
|
|
50
78
|
switch (options.placement) {
|
|
51
|
-
case
|
|
52
|
-
case
|
|
53
|
-
return
|
|
54
|
-
case
|
|
55
|
-
case
|
|
56
|
-
case
|
|
57
|
-
return
|
|
58
|
-
case
|
|
59
|
-
case
|
|
60
|
-
case
|
|
61
|
-
return
|
|
62
|
-
case
|
|
63
|
-
case
|
|
64
|
-
return
|
|
65
|
-
case
|
|
66
|
-
case
|
|
67
|
-
case
|
|
68
|
-
return
|
|
69
|
-
case
|
|
70
|
-
case
|
|
71
|
-
case
|
|
72
|
-
return
|
|
73
|
-
case
|
|
74
|
-
case
|
|
75
|
-
return
|
|
76
|
-
case
|
|
77
|
-
case
|
|
78
|
-
return
|
|
79
|
+
case "top":
|
|
80
|
+
case "cover-bottom":
|
|
81
|
+
return "bottom";
|
|
82
|
+
case "top-start":
|
|
83
|
+
case "right-end":
|
|
84
|
+
case "cover-bottom-start":
|
|
85
|
+
return "bottom left";
|
|
86
|
+
case "top-end":
|
|
87
|
+
case "left-end":
|
|
88
|
+
case "cover-bottom-end":
|
|
89
|
+
return "bottom right";
|
|
90
|
+
case "bottom":
|
|
91
|
+
case "cover-top":
|
|
92
|
+
return "top";
|
|
93
|
+
case "bottom-start":
|
|
94
|
+
case "right-start":
|
|
95
|
+
case "cover-top-start":
|
|
96
|
+
return "top left";
|
|
97
|
+
case "bottom-end":
|
|
98
|
+
case "left-start":
|
|
99
|
+
case "cover-top-end":
|
|
100
|
+
return "top right";
|
|
101
|
+
case "left":
|
|
102
|
+
case "cover-right":
|
|
103
|
+
return "right";
|
|
104
|
+
case "right":
|
|
105
|
+
case "cover-left":
|
|
106
|
+
return "left";
|
|
79
107
|
}
|
|
80
108
|
};
|
|
81
|
-
|
|
82
|
-
if (options.trigger !==
|
|
109
|
+
const handleHostMouseenter = () => {
|
|
110
|
+
if (options.trigger !== "hover") {
|
|
83
111
|
return;
|
|
84
112
|
}
|
|
85
113
|
enterHost = true;
|
|
86
114
|
open();
|
|
87
115
|
};
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return _ref.apply(this, arguments);
|
|
102
|
-
};
|
|
103
|
-
}();
|
|
104
|
-
var handlePopoverMouseenter = () => {
|
|
105
|
-
if (options.trigger !== 'hover') {
|
|
116
|
+
const handleHostMouseleave = () => __async(this, null, function* () {
|
|
117
|
+
if (options.trigger !== "hover") {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
enterHost = false;
|
|
121
|
+
yield doubleRaf();
|
|
122
|
+
if (enterPopover) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
close();
|
|
126
|
+
});
|
|
127
|
+
const handlePopoverMouseenter = () => {
|
|
128
|
+
if (options.trigger !== "hover") {
|
|
106
129
|
return;
|
|
107
130
|
}
|
|
108
131
|
enterPopover = true;
|
|
109
132
|
};
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return function handlePopoverMouseleave() {
|
|
123
|
-
return _ref2.apply(this, arguments);
|
|
124
|
-
};
|
|
125
|
-
}();
|
|
126
|
-
var handleHostClick = () => {
|
|
133
|
+
const handlePopoverMouseleave = () => __async(this, null, function* () {
|
|
134
|
+
if (options.trigger !== "hover") {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
enterPopover = false;
|
|
138
|
+
yield doubleRaf();
|
|
139
|
+
if (enterHost) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
close();
|
|
143
|
+
});
|
|
144
|
+
const handleHostClick = () => {
|
|
127
145
|
if (options.closeOnClickReference && show.value) {
|
|
128
146
|
close();
|
|
129
147
|
} else {
|
|
130
148
|
open();
|
|
131
149
|
}
|
|
132
150
|
};
|
|
133
|
-
|
|
151
|
+
const handlePopoverClose = () => {
|
|
134
152
|
close();
|
|
135
153
|
};
|
|
136
|
-
|
|
137
|
-
if (options.trigger !==
|
|
154
|
+
const handleClickOutside = (e) => {
|
|
155
|
+
if (options.trigger !== "click") {
|
|
138
156
|
return;
|
|
139
157
|
}
|
|
140
158
|
handlePopoverClose();
|
|
141
159
|
call(options.onClickOutside, e);
|
|
142
160
|
};
|
|
143
|
-
|
|
161
|
+
const handleClosed = () => {
|
|
144
162
|
resize();
|
|
145
163
|
call(options.onClosed);
|
|
146
164
|
};
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
offsetX,
|
|
150
|
-
offsetY,
|
|
151
|
-
placement
|
|
152
|
-
} = options;
|
|
165
|
+
const getPosition = () => {
|
|
166
|
+
const { offsetX, offsetY, placement } = options;
|
|
153
167
|
computeHostSize();
|
|
154
|
-
|
|
168
|
+
const offset2 = {
|
|
155
169
|
x: toPxNum(offsetX),
|
|
156
170
|
y: toPxNum(offsetY)
|
|
157
171
|
};
|
|
158
172
|
switch (placement) {
|
|
159
|
-
case
|
|
173
|
+
case "cover-top":
|
|
160
174
|
return {
|
|
161
|
-
placement:
|
|
162
|
-
skidding:
|
|
163
|
-
distance:
|
|
175
|
+
placement: "bottom",
|
|
176
|
+
skidding: offset2.x,
|
|
177
|
+
distance: offset2.y - hostSize.value.height
|
|
164
178
|
};
|
|
165
|
-
case
|
|
179
|
+
case "cover-top-start":
|
|
166
180
|
return {
|
|
167
|
-
placement:
|
|
168
|
-
skidding:
|
|
169
|
-
distance:
|
|
181
|
+
placement: "bottom-start",
|
|
182
|
+
skidding: offset2.x,
|
|
183
|
+
distance: offset2.y - hostSize.value.height
|
|
170
184
|
};
|
|
171
|
-
case
|
|
185
|
+
case "cover-top-end":
|
|
172
186
|
return {
|
|
173
|
-
placement:
|
|
174
|
-
skidding:
|
|
175
|
-
distance:
|
|
187
|
+
placement: "bottom-end",
|
|
188
|
+
skidding: offset2.x,
|
|
189
|
+
distance: offset2.y - hostSize.value.height
|
|
176
190
|
};
|
|
177
|
-
case
|
|
191
|
+
case "cover-bottom":
|
|
178
192
|
return {
|
|
179
|
-
placement:
|
|
180
|
-
skidding:
|
|
181
|
-
distance: -
|
|
193
|
+
placement: "top",
|
|
194
|
+
skidding: offset2.x,
|
|
195
|
+
distance: -offset2.y - hostSize.value.height
|
|
182
196
|
};
|
|
183
|
-
case
|
|
197
|
+
case "cover-bottom-start":
|
|
184
198
|
return {
|
|
185
|
-
placement:
|
|
186
|
-
skidding:
|
|
187
|
-
distance: -
|
|
199
|
+
placement: "top-start",
|
|
200
|
+
skidding: offset2.x,
|
|
201
|
+
distance: -offset2.y - hostSize.value.height
|
|
188
202
|
};
|
|
189
|
-
case
|
|
203
|
+
case "cover-bottom-end":
|
|
190
204
|
return {
|
|
191
|
-
placement:
|
|
192
|
-
skidding:
|
|
193
|
-
distance: -
|
|
205
|
+
placement: "top-end",
|
|
206
|
+
skidding: offset2.x,
|
|
207
|
+
distance: -offset2.y - hostSize.value.height
|
|
194
208
|
};
|
|
195
|
-
case
|
|
209
|
+
case "cover-left":
|
|
196
210
|
return {
|
|
197
|
-
placement:
|
|
198
|
-
skidding:
|
|
199
|
-
distance:
|
|
211
|
+
placement: "right",
|
|
212
|
+
skidding: offset2.y,
|
|
213
|
+
distance: offset2.x - hostSize.value.width
|
|
200
214
|
};
|
|
201
|
-
case
|
|
215
|
+
case "cover-right":
|
|
202
216
|
return {
|
|
203
|
-
placement:
|
|
204
|
-
skidding:
|
|
205
|
-
distance: -
|
|
217
|
+
placement: "left",
|
|
218
|
+
skidding: offset2.y,
|
|
219
|
+
distance: -offset2.x - hostSize.value.width
|
|
206
220
|
};
|
|
207
|
-
case
|
|
208
|
-
case
|
|
209
|
-
case
|
|
221
|
+
case "left":
|
|
222
|
+
case "left-start":
|
|
223
|
+
case "left-end":
|
|
210
224
|
return {
|
|
211
225
|
placement,
|
|
212
|
-
skidding:
|
|
213
|
-
distance: -
|
|
226
|
+
skidding: offset2.y,
|
|
227
|
+
distance: -offset2.x
|
|
214
228
|
};
|
|
215
|
-
case
|
|
216
|
-
case
|
|
217
|
-
case
|
|
229
|
+
case "top":
|
|
230
|
+
case "top-start":
|
|
231
|
+
case "top-end":
|
|
218
232
|
return {
|
|
219
233
|
placement,
|
|
220
|
-
skidding:
|
|
221
|
-
distance: -
|
|
234
|
+
skidding: offset2.x,
|
|
235
|
+
distance: -offset2.y
|
|
222
236
|
};
|
|
223
|
-
case
|
|
224
|
-
case
|
|
225
|
-
case
|
|
237
|
+
case "bottom":
|
|
238
|
+
case "bottom-start":
|
|
239
|
+
case "bottom-end":
|
|
226
240
|
return {
|
|
227
241
|
placement,
|
|
228
|
-
skidding:
|
|
229
|
-
distance:
|
|
242
|
+
skidding: offset2.x,
|
|
243
|
+
distance: offset2.y
|
|
230
244
|
};
|
|
231
|
-
case
|
|
232
|
-
case
|
|
233
|
-
case
|
|
245
|
+
case "right":
|
|
246
|
+
case "right-start":
|
|
247
|
+
case "right-end":
|
|
234
248
|
return {
|
|
235
249
|
placement,
|
|
236
|
-
skidding:
|
|
237
|
-
distance:
|
|
250
|
+
skidding: offset2.y,
|
|
251
|
+
distance: offset2.x
|
|
238
252
|
};
|
|
239
253
|
}
|
|
240
254
|
};
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
} = _ref3;
|
|
267
|
-
state.styles.popper.transformOrigin = getTransformOrigin();
|
|
255
|
+
const getPopperOptions = () => {
|
|
256
|
+
const { placement, skidding, distance } = getPosition();
|
|
257
|
+
const modifiers = [
|
|
258
|
+
__spreadProps(__spreadValues({}, flip), {
|
|
259
|
+
enabled: show.value
|
|
260
|
+
}),
|
|
261
|
+
__spreadProps(__spreadValues({}, offset), {
|
|
262
|
+
options: {
|
|
263
|
+
offset: [skidding, distance]
|
|
264
|
+
}
|
|
265
|
+
}),
|
|
266
|
+
__spreadProps(__spreadValues({}, computeStyles), {
|
|
267
|
+
options: {
|
|
268
|
+
adaptive: false,
|
|
269
|
+
gpuAcceleration: false
|
|
270
|
+
},
|
|
271
|
+
enabled: show.value
|
|
272
|
+
}),
|
|
273
|
+
{
|
|
274
|
+
name: "applyTransformOrigin",
|
|
275
|
+
enabled: show.value,
|
|
276
|
+
phase: "beforeWrite",
|
|
277
|
+
fn({ state }) {
|
|
278
|
+
state.styles.popper.transformOrigin = getTransformOrigin();
|
|
279
|
+
}
|
|
268
280
|
}
|
|
269
|
-
|
|
281
|
+
];
|
|
270
282
|
return {
|
|
271
283
|
placement,
|
|
272
284
|
modifiers,
|
|
273
285
|
strategy: options.strategy
|
|
274
286
|
};
|
|
275
287
|
};
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
// expose
|
|
279
|
-
var resize = () => {
|
|
288
|
+
const getReference = () => options.reference ? host.value.querySelector(options.reference) : host.value;
|
|
289
|
+
const resize = () => {
|
|
280
290
|
popoverInstance.setOptions(getPopperOptions());
|
|
281
291
|
};
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
var open = () => {
|
|
285
|
-
var {
|
|
286
|
-
disabled
|
|
287
|
-
} = options;
|
|
292
|
+
const open = () => {
|
|
293
|
+
const { disabled } = options;
|
|
288
294
|
if (disabled) {
|
|
289
295
|
return;
|
|
290
296
|
}
|
|
291
297
|
show.value = true;
|
|
292
|
-
call(options[
|
|
298
|
+
call(options["onUpdate:show"], true);
|
|
293
299
|
};
|
|
294
|
-
|
|
295
|
-
// expose
|
|
296
|
-
var close = () => {
|
|
300
|
+
const close = () => {
|
|
297
301
|
show.value = false;
|
|
298
|
-
call(options[
|
|
302
|
+
call(options["onUpdate:show"], false);
|
|
299
303
|
};
|
|
300
|
-
useClickOutside(getReference,
|
|
304
|
+
useClickOutside(getReference, "click", handleClickOutside);
|
|
301
305
|
watch(() => [options.offsetX, options.offsetY, options.placement, options.strategy], resize);
|
|
302
306
|
watch(() => options.disabled, close);
|
|
303
307
|
onMounted(() => {
|
|
304
|
-
var
|
|
305
|
-
popoverInstance = createPopper((
|
|
308
|
+
var _a;
|
|
309
|
+
popoverInstance = createPopper((_a = getReference()) != null ? _a : host.value, popover.value, getPopperOptions());
|
|
306
310
|
});
|
|
307
311
|
onUnmounted(() => {
|
|
308
312
|
popoverInstance.destroy();
|
|
@@ -324,4 +328,7 @@ export function usePopover(options) {
|
|
|
324
328
|
open,
|
|
325
329
|
close
|
|
326
330
|
};
|
|
327
|
-
}
|
|
331
|
+
}
|
|
332
|
+
export {
|
|
333
|
+
usePopover
|
|
334
|
+
};
|