@nutui/nutui-react-taro 2.0.22 → 2.0.23
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/CHANGELOG.md +13 -0
- package/dist/esm/ActionSheet/style/style.css +1 -1
- package/dist/esm/ActionSheet.js +6 -3
- package/dist/esm/Address/style/style.css +1 -1
- package/dist/esm/Address.js +7 -5
- package/dist/esm/Audio.js +3 -3
- package/dist/esm/Calendar/style/style.css +1 -1
- package/dist/esm/Calendar.js +7 -4
- package/dist/esm/CalendarCard/style/css.js +1 -0
- package/dist/esm/CalendarCard/style/index.js +2 -0
- package/dist/esm/CalendarCard/style/style.css +1 -0
- package/dist/esm/CalendarCard.js +11 -0
- package/dist/esm/CalendarItem.js +2 -1
- package/dist/esm/Cascader/style/style.css +1 -1
- package/dist/esm/Cascader.js +6 -4
- package/dist/esm/DatePicker/style/style.css +1 -1
- package/dist/esm/DatePicker.js +6 -6
- package/dist/esm/Dialog/style/style.css +1 -1
- package/dist/esm/Dialog.js +4 -2
- package/dist/esm/FixedNav/style/style.css +1 -1
- package/dist/esm/FixedNav.js +5 -2
- package/dist/esm/ImagePreview/style/style.css +1 -1
- package/dist/esm/ImagePreview.js +5 -3
- package/dist/esm/Menu/style/style.css +1 -1
- package/dist/esm/Menu.js +5 -3
- package/dist/esm/MenuItem/style/style.css +1 -1
- package/dist/esm/MenuItem.js +4 -2
- package/dist/esm/NoticeBar/style/style.css +1 -1
- package/dist/esm/NoticeBar.js +1 -1
- package/dist/esm/NumberKeyboard/style/style.css +1 -1
- package/dist/esm/NumberKeyboard.js +6 -3
- package/dist/esm/Overlay/style/style.css +1 -1
- package/dist/esm/Overlay.js +4 -1
- package/dist/esm/Picker/style/style.css +1 -1
- package/dist/esm/Picker.js +5 -5
- package/dist/esm/Popover/style/style.css +1 -1
- package/dist/esm/Popover.js +5 -3
- package/dist/esm/Popup/style/style.css +1 -1
- package/dist/esm/Popup.js +5 -2
- package/dist/esm/PullToRefresh.js +2 -2
- package/dist/esm/Range.js +2 -2
- package/dist/esm/SearchBar.js +1 -1
- package/dist/esm/ShortPassword/style/style.css +1 -1
- package/dist/esm/ShortPassword.js +6 -3
- package/dist/esm/SideNavBar/style/style.css +1 -1
- package/dist/esm/SideNavBar.js +6 -3
- package/dist/esm/Sticky.js +2 -2
- package/dist/esm/Swipe.js +2 -2
- package/dist/esm/TimeSelect/style/style.css +1 -1
- package/dist/esm/TimeSelect.js +6 -3
- package/dist/esm/Toast.js +5 -3
- package/dist/esm/Tour/style/style.css +1 -1
- package/dist/esm/Tour.js +6 -4
- package/dist/esm/{actionsheet.taro-4ce9962a.js → actionsheet.taro-c3556cf1.js} +1 -1
- package/dist/esm/{address.taro-4295c3b3.js → address.taro-315e935e.js} +2 -2
- package/dist/esm/{audio.taro-abacd130.js → audio.taro-c98ee643.js} +1 -1
- package/dist/esm/{calendar.taro-802f92e1.js → calendar.taro-7c342305.js} +3 -2
- package/dist/esm/calendarcard.taro-cef184a2.js +400 -0
- package/dist/esm/{calendaritem.taro-f1995224.js → calendaritem.taro-da659861.js} +4 -218
- package/dist/esm/{cascader.taro-9070043a.js → cascader.taro-fe8472ca.js} +1 -1
- package/dist/esm/date-04589b69.js +222 -0
- package/dist/esm/{datepicker.taro-59c99fd7.js → datepicker.taro-5d8f0e45.js} +3 -3
- package/dist/esm/{dialog.taro-eb61fb7a.js → dialog.taro-2e0e7c57.js} +3 -2
- package/dist/esm/{fixednav.taro-0d998d65.js → fixednav.taro-bd96e277.js} +1 -1
- package/dist/esm/get-scroll-parent-3d880563.js +25 -0
- package/dist/esm/{imagepreview.taro-8bbafaa4.js → imagepreview.taro-44db4eba.js} +1 -1
- package/dist/esm/{menu.taro-cad143e1.js → menu.taro-f3e49415.js} +1 -1
- package/dist/esm/{menuitem.taro-60e01217.js → menuitem.taro-0045e4a8.js} +1 -1
- package/dist/esm/{noticebar.taro-bc771bc9.js → noticebar.taro-11fe07b1.js} +7 -8
- package/dist/esm/{numberkeyboard.taro-ec8f8435.js → numberkeyboard.taro-7d5a8c83.js} +1 -1
- package/dist/esm/nutui-react.es.js +46 -43
- package/dist/esm/overlay.taro-ad4b4c8a.js +153 -0
- package/dist/esm/{picker.taro-11d54577.js → picker.taro-4cbe43f7.js} +24 -27
- package/dist/esm/{popover.taro-539d15e4.js → popover.taro-076ba3ac.js} +1 -1
- package/dist/esm/{popup.taro-3273aa87.js → popup.taro-6f68b86f.js} +7 -7
- package/dist/esm/{pulltorefresh.taro-f3ab76c2.js → pulltorefresh.taro-57993124.js} +2 -2
- package/dist/esm/{range.taro-021442f5.js → range.taro-5254c32d.js} +3 -3
- package/dist/esm/{searchbar.taro-7daf43fc.js → searchbar.taro-9729e815.js} +7 -6
- package/dist/esm/{shortpassword.taro-b01da5b3.js → shortpassword.taro-e29734ce.js} +1 -1
- package/dist/esm/{sidenavbar.taro-97230c40.js → sidenavbar.taro-f1b1b6f0.js} +1 -1
- package/dist/esm/{sticky.taro-2b9a5231.js → sticky.taro-bee7a130.js} +1 -21
- package/dist/esm/{swipe.taro-3d5c4b51.js → swipe.taro-20be8e8c.js} +11 -6
- package/dist/esm/{timeselect.taro-892ca807.js → timeselect.taro-58a9729d.js} +1 -1
- package/dist/esm/{toast.taro-3bdf6d67.js → toast.taro-d63f6e12.js} +1 -1
- package/dist/esm/{tour.taro-b38e06a5.js → tour.taro-2c596c1e.js} +1 -1
- package/dist/esm/types/src/packages/calendarcard/__tests__/calendarcard.spec.d.ts +1 -0
- package/dist/esm/types/src/packages/calendarcard/calendarcard.d.ts +24 -0
- package/dist/esm/types/src/packages/calendarcard/calendarcard.taro.d.ts +24 -0
- package/dist/esm/types/src/packages/calendarcard/demo.d.ts +3 -0
- package/dist/esm/types/src/packages/calendarcard/demo.taro.d.ts +3 -0
- package/dist/esm/types/src/packages/calendarcard/icon.d.ts +5 -0
- package/dist/esm/types/src/packages/calendarcard/icon.taro.d.ts +5 -0
- package/dist/esm/types/src/packages/calendarcard/index.d.ts +3 -0
- package/dist/esm/types/src/packages/calendarcard/index.taro.d.ts +3 -0
- package/dist/esm/types/src/packages/calendarcard/types.d.ts +11 -0
- package/dist/esm/types/src/packages/calendarcard/utils.d.ts +19 -0
- package/dist/esm/types/src/packages/datepicker/datepicker.d.ts +2 -1
- package/dist/esm/types/src/packages/datepicker/datepicker.taro.d.ts +2 -1
- package/dist/esm/types/src/packages/nutui.react.build.d.ts +2 -1
- package/dist/esm/types/src/packages/nutui.react.d.ts +3 -1
- package/dist/esm/types/src/packages/nutui.react.scss.d.ts +1 -0
- package/dist/esm/types/src/packages/nutui.react.taro.d.ts +3 -1
- package/dist/esm/types/src/packages/nutui.react.taro.scss.d.ts +1 -0
- package/dist/esm/types/src/packages/nutui.taro.react.build.d.ts +2 -1
- package/dist/esm/types/src/packages/picker/picker.d.ts +2 -0
- package/dist/esm/types/src/packages/picker/picker.taro.d.ts +2 -0
- package/dist/esm/types/src/utils/use-lock-scoll-taro.d.ts +2 -0
- package/dist/esm/types/src/utils/use-lock-scroll.d.ts +2 -0
- package/dist/esm/types/src/utils/use-touch.d.ts +8 -9
- package/dist/esm/use-touch-38cf73ae.js +61 -0
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/tr-TR.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.es.js +787 -325
- package/dist/nutui.react.umd.js +786 -324
- package/dist/packages/calendarcard/calendarcard.scss +104 -0
- package/dist/packages/noticebar/noticebar.scss +1 -0
- package/dist/packages/overlay/overlay.scss +5 -0
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/themes/default.scss +1 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/packages/calendarcard/calendarcard.taro.d.ts +76 -0
- package/dist/types/packages/calendarcard/icon.taro.d.ts +5 -0
- package/dist/types/packages/calendarcard/index.taro.d.ts +3 -0
- package/dist/types/packages/calendarcard/types.d.ts +11 -0
- package/dist/types/packages/calendarcard/utils.d.ts +19 -0
- package/dist/types/packages/datepicker/datepicker.taro.d.ts +6 -1
- package/dist/types/packages/picker/picker.taro.d.ts +6 -0
- package/dist/types/utils/use-lock-scoll-taro.d.ts +1 -0
- package/dist/types/utils/use-lock-scroll.d.ts +2 -0
- package/dist/types/utils/use-touch.d.ts +8 -9
- package/package.json +1 -1
- package/dist/esm/can-use-dom-0e539bd3.js +0 -4
- package/dist/esm/overlay.taro-626840fc.js +0 -73
- package/dist/esm/types/src/packages/dialog/dialogwrap.taro.d.ts +0 -14
- package/dist/esm/use-touch-ff43512c.js +0 -69
- package/dist/types/packages/overlay/index.d.ts +0 -3
- package/dist/types/packages/overlay/overlay.d.ts +0 -14
- package/dist/types/packages/picker/index.d.ts +0 -4
- package/dist/types/packages/picker/picker.d.ts +0 -23
- package/dist/types/packages/picker/pickerpanel.d.ts +0 -15
- package/dist/types/packages/popup/index.d.ts +0 -3
- package/dist/types/packages/popup/popup.d.ts +0 -24
|
@@ -3,225 +3,10 @@ import classNames from "classnames";
|
|
|
3
3
|
import { ScrollView } from "@tarojs/components";
|
|
4
4
|
import Taro, { nextTick } from "@tarojs/taro";
|
|
5
5
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
6
|
+
import { U as Utils, g as getPreMonthDates, a as getDaysStatus, b as getCurrMonthData } from "./date-04589b69.js";
|
|
6
7
|
import { r as requestAniFrame } from "./raf-a9ff50ad.js";
|
|
7
8
|
import { u as useConfig } from "./configprovider.taro-c5ff4877.js";
|
|
8
9
|
import { u as usePropsValue } from "./use-props-value-7637d900.js";
|
|
9
|
-
const Utils = {
|
|
10
|
-
/**
|
|
11
|
-
* 是否为闫年
|
|
12
|
-
* @return {Boolse} true|false
|
|
13
|
-
*/
|
|
14
|
-
isLeapYear(y) {
|
|
15
|
-
return y % 4 === 0 && y % 100 !== 0 || y % 400 === 0;
|
|
16
|
-
},
|
|
17
|
-
/**
|
|
18
|
-
* 返回星期数
|
|
19
|
-
* @return {String}
|
|
20
|
-
*/
|
|
21
|
-
getWhatDay(year, month, day) {
|
|
22
|
-
const date = /* @__PURE__ */ new Date(`${year}/${month}/${day}`);
|
|
23
|
-
const index = date.getDay();
|
|
24
|
-
const dayNames = [
|
|
25
|
-
"星期日",
|
|
26
|
-
"星期一",
|
|
27
|
-
"星期二",
|
|
28
|
-
"星期三",
|
|
29
|
-
"星期四",
|
|
30
|
-
"星期五",
|
|
31
|
-
"星期六"
|
|
32
|
-
];
|
|
33
|
-
return dayNames[index];
|
|
34
|
-
},
|
|
35
|
-
/**
|
|
36
|
-
* 返回上一个月在当前面板中的天数
|
|
37
|
-
* @return {Number}
|
|
38
|
-
*/
|
|
39
|
-
getMonthPreDay(year, month) {
|
|
40
|
-
const date = /* @__PURE__ */ new Date(`${year}/${month}/01`);
|
|
41
|
-
let day = date.getDay();
|
|
42
|
-
if (day === 0) {
|
|
43
|
-
day = 7;
|
|
44
|
-
}
|
|
45
|
-
return day;
|
|
46
|
-
},
|
|
47
|
-
/**
|
|
48
|
-
* 返回月份天数
|
|
49
|
-
* @return {Number}
|
|
50
|
-
*/
|
|
51
|
-
getMonthDays(year, month) {
|
|
52
|
-
if (/^0/.test(month)) {
|
|
53
|
-
month = month.split("")[1];
|
|
54
|
-
}
|
|
55
|
-
return [
|
|
56
|
-
0,
|
|
57
|
-
31,
|
|
58
|
-
this.isLeapYear(Number(year)) ? 29 : 28,
|
|
59
|
-
31,
|
|
60
|
-
30,
|
|
61
|
-
31,
|
|
62
|
-
30,
|
|
63
|
-
31,
|
|
64
|
-
31,
|
|
65
|
-
30,
|
|
66
|
-
31,
|
|
67
|
-
30,
|
|
68
|
-
31
|
|
69
|
-
][month];
|
|
70
|
-
},
|
|
71
|
-
/**
|
|
72
|
-
* 补齐数字位数
|
|
73
|
-
* @return {string}
|
|
74
|
-
*/
|
|
75
|
-
getNumTwoBit(n) {
|
|
76
|
-
n = Number(n);
|
|
77
|
-
return (n > 9 ? "" : "0") + n;
|
|
78
|
-
},
|
|
79
|
-
/**
|
|
80
|
-
* 日期对象转成字符串
|
|
81
|
-
* @return {string}
|
|
82
|
-
*/
|
|
83
|
-
date2Str(date, split) {
|
|
84
|
-
split = split || "-";
|
|
85
|
-
const y = date.getFullYear();
|
|
86
|
-
const m = this.getNumTwoBit(date.getMonth() + 1);
|
|
87
|
-
const d = this.getNumTwoBit(date.getDate());
|
|
88
|
-
return [y, m, d].join(split);
|
|
89
|
-
},
|
|
90
|
-
/**
|
|
91
|
-
* 返回日期格式字符串
|
|
92
|
-
* @param {Number} 0返回今天的日期、1返回明天的日期,2返回后天得日期,依次类推
|
|
93
|
-
* @return {string} '2014-12-31'
|
|
94
|
-
*/
|
|
95
|
-
getDay(i) {
|
|
96
|
-
i = i || 0;
|
|
97
|
-
let date = /* @__PURE__ */ new Date();
|
|
98
|
-
const diff = i * (1e3 * 60 * 60 * 24);
|
|
99
|
-
date = new Date(date.getTime() + diff);
|
|
100
|
-
return this.date2Str(date);
|
|
101
|
-
},
|
|
102
|
-
/**
|
|
103
|
-
* 时间比较
|
|
104
|
-
* @return {Boolean}
|
|
105
|
-
*/
|
|
106
|
-
compareDate(date1, date2) {
|
|
107
|
-
const startTime = new Date(date1.replace("-", "/").replace("-", "/"));
|
|
108
|
-
const endTime = new Date(date2.replace("-", "/").replace("-", "/"));
|
|
109
|
-
if (startTime >= endTime) {
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
return true;
|
|
113
|
-
},
|
|
114
|
-
/**
|
|
115
|
-
* 时间是否相等
|
|
116
|
-
* @return {Boolean}
|
|
117
|
-
*/
|
|
118
|
-
isEqual(date1, date2) {
|
|
119
|
-
const startTime = new Date((date1 || "").replace(/-/g, "/")).getTime();
|
|
120
|
-
const endTime = new Date(date2.replace(/-/g, "/")).getTime();
|
|
121
|
-
if (startTime === endTime) {
|
|
122
|
-
return true;
|
|
123
|
-
}
|
|
124
|
-
return false;
|
|
125
|
-
},
|
|
126
|
-
getMonthWeek(year, month, date, firstDayOfWeek = 0) {
|
|
127
|
-
const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date));
|
|
128
|
-
let w = dateNow.getDay();
|
|
129
|
-
const d = dateNow.getDate();
|
|
130
|
-
let remainder = 6 - w;
|
|
131
|
-
if (firstDayOfWeek !== 0) {
|
|
132
|
-
w = w === 0 ? 7 : w;
|
|
133
|
-
remainder = 7 - w;
|
|
134
|
-
}
|
|
135
|
-
return Math.ceil((d + remainder) / 7);
|
|
136
|
-
},
|
|
137
|
-
getYearWeek(year, month, date, firstDayOfWeek = 0) {
|
|
138
|
-
const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date));
|
|
139
|
-
const dateFirst = new Date(Number(year), 0, 1);
|
|
140
|
-
const dataNumber = Math.round((dateNow.valueOf() - dateFirst.valueOf()) / 864e5);
|
|
141
|
-
return Math.ceil((dataNumber + (dateFirst.getDay() + 1 - 1)) / 7);
|
|
142
|
-
},
|
|
143
|
-
getWeekDate(year, month, date, firstDayOfWeek = 0) {
|
|
144
|
-
const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date));
|
|
145
|
-
const nowTime = dateNow.getTime();
|
|
146
|
-
let day = dateNow.getDay();
|
|
147
|
-
if (firstDayOfWeek === 0) {
|
|
148
|
-
const oneDayTime2 = 24 * 60 * 60 * 1e3;
|
|
149
|
-
const SundayTime2 = nowTime - day * oneDayTime2;
|
|
150
|
-
const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
|
|
151
|
-
const sunday2 = this.date2Str(new Date(SundayTime2));
|
|
152
|
-
const saturday = this.date2Str(new Date(SaturdayTime));
|
|
153
|
-
return [sunday2, saturday];
|
|
154
|
-
}
|
|
155
|
-
day = day === 0 ? 7 : day;
|
|
156
|
-
const oneDayTime = 24 * 60 * 60 * 1e3;
|
|
157
|
-
const MondayTime = nowTime - (day - 1) * oneDayTime;
|
|
158
|
-
const SundayTime = nowTime + (7 - day) * oneDayTime;
|
|
159
|
-
const monday = this.date2Str(new Date(MondayTime));
|
|
160
|
-
const sunday = this.date2Str(new Date(SundayTime));
|
|
161
|
-
return [monday, sunday];
|
|
162
|
-
},
|
|
163
|
-
formatResultDate(date) {
|
|
164
|
-
const days = [...date.split("-")];
|
|
165
|
-
days[2] = Utils.getNumTwoBit(Number(days[2]));
|
|
166
|
-
days[3] = `${days[0]}-${days[1]}-${days[2]}`;
|
|
167
|
-
days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
|
|
168
|
-
return days;
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
const getCurrMonthData = (type, year, month) => {
|
|
172
|
-
switch (type) {
|
|
173
|
-
case "prev":
|
|
174
|
-
month === 1 && (year -= 1);
|
|
175
|
-
month = month === 1 ? 12 : --month;
|
|
176
|
-
break;
|
|
177
|
-
case "next":
|
|
178
|
-
month === 12 && (year += 1);
|
|
179
|
-
month = month === 12 ? 1 : ++month;
|
|
180
|
-
break;
|
|
181
|
-
}
|
|
182
|
-
return [
|
|
183
|
-
year,
|
|
184
|
-
Utils.getNumTwoBit(month),
|
|
185
|
-
Utils.getMonthDays(String(year), String(month))
|
|
186
|
-
];
|
|
187
|
-
};
|
|
188
|
-
const getDaysStatus = (type, year, month) => {
|
|
189
|
-
let days = Utils.getMonthDays(`${year}`, `${month}`);
|
|
190
|
-
if (type === "prev" && days >= 7) {
|
|
191
|
-
days -= 7;
|
|
192
|
-
}
|
|
193
|
-
return Array.from(Array(days), (v, k) => {
|
|
194
|
-
return {
|
|
195
|
-
day: k + 1,
|
|
196
|
-
type,
|
|
197
|
-
year,
|
|
198
|
-
month
|
|
199
|
-
};
|
|
200
|
-
});
|
|
201
|
-
};
|
|
202
|
-
const getPreMonthDates = (type, year, month, firstDayOfWeek) => {
|
|
203
|
-
let preMonth = +month - 1;
|
|
204
|
-
let preYear = year;
|
|
205
|
-
if (preMonth <= 0) {
|
|
206
|
-
preMonth = 12;
|
|
207
|
-
preYear += 1;
|
|
208
|
-
}
|
|
209
|
-
let days = Utils.getMonthPreDay(+year, +month);
|
|
210
|
-
days -= firstDayOfWeek;
|
|
211
|
-
if (type === "prev" && days >= 7) {
|
|
212
|
-
days -= 7;
|
|
213
|
-
}
|
|
214
|
-
const preDates = Utils.getMonthDays(`${preYear}`, `${preMonth}`);
|
|
215
|
-
const months = Array.from(Array(preDates), (v, k) => {
|
|
216
|
-
return {
|
|
217
|
-
day: k + 1,
|
|
218
|
-
type,
|
|
219
|
-
preYear,
|
|
220
|
-
preMonth
|
|
221
|
-
};
|
|
222
|
-
});
|
|
223
|
-
return months.slice(preDates - days);
|
|
224
|
-
};
|
|
225
10
|
const splitDate = (date) => {
|
|
226
11
|
const split = date.indexOf("-") !== -1 ? "-" : "/";
|
|
227
12
|
return date.split(split);
|
|
@@ -594,6 +379,8 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
594
379
|
const scrollTop2 = e.detail.scrollTop;
|
|
595
380
|
Taro.getEnv() === "WEB" && setScrollTop(scrollTop2);
|
|
596
381
|
let current = Math.floor(scrollTop2 / avgHeight);
|
|
382
|
+
if (!monthsData[current + 1])
|
|
383
|
+
return;
|
|
597
384
|
const nextTop = monthsData[current + 1].scrollTop;
|
|
598
385
|
const nextHeight = monthsData[current + 1].cssHeight;
|
|
599
386
|
if (current === 0) {
|
|
@@ -802,6 +589,5 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
802
589
|
CalendarItem.defaultProps = defaultProps;
|
|
803
590
|
CalendarItem.displayName = "NutCalendarItem";
|
|
804
591
|
export {
|
|
805
|
-
CalendarItem as C
|
|
806
|
-
Utils as U
|
|
592
|
+
CalendarItem as C
|
|
807
593
|
};
|
|
@@ -7,7 +7,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7
7
|
import React__default, { useState, useEffect, isValidElement } from "react";
|
|
8
8
|
import classNames from "classnames";
|
|
9
9
|
import { Loading, Checklist } from "@nutui/icons-react-taro";
|
|
10
|
-
import { P as Popup } from "./popup.taro-
|
|
10
|
+
import { P as Popup } from "./popup.taro-6f68b86f.js";
|
|
11
11
|
import { T as Tabs } from "./tabs.taro-f4239f2d.js";
|
|
12
12
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
13
13
|
import { u as usePropsValue } from "./use-props-value-7637d900.js";
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
const Utils = {
|
|
2
|
+
/**
|
|
3
|
+
* 是否为闫年
|
|
4
|
+
* @return {Boolse} true|false
|
|
5
|
+
*/
|
|
6
|
+
isLeapYear(y) {
|
|
7
|
+
return y % 4 === 0 && y % 100 !== 0 || y % 400 === 0;
|
|
8
|
+
},
|
|
9
|
+
/**
|
|
10
|
+
* 返回星期数
|
|
11
|
+
* @return {String}
|
|
12
|
+
*/
|
|
13
|
+
getWhatDay(year, month, day) {
|
|
14
|
+
const date = /* @__PURE__ */ new Date(`${year}/${month}/${day}`);
|
|
15
|
+
const index = date.getDay();
|
|
16
|
+
const dayNames = [
|
|
17
|
+
"星期日",
|
|
18
|
+
"星期一",
|
|
19
|
+
"星期二",
|
|
20
|
+
"星期三",
|
|
21
|
+
"星期四",
|
|
22
|
+
"星期五",
|
|
23
|
+
"星期六"
|
|
24
|
+
];
|
|
25
|
+
return dayNames[index];
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* 返回上一个月在当前面板中的天数
|
|
29
|
+
* @return {Number}
|
|
30
|
+
*/
|
|
31
|
+
getMonthPreDay(year, month) {
|
|
32
|
+
const date = /* @__PURE__ */ new Date(`${year}/${month}/01`);
|
|
33
|
+
let day = date.getDay();
|
|
34
|
+
if (day === 0) {
|
|
35
|
+
day = 7;
|
|
36
|
+
}
|
|
37
|
+
return day;
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* 返回月份天数
|
|
41
|
+
* @return {Number}
|
|
42
|
+
*/
|
|
43
|
+
getMonthDays(year, month) {
|
|
44
|
+
if (/^0/.test(month)) {
|
|
45
|
+
month = month.split("")[1];
|
|
46
|
+
}
|
|
47
|
+
return [
|
|
48
|
+
0,
|
|
49
|
+
31,
|
|
50
|
+
this.isLeapYear(Number(year)) ? 29 : 28,
|
|
51
|
+
31,
|
|
52
|
+
30,
|
|
53
|
+
31,
|
|
54
|
+
30,
|
|
55
|
+
31,
|
|
56
|
+
31,
|
|
57
|
+
30,
|
|
58
|
+
31,
|
|
59
|
+
30,
|
|
60
|
+
31
|
|
61
|
+
][month];
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* 补齐数字位数
|
|
65
|
+
* @return {string}
|
|
66
|
+
*/
|
|
67
|
+
getNumTwoBit(n) {
|
|
68
|
+
n = Number(n);
|
|
69
|
+
return (n > 9 ? "" : "0") + n;
|
|
70
|
+
},
|
|
71
|
+
/**
|
|
72
|
+
* 日期对象转成字符串
|
|
73
|
+
* @return {string}
|
|
74
|
+
*/
|
|
75
|
+
date2Str(date, split) {
|
|
76
|
+
split = split || "-";
|
|
77
|
+
const y = date.getFullYear();
|
|
78
|
+
const m = this.getNumTwoBit(date.getMonth() + 1);
|
|
79
|
+
const d = this.getNumTwoBit(date.getDate());
|
|
80
|
+
return [y, m, d].join(split);
|
|
81
|
+
},
|
|
82
|
+
/**
|
|
83
|
+
* 返回日期格式字符串
|
|
84
|
+
* @param {Number} 0返回今天的日期、1返回明天的日期,2返回后天得日期,依次类推
|
|
85
|
+
* @return {string} '2014-12-31'
|
|
86
|
+
*/
|
|
87
|
+
getDay(i) {
|
|
88
|
+
i = i || 0;
|
|
89
|
+
let date = /* @__PURE__ */ new Date();
|
|
90
|
+
const diff = i * (1e3 * 60 * 60 * 24);
|
|
91
|
+
date = new Date(date.getTime() + diff);
|
|
92
|
+
return this.date2Str(date);
|
|
93
|
+
},
|
|
94
|
+
/**
|
|
95
|
+
* 时间比较
|
|
96
|
+
* @return {Boolean}
|
|
97
|
+
*/
|
|
98
|
+
compareDate(date1, date2) {
|
|
99
|
+
const startTime = new Date(date1.replace("-", "/").replace("-", "/"));
|
|
100
|
+
const endTime = new Date(date2.replace("-", "/").replace("-", "/"));
|
|
101
|
+
if (startTime >= endTime) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
return true;
|
|
105
|
+
},
|
|
106
|
+
/**
|
|
107
|
+
* 时间是否相等
|
|
108
|
+
* @return {Boolean}
|
|
109
|
+
*/
|
|
110
|
+
isEqual(date1, date2) {
|
|
111
|
+
const startTime = new Date((date1 || "").replace(/-/g, "/")).getTime();
|
|
112
|
+
const endTime = new Date(date2.replace(/-/g, "/")).getTime();
|
|
113
|
+
if (startTime === endTime) {
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
},
|
|
118
|
+
getMonthWeek(year, month, date, firstDayOfWeek = 0) {
|
|
119
|
+
const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date));
|
|
120
|
+
let w = dateNow.getDay();
|
|
121
|
+
const d = dateNow.getDate();
|
|
122
|
+
let remainder = 6 - w;
|
|
123
|
+
if (firstDayOfWeek !== 0) {
|
|
124
|
+
w = w === 0 ? 7 : w;
|
|
125
|
+
remainder = 7 - w;
|
|
126
|
+
}
|
|
127
|
+
return Math.ceil((d + remainder) / 7);
|
|
128
|
+
},
|
|
129
|
+
getYearWeek(year, month, date, firstDayOfWeek = 0) {
|
|
130
|
+
const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date));
|
|
131
|
+
const dateFirst = new Date(Number(year), 0, 1);
|
|
132
|
+
const dataNumber = Math.round((dateNow.valueOf() - dateFirst.valueOf()) / 864e5);
|
|
133
|
+
return Math.ceil((dataNumber + (dateFirst.getDay() + 1 - 1)) / 7);
|
|
134
|
+
},
|
|
135
|
+
getWeekDate(year, month, date, firstDayOfWeek = 0) {
|
|
136
|
+
const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date));
|
|
137
|
+
const nowTime = dateNow.getTime();
|
|
138
|
+
let day = dateNow.getDay();
|
|
139
|
+
if (firstDayOfWeek === 0) {
|
|
140
|
+
const oneDayTime2 = 24 * 60 * 60 * 1e3;
|
|
141
|
+
const SundayTime2 = nowTime - day * oneDayTime2;
|
|
142
|
+
const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
|
|
143
|
+
const sunday2 = this.date2Str(new Date(SundayTime2));
|
|
144
|
+
const saturday = this.date2Str(new Date(SaturdayTime));
|
|
145
|
+
return [sunday2, saturday];
|
|
146
|
+
}
|
|
147
|
+
day = day === 0 ? 7 : day;
|
|
148
|
+
const oneDayTime = 24 * 60 * 60 * 1e3;
|
|
149
|
+
const MondayTime = nowTime - (day - 1) * oneDayTime;
|
|
150
|
+
const SundayTime = nowTime + (7 - day) * oneDayTime;
|
|
151
|
+
const monday = this.date2Str(new Date(MondayTime));
|
|
152
|
+
const sunday = this.date2Str(new Date(SundayTime));
|
|
153
|
+
return [monday, sunday];
|
|
154
|
+
},
|
|
155
|
+
formatResultDate(date) {
|
|
156
|
+
const days = [...date.split("-")];
|
|
157
|
+
days[2] = Utils.getNumTwoBit(Number(days[2]));
|
|
158
|
+
days[3] = `${days[0]}-${days[1]}-${days[2]}`;
|
|
159
|
+
days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
|
|
160
|
+
return days;
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
const getCurrMonthData = (type, year, month) => {
|
|
164
|
+
switch (type) {
|
|
165
|
+
case "prev":
|
|
166
|
+
month === 1 && (year -= 1);
|
|
167
|
+
month = month === 1 ? 12 : --month;
|
|
168
|
+
break;
|
|
169
|
+
case "next":
|
|
170
|
+
month === 12 && (year += 1);
|
|
171
|
+
month = month === 12 ? 1 : ++month;
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
return [
|
|
175
|
+
year,
|
|
176
|
+
Utils.getNumTwoBit(month),
|
|
177
|
+
Utils.getMonthDays(String(year), String(month))
|
|
178
|
+
];
|
|
179
|
+
};
|
|
180
|
+
const getDaysStatus = (type, year, month) => {
|
|
181
|
+
let days = Utils.getMonthDays(`${year}`, `${month}`);
|
|
182
|
+
if (type === "prev" && days >= 7) {
|
|
183
|
+
days -= 7;
|
|
184
|
+
}
|
|
185
|
+
return Array.from(Array(days), (v, k) => {
|
|
186
|
+
return {
|
|
187
|
+
day: k + 1,
|
|
188
|
+
type,
|
|
189
|
+
year,
|
|
190
|
+
month
|
|
191
|
+
};
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
const getPreMonthDates = (type, year, month, firstDayOfWeek) => {
|
|
195
|
+
let preMonth = +month - 1;
|
|
196
|
+
let preYear = year;
|
|
197
|
+
if (preMonth <= 0) {
|
|
198
|
+
preMonth = 12;
|
|
199
|
+
preYear += 1;
|
|
200
|
+
}
|
|
201
|
+
let days = Utils.getMonthPreDay(+year, +month);
|
|
202
|
+
days -= firstDayOfWeek;
|
|
203
|
+
if (type === "prev" && days >= 7) {
|
|
204
|
+
days -= 7;
|
|
205
|
+
}
|
|
206
|
+
const preDates = Utils.getMonthDays(`${preYear}`, `${preMonth}`);
|
|
207
|
+
const months = Array.from(Array(preDates), (v, k) => {
|
|
208
|
+
return {
|
|
209
|
+
day: k + 1,
|
|
210
|
+
type,
|
|
211
|
+
preYear,
|
|
212
|
+
preMonth
|
|
213
|
+
};
|
|
214
|
+
});
|
|
215
|
+
return months.slice(preDates - days);
|
|
216
|
+
};
|
|
217
|
+
export {
|
|
218
|
+
Utils as U,
|
|
219
|
+
getDaysStatus as a,
|
|
220
|
+
getCurrMonthData as b,
|
|
221
|
+
getPreMonthDates as g
|
|
222
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React__default, { useState, useEffect } from "react";
|
|
2
2
|
import { View } from "@tarojs/components";
|
|
3
|
-
import { P as Picker } from "./picker.taro-
|
|
3
|
+
import { P as Picker } from "./picker.taro-4cbe43f7.js";
|
|
4
4
|
import { u as useConfig } from "./configprovider.taro-c5ff4877.js";
|
|
5
5
|
import { u as usePropsValue } from "./use-props-value-7637d900.js";
|
|
6
6
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
@@ -17,7 +17,7 @@ const defaultProps = {
|
|
|
17
17
|
endDate: new Date(currentYear + 10, 11, 31)
|
|
18
18
|
};
|
|
19
19
|
const DatePicker = (props) => {
|
|
20
|
-
const { startDate, endDate, type, showChinese, minuteStep, visible, title, defaultValue, formatter, onClose, onConfirm, filter, onChange, threeDimensional, className, style, ...rest } = {
|
|
20
|
+
const { startDate, endDate, type, showChinese, minuteStep, visible, title, defaultValue, pickerProps = {}, formatter, onClose, onConfirm, filter, onChange, threeDimensional, className, style, ...rest } = {
|
|
21
21
|
...defaultProps,
|
|
22
22
|
...props
|
|
23
23
|
};
|
|
@@ -256,7 +256,7 @@ const DatePicker = (props) => {
|
|
|
256
256
|
setOptions(columns());
|
|
257
257
|
}
|
|
258
258
|
}, [currentDate]);
|
|
259
|
-
return React__default.createElement(View, { className: `nut-datepicker ${className}`, style, catchMove: true, ...rest }, options.length && React__default.createElement(Picker, { title, visible, options, onClose, defaultValue: defaultValueOfPicker, onConfirm: (options2, value) => onConfirm && onConfirm(options2, value), onChange: (options2, value, index) => updateChooseValueCustmer(options2, value, index), threeDimensional }));
|
|
259
|
+
return React__default.createElement(View, { className: `nut-datepicker ${className}`, style, catchMove: true, ...rest }, options.length && React__default.createElement(Picker, { ...pickerProps, title, visible, options, onClose, defaultValue: defaultValueOfPicker, onConfirm: (options2, value) => onConfirm && onConfirm(options2, value), onChange: (options2, value, index) => updateChooseValueCustmer(options2, value, index), threeDimensional }));
|
|
260
260
|
};
|
|
261
261
|
DatePicker.defaultProps = defaultProps;
|
|
262
262
|
DatePicker.displayName = "NutDatePicker";
|
|
@@ -4,7 +4,7 @@ import { CSSTransition } from "react-transition-group";
|
|
|
4
4
|
import { View } from "@tarojs/components";
|
|
5
5
|
import { B as Button } from "./button.taro-25f559e1.js";
|
|
6
6
|
import { u as useConfig } from "./configprovider.taro-c5ff4877.js";
|
|
7
|
-
import { O as Overlay } from "./overlay.taro-
|
|
7
|
+
import { u as useLockScrollTaro, O as Overlay } from "./overlay.taro-ad4b4c8a.js";
|
|
8
8
|
import { u as useParams, a as useCustomEvent, b as useCustomEventsPath, c as customEvents } from "./use-custom-event-bb9c7f2e.js";
|
|
9
9
|
const Content = (props) => {
|
|
10
10
|
const { visible, title, footer, footerDirection, onClick, children } = props;
|
|
@@ -65,6 +65,7 @@ const BaseDialog = (props) => {
|
|
|
65
65
|
setParams({ ...options, visible: false });
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
|
+
const refObject = useLockScrollTaro(!!(visible && lockScroll));
|
|
68
69
|
const renderFooter = () => {
|
|
69
70
|
if (footer === null)
|
|
70
71
|
return "";
|
|
@@ -100,7 +101,7 @@ const BaseDialog = (props) => {
|
|
|
100
101
|
};
|
|
101
102
|
return React__default.createElement(
|
|
102
103
|
View,
|
|
103
|
-
{ style: { display: visible ? "block" : "none" }, catchMove: lockScroll },
|
|
104
|
+
{ style: { display: visible ? "block" : "none" }, ref: refObject, catchMove: lockScroll },
|
|
104
105
|
React__default.createElement(
|
|
105
106
|
React__default.Fragment,
|
|
106
107
|
null,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React__default from "react";
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import { Left } from "@nutui/icons-react-taro";
|
|
4
|
-
import { O as Overlay } from "./overlay.taro-
|
|
4
|
+
import { O as Overlay } from "./overlay.taro-ad4b4c8a.js";
|
|
5
5
|
import { u as useConfig } from "./configprovider.taro-c5ff4877.js";
|
|
6
6
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
7
7
|
const defaultProps = {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const canUseDom = !!(typeof window !== "undefined" && typeof document !== "undefined" && window.document && window.document.createElement);
|
|
2
|
+
const defaultRoot = canUseDom ? window : void 0;
|
|
3
|
+
const overflowStylePatterns = ["scroll", "auto", "overlay"];
|
|
4
|
+
function isElement(node) {
|
|
5
|
+
const ELEMENT_NODE_TYPE = 1;
|
|
6
|
+
return node.nodeType === ELEMENT_NODE_TYPE;
|
|
7
|
+
}
|
|
8
|
+
function getScrollParent(el, root = defaultRoot) {
|
|
9
|
+
let node = el;
|
|
10
|
+
while (node && node !== root && isElement(node)) {
|
|
11
|
+
if (node === document.body) {
|
|
12
|
+
return root;
|
|
13
|
+
}
|
|
14
|
+
const { overflowY } = window.getComputedStyle(node);
|
|
15
|
+
if (overflowStylePatterns.includes(overflowY) && node.scrollHeight > node.clientHeight) {
|
|
16
|
+
return node;
|
|
17
|
+
}
|
|
18
|
+
node = node.parentNode;
|
|
19
|
+
}
|
|
20
|
+
return root;
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
canUseDom as c,
|
|
24
|
+
getScrollParent as g
|
|
25
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React__default, { useRef, useState, useEffect } from "react";
|
|
2
2
|
import Taro from "@tarojs/taro";
|
|
3
3
|
import { Video } from "@tarojs/components";
|
|
4
|
-
import { P as Popup } from "./popup.taro-
|
|
4
|
+
import { P as Popup } from "./popup.taro-6f68b86f.js";
|
|
5
5
|
import { I as Image } from "./image.taro-c2441b71.js";
|
|
6
6
|
import InnerSwiper from "./Swiper.js";
|
|
7
7
|
import { S as SwiperItem } from "./swiperitem.taro-da39a67b.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React__default, { useRef, useState, useEffect } from "react";
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import { ArrowUp2, ArrowDown2 } from "@nutui/icons-react-taro";
|
|
4
|
-
import { M as MenuItem } from "./menuitem.taro-
|
|
4
|
+
import { M as MenuItem } from "./menuitem.taro-0045e4a8.js";
|
|
5
5
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
6
6
|
const defaultProps = {
|
|
7
7
|
...ComponentDefaults,
|
|
@@ -4,7 +4,7 @@ import { getSystemInfoSync, usePageScroll } from "@tarojs/taro";
|
|
|
4
4
|
import { View } from "@tarojs/components";
|
|
5
5
|
import { CSSTransition } from "react-transition-group";
|
|
6
6
|
import { Check } from "@nutui/icons-react-taro";
|
|
7
|
-
import { O as Overlay } from "./overlay.taro-
|
|
7
|
+
import { O as Overlay } from "./overlay.taro-ad4b4c8a.js";
|
|
8
8
|
import { g as getRectByTaro } from "./get-rect-by-taro-fe02fe2b.js";
|
|
9
9
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
10
10
|
import { u as usePropsValue } from "./use-props-value-7637d900.js";
|
|
@@ -79,9 +79,7 @@ const NoticeBar = (props) => {
|
|
|
79
79
|
scrollList.current = [].concat(childs);
|
|
80
80
|
} else {
|
|
81
81
|
scrollList.current = [].concat(list);
|
|
82
|
-
|
|
83
|
-
startRollEasy();
|
|
84
|
-
}, Number(duration));
|
|
82
|
+
startRollEasy();
|
|
85
83
|
}
|
|
86
84
|
} else {
|
|
87
85
|
initScrollWrap();
|
|
@@ -210,11 +208,9 @@ const NoticeBar = (props) => {
|
|
|
210
208
|
}, [ready]);
|
|
211
209
|
useEffect(() => {
|
|
212
210
|
if (isVertical && children) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
autoplay();
|
|
217
|
-
}, 300);
|
|
211
|
+
init();
|
|
212
|
+
stopAutoPlay();
|
|
213
|
+
autoplay();
|
|
218
214
|
}
|
|
219
215
|
}, [children, container == null ? void 0 : container.current]);
|
|
220
216
|
const stopAutoPlay = () => {
|
|
@@ -264,6 +260,9 @@ const NoticeBar = (props) => {
|
|
|
264
260
|
};
|
|
265
261
|
const getStyle = (moveOffset = offset) => {
|
|
266
262
|
const target = innerRef.current;
|
|
263
|
+
if (!target) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
267
266
|
let _offset = 0;
|
|
268
267
|
const val = ((rect == null ? void 0 : rect.height) || 0) - height;
|
|
269
268
|
_offset = moveOffset + Number(active === childCount - 1 && val / 2);
|
|
@@ -2,7 +2,7 @@ import React__default, { useMemo, useState } from "react";
|
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import { RectDown } from "@nutui/icons-react-taro";
|
|
4
4
|
import { View } from "@tarojs/components";
|
|
5
|
-
import { P as Popup } from "./popup.taro-
|
|
5
|
+
import { P as Popup } from "./popup.taro-6f68b86f.js";
|
|
6
6
|
import { u as useConfig } from "./configprovider.taro-c5ff4877.js";
|
|
7
7
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
8
8
|
const defaultProps = {
|