shineout 3.8.0-beta.43 → 3.8.0-beta.44
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 +1 -1
- package/dist/shineout.js +47 -14
- package/dist/shineout.js.map +1 -1
- package/dist/shineout.min.js +1 -1
- package/dist/shineout.min.js.map +1 -1
- package/esm/index.js +1 -1
- package/package.json +5 -5
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.0-beta.
|
|
525
|
+
version: '3.8.0-beta.44'
|
|
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.0-beta.
|
|
12389
|
+
/* harmony default export */ var version = ('3.8.0-beta.44');
|
|
12390
12390
|
;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
|
|
12391
12391
|
|
|
12392
12392
|
|
|
@@ -49222,7 +49222,23 @@ function _ReactUnmount() {
|
|
|
49222
49222
|
|
|
49223
49223
|
|
|
49224
49224
|
|
|
49225
|
+
|
|
49225
49226
|
var hasMask = false;
|
|
49227
|
+
var modal_content_config = {
|
|
49228
|
+
instanceIds: []
|
|
49229
|
+
};
|
|
49230
|
+
var modal_content_state = createWithHooks(modal_content_config);
|
|
49231
|
+
var useModalConfig = function useModalConfig() {
|
|
49232
|
+
return modal_content_state.useSnapshot();
|
|
49233
|
+
};
|
|
49234
|
+
var addModalInstance = function addModalInstance(instanceId) {
|
|
49235
|
+
modal_content_state.mutate.instanceIds.push(instanceId);
|
|
49236
|
+
};
|
|
49237
|
+
var removeModalInstance = function removeModalInstance(instanceId) {
|
|
49238
|
+
modal_content_state.mutate.instanceIds = modal_content_state.mutate.instanceIds.filter(function (id) {
|
|
49239
|
+
return id !== instanceId;
|
|
49240
|
+
});
|
|
49241
|
+
};
|
|
49226
49242
|
var mousePosition = null;
|
|
49227
49243
|
var getClickPosition = function getClickPosition(e) {
|
|
49228
49244
|
mousePosition = {
|
|
@@ -49265,12 +49281,11 @@ var Modal = function Modal(props) {
|
|
|
49265
49281
|
mouseDownTarget: null,
|
|
49266
49282
|
mouseUpTarget: null,
|
|
49267
49283
|
content: null,
|
|
49268
|
-
originDocumentStyle:
|
|
49269
|
-
|
|
49270
|
-
paddingRight: ''
|
|
49271
|
-
}
|
|
49284
|
+
originDocumentStyle: null,
|
|
49285
|
+
instanceId: generateUUID()
|
|
49272
49286
|
}),
|
|
49273
49287
|
context = _useRef.current;
|
|
49288
|
+
var config = useModalConfig();
|
|
49274
49289
|
var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(props.visible || props.autoShow),
|
|
49275
49290
|
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
49276
49291
|
animation = _useState4[0],
|
|
@@ -49285,6 +49300,10 @@ var Modal = function Modal(props) {
|
|
|
49285
49300
|
defaultHeight: height,
|
|
49286
49301
|
panelRef: panelRef
|
|
49287
49302
|
});
|
|
49303
|
+
var showMask = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
|
|
49304
|
+
if (props.forceMask) return config.instanceIds.includes(context.instanceId);
|
|
49305
|
+
return config.instanceIds[0] === context.instanceId;
|
|
49306
|
+
}, [config.instanceIds, props.forceMask]);
|
|
49288
49307
|
var rerender = useRender();
|
|
49289
49308
|
var handleMaskVisible = function handleMaskVisible() {
|
|
49290
49309
|
// 多个moal 只有第一个显示的时候才显示遮罩
|
|
@@ -49295,6 +49314,15 @@ var Modal = function Modal(props) {
|
|
|
49295
49314
|
rerender();
|
|
49296
49315
|
}
|
|
49297
49316
|
};
|
|
49317
|
+
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
49318
|
+
var index = config.instanceIds.indexOf(context.instanceId);
|
|
49319
|
+
if (visible && index === -1) {
|
|
49320
|
+
addModalInstance(context.instanceId);
|
|
49321
|
+
}
|
|
49322
|
+
if (!visible && index > -1 && !animation) {
|
|
49323
|
+
removeModalInstance(context.instanceId);
|
|
49324
|
+
}
|
|
49325
|
+
}, [visible, animation, config.instanceIds]);
|
|
49298
49326
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(handleMaskVisible, [visible]);
|
|
49299
49327
|
var updateOrigin = function updateOrigin() {
|
|
49300
49328
|
// 更新transform-origin
|
|
@@ -49372,9 +49400,11 @@ var Modal = function Modal(props) {
|
|
|
49372
49400
|
// 设置 document.body.style.overflow 和 document.body.style.paddingRight,并记录原始值到 context 中
|
|
49373
49401
|
var setDocumentOverflow = usePersistFn(function () {
|
|
49374
49402
|
var doc = document.body.parentNode;
|
|
49375
|
-
if (context.isMask) {
|
|
49376
|
-
context.originDocumentStyle
|
|
49377
|
-
|
|
49403
|
+
if (context.isMask && !context.originDocumentStyle) {
|
|
49404
|
+
context.originDocumentStyle = {
|
|
49405
|
+
overflow: doc.style.overflow,
|
|
49406
|
+
paddingRight: doc.style.paddingRight
|
|
49407
|
+
};
|
|
49378
49408
|
}
|
|
49379
49409
|
doc.style.overflow = 'hidden';
|
|
49380
49410
|
if (!doc.style.paddingRight) {
|
|
@@ -49385,19 +49415,21 @@ var Modal = function Modal(props) {
|
|
|
49385
49415
|
// 还原 document.body.style.overflow 和 document.body.style.paddingRight
|
|
49386
49416
|
var resetDocumentOverflow = usePersistFn(function () {
|
|
49387
49417
|
var doc = document.body.parentNode;
|
|
49388
|
-
|
|
49389
|
-
|
|
49418
|
+
if (context.originDocumentStyle) {
|
|
49419
|
+
doc.style.overflow = context.originDocumentStyle.overflow;
|
|
49420
|
+
doc.style.paddingRight = context.originDocumentStyle.paddingRight;
|
|
49421
|
+
}
|
|
49390
49422
|
});
|
|
49391
49423
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
49392
49424
|
if (!props.hideMask) {
|
|
49393
49425
|
if (visible) {
|
|
49394
49426
|
setDocumentOverflow();
|
|
49395
49427
|
} else {
|
|
49396
|
-
if (
|
|
49428
|
+
if (config.instanceIds.length && config.instanceIds[config.instanceIds.length - 1] === context.instanceId) return;
|
|
49397
49429
|
resetDocumentOverflow();
|
|
49398
49430
|
}
|
|
49399
49431
|
}
|
|
49400
|
-
}, [visible]);
|
|
49432
|
+
}, [visible, config.instanceIds]);
|
|
49401
49433
|
var canDestroy = !visible && !animation;
|
|
49402
49434
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
49403
49435
|
var _props$shouldDestroy;
|
|
@@ -49408,6 +49440,7 @@ var Modal = function Modal(props) {
|
|
|
49408
49440
|
// unmount
|
|
49409
49441
|
return function () {
|
|
49410
49442
|
var _props$shouldDestroy2;
|
|
49443
|
+
removeModalInstance(context.instanceId);
|
|
49411
49444
|
if (context.isMask) {
|
|
49412
49445
|
resetDocumentOverflow();
|
|
49413
49446
|
}
|
|
@@ -49537,7 +49570,7 @@ var Modal = function Modal(props) {
|
|
|
49537
49570
|
onClick: function onClick(e) {
|
|
49538
49571
|
e.stopPropagation();
|
|
49539
49572
|
},
|
|
49540
|
-
className: classnames_default()(props.rootClassName, modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.rootClass, modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.wrapper, animation && (modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.wrapperAnimation), visible ? modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.wrapperShow : modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.wrapperHide,
|
|
49573
|
+
className: classnames_default()(props.rootClassName, modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.rootClass, modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.wrapper, animation && (modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.wrapperAnimation), visible ? modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.wrapperShow : modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.wrapperHide, showMask && (modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.wrapperIsMask), props.fullScreen && (modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.wrapperFullScreen), props.moveable && (modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.wrapperMoveable), props.hideMask && (modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.wrapperHideMask), props.zoom && !props.moveable && (modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.wrapperZoom), (isPositionX || isPositionY) && (modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.wrapperDrawer), props.position === 'left' && (modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.wrapperDrawerLeft), props.position === 'right' && (modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.wrapperDrawerRight), props.position === 'top' && (modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.wrapperDrawerTop), props.position === 'bottom' && (modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.wrapperDrawerBottom)),
|
|
49541
49574
|
onAnimationEnd: handleAnimationEnd,
|
|
49542
49575
|
style: {
|
|
49543
49576
|
background: props.maskBackground,
|
|
@@ -72959,7 +72992,7 @@ var upload_interface = __webpack_require__(8821);
|
|
|
72959
72992
|
|
|
72960
72993
|
|
|
72961
72994
|
/* harmony default export */ var src_0 = ({
|
|
72962
|
-
version: '3.8.0-beta.
|
|
72995
|
+
version: '3.8.0-beta.44'
|
|
72963
72996
|
});
|
|
72964
72997
|
}();
|
|
72965
72998
|
/******/ return __webpack_exports__;
|