@nutui/nutui-react-taro 3.0.6 → 3.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/CHANGELOG.md +51 -15
  2. package/dist/cjs/packages/actionsheet/style/style.css +4 -4
  3. package/dist/cjs/packages/address/style/style.css +4 -4
  4. package/dist/cjs/packages/audio/style/style.css +4 -16
  5. package/dist/cjs/packages/avatar/style/style.css +4 -0
  6. package/dist/cjs/packages/button/style/button.scss +4 -20
  7. package/dist/cjs/packages/button/style/style.css +4 -16
  8. package/dist/cjs/packages/button/style/style.harmony.css +2 -14
  9. package/dist/cjs/packages/calendar/style/style.css +4 -4
  10. package/dist/cjs/packages/cascader/cascader.js +2 -1
  11. package/dist/cjs/packages/cascader/style/style.css +4 -4
  12. package/dist/cjs/packages/collapse/style/style.css +22 -7
  13. package/dist/cjs/packages/collapseitem/collapseitem.js +63 -77
  14. package/dist/cjs/packages/collapseitem/style/collapseitem.scss +22 -5
  15. package/dist/cjs/packages/collapseitem/style/style.css +22 -7
  16. package/dist/cjs/packages/collapseitem/style/style.harmony.css +22 -7
  17. package/dist/cjs/packages/configprovider/types.d.ts +1 -1
  18. package/dist/cjs/packages/datepicker/style/style.css +4 -4
  19. package/dist/cjs/packages/dialog/content.d.ts +11 -3
  20. package/dist/cjs/packages/dialog/content.js +4 -4
  21. package/dist/cjs/packages/dialog/dialog.d.ts +39 -4
  22. package/dist/cjs/packages/dialog/dialog.js +14 -13
  23. package/dist/cjs/packages/dialog/index.d.ts +1 -1
  24. package/dist/cjs/packages/dialog/style/dialog.scss +1 -0
  25. package/dist/cjs/packages/dialog/style/style.css +5 -16
  26. package/dist/cjs/packages/dialog/style/style.harmony.css +1 -0
  27. package/dist/cjs/packages/empty/style/style.css +4 -16
  28. package/dist/cjs/packages/image/image.js +10 -9
  29. package/dist/cjs/packages/image/style/image.scss +4 -1
  30. package/dist/cjs/packages/image/style/style.css +4 -0
  31. package/dist/cjs/packages/image/style/style.harmony.css +4 -0
  32. package/dist/cjs/packages/imagepreview/style/style.css +8 -4
  33. package/dist/cjs/packages/numberkeyboard/style/style.css +4 -4
  34. package/dist/cjs/packages/picker/style/style.css +4 -4
  35. package/dist/cjs/packages/popover/popover.d.ts +0 -7
  36. package/dist/cjs/packages/popover/popover.js +114 -141
  37. package/dist/cjs/packages/popover/style/popover.scss +48 -51
  38. package/dist/cjs/packages/popover/style/style.css +64 -70
  39. package/dist/cjs/packages/popover/style/style.harmony.css +64 -60
  40. package/dist/cjs/packages/popup/style/popup.scss +4 -4
  41. package/dist/cjs/packages/popup/style/style.css +4 -4
  42. package/dist/cjs/packages/popup/style/style.harmony.css +4 -4
  43. package/dist/cjs/packages/resultpage/style/style.css +4 -16
  44. package/dist/cjs/packages/shortpassword/style/style.css +4 -4
  45. package/dist/cjs/packages/sidebar/sidebar.js +11 -3
  46. package/dist/cjs/packages/skeleton/skeleton.js +1 -2
  47. package/dist/cjs/packages/swipe/swipe.js +1 -1
  48. package/dist/cjs/packages/switch/switch.js +53 -8
  49. package/dist/cjs/packages/tabpane/tabpane.js +2 -2
  50. package/dist/cjs/packages/timeselect/style/style.css +4 -4
  51. package/dist/cjs/packages/tour/style/style.css +64 -70
  52. package/dist/cjs/packages/tour/tour.js +3 -4
  53. package/dist/cjs/types/spec/dialog/base.d.ts +50 -1
  54. package/dist/cjs/types/spec/dialog/base.js +7 -0
  55. package/dist/cjs/types/spec/dialog/h5.d.ts +4 -1
  56. package/dist/cjs/types/spec/dialog/taro.d.ts +8 -2
  57. package/dist/cjs/types/spec/popover/base.d.ts +7 -0
  58. package/dist/cjs/utils/get-rect-by-taro.js +10 -0
  59. package/dist/cjs/utils/lru.d.ts +8 -0
  60. package/dist/cjs/utils/lru.js +58 -0
  61. package/dist/es/packages/actionsheet/style/style.css +4 -4
  62. package/dist/es/packages/address/style/style.css +4 -4
  63. package/dist/es/packages/audio/style/style.css +4 -16
  64. package/dist/es/packages/avatar/style/style.css +4 -0
  65. package/dist/es/packages/button/style/button.scss +4 -20
  66. package/dist/es/packages/button/style/style.css +4 -16
  67. package/dist/es/packages/button/style/style.harmony.css +2 -14
  68. package/dist/es/packages/calendar/style/style.css +4 -4
  69. package/dist/es/packages/cascader/cascader.js +2 -1
  70. package/dist/es/packages/cascader/style/style.css +4 -4
  71. package/dist/es/packages/collapse/style/style.css +22 -7
  72. package/dist/es/packages/collapseitem/collapseitem.js +65 -79
  73. package/dist/es/packages/collapseitem/style/collapseitem.scss +22 -5
  74. package/dist/es/packages/collapseitem/style/style.css +22 -7
  75. package/dist/es/packages/collapseitem/style/style.harmony.css +22 -7
  76. package/dist/es/packages/configprovider/types.d.ts +1 -1
  77. package/dist/es/packages/datepicker/style/style.css +4 -4
  78. package/dist/es/packages/dialog/content.d.ts +11 -3
  79. package/dist/es/packages/dialog/content.js +4 -4
  80. package/dist/es/packages/dialog/dialog.d.ts +39 -4
  81. package/dist/es/packages/dialog/dialog.js +14 -13
  82. package/dist/es/packages/dialog/index.d.ts +1 -1
  83. package/dist/es/packages/dialog/style/dialog.scss +1 -0
  84. package/dist/es/packages/dialog/style/style.css +5 -16
  85. package/dist/es/packages/dialog/style/style.harmony.css +1 -0
  86. package/dist/es/packages/empty/style/style.css +4 -16
  87. package/dist/es/packages/image/image.js +10 -10
  88. package/dist/es/packages/image/style/image.scss +4 -1
  89. package/dist/es/packages/image/style/style.css +4 -0
  90. package/dist/es/packages/image/style/style.harmony.css +4 -0
  91. package/dist/es/packages/imagepreview/style/style.css +8 -4
  92. package/dist/es/packages/numberkeyboard/style/style.css +4 -4
  93. package/dist/es/packages/picker/style/style.css +4 -4
  94. package/dist/es/packages/popover/popover.d.ts +0 -7
  95. package/dist/es/packages/popover/popover.js +115 -142
  96. package/dist/es/packages/popover/style/popover.scss +48 -51
  97. package/dist/es/packages/popover/style/style.css +64 -70
  98. package/dist/es/packages/popover/style/style.harmony.css +64 -60
  99. package/dist/es/packages/popup/style/popup.scss +4 -4
  100. package/dist/es/packages/popup/style/style.css +4 -4
  101. package/dist/es/packages/popup/style/style.harmony.css +4 -4
  102. package/dist/es/packages/resultpage/style/style.css +4 -16
  103. package/dist/es/packages/shortpassword/style/style.css +4 -4
  104. package/dist/es/packages/sidebar/sidebar.js +11 -3
  105. package/dist/es/packages/skeleton/skeleton.js +1 -2
  106. package/dist/es/packages/swipe/swipe.js +2 -2
  107. package/dist/es/packages/switch/switch.js +53 -8
  108. package/dist/es/packages/tabpane/tabpane.js +2 -2
  109. package/dist/es/packages/timeselect/style/style.css +4 -4
  110. package/dist/es/packages/tour/style/style.css +64 -70
  111. package/dist/es/packages/tour/tour.js +3 -4
  112. package/dist/es/types/spec/dialog/base.d.ts +83 -1
  113. package/dist/es/types/spec/dialog/base.js +1 -1
  114. package/dist/es/types/spec/dialog/h5.d.ts +4 -1
  115. package/dist/es/types/spec/dialog/taro.d.ts +8 -2
  116. package/dist/es/types/spec/popover/base.d.ts +7 -0
  117. package/dist/es/utils/get-rect-by-taro.js +9 -0
  118. package/dist/es/utils/lru.d.ts +8 -0
  119. package/dist/es/utils/lru.js +49 -0
  120. package/dist/nutui.react.umd.js +339 -286
  121. package/dist/style.css +1 -1
  122. package/dist/style.scss +52 -52
  123. package/dist/styles/theme-jmapp.scss +1 -0
  124. package/dist/styles/themes/dark.css +1 -1
  125. package/dist/styles/themes/default.css +1 -1
  126. package/dist/styles/themes/jmapp.css +1 -1
  127. package/dist/styles/themes/jrkf.css +1 -1
  128. package/dist/styles/variables-jmapp.scss +215 -49
  129. package/dist/styles/variables-jrkf.scss +2 -13
  130. package/dist/styles/variables.scss +7 -14
  131. package/package.json +1 -1
  132. package/dist/cjs/packages/dialog/types.d.ts +0 -57
  133. package/dist/cjs/packages/dialog/types.js +0 -4
  134. package/dist/cjs/packages/dialog/types.taro.d.ts +0 -10
  135. package/dist/es/packages/dialog/types.d.ts +0 -57
  136. package/dist/es/packages/dialog/types.js +0 -1
  137. package/dist/es/packages/dialog/types.taro.d.ts +0 -10
@@ -1316,17 +1316,14 @@
1316
1316
  onError && onError(e);
1317
1317
  }
1318
1318
  };
1319
- var containerStyle = {
1320
- // eslint-disable-next-line no-nested-ternary
1321
- height: height2 ? pxCheck(height2) : Taro.getEnv() === "WEB" ? "" : "100%",
1322
- // eslint-disable-next-line no-nested-ternary
1323
- width: width2 ? pxCheck(width2) : Taro.getEnv() === "WEB" ? "" : "100%",
1324
- overflow: radius !== void 0 && radius !== null ? "hidden" : "",
1325
- borderRadius: (
1326
- // eslint-disable-next-line no-nested-ternary
1327
- radius !== void 0 && radius != null ? pxCheck(radius) : ""
1328
- )
1329
- };
1319
+ var containerStyle = _object_spread({}, height2 ? {
1320
+ height: pxCheck(height2)
1321
+ } : {}, width2 ? {
1322
+ width: pxCheck(width2)
1323
+ } : {}, radius !== void 0 && radius !== null ? {
1324
+ overflow: "hidden",
1325
+ borderRadius: pxCheck(radius)
1326
+ } : {});
1330
1327
  var imgStyle = _object_spread_props(_object_spread({}, style), {
1331
1328
  width: width2,
1332
1329
  height: height2
@@ -1367,7 +1364,7 @@
1367
1364
  innerLoading
1368
1365
  ]);
1369
1366
  return /* @__PURE__ */ React.createElement(components.View, {
1370
- className: classNames(classPrefix2, className),
1367
+ className: classNames(classPrefix2, _define_property({}, "".concat(classPrefix2, "-basic"), Taro.getEnv() !== "WEB"), className),
1371
1368
  style: containerStyle
1372
1369
  }, /* @__PURE__ */ React.createElement(components.Image, _object_spread_props(_object_spread({}, rest), {
1373
1370
  className: "".concat(classPrefix2, "-default ").concat(className ? "".concat(className, "-image") : ""),
@@ -3784,6 +3781,66 @@
3784
3781
  stop.current = true;
3785
3782
  };
3786
3783
  }
3784
+ function _class_call_check(instance, Constructor) {
3785
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
3786
+ }
3787
+ function _defineProperties(target, props) {
3788
+ for (var i2 = 0; i2 < props.length; i2++) {
3789
+ var descriptor = props[i2];
3790
+ descriptor.enumerable = descriptor.enumerable || false;
3791
+ descriptor.configurable = true;
3792
+ if ("value" in descriptor) descriptor.writable = true;
3793
+ Object.defineProperty(target, descriptor.key, descriptor);
3794
+ }
3795
+ }
3796
+ function _create_class(Constructor, protoProps, staticProps) {
3797
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
3798
+ return Constructor;
3799
+ }
3800
+ var MiniLru = /* @__PURE__ */ function() {
3801
+ function MiniLru2(capacity) {
3802
+ _class_call_check(this, MiniLru2);
3803
+ _define_property(this, "cache", void 0);
3804
+ _define_property(this, "capacity", void 0);
3805
+ if (capacity <= 0) {
3806
+ throw new Error("Cache capacity must be a positive number");
3807
+ }
3808
+ this.cache = /* @__PURE__ */ new Map();
3809
+ this.capacity = capacity;
3810
+ }
3811
+ _create_class(MiniLru2, [
3812
+ {
3813
+ key: "get",
3814
+ value: function get(key2) {
3815
+ if (this.cache.has(key2)) {
3816
+ var value2 = this.cache.get(key2);
3817
+ this.cache.delete(key2);
3818
+ this.cache.set(key2, value2);
3819
+ return value2;
3820
+ }
3821
+ return null;
3822
+ }
3823
+ },
3824
+ {
3825
+ key: "set",
3826
+ value: function set(key2, value2) {
3827
+ if (this.cache.has(key2)) {
3828
+ this.cache.delete(key2);
3829
+ } else if (this.cache.size >= this.capacity) {
3830
+ this.cache.delete(this.cache.keys().next().value);
3831
+ }
3832
+ this.cache.set(key2, value2);
3833
+ }
3834
+ },
3835
+ {
3836
+ key: "has",
3837
+ value: function has2(key2) {
3838
+ return this.cache.has(key2);
3839
+ }
3840
+ }
3841
+ ]);
3842
+ return MiniLru2;
3843
+ }();
3787
3844
  var inBrowser$1 = typeof document !== "undefined" && !!document.scripts;
3788
3845
  function isWindow(val2) {
3789
3846
  return val2 === window;
@@ -3815,6 +3872,7 @@
3815
3872
  height: 0
3816
3873
  };
3817
3874
  };
3875
+ var lru = new MiniLru(10);
3818
3876
  function makeRect(width2, height2) {
3819
3877
  return {
3820
3878
  top: 0,
@@ -3841,8 +3899,15 @@
3841
3899
  return [
3842
3900
  2,
3843
3901
  new Promise(function(resolve, reject) {
3902
+ if (lru.has(element)) {
3903
+ resolve(lru.get(element));
3904
+ return;
3905
+ }
3844
3906
  Taro.createSelectorQuery().select("#".concat(harmonyId || element.uid)).boundingClientRect().exec(function(param) {
3845
3907
  var _param = _sliced_to_array(param, 1), rects = _param[0];
3908
+ if (rects) {
3909
+ lru.set(element, rects);
3910
+ }
3846
3911
  resolve(rects);
3847
3912
  });
3848
3913
  })
@@ -4797,11 +4862,19 @@
4797
4862
  var titleRectRef = React.useRef([]);
4798
4863
  var _useState = _sliced_to_array(React.useState(0), 2), scrollTop = _useState[0], setScrollTop = _useState[1];
4799
4864
  var scrollDirection = function(to) {
4865
+ if (sidebarDuration === 0) {
4866
+ setScrollTop(to);
4867
+ return;
4868
+ }
4869
+ var from = scrollTop;
4870
+ var frames2 = Math.round(sidebarDuration / 16);
4800
4871
  var count = 0;
4801
- var frames2 = sidebarDuration === 0 ? 1 : Math.round(sidebarDuration / 16);
4802
4872
  function animate() {
4803
- setScrollTop(to);
4804
- if (++count < frames2) {
4873
+ var progress = count / frames2;
4874
+ var current = from + (to - from) * progress;
4875
+ setScrollTop(current);
4876
+ if (count < frames2) {
4877
+ count++;
4805
4878
  requestAniFrame$1(animate);
4806
4879
  }
4807
4880
  }
@@ -5047,9 +5120,9 @@
5047
5120
  var classes = classNames(classPrefix2, {
5048
5121
  active: !disabled && props.active
5049
5122
  }, autoHeightClassName, className);
5050
- return children && /* @__PURE__ */ React.createElement(components.View, {
5123
+ return children ? /* @__PURE__ */ React.createElement(components.View, {
5051
5124
  className: classes
5052
- }, !disabled && children);
5125
+ }, !disabled && children) : null;
5053
5126
  };
5054
5127
  var defaultProps$1d = _object_spread_props(_object_spread({}, ComponentDefaults), {
5055
5128
  tabStyle: {},
@@ -5628,6 +5701,7 @@
5628
5701
  });
5629
5702
  next.push({
5630
5703
  selected: val2,
5704
+ selectedText: opt === null || opt === void 0 ? void 0 : opt.text,
5631
5705
  pane: currentOptions
5632
5706
  });
5633
5707
  pathNodes.current[index2] = opt;
@@ -5917,7 +5991,7 @@
5917
5991
  }
5918
5992
  }, levels.map(function(pane, index2) {
5919
5993
  return /* @__PURE__ */ React.createElement(Tabs.TabPane, {
5920
- title: pane.selected || locale.select,
5994
+ title: pane.selectedText || locale.select,
5921
5995
  key: index2
5922
5996
  }, /* @__PURE__ */ React.createElement(components.View, {
5923
5997
  className: classPane
@@ -8910,22 +8984,6 @@
8910
8984
  };
8911
8985
  DatePickerView.displayName = "NutDatePickerView";
8912
8986
  var Context = React.createContext({});
8913
- function _class_call_check(instance, Constructor) {
8914
- if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
8915
- }
8916
- function _defineProperties(target, props) {
8917
- for (var i2 = 0; i2 < props.length; i2++) {
8918
- var descriptor = props[i2];
8919
- descriptor.enumerable = descriptor.enumerable || false;
8920
- descriptor.configurable = true;
8921
- if ("value" in descriptor) descriptor.writable = true;
8922
- Object.defineProperty(target, descriptor.key, descriptor);
8923
- }
8924
- }
8925
- function _create_class(Constructor, protoProps, staticProps) {
8926
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
8927
- return Constructor;
8928
- }
8929
8987
  function _extends() {
8930
8988
  _extends = Object.assign ? Object.assign.bind() : function(target) {
8931
8989
  for (var i2 = 1; i2 < arguments.length; i2++) {
@@ -13087,9 +13145,7 @@
13087
13145
  loadingIcon: /* @__PURE__ */ React.createElement(IconSVG$h, null)
13088
13146
  });
13089
13147
  var Switch = function(props) {
13090
- var _ref = _object_spread({}, defaultProps$M, props), checked = _ref.checked, defaultChecked = _ref.defaultChecked, disabled = _ref.disabled, activeText = _ref.activeText, inactiveText = _ref.inactiveText, loadingIcon = _ref.loadingIcon, className = _ref.className, style = _ref.style;
13091
- _ref.onChange;
13092
- var rest = _object_without_properties(_ref, [
13148
+ var _ref = _object_spread({}, defaultProps$M, props), checked = _ref.checked, defaultChecked = _ref.defaultChecked, disabled = _ref.disabled, activeText = _ref.activeText, inactiveText = _ref.inactiveText, loadingIcon = _ref.loadingIcon, className = _ref.className, style = _ref.style, onChange = _ref.onChange, rest = _object_without_properties(_ref, [
13093
13149
  "checked",
13094
13150
  "defaultChecked",
13095
13151
  "disabled",
@@ -13120,14 +13176,56 @@
13120
13176
  (_obj2 = {}, _define_property(_obj2, "".concat(classPrefix2, "-close"), !value2), _define_property(_obj2, "".concat(classPrefix2, "-disabled"), disabled), _define_property(_obj2, "".concat(classPrefix2, "-disabled-close"), disabled && !value2), _obj2)
13121
13177
  ]);
13122
13178
  };
13123
- var onClick = function() {
13124
- if (disabled || changing) return;
13125
- if (props.onChange) {
13126
- setChanging(true);
13127
- props.onChange(!value2);
13128
- }
13129
- setValue(!value2);
13130
- };
13179
+ var onClick = /* @__PURE__ */ function() {
13180
+ var _ref2 = _async_to_generator(function() {
13181
+ return __generator(this, function(_state) {
13182
+ switch (_state.label) {
13183
+ case 0:
13184
+ if (disabled || changing) return [
13185
+ 2
13186
+ ];
13187
+ if (!onChange) return [
13188
+ 3,
13189
+ 4
13190
+ ];
13191
+ setChanging(true);
13192
+ _state.label = 1;
13193
+ case 1:
13194
+ _state.trys.push([
13195
+ 1,
13196
+ 3,
13197
+ ,
13198
+ 4
13199
+ ]);
13200
+ return [
13201
+ 4,
13202
+ onChange(!value2)
13203
+ ];
13204
+ case 2:
13205
+ _state.sent();
13206
+ return [
13207
+ 3,
13208
+ 4
13209
+ ];
13210
+ case 3:
13211
+ _state.sent();
13212
+ setChanging(false);
13213
+ return [
13214
+ 3,
13215
+ 4
13216
+ ];
13217
+ case 4:
13218
+ setValue(!value2);
13219
+ return [
13220
+ 2
13221
+ ];
13222
+ }
13223
+ });
13224
+ });
13225
+ return function onClick2() {
13226
+ return _ref2.apply(this, arguments);
13227
+ };
13228
+ }();
13131
13229
  var _obj, _obj1;
13132
13230
  return /* @__PURE__ */ React.createElement(components.View, _object_spread({
13133
13231
  className: classes(),
@@ -14086,7 +14184,7 @@
14086
14184
  }
14087
14185
  };
14088
14186
  var Content = function(props) {
14089
- var _$_object_spread = _object_spread({}, defaultContentProps, props), visible = _$_object_spread.visible, title = _$_object_spread.title, header = _$_object_spread.header, footer = _$_object_spread.footer, close2 = _$_object_spread.close, footerDirection = _$_object_spread.footerDirection, children = _$_object_spread.children, onClick = _$_object_spread.onClick;
14187
+ var _$_object_spread = _object_spread({}, defaultContentProps, props), visible = _$_object_spread.visible, title = _$_object_spread.title, header = _$_object_spread.header, footer = _$_object_spread.footer, close2 = _$_object_spread.close, footerDirection = _$_object_spread.footerDirection, children = _$_object_spread.children, style = _$_object_spread.style, className = _$_object_spread.className, onClick = _$_object_spread.onClick;
14090
14188
  var classPrefix2 = "nut-dialog";
14091
14189
  var renderHeader = function() {
14092
14190
  return title && /* @__PURE__ */ React.createElement(components.View, {
@@ -14099,11 +14197,11 @@
14099
14197
  }, footer);
14100
14198
  };
14101
14199
  var handleClick = function(e) {
14102
- onClick && onClick(e);
14200
+ onClick(e);
14103
14201
  };
14104
14202
  return /* @__PURE__ */ React.createElement(components.View, {
14105
- className: classNames("".concat(classPrefix2, "-outer"), props.className),
14106
- style: props.style,
14203
+ className: classNames("".concat(classPrefix2, "-outer"), className),
14204
+ style,
14107
14205
  onClick: function(e) {
14108
14206
  return handleClick(e);
14109
14207
  }
@@ -14170,15 +14268,15 @@
14170
14268
  footer: "",
14171
14269
  confirmText: "",
14172
14270
  cancelText: "",
14173
- overlay: true,
14174
- overlayStyle: {},
14175
- overlayClassName: "nut-dialog-overlay",
14176
14271
  hideConfirmButton: false,
14177
14272
  hideCancelButton: false,
14178
14273
  disableConfirmButton: false,
14179
14274
  footerDirection: "horizontal",
14180
14275
  closeIconPosition: "bottom",
14181
14276
  closeIcon: false,
14277
+ overlay: true,
14278
+ overlayStyle: {},
14279
+ overlayClassName: "nut-dialog-overlay",
14182
14280
  zIndex: 1200,
14183
14281
  beforeCancel: function() {
14184
14282
  return true;
@@ -14190,15 +14288,17 @@
14190
14288
  },
14191
14289
  onClose: function() {
14192
14290
  },
14291
+ onConfirm: function() {
14292
+ },
14193
14293
  onOverlayClick: function() {
14194
14294
  return true;
14195
14295
  }
14196
14296
  });
14197
14297
  var BaseDialog = function(props) {
14298
+ var _useParams = useParams(mergeProps(defaultProps$H, props)), _useParams_params = _useParams.params, id = _useParams_params.id, closeOnOverlayClick = _useParams_params.closeOnOverlayClick, confirmText = _useParams_params.confirmText, cancelText = _useParams_params.cancelText, children = _useParams_params.children, className = _useParams_params.className, closeIconPosition = _useParams_params.closeIconPosition, closeIcon = _useParams_params.closeIcon, content2 = _useParams_params.content, disableConfirmButton = _useParams_params.disableConfirmButton, footer = _useParams_params.footer, footerDirection = _useParams_params.footerDirection, header = _useParams_params.header, hideConfirmButton = _useParams_params.hideConfirmButton, hideCancelButton = _useParams_params.hideCancelButton, lockScroll = _useParams_params.lockScroll, overlay = _useParams_params.overlay, overlayStyle = _useParams_params.overlayStyle, overlayClassName = _useParams_params.overlayClassName, style = _useParams_params.style, title = _useParams_params.title, visible = _useParams_params.visible, zIndex = _useParams_params.zIndex, beforeCancel = _useParams_params.beforeCancel, beforeClose = _useParams_params.beforeClose, onClose = _useParams_params.onClose, onCancel = _useParams_params.onCancel, onConfirm = _useParams_params.onConfirm, onOverlayClick = _useParams_params.onOverlayClick, setParams = _useParams.setParams;
14198
14299
  var classPrefix2 = "nut-dialog";
14199
14300
  var locale = useConfig().locale;
14200
14301
  var _useState = _sliced_to_array(React.useState(false), 2), loading = _useState[0], setLoading = _useState[1];
14201
- var _useParams = useParams(mergeProps(defaultProps$H, props)), _useParams_params = _useParams.params, id = _useParams_params.id, className = _useParams_params.className, style = _useParams_params.style, visible = _useParams_params.visible, footer = _useParams_params.footer, title = _useParams_params.title, header = _useParams_params.header, content2 = _useParams_params.content, children = _useParams_params.children, footerDirection = _useParams_params.footerDirection, hideConfirmButton = _useParams_params.hideConfirmButton, hideCancelButton = _useParams_params.hideCancelButton, lockScroll = _useParams_params.lockScroll, disableConfirmButton = _useParams_params.disableConfirmButton, closeOnOverlayClick = _useParams_params.closeOnOverlayClick, confirmText = _useParams_params.confirmText, cancelText = _useParams_params.cancelText, overlay = _useParams_params.overlay, overlayStyle = _useParams_params.overlayStyle, overlayClassName = _useParams_params.overlayClassName, closeIconPosition = _useParams_params.closeIconPosition, closeIcon = _useParams_params.closeIcon, zIndex = _useParams_params.zIndex, beforeCancel = _useParams_params.beforeCancel, beforeClose = _useParams_params.beforeClose, onClose = _useParams_params.onClose, onCancel = _useParams_params.onCancel, onConfirm = _useParams_params.onConfirm, onOverlayClick = _useParams_params.onOverlayClick, setParams = _useParams.setParams;
14202
14302
  useCustomEvent(id, function(param) {
14203
14303
  var status = param.status, options = param.options;
14204
14304
  setParams(_object_spread_props(_object_spread({}, options), {
@@ -14212,8 +14312,8 @@
14212
14312
  e.stopPropagation();
14213
14313
  if (!(beforeCancel === null || beforeCancel === void 0 ? void 0 : beforeCancel())) return;
14214
14314
  if (!(beforeClose === null || beforeClose === void 0 ? void 0 : beforeClose())) return;
14215
- onClose === null || onClose === void 0 ? void 0 : onClose();
14216
- onCancel === null || onCancel === void 0 ? void 0 : onCancel();
14315
+ onClose();
14316
+ onCancel();
14217
14317
  };
14218
14318
  var handleOk = /* @__PURE__ */ function() {
14219
14319
  var _ref = _async_to_generator(function(e) {
@@ -14237,7 +14337,7 @@
14237
14337
  case 2:
14238
14338
  _state.sent();
14239
14339
  setLoading(false);
14240
- onClose === null || onClose === void 0 ? void 0 : onClose();
14340
+ onClose();
14241
14341
  return [
14242
14342
  3,
14243
14343
  4
@@ -14281,8 +14381,8 @@
14281
14381
  };
14282
14382
  var renderConfirm = function() {
14283
14383
  return !hideConfirmButton && /* @__PURE__ */ React.createElement(Button, {
14284
- size: "large",
14285
14384
  type: "primary",
14385
+ size: "large",
14286
14386
  className: classNames("".concat(classPrefix2, "-footer-ok ").concat(btnClass), {
14287
14387
  disabled: disableConfirmButton
14288
14388
  }),
@@ -14300,8 +14400,8 @@
14300
14400
  var handleCancel = function() {
14301
14401
  if (!(beforeCancel === null || beforeCancel === void 0 ? void 0 : beforeCancel())) return;
14302
14402
  if (!(beforeClose === null || beforeClose === void 0 ? void 0 : beforeClose())) return;
14303
- onClose === null || onClose === void 0 ? void 0 : onClose();
14304
- onCancel === null || onCancel === void 0 ? void 0 : onCancel();
14403
+ onClose();
14404
+ onCancel();
14305
14405
  };
14306
14406
  var _obj;
14307
14407
  var closeClasses = classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-close"), true), _define_property(_obj, "".concat(classPrefix2, "-close-").concat(closeIconPosition), true), _obj));
@@ -14314,8 +14414,8 @@
14314
14414
  var onHandleClickOverlay = function(e) {
14315
14415
  if (closeOnOverlayClick && visible && e.target === e.currentTarget) {
14316
14416
  var closed = onOverlayClick && onOverlayClick(e);
14317
- closed && onClose && onClose();
14318
- closed && onCancel && onCancel();
14417
+ closed && onClose();
14418
+ closed && onCancel();
14319
14419
  }
14320
14420
  };
14321
14421
  var renderContent = function() {
@@ -31765,7 +31865,7 @@
31765
31865
  "function" == typeof t2 && t2(Date.now());
31766
31866
  }, 16);
31767
31867
  } };
31768
- S.window = { devicePixelRatio: x.pixelRatio }, S.document = S.window.document = { body: {}, createElement: v }, S.navigator = S.window.navigator = { userAgent: "" }, XMLHttpRequest = u;
31868
+ S.window = { devicePixelRatio: x.pixelRatio }, S.document = S.window.document = { body: {}, createElement: v }, S.navigator = S.window.navigator = { userAgent: "" }, S.window.XMLHttpRequest = u;
31769
31869
  var E = function(t2) {
31770
31870
  var e2 = S.window, r2 = S.document;
31771
31871
  S._requestAnimationFrame = e2.requestAnimationFrame, S._cancelAnimationFrame = e2.cancelAnimationFrame, e2.requestAnimationFrame = function(e3) {
@@ -35955,7 +36055,6 @@
35955
36055
  ],
35956
36056
  arrowOffset: 0,
35957
36057
  targetId: "",
35958
- className: "",
35959
36058
  showArrow: true,
35960
36059
  closeOnOutsideClick: true,
35961
36060
  closeOnActionClick: true,
@@ -35993,129 +36092,100 @@
35993
36092
  var popoverRef = React.useRef(null);
35994
36093
  var popoverContentRef = React.useRef(null);
35995
36094
  var _useState = _sliced_to_array(React.useState(false), 2), showPopup = _useState[0], setShowPopup = _useState[1];
35996
- var _useState1 = _sliced_to_array(React.useState(0), 2), elWidth = _useState1[0], setElWidth = _useState1[1];
35997
- var _useState2 = _sliced_to_array(React.useState(0), 2), elHeight = _useState2[0], setElHeight = _useState2[1];
35998
- var _useState3 = _sliced_to_array(React.useState(), 2), rootPosition = _useState3[0], setRootPosition = _useState3[1];
36095
+ var _useState1 = _sliced_to_array(React.useState(0), 2), popWidth = _useState1[0], setPopWidth = _useState1[1];
36096
+ var _useState2 = _sliced_to_array(React.useState(0), 2), popHeight = _useState2[0], setPopHeight = _useState2[1];
36097
+ var _useState3 = _sliced_to_array(React.useState(), 2), wrapperPosition = _useState3[0], setWrapperPosition = _useState3[1];
35999
36098
  React.useEffect(function() {
36000
36099
  setShowPopup(visible);
36001
36100
  if (visible) {
36002
- setTimeout(function() {
36003
- getContentWidth();
36004
- }, 0);
36101
+ getWrapperPosition();
36005
36102
  }
36006
36103
  }, [
36007
36104
  visible
36008
36105
  ]);
36009
- var getContentWidth = /* @__PURE__ */ function() {
36106
+ var uid = useUuid();
36107
+ var popoverId = "popover-".concat(uid);
36108
+ var getWrapperPosition = /* @__PURE__ */ function() {
36010
36109
  var _ref2 = _async_to_generator(function() {
36011
- var rect;
36012
36110
  return __generator(this, function(_state) {
36013
- Taro.createSelectorQuery().selectViewport().scrollOffset(/* @__PURE__ */ function() {
36014
- var _ref3 = _async_to_generator(function(res) {
36015
- var distance;
36016
- return __generator(this, function(_state2) {
36017
- switch (_state2.label) {
36018
- case 0:
36019
- distance = res.scrollTop;
36020
- if (!targetId) return [
36021
- 3,
36022
- 4
36023
- ];
36024
- if (!(Taro.getEnv() === Taro.ENV_TYPE.WEB)) return [
36025
- 3,
36026
- 1
36027
- ];
36028
- rect = getRect(document.querySelector("#".concat(targetId)));
36029
- return [
36030
- 3,
36031
- 3
36032
- ];
36033
- case 1:
36034
- return [
36035
- 4,
36036
- getRectTaro(targetId)
36037
- ];
36038
- case 2:
36039
- rect = _state2.sent();
36040
- _state2.label = 3;
36041
- case 3:
36042
- return [
36043
- 3,
36044
- 6
36045
- ];
36046
- case 4:
36047
- return [
36048
- 4,
36049
- getRectByTaro(popoverRef.current)
36050
- ];
36051
- case 5:
36052
- rect = _state2.sent();
36053
- _state2.label = 6;
36054
- case 6:
36055
- setRootPosition({
36056
- width: rect.width,
36057
- height: rect.height,
36058
- left: rtl ? rect.right : rect.left,
36059
- top: rect.top + distance,
36060
- right: rtl ? rect.left : rect.right
36061
- });
36062
- return [
36063
- 2
36064
- ];
36065
- }
36066
- });
36111
+ Taro.nextTick(/* @__PURE__ */ _async_to_generator(function() {
36112
+ var rect, _tmp, width2, height2, right2, left2, top;
36113
+ return __generator(this, function(_state2) {
36114
+ switch (_state2.label) {
36115
+ case 0:
36116
+ if (!targetId) return [
36117
+ 3,
36118
+ 2
36119
+ ];
36120
+ return [
36121
+ 4,
36122
+ getRectByTaro(document.querySelector("#".concat(targetId)), targetId)
36123
+ ];
36124
+ case 1:
36125
+ _tmp = _state2.sent();
36126
+ return [
36127
+ 3,
36128
+ 4
36129
+ ];
36130
+ case 2:
36131
+ return [
36132
+ 4,
36133
+ getRectByTaro(popoverRef.current, popoverId)
36134
+ ];
36135
+ case 3:
36136
+ _tmp = _state2.sent();
36137
+ _state2.label = 4;
36138
+ case 4:
36139
+ rect = _tmp;
36140
+ width2 = rect.width, height2 = rect.height, right2 = rect.right, left2 = rect.left, top = rect.top;
36141
+ setWrapperPosition({
36142
+ width: width2,
36143
+ height: height2,
36144
+ left: rtl ? right2 : left2,
36145
+ top,
36146
+ right: rtl ? left2 : right2
36147
+ });
36148
+ getPopoverContentW();
36149
+ return [
36150
+ 2
36151
+ ];
36152
+ }
36067
36153
  });
36068
- return function(res) {
36069
- return _ref3.apply(this, arguments);
36070
- };
36071
- }()).exec();
36072
- setTimeout(function() {
36073
- getPopoverContentW();
36074
- }, 300);
36154
+ }));
36075
36155
  return [
36076
36156
  2
36077
36157
  ];
36078
36158
  });
36079
36159
  });
36080
- return function getContentWidth2() {
36081
- return _ref2.apply(this, arguments);
36082
- };
36083
- }();
36084
- var getRectTaro = /* @__PURE__ */ function() {
36085
- var _ref2 = _async_to_generator(function(targetId2) {
36086
- return __generator(this, function(_state) {
36087
- return [
36088
- 2,
36089
- new Promise(function(resolve) {
36090
- Taro.createSelectorQuery().select("#".concat(targetId2)).boundingClientRect().exec(function(res) {
36091
- resolve(res[0]);
36092
- });
36093
- })
36094
- ];
36095
- });
36096
- });
36097
- return function getRectTaro2(targetId2) {
36160
+ return function getWrapperPosition2() {
36098
36161
  return _ref2.apply(this, arguments);
36099
36162
  };
36100
36163
  }();
36101
36164
  var getPopoverContentW = /* @__PURE__ */ function() {
36102
36165
  var _ref2 = _async_to_generator(function() {
36103
- var rectContent;
36104
36166
  return __generator(this, function(_state) {
36105
- switch (_state.label) {
36106
- case 0:
36107
- return [
36108
- 4,
36109
- getRectByTaro(popoverContentRef.current)
36110
- ];
36111
- case 1:
36112
- rectContent = _state.sent();
36113
- setElWidth(rectContent.width);
36114
- setElHeight(rectContent.height);
36115
- return [
36116
- 2
36117
- ];
36118
- }
36167
+ Taro.nextTick(/* @__PURE__ */ _async_to_generator(function() {
36168
+ var rectContent;
36169
+ return __generator(this, function(_state2) {
36170
+ switch (_state2.label) {
36171
+ case 0:
36172
+ return [
36173
+ 4,
36174
+ getRectByTaro(popoverContentRef.current)
36175
+ ];
36176
+ case 1:
36177
+ rectContent = _state2.sent();
36178
+ setPopWidth(rectContent.width);
36179
+ setPopHeight(rectContent.height);
36180
+ return [
36181
+ 2
36182
+ ];
36183
+ }
36184
+ });
36185
+ }));
36186
+ return [
36187
+ 2
36188
+ ];
36119
36189
  });
36120
36190
  });
36121
36191
  return function getPopoverContentW2() {
@@ -36124,23 +36194,23 @@
36124
36194
  }();
36125
36195
  var clickAway = function() {
36126
36196
  if (closeOnOutsideClick) {
36127
- onClick && onClick();
36128
- onClose && onClose();
36197
+ onClick === null || onClick === void 0 ? void 0 : onClick();
36198
+ onClose === null || onClose === void 0 ? void 0 : onClose();
36129
36199
  }
36130
36200
  };
36131
- var _obj;
36132
- var classes = classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix$b), true), _define_property(_obj, "".concat(classPrefix$b, "-").concat(theme), theme === "dark"), _obj), className);
36201
+ var classes = classNames(classPrefix$b, _define_property({}, "".concat(classPrefix$b, "-").concat(theme), theme === "dark"), className);
36133
36202
  var popoverArrow = function() {
36134
36203
  var prefixCls2 = "nut-popover-arrow";
36135
- return "".concat(prefixCls2, " ").concat(prefixCls2, "-").concat(location.split("-")[0], " ").concat(prefixCls2, "-").concat(location);
36204
+ var direction = location.split("-")[0];
36205
+ return "".concat(prefixCls2, " ").concat(prefixCls2, "-").concat(direction, " ").concat(prefixCls2, "-").concat(location);
36136
36206
  };
36137
- var getRootPosition = function() {
36207
+ var getPopoverPosition = function() {
36138
36208
  var styles = {};
36139
- if (!rootPosition) {
36209
+ if (!wrapperPosition) {
36140
36210
  styles.visibility = "hidden";
36141
36211
  return styles;
36142
36212
  }
36143
- var width2 = rootPosition.width, height2 = rootPosition.height, left2 = rootPosition.left, top = rootPosition.top, right2 = rootPosition.right;
36213
+ var width2 = wrapperPosition.width, height2 = wrapperPosition.height, left2 = wrapperPosition.left, top = wrapperPosition.top, right2 = wrapperPosition.right;
36144
36214
  var direction = location.split("-")[0];
36145
36215
  var skew = location.split("-")[1];
36146
36216
  var cross = 0;
@@ -36156,36 +36226,36 @@
36156
36226
  "bottom",
36157
36227
  "top"
36158
36228
  ].includes(direction)) {
36159
- var h = direction === "bottom" ? height2 + cross : -(elHeight + cross);
36160
- styles.top = "".concat(top + h, "px");
36229
+ var h = direction === "bottom" ? height2 + cross : -(popHeight + cross);
36230
+ styles.top = pxTransform(top + h);
36161
36231
  if (!skew) {
36162
- styles[dir] = "".concat(-(elWidth - width2) / 2 + rootPosition[dir] + parallel, "px");
36232
+ styles[dir] = pxTransform(-(popWidth - width2) / 2 + wrapperPosition[dir] + parallel);
36163
36233
  }
36164
- if (skew === "start") {
36165
- styles.left = "".concat(left2 + parallel, "px");
36234
+ if (skew === "left") {
36235
+ styles.left = pxTransform(left2 + parallel);
36166
36236
  }
36167
- if (skew === "end") {
36168
- styles.left = "".concat(right2 + parallel, "px");
36237
+ if (skew === "right") {
36238
+ styles.left = pxTransform(right2 + parallel);
36169
36239
  }
36170
36240
  }
36171
36241
  if ([
36172
36242
  "left",
36173
36243
  "right"
36174
36244
  ].includes(direction)) {
36175
- var contentW = direction === "left" ? -(elWidth + cross) : width2 + cross;
36176
- styles.left = "".concat(left2 + contentW, "px");
36245
+ var contentW = direction === "left" ? -(popWidth + cross) : width2 + cross;
36246
+ styles.left = pxTransform(left2 + contentW);
36177
36247
  if (!skew) {
36178
- styles.top = "".concat(top - elHeight / 2 + height2 / 2 - 4 + parallel, "px");
36248
+ styles.top = pxTransform(top - popHeight / 2 + height2 / 2 - 4 + parallel);
36179
36249
  }
36180
- if (skew === "start") {
36181
- styles.top = "".concat(top + parallel, "px");
36250
+ if (skew === "top") {
36251
+ styles.top = pxTransform(top + parallel);
36182
36252
  }
36183
- if (skew === "end") {
36184
- styles.top = "".concat(top + height2 + parallel, "px");
36253
+ if (skew === "bottom") {
36254
+ styles.top = pxTransform(top + height2 + parallel);
36185
36255
  }
36186
36256
  }
36187
36257
  }
36188
- styles.visibility = elWidth === 0 ? "hidden" : "initial";
36258
+ styles.visibility = popWidth === 0 ? "hidden" : "initial";
36189
36259
  return styles;
36190
36260
  };
36191
36261
  var popoverArrowStyle = function() {
@@ -36203,10 +36273,10 @@
36203
36273
  if (!skew) {
36204
36274
  styles[dir] = "calc(50% + ".concat(arrowOffset, "px)");
36205
36275
  }
36206
- if (skew === "start") {
36276
+ if (skew === "left") {
36207
36277
  styles[dir] = "".concat(base + arrowOffset, "px");
36208
36278
  }
36209
- if (skew === "end") {
36279
+ if (skew === "right") {
36210
36280
  styles[dir2] = "".concat(base - arrowOffset, "px");
36211
36281
  }
36212
36282
  }
@@ -36217,10 +36287,10 @@
36217
36287
  if (!skew) {
36218
36288
  styles.top = "calc(50% - ".concat(arrowOffset, "px)");
36219
36289
  }
36220
- if (skew === "start") {
36290
+ if (skew === "top") {
36221
36291
  styles.top = "".concat(base - arrowOffset, "px");
36222
36292
  }
36223
- if (skew === "end") {
36293
+ if (skew === "bottom") {
36224
36294
  styles.bottom = "".concat(base + arrowOffset, "px");
36225
36295
  }
36226
36296
  }
@@ -36239,6 +36309,7 @@
36239
36309
  return /* @__PURE__ */ React.createElement(React.Fragment, null, !targetId && /* @__PURE__ */ React.createElement(components.View, {
36240
36310
  className: "nut-popover-wrapper",
36241
36311
  ref: popoverRef,
36312
+ id: popoverId,
36242
36313
  onClick: function() {
36243
36314
  var _props_onClick;
36244
36315
  props === null || props === void 0 ? void 0 : (_props_onClick = props.onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(props);
@@ -36251,7 +36322,7 @@
36251
36322
  style
36252
36323
  }, Array.isArray(children) ? children[0] : children), /* @__PURE__ */ React.createElement(components.View, {
36253
36324
  className: classes,
36254
- style: getRootPosition()
36325
+ style: _object_spread({}, getPopoverPosition(), style)
36255
36326
  }, /* @__PURE__ */ React.createElement(Popup, _object_spread({
36256
36327
  className: "nut-popover-content nut-popover-content-".concat(location),
36257
36328
  position: "none",
@@ -36266,25 +36337,26 @@
36266
36337
  }, /* @__PURE__ */ React.createElement(IconSVG$x, {
36267
36338
  width: 8,
36268
36339
  height: 4
36269
- })), Array.isArray(children) ? children[1] : "", list.map(function(item, index2) {
36340
+ })), Array.isArray(children) ? children[1] : null, list.map(function(item, index2) {
36341
+ var _item_action;
36270
36342
  return /* @__PURE__ */ React.createElement(components.View, {
36271
36343
  className: classNames({
36272
- "nut-popover-menu-item": true,
36273
- "nut-popover-menu-disabled": item.disabled
36344
+ "nut-popover-item": true,
36345
+ "nut-popover-item-disabled": item.disabled
36274
36346
  }, item.className),
36275
36347
  key: item.key || index2,
36276
36348
  onClick: function() {
36277
36349
  return handleSelect(item, index2);
36278
36350
  }
36279
36351
  }, item.icon && /* @__PURE__ */ React.createElement(components.View, {
36280
- className: "nut-popover-menu-item-icon"
36281
- }, item.icon), /* @__PURE__ */ React.createElement(components.View, {
36282
- className: "nut-popover-menu-item-name"
36283
- }, item.name), item.action && item.action.icon && /* @__PURE__ */ React.createElement(components.View, {
36284
- className: "nut-popover-menu-item-action-icon",
36352
+ className: "nut-popover-item-icon"
36353
+ }, item.icon), /* @__PURE__ */ React.createElement(components.Text, {
36354
+ className: "nut-popover-item-name"
36355
+ }, item.name), ((_item_action = item.action) === null || _item_action === void 0 ? void 0 : _item_action.icon) && /* @__PURE__ */ React.createElement(components.View, {
36356
+ className: "nut-popover-item-action-icon",
36285
36357
  onClick: function(e) {
36286
- var _item_action_onClick, _item_action;
36287
- return (_item_action = item.action) === null || _item_action === void 0 ? void 0 : (_item_action_onClick = _item_action.onClick) === null || _item_action_onClick === void 0 ? void 0 : _item_action_onClick.call(_item_action, e);
36358
+ var _item_action_onClick, _item_action2;
36359
+ return (_item_action2 = item.action) === null || _item_action2 === void 0 ? void 0 : (_item_action_onClick = _item_action2.onClick) === null || _item_action_onClick === void 0 ? void 0 : _item_action_onClick.call(_item_action2, e);
36288
36360
  }
36289
36361
  }, item.action.icon));
36290
36362
  }))), showPopup && closeOnOutsideClick && /* @__PURE__ */ React.createElement(components.View, {
@@ -36537,8 +36609,7 @@
36537
36609
  visible: false,
36538
36610
  size: "normal",
36539
36611
  shape: "round",
36540
- duration: 0.6,
36541
- inline: false
36612
+ duration: 0.6
36542
36613
  });
36543
36614
  var Skeleton = function(props) {
36544
36615
  var shapeStyle = function shapeStyle2() {
@@ -36678,7 +36749,7 @@
36678
36749
  return _ref.apply(this, arguments);
36679
36750
  };
36680
36751
  }();
36681
- setTimeout(function() {
36752
+ Taro.nextTick(function() {
36682
36753
  return getWidth();
36683
36754
  });
36684
36755
  });
@@ -37710,10 +37781,8 @@
37710
37781
  var context2 = React.useContext(CollapseContext);
37711
37782
  var wrapperRef = React.useRef(null);
37712
37783
  var contentRef = React.useRef(null);
37713
- var _useState = _sliced_to_array(React.useState(function() {
37714
- return Math.random().toString(36).slice(-8);
37715
- }), 1), refRandomId = _useState[0];
37716
- var target = "#nut-collapse-content-".concat(refRandomId);
37784
+ var uid = useUuid();
37785
+ var target = "nut-collapse-content-".concat(uid);
37717
37786
  var expanded = React.useMemo(function() {
37718
37787
  if (context2) {
37719
37788
  return context2.isOpen(name2);
@@ -37733,82 +37802,64 @@
37733
37802
  expanded,
37734
37803
  rotate
37735
37804
  ]);
37736
- var handleClick = function() {
37737
- if (!disabled) {
37738
- context2.updateValue(name2);
37739
- }
37740
- };
37741
- var _useState1 = _sliced_to_array(React.useState(null), 2), timer = _useState1[0], setTimer = _useState1[1];
37742
- var _useState2 = _sliced_to_array(React.useState("auto"), 2), currentHeight = _useState2[0], setCurrentHeight = _useState2[1];
37743
- var inAnimation = React.useRef(false);
37744
- var _useState3 = _sliced_to_array(React.useState(function() {
37745
- return expanded ? "auto" : "0px";
37746
- }), 2), wrapperHeight = _useState3[0], setWrapperHeight = _useState3[1];
37747
- var getRect2 = function(selector) {
37748
- return new Promise(function(resolve) {
37749
- Taro.createSelectorQuery().select(selector).boundingClientRect().exec(function() {
37750
- var rect = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
37751
- resolve(rect[0]);
37805
+ var _useState = _sliced_to_array(React.useState(0), 2), tran = _useState[0], setTran = _useState[1];
37806
+ var _useRefState = _sliced_to_array(useRefState(0), 2), currentHeight = _useRefState[0], setCurrentHeight = _useRefState[1];
37807
+ var _useState1 = _sliced_to_array(React.useState(0), 2), wrapperHeight = _useState1[0], setWrapperHeight = _useState1[1];
37808
+ var updateRectHeight = /* @__PURE__ */ function() {
37809
+ var _ref2 = _async_to_generator(function() {
37810
+ var res;
37811
+ return __generator(this, function(_state) {
37812
+ switch (_state.label) {
37813
+ case 0:
37814
+ return [
37815
+ 4,
37816
+ getRectByTaro(contentRef.current, target)
37817
+ ];
37818
+ case 1:
37819
+ res = _state.sent();
37820
+ if (res === null || res === void 0 ? void 0 : res.height) {
37821
+ setCurrentHeight(res.height);
37822
+ setWrapperHeight(expanded ? res.height : 0);
37823
+ Taro.nextTick(function() {
37824
+ setTran(1);
37825
+ });
37826
+ }
37827
+ return [
37828
+ 2
37829
+ ];
37830
+ }
37752
37831
  });
37753
37832
  });
37754
- };
37833
+ return function updateRectHeight2() {
37834
+ return _ref2.apply(this, arguments);
37835
+ };
37836
+ }();
37755
37837
  React.useEffect(function() {
37756
- setTimeout(function() {
37757
- getRect2(target).then(function(res) {
37758
- if (res === null || res === void 0 ? void 0 : res.height) {
37759
- setCurrentHeight("".concat(res.height, "px"));
37760
- }
37761
- });
37762
- }, 200);
37838
+ Taro.nextTick(function() {
37839
+ updateRectHeight();
37840
+ });
37763
37841
  }, [
37764
- children
37842
+ children,
37843
+ expanded
37765
37844
  ]);
37766
- React.useEffect(function() {
37767
- setTimeout(function() {
37768
- getRect2(target).then(function(res) {
37769
- if (res === null || res === void 0 ? void 0 : res.height) {
37770
- setCurrentHeight("".concat(res.height, "px"));
37771
- }
37772
- });
37773
- }, 100);
37774
- }, []);
37775
37845
  var toggle = function() {
37776
- if (timer) {
37777
- clearTimeout(timer);
37778
- setTimer(timer);
37779
- }
37780
- var start = expanded ? "0px" : currentHeight;
37781
- var end = expanded ? currentHeight : "0px";
37782
- inAnimation.current = true;
37783
- setWrapperHeight(start);
37784
- setTimeout(function() {
37785
- setWrapperHeight(end);
37786
- inAnimation.current = false;
37787
- if (expanded) {
37788
- var timer2 = setTimeout(function() {
37789
- setWrapperHeight("auto");
37790
- }, 300);
37791
- setTimer(timer2);
37792
- }
37793
- }, 100);
37846
+ var end = !expanded ? currentHeight.current : 0;
37847
+ setWrapperHeight(end);
37794
37848
  };
37795
- var init = React.useRef(true);
37796
- React.useEffect(function() {
37797
- if (init.current) {
37798
- init.current = false;
37799
- } else {
37800
- toggle();
37849
+ var handleClick = function() {
37850
+ if (!disabled) {
37851
+ context2.updateValue(name2);
37852
+ setTimeout(function() {
37853
+ toggle();
37854
+ }, 150);
37801
37855
  }
37802
- }, [
37803
- expanded
37804
- ]);
37856
+ };
37857
+ var _obj;
37805
37858
  return /* @__PURE__ */ React.createElement("div", _object_spread({
37806
37859
  className: classNames(classPrefix2, className),
37807
37860
  style
37808
37861
  }, rest), /* @__PURE__ */ React.createElement(components.View, {
37809
- className: classNames("".concat(classPrefix2, "-header"), {
37810
- disabled
37811
- }),
37862
+ className: classNames("".concat(classPrefix2, "-header"), _define_property({}, "".concat(classPrefix2, "-header-disabled"), disabled)),
37812
37863
  onClick: handleClick
37813
37864
  }, /* @__PURE__ */ React.createElement(components.View, {
37814
37865
  className: "".concat(classPrefix2, "-title")
@@ -37820,17 +37871,18 @@
37820
37871
  className: "".concat(classPrefix2, "-icon"),
37821
37872
  style: iconStyle
37822
37873
  }, expandIcon || context2.expandIcon))), /* @__PURE__ */ React.createElement(components.View, {
37823
- className: "".concat(classPrefix2, "-content"),
37824
- ref: wrapperRef,
37825
- style: {
37826
- willChange: "height",
37874
+ className: classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-content-wrapper"), true), _define_property(_obj, "".concat(classPrefix2, "-content-wrapper-tran"), true), _obj)),
37875
+ style: tran ? {
37827
37876
  height: wrapperHeight
37828
- }
37877
+ } : {},
37878
+ ref: wrapperRef
37829
37879
  }, /* @__PURE__ */ React.createElement(components.View, {
37880
+ className: "".concat(classPrefix2, "-content"),
37830
37881
  ref: contentRef,
37831
- className: "".concat(classPrefix2, "-content-text"),
37832
- id: "nut-collapse-content-".concat(refRandomId)
37833
- }, children)));
37882
+ id: target
37883
+ }, /* @__PURE__ */ React.createElement(components.View, {
37884
+ className: "".concat(classPrefix2, "-content-text")
37885
+ }, children))));
37834
37886
  };
37835
37887
  CollapseItem.displayName = "NutCollapseItem";
37836
37888
  var defaultProps$m = _object_spread_props(_object_spread({}, ComponentDefaults), {
@@ -39625,7 +39677,6 @@
39625
39677
  ]);
39626
39678
  var getRootPosition = function() {
39627
39679
  getTaroRectById(list[active2].target).then(function(rect) {
39628
- console.log("rect", rect);
39629
39680
  setMaskRect({
39630
39681
  top: rect.top,
39631
39682
  left: rect.left,
@@ -39687,16 +39738,16 @@
39687
39738
  }
39688
39739
  }, index2 === active2 && /* @__PURE__ */ React.createElement(React.Fragment, null, showTour && /* @__PURE__ */ React.createElement(components.View, {
39689
39740
  className: "".concat(mask2 ? "nut-tour-mask" : "nut-tour-mask nut-tour-mask-none"),
39690
- id: "nut-tour-popid",
39741
+ id: "nut-tour-popid".concat(index2),
39691
39742
  style: maskStyle()
39692
39743
  }), /* @__PURE__ */ React.createElement(Popover, {
39693
39744
  visible: showPopup,
39694
39745
  location: item.location || location,
39695
- targetId: "nut-tour-popid",
39746
+ targetId: "nut-tour-popid".concat(index2 === active2 ? index2 : ""),
39696
39747
  closeOnOutsideClick: false,
39697
39748
  offset: item.popoverOffset || [
39698
39749
  0,
39699
- 12
39750
+ 8
39700
39751
  ],
39701
39752
  arrowOffset: item.arrowOffset || 0
39702
39753
  }, /* @__PURE__ */ React.createElement(React.Fragment, null), /* @__PURE__ */ React.createElement(React.Fragment, null, children || /* @__PURE__ */ React.createElement(React.Fragment, null, type2 === "step" && /* @__PURE__ */ React.createElement(components.View, {
@@ -41243,6 +41294,7 @@
41243
41294
  });
41244
41295
  };
41245
41296
  WaterMark.displayName = "NutWaterMark";
41297
+ var destroyList = [];
41246
41298
  exports.ActionSheet = ActionSheet;
41247
41299
  exports.Address = Address;
41248
41300
  exports.Animate = Animate;
@@ -41347,6 +41399,7 @@
41347
41399
  exports.Video = Video;
41348
41400
  exports.VirtualList = VirtualList;
41349
41401
  exports.WaterMark = WaterMark;
41402
+ exports.destroyList = destroyList;
41350
41403
  exports.getDefaultConfig = getDefaultConfig;
41351
41404
  exports.setDefaultConfig = setDefaultConfig;
41352
41405
  exports.useConfig = useConfig;