@nutui/nutui-react-taro 2.7.3 → 2.7.5

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 (62) hide show
  1. package/CHANGELOG.md +28 -7
  2. package/dist/esm/AnimatingNumbers/style/style.css +1 -1
  3. package/dist/esm/Audio.js +1 -1
  4. package/dist/esm/Barrage.js +1 -1
  5. package/dist/esm/DatePicker.js +1 -1
  6. package/dist/esm/Drag/style/style.css +1 -1
  7. package/dist/esm/Drag.js +1 -1
  8. package/dist/esm/Ellipsis.js +1 -1
  9. package/dist/esm/Form/style/style.css +1 -1
  10. package/dist/esm/FormItem/style/style.css +1 -1
  11. package/dist/esm/Menu.js +1 -1
  12. package/dist/esm/MenuItem.js +1 -1
  13. package/dist/esm/NavBar.js +1 -1
  14. package/dist/esm/NoticeBar.js +1 -1
  15. package/dist/esm/Picker.js +1 -1
  16. package/dist/esm/Popover.js +1 -1
  17. package/dist/esm/Range.js +1 -1
  18. package/dist/esm/Rate.js +1 -1
  19. package/dist/esm/Sticky.js +1 -1
  20. package/dist/esm/Swipe.js +1 -1
  21. package/dist/esm/TextArea/style/style.css +1 -1
  22. package/dist/esm/Tour.js +1 -1
  23. package/dist/esm/Uploader.js +1 -1
  24. package/dist/esm/{audio.taro-qK1wq4IH.js → audio.taro-DtIUjg89.js} +1 -1
  25. package/dist/esm/{barrage.taro-D2lmvcB-.js → barrage.taro-Dc2Wz_3H.js} +1 -1
  26. package/dist/esm/{datepicker.taro-DU4OSraL.js → datepicker.taro-DicskhhH.js} +1 -1
  27. package/dist/esm/{drag.taro-B_sfzmtW.js → drag.taro-r5Lmncrq.js} +10 -14
  28. package/dist/esm/{ellipsis.taro-fvcP85Ir.js → ellipsis.taro-K9VJCTL6.js} +1 -1
  29. package/dist/esm/{get-rect-by-taro-THaHH07X.js → get-rect-by-taro-D0h6aiDr.js} +37 -0
  30. package/dist/esm/{menu.taro-BmjnA_YM.js → menu.taro-2APk--BX.js} +1 -1
  31. package/dist/esm/{menuitem.taro-DCqPC4Nu.js → menuitem.taro-BMlSqBSc.js} +1 -1
  32. package/dist/esm/{navbar.taro-HRFRDGii.js → navbar.taro-B_9Ezsny.js} +1 -1
  33. package/dist/esm/{noticebar.taro-BjKDC7We.js → noticebar.taro-B0qm66Cu.js} +1 -1
  34. package/dist/esm/nutui-react.es.js +17 -17
  35. package/dist/esm/{picker.taro-CYNZBTE4.js → picker.taro-B7EE52qf.js} +1 -1
  36. package/dist/esm/{popover.taro-o5vHvHsm.js → popover.taro-C9qhPJCb.js} +1 -1
  37. package/dist/esm/{range.taro-D4U2Q7Wx.js → range.taro-Bbs4JcXp.js} +1 -1
  38. package/dist/esm/{rate.taro-CPGkjYYu.js → rate.taro-DsDMiRHd.js} +1 -1
  39. package/dist/esm/{sticky.taro-DC98CdU7.js → sticky.taro-DtUAawu_.js} +1 -1
  40. package/dist/esm/{swipe.taro-Bsk2fnEl.js → swipe.taro-CUZSZcIh.js} +1 -1
  41. package/dist/esm/{tour.taro-DfOfyyte.js → tour.taro-BidQx8Fg.js} +1 -1
  42. package/dist/esm/{uploader.taro-C3hV5Aih.js → uploader.taro-BBJsHrew.js} +1 -1
  43. package/dist/locales/base.js +1 -1
  44. package/dist/locales/en-US.js +1 -1
  45. package/dist/locales/id-ID.js +1 -1
  46. package/dist/locales/tr-TR.js +1 -1
  47. package/dist/locales/zh-CN.js +1 -1
  48. package/dist/locales/zh-TW.js +1 -1
  49. package/dist/locales/zh-UG.js +1 -1
  50. package/dist/nutui.react.es.js +52 -14
  51. package/dist/nutui.react.umd.js +52 -14
  52. package/dist/packages/animatingnumbers/countup.scss +1 -1
  53. package/dist/packages/drag/drag.scss +1 -0
  54. package/dist/packages/formitem/formitem.scss +1 -1
  55. package/dist/packages/textarea/textarea.scss +3 -4
  56. package/dist/style.css +1 -1
  57. package/dist/styles/variables-jmapp.scss +5 -0
  58. package/dist/styles/variables.scss +5 -0
  59. package/dist/types/packages/configprovider/types.d.ts +1 -1
  60. package/dist/types/packages/uploader/uploader.taro.d.ts +15 -3
  61. package/dist/types/utils/lru.d.ts +8 -0
  62. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.7.3 Fri Dec 13 2024 15:48:17 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.7.5 Fri Jan 03 2025 17:32:08 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.7.3 Fri Dec 13 2024 15:48:17 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.7.5 Fri Jan 03 2025 17:32:08 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.7.3 Fri Dec 13 2024 15:48:17 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.7.5 Fri Jan 03 2025 17:32:08 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.7.3 Fri Dec 13 2024 15:48:17 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.7.5 Fri Jan 03 2025 17:32:08 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.7.3 Fri Dec 13 2024 15:48:17 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.7.5 Fri Jan 03 2025 17:32:08 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.7.3 Fri Dec 13 2024 15:48:17 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.7.5 Fri Jan 03 2025 17:32:08 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.7.3 Fri Dec 13 2024 15:47:49 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.7.5 Fri Jan 03 2025 17:31:45 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -3945,6 +3945,35 @@ function useWatch(dep, callback, config2 = { immediate: false }) {
3945
3945
  stop.current = true;
3946
3946
  };
3947
3947
  }
3948
+ class MiniLru {
3949
+ constructor(capacity) {
3950
+ if (capacity <= 0) {
3951
+ throw new Error("Cache capacity must be a positive number");
3952
+ }
3953
+ this.cache = /* @__PURE__ */ new Map();
3954
+ this.capacity = capacity;
3955
+ }
3956
+ get(key) {
3957
+ if (this.cache.has(key)) {
3958
+ const value = this.cache.get(key);
3959
+ this.cache.delete(key);
3960
+ this.cache.set(key, value);
3961
+ return value;
3962
+ }
3963
+ return null;
3964
+ }
3965
+ set(key, value) {
3966
+ if (this.cache.has(key)) {
3967
+ this.cache.delete(key);
3968
+ } else if (this.cache.size >= this.capacity) {
3969
+ this.cache.delete(this.cache.keys().next().value);
3970
+ }
3971
+ this.cache.set(key, value);
3972
+ }
3973
+ has(key) {
3974
+ return this.cache.has(key);
3975
+ }
3976
+ }
3948
3977
  const inBrowser$1 = typeof document !== "undefined" && !!document.scripts;
3949
3978
  function isWindow(val) {
3950
3979
  return val === window;
@@ -3975,6 +4004,7 @@ const getRect = (elementRef) => {
3975
4004
  height: 0
3976
4005
  };
3977
4006
  };
4007
+ const lru = new MiniLru(10);
3978
4008
  function makeRect(width, height) {
3979
4009
  return {
3980
4010
  top: 0,
@@ -3991,7 +4021,14 @@ const getRectByTaro = async (element) => {
3991
4021
  return Promise.resolve(getRect(element));
3992
4022
  }
3993
4023
  return new Promise((resolve, reject) => {
4024
+ if (lru.has(element)) {
4025
+ resolve(lru.get(element));
4026
+ return;
4027
+ }
3994
4028
  createSelectorQuery().select(`#${element.uid}`).boundingClientRect().exec(([rects]) => {
4029
+ if (rects) {
4030
+ lru.set(element, rects);
4031
+ }
3995
4032
  resolve(rects);
3996
4033
  });
3997
4034
  });
@@ -13124,7 +13161,7 @@ const InternalUploader = (props, ref) => {
13124
13161
  document.body.appendChild(obj);
13125
13162
  }
13126
13163
  }
13127
- if ((getEnv() === "WEAPP" || getEnv() === "JD") && chooseMedia) {
13164
+ if (["WEAPP", "JD", "WEB"].includes(getEnv()) && chooseMedia) {
13128
13165
  chooseMedia({
13129
13166
  count: multiple ? maxCount * 1 - fileList.length : 1,
13130
13167
  /** 文件类型 */
@@ -13779,22 +13816,23 @@ const Drag = (props) => {
13779
13816
  const translateY = useRef(0);
13780
13817
  const middleLine = useRef(0);
13781
13818
  const getInfo = async () => {
13782
- var _a;
13783
13819
  const el = myDrag.current;
13784
13820
  if (el) {
13785
13821
  const { top, left: left2, bottom, right: right2 } = boundary;
13786
13822
  const { screenWidth, windowHeight } = getSystemInfoSync();
13787
- const { width, height } = await getRectByTaro(dragRef.current);
13788
- (_a = dragRef.current) == null ? void 0 : _a.getBoundingClientRect();
13789
- createSelectorQuery().select(`.${className}`).boundingClientRect((rec) => {
13790
- setBoundaryState({
13791
- top: -rec.top + top,
13792
- left: -rec.left + left2,
13793
- bottom: windowHeight - rec.top - bottom - Math.ceil(height),
13794
- right: screenWidth - rec.left - right2 - Math.ceil(width)
13795
- });
13796
- middleLine.current = screenWidth - rec.width - rec.left - (screenWidth - rec.width) / 2;
13797
- }).exec();
13823
+ const {
13824
+ width,
13825
+ height,
13826
+ top: dragTop,
13827
+ left: dragLeft
13828
+ } = await getRectByTaro(dragRef.current);
13829
+ setBoundaryState({
13830
+ top: -dragTop + top,
13831
+ left: -dragLeft + left2,
13832
+ bottom: windowHeight - dragTop - bottom - Math.ceil(height),
13833
+ right: screenWidth - dragLeft - right2 - Math.ceil(width)
13834
+ });
13835
+ middleLine.current = screenWidth - width - dragLeft - (screenWidth - width) / 2;
13798
13836
  }
13799
13837
  };
13800
13838
  const touchStart = (e2) => {
@@ -2,7 +2,7 @@
2
2
  typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("@tarojs/taro"), require("@tarojs/components"), require("react-dom")) : typeof define === "function" && define.amd ? define(["exports", "react", "@tarojs/taro", "@tarojs/components", "react-dom"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory((global2.nutui = global2.nutui || {}, global2.nutui.react = {}), global2.React, global2.Taro, global2.components, global2.ReactDOM));
3
3
  })(this, function(exports2, React, Taro, components, ReactDOM) {
4
4
  "use strict";/*!
5
- * @nutui/nutui-react-taro v2.7.3 Fri Dec 13 2024 15:47:49 GMT+0800 (China Standard Time)
5
+ * @nutui/nutui-react-taro v2.7.5 Fri Jan 03 2025 17:31:45 GMT+0800 (China Standard Time)
6
6
  * (c) 2023 @jdf2e.
7
7
  * Released under the MIT License.
8
8
  */
@@ -3961,6 +3961,35 @@
3961
3961
  stop.current = true;
3962
3962
  };
3963
3963
  }
3964
+ class MiniLru {
3965
+ constructor(capacity) {
3966
+ if (capacity <= 0) {
3967
+ throw new Error("Cache capacity must be a positive number");
3968
+ }
3969
+ this.cache = /* @__PURE__ */ new Map();
3970
+ this.capacity = capacity;
3971
+ }
3972
+ get(key) {
3973
+ if (this.cache.has(key)) {
3974
+ const value = this.cache.get(key);
3975
+ this.cache.delete(key);
3976
+ this.cache.set(key, value);
3977
+ return value;
3978
+ }
3979
+ return null;
3980
+ }
3981
+ set(key, value) {
3982
+ if (this.cache.has(key)) {
3983
+ this.cache.delete(key);
3984
+ } else if (this.cache.size >= this.capacity) {
3985
+ this.cache.delete(this.cache.keys().next().value);
3986
+ }
3987
+ this.cache.set(key, value);
3988
+ }
3989
+ has(key) {
3990
+ return this.cache.has(key);
3991
+ }
3992
+ }
3964
3993
  const inBrowser$1 = typeof document !== "undefined" && !!document.scripts;
3965
3994
  function isWindow(val) {
3966
3995
  return val === window;
@@ -3991,6 +4020,7 @@
3991
4020
  height: 0
3992
4021
  };
3993
4022
  };
4023
+ const lru = new MiniLru(10);
3994
4024
  function makeRect(width, height) {
3995
4025
  return {
3996
4026
  top: 0,
@@ -4007,7 +4037,14 @@
4007
4037
  return Promise.resolve(getRect(element));
4008
4038
  }
4009
4039
  return new Promise((resolve, reject) => {
4040
+ if (lru.has(element)) {
4041
+ resolve(lru.get(element));
4042
+ return;
4043
+ }
4010
4044
  Taro.createSelectorQuery().select(`#${element.uid}`).boundingClientRect().exec(([rects]) => {
4045
+ if (rects) {
4046
+ lru.set(element, rects);
4047
+ }
4011
4048
  resolve(rects);
4012
4049
  });
4013
4050
  });
@@ -13140,7 +13177,7 @@
13140
13177
  document.body.appendChild(obj);
13141
13178
  }
13142
13179
  }
13143
- if ((Taro.getEnv() === "WEAPP" || Taro.getEnv() === "JD") && Taro.chooseMedia) {
13180
+ if (["WEAPP", "JD", "WEB"].includes(Taro.getEnv()) && Taro.chooseMedia) {
13144
13181
  Taro.chooseMedia({
13145
13182
  count: multiple ? maxCount * 1 - fileList.length : 1,
13146
13183
  /** 文件类型 */
@@ -13795,22 +13832,23 @@
13795
13832
  const translateY = React.useRef(0);
13796
13833
  const middleLine = React.useRef(0);
13797
13834
  const getInfo = async () => {
13798
- var _a;
13799
13835
  const el = myDrag.current;
13800
13836
  if (el) {
13801
13837
  const { top, left: left2, bottom, right: right2 } = boundary;
13802
13838
  const { screenWidth, windowHeight } = Taro.getSystemInfoSync();
13803
- const { width, height } = await getRectByTaro(dragRef.current);
13804
- (_a = dragRef.current) == null ? void 0 : _a.getBoundingClientRect();
13805
- Taro.createSelectorQuery().select(`.${className}`).boundingClientRect((rec) => {
13806
- setBoundaryState({
13807
- top: -rec.top + top,
13808
- left: -rec.left + left2,
13809
- bottom: windowHeight - rec.top - bottom - Math.ceil(height),
13810
- right: screenWidth - rec.left - right2 - Math.ceil(width)
13811
- });
13812
- middleLine.current = screenWidth - rec.width - rec.left - (screenWidth - rec.width) / 2;
13813
- }).exec();
13839
+ const {
13840
+ width,
13841
+ height,
13842
+ top: dragTop,
13843
+ left: dragLeft
13844
+ } = await getRectByTaro(dragRef.current);
13845
+ setBoundaryState({
13846
+ top: -dragTop + top,
13847
+ left: -dragLeft + left2,
13848
+ bottom: windowHeight - dragTop - bottom - Math.ceil(height),
13849
+ right: screenWidth - dragLeft - right2 - Math.ceil(width)
13850
+ });
13851
+ middleLine.current = screenWidth - width - dragLeft - (screenWidth - width) / 2;
13814
13852
  }
13815
13853
  };
13816
13854
  const touchStart = (e2) => {
@@ -25,7 +25,7 @@
25
25
  display: flex;
26
26
  height: 80%;
27
27
  align-items: flex-end;
28
- color: $countup-bg-color;
28
+ color: $countup-separator-color;
29
29
  }
30
30
 
31
31
  &-number {
@@ -10,5 +10,6 @@
10
10
  display: inline-flex;
11
11
  width: fit-content;
12
12
  height: fit-content;
13
+ touch-action: none;
13
14
  }
14
15
  }
@@ -26,7 +26,7 @@
26
26
  left: -0.8em;
27
27
  }
28
28
  .nut-form-item-labeltxt {
29
- font-size: 12px;
29
+ font-size: $form-item-label-font-size;
30
30
  height: 10px;
31
31
  position: relative;
32
32
  }
@@ -1,8 +1,9 @@
1
1
  .nut-textarea {
2
+ display: flex;
3
+ flex-direction: column;
2
4
  position: relative;
3
5
  width: 100%;
4
6
  box-sizing: border-box;
5
- display: flex;
6
7
  background: $color-background-overlay;
7
8
  font-size: $textarea-font;
8
9
  padding: $textarea-padding;
@@ -16,11 +17,9 @@
16
17
  }
17
18
 
18
19
  &-limit {
19
- position: absolute;
20
- right: 15px;
21
- bottom: 12px;
22
20
  font-size: $textarea-font;
23
21
  color: $textarea-limit-color;
22
+ text-align: $textarea-limit-align;
24
23
  }
25
24
 
26
25
  &-textarea {