shineout 3.7.1-beta.4 → 3.7.1-beta.5

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/cjs/index.js CHANGED
@@ -522,5 +522,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
522
522
  // 此文件由脚本自动生成,请勿直接修改。
523
523
  // This file was generated automatically by a script. Please do not modify it directly.
524
524
  var _default = exports.default = {
525
- version: '3.7.1-beta.4'
525
+ version: '3.7.1-beta.5'
526
526
  };
package/dist/shineout.js CHANGED
@@ -12227,7 +12227,7 @@ var handleStyle = function handleStyle(style) {
12227
12227
  };
12228
12228
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12229
12229
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12230
- /* harmony default export */ var version = ('3.7.1-beta.4');
12230
+ /* harmony default export */ var version = ('3.7.1-beta.5');
12231
12231
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12232
12232
 
12233
12233
 
@@ -31017,6 +31017,20 @@ var usePositionStyle = function usePositionStyle(config) {
31017
31017
  var popupElSize = useCheckElementSize(popupElRef, {
31018
31018
  enable: show
31019
31019
  });
31020
+ var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
31021
+ _useState4 = slicedToArray_default()(_useState3, 2),
31022
+ popupElWidth = _useState4[0],
31023
+ setPopupElWidth = _useState4[1];
31024
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
31025
+ if (!show || !popupElRef.current) return;
31026
+ if (popupElRef.current) {
31027
+ // 二次打开弹出层时,元素被之前的动画设置了display: none,重新获取元素尺寸时,需要立即设置display: block
31028
+ if (popupElRef.current.style.display === 'none') {
31029
+ popupElRef.current.style.display = 'block';
31030
+ }
31031
+ setPopupElWidth(popupElRef.current.getBoundingClientRect().width);
31032
+ }
31033
+ }, [show, popupElRef.current]);
31020
31034
  var adjustPosition = function adjustPosition(position) {
31021
31035
  var winHeight = docSize.height;
31022
31036
  if (!verticalPosition.includes(position)) return position;
@@ -31043,6 +31057,14 @@ var usePositionStyle = function usePositionStyle(config) {
31043
31057
  newPosition = newPosition.replace('left', 'right');
31044
31058
  }
31045
31059
  }
31060
+ } else {
31061
+ // absolute 场景下,右侧溢出判断需要考虑弹出层元素的尺寸
31062
+ var _position$split = position.split('-'),
31063
+ _position$split2 = slicedToArray_default()(_position$split, 2),
31064
+ _horizontalPosition = _position$split2[1];
31065
+ if (_horizontalPosition === 'left' && context.parentRect.left + (popupElWidth || context.popUpWidth) > docSize.width) {
31066
+ newPosition = newPosition.replace('left', 'right');
31067
+ }
31046
31068
  }
31047
31069
  return newPosition;
31048
31070
  };
@@ -71310,7 +71332,7 @@ var upload_interface = __webpack_require__(8821);
71310
71332
 
71311
71333
 
71312
71334
  /* harmony default export */ var src_0 = ({
71313
- version: '3.7.1-beta.4'
71335
+ version: '3.7.1-beta.5'
71314
71336
  });
71315
71337
  }();
71316
71338
  /******/ return __webpack_exports__;