@nutui/nutui 3.1.22-beta.0 → 3.1.22-beta.3
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/dist/nutui.es.js +4019 -19251
- package/dist/nutui.umd.js +4012 -19344
- package/dist/packages/_es/ActionSheet.js +26 -157
- package/dist/packages/_es/Address.js +119 -542
- package/dist/packages/_es/AddressList.js +113 -613
- package/dist/packages/_es/Audio.js +62 -264
- package/dist/packages/_es/AudioOperate.js +18 -107
- package/dist/packages/_es/Avatar.js +42 -165
- package/dist/packages/_es/AvatarGroup.js +14 -73
- package/dist/packages/_es/BackTop.js +43 -156
- package/dist/packages/_es/Badge.js +14 -86
- package/dist/packages/_es/Barrage.js +41 -120
- package/dist/packages/_es/Button.js +23 -128
- package/dist/packages/_es/Calendar.js +24 -237
- package/dist/packages/_es/CalendarItem.js +1 -1
- package/dist/packages/_es/Card.js +10 -107
- package/dist/packages/_es/Cascader.js +156 -500
- package/dist/packages/_es/Category.js +15 -58
- package/dist/packages/_es/CategoryPane.js +11 -111
- package/dist/packages/_es/Cell.js +21 -100
- package/dist/packages/_es/CellGroup.js +9 -44
- package/dist/packages/_es/Checkbox.js +31 -113
- package/dist/packages/_es/CheckboxGroup.js +29 -58
- package/dist/packages/_es/CircleProgress.js +28 -151
- package/dist/packages/_es/Col.js +14 -56
- package/dist/packages/_es/Collapse.js +24 -85
- package/dist/packages/_es/CollapseItem.js +70 -261
- package/dist/packages/_es/Comment.js +64 -434
- package/dist/packages/_es/CountDown.js +61 -242
- package/dist/packages/_es/CountUp.js +149 -546
- package/dist/packages/_es/DatePicker.js +107 -322
- package/dist/packages/_es/Dialog.js +69 -261
- package/dist/packages/_es/Divider.js +18 -68
- package/dist/packages/_es/Drag.js +56 -197
- package/dist/packages/_es/Ecard.js +24 -159
- package/dist/packages/_es/Elevator.js +63 -198
- package/dist/packages/_es/Empty.js +12 -71
- package/dist/packages/_es/FixedNav.js +15 -122
- package/dist/packages/_es/Form.js +64 -151
- package/dist/packages/_es/FormItem.js +15 -110
- package/dist/packages/_es/Grid.js +5 -6
- package/dist/packages/_es/GridItem.js +33 -144
- package/dist/packages/_es/Icon.js +15 -40
- package/dist/packages/_es/ImagePreview.js +74 -298
- package/dist/packages/_es/Indicator.js +15 -62
- package/dist/packages/_es/InfiniteLoading.js +66 -258
- package/dist/packages/_es/Input.js +51 -413
- package/dist/packages/_es/InputNumber.js +41 -160
- package/dist/packages/_es/Layout.js +4 -5
- package/dist/packages/_es/List.js +23 -110
- package/dist/packages/_es/Menu.js +30 -118
- package/dist/packages/_es/MenuItem.js +34 -162
- package/dist/packages/_es/Navbar.js +30 -192
- package/dist/packages/_es/NoticeBar.js +83 -387
- package/dist/packages/_es/Notify.js +81 -236
- package/dist/packages/_es/NumberKeyboard.js +41 -272
- package/dist/packages/_es/OldPicker.js +140 -464
- package/dist/packages/_es/OverLay.js +32 -105
- package/dist/packages/_es/Pagination.js +39 -157
- package/dist/packages/_es/Picker.js +138 -459
- package/dist/packages/_es/Popover.js +327 -965
- package/dist/packages/_es/Popup.js +64 -303
- package/dist/packages/_es/Price.js +16 -118
- package/dist/packages/_es/Progress.js +14 -146
- package/dist/packages/_es/PullRefresh.js +92 -346
- package/dist/packages/_es/Radio.js +22 -90
- package/dist/packages/_es/RadioGroup.js +8 -37
- package/dist/packages/_es/Range.js +92 -417
- package/dist/packages/_es/Rate.js +16 -139
- package/dist/packages/_es/Row.js +22 -64
- package/dist/packages/_es/SearchBar.js +46 -247
- package/dist/packages/_es/ShortPassword.js +35 -225
- package/dist/packages/_es/SideNavBar.js +33 -89
- package/dist/packages/_es/SideNavBarItem.js +11 -46
- package/dist/packages/_es/Signature.js +46 -165
- package/dist/packages/_es/Skeleton.js +20 -136
- package/dist/packages/_es/Sku.js +93 -499
- package/dist/packages/_es/Step.js +25 -119
- package/dist/packages/_es/Steps.js +18 -53
- package/dist/packages/_es/Sticky.js +53 -138
- package/dist/packages/_es/SubSideNavBar.js +26 -90
- package/dist/packages/_es/Swipe.js +46 -183
- package/dist/packages/_es/Swiper.js +121 -433
- package/dist/packages/_es/SwiperItem.js +22 -53
- package/dist/packages/_es/Switch.js +21 -116
- package/dist/packages/_es/TabPane.js +12 -39
- package/dist/packages/_es/Tabbar.js +17 -72
- package/dist/packages/_es/TabbarItem.js +29 -151
- package/dist/packages/_es/Table.js +27 -186
- package/dist/packages/_es/Tabs.js +51 -209
- package/dist/packages/_es/Tag.js +20 -97
- package/dist/packages/_es/TextArea.js +42 -160
- package/dist/packages/_es/TimeDetail.js +23 -84
- package/dist/packages/_es/TimePannel.js +19 -52
- package/dist/packages/_es/TimeSelect.js +15 -103
- package/dist/packages/_es/Toast.js +80 -319
- package/dist/packages/_es/Uploader.js +112 -460
- package/dist/packages/_es/Video.js +83 -340
- package/dist/packages/_es/common.js +38 -128
- package/dist/packages/_es/component.js +35 -76
- package/dist/packages/_es/index.js +5 -6
- package/dist/packages/_es/index2.js +9 -30
- package/dist/packages/_es/index3.js +6 -8
- package/dist/packages/_es/index4.js +13 -58
- package/dist/packages/_es/index5.js +120 -675
- package/dist/packages/_es/plugin-vue_export-helper.js +7 -8
- package/dist/packages/_es/pxCheck.js +3 -5
- package/dist/packages/_es/raf.js +8 -15
- package/dist/packages/button/index.scss +2 -1
- package/dist/packages/cell/index.scss +11 -0
- package/dist/packages/checkbox/index.scss +6 -0
- package/dist/packages/dialog/index.scss +1 -0
- package/dist/packages/elevator/index.scss +21 -0
- package/dist/packages/input/index.scss +13 -1
- package/dist/packages/locale/lang/baseLang.d.ts +1 -0
- package/dist/packages/locale/lang/baseLang.js +3 -3
- package/dist/packages/locale/lang/en-US.d.ts +8 -0
- package/dist/packages/locale/lang/en-US.js +5 -97
- package/dist/packages/locale/lang/id-ID.d.ts +8 -0
- package/dist/packages/locale/lang/id-ID.js +5 -97
- package/dist/packages/locale/lang/index.js +16 -38
- package/dist/packages/locale/lang/zh-CN.d.ts +8 -0
- package/dist/packages/locale/lang/zh-CN.js +5 -97
- package/dist/packages/locale/lang/zh-TW.d.ts +8 -0
- package/dist/packages/locale/lang/zh-TW.js +5 -97
- package/dist/packages/radio/index.scss +1 -0
- package/dist/packages/switch/index.scss +3 -3
- package/dist/packages/tabpane/index.scss +1 -0
- package/dist/smartips/attributes.json +62 -10
- package/dist/smartips/tags.json +17 -4
- package/dist/style.css +1 -1
- package/dist/styles/themes/default.scss +49 -49
- package/dist/styles/themes/jdb.scss +49 -49
- package/dist/styles/themes/jdt.scss +49 -49
- package/dist/styles/variables-jdb.scss +10 -1
- package/dist/styles/variables-jdt.scss +10 -1
- package/dist/styles/variables.scss +10 -1
- package/dist/types/__VUE/address/index.vue.d.ts +5 -5
- package/dist/types/__VUE/addresslist/components/ItemContents.vue.d.ts +1 -0
- package/dist/types/__VUE/audiooperate/index.vue.d.ts +1 -0
- package/dist/types/__VUE/avatar/index.vue.d.ts +4 -4
- package/dist/types/__VUE/backtop/index.vue.d.ts +2 -2
- package/dist/types/__VUE/badge/index.vue.d.ts +2 -2
- package/dist/types/__VUE/button/index.vue.d.ts +2 -2
- package/dist/types/__VUE/cascader/index.vue.d.ts +1 -1
- package/dist/types/__VUE/cell/index.vue.d.ts +11 -4
- package/dist/types/__VUE/checkbox/common.d.ts +59 -0
- package/dist/types/__VUE/checkbox/index.vue.d.ts +18 -5
- package/dist/types/__VUE/checkboxgroup/index.vue.d.ts +7 -0
- package/dist/types/__VUE/collapseitem/index.vue.d.ts +2 -2
- package/dist/types/__VUE/dialog/index.d.ts +9 -2
- package/dist/types/__VUE/dialog/index.vue.d.ts +23 -8
- package/dist/types/__VUE/ecard/index.vue.d.ts +3 -3
- package/dist/types/__VUE/elevator/index.vue.d.ts +29 -0
- package/dist/types/__VUE/empty/index.vue.d.ts +2 -2
- package/dist/types/__VUE/formitem/index.vue.d.ts +3 -10
- package/dist/types/__VUE/grid/index.vue.d.ts +4 -4
- package/dist/types/__VUE/griditem/index.vue.d.ts +1 -1
- package/dist/types/__VUE/input/index.vue.d.ts +2 -2
- package/dist/types/__VUE/noticebar/index.vue.d.ts +1 -1
- package/dist/types/__VUE/oldpicker/index.vue.d.ts +2 -2
- package/dist/types/__VUE/picker/index.vue.d.ts +2 -2
- package/dist/types/__VUE/popover/index.vue.d.ts +2 -2
- package/dist/types/__VUE/range/index.vue.d.ts +1 -1
- package/dist/types/__VUE/rate/index.vue.d.ts +2 -2
- package/dist/types/__VUE/row/index.vue.d.ts +2 -2
- package/dist/types/__VUE/shortpassword/index.vue.d.ts +2 -2
- package/dist/types/__VUE/step/index.vue.d.ts +2 -2
- package/dist/types/__VUE/switch/index.vue.d.ts +2 -2
- package/dist/types/__VUE/tabbaritem/index.vue.d.ts +2 -2
- package/dist/types/__VUE/timeselect/index.vue.d.ts +9 -2
- package/dist/types/__VUE/toast/index.vue.d.ts +3 -3
- package/dist/types/__VUE/uploader/index.vue.d.ts +2 -2
- package/dist/types/__VUE/video/index.vue.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -1
|
@@ -5,688 +5,133 @@ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
6
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
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 = (
|
|
9
|
-
for (var prop in
|
|
10
|
-
if (__hasOwnProp.call(
|
|
11
|
-
__defNormalProp(
|
|
8
|
+
var __spreadValues = (a2, b2) => {
|
|
9
|
+
for (var prop in b2 || (b2 = {}))
|
|
10
|
+
if (__hasOwnProp.call(b2, prop))
|
|
11
|
+
__defNormalProp(a2, prop, b2[prop]);
|
|
12
12
|
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(
|
|
14
|
-
if (__propIsEnum.call(
|
|
15
|
-
__defNormalProp(
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b2)) {
|
|
14
|
+
if (__propIsEnum.call(b2, prop))
|
|
15
|
+
__defNormalProp(a2, prop, b2[prop]);
|
|
16
16
|
}
|
|
17
|
-
return
|
|
17
|
+
return a2;
|
|
18
18
|
};
|
|
19
|
-
var __spreadProps = (
|
|
19
|
+
var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
|
|
20
20
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.22-beta.
|
|
21
|
+
* @nutui/nutui v3.1.22-beta.3 Wed Jun 15 2022 20:12:30 GMT+0800 (中国标准时间)
|
|
22
22
|
* (c) 2022 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
25
|
-
import { ref, computed, reactive, watch, toRefs, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, createCommentVNode, renderSlot, Fragment, renderList, normalizeStyle, createTextVNode } from "vue";
|
|
26
|
-
import { c as
|
|
27
|
-
import { r as
|
|
28
|
-
import { _ as
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
25
|
+
import { ref as t, computed as e, reactive as a, watch as r, toRefs as n, openBlock as s, createElementBlock as o, normalizeClass as l, createElementVNode as c, toDisplayString as i, createCommentVNode as u, renderSlot as D, Fragment as h, renderList as d, normalizeStyle as m, createTextVNode as p } from "vue";
|
|
26
|
+
import { c as y } from "./component.js";
|
|
27
|
+
import { r as g } from "./raf.js";
|
|
28
|
+
import { _ as f } from "./plugin-vue_export-helper.js";
|
|
29
|
+
const w = { isLeapYear: function(t2) {
|
|
30
|
+
return t2 % 4 == 0 && t2 % 100 != 0 || t2 % 400 == 0;
|
|
31
|
+
}, getWhatDay: function(t2, e2, a2) {
|
|
32
|
+
return ["\u661F\u671F\u65E5", "\u661F\u671F\u4E00", "\u661F\u671F\u4E8C", "\u661F\u671F\u4E09", "\u661F\u671F\u56DB", "\u661F\u671F\u4E94", "\u661F\u671F\u516D"][new Date(t2 + "/" + e2 + "/" + a2).getDay()];
|
|
33
|
+
}, getMonthPreDay: function(t2, e2) {
|
|
34
|
+
let a2 = new Date(t2 + "/" + e2 + "/01").getDay();
|
|
35
|
+
return a2 == 0 && (a2 = 7), a2;
|
|
36
|
+
}, getMonthDays: function(t2, e2) {
|
|
37
|
+
return /^0/.test(e2) && (e2 = e2.split("")[1]), [0, 31, this.isLeapYear(Number(t2)) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][e2];
|
|
38
|
+
}, getNumTwoBit: function(t2) {
|
|
39
|
+
return ((t2 = Number(t2)) > 9 ? "" : "0") + t2;
|
|
40
|
+
}, date2Str: function(t2, e2) {
|
|
41
|
+
e2 = e2 || "-";
|
|
42
|
+
return [t2.getFullYear(), this.getNumTwoBit(t2.getMonth() + 1), this.getNumTwoBit(t2.getDate())].join(e2);
|
|
43
|
+
}, getDay: function(t2) {
|
|
44
|
+
t2 = t2 || 0;
|
|
45
|
+
let e2 = new Date();
|
|
46
|
+
const a2 = 864e5 * t2;
|
|
47
|
+
return e2 = new Date(e2.getTime() + a2), this.date2Str(e2);
|
|
48
|
+
}, compareDate: function(t2, e2) {
|
|
49
|
+
return !(new Date(t2.replace("-", "/").replace("-", "/")) >= new Date(e2.replace("-", "/").replace("-", "/")));
|
|
50
|
+
}, isEqual: function(t2, e2) {
|
|
51
|
+
return new Date(t2).getTime() == new Date(e2).getTime();
|
|
52
|
+
} }, { create: v, translate: T } = y("calendar-item"), S = v({ props: { type: { type: String, default: "one" }, isAutoBackFill: { type: Boolean, default: false }, poppable: { type: Boolean, default: true }, showTitle: { type: Boolean, default: true }, showSubTitle: { type: Boolean, default: true }, showToday: { type: Boolean, default: true }, title: { type: String, default: "" }, confirmText: { type: String, default: "" }, startText: { type: String, default: "" }, endText: { type: String, default: "" }, defaultValue: { type: [String, Array], default: null }, startDate: { type: String, default: w.getDay(0) }, endDate: { type: String, default: w.getDay(365) } }, emits: ["choose", "update", "close", "select"], setup(s2, { emit: o2, slots: l2 }) {
|
|
53
|
+
const c2 = t(T("weekdays")), i2 = t(null), u2 = t(null), D2 = t(null), h2 = t(null), d2 = t(0), m2 = e(() => v2.monthsData.slice(v2.defaultRange[0], v2.defaultRange[1])), p2 = e(() => l2.btn), y2 = e(() => l2.topInfo), f2 = e(() => l2.bottomInfo), v2 = a({ yearMonthTitle: "", defaultRange: [], currDate: "", propStartDate: "", propEndDate: "", unLoadPrev: false, touchParams: { startY: 0, endY: 0, startTime: 0, endTime: 0, lastY: 0, lastTime: 0 }, transformY: 0, translateY: 0, scrollDistance: 0, defaultData: [], chooseData: [], monthsData: [], dayPrefix: "calendar-month-day", startData: "", endData: "", isRange: s2.type === "range", timer: 0, currentIndex: 0, avgHeight: 0, monthsNum: 0 }), S2 = (t2) => t2.split("-"), b2 = (t2) => w.isEqual(v2.currDate[0], t2), x2 = (t2) => w.isEqual(v2.currDate[1], t2), $2 = (t2, e2, a2) => e2.curData[0] + "-" + e2.curData[1] + "-" + w.getNumTwoBit(+t2.day), k2 = (t2, e2, a2) => {
|
|
54
|
+
const r2 = $2(t2, e2);
|
|
55
|
+
return t2.type == "curr" ? !v2.isRange && w.isEqual(v2.currDate, r2) || v2.isRange && (b2(r2) || x2(r2)) ? `${v2.dayPrefix}-active` : v2.propStartDate && w.compareDate(r2, v2.propStartDate) || v2.propEndDate && w.compareDate(v2.propEndDate, r2) ? `${v2.dayPrefix}-disabled` : v2.isRange && Array.isArray(v2.currDate) && Object.values(v2.currDate).length == 2 && w.compareDate(v2.currDate[0], r2) && w.compareDate(r2, v2.currDate[1]) ? `${v2.dayPrefix}-choose` : null : `${v2.dayPrefix}-disabled`;
|
|
56
|
+
}, A2 = () => {
|
|
57
|
+
(v2.isRange && v2.chooseData.length == 2 || !v2.isRange) && (o2("choose", v2.chooseData), s2.poppable && o2("update"));
|
|
58
|
+
}, H2 = (t2, e2, a2, r2) => {
|
|
59
|
+
if (k2(t2, e2) != `${v2.dayPrefix}-disabled`) {
|
|
60
|
+
let r3 = [...e2.curData];
|
|
61
|
+
r3[2] = typeof t2.day == "number" ? w.getNumTwoBit(t2.day) : t2.day, r3[3] = `${r3[0]}-${r3[1]}-${r3[2]}`, r3[4] = w.getWhatDay(+r3[0], +r3[1], +r3[2]), v2.isRange ? (Object.values(v2.currDate).length == 2 ? v2.currDate = [r3[3]] : w.compareDate(v2.currDate[0], r3[3]) ? Array.isArray(v2.currDate) && v2.currDate.push(r3[3]) : Array.isArray(v2.currDate) && v2.currDate.unshift(r3[3]), v2.chooseData.length != 2 && v2.chooseData.length ? w.compareDate(v2.chooseData[3], r3[3]) ? v2.chooseData = [[...v2.chooseData], [...r3]] : v2.chooseData = [[...r3], [...v2.chooseData]] : v2.chooseData = [...r3]) : (v2.currDate = r3[3], v2.chooseData = [...r3]), a2 || (o2("select", v2.chooseData), s2.isAutoBackFill && A2());
|
|
52
62
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
63
|
+
}, R2 = (t2) => {
|
|
64
|
+
const e2 = t2 == "prev" ? v2.monthsData[0] : v2.monthsData[v2.monthsData.length - 1];
|
|
65
|
+
let a2 = parseInt(e2.curData[0]), r2 = parseInt(e2.curData[1].toString().replace(/^0/, ""));
|
|
66
|
+
switch (t2) {
|
|
67
|
+
case "prev":
|
|
68
|
+
r2 == 1 && (a2 -= 1), r2 = r2 == 1 ? 12 : --r2;
|
|
69
|
+
break;
|
|
70
|
+
case "next":
|
|
71
|
+
r2 == 12 && (a2 += 1), r2 = r2 == 12 ? 1 : ++r2;
|
|
58
72
|
}
|
|
59
|
-
return [
|
|
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
|
-
|
|
73
|
+
return [a2, w.getNumTwoBit(r2), w.getMonthDays(String(a2), String(r2))];
|
|
74
|
+
}, I2 = (t2, e2, a2) => {
|
|
75
|
+
let { year: r2, month: n2 } = a2;
|
|
76
|
+
return e2 == "prev" && t2 >= 7 && (t2 -= 7), Array.from(Array(t2), (t3, a3) => ({ day: a3 + 1, type: e2, year: r2, month: n2 }));
|
|
77
|
+
}, B2 = (t2, e2, a2, r2) => {
|
|
78
|
+
let { year: n2, month: s3 } = a2;
|
|
79
|
+
return e2 == "prev" && t2 >= 7 && (t2 -= 7), Array.from(Array(r2), (t3, a3) => ({ day: a3 + 1, type: e2, year: n2, month: s3 })).slice(r2 - t2);
|
|
80
|
+
}, N2 = (t2, e2) => {
|
|
81
|
+
const a2 = w.getMonthPreDay(+t2[0], +t2[1]);
|
|
82
|
+
let r2 = t2[1] - 1, n2 = t2[0];
|
|
83
|
+
r2 <= 0 && (r2 = 12, n2 += 1);
|
|
84
|
+
const s3 = w.getMonthDays(t2[0], t2[1]), o3 = w.getMonthDays(n2 + "", r2 + ""), l3 = { year: t2[0], month: t2[1] }, c3 = { curData: t2, title: T("monthTitle", l3.year, l3.month), monthData: [...B2(a2, "prev", { month: r2, year: n2 }, o3), ...I2(s3, "curr", l3)] };
|
|
85
|
+
c3.cssHeight = 39 + (c3.monthData.length > 35 ? 384 : 320);
|
|
86
|
+
let i3 = 0;
|
|
87
|
+
v2.monthsData.length > 0 && (i3 = v2.monthsData[v2.monthsData.length - 1].cssScrollHeight + v2.monthsData[v2.monthsData.length - 1].cssHeight), c3.cssScrollHeight = i3, e2 == "next" ? v2.endData && w.compareDate(`${v2.endData[0]}-${v2.endData[1]}-${w.getMonthDays(v2.endData[0], v2.endData[1])}`, `${t2[0]}-${t2[1]}-${t2[2]}`) || v2.monthsData.push(c3) : v2.startData && w.compareDate(`${t2[0]}-${t2[1]}-${t2[2]}`, `${v2.startData[0]}-${v2.startData[1]}-01`) ? v2.unLoadPrev = true : v2.monthsData.unshift(c3);
|
|
88
|
+
}, M2 = () => {
|
|
89
|
+
let t2 = s2.startDate ? s2.startDate : w.getDay(0), e2 = s2.endDate ? s2.endDate : w.getDay(365);
|
|
90
|
+
v2.propStartDate = t2, v2.propEndDate = e2, v2.startData = S2(t2), v2.endData = S2(e2), !s2.defaultValue || Array.isArray(s2.defaultValue) && s2.defaultValue.length <= 0 ? v2.currDate = v2.isRange ? [w.date2Str(new Date()), w.getDay(1)] : w.date2Str(new Date()) : v2.currDate = v2.isRange ? [...s2.defaultValue] : s2.defaultValue;
|
|
91
|
+
const a2 = Number(v2.startData[0]), r2 = Number(v2.startData[1]), n2 = Number(v2.endData[0]);
|
|
92
|
+
let o3 = Number(v2.endData[1]) - r2;
|
|
93
|
+
n2 - a2 > 0 && (o3 += 12 * (n2 - a2)), N2(v2.startData, "next");
|
|
94
|
+
let l3 = 1;
|
|
95
|
+
do {
|
|
96
|
+
N2(R2("next"), "next");
|
|
97
|
+
} while (l3++ < o3);
|
|
98
|
+
v2.monthsNum = o3, v2.isRange && Array.isArray(v2.currDate) ? (t2 && w.compareDate(v2.currDate[0], t2) && v2.currDate.splice(0, 1, t2), e2 && w.compareDate(e2, v2.currDate[1]) && v2.currDate.splice(1, 1, e2), v2.defaultData = [...S2(v2.currDate[0]), ...S2(v2.currDate[1])]) : (t2 && w.compareDate(v2.currDate, t2) ? v2.currDate = t2 : e2 && !w.compareDate(v2.currDate, e2) && (v2.currDate = e2), v2.defaultData = [...S2(v2.currDate)]);
|
|
99
|
+
let c3 = 0, D3 = 0;
|
|
100
|
+
v2.monthsData.forEach((t3, e3) => {
|
|
101
|
+
t3.title == T("monthTitle", v2.defaultData[0], v2.defaultData[1]) && (c3 = e3), v2.isRange && t3.title == T("monthTitle", v2.defaultData[3], v2.defaultData[4]) && (D3 = e3);
|
|
102
|
+
}), P2(o3, c3), v2.currentIndex = c3, v2.yearMonthTitle = v2.monthsData[v2.currentIndex].title, v2.isRange ? (H2({ day: v2.defaultData[2], type: "curr" }, v2.monthsData[v2.currentIndex], true), H2({ day: v2.defaultData[5], type: "curr" }, v2.monthsData[D3], true)) : H2({ day: v2.defaultData[2], type: "curr" }, v2.monthsData[v2.currentIndex], true);
|
|
103
|
+
let m3 = v2.monthsData[v2.monthsData.length - 1], p3 = m3.cssHeight + m3.cssScrollHeight;
|
|
104
|
+
g(() => {
|
|
105
|
+
(i2 == null ? void 0 : i2.value) && (u2 == null ? void 0 : u2.value) && (h2 == null ? void 0 : h2.value) && (d2.value = i2.value.clientHeight, u2.value.style.height = `${p3}px`, i2.value.scrollTop = v2.monthsData[v2.currentIndex].cssScrollHeight);
|
|
106
|
+
}), v2.avgHeight = Math.floor(p3 / (o3 + 1));
|
|
107
|
+
}, P2 = (t2, e2) => {
|
|
108
|
+
t2 >= 3 ? e2 > 0 && e2 < t2 ? v2.defaultRange = [e2 - 1, e2 + 3] : e2 == 0 ? v2.defaultRange = [e2, e2 + 4] : e2 == t2 && (v2.defaultRange = [e2 - 2, e2 + 2]) : v2.defaultRange = [0, t2 + 2];
|
|
109
|
+
let a2 = v2.monthsData[v2.defaultRange[0]].cssScrollHeight;
|
|
110
|
+
v2.translateY = a2;
|
|
111
|
+
}, E2 = (t2, e2) => v2.isRange && t2.type == "curr" && k2(t2, e2) == "calendar-month-day-active";
|
|
112
|
+
return M2(), r(() => s2.defaultValue, (t2) => {
|
|
113
|
+
t2 && s2.poppable && (v2.chooseData.splice(0), v2.monthsData.splice(0), M2());
|
|
114
|
+
}), __spreadProps(__spreadValues(__spreadValues({ weeks: c2, compConthsData: m2, showTopBtn: p2, topInfo: y2, bottomInfo: f2, rangeTip: (t2, e2) => {
|
|
115
|
+
if (v2.currDate.length >= 2)
|
|
116
|
+
return w.isEqual(v2.currDate[0], v2.currDate[1]);
|
|
117
|
+
}, mothsViewScroll: (t2) => {
|
|
118
|
+
const e2 = t2.target.scrollTop;
|
|
119
|
+
let a2 = Math.floor(e2 / v2.avgHeight);
|
|
120
|
+
if (a2 == 0)
|
|
121
|
+
e2 >= v2.monthsData[a2 + 1].cssScrollHeight && (a2 += 1);
|
|
122
|
+
else if (a2 > 0 && a2 < v2.monthsNum - 1)
|
|
123
|
+
e2 >= v2.monthsData[a2 + 1].cssScrollHeight && (a2 += 1), e2 < v2.monthsData[a2].cssScrollHeight && (a2 -= 1);
|
|
124
|
+
else {
|
|
125
|
+
const t3 = Math.round(e2 + d2.value);
|
|
126
|
+
t3 < v2.monthsData[a2].cssScrollHeight + v2.monthsData[a2].cssHeight && e2 > v2.monthsData[a2 - 1].cssScrollHeight && (a2 -= 1), a2 + 1 <= v2.monthsNum && t3 >= v2.monthsData[a2 + 1].cssScrollHeight + v2.monthsData[a2 + 1].cssHeight && (a2 += 1), e2 < v2.monthsData[a2 - 1].cssScrollHeight && (a2 -= 1);
|
|
98
127
|
}
|
|
99
|
-
|
|
100
|
-
},
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
};
|
|
110
|
-
const { create, translate } = createComponent("calendar-item");
|
|
111
|
-
const _sfc_main = create({
|
|
112
|
-
props: {
|
|
113
|
-
type: {
|
|
114
|
-
type: String,
|
|
115
|
-
default: "one"
|
|
116
|
-
},
|
|
117
|
-
isAutoBackFill: {
|
|
118
|
-
type: Boolean,
|
|
119
|
-
default: false
|
|
120
|
-
},
|
|
121
|
-
poppable: {
|
|
122
|
-
type: Boolean,
|
|
123
|
-
default: true
|
|
124
|
-
},
|
|
125
|
-
showTitle: {
|
|
126
|
-
type: Boolean,
|
|
127
|
-
default: true
|
|
128
|
-
},
|
|
129
|
-
showSubTitle: {
|
|
130
|
-
type: Boolean,
|
|
131
|
-
default: true
|
|
132
|
-
},
|
|
133
|
-
showToday: {
|
|
134
|
-
type: Boolean,
|
|
135
|
-
default: true
|
|
136
|
-
},
|
|
137
|
-
title: {
|
|
138
|
-
type: String,
|
|
139
|
-
default: ""
|
|
140
|
-
},
|
|
141
|
-
confirmText: {
|
|
142
|
-
type: String,
|
|
143
|
-
default: ""
|
|
144
|
-
},
|
|
145
|
-
startText: {
|
|
146
|
-
type: String,
|
|
147
|
-
default: ""
|
|
148
|
-
},
|
|
149
|
-
endText: {
|
|
150
|
-
type: String,
|
|
151
|
-
default: ""
|
|
152
|
-
},
|
|
153
|
-
defaultValue: {
|
|
154
|
-
type: [String, Array],
|
|
155
|
-
default: null
|
|
156
|
-
},
|
|
157
|
-
startDate: {
|
|
158
|
-
type: String,
|
|
159
|
-
default: Utils.getDay(0)
|
|
160
|
-
},
|
|
161
|
-
endDate: {
|
|
162
|
-
type: String,
|
|
163
|
-
default: Utils.getDay(365)
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
emits: ["choose", "update", "close", "select"],
|
|
167
|
-
setup(props, { emit, slots }) {
|
|
168
|
-
const weeks = ref(translate("weekdays"));
|
|
169
|
-
const months = ref(null);
|
|
170
|
-
const monthsPanel = ref(null);
|
|
171
|
-
const weeksPanel = ref(null);
|
|
172
|
-
const viewArea = ref(null);
|
|
173
|
-
const viewHeight = ref(0);
|
|
174
|
-
const compConthsData = computed(() => {
|
|
175
|
-
return state.monthsData.slice(state.defaultRange[0], state.defaultRange[1]);
|
|
176
|
-
});
|
|
177
|
-
const showTopBtn = computed(() => {
|
|
178
|
-
return slots.btn;
|
|
179
|
-
});
|
|
180
|
-
const topInfo = computed(() => {
|
|
181
|
-
return slots.topInfo;
|
|
182
|
-
});
|
|
183
|
-
const bottomInfo = computed(() => {
|
|
184
|
-
return slots.bottomInfo;
|
|
185
|
-
});
|
|
186
|
-
const state = reactive({
|
|
187
|
-
yearMonthTitle: "",
|
|
188
|
-
defaultRange: [],
|
|
189
|
-
currDate: "",
|
|
190
|
-
propStartDate: "",
|
|
191
|
-
propEndDate: "",
|
|
192
|
-
unLoadPrev: false,
|
|
193
|
-
touchParams: {
|
|
194
|
-
startY: 0,
|
|
195
|
-
endY: 0,
|
|
196
|
-
startTime: 0,
|
|
197
|
-
endTime: 0,
|
|
198
|
-
lastY: 0,
|
|
199
|
-
lastTime: 0
|
|
200
|
-
},
|
|
201
|
-
transformY: 0,
|
|
202
|
-
translateY: 0,
|
|
203
|
-
scrollDistance: 0,
|
|
204
|
-
defaultData: [],
|
|
205
|
-
chooseData: [],
|
|
206
|
-
monthsData: [],
|
|
207
|
-
dayPrefix: "calendar-month-day",
|
|
208
|
-
startData: "",
|
|
209
|
-
endData: "",
|
|
210
|
-
isRange: props.type === "range",
|
|
211
|
-
timer: 0,
|
|
212
|
-
currentIndex: 0,
|
|
213
|
-
avgHeight: 0,
|
|
214
|
-
monthsNum: 0
|
|
215
|
-
});
|
|
216
|
-
const splitDate = (date) => {
|
|
217
|
-
return date.split("-");
|
|
218
|
-
};
|
|
219
|
-
const isStart = (currDate) => {
|
|
220
|
-
return Utils.isEqual(state.currDate[0], currDate);
|
|
221
|
-
};
|
|
222
|
-
const isEnd = (currDate) => {
|
|
223
|
-
return Utils.isEqual(state.currDate[1], currDate);
|
|
224
|
-
};
|
|
225
|
-
const getCurrDate = (day, month, isRange) => {
|
|
226
|
-
return month.curData[0] + "-" + month.curData[1] + "-" + Utils.getNumTwoBit(+day.day);
|
|
227
|
-
};
|
|
228
|
-
const getClass = (day, month, isRange) => {
|
|
229
|
-
const currDate = getCurrDate(day, month);
|
|
230
|
-
if (day.type == "curr") {
|
|
231
|
-
if (!state.isRange && Utils.isEqual(state.currDate, currDate) || state.isRange && (isStart(currDate) || isEnd(currDate))) {
|
|
232
|
-
return `${state.dayPrefix}-active`;
|
|
233
|
-
} else if (state.propStartDate && Utils.compareDate(currDate, state.propStartDate) || state.propEndDate && Utils.compareDate(state.propEndDate, currDate)) {
|
|
234
|
-
return `${state.dayPrefix}-disabled`;
|
|
235
|
-
} else if (state.isRange && Array.isArray(state.currDate) && Object.values(state.currDate).length == 2 && Utils.compareDate(state.currDate[0], currDate) && Utils.compareDate(currDate, state.currDate[1])) {
|
|
236
|
-
return `${state.dayPrefix}-choose`;
|
|
237
|
-
} else {
|
|
238
|
-
return null;
|
|
239
|
-
}
|
|
240
|
-
} else {
|
|
241
|
-
return `${state.dayPrefix}-disabled`;
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
const confirm = () => {
|
|
245
|
-
if (state.isRange && state.chooseData.length == 2 || !state.isRange) {
|
|
246
|
-
emit("choose", state.chooseData);
|
|
247
|
-
if (props.poppable) {
|
|
248
|
-
emit("update");
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
const chooseDay = (day, month, isFirst, isRange) => {
|
|
253
|
-
if (getClass(day, month) != `${state.dayPrefix}-disabled`) {
|
|
254
|
-
let days = [...month.curData];
|
|
255
|
-
days[2] = typeof day.day == "number" ? Utils.getNumTwoBit(day.day) : day.day;
|
|
256
|
-
days[3] = `${days[0]}-${days[1]}-${days[2]}`;
|
|
257
|
-
days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
|
|
258
|
-
if (!state.isRange) {
|
|
259
|
-
state.currDate = days[3];
|
|
260
|
-
state.chooseData = [...days];
|
|
261
|
-
} else {
|
|
262
|
-
if (Object.values(state.currDate).length == 2) {
|
|
263
|
-
state.currDate = [days[3]];
|
|
264
|
-
} else {
|
|
265
|
-
if (Utils.compareDate(state.currDate[0], days[3])) {
|
|
266
|
-
Array.isArray(state.currDate) && state.currDate.push(days[3]);
|
|
267
|
-
} else {
|
|
268
|
-
Array.isArray(state.currDate) && state.currDate.unshift(days[3]);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
if (state.chooseData.length == 2 || !state.chooseData.length) {
|
|
272
|
-
state.chooseData = [...days];
|
|
273
|
-
} else {
|
|
274
|
-
if (Utils.compareDate(state.chooseData[3], days[3])) {
|
|
275
|
-
state.chooseData = [[...state.chooseData], [...days]];
|
|
276
|
-
} else {
|
|
277
|
-
state.chooseData = [[...days], [...state.chooseData]];
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
if (!isFirst) {
|
|
282
|
-
emit("select", state.chooseData);
|
|
283
|
-
if (props.isAutoBackFill) {
|
|
284
|
-
confirm();
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
const getCurrData = (type) => {
|
|
290
|
-
const monthData = type == "prev" ? state.monthsData[0] : state.monthsData[state.monthsData.length - 1];
|
|
291
|
-
let year = parseInt(monthData.curData[0]);
|
|
292
|
-
let month = parseInt(monthData.curData[1].toString().replace(/^0/, ""));
|
|
293
|
-
switch (type) {
|
|
294
|
-
case "prev":
|
|
295
|
-
month == 1 && (year -= 1);
|
|
296
|
-
month = month == 1 ? 12 : --month;
|
|
297
|
-
break;
|
|
298
|
-
case "next":
|
|
299
|
-
month == 12 && (year += 1);
|
|
300
|
-
month = month == 12 ? 1 : ++month;
|
|
301
|
-
break;
|
|
302
|
-
}
|
|
303
|
-
return [year, Utils.getNumTwoBit(month), Utils.getMonthDays(String(year), String(month))];
|
|
304
|
-
};
|
|
305
|
-
const getDaysStatus = (days, type, dateInfo) => {
|
|
306
|
-
let { year, month } = dateInfo;
|
|
307
|
-
if (type == "prev" && days >= 7) {
|
|
308
|
-
days -= 7;
|
|
309
|
-
}
|
|
310
|
-
return Array.from(Array(days), (v, k) => {
|
|
311
|
-
return {
|
|
312
|
-
day: k + 1,
|
|
313
|
-
type,
|
|
314
|
-
year,
|
|
315
|
-
month
|
|
316
|
-
};
|
|
317
|
-
});
|
|
318
|
-
};
|
|
319
|
-
const getPreDaysStatus = (days, type, dateInfo, preCurrMonthDays) => {
|
|
320
|
-
let { year, month } = dateInfo;
|
|
321
|
-
if (type == "prev" && days >= 7) {
|
|
322
|
-
days -= 7;
|
|
323
|
-
}
|
|
324
|
-
let months2 = Array.from(Array(preCurrMonthDays), (v, k) => {
|
|
325
|
-
return {
|
|
326
|
-
day: k + 1,
|
|
327
|
-
type,
|
|
328
|
-
year,
|
|
329
|
-
month
|
|
330
|
-
};
|
|
331
|
-
});
|
|
332
|
-
return months2.slice(preCurrMonthDays - days);
|
|
333
|
-
};
|
|
334
|
-
const getMonth = (curData, type) => {
|
|
335
|
-
const preMonthDays = Utils.getMonthPreDay(+curData[0], +curData[1]);
|
|
336
|
-
let preMonth = curData[1] - 1;
|
|
337
|
-
let preYear = curData[0];
|
|
338
|
-
if (preMonth <= 0) {
|
|
339
|
-
preMonth = 12;
|
|
340
|
-
preYear += 1;
|
|
341
|
-
}
|
|
342
|
-
const currMonthDays = Utils.getMonthDays(curData[0], curData[1]);
|
|
343
|
-
const preCurrMonthDays = Utils.getMonthDays(preYear + "", preMonth + "");
|
|
344
|
-
const title = {
|
|
345
|
-
year: curData[0],
|
|
346
|
-
month: curData[1]
|
|
347
|
-
};
|
|
348
|
-
const monthInfo = {
|
|
349
|
-
curData,
|
|
350
|
-
title: translate("monthTitle", title.year, title.month),
|
|
351
|
-
monthData: [
|
|
352
|
-
...getPreDaysStatus(preMonthDays, "prev", { month: preMonth, year: preYear }, preCurrMonthDays),
|
|
353
|
-
...getDaysStatus(currMonthDays, "curr", title)
|
|
354
|
-
]
|
|
355
|
-
};
|
|
356
|
-
monthInfo.cssHeight = 39 + (monthInfo.monthData.length > 35 ? 384 : 320);
|
|
357
|
-
let cssScrollHeight = 0;
|
|
358
|
-
if (state.monthsData.length > 0) {
|
|
359
|
-
cssScrollHeight = state.monthsData[state.monthsData.length - 1].cssScrollHeight + state.monthsData[state.monthsData.length - 1].cssHeight;
|
|
360
|
-
}
|
|
361
|
-
monthInfo.cssScrollHeight = cssScrollHeight;
|
|
362
|
-
if (type == "next") {
|
|
363
|
-
if (!state.endData || !Utils.compareDate(`${state.endData[0]}-${state.endData[1]}-${Utils.getMonthDays(state.endData[0], state.endData[1])}`, `${curData[0]}-${curData[1]}-${curData[2]}`)) {
|
|
364
|
-
state.monthsData.push(monthInfo);
|
|
365
|
-
}
|
|
366
|
-
} else {
|
|
367
|
-
if (!state.startData || !Utils.compareDate(`${curData[0]}-${curData[1]}-${curData[2]}`, `${state.startData[0]}-${state.startData[1]}-01`)) {
|
|
368
|
-
state.monthsData.unshift(monthInfo);
|
|
369
|
-
} else {
|
|
370
|
-
state.unLoadPrev = true;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
};
|
|
374
|
-
const initData = () => {
|
|
375
|
-
let propStartDate = props.startDate ? props.startDate : Utils.getDay(0);
|
|
376
|
-
let propEndDate = props.endDate ? props.endDate : Utils.getDay(365);
|
|
377
|
-
state.propStartDate = propStartDate;
|
|
378
|
-
state.propEndDate = propEndDate;
|
|
379
|
-
state.startData = splitDate(propStartDate);
|
|
380
|
-
state.endData = splitDate(propEndDate);
|
|
381
|
-
if (!props.defaultValue || Array.isArray(props.defaultValue) && props.defaultValue.length <= 0) {
|
|
382
|
-
state.currDate = state.isRange ? [Utils.date2Str(new Date()), Utils.getDay(1)] : Utils.date2Str(new Date());
|
|
383
|
-
} else {
|
|
384
|
-
state.currDate = state.isRange ? [...props.defaultValue] : props.defaultValue;
|
|
385
|
-
}
|
|
386
|
-
const startDate = {
|
|
387
|
-
year: Number(state.startData[0]),
|
|
388
|
-
month: Number(state.startData[1])
|
|
389
|
-
};
|
|
390
|
-
const endDate = {
|
|
391
|
-
year: Number(state.endData[0]),
|
|
392
|
-
month: Number(state.endData[1])
|
|
393
|
-
};
|
|
394
|
-
let monthsNum = endDate.month - startDate.month;
|
|
395
|
-
if (endDate.year - startDate.year > 0) {
|
|
396
|
-
monthsNum = monthsNum + 12 * (endDate.year - startDate.year);
|
|
397
|
-
}
|
|
398
|
-
getMonth(state.startData, "next");
|
|
399
|
-
let i = 1;
|
|
400
|
-
do {
|
|
401
|
-
getMonth(getCurrData("next"), "next");
|
|
402
|
-
} while (i++ < monthsNum);
|
|
403
|
-
state.monthsNum = monthsNum;
|
|
404
|
-
if (state.isRange && Array.isArray(state.currDate)) {
|
|
405
|
-
if (propStartDate && Utils.compareDate(state.currDate[0], propStartDate)) {
|
|
406
|
-
state.currDate.splice(0, 1, propStartDate);
|
|
407
|
-
}
|
|
408
|
-
if (propEndDate && Utils.compareDate(propEndDate, state.currDate[1])) {
|
|
409
|
-
state.currDate.splice(1, 1, propEndDate);
|
|
410
|
-
}
|
|
411
|
-
state.defaultData = [...splitDate(state.currDate[0]), ...splitDate(state.currDate[1])];
|
|
412
|
-
} else {
|
|
413
|
-
if (propStartDate && Utils.compareDate(state.currDate, propStartDate)) {
|
|
414
|
-
state.currDate = propStartDate;
|
|
415
|
-
} else if (propEndDate && !Utils.compareDate(state.currDate, propEndDate)) {
|
|
416
|
-
state.currDate = propEndDate;
|
|
417
|
-
}
|
|
418
|
-
state.defaultData = [...splitDate(state.currDate)];
|
|
419
|
-
}
|
|
420
|
-
let current = 0;
|
|
421
|
-
let lastCurrent = 0;
|
|
422
|
-
state.monthsData.forEach((item, index) => {
|
|
423
|
-
if (item.title == translate("monthTitle", state.defaultData[0], state.defaultData[1])) {
|
|
424
|
-
current = index;
|
|
425
|
-
}
|
|
426
|
-
if (state.isRange) {
|
|
427
|
-
if (item.title == translate("monthTitle", state.defaultData[3], state.defaultData[4])) {
|
|
428
|
-
lastCurrent = index;
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
});
|
|
432
|
-
setDefaultRange(monthsNum, current);
|
|
433
|
-
state.currentIndex = current;
|
|
434
|
-
state.yearMonthTitle = state.monthsData[state.currentIndex].title;
|
|
435
|
-
if (state.isRange) {
|
|
436
|
-
chooseDay({ day: state.defaultData[2], type: "curr" }, state.monthsData[state.currentIndex], true);
|
|
437
|
-
chooseDay({ day: state.defaultData[5], type: "curr" }, state.monthsData[lastCurrent], true);
|
|
438
|
-
} else {
|
|
439
|
-
chooseDay({ day: state.defaultData[2], type: "curr" }, state.monthsData[state.currentIndex], true);
|
|
440
|
-
}
|
|
441
|
-
let lastItem = state.monthsData[state.monthsData.length - 1];
|
|
442
|
-
let containerHeight = lastItem.cssHeight + lastItem.cssScrollHeight;
|
|
443
|
-
requestAniFrame(() => {
|
|
444
|
-
if ((months == null ? void 0 : months.value) && (monthsPanel == null ? void 0 : monthsPanel.value) && (viewArea == null ? void 0 : viewArea.value)) {
|
|
445
|
-
viewHeight.value = months.value.clientHeight;
|
|
446
|
-
monthsPanel.value.style.height = `${containerHeight}px`;
|
|
447
|
-
months.value.scrollTop = state.monthsData[state.currentIndex].cssScrollHeight;
|
|
448
|
-
}
|
|
449
|
-
});
|
|
450
|
-
state.avgHeight = Math.floor(containerHeight / (monthsNum + 1));
|
|
451
|
-
};
|
|
452
|
-
const setDefaultRange = (monthsNum, current) => {
|
|
453
|
-
if (monthsNum >= 3) {
|
|
454
|
-
if (current > 0 && current < monthsNum) {
|
|
455
|
-
state.defaultRange = [current - 1, current + 3];
|
|
456
|
-
} else if (current == 0) {
|
|
457
|
-
state.defaultRange = [current, current + 4];
|
|
458
|
-
} else if (current == monthsNum) {
|
|
459
|
-
state.defaultRange = [current - 2, current + 2];
|
|
460
|
-
}
|
|
461
|
-
} else {
|
|
462
|
-
state.defaultRange = [0, monthsNum + 2];
|
|
463
|
-
}
|
|
464
|
-
let defaultScrollTop = state.monthsData[state.defaultRange[0]].cssScrollHeight;
|
|
465
|
-
state.translateY = defaultScrollTop;
|
|
466
|
-
};
|
|
467
|
-
const isActive = (day, month) => {
|
|
468
|
-
return state.isRange && day.type == "curr" && getClass(day, month) == "calendar-month-day-active";
|
|
469
|
-
};
|
|
470
|
-
const isStartTip = (day, month) => {
|
|
471
|
-
return isActive(day, month) && isStart(getCurrDate(day, month));
|
|
472
|
-
};
|
|
473
|
-
const isEndTip = (day, month) => {
|
|
474
|
-
if (state.currDate.length >= 2 && isEnd(getCurrDate(day, month))) {
|
|
475
|
-
return isActive(day, month);
|
|
476
|
-
}
|
|
477
|
-
return false;
|
|
478
|
-
};
|
|
479
|
-
const rangeTip = (day, month) => {
|
|
480
|
-
if (state.currDate.length >= 2) {
|
|
481
|
-
return Utils.isEqual(state.currDate[0], state.currDate[1]);
|
|
482
|
-
}
|
|
483
|
-
};
|
|
484
|
-
const isCurrDay = (dateInfo) => {
|
|
485
|
-
const date = `${dateInfo.year}-${dateInfo.month}-${dateInfo.day < 10 ? "0" + dateInfo.day : dateInfo.day}`;
|
|
486
|
-
return Utils.isEqual(date, Utils.date2Str(new Date()));
|
|
487
|
-
};
|
|
488
|
-
const mothsViewScroll = (e) => {
|
|
489
|
-
const currentScrollTop = e.target.scrollTop;
|
|
490
|
-
let current = Math.floor(currentScrollTop / state.avgHeight);
|
|
491
|
-
if (current == 0) {
|
|
492
|
-
if (currentScrollTop >= state.monthsData[current + 1].cssScrollHeight) {
|
|
493
|
-
current += 1;
|
|
494
|
-
}
|
|
495
|
-
} else if (current > 0 && current < state.monthsNum - 1) {
|
|
496
|
-
if (currentScrollTop >= state.monthsData[current + 1].cssScrollHeight) {
|
|
497
|
-
current += 1;
|
|
498
|
-
}
|
|
499
|
-
if (currentScrollTop < state.monthsData[current].cssScrollHeight) {
|
|
500
|
-
current -= 1;
|
|
501
|
-
}
|
|
502
|
-
} else {
|
|
503
|
-
const viewPosition = Math.round(currentScrollTop + viewHeight.value);
|
|
504
|
-
if (viewPosition < state.monthsData[current].cssScrollHeight + state.monthsData[current].cssHeight && currentScrollTop > state.monthsData[current - 1].cssScrollHeight) {
|
|
505
|
-
current -= 1;
|
|
506
|
-
}
|
|
507
|
-
if (current + 1 <= state.monthsNum && viewPosition >= state.monthsData[current + 1].cssScrollHeight + state.monthsData[current + 1].cssHeight) {
|
|
508
|
-
current += 1;
|
|
509
|
-
}
|
|
510
|
-
if (currentScrollTop < state.monthsData[current - 1].cssScrollHeight) {
|
|
511
|
-
current -= 1;
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
if (state.currentIndex !== current) {
|
|
515
|
-
state.currentIndex = current;
|
|
516
|
-
setDefaultRange(state.monthsNum, current);
|
|
517
|
-
}
|
|
518
|
-
state.yearMonthTitle = state.monthsData[current].title;
|
|
519
|
-
};
|
|
520
|
-
const resetRender = () => {
|
|
521
|
-
state.chooseData.splice(0);
|
|
522
|
-
state.monthsData.splice(0);
|
|
523
|
-
initData();
|
|
524
|
-
};
|
|
525
|
-
initData();
|
|
526
|
-
watch(() => props.defaultValue, (val) => {
|
|
527
|
-
if (val) {
|
|
528
|
-
if (props.poppable) {
|
|
529
|
-
resetRender();
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
});
|
|
533
|
-
return __spreadProps(__spreadValues(__spreadValues({
|
|
534
|
-
weeks,
|
|
535
|
-
compConthsData,
|
|
536
|
-
showTopBtn,
|
|
537
|
-
topInfo,
|
|
538
|
-
bottomInfo,
|
|
539
|
-
rangeTip,
|
|
540
|
-
mothsViewScroll,
|
|
541
|
-
getClass,
|
|
542
|
-
isStartTip,
|
|
543
|
-
isEndTip,
|
|
544
|
-
chooseDay,
|
|
545
|
-
isCurrDay,
|
|
546
|
-
confirm,
|
|
547
|
-
monthsPanel,
|
|
548
|
-
months,
|
|
549
|
-
weeksPanel,
|
|
550
|
-
viewArea
|
|
551
|
-
}, toRefs(state)), toRefs(props)), {
|
|
552
|
-
translate
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
});
|
|
556
|
-
const _hoisted_1 = {
|
|
557
|
-
key: 0,
|
|
558
|
-
class: "calendar-title"
|
|
559
|
-
};
|
|
560
|
-
const _hoisted_2 = {
|
|
561
|
-
key: 1,
|
|
562
|
-
class: "calendar-top-slot"
|
|
563
|
-
};
|
|
564
|
-
const _hoisted_3 = {
|
|
565
|
-
key: 2,
|
|
566
|
-
class: "calendar-curr-month"
|
|
567
|
-
};
|
|
568
|
-
const _hoisted_4 = {
|
|
569
|
-
class: "calendar-weeks",
|
|
570
|
-
ref: "weeksPanel"
|
|
571
|
-
};
|
|
572
|
-
const _hoisted_5 = {
|
|
573
|
-
class: "calendar-months-panel",
|
|
574
|
-
ref: "monthsPanel"
|
|
575
|
-
};
|
|
576
|
-
const _hoisted_6 = { class: "calendar-month-title" };
|
|
577
|
-
const _hoisted_7 = { class: "calendar-month-con" };
|
|
578
|
-
const _hoisted_8 = ["onClick"];
|
|
579
|
-
const _hoisted_9 = { class: "calendar-day" };
|
|
580
|
-
const _hoisted_10 = {
|
|
581
|
-
key: 0,
|
|
582
|
-
class: "calendar-curr-tips calendar-curr-tips-top"
|
|
583
|
-
};
|
|
584
|
-
const _hoisted_11 = {
|
|
585
|
-
key: 1,
|
|
586
|
-
class: "calendar-curr-tips calendar-curr-tips-bottom"
|
|
587
|
-
};
|
|
588
|
-
const _hoisted_12 = {
|
|
589
|
-
key: 2,
|
|
590
|
-
class: "calendar-curr-tip-curr"
|
|
591
|
-
};
|
|
592
|
-
const _hoisted_13 = {
|
|
593
|
-
key: 4,
|
|
594
|
-
class: "calendar-day-tip"
|
|
595
|
-
};
|
|
596
|
-
const _hoisted_14 = {
|
|
597
|
-
key: 0,
|
|
598
|
-
class: "nut-calendar-footer"
|
|
599
|
-
};
|
|
600
|
-
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
601
|
-
return openBlock(), createElementBlock("view", {
|
|
602
|
-
class: normalizeClass(["nut-calendar nut-calendar-taro", {
|
|
603
|
-
"nut-calendar-tile": !_ctx.poppable,
|
|
604
|
-
"nut-calendar-nofooter": _ctx.isAutoBackFill
|
|
605
|
-
}])
|
|
606
|
-
}, [
|
|
607
|
-
createElementVNode("view", {
|
|
608
|
-
class: normalizeClass(["nut-calendar-header", { "nut-calendar-header-tile": !_ctx.poppable }])
|
|
609
|
-
}, [
|
|
610
|
-
_ctx.showTitle ? (openBlock(), createElementBlock("view", _hoisted_1, toDisplayString(_ctx.title || _ctx.translate("title")), 1)) : createCommentVNode("", true),
|
|
611
|
-
_ctx.showTopBtn ? (openBlock(), createElementBlock("view", _hoisted_2, [
|
|
612
|
-
renderSlot(_ctx.$slots, "btn")
|
|
613
|
-
])) : createCommentVNode("", true),
|
|
614
|
-
_ctx.showSubTitle ? (openBlock(), createElementBlock("view", _hoisted_3, toDisplayString(_ctx.yearMonthTitle), 1)) : createCommentVNode("", true),
|
|
615
|
-
createElementVNode("view", _hoisted_4, [
|
|
616
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.weeks, (item, index) => {
|
|
617
|
-
return openBlock(), createElementBlock("view", {
|
|
618
|
-
class: "calendar-week-item",
|
|
619
|
-
key: index
|
|
620
|
-
}, toDisplayString(item), 1);
|
|
621
|
-
}), 128))
|
|
622
|
-
], 512)
|
|
623
|
-
], 2),
|
|
624
|
-
createElementVNode("view", {
|
|
625
|
-
class: "nut-calendar-content",
|
|
626
|
-
ref: "months",
|
|
627
|
-
onScroll: _cache[0] || (_cache[0] = (...args) => _ctx.mothsViewScroll && _ctx.mothsViewScroll(...args))
|
|
628
|
-
}, [
|
|
629
|
-
createElementVNode("view", _hoisted_5, [
|
|
630
|
-
createElementVNode("view", {
|
|
631
|
-
class: "viewArea",
|
|
632
|
-
ref: "viewArea",
|
|
633
|
-
style: normalizeStyle({ transform: `translateY(${_ctx.translateY}px)` })
|
|
634
|
-
}, [
|
|
635
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.compConthsData, (month, index) => {
|
|
636
|
-
return openBlock(), createElementBlock("view", {
|
|
637
|
-
class: "calendar-month",
|
|
638
|
-
key: index
|
|
639
|
-
}, [
|
|
640
|
-
createElementVNode("view", _hoisted_6, toDisplayString(month.title), 1),
|
|
641
|
-
createElementVNode("view", _hoisted_7, [
|
|
642
|
-
createElementVNode("view", {
|
|
643
|
-
class: normalizeClass(["calendar-month-item", _ctx.type === "range" ? "month-item-range" : ""])
|
|
644
|
-
}, [
|
|
645
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(month.monthData, (day, i) => {
|
|
646
|
-
return openBlock(), createElementBlock("view", {
|
|
647
|
-
key: i,
|
|
648
|
-
class: normalizeClass(["calendar-month-day", _ctx.getClass(day, month)]),
|
|
649
|
-
onClick: ($event) => _ctx.chooseDay(day, month)
|
|
650
|
-
}, [
|
|
651
|
-
createElementVNode("view", _hoisted_9, [
|
|
652
|
-
renderSlot(_ctx.$slots, "day", {
|
|
653
|
-
date: day.type == "curr" ? day : ""
|
|
654
|
-
}, () => [
|
|
655
|
-
createTextVNode(toDisplayString(day.type == "curr" ? day.day : ""), 1)
|
|
656
|
-
])
|
|
657
|
-
]),
|
|
658
|
-
_ctx.topInfo ? (openBlock(), createElementBlock("view", _hoisted_10, [
|
|
659
|
-
renderSlot(_ctx.$slots, "topInfo", {
|
|
660
|
-
date: day.type == "curr" ? day : ""
|
|
661
|
-
})
|
|
662
|
-
])) : createCommentVNode("", true),
|
|
663
|
-
_ctx.bottomInfo ? (openBlock(), createElementBlock("view", _hoisted_11, [
|
|
664
|
-
renderSlot(_ctx.$slots, "bottomInfo", {
|
|
665
|
-
date: day.type == "curr" ? day : ""
|
|
666
|
-
})
|
|
667
|
-
])) : createCommentVNode("", true),
|
|
668
|
-
!_ctx.bottomInfo && _ctx.showToday && _ctx.isCurrDay(day) ? (openBlock(), createElementBlock("view", _hoisted_12, toDisplayString(_ctx.translate("today")), 1)) : createCommentVNode("", true),
|
|
669
|
-
_ctx.isStartTip(day, month) ? (openBlock(), createElementBlock("view", {
|
|
670
|
-
key: 3,
|
|
671
|
-
class: normalizeClass(["calendar-day-tip", { "calendar-curr-tips-top": _ctx.rangeTip(day, month) }])
|
|
672
|
-
}, toDisplayString(_ctx.startText || _ctx.translate("start")), 3)) : createCommentVNode("", true),
|
|
673
|
-
_ctx.isEndTip(day, month) ? (openBlock(), createElementBlock("view", _hoisted_13, toDisplayString(_ctx.endText || _ctx.translate("end")), 1)) : createCommentVNode("", true)
|
|
674
|
-
], 10, _hoisted_8);
|
|
675
|
-
}), 128))
|
|
676
|
-
], 2)
|
|
677
|
-
])
|
|
678
|
-
]);
|
|
679
|
-
}), 128))
|
|
680
|
-
], 4)
|
|
681
|
-
], 512)
|
|
682
|
-
], 544),
|
|
683
|
-
_ctx.poppable && !_ctx.isAutoBackFill ? (openBlock(), createElementBlock("view", _hoisted_14, [
|
|
684
|
-
createElementVNode("view", {
|
|
685
|
-
class: "calendar-confirm-btn",
|
|
686
|
-
onClick: _cache[1] || (_cache[1] = (...args) => _ctx.confirm && _ctx.confirm(...args))
|
|
687
|
-
}, toDisplayString(_ctx.confirmText || _ctx.translate("confirm")), 1)
|
|
688
|
-
])) : createCommentVNode("", true)
|
|
689
|
-
], 2);
|
|
690
|
-
}
|
|
691
|
-
var CalendarItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
692
|
-
export { CalendarItem as C, Utils as U };
|
|
128
|
+
v2.currentIndex !== a2 && (v2.currentIndex = a2, P2(v2.monthsNum, a2)), v2.yearMonthTitle = v2.monthsData[a2].title;
|
|
129
|
+
}, getClass: k2, isStartTip: (t2, e2) => E2(t2, e2) && b2($2(t2, e2)), isEndTip: (t2, e2) => !!(v2.currDate.length >= 2 && x2($2(t2, e2))) && E2(t2, e2), chooseDay: H2, isCurrDay: (t2) => {
|
|
130
|
+
const e2 = `${t2.year}-${t2.month}-${t2.day < 10 ? "0" + t2.day : t2.day}`;
|
|
131
|
+
return w.isEqual(e2, w.date2Str(new Date()));
|
|
132
|
+
}, confirm: A2, monthsPanel: u2, months: i2, weeksPanel: D2, viewArea: h2 }, n(v2)), n(s2)), { translate: T });
|
|
133
|
+
} }), b = { key: 0, class: "calendar-title" }, x = { key: 1, class: "calendar-top-slot" }, $ = { key: 2, class: "calendar-curr-month" }, k = { class: "calendar-weeks", ref: "weeksPanel" }, A = { class: "calendar-months-panel", ref: "monthsPanel" }, H = { class: "calendar-month-title" }, R = { class: "calendar-month-con" }, I = ["onClick"], B = { class: "calendar-day" }, N = { key: 0, class: "calendar-curr-tips calendar-curr-tips-top" }, M = { key: 1, class: "calendar-curr-tips calendar-curr-tips-bottom" }, P = { key: 2, class: "calendar-curr-tip-curr" }, E = { key: 4, class: "calendar-day-tip" }, Y = { key: 0, class: "nut-calendar-footer" };
|
|
134
|
+
var C = f(S, [["render", function(t2, e2, a2, r2, n2, y2) {
|
|
135
|
+
return s(), o("view", { class: l(["nut-calendar nut-calendar-taro", { "nut-calendar-tile": !t2.poppable, "nut-calendar-nofooter": t2.isAutoBackFill }]) }, [c("view", { class: l(["nut-calendar-header", { "nut-calendar-header-tile": !t2.poppable }]) }, [t2.showTitle ? (s(), o("view", b, i(t2.title || t2.translate("title")), 1)) : u("", true), t2.showTopBtn ? (s(), o("view", x, [D(t2.$slots, "btn")])) : u("", true), t2.showSubTitle ? (s(), o("view", $, i(t2.yearMonthTitle), 1)) : u("", true), c("view", k, [(s(true), o(h, null, d(t2.weeks, (t3, e3) => (s(), o("view", { class: "calendar-week-item", key: e3 }, i(t3), 1))), 128))], 512)], 2), c("view", { class: "nut-calendar-content", ref: "months", onScroll: e2[0] || (e2[0] = (...e3) => t2.mothsViewScroll && t2.mothsViewScroll(...e3)) }, [c("view", A, [c("view", { class: "viewArea", ref: "viewArea", style: m({ transform: `translateY(${t2.translateY}px)` }) }, [(s(true), o(h, null, d(t2.compConthsData, (e3, a3) => (s(), o("view", { class: "calendar-month", key: a3 }, [c("view", H, i(e3.title), 1), c("view", R, [c("view", { class: l(["calendar-month-item", t2.type === "range" ? "month-item-range" : ""]) }, [(s(true), o(h, null, d(e3.monthData, (a4, r3) => (s(), o("view", { key: r3, class: l(["calendar-month-day", t2.getClass(a4, e3)]), onClick: (r4) => t2.chooseDay(a4, e3) }, [c("view", B, [D(t2.$slots, "day", { date: a4.type == "curr" ? a4 : "" }, () => [p(i(a4.type == "curr" ? a4.day : ""), 1)])]), t2.topInfo ? (s(), o("view", N, [D(t2.$slots, "topInfo", { date: a4.type == "curr" ? a4 : "" })])) : u("", true), t2.bottomInfo ? (s(), o("view", M, [D(t2.$slots, "bottomInfo", { date: a4.type == "curr" ? a4 : "" })])) : u("", true), !t2.bottomInfo && t2.showToday && t2.isCurrDay(a4) ? (s(), o("view", P, i(t2.translate("today")), 1)) : u("", true), t2.isStartTip(a4, e3) ? (s(), o("view", { key: 3, class: l(["calendar-day-tip", { "calendar-curr-tips-top": t2.rangeTip(a4, e3) }]) }, i(t2.startText || t2.translate("start")), 3)) : u("", true), t2.isEndTip(a4, e3) ? (s(), o("view", E, i(t2.endText || t2.translate("end")), 1)) : u("", true)], 10, I))), 128))], 2)])]))), 128))], 4)], 512)], 544), t2.poppable && !t2.isAutoBackFill ? (s(), o("view", Y, [c("view", { class: "calendar-confirm-btn", onClick: e2[1] || (e2[1] = (...e3) => t2.confirm && t2.confirm(...e3)) }, i(t2.confirmText || t2.translate("confirm")), 1)])) : u("", true)], 2);
|
|
136
|
+
}]]);
|
|
137
|
+
export { C, w as U };
|