@nutui/nutui-react-taro 2.7.7 → 2.7.8

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.7.7 Fri Jan 24 2025 13:57:13 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.7.8 Fri Feb 14 2025 16:17:59 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1349,7 +1349,7 @@ lodash_isequal.exports;
1349
1349
  return value != null && isLength(value.length) && !isFunction2(value);
1350
1350
  }
1351
1351
  var isBuffer = nativeIsBuffer || stubFalse;
1352
- function isEqual(value, other) {
1352
+ function isEqual2(value, other) {
1353
1353
  return baseIsEqual(value, other);
1354
1354
  }
1355
1355
  function isFunction2(value) {
@@ -1379,7 +1379,7 @@ lodash_isequal.exports;
1379
1379
  function stubFalse() {
1380
1380
  return false;
1381
1381
  }
1382
- module.exports = isEqual;
1382
+ module.exports = isEqual2;
1383
1383
  })(lodash_isequal, lodash_isequal.exports);
1384
1384
  var lodash_isequalExports = lodash_isequal.exports;
1385
1385
  const isequal = /* @__PURE__ */ getDefaultExportFromCjs(lodash_isequalExports);
@@ -6212,189 +6212,106 @@ const InternalAddress = (props, ref) => {
6212
6212
  };
6213
6213
  const Address = forwardRef(InternalAddress);
6214
6214
  Address.displayName = "NutAddress";
6215
- const Utils = {
6216
- /**
6217
- * 是否为闫年
6218
- * @return {Boolse} true|false
6219
- */
6220
- isLeapYear(y2) {
6221
- return y2 % 4 === 0 && y2 % 100 !== 0 || y2 % 400 === 0;
6222
- },
6223
- /**
6224
- * 返回星期数
6225
- * @return {String}
6226
- */
6227
- getWhatDay(year, month, day) {
6228
- const date4 = /* @__PURE__ */ new Date(`${year}/${month}/${day}`);
6229
- const index = date4.getDay();
6230
- const dayNames = [
6231
- "星期日",
6232
- "星期一",
6233
- "星期二",
6234
- "星期三",
6235
- "星期四",
6236
- "星期五",
6237
- "星期六"
6238
- ];
6239
- return dayNames[index];
6240
- },
6241
- /**
6242
- * 返回上一个月在当前面板中的天数
6243
- * @return {Number}
6244
- */
6245
- getMonthPreDay(year, month) {
6246
- const date4 = /* @__PURE__ */ new Date(`${year}/${month}/01`);
6247
- let day = date4.getDay();
6248
- if (day === 0) {
6249
- day = 7;
6250
- }
6251
- return day;
6252
- },
6253
- /**
6254
- * 返回月份天数
6255
- * @return {Number}
6256
- */
6257
- getMonthDays(year, month) {
6258
- if (/^0/.test(month)) {
6259
- month = month.split("")[1];
6260
- }
6261
- return [
6262
- 0,
6263
- 31,
6264
- this.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
- /**
6278
- * 补齐数字位数
6279
- * @return {string}
6280
- */
6281
- getNumTwoBit(n2) {
6282
- n2 = Number(n2);
6283
- return (n2 > 9 ? "" : "0") + n2;
6284
- },
6285
- /**
6286
- * 日期对象转成字符串
6287
- * @return {string}
6288
- */
6289
- date2Str(date4, split) {
6290
- split = split || "-";
6291
- const y2 = date4.getFullYear();
6292
- const m2 = this.getNumTwoBit(date4.getMonth() + 1);
6293
- const d = this.getNumTwoBit(date4.getDate());
6294
- return [y2, m2, d].join(split);
6295
- },
6296
- /**
6297
- * 返回日期格式字符串
6298
- * @param {Number} 0返回今天的日期、1返回明天的日期,2返回后天得日期,依次类推
6299
- * @return {string} '2014-12-31'
6300
- */
6301
- getDay(i2) {
6302
- i2 = i2 || 0;
6303
- let date4 = /* @__PURE__ */ new Date();
6304
- const diff = i2 * (1e3 * 60 * 60 * 24);
6305
- date4 = new Date(date4.getTime() + diff);
6306
- return this.date2Str(date4);
6307
- },
6308
- /**
6309
- * 时间比较
6310
- * @return {Boolean}
6311
- */
6312
- compareDate(date1, date22) {
6313
- const startTime = new Date(date1.replace("-", "/").replace("-", "/"));
6314
- const endTime = new Date(date22.replace("-", "/").replace("-", "/"));
6315
- if (startTime >= endTime) {
6316
- return false;
6317
- }
6318
- return true;
6319
- },
6320
- /**
6321
- * 时间是否相等
6322
- * @return {Boolean}
6323
- */
6324
- isEqual(date1, date22) {
6325
- const startTime = new Date((date1 || "").replace(/-/g, "/")).getTime();
6326
- const endTime = new Date(date22.replace(/-/g, "/")).getTime();
6327
- if (startTime === endTime) {
6328
- return true;
6329
- }
6330
- return false;
6331
- },
6332
- getMonthWeek(year, month, date4, firstDayOfWeek = 0) {
6333
- const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date4));
6334
- let w = dateNow.getDay();
6335
- const d = dateNow.getDate();
6336
- let remainder = 6 - w;
6337
- if (firstDayOfWeek !== 0) {
6338
- w = w === 0 ? 7 : w;
6339
- remainder = 7 - w;
6340
- }
6341
- return Math.ceil((d + remainder) / 7);
6342
- },
6343
- getYearWeek(year, month, date4, firstDayOfWeek = 0) {
6344
- const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date4));
6345
- const dateFirst = new Date(Number(year), 0, 1);
6346
- const dataNumber = Math.round(
6347
- (dateNow.valueOf() - dateFirst.valueOf()) / 864e5
6348
- );
6349
- return Math.ceil((dataNumber + (dateFirst.getDay() + 1 - 1)) / 7);
6350
- },
6351
- getWeekDate(year, month, date4, firstDayOfWeek = 0) {
6352
- const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date4));
6353
- const nowTime = dateNow.getTime();
6354
- let day = dateNow.getDay();
6355
- if (firstDayOfWeek === 0) {
6356
- const oneDayTime2 = 24 * 60 * 60 * 1e3;
6357
- const SundayTime2 = nowTime - day * oneDayTime2;
6358
- const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
6359
- const sunday2 = this.date2Str(new Date(SundayTime2));
6360
- const saturday = this.date2Str(new Date(SaturdayTime));
6361
- return [sunday2, saturday];
6362
- }
6363
- day = day === 0 ? 7 : day;
6364
- const oneDayTime = 24 * 60 * 60 * 1e3;
6365
- const MondayTime = nowTime - (day - 1) * oneDayTime;
6366
- const SundayTime = nowTime + (7 - day) * oneDayTime;
6367
- const monday = this.date2Str(new Date(MondayTime));
6368
- const sunday = this.date2Str(new Date(SundayTime));
6369
- return [monday, sunday];
6370
- },
6371
- formatResultDate(date4) {
6372
- const days = [...date4.split("-")];
6373
- days[2] = Utils.getNumTwoBit(Number(days[2]));
6374
- days[3] = `${days[0]}-${days[1]}-${days[2]}`;
6375
- days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
6376
- return days;
6215
+ const isLeapYear = (y2) => {
6216
+ return y2 % 4 === 0 && y2 % 100 !== 0 || y2 % 400 === 0;
6217
+ };
6218
+ const getWhatDay = (year, month, day) => {
6219
+ const date4 = new Date(year, month - 1, day);
6220
+ const dayNames = [
6221
+ "星期日",
6222
+ "星期一",
6223
+ "星期二",
6224
+ "星期三",
6225
+ "星期四",
6226
+ "星期五",
6227
+ "星期六"
6228
+ ];
6229
+ return dayNames[date4.getDay()];
6230
+ };
6231
+ const getMonthPreDay = (year, month) => {
6232
+ const day = new Date(year, month - 1, 1).getDay();
6233
+ return day === 0 ? 7 : day;
6234
+ };
6235
+ const getMonthDays = (year, month) => {
6236
+ if (/^0/.test(month)) {
6237
+ month = month.split("")[1];
6377
6238
  }
6239
+ return [
6240
+ 0,
6241
+ 31,
6242
+ isLeapYear(Number(year)) ? 29 : 28,
6243
+ 31,
6244
+ 30,
6245
+ 31,
6246
+ 30,
6247
+ 31,
6248
+ 31,
6249
+ 30,
6250
+ 31,
6251
+ 30,
6252
+ 31
6253
+ ][month];
6254
+ };
6255
+ const getNumTwoBit = (n2) => {
6256
+ return n2 > 9 ? `${n2}` : `0${n2}`;
6257
+ };
6258
+ const date2Str = (date4, split = "-") => {
6259
+ const y2 = date4.getFullYear();
6260
+ const m2 = getNumTwoBit(date4.getMonth() + 1);
6261
+ const d = getNumTwoBit(date4.getDate());
6262
+ return [y2, m2, d].join(split);
6263
+ };
6264
+ const getDateString = (offset = 0) => {
6265
+ const date4 = /* @__PURE__ */ new Date();
6266
+ date4.setDate(date4.getDate() + offset);
6267
+ return date2Str(date4, "-");
6268
+ };
6269
+ const compareDate = (date1, date22) => {
6270
+ const startTime = new Date(date1.replace("-", "/").replace("-", "/"));
6271
+ const endTime = new Date(date22.replace("-", "/").replace("-", "/"));
6272
+ return startTime < endTime;
6273
+ };
6274
+ const isEqual = (date1, date22) => {
6275
+ const startTime = new Date((date1 || "").replace(/-/g, "/")).getTime();
6276
+ const endTime = new Date(date22.replace(/-/g, "/")).getTime();
6277
+ return startTime === endTime;
6278
+ };
6279
+ const getWeekDate = (year, month, date4, firstDayOfWeek = 0) => {
6280
+ const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date4));
6281
+ const nowTime = dateNow.getTime();
6282
+ let day = dateNow.getDay();
6283
+ if (firstDayOfWeek === 0) {
6284
+ const oneDayTime2 = 24 * 60 * 60 * 1e3;
6285
+ const SundayTime2 = nowTime - day * oneDayTime2;
6286
+ const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
6287
+ const sunday2 = date2Str(new Date(SundayTime2));
6288
+ const saturday = date2Str(new Date(SaturdayTime));
6289
+ return [sunday2, saturday];
6290
+ }
6291
+ day = day === 0 ? 7 : day;
6292
+ const oneDayTime = 24 * 60 * 60 * 1e3;
6293
+ const MondayTime = nowTime - (day - 1) * oneDayTime;
6294
+ const SundayTime = nowTime + (7 - day) * oneDayTime;
6295
+ const monday = date2Str(new Date(MondayTime));
6296
+ const sunday = date2Str(new Date(SundayTime));
6297
+ return [monday, sunday];
6298
+ };
6299
+ const formatResultDate = (date4) => {
6300
+ const [year, month, day] = [...date4.split("-")];
6301
+ const formatterDay = getNumTwoBit(Number(day));
6302
+ const formatterDate = `${year}-${month}-${day}`;
6303
+ const dayOfWeek = getWhatDay(Number(year), Number(month), Number(day));
6304
+ return [year, month, formatterDay, formatterDate, dayOfWeek];
6378
6305
  };
6379
6306
  const getCurrMonthData = (type4, year, month) => {
6380
- switch (type4) {
6381
- case "prev":
6382
- month === 1 && (year -= 1);
6383
- month = month === 1 ? 12 : --month;
6384
- break;
6385
- case "next":
6386
- month === 12 && (year += 1);
6387
- month = month === 12 ? 1 : ++month;
6388
- break;
6307
+ {
6308
+ month === 12 && (year += 1);
6309
+ month = month === 12 ? 1 : ++month;
6389
6310
  }
6390
- return [
6391
- year,
6392
- Utils.getNumTwoBit(month),
6393
- Utils.getMonthDays(String(year), String(month))
6394
- ];
6311
+ return [year, getNumTwoBit(month), getMonthDays(String(year), String(month))];
6395
6312
  };
6396
6313
  const getDaysStatus = (type4, year, month) => {
6397
- let days = Utils.getMonthDays(`${year}`, `${month}`);
6314
+ let days = getMonthDays(`${year}`, `${month}`);
6398
6315
  return Array.from(Array(days), (v, k) => {
6399
6316
  return {
6400
6317
  day: k + 1,
@@ -6411,12 +6328,12 @@ const getPreMonthDates = (type4, year, month, firstDayOfWeek) => {
6411
6328
  preMonth = 12;
6412
6329
  preYear += 1;
6413
6330
  }
6414
- let days = Utils.getMonthPreDay(+year, +month);
6331
+ let days = getMonthPreDay(+year, +month);
6415
6332
  days -= firstDayOfWeek;
6416
6333
  if (days >= 7) {
6417
6334
  days -= 7;
6418
6335
  }
6419
- const preDates = Utils.getMonthDays(`${preYear}`, `${preMonth}`);
6336
+ const preDates = getMonthDays(`${preYear}`, `${preMonth}`);
6420
6337
  const months = Array.from(Array(preDates), (v, k) => {
6421
6338
  return {
6422
6339
  day: k + 1,
@@ -6434,28 +6351,26 @@ const splitDate = (date4) => {
6434
6351
  const isMultiple = (day, days) => {
6435
6352
  if (days.length > 0) {
6436
6353
  return days.some((item) => {
6437
- return Utils.isEqual(item, day);
6354
+ return isEqual(item, day);
6438
6355
  });
6439
6356
  }
6440
6357
  return false;
6441
6358
  };
6442
6359
  const isCurrDay = (month, day) => {
6443
6360
  const date4 = `${month.curData[0]}/${month.curData[1]}/${day}`;
6444
- return Utils.isEqual(date4, Utils.date2Str(/* @__PURE__ */ new Date(), "/"));
6361
+ return isEqual(date4, date2Str(/* @__PURE__ */ new Date(), "/"));
6445
6362
  };
6446
6363
  const getCurrDate = (day, month) => {
6447
- return `${month.curData[0]}/${month.curData[1]}/${Utils.getNumTwoBit(
6448
- +day.day
6449
- )}`;
6364
+ return `${month.curData[0]}/${month.curData[1]}/${getNumTwoBit(+day.day)}`;
6450
6365
  };
6451
6366
  const isStart = (day, days) => {
6452
- return Utils.isEqual(days[0], day);
6367
+ return isEqual(days[0], day);
6453
6368
  };
6454
6369
  const isEnd = (day, days) => {
6455
- return Utils.isEqual(days[1], day);
6370
+ return isEqual(days[1], day);
6456
6371
  };
6457
6372
  const isStartAndEnd = (days) => {
6458
- return days.length >= 2 && Utils.isEqual(days[0], days[1]);
6373
+ return days.length >= 2 && isEqual(days[0], days[1]);
6459
6374
  };
6460
6375
  const defaultProps$13 = {
6461
6376
  ...ComponentDefaults,
@@ -6463,8 +6378,8 @@ const defaultProps$13 = {
6463
6378
  autoBackfill: false,
6464
6379
  popup: true,
6465
6380
  title: "",
6466
- startDate: Utils.getDay(0),
6467
- endDate: Utils.getDay(365),
6381
+ startDate: getDateString(0),
6382
+ endDate: getDateString(365),
6468
6383
  showToday: true,
6469
6384
  startText: "",
6470
6385
  endText: "",
@@ -6497,6 +6412,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
6497
6412
  type: type4,
6498
6413
  autoBackfill,
6499
6414
  title,
6415
+ value,
6500
6416
  defaultValue,
6501
6417
  startDate,
6502
6418
  endDate,
@@ -6514,12 +6430,13 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
6514
6430
  renderDayTop,
6515
6431
  renderDayBottom,
6516
6432
  renderBottomButton,
6517
- value,
6518
6433
  onConfirm,
6519
6434
  onUpdate,
6520
6435
  onDayClick,
6521
6436
  onPageChange
6522
6437
  } = { ...defaultProps$13, ...props };
6438
+ const classPrefix2 = "nut-calendar";
6439
+ const dayPrefix = "nut-calendar-day";
6523
6440
  const weekdays = locale.calendaritem.weekdays;
6524
6441
  const weeks = [
6525
6442
  ...weekdays.slice(firstDayOfWeek, 7),
@@ -6533,19 +6450,13 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
6533
6450
  const [monthDefaultRange, setMonthDefaultRange] = useState([]);
6534
6451
  const [scrollTop, setScrollTop] = useState(0);
6535
6452
  const [scrollWithAnimation, setScrollWithAnimation] = useState(false);
6536
- const propStartDate = startDate || Utils.getDay(0);
6537
- const propEndDate = endDate || Utils.getDay(365);
6453
+ const propStartDate = startDate || getDateString(0);
6454
+ const propEndDate = endDate || getDateString(365);
6538
6455
  const startDates = splitDate(propStartDate);
6539
6456
  const endDates = splitDate(propEndDate);
6540
6457
  const [state] = useState({
6541
6458
  currDateArray: []
6542
6459
  });
6543
- const getMonthsPanel = () => {
6544
- return monthsPanel.current;
6545
- };
6546
- const getMonthsRef = () => {
6547
- return monthsRef.current;
6548
- };
6549
6460
  const resetDefaultValue = () => {
6550
6461
  if (defaultValue || Array.isArray(defaultValue) && defaultValue.length > 0) {
6551
6462
  return type4 !== "single" ? [...defaultValue] : defaultValue;
@@ -6565,9 +6476,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
6565
6476
  const viewAreaRef = useRef(null);
6566
6477
  const [avgHeight, setAvgHeight] = useState(0);
6567
6478
  let viewHeight = 0;
6568
- const classPrefix2 = "nut-calendar";
6569
- const dayPrefix = "nut-calendar-day";
6570
- const getMonthData = (curData, monthNum, type22) => {
6479
+ const getMonthData = (curData, monthNum) => {
6571
6480
  let i2 = 0;
6572
6481
  let date4 = curData;
6573
6482
  const monthData = monthsData;
@@ -6578,12 +6487,12 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
6578
6487
  ...getPreMonthDates("prev", y2, m2, firstDayOfWeek),
6579
6488
  ...getDaysStatus("active", y2, m2)
6580
6489
  ];
6581
- const cssHeight = 39 + (days.length > 35 ? 384 : 320);
6582
6490
  let scrollTop2 = 0;
6583
6491
  if (monthData.length > 0) {
6584
6492
  const monthEle = monthData[monthData.length - 1];
6585
6493
  scrollTop2 = monthEle.scrollTop + monthEle.cssHeight;
6586
6494
  }
6495
+ const cssHeight = 39 + (days.length > 35 ? 384 : 320);
6587
6496
  const monthInfo = {
6588
6497
  curData: date4,
6589
6498
  title: monthTitle(y2, m2),
@@ -6591,16 +6500,14 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
6591
6500
  cssHeight,
6592
6501
  scrollTop: scrollTop2
6593
6502
  };
6594
- {
6595
- if (!endDates || !Utils.compareDate(
6596
- `${endDates[0]}/${endDates[1]}/${Utils.getMonthDays(
6597
- endDates[0],
6598
- endDates[1]
6599
- )}`,
6600
- `${curData[0]}/${curData[1]}/${curData[2]}`
6601
- )) {
6602
- monthData.push(monthInfo);
6603
- }
6503
+ if (!endDates || !compareDate(
6504
+ `${endDates[0]}/${endDates[1]}/${getMonthDays(
6505
+ endDates[0],
6506
+ endDates[1]
6507
+ )}`,
6508
+ `${curData[0]}/${curData[1]}/${curData[2]}`
6509
+ )) {
6510
+ monthData.push(monthInfo);
6604
6511
  }
6605
6512
  date4 = getCurrMonthData("next", y2, m2);
6606
6513
  } while (i2++ < monthNum);
@@ -6608,8 +6515,8 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
6608
6515
  };
6609
6516
  const setReachedYearMonthInfo = (current) => {
6610
6517
  const currentMonthsData = monthsData[current];
6611
- const [year, month] = currentMonthsData.curData;
6612
6518
  if (currentMonthsData.title === yearMonthTitle) return;
6519
+ const [year, month] = currentMonthsData.curData;
6613
6520
  onPageChange && onPageChange([year, month, `${year}-${month}`]);
6614
6521
  setYearMonthTitle(currentMonthsData.title);
6615
6522
  };
@@ -6635,75 +6542,67 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
6635
6542
  setTranslateY(monthsData[start].scrollTop);
6636
6543
  setReachedYearMonthInfo(current);
6637
6544
  };
6638
- const getMonthNum = () => {
6639
- let monthNum = Number(endDates[1]) - Number(startDates[1]);
6640
- const yearNum = Number(endDates[0]) - Number(startDates[0]);
6641
- if (yearNum > 0) {
6642
- monthNum += 12 * yearNum;
6643
- }
6644
- if (monthNum <= 0) {
6645
- monthNum = 1;
6646
- }
6647
- setMonthsNum(monthNum);
6648
- return monthNum;
6649
- };
6650
6545
  const setDefaultDate = () => {
6651
6546
  let defaultData = [];
6652
- if (type4 === "range" && Array.isArray(currentDate)) {
6653
- if (currentDate.length > 0) {
6654
- if (propStartDate && Utils.compareDate(currentDate[0], propStartDate)) {
6655
- currentDate.splice(0, 1, propStartDate);
6656
- }
6657
- if (propEndDate && Utils.compareDate(propEndDate, currentDate[1])) {
6658
- currentDate.splice(1, 1, propEndDate);
6659
- }
6660
- defaultData = [
6661
- ...splitDate(currentDate[0]),
6662
- ...splitDate(currentDate[1])
6663
- ];
6547
+ if (type4 === "single" && typeof currentDate === "string") {
6548
+ if (!currentDate.length) {
6549
+ return defaultData;
6550
+ }
6551
+ if (compareDate(currentDate, propStartDate)) {
6552
+ defaultData = [...splitDate(propStartDate)];
6553
+ } else if (!compareDate(currentDate, propEndDate)) {
6554
+ defaultData = [...splitDate(propEndDate)];
6555
+ } else {
6556
+ defaultData = [...splitDate(currentDate)];
6664
6557
  }
6665
- } else if (type4 === "multiple" && Array.isArray(currentDate)) {
6666
- if (currentDate.length > 0) {
6667
- const defaultArr = [];
6668
- const obj = {};
6669
- currentDate.forEach((item) => {
6670
- if (propStartDate && !Utils.compareDate(item, propStartDate) && propEndDate && !Utils.compareDate(propEndDate, item)) {
6671
- if (!Object.hasOwnProperty.call(obj, item)) {
6672
- defaultArr.push(item);
6673
- obj[item] = item;
6674
- }
6558
+ return defaultData;
6559
+ }
6560
+ if (Array.isArray(currentDate) && currentDate.length) {
6561
+ switch (type4) {
6562
+ case "range": {
6563
+ if (compareDate(currentDate[0], propStartDate)) {
6564
+ currentDate[0] = propStartDate;
6675
6565
  }
6676
- });
6677
- currentDate.splice(0) && currentDate.push(...defaultArr);
6678
- defaultData = [...splitDate(defaultArr[0])];
6679
- }
6680
- } else if (type4 === "week" && Array.isArray(currentDate)) {
6681
- if (currentDate.length > 0) {
6682
- const [y2, m2, d] = splitDate(currentDate[0]);
6683
- const weekArr = Utils.getWeekDate(y2, m2, d, firstDayOfWeek);
6684
- currentDate.splice(0) && currentDate.push(...weekArr);
6685
- if (propStartDate && Utils.compareDate(currentDate[0], propStartDate)) {
6686
- currentDate.splice(0, 1, propStartDate);
6566
+ if (compareDate(propEndDate, currentDate[1])) {
6567
+ currentDate[1] = propEndDate;
6568
+ }
6569
+ defaultData = [
6570
+ ...splitDate(currentDate[0]),
6571
+ ...splitDate(currentDate[1])
6572
+ ];
6573
+ break;
6687
6574
  }
6688
- if (propEndDate && Utils.compareDate(propEndDate, currentDate[1])) {
6689
- currentDate.splice(1, 1, propEndDate);
6575
+ case "multiple": {
6576
+ const defaultArr = [];
6577
+ const obj = {};
6578
+ currentDate.forEach((item) => {
6579
+ if (!compareDate(item, propStartDate) && !compareDate(propEndDate, item)) {
6580
+ if (!Object.hasOwnProperty.call(obj, item)) {
6581
+ defaultArr.push(item);
6582
+ obj[item] = item;
6583
+ }
6584
+ }
6585
+ });
6586
+ currentDate.splice(0, currentDate.length, ...defaultArr);
6587
+ defaultData = [...splitDate(defaultArr[0])];
6588
+ break;
6690
6589
  }
6691
- defaultData = [
6692
- ...splitDate(currentDate[0]),
6693
- ...splitDate(currentDate[1])
6694
- ];
6695
- }
6696
- } else if (currentDate) {
6697
- if (currentDate.length > 0) {
6698
- if (propStartDate && Utils.compareDate(currentDate, propStartDate)) {
6699
- defaultData = [...splitDate(propStartDate)];
6700
- } else if (propEndDate && !Utils.compareDate(currentDate, propEndDate)) {
6701
- defaultData = [...splitDate(propEndDate)];
6702
- } else {
6703
- defaultData = [...splitDate(currentDate)];
6590
+ case "week": {
6591
+ const [y2, m2, d] = splitDate(currentDate[0]);
6592
+ const weekArr = getWeekDate(y2, m2, d, firstDayOfWeek);
6593
+ currentDate.splice(0, currentDate.length, ...weekArr);
6594
+ if (compareDate(currentDate[0], propStartDate)) {
6595
+ currentDate.splice(0, 1, propStartDate);
6596
+ }
6597
+ if (compareDate(propEndDate, currentDate[1])) {
6598
+ currentDate.splice(1, 1, propEndDate);
6599
+ }
6600
+ defaultData = [
6601
+ ...splitDate(currentDate[0]),
6602
+ ...splitDate(currentDate[1])
6603
+ ];
6604
+ break;
6704
6605
  }
6705
- } else {
6706
- defaultData = [];
6707
6606
  }
6708
6607
  }
6709
6608
  return defaultData;
@@ -6726,63 +6625,57 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
6726
6625
  const date4 = /* @__PURE__ */ new Date();
6727
6626
  const year = date4.getFullYear();
6728
6627
  const month = date4.getMonth() + 1;
6729
- const index = monthsData.findIndex((item) => {
6730
- return +item.curData[0] === year && +item.curData[1] === month;
6731
- });
6732
- if (index > -1) {
6733
- current = index;
6734
- }
6628
+ const index = monthsData.findIndex(
6629
+ (item) => +item.curData[0] === year && +item.curData[1] === month
6630
+ );
6631
+ if (index > -1) current = index;
6735
6632
  }
6736
6633
  return {
6737
6634
  current,
6738
6635
  lastCurrent
6739
6636
  };
6740
6637
  };
6741
- const renderCurrentDate = () => {
6742
- const defaultData = setDefaultDate();
6743
- const current = getCurrentIndex(defaultData);
6744
- if (defaultData.length > 0) {
6745
- if (type4 === "range") {
6746
- chooseDay(
6747
- { day: defaultData[2], type: "active" },
6748
- monthsData[current.current],
6749
- true
6750
- );
6751
- chooseDay(
6638
+ const renderCurrentDate = (defaultData, current) => {
6639
+ if (!defaultData.length) return;
6640
+ const date4 = monthsData[current.current];
6641
+ switch (type4) {
6642
+ case "range": {
6643
+ handleDayClick({ day: defaultData[2], type: "active" }, date4);
6644
+ handleDayClick(
6752
6645
  { day: defaultData[5], type: "active" },
6753
- monthsData[current.lastCurrent],
6754
- true
6755
- );
6756
- } else if (type4 === "week") {
6757
- chooseDay(
6758
- { day: defaultData[2], type: "curr" },
6759
- monthsData[current.current],
6760
- true
6646
+ monthsData[current.lastCurrent]
6761
6647
  );
6762
- } else if (type4 === "multiple") {
6648
+ break;
6649
+ }
6650
+ case "week": {
6651
+ handleDayClick({ day: defaultData[2], type: "curr" }, date4);
6652
+ break;
6653
+ }
6654
+ case "multiple": {
6763
6655
  [...currentDate].forEach((item) => {
6764
6656
  const dateArr = splitDate(item);
6765
6657
  let currentIndex = current.current;
6766
- monthsData.forEach((item2, index) => {
6767
- if (item2.title === monthTitle(dateArr[0], dateArr[1])) {
6768
- currentIndex = index;
6769
- }
6770
- });
6771
- chooseDay(
6658
+ currentIndex = monthsData.findIndex(
6659
+ (item2) => item2.title === monthTitle(dateArr[0], dateArr[1])
6660
+ );
6661
+ handleDayClick(
6772
6662
  { day: dateArr[2], type: "active" },
6773
- monthsData[currentIndex],
6774
- true
6663
+ monthsData[currentIndex]
6775
6664
  );
6776
6665
  });
6777
- } else {
6778
- chooseDay(
6779
- { day: defaultData[2], type: "active" },
6780
- monthsData[current.current],
6781
- true
6782
- );
6666
+ break;
6667
+ }
6668
+ default: {
6669
+ handleDayClick({ day: defaultData[2], type: "active" }, date4);
6670
+ break;
6783
6671
  }
6784
6672
  }
6785
- return current.current;
6673
+ };
6674
+ const getMonthsPanel = () => {
6675
+ return monthsPanel.current;
6676
+ };
6677
+ const getMonthsRef = () => {
6678
+ return monthsRef.current;
6786
6679
  };
6787
6680
  const requestAniFrameFunc = (current, monthNum) => {
6788
6681
  const lastItem = monthsData[monthsData.length - 1];
@@ -6791,19 +6684,31 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
6791
6684
  if (monthsRef && monthsPanel && viewAreaRef) {
6792
6685
  viewHeight = getMonthsRef().clientHeight;
6793
6686
  getMonthsPanel().style.height = `${containerHeight}px`;
6794
- getMonthsRef().scrollTop = monthsData[current].scrollTop;
6795
- setScrollTop(monthsData[current].scrollTop);
6687
+ const currTop = monthsData[current].scrollTop;
6688
+ getMonthsRef().scrollTop = currTop;
6689
+ setScrollTop(currTop);
6796
6690
  nextTick(() => setScrollWithAnimation(true));
6797
6691
  }
6798
6692
  });
6799
6693
  setAvgHeight(Math.floor(containerHeight / (monthNum + 1)));
6800
6694
  };
6695
+ const getMonthNum = () => {
6696
+ let monthNum = Number(endDates[1]) - Number(startDates[1]);
6697
+ const yearNum = Number(endDates[0]) - Number(startDates[0]);
6698
+ if (yearNum > 0) monthNum += 12 * yearNum;
6699
+ if (monthNum <= 0) monthNum = 1;
6700
+ setMonthsNum(monthNum);
6701
+ return monthNum;
6702
+ };
6801
6703
  const initData = () => {
6802
6704
  const monthNum = getMonthNum();
6803
6705
  getMonthData(startDates, monthNum);
6804
- const current = renderCurrentDate();
6805
- setDefaultRange(monthNum, current);
6806
- requestAniFrameFunc(current, monthNum);
6706
+ const defaultData = setDefaultDate();
6707
+ const current = getCurrentIndex(defaultData);
6708
+ const currentIndex = current.current;
6709
+ renderCurrentDate(defaultData, current);
6710
+ setDefaultRange(monthNum, currentIndex);
6711
+ requestAniFrameFunc(currentIndex, monthNum);
6807
6712
  };
6808
6713
  useEffect(() => {
6809
6714
  initData();
@@ -6820,9 +6725,9 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
6820
6725
  popup && resetRender();
6821
6726
  }, [currentDate]);
6822
6727
  const scrollToDate = (date4) => {
6823
- if (Utils.compareDate(date4, propStartDate)) {
6728
+ if (compareDate(date4, propStartDate)) {
6824
6729
  date4 = propStartDate;
6825
- } else if (!Utils.compareDate(date4, propEndDate)) {
6730
+ } else if (!compareDate(date4, propEndDate)) {
6826
6731
  date4 = propEndDate;
6827
6732
  }
6828
6733
  const dateArr = splitDate(date4);
@@ -6843,22 +6748,20 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
6843
6748
  clearInterval(interval);
6844
6749
  if (monthsRef.current) {
6845
6750
  monthsRef.current.scrollTop = currTop;
6846
- setScrollTop(monthsRef.current.scrollTop);
6751
+ setScrollTop(currTop);
6847
6752
  }
6848
6753
  }
6849
6754
  }, 40);
6850
6755
  } else {
6851
6756
  monthsRef.current.scrollTop = currTop;
6852
- setScrollTop(monthsRef.current.scrollTop);
6757
+ setScrollTop(currTop);
6853
6758
  }
6854
6759
  }
6855
6760
  }
6856
6761
  });
6857
6762
  };
6858
6763
  const monthsViewScroll = (e2) => {
6859
- if (monthsData.length <= 1) {
6860
- return;
6861
- }
6764
+ if (monthsData.length <= 1) return;
6862
6765
  const scrollTop2 = e2.target.scrollTop;
6863
6766
  Taro.getEnv() === "WEB" && setScrollTop(scrollTop2);
6864
6767
  let current = Math.floor(scrollTop2 / avgHeight);
@@ -6867,16 +6770,10 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
6867
6770
  const nextTop = monthsData[current + 1].scrollTop;
6868
6771
  const nextHeight = monthsData[current + 1].cssHeight;
6869
6772
  if (current === 0) {
6870
- if (scrollTop2 >= nextTop) {
6871
- current += 1;
6872
- }
6773
+ if (scrollTop2 >= nextTop) current += 1;
6873
6774
  } else if (current > 0 && current < monthsNum - 1) {
6874
- if (scrollTop2 >= nextTop) {
6875
- current += 1;
6876
- }
6877
- if (scrollTop2 < monthsData[current].scrollTop) {
6878
- current -= 1;
6879
- }
6775
+ if (scrollTop2 >= nextTop) current += 1;
6776
+ if (scrollTop2 < monthsData[current].scrollTop) current -= 1;
6880
6777
  } else {
6881
6778
  const viewPosition = Math.round(scrollTop2 + viewHeight);
6882
6779
  if (current + 1 <= monthsNum && viewPosition >= nextTop + nextHeight) {
@@ -6891,90 +6788,96 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
6891
6788
  React__default.useImperativeHandle(ref, () => ({
6892
6789
  scrollToDate
6893
6790
  }));
6791
+ const isDisable = (day, month) => {
6792
+ if (day.type !== "active") return true;
6793
+ const dateStr = getCurrDate(day, month);
6794
+ if (compareDate(dateStr, propStartDate)) return true;
6795
+ if (compareDate(propEndDate, dateStr)) return true;
6796
+ return false;
6797
+ };
6894
6798
  const getClasses = (day, month) => {
6895
6799
  const dateStr = getCurrDate(day, month);
6896
- if (day.type === "active") {
6897
- if (propStartDate && Utils.compareDate(dateStr, propStartDate) || propEndDate && Utils.compareDate(propEndDate, dateStr)) {
6898
- return `${dayPrefix}-disabled`;
6899
- }
6900
- if (type4 === "range" || type4 === "week") {
6901
- if (isStart(dateStr, currentDate) || isEnd(dateStr, currentDate)) {
6902
- return `${dayPrefix}-active ${isStart(dateStr, currentDate) ? "active-start" : ""} ${isEnd(dateStr, currentDate) ? "active-end" : ""}`;
6903
- }
6904
- if (Array.isArray(currentDate) && Object.values(currentDate).length === 2 && Utils.compareDate(currentDate[0], dateStr) && Utils.compareDate(dateStr, currentDate[1])) {
6905
- if (disableDate(day)) {
6906
- return `${dayPrefix}-choose-disabled`;
6907
- }
6908
- return `${dayPrefix}-choose`;
6909
- }
6910
- } else if (type4 === "multiple" && isMultiple(dateStr, currentDate) || !Array.isArray(currentDate) && Utils.isEqual(currentDate, dateStr)) {
6911
- return `${dayPrefix}-active`;
6800
+ if (isDisable(day, month)) return `${dayPrefix}-disabled`;
6801
+ const activeCls = `${dayPrefix}-active`;
6802
+ if (type4 === "range" || type4 === "week") {
6803
+ if (isStart(dateStr, currentDate))
6804
+ return `${activeCls} active-start`;
6805
+ if (isEnd(dateStr, currentDate)) {
6806
+ return `${activeCls} active-end`;
6912
6807
  }
6913
- if (disableDate(day)) {
6914
- return `${dayPrefix}-disabled`;
6808
+ if (currentDate.length === 2 && compareDate(currentDate[0], dateStr) && compareDate(dateStr, currentDate[1])) {
6809
+ return disableDate(day) ? `${dayPrefix}-choose-disabled` : `${dayPrefix}-choose`;
6915
6810
  }
6916
- return null;
6811
+ } else if (type4 === "multiple" && isMultiple(dateStr, currentDate) || !Array.isArray(currentDate) && isEqual(currentDate, dateStr)) {
6812
+ return activeCls;
6917
6813
  }
6918
- return `${dayPrefix}-disabled`;
6814
+ if (disableDate(day)) return `${dayPrefix}-disabled`;
6815
+ return null;
6919
6816
  };
6920
- const chooseDay = (day, month, isFirst) => {
6921
- if (getClasses(day, month) === `${dayPrefix}-disabled`) {
6922
- return;
6923
- }
6817
+ const handleDayClick = (day, month, isFirst = true) => {
6818
+ if (isDisable(day, month) || disableDate(day)) return;
6924
6819
  const days = [...month.curData];
6925
6820
  const [y2, m2] = month.curData;
6926
- days[2] = typeof day.day === "number" ? Utils.getNumTwoBit(day.day) : day.day;
6821
+ days[2] = typeof day.day === "number" ? getNumTwoBit(day.day) : day.day;
6927
6822
  days[3] = `${days[0]}/${days[1]}/${days[2]}`;
6928
- days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
6929
- if (type4 === "multiple") {
6930
- if (currentDate.length > 0) {
6931
- let hasIndex = "";
6932
- currentDate.forEach((item, index) => {
6933
- if (item === days[3]) {
6934
- hasIndex = index;
6823
+ days[4] = getWhatDay(+days[0], +days[1], +days[2]);
6824
+ const newDate = days[3];
6825
+ switch (type4) {
6826
+ case "multiple": {
6827
+ if (Array.isArray(currentDate)) {
6828
+ if (currentDate.length > 0) {
6829
+ const hasIndex = currentDate.findIndex((item) => item === newDate);
6830
+ if (isFirst) {
6831
+ state.currDateArray.push([...days]);
6832
+ } else if (hasIndex > -1) {
6833
+ currentDate.splice(hasIndex, 1);
6834
+ state.currDateArray.splice(hasIndex, 1);
6835
+ } else {
6836
+ currentDate.push(newDate);
6837
+ state.currDateArray.push([...days]);
6838
+ }
6839
+ } else {
6840
+ currentDate.push(newDate);
6841
+ state.currDateArray = [[...days]];
6935
6842
  }
6936
- });
6937
- if (isFirst) {
6938
- state.currDateArray.push([...days]);
6939
- } else if (hasIndex !== "") {
6940
- currentDate.splice(hasIndex, 1);
6941
- state.currDateArray.splice(hasIndex, 1);
6942
- } else {
6943
- currentDate.push(days[3]);
6944
- state.currDateArray.push([...days]);
6945
6843
  }
6946
- } else {
6947
- currentDate.push(days[3]);
6948
- state.currDateArray = [[...days]];
6949
- }
6950
- } else if (type4 === "range") {
6951
- const curDataLength = Object.values(currentDate).length;
6952
- if (curDataLength === 2 || curDataLength === 0) {
6953
- Array.isArray(currentDate) && currentDate.splice(0) && currentDate.push(days[3]);
6954
- state.currDateArray = [[...days]];
6955
- } else if (Utils.compareDate(currentDate[0], days[3])) {
6956
- Array.isArray(currentDate) && currentDate.push(days[3]);
6957
- state.currDateArray = [...state.currDateArray, [...days]];
6958
- } else {
6959
- Array.isArray(currentDate) && currentDate.unshift(days[3]);
6960
- state.currDateArray = [[...days], ...state.currDateArray];
6844
+ break;
6845
+ }
6846
+ case "range": {
6847
+ if (Array.isArray(currentDate)) {
6848
+ if (currentDate.length === 2 || currentDate.length === 0) {
6849
+ currentDate.splice(0, currentDate.length, newDate);
6850
+ state.currDateArray = [[...days]];
6851
+ } else if (compareDate(currentDate[0], newDate)) {
6852
+ currentDate.push(newDate);
6853
+ state.currDateArray = [...state.currDateArray, [...days]];
6854
+ } else {
6855
+ currentDate.unshift(newDate);
6856
+ state.currDateArray = [[...days], ...state.currDateArray];
6857
+ }
6858
+ }
6859
+ break;
6961
6860
  }
6962
- } else if (type4 === "week") {
6963
- const weekArr = Utils.getWeekDate(y2, m2, `${day.day}`, firstDayOfWeek);
6964
- if (propStartDate && Utils.compareDate(weekArr[0], propStartDate)) {
6965
- weekArr.splice(0, 1, propStartDate);
6861
+ case "week": {
6862
+ const weekArr = getWeekDate(y2, m2, `${day.day}`, firstDayOfWeek);
6863
+ if (compareDate(weekArr[0], propStartDate)) {
6864
+ weekArr[0] = propStartDate;
6865
+ }
6866
+ if (compareDate(propEndDate, weekArr[1])) {
6867
+ weekArr[1] = propEndDate;
6868
+ }
6869
+ currentDate.splice(0, currentDate.length, ...weekArr);
6870
+ state.currDateArray = [
6871
+ formatResultDate(weekArr[0]),
6872
+ formatResultDate(weekArr[1])
6873
+ ];
6874
+ break;
6966
6875
  }
6967
- if (propEndDate && Utils.compareDate(propEndDate, weekArr[1])) {
6968
- weekArr.splice(1, 1, propEndDate);
6876
+ default: {
6877
+ setCurrentDate(newDate);
6878
+ state.currDateArray = [...days];
6879
+ break;
6969
6880
  }
6970
- Array.isArray(currentDate) && currentDate.splice(0) && currentDate.push(...weekArr);
6971
- state.currDateArray = [
6972
- Utils.formatResultDate(weekArr[0]),
6973
- Utils.formatResultDate(weekArr[1])
6974
- ];
6975
- } else {
6976
- setCurrentDate(days[3]);
6977
- state.currDateArray = [...days];
6978
6881
  }
6979
6882
  if (!isFirst) {
6980
6883
  onDayClick && onDayClick(state.currDateArray);
@@ -6994,11 +6897,11 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
6994
6897
  }
6995
6898
  };
6996
6899
  const classes = classNames(
6900
+ classPrefix2,
6997
6901
  {
6998
6902
  [`${classPrefix2}-title`]: !popup,
6999
6903
  [`${classPrefix2}-nofooter`]: !!autoBackfill
7000
6904
  },
7001
- classPrefix2,
7002
6905
  className
7003
6906
  );
7004
6907
  const headerClasses = classNames({
@@ -7014,6 +6917,40 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
7014
6917
  const renderHeader = () => {
7015
6918
  return /* @__PURE__ */ React__default.createElement("div", { className: headerClasses }, showTitle && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-title` }, title || locale.calendaritem.title), renderHeaderButtons && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-header-buttons` }, renderHeaderButtons()), showSubTitle && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-sub-title` }, yearMonthTitle), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-weeks`, ref: weeksPanel }, weeks.map((item) => /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-week-item`, key: item }, item))));
7016
6919
  };
6920
+ const renderItem = (month, day, index) => {
6921
+ const startTip = isStartTip(day, month);
6922
+ const endTip = isEndTip(day, month);
6923
+ const noStartNorEnd = !startTip && !endTip;
6924
+ return /* @__PURE__ */ React__default.createElement(
6925
+ "div",
6926
+ {
6927
+ className: classNames("nut-calendar-day", getClasses(day, month)),
6928
+ onClick: () => handleDayClick(day, month, false),
6929
+ key: index
6930
+ },
6931
+ /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-day` }, renderDay ? renderDay(day) : day.day),
6932
+ !startTip && renderDayTop && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info-top` }, renderDayTop(day)),
6933
+ noStartNorEnd && renderDayBottom && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info-bottom` }, renderDayBottom(day)),
6934
+ noStartNorEnd && isCurrDay(month, day.day) && !renderDayBottom && showToday && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info-curr` }, locale.calendaritem.today),
6935
+ startTip && /* @__PURE__ */ React__default.createElement(
6936
+ "div",
6937
+ {
6938
+ className: classNames("nut-calendar-day-info", {
6939
+ "nut-calendar-day-info-top": isStartAndEnd(
6940
+ currentDate
6941
+ )
6942
+ })
6943
+ },
6944
+ startText || locale.calendaritem.start
6945
+ ),
6946
+ endTip && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info` }, endText || locale.calendaritem.end)
6947
+ );
6948
+ };
6949
+ const renderPanel = (month, key) => {
6950
+ return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-month`, key }, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-month-title` }, month.title), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-days` }, month.monthData.map(
6951
+ (day, i2) => renderItem(month, day, i2)
6952
+ )));
6953
+ };
7017
6954
  const renderContent = () => {
7018
6955
  return /* @__PURE__ */ React__default.createElement(
7019
6956
  ScrollView,
@@ -7034,31 +6971,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
7034
6971
  style: { transform: `translateY(${translateY}px)` }
7035
6972
  },
7036
6973
  monthsData.slice(monthDefaultRange[0], monthDefaultRange[1]).map((month, key) => {
7037
- return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-month`, key }, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-month-title` }, month.title), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-days` }, month.monthData.map((day, i2) => /* @__PURE__ */ React__default.createElement(
7038
- "div",
7039
- {
7040
- className: [
7041
- `${classPrefix2}-day`,
7042
- getClasses(day, month)
7043
- ].join(" "),
7044
- onClick: () => {
7045
- chooseDay(day, month);
7046
- },
7047
- key: i2
7048
- },
7049
- /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-day` }, renderDay ? renderDay(day) : day.day),
7050
- !isStartTip(day, month) && renderDayTop && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info-top` }, renderDayTop(day)),
7051
- !isStartTip(day, month) && !isEndTip(day, month) && renderDayBottom && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info-bottom` }, renderDayBottom(day)),
7052
- !isStartTip(day, month) && !isEndTip(day, month) && !renderDayBottom && showToday && isCurrDay(month, day.day) && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info-curr` }, locale.calendaritem.today),
7053
- isStartTip(day, month) && /* @__PURE__ */ React__default.createElement(
7054
- "div",
7055
- {
7056
- className: `${classPrefix2}-day-info ${isStartAndEnd(currentDate) ? `${classPrefix2}-day-info-top` : ""}`
7057
- },
7058
- startText || locale.calendaritem.start
7059
- ),
7060
- isEndTip(day, month) && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info` }, endText || locale.calendaritem.end)
7061
- ))));
6974
+ return renderPanel(month, key);
7062
6975
  })
7063
6976
  ))
7064
6977
  );
@@ -7077,8 +6990,8 @@ const defaultProps$12 = {
7077
6990
  visible: false,
7078
6991
  title: "",
7079
6992
  defaultValue: "",
7080
- startDate: Utils.getDay(0),
7081
- endDate: Utils.getDay(365),
6993
+ startDate: getDateString(0),
6994
+ endDate: getDateString(365),
7082
6995
  showToday: true,
7083
6996
  startText: "",
7084
6997
  endText: "",
@@ -7246,12 +7159,12 @@ const getPrevMonthDays = (year, month, firstDayOfWeek) => {
7246
7159
  prevMonth = 12;
7247
7160
  prevYear -= 1;
7248
7161
  }
7249
- let days = Utils.getMonthPreDay(year, month);
7162
+ let days = getMonthPreDay(year, month);
7250
7163
  days -= firstDayOfWeek;
7251
7164
  if (days >= 7) {
7252
7165
  days -= 7;
7253
7166
  }
7254
- const preDates = Utils.getMonthDays(`${prevYear}`, `${prevMonth}`);
7167
+ const preDates = getMonthDays(`${prevYear}`, `${prevMonth}`);
7255
7168
  const months = Array.from(Array(preDates), (_, k) => {
7256
7169
  return {
7257
7170
  type: "prev",
@@ -7263,7 +7176,7 @@ const getPrevMonthDays = (year, month, firstDayOfWeek) => {
7263
7176
  return months.slice(preDates - days);
7264
7177
  };
7265
7178
  const getCurrentMonthDays = (year, month) => {
7266
- const days = Utils.getMonthDays(`${year}`, `${month}`);
7179
+ const days = getMonthDays(`${year}`, `${month}`);
7267
7180
  return Array.from(Array(days), (_, k) => {
7268
7181
  return {
7269
7182
  type: "current",
@@ -8626,9 +8539,9 @@ const DatePicker = (props) => {
8626
8539
  };
8627
8540
  const compareDateChange = (currentDate, newDate, selectedOptions, index) => {
8628
8541
  var _a;
8629
- const isEqual = ((_a = new Date(currentDate)) == null ? void 0 : _a.getTime()) === (newDate == null ? void 0 : newDate.getTime());
8542
+ const isEqual2 = ((_a = new Date(currentDate)) == null ? void 0 : _a.getTime()) === (newDate == null ? void 0 : newDate.getTime());
8630
8543
  if (newDate && isDate(newDate)) {
8631
- if (!isEqual) {
8544
+ if (!isEqual2) {
8632
8545
  setSelectedDate(formatValue(newDate));
8633
8546
  }
8634
8547
  onChange == null ? void 0 : onChange(
@@ -15746,29 +15659,29 @@ const defaultProps$r = {
15746
15659
  onClick: (event) => {
15747
15660
  }
15748
15661
  };
15749
- const classPrefix$8 = `nut-animate`;
15662
+ const classPrefix$8 = "nut-animate";
15750
15663
  const Animate = (props) => {
15751
- const { className, type: type4, action, loop, onClick, children, ...rest } = {
15664
+ const { className, type: type4, action, loop, onClick, children, style } = {
15752
15665
  ...defaultProps$r,
15753
15666
  ...props
15754
15667
  };
15755
15668
  const [clicked, setClicked] = useState(false);
15756
- const classes = classNames({
15757
- "nut-ani-container": true,
15758
- [`${classPrefix$8}-${type4}`]: action === "initial" || clicked ? type4 : false,
15759
- loop
15760
- });
15761
- const cls = classNames(classes, className);
15669
+ const classes = classNames(
15670
+ {
15671
+ "nut-ani-container": true,
15672
+ [`${classPrefix$8}-${type4}`]: action === "initial" || clicked,
15673
+ loop
15674
+ },
15675
+ className
15676
+ );
15762
15677
  const handleClick = (event) => {
15763
15678
  setClicked(true);
15764
15679
  if (!loop) {
15765
- setTimeout(() => {
15766
- setClicked(false);
15767
- }, 1e3);
15680
+ setTimeout(() => setClicked(false), 1e3);
15768
15681
  }
15769
- onClick && onClick(event);
15682
+ onClick(event);
15770
15683
  };
15771
- return /* @__PURE__ */ React__default.createElement("div", { className: "nut-animate" }, /* @__PURE__ */ React__default.createElement("div", { className: cls, onClick: handleClick, ...rest }, children));
15684
+ return /* @__PURE__ */ React__default.createElement(View, { className: "nut-animate" }, /* @__PURE__ */ React__default.createElement(View, { className: classes, onClick: handleClick, style }, children));
15772
15685
  };
15773
15686
  Animate.displayName = "NutAnimate";
15774
15687
  const defaultProps$q = {