@nutui/nutui-react-taro 2.7.7 → 2.7.9

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 (48) hide show
  1. package/CHANGELOG.md +26 -10
  2. package/dist/esm/Animate/style/style.css +1 -1
  3. package/dist/esm/Animate.js +1 -1
  4. package/dist/esm/AvatarCropper.js +1 -1
  5. package/dist/esm/Calendar/style/style.css +1 -1
  6. package/dist/esm/Calendar.js +1 -1
  7. package/dist/esm/CalendarCard.js +1 -1
  8. package/dist/esm/CalendarItem.js +1 -1
  9. package/dist/esm/Drag.js +1 -1
  10. package/dist/esm/ImagePreview/style/style.css +1 -1
  11. package/dist/esm/Menu.js +1 -1
  12. package/dist/esm/MenuItem.js +1 -1
  13. package/dist/esm/PullToRefresh.js +1 -1
  14. package/dist/esm/Sticky.js +1 -1
  15. package/dist/esm/Swiper/style/style.css +1 -1
  16. package/dist/esm/VirtualList.js +1 -1
  17. package/dist/esm/{animate.taro-CQVEyDKL.js → animate.taro-BHDZMzJF.js} +9 -12
  18. package/dist/esm/{avatarcropper.taro-meD2sizv.js → avatarcropper.taro-5JSFH7Q9.js} +2 -1
  19. package/dist/esm/{calendar.taro-CM4yWFlF.js → calendar.taro-CUDVpJBa.js} +3 -3
  20. package/dist/esm/{calendarcard.taro-CvWyBqnr.js → calendarcard.taro-BiOnui_b.js} +4 -4
  21. package/dist/esm/{calendaritem.taro-BGbbuJOS.js → calendaritem.taro-DveeC4_t.js} +237 -219
  22. package/dist/esm/date-BmUWlDuN.js +147 -0
  23. package/dist/esm/{drag.taro-r5Lmncrq.js → drag.taro-CHPSfySz.js} +2 -2
  24. package/dist/esm/get-system-info-D27xNglo.js +11 -0
  25. package/dist/esm/{menu.taro-2APk--BX.js → menu.taro-9N8A5UoN.js} +1 -1
  26. package/dist/esm/{menuitem.taro-BMlSqBSc.js → menuitem.taro-CnsORm5-.js} +5 -4
  27. package/dist/esm/nutui-react.es.js +11 -11
  28. package/dist/esm/{pulltorefresh.taro-BiSDwLpA.js → pulltorefresh.taro-DAFv7upo.js} +2 -1
  29. package/dist/esm/{sticky.taro-DtUAawu_.js → sticky.taro-l66r7WFn.js} +3 -2
  30. package/dist/esm/{virtuallist.taro-BlPW8ibd.js → virtuallist.taro-CQDtOwWn.js} +2 -2
  31. package/dist/locales/base.js +1 -1
  32. package/dist/locales/en-US.js +1 -1
  33. package/dist/locales/id-ID.js +1 -1
  34. package/dist/locales/tr-TR.js +1 -1
  35. package/dist/locales/zh-CN.js +1 -1
  36. package/dist/locales/zh-TW.js +1 -1
  37. package/dist/locales/zh-UG.js +1 -1
  38. package/dist/nutui.react.es.js +384 -465
  39. package/dist/nutui.react.umd.js +383 -464
  40. package/dist/packages/animate/animate.scss +63 -105
  41. package/dist/packages/calendar/calendar.scss +9 -9
  42. package/dist/packages/swiper/swiper.scss +11 -0
  43. package/dist/style.css +1 -1
  44. package/dist/types/packages/animate/animate.taro.d.ts +2 -1
  45. package/dist/types/utils/date.d.ts +54 -52
  46. package/dist/types/utils/get-system-info.d.ts +19 -0
  47. package/package.json +1 -1
  48. package/dist/esm/date-CYwRNlGq.js +0 -219
@@ -2,7 +2,7 @@
2
2
  typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("@tarojs/taro"), require("@tarojs/components"), require("react-dom")) : typeof define === "function" && define.amd ? define(["exports", "react", "@tarojs/taro", "@tarojs/components", "react-dom"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory((global2.nutui = global2.nutui || {}, global2.nutui.react = {}), global2.React, global2.Taro, global2.components, global2.ReactDOM));
3
3
  })(this, function(exports2, React, Taro, components, ReactDOM) {
4
4
  "use strict";/*!
5
- * @nutui/nutui-react v2.7.7 Fri Jan 24 2025 13:57:13 GMT+0800 (China Standard Time)
5
+ * @nutui/nutui-react-taro v2.7.9 Fri Feb 21 2025 17:12:27 GMT+0800 (China Standard Time)
6
6
  * (c) 2023 @jdf2e.
7
7
  * Released under the MIT License.
8
8
  */
@@ -1365,7 +1365,7 @@
1365
1365
  return value != null && isLength(value.length) && !isFunction2(value);
1366
1366
  }
1367
1367
  var isBuffer = nativeIsBuffer || stubFalse;
1368
- function isEqual(value, other) {
1368
+ function isEqual2(value, other) {
1369
1369
  return baseIsEqual(value, other);
1370
1370
  }
1371
1371
  function isFunction2(value) {
@@ -1395,7 +1395,7 @@
1395
1395
  function stubFalse() {
1396
1396
  return false;
1397
1397
  }
1398
- module2.exports = isEqual;
1398
+ module2.exports = isEqual2;
1399
1399
  })(lodash_isequal, lodash_isequal.exports);
1400
1400
  var lodash_isequalExports = lodash_isequal.exports;
1401
1401
  const isequal = /* @__PURE__ */ getDefaultExportFromCjs(lodash_isequalExports);
@@ -3938,6 +3938,12 @@
3938
3938
  }));
3939
3939
  };
3940
3940
  Space.displayName = "NutSpace";
3941
+ const getDeviceInfo = () => {
3942
+ return Taro.canIUse("getDeviceInfo") ? Taro.getDeviceInfo() : Taro.getSystemInfoSync();
3943
+ };
3944
+ const getWindowInfo = () => {
3945
+ return Taro.canIUse("getWindowInfo") ? Taro.getWindowInfo() : Taro.getSystemInfoSync();
3946
+ };
3941
3947
  function useWatch$1(dep, callback, config2 = { immediate: false }) {
3942
3948
  const { immediate } = config2;
3943
3949
  const prev = React.useRef();
@@ -4135,7 +4141,7 @@
4135
4141
  setFixed(threshold > curRootRect.top);
4136
4142
  }
4137
4143
  } else {
4138
- const windowHeight = Taro.getSystemInfoSync().windowHeight;
4144
+ const windowHeight = getWindowInfo().windowHeight;
4139
4145
  setFixed(windowHeight - threshold < curRootRect.bottom);
4140
4146
  }
4141
4147
  };
@@ -6228,189 +6234,106 @@
6228
6234
  };
6229
6235
  const Address = React.forwardRef(InternalAddress);
6230
6236
  Address.displayName = "NutAddress";
6231
- const Utils = {
6232
- /**
6233
- * 是否为闫年
6234
- * @return {Boolse} true|false
6235
- */
6236
- isLeapYear(y2) {
6237
- return y2 % 4 === 0 && y2 % 100 !== 0 || y2 % 400 === 0;
6238
- },
6239
- /**
6240
- * 返回星期数
6241
- * @return {String}
6242
- */
6243
- getWhatDay(year, month, day) {
6244
- const date2 = /* @__PURE__ */ new Date(`${year}/${month}/${day}`);
6245
- const index = date2.getDay();
6246
- const dayNames = [
6247
- "星期日",
6248
- "星期一",
6249
- "星期二",
6250
- "星期三",
6251
- "星期四",
6252
- "星期五",
6253
- "星期六"
6254
- ];
6255
- return dayNames[index];
6256
- },
6257
- /**
6258
- * 返回上一个月在当前面板中的天数
6259
- * @return {Number}
6260
- */
6261
- getMonthPreDay(year, month) {
6262
- const date2 = /* @__PURE__ */ new Date(`${year}/${month}/01`);
6263
- let day = date2.getDay();
6264
- if (day === 0) {
6265
- day = 7;
6266
- }
6267
- return day;
6268
- },
6269
- /**
6270
- * 返回月份天数
6271
- * @return {Number}
6272
- */
6273
- getMonthDays(year, month) {
6274
- if (/^0/.test(month)) {
6275
- month = month.split("")[1];
6276
- }
6277
- return [
6278
- 0,
6279
- 31,
6280
- this.isLeapYear(Number(year)) ? 29 : 28,
6281
- 31,
6282
- 30,
6283
- 31,
6284
- 30,
6285
- 31,
6286
- 31,
6287
- 30,
6288
- 31,
6289
- 30,
6290
- 31
6291
- ][month];
6292
- },
6293
- /**
6294
- * 补齐数字位数
6295
- * @return {string}
6296
- */
6297
- getNumTwoBit(n2) {
6298
- n2 = Number(n2);
6299
- return (n2 > 9 ? "" : "0") + n2;
6300
- },
6301
- /**
6302
- * 日期对象转成字符串
6303
- * @return {string}
6304
- */
6305
- date2Str(date2, split) {
6306
- split = split || "-";
6307
- const y2 = date2.getFullYear();
6308
- const m2 = this.getNumTwoBit(date2.getMonth() + 1);
6309
- const d = this.getNumTwoBit(date2.getDate());
6310
- return [y2, m2, d].join(split);
6311
- },
6312
- /**
6313
- * 返回日期格式字符串
6314
- * @param {Number} 0返回今天的日期、1返回明天的日期,2返回后天得日期,依次类推
6315
- * @return {string} '2014-12-31'
6316
- */
6317
- getDay(i2) {
6318
- i2 = i2 || 0;
6319
- let date2 = /* @__PURE__ */ new Date();
6320
- const diff = i2 * (1e3 * 60 * 60 * 24);
6321
- date2 = new Date(date2.getTime() + diff);
6322
- return this.date2Str(date2);
6323
- },
6324
- /**
6325
- * 时间比较
6326
- * @return {Boolean}
6327
- */
6328
- compareDate(date1, date2) {
6329
- const startTime = new Date(date1.replace("-", "/").replace("-", "/"));
6330
- const endTime = new Date(date2.replace("-", "/").replace("-", "/"));
6331
- if (startTime >= endTime) {
6332
- return false;
6333
- }
6334
- return true;
6335
- },
6336
- /**
6337
- * 时间是否相等
6338
- * @return {Boolean}
6339
- */
6340
- isEqual(date1, date2) {
6341
- const startTime = new Date((date1 || "").replace(/-/g, "/")).getTime();
6342
- const endTime = new Date(date2.replace(/-/g, "/")).getTime();
6343
- if (startTime === endTime) {
6344
- return true;
6345
- }
6346
- return false;
6347
- },
6348
- getMonthWeek(year, month, date2, firstDayOfWeek = 0) {
6349
- const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date2));
6350
- let w = dateNow.getDay();
6351
- const d = dateNow.getDate();
6352
- let remainder = 6 - w;
6353
- if (firstDayOfWeek !== 0) {
6354
- w = w === 0 ? 7 : w;
6355
- remainder = 7 - w;
6356
- }
6357
- return Math.ceil((d + remainder) / 7);
6358
- },
6359
- getYearWeek(year, month, date2, firstDayOfWeek = 0) {
6360
- const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date2));
6361
- const dateFirst = new Date(Number(year), 0, 1);
6362
- const dataNumber = Math.round(
6363
- (dateNow.valueOf() - dateFirst.valueOf()) / 864e5
6364
- );
6365
- return Math.ceil((dataNumber + (dateFirst.getDay() + 1 - 1)) / 7);
6366
- },
6367
- getWeekDate(year, month, date2, firstDayOfWeek = 0) {
6368
- const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date2));
6369
- const nowTime = dateNow.getTime();
6370
- let day = dateNow.getDay();
6371
- if (firstDayOfWeek === 0) {
6372
- const oneDayTime2 = 24 * 60 * 60 * 1e3;
6373
- const SundayTime2 = nowTime - day * oneDayTime2;
6374
- const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
6375
- const sunday2 = this.date2Str(new Date(SundayTime2));
6376
- const saturday = this.date2Str(new Date(SaturdayTime));
6377
- return [sunday2, saturday];
6378
- }
6379
- day = day === 0 ? 7 : day;
6380
- const oneDayTime = 24 * 60 * 60 * 1e3;
6381
- const MondayTime = nowTime - (day - 1) * oneDayTime;
6382
- const SundayTime = nowTime + (7 - day) * oneDayTime;
6383
- const monday = this.date2Str(new Date(MondayTime));
6384
- const sunday = this.date2Str(new Date(SundayTime));
6385
- return [monday, sunday];
6386
- },
6387
- formatResultDate(date2) {
6388
- const days = [...date2.split("-")];
6389
- days[2] = Utils.getNumTwoBit(Number(days[2]));
6390
- days[3] = `${days[0]}-${days[1]}-${days[2]}`;
6391
- days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
6392
- return days;
6237
+ const isLeapYear = (y2) => {
6238
+ return y2 % 4 === 0 && y2 % 100 !== 0 || y2 % 400 === 0;
6239
+ };
6240
+ const getWhatDay = (year, month, day) => {
6241
+ const date2 = new Date(year, month - 1, day);
6242
+ const dayNames = [
6243
+ "星期日",
6244
+ "星期一",
6245
+ "星期二",
6246
+ "星期三",
6247
+ "星期四",
6248
+ "星期五",
6249
+ "星期六"
6250
+ ];
6251
+ return dayNames[date2.getDay()];
6252
+ };
6253
+ const getMonthPreDay = (year, month) => {
6254
+ const day = new Date(year, month - 1, 1).getDay();
6255
+ return day === 0 ? 7 : day;
6256
+ };
6257
+ const getMonthDays = (year, month) => {
6258
+ if (/^0/.test(month)) {
6259
+ month = month.split("")[1];
6260
+ }
6261
+ return [
6262
+ 0,
6263
+ 31,
6264
+ isLeapYear(Number(year)) ? 29 : 28,
6265
+ 31,
6266
+ 30,
6267
+ 31,
6268
+ 30,
6269
+ 31,
6270
+ 31,
6271
+ 30,
6272
+ 31,
6273
+ 30,
6274
+ 31
6275
+ ][month];
6276
+ };
6277
+ const getNumTwoBit = (n2) => {
6278
+ return n2 > 9 ? `${n2}` : `0${n2}`;
6279
+ };
6280
+ const date2Str = (date2, split = "-") => {
6281
+ const y2 = date2.getFullYear();
6282
+ const m2 = getNumTwoBit(date2.getMonth() + 1);
6283
+ const d = getNumTwoBit(date2.getDate());
6284
+ return [y2, m2, d].join(split);
6285
+ };
6286
+ const getDateString = (offset = 0) => {
6287
+ const date2 = /* @__PURE__ */ new Date();
6288
+ date2.setDate(date2.getDate() + offset);
6289
+ return date2Str(date2, "-");
6290
+ };
6291
+ const compareDate = (date1, date2) => {
6292
+ const startTime = new Date(date1.replace("-", "/").replace("-", "/"));
6293
+ const endTime = new Date(date2.replace("-", "/").replace("-", "/"));
6294
+ return startTime < endTime;
6295
+ };
6296
+ const isEqual = (date1, date2) => {
6297
+ const startTime = new Date((date1 || "").replace(/-/g, "/")).getTime();
6298
+ const endTime = new Date(date2.replace(/-/g, "/")).getTime();
6299
+ return startTime === endTime;
6300
+ };
6301
+ const getWeekDate = (year, month, date2, firstDayOfWeek = 0) => {
6302
+ const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date2));
6303
+ const nowTime = dateNow.getTime();
6304
+ let day = dateNow.getDay();
6305
+ if (firstDayOfWeek === 0) {
6306
+ const oneDayTime2 = 24 * 60 * 60 * 1e3;
6307
+ const SundayTime2 = nowTime - day * oneDayTime2;
6308
+ const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
6309
+ const sunday2 = date2Str(new Date(SundayTime2));
6310
+ const saturday = date2Str(new Date(SaturdayTime));
6311
+ return [sunday2, saturday];
6393
6312
  }
6313
+ day = day === 0 ? 7 : day;
6314
+ const oneDayTime = 24 * 60 * 60 * 1e3;
6315
+ const MondayTime = nowTime - (day - 1) * oneDayTime;
6316
+ const SundayTime = nowTime + (7 - day) * oneDayTime;
6317
+ const monday = date2Str(new Date(MondayTime));
6318
+ const sunday = date2Str(new Date(SundayTime));
6319
+ return [monday, sunday];
6320
+ };
6321
+ const formatResultDate = (date2) => {
6322
+ const [year, month, day] = [...date2.split("-")];
6323
+ const formatterDay = getNumTwoBit(Number(day));
6324
+ const formatterDate = `${year}-${month}-${day}`;
6325
+ const dayOfWeek = getWhatDay(Number(year), Number(month), Number(day));
6326
+ return [year, month, formatterDay, formatterDate, dayOfWeek];
6394
6327
  };
6395
6328
  const getCurrMonthData = (type2, year, month) => {
6396
- switch (type2) {
6397
- case "prev":
6398
- month === 1 && (year -= 1);
6399
- month = month === 1 ? 12 : --month;
6400
- break;
6401
- case "next":
6402
- month === 12 && (year += 1);
6403
- month = month === 12 ? 1 : ++month;
6404
- break;
6329
+ {
6330
+ month === 12 && (year += 1);
6331
+ month = month === 12 ? 1 : ++month;
6405
6332
  }
6406
- return [
6407
- year,
6408
- Utils.getNumTwoBit(month),
6409
- Utils.getMonthDays(String(year), String(month))
6410
- ];
6333
+ return [year, getNumTwoBit(month), getMonthDays(String(year), String(month))];
6411
6334
  };
6412
6335
  const getDaysStatus = (type2, year, month) => {
6413
- let days = Utils.getMonthDays(`${year}`, `${month}`);
6336
+ let days = getMonthDays(`${year}`, `${month}`);
6414
6337
  return Array.from(Array(days), (v, k) => {
6415
6338
  return {
6416
6339
  day: k + 1,
@@ -6427,12 +6350,12 @@
6427
6350
  preMonth = 12;
6428
6351
  preYear += 1;
6429
6352
  }
6430
- let days = Utils.getMonthPreDay(+year, +month);
6353
+ let days = getMonthPreDay(+year, +month);
6431
6354
  days -= firstDayOfWeek;
6432
6355
  if (days >= 7) {
6433
6356
  days -= 7;
6434
6357
  }
6435
- const preDates = Utils.getMonthDays(`${preYear}`, `${preMonth}`);
6358
+ const preDates = getMonthDays(`${preYear}`, `${preMonth}`);
6436
6359
  const months = Array.from(Array(preDates), (v, k) => {
6437
6360
  return {
6438
6361
  day: k + 1,
@@ -6450,28 +6373,26 @@
6450
6373
  const isMultiple = (day, days) => {
6451
6374
  if (days.length > 0) {
6452
6375
  return days.some((item) => {
6453
- return Utils.isEqual(item, day);
6376
+ return isEqual(item, day);
6454
6377
  });
6455
6378
  }
6456
6379
  return false;
6457
6380
  };
6458
6381
  const isCurrDay = (month, day) => {
6459
6382
  const date2 = `${month.curData[0]}/${month.curData[1]}/${day}`;
6460
- return Utils.isEqual(date2, Utils.date2Str(/* @__PURE__ */ new Date(), "/"));
6383
+ return isEqual(date2, date2Str(/* @__PURE__ */ new Date(), "/"));
6461
6384
  };
6462
6385
  const getCurrDate = (day, month) => {
6463
- return `${month.curData[0]}/${month.curData[1]}/${Utils.getNumTwoBit(
6464
- +day.day
6465
- )}`;
6386
+ return `${month.curData[0]}/${month.curData[1]}/${getNumTwoBit(+day.day)}`;
6466
6387
  };
6467
6388
  const isStart = (day, days) => {
6468
- return Utils.isEqual(days[0], day);
6389
+ return isEqual(days[0], day);
6469
6390
  };
6470
6391
  const isEnd = (day, days) => {
6471
- return Utils.isEqual(days[1], day);
6392
+ return isEqual(days[1], day);
6472
6393
  };
6473
6394
  const isStartAndEnd = (days) => {
6474
- return days.length >= 2 && Utils.isEqual(days[0], days[1]);
6395
+ return days.length >= 2 && isEqual(days[0], days[1]);
6475
6396
  };
6476
6397
  const defaultProps$13 = {
6477
6398
  ...ComponentDefaults,
@@ -6479,8 +6400,8 @@
6479
6400
  autoBackfill: false,
6480
6401
  popup: true,
6481
6402
  title: "",
6482
- startDate: Utils.getDay(0),
6483
- endDate: Utils.getDay(365),
6403
+ startDate: getDateString(0),
6404
+ endDate: getDateString(365),
6484
6405
  showToday: true,
6485
6406
  startText: "",
6486
6407
  endText: "",
@@ -6513,6 +6434,7 @@
6513
6434
  type: type2,
6514
6435
  autoBackfill,
6515
6436
  title,
6437
+ value,
6516
6438
  defaultValue,
6517
6439
  startDate,
6518
6440
  endDate,
@@ -6530,12 +6452,13 @@
6530
6452
  renderDayTop,
6531
6453
  renderDayBottom,
6532
6454
  renderBottomButton,
6533
- value,
6534
6455
  onConfirm,
6535
6456
  onUpdate,
6536
6457
  onDayClick,
6537
6458
  onPageChange
6538
6459
  } = { ...defaultProps$13, ...props };
6460
+ const classPrefix2 = "nut-calendar";
6461
+ const dayPrefix = "nut-calendar-day";
6539
6462
  const weekdays = locale.calendaritem.weekdays;
6540
6463
  const weeks = [
6541
6464
  ...weekdays.slice(firstDayOfWeek, 7),
@@ -6549,19 +6472,13 @@
6549
6472
  const [monthDefaultRange, setMonthDefaultRange] = React.useState([]);
6550
6473
  const [scrollTop, setScrollTop] = React.useState(0);
6551
6474
  const [scrollWithAnimation, setScrollWithAnimation] = React.useState(false);
6552
- const propStartDate = startDate || Utils.getDay(0);
6553
- const propEndDate = endDate || Utils.getDay(365);
6475
+ const propStartDate = startDate || getDateString(0);
6476
+ const propEndDate = endDate || getDateString(365);
6554
6477
  const startDates = splitDate(propStartDate);
6555
6478
  const endDates = splitDate(propEndDate);
6556
6479
  const [state] = React.useState({
6557
6480
  currDateArray: []
6558
6481
  });
6559
- const getMonthsPanel = () => {
6560
- return monthsPanel.current;
6561
- };
6562
- const getMonthsRef = () => {
6563
- return monthsRef.current;
6564
- };
6565
6482
  const resetDefaultValue = () => {
6566
6483
  if (defaultValue || Array.isArray(defaultValue) && defaultValue.length > 0) {
6567
6484
  return type2 !== "single" ? [...defaultValue] : defaultValue;
@@ -6581,9 +6498,7 @@
6581
6498
  const viewAreaRef = React.useRef(null);
6582
6499
  const [avgHeight, setAvgHeight] = React.useState(0);
6583
6500
  let viewHeight = 0;
6584
- const classPrefix2 = "nut-calendar";
6585
- const dayPrefix = "nut-calendar-day";
6586
- const getMonthData = (curData, monthNum, type22) => {
6501
+ const getMonthData = (curData, monthNum) => {
6587
6502
  let i2 = 0;
6588
6503
  let date2 = curData;
6589
6504
  const monthData = monthsData;
@@ -6594,12 +6509,12 @@
6594
6509
  ...getPreMonthDates("prev", y2, m2, firstDayOfWeek),
6595
6510
  ...getDaysStatus("active", y2, m2)
6596
6511
  ];
6597
- const cssHeight = 39 + (days.length > 35 ? 384 : 320);
6598
6512
  let scrollTop2 = 0;
6599
6513
  if (monthData.length > 0) {
6600
6514
  const monthEle = monthData[monthData.length - 1];
6601
6515
  scrollTop2 = monthEle.scrollTop + monthEle.cssHeight;
6602
6516
  }
6517
+ const cssHeight = 39 + (days.length > 35 ? 384 : 320);
6603
6518
  const monthInfo = {
6604
6519
  curData: date2,
6605
6520
  title: monthTitle(y2, m2),
@@ -6607,16 +6522,14 @@
6607
6522
  cssHeight,
6608
6523
  scrollTop: scrollTop2
6609
6524
  };
6610
- {
6611
- if (!endDates || !Utils.compareDate(
6612
- `${endDates[0]}/${endDates[1]}/${Utils.getMonthDays(
6613
- endDates[0],
6614
- endDates[1]
6615
- )}`,
6616
- `${curData[0]}/${curData[1]}/${curData[2]}`
6617
- )) {
6618
- monthData.push(monthInfo);
6619
- }
6525
+ if (!endDates || !compareDate(
6526
+ `${endDates[0]}/${endDates[1]}/${getMonthDays(
6527
+ endDates[0],
6528
+ endDates[1]
6529
+ )}`,
6530
+ `${curData[0]}/${curData[1]}/${curData[2]}`
6531
+ )) {
6532
+ monthData.push(monthInfo);
6620
6533
  }
6621
6534
  date2 = getCurrMonthData("next", y2, m2);
6622
6535
  } while (i2++ < monthNum);
@@ -6624,8 +6537,8 @@
6624
6537
  };
6625
6538
  const setReachedYearMonthInfo = (current) => {
6626
6539
  const currentMonthsData = monthsData[current];
6627
- const [year, month] = currentMonthsData.curData;
6628
6540
  if (currentMonthsData.title === yearMonthTitle) return;
6541
+ const [year, month] = currentMonthsData.curData;
6629
6542
  onPageChange && onPageChange([year, month, `${year}-${month}`]);
6630
6543
  setYearMonthTitle(currentMonthsData.title);
6631
6544
  };
@@ -6651,75 +6564,67 @@
6651
6564
  setTranslateY(monthsData[start].scrollTop);
6652
6565
  setReachedYearMonthInfo(current);
6653
6566
  };
6654
- const getMonthNum = () => {
6655
- let monthNum = Number(endDates[1]) - Number(startDates[1]);
6656
- const yearNum = Number(endDates[0]) - Number(startDates[0]);
6657
- if (yearNum > 0) {
6658
- monthNum += 12 * yearNum;
6659
- }
6660
- if (monthNum <= 0) {
6661
- monthNum = 1;
6662
- }
6663
- setMonthsNum(monthNum);
6664
- return monthNum;
6665
- };
6666
6567
  const setDefaultDate = () => {
6667
6568
  let defaultData = [];
6668
- if (type2 === "range" && Array.isArray(currentDate)) {
6669
- if (currentDate.length > 0) {
6670
- if (propStartDate && Utils.compareDate(currentDate[0], propStartDate)) {
6671
- currentDate.splice(0, 1, propStartDate);
6672
- }
6673
- if (propEndDate && Utils.compareDate(propEndDate, currentDate[1])) {
6674
- currentDate.splice(1, 1, propEndDate);
6675
- }
6676
- defaultData = [
6677
- ...splitDate(currentDate[0]),
6678
- ...splitDate(currentDate[1])
6679
- ];
6569
+ if (type2 === "single" && typeof currentDate === "string") {
6570
+ if (!currentDate.length) {
6571
+ return defaultData;
6572
+ }
6573
+ if (compareDate(currentDate, propStartDate)) {
6574
+ defaultData = [...splitDate(propStartDate)];
6575
+ } else if (!compareDate(currentDate, propEndDate)) {
6576
+ defaultData = [...splitDate(propEndDate)];
6577
+ } else {
6578
+ defaultData = [...splitDate(currentDate)];
6680
6579
  }
6681
- } else if (type2 === "multiple" && Array.isArray(currentDate)) {
6682
- if (currentDate.length > 0) {
6683
- const defaultArr = [];
6684
- const obj = {};
6685
- currentDate.forEach((item) => {
6686
- if (propStartDate && !Utils.compareDate(item, propStartDate) && propEndDate && !Utils.compareDate(propEndDate, item)) {
6687
- if (!Object.hasOwnProperty.call(obj, item)) {
6688
- defaultArr.push(item);
6689
- obj[item] = item;
6690
- }
6580
+ return defaultData;
6581
+ }
6582
+ if (Array.isArray(currentDate) && currentDate.length) {
6583
+ switch (type2) {
6584
+ case "range": {
6585
+ if (compareDate(currentDate[0], propStartDate)) {
6586
+ currentDate[0] = propStartDate;
6691
6587
  }
6692
- });
6693
- currentDate.splice(0) && currentDate.push(...defaultArr);
6694
- defaultData = [...splitDate(defaultArr[0])];
6695
- }
6696
- } else if (type2 === "week" && Array.isArray(currentDate)) {
6697
- if (currentDate.length > 0) {
6698
- const [y2, m2, d] = splitDate(currentDate[0]);
6699
- const weekArr = Utils.getWeekDate(y2, m2, d, firstDayOfWeek);
6700
- currentDate.splice(0) && currentDate.push(...weekArr);
6701
- if (propStartDate && Utils.compareDate(currentDate[0], propStartDate)) {
6702
- currentDate.splice(0, 1, propStartDate);
6588
+ if (compareDate(propEndDate, currentDate[1])) {
6589
+ currentDate[1] = propEndDate;
6590
+ }
6591
+ defaultData = [
6592
+ ...splitDate(currentDate[0]),
6593
+ ...splitDate(currentDate[1])
6594
+ ];
6595
+ break;
6703
6596
  }
6704
- if (propEndDate && Utils.compareDate(propEndDate, currentDate[1])) {
6705
- currentDate.splice(1, 1, propEndDate);
6597
+ case "multiple": {
6598
+ const defaultArr = [];
6599
+ const obj = {};
6600
+ currentDate.forEach((item) => {
6601
+ if (!compareDate(item, propStartDate) && !compareDate(propEndDate, item)) {
6602
+ if (!Object.hasOwnProperty.call(obj, item)) {
6603
+ defaultArr.push(item);
6604
+ obj[item] = item;
6605
+ }
6606
+ }
6607
+ });
6608
+ currentDate.splice(0, currentDate.length, ...defaultArr);
6609
+ defaultData = [...splitDate(defaultArr[0])];
6610
+ break;
6706
6611
  }
6707
- defaultData = [
6708
- ...splitDate(currentDate[0]),
6709
- ...splitDate(currentDate[1])
6710
- ];
6711
- }
6712
- } else if (currentDate) {
6713
- if (currentDate.length > 0) {
6714
- if (propStartDate && Utils.compareDate(currentDate, propStartDate)) {
6715
- defaultData = [...splitDate(propStartDate)];
6716
- } else if (propEndDate && !Utils.compareDate(currentDate, propEndDate)) {
6717
- defaultData = [...splitDate(propEndDate)];
6718
- } else {
6719
- defaultData = [...splitDate(currentDate)];
6612
+ case "week": {
6613
+ const [y2, m2, d] = splitDate(currentDate[0]);
6614
+ const weekArr = getWeekDate(y2, m2, d, firstDayOfWeek);
6615
+ currentDate.splice(0, currentDate.length, ...weekArr);
6616
+ if (compareDate(currentDate[0], propStartDate)) {
6617
+ currentDate.splice(0, 1, propStartDate);
6618
+ }
6619
+ if (compareDate(propEndDate, currentDate[1])) {
6620
+ currentDate.splice(1, 1, propEndDate);
6621
+ }
6622
+ defaultData = [
6623
+ ...splitDate(currentDate[0]),
6624
+ ...splitDate(currentDate[1])
6625
+ ];
6626
+ break;
6720
6627
  }
6721
- } else {
6722
- defaultData = [];
6723
6628
  }
6724
6629
  }
6725
6630
  return defaultData;
@@ -6742,63 +6647,57 @@
6742
6647
  const date2 = /* @__PURE__ */ new Date();
6743
6648
  const year = date2.getFullYear();
6744
6649
  const month = date2.getMonth() + 1;
6745
- const index = monthsData.findIndex((item) => {
6746
- return +item.curData[0] === year && +item.curData[1] === month;
6747
- });
6748
- if (index > -1) {
6749
- current = index;
6750
- }
6650
+ const index = monthsData.findIndex(
6651
+ (item) => +item.curData[0] === year && +item.curData[1] === month
6652
+ );
6653
+ if (index > -1) current = index;
6751
6654
  }
6752
6655
  return {
6753
6656
  current,
6754
6657
  lastCurrent
6755
6658
  };
6756
6659
  };
6757
- const renderCurrentDate = () => {
6758
- const defaultData = setDefaultDate();
6759
- const current = getCurrentIndex(defaultData);
6760
- if (defaultData.length > 0) {
6761
- if (type2 === "range") {
6762
- chooseDay(
6763
- { day: defaultData[2], type: "active" },
6764
- monthsData[current.current],
6765
- true
6766
- );
6767
- chooseDay(
6660
+ const renderCurrentDate = (defaultData, current) => {
6661
+ if (!defaultData.length) return;
6662
+ const date2 = monthsData[current.current];
6663
+ switch (type2) {
6664
+ case "range": {
6665
+ handleDayClick({ day: defaultData[2], type: "active" }, date2);
6666
+ handleDayClick(
6768
6667
  { day: defaultData[5], type: "active" },
6769
- monthsData[current.lastCurrent],
6770
- true
6668
+ monthsData[current.lastCurrent]
6771
6669
  );
6772
- } else if (type2 === "week") {
6773
- chooseDay(
6774
- { day: defaultData[2], type: "curr" },
6775
- monthsData[current.current],
6776
- true
6777
- );
6778
- } else if (type2 === "multiple") {
6670
+ break;
6671
+ }
6672
+ case "week": {
6673
+ handleDayClick({ day: defaultData[2], type: "curr" }, date2);
6674
+ break;
6675
+ }
6676
+ case "multiple": {
6779
6677
  [...currentDate].forEach((item) => {
6780
6678
  const dateArr = splitDate(item);
6781
6679
  let currentIndex = current.current;
6782
- monthsData.forEach((item2, index) => {
6783
- if (item2.title === monthTitle(dateArr[0], dateArr[1])) {
6784
- currentIndex = index;
6785
- }
6786
- });
6787
- chooseDay(
6680
+ currentIndex = monthsData.findIndex(
6681
+ (item2) => item2.title === monthTitle(dateArr[0], dateArr[1])
6682
+ );
6683
+ handleDayClick(
6788
6684
  { day: dateArr[2], type: "active" },
6789
- monthsData[currentIndex],
6790
- true
6685
+ monthsData[currentIndex]
6791
6686
  );
6792
6687
  });
6793
- } else {
6794
- chooseDay(
6795
- { day: defaultData[2], type: "active" },
6796
- monthsData[current.current],
6797
- true
6798
- );
6688
+ break;
6689
+ }
6690
+ default: {
6691
+ handleDayClick({ day: defaultData[2], type: "active" }, date2);
6692
+ break;
6799
6693
  }
6800
6694
  }
6801
- return current.current;
6695
+ };
6696
+ const getMonthsPanel = () => {
6697
+ return monthsPanel.current;
6698
+ };
6699
+ const getMonthsRef = () => {
6700
+ return monthsRef.current;
6802
6701
  };
6803
6702
  const requestAniFrameFunc = (current, monthNum) => {
6804
6703
  const lastItem = monthsData[monthsData.length - 1];
@@ -6807,19 +6706,31 @@
6807
6706
  if (monthsRef && monthsPanel && viewAreaRef) {
6808
6707
  viewHeight = getMonthsRef().clientHeight;
6809
6708
  getMonthsPanel().style.height = `${containerHeight}px`;
6810
- getMonthsRef().scrollTop = monthsData[current].scrollTop;
6811
- setScrollTop(monthsData[current].scrollTop);
6709
+ const currTop = monthsData[current].scrollTop;
6710
+ getMonthsRef().scrollTop = currTop;
6711
+ setScrollTop(currTop);
6812
6712
  Taro.nextTick(() => setScrollWithAnimation(true));
6813
6713
  }
6814
6714
  });
6815
6715
  setAvgHeight(Math.floor(containerHeight / (monthNum + 1)));
6816
6716
  };
6717
+ const getMonthNum = () => {
6718
+ let monthNum = Number(endDates[1]) - Number(startDates[1]);
6719
+ const yearNum = Number(endDates[0]) - Number(startDates[0]);
6720
+ if (yearNum > 0) monthNum += 12 * yearNum;
6721
+ if (monthNum <= 0) monthNum = 1;
6722
+ setMonthsNum(monthNum);
6723
+ return monthNum;
6724
+ };
6817
6725
  const initData = () => {
6818
6726
  const monthNum = getMonthNum();
6819
6727
  getMonthData(startDates, monthNum);
6820
- const current = renderCurrentDate();
6821
- setDefaultRange(monthNum, current);
6822
- requestAniFrameFunc(current, monthNum);
6728
+ const defaultData = setDefaultDate();
6729
+ const current = getCurrentIndex(defaultData);
6730
+ const currentIndex = current.current;
6731
+ renderCurrentDate(defaultData, current);
6732
+ setDefaultRange(monthNum, currentIndex);
6733
+ requestAniFrameFunc(currentIndex, monthNum);
6823
6734
  };
6824
6735
  React.useEffect(() => {
6825
6736
  initData();
@@ -6836,9 +6747,9 @@
6836
6747
  popup && resetRender();
6837
6748
  }, [currentDate]);
6838
6749
  const scrollToDate = (date2) => {
6839
- if (Utils.compareDate(date2, propStartDate)) {
6750
+ if (compareDate(date2, propStartDate)) {
6840
6751
  date2 = propStartDate;
6841
- } else if (!Utils.compareDate(date2, propEndDate)) {
6752
+ } else if (!compareDate(date2, propEndDate)) {
6842
6753
  date2 = propEndDate;
6843
6754
  }
6844
6755
  const dateArr = splitDate(date2);
@@ -6859,22 +6770,20 @@
6859
6770
  clearInterval(interval);
6860
6771
  if (monthsRef.current) {
6861
6772
  monthsRef.current.scrollTop = currTop;
6862
- setScrollTop(monthsRef.current.scrollTop);
6773
+ setScrollTop(currTop);
6863
6774
  }
6864
6775
  }
6865
6776
  }, 40);
6866
6777
  } else {
6867
6778
  monthsRef.current.scrollTop = currTop;
6868
- setScrollTop(monthsRef.current.scrollTop);
6779
+ setScrollTop(currTop);
6869
6780
  }
6870
6781
  }
6871
6782
  }
6872
6783
  });
6873
6784
  };
6874
6785
  const monthsViewScroll = (e2) => {
6875
- if (monthsData.length <= 1) {
6876
- return;
6877
- }
6786
+ if (monthsData.length <= 1) return;
6878
6787
  const scrollTop2 = e2.target.scrollTop;
6879
6788
  Taro.getEnv() === "WEB" && setScrollTop(scrollTop2);
6880
6789
  let current = Math.floor(scrollTop2 / avgHeight);
@@ -6883,16 +6792,10 @@
6883
6792
  const nextTop = monthsData[current + 1].scrollTop;
6884
6793
  const nextHeight = monthsData[current + 1].cssHeight;
6885
6794
  if (current === 0) {
6886
- if (scrollTop2 >= nextTop) {
6887
- current += 1;
6888
- }
6795
+ if (scrollTop2 >= nextTop) current += 1;
6889
6796
  } else if (current > 0 && current < monthsNum - 1) {
6890
- if (scrollTop2 >= nextTop) {
6891
- current += 1;
6892
- }
6893
- if (scrollTop2 < monthsData[current].scrollTop) {
6894
- current -= 1;
6895
- }
6797
+ if (scrollTop2 >= nextTop) current += 1;
6798
+ if (scrollTop2 < monthsData[current].scrollTop) current -= 1;
6896
6799
  } else {
6897
6800
  const viewPosition = Math.round(scrollTop2 + viewHeight);
6898
6801
  if (current + 1 <= monthsNum && viewPosition >= nextTop + nextHeight) {
@@ -6907,90 +6810,96 @@
6907
6810
  React.useImperativeHandle(ref, () => ({
6908
6811
  scrollToDate
6909
6812
  }));
6813
+ const isDisable = (day, month) => {
6814
+ if (day.type !== "active") return true;
6815
+ const dateStr = getCurrDate(day, month);
6816
+ if (compareDate(dateStr, propStartDate)) return true;
6817
+ if (compareDate(propEndDate, dateStr)) return true;
6818
+ return false;
6819
+ };
6910
6820
  const getClasses = (day, month) => {
6911
6821
  const dateStr = getCurrDate(day, month);
6912
- if (day.type === "active") {
6913
- if (propStartDate && Utils.compareDate(dateStr, propStartDate) || propEndDate && Utils.compareDate(propEndDate, dateStr)) {
6914
- return `${dayPrefix}-disabled`;
6915
- }
6916
- if (type2 === "range" || type2 === "week") {
6917
- if (isStart(dateStr, currentDate) || isEnd(dateStr, currentDate)) {
6918
- return `${dayPrefix}-active ${isStart(dateStr, currentDate) ? "active-start" : ""} ${isEnd(dateStr, currentDate) ? "active-end" : ""}`;
6919
- }
6920
- if (Array.isArray(currentDate) && Object.values(currentDate).length === 2 && Utils.compareDate(currentDate[0], dateStr) && Utils.compareDate(dateStr, currentDate[1])) {
6921
- if (disableDate(day)) {
6922
- return `${dayPrefix}-choose-disabled`;
6923
- }
6924
- return `${dayPrefix}-choose`;
6925
- }
6926
- } else if (type2 === "multiple" && isMultiple(dateStr, currentDate) || !Array.isArray(currentDate) && Utils.isEqual(currentDate, dateStr)) {
6927
- return `${dayPrefix}-active`;
6822
+ if (isDisable(day, month)) return `${dayPrefix}-disabled`;
6823
+ const activeCls = `${dayPrefix}-active`;
6824
+ if (type2 === "range" || type2 === "week") {
6825
+ if (isStart(dateStr, currentDate))
6826
+ return `${activeCls} active-start`;
6827
+ if (isEnd(dateStr, currentDate)) {
6828
+ return `${activeCls} active-end`;
6928
6829
  }
6929
- if (disableDate(day)) {
6930
- return `${dayPrefix}-disabled`;
6830
+ if (currentDate.length === 2 && compareDate(currentDate[0], dateStr) && compareDate(dateStr, currentDate[1])) {
6831
+ return disableDate(day) ? `${dayPrefix}-choose-disabled` : `${dayPrefix}-choose`;
6931
6832
  }
6932
- return null;
6833
+ } else if (type2 === "multiple" && isMultiple(dateStr, currentDate) || !Array.isArray(currentDate) && isEqual(currentDate, dateStr)) {
6834
+ return activeCls;
6933
6835
  }
6934
- return `${dayPrefix}-disabled`;
6836
+ if (disableDate(day)) return `${dayPrefix}-disabled`;
6837
+ return null;
6935
6838
  };
6936
- const chooseDay = (day, month, isFirst) => {
6937
- if (getClasses(day, month) === `${dayPrefix}-disabled`) {
6938
- return;
6939
- }
6839
+ const handleDayClick = (day, month, isFirst = true) => {
6840
+ if (isDisable(day, month) || disableDate(day)) return;
6940
6841
  const days = [...month.curData];
6941
6842
  const [y2, m2] = month.curData;
6942
- days[2] = typeof day.day === "number" ? Utils.getNumTwoBit(day.day) : day.day;
6843
+ days[2] = typeof day.day === "number" ? getNumTwoBit(day.day) : day.day;
6943
6844
  days[3] = `${days[0]}/${days[1]}/${days[2]}`;
6944
- days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
6945
- if (type2 === "multiple") {
6946
- if (currentDate.length > 0) {
6947
- let hasIndex = "";
6948
- currentDate.forEach((item, index) => {
6949
- if (item === days[3]) {
6950
- hasIndex = index;
6845
+ days[4] = getWhatDay(+days[0], +days[1], +days[2]);
6846
+ const newDate = days[3];
6847
+ switch (type2) {
6848
+ case "multiple": {
6849
+ if (Array.isArray(currentDate)) {
6850
+ if (currentDate.length > 0) {
6851
+ const hasIndex = currentDate.findIndex((item) => item === newDate);
6852
+ if (isFirst) {
6853
+ state.currDateArray.push([...days]);
6854
+ } else if (hasIndex > -1) {
6855
+ currentDate.splice(hasIndex, 1);
6856
+ state.currDateArray.splice(hasIndex, 1);
6857
+ } else {
6858
+ currentDate.push(newDate);
6859
+ state.currDateArray.push([...days]);
6860
+ }
6861
+ } else {
6862
+ currentDate.push(newDate);
6863
+ state.currDateArray = [[...days]];
6951
6864
  }
6952
- });
6953
- if (isFirst) {
6954
- state.currDateArray.push([...days]);
6955
- } else if (hasIndex !== "") {
6956
- currentDate.splice(hasIndex, 1);
6957
- state.currDateArray.splice(hasIndex, 1);
6958
- } else {
6959
- currentDate.push(days[3]);
6960
- state.currDateArray.push([...days]);
6961
6865
  }
6962
- } else {
6963
- currentDate.push(days[3]);
6964
- state.currDateArray = [[...days]];
6965
- }
6966
- } else if (type2 === "range") {
6967
- const curDataLength = Object.values(currentDate).length;
6968
- if (curDataLength === 2 || curDataLength === 0) {
6969
- Array.isArray(currentDate) && currentDate.splice(0) && currentDate.push(days[3]);
6970
- state.currDateArray = [[...days]];
6971
- } else if (Utils.compareDate(currentDate[0], days[3])) {
6972
- Array.isArray(currentDate) && currentDate.push(days[3]);
6973
- state.currDateArray = [...state.currDateArray, [...days]];
6974
- } else {
6975
- Array.isArray(currentDate) && currentDate.unshift(days[3]);
6976
- state.currDateArray = [[...days], ...state.currDateArray];
6866
+ break;
6867
+ }
6868
+ case "range": {
6869
+ if (Array.isArray(currentDate)) {
6870
+ if (currentDate.length === 2 || currentDate.length === 0) {
6871
+ currentDate.splice(0, currentDate.length, newDate);
6872
+ state.currDateArray = [[...days]];
6873
+ } else if (compareDate(currentDate[0], newDate)) {
6874
+ currentDate.push(newDate);
6875
+ state.currDateArray = [...state.currDateArray, [...days]];
6876
+ } else {
6877
+ currentDate.unshift(newDate);
6878
+ state.currDateArray = [[...days], ...state.currDateArray];
6879
+ }
6880
+ }
6881
+ break;
6977
6882
  }
6978
- } else if (type2 === "week") {
6979
- const weekArr = Utils.getWeekDate(y2, m2, `${day.day}`, firstDayOfWeek);
6980
- if (propStartDate && Utils.compareDate(weekArr[0], propStartDate)) {
6981
- weekArr.splice(0, 1, propStartDate);
6883
+ case "week": {
6884
+ const weekArr = getWeekDate(y2, m2, `${day.day}`, firstDayOfWeek);
6885
+ if (compareDate(weekArr[0], propStartDate)) {
6886
+ weekArr[0] = propStartDate;
6887
+ }
6888
+ if (compareDate(propEndDate, weekArr[1])) {
6889
+ weekArr[1] = propEndDate;
6890
+ }
6891
+ currentDate.splice(0, currentDate.length, ...weekArr);
6892
+ state.currDateArray = [
6893
+ formatResultDate(weekArr[0]),
6894
+ formatResultDate(weekArr[1])
6895
+ ];
6896
+ break;
6982
6897
  }
6983
- if (propEndDate && Utils.compareDate(propEndDate, weekArr[1])) {
6984
- weekArr.splice(1, 1, propEndDate);
6898
+ default: {
6899
+ setCurrentDate(newDate);
6900
+ state.currDateArray = [...days];
6901
+ break;
6985
6902
  }
6986
- Array.isArray(currentDate) && currentDate.splice(0) && currentDate.push(...weekArr);
6987
- state.currDateArray = [
6988
- Utils.formatResultDate(weekArr[0]),
6989
- Utils.formatResultDate(weekArr[1])
6990
- ];
6991
- } else {
6992
- setCurrentDate(days[3]);
6993
- state.currDateArray = [...days];
6994
6903
  }
6995
6904
  if (!isFirst) {
6996
6905
  onDayClick && onDayClick(state.currDateArray);
@@ -7010,11 +6919,11 @@
7010
6919
  }
7011
6920
  };
7012
6921
  const classes = classNames(
6922
+ classPrefix2,
7013
6923
  {
7014
6924
  [`${classPrefix2}-title`]: !popup,
7015
6925
  [`${classPrefix2}-nofooter`]: !!autoBackfill
7016
6926
  },
7017
- classPrefix2,
7018
6927
  className
7019
6928
  );
7020
6929
  const headerClasses = classNames({
@@ -7030,6 +6939,40 @@
7030
6939
  const renderHeader = () => {
7031
6940
  return /* @__PURE__ */ React.createElement("div", { className: headerClasses }, showTitle && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-title` }, title || locale.calendaritem.title), renderHeaderButtons && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-header-buttons` }, renderHeaderButtons()), showSubTitle && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-sub-title` }, yearMonthTitle), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-weeks`, ref: weeksPanel }, weeks.map((item) => /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-week-item`, key: item }, item))));
7032
6941
  };
6942
+ const renderItem = (month, day, index) => {
6943
+ const startTip = isStartTip(day, month);
6944
+ const endTip = isEndTip(day, month);
6945
+ const noStartNorEnd = !startTip && !endTip;
6946
+ return /* @__PURE__ */ React.createElement(
6947
+ "div",
6948
+ {
6949
+ className: classNames("nut-calendar-day", getClasses(day, month)),
6950
+ onClick: () => handleDayClick(day, month, false),
6951
+ key: index
6952
+ },
6953
+ /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-day` }, renderDay ? renderDay(day) : day.day),
6954
+ !startTip && renderDayTop && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-top` }, renderDayTop(day)),
6955
+ noStartNorEnd && renderDayBottom && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-bottom` }, renderDayBottom(day)),
6956
+ noStartNorEnd && isCurrDay(month, day.day) && !renderDayBottom && showToday && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-curr` }, locale.calendaritem.today),
6957
+ startTip && /* @__PURE__ */ React.createElement(
6958
+ "div",
6959
+ {
6960
+ className: classNames("nut-calendar-day-info", {
6961
+ "nut-calendar-day-info-top": isStartAndEnd(
6962
+ currentDate
6963
+ )
6964
+ })
6965
+ },
6966
+ startText || locale.calendaritem.start
6967
+ ),
6968
+ endTip && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info` }, endText || locale.calendaritem.end)
6969
+ );
6970
+ };
6971
+ const renderPanel = (month, key) => {
6972
+ return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-month`, key }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-month-title` }, month.title), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-days` }, month.monthData.map(
6973
+ (day, i2) => renderItem(month, day, i2)
6974
+ )));
6975
+ };
7033
6976
  const renderContent = () => {
7034
6977
  return /* @__PURE__ */ React.createElement(
7035
6978
  components.ScrollView,
@@ -7050,31 +6993,7 @@
7050
6993
  style: { transform: `translateY(${translateY}px)` }
7051
6994
  },
7052
6995
  monthsData.slice(monthDefaultRange[0], monthDefaultRange[1]).map((month, key) => {
7053
- return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-month`, key }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-month-title` }, month.title), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-days` }, month.monthData.map((day, i2) => /* @__PURE__ */ React.createElement(
7054
- "div",
7055
- {
7056
- className: [
7057
- `${classPrefix2}-day`,
7058
- getClasses(day, month)
7059
- ].join(" "),
7060
- onClick: () => {
7061
- chooseDay(day, month);
7062
- },
7063
- key: i2
7064
- },
7065
- /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-day` }, renderDay ? renderDay(day) : day.day),
7066
- !isStartTip(day, month) && renderDayTop && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-top` }, renderDayTop(day)),
7067
- !isStartTip(day, month) && !isEndTip(day, month) && renderDayBottom && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-bottom` }, renderDayBottom(day)),
7068
- !isStartTip(day, month) && !isEndTip(day, month) && !renderDayBottom && showToday && isCurrDay(month, day.day) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-curr` }, locale.calendaritem.today),
7069
- isStartTip(day, month) && /* @__PURE__ */ React.createElement(
7070
- "div",
7071
- {
7072
- className: `${classPrefix2}-day-info ${isStartAndEnd(currentDate) ? `${classPrefix2}-day-info-top` : ""}`
7073
- },
7074
- startText || locale.calendaritem.start
7075
- ),
7076
- isEndTip(day, month) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info` }, endText || locale.calendaritem.end)
7077
- ))));
6996
+ return renderPanel(month, key);
7078
6997
  })
7079
6998
  ))
7080
6999
  );
@@ -7093,8 +7012,8 @@
7093
7012
  visible: false,
7094
7013
  title: "",
7095
7014
  defaultValue: "",
7096
- startDate: Utils.getDay(0),
7097
- endDate: Utils.getDay(365),
7015
+ startDate: getDateString(0),
7016
+ endDate: getDateString(365),
7098
7017
  showToday: true,
7099
7018
  startText: "",
7100
7019
  endText: "",
@@ -7262,12 +7181,12 @@
7262
7181
  prevMonth = 12;
7263
7182
  prevYear -= 1;
7264
7183
  }
7265
- let days = Utils.getMonthPreDay(year, month);
7184
+ let days = getMonthPreDay(year, month);
7266
7185
  days -= firstDayOfWeek;
7267
7186
  if (days >= 7) {
7268
7187
  days -= 7;
7269
7188
  }
7270
- const preDates = Utils.getMonthDays(`${prevYear}`, `${prevMonth}`);
7189
+ const preDates = getMonthDays(`${prevYear}`, `${prevMonth}`);
7271
7190
  const months = Array.from(Array(preDates), (_, k) => {
7272
7191
  return {
7273
7192
  type: "prev",
@@ -7279,7 +7198,7 @@
7279
7198
  return months.slice(preDates - days);
7280
7199
  };
7281
7200
  const getCurrentMonthDays = (year, month) => {
7282
- const days = Utils.getMonthDays(`${year}`, `${month}`);
7201
+ const days = getMonthDays(`${year}`, `${month}`);
7283
7202
  return Array.from(Array(days), (_, k) => {
7284
7203
  return {
7285
7204
  type: "current",
@@ -8642,9 +8561,9 @@
8642
8561
  };
8643
8562
  const compareDateChange = (currentDate, newDate, selectedOptions, index) => {
8644
8563
  var _a;
8645
- const isEqual = ((_a = new Date(currentDate)) == null ? void 0 : _a.getTime()) === (newDate == null ? void 0 : newDate.getTime());
8564
+ const isEqual2 = ((_a = new Date(currentDate)) == null ? void 0 : _a.getTime()) === (newDate == null ? void 0 : newDate.getTime());
8646
8565
  if (newDate && isDate(newDate)) {
8647
- if (!isEqual) {
8566
+ if (!isEqual2) {
8648
8567
  setSelectedDate(formatValue(newDate));
8649
8568
  }
8650
8569
  onChange == null ? void 0 : onChange(
@@ -10969,7 +10888,7 @@
10969
10888
  React.useEffect(() => {
10970
10889
  getParentOffset();
10971
10890
  }, [showPopup, getParentOffset]);
10972
- const windowHeight = React.useMemo(() => Taro.getSystemInfoSync().windowHeight, []);
10891
+ const windowHeight = React.useMemo(() => getWindowInfo().windowHeight, []);
10973
10892
  const updateItemOffset = React.useCallback(() => {
10974
10893
  if (!parent.lockScroll) return;
10975
10894
  const p = parent.menuRef.current;
@@ -11019,7 +10938,7 @@
11019
10938
  bottom: "0",
11020
10939
  height: "initial"
11021
10940
  } : {
11022
- bottom: `${Taro.getSystemInfoSync().windowHeight - position.top}px`,
10941
+ bottom: `${getWindowInfo().windowHeight - position.top}px`,
11023
10942
  top: "0",
11024
10943
  height: "initial"
11025
10944
  };
@@ -11032,7 +10951,7 @@
11032
10951
  };
11033
10952
  }
11034
10953
  return {
11035
- height: `${Taro.getSystemInfoSync().windowHeight - position.top}px`,
10954
+ height: `${getWindowInfo().windowHeight - position.top}px`,
11036
10955
  top: "auto",
11037
10956
  ...isShow()
11038
10957
  };
@@ -13897,7 +13816,7 @@
13897
13816
  const el = myDrag.current;
13898
13817
  if (el) {
13899
13818
  const { top, left: left2, bottom, right: right2 } = boundary;
13900
- const { screenWidth, windowHeight } = Taro.getSystemInfoSync();
13819
+ const { screenWidth, windowHeight } = getWindowInfo();
13901
13820
  const {
13902
13821
  width,
13903
13822
  height,
@@ -15174,7 +15093,7 @@
15174
15093
  setStatus("pulling");
15175
15094
  }
15176
15095
  };
15177
- const isAndroidWeApp = Taro.getSystemInfoSync().platform === "android" && Taro.getEnv() === "WEAPP";
15096
+ const isAndroidWeApp = getDeviceInfo().platform === "android" && Taro.getEnv() === "WEAPP";
15178
15097
  const springStyles = {
15179
15098
  height: `${height}px`,
15180
15099
  ...!pullingRef.current || isAndroidWeApp ? { transition: "height .3s ease" } : {}
@@ -15762,29 +15681,29 @@
15762
15681
  onClick: (event) => {
15763
15682
  }
15764
15683
  };
15765
- const classPrefix$8 = `nut-animate`;
15684
+ const classPrefix$8 = "nut-animate";
15766
15685
  const Animate = (props) => {
15767
- const { className, type: type2, action, loop, onClick, children, ...rest } = {
15686
+ const { className, type: type2, action, loop, onClick, children, style } = {
15768
15687
  ...defaultProps$r,
15769
15688
  ...props
15770
15689
  };
15771
15690
  const [clicked, setClicked] = React.useState(false);
15772
- const classes = classNames({
15773
- "nut-ani-container": true,
15774
- [`${classPrefix$8}-${type2}`]: action === "initial" || clicked ? type2 : false,
15775
- loop
15776
- });
15777
- const cls = classNames(classes, className);
15691
+ const classes = classNames(
15692
+ {
15693
+ "nut-ani-container": true,
15694
+ [`${classPrefix$8}-${type2}`]: action === "initial" || clicked,
15695
+ loop
15696
+ },
15697
+ className
15698
+ );
15778
15699
  const handleClick = (event) => {
15779
15700
  setClicked(true);
15780
15701
  if (!loop) {
15781
- setTimeout(() => {
15782
- setClicked(false);
15783
- }, 1e3);
15702
+ setTimeout(() => setClicked(false), 1e3);
15784
15703
  }
15785
- onClick && onClick(event);
15704
+ onClick(event);
15786
15705
  };
15787
- return /* @__PURE__ */ React.createElement("div", { className: "nut-animate" }, /* @__PURE__ */ React.createElement("div", { className: cls, onClick: handleClick, ...rest }, children));
15706
+ return /* @__PURE__ */ React.createElement(components.View, { className: "nut-animate" }, /* @__PURE__ */ React.createElement(components.View, { className: classes, onClick: handleClick, style }, children));
15788
15707
  };
15789
15708
  Animate.displayName = "NutAnimate";
15790
15709
  const defaultProps$q = {
@@ -18378,7 +18297,7 @@
18378
18297
  ...props
18379
18298
  };
18380
18299
  const clientHeight = React.useMemo(
18381
- () => Taro.getSystemInfoSync().windowHeight - 5 || 667,
18300
+ () => getWindowInfo().windowHeight - 5 || 667,
18382
18301
  []
18383
18302
  );
18384
18303
  const containerHeight = React.useMemo(
@@ -19152,7 +19071,7 @@
19152
19071
  const [visible, setVisible] = React.useState(false);
19153
19072
  const [moving, setMoving] = React.useState(false);
19154
19073
  const [zooming, setZooming] = React.useState(false);
19155
- const systemInfo = Taro.getSystemInfoSync();
19074
+ const systemInfo = getWindowInfo();
19156
19075
  const showAlipayCanvas2D = React.useMemo(() => {
19157
19076
  return Taro.getEnv() === "ALIPAY" && parseInt(Taro.SDKVersion.replace(/\./g, "")) >= 270;
19158
19077
  }, []);