@nutui/nutui-react-taro 2.0.18 → 2.0.19-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 (41) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/esm/Audio/style/style.css +1 -1
  3. package/dist/esm/Button/style/style.css +1 -1
  4. package/dist/esm/Dialog/style/style.css +1 -1
  5. package/dist/esm/ImagePreview/style/style.css +1 -1
  6. package/dist/esm/ImagePreview.js +2 -2
  7. package/dist/esm/Indicator/style/style.css +1 -1
  8. package/dist/esm/Indicator.js +1 -1
  9. package/dist/esm/Input/style/style.css +1 -1
  10. package/dist/esm/Menu.js +2 -2
  11. package/dist/esm/MenuItem.js +1 -1
  12. package/dist/esm/Swiper/style/style.css +1 -1
  13. package/dist/esm/Swiper.js +7 -3
  14. package/dist/esm/{imagepreview.taro-87d85d88.js → imagepreview.taro-78c0a7b8.js} +5 -2
  15. package/dist/esm/{indicator.taro-4ed0d6da.js → indicator.taro-092f9f4e.js} +1 -1
  16. package/dist/esm/{menu.taro-cc93f12a.js → menu.taro-f419b9ef.js} +8 -8
  17. package/dist/esm/{menuitem.taro-69a45abd.js → menuitem.taro-d598a86e.js} +3 -2
  18. package/dist/esm/nutui-react.es.js +4 -4
  19. package/dist/esm/types/src/packages/menu/index.d.ts +1 -1
  20. package/dist/esm/types/src/packages/menu/index.taro.d.ts +1 -1
  21. package/dist/esm/types/src/packages/menu/menu.d.ts +4 -2
  22. package/dist/esm/types/src/packages/menu/menu.taro.d.ts +4 -2
  23. package/dist/esm/types/src/packages/swiper/swiper.taro.d.ts +1 -0
  24. package/dist/locales/base.js +1 -1
  25. package/dist/locales/en-US.js +1 -1
  26. package/dist/locales/id-ID.js +1 -1
  27. package/dist/locales/tr-TR.js +1 -1
  28. package/dist/locales/zh-CN.js +1 -1
  29. package/dist/locales/zh-TW.js +1 -1
  30. package/dist/locales/zh-UG.js +1 -1
  31. package/dist/nutui.react.es.js +25 -14
  32. package/dist/nutui.react.umd.js +25 -14
  33. package/dist/packages/button/button.scss +1 -1
  34. package/dist/packages/indicator/indicator.scss +5 -0
  35. package/dist/packages/input/input.scss +1 -0
  36. package/dist/style.css +1 -1
  37. package/dist/style.mjs +1 -1
  38. package/dist/types/packages/menu/index.taro.d.ts +1 -1
  39. package/dist/types/packages/menu/menu.taro.d.ts +4 -2
  40. package/dist/types/packages/swiper/swiper.taro.d.ts +5 -0
  41. package/package.json +1 -1
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  /*!
8
- * @nutui/nutui-react-taro v2.0.18 Wed Sep 20 2023 14:56:58 GMT+0800 (China Standard Time)
8
+ * @nutui/nutui-react-taro v2.0.19-beta.0 Mon Sep 25 2023 18:03:38 GMT+0800 (China Standard Time)
9
9
  * (c) 2023 @jdf2e.
10
10
  * Released under the MIT License.
11
11
  */
@@ -11807,7 +11807,8 @@ const MenuItem = forwardRef((props, ref) => {
11807
11807
  usePageScroll(updateItemOffset);
11808
11808
  useImperativeHandle(ref, () => ({
11809
11809
  toggle: (s) => {
11810
- s ? parent.toggleMenuItem(index) : parent.hideMenuItem(index);
11810
+ const from = "REF";
11811
+ s ? parent.toggleMenuItem(index, from) : parent.hideMenuItem(index, from);
11811
11812
  }
11812
11813
  }));
11813
11814
  const getIconCName = (optionVal, value2) => {
@@ -11887,7 +11888,7 @@ const MenuItem = forwardRef((props, ref) => {
11887
11888
  visible: showPopup,
11888
11889
  closeOnOverlayClick: parent.closeOnOverlayClick,
11889
11890
  onClick: () => {
11890
- parent.closeOnOverlayClick && parent.toggleMenuItem(index);
11891
+ parent.closeOnOverlayClick && parent.hideMenuItem(index);
11891
11892
  }
11892
11893
  }
11893
11894
  ) : null, /* @__PURE__ */ React__default.createElement(
@@ -11957,9 +11958,9 @@ const defaultProps$T = {
11957
11958
  lockScroll: true,
11958
11959
  overlay: true,
11959
11960
  icon: null,
11960
- onOpen: (index) => {
11961
+ onOpen: (index, from) => {
11961
11962
  },
11962
- onClose: (index) => {
11963
+ onClose: (index, from) => {
11963
11964
  }
11964
11965
  };
11965
11966
  const Menu = (props) => {
@@ -11998,22 +11999,22 @@ const Menu = (props) => {
11998
11999
  }, []);
11999
12000
  const [showMenuItem, setShowMenuItem] = useState([]);
12000
12001
  const [menuItemTitle, setMenuItemTitle] = useState([]);
12001
- const toggleMenuItem = (index) => {
12002
+ const toggleMenuItem = (index, from = "NORMAL") => {
12002
12003
  showMenuItem[index] = !showMenuItem[index];
12003
12004
  if (showMenuItem[index]) {
12004
- onOpen && onOpen(index);
12005
+ onOpen && onOpen(index, from);
12005
12006
  } else {
12006
- onClose && onClose(index);
12007
+ onClose && onClose(index, from);
12007
12008
  }
12008
12009
  const temp = showMenuItem.map(
12009
12010
  (i, idx) => idx === index ? i : false
12010
12011
  );
12011
12012
  setShowMenuItem([...temp]);
12012
12013
  };
12013
- const hideMenuItem = (index) => {
12014
+ const hideMenuItem = (index, from = "NORMAL") => {
12014
12015
  showMenuItem[index] = false;
12015
12016
  setShowMenuItem([...showMenuItem]);
12016
- onClose && onClose(index);
12017
+ onClose && onClose(index, from);
12017
12018
  };
12018
12019
  const updateTitle = (text, index) => {
12019
12020
  menuItemTitle[index] = text;
@@ -17464,7 +17465,7 @@ const Indicator = (props) => {
17464
17465
  }
17465
17466
  return childs;
17466
17467
  };
17467
- return /* @__PURE__ */ React__default.createElement("div", { className: classNames(classes, className), ...rest }, renderElement());
17468
+ return /* @__PURE__ */ React__default.createElement("div", { className: classNames(classPrefix$4, classes, className), ...rest }, renderElement());
17468
17469
  };
17469
17470
  Indicator.defaultProps = defaultProps$i;
17470
17471
  Indicator.displayName = "NutIndicator";
@@ -17488,6 +17489,7 @@ const Swiper = forwardRef((props, ref) => {
17488
17489
  duration,
17489
17490
  direction,
17490
17491
  defaultValue,
17492
+ onChange,
17491
17493
  ...rest
17492
17494
  } = {
17493
17495
  ...defaultProps$h,
@@ -17572,7 +17574,11 @@ const Swiper = forwardRef((props, ref) => {
17572
17574
  autoplay: autoPlay,
17573
17575
  vertical: direction === "vertical",
17574
17576
  indicatorDots: false,
17575
- onChange: handleOnChange,
17577
+ onChange: (e) => {
17578
+ var _a;
17579
+ handleOnChange(e);
17580
+ (_a = props.onChange) == null ? void 0 : _a.call(props, e);
17581
+ },
17576
17582
  style: {
17577
17583
  width: !width ? "100%" : `${width}px`,
17578
17584
  height: !height ? "150px" : `${height}px`
@@ -17641,7 +17647,9 @@ const ImagePreview = (props) => {
17641
17647
  });
17642
17648
  const [showPop, setShowPop] = useState(visible);
17643
17649
  const [active, setActive] = useState(0);
17644
- const [maxNo] = useState((images == null ? void 0 : images.length) || 0 + ((videos == null ? void 0 : videos.length) || 0));
17650
+ const [maxNo, setMaxNo] = useState(
17651
+ (images == null ? void 0 : images.length) || 0 + ((videos == null ? void 0 : videos.length) || 0)
17652
+ );
17645
17653
  const [store, setStore] = useState({
17646
17654
  scale: 1,
17647
17655
  moveable: false
@@ -17730,6 +17738,9 @@ const ImagePreview = (props) => {
17730
17738
  useEffect(() => {
17731
17739
  setActive(innerNo);
17732
17740
  }, [innerNo]);
17741
+ useEffect(() => {
17742
+ setMaxNo((images == null ? void 0 : images.length) || 0 + ((videos == null ? void 0 : videos.length) || 0));
17743
+ }, [images, videos]);
17733
17744
  const scaleNow = () => {
17734
17745
  if (ref.current) {
17735
17746
  ref.current.style.transform = `scale(${store.scale})`;
@@ -17746,7 +17757,7 @@ const ImagePreview = (props) => {
17746
17757
  };
17747
17758
  const onCloseInner = () => {
17748
17759
  setShowPop(false);
17749
- setActive(1);
17760
+ setActive(innerNo);
17750
17761
  scaleNow();
17751
17762
  onClose && onClose();
17752
17763
  setStore({
@@ -8,7 +8,7 @@ var __publicField = (obj, key, value) => {
8
8
  return value;
9
9
  };
10
10
  /*!
11
- * @nutui/nutui-react-taro v2.0.18 Wed Sep 20 2023 14:56:58 GMT+0800 (China Standard Time)
11
+ * @nutui/nutui-react-taro v2.0.19-beta.0 Mon Sep 25 2023 18:03:38 GMT+0800 (China Standard Time)
12
12
  * (c) 2023 @jdf2e.
13
13
  * Released under the MIT License.
14
14
  */
@@ -11823,7 +11823,8 @@ var __publicField = (obj, key, value) => {
11823
11823
  Taro.usePageScroll(updateItemOffset);
11824
11824
  React.useImperativeHandle(ref, () => ({
11825
11825
  toggle: (s) => {
11826
- s ? parent.toggleMenuItem(index) : parent.hideMenuItem(index);
11826
+ const from = "REF";
11827
+ s ? parent.toggleMenuItem(index, from) : parent.hideMenuItem(index, from);
11827
11828
  }
11828
11829
  }));
11829
11830
  const getIconCName = (optionVal, value2) => {
@@ -11903,7 +11904,7 @@ var __publicField = (obj, key, value) => {
11903
11904
  visible: showPopup,
11904
11905
  closeOnOverlayClick: parent.closeOnOverlayClick,
11905
11906
  onClick: () => {
11906
- parent.closeOnOverlayClick && parent.toggleMenuItem(index);
11907
+ parent.closeOnOverlayClick && parent.hideMenuItem(index);
11907
11908
  }
11908
11909
  }
11909
11910
  ) : null, /* @__PURE__ */ React.createElement(
@@ -11973,9 +11974,9 @@ var __publicField = (obj, key, value) => {
11973
11974
  lockScroll: true,
11974
11975
  overlay: true,
11975
11976
  icon: null,
11976
- onOpen: (index) => {
11977
+ onOpen: (index, from) => {
11977
11978
  },
11978
- onClose: (index) => {
11979
+ onClose: (index, from) => {
11979
11980
  }
11980
11981
  };
11981
11982
  const Menu = (props) => {
@@ -12014,22 +12015,22 @@ var __publicField = (obj, key, value) => {
12014
12015
  }, []);
12015
12016
  const [showMenuItem, setShowMenuItem] = React.useState([]);
12016
12017
  const [menuItemTitle, setMenuItemTitle] = React.useState([]);
12017
- const toggleMenuItem = (index) => {
12018
+ const toggleMenuItem = (index, from = "NORMAL") => {
12018
12019
  showMenuItem[index] = !showMenuItem[index];
12019
12020
  if (showMenuItem[index]) {
12020
- onOpen && onOpen(index);
12021
+ onOpen && onOpen(index, from);
12021
12022
  } else {
12022
- onClose && onClose(index);
12023
+ onClose && onClose(index, from);
12023
12024
  }
12024
12025
  const temp = showMenuItem.map(
12025
12026
  (i, idx) => idx === index ? i : false
12026
12027
  );
12027
12028
  setShowMenuItem([...temp]);
12028
12029
  };
12029
- const hideMenuItem = (index) => {
12030
+ const hideMenuItem = (index, from = "NORMAL") => {
12030
12031
  showMenuItem[index] = false;
12031
12032
  setShowMenuItem([...showMenuItem]);
12032
- onClose && onClose(index);
12033
+ onClose && onClose(index, from);
12033
12034
  };
12034
12035
  const updateTitle = (text, index) => {
12035
12036
  menuItemTitle[index] = text;
@@ -17480,7 +17481,7 @@ var __publicField = (obj, key, value) => {
17480
17481
  }
17481
17482
  return childs;
17482
17483
  };
17483
- return /* @__PURE__ */ React.createElement("div", { className: classNames(classes, className), ...rest }, renderElement());
17484
+ return /* @__PURE__ */ React.createElement("div", { className: classNames(classPrefix$4, classes, className), ...rest }, renderElement());
17484
17485
  };
17485
17486
  Indicator.defaultProps = defaultProps$i;
17486
17487
  Indicator.displayName = "NutIndicator";
@@ -17504,6 +17505,7 @@ var __publicField = (obj, key, value) => {
17504
17505
  duration,
17505
17506
  direction,
17506
17507
  defaultValue,
17508
+ onChange,
17507
17509
  ...rest
17508
17510
  } = {
17509
17511
  ...defaultProps$h,
@@ -17588,7 +17590,11 @@ var __publicField = (obj, key, value) => {
17588
17590
  autoplay: autoPlay,
17589
17591
  vertical: direction === "vertical",
17590
17592
  indicatorDots: false,
17591
- onChange: handleOnChange,
17593
+ onChange: (e) => {
17594
+ var _a;
17595
+ handleOnChange(e);
17596
+ (_a = props.onChange) == null ? void 0 : _a.call(props, e);
17597
+ },
17592
17598
  style: {
17593
17599
  width: !width ? "100%" : `${width}px`,
17594
17600
  height: !height ? "150px" : `${height}px`
@@ -17657,7 +17663,9 @@ var __publicField = (obj, key, value) => {
17657
17663
  });
17658
17664
  const [showPop, setShowPop] = React.useState(visible);
17659
17665
  const [active, setActive] = React.useState(0);
17660
- const [maxNo] = React.useState((images == null ? void 0 : images.length) || 0 + ((videos == null ? void 0 : videos.length) || 0));
17666
+ const [maxNo, setMaxNo] = React.useState(
17667
+ (images == null ? void 0 : images.length) || 0 + ((videos == null ? void 0 : videos.length) || 0)
17668
+ );
17661
17669
  const [store, setStore] = React.useState({
17662
17670
  scale: 1,
17663
17671
  moveable: false
@@ -17746,6 +17754,9 @@ var __publicField = (obj, key, value) => {
17746
17754
  React.useEffect(() => {
17747
17755
  setActive(innerNo);
17748
17756
  }, [innerNo]);
17757
+ React.useEffect(() => {
17758
+ setMaxNo((images == null ? void 0 : images.length) || 0 + ((videos == null ? void 0 : videos.length) || 0));
17759
+ }, [images, videos]);
17749
17760
  const scaleNow = () => {
17750
17761
  if (ref.current) {
17751
17762
  ref.current.style.transform = `scale(${store.scale})`;
@@ -17762,7 +17773,7 @@ var __publicField = (obj, key, value) => {
17762
17773
  };
17763
17774
  const onCloseInner = () => {
17764
17775
  setShowPop(false);
17765
- setActive(1);
17776
+ setActive(innerNo);
17766
17777
  scaleNow();
17767
17778
  onClose && onClose();
17768
17779
  setStore({
@@ -14,7 +14,7 @@
14
14
  -webkit-appearance: none;
15
15
  user-select: none;
16
16
  touch-action: manipulation;
17
-
17
+ -webkit-tap-highlight-color: rgba(0,0,0,0);
18
18
  color: $button-default-color;
19
19
  background: $button-default-bg-color;
20
20
  border: $button-border-width solid $button-default-border-color;
@@ -1,4 +1,9 @@
1
1
  .nut-indicator {
2
+ display: flex;
3
+ width: auto;
4
+ flex-wrap: nowrap;
5
+ align-items: center;
6
+
2
7
  &__dot {
3
8
  margin: 0 $indicator-dot-margin;
4
9
 
@@ -19,6 +19,7 @@
19
19
  width: 100%;
20
20
  color: $gray1;
21
21
  flex: 1;
22
+ background-color: transparent;
22
23
  padding: 0;
23
24
  border: 0;
24
25
  outline: 0 none;