@blocklet/launcher-layout 1.5.60 → 1.5.63
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/lib/compact-layout.js +18 -4
- package/package.json +5 -5
package/lib/compact-layout.js
CHANGED
|
@@ -21,17 +21,29 @@ function CompactLayout(_ref) {
|
|
|
21
21
|
let {
|
|
22
22
|
children,
|
|
23
23
|
bottom,
|
|
24
|
-
fixBottomMaxWidth
|
|
24
|
+
fixBottomMaxWidth,
|
|
25
|
+
onBottomFix
|
|
25
26
|
} = _ref;
|
|
26
27
|
const mainCon = (0, _react.useRef)(null);
|
|
27
28
|
const childsCon = (0, _react.useRef)(null);
|
|
28
29
|
const compactCon = (0, _react.useRef)(null);
|
|
30
|
+
const isFix = (0, _react.useRef)(null);
|
|
29
31
|
const [scrollMode, setScrollMode] = (0, _react.useState)(false);
|
|
30
32
|
(0, _react.useEffect)(() => {
|
|
31
33
|
const fixSize = () => {
|
|
32
34
|
if (childsCon.current.scrollHeight > mainCon.current.clientHeight - compactCon.current.clientHeight || fixBottomMaxWidth && fixBottomMaxWidth > compactCon.current.clientWidth) {
|
|
35
|
+
if (isFix.current !== 'fix') {
|
|
36
|
+
onBottomFix('fix');
|
|
37
|
+
isFix.current = 'fix';
|
|
38
|
+
}
|
|
39
|
+
|
|
33
40
|
setScrollMode(true);
|
|
34
41
|
} else {
|
|
42
|
+
if (isFix.current !== 'scroll') {
|
|
43
|
+
onBottomFix('scroll');
|
|
44
|
+
isFix.current = 'scroll';
|
|
45
|
+
}
|
|
46
|
+
|
|
35
47
|
setScrollMode(false);
|
|
36
48
|
}
|
|
37
49
|
};
|
|
@@ -44,7 +56,7 @@ function CompactLayout(_ref) {
|
|
|
44
56
|
window.addEventListener('resize', fixSize);
|
|
45
57
|
}
|
|
46
58
|
|
|
47
|
-
resizeObs.observe(
|
|
59
|
+
resizeObs.observe(mainCon.current);
|
|
48
60
|
return () => {
|
|
49
61
|
if (resizeObs) {
|
|
50
62
|
resizeObs.disconnect();
|
|
@@ -73,9 +85,11 @@ const Container = _styledComponents.default.div.withConfig({
|
|
|
73
85
|
CompactLayout.propTypes = {
|
|
74
86
|
children: _propTypes.default.any,
|
|
75
87
|
bottom: _propTypes.default.element.isRequired,
|
|
76
|
-
fixBottomMaxWidth: _propTypes.default.number
|
|
88
|
+
fixBottomMaxWidth: _propTypes.default.number,
|
|
89
|
+
onBottomFix: _propTypes.default.func
|
|
77
90
|
};
|
|
78
91
|
CompactLayout.defaultProps = {
|
|
79
92
|
children: [],
|
|
80
|
-
fixBottomMaxWidth: 0
|
|
93
|
+
fixBottomMaxWidth: 0,
|
|
94
|
+
onBottomFix: () => {}
|
|
81
95
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/launcher-layout",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.63",
|
|
4
4
|
"description": "Common ux components of launcher",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"react": ">=16.12.0"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@arcblock/did-connect": "^1.16.
|
|
41
|
-
"@arcblock/icons": "^1.16.
|
|
42
|
-
"@arcblock/ux": "^1.16.
|
|
40
|
+
"@arcblock/did-connect": "^1.16.43",
|
|
41
|
+
"@arcblock/icons": "^1.16.43",
|
|
42
|
+
"@arcblock/ux": "^1.16.43",
|
|
43
43
|
"@material-ui/core": "^4.12.3",
|
|
44
44
|
"@material-ui/icons": "^4.11.2",
|
|
45
45
|
"@material-ui/lab": "^4.0.0-alpha.60",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"babel-plugin-inline-react-svg": "^2.0.1",
|
|
57
57
|
"babel-plugin-styled-components": "^1.10.7"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "f75fa0509639a6e0490d1bd4443b8028e237675c"
|
|
60
60
|
}
|