@pisell/materials 3.0.65 → 3.0.66
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +1 -1
- package/es/components/pisellModal/components/MobileModal/index.js +42 -2
- package/es/components/pisellModal/components/MobileModal/index.less +4 -0
- package/lib/components/pisellModal/components/MobileModal/index.js +39 -1
- package/lib/components/pisellModal/components/MobileModal/index.less +4 -0
- package/package.json +1 -1
|
@@ -3,13 +3,52 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
3
3
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
4
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
5
5
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
6
|
-
import React from 'react';
|
|
6
|
+
import React, { useEffect, useRef } from 'react';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
import PcModal from "../PcModal";
|
|
9
9
|
import "./index.less";
|
|
10
|
+
var modalCount = 0;
|
|
10
11
|
var MobileModal = function MobileModal(props) {
|
|
11
12
|
var wrapClassName = props.wrapClassName,
|
|
12
13
|
mobileModalHeight = props.mobileModalHeight;
|
|
14
|
+
var ref = React.useRef(null);
|
|
15
|
+
var prevOpenRef = useRef(props.open);
|
|
16
|
+
var isFirstRender = useRef(true);
|
|
17
|
+
|
|
18
|
+
// 处理初始化时的open状态
|
|
19
|
+
useEffect(function () {
|
|
20
|
+
if (isFirstRender.current && props.open) {
|
|
21
|
+
modalCount++;
|
|
22
|
+
document.body.style.overflow = 'hidden';
|
|
23
|
+
}
|
|
24
|
+
isFirstRender.current = false;
|
|
25
|
+
}, []);
|
|
26
|
+
useEffect(function () {
|
|
27
|
+
if (!isFirstRender.current && props.open !== prevOpenRef.current) {
|
|
28
|
+
if (props.open) {
|
|
29
|
+
modalCount++;
|
|
30
|
+
document.body.style.overflow = 'hidden';
|
|
31
|
+
} else {
|
|
32
|
+
modalCount--;
|
|
33
|
+
if (modalCount <= 0) {
|
|
34
|
+
modalCount = 0;
|
|
35
|
+
document.body.style.overflow = '';
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
prevOpenRef.current = props.open;
|
|
39
|
+
}
|
|
40
|
+
}, [props.open]);
|
|
41
|
+
useEffect(function () {
|
|
42
|
+
return function () {
|
|
43
|
+
if (prevOpenRef.current) {
|
|
44
|
+
modalCount--;
|
|
45
|
+
if (modalCount <= 0) {
|
|
46
|
+
modalCount = 0;
|
|
47
|
+
document.body.style.overflow = '';
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}, []);
|
|
13
52
|
return /*#__PURE__*/React.createElement(PcModal, _extends({}, props, {
|
|
14
53
|
transitionName: "pisell-move-down",
|
|
15
54
|
width: "100%",
|
|
@@ -19,7 +58,8 @@ var MobileModal = function MobileModal(props) {
|
|
|
19
58
|
className: classNames(_defineProperty({}, 'pisell-mobile-modal-render', mobileModalHeight)),
|
|
20
59
|
style: {
|
|
21
60
|
height: mobileModalHeight || '100%'
|
|
22
|
-
}
|
|
61
|
+
},
|
|
62
|
+
ref: ref
|
|
23
63
|
}, node);
|
|
24
64
|
}
|
|
25
65
|
}));
|
|
@@ -17,14 +17,18 @@
|
|
|
17
17
|
overflow: hidden;
|
|
18
18
|
max-height: 90%;
|
|
19
19
|
min-height: 200px;
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
20
22
|
}
|
|
21
23
|
.pisell-lowcode-modal-content {
|
|
24
|
+
flex: 1;
|
|
22
25
|
padding: 0;
|
|
23
26
|
border-radius: 0;
|
|
24
27
|
height: 100%;
|
|
25
28
|
display: flex;
|
|
26
29
|
flex-direction: column;
|
|
27
30
|
max-height: none;
|
|
31
|
+
min-height: 200px;
|
|
28
32
|
.pisell-lowcode-modal-close {
|
|
29
33
|
padding: 10px;
|
|
30
34
|
top: 8px;
|
|
@@ -36,8 +36,45 @@ var import_react = __toESM(require("react"));
|
|
|
36
36
|
var import_classnames = __toESM(require("classnames"));
|
|
37
37
|
var import_PcModal = __toESM(require("../PcModal"));
|
|
38
38
|
var import_index = require("./index.less");
|
|
39
|
+
var modalCount = 0;
|
|
39
40
|
var MobileModal = (props) => {
|
|
40
41
|
const { wrapClassName, mobileModalHeight } = props;
|
|
42
|
+
const ref = import_react.default.useRef(null);
|
|
43
|
+
const prevOpenRef = (0, import_react.useRef)(props.open);
|
|
44
|
+
const isFirstRender = (0, import_react.useRef)(true);
|
|
45
|
+
(0, import_react.useEffect)(() => {
|
|
46
|
+
if (isFirstRender.current && props.open) {
|
|
47
|
+
modalCount++;
|
|
48
|
+
document.body.style.overflow = "hidden";
|
|
49
|
+
}
|
|
50
|
+
isFirstRender.current = false;
|
|
51
|
+
}, []);
|
|
52
|
+
(0, import_react.useEffect)(() => {
|
|
53
|
+
if (!isFirstRender.current && props.open !== prevOpenRef.current) {
|
|
54
|
+
if (props.open) {
|
|
55
|
+
modalCount++;
|
|
56
|
+
document.body.style.overflow = "hidden";
|
|
57
|
+
} else {
|
|
58
|
+
modalCount--;
|
|
59
|
+
if (modalCount <= 0) {
|
|
60
|
+
modalCount = 0;
|
|
61
|
+
document.body.style.overflow = "";
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
prevOpenRef.current = props.open;
|
|
65
|
+
}
|
|
66
|
+
}, [props.open]);
|
|
67
|
+
(0, import_react.useEffect)(() => {
|
|
68
|
+
return () => {
|
|
69
|
+
if (prevOpenRef.current) {
|
|
70
|
+
modalCount--;
|
|
71
|
+
if (modalCount <= 0) {
|
|
72
|
+
modalCount = 0;
|
|
73
|
+
document.body.style.overflow = "";
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}, []);
|
|
41
78
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
42
79
|
import_PcModal.default,
|
|
43
80
|
{
|
|
@@ -56,7 +93,8 @@ var MobileModal = (props) => {
|
|
|
56
93
|
}),
|
|
57
94
|
style: {
|
|
58
95
|
height: mobileModalHeight || "100%"
|
|
59
|
-
}
|
|
96
|
+
},
|
|
97
|
+
ref
|
|
60
98
|
},
|
|
61
99
|
node
|
|
62
100
|
);
|
|
@@ -17,14 +17,18 @@
|
|
|
17
17
|
overflow: hidden;
|
|
18
18
|
max-height: 90%;
|
|
19
19
|
min-height: 200px;
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
20
22
|
}
|
|
21
23
|
.pisell-lowcode-modal-content {
|
|
24
|
+
flex: 1;
|
|
22
25
|
padding: 0;
|
|
23
26
|
border-radius: 0;
|
|
24
27
|
height: 100%;
|
|
25
28
|
display: flex;
|
|
26
29
|
flex-direction: column;
|
|
27
30
|
max-height: none;
|
|
31
|
+
min-height: 200px;
|
|
28
32
|
.pisell-lowcode-modal-close {
|
|
29
33
|
padding: 10px;
|
|
30
34
|
top: 8px;
|