@nutui/nutui-react-taro 3.0.13 → 3.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/CHANGELOG.md +26 -12
  2. package/dist/cjs/packages/configprovider/types.d.ts +1 -1
  3. package/dist/cjs/packages/datepicker/utils.js +1 -1
  4. package/dist/cjs/packages/elevator/elevator.d.ts +3 -20
  5. package/dist/cjs/packages/elevator/elevator.js +119 -91
  6. package/dist/cjs/packages/elevator/index.d.ts +1 -1
  7. package/dist/cjs/packages/elevator/style/elevator.scss +61 -33
  8. package/dist/cjs/packages/elevator/style/style.css +65 -40
  9. package/dist/cjs/packages/elevator/style/style.harmony.css +69 -41
  10. package/dist/cjs/packages/elevator/style-jmapp/elevator.scss +61 -33
  11. package/dist/cjs/packages/elevator/style-jmapp/style.css +56 -31
  12. package/dist/cjs/packages/elevator/style-jrkf/elevator.scss +61 -33
  13. package/dist/cjs/packages/elevator/style-jrkf/style.css +56 -31
  14. package/dist/cjs/packages/image/image.js +2 -2
  15. package/dist/cjs/packages/input/input.js +1 -1
  16. package/dist/cjs/packages/navbar/style/navbar.scss +2 -0
  17. package/dist/cjs/packages/navbar/style/style.css +2 -0
  18. package/dist/cjs/packages/navbar/style/style.harmony.css +2 -0
  19. package/dist/cjs/packages/navbar/style-jmapp/navbar.scss +2 -0
  20. package/dist/cjs/packages/navbar/style-jmapp/style.css +2 -0
  21. package/dist/cjs/packages/navbar/style-jrkf/navbar.scss +2 -0
  22. package/dist/cjs/packages/navbar/style-jrkf/style.css +2 -0
  23. package/dist/cjs/packages/switch/switch.js +0 -1
  24. package/dist/cjs/packages/tabpane/style/style.css +1 -1
  25. package/dist/cjs/packages/tabpane/style/tabpane.scss +1 -1
  26. package/dist/cjs/packages/tabpane/style-jmapp/style.css +1 -1
  27. package/dist/cjs/packages/tabpane/style-jmapp/tabpane.scss +1 -1
  28. package/dist/cjs/packages/tabpane/style-jrkf/style.css +1 -1
  29. package/dist/cjs/packages/tabpane/style-jrkf/tabpane.scss +1 -1
  30. package/dist/cjs/types/spec/elevator/base.d.ts +5 -2
  31. package/dist/es/packages/configprovider/types.d.ts +1 -1
  32. package/dist/es/packages/datepicker/utils.js +1 -1
  33. package/dist/es/packages/elevator/elevator.d.ts +3 -20
  34. package/dist/es/packages/elevator/elevator.js +119 -91
  35. package/dist/es/packages/elevator/index.d.ts +1 -1
  36. package/dist/es/packages/elevator/style/elevator.scss +61 -33
  37. package/dist/es/packages/elevator/style/style.css +65 -40
  38. package/dist/es/packages/elevator/style/style.harmony.css +69 -41
  39. package/dist/es/packages/elevator/style-jmapp/elevator.scss +61 -33
  40. package/dist/es/packages/elevator/style-jmapp/style.css +56 -31
  41. package/dist/es/packages/elevator/style-jrkf/elevator.scss +61 -33
  42. package/dist/es/packages/elevator/style-jrkf/style.css +56 -31
  43. package/dist/es/packages/image/image.js +2 -2
  44. package/dist/es/packages/input/input.js +1 -1
  45. package/dist/es/packages/navbar/style/navbar.scss +2 -0
  46. package/dist/es/packages/navbar/style/style.css +2 -0
  47. package/dist/es/packages/navbar/style/style.harmony.css +2 -0
  48. package/dist/es/packages/navbar/style-jmapp/navbar.scss +2 -0
  49. package/dist/es/packages/navbar/style-jmapp/style.css +2 -0
  50. package/dist/es/packages/navbar/style-jrkf/navbar.scss +2 -0
  51. package/dist/es/packages/navbar/style-jrkf/style.css +2 -0
  52. package/dist/es/packages/switch/switch.js +0 -1
  53. package/dist/es/packages/tabpane/style/style.css +1 -1
  54. package/dist/es/packages/tabpane/style/tabpane.scss +1 -1
  55. package/dist/es/packages/tabpane/style-jmapp/style.css +1 -1
  56. package/dist/es/packages/tabpane/style-jmapp/tabpane.scss +1 -1
  57. package/dist/es/packages/tabpane/style-jrkf/style.css +1 -1
  58. package/dist/es/packages/tabpane/style-jrkf/tabpane.scss +1 -1
  59. package/dist/es/types/spec/elevator/base.d.ts +15 -6
  60. package/dist/nutui.react.umd.js +858 -837
  61. package/dist/style-jmapp.css +1 -1
  62. package/dist/style-jmapp.scss +36 -36
  63. package/dist/style-jrkf.css +1 -1
  64. package/dist/style-jrkf.scss +44 -44
  65. package/dist/style.css +1 -1
  66. package/dist/style.scss +35 -35
  67. package/dist/styles/variables-jmapp.scss +14 -2
  68. package/dist/styles/variables-jrkf.scss +14 -2
  69. package/dist/styles/variables.scss +24 -43
  70. package/package.json +1 -1
@@ -1337,7 +1337,7 @@
1337
1337
  } : {}, radius !== void 0 && radius !== null ? {
1338
1338
  overflow: "hidden",
1339
1339
  borderRadius: pxCheck2(radius)
1340
- } : {});
1340
+ } : {}, style);
1341
1341
  var imgStyle = _object_spread_props(_object_spread({}, style), {
1342
1342
  width: width2,
1343
1343
  height: height2
@@ -1381,7 +1381,7 @@
1381
1381
  className: classNames(classPrefix2, _define_property({}, "".concat(classPrefix2, "-basic"), Taro.getEnv() !== "WEB"), className),
1382
1382
  style: containerStyle
1383
1383
  }, /* @__PURE__ */ React.createElement(components.Image, _object_spread_props(_object_spread({}, rest), {
1384
- className: "".concat(classPrefix2, "-default ").concat(className ? "".concat(className, "-image") : ""),
1384
+ className: classNames("".concat(classPrefix2, "-default"), className && "".concat(className, "-image"), _define_property({}, "".concat(classPrefix2, "-error"), isError)),
1385
1385
  style: imgStyle,
1386
1386
  src,
1387
1387
  onLoad: function(e) {
@@ -4272,6 +4272,63 @@
4272
4272
  }, children));
4273
4273
  };
4274
4274
  BackTop.displayName = "NutBackTop";
4275
+ var idCounter = {};
4276
+ function uniqueId() {
4277
+ var prefix = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "$nut$";
4278
+ if (!idCounter[prefix]) {
4279
+ idCounter[prefix] = 0;
4280
+ }
4281
+ var id = ++idCounter[prefix];
4282
+ if (prefix === "$nut$") {
4283
+ return "".concat(id);
4284
+ }
4285
+ return "".concat(prefix).concat(id);
4286
+ }
4287
+ function useUuid() {
4288
+ var idRef = React.useRef(uniqueId());
4289
+ return idRef.current;
4290
+ }
4291
+ function requestAniFrame() {
4292
+ if (inBrowser) {
4293
+ var _window = window;
4294
+ return _window.requestAnimationFrame || _window.webkitRequestAnimationFrame || function(callback) {
4295
+ _window.setTimeout(callback, 1e3 / 60);
4296
+ };
4297
+ }
4298
+ return function(callback) {
4299
+ setTimeout(callback, 1e3 / 60);
4300
+ };
4301
+ }
4302
+ function cancelRaf(id) {
4303
+ if (inBrowser) {
4304
+ var _window = window;
4305
+ (_window.cancelAnimationFrame || _window.webkitCancelAnimationFrame)(id);
4306
+ } else {
4307
+ clearTimeout(id);
4308
+ }
4309
+ }
4310
+ const requestAniFrame$1 = requestAniFrame();
4311
+ function addColorForHarmony(maybeElement, color) {
4312
+ if (React.isValidElement(maybeElement) && harmony()) {
4313
+ return React.cloneElement(maybeElement, {
4314
+ color
4315
+ });
4316
+ }
4317
+ return maybeElement;
4318
+ }
4319
+ function bound(position2, min, max) {
4320
+ var ret = position2;
4321
+ if (min !== void 0) {
4322
+ ret = Math.max(position2, min);
4323
+ }
4324
+ if (max !== void 0) {
4325
+ ret = Math.min(ret, max);
4326
+ }
4327
+ return ret;
4328
+ }
4329
+ var clamp = function(num, min, max) {
4330
+ return Math.min(Math.max(num, min), max);
4331
+ };
4275
4332
  function _array_without_holes(arr) {
4276
4333
  if (Array.isArray(arr)) return _array_like_to_array(arr);
4277
4334
  }
@@ -4286,43 +4343,716 @@
4286
4343
  function _to_consumable_array(arr) {
4287
4344
  return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
4288
4345
  }
4289
- var idCounter = {};
4290
- function uniqueId() {
4291
- var prefix = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "$nut$";
4292
- if (!idCounter[prefix]) {
4293
- idCounter[prefix] = 0;
4346
+ var Utils = {
4347
+ /**
4348
+ * 是否为闫年
4349
+ * @return {Boolse} true|false
4350
+ */
4351
+ isLeapYear: function isLeapYear(y) {
4352
+ return y % 4 === 0 && y % 100 !== 0 || y % 400 === 0;
4353
+ },
4354
+ /**
4355
+ * 返回星期数
4356
+ * @return {String}
4357
+ */
4358
+ getWhatDay: function getWhatDay(year, month, day) {
4359
+ var date2 = new Date("".concat(year, "/").concat(month, "/").concat(day));
4360
+ var index2 = date2.getDay();
4361
+ var dayNames = [
4362
+ "星期日",
4363
+ "星期一",
4364
+ "星期二",
4365
+ "星期三",
4366
+ "星期四",
4367
+ "星期五",
4368
+ "星期六"
4369
+ ];
4370
+ return dayNames[index2];
4371
+ },
4372
+ /**
4373
+ * 返回上一个月在当前面板中的天数
4374
+ * @return {Number}
4375
+ */
4376
+ getMonthPreDay: function getMonthPreDay(year, month) {
4377
+ var date2 = new Date("".concat(year, "/").concat(month, "/01"));
4378
+ var day = date2.getDay();
4379
+ if (day === 0) {
4380
+ day = 7;
4381
+ }
4382
+ return day;
4383
+ },
4384
+ /**
4385
+ * 返回月份天数
4386
+ * @return {Number}
4387
+ */
4388
+ getMonthDays: function getMonthDays(year, month) {
4389
+ if (/^0/.test(month)) {
4390
+ month = month.split("")[1];
4391
+ }
4392
+ return [
4393
+ 0,
4394
+ 31,
4395
+ this.isLeapYear(Number(year)) ? 29 : 28,
4396
+ 31,
4397
+ 30,
4398
+ 31,
4399
+ 30,
4400
+ 31,
4401
+ 31,
4402
+ 30,
4403
+ 31,
4404
+ 30,
4405
+ 31
4406
+ ][month];
4407
+ },
4408
+ /**
4409
+ * 补齐数字位数
4410
+ * @return {string}
4411
+ */
4412
+ getNumTwoBit: function getNumTwoBit(n) {
4413
+ n = Number(n);
4414
+ return (n > 9 ? "" : "0") + n;
4415
+ },
4416
+ /**
4417
+ * 日期对象转成字符串
4418
+ * @return {string}
4419
+ */
4420
+ date2Str: function date2Str(date2, split) {
4421
+ split = split || "-";
4422
+ var y = date2.getFullYear();
4423
+ var m = this.getNumTwoBit(date2.getMonth() + 1);
4424
+ var d = this.getNumTwoBit(date2.getDate());
4425
+ return [
4426
+ y,
4427
+ m,
4428
+ d
4429
+ ].join(split);
4430
+ },
4431
+ /**
4432
+ * 返回日期格式字符串
4433
+ * @param {Number} 0返回今天的日期、1返回明天的日期,2返回后天得日期,依次类推
4434
+ * @return {string} '2014-12-31'
4435
+ */
4436
+ getDay: function getDay(i2) {
4437
+ i2 = i2 || 0;
4438
+ var date2 = /* @__PURE__ */ new Date();
4439
+ var diff = i2 * (1e3 * 60 * 60 * 24);
4440
+ date2 = new Date(date2.getTime() + diff);
4441
+ return this.date2Str(date2);
4442
+ },
4443
+ /**
4444
+ * 时间比较
4445
+ * @return {Boolean}
4446
+ */
4447
+ compareDate: function compareDate(date1, date2) {
4448
+ var startTime = new Date(date1.replace("-", "/").replace("-", "/"));
4449
+ var endTime = new Date(date2.replace("-", "/").replace("-", "/"));
4450
+ if (startTime >= endTime) {
4451
+ return false;
4452
+ }
4453
+ return true;
4454
+ },
4455
+ /**
4456
+ * 时间是否相等
4457
+ * @return {Boolean}
4458
+ */
4459
+ isEqual: function isEqual2(date1, date2) {
4460
+ var startTime = new Date((date1 || "").replace(/-/g, "/")).getTime();
4461
+ var endTime = new Date(date2.replace(/-/g, "/")).getTime();
4462
+ if (startTime === endTime) {
4463
+ return true;
4464
+ }
4465
+ return false;
4466
+ },
4467
+ getMonthWeek: function getMonthWeek(year, month, date2) {
4468
+ var firstDayOfWeek = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
4469
+ var dateNow = new Date(Number(year), parseInt(month) - 1, Number(date2));
4470
+ var w = dateNow.getDay();
4471
+ var d = dateNow.getDate();
4472
+ var remainder = 6 - w;
4473
+ if (firstDayOfWeek !== 0) {
4474
+ w = w === 0 ? 7 : w;
4475
+ remainder = 7 - w;
4476
+ }
4477
+ return Math.ceil((d + remainder) / 7);
4478
+ },
4479
+ getYearWeek: function getYearWeek(year, month, date2) {
4480
+ var dateNow = new Date(Number(year), parseInt(month) - 1, Number(date2));
4481
+ var dateFirst = new Date(Number(year), 0, 1);
4482
+ var dataNumber = Math.round((dateNow.valueOf() - dateFirst.valueOf()) / 864e5);
4483
+ return Math.ceil((dataNumber + (dateFirst.getDay() + 1 - 1)) / 7);
4484
+ },
4485
+ getWeekDate: function getWeekDate(year, month, date2) {
4486
+ var firstDayOfWeek = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
4487
+ var dateNow = new Date(Number(year), parseInt(month) - 1, Number(date2));
4488
+ var nowTime = dateNow.getTime();
4489
+ var day = dateNow.getDay();
4490
+ if (firstDayOfWeek === 0) {
4491
+ var oneDayTime = 24 * 60 * 60 * 1e3;
4492
+ var SundayTime = nowTime - day * oneDayTime;
4493
+ var SaturdayTime = nowTime + (6 - day) * oneDayTime;
4494
+ var sunday = this.date2Str(new Date(SundayTime));
4495
+ var saturday = this.date2Str(new Date(SaturdayTime));
4496
+ return [
4497
+ sunday,
4498
+ saturday
4499
+ ];
4500
+ }
4501
+ day = day === 0 ? 7 : day;
4502
+ var oneDayTime1 = 24 * 60 * 60 * 1e3;
4503
+ var MondayTime = nowTime - (day - 1) * oneDayTime1;
4504
+ var SundayTime1 = nowTime + (7 - day) * oneDayTime1;
4505
+ var monday = this.date2Str(new Date(MondayTime));
4506
+ var sunday1 = this.date2Str(new Date(SundayTime1));
4507
+ return [
4508
+ monday,
4509
+ sunday1
4510
+ ];
4511
+ },
4512
+ formatResultDate: function formatResultDate(date2) {
4513
+ var days = _to_consumable_array(date2.split("-"));
4514
+ days[2] = Utils.getNumTwoBit(Number(days[2]));
4515
+ days[3] = "".concat(days[0], "-").concat(days[1], "-").concat(days[2]);
4516
+ days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
4517
+ return days;
4294
4518
  }
4295
- var id = ++idCounter[prefix];
4296
- if (prefix === "$nut$") {
4297
- return "".concat(id);
4519
+ };
4520
+ var getCurrMonthData = function(type2, year, month) {
4521
+ switch (type2) {
4522
+ case "prev":
4523
+ month === 1 && (year -= 1);
4524
+ month = month === 1 ? 12 : --month;
4525
+ break;
4526
+ case "next":
4527
+ month === 12 && (year += 1);
4528
+ month = month === 12 ? 1 : ++month;
4529
+ break;
4298
4530
  }
4299
- return "".concat(prefix).concat(id);
4531
+ return [
4532
+ year,
4533
+ Utils.getNumTwoBit(month),
4534
+ Utils.getMonthDays(String(year), String(month))
4535
+ ];
4536
+ };
4537
+ var getDaysStatus = function(type2, year, month) {
4538
+ var days = Utils.getMonthDays("".concat(year), "".concat(month));
4539
+ if (type2 === "prev" && days >= 7) {
4540
+ days -= 7;
4541
+ }
4542
+ return Array.from(Array(days), function(v, k) {
4543
+ return {
4544
+ day: k + 1,
4545
+ type: type2,
4546
+ year,
4547
+ month
4548
+ };
4549
+ });
4550
+ };
4551
+ var getPreMonthDates = function(type2, year, month, firstDayOfWeek) {
4552
+ var preMonth = +month - 1;
4553
+ var preYear = year;
4554
+ if (preMonth <= 0) {
4555
+ preMonth = 12;
4556
+ preYear += 1;
4557
+ }
4558
+ var days = Utils.getMonthPreDay(+year, +month);
4559
+ days -= firstDayOfWeek;
4560
+ if (type2 === "prev" && days >= 7) {
4561
+ days -= 7;
4562
+ }
4563
+ var preDates = Utils.getMonthDays("".concat(preYear), "".concat(preMonth));
4564
+ var months = Array.from(Array(preDates), function(v, k) {
4565
+ return {
4566
+ day: k + 1,
4567
+ type: type2,
4568
+ preYear,
4569
+ preMonth
4570
+ };
4571
+ });
4572
+ return months.slice(preDates - days);
4573
+ };
4574
+ var getRectById = function(id) {
4575
+ return new Promise(function(resolve, reject) {
4576
+ if (Taro.getEnv() === Taro.ENV_TYPE.WEB) {
4577
+ var t = document ? document.querySelector("#".concat(id)) : "";
4578
+ if (t) {
4579
+ resolve(t === null || t === void 0 ? void 0 : t.getBoundingClientRect());
4580
+ }
4581
+ reject();
4582
+ } else {
4583
+ var query = Taro.createSelectorQuery();
4584
+ query.select("#".concat(id)).boundingClientRect().exec(function(rect) {
4585
+ if (rect[0]) {
4586
+ resolve(rect[0]);
4587
+ } else {
4588
+ reject();
4589
+ }
4590
+ });
4591
+ }
4592
+ });
4593
+ };
4594
+ function _type_of(obj) {
4595
+ "@swc/helpers - typeof";
4596
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
4300
4597
  }
4301
- function useUuid() {
4302
- var idRef = React.useRef(uniqueId());
4303
- return idRef.current;
4598
+ var isObject = function(val2) {
4599
+ return val2 !== null && (typeof val2 === "undefined" ? "undefined" : _type_of(val2)) === "object";
4600
+ };
4601
+ var isFunction = function(val2) {
4602
+ return typeof val2 === "function";
4603
+ };
4604
+ var isPromise = function(val2) {
4605
+ return isObject(val2) && isFunction(val2.then) && isFunction(val2.catch);
4606
+ };
4607
+ var funcInterceptor = function(interceptor, param) {
4608
+ var _param_args = param.args, args = _param_args === void 0 ? [] : _param_args, done = param.done, canceled = param.canceled;
4609
+ if (interceptor) {
4610
+ var returnVal = interceptor.apply(null, args);
4611
+ if (isPromise(returnVal)) {
4612
+ returnVal.then(function(value2) {
4613
+ if (value2) {
4614
+ done(value2);
4615
+ } else if (canceled) {
4616
+ canceled();
4617
+ }
4618
+ }).catch(function() {
4619
+ });
4620
+ } else if (returnVal) {
4621
+ done();
4622
+ } else if (canceled) {
4623
+ canceled();
4624
+ }
4625
+ } else {
4626
+ done();
4627
+ }
4628
+ };
4629
+ var isDate = function(val2) {
4630
+ return Object.prototype.toString.call(val2) === "[object Date]" && !Number.isNaN(val2.getTime());
4631
+ };
4632
+ var isEmpty = function(p) {
4633
+ if (p === null || p === void 0) return true;
4634
+ if ((typeof p === "undefined" ? "undefined" : _type_of(p)) === "object" && Object.keys(p).length === 0) return true;
4635
+ if (Array.isArray(p) && p.length === 0) return true;
4636
+ return false;
4637
+ };
4638
+ function isForwardRefComponent(component) {
4639
+ return component.type && component.type.$$typeof && // eslint-disable-next-line react/display-name
4640
+ React.forwardRef(
4641
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4642
+ // @ts-ignore
4643
+ function() {
4644
+ }
4645
+ ).$$typeof === component.type.$$typeof;
4646
+ }
4647
+ function main() {
4648
+ for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) {
4649
+ items[_key] = arguments[_key];
4650
+ }
4651
+ return merge.apply(void 0, _to_consumable_array(items));
4652
+ }
4653
+ main.clone = clone;
4654
+ main.isPlainObject = isPlainObject;
4655
+ main.recursive = recursive;
4656
+ function merge() {
4657
+ for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) {
4658
+ items[_key] = arguments[_key];
4659
+ }
4660
+ return _merge(items[0] === true, false, items);
4661
+ }
4662
+ function recursive() {
4663
+ for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) {
4664
+ items[_key] = arguments[_key];
4665
+ }
4666
+ return _merge(items[0] === true, true, items);
4667
+ }
4668
+ function clone(input) {
4669
+ if (Array.isArray(input)) {
4670
+ var output = [];
4671
+ for (var index2 = 0; index2 < input.length; ++index2) output.push(clone(input[index2]));
4672
+ return output;
4673
+ }
4674
+ if (isPlainObject(input)) {
4675
+ var output1 = {};
4676
+ for (var index1 in input) output1[index1] = clone(input[index1]);
4677
+ return output1;
4678
+ }
4679
+ return input;
4680
+ }
4681
+ function isPlainObject(input) {
4682
+ if (input === null || (typeof input === "undefined" ? "undefined" : _type_of(input)) !== "object") return false;
4683
+ if (Object.getPrototypeOf(input) === null) return true;
4684
+ var ref = input;
4685
+ while (Object.getPrototypeOf(ref) !== null) ref = Object.getPrototypeOf(ref);
4686
+ return Object.getPrototypeOf(input) === ref;
4687
+ }
4688
+ function _recursiveMerge(base, extend) {
4689
+ if (!isPlainObject(base) || !isPlainObject(extend)) return extend;
4690
+ for (var key2 in extend) {
4691
+ if (key2 === "__proto__" || key2 === "constructor" || key2 === "prototype") continue;
4692
+ base[key2] = isPlainObject(base[key2]) && isPlainObject(extend[key2]) ? _recursiveMerge(base[key2], extend[key2]) : extend[key2];
4693
+ }
4694
+ return base;
4695
+ }
4696
+ function _merge(isClone, isRecursive, items) {
4697
+ var result;
4698
+ if (isClone || !isPlainObject(result = items.shift())) result = {};
4699
+ for (var index2 = 0; index2 < items.length; ++index2) {
4700
+ var item = items[index2];
4701
+ if (!isPlainObject(item)) continue;
4702
+ for (var key2 in item) {
4703
+ if (key2 === "__proto__" || key2 === "constructor" || key2 === "prototype") continue;
4704
+ var value2 = isClone ? clone(item[key2]) : item[key2];
4705
+ result[key2] = isRecursive ? _recursiveMerge(result[key2], value2) : value2;
4706
+ }
4707
+ }
4708
+ return result;
4709
+ }
4710
+ function mergeProps() {
4711
+ for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) {
4712
+ items[_key] = arguments[_key];
4713
+ }
4714
+ var ret = {};
4715
+ items.forEach(function(item) {
4716
+ if (item) {
4717
+ Object.keys(item).forEach(function(key2) {
4718
+ if (item[key2] !== void 0) {
4719
+ ret[key2] = item[key2];
4720
+ }
4721
+ });
4722
+ }
4723
+ });
4724
+ return ret;
4725
+ }
4726
+ function mergeProp(defaultProp) {
4727
+ for (var _len = arguments.length, propList = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
4728
+ propList[_key - 1] = arguments[_key];
4729
+ }
4730
+ for (var i2 = propList.length - 1; i2 >= 0; i2 -= 1) {
4731
+ if (propList[i2] !== void 0) {
4732
+ return propList[i2];
4733
+ }
4734
+ }
4735
+ return defaultProp;
4736
+ }
4737
+ var padZero = function(num) {
4738
+ var targetLength = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 2;
4739
+ var str = "".concat(num);
4740
+ while (str.length < targetLength) {
4741
+ str = "0".concat(str);
4742
+ }
4743
+ return str;
4744
+ };
4745
+ function preventDefault$1(event, isStopPropagation) {
4746
+ if (typeof event.cancelable !== "boolean" || event.cancelable) {
4747
+ event.preventDefault();
4748
+ }
4749
+ if (isStopPropagation) {
4750
+ event.stopPropagation();
4751
+ }
4752
+ }
4753
+ var pxCheck = function(value2) {
4754
+ return parseFloat(value2.toString());
4755
+ };
4756
+ var fullClone = _object_spread({}, ReactDOM__namespace);
4757
+ var version = fullClone.version, reactRender = fullClone.render, unmountComponentAtNode = fullClone.unmountComponentAtNode;
4758
+ var createRoot;
4759
+ try {
4760
+ var mainVersion = Number((version || "").split(".")[0]);
4761
+ if (mainVersion >= 18 && fullClone.createRoot) {
4762
+ createRoot = fullClone.createRoot;
4763
+ }
4764
+ } catch (e) {
4765
+ }
4766
+ function toggleWarning(skip) {
4767
+ var __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = fullClone.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
4768
+ if (__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED && (typeof __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === "undefined" ? "undefined" : _type_of(__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)) === "object") {
4769
+ __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.usingClientEntryPoint = skip;
4770
+ }
4771
+ }
4772
+ var MARK = "__nutui_react_root__";
4773
+ function legacyRender(node, container) {
4774
+ reactRender(node, container);
4775
+ }
4776
+ function concurrentRender(node, container) {
4777
+ toggleWarning(true);
4778
+ var root2 = container[MARK] || createRoot(container);
4779
+ toggleWarning(false);
4780
+ root2.render(node);
4781
+ container[MARK] = root2;
4782
+ }
4783
+ function render(node, container) {
4784
+ if (createRoot) {
4785
+ concurrentRender(node, container);
4786
+ return;
4787
+ }
4788
+ legacyRender(node, container);
4789
+ }
4790
+ function legacyUnmount(container) {
4791
+ return unmountComponentAtNode(container);
4792
+ }
4793
+ function concurrentUnmount(container) {
4794
+ return _concurrentUnmount.apply(this, arguments);
4795
+ }
4796
+ function _concurrentUnmount() {
4797
+ _concurrentUnmount = _async_to_generator(function(container) {
4798
+ return __generator(this, function(_state) {
4799
+ return [
4800
+ 2,
4801
+ Promise.resolve().then(function() {
4802
+ var _container_MARK;
4803
+ (_container_MARK = container[MARK]) === null || _container_MARK === void 0 ? void 0 : _container_MARK.unmount();
4804
+ delete container[MARK];
4805
+ })
4806
+ ];
4807
+ });
4808
+ });
4809
+ return _concurrentUnmount.apply(this, arguments);
4810
+ }
4811
+ function unmount(container) {
4812
+ if (createRoot) {
4813
+ return concurrentUnmount(container);
4814
+ }
4815
+ return legacyUnmount(container);
4816
+ }
4817
+ function rubberband(distance, dimension, constant) {
4818
+ return distance * dimension * constant / (dimension + constant * distance);
4819
+ }
4820
+ function rubberbandIfOutOfBounds(position2, min, max, dimension) {
4821
+ var constant = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 0.15;
4822
+ if (constant === 0) return bound(position2, min, max);
4823
+ if (position2 < min) return -rubberband(min - position2, dimension, constant) + min;
4824
+ if (position2 > max) return +rubberband(position2 - max, dimension, constant) + max;
4825
+ return position2;
4826
+ }
4827
+ var sleep = function(time2) {
4828
+ return new Promise(function(resolve) {
4829
+ return setTimeout(resolve, time2);
4830
+ });
4831
+ };
4832
+ function toArray(value2) {
4833
+ if (value2 === void 0 || value2 === null) {
4834
+ return [];
4835
+ }
4836
+ return Array.isArray(value2) ? value2 : [
4837
+ value2
4838
+ ];
4839
+ }
4840
+ var upperCaseFirst = function(str) {
4841
+ str = str.toLowerCase();
4842
+ str = str.replace(/\b\w+\b/g, function(word) {
4843
+ return word.substring(0, 1).toUpperCase() + word.substring(1);
4844
+ });
4845
+ return str;
4846
+ };
4847
+ function useForceUpdate() {
4848
+ var _React_useState = _sliced_to_array(React.useState(), 2), updateState = _React_useState[1];
4849
+ return React.useCallback(function() {
4850
+ return updateState({});
4851
+ }, []);
4852
+ }
4853
+ var customEvents = new Taro.Events();
4854
+ function useCustomEventsPath(selector) {
4855
+ var _getCurrentInstance_router;
4856
+ selector = selector || "";
4857
+ var path = (_getCurrentInstance_router = Taro.getCurrentInstance().router) === null || _getCurrentInstance_router === void 0 ? void 0 : _getCurrentInstance_router.path;
4858
+ return path ? "".concat(path, "__").concat(selector) : selector;
4859
+ }
4860
+ function useCustomEvent(selector, cb) {
4861
+ var path = useCustomEventsPath(selector);
4862
+ React.useEffect(function() {
4863
+ customEvents.on(path, cb);
4864
+ return function() {
4865
+ customEvents.off(path);
4866
+ };
4867
+ }, []);
4868
+ var trigger = function(args) {
4869
+ customEvents.trigger(path, args);
4870
+ };
4871
+ var off = function() {
4872
+ customEvents.off(path);
4873
+ };
4874
+ return [
4875
+ trigger,
4876
+ off
4877
+ ];
4878
+ }
4879
+ function useParams(args) {
4880
+ var forceUpdate = useForceUpdate();
4881
+ var stateRef = React.useRef(args);
4882
+ var currentRef = React.useRef();
4883
+ var previousRef = React.useRef();
4884
+ if (!isEqual(currentRef.current, args)) {
4885
+ previousRef.current = currentRef.current;
4886
+ currentRef.current = args;
4887
+ stateRef.current = args;
4888
+ }
4889
+ var setParams = function(args2) {
4890
+ stateRef.current = _object_spread({}, stateRef.current, args2);
4891
+ forceUpdate();
4892
+ };
4893
+ var params = stateRef.current;
4894
+ return {
4895
+ params,
4896
+ setParams
4897
+ };
4898
+ }
4899
+ var useIsomorphicLayoutEffect = canUseDom ? React.useLayoutEffect : React.useEffect;
4900
+ var defaultPaginationOptions = {
4901
+ current: 0,
4902
+ itemsPerPage: 10,
4903
+ displayCount: 5,
4904
+ ellipse: false
4905
+ };
4906
+ function human2Machine(number2) {
4907
+ return --number2;
4908
+ }
4909
+ function calculateNodes(options, nodesCount) {
4910
+ var halfIndex = Math.floor(options.displayCount / 2);
4911
+ var buttonsCountIndex = human2Machine(nodesCount);
4912
+ var displayCountIndex = human2Machine(options.displayCount);
4913
+ var currentIndex = human2Machine(options.current);
4914
+ var start;
4915
+ var end;
4916
+ if (buttonsCountIndex <= displayCountIndex) {
4917
+ start = 0;
4918
+ end = buttonsCountIndex;
4919
+ } else {
4920
+ start = Math.max(0, currentIndex - halfIndex);
4921
+ end = Math.min(buttonsCountIndex, currentIndex + halfIndex);
4922
+ if (end - start < displayCountIndex) {
4923
+ if (start === 0) {
4924
+ end = Math.min(start + displayCountIndex, buttonsCountIndex);
4925
+ } else if (end === buttonsCountIndex) {
4926
+ start = Math.max(end - displayCountIndex, 1);
4927
+ }
4928
+ } else if (end - start > displayCountIndex) {
4929
+ end = start + displayCountIndex;
4930
+ }
4931
+ }
4932
+ var buttons = [];
4933
+ for (var i2 = start; i2 <= end; i2++) {
4934
+ var humanPageNumber = i2 + 1;
4935
+ buttons.push({
4936
+ number: humanPageNumber,
4937
+ text: humanPageNumber.toString(),
4938
+ selected: options.current === humanPageNumber
4939
+ });
4940
+ }
4941
+ return addEllipses(buttons, {
4942
+ nodesCount,
4943
+ ellipse: options.ellipse,
4944
+ displayCount: options.displayCount
4945
+ });
4946
+ }
4947
+ function addEllipses(nodes, param) {
4948
+ var displayCount = param.displayCount, nodesCount = param.nodesCount, ellipse = param.ellipse;
4949
+ if (nodesCount <= displayCount || !ellipse) return nodes;
4950
+ var start = nodes[0];
4951
+ var end = nodes[nodes.length - 1];
4952
+ var leftEllipse = start.number > 1;
4953
+ var rightEllipse = end.number < nodesCount;
4954
+ if (leftEllipse) {
4955
+ nodes.unshift({
4956
+ number: start.number - 1,
4957
+ text: "..."
4958
+ });
4959
+ }
4960
+ if (rightEllipse) {
4961
+ nodes.push({
4962
+ number: end.number + 1,
4963
+ text: "..."
4964
+ });
4965
+ }
4966
+ return nodes;
4967
+ }
4968
+ var usePagination = function(options) {
4969
+ var mergedOptions = _object_spread({}, defaultPaginationOptions, options);
4970
+ var total = mergedOptions.total, itemsPerPage = mergedOptions.itemsPerPage;
4971
+ var nodesCount = Math.ceil((total || 0) / itemsPerPage) || 1;
4972
+ return [
4973
+ calculateNodes(mergedOptions, nodesCount),
4974
+ nodesCount
4975
+ ];
4976
+ };
4977
+ function usePropsValue(param) {
4978
+ var value2 = param.value, defaultValue = param.defaultValue, finalValue = param.finalValue, _param_onChange = param.onChange, onChange = _param_onChange === void 0 ? function(value3) {
4979
+ } : _param_onChange;
4980
+ var forceUpdate = useForceUpdate();
4981
+ var dfValue = defaultValue !== void 0 ? defaultValue : finalValue;
4982
+ var stateRef = React.useRef(value2 !== void 0 ? value2 : dfValue);
4983
+ if (value2 !== void 0) {
4984
+ stateRef.current = value2;
4985
+ }
4986
+ var setState = React.useCallback(function(v) {
4987
+ var forceTrigger = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
4988
+ var prevState = stateRef.current;
4989
+ stateRef.current = v;
4990
+ if (prevState !== stateRef.current || forceTrigger) {
4991
+ forceUpdate();
4992
+ onChange === null || onChange === void 0 ? void 0 : onChange(v);
4993
+ }
4994
+ }, [
4995
+ value2,
4996
+ onChange
4997
+ ]);
4998
+ return [
4999
+ stateRef.current,
5000
+ setState
5001
+ ];
5002
+ }
5003
+ var getRefValue = function(ref) {
5004
+ return ref.current;
5005
+ };
5006
+ var useRefState = function(param) {
5007
+ var ref = React.useRef(param);
5008
+ var _useState = _sliced_to_array(React.useState(param), 2), setState = _useState[1];
5009
+ var updateState = function(p) {
5010
+ ref.current = p;
5011
+ setState(p);
5012
+ };
5013
+ return [
5014
+ ref,
5015
+ updateState
5016
+ ];
5017
+ };
5018
+ function useRefs() {
5019
+ var refs = React.useRef([]);
5020
+ var setRefs = React.useCallback(function(index2) {
5021
+ return function(el) {
5022
+ if (el) refs.current[index2] = el;
5023
+ };
5024
+ }, []);
5025
+ var reset = React.useCallback(function() {
5026
+ refs.current = [];
5027
+ }, []);
5028
+ return [
5029
+ refs.current,
5030
+ setRefs,
5031
+ reset
5032
+ ];
4304
5033
  }
4305
5034
  var elevatorContext = /* @__PURE__ */ React.createContext({});
4306
5035
  var defaultProps$1n = _object_spread_props(_object_spread({}, ComponentDefaults), {
5036
+ mode: "horizontal",
4307
5037
  height: "200px",
4308
5038
  floorKey: "title",
4309
5039
  list: [],
4310
5040
  sticky: false,
4311
- spaceHeight: 23,
4312
- titleHeight: 35,
5041
+ spaceHeight: 18,
4313
5042
  showKeys: true,
4314
- className: "weapp-elevator"
5043
+ defaultValue: void 0,
5044
+ value: void 0
4315
5045
  });
4316
5046
  var Elevator = function(props) {
4317
- var _ref = _object_spread({}, defaultProps$1n, props), height2 = _ref.height, floorKey = _ref.floorKey, list = _ref.list, sticky = _ref.sticky, spaceHeight = _ref.spaceHeight;
4318
- _ref.titleHeight;
4319
- var showKeys = _ref.showKeys, className = _ref.className, style = _ref.style, onItemClick = _ref.onItemClick, onIndexClick = _ref.onIndexClick, children = _ref.children, rest = _object_without_properties(_ref, [
5047
+ var _ref = _object_spread({}, defaultProps$1n, props), value2 = _ref.value, defaultValue = _ref.defaultValue, mode = _ref.mode, height2 = _ref.height, floorKey = _ref.floorKey, list = _ref.list, sticky = _ref.sticky, spaceHeight = _ref.spaceHeight, showKeys = _ref.showKeys, className = _ref.className, style = _ref.style, onItemClick = _ref.onItemClick, onIndexClick = _ref.onIndexClick, children = _ref.children, rest = _object_without_properties(_ref, [
5048
+ "value",
5049
+ "defaultValue",
5050
+ "mode",
4320
5051
  "height",
4321
5052
  "floorKey",
4322
5053
  "list",
4323
5054
  "sticky",
4324
5055
  "spaceHeight",
4325
- "titleHeight",
4326
5056
  "showKeys",
4327
5057
  "className",
4328
5058
  "style",
@@ -4332,25 +5062,25 @@
4332
5062
  ]);
4333
5063
  var uuid = useUuid();
4334
5064
  var classPrefix2 = "nut-elevator";
4335
- var listview = React.useRef(null);
4336
5065
  var initData = {
4337
5066
  anchorIndex: 0,
4338
5067
  listHeight: [],
4339
- listGroup: [],
4340
5068
  scrollY: 0
4341
5069
  };
4342
5070
  var touchState = React.useRef({
4343
5071
  y1: 0,
4344
5072
  y2: 0
4345
5073
  });
4346
- var _useState = _sliced_to_array(React.useState({}), 2), currentData = _useState[0], setCurrentData = _useState[1];
4347
- var _useState1 = _sliced_to_array(React.useState(""), 2), currentKey = _useState1[0], setCurrentKey = _useState1[1];
4348
- var _useState2 = _sliced_to_array(React.useState(0), 2), codeIndex = _useState2[0], setCodeIndex = _useState2[1];
4349
- var _useState3 = _sliced_to_array(React.useState(false), 2), scrollStart = _useState3[0], setScrollStart = _useState3[1];
5074
+ var _usePropsValue = _sliced_to_array(usePropsValue({
5075
+ value: value2,
5076
+ defaultValue: defaultValue || {}
5077
+ }), 2), currentData = _usePropsValue[0], setCurrentData = _usePropsValue[1];
5078
+ var _useState = _sliced_to_array(React.useState(0), 2), codeIndex = _useState[0], setCodeIndex = _useState[1];
5079
+ var _useState1 = _sliced_to_array(React.useState(false), 2), scrollStart = _useState1[0], setScrollStart = _useState1[1];
4350
5080
  var state = React.useRef(initData);
4351
5081
  var scrolling = React.useRef(false);
4352
- var _useState4 = _sliced_to_array(React.useState(0), 2), scrollTop = _useState4[0], setScrollTop = _useState4[1];
4353
- var _useState5 = _sliced_to_array(React.useState(0), 2), scrollY = _useState5[0], setScrollY = _useState5[1];
5082
+ var _useState2 = _sliced_to_array(React.useState(0), 2), scrollTop = _useState2[0], setScrollTop = _useState2[1];
5083
+ var _useState3 = _sliced_to_array(React.useState(0), 2), scrollY = _useState3[0], setScrollY = _useState3[1];
4354
5084
  var resetScrollState = function() {
4355
5085
  setScrollStart(false);
4356
5086
  };
@@ -4361,38 +5091,69 @@
4361
5091
  return el.dataset.index;
4362
5092
  };
4363
5093
  var calculateHeight = function() {
4364
- var height3 = 0;
4365
- state.current.listHeight.push(height3);
4366
- for (var i2 = 0; i2 < state.current.listGroup.length; i2++) {
4367
- var query = Taro.createSelectorQuery();
4368
- query.selectAll(".".concat(classPrefix2, "-").concat(uuid, " .nut-elevator-item-").concat(i2)).boundingClientRect();
4369
- query.exec(function(res) {
4370
- if (res[0][0]) height3 += res[0][0].height;
4371
- state.current.listHeight.push(height3);
4372
- });
4373
- }
4374
- };
4375
- var scrollTo = function(index2) {
4376
- if (!index2 && index2 !== 0) {
4377
- return;
4378
- }
4379
- if (!state.current.listHeight.length) {
4380
- calculateHeight();
4381
- }
4382
- var cacheIndex = index2;
4383
- if (index2 < 0) {
4384
- cacheIndex = 0;
4385
- }
4386
- if (index2 > state.current.listHeight.length - 2) {
4387
- cacheIndex = Math.max(0, state.current.listHeight.length - 2);
4388
- }
4389
- setCodeIndex(cacheIndex);
4390
- var scrollTop2 = state.current.listHeight[cacheIndex];
4391
- setScrollTop(scrollTop2);
4392
- if (sticky && scrollY !== scrollTop2) {
4393
- setScrollY(Math.floor(scrollTop2) > 0 ? 1 : 0);
4394
- }
5094
+ state.current.listHeight = [
5095
+ 0
5096
+ ];
5097
+ var query = Taro.createSelectorQuery();
5098
+ query.selectAll("#".concat(classPrefix2, "-").concat(uuid, " .").concat(classPrefix2, "-list-item")).boundingClientRect().exec(function() {
5099
+ var rect = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
5100
+ if (rect[0] && rect[0].length) {
5101
+ state.current.listHeight = rect[0].reduce(function(acc, item, index2) {
5102
+ var height3 = acc[index2] + item.height;
5103
+ acc.push(height3);
5104
+ return acc;
5105
+ }, [
5106
+ 0
5107
+ ]);
5108
+ }
5109
+ });
4395
5110
  };
5111
+ var scrollTo = /* @__PURE__ */ function() {
5112
+ var _ref2 = _async_to_generator(function(index2) {
5113
+ var cacheIndex, scrollTop2;
5114
+ return __generator(this, function(_state) {
5115
+ switch (_state.label) {
5116
+ case 0:
5117
+ if (!index2 && index2 !== 0) {
5118
+ return [
5119
+ 2
5120
+ ];
5121
+ }
5122
+ if (!!state.current.listHeight.length) return [
5123
+ 3,
5124
+ 2
5125
+ ];
5126
+ return [
5127
+ 4,
5128
+ calculateHeight()
5129
+ ];
5130
+ case 1:
5131
+ _state.sent();
5132
+ _state.label = 2;
5133
+ case 2:
5134
+ cacheIndex = index2;
5135
+ if (index2 < 0) {
5136
+ cacheIndex = 0;
5137
+ }
5138
+ if (index2 > state.current.listHeight.length - 2) {
5139
+ cacheIndex = Math.max(0, state.current.listHeight.length - 2);
5140
+ }
5141
+ setCodeIndex(cacheIndex);
5142
+ scrollTop2 = state.current.listHeight[cacheIndex];
5143
+ setScrollTop(scrollTop2);
5144
+ if (mode === "vertical" && sticky) {
5145
+ setScrollY(Math.floor(scrollTop2) > 0 ? 1 : 0);
5146
+ }
5147
+ return [
5148
+ 2
5149
+ ];
5150
+ }
5151
+ });
5152
+ });
5153
+ return function scrollTo2(index2) {
5154
+ return _ref2.apply(this, arguments);
5155
+ };
5156
+ }();
4396
5157
  var touchMove = function(e) {
4397
5158
  var firstTouch = e.touches[0];
4398
5159
  touchState.current.y2 = firstTouch.pageY;
@@ -4417,39 +5178,31 @@
4417
5178
  var handleClickItem = function(key2, item) {
4418
5179
  onItemClick && onItemClick(key2, item);
4419
5180
  setCurrentData(item);
4420
- setCurrentKey(key2);
4421
5181
  };
4422
5182
  var handleClickIndex = function(key2) {
4423
5183
  onIndexClick && onIndexClick(key2);
4424
5184
  };
4425
- var setListGroup = function() {
4426
- if (listview.current) {
4427
- Taro.createSelectorQuery().selectAll(".".concat(classPrefix2, "-").concat(uuid, " .nut-elevator-list-item")).node(function(el) {
4428
- state.current.listGroup = _to_consumable_array(Object.keys(el));
4429
- calculateHeight();
4430
- }).exec();
4431
- }
4432
- };
4433
5185
  var listViewScroll = function(e) {
4434
- var listHeight = state.current.listHeight;
4435
- if (!listHeight.length) {
4436
- calculateHeight();
4437
- }
4438
- var target = e.target;
4439
- var scrollTop2 = target.scrollTop;
4440
- state.current.scrollY = Math.floor(scrollTop2);
4441
- Taro.getEnv() === "WEB" && setScrollTop(scrollTop2);
4442
- if (sticky && scrollTop2 !== scrollY) {
4443
- setScrollY(Math.floor(scrollTop2) > 0 ? 1 : 0);
4444
- }
4445
- if (scrolling.current) return;
4446
- for (var i2 = 0; i2 < listHeight.length - 1; i2++) {
4447
- var height1 = listHeight[i2];
4448
- var height22 = listHeight[i2 + 1];
4449
- if (state.current.scrollY >= height1 && state.current.scrollY < height22) {
4450
- return setCodeIndex(i2);
5186
+ requestAniFrame$1(function() {
5187
+ var listHeight = state.current.listHeight;
5188
+ if (!listHeight.length) {
5189
+ calculateHeight();
4451
5190
  }
4452
- }
5191
+ var target = e.target;
5192
+ var scrollTop2 = target.scrollTop;
5193
+ state.current.scrollY = Math.floor(scrollTop2);
5194
+ Taro.getEnv() === "WEB" && setScrollTop(scrollTop2);
5195
+ if (mode === "vertical" && sticky) {
5196
+ setScrollY(Math.floor(scrollTop2) > 0 ? 1 : 0);
5197
+ }
5198
+ if (scrolling.current) return;
5199
+ var index2 = listHeight.findIndex(function(height3, i2) {
5200
+ return state.current.scrollY >= height3 && state.current.scrollY < (listHeight[i2 + 1] || Infinity);
5201
+ });
5202
+ if (index2 !== -1 && index2 !== codeIndex) {
5203
+ setCodeIndex(index2);
5204
+ }
5205
+ });
4453
5206
  };
4454
5207
  var getWrapStyle = React.useMemo(function() {
4455
5208
  var calcHeight = Number.isNaN(+height2) ? height2 : "".concat(height2, "px");
@@ -4460,17 +5213,14 @@
4460
5213
  height2
4461
5214
  ]);
4462
5215
  React.useEffect(function() {
4463
- if (listview.current) {
4464
- Taro.nextTick(function() {
4465
- setListGroup();
4466
- });
4467
- }
4468
- }, [
4469
- listview
4470
- ]);
5216
+ Taro.nextTick(function() {
5217
+ calculateHeight();
5218
+ });
5219
+ }, []);
4471
5220
  var _obj;
4472
5221
  return /* @__PURE__ */ React.createElement("div", _object_spread({
4473
- className: "".concat(classPrefix2, " ").concat(className, " ").concat(classPrefix2, "-").concat(uuid),
5222
+ className: "".concat(classPrefix2, " ").concat(className, " ").concat(classPrefix2, "-").concat(mode, " "),
5223
+ id: "".concat(classPrefix2, "-").concat(uuid),
4474
5224
  style
4475
5225
  }, rest), /* @__PURE__ */ React.createElement(components.View, {
4476
5226
  className: "".concat(classPrefix2, "-list"),
@@ -4478,11 +5228,10 @@
4478
5228
  }, /* @__PURE__ */ React.createElement(components.ScrollView, {
4479
5229
  scrollTop,
4480
5230
  scrollY: true,
4481
- scrollWithAnimation: true,
5231
+ enhanced: true,
5232
+ scrollWithAnimation: false,
4482
5233
  scrollAnchoring: true,
4483
5234
  className: "".concat(classPrefix2, "-list-inner"),
4484
- type: "list",
4485
- ref: listview,
4486
5235
  onScroll: listViewScroll,
4487
5236
  onTouchStart: function(e) {
4488
5237
  scrolling.current = false;
@@ -4493,10 +5242,12 @@
4493
5242
  key: idx
4494
5243
  }, /* @__PURE__ */ React.createElement(components.View, {
4495
5244
  className: "".concat(classPrefix2, "-list-item-code")
4496
- }, item[floorKey]), /* @__PURE__ */ React.createElement(React.Fragment, null, item.list.map(function(subitem) {
5245
+ }, item[floorKey]), /* @__PURE__ */ React.createElement(components.View, {
5246
+ className: "".concat(classPrefix2, "-list-item-sublist")
5247
+ }, item.list.map(function(subitem) {
4497
5248
  var _obj2;
4498
5249
  return /* @__PURE__ */ React.createElement(components.View, {
4499
- className: classNames((_obj2 = {}, _define_property(_obj2, "".concat(classPrefix2, "-list-item-name"), true), _define_property(_obj2, "".concat(classPrefix2, "-list-item-name-highcolor"), currentData.id === subitem.id && currentKey === item[floorKey]), _obj2)),
5250
+ className: classNames((_obj2 = {}, _define_property(_obj2, "".concat(classPrefix2, "-list-item-name"), true), _define_property(_obj2, "".concat(classPrefix2, "-list-item-name-highcolor"), currentData.id === subitem.id), _obj2)),
4500
5251
  key: subitem.id,
4501
5252
  onClick: function() {
4502
5253
  return handleClickItem(item[floorKey], subitem);
@@ -4507,7 +5258,7 @@
4507
5258
  })));
4508
5259
  }))), showKeys ? /* @__PURE__ */ React.createElement(React.Fragment, null, list.length && scrollStart ? /* @__PURE__ */ React.createElement(components.View, {
4509
5260
  className: classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-code-current"), true), _define_property(_obj, "".concat(classPrefix2, "-code-current-current"), true), _obj))
4510
- }, list[codeIndex][floorKey]) : null, /* @__PURE__ */ React.createElement(components.View, {
5261
+ }, list[codeIndex] && String(list[codeIndex][floorKey])) : null, /* @__PURE__ */ React.createElement(components.View, {
4511
5262
  className: "".concat(classPrefix2, "-bars")
4512
5263
  }, /* @__PURE__ */ React.createElement(components.View, {
4513
5264
  className: "".concat(classPrefix2, "-bars-inner")
@@ -4530,19 +5281,15 @@
4530
5281
  style: {
4531
5282
  touchAction: "pan-y"
4532
5283
  }
4533
- }, item[floorKey]);
4534
- })))) : null, sticky && scrollY > 0 ? /* @__PURE__ */ React.createElement(components.View, {
5284
+ }, String(item[floorKey]));
5285
+ })))) : null, mode === "vertical" && sticky && scrollY > 0 ? /* @__PURE__ */ React.createElement(components.View, {
4535
5286
  className: "".concat(classPrefix2, "-list-fixed")
4536
5287
  }, /* @__PURE__ */ React.createElement(components.Text, {
4537
5288
  className: "".concat(classPrefix2, "-list-fixed-title")
4538
- }, list[codeIndex][floorKey])) : null);
5289
+ }, list[codeIndex] && String(list[codeIndex][floorKey]))) : null);
4539
5290
  };
4540
5291
  Elevator.displayName = "NutElevator";
4541
5292
  Elevator.Context = elevatorContext;
4542
- function _type_of(obj) {
4543
- "@swc/helpers - typeof";
4544
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
4545
- }
4546
5293
  var defaultProps$1m = _object_spread_props(_object_spread({}, ComponentDefaults), {
4547
5294
  value: "",
4548
5295
  dot: false,
@@ -4744,85 +5491,6 @@
4744
5491
  }, renderWrapper()) : renderWrapper());
4745
5492
  };
4746
5493
  NavBar.displayName = "NutNavBar";
4747
- function useForceUpdate() {
4748
- var _React_useState = _sliced_to_array(React.useState(), 2), updateState = _React_useState[1];
4749
- return React.useCallback(function() {
4750
- return updateState({});
4751
- }, []);
4752
- }
4753
- function usePropsValue(param) {
4754
- var value2 = param.value, defaultValue = param.defaultValue, finalValue = param.finalValue, _param_onChange = param.onChange, onChange = _param_onChange === void 0 ? function(value3) {
4755
- } : _param_onChange;
4756
- var forceUpdate = useForceUpdate();
4757
- var dfValue = defaultValue !== void 0 ? defaultValue : finalValue;
4758
- var stateRef = React.useRef(value2 !== void 0 ? value2 : dfValue);
4759
- if (value2 !== void 0) {
4760
- stateRef.current = value2;
4761
- }
4762
- var setState = React.useCallback(function(v) {
4763
- var forceTrigger = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
4764
- var prevState = stateRef.current;
4765
- stateRef.current = v;
4766
- if (prevState !== stateRef.current || forceTrigger) {
4767
- forceUpdate();
4768
- onChange === null || onChange === void 0 ? void 0 : onChange(v);
4769
- }
4770
- }, [
4771
- value2,
4772
- onChange
4773
- ]);
4774
- return [
4775
- stateRef.current,
4776
- setState
4777
- ];
4778
- }
4779
- function requestAniFrame() {
4780
- if (inBrowser) {
4781
- var _window = window;
4782
- return _window.requestAnimationFrame || _window.webkitRequestAnimationFrame || function(callback) {
4783
- _window.setTimeout(callback, 1e3 / 60);
4784
- };
4785
- }
4786
- return function(callback) {
4787
- setTimeout(callback, 1e3 / 60);
4788
- };
4789
- }
4790
- function cancelRaf(id) {
4791
- if (inBrowser) {
4792
- var _window = window;
4793
- (_window.cancelAnimationFrame || _window.webkitCancelAnimationFrame)(id);
4794
- } else {
4795
- clearTimeout(id);
4796
- }
4797
- }
4798
- const requestAniFrame$1 = requestAniFrame();
4799
- function mergeProps() {
4800
- for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) {
4801
- items[_key] = arguments[_key];
4802
- }
4803
- var ret = {};
4804
- items.forEach(function(item) {
4805
- if (item) {
4806
- Object.keys(item).forEach(function(key2) {
4807
- if (item[key2] !== void 0) {
4808
- ret[key2] = item[key2];
4809
- }
4810
- });
4811
- }
4812
- });
4813
- return ret;
4814
- }
4815
- function mergeProp(defaultProp) {
4816
- for (var _len = arguments.length, propList = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
4817
- propList[_key - 1] = arguments[_key];
4818
- }
4819
- for (var i2 = propList.length - 1; i2 >= 0; i2 -= 1) {
4820
- if (propList[i2] !== void 0) {
4821
- return propList[i2];
4822
- }
4823
- }
4824
- return defaultProp;
4825
- }
4826
5494
  var defaultProps$1j = {
4827
5495
  title: "",
4828
5496
  value: "",
@@ -5742,12 +6410,6 @@
5742
6410
  }
5743
6411
  return null;
5744
6412
  };
5745
- var isEmpty = function(p) {
5746
- if (p === null || p === void 0) return true;
5747
- if ((typeof p === "undefined" ? "undefined" : _type_of(p)) === "object" && Object.keys(p).length === 0) return true;
5748
- if (Array.isArray(p) && p.length === 0) return true;
5749
- return false;
5750
- };
5751
6413
  var defaultProps$1b = _object_spread_props(_object_spread({}, ComponentDefaults), {
5752
6414
  visible: false,
5753
6415
  type: "elevator",
@@ -5986,21 +6648,6 @@
5986
6648
  }), renderContent()) : renderContent();
5987
6649
  };
5988
6650
  ElevatorRender.displayName = "NutElevatorRender";
5989
- var getRefValue = function(ref) {
5990
- return ref.current;
5991
- };
5992
- var useRefState = function(param) {
5993
- var ref = React.useRef(param);
5994
- var _useState = _sliced_to_array(React.useState(param), 2), setState = _useState[1];
5995
- var updateState = function(p) {
5996
- ref.current = p;
5997
- setState(p);
5998
- };
5999
- return [
6000
- ref,
6001
- updateState
6002
- ];
6003
- };
6004
6651
  var defaultProps$1a = _object_spread_props(_object_spread({}, ComponentDefaults), {
6005
6652
  activeColor: "",
6006
6653
  activeIcon: "checklist",
@@ -6593,234 +7240,6 @@
6593
7240
  };
6594
7241
  var Address = /* @__PURE__ */ React.forwardRef(InternalAddress);
6595
7242
  Address.displayName = "NutAddress";
6596
- var Utils = {
6597
- /**
6598
- * 是否为闫年
6599
- * @return {Boolse} true|false
6600
- */
6601
- isLeapYear: function isLeapYear(y) {
6602
- return y % 4 === 0 && y % 100 !== 0 || y % 400 === 0;
6603
- },
6604
- /**
6605
- * 返回星期数
6606
- * @return {String}
6607
- */
6608
- getWhatDay: function getWhatDay(year, month, day) {
6609
- var date2 = new Date("".concat(year, "/").concat(month, "/").concat(day));
6610
- var index2 = date2.getDay();
6611
- var dayNames = [
6612
- "星期日",
6613
- "星期一",
6614
- "星期二",
6615
- "星期三",
6616
- "星期四",
6617
- "星期五",
6618
- "星期六"
6619
- ];
6620
- return dayNames[index2];
6621
- },
6622
- /**
6623
- * 返回上一个月在当前面板中的天数
6624
- * @return {Number}
6625
- */
6626
- getMonthPreDay: function getMonthPreDay(year, month) {
6627
- var date2 = new Date("".concat(year, "/").concat(month, "/01"));
6628
- var day = date2.getDay();
6629
- if (day === 0) {
6630
- day = 7;
6631
- }
6632
- return day;
6633
- },
6634
- /**
6635
- * 返回月份天数
6636
- * @return {Number}
6637
- */
6638
- getMonthDays: function getMonthDays(year, month) {
6639
- if (/^0/.test(month)) {
6640
- month = month.split("")[1];
6641
- }
6642
- return [
6643
- 0,
6644
- 31,
6645
- this.isLeapYear(Number(year)) ? 29 : 28,
6646
- 31,
6647
- 30,
6648
- 31,
6649
- 30,
6650
- 31,
6651
- 31,
6652
- 30,
6653
- 31,
6654
- 30,
6655
- 31
6656
- ][month];
6657
- },
6658
- /**
6659
- * 补齐数字位数
6660
- * @return {string}
6661
- */
6662
- getNumTwoBit: function getNumTwoBit(n) {
6663
- n = Number(n);
6664
- return (n > 9 ? "" : "0") + n;
6665
- },
6666
- /**
6667
- * 日期对象转成字符串
6668
- * @return {string}
6669
- */
6670
- date2Str: function date2Str(date2, split) {
6671
- split = split || "-";
6672
- var y = date2.getFullYear();
6673
- var m = this.getNumTwoBit(date2.getMonth() + 1);
6674
- var d = this.getNumTwoBit(date2.getDate());
6675
- return [
6676
- y,
6677
- m,
6678
- d
6679
- ].join(split);
6680
- },
6681
- /**
6682
- * 返回日期格式字符串
6683
- * @param {Number} 0返回今天的日期、1返回明天的日期,2返回后天得日期,依次类推
6684
- * @return {string} '2014-12-31'
6685
- */
6686
- getDay: function getDay(i2) {
6687
- i2 = i2 || 0;
6688
- var date2 = /* @__PURE__ */ new Date();
6689
- var diff = i2 * (1e3 * 60 * 60 * 24);
6690
- date2 = new Date(date2.getTime() + diff);
6691
- return this.date2Str(date2);
6692
- },
6693
- /**
6694
- * 时间比较
6695
- * @return {Boolean}
6696
- */
6697
- compareDate: function compareDate(date1, date2) {
6698
- var startTime = new Date(date1.replace("-", "/").replace("-", "/"));
6699
- var endTime = new Date(date2.replace("-", "/").replace("-", "/"));
6700
- if (startTime >= endTime) {
6701
- return false;
6702
- }
6703
- return true;
6704
- },
6705
- /**
6706
- * 时间是否相等
6707
- * @return {Boolean}
6708
- */
6709
- isEqual: function isEqual2(date1, date2) {
6710
- var startTime = new Date((date1 || "").replace(/-/g, "/")).getTime();
6711
- var endTime = new Date(date2.replace(/-/g, "/")).getTime();
6712
- if (startTime === endTime) {
6713
- return true;
6714
- }
6715
- return false;
6716
- },
6717
- getMonthWeek: function getMonthWeek(year, month, date2) {
6718
- var firstDayOfWeek = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
6719
- var dateNow = new Date(Number(year), parseInt(month) - 1, Number(date2));
6720
- var w = dateNow.getDay();
6721
- var d = dateNow.getDate();
6722
- var remainder = 6 - w;
6723
- if (firstDayOfWeek !== 0) {
6724
- w = w === 0 ? 7 : w;
6725
- remainder = 7 - w;
6726
- }
6727
- return Math.ceil((d + remainder) / 7);
6728
- },
6729
- getYearWeek: function getYearWeek(year, month, date2) {
6730
- var dateNow = new Date(Number(year), parseInt(month) - 1, Number(date2));
6731
- var dateFirst = new Date(Number(year), 0, 1);
6732
- var dataNumber = Math.round((dateNow.valueOf() - dateFirst.valueOf()) / 864e5);
6733
- return Math.ceil((dataNumber + (dateFirst.getDay() + 1 - 1)) / 7);
6734
- },
6735
- getWeekDate: function getWeekDate(year, month, date2) {
6736
- var firstDayOfWeek = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
6737
- var dateNow = new Date(Number(year), parseInt(month) - 1, Number(date2));
6738
- var nowTime = dateNow.getTime();
6739
- var day = dateNow.getDay();
6740
- if (firstDayOfWeek === 0) {
6741
- var oneDayTime = 24 * 60 * 60 * 1e3;
6742
- var SundayTime = nowTime - day * oneDayTime;
6743
- var SaturdayTime = nowTime + (6 - day) * oneDayTime;
6744
- var sunday = this.date2Str(new Date(SundayTime));
6745
- var saturday = this.date2Str(new Date(SaturdayTime));
6746
- return [
6747
- sunday,
6748
- saturday
6749
- ];
6750
- }
6751
- day = day === 0 ? 7 : day;
6752
- var oneDayTime1 = 24 * 60 * 60 * 1e3;
6753
- var MondayTime = nowTime - (day - 1) * oneDayTime1;
6754
- var SundayTime1 = nowTime + (7 - day) * oneDayTime1;
6755
- var monday = this.date2Str(new Date(MondayTime));
6756
- var sunday1 = this.date2Str(new Date(SundayTime1));
6757
- return [
6758
- monday,
6759
- sunday1
6760
- ];
6761
- },
6762
- formatResultDate: function formatResultDate(date2) {
6763
- var days = _to_consumable_array(date2.split("-"));
6764
- days[2] = Utils.getNumTwoBit(Number(days[2]));
6765
- days[3] = "".concat(days[0], "-").concat(days[1], "-").concat(days[2]);
6766
- days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
6767
- return days;
6768
- }
6769
- };
6770
- var getCurrMonthData = function(type2, year, month) {
6771
- switch (type2) {
6772
- case "prev":
6773
- month === 1 && (year -= 1);
6774
- month = month === 1 ? 12 : --month;
6775
- break;
6776
- case "next":
6777
- month === 12 && (year += 1);
6778
- month = month === 12 ? 1 : ++month;
6779
- break;
6780
- }
6781
- return [
6782
- year,
6783
- Utils.getNumTwoBit(month),
6784
- Utils.getMonthDays(String(year), String(month))
6785
- ];
6786
- };
6787
- var getDaysStatus = function(type2, year, month) {
6788
- var days = Utils.getMonthDays("".concat(year), "".concat(month));
6789
- if (type2 === "prev" && days >= 7) {
6790
- days -= 7;
6791
- }
6792
- return Array.from(Array(days), function(v, k) {
6793
- return {
6794
- day: k + 1,
6795
- type: type2,
6796
- year,
6797
- month
6798
- };
6799
- });
6800
- };
6801
- var getPreMonthDates = function(type2, year, month, firstDayOfWeek) {
6802
- var preMonth = +month - 1;
6803
- var preYear = year;
6804
- if (preMonth <= 0) {
6805
- preMonth = 12;
6806
- preYear += 1;
6807
- }
6808
- var days = Utils.getMonthPreDay(+year, +month);
6809
- days -= firstDayOfWeek;
6810
- if (type2 === "prev" && days >= 7) {
6811
- days -= 7;
6812
- }
6813
- var preDates = Utils.getMonthDays("".concat(preYear), "".concat(preMonth));
6814
- var months = Array.from(Array(preDates), function(v, k) {
6815
- return {
6816
- day: k + 1,
6817
- type: type2,
6818
- preYear,
6819
- preMonth
6820
- };
6821
- });
6822
- return months.slice(preDates - days);
6823
- };
6824
7243
  var splitDate = function(date2) {
6825
7244
  var split = date2.indexOf("-") !== -1 ? "-" : "/";
6826
7245
  return date2.split(split);
@@ -8306,263 +8725,6 @@
8306
8725
  CheckboxGroup.displayName = "NutCheckboxGroup";
8307
8726
  var InnerCheckbox = Checkbox;
8308
8727
  InnerCheckbox.Group = CheckboxGroup;
8309
- function addColorForHarmony(maybeElement, color) {
8310
- if (React.isValidElement(maybeElement) && harmony()) {
8311
- return React.cloneElement(maybeElement, {
8312
- color
8313
- });
8314
- }
8315
- return maybeElement;
8316
- }
8317
- function bound(position2, min, max) {
8318
- var ret = position2;
8319
- if (min !== void 0) {
8320
- ret = Math.max(position2, min);
8321
- }
8322
- if (max !== void 0) {
8323
- ret = Math.min(ret, max);
8324
- }
8325
- return ret;
8326
- }
8327
- var clamp = function(num, min, max) {
8328
- return Math.min(Math.max(num, min), max);
8329
- };
8330
- var getRectById = function(id) {
8331
- return new Promise(function(resolve, reject) {
8332
- if (Taro.getEnv() === Taro.ENV_TYPE.WEB) {
8333
- var t = document ? document.querySelector("#".concat(id)) : "";
8334
- if (t) {
8335
- resolve(t === null || t === void 0 ? void 0 : t.getBoundingClientRect());
8336
- }
8337
- reject();
8338
- } else {
8339
- var query = Taro.createSelectorQuery();
8340
- query.select("#".concat(id)).boundingClientRect().exec(function(rect) {
8341
- if (rect[0]) {
8342
- resolve(rect[0]);
8343
- } else {
8344
- reject();
8345
- }
8346
- });
8347
- }
8348
- });
8349
- };
8350
- var isObject = function(val2) {
8351
- return val2 !== null && (typeof val2 === "undefined" ? "undefined" : _type_of(val2)) === "object";
8352
- };
8353
- var isFunction = function(val2) {
8354
- return typeof val2 === "function";
8355
- };
8356
- var isPromise = function(val2) {
8357
- return isObject(val2) && isFunction(val2.then) && isFunction(val2.catch);
8358
- };
8359
- var funcInterceptor = function(interceptor, param) {
8360
- var _param_args = param.args, args = _param_args === void 0 ? [] : _param_args, done = param.done, canceled = param.canceled;
8361
- if (interceptor) {
8362
- var returnVal = interceptor.apply(null, args);
8363
- if (isPromise(returnVal)) {
8364
- returnVal.then(function(value2) {
8365
- if (value2) {
8366
- done(value2);
8367
- } else if (canceled) {
8368
- canceled();
8369
- }
8370
- }).catch(function() {
8371
- });
8372
- } else if (returnVal) {
8373
- done();
8374
- } else if (canceled) {
8375
- canceled();
8376
- }
8377
- } else {
8378
- done();
8379
- }
8380
- };
8381
- var isDate = function(val2) {
8382
- return Object.prototype.toString.call(val2) === "[object Date]" && !Number.isNaN(val2.getTime());
8383
- };
8384
- function isForwardRefComponent(component) {
8385
- return component.type && component.type.$$typeof && // eslint-disable-next-line react/display-name
8386
- React.forwardRef(
8387
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
8388
- // @ts-ignore
8389
- function() {
8390
- }
8391
- ).$$typeof === component.type.$$typeof;
8392
- }
8393
- function main() {
8394
- for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) {
8395
- items[_key] = arguments[_key];
8396
- }
8397
- return merge.apply(void 0, _to_consumable_array(items));
8398
- }
8399
- main.clone = clone;
8400
- main.isPlainObject = isPlainObject;
8401
- main.recursive = recursive;
8402
- function merge() {
8403
- for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) {
8404
- items[_key] = arguments[_key];
8405
- }
8406
- return _merge(items[0] === true, false, items);
8407
- }
8408
- function recursive() {
8409
- for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) {
8410
- items[_key] = arguments[_key];
8411
- }
8412
- return _merge(items[0] === true, true, items);
8413
- }
8414
- function clone(input) {
8415
- if (Array.isArray(input)) {
8416
- var output = [];
8417
- for (var index2 = 0; index2 < input.length; ++index2) output.push(clone(input[index2]));
8418
- return output;
8419
- }
8420
- if (isPlainObject(input)) {
8421
- var output1 = {};
8422
- for (var index1 in input) output1[index1] = clone(input[index1]);
8423
- return output1;
8424
- }
8425
- return input;
8426
- }
8427
- function isPlainObject(input) {
8428
- if (input === null || (typeof input === "undefined" ? "undefined" : _type_of(input)) !== "object") return false;
8429
- if (Object.getPrototypeOf(input) === null) return true;
8430
- var ref = input;
8431
- while (Object.getPrototypeOf(ref) !== null) ref = Object.getPrototypeOf(ref);
8432
- return Object.getPrototypeOf(input) === ref;
8433
- }
8434
- function _recursiveMerge(base, extend) {
8435
- if (!isPlainObject(base) || !isPlainObject(extend)) return extend;
8436
- for (var key2 in extend) {
8437
- if (key2 === "__proto__" || key2 === "constructor" || key2 === "prototype") continue;
8438
- base[key2] = isPlainObject(base[key2]) && isPlainObject(extend[key2]) ? _recursiveMerge(base[key2], extend[key2]) : extend[key2];
8439
- }
8440
- return base;
8441
- }
8442
- function _merge(isClone, isRecursive, items) {
8443
- var result;
8444
- if (isClone || !isPlainObject(result = items.shift())) result = {};
8445
- for (var index2 = 0; index2 < items.length; ++index2) {
8446
- var item = items[index2];
8447
- if (!isPlainObject(item)) continue;
8448
- for (var key2 in item) {
8449
- if (key2 === "__proto__" || key2 === "constructor" || key2 === "prototype") continue;
8450
- var value2 = isClone ? clone(item[key2]) : item[key2];
8451
- result[key2] = isRecursive ? _recursiveMerge(result[key2], value2) : value2;
8452
- }
8453
- }
8454
- return result;
8455
- }
8456
- var padZero = function(num) {
8457
- var targetLength = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 2;
8458
- var str = "".concat(num);
8459
- while (str.length < targetLength) {
8460
- str = "0".concat(str);
8461
- }
8462
- return str;
8463
- };
8464
- function preventDefault$1(event, isStopPropagation) {
8465
- if (typeof event.cancelable !== "boolean" || event.cancelable) {
8466
- event.preventDefault();
8467
- }
8468
- if (isStopPropagation) {
8469
- event.stopPropagation();
8470
- }
8471
- }
8472
- var pxCheck = function(value2) {
8473
- return parseFloat(value2.toString());
8474
- };
8475
- var fullClone = _object_spread({}, ReactDOM__namespace);
8476
- var version = fullClone.version, reactRender = fullClone.render, unmountComponentAtNode = fullClone.unmountComponentAtNode;
8477
- var createRoot;
8478
- try {
8479
- var mainVersion = Number((version || "").split(".")[0]);
8480
- if (mainVersion >= 18 && fullClone.createRoot) {
8481
- createRoot = fullClone.createRoot;
8482
- }
8483
- } catch (e) {
8484
- }
8485
- function toggleWarning(skip) {
8486
- var __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = fullClone.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
8487
- if (__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED && (typeof __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === "undefined" ? "undefined" : _type_of(__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)) === "object") {
8488
- __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.usingClientEntryPoint = skip;
8489
- }
8490
- }
8491
- var MARK = "__nutui_react_root__";
8492
- function legacyRender(node, container) {
8493
- reactRender(node, container);
8494
- }
8495
- function concurrentRender(node, container) {
8496
- toggleWarning(true);
8497
- var root2 = container[MARK] || createRoot(container);
8498
- toggleWarning(false);
8499
- root2.render(node);
8500
- container[MARK] = root2;
8501
- }
8502
- function render(node, container) {
8503
- if (createRoot) {
8504
- concurrentRender(node, container);
8505
- return;
8506
- }
8507
- legacyRender(node, container);
8508
- }
8509
- function legacyUnmount(container) {
8510
- return unmountComponentAtNode(container);
8511
- }
8512
- function concurrentUnmount(container) {
8513
- return _concurrentUnmount.apply(this, arguments);
8514
- }
8515
- function _concurrentUnmount() {
8516
- _concurrentUnmount = _async_to_generator(function(container) {
8517
- return __generator(this, function(_state) {
8518
- return [
8519
- 2,
8520
- Promise.resolve().then(function() {
8521
- var _container_MARK;
8522
- (_container_MARK = container[MARK]) === null || _container_MARK === void 0 ? void 0 : _container_MARK.unmount();
8523
- delete container[MARK];
8524
- })
8525
- ];
8526
- });
8527
- });
8528
- return _concurrentUnmount.apply(this, arguments);
8529
- }
8530
- function unmount(container) {
8531
- if (createRoot) {
8532
- return concurrentUnmount(container);
8533
- }
8534
- return legacyUnmount(container);
8535
- }
8536
- function rubberband(distance, dimension, constant) {
8537
- return distance * dimension * constant / (dimension + constant * distance);
8538
- }
8539
- function rubberbandIfOutOfBounds(position2, min, max, dimension) {
8540
- var constant = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 0.15;
8541
- if (constant === 0) return bound(position2, min, max);
8542
- if (position2 < min) return -rubberband(min - position2, dimension, constant) + min;
8543
- if (position2 > max) return +rubberband(position2 - max, dimension, constant) + max;
8544
- return position2;
8545
- }
8546
- var sleep = function(time2) {
8547
- return new Promise(function(resolve) {
8548
- return setTimeout(resolve, time2);
8549
- });
8550
- };
8551
- function toArray(value2) {
8552
- if (value2 === void 0 || value2 === null) {
8553
- return [];
8554
- }
8555
- return Array.isArray(value2) ? value2 : [
8556
- value2
8557
- ];
8558
- }
8559
- var upperCaseFirst = function(str) {
8560
- str = str.toLowerCase();
8561
- str = str.replace(/\b\w+\b/g, function(word) {
8562
- return word.substring(0, 1).toUpperCase() + word.substring(1);
8563
- });
8564
- return str;
8565
- };
8566
8728
  var momentum = function(distance, duration) {
8567
8729
  var speed = Math.abs(distance / duration);
8568
8730
  return speed / 3e-3 * (distance < 0 ? -1 : 1);
@@ -8986,22 +9148,6 @@
8986
9148
  })) : null);
8987
9149
  };
8988
9150
  var PickerView = /* @__PURE__ */ React.forwardRef(InternalPickerView);
8989
- function useRefs() {
8990
- var refs = React.useRef([]);
8991
- var setRefs = React.useCallback(function(index2) {
8992
- return function(el) {
8993
- if (el) refs.current[index2] = el;
8994
- };
8995
- }, []);
8996
- var reset = React.useCallback(function() {
8997
- refs.current = [];
8998
- }, []);
8999
- return [
9000
- refs.current,
9001
- setRefs,
9002
- reset
9003
- ];
9004
- }
9005
9151
  var defaultProps$11 = _object_spread_props(_object_spread({}, ComponentDefaults), {
9006
9152
  title: "",
9007
9153
  options: [],
@@ -9192,7 +9338,7 @@
9192
9338
  return _obj = {}, _define_property(_obj, "".concat(type2, "Year"), year), _define_property(_obj, "".concat(type2, "Month"), month), _define_property(_obj, "".concat(type2, "Date"), date2), _define_property(_obj, "".concat(type2, "Hour"), hour), _define_property(_obj, "".concat(type2, "Minute"), minute), _define_property(_obj, "".concat(type2, "Seconds"), minute), _obj;
9193
9339
  };
9194
9340
  var generateDatePickerRanges = function(type2, selectedDate, startDate, endDate) {
9195
- var selected = new Date(selectedDate);
9341
+ var selected = selectedDate ? new Date(selectedDate) : new Date(startDate);
9196
9342
  if (!selected) return [];
9197
9343
  var _calculateDateBoundary = calculateDateBoundary("max", selected, startDate, endDate), maxYear = _calculateDateBoundary.maxYear, maxDate = _calculateDateBoundary.maxDate, maxMonth = _calculateDateBoundary.maxMonth, maxHour = _calculateDateBoundary.maxHour, maxMinute = _calculateDateBoundary.maxMinute, maxSeconds = _calculateDateBoundary.maxSeconds;
9198
9344
  var _calculateDateBoundary1 = calculateDateBoundary("min", selected, startDate, endDate), minYear = _calculateDateBoundary1.minYear, minDate = _calculateDateBoundary1.minDate, minMonth = _calculateDateBoundary1.minMonth, minHour = _calculateDateBoundary1.minHour, minMinute = _calculateDateBoundary1.minMinute, minSeconds = _calculateDateBoundary1.minSeconds;
@@ -11493,7 +11639,7 @@
11493
11639
  updateValue((event.detail || event.currentTarget).value, "onChange");
11494
11640
  };
11495
11641
  var handleBlur = function(event) {
11496
- var val2 = Taro.getEnv() === "WEB" ? event.target.value : value2;
11642
+ var val2 = Taro.getEnv() === "WEB" ? event.target.value : event.detail.value;
11497
11643
  updateValue(val2, "onBlur");
11498
11644
  setTimeout(function() {
11499
11645
  return setActive(false);
@@ -13838,7 +13984,6 @@
13838
13984
  4
13839
13985
  ];
13840
13986
  loadingIcon && setLoading(true);
13841
- onChange(!value2);
13842
13987
  _state.label = 1;
13843
13988
  case 1:
13844
13989
  _state.trys.push([
@@ -14871,52 +15016,6 @@
14871
15016
  }, children), renderFooter()));
14872
15017
  };
14873
15018
  Content.displayName = "NutContent";
14874
- var customEvents = new Taro.Events();
14875
- function useCustomEventsPath(selector) {
14876
- var _getCurrentInstance_router;
14877
- selector = selector || "";
14878
- var path = (_getCurrentInstance_router = Taro.getCurrentInstance().router) === null || _getCurrentInstance_router === void 0 ? void 0 : _getCurrentInstance_router.path;
14879
- return path ? "".concat(path, "__").concat(selector) : selector;
14880
- }
14881
- function useCustomEvent(selector, cb) {
14882
- var path = useCustomEventsPath(selector);
14883
- React.useEffect(function() {
14884
- customEvents.on(path, cb);
14885
- return function() {
14886
- customEvents.off(path);
14887
- };
14888
- }, []);
14889
- var trigger = function(args) {
14890
- customEvents.trigger(path, args);
14891
- };
14892
- var off = function() {
14893
- customEvents.off(path);
14894
- };
14895
- return [
14896
- trigger,
14897
- off
14898
- ];
14899
- }
14900
- function useParams(args) {
14901
- var forceUpdate = useForceUpdate();
14902
- var stateRef = React.useRef(args);
14903
- var currentRef = React.useRef();
14904
- var previousRef = React.useRef();
14905
- if (!isEqual(currentRef.current, args)) {
14906
- previousRef.current = currentRef.current;
14907
- currentRef.current = args;
14908
- stateRef.current = args;
14909
- }
14910
- var setParams = function(args2) {
14911
- stateRef.current = _object_spread({}, stateRef.current, args2);
14912
- forceUpdate();
14913
- };
14914
- var params = stateRef.current;
14915
- return {
14916
- params,
14917
- setParams
14918
- };
14919
- }
14920
15019
  var defaultProps$H = _object_spread_props(_object_spread({}, defaultOverlayProps, defaultContentProps), {
14921
15020
  title: "",
14922
15021
  content: "",
@@ -39526,83 +39625,6 @@
39526
39625
  };
39527
39626
  }
39528
39627
  var Lottie = implementation;
39529
- var defaultPaginationOptions = {
39530
- current: 0,
39531
- itemsPerPage: 10,
39532
- displayCount: 5,
39533
- ellipse: false
39534
- };
39535
- function human2Machine(number2) {
39536
- return --number2;
39537
- }
39538
- function calculateNodes(options, nodesCount) {
39539
- var halfIndex = Math.floor(options.displayCount / 2);
39540
- var buttonsCountIndex = human2Machine(nodesCount);
39541
- var displayCountIndex = human2Machine(options.displayCount);
39542
- var currentIndex = human2Machine(options.current);
39543
- var start;
39544
- var end;
39545
- if (buttonsCountIndex <= displayCountIndex) {
39546
- start = 0;
39547
- end = buttonsCountIndex;
39548
- } else {
39549
- start = Math.max(0, currentIndex - halfIndex);
39550
- end = Math.min(buttonsCountIndex, currentIndex + halfIndex);
39551
- if (end - start < displayCountIndex) {
39552
- if (start === 0) {
39553
- end = Math.min(start + displayCountIndex, buttonsCountIndex);
39554
- } else if (end === buttonsCountIndex) {
39555
- start = Math.max(end - displayCountIndex, 1);
39556
- }
39557
- } else if (end - start > displayCountIndex) {
39558
- end = start + displayCountIndex;
39559
- }
39560
- }
39561
- var buttons = [];
39562
- for (var i2 = start; i2 <= end; i2++) {
39563
- var humanPageNumber = i2 + 1;
39564
- buttons.push({
39565
- number: humanPageNumber,
39566
- text: humanPageNumber.toString(),
39567
- selected: options.current === humanPageNumber
39568
- });
39569
- }
39570
- return addEllipses(buttons, {
39571
- nodesCount,
39572
- ellipse: options.ellipse,
39573
- displayCount: options.displayCount
39574
- });
39575
- }
39576
- function addEllipses(nodes, param) {
39577
- var displayCount = param.displayCount, nodesCount = param.nodesCount, ellipse = param.ellipse;
39578
- if (nodesCount <= displayCount || !ellipse) return nodes;
39579
- var start = nodes[0];
39580
- var end = nodes[nodes.length - 1];
39581
- var leftEllipse = start.number > 1;
39582
- var rightEllipse = end.number < nodesCount;
39583
- if (leftEllipse) {
39584
- nodes.unshift({
39585
- number: start.number - 1,
39586
- text: "..."
39587
- });
39588
- }
39589
- if (rightEllipse) {
39590
- nodes.push({
39591
- number: end.number + 1,
39592
- text: "..."
39593
- });
39594
- }
39595
- return nodes;
39596
- }
39597
- var usePagination = function(options) {
39598
- var mergedOptions = _object_spread({}, defaultPaginationOptions, options);
39599
- var total = mergedOptions.total, itemsPerPage = mergedOptions.itemsPerPage;
39600
- var nodesCount = Math.ceil((total || 0) / itemsPerPage) || 1;
39601
- return [
39602
- calculateNodes(mergedOptions, nodesCount),
39603
- nodesCount
39604
- ];
39605
- };
39606
39628
  var defaultProps$g = _object_spread_props(_object_spread({}, ComponentDefaults), {
39607
39629
  defaultValue: 1,
39608
39630
  mode: "multi",
@@ -41948,7 +41970,6 @@
41948
41970
  };
41949
41971
  WaterMark.displayName = "NutWaterMark";
41950
41972
  var destroyList = [];
41951
- var useIsomorphicLayoutEffect = canUseDom ? React.useLayoutEffect : React.useEffect;
41952
41973
  exports.ActionSheet = ActionSheet;
41953
41974
  exports.Address = Address;
41954
41975
  exports.Animate = Animate;