@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.
@@ -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.8 Fri Feb 14 2025 16:17:59 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);
@@ -6228,189 +6228,106 @@
6228
6228
  };
6229
6229
  const Address = React.forwardRef(InternalAddress);
6230
6230
  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;
6231
+ const isLeapYear = (y2) => {
6232
+ return y2 % 4 === 0 && y2 % 100 !== 0 || y2 % 400 === 0;
6233
+ };
6234
+ const getWhatDay = (year, month, day) => {
6235
+ const date2 = new Date(year, month - 1, day);
6236
+ const dayNames = [
6237
+ "星期日",
6238
+ "星期一",
6239
+ "星期二",
6240
+ "星期三",
6241
+ "星期四",
6242
+ "星期五",
6243
+ "星期六"
6244
+ ];
6245
+ return dayNames[date2.getDay()];
6246
+ };
6247
+ const getMonthPreDay = (year, month) => {
6248
+ const day = new Date(year, month - 1, 1).getDay();
6249
+ return day === 0 ? 7 : day;
6250
+ };
6251
+ const getMonthDays = (year, month) => {
6252
+ if (/^0/.test(month)) {
6253
+ month = month.split("")[1];
6393
6254
  }
6255
+ return [
6256
+ 0,
6257
+ 31,
6258
+ isLeapYear(Number(year)) ? 29 : 28,
6259
+ 31,
6260
+ 30,
6261
+ 31,
6262
+ 30,
6263
+ 31,
6264
+ 31,
6265
+ 30,
6266
+ 31,
6267
+ 30,
6268
+ 31
6269
+ ][month];
6270
+ };
6271
+ const getNumTwoBit = (n2) => {
6272
+ return n2 > 9 ? `${n2}` : `0${n2}`;
6273
+ };
6274
+ const date2Str = (date2, split = "-") => {
6275
+ const y2 = date2.getFullYear();
6276
+ const m2 = getNumTwoBit(date2.getMonth() + 1);
6277
+ const d = getNumTwoBit(date2.getDate());
6278
+ return [y2, m2, d].join(split);
6279
+ };
6280
+ const getDateString = (offset = 0) => {
6281
+ const date2 = /* @__PURE__ */ new Date();
6282
+ date2.setDate(date2.getDate() + offset);
6283
+ return date2Str(date2, "-");
6284
+ };
6285
+ const compareDate = (date1, date2) => {
6286
+ const startTime = new Date(date1.replace("-", "/").replace("-", "/"));
6287
+ const endTime = new Date(date2.replace("-", "/").replace("-", "/"));
6288
+ return startTime < endTime;
6289
+ };
6290
+ const isEqual = (date1, date2) => {
6291
+ const startTime = new Date((date1 || "").replace(/-/g, "/")).getTime();
6292
+ const endTime = new Date(date2.replace(/-/g, "/")).getTime();
6293
+ return startTime === endTime;
6294
+ };
6295
+ const getWeekDate = (year, month, date2, firstDayOfWeek = 0) => {
6296
+ const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date2));
6297
+ const nowTime = dateNow.getTime();
6298
+ let day = dateNow.getDay();
6299
+ if (firstDayOfWeek === 0) {
6300
+ const oneDayTime2 = 24 * 60 * 60 * 1e3;
6301
+ const SundayTime2 = nowTime - day * oneDayTime2;
6302
+ const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
6303
+ const sunday2 = date2Str(new Date(SundayTime2));
6304
+ const saturday = date2Str(new Date(SaturdayTime));
6305
+ return [sunday2, saturday];
6306
+ }
6307
+ day = day === 0 ? 7 : day;
6308
+ const oneDayTime = 24 * 60 * 60 * 1e3;
6309
+ const MondayTime = nowTime - (day - 1) * oneDayTime;
6310
+ const SundayTime = nowTime + (7 - day) * oneDayTime;
6311
+ const monday = date2Str(new Date(MondayTime));
6312
+ const sunday = date2Str(new Date(SundayTime));
6313
+ return [monday, sunday];
6314
+ };
6315
+ const formatResultDate = (date2) => {
6316
+ const [year, month, day] = [...date2.split("-")];
6317
+ const formatterDay = getNumTwoBit(Number(day));
6318
+ const formatterDate = `${year}-${month}-${day}`;
6319
+ const dayOfWeek = getWhatDay(Number(year), Number(month), Number(day));
6320
+ return [year, month, formatterDay, formatterDate, dayOfWeek];
6394
6321
  };
6395
6322
  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;
6323
+ {
6324
+ month === 12 && (year += 1);
6325
+ month = month === 12 ? 1 : ++month;
6405
6326
  }
6406
- return [
6407
- year,
6408
- Utils.getNumTwoBit(month),
6409
- Utils.getMonthDays(String(year), String(month))
6410
- ];
6327
+ return [year, getNumTwoBit(month), getMonthDays(String(year), String(month))];
6411
6328
  };
6412
6329
  const getDaysStatus = (type2, year, month) => {
6413
- let days = Utils.getMonthDays(`${year}`, `${month}`);
6330
+ let days = getMonthDays(`${year}`, `${month}`);
6414
6331
  return Array.from(Array(days), (v, k) => {
6415
6332
  return {
6416
6333
  day: k + 1,
@@ -6427,12 +6344,12 @@
6427
6344
  preMonth = 12;
6428
6345
  preYear += 1;
6429
6346
  }
6430
- let days = Utils.getMonthPreDay(+year, +month);
6347
+ let days = getMonthPreDay(+year, +month);
6431
6348
  days -= firstDayOfWeek;
6432
6349
  if (days >= 7) {
6433
6350
  days -= 7;
6434
6351
  }
6435
- const preDates = Utils.getMonthDays(`${preYear}`, `${preMonth}`);
6352
+ const preDates = getMonthDays(`${preYear}`, `${preMonth}`);
6436
6353
  const months = Array.from(Array(preDates), (v, k) => {
6437
6354
  return {
6438
6355
  day: k + 1,
@@ -6450,28 +6367,26 @@
6450
6367
  const isMultiple = (day, days) => {
6451
6368
  if (days.length > 0) {
6452
6369
  return days.some((item) => {
6453
- return Utils.isEqual(item, day);
6370
+ return isEqual(item, day);
6454
6371
  });
6455
6372
  }
6456
6373
  return false;
6457
6374
  };
6458
6375
  const isCurrDay = (month, day) => {
6459
6376
  const date2 = `${month.curData[0]}/${month.curData[1]}/${day}`;
6460
- return Utils.isEqual(date2, Utils.date2Str(/* @__PURE__ */ new Date(), "/"));
6377
+ return isEqual(date2, date2Str(/* @__PURE__ */ new Date(), "/"));
6461
6378
  };
6462
6379
  const getCurrDate = (day, month) => {
6463
- return `${month.curData[0]}/${month.curData[1]}/${Utils.getNumTwoBit(
6464
- +day.day
6465
- )}`;
6380
+ return `${month.curData[0]}/${month.curData[1]}/${getNumTwoBit(+day.day)}`;
6466
6381
  };
6467
6382
  const isStart = (day, days) => {
6468
- return Utils.isEqual(days[0], day);
6383
+ return isEqual(days[0], day);
6469
6384
  };
6470
6385
  const isEnd = (day, days) => {
6471
- return Utils.isEqual(days[1], day);
6386
+ return isEqual(days[1], day);
6472
6387
  };
6473
6388
  const isStartAndEnd = (days) => {
6474
- return days.length >= 2 && Utils.isEqual(days[0], days[1]);
6389
+ return days.length >= 2 && isEqual(days[0], days[1]);
6475
6390
  };
6476
6391
  const defaultProps$13 = {
6477
6392
  ...ComponentDefaults,
@@ -6479,8 +6394,8 @@
6479
6394
  autoBackfill: false,
6480
6395
  popup: true,
6481
6396
  title: "",
6482
- startDate: Utils.getDay(0),
6483
- endDate: Utils.getDay(365),
6397
+ startDate: getDateString(0),
6398
+ endDate: getDateString(365),
6484
6399
  showToday: true,
6485
6400
  startText: "",
6486
6401
  endText: "",
@@ -6513,6 +6428,7 @@
6513
6428
  type: type2,
6514
6429
  autoBackfill,
6515
6430
  title,
6431
+ value,
6516
6432
  defaultValue,
6517
6433
  startDate,
6518
6434
  endDate,
@@ -6530,12 +6446,13 @@
6530
6446
  renderDayTop,
6531
6447
  renderDayBottom,
6532
6448
  renderBottomButton,
6533
- value,
6534
6449
  onConfirm,
6535
6450
  onUpdate,
6536
6451
  onDayClick,
6537
6452
  onPageChange
6538
6453
  } = { ...defaultProps$13, ...props };
6454
+ const classPrefix2 = "nut-calendar";
6455
+ const dayPrefix = "nut-calendar-day";
6539
6456
  const weekdays = locale.calendaritem.weekdays;
6540
6457
  const weeks = [
6541
6458
  ...weekdays.slice(firstDayOfWeek, 7),
@@ -6549,19 +6466,13 @@
6549
6466
  const [monthDefaultRange, setMonthDefaultRange] = React.useState([]);
6550
6467
  const [scrollTop, setScrollTop] = React.useState(0);
6551
6468
  const [scrollWithAnimation, setScrollWithAnimation] = React.useState(false);
6552
- const propStartDate = startDate || Utils.getDay(0);
6553
- const propEndDate = endDate || Utils.getDay(365);
6469
+ const propStartDate = startDate || getDateString(0);
6470
+ const propEndDate = endDate || getDateString(365);
6554
6471
  const startDates = splitDate(propStartDate);
6555
6472
  const endDates = splitDate(propEndDate);
6556
6473
  const [state] = React.useState({
6557
6474
  currDateArray: []
6558
6475
  });
6559
- const getMonthsPanel = () => {
6560
- return monthsPanel.current;
6561
- };
6562
- const getMonthsRef = () => {
6563
- return monthsRef.current;
6564
- };
6565
6476
  const resetDefaultValue = () => {
6566
6477
  if (defaultValue || Array.isArray(defaultValue) && defaultValue.length > 0) {
6567
6478
  return type2 !== "single" ? [...defaultValue] : defaultValue;
@@ -6581,9 +6492,7 @@
6581
6492
  const viewAreaRef = React.useRef(null);
6582
6493
  const [avgHeight, setAvgHeight] = React.useState(0);
6583
6494
  let viewHeight = 0;
6584
- const classPrefix2 = "nut-calendar";
6585
- const dayPrefix = "nut-calendar-day";
6586
- const getMonthData = (curData, monthNum, type22) => {
6495
+ const getMonthData = (curData, monthNum) => {
6587
6496
  let i2 = 0;
6588
6497
  let date2 = curData;
6589
6498
  const monthData = monthsData;
@@ -6594,12 +6503,12 @@
6594
6503
  ...getPreMonthDates("prev", y2, m2, firstDayOfWeek),
6595
6504
  ...getDaysStatus("active", y2, m2)
6596
6505
  ];
6597
- const cssHeight = 39 + (days.length > 35 ? 384 : 320);
6598
6506
  let scrollTop2 = 0;
6599
6507
  if (monthData.length > 0) {
6600
6508
  const monthEle = monthData[monthData.length - 1];
6601
6509
  scrollTop2 = monthEle.scrollTop + monthEle.cssHeight;
6602
6510
  }
6511
+ const cssHeight = 39 + (days.length > 35 ? 384 : 320);
6603
6512
  const monthInfo = {
6604
6513
  curData: date2,
6605
6514
  title: monthTitle(y2, m2),
@@ -6607,16 +6516,14 @@
6607
6516
  cssHeight,
6608
6517
  scrollTop: scrollTop2
6609
6518
  };
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
- }
6519
+ if (!endDates || !compareDate(
6520
+ `${endDates[0]}/${endDates[1]}/${getMonthDays(
6521
+ endDates[0],
6522
+ endDates[1]
6523
+ )}`,
6524
+ `${curData[0]}/${curData[1]}/${curData[2]}`
6525
+ )) {
6526
+ monthData.push(monthInfo);
6620
6527
  }
6621
6528
  date2 = getCurrMonthData("next", y2, m2);
6622
6529
  } while (i2++ < monthNum);
@@ -6624,8 +6531,8 @@
6624
6531
  };
6625
6532
  const setReachedYearMonthInfo = (current) => {
6626
6533
  const currentMonthsData = monthsData[current];
6627
- const [year, month] = currentMonthsData.curData;
6628
6534
  if (currentMonthsData.title === yearMonthTitle) return;
6535
+ const [year, month] = currentMonthsData.curData;
6629
6536
  onPageChange && onPageChange([year, month, `${year}-${month}`]);
6630
6537
  setYearMonthTitle(currentMonthsData.title);
6631
6538
  };
@@ -6651,75 +6558,67 @@
6651
6558
  setTranslateY(monthsData[start].scrollTop);
6652
6559
  setReachedYearMonthInfo(current);
6653
6560
  };
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
6561
  const setDefaultDate = () => {
6667
6562
  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
- ];
6563
+ if (type2 === "single" && typeof currentDate === "string") {
6564
+ if (!currentDate.length) {
6565
+ return defaultData;
6566
+ }
6567
+ if (compareDate(currentDate, propStartDate)) {
6568
+ defaultData = [...splitDate(propStartDate)];
6569
+ } else if (!compareDate(currentDate, propEndDate)) {
6570
+ defaultData = [...splitDate(propEndDate)];
6571
+ } else {
6572
+ defaultData = [...splitDate(currentDate)];
6680
6573
  }
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
- }
6574
+ return defaultData;
6575
+ }
6576
+ if (Array.isArray(currentDate) && currentDate.length) {
6577
+ switch (type2) {
6578
+ case "range": {
6579
+ if (compareDate(currentDate[0], propStartDate)) {
6580
+ currentDate[0] = propStartDate;
6691
6581
  }
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);
6582
+ if (compareDate(propEndDate, currentDate[1])) {
6583
+ currentDate[1] = propEndDate;
6584
+ }
6585
+ defaultData = [
6586
+ ...splitDate(currentDate[0]),
6587
+ ...splitDate(currentDate[1])
6588
+ ];
6589
+ break;
6703
6590
  }
6704
- if (propEndDate && Utils.compareDate(propEndDate, currentDate[1])) {
6705
- currentDate.splice(1, 1, propEndDate);
6591
+ case "multiple": {
6592
+ const defaultArr = [];
6593
+ const obj = {};
6594
+ currentDate.forEach((item) => {
6595
+ if (!compareDate(item, propStartDate) && !compareDate(propEndDate, item)) {
6596
+ if (!Object.hasOwnProperty.call(obj, item)) {
6597
+ defaultArr.push(item);
6598
+ obj[item] = item;
6599
+ }
6600
+ }
6601
+ });
6602
+ currentDate.splice(0, currentDate.length, ...defaultArr);
6603
+ defaultData = [...splitDate(defaultArr[0])];
6604
+ break;
6706
6605
  }
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)];
6606
+ case "week": {
6607
+ const [y2, m2, d] = splitDate(currentDate[0]);
6608
+ const weekArr = getWeekDate(y2, m2, d, firstDayOfWeek);
6609
+ currentDate.splice(0, currentDate.length, ...weekArr);
6610
+ if (compareDate(currentDate[0], propStartDate)) {
6611
+ currentDate.splice(0, 1, propStartDate);
6612
+ }
6613
+ if (compareDate(propEndDate, currentDate[1])) {
6614
+ currentDate.splice(1, 1, propEndDate);
6615
+ }
6616
+ defaultData = [
6617
+ ...splitDate(currentDate[0]),
6618
+ ...splitDate(currentDate[1])
6619
+ ];
6620
+ break;
6720
6621
  }
6721
- } else {
6722
- defaultData = [];
6723
6622
  }
6724
6623
  }
6725
6624
  return defaultData;
@@ -6742,63 +6641,57 @@
6742
6641
  const date2 = /* @__PURE__ */ new Date();
6743
6642
  const year = date2.getFullYear();
6744
6643
  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
- }
6644
+ const index = monthsData.findIndex(
6645
+ (item) => +item.curData[0] === year && +item.curData[1] === month
6646
+ );
6647
+ if (index > -1) current = index;
6751
6648
  }
6752
6649
  return {
6753
6650
  current,
6754
6651
  lastCurrent
6755
6652
  };
6756
6653
  };
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(
6654
+ const renderCurrentDate = (defaultData, current) => {
6655
+ if (!defaultData.length) return;
6656
+ const date2 = monthsData[current.current];
6657
+ switch (type2) {
6658
+ case "range": {
6659
+ handleDayClick({ day: defaultData[2], type: "active" }, date2);
6660
+ handleDayClick(
6768
6661
  { day: defaultData[5], type: "active" },
6769
- monthsData[current.lastCurrent],
6770
- true
6771
- );
6772
- } else if (type2 === "week") {
6773
- chooseDay(
6774
- { day: defaultData[2], type: "curr" },
6775
- monthsData[current.current],
6776
- true
6662
+ monthsData[current.lastCurrent]
6777
6663
  );
6778
- } else if (type2 === "multiple") {
6664
+ break;
6665
+ }
6666
+ case "week": {
6667
+ handleDayClick({ day: defaultData[2], type: "curr" }, date2);
6668
+ break;
6669
+ }
6670
+ case "multiple": {
6779
6671
  [...currentDate].forEach((item) => {
6780
6672
  const dateArr = splitDate(item);
6781
6673
  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(
6674
+ currentIndex = monthsData.findIndex(
6675
+ (item2) => item2.title === monthTitle(dateArr[0], dateArr[1])
6676
+ );
6677
+ handleDayClick(
6788
6678
  { day: dateArr[2], type: "active" },
6789
- monthsData[currentIndex],
6790
- true
6679
+ monthsData[currentIndex]
6791
6680
  );
6792
6681
  });
6793
- } else {
6794
- chooseDay(
6795
- { day: defaultData[2], type: "active" },
6796
- monthsData[current.current],
6797
- true
6798
- );
6682
+ break;
6683
+ }
6684
+ default: {
6685
+ handleDayClick({ day: defaultData[2], type: "active" }, date2);
6686
+ break;
6799
6687
  }
6800
6688
  }
6801
- return current.current;
6689
+ };
6690
+ const getMonthsPanel = () => {
6691
+ return monthsPanel.current;
6692
+ };
6693
+ const getMonthsRef = () => {
6694
+ return monthsRef.current;
6802
6695
  };
6803
6696
  const requestAniFrameFunc = (current, monthNum) => {
6804
6697
  const lastItem = monthsData[monthsData.length - 1];
@@ -6807,19 +6700,31 @@
6807
6700
  if (monthsRef && monthsPanel && viewAreaRef) {
6808
6701
  viewHeight = getMonthsRef().clientHeight;
6809
6702
  getMonthsPanel().style.height = `${containerHeight}px`;
6810
- getMonthsRef().scrollTop = monthsData[current].scrollTop;
6811
- setScrollTop(monthsData[current].scrollTop);
6703
+ const currTop = monthsData[current].scrollTop;
6704
+ getMonthsRef().scrollTop = currTop;
6705
+ setScrollTop(currTop);
6812
6706
  Taro.nextTick(() => setScrollWithAnimation(true));
6813
6707
  }
6814
6708
  });
6815
6709
  setAvgHeight(Math.floor(containerHeight / (monthNum + 1)));
6816
6710
  };
6711
+ const getMonthNum = () => {
6712
+ let monthNum = Number(endDates[1]) - Number(startDates[1]);
6713
+ const yearNum = Number(endDates[0]) - Number(startDates[0]);
6714
+ if (yearNum > 0) monthNum += 12 * yearNum;
6715
+ if (monthNum <= 0) monthNum = 1;
6716
+ setMonthsNum(monthNum);
6717
+ return monthNum;
6718
+ };
6817
6719
  const initData = () => {
6818
6720
  const monthNum = getMonthNum();
6819
6721
  getMonthData(startDates, monthNum);
6820
- const current = renderCurrentDate();
6821
- setDefaultRange(monthNum, current);
6822
- requestAniFrameFunc(current, monthNum);
6722
+ const defaultData = setDefaultDate();
6723
+ const current = getCurrentIndex(defaultData);
6724
+ const currentIndex = current.current;
6725
+ renderCurrentDate(defaultData, current);
6726
+ setDefaultRange(monthNum, currentIndex);
6727
+ requestAniFrameFunc(currentIndex, monthNum);
6823
6728
  };
6824
6729
  React.useEffect(() => {
6825
6730
  initData();
@@ -6836,9 +6741,9 @@
6836
6741
  popup && resetRender();
6837
6742
  }, [currentDate]);
6838
6743
  const scrollToDate = (date2) => {
6839
- if (Utils.compareDate(date2, propStartDate)) {
6744
+ if (compareDate(date2, propStartDate)) {
6840
6745
  date2 = propStartDate;
6841
- } else if (!Utils.compareDate(date2, propEndDate)) {
6746
+ } else if (!compareDate(date2, propEndDate)) {
6842
6747
  date2 = propEndDate;
6843
6748
  }
6844
6749
  const dateArr = splitDate(date2);
@@ -6859,22 +6764,20 @@
6859
6764
  clearInterval(interval);
6860
6765
  if (monthsRef.current) {
6861
6766
  monthsRef.current.scrollTop = currTop;
6862
- setScrollTop(monthsRef.current.scrollTop);
6767
+ setScrollTop(currTop);
6863
6768
  }
6864
6769
  }
6865
6770
  }, 40);
6866
6771
  } else {
6867
6772
  monthsRef.current.scrollTop = currTop;
6868
- setScrollTop(monthsRef.current.scrollTop);
6773
+ setScrollTop(currTop);
6869
6774
  }
6870
6775
  }
6871
6776
  }
6872
6777
  });
6873
6778
  };
6874
6779
  const monthsViewScroll = (e2) => {
6875
- if (monthsData.length <= 1) {
6876
- return;
6877
- }
6780
+ if (monthsData.length <= 1) return;
6878
6781
  const scrollTop2 = e2.target.scrollTop;
6879
6782
  Taro.getEnv() === "WEB" && setScrollTop(scrollTop2);
6880
6783
  let current = Math.floor(scrollTop2 / avgHeight);
@@ -6883,16 +6786,10 @@
6883
6786
  const nextTop = monthsData[current + 1].scrollTop;
6884
6787
  const nextHeight = monthsData[current + 1].cssHeight;
6885
6788
  if (current === 0) {
6886
- if (scrollTop2 >= nextTop) {
6887
- current += 1;
6888
- }
6789
+ if (scrollTop2 >= nextTop) current += 1;
6889
6790
  } 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
- }
6791
+ if (scrollTop2 >= nextTop) current += 1;
6792
+ if (scrollTop2 < monthsData[current].scrollTop) current -= 1;
6896
6793
  } else {
6897
6794
  const viewPosition = Math.round(scrollTop2 + viewHeight);
6898
6795
  if (current + 1 <= monthsNum && viewPosition >= nextTop + nextHeight) {
@@ -6907,90 +6804,96 @@
6907
6804
  React.useImperativeHandle(ref, () => ({
6908
6805
  scrollToDate
6909
6806
  }));
6807
+ const isDisable = (day, month) => {
6808
+ if (day.type !== "active") return true;
6809
+ const dateStr = getCurrDate(day, month);
6810
+ if (compareDate(dateStr, propStartDate)) return true;
6811
+ if (compareDate(propEndDate, dateStr)) return true;
6812
+ return false;
6813
+ };
6910
6814
  const getClasses = (day, month) => {
6911
6815
  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`;
6816
+ if (isDisable(day, month)) return `${dayPrefix}-disabled`;
6817
+ const activeCls = `${dayPrefix}-active`;
6818
+ if (type2 === "range" || type2 === "week") {
6819
+ if (isStart(dateStr, currentDate))
6820
+ return `${activeCls} active-start`;
6821
+ if (isEnd(dateStr, currentDate)) {
6822
+ return `${activeCls} active-end`;
6928
6823
  }
6929
- if (disableDate(day)) {
6930
- return `${dayPrefix}-disabled`;
6824
+ if (currentDate.length === 2 && compareDate(currentDate[0], dateStr) && compareDate(dateStr, currentDate[1])) {
6825
+ return disableDate(day) ? `${dayPrefix}-choose-disabled` : `${dayPrefix}-choose`;
6931
6826
  }
6932
- return null;
6827
+ } else if (type2 === "multiple" && isMultiple(dateStr, currentDate) || !Array.isArray(currentDate) && isEqual(currentDate, dateStr)) {
6828
+ return activeCls;
6933
6829
  }
6934
- return `${dayPrefix}-disabled`;
6830
+ if (disableDate(day)) return `${dayPrefix}-disabled`;
6831
+ return null;
6935
6832
  };
6936
- const chooseDay = (day, month, isFirst) => {
6937
- if (getClasses(day, month) === `${dayPrefix}-disabled`) {
6938
- return;
6939
- }
6833
+ const handleDayClick = (day, month, isFirst = true) => {
6834
+ if (isDisable(day, month) || disableDate(day)) return;
6940
6835
  const days = [...month.curData];
6941
6836
  const [y2, m2] = month.curData;
6942
- days[2] = typeof day.day === "number" ? Utils.getNumTwoBit(day.day) : day.day;
6837
+ days[2] = typeof day.day === "number" ? getNumTwoBit(day.day) : day.day;
6943
6838
  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;
6839
+ days[4] = getWhatDay(+days[0], +days[1], +days[2]);
6840
+ const newDate = days[3];
6841
+ switch (type2) {
6842
+ case "multiple": {
6843
+ if (Array.isArray(currentDate)) {
6844
+ if (currentDate.length > 0) {
6845
+ const hasIndex = currentDate.findIndex((item) => item === newDate);
6846
+ if (isFirst) {
6847
+ state.currDateArray.push([...days]);
6848
+ } else if (hasIndex > -1) {
6849
+ currentDate.splice(hasIndex, 1);
6850
+ state.currDateArray.splice(hasIndex, 1);
6851
+ } else {
6852
+ currentDate.push(newDate);
6853
+ state.currDateArray.push([...days]);
6854
+ }
6855
+ } else {
6856
+ currentDate.push(newDate);
6857
+ state.currDateArray = [[...days]];
6951
6858
  }
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
6859
  }
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];
6860
+ break;
6861
+ }
6862
+ case "range": {
6863
+ if (Array.isArray(currentDate)) {
6864
+ if (currentDate.length === 2 || currentDate.length === 0) {
6865
+ currentDate.splice(0, currentDate.length, newDate);
6866
+ state.currDateArray = [[...days]];
6867
+ } else if (compareDate(currentDate[0], newDate)) {
6868
+ currentDate.push(newDate);
6869
+ state.currDateArray = [...state.currDateArray, [...days]];
6870
+ } else {
6871
+ currentDate.unshift(newDate);
6872
+ state.currDateArray = [[...days], ...state.currDateArray];
6873
+ }
6874
+ }
6875
+ break;
6977
6876
  }
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);
6877
+ case "week": {
6878
+ const weekArr = getWeekDate(y2, m2, `${day.day}`, firstDayOfWeek);
6879
+ if (compareDate(weekArr[0], propStartDate)) {
6880
+ weekArr[0] = propStartDate;
6881
+ }
6882
+ if (compareDate(propEndDate, weekArr[1])) {
6883
+ weekArr[1] = propEndDate;
6884
+ }
6885
+ currentDate.splice(0, currentDate.length, ...weekArr);
6886
+ state.currDateArray = [
6887
+ formatResultDate(weekArr[0]),
6888
+ formatResultDate(weekArr[1])
6889
+ ];
6890
+ break;
6982
6891
  }
6983
- if (propEndDate && Utils.compareDate(propEndDate, weekArr[1])) {
6984
- weekArr.splice(1, 1, propEndDate);
6892
+ default: {
6893
+ setCurrentDate(newDate);
6894
+ state.currDateArray = [...days];
6895
+ break;
6985
6896
  }
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
6897
  }
6995
6898
  if (!isFirst) {
6996
6899
  onDayClick && onDayClick(state.currDateArray);
@@ -7010,11 +6913,11 @@
7010
6913
  }
7011
6914
  };
7012
6915
  const classes = classNames(
6916
+ classPrefix2,
7013
6917
  {
7014
6918
  [`${classPrefix2}-title`]: !popup,
7015
6919
  [`${classPrefix2}-nofooter`]: !!autoBackfill
7016
6920
  },
7017
- classPrefix2,
7018
6921
  className
7019
6922
  );
7020
6923
  const headerClasses = classNames({
@@ -7030,6 +6933,40 @@
7030
6933
  const renderHeader = () => {
7031
6934
  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
6935
  };
6936
+ const renderItem = (month, day, index) => {
6937
+ const startTip = isStartTip(day, month);
6938
+ const endTip = isEndTip(day, month);
6939
+ const noStartNorEnd = !startTip && !endTip;
6940
+ return /* @__PURE__ */ React.createElement(
6941
+ "div",
6942
+ {
6943
+ className: classNames("nut-calendar-day", getClasses(day, month)),
6944
+ onClick: () => handleDayClick(day, month, false),
6945
+ key: index
6946
+ },
6947
+ /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-day` }, renderDay ? renderDay(day) : day.day),
6948
+ !startTip && renderDayTop && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-top` }, renderDayTop(day)),
6949
+ noStartNorEnd && renderDayBottom && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-bottom` }, renderDayBottom(day)),
6950
+ noStartNorEnd && isCurrDay(month, day.day) && !renderDayBottom && showToday && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-curr` }, locale.calendaritem.today),
6951
+ startTip && /* @__PURE__ */ React.createElement(
6952
+ "div",
6953
+ {
6954
+ className: classNames("nut-calendar-day-info", {
6955
+ "nut-calendar-day-info-top": isStartAndEnd(
6956
+ currentDate
6957
+ )
6958
+ })
6959
+ },
6960
+ startText || locale.calendaritem.start
6961
+ ),
6962
+ endTip && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info` }, endText || locale.calendaritem.end)
6963
+ );
6964
+ };
6965
+ const renderPanel = (month, key) => {
6966
+ 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(
6967
+ (day, i2) => renderItem(month, day, i2)
6968
+ )));
6969
+ };
7033
6970
  const renderContent = () => {
7034
6971
  return /* @__PURE__ */ React.createElement(
7035
6972
  components.ScrollView,
@@ -7050,31 +6987,7 @@
7050
6987
  style: { transform: `translateY(${translateY}px)` }
7051
6988
  },
7052
6989
  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
- ))));
6990
+ return renderPanel(month, key);
7078
6991
  })
7079
6992
  ))
7080
6993
  );
@@ -7093,8 +7006,8 @@
7093
7006
  visible: false,
7094
7007
  title: "",
7095
7008
  defaultValue: "",
7096
- startDate: Utils.getDay(0),
7097
- endDate: Utils.getDay(365),
7009
+ startDate: getDateString(0),
7010
+ endDate: getDateString(365),
7098
7011
  showToday: true,
7099
7012
  startText: "",
7100
7013
  endText: "",
@@ -7262,12 +7175,12 @@
7262
7175
  prevMonth = 12;
7263
7176
  prevYear -= 1;
7264
7177
  }
7265
- let days = Utils.getMonthPreDay(year, month);
7178
+ let days = getMonthPreDay(year, month);
7266
7179
  days -= firstDayOfWeek;
7267
7180
  if (days >= 7) {
7268
7181
  days -= 7;
7269
7182
  }
7270
- const preDates = Utils.getMonthDays(`${prevYear}`, `${prevMonth}`);
7183
+ const preDates = getMonthDays(`${prevYear}`, `${prevMonth}`);
7271
7184
  const months = Array.from(Array(preDates), (_, k) => {
7272
7185
  return {
7273
7186
  type: "prev",
@@ -7279,7 +7192,7 @@
7279
7192
  return months.slice(preDates - days);
7280
7193
  };
7281
7194
  const getCurrentMonthDays = (year, month) => {
7282
- const days = Utils.getMonthDays(`${year}`, `${month}`);
7195
+ const days = getMonthDays(`${year}`, `${month}`);
7283
7196
  return Array.from(Array(days), (_, k) => {
7284
7197
  return {
7285
7198
  type: "current",
@@ -8642,9 +8555,9 @@
8642
8555
  };
8643
8556
  const compareDateChange = (currentDate, newDate, selectedOptions, index) => {
8644
8557
  var _a;
8645
- const isEqual = ((_a = new Date(currentDate)) == null ? void 0 : _a.getTime()) === (newDate == null ? void 0 : newDate.getTime());
8558
+ const isEqual2 = ((_a = new Date(currentDate)) == null ? void 0 : _a.getTime()) === (newDate == null ? void 0 : newDate.getTime());
8646
8559
  if (newDate && isDate(newDate)) {
8647
- if (!isEqual) {
8560
+ if (!isEqual2) {
8648
8561
  setSelectedDate(formatValue(newDate));
8649
8562
  }
8650
8563
  onChange == null ? void 0 : onChange(
@@ -15762,29 +15675,29 @@
15762
15675
  onClick: (event) => {
15763
15676
  }
15764
15677
  };
15765
- const classPrefix$8 = `nut-animate`;
15678
+ const classPrefix$8 = "nut-animate";
15766
15679
  const Animate = (props) => {
15767
- const { className, type: type2, action, loop, onClick, children, ...rest } = {
15680
+ const { className, type: type2, action, loop, onClick, children, style } = {
15768
15681
  ...defaultProps$r,
15769
15682
  ...props
15770
15683
  };
15771
15684
  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);
15685
+ const classes = classNames(
15686
+ {
15687
+ "nut-ani-container": true,
15688
+ [`${classPrefix$8}-${type2}`]: action === "initial" || clicked,
15689
+ loop
15690
+ },
15691
+ className
15692
+ );
15778
15693
  const handleClick = (event) => {
15779
15694
  setClicked(true);
15780
15695
  if (!loop) {
15781
- setTimeout(() => {
15782
- setClicked(false);
15783
- }, 1e3);
15696
+ setTimeout(() => setClicked(false), 1e3);
15784
15697
  }
15785
- onClick && onClick(event);
15698
+ onClick(event);
15786
15699
  };
15787
- return /* @__PURE__ */ React.createElement("div", { className: "nut-animate" }, /* @__PURE__ */ React.createElement("div", { className: cls, onClick: handleClick, ...rest }, children));
15700
+ return /* @__PURE__ */ React.createElement(components.View, { className: "nut-animate" }, /* @__PURE__ */ React.createElement(components.View, { className: classes, onClick: handleClick, style }, children));
15788
15701
  };
15789
15702
  Animate.displayName = "NutAnimate";
15790
15703
  const defaultProps$q = {