@nutui/nutui-react 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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.7.7 Fri Jan 24 2025 13:55:36 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.7.9 Fri Feb 21 2025 17:10:51 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -5290,7 +5290,7 @@ const is = {
5290
5290
  num: (a) => typeof a === "number",
5291
5291
  und: (a) => a === void 0
5292
5292
  };
5293
- function isEqual(a, b) {
5293
+ function isEqual$1(a, b) {
5294
5294
  if (is.arr(a)) {
5295
5295
  if (!is.arr(b) || a.length !== b.length) return false;
5296
5296
  for (let i2 = 0; i2 < a.length; i2++) {
@@ -7154,12 +7154,12 @@ class SpringValue extends FrameValue {
7154
7154
  to2 = from;
7155
7155
  }
7156
7156
  if (props.reverse) [to2, from] = [from, to2];
7157
- const hasFromChanged = !isEqual(from, prevFrom);
7157
+ const hasFromChanged = !isEqual$1(from, prevFrom);
7158
7158
  if (hasFromChanged) {
7159
7159
  anim.from = from;
7160
7160
  }
7161
7161
  from = getFluidValue(from);
7162
- const hasToChanged = !isEqual(to2, prevTo);
7162
+ const hasToChanged = !isEqual$1(to2, prevTo);
7163
7163
  if (hasToChanged) {
7164
7164
  this._focus(to2);
7165
7165
  }
@@ -7200,10 +7200,10 @@ class SpringValue extends FrameValue {
7200
7200
  if (!started) {
7201
7201
  const hasValueChanged = reset || !hasAnimated(this) && hasFromChanged;
7202
7202
  if (hasToChanged || hasValueChanged) {
7203
- finished = isEqual(computeGoal(value), goal);
7203
+ finished = isEqual$1(computeGoal(value), goal);
7204
7204
  started = !finished;
7205
7205
  }
7206
- if (!isEqual(anim.immediate, immediate) && !immediate || !isEqual(config2.decay, decay) || !isEqual(config2.velocity, velocity)) {
7206
+ if (!isEqual$1(anim.immediate, immediate) && !immediate || !isEqual$1(config2.decay, decay) || !isEqual$1(config2.velocity, velocity)) {
7207
7207
  started = true;
7208
7208
  }
7209
7209
  }
@@ -7294,7 +7294,7 @@ class SpringValue extends FrameValue {
7294
7294
  const value = getFluidValue(arg);
7295
7295
  if (!is.und(value)) {
7296
7296
  const oldNode = getAnimated(this);
7297
- if (!oldNode || !isEqual(value, oldNode.getValue())) {
7297
+ if (!oldNode || !isEqual$1(value, oldNode.getValue())) {
7298
7298
  const nodeType = getAnimatedType(value);
7299
7299
  if (!oldNode || oldNode.constructor != nodeType) {
7300
7300
  setAnimated(this, nodeType.create(value));
@@ -7371,7 +7371,7 @@ class SpringValue extends FrameValue {
7371
7371
  function checkFinished(target, to2) {
7372
7372
  const goal = computeGoal(to2);
7373
7373
  const value = computeGoal(target.get());
7374
- return isEqual(value, goal);
7374
+ return isEqual$1(value, goal);
7375
7375
  }
7376
7376
  function createLoopUpdate(props, loop2 = props.loop, to2 = props.to) {
7377
7377
  let loopRet = callProp(loop2);
@@ -7945,7 +7945,7 @@ class Interpolation extends FrameValue {
7945
7945
  advance(_dt) {
7946
7946
  const value = this._get();
7947
7947
  const oldValue = this.get();
7948
- if (!isEqual(value, oldValue)) {
7948
+ if (!isEqual$1(value, oldValue)) {
7949
7949
  getAnimated(this).setValue(value);
7950
7950
  this._onChange(value, this.idle);
7951
7951
  }
@@ -10106,189 +10106,106 @@ const InternalAddress = (props, ref) => {
10106
10106
  };
10107
10107
  const Address = forwardRef(InternalAddress);
10108
10108
  Address.displayName = "NutAddress";
10109
- const Utils = {
10110
- /**
10111
- * 是否为闫年
10112
- * @return {Boolse} true|false
10113
- */
10114
- isLeapYear(y) {
10115
- return y % 4 === 0 && y % 100 !== 0 || y % 400 === 0;
10116
- },
10117
- /**
10118
- * 返回星期数
10119
- * @return {String}
10120
- */
10121
- getWhatDay(year, month, day) {
10122
- const date4 = /* @__PURE__ */ new Date(`${year}/${month}/${day}`);
10123
- const index = date4.getDay();
10124
- const dayNames = [
10125
- "星期日",
10126
- "星期一",
10127
- "星期二",
10128
- "星期三",
10129
- "星期四",
10130
- "星期五",
10131
- "星期六"
10132
- ];
10133
- return dayNames[index];
10134
- },
10135
- /**
10136
- * 返回上一个月在当前面板中的天数
10137
- * @return {Number}
10138
- */
10139
- getMonthPreDay(year, month) {
10140
- const date4 = /* @__PURE__ */ new Date(`${year}/${month}/01`);
10141
- let day = date4.getDay();
10142
- if (day === 0) {
10143
- day = 7;
10144
- }
10145
- return day;
10146
- },
10147
- /**
10148
- * 返回月份天数
10149
- * @return {Number}
10150
- */
10151
- getMonthDays(year, month) {
10152
- if (/^0/.test(month)) {
10153
- month = month.split("")[1];
10154
- }
10155
- return [
10156
- 0,
10157
- 31,
10158
- this.isLeapYear(Number(year)) ? 29 : 28,
10159
- 31,
10160
- 30,
10161
- 31,
10162
- 30,
10163
- 31,
10164
- 31,
10165
- 30,
10166
- 31,
10167
- 30,
10168
- 31
10169
- ][month];
10170
- },
10171
- /**
10172
- * 补齐数字位数
10173
- * @return {string}
10174
- */
10175
- getNumTwoBit(n2) {
10176
- n2 = Number(n2);
10177
- return (n2 > 9 ? "" : "0") + n2;
10178
- },
10179
- /**
10180
- * 日期对象转成字符串
10181
- * @return {string}
10182
- */
10183
- date2Str(date4, split) {
10184
- split = split || "-";
10185
- const y = date4.getFullYear();
10186
- const m2 = this.getNumTwoBit(date4.getMonth() + 1);
10187
- const d2 = this.getNumTwoBit(date4.getDate());
10188
- return [y, m2, d2].join(split);
10189
- },
10190
- /**
10191
- * 返回日期格式字符串
10192
- * @param {Number} 0返回今天的日期、1返回明天的日期,2返回后天得日期,依次类推
10193
- * @return {string} '2014-12-31'
10194
- */
10195
- getDay(i2) {
10196
- i2 = i2 || 0;
10197
- let date4 = /* @__PURE__ */ new Date();
10198
- const diff = i2 * (1e3 * 60 * 60 * 24);
10199
- date4 = new Date(date4.getTime() + diff);
10200
- return this.date2Str(date4);
10201
- },
10202
- /**
10203
- * 时间比较
10204
- * @return {Boolean}
10205
- */
10206
- compareDate(date1, date22) {
10207
- const startTime = new Date(date1.replace("-", "/").replace("-", "/"));
10208
- const endTime = new Date(date22.replace("-", "/").replace("-", "/"));
10209
- if (startTime >= endTime) {
10210
- return false;
10211
- }
10212
- return true;
10213
- },
10214
- /**
10215
- * 时间是否相等
10216
- * @return {Boolean}
10217
- */
10218
- isEqual(date1, date22) {
10219
- const startTime = new Date((date1 || "").replace(/-/g, "/")).getTime();
10220
- const endTime = new Date(date22.replace(/-/g, "/")).getTime();
10221
- if (startTime === endTime) {
10222
- return true;
10223
- }
10224
- return false;
10225
- },
10226
- getMonthWeek(year, month, date4, firstDayOfWeek = 0) {
10227
- const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date4));
10228
- let w = dateNow.getDay();
10229
- const d2 = dateNow.getDate();
10230
- let remainder = 6 - w;
10231
- if (firstDayOfWeek !== 0) {
10232
- w = w === 0 ? 7 : w;
10233
- remainder = 7 - w;
10234
- }
10235
- return Math.ceil((d2 + remainder) / 7);
10236
- },
10237
- getYearWeek(year, month, date4, firstDayOfWeek = 0) {
10238
- const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date4));
10239
- const dateFirst = new Date(Number(year), 0, 1);
10240
- const dataNumber = Math.round(
10241
- (dateNow.valueOf() - dateFirst.valueOf()) / 864e5
10242
- );
10243
- return Math.ceil((dataNumber + (dateFirst.getDay() + 1 - 1)) / 7);
10244
- },
10245
- getWeekDate(year, month, date4, firstDayOfWeek = 0) {
10246
- const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date4));
10247
- const nowTime = dateNow.getTime();
10248
- let day = dateNow.getDay();
10249
- if (firstDayOfWeek === 0) {
10250
- const oneDayTime2 = 24 * 60 * 60 * 1e3;
10251
- const SundayTime2 = nowTime - day * oneDayTime2;
10252
- const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
10253
- const sunday2 = this.date2Str(new Date(SundayTime2));
10254
- const saturday = this.date2Str(new Date(SaturdayTime));
10255
- return [sunday2, saturday];
10256
- }
10257
- day = day === 0 ? 7 : day;
10258
- const oneDayTime = 24 * 60 * 60 * 1e3;
10259
- const MondayTime = nowTime - (day - 1) * oneDayTime;
10260
- const SundayTime = nowTime + (7 - day) * oneDayTime;
10261
- const monday = this.date2Str(new Date(MondayTime));
10262
- const sunday = this.date2Str(new Date(SundayTime));
10263
- return [monday, sunday];
10264
- },
10265
- formatResultDate(date4) {
10266
- const days = [...date4.split("-")];
10267
- days[2] = Utils.getNumTwoBit(Number(days[2]));
10268
- days[3] = `${days[0]}-${days[1]}-${days[2]}`;
10269
- days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
10270
- return days;
10109
+ const isLeapYear = (y) => {
10110
+ return y % 4 === 0 && y % 100 !== 0 || y % 400 === 0;
10111
+ };
10112
+ const getWhatDay = (year, month, day) => {
10113
+ const date4 = new Date(year, month - 1, day);
10114
+ const dayNames = [
10115
+ "星期日",
10116
+ "星期一",
10117
+ "星期二",
10118
+ "星期三",
10119
+ "星期四",
10120
+ "星期五",
10121
+ "星期六"
10122
+ ];
10123
+ return dayNames[date4.getDay()];
10124
+ };
10125
+ const getMonthPreDay = (year, month) => {
10126
+ const day = new Date(year, month - 1, 1).getDay();
10127
+ return day === 0 ? 7 : day;
10128
+ };
10129
+ const getMonthDays = (year, month) => {
10130
+ if (/^0/.test(month)) {
10131
+ month = month.split("")[1];
10271
10132
  }
10133
+ return [
10134
+ 0,
10135
+ 31,
10136
+ isLeapYear(Number(year)) ? 29 : 28,
10137
+ 31,
10138
+ 30,
10139
+ 31,
10140
+ 30,
10141
+ 31,
10142
+ 31,
10143
+ 30,
10144
+ 31,
10145
+ 30,
10146
+ 31
10147
+ ][month];
10148
+ };
10149
+ const getNumTwoBit = (n2) => {
10150
+ return n2 > 9 ? `${n2}` : `0${n2}`;
10151
+ };
10152
+ const date2Str = (date4, split = "-") => {
10153
+ const y = date4.getFullYear();
10154
+ const m2 = getNumTwoBit(date4.getMonth() + 1);
10155
+ const d2 = getNumTwoBit(date4.getDate());
10156
+ return [y, m2, d2].join(split);
10157
+ };
10158
+ const getDateString = (offset = 0) => {
10159
+ const date4 = /* @__PURE__ */ new Date();
10160
+ date4.setDate(date4.getDate() + offset);
10161
+ return date2Str(date4, "-");
10162
+ };
10163
+ const compareDate = (date1, date22) => {
10164
+ const startTime = new Date(date1.replace("-", "/").replace("-", "/"));
10165
+ const endTime = new Date(date22.replace("-", "/").replace("-", "/"));
10166
+ return startTime < endTime;
10167
+ };
10168
+ const isEqual = (date1, date22) => {
10169
+ const startTime = new Date((date1 || "").replace(/-/g, "/")).getTime();
10170
+ const endTime = new Date(date22.replace(/-/g, "/")).getTime();
10171
+ return startTime === endTime;
10172
+ };
10173
+ const getWeekDate = (year, month, date4, firstDayOfWeek = 0) => {
10174
+ const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date4));
10175
+ const nowTime = dateNow.getTime();
10176
+ let day = dateNow.getDay();
10177
+ if (firstDayOfWeek === 0) {
10178
+ const oneDayTime2 = 24 * 60 * 60 * 1e3;
10179
+ const SundayTime2 = nowTime - day * oneDayTime2;
10180
+ const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
10181
+ const sunday2 = date2Str(new Date(SundayTime2));
10182
+ const saturday = date2Str(new Date(SaturdayTime));
10183
+ return [sunday2, saturday];
10184
+ }
10185
+ day = day === 0 ? 7 : day;
10186
+ const oneDayTime = 24 * 60 * 60 * 1e3;
10187
+ const MondayTime = nowTime - (day - 1) * oneDayTime;
10188
+ const SundayTime = nowTime + (7 - day) * oneDayTime;
10189
+ const monday = date2Str(new Date(MondayTime));
10190
+ const sunday = date2Str(new Date(SundayTime));
10191
+ return [monday, sunday];
10192
+ };
10193
+ const formatResultDate = (date4) => {
10194
+ const [year, month, day] = [...date4.split("-")];
10195
+ const formatterDay = getNumTwoBit(Number(day));
10196
+ const formatterDate = `${year}-${month}-${day}`;
10197
+ const dayOfWeek = getWhatDay(Number(year), Number(month), Number(day));
10198
+ return [year, month, formatterDay, formatterDate, dayOfWeek];
10272
10199
  };
10273
10200
  const getCurrMonthData = (type4, year, month) => {
10274
- switch (type4) {
10275
- case "prev":
10276
- month === 1 && (year -= 1);
10277
- month = month === 1 ? 12 : --month;
10278
- break;
10279
- case "next":
10280
- month === 12 && (year += 1);
10281
- month = month === 12 ? 1 : ++month;
10282
- break;
10201
+ {
10202
+ month === 12 && (year += 1);
10203
+ month = month === 12 ? 1 : ++month;
10283
10204
  }
10284
- return [
10285
- year,
10286
- Utils.getNumTwoBit(month),
10287
- Utils.getMonthDays(String(year), String(month))
10288
- ];
10205
+ return [year, getNumTwoBit(month), getMonthDays(String(year), String(month))];
10289
10206
  };
10290
10207
  const getDaysStatus = (type4, year, month) => {
10291
- let days = Utils.getMonthDays(`${year}`, `${month}`);
10208
+ let days = getMonthDays(`${year}`, `${month}`);
10292
10209
  return Array.from(Array(days), (v, k) => {
10293
10210
  return {
10294
10211
  day: k + 1,
@@ -10305,12 +10222,12 @@ const getPreMonthDates = (type4, year, month, firstDayOfWeek) => {
10305
10222
  preMonth = 12;
10306
10223
  preYear += 1;
10307
10224
  }
10308
- let days = Utils.getMonthPreDay(+year, +month);
10225
+ let days = getMonthPreDay(+year, +month);
10309
10226
  days -= firstDayOfWeek;
10310
10227
  if (days >= 7) {
10311
10228
  days -= 7;
10312
10229
  }
10313
- const preDates = Utils.getMonthDays(`${preYear}`, `${preMonth}`);
10230
+ const preDates = getMonthDays(`${preYear}`, `${preMonth}`);
10314
10231
  const months = Array.from(Array(preDates), (v, k) => {
10315
10232
  return {
10316
10233
  day: k + 1,
@@ -10328,28 +10245,26 @@ const splitDate = (date4) => {
10328
10245
  const isMultiple = (day, days) => {
10329
10246
  if (days.length > 0) {
10330
10247
  return days.some((item) => {
10331
- return Utils.isEqual(item, day);
10248
+ return isEqual(item, day);
10332
10249
  });
10333
10250
  }
10334
10251
  return false;
10335
10252
  };
10336
10253
  const isCurrDay = (month, day) => {
10337
10254
  const date4 = `${month.curData[0]}/${month.curData[1]}/${day}`;
10338
- return Utils.isEqual(date4, Utils.date2Str(/* @__PURE__ */ new Date(), "/"));
10255
+ return isEqual(date4, date2Str(/* @__PURE__ */ new Date(), "/"));
10339
10256
  };
10340
10257
  const getCurrDate = (day, month) => {
10341
- return `${month.curData[0]}/${month.curData[1]}/${Utils.getNumTwoBit(
10342
- +day.day
10343
- )}`;
10258
+ return `${month.curData[0]}/${month.curData[1]}/${getNumTwoBit(+day.day)}`;
10344
10259
  };
10345
10260
  const isStart = (day, days) => {
10346
- return Utils.isEqual(days[0], day);
10261
+ return isEqual(days[0], day);
10347
10262
  };
10348
10263
  const isEnd = (day, days) => {
10349
- return Utils.isEqual(days[1], day);
10264
+ return isEqual(days[1], day);
10350
10265
  };
10351
10266
  const isStartAndEnd = (days) => {
10352
- return days.length >= 2 && Utils.isEqual(days[0], days[1]);
10267
+ return days.length >= 2 && isEqual(days[0], days[1]);
10353
10268
  };
10354
10269
  const defaultProps$12 = {
10355
10270
  ...ComponentDefaults,
@@ -10357,8 +10272,8 @@ const defaultProps$12 = {
10357
10272
  autoBackfill: false,
10358
10273
  popup: true,
10359
10274
  title: "",
10360
- startDate: Utils.getDay(0),
10361
- endDate: Utils.getDay(365),
10275
+ startDate: getDateString(0),
10276
+ endDate: getDateString(365),
10362
10277
  showToday: true,
10363
10278
  startText: "",
10364
10279
  endText: "",
@@ -10414,6 +10329,8 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10414
10329
  onDayClick,
10415
10330
  onPageChange
10416
10331
  } = { ...defaultProps$12, ...props };
10332
+ const classPrefix2 = "nut-calendar";
10333
+ const dayPrefix = "nut-calendar-day";
10417
10334
  const weekdays = locale.calendaritem.weekdays;
10418
10335
  const weeks = [
10419
10336
  ...weekdays.slice(firstDayOfWeek, 7),
@@ -10425,19 +10342,13 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10425
10342
  const [monthsNum, setMonthsNum] = useState(0);
10426
10343
  const [translateY, setTranslateY] = useState(0);
10427
10344
  const [monthDefaultRange, setMonthDefaultRange] = useState([]);
10428
- const propStartDate = startDate || Utils.getDay(0);
10429
- const propEndDate = endDate || Utils.getDay(365);
10345
+ const propStartDate = startDate || getDateString(0);
10346
+ const propEndDate = endDate || getDateString(365);
10430
10347
  const startDates = splitDate(propStartDate);
10431
10348
  const endDates = splitDate(propEndDate);
10432
10349
  const [state] = useState({
10433
10350
  currDateArray: []
10434
10351
  });
10435
- const getMonthsPanel = () => {
10436
- return monthsPanel.current;
10437
- };
10438
- const getMonthsRef = () => {
10439
- return monthsRef.current;
10440
- };
10441
10352
  const resetDefaultValue = () => {
10442
10353
  if (defaultValue || Array.isArray(defaultValue) && defaultValue.length > 0) {
10443
10354
  return type4 !== "single" ? [...defaultValue] : defaultValue;
@@ -10457,9 +10368,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10457
10368
  const viewAreaRef = useRef(null);
10458
10369
  const [avgHeight, setAvgHeight] = useState(0);
10459
10370
  let viewHeight = 0;
10460
- const classPrefix2 = "nut-calendar";
10461
- const dayPrefix = "nut-calendar-day";
10462
- const getMonthData = (curData, monthNum, type22) => {
10371
+ const getMonthData = (curData, monthNum) => {
10463
10372
  let i2 = 0;
10464
10373
  let date4 = curData;
10465
10374
  const monthData = monthsData;
@@ -10483,16 +10392,14 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10483
10392
  cssHeight,
10484
10393
  scrollTop
10485
10394
  };
10486
- {
10487
- if (!endDates || !Utils.compareDate(
10488
- `${endDates[0]}/${endDates[1]}/${Utils.getMonthDays(
10489
- endDates[0],
10490
- endDates[1]
10491
- )}`,
10492
- `${curData[0]}/${curData[1]}/${curData[2]}`
10493
- )) {
10494
- monthData.push(monthInfo);
10495
- }
10395
+ if (!endDates || !compareDate(
10396
+ `${endDates[0]}/${endDates[1]}/${getMonthDays(
10397
+ endDates[0],
10398
+ endDates[1]
10399
+ )}`,
10400
+ `${curData[0]}/${curData[1]}/${curData[2]}`
10401
+ )) {
10402
+ monthData.push(monthInfo);
10496
10403
  }
10497
10404
  date4 = getCurrMonthData("next", y, m2);
10498
10405
  } while (i2++ < monthNum);
@@ -10500,8 +10407,8 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10500
10407
  };
10501
10408
  const setReachedYearMonthInfo = (current) => {
10502
10409
  const currentMonthsData = monthsData[current];
10503
- const [year, month] = currentMonthsData.curData;
10504
10410
  if (currentMonthsData.title === yearMonthTitle) return;
10411
+ const [year, month] = currentMonthsData.curData;
10505
10412
  onPageChange && onPageChange([year, month, `${year}-${month}`]);
10506
10413
  setYearMonthTitle(currentMonthsData.title);
10507
10414
  };
@@ -10527,57 +10434,54 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10527
10434
  setTranslateY(monthsData[start2].scrollTop);
10528
10435
  setReachedYearMonthInfo(current);
10529
10436
  };
10530
- const getMonthNum = () => {
10531
- let monthNum = Number(endDates[1]) - Number(startDates[1]);
10532
- const yearNum = Number(endDates[0]) - Number(startDates[0]);
10533
- if (yearNum > 0) {
10534
- monthNum += 12 * yearNum;
10535
- }
10536
- if (monthNum <= 0) {
10537
- monthNum = 1;
10538
- }
10539
- setMonthsNum(monthNum);
10540
- return monthNum;
10541
- };
10542
10437
  const setDefaultDate = () => {
10543
10438
  let defaultData = [];
10544
- if (type4 === "range" && Array.isArray(currentDate)) {
10545
- if (currentDate.length > 0) {
10546
- if (propStartDate && Utils.compareDate(currentDate[0], propStartDate)) {
10547
- currentDate.splice(0, 1, propStartDate);
10439
+ if (type4 === "single" && typeof currentDate === "string") {
10440
+ if (!currentDate.length) {
10441
+ return defaultData;
10442
+ }
10443
+ if (compareDate(currentDate, propStartDate)) {
10444
+ defaultData = [...splitDate(propStartDate)];
10445
+ } else if (!compareDate(currentDate, propEndDate)) {
10446
+ defaultData = [...splitDate(propEndDate)];
10447
+ } else {
10448
+ defaultData = [...splitDate(currentDate)];
10449
+ }
10450
+ return defaultData;
10451
+ }
10452
+ if (Array.isArray(currentDate) && currentDate.length) {
10453
+ if (type4 === "range") {
10454
+ if (compareDate(currentDate[0], propStartDate)) {
10455
+ currentDate[0] = propStartDate;
10548
10456
  }
10549
- if (propEndDate && Utils.compareDate(propEndDate, currentDate[1])) {
10550
- currentDate.splice(1, 1, propEndDate);
10457
+ if (compareDate(propEndDate, currentDate[1])) {
10458
+ currentDate[1] = propEndDate;
10551
10459
  }
10552
10460
  defaultData = [
10553
10461
  ...splitDate(currentDate[0]),
10554
10462
  ...splitDate(currentDate[1])
10555
10463
  ];
10556
- }
10557
- } else if (type4 === "multiple" && Array.isArray(currentDate)) {
10558
- if (currentDate.length > 0) {
10464
+ } else if (type4 === "multiple") {
10559
10465
  const defaultArr = [];
10560
10466
  const obj = {};
10561
10467
  currentDate.forEach((item) => {
10562
- if (propStartDate && !Utils.compareDate(item, propStartDate) && propEndDate && !Utils.compareDate(propEndDate, item)) {
10468
+ if (!compareDate(item, propStartDate) && !compareDate(propEndDate, item)) {
10563
10469
  if (!Object.hasOwnProperty.call(obj, item)) {
10564
10470
  defaultArr.push(item);
10565
10471
  obj[item] = item;
10566
10472
  }
10567
10473
  }
10568
10474
  });
10569
- currentDate.splice(0) && currentDate.push(...defaultArr);
10475
+ currentDate.splice(0, currentDate.length, ...defaultArr);
10570
10476
  defaultData = [...splitDate(defaultArr[0])];
10571
- }
10572
- } else if (type4 === "week" && Array.isArray(currentDate)) {
10573
- if (currentDate.length > 0) {
10477
+ } else if (type4 === "week") {
10574
10478
  const [y, m2, d2] = splitDate(currentDate[0]);
10575
- const weekArr = Utils.getWeekDate(y, m2, d2, firstDayOfWeek);
10576
- currentDate.splice(0) && currentDate.push(...weekArr);
10577
- if (propStartDate && Utils.compareDate(currentDate[0], propStartDate)) {
10479
+ const weekArr = getWeekDate(y, m2, d2, firstDayOfWeek);
10480
+ currentDate.splice(0, currentDate.length, ...weekArr);
10481
+ if (compareDate(currentDate[0], propStartDate)) {
10578
10482
  currentDate.splice(0, 1, propStartDate);
10579
10483
  }
10580
- if (propEndDate && Utils.compareDate(propEndDate, currentDate[1])) {
10484
+ if (compareDate(propEndDate, currentDate[1])) {
10581
10485
  currentDate.splice(1, 1, propEndDate);
10582
10486
  }
10583
10487
  defaultData = [
@@ -10585,18 +10489,6 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10585
10489
  ...splitDate(currentDate[1])
10586
10490
  ];
10587
10491
  }
10588
- } else if (currentDate) {
10589
- if (currentDate.length > 0) {
10590
- if (propStartDate && Utils.compareDate(currentDate, propStartDate)) {
10591
- defaultData = [...splitDate(propStartDate)];
10592
- } else if (propEndDate && !Utils.compareDate(currentDate, propEndDate)) {
10593
- defaultData = [...splitDate(propEndDate)];
10594
- } else {
10595
- defaultData = [...splitDate(currentDate)];
10596
- }
10597
- } else {
10598
- defaultData = [];
10599
- }
10600
10492
  }
10601
10493
  return defaultData;
10602
10494
  };
@@ -10630,51 +10522,38 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10630
10522
  lastCurrent
10631
10523
  };
10632
10524
  };
10633
- const renderCurrentDate = () => {
10634
- const defaultData = setDefaultDate();
10635
- const current = getCurrentIndex(defaultData);
10636
- if (defaultData.length > 0) {
10637
- if (type4 === "range") {
10638
- chooseDay(
10639
- { day: defaultData[2], type: "active" },
10640
- monthsData[current.current],
10641
- true
10642
- );
10643
- chooseDay(
10644
- { day: defaultData[5], type: "active" },
10645
- monthsData[current.lastCurrent],
10646
- true
10647
- );
10648
- } else if (type4 === "week") {
10649
- chooseDay(
10650
- { day: defaultData[2], type: "curr" },
10651
- monthsData[current.current],
10652
- true
10525
+ const renderCurrentDate = (defaultData, current) => {
10526
+ if (!defaultData.length) return;
10527
+ const date4 = monthsData[current.current];
10528
+ if (type4 === "range") {
10529
+ handleDayClick({ day: defaultData[2], type: "active" }, date4);
10530
+ handleDayClick(
10531
+ { day: defaultData[5], type: "active" },
10532
+ monthsData[current.lastCurrent]
10533
+ );
10534
+ } else if (type4 === "week") {
10535
+ handleDayClick({ day: defaultData[2], type: "curr" }, date4);
10536
+ } else if (type4 === "multiple") {
10537
+ [...currentDate].forEach((item) => {
10538
+ const dateArr = splitDate(item);
10539
+ let currentIndex = current.current;
10540
+ currentIndex = monthsData.findIndex(
10541
+ (item2) => item2.title === monthTitle(dateArr[0], dateArr[1])
10653
10542
  );
10654
- } else if (type4 === "multiple") {
10655
- [...currentDate].forEach((item) => {
10656
- const dateArr = splitDate(item);
10657
- let currentIndex = current.current;
10658
- monthsData.forEach((item2, index) => {
10659
- if (item2.title === monthTitle(dateArr[0], dateArr[1])) {
10660
- currentIndex = index;
10661
- }
10662
- });
10663
- chooseDay(
10664
- { day: dateArr[2], type: "active" },
10665
- monthsData[currentIndex],
10666
- true
10667
- );
10668
- });
10669
- } else {
10670
- chooseDay(
10671
- { day: defaultData[2], type: "active" },
10672
- monthsData[current.current],
10673
- true
10543
+ handleDayClick(
10544
+ { day: dateArr[2], type: "active" },
10545
+ monthsData[currentIndex]
10674
10546
  );
10675
- }
10547
+ });
10548
+ } else {
10549
+ handleDayClick({ day: defaultData[2], type: "active" }, date4);
10676
10550
  }
10677
- return current.current;
10551
+ };
10552
+ const getMonthsPanel = () => {
10553
+ return monthsPanel.current;
10554
+ };
10555
+ const getMonthsRef = () => {
10556
+ return monthsRef.current;
10678
10557
  };
10679
10558
  const requestAniFrameFunc = (current, monthNum) => {
10680
10559
  const lastItem = monthsData[monthsData.length - 1];
@@ -10688,12 +10567,27 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10688
10567
  });
10689
10568
  setAvgHeight(Math.floor(containerHeight / (monthNum + 1)));
10690
10569
  };
10570
+ const getMonthNum = () => {
10571
+ let monthNum = Number(endDates[1]) - Number(startDates[1]);
10572
+ const yearNum = Number(endDates[0]) - Number(startDates[0]);
10573
+ if (yearNum > 0) {
10574
+ monthNum += 12 * yearNum;
10575
+ }
10576
+ if (monthNum <= 0) {
10577
+ monthNum = 1;
10578
+ }
10579
+ setMonthsNum(monthNum);
10580
+ return monthNum;
10581
+ };
10691
10582
  const initData = () => {
10692
10583
  const monthNum = getMonthNum();
10693
10584
  getMonthData(startDates, monthNum);
10694
- const current = renderCurrentDate();
10695
- setDefaultRange(monthNum, current);
10696
- requestAniFrameFunc(current, monthNum);
10585
+ const defaultData = setDefaultDate();
10586
+ const current = getCurrentIndex(defaultData);
10587
+ const currentIndex = current.current;
10588
+ renderCurrentDate(defaultData, current);
10589
+ setDefaultRange(monthNum, currentIndex);
10590
+ requestAniFrameFunc(currentIndex, monthNum);
10697
10591
  };
10698
10592
  useEffect(() => {
10699
10593
  initData();
@@ -10710,9 +10604,9 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10710
10604
  popup && resetRender();
10711
10605
  }, [currentDate]);
10712
10606
  const scrollToDate = (date4) => {
10713
- if (Utils.compareDate(date4, propStartDate)) {
10607
+ if (compareDate(date4, propStartDate)) {
10714
10608
  date4 = propStartDate;
10715
- } else if (!Utils.compareDate(date4, propEndDate)) {
10609
+ } else if (!compareDate(date4, propEndDate)) {
10716
10610
  date4 = propEndDate;
10717
10611
  }
10718
10612
  const dateArr = splitDate(date4);
@@ -10754,16 +10648,10 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10754
10648
  const nextTop = monthsData[current + 1].scrollTop;
10755
10649
  const nextHeight = monthsData[current + 1].cssHeight;
10756
10650
  if (current === 0) {
10757
- if (scrollTop >= nextTop) {
10758
- current += 1;
10759
- }
10651
+ if (scrollTop >= nextTop) current += 1;
10760
10652
  } else if (current > 0 && current < monthsNum - 1) {
10761
- if (scrollTop >= nextTop) {
10762
- current += 1;
10763
- }
10764
- if (scrollTop < monthsData[current].scrollTop) {
10765
- current -= 1;
10766
- }
10653
+ if (scrollTop >= nextTop) current += 1;
10654
+ if (scrollTop < monthsData[current].scrollTop) current -= 1;
10767
10655
  } else {
10768
10656
  const viewPosition = Math.round(scrollTop + viewHeight);
10769
10657
  if (current + 1 <= monthsNum && viewPosition >= nextTop + nextHeight) {
@@ -10778,86 +10666,85 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10778
10666
  React__default.useImperativeHandle(ref, () => ({
10779
10667
  scrollToDate
10780
10668
  }));
10669
+ const isDisable = (day, month) => {
10670
+ if (day.type !== "active") return true;
10671
+ const dateStr = getCurrDate(day, month);
10672
+ if (compareDate(dateStr, propStartDate)) return true;
10673
+ if (compareDate(propEndDate, dateStr)) return true;
10674
+ return false;
10675
+ };
10781
10676
  const getClasses = (day, month) => {
10782
10677
  const dateStr = getCurrDate(day, month);
10783
- if (day.type === "active") {
10784
- if (propStartDate && Utils.compareDate(dateStr, propStartDate) || propEndDate && Utils.compareDate(propEndDate, dateStr)) {
10785
- return `${dayPrefix}-disabled`;
10786
- }
10787
- if (type4 === "range" || type4 === "week") {
10788
- if (isStart(dateStr, currentDate) || isEnd(dateStr, currentDate)) {
10789
- return `${dayPrefix}-active ${isStart(dateStr, currentDate) ? "active-start" : ""} ${isEnd(dateStr, currentDate) ? "active-end" : ""}`;
10790
- }
10791
- if (Array.isArray(currentDate) && Object.values(currentDate).length === 2 && Utils.compareDate(currentDate[0], dateStr) && Utils.compareDate(dateStr, currentDate[1])) {
10792
- if (disableDate(day)) {
10793
- return `${dayPrefix}-choose-disabled`;
10794
- }
10795
- return `${dayPrefix}-choose`;
10796
- }
10797
- } else if (type4 === "multiple" && isMultiple(dateStr, currentDate) || !Array.isArray(currentDate) && Utils.isEqual(currentDate, dateStr)) {
10798
- return `${dayPrefix}-active`;
10678
+ if (isDisable(day, month)) return `${dayPrefix}-disabled`;
10679
+ const activeCls = `${dayPrefix}-active`;
10680
+ if (type4 === "range" || type4 === "week") {
10681
+ if (isStart(dateStr, currentDate))
10682
+ return `${activeCls} active-start`;
10683
+ if (isEnd(dateStr, currentDate)) {
10684
+ return `${activeCls} active-end`;
10799
10685
  }
10800
- if (disableDate(day)) {
10801
- return `${dayPrefix}-disabled`;
10686
+ if (currentDate.length === 2 && compareDate(currentDate[0], dateStr) && compareDate(dateStr, currentDate[1])) {
10687
+ return disableDate(day) ? `${dayPrefix}-choose-disabled` : `${dayPrefix}-choose`;
10802
10688
  }
10803
- return null;
10689
+ } else if (type4 === "multiple" && isMultiple(dateStr, currentDate) || type4 === "single" && isEqual(currentDate, dateStr)) {
10690
+ return activeCls;
10804
10691
  }
10805
- return `${dayPrefix}-disabled`;
10692
+ if (disableDate(day)) return `${dayPrefix}-disabled`;
10693
+ return null;
10806
10694
  };
10807
- const chooseDay = (day, month, isFirst) => {
10695
+ const handleDayClick = (day, month, isFirst = true) => {
10808
10696
  if (getClasses(day, month) === `${dayPrefix}-disabled`) {
10809
10697
  return;
10810
10698
  }
10811
10699
  const days = [...month.curData];
10812
10700
  const [y, m2] = month.curData;
10813
- days[2] = typeof day.day === "number" ? Utils.getNumTwoBit(day.day) : day.day;
10701
+ days[2] = typeof day.day === "number" ? getNumTwoBit(day.day) : day.day;
10814
10702
  days[3] = `${days[0]}/${days[1]}/${days[2]}`;
10815
- days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
10703
+ days[4] = getWhatDay(+days[0], +days[1], +days[2]);
10704
+ const newDate = days[3];
10816
10705
  if (type4 === "multiple") {
10817
- if (currentDate.length > 0) {
10818
- let hasIndex = "";
10819
- currentDate.forEach((item, index) => {
10820
- if (item === days[3]) {
10821
- hasIndex = index;
10706
+ if (Array.isArray(currentDate)) {
10707
+ if (currentDate.length > 0) {
10708
+ const hasIndex = currentDate.findIndex((item) => item === newDate);
10709
+ if (isFirst) {
10710
+ state.currDateArray.push([...days]);
10711
+ } else if (hasIndex > -1) {
10712
+ currentDate.splice(hasIndex, 1);
10713
+ state.currDateArray.splice(hasIndex, 1);
10714
+ } else {
10715
+ currentDate.push(newDate);
10716
+ state.currDateArray.push([...days]);
10822
10717
  }
10823
- });
10824
- if (isFirst) {
10825
- state.currDateArray.push([...days]);
10826
- } else if (hasIndex !== "") {
10827
- currentDate.splice(hasIndex, 1);
10828
- state.currDateArray.splice(hasIndex, 1);
10829
10718
  } else {
10830
- currentDate.push(days[3]);
10831
- state.currDateArray.push([...days]);
10719
+ currentDate.push(newDate);
10720
+ state.currDateArray = [[...days]];
10832
10721
  }
10833
- } else {
10834
- currentDate.push(days[3]);
10835
- state.currDateArray = [[...days]];
10836
10722
  }
10837
10723
  } else if (type4 === "range") {
10838
- const curDataLength = Object.values(currentDate).length;
10839
- if (curDataLength === 2 || curDataLength === 0) {
10840
- Array.isArray(currentDate) && currentDate.splice(0) && currentDate.push(days[3]);
10841
- state.currDateArray = [[...days]];
10842
- } else if (Utils.compareDate(currentDate[0], days[3])) {
10843
- Array.isArray(currentDate) && currentDate.push(days[3]);
10844
- state.currDateArray = [...state.currDateArray, [...days]];
10845
- } else {
10846
- Array.isArray(currentDate) && currentDate.unshift(days[3]);
10847
- state.currDateArray = [[...days], ...state.currDateArray];
10724
+ if (Array.isArray(currentDate)) {
10725
+ if (currentDate.length === 2 || currentDate.length === 0) {
10726
+ currentDate.splice(0, currentDate.length, newDate);
10727
+ state.currDateArray = [[...days]];
10728
+ } else if (compareDate(currentDate[0], newDate)) {
10729
+ currentDate.push(newDate);
10730
+ state.currDateArray = [...state.currDateArray, [...days]];
10731
+ } else {
10732
+ currentDate.unshift(newDate);
10733
+ state.currDateArray = [[...days], ...state.currDateArray];
10734
+ }
10848
10735
  }
10849
10736
  } else if (type4 === "week") {
10850
- const weekArr = Utils.getWeekDate(y, m2, `${day.day}`, firstDayOfWeek);
10851
- if (propStartDate && Utils.compareDate(weekArr[0], propStartDate)) {
10852
- weekArr.splice(0, 1, propStartDate);
10737
+ const weekArr = getWeekDate(y, m2, `${day.day}`, firstDayOfWeek);
10738
+ if (compareDate(weekArr[0], propStartDate)) {
10739
+ weekArr[0] = propStartDate;
10853
10740
  }
10854
- if (propEndDate && Utils.compareDate(propEndDate, weekArr[1])) {
10855
- weekArr.splice(1, 1, propEndDate);
10741
+ if (compareDate(propEndDate, weekArr[1])) {
10742
+ weekArr[1] = propEndDate;
10856
10743
  }
10857
- Array.isArray(currentDate) && currentDate.splice(0) && currentDate.push(...weekArr);
10744
+ currentDate.splice(0, currentDate.length, ...weekArr);
10858
10745
  state.currDateArray = [
10859
- Utils.formatResultDate(weekArr[0]),
10860
- Utils.formatResultDate(weekArr[1])
10746
+ formatResultDate(weekArr[0]),
10747
+ formatResultDate(weekArr[1])
10861
10748
  ];
10862
10749
  } else {
10863
10750
  setCurrentDate(days[3]);
@@ -10881,11 +10768,11 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10881
10768
  }
10882
10769
  };
10883
10770
  const classes = classNames(
10771
+ classPrefix2,
10884
10772
  {
10885
10773
  [`${classPrefix2}-title`]: !popup,
10886
10774
  [`${classPrefix2}-nofooter`]: !!autoBackfill
10887
10775
  },
10888
- classPrefix2,
10889
10776
  className
10890
10777
  );
10891
10778
  const headerClasses = classNames({
@@ -10901,6 +10788,36 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10901
10788
  const renderHeader = () => {
10902
10789
  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))));
10903
10790
  };
10791
+ const renderItem = (month, day, index) => {
10792
+ const startTip = isStartTip(day, month);
10793
+ const endTip = isEndTip(day, month);
10794
+ const noStartNorEnd = !startTip && !endTip;
10795
+ return /* @__PURE__ */ React__default.createElement(
10796
+ "div",
10797
+ {
10798
+ className: [`${classPrefix2}-day`, getClasses(day, month)].join(" "),
10799
+ onClick: () => handleDayClick(day, month, false),
10800
+ key: index
10801
+ },
10802
+ /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-day` }, renderDay ? renderDay(day) : day.day),
10803
+ !startTip && renderDayTop && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info-top` }, renderDayTop(day)),
10804
+ noStartNorEnd && renderDayBottom && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info-bottom` }, renderDayBottom(day)),
10805
+ noStartNorEnd && !renderDayBottom && showToday && isCurrDay(month, day.day) && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info-curr` }, locale.calendaritem.today),
10806
+ startTip && /* @__PURE__ */ React__default.createElement(
10807
+ "div",
10808
+ {
10809
+ className: `${classPrefix2}-day-info ${isStartAndEnd(currentDate) ? `${classPrefix2}-day-info-top` : ""}`
10810
+ },
10811
+ startText || locale.calendaritem.start
10812
+ ),
10813
+ endTip && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info` }, endText || locale.calendaritem.end)
10814
+ );
10815
+ };
10816
+ const renderPanel = (month, key) => {
10817
+ 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(
10818
+ (day, i2) => renderItem(month, day, i2)
10819
+ )));
10820
+ };
10904
10821
  const renderContent = () => {
10905
10822
  return /* @__PURE__ */ React__default.createElement(
10906
10823
  "div",
@@ -10917,31 +10834,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
10917
10834
  style: { transform: `translateY(${translateY}px)` }
10918
10835
  },
10919
10836
  monthsData.slice(monthDefaultRange[0], monthDefaultRange[1]).map((month, key) => {
10920
- 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(
10921
- "div",
10922
- {
10923
- className: [
10924
- `${classPrefix2}-day`,
10925
- getClasses(day, month)
10926
- ].join(" "),
10927
- onClick: () => {
10928
- chooseDay(day, month);
10929
- },
10930
- key: i2
10931
- },
10932
- /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-day` }, renderDay ? renderDay(day) : day.day),
10933
- !isStartTip(day, month) && renderDayTop && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info-top` }, renderDayTop(day)),
10934
- !isStartTip(day, month) && !isEndTip(day, month) && renderDayBottom && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info-bottom` }, renderDayBottom(day)),
10935
- !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),
10936
- isStartTip(day, month) && /* @__PURE__ */ React__default.createElement(
10937
- "div",
10938
- {
10939
- className: `${classPrefix2}-day-info ${isStartAndEnd(currentDate) ? `${classPrefix2}-day-info-top` : ""}`
10940
- },
10941
- startText || locale.calendaritem.start
10942
- ),
10943
- isEndTip(day, month) && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info` }, endText || locale.calendaritem.end)
10944
- ))));
10837
+ return renderPanel(month, key);
10945
10838
  })
10946
10839
  ))
10947
10840
  );
@@ -10960,8 +10853,8 @@ const defaultProps$11 = {
10960
10853
  visible: false,
10961
10854
  title: "",
10962
10855
  defaultValue: "",
10963
- startDate: Utils.getDay(0),
10964
- endDate: Utils.getDay(365),
10856
+ startDate: getDateString(0),
10857
+ endDate: getDateString(365),
10965
10858
  showToday: true,
10966
10859
  startText: "",
10967
10860
  endText: "",
@@ -11160,12 +11053,12 @@ const getPrevMonthDays = (year, month, firstDayOfWeek) => {
11160
11053
  prevMonth = 12;
11161
11054
  prevYear -= 1;
11162
11055
  }
11163
- let days = Utils.getMonthPreDay(year, month);
11056
+ let days = getMonthPreDay(year, month);
11164
11057
  days -= firstDayOfWeek;
11165
11058
  if (days >= 7) {
11166
11059
  days -= 7;
11167
11060
  }
11168
- const preDates = Utils.getMonthDays(`${prevYear}`, `${prevMonth}`);
11061
+ const preDates = getMonthDays(`${prevYear}`, `${prevMonth}`);
11169
11062
  const months = Array.from(Array(preDates), (_, k) => {
11170
11063
  return {
11171
11064
  type: "prev",
@@ -11177,7 +11070,7 @@ const getPrevMonthDays = (year, month, firstDayOfWeek) => {
11177
11070
  return months.slice(preDates - days);
11178
11071
  };
11179
11072
  const getCurrentMonthDays = (year, month) => {
11180
- const days = Utils.getMonthDays(`${year}`, `${month}`);
11073
+ const days = getMonthDays(`${year}`, `${month}`);
11181
11074
  return Array.from(Array(days), (_, k) => {
11182
11075
  return {
11183
11076
  type: "current",
@@ -19622,29 +19515,29 @@ const defaultProps$s = {
19622
19515
  onClick: (event) => {
19623
19516
  }
19624
19517
  };
19625
- const classPrefix$7 = `nut-animate`;
19518
+ const classPrefix$7 = "nut-animate";
19626
19519
  const Animate = (props) => {
19627
19520
  const { className, type: type4, action, loop: loop2, onClick, children, ...rest } = {
19628
19521
  ...defaultProps$s,
19629
19522
  ...props
19630
19523
  };
19631
19524
  const [clicked, setClicked] = useState(false);
19632
- const classes = classNames({
19633
- "nut-ani-container": true,
19634
- [`${classPrefix$7}-${type4}`]: action === "initial" || clicked ? type4 : false,
19635
- loop: loop2
19636
- });
19637
- const cls = classNames(classes, className);
19525
+ const classes = classNames(
19526
+ {
19527
+ "nut-ani-container": true,
19528
+ [`${classPrefix$7}-${type4}`]: action === "initial" || clicked,
19529
+ loop: loop2
19530
+ },
19531
+ className
19532
+ );
19638
19533
  const handleClick2 = (event) => {
19639
19534
  setClicked(true);
19640
19535
  if (!loop2) {
19641
- setTimeout(() => {
19642
- setClicked(false);
19643
- }, 1e3);
19536
+ setTimeout(() => setClicked(false), 1e3);
19644
19537
  }
19645
- onClick && onClick(event);
19538
+ onClick(event);
19646
19539
  };
19647
- return /* @__PURE__ */ React__default.createElement("div", { className: "nut-animate" }, /* @__PURE__ */ React__default.createElement("div", { className: cls, onClick: handleClick2, ...rest }, children));
19540
+ return /* @__PURE__ */ React__default.createElement("div", { className: "nut-animate" }, /* @__PURE__ */ React__default.createElement("div", { className: classes, onClick: handleClick2, ...rest }, children));
19648
19541
  };
19649
19542
  Animate.displayName = "NutAnimate";
19650
19543
  const defaultProps$r = {
@@ -21104,18 +20997,17 @@ const Swiper = React__default.forwardRef(
21104
20997
  const y = springs.y.get() / 100 * slideSize;
21105
20998
  return [-x, -y];
21106
20999
  },
21107
- triggerAllEvents: true,
21108
21000
  bounds: () => {
21109
21001
  if (loop2) return {};
21110
21002
  const slideSize = getSlideSize();
21111
- getSwiperSize();
21112
21003
  if (isVertical) {
21113
21004
  return { top: 0, bottom: (count - 1) * slideSize };
21114
21005
  }
21115
21006
  return { left: 0, right: (count - 1) * slideSize };
21116
21007
  },
21117
- preventDefault: true,
21118
21008
  rubberband: true,
21009
+ triggerAllEvents: true,
21010
+ preventScroll: isVertical,
21119
21011
  axis: isVertical ? "y" : "x",
21120
21012
  pointer: {
21121
21013
  touch: true
@@ -21174,8 +21066,8 @@ const Swiper = React__default.forwardRef(
21174
21066
  {
21175
21067
  ref: stageRef,
21176
21068
  className: classNames("nut-swiper-inner", {
21177
- "nut-swiper-inner-vertical": isVertical,
21178
- "nut-swiper-inner-horizontal": !isVertical
21069
+ [`${classPrefix2}-inner-vertical`]: isVertical,
21070
+ [`${classPrefix2}-inner-horizontal`]: !isVertical
21179
21071
  }),
21180
21072
  style: {
21181
21073
  ...props.slideSize ? { [isVertical ? "height" : "width"]: `${props.slideSize}px` } : {}
@@ -21187,7 +21079,11 @@ const Swiper = React__default.forwardRef(
21187
21079
  return /* @__PURE__ */ React__default.createElement(
21188
21080
  "div",
21189
21081
  {
21190
- className: classNames("nut-swiper", className),
21082
+ className: classNames(
21083
+ classPrefix2,
21084
+ `${classPrefix2}-canmove-${direction}`,
21085
+ className
21086
+ ),
21191
21087
  style,
21192
21088
  ref: swiperRef,
21193
21089
  ...bind()