shineout 3.8.4-beta.9 → 3.8.5-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.
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.8.4-beta.9'
525
+ version: '3.8.5-beta.1'
526
526
  };
package/dist/shineout.js CHANGED
@@ -12386,7 +12386,7 @@ var handleStyle = function handleStyle(style) {
12386
12386
  };
12387
12387
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12388
12388
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12389
- /* harmony default export */ var version = ('3.8.4-beta.9');
12389
+ /* harmony default export */ var version = ('3.8.5-beta.1');
12390
12390
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12391
12391
 
12392
12392
 
@@ -49388,7 +49388,8 @@ function _ReactUnmount() {
49388
49388
 
49389
49389
  var hasMask = false;
49390
49390
  var modal_content_config = {
49391
- instanceIds: []
49391
+ instanceIds: [],
49392
+ originDocumentStyle: null
49392
49393
  };
49393
49394
  var modal_content_state = createWithHooks(modal_content_config);
49394
49395
  var useModalConfig = function useModalConfig() {
@@ -49405,6 +49406,12 @@ var removeModalInstance = function removeModalInstance(instanceId) {
49405
49406
  var getInstanceIds = function getInstanceIds() {
49406
49407
  return modal_content_state.mutate.instanceIds;
49407
49408
  };
49409
+ var setOriginDocumentStyle = function setOriginDocumentStyle(style) {
49410
+ modal_content_state.mutate.originDocumentStyle = style;
49411
+ };
49412
+ var getOriginDocumentStyle = function getOriginDocumentStyle() {
49413
+ return modal_content_state.mutate.originDocumentStyle;
49414
+ };
49408
49415
  var mousePosition = null;
49409
49416
  var getClickPosition = function getClickPosition(e) {
49410
49417
  mousePosition = {
@@ -49447,7 +49454,6 @@ var Modal = function Modal(props) {
49447
49454
  mouseDownTarget: null,
49448
49455
  mouseUpTarget: null,
49449
49456
  content: null,
49450
- originDocumentStyle: null,
49451
49457
  instanceId: generateUUID()
49452
49458
  }),
49453
49459
  context = _useRef.current;
@@ -49562,15 +49568,16 @@ var Modal = function Modal(props) {
49562
49568
  setAnimation(true);
49563
49569
  }
49564
49570
  }, [props.visible]);
49571
+ var originDocumentStyle = getOriginDocumentStyle();
49565
49572
 
49566
49573
  // 设置 document.body.style.overflow 和 document.body.style.paddingRight,并记录原始值到 context 中
49567
49574
  var setDocumentOverflow = usePersistFn(function () {
49568
49575
  var doc = document.body.parentNode;
49569
- if (context.isMask && !context.originDocumentStyle) {
49570
- context.originDocumentStyle = {
49576
+ if (context.isMask && !originDocumentStyle) {
49577
+ setOriginDocumentStyle({
49571
49578
  overflow: doc.style.overflow,
49572
49579
  paddingRight: doc.style.paddingRight
49573
- };
49580
+ });
49574
49581
  }
49575
49582
  doc.style.overflow = 'hidden';
49576
49583
  if (!doc.style.paddingRight) {
@@ -49581,9 +49588,10 @@ var Modal = function Modal(props) {
49581
49588
  // 还原 document.body.style.overflow 和 document.body.style.paddingRight
49582
49589
  var resetDocumentOverflow = usePersistFn(function () {
49583
49590
  var doc = document.body.parentNode;
49584
- if (context.originDocumentStyle) {
49585
- doc.style.overflow = context.originDocumentStyle.overflow;
49586
- doc.style.paddingRight = context.originDocumentStyle.paddingRight;
49591
+ // originDocumentStyle放到全局管理后,多个modal连续打开关闭场景下,可以正确还原
49592
+ if (originDocumentStyle) {
49593
+ doc.style.overflow = originDocumentStyle.overflow;
49594
+ doc.style.paddingRight = originDocumentStyle.paddingRight;
49587
49595
  }
49588
49596
  });
49589
49597
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
@@ -73279,7 +73287,7 @@ var upload_interface = __webpack_require__(8821);
73279
73287
 
73280
73288
 
73281
73289
  /* harmony default export */ var src_0 = ({
73282
- version: '3.8.4-beta.9'
73290
+ version: '3.8.5-beta.1'
73283
73291
  });
73284
73292
  }();
73285
73293
  /******/ return __webpack_exports__;