UNPKG

react-virtualized

Version:

React components for efficiently rendering large, scrollable lists and tabular data

764 lines (758 loc) 282 kB
((global, factory) => { "object" == typeof exports && "undefined" != typeof module ? factory(exports, require("react")) : "function" == typeof define && define.amd ? define([ "exports", "react" ], factory) : factory((global = global || self).ReactVirtualized = {}, global.React); })(this, function(exports, React) { var React__default = "default" in React ? React.default : React; function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } function _callSuper(t, o, e) { return o = _getPrototypeOf(o), ((t, e) => { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return (e => { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; })(t); })(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } function _extends() { return (_extends = Object.assign ? Object.assign.bind() : function(n) { for (var e = 1; e < arguments.length; e++) { var r, t = arguments[e]; for (r in t) !{}.hasOwnProperty.call(t, r) || (n[r] = t[r]); } return n; }).apply(null, arguments); } function _getPrototypeOf(t) { return (_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) { return t.__proto__ || Object.getPrototypeOf(t); })(t); } function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); } catch (t) {} return (_isNativeReflectConstruct = function() { return !!t; })(); } function ownKeys(e, r) { var o, t = Object.keys(e); return Object.getOwnPropertySymbols && (o = Object.getOwnPropertySymbols(e), r && (o = o.filter(function(r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o)), t; } function _objectSpread2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function(r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, i = ((r, e) => { if (null == r) return {}; var n, t = {}; for (n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; })(e, t); if (Object.getOwnPropertySymbols) for (var s = Object.getOwnPropertySymbols(e), r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); return i; } function _setPrototypeOf(t, e) { return (_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) { return t.__proto__ = e, t; })(t, e); } function _slicedToArray(r, e) { return (r => { if (Array.isArray(r)) return r; })(r) || ((r, l) => { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (;!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } })(r, e) || _unsupportedIterableToArray(r, e) || (() => { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); })(); } function _toConsumableArray(r) { return (r => { if (Array.isArray(r)) return _arrayLikeToArray(r); })(r) || (r => { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); })(r) || _unsupportedIterableToArray(r) || (() => { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); })(); } function _toPropertyKey(t) { t = ((t, r) => { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 === e) return ("string" === r ? String : Number)(t); if ("object" != typeof (e = e.call(t, r || "default"))) return e; throw new TypeError("@@toPrimitive must return a primitive value."); })(t, "string"); return "symbol" == typeof t ? t : t + ""; } function _typeof(o) { return (_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) { return typeof o; } : function(o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; })(o); } function _unsupportedIterableToArray(r, a) { var t; if (r) return "string" == typeof r ? _arrayLikeToArray(r, a) : "Map" === (t = "Object" === (t = {}.toString.call(r).slice(8, -1)) && r.constructor ? r.constructor.name : t) || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ function componentWillMount() { // Call this.constructor.gDSFP to support sub-classes. var state = this.constructor.getDerivedStateFromProps(this.props, this.state); null != state && this.setState(state); } function componentWillReceiveProps(nextProps) { // Binding "this" is important for shallow renderer support. this.setState( // Call this.constructor.gDSFP to support sub-classes. // Use the setState() updater to ensure state isn't stale in certain edge cases. function(prevState) { return null != (prevState = this.constructor.getDerivedStateFromProps(nextProps, prevState)) ? prevState : null; }.bind(this)); } function componentWillUpdate(nextProps, nextState) { try { var prevProps = this.props, prevState = this.state; this.props = nextProps, this.state = nextState, this.__reactInternalSnapshotFlag = !0, this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate(prevProps, prevState); } finally { this.props = prevProps, this.state = prevState; } } // React may warn about cWM/cWRP/cWU methods being deprecated. // Add a flag to suppress these warnings for this special case. function polyfill(Component) { var prototype = Component.prototype; if (!prototype || !prototype.isReactComponent) throw new Error("Can only polyfill class components"); if ("function" == typeof Component.getDerivedStateFromProps || "function" == typeof prototype.getSnapshotBeforeUpdate) { // If new component APIs are defined, "unsafe" lifecycles won't be called. // Error if any of these lifecycles are present, // Because they would work differently between older and newer (16.3+) versions of React. var componentName, foundWillMountName = null, foundWillReceivePropsName = null, foundWillUpdateName = null; if ("function" == typeof prototype.componentWillMount ? foundWillMountName = "componentWillMount" : "function" == typeof prototype.UNSAFE_componentWillMount && (foundWillMountName = "UNSAFE_componentWillMount"), "function" == typeof prototype.componentWillReceiveProps ? foundWillReceivePropsName = "componentWillReceiveProps" : "function" == typeof prototype.UNSAFE_componentWillReceiveProps && (foundWillReceivePropsName = "UNSAFE_componentWillReceiveProps"), "function" == typeof prototype.componentWillUpdate ? foundWillUpdateName = "componentWillUpdate" : "function" == typeof prototype.UNSAFE_componentWillUpdate && (foundWillUpdateName = "UNSAFE_componentWillUpdate"), null !== foundWillMountName || null !== foundWillReceivePropsName || null !== foundWillUpdateName) throw componentName = Component.displayName || Component.name, Error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n" + componentName + " uses " + ("function" == typeof Component.getDerivedStateFromProps ? "getDerivedStateFromProps()" : "getSnapshotBeforeUpdate()") + " but also contains the following legacy lifecycles:" + (null !== foundWillMountName ? "\n " + foundWillMountName : "") + (null !== foundWillReceivePropsName ? "\n " + foundWillReceivePropsName : "") + (null !== foundWillUpdateName ? "\n " + foundWillUpdateName : "") + "\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks"); // React <= 16.2 does not support static getDerivedStateFromProps. // As a workaround, use cWM and cWRP to invoke the new static lifecycle. // Newer versions of React will ignore these lifecycles if gDSFP exists. // React <= 16.2 does not support getSnapshotBeforeUpdate. // As a workaround, use cWU to invoke the new lifecycle. // Newer versions of React will ignore that lifecycle if gSBU exists. if ("function" == typeof Component.getDerivedStateFromProps && (prototype.componentWillMount = componentWillMount, prototype.componentWillReceiveProps = componentWillReceiveProps), "function" == typeof prototype.getSnapshotBeforeUpdate) { if ("function" != typeof prototype.componentDidUpdate) throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype"); prototype.componentWillUpdate = componentWillUpdate; var componentDidUpdate = prototype.componentDidUpdate; prototype.componentDidUpdate = function(prevProps, prevState, maybeSnapshot) { // 16.3+ will not execute our will-update method; // It will pass a snapshot value to did-update though. // Older versions will require our polyfilled will-update value. // We need to handle both cases, but can't just check for the presence of "maybeSnapshot", // Because for <= 15.x versions this might be a "prevContext" object. // We also can't just check "__reactInternalSnapshot", // Because get-snapshot might return a falsy value. // So check for the explicit __reactInternalSnapshotFlag flag to determine behavior. maybeSnapshot = this.__reactInternalSnapshotFlag ? this.__reactInternalSnapshot : maybeSnapshot; componentDidUpdate.call(this, prevProps, prevState, maybeSnapshot); }; } } } componentWillUpdate.__suppressDeprecationWarning = componentWillReceiveProps.__suppressDeprecationWarning = componentWillMount.__suppressDeprecationWarning = !0; var ArrowKeyStepper = (() => { function ArrowKeyStepper() { var _this; _classCallCheck(this, ArrowKeyStepper); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key]; return _defineProperty(_this = _callSuper(this, ArrowKeyStepper, [].concat(args)), "state", { scrollToColumn: 0, scrollToRow: 0, instanceProps: { prevScrollToColumn: 0, prevScrollToRow: 0 } }), _defineProperty(_this, "_columnStartIndex", 0), _defineProperty(_this, "_columnStopIndex", 0), _defineProperty(_this, "_rowStartIndex", 0), _defineProperty(_this, "_rowStopIndex", 0), _defineProperty(_this, "_onKeyDown", function(event) { var _this$props = _this.props, columnCount = _this$props.columnCount, disabled = _this$props.disabled, mode = _this$props.mode, rowCount = _this$props.rowCount; if (!disabled) { var _this$props = _this._getScrollState(), disabled = _this$props.scrollToColumn, _this$props = _this$props.scrollToRow, _this$_getScrollState2 = _this._getScrollState(), scrollToColumn = _this$_getScrollState2.scrollToColumn, scrollToRow = _this$_getScrollState2.scrollToRow; switch (event.key) { case "ArrowDown": scrollToRow = "cells" === mode ? Math.min(scrollToRow + 1, rowCount - 1) : Math.min(_this._rowStopIndex + 1, rowCount - 1); break; case "ArrowLeft": scrollToColumn = "cells" === mode ? Math.max(scrollToColumn - 1, 0) : Math.max(_this._columnStartIndex - 1, 0); break; case "ArrowRight": scrollToColumn = "cells" === mode ? Math.min(scrollToColumn + 1, columnCount - 1) : Math.min(_this._columnStopIndex + 1, columnCount - 1); break; case "ArrowUp": scrollToRow = "cells" === mode ? Math.max(scrollToRow - 1, 0) : Math.max(_this._rowStartIndex - 1, 0); } scrollToColumn === disabled && scrollToRow === _this$props || (event.preventDefault(), _this._updateScrollState({ scrollToColumn: scrollToColumn, scrollToRow: scrollToRow })); } }), _defineProperty(_this, "_onSectionRendered", function(_ref) { var columnStartIndex = _ref.columnStartIndex, columnStopIndex = _ref.columnStopIndex, rowStartIndex = _ref.rowStartIndex, _ref = _ref.rowStopIndex; _this._columnStartIndex = columnStartIndex, _this._columnStopIndex = columnStopIndex, _this._rowStartIndex = rowStartIndex, _this._rowStopIndex = _ref; }), _this; } return _inherits(ArrowKeyStepper, React.PureComponent), _createClass(ArrowKeyStepper, [ { key: "setScrollIndexes", value: function(_ref2) { var scrollToColumn = _ref2.scrollToColumn; this.setState({ scrollToRow: _ref2.scrollToRow, scrollToColumn: scrollToColumn }); } }, { key: "render", value: function() { var _this$props2 = this.props, className = _this$props2.className, _this$props2 = _this$props2.children, _this$_getScrollState3 = this._getScrollState(), scrollToColumn = _this$_getScrollState3.scrollToColumn; return React.createElement("div", { className: className, onKeyDown: this._onKeyDown }, _this$props2({ onSectionRendered: this._onSectionRendered, scrollToColumn: scrollToColumn, scrollToRow: _this$_getScrollState3.scrollToRow })); } }, { key: "_getScrollState", value: function() { return this.props.isControlled ? this.props : this.state; } }, { key: "_updateScrollState", value: function(_ref3) { var scrollToColumn = _ref3.scrollToColumn, _ref3 = _ref3.scrollToRow, _this$props3 = this.props, isControlled = _this$props3.isControlled, _this$props3 = _this$props3.onScrollToChange; "function" == typeof _this$props3 && _this$props3({ scrollToColumn: scrollToColumn, scrollToRow: _ref3 }), isControlled || this.setState({ scrollToColumn: scrollToColumn, scrollToRow: _ref3 }); } } ], [ { key: "getDerivedStateFromProps", value: function(nextProps, prevState) { return !nextProps.isControlled && (nextProps.scrollToColumn !== prevState.instanceProps.prevScrollToColumn || nextProps.scrollToRow !== prevState.instanceProps.prevScrollToRow) ? _objectSpread2(_objectSpread2({}, prevState), {}, { scrollToColumn: nextProps.scrollToColumn, scrollToRow: nextProps.scrollToRow, instanceProps: { prevScrollToColumn: nextProps.scrollToColumn, prevScrollToRow: nextProps.scrollToRow } }) : {}; } } ]); })(); function createDetectElementResize(nonce, hostWindow) { var cancel, raf, _window = void 0 !== hostWindow ? hostWindow : "undefined" != typeof window ? window : "undefined" != typeof self ? self : global, attachEvent = void 0 !== _window.document && _window.document.attachEvent; if (!attachEvent) { raf = _window.requestAnimationFrame || _window.mozRequestAnimationFrame || _window.webkitRequestAnimationFrame || function(fn) { return _window.setTimeout(fn, 20); }; var requestFrame = function(fn) { return raf(fn); }, cancelFrame = (cancel = _window.cancelAnimationFrame || _window.mozCancelAnimationFrame || _window.webkitCancelAnimationFrame || _window.clearTimeout, function(id) { return cancel(id); }), resetTriggers = function(element) { var element = element.__resizeTriggers__, expand = element.firstElementChild, element = element.lastElementChild, expandChild = expand.firstElementChild; element.scrollLeft = element.scrollWidth, element.scrollTop = element.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) { var element; e.target.className && "function" == typeof e.target.className.indexOf && e.target.className.indexOf("contract-trigger") < 0 && e.target.className.indexOf("expand-trigger") < 0 || (resetTriggers(element = this), this.__resizeRAF__ && cancelFrame(this.__resizeRAF__), this.__resizeRAF__ = requestFrame(function() { checkTriggers(element) && (element.__resizeLast__.width = element.offsetWidth, element.__resizeLast__.height = element.offsetHeight, element.__resizeListeners__.forEach(function(fn) { fn.call(element, e); })); })); }, animation = !1, keyframeprefix = "", animationstartevent = "animationstart", domPrefixes = "Webkit Moz O ms".split(" "), startEvents = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "), elm = _window.document.createElement("fakeelement"); if (!1 === (animation = void 0 !== elm.style.animationName ? !0 : animation)) for (var i = 0; i < domPrefixes.length; i++) if (void 0 !== elm.style[domPrefixes[i] + "AnimationName"]) { keyframeprefix = "-" + domPrefixes[i].toLowerCase() + "-", animationstartevent = startEvents[i], animation = !0; break; } var animationName = "resizeanim", animationKeyframes = "@" + keyframeprefix + "keyframes " + animationName + " { from { opacity: 0; } to { opacity: 0; } } ", animationStyle = keyframeprefix + "animation: 1ms " + animationName + "; "; } return { addResizeListener: function(element, fn) { var elementStyle, doc; attachEvent ? element.attachEvent("onresize", fn) : (element.__resizeTriggers__ || (doc = element.ownerDocument, (elementStyle = _window.getComputedStyle(element)) && "static" == elementStyle.position && (element.style.position = "relative"), (doc => { var css, head, style; doc.getElementById("detectElementResize") || (css = (animationKeyframes || "") + ".resize-triggers { " + (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")).id = "detectElementResize", style.type = "text/css", null != nonce && style.setAttribute("nonce", nonce), style.styleSheet ? style.styleSheet.cssText = css : style.appendChild(doc.createTextNode(css)), head.appendChild(style)); })(doc), element.__resizeLast__ = {}, element.__resizeListeners__ = [], (element.__resizeTriggers__ = doc.createElement("div")).className = "resize-triggers", (elementStyle = doc.createElement("div")).className = "expand-trigger", elementStyle.appendChild(doc.createElement("div")), (doc = doc.createElement("div")).className = "contract-trigger", element.__resizeTriggers__.appendChild(elementStyle), element.__resizeTriggers__.appendChild(doc), element.appendChild(element.__resizeTriggers__), resetTriggers(element), element.addEventListener("scroll", scrollListener, !0), animationstartevent && (element.__resizeTriggers__.__animationListener__ = function(e) { e.animationName == animationName && resetTriggers(element); }, element.__resizeTriggers__.addEventListener(animationstartevent, element.__resizeTriggers__.__animationListener__))), element.__resizeListeners__.push(fn)); }, removeResizeListener: function(element, fn) { if (attachEvent) element.detachEvent("onresize", fn); else if (element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1), !element.__resizeListeners__.length) { element.removeEventListener("scroll", scrollListener, !0), element.__resizeTriggers__.__animationListener__ && (element.__resizeTriggers__.removeEventListener(animationstartevent, element.__resizeTriggers__.__animationListener__), element.__resizeTriggers__.__animationListener__ = null); try { element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__); } catch (e) {} } } }; } _defineProperty(ArrowKeyStepper, "defaultProps", { disabled: !1, isControlled: !1, mode: "edges", scrollToColumn: 0, scrollToRow: 0 }), polyfill(ArrowKeyStepper); var AutoSizer = (() => { function AutoSizer() { var _this; _classCallCheck(this, AutoSizer); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key]; return _defineProperty(_this = _callSuper(this, AutoSizer, [].concat(args)), "state", { height: _this.props.defaultHeight || 0, width: _this.props.defaultWidth || 0 }), _defineProperty(_this, "_parentNode", void 0), _defineProperty(_this, "_autoSizer", void 0), _defineProperty(_this, "_window", void 0), _defineProperty(_this, "_detectElementResize", void 0), _defineProperty(_this, "_onResize", function() { var height, width, paddingLeft, paddingRight, paddingTop, style, _this$props = _this.props, disableHeight = _this$props.disableHeight, disableWidth = _this$props.disableWidth, _this$props = _this$props.onResize; _this._parentNode && (height = _this._parentNode.offsetHeight || 0, width = _this._parentNode.offsetWidth || 0, style = (_this._window || window).getComputedStyle(_this._parentNode) || {}, paddingLeft = parseInt(style.paddingLeft, 10) || 0, paddingRight = parseInt(style.paddingRight, 10) || 0, paddingTop = parseInt(style.paddingTop, 10) || 0, style = parseInt(style.paddingBottom, 10) || 0, !disableHeight && _this.state.height !== height - paddingTop - style || !disableWidth && _this.state.width !== width - paddingLeft - paddingRight) && (_this.setState({ height: height - paddingTop - style, width: width - paddingLeft - paddingRight }), _this$props({ height: height, width: width })); }), _defineProperty(_this, "_setRef", function(autoSizer) { _this._autoSizer = autoSizer; }), _this; } return _inherits(AutoSizer, React.Component), _createClass(AutoSizer, [ { key: "componentDidMount", value: function() { var nonce = this.props.nonce; this._autoSizer && this._autoSizer.parentNode && this._autoSizer.parentNode.ownerDocument && this._autoSizer.parentNode.ownerDocument.defaultView && this._autoSizer.parentNode instanceof this._autoSizer.parentNode.ownerDocument.defaultView.HTMLElement && (this._parentNode = this._autoSizer.parentNode, this._window = this._autoSizer.parentNode.ownerDocument.defaultView, this._detectElementResize = createDetectElementResize(nonce, this._window), this._detectElementResize.addResizeListener(this._parentNode, this._onResize), this._onResize()); } }, { key: "componentWillUnmount", value: function() { this._detectElementResize && this._parentNode && this._detectElementResize.removeResizeListener(this._parentNode, this._onResize); } }, { key: "render", value: function() { var _this$props2 = this.props, children = _this$props2.children, className = _this$props2.className, disableWidth = _this$props2.disableWidth, style = _this$props2.style, _this$state = this.state, height = _this$state.height, _this$state = _this$state.width, outerStyle = { overflow: "visible" }, childParams = {}; return _this$props2.disableHeight || (outerStyle.height = 0, childParams.height = height), disableWidth || (outerStyle.width = 0, childParams.width = _this$state), React.createElement("div", { className: className, ref: this._setRef, style: _objectSpread2(_objectSpread2({}, outerStyle), style) }, children(childParams)); } } ]); })(), CellMeasurer = (_defineProperty(AutoSizer, "defaultProps", { onResize: function() {}, disableHeight: !1, disableWidth: !1, style: {} }), (() => { function CellMeasurer() { var _this; _classCallCheck(this, CellMeasurer); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key]; return _defineProperty(_this = _callSuper(this, CellMeasurer, [].concat(args)), "_child", React.createRef()), _defineProperty(_this, "_measure", function() { var _this$props = _this.props, cache = _this$props.cache, _this$props$columnInd = _this$props.columnIndex, _this$props$columnInd = void 0 === _this$props$columnInd ? 0 : _this$props$columnInd, parent = _this$props.parent, _this$props = _this$props.rowIndex, _this$props = void 0 === _this$props ? _this.props.index || 0 : _this$props, _this$_getCellMeasure = _this._getCellMeasurements(), height = _this$_getCellMeasure.height, _this$_getCellMeasure = _this$_getCellMeasure.width; height === cache.getHeight(_this$props, _this$props$columnInd) && _this$_getCellMeasure === cache.getWidth(_this$props, _this$props$columnInd) || (cache.set(_this$props, _this$props$columnInd, _this$_getCellMeasure, height), parent && "function" == typeof parent.recomputeGridSize && parent.recomputeGridSize({ columnIndex: _this$props$columnInd, rowIndex: _this$props })); }), _defineProperty(_this, "_registerChild", function(element) { !element || element instanceof Element || console.warn("CellMeasurer registerChild expects to be passed Element or null"), (_this._child.current = element) && _this._maybeMeasureCell(); }), _this; } return _inherits(CellMeasurer, React.PureComponent), _createClass(CellMeasurer, [ { key: "componentDidMount", value: function() { this._maybeMeasureCell(); } }, { key: "componentDidUpdate", value: function() { this._maybeMeasureCell(); } }, { key: "render", value: function() { var _this2 = this, children = this.props.children, resolvedChildren = "function" == typeof children ? children({ measure: this._measure, registerChild: this._registerChild }) : children; return null === resolvedChildren ? resolvedChildren : React.cloneElement(resolvedChildren, { ref: function(node) { "function" == typeof resolvedChildren.ref ? resolvedChildren.ref(node) : resolvedChildren.ref && (resolvedChildren.ref.current = node), _this2._child.current = node; } }); } }, { key: "_getCellMeasurements", value: function() { var styleWidth, styleHeight, width, cache = this.props.cache, node = this._child.current; return node && node.ownerDocument && node.ownerDocument.defaultView && node instanceof node.ownerDocument.defaultView.HTMLElement ? (styleWidth = node.style.width, styleHeight = node.style.height, cache.hasFixedWidth() || (node.style.width = "auto"), cache.hasFixedHeight() || (node.style.height = "auto"), cache = Math.ceil(node.offsetHeight), width = Math.ceil(node.offsetWidth), styleWidth && (node.style.width = styleWidth), styleHeight && (node.style.height = styleHeight), { height: cache, width: width }) : { height: 0, width: 0 }; } }, { key: "_maybeMeasureCell", value: function() { var _this$_getCellMeasure2, height, _this$props2 = this.props, cache = _this$props2.cache, _this$props2$columnIn = _this$props2.columnIndex, _this$props2$columnIn = void 0 === _this$props2$columnIn ? 0 : _this$props2$columnIn, parent = _this$props2.parent, _this$props2 = _this$props2.rowIndex, _this$props2 = void 0 === _this$props2 ? this.props.index || 0 : _this$props2; cache.has(_this$props2, _this$props2$columnIn) || (height = (_this$_getCellMeasure2 = this._getCellMeasurements()).height, cache.set(_this$props2, _this$props2$columnIn, _this$_getCellMeasure2.width, height), parent && "function" == typeof parent.invalidateCellSizeAfterRender && parent.invalidateCellSizeAfterRender({ columnIndex: _this$props2$columnIn, rowIndex: _this$props2 })); } } ]); })()), CellMeasurerCache = (_defineProperty(CellMeasurer, "__internalCellMeasurerFlag", !1), CellMeasurer.__internalCellMeasurerFlag = !0, _createClass(function CellMeasurerCache() { var _this = this, params = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, defaultHeight = (_classCallCheck(this, CellMeasurerCache), _defineProperty(this, "_cellHeightCache", {}), _defineProperty(this, "_cellWidthCache", {}), _defineProperty(this, "_columnWidthCache", {}), _defineProperty(this, "_rowHeightCache", {}), _defineProperty(this, "_defaultHeight", void 0), _defineProperty(this, "_defaultWidth", void 0), _defineProperty(this, "_minHeight", void 0), _defineProperty(this, "_minWidth", void 0), _defineProperty(this, "_keyMapper", void 0), _defineProperty(this, "_hasFixedHeight", void 0), _defineProperty(this, "_hasFixedWidth", void 0), _defineProperty(this, "_columnCount", 0), _defineProperty(this, "_rowCount", 0), _defineProperty(this, "columnWidth", function(_ref) { return _ref = _ref.index, _ref = _this._keyMapper(0, _ref), void 0 !== _this._columnWidthCache[_ref] ? _this._columnWidthCache[_ref] : _this._defaultWidth; }), _defineProperty(this, "rowHeight", function(_ref2) { return _ref2 = _ref2.index, _ref2 = _this._keyMapper(_ref2, 0), void 0 !== _this._rowHeightCache[_ref2] ? _this._rowHeightCache[_ref2] : _this._defaultHeight; }), params.defaultHeight), defaultWidth = params.defaultWidth, fixedWidth = params.fixedWidth, keyMapper = params.keyMapper, minHeight = params.minHeight, minWidth = params.minWidth; this._hasFixedHeight = !0 === params.fixedHeight, this._hasFixedWidth = !0 === fixedWidth, this._minHeight = minHeight || 0, this._minWidth = minWidth || 0, this._keyMapper = keyMapper || defaultKeyMapper, this._defaultHeight = Math.max(this._minHeight, "number" == typeof defaultHeight ? defaultHeight : 30), this._defaultWidth = Math.max(this._minWidth, "number" == typeof defaultWidth ? defaultWidth : 100), !1 === this._hasFixedHeight && !1 === this._hasFixedWidth && console.warn("CellMeasurerCache should only measure a cell's width or height. You have configured CellMeasurerCache to measure both. This will result in poor performance."), !1 === this._hasFixedHeight && 0 === this._defaultHeight && console.warn("Fixed height CellMeasurerCache should specify a :defaultHeight greater than 0. Failing to do so will lead to unnecessary layout and poor performance."), !1 === this._hasFixedWidth && 0 === this._defaultWidth && console.warn("Fixed width CellMeasurerCache should specify a :defaultWidth greater than 0. Failing to do so will lead to unnecessary layout and poor performance."); }, [ { key: "clear", value: function(rowIndex) { var columnIndex = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, key = this._keyMapper(rowIndex, columnIndex); delete this._cellHeightCache[key], delete this._cellWidthCache[key], this._updateCachedColumnAndRowSizes(rowIndex, columnIndex); } }, { key: "clearAll", value: function() { this._cellHeightCache = {}, this._cellWidthCache = {}, this._columnWidthCache = {}, this._rowHeightCache = {}, this._rowCount = 0, this._columnCount = 0; } }, { key: "defaultHeight", get: function() { return this._defaultHeight; } }, { key: "defaultWidth", get: function() { return this._defaultWidth; } }, { key: "hasFixedHeight", value: function() { return this._hasFixedHeight; } }, { key: "hasFixedWidth", value: function() { return this._hasFixedWidth; } }, { key: "getHeight", value: function(rowIndex) { return !this._hasFixedHeight && (rowIndex = this._keyMapper(rowIndex, 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0), void 0 !== this._cellHeightCache[rowIndex]) ? Math.max(this._minHeight, this._cellHeightCache[rowIndex]) : this._defaultHeight; } }, { key: "getWidth", value: function(rowIndex) { return !this._hasFixedWidth && (rowIndex = this._keyMapper(rowIndex, 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0), void 0 !== this._cellWidthCache[rowIndex]) ? Math.max(this._minWidth, this._cellWidthCache[rowIndex]) : this._defaultWidth; } }, { key: "has", value: function(rowIndex) { rowIndex = this._keyMapper(rowIndex, 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0); return void 0 !== this._cellHeightCache[rowIndex]; } }, { key: "set", value: function(rowIndex, columnIndex, width, height) { var key = this._keyMapper(rowIndex, columnIndex); columnIndex >= this._columnCount && (this._columnCount = columnIndex + 1), rowIndex >= this._rowCount && (this._rowCount = rowIndex + 1), this._cellHeightCache[key] = height, this._cellWidthCache[key] = width, this._updateCachedColumnAndRowSizes(rowIndex, columnIndex); } }, { key: "_updateCachedColumnAndRowSizes", value: function(rowIndex, columnIndex) { if (!this._hasFixedWidth) { for (var columnWidth = 0, i = 0; i < this._rowCount; i++) columnWidth = Math.max(columnWidth, this.getWidth(i, columnIndex)); var columnKey = this._keyMapper(0, columnIndex); this._columnWidthCache[columnKey] = columnWidth; } if (!this._hasFixedHeight) { for (var rowHeight = 0, _i = 0; _i < this._columnCount; _i++) rowHeight = Math.max(rowHeight, this.getHeight(rowIndex, _i)); columnKey = this._keyMapper(rowIndex, 0); this._rowHeightCache[columnKey] = rowHeight; } } } ])); function defaultKeyMapper(rowIndex, columnIndex) { return "".concat(rowIndex, "-").concat(columnIndex); } function createCommonjsModule(fn, module) { return fn(module = { exports: {} }, module.exports), module.exports; } var reactIs_development = createCommonjsModule(function(module, exports) { function typeOf(object) { if ("object" == typeof object && null !== object) { var $$typeof = object.$$typeof; switch ($$typeof) { case REACT_ELEMENT_TYPE: var type = object.type; switch (type) { case REACT_ASYNC_MODE_TYPE: case REACT_CONCURRENT_MODE_TYPE: case REACT_FRAGMENT_TYPE: case REACT_PROFILER_TYPE: case REACT_STRICT_MODE_TYPE: case REACT_SUSPENSE_TYPE: return type; default: var $$typeofType = type && type.$$typeof; switch ($$typeofType) { case REACT_CONTEXT_TYPE: case REACT_FORWARD_REF_TYPE: case REACT_LAZY_TYPE: case REACT_MEMO_TYPE: case REACT_PROVIDER_TYPE: return $$typeofType; default: return $$typeof; } } case REACT_PORTAL_TYPE: return $$typeof; } } } // AsyncMode is deprecated along with isAsyncMode function isConcurrentMode(object) { return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; } var hasSymbol, REACT_ELEMENT_TYPE, REACT_PORTAL_TYPE, REACT_FRAGMENT_TYPE, REACT_STRICT_MODE_TYPE, REACT_PROFILER_TYPE, REACT_PROVIDER_TYPE, REACT_CONTEXT_TYPE, REACT_ASYNC_MODE_TYPE, REACT_CONCURRENT_MODE_TYPE, REACT_FORWARD_REF_TYPE, REACT_SUSPENSE_TYPE, REACT_SUSPENSE_LIST_TYPE, REACT_MEMO_TYPE, REACT_LAZY_TYPE, REACT_BLOCK_TYPE, REACT_FUNDAMENTAL_TYPE, REACT_RESPONDER_TYPE, REACT_SCOPE_TYPE, ContextConsumer, ContextProvider, Element, ForwardRef, Fragment, Lazy, Memo, Portal, Profiler, StrictMode, Suspense, hasWarnedAboutDeprecatedIsAsyncMode; hasSymbol = "function" == typeof Symbol && Symbol.for, REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103, REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106, REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107, REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108, REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 60114, REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 60109, REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 60110, REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for("react.async_mode") : 60111, REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for("react.concurrent_mode") : 60111, REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112, REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113, REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for("react.suspense_list") : 60120, REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115, REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116, REACT_BLOCK_TYPE = hasSymbol ? Symbol.for("react.block") : 60121, REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for("react.fundamental") : 60117, REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 60118, REACT_SCOPE_TYPE = hasSymbol ? Symbol.for("react.scope") : 60119, hasSymbol = REACT_CONCURRENT_MODE_TYPE, ContextConsumer = REACT_CONTEXT_TYPE, ContextProvider = REACT_PROVIDER_TYPE, Element = REACT_ELEMENT_TYPE, ForwardRef = REACT_FORWARD_REF_TYPE, Fragment = REACT_FRAGMENT_TYPE, Lazy = REACT_LAZY_TYPE, Memo = REACT_MEMO_TYPE, Portal = REACT_PORTAL_TYPE, Profiler = REACT_PROFILER_TYPE, StrictMode = REACT_STRICT_MODE_TYPE, Suspense = REACT_SUSPENSE_TYPE, hasWarnedAboutDeprecatedIsAsyncMode = !1, exports.AsyncMode = REACT_ASYNC_MODE_TYPE, exports.ConcurrentMode = hasSymbol, exports.ContextConsumer = ContextConsumer, exports.ContextProvider = ContextProvider, exports.Element = Element, exports.ForwardRef = ForwardRef, exports.Fragment = Fragment, exports.Lazy = Lazy, exports.Memo = Memo, exports.Portal = Portal, exports.Profiler = Profiler, exports.StrictMode = StrictMode, exports.Suspense = Suspense, exports.isAsyncMode = // AsyncMode should be deprecated function(object) { return hasWarnedAboutDeprecatedIsAsyncMode || (hasWarnedAboutDeprecatedIsAsyncMode = !0, // Using console['warn'] to evade Babel and ESLint console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; }, exports.isConcurrentMode = isConcurrentMode, exports.isContextConsumer = function(object) { return typeOf(object) === REACT_CONTEXT_TYPE; }, exports.isContextProvider = function(object) { return typeOf(object) === REACT_PROVIDER_TYPE; }, exports.isElement = function(object) { return "object" == typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE; }, exports.isForwardRef = function(object) { return typeOf(object) === REACT_FORWARD_REF_TYPE; }, exports.isFragment = function(object) { return typeOf(object) === REACT_FRAGMENT_TYPE; }, exports.isLazy = function(object) { return typeOf(object) === REACT_LAZY_TYPE; }, exports.isMemo = function(object) { return typeOf(object) === REACT_MEMO_TYPE; }, exports.isPortal = function(object) { return typeOf(object) === REACT_PORTAL_TYPE; }, exports.isProfiler = function(object) { return typeOf(object) === REACT_PROFILER_TYPE; }, exports.isStrictMode = function(object) { return typeOf(object) === REACT_STRICT_MODE_TYPE; }, exports.isSuspense = function(object) { return typeOf(object) === REACT_SUSPENSE_TYPE; }, exports.isValidElementType = function(type) { return "string" == typeof type || "function" == typeof type || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || "object" == typeof type && null !== type && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE); }, exports.typeOf = typeOf; }), reactIs = (reactIs_development.AsyncMode, createCommonjsModule(function(module) { module.exports = reactIs_development; })), getOwnPropertySymbols = Object.getOwnPropertySymbols, hasOwnProperty = Object.prototype.hasOwnProperty, propIsEnumerable = Object.prototype.propertyIsEnumerable; var objectAssign = (() => { try { if (Object.assign) { // Detect buggy property enumeration order in older V8 versions. // https://bugs.chromium.org/p/v8/issues/detail?id=4118 var test1 = new String("abc"); // eslint-disable-line no-new-wrappers if (test1[5] = "de", "5" !== Object.getOwnPropertyNames(test1)[0]) { for ( // https://bugs.chromium.org/p/v8/issues/detail?id=3056 var test2 = {}, i = 0; i < 10; i++) test2["_" + String.fromCharCode(i)] = i; var test3, order2 = Object.getOwn