@varlet/ui 2.16.7 → 2.16.8-alpha.1695227124357
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 +233 -116
- package/es/progress/index.mjs +10 -5
- package/es/progress/props.mjs +8 -5
- 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 +155 -131
- 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 +12426 -13450
- 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 +6 -6
- package/highlight/web-types.zh-CN.json +5 -5
- package/lib/varlet.cjs.js +9233 -10194
- package/package.json +7 -7
- package/types/progress.d.ts +1 -1
- package/umd/varlet.js +5 -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,66 +1,108 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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 { defineComponent, ref, computed, reactive, watch } from "vue";
|
|
18
|
+
import dayjs from "dayjs/esm";
|
|
19
|
+
import isSameOrBefore from "dayjs/esm/plugin/isSameOrBefore";
|
|
20
|
+
import isSameOrAfter from "dayjs/esm/plugin/isSameOrAfter";
|
|
21
|
+
import { MONTH_LIST } from "../props.mjs";
|
|
22
|
+
import PanelHeader from "./panel-header.mjs";
|
|
23
|
+
import VarButton from "../../button/index.mjs";
|
|
24
|
+
import { toNumber } from "@varlet/shared";
|
|
25
|
+
import { createNamespace } from "../../utils/components.mjs";
|
|
26
|
+
import { pack } from "../../locale/index.mjs";
|
|
12
27
|
dayjs.extend(isSameOrBefore);
|
|
13
28
|
dayjs.extend(isSameOrAfter);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
classes
|
|
17
|
-
} = createNamespace('month-picker');
|
|
18
|
-
var {
|
|
19
|
-
n: nDate
|
|
20
|
-
} = createNamespace('date-picker');
|
|
29
|
+
const { n, classes } = createNamespace("month-picker");
|
|
30
|
+
const { n: nDate } = createNamespace("date-picker");
|
|
21
31
|
import { resolveComponent as _resolveComponent, createVNode as _createVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, mergeProps as _mergeProps, withCtx as _withCtx, Transition as _Transition, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode } from "vue";
|
|
22
32
|
function __render__(_ctx, _cache) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return _openBlock(), _createElementBlock(
|
|
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
|
-
|
|
33
|
+
const _component_panel_header = _resolveComponent("panel-header");
|
|
34
|
+
const _component_var_button = _resolveComponent("var-button");
|
|
35
|
+
return _openBlock(), _createElementBlock(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
class: _normalizeClass(_ctx.n())
|
|
39
|
+
},
|
|
40
|
+
[
|
|
41
|
+
_createElementVNode(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
class: _normalizeClass(_ctx.n("content"))
|
|
45
|
+
},
|
|
46
|
+
[
|
|
47
|
+
_createVNode(_component_panel_header, {
|
|
48
|
+
ref: "headerEl",
|
|
49
|
+
type: "month",
|
|
50
|
+
date: _ctx.preview,
|
|
51
|
+
disabled: _ctx.panelBtnDisabled,
|
|
52
|
+
onCheckPanel: _ctx.clickYear,
|
|
53
|
+
onCheckDate: _ctx.checkDate
|
|
54
|
+
}, null, 8, ["date", "disabled", "onCheckPanel", "onCheckDate"]),
|
|
55
|
+
_createVNode(_Transition, {
|
|
56
|
+
name: `${_ctx.nDate()}${_ctx.reverse ? "-reverse" : ""}-translatex`
|
|
57
|
+
}, {
|
|
58
|
+
default: _withCtx(() => [
|
|
59
|
+
(_openBlock(), _createElementBlock("ul", { key: _ctx.panelKey }, [
|
|
60
|
+
(_openBlock(true), _createElementBlock(
|
|
61
|
+
_Fragment,
|
|
62
|
+
null,
|
|
63
|
+
_renderList(_ctx.MONTH_LIST, (month) => {
|
|
64
|
+
return _openBlock(), _createElementBlock("li", {
|
|
65
|
+
key: month.index
|
|
66
|
+
}, [
|
|
67
|
+
_createVNode(_component_var_button, _mergeProps({
|
|
68
|
+
type: "primary",
|
|
69
|
+
"var-month-picker-cover": "",
|
|
70
|
+
ripple: false,
|
|
71
|
+
elevation: _ctx.componentProps.buttonElevation
|
|
72
|
+
}, __spreadValues({}, _ctx.buttonProps(month.index)), {
|
|
73
|
+
onClick: (event) => _ctx.chooseMonth(month, event)
|
|
74
|
+
}), {
|
|
75
|
+
default: _withCtx(() => [
|
|
76
|
+
_createTextVNode(
|
|
77
|
+
_toDisplayString(_ctx.getMonthAbbr(month.index)),
|
|
78
|
+
1
|
|
79
|
+
/* TEXT */
|
|
80
|
+
)
|
|
81
|
+
]),
|
|
82
|
+
_: 2
|
|
83
|
+
/* DYNAMIC */
|
|
84
|
+
}, 1040, ["elevation", "onClick"])
|
|
85
|
+
]);
|
|
86
|
+
}),
|
|
87
|
+
128
|
|
88
|
+
/* KEYED_FRAGMENT */
|
|
89
|
+
))
|
|
90
|
+
]))
|
|
91
|
+
]),
|
|
92
|
+
_: 1
|
|
93
|
+
/* STABLE */
|
|
94
|
+
}, 8, ["name"])
|
|
95
|
+
],
|
|
96
|
+
2
|
|
97
|
+
/* CLASS */
|
|
98
|
+
)
|
|
99
|
+
],
|
|
100
|
+
2
|
|
101
|
+
/* CLASS */
|
|
102
|
+
);
|
|
60
103
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
name: 'MonthPickerPanel',
|
|
104
|
+
const __sfc__ = defineComponent({
|
|
105
|
+
name: "MonthPickerPanel",
|
|
64
106
|
components: {
|
|
65
107
|
VarButton,
|
|
66
108
|
PanelHeader
|
|
@@ -87,152 +129,137 @@ var __sfc__ = defineComponent({
|
|
|
87
129
|
required: true
|
|
88
130
|
}
|
|
89
131
|
},
|
|
90
|
-
emits: [
|
|
91
|
-
setup(props,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
var panelKey = ref(0);
|
|
98
|
-
var headerEl = ref(null);
|
|
99
|
-
var panelBtnDisabled = reactive({
|
|
132
|
+
emits: ["check-preview", "choose-month"],
|
|
133
|
+
setup(props, { emit }) {
|
|
134
|
+
const [currentYear, currentMonth] = props.current.split("-");
|
|
135
|
+
const reverse = ref(false);
|
|
136
|
+
const panelKey = ref(0);
|
|
137
|
+
const headerEl = ref(null);
|
|
138
|
+
const panelBtnDisabled = reactive({
|
|
100
139
|
left: false,
|
|
101
140
|
right: false
|
|
102
141
|
});
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
var
|
|
107
|
-
return (
|
|
142
|
+
const isSameYear = computed(() => props.choose.chooseYear === props.preview.previewYear);
|
|
143
|
+
const isCurrentYear = computed(() => props.preview.previewYear === currentYear);
|
|
144
|
+
const getMonthAbbr = (key) => {
|
|
145
|
+
var _a, _b;
|
|
146
|
+
return (_b = (_a = pack.value.datePickerMonthDict) == null ? void 0 : _a[key].abbr) != null ? _b : "";
|
|
108
147
|
};
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
preview: {
|
|
112
|
-
|
|
113
|
-
},
|
|
114
|
-
componentProps: {
|
|
115
|
-
min,
|
|
116
|
-
max
|
|
117
|
-
}
|
|
148
|
+
const inRange = (key) => {
|
|
149
|
+
const {
|
|
150
|
+
preview: { previewYear },
|
|
151
|
+
componentProps: { min, max }
|
|
118
152
|
} = props;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (max)
|
|
123
|
-
|
|
153
|
+
let isBeforeMax = true;
|
|
154
|
+
let isAfterMin = true;
|
|
155
|
+
const previewDate = `${previewYear}-${key}`;
|
|
156
|
+
if (max)
|
|
157
|
+
isBeforeMax = dayjs(previewDate).isSameOrBefore(dayjs(max), "month");
|
|
158
|
+
if (min)
|
|
159
|
+
isAfterMin = dayjs(previewDate).isSameOrAfter(dayjs(min), "month");
|
|
124
160
|
return isBeforeMax && isAfterMin;
|
|
125
161
|
};
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
choose: {
|
|
129
|
-
|
|
130
|
-
chooseDays,
|
|
131
|
-
chooseRangeMonth
|
|
132
|
-
},
|
|
133
|
-
componentProps: {
|
|
134
|
-
type,
|
|
135
|
-
range
|
|
136
|
-
}
|
|
162
|
+
const shouldChoose = (val) => {
|
|
163
|
+
const {
|
|
164
|
+
choose: { chooseMonths, chooseDays, chooseRangeMonth },
|
|
165
|
+
componentProps: { type, range }
|
|
137
166
|
} = props;
|
|
138
167
|
if (range) {
|
|
139
|
-
if (!chooseRangeMonth.length)
|
|
140
|
-
|
|
141
|
-
|
|
168
|
+
if (!chooseRangeMonth.length)
|
|
169
|
+
return false;
|
|
170
|
+
const isBeforeMax = dayjs(val).isSameOrBefore(dayjs(chooseRangeMonth[1]), "month");
|
|
171
|
+
const isAfterMin = dayjs(val).isSameOrAfter(dayjs(chooseRangeMonth[0]), "month");
|
|
142
172
|
return isBeforeMax && isAfterMin;
|
|
143
173
|
}
|
|
144
|
-
if (type ===
|
|
145
|
-
|
|
174
|
+
if (type === "month")
|
|
175
|
+
return chooseMonths.includes(val);
|
|
176
|
+
return chooseDays.some((value) => value.includes(val));
|
|
146
177
|
};
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
choose: {
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
preview: {
|
|
153
|
-
previewYear
|
|
154
|
-
},
|
|
155
|
-
componentProps: {
|
|
156
|
-
allowedDates,
|
|
157
|
-
color,
|
|
158
|
-
multiple,
|
|
159
|
-
range
|
|
160
|
-
}
|
|
178
|
+
const buttonProps = (key) => {
|
|
179
|
+
const {
|
|
180
|
+
choose: { chooseMonth: chooseMonth2 },
|
|
181
|
+
preview: { previewYear },
|
|
182
|
+
componentProps: { allowedDates, color, multiple, range }
|
|
161
183
|
} = props;
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if (range || multiple)
|
|
165
|
-
|
|
184
|
+
const val = `${previewYear}-${key}`;
|
|
185
|
+
const monthExist = () => {
|
|
186
|
+
if (range || multiple)
|
|
187
|
+
return shouldChoose(val);
|
|
188
|
+
return (chooseMonth2 == null ? void 0 : chooseMonth2.index) === key && isSameYear.value;
|
|
166
189
|
};
|
|
167
|
-
|
|
168
|
-
if (!inRange(key))
|
|
169
|
-
|
|
190
|
+
const computeDisabled = () => {
|
|
191
|
+
if (!inRange(key))
|
|
192
|
+
return true;
|
|
193
|
+
if (!allowedDates)
|
|
194
|
+
return false;
|
|
170
195
|
return !allowedDates(val);
|
|
171
196
|
};
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
if (disabled)
|
|
175
|
-
|
|
176
|
-
|
|
197
|
+
const disabled = computeDisabled();
|
|
198
|
+
const computeText = () => {
|
|
199
|
+
if (disabled)
|
|
200
|
+
return true;
|
|
201
|
+
if (range || multiple)
|
|
202
|
+
return !shouldChoose(val);
|
|
203
|
+
return !isSameYear.value || (chooseMonth2 == null ? void 0 : chooseMonth2.index) !== key;
|
|
177
204
|
};
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
// 同一年但是未被选择的情况
|
|
189
|
-
if (isSameYear.value) return (chooseMonth == null ? void 0 : chooseMonth.index) !== currentMonth;
|
|
205
|
+
const computeOutline = () => {
|
|
206
|
+
if (!(isCurrentYear.value && currentMonth === key && props.componentProps.showCurrent))
|
|
207
|
+
return false;
|
|
208
|
+
if ((range || multiple || isSameYear.value) && disabled)
|
|
209
|
+
return true;
|
|
210
|
+
if (range || multiple)
|
|
211
|
+
return !shouldChoose(val);
|
|
212
|
+
if (isSameYear.value)
|
|
213
|
+
return (chooseMonth2 == null ? void 0 : chooseMonth2.index) !== currentMonth;
|
|
190
214
|
return true;
|
|
191
215
|
};
|
|
192
|
-
|
|
193
|
-
if (disabled)
|
|
194
|
-
|
|
195
|
-
if (
|
|
196
|
-
|
|
216
|
+
const textColorOrCover = () => {
|
|
217
|
+
if (disabled)
|
|
218
|
+
return "";
|
|
219
|
+
if (computeOutline())
|
|
220
|
+
return color != null ? color : "";
|
|
221
|
+
if (monthExist())
|
|
222
|
+
return "";
|
|
223
|
+
return `${nDate()}-color-cover`;
|
|
197
224
|
};
|
|
198
|
-
|
|
225
|
+
const isCover = textColorOrCover().startsWith(nDate());
|
|
199
226
|
return {
|
|
200
227
|
outline: computeOutline(),
|
|
201
228
|
text: computeText(),
|
|
202
|
-
color: !computeText() ? color :
|
|
203
|
-
textColor: isCover ?
|
|
204
|
-
[nDate()
|
|
205
|
-
class: classes(n(
|
|
229
|
+
color: !computeText() ? color : "",
|
|
230
|
+
textColor: isCover ? "" : textColorOrCover(),
|
|
231
|
+
[`${nDate()}-color-cover`]: isCover,
|
|
232
|
+
class: classes(n("button"), [disabled, n("button--disabled")]),
|
|
206
233
|
disabled
|
|
207
234
|
};
|
|
208
235
|
};
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
if (buttonEl.classList.contains(n(
|
|
212
|
-
|
|
236
|
+
const chooseMonth = (month, event) => {
|
|
237
|
+
const buttonEl = event.currentTarget;
|
|
238
|
+
if (buttonEl.classList.contains(n("button--disabled")))
|
|
239
|
+
return;
|
|
240
|
+
emit("choose-month", month);
|
|
213
241
|
};
|
|
214
|
-
|
|
215
|
-
reverse.value = checkType ===
|
|
216
|
-
panelKey.value += checkType ===
|
|
217
|
-
emit(
|
|
242
|
+
const checkDate = (checkType) => {
|
|
243
|
+
reverse.value = checkType === "prev";
|
|
244
|
+
panelKey.value += checkType === "prev" ? -1 : 1;
|
|
245
|
+
emit("check-preview", "year", checkType);
|
|
218
246
|
};
|
|
219
|
-
|
|
220
|
-
// expose for internal
|
|
221
|
-
var forwardRef = checkType => {
|
|
247
|
+
const forwardRef = (checkType) => {
|
|
222
248
|
headerEl.value.checkDate(checkType);
|
|
223
249
|
};
|
|
224
|
-
watch(
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
max
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
250
|
+
watch(
|
|
251
|
+
() => props.preview.previewYear,
|
|
252
|
+
(year) => {
|
|
253
|
+
const {
|
|
254
|
+
componentProps: { min, max }
|
|
255
|
+
} = props;
|
|
256
|
+
if (max)
|
|
257
|
+
panelBtnDisabled.right = !dayjs(`${toNumber(year) + 1}`).isSameOrBefore(dayjs(max), "year");
|
|
258
|
+
if (min)
|
|
259
|
+
panelBtnDisabled.left = !dayjs(`${toNumber(year) - 1}`).isSameOrAfter(dayjs(min), "year");
|
|
260
|
+
},
|
|
261
|
+
{ immediate: true }
|
|
262
|
+
);
|
|
236
263
|
return {
|
|
237
264
|
n,
|
|
238
265
|
nDate,
|
|
@@ -251,4 +278,7 @@ var __sfc__ = defineComponent({
|
|
|
251
278
|
}
|
|
252
279
|
});
|
|
253
280
|
__sfc__.render = __render__;
|
|
254
|
-
|
|
281
|
+
var stdin_default = __sfc__;
|
|
282
|
+
export {
|
|
283
|
+
stdin_default as default
|
|
284
|
+
};
|
|
@@ -1,60 +1,79 @@
|
|
|
1
|
-
import VarButton from
|
|
2
|
-
import VarIcon from
|
|
3
|
-
import { defineComponent, ref, computed, watch } from
|
|
4
|
-
import { toNumber } from
|
|
5
|
-
import { createNamespace } from
|
|
6
|
-
import { pack } from
|
|
7
|
-
|
|
8
|
-
n
|
|
9
|
-
} = createNamespace('picker-header');
|
|
1
|
+
import VarButton from "../../button/index.mjs";
|
|
2
|
+
import VarIcon from "../../icon/index.mjs";
|
|
3
|
+
import { defineComponent, ref, computed, watch } from "vue";
|
|
4
|
+
import { toNumber } from "@varlet/shared";
|
|
5
|
+
import { createNamespace } from "../../utils/components.mjs";
|
|
6
|
+
import { pack } from "../../locale/index.mjs";
|
|
7
|
+
const { n } = createNamespace("picker-header");
|
|
10
8
|
import { resolveComponent as _resolveComponent, createVNode as _createVNode, withCtx as _withCtx, toDisplayString as _toDisplayString, openBlock as _openBlock, createElementBlock as _createElementBlock, Transition as _Transition, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode } from "vue";
|
|
11
9
|
function __render__(_ctx, _cache) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return _openBlock(), _createElementBlock(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
text: "",
|
|
19
|
-
style: {
|
|
20
|
-
"filter": "opacity(0.54)"
|
|
10
|
+
const _component_var_icon = _resolveComponent("var-icon");
|
|
11
|
+
const _component_var_button = _resolveComponent("var-button");
|
|
12
|
+
return _openBlock(), _createElementBlock(
|
|
13
|
+
"div",
|
|
14
|
+
{
|
|
15
|
+
class: _normalizeClass(_ctx.n())
|
|
21
16
|
},
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
17
|
+
[
|
|
18
|
+
_createVNode(_component_var_button, {
|
|
19
|
+
round: "",
|
|
20
|
+
text: "",
|
|
21
|
+
style: { "filter": "opacity(0.54)" },
|
|
22
|
+
disabled: _ctx.disabled.left,
|
|
23
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.checkDate("prev"))
|
|
24
|
+
}, {
|
|
25
|
+
default: _withCtx(() => [
|
|
26
|
+
_createVNode(_component_var_icon, { name: "chevron-left" })
|
|
27
|
+
]),
|
|
28
|
+
_: 1
|
|
29
|
+
/* STABLE */
|
|
30
|
+
}, 8, ["disabled"]),
|
|
31
|
+
_createElementVNode(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
class: _normalizeClass(_ctx.n("value")),
|
|
35
|
+
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("check-panel"))
|
|
36
|
+
},
|
|
37
|
+
[
|
|
38
|
+
_createVNode(_Transition, {
|
|
39
|
+
name: `var-date-picker${_ctx.reverse ? "-reverse" : ""}-translatex`
|
|
40
|
+
}, {
|
|
41
|
+
default: _withCtx(() => [
|
|
42
|
+
(_openBlock(), _createElementBlock(
|
|
43
|
+
"div",
|
|
44
|
+
{ key: _ctx.showDate },
|
|
45
|
+
_toDisplayString(_ctx.showDate),
|
|
46
|
+
1
|
|
47
|
+
/* TEXT */
|
|
48
|
+
))
|
|
49
|
+
]),
|
|
50
|
+
_: 1
|
|
51
|
+
/* STABLE */
|
|
52
|
+
}, 8, ["name"])
|
|
53
|
+
],
|
|
54
|
+
2
|
|
55
|
+
/* CLASS */
|
|
56
|
+
),
|
|
57
|
+
_createVNode(_component_var_button, {
|
|
58
|
+
round: "",
|
|
59
|
+
text: "",
|
|
60
|
+
style: { "filter": "opacity(0.54)" },
|
|
61
|
+
disabled: _ctx.disabled.right,
|
|
62
|
+
onClick: _cache[2] || (_cache[2] = ($event) => _ctx.checkDate("next"))
|
|
63
|
+
}, {
|
|
64
|
+
default: _withCtx(() => [
|
|
65
|
+
_createVNode(_component_var_icon, { name: "chevron-right" })
|
|
66
|
+
]),
|
|
67
|
+
_: 1
|
|
68
|
+
/* STABLE */
|
|
69
|
+
}, 8, ["disabled"])
|
|
70
|
+
],
|
|
71
|
+
2
|
|
72
|
+
/* CLASS */
|
|
73
|
+
);
|
|
54
74
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
name: 'PanelHeader',
|
|
75
|
+
const __sfc__ = defineComponent({
|
|
76
|
+
name: "PanelHeader",
|
|
58
77
|
components: {
|
|
59
78
|
VarButton,
|
|
60
79
|
VarIcon
|
|
@@ -66,43 +85,39 @@ var __sfc__ = defineComponent({
|
|
|
66
85
|
},
|
|
67
86
|
type: {
|
|
68
87
|
type: String,
|
|
69
|
-
default:
|
|
88
|
+
default: "date"
|
|
70
89
|
},
|
|
71
90
|
disabled: {
|
|
72
91
|
type: Object,
|
|
73
92
|
required: true
|
|
74
93
|
}
|
|
75
94
|
},
|
|
76
|
-
emits: [
|
|
77
|
-
setup(props,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
} = props;
|
|
89
|
-
var {
|
|
90
|
-
previewMonth,
|
|
91
|
-
previewYear
|
|
92
|
-
} = date;
|
|
93
|
-
if (type === 'month') return toNumber(previewYear) + forwardOrBackNum.value;
|
|
94
|
-
var monthName = (_pack$value$datePicke = pack.value.datePickerMonthDict) == null ? void 0 : _pack$value$datePicke[previewMonth.index].name;
|
|
95
|
-
return pack.value.lang === 'zh-CN' ? previewYear + " " + monthName : monthName + " " + previewYear;
|
|
95
|
+
emits: ["check-panel", "check-date"],
|
|
96
|
+
setup(props, { emit }) {
|
|
97
|
+
const reverse = ref(false);
|
|
98
|
+
const forwardOrBackNum = ref(0);
|
|
99
|
+
const showDate = computed(() => {
|
|
100
|
+
var _a;
|
|
101
|
+
const { date, type } = props;
|
|
102
|
+
const { previewMonth, previewYear } = date;
|
|
103
|
+
if (type === "month")
|
|
104
|
+
return toNumber(previewYear) + forwardOrBackNum.value;
|
|
105
|
+
const monthName = (_a = pack.value.datePickerMonthDict) == null ? void 0 : _a[previewMonth.index].name;
|
|
106
|
+
return pack.value.lang === "zh-CN" ? `${previewYear} ${monthName}` : `${monthName} ${previewYear}`;
|
|
96
107
|
});
|
|
97
|
-
|
|
98
|
-
if (checkType ===
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
108
|
+
const checkDate = (checkType) => {
|
|
109
|
+
if (checkType === "prev" && props.disabled.left || checkType === "next" && props.disabled.right)
|
|
110
|
+
return;
|
|
111
|
+
emit("check-date", checkType);
|
|
112
|
+
reverse.value = checkType === "prev";
|
|
113
|
+
forwardOrBackNum.value += checkType === "prev" ? -1 : 1;
|
|
102
114
|
};
|
|
103
|
-
watch(
|
|
104
|
-
|
|
105
|
-
|
|
115
|
+
watch(
|
|
116
|
+
() => props.date,
|
|
117
|
+
() => {
|
|
118
|
+
forwardOrBackNum.value = 0;
|
|
119
|
+
}
|
|
120
|
+
);
|
|
106
121
|
return {
|
|
107
122
|
n,
|
|
108
123
|
reverse,
|
|
@@ -112,4 +127,7 @@ var __sfc__ = defineComponent({
|
|
|
112
127
|
}
|
|
113
128
|
});
|
|
114
129
|
__sfc__.render = __render__;
|
|
115
|
-
|
|
130
|
+
var stdin_default = __sfc__;
|
|
131
|
+
export {
|
|
132
|
+
stdin_default as default
|
|
133
|
+
};
|