shineout 3.8.4 → 3.8.5-beta.2

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'
525
+ version: '3.8.5-beta.2'
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');
12389
+ /* harmony default export */ var version = ('3.8.5-beta.2');
12390
12390
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12391
12391
 
12392
12392
 
@@ -33462,6 +33462,13 @@ var Tooltip = function Tooltip(props) {
33462
33462
  popsitionProps = _props$position === void 0 ? 'auto' : _props$position,
33463
33463
  _props$popupGap = props.popupGap,
33464
33464
  popupGap = _props$popupGap === void 0 ? 0 : _props$popupGap;
33465
+
33466
+ // Early validation checks BEFORE any hooks
33467
+ if (! /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement)(children)) {
33468
+ tooltip_devUseWarning.error('Tooltip children expect a single ReactElement.');
33469
+ return null;
33470
+ }
33471
+ if (!tip) return children;
33465
33472
  var tooltipClasses = jssStyle === null || jssStyle === void 0 || (_jssStyle$tooltip = jssStyle.tooltip) === null || _jssStyle$tooltip === void 0 ? void 0 : _jssStyle$tooltip.call(jssStyle);
33466
33473
  var config = useConfig();
33467
33474
  var persistent = persistentProp !== null && persistentProp !== void 0 ? persistentProp : (_config$tooltip = config.tooltip) === null || _config$tooltip === void 0 ? void 0 : _config$tooltip.persistent;
@@ -33520,22 +33527,6 @@ var Tooltip = function Tooltip(props) {
33520
33527
  unbindEvents();
33521
33528
  };
33522
33529
  }, [persistent]);
33523
- if (! /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement)(children)) {
33524
- tooltip_devUseWarning.error('Tooltip children expect a single ReactElement.');
33525
- return null;
33526
- }
33527
- if (!tip) return children;
33528
- var inner = disabledChild ? /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
33529
- className: tooltipClasses === null || tooltipClasses === void 0 ? void 0 : tooltipClasses.target,
33530
- style: {
33531
- cursor: 'not-allowed'
33532
- },
33533
- children: /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement)(children, {
33534
- style: objectSpread2_default()(objectSpread2_default()({}, childrenProps.style), {}, {
33535
- pointerEvents: 'none'
33536
- })
33537
- })
33538
- }) : children;
33539
33530
  var innerProps = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
33540
33531
  if (persistent) {
33541
33532
  return trigger === 'hover' ? objectSpread2_default()(objectSpread2_default()({}, events), {}, {
@@ -33547,6 +33538,17 @@ var Tooltip = function Tooltip(props) {
33547
33538
  }
33548
33539
  return events;
33549
33540
  }, [persistent, events, trigger]);
33541
+ var inner = disabledChild ? /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
33542
+ className: tooltipClasses === null || tooltipClasses === void 0 ? void 0 : tooltipClasses.target,
33543
+ style: {
33544
+ cursor: 'not-allowed'
33545
+ },
33546
+ children: /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement)(children, {
33547
+ style: objectSpread2_default()(objectSpread2_default()({}, childrenProps.style), {}, {
33548
+ pointerEvents: 'none'
33549
+ })
33550
+ })
33551
+ }) : children;
33550
33552
  return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
33551
33553
  children: [/*#__PURE__*/(0,jsx_runtime.jsx)("noscript", {
33552
33554
  ref: function ref(el) {
@@ -49388,7 +49390,8 @@ function _ReactUnmount() {
49388
49390
 
49389
49391
  var hasMask = false;
49390
49392
  var modal_content_config = {
49391
- instanceIds: []
49393
+ instanceIds: [],
49394
+ originDocumentStyle: null
49392
49395
  };
49393
49396
  var modal_content_state = createWithHooks(modal_content_config);
49394
49397
  var useModalConfig = function useModalConfig() {
@@ -49405,6 +49408,12 @@ var removeModalInstance = function removeModalInstance(instanceId) {
49405
49408
  var getInstanceIds = function getInstanceIds() {
49406
49409
  return modal_content_state.mutate.instanceIds;
49407
49410
  };
49411
+ var setOriginDocumentStyle = function setOriginDocumentStyle(style) {
49412
+ modal_content_state.mutate.originDocumentStyle = style;
49413
+ };
49414
+ var getOriginDocumentStyle = function getOriginDocumentStyle() {
49415
+ return modal_content_state.mutate.originDocumentStyle;
49416
+ };
49408
49417
  var mousePosition = null;
49409
49418
  var getClickPosition = function getClickPosition(e) {
49410
49419
  mousePosition = {
@@ -49447,7 +49456,6 @@ var Modal = function Modal(props) {
49447
49456
  mouseDownTarget: null,
49448
49457
  mouseUpTarget: null,
49449
49458
  content: null,
49450
- originDocumentStyle: null,
49451
49459
  instanceId: generateUUID()
49452
49460
  }),
49453
49461
  context = _useRef.current;
@@ -49562,15 +49570,16 @@ var Modal = function Modal(props) {
49562
49570
  setAnimation(true);
49563
49571
  }
49564
49572
  }, [props.visible]);
49573
+ var originDocumentStyle = getOriginDocumentStyle();
49565
49574
 
49566
49575
  // 设置 document.body.style.overflow 和 document.body.style.paddingRight,并记录原始值到 context 中
49567
49576
  var setDocumentOverflow = usePersistFn(function () {
49568
49577
  var doc = document.body.parentNode;
49569
- if (context.isMask && !context.originDocumentStyle) {
49570
- context.originDocumentStyle = {
49578
+ if (context.isMask && !originDocumentStyle) {
49579
+ setOriginDocumentStyle({
49571
49580
  overflow: doc.style.overflow,
49572
49581
  paddingRight: doc.style.paddingRight
49573
- };
49582
+ });
49574
49583
  }
49575
49584
  doc.style.overflow = 'hidden';
49576
49585
  if (!doc.style.paddingRight) {
@@ -49581,9 +49590,10 @@ var Modal = function Modal(props) {
49581
49590
  // 还原 document.body.style.overflow 和 document.body.style.paddingRight
49582
49591
  var resetDocumentOverflow = usePersistFn(function () {
49583
49592
  var doc = document.body.parentNode;
49584
- if (context.originDocumentStyle) {
49585
- doc.style.overflow = context.originDocumentStyle.overflow;
49586
- doc.style.paddingRight = context.originDocumentStyle.paddingRight;
49593
+ // originDocumentStyle放到全局管理后,多个modal连续打开关闭场景下,可以正确还原
49594
+ if (originDocumentStyle) {
49595
+ doc.style.overflow = originDocumentStyle.overflow;
49596
+ doc.style.paddingRight = originDocumentStyle.paddingRight;
49587
49597
  }
49588
49598
  });
49589
49599
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
@@ -73279,7 +73289,7 @@ var upload_interface = __webpack_require__(8821);
73279
73289
 
73280
73290
 
73281
73291
  /* harmony default export */ var src_0 = ({
73282
- version: '3.8.4'
73292
+ version: '3.8.5-beta.2'
73283
73293
  });
73284
73294
  }();
73285
73295
  /******/ return __webpack_exports__;