@nutui/nutui-react-taro 2.0.0-beta.1 → 2.0.0-beta.2

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.
Files changed (114) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/esm/ActionSheet.js +2 -2
  3. package/dist/esm/Address.js +3 -3
  4. package/dist/esm/Calendar/style/style.css +1 -1
  5. package/dist/esm/Calendar.js +3 -3
  6. package/dist/esm/CalendarItem.js +2 -1
  7. package/dist/esm/Cascader.js +2 -2
  8. package/dist/esm/DatePicker.js +3 -3
  9. package/dist/esm/Dialog/style/style.css +1 -1
  10. package/dist/esm/Elevator.js +1 -1
  11. package/dist/esm/ImagePreview.js +2 -2
  12. package/dist/esm/NavBar.js +1 -1
  13. package/dist/esm/NoticeBar.js +1 -1
  14. package/dist/esm/NumberKeyboard.js +2 -2
  15. package/dist/esm/Picker.js +2 -2
  16. package/dist/esm/Popover.js +3 -3
  17. package/dist/esm/Popup.js +1 -1
  18. package/dist/esm/SearchBar.js +1 -1
  19. package/dist/esm/ShortPassword.js +2 -2
  20. package/dist/esm/SideNavBar.js +2 -2
  21. package/dist/esm/TimeSelect.js +2 -2
  22. package/dist/esm/TrendArrow.js +1 -1
  23. package/dist/esm/Uploader.js +1 -1
  24. package/dist/esm/VirtualList.js +1 -1
  25. package/dist/esm/{actionsheet.taro-06df0e47.js → actionsheet.taro-0fecc929.js} +3 -3
  26. package/dist/esm/{address.taro-09392335.js → address.taro-d4299225.js} +2 -2
  27. package/dist/esm/{calendar.taro-63544d95.js → calendar.taro-8bb4cb34.js} +8 -7
  28. package/dist/esm/{calendaritem.taro-c222ea25.js → calendaritem.taro-0262d6ab.js} +381 -281
  29. package/dist/esm/{cascader.taro-b5c1f5c6.js → cascader.taro-e929f24d.js} +3 -3
  30. package/dist/esm/{datepicker.taro-d04fc491.js → datepicker.taro-604222f0.js} +1 -1
  31. package/dist/esm/{elevator.taro-df8fde9d.js → elevator.taro-459f7322.js} +3 -3
  32. package/dist/esm/{imagepreview.taro-9e0c5171.js → imagepreview.taro-fad0448a.js} +1 -1
  33. package/dist/esm/{navbar.taro-5e1a0835.js → navbar.taro-f2d4215d.js} +2 -2
  34. package/dist/esm/{noticebar.taro-dc895cc5.js → noticebar.taro-2720ca1e.js} +2 -2
  35. package/dist/esm/{numberkeyboard.taro-f245cb85.js → numberkeyboard.taro-04a2f2c8.js} +2 -2
  36. package/dist/esm/nutui-react.es.js +27 -27
  37. package/dist/esm/{picker.taro-69fb40fe.js → picker.taro-86564e14.js} +1 -2
  38. package/dist/esm/{popover.taro-ae72d2de.js → popover.taro-cec3a7a0.js} +6 -6
  39. package/dist/esm/{popup.taro-23f882b0.js → popup.taro-1cd1f9d2.js} +5 -5
  40. package/dist/esm/{searchbar.taro-450d361d.js → searchbar.taro-842e985f.js} +2 -2
  41. package/dist/esm/{shortpassword.taro-ac22a29e.js → shortpassword.taro-b1b6c076.js} +3 -3
  42. package/dist/esm/{sidenavbar.taro-7bf8d265.js → sidenavbar.taro-61eaa60b.js} +1 -1
  43. package/dist/esm/{timeselect.taro-df7477a3.js → timeselect.taro-45ab9d52.js} +1 -1
  44. package/dist/esm/{trendarrow.taro-253025d2.js → trendarrow.taro-fa177b5c.js} +10 -10
  45. package/dist/esm/types/src/packages/calendar/calendar.d.ts +4 -6
  46. package/dist/esm/types/src/packages/calendar/calendar.taro.d.ts +4 -6
  47. package/dist/esm/types/src/packages/calendar/type.d.ts +13 -0
  48. package/dist/esm/types/src/packages/calendar/utils.d.ts +8 -0
  49. package/dist/esm/types/src/packages/calendaritem/calendaritem.d.ts +25 -27
  50. package/dist/esm/types/src/packages/calendaritem/calendaritem.taro.d.ts +26 -28
  51. package/dist/esm/types/src/packages/configprovider/types.d.ts +1 -1
  52. package/dist/esm/types/src/packages/elevator/elevator.d.ts +2 -2
  53. package/dist/esm/types/src/packages/elevator/elevator.taro.d.ts +2 -2
  54. package/dist/esm/types/src/packages/navbar/demo.d.ts +1 -0
  55. package/dist/esm/types/src/packages/navbar/demo.taro.d.ts +1 -0
  56. package/dist/esm/types/src/packages/navbar/navbar.d.ts +1 -1
  57. package/dist/esm/types/src/packages/navbar/navbar.taro.d.ts +1 -1
  58. package/dist/esm/types/src/packages/noticebar/noticebar.d.ts +1 -1
  59. package/dist/esm/types/src/packages/noticebar/noticebar.taro.d.ts +1 -1
  60. package/dist/esm/types/src/packages/nutui.react.build.d.ts +3 -3
  61. package/dist/esm/types/src/packages/nutui.react.d.ts +5 -5
  62. package/dist/esm/types/src/packages/nutui.react.scss.d.ts +2 -2
  63. package/dist/esm/types/src/packages/nutui.react.taro.d.ts +5 -5
  64. package/dist/esm/types/src/packages/nutui.react.taro.scss.d.ts +2 -2
  65. package/dist/esm/types/src/packages/nutui.taro.react.build.d.ts +3 -3
  66. package/dist/esm/types/src/packages/popover/popover.d.ts +2 -2
  67. package/dist/esm/types/src/packages/popover/popover.taro.d.ts +2 -2
  68. package/dist/esm/types/src/packages/popup/popup.d.ts +2 -2
  69. package/dist/esm/types/src/packages/popup/popup.taro.d.ts +2 -2
  70. package/dist/esm/types/src/packages/searchbar/searchbar.d.ts +1 -1
  71. package/dist/esm/types/src/packages/searchbar/searchbar.taro.d.ts +1 -1
  72. package/dist/esm/types/src/packages/trendarrow/trendarrow.d.ts +3 -3
  73. package/dist/esm/types/src/packages/trendarrow/trendarrow.taro.d.ts +3 -3
  74. package/dist/esm/types/src/packages/uploader/uploader.d.ts +1 -1
  75. package/dist/esm/types/src/packages/uploader/uploader.taro.d.ts +1 -1
  76. package/dist/esm/types/src/packages/virtuallist/virtuallist.d.ts +2 -2
  77. package/dist/esm/types/src/packages/virtuallist/virtuallist.taro.d.ts +2 -2
  78. package/dist/esm/types/src/utils/date.d.ts +19 -3
  79. package/dist/esm/{uploader.taro-ea2c7ab9.js → uploader.taro-d9add90e.js} +4 -4
  80. package/dist/esm/{virtuallist.taro-97d3403a.js → virtuallist.taro-1de01855.js} +3 -4
  81. package/dist/locales/base.js +1 -1
  82. package/dist/locales/en-US.js +1 -1
  83. package/dist/locales/id-ID.js +1 -1
  84. package/dist/locales/tr-TR.js +1 -1
  85. package/dist/locales/zh-CN.js +1 -1
  86. package/dist/locales/zh-TW.js +1 -1
  87. package/dist/locales/zh-UG.js +1 -1
  88. package/dist/nutui.react.es.js +767 -677
  89. package/dist/nutui.react.umd.js +767 -677
  90. package/dist/packages/calendar/calendar.scss +4 -0
  91. package/dist/packages/dialog/dialog.scss +1 -1
  92. package/dist/style.css +1 -1
  93. package/dist/style.mjs +1 -1
  94. package/dist/styles/themes/default.scss +2 -2
  95. package/dist/styles/variables-jmapp.scss +2 -2
  96. package/dist/styles/variables.scss +2 -2
  97. package/dist/types/index.d.ts +3 -3
  98. package/dist/types/packages/calendar/calendar.taro.d.ts +8 -6
  99. package/dist/types/packages/calendar/type.d.ts +13 -0
  100. package/dist/types/packages/calendar/utils.d.ts +8 -0
  101. package/dist/types/packages/calendaritem/calendaritem.taro.d.ts +26 -28
  102. package/dist/types/packages/configprovider/types.d.ts +1 -1
  103. package/dist/types/packages/elevator/elevator.taro.d.ts +2 -2
  104. package/dist/types/packages/navbar/navbar.taro.d.ts +1 -1
  105. package/dist/types/packages/noticebar/noticebar.taro.d.ts +1 -1
  106. package/dist/types/packages/popover/popover.taro.d.ts +2 -2
  107. package/dist/types/packages/popup/popup.d.ts +2 -2
  108. package/dist/types/packages/popup/popup.taro.d.ts +2 -2
  109. package/dist/types/packages/searchbar/searchbar.taro.d.ts +1 -1
  110. package/dist/types/packages/trendarrow/trendarrow.taro.d.ts +3 -3
  111. package/dist/types/packages/uploader/uploader.taro.d.ts +1 -1
  112. package/dist/types/packages/virtuallist/virtuallist.taro.d.ts +2 -2
  113. package/dist/types/utils/date.d.ts +19 -3
  114. package/package.json +1 -1
@@ -1,7 +1,8 @@
1
1
  import React, { useState, useRef, useEffect } from "react";
2
2
  import classNames from "classnames";
3
3
  import { ScrollView } from "@tarojs/components";
4
- import { nextTick } from "@tarojs/taro";
4
+ import Taro, { nextTick } from "@tarojs/taro";
5
+ import { C as ComponentDefaults } from "./typings-11d83a22.js";
5
6
  import { u as useConfig } from "./configprovider.taro-a7f3bcfd.js";
6
7
  import { u as usePropsValue } from "./use-props-value-7ac1b1b5.js";
7
8
  const Utils = {
@@ -31,7 +32,7 @@ const Utils = {
31
32
  return dayNames[index];
32
33
  },
33
34
  /**
34
- * 返回星期数
35
+ * 返回上一个月在当前面板中的天数
35
36
  * @return {Number}
36
37
  */
37
38
  getMonthPreDay(year, month) {
@@ -120,7 +121,105 @@ const Utils = {
120
121
  return true;
121
122
  }
122
123
  return false;
124
+ },
125
+ getMonthWeek(year, month, date, firstDayOfWeek = 0) {
126
+ const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date));
127
+ let w = dateNow.getDay();
128
+ const d = dateNow.getDate();
129
+ let remainder = 6 - w;
130
+ if (firstDayOfWeek !== 0) {
131
+ w = w === 0 ? 7 : w;
132
+ remainder = 7 - w;
133
+ }
134
+ return Math.ceil((d + remainder) / 7);
135
+ },
136
+ getYearWeek(year, month, date, firstDayOfWeek = 0) {
137
+ const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date));
138
+ const dateFirst = new Date(Number(year), 0, 1);
139
+ const dataNumber = Math.round((dateNow.valueOf() - dateFirst.valueOf()) / 864e5);
140
+ return Math.ceil((dataNumber + (dateFirst.getDay() + 1 - 1)) / 7);
141
+ },
142
+ getWeekDate(year, month, date, firstDayOfWeek = 0) {
143
+ const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date));
144
+ const nowTime = dateNow.getTime();
145
+ let day = dateNow.getDay();
146
+ if (firstDayOfWeek === 0) {
147
+ const oneDayTime2 = 24 * 60 * 60 * 1e3;
148
+ const SundayTime2 = nowTime - day * oneDayTime2;
149
+ const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
150
+ const sunday2 = this.date2Str(new Date(SundayTime2));
151
+ const saturday = this.date2Str(new Date(SaturdayTime));
152
+ return [sunday2, saturday];
153
+ }
154
+ day = day === 0 ? 7 : day;
155
+ const oneDayTime = 24 * 60 * 60 * 1e3;
156
+ const MondayTime = nowTime - (day - 1) * oneDayTime;
157
+ const SundayTime = nowTime + (7 - day) * oneDayTime;
158
+ const monday = this.date2Str(new Date(MondayTime));
159
+ const sunday = this.date2Str(new Date(SundayTime));
160
+ return [monday, sunday];
161
+ },
162
+ formatResultDate(date) {
163
+ const days = [...date.split("-")];
164
+ days[2] = Utils.getNumTwoBit(Number(days[2]));
165
+ days[3] = `${days[0]}-${days[1]}-${days[2]}`;
166
+ days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
167
+ return days;
168
+ }
169
+ };
170
+ const getCurrMonthData = (type, year, month) => {
171
+ switch (type) {
172
+ case "prev":
173
+ month === 1 && (year -= 1);
174
+ month = month === 1 ? 12 : --month;
175
+ break;
176
+ case "next":
177
+ month === 12 && (year += 1);
178
+ month = month === 12 ? 1 : ++month;
179
+ break;
180
+ }
181
+ return [
182
+ year,
183
+ Utils.getNumTwoBit(month),
184
+ Utils.getMonthDays(String(year), String(month))
185
+ ];
186
+ };
187
+ const getDaysStatus = (type, year, month) => {
188
+ let days = Utils.getMonthDays(`${year}`, `${month}`);
189
+ if (type === "prev" && days >= 7) {
190
+ days -= 7;
191
+ }
192
+ return Array.from(Array(days), (v, k) => {
193
+ return {
194
+ day: k + 1,
195
+ type,
196
+ year,
197
+ month
198
+ };
199
+ });
200
+ };
201
+ const getPreMonthDates = (type, year, month, firstDayOfWeek) => {
202
+ let preMonth = +month - 1;
203
+ let preYear = year;
204
+ if (preMonth <= 0) {
205
+ preMonth = 12;
206
+ preYear += 1;
123
207
  }
208
+ let days = Utils.getMonthPreDay(+year, +month);
209
+ days -= firstDayOfWeek;
210
+ if (type === "prev" && days >= 7) {
211
+ days -= 7;
212
+ }
213
+ const preDates = Utils.getMonthDays(`${preYear}`, `${preMonth}`);
214
+ const months = Array.from(Array(preDates), (v, k) => {
215
+ return {
216
+ day: k + 1,
217
+ type,
218
+ preYear,
219
+ preMonth
220
+ };
221
+ });
222
+ return months.slice(preDates - days);
124
223
  };
125
224
  const _window = window;
126
225
  function requestAniFrame() {
@@ -134,7 +233,36 @@ function requestAniFrame() {
134
233
  };
135
234
  }
136
235
  const requestAniFrame$1 = requestAniFrame();
236
+ const splitDate = (date) => {
237
+ const split = date.indexOf("-") !== -1 ? "-" : "/";
238
+ return date.split(split);
239
+ };
240
+ const isMultiple = (day, days) => {
241
+ if (days.length > 0) {
242
+ return days.some((item) => {
243
+ return Utils.isEqual(item, day);
244
+ });
245
+ }
246
+ return false;
247
+ };
248
+ const isCurrDay = (month, day) => {
249
+ const date = `${month.curData[0]}/${month.curData[1]}/${day}`;
250
+ return Utils.isEqual(date, Utils.date2Str(/* @__PURE__ */ new Date(), "/"));
251
+ };
252
+ const getCurrDate = (day, month) => {
253
+ return `${month.curData[0]}/${month.curData[1]}/${Utils.getNumTwoBit(+day.day)}`;
254
+ };
255
+ const isStart = (day, days) => {
256
+ return Utils.isEqual(days[0], day);
257
+ };
258
+ const isEnd = (day, days) => {
259
+ return Utils.isEqual(days[1], day);
260
+ };
261
+ const isStartAndEnd = (days) => {
262
+ return days.length >= 2 && Utils.isEqual(days[0], days[1]);
263
+ };
137
264
  const defaultProps = {
265
+ ...ComponentDefaults,
138
266
  type: "single",
139
267
  autoBackfill: false,
140
268
  popup: true,
@@ -148,6 +276,7 @@ const defaultProps = {
148
276
  showTitle: true,
149
277
  showSubTitle: true,
150
278
  scrollAnimation: true,
279
+ firstDayOfWeek: 0,
151
280
  renderHeaderButtons: void 0,
152
281
  renderDay: void 0,
153
282
  renderDayTop: void 0,
@@ -156,15 +285,19 @@ const defaultProps = {
156
285
  },
157
286
  onUpdate: () => {
158
287
  },
159
- onClickDay: (data) => {
288
+ onDayClick: (data) => {
160
289
  },
161
290
  onPageChange: (data) => {
162
291
  }
163
292
  };
164
293
  const CalendarItem = React.forwardRef((props, ref) => {
165
294
  const { locale } = useConfig();
166
- const { type, autoBackfill, popup, title, defaultValue, showToday, startText, endText, confirmText, showTitle, showSubTitle, scrollAnimation, renderHeaderButtons, renderDay, renderDayTop, renderDayBottom, onConfirm, onUpdate, onClickDay, onPageChange } = { ...defaultProps, ...props };
167
- const weeks = locale.calendaritem.weekdays;
295
+ const { popup, type, autoBackfill, title, defaultValue, startDate, endDate, showToday, startText, endText, confirmText, showTitle, showSubTitle, scrollAnimation, firstDayOfWeek, renderHeaderButtons, renderDay, renderDayTop, renderDayBottom, onConfirm, onUpdate, onDayClick, onPageChange } = { ...defaultProps, ...props };
296
+ const weekdays = locale.calendaritem.weekdays;
297
+ const weeks = [
298
+ ...weekdays.slice(firstDayOfWeek, 7),
299
+ ...weekdays.slice(0, firstDayOfWeek)
300
+ ];
168
301
  const monthTitle = locale.calendaritem.monthTitle;
169
302
  const [yearMonthTitle, setYearMonthTitle] = useState("");
170
303
  const [monthsData, setMonthsData] = useState([]);
@@ -173,12 +306,8 @@ const CalendarItem = React.forwardRef((props, ref) => {
173
306
  const [monthDefaultRange, setMonthDefaultRange] = useState([]);
174
307
  const [scrollTop, setScrollTop] = useState(0);
175
308
  const [scrollWithAnimation, setScrollWithAnimation] = useState(false);
176
- const propStartDate = props.startDate || Utils.getDay(0);
177
- const propEndDate = props.endDate || Utils.getDay(365);
178
- const splitDate = (date) => {
179
- const split = date.indexOf("-") !== -1 ? "-" : "/";
180
- return date.split(split);
181
- };
309
+ const propStartDate = startDate || Utils.getDay(0);
310
+ const propEndDate = endDate || Utils.getDay(365);
182
311
  const startDates = splitDate(propStartDate);
183
312
  const endDates = splitDate(propEndDate);
184
313
  const [state] = useState({
@@ -205,146 +334,40 @@ const CalendarItem = React.forwardRef((props, ref) => {
205
334
  let viewHeight = 0;
206
335
  const classPrefix = "nut-calendar";
207
336
  const dayPrefix = "nut-calendar-day";
208
- const classes = classNames({
209
- [`${classPrefix}-title`]: !popup,
210
- [`${classPrefix}-nofooter`]: !!autoBackfill
211
- }, classPrefix);
212
- const headerClasses = classNames({
213
- [`${classPrefix}-header`]: true,
214
- [`${classPrefix}-header-title`]: !popup
215
- });
216
- const isMultiple = (d) => {
217
- if (currentDate.length > 0) {
218
- return currentDate.some((item) => {
219
- return Utils.isEqual(item, d);
220
- });
221
- }
222
- return false;
223
- };
224
- const getCurrDate = (day, month) => {
225
- return `${month.curData[0]}/${month.curData[1]}/${Utils.getNumTwoBit(+day.day)}`;
226
- };
227
- const getClasses = (day, month) => {
228
- const dateStr = getCurrDate(day, month);
229
- if (day.type === "active") {
230
- if (propStartDate && Utils.compareDate(dateStr, propStartDate) || propEndDate && Utils.compareDate(propEndDate, dateStr)) {
231
- return `${dayPrefix}-disabled`;
232
- }
233
- if (type === "range") {
234
- if (isStart(dateStr) || isEnd(dateStr)) {
235
- return `${dayPrefix}-active ${isStart(dateStr) ? "active-start" : ""} ${isEnd(dateStr) ? "active-end" : ""}`;
236
- }
237
- if (Array.isArray(currentDate) && Object.values(currentDate).length === 2 && Utils.compareDate(currentDate[0], dateStr) && Utils.compareDate(dateStr, currentDate[1])) {
238
- return `${dayPrefix}-choose`;
239
- }
240
- return null;
241
- }
242
- if (type === "multiple" && isMultiple(dateStr) || !Array.isArray(currentDate) && Utils.isEqual(currentDate, dateStr)) {
243
- return `${dayPrefix}-active`;
337
+ const getMonthData = (curData, monthNum, type2) => {
338
+ let i = 0;
339
+ let date = curData;
340
+ const monthData = monthsData;
341
+ do {
342
+ const y = parseInt(date[0], 10);
343
+ const m = parseInt(date[1], 10);
344
+ const days = [
345
+ ...getPreMonthDates("prev", y, m, firstDayOfWeek),
346
+ ...getDaysStatus("active", y, m)
347
+ ];
348
+ const cssHeight = 39 + (days.length > 35 ? 384 : 320);
349
+ let scrollTop2 = 0;
350
+ if (monthData.length > 0) {
351
+ const monthEle = monthData[monthData.length - 1];
352
+ scrollTop2 = monthEle.scrollTop + monthEle.cssHeight;
244
353
  }
245
- return null;
246
- }
247
- return `${dayPrefix}-disabled`;
248
- };
249
- const isCurrDay = (month, day) => {
250
- const date = `${month.curData[0]}/${month.curData[1]}/${day}`;
251
- return Utils.isEqual(date, Utils.date2Str(/* @__PURE__ */ new Date(), "/"));
252
- };
253
- const isStart = (d) => {
254
- return Utils.isEqual(currentDate[0], d);
255
- };
256
- const isEnd = (d) => {
257
- return Utils.isEqual(currentDate[1], d);
258
- };
259
- const isStartTip = (day, month) => {
260
- return type === "range" && day.type === "active" && isStart(getCurrDate(day, month));
261
- };
262
- const isEndTip = (day, month) => {
263
- return currentDate.length >= 2 && type === "range" && day.type === "active" && isEnd(getCurrDate(day, month));
264
- };
265
- const isStartAndEnd = () => {
266
- return currentDate.length >= 2 && Utils.isEqual(currentDate[0], currentDate[1]);
267
- };
268
- const getCurrMonthData = (type2) => {
269
- const monthData = type2 === "prev" ? monthsData[0] : monthsData[monthsData.length - 1];
270
- let year = parseInt(monthData.curData[0]);
271
- let month = parseInt(monthData.curData[1].toString().replace(/^0/, ""));
272
- switch (type2) {
273
- case "prev":
274
- month === 1 && (year -= 1);
275
- month = month === 1 ? 12 : --month;
276
- break;
277
- case "next":
278
- month === 12 && (year += 1);
279
- month = month === 12 ? 1 : ++month;
280
- break;
281
- }
282
- return [
283
- year,
284
- Utils.getNumTwoBit(month),
285
- Utils.getMonthDays(String(year), String(month))
286
- ];
287
- };
288
- const getDaysStatus = (days, type2, year, month) => {
289
- if (type2 === "prev" && days >= 7) {
290
- days -= 7;
291
- }
292
- return Array.from(Array(days), (v, k) => {
293
- return {
294
- day: k + 1,
295
- type: type2,
296
- year,
297
- month
354
+ const monthInfo = {
355
+ curData: date,
356
+ title: monthTitle(y, m),
357
+ monthData: days,
358
+ cssHeight,
359
+ scrollTop: scrollTop2
298
360
  };
299
- });
300
- };
301
- const getPreDaysStatus = (days, type2, year, month, preCurrMonthDays) => {
302
- if (type2 === "prev" && days >= 7) {
303
- days -= 7;
304
- }
305
- const months = Array.from(Array(preCurrMonthDays), (v, k) => {
306
- return {
307
- day: k + 1,
308
- type: type2,
309
- year,
310
- month
311
- };
312
- });
313
- return months.slice(preCurrMonthDays - days);
314
- };
315
- const getMonthData = (curData, type2) => {
316
- let preMonth = +curData[1] - 1;
317
- let preYear = curData[0];
318
- if (preMonth <= 0) {
319
- preMonth = 12;
320
- preYear += 1;
321
- }
322
- const preMonthDays = Utils.getMonthPreDay(+curData[0], +curData[1]);
323
- const currMonthDays = Utils.getMonthDays(curData[0], curData[1]);
324
- const preCurrMonthDays = Utils.getMonthDays(`${preYear}`, `${preMonth}`);
325
- const monthInfo = {
326
- curData,
327
- title: monthTitle(curData[0], curData[1]),
328
- monthData: [
329
- ...getPreDaysStatus(preMonthDays, "prev", `${preMonth}`, preYear, preCurrMonthDays),
330
- ...getDaysStatus(currMonthDays, "active", curData[0], curData[1])
331
- ]
332
- };
333
- monthInfo.cssHeight = 39 + (monthInfo.monthData.length > 35 ? 384 : 320);
334
- let scrollTop2 = 0;
335
- if (monthsData.length > 0) {
336
- const monthEle = monthsData[monthsData.length - 1];
337
- scrollTop2 = monthEle.scrollTop + monthEle.cssHeight;
338
- }
339
- monthInfo.scrollTop = scrollTop2;
340
- if (type2 === "next") {
341
- if (!endDates || !Utils.compareDate(`${endDates[0]}/${endDates[1]}/${Utils.getMonthDays(endDates[0], endDates[1])}`, `${curData[0]}/${curData[1]}/${curData[2]}`)) {
342
- monthsData.push(monthInfo);
361
+ if (type2 === "next") {
362
+ if (!endDates || !Utils.compareDate(`${endDates[0]}/${endDates[1]}/${Utils.getMonthDays(endDates[0], endDates[1])}`, `${curData[0]}/${curData[1]}/${curData[2]}`)) {
363
+ monthData.push(monthInfo);
364
+ }
365
+ } else if (!startDates || !Utils.compareDate(`${curData[0]}/${curData[1]}/${curData[2]}`, `${startDates[0]}/${startDates[1]}/01`)) {
366
+ monthData.unshift(monthInfo);
343
367
  }
344
- } else if (!startDates || !Utils.compareDate(`${curData[0]}/${curData[1]}/${curData[2]}`, `${startDates[0]}/${startDates[1]}/01`)) {
345
- monthsData.unshift(monthInfo);
346
- }
347
- setMonthsData(monthsData);
368
+ date = getCurrMonthData("next", y, m);
369
+ } while (i++ < monthNum);
370
+ setMonthsData(monthData);
348
371
  };
349
372
  const setReachedYearMonthInfo = (current) => {
350
373
  const currentMonthsData = monthsData[current];
@@ -376,48 +399,11 @@ const CalendarItem = React.forwardRef((props, ref) => {
376
399
  setTranslateY(monthsData[start].scrollTop);
377
400
  setReachedYearMonthInfo(current);
378
401
  };
379
- const monthsViewScroll = (e) => {
380
- if (monthsData.length <= 1) {
381
- return;
382
- }
383
- const scrollTop2 = e.target.scrollTop;
384
- let current = Math.floor(scrollTop2 / avgHeight);
385
- const nextTop = monthsData[current + 1].scrollTop;
386
- const nextHeight = monthsData[current + 1].cssHeight;
387
- if (current === 0) {
388
- if (scrollTop2 >= nextTop) {
389
- current += 1;
390
- }
391
- } else if (current > 0 && current < monthsNum - 1) {
392
- if (scrollTop2 >= nextTop) {
393
- current += 1;
394
- }
395
- if (scrollTop2 < monthsData[current].scrollTop) {
396
- current -= 1;
397
- }
398
- } else {
399
- const viewPosition = Math.round(scrollTop2 + viewHeight);
400
- if (current + 1 <= monthsNum && viewPosition >= nextTop + nextHeight) {
401
- current += 1;
402
- }
403
- if (current >= 1 && scrollTop2 < monthsData[current - 1].scrollTop) {
404
- current -= 1;
405
- }
406
- }
407
- setDefaultRange(monthsNum, current);
408
- };
409
402
  const getMonthNum = () => {
410
- const startDate = {
411
- year: Number(startDates[0]),
412
- month: Number(startDates[1])
413
- };
414
- const endDate = {
415
- year: Number(endDates[0]),
416
- month: Number(endDates[1])
417
- };
418
- let monthNum = endDate.month - startDate.month;
419
- if (endDate.year - startDate.year > 0) {
420
- monthNum += 12 * (endDate.year - startDate.year);
403
+ let monthNum = Number(endDates[1]) - Number(startDates[1]);
404
+ const yearNum = Number(endDates[0]) - Number(startDates[0]);
405
+ if (yearNum > 0) {
406
+ monthNum += 12 * yearNum;
421
407
  }
422
408
  if (monthNum <= 0) {
423
409
  monthNum = 1;
@@ -425,27 +411,7 @@ const CalendarItem = React.forwardRef((props, ref) => {
425
411
  setMonthsNum(monthNum);
426
412
  return monthNum;
427
413
  };
428
- const getMonthsData = (monthNum) => {
429
- getMonthData(startDates, "next");
430
- let i = 1;
431
- do {
432
- getMonthData(getCurrMonthData("next"), "next");
433
- } while (i++ < monthNum);
434
- };
435
- const requestAniFrameFunc = (current, monthNum) => {
436
- const lastItem = monthsData[monthsData.length - 1];
437
- const containerHeight = lastItem.cssHeight + lastItem.scrollTop;
438
- requestAniFrame$1(() => {
439
- if (monthsRef && monthsPanel && viewAreaRef) {
440
- viewHeight = monthsRef.current.clientHeight;
441
- monthsPanel.current.style.height = `${containerHeight}px`;
442
- setScrollTop(monthsData[current].scrollTop);
443
- nextTick(() => setScrollWithAnimation(true));
444
- }
445
- });
446
- setAvgHeight(Math.floor(containerHeight / (monthNum + 1)));
447
- };
448
- const renderCurrentDate = () => {
414
+ const setDefaultDate = () => {
449
415
  let defaultData = [];
450
416
  if (type === "range" && Array.isArray(currentDate)) {
451
417
  if (currentDate.length > 0) {
@@ -460,7 +426,7 @@ const CalendarItem = React.forwardRef((props, ref) => {
460
426
  ...splitDate(currentDate[1])
461
427
  ];
462
428
  }
463
- } else if (props.type === "multiple" && Array.isArray(currentDate)) {
429
+ } else if (type === "multiple" && Array.isArray(currentDate)) {
464
430
  if (currentDate.length > 0) {
465
431
  const defaultArr = [];
466
432
  const obj = {};
@@ -475,6 +441,22 @@ const CalendarItem = React.forwardRef((props, ref) => {
475
441
  currentDate.splice(0) && currentDate.push(...defaultArr);
476
442
  defaultData = [...splitDate(defaultArr[0])];
477
443
  }
444
+ } else if (type === "week" && Array.isArray(currentDate)) {
445
+ if (currentDate.length > 0) {
446
+ const [y, m, d] = splitDate(currentDate[0]);
447
+ const weekArr = Utils.getWeekDate(y, m, d, firstDayOfWeek);
448
+ currentDate.splice(0) && currentDate.push(...weekArr);
449
+ if (propStartDate && Utils.compareDate(currentDate[0], propStartDate)) {
450
+ currentDate.splice(0, 1, propStartDate);
451
+ }
452
+ if (propEndDate && Utils.compareDate(propEndDate, currentDate[1])) {
453
+ currentDate.splice(1, 1, propEndDate);
454
+ }
455
+ defaultData = [
456
+ ...splitDate(currentDate[0]),
457
+ ...splitDate(currentDate[1])
458
+ ];
459
+ }
478
460
  } else if (currentDate) {
479
461
  if (currentDate.length > 0) {
480
462
  if (propStartDate && Utils.compareDate(currentDate, propStartDate)) {
@@ -488,6 +470,9 @@ const CalendarItem = React.forwardRef((props, ref) => {
488
470
  defaultData = [];
489
471
  }
490
472
  }
473
+ return defaultData;
474
+ };
475
+ const getCurrentIndex = (defaultData) => {
491
476
  let current = 0;
492
477
  let lastCurrent = 0;
493
478
  if (defaultData.length > 0) {
@@ -495,30 +480,41 @@ const CalendarItem = React.forwardRef((props, ref) => {
495
480
  if (item.title === monthTitle(defaultData[0], defaultData[1])) {
496
481
  current = index;
497
482
  }
498
- if (props.type === "range") {
483
+ if (type === "range" || type === "week") {
499
484
  if (item.title === monthTitle(defaultData[3], defaultData[4])) {
500
485
  lastCurrent = index;
501
486
  }
502
487
  }
503
488
  });
504
489
  } else {
505
- const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
506
- const currentMonth = (/* @__PURE__ */ new Date()).getMonth() + 1;
507
- const currentYearMonthIndex = monthsData.findIndex((item) => {
508
- return +item.curData[0] === currentYear && +item.curData[1] === currentMonth;
490
+ const date = /* @__PURE__ */ new Date();
491
+ const year = date.getFullYear();
492
+ const month = date.getMonth() + 1;
493
+ const index = monthsData.findIndex((item) => {
494
+ return +item.curData[0] === year && +item.curData[1] === month;
509
495
  });
510
- if (currentYearMonthIndex > -1) {
511
- current = currentYearMonthIndex;
496
+ if (index > -1) {
497
+ current = index;
512
498
  }
513
499
  }
500
+ return {
501
+ current,
502
+ lastCurrent
503
+ };
504
+ };
505
+ const renderCurrentDate = () => {
506
+ const defaultData = setDefaultDate();
507
+ const current = getCurrentIndex(defaultData);
514
508
  if (defaultData.length > 0) {
515
509
  if (type === "range") {
516
- chooseDay({ day: defaultData[2], type: "active" }, monthsData[current], true);
517
- chooseDay({ day: defaultData[5], type: "active" }, monthsData[lastCurrent], true);
510
+ chooseDay({ day: defaultData[2], type: "active" }, monthsData[current.current], true);
511
+ chooseDay({ day: defaultData[5], type: "active" }, monthsData[current.lastCurrent], true);
512
+ } else if (props.type === "week") {
513
+ chooseDay({ day: defaultData[2], type: "curr" }, monthsData[current.current], true);
518
514
  } else if (type === "multiple") {
519
515
  [...currentDate].forEach((item) => {
520
516
  const dateArr = splitDate(item);
521
- let currentIndex = current;
517
+ let currentIndex = current.current;
522
518
  monthsData.forEach((item2, index) => {
523
519
  if (item2.title === monthTitle(dateArr[0], dateArr[1])) {
524
520
  currentIndex = index;
@@ -527,23 +523,44 @@ const CalendarItem = React.forwardRef((props, ref) => {
527
523
  chooseDay({ day: dateArr[2], type: "active" }, monthsData[currentIndex], true);
528
524
  });
529
525
  } else {
530
- chooseDay({ day: defaultData[2], type: "active" }, monthsData[current], true);
526
+ chooseDay({ day: defaultData[2], type: "active" }, monthsData[current.current], true);
531
527
  }
532
528
  }
533
- return current;
529
+ return current.current;
530
+ };
531
+ const requestAniFrameFunc = (current, monthNum) => {
532
+ const lastItem = monthsData[monthsData.length - 1];
533
+ const containerHeight = lastItem.cssHeight + lastItem.scrollTop;
534
+ requestAniFrame$1(() => {
535
+ if (monthsRef && monthsPanel && viewAreaRef) {
536
+ viewHeight = monthsRef.current.clientHeight;
537
+ monthsPanel.current.style.height = `${containerHeight}px`;
538
+ monthsRef.current.scrollTop = monthsData[current].scrollTop;
539
+ setScrollTop(monthsData[current].scrollTop);
540
+ nextTick(() => setScrollWithAnimation(true));
541
+ }
542
+ });
543
+ setAvgHeight(Math.floor(containerHeight / (monthNum + 1)));
534
544
  };
535
545
  const initData = () => {
536
546
  const monthNum = getMonthNum();
537
- getMonthsData(monthNum);
547
+ getMonthData(startDates, monthNum, "next");
538
548
  const current = renderCurrentDate();
539
549
  setDefaultRange(monthNum, current);
540
550
  requestAniFrameFunc(current, monthNum);
541
551
  };
552
+ useEffect(() => {
553
+ initData();
554
+ }, []);
542
555
  const resetRender = () => {
543
556
  state.currDateArray.splice(0);
544
557
  monthsData.splice(0);
545
558
  initData();
546
559
  };
560
+ useEffect(() => {
561
+ setCurrentDate(resetDefaultValue() || []);
562
+ popup && resetRender();
563
+ }, [defaultValue]);
547
564
  const scrollToDate = (date) => {
548
565
  if (Utils.compareDate(date, propStartDate)) {
549
566
  date = propStartDate;
@@ -580,30 +597,68 @@ const CalendarItem = React.forwardRef((props, ref) => {
580
597
  }
581
598
  });
582
599
  };
583
- useEffect(() => {
584
- initData();
585
- }, []);
586
- useEffect(() => {
587
- setCurrentDate(resetDefaultValue() || []);
588
- popup && resetRender();
589
- }, [defaultValue]);
600
+ const monthsViewScroll = (e) => {
601
+ if (monthsData.length <= 1) {
602
+ return;
603
+ }
604
+ const scrollTop2 = e.detail.scrollTop;
605
+ Taro.getEnv() === "WEB" && setScrollTop(scrollTop2);
606
+ let current = Math.floor(scrollTop2 / avgHeight);
607
+ const nextTop = monthsData[current + 1].scrollTop;
608
+ const nextHeight = monthsData[current + 1].cssHeight;
609
+ if (current === 0) {
610
+ if (scrollTop2 >= nextTop) {
611
+ current += 1;
612
+ }
613
+ } else if (current > 0 && current < monthsNum - 1) {
614
+ if (scrollTop2 >= nextTop) {
615
+ current += 1;
616
+ }
617
+ if (scrollTop2 < monthsData[current].scrollTop) {
618
+ current -= 1;
619
+ }
620
+ } else {
621
+ const viewPosition = Math.round(scrollTop2 + viewHeight);
622
+ if (current + 1 <= monthsNum && viewPosition >= nextTop + nextHeight) {
623
+ current += 1;
624
+ }
625
+ if (current >= 1 && scrollTop2 < monthsData[current - 1].scrollTop) {
626
+ current -= 1;
627
+ }
628
+ }
629
+ setDefaultRange(monthsNum, current);
630
+ };
590
631
  React.useImperativeHandle(ref, () => ({
591
632
  scrollToDate
592
633
  }));
593
- const confirm = () => {
594
- if (type === "range" && state.currDateArray.length === 2 || type !== "range") {
595
- const chooseData = state.currDateArray.slice(0);
596
- onConfirm && onConfirm(chooseData);
597
- if (popup) {
598
- onUpdate && onUpdate();
634
+ const getClasses = (day, month) => {
635
+ const dateStr = getCurrDate(day, month);
636
+ if (day.type === "active") {
637
+ if (propStartDate && Utils.compareDate(dateStr, propStartDate) || propEndDate && Utils.compareDate(propEndDate, dateStr)) {
638
+ return `${dayPrefix}-disabled`;
639
+ }
640
+ if (type === "range" || type === "week") {
641
+ if (isStart(dateStr, currentDate) || isEnd(dateStr, currentDate)) {
642
+ return `${dayPrefix}-active ${isStart(dateStr, currentDate) ? "active-start" : ""} ${isEnd(dateStr, currentDate) ? "active-end" : ""}`;
643
+ }
644
+ if (Array.isArray(currentDate) && Object.values(currentDate).length === 2 && Utils.compareDate(currentDate[0], dateStr) && Utils.compareDate(dateStr, currentDate[1])) {
645
+ return `${dayPrefix}-choose`;
646
+ }
647
+ return null;
648
+ }
649
+ if (type === "multiple" && isMultiple(dateStr, currentDate) || !Array.isArray(currentDate) && Utils.isEqual(currentDate, dateStr)) {
650
+ return `${dayPrefix}-active`;
599
651
  }
652
+ return null;
600
653
  }
654
+ return `${dayPrefix}-disabled`;
601
655
  };
602
656
  const chooseDay = (day, month, isFirst) => {
603
657
  if (getClasses(day, month) === `${dayPrefix}-disabled`) {
604
658
  return;
605
659
  }
606
660
  const days = [...month.curData];
661
+ const [y, m] = month.curData;
607
662
  days[2] = typeof day.day === "number" ? Utils.getNumTwoBit(day.day) : day.day;
608
663
  days[3] = `${days[0]}/${days[1]}/${days[2]}`;
609
664
  days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
@@ -640,67 +695,112 @@ const CalendarItem = React.forwardRef((props, ref) => {
640
695
  Array.isArray(currentDate) && currentDate.unshift(days[3]);
641
696
  state.currDateArray = [[...days], ...state.currDateArray];
642
697
  }
698
+ } else if (type === "week") {
699
+ const weekArr = Utils.getWeekDate(y, m, `${day.day}`, firstDayOfWeek);
700
+ if (propStartDate && Utils.compareDate(weekArr[0], propStartDate)) {
701
+ weekArr.splice(0, 1, propStartDate);
702
+ }
703
+ if (propEndDate && Utils.compareDate(propEndDate, weekArr[1])) {
704
+ weekArr.splice(1, 1, propEndDate);
705
+ }
706
+ Array.isArray(currentDate) && currentDate.splice(0) && currentDate.push(...weekArr);
707
+ state.currDateArray = [
708
+ Utils.formatResultDate(weekArr[0]),
709
+ Utils.formatResultDate(weekArr[1])
710
+ ];
643
711
  } else {
644
712
  setCurrentDate(days[3]);
645
713
  state.currDateArray = [...days];
646
714
  }
647
715
  if (!isFirst) {
648
- onClickDay && onClickDay(state.currDateArray);
716
+ onDayClick && onDayClick(state.currDateArray);
649
717
  if (autoBackfill || !popup) {
650
718
  confirm();
651
719
  }
652
720
  }
653
721
  setMonthsData(monthsData.slice());
654
722
  };
723
+ const confirm = () => {
724
+ if (type === "range" && state.currDateArray.length === 2 || type !== "range") {
725
+ const chooseData = state.currDateArray.slice(0);
726
+ onConfirm && onConfirm(chooseData);
727
+ if (popup) {
728
+ onUpdate && onUpdate();
729
+ }
730
+ }
731
+ };
732
+ const classes = classNames({
733
+ [`${classPrefix}-title`]: !popup,
734
+ [`${classPrefix}-nofooter`]: !!autoBackfill
735
+ }, classPrefix);
736
+ const headerClasses = classNames({
737
+ [`${classPrefix}-header`]: true,
738
+ [`${classPrefix}-header-title`]: !popup
739
+ });
740
+ const isStartTip = (day, month) => {
741
+ return (type === "range" || type === "week") && day.type === "active" && isStart(getCurrDate(day, month), currentDate);
742
+ };
743
+ const isEndTip = (day, month) => {
744
+ return currentDate.length >= 2 && (type === "range" || type === "week") && day.type === "active" && isEnd(getCurrDate(day, month), currentDate);
745
+ };
746
+ const renderHeader = () => {
747
+ return React.createElement(
748
+ "div",
749
+ { className: headerClasses },
750
+ showTitle && React.createElement("div", { className: `${classPrefix}-title` }, title || locale.calendaritem.title),
751
+ renderHeaderButtons && React.createElement("div", { className: `${classPrefix}-header-buttons` }, renderHeaderButtons()),
752
+ showSubTitle && React.createElement("div", { className: `${classPrefix}-sub-title` }, yearMonthTitle),
753
+ React.createElement("div", { className: `${classPrefix}-weeks`, ref: weeksPanel }, weeks.map((item) => React.createElement("div", { className: `${classPrefix}-week-item`, key: item }, item)))
754
+ );
755
+ };
756
+ const renderContent = () => {
757
+ return React.createElement(
758
+ ScrollView,
759
+ { scrollTop, scrollY: true, type: "list", scrollWithAnimation, className: `${classPrefix}-content`, onScroll: monthsViewScroll, ref: monthsRef },
760
+ React.createElement(
761
+ "div",
762
+ { className: `${classPrefix}-pannel`, ref: monthsPanel },
763
+ React.createElement("div", { className: "viewArea", ref: viewAreaRef, style: { transform: `translateY(${translateY}px)` } }, monthsData.slice(monthDefaultRange[0], monthDefaultRange[1]).map((month, key) => {
764
+ return React.createElement(
765
+ "div",
766
+ { className: `${classPrefix}-month`, key },
767
+ React.createElement("div", { className: `${classPrefix}-month-title` }, month.title),
768
+ React.createElement("div", { className: `${classPrefix}-days` }, month.monthData.map((day, i) => React.createElement(
769
+ "div",
770
+ { className: [
771
+ `${classPrefix}-day`,
772
+ getClasses(day, month)
773
+ ].join(" "), onClick: () => {
774
+ chooseDay(day, month);
775
+ }, key: i },
776
+ React.createElement("div", { className: `${classPrefix}-day-day` }, renderDay ? renderDay(day) : day.day),
777
+ !isStartTip(day, month) && renderDayTop && React.createElement("div", { className: `${classPrefix}-day-info-top` }, renderDayTop(day)),
778
+ !isStartTip(day, month) && !isEndTip(day, month) && renderDayBottom && React.createElement("div", { className: `${classPrefix}-day-info-bottom` }, renderDayBottom(day)),
779
+ !isStartTip(day, month) && !isEndTip(day, month) && !renderDayBottom && showToday && isCurrDay(month, day.day) && React.createElement("div", { className: `${classPrefix}-day-info-curr` }, locale.calendaritem.today),
780
+ isStartTip(day, month) && React.createElement("div", { className: `${classPrefix}-day-info ${isStartAndEnd(currentDate) ? `${classPrefix}-day-info-top` : ""}` }, startText || locale.calendaritem.start),
781
+ isEndTip(day, month) && React.createElement("div", { className: `${classPrefix}-day-info` }, endText || locale.calendaritem.end)
782
+ )))
783
+ );
784
+ }))
785
+ )
786
+ );
787
+ };
788
+ const renderFooter = () => {
789
+ return React.createElement(
790
+ "div",
791
+ { className: "nut-calendar-footer" },
792
+ React.createElement("div", { className: "calendar-confirm-btn", onClick: confirm }, confirmText || locale.confirm)
793
+ );
794
+ };
655
795
  return React.createElement(
656
796
  React.Fragment,
657
797
  null,
658
798
  React.createElement(
659
799
  "div",
660
800
  { className: classes },
661
- React.createElement(
662
- "div",
663
- { className: headerClasses },
664
- showTitle && React.createElement("div", { className: `${classPrefix}-title` }, title || locale.calendaritem.title),
665
- renderHeaderButtons && React.createElement("div", { className: `${classPrefix}-header-buttons` }, renderHeaderButtons()),
666
- showSubTitle && React.createElement("div", { className: `${classPrefix}-sub-title` }, yearMonthTitle),
667
- React.createElement("div", { className: `${classPrefix}-weeks`, ref: weeksPanel }, weeks.map((item) => React.createElement("div", { className: `${classPrefix}-week-item`, key: item }, item)))
668
- ),
669
- React.createElement(
670
- ScrollView,
671
- { scrollTop, scrollY: true, type: "list", scrollWithAnimation, className: `${classPrefix}-content`, onScroll: monthsViewScroll, ref: monthsRef },
672
- React.createElement(
673
- "div",
674
- { className: `${classPrefix}-pannel`, ref: monthsPanel },
675
- React.createElement("div", { className: "viewArea", ref: viewAreaRef, style: { transform: `translateY(${translateY}px)` } }, monthsData.slice(monthDefaultRange[0], monthDefaultRange[1]).map((month, key) => {
676
- return React.createElement(
677
- "div",
678
- { className: `${classPrefix}-month`, key },
679
- React.createElement("div", { className: `${classPrefix}-month-title` }, month.title),
680
- React.createElement("div", { className: `${classPrefix}-days` }, month.monthData.map((day, i) => React.createElement(
681
- "div",
682
- { className: [
683
- `${classPrefix}-day`,
684
- getClasses(day, month)
685
- ].join(" "), onClick: () => {
686
- chooseDay(day, month);
687
- }, key: i },
688
- React.createElement("div", { className: `${classPrefix}-day-day` }, renderDay ? renderDay(day) : day.day),
689
- !isStartTip(day, month) && renderDayTop && React.createElement("div", { className: `${classPrefix}-day-info-top` }, renderDayTop(day)),
690
- !isStartTip(day, month) && !isEndTip(day, month) && renderDayBottom && React.createElement("div", { className: `${classPrefix}-day-info-bottom` }, renderDayBottom(day)),
691
- !isStartTip(day, month) && !isEndTip(day, month) && !renderDayBottom && showToday && isCurrDay(month, day.day) && React.createElement("div", { className: `${classPrefix}-day-info-curr` }, locale.calendaritem.today),
692
- isStartTip(day, month) && React.createElement("div", { className: `${classPrefix}-day-info ${isStartAndEnd() ? `${classPrefix}-day-info-top` : ""}` }, startText || locale.calendaritem.start),
693
- isEndTip(day, month) && React.createElement("div", { className: `${classPrefix}-day-info` }, endText || locale.calendaritem.end)
694
- )))
695
- );
696
- }))
697
- )
698
- ),
699
- popup && !autoBackfill ? React.createElement(
700
- "div",
701
- { className: "nut-calendar-footer" },
702
- React.createElement("div", { className: "calendar-confirm-btn", onClick: confirm }, confirmText || locale.confirm)
703
- ) : ""
801
+ renderHeader(),
802
+ renderContent(),
803
+ popup && !autoBackfill ? renderFooter() : ""
704
804
  )
705
805
  );
706
806
  });