@nutui/nutui-react-taro 1.4.1 → 1.4.2

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 (43) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +4 -4
  3. package/dist/esm/DatePicker.js +3 -3
  4. package/dist/esm/Input.js +2 -2
  5. package/dist/esm/Picker.js +2 -2
  6. package/dist/esm/SideNavBar.js +3 -3
  7. package/dist/esm/SubSideNavBar.js +3 -3
  8. package/dist/esm/address.taro-c03b8b16.js +23 -21
  9. package/dist/esm/barrage.taro-d86c367a.js +22 -24
  10. package/dist/esm/calendaritem.taro-85a8c4fc.js +16 -18
  11. package/dist/esm/cascader.taro-459f7d45.js +234 -244
  12. package/dist/esm/{datepicker.taro-00a72ca3.js → datepicker.taro-7de67b85.js} +1 -1
  13. package/dist/esm/ellipsis.taro-c0de6ff4.js +76 -84
  14. package/dist/esm/{input.taro-65db24c3.js → input.taro-8b3f8381.js} +12 -24
  15. package/dist/esm/menuitem.taro-2f8e69a4.js +14 -16
  16. package/dist/esm/noticebar.taro-43c18dc9.js +31 -33
  17. package/dist/esm/nutui-react.es.js +6 -6
  18. package/dist/esm/offsetContext-bfb02c25.js +3 -0
  19. package/dist/esm/{picker.taro-e23bc9d1.js → picker.taro-9b7263ca.js} +11 -15
  20. package/dist/esm/popover.taro-7e5dff8c.js +15 -17
  21. package/dist/esm/pulltorefresh.taro-f26a20dd.js +75 -81
  22. package/dist/esm/range.taro-4cbe2469.js +67 -71
  23. package/dist/esm/{sidenavbar.taro-a828250a.js → sidenavbar.taro-3b1f1218.js} +13 -5
  24. package/dist/esm/{subsidenavbar.taro-4c80ad38.js → subsidenavbar.taro-f46b4c73.js} +12 -11
  25. package/dist/esm/swipe.taro-83bc248f.js +35 -37
  26. package/dist/esm/swiper.taro-852f6615.js +26 -28
  27. package/dist/esm/types/src/packages/input/input.d.ts +0 -8
  28. package/dist/esm/types/src/packages/input/input.taro.d.ts +0 -8
  29. package/dist/esm/useClientRect-bf69d7b3.js +10 -12
  30. package/dist/locales/base.js +2 -2
  31. package/dist/locales/en-US.js +2 -2
  32. package/dist/locales/id-ID.js +2 -2
  33. package/dist/locales/zh-CN.js +2 -2
  34. package/dist/locales/zh-TW.js +2 -2
  35. package/dist/locales/zh-UG.js +2 -2
  36. package/dist/nutui.react.es.js +66 -88
  37. package/dist/nutui.react.umd.js +66 -88
  38. package/dist/packages/input/input.scss +12 -12
  39. package/dist/style.css +1 -1
  40. package/dist/style.es.js +2 -2
  41. package/dist/types/index.d.ts +0 -8
  42. package/package.json +1 -1
  43. package/dist/esm/offsetContext-0e3d04b3.js +0 -16
@@ -318,44 +318,42 @@ var InternalCascader = function InternalCascader(props) {
318
318
  var initData = /*#__PURE__*/function () {
319
319
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
320
320
  return _regeneratorRuntime.wrap(function _callee$(_context) {
321
- while (1) {
322
- switch (_context.prev = _context.next) {
323
- case 0:
324
- // 初始化开始处理数据
325
- state.lazyLoadMap.clear();
326
- if (convertConfig && Object.keys(convertConfig).length > 0) {
327
- state.optionsData = convertListToOptions(options, convertConfig);
328
- } else {
329
- state.optionsData = options;
330
- }
331
- state.tree = new Tree(state.optionsData, {
332
- value: state.configs.valueKey,
333
- text: state.configs.textKey,
334
- children: state.configs.childrenKey
335
- });
336
- if (!(isLazy() && !state.tree.nodes.length)) {
337
- _context.next = 6;
338
- break;
339
- }
321
+ while (1) switch (_context.prev = _context.next) {
322
+ case 0:
323
+ // 初始化开始处理数据
324
+ state.lazyLoadMap.clear();
325
+ if (convertConfig && Object.keys(convertConfig).length > 0) {
326
+ state.optionsData = convertListToOptions(options, convertConfig);
327
+ } else {
328
+ state.optionsData = options;
329
+ }
330
+ state.tree = new Tree(state.optionsData, {
331
+ value: state.configs.valueKey,
332
+ text: state.configs.textKey,
333
+ children: state.configs.childrenKey
334
+ });
335
+ if (!(isLazy() && !state.tree.nodes.length)) {
340
336
  _context.next = 6;
341
- return invokeLazyLoad({
342
- root: true,
343
- loading: true,
344
- text: '',
345
- value: ''
346
- });
347
- case 6:
348
- state.panes = [{
349
- nodes: state.tree.nodes,
350
- selectedNode: null,
351
- paneKey: 'c1'
352
- }];
353
- syncValue();
354
- setOptiosData(state.panes);
355
- case 9:
356
- case "end":
357
- return _context.stop();
358
- }
337
+ break;
338
+ }
339
+ _context.next = 6;
340
+ return invokeLazyLoad({
341
+ root: true,
342
+ loading: true,
343
+ text: '',
344
+ value: ''
345
+ });
346
+ case 6:
347
+ state.panes = [{
348
+ nodes: state.tree.nodes,
349
+ selectedNode: null,
350
+ paneKey: 'c1'
351
+ }];
352
+ syncValue();
353
+ setOptiosData(state.panes);
354
+ case 9:
355
+ case "end":
356
+ return _context.stop();
359
357
  }
360
358
  }, _callee);
361
359
  }));
@@ -368,92 +366,88 @@ var InternalCascader = function InternalCascader(props) {
368
366
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
369
367
  var currentValue, needToSync, parent, last, pathNodes;
370
368
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
371
- while (1) {
372
- switch (_context3.prev = _context3.next) {
373
- case 0:
374
- currentValue = state.innerValue;
375
- if (!(currentValue === undefined || !state.tree.nodes.length)) {
376
- _context3.next = 3;
377
- break;
378
- }
379
- return _context3.abrupt("return");
380
- case 3:
381
- if (!(currentValue.length === 0)) {
382
- _context3.next = 6;
383
- break;
384
- }
385
- state.tabsCursor = 0;
386
- // state.panes = [{ nodes: state.tree.nodes, selectedNode: null }];
387
- return _context3.abrupt("return");
388
- case 6:
389
- needToSync = currentValue;
390
- if (!(isLazy() && Array.isArray(currentValue) && currentValue.length)) {
391
- _context3.next = 19;
392
- break;
393
- }
394
- needToSync = [];
395
- parent = state.tree.nodes.find(function (node) {
396
- return node.value === currentValue[0];
397
- });
398
- if (!parent) {
399
- _context3.next = 19;
400
- break;
401
- }
402
- needToSync = [parent.value];
403
- state.initLoading = true;
404
- _context3.next = 15;
405
- return currentValue.slice(1).reduce( /*#__PURE__*/function () {
406
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(p, value) {
407
- var _parent$children;
408
- var parent, node;
409
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
410
- while (1) {
411
- switch (_context2.prev = _context2.next) {
412
- case 0:
413
- _context2.next = 2;
414
- return p;
415
- case 2:
416
- parent = _context2.sent;
417
- _context2.next = 5;
418
- return invokeLazyLoad(parent);
419
- case 5:
420
- node = parent === null || parent === void 0 ? void 0 : (_parent$children = parent.children) === null || _parent$children === void 0 ? void 0 : _parent$children.find(function (item) {
421
- return item.value === value;
422
- });
423
- if (node) {
424
- needToSync.push(value);
425
- }
426
- return _context2.abrupt("return", Promise.resolve(node));
427
- case 8:
428
- case "end":
429
- return _context2.stop();
369
+ while (1) switch (_context3.prev = _context3.next) {
370
+ case 0:
371
+ currentValue = state.innerValue;
372
+ if (!(currentValue === undefined || !state.tree.nodes.length)) {
373
+ _context3.next = 3;
374
+ break;
375
+ }
376
+ return _context3.abrupt("return");
377
+ case 3:
378
+ if (!(currentValue.length === 0)) {
379
+ _context3.next = 6;
380
+ break;
381
+ }
382
+ state.tabsCursor = 0;
383
+ // state.panes = [{ nodes: state.tree.nodes, selectedNode: null }];
384
+ return _context3.abrupt("return");
385
+ case 6:
386
+ needToSync = currentValue;
387
+ if (!(isLazy() && Array.isArray(currentValue) && currentValue.length)) {
388
+ _context3.next = 19;
389
+ break;
390
+ }
391
+ needToSync = [];
392
+ parent = state.tree.nodes.find(function (node) {
393
+ return node.value === currentValue[0];
394
+ });
395
+ if (!parent) {
396
+ _context3.next = 19;
397
+ break;
398
+ }
399
+ needToSync = [parent.value];
400
+ state.initLoading = true;
401
+ _context3.next = 15;
402
+ return currentValue.slice(1).reduce( /*#__PURE__*/function () {
403
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(p, value) {
404
+ var _parent$children;
405
+ var parent, node;
406
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
407
+ while (1) switch (_context2.prev = _context2.next) {
408
+ case 0:
409
+ _context2.next = 2;
410
+ return p;
411
+ case 2:
412
+ parent = _context2.sent;
413
+ _context2.next = 5;
414
+ return invokeLazyLoad(parent);
415
+ case 5:
416
+ node = parent === null || parent === void 0 ? void 0 : (_parent$children = parent.children) === null || _parent$children === void 0 ? void 0 : _parent$children.find(function (item) {
417
+ return item.value === value;
418
+ });
419
+ if (node) {
420
+ needToSync.push(value);
430
421
  }
431
- }
432
- }, _callee2);
433
- }));
434
- return function (_x, _x2) {
435
- return _ref3.apply(this, arguments);
436
- };
437
- }(), Promise.resolve(parent));
438
- case 15:
439
- last = _context3.sent;
440
- _context3.next = 18;
441
- return invokeLazyLoad(last);
442
- case 18:
443
- state.initLoading = false;
444
- case 19:
445
- if (needToSync.length && currentValue === value) {
446
- pathNodes = state.tree.getPathNodesByValue(needToSync);
447
- pathNodes.forEach(function (node, index) {
448
- state.tabsCursor = index;
449
- // 当有默认值时,不触发 chooseItem 里的 emit 事件
450
- _chooseItem(node, true);
451
- });
452
- }
453
- case 20:
454
- case "end":
455
- return _context3.stop();
456
- }
422
+ return _context2.abrupt("return", Promise.resolve(node));
423
+ case 8:
424
+ case "end":
425
+ return _context2.stop();
426
+ }
427
+ }, _callee2);
428
+ }));
429
+ return function (_x, _x2) {
430
+ return _ref3.apply(this, arguments);
431
+ };
432
+ }(), Promise.resolve(parent));
433
+ case 15:
434
+ last = _context3.sent;
435
+ _context3.next = 18;
436
+ return invokeLazyLoad(last);
437
+ case 18:
438
+ state.initLoading = false;
439
+ case 19:
440
+ if (needToSync.length && currentValue === value) {
441
+ pathNodes = state.tree.getPathNodesByValue(needToSync);
442
+ pathNodes.forEach(function (node, index) {
443
+ state.tabsCursor = index;
444
+ // 当有默认值时,不触发 chooseItem 里的 emit 事件
445
+ _chooseItem(node, true);
446
+ });
447
+ }
448
+ case 20:
449
+ case "end":
450
+ return _context3.stop();
457
451
  }
458
452
  }, _callee3);
459
453
  }));
@@ -465,55 +459,53 @@ var InternalCascader = function InternalCascader(props) {
465
459
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(node) {
466
460
  var parent, lazyLoadPromise, nodes;
467
461
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
468
- while (1) {
469
- switch (_context4.prev = _context4.next) {
470
- case 0:
471
- if (node) {
472
- _context4.next = 2;
473
- break;
474
- }
475
- return _context4.abrupt("return");
476
- case 2:
477
- if (state.configs.lazyLoad) {
478
- _context4.next = 5;
479
- break;
480
- }
462
+ while (1) switch (_context4.prev = _context4.next) {
463
+ case 0:
464
+ if (node) {
465
+ _context4.next = 2;
466
+ break;
467
+ }
468
+ return _context4.abrupt("return");
469
+ case 2:
470
+ if (state.configs.lazyLoad) {
471
+ _context4.next = 5;
472
+ break;
473
+ }
474
+ node.leaf = true;
475
+ return _context4.abrupt("return");
476
+ case 5:
477
+ if (!(state.tree.isLeaf(node, isLazy()) || state.tree.hasChildren(node, isLazy()))) {
478
+ _context4.next = 7;
479
+ break;
480
+ }
481
+ return _context4.abrupt("return");
482
+ case 7:
483
+ node.loading = true;
484
+ parent = node.root ? null : node;
485
+ lazyLoadPromise = state.lazyLoadMap.get(node);
486
+ if (!lazyLoadPromise) {
487
+ lazyLoadPromise = new Promise(function (resolve) {
488
+ var _state$configs$lazyLo, _state$configs;
489
+ // 外部必须resolve
490
+ (_state$configs$lazyLo = (_state$configs = state.configs).lazyLoad) === null || _state$configs$lazyLo === void 0 ? void 0 : _state$configs$lazyLo.call(_state$configs, node, resolve);
491
+ });
492
+ state.lazyLoadMap.set(node, lazyLoadPromise);
493
+ }
494
+ _context4.next = 13;
495
+ return lazyLoadPromise;
496
+ case 13:
497
+ nodes = _context4.sent;
498
+ if (Array.isArray(nodes) && nodes.length > 0) {
499
+ state.tree.updateChildren(nodes, parent);
500
+ } else {
501
+ // 如果加载完成后没有提供子节点,作为叶子节点处理
481
502
  node.leaf = true;
482
- return _context4.abrupt("return");
483
- case 5:
484
- if (!(state.tree.isLeaf(node, isLazy()) || state.tree.hasChildren(node, isLazy()))) {
485
- _context4.next = 7;
486
- break;
487
- }
488
- return _context4.abrupt("return");
489
- case 7:
490
- node.loading = true;
491
- parent = node.root ? null : node;
492
- lazyLoadPromise = state.lazyLoadMap.get(node);
493
- if (!lazyLoadPromise) {
494
- lazyLoadPromise = new Promise(function (resolve) {
495
- var _state$configs$lazyLo, _state$configs;
496
- // 外部必须resolve
497
- (_state$configs$lazyLo = (_state$configs = state.configs).lazyLoad) === null || _state$configs$lazyLo === void 0 ? void 0 : _state$configs$lazyLo.call(_state$configs, node, resolve);
498
- });
499
- state.lazyLoadMap.set(node, lazyLoadPromise);
500
- }
501
- _context4.next = 13;
502
- return lazyLoadPromise;
503
- case 13:
504
- nodes = _context4.sent;
505
- if (Array.isArray(nodes) && nodes.length > 0) {
506
- state.tree.updateChildren(nodes, parent);
507
- } else {
508
- // 如果加载完成后没有提供子节点,作为叶子节点处理
509
- node.leaf = true;
510
- }
511
- node.loading = false;
512
- state.lazyLoadMap["delete"](node);
513
- case 17:
514
- case "end":
515
- return _context4.stop();
516
- }
503
+ }
504
+ node.loading = false;
505
+ state.lazyLoadMap["delete"](node);
506
+ case 17:
507
+ case "end":
508
+ return _context4.stop();
517
509
  }
518
510
  }, _callee4);
519
511
  }));
@@ -533,81 +525,79 @@ var InternalCascader = function InternalCascader(props) {
533
525
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(node, type) {
534
526
  var pathNodes, optionParams, level, _pathNodes, _optionParams;
535
527
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
536
- while (1) {
537
- switch (_context5.prev = _context5.next) {
538
- case 0:
539
- if (!(!type && node.disabled || !state.panes[state.tabsCursor])) {
540
- _context5.next = 2;
541
- break;
542
- }
543
- return _context5.abrupt("return");
544
- case 2:
545
- if (!state.tree.isLeaf(node, isLazy())) {
546
- _context5.next = 10;
547
- break;
548
- }
549
- node.leaf = true;
550
- state.panes[state.tabsCursor].selectedNode = node;
551
- state.panes = state.panes.slice(0, node.level + 1);
552
- if (!type) {
553
- pathNodes = state.panes.map(function (item) {
554
- return item.selectedNode;
555
- });
556
- optionParams = pathNodes.map(function (item) {
557
- return item.value;
558
- });
559
- onChange(optionParams, pathNodes);
560
- onPathChange(optionParams, pathNodes);
561
- }
562
- setOptiosData(state.panes);
563
- close();
564
- return _context5.abrupt("return");
565
- case 10:
566
- if (!state.tree.hasChildren(node, isLazy())) {
567
- _context5.next = 20;
568
- break;
569
- }
570
- level = node.level + 1;
571
- state.panes[state.tabsCursor].selectedNode = node;
572
- state.panes = state.panes.slice(0, level);
573
- state.tabsCursor = level;
574
- state.panes.push({
575
- nodes: node.children || [],
576
- selectedNode: null,
577
- paneKey: "c".concat(state.tabsCursor + 1)
528
+ while (1) switch (_context5.prev = _context5.next) {
529
+ case 0:
530
+ if (!(!type && node.disabled || !state.panes[state.tabsCursor])) {
531
+ _context5.next = 2;
532
+ break;
533
+ }
534
+ return _context5.abrupt("return");
535
+ case 2:
536
+ if (!state.tree.isLeaf(node, isLazy())) {
537
+ _context5.next = 10;
538
+ break;
539
+ }
540
+ node.leaf = true;
541
+ state.panes[state.tabsCursor].selectedNode = node;
542
+ state.panes = state.panes.slice(0, node.level + 1);
543
+ if (!type) {
544
+ pathNodes = state.panes.map(function (item) {
545
+ return item.selectedNode;
578
546
  });
579
- setTabvalue("c".concat(state.tabsCursor + 1));
580
- setOptiosData(state.panes);
581
- if (!type) {
582
- _pathNodes = state.panes.map(function (item) {
583
- return item.selectedNode;
584
- });
585
- _optionParams = _pathNodes.map(function (item) {
586
- return item === null || item === void 0 ? void 0 : item.value;
587
- });
588
- onPathChange(_optionParams, _pathNodes);
589
- }
590
- return _context5.abrupt("return");
591
- case 20:
592
- state.currentProcessNode = node;
593
- if (!node.loading) {
594
- _context5.next = 23;
595
- break;
596
- }
597
- return _context5.abrupt("return");
598
- case 23:
599
- _context5.next = 25;
600
- return invokeLazyLoad(node);
601
- case 25:
602
- if (state.currentProcessNode === node) {
603
- state.panes[state.tabsCursor].selectedNode = node;
604
- _chooseItem(node, type);
605
- }
606
- setOptiosData(state.panes);
607
- case 27:
608
- case "end":
609
- return _context5.stop();
610
- }
547
+ optionParams = pathNodes.map(function (item) {
548
+ return item.value;
549
+ });
550
+ onChange(optionParams, pathNodes);
551
+ onPathChange(optionParams, pathNodes);
552
+ }
553
+ setOptiosData(state.panes);
554
+ close();
555
+ return _context5.abrupt("return");
556
+ case 10:
557
+ if (!state.tree.hasChildren(node, isLazy())) {
558
+ _context5.next = 20;
559
+ break;
560
+ }
561
+ level = node.level + 1;
562
+ state.panes[state.tabsCursor].selectedNode = node;
563
+ state.panes = state.panes.slice(0, level);
564
+ state.tabsCursor = level;
565
+ state.panes.push({
566
+ nodes: node.children || [],
567
+ selectedNode: null,
568
+ paneKey: "c".concat(state.tabsCursor + 1)
569
+ });
570
+ setTabvalue("c".concat(state.tabsCursor + 1));
571
+ setOptiosData(state.panes);
572
+ if (!type) {
573
+ _pathNodes = state.panes.map(function (item) {
574
+ return item.selectedNode;
575
+ });
576
+ _optionParams = _pathNodes.map(function (item) {
577
+ return item === null || item === void 0 ? void 0 : item.value;
578
+ });
579
+ onPathChange(_optionParams, _pathNodes);
580
+ }
581
+ return _context5.abrupt("return");
582
+ case 20:
583
+ state.currentProcessNode = node;
584
+ if (!node.loading) {
585
+ _context5.next = 23;
586
+ break;
587
+ }
588
+ return _context5.abrupt("return");
589
+ case 23:
590
+ _context5.next = 25;
591
+ return invokeLazyLoad(node);
592
+ case 25:
593
+ if (state.currentProcessNode === node) {
594
+ state.panes[state.tabsCursor].selectedNode = node;
595
+ _chooseItem(node, type);
596
+ }
597
+ setOptiosData(state.panes);
598
+ case 27:
599
+ case "end":
600
+ return _context5.stop();
611
601
  }
612
602
  }, _callee5);
613
603
  }));
@@ -6,7 +6,7 @@ var _excluded = ["minDate", "maxDate", "type", "isShowChinese", "minuteStep", "m
6
6
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7
7
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
8
  import React__default, { useState, useRef, useEffect } from 'react';
9
- import { P as Picker } from './picker.taro-e23bc9d1.js';
9
+ import { P as Picker } from './picker.taro-9b7263ca.js';
10
10
  var currentYear = new Date().getFullYear();
11
11
  var defaultProps = {
12
12
  modelValue: null,