uiw 4.21.11 → 4.21.12

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.
package/dist/uiw.js CHANGED
@@ -4597,7 +4597,6 @@ var SubMenu = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_am
4597
4597
  };
4598
4598
  var popupRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
4599
4599
  var refNode = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef();
4600
- var currentHeight = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(0);
4601
4600
  var elementSource = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef();
4602
4601
  var [isOpen, setIsOpen] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(!!overlayProps.isOpen);
4603
4602
  var {
@@ -4607,11 +4606,15 @@ var SubMenu = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_am
4607
4606
  } = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(ThemeContext);
4608
4607
  external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(() => {
4609
4608
  if (refNode.current && refNode.current.style && ele === elementSource.current) {
4610
- var _currentHeight = refNode.current.style.height;
4611
- if (height + 'px' === _currentHeight) return;
4612
- refNode.current.style.height = Number(_currentHeight.substr(0, _currentHeight.length - 2)) + height + 'px';
4609
+ var currentHeight = Number(refNode.current.style.height.substr(0, refNode.current.style.height.length - 2)); // 设置的高度 < '已有展开的高度',
4610
+
4611
+ if (refNode.current.getBoundingClientRect().height < currentHeight) {
4612
+ refNode.current.style.height = currentHeight + 'px';
4613
+ } else {
4614
+ refNode.current.style.height = currentHeight + height + 'px';
4615
+ }
4613
4616
  }
4614
- }, [height]);
4617
+ }, [height, ele]);
4615
4618
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
4616
4619
  if (collapse) setIsOpen(false);
4617
4620
  }, [collapse]);
@@ -4628,25 +4631,12 @@ var SubMenu = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_am
4628
4631
  }
4629
4632
  }
4630
4633
 
4631
- function onExit(node) {
4632
- node.style.height = node.scrollHeight + "px";
4633
- setIsOpen(false);
4634
- }
4635
-
4636
- function onExiting(node) {
4637
- node.style.height = '0px';
4638
- setContextHeight({
4639
- height: -currentHeight.current,
4640
- ele: elementSource.current
4641
- });
4642
- }
4643
-
4644
4634
  function onEnter(node) {
4645
- node.style.height = '1px';
4635
+ node.style.height = '0px';
4636
+ refNode.current = node;
4646
4637
  setIsOpen(true);
4647
- currentHeight.current = popupRef.current.overlayDom.current.getBoundingClientRect().height;
4648
4638
  setContextHeight({
4649
- height: currentHeight.current,
4639
+ height: popupRef.current.overlayDom.current.getBoundingClientRect().height,
4650
4640
  ele: elementSource.current
4651
4641
  });
4652
4642
  }
@@ -4657,8 +4647,20 @@ var SubMenu = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_am
4657
4647
 
4658
4648
  function onEntered(node) {
4659
4649
  // node.style.height = 'initial';
4660
- node.style.height = currentHeight.current + 'px';
4661
- refNode.current = node;
4650
+ node.style.height = popupRef.current.overlayDom.current.getBoundingClientRect().height + 'px';
4651
+ }
4652
+
4653
+ function onExiting(node) {
4654
+ node.style.height = '0px';
4655
+ setContextHeight({
4656
+ height: -popupRef.current.overlayDom.current.getBoundingClientRect().height,
4657
+ ele: elementSource.current
4658
+ });
4659
+ }
4660
+
4661
+ function onExit(node) {
4662
+ node.style.height = node.scrollHeight + "px";
4663
+ setIsOpen(false);
4662
4664
  }
4663
4665
 
4664
4666
  if (!collapse) {