@depup/react-virtualized 9.22.6-depup.0
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/LICENSE +22 -0
- package/README.md +34 -0
- package/changes.json +22 -0
- package/dist/commonjs/ArrowKeyStepper/ArrowKeyStepper.example.js +184 -0
- package/dist/commonjs/ArrowKeyStepper/ArrowKeyStepper.jest.js +338 -0
- package/dist/commonjs/ArrowKeyStepper/ArrowKeyStepper.js +204 -0
- package/dist/commonjs/ArrowKeyStepper/index.js +19 -0
- package/dist/commonjs/ArrowKeyStepper/types.js +5 -0
- package/dist/commonjs/AutoSizer/AutoSizer.example.js +104 -0
- package/dist/commonjs/AutoSizer/AutoSizer.jest.js +341 -0
- package/dist/commonjs/AutoSizer/AutoSizer.js +199 -0
- package/dist/commonjs/AutoSizer/AutoSizer.ssr.js +25 -0
- package/dist/commonjs/AutoSizer/index.js +19 -0
- package/dist/commonjs/CellMeasurer/CellMeasurer.DynamicHeightGrid.example.js +100 -0
- package/dist/commonjs/CellMeasurer/CellMeasurer.DynamicHeightList.example.js +99 -0
- package/dist/commonjs/CellMeasurer/CellMeasurer.DynamicHeightTableColumn.example.js +107 -0
- package/dist/commonjs/CellMeasurer/CellMeasurer.DynamicWidthGrid.example.js +102 -0
- package/dist/commonjs/CellMeasurer/CellMeasurer.DynamicWidthMultiGrid.example.js +107 -0
- package/dist/commonjs/CellMeasurer/CellMeasurer.example.js +129 -0
- package/dist/commonjs/CellMeasurer/CellMeasurer.jest.js +345 -0
- package/dist/commonjs/CellMeasurer/CellMeasurer.js +195 -0
- package/dist/commonjs/CellMeasurer/CellMeasurerCache.jest.js +298 -0
- package/dist/commonjs/CellMeasurer/CellMeasurerCache.js +202 -0
- package/dist/commonjs/CellMeasurer/index.js +22 -0
- package/dist/commonjs/CellMeasurer/types.js +14 -0
- package/dist/commonjs/Collection/Collection.example.js +231 -0
- package/dist/commonjs/Collection/Collection.jest.js +829 -0
- package/dist/commonjs/Collection/Collection.js +266 -0
- package/dist/commonjs/Collection/CollectionView.js +553 -0
- package/dist/commonjs/Collection/Section.jest.js +63 -0
- package/dist/commonjs/Collection/Section.js +57 -0
- package/dist/commonjs/Collection/SectionManager.jest.js +121 -0
- package/dist/commonjs/Collection/SectionManager.js +134 -0
- package/dist/commonjs/Collection/TestData.js +77 -0
- package/dist/commonjs/Collection/index.js +15 -0
- package/dist/commonjs/Collection/types.js +22 -0
- package/dist/commonjs/Collection/utils/calculateSizeAndPositionData.jest.js +34 -0
- package/dist/commonjs/Collection/utils/calculateSizeAndPositionData.js +38 -0
- package/dist/commonjs/ColumnSizer/ColumnSizer.example.js +159 -0
- package/dist/commonjs/ColumnSizer/ColumnSizer.jest.js +129 -0
- package/dist/commonjs/ColumnSizer/ColumnSizer.js +103 -0
- package/dist/commonjs/ColumnSizer/index.js +15 -0
- package/dist/commonjs/Grid/Grid.example.js +330 -0
- package/dist/commonjs/Grid/Grid.jest.js +2561 -0
- package/dist/commonjs/Grid/Grid.js +1432 -0
- package/dist/commonjs/Grid/Grid.ssr.js +62 -0
- package/dist/commonjs/Grid/accessibilityOverscanIndicesGetter.jest.js +92 -0
- package/dist/commonjs/Grid/accessibilityOverscanIndicesGetter.js +40 -0
- package/dist/commonjs/Grid/defaultCellRangeRenderer.js +139 -0
- package/dist/commonjs/Grid/defaultOverscanIndicesGetter.jest.js +92 -0
- package/dist/commonjs/Grid/defaultOverscanIndicesGetter.js +36 -0
- package/dist/commonjs/Grid/index.js +40 -0
- package/dist/commonjs/Grid/types.js +8 -0
- package/dist/commonjs/Grid/utils/CellSizeAndPositionManager.jest.js +375 -0
- package/dist/commonjs/Grid/utils/CellSizeAndPositionManager.js +296 -0
- package/dist/commonjs/Grid/utils/ScalingCellSizeAndPositionManager.jest.js +201 -0
- package/dist/commonjs/Grid/utils/ScalingCellSizeAndPositionManager.js +204 -0
- package/dist/commonjs/Grid/utils/calculateSizeAndPositionDataAndUpdateScrollOffset.jest.js +84 -0
- package/dist/commonjs/Grid/utils/calculateSizeAndPositionDataAndUpdateScrollOffset.js +59 -0
- package/dist/commonjs/Grid/utils/maxElementSize.js +22 -0
- package/dist/commonjs/Grid/utils/updateScrollIndexHelper.jest.js +180 -0
- package/dist/commonjs/Grid/utils/updateScrollIndexHelper.js +85 -0
- package/dist/commonjs/InfiniteLoader/InfiniteLoader.example.js +179 -0
- package/dist/commonjs/InfiniteLoader/InfiniteLoader.jest.js +571 -0
- package/dist/commonjs/InfiniteLoader/InfiniteLoader.js +274 -0
- package/dist/commonjs/InfiniteLoader/index.js +15 -0
- package/dist/commonjs/List/List.example.js +236 -0
- package/dist/commonjs/List/List.jest.js +517 -0
- package/dist/commonjs/List/List.js +318 -0
- package/dist/commonjs/List/index.js +19 -0
- package/dist/commonjs/List/types.js +6 -0
- package/dist/commonjs/Masonry/Masonry.example.js +287 -0
- package/dist/commonjs/Masonry/Masonry.jest.js +450 -0
- package/dist/commonjs/Masonry/Masonry.js +431 -0
- package/dist/commonjs/Masonry/PositionCache.js +88 -0
- package/dist/commonjs/Masonry/createCellPositioner.js +59 -0
- package/dist/commonjs/Masonry/index.js +22 -0
- package/dist/commonjs/MultiGrid/CellMeasurerCacheDecorator.js +106 -0
- package/dist/commonjs/MultiGrid/MultiGrid.example.js +131 -0
- package/dist/commonjs/MultiGrid/MultiGrid.jest.js +584 -0
- package/dist/commonjs/MultiGrid/MultiGrid.js +743 -0
- package/dist/commonjs/MultiGrid/index.js +15 -0
- package/dist/commonjs/ScrollSync/ScrollSync.example.js +257 -0
- package/dist/commonjs/ScrollSync/ScrollSync.jest.js +66 -0
- package/dist/commonjs/ScrollSync/ScrollSync.js +88 -0
- package/dist/commonjs/ScrollSync/index.js +15 -0
- package/dist/commonjs/Table/Column.jest.js +90 -0
- package/dist/commonjs/Table/Column.js +93 -0
- package/dist/commonjs/Table/SortDirection.js +19 -0
- package/dist/commonjs/Table/SortIndicator.js +40 -0
- package/dist/commonjs/Table/Table.example.js +325 -0
- package/dist/commonjs/Table/Table.jest.js +1257 -0
- package/dist/commonjs/Table/Table.js +742 -0
- package/dist/commonjs/Table/createMultiSort.jest.js +165 -0
- package/dist/commonjs/Table/createMultiSort.js +99 -0
- package/dist/commonjs/Table/defaultCellDataGetter.js +21 -0
- package/dist/commonjs/Table/defaultCellRenderer.js +19 -0
- package/dist/commonjs/Table/defaultHeaderRenderer.js +35 -0
- package/dist/commonjs/Table/defaultHeaderRowRenderer.js +21 -0
- package/dist/commonjs/Table/defaultRowRenderer.js +87 -0
- package/dist/commonjs/Table/index.js +78 -0
- package/dist/commonjs/Table/types.js +39 -0
- package/dist/commonjs/WindowScroller/WindowScroller.e2e.js +298 -0
- package/dist/commonjs/WindowScroller/WindowScroller.example.js +167 -0
- package/dist/commonjs/WindowScroller/WindowScroller.header-resize.e2e.js +359 -0
- package/dist/commonjs/WindowScroller/WindowScroller.jest.js +536 -0
- package/dist/commonjs/WindowScroller/WindowScroller.js +268 -0
- package/dist/commonjs/WindowScroller/WindowScroller.ssr.js +25 -0
- package/dist/commonjs/WindowScroller/index.js +23 -0
- package/dist/commonjs/WindowScroller/utils/dimensions.js +89 -0
- package/dist/commonjs/WindowScroller/utils/onScroll.js +70 -0
- package/dist/commonjs/index.js +180 -0
- package/dist/commonjs/jest-setup.js +7 -0
- package/dist/commonjs/utils/TestHelper.js +36 -0
- package/dist/commonjs/utils/animationFrame.js +29 -0
- package/dist/commonjs/utils/createCallbackMemoizer.jest.js +219 -0
- package/dist/commonjs/utils/createCallbackMemoizer.js +31 -0
- package/dist/commonjs/utils/getUpdatedOffsetForIndex.jest.js +68 -0
- package/dist/commonjs/utils/getUpdatedOffsetForIndex.js +38 -0
- package/dist/commonjs/utils/initCellMetadata.js +37 -0
- package/dist/commonjs/utils/requestAnimationTimeout.js +38 -0
- package/dist/commonjs/vendor/binarySearchBounds.js +200 -0
- package/dist/commonjs/vendor/detectElementResize.js +192 -0
- package/dist/commonjs/vendor/intervalTree.js +361 -0
- package/dist/es/ArrowKeyStepper/ArrowKeyStepper.example.js +176 -0
- package/dist/es/ArrowKeyStepper/ArrowKeyStepper.jest.js +332 -0
- package/dist/es/ArrowKeyStepper/ArrowKeyStepper.js +197 -0
- package/dist/es/ArrowKeyStepper/index.js +3 -0
- package/dist/es/ArrowKeyStepper/types.js +4 -0
- package/dist/es/AutoSizer/AutoSizer.example.js +96 -0
- package/dist/es/AutoSizer/AutoSizer.jest.js +335 -0
- package/dist/es/AutoSizer/AutoSizer.js +190 -0
- package/dist/es/AutoSizer/AutoSizer.js.flow +200 -0
- package/dist/es/AutoSizer/AutoSizer.ssr.js +19 -0
- package/dist/es/AutoSizer/index.js +2 -0
- package/dist/es/AutoSizer/index.js.flow +4 -0
- package/dist/es/CellMeasurer/CellMeasurer.DynamicHeightGrid.example.js +91 -0
- package/dist/es/CellMeasurer/CellMeasurer.DynamicHeightList.example.js +90 -0
- package/dist/es/CellMeasurer/CellMeasurer.DynamicHeightTableColumn.example.js +98 -0
- package/dist/es/CellMeasurer/CellMeasurer.DynamicWidthGrid.example.js +93 -0
- package/dist/es/CellMeasurer/CellMeasurer.DynamicWidthMultiGrid.example.js +98 -0
- package/dist/es/CellMeasurer/CellMeasurer.example.js +120 -0
- package/dist/es/CellMeasurer/CellMeasurer.jest.js +340 -0
- package/dist/es/CellMeasurer/CellMeasurer.js +187 -0
- package/dist/es/CellMeasurer/CellMeasurerCache.jest.js +293 -0
- package/dist/es/CellMeasurer/CellMeasurerCache.js +196 -0
- package/dist/es/CellMeasurer/index.js +4 -0
- package/dist/es/CellMeasurer/types.js +13 -0
- package/dist/es/Collection/Collection.example.js +223 -0
- package/dist/es/Collection/Collection.jest.js +824 -0
- package/dist/es/Collection/Collection.js +257 -0
- package/dist/es/Collection/CollectionView.js +544 -0
- package/dist/es/Collection/Section.jest.js +60 -0
- package/dist/es/Collection/Section.js +51 -0
- package/dist/es/Collection/SectionManager.jest.js +118 -0
- package/dist/es/Collection/SectionManager.js +128 -0
- package/dist/es/Collection/TestData.js +71 -0
- package/dist/es/Collection/index.js +3 -0
- package/dist/es/Collection/types.js +21 -0
- package/dist/es/Collection/utils/calculateSizeAndPositionData.jest.js +31 -0
- package/dist/es/Collection/utils/calculateSizeAndPositionData.js +31 -0
- package/dist/es/ColumnSizer/ColumnSizer.example.js +150 -0
- package/dist/es/ColumnSizer/ColumnSizer.jest.js +123 -0
- package/dist/es/ColumnSizer/ColumnSizer.js +95 -0
- package/dist/es/ColumnSizer/index.js +3 -0
- package/dist/es/Grid/Grid.example.js +321 -0
- package/dist/es/Grid/Grid.jest.js +2555 -0
- package/dist/es/Grid/Grid.js +1425 -0
- package/dist/es/Grid/Grid.ssr.js +57 -0
- package/dist/es/Grid/accessibilityOverscanIndicesGetter.jest.js +87 -0
- package/dist/es/Grid/accessibilityOverscanIndicesGetter.js +33 -0
- package/dist/es/Grid/defaultCellRangeRenderer.js +134 -0
- package/dist/es/Grid/defaultOverscanIndicesGetter.jest.js +87 -0
- package/dist/es/Grid/defaultOverscanIndicesGetter.js +29 -0
- package/dist/es/Grid/index.js +15 -0
- package/dist/es/Grid/types.js +96 -0
- package/dist/es/Grid/utils/CellSizeAndPositionManager.jest.js +372 -0
- package/dist/es/Grid/utils/CellSizeAndPositionManager.js +290 -0
- package/dist/es/Grid/utils/ScalingCellSizeAndPositionManager.jest.js +198 -0
- package/dist/es/Grid/utils/ScalingCellSizeAndPositionManager.js +198 -0
- package/dist/es/Grid/utils/calculateSizeAndPositionDataAndUpdateScrollOffset.jest.js +81 -0
- package/dist/es/Grid/utils/calculateSizeAndPositionDataAndUpdateScrollOffset.js +53 -0
- package/dist/es/Grid/utils/maxElementSize.js +16 -0
- package/dist/es/Grid/utils/updateScrollIndexHelper.jest.js +174 -0
- package/dist/es/Grid/utils/updateScrollIndexHelper.js +79 -0
- package/dist/es/InfiniteLoader/InfiniteLoader.example.js +170 -0
- package/dist/es/InfiniteLoader/InfiniteLoader.jest.js +565 -0
- package/dist/es/InfiniteLoader/InfiniteLoader.js +263 -0
- package/dist/es/InfiniteLoader/index.js +3 -0
- package/dist/es/List/List.example.js +227 -0
- package/dist/es/List/List.jest.js +511 -0
- package/dist/es/List/List.js +312 -0
- package/dist/es/List/index.js +3 -0
- package/dist/es/List/types.js +21 -0
- package/dist/es/Masonry/Masonry.example.js +278 -0
- package/dist/es/Masonry/Masonry.jest.js +444 -0
- package/dist/es/Masonry/Masonry.js +421 -0
- package/dist/es/Masonry/PositionCache.js +82 -0
- package/dist/es/Masonry/createCellPositioner.js +53 -0
- package/dist/es/Masonry/index.js +4 -0
- package/dist/es/MultiGrid/CellMeasurerCacheDecorator.js +100 -0
- package/dist/es/MultiGrid/MultiGrid.example.js +122 -0
- package/dist/es/MultiGrid/MultiGrid.jest.js +579 -0
- package/dist/es/MultiGrid/MultiGrid.js +733 -0
- package/dist/es/MultiGrid/index.js +3 -0
- package/dist/es/ScrollSync/ScrollSync.example.js +248 -0
- package/dist/es/ScrollSync/ScrollSync.jest.js +60 -0
- package/dist/es/ScrollSync/ScrollSync.js +80 -0
- package/dist/es/ScrollSync/index.js +3 -0
- package/dist/es/Table/Column.jest.js +84 -0
- package/dist/es/Table/Column.js +85 -0
- package/dist/es/Table/SortDirection.js +13 -0
- package/dist/es/Table/SortIndicator.js +31 -0
- package/dist/es/Table/Table.example.js +316 -0
- package/dist/es/Table/Table.jest.js +1251 -0
- package/dist/es/Table/Table.js +735 -0
- package/dist/es/Table/createMultiSort.jest.js +162 -0
- package/dist/es/Table/createMultiSort.js +93 -0
- package/dist/es/Table/defaultCellDataGetter.js +15 -0
- package/dist/es/Table/defaultCellRenderer.js +13 -0
- package/dist/es/Table/defaultHeaderRenderer.js +25 -0
- package/dist/es/Table/defaultHeaderRowRenderer.js +12 -0
- package/dist/es/Table/defaultRowRenderer.js +77 -0
- package/dist/es/Table/index.js +12 -0
- package/dist/es/Table/types.js +38 -0
- package/dist/es/WindowScroller/WindowScroller.e2e.js +295 -0
- package/dist/es/WindowScroller/WindowScroller.example.js +158 -0
- package/dist/es/WindowScroller/WindowScroller.header-resize.e2e.js +356 -0
- package/dist/es/WindowScroller/WindowScroller.jest.js +530 -0
- package/dist/es/WindowScroller/WindowScroller.js +259 -0
- package/dist/es/WindowScroller/WindowScroller.js.flow +277 -0
- package/dist/es/WindowScroller/WindowScroller.ssr.js +19 -0
- package/dist/es/WindowScroller/index.js +3 -0
- package/dist/es/WindowScroller/index.js.flow +6 -0
- package/dist/es/WindowScroller/utils/dimensions.js +81 -0
- package/dist/es/WindowScroller/utils/dimensions.js.flow +91 -0
- package/dist/es/WindowScroller/utils/onScroll.js +64 -0
- package/dist/es/WindowScroller/utils/onScroll.js.flow +94 -0
- package/dist/es/index.js +13 -0
- package/dist/es/jest-setup.js +5 -0
- package/dist/es/utils/TestHelper.js +30 -0
- package/dist/es/utils/animationFrame.js +23 -0
- package/dist/es/utils/createCallbackMemoizer.jest.js +216 -0
- package/dist/es/utils/createCallbackMemoizer.js +25 -0
- package/dist/es/utils/getUpdatedOffsetForIndex.jest.js +65 -0
- package/dist/es/utils/getUpdatedOffsetForIndex.js +32 -0
- package/dist/es/utils/initCellMetadata.js +31 -0
- package/dist/es/utils/requestAnimationTimeout.js +32 -0
- package/dist/es/vendor/binarySearchBounds.js +194 -0
- package/dist/es/vendor/detectElementResize.js +186 -0
- package/dist/es/vendor/intervalTree.js +354 -0
- package/dist/umd/react-virtualized.js +4638 -0
- package/package.json +188 -0
- package/styles.css +80 -0
|
@@ -0,0 +1,4638 @@
|
|
|
1
|
+
((global, factory) => {
|
|
2
|
+
"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);
|
|
3
|
+
})(this, function(exports, React) {
|
|
4
|
+
var React__default = "default" in React ? React.default : React;
|
|
5
|
+
function _arrayLikeToArray(r, a) {
|
|
6
|
+
(null == a || a > r.length) && (a = r.length);
|
|
7
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
8
|
+
return n;
|
|
9
|
+
}
|
|
10
|
+
function _callSuper(t, o, e) {
|
|
11
|
+
return o = _getPrototypeOf(o), ((t, e) => {
|
|
12
|
+
if (e && ("object" == typeof e || "function" == typeof e)) return e;
|
|
13
|
+
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
14
|
+
return (e => {
|
|
15
|
+
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
16
|
+
return e;
|
|
17
|
+
})(t);
|
|
18
|
+
})(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
|
|
19
|
+
}
|
|
20
|
+
function _classCallCheck(a, n) {
|
|
21
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
22
|
+
}
|
|
23
|
+
function _defineProperties(e, r) {
|
|
24
|
+
for (var t = 0; t < r.length; t++) {
|
|
25
|
+
var o = r[t];
|
|
26
|
+
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0),
|
|
27
|
+
Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function _createClass(e, r, t) {
|
|
31
|
+
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t),
|
|
32
|
+
Object.defineProperty(e, "prototype", {
|
|
33
|
+
writable: !1
|
|
34
|
+
}), e;
|
|
35
|
+
}
|
|
36
|
+
function _defineProperty(e, r, t) {
|
|
37
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
38
|
+
value: t,
|
|
39
|
+
enumerable: !0,
|
|
40
|
+
configurable: !0,
|
|
41
|
+
writable: !0
|
|
42
|
+
}) : e[r] = t, e;
|
|
43
|
+
}
|
|
44
|
+
function _extends() {
|
|
45
|
+
return (_extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
46
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
47
|
+
var r, t = arguments[e];
|
|
48
|
+
for (r in t) !{}.hasOwnProperty.call(t, r) || (n[r] = t[r]);
|
|
49
|
+
}
|
|
50
|
+
return n;
|
|
51
|
+
}).apply(null, arguments);
|
|
52
|
+
}
|
|
53
|
+
function _getPrototypeOf(t) {
|
|
54
|
+
return (_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
|
|
55
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
56
|
+
})(t);
|
|
57
|
+
}
|
|
58
|
+
function _inherits(t, e) {
|
|
59
|
+
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
60
|
+
t.prototype = Object.create(e && e.prototype, {
|
|
61
|
+
constructor: {
|
|
62
|
+
value: t,
|
|
63
|
+
writable: !0,
|
|
64
|
+
configurable: !0
|
|
65
|
+
}
|
|
66
|
+
}), Object.defineProperty(t, "prototype", {
|
|
67
|
+
writable: !1
|
|
68
|
+
}), e && _setPrototypeOf(t, e);
|
|
69
|
+
}
|
|
70
|
+
function _isNativeReflectConstruct() {
|
|
71
|
+
try {
|
|
72
|
+
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
73
|
+
} catch (t) {}
|
|
74
|
+
return (_isNativeReflectConstruct = function() {
|
|
75
|
+
return !!t;
|
|
76
|
+
})();
|
|
77
|
+
}
|
|
78
|
+
function ownKeys(e, r) {
|
|
79
|
+
var o, t = Object.keys(e);
|
|
80
|
+
return Object.getOwnPropertySymbols && (o = Object.getOwnPropertySymbols(e),
|
|
81
|
+
r && (o = o.filter(function(r) {
|
|
82
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
83
|
+
})), t.push.apply(t, o)), t;
|
|
84
|
+
}
|
|
85
|
+
function _objectSpread2(e) {
|
|
86
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
87
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
88
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
89
|
+
_defineProperty(e, r, t[r]);
|
|
90
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
91
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return e;
|
|
95
|
+
}
|
|
96
|
+
function _objectWithoutProperties(e, t) {
|
|
97
|
+
if (null == e) return {};
|
|
98
|
+
var o, i = ((r, e) => {
|
|
99
|
+
if (null == r) return {};
|
|
100
|
+
var n, t = {};
|
|
101
|
+
for (n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
102
|
+
if (e.includes(n)) continue;
|
|
103
|
+
t[n] = r[n];
|
|
104
|
+
}
|
|
105
|
+
return t;
|
|
106
|
+
})(e, t);
|
|
107
|
+
if (Object.getOwnPropertySymbols) for (var s = Object.getOwnPropertySymbols(e), r = 0; r < s.length; r++) o = s[r],
|
|
108
|
+
t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
109
|
+
return i;
|
|
110
|
+
}
|
|
111
|
+
function _setPrototypeOf(t, e) {
|
|
112
|
+
return (_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
|
|
113
|
+
return t.__proto__ = e, t;
|
|
114
|
+
})(t, e);
|
|
115
|
+
}
|
|
116
|
+
function _slicedToArray(r, e) {
|
|
117
|
+
return (r => {
|
|
118
|
+
if (Array.isArray(r)) return r;
|
|
119
|
+
})(r) || ((r, l) => {
|
|
120
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
121
|
+
if (null != t) {
|
|
122
|
+
var e, n, i, u, a = [], f = !0, o = !1;
|
|
123
|
+
try {
|
|
124
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
125
|
+
if (Object(t) !== t) return;
|
|
126
|
+
f = !1;
|
|
127
|
+
} else for (;!(f = (e = i.call(t)).done) && (a.push(e.value),
|
|
128
|
+
a.length !== l); f = !0);
|
|
129
|
+
} catch (r) {
|
|
130
|
+
o = !0, n = r;
|
|
131
|
+
} finally {
|
|
132
|
+
try {
|
|
133
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
134
|
+
} finally {
|
|
135
|
+
if (o) throw n;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return a;
|
|
139
|
+
}
|
|
140
|
+
})(r, e) || _unsupportedIterableToArray(r, e) || (() => {
|
|
141
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
142
|
+
})();
|
|
143
|
+
}
|
|
144
|
+
function _toConsumableArray(r) {
|
|
145
|
+
return (r => {
|
|
146
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
147
|
+
})(r) || (r => {
|
|
148
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
149
|
+
})(r) || _unsupportedIterableToArray(r) || (() => {
|
|
150
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
151
|
+
})();
|
|
152
|
+
}
|
|
153
|
+
function _toPropertyKey(t) {
|
|
154
|
+
t = ((t, r) => {
|
|
155
|
+
if ("object" != typeof t || !t) return t;
|
|
156
|
+
var e = t[Symbol.toPrimitive];
|
|
157
|
+
if (void 0 === e) return ("string" === r ? String : Number)(t);
|
|
158
|
+
if ("object" != typeof (e = e.call(t, r || "default"))) return e;
|
|
159
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
160
|
+
})(t, "string");
|
|
161
|
+
return "symbol" == typeof t ? t : t + "";
|
|
162
|
+
}
|
|
163
|
+
function _typeof(o) {
|
|
164
|
+
return (_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
165
|
+
return typeof o;
|
|
166
|
+
} : function(o) {
|
|
167
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
168
|
+
})(o);
|
|
169
|
+
}
|
|
170
|
+
function _unsupportedIterableToArray(r, a) {
|
|
171
|
+
var t;
|
|
172
|
+
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;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
176
|
+
*
|
|
177
|
+
* This source code is licensed under the MIT license found in the
|
|
178
|
+
* LICENSE file in the root directory of this source tree.
|
|
179
|
+
*/
|
|
180
|
+
function componentWillMount() {
|
|
181
|
+
// Call this.constructor.gDSFP to support sub-classes.
|
|
182
|
+
var state = this.constructor.getDerivedStateFromProps(this.props, this.state);
|
|
183
|
+
null != state && this.setState(state);
|
|
184
|
+
}
|
|
185
|
+
function componentWillReceiveProps(nextProps) {
|
|
186
|
+
// Binding "this" is important for shallow renderer support.
|
|
187
|
+
this.setState(
|
|
188
|
+
// Call this.constructor.gDSFP to support sub-classes.
|
|
189
|
+
// Use the setState() updater to ensure state isn't stale in certain edge cases.
|
|
190
|
+
function(prevState) {
|
|
191
|
+
return null != (prevState = this.constructor.getDerivedStateFromProps(nextProps, prevState)) ? prevState : null;
|
|
192
|
+
}.bind(this));
|
|
193
|
+
}
|
|
194
|
+
function componentWillUpdate(nextProps, nextState) {
|
|
195
|
+
try {
|
|
196
|
+
var prevProps = this.props, prevState = this.state;
|
|
197
|
+
this.props = nextProps, this.state = nextState, this.__reactInternalSnapshotFlag = !0,
|
|
198
|
+
this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate(prevProps, prevState);
|
|
199
|
+
} finally {
|
|
200
|
+
this.props = prevProps, this.state = prevState;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
// React may warn about cWM/cWRP/cWU methods being deprecated.
|
|
204
|
+
// Add a flag to suppress these warnings for this special case.
|
|
205
|
+
function polyfill(Component) {
|
|
206
|
+
var prototype = Component.prototype;
|
|
207
|
+
if (!prototype || !prototype.isReactComponent) throw new Error("Can only polyfill class components");
|
|
208
|
+
if ("function" == typeof Component.getDerivedStateFromProps || "function" == typeof prototype.getSnapshotBeforeUpdate) {
|
|
209
|
+
// If new component APIs are defined, "unsafe" lifecycles won't be called.
|
|
210
|
+
// Error if any of these lifecycles are present,
|
|
211
|
+
// Because they would work differently between older and newer (16.3+) versions of React.
|
|
212
|
+
var componentName, foundWillMountName = null, foundWillReceivePropsName = null, foundWillUpdateName = null;
|
|
213
|
+
if ("function" == typeof prototype.componentWillMount ? foundWillMountName = "componentWillMount" : "function" == typeof prototype.UNSAFE_componentWillMount && (foundWillMountName = "UNSAFE_componentWillMount"),
|
|
214
|
+
"function" == typeof prototype.componentWillReceiveProps ? foundWillReceivePropsName = "componentWillReceiveProps" : "function" == typeof prototype.UNSAFE_componentWillReceiveProps && (foundWillReceivePropsName = "UNSAFE_componentWillReceiveProps"),
|
|
215
|
+
"function" == typeof prototype.componentWillUpdate ? foundWillUpdateName = "componentWillUpdate" : "function" == typeof prototype.UNSAFE_componentWillUpdate && (foundWillUpdateName = "UNSAFE_componentWillUpdate"),
|
|
216
|
+
null !== foundWillMountName || null !== foundWillReceivePropsName || null !== foundWillUpdateName) throw componentName = Component.displayName || Component.name,
|
|
217
|
+
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");
|
|
218
|
+
// React <= 16.2 does not support static getDerivedStateFromProps.
|
|
219
|
+
// As a workaround, use cWM and cWRP to invoke the new static lifecycle.
|
|
220
|
+
// Newer versions of React will ignore these lifecycles if gDSFP exists.
|
|
221
|
+
// React <= 16.2 does not support getSnapshotBeforeUpdate.
|
|
222
|
+
// As a workaround, use cWU to invoke the new lifecycle.
|
|
223
|
+
// Newer versions of React will ignore that lifecycle if gSBU exists.
|
|
224
|
+
if ("function" == typeof Component.getDerivedStateFromProps && (prototype.componentWillMount = componentWillMount,
|
|
225
|
+
prototype.componentWillReceiveProps = componentWillReceiveProps), "function" == typeof prototype.getSnapshotBeforeUpdate) {
|
|
226
|
+
if ("function" != typeof prototype.componentDidUpdate) throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");
|
|
227
|
+
prototype.componentWillUpdate = componentWillUpdate;
|
|
228
|
+
var componentDidUpdate = prototype.componentDidUpdate;
|
|
229
|
+
prototype.componentDidUpdate = function(prevProps, prevState, maybeSnapshot) {
|
|
230
|
+
// 16.3+ will not execute our will-update method;
|
|
231
|
+
// It will pass a snapshot value to did-update though.
|
|
232
|
+
// Older versions will require our polyfilled will-update value.
|
|
233
|
+
// We need to handle both cases, but can't just check for the presence of "maybeSnapshot",
|
|
234
|
+
// Because for <= 15.x versions this might be a "prevContext" object.
|
|
235
|
+
// We also can't just check "__reactInternalSnapshot",
|
|
236
|
+
// Because get-snapshot might return a falsy value.
|
|
237
|
+
// So check for the explicit __reactInternalSnapshotFlag flag to determine behavior.
|
|
238
|
+
maybeSnapshot = this.__reactInternalSnapshotFlag ? this.__reactInternalSnapshot : maybeSnapshot;
|
|
239
|
+
componentDidUpdate.call(this, prevProps, prevState, maybeSnapshot);
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
componentWillUpdate.__suppressDeprecationWarning = componentWillReceiveProps.__suppressDeprecationWarning = componentWillMount.__suppressDeprecationWarning = !0;
|
|
245
|
+
var ArrowKeyStepper = (() => {
|
|
246
|
+
function ArrowKeyStepper() {
|
|
247
|
+
var _this;
|
|
248
|
+
_classCallCheck(this, ArrowKeyStepper);
|
|
249
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
|
250
|
+
return _defineProperty(_this = _callSuper(this, ArrowKeyStepper, [].concat(args)), "state", {
|
|
251
|
+
scrollToColumn: 0,
|
|
252
|
+
scrollToRow: 0,
|
|
253
|
+
instanceProps: {
|
|
254
|
+
prevScrollToColumn: 0,
|
|
255
|
+
prevScrollToRow: 0
|
|
256
|
+
}
|
|
257
|
+
}), _defineProperty(_this, "_columnStartIndex", 0), _defineProperty(_this, "_columnStopIndex", 0),
|
|
258
|
+
_defineProperty(_this, "_rowStartIndex", 0), _defineProperty(_this, "_rowStopIndex", 0),
|
|
259
|
+
_defineProperty(_this, "_onKeyDown", function(event) {
|
|
260
|
+
var _this$props = _this.props, columnCount = _this$props.columnCount, disabled = _this$props.disabled, mode = _this$props.mode, rowCount = _this$props.rowCount;
|
|
261
|
+
if (!disabled) {
|
|
262
|
+
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;
|
|
263
|
+
switch (event.key) {
|
|
264
|
+
case "ArrowDown":
|
|
265
|
+
scrollToRow = "cells" === mode ? Math.min(scrollToRow + 1, rowCount - 1) : Math.min(_this._rowStopIndex + 1, rowCount - 1);
|
|
266
|
+
break;
|
|
267
|
+
|
|
268
|
+
case "ArrowLeft":
|
|
269
|
+
scrollToColumn = "cells" === mode ? Math.max(scrollToColumn - 1, 0) : Math.max(_this._columnStartIndex - 1, 0);
|
|
270
|
+
break;
|
|
271
|
+
|
|
272
|
+
case "ArrowRight":
|
|
273
|
+
scrollToColumn = "cells" === mode ? Math.min(scrollToColumn + 1, columnCount - 1) : Math.min(_this._columnStopIndex + 1, columnCount - 1);
|
|
274
|
+
break;
|
|
275
|
+
|
|
276
|
+
case "ArrowUp":
|
|
277
|
+
scrollToRow = "cells" === mode ? Math.max(scrollToRow - 1, 0) : Math.max(_this._rowStartIndex - 1, 0);
|
|
278
|
+
}
|
|
279
|
+
scrollToColumn === disabled && scrollToRow === _this$props || (event.preventDefault(),
|
|
280
|
+
_this._updateScrollState({
|
|
281
|
+
scrollToColumn: scrollToColumn,
|
|
282
|
+
scrollToRow: scrollToRow
|
|
283
|
+
}));
|
|
284
|
+
}
|
|
285
|
+
}), _defineProperty(_this, "_onSectionRendered", function(_ref) {
|
|
286
|
+
var columnStartIndex = _ref.columnStartIndex, columnStopIndex = _ref.columnStopIndex, rowStartIndex = _ref.rowStartIndex, _ref = _ref.rowStopIndex;
|
|
287
|
+
_this._columnStartIndex = columnStartIndex, _this._columnStopIndex = columnStopIndex,
|
|
288
|
+
_this._rowStartIndex = rowStartIndex, _this._rowStopIndex = _ref;
|
|
289
|
+
}), _this;
|
|
290
|
+
}
|
|
291
|
+
return _inherits(ArrowKeyStepper, React.PureComponent), _createClass(ArrowKeyStepper, [ {
|
|
292
|
+
key: "setScrollIndexes",
|
|
293
|
+
value: function(_ref2) {
|
|
294
|
+
var scrollToColumn = _ref2.scrollToColumn;
|
|
295
|
+
this.setState({
|
|
296
|
+
scrollToRow: _ref2.scrollToRow,
|
|
297
|
+
scrollToColumn: scrollToColumn
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
}, {
|
|
301
|
+
key: "render",
|
|
302
|
+
value: function() {
|
|
303
|
+
var _this$props2 = this.props, className = _this$props2.className, _this$props2 = _this$props2.children, _this$_getScrollState3 = this._getScrollState(), scrollToColumn = _this$_getScrollState3.scrollToColumn;
|
|
304
|
+
return React.createElement("div", {
|
|
305
|
+
className: className,
|
|
306
|
+
onKeyDown: this._onKeyDown
|
|
307
|
+
}, _this$props2({
|
|
308
|
+
onSectionRendered: this._onSectionRendered,
|
|
309
|
+
scrollToColumn: scrollToColumn,
|
|
310
|
+
scrollToRow: _this$_getScrollState3.scrollToRow
|
|
311
|
+
}));
|
|
312
|
+
}
|
|
313
|
+
}, {
|
|
314
|
+
key: "_getScrollState",
|
|
315
|
+
value: function() {
|
|
316
|
+
return this.props.isControlled ? this.props : this.state;
|
|
317
|
+
}
|
|
318
|
+
}, {
|
|
319
|
+
key: "_updateScrollState",
|
|
320
|
+
value: function(_ref3) {
|
|
321
|
+
var scrollToColumn = _ref3.scrollToColumn, _ref3 = _ref3.scrollToRow, _this$props3 = this.props, isControlled = _this$props3.isControlled, _this$props3 = _this$props3.onScrollToChange;
|
|
322
|
+
"function" == typeof _this$props3 && _this$props3({
|
|
323
|
+
scrollToColumn: scrollToColumn,
|
|
324
|
+
scrollToRow: _ref3
|
|
325
|
+
}), isControlled || this.setState({
|
|
326
|
+
scrollToColumn: scrollToColumn,
|
|
327
|
+
scrollToRow: _ref3
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
} ], [ {
|
|
331
|
+
key: "getDerivedStateFromProps",
|
|
332
|
+
value: function(nextProps, prevState) {
|
|
333
|
+
return !nextProps.isControlled && (nextProps.scrollToColumn !== prevState.instanceProps.prevScrollToColumn || nextProps.scrollToRow !== prevState.instanceProps.prevScrollToRow) ? _objectSpread2(_objectSpread2({}, prevState), {}, {
|
|
334
|
+
scrollToColumn: nextProps.scrollToColumn,
|
|
335
|
+
scrollToRow: nextProps.scrollToRow,
|
|
336
|
+
instanceProps: {
|
|
337
|
+
prevScrollToColumn: nextProps.scrollToColumn,
|
|
338
|
+
prevScrollToRow: nextProps.scrollToRow
|
|
339
|
+
}
|
|
340
|
+
}) : {};
|
|
341
|
+
}
|
|
342
|
+
} ]);
|
|
343
|
+
})();
|
|
344
|
+
function createDetectElementResize(nonce, hostWindow) {
|
|
345
|
+
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;
|
|
346
|
+
if (!attachEvent) {
|
|
347
|
+
raf = _window.requestAnimationFrame || _window.mozRequestAnimationFrame || _window.webkitRequestAnimationFrame || function(fn) {
|
|
348
|
+
return _window.setTimeout(fn, 20);
|
|
349
|
+
};
|
|
350
|
+
var requestFrame = function(fn) {
|
|
351
|
+
return raf(fn);
|
|
352
|
+
}, cancelFrame = (cancel = _window.cancelAnimationFrame || _window.mozCancelAnimationFrame || _window.webkitCancelAnimationFrame || _window.clearTimeout,
|
|
353
|
+
function(id) {
|
|
354
|
+
return cancel(id);
|
|
355
|
+
}), resetTriggers = function(element) {
|
|
356
|
+
var element = element.__resizeTriggers__, expand = element.firstElementChild, element = element.lastElementChild, expandChild = expand.firstElementChild;
|
|
357
|
+
element.scrollLeft = element.scrollWidth, element.scrollTop = element.scrollHeight,
|
|
358
|
+
expandChild.style.width = expand.offsetWidth + 1 + "px", expandChild.style.height = expand.offsetHeight + 1 + "px",
|
|
359
|
+
expand.scrollLeft = expand.scrollWidth, expand.scrollTop = expand.scrollHeight;
|
|
360
|
+
}, checkTriggers = function(element) {
|
|
361
|
+
return element.offsetWidth != element.__resizeLast__.width || element.offsetHeight != element.__resizeLast__.height;
|
|
362
|
+
}, scrollListener = function(e) {
|
|
363
|
+
var element;
|
|
364
|
+
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),
|
|
365
|
+
this.__resizeRAF__ && cancelFrame(this.__resizeRAF__), this.__resizeRAF__ = requestFrame(function() {
|
|
366
|
+
checkTriggers(element) && (element.__resizeLast__.width = element.offsetWidth,
|
|
367
|
+
element.__resizeLast__.height = element.offsetHeight, element.__resizeListeners__.forEach(function(fn) {
|
|
368
|
+
fn.call(element, e);
|
|
369
|
+
}));
|
|
370
|
+
}));
|
|
371
|
+
}, animation = !1, keyframeprefix = "", animationstartevent = "animationstart", domPrefixes = "Webkit Moz O ms".split(" "), startEvents = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "), elm = _window.document.createElement("fakeelement");
|
|
372
|
+
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"]) {
|
|
373
|
+
keyframeprefix = "-" + domPrefixes[i].toLowerCase() + "-", animationstartevent = startEvents[i],
|
|
374
|
+
animation = !0;
|
|
375
|
+
break;
|
|
376
|
+
}
|
|
377
|
+
var animationName = "resizeanim", animationKeyframes = "@" + keyframeprefix + "keyframes " + animationName + " { from { opacity: 0; } to { opacity: 0; } } ", animationStyle = keyframeprefix + "animation: 1ms " + animationName + "; ";
|
|
378
|
+
}
|
|
379
|
+
return {
|
|
380
|
+
addResizeListener: function(element, fn) {
|
|
381
|
+
var elementStyle, doc;
|
|
382
|
+
attachEvent ? element.attachEvent("onresize", fn) : (element.__resizeTriggers__ || (doc = element.ownerDocument,
|
|
383
|
+
(elementStyle = _window.getComputedStyle(element)) && "static" == elementStyle.position && (element.style.position = "relative"),
|
|
384
|
+
(doc => {
|
|
385
|
+
var css, head, style;
|
|
386
|
+
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%; }',
|
|
387
|
+
head = doc.head || doc.getElementsByTagName("head")[0], (style = doc.createElement("style")).id = "detectElementResize",
|
|
388
|
+
style.type = "text/css", null != nonce && style.setAttribute("nonce", nonce),
|
|
389
|
+
style.styleSheet ? style.styleSheet.cssText = css : style.appendChild(doc.createTextNode(css)),
|
|
390
|
+
head.appendChild(style));
|
|
391
|
+
})(doc), element.__resizeLast__ = {}, element.__resizeListeners__ = [],
|
|
392
|
+
(element.__resizeTriggers__ = doc.createElement("div")).className = "resize-triggers",
|
|
393
|
+
(elementStyle = doc.createElement("div")).className = "expand-trigger",
|
|
394
|
+
elementStyle.appendChild(doc.createElement("div")), (doc = doc.createElement("div")).className = "contract-trigger",
|
|
395
|
+
element.__resizeTriggers__.appendChild(elementStyle), element.__resizeTriggers__.appendChild(doc),
|
|
396
|
+
element.appendChild(element.__resizeTriggers__), resetTriggers(element),
|
|
397
|
+
element.addEventListener("scroll", scrollListener, !0), animationstartevent && (element.__resizeTriggers__.__animationListener__ = function(e) {
|
|
398
|
+
e.animationName == animationName && resetTriggers(element);
|
|
399
|
+
}, element.__resizeTriggers__.addEventListener(animationstartevent, element.__resizeTriggers__.__animationListener__))),
|
|
400
|
+
element.__resizeListeners__.push(fn));
|
|
401
|
+
},
|
|
402
|
+
removeResizeListener: function(element, fn) {
|
|
403
|
+
if (attachEvent) element.detachEvent("onresize", fn); else if (element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1),
|
|
404
|
+
!element.__resizeListeners__.length) {
|
|
405
|
+
element.removeEventListener("scroll", scrollListener, !0), element.__resizeTriggers__.__animationListener__ && (element.__resizeTriggers__.removeEventListener(animationstartevent, element.__resizeTriggers__.__animationListener__),
|
|
406
|
+
element.__resizeTriggers__.__animationListener__ = null);
|
|
407
|
+
try {
|
|
408
|
+
element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__);
|
|
409
|
+
} catch (e) {}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
_defineProperty(ArrowKeyStepper, "defaultProps", {
|
|
415
|
+
disabled: !1,
|
|
416
|
+
isControlled: !1,
|
|
417
|
+
mode: "edges",
|
|
418
|
+
scrollToColumn: 0,
|
|
419
|
+
scrollToRow: 0
|
|
420
|
+
}), polyfill(ArrowKeyStepper);
|
|
421
|
+
var AutoSizer = (() => {
|
|
422
|
+
function AutoSizer() {
|
|
423
|
+
var _this;
|
|
424
|
+
_classCallCheck(this, AutoSizer);
|
|
425
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
|
426
|
+
return _defineProperty(_this = _callSuper(this, AutoSizer, [].concat(args)), "state", {
|
|
427
|
+
height: _this.props.defaultHeight || 0,
|
|
428
|
+
width: _this.props.defaultWidth || 0
|
|
429
|
+
}), _defineProperty(_this, "_parentNode", void 0), _defineProperty(_this, "_autoSizer", void 0),
|
|
430
|
+
_defineProperty(_this, "_window", void 0), _defineProperty(_this, "_detectElementResize", void 0),
|
|
431
|
+
_defineProperty(_this, "_onResize", function() {
|
|
432
|
+
var height, width, paddingLeft, paddingRight, paddingTop, style, _this$props = _this.props, disableHeight = _this$props.disableHeight, disableWidth = _this$props.disableWidth, _this$props = _this$props.onResize;
|
|
433
|
+
_this._parentNode && (height = _this._parentNode.offsetHeight || 0,
|
|
434
|
+
width = _this._parentNode.offsetWidth || 0, style = (_this._window || window).getComputedStyle(_this._parentNode) || {},
|
|
435
|
+
paddingLeft = parseInt(style.paddingLeft, 10) || 0, paddingRight = parseInt(style.paddingRight, 10) || 0,
|
|
436
|
+
paddingTop = parseInt(style.paddingTop, 10) || 0, style = parseInt(style.paddingBottom, 10) || 0,
|
|
437
|
+
!disableHeight && _this.state.height !== height - paddingTop - style || !disableWidth && _this.state.width !== width - paddingLeft - paddingRight) && (_this.setState({
|
|
438
|
+
height: height - paddingTop - style,
|
|
439
|
+
width: width - paddingLeft - paddingRight
|
|
440
|
+
}), _this$props({
|
|
441
|
+
height: height,
|
|
442
|
+
width: width
|
|
443
|
+
}));
|
|
444
|
+
}), _defineProperty(_this, "_setRef", function(autoSizer) {
|
|
445
|
+
_this._autoSizer = autoSizer;
|
|
446
|
+
}), _this;
|
|
447
|
+
}
|
|
448
|
+
return _inherits(AutoSizer, React.Component), _createClass(AutoSizer, [ {
|
|
449
|
+
key: "componentDidMount",
|
|
450
|
+
value: function() {
|
|
451
|
+
var nonce = this.props.nonce;
|
|
452
|
+
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,
|
|
453
|
+
this._window = this._autoSizer.parentNode.ownerDocument.defaultView,
|
|
454
|
+
this._detectElementResize = createDetectElementResize(nonce, this._window),
|
|
455
|
+
this._detectElementResize.addResizeListener(this._parentNode, this._onResize),
|
|
456
|
+
this._onResize());
|
|
457
|
+
}
|
|
458
|
+
}, {
|
|
459
|
+
key: "componentWillUnmount",
|
|
460
|
+
value: function() {
|
|
461
|
+
this._detectElementResize && this._parentNode && this._detectElementResize.removeResizeListener(this._parentNode, this._onResize);
|
|
462
|
+
}
|
|
463
|
+
}, {
|
|
464
|
+
key: "render",
|
|
465
|
+
value: function() {
|
|
466
|
+
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 = {
|
|
467
|
+
overflow: "visible"
|
|
468
|
+
}, childParams = {};
|
|
469
|
+
return _this$props2.disableHeight || (outerStyle.height = 0, childParams.height = height),
|
|
470
|
+
disableWidth || (outerStyle.width = 0, childParams.width = _this$state),
|
|
471
|
+
React.createElement("div", {
|
|
472
|
+
className: className,
|
|
473
|
+
ref: this._setRef,
|
|
474
|
+
style: _objectSpread2(_objectSpread2({}, outerStyle), style)
|
|
475
|
+
}, children(childParams));
|
|
476
|
+
}
|
|
477
|
+
} ]);
|
|
478
|
+
})(), CellMeasurer = (_defineProperty(AutoSizer, "defaultProps", {
|
|
479
|
+
onResize: function() {},
|
|
480
|
+
disableHeight: !1,
|
|
481
|
+
disableWidth: !1,
|
|
482
|
+
style: {}
|
|
483
|
+
}), (() => {
|
|
484
|
+
function CellMeasurer() {
|
|
485
|
+
var _this;
|
|
486
|
+
_classCallCheck(this, CellMeasurer);
|
|
487
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
|
488
|
+
return _defineProperty(_this = _callSuper(this, CellMeasurer, [].concat(args)), "_child", React.createRef()),
|
|
489
|
+
_defineProperty(_this, "_measure", function() {
|
|
490
|
+
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;
|
|
491
|
+
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),
|
|
492
|
+
parent && "function" == typeof parent.recomputeGridSize && parent.recomputeGridSize({
|
|
493
|
+
columnIndex: _this$props$columnInd,
|
|
494
|
+
rowIndex: _this$props
|
|
495
|
+
}));
|
|
496
|
+
}), _defineProperty(_this, "_registerChild", function(element) {
|
|
497
|
+
!element || element instanceof Element || console.warn("CellMeasurer registerChild expects to be passed Element or null"),
|
|
498
|
+
(_this._child.current = element) && _this._maybeMeasureCell();
|
|
499
|
+
}), _this;
|
|
500
|
+
}
|
|
501
|
+
return _inherits(CellMeasurer, React.PureComponent), _createClass(CellMeasurer, [ {
|
|
502
|
+
key: "componentDidMount",
|
|
503
|
+
value: function() {
|
|
504
|
+
this._maybeMeasureCell();
|
|
505
|
+
}
|
|
506
|
+
}, {
|
|
507
|
+
key: "componentDidUpdate",
|
|
508
|
+
value: function() {
|
|
509
|
+
this._maybeMeasureCell();
|
|
510
|
+
}
|
|
511
|
+
}, {
|
|
512
|
+
key: "render",
|
|
513
|
+
value: function() {
|
|
514
|
+
var _this2 = this, children = this.props.children, resolvedChildren = "function" == typeof children ? children({
|
|
515
|
+
measure: this._measure,
|
|
516
|
+
registerChild: this._registerChild
|
|
517
|
+
}) : children;
|
|
518
|
+
return null === resolvedChildren ? resolvedChildren : React.cloneElement(resolvedChildren, {
|
|
519
|
+
ref: function(node) {
|
|
520
|
+
"function" == typeof resolvedChildren.ref ? resolvedChildren.ref(node) : resolvedChildren.ref && (resolvedChildren.ref.current = node),
|
|
521
|
+
_this2._child.current = node;
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
}, {
|
|
526
|
+
key: "_getCellMeasurements",
|
|
527
|
+
value: function() {
|
|
528
|
+
var styleWidth, styleHeight, width, cache = this.props.cache, node = this._child.current;
|
|
529
|
+
return node && node.ownerDocument && node.ownerDocument.defaultView && node instanceof node.ownerDocument.defaultView.HTMLElement ? (styleWidth = node.style.width,
|
|
530
|
+
styleHeight = node.style.height, cache.hasFixedWidth() || (node.style.width = "auto"),
|
|
531
|
+
cache.hasFixedHeight() || (node.style.height = "auto"), cache = Math.ceil(node.offsetHeight),
|
|
532
|
+
width = Math.ceil(node.offsetWidth), styleWidth && (node.style.width = styleWidth),
|
|
533
|
+
styleHeight && (node.style.height = styleHeight), {
|
|
534
|
+
height: cache,
|
|
535
|
+
width: width
|
|
536
|
+
}) : {
|
|
537
|
+
height: 0,
|
|
538
|
+
width: 0
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
}, {
|
|
542
|
+
key: "_maybeMeasureCell",
|
|
543
|
+
value: function() {
|
|
544
|
+
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;
|
|
545
|
+
cache.has(_this$props2, _this$props2$columnIn) || (height = (_this$_getCellMeasure2 = this._getCellMeasurements()).height,
|
|
546
|
+
cache.set(_this$props2, _this$props2$columnIn, _this$_getCellMeasure2.width, height),
|
|
547
|
+
parent && "function" == typeof parent.invalidateCellSizeAfterRender && parent.invalidateCellSizeAfterRender({
|
|
548
|
+
columnIndex: _this$props2$columnIn,
|
|
549
|
+
rowIndex: _this$props2
|
|
550
|
+
}));
|
|
551
|
+
}
|
|
552
|
+
} ]);
|
|
553
|
+
})()), CellMeasurerCache = (_defineProperty(CellMeasurer, "__internalCellMeasurerFlag", !1),
|
|
554
|
+
CellMeasurer.__internalCellMeasurerFlag = !0, _createClass(function CellMeasurerCache() {
|
|
555
|
+
var _this = this, params = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, defaultHeight = (_classCallCheck(this, CellMeasurerCache),
|
|
556
|
+
_defineProperty(this, "_cellHeightCache", {}), _defineProperty(this, "_cellWidthCache", {}),
|
|
557
|
+
_defineProperty(this, "_columnWidthCache", {}), _defineProperty(this, "_rowHeightCache", {}),
|
|
558
|
+
_defineProperty(this, "_defaultHeight", void 0), _defineProperty(this, "_defaultWidth", void 0),
|
|
559
|
+
_defineProperty(this, "_minHeight", void 0), _defineProperty(this, "_minWidth", void 0),
|
|
560
|
+
_defineProperty(this, "_keyMapper", void 0), _defineProperty(this, "_hasFixedHeight", void 0),
|
|
561
|
+
_defineProperty(this, "_hasFixedWidth", void 0), _defineProperty(this, "_columnCount", 0),
|
|
562
|
+
_defineProperty(this, "_rowCount", 0), _defineProperty(this, "columnWidth", function(_ref) {
|
|
563
|
+
return _ref = _ref.index, _ref = _this._keyMapper(0, _ref), void 0 !== _this._columnWidthCache[_ref] ? _this._columnWidthCache[_ref] : _this._defaultWidth;
|
|
564
|
+
}), _defineProperty(this, "rowHeight", function(_ref2) {
|
|
565
|
+
return _ref2 = _ref2.index, _ref2 = _this._keyMapper(_ref2, 0), void 0 !== _this._rowHeightCache[_ref2] ? _this._rowHeightCache[_ref2] : _this._defaultHeight;
|
|
566
|
+
}), params.defaultHeight), defaultWidth = params.defaultWidth, fixedWidth = params.fixedWidth, keyMapper = params.keyMapper, minHeight = params.minHeight, minWidth = params.minWidth;
|
|
567
|
+
this._hasFixedHeight = !0 === params.fixedHeight, this._hasFixedWidth = !0 === fixedWidth,
|
|
568
|
+
this._minHeight = minHeight || 0, this._minWidth = minWidth || 0, this._keyMapper = keyMapper || defaultKeyMapper,
|
|
569
|
+
this._defaultHeight = Math.max(this._minHeight, "number" == typeof defaultHeight ? defaultHeight : 30),
|
|
570
|
+
this._defaultWidth = Math.max(this._minWidth, "number" == typeof defaultWidth ? defaultWidth : 100),
|
|
571
|
+
!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."),
|
|
572
|
+
!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."),
|
|
573
|
+
!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.");
|
|
574
|
+
}, [ {
|
|
575
|
+
key: "clear",
|
|
576
|
+
value: function(rowIndex) {
|
|
577
|
+
var columnIndex = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, key = this._keyMapper(rowIndex, columnIndex);
|
|
578
|
+
delete this._cellHeightCache[key], delete this._cellWidthCache[key],
|
|
579
|
+
this._updateCachedColumnAndRowSizes(rowIndex, columnIndex);
|
|
580
|
+
}
|
|
581
|
+
}, {
|
|
582
|
+
key: "clearAll",
|
|
583
|
+
value: function() {
|
|
584
|
+
this._cellHeightCache = {}, this._cellWidthCache = {}, this._columnWidthCache = {},
|
|
585
|
+
this._rowHeightCache = {}, this._rowCount = 0, this._columnCount = 0;
|
|
586
|
+
}
|
|
587
|
+
}, {
|
|
588
|
+
key: "defaultHeight",
|
|
589
|
+
get: function() {
|
|
590
|
+
return this._defaultHeight;
|
|
591
|
+
}
|
|
592
|
+
}, {
|
|
593
|
+
key: "defaultWidth",
|
|
594
|
+
get: function() {
|
|
595
|
+
return this._defaultWidth;
|
|
596
|
+
}
|
|
597
|
+
}, {
|
|
598
|
+
key: "hasFixedHeight",
|
|
599
|
+
value: function() {
|
|
600
|
+
return this._hasFixedHeight;
|
|
601
|
+
}
|
|
602
|
+
}, {
|
|
603
|
+
key: "hasFixedWidth",
|
|
604
|
+
value: function() {
|
|
605
|
+
return this._hasFixedWidth;
|
|
606
|
+
}
|
|
607
|
+
}, {
|
|
608
|
+
key: "getHeight",
|
|
609
|
+
value: function(rowIndex) {
|
|
610
|
+
return !this._hasFixedHeight && (rowIndex = this._keyMapper(rowIndex, 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0),
|
|
611
|
+
void 0 !== this._cellHeightCache[rowIndex]) ? Math.max(this._minHeight, this._cellHeightCache[rowIndex]) : this._defaultHeight;
|
|
612
|
+
}
|
|
613
|
+
}, {
|
|
614
|
+
key: "getWidth",
|
|
615
|
+
value: function(rowIndex) {
|
|
616
|
+
return !this._hasFixedWidth && (rowIndex = this._keyMapper(rowIndex, 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0),
|
|
617
|
+
void 0 !== this._cellWidthCache[rowIndex]) ? Math.max(this._minWidth, this._cellWidthCache[rowIndex]) : this._defaultWidth;
|
|
618
|
+
}
|
|
619
|
+
}, {
|
|
620
|
+
key: "has",
|
|
621
|
+
value: function(rowIndex) {
|
|
622
|
+
rowIndex = this._keyMapper(rowIndex, 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0);
|
|
623
|
+
return void 0 !== this._cellHeightCache[rowIndex];
|
|
624
|
+
}
|
|
625
|
+
}, {
|
|
626
|
+
key: "set",
|
|
627
|
+
value: function(rowIndex, columnIndex, width, height) {
|
|
628
|
+
var key = this._keyMapper(rowIndex, columnIndex);
|
|
629
|
+
columnIndex >= this._columnCount && (this._columnCount = columnIndex + 1),
|
|
630
|
+
rowIndex >= this._rowCount && (this._rowCount = rowIndex + 1), this._cellHeightCache[key] = height,
|
|
631
|
+
this._cellWidthCache[key] = width, this._updateCachedColumnAndRowSizes(rowIndex, columnIndex);
|
|
632
|
+
}
|
|
633
|
+
}, {
|
|
634
|
+
key: "_updateCachedColumnAndRowSizes",
|
|
635
|
+
value: function(rowIndex, columnIndex) {
|
|
636
|
+
if (!this._hasFixedWidth) {
|
|
637
|
+
for (var columnWidth = 0, i = 0; i < this._rowCount; i++) columnWidth = Math.max(columnWidth, this.getWidth(i, columnIndex));
|
|
638
|
+
var columnKey = this._keyMapper(0, columnIndex);
|
|
639
|
+
this._columnWidthCache[columnKey] = columnWidth;
|
|
640
|
+
}
|
|
641
|
+
if (!this._hasFixedHeight) {
|
|
642
|
+
for (var rowHeight = 0, _i = 0; _i < this._columnCount; _i++) rowHeight = Math.max(rowHeight, this.getHeight(rowIndex, _i));
|
|
643
|
+
columnKey = this._keyMapper(rowIndex, 0);
|
|
644
|
+
this._rowHeightCache[columnKey] = rowHeight;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
} ]));
|
|
648
|
+
function defaultKeyMapper(rowIndex, columnIndex) {
|
|
649
|
+
return "".concat(rowIndex, "-").concat(columnIndex);
|
|
650
|
+
}
|
|
651
|
+
function createCommonjsModule(fn, module) {
|
|
652
|
+
return fn(module = {
|
|
653
|
+
exports: {}
|
|
654
|
+
}, module.exports), module.exports;
|
|
655
|
+
}
|
|
656
|
+
var reactIs_development = createCommonjsModule(function(module, exports) {
|
|
657
|
+
function typeOf(object) {
|
|
658
|
+
if ("object" == typeof object && null !== object) {
|
|
659
|
+
var $$typeof = object.$$typeof;
|
|
660
|
+
switch ($$typeof) {
|
|
661
|
+
case REACT_ELEMENT_TYPE:
|
|
662
|
+
var type = object.type;
|
|
663
|
+
switch (type) {
|
|
664
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
665
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
666
|
+
case REACT_FRAGMENT_TYPE:
|
|
667
|
+
case REACT_PROFILER_TYPE:
|
|
668
|
+
case REACT_STRICT_MODE_TYPE:
|
|
669
|
+
case REACT_SUSPENSE_TYPE:
|
|
670
|
+
return type;
|
|
671
|
+
|
|
672
|
+
default:
|
|
673
|
+
var $$typeofType = type && type.$$typeof;
|
|
674
|
+
switch ($$typeofType) {
|
|
675
|
+
case REACT_CONTEXT_TYPE:
|
|
676
|
+
case REACT_FORWARD_REF_TYPE:
|
|
677
|
+
case REACT_LAZY_TYPE:
|
|
678
|
+
case REACT_MEMO_TYPE:
|
|
679
|
+
case REACT_PROVIDER_TYPE:
|
|
680
|
+
return $$typeofType;
|
|
681
|
+
|
|
682
|
+
default:
|
|
683
|
+
return $$typeof;
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
case REACT_PORTAL_TYPE:
|
|
688
|
+
return $$typeof;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
} // AsyncMode is deprecated along with isAsyncMode
|
|
692
|
+
function isConcurrentMode(object) {
|
|
693
|
+
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
694
|
+
}
|
|
695
|
+
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;
|
|
696
|
+
hasSymbol = "function" == typeof Symbol && Symbol.for, REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103,
|
|
697
|
+
REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106, REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107,
|
|
698
|
+
REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108,
|
|
699
|
+
REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 60114,
|
|
700
|
+
REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 60109,
|
|
701
|
+
REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 60110, REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for("react.async_mode") : 60111,
|
|
702
|
+
REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for("react.concurrent_mode") : 60111,
|
|
703
|
+
REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112,
|
|
704
|
+
REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113,
|
|
705
|
+
REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for("react.suspense_list") : 60120,
|
|
706
|
+
REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115, REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116,
|
|
707
|
+
REACT_BLOCK_TYPE = hasSymbol ? Symbol.for("react.block") : 60121, REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for("react.fundamental") : 60117,
|
|
708
|
+
REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 60118,
|
|
709
|
+
REACT_SCOPE_TYPE = hasSymbol ? Symbol.for("react.scope") : 60119, hasSymbol = REACT_CONCURRENT_MODE_TYPE,
|
|
710
|
+
ContextConsumer = REACT_CONTEXT_TYPE, ContextProvider = REACT_PROVIDER_TYPE,
|
|
711
|
+
Element = REACT_ELEMENT_TYPE, ForwardRef = REACT_FORWARD_REF_TYPE, Fragment = REACT_FRAGMENT_TYPE,
|
|
712
|
+
Lazy = REACT_LAZY_TYPE, Memo = REACT_MEMO_TYPE, Portal = REACT_PORTAL_TYPE,
|
|
713
|
+
Profiler = REACT_PROFILER_TYPE, StrictMode = REACT_STRICT_MODE_TYPE, Suspense = REACT_SUSPENSE_TYPE,
|
|
714
|
+
hasWarnedAboutDeprecatedIsAsyncMode = !1, exports.AsyncMode = REACT_ASYNC_MODE_TYPE,
|
|
715
|
+
exports.ConcurrentMode = hasSymbol, exports.ContextConsumer = ContextConsumer,
|
|
716
|
+
exports.ContextProvider = ContextProvider, exports.Element = Element, exports.ForwardRef = ForwardRef,
|
|
717
|
+
exports.Fragment = Fragment, exports.Lazy = Lazy, exports.Memo = Memo, exports.Portal = Portal,
|
|
718
|
+
exports.Profiler = Profiler, exports.StrictMode = StrictMode, exports.Suspense = Suspense,
|
|
719
|
+
exports.isAsyncMode = // AsyncMode should be deprecated
|
|
720
|
+
function(object) {
|
|
721
|
+
return hasWarnedAboutDeprecatedIsAsyncMode || (hasWarnedAboutDeprecatedIsAsyncMode = !0,
|
|
722
|
+
// Using console['warn'] to evade Babel and ESLint
|
|
723
|
+
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.")),
|
|
724
|
+
isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
725
|
+
}, exports.isConcurrentMode = isConcurrentMode, exports.isContextConsumer = function(object) {
|
|
726
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
727
|
+
}, exports.isContextProvider = function(object) {
|
|
728
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
729
|
+
}, exports.isElement = function(object) {
|
|
730
|
+
return "object" == typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
731
|
+
}, exports.isForwardRef = function(object) {
|
|
732
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
733
|
+
}, exports.isFragment = function(object) {
|
|
734
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
735
|
+
}, exports.isLazy = function(object) {
|
|
736
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
737
|
+
}, exports.isMemo = function(object) {
|
|
738
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
739
|
+
}, exports.isPortal = function(object) {
|
|
740
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
741
|
+
}, exports.isProfiler = function(object) {
|
|
742
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
743
|
+
}, exports.isStrictMode = function(object) {
|
|
744
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
745
|
+
}, exports.isSuspense = function(object) {
|
|
746
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
747
|
+
}, exports.isValidElementType = function(type) {
|
|
748
|
+
return "string" == typeof type || "function" == typeof type || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
749
|
+
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);
|
|
750
|
+
}, exports.typeOf = typeOf;
|
|
751
|
+
}), reactIs = (reactIs_development.AsyncMode, createCommonjsModule(function(module) {
|
|
752
|
+
module.exports = reactIs_development;
|
|
753
|
+
})), getOwnPropertySymbols = Object.getOwnPropertySymbols, hasOwnProperty = Object.prototype.hasOwnProperty, propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
754
|
+
var objectAssign = (() => {
|
|
755
|
+
try {
|
|
756
|
+
if (Object.assign) {
|
|
757
|
+
// Detect buggy property enumeration order in older V8 versions.
|
|
758
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
759
|
+
var test1 = new String("abc"); // eslint-disable-line no-new-wrappers
|
|
760
|
+
if (test1[5] = "de", "5" !== Object.getOwnPropertyNames(test1)[0]) {
|
|
761
|
+
for (
|
|
762
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
763
|
+
var test2 = {}, i = 0; i < 10; i++) test2["_" + String.fromCharCode(i)] = i;
|
|
764
|
+
var test3, order2 = Object.getOwnPropertyNames(test2).map(function(n) {
|
|
765
|
+
return test2[n];
|
|
766
|
+
});
|
|
767
|
+
if ("0123456789" === order2.join("")) return test3 = {}, "abcdefghijklmnopqrst".split("").forEach(function(letter) {
|
|
768
|
+
test3[letter] = letter;
|
|
769
|
+
}), "abcdefghijklmnopqrst" === Object.keys(Object.assign({}, test3)).join("") ? 1 : void 0;
|
|
770
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
} catch (err) {}
|
|
774
|
+
})() ? Object.assign : function(target, source) {
|
|
775
|
+
for (var from, to = (val => {
|
|
776
|
+
if (null == val) throw new TypeError("Object.assign cannot be called with null or undefined");
|
|
777
|
+
return Object(val);
|
|
778
|
+
})(target), s = 1; s < arguments.length; s++) {
|
|
779
|
+
for (var key in from = Object(arguments[s])) hasOwnProperty.call(from, key) && (to[key] = from[key]);
|
|
780
|
+
if (getOwnPropertySymbols) for (var symbols = getOwnPropertySymbols(from), i = 0; i < symbols.length; i++) propIsEnumerable.call(from, symbols[i]) && (to[symbols[i]] = from[symbols[i]]);
|
|
781
|
+
}
|
|
782
|
+
return to;
|
|
783
|
+
}, ReactPropTypesSecret_1 = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED", has = Function.call.bind(Object.prototype.hasOwnProperty), loggedTypeFailures = {}, has$1 = has, printWarning = function(text) {
|
|
784
|
+
text = "Warning: " + text;
|
|
785
|
+
"undefined" != typeof console && console.error(text);
|
|
786
|
+
try {
|
|
787
|
+
// --- Welcome to debugging React ---
|
|
788
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
789
|
+
// to find the callsite that caused this warning to fire.
|
|
790
|
+
throw new Error(text);
|
|
791
|
+
} catch (x) {/**/}
|
|
792
|
+
};
|
|
793
|
+
/**
|
|
794
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
795
|
+
*
|
|
796
|
+
* This source code is licensed under the MIT license found in the
|
|
797
|
+
* LICENSE file in the root directory of this source tree.
|
|
798
|
+
*/
|
|
799
|
+
/**
|
|
800
|
+
* Assert that the values match with the type specs.
|
|
801
|
+
* Error messages are memorized and will only be shown once.
|
|
802
|
+
*
|
|
803
|
+
* @param {object} typeSpecs Map of name to a ReactPropType
|
|
804
|
+
* @param {object} values Runtime values that need to be type-checked
|
|
805
|
+
* @param {string} location e.g. "prop", "context", "child context"
|
|
806
|
+
* @param {string} componentName Name of the component for error messages.
|
|
807
|
+
* @param {?Function} getStack Returns the component stack.
|
|
808
|
+
* @private
|
|
809
|
+
*/
|
|
810
|
+
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
811
|
+
for (var typeSpecName in typeSpecs) if (has$1(typeSpecs, typeSpecName)) {
|
|
812
|
+
var error, err;
|
|
813
|
+
// Prop type validation may throw. In case they do, we don't want to
|
|
814
|
+
// fail the render phase where it didn't fail before. So we log it.
|
|
815
|
+
// After these have been cleaned up, we'll let them throw.
|
|
816
|
+
try {
|
|
817
|
+
// This is intentionally an invariant that gets caught. It's the same
|
|
818
|
+
// behavior as without this statement except with a better message.
|
|
819
|
+
if ("function" != typeof typeSpecs[typeSpecName]) throw (err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.")).name = "Invariant Violation",
|
|
820
|
+
err;
|
|
821
|
+
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
822
|
+
} catch (ex) {
|
|
823
|
+
error = ex;
|
|
824
|
+
}
|
|
825
|
+
!error || error instanceof Error || printWarning((componentName || "React class") + ": type specification of " + location + " `" + typeSpecName + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof error + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),
|
|
826
|
+
error instanceof Error && !(error.message in loggedTypeFailures) && (
|
|
827
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
828
|
+
// same error.
|
|
829
|
+
loggedTypeFailures[error.message] = !0, typeSpecName = getStack ? getStack() : "",
|
|
830
|
+
printWarning("Failed " + location + " type: " + error.message + (null != typeSpecName ? typeSpecName : "")));
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Resets warning cache when testing.
|
|
835
|
+
*
|
|
836
|
+
* @private
|
|
837
|
+
*/
|
|
838
|
+
checkPropTypes.resetWarningCache = function() {
|
|
839
|
+
loggedTypeFailures = {};
|
|
840
|
+
};
|
|
841
|
+
var checkPropTypes_1 = checkPropTypes;
|
|
842
|
+
function emptyFunctionThatReturnsNull() {
|
|
843
|
+
return null;
|
|
844
|
+
}
|
|
845
|
+
function factoryWithTypeCheckers(isValidElement, throwOnDirectAccess) {
|
|
846
|
+
/* global Symbol */
|
|
847
|
+
var ITERATOR_SYMBOL = "function" == typeof Symbol && Symbol.iterator, FAUX_ITERATOR_SYMBOL = "@@iterator", ANONYMOUS = "<<anonymous>>", ReactPropTypes = {
|
|
848
|
+
array: createPrimitiveTypeChecker("array"),
|
|
849
|
+
bigint: createPrimitiveTypeChecker("bigint"),
|
|
850
|
+
bool: createPrimitiveTypeChecker("boolean"),
|
|
851
|
+
func: createPrimitiveTypeChecker("function"),
|
|
852
|
+
number: createPrimitiveTypeChecker("number"),
|
|
853
|
+
object: createPrimitiveTypeChecker("object"),
|
|
854
|
+
string: createPrimitiveTypeChecker("string"),
|
|
855
|
+
symbol: createPrimitiveTypeChecker("symbol"),
|
|
856
|
+
any: createChainableTypeChecker(emptyFunctionThatReturnsNull),
|
|
857
|
+
arrayOf: function(typeChecker) {
|
|
858
|
+
return createChainableTypeChecker(function(props, propName, componentName, location, propFullName) {
|
|
859
|
+
if ("function" != typeof typeChecker) return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside arrayOf.");
|
|
860
|
+
var propValue = props[propName];
|
|
861
|
+
if (!Array.isArray(propValue)) return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + getPropType(propValue) + "` supplied to `" + componentName + "`, expected an array.");
|
|
862
|
+
for (var i = 0; i < propValue.length; i++) {
|
|
863
|
+
var error = typeChecker(propValue, i, componentName, location, propFullName + "[" + i + "]", ReactPropTypesSecret_1);
|
|
864
|
+
if (error instanceof Error) return error;
|
|
865
|
+
}
|
|
866
|
+
return null;
|
|
867
|
+
});
|
|
868
|
+
},
|
|
869
|
+
element: createChainableTypeChecker(function(props, propName, componentName, location, propFullName) {
|
|
870
|
+
return props = props[propName], isValidElement(props) ? null : new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + getPropType(props) + "` supplied to `" + componentName + "`, expected a single ReactElement.");
|
|
871
|
+
}),
|
|
872
|
+
elementType: createChainableTypeChecker(function(props, propName, componentName, location, propFullName) {
|
|
873
|
+
return props = props[propName], reactIs.isValidElementType(props) ? null : new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + getPropType(props) + "` supplied to `" + componentName + "`, expected a single ReactElement type.");
|
|
874
|
+
}),
|
|
875
|
+
instanceOf: function(expectedClass) {
|
|
876
|
+
return createChainableTypeChecker(function(props, propName, componentName, location, propFullName) {
|
|
877
|
+
var expectedClassName;
|
|
878
|
+
return props[propName] instanceof expectedClass ? null : (expectedClassName = expectedClass.name || ANONYMOUS,
|
|
879
|
+
new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + ((location = props[propName]).constructor && location.constructor.name ? location.constructor.name : ANONYMOUS) + "` supplied to `" + componentName + "`, expected instance of `" + expectedClassName + "`."));
|
|
880
|
+
});
|
|
881
|
+
},
|
|
882
|
+
node: createChainableTypeChecker(function(props, propName, componentName, location, propFullName) {
|
|
883
|
+
return isNode(props[propName]) ? null : new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to `" + componentName + "`, expected a ReactNode.");
|
|
884
|
+
}),
|
|
885
|
+
objectOf: function(typeChecker) {
|
|
886
|
+
return createChainableTypeChecker(function(props, propName, componentName, location, propFullName) {
|
|
887
|
+
if ("function" != typeof typeChecker) return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside objectOf.");
|
|
888
|
+
var key, propValue = props[propName];
|
|
889
|
+
if ("object" !== (props = getPropType(propValue))) return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + props + "` supplied to `" + componentName + "`, expected an object.");
|
|
890
|
+
for (key in propValue) if (has(propValue, key)) {
|
|
891
|
+
var error = typeChecker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret_1);
|
|
892
|
+
if (error instanceof Error) return error;
|
|
893
|
+
}
|
|
894
|
+
return null;
|
|
895
|
+
});
|
|
896
|
+
},
|
|
897
|
+
oneOf: function(expectedValues) {
|
|
898
|
+
if (Array.isArray(expectedValues)) return createChainableTypeChecker(function(props, propName, componentName, location, propFullName) {
|
|
899
|
+
for (var propValue = props[propName], i = 0; i < expectedValues.length; i++) if ((
|
|
900
|
+
/**
|
|
901
|
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
902
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
903
|
+
*/
|
|
904
|
+
/*eslint-disable no-self-compare*/
|
|
905
|
+
(x, y) =>
|
|
906
|
+
// SameValue algorithm
|
|
907
|
+
x === y ? 0 !== x || 1 / x == 1 / y : x != x && y != y
|
|
908
|
+
/*eslint-enable no-self-compare*/
|
|
909
|
+
/**
|
|
910
|
+
* We use an Error-like object for backward compatibility as people may call
|
|
911
|
+
* PropTypes directly and inspect their output. However, we don't use real
|
|
912
|
+
* Errors anymore. We don't inspect their stack anyway, and creating them
|
|
913
|
+
* is prohibitively expensive if they are created too often, such as what
|
|
914
|
+
* happens in oneOfType() for any type before the one that matched.
|
|
915
|
+
*/)(propValue, expectedValues[i])) return null;
|
|
916
|
+
props = JSON.stringify(expectedValues, function(key, value) {
|
|
917
|
+
return "symbol" === getPreciseType(value) ? String(value) : value;
|
|
918
|
+
});
|
|
919
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of value `" + String(propValue) + "` supplied to `" + componentName + "`, expected one of " + props + ".");
|
|
920
|
+
});
|
|
921
|
+
printWarning$1(1 < arguments.length ? "Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])." : "Invalid argument supplied to oneOf, expected an array.");
|
|
922
|
+
return emptyFunctionThatReturnsNull;
|
|
923
|
+
},
|
|
924
|
+
oneOfType: function(arrayOfTypeCheckers) {
|
|
925
|
+
if (!Array.isArray(arrayOfTypeCheckers)) return printWarning$1("Invalid argument supplied to oneOfType, expected an instance of array."),
|
|
926
|
+
emptyFunctionThatReturnsNull;
|
|
927
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
928
|
+
var checker = arrayOfTypeCheckers[i];
|
|
929
|
+
if ("function" != typeof checker) return printWarning$1("Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + (
|
|
930
|
+
// Returns a string that is postfixed to a warning about an invalid type.
|
|
931
|
+
// For example, "undefined" or "of type array"
|
|
932
|
+
value => {
|
|
933
|
+
var type = getPreciseType(value);
|
|
934
|
+
switch (type) {
|
|
935
|
+
case "array":
|
|
936
|
+
case "object":
|
|
937
|
+
return "an " + type;
|
|
938
|
+
|
|
939
|
+
case "boolean":
|
|
940
|
+
case "date":
|
|
941
|
+
case "regexp":
|
|
942
|
+
return "a " + type;
|
|
943
|
+
|
|
944
|
+
default:
|
|
945
|
+
return type;
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
// Returns class name of the object, if any.
|
|
949
|
+
)(checker) + " at index " + i + "."), emptyFunctionThatReturnsNull;
|
|
950
|
+
}
|
|
951
|
+
return createChainableTypeChecker(function(props, propName, componentName, location, propFullName) {
|
|
952
|
+
for (var expectedTypes = [], i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
953
|
+
var checkerResult = (0, arrayOfTypeCheckers[i])(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1);
|
|
954
|
+
if (null == checkerResult) return null;
|
|
955
|
+
checkerResult.data && has(checkerResult.data, "expectedType") && expectedTypes.push(checkerResult.data.expectedType);
|
|
956
|
+
}
|
|
957
|
+
return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to `" + componentName + "`" + (0 < expectedTypes.length ? ", expected one of type [" + expectedTypes.join(", ") + "]" : "") + ".");
|
|
958
|
+
});
|
|
959
|
+
},
|
|
960
|
+
shape: function(shapeTypes) {
|
|
961
|
+
return createChainableTypeChecker(function(props, propName, componentName, location, propFullName) {
|
|
962
|
+
var key, propValue = props[propName];
|
|
963
|
+
if ("object" !== (props = getPropType(propValue))) return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + props + "` supplied to `" + componentName + "`, expected `object`.");
|
|
964
|
+
for (key in shapeTypes) {
|
|
965
|
+
var checker = shapeTypes[key];
|
|
966
|
+
if ("function" != typeof checker) return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
967
|
+
checker = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret_1);
|
|
968
|
+
if (checker) return checker;
|
|
969
|
+
}
|
|
970
|
+
return null;
|
|
971
|
+
});
|
|
972
|
+
},
|
|
973
|
+
exact: function(shapeTypes) {
|
|
974
|
+
return createChainableTypeChecker(function(props, propName, componentName, location, propFullName) {
|
|
975
|
+
var key, propValue = props[propName], propType = getPropType(propValue);
|
|
976
|
+
if ("object" !== propType) return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` supplied to `" + componentName + "`, expected `object`.");
|
|
977
|
+
// We need to check all keys in case some are required but missing from props.
|
|
978
|
+
for (key in objectAssign({}, props[propName], shapeTypes)) {
|
|
979
|
+
var checker = shapeTypes[key];
|
|
980
|
+
if (has(shapeTypes, key) && "function" != typeof checker) return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
981
|
+
if (!checker) return new PropTypeError("Invalid " + location + " `" + propFullName + "` key `" + key + "` supplied to `" + componentName + "`.\nBad object: " + JSON.stringify(props[propName], null, " ") + "\nValid keys: " + JSON.stringify(Object.keys(shapeTypes), null, " "));
|
|
982
|
+
checker = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret_1);
|
|
983
|
+
if (checker) return checker;
|
|
984
|
+
}
|
|
985
|
+
return null;
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
};
|
|
989
|
+
function PropTypeError(message, data) {
|
|
990
|
+
this.message = message, this.data = data && "object" == typeof data ? data : {},
|
|
991
|
+
this.stack = "";
|
|
992
|
+
}
|
|
993
|
+
// Make `instanceof Error` still work for returned errors.
|
|
994
|
+
function createChainableTypeChecker(validate) {
|
|
995
|
+
var manualPropTypeCallCache = {}, manualPropTypeWarningCount = 0;
|
|
996
|
+
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
997
|
+
if (componentName = componentName || ANONYMOUS, propFullName = propFullName || propName,
|
|
998
|
+
secret !== ReactPropTypesSecret_1) {
|
|
999
|
+
if (throwOnDirectAccess) throw (secret = new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types")).name = "Invariant Violation",
|
|
1000
|
+
secret;
|
|
1001
|
+
"undefined" != typeof console && !manualPropTypeCallCache[secret = componentName + ":" + propName] &&
|
|
1002
|
+
// Avoid spamming the console because they are often not actionable except for lib authors
|
|
1003
|
+
manualPropTypeWarningCount < 3 && (printWarning$1("You are manually calling a React.PropTypes validation function for the `" + propFullName + "` prop on `" + componentName + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),
|
|
1004
|
+
manualPropTypeCallCache[secret] = !0, manualPropTypeWarningCount++);
|
|
1005
|
+
}
|
|
1006
|
+
return null == props[propName] ? isRequired ? null === props[propName] ? new PropTypeError("The " + location + " `" + propFullName + "` is marked as required in `" + componentName + "`, but its value is `null`.") : new PropTypeError("The " + location + " `" + propFullName + "` is marked as required in `" + componentName + "`, but its value is `undefined`.") : null : validate(props, propName, componentName, location, propFullName);
|
|
1007
|
+
}
|
|
1008
|
+
var chainedCheckType = checkType.bind(null, !1);
|
|
1009
|
+
return chainedCheckType.isRequired = checkType.bind(null, !0), chainedCheckType;
|
|
1010
|
+
}
|
|
1011
|
+
function createPrimitiveTypeChecker(expectedType) {
|
|
1012
|
+
return createChainableTypeChecker(function(props, propName, componentName, location, propFullName, secret) {
|
|
1013
|
+
return getPropType(props = props[propName]) !== expectedType ? new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + getPreciseType(props) + "` supplied to `" + componentName + "`, expected `" + expectedType + "`.", {
|
|
1014
|
+
expectedType: expectedType
|
|
1015
|
+
}) : null;
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
|
1019
|
+
return new PropTypeError((componentName || "React class") + ": " + location + " type `" + propFullName + "." + key + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + type + "`.");
|
|
1020
|
+
}
|
|
1021
|
+
function isNode(propValue) {
|
|
1022
|
+
switch (typeof propValue) {
|
|
1023
|
+
case "number":
|
|
1024
|
+
case "string":
|
|
1025
|
+
case "undefined":
|
|
1026
|
+
return !0;
|
|
1027
|
+
|
|
1028
|
+
case "boolean":
|
|
1029
|
+
return !propValue;
|
|
1030
|
+
|
|
1031
|
+
case "object":
|
|
1032
|
+
if (Array.isArray(propValue)) return propValue.every(isNode);
|
|
1033
|
+
if (null !== propValue && !isValidElement(propValue)) {
|
|
1034
|
+
var iteratorFn = (// Before Symbol spec.
|
|
1035
|
+
/**
|
|
1036
|
+
* Returns the iterator method function contained on the iterable object.
|
|
1037
|
+
*
|
|
1038
|
+
* Be sure to invoke the function with the iterable as context:
|
|
1039
|
+
*
|
|
1040
|
+
* var iteratorFn = getIteratorFn(myIterable);
|
|
1041
|
+
* if (iteratorFn) {
|
|
1042
|
+
* var iterator = iteratorFn.call(myIterable);
|
|
1043
|
+
* ...
|
|
1044
|
+
* }
|
|
1045
|
+
*
|
|
1046
|
+
* @param {?object} maybeIterable
|
|
1047
|
+
* @return {?function}
|
|
1048
|
+
*/
|
|
1049
|
+
maybeIterable => {
|
|
1050
|
+
if ("function" == typeof (maybeIterable = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]))) return maybeIterable;
|
|
1051
|
+
}
|
|
1052
|
+
/**
|
|
1053
|
+
* Collection of methods that allow declaration and validation of props that are
|
|
1054
|
+
* supplied to React components. Example usage:
|
|
1055
|
+
*
|
|
1056
|
+
* var Props = require('ReactPropTypes');
|
|
1057
|
+
* var MyArticle = React.createClass({
|
|
1058
|
+
* propTypes: {
|
|
1059
|
+
* // An optional string prop named "description".
|
|
1060
|
+
* description: Props.string,
|
|
1061
|
+
*
|
|
1062
|
+
* // A required enum prop named "category".
|
|
1063
|
+
* category: Props.oneOf(['News','Photos']).isRequired,
|
|
1064
|
+
*
|
|
1065
|
+
* // A prop named "dialog" that requires an instance of Dialog.
|
|
1066
|
+
* dialog: Props.instanceOf(Dialog).isRequired
|
|
1067
|
+
* },
|
|
1068
|
+
* render: function() { ... }
|
|
1069
|
+
* });
|
|
1070
|
+
*
|
|
1071
|
+
* A more formal specification of how these methods are used:
|
|
1072
|
+
*
|
|
1073
|
+
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
|
1074
|
+
* decl := ReactPropTypes.{type}(.isRequired)?
|
|
1075
|
+
*
|
|
1076
|
+
* Each and every declaration produces a function with the same signature. This
|
|
1077
|
+
* allows the creation of custom validation functions. For example:
|
|
1078
|
+
*
|
|
1079
|
+
* var MyLink = React.createClass({
|
|
1080
|
+
* propTypes: {
|
|
1081
|
+
* // An optional string or URI prop named "href".
|
|
1082
|
+
* href: function(props, propName, componentName) {
|
|
1083
|
+
* var propValue = props[propName];
|
|
1084
|
+
* if (propValue != null && typeof propValue !== 'string' &&
|
|
1085
|
+
* !(propValue instanceof URI)) {
|
|
1086
|
+
* return new Error(
|
|
1087
|
+
* 'Expected a string or an URI for ' + propName + ' in ' +
|
|
1088
|
+
* componentName
|
|
1089
|
+
* );
|
|
1090
|
+
* }
|
|
1091
|
+
* }
|
|
1092
|
+
* },
|
|
1093
|
+
* render: function() {...}
|
|
1094
|
+
* });
|
|
1095
|
+
*
|
|
1096
|
+
* @internal
|
|
1097
|
+
*/)(propValue);
|
|
1098
|
+
if (!iteratorFn) return !1;
|
|
1099
|
+
var step, iterator = iteratorFn.call(propValue);
|
|
1100
|
+
if (iteratorFn !== propValue.entries) {
|
|
1101
|
+
for (;!(step = iterator.next()).done; ) if (!isNode(step.value)) return !1;
|
|
1102
|
+
} else
|
|
1103
|
+
// Iterator will provide entry [k,v] tuples rather than values.
|
|
1104
|
+
for (;!(step = iterator.next()).done; ) {
|
|
1105
|
+
var entry = step.value;
|
|
1106
|
+
if (entry && !isNode(entry[1])) return !1;
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
return !0;
|
|
1110
|
+
|
|
1111
|
+
default:
|
|
1112
|
+
return !1;
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
// Equivalent of `typeof` but with special handling for array and regexp.
|
|
1116
|
+
function getPropType(propValue) {
|
|
1117
|
+
var propType = typeof propValue;
|
|
1118
|
+
return Array.isArray(propValue) ? "array" : propValue instanceof RegExp ? "object" : ((propType, propValue) =>
|
|
1119
|
+
// Native Symbol.
|
|
1120
|
+
"symbol" === propType ||
|
|
1121
|
+
// falsy value can't be a Symbol
|
|
1122
|
+
propValue && (
|
|
1123
|
+
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
1124
|
+
"Symbol" === propValue["@@toStringTag"] || "function" == typeof Symbol && propValue instanceof Symbol))(propType, propValue) ? "symbol" : propType;
|
|
1125
|
+
}
|
|
1126
|
+
// This handles more types than `getPropType`. Only used for error messages.
|
|
1127
|
+
// See `createPrimitiveTypeChecker`.
|
|
1128
|
+
function getPreciseType(propValue) {
|
|
1129
|
+
if (null == propValue) return "" + propValue;
|
|
1130
|
+
var propType = getPropType(propValue);
|
|
1131
|
+
if ("object" === propType) {
|
|
1132
|
+
if (propValue instanceof Date) return "date";
|
|
1133
|
+
if (propValue instanceof RegExp) return "regexp";
|
|
1134
|
+
}
|
|
1135
|
+
return propType;
|
|
1136
|
+
}
|
|
1137
|
+
return PropTypeError.prototype = Error.prototype, ReactPropTypes.checkPropTypes = checkPropTypes_1,
|
|
1138
|
+
ReactPropTypes.resetWarningCache = checkPropTypes_1.resetWarningCache, ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1139
|
+
}
|
|
1140
|
+
var printWarning$1 = function(text) {
|
|
1141
|
+
text = "Warning: " + text;
|
|
1142
|
+
"undefined" != typeof console && console.error(text);
|
|
1143
|
+
try {
|
|
1144
|
+
// --- Welcome to debugging React ---
|
|
1145
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
1146
|
+
// to find the callsite that caused this warning to fire.
|
|
1147
|
+
throw new Error(text);
|
|
1148
|
+
} catch (x) {}
|
|
1149
|
+
}, propTypes = createCommonjsModule(function(module) {
|
|
1150
|
+
var ReactIs = reactIs;
|
|
1151
|
+
// By explicitly using `prop-types` you are opting into new development behavior.
|
|
1152
|
+
// http://fb.me/prop-types-in-prod
|
|
1153
|
+
module.exports = factoryWithTypeCheckers(ReactIs.isElement, !0);
|
|
1154
|
+
});
|
|
1155
|
+
function clsx() {
|
|
1156
|
+
for (var e, f = 0, n = ""; f < arguments.length; ) (e = arguments[f++]) && (e = function r(e) {
|
|
1157
|
+
var t, f, n = "";
|
|
1158
|
+
if ("string" == typeof e || "number" == typeof e) n += e; else if ("object" == typeof e) if (Array.isArray(e)) for (t = 0; t < e.length; t++) e[t] && (f = r(e[t])) && (n && (n += " "),
|
|
1159
|
+
n += f); else for (t in e) e[t] && (n && (n += " "), n += t);
|
|
1160
|
+
return n;
|
|
1161
|
+
}(e)) && (n && (n += " "), n += e);
|
|
1162
|
+
return n;
|
|
1163
|
+
}
|
|
1164
|
+
function createCallbackMemoizer(argument_0) {
|
|
1165
|
+
var requireAllKeys = !(0 < arguments.length && void 0 !== argument_0) || argument_0, cachedIndices = {};
|
|
1166
|
+
return function(_ref) {
|
|
1167
|
+
var callback = _ref.callback, indices = _ref.indices, _ref = Object.keys(indices), allInitialized = !requireAllKeys || _ref.every(function(key) {
|
|
1168
|
+
key = indices[key];
|
|
1169
|
+
return Array.isArray(key) ? 0 < key.length : 0 <= key;
|
|
1170
|
+
}), _ref = _ref.length !== Object.keys(cachedIndices).length || _ref.some(function(key) {
|
|
1171
|
+
var cachedValue = cachedIndices[key], key = indices[key];
|
|
1172
|
+
return Array.isArray(key) ? cachedValue.join(",") !== key.join(",") : cachedValue !== key;
|
|
1173
|
+
});
|
|
1174
|
+
cachedIndices = indices, allInitialized && _ref && callback(indices);
|
|
1175
|
+
};
|
|
1176
|
+
}
|
|
1177
|
+
var size, canUseDOM = !("undefined" == typeof window || !window.document || !window.document.createElement);
|
|
1178
|
+
function scrollbarSize(recalc) {
|
|
1179
|
+
return (!size && 0 !== size || recalc) && canUseDOM && ((recalc = document.createElement("div")).style.position = "absolute",
|
|
1180
|
+
recalc.style.top = "-9999px", recalc.style.width = "50px", recalc.style.height = "50px",
|
|
1181
|
+
recalc.style.overflow = "scroll", document.body.appendChild(recalc), size = recalc.offsetWidth - recalc.clientWidth,
|
|
1182
|
+
document.body.removeChild(recalc)), size;
|
|
1183
|
+
}
|
|
1184
|
+
var SCROLL_POSITION_CHANGE_REASONS_OBSERVED = "observed", SCROLL_POSITION_CHANGE_REASONS_REQUESTED = "requested", CollectionView = (() => {
|
|
1185
|
+
function CollectionView() {
|
|
1186
|
+
var _this;
|
|
1187
|
+
_classCallCheck(this, CollectionView);
|
|
1188
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
|
1189
|
+
return _defineProperty(_this = _callSuper(this, CollectionView, [].concat(args)), "state", {
|
|
1190
|
+
isScrolling: !1,
|
|
1191
|
+
scrollLeft: 0,
|
|
1192
|
+
scrollTop: 0
|
|
1193
|
+
}), _defineProperty(_this, "_calculateSizeAndPositionDataOnNextUpdate", !1),
|
|
1194
|
+
_defineProperty(_this, "_onSectionRenderedMemoizer", createCallbackMemoizer()),
|
|
1195
|
+
_defineProperty(_this, "_onScrollMemoizer", createCallbackMemoizer(!1)),
|
|
1196
|
+
_defineProperty(_this, "_invokeOnSectionRenderedHelper", function() {
|
|
1197
|
+
var _this$props = _this.props, cellLayoutManager = _this$props.cellLayoutManager;
|
|
1198
|
+
_this._onSectionRenderedMemoizer({
|
|
1199
|
+
callback: _this$props.onSectionRendered,
|
|
1200
|
+
indices: {
|
|
1201
|
+
indices: cellLayoutManager.getLastRenderedIndices()
|
|
1202
|
+
}
|
|
1203
|
+
});
|
|
1204
|
+
}), _defineProperty(_this, "_setScrollingContainerRef", function(ref) {
|
|
1205
|
+
_this._scrollingContainer = ref;
|
|
1206
|
+
}), _defineProperty(_this, "_updateScrollPositionForScrollToCell", function() {
|
|
1207
|
+
var _this$props2 = _this.props, cellLayoutManager = _this$props2.cellLayoutManager, scrollToCell = _this$props2.scrollToCell, _this$state = _this.state, scrollLeft = _this$state.scrollLeft, _this$state = _this$state.scrollTop;
|
|
1208
|
+
0 <= scrollToCell && ((cellLayoutManager = cellLayoutManager.getScrollPositionForCell({
|
|
1209
|
+
align: _this$props2.scrollToAlignment,
|
|
1210
|
+
cellIndex: scrollToCell,
|
|
1211
|
+
height: _this$props2.height,
|
|
1212
|
+
scrollLeft: scrollLeft,
|
|
1213
|
+
scrollTop: _this$state,
|
|
1214
|
+
width: _this$props2.width
|
|
1215
|
+
})).scrollLeft === scrollLeft && cellLayoutManager.scrollTop === _this$state || _this._setScrollPosition(cellLayoutManager));
|
|
1216
|
+
}), _defineProperty(_this, "_onScroll", function(event) {
|
|
1217
|
+
var isScrollingChange, totalHeight, cellLayoutManager, _this$props3, height, scrollbarSize;
|
|
1218
|
+
event.target === _this._scrollingContainer && (_this._enablePointerEventsAfterDelay(),
|
|
1219
|
+
cellLayoutManager = (_this$props3 = _this.props).cellLayoutManager,
|
|
1220
|
+
height = _this$props3.height, isScrollingChange = _this$props3.isScrollingChange,
|
|
1221
|
+
_this$props3 = _this$props3.width, scrollbarSize = _this._scrollbarSize,
|
|
1222
|
+
totalHeight = (cellLayoutManager = cellLayoutManager.getTotalSize()).height,
|
|
1223
|
+
cellLayoutManager = cellLayoutManager.width, _this$props3 = Math.max(0, Math.min(cellLayoutManager - _this$props3 + scrollbarSize, event.target.scrollLeft)),
|
|
1224
|
+
height = Math.max(0, Math.min(totalHeight - height + scrollbarSize, event.target.scrollTop)),
|
|
1225
|
+
_this.state.scrollLeft === _this$props3 && _this.state.scrollTop === height || (scrollbarSize = event.cancelable ? SCROLL_POSITION_CHANGE_REASONS_OBSERVED : SCROLL_POSITION_CHANGE_REASONS_REQUESTED,
|
|
1226
|
+
_this.state.isScrolling || isScrollingChange(!0), _this.setState({
|
|
1227
|
+
isScrolling: !0,
|
|
1228
|
+
scrollLeft: _this$props3,
|
|
1229
|
+
scrollPositionChangeReason: scrollbarSize,
|
|
1230
|
+
scrollTop: height
|
|
1231
|
+
})), _this._invokeOnScrollMemoizer({
|
|
1232
|
+
scrollLeft: _this$props3,
|
|
1233
|
+
scrollTop: height,
|
|
1234
|
+
totalWidth: cellLayoutManager,
|
|
1235
|
+
totalHeight: totalHeight
|
|
1236
|
+
}));
|
|
1237
|
+
}), _this._scrollbarSize = scrollbarSize(), void 0 === _this._scrollbarSize ? (_this._scrollbarSizeMeasured = !1,
|
|
1238
|
+
_this._scrollbarSize = 0) : _this._scrollbarSizeMeasured = !0, _this;
|
|
1239
|
+
}
|
|
1240
|
+
return _inherits(CollectionView, React.PureComponent), _createClass(CollectionView, [ {
|
|
1241
|
+
key: "recomputeCellSizesAndPositions",
|
|
1242
|
+
value: function() {
|
|
1243
|
+
this._calculateSizeAndPositionDataOnNextUpdate = !0, this.forceUpdate();
|
|
1244
|
+
}
|
|
1245
|
+
}, {
|
|
1246
|
+
key: "componentDidMount",
|
|
1247
|
+
value: function() {
|
|
1248
|
+
var _this$props4 = this.props, cellLayoutManager = _this$props4.cellLayoutManager, scrollLeft = _this$props4.scrollLeft, scrollToCell = _this$props4.scrollToCell, _this$props4 = _this$props4.scrollTop, scrollToCell = (this._scrollbarSizeMeasured || (this._scrollbarSize = scrollbarSize(),
|
|
1249
|
+
this._scrollbarSizeMeasured = !0, this.setState({})), 0 <= scrollToCell ? this._updateScrollPositionForScrollToCell() : (0 <= scrollLeft || 0 <= _this$props4) && this._setScrollPosition({
|
|
1250
|
+
scrollLeft: scrollLeft,
|
|
1251
|
+
scrollTop: _this$props4
|
|
1252
|
+
}), this._invokeOnSectionRenderedHelper(), cellLayoutManager.getTotalSize()), cellLayoutManager = scrollToCell.height;
|
|
1253
|
+
this._invokeOnScrollMemoizer({
|
|
1254
|
+
scrollLeft: scrollLeft || 0,
|
|
1255
|
+
scrollTop: _this$props4 || 0,
|
|
1256
|
+
totalHeight: cellLayoutManager,
|
|
1257
|
+
totalWidth: scrollToCell.width
|
|
1258
|
+
});
|
|
1259
|
+
}
|
|
1260
|
+
}, {
|
|
1261
|
+
key: "componentDidUpdate",
|
|
1262
|
+
value: function(prevProps, prevState) {
|
|
1263
|
+
var _this$props5 = this.props, height = _this$props5.height, scrollToAlignment = _this$props5.scrollToAlignment, scrollToCell = _this$props5.scrollToCell, _this$props5 = _this$props5.width, _this$state2 = this.state, scrollLeft = _this$state2.scrollLeft, scrollTop = _this$state2.scrollTop;
|
|
1264
|
+
_this$state2.scrollPositionChangeReason === SCROLL_POSITION_CHANGE_REASONS_REQUESTED && (0 <= scrollLeft && scrollLeft !== prevState.scrollLeft && scrollLeft !== this._scrollingContainer.scrollLeft && (this._scrollingContainer.scrollLeft = scrollLeft),
|
|
1265
|
+
0 <= scrollTop) && scrollTop !== prevState.scrollTop && scrollTop !== this._scrollingContainer.scrollTop && (this._scrollingContainer.scrollTop = scrollTop),
|
|
1266
|
+
height === prevProps.height && scrollToAlignment === prevProps.scrollToAlignment && scrollToCell === prevProps.scrollToCell && _this$props5 === prevProps.width || this._updateScrollPositionForScrollToCell(),
|
|
1267
|
+
this._invokeOnSectionRenderedHelper();
|
|
1268
|
+
}
|
|
1269
|
+
}, {
|
|
1270
|
+
key: "componentWillUnmount",
|
|
1271
|
+
value: function() {
|
|
1272
|
+
this._disablePointerEventsTimeoutId && clearTimeout(this._disablePointerEventsTimeoutId);
|
|
1273
|
+
}
|
|
1274
|
+
}, {
|
|
1275
|
+
key: "render",
|
|
1276
|
+
value: function() {
|
|
1277
|
+
var _this$props6 = this.props, autoHeight = _this$props6.autoHeight, cellCount = _this$props6.cellCount, cellLayoutManager = _this$props6.cellLayoutManager, className = _this$props6.className, height = _this$props6.height, horizontalOverscanSize = _this$props6.horizontalOverscanSize, id = _this$props6.id, noContentRenderer = _this$props6.noContentRenderer, style = _this$props6.style, verticalOverscanSize = _this$props6.verticalOverscanSize, _this$props6 = _this$props6.width, _this$state3 = this.state, isScrolling = _this$state3.isScrolling, scrollLeft = _this$state3.scrollLeft, _this$state3 = _this$state3.scrollTop, _cellLayoutManager$ge3 = (this._lastRenderedCellCount === cellCount && this._lastRenderedCellLayoutManager === cellLayoutManager && !this._calculateSizeAndPositionDataOnNextUpdate || (this._lastRenderedCellCount = cellCount,
|
|
1278
|
+
this._lastRenderedCellLayoutManager = cellLayoutManager, this._calculateSizeAndPositionDataOnNextUpdate = !1,
|
|
1279
|
+
cellLayoutManager.calculateSizeAndPositionData()), cellLayoutManager.getTotalSize()), totalHeight = _cellLayoutManager$ge3.height, _cellLayoutManager$ge3 = _cellLayoutManager$ge3.width, left = Math.max(0, scrollLeft - horizontalOverscanSize), top = Math.max(0, _this$state3 - verticalOverscanSize), scrollLeft = Math.min(_cellLayoutManager$ge3, scrollLeft + _this$props6 + horizontalOverscanSize), horizontalOverscanSize = Math.min(totalHeight, _this$state3 + height + verticalOverscanSize), _this$state3 = 0 < height && 0 < _this$props6 ? cellLayoutManager.cellRenderers({
|
|
1280
|
+
height: horizontalOverscanSize - top,
|
|
1281
|
+
isScrolling: isScrolling,
|
|
1282
|
+
width: scrollLeft - left,
|
|
1283
|
+
x: left,
|
|
1284
|
+
y: top
|
|
1285
|
+
}) : [], verticalOverscanSize = {
|
|
1286
|
+
boxSizing: "border-box",
|
|
1287
|
+
direction: "ltr",
|
|
1288
|
+
height: autoHeight ? "auto" : height,
|
|
1289
|
+
position: "relative",
|
|
1290
|
+
WebkitOverflowScrolling: "touch",
|
|
1291
|
+
width: _this$props6,
|
|
1292
|
+
willChange: "transform"
|
|
1293
|
+
}, cellLayoutManager = height < totalHeight ? this._scrollbarSize : 0, horizontalOverscanSize = _this$props6 < _cellLayoutManager$ge3 ? this._scrollbarSize : 0;
|
|
1294
|
+
return verticalOverscanSize.overflowX = _cellLayoutManager$ge3 + cellLayoutManager <= _this$props6 ? "hidden" : "auto",
|
|
1295
|
+
verticalOverscanSize.overflowY = totalHeight + horizontalOverscanSize <= height ? "hidden" : "auto",
|
|
1296
|
+
React.createElement("div", {
|
|
1297
|
+
ref: this._setScrollingContainerRef,
|
|
1298
|
+
"aria-label": this.props["aria-label"],
|
|
1299
|
+
className: clsx("ReactVirtualized__Collection", className),
|
|
1300
|
+
id: id,
|
|
1301
|
+
onScroll: this._onScroll,
|
|
1302
|
+
role: "grid",
|
|
1303
|
+
style: _objectSpread2(_objectSpread2({}, verticalOverscanSize), style),
|
|
1304
|
+
tabIndex: 0
|
|
1305
|
+
}, 0 < cellCount && React.createElement("div", {
|
|
1306
|
+
className: "ReactVirtualized__Collection__innerScrollContainer",
|
|
1307
|
+
style: {
|
|
1308
|
+
height: totalHeight,
|
|
1309
|
+
maxHeight: totalHeight,
|
|
1310
|
+
maxWidth: _cellLayoutManager$ge3,
|
|
1311
|
+
overflow: "hidden",
|
|
1312
|
+
pointerEvents: isScrolling ? "none" : "",
|
|
1313
|
+
width: _cellLayoutManager$ge3
|
|
1314
|
+
}
|
|
1315
|
+
}, _this$state3), 0 === cellCount && noContentRenderer());
|
|
1316
|
+
}
|
|
1317
|
+
}, {
|
|
1318
|
+
key: "_enablePointerEventsAfterDelay",
|
|
1319
|
+
value: function() {
|
|
1320
|
+
var _this2 = this;
|
|
1321
|
+
this._disablePointerEventsTimeoutId && clearTimeout(this._disablePointerEventsTimeoutId),
|
|
1322
|
+
this._disablePointerEventsTimeoutId = setTimeout(function() {
|
|
1323
|
+
(0, _this2.props.isScrollingChange)(!1), _this2._disablePointerEventsTimeoutId = null,
|
|
1324
|
+
_this2.setState({
|
|
1325
|
+
isScrolling: !1
|
|
1326
|
+
});
|
|
1327
|
+
}, 150);
|
|
1328
|
+
}
|
|
1329
|
+
}, {
|
|
1330
|
+
key: "_invokeOnScrollMemoizer",
|
|
1331
|
+
value: function(_ref) {
|
|
1332
|
+
var _this3 = this, scrollLeft = _ref.scrollLeft, totalHeight = _ref.totalHeight, totalWidth = _ref.totalWidth;
|
|
1333
|
+
this._onScrollMemoizer({
|
|
1334
|
+
callback: function(_ref2) {
|
|
1335
|
+
var scrollLeft = _ref2.scrollLeft, _this3$props = _this3.props, height = _this3$props.height;
|
|
1336
|
+
(0, _this3$props.onScroll)({
|
|
1337
|
+
clientHeight: height,
|
|
1338
|
+
clientWidth: _this3$props.width,
|
|
1339
|
+
scrollHeight: totalHeight,
|
|
1340
|
+
scrollLeft: scrollLeft,
|
|
1341
|
+
scrollTop: _ref2.scrollTop,
|
|
1342
|
+
scrollWidth: totalWidth
|
|
1343
|
+
});
|
|
1344
|
+
},
|
|
1345
|
+
indices: {
|
|
1346
|
+
scrollLeft: scrollLeft,
|
|
1347
|
+
scrollTop: _ref.scrollTop
|
|
1348
|
+
}
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
}, {
|
|
1352
|
+
key: "_setScrollPosition",
|
|
1353
|
+
value: function(_ref3) {
|
|
1354
|
+
var scrollLeft = _ref3.scrollLeft, _ref3 = _ref3.scrollTop, newState = {
|
|
1355
|
+
scrollPositionChangeReason: SCROLL_POSITION_CHANGE_REASONS_REQUESTED
|
|
1356
|
+
};
|
|
1357
|
+
0 <= scrollLeft && (newState.scrollLeft = scrollLeft), 0 <= _ref3 && (newState.scrollTop = _ref3),
|
|
1358
|
+
(0 <= scrollLeft && scrollLeft !== this.state.scrollLeft || 0 <= _ref3 && _ref3 !== this.state.scrollTop) && this.setState(newState);
|
|
1359
|
+
}
|
|
1360
|
+
} ], [ {
|
|
1361
|
+
key: "getDerivedStateFromProps",
|
|
1362
|
+
value: function(nextProps, prevState) {
|
|
1363
|
+
return 0 !== nextProps.cellCount || 0 === prevState.scrollLeft && 0 === prevState.scrollTop ? nextProps.scrollLeft !== prevState.scrollLeft || nextProps.scrollTop !== prevState.scrollTop ? {
|
|
1364
|
+
scrollLeft: (null != nextProps.scrollLeft ? nextProps : prevState).scrollLeft,
|
|
1365
|
+
scrollTop: (null != nextProps.scrollTop ? nextProps : prevState).scrollTop,
|
|
1366
|
+
scrollPositionChangeReason: SCROLL_POSITION_CHANGE_REASONS_REQUESTED
|
|
1367
|
+
} : null : {
|
|
1368
|
+
scrollLeft: 0,
|
|
1369
|
+
scrollTop: 0,
|
|
1370
|
+
scrollPositionChangeReason: SCROLL_POSITION_CHANGE_REASONS_REQUESTED
|
|
1371
|
+
};
|
|
1372
|
+
}
|
|
1373
|
+
} ]);
|
|
1374
|
+
})(), Section = (_defineProperty(CollectionView, "propTypes", {
|
|
1375
|
+
"aria-label": propTypes.string,
|
|
1376
|
+
autoHeight: propTypes.bool,
|
|
1377
|
+
cellCount: propTypes.number.isRequired,
|
|
1378
|
+
cellLayoutManager: propTypes.object.isRequired,
|
|
1379
|
+
className: propTypes.string,
|
|
1380
|
+
height: propTypes.number.isRequired,
|
|
1381
|
+
id: propTypes.string,
|
|
1382
|
+
horizontalOverscanSize: propTypes.number.isRequired,
|
|
1383
|
+
isScrollingChange: propTypes.func,
|
|
1384
|
+
noContentRenderer: propTypes.func.isRequired,
|
|
1385
|
+
onScroll: propTypes.func.isRequired,
|
|
1386
|
+
onSectionRendered: propTypes.func.isRequired,
|
|
1387
|
+
scrollLeft: propTypes.number,
|
|
1388
|
+
scrollToAlignment: propTypes.oneOf([ "auto", "end", "start", "center" ]).isRequired,
|
|
1389
|
+
scrollToCell: propTypes.number.isRequired,
|
|
1390
|
+
scrollTop: propTypes.number,
|
|
1391
|
+
style: propTypes.object,
|
|
1392
|
+
verticalOverscanSize: propTypes.number.isRequired,
|
|
1393
|
+
width: propTypes.number.isRequired
|
|
1394
|
+
}), _defineProperty(CollectionView, "defaultProps", {
|
|
1395
|
+
"aria-label": "grid",
|
|
1396
|
+
horizontalOverscanSize: 0,
|
|
1397
|
+
noContentRenderer: function() {
|
|
1398
|
+
return null;
|
|
1399
|
+
},
|
|
1400
|
+
onScroll: function() {
|
|
1401
|
+
return null;
|
|
1402
|
+
},
|
|
1403
|
+
onSectionRendered: function() {
|
|
1404
|
+
return null;
|
|
1405
|
+
},
|
|
1406
|
+
scrollToAlignment: "auto",
|
|
1407
|
+
scrollToCell: -1,
|
|
1408
|
+
style: {},
|
|
1409
|
+
verticalOverscanSize: 0
|
|
1410
|
+
}), polyfill(CollectionView), _createClass(function Section(_ref) {
|
|
1411
|
+
var height = _ref.height, width = _ref.width, x = _ref.x, _ref = _ref.y;
|
|
1412
|
+
_classCallCheck(this, Section), this.height = height, this.width = width,
|
|
1413
|
+
this.x = x, this.y = _ref, this._indexMap = {}, this._indices = [];
|
|
1414
|
+
}, [ {
|
|
1415
|
+
key: "addCellIndex",
|
|
1416
|
+
value: function(_ref2) {
|
|
1417
|
+
_ref2 = _ref2.index;
|
|
1418
|
+
this._indexMap[_ref2] || (this._indexMap[_ref2] = !0, this._indices.push(_ref2));
|
|
1419
|
+
}
|
|
1420
|
+
}, {
|
|
1421
|
+
key: "getCellIndices",
|
|
1422
|
+
value: function() {
|
|
1423
|
+
return this._indices;
|
|
1424
|
+
}
|
|
1425
|
+
}, {
|
|
1426
|
+
key: "toString",
|
|
1427
|
+
value: function() {
|
|
1428
|
+
return "".concat(this.x, ",").concat(this.y, " ").concat(this.width, "x").concat(this.height);
|
|
1429
|
+
}
|
|
1430
|
+
} ])), SectionManager = _createClass(function SectionManager() {
|
|
1431
|
+
var sectionSize = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 100;
|
|
1432
|
+
_classCallCheck(this, SectionManager), this._sectionSize = sectionSize,
|
|
1433
|
+
this._cellMetadata = [], this._sections = {};
|
|
1434
|
+
}, [ {
|
|
1435
|
+
key: "getCellIndices",
|
|
1436
|
+
value: function(_ref) {
|
|
1437
|
+
var height = _ref.height, indices = {};
|
|
1438
|
+
return this.getSections({
|
|
1439
|
+
height: height,
|
|
1440
|
+
width: _ref.width,
|
|
1441
|
+
x: _ref.x,
|
|
1442
|
+
y: _ref.y
|
|
1443
|
+
}).forEach(function(section) {
|
|
1444
|
+
return section.getCellIndices().forEach(function(index) {
|
|
1445
|
+
indices[index] = index;
|
|
1446
|
+
});
|
|
1447
|
+
}), Object.keys(indices).map(function(index) {
|
|
1448
|
+
return indices[index];
|
|
1449
|
+
});
|
|
1450
|
+
}
|
|
1451
|
+
}, {
|
|
1452
|
+
key: "getCellMetadata",
|
|
1453
|
+
value: function(_ref2) {
|
|
1454
|
+
_ref2 = _ref2.index;
|
|
1455
|
+
return this._cellMetadata[_ref2];
|
|
1456
|
+
}
|
|
1457
|
+
}, {
|
|
1458
|
+
key: "getSections",
|
|
1459
|
+
value: function(_ref3) {
|
|
1460
|
+
for (var height = _ref3.height, width = _ref3.width, x = _ref3.x, _ref3 = _ref3.y, sectionXStart = Math.floor(x / this._sectionSize), sectionXStop = Math.floor((x + width - 1) / this._sectionSize), sectionYStart = Math.floor(_ref3 / this._sectionSize), sectionYStop = Math.floor((_ref3 + height - 1) / this._sectionSize), sections = [], sectionX = sectionXStart; sectionX <= sectionXStop; sectionX++) for (var sectionY = sectionYStart; sectionY <= sectionYStop; sectionY++) {
|
|
1461
|
+
var key = "".concat(sectionX, ".").concat(sectionY);
|
|
1462
|
+
this._sections[key] || (this._sections[key] = new Section({
|
|
1463
|
+
height: this._sectionSize,
|
|
1464
|
+
width: this._sectionSize,
|
|
1465
|
+
x: sectionX * this._sectionSize,
|
|
1466
|
+
y: sectionY * this._sectionSize
|
|
1467
|
+
})), sections.push(this._sections[key]);
|
|
1468
|
+
}
|
|
1469
|
+
return sections;
|
|
1470
|
+
}
|
|
1471
|
+
}, {
|
|
1472
|
+
key: "getTotalSectionCount",
|
|
1473
|
+
value: function() {
|
|
1474
|
+
return Object.keys(this._sections).length;
|
|
1475
|
+
}
|
|
1476
|
+
}, {
|
|
1477
|
+
key: "toString",
|
|
1478
|
+
value: function() {
|
|
1479
|
+
var _this = this;
|
|
1480
|
+
return Object.keys(this._sections).map(function(index) {
|
|
1481
|
+
return _this._sections[index].toString();
|
|
1482
|
+
});
|
|
1483
|
+
}
|
|
1484
|
+
}, {
|
|
1485
|
+
key: "registerCell",
|
|
1486
|
+
value: function(_ref4) {
|
|
1487
|
+
var cellMetadatum = _ref4.cellMetadatum, index = _ref4.index;
|
|
1488
|
+
this._cellMetadata[index] = cellMetadatum, this.getSections(cellMetadatum).forEach(function(section) {
|
|
1489
|
+
return section.addCellIndex({
|
|
1490
|
+
index: index
|
|
1491
|
+
});
|
|
1492
|
+
});
|
|
1493
|
+
}
|
|
1494
|
+
} ]);
|
|
1495
|
+
function getUpdatedOffsetForIndex(_ref) {
|
|
1496
|
+
var _ref$align = _ref.align, cellSize = _ref.cellSize, containerSize = _ref.containerSize, currentOffset = _ref.currentOffset, maxOffset = _ref.cellOffset, minOffset = maxOffset - containerSize + cellSize;
|
|
1497
|
+
switch (void 0 === _ref$align ? "auto" : _ref$align) {
|
|
1498
|
+
case "start":
|
|
1499
|
+
return maxOffset;
|
|
1500
|
+
|
|
1501
|
+
case "end":
|
|
1502
|
+
return minOffset;
|
|
1503
|
+
|
|
1504
|
+
case "center":
|
|
1505
|
+
return maxOffset - (containerSize - cellSize) / 2;
|
|
1506
|
+
|
|
1507
|
+
default:
|
|
1508
|
+
return Math.max(minOffset, Math.min(maxOffset, currentOffset));
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
var Collection = (() => {
|
|
1512
|
+
function Collection(props, context) {
|
|
1513
|
+
return _classCallCheck(this, Collection), (props = _callSuper(this, Collection, [ props, context ]))._cellMetadata = [],
|
|
1514
|
+
props._lastRenderedCellIndices = [], props._cellCache = [], props._isScrollingChange = props._isScrollingChange.bind(props),
|
|
1515
|
+
props._setCollectionViewRef = props._setCollectionViewRef.bind(props),
|
|
1516
|
+
props;
|
|
1517
|
+
}
|
|
1518
|
+
return _inherits(Collection, React.PureComponent), _createClass(Collection, [ {
|
|
1519
|
+
key: "forceUpdate",
|
|
1520
|
+
value: function() {
|
|
1521
|
+
void 0 !== this._collectionView && this._collectionView.forceUpdate();
|
|
1522
|
+
}
|
|
1523
|
+
}, {
|
|
1524
|
+
key: "recomputeCellSizesAndPositions",
|
|
1525
|
+
value: function() {
|
|
1526
|
+
this._cellCache = [], this._collectionView.recomputeCellSizesAndPositions();
|
|
1527
|
+
}
|
|
1528
|
+
}, {
|
|
1529
|
+
key: "render",
|
|
1530
|
+
value: function() {
|
|
1531
|
+
var props = _extends({}, ((t => {
|
|
1532
|
+
if (null == t) throw new TypeError("Cannot destructure " + t);
|
|
1533
|
+
})(this.props), this.props));
|
|
1534
|
+
return React.createElement(CollectionView, _extends({
|
|
1535
|
+
cellLayoutManager: this,
|
|
1536
|
+
isScrollingChange: this._isScrollingChange,
|
|
1537
|
+
ref: this._setCollectionViewRef
|
|
1538
|
+
}, props));
|
|
1539
|
+
}
|
|
1540
|
+
}, {
|
|
1541
|
+
key: "calculateSizeAndPositionData",
|
|
1542
|
+
value: function() {
|
|
1543
|
+
var _this$props = this.props, _this$props = (_ref => {
|
|
1544
|
+
for (var cellCount = _ref.cellCount, cellSizeAndPositionGetter = _ref.cellSizeAndPositionGetter, cellMetadata = [], sectionManager = new SectionManager(_ref.sectionSize), height = 0, width = 0, index = 0; index < cellCount; index++) {
|
|
1545
|
+
var cellMetadatum = cellSizeAndPositionGetter({
|
|
1546
|
+
index: index
|
|
1547
|
+
});
|
|
1548
|
+
if (null == cellMetadatum.height || isNaN(cellMetadatum.height) || null == cellMetadatum.width || isNaN(cellMetadatum.width) || null == cellMetadatum.x || isNaN(cellMetadatum.x) || null == cellMetadatum.y || isNaN(cellMetadatum.y)) throw Error("Invalid metadata returned for cell ".concat(index, ":\n x:").concat(cellMetadatum.x, ", y:").concat(cellMetadatum.y, ", width:").concat(cellMetadatum.width, ", height:").concat(cellMetadatum.height));
|
|
1549
|
+
height = Math.max(height, cellMetadatum.y + cellMetadatum.height),
|
|
1550
|
+
width = Math.max(width, cellMetadatum.x + cellMetadatum.width),
|
|
1551
|
+
sectionManager.registerCell({
|
|
1552
|
+
cellMetadatum: cellMetadata[index] = cellMetadatum,
|
|
1553
|
+
index: index
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1556
|
+
return {
|
|
1557
|
+
cellMetadata: cellMetadata,
|
|
1558
|
+
height: height,
|
|
1559
|
+
sectionManager: sectionManager,
|
|
1560
|
+
width: width
|
|
1561
|
+
};
|
|
1562
|
+
})({
|
|
1563
|
+
cellCount: _this$props.cellCount,
|
|
1564
|
+
cellSizeAndPositionGetter: _this$props.cellSizeAndPositionGetter,
|
|
1565
|
+
sectionSize: _this$props.sectionSize
|
|
1566
|
+
});
|
|
1567
|
+
this._cellMetadata = _this$props.cellMetadata, this._sectionManager = _this$props.sectionManager,
|
|
1568
|
+
this._height = _this$props.height, this._width = _this$props.width;
|
|
1569
|
+
}
|
|
1570
|
+
}, {
|
|
1571
|
+
key: "getLastRenderedIndices",
|
|
1572
|
+
value: function() {
|
|
1573
|
+
return this._lastRenderedCellIndices;
|
|
1574
|
+
}
|
|
1575
|
+
}, {
|
|
1576
|
+
key: "getScrollPositionForCell",
|
|
1577
|
+
value: function(_ref) {
|
|
1578
|
+
var align = _ref.align, cellIndex = _ref.cellIndex, height = _ref.height, scrollLeft = _ref.scrollLeft, scrollTop = _ref.scrollTop, cellCount = this.props.cellCount;
|
|
1579
|
+
return 0 <= cellIndex && cellIndex < cellCount && (scrollLeft = getUpdatedOffsetForIndex({
|
|
1580
|
+
align: align,
|
|
1581
|
+
cellOffset: (cellCount = this._cellMetadata[cellIndex]).x,
|
|
1582
|
+
cellSize: cellCount.width,
|
|
1583
|
+
containerSize: _ref.width,
|
|
1584
|
+
currentOffset: scrollLeft,
|
|
1585
|
+
targetIndex: cellIndex
|
|
1586
|
+
}), scrollTop = getUpdatedOffsetForIndex({
|
|
1587
|
+
align: align,
|
|
1588
|
+
cellOffset: cellCount.y,
|
|
1589
|
+
cellSize: cellCount.height,
|
|
1590
|
+
containerSize: height,
|
|
1591
|
+
currentOffset: scrollTop,
|
|
1592
|
+
targetIndex: cellIndex
|
|
1593
|
+
})), {
|
|
1594
|
+
scrollLeft: scrollLeft,
|
|
1595
|
+
scrollTop: scrollTop
|
|
1596
|
+
};
|
|
1597
|
+
}
|
|
1598
|
+
}, {
|
|
1599
|
+
key: "getTotalSize",
|
|
1600
|
+
value: function() {
|
|
1601
|
+
return {
|
|
1602
|
+
height: this._height,
|
|
1603
|
+
width: this._width
|
|
1604
|
+
};
|
|
1605
|
+
}
|
|
1606
|
+
}, {
|
|
1607
|
+
key: "cellRenderers",
|
|
1608
|
+
value: function(_ref2) {
|
|
1609
|
+
var _this2 = this, height = _ref2.height, isScrolling = _ref2.isScrolling, _this$props2 = this.props, cellGroupRenderer = _this$props2.cellGroupRenderer, _this$props2 = _this$props2.cellRenderer;
|
|
1610
|
+
return this._lastRenderedCellIndices = this._sectionManager.getCellIndices({
|
|
1611
|
+
height: height,
|
|
1612
|
+
width: _ref2.width,
|
|
1613
|
+
x: _ref2.x,
|
|
1614
|
+
y: _ref2.y
|
|
1615
|
+
}), cellGroupRenderer({
|
|
1616
|
+
cellCache: this._cellCache,
|
|
1617
|
+
cellRenderer: _this$props2,
|
|
1618
|
+
cellSizeAndPositionGetter: function(_ref3) {
|
|
1619
|
+
_ref3 = _ref3.index;
|
|
1620
|
+
return _this2._sectionManager.getCellMetadata({
|
|
1621
|
+
index: _ref3
|
|
1622
|
+
});
|
|
1623
|
+
},
|
|
1624
|
+
indices: this._lastRenderedCellIndices,
|
|
1625
|
+
isScrolling: isScrolling
|
|
1626
|
+
});
|
|
1627
|
+
}
|
|
1628
|
+
}, {
|
|
1629
|
+
key: "_isScrollingChange",
|
|
1630
|
+
value: function(isScrolling) {
|
|
1631
|
+
isScrolling || (this._cellCache = []);
|
|
1632
|
+
}
|
|
1633
|
+
}, {
|
|
1634
|
+
key: "_setCollectionViewRef",
|
|
1635
|
+
value: function(ref) {
|
|
1636
|
+
this._collectionView = ref;
|
|
1637
|
+
}
|
|
1638
|
+
} ]);
|
|
1639
|
+
})();
|
|
1640
|
+
_defineProperty(Collection, "propTypes", {
|
|
1641
|
+
"aria-label": propTypes.string,
|
|
1642
|
+
cellCount: propTypes.number.isRequired,
|
|
1643
|
+
cellGroupRenderer: propTypes.func.isRequired,
|
|
1644
|
+
cellRenderer: propTypes.func.isRequired,
|
|
1645
|
+
cellSizeAndPositionGetter: propTypes.func.isRequired,
|
|
1646
|
+
sectionSize: propTypes.number
|
|
1647
|
+
}), _defineProperty(Collection, "defaultProps", {
|
|
1648
|
+
"aria-label": "grid",
|
|
1649
|
+
cellGroupRenderer: function(_ref4) {
|
|
1650
|
+
var cellCache = _ref4.cellCache, cellRenderer = _ref4.cellRenderer, cellSizeAndPositionGetter = _ref4.cellSizeAndPositionGetter, indices = _ref4.indices, isScrolling = _ref4.isScrolling;
|
|
1651
|
+
return indices.map(function(index) {
|
|
1652
|
+
var cellMetadata = cellSizeAndPositionGetter({
|
|
1653
|
+
index: index
|
|
1654
|
+
}), cellMetadata = {
|
|
1655
|
+
index: index,
|
|
1656
|
+
isScrolling: isScrolling,
|
|
1657
|
+
key: index,
|
|
1658
|
+
style: {
|
|
1659
|
+
height: cellMetadata.height,
|
|
1660
|
+
left: cellMetadata.x,
|
|
1661
|
+
position: "absolute",
|
|
1662
|
+
top: cellMetadata.y,
|
|
1663
|
+
width: cellMetadata.width
|
|
1664
|
+
}
|
|
1665
|
+
};
|
|
1666
|
+
return isScrolling ? (index in cellCache || (cellCache[index] = cellRenderer(cellMetadata)),
|
|
1667
|
+
cellCache[index]) : cellRenderer(cellMetadata);
|
|
1668
|
+
}).filter(function(renderedCell) {
|
|
1669
|
+
return !!renderedCell;
|
|
1670
|
+
});
|
|
1671
|
+
}
|
|
1672
|
+
});
|
|
1673
|
+
var ColumnSizer = (() => {
|
|
1674
|
+
function ColumnSizer(props, context) {
|
|
1675
|
+
return _classCallCheck(this, ColumnSizer), (props = _callSuper(this, ColumnSizer, [ props, context ]))._registerChild = props._registerChild.bind(props),
|
|
1676
|
+
props;
|
|
1677
|
+
}
|
|
1678
|
+
return _inherits(ColumnSizer, React.PureComponent), _createClass(ColumnSizer, [ {
|
|
1679
|
+
key: "componentDidUpdate",
|
|
1680
|
+
value: function(prevProps) {
|
|
1681
|
+
var _this$props = this.props;
|
|
1682
|
+
_this$props.columnMaxWidth === prevProps.columnMaxWidth && _this$props.columnMinWidth === prevProps.columnMinWidth && _this$props.columnCount === prevProps.columnCount && _this$props.width === prevProps.width || this._registeredChild && this._registeredChild.recomputeGridSize();
|
|
1683
|
+
}
|
|
1684
|
+
}, {
|
|
1685
|
+
key: "render",
|
|
1686
|
+
value: function() {
|
|
1687
|
+
var _this$props2 = this.props, children = _this$props2.children, columnMaxWidth = _this$props2.columnMaxWidth, columnCount = _this$props2.columnCount, width = _this$props2.width, _this$props2 = _this$props2.columnMinWidth || 1, columnMaxWidth = columnMaxWidth ? Math.min(columnMaxWidth, width) : width, columnWidth = width / columnCount, columnWidth = Math.max(_this$props2, columnWidth);
|
|
1688
|
+
return columnWidth = Math.min(columnMaxWidth, columnWidth), columnWidth = Math.floor(columnWidth),
|
|
1689
|
+
children({
|
|
1690
|
+
adjustedWidth: Math.min(width, columnWidth * columnCount),
|
|
1691
|
+
columnWidth: columnWidth,
|
|
1692
|
+
getColumnWidth: function() {
|
|
1693
|
+
return columnWidth;
|
|
1694
|
+
},
|
|
1695
|
+
registerChild: this._registerChild
|
|
1696
|
+
});
|
|
1697
|
+
}
|
|
1698
|
+
}, {
|
|
1699
|
+
key: "_registerChild",
|
|
1700
|
+
value: function(child) {
|
|
1701
|
+
if (child && "function" != typeof child.recomputeGridSize) throw Error("Unexpected child type registered; only Grid/MultiGrid children are supported.");
|
|
1702
|
+
this._registeredChild = child, this._registeredChild && this._registeredChild.recomputeGridSize();
|
|
1703
|
+
}
|
|
1704
|
+
} ]);
|
|
1705
|
+
})();
|
|
1706
|
+
function calculateSizeAndPositionDataAndUpdateScrollOffset(_ref) {
|
|
1707
|
+
var cellCount = _ref.cellCount, cellSize = _ref.cellSize, computeMetadataCallback = _ref.computeMetadataCallback, nextCellSize = _ref.nextCellSize, nextScrollToIndex = _ref.nextScrollToIndex, scrollToIndex = _ref.scrollToIndex, updateScrollOffsetForScrollToIndex = _ref.updateScrollOffsetForScrollToIndex;
|
|
1708
|
+
cellCount === _ref.nextCellsCount && ("number" != typeof cellSize && "number" != typeof nextCellSize || cellSize === nextCellSize) || (computeMetadataCallback(_ref.computeMetadataCallbackProps),
|
|
1709
|
+
0 <= scrollToIndex && scrollToIndex === nextScrollToIndex && updateScrollOffsetForScrollToIndex());
|
|
1710
|
+
}
|
|
1711
|
+
_defineProperty(ColumnSizer, "propTypes", {
|
|
1712
|
+
children: propTypes.func.isRequired,
|
|
1713
|
+
columnMaxWidth: propTypes.number,
|
|
1714
|
+
columnMinWidth: propTypes.number,
|
|
1715
|
+
columnCount: propTypes.number.isRequired,
|
|
1716
|
+
width: propTypes.number.isRequired
|
|
1717
|
+
});
|
|
1718
|
+
var CellSizeAndPositionManager = _createClass(function CellSizeAndPositionManager(_ref) {
|
|
1719
|
+
var cellCount = _ref.cellCount, cellSizeGetter = _ref.cellSizeGetter, _ref = _ref.estimatedCellSize;
|
|
1720
|
+
_classCallCheck(this, CellSizeAndPositionManager), _defineProperty(this, "_cellSizeAndPositionData", {}),
|
|
1721
|
+
_defineProperty(this, "_lastMeasuredIndex", -1), _defineProperty(this, "_lastBatchedIndex", -1),
|
|
1722
|
+
_defineProperty(this, "_cellCount", void 0), _defineProperty(this, "_cellSizeGetter", void 0),
|
|
1723
|
+
_defineProperty(this, "_estimatedCellSize", void 0), this._cellSizeGetter = cellSizeGetter,
|
|
1724
|
+
this._cellCount = cellCount, this._estimatedCellSize = _ref;
|
|
1725
|
+
}, [ {
|
|
1726
|
+
key: "areOffsetsAdjusted",
|
|
1727
|
+
value: function() {
|
|
1728
|
+
return !1;
|
|
1729
|
+
}
|
|
1730
|
+
}, {
|
|
1731
|
+
key: "configure",
|
|
1732
|
+
value: function(_ref2) {
|
|
1733
|
+
var cellCount = _ref2.cellCount, estimatedCellSize = _ref2.estimatedCellSize, _ref2 = _ref2.cellSizeGetter;
|
|
1734
|
+
this._cellCount = cellCount, this._estimatedCellSize = estimatedCellSize,
|
|
1735
|
+
this._cellSizeGetter = _ref2;
|
|
1736
|
+
}
|
|
1737
|
+
}, {
|
|
1738
|
+
key: "getCellCount",
|
|
1739
|
+
value: function() {
|
|
1740
|
+
return this._cellCount;
|
|
1741
|
+
}
|
|
1742
|
+
}, {
|
|
1743
|
+
key: "getEstimatedCellSize",
|
|
1744
|
+
value: function() {
|
|
1745
|
+
return this._estimatedCellSize;
|
|
1746
|
+
}
|
|
1747
|
+
}, {
|
|
1748
|
+
key: "getLastMeasuredIndex",
|
|
1749
|
+
value: function() {
|
|
1750
|
+
return this._lastMeasuredIndex;
|
|
1751
|
+
}
|
|
1752
|
+
}, {
|
|
1753
|
+
key: "getOffsetAdjustment",
|
|
1754
|
+
value: function() {
|
|
1755
|
+
return 0;
|
|
1756
|
+
}
|
|
1757
|
+
}, {
|
|
1758
|
+
key: "getSizeAndPositionOfCell",
|
|
1759
|
+
value: function(index) {
|
|
1760
|
+
if (index < 0 || index >= this._cellCount) throw Error("Requested index ".concat(index, " is outside of range 0..").concat(this._cellCount));
|
|
1761
|
+
if (index > this._lastMeasuredIndex) for (var lastMeasuredCellSizeAndPosition = this.getSizeAndPositionOfLastMeasuredCell(), offset = lastMeasuredCellSizeAndPosition.offset + lastMeasuredCellSizeAndPosition.size, i = this._lastMeasuredIndex + 1; i <= index; i++) {
|
|
1762
|
+
var size = this._cellSizeGetter({
|
|
1763
|
+
index: i
|
|
1764
|
+
});
|
|
1765
|
+
if (void 0 === size || isNaN(size)) throw Error("Invalid size returned for cell ".concat(i, " of value ").concat(size));
|
|
1766
|
+
null === size ? (this._cellSizeAndPositionData[i] = {
|
|
1767
|
+
offset: offset,
|
|
1768
|
+
size: 0
|
|
1769
|
+
}, this._lastBatchedIndex = index) : (this._cellSizeAndPositionData[i] = {
|
|
1770
|
+
offset: offset,
|
|
1771
|
+
size: size
|
|
1772
|
+
}, offset += size, this._lastMeasuredIndex = index);
|
|
1773
|
+
}
|
|
1774
|
+
return this._cellSizeAndPositionData[index];
|
|
1775
|
+
}
|
|
1776
|
+
}, {
|
|
1777
|
+
key: "getSizeAndPositionOfLastMeasuredCell",
|
|
1778
|
+
value: function() {
|
|
1779
|
+
return 0 <= this._lastMeasuredIndex ? this._cellSizeAndPositionData[this._lastMeasuredIndex] : {
|
|
1780
|
+
offset: 0,
|
|
1781
|
+
size: 0
|
|
1782
|
+
};
|
|
1783
|
+
}
|
|
1784
|
+
}, {
|
|
1785
|
+
key: "getTotalSize",
|
|
1786
|
+
value: function() {
|
|
1787
|
+
var lastMeasuredCellSizeAndPosition = this.getSizeAndPositionOfLastMeasuredCell();
|
|
1788
|
+
return lastMeasuredCellSizeAndPosition.offset + lastMeasuredCellSizeAndPosition.size + (this._cellCount - this._lastMeasuredIndex - 1) * this._estimatedCellSize;
|
|
1789
|
+
}
|
|
1790
|
+
}, {
|
|
1791
|
+
key: "getUpdatedOffsetForIndex",
|
|
1792
|
+
value: function(_ref3) {
|
|
1793
|
+
var _ref3$align = _ref3.align, _ref3$align = void 0 === _ref3$align ? "auto" : _ref3$align, containerSize = _ref3.containerSize, currentOffset = _ref3.currentOffset;
|
|
1794
|
+
if (containerSize <= 0) return 0;
|
|
1795
|
+
var idealOffset, datum = this.getSizeAndPositionOfCell(_ref3.targetIndex), maxOffset = datum.offset, minOffset = maxOffset - containerSize + datum.size;
|
|
1796
|
+
switch (_ref3$align) {
|
|
1797
|
+
case "start":
|
|
1798
|
+
idealOffset = maxOffset;
|
|
1799
|
+
break;
|
|
1800
|
+
|
|
1801
|
+
case "end":
|
|
1802
|
+
idealOffset = minOffset;
|
|
1803
|
+
break;
|
|
1804
|
+
|
|
1805
|
+
case "center":
|
|
1806
|
+
idealOffset = maxOffset - (containerSize - datum.size) / 2;
|
|
1807
|
+
break;
|
|
1808
|
+
|
|
1809
|
+
default:
|
|
1810
|
+
idealOffset = Math.max(minOffset, Math.min(maxOffset, currentOffset));
|
|
1811
|
+
}
|
|
1812
|
+
_ref3 = this.getTotalSize();
|
|
1813
|
+
return Math.max(0, Math.min(_ref3 - containerSize, idealOffset));
|
|
1814
|
+
}
|
|
1815
|
+
}, {
|
|
1816
|
+
key: "getVisibleCellRange",
|
|
1817
|
+
value: function(params) {
|
|
1818
|
+
var containerSize = params.containerSize, offset = params.offset;
|
|
1819
|
+
if (0 === this.getTotalSize()) return {};
|
|
1820
|
+
for (var maxOffset = offset + containerSize, params = this._findNearestCell(offset), containerSize = this.getSizeAndPositionOfCell(params), offset = containerSize.offset + containerSize.size, stop = params; offset < maxOffset && stop < this._cellCount - 1; ) offset += this.getSizeAndPositionOfCell(++stop).size;
|
|
1821
|
+
return {
|
|
1822
|
+
start: params,
|
|
1823
|
+
stop: stop
|
|
1824
|
+
};
|
|
1825
|
+
}
|
|
1826
|
+
}, {
|
|
1827
|
+
key: "resetCell",
|
|
1828
|
+
value: function(index) {
|
|
1829
|
+
this._lastMeasuredIndex = Math.min(this._lastMeasuredIndex, index - 1);
|
|
1830
|
+
}
|
|
1831
|
+
}, {
|
|
1832
|
+
key: "_binarySearch",
|
|
1833
|
+
value: function(high, low, offset) {
|
|
1834
|
+
for (;low <= high; ) {
|
|
1835
|
+
var middle = low + Math.floor((high - low) / 2), currentOffset = this.getSizeAndPositionOfCell(middle).offset;
|
|
1836
|
+
if (currentOffset === offset) return middle;
|
|
1837
|
+
currentOffset < offset ? low = middle + 1 : offset < currentOffset && (high = middle - 1);
|
|
1838
|
+
}
|
|
1839
|
+
return 0 < low ? low - 1 : 0;
|
|
1840
|
+
}
|
|
1841
|
+
}, {
|
|
1842
|
+
key: "_exponentialSearch",
|
|
1843
|
+
value: function(index, offset) {
|
|
1844
|
+
for (var interval = 1; index < this._cellCount && this.getSizeAndPositionOfCell(index).offset < offset; ) index += interval,
|
|
1845
|
+
interval *= 2;
|
|
1846
|
+
return this._binarySearch(Math.min(index, this._cellCount - 1), Math.floor(index / 2), offset);
|
|
1847
|
+
}
|
|
1848
|
+
}, {
|
|
1849
|
+
key: "_findNearestCell",
|
|
1850
|
+
value: function(offset) {
|
|
1851
|
+
if (isNaN(offset)) throw Error("Invalid offset ".concat(offset, " specified"));
|
|
1852
|
+
offset = Math.max(0, offset);
|
|
1853
|
+
var lastMeasuredCellSizeAndPosition = this.getSizeAndPositionOfLastMeasuredCell(), lastMeasuredIndex = Math.max(0, this._lastMeasuredIndex);
|
|
1854
|
+
return lastMeasuredCellSizeAndPosition.offset >= offset ? this._binarySearch(lastMeasuredIndex, 0, offset) : this._exponentialSearch(lastMeasuredIndex, offset);
|
|
1855
|
+
}
|
|
1856
|
+
} ]), DEFAULT_MAX_ELEMENT_SIZE = 15e5, CHROME_MAX_ELEMENT_SIZE = 16777100, isBrowser = function() {
|
|
1857
|
+
return "undefined" != typeof window;
|
|
1858
|
+
}, isChrome = function() {
|
|
1859
|
+
return !!window.chrome;
|
|
1860
|
+
}, _excluded = [ "maxScrollSize" ], ScalingCellSizeAndPositionManager = _createClass(function ScalingCellSizeAndPositionManager(_ref) {
|
|
1861
|
+
var _ref$maxScrollSize = _ref.maxScrollSize, _ref$maxScrollSize = void 0 === _ref$maxScrollSize ? isBrowser() && isChrome() ? CHROME_MAX_ELEMENT_SIZE : DEFAULT_MAX_ELEMENT_SIZE : _ref$maxScrollSize, _ref = _objectWithoutProperties(_ref, _excluded);
|
|
1862
|
+
_classCallCheck(this, ScalingCellSizeAndPositionManager), _defineProperty(this, "_cellSizeAndPositionManager", void 0),
|
|
1863
|
+
_defineProperty(this, "_maxScrollSize", void 0), this._cellSizeAndPositionManager = new CellSizeAndPositionManager(_ref),
|
|
1864
|
+
this._maxScrollSize = _ref$maxScrollSize;
|
|
1865
|
+
}, [ {
|
|
1866
|
+
key: "areOffsetsAdjusted",
|
|
1867
|
+
value: function() {
|
|
1868
|
+
return this._cellSizeAndPositionManager.getTotalSize() > this._maxScrollSize;
|
|
1869
|
+
}
|
|
1870
|
+
}, {
|
|
1871
|
+
key: "configure",
|
|
1872
|
+
value: function(params) {
|
|
1873
|
+
this._cellSizeAndPositionManager.configure(params);
|
|
1874
|
+
}
|
|
1875
|
+
}, {
|
|
1876
|
+
key: "getCellCount",
|
|
1877
|
+
value: function() {
|
|
1878
|
+
return this._cellSizeAndPositionManager.getCellCount();
|
|
1879
|
+
}
|
|
1880
|
+
}, {
|
|
1881
|
+
key: "getEstimatedCellSize",
|
|
1882
|
+
value: function() {
|
|
1883
|
+
return this._cellSizeAndPositionManager.getEstimatedCellSize();
|
|
1884
|
+
}
|
|
1885
|
+
}, {
|
|
1886
|
+
key: "getLastMeasuredIndex",
|
|
1887
|
+
value: function() {
|
|
1888
|
+
return this._cellSizeAndPositionManager.getLastMeasuredIndex();
|
|
1889
|
+
}
|
|
1890
|
+
}, {
|
|
1891
|
+
key: "getOffsetAdjustment",
|
|
1892
|
+
value: function(_ref2) {
|
|
1893
|
+
var containerSize = _ref2.containerSize, _ref2 = _ref2.offset, totalSize = this._cellSizeAndPositionManager.getTotalSize(), safeTotalSize = this.getTotalSize(), containerSize = this._getOffsetPercentage({
|
|
1894
|
+
containerSize: containerSize,
|
|
1895
|
+
offset: _ref2,
|
|
1896
|
+
totalSize: safeTotalSize
|
|
1897
|
+
});
|
|
1898
|
+
return Math.round(containerSize * (safeTotalSize - totalSize));
|
|
1899
|
+
}
|
|
1900
|
+
}, {
|
|
1901
|
+
key: "getSizeAndPositionOfCell",
|
|
1902
|
+
value: function(index) {
|
|
1903
|
+
return this._cellSizeAndPositionManager.getSizeAndPositionOfCell(index);
|
|
1904
|
+
}
|
|
1905
|
+
}, {
|
|
1906
|
+
key: "getSizeAndPositionOfLastMeasuredCell",
|
|
1907
|
+
value: function() {
|
|
1908
|
+
return this._cellSizeAndPositionManager.getSizeAndPositionOfLastMeasuredCell();
|
|
1909
|
+
}
|
|
1910
|
+
}, {
|
|
1911
|
+
key: "getTotalSize",
|
|
1912
|
+
value: function() {
|
|
1913
|
+
return Math.min(this._maxScrollSize, this._cellSizeAndPositionManager.getTotalSize());
|
|
1914
|
+
}
|
|
1915
|
+
}, {
|
|
1916
|
+
key: "getUpdatedOffsetForIndex",
|
|
1917
|
+
value: function(_ref3) {
|
|
1918
|
+
var _ref3$align = _ref3.align, _ref3$align = void 0 === _ref3$align ? "auto" : _ref3$align, containerSize = _ref3.containerSize, targetIndex = _ref3.targetIndex, _ref3 = this._safeOffsetToOffset({
|
|
1919
|
+
containerSize: containerSize,
|
|
1920
|
+
offset: _ref3.currentOffset
|
|
1921
|
+
}), _ref3$align = this._cellSizeAndPositionManager.getUpdatedOffsetForIndex({
|
|
1922
|
+
align: _ref3$align,
|
|
1923
|
+
containerSize: containerSize,
|
|
1924
|
+
currentOffset: _ref3,
|
|
1925
|
+
targetIndex: targetIndex
|
|
1926
|
+
});
|
|
1927
|
+
return this._offsetToSafeOffset({
|
|
1928
|
+
containerSize: containerSize,
|
|
1929
|
+
offset: _ref3$align
|
|
1930
|
+
});
|
|
1931
|
+
}
|
|
1932
|
+
}, {
|
|
1933
|
+
key: "getVisibleCellRange",
|
|
1934
|
+
value: function(_ref4) {
|
|
1935
|
+
var containerSize = _ref4.containerSize, _ref4 = this._safeOffsetToOffset({
|
|
1936
|
+
containerSize: containerSize,
|
|
1937
|
+
offset: _ref4.offset
|
|
1938
|
+
});
|
|
1939
|
+
return this._cellSizeAndPositionManager.getVisibleCellRange({
|
|
1940
|
+
containerSize: containerSize,
|
|
1941
|
+
offset: _ref4
|
|
1942
|
+
});
|
|
1943
|
+
}
|
|
1944
|
+
}, {
|
|
1945
|
+
key: "resetCell",
|
|
1946
|
+
value: function(index) {
|
|
1947
|
+
this._cellSizeAndPositionManager.resetCell(index);
|
|
1948
|
+
}
|
|
1949
|
+
}, {
|
|
1950
|
+
key: "_getOffsetPercentage",
|
|
1951
|
+
value: function(_ref5) {
|
|
1952
|
+
var containerSize = _ref5.containerSize, totalSize = _ref5.totalSize;
|
|
1953
|
+
return totalSize <= containerSize ? 0 : _ref5.offset / (totalSize - containerSize);
|
|
1954
|
+
}
|
|
1955
|
+
}, {
|
|
1956
|
+
key: "_offsetToSafeOffset",
|
|
1957
|
+
value: function(_ref6) {
|
|
1958
|
+
var containerSize = _ref6.containerSize, _ref6 = _ref6.offset, totalSize = this._cellSizeAndPositionManager.getTotalSize(), safeTotalSize = this.getTotalSize();
|
|
1959
|
+
return totalSize === safeTotalSize ? _ref6 : (_ref6 = this._getOffsetPercentage({
|
|
1960
|
+
containerSize: containerSize,
|
|
1961
|
+
offset: _ref6,
|
|
1962
|
+
totalSize: totalSize
|
|
1963
|
+
}), Math.round(_ref6 * (safeTotalSize - containerSize)));
|
|
1964
|
+
}
|
|
1965
|
+
}, {
|
|
1966
|
+
key: "_safeOffsetToOffset",
|
|
1967
|
+
value: function(_ref7) {
|
|
1968
|
+
var containerSize = _ref7.containerSize, _ref7 = _ref7.offset, totalSize = this._cellSizeAndPositionManager.getTotalSize(), safeTotalSize = this.getTotalSize();
|
|
1969
|
+
return totalSize === safeTotalSize ? _ref7 : (_ref7 = this._getOffsetPercentage({
|
|
1970
|
+
containerSize: containerSize,
|
|
1971
|
+
offset: _ref7,
|
|
1972
|
+
totalSize: safeTotalSize
|
|
1973
|
+
}), Math.round(_ref7 * (totalSize - containerSize)));
|
|
1974
|
+
}
|
|
1975
|
+
} ]);
|
|
1976
|
+
function defaultOverscanIndicesGetter(_ref) {
|
|
1977
|
+
var cellCount = _ref.cellCount, overscanCellsCount = _ref.overscanCellsCount, startIndex = _ref.startIndex, stopIndex = _ref.stopIndex;
|
|
1978
|
+
return 1 === _ref.scrollDirection ? {
|
|
1979
|
+
overscanStartIndex: Math.max(0, startIndex),
|
|
1980
|
+
overscanStopIndex: Math.min(cellCount - 1, stopIndex + overscanCellsCount)
|
|
1981
|
+
} : {
|
|
1982
|
+
overscanStartIndex: Math.max(0, startIndex - overscanCellsCount),
|
|
1983
|
+
overscanStopIndex: Math.min(cellCount - 1, stopIndex)
|
|
1984
|
+
};
|
|
1985
|
+
}
|
|
1986
|
+
function updateScrollIndexHelper(_ref) {
|
|
1987
|
+
var cellSize = _ref.cellSize, cellSizeAndPositionManager = _ref.cellSizeAndPositionManager, previousCellsCount = _ref.previousCellsCount, previousCellSize = _ref.previousCellSize, previousScrollToAlignment = _ref.previousScrollToAlignment, previousScrollToIndex = _ref.previousScrollToIndex, previousSize = _ref.previousSize, scrollOffset = _ref.scrollOffset, scrollToAlignment = _ref.scrollToAlignment, scrollToIndex = _ref.scrollToIndex, size = _ref.size, sizeJustIncreasedFromZero = _ref.sizeJustIncreasedFromZero, _ref = _ref.updateScrollIndexCallback, cellCount = cellSizeAndPositionManager.getCellCount(), hasScrollToIndex = 0 <= scrollToIndex && scrollToIndex < cellCount;
|
|
1988
|
+
hasScrollToIndex && (size !== previousSize || sizeJustIncreasedFromZero || !previousCellSize || "number" == typeof cellSize && cellSize !== previousCellSize || scrollToAlignment !== previousScrollToAlignment || scrollToIndex !== previousScrollToIndex) ? _ref(scrollToIndex) : !hasScrollToIndex && 0 < cellCount && (size < previousSize || cellCount < previousCellsCount) && scrollOffset > cellSizeAndPositionManager.getTotalSize() - size && _ref(cellCount - 1);
|
|
1989
|
+
}
|
|
1990
|
+
function defaultCellRangeRenderer(_ref) {
|
|
1991
|
+
for (var cellCache = _ref.cellCache, cellRenderer = _ref.cellRenderer, columnSizeAndPositionManager = _ref.columnSizeAndPositionManager, columnStartIndex = _ref.columnStartIndex, columnStopIndex = _ref.columnStopIndex, deferredMeasurementCache = _ref.deferredMeasurementCache, horizontalOffsetAdjustment = _ref.horizontalOffsetAdjustment, isScrolling = _ref.isScrolling, isScrollingOptOut = _ref.isScrollingOptOut, parent = _ref.parent, rowSizeAndPositionManager = _ref.rowSizeAndPositionManager, rowStartIndex = _ref.rowStartIndex, rowStopIndex = _ref.rowStopIndex, styleCache = _ref.styleCache, verticalOffsetAdjustment = _ref.verticalOffsetAdjustment, visibleColumnIndices = _ref.visibleColumnIndices, visibleRowIndices = _ref.visibleRowIndices, renderedCells = [], _ref = columnSizeAndPositionManager.areOffsetsAdjusted() || rowSizeAndPositionManager.areOffsetsAdjusted(), canCacheStyle = !isScrolling && !_ref, rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) for (var rowDatum = rowSizeAndPositionManager.getSizeAndPositionOfCell(rowIndex), columnIndex = columnStartIndex; columnIndex <= columnStopIndex; columnIndex++) {
|
|
1992
|
+
var columnDatum = columnSizeAndPositionManager.getSizeAndPositionOfCell(columnIndex), isVisible = columnIndex >= visibleColumnIndices.start && columnIndex <= visibleColumnIndices.stop && rowIndex >= visibleRowIndices.start && rowIndex <= visibleRowIndices.stop, key = "".concat(rowIndex, "-").concat(columnIndex), style = void 0, columnDatum = (canCacheStyle && styleCache[key] ? style = styleCache[key] : deferredMeasurementCache && !deferredMeasurementCache.has(rowIndex, columnIndex) ? style = {
|
|
1993
|
+
height: "auto",
|
|
1994
|
+
left: 0,
|
|
1995
|
+
position: "absolute",
|
|
1996
|
+
top: 0,
|
|
1997
|
+
width: "auto"
|
|
1998
|
+
} : (style = {
|
|
1999
|
+
height: rowDatum.size,
|
|
2000
|
+
left: columnDatum.offset + horizontalOffsetAdjustment,
|
|
2001
|
+
position: "absolute",
|
|
2002
|
+
top: rowDatum.offset + verticalOffsetAdjustment,
|
|
2003
|
+
width: columnDatum.size
|
|
2004
|
+
}, styleCache[key] = style), {
|
|
2005
|
+
columnIndex: columnIndex,
|
|
2006
|
+
isScrolling: isScrolling,
|
|
2007
|
+
isVisible: isVisible,
|
|
2008
|
+
key: key,
|
|
2009
|
+
parent: parent,
|
|
2010
|
+
rowIndex: rowIndex,
|
|
2011
|
+
style: style
|
|
2012
|
+
}), isVisible = void 0;
|
|
2013
|
+
null != (isVisible = !isScrollingOptOut && !isScrolling || horizontalOffsetAdjustment || verticalOffsetAdjustment ? cellRenderer(columnDatum) : (cellCache[key] || (cellCache[key] = cellRenderer(columnDatum)),
|
|
2014
|
+
cellCache[key])) && !1 !== isVisible && (((parent, renderedCell) => {
|
|
2015
|
+
(renderedCell = renderedCell && (renderedCell.type && renderedCell.type.__internalCellMeasurerFlag ? renderedCell.props.children : renderedCell)) && renderedCell.props && void 0 === renderedCell.props.style && !0 !== parent.__warnedAboutMissingStyle && (parent.__warnedAboutMissingStyle = !0,
|
|
2016
|
+
console.warn("Rendered cell should include style property for positioning."));
|
|
2017
|
+
})(parent, isVisible), isVisible.props.role || (isVisible = React__default.cloneElement(isVisible, {
|
|
2018
|
+
role: "gridcell"
|
|
2019
|
+
})), renderedCells.push(isVisible));
|
|
2020
|
+
}
|
|
2021
|
+
return renderedCells;
|
|
2022
|
+
}
|
|
2023
|
+
var win, request = (win = "undefined" != typeof window ? window : "undefined" != typeof self ? self : {}).requestAnimationFrame || win.webkitRequestAnimationFrame || win.mozRequestAnimationFrame || win.oRequestAnimationFrame || win.msRequestAnimationFrame || function(callback) {
|
|
2024
|
+
return win.setTimeout(callback, 1e3 / 60);
|
|
2025
|
+
}, cancel = win.cancelAnimationFrame || win.webkitCancelAnimationFrame || win.mozCancelAnimationFrame || win.oCancelAnimationFrame || win.msCancelAnimationFrame || function(id) {
|
|
2026
|
+
win.clearTimeout(id);
|
|
2027
|
+
}, raf = request, caf = cancel, cancelAnimationTimeout = function(frame) {
|
|
2028
|
+
return caf(frame.id);
|
|
2029
|
+
}, requestAnimationTimeout = function(callback, delay) {
|
|
2030
|
+
function _timeout() {
|
|
2031
|
+
Date.now() - start >= delay ? callback.call() : frame.id = raf(_timeout);
|
|
2032
|
+
}
|
|
2033
|
+
Promise.resolve().then(function() {
|
|
2034
|
+
start = Date.now();
|
|
2035
|
+
});
|
|
2036
|
+
var start, frame = {
|
|
2037
|
+
id: raf(_timeout)
|
|
2038
|
+
};
|
|
2039
|
+
return frame;
|
|
2040
|
+
}, SCROLL_POSITION_CHANGE_REASONS$1_OBSERVED = "observed", SCROLL_POSITION_CHANGE_REASONS$1_REQUESTED = "requested", Grid = (() => {
|
|
2041
|
+
function Grid(props) {
|
|
2042
|
+
_classCallCheck(this, Grid), _defineProperty(_this = _callSuper(this, Grid, [ props ]), "_onGridRenderedMemoizer", createCallbackMemoizer()),
|
|
2043
|
+
_defineProperty(_this, "_onScrollMemoizer", createCallbackMemoizer(!1)),
|
|
2044
|
+
_defineProperty(_this, "_deferredInvalidateColumnIndex", null), _defineProperty(_this, "_deferredInvalidateRowIndex", null),
|
|
2045
|
+
_defineProperty(_this, "_recomputeScrollLeftFlag", !1), _defineProperty(_this, "_recomputeScrollTopFlag", !1),
|
|
2046
|
+
_defineProperty(_this, "_horizontalScrollBarSize", 0), _defineProperty(_this, "_verticalScrollBarSize", 0),
|
|
2047
|
+
_defineProperty(_this, "_scrollbarPresenceChanged", !1), _defineProperty(_this, "_scrollingContainer", void 0),
|
|
2048
|
+
_defineProperty(_this, "_childrenToDisplay", void 0), _defineProperty(_this, "_columnStartIndex", void 0),
|
|
2049
|
+
_defineProperty(_this, "_columnStopIndex", void 0), _defineProperty(_this, "_rowStartIndex", void 0),
|
|
2050
|
+
_defineProperty(_this, "_rowStopIndex", void 0), _defineProperty(_this, "_renderedColumnStartIndex", 0),
|
|
2051
|
+
_defineProperty(_this, "_renderedColumnStopIndex", 0), _defineProperty(_this, "_renderedRowStartIndex", 0),
|
|
2052
|
+
_defineProperty(_this, "_renderedRowStopIndex", 0), _defineProperty(_this, "_initialScrollTop", void 0),
|
|
2053
|
+
_defineProperty(_this, "_initialScrollLeft", void 0), _defineProperty(_this, "_disablePointerEventsTimeoutId", void 0),
|
|
2054
|
+
_defineProperty(_this, "_styleCache", {}), _defineProperty(_this, "_cellCache", {}),
|
|
2055
|
+
_defineProperty(_this, "_debounceScrollEndedCallback", function() {
|
|
2056
|
+
_this._disablePointerEventsTimeoutId = null, _this.setState({
|
|
2057
|
+
isScrolling: !1,
|
|
2058
|
+
needToResetStyleCache: !1
|
|
2059
|
+
});
|
|
2060
|
+
}), _defineProperty(_this, "_invokeOnGridRenderedHelper", function() {
|
|
2061
|
+
var onSectionRendered = _this.props.onSectionRendered;
|
|
2062
|
+
_this._onGridRenderedMemoizer({
|
|
2063
|
+
callback: onSectionRendered,
|
|
2064
|
+
indices: {
|
|
2065
|
+
columnOverscanStartIndex: _this._columnStartIndex,
|
|
2066
|
+
columnOverscanStopIndex: _this._columnStopIndex,
|
|
2067
|
+
columnStartIndex: _this._renderedColumnStartIndex,
|
|
2068
|
+
columnStopIndex: _this._renderedColumnStopIndex,
|
|
2069
|
+
rowOverscanStartIndex: _this._rowStartIndex,
|
|
2070
|
+
rowOverscanStopIndex: _this._rowStopIndex,
|
|
2071
|
+
rowStartIndex: _this._renderedRowStartIndex,
|
|
2072
|
+
rowStopIndex: _this._renderedRowStopIndex
|
|
2073
|
+
}
|
|
2074
|
+
});
|
|
2075
|
+
}), _defineProperty(_this, "_setScrollingContainerRef", function(ref) {
|
|
2076
|
+
_this._scrollingContainer = ref, "function" == typeof _this.props.elementRef ? _this.props.elementRef(ref) : "object" === _typeof(_this.props.elementRef) && (_this.props.elementRef.current = ref);
|
|
2077
|
+
}), _defineProperty(_this, "_onScroll", function(event) {
|
|
2078
|
+
event.target === _this._scrollingContainer && _this.handleScrollEvent(event.target);
|
|
2079
|
+
});
|
|
2080
|
+
var _this, columnSizeAndPositionManager = new ScalingCellSizeAndPositionManager({
|
|
2081
|
+
cellCount: props.columnCount,
|
|
2082
|
+
cellSizeGetter: function(params) {
|
|
2083
|
+
return Grid._wrapSizeGetter(props.columnWidth)(params);
|
|
2084
|
+
},
|
|
2085
|
+
estimatedCellSize: Grid._getEstimatedColumnSize(props)
|
|
2086
|
+
}), rowSizeAndPositionManager = new ScalingCellSizeAndPositionManager({
|
|
2087
|
+
cellCount: props.rowCount,
|
|
2088
|
+
cellSizeGetter: function(params) {
|
|
2089
|
+
return Grid._wrapSizeGetter(props.rowHeight)(params);
|
|
2090
|
+
},
|
|
2091
|
+
estimatedCellSize: Grid._getEstimatedRowSize(props)
|
|
2092
|
+
});
|
|
2093
|
+
return _this.state = {
|
|
2094
|
+
instanceProps: {
|
|
2095
|
+
columnSizeAndPositionManager: columnSizeAndPositionManager,
|
|
2096
|
+
rowSizeAndPositionManager: rowSizeAndPositionManager,
|
|
2097
|
+
prevColumnWidth: props.columnWidth,
|
|
2098
|
+
prevRowHeight: props.rowHeight,
|
|
2099
|
+
prevColumnCount: props.columnCount,
|
|
2100
|
+
prevRowCount: props.rowCount,
|
|
2101
|
+
prevIsScrolling: !0 === props.isScrolling,
|
|
2102
|
+
prevScrollToColumn: props.scrollToColumn,
|
|
2103
|
+
prevScrollToRow: props.scrollToRow,
|
|
2104
|
+
scrollbarSize: 0,
|
|
2105
|
+
scrollbarSizeMeasured: !1
|
|
2106
|
+
},
|
|
2107
|
+
isScrolling: !1,
|
|
2108
|
+
scrollDirectionHorizontal: 1,
|
|
2109
|
+
scrollDirectionVertical: 1,
|
|
2110
|
+
scrollLeft: 0,
|
|
2111
|
+
scrollTop: 0,
|
|
2112
|
+
scrollPositionChangeReason: null,
|
|
2113
|
+
needToResetStyleCache: !1
|
|
2114
|
+
}, 0 < props.scrollToRow && (_this._initialScrollTop = _this._getCalculatedScrollTop(props, _this.state)),
|
|
2115
|
+
0 < props.scrollToColumn && (_this._initialScrollLeft = _this._getCalculatedScrollLeft(props, _this.state)),
|
|
2116
|
+
_this;
|
|
2117
|
+
}
|
|
2118
|
+
return _inherits(Grid, React.PureComponent), _createClass(Grid, [ {
|
|
2119
|
+
key: "getOffsetForCell",
|
|
2120
|
+
value: function() {
|
|
2121
|
+
var _ref = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, _ref$alignment = _ref.alignment, _ref$alignment = void 0 === _ref$alignment ? this.props.scrollToAlignment : _ref$alignment, _ref$columnIndex = _ref.columnIndex, _ref$columnIndex = void 0 === _ref$columnIndex ? this.props.scrollToColumn : _ref$columnIndex, _ref = _ref.rowIndex, _ref = void 0 === _ref ? this.props.scrollToRow : _ref, _ref$alignment = _objectSpread2(_objectSpread2({}, this.props), {}, {
|
|
2122
|
+
scrollToAlignment: _ref$alignment,
|
|
2123
|
+
scrollToColumn: _ref$columnIndex,
|
|
2124
|
+
scrollToRow: _ref
|
|
2125
|
+
});
|
|
2126
|
+
return {
|
|
2127
|
+
scrollLeft: this._getCalculatedScrollLeft(_ref$alignment),
|
|
2128
|
+
scrollTop: this._getCalculatedScrollTop(_ref$alignment)
|
|
2129
|
+
};
|
|
2130
|
+
}
|
|
2131
|
+
}, {
|
|
2132
|
+
key: "getTotalRowsHeight",
|
|
2133
|
+
value: function() {
|
|
2134
|
+
return this.state.instanceProps.rowSizeAndPositionManager.getTotalSize();
|
|
2135
|
+
}
|
|
2136
|
+
}, {
|
|
2137
|
+
key: "getTotalColumnsWidth",
|
|
2138
|
+
value: function() {
|
|
2139
|
+
return this.state.instanceProps.columnSizeAndPositionManager.getTotalSize();
|
|
2140
|
+
}
|
|
2141
|
+
}, {
|
|
2142
|
+
key: "handleScrollEvent",
|
|
2143
|
+
value: function(_ref2) {
|
|
2144
|
+
var autoHeight, autoWidth, scrollbarSize, totalRowsHeight, instanceProps, _this$props, height, _ref2$scrollLeft = _ref2.scrollLeft, _ref2$scrollLeft = void 0 === _ref2$scrollLeft ? 0 : _ref2$scrollLeft, _ref2 = _ref2.scrollTop, _ref2 = void 0 === _ref2 ? 0 : _ref2;
|
|
2145
|
+
_ref2 < 0 || (this._debounceScrollEnded(), autoHeight = (_this$props = this.props).autoHeight,
|
|
2146
|
+
autoWidth = _this$props.autoWidth, height = _this$props.height,
|
|
2147
|
+
_this$props = _this$props.width, scrollbarSize = (instanceProps = this.state.instanceProps).scrollbarSize,
|
|
2148
|
+
totalRowsHeight = instanceProps.rowSizeAndPositionManager.getTotalSize(),
|
|
2149
|
+
instanceProps = instanceProps.columnSizeAndPositionManager.getTotalSize(),
|
|
2150
|
+
_this$props = Math.min(Math.max(0, instanceProps - _this$props + scrollbarSize), _ref2$scrollLeft),
|
|
2151
|
+
_ref2$scrollLeft = Math.min(Math.max(0, totalRowsHeight - height + scrollbarSize), _ref2),
|
|
2152
|
+
this.state.scrollLeft === _this$props && this.state.scrollTop === _ref2$scrollLeft || (height = {
|
|
2153
|
+
isScrolling: !0,
|
|
2154
|
+
scrollDirectionHorizontal: _this$props !== this.state.scrollLeft ? _this$props > this.state.scrollLeft ? 1 : -1 : this.state.scrollDirectionHorizontal,
|
|
2155
|
+
scrollDirectionVertical: _ref2$scrollLeft !== this.state.scrollTop ? _ref2$scrollLeft > this.state.scrollTop ? 1 : -1 : this.state.scrollDirectionVertical,
|
|
2156
|
+
scrollPositionChangeReason: SCROLL_POSITION_CHANGE_REASONS$1_OBSERVED
|
|
2157
|
+
}, autoHeight || (height.scrollTop = _ref2$scrollLeft), autoWidth || (height.scrollLeft = _this$props),
|
|
2158
|
+
height.needToResetStyleCache = !1, this.setState(height)), this._invokeOnScrollMemoizer({
|
|
2159
|
+
scrollLeft: _this$props,
|
|
2160
|
+
scrollTop: _ref2$scrollLeft,
|
|
2161
|
+
totalColumnsWidth: instanceProps,
|
|
2162
|
+
totalRowsHeight: totalRowsHeight
|
|
2163
|
+
}));
|
|
2164
|
+
}
|
|
2165
|
+
}, {
|
|
2166
|
+
key: "invalidateCellSizeAfterRender",
|
|
2167
|
+
value: function(_ref3) {
|
|
2168
|
+
var columnIndex = _ref3.columnIndex, _ref3 = _ref3.rowIndex;
|
|
2169
|
+
this._deferredInvalidateColumnIndex = "number" == typeof this._deferredInvalidateColumnIndex ? Math.min(this._deferredInvalidateColumnIndex, columnIndex) : columnIndex,
|
|
2170
|
+
this._deferredInvalidateRowIndex = "number" == typeof this._deferredInvalidateRowIndex ? Math.min(this._deferredInvalidateRowIndex, _ref3) : _ref3;
|
|
2171
|
+
}
|
|
2172
|
+
}, {
|
|
2173
|
+
key: "measureAllCells",
|
|
2174
|
+
value: function() {
|
|
2175
|
+
var _this$props2 = this.props, columnCount = _this$props2.columnCount, _this$props2 = _this$props2.rowCount, instanceProps = this.state.instanceProps;
|
|
2176
|
+
instanceProps.columnSizeAndPositionManager.getSizeAndPositionOfCell(columnCount - 1),
|
|
2177
|
+
instanceProps.rowSizeAndPositionManager.getSizeAndPositionOfCell(_this$props2 - 1);
|
|
2178
|
+
}
|
|
2179
|
+
}, {
|
|
2180
|
+
key: "recomputeGridSize",
|
|
2181
|
+
value: function() {
|
|
2182
|
+
var _ref4 = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, _ref4$columnIndex = _ref4.columnIndex, _ref4$columnIndex = void 0 === _ref4$columnIndex ? 0 : _ref4$columnIndex, _ref4 = _ref4.rowIndex, _ref4 = void 0 === _ref4 ? 0 : _ref4, _this$props3 = this.props, scrollToColumn = _this$props3.scrollToColumn, _this$props3 = _this$props3.scrollToRow, instanceProps = this.state.instanceProps;
|
|
2183
|
+
instanceProps.columnSizeAndPositionManager.resetCell(_ref4$columnIndex),
|
|
2184
|
+
instanceProps.rowSizeAndPositionManager.resetCell(_ref4), this._recomputeScrollLeftFlag = 0 <= scrollToColumn && (1 === this.state.scrollDirectionHorizontal ? _ref4$columnIndex <= scrollToColumn : scrollToColumn <= _ref4$columnIndex),
|
|
2185
|
+
this._recomputeScrollTopFlag = 0 <= _this$props3 && (1 === this.state.scrollDirectionVertical ? _ref4 <= _this$props3 : _this$props3 <= _ref4),
|
|
2186
|
+
this._styleCache = {}, this._cellCache = {}, this.forceUpdate();
|
|
2187
|
+
}
|
|
2188
|
+
}, {
|
|
2189
|
+
key: "scrollToCell",
|
|
2190
|
+
value: function(_ref5) {
|
|
2191
|
+
var columnIndex = _ref5.columnIndex, _ref5 = _ref5.rowIndex, columnCount = this.props.columnCount, props = this.props;
|
|
2192
|
+
1 < columnCount && void 0 !== columnIndex && this._updateScrollLeftForScrollToColumn(_objectSpread2(_objectSpread2({}, props), {}, {
|
|
2193
|
+
scrollToColumn: columnIndex
|
|
2194
|
+
})), void 0 !== _ref5 && this._updateScrollTopForScrollToRow(_objectSpread2(_objectSpread2({}, props), {}, {
|
|
2195
|
+
scrollToRow: _ref5
|
|
2196
|
+
}));
|
|
2197
|
+
}
|
|
2198
|
+
}, {
|
|
2199
|
+
key: "componentDidMount",
|
|
2200
|
+
value: function() {
|
|
2201
|
+
var _this$props4 = this.props, getScrollbarSize = _this$props4.getScrollbarSize, height = _this$props4.height, scrollLeft = _this$props4.scrollLeft, scrollToColumn = _this$props4.scrollToColumn, scrollTop = _this$props4.scrollTop, scrollToRow = _this$props4.scrollToRow, _this$props4 = _this$props4.width, instanceProps = this.state.instanceProps, stateUpdate = (this._initialScrollTop = 0,
|
|
2202
|
+
this._initialScrollLeft = 0, this._handleInvalidatedGridSize(),
|
|
2203
|
+
instanceProps.scrollbarSizeMeasured || this.setState(function(prevState) {
|
|
2204
|
+
prevState = _objectSpread2(_objectSpread2({}, prevState), {}, {
|
|
2205
|
+
needToResetStyleCache: !1
|
|
2206
|
+
});
|
|
2207
|
+
return prevState.instanceProps.scrollbarSize = getScrollbarSize(),
|
|
2208
|
+
prevState.instanceProps.scrollbarSizeMeasured = !0, prevState;
|
|
2209
|
+
}), ("number" == typeof scrollLeft && 0 <= scrollLeft || "number" == typeof scrollTop && 0 <= scrollTop) && (stateUpdate = Grid._getScrollToPositionStateUpdate({
|
|
2210
|
+
prevState: this.state,
|
|
2211
|
+
scrollLeft: scrollLeft,
|
|
2212
|
+
scrollTop: scrollTop
|
|
2213
|
+
})) && (stateUpdate.needToResetStyleCache = !1, this.setState(stateUpdate)),
|
|
2214
|
+
this._scrollingContainer && (this._scrollingContainer.scrollLeft !== this.state.scrollLeft && (this._scrollingContainer.scrollLeft = this.state.scrollLeft),
|
|
2215
|
+
this._scrollingContainer.scrollTop !== this.state.scrollTop) && (this._scrollingContainer.scrollTop = this.state.scrollTop),
|
|
2216
|
+
0 < height && 0 < _this$props4);
|
|
2217
|
+
0 <= scrollToColumn && stateUpdate && this._updateScrollLeftForScrollToColumn(),
|
|
2218
|
+
0 <= scrollToRow && stateUpdate && this._updateScrollTopForScrollToRow(),
|
|
2219
|
+
this._invokeOnGridRenderedHelper(), this._invokeOnScrollMemoizer({
|
|
2220
|
+
scrollLeft: scrollLeft || 0,
|
|
2221
|
+
scrollTop: scrollTop || 0,
|
|
2222
|
+
totalColumnsWidth: instanceProps.columnSizeAndPositionManager.getTotalSize(),
|
|
2223
|
+
totalRowsHeight: instanceProps.rowSizeAndPositionManager.getTotalSize()
|
|
2224
|
+
}), this._maybeCallOnScrollbarPresenceChange();
|
|
2225
|
+
}
|
|
2226
|
+
}, {
|
|
2227
|
+
key: "componentDidUpdate",
|
|
2228
|
+
value: function(prevProps, prevState) {
|
|
2229
|
+
var _this2 = this, _this$props5 = this.props, autoHeight = _this$props5.autoHeight, autoWidth = _this$props5.autoWidth, columnCount = _this$props5.columnCount, height = _this$props5.height, rowCount = _this$props5.rowCount, scrollToAlignment = _this$props5.scrollToAlignment, scrollToColumn = _this$props5.scrollToColumn, scrollToRow = _this$props5.scrollToRow, _this$props5 = _this$props5.width, _this$state = this.state, scrollLeft = _this$state.scrollLeft, scrollPositionChangeReason = _this$state.scrollPositionChangeReason, scrollTop = _this$state.scrollTop, _this$state = _this$state.instanceProps, columnCount = (this._handleInvalidatedGridSize(),
|
|
2230
|
+
0 < columnCount && 0 === prevProps.columnCount || 0 < rowCount && 0 === prevProps.rowCount), rowCount = (scrollPositionChangeReason === SCROLL_POSITION_CHANGE_REASONS$1_REQUESTED && (!autoWidth && 0 <= scrollLeft && (scrollLeft !== this._scrollingContainer.scrollLeft || columnCount) && (this._scrollingContainer.scrollLeft = scrollLeft),
|
|
2231
|
+
!autoHeight) && 0 <= scrollTop && (scrollTop !== this._scrollingContainer.scrollTop || columnCount) && (this._scrollingContainer.scrollTop = scrollTop),
|
|
2232
|
+
(0 === prevProps.width || 0 === prevProps.height) && 0 < height && 0 < _this$props5);
|
|
2233
|
+
this._recomputeScrollLeftFlag ? (this._recomputeScrollLeftFlag = !1,
|
|
2234
|
+
this._updateScrollLeftForScrollToColumn(this.props)) : updateScrollIndexHelper({
|
|
2235
|
+
cellSizeAndPositionManager: _this$state.columnSizeAndPositionManager,
|
|
2236
|
+
previousCellsCount: prevProps.columnCount,
|
|
2237
|
+
previousCellSize: prevProps.columnWidth,
|
|
2238
|
+
previousScrollToAlignment: prevProps.scrollToAlignment,
|
|
2239
|
+
previousScrollToIndex: prevProps.scrollToColumn,
|
|
2240
|
+
previousSize: prevProps.width,
|
|
2241
|
+
scrollOffset: scrollLeft,
|
|
2242
|
+
scrollToAlignment: scrollToAlignment,
|
|
2243
|
+
scrollToIndex: scrollToColumn,
|
|
2244
|
+
size: _this$props5,
|
|
2245
|
+
sizeJustIncreasedFromZero: rowCount,
|
|
2246
|
+
updateScrollIndexCallback: function() {
|
|
2247
|
+
return _this2._updateScrollLeftForScrollToColumn(_this2.props);
|
|
2248
|
+
}
|
|
2249
|
+
}), this._recomputeScrollTopFlag ? (this._recomputeScrollTopFlag = !1,
|
|
2250
|
+
this._updateScrollTopForScrollToRow(this.props)) : updateScrollIndexHelper({
|
|
2251
|
+
cellSizeAndPositionManager: _this$state.rowSizeAndPositionManager,
|
|
2252
|
+
previousCellsCount: prevProps.rowCount,
|
|
2253
|
+
previousCellSize: prevProps.rowHeight,
|
|
2254
|
+
previousScrollToAlignment: prevProps.scrollToAlignment,
|
|
2255
|
+
previousScrollToIndex: prevProps.scrollToRow,
|
|
2256
|
+
previousSize: prevProps.height,
|
|
2257
|
+
scrollOffset: scrollTop,
|
|
2258
|
+
scrollToAlignment: scrollToAlignment,
|
|
2259
|
+
scrollToIndex: scrollToRow,
|
|
2260
|
+
size: height,
|
|
2261
|
+
sizeJustIncreasedFromZero: rowCount,
|
|
2262
|
+
updateScrollIndexCallback: function() {
|
|
2263
|
+
return _this2._updateScrollTopForScrollToRow(_this2.props);
|
|
2264
|
+
}
|
|
2265
|
+
}), this._invokeOnGridRenderedHelper(), scrollLeft === prevState.scrollLeft && scrollTop === prevState.scrollTop || (scrollPositionChangeReason = _this$state.rowSizeAndPositionManager.getTotalSize(),
|
|
2266
|
+
autoWidth = _this$state.columnSizeAndPositionManager.getTotalSize(),
|
|
2267
|
+
this._invokeOnScrollMemoizer({
|
|
2268
|
+
scrollLeft: scrollLeft,
|
|
2269
|
+
scrollTop: scrollTop,
|
|
2270
|
+
totalColumnsWidth: autoWidth,
|
|
2271
|
+
totalRowsHeight: scrollPositionChangeReason
|
|
2272
|
+
})), this._maybeCallOnScrollbarPresenceChange();
|
|
2273
|
+
}
|
|
2274
|
+
}, {
|
|
2275
|
+
key: "componentWillUnmount",
|
|
2276
|
+
value: function() {
|
|
2277
|
+
this._disablePointerEventsTimeoutId && cancelAnimationTimeout(this._disablePointerEventsTimeoutId);
|
|
2278
|
+
}
|
|
2279
|
+
}, {
|
|
2280
|
+
key: "render",
|
|
2281
|
+
value: function() {
|
|
2282
|
+
var _this$props6 = this.props, autoContainerWidth = _this$props6.autoContainerWidth, autoHeight = _this$props6.autoHeight, autoWidth = _this$props6.autoWidth, className = _this$props6.className, containerProps = _this$props6.containerProps, containerRole = _this$props6.containerRole, containerStyle = _this$props6.containerStyle, height = _this$props6.height, id = _this$props6.id, noContentRenderer = _this$props6.noContentRenderer, role = _this$props6.role, style = _this$props6.style, tabIndex = _this$props6.tabIndex, _this$props6 = _this$props6.width, _this$state2 = this.state, instanceProps = _this$state2.instanceProps, _this$state2 = _this$state2.needToResetStyleCache, isScrolling = this._isScrolling(), autoHeight = {
|
|
2283
|
+
boxSizing: "border-box",
|
|
2284
|
+
direction: "ltr",
|
|
2285
|
+
height: autoHeight ? "auto" : height,
|
|
2286
|
+
position: "relative",
|
|
2287
|
+
width: autoWidth ? "auto" : _this$props6,
|
|
2288
|
+
WebkitOverflowScrolling: "touch",
|
|
2289
|
+
willChange: "transform"
|
|
2290
|
+
}, autoWidth = (_this$state2 && (this._styleCache = {}), this.state.isScrolling || this._resetStyleCache(),
|
|
2291
|
+
this._calculateChildrenToRender(this.props, this.state), instanceProps.columnSizeAndPositionManager.getTotalSize()), _this$state2 = instanceProps.rowSizeAndPositionManager.getTotalSize(), verticalScrollBarSize = height < _this$state2 ? instanceProps.scrollbarSize : 0, instanceProps = _this$props6 < autoWidth ? instanceProps.scrollbarSize : 0, verticalScrollBarSize = (instanceProps === this._horizontalScrollBarSize && verticalScrollBarSize === this._verticalScrollBarSize || (this._horizontalScrollBarSize = instanceProps,
|
|
2292
|
+
this._verticalScrollBarSize = verticalScrollBarSize, this._scrollbarPresenceChanged = !0),
|
|
2293
|
+
autoHeight.overflowX = autoWidth + verticalScrollBarSize <= _this$props6 ? "hidden" : "auto",
|
|
2294
|
+
autoHeight.overflowY = _this$state2 + instanceProps <= height ? "hidden" : "auto",
|
|
2295
|
+
this._childrenToDisplay), instanceProps = 0 === verticalScrollBarSize.length && 0 < height && 0 < _this$props6;
|
|
2296
|
+
return React.createElement("div", _extends({
|
|
2297
|
+
ref: this._setScrollingContainerRef
|
|
2298
|
+
}, containerProps, {
|
|
2299
|
+
"aria-label": this.props["aria-label"],
|
|
2300
|
+
"aria-readonly": this.props["aria-readonly"],
|
|
2301
|
+
className: clsx("ReactVirtualized__Grid", className),
|
|
2302
|
+
id: id,
|
|
2303
|
+
onScroll: this._onScroll,
|
|
2304
|
+
role: role,
|
|
2305
|
+
style: _objectSpread2(_objectSpread2({}, autoHeight), style),
|
|
2306
|
+
tabIndex: tabIndex
|
|
2307
|
+
}), 0 < verticalScrollBarSize.length && React.createElement("div", {
|
|
2308
|
+
className: "ReactVirtualized__Grid__innerScrollContainer",
|
|
2309
|
+
role: containerRole,
|
|
2310
|
+
style: _objectSpread2({
|
|
2311
|
+
width: autoContainerWidth ? "auto" : autoWidth,
|
|
2312
|
+
height: _this$state2,
|
|
2313
|
+
maxWidth: autoWidth,
|
|
2314
|
+
maxHeight: _this$state2,
|
|
2315
|
+
overflow: "hidden",
|
|
2316
|
+
pointerEvents: isScrolling ? "none" : "",
|
|
2317
|
+
position: "relative"
|
|
2318
|
+
}, containerStyle)
|
|
2319
|
+
}, verticalScrollBarSize), instanceProps && noContentRenderer());
|
|
2320
|
+
}
|
|
2321
|
+
}, {
|
|
2322
|
+
key: "_calculateChildrenToRender",
|
|
2323
|
+
value: function() {
|
|
2324
|
+
var props = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : this.props, state = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : this.state, cellRenderer = props.cellRenderer, cellRangeRenderer = props.cellRangeRenderer, columnCount = props.columnCount, deferredMeasurementCache = props.deferredMeasurementCache, height = props.height, overscanColumnCount = props.overscanColumnCount, overscanIndicesGetter = props.overscanIndicesGetter, overscanRowCount = props.overscanRowCount, rowCount = props.rowCount, width = props.width, isScrollingOptOut = props.isScrollingOptOut, scrollDirectionHorizontal = state.scrollDirectionHorizontal, scrollDirectionVertical = state.scrollDirectionVertical, instanceProps = state.instanceProps, scrollTop = 0 < this._initialScrollTop ? this._initialScrollTop : state.scrollTop, scrollLeft = 0 < this._initialScrollLeft ? this._initialScrollLeft : state.scrollLeft, props = this._isScrolling(props, state);
|
|
2325
|
+
if (this._childrenToDisplay = [], 0 < height && 0 < width) {
|
|
2326
|
+
var state = instanceProps.columnSizeAndPositionManager.getVisibleCellRange({
|
|
2327
|
+
containerSize: width,
|
|
2328
|
+
offset: scrollLeft
|
|
2329
|
+
}), visibleRowIndices = instanceProps.rowSizeAndPositionManager.getVisibleCellRange({
|
|
2330
|
+
containerSize: height,
|
|
2331
|
+
offset: scrollTop
|
|
2332
|
+
}), width = instanceProps.columnSizeAndPositionManager.getOffsetAdjustment({
|
|
2333
|
+
containerSize: width,
|
|
2334
|
+
offset: scrollLeft
|
|
2335
|
+
}), height = instanceProps.rowSizeAndPositionManager.getOffsetAdjustment({
|
|
2336
|
+
containerSize: height,
|
|
2337
|
+
offset: scrollTop
|
|
2338
|
+
}), overscanColumnCount = (this._renderedColumnStartIndex = state.start,
|
|
2339
|
+
this._renderedColumnStopIndex = state.stop, this._renderedRowStartIndex = visibleRowIndices.start,
|
|
2340
|
+
this._renderedRowStopIndex = visibleRowIndices.stop, overscanIndicesGetter({
|
|
2341
|
+
direction: "horizontal",
|
|
2342
|
+
cellCount: columnCount,
|
|
2343
|
+
overscanCellsCount: overscanColumnCount,
|
|
2344
|
+
scrollDirection: scrollDirectionHorizontal,
|
|
2345
|
+
startIndex: "number" == typeof state.start ? state.start : 0,
|
|
2346
|
+
stopIndex: "number" == typeof state.stop ? state.stop : -1
|
|
2347
|
+
})), scrollDirectionHorizontal = overscanIndicesGetter({
|
|
2348
|
+
direction: "vertical",
|
|
2349
|
+
cellCount: rowCount,
|
|
2350
|
+
overscanCellsCount: overscanRowCount,
|
|
2351
|
+
scrollDirection: scrollDirectionVertical,
|
|
2352
|
+
startIndex: "number" == typeof visibleRowIndices.start ? visibleRowIndices.start : 0,
|
|
2353
|
+
stopIndex: "number" == typeof visibleRowIndices.stop ? visibleRowIndices.stop : -1
|
|
2354
|
+
}), columnStartIndex = overscanColumnCount.overscanStartIndex, columnStopIndex = overscanColumnCount.overscanStopIndex, rowStartIndex = scrollDirectionHorizontal.overscanStartIndex, rowStopIndex = scrollDirectionHorizontal.overscanStopIndex;
|
|
2355
|
+
if (deferredMeasurementCache) {
|
|
2356
|
+
if (!deferredMeasurementCache.hasFixedHeight()) for (var rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) if (!deferredMeasurementCache.has(rowIndex, 0)) {
|
|
2357
|
+
columnStartIndex = 0, columnStopIndex = columnCount - 1;
|
|
2358
|
+
break;
|
|
2359
|
+
}
|
|
2360
|
+
if (!deferredMeasurementCache.hasFixedWidth()) for (var columnIndex = columnStartIndex; columnIndex <= columnStopIndex; columnIndex++) if (!deferredMeasurementCache.has(0, columnIndex)) {
|
|
2361
|
+
rowStartIndex = 0, rowStopIndex = rowCount - 1;
|
|
2362
|
+
break;
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
this._childrenToDisplay = cellRangeRenderer({
|
|
2366
|
+
cellCache: this._cellCache,
|
|
2367
|
+
cellRenderer: cellRenderer,
|
|
2368
|
+
columnSizeAndPositionManager: instanceProps.columnSizeAndPositionManager,
|
|
2369
|
+
columnStartIndex: columnStartIndex,
|
|
2370
|
+
columnStopIndex: columnStopIndex,
|
|
2371
|
+
deferredMeasurementCache: deferredMeasurementCache,
|
|
2372
|
+
horizontalOffsetAdjustment: width,
|
|
2373
|
+
isScrolling: props,
|
|
2374
|
+
isScrollingOptOut: isScrollingOptOut,
|
|
2375
|
+
parent: this,
|
|
2376
|
+
rowSizeAndPositionManager: instanceProps.rowSizeAndPositionManager,
|
|
2377
|
+
rowStartIndex: rowStartIndex,
|
|
2378
|
+
rowStopIndex: rowStopIndex,
|
|
2379
|
+
scrollLeft: scrollLeft,
|
|
2380
|
+
scrollTop: scrollTop,
|
|
2381
|
+
styleCache: this._styleCache,
|
|
2382
|
+
verticalOffsetAdjustment: height,
|
|
2383
|
+
visibleColumnIndices: state,
|
|
2384
|
+
visibleRowIndices: visibleRowIndices
|
|
2385
|
+
}), this._columnStartIndex = columnStartIndex, this._columnStopIndex = columnStopIndex,
|
|
2386
|
+
this._rowStartIndex = rowStartIndex, this._rowStopIndex = rowStopIndex;
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2389
|
+
}, {
|
|
2390
|
+
key: "_debounceScrollEnded",
|
|
2391
|
+
value: function() {
|
|
2392
|
+
var scrollingResetTimeInterval = this.props.scrollingResetTimeInterval;
|
|
2393
|
+
this._disablePointerEventsTimeoutId && cancelAnimationTimeout(this._disablePointerEventsTimeoutId),
|
|
2394
|
+
this._disablePointerEventsTimeoutId = requestAnimationTimeout(this._debounceScrollEndedCallback, scrollingResetTimeInterval);
|
|
2395
|
+
}
|
|
2396
|
+
}, {
|
|
2397
|
+
key: "_handleInvalidatedGridSize",
|
|
2398
|
+
value: function() {
|
|
2399
|
+
var columnIndex, rowIndex;
|
|
2400
|
+
"number" == typeof this._deferredInvalidateColumnIndex && "number" == typeof this._deferredInvalidateRowIndex && (columnIndex = this._deferredInvalidateColumnIndex,
|
|
2401
|
+
rowIndex = this._deferredInvalidateRowIndex, this._deferredInvalidateColumnIndex = null,
|
|
2402
|
+
this._deferredInvalidateRowIndex = null, this.recomputeGridSize({
|
|
2403
|
+
columnIndex: columnIndex,
|
|
2404
|
+
rowIndex: rowIndex
|
|
2405
|
+
}));
|
|
2406
|
+
}
|
|
2407
|
+
}, {
|
|
2408
|
+
key: "_invokeOnScrollMemoizer",
|
|
2409
|
+
value: function(_ref6) {
|
|
2410
|
+
var _this3 = this, scrollLeft = _ref6.scrollLeft, totalColumnsWidth = _ref6.totalColumnsWidth, totalRowsHeight = _ref6.totalRowsHeight;
|
|
2411
|
+
this._onScrollMemoizer({
|
|
2412
|
+
callback: function(_ref7) {
|
|
2413
|
+
var scrollLeft = _ref7.scrollLeft, _this3$props = _this3.props, height = _this3$props.height;
|
|
2414
|
+
(0, _this3$props.onScroll)({
|
|
2415
|
+
clientHeight: height,
|
|
2416
|
+
clientWidth: _this3$props.width,
|
|
2417
|
+
scrollHeight: totalRowsHeight,
|
|
2418
|
+
scrollLeft: scrollLeft,
|
|
2419
|
+
scrollTop: _ref7.scrollTop,
|
|
2420
|
+
scrollWidth: totalColumnsWidth
|
|
2421
|
+
});
|
|
2422
|
+
},
|
|
2423
|
+
indices: {
|
|
2424
|
+
scrollLeft: scrollLeft,
|
|
2425
|
+
scrollTop: _ref6.scrollTop
|
|
2426
|
+
}
|
|
2427
|
+
});
|
|
2428
|
+
}
|
|
2429
|
+
}, {
|
|
2430
|
+
key: "_isScrolling",
|
|
2431
|
+
value: function() {
|
|
2432
|
+
var props = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : this.props, state = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : this.state;
|
|
2433
|
+
return Object.hasOwnProperty.call(props, "isScrolling") ? Boolean(props.isScrolling) : Boolean(state.isScrolling);
|
|
2434
|
+
}
|
|
2435
|
+
}, {
|
|
2436
|
+
key: "_maybeCallOnScrollbarPresenceChange",
|
|
2437
|
+
value: function() {
|
|
2438
|
+
var onScrollbarPresenceChange;
|
|
2439
|
+
this._scrollbarPresenceChanged && (onScrollbarPresenceChange = this.props.onScrollbarPresenceChange,
|
|
2440
|
+
this._scrollbarPresenceChanged = !1, onScrollbarPresenceChange({
|
|
2441
|
+
horizontal: 0 < this._horizontalScrollBarSize,
|
|
2442
|
+
size: this.state.instanceProps.scrollbarSize,
|
|
2443
|
+
vertical: 0 < this._verticalScrollBarSize
|
|
2444
|
+
}));
|
|
2445
|
+
}
|
|
2446
|
+
}, {
|
|
2447
|
+
key: "scrollToPosition",
|
|
2448
|
+
value: function(_ref8) {
|
|
2449
|
+
var scrollLeft = _ref8.scrollLeft, scrollLeft = Grid._getScrollToPositionStateUpdate({
|
|
2450
|
+
prevState: this.state,
|
|
2451
|
+
scrollLeft: scrollLeft,
|
|
2452
|
+
scrollTop: _ref8.scrollTop
|
|
2453
|
+
});
|
|
2454
|
+
scrollLeft && (scrollLeft.needToResetStyleCache = !1, this.setState(scrollLeft));
|
|
2455
|
+
}
|
|
2456
|
+
}, {
|
|
2457
|
+
key: "_getCalculatedScrollLeft",
|
|
2458
|
+
value: function() {
|
|
2459
|
+
var props = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : this.props, state = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : this.state;
|
|
2460
|
+
return Grid._getCalculatedScrollLeft(props, state);
|
|
2461
|
+
}
|
|
2462
|
+
}, {
|
|
2463
|
+
key: "_updateScrollLeftForScrollToColumn",
|
|
2464
|
+
value: function() {
|
|
2465
|
+
var props = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : this.props, state = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : this.state, props = Grid._getScrollLeftForScrollToColumnStateUpdate(props, state);
|
|
2466
|
+
props && (props.needToResetStyleCache = !1, this.setState(props));
|
|
2467
|
+
}
|
|
2468
|
+
}, {
|
|
2469
|
+
key: "_getCalculatedScrollTop",
|
|
2470
|
+
value: function() {
|
|
2471
|
+
var props = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : this.props, state = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : this.state;
|
|
2472
|
+
return Grid._getCalculatedScrollTop(props, state);
|
|
2473
|
+
}
|
|
2474
|
+
}, {
|
|
2475
|
+
key: "_resetStyleCache",
|
|
2476
|
+
value: function() {
|
|
2477
|
+
var styleCache = this._styleCache, cellCache = this._cellCache, isScrollingOptOut = this.props.isScrollingOptOut;
|
|
2478
|
+
this._cellCache = {}, this._styleCache = {};
|
|
2479
|
+
for (var rowIndex = this._rowStartIndex; rowIndex <= this._rowStopIndex; rowIndex++) for (var columnIndex = this._columnStartIndex; columnIndex <= this._columnStopIndex; columnIndex++) {
|
|
2480
|
+
var key = "".concat(rowIndex, "-").concat(columnIndex);
|
|
2481
|
+
this._styleCache[key] = styleCache[key], isScrollingOptOut && (this._cellCache[key] = cellCache[key]);
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
}, {
|
|
2485
|
+
key: "_updateScrollTopForScrollToRow",
|
|
2486
|
+
value: function() {
|
|
2487
|
+
var props = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : this.props, state = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : this.state, props = Grid._getScrollTopForScrollToRowStateUpdate(props, state);
|
|
2488
|
+
props && (props.needToResetStyleCache = !1, this.setState(props));
|
|
2489
|
+
}
|
|
2490
|
+
} ], [ {
|
|
2491
|
+
key: "getDerivedStateFromProps",
|
|
2492
|
+
value: function(nextProps, prevState) {
|
|
2493
|
+
var maybeStateA, maybeStateB, newState = {}, instanceProps = (0 === nextProps.columnCount && 0 !== prevState.scrollLeft || 0 === nextProps.rowCount && 0 !== prevState.scrollTop ? (newState.scrollLeft = 0,
|
|
2494
|
+
newState.scrollTop = 0) : (nextProps.scrollLeft !== prevState.scrollLeft && nextProps.scrollToColumn < 0 || nextProps.scrollTop !== prevState.scrollTop && nextProps.scrollToRow < 0) && Object.assign(newState, Grid._getScrollToPositionStateUpdate({
|
|
2495
|
+
prevState: prevState,
|
|
2496
|
+
scrollLeft: nextProps.scrollLeft,
|
|
2497
|
+
scrollTop: nextProps.scrollTop
|
|
2498
|
+
})), prevState.instanceProps);
|
|
2499
|
+
return newState.needToResetStyleCache = !1, nextProps.columnWidth === instanceProps.prevColumnWidth && nextProps.rowHeight === instanceProps.prevRowHeight || (newState.needToResetStyleCache = !0),
|
|
2500
|
+
instanceProps.columnSizeAndPositionManager.configure({
|
|
2501
|
+
cellCount: nextProps.columnCount,
|
|
2502
|
+
estimatedCellSize: Grid._getEstimatedColumnSize(nextProps),
|
|
2503
|
+
cellSizeGetter: Grid._wrapSizeGetter(nextProps.columnWidth)
|
|
2504
|
+
}), instanceProps.rowSizeAndPositionManager.configure({
|
|
2505
|
+
cellCount: nextProps.rowCount,
|
|
2506
|
+
estimatedCellSize: Grid._getEstimatedRowSize(nextProps),
|
|
2507
|
+
cellSizeGetter: Grid._wrapSizeGetter(nextProps.rowHeight)
|
|
2508
|
+
}), 0 !== instanceProps.prevColumnCount && 0 !== instanceProps.prevRowCount || (instanceProps.prevColumnCount = 0,
|
|
2509
|
+
instanceProps.prevRowCount = 0), nextProps.autoHeight && !1 === nextProps.isScrolling && !0 === instanceProps.prevIsScrolling && Object.assign(newState, {
|
|
2510
|
+
isScrolling: !1
|
|
2511
|
+
}), calculateSizeAndPositionDataAndUpdateScrollOffset({
|
|
2512
|
+
cellCount: instanceProps.prevColumnCount,
|
|
2513
|
+
cellSize: "number" == typeof instanceProps.prevColumnWidth ? instanceProps.prevColumnWidth : null,
|
|
2514
|
+
computeMetadataCallback: function() {
|
|
2515
|
+
return instanceProps.columnSizeAndPositionManager.resetCell(0);
|
|
2516
|
+
},
|
|
2517
|
+
computeMetadataCallbackProps: nextProps,
|
|
2518
|
+
nextCellsCount: nextProps.columnCount,
|
|
2519
|
+
nextCellSize: "number" == typeof nextProps.columnWidth ? nextProps.columnWidth : null,
|
|
2520
|
+
nextScrollToIndex: nextProps.scrollToColumn,
|
|
2521
|
+
scrollToIndex: instanceProps.prevScrollToColumn,
|
|
2522
|
+
updateScrollOffsetForScrollToIndex: function() {
|
|
2523
|
+
maybeStateA = Grid._getScrollLeftForScrollToColumnStateUpdate(nextProps, prevState);
|
|
2524
|
+
}
|
|
2525
|
+
}), calculateSizeAndPositionDataAndUpdateScrollOffset({
|
|
2526
|
+
cellCount: instanceProps.prevRowCount,
|
|
2527
|
+
cellSize: "number" == typeof instanceProps.prevRowHeight ? instanceProps.prevRowHeight : null,
|
|
2528
|
+
computeMetadataCallback: function() {
|
|
2529
|
+
return instanceProps.rowSizeAndPositionManager.resetCell(0);
|
|
2530
|
+
},
|
|
2531
|
+
computeMetadataCallbackProps: nextProps,
|
|
2532
|
+
nextCellsCount: nextProps.rowCount,
|
|
2533
|
+
nextCellSize: "number" == typeof nextProps.rowHeight ? nextProps.rowHeight : null,
|
|
2534
|
+
nextScrollToIndex: nextProps.scrollToRow,
|
|
2535
|
+
scrollToIndex: instanceProps.prevScrollToRow,
|
|
2536
|
+
updateScrollOffsetForScrollToIndex: function() {
|
|
2537
|
+
maybeStateB = Grid._getScrollTopForScrollToRowStateUpdate(nextProps, prevState);
|
|
2538
|
+
}
|
|
2539
|
+
}), instanceProps.prevColumnCount = nextProps.columnCount, instanceProps.prevColumnWidth = nextProps.columnWidth,
|
|
2540
|
+
instanceProps.prevIsScrolling = !0 === nextProps.isScrolling, instanceProps.prevRowCount = nextProps.rowCount,
|
|
2541
|
+
instanceProps.prevRowHeight = nextProps.rowHeight, instanceProps.prevScrollToColumn = nextProps.scrollToColumn,
|
|
2542
|
+
instanceProps.prevScrollToRow = nextProps.scrollToRow, instanceProps.scrollbarSize = nextProps.getScrollbarSize(),
|
|
2543
|
+
void 0 === instanceProps.scrollbarSize ? (instanceProps.scrollbarSizeMeasured = !1,
|
|
2544
|
+
instanceProps.scrollbarSize = 0) : instanceProps.scrollbarSizeMeasured = !0,
|
|
2545
|
+
newState.instanceProps = instanceProps, _objectSpread2(_objectSpread2(_objectSpread2({}, newState), maybeStateA), maybeStateB);
|
|
2546
|
+
}
|
|
2547
|
+
}, {
|
|
2548
|
+
key: "_getEstimatedColumnSize",
|
|
2549
|
+
value: function(props) {
|
|
2550
|
+
return "number" == typeof props.columnWidth ? props.columnWidth : props.estimatedColumnSize;
|
|
2551
|
+
}
|
|
2552
|
+
}, {
|
|
2553
|
+
key: "_getEstimatedRowSize",
|
|
2554
|
+
value: function(props) {
|
|
2555
|
+
return "number" == typeof props.rowHeight ? props.rowHeight : props.estimatedRowSize;
|
|
2556
|
+
}
|
|
2557
|
+
}, {
|
|
2558
|
+
key: "_getScrollToPositionStateUpdate",
|
|
2559
|
+
value: function(_ref9) {
|
|
2560
|
+
var prevState = _ref9.prevState, scrollLeft = _ref9.scrollLeft, _ref9 = _ref9.scrollTop, newState = {
|
|
2561
|
+
scrollPositionChangeReason: SCROLL_POSITION_CHANGE_REASONS$1_REQUESTED
|
|
2562
|
+
};
|
|
2563
|
+
return "number" == typeof scrollLeft && 0 <= scrollLeft && (newState.scrollDirectionHorizontal = scrollLeft > prevState.scrollLeft ? 1 : -1,
|
|
2564
|
+
newState.scrollLeft = scrollLeft), "number" == typeof _ref9 && 0 <= _ref9 && (newState.scrollDirectionVertical = _ref9 > prevState.scrollTop ? 1 : -1,
|
|
2565
|
+
newState.scrollTop = _ref9), "number" == typeof scrollLeft && 0 <= scrollLeft && scrollLeft !== prevState.scrollLeft || "number" == typeof _ref9 && 0 <= _ref9 && _ref9 !== prevState.scrollTop ? newState : {};
|
|
2566
|
+
}
|
|
2567
|
+
}, {
|
|
2568
|
+
key: "_wrapSizeGetter",
|
|
2569
|
+
value: function(value) {
|
|
2570
|
+
return "function" == typeof value ? value : function() {
|
|
2571
|
+
return value;
|
|
2572
|
+
};
|
|
2573
|
+
}
|
|
2574
|
+
}, {
|
|
2575
|
+
key: "_getCalculatedScrollLeft",
|
|
2576
|
+
value: function(nextProps, prevState) {
|
|
2577
|
+
var columnCount = nextProps.columnCount, height = nextProps.height, scrollToAlignment = nextProps.scrollToAlignment, scrollToColumn = nextProps.scrollToColumn, nextProps = nextProps.width, scrollLeft = prevState.scrollLeft, prevState = prevState.instanceProps;
|
|
2578
|
+
return 0 < columnCount ? (columnCount = columnCount - 1, columnCount = scrollToColumn < 0 ? columnCount : Math.min(columnCount, scrollToColumn),
|
|
2579
|
+
scrollToColumn = prevState.rowSizeAndPositionManager.getTotalSize(),
|
|
2580
|
+
height = prevState.scrollbarSizeMeasured && height < scrollToColumn ? prevState.scrollbarSize : 0,
|
|
2581
|
+
prevState.columnSizeAndPositionManager.getUpdatedOffsetForIndex({
|
|
2582
|
+
align: scrollToAlignment,
|
|
2583
|
+
containerSize: nextProps - height,
|
|
2584
|
+
currentOffset: scrollLeft,
|
|
2585
|
+
targetIndex: columnCount
|
|
2586
|
+
})) : 0;
|
|
2587
|
+
}
|
|
2588
|
+
}, {
|
|
2589
|
+
key: "_getScrollLeftForScrollToColumnStateUpdate",
|
|
2590
|
+
value: function(nextProps, prevState) {
|
|
2591
|
+
var scrollLeft = prevState.scrollLeft, nextProps = Grid._getCalculatedScrollLeft(nextProps, prevState);
|
|
2592
|
+
return "number" == typeof nextProps && 0 <= nextProps && scrollLeft !== nextProps ? Grid._getScrollToPositionStateUpdate({
|
|
2593
|
+
prevState: prevState,
|
|
2594
|
+
scrollLeft: nextProps,
|
|
2595
|
+
scrollTop: -1
|
|
2596
|
+
}) : {};
|
|
2597
|
+
}
|
|
2598
|
+
}, {
|
|
2599
|
+
key: "_getCalculatedScrollTop",
|
|
2600
|
+
value: function(nextProps, prevState) {
|
|
2601
|
+
var height = nextProps.height, rowCount = nextProps.rowCount, scrollToAlignment = nextProps.scrollToAlignment, scrollToRow = nextProps.scrollToRow, nextProps = nextProps.width, scrollTop = prevState.scrollTop, prevState = prevState.instanceProps;
|
|
2602
|
+
return 0 < rowCount ? (rowCount = rowCount - 1, rowCount = scrollToRow < 0 ? rowCount : Math.min(rowCount, scrollToRow),
|
|
2603
|
+
scrollToRow = prevState.columnSizeAndPositionManager.getTotalSize(),
|
|
2604
|
+
nextProps = prevState.scrollbarSizeMeasured && nextProps < scrollToRow ? prevState.scrollbarSize : 0,
|
|
2605
|
+
prevState.rowSizeAndPositionManager.getUpdatedOffsetForIndex({
|
|
2606
|
+
align: scrollToAlignment,
|
|
2607
|
+
containerSize: height - nextProps,
|
|
2608
|
+
currentOffset: scrollTop,
|
|
2609
|
+
targetIndex: rowCount
|
|
2610
|
+
})) : 0;
|
|
2611
|
+
}
|
|
2612
|
+
}, {
|
|
2613
|
+
key: "_getScrollTopForScrollToRowStateUpdate",
|
|
2614
|
+
value: function(nextProps, prevState) {
|
|
2615
|
+
var scrollTop = prevState.scrollTop, nextProps = Grid._getCalculatedScrollTop(nextProps, prevState);
|
|
2616
|
+
return "number" == typeof nextProps && 0 <= nextProps && scrollTop !== nextProps ? Grid._getScrollToPositionStateUpdate({
|
|
2617
|
+
prevState: prevState,
|
|
2618
|
+
scrollLeft: -1,
|
|
2619
|
+
scrollTop: nextProps
|
|
2620
|
+
}) : {};
|
|
2621
|
+
}
|
|
2622
|
+
} ]);
|
|
2623
|
+
})();
|
|
2624
|
+
_defineProperty(Grid, "defaultProps", {
|
|
2625
|
+
"aria-label": "grid",
|
|
2626
|
+
"aria-readonly": !0,
|
|
2627
|
+
autoContainerWidth: !1,
|
|
2628
|
+
autoHeight: !1,
|
|
2629
|
+
autoWidth: !1,
|
|
2630
|
+
cellRangeRenderer: defaultCellRangeRenderer,
|
|
2631
|
+
containerRole: "row",
|
|
2632
|
+
containerStyle: {},
|
|
2633
|
+
estimatedColumnSize: 100,
|
|
2634
|
+
estimatedRowSize: 30,
|
|
2635
|
+
getScrollbarSize: scrollbarSize,
|
|
2636
|
+
noContentRenderer: function() {
|
|
2637
|
+
return null;
|
|
2638
|
+
},
|
|
2639
|
+
onScroll: function() {},
|
|
2640
|
+
onScrollbarPresenceChange: function() {},
|
|
2641
|
+
onSectionRendered: function() {},
|
|
2642
|
+
overscanColumnCount: 0,
|
|
2643
|
+
overscanIndicesGetter: defaultOverscanIndicesGetter,
|
|
2644
|
+
overscanRowCount: 10,
|
|
2645
|
+
role: "grid",
|
|
2646
|
+
scrollingResetTimeInterval: 150,
|
|
2647
|
+
scrollToAlignment: "auto",
|
|
2648
|
+
scrollToColumn: -1,
|
|
2649
|
+
scrollToRow: -1,
|
|
2650
|
+
style: {},
|
|
2651
|
+
tabIndex: 0,
|
|
2652
|
+
isScrollingOptOut: !1
|
|
2653
|
+
}), polyfill(Grid);
|
|
2654
|
+
function defaultOverscanIndicesGetter$1(_ref) {
|
|
2655
|
+
var cellCount = _ref.cellCount, overscanCellsCount = _ref.overscanCellsCount, scrollDirection = _ref.scrollDirection, startIndex = _ref.startIndex, _ref = _ref.stopIndex, overscanCellsCount = Math.max(1, overscanCellsCount);
|
|
2656
|
+
return 1 === scrollDirection ? {
|
|
2657
|
+
overscanStartIndex: Math.max(0, startIndex - 1),
|
|
2658
|
+
overscanStopIndex: Math.min(cellCount - 1, _ref + overscanCellsCount)
|
|
2659
|
+
} : {
|
|
2660
|
+
overscanStartIndex: Math.max(0, startIndex - overscanCellsCount),
|
|
2661
|
+
overscanStopIndex: Math.min(cellCount - 1, _ref + 1)
|
|
2662
|
+
};
|
|
2663
|
+
}
|
|
2664
|
+
request = (() => {
|
|
2665
|
+
function InfiniteLoader(props, context) {
|
|
2666
|
+
return _classCallCheck(this, InfiniteLoader), (props = _callSuper(this, InfiniteLoader, [ props, context ]))._loadMoreRowsMemoizer = createCallbackMemoizer(),
|
|
2667
|
+
props._onRowsRendered = props._onRowsRendered.bind(props), props._registerChild = props._registerChild.bind(props),
|
|
2668
|
+
props;
|
|
2669
|
+
}
|
|
2670
|
+
return _inherits(InfiniteLoader, React.PureComponent), _createClass(InfiniteLoader, [ {
|
|
2671
|
+
key: "resetLoadMoreRowsCache",
|
|
2672
|
+
value: function(autoReload) {
|
|
2673
|
+
this._loadMoreRowsMemoizer = createCallbackMemoizer(), autoReload && this._doStuff(this._lastRenderedStartIndex, this._lastRenderedStopIndex);
|
|
2674
|
+
}
|
|
2675
|
+
}, {
|
|
2676
|
+
key: "render",
|
|
2677
|
+
value: function() {
|
|
2678
|
+
return (0, this.props.children)({
|
|
2679
|
+
onRowsRendered: this._onRowsRendered,
|
|
2680
|
+
registerChild: this._registerChild
|
|
2681
|
+
});
|
|
2682
|
+
}
|
|
2683
|
+
}, {
|
|
2684
|
+
key: "_loadUnloadedRanges",
|
|
2685
|
+
value: function(unloadedRanges) {
|
|
2686
|
+
var _this2 = this, loadMoreRows = this.props.loadMoreRows;
|
|
2687
|
+
unloadedRanges.forEach(function(unloadedRange) {
|
|
2688
|
+
var promise = loadMoreRows(unloadedRange);
|
|
2689
|
+
promise && promise.then(function() {
|
|
2690
|
+
var _ref4, lastRenderedStartIndex, lastRenderedStopIndex, stopIndex;
|
|
2691
|
+
_ref4 = {
|
|
2692
|
+
lastRenderedStartIndex: _this2._lastRenderedStartIndex,
|
|
2693
|
+
lastRenderedStopIndex: _this2._lastRenderedStopIndex,
|
|
2694
|
+
startIndex: unloadedRange.startIndex,
|
|
2695
|
+
stopIndex: unloadedRange.stopIndex
|
|
2696
|
+
}, lastRenderedStartIndex = _ref4.lastRenderedStartIndex,
|
|
2697
|
+
lastRenderedStopIndex = _ref4.lastRenderedStopIndex, stopIndex = _ref4.stopIndex,
|
|
2698
|
+
_ref4.startIndex > lastRenderedStopIndex || stopIndex < lastRenderedStartIndex || _this2._registeredChild && function(component) {
|
|
2699
|
+
var currentIndex = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, recomputeSize = "function" == typeof component.recomputeGridSize ? component.recomputeGridSize : component.recomputeRowHeights;
|
|
2700
|
+
recomputeSize ? recomputeSize.call(component, currentIndex) : component.forceUpdate();
|
|
2701
|
+
}(_this2._registeredChild, _this2._lastRenderedStartIndex);
|
|
2702
|
+
});
|
|
2703
|
+
});
|
|
2704
|
+
}
|
|
2705
|
+
}, {
|
|
2706
|
+
key: "_onRowsRendered",
|
|
2707
|
+
value: function(_ref) {
|
|
2708
|
+
var startIndex = _ref.startIndex, _ref = _ref.stopIndex;
|
|
2709
|
+
this._lastRenderedStartIndex = startIndex, this._lastRenderedStopIndex = _ref,
|
|
2710
|
+
this._doStuff(startIndex, _ref);
|
|
2711
|
+
}
|
|
2712
|
+
}, {
|
|
2713
|
+
key: "_doStuff",
|
|
2714
|
+
value: function(startIndex, stopIndex) {
|
|
2715
|
+
var _this3 = this, _this$props = this.props, isRowLoaded = _this$props.isRowLoaded, rowCount = _this$props.rowCount, threshold = _this$props.threshold, unloadedRanges = (_ref5 => {
|
|
2716
|
+
for (var isRowLoaded = _ref5.isRowLoaded, minimumBatchSize = _ref5.minimumBatchSize, rowCount = _ref5.rowCount, stopIndex = _ref5.stopIndex, unloadedRanges = [], rangeStartIndex = null, rangeStopIndex = null, index = _ref5.startIndex; index <= stopIndex; index++) isRowLoaded({
|
|
2717
|
+
index: index
|
|
2718
|
+
}) ? null !== rangeStopIndex && (unloadedRanges.push({
|
|
2719
|
+
startIndex: rangeStartIndex,
|
|
2720
|
+
stopIndex: rangeStopIndex
|
|
2721
|
+
}), rangeStartIndex = rangeStopIndex = null) : (rangeStopIndex = index,
|
|
2722
|
+
null === rangeStartIndex && (rangeStartIndex = index));
|
|
2723
|
+
if (null !== rangeStopIndex) {
|
|
2724
|
+
for (var potentialStopIndex = Math.min(Math.max(rangeStopIndex, rangeStartIndex + minimumBatchSize - 1), rowCount - 1), _index = rangeStopIndex + 1; _index <= potentialStopIndex && !isRowLoaded({
|
|
2725
|
+
index: _index
|
|
2726
|
+
}); _index++) rangeStopIndex = _index;
|
|
2727
|
+
unloadedRanges.push({
|
|
2728
|
+
startIndex: rangeStartIndex,
|
|
2729
|
+
stopIndex: rangeStopIndex
|
|
2730
|
+
});
|
|
2731
|
+
}
|
|
2732
|
+
if (unloadedRanges.length) for (var firstUnloadedRange = unloadedRanges[0]; firstUnloadedRange.stopIndex - firstUnloadedRange.startIndex + 1 < minimumBatchSize && 0 < firstUnloadedRange.startIndex; ) {
|
|
2733
|
+
var _index2 = firstUnloadedRange.startIndex - 1;
|
|
2734
|
+
if (isRowLoaded({
|
|
2735
|
+
index: _index2
|
|
2736
|
+
})) break;
|
|
2737
|
+
firstUnloadedRange.startIndex = _index2;
|
|
2738
|
+
}
|
|
2739
|
+
return unloadedRanges;
|
|
2740
|
+
})({
|
|
2741
|
+
isRowLoaded: isRowLoaded,
|
|
2742
|
+
minimumBatchSize: _this$props.minimumBatchSize,
|
|
2743
|
+
rowCount: rowCount,
|
|
2744
|
+
startIndex: Math.max(0, startIndex - threshold),
|
|
2745
|
+
stopIndex: Math.min(rowCount - 1, stopIndex + threshold)
|
|
2746
|
+
}), _this$props = (isRowLoaded = []).concat.apply(isRowLoaded, _toConsumableArray(unloadedRanges.map(function(_ref3) {
|
|
2747
|
+
return [ _ref3.startIndex, _ref3.stopIndex ];
|
|
2748
|
+
})));
|
|
2749
|
+
this._loadMoreRowsMemoizer({
|
|
2750
|
+
callback: function() {
|
|
2751
|
+
_this3._loadUnloadedRanges(unloadedRanges);
|
|
2752
|
+
},
|
|
2753
|
+
indices: {
|
|
2754
|
+
squashedUnloadedRanges: _this$props
|
|
2755
|
+
}
|
|
2756
|
+
});
|
|
2757
|
+
}
|
|
2758
|
+
}, {
|
|
2759
|
+
key: "_registerChild",
|
|
2760
|
+
value: function(registeredChild) {
|
|
2761
|
+
this._registeredChild = registeredChild;
|
|
2762
|
+
}
|
|
2763
|
+
} ]);
|
|
2764
|
+
})();
|
|
2765
|
+
_defineProperty(request, "propTypes", {
|
|
2766
|
+
children: propTypes.func.isRequired,
|
|
2767
|
+
isRowLoaded: propTypes.func.isRequired,
|
|
2768
|
+
loadMoreRows: propTypes.func.isRequired,
|
|
2769
|
+
minimumBatchSize: propTypes.number.isRequired,
|
|
2770
|
+
rowCount: propTypes.number.isRequired,
|
|
2771
|
+
threshold: propTypes.number.isRequired
|
|
2772
|
+
}), _defineProperty(request, "defaultProps", {
|
|
2773
|
+
minimumBatchSize: 10,
|
|
2774
|
+
rowCount: 0,
|
|
2775
|
+
threshold: 15
|
|
2776
|
+
});
|
|
2777
|
+
cancel = (() => {
|
|
2778
|
+
function List() {
|
|
2779
|
+
var _this;
|
|
2780
|
+
_classCallCheck(this, List);
|
|
2781
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
|
2782
|
+
return _defineProperty(_this = _callSuper(this, List, [].concat(args)), "Grid", void 0),
|
|
2783
|
+
_defineProperty(_this, "_cellRenderer", function(_ref) {
|
|
2784
|
+
var parent = _ref.parent, rowIndex = _ref.rowIndex, style = _ref.style, isScrolling = _ref.isScrolling, isVisible = _ref.isVisible, _ref = _ref.key, rowRenderer = _this.props.rowRenderer, widthDescriptor = Object.getOwnPropertyDescriptor(style, "width");
|
|
2785
|
+
return widthDescriptor && widthDescriptor.writable && (style.width = "100%"),
|
|
2786
|
+
rowRenderer({
|
|
2787
|
+
index: rowIndex,
|
|
2788
|
+
style: style,
|
|
2789
|
+
isScrolling: isScrolling,
|
|
2790
|
+
isVisible: isVisible,
|
|
2791
|
+
key: _ref,
|
|
2792
|
+
parent: parent
|
|
2793
|
+
});
|
|
2794
|
+
}), _defineProperty(_this, "_setRef", function(ref) {
|
|
2795
|
+
_this.Grid = ref;
|
|
2796
|
+
}), _defineProperty(_this, "_onScroll", function(_ref2) {
|
|
2797
|
+
var clientHeight = _ref2.clientHeight;
|
|
2798
|
+
(0, _this.props.onScroll)({
|
|
2799
|
+
clientHeight: clientHeight,
|
|
2800
|
+
scrollHeight: _ref2.scrollHeight,
|
|
2801
|
+
scrollTop: _ref2.scrollTop
|
|
2802
|
+
});
|
|
2803
|
+
}), _defineProperty(_this, "_onSectionRendered", function(_ref3) {
|
|
2804
|
+
var rowOverscanStartIndex = _ref3.rowOverscanStartIndex;
|
|
2805
|
+
(0, _this.props.onRowsRendered)({
|
|
2806
|
+
overscanStartIndex: rowOverscanStartIndex,
|
|
2807
|
+
overscanStopIndex: _ref3.rowOverscanStopIndex,
|
|
2808
|
+
startIndex: _ref3.rowStartIndex,
|
|
2809
|
+
stopIndex: _ref3.rowStopIndex
|
|
2810
|
+
});
|
|
2811
|
+
}), _this;
|
|
2812
|
+
}
|
|
2813
|
+
return _inherits(List, React.PureComponent), _createClass(List, [ {
|
|
2814
|
+
key: "forceUpdateGrid",
|
|
2815
|
+
value: function() {
|
|
2816
|
+
this.Grid && this.Grid.forceUpdate();
|
|
2817
|
+
}
|
|
2818
|
+
}, {
|
|
2819
|
+
key: "getOffsetForRow",
|
|
2820
|
+
value: function(_ref4) {
|
|
2821
|
+
var alignment = _ref4.alignment;
|
|
2822
|
+
return this.Grid ? this.Grid.getOffsetForCell({
|
|
2823
|
+
alignment: alignment,
|
|
2824
|
+
rowIndex: _ref4.index,
|
|
2825
|
+
columnIndex: 0
|
|
2826
|
+
}).scrollTop : 0;
|
|
2827
|
+
}
|
|
2828
|
+
}, {
|
|
2829
|
+
key: "invalidateCellSizeAfterRender",
|
|
2830
|
+
value: function(_ref5) {
|
|
2831
|
+
var columnIndex = _ref5.columnIndex;
|
|
2832
|
+
this.Grid && this.Grid.invalidateCellSizeAfterRender({
|
|
2833
|
+
rowIndex: _ref5.rowIndex,
|
|
2834
|
+
columnIndex: columnIndex
|
|
2835
|
+
});
|
|
2836
|
+
}
|
|
2837
|
+
}, {
|
|
2838
|
+
key: "measureAllRows",
|
|
2839
|
+
value: function() {
|
|
2840
|
+
this.Grid && this.Grid.measureAllCells();
|
|
2841
|
+
}
|
|
2842
|
+
}, {
|
|
2843
|
+
key: "recomputeGridSize",
|
|
2844
|
+
value: function() {
|
|
2845
|
+
var _ref6 = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, _ref6$columnIndex = _ref6.columnIndex, _ref6 = _ref6.rowIndex;
|
|
2846
|
+
this.Grid && this.Grid.recomputeGridSize({
|
|
2847
|
+
rowIndex: void 0 === _ref6 ? 0 : _ref6,
|
|
2848
|
+
columnIndex: void 0 === _ref6$columnIndex ? 0 : _ref6$columnIndex
|
|
2849
|
+
});
|
|
2850
|
+
}
|
|
2851
|
+
}, {
|
|
2852
|
+
key: "recomputeRowHeights",
|
|
2853
|
+
value: function() {
|
|
2854
|
+
this.Grid && this.Grid.recomputeGridSize({
|
|
2855
|
+
rowIndex: 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0,
|
|
2856
|
+
columnIndex: 0
|
|
2857
|
+
});
|
|
2858
|
+
}
|
|
2859
|
+
}, {
|
|
2860
|
+
key: "scrollToPosition",
|
|
2861
|
+
value: function() {
|
|
2862
|
+
this.Grid && this.Grid.scrollToPosition({
|
|
2863
|
+
scrollTop: 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0
|
|
2864
|
+
});
|
|
2865
|
+
}
|
|
2866
|
+
}, {
|
|
2867
|
+
key: "scrollToRow",
|
|
2868
|
+
value: function() {
|
|
2869
|
+
this.Grid && this.Grid.scrollToCell({
|
|
2870
|
+
columnIndex: 0,
|
|
2871
|
+
rowIndex: 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0
|
|
2872
|
+
});
|
|
2873
|
+
}
|
|
2874
|
+
}, {
|
|
2875
|
+
key: "render",
|
|
2876
|
+
value: function() {
|
|
2877
|
+
var _this$props = this.props, className = _this$props.className, noRowsRenderer = _this$props.noRowsRenderer, scrollToIndex = _this$props.scrollToIndex, _this$props = _this$props.width, className = clsx("ReactVirtualized__List", className);
|
|
2878
|
+
return React.createElement(Grid, _extends({}, this.props, {
|
|
2879
|
+
autoContainerWidth: !0,
|
|
2880
|
+
cellRenderer: this._cellRenderer,
|
|
2881
|
+
className: className,
|
|
2882
|
+
columnWidth: _this$props,
|
|
2883
|
+
columnCount: 1,
|
|
2884
|
+
noContentRenderer: noRowsRenderer,
|
|
2885
|
+
onScroll: this._onScroll,
|
|
2886
|
+
onSectionRendered: this._onSectionRendered,
|
|
2887
|
+
ref: this._setRef,
|
|
2888
|
+
scrollToRow: scrollToIndex
|
|
2889
|
+
}));
|
|
2890
|
+
}
|
|
2891
|
+
} ]);
|
|
2892
|
+
})();
|
|
2893
|
+
_defineProperty(cancel, "defaultProps", {
|
|
2894
|
+
autoHeight: !1,
|
|
2895
|
+
estimatedRowSize: 30,
|
|
2896
|
+
onScroll: function() {},
|
|
2897
|
+
noRowsRenderer: function() {
|
|
2898
|
+
return null;
|
|
2899
|
+
},
|
|
2900
|
+
onRowsRendered: function() {},
|
|
2901
|
+
overscanIndicesGetter: defaultOverscanIndicesGetter$1,
|
|
2902
|
+
overscanRowCount: 10,
|
|
2903
|
+
scrollToAlignment: "auto",
|
|
2904
|
+
scrollToIndex: -1,
|
|
2905
|
+
style: {}
|
|
2906
|
+
});
|
|
2907
|
+
var bounds = {
|
|
2908
|
+
ge: function(a, y, c, l, h) {
|
|
2909
|
+
return "function" == typeof c ? ((a, l, h, y, c) => {
|
|
2910
|
+
for (var i = h + 1; l <= h; ) {
|
|
2911
|
+
var m = l + h >>> 1;
|
|
2912
|
+
0 <= c(a[m], y) ? h = (i = m) - 1 : l = 1 + m;
|
|
2913
|
+
}
|
|
2914
|
+
return i;
|
|
2915
|
+
})(a, void 0 === l ? 0 : 0 | l, void 0 === h ? a.length - 1 : 0 | h, y, c) : ((a, l, h, y) => {
|
|
2916
|
+
for (var i = h + 1; l <= h; ) {
|
|
2917
|
+
var m = l + h >>> 1;
|
|
2918
|
+
y <= a[m] ? h = (i = m) - 1 : l = 1 + m;
|
|
2919
|
+
}
|
|
2920
|
+
return i;
|
|
2921
|
+
})(a, void 0 === c ? 0 : 0 | c, void 0 === l ? a.length - 1 : 0 | l, y);
|
|
2922
|
+
},
|
|
2923
|
+
gt: function(a, y, c, l, h) {
|
|
2924
|
+
return "function" == typeof c ? ((a, l, h, y, c) => {
|
|
2925
|
+
for (var i = h + 1; l <= h; ) {
|
|
2926
|
+
var m = l + h >>> 1;
|
|
2927
|
+
0 < c(a[m], y) ? h = (i = m) - 1 : l = 1 + m;
|
|
2928
|
+
}
|
|
2929
|
+
return i;
|
|
2930
|
+
})(a, void 0 === l ? 0 : 0 | l, void 0 === h ? a.length - 1 : 0 | h, y, c) : ((a, l, h, y) => {
|
|
2931
|
+
for (var i = h + 1; l <= h; ) {
|
|
2932
|
+
var m = l + h >>> 1;
|
|
2933
|
+
y < a[m] ? h = (i = m) - 1 : l = 1 + m;
|
|
2934
|
+
}
|
|
2935
|
+
return i;
|
|
2936
|
+
})(a, void 0 === c ? 0 : 0 | c, void 0 === l ? a.length - 1 : 0 | l, y);
|
|
2937
|
+
},
|
|
2938
|
+
lt: function(a, y, c, l, h) {
|
|
2939
|
+
return "function" == typeof c ? ((a, l, h, y, c) => {
|
|
2940
|
+
for (var i = l - 1; l <= h; ) {
|
|
2941
|
+
var m = l + h >>> 1;
|
|
2942
|
+
c(a[m], y) < 0 ? l = 1 + (i = m) : h = m - 1;
|
|
2943
|
+
}
|
|
2944
|
+
return i;
|
|
2945
|
+
})(a, void 0 === l ? 0 : 0 | l, void 0 === h ? a.length - 1 : 0 | h, y, c) : ((a, l, h, y) => {
|
|
2946
|
+
for (var i = l - 1; l <= h; ) {
|
|
2947
|
+
var m = l + h >>> 1;
|
|
2948
|
+
a[m] < y ? l = 1 + (i = m) : h = m - 1;
|
|
2949
|
+
}
|
|
2950
|
+
return i;
|
|
2951
|
+
})(a, void 0 === c ? 0 : 0 | c, void 0 === l ? a.length - 1 : 0 | l, y);
|
|
2952
|
+
},
|
|
2953
|
+
le: function(a, y, c, l, h) {
|
|
2954
|
+
return "function" == typeof c ? ((a, l, h, y, c) => {
|
|
2955
|
+
for (var i = l - 1; l <= h; ) {
|
|
2956
|
+
var m = l + h >>> 1;
|
|
2957
|
+
c(a[m], y) <= 0 ? l = 1 + (i = m) : h = m - 1;
|
|
2958
|
+
}
|
|
2959
|
+
return i;
|
|
2960
|
+
})(a, void 0 === l ? 0 : 0 | l, void 0 === h ? a.length - 1 : 0 | h, y, c) : ((a, l, h, y) => {
|
|
2961
|
+
for (var i = l - 1; l <= h; ) {
|
|
2962
|
+
var m = l + h >>> 1;
|
|
2963
|
+
a[m] <= y ? l = 1 + (i = m) : h = m - 1;
|
|
2964
|
+
}
|
|
2965
|
+
return i;
|
|
2966
|
+
})(a, void 0 === c ? 0 : 0 | c, void 0 === l ? a.length - 1 : 0 | l, y);
|
|
2967
|
+
},
|
|
2968
|
+
eq: function(a, y, c, l, h) {
|
|
2969
|
+
return "function" == typeof c ? ((a, l, h, y, c) => {
|
|
2970
|
+
for (;l <= h; ) {
|
|
2971
|
+
var m = l + h >>> 1, p = c(a[m], y);
|
|
2972
|
+
if (0 === p) return m;
|
|
2973
|
+
p <= 0 ? l = 1 + m : h = m - 1;
|
|
2974
|
+
}
|
|
2975
|
+
return -1;
|
|
2976
|
+
})(a, void 0 === l ? 0 : 0 | l, void 0 === h ? a.length - 1 : 0 | h, y, c) : ((a, l, h, y) => {
|
|
2977
|
+
for (;l <= h; ) {
|
|
2978
|
+
var m = l + h >>> 1, x = a[m];
|
|
2979
|
+
if (x === y) return m;
|
|
2980
|
+
x <= y ? l = 1 + m : h = m - 1;
|
|
2981
|
+
}
|
|
2982
|
+
return -1;
|
|
2983
|
+
})(a, void 0 === c ? 0 : 0 | c, void 0 === l ? a.length - 1 : 0 | l, y);
|
|
2984
|
+
}
|
|
2985
|
+
};
|
|
2986
|
+
function IntervalTreeNode(mid, left, right, leftPoints, rightPoints) {
|
|
2987
|
+
this.mid = mid, this.left = left, this.right = right, this.leftPoints = leftPoints,
|
|
2988
|
+
this.rightPoints = rightPoints, this.count = (left ? left.count : 0) + (right ? right.count : 0) + leftPoints.length;
|
|
2989
|
+
}
|
|
2990
|
+
var proto = IntervalTreeNode.prototype;
|
|
2991
|
+
function copy(a, b) {
|
|
2992
|
+
a.mid = b.mid, a.left = b.left, a.right = b.right, a.leftPoints = b.leftPoints,
|
|
2993
|
+
a.rightPoints = b.rightPoints, a.count = b.count;
|
|
2994
|
+
}
|
|
2995
|
+
function rebuild(node, intervals) {
|
|
2996
|
+
intervals = createIntervalTree(intervals);
|
|
2997
|
+
node.mid = intervals.mid, node.left = intervals.left, node.right = intervals.right,
|
|
2998
|
+
node.leftPoints = intervals.leftPoints, node.rightPoints = intervals.rightPoints,
|
|
2999
|
+
node.count = intervals.count;
|
|
3000
|
+
}
|
|
3001
|
+
function rebuildWithInterval(node, interval) {
|
|
3002
|
+
var intervals = node.intervals([]);
|
|
3003
|
+
intervals.push(interval), rebuild(node, intervals);
|
|
3004
|
+
}
|
|
3005
|
+
function rebuildWithoutInterval(node, interval) {
|
|
3006
|
+
var intervals = node.intervals([]), interval = intervals.indexOf(interval);
|
|
3007
|
+
return interval < 0 ? 0 : (intervals.splice(interval, 1), rebuild(node, intervals),
|
|
3008
|
+
1);
|
|
3009
|
+
}
|
|
3010
|
+
function reportLeftRange(arr, hi, cb) {
|
|
3011
|
+
for (var i = 0; i < arr.length && arr[i][0] <= hi; ++i) {
|
|
3012
|
+
var r = cb(arr[i]);
|
|
3013
|
+
if (r) return r;
|
|
3014
|
+
}
|
|
3015
|
+
}
|
|
3016
|
+
function reportRightRange(arr, lo, cb) {
|
|
3017
|
+
for (var i = arr.length - 1; 0 <= i && arr[i][1] >= lo; --i) {
|
|
3018
|
+
var r = cb(arr[i]);
|
|
3019
|
+
if (r) return r;
|
|
3020
|
+
}
|
|
3021
|
+
}
|
|
3022
|
+
function reportRange(arr, cb) {
|
|
3023
|
+
for (var i = 0; i < arr.length; ++i) {
|
|
3024
|
+
var r = cb(arr[i]);
|
|
3025
|
+
if (r) return r;
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
function compareNumbers(a, b) {
|
|
3029
|
+
return a - b;
|
|
3030
|
+
}
|
|
3031
|
+
function compareBegin(a, b) {
|
|
3032
|
+
var d = a[0] - b[0];
|
|
3033
|
+
return d || a[1] - b[1];
|
|
3034
|
+
}
|
|
3035
|
+
function compareEnd(a, b) {
|
|
3036
|
+
var d = a[1] - b[1];
|
|
3037
|
+
return d || a[0] - b[0];
|
|
3038
|
+
}
|
|
3039
|
+
function createIntervalTree(intervals) {
|
|
3040
|
+
if (0 === intervals.length) return null;
|
|
3041
|
+
for (var pts = [], i = 0; i < intervals.length; ++i) pts.push(intervals[i][0], intervals[i][1]);
|
|
3042
|
+
pts.sort(compareNumbers);
|
|
3043
|
+
for (var mid = pts[pts.length >> 1], leftIntervals = [], rightIntervals = [], centerIntervals = [], i = 0; i < intervals.length; ++i) {
|
|
3044
|
+
var s = intervals[i];
|
|
3045
|
+
(s[1] < mid ? leftIntervals : mid < s[0] ? rightIntervals : centerIntervals).push(s);
|
|
3046
|
+
}
|
|
3047
|
+
var leftPoints = centerIntervals, rightPoints = centerIntervals.slice();
|
|
3048
|
+
return leftPoints.sort(compareBegin), rightPoints.sort(compareEnd), new IntervalTreeNode(mid, createIntervalTree(leftIntervals), createIntervalTree(rightIntervals), leftPoints, rightPoints);
|
|
3049
|
+
}
|
|
3050
|
+
function IntervalTree(root) {
|
|
3051
|
+
this.root = root;
|
|
3052
|
+
}
|
|
3053
|
+
proto.intervals = function(result) {
|
|
3054
|
+
return result.push.apply(result, this.leftPoints), this.left && this.left.intervals(result),
|
|
3055
|
+
this.right && this.right.intervals(result), result;
|
|
3056
|
+
}, proto.insert = function(interval) {
|
|
3057
|
+
var r, weight = this.count - this.leftPoints.length;
|
|
3058
|
+
this.count += 1, interval[1] < this.mid ? this.left ? 4 * (this.left.count + 1) > 3 * (1 + weight) ? rebuildWithInterval(this, interval) : this.left.insert(interval) : this.left = createIntervalTree([ interval ]) : interval[0] > this.mid ? this.right ? 4 * (this.right.count + 1) > 3 * (1 + weight) ? rebuildWithInterval(this, interval) : this.right.insert(interval) : this.right = createIntervalTree([ interval ]) : (weight = bounds.ge(this.leftPoints, interval, compareBegin),
|
|
3059
|
+
r = bounds.ge(this.rightPoints, interval, compareEnd), this.leftPoints.splice(weight, 0, interval),
|
|
3060
|
+
this.rightPoints.splice(r, 0, interval));
|
|
3061
|
+
}, proto.remove = function(interval) {
|
|
3062
|
+
var weight = this.count - this.leftPoints;
|
|
3063
|
+
if (interval[1] < this.mid) return this.left ? 3 * (weight - 1) < 4 * (this.right ? this.right.count : 0) ? rebuildWithoutInterval(this, interval) : 2 === (r = this.left.remove(interval)) ? (this.left = null,
|
|
3064
|
+
--this.count, 1) : (1 === r && --this.count, r) : 0;
|
|
3065
|
+
if (interval[0] > this.mid) return this.right ? 3 * (weight - 1) < 4 * (this.left ? this.left.count : 0) ? rebuildWithoutInterval(this, interval) : 2 === (r = this.right.remove(interval)) ? (this.right = null,
|
|
3066
|
+
--this.count, 1) : (1 === r && --this.count, r) : 0;
|
|
3067
|
+
if (1 === this.count) return this.leftPoints[0] === interval ? 2 : 0;
|
|
3068
|
+
if (1 === this.leftPoints.length && this.leftPoints[0] === interval) {
|
|
3069
|
+
if (this.left && this.right) {
|
|
3070
|
+
for (var p = this, n = this.left; n.right; ) n = (p = n).right;
|
|
3071
|
+
p === this ? n.right = this.right : (l = this.left, r = this.right,
|
|
3072
|
+
p.count -= n.count, p.right = n.left, n.left = l, n.right = r),
|
|
3073
|
+
copy(this, n), this.count = (this.left ? this.left.count : 0) + (this.right ? this.right.count : 0) + this.leftPoints.length;
|
|
3074
|
+
} else this.left ? copy(this, this.left) : copy(this, this.right);
|
|
3075
|
+
return 1;
|
|
3076
|
+
}
|
|
3077
|
+
for (var l = bounds.ge(this.leftPoints, interval, compareBegin); l < this.leftPoints.length && this.leftPoints[l][0] === interval[0]; ++l) if (this.leftPoints[l] === interval) {
|
|
3078
|
+
--this.count, this.leftPoints.splice(l, 1);
|
|
3079
|
+
for (var r = bounds.ge(this.rightPoints, interval, compareEnd); r < this.rightPoints.length && this.rightPoints[r][1] === interval[1]; ++r) if (this.rightPoints[r] === interval) return this.rightPoints.splice(r, 1),
|
|
3080
|
+
1;
|
|
3081
|
+
}
|
|
3082
|
+
return 0;
|
|
3083
|
+
}, proto.queryPoint = function(x, cb) {
|
|
3084
|
+
if (x < this.mid) {
|
|
3085
|
+
if (this.left) if (r = this.left.queryPoint(x, cb)) return r;
|
|
3086
|
+
return reportLeftRange(this.leftPoints, x, cb);
|
|
3087
|
+
}
|
|
3088
|
+
if (x > this.mid) {
|
|
3089
|
+
var r;
|
|
3090
|
+
if (this.right) if (r = this.right.queryPoint(x, cb)) return r;
|
|
3091
|
+
return reportRightRange(this.rightPoints, x, cb);
|
|
3092
|
+
}
|
|
3093
|
+
return reportRange(this.leftPoints, cb);
|
|
3094
|
+
}, proto.queryInterval = function(lo, hi, cb) {
|
|
3095
|
+
var r;
|
|
3096
|
+
if (lo < this.mid && this.left && (r = this.left.queryInterval(lo, hi, cb))) return r;
|
|
3097
|
+
if (hi > this.mid && this.right && (r = this.right.queryInterval(lo, hi, cb))) return r;
|
|
3098
|
+
return hi < this.mid ? reportLeftRange(this.leftPoints, hi, cb) : lo > this.mid ? reportRightRange(this.rightPoints, lo, cb) : reportRange(this.leftPoints, cb);
|
|
3099
|
+
};
|
|
3100
|
+
proto = IntervalTree.prototype;
|
|
3101
|
+
proto.insert = function(interval) {
|
|
3102
|
+
this.root ? this.root.insert(interval) : this.root = new IntervalTreeNode(interval[0], null, null, [ interval ], [ interval ]);
|
|
3103
|
+
}, proto.remove = function(interval) {
|
|
3104
|
+
return !!this.root && (2 === (interval = this.root.remove(interval)) && (this.root = null),
|
|
3105
|
+
0 !== interval);
|
|
3106
|
+
}, proto.queryPoint = function(p, cb) {
|
|
3107
|
+
if (this.root) return this.root.queryPoint(p, cb);
|
|
3108
|
+
}, proto.queryInterval = function(lo, hi, cb) {
|
|
3109
|
+
if (lo <= hi && this.root) return this.root.queryInterval(lo, hi, cb);
|
|
3110
|
+
}, Object.defineProperty(proto, "count", {
|
|
3111
|
+
get: function() {
|
|
3112
|
+
return this.root ? this.root.count : 0;
|
|
3113
|
+
}
|
|
3114
|
+
}), Object.defineProperty(proto, "intervals", {
|
|
3115
|
+
get: function() {
|
|
3116
|
+
return this.root ? this.root.intervals([]) : [];
|
|
3117
|
+
}
|
|
3118
|
+
});
|
|
3119
|
+
var PositionCache = _createClass(function PositionCache() {
|
|
3120
|
+
var intervals;
|
|
3121
|
+
_classCallCheck(this, PositionCache), _defineProperty(this, "_columnSizeMap", {}),
|
|
3122
|
+
_defineProperty(this, "_intervalTree", intervals && 0 !== intervals.length ? new IntervalTree(createIntervalTree(intervals)) : new IntervalTree(null)),
|
|
3123
|
+
_defineProperty(this, "_leftMap", {});
|
|
3124
|
+
}, [ {
|
|
3125
|
+
key: "estimateTotalHeight",
|
|
3126
|
+
value: function(cellCount, columnCount, defaultCellHeight) {
|
|
3127
|
+
cellCount -= this.count;
|
|
3128
|
+
return this.tallestColumnSize + Math.ceil(cellCount / columnCount) * defaultCellHeight;
|
|
3129
|
+
}
|
|
3130
|
+
}, {
|
|
3131
|
+
key: "range",
|
|
3132
|
+
value: function(scrollTop, clientHeight, renderCallback) {
|
|
3133
|
+
var _this = this;
|
|
3134
|
+
this._intervalTree.queryInterval(scrollTop, scrollTop + clientHeight, function(_ref) {
|
|
3135
|
+
var _ref = _slicedToArray(_ref, 3), top = _ref[0], _ref = _ref[2];
|
|
3136
|
+
return renderCallback(_ref, _this._leftMap[_ref], top);
|
|
3137
|
+
});
|
|
3138
|
+
}
|
|
3139
|
+
}, {
|
|
3140
|
+
key: "setPosition",
|
|
3141
|
+
value: function(index, left, top, height) {
|
|
3142
|
+
this._intervalTree.insert([ top, top + height, index ]), this._leftMap[index] = left;
|
|
3143
|
+
var index = this._columnSizeMap, columnHeight = index[left];
|
|
3144
|
+
index[left] = void 0 === columnHeight ? top + height : Math.max(columnHeight, top + height);
|
|
3145
|
+
}
|
|
3146
|
+
}, {
|
|
3147
|
+
key: "count",
|
|
3148
|
+
get: function() {
|
|
3149
|
+
return this._intervalTree.count;
|
|
3150
|
+
}
|
|
3151
|
+
}, {
|
|
3152
|
+
key: "shortestColumnSize",
|
|
3153
|
+
get: function() {
|
|
3154
|
+
var i, columnSizeMap = this._columnSizeMap, size = 0;
|
|
3155
|
+
for (i in columnSizeMap) var height = columnSizeMap[i], size = 0 === size ? height : Math.min(size, height);
|
|
3156
|
+
return size;
|
|
3157
|
+
}
|
|
3158
|
+
}, {
|
|
3159
|
+
key: "tallestColumnSize",
|
|
3160
|
+
get: function() {
|
|
3161
|
+
var i, columnSizeMap = this._columnSizeMap, size = 0;
|
|
3162
|
+
for (i in columnSizeMap) var height = columnSizeMap[i], size = Math.max(size, height);
|
|
3163
|
+
return size;
|
|
3164
|
+
}
|
|
3165
|
+
} ]), proto = (() => {
|
|
3166
|
+
function Masonry() {
|
|
3167
|
+
var _this;
|
|
3168
|
+
_classCallCheck(this, Masonry);
|
|
3169
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
|
3170
|
+
return _defineProperty(_this = _callSuper(this, Masonry, [].concat(args)), "state", {
|
|
3171
|
+
isScrolling: !1,
|
|
3172
|
+
scrollTop: 0
|
|
3173
|
+
}), _defineProperty(_this, "_debounceResetIsScrollingId", void 0), _defineProperty(_this, "_invalidateOnUpdateStartIndex", null),
|
|
3174
|
+
_defineProperty(_this, "_invalidateOnUpdateStopIndex", null), _defineProperty(_this, "_positionCache", new PositionCache()),
|
|
3175
|
+
_defineProperty(_this, "_startIndex", null), _defineProperty(_this, "_startIndexMemoized", null),
|
|
3176
|
+
_defineProperty(_this, "_stopIndex", null), _defineProperty(_this, "_stopIndexMemoized", null),
|
|
3177
|
+
_defineProperty(_this, "_debounceResetIsScrollingCallback", function() {
|
|
3178
|
+
_this.setState({
|
|
3179
|
+
isScrolling: !1
|
|
3180
|
+
});
|
|
3181
|
+
}), _defineProperty(_this, "_setScrollingContainerRef", function(ref) {
|
|
3182
|
+
_this._scrollingContainer = ref;
|
|
3183
|
+
}), _defineProperty(_this, "_onScroll", function(event) {
|
|
3184
|
+
var height = _this.props.height, event = event.currentTarget.scrollTop, height = Math.min(Math.max(0, _this._getEstimatedTotalHeight() - height), event);
|
|
3185
|
+
event === height && (_this._debounceResetIsScrolling(), _this.state.scrollTop !== height) && _this.setState({
|
|
3186
|
+
isScrolling: !0,
|
|
3187
|
+
scrollTop: height
|
|
3188
|
+
});
|
|
3189
|
+
}), _this;
|
|
3190
|
+
}
|
|
3191
|
+
return _inherits(Masonry, React.PureComponent), _createClass(Masonry, [ {
|
|
3192
|
+
key: "clearCellPositions",
|
|
3193
|
+
value: function() {
|
|
3194
|
+
this._positionCache = new PositionCache(), this.forceUpdate();
|
|
3195
|
+
}
|
|
3196
|
+
}, {
|
|
3197
|
+
key: "invalidateCellSizeAfterRender",
|
|
3198
|
+
value: function(_ref) {
|
|
3199
|
+
_ref = _ref.rowIndex;
|
|
3200
|
+
null === this._invalidateOnUpdateStartIndex ? (this._invalidateOnUpdateStartIndex = _ref,
|
|
3201
|
+
this._invalidateOnUpdateStopIndex = _ref) : (this._invalidateOnUpdateStartIndex = Math.min(this._invalidateOnUpdateStartIndex, _ref),
|
|
3202
|
+
this._invalidateOnUpdateStopIndex = Math.max(this._invalidateOnUpdateStopIndex, _ref));
|
|
3203
|
+
}
|
|
3204
|
+
}, {
|
|
3205
|
+
key: "recomputeCellPositions",
|
|
3206
|
+
value: function() {
|
|
3207
|
+
var stopIndex = this._positionCache.count - 1;
|
|
3208
|
+
this._positionCache = new PositionCache(), this._populatePositionCache(0, stopIndex),
|
|
3209
|
+
this.forceUpdate();
|
|
3210
|
+
}
|
|
3211
|
+
}, {
|
|
3212
|
+
key: "componentDidMount",
|
|
3213
|
+
value: function() {
|
|
3214
|
+
this._checkInvalidateOnUpdate(), this._invokeOnScrollCallback(),
|
|
3215
|
+
this._invokeOnCellsRenderedCallback();
|
|
3216
|
+
}
|
|
3217
|
+
}, {
|
|
3218
|
+
key: "componentDidUpdate",
|
|
3219
|
+
value: function(prevProps, prevState) {
|
|
3220
|
+
this._checkInvalidateOnUpdate(), this._invokeOnScrollCallback(),
|
|
3221
|
+
this._invokeOnCellsRenderedCallback(), this.props.scrollTop !== prevProps.scrollTop && this._debounceResetIsScrolling();
|
|
3222
|
+
}
|
|
3223
|
+
}, {
|
|
3224
|
+
key: "componentWillUnmount",
|
|
3225
|
+
value: function() {
|
|
3226
|
+
this._debounceResetIsScrollingId && cancelAnimationTimeout(this._debounceResetIsScrollingId);
|
|
3227
|
+
}
|
|
3228
|
+
}, {
|
|
3229
|
+
key: "render",
|
|
3230
|
+
value: function() {
|
|
3231
|
+
var stopIndex, _this2 = this, _this$props = this.props, autoHeight = _this$props.autoHeight, cellCount = _this$props.cellCount, cellMeasurerCache = _this$props.cellMeasurerCache, cellRenderer = _this$props.cellRenderer, className = _this$props.className, height = _this$props.height, id = _this$props.id, keyMapper = _this$props.keyMapper, overscanByPixels = _this$props.overscanByPixels, role = _this$props.role, style = _this$props.style, tabIndex = _this$props.tabIndex, width = _this$props.width, rowDirection = _this$props.rowDirection, _this$props = this.state, isScrolling = _this$props.isScrolling, _this$props = _this$props.scrollTop, children = [], estimateTotalHeight = this._getEstimatedTotalHeight(), shortestColumnSize = this._positionCache.shortestColumnSize, measuredCellCount = this._positionCache.count, startIndex = 0;
|
|
3232
|
+
if (this._positionCache.range(Math.max(0, _this$props - overscanByPixels), height + 2 * overscanByPixels, function(index, left, top) {
|
|
3233
|
+
stopIndex = void 0 === stopIndex ? startIndex = index : (startIndex = Math.min(startIndex, index),
|
|
3234
|
+
Math.max(stopIndex, index)), children.push(cellRenderer({
|
|
3235
|
+
index: index,
|
|
3236
|
+
isScrolling: isScrolling,
|
|
3237
|
+
key: keyMapper(index),
|
|
3238
|
+
parent: _this2,
|
|
3239
|
+
style: _defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
3240
|
+
height: cellMeasurerCache.getHeight(index)
|
|
3241
|
+
}, "ltr" === rowDirection ? "left" : "right", left), "position", "absolute"), "top", top), "width", cellMeasurerCache.getWidth(index))
|
|
3242
|
+
}));
|
|
3243
|
+
}), shortestColumnSize < _this$props + height + overscanByPixels && measuredCellCount < cellCount) for (var batchSize = Math.min(cellCount - measuredCellCount, Math.ceil((_this$props + height + overscanByPixels - shortestColumnSize) / cellMeasurerCache.defaultHeight * width / cellMeasurerCache.defaultWidth)), _index = measuredCellCount; _index < measuredCellCount + batchSize; _index++) stopIndex = _index,
|
|
3244
|
+
children.push(cellRenderer({
|
|
3245
|
+
index: _index,
|
|
3246
|
+
isScrolling: isScrolling,
|
|
3247
|
+
key: keyMapper(_index),
|
|
3248
|
+
parent: this,
|
|
3249
|
+
style: {
|
|
3250
|
+
width: cellMeasurerCache.getWidth(_index)
|
|
3251
|
+
}
|
|
3252
|
+
}));
|
|
3253
|
+
return this._startIndex = startIndex, this._stopIndex = stopIndex,
|
|
3254
|
+
React.createElement("div", {
|
|
3255
|
+
ref: this._setScrollingContainerRef,
|
|
3256
|
+
"aria-label": this.props["aria-label"],
|
|
3257
|
+
className: clsx("ReactVirtualized__Masonry", className),
|
|
3258
|
+
id: id,
|
|
3259
|
+
onScroll: this._onScroll,
|
|
3260
|
+
role: role,
|
|
3261
|
+
style: _objectSpread2({
|
|
3262
|
+
boxSizing: "border-box",
|
|
3263
|
+
direction: "ltr",
|
|
3264
|
+
height: autoHeight ? "auto" : height,
|
|
3265
|
+
overflowX: "hidden",
|
|
3266
|
+
overflowY: estimateTotalHeight < height ? "hidden" : "auto",
|
|
3267
|
+
position: "relative",
|
|
3268
|
+
width: width,
|
|
3269
|
+
WebkitOverflowScrolling: "touch",
|
|
3270
|
+
willChange: "transform"
|
|
3271
|
+
}, style),
|
|
3272
|
+
tabIndex: tabIndex
|
|
3273
|
+
}, React.createElement("div", {
|
|
3274
|
+
className: "ReactVirtualized__Masonry__innerScrollContainer",
|
|
3275
|
+
style: {
|
|
3276
|
+
width: "100%",
|
|
3277
|
+
height: estimateTotalHeight,
|
|
3278
|
+
maxWidth: "100%",
|
|
3279
|
+
maxHeight: estimateTotalHeight,
|
|
3280
|
+
overflow: "hidden",
|
|
3281
|
+
pointerEvents: isScrolling ? "none" : "",
|
|
3282
|
+
position: "relative"
|
|
3283
|
+
}
|
|
3284
|
+
}, children));
|
|
3285
|
+
}
|
|
3286
|
+
}, {
|
|
3287
|
+
key: "_checkInvalidateOnUpdate",
|
|
3288
|
+
value: function() {
|
|
3289
|
+
var startIndex, stopIndex;
|
|
3290
|
+
"number" == typeof this._invalidateOnUpdateStartIndex && (startIndex = this._invalidateOnUpdateStartIndex,
|
|
3291
|
+
stopIndex = this._invalidateOnUpdateStopIndex, this._invalidateOnUpdateStartIndex = null,
|
|
3292
|
+
this._invalidateOnUpdateStopIndex = null, this._populatePositionCache(startIndex, stopIndex),
|
|
3293
|
+
this.forceUpdate());
|
|
3294
|
+
}
|
|
3295
|
+
}, {
|
|
3296
|
+
key: "_debounceResetIsScrolling",
|
|
3297
|
+
value: function() {
|
|
3298
|
+
var scrollingResetTimeInterval = this.props.scrollingResetTimeInterval;
|
|
3299
|
+
this._debounceResetIsScrollingId && cancelAnimationTimeout(this._debounceResetIsScrollingId),
|
|
3300
|
+
this._debounceResetIsScrollingId = requestAnimationTimeout(this._debounceResetIsScrollingCallback, scrollingResetTimeInterval);
|
|
3301
|
+
}
|
|
3302
|
+
}, {
|
|
3303
|
+
key: "_getEstimatedTotalHeight",
|
|
3304
|
+
value: function() {
|
|
3305
|
+
var _this$props2 = this.props, cellCount = _this$props2.cellCount, cellMeasurerCache = _this$props2.cellMeasurerCache, _this$props2 = Math.max(1, Math.floor(_this$props2.width / cellMeasurerCache.defaultWidth));
|
|
3306
|
+
return this._positionCache.estimateTotalHeight(cellCount, _this$props2, cellMeasurerCache.defaultHeight);
|
|
3307
|
+
}
|
|
3308
|
+
}, {
|
|
3309
|
+
key: "_invokeOnScrollCallback",
|
|
3310
|
+
value: function() {
|
|
3311
|
+
var _this$props3 = this.props, height = _this$props3.height, _this$props3 = _this$props3.onScroll, scrollTop = this.state.scrollTop;
|
|
3312
|
+
this._onScrollMemoized !== scrollTop && (_this$props3({
|
|
3313
|
+
clientHeight: height,
|
|
3314
|
+
scrollHeight: this._getEstimatedTotalHeight(),
|
|
3315
|
+
scrollTop: scrollTop
|
|
3316
|
+
}), this._onScrollMemoized = scrollTop);
|
|
3317
|
+
}
|
|
3318
|
+
}, {
|
|
3319
|
+
key: "_invokeOnCellsRenderedCallback",
|
|
3320
|
+
value: function() {
|
|
3321
|
+
this._startIndexMemoized === this._startIndex && this._stopIndexMemoized === this._stopIndex || ((0,
|
|
3322
|
+
this.props.onCellsRendered)({
|
|
3323
|
+
startIndex: this._startIndex,
|
|
3324
|
+
stopIndex: this._stopIndex
|
|
3325
|
+
}), this._startIndexMemoized = this._startIndex, this._stopIndexMemoized = this._stopIndex);
|
|
3326
|
+
}
|
|
3327
|
+
}, {
|
|
3328
|
+
key: "_populatePositionCache",
|
|
3329
|
+
value: function(startIndex, stopIndex) {
|
|
3330
|
+
for (var _this$props4 = this.props, cellMeasurerCache = _this$props4.cellMeasurerCache, cellPositioner = _this$props4.cellPositioner, _index2 = startIndex; _index2 <= stopIndex; _index2++) {
|
|
3331
|
+
var _cellPositioner = cellPositioner(_index2), left = _cellPositioner.left;
|
|
3332
|
+
this._positionCache.setPosition(_index2, left, _cellPositioner.top, cellMeasurerCache.getHeight(_index2));
|
|
3333
|
+
}
|
|
3334
|
+
}
|
|
3335
|
+
} ], [ {
|
|
3336
|
+
key: "getDerivedStateFromProps",
|
|
3337
|
+
value: function(nextProps, prevState) {
|
|
3338
|
+
return void 0 !== nextProps.scrollTop && prevState.scrollTop !== nextProps.scrollTop ? {
|
|
3339
|
+
isScrolling: !0,
|
|
3340
|
+
scrollTop: nextProps.scrollTop
|
|
3341
|
+
} : null;
|
|
3342
|
+
}
|
|
3343
|
+
} ]);
|
|
3344
|
+
})();
|
|
3345
|
+
function noop() {}
|
|
3346
|
+
_defineProperty(proto, "defaultProps", {
|
|
3347
|
+
autoHeight: !1,
|
|
3348
|
+
keyMapper: function(value) {
|
|
3349
|
+
return value;
|
|
3350
|
+
},
|
|
3351
|
+
onCellsRendered: noop,
|
|
3352
|
+
onScroll: noop,
|
|
3353
|
+
overscanByPixels: 20,
|
|
3354
|
+
role: "grid",
|
|
3355
|
+
scrollingResetTimeInterval: 150,
|
|
3356
|
+
style: {},
|
|
3357
|
+
tabIndex: 0,
|
|
3358
|
+
rowDirection: "ltr"
|
|
3359
|
+
}), polyfill(proto);
|
|
3360
|
+
var CellMeasurerCacheDecorator = _createClass(function CellMeasurerCacheDecorator() {
|
|
3361
|
+
var _this = this, params = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, cellMeasurerCache = (_classCallCheck(this, CellMeasurerCacheDecorator),
|
|
3362
|
+
_defineProperty(this, "_cellMeasurerCache", void 0), _defineProperty(this, "_columnIndexOffset", void 0),
|
|
3363
|
+
_defineProperty(this, "_rowIndexOffset", void 0), _defineProperty(this, "columnWidth", function(_ref) {
|
|
3364
|
+
_ref = _ref.index, _this._cellMeasurerCache.columnWidth({
|
|
3365
|
+
index: _ref + _this._columnIndexOffset
|
|
3366
|
+
});
|
|
3367
|
+
}), _defineProperty(this, "rowHeight", function(_ref2) {
|
|
3368
|
+
_ref2 = _ref2.index, _this._cellMeasurerCache.rowHeight({
|
|
3369
|
+
index: _ref2 + _this._rowIndexOffset
|
|
3370
|
+
});
|
|
3371
|
+
}), params.cellMeasurerCache), _params$columnIndexOf = params.columnIndexOffset, _params$columnIndexOf = void 0 === _params$columnIndexOf ? 0 : _params$columnIndexOf, params = params.rowIndexOffset, params = void 0 === params ? 0 : params;
|
|
3372
|
+
this._cellMeasurerCache = cellMeasurerCache, this._columnIndexOffset = _params$columnIndexOf,
|
|
3373
|
+
this._rowIndexOffset = params;
|
|
3374
|
+
}, [ {
|
|
3375
|
+
key: "clear",
|
|
3376
|
+
value: function(rowIndex, columnIndex) {
|
|
3377
|
+
this._cellMeasurerCache.clear(rowIndex + this._rowIndexOffset, columnIndex + this._columnIndexOffset);
|
|
3378
|
+
}
|
|
3379
|
+
}, {
|
|
3380
|
+
key: "clearAll",
|
|
3381
|
+
value: function() {
|
|
3382
|
+
this._cellMeasurerCache.clearAll();
|
|
3383
|
+
}
|
|
3384
|
+
}, {
|
|
3385
|
+
key: "defaultHeight",
|
|
3386
|
+
get: function() {
|
|
3387
|
+
return this._cellMeasurerCache.defaultHeight;
|
|
3388
|
+
}
|
|
3389
|
+
}, {
|
|
3390
|
+
key: "defaultWidth",
|
|
3391
|
+
get: function() {
|
|
3392
|
+
return this._cellMeasurerCache.defaultWidth;
|
|
3393
|
+
}
|
|
3394
|
+
}, {
|
|
3395
|
+
key: "hasFixedHeight",
|
|
3396
|
+
value: function() {
|
|
3397
|
+
return this._cellMeasurerCache.hasFixedHeight();
|
|
3398
|
+
}
|
|
3399
|
+
}, {
|
|
3400
|
+
key: "hasFixedWidth",
|
|
3401
|
+
value: function() {
|
|
3402
|
+
return this._cellMeasurerCache.hasFixedWidth();
|
|
3403
|
+
}
|
|
3404
|
+
}, {
|
|
3405
|
+
key: "getHeight",
|
|
3406
|
+
value: function(rowIndex) {
|
|
3407
|
+
return this._cellMeasurerCache.getHeight(rowIndex + this._rowIndexOffset, (1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0) + this._columnIndexOffset);
|
|
3408
|
+
}
|
|
3409
|
+
}, {
|
|
3410
|
+
key: "getWidth",
|
|
3411
|
+
value: function(rowIndex) {
|
|
3412
|
+
return this._cellMeasurerCache.getWidth(rowIndex + this._rowIndexOffset, (1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0) + this._columnIndexOffset);
|
|
3413
|
+
}
|
|
3414
|
+
}, {
|
|
3415
|
+
key: "has",
|
|
3416
|
+
value: function(rowIndex) {
|
|
3417
|
+
return this._cellMeasurerCache.has(rowIndex + this._rowIndexOffset, (1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0) + this._columnIndexOffset);
|
|
3418
|
+
}
|
|
3419
|
+
}, {
|
|
3420
|
+
key: "set",
|
|
3421
|
+
value: function(rowIndex, columnIndex, width, height) {
|
|
3422
|
+
this._cellMeasurerCache.set(rowIndex + this._rowIndexOffset, columnIndex + this._columnIndexOffset, width, height);
|
|
3423
|
+
}
|
|
3424
|
+
} ]), _excluded$1 = [ "rowIndex" ], _excluded2 = [ "columnIndex", "rowIndex" ], _excluded3 = [ "columnIndex" ], _excluded4 = [ "onScroll", "onSectionRendered", "onScrollbarPresenceChange", "scrollLeft", "scrollToColumn", "scrollTop", "scrollToRow" ], MultiGrid = (() => {
|
|
3425
|
+
function MultiGrid(props, context) {
|
|
3426
|
+
_classCallCheck(this, MultiGrid), _defineProperty(_this = _callSuper(this, MultiGrid, [ props, context ]), "state", {
|
|
3427
|
+
scrollLeft: 0,
|
|
3428
|
+
scrollTop: 0,
|
|
3429
|
+
scrollbarSize: 0,
|
|
3430
|
+
showHorizontalScrollbar: !1,
|
|
3431
|
+
showVerticalScrollbar: !1
|
|
3432
|
+
}), _defineProperty(_this, "_deferredInvalidateColumnIndex", null),
|
|
3433
|
+
_defineProperty(_this, "_deferredInvalidateRowIndex", null), _defineProperty(_this, "_bottomLeftGridRef", function(ref) {
|
|
3434
|
+
_this._bottomLeftGrid = ref;
|
|
3435
|
+
}), _defineProperty(_this, "_bottomRightGridRef", function(ref) {
|
|
3436
|
+
_this._bottomRightGrid = ref;
|
|
3437
|
+
}), _defineProperty(_this, "_cellRendererBottomLeftGrid", function(_ref) {
|
|
3438
|
+
var rowIndex = _ref.rowIndex, _ref = _objectWithoutProperties(_ref, _excluded$1), _this$props = _this.props, cellRenderer = _this$props.cellRenderer, fixedRowCount = _this$props.fixedRowCount;
|
|
3439
|
+
return rowIndex === _this$props.rowCount - fixedRowCount ? React.createElement("div", {
|
|
3440
|
+
key: _ref.key,
|
|
3441
|
+
style: _objectSpread2(_objectSpread2({}, _ref.style), {}, {
|
|
3442
|
+
height: 20
|
|
3443
|
+
})
|
|
3444
|
+
}) : cellRenderer(_objectSpread2(_objectSpread2({}, _ref), {}, {
|
|
3445
|
+
parent: _this,
|
|
3446
|
+
rowIndex: rowIndex + fixedRowCount
|
|
3447
|
+
}));
|
|
3448
|
+
}), _defineProperty(_this, "_cellRendererBottomRightGrid", function(_ref2) {
|
|
3449
|
+
var columnIndex = _ref2.columnIndex, rowIndex = _ref2.rowIndex, _ref2 = _objectWithoutProperties(_ref2, _excluded2), _this$props2 = _this.props, cellRenderer = _this$props2.cellRenderer, fixedColumnCount = _this$props2.fixedColumnCount, _this$props2 = _this$props2.fixedRowCount;
|
|
3450
|
+
return cellRenderer(_objectSpread2(_objectSpread2({}, _ref2), {}, {
|
|
3451
|
+
columnIndex: columnIndex + fixedColumnCount,
|
|
3452
|
+
parent: _this,
|
|
3453
|
+
rowIndex: rowIndex + _this$props2
|
|
3454
|
+
}));
|
|
3455
|
+
}), _defineProperty(_this, "_cellRendererTopRightGrid", function(_ref3) {
|
|
3456
|
+
var columnIndex = _ref3.columnIndex, _ref3 = _objectWithoutProperties(_ref3, _excluded3), _this$props3 = _this.props, cellRenderer = _this$props3.cellRenderer, fixedColumnCount = _this$props3.fixedColumnCount;
|
|
3457
|
+
return columnIndex === _this$props3.columnCount - fixedColumnCount ? React.createElement("div", {
|
|
3458
|
+
key: _ref3.key,
|
|
3459
|
+
style: _objectSpread2(_objectSpread2({}, _ref3.style), {}, {
|
|
3460
|
+
width: 20
|
|
3461
|
+
})
|
|
3462
|
+
}) : cellRenderer(_objectSpread2(_objectSpread2({}, _ref3), {}, {
|
|
3463
|
+
columnIndex: columnIndex + fixedColumnCount,
|
|
3464
|
+
parent: _this
|
|
3465
|
+
}));
|
|
3466
|
+
}), _defineProperty(_this, "_columnWidthRightGrid", function(_ref4) {
|
|
3467
|
+
var _ref4 = _ref4.index, _this$props4 = _this.props, columnCount = _this$props4.columnCount, fixedColumnCount = _this$props4.fixedColumnCount, _this$props4 = _this$props4.columnWidth, _this$state = _this.state, scrollbarSize = _this$state.scrollbarSize;
|
|
3468
|
+
return _this$state.showHorizontalScrollbar && _ref4 === columnCount - fixedColumnCount ? scrollbarSize : "function" == typeof _this$props4 ? _this$props4({
|
|
3469
|
+
index: _ref4 + fixedColumnCount
|
|
3470
|
+
}) : _this$props4;
|
|
3471
|
+
}), _defineProperty(_this, "_onScroll", function(scrollInfo) {
|
|
3472
|
+
var scrollLeft = scrollInfo.scrollLeft, scrollLeft = (_this.setState({
|
|
3473
|
+
scrollLeft: scrollLeft,
|
|
3474
|
+
scrollTop: scrollInfo.scrollTop
|
|
3475
|
+
}), _this.props.onScroll);
|
|
3476
|
+
scrollLeft && scrollLeft(scrollInfo);
|
|
3477
|
+
}), _defineProperty(_this, "_onScrollbarPresenceChange", function(_ref5) {
|
|
3478
|
+
var horizontal = _ref5.horizontal, size = _ref5.size, _ref5 = _ref5.vertical, _this$state2 = _this.state;
|
|
3479
|
+
horizontal === _this$state2.showHorizontalScrollbar && _ref5 === _this$state2.showVerticalScrollbar || (_this.setState({
|
|
3480
|
+
scrollbarSize: size,
|
|
3481
|
+
showHorizontalScrollbar: horizontal,
|
|
3482
|
+
showVerticalScrollbar: _ref5
|
|
3483
|
+
}), "function" == typeof (_this$state2 = _this.props.onScrollbarPresenceChange) && _this$state2({
|
|
3484
|
+
horizontal: horizontal,
|
|
3485
|
+
size: size,
|
|
3486
|
+
vertical: _ref5
|
|
3487
|
+
}));
|
|
3488
|
+
}), _defineProperty(_this, "_onScrollLeft", function(scrollInfo) {
|
|
3489
|
+
scrollInfo = scrollInfo.scrollLeft;
|
|
3490
|
+
_this._onScroll({
|
|
3491
|
+
scrollLeft: scrollInfo,
|
|
3492
|
+
scrollTop: _this.state.scrollTop
|
|
3493
|
+
});
|
|
3494
|
+
}), _defineProperty(_this, "_onScrollTop", function(scrollInfo) {
|
|
3495
|
+
scrollInfo = scrollInfo.scrollTop;
|
|
3496
|
+
_this._onScroll({
|
|
3497
|
+
scrollTop: scrollInfo,
|
|
3498
|
+
scrollLeft: _this.state.scrollLeft
|
|
3499
|
+
});
|
|
3500
|
+
}), _defineProperty(_this, "_rowHeightBottomGrid", function(_ref6) {
|
|
3501
|
+
var _ref6 = _ref6.index, _this$props5 = _this.props, fixedRowCount = _this$props5.fixedRowCount, rowHeight = _this$props5.rowHeight, _this$state3 = _this.state, scrollbarSize = _this$state3.scrollbarSize;
|
|
3502
|
+
return _this$state3.showVerticalScrollbar && _ref6 === _this$props5.rowCount - fixedRowCount ? scrollbarSize : "function" == typeof rowHeight ? rowHeight({
|
|
3503
|
+
index: _ref6 + fixedRowCount
|
|
3504
|
+
}) : rowHeight;
|
|
3505
|
+
}), _defineProperty(_this, "_topLeftGridRef", function(ref) {
|
|
3506
|
+
_this._topLeftGrid = ref;
|
|
3507
|
+
}), _defineProperty(_this, "_topRightGridRef", function(ref) {
|
|
3508
|
+
_this._topRightGrid = ref;
|
|
3509
|
+
});
|
|
3510
|
+
var _this, context = props.deferredMeasurementCache, _fixedColumnCount = props.fixedColumnCount, props = props.fixedRowCount;
|
|
3511
|
+
return _this._maybeCalculateCachedStyles(!0), context && (_this._deferredMeasurementCacheBottomLeftGrid = 0 < props ? new CellMeasurerCacheDecorator({
|
|
3512
|
+
cellMeasurerCache: context,
|
|
3513
|
+
columnIndexOffset: 0,
|
|
3514
|
+
rowIndexOffset: props
|
|
3515
|
+
}) : context, _this._deferredMeasurementCacheBottomRightGrid = 0 < _fixedColumnCount || 0 < props ? new CellMeasurerCacheDecorator({
|
|
3516
|
+
cellMeasurerCache: context,
|
|
3517
|
+
columnIndexOffset: _fixedColumnCount,
|
|
3518
|
+
rowIndexOffset: props
|
|
3519
|
+
}) : context, _this._deferredMeasurementCacheTopRightGrid = 0 < _fixedColumnCount ? new CellMeasurerCacheDecorator({
|
|
3520
|
+
cellMeasurerCache: context,
|
|
3521
|
+
columnIndexOffset: _fixedColumnCount,
|
|
3522
|
+
rowIndexOffset: 0
|
|
3523
|
+
}) : context), _this;
|
|
3524
|
+
}
|
|
3525
|
+
return _inherits(MultiGrid, React.PureComponent), _createClass(MultiGrid, [ {
|
|
3526
|
+
key: "forceUpdateGrids",
|
|
3527
|
+
value: function() {
|
|
3528
|
+
this._bottomLeftGrid && this._bottomLeftGrid.forceUpdate(), this._bottomRightGrid && this._bottomRightGrid.forceUpdate(),
|
|
3529
|
+
this._topLeftGrid && this._topLeftGrid.forceUpdate(), this._topRightGrid && this._topRightGrid.forceUpdate();
|
|
3530
|
+
}
|
|
3531
|
+
}, {
|
|
3532
|
+
key: "invalidateCellSizeAfterRender",
|
|
3533
|
+
value: function() {
|
|
3534
|
+
var _ref7 = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, _ref7$columnIndex = _ref7.columnIndex, _ref7$columnIndex = void 0 === _ref7$columnIndex ? 0 : _ref7$columnIndex, _ref7 = _ref7.rowIndex, _ref7 = void 0 === _ref7 ? 0 : _ref7;
|
|
3535
|
+
this._deferredInvalidateColumnIndex = "number" == typeof this._deferredInvalidateColumnIndex ? Math.min(this._deferredInvalidateColumnIndex, _ref7$columnIndex) : _ref7$columnIndex,
|
|
3536
|
+
this._deferredInvalidateRowIndex = "number" == typeof this._deferredInvalidateRowIndex ? Math.min(this._deferredInvalidateRowIndex, _ref7) : _ref7;
|
|
3537
|
+
}
|
|
3538
|
+
}, {
|
|
3539
|
+
key: "measureAllCells",
|
|
3540
|
+
value: function() {
|
|
3541
|
+
this._bottomLeftGrid && this._bottomLeftGrid.measureAllCells(),
|
|
3542
|
+
this._bottomRightGrid && this._bottomRightGrid.measureAllCells(),
|
|
3543
|
+
this._topLeftGrid && this._topLeftGrid.measureAllCells(), this._topRightGrid && this._topRightGrid.measureAllCells();
|
|
3544
|
+
}
|
|
3545
|
+
}, {
|
|
3546
|
+
key: "recomputeGridSize",
|
|
3547
|
+
value: function() {
|
|
3548
|
+
var _ref8 = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, _ref8$columnIndex = _ref8.columnIndex, _ref8$columnIndex = void 0 === _ref8$columnIndex ? 0 : _ref8$columnIndex, _ref8 = _ref8.rowIndex, _ref8 = void 0 === _ref8 ? 0 : _ref8, _this$props6 = this.props, fixedColumnCount = _this$props6.fixedColumnCount, _this$props6 = _this$props6.fixedRowCount, fixedColumnCount = Math.max(0, _ref8$columnIndex - fixedColumnCount), _this$props6 = Math.max(0, _ref8 - _this$props6);
|
|
3549
|
+
this._bottomLeftGrid && this._bottomLeftGrid.recomputeGridSize({
|
|
3550
|
+
columnIndex: _ref8$columnIndex,
|
|
3551
|
+
rowIndex: _this$props6
|
|
3552
|
+
}), this._bottomRightGrid && this._bottomRightGrid.recomputeGridSize({
|
|
3553
|
+
columnIndex: fixedColumnCount,
|
|
3554
|
+
rowIndex: _this$props6
|
|
3555
|
+
}), this._topLeftGrid && this._topLeftGrid.recomputeGridSize({
|
|
3556
|
+
columnIndex: _ref8$columnIndex,
|
|
3557
|
+
rowIndex: _ref8
|
|
3558
|
+
}), this._topRightGrid && this._topRightGrid.recomputeGridSize({
|
|
3559
|
+
columnIndex: fixedColumnCount,
|
|
3560
|
+
rowIndex: _ref8
|
|
3561
|
+
}), this._leftGridWidth = null, this._topGridHeight = null, this._maybeCalculateCachedStyles(!0);
|
|
3562
|
+
}
|
|
3563
|
+
}, {
|
|
3564
|
+
key: "componentDidMount",
|
|
3565
|
+
value: function() {
|
|
3566
|
+
var newState, _this$props7 = this.props, scrollLeft = _this$props7.scrollLeft, _this$props7 = _this$props7.scrollTop;
|
|
3567
|
+
(0 < scrollLeft || 0 < _this$props7) && (newState = {}, 0 < scrollLeft && (newState.scrollLeft = scrollLeft),
|
|
3568
|
+
0 < _this$props7 && (newState.scrollTop = _this$props7), this.setState(newState)),
|
|
3569
|
+
this._handleInvalidatedGridSize();
|
|
3570
|
+
}
|
|
3571
|
+
}, {
|
|
3572
|
+
key: "componentDidUpdate",
|
|
3573
|
+
value: function() {
|
|
3574
|
+
this._handleInvalidatedGridSize();
|
|
3575
|
+
}
|
|
3576
|
+
}, {
|
|
3577
|
+
key: "render",
|
|
3578
|
+
value: function() {
|
|
3579
|
+
var scrollLeft, _this$state4, _this$props8 = this.props, onScroll = _this$props8.onScroll, onSectionRendered = _this$props8.onSectionRendered, scrollToColumn = _this$props8.scrollToColumn, scrollToRow = _this$props8.scrollToRow, _this$props8 = _objectWithoutProperties(_this$props8, _excluded4);
|
|
3580
|
+
return this._prepareForRender(), 0 === this.props.width || 0 === this.props.height ? null : (scrollLeft = (_this$state4 = this.state).scrollLeft,
|
|
3581
|
+
_this$state4 = _this$state4.scrollTop, React.createElement("div", {
|
|
3582
|
+
style: this._containerOuterStyle
|
|
3583
|
+
}, React.createElement("div", {
|
|
3584
|
+
style: this._containerTopStyle
|
|
3585
|
+
}, this._renderTopLeftGrid(_this$props8), this._renderTopRightGrid(_objectSpread2(_objectSpread2({}, _this$props8), {}, {
|
|
3586
|
+
onScroll: onScroll,
|
|
3587
|
+
scrollLeft: scrollLeft
|
|
3588
|
+
}))), React.createElement("div", {
|
|
3589
|
+
style: this._containerBottomStyle
|
|
3590
|
+
}, this._renderBottomLeftGrid(_objectSpread2(_objectSpread2({}, _this$props8), {}, {
|
|
3591
|
+
onScroll: onScroll,
|
|
3592
|
+
scrollTop: _this$state4
|
|
3593
|
+
})), this._renderBottomRightGrid(_objectSpread2(_objectSpread2({}, _this$props8), {}, {
|
|
3594
|
+
onScroll: onScroll,
|
|
3595
|
+
onSectionRendered: onSectionRendered,
|
|
3596
|
+
scrollLeft: scrollLeft,
|
|
3597
|
+
scrollToColumn: scrollToColumn,
|
|
3598
|
+
scrollToRow: scrollToRow,
|
|
3599
|
+
scrollTop: _this$state4
|
|
3600
|
+
})))));
|
|
3601
|
+
}
|
|
3602
|
+
}, {
|
|
3603
|
+
key: "_getBottomGridHeight",
|
|
3604
|
+
value: function(props) {
|
|
3605
|
+
return props.height - this._getTopGridHeight(props);
|
|
3606
|
+
}
|
|
3607
|
+
}, {
|
|
3608
|
+
key: "_getLeftGridWidth",
|
|
3609
|
+
value: function(props) {
|
|
3610
|
+
var fixedColumnCount = props.fixedColumnCount, columnWidth = props.columnWidth;
|
|
3611
|
+
if (null == this._leftGridWidth) if ("function" == typeof columnWidth) {
|
|
3612
|
+
for (var leftGridWidth = 0, index = 0; index < fixedColumnCount; index++) leftGridWidth += columnWidth({
|
|
3613
|
+
index: index
|
|
3614
|
+
});
|
|
3615
|
+
this._leftGridWidth = leftGridWidth;
|
|
3616
|
+
} else this._leftGridWidth = columnWidth * fixedColumnCount;
|
|
3617
|
+
return this._leftGridWidth;
|
|
3618
|
+
}
|
|
3619
|
+
}, {
|
|
3620
|
+
key: "_getRightGridWidth",
|
|
3621
|
+
value: function(props) {
|
|
3622
|
+
return props.width - this._getLeftGridWidth(props);
|
|
3623
|
+
}
|
|
3624
|
+
}, {
|
|
3625
|
+
key: "_getTopGridHeight",
|
|
3626
|
+
value: function(props) {
|
|
3627
|
+
var fixedRowCount = props.fixedRowCount, rowHeight = props.rowHeight;
|
|
3628
|
+
if (null == this._topGridHeight) if ("function" == typeof rowHeight) {
|
|
3629
|
+
for (var topGridHeight = 0, index = 0; index < fixedRowCount; index++) topGridHeight += rowHeight({
|
|
3630
|
+
index: index
|
|
3631
|
+
});
|
|
3632
|
+
this._topGridHeight = topGridHeight;
|
|
3633
|
+
} else this._topGridHeight = rowHeight * fixedRowCount;
|
|
3634
|
+
return this._topGridHeight;
|
|
3635
|
+
}
|
|
3636
|
+
}, {
|
|
3637
|
+
key: "_handleInvalidatedGridSize",
|
|
3638
|
+
value: function() {
|
|
3639
|
+
var columnIndex, rowIndex;
|
|
3640
|
+
"number" == typeof this._deferredInvalidateColumnIndex && (columnIndex = this._deferredInvalidateColumnIndex,
|
|
3641
|
+
rowIndex = this._deferredInvalidateRowIndex, this._deferredInvalidateColumnIndex = null,
|
|
3642
|
+
this._deferredInvalidateRowIndex = null, this.recomputeGridSize({
|
|
3643
|
+
columnIndex: columnIndex,
|
|
3644
|
+
rowIndex: rowIndex
|
|
3645
|
+
}), this.forceUpdate());
|
|
3646
|
+
}
|
|
3647
|
+
}, {
|
|
3648
|
+
key: "_maybeCalculateCachedStyles",
|
|
3649
|
+
value: function(resetAll) {
|
|
3650
|
+
var _this$props9 = this.props, columnWidth = _this$props9.columnWidth, enableFixedColumnScroll = _this$props9.enableFixedColumnScroll, enableFixedRowScroll = _this$props9.enableFixedRowScroll, height = _this$props9.height, fixedColumnCount = _this$props9.fixedColumnCount, fixedRowCount = _this$props9.fixedRowCount, rowHeight = _this$props9.rowHeight, style = _this$props9.style, styleBottomLeftGrid = _this$props9.styleBottomLeftGrid, styleBottomRightGrid = _this$props9.styleBottomRightGrid, styleTopLeftGrid = _this$props9.styleTopLeftGrid, styleTopRightGrid = _this$props9.styleTopRightGrid, _this$props9 = _this$props9.width, sizeChange = resetAll || height !== this._lastRenderedHeight || _this$props9 !== this._lastRenderedWidth, leftSizeChange = resetAll || columnWidth !== this._lastRenderedColumnWidth || fixedColumnCount !== this._lastRenderedFixedColumnCount, topSizeChange = resetAll || fixedRowCount !== this._lastRenderedFixedRowCount || rowHeight !== this._lastRenderedRowHeight;
|
|
3651
|
+
(resetAll || sizeChange || style !== this._lastRenderedStyle) && (this._containerOuterStyle = _objectSpread2({
|
|
3652
|
+
height: height,
|
|
3653
|
+
overflow: "visible",
|
|
3654
|
+
width: _this$props9
|
|
3655
|
+
}, style)), (resetAll || sizeChange || topSizeChange) && (this._containerTopStyle = {
|
|
3656
|
+
height: this._getTopGridHeight(this.props),
|
|
3657
|
+
position: "relative",
|
|
3658
|
+
width: _this$props9
|
|
3659
|
+
}, this._containerBottomStyle = {
|
|
3660
|
+
height: height - this._getTopGridHeight(this.props),
|
|
3661
|
+
overflow: "visible",
|
|
3662
|
+
position: "relative",
|
|
3663
|
+
width: _this$props9
|
|
3664
|
+
}), !resetAll && styleBottomLeftGrid === this._lastRenderedStyleBottomLeftGrid || (this._bottomLeftGridStyle = _objectSpread2({
|
|
3665
|
+
left: 0,
|
|
3666
|
+
overflowX: "hidden",
|
|
3667
|
+
overflowY: enableFixedColumnScroll ? "auto" : "hidden",
|
|
3668
|
+
position: "absolute"
|
|
3669
|
+
}, styleBottomLeftGrid)), (resetAll || leftSizeChange || styleBottomRightGrid !== this._lastRenderedStyleBottomRightGrid) && (this._bottomRightGridStyle = _objectSpread2({
|
|
3670
|
+
left: this._getLeftGridWidth(this.props),
|
|
3671
|
+
position: "absolute"
|
|
3672
|
+
}, styleBottomRightGrid)), !resetAll && styleTopLeftGrid === this._lastRenderedStyleTopLeftGrid || (this._topLeftGridStyle = _objectSpread2({
|
|
3673
|
+
left: 0,
|
|
3674
|
+
overflowX: "hidden",
|
|
3675
|
+
overflowY: "hidden",
|
|
3676
|
+
position: "absolute",
|
|
3677
|
+
top: 0
|
|
3678
|
+
}, styleTopLeftGrid)), (resetAll || leftSizeChange || styleTopRightGrid !== this._lastRenderedStyleTopRightGrid) && (this._topRightGridStyle = _objectSpread2({
|
|
3679
|
+
left: this._getLeftGridWidth(this.props),
|
|
3680
|
+
overflowX: enableFixedRowScroll ? "auto" : "hidden",
|
|
3681
|
+
overflowY: "hidden",
|
|
3682
|
+
position: "absolute",
|
|
3683
|
+
top: 0
|
|
3684
|
+
}, styleTopRightGrid)), this._lastRenderedColumnWidth = columnWidth,
|
|
3685
|
+
this._lastRenderedFixedColumnCount = fixedColumnCount, this._lastRenderedFixedRowCount = fixedRowCount,
|
|
3686
|
+
this._lastRenderedHeight = height, this._lastRenderedRowHeight = rowHeight,
|
|
3687
|
+
this._lastRenderedStyle = style, this._lastRenderedStyleBottomLeftGrid = styleBottomLeftGrid,
|
|
3688
|
+
this._lastRenderedStyleBottomRightGrid = styleBottomRightGrid, this._lastRenderedStyleTopLeftGrid = styleTopLeftGrid,
|
|
3689
|
+
this._lastRenderedStyleTopRightGrid = styleTopRightGrid, this._lastRenderedWidth = _this$props9;
|
|
3690
|
+
}
|
|
3691
|
+
}, {
|
|
3692
|
+
key: "_prepareForRender",
|
|
3693
|
+
value: function() {
|
|
3694
|
+
this._lastRenderedColumnWidth === this.props.columnWidth && this._lastRenderedFixedColumnCount === this.props.fixedColumnCount || (this._leftGridWidth = null),
|
|
3695
|
+
this._lastRenderedFixedRowCount === this.props.fixedRowCount && this._lastRenderedRowHeight === this.props.rowHeight || (this._topGridHeight = null),
|
|
3696
|
+
this._maybeCalculateCachedStyles(), this._lastRenderedColumnWidth = this.props.columnWidth,
|
|
3697
|
+
this._lastRenderedFixedColumnCount = this.props.fixedColumnCount,
|
|
3698
|
+
this._lastRenderedFixedRowCount = this.props.fixedRowCount, this._lastRenderedRowHeight = this.props.rowHeight;
|
|
3699
|
+
}
|
|
3700
|
+
}, {
|
|
3701
|
+
key: "_renderBottomLeftGrid",
|
|
3702
|
+
value: function(props) {
|
|
3703
|
+
var height, width, scrollbarSize, enableFixedColumnScroll = props.enableFixedColumnScroll, fixedColumnCount = props.fixedColumnCount, fixedRowCount = props.fixedRowCount, rowCount = props.rowCount, hideBottomLeftGridScrollbar = props.hideBottomLeftGridScrollbar, showVerticalScrollbar = this.state.showVerticalScrollbar;
|
|
3704
|
+
return fixedColumnCount ? (showVerticalScrollbar = showVerticalScrollbar ? 1 : 0,
|
|
3705
|
+
height = this._getBottomGridHeight(props), width = this._getLeftGridWidth(props),
|
|
3706
|
+
scrollbarSize = this.state.showVerticalScrollbar ? this.state.scrollbarSize : 0,
|
|
3707
|
+
scrollbarSize = hideBottomLeftGridScrollbar ? width + scrollbarSize : width,
|
|
3708
|
+
props = React.createElement(Grid, _extends({}, props, {
|
|
3709
|
+
cellRenderer: this._cellRendererBottomLeftGrid,
|
|
3710
|
+
className: this.props.classNameBottomLeftGrid,
|
|
3711
|
+
columnCount: fixedColumnCount,
|
|
3712
|
+
deferredMeasurementCache: this._deferredMeasurementCacheBottomLeftGrid,
|
|
3713
|
+
height: height,
|
|
3714
|
+
onScroll: enableFixedColumnScroll ? this._onScrollTop : void 0,
|
|
3715
|
+
ref: this._bottomLeftGridRef,
|
|
3716
|
+
rowCount: Math.max(0, rowCount - fixedRowCount) + showVerticalScrollbar,
|
|
3717
|
+
rowHeight: this._rowHeightBottomGrid,
|
|
3718
|
+
style: this._bottomLeftGridStyle,
|
|
3719
|
+
tabIndex: null,
|
|
3720
|
+
width: scrollbarSize
|
|
3721
|
+
})), hideBottomLeftGridScrollbar ? React.createElement("div", {
|
|
3722
|
+
className: "BottomLeftGrid_ScrollWrapper",
|
|
3723
|
+
style: _objectSpread2(_objectSpread2({}, this._bottomLeftGridStyle), {}, {
|
|
3724
|
+
height: height,
|
|
3725
|
+
width: width,
|
|
3726
|
+
overflowY: "hidden"
|
|
3727
|
+
})
|
|
3728
|
+
}, props) : props) : null;
|
|
3729
|
+
}
|
|
3730
|
+
}, {
|
|
3731
|
+
key: "_renderBottomRightGrid",
|
|
3732
|
+
value: function(props) {
|
|
3733
|
+
var columnCount = props.columnCount, fixedColumnCount = props.fixedColumnCount, fixedRowCount = props.fixedRowCount, rowCount = props.rowCount, scrollToColumn = props.scrollToColumn, scrollToRow = props.scrollToRow;
|
|
3734
|
+
return React.createElement(Grid, _extends({}, props, {
|
|
3735
|
+
cellRenderer: this._cellRendererBottomRightGrid,
|
|
3736
|
+
className: this.props.classNameBottomRightGrid,
|
|
3737
|
+
columnCount: Math.max(0, columnCount - fixedColumnCount),
|
|
3738
|
+
columnWidth: this._columnWidthRightGrid,
|
|
3739
|
+
deferredMeasurementCache: this._deferredMeasurementCacheBottomRightGrid,
|
|
3740
|
+
height: this._getBottomGridHeight(props),
|
|
3741
|
+
onScroll: this._onScroll,
|
|
3742
|
+
onScrollbarPresenceChange: this._onScrollbarPresenceChange,
|
|
3743
|
+
ref: this._bottomRightGridRef,
|
|
3744
|
+
rowCount: Math.max(0, rowCount - fixedRowCount),
|
|
3745
|
+
rowHeight: this._rowHeightBottomGrid,
|
|
3746
|
+
scrollToColumn: scrollToColumn - fixedColumnCount,
|
|
3747
|
+
scrollToRow: scrollToRow - fixedRowCount,
|
|
3748
|
+
style: this._bottomRightGridStyle,
|
|
3749
|
+
width: this._getRightGridWidth(props)
|
|
3750
|
+
}));
|
|
3751
|
+
}
|
|
3752
|
+
}, {
|
|
3753
|
+
key: "_renderTopLeftGrid",
|
|
3754
|
+
value: function(props) {
|
|
3755
|
+
var fixedColumnCount = props.fixedColumnCount, fixedRowCount = props.fixedRowCount;
|
|
3756
|
+
return fixedColumnCount && fixedRowCount ? React.createElement(Grid, _extends({}, props, {
|
|
3757
|
+
className: this.props.classNameTopLeftGrid,
|
|
3758
|
+
columnCount: fixedColumnCount,
|
|
3759
|
+
height: this._getTopGridHeight(props),
|
|
3760
|
+
ref: this._topLeftGridRef,
|
|
3761
|
+
rowCount: fixedRowCount,
|
|
3762
|
+
style: this._topLeftGridStyle,
|
|
3763
|
+
tabIndex: null,
|
|
3764
|
+
width: this._getLeftGridWidth(props)
|
|
3765
|
+
})) : null;
|
|
3766
|
+
}
|
|
3767
|
+
}, {
|
|
3768
|
+
key: "_renderTopRightGrid",
|
|
3769
|
+
value: function(props) {
|
|
3770
|
+
var additionalColumnCount, height, width, gridHeight, style, columnCount = props.columnCount, enableFixedRowScroll = props.enableFixedRowScroll, fixedColumnCount = props.fixedColumnCount, fixedRowCount = props.fixedRowCount, scrollLeft = props.scrollLeft, hideTopRightGridScrollbar = props.hideTopRightGridScrollbar, _this$state5 = this.state, showHorizontalScrollbar = _this$state5.showHorizontalScrollbar, _this$state5 = _this$state5.scrollbarSize;
|
|
3771
|
+
return fixedRowCount ? (additionalColumnCount = showHorizontalScrollbar ? 1 : 0,
|
|
3772
|
+
height = this._getTopGridHeight(props), width = this._getRightGridWidth(props),
|
|
3773
|
+
gridHeight = height, style = this._topRightGridStyle, hideTopRightGridScrollbar && (gridHeight = height + (showHorizontalScrollbar ? _this$state5 : 0),
|
|
3774
|
+
style = _objectSpread2(_objectSpread2({}, this._topRightGridStyle), {}, {
|
|
3775
|
+
left: 0
|
|
3776
|
+
})), showHorizontalScrollbar = React.createElement(Grid, _extends({}, props, {
|
|
3777
|
+
cellRenderer: this._cellRendererTopRightGrid,
|
|
3778
|
+
className: this.props.classNameTopRightGrid,
|
|
3779
|
+
columnCount: Math.max(0, columnCount - fixedColumnCount) + additionalColumnCount,
|
|
3780
|
+
columnWidth: this._columnWidthRightGrid,
|
|
3781
|
+
deferredMeasurementCache: this._deferredMeasurementCacheTopRightGrid,
|
|
3782
|
+
height: gridHeight,
|
|
3783
|
+
onScroll: enableFixedRowScroll ? this._onScrollLeft : void 0,
|
|
3784
|
+
ref: this._topRightGridRef,
|
|
3785
|
+
rowCount: fixedRowCount,
|
|
3786
|
+
scrollLeft: scrollLeft,
|
|
3787
|
+
style: style,
|
|
3788
|
+
tabIndex: null,
|
|
3789
|
+
width: width
|
|
3790
|
+
})), hideTopRightGridScrollbar ? React.createElement("div", {
|
|
3791
|
+
className: "TopRightGrid_ScrollWrapper",
|
|
3792
|
+
style: _objectSpread2(_objectSpread2({}, this._topRightGridStyle), {}, {
|
|
3793
|
+
height: height,
|
|
3794
|
+
width: width,
|
|
3795
|
+
overflowX: "hidden"
|
|
3796
|
+
})
|
|
3797
|
+
}, showHorizontalScrollbar) : showHorizontalScrollbar) : null;
|
|
3798
|
+
}
|
|
3799
|
+
} ], [ {
|
|
3800
|
+
key: "getDerivedStateFromProps",
|
|
3801
|
+
value: function(nextProps, prevState) {
|
|
3802
|
+
return nextProps.scrollLeft !== prevState.scrollLeft || nextProps.scrollTop !== prevState.scrollTop ? {
|
|
3803
|
+
scrollLeft: (null != nextProps.scrollLeft && 0 <= nextProps.scrollLeft ? nextProps : prevState).scrollLeft,
|
|
3804
|
+
scrollTop: (null != nextProps.scrollTop && 0 <= nextProps.scrollTop ? nextProps : prevState).scrollTop
|
|
3805
|
+
} : null;
|
|
3806
|
+
}
|
|
3807
|
+
} ]);
|
|
3808
|
+
})(), ScrollSync = (_defineProperty(MultiGrid, "propTypes", {
|
|
3809
|
+
classNameBottomLeftGrid: propTypes.string.isRequired,
|
|
3810
|
+
classNameBottomRightGrid: propTypes.string.isRequired,
|
|
3811
|
+
classNameTopLeftGrid: propTypes.string.isRequired,
|
|
3812
|
+
classNameTopRightGrid: propTypes.string.isRequired,
|
|
3813
|
+
enableFixedColumnScroll: propTypes.bool.isRequired,
|
|
3814
|
+
enableFixedRowScroll: propTypes.bool.isRequired,
|
|
3815
|
+
fixedColumnCount: propTypes.number.isRequired,
|
|
3816
|
+
fixedRowCount: propTypes.number.isRequired,
|
|
3817
|
+
onScrollbarPresenceChange: propTypes.func,
|
|
3818
|
+
style: propTypes.object.isRequired,
|
|
3819
|
+
styleBottomLeftGrid: propTypes.object.isRequired,
|
|
3820
|
+
styleBottomRightGrid: propTypes.object.isRequired,
|
|
3821
|
+
styleTopLeftGrid: propTypes.object.isRequired,
|
|
3822
|
+
styleTopRightGrid: propTypes.object.isRequired,
|
|
3823
|
+
hideTopRightGridScrollbar: propTypes.bool,
|
|
3824
|
+
hideBottomLeftGridScrollbar: propTypes.bool
|
|
3825
|
+
}), _defineProperty(MultiGrid, "defaultProps", {
|
|
3826
|
+
classNameBottomLeftGrid: "",
|
|
3827
|
+
classNameBottomRightGrid: "",
|
|
3828
|
+
classNameTopLeftGrid: "",
|
|
3829
|
+
classNameTopRightGrid: "",
|
|
3830
|
+
enableFixedColumnScroll: !1,
|
|
3831
|
+
enableFixedRowScroll: !1,
|
|
3832
|
+
fixedColumnCount: 0,
|
|
3833
|
+
fixedRowCount: 0,
|
|
3834
|
+
scrollToColumn: -1,
|
|
3835
|
+
scrollToRow: -1,
|
|
3836
|
+
style: {},
|
|
3837
|
+
styleBottomLeftGrid: {},
|
|
3838
|
+
styleBottomRightGrid: {},
|
|
3839
|
+
styleTopLeftGrid: {},
|
|
3840
|
+
styleTopRightGrid: {},
|
|
3841
|
+
hideTopRightGridScrollbar: !1,
|
|
3842
|
+
hideBottomLeftGridScrollbar: !1
|
|
3843
|
+
}), polyfill(MultiGrid), (() => {
|
|
3844
|
+
function ScrollSync(props, context) {
|
|
3845
|
+
return _classCallCheck(this, ScrollSync), (props = _callSuper(this, ScrollSync, [ props, context ])).state = {
|
|
3846
|
+
clientHeight: 0,
|
|
3847
|
+
clientWidth: 0,
|
|
3848
|
+
scrollHeight: 0,
|
|
3849
|
+
scrollLeft: 0,
|
|
3850
|
+
scrollTop: 0,
|
|
3851
|
+
scrollWidth: 0
|
|
3852
|
+
}, props._onScroll = props._onScroll.bind(props), props;
|
|
3853
|
+
}
|
|
3854
|
+
return _inherits(ScrollSync, React.PureComponent), _createClass(ScrollSync, [ {
|
|
3855
|
+
key: "render",
|
|
3856
|
+
value: function() {
|
|
3857
|
+
var children = this.props.children, _this$state = this.state;
|
|
3858
|
+
return children({
|
|
3859
|
+
clientHeight: _this$state.clientHeight,
|
|
3860
|
+
clientWidth: _this$state.clientWidth,
|
|
3861
|
+
onScroll: this._onScroll,
|
|
3862
|
+
scrollHeight: _this$state.scrollHeight,
|
|
3863
|
+
scrollLeft: _this$state.scrollLeft,
|
|
3864
|
+
scrollTop: _this$state.scrollTop,
|
|
3865
|
+
scrollWidth: _this$state.scrollWidth
|
|
3866
|
+
});
|
|
3867
|
+
}
|
|
3868
|
+
}, {
|
|
3869
|
+
key: "_onScroll",
|
|
3870
|
+
value: function(_ref) {
|
|
3871
|
+
var clientHeight = _ref.clientHeight;
|
|
3872
|
+
this.setState({
|
|
3873
|
+
clientHeight: clientHeight,
|
|
3874
|
+
clientWidth: _ref.clientWidth,
|
|
3875
|
+
scrollHeight: _ref.scrollHeight,
|
|
3876
|
+
scrollLeft: _ref.scrollLeft,
|
|
3877
|
+
scrollTop: _ref.scrollTop,
|
|
3878
|
+
scrollWidth: _ref.scrollWidth
|
|
3879
|
+
});
|
|
3880
|
+
}
|
|
3881
|
+
} ]);
|
|
3882
|
+
})());
|
|
3883
|
+
function defaultCellDataGetter(_ref) {
|
|
3884
|
+
var dataKey = _ref.dataKey, _ref = _ref.rowData;
|
|
3885
|
+
return "function" == typeof _ref.get ? _ref.get(dataKey) : _ref[dataKey];
|
|
3886
|
+
}
|
|
3887
|
+
function defaultCellRenderer(_ref) {
|
|
3888
|
+
_ref = _ref.cellData;
|
|
3889
|
+
return null == _ref ? "" : String(_ref);
|
|
3890
|
+
}
|
|
3891
|
+
function defaultHeaderRowRenderer(_ref) {
|
|
3892
|
+
var className = _ref.className;
|
|
3893
|
+
return React.createElement("div", {
|
|
3894
|
+
className: className,
|
|
3895
|
+
role: "row",
|
|
3896
|
+
style: _ref.style
|
|
3897
|
+
}, _ref.columns);
|
|
3898
|
+
}
|
|
3899
|
+
_defineProperty(ScrollSync, "propTypes", {
|
|
3900
|
+
children: propTypes.func.isRequired
|
|
3901
|
+
});
|
|
3902
|
+
var SortDirection = {
|
|
3903
|
+
ASC: "ASC",
|
|
3904
|
+
DESC: "DESC"
|
|
3905
|
+
};
|
|
3906
|
+
function SortIndicator(_ref) {
|
|
3907
|
+
var _ref = _ref.sortDirection, classNames = clsx("ReactVirtualized__Table__sortableHeaderIcon", {
|
|
3908
|
+
"ReactVirtualized__Table__sortableHeaderIcon--ASC": _ref === SortDirection.ASC,
|
|
3909
|
+
"ReactVirtualized__Table__sortableHeaderIcon--DESC": _ref === SortDirection.DESC
|
|
3910
|
+
});
|
|
3911
|
+
return React.createElement("svg", {
|
|
3912
|
+
className: classNames,
|
|
3913
|
+
width: 18,
|
|
3914
|
+
height: 18,
|
|
3915
|
+
viewBox: "0 0 24 24"
|
|
3916
|
+
}, _ref === SortDirection.ASC ? React.createElement("path", {
|
|
3917
|
+
d: "M7 14l5-5 5 5z"
|
|
3918
|
+
}) : React.createElement("path", {
|
|
3919
|
+
d: "M7 10l5 5 5-5z"
|
|
3920
|
+
}), React.createElement("path", {
|
|
3921
|
+
d: "M0 0h24v24H0z",
|
|
3922
|
+
fill: "none"
|
|
3923
|
+
}));
|
|
3924
|
+
}
|
|
3925
|
+
function defaultHeaderRenderer(_ref) {
|
|
3926
|
+
var dataKey = _ref.dataKey, label = _ref.label, sortDirection = _ref.sortDirection, _ref = _ref.sortBy === dataKey, dataKey = [ React.createElement("span", {
|
|
3927
|
+
className: "ReactVirtualized__Table__headerTruncatedText",
|
|
3928
|
+
key: "label",
|
|
3929
|
+
title: "string" == typeof label ? label : null
|
|
3930
|
+
}, label) ];
|
|
3931
|
+
return _ref && dataKey.push(React.createElement(SortIndicator, {
|
|
3932
|
+
key: "SortIndicator",
|
|
3933
|
+
sortDirection: sortDirection
|
|
3934
|
+
})), dataKey;
|
|
3935
|
+
}
|
|
3936
|
+
function defaultRowRenderer(_ref) {
|
|
3937
|
+
var className = _ref.className, columns = _ref.columns, index = _ref.index, key = _ref.key, onRowClick = _ref.onRowClick, onRowDoubleClick = _ref.onRowDoubleClick, onRowMouseOut = _ref.onRowMouseOut, onRowMouseOver = _ref.onRowMouseOver, onRowRightClick = _ref.onRowRightClick, rowData = _ref.rowData, _ref = _ref.style, a11yProps = {
|
|
3938
|
+
"aria-rowindex": index + 1
|
|
3939
|
+
};
|
|
3940
|
+
return (onRowClick || onRowDoubleClick || onRowMouseOut || onRowMouseOver || onRowRightClick) && (a11yProps["aria-label"] = "row",
|
|
3941
|
+
a11yProps.tabIndex = 0, onRowClick && (a11yProps.onClick = function(event) {
|
|
3942
|
+
return onRowClick({
|
|
3943
|
+
event: event,
|
|
3944
|
+
index: index,
|
|
3945
|
+
rowData: rowData
|
|
3946
|
+
});
|
|
3947
|
+
}), onRowDoubleClick && (a11yProps.onDoubleClick = function(event) {
|
|
3948
|
+
return onRowDoubleClick({
|
|
3949
|
+
event: event,
|
|
3950
|
+
index: index,
|
|
3951
|
+
rowData: rowData
|
|
3952
|
+
});
|
|
3953
|
+
}), onRowMouseOut && (a11yProps.onMouseOut = function(event) {
|
|
3954
|
+
return onRowMouseOut({
|
|
3955
|
+
event: event,
|
|
3956
|
+
index: index,
|
|
3957
|
+
rowData: rowData
|
|
3958
|
+
});
|
|
3959
|
+
}), onRowMouseOver && (a11yProps.onMouseOver = function(event) {
|
|
3960
|
+
return onRowMouseOver({
|
|
3961
|
+
event: event,
|
|
3962
|
+
index: index,
|
|
3963
|
+
rowData: rowData
|
|
3964
|
+
});
|
|
3965
|
+
}), onRowRightClick) && (a11yProps.onContextMenu = function(event) {
|
|
3966
|
+
return onRowRightClick({
|
|
3967
|
+
event: event,
|
|
3968
|
+
index: index,
|
|
3969
|
+
rowData: rowData
|
|
3970
|
+
});
|
|
3971
|
+
}), React.createElement("div", _extends({}, a11yProps, {
|
|
3972
|
+
className: className,
|
|
3973
|
+
key: key,
|
|
3974
|
+
role: "row",
|
|
3975
|
+
style: _ref
|
|
3976
|
+
}), columns);
|
|
3977
|
+
}
|
|
3978
|
+
SortIndicator.propTypes = {
|
|
3979
|
+
sortDirection: propTypes.oneOf([ SortDirection.ASC, SortDirection.DESC ])
|
|
3980
|
+
};
|
|
3981
|
+
var Column = (() => {
|
|
3982
|
+
function Column() {
|
|
3983
|
+
return _classCallCheck(this, Column), _callSuper(this, Column, arguments);
|
|
3984
|
+
}
|
|
3985
|
+
return _inherits(Column, React.Component), _createClass(Column);
|
|
3986
|
+
})(), Table = (_defineProperty(Column, "propTypes", {
|
|
3987
|
+
"aria-label": propTypes.string,
|
|
3988
|
+
cellDataGetter: propTypes.func,
|
|
3989
|
+
cellRenderer: propTypes.func,
|
|
3990
|
+
className: propTypes.string,
|
|
3991
|
+
columnData: propTypes.object,
|
|
3992
|
+
dataKey: propTypes.any.isRequired,
|
|
3993
|
+
defaultSortDirection: propTypes.oneOf([ SortDirection.ASC, SortDirection.DESC ]),
|
|
3994
|
+
disableSort: propTypes.bool,
|
|
3995
|
+
flexGrow: propTypes.number,
|
|
3996
|
+
flexShrink: propTypes.number,
|
|
3997
|
+
headerClassName: propTypes.string,
|
|
3998
|
+
headerRenderer: propTypes.func.isRequired,
|
|
3999
|
+
headerStyle: propTypes.object,
|
|
4000
|
+
id: propTypes.string,
|
|
4001
|
+
label: propTypes.node,
|
|
4002
|
+
maxWidth: propTypes.number,
|
|
4003
|
+
minWidth: propTypes.number,
|
|
4004
|
+
style: propTypes.object,
|
|
4005
|
+
width: propTypes.number.isRequired
|
|
4006
|
+
}), _defineProperty(Column, "defaultProps", {
|
|
4007
|
+
cellDataGetter: defaultCellDataGetter,
|
|
4008
|
+
cellRenderer: defaultCellRenderer,
|
|
4009
|
+
defaultSortDirection: SortDirection.ASC,
|
|
4010
|
+
flexGrow: 0,
|
|
4011
|
+
flexShrink: 1,
|
|
4012
|
+
headerRenderer: defaultHeaderRenderer,
|
|
4013
|
+
style: {}
|
|
4014
|
+
}), (() => {
|
|
4015
|
+
function Table(props) {
|
|
4016
|
+
return _classCallCheck(this, Table), (props = _callSuper(this, Table, [ props ])).state = {
|
|
4017
|
+
scrollbarWidth: 0
|
|
4018
|
+
}, props._createColumn = props._createColumn.bind(props), props._createRow = props._createRow.bind(props),
|
|
4019
|
+
props._onScroll = props._onScroll.bind(props), props._onSectionRendered = props._onSectionRendered.bind(props),
|
|
4020
|
+
props._setRef = props._setRef.bind(props), props._setGridElementRef = props._setGridElementRef.bind(props),
|
|
4021
|
+
props;
|
|
4022
|
+
}
|
|
4023
|
+
return _inherits(Table, React.PureComponent), _createClass(Table, [ {
|
|
4024
|
+
key: "forceUpdateGrid",
|
|
4025
|
+
value: function() {
|
|
4026
|
+
this.Grid && this.Grid.forceUpdate();
|
|
4027
|
+
}
|
|
4028
|
+
}, {
|
|
4029
|
+
key: "getOffsetForRow",
|
|
4030
|
+
value: function(_ref) {
|
|
4031
|
+
var alignment = _ref.alignment;
|
|
4032
|
+
return this.Grid ? this.Grid.getOffsetForCell({
|
|
4033
|
+
alignment: alignment,
|
|
4034
|
+
rowIndex: _ref.index
|
|
4035
|
+
}).scrollTop : 0;
|
|
4036
|
+
}
|
|
4037
|
+
}, {
|
|
4038
|
+
key: "invalidateCellSizeAfterRender",
|
|
4039
|
+
value: function(_ref2) {
|
|
4040
|
+
var columnIndex = _ref2.columnIndex;
|
|
4041
|
+
this.Grid && this.Grid.invalidateCellSizeAfterRender({
|
|
4042
|
+
rowIndex: _ref2.rowIndex,
|
|
4043
|
+
columnIndex: columnIndex
|
|
4044
|
+
});
|
|
4045
|
+
}
|
|
4046
|
+
}, {
|
|
4047
|
+
key: "measureAllRows",
|
|
4048
|
+
value: function() {
|
|
4049
|
+
this.Grid && this.Grid.measureAllCells();
|
|
4050
|
+
}
|
|
4051
|
+
}, {
|
|
4052
|
+
key: "recomputeGridSize",
|
|
4053
|
+
value: function() {
|
|
4054
|
+
var _ref3 = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, _ref3$columnIndex = _ref3.columnIndex, _ref3 = _ref3.rowIndex;
|
|
4055
|
+
this.Grid && this.Grid.recomputeGridSize({
|
|
4056
|
+
rowIndex: void 0 === _ref3 ? 0 : _ref3,
|
|
4057
|
+
columnIndex: void 0 === _ref3$columnIndex ? 0 : _ref3$columnIndex
|
|
4058
|
+
});
|
|
4059
|
+
}
|
|
4060
|
+
}, {
|
|
4061
|
+
key: "recomputeRowHeights",
|
|
4062
|
+
value: function() {
|
|
4063
|
+
this.Grid && this.Grid.recomputeGridSize({
|
|
4064
|
+
rowIndex: 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0
|
|
4065
|
+
});
|
|
4066
|
+
}
|
|
4067
|
+
}, {
|
|
4068
|
+
key: "scrollToPosition",
|
|
4069
|
+
value: function() {
|
|
4070
|
+
this.Grid && this.Grid.scrollToPosition({
|
|
4071
|
+
scrollTop: 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0
|
|
4072
|
+
});
|
|
4073
|
+
}
|
|
4074
|
+
}, {
|
|
4075
|
+
key: "scrollToRow",
|
|
4076
|
+
value: function() {
|
|
4077
|
+
this.Grid && this.Grid.scrollToCell({
|
|
4078
|
+
columnIndex: 0,
|
|
4079
|
+
rowIndex: 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0
|
|
4080
|
+
});
|
|
4081
|
+
}
|
|
4082
|
+
}, {
|
|
4083
|
+
key: "getScrollbarWidth",
|
|
4084
|
+
value: function() {
|
|
4085
|
+
var _Grid, clientWidth;
|
|
4086
|
+
return this.GridElement ? (clientWidth = (_Grid = this.GridElement).clientWidth || 0,
|
|
4087
|
+
(_Grid.offsetWidth || 0) - clientWidth) : 0;
|
|
4088
|
+
}
|
|
4089
|
+
}, {
|
|
4090
|
+
key: "componentDidMount",
|
|
4091
|
+
value: function() {
|
|
4092
|
+
this._setScrollbarWidth();
|
|
4093
|
+
}
|
|
4094
|
+
}, {
|
|
4095
|
+
key: "componentDidUpdate",
|
|
4096
|
+
value: function() {
|
|
4097
|
+
this._setScrollbarWidth();
|
|
4098
|
+
}
|
|
4099
|
+
}, {
|
|
4100
|
+
key: "render",
|
|
4101
|
+
value: function() {
|
|
4102
|
+
var _this2 = this, _this$props = this.props, children = _this$props.children, className = _this$props.className, disableHeader = _this$props.disableHeader, gridClassName = _this$props.gridClassName, gridStyle = _this$props.gridStyle, headerHeight = _this$props.headerHeight, headerRowRenderer = _this$props.headerRowRenderer, height = _this$props.height, id = _this$props.id, noRowsRenderer = _this$props.noRowsRenderer, rowClassName = _this$props.rowClassName, rowStyle = _this$props.rowStyle, scrollToIndex = _this$props.scrollToIndex, style = _this$props.style, _this$props = _this$props.width, scrollbarWidth = this.state.scrollbarWidth, height = disableHeader ? height : height - headerHeight, rowClassName = "function" == typeof rowClassName ? rowClassName({
|
|
4103
|
+
index: -1
|
|
4104
|
+
}) : rowClassName, rowStyle = "function" == typeof rowStyle ? rowStyle({
|
|
4105
|
+
index: -1
|
|
4106
|
+
}) : rowStyle;
|
|
4107
|
+
return this._cachedColumnStyles = [], React.Children.toArray(children).forEach(function(column, index) {
|
|
4108
|
+
column = _this2._getFlexStyleForColumn(column, column.props.style || Column.defaultProps.style);
|
|
4109
|
+
_this2._cachedColumnStyles[index] = _objectSpread2({
|
|
4110
|
+
overflow: "hidden"
|
|
4111
|
+
}, column);
|
|
4112
|
+
}), React.createElement("div", {
|
|
4113
|
+
"aria-label": this.props["aria-label"],
|
|
4114
|
+
"aria-labelledby": this.props["aria-labelledby"],
|
|
4115
|
+
"aria-colcount": React.Children.toArray(children).length,
|
|
4116
|
+
"aria-rowcount": this.props.rowCount,
|
|
4117
|
+
className: clsx("ReactVirtualized__Table", className),
|
|
4118
|
+
id: id,
|
|
4119
|
+
role: "grid",
|
|
4120
|
+
style: style
|
|
4121
|
+
}, !disableHeader && headerRowRenderer({
|
|
4122
|
+
className: clsx("ReactVirtualized__Table__headerRow", rowClassName),
|
|
4123
|
+
columns: this._getHeaderColumns(),
|
|
4124
|
+
style: _objectSpread2({
|
|
4125
|
+
height: headerHeight,
|
|
4126
|
+
overflow: "hidden",
|
|
4127
|
+
paddingRight: scrollbarWidth,
|
|
4128
|
+
width: _this$props
|
|
4129
|
+
}, rowStyle)
|
|
4130
|
+
}), React.createElement(Grid, _extends({}, this.props, {
|
|
4131
|
+
elementRef: this._setGridElementRef,
|
|
4132
|
+
"aria-readonly": null,
|
|
4133
|
+
autoContainerWidth: !0,
|
|
4134
|
+
className: clsx("ReactVirtualized__Table__Grid", gridClassName),
|
|
4135
|
+
cellRenderer: this._createRow,
|
|
4136
|
+
columnWidth: _this$props,
|
|
4137
|
+
columnCount: 1,
|
|
4138
|
+
height: height,
|
|
4139
|
+
id: void 0,
|
|
4140
|
+
noContentRenderer: noRowsRenderer,
|
|
4141
|
+
onScroll: this._onScroll,
|
|
4142
|
+
onSectionRendered: this._onSectionRendered,
|
|
4143
|
+
ref: this._setRef,
|
|
4144
|
+
role: "rowgroup",
|
|
4145
|
+
scrollbarWidth: scrollbarWidth,
|
|
4146
|
+
scrollToRow: scrollToIndex,
|
|
4147
|
+
style: _objectSpread2(_objectSpread2({}, gridStyle), {}, {
|
|
4148
|
+
overflowX: "hidden"
|
|
4149
|
+
})
|
|
4150
|
+
})));
|
|
4151
|
+
}
|
|
4152
|
+
}, {
|
|
4153
|
+
key: "_createColumn",
|
|
4154
|
+
value: function(_ref4) {
|
|
4155
|
+
var column = _ref4.column, columnIndex = _ref4.columnIndex, isScrolling = _ref4.isScrolling, parent = _ref4.parent, rowData = _ref4.rowData, _ref4 = _ref4.rowIndex, onColumnClick = this.props.onColumnClick, column = column.props, cellDataGetter = column.cellDataGetter, cellRenderer = column.cellRenderer, className = column.className, columnData = column.columnData, dataKey = column.dataKey, column = column.id, cellRenderer = cellRenderer({
|
|
4156
|
+
cellData: cellDataGetter({
|
|
4157
|
+
columnData: columnData,
|
|
4158
|
+
dataKey: dataKey,
|
|
4159
|
+
rowData: rowData
|
|
4160
|
+
}),
|
|
4161
|
+
columnData: columnData,
|
|
4162
|
+
columnIndex: columnIndex,
|
|
4163
|
+
dataKey: dataKey,
|
|
4164
|
+
isScrolling: isScrolling,
|
|
4165
|
+
parent: parent,
|
|
4166
|
+
rowData: rowData,
|
|
4167
|
+
rowIndex: _ref4
|
|
4168
|
+
}), cellDataGetter = this._cachedColumnStyles[columnIndex], isScrolling = "string" == typeof cellRenderer ? cellRenderer : null;
|
|
4169
|
+
return React.createElement("div", {
|
|
4170
|
+
"aria-colindex": columnIndex + 1,
|
|
4171
|
+
"aria-describedby": column,
|
|
4172
|
+
className: clsx("ReactVirtualized__Table__rowColumn", className),
|
|
4173
|
+
key: "Row" + _ref4 + "-Col" + columnIndex,
|
|
4174
|
+
onClick: function(event) {
|
|
4175
|
+
onColumnClick && onColumnClick({
|
|
4176
|
+
columnData: columnData,
|
|
4177
|
+
dataKey: dataKey,
|
|
4178
|
+
event: event
|
|
4179
|
+
});
|
|
4180
|
+
},
|
|
4181
|
+
role: "gridcell",
|
|
4182
|
+
style: cellDataGetter,
|
|
4183
|
+
title: isScrolling
|
|
4184
|
+
}, cellRenderer);
|
|
4185
|
+
}
|
|
4186
|
+
}, {
|
|
4187
|
+
key: "_createHeader",
|
|
4188
|
+
value: function(_ref5) {
|
|
4189
|
+
var newSortDirection, onClick, headerAriaLabel, headerAriaSort, headerTabIndex, headerOnClick, headerOnKeyDown, column = _ref5.column, _ref5 = _ref5.index, _this$props2 = this.props, headerClassName = _this$props2.headerClassName, headerStyle = _this$props2.headerStyle, onHeaderClick = _this$props2.onHeaderClick, sort = _this$props2.sort, sortBy = _this$props2.sortBy, _this$props2 = _this$props2.sortDirection, _column$props2 = column.props, columnData = _column$props2.columnData, dataKey = _column$props2.dataKey, defaultSortDirection = _column$props2.defaultSortDirection, disableSort = _column$props2.disableSort, headerRenderer = _column$props2.headerRenderer, id = _column$props2.id, _column$props2 = _column$props2.label, sortEnabled = !disableSort && sort, headerClassName = clsx("ReactVirtualized__Table__headerColumn", headerClassName, column.props.headerClassName, {
|
|
4190
|
+
ReactVirtualized__Table__sortableHeaderColumn: sortEnabled
|
|
4191
|
+
}), headerStyle = this._getFlexStyleForColumn(column, _objectSpread2(_objectSpread2({}, headerStyle), column.props.headerStyle)), headerRenderer = headerRenderer({
|
|
4192
|
+
columnData: columnData,
|
|
4193
|
+
dataKey: dataKey,
|
|
4194
|
+
disableSort: disableSort,
|
|
4195
|
+
label: _column$props2,
|
|
4196
|
+
sortBy: sortBy,
|
|
4197
|
+
sortDirection: _this$props2
|
|
4198
|
+
});
|
|
4199
|
+
return (sortEnabled || onHeaderClick) && (newSortDirection = sortBy !== dataKey ? defaultSortDirection : _this$props2 === SortDirection.DESC ? SortDirection.ASC : SortDirection.DESC,
|
|
4200
|
+
onClick = function(event) {
|
|
4201
|
+
sortEnabled && sort({
|
|
4202
|
+
defaultSortDirection: defaultSortDirection,
|
|
4203
|
+
event: event,
|
|
4204
|
+
sortBy: dataKey,
|
|
4205
|
+
sortDirection: newSortDirection
|
|
4206
|
+
}), onHeaderClick && onHeaderClick({
|
|
4207
|
+
columnData: columnData,
|
|
4208
|
+
dataKey: dataKey,
|
|
4209
|
+
event: event
|
|
4210
|
+
});
|
|
4211
|
+
}, headerAriaLabel = column.props["aria-label"] || _column$props2 || dataKey,
|
|
4212
|
+
headerAriaSort = "none", headerTabIndex = 0, headerOnClick = onClick,
|
|
4213
|
+
headerOnKeyDown = function(event) {
|
|
4214
|
+
"Enter" !== event.key && " " !== event.key || onClick(event);
|
|
4215
|
+
}), React.createElement("div", {
|
|
4216
|
+
"aria-label": headerAriaLabel,
|
|
4217
|
+
"aria-sort": headerAriaSort = sortBy === dataKey ? _this$props2 === SortDirection.ASC ? "ascending" : "descending" : headerAriaSort,
|
|
4218
|
+
className: headerClassName,
|
|
4219
|
+
id: id,
|
|
4220
|
+
key: "Header-Col" + _ref5,
|
|
4221
|
+
onClick: headerOnClick,
|
|
4222
|
+
onKeyDown: headerOnKeyDown,
|
|
4223
|
+
role: "columnheader",
|
|
4224
|
+
style: headerStyle,
|
|
4225
|
+
tabIndex: headerTabIndex
|
|
4226
|
+
}, headerRenderer);
|
|
4227
|
+
}
|
|
4228
|
+
}, {
|
|
4229
|
+
key: "_createRow",
|
|
4230
|
+
value: function(_ref6) {
|
|
4231
|
+
var _this3 = this, index = _ref6.rowIndex, isScrolling = _ref6.isScrolling, key = _ref6.key, parent = _ref6.parent, _ref6 = _ref6.style, _this$props3 = this.props, children = _this$props3.children, onRowClick = _this$props3.onRowClick, onRowDoubleClick = _this$props3.onRowDoubleClick, onRowRightClick = _this$props3.onRowRightClick, onRowMouseOver = _this$props3.onRowMouseOver, onRowMouseOut = _this$props3.onRowMouseOut, rowClassName = _this$props3.rowClassName, rowGetter = _this$props3.rowGetter, rowRenderer = _this$props3.rowRenderer, _this$props3 = _this$props3.rowStyle, scrollbarWidth = this.state.scrollbarWidth, rowClassName = "function" == typeof rowClassName ? rowClassName({
|
|
4232
|
+
index: index
|
|
4233
|
+
}) : rowClassName, _this$props3 = "function" == typeof _this$props3 ? _this$props3({
|
|
4234
|
+
index: index
|
|
4235
|
+
}) : _this$props3, rowData = rowGetter({
|
|
4236
|
+
index: index
|
|
4237
|
+
}), rowGetter = React.Children.toArray(children).map(function(column, columnIndex) {
|
|
4238
|
+
return _this3._createColumn({
|
|
4239
|
+
column: column,
|
|
4240
|
+
columnIndex: columnIndex,
|
|
4241
|
+
isScrolling: isScrolling,
|
|
4242
|
+
parent: parent,
|
|
4243
|
+
rowData: rowData,
|
|
4244
|
+
rowIndex: index,
|
|
4245
|
+
scrollbarWidth: scrollbarWidth
|
|
4246
|
+
});
|
|
4247
|
+
}), children = clsx("ReactVirtualized__Table__row", rowClassName), rowClassName = _objectSpread2(_objectSpread2({}, _ref6), {}, {
|
|
4248
|
+
height: this._getRowHeight(index),
|
|
4249
|
+
overflow: "hidden",
|
|
4250
|
+
paddingRight: scrollbarWidth
|
|
4251
|
+
}, _this$props3);
|
|
4252
|
+
return rowRenderer({
|
|
4253
|
+
className: children,
|
|
4254
|
+
columns: rowGetter,
|
|
4255
|
+
index: index,
|
|
4256
|
+
isScrolling: isScrolling,
|
|
4257
|
+
key: key,
|
|
4258
|
+
onRowClick: onRowClick,
|
|
4259
|
+
onRowDoubleClick: onRowDoubleClick,
|
|
4260
|
+
onRowRightClick: onRowRightClick,
|
|
4261
|
+
onRowMouseOver: onRowMouseOver,
|
|
4262
|
+
onRowMouseOut: onRowMouseOut,
|
|
4263
|
+
rowData: rowData,
|
|
4264
|
+
style: rowClassName
|
|
4265
|
+
});
|
|
4266
|
+
}
|
|
4267
|
+
}, {
|
|
4268
|
+
key: "_getFlexStyleForColumn",
|
|
4269
|
+
value: function(column) {
|
|
4270
|
+
var customStyle = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}, flexValue = "".concat(column.props.flexGrow, " ").concat(column.props.flexShrink, " ").concat(column.props.width, "px"), customStyle = _objectSpread2(_objectSpread2({}, customStyle), {}, {
|
|
4271
|
+
flex: flexValue,
|
|
4272
|
+
msFlex: flexValue,
|
|
4273
|
+
WebkitFlex: flexValue
|
|
4274
|
+
});
|
|
4275
|
+
return column.props.maxWidth && (customStyle.maxWidth = column.props.maxWidth),
|
|
4276
|
+
column.props.minWidth && (customStyle.minWidth = column.props.minWidth),
|
|
4277
|
+
customStyle;
|
|
4278
|
+
}
|
|
4279
|
+
}, {
|
|
4280
|
+
key: "_getHeaderColumns",
|
|
4281
|
+
value: function() {
|
|
4282
|
+
var _this4 = this, _this$props4 = this.props, children = _this$props4.children;
|
|
4283
|
+
return (_this$props4.disableHeader ? [] : React.Children.toArray(children)).map(function(column, index) {
|
|
4284
|
+
return _this4._createHeader({
|
|
4285
|
+
column: column,
|
|
4286
|
+
index: index
|
|
4287
|
+
});
|
|
4288
|
+
});
|
|
4289
|
+
}
|
|
4290
|
+
}, {
|
|
4291
|
+
key: "_getRowHeight",
|
|
4292
|
+
value: function(rowIndex) {
|
|
4293
|
+
var rowHeight = this.props.rowHeight;
|
|
4294
|
+
return "function" == typeof rowHeight ? rowHeight({
|
|
4295
|
+
index: rowIndex
|
|
4296
|
+
}) : rowHeight;
|
|
4297
|
+
}
|
|
4298
|
+
}, {
|
|
4299
|
+
key: "_onScroll",
|
|
4300
|
+
value: function(_ref7) {
|
|
4301
|
+
var clientHeight = _ref7.clientHeight;
|
|
4302
|
+
(0, this.props.onScroll)({
|
|
4303
|
+
clientHeight: clientHeight,
|
|
4304
|
+
scrollHeight: _ref7.scrollHeight,
|
|
4305
|
+
scrollTop: _ref7.scrollTop
|
|
4306
|
+
});
|
|
4307
|
+
}
|
|
4308
|
+
}, {
|
|
4309
|
+
key: "_onSectionRendered",
|
|
4310
|
+
value: function(_ref8) {
|
|
4311
|
+
var rowOverscanStartIndex = _ref8.rowOverscanStartIndex;
|
|
4312
|
+
(0, this.props.onRowsRendered)({
|
|
4313
|
+
overscanStartIndex: rowOverscanStartIndex,
|
|
4314
|
+
overscanStopIndex: _ref8.rowOverscanStopIndex,
|
|
4315
|
+
startIndex: _ref8.rowStartIndex,
|
|
4316
|
+
stopIndex: _ref8.rowStopIndex
|
|
4317
|
+
});
|
|
4318
|
+
}
|
|
4319
|
+
}, {
|
|
4320
|
+
key: "_setRef",
|
|
4321
|
+
value: function(ref) {
|
|
4322
|
+
this.Grid = ref;
|
|
4323
|
+
}
|
|
4324
|
+
}, {
|
|
4325
|
+
key: "_setGridElementRef",
|
|
4326
|
+
value: function(ref) {
|
|
4327
|
+
this.GridElement = ref;
|
|
4328
|
+
}
|
|
4329
|
+
}, {
|
|
4330
|
+
key: "_setScrollbarWidth",
|
|
4331
|
+
value: function() {
|
|
4332
|
+
var scrollbarWidth = this.getScrollbarWidth();
|
|
4333
|
+
this.setState({
|
|
4334
|
+
scrollbarWidth: scrollbarWidth
|
|
4335
|
+
});
|
|
4336
|
+
}
|
|
4337
|
+
} ]);
|
|
4338
|
+
})()), mountedInstances = (_defineProperty(Table, "propTypes", {
|
|
4339
|
+
"aria-label": propTypes.string,
|
|
4340
|
+
"aria-labelledby": propTypes.string,
|
|
4341
|
+
autoHeight: propTypes.bool,
|
|
4342
|
+
children: function(props) {
|
|
4343
|
+
for (var children = React.Children.toArray(props.children), i = 0; i < children.length; i++) {
|
|
4344
|
+
var childType = children[i].type;
|
|
4345
|
+
if (childType !== Column && !(childType.prototype instanceof Column)) return new Error("Table only accepts children of type Column");
|
|
4346
|
+
}
|
|
4347
|
+
},
|
|
4348
|
+
className: propTypes.string,
|
|
4349
|
+
disableHeader: propTypes.bool,
|
|
4350
|
+
estimatedRowSize: propTypes.number.isRequired,
|
|
4351
|
+
gridClassName: propTypes.string,
|
|
4352
|
+
gridStyle: propTypes.object,
|
|
4353
|
+
headerClassName: propTypes.string,
|
|
4354
|
+
headerHeight: propTypes.number.isRequired,
|
|
4355
|
+
headerRowRenderer: propTypes.func,
|
|
4356
|
+
headerStyle: propTypes.object,
|
|
4357
|
+
height: propTypes.number.isRequired,
|
|
4358
|
+
id: propTypes.string,
|
|
4359
|
+
noRowsRenderer: propTypes.func,
|
|
4360
|
+
onColumnClick: propTypes.func,
|
|
4361
|
+
onHeaderClick: propTypes.func,
|
|
4362
|
+
onRowClick: propTypes.func,
|
|
4363
|
+
onRowDoubleClick: propTypes.func,
|
|
4364
|
+
onRowMouseOut: propTypes.func,
|
|
4365
|
+
onRowMouseOver: propTypes.func,
|
|
4366
|
+
onRowRightClick: propTypes.func,
|
|
4367
|
+
onRowsRendered: propTypes.func,
|
|
4368
|
+
onScroll: propTypes.func.isRequired,
|
|
4369
|
+
overscanIndicesGetter: propTypes.func.isRequired,
|
|
4370
|
+
overscanRowCount: propTypes.number.isRequired,
|
|
4371
|
+
rowClassName: propTypes.oneOfType([ propTypes.string, propTypes.func ]),
|
|
4372
|
+
rowGetter: propTypes.func.isRequired,
|
|
4373
|
+
rowHeight: propTypes.oneOfType([ propTypes.number, propTypes.func ]).isRequired,
|
|
4374
|
+
rowCount: propTypes.number.isRequired,
|
|
4375
|
+
rowRenderer: propTypes.func,
|
|
4376
|
+
rowStyle: propTypes.oneOfType([ propTypes.object, propTypes.func ]).isRequired,
|
|
4377
|
+
scrollToAlignment: propTypes.oneOf([ "auto", "end", "start", "center" ]).isRequired,
|
|
4378
|
+
scrollToIndex: propTypes.number.isRequired,
|
|
4379
|
+
scrollTop: propTypes.number,
|
|
4380
|
+
sort: propTypes.func,
|
|
4381
|
+
sortBy: propTypes.string,
|
|
4382
|
+
sortDirection: propTypes.oneOf([ SortDirection.ASC, SortDirection.DESC ]),
|
|
4383
|
+
style: propTypes.object,
|
|
4384
|
+
tabIndex: propTypes.number,
|
|
4385
|
+
width: propTypes.number.isRequired
|
|
4386
|
+
}), _defineProperty(Table, "defaultProps", {
|
|
4387
|
+
disableHeader: !1,
|
|
4388
|
+
estimatedRowSize: 30,
|
|
4389
|
+
headerHeight: 0,
|
|
4390
|
+
headerStyle: {},
|
|
4391
|
+
noRowsRenderer: function() {
|
|
4392
|
+
return null;
|
|
4393
|
+
},
|
|
4394
|
+
onRowsRendered: function() {
|
|
4395
|
+
return null;
|
|
4396
|
+
},
|
|
4397
|
+
onScroll: function() {
|
|
4398
|
+
return null;
|
|
4399
|
+
},
|
|
4400
|
+
overscanIndicesGetter: defaultOverscanIndicesGetter$1,
|
|
4401
|
+
overscanRowCount: 10,
|
|
4402
|
+
rowRenderer: defaultRowRenderer,
|
|
4403
|
+
headerRowRenderer: defaultHeaderRowRenderer,
|
|
4404
|
+
rowStyle: {},
|
|
4405
|
+
scrollToAlignment: "auto",
|
|
4406
|
+
scrollToIndex: -1,
|
|
4407
|
+
style: {}
|
|
4408
|
+
}), []), originalBodyPointerEvents = null, disablePointerEventsTimeoutId = null;
|
|
4409
|
+
function enablePointerEventsIfDisabled() {
|
|
4410
|
+
disablePointerEventsTimeoutId && (disablePointerEventsTimeoutId = null,
|
|
4411
|
+
document.body && null != originalBodyPointerEvents && (document.body.style.pointerEvents = originalBodyPointerEvents),
|
|
4412
|
+
originalBodyPointerEvents = null);
|
|
4413
|
+
}
|
|
4414
|
+
function enablePointerEventsAfterDelayCallback() {
|
|
4415
|
+
enablePointerEventsIfDisabled(), mountedInstances.forEach(function(instance) {
|
|
4416
|
+
return instance.__resetIsScrolling();
|
|
4417
|
+
});
|
|
4418
|
+
}
|
|
4419
|
+
function onScrollWindow(event) {
|
|
4420
|
+
var maximumTimeout;
|
|
4421
|
+
event.currentTarget === window && null == originalBodyPointerEvents && document.body && (originalBodyPointerEvents = document.body.style.pointerEvents,
|
|
4422
|
+
document.body.style.pointerEvents = "none"), disablePointerEventsTimeoutId && cancelAnimationTimeout(disablePointerEventsTimeoutId),
|
|
4423
|
+
maximumTimeout = 0, mountedInstances.forEach(function(instance) {
|
|
4424
|
+
maximumTimeout = Math.max(maximumTimeout, instance.props.scrollingResetTimeInterval);
|
|
4425
|
+
}), disablePointerEventsTimeoutId = requestAnimationTimeout(enablePointerEventsAfterDelayCallback, maximumTimeout),
|
|
4426
|
+
mountedInstances.forEach(function(instance) {
|
|
4427
|
+
instance.props.scrollElement === event.currentTarget && instance.__handleWindowScrollEvent();
|
|
4428
|
+
});
|
|
4429
|
+
}
|
|
4430
|
+
function registerScrollListener(component, element) {
|
|
4431
|
+
mountedInstances.some(function(instance) {
|
|
4432
|
+
return instance.props.scrollElement === element;
|
|
4433
|
+
}) || element.addEventListener("scroll", onScrollWindow), mountedInstances.push(component);
|
|
4434
|
+
}
|
|
4435
|
+
function unregisterScrollListener(component, element) {
|
|
4436
|
+
(mountedInstances = mountedInstances.filter(function(instance) {
|
|
4437
|
+
return instance !== component;
|
|
4438
|
+
})).length || (element.removeEventListener("scroll", onScrollWindow), disablePointerEventsTimeoutId && (cancelAnimationTimeout(disablePointerEventsTimeoutId),
|
|
4439
|
+
enablePointerEventsIfDisabled()));
|
|
4440
|
+
}
|
|
4441
|
+
var isWindow = function(element) {
|
|
4442
|
+
return element === window;
|
|
4443
|
+
}, getBoundingBox = function(element) {
|
|
4444
|
+
return element.getBoundingClientRect();
|
|
4445
|
+
};
|
|
4446
|
+
function getDimensions(scrollElement, props) {
|
|
4447
|
+
var _window, innerHeight;
|
|
4448
|
+
return scrollElement ? isWindow(scrollElement) ? {
|
|
4449
|
+
height: "number" == typeof (innerHeight = (_window = window).innerHeight) ? innerHeight : 0,
|
|
4450
|
+
width: "number" == typeof (innerHeight = _window.innerWidth) ? innerHeight : 0
|
|
4451
|
+
} : getBoundingBox(scrollElement) : {
|
|
4452
|
+
height: props.serverHeight,
|
|
4453
|
+
width: props.serverWidth
|
|
4454
|
+
};
|
|
4455
|
+
}
|
|
4456
|
+
function getScrollOffset(element) {
|
|
4457
|
+
return isWindow(element) && document.documentElement ? {
|
|
4458
|
+
top: "scrollY" in window ? window.scrollY : document.documentElement.scrollTop,
|
|
4459
|
+
left: "scrollX" in window ? window.scrollX : document.documentElement.scrollLeft
|
|
4460
|
+
} : {
|
|
4461
|
+
top: element.scrollTop,
|
|
4462
|
+
left: element.scrollLeft
|
|
4463
|
+
};
|
|
4464
|
+
}
|
|
4465
|
+
function getWindow() {
|
|
4466
|
+
return "undefined" != typeof window ? window : void 0;
|
|
4467
|
+
}
|
|
4468
|
+
propTypes = (() => {
|
|
4469
|
+
function WindowScroller() {
|
|
4470
|
+
var _this;
|
|
4471
|
+
_classCallCheck(this, WindowScroller);
|
|
4472
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
|
4473
|
+
return _defineProperty(_this = _callSuper(this, WindowScroller, [].concat(args)), "_window", getWindow()),
|
|
4474
|
+
_defineProperty(_this, "_isMounted", !1), _defineProperty(_this, "_positionFromTop", 0),
|
|
4475
|
+
_defineProperty(_this, "_positionFromLeft", 0), _defineProperty(_this, "_detectElementResize", void 0),
|
|
4476
|
+
_defineProperty(_this, "_child", void 0), _defineProperty(_this, "_windowScrollerRef", React.createRef()),
|
|
4477
|
+
_defineProperty(_this, "state", _objectSpread2(_objectSpread2({}, getDimensions(_this.props.scrollElement, _this.props)), {}, {
|
|
4478
|
+
isScrolling: !1,
|
|
4479
|
+
scrollLeft: 0,
|
|
4480
|
+
scrollTop: 0
|
|
4481
|
+
})), _defineProperty(_this, "_registerChild", function(element) {
|
|
4482
|
+
!element || element instanceof Element || console.warn("WindowScroller registerChild expects to be passed Element or null"),
|
|
4483
|
+
_this._child = element, _this.updatePosition();
|
|
4484
|
+
}), _defineProperty(_this, "_onChildScroll", function(_ref) {
|
|
4485
|
+
var scrollElement, _ref = _ref.scrollTop;
|
|
4486
|
+
_this.state.scrollTop !== _ref && (scrollElement = _this.props.scrollElement) && ("function" == typeof scrollElement.scrollTo ? scrollElement.scrollTo(0, _ref + _this._positionFromTop) : scrollElement.scrollTop = _ref + _this._positionFromTop);
|
|
4487
|
+
}), _defineProperty(_this, "_registerResizeListener", function(element) {
|
|
4488
|
+
element === window ? window.addEventListener("resize", _this._onResize, !1) : _this._detectElementResize.addResizeListener(element, _this._onResize);
|
|
4489
|
+
}), _defineProperty(_this, "_unregisterResizeListener", function(element) {
|
|
4490
|
+
element === window ? window.removeEventListener("resize", _this._onResize, !1) : element && _this._detectElementResize.removeResizeListener(element, _this._onResize);
|
|
4491
|
+
}), _defineProperty(_this, "_onResize", function() {
|
|
4492
|
+
_this.updatePosition();
|
|
4493
|
+
}), _defineProperty(_this, "__handleWindowScrollEvent", function() {
|
|
4494
|
+
var onScroll, scrollLeft, scrollElement;
|
|
4495
|
+
_this._isMounted && (onScroll = _this.props.onScroll, scrollElement = _this.props.scrollElement) && (scrollElement = getScrollOffset(scrollElement),
|
|
4496
|
+
scrollLeft = Math.max(0, scrollElement.left - _this._positionFromLeft),
|
|
4497
|
+
scrollElement = Math.max(0, scrollElement.top - _this._positionFromTop),
|
|
4498
|
+
_this.setState({
|
|
4499
|
+
isScrolling: !0,
|
|
4500
|
+
scrollLeft: scrollLeft,
|
|
4501
|
+
scrollTop: scrollElement
|
|
4502
|
+
}), onScroll({
|
|
4503
|
+
scrollLeft: scrollLeft,
|
|
4504
|
+
scrollTop: scrollElement
|
|
4505
|
+
}));
|
|
4506
|
+
}), _defineProperty(_this, "__resetIsScrolling", function() {
|
|
4507
|
+
_this.setState({
|
|
4508
|
+
isScrolling: !1
|
|
4509
|
+
});
|
|
4510
|
+
}), _this;
|
|
4511
|
+
}
|
|
4512
|
+
return _inherits(WindowScroller, React.PureComponent), _createClass(WindowScroller, [ {
|
|
4513
|
+
key: "updatePosition",
|
|
4514
|
+
value: function() {
|
|
4515
|
+
var container, elementRect, scrollElement = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : this.props.scrollElement, onResize = this.props.onResize, _this$state = this.state, height = _this$state.height, _this$state = _this$state.width, thisNode = this._child || this._windowScrollerRef.current, containerElement = (thisNode instanceof Element && scrollElement && (thisNode = thisNode,
|
|
4516
|
+
container = isWindow(container = scrollElement) && document.documentElement ? (containerElement = document.documentElement,
|
|
4517
|
+
elementRect = getBoundingBox(thisNode), containerElement = getBoundingBox(containerElement),
|
|
4518
|
+
{
|
|
4519
|
+
top: elementRect.top - containerElement.top,
|
|
4520
|
+
left: elementRect.left - containerElement.left
|
|
4521
|
+
}) : (elementRect = getScrollOffset(container), containerElement = getBoundingBox(thisNode),
|
|
4522
|
+
thisNode = getBoundingBox(container), {
|
|
4523
|
+
top: containerElement.top + elementRect.top - thisNode.top,
|
|
4524
|
+
left: containerElement.left + elementRect.left - thisNode.left
|
|
4525
|
+
}), this._positionFromTop = container.top, this._positionFromLeft = container.left),
|
|
4526
|
+
getDimensions(scrollElement, this.props));
|
|
4527
|
+
height === containerElement.height && _this$state === containerElement.width || (this.setState({
|
|
4528
|
+
height: containerElement.height,
|
|
4529
|
+
width: containerElement.width
|
|
4530
|
+
}), onResize({
|
|
4531
|
+
height: containerElement.height,
|
|
4532
|
+
width: containerElement.width
|
|
4533
|
+
})), !0 === this.props.updateScrollTopOnUpdatePosition && (this.__handleWindowScrollEvent(),
|
|
4534
|
+
this.__resetIsScrolling());
|
|
4535
|
+
}
|
|
4536
|
+
}, {
|
|
4537
|
+
key: "componentDidMount",
|
|
4538
|
+
value: function() {
|
|
4539
|
+
var scrollElement = this.props.scrollElement;
|
|
4540
|
+
this._detectElementResize = createDetectElementResize(), this.updatePosition(scrollElement),
|
|
4541
|
+
scrollElement && (registerScrollListener(this, scrollElement), this._registerResizeListener(scrollElement)),
|
|
4542
|
+
this._isMounted = !0;
|
|
4543
|
+
}
|
|
4544
|
+
}, {
|
|
4545
|
+
key: "componentDidUpdate",
|
|
4546
|
+
value: function(prevProps, prevState) {
|
|
4547
|
+
var scrollElement = this.props.scrollElement, prevProps = prevProps.scrollElement;
|
|
4548
|
+
prevProps !== scrollElement && null != prevProps && null != scrollElement && (this.updatePosition(scrollElement),
|
|
4549
|
+
unregisterScrollListener(this, prevProps), registerScrollListener(this, scrollElement),
|
|
4550
|
+
this._unregisterResizeListener(prevProps), this._registerResizeListener(scrollElement));
|
|
4551
|
+
}
|
|
4552
|
+
}, {
|
|
4553
|
+
key: "componentWillUnmount",
|
|
4554
|
+
value: function() {
|
|
4555
|
+
var scrollElement = this.props.scrollElement;
|
|
4556
|
+
scrollElement && (unregisterScrollListener(this, scrollElement),
|
|
4557
|
+
this._unregisterResizeListener(scrollElement)), this._isMounted = !1;
|
|
4558
|
+
}
|
|
4559
|
+
}, {
|
|
4560
|
+
key: "render",
|
|
4561
|
+
value: function() {
|
|
4562
|
+
var children = this.props.children, _this$state2 = this.state, isScrolling = _this$state2.isScrolling;
|
|
4563
|
+
return React.createElement("div", {
|
|
4564
|
+
ref: this._windowScrollerRef
|
|
4565
|
+
}, children({
|
|
4566
|
+
onChildScroll: this._onChildScroll,
|
|
4567
|
+
registerChild: this._registerChild,
|
|
4568
|
+
height: _this$state2.height,
|
|
4569
|
+
isScrolling: isScrolling,
|
|
4570
|
+
scrollLeft: _this$state2.scrollLeft,
|
|
4571
|
+
scrollTop: _this$state2.scrollTop,
|
|
4572
|
+
width: _this$state2.width
|
|
4573
|
+
}));
|
|
4574
|
+
}
|
|
4575
|
+
} ]);
|
|
4576
|
+
})();
|
|
4577
|
+
_defineProperty(propTypes, "defaultProps", {
|
|
4578
|
+
onResize: function() {},
|
|
4579
|
+
onScroll: function() {},
|
|
4580
|
+
scrollingResetTimeInterval: 150,
|
|
4581
|
+
scrollElement: getWindow(),
|
|
4582
|
+
serverHeight: 0,
|
|
4583
|
+
serverWidth: 0
|
|
4584
|
+
}), exports.ArrowKeyStepper = ArrowKeyStepper, exports.AutoSizer = AutoSizer,
|
|
4585
|
+
exports.CellMeasurer = CellMeasurer, exports.CellMeasurerCache = CellMeasurerCache,
|
|
4586
|
+
exports.Collection = Collection, exports.Column = Column, exports.ColumnSizer = ColumnSizer,
|
|
4587
|
+
exports.Grid = Grid, exports.InfiniteLoader = request, exports.List = cancel,
|
|
4588
|
+
exports.Masonry = proto, exports.MultiGrid = MultiGrid, exports.ScrollSync = ScrollSync,
|
|
4589
|
+
exports.SortDirection = SortDirection, exports.SortIndicator = SortIndicator,
|
|
4590
|
+
exports.Table = Table, exports.WindowScroller = propTypes, exports.accessibilityOverscanIndicesGetter = defaultOverscanIndicesGetter$1,
|
|
4591
|
+
exports.createMasonryCellPositioner = function(_ref) {
|
|
4592
|
+
var columnHeights, cellMeasurerCache = _ref.cellMeasurerCache, columnCount = _ref.columnCount, columnWidth = _ref.columnWidth, spacer = void 0 === (_ref = _ref.spacer) ? 0 : _ref;
|
|
4593
|
+
function cellPositioner(index) {
|
|
4594
|
+
for (var columnIndex = 0, i = 1; i < columnHeights.length; i++) columnHeights[i] < columnHeights[columnIndex] && (columnIndex = i);
|
|
4595
|
+
var left = columnIndex * (columnWidth + spacer), top = columnHeights[columnIndex] || 0;
|
|
4596
|
+
return columnHeights[columnIndex] = top + cellMeasurerCache.getHeight(index) + spacer,
|
|
4597
|
+
{
|
|
4598
|
+
left: left,
|
|
4599
|
+
top: top
|
|
4600
|
+
};
|
|
4601
|
+
}
|
|
4602
|
+
function initOrResetDerivedValues() {
|
|
4603
|
+
columnHeights = [];
|
|
4604
|
+
for (var i = 0; i < columnCount; i++) columnHeights[i] = 0;
|
|
4605
|
+
}
|
|
4606
|
+
return initOrResetDerivedValues(), cellPositioner.reset = function(params) {
|
|
4607
|
+
columnCount = params.columnCount, columnWidth = params.columnWidth,
|
|
4608
|
+
spacer = params.spacer, initOrResetDerivedValues();
|
|
4609
|
+
}, cellPositioner;
|
|
4610
|
+
}, exports.createTableMultiSort = function(sortCallback) {
|
|
4611
|
+
var sortBy, sortDirection, _ref = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}, defaultSortBy = _ref.defaultSortBy, defaultSortDirection = void 0 === (_ref = _ref.defaultSortDirection) ? {} : _ref;
|
|
4612
|
+
if (sortCallback) return sortDirection = {}, (sortBy = defaultSortBy || []).forEach(function(dataKey) {
|
|
4613
|
+
sortDirection[dataKey] = void 0 !== defaultSortDirection[dataKey] ? defaultSortDirection[dataKey] : "ASC";
|
|
4614
|
+
}), {
|
|
4615
|
+
sort: function(_ref2) {
|
|
4616
|
+
var defaultSortDirection = _ref2.defaultSortDirection, event = _ref2.event, dataKey = _ref2.sortBy;
|
|
4617
|
+
event.shiftKey ? void 0 !== sortDirection[dataKey] ? sortDirection[dataKey] = "ASC" === sortDirection[dataKey] ? "DESC" : "ASC" : (sortDirection[dataKey] = defaultSortDirection,
|
|
4618
|
+
sortBy.push(dataKey)) : event.ctrlKey || event.metaKey ? 0 <= (_ref2 = sortBy.indexOf(dataKey)) && (sortBy.splice(_ref2, 1),
|
|
4619
|
+
delete sortDirection[dataKey]) : (sortBy.length = 0, sortBy.push(dataKey),
|
|
4620
|
+
Object.keys(sortDirection).forEach(function(key) {
|
|
4621
|
+
key !== dataKey && delete sortDirection[key];
|
|
4622
|
+
}), sortDirection[dataKey] = void 0 !== sortDirection[dataKey] ? "ASC" === sortDirection[dataKey] ? "DESC" : "ASC" : defaultSortDirection),
|
|
4623
|
+
sortCallback({
|
|
4624
|
+
sortBy: sortBy,
|
|
4625
|
+
sortDirection: sortDirection
|
|
4626
|
+
});
|
|
4627
|
+
},
|
|
4628
|
+
sortBy: sortBy,
|
|
4629
|
+
sortDirection: sortDirection
|
|
4630
|
+
};
|
|
4631
|
+
throw Error('Required parameter "sortCallback" not specified');
|
|
4632
|
+
}, exports.defaultCellRangeRenderer = defaultCellRangeRenderer, exports.defaultOverscanIndicesGetter = defaultOverscanIndicesGetter,
|
|
4633
|
+
exports.defaultTableCellDataGetter = defaultCellDataGetter, exports.defaultTableCellRenderer = defaultCellRenderer,
|
|
4634
|
+
exports.defaultTableHeaderRenderer = defaultHeaderRenderer, exports.defaultTableHeaderRowRenderer = defaultHeaderRowRenderer,
|
|
4635
|
+
exports.defaultTableRowRenderer = defaultRowRenderer, Object.defineProperty(exports, "__esModule", {
|
|
4636
|
+
value: !0
|
|
4637
|
+
});
|
|
4638
|
+
});
|