@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/snackbar/index.mjs
CHANGED
|
@@ -1,74 +1,90 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
import { createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
|
|
18
|
+
import VarSnackbarCore from "./core.mjs";
|
|
19
|
+
import VarSnackbar from "./Snackbar.mjs";
|
|
20
|
+
import context from "../context/index.mjs";
|
|
21
|
+
import { reactive, TransitionGroup } from "vue";
|
|
22
|
+
import { call, mountInstance, withInstall } from "../utils/components.mjs";
|
|
23
|
+
import { isFunction, isPlainObject, isString, toNumber } from "@varlet/shared";
|
|
24
|
+
const SNACKBAR_TYPE = ["loading", "success", "warning", "info", "error"];
|
|
25
|
+
let sid = 0;
|
|
26
|
+
let isMount = false;
|
|
27
|
+
let unmount;
|
|
28
|
+
let isAllowMultiple = false;
|
|
29
|
+
const defaultOptionsValue = {
|
|
30
|
+
type: void 0,
|
|
31
|
+
content: "",
|
|
32
|
+
icon: "",
|
|
33
|
+
action: "",
|
|
34
|
+
position: "top",
|
|
35
|
+
duration: 3e3,
|
|
24
36
|
vertical: false,
|
|
25
|
-
contentClass:
|
|
26
|
-
loadingType:
|
|
27
|
-
loadingSize:
|
|
37
|
+
contentClass: void 0,
|
|
38
|
+
loadingType: "circle",
|
|
39
|
+
loadingSize: "normal",
|
|
28
40
|
lockScroll: false,
|
|
29
|
-
teleport:
|
|
41
|
+
teleport: "body",
|
|
30
42
|
forbidClick: false,
|
|
31
|
-
onOpen: () => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
onOpen: () => {
|
|
44
|
+
},
|
|
45
|
+
onOpened: () => {
|
|
46
|
+
},
|
|
47
|
+
onClose: () => {
|
|
48
|
+
},
|
|
49
|
+
onClosed: () => {
|
|
50
|
+
}
|
|
35
51
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
name:
|
|
40
|
-
tag:
|
|
41
|
-
class:
|
|
52
|
+
let uniqSnackbarOptions = reactive([]);
|
|
53
|
+
let defaultOptions = defaultOptionsValue;
|
|
54
|
+
const transitionGroupProps = {
|
|
55
|
+
name: "var-snackbar-fade",
|
|
56
|
+
tag: "div",
|
|
57
|
+
class: "var-transition-group"
|
|
42
58
|
};
|
|
43
|
-
|
|
44
|
-
|
|
59
|
+
const getSlotValue = (value) => () => isFunction(value) ? value() : value;
|
|
60
|
+
const TransitionGroupHost = {
|
|
45
61
|
setup() {
|
|
46
62
|
return () => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (reactiveSnackOptions.forbidClick || reactiveSnackOptions.type === 'loading') {
|
|
63
|
+
const snackbarList = uniqSnackbarOptions.map(({
|
|
64
|
+
id,
|
|
65
|
+
reactiveSnackOptions,
|
|
66
|
+
_update
|
|
67
|
+
}) => {
|
|
68
|
+
const transitionGroupEl = document.querySelector(".var-transition-group");
|
|
69
|
+
if (reactiveSnackOptions.forbidClick || reactiveSnackOptions.type === "loading") {
|
|
55
70
|
;
|
|
56
|
-
transitionGroupEl.classList.add(
|
|
71
|
+
transitionGroupEl.classList.add("var-pointer-auto");
|
|
57
72
|
} else {
|
|
58
73
|
;
|
|
59
|
-
transitionGroupEl.classList.remove(
|
|
74
|
+
transitionGroupEl.classList.remove("var-pointer-auto");
|
|
60
75
|
}
|
|
61
|
-
if (isAllowMultiple)
|
|
62
|
-
|
|
63
|
-
|
|
76
|
+
if (isAllowMultiple)
|
|
77
|
+
reactiveSnackOptions.position = "top";
|
|
78
|
+
const position = isAllowMultiple ? "relative" : "absolute";
|
|
79
|
+
const style = __spreadValues({
|
|
64
80
|
position
|
|
65
81
|
}, getTop(reactiveSnackOptions.position));
|
|
66
|
-
|
|
82
|
+
const {
|
|
67
83
|
content,
|
|
68
84
|
icon,
|
|
69
85
|
action
|
|
70
86
|
} = reactiveSnackOptions;
|
|
71
|
-
|
|
87
|
+
const slots = {
|
|
72
88
|
default: getSlotValue(content),
|
|
73
89
|
icon: getSlotValue(icon),
|
|
74
90
|
action: getSlotValue(action)
|
|
@@ -78,8 +94,8 @@ var TransitionGroupHost = {
|
|
|
78
94
|
"style": style,
|
|
79
95
|
"data-id": id,
|
|
80
96
|
"_update": _update,
|
|
81
|
-
|
|
82
|
-
"onUpdate:show": $event => reactiveSnackOptions.show = $event
|
|
97
|
+
"show": reactiveSnackOptions.show,
|
|
98
|
+
"onUpdate:show": ($event) => reactiveSnackOptions.show = $event
|
|
83
99
|
}), slots);
|
|
84
100
|
});
|
|
85
101
|
return _createVNode(TransitionGroup, _mergeProps(transitionGroupProps, {
|
|
@@ -88,31 +104,31 @@ var TransitionGroupHost = {
|
|
|
88
104
|
},
|
|
89
105
|
"onAfterEnter": opened,
|
|
90
106
|
"onAfterLeave": removeUniqOption
|
|
91
|
-
}),
|
|
107
|
+
}), {
|
|
92
108
|
default: () => [snackbarList]
|
|
93
109
|
});
|
|
94
110
|
};
|
|
95
111
|
}
|
|
96
112
|
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
113
|
+
const Snackbar = function(options) {
|
|
114
|
+
const snackOptions = normalizeOptions(options);
|
|
115
|
+
const reactiveSnackOptions = reactive(__spreadValues(__spreadValues({}, defaultOptions), snackOptions));
|
|
100
116
|
reactiveSnackOptions.show = true;
|
|
101
117
|
if (!isMount) {
|
|
102
118
|
isMount = true;
|
|
103
119
|
unmount = mountInstance(TransitionGroupHost).unmountInstance;
|
|
104
120
|
}
|
|
105
|
-
|
|
121
|
+
const {
|
|
106
122
|
length
|
|
107
123
|
} = uniqSnackbarOptions;
|
|
108
|
-
|
|
124
|
+
const uniqSnackbarOptionItem = {
|
|
109
125
|
id: sid++,
|
|
110
126
|
reactiveSnackOptions
|
|
111
127
|
};
|
|
112
128
|
if (length === 0 || isAllowMultiple) {
|
|
113
129
|
addUniqOption(uniqSnackbarOptionItem);
|
|
114
130
|
} else {
|
|
115
|
-
|
|
131
|
+
const _update = `update-${sid}`;
|
|
116
132
|
updateUniqOption(reactiveSnackOptions, _update);
|
|
117
133
|
}
|
|
118
134
|
return {
|
|
@@ -125,8 +141,8 @@ var Snackbar = function (options) {
|
|
|
125
141
|
}
|
|
126
142
|
};
|
|
127
143
|
};
|
|
128
|
-
SNACKBAR_TYPE.forEach(type => {
|
|
129
|
-
Snackbar[type] = options => {
|
|
144
|
+
SNACKBAR_TYPE.forEach((type) => {
|
|
145
|
+
Snackbar[type] = (options) => {
|
|
130
146
|
if (isPlainObject(options)) {
|
|
131
147
|
options.type = type;
|
|
132
148
|
} else {
|
|
@@ -138,44 +154,41 @@ SNACKBAR_TYPE.forEach(type => {
|
|
|
138
154
|
return Snackbar(options);
|
|
139
155
|
};
|
|
140
156
|
});
|
|
141
|
-
Snackbar.allowMultiple = function
|
|
142
|
-
if (bool === void 0) {
|
|
143
|
-
bool = false;
|
|
144
|
-
}
|
|
157
|
+
Snackbar.allowMultiple = function(bool = false) {
|
|
145
158
|
if (bool !== isAllowMultiple) {
|
|
146
|
-
uniqSnackbarOptions.forEach(option => {
|
|
159
|
+
uniqSnackbarOptions.forEach((option) => {
|
|
147
160
|
option.reactiveSnackOptions.show = false;
|
|
148
161
|
});
|
|
149
162
|
isAllowMultiple = bool;
|
|
150
163
|
}
|
|
151
164
|
};
|
|
152
|
-
Snackbar.clear = function
|
|
153
|
-
uniqSnackbarOptions.forEach(option => {
|
|
165
|
+
Snackbar.clear = function() {
|
|
166
|
+
uniqSnackbarOptions.forEach((option) => {
|
|
154
167
|
option.reactiveSnackOptions.show = false;
|
|
155
168
|
});
|
|
156
169
|
};
|
|
157
|
-
Snackbar.setDefaultOptions = function
|
|
170
|
+
Snackbar.setDefaultOptions = function(options) {
|
|
158
171
|
defaultOptions = options;
|
|
159
172
|
};
|
|
160
|
-
Snackbar.resetDefaultOptions = function
|
|
173
|
+
Snackbar.resetDefaultOptions = function() {
|
|
161
174
|
defaultOptions = defaultOptionsValue;
|
|
162
175
|
};
|
|
163
176
|
function opened(element) {
|
|
164
|
-
|
|
165
|
-
|
|
177
|
+
const id = element.getAttribute("data-id");
|
|
178
|
+
const option = uniqSnackbarOptions.find((option2) => option2.id === toNumber(id));
|
|
166
179
|
if (option) {
|
|
167
180
|
call(option.reactiveSnackOptions.onOpened);
|
|
168
181
|
}
|
|
169
182
|
}
|
|
170
183
|
function removeUniqOption(element) {
|
|
171
|
-
element.parentElement && element.parentElement.classList.remove(
|
|
172
|
-
|
|
173
|
-
|
|
184
|
+
element.parentElement && element.parentElement.classList.remove("var-pointer-auto");
|
|
185
|
+
const id = element.getAttribute("data-id");
|
|
186
|
+
const option = uniqSnackbarOptions.find((option2) => option2.id === toNumber(id));
|
|
174
187
|
if (option) {
|
|
175
188
|
option.animationEnd = true;
|
|
176
189
|
call(option.reactiveSnackOptions.onClosed);
|
|
177
190
|
}
|
|
178
|
-
|
|
191
|
+
const isAllAnimationEnd = uniqSnackbarOptions.every((option2) => option2.animationEnd);
|
|
179
192
|
if (isAllAnimationEnd) {
|
|
180
193
|
call(unmount);
|
|
181
194
|
uniqSnackbarOptions = reactive([]);
|
|
@@ -185,33 +198,34 @@ function removeUniqOption(element) {
|
|
|
185
198
|
function addUniqOption(uniqSnackbarOptionItem) {
|
|
186
199
|
uniqSnackbarOptions.push(uniqSnackbarOptionItem);
|
|
187
200
|
}
|
|
188
|
-
function normalizeOptions(options) {
|
|
189
|
-
if (options === void 0) {
|
|
190
|
-
options = {};
|
|
191
|
-
}
|
|
201
|
+
function normalizeOptions(options = {}) {
|
|
192
202
|
return isString(options) ? {
|
|
193
203
|
content: options
|
|
194
204
|
} : options;
|
|
195
205
|
}
|
|
196
206
|
function updateUniqOption(reactiveSnackOptions, _update) {
|
|
197
|
-
|
|
198
|
-
firstOption.reactiveSnackOptions =
|
|
207
|
+
const [firstOption] = uniqSnackbarOptions;
|
|
208
|
+
firstOption.reactiveSnackOptions = __spreadValues(__spreadValues({}, firstOption.reactiveSnackOptions), reactiveSnackOptions);
|
|
199
209
|
firstOption._update = _update;
|
|
200
210
|
}
|
|
201
|
-
function getTop(position) {
|
|
202
|
-
if (position ===
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
[position]: '5%'
|
|
207
|
-
};
|
|
211
|
+
function getTop(position = "top") {
|
|
212
|
+
if (position === "bottom")
|
|
213
|
+
return {
|
|
214
|
+
[position]: "5%"
|
|
215
|
+
};
|
|
208
216
|
return {
|
|
209
|
-
top: position ===
|
|
217
|
+
top: position === "top" ? "5%" : "45%"
|
|
210
218
|
};
|
|
211
219
|
}
|
|
212
220
|
Snackbar.Component = VarSnackbar;
|
|
213
221
|
withInstall(VarSnackbar);
|
|
214
222
|
withInstall(VarSnackbar, Snackbar);
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
223
|
+
import { props } from "./props.mjs";
|
|
224
|
+
const _SnackbarComponent = VarSnackbar;
|
|
225
|
+
var stdin_default = Snackbar;
|
|
226
|
+
export {
|
|
227
|
+
SNACKBAR_TYPE,
|
|
228
|
+
_SnackbarComponent,
|
|
229
|
+
stdin_default as default,
|
|
230
|
+
props as snackbarProps
|
|
231
|
+
};
|
package/es/snackbar/props.mjs
CHANGED
|
@@ -1,11 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
+
import { defineListenerProp, pickProps } from "../utils/components.mjs";
|
|
21
|
+
import { props as loadingProps } from "../loading/props.mjs";
|
|
22
|
+
const props = {
|
|
5
23
|
type: String,
|
|
6
24
|
position: {
|
|
7
25
|
type: String,
|
|
8
|
-
default:
|
|
26
|
+
default: "top"
|
|
9
27
|
},
|
|
10
28
|
content: {
|
|
11
29
|
type: [String, Function, Object]
|
|
@@ -13,26 +31,29 @@ export var props = {
|
|
|
13
31
|
contentClass: String,
|
|
14
32
|
duration: {
|
|
15
33
|
type: Number,
|
|
16
|
-
default:
|
|
34
|
+
default: 3e3
|
|
17
35
|
},
|
|
18
36
|
vertical: Boolean,
|
|
19
|
-
loadingType: pickProps(loadingProps,
|
|
20
|
-
loadingSize: pickProps(loadingProps,
|
|
21
|
-
loadingRadius: pickProps(loadingProps,
|
|
22
|
-
loadingColor:
|
|
23
|
-
default:
|
|
37
|
+
loadingType: pickProps(loadingProps, "type"),
|
|
38
|
+
loadingSize: pickProps(loadingProps, "size"),
|
|
39
|
+
loadingRadius: pickProps(loadingProps, "radius"),
|
|
40
|
+
loadingColor: __spreadProps(__spreadValues({}, pickProps(loadingProps, "color")), {
|
|
41
|
+
default: "currentColor"
|
|
24
42
|
}),
|
|
25
43
|
lockScroll: Boolean,
|
|
26
44
|
show: Boolean,
|
|
27
45
|
teleport: {
|
|
28
46
|
type: [String, Object, Boolean],
|
|
29
|
-
default:
|
|
47
|
+
default: "body"
|
|
30
48
|
},
|
|
31
49
|
forbidClick: Boolean,
|
|
32
50
|
onOpen: defineListenerProp(),
|
|
33
51
|
onOpened: defineListenerProp(),
|
|
34
52
|
onClose: defineListenerProp(),
|
|
35
53
|
onClosed: defineListenerProp(),
|
|
36
|
-
|
|
54
|
+
"onUpdate:show": defineListenerProp(),
|
|
37
55
|
_update: String
|
|
38
|
-
};
|
|
56
|
+
};
|
|
57
|
+
export {
|
|
58
|
+
props
|
|
59
|
+
};
|
package/es/space/Space.mjs
CHANGED
|
@@ -1,44 +1,43 @@
|
|
|
1
1
|
import { createVNode as _createVNode } from "vue";
|
|
2
|
-
import { defineComponent } from
|
|
3
|
-
import { props } from
|
|
4
|
-
import { isArray } from
|
|
5
|
-
import { call, createNamespace, flatFragment } from
|
|
6
|
-
import { padStartFlex, toSizeUnit } from
|
|
7
|
-
import { computeMargin } from
|
|
2
|
+
import { defineComponent } from "vue";
|
|
3
|
+
import { props } from "./props.mjs";
|
|
4
|
+
import { isArray } from "@varlet/shared";
|
|
5
|
+
import { call, createNamespace, flatFragment } from "../utils/components.mjs";
|
|
6
|
+
import { padStartFlex, toSizeUnit } from "../utils/elements.mjs";
|
|
7
|
+
import { computeMargin } from "./margin.mjs";
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const isInternalSize = (size) => ["mini", "small", "normal", "large"].includes(size);
|
|
11
|
+
const {
|
|
12
12
|
name,
|
|
13
13
|
n,
|
|
14
14
|
classes
|
|
15
|
-
} = createNamespace(
|
|
16
|
-
function getSize(size,
|
|
17
|
-
return
|
|
15
|
+
} = createNamespace("space");
|
|
16
|
+
function getSize(size, isInternalSize2) {
|
|
17
|
+
return isInternalSize2 ? [`var(--space-size-${size}-y)`, `var(--space-size-${size}-x)`] : isArray(size) ? size.map(toSizeUnit) : [toSizeUnit(size), toSizeUnit(size)];
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
var stdin_default = defineComponent({
|
|
20
20
|
name,
|
|
21
21
|
props,
|
|
22
|
-
setup(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} = _ref;
|
|
22
|
+
setup(props2, {
|
|
23
|
+
slots
|
|
24
|
+
}) {
|
|
26
25
|
return () => {
|
|
27
|
-
var
|
|
28
|
-
|
|
26
|
+
var _a;
|
|
27
|
+
const {
|
|
29
28
|
inline,
|
|
30
29
|
justify,
|
|
31
30
|
align,
|
|
32
31
|
wrap,
|
|
33
32
|
direction,
|
|
34
33
|
size
|
|
35
|
-
} =
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
} = props2;
|
|
35
|
+
let children = (_a = call(slots.default)) != null ? _a : [];
|
|
36
|
+
const [y, x] = getSize(size, isInternalSize(size));
|
|
38
37
|
children = flatFragment(children);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
const lastIndex = children.length - 1;
|
|
39
|
+
const spacers = children.map((child, index) => {
|
|
40
|
+
const margin = computeMargin(y, x, {
|
|
42
41
|
direction,
|
|
43
42
|
justify,
|
|
44
43
|
index,
|
|
@@ -51,15 +50,18 @@ export default defineComponent({
|
|
|
51
50
|
}, [child]);
|
|
52
51
|
});
|
|
53
52
|
return _createVNode("div", {
|
|
54
|
-
"class": classes(n(), n(
|
|
53
|
+
"class": classes(n(), n("$--box"), [inline, n("--inline")]),
|
|
55
54
|
"style": {
|
|
56
55
|
flexDirection: direction,
|
|
57
56
|
justifyContent: padStartFlex(justify),
|
|
58
57
|
alignItems: padStartFlex(align),
|
|
59
|
-
flexWrap: wrap ?
|
|
60
|
-
margin: direction ===
|
|
58
|
+
flexWrap: wrap ? "wrap" : "nowrap",
|
|
59
|
+
margin: direction === "row" ? `calc(-1 * ${y} / 2) 0` : void 0
|
|
61
60
|
}
|
|
62
61
|
}, [spacers]);
|
|
63
62
|
};
|
|
64
63
|
}
|
|
65
|
-
});
|
|
64
|
+
});
|
|
65
|
+
export {
|
|
66
|
+
stdin_default as default
|
|
67
|
+
};
|
package/es/space/index.mjs
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import Space from
|
|
2
|
-
import { withInstall } from
|
|
1
|
+
import Space from "./Space.mjs";
|
|
2
|
+
import { withInstall } from "../utils/components.mjs";
|
|
3
3
|
withInstall(Space);
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { props } from "./props.mjs";
|
|
5
|
+
const _SpaceComponent = Space;
|
|
6
|
+
var stdin_default = Space;
|
|
7
|
+
export {
|
|
8
|
+
_SpaceComponent,
|
|
9
|
+
stdin_default as default,
|
|
10
|
+
props as spaceProps
|
|
11
|
+
};
|
package/es/space/margin.mjs
CHANGED
|
@@ -1,35 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
return
|
|
1
|
+
function half(value) {
|
|
2
|
+
return `calc(${value} / 2)`;
|
|
3
3
|
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
lastIndex
|
|
10
|
-
} = options;
|
|
11
|
-
var margin = '0';
|
|
12
|
-
if (direction === 'row') {
|
|
13
|
-
if (['flex-start', 'center', 'flex-end', 'start', 'end'].includes(justify)) {
|
|
4
|
+
function computeMargin(y, x, options) {
|
|
5
|
+
const { direction, justify, index, lastIndex } = options;
|
|
6
|
+
let margin = "0";
|
|
7
|
+
if (direction === "row") {
|
|
8
|
+
if (["flex-start", "center", "flex-end", "start", "end"].includes(justify)) {
|
|
14
9
|
if (index !== lastIndex) {
|
|
15
|
-
margin = half(y)
|
|
10
|
+
margin = `${half(y)} ${x} ${half(y)} 0`;
|
|
16
11
|
} else {
|
|
17
|
-
margin = half(y)
|
|
12
|
+
margin = `${half(y)} 0`;
|
|
18
13
|
}
|
|
19
|
-
} else if (justify ===
|
|
20
|
-
margin = half(y)
|
|
21
|
-
} else if (justify ===
|
|
14
|
+
} else if (justify === "space-around") {
|
|
15
|
+
margin = `${half(y)} ${half(x)}`;
|
|
16
|
+
} else if (justify === "space-between") {
|
|
22
17
|
if (index === 0) {
|
|
23
|
-
margin = half(y)
|
|
18
|
+
margin = `${half(y)} ${half(x)} ${half(y)} 0`;
|
|
24
19
|
} else if (index === lastIndex) {
|
|
25
|
-
margin = half(y)
|
|
20
|
+
margin = `${half(y)} 0 ${half(y)} ${half(x)}`;
|
|
26
21
|
} else {
|
|
27
|
-
margin = half(y)
|
|
22
|
+
margin = `${half(y)} ${half(x)}`;
|
|
28
23
|
}
|
|
29
24
|
}
|
|
30
25
|
}
|
|
31
|
-
if (direction ===
|
|
32
|
-
margin =
|
|
26
|
+
if (direction === "column" && index !== lastIndex) {
|
|
27
|
+
margin = `0 0 ${y} 0`;
|
|
33
28
|
}
|
|
34
29
|
return margin;
|
|
35
|
-
}
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
computeMargin,
|
|
33
|
+
half
|
|
34
|
+
};
|
package/es/space/props.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
const props = {
|
|
2
2
|
size: {
|
|
3
3
|
type: [String, Number, Array],
|
|
4
|
-
default:
|
|
4
|
+
default: "normal"
|
|
5
5
|
},
|
|
6
6
|
wrap: {
|
|
7
7
|
type: Boolean,
|
|
@@ -9,12 +9,15 @@ export var props = {
|
|
|
9
9
|
},
|
|
10
10
|
direction: {
|
|
11
11
|
type: String,
|
|
12
|
-
default:
|
|
12
|
+
default: "row"
|
|
13
13
|
},
|
|
14
14
|
justify: {
|
|
15
15
|
type: String,
|
|
16
|
-
default:
|
|
16
|
+
default: "flex-start"
|
|
17
17
|
},
|
|
18
18
|
align: String,
|
|
19
19
|
inline: Boolean
|
|
20
|
-
};
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
props
|
|
23
|
+
};
|