Added Statistics calculation
Statistics now show calculated values
This commit is contained in:
parent
fe87374e47
commit
fc0f69dacb
2147 changed files with 141321 additions and 39 deletions
36
node_modules/@mui/x-internals/esm/useResizeObserver/useResizeObserver.js
generated
vendored
Normal file
36
node_modules/@mui/x-internals/esm/useResizeObserver/useResizeObserver.js
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import * as React from 'react';
|
||||
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
||||
const isDevEnvironment = process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test';
|
||||
const noop = () => {};
|
||||
export function useResizeObserver(ref, fn, enabled) {
|
||||
const fnRef = React.useRef(null);
|
||||
fnRef.current = fn;
|
||||
useEnhancedEffect(() => {
|
||||
if (enabled === false || typeof ResizeObserver === 'undefined') {
|
||||
return noop;
|
||||
}
|
||||
let frameID = 0;
|
||||
const target = ref.current;
|
||||
const observer = new ResizeObserver(entries => {
|
||||
// See https://github.com/mui/mui-x/issues/8733
|
||||
// In dev, we avoid the React warning by moving the task to the next frame.
|
||||
// In prod, we want the task to run in the same frame as to avoid tear.
|
||||
if (isDevEnvironment) {
|
||||
frameID = requestAnimationFrame(() => {
|
||||
fnRef.current(entries);
|
||||
});
|
||||
} else {
|
||||
fnRef.current(entries);
|
||||
}
|
||||
});
|
||||
if (target) {
|
||||
observer.observe(target);
|
||||
}
|
||||
return () => {
|
||||
if (frameID) {
|
||||
cancelAnimationFrame(frameID);
|
||||
}
|
||||
observer.disconnect();
|
||||
};
|
||||
}, [ref, enabled]);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue