planning
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s

This commit is contained in:
2024-10-14 09:15:30 +02:00
parent bcba00a730
commit 6e64e138e2
21059 changed files with 2317811 additions and 1 deletions

21
node_modules/react-virtualized-auto-sizer/LICENSE.md generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Brian Vaughn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

97
node_modules/react-virtualized-auto-sizer/README.md generated vendored Normal file
View File

@@ -0,0 +1,97 @@
# react-virtualized-auto-sizer
Standalone version of the `AutoSizer` component from [`react-virtualized`](https://github.com/bvaughn/react-virtualized).
### If you like this project, 🎉 [become a sponsor](https://github.com/sponsors/bvaughn/) or ☕ [buy me a coffee](http://givebrian.coffee/)
## Install
```bash
npm install --save react-virtualized-auto-sizer
```
## Documentation
| Property | Type | Required? | Description |
| :------------ | :------- | :-------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| children | Function | ✓ | Function responsible for rendering children. This function should implement the following signature: `({ height?: number \| undefined, width?: number \| undefined }) => PropTypes.element` |
| className | String | | Optional custom CSS class name to attach to root `AutoSizer` element. This is an advanced property and is not typically necessary. |
| defaultHeight | Number | | Height passed to child for initial render; useful for server-side rendering. This value will be overridden with an accurate height after mounting. |
| defaultWidth | Number | | Width passed to child for initial render; useful for server-side rendering. This value will be overridden with an accurate width after mounting. |
| disableHeight | Boolean | | Fixed `height`; if specified, the child's `height` property will not be managed |
| disableWidth | Boolean | | Fixed `width`; if specified, the child's `width` property will not be managed |
| nonce | String | | Nonce of the inlined stylesheets for [Content Security Policy](https://www.w3.org/TR/2016/REC-CSP2-20161215/#script-src-the-nonce-attribute) |
| onResize | Function | | Callback to be invoked on-resize; it is passed the following named parameters: `({ height: number, width: number })`. |
| style | Object | | Optional custom inline style to attach to root `AutoSizer` element. This is an advanced property and is not typically necessary. |
| tagName | string | | Optional HTML tag name for root element; defaults to `"div"` |
## Examples
Some components (like those found in [`react-window`](https://github.com/bvaughn/react-window) or [`react-virtualized`](https://github.com/bvaughn/react-virtualized)) require numeric width and height parameters. The `AutoSizer` component can be useful if you want to pass percentage based dimensions.
```jsx
import AutoSizer from "react-virtualized-auto-sizer";
// UI
<AutoSizer>
{({ height, width }) => {
// Use these actual sizes to calculate your percentage based sizes
}}
</AutoSizer>;
```
## FAQs
### Can I use this component with flexbox?
Flex containers don't prevent their children from growing and `AutoSizer` greedily grows to fill as much space as possible. Combining the two can be problematic. The simple way to fix this is to nest `AutoSizer` inside of a `block` element (like a `<div>`) rather than putting it as a direct child of the flex container, like so:
```jsx
<div style={{ display: 'flex' }}>
<!-- Other children... -->
<div style={{ flex: '1 1 auto' }}>
<AutoSizer>
{({ height, width }) => (
<Component
width={width}
height={height}
{...props}
/>
)}
</AutoSizer>
</div>
</div>
```
### Why is `AutoSizer` passing a height of 0?
`AutoSizer` expands to _fill_ its parent but it will not _stretch_ the parent. This is done to prevent problems with flexbox layouts. If `AutoSizer` is reporting a height (or width) of 0- then it's likely that the parent element (or one of its parents) has a height of 0.
The solution to this problem is often to add `height: 100%` or `flex: 1` to the parent. One easy way to test this is to add a style property (eg `background-color: red;`) to the parent to visually confirm that it is the expected size.
### Can I use `AutoSizer` to manage only width or height (not both)?
You can use `AutoSizer` to control only one dimension of its child component using the `disableHeight` or `disableWidth` attributes. For example, a fixed-height component that should grow to fill the available width can be created like so:
```jsx
<AutoSizer disableHeight>
{({width}) => <Component height={200} width={width} {...props} />}
</AutoSizer>
```
### Module parsing fails because of an unexpected token?
This package targets [ECMAScript 2015](https://262.ecma-international.org/6.0/) (ES6) and requires a build tool such as [babel-loader](https://www.npmjs.com/package/babel-loader) that is capable of parsing the ES6 `class` syntax.
### Can this component work with a Content Security Policy?
[The specification of Content Security Policy](https://www.w3.org/TR/2016/REC-CSP2-20161215/#intro)
describes as the following:
> This document defines Content Security Policy, a mechanism web applications
> can use to mitigate a broad class of content injection vulnerabilities, such
> as cross-site scripting (XSS).
To apply Content Security Policy, pass a `nonce` to `AutoSizer` and add a matching `nonce-source` to the `Content-Security-Policy` field in HTTP header.

View File

@@ -0,0 +1,28 @@
import { Component, ReactNode } from "react";
import { DetectElementResize } from "./vendor/detectElementResize.js";
import { Props } from "./types.js";
type State = {
height: number;
scaledHeight: number;
scaledWidth: number;
width: number;
};
export declare class AutoSizer extends Component<Props, State> {
state: {
height: number;
scaledHeight: number;
scaledWidth: number;
width: number;
};
_autoSizer: HTMLElement | null;
_detectElementResize: DetectElementResize | null;
_parentNode: HTMLElement | null;
_resizeObserver: ResizeObserver | null;
_timeoutId: number | null;
componentDidMount(): void;
componentWillUnmount(): void;
render(): ReactNode;
_onResize: () => void;
_setRef: (autoSizer: HTMLElement | null) => void;
}
export {};

View File

@@ -0,0 +1,3 @@
import { AutoSizer } from "./AutoSizer.js";
export default AutoSizer;
export * from "./types.js";

View File

@@ -0,0 +1,42 @@
import { HTMLAttributes, ReactNode } from "react";
export type HorizontalSize = {
width: number;
scaledWidth: number;
};
export type VerticalSize = {
height: number;
scaledHeight: number;
};
export type Size = HorizontalSize & VerticalSize;
type BaseProps = {
doNotBailOutOnEmptyChildren?: boolean;
nonce?: string;
tagName?: string;
} & Omit<HTMLAttributes<HTMLDivElement>, "children" | "onResize">;
export type HeightOnlyProps = BaseProps & {
children: (size: VerticalSize) => ReactNode;
defaultHeight?: number;
disableHeight?: false;
disableWidth: true;
onResize?: (size: VerticalSize) => void;
};
export type WidthOnlyProps = BaseProps & {
children: (size: HorizontalSize) => ReactNode;
defaultWidth?: number;
disableHeight: true;
disableWidth?: false;
onResize?: (size: HorizontalSize) => void;
};
export type HeightAndWidthProps = BaseProps & {
children: (size: Size) => ReactNode;
defaultHeight?: number;
defaultWidth?: number;
disableHeight?: false;
disableWidth?: false;
onResize?: (size: Size) => void;
};
export type Props = HeightOnlyProps | WidthOnlyProps | HeightAndWidthProps;
export declare function isHeightAndWidthProps(props: any): props is HeightAndWidthProps;
export declare function isHeightOnlyProps(props: any): props is HeightOnlyProps;
export declare function isWidthOnlyProps(props: any): props is WidthOnlyProps;
export {};

View File

@@ -0,0 +1,10 @@
type ResizeHandler = (element: HTMLElement, onResize: () => void) => void;
export type DetectElementResize = {
addResizeListener: ResizeHandler;
removeResizeListener: ResizeHandler;
};
export function createDetectElementResize(nonce?: string): DetectElementResize;
export {};

View File

@@ -0,0 +1,3 @@
export * from "./declarations/src/index.js";
export { _default as default } from "./react-virtualized-auto-sizer.cjs.default.js";
//# sourceMappingURL=react-virtualized-auto-sizer.cjs.d.mts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"react-virtualized-auto-sizer.cjs.d.mts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"}

View File

@@ -0,0 +1,3 @@
export * from "./declarations/src/index";
export { default } from "./declarations/src/index";
//# sourceMappingURL=react-virtualized-auto-sizer.cjs.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"react-virtualized-auto-sizer.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"}

View File

@@ -0,0 +1 @@
export { default as _default } from "./declarations/src/index.js"

View File

@@ -0,0 +1 @@
exports._default = require("./react-virtualized-auto-sizer.cjs.js").default;

View File

@@ -0,0 +1,399 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var react = require('react');
/**
* Detect Element Resize.
* https://github.com/sdecima/javascript-detect-element-resize
* Sebastian Decima
*
* Forked from version 0.5.3; includes the following modifications:
* 1) Guard against unsafe 'window' and 'document' references (to support SSR).
* 2) Defer initialization code via a top-level function wrapper (to support SSR).
* 3) Avoid unnecessary reflows by not measuring size for scroll events bubbling from children.
* 4) Add nonce for style element.
* 5) Use 'export' statement over 'module.exports' assignment
**/
// Check `document` and `window` in case of server-side rendering
let windowObject;
if (typeof window !== "undefined") {
windowObject = window;
// eslint-disable-next-line no-restricted-globals
} else if (typeof self !== "undefined") {
// eslint-disable-next-line no-restricted-globals
windowObject = self;
} else {
windowObject = global;
}
let cancelFrame = null;
let requestFrame = null;
const TIMEOUT_DURATION = 20;
const clearTimeoutFn = windowObject.clearTimeout;
const setTimeoutFn = windowObject.setTimeout;
const cancelAnimationFrameFn = windowObject.cancelAnimationFrame || windowObject.mozCancelAnimationFrame || windowObject.webkitCancelAnimationFrame;
const requestAnimationFrameFn = windowObject.requestAnimationFrame || windowObject.mozRequestAnimationFrame || windowObject.webkitRequestAnimationFrame;
if (cancelAnimationFrameFn == null || requestAnimationFrameFn == null) {
// For environments that don't support animation frame,
// fallback to a setTimeout based approach.
cancelFrame = clearTimeoutFn;
requestFrame = function requestAnimationFrameViaSetTimeout(callback) {
return setTimeoutFn(callback, TIMEOUT_DURATION);
};
} else {
// Counter intuitively, environments that support animation frames can be trickier.
// Chrome's "Throttle non-visible cross-origin iframes" flag can prevent rAFs from being called.
// In this case, we should fallback to a setTimeout() implementation.
cancelFrame = function cancelFrame([animationFrameID, timeoutID]) {
cancelAnimationFrameFn(animationFrameID);
clearTimeoutFn(timeoutID);
};
requestFrame = function requestAnimationFrameWithSetTimeoutFallback(callback) {
const animationFrameID = requestAnimationFrameFn(function animationFrameCallback() {
clearTimeoutFn(timeoutID);
callback();
});
const timeoutID = setTimeoutFn(function timeoutCallback() {
cancelAnimationFrameFn(animationFrameID);
callback();
}, TIMEOUT_DURATION);
return [animationFrameID, timeoutID];
};
}
function createDetectElementResize(nonce) {
let animationKeyframes;
let animationName;
let animationStartEvent;
let animationStyle;
let checkTriggers;
let resetTriggers;
let scrollListener;
const attachEvent = typeof document !== "undefined" && document.attachEvent;
if (!attachEvent) {
resetTriggers = function (element) {
const triggers = element.__resizeTriggers__,
expand = triggers.firstElementChild,
contract = triggers.lastElementChild,
expandChild = expand.firstElementChild;
contract.scrollLeft = contract.scrollWidth;
contract.scrollTop = contract.scrollHeight;
expandChild.style.width = expand.offsetWidth + 1 + "px";
expandChild.style.height = expand.offsetHeight + 1 + "px";
expand.scrollLeft = expand.scrollWidth;
expand.scrollTop = expand.scrollHeight;
};
checkTriggers = function (element) {
return element.offsetWidth !== element.__resizeLast__.width || element.offsetHeight !== element.__resizeLast__.height;
};
scrollListener = function (e) {
// Don't measure (which forces) reflow for scrolls that happen inside of children!
if (e.target.className && typeof e.target.className.indexOf === "function" && e.target.className.indexOf("contract-trigger") < 0 && e.target.className.indexOf("expand-trigger") < 0) {
return;
}
const element = this;
resetTriggers(this);
if (this.__resizeRAF__) {
cancelFrame(this.__resizeRAF__);
}
this.__resizeRAF__ = requestFrame(function animationFrame() {
if (checkTriggers(element)) {
element.__resizeLast__.width = element.offsetWidth;
element.__resizeLast__.height = element.offsetHeight;
element.__resizeListeners__.forEach(function forEachResizeListener(fn) {
fn.call(element, e);
});
}
});
};
/* Detect CSS Animations support to detect element display/re-attach */
let animation = false;
let keyframeprefix = "";
animationStartEvent = "animationstart";
const domPrefixes = "Webkit Moz O ms".split(" ");
let startEvents = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" ");
let pfx = "";
{
const elm = document.createElement("fakeelement");
if (elm.style.animationName !== undefined) {
animation = true;
}
if (animation === false) {
for (let i = 0; i < domPrefixes.length; i++) {
if (elm.style[domPrefixes[i] + "AnimationName"] !== undefined) {
pfx = domPrefixes[i];
keyframeprefix = "-" + pfx.toLowerCase() + "-";
animationStartEvent = startEvents[i];
animation = true;
break;
}
}
}
}
animationName = "resizeanim";
animationKeyframes = "@" + keyframeprefix + "keyframes " + animationName + " { from { opacity: 0; } to { opacity: 0; } } ";
animationStyle = keyframeprefix + "animation: 1ms " + animationName + "; ";
}
const createStyles = function (doc) {
if (!doc.getElementById("detectElementResize")) {
//opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360
const css = (animationKeyframes ? animationKeyframes : "") + ".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " + '.resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',
head = doc.head || doc.getElementsByTagName("head")[0],
style = doc.createElement("style");
style.id = "detectElementResize";
style.type = "text/css";
if (nonce != null) {
style.setAttribute("nonce", nonce);
}
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(doc.createTextNode(css));
}
head.appendChild(style);
}
};
const addResizeListener = function (element, fn) {
if (attachEvent) {
element.attachEvent("onresize", fn);
} else {
if (!element.__resizeTriggers__) {
const doc = element.ownerDocument;
const elementStyle = windowObject.getComputedStyle(element);
if (elementStyle && elementStyle.position === "static") {
element.style.position = "relative";
}
createStyles(doc);
element.__resizeLast__ = {};
element.__resizeListeners__ = [];
(element.__resizeTriggers__ = doc.createElement("div")).className = "resize-triggers";
const expandTrigger = doc.createElement("div");
expandTrigger.className = "expand-trigger";
expandTrigger.appendChild(doc.createElement("div"));
const contractTrigger = doc.createElement("div");
contractTrigger.className = "contract-trigger";
element.__resizeTriggers__.appendChild(expandTrigger);
element.__resizeTriggers__.appendChild(contractTrigger);
element.appendChild(element.__resizeTriggers__);
resetTriggers(element);
element.addEventListener("scroll", scrollListener, true);
/* Listen for a css animation to detect element display/re-attach */
if (animationStartEvent) {
element.__resizeTriggers__.__animationListener__ = function animationListener(e) {
if (e.animationName === animationName) {
resetTriggers(element);
}
};
element.__resizeTriggers__.addEventListener(animationStartEvent, element.__resizeTriggers__.__animationListener__);
}
}
element.__resizeListeners__.push(fn);
}
};
const removeResizeListener = function (element, fn) {
if (attachEvent) {
element.detachEvent("onresize", fn);
} else {
element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
if (!element.__resizeListeners__.length) {
element.removeEventListener("scroll", scrollListener, true);
if (element.__resizeTriggers__.__animationListener__) {
element.__resizeTriggers__.removeEventListener(animationStartEvent, element.__resizeTriggers__.__animationListener__);
element.__resizeTriggers__.__animationListener__ = null;
}
try {
element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__);
} catch (e) {
// Preact compat; see developit/preact-compat/issues/228
}
}
}
};
return {
addResizeListener,
removeResizeListener
};
}
class AutoSizer extends react.Component {
constructor(...args) {
super(...args);
this.state = {
height: this.props.defaultHeight || 0,
scaledHeight: this.props.defaultHeight || 0,
scaledWidth: this.props.defaultWidth || 0,
width: this.props.defaultWidth || 0
};
this._autoSizer = null;
this._detectElementResize = null;
this._parentNode = null;
this._resizeObserver = null;
this._timeoutId = null;
this._onResize = () => {
this._timeoutId = null;
const {
disableHeight,
disableWidth,
onResize
} = this.props;
if (this._parentNode) {
// Guard against AutoSizer component being removed from the DOM immediately after being added.
// This can result in invalid style values which can result in NaN values if we don't handle them.
// See issue #150 for more context.
const style = window.getComputedStyle(this._parentNode) || {};
const paddingLeft = parseFloat(style.paddingLeft || "0");
const paddingRight = parseFloat(style.paddingRight || "0");
const paddingTop = parseFloat(style.paddingTop || "0");
const paddingBottom = parseFloat(style.paddingBottom || "0");
const rect = this._parentNode.getBoundingClientRect();
const scaledHeight = rect.height - paddingTop - paddingBottom;
const scaledWidth = rect.width - paddingLeft - paddingRight;
const height = this._parentNode.offsetHeight - paddingTop - paddingBottom;
const width = this._parentNode.offsetWidth - paddingLeft - paddingRight;
if (!disableHeight && (this.state.height !== height || this.state.scaledHeight !== scaledHeight) || !disableWidth && (this.state.width !== width || this.state.scaledWidth !== scaledWidth)) {
this.setState({
height,
width,
scaledHeight,
scaledWidth
});
if (typeof onResize === "function") {
onResize({
height,
scaledHeight,
scaledWidth,
width
});
}
}
}
};
this._setRef = autoSizer => {
this._autoSizer = autoSizer;
};
}
componentDidMount() {
const {
nonce
} = this.props;
const parentNode = this._autoSizer ? this._autoSizer.parentNode : null;
if (parentNode != null && parentNode.ownerDocument && parentNode.ownerDocument.defaultView && parentNode instanceof parentNode.ownerDocument.defaultView.HTMLElement) {
// Delay access of parentNode until mount.
// This handles edge-cases where the component has already been unmounted before its ref has been set,
// As well as libraries like react-lite which have a slightly different lifecycle.
this._parentNode = parentNode;
// Use ResizeObserver from the same context where parentNode (which we will observe) was defined
// Using just global can result into onResize events not being emitted in cases with multiple realms
const ResizeObserverInstance = parentNode.ownerDocument.defaultView.ResizeObserver;
if (ResizeObserverInstance != null) {
this._resizeObserver = new ResizeObserverInstance(() => {
// Guard against "ResizeObserver loop limit exceeded" error;
// could be triggered if the state update causes the ResizeObserver handler to run long.
// See https://github.com/bvaughn/react-virtualized-auto-sizer/issues/55
this._timeoutId = setTimeout(this._onResize, 0);
});
this._resizeObserver.observe(parentNode);
} else {
// Defer requiring resize handler in order to support server-side rendering.
// See issue #41
this._detectElementResize = createDetectElementResize(nonce);
this._detectElementResize.addResizeListener(parentNode, this._onResize);
}
this._onResize();
}
}
componentWillUnmount() {
if (this._parentNode) {
if (this._detectElementResize) {
this._detectElementResize.removeResizeListener(this._parentNode, this._onResize);
}
if (this._timeoutId !== null) {
clearTimeout(this._timeoutId);
}
if (this._resizeObserver) {
this._resizeObserver.disconnect();
}
}
}
render() {
const {
children,
defaultHeight,
defaultWidth,
disableHeight = false,
disableWidth = false,
doNotBailOutOnEmptyChildren = false,
nonce,
onResize,
style = {},
tagName = "div",
...rest
} = this.props;
const {
height,
scaledHeight,
scaledWidth,
width
} = this.state;
// Outer div should not force width/height since that may prevent containers from shrinking.
// Inner component should overflow and use calculated width/height.
// See issue #68 for more information.
const outerStyle = {
overflow: "visible"
};
const childParams = {};
// Avoid rendering children before the initial measurements have been collected.
// At best this would just be wasting cycles.
let bailoutOnChildren = false;
if (!disableHeight) {
if (height === 0) {
bailoutOnChildren = true;
}
outerStyle.height = 0;
childParams.height = height;
childParams.scaledHeight = scaledHeight;
}
if (!disableWidth) {
if (width === 0) {
bailoutOnChildren = true;
}
outerStyle.width = 0;
childParams.width = width;
childParams.scaledWidth = scaledWidth;
}
if (doNotBailOutOnEmptyChildren) {
bailoutOnChildren = false;
}
return react.createElement(tagName, {
ref: this._setRef,
style: {
...outerStyle,
...style
},
...rest
}, !bailoutOnChildren && children(childParams));
}
}
function isHeightAndWidthProps(props) {
return props && props.disableHeight !== true && props.disableWidth !== true;
}
function isHeightOnlyProps(props) {
return props && props.disableHeight !== true && props.disableWidth === true;
}
function isWidthOnlyProps(props) {
return props && props.disableHeight === true && props.disableWidth !== true;
}
exports["default"] = AutoSizer;
exports.isHeightAndWidthProps = isHeightAndWidthProps;
exports.isHeightOnlyProps = isHeightOnlyProps;
exports.isWidthOnlyProps = isWidthOnlyProps;

View File

@@ -0,0 +1,6 @@
export {
isHeightAndWidthProps,
isHeightOnlyProps,
isWidthOnlyProps
} from "./react-virtualized-auto-sizer.cjs.js";
export { _default as default } from "./react-virtualized-auto-sizer.cjs.default.js";

View File

@@ -0,0 +1,392 @@
import { Component, createElement } from 'react';
/**
* Detect Element Resize.
* https://github.com/sdecima/javascript-detect-element-resize
* Sebastian Decima
*
* Forked from version 0.5.3; includes the following modifications:
* 1) Guard against unsafe 'window' and 'document' references (to support SSR).
* 2) Defer initialization code via a top-level function wrapper (to support SSR).
* 3) Avoid unnecessary reflows by not measuring size for scroll events bubbling from children.
* 4) Add nonce for style element.
* 5) Use 'export' statement over 'module.exports' assignment
**/
// Check `document` and `window` in case of server-side rendering
let windowObject;
if (typeof window !== "undefined") {
windowObject = window;
// eslint-disable-next-line no-restricted-globals
} else if (typeof self !== "undefined") {
// eslint-disable-next-line no-restricted-globals
windowObject = self;
} else {
windowObject = global;
}
let cancelFrame = null;
let requestFrame = null;
const TIMEOUT_DURATION = 20;
const clearTimeoutFn = windowObject.clearTimeout;
const setTimeoutFn = windowObject.setTimeout;
const cancelAnimationFrameFn = windowObject.cancelAnimationFrame || windowObject.mozCancelAnimationFrame || windowObject.webkitCancelAnimationFrame;
const requestAnimationFrameFn = windowObject.requestAnimationFrame || windowObject.mozRequestAnimationFrame || windowObject.webkitRequestAnimationFrame;
if (cancelAnimationFrameFn == null || requestAnimationFrameFn == null) {
// For environments that don't support animation frame,
// fallback to a setTimeout based approach.
cancelFrame = clearTimeoutFn;
requestFrame = function requestAnimationFrameViaSetTimeout(callback) {
return setTimeoutFn(callback, TIMEOUT_DURATION);
};
} else {
// Counter intuitively, environments that support animation frames can be trickier.
// Chrome's "Throttle non-visible cross-origin iframes" flag can prevent rAFs from being called.
// In this case, we should fallback to a setTimeout() implementation.
cancelFrame = function cancelFrame([animationFrameID, timeoutID]) {
cancelAnimationFrameFn(animationFrameID);
clearTimeoutFn(timeoutID);
};
requestFrame = function requestAnimationFrameWithSetTimeoutFallback(callback) {
const animationFrameID = requestAnimationFrameFn(function animationFrameCallback() {
clearTimeoutFn(timeoutID);
callback();
});
const timeoutID = setTimeoutFn(function timeoutCallback() {
cancelAnimationFrameFn(animationFrameID);
callback();
}, TIMEOUT_DURATION);
return [animationFrameID, timeoutID];
};
}
function createDetectElementResize(nonce) {
let animationKeyframes;
let animationName;
let animationStartEvent;
let animationStyle;
let checkTriggers;
let resetTriggers;
let scrollListener;
const attachEvent = typeof document !== "undefined" && document.attachEvent;
if (!attachEvent) {
resetTriggers = function (element) {
const triggers = element.__resizeTriggers__,
expand = triggers.firstElementChild,
contract = triggers.lastElementChild,
expandChild = expand.firstElementChild;
contract.scrollLeft = contract.scrollWidth;
contract.scrollTop = contract.scrollHeight;
expandChild.style.width = expand.offsetWidth + 1 + "px";
expandChild.style.height = expand.offsetHeight + 1 + "px";
expand.scrollLeft = expand.scrollWidth;
expand.scrollTop = expand.scrollHeight;
};
checkTriggers = function (element) {
return element.offsetWidth !== element.__resizeLast__.width || element.offsetHeight !== element.__resizeLast__.height;
};
scrollListener = function (e) {
// Don't measure (which forces) reflow for scrolls that happen inside of children!
if (e.target.className && typeof e.target.className.indexOf === "function" && e.target.className.indexOf("contract-trigger") < 0 && e.target.className.indexOf("expand-trigger") < 0) {
return;
}
const element = this;
resetTriggers(this);
if (this.__resizeRAF__) {
cancelFrame(this.__resizeRAF__);
}
this.__resizeRAF__ = requestFrame(function animationFrame() {
if (checkTriggers(element)) {
element.__resizeLast__.width = element.offsetWidth;
element.__resizeLast__.height = element.offsetHeight;
element.__resizeListeners__.forEach(function forEachResizeListener(fn) {
fn.call(element, e);
});
}
});
};
/* Detect CSS Animations support to detect element display/re-attach */
let animation = false;
let keyframeprefix = "";
animationStartEvent = "animationstart";
const domPrefixes = "Webkit Moz O ms".split(" ");
let startEvents = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" ");
let pfx = "";
{
const elm = document.createElement("fakeelement");
if (elm.style.animationName !== undefined) {
animation = true;
}
if (animation === false) {
for (let i = 0; i < domPrefixes.length; i++) {
if (elm.style[domPrefixes[i] + "AnimationName"] !== undefined) {
pfx = domPrefixes[i];
keyframeprefix = "-" + pfx.toLowerCase() + "-";
animationStartEvent = startEvents[i];
animation = true;
break;
}
}
}
}
animationName = "resizeanim";
animationKeyframes = "@" + keyframeprefix + "keyframes " + animationName + " { from { opacity: 0; } to { opacity: 0; } } ";
animationStyle = keyframeprefix + "animation: 1ms " + animationName + "; ";
}
const createStyles = function (doc) {
if (!doc.getElementById("detectElementResize")) {
//opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360
const css = (animationKeyframes ? animationKeyframes : "") + ".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " + '.resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',
head = doc.head || doc.getElementsByTagName("head")[0],
style = doc.createElement("style");
style.id = "detectElementResize";
style.type = "text/css";
if (nonce != null) {
style.setAttribute("nonce", nonce);
}
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(doc.createTextNode(css));
}
head.appendChild(style);
}
};
const addResizeListener = function (element, fn) {
if (attachEvent) {
element.attachEvent("onresize", fn);
} else {
if (!element.__resizeTriggers__) {
const doc = element.ownerDocument;
const elementStyle = windowObject.getComputedStyle(element);
if (elementStyle && elementStyle.position === "static") {
element.style.position = "relative";
}
createStyles(doc);
element.__resizeLast__ = {};
element.__resizeListeners__ = [];
(element.__resizeTriggers__ = doc.createElement("div")).className = "resize-triggers";
const expandTrigger = doc.createElement("div");
expandTrigger.className = "expand-trigger";
expandTrigger.appendChild(doc.createElement("div"));
const contractTrigger = doc.createElement("div");
contractTrigger.className = "contract-trigger";
element.__resizeTriggers__.appendChild(expandTrigger);
element.__resizeTriggers__.appendChild(contractTrigger);
element.appendChild(element.__resizeTriggers__);
resetTriggers(element);
element.addEventListener("scroll", scrollListener, true);
/* Listen for a css animation to detect element display/re-attach */
if (animationStartEvent) {
element.__resizeTriggers__.__animationListener__ = function animationListener(e) {
if (e.animationName === animationName) {
resetTriggers(element);
}
};
element.__resizeTriggers__.addEventListener(animationStartEvent, element.__resizeTriggers__.__animationListener__);
}
}
element.__resizeListeners__.push(fn);
}
};
const removeResizeListener = function (element, fn) {
if (attachEvent) {
element.detachEvent("onresize", fn);
} else {
element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
if (!element.__resizeListeners__.length) {
element.removeEventListener("scroll", scrollListener, true);
if (element.__resizeTriggers__.__animationListener__) {
element.__resizeTriggers__.removeEventListener(animationStartEvent, element.__resizeTriggers__.__animationListener__);
element.__resizeTriggers__.__animationListener__ = null;
}
try {
element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__);
} catch (e) {
// Preact compat; see developit/preact-compat/issues/228
}
}
}
};
return {
addResizeListener,
removeResizeListener
};
}
class AutoSizer extends Component {
constructor(...args) {
super(...args);
this.state = {
height: this.props.defaultHeight || 0,
scaledHeight: this.props.defaultHeight || 0,
scaledWidth: this.props.defaultWidth || 0,
width: this.props.defaultWidth || 0
};
this._autoSizer = null;
this._detectElementResize = null;
this._parentNode = null;
this._resizeObserver = null;
this._timeoutId = null;
this._onResize = () => {
this._timeoutId = null;
const {
disableHeight,
disableWidth,
onResize
} = this.props;
if (this._parentNode) {
// Guard against AutoSizer component being removed from the DOM immediately after being added.
// This can result in invalid style values which can result in NaN values if we don't handle them.
// See issue #150 for more context.
const style = window.getComputedStyle(this._parentNode) || {};
const paddingLeft = parseFloat(style.paddingLeft || "0");
const paddingRight = parseFloat(style.paddingRight || "0");
const paddingTop = parseFloat(style.paddingTop || "0");
const paddingBottom = parseFloat(style.paddingBottom || "0");
const rect = this._parentNode.getBoundingClientRect();
const scaledHeight = rect.height - paddingTop - paddingBottom;
const scaledWidth = rect.width - paddingLeft - paddingRight;
const height = this._parentNode.offsetHeight - paddingTop - paddingBottom;
const width = this._parentNode.offsetWidth - paddingLeft - paddingRight;
if (!disableHeight && (this.state.height !== height || this.state.scaledHeight !== scaledHeight) || !disableWidth && (this.state.width !== width || this.state.scaledWidth !== scaledWidth)) {
this.setState({
height,
width,
scaledHeight,
scaledWidth
});
if (typeof onResize === "function") {
onResize({
height,
scaledHeight,
scaledWidth,
width
});
}
}
}
};
this._setRef = autoSizer => {
this._autoSizer = autoSizer;
};
}
componentDidMount() {
const {
nonce
} = this.props;
const parentNode = this._autoSizer ? this._autoSizer.parentNode : null;
if (parentNode != null && parentNode.ownerDocument && parentNode.ownerDocument.defaultView && parentNode instanceof parentNode.ownerDocument.defaultView.HTMLElement) {
// Delay access of parentNode until mount.
// This handles edge-cases where the component has already been unmounted before its ref has been set,
// As well as libraries like react-lite which have a slightly different lifecycle.
this._parentNode = parentNode;
// Use ResizeObserver from the same context where parentNode (which we will observe) was defined
// Using just global can result into onResize events not being emitted in cases with multiple realms
const ResizeObserverInstance = parentNode.ownerDocument.defaultView.ResizeObserver;
if (ResizeObserverInstance != null) {
this._resizeObserver = new ResizeObserverInstance(() => {
// Guard against "ResizeObserver loop limit exceeded" error;
// could be triggered if the state update causes the ResizeObserver handler to run long.
// See https://github.com/bvaughn/react-virtualized-auto-sizer/issues/55
this._timeoutId = setTimeout(this._onResize, 0);
});
this._resizeObserver.observe(parentNode);
} else {
// Defer requiring resize handler in order to support server-side rendering.
// See issue #41
this._detectElementResize = createDetectElementResize(nonce);
this._detectElementResize.addResizeListener(parentNode, this._onResize);
}
this._onResize();
}
}
componentWillUnmount() {
if (this._parentNode) {
if (this._detectElementResize) {
this._detectElementResize.removeResizeListener(this._parentNode, this._onResize);
}
if (this._timeoutId !== null) {
clearTimeout(this._timeoutId);
}
if (this._resizeObserver) {
this._resizeObserver.disconnect();
}
}
}
render() {
const {
children,
defaultHeight,
defaultWidth,
disableHeight = false,
disableWidth = false,
doNotBailOutOnEmptyChildren = false,
nonce,
onResize,
style = {},
tagName = "div",
...rest
} = this.props;
const {
height,
scaledHeight,
scaledWidth,
width
} = this.state;
// Outer div should not force width/height since that may prevent containers from shrinking.
// Inner component should overflow and use calculated width/height.
// See issue #68 for more information.
const outerStyle = {
overflow: "visible"
};
const childParams = {};
// Avoid rendering children before the initial measurements have been collected.
// At best this would just be wasting cycles.
let bailoutOnChildren = false;
if (!disableHeight) {
if (height === 0) {
bailoutOnChildren = true;
}
outerStyle.height = 0;
childParams.height = height;
childParams.scaledHeight = scaledHeight;
}
if (!disableWidth) {
if (width === 0) {
bailoutOnChildren = true;
}
outerStyle.width = 0;
childParams.width = width;
childParams.scaledWidth = scaledWidth;
}
if (doNotBailOutOnEmptyChildren) {
bailoutOnChildren = false;
}
return createElement(tagName, {
ref: this._setRef,
style: {
...outerStyle,
...style
},
...rest
}, !bailoutOnChildren && children(childParams));
}
}
function isHeightAndWidthProps(props) {
return props && props.disableHeight !== true && props.disableWidth !== true;
}
function isHeightOnlyProps(props) {
return props && props.disableHeight !== true && props.disableWidth === true;
}
function isWidthOnlyProps(props) {
return props && props.disableHeight === true && props.disableWidth !== true;
}
export { AutoSizer as default, isHeightAndWidthProps, isHeightOnlyProps, isWidthOnlyProps };

95
node_modules/react-virtualized-auto-sizer/package.json generated vendored Normal file
View File

@@ -0,0 +1,95 @@
{
"name": "react-virtualized-auto-sizer",
"version": "1.0.24",
"description": "Standalone version of the AutoSizer component from react-virtualized",
"author": "Brian Vaughn <brian.david.vaughn@gmail.com> (https://github.com/bvaughn/)",
"contributors": [
"Brian Vaughn <brian.david.vaughn@gmail.com> (https://github.com/bvaughn/)"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/bvaughn/react-virtualized-auto-sizer.git"
},
"keywords": [
"react",
"reactjs",
"virtual",
"window",
"windowed",
"list",
"scrolling",
"infinite",
"virtualized",
"table",
"grid",
"spreadsheet"
],
"main": "dist/react-virtualized-auto-sizer.cjs.js",
"module": "dist/react-virtualized-auto-sizer.esm.js",
"exports": {
".": {
"types": {
"import": "./dist/react-virtualized-auto-sizer.cjs.mjs",
"default": "./dist/react-virtualized-auto-sizer.cjs.js"
},
"module": "./dist/react-virtualized-auto-sizer.esm.js",
"import": "./dist/react-virtualized-auto-sizer.cjs.mjs",
"default": "./dist/react-virtualized-auto-sizer.cjs.js"
},
"./package.json": "./package.json"
},
"types": "dist/react-virtualized-auto-sizer.cjs.d.ts",
"files": [
"dist"
],
"scripts": {
"clear": "npm run clear:builds & npm run clear:node_modules",
"clear:builds": "rm -rf ./dist",
"clear:node_modules": "rm -rf ./node_modules",
"prerelease": "preconstruct build",
"prettier": "prettier --write \"**/*.{css,html,js,json,jsx,ts,tsx}\"",
"prettier:ci": "prettier --check \"**/*.{css,html,js,json,jsx,ts,tsx}\"",
"test": "jest",
"test:watch": "jest --watch",
"typescript": "tsc --noEmit",
"typescript:watch": "tsc --noEmit --watch"
},
"lint-staged": {
"{example,src}/**/*.{js,json,css}": [
"prettier --write",
"git add"
],
"**/*.js": "eslint --max-warnings 0"
},
"devDependencies": {
"@babel/core": "^7.21.4",
"@babel/helper-create-class-features-plugin": "^7.21.4",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
"@babel/preset-typescript": "^7.21.5",
"@preconstruct/cli": "^2.8.1",
"@types/jest": "^26.0.15",
"@types/react": "^18",
"@types/react-dom": "^18",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"prettier": "^2.8.6",
"react": "^18",
"react-dom": "^18",
"ts-jest": "^29.1.0",
"typescript": "^4.1.2"
},
"peerDependencies": {
"react": "^15.3.0 || ^16.0.0-alpha || ^17.0.0 || ^18.0.0",
"react-dom": "^15.3.0 || ^16.0.0-alpha || ^17.0.0 || ^18.0.0"
},
"preconstruct": {
"exports": {
"importConditionDefaultExport": "default"
},
"___experimentalFlags_WILL_CHANGE_IN_PATCH": {
"importsConditions": true
}
}
}