shineout 3.7.2-beta.2 → 3.7.2-beta.3

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.2-beta.2'
525
+ version: '3.7.2-beta.3'
526
526
  };
package/dist/shineout.js CHANGED
@@ -12234,7 +12234,7 @@ var handleStyle = function handleStyle(style) {
12234
12234
  };
12235
12235
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12236
12236
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12237
- /* harmony default export */ var version = ('3.7.2-beta.2');
12237
+ /* harmony default export */ var version = ('3.7.2-beta.3');
12238
12238
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12239
12239
 
12240
12240
 
@@ -48256,7 +48256,11 @@ var Modal = function Modal(props) {
48256
48256
  isMask: false,
48257
48257
  mouseDownTarget: null,
48258
48258
  mouseUpTarget: null,
48259
- content: null
48259
+ content: null,
48260
+ originDocumentStyle: {
48261
+ overflow: '',
48262
+ paddingRight: ''
48263
+ }
48260
48264
  }),
48261
48265
  context = _useRef.current;
48262
48266
  var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(props.visible || props.autoShow),
@@ -48356,18 +48360,33 @@ var Modal = function Modal(props) {
48356
48360
  setAnimation(true);
48357
48361
  }
48358
48362
  }, [props.visible]);
48363
+
48364
+ // 设置 document.body.style.overflow 和 document.body.style.paddingRight,并记录原始值到 context 中
48365
+ var setDocumentOverflow = usePersistFn(function () {
48366
+ var doc = document.body.parentNode;
48367
+ if (context.isMask) {
48368
+ context.originDocumentStyle.overflow = doc.style.overflow;
48369
+ context.originDocumentStyle.paddingRight = doc.style.paddingRight;
48370
+ }
48371
+ doc.style.overflow = 'hidden';
48372
+ if (!doc.style.paddingRight) {
48373
+ doc.style.paddingRight = "".concat(window.innerWidth - docSize.width, "px");
48374
+ }
48375
+ });
48376
+
48377
+ // 还原 document.body.style.overflow 和 document.body.style.paddingRight
48378
+ var resetDocumentOverflow = usePersistFn(function () {
48379
+ var doc = document.body.parentNode;
48380
+ doc.style.overflow = context.originDocumentStyle.overflow;
48381
+ doc.style.paddingRight = context.originDocumentStyle.paddingRight;
48382
+ });
48359
48383
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
48360
48384
  if (!props.hideMask) {
48361
- var doc = document.body.parentNode;
48362
48385
  if (visible) {
48363
- doc.style.overflow = 'hidden';
48364
- if (!doc.style.paddingRight) {
48365
- doc.style.paddingRight = "".concat(window.innerWidth - docSize.width, "px");
48366
- }
48386
+ setDocumentOverflow();
48367
48387
  } else {
48368
48388
  if (!context.isMask) return;
48369
- doc.style.paddingRight = '';
48370
- doc.style.overflow = '';
48389
+ resetDocumentOverflow();
48371
48390
  }
48372
48391
  }
48373
48392
  }, [visible]);
@@ -48381,20 +48400,15 @@ var Modal = function Modal(props) {
48381
48400
  // unmount
48382
48401
  return function () {
48383
48402
  var _props$shouldDestroy2;
48403
+ if (context.isMask) {
48404
+ resetDocumentOverflow();
48405
+ }
48406
+ ;
48384
48407
  (_props$shouldDestroy2 = props.shouldDestroy) === null || _props$shouldDestroy2 === void 0 || _props$shouldDestroy2.call(props, true);
48385
- // if (props.autoShow) {
48386
- // props.onClose?.();
48387
- // }
48388
48408
  if (context.isMask) {
48389
48409
  context.isMask = false;
48390
48410
  hasMask = false;
48391
48411
  }
48392
- {
48393
- if (!context.isMask) return;
48394
- var doc = document.body.parentNode;
48395
- doc.style.paddingRight = '';
48396
- doc.style.overflow = '';
48397
- }
48398
48412
  };
48399
48413
  }, []);
48400
48414
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
@@ -71415,7 +71429,7 @@ var upload_interface = __webpack_require__(8821);
71415
71429
 
71416
71430
 
71417
71431
  /* harmony default export */ var src_0 = ({
71418
- version: '3.7.2-beta.2'
71432
+ version: '3.7.2-beta.3'
71419
71433
  });
71420
71434
  }();
71421
71435
  /******/ return __webpack_exports__;