@difizen/libro-virtualized 0.1.2

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.
Files changed (132) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +0 -0
  3. package/es/auto-sizer/auto-sizer.d.ts +56 -0
  4. package/es/auto-sizer/auto-sizer.d.ts.map +1 -0
  5. package/es/auto-sizer/auto-sizer.js +157 -0
  6. package/es/auto-sizer/index.d.ts +3 -0
  7. package/es/auto-sizer/index.d.ts.map +1 -0
  8. package/es/auto-sizer/index.js +2 -0
  9. package/es/cell-measurer/cell-measurer-cache.d.ts +52 -0
  10. package/es/cell-measurer/cell-measurer-cache.d.ts.map +1 -0
  11. package/es/cell-measurer/cell-measurer-cache.js +176 -0
  12. package/es/cell-measurer/cell-measurer.d.ts +39 -0
  13. package/es/cell-measurer/cell-measurer.d.ts.map +1 -0
  14. package/es/cell-measurer/cell-measurer.js +154 -0
  15. package/es/cell-measurer/index.d.ts +5 -0
  16. package/es/cell-measurer/index.d.ts.map +1 -0
  17. package/es/cell-measurer/index.js +4 -0
  18. package/es/cell-measurer/types.d.ts +9 -0
  19. package/es/cell-measurer/types.d.ts.map +1 -0
  20. package/es/cell-measurer/types.js +0 -0
  21. package/es/grid/accessibility-overscanIndices-getter.d.ts +11 -0
  22. package/es/grid/accessibility-overscanIndices-getter.d.ts.map +1 -0
  23. package/es/grid/accessibility-overscanIndices-getter.js +33 -0
  24. package/es/grid/default-cell-range-renderer.d.ts +10 -0
  25. package/es/grid/default-cell-range-renderer.d.ts.map +1 -0
  26. package/es/grid/default-cell-range-renderer.js +135 -0
  27. package/es/grid/default-overscanIndices-getter.d.ts +11 -0
  28. package/es/grid/default-overscanIndices-getter.d.ts.map +1 -0
  29. package/es/grid/default-overscanIndices-getter.js +28 -0
  30. package/es/grid/grid.d.ts +359 -0
  31. package/es/grid/grid.d.ts.map +1 -0
  32. package/es/grid/grid.js +1287 -0
  33. package/es/grid/index.d.ts +6 -0
  34. package/es/grid/index.d.ts.map +1 -0
  35. package/es/grid/index.js +4 -0
  36. package/es/grid/types.d.ts +87 -0
  37. package/es/grid/types.d.ts.map +1 -0
  38. package/es/grid/types.js +1 -0
  39. package/es/grid/utils/calculate-size-and-position-data-and-update-scroll-offset.d.ts +17 -0
  40. package/es/grid/utils/calculate-size-and-position-data-and-update-scroll-offset.d.ts.map +1 -0
  41. package/es/grid/utils/calculate-size-and-position-data-and-update-scroll-offset.js +25 -0
  42. package/es/grid/utils/cell-size-and-position-manager-row.d.ts +97 -0
  43. package/es/grid/utils/cell-size-and-position-manager-row.d.ts.map +1 -0
  44. package/es/grid/utils/cell-size-and-position-manager-row.js +297 -0
  45. package/es/grid/utils/cell-size-and-position-manager.d.ts +85 -0
  46. package/es/grid/utils/cell-size-and-position-manager.d.ts.map +1 -0
  47. package/es/grid/utils/cell-size-and-position-manager.js +268 -0
  48. package/es/grid/utils/max-element-size.d.ts +2 -0
  49. package/es/grid/utils/max-element-size.d.ts.map +1 -0
  50. package/es/grid/utils/max-element-size.js +17 -0
  51. package/es/grid/utils/scaling-cell-size-and-position-manager-row.d.ts +78 -0
  52. package/es/grid/utils/scaling-cell-size-and-position-manager-row.d.ts.map +1 -0
  53. package/es/grid/utils/scaling-cell-size-and-position-manager-row.js +187 -0
  54. package/es/grid/utils/scaling-cell-size-and-position-manager.d.ts +70 -0
  55. package/es/grid/utils/scaling-cell-size-and-position-manager.d.ts.map +1 -0
  56. package/es/grid/utils/scaling-cell-size-and-position-manager.js +187 -0
  57. package/es/grid/utils/update-scroll-index-helper.d.ts +24 -0
  58. package/es/grid/utils/update-scroll-index-helper.d.ts.map +1 -0
  59. package/es/grid/utils/update-scroll-index-helper.js +40 -0
  60. package/es/index.d.ts +5 -0
  61. package/es/index.d.ts.map +1 -0
  62. package/es/index.js +4 -0
  63. package/es/list/index.d.ts +3 -0
  64. package/es/list/index.d.ts.map +1 -0
  65. package/es/list/index.js +1 -0
  66. package/es/list/list.d.ts +109 -0
  67. package/es/list/list.d.ts.map +1 -0
  68. package/es/list/list.js +261 -0
  69. package/es/list/types.d.ts +22 -0
  70. package/es/list/types.d.ts.map +1 -0
  71. package/es/list/types.js +1 -0
  72. package/es/utils/animation-frame.d.ts +7 -0
  73. package/es/utils/animation-frame.d.ts.map +1 -0
  74. package/es/utils/animation-frame.js +20 -0
  75. package/es/utils/create-callback-memoizer.d.ts +5 -0
  76. package/es/utils/create-callback-memoizer.d.ts.map +1 -0
  77. package/es/utils/create-callback-memoizer.js +25 -0
  78. package/es/utils/get-updated-offset-for-index.d.ts +14 -0
  79. package/es/utils/get-updated-offset-for-index.d.ts.map +1 -0
  80. package/es/utils/get-updated-offset-for-index.js +32 -0
  81. package/es/utils/init-cell-metadata.d.ts +13 -0
  82. package/es/utils/init-cell-metadata.d.ts.map +1 -0
  83. package/es/utils/init-cell-metadata.js +32 -0
  84. package/es/utils/request-animation-timeout.d.ts +12 -0
  85. package/es/utils/request-animation-timeout.d.ts.map +1 -0
  86. package/es/utils/request-animation-timeout.js +33 -0
  87. package/es/utils/test-helper.d.ts +5 -0
  88. package/es/utils/test-helper.d.ts.map +1 -0
  89. package/es/utils/test-helper.js +31 -0
  90. package/es/vendor/binary-search-bounds.d.ts +22 -0
  91. package/es/vendor/binary-search-bounds.d.ts.map +1 -0
  92. package/es/vendor/binary-search-bounds.js +198 -0
  93. package/es/vendor/detect-element-resize.d.ts +16 -0
  94. package/es/vendor/detect-element-resize.d.ts.map +1 -0
  95. package/es/vendor/detect-element-resize.js +184 -0
  96. package/es/vendor/interval-tree.d.ts +10 -0
  97. package/es/vendor/interval-tree.d.ts.map +1 -0
  98. package/es/vendor/interval-tree.js +359 -0
  99. package/package.json +59 -0
  100. package/src/auto-sizer/auto-sizer.tsx +187 -0
  101. package/src/auto-sizer/index.ts +4 -0
  102. package/src/cell-measurer/cell-measurer-cache.ts +220 -0
  103. package/src/cell-measurer/cell-measurer.ts +151 -0
  104. package/src/cell-measurer/index.ts +5 -0
  105. package/src/cell-measurer/types.ts +8 -0
  106. package/src/grid/accessibility-overscanIndices-getter.ts +38 -0
  107. package/src/grid/default-cell-range-renderer.ts +166 -0
  108. package/src/grid/default-overscanIndices-getter.ts +32 -0
  109. package/src/grid/grid.tsx +1672 -0
  110. package/src/grid/index.ts +14 -0
  111. package/src/grid/types.ts +112 -0
  112. package/src/grid/utils/calculate-size-and-position-data-and-update-scroll-offset.ts +62 -0
  113. package/src/grid/utils/cell-size-and-position-manager-row.ts +365 -0
  114. package/src/grid/utils/cell-size-and-position-manager.ts +309 -0
  115. package/src/grid/utils/max-element-size.ts +18 -0
  116. package/src/grid/utils/scaling-cell-size-and-position-manager-row.ts +206 -0
  117. package/src/grid/utils/scaling-cell-size-and-position-manager.ts +198 -0
  118. package/src/grid/utils/update-scroll-index-helper.ts +96 -0
  119. package/src/index.spec.ts +10 -0
  120. package/src/index.ts +4 -0
  121. package/src/list/index.ts +2 -0
  122. package/src/list/list.tsx +292 -0
  123. package/src/list/types.ts +25 -0
  124. package/src/utils/animation-frame.ts +38 -0
  125. package/src/utils/create-callback-memoizer.ts +32 -0
  126. package/src/utils/get-updated-offset-for-index.ts +33 -0
  127. package/src/utils/init-cell-metadata.ts +32 -0
  128. package/src/utils/request-animation-timeout.ts +44 -0
  129. package/src/utils/test-helper.ts +20 -0
  130. package/src/vendor/binary-search-bounds.ts +203 -0
  131. package/src/vendor/detect-element-resize.ts +241 -0
  132. package/src/vendor/interval-tree.ts +406 -0
@@ -0,0 +1,187 @@
1
+ var _excluded = ["maxScrollSize"];
2
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
7
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
9
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
10
+ /* eslint-disable no-param-reassign */
11
+
12
+ import CellSizeAndPositionManager from "./cell-size-and-position-manager.js";
13
+ import { getMaxElementSize } from "./max-element-size.js";
14
+
15
+ /**
16
+ * Browsers have scroll offset limitations (eg Chrome stops scrolling at ~33.5M pixels where as Edge tops out at ~1.5M pixels).
17
+ * After a certain position, the browser won't allow the user to scroll further (even via JavaScript scroll offset adjustments).
18
+ * This util picks a lower ceiling for max size and artificially adjusts positions within to make it transparent for users.
19
+ */
20
+ /**
21
+ * Extends CellSizeAndPositionManager and adds scaling behavior for lists that are too large to fit within a browser's native limits.
22
+ */
23
+ var ScalingCellSizeAndPositionManager = /*#__PURE__*/function () {
24
+ function ScalingCellSizeAndPositionManager(_ref) {
25
+ var _ref$maxScrollSize = _ref.maxScrollSize,
26
+ maxScrollSize = _ref$maxScrollSize === void 0 ? getMaxElementSize() : _ref$maxScrollSize,
27
+ params = _objectWithoutProperties(_ref, _excluded);
28
+ _classCallCheck(this, ScalingCellSizeAndPositionManager);
29
+ // Favor composition over inheritance to simplify IE10 support
30
+ this._cellSizeAndPositionManager = new CellSizeAndPositionManager(params);
31
+ this._maxScrollSize = maxScrollSize;
32
+ }
33
+ _createClass(ScalingCellSizeAndPositionManager, [{
34
+ key: "areOffsetsAdjusted",
35
+ value: function areOffsetsAdjusted() {
36
+ return this._cellSizeAndPositionManager.getTotalSize() > this._maxScrollSize;
37
+ }
38
+ }, {
39
+ key: "configure",
40
+ value: function configure(params) {
41
+ this._cellSizeAndPositionManager.configure(params);
42
+ }
43
+ }, {
44
+ key: "getCellCount",
45
+ value: function getCellCount() {
46
+ return this._cellSizeAndPositionManager.getCellCount();
47
+ }
48
+ }, {
49
+ key: "getEstimatedCellSize",
50
+ value: function getEstimatedCellSize() {
51
+ return this._cellSizeAndPositionManager.getEstimatedCellSize();
52
+ }
53
+ }, {
54
+ key: "getLastMeasuredIndex",
55
+ value: function getLastMeasuredIndex() {
56
+ return this._cellSizeAndPositionManager.getLastMeasuredIndex();
57
+ }
58
+
59
+ /**
60
+ * Number of pixels a cell at the given position (offset) should be shifted in order to fit within the scaled container.
61
+ * The offset passed to this function is scaled (safe) as well.
62
+ */
63
+ }, {
64
+ key: "getOffsetAdjustment",
65
+ value: function getOffsetAdjustment(_ref2) {
66
+ var containerSize = _ref2.containerSize,
67
+ offset = _ref2.offset;
68
+ var totalSize = this._cellSizeAndPositionManager.getTotalSize();
69
+ var safeTotalSize = this.getTotalSize();
70
+ var offsetPercentage = this._getOffsetPercentage({
71
+ containerSize: containerSize,
72
+ offset: offset,
73
+ totalSize: safeTotalSize
74
+ });
75
+ return Math.round(offsetPercentage * (safeTotalSize - totalSize));
76
+ }
77
+ }, {
78
+ key: "getSizeAndPositionOfCell",
79
+ value: function getSizeAndPositionOfCell(index) {
80
+ return this._cellSizeAndPositionManager.getSizeAndPositionOfCell(index);
81
+ }
82
+ }, {
83
+ key: "getSizeAndPositionOfLastMeasuredCell",
84
+ value: function getSizeAndPositionOfLastMeasuredCell() {
85
+ return this._cellSizeAndPositionManager.getSizeAndPositionOfLastMeasuredCell();
86
+ }
87
+
88
+ /** See CellSizeAndPositionManager#getTotalSize */
89
+ }, {
90
+ key: "getTotalSize",
91
+ value: function getTotalSize() {
92
+ return Math.min(this._maxScrollSize, this._cellSizeAndPositionManager.getTotalSize());
93
+ }
94
+
95
+ /** See CellSizeAndPositionManager#getUpdatedOffsetForIndex */
96
+ }, {
97
+ key: "getUpdatedOffsetForIndex",
98
+ value: function getUpdatedOffsetForIndex(_ref3) {
99
+ var _ref3$align = _ref3.align,
100
+ align = _ref3$align === void 0 ? 'auto' : _ref3$align,
101
+ containerSize = _ref3.containerSize,
102
+ currentOffset = _ref3.currentOffset,
103
+ targetIndex = _ref3.targetIndex;
104
+ currentOffset = this._safeOffsetToOffset({
105
+ containerSize: containerSize,
106
+ offset: currentOffset
107
+ });
108
+ var offset = this._cellSizeAndPositionManager.getUpdatedOffsetForIndex({
109
+ align: align,
110
+ containerSize: containerSize,
111
+ currentOffset: currentOffset,
112
+ targetIndex: targetIndex
113
+ });
114
+ return this._offsetToSafeOffset({
115
+ containerSize: containerSize,
116
+ offset: offset
117
+ });
118
+ }
119
+
120
+ /** See CellSizeAndPositionManager#getVisibleCellRange */
121
+ }, {
122
+ key: "getVisibleCellRange",
123
+ value: function getVisibleCellRange(_ref4) {
124
+ var containerSize = _ref4.containerSize,
125
+ offset = _ref4.offset;
126
+ offset = this._safeOffsetToOffset({
127
+ containerSize: containerSize,
128
+ offset: offset
129
+ });
130
+ return this._cellSizeAndPositionManager.getVisibleCellRange({
131
+ containerSize: containerSize,
132
+ offset: offset
133
+ });
134
+ }
135
+ }, {
136
+ key: "resetCell",
137
+ value: function resetCell(index) {
138
+ this._cellSizeAndPositionManager.resetCell(index);
139
+ }
140
+ }, {
141
+ key: "_getOffsetPercentage",
142
+ value: function _getOffsetPercentage(_ref5) {
143
+ var containerSize = _ref5.containerSize,
144
+ offset = _ref5.offset,
145
+ totalSize = _ref5.totalSize;
146
+ return totalSize <= containerSize ? 0 : offset / (totalSize - containerSize);
147
+ }
148
+ }, {
149
+ key: "_offsetToSafeOffset",
150
+ value: function _offsetToSafeOffset(_ref6) {
151
+ var containerSize = _ref6.containerSize,
152
+ offset = _ref6.offset;
153
+ var totalSize = this._cellSizeAndPositionManager.getTotalSize();
154
+ var safeTotalSize = this.getTotalSize();
155
+ if (totalSize === safeTotalSize) {
156
+ return offset;
157
+ } else {
158
+ var offsetPercentage = this._getOffsetPercentage({
159
+ containerSize: containerSize,
160
+ offset: offset,
161
+ totalSize: totalSize
162
+ });
163
+ return Math.round(offsetPercentage * (safeTotalSize - containerSize));
164
+ }
165
+ }
166
+ }, {
167
+ key: "_safeOffsetToOffset",
168
+ value: function _safeOffsetToOffset(_ref7) {
169
+ var containerSize = _ref7.containerSize,
170
+ offset = _ref7.offset;
171
+ var totalSize = this._cellSizeAndPositionManager.getTotalSize();
172
+ var safeTotalSize = this.getTotalSize();
173
+ if (totalSize === safeTotalSize) {
174
+ return offset;
175
+ } else {
176
+ var offsetPercentage = this._getOffsetPercentage({
177
+ containerSize: containerSize,
178
+ offset: offset,
179
+ totalSize: safeTotalSize
180
+ });
181
+ return Math.round(offsetPercentage * (totalSize - containerSize));
182
+ }
183
+ }
184
+ }]);
185
+ return ScalingCellSizeAndPositionManager;
186
+ }();
187
+ export { ScalingCellSizeAndPositionManager as default };
@@ -0,0 +1,24 @@
1
+ import type { Alignment, CellSize } from '../types.js';
2
+ import type ScalingCellSizeAndPositionManager from './scaling-cell-size-and-position-manager.js';
3
+ /**
4
+ * Helper function that determines when to update scroll offsets to ensure that a scroll-to-index remains visible.
5
+ * This function also ensures that the scroll ofset isn't past the last column/row of cells.
6
+ */
7
+ type Params = {
8
+ cellSize?: CellSize;
9
+ cellSizeAndPositionManager: ScalingCellSizeAndPositionManager;
10
+ previousCellsCount: number;
11
+ previousCellSize: CellSize;
12
+ previousScrollToAlignment: Alignment;
13
+ previousScrollToIndex: number;
14
+ previousSize: number;
15
+ scrollOffset: number;
16
+ scrollToAlignment: Alignment;
17
+ scrollToIndex: number;
18
+ size: number;
19
+ sizeJustIncreasedFromZero: boolean;
20
+ updateScrollIndexCallback: (index: number) => void;
21
+ };
22
+ export default function updateScrollIndexHelper({ cellSize, cellSizeAndPositionManager, previousCellsCount, previousCellSize, previousScrollToAlignment, previousScrollToIndex, previousSize, scrollOffset, scrollToAlignment, scrollToIndex, size, sizeJustIncreasedFromZero, updateScrollIndexCallback, }: Params): void;
23
+ export {};
24
+ //# sourceMappingURL=update-scroll-index-helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-scroll-index-helper.d.ts","sourceRoot":"","sources":["../../../src/grid/utils/update-scroll-index-helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,KAAK,iCAAiC,MAAM,6CAA6C,CAAC;AAEjG;;;GAGG;AAEH,KAAK,MAAM,GAAG;IAEZ,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAGpB,0BAA0B,EAAE,iCAAiC,CAAC;IAG9D,kBAAkB,EAAE,MAAM,CAAC;IAG3B,gBAAgB,EAAE,QAAQ,CAAC;IAE3B,yBAAyB,EAAE,SAAS,CAAC;IAGrC,qBAAqB,EAAE,MAAM,CAAC;IAG9B,YAAY,EAAE,MAAM,CAAC;IAGrB,YAAY,EAAE,MAAM,CAAC;IAErB,iBAAiB,EAAE,SAAS,CAAC;IAG7B,aAAa,EAAE,MAAM,CAAC;IAGtB,IAAI,EAAE,MAAM,CAAC;IAEb,yBAAyB,EAAE,OAAO,CAAC;IAGnC,yBAAyB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpD,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,EAC9C,QAAQ,EACR,0BAA0B,EAC1B,kBAAkB,EAClB,gBAAgB,EAChB,yBAAyB,EACzB,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,IAAI,EACJ,yBAAyB,EACzB,yBAAyB,GAC1B,EAAE,MAAM,QAkCR"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Helper function that determines when to update scroll offsets to ensure that a scroll-to-index remains visible.
3
+ * This function also ensures that the scroll ofset isn't past the last column/row of cells.
4
+ */
5
+
6
+ export default function updateScrollIndexHelper(_ref) {
7
+ var cellSize = _ref.cellSize,
8
+ cellSizeAndPositionManager = _ref.cellSizeAndPositionManager,
9
+ previousCellsCount = _ref.previousCellsCount,
10
+ previousCellSize = _ref.previousCellSize,
11
+ previousScrollToAlignment = _ref.previousScrollToAlignment,
12
+ previousScrollToIndex = _ref.previousScrollToIndex,
13
+ previousSize = _ref.previousSize,
14
+ scrollOffset = _ref.scrollOffset,
15
+ scrollToAlignment = _ref.scrollToAlignment,
16
+ scrollToIndex = _ref.scrollToIndex,
17
+ size = _ref.size,
18
+ sizeJustIncreasedFromZero = _ref.sizeJustIncreasedFromZero,
19
+ updateScrollIndexCallback = _ref.updateScrollIndexCallback;
20
+ var cellCount = cellSizeAndPositionManager.getCellCount();
21
+ var hasScrollToIndex = scrollToIndex >= 0 && scrollToIndex < cellCount;
22
+ var sizeHasChanged = size !== previousSize || sizeJustIncreasedFromZero || !previousCellSize || typeof cellSize === 'number' && cellSize !== previousCellSize;
23
+
24
+ // If we have a new scroll target OR if height/row-height has changed,
25
+ // We should ensure that the scroll target is visible.
26
+ if (hasScrollToIndex && (sizeHasChanged || scrollToAlignment !== previousScrollToAlignment || scrollToIndex !== previousScrollToIndex)) {
27
+ updateScrollIndexCallback(scrollToIndex);
28
+
29
+ // If we don't have a selected item but list size or number of children have decreased,
30
+ // Make sure we aren't scrolled too far past the current content.
31
+ } else if (!hasScrollToIndex && cellCount > 0 && (size < previousSize || cellCount < previousCellsCount)) {
32
+ // We need to ensure that the current scroll offset is still within the collection's range.
33
+ // To do this, we don't need to measure everything; CellMeasurer would perform poorly.
34
+ // Just check to make sure we're still okay.
35
+ // Only adjust the scroll position if we've scrolled below the last set of rows.
36
+ if (scrollOffset > cellSizeAndPositionManager.getTotalSize() - size) {
37
+ updateScrollIndexCallback(cellCount - 1);
38
+ }
39
+ }
40
+ }
package/es/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export * from './auto-sizer/index.js';
2
+ export * from './cell-measurer/index.js';
3
+ export * from './grid/index.js';
4
+ export * from './list/index.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
package/es/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./auto-sizer/index.js";
2
+ export * from "./cell-measurer/index.js";
3
+ export * from "./grid/index.js";
4
+ export * from "./list/index.js";
@@ -0,0 +1,3 @@
1
+ export { default, default as List } from './list.js';
2
+ export type { RowRendererParams } from './types.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/list/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC;AACrD,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1 @@
1
+ export { default, default as List } from "./list.js";
@@ -0,0 +1,109 @@
1
+ import * as React from 'react';
2
+ import type { Alignment, CellPosition, CellRendererParams, CellSize, NoContentRenderer, OverscanIndicesGetter, RenderedSection, Scroll as GridScroll } from '../grid/index.js';
3
+ import Grid, { accessibilityOverscanIndicesGetter } from '../grid/index.js';
4
+ import type { RenderedRows, RowRenderer, Scroll } from './types.js';
5
+ /**
6
+ * It is inefficient to create and manage a large list of DOM elements within a scrolling container
7
+ * if only a few of those elements are visible. The primary purpose of this component is to improve
8
+ * performance by only rendering the DOM nodes that a user is able to see based on their current
9
+ * scroll position.
10
+ *
11
+ * This component renders a virtualized list of elements with either fixed or dynamic heights.
12
+ */
13
+ type Props = {
14
+ 'aria-label'?: string;
15
+ /**
16
+ * Removes fixed height from the scrollingContainer so that the total height
17
+ * of rows can stretch the window. Intended for use with WindowScroller
18
+ */
19
+ autoHeight: boolean;
20
+ /** Optional CSS class name */
21
+ className?: string;
22
+ /**
23
+ * Used to estimate the total height of a List before all of its rows have actually been measured.
24
+ * The estimated total height is adjusted as rows are rendered.
25
+ */
26
+ estimatedRowSize: number;
27
+ /** Height constraint for list (determines how many actual rows are rendered) */
28
+ height: number;
29
+ /** Optional renderer to be used in place of rows when rowCount is 0 */
30
+ noRowsRenderer: NoContentRenderer;
31
+ /** Callback invoked with information about the slice of rows that were just rendered. */
32
+ onRowsRendered: (params: RenderedRows) => void;
33
+ /**
34
+ * Callback invoked whenever the scroll offset changes within the inner scrollable region.
35
+ * This callback can be used to sync scrolling between lists, tables, or grids.
36
+ */
37
+ onScroll: (params: Scroll) => void;
38
+ /** See Grid#overscanIndicesGetter */
39
+ overscanIndicesGetter: OverscanIndicesGetter;
40
+ /**
41
+ * Number of rows to render above/below the visible bounds of the list.
42
+ * These rows can help for smoother scrolling on touch devices.
43
+ */
44
+ overscanRowCount: number;
45
+ /** Either a fixed row height (number) or a function that returns the height of a row given its index. */
46
+ rowHeight: CellSize;
47
+ /** Responsible for rendering a row given an index; ({ index: number }): node */
48
+ rowRenderer: RowRenderer;
49
+ /** Number of rows in list. */
50
+ rowCount: number;
51
+ /** See Grid#scrollToAlignment */
52
+ scrollToAlignment: Alignment;
53
+ /** Row index to ensure visible (by forcefully scrolling if necessary) */
54
+ scrollToIndex: number;
55
+ /** Vertical offset. */
56
+ scrollTop?: number;
57
+ /** Optional inline style */
58
+ style: any;
59
+ /** Tab index for focus */
60
+ tabIndex?: number;
61
+ /** Width of list */
62
+ width: number;
63
+ cellsHeight: number[];
64
+ editorsOffset: number[];
65
+ editorAreaHeight: number[];
66
+ totalSize: number;
67
+ noEditorArea: React.ReactElement;
68
+ };
69
+ export default class List extends React.PureComponent<Props> {
70
+ static defaultProps: {
71
+ autoHeight: boolean;
72
+ estimatedRowSize: number;
73
+ onScroll: () => void;
74
+ noRowsRenderer: () => null;
75
+ onRowsRendered: () => void;
76
+ overscanIndicesGetter: typeof accessibilityOverscanIndicesGetter;
77
+ overscanRowCount: number;
78
+ scrollToAlignment: string;
79
+ scrollToIndex: number;
80
+ style: {};
81
+ };
82
+ Grid?: React.ElementRef<typeof Grid> | null;
83
+ forceUpdateGrid(): void;
84
+ /** See Grid#getOffsetForCell */
85
+ getOffsetForRow({ alignment, index }: {
86
+ alignment: Alignment;
87
+ index: number;
88
+ }): number;
89
+ /** CellMeasurer compatibility */
90
+ invalidateCellSizeAfterRender({ columnIndex, rowIndex }: CellPosition): void;
91
+ /** See Grid#measureAllCells */
92
+ measureAllRows(): void;
93
+ /** CellMeasurer compatibility */
94
+ recomputeGridSize({ columnIndex, rowIndex }?: CellPosition): void;
95
+ /** See Grid#recomputeGridSize */
96
+ recomputeRowHeights(index?: number): void;
97
+ scrollToLine(cellIndex?: number, lineIndex?: number): void;
98
+ /** See Grid#scrollToPosition */
99
+ scrollToPosition(scrollTop?: number): void;
100
+ /** See Grid#scrollToCell */
101
+ scrollToRow(index?: number): void;
102
+ render(): import("react/jsx-runtime").JSX.Element;
103
+ _cellRenderer: ({ parent, rowIndex, style, isScrolling, isVisible, key, }: CellRendererParams) => React.ReactNode;
104
+ _setRef: (ref: React.ElementRef<typeof Grid> | null) => void;
105
+ _onScroll: ({ clientHeight, scrollHeight, scrollTop }: GridScroll) => void;
106
+ _onSectionRendered: ({ rowOverscanStartIndex, rowOverscanStopIndex, rowStartIndex, rowStopIndex, }: RenderedSection) => void;
107
+ }
108
+ export {};
109
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/list/list.tsx"],"names":[],"mappings":"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"}
@@ -0,0 +1,261 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
7
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
9
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
10
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
11
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
13
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
14
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
15
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
16
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
17
+ import classNames from 'classnames';
18
+ import * as React from 'react';
19
+ import Grid, { accessibilityOverscanIndicesGetter } from "../grid/index.js";
20
+
21
+ /**
22
+ * It is inefficient to create and manage a large list of DOM elements within a scrolling container
23
+ * if only a few of those elements are visible. The primary purpose of this component is to improve
24
+ * performance by only rendering the DOM nodes that a user is able to see based on their current
25
+ * scroll position.
26
+ *
27
+ * This component renders a virtualized list of elements with either fixed or dynamic heights.
28
+ */
29
+ import { jsx as _jsx } from "react/jsx-runtime";
30
+ var List = /*#__PURE__*/function (_React$PureComponent) {
31
+ _inherits(List, _React$PureComponent);
32
+ var _super = _createSuper(List);
33
+ function List() {
34
+ var _this;
35
+ _classCallCheck(this, List);
36
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
37
+ args[_key] = arguments[_key];
38
+ }
39
+ _this = _super.call.apply(_super, [this].concat(args));
40
+ _this._cellRenderer = function (_ref) {
41
+ var parent = _ref.parent,
42
+ rowIndex = _ref.rowIndex,
43
+ style = _ref.style,
44
+ isScrolling = _ref.isScrolling,
45
+ isVisible = _ref.isVisible,
46
+ key = _ref.key;
47
+ var rowRenderer = _this.props.rowRenderer;
48
+
49
+ // TRICKY The style object is sometimes cached by Grid.
50
+ // This prevents new style objects from bypassing shallowCompare().
51
+ // However as of React 16, style props are auto-frozen (at least in dev mode)
52
+ // Check to make sure we can still modify the style before proceeding.
53
+ // https://github.com/facebook/react/commit/977357765b44af8ff0cfea327866861073095c12#commitcomment-20648713
54
+ // const { writable } = Object.getOwnPropertyDescriptor(style, 'width');
55
+ // if (writable) {
56
+ // // By default, List cells should be 100% width.
57
+ // // This prevents them from flowing under a scrollbar (if present).
58
+ // style.width = '100%';
59
+ // }
60
+
61
+ return rowRenderer({
62
+ index: rowIndex,
63
+ style: style,
64
+ isScrolling: isScrolling,
65
+ isVisible: isVisible,
66
+ key: key,
67
+ parent: parent
68
+ });
69
+ };
70
+ _this._setRef = function (ref) {
71
+ _this.Grid = ref;
72
+ };
73
+ _this._onScroll = function (_ref2) {
74
+ var clientHeight = _ref2.clientHeight,
75
+ scrollHeight = _ref2.scrollHeight,
76
+ scrollTop = _ref2.scrollTop;
77
+ var onScroll = _this.props.onScroll;
78
+ onScroll({
79
+ clientHeight: clientHeight,
80
+ scrollHeight: scrollHeight,
81
+ scrollTop: scrollTop
82
+ });
83
+ };
84
+ _this._onSectionRendered = function (_ref3) {
85
+ var rowOverscanStartIndex = _ref3.rowOverscanStartIndex,
86
+ rowOverscanStopIndex = _ref3.rowOverscanStopIndex,
87
+ rowStartIndex = _ref3.rowStartIndex,
88
+ rowStopIndex = _ref3.rowStopIndex;
89
+ var onRowsRendered = _this.props.onRowsRendered;
90
+ onRowsRendered({
91
+ overscanStartIndex: rowOverscanStartIndex,
92
+ overscanStopIndex: rowOverscanStopIndex,
93
+ startIndex: rowStartIndex,
94
+ stopIndex: rowStopIndex
95
+ });
96
+ };
97
+ return _this;
98
+ }
99
+ _createClass(List, [{
100
+ key: "forceUpdateGrid",
101
+ value: function forceUpdateGrid() {
102
+ if (this.Grid) {
103
+ this.Grid.forceUpdate();
104
+ }
105
+ }
106
+
107
+ /** See Grid#getOffsetForCell */
108
+ }, {
109
+ key: "getOffsetForRow",
110
+ value: function getOffsetForRow(_ref4) {
111
+ var alignment = _ref4.alignment,
112
+ index = _ref4.index;
113
+ if (this.Grid) {
114
+ var _this$Grid$getOffsetF = this.Grid.getOffsetForCell({
115
+ alignment: alignment,
116
+ rowIndex: index,
117
+ columnIndex: 0
118
+ }),
119
+ scrollTop = _this$Grid$getOffsetF.scrollTop;
120
+ return scrollTop;
121
+ }
122
+ return 0;
123
+ }
124
+
125
+ /** CellMeasurer compatibility */
126
+ }, {
127
+ key: "invalidateCellSizeAfterRender",
128
+ value: function invalidateCellSizeAfterRender(_ref5) {
129
+ var columnIndex = _ref5.columnIndex,
130
+ rowIndex = _ref5.rowIndex;
131
+ if (this.Grid) {
132
+ this.Grid.invalidateCellSizeAfterRender({
133
+ rowIndex: rowIndex,
134
+ columnIndex: columnIndex
135
+ });
136
+ }
137
+ }
138
+
139
+ /** See Grid#measureAllCells */
140
+ }, {
141
+ key: "measureAllRows",
142
+ value: function measureAllRows() {
143
+ if (this.Grid) {
144
+ this.Grid.measureAllCells();
145
+ }
146
+ }
147
+
148
+ /** CellMeasurer compatibility */
149
+ }, {
150
+ key: "recomputeGridSize",
151
+ value: function recomputeGridSize() {
152
+ var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
153
+ columnIndex: 0,
154
+ rowIndex: 0
155
+ },
156
+ _ref6$columnIndex = _ref6.columnIndex,
157
+ columnIndex = _ref6$columnIndex === void 0 ? 0 : _ref6$columnIndex,
158
+ _ref6$rowIndex = _ref6.rowIndex,
159
+ rowIndex = _ref6$rowIndex === void 0 ? 0 : _ref6$rowIndex;
160
+ if (this.Grid) {
161
+ this.Grid.recomputeGridSize({
162
+ rowIndex: rowIndex,
163
+ columnIndex: columnIndex
164
+ });
165
+ }
166
+ }
167
+
168
+ /** See Grid#recomputeGridSize */
169
+ }, {
170
+ key: "recomputeRowHeights",
171
+ value: function recomputeRowHeights() {
172
+ var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
173
+ if (this.Grid) {
174
+ this.Grid.recomputeGridSize({
175
+ rowIndex: index,
176
+ columnIndex: 0
177
+ });
178
+ }
179
+ }
180
+ }, {
181
+ key: "scrollToLine",
182
+ value: function scrollToLine() {
183
+ var cellIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
184
+ var lineIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
185
+ if (this.Grid) {
186
+ this.Grid.scrollToLine({
187
+ cellIndex: cellIndex,
188
+ lineIndex: lineIndex
189
+ });
190
+ }
191
+ }
192
+
193
+ /** See Grid#scrollToPosition */
194
+ }, {
195
+ key: "scrollToPosition",
196
+ value: function scrollToPosition() {
197
+ var scrollTop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
198
+ if (this.Grid) {
199
+ this.Grid.scrollToPosition({
200
+ scrollTop: scrollTop
201
+ });
202
+ }
203
+ }
204
+
205
+ /** See Grid#scrollToCell */
206
+ }, {
207
+ key: "scrollToRow",
208
+ value: function scrollToRow() {
209
+ var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
210
+ if (this.Grid) {
211
+ this.Grid.scrollToCell({
212
+ columnIndex: 0,
213
+ rowIndex: index
214
+ });
215
+ }
216
+ }
217
+ }, {
218
+ key: "render",
219
+ value: function render() {
220
+ var _this$props = this.props,
221
+ className = _this$props.className,
222
+ noRowsRenderer = _this$props.noRowsRenderer,
223
+ scrollToIndex = _this$props.scrollToIndex,
224
+ width = _this$props.width;
225
+ return /*#__PURE__*/_jsx(Grid, _objectSpread(_objectSpread({
226
+ resizeObserver: {}
227
+ }, this.props), {}, {
228
+ autoContainerWidth: true,
229
+ cellRenderer: this._cellRenderer,
230
+ className: classNames('ReactVirtualized__List', className),
231
+ columnWidth: width,
232
+ columnCount: 1,
233
+ noContentRenderer: noRowsRenderer,
234
+ onScroll: this._onScroll,
235
+ onSectionRendered: this._onSectionRendered,
236
+ ref: this._setRef,
237
+ scrollToRow: scrollToIndex
238
+ }));
239
+ }
240
+ }]);
241
+ return List;
242
+ }(React.PureComponent);
243
+ List.defaultProps = {
244
+ autoHeight: false,
245
+ estimatedRowSize: 30,
246
+ onScroll: function onScroll() {
247
+ //
248
+ },
249
+ noRowsRenderer: function noRowsRenderer() {
250
+ return null;
251
+ },
252
+ onRowsRendered: function onRowsRendered() {
253
+ //
254
+ },
255
+ overscanIndicesGetter: accessibilityOverscanIndicesGetter,
256
+ overscanRowCount: 10,
257
+ scrollToAlignment: 'auto',
258
+ scrollToIndex: -1,
259
+ style: {}
260
+ };
261
+ export { List as default };