@micromag/element-scroll 0.3.349 → 0.3.354
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/es/index.js +13 -0
- package/lib/index.js +13 -0
- package/package.json +3 -3
package/es/index.js
CHANGED
|
@@ -17,6 +17,7 @@ var propTypes = {
|
|
|
17
17
|
children: PropTypes.node,
|
|
18
18
|
onScrolledBottom: PropTypes.func,
|
|
19
19
|
onScrolledNotBottom: PropTypes.func,
|
|
20
|
+
onScrollHeightChange: PropTypes.func,
|
|
20
21
|
contain: PropTypes.bool,
|
|
21
22
|
scrollContainerRef: PropTypes.any,
|
|
22
23
|
// eslint-disable-line
|
|
@@ -32,6 +33,7 @@ var defaultProps = {
|
|
|
32
33
|
children: null,
|
|
33
34
|
onScrolledBottom: null,
|
|
34
35
|
onScrolledNotBottom: null,
|
|
36
|
+
onScrollHeightChange: null,
|
|
35
37
|
contain: false,
|
|
36
38
|
scrollContainerRef: null,
|
|
37
39
|
withShadow: false,
|
|
@@ -47,6 +49,7 @@ function Scroll(_ref) {
|
|
|
47
49
|
children = _ref.children,
|
|
48
50
|
onScrolledBottom = _ref.onScrolledBottom,
|
|
49
51
|
onScrolledNotBottom = _ref.onScrolledNotBottom,
|
|
52
|
+
onScrollHeightChange = _ref.onScrollHeightChange,
|
|
50
53
|
contain = _ref.contain,
|
|
51
54
|
scrollContainerRef = _ref.scrollContainerRef,
|
|
52
55
|
withShadow = _ref.withShadow,
|
|
@@ -123,6 +126,16 @@ function Scroll(_ref) {
|
|
|
123
126
|
}
|
|
124
127
|
}
|
|
125
128
|
}, [scrollableHeight, scrolleeHeight, setWithArrow, disabled]);
|
|
129
|
+
useEffect(function () {
|
|
130
|
+
if (onScrollHeightChange !== null) {
|
|
131
|
+
var canScroll = (scrolleeHeight || 0) > (scrollableHeight || 0);
|
|
132
|
+
onScrollHeightChange({
|
|
133
|
+
scrollableHeight: scrollableHeight,
|
|
134
|
+
scrolleeHeight: scrolleeHeight,
|
|
135
|
+
canScroll: canScroll
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}, [scrollableHeight, scrolleeHeight, onScrollHeightChange]);
|
|
126
139
|
return /*#__PURE__*/React.createElement("div", {
|
|
127
140
|
className: classNames([styles.container, (_ref3 = {}, _defineProperty(_ref3, styles.withScroll, !disabled), _defineProperty(_ref3, styles.containOverscroll, contain), _defineProperty(_ref3, className, className !== null), _defineProperty(_ref3, styles[verticalAlign], verticalAlign !== null), _defineProperty(_ref3, styles.withArrow, showArrow && withArrow), _defineProperty(_ref3, styles.withShadow, withShadow), _ref3)]),
|
|
128
141
|
style: finalStyle
|
package/lib/index.js
CHANGED
|
@@ -27,6 +27,7 @@ var propTypes = {
|
|
|
27
27
|
children: PropTypes__default["default"].node,
|
|
28
28
|
onScrolledBottom: PropTypes__default["default"].func,
|
|
29
29
|
onScrolledNotBottom: PropTypes__default["default"].func,
|
|
30
|
+
onScrollHeightChange: PropTypes__default["default"].func,
|
|
30
31
|
contain: PropTypes__default["default"].bool,
|
|
31
32
|
scrollContainerRef: PropTypes__default["default"].any,
|
|
32
33
|
// eslint-disable-line
|
|
@@ -42,6 +43,7 @@ var defaultProps = {
|
|
|
42
43
|
children: null,
|
|
43
44
|
onScrolledBottom: null,
|
|
44
45
|
onScrolledNotBottom: null,
|
|
46
|
+
onScrollHeightChange: null,
|
|
45
47
|
contain: false,
|
|
46
48
|
scrollContainerRef: null,
|
|
47
49
|
withShadow: false,
|
|
@@ -57,6 +59,7 @@ function Scroll(_ref) {
|
|
|
57
59
|
children = _ref.children,
|
|
58
60
|
onScrolledBottom = _ref.onScrolledBottom,
|
|
59
61
|
onScrolledNotBottom = _ref.onScrolledNotBottom,
|
|
62
|
+
onScrollHeightChange = _ref.onScrollHeightChange,
|
|
60
63
|
contain = _ref.contain,
|
|
61
64
|
scrollContainerRef = _ref.scrollContainerRef,
|
|
62
65
|
withShadow = _ref.withShadow,
|
|
@@ -133,6 +136,16 @@ function Scroll(_ref) {
|
|
|
133
136
|
}
|
|
134
137
|
}
|
|
135
138
|
}, [scrollableHeight, scrolleeHeight, setWithArrow, disabled]);
|
|
139
|
+
React.useEffect(function () {
|
|
140
|
+
if (onScrollHeightChange !== null) {
|
|
141
|
+
var canScroll = (scrolleeHeight || 0) > (scrollableHeight || 0);
|
|
142
|
+
onScrollHeightChange({
|
|
143
|
+
scrollableHeight: scrollableHeight,
|
|
144
|
+
scrolleeHeight: scrolleeHeight,
|
|
145
|
+
canScroll: canScroll
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}, [scrollableHeight, scrolleeHeight, onScrollHeightChange]);
|
|
136
149
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
137
150
|
className: classNames__default["default"]([styles.container, (_ref3 = {}, _defineProperty__default["default"](_ref3, styles.withScroll, !disabled), _defineProperty__default["default"](_ref3, styles.containOverscroll, contain), _defineProperty__default["default"](_ref3, className, className !== null), _defineProperty__default["default"](_ref3, styles[verticalAlign], verticalAlign !== null), _defineProperty__default["default"](_ref3, styles.withArrow, showArrow && withArrow), _defineProperty__default["default"](_ref3, styles.withShadow, withShadow), _ref3)]),
|
|
138
151
|
style: finalStyle
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-scroll",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.354",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@fortawesome/fontawesome-svg-core": "^1.2.32",
|
|
53
53
|
"@fortawesome/free-solid-svg-icons": "^5.15.1",
|
|
54
54
|
"@fortawesome/react-fontawesome": "^0.1.13",
|
|
55
|
-
"@micromag/core": "^0.3.
|
|
55
|
+
"@micromag/core": "^0.3.354",
|
|
56
56
|
"@use-gesture/react": "^10.2.4",
|
|
57
57
|
"classnames": "^2.2.6",
|
|
58
58
|
"lodash": "^4.17.21",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "ccf852d0a7df8f222365088e7de3843492e720e7"
|
|
67
67
|
}
|