@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
|
@@ -1,116 +1,214 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
import dayjs from "dayjs/esm";
|
|
22
|
+
import MonthPickerPanel from "./src/month-picker-panel.mjs";
|
|
23
|
+
import YearPickerPanel from "./src/year-picker-panel.mjs";
|
|
24
|
+
import DayPickerPanel from "./src/day-picker-panel.mjs";
|
|
25
|
+
import { defineComponent, ref, computed, reactive, watch } from "vue";
|
|
26
|
+
import {
|
|
27
|
+
props,
|
|
28
|
+
MONTH_LIST,
|
|
29
|
+
WEEK_HEADER
|
|
30
|
+
} from "./props.mjs";
|
|
31
|
+
import { isArray, toNumber, doubleRaf } from "@varlet/shared";
|
|
32
|
+
import { createNamespace, call, formatElevation } from "../utils/components.mjs";
|
|
33
|
+
import { padStart } from "../utils/shared.mjs";
|
|
34
|
+
import { pack } from "../locale/index.mjs";
|
|
35
|
+
const { name, n, classes } = createNamespace("date-picker");
|
|
18
36
|
import { renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, createCommentVNode as _createCommentVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, normalizeProps as _normalizeProps, mergeProps as _mergeProps, Transition as _Transition, withCtx as _withCtx, createVNode as _createVNode, normalizeStyle as _normalizeStyle, resolveComponent as _resolveComponent, createBlock as _createBlock } from "vue";
|
|
19
37
|
function __render__(_ctx, _cache) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return _openBlock(), _createElementBlock(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
38
|
+
const _component_year_picker_panel = _resolveComponent("year-picker-panel");
|
|
39
|
+
const _component_month_picker_panel = _resolveComponent("month-picker-panel");
|
|
40
|
+
const _component_day_picker_panel = _resolveComponent("day-picker-panel");
|
|
41
|
+
return _openBlock(), _createElementBlock(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
class: _normalizeClass(_ctx.classes(_ctx.n(), _ctx.formatElevation(_ctx.elevation, 2)))
|
|
45
|
+
},
|
|
46
|
+
[
|
|
47
|
+
_createElementVNode(
|
|
48
|
+
"div",
|
|
49
|
+
{
|
|
50
|
+
class: _normalizeClass(_ctx.n("title")),
|
|
51
|
+
style: _normalizeStyle({ background: _ctx.headerColor || _ctx.color })
|
|
52
|
+
},
|
|
53
|
+
[
|
|
54
|
+
_createElementVNode(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
class: _normalizeClass(_ctx.classes(_ctx.n("title-year"), [_ctx.isYearPanel, _ctx.n("title-year--active")])),
|
|
58
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.clickEl("year"))
|
|
59
|
+
},
|
|
60
|
+
[
|
|
61
|
+
_renderSlot(_ctx.$slots, "year", { year: _ctx.chooseYear }, () => [
|
|
62
|
+
_createTextVNode(
|
|
63
|
+
_toDisplayString(_ctx.chooseYear),
|
|
64
|
+
1
|
|
65
|
+
/* TEXT */
|
|
66
|
+
)
|
|
67
|
+
])
|
|
68
|
+
],
|
|
69
|
+
2
|
|
70
|
+
/* CLASS */
|
|
71
|
+
),
|
|
72
|
+
_createElementVNode(
|
|
73
|
+
"div",
|
|
74
|
+
{
|
|
75
|
+
class: _normalizeClass(_ctx.classes(_ctx.n("title-date"), [!_ctx.isYearPanel, _ctx.n("title-date--active")], [_ctx.range, _ctx.n("title-date--range")])),
|
|
76
|
+
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.clickEl("date"))
|
|
77
|
+
},
|
|
78
|
+
[
|
|
79
|
+
_createVNode(_Transition, {
|
|
80
|
+
name: _ctx.multiple ? "" : `${_ctx.n()}${_ctx.reverse ? "-reverse" : ""}-translatey`
|
|
81
|
+
}, {
|
|
82
|
+
default: _withCtx(() => {
|
|
83
|
+
var _a, _b, _c;
|
|
84
|
+
return [
|
|
85
|
+
_ctx.type === "month" ? (_openBlock(), _createElementBlock("div", {
|
|
86
|
+
key: `${_ctx.chooseYear}${(_a = _ctx.chooseMonth) == null ? void 0 : _a.index}`
|
|
87
|
+
}, [
|
|
88
|
+
_ctx.range ? _renderSlot(_ctx.$slots, "range", {
|
|
89
|
+
key: 0,
|
|
90
|
+
choose: _ctx.getChoose.chooseRangeMonth
|
|
91
|
+
}, () => [
|
|
92
|
+
_createTextVNode(
|
|
93
|
+
_toDisplayString(_ctx.getMonthTitle),
|
|
94
|
+
1
|
|
95
|
+
/* TEXT */
|
|
96
|
+
)
|
|
97
|
+
]) : _ctx.multiple ? _renderSlot(_ctx.$slots, "multiple", {
|
|
98
|
+
key: 1,
|
|
99
|
+
choose: _ctx.getChoose.chooseMonths
|
|
100
|
+
}, () => [
|
|
101
|
+
_createTextVNode(
|
|
102
|
+
_toDisplayString(_ctx.getMonthTitle),
|
|
103
|
+
1
|
|
104
|
+
/* TEXT */
|
|
105
|
+
)
|
|
106
|
+
]) : _renderSlot(_ctx.$slots, "month", {
|
|
107
|
+
key: 2,
|
|
108
|
+
month: (_b = _ctx.chooseMonth) == null ? void 0 : _b.index,
|
|
109
|
+
year: _ctx.chooseYear
|
|
110
|
+
}, () => [
|
|
111
|
+
_createTextVNode(
|
|
112
|
+
_toDisplayString(_ctx.getMonthTitle),
|
|
113
|
+
1
|
|
114
|
+
/* TEXT */
|
|
115
|
+
)
|
|
116
|
+
])
|
|
117
|
+
])) : (_openBlock(), _createElementBlock("div", {
|
|
118
|
+
key: `${_ctx.chooseYear}${(_c = _ctx.chooseMonth) == null ? void 0 : _c.index}${_ctx.chooseDay}`
|
|
119
|
+
}, [
|
|
120
|
+
_ctx.range ? _renderSlot(_ctx.$slots, "range", {
|
|
121
|
+
key: 0,
|
|
122
|
+
choose: _ctx.formatRange
|
|
123
|
+
}, () => [
|
|
124
|
+
_createTextVNode(
|
|
125
|
+
_toDisplayString(_ctx.getDateTitle),
|
|
126
|
+
1
|
|
127
|
+
/* TEXT */
|
|
128
|
+
)
|
|
129
|
+
]) : _ctx.multiple ? _renderSlot(_ctx.$slots, "multiple", {
|
|
130
|
+
key: 1,
|
|
131
|
+
choose: _ctx.getChoose.chooseDays
|
|
132
|
+
}, () => [
|
|
133
|
+
_createTextVNode(
|
|
134
|
+
_toDisplayString(_ctx.getDateTitle),
|
|
135
|
+
1
|
|
136
|
+
/* TEXT */
|
|
137
|
+
)
|
|
138
|
+
]) : _renderSlot(_ctx.$slots, "date", _normalizeProps(_mergeProps({ key: 2 }, _ctx.slotProps)), () => [
|
|
139
|
+
_createTextVNode(
|
|
140
|
+
_toDisplayString(_ctx.getDateTitle),
|
|
141
|
+
1
|
|
142
|
+
/* TEXT */
|
|
143
|
+
)
|
|
144
|
+
])
|
|
145
|
+
]))
|
|
146
|
+
];
|
|
147
|
+
}),
|
|
148
|
+
_: 3
|
|
149
|
+
/* FORWARDED */
|
|
150
|
+
}, 8, ["name"])
|
|
151
|
+
],
|
|
152
|
+
2
|
|
153
|
+
/* CLASS */
|
|
154
|
+
)
|
|
155
|
+
],
|
|
156
|
+
6
|
|
157
|
+
/* CLASS, STYLE */
|
|
158
|
+
),
|
|
159
|
+
_createElementVNode(
|
|
160
|
+
"div",
|
|
161
|
+
{
|
|
162
|
+
class: _normalizeClass(_ctx.n("body")),
|
|
163
|
+
onTouchstart: _cache[2] || (_cache[2] = (...args) => _ctx.handleTouchstart && _ctx.handleTouchstart(...args)),
|
|
164
|
+
onTouchmove: _cache[3] || (_cache[3] = (...args) => _ctx.handleTouchmove && _ctx.handleTouchmove(...args)),
|
|
165
|
+
onTouchend: _cache[4] || (_cache[4] = (...args) => _ctx.handleTouchend && _ctx.handleTouchend(...args))
|
|
166
|
+
},
|
|
167
|
+
[
|
|
168
|
+
_createVNode(_Transition, {
|
|
169
|
+
name: `${_ctx.n()}-panel-fade`
|
|
170
|
+
}, {
|
|
171
|
+
default: _withCtx(() => [
|
|
172
|
+
_ctx.getPanelType === "year" ? (_openBlock(), _createBlock(_component_year_picker_panel, {
|
|
173
|
+
key: 0,
|
|
174
|
+
"component-props": _ctx.componentProps,
|
|
175
|
+
preview: _ctx.previewYear,
|
|
176
|
+
onChooseYear: _ctx.getChooseYear
|
|
177
|
+
}, null, 8, ["component-props", "preview", "onChooseYear"])) : _ctx.getPanelType === "month" ? (_openBlock(), _createBlock(_component_month_picker_panel, {
|
|
178
|
+
key: 1,
|
|
179
|
+
ref: "monthPanelEl",
|
|
180
|
+
current: _ctx.currentDate,
|
|
181
|
+
choose: _ctx.getChoose,
|
|
182
|
+
preview: _ctx.getPreview,
|
|
183
|
+
"click-year": () => _ctx.clickEl("year"),
|
|
184
|
+
"component-props": _ctx.componentProps,
|
|
185
|
+
onChooseMonth: _ctx.getChooseMonth,
|
|
186
|
+
onCheckPreview: _ctx.checkPreview
|
|
187
|
+
}, null, 8, ["current", "choose", "preview", "click-year", "component-props", "onChooseMonth", "onCheckPreview"])) : _ctx.getPanelType === "date" ? (_openBlock(), _createBlock(_component_day_picker_panel, {
|
|
188
|
+
key: 2,
|
|
189
|
+
ref: "dayPanelEl",
|
|
190
|
+
current: _ctx.currentDate,
|
|
191
|
+
choose: _ctx.getChoose,
|
|
192
|
+
preview: _ctx.getPreview,
|
|
193
|
+
"component-props": _ctx.componentProps,
|
|
194
|
+
"click-month": () => _ctx.clickEl("month"),
|
|
195
|
+
onChooseDay: _ctx.getChooseDay,
|
|
196
|
+
onCheckPreview: _ctx.checkPreview
|
|
197
|
+
}, null, 8, ["current", "choose", "preview", "component-props", "click-month", "onChooseDay", "onCheckPreview"])) : _createCommentVNode("v-if", true)
|
|
198
|
+
]),
|
|
199
|
+
_: 1
|
|
200
|
+
/* STABLE */
|
|
201
|
+
}, 8, ["name"])
|
|
202
|
+
],
|
|
203
|
+
34
|
|
204
|
+
/* CLASS, HYDRATE_EVENTS */
|
|
205
|
+
)
|
|
206
|
+
],
|
|
207
|
+
2
|
|
208
|
+
/* CLASS */
|
|
209
|
+
);
|
|
111
210
|
}
|
|
112
|
-
|
|
113
|
-
var __sfc__ = defineComponent({
|
|
211
|
+
const __sfc__ = defineComponent({
|
|
114
212
|
name,
|
|
115
213
|
components: {
|
|
116
214
|
MonthPickerPanel,
|
|
@@ -118,38 +216,38 @@ var __sfc__ = defineComponent({
|
|
|
118
216
|
DayPickerPanel
|
|
119
217
|
},
|
|
120
218
|
props,
|
|
121
|
-
setup(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
allowedDates:
|
|
142
|
-
type:
|
|
143
|
-
color:
|
|
144
|
-
firstDayOfWeek:
|
|
145
|
-
min:
|
|
146
|
-
max:
|
|
147
|
-
showCurrent:
|
|
148
|
-
multiple:
|
|
149
|
-
range:
|
|
150
|
-
buttonElevation:
|
|
219
|
+
setup(props2) {
|
|
220
|
+
const currentDate = dayjs().format("YYYY-MM-D");
|
|
221
|
+
const [currentYear, currentMonth] = currentDate.split("-");
|
|
222
|
+
const monthDes = MONTH_LIST.find((month) => month.index === currentMonth);
|
|
223
|
+
const isYearPanel = ref(false);
|
|
224
|
+
const isMonthPanel = ref(false);
|
|
225
|
+
const rangeDone = ref(true);
|
|
226
|
+
const chooseMonth = ref();
|
|
227
|
+
const chooseYear = ref();
|
|
228
|
+
const chooseDay = ref();
|
|
229
|
+
const previewMonth = ref(monthDes);
|
|
230
|
+
const previewYear = ref(currentYear);
|
|
231
|
+
const reverse = ref(false);
|
|
232
|
+
const chooseMonths = ref([]);
|
|
233
|
+
const chooseDays = ref([]);
|
|
234
|
+
const chooseRangeMonth = ref([]);
|
|
235
|
+
const chooseRangeDay = ref([]);
|
|
236
|
+
const monthPanelEl = ref(null);
|
|
237
|
+
const dayPanelEl = ref(null);
|
|
238
|
+
const componentProps = reactive({
|
|
239
|
+
allowedDates: props2.allowedDates,
|
|
240
|
+
type: props2.type,
|
|
241
|
+
color: props2.color,
|
|
242
|
+
firstDayOfWeek: props2.firstDayOfWeek,
|
|
243
|
+
min: props2.min,
|
|
244
|
+
max: props2.max,
|
|
245
|
+
showCurrent: props2.showCurrent,
|
|
246
|
+
multiple: props2.multiple,
|
|
247
|
+
range: props2.range,
|
|
248
|
+
buttonElevation: props2.buttonElevation
|
|
151
249
|
});
|
|
152
|
-
|
|
250
|
+
const getChoose = computed(() => ({
|
|
153
251
|
chooseMonth: chooseMonth.value,
|
|
154
252
|
chooseYear: chooseYear.value,
|
|
155
253
|
chooseDay: chooseDay.value,
|
|
@@ -158,188 +256,193 @@ var __sfc__ = defineComponent({
|
|
|
158
256
|
chooseRangeMonth: chooseRangeMonth.value,
|
|
159
257
|
chooseRangeDay: chooseRangeDay.value
|
|
160
258
|
}));
|
|
161
|
-
|
|
259
|
+
const getPreview = computed(() => ({
|
|
162
260
|
previewMonth: previewMonth.value,
|
|
163
261
|
previewYear: previewYear.value
|
|
164
262
|
}));
|
|
165
|
-
|
|
166
|
-
var
|
|
167
|
-
|
|
168
|
-
range
|
|
169
|
-
} = props;
|
|
263
|
+
const getMonthTitle = computed(() => {
|
|
264
|
+
var _a, _b;
|
|
265
|
+
const { multiple, range } = props2;
|
|
170
266
|
if (range) {
|
|
171
|
-
return chooseRangeMonth.value.length ? chooseRangeMonth.value[0]
|
|
267
|
+
return chooseRangeMonth.value.length ? `${chooseRangeMonth.value[0]} ~ ${chooseRangeMonth.value[1]}` : "";
|
|
172
268
|
}
|
|
173
|
-
|
|
269
|
+
let monthName = "";
|
|
174
270
|
if (chooseMonth.value) {
|
|
175
|
-
|
|
176
|
-
monthName = (_pack$value$datePicke = (_pack$value$datePicke2 = pack.value.datePickerMonthDict) == null ? void 0 : _pack$value$datePicke2[chooseMonth.value.index].name) != null ? _pack$value$datePicke : '';
|
|
271
|
+
monthName = (_b = (_a = pack.value.datePickerMonthDict) == null ? void 0 : _a[chooseMonth.value.index].name) != null ? _b : "";
|
|
177
272
|
}
|
|
178
|
-
return multiple ?
|
|
273
|
+
return multiple ? `${chooseMonths.value.length}${pack.value.datePickerSelected}` : monthName;
|
|
179
274
|
});
|
|
180
|
-
|
|
181
|
-
var
|
|
182
|
-
|
|
183
|
-
multiple,
|
|
184
|
-
range
|
|
185
|
-
} = props;
|
|
275
|
+
const getDateTitle = computed(() => {
|
|
276
|
+
var _a, _b, _c, _d;
|
|
277
|
+
const { multiple, range } = props2;
|
|
186
278
|
if (range) {
|
|
187
|
-
|
|
188
|
-
return formatRangeDays.length ? formatRangeDays[0]
|
|
279
|
+
const formatRangeDays = chooseRangeDay.value.map((date) => dayjs(date).format("YYYY-MM-DD"));
|
|
280
|
+
return formatRangeDays.length ? `${formatRangeDays[0]} ~ ${formatRangeDays[1]}` : "";
|
|
189
281
|
}
|
|
190
|
-
if (multiple)
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
282
|
+
if (multiple)
|
|
283
|
+
return `${chooseDays.value.length}${pack.value.datePickerSelected}`;
|
|
284
|
+
if (!chooseYear.value || !chooseMonth.value || !chooseDay.value)
|
|
285
|
+
return "";
|
|
286
|
+
const weekIndex = dayjs(`${chooseYear.value}-${chooseMonth.value.index}-${chooseDay.value}`).day();
|
|
287
|
+
const week = WEEK_HEADER.find((value) => value.index === `${weekIndex}`);
|
|
288
|
+
const weekName = (_b = (_a = pack.value.datePickerWeekDict) == null ? void 0 : _a[week.index].name) != null ? _b : "";
|
|
289
|
+
const monthName = (_d = (_c = pack.value.datePickerMonthDict) == null ? void 0 : _c[chooseMonth.value.index].name) != null ? _d : "";
|
|
290
|
+
const showDay = padStart(chooseDay.value, 2, "0");
|
|
291
|
+
if (pack.value.lang === "zh-CN")
|
|
292
|
+
return `${chooseMonth.value.index}-${showDay} ${weekName.slice(0, 3)}`;
|
|
293
|
+
return `${weekName.slice(0, 3)}, ${monthName.slice(0, 3)} ${chooseDay.value}`;
|
|
199
294
|
});
|
|
200
|
-
|
|
201
|
-
if (isYearPanel.value)
|
|
202
|
-
|
|
203
|
-
if (
|
|
204
|
-
|
|
295
|
+
const getPanelType = computed(() => {
|
|
296
|
+
if (isYearPanel.value)
|
|
297
|
+
return "year";
|
|
298
|
+
if (props2.type === "month" || isMonthPanel.value)
|
|
299
|
+
return "month";
|
|
300
|
+
if (props2.type === "date")
|
|
301
|
+
return "date";
|
|
302
|
+
return "";
|
|
205
303
|
});
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
var
|
|
209
|
-
|
|
210
|
-
|
|
304
|
+
const isUntouchable = computed(() => !props2.touchable || ["", "year"].includes(getPanelType.value));
|
|
305
|
+
const slotProps = computed(() => {
|
|
306
|
+
var _a, _b, _c, _d;
|
|
307
|
+
const weekIndex = dayjs(`${chooseYear.value}-${(_a = chooseMonth.value) == null ? void 0 : _a.index}-${chooseDay.value}`).day();
|
|
308
|
+
const date = chooseDay.value ? padStart(chooseDay.value, 2, "0") : "";
|
|
211
309
|
return {
|
|
212
|
-
week:
|
|
213
|
-
year: (
|
|
214
|
-
month: (
|
|
310
|
+
week: `${weekIndex}`,
|
|
311
|
+
year: (_b = chooseYear.value) != null ? _b : "",
|
|
312
|
+
month: (_d = (_c = chooseMonth.value) == null ? void 0 : _c.index) != null ? _d : "",
|
|
215
313
|
date
|
|
216
314
|
};
|
|
217
315
|
});
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
var startY = 0;
|
|
226
|
-
var checkType = '';
|
|
227
|
-
var touchDirection;
|
|
228
|
-
watch(() => props.modelValue, value => {
|
|
229
|
-
if (!checkValue() || invalidFormatDate(value) || !value) return;
|
|
230
|
-
if (props.range) {
|
|
231
|
-
if (!isArray(value)) return;
|
|
232
|
-
rangeDone.value = value.length !== 1;
|
|
233
|
-
rangeInit(value, props.type);
|
|
234
|
-
} else if (props.multiple) {
|
|
235
|
-
if (!isArray(value)) return;
|
|
236
|
-
multipleInit(value, props.type);
|
|
237
|
-
} else {
|
|
238
|
-
dateInit(value);
|
|
239
|
-
}
|
|
240
|
-
}, {
|
|
241
|
-
immediate: true
|
|
316
|
+
const formatRange = computed(
|
|
317
|
+
() => getChoose.value.chooseRangeDay.map((choose) => dayjs(choose).format("YYYY-MM-DD"))
|
|
318
|
+
);
|
|
319
|
+
const isSameYear = computed(() => chooseYear.value === previewYear.value);
|
|
320
|
+
const isSameMonth = computed(() => {
|
|
321
|
+
var _a;
|
|
322
|
+
return ((_a = chooseMonth.value) == null ? void 0 : _a.index) === previewMonth.value.index;
|
|
242
323
|
});
|
|
324
|
+
let startX = 0;
|
|
325
|
+
let startY = 0;
|
|
326
|
+
let checkType = "";
|
|
327
|
+
let touchDirection;
|
|
328
|
+
watch(
|
|
329
|
+
() => props2.modelValue,
|
|
330
|
+
(value) => {
|
|
331
|
+
if (!checkValue() || invalidFormatDate(value) || !value)
|
|
332
|
+
return;
|
|
333
|
+
if (props2.range) {
|
|
334
|
+
if (!isArray(value))
|
|
335
|
+
return;
|
|
336
|
+
rangeDone.value = value.length !== 1;
|
|
337
|
+
rangeInit(value, props2.type);
|
|
338
|
+
} else if (props2.multiple) {
|
|
339
|
+
if (!isArray(value))
|
|
340
|
+
return;
|
|
341
|
+
multipleInit(value, props2.type);
|
|
342
|
+
} else {
|
|
343
|
+
dateInit(value);
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
{ immediate: true }
|
|
347
|
+
);
|
|
243
348
|
watch(getPanelType, resetState);
|
|
244
349
|
function clickEl(type) {
|
|
245
|
-
if (type ===
|
|
350
|
+
if (type === "year")
|
|
351
|
+
isYearPanel.value = true;
|
|
352
|
+
else if (type === "month")
|
|
353
|
+
isMonthPanel.value = true;
|
|
354
|
+
else {
|
|
246
355
|
isYearPanel.value = false;
|
|
247
356
|
isMonthPanel.value = false;
|
|
248
357
|
}
|
|
249
358
|
}
|
|
250
359
|
function handleTouchstart(event) {
|
|
251
|
-
if (isUntouchable.value)
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
clientY
|
|
255
|
-
} = event.touches[0];
|
|
360
|
+
if (isUntouchable.value)
|
|
361
|
+
return;
|
|
362
|
+
const { clientX, clientY } = event.touches[0];
|
|
256
363
|
startX = clientX;
|
|
257
364
|
startY = clientY;
|
|
258
365
|
}
|
|
259
366
|
function getDirection(x, y) {
|
|
260
|
-
return x >= y && x > 20 ?
|
|
367
|
+
return x >= y && x > 20 ? "x" : "y";
|
|
261
368
|
}
|
|
262
369
|
function handleTouchmove(event) {
|
|
263
|
-
if (isUntouchable.value)
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
var x = clientX - startX;
|
|
269
|
-
var y = clientY - startY;
|
|
370
|
+
if (isUntouchable.value)
|
|
371
|
+
return;
|
|
372
|
+
const { clientX, clientY } = event.touches[0];
|
|
373
|
+
const x = clientX - startX;
|
|
374
|
+
const y = clientY - startY;
|
|
270
375
|
touchDirection = getDirection(Math.abs(x), Math.abs(y));
|
|
271
|
-
checkType = x > 0 ?
|
|
376
|
+
checkType = x > 0 ? "prev" : "next";
|
|
272
377
|
}
|
|
273
378
|
function handleTouchend() {
|
|
274
|
-
return
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
if (isUntouchable.value || touchDirection !== 'x') return;
|
|
279
|
-
var componentRef = getPanelType.value === 'month' ? monthPanelEl : dayPanelEl;
|
|
379
|
+
return __async(this, null, function* () {
|
|
380
|
+
if (isUntouchable.value || touchDirection !== "x")
|
|
381
|
+
return;
|
|
382
|
+
const componentRef = getPanelType.value === "month" ? monthPanelEl : dayPanelEl;
|
|
280
383
|
yield doubleRaf();
|
|
281
384
|
componentRef.value.forwardRef(checkType);
|
|
282
385
|
resetState();
|
|
283
386
|
});
|
|
284
|
-
return _handleTouchend.apply(this, arguments);
|
|
285
387
|
}
|
|
286
388
|
function updateRange(date, type) {
|
|
287
|
-
|
|
389
|
+
const rangeDate = type === "month" ? chooseRangeMonth : chooseRangeDay;
|
|
288
390
|
rangeDate.value = rangeDone.value ? [date, date] : [rangeDate.value[0], date];
|
|
289
391
|
rangeDone.value = !rangeDone.value;
|
|
290
392
|
if (rangeDone.value) {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
call(
|
|
294
|
-
call(
|
|
393
|
+
const isChangeOrder = dayjs(rangeDate.value[0]).isAfter(rangeDate.value[1]);
|
|
394
|
+
const date2 = isChangeOrder ? [rangeDate.value[1], rangeDate.value[0]] : [...rangeDate.value];
|
|
395
|
+
call(props2["onUpdate:modelValue"], date2);
|
|
396
|
+
call(props2.onChange, date2);
|
|
295
397
|
}
|
|
296
398
|
}
|
|
297
399
|
function updateMultiple(date, type) {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
if (index === -1)
|
|
303
|
-
|
|
304
|
-
|
|
400
|
+
const multipleDates = type === "month" ? chooseMonths : chooseDays;
|
|
401
|
+
const formatType = type === "month" ? "YYYY-MM" : "YYYY-MM-DD";
|
|
402
|
+
const formatDates = multipleDates.value.map((date2) => dayjs(date2).format(formatType));
|
|
403
|
+
const index = formatDates.findIndex((choose) => choose === date);
|
|
404
|
+
if (index === -1)
|
|
405
|
+
formatDates.push(date);
|
|
406
|
+
else
|
|
407
|
+
formatDates.splice(index, 1);
|
|
408
|
+
call(props2["onUpdate:modelValue"], formatDates);
|
|
409
|
+
call(props2.onChange, formatDates);
|
|
305
410
|
}
|
|
306
411
|
function getReverse(dateType, date) {
|
|
307
|
-
if (!chooseYear.value || !chooseMonth.value)
|
|
308
|
-
|
|
309
|
-
if (
|
|
412
|
+
if (!chooseYear.value || !chooseMonth.value)
|
|
413
|
+
return false;
|
|
414
|
+
if (!isSameYear.value)
|
|
415
|
+
return chooseYear.value > previewYear.value;
|
|
416
|
+
if (dateType === "month")
|
|
417
|
+
return date.index < chooseMonth.value.index;
|
|
310
418
|
return isSameMonth.value ? date < toNumber(chooseDay.value) : chooseMonth.value.index > previewMonth.value.index;
|
|
311
419
|
}
|
|
312
420
|
function getChooseDay(day) {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
if (range) updateRange(formatDate, 'day');else if (multiple) updateMultiple(formatDate, 'day');else {
|
|
421
|
+
const { readonly, range, multiple, onChange, "onUpdate:modelValue": updateModelValue } = props2;
|
|
422
|
+
if (day < 0 || readonly)
|
|
423
|
+
return;
|
|
424
|
+
reverse.value = getReverse("day", day);
|
|
425
|
+
const date = `${previewYear.value}-${previewMonth.value.index}-${day}`;
|
|
426
|
+
const formatDate = dayjs(date).format("YYYY-MM-DD");
|
|
427
|
+
if (range)
|
|
428
|
+
updateRange(formatDate, "day");
|
|
429
|
+
else if (multiple)
|
|
430
|
+
updateMultiple(formatDate, "day");
|
|
431
|
+
else {
|
|
325
432
|
call(updateModelValue, formatDate);
|
|
326
433
|
call(onChange, formatDate);
|
|
327
434
|
}
|
|
328
435
|
}
|
|
329
436
|
function getChooseMonth(month) {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
reverse.value = getReverse('month', month);
|
|
340
|
-
if (type === 'month' && !readonly) {
|
|
341
|
-
var date = previewYear.value + "-" + month.index;
|
|
342
|
-
if (range) updateRange(date, 'month');else if (multiple) updateMultiple(date, 'month');else {
|
|
437
|
+
const { type, readonly, range, multiple, onChange, onPreview, "onUpdate:modelValue": updateModelValue } = props2;
|
|
438
|
+
reverse.value = getReverse("month", month);
|
|
439
|
+
if (type === "month" && !readonly) {
|
|
440
|
+
const date = `${previewYear.value}-${month.index}`;
|
|
441
|
+
if (range)
|
|
442
|
+
updateRange(date, "month");
|
|
443
|
+
else if (multiple)
|
|
444
|
+
updateMultiple(date, "month");
|
|
445
|
+
else {
|
|
343
446
|
call(updateModelValue, date);
|
|
344
447
|
call(onChange, date);
|
|
345
448
|
}
|
|
@@ -350,84 +453,85 @@ var __sfc__ = defineComponent({
|
|
|
350
453
|
isMonthPanel.value = false;
|
|
351
454
|
}
|
|
352
455
|
function getChooseYear(year) {
|
|
353
|
-
previewYear.value =
|
|
456
|
+
previewYear.value = `${year}`;
|
|
354
457
|
isYearPanel.value = false;
|
|
355
458
|
isMonthPanel.value = true;
|
|
356
|
-
call(
|
|
459
|
+
call(props2.onPreview, toNumber(previewYear.value), toNumber(previewMonth.value.index));
|
|
357
460
|
}
|
|
358
|
-
function checkPreview(type,
|
|
359
|
-
|
|
360
|
-
if (type ===
|
|
361
|
-
previewYear.value =
|
|
461
|
+
function checkPreview(type, checkType2) {
|
|
462
|
+
const changeValue = checkType2 === "prev" ? -1 : 1;
|
|
463
|
+
if (type === "year") {
|
|
464
|
+
previewYear.value = `${toNumber(previewYear.value) + changeValue}`;
|
|
362
465
|
} else {
|
|
363
|
-
|
|
466
|
+
let checkIndex = toNumber(previewMonth.value.index) + changeValue;
|
|
364
467
|
if (checkIndex < 1) {
|
|
365
|
-
previewYear.value =
|
|
468
|
+
previewYear.value = `${toNumber(previewYear.value) - 1}`;
|
|
366
469
|
checkIndex = 12;
|
|
367
470
|
}
|
|
368
471
|
if (checkIndex > 12) {
|
|
369
|
-
previewYear.value =
|
|
472
|
+
previewYear.value = `${toNumber(previewYear.value) + 1}`;
|
|
370
473
|
checkIndex = 1;
|
|
371
474
|
}
|
|
372
|
-
previewMonth.value = MONTH_LIST.find(month => toNumber(month.index) === checkIndex);
|
|
475
|
+
previewMonth.value = MONTH_LIST.find((month) => toNumber(month.index) === checkIndex);
|
|
373
476
|
}
|
|
374
|
-
call(
|
|
477
|
+
call(props2.onPreview, toNumber(previewYear.value), toNumber(previewMonth.value.index));
|
|
375
478
|
}
|
|
376
479
|
function checkValue() {
|
|
377
|
-
if ((
|
|
480
|
+
if ((props2.multiple || props2.range) && !isArray(props2.modelValue)) {
|
|
378
481
|
console.error('[Varlet] DatePicker: type of prop "modelValue" should be an Array');
|
|
379
482
|
return false;
|
|
380
483
|
}
|
|
381
|
-
if (!
|
|
484
|
+
if (!props2.multiple && !props2.range && isArray(props2.modelValue)) {
|
|
382
485
|
console.error('[Varlet] DatePicker: type of prop "modelValue" should be a String');
|
|
383
486
|
return false;
|
|
384
487
|
}
|
|
385
488
|
return true;
|
|
386
489
|
}
|
|
387
490
|
function invalidFormatDate(date) {
|
|
388
|
-
if (isArray(date))
|
|
389
|
-
|
|
491
|
+
if (isArray(date))
|
|
492
|
+
return false;
|
|
493
|
+
if (date === "Invalid Date") {
|
|
390
494
|
console.error('[Varlet] DatePicker: "modelValue" is an Invalid Date');
|
|
391
495
|
return true;
|
|
392
496
|
}
|
|
393
497
|
return false;
|
|
394
498
|
}
|
|
395
499
|
function rangeInit(value, type) {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
if (isValid)
|
|
500
|
+
const rangeDate = type === "month" ? chooseRangeMonth : chooseRangeDay;
|
|
501
|
+
const formatType = type === "month" ? "YYYY-MM" : "YYYY-MM-D";
|
|
502
|
+
const formatDateList = value.map((choose) => dayjs(choose).format(formatType)).slice(0, 2);
|
|
503
|
+
const isValid = rangeDate.value.some((date) => invalidFormatDate(date));
|
|
504
|
+
if (isValid)
|
|
505
|
+
return;
|
|
401
506
|
rangeDate.value = formatDateList;
|
|
402
|
-
|
|
507
|
+
const isChangeOrder = dayjs(rangeDate.value[0]).isAfter(rangeDate.value[1]);
|
|
403
508
|
if (rangeDate.value.length === 2 && isChangeOrder) {
|
|
404
509
|
rangeDate.value = [rangeDate.value[1], rangeDate.value[0]];
|
|
405
510
|
}
|
|
406
511
|
}
|
|
407
512
|
function multipleInit(value, type) {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
var formatDateList = Array.from(new Set(value.map(choose => dayjs(choose).format(formatType))));
|
|
413
|
-
rangeDate.value = formatDateList.filter(date => date !== 'Invalid Date');
|
|
513
|
+
const rangeDate = type === "month" ? chooseMonths : chooseDays;
|
|
514
|
+
const formatType = type === "month" ? "YYYY-MM" : "YYYY-MM-D";
|
|
515
|
+
const formatDateList = Array.from(new Set(value.map((choose) => dayjs(choose).format(formatType))));
|
|
516
|
+
rangeDate.value = formatDateList.filter((date) => date !== "Invalid Date");
|
|
414
517
|
}
|
|
415
518
|
function dateInit(value) {
|
|
416
|
-
|
|
417
|
-
if (invalidFormatDate(formatDate))
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
519
|
+
const formatDate = dayjs(value).format("YYYY-MM-D");
|
|
520
|
+
if (invalidFormatDate(formatDate))
|
|
521
|
+
return;
|
|
522
|
+
const [yearValue, monthValue, dayValue] = formatDate.split("-");
|
|
523
|
+
const monthDes2 = MONTH_LIST.find((month) => month.index === monthValue);
|
|
524
|
+
chooseMonth.value = monthDes2;
|
|
421
525
|
chooseYear.value = yearValue;
|
|
422
526
|
chooseDay.value = dayValue;
|
|
423
|
-
previewMonth.value =
|
|
527
|
+
previewMonth.value = monthDes2;
|
|
424
528
|
previewYear.value = yearValue;
|
|
425
529
|
}
|
|
426
530
|
function resetState() {
|
|
427
531
|
startY = 0;
|
|
428
532
|
startX = 0;
|
|
429
|
-
checkType =
|
|
430
|
-
touchDirection =
|
|
533
|
+
checkType = "";
|
|
534
|
+
touchDirection = void 0;
|
|
431
535
|
}
|
|
432
536
|
return {
|
|
433
537
|
monthPanelEl,
|
|
@@ -463,4 +567,7 @@ var __sfc__ = defineComponent({
|
|
|
463
567
|
}
|
|
464
568
|
});
|
|
465
569
|
__sfc__.render = __render__;
|
|
466
|
-
|
|
570
|
+
var stdin_default = __sfc__;
|
|
571
|
+
export {
|
|
572
|
+
stdin_default as default
|
|
573
|
+
};
|