@nutui/nutui-react 2.0.18 → 2.0.19-beta.1

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.
@@ -9,7 +9,7 @@ var __publicField = (obj, key, value) => {
9
9
  return value;
10
10
  };
11
11
  /*!
12
- * @nutui/nutui-react v2.0.18 Wed Sep 20 2023 15:07:55 GMT+0800 (China Standard Time)
12
+ * @nutui/nutui-react v2.0.19-beta.1 Tue Sep 26 2023 19:08:13 GMT+0800 (China Standard Time)
13
13
  * (c) 2023 @jdf2e.
14
14
  * Released under the MIT License.
15
15
  */
@@ -17389,7 +17389,8 @@ Please add \`${key}Action\` when creating your handler.`);
17389
17389
  }, [showPopup]);
17390
17390
  React.useImperativeHandle(ref, () => ({
17391
17391
  toggle: (s) => {
17392
- s ? parent.toggleMenuItem(index) : parent.hideMenuItem(index);
17392
+ const from = "REF";
17393
+ s ? parent.toggleMenuItem(index, from) : parent.hideMenuItem(index, from);
17393
17394
  }
17394
17395
  }));
17395
17396
  const getIconCName = (optionVal, value2) => {
@@ -17431,10 +17432,12 @@ Please add \`${key}Action\` when creating your handler.`);
17431
17432
  });
17432
17433
  };
17433
17434
  React.useEffect(() => {
17434
- scrollParent == null ? void 0 : scrollParent.addEventListener("scroll", getParentOffset, false);
17435
- return () => {
17436
- scrollParent == null ? void 0 : scrollParent.removeEventListener("scroll", getParentOffset, false);
17437
- };
17435
+ if (!parent.lockScroll) {
17436
+ scrollParent == null ? void 0 : scrollParent.addEventListener("scroll", getParentOffset, false);
17437
+ return () => {
17438
+ scrollParent == null ? void 0 : scrollParent.removeEventListener("scroll", getParentOffset, false);
17439
+ };
17440
+ }
17438
17441
  }, []);
17439
17442
  const getPosition = () => {
17440
17443
  return direction === "down" ? {
@@ -17476,7 +17479,7 @@ Please add \`${key}Action\` when creating your handler.`);
17476
17479
  visible: showPopup,
17477
17480
  closeOnOverlayClick: parent.closeOnOverlayClick,
17478
17481
  onClick: () => {
17479
- parent.closeOnOverlayClick && parent.toggleMenuItem(index);
17482
+ parent.closeOnOverlayClick && parent.hideMenuItem(index);
17480
17483
  }
17481
17484
  }
17482
17485
  ) : null,
@@ -17547,9 +17550,9 @@ Please add \`${key}Action\` when creating your handler.`);
17547
17550
  lockScroll: true,
17548
17551
  overlay: true,
17549
17552
  icon: null,
17550
- onOpen: (index) => {
17553
+ onOpen: (index, from) => {
17551
17554
  },
17552
- onClose: (index) => {
17555
+ onClose: (index, from) => {
17553
17556
  }
17554
17557
  };
17555
17558
  const Menu = (props) => {
@@ -17588,22 +17591,22 @@ Please add \`${key}Action\` when creating your handler.`);
17588
17591
  }, []);
17589
17592
  const [showMenuItem, setShowMenuItem] = React.useState([]);
17590
17593
  const [menuItemTitle, setMenuItemTitle] = React.useState([]);
17591
- const toggleMenuItem = (index) => {
17594
+ const toggleMenuItem = (index, from = "NORMAL") => {
17592
17595
  showMenuItem[index] = !showMenuItem[index];
17593
17596
  if (showMenuItem[index]) {
17594
- onOpen && onOpen(index);
17597
+ onOpen && onOpen(index, from);
17595
17598
  } else {
17596
- onClose && onClose(index);
17599
+ onClose && onClose(index, from);
17597
17600
  }
17598
17601
  const temp = showMenuItem.map(
17599
17602
  (i, idx) => idx === index ? i : false
17600
17603
  );
17601
17604
  setShowMenuItem([...temp]);
17602
17605
  };
17603
- const hideMenuItem = (index) => {
17606
+ const hideMenuItem = (index, from = "NORMAL") => {
17604
17607
  showMenuItem[index] = false;
17605
17608
  setShowMenuItem([...showMenuItem]);
17606
- onClose && onClose(index);
17609
+ onClose && onClose(index, from);
17607
17610
  };
17608
17611
  const updateTitle = (text, index) => {
17609
17612
  menuItemTitle[index] = text;
@@ -23192,7 +23195,7 @@ Please add \`${key}Action\` when creating your handler.`);
23192
23195
  }
23193
23196
  return childs;
23194
23197
  };
23195
- return /* @__PURE__ */ React.createElement("div", { className: classNames(classes, className), ...rest }, renderElement());
23198
+ return /* @__PURE__ */ React.createElement("div", { className: classNames(classPrefix$2, classes, className), ...rest }, renderElement());
23196
23199
  };
23197
23200
  Indicator.defaultProps = defaultProps$h;
23198
23201
  Indicator.displayName = "NutIndicator";
@@ -23692,7 +23695,9 @@ Please add \`${key}Action\` when creating your handler.`);
23692
23695
  });
23693
23696
  const [showPop, setShowPop] = React.useState(visible);
23694
23697
  const [active, setActive] = React.useState(0);
23695
- const [maxNo] = React.useState((images == null ? void 0 : images.length) || 0 + ((videos == null ? void 0 : videos.length) || 0));
23698
+ const [maxNo, setMaxNo] = React.useState(
23699
+ (images == null ? void 0 : images.length) || 0 + ((videos == null ? void 0 : videos.length) || 0)
23700
+ );
23696
23701
  const [store, setStore] = React.useState({
23697
23702
  scale: 1,
23698
23703
  moveable: false
@@ -23781,6 +23786,9 @@ Please add \`${key}Action\` when creating your handler.`);
23781
23786
  React.useEffect(() => {
23782
23787
  setActive(innerNo);
23783
23788
  }, [innerNo]);
23789
+ React.useEffect(() => {
23790
+ setMaxNo((images == null ? void 0 : images.length) || 0 + ((videos == null ? void 0 : videos.length) || 0));
23791
+ }, [images, videos]);
23784
23792
  const scaleNow = () => {
23785
23793
  if (ref.current) {
23786
23794
  ref.current.style.transform = `scale(${store.scale})`;
@@ -23797,7 +23805,7 @@ Please add \`${key}Action\` when creating your handler.`);
23797
23805
  };
23798
23806
  const onCloseInner = () => {
23799
23807
  setShowPop(false);
23800
- setActive(1);
23808
+ setActive(innerNo);
23801
23809
  scaleNow();
23802
23810
  onClose && onClose();
23803
23811
  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;