@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.
@@ -2,7 +2,7 @@
2
2
  typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("react-dom")) : typeof define === "function" && define.amd ? define(["exports", "react", "react-dom"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.nutui = {}, global2.React, global2.ReactDOM));
3
3
  })(this, function(exports2, React, ReactDOM) {
4
4
  "use strict";/*!
5
- * @nutui/nutui-react v2.7.7 Fri Jan 24 2025 13:55:36 GMT+0800 (China Standard Time)
5
+ * @nutui/nutui-react v2.7.9 Fri Feb 21 2025 17:10:51 GMT+0800 (China Standard Time)
6
6
  * (c) 2023 @jdf2e.
7
7
  * Released under the MIT License.
8
8
  */
@@ -5308,7 +5308,7 @@
5308
5308
  num: (a) => typeof a === "number",
5309
5309
  und: (a) => a === void 0
5310
5310
  };
5311
- function isEqual(a, b) {
5311
+ function isEqual$1(a, b) {
5312
5312
  if (is.arr(a)) {
5313
5313
  if (!is.arr(b) || a.length !== b.length) return false;
5314
5314
  for (let i2 = 0; i2 < a.length; i2++) {
@@ -7172,12 +7172,12 @@
7172
7172
  to2 = from;
7173
7173
  }
7174
7174
  if (props.reverse) [to2, from] = [from, to2];
7175
- const hasFromChanged = !isEqual(from, prevFrom);
7175
+ const hasFromChanged = !isEqual$1(from, prevFrom);
7176
7176
  if (hasFromChanged) {
7177
7177
  anim.from = from;
7178
7178
  }
7179
7179
  from = getFluidValue(from);
7180
- const hasToChanged = !isEqual(to2, prevTo);
7180
+ const hasToChanged = !isEqual$1(to2, prevTo);
7181
7181
  if (hasToChanged) {
7182
7182
  this._focus(to2);
7183
7183
  }
@@ -7218,10 +7218,10 @@
7218
7218
  if (!started) {
7219
7219
  const hasValueChanged = reset || !hasAnimated(this) && hasFromChanged;
7220
7220
  if (hasToChanged || hasValueChanged) {
7221
- finished = isEqual(computeGoal(value), goal);
7221
+ finished = isEqual$1(computeGoal(value), goal);
7222
7222
  started = !finished;
7223
7223
  }
7224
- if (!isEqual(anim.immediate, immediate) && !immediate || !isEqual(config2.decay, decay) || !isEqual(config2.velocity, velocity)) {
7224
+ if (!isEqual$1(anim.immediate, immediate) && !immediate || !isEqual$1(config2.decay, decay) || !isEqual$1(config2.velocity, velocity)) {
7225
7225
  started = true;
7226
7226
  }
7227
7227
  }
@@ -7312,7 +7312,7 @@
7312
7312
  const value = getFluidValue(arg);
7313
7313
  if (!is.und(value)) {
7314
7314
  const oldNode = getAnimated(this);
7315
- if (!oldNode || !isEqual(value, oldNode.getValue())) {
7315
+ if (!oldNode || !isEqual$1(value, oldNode.getValue())) {
7316
7316
  const nodeType = getAnimatedType(value);
7317
7317
  if (!oldNode || oldNode.constructor != nodeType) {
7318
7318
  setAnimated(this, nodeType.create(value));
@@ -7389,7 +7389,7 @@
7389
7389
  function checkFinished(target, to2) {
7390
7390
  const goal = computeGoal(to2);
7391
7391
  const value = computeGoal(target.get());
7392
- return isEqual(value, goal);
7392
+ return isEqual$1(value, goal);
7393
7393
  }
7394
7394
  function createLoopUpdate(props, loop2 = props.loop, to2 = props.to) {
7395
7395
  let loopRet = callProp(loop2);
@@ -7963,7 +7963,7 @@
7963
7963
  advance(_dt) {
7964
7964
  const value = this._get();
7965
7965
  const oldValue = this.get();
7966
- if (!isEqual(value, oldValue)) {
7966
+ if (!isEqual$1(value, oldValue)) {
7967
7967
  getAnimated(this).setValue(value);
7968
7968
  this._onChange(value, this.idle);
7969
7969
  }
@@ -10124,189 +10124,106 @@
10124
10124
  };
10125
10125
  const Address = React.forwardRef(InternalAddress);
10126
10126
  Address.displayName = "NutAddress";
10127
- const Utils = {
10128
- /**
10129
- * 是否为闫年
10130
- * @return {Boolse} true|false
10131
- */
10132
- isLeapYear(y) {
10133
- return y % 4 === 0 && y % 100 !== 0 || y % 400 === 0;
10134
- },
10135
- /**
10136
- * 返回星期数
10137
- * @return {String}
10138
- */
10139
- getWhatDay(year, month, day) {
10140
- const date = /* @__PURE__ */ new Date(`${year}/${month}/${day}`);
10141
- const index = date.getDay();
10142
- const dayNames = [
10143
- "星期日",
10144
- "星期一",
10145
- "星期二",
10146
- "星期三",
10147
- "星期四",
10148
- "星期五",
10149
- "星期六"
10150
- ];
10151
- return dayNames[index];
10152
- },
10153
- /**
10154
- * 返回上一个月在当前面板中的天数
10155
- * @return {Number}
10156
- */
10157
- getMonthPreDay(year, month) {
10158
- const date = /* @__PURE__ */ new Date(`${year}/${month}/01`);
10159
- let day = date.getDay();
10160
- if (day === 0) {
10161
- day = 7;
10162
- }
10163
- return day;
10164
- },
10165
- /**
10166
- * 返回月份天数
10167
- * @return {Number}
10168
- */
10169
- getMonthDays(year, month) {
10170
- if (/^0/.test(month)) {
10171
- month = month.split("")[1];
10172
- }
10173
- return [
10174
- 0,
10175
- 31,
10176
- this.isLeapYear(Number(year)) ? 29 : 28,
10177
- 31,
10178
- 30,
10179
- 31,
10180
- 30,
10181
- 31,
10182
- 31,
10183
- 30,
10184
- 31,
10185
- 30,
10186
- 31
10187
- ][month];
10188
- },
10189
- /**
10190
- * 补齐数字位数
10191
- * @return {string}
10192
- */
10193
- getNumTwoBit(n2) {
10194
- n2 = Number(n2);
10195
- return (n2 > 9 ? "" : "0") + n2;
10196
- },
10197
- /**
10198
- * 日期对象转成字符串
10199
- * @return {string}
10200
- */
10201
- date2Str(date, split) {
10202
- split = split || "-";
10203
- const y = date.getFullYear();
10204
- const m2 = this.getNumTwoBit(date.getMonth() + 1);
10205
- const d2 = this.getNumTwoBit(date.getDate());
10206
- return [y, m2, d2].join(split);
10207
- },
10208
- /**
10209
- * 返回日期格式字符串
10210
- * @param {Number} 0返回今天的日期、1返回明天的日期,2返回后天得日期,依次类推
10211
- * @return {string} '2014-12-31'
10212
- */
10213
- getDay(i2) {
10214
- i2 = i2 || 0;
10215
- let date = /* @__PURE__ */ new Date();
10216
- const diff = i2 * (1e3 * 60 * 60 * 24);
10217
- date = new Date(date.getTime() + diff);
10218
- return this.date2Str(date);
10219
- },
10220
- /**
10221
- * 时间比较
10222
- * @return {Boolean}
10223
- */
10224
- compareDate(date1, date22) {
10225
- const startTime = new Date(date1.replace("-", "/").replace("-", "/"));
10226
- const endTime = new Date(date22.replace("-", "/").replace("-", "/"));
10227
- if (startTime >= endTime) {
10228
- return false;
10229
- }
10230
- return true;
10231
- },
10232
- /**
10233
- * 时间是否相等
10234
- * @return {Boolean}
10235
- */
10236
- isEqual(date1, date22) {
10237
- const startTime = new Date((date1 || "").replace(/-/g, "/")).getTime();
10238
- const endTime = new Date(date22.replace(/-/g, "/")).getTime();
10239
- if (startTime === endTime) {
10240
- return true;
10241
- }
10242
- return false;
10243
- },
10244
- getMonthWeek(year, month, date, firstDayOfWeek = 0) {
10245
- const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date));
10246
- let w = dateNow.getDay();
10247
- const d2 = dateNow.getDate();
10248
- let remainder = 6 - w;
10249
- if (firstDayOfWeek !== 0) {
10250
- w = w === 0 ? 7 : w;
10251
- remainder = 7 - w;
10252
- }
10253
- return Math.ceil((d2 + remainder) / 7);
10254
- },
10255
- getYearWeek(year, month, date, firstDayOfWeek = 0) {
10256
- const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date));
10257
- const dateFirst = new Date(Number(year), 0, 1);
10258
- const dataNumber = Math.round(
10259
- (dateNow.valueOf() - dateFirst.valueOf()) / 864e5
10260
- );
10261
- return Math.ceil((dataNumber + (dateFirst.getDay() + 1 - 1)) / 7);
10262
- },
10263
- getWeekDate(year, month, date, firstDayOfWeek = 0) {
10264
- const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date));
10265
- const nowTime = dateNow.getTime();
10266
- let day = dateNow.getDay();
10267
- if (firstDayOfWeek === 0) {
10268
- const oneDayTime2 = 24 * 60 * 60 * 1e3;
10269
- const SundayTime2 = nowTime - day * oneDayTime2;
10270
- const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
10271
- const sunday2 = this.date2Str(new Date(SundayTime2));
10272
- const saturday = this.date2Str(new Date(SaturdayTime));
10273
- return [sunday2, saturday];
10274
- }
10275
- day = day === 0 ? 7 : day;
10276
- const oneDayTime = 24 * 60 * 60 * 1e3;
10277
- const MondayTime = nowTime - (day - 1) * oneDayTime;
10278
- const SundayTime = nowTime + (7 - day) * oneDayTime;
10279
- const monday = this.date2Str(new Date(MondayTime));
10280
- const sunday = this.date2Str(new Date(SundayTime));
10281
- return [monday, sunday];
10282
- },
10283
- formatResultDate(date) {
10284
- const days = [...date.split("-")];
10285
- days[2] = Utils.getNumTwoBit(Number(days[2]));
10286
- days[3] = `${days[0]}-${days[1]}-${days[2]}`;
10287
- days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
10288
- return days;
10127
+ const isLeapYear = (y) => {
10128
+ return y % 4 === 0 && y % 100 !== 0 || y % 400 === 0;
10129
+ };
10130
+ const getWhatDay = (year, month, day) => {
10131
+ const date = new Date(year, month - 1, day);
10132
+ const dayNames = [
10133
+ "星期日",
10134
+ "星期一",
10135
+ "星期二",
10136
+ "星期三",
10137
+ "星期四",
10138
+ "星期五",
10139
+ "星期六"
10140
+ ];
10141
+ return dayNames[date.getDay()];
10142
+ };
10143
+ const getMonthPreDay = (year, month) => {
10144
+ const day = new Date(year, month - 1, 1).getDay();
10145
+ return day === 0 ? 7 : day;
10146
+ };
10147
+ const getMonthDays = (year, month) => {
10148
+ if (/^0/.test(month)) {
10149
+ month = month.split("")[1];
10289
10150
  }
10151
+ return [
10152
+ 0,
10153
+ 31,
10154
+ isLeapYear(Number(year)) ? 29 : 28,
10155
+ 31,
10156
+ 30,
10157
+ 31,
10158
+ 30,
10159
+ 31,
10160
+ 31,
10161
+ 30,
10162
+ 31,
10163
+ 30,
10164
+ 31
10165
+ ][month];
10166
+ };
10167
+ const getNumTwoBit = (n2) => {
10168
+ return n2 > 9 ? `${n2}` : `0${n2}`;
10169
+ };
10170
+ const date2Str = (date, split = "-") => {
10171
+ const y = date.getFullYear();
10172
+ const m2 = getNumTwoBit(date.getMonth() + 1);
10173
+ const d2 = getNumTwoBit(date.getDate());
10174
+ return [y, m2, d2].join(split);
10175
+ };
10176
+ const getDateString = (offset = 0) => {
10177
+ const date = /* @__PURE__ */ new Date();
10178
+ date.setDate(date.getDate() + offset);
10179
+ return date2Str(date, "-");
10180
+ };
10181
+ const compareDate = (date1, date22) => {
10182
+ const startTime = new Date(date1.replace("-", "/").replace("-", "/"));
10183
+ const endTime = new Date(date22.replace("-", "/").replace("-", "/"));
10184
+ return startTime < endTime;
10185
+ };
10186
+ const isEqual = (date1, date22) => {
10187
+ const startTime = new Date((date1 || "").replace(/-/g, "/")).getTime();
10188
+ const endTime = new Date(date22.replace(/-/g, "/")).getTime();
10189
+ return startTime === endTime;
10190
+ };
10191
+ const getWeekDate = (year, month, date, firstDayOfWeek = 0) => {
10192
+ const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date));
10193
+ const nowTime = dateNow.getTime();
10194
+ let day = dateNow.getDay();
10195
+ if (firstDayOfWeek === 0) {
10196
+ const oneDayTime2 = 24 * 60 * 60 * 1e3;
10197
+ const SundayTime2 = nowTime - day * oneDayTime2;
10198
+ const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
10199
+ const sunday2 = date2Str(new Date(SundayTime2));
10200
+ const saturday = date2Str(new Date(SaturdayTime));
10201
+ return [sunday2, saturday];
10202
+ }
10203
+ day = day === 0 ? 7 : day;
10204
+ const oneDayTime = 24 * 60 * 60 * 1e3;
10205
+ const MondayTime = nowTime - (day - 1) * oneDayTime;
10206
+ const SundayTime = nowTime + (7 - day) * oneDayTime;
10207
+ const monday = date2Str(new Date(MondayTime));
10208
+ const sunday = date2Str(new Date(SundayTime));
10209
+ return [monday, sunday];
10210
+ };
10211
+ const formatResultDate = (date) => {
10212
+ const [year, month, day] = [...date.split("-")];
10213
+ const formatterDay = getNumTwoBit(Number(day));
10214
+ const formatterDate = `${year}-${month}-${day}`;
10215
+ const dayOfWeek = getWhatDay(Number(year), Number(month), Number(day));
10216
+ return [year, month, formatterDay, formatterDate, dayOfWeek];
10290
10217
  };
10291
10218
  const getCurrMonthData = (type, year, month) => {
10292
- switch (type) {
10293
- case "prev":
10294
- month === 1 && (year -= 1);
10295
- month = month === 1 ? 12 : --month;
10296
- break;
10297
- case "next":
10298
- month === 12 && (year += 1);
10299
- month = month === 12 ? 1 : ++month;
10300
- break;
10219
+ {
10220
+ month === 12 && (year += 1);
10221
+ month = month === 12 ? 1 : ++month;
10301
10222
  }
10302
- return [
10303
- year,
10304
- Utils.getNumTwoBit(month),
10305
- Utils.getMonthDays(String(year), String(month))
10306
- ];
10223
+ return [year, getNumTwoBit(month), getMonthDays(String(year), String(month))];
10307
10224
  };
10308
10225
  const getDaysStatus = (type, year, month) => {
10309
- let days = Utils.getMonthDays(`${year}`, `${month}`);
10226
+ let days = getMonthDays(`${year}`, `${month}`);
10310
10227
  return Array.from(Array(days), (v, k) => {
10311
10228
  return {
10312
10229
  day: k + 1,
@@ -10323,12 +10240,12 @@
10323
10240
  preMonth = 12;
10324
10241
  preYear += 1;
10325
10242
  }
10326
- let days = Utils.getMonthPreDay(+year, +month);
10243
+ let days = getMonthPreDay(+year, +month);
10327
10244
  days -= firstDayOfWeek;
10328
10245
  if (days >= 7) {
10329
10246
  days -= 7;
10330
10247
  }
10331
- const preDates = Utils.getMonthDays(`${preYear}`, `${preMonth}`);
10248
+ const preDates = getMonthDays(`${preYear}`, `${preMonth}`);
10332
10249
  const months = Array.from(Array(preDates), (v, k) => {
10333
10250
  return {
10334
10251
  day: k + 1,
@@ -10346,28 +10263,26 @@
10346
10263
  const isMultiple = (day, days) => {
10347
10264
  if (days.length > 0) {
10348
10265
  return days.some((item) => {
10349
- return Utils.isEqual(item, day);
10266
+ return isEqual(item, day);
10350
10267
  });
10351
10268
  }
10352
10269
  return false;
10353
10270
  };
10354
10271
  const isCurrDay = (month, day) => {
10355
10272
  const date = `${month.curData[0]}/${month.curData[1]}/${day}`;
10356
- return Utils.isEqual(date, Utils.date2Str(/* @__PURE__ */ new Date(), "/"));
10273
+ return isEqual(date, date2Str(/* @__PURE__ */ new Date(), "/"));
10357
10274
  };
10358
10275
  const getCurrDate = (day, month) => {
10359
- return `${month.curData[0]}/${month.curData[1]}/${Utils.getNumTwoBit(
10360
- +day.day
10361
- )}`;
10276
+ return `${month.curData[0]}/${month.curData[1]}/${getNumTwoBit(+day.day)}`;
10362
10277
  };
10363
10278
  const isStart = (day, days) => {
10364
- return Utils.isEqual(days[0], day);
10279
+ return isEqual(days[0], day);
10365
10280
  };
10366
10281
  const isEnd = (day, days) => {
10367
- return Utils.isEqual(days[1], day);
10282
+ return isEqual(days[1], day);
10368
10283
  };
10369
10284
  const isStartAndEnd = (days) => {
10370
- return days.length >= 2 && Utils.isEqual(days[0], days[1]);
10285
+ return days.length >= 2 && isEqual(days[0], days[1]);
10371
10286
  };
10372
10287
  const defaultProps$12 = {
10373
10288
  ...ComponentDefaults,
@@ -10375,8 +10290,8 @@
10375
10290
  autoBackfill: false,
10376
10291
  popup: true,
10377
10292
  title: "",
10378
- startDate: Utils.getDay(0),
10379
- endDate: Utils.getDay(365),
10293
+ startDate: getDateString(0),
10294
+ endDate: getDateString(365),
10380
10295
  showToday: true,
10381
10296
  startText: "",
10382
10297
  endText: "",
@@ -10432,6 +10347,8 @@
10432
10347
  onDayClick,
10433
10348
  onPageChange
10434
10349
  } = { ...defaultProps$12, ...props };
10350
+ const classPrefix2 = "nut-calendar";
10351
+ const dayPrefix = "nut-calendar-day";
10435
10352
  const weekdays = locale.calendaritem.weekdays;
10436
10353
  const weeks = [
10437
10354
  ...weekdays.slice(firstDayOfWeek, 7),
@@ -10443,19 +10360,13 @@
10443
10360
  const [monthsNum, setMonthsNum] = React.useState(0);
10444
10361
  const [translateY, setTranslateY] = React.useState(0);
10445
10362
  const [monthDefaultRange, setMonthDefaultRange] = React.useState([]);
10446
- const propStartDate = startDate || Utils.getDay(0);
10447
- const propEndDate = endDate || Utils.getDay(365);
10363
+ const propStartDate = startDate || getDateString(0);
10364
+ const propEndDate = endDate || getDateString(365);
10448
10365
  const startDates = splitDate(propStartDate);
10449
10366
  const endDates = splitDate(propEndDate);
10450
10367
  const [state] = React.useState({
10451
10368
  currDateArray: []
10452
10369
  });
10453
- const getMonthsPanel = () => {
10454
- return monthsPanel.current;
10455
- };
10456
- const getMonthsRef = () => {
10457
- return monthsRef.current;
10458
- };
10459
10370
  const resetDefaultValue = () => {
10460
10371
  if (defaultValue || Array.isArray(defaultValue) && defaultValue.length > 0) {
10461
10372
  return type !== "single" ? [...defaultValue] : defaultValue;
@@ -10475,9 +10386,7 @@
10475
10386
  const viewAreaRef = React.useRef(null);
10476
10387
  const [avgHeight, setAvgHeight] = React.useState(0);
10477
10388
  let viewHeight = 0;
10478
- const classPrefix2 = "nut-calendar";
10479
- const dayPrefix = "nut-calendar-day";
10480
- const getMonthData = (curData, monthNum, type22) => {
10389
+ const getMonthData = (curData, monthNum) => {
10481
10390
  let i2 = 0;
10482
10391
  let date = curData;
10483
10392
  const monthData = monthsData;
@@ -10501,16 +10410,14 @@
10501
10410
  cssHeight,
10502
10411
  scrollTop
10503
10412
  };
10504
- {
10505
- if (!endDates || !Utils.compareDate(
10506
- `${endDates[0]}/${endDates[1]}/${Utils.getMonthDays(
10507
- endDates[0],
10508
- endDates[1]
10509
- )}`,
10510
- `${curData[0]}/${curData[1]}/${curData[2]}`
10511
- )) {
10512
- monthData.push(monthInfo);
10513
- }
10413
+ if (!endDates || !compareDate(
10414
+ `${endDates[0]}/${endDates[1]}/${getMonthDays(
10415
+ endDates[0],
10416
+ endDates[1]
10417
+ )}`,
10418
+ `${curData[0]}/${curData[1]}/${curData[2]}`
10419
+ )) {
10420
+ monthData.push(monthInfo);
10514
10421
  }
10515
10422
  date = getCurrMonthData("next", y, m2);
10516
10423
  } while (i2++ < monthNum);
@@ -10518,8 +10425,8 @@
10518
10425
  };
10519
10426
  const setReachedYearMonthInfo = (current) => {
10520
10427
  const currentMonthsData = monthsData[current];
10521
- const [year, month] = currentMonthsData.curData;
10522
10428
  if (currentMonthsData.title === yearMonthTitle) return;
10429
+ const [year, month] = currentMonthsData.curData;
10523
10430
  onPageChange && onPageChange([year, month, `${year}-${month}`]);
10524
10431
  setYearMonthTitle(currentMonthsData.title);
10525
10432
  };
@@ -10545,57 +10452,54 @@
10545
10452
  setTranslateY(monthsData[start2].scrollTop);
10546
10453
  setReachedYearMonthInfo(current);
10547
10454
  };
10548
- const getMonthNum = () => {
10549
- let monthNum = Number(endDates[1]) - Number(startDates[1]);
10550
- const yearNum = Number(endDates[0]) - Number(startDates[0]);
10551
- if (yearNum > 0) {
10552
- monthNum += 12 * yearNum;
10553
- }
10554
- if (monthNum <= 0) {
10555
- monthNum = 1;
10556
- }
10557
- setMonthsNum(monthNum);
10558
- return monthNum;
10559
- };
10560
10455
  const setDefaultDate = () => {
10561
10456
  let defaultData = [];
10562
- if (type === "range" && Array.isArray(currentDate)) {
10563
- if (currentDate.length > 0) {
10564
- if (propStartDate && Utils.compareDate(currentDate[0], propStartDate)) {
10565
- currentDate.splice(0, 1, propStartDate);
10457
+ if (type === "single" && typeof currentDate === "string") {
10458
+ if (!currentDate.length) {
10459
+ return defaultData;
10460
+ }
10461
+ if (compareDate(currentDate, propStartDate)) {
10462
+ defaultData = [...splitDate(propStartDate)];
10463
+ } else if (!compareDate(currentDate, propEndDate)) {
10464
+ defaultData = [...splitDate(propEndDate)];
10465
+ } else {
10466
+ defaultData = [...splitDate(currentDate)];
10467
+ }
10468
+ return defaultData;
10469
+ }
10470
+ if (Array.isArray(currentDate) && currentDate.length) {
10471
+ if (type === "range") {
10472
+ if (compareDate(currentDate[0], propStartDate)) {
10473
+ currentDate[0] = propStartDate;
10566
10474
  }
10567
- if (propEndDate && Utils.compareDate(propEndDate, currentDate[1])) {
10568
- currentDate.splice(1, 1, propEndDate);
10475
+ if (compareDate(propEndDate, currentDate[1])) {
10476
+ currentDate[1] = propEndDate;
10569
10477
  }
10570
10478
  defaultData = [
10571
10479
  ...splitDate(currentDate[0]),
10572
10480
  ...splitDate(currentDate[1])
10573
10481
  ];
10574
- }
10575
- } else if (type === "multiple" && Array.isArray(currentDate)) {
10576
- if (currentDate.length > 0) {
10482
+ } else if (type === "multiple") {
10577
10483
  const defaultArr = [];
10578
10484
  const obj = {};
10579
10485
  currentDate.forEach((item) => {
10580
- if (propStartDate && !Utils.compareDate(item, propStartDate) && propEndDate && !Utils.compareDate(propEndDate, item)) {
10486
+ if (!compareDate(item, propStartDate) && !compareDate(propEndDate, item)) {
10581
10487
  if (!Object.hasOwnProperty.call(obj, item)) {
10582
10488
  defaultArr.push(item);
10583
10489
  obj[item] = item;
10584
10490
  }
10585
10491
  }
10586
10492
  });
10587
- currentDate.splice(0) && currentDate.push(...defaultArr);
10493
+ currentDate.splice(0, currentDate.length, ...defaultArr);
10588
10494
  defaultData = [...splitDate(defaultArr[0])];
10589
- }
10590
- } else if (type === "week" && Array.isArray(currentDate)) {
10591
- if (currentDate.length > 0) {
10495
+ } else if (type === "week") {
10592
10496
  const [y, m2, d2] = splitDate(currentDate[0]);
10593
- const weekArr = Utils.getWeekDate(y, m2, d2, firstDayOfWeek);
10594
- currentDate.splice(0) && currentDate.push(...weekArr);
10595
- if (propStartDate && Utils.compareDate(currentDate[0], propStartDate)) {
10497
+ const weekArr = getWeekDate(y, m2, d2, firstDayOfWeek);
10498
+ currentDate.splice(0, currentDate.length, ...weekArr);
10499
+ if (compareDate(currentDate[0], propStartDate)) {
10596
10500
  currentDate.splice(0, 1, propStartDate);
10597
10501
  }
10598
- if (propEndDate && Utils.compareDate(propEndDate, currentDate[1])) {
10502
+ if (compareDate(propEndDate, currentDate[1])) {
10599
10503
  currentDate.splice(1, 1, propEndDate);
10600
10504
  }
10601
10505
  defaultData = [
@@ -10603,18 +10507,6 @@
10603
10507
  ...splitDate(currentDate[1])
10604
10508
  ];
10605
10509
  }
10606
- } else if (currentDate) {
10607
- if (currentDate.length > 0) {
10608
- if (propStartDate && Utils.compareDate(currentDate, propStartDate)) {
10609
- defaultData = [...splitDate(propStartDate)];
10610
- } else if (propEndDate && !Utils.compareDate(currentDate, propEndDate)) {
10611
- defaultData = [...splitDate(propEndDate)];
10612
- } else {
10613
- defaultData = [...splitDate(currentDate)];
10614
- }
10615
- } else {
10616
- defaultData = [];
10617
- }
10618
10510
  }
10619
10511
  return defaultData;
10620
10512
  };
@@ -10648,51 +10540,38 @@
10648
10540
  lastCurrent
10649
10541
  };
10650
10542
  };
10651
- const renderCurrentDate = () => {
10652
- const defaultData = setDefaultDate();
10653
- const current = getCurrentIndex(defaultData);
10654
- if (defaultData.length > 0) {
10655
- if (type === "range") {
10656
- chooseDay(
10657
- { day: defaultData[2], type: "active" },
10658
- monthsData[current.current],
10659
- true
10660
- );
10661
- chooseDay(
10662
- { day: defaultData[5], type: "active" },
10663
- monthsData[current.lastCurrent],
10664
- true
10665
- );
10666
- } else if (type === "week") {
10667
- chooseDay(
10668
- { day: defaultData[2], type: "curr" },
10669
- monthsData[current.current],
10670
- true
10543
+ const renderCurrentDate = (defaultData, current) => {
10544
+ if (!defaultData.length) return;
10545
+ const date = monthsData[current.current];
10546
+ if (type === "range") {
10547
+ handleDayClick({ day: defaultData[2], type: "active" }, date);
10548
+ handleDayClick(
10549
+ { day: defaultData[5], type: "active" },
10550
+ monthsData[current.lastCurrent]
10551
+ );
10552
+ } else if (type === "week") {
10553
+ handleDayClick({ day: defaultData[2], type: "curr" }, date);
10554
+ } else if (type === "multiple") {
10555
+ [...currentDate].forEach((item) => {
10556
+ const dateArr = splitDate(item);
10557
+ let currentIndex = current.current;
10558
+ currentIndex = monthsData.findIndex(
10559
+ (item2) => item2.title === monthTitle(dateArr[0], dateArr[1])
10671
10560
  );
10672
- } else if (type === "multiple") {
10673
- [...currentDate].forEach((item) => {
10674
- const dateArr = splitDate(item);
10675
- let currentIndex = current.current;
10676
- monthsData.forEach((item2, index) => {
10677
- if (item2.title === monthTitle(dateArr[0], dateArr[1])) {
10678
- currentIndex = index;
10679
- }
10680
- });
10681
- chooseDay(
10682
- { day: dateArr[2], type: "active" },
10683
- monthsData[currentIndex],
10684
- true
10685
- );
10686
- });
10687
- } else {
10688
- chooseDay(
10689
- { day: defaultData[2], type: "active" },
10690
- monthsData[current.current],
10691
- true
10561
+ handleDayClick(
10562
+ { day: dateArr[2], type: "active" },
10563
+ monthsData[currentIndex]
10692
10564
  );
10693
- }
10565
+ });
10566
+ } else {
10567
+ handleDayClick({ day: defaultData[2], type: "active" }, date);
10694
10568
  }
10695
- return current.current;
10569
+ };
10570
+ const getMonthsPanel = () => {
10571
+ return monthsPanel.current;
10572
+ };
10573
+ const getMonthsRef = () => {
10574
+ return monthsRef.current;
10696
10575
  };
10697
10576
  const requestAniFrameFunc = (current, monthNum) => {
10698
10577
  const lastItem = monthsData[monthsData.length - 1];
@@ -10706,12 +10585,27 @@
10706
10585
  });
10707
10586
  setAvgHeight(Math.floor(containerHeight / (monthNum + 1)));
10708
10587
  };
10588
+ const getMonthNum = () => {
10589
+ let monthNum = Number(endDates[1]) - Number(startDates[1]);
10590
+ const yearNum = Number(endDates[0]) - Number(startDates[0]);
10591
+ if (yearNum > 0) {
10592
+ monthNum += 12 * yearNum;
10593
+ }
10594
+ if (monthNum <= 0) {
10595
+ monthNum = 1;
10596
+ }
10597
+ setMonthsNum(monthNum);
10598
+ return monthNum;
10599
+ };
10709
10600
  const initData = () => {
10710
10601
  const monthNum = getMonthNum();
10711
10602
  getMonthData(startDates, monthNum);
10712
- const current = renderCurrentDate();
10713
- setDefaultRange(monthNum, current);
10714
- requestAniFrameFunc(current, monthNum);
10603
+ const defaultData = setDefaultDate();
10604
+ const current = getCurrentIndex(defaultData);
10605
+ const currentIndex = current.current;
10606
+ renderCurrentDate(defaultData, current);
10607
+ setDefaultRange(monthNum, currentIndex);
10608
+ requestAniFrameFunc(currentIndex, monthNum);
10715
10609
  };
10716
10610
  React.useEffect(() => {
10717
10611
  initData();
@@ -10728,9 +10622,9 @@
10728
10622
  popup && resetRender();
10729
10623
  }, [currentDate]);
10730
10624
  const scrollToDate = (date) => {
10731
- if (Utils.compareDate(date, propStartDate)) {
10625
+ if (compareDate(date, propStartDate)) {
10732
10626
  date = propStartDate;
10733
- } else if (!Utils.compareDate(date, propEndDate)) {
10627
+ } else if (!compareDate(date, propEndDate)) {
10734
10628
  date = propEndDate;
10735
10629
  }
10736
10630
  const dateArr = splitDate(date);
@@ -10772,16 +10666,10 @@
10772
10666
  const nextTop = monthsData[current + 1].scrollTop;
10773
10667
  const nextHeight = monthsData[current + 1].cssHeight;
10774
10668
  if (current === 0) {
10775
- if (scrollTop >= nextTop) {
10776
- current += 1;
10777
- }
10669
+ if (scrollTop >= nextTop) current += 1;
10778
10670
  } else if (current > 0 && current < monthsNum - 1) {
10779
- if (scrollTop >= nextTop) {
10780
- current += 1;
10781
- }
10782
- if (scrollTop < monthsData[current].scrollTop) {
10783
- current -= 1;
10784
- }
10671
+ if (scrollTop >= nextTop) current += 1;
10672
+ if (scrollTop < monthsData[current].scrollTop) current -= 1;
10785
10673
  } else {
10786
10674
  const viewPosition = Math.round(scrollTop + viewHeight);
10787
10675
  if (current + 1 <= monthsNum && viewPosition >= nextTop + nextHeight) {
@@ -10796,86 +10684,85 @@
10796
10684
  React.useImperativeHandle(ref, () => ({
10797
10685
  scrollToDate
10798
10686
  }));
10687
+ const isDisable = (day, month) => {
10688
+ if (day.type !== "active") return true;
10689
+ const dateStr = getCurrDate(day, month);
10690
+ if (compareDate(dateStr, propStartDate)) return true;
10691
+ if (compareDate(propEndDate, dateStr)) return true;
10692
+ return false;
10693
+ };
10799
10694
  const getClasses = (day, month) => {
10800
10695
  const dateStr = getCurrDate(day, month);
10801
- if (day.type === "active") {
10802
- if (propStartDate && Utils.compareDate(dateStr, propStartDate) || propEndDate && Utils.compareDate(propEndDate, dateStr)) {
10803
- return `${dayPrefix}-disabled`;
10804
- }
10805
- if (type === "range" || type === "week") {
10806
- if (isStart(dateStr, currentDate) || isEnd(dateStr, currentDate)) {
10807
- return `${dayPrefix}-active ${isStart(dateStr, currentDate) ? "active-start" : ""} ${isEnd(dateStr, currentDate) ? "active-end" : ""}`;
10808
- }
10809
- if (Array.isArray(currentDate) && Object.values(currentDate).length === 2 && Utils.compareDate(currentDate[0], dateStr) && Utils.compareDate(dateStr, currentDate[1])) {
10810
- if (disableDate(day)) {
10811
- return `${dayPrefix}-choose-disabled`;
10812
- }
10813
- return `${dayPrefix}-choose`;
10814
- }
10815
- } else if (type === "multiple" && isMultiple(dateStr, currentDate) || !Array.isArray(currentDate) && Utils.isEqual(currentDate, dateStr)) {
10816
- return `${dayPrefix}-active`;
10696
+ if (isDisable(day, month)) return `${dayPrefix}-disabled`;
10697
+ const activeCls = `${dayPrefix}-active`;
10698
+ if (type === "range" || type === "week") {
10699
+ if (isStart(dateStr, currentDate))
10700
+ return `${activeCls} active-start`;
10701
+ if (isEnd(dateStr, currentDate)) {
10702
+ return `${activeCls} active-end`;
10817
10703
  }
10818
- if (disableDate(day)) {
10819
- return `${dayPrefix}-disabled`;
10704
+ if (currentDate.length === 2 && compareDate(currentDate[0], dateStr) && compareDate(dateStr, currentDate[1])) {
10705
+ return disableDate(day) ? `${dayPrefix}-choose-disabled` : `${dayPrefix}-choose`;
10820
10706
  }
10821
- return null;
10707
+ } else if (type === "multiple" && isMultiple(dateStr, currentDate) || type === "single" && isEqual(currentDate, dateStr)) {
10708
+ return activeCls;
10822
10709
  }
10823
- return `${dayPrefix}-disabled`;
10710
+ if (disableDate(day)) return `${dayPrefix}-disabled`;
10711
+ return null;
10824
10712
  };
10825
- const chooseDay = (day, month, isFirst) => {
10713
+ const handleDayClick = (day, month, isFirst = true) => {
10826
10714
  if (getClasses(day, month) === `${dayPrefix}-disabled`) {
10827
10715
  return;
10828
10716
  }
10829
10717
  const days = [...month.curData];
10830
10718
  const [y, m2] = month.curData;
10831
- days[2] = typeof day.day === "number" ? Utils.getNumTwoBit(day.day) : day.day;
10719
+ days[2] = typeof day.day === "number" ? getNumTwoBit(day.day) : day.day;
10832
10720
  days[3] = `${days[0]}/${days[1]}/${days[2]}`;
10833
- days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
10721
+ days[4] = getWhatDay(+days[0], +days[1], +days[2]);
10722
+ const newDate = days[3];
10834
10723
  if (type === "multiple") {
10835
- if (currentDate.length > 0) {
10836
- let hasIndex = "";
10837
- currentDate.forEach((item, index) => {
10838
- if (item === days[3]) {
10839
- hasIndex = index;
10724
+ if (Array.isArray(currentDate)) {
10725
+ if (currentDate.length > 0) {
10726
+ const hasIndex = currentDate.findIndex((item) => item === newDate);
10727
+ if (isFirst) {
10728
+ state.currDateArray.push([...days]);
10729
+ } else if (hasIndex > -1) {
10730
+ currentDate.splice(hasIndex, 1);
10731
+ state.currDateArray.splice(hasIndex, 1);
10732
+ } else {
10733
+ currentDate.push(newDate);
10734
+ state.currDateArray.push([...days]);
10840
10735
  }
10841
- });
10842
- if (isFirst) {
10843
- state.currDateArray.push([...days]);
10844
- } else if (hasIndex !== "") {
10845
- currentDate.splice(hasIndex, 1);
10846
- state.currDateArray.splice(hasIndex, 1);
10847
10736
  } else {
10848
- currentDate.push(days[3]);
10849
- state.currDateArray.push([...days]);
10737
+ currentDate.push(newDate);
10738
+ state.currDateArray = [[...days]];
10850
10739
  }
10851
- } else {
10852
- currentDate.push(days[3]);
10853
- state.currDateArray = [[...days]];
10854
10740
  }
10855
10741
  } else if (type === "range") {
10856
- const curDataLength = Object.values(currentDate).length;
10857
- if (curDataLength === 2 || curDataLength === 0) {
10858
- Array.isArray(currentDate) && currentDate.splice(0) && currentDate.push(days[3]);
10859
- state.currDateArray = [[...days]];
10860
- } else if (Utils.compareDate(currentDate[0], days[3])) {
10861
- Array.isArray(currentDate) && currentDate.push(days[3]);
10862
- state.currDateArray = [...state.currDateArray, [...days]];
10863
- } else {
10864
- Array.isArray(currentDate) && currentDate.unshift(days[3]);
10865
- state.currDateArray = [[...days], ...state.currDateArray];
10742
+ if (Array.isArray(currentDate)) {
10743
+ if (currentDate.length === 2 || currentDate.length === 0) {
10744
+ currentDate.splice(0, currentDate.length, newDate);
10745
+ state.currDateArray = [[...days]];
10746
+ } else if (compareDate(currentDate[0], newDate)) {
10747
+ currentDate.push(newDate);
10748
+ state.currDateArray = [...state.currDateArray, [...days]];
10749
+ } else {
10750
+ currentDate.unshift(newDate);
10751
+ state.currDateArray = [[...days], ...state.currDateArray];
10752
+ }
10866
10753
  }
10867
10754
  } else if (type === "week") {
10868
- const weekArr = Utils.getWeekDate(y, m2, `${day.day}`, firstDayOfWeek);
10869
- if (propStartDate && Utils.compareDate(weekArr[0], propStartDate)) {
10870
- weekArr.splice(0, 1, propStartDate);
10755
+ const weekArr = getWeekDate(y, m2, `${day.day}`, firstDayOfWeek);
10756
+ if (compareDate(weekArr[0], propStartDate)) {
10757
+ weekArr[0] = propStartDate;
10871
10758
  }
10872
- if (propEndDate && Utils.compareDate(propEndDate, weekArr[1])) {
10873
- weekArr.splice(1, 1, propEndDate);
10759
+ if (compareDate(propEndDate, weekArr[1])) {
10760
+ weekArr[1] = propEndDate;
10874
10761
  }
10875
- Array.isArray(currentDate) && currentDate.splice(0) && currentDate.push(...weekArr);
10762
+ currentDate.splice(0, currentDate.length, ...weekArr);
10876
10763
  state.currDateArray = [
10877
- Utils.formatResultDate(weekArr[0]),
10878
- Utils.formatResultDate(weekArr[1])
10764
+ formatResultDate(weekArr[0]),
10765
+ formatResultDate(weekArr[1])
10879
10766
  ];
10880
10767
  } else {
10881
10768
  setCurrentDate(days[3]);
@@ -10899,11 +10786,11 @@
10899
10786
  }
10900
10787
  };
10901
10788
  const classes = classNames(
10789
+ classPrefix2,
10902
10790
  {
10903
10791
  [`${classPrefix2}-title`]: !popup,
10904
10792
  [`${classPrefix2}-nofooter`]: !!autoBackfill
10905
10793
  },
10906
- classPrefix2,
10907
10794
  className
10908
10795
  );
10909
10796
  const headerClasses = classNames({
@@ -10919,6 +10806,36 @@
10919
10806
  const renderHeader = () => {
10920
10807
  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))));
10921
10808
  };
10809
+ const renderItem = (month, day, index) => {
10810
+ const startTip = isStartTip(day, month);
10811
+ const endTip = isEndTip(day, month);
10812
+ const noStartNorEnd = !startTip && !endTip;
10813
+ return /* @__PURE__ */ React.createElement(
10814
+ "div",
10815
+ {
10816
+ className: [`${classPrefix2}-day`, getClasses(day, month)].join(" "),
10817
+ onClick: () => handleDayClick(day, month, false),
10818
+ key: index
10819
+ },
10820
+ /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-day` }, renderDay ? renderDay(day) : day.day),
10821
+ !startTip && renderDayTop && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-top` }, renderDayTop(day)),
10822
+ noStartNorEnd && renderDayBottom && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-bottom` }, renderDayBottom(day)),
10823
+ noStartNorEnd && !renderDayBottom && showToday && isCurrDay(month, day.day) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-curr` }, locale.calendaritem.today),
10824
+ startTip && /* @__PURE__ */ React.createElement(
10825
+ "div",
10826
+ {
10827
+ className: `${classPrefix2}-day-info ${isStartAndEnd(currentDate) ? `${classPrefix2}-day-info-top` : ""}`
10828
+ },
10829
+ startText || locale.calendaritem.start
10830
+ ),
10831
+ endTip && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info` }, endText || locale.calendaritem.end)
10832
+ );
10833
+ };
10834
+ const renderPanel = (month, key) => {
10835
+ 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(
10836
+ (day, i2) => renderItem(month, day, i2)
10837
+ )));
10838
+ };
10922
10839
  const renderContent = () => {
10923
10840
  return /* @__PURE__ */ React.createElement(
10924
10841
  "div",
@@ -10935,31 +10852,7 @@
10935
10852
  style: { transform: `translateY(${translateY}px)` }
10936
10853
  },
10937
10854
  monthsData.slice(monthDefaultRange[0], monthDefaultRange[1]).map((month, key) => {
10938
- 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(
10939
- "div",
10940
- {
10941
- className: [
10942
- `${classPrefix2}-day`,
10943
- getClasses(day, month)
10944
- ].join(" "),
10945
- onClick: () => {
10946
- chooseDay(day, month);
10947
- },
10948
- key: i2
10949
- },
10950
- /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-day` }, renderDay ? renderDay(day) : day.day),
10951
- !isStartTip(day, month) && renderDayTop && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-top` }, renderDayTop(day)),
10952
- !isStartTip(day, month) && !isEndTip(day, month) && renderDayBottom && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-bottom` }, renderDayBottom(day)),
10953
- !isStartTip(day, month) && !isEndTip(day, month) && !renderDayBottom && showToday && isCurrDay(month, day.day) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-curr` }, locale.calendaritem.today),
10954
- isStartTip(day, month) && /* @__PURE__ */ React.createElement(
10955
- "div",
10956
- {
10957
- className: `${classPrefix2}-day-info ${isStartAndEnd(currentDate) ? `${classPrefix2}-day-info-top` : ""}`
10958
- },
10959
- startText || locale.calendaritem.start
10960
- ),
10961
- isEndTip(day, month) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info` }, endText || locale.calendaritem.end)
10962
- ))));
10855
+ return renderPanel(month, key);
10963
10856
  })
10964
10857
  ))
10965
10858
  );
@@ -10978,8 +10871,8 @@
10978
10871
  visible: false,
10979
10872
  title: "",
10980
10873
  defaultValue: "",
10981
- startDate: Utils.getDay(0),
10982
- endDate: Utils.getDay(365),
10874
+ startDate: getDateString(0),
10875
+ endDate: getDateString(365),
10983
10876
  showToday: true,
10984
10877
  startText: "",
10985
10878
  endText: "",
@@ -11178,12 +11071,12 @@
11178
11071
  prevMonth = 12;
11179
11072
  prevYear -= 1;
11180
11073
  }
11181
- let days = Utils.getMonthPreDay(year, month);
11074
+ let days = getMonthPreDay(year, month);
11182
11075
  days -= firstDayOfWeek;
11183
11076
  if (days >= 7) {
11184
11077
  days -= 7;
11185
11078
  }
11186
- const preDates = Utils.getMonthDays(`${prevYear}`, `${prevMonth}`);
11079
+ const preDates = getMonthDays(`${prevYear}`, `${prevMonth}`);
11187
11080
  const months = Array.from(Array(preDates), (_, k) => {
11188
11081
  return {
11189
11082
  type: "prev",
@@ -11195,7 +11088,7 @@
11195
11088
  return months.slice(preDates - days);
11196
11089
  };
11197
11090
  const getCurrentMonthDays = (year, month) => {
11198
- const days = Utils.getMonthDays(`${year}`, `${month}`);
11091
+ const days = getMonthDays(`${year}`, `${month}`);
11199
11092
  return Array.from(Array(days), (_, k) => {
11200
11093
  return {
11201
11094
  type: "current",
@@ -19640,29 +19533,29 @@
19640
19533
  onClick: (event) => {
19641
19534
  }
19642
19535
  };
19643
- const classPrefix$7 = `nut-animate`;
19536
+ const classPrefix$7 = "nut-animate";
19644
19537
  const Animate = (props) => {
19645
19538
  const { className, type, action, loop: loop2, onClick, children, ...rest } = {
19646
19539
  ...defaultProps$s,
19647
19540
  ...props
19648
19541
  };
19649
19542
  const [clicked, setClicked] = React.useState(false);
19650
- const classes = classNames({
19651
- "nut-ani-container": true,
19652
- [`${classPrefix$7}-${type}`]: action === "initial" || clicked ? type : false,
19653
- loop: loop2
19654
- });
19655
- const cls = classNames(classes, className);
19543
+ const classes = classNames(
19544
+ {
19545
+ "nut-ani-container": true,
19546
+ [`${classPrefix$7}-${type}`]: action === "initial" || clicked,
19547
+ loop: loop2
19548
+ },
19549
+ className
19550
+ );
19656
19551
  const handleClick2 = (event) => {
19657
19552
  setClicked(true);
19658
19553
  if (!loop2) {
19659
- setTimeout(() => {
19660
- setClicked(false);
19661
- }, 1e3);
19554
+ setTimeout(() => setClicked(false), 1e3);
19662
19555
  }
19663
- onClick && onClick(event);
19556
+ onClick(event);
19664
19557
  };
19665
- return /* @__PURE__ */ React.createElement("div", { className: "nut-animate" }, /* @__PURE__ */ React.createElement("div", { className: cls, onClick: handleClick2, ...rest }, children));
19558
+ return /* @__PURE__ */ React.createElement("div", { className: "nut-animate" }, /* @__PURE__ */ React.createElement("div", { className: classes, onClick: handleClick2, ...rest }, children));
19666
19559
  };
19667
19560
  Animate.displayName = "NutAnimate";
19668
19561
  const defaultProps$r = {
@@ -21122,18 +21015,17 @@
21122
21015
  const y = springs.y.get() / 100 * slideSize;
21123
21016
  return [-x, -y];
21124
21017
  },
21125
- triggerAllEvents: true,
21126
21018
  bounds: () => {
21127
21019
  if (loop2) return {};
21128
21020
  const slideSize = getSlideSize();
21129
- getSwiperSize();
21130
21021
  if (isVertical) {
21131
21022
  return { top: 0, bottom: (count - 1) * slideSize };
21132
21023
  }
21133
21024
  return { left: 0, right: (count - 1) * slideSize };
21134
21025
  },
21135
- preventDefault: true,
21136
21026
  rubberband: true,
21027
+ triggerAllEvents: true,
21028
+ preventScroll: isVertical,
21137
21029
  axis: isVertical ? "y" : "x",
21138
21030
  pointer: {
21139
21031
  touch: true
@@ -21192,8 +21084,8 @@
21192
21084
  {
21193
21085
  ref: stageRef,
21194
21086
  className: classNames("nut-swiper-inner", {
21195
- "nut-swiper-inner-vertical": isVertical,
21196
- "nut-swiper-inner-horizontal": !isVertical
21087
+ [`${classPrefix2}-inner-vertical`]: isVertical,
21088
+ [`${classPrefix2}-inner-horizontal`]: !isVertical
21197
21089
  }),
21198
21090
  style: {
21199
21091
  ...props.slideSize ? { [isVertical ? "height" : "width"]: `${props.slideSize}px` } : {}
@@ -21205,7 +21097,11 @@
21205
21097
  return /* @__PURE__ */ React.createElement(
21206
21098
  "div",
21207
21099
  {
21208
- className: classNames("nut-swiper", className),
21100
+ className: classNames(
21101
+ classPrefix2,
21102
+ `${classPrefix2}-canmove-${direction}`,
21103
+ className
21104
+ ),
21209
21105
  style,
21210
21106
  ref: swiperRef,
21211
21107
  ...bind()