@nutui/nutui-react-taro 2.6.14 → 2.6.15-beta.0

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 (31) hide show
  1. package/dist/esm/Calendar.js +1 -1
  2. package/dist/esm/CalendarItem.js +1 -1
  3. package/dist/esm/InfiniteLoading.js +1 -1
  4. package/dist/esm/Sticky.js +1 -1
  5. package/dist/esm/Uploader/style/style.css +1 -1
  6. package/dist/esm/Uploader.js +1 -1
  7. package/dist/esm/WaterMark.js +1 -1
  8. package/dist/esm/{calendar.taro-Bf5owfGd.js → calendar.taro-BXrHr8bg.js} +1 -1
  9. package/dist/esm/{calendaritem.taro-PLHReAvU.js → calendaritem.taro-CRultyrO.js} +3 -1
  10. package/dist/esm/{infiniteloading.taro-DmDQKk_d.js → infiniteloading.taro-TbcBB0Qr.js} +1 -1
  11. package/dist/esm/nutui-react.es.js +6 -6
  12. package/dist/esm/{sticky.taro-DZzgkigZ.js → sticky.taro-Zbz7wQH8.js} +29 -31
  13. package/dist/esm/{uploader.taro-CiamsRGo.js → uploader.taro-DfO2HWvy.js} +13 -11
  14. package/dist/esm/{watermark.taro-BR12yZQt.js → watermark.taro-CZ6R5FlJ.js} +3 -3
  15. package/dist/locales/base.js +1 -1
  16. package/dist/locales/en-US.js +1 -1
  17. package/dist/locales/id-ID.js +1 -1
  18. package/dist/locales/tr-TR.js +1 -1
  19. package/dist/locales/zh-CN.js +1 -1
  20. package/dist/locales/zh-TW.js +1 -1
  21. package/dist/locales/zh-UG.js +1 -1
  22. package/dist/nutui.react.es.js +50 -44
  23. package/dist/nutui.react.umd.js +50 -44
  24. package/dist/packages/uploader/uploader.scss +3 -1
  25. package/dist/style.css +1 -1
  26. package/dist/types/packages/griditem/types.d.ts +13 -0
  27. package/dist/types/packages/watermark/watermark.d.ts +2 -0
  28. package/dist/types/packages/watermark/watermark.taro.d.ts +10 -0
  29. package/dist/types/utils/get-scroll-parent.d.ts +1 -1
  30. package/dist/types/utils/use-client-rect.d.ts +1 -1
  31. package/package.json +1 -1
@@ -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.6.14 Fri Jul 19 2024 16:23:26 GMT+0800 (China Standard Time)
5
+ * @nutui/nutui-react-taro v2.6.14 Wed Jul 24 2024 13:29:51 GMT+0800 (China Standard Time)
6
6
  * (c) 2023 @jdf2e.
7
7
  * Released under the MIT License.
8
8
  */
@@ -3977,13 +3977,10 @@
3977
3977
  width: ""
3978
3978
  };
3979
3979
  }
3980
- const style2 = {};
3981
- if (rootRect.height) {
3982
- style2.height = rootRect.height;
3983
- }
3984
- if (rootRect.width) {
3985
- style2.width = rootRect.width;
3986
- }
3980
+ const style2 = {
3981
+ height: rootRect.height ?? "",
3982
+ width: rootRect.width ?? ""
3983
+ };
3987
3984
  return style2;
3988
3985
  }, [fixed, rootRect.height, rootRect.width]);
3989
3986
  const stickyStyle = React.useMemo(() => {
@@ -3994,36 +3991,37 @@
3994
3991
  [position]: ""
3995
3992
  };
3996
3993
  }
3997
- const style2 = {};
3998
- if (rootRect.height) style2.height = rootRect.height;
3999
- if (rootRect.width) style2.width = rootRect.width;
4000
- style2.transform = `translate3d(0, ${transform}px, 0)`;
4001
- style2[position] = threshold;
4002
- style2.zIndex = zIndex;
3994
+ const style2 = {
3995
+ height: rootRect.height ?? "",
3996
+ width: rootRect.width ?? "",
3997
+ transform: `translate3d(0, ${transform}px, 0)`,
3998
+ [position]: threshold,
3999
+ zIndex
4000
+ };
4003
4001
  return style2;
4004
4002
  }, [fixed, rootRect.height, rootRect.width, transform, position]);
4005
4003
  const handleScroll = async (scrollTop) => {
4006
4004
  const curRootRect = await getRectByTaro(rootRef.current);
4007
4005
  const stickyRect = await getRectByTaro(stickyRef.current);
4008
- if (curRootRect && stickyRect) {
4009
- setRootRect(curRootRect);
4010
- if (position === "top") {
4011
- if (container) {
4012
- const containerRect = await getRectByTaro(container.current);
4013
- const difference = containerRect.bottom - threshold - curRootRect.height;
4014
- const curTransform = difference < 0 ? difference : 0;
4015
- setTransform(curTransform);
4016
- const curFixed = threshold > curRootRect.top && containerRect.bottom > 0;
4017
- setFixed(curFixed);
4018
- } else {
4019
- setFixed(threshold > curRootRect.top);
4020
- }
4006
+ if (!curRootRect || !stickyRect) {
4007
+ console.warn("getRectByTaro获取失败", { stickyRect, curRootRect });
4008
+ return;
4009
+ }
4010
+ setRootRect(curRootRect);
4011
+ if (position === "top") {
4012
+ if (container) {
4013
+ const containerRect = await getRectByTaro(container.current);
4014
+ const difference = containerRect.bottom - threshold - curRootRect.height;
4015
+ const curTransform = difference < 0 ? difference : 0;
4016
+ setTransform(curTransform);
4017
+ const curFixed = threshold > curRootRect.top && containerRect.bottom > 0;
4018
+ setFixed(curFixed);
4021
4019
  } else {
4022
- const windowHeight = Taro.getSystemInfoSync().windowHeight;
4023
- setFixed(windowHeight - threshold < curRootRect.bottom);
4020
+ setFixed(threshold > curRootRect.top);
4024
4021
  }
4025
4022
  } else {
4026
- console.warn("getRectByTaro获取失败", { stickyRect, curRootRect });
4023
+ const windowHeight = Taro.getSystemInfoSync().windowHeight;
4024
+ setFixed(windowHeight - threshold < curRootRect.bottom);
4027
4025
  }
4028
4026
  };
4029
4027
  const getElement = React.useCallback(() => {
@@ -6746,8 +6744,10 @@
6746
6744
  };
6747
6745
  React.useEffect(() => {
6748
6746
  setCurrentDate(resetDefaultValue() || []);
6749
- popup && resetRender();
6750
6747
  }, [defaultValue]);
6748
+ React.useEffect(() => {
6749
+ popup && resetRender();
6750
+ }, [currentDate]);
6751
6751
  const scrollToDate = (date2) => {
6752
6752
  if (Utils.compareDate(date2, propStartDate)) {
6753
6753
  date2 = propStartDate;
@@ -12901,6 +12901,10 @@
12901
12901
  clearUploadQueue();
12902
12902
  }
12903
12903
  }));
12904
+ const fileListRef = React.useRef([]);
12905
+ React.useEffect(() => {
12906
+ fileListRef.current = fileList;
12907
+ }, [fileList]);
12904
12908
  const clearUploadQueue = (index = -1) => {
12905
12909
  if (index > -1) {
12906
12910
  uploadQueue.splice(index, 1);
@@ -12980,7 +12984,7 @@
12980
12984
  uploadOption.onStart = (option) => {
12981
12985
  clearUploadQueue(index);
12982
12986
  setFileList(
12983
- fileList.map((item) => {
12987
+ fileListRef.current.map((item) => {
12984
12988
  if (item.uid === fileItem.uid) {
12985
12989
  item.status = "ready";
12986
12990
  item.message = locale.uploader.readyUpload;
@@ -12988,23 +12992,23 @@
12988
12992
  return item;
12989
12993
  })
12990
12994
  );
12991
- onStart && onStart(option);
12995
+ onStart == null ? void 0 : onStart(option);
12992
12996
  };
12993
12997
  uploadOption.onProgress = (e2, option) => {
12994
12998
  setFileList(
12995
- fileList.map((item) => {
12999
+ fileListRef.current.map((item) => {
12996
13000
  if (item.uid === fileItem.uid) {
12997
13001
  item.status = UPLOADING;
12998
13002
  item.message = locale.uploader.uploading;
12999
13003
  item.percentage = e2.progress;
13000
- onProgress && onProgress({ e: e2, option, percentage: item.percentage });
13004
+ onProgress == null ? void 0 : onProgress({ e: e2, option, percentage: item.percentage });
13001
13005
  }
13002
13006
  return item;
13003
13007
  })
13004
13008
  );
13005
13009
  };
13006
13010
  uploadOption.onSuccess = (responseText, option) => {
13007
- const list = fileList.map((item) => {
13011
+ const list = fileListRef.current.map((item) => {
13008
13012
  if (item.uid === fileItem.uid) {
13009
13013
  item.status = SUCCESS;
13010
13014
  item.message = locale.uploader.success;
@@ -13020,7 +13024,7 @@
13020
13024
  });
13021
13025
  };
13022
13026
  uploadOption.onFailure = (responseText, option) => {
13023
- const list = fileList.map((item) => {
13027
+ const list = fileListRef.current.map((item) => {
13024
13028
  if (item.uid === fileItem.uid) {
13025
13029
  item.status = ERROR;
13026
13030
  item.message = locale.uploader.error;
@@ -13082,8 +13086,8 @@
13082
13086
  if (preview) {
13083
13087
  fileItem.url = fileType === "video" ? file.thumbTempFilePath : filepath;
13084
13088
  }
13085
- setFileList([...fileList, fileItem]);
13086
13089
  executeUpload(fileItem, index);
13090
+ setFileList([...fileList, fileItem]);
13087
13091
  });
13088
13092
  };
13089
13093
  const filterFiles = (files) => {
@@ -13097,9 +13101,7 @@
13097
13101
  }
13098
13102
  return true;
13099
13103
  });
13100
- if (oversizes.length) {
13101
- onOversize && onOversize(files);
13102
- }
13104
+ oversizes.length && (onOversize == null ? void 0 : onOversize(files));
13103
13105
  const currentFileLength = filterFile.length + fileList.length;
13104
13106
  if (currentFileLength > maximum) {
13105
13107
  filterFile.splice(filterFile.length - (currentFileLength - maximum));
@@ -13842,6 +13844,7 @@
13842
13844
  return /* @__PURE__ */ React.createElement(
13843
13845
  components.ScrollView,
13844
13846
  {
13847
+ ...rest,
13845
13848
  className: classes,
13846
13849
  scrollY: true,
13847
13850
  id: "scroller",
@@ -13851,8 +13854,7 @@
13851
13854
  onScrollToLower: lower,
13852
13855
  onTouchStart: touchStart,
13853
13856
  onTouchMove: touchMove,
13854
- onTouchEnd: touchEnd,
13855
- ...rest
13857
+ onTouchEnd: touchEnd
13856
13858
  },
13857
13859
  /* @__PURE__ */ React.createElement("div", { className: "nut-infinite-top", ref: refreshTop, style: getStyle() }, /* @__PURE__ */ React.createElement("div", { className: "nut-infinite-top-tips" }, pullingText || locale.infiniteloading.pullRefreshText)),
13858
13860
  /* @__PURE__ */ React.createElement("div", { className: "nut-infinite-container" }, children),
@@ -18612,6 +18614,8 @@
18612
18614
  gapY: 48,
18613
18615
  width: 120,
18614
18616
  height: 64,
18617
+ startX: 0,
18618
+ startY: 0,
18615
18619
  image: "",
18616
18620
  imageWidth: 120,
18617
18621
  imageHeight: 64,
@@ -18630,6 +18634,8 @@
18630
18634
  className,
18631
18635
  gapX,
18632
18636
  gapY,
18637
+ startX,
18638
+ startY,
18633
18639
  width,
18634
18640
  height,
18635
18641
  image,
@@ -18710,7 +18716,7 @@
18710
18716
  const markSize = Number(fontSize) * ratio;
18711
18717
  ctx.font = `${fontStyle} normal ${fontWeight} ${markSize}px/${markHeight}px ${fontFamily}`;
18712
18718
  ctx.fillStyle = color;
18713
- ctx.fillText(content, 0, 0);
18719
+ ctx.fillText(content, startX, startY);
18714
18720
  ctx.restore();
18715
18721
  setBase64Url(canvas.toDataURL());
18716
18722
  }
@@ -174,7 +174,9 @@
174
174
  }
175
175
 
176
176
  &-c {
177
- width: 100%;
177
+ display: flex;
178
+ justify-content: center;
179
+ align-items: center;
178
180
  height: 100%;
179
181
  position: initial;
180
182
  border-radius: $uploader-image-border-radius;