@mw-kit/mw-ui 1.7.76 → 1.7.77

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.
@@ -653,14 +653,18 @@ var AbsoluteContainer = React__default.forwardRef(function (props, fowardedRef)
653
653
  setRef = _useState[1];
654
654
 
655
655
  var getPosition = useCallback(function () {
656
+ if (props.position) return props.position;
656
657
  if (!ref) return null;
657
658
 
658
- var _ref = boundRef ? {
659
- offsetTop: boundRef.offsetTop,
660
- offsetLeft: boundRef.offsetLeft,
661
- width: boundRef.offsetWidth,
662
- height: boundRef.offsetHeight
663
- } : {
659
+ var _ref = boundRef ? function () {
660
+ var rect = boundRef.getBoundingClientRect();
661
+ return {
662
+ offsetTop: rect.top,
663
+ offsetLeft: rect.left,
664
+ width: boundRef.offsetWidth,
665
+ height: boundRef.offsetHeight
666
+ };
667
+ }() : {
664
668
  offsetTop: 0,
665
669
  offsetLeft: 0,
666
670
  width: window.innerWidth,
@@ -691,9 +695,9 @@ var AbsoluteContainer = React__default.forwardRef(function (props, fowardedRef)
691
695
 
692
696
  return _newPosition;
693
697
  }
694
- }, [ref, boundRef]);
698
+ }, [ref, boundRef, props.position]);
695
699
 
696
- var _useState2 = useState(props.position || getPosition),
700
+ var _useState2 = useState(getPosition),
697
701
  position = _useState2[0],
698
702
  setPosition = _useState2[1];
699
703
 
@@ -701,7 +705,6 @@ var AbsoluteContainer = React__default.forwardRef(function (props, fowardedRef)
701
705
  return ref;
702
706
  });
703
707
  useEffect(function () {
704
- if (props.position) return;
705
708
  setPosition(getPosition);
706
709
  }, [getPosition]);
707
710
  var htmlProps = filterObject(props, ['center', 'position', 'children', 'content']);