@patternfly/react-table 4.105.6 → 4.105.7
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/CHANGELOG.md +8 -0
- package/dist/umd/react-table.css +9092 -9092
- package/dist/umd/react-table.js +18 -3
- package/dist/umd/react-table.min.css +989 -989
- package/dist/umd/react-table.min.js +1 -1
- package/package.json +6 -6
package/dist/umd/react-table.js
CHANGED
|
@@ -4014,22 +4014,37 @@
|
|
|
4014
4014
|
* );
|
|
4015
4015
|
* }
|
|
4016
4016
|
*
|
|
4017
|
+
* Example 3 - With debounced method passed in:
|
|
4018
|
+
*
|
|
4019
|
+
* public componentDidMount() {
|
|
4020
|
+
* this.observer = getResizeObserver(this.inputRef.current, debounce(this.handleResize, 250), false);
|
|
4021
|
+
* }
|
|
4022
|
+
*
|
|
4017
4023
|
* @param {Element} containerRefElement The container reference to observe
|
|
4018
4024
|
* @param {Function} handleResize The function to call for resize events
|
|
4025
|
+
* @param {boolean} useRequestAnimationFrame Whether to pass the handleResize function as a callback to requestAnimationFrame. Pass in false when the function passed in is debounced. Defaults to true.
|
|
4019
4026
|
* @return {Function} The function used to unobserve resize events
|
|
4020
4027
|
*/
|
|
4021
|
-
const getResizeObserver = (containerRefElement, handleResize) => {
|
|
4028
|
+
const getResizeObserver = (containerRefElement, handleResize, useRequestAnimationFrame = true) => {
|
|
4022
4029
|
let unobserve;
|
|
4023
4030
|
if (canUseDOM) {
|
|
4024
4031
|
const { ResizeObserver } = window;
|
|
4025
4032
|
if (containerRefElement && ResizeObserver) {
|
|
4026
4033
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
4027
4034
|
// Wrap resize function in requestAnimationFrame to avoid "ResizeObserver loop limit exceeded" errors
|
|
4028
|
-
|
|
4035
|
+
if (useRequestAnimationFrame) {
|
|
4036
|
+
window.requestAnimationFrame(() => {
|
|
4037
|
+
if (Array.isArray(entries) && entries.length > 0) {
|
|
4038
|
+
handleResize();
|
|
4039
|
+
}
|
|
4040
|
+
});
|
|
4041
|
+
// Avoid wrapping function in requestAnimationFrame if the function is debounced
|
|
4042
|
+
}
|
|
4043
|
+
else {
|
|
4029
4044
|
if (Array.isArray(entries) && entries.length > 0) {
|
|
4030
4045
|
handleResize();
|
|
4031
4046
|
}
|
|
4032
|
-
}
|
|
4047
|
+
}
|
|
4033
4048
|
});
|
|
4034
4049
|
resizeObserver.observe(containerRefElement);
|
|
4035
4050
|
unobserve = () => resizeObserver.unobserve(containerRefElement);
|