virtual-scroller 1.15.0 → 1.15.1
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/CHANGELOG.md +6 -0
- package/README.md +98 -8
- package/bundle/index-dom-bypass.html +3 -4
- package/bundle/index-dom-grid.html +3 -4
- package/bundle/index-dom-scrollableContainer.html +3 -4
- package/bundle/index-dom.html +3 -4
- package/bundle/index-react-bypass.html +56 -62
- package/bundle/index-react-grid.html +55 -61
- package/bundle/index-react-hook.html +209 -0
- package/bundle/index-react-scrollableContainer.html +56 -62
- package/bundle/index-react-strictMode.html +55 -61
- package/bundle/index-react-tbody-scrollableContainer.html +13 -15
- package/bundle/index-react-tbody.html +10 -12
- package/bundle/virtual-scroller-dom.js +1 -1
- package/bundle/virtual-scroller-dom.js.map +1 -1
- package/bundle/virtual-scroller-react.js +1 -1
- package/bundle/virtual-scroller-react.js.map +1 -1
- package/bundle/virtual-scroller.js +1 -1
- package/bundle/virtual-scroller.js.map +1 -1
- package/commonjs/react/VirtualScroller.js +69 -127
- package/commonjs/react/VirtualScroller.js.map +1 -1
- package/commonjs/react/useCreateVirtualScroller.js +64 -0
- package/commonjs/react/useCreateVirtualScroller.js.map +1 -0
- package/commonjs/react/useInstanceMethods.js +2 -2
- package/commonjs/react/useInstanceMethods.js.map +1 -1
- package/commonjs/react/useMergeRefs.js +52 -0
- package/commonjs/react/useMergeRefs.js.map +1 -0
- package/commonjs/react/{useVirtualScrollerStartStop.js → useStartStopVirtualScroller.js} +1 -1
- package/commonjs/react/{useVirtualScrollerStartStop.js.map → useStartStopVirtualScroller.js.map} +1 -1
- package/commonjs/react/useStyle.js +18 -0
- package/commonjs/react/useStyle.js.map +1 -1
- package/commonjs/react/useVirtualScroller.js +142 -43
- package/commonjs/react/useVirtualScroller.js.map +1 -1
- package/modules/react/VirtualScroller.js +68 -119
- package/modules/react/VirtualScroller.js.map +1 -1
- package/modules/react/useCreateVirtualScroller.js +53 -0
- package/modules/react/useCreateVirtualScroller.js.map +1 -0
- package/modules/react/useInstanceMethods.js +2 -2
- package/modules/react/useInstanceMethods.js.map +1 -1
- package/modules/react/useMergeRefs.js +44 -0
- package/modules/react/useMergeRefs.js.map +1 -0
- package/modules/react/{useVirtualScrollerStartStop.js → useStartStopVirtualScroller.js} +1 -1
- package/modules/react/{useVirtualScrollerStartStop.js.map → useStartStopVirtualScroller.js.map} +1 -1
- package/modules/react/useStyle.js +17 -0
- package/modules/react/useStyle.js.map +1 -1
- package/modules/react/useVirtualScroller.js +136 -43
- package/modules/react/useVirtualScroller.js.map +1 -1
- package/package.json +4 -1
- package/react/index.cjs +2 -1
- package/react/index.d.ts +51 -7
- package/react/index.js +1 -0
- package/rollup.config.mjs +15 -1
- package/source/react/VirtualScroller.js +66 -127
- package/source/react/useCreateVirtualScroller.js +65 -0
- package/source/react/useInstanceMethods.js +2 -2
- package/source/react/useMergeRefs.js +45 -0
- package/source/react/useStyle.js +15 -0
- package/source/react/useVirtualScroller.js +155 -48
- package/website/index-dom-bypass.html +3 -4
- package/website/index-dom-grid.html +3 -4
- package/website/index-dom-scrollableContainer.html +3 -4
- package/website/index-dom.html +3 -4
- package/website/index-react-bypass.html +56 -62
- package/website/index-react-grid.html +55 -61
- package/website/index-react-hook.html +209 -0
- package/website/index-react-scrollableContainer.html +56 -62
- package/website/index-react-strictMode.html +55 -61
- package/website/index-react-tbody-scrollableContainer.html +13 -15
- package/website/index-react-tbody.html +10 -12
- package/website/index-react.html +55 -61
- package/website/index.html +55 -61
- package/commonjs/react/useForwardedRef.js +0 -50
- package/commonjs/react/useForwardedRef.js.map +0 -1
- package/modules/react/useForwardedRef.js +0 -42
- package/modules/react/useForwardedRef.js.map +0 -1
- package/source/react/useForwardedRef.js +0 -39
- /package/source/react/{useVirtualScrollerStartStop.js → useStartStopVirtualScroller.js} +0 -0
|
@@ -11,13 +11,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
var _useVirtualScroller = _interopRequireDefault(require("./useVirtualScroller.js"));
|
|
17
|
-
|
|
18
|
-
var _useVirtualScrollerStartStop = _interopRequireDefault(require("./useVirtualScrollerStartStop.js"));
|
|
19
|
-
|
|
20
|
-
var _useInstanceMethods = _interopRequireDefault(require("./useInstanceMethods.js"));
|
|
14
|
+
var _useVirtualScroller2 = _interopRequireDefault(require("./useVirtualScroller.js"));
|
|
21
15
|
|
|
22
16
|
var _useItemKeys2 = _interopRequireDefault(require("./useItemKeys.js"));
|
|
23
17
|
|
|
@@ -25,21 +19,15 @@ var _useSetItemState = _interopRequireDefault(require("./useSetItemState.js"));
|
|
|
25
19
|
|
|
26
20
|
var _useOnItemHeightDidChange = _interopRequireDefault(require("./useOnItemHeightDidChange.js"));
|
|
27
21
|
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
var _useUpdateItemKeysOnItemsChange = _interopRequireDefault(require("./useUpdateItemKeysOnItemsChange.js"));
|
|
31
|
-
|
|
32
|
-
var _useValidateTableBodyItemsContainer = _interopRequireDefault(require("./useValidateTableBodyItemsContainer.js"));
|
|
33
|
-
|
|
34
|
-
var _useForwardedRef2 = _interopRequireDefault(require("./useForwardedRef.js"));
|
|
22
|
+
var _useMergeRefs = _interopRequireDefault(require("./useMergeRefs.js"));
|
|
35
23
|
|
|
36
|
-
var
|
|
24
|
+
var _useInstanceMethods = _interopRequireDefault(require("./useInstanceMethods.js"));
|
|
37
25
|
|
|
38
|
-
var
|
|
26
|
+
var _useUpdateItemKeysOnItemsChange = _interopRequireDefault(require("./useUpdateItemKeysOnItemsChange.js"));
|
|
39
27
|
|
|
40
28
|
var _debug = require("../utility/debug.js");
|
|
41
29
|
|
|
42
|
-
var _excluded = ["as", "items", "itemComponent", "itemComponentProps", "itemsContainerComponent", "itemsContainerComponentProps", "itemsContainerRef", "
|
|
30
|
+
var _excluded = ["as", "items", "itemComponent", "itemComponentProps", "itemsContainerComponent", "itemsContainerComponentProps", "itemsContainerRef", "onMount", "tbody", "readyToStart", "className", "bypass", "preserveScrollPosition", "preserveScrollPositionOnPrependItems", "measureItemsBatchSize", "scrollableContainer", "getScrollableContainer", "getColumnsCount", "getItemId", "onItemFirstRender", "onItemInitialRender", "initialScrollPosition", "onScrollPositionChange", "initialState", "getInitialItemState", "onStateChange", "estimatedItemHeight", "getEstimatedItemHeight", "getEstimatedVisibleItemRowsCount", "getEstimatedInterItemVerticalSpacing"];
|
|
43
31
|
|
|
44
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
45
33
|
|
|
@@ -53,16 +41,6 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
53
41
|
|
|
54
42
|
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; }
|
|
55
43
|
|
|
56
|
-
// When `items` property changes:
|
|
57
|
-
// * A new `items` property is supplied to the React component.
|
|
58
|
-
// * The React component re-renders itself.
|
|
59
|
-
// * `useSetNewItemsOnItemsPropertyChange()` hook is run.
|
|
60
|
-
// * `useSetNewItemsOnItemsPropertyChange()` hook detects that the `items` property
|
|
61
|
-
// has changed and calls `VirtualScroller.setItems(items)`.
|
|
62
|
-
// * `VirtualScroller.setItems(items)` calls `VirtualScroller.setState()`.
|
|
63
|
-
// * `VirtualScroller.setState()` calls the `setState()` function.
|
|
64
|
-
// * The `setState()` function calls a setter from a `useState()` hook.
|
|
65
|
-
// * The React component re-renders itself the second time.
|
|
66
44
|
function VirtualScroller(_ref, ref) {
|
|
67
45
|
var as = _ref.as,
|
|
68
46
|
itemsProperty = _ref.items,
|
|
@@ -70,11 +48,7 @@ function VirtualScroller(_ref, ref) {
|
|
|
70
48
|
itemComponentProps = _ref.itemComponentProps,
|
|
71
49
|
ItemsContainerComponent = _ref.itemsContainerComponent,
|
|
72
50
|
itemsContainerComponentProps = _ref.itemsContainerComponentProps,
|
|
73
|
-
|
|
74
|
-
estimatedItemHeight = _ref.estimatedItemHeight,
|
|
75
|
-
getEstimatedItemHeight = _ref.getEstimatedItemHeight,
|
|
76
|
-
getEstimatedVisibleItemRowsCount = _ref.getEstimatedVisibleItemRowsCount,
|
|
77
|
-
getEstimatedInterItemVerticalSpacing = _ref.getEstimatedInterItemVerticalSpacing,
|
|
51
|
+
itemsContainerRefProperty = _ref.itemsContainerRef,
|
|
78
52
|
onMount = _ref.onMount,
|
|
79
53
|
tbody = _ref.tbody,
|
|
80
54
|
readyToStart = _ref.readyToStart,
|
|
@@ -94,6 +68,10 @@ function VirtualScroller(_ref, ref) {
|
|
|
94
68
|
initialState = _ref.initialState,
|
|
95
69
|
getInitialItemState = _ref.getInitialItemState,
|
|
96
70
|
onStateChange = _ref.onStateChange,
|
|
71
|
+
estimatedItemHeight = _ref.estimatedItemHeight,
|
|
72
|
+
getEstimatedItemHeight = _ref.getEstimatedItemHeight,
|
|
73
|
+
getEstimatedVisibleItemRowsCount = _ref.getEstimatedVisibleItemRowsCount,
|
|
74
|
+
getEstimatedInterItemVerticalSpacing = _ref.getEstimatedInterItemVerticalSpacing,
|
|
97
75
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
98
76
|
|
|
99
77
|
// Previously, `as` property was being used instead of `itemsContainerComponent`,
|
|
@@ -102,47 +80,34 @@ function VirtualScroller(_ref, ref) {
|
|
|
102
80
|
// The default `"div"` fallback value is just a legacy compatibility relic, and so is the `as` property.
|
|
103
81
|
if (!ItemsContainerComponent) {
|
|
104
82
|
ItemsContainerComponent = as || 'div';
|
|
105
|
-
} //
|
|
106
|
-
// Instead, it always derived `tbody` property value from `as` property value by comparing it to `"tbody"` string.
|
|
107
|
-
// As a result, it seemed like the explicit passing of `tbody` property didn't really work as intended.
|
|
108
|
-
// In the end, it was decided that perhaps `tbody` property value should always be derived from `as` property
|
|
109
|
-
// without a developer having to manually specify it. So the `tbody` property was deprecated.
|
|
110
|
-
// It still exists though for backwards compatibility with the older versions of the package.
|
|
83
|
+
} // In simple cases, the use of a `<tbody/>` tag as an items container component could be auto-detected.
|
|
111
84
|
|
|
112
85
|
|
|
113
86
|
if (tbody === undefined) {
|
|
114
|
-
// `tbody` should
|
|
87
|
+
// `tbody` auto-detection should happen before any DOM Elements have been mounted,
|
|
88
|
+
// i.e. it can't rely on the trivial `getItemsContainerElement().tagName === 'TBODY'` check.
|
|
115
89
|
// This is because during Server-Side Render there's no DOM Elements tree at all.
|
|
116
90
|
// And server-sider render result is required to be exactly the same as client-side render result.
|
|
117
91
|
// This means that `tbody` detection for the purposes of getting the initial
|
|
118
92
|
// `className` or `style` property values must not rely on any DOM Elements at all,
|
|
119
93
|
// and should use some other means such as explicitly passing a `tbody: true` property
|
|
120
|
-
//
|
|
121
|
-
// `itemsContainerCompoent` property value.
|
|
94
|
+
// or detecting `<tbody/>` tag usage from the `itemsContainerCompoent` property value.
|
|
122
95
|
tbody = ItemsContainerComponent === 'tbody';
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
var _useForwardedRef = (0, _useForwardedRef2["default"])(itemsContainerRef),
|
|
127
|
-
setItemsContainerRef = _useForwardedRef.setRef,
|
|
128
|
-
itemsContainer = _useForwardedRef.internalRef; // Create a `VirtualScroller` instance.
|
|
96
|
+
}
|
|
129
97
|
|
|
130
|
-
|
|
131
|
-
var virtualScroller = (0, _useVirtualScroller["default"])({
|
|
98
|
+
var _useVirtualScroller = (0, _useVirtualScroller2["default"])({
|
|
132
99
|
items: itemsProperty,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
100
|
+
tbody: tbody,
|
|
101
|
+
readyToStart: readyToStart,
|
|
102
|
+
style: itemsContainerComponentProps && itemsContainerComponentProps.style,
|
|
103
|
+
className: classNameProperty || itemsContainerComponentProps && itemsContainerComponentProps.className,
|
|
104
|
+
// The following are the "core" component options.
|
|
105
|
+
//
|
|
139
106
|
bypass: bypass,
|
|
140
|
-
//
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
initialScrollPosition: initialScrollPosition,
|
|
145
|
-
onScrollPositionChange: onScrollPositionChange,
|
|
107
|
+
// `preserveScrollPosition` property name is deprecated,
|
|
108
|
+
// use `preserveScrollPositionOnPrependItems` property instead.
|
|
109
|
+
preserveScrollPosition: preserveScrollPosition,
|
|
110
|
+
preserveScrollPositionOnPrependItems: preserveScrollPositionOnPrependItems,
|
|
146
111
|
measureItemsBatchSize: measureItemsBatchSize,
|
|
147
112
|
// `scrollableContainer` property is deprecated.
|
|
148
113
|
// Use `getScrollableContainer()` property instead.
|
|
@@ -150,39 +115,30 @@ function VirtualScroller(_ref, ref) {
|
|
|
150
115
|
getScrollableContainer: getScrollableContainer,
|
|
151
116
|
getColumnsCount: getColumnsCount,
|
|
152
117
|
getItemId: getItemId,
|
|
118
|
+
// `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.
|
|
119
|
+
onItemFirstRender: onItemFirstRender,
|
|
120
|
+
onItemInitialRender: onItemInitialRender,
|
|
121
|
+
initialScrollPosition: initialScrollPosition,
|
|
122
|
+
onScrollPositionChange: onScrollPositionChange,
|
|
153
123
|
initialState: initialState,
|
|
154
124
|
getInitialItemState: getInitialItemState,
|
|
155
|
-
onStateChange: onStateChange
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
125
|
+
onStateChange: onStateChange,
|
|
126
|
+
getEstimatedItemHeight: getEstimatedItemHeight || ( // `estimatedItemHeight` property name is deprecated,
|
|
127
|
+
// use `getEstimatedItemHeight` property instead.
|
|
128
|
+
typeof estimatedItemHeight === 'number' ? function () {
|
|
129
|
+
return estimatedItemHeight;
|
|
130
|
+
} : undefined),
|
|
131
|
+
getEstimatedVisibleItemRowsCount: getEstimatedVisibleItemRowsCount,
|
|
132
|
+
getEstimatedInterItemVerticalSpacing: getEstimatedInterItemVerticalSpacing
|
|
133
|
+
}),
|
|
134
|
+
stateToRender = _useVirtualScroller.state,
|
|
135
|
+
style = _useVirtualScroller.style,
|
|
136
|
+
className = _useVirtualScroller.className,
|
|
137
|
+
itemsContainerRef = _useVirtualScroller.itemsContainerRef,
|
|
138
|
+
virtualScroller = _useVirtualScroller.virtualScroller; // List items "container" DOM Element reference.
|
|
164
139
|
|
|
165
140
|
|
|
166
|
-
var
|
|
167
|
-
initialState: _initialState,
|
|
168
|
-
onRender: virtualScroller.onRender
|
|
169
|
-
}),
|
|
170
|
-
getState = _useState.getState,
|
|
171
|
-
setState = _useState.setState,
|
|
172
|
-
stateToRender = _useState.stateToRender; // Use custom (external) state storage in the `VirtualScroller`.
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
(0, _react.useMemo)(function () {
|
|
176
|
-
virtualScroller.useState({
|
|
177
|
-
getState: getState,
|
|
178
|
-
setState: setState
|
|
179
|
-
});
|
|
180
|
-
}, []); // Start `VirtualScroller` on mount.
|
|
181
|
-
// Stop `VirtualScroller` on unmount.
|
|
182
|
-
|
|
183
|
-
(0, _useVirtualScrollerStartStop["default"])(virtualScroller, {
|
|
184
|
-
readyToStart: readyToStart
|
|
185
|
-
}); // List items are rendered with `key`s so that React doesn't
|
|
141
|
+
var setItemsContainerRef = (0, _useMergeRefs["default"])(itemsContainerRef, itemsContainerRefProperty); // List items are rendered with `key`s so that React doesn't
|
|
186
142
|
// "reuse" `itemComponent`s in cases when `items` are changed.
|
|
187
143
|
|
|
188
144
|
var _useItemKeys = (0, _useItemKeys2["default"])({
|
|
@@ -191,9 +147,15 @@ function VirtualScroller(_ref, ref) {
|
|
|
191
147
|
getItemKey = _useItemKeys.getItemKey,
|
|
192
148
|
onItemKeysReset = _useItemKeys.onItemKeysReset,
|
|
193
149
|
usesAutogeneratedItemKeys = _useItemKeys.usesAutogeneratedItemKeys,
|
|
194
|
-
updateItemKeysForNewItems = _useItemKeys.updateItemKeysForNewItems; //
|
|
195
|
-
|
|
150
|
+
updateItemKeysForNewItems = _useItemKeys.updateItemKeysForNewItems; // Updates `key`s if item indexes have changed.
|
|
151
|
+
|
|
196
152
|
|
|
153
|
+
(0, _useUpdateItemKeysOnItemsChange["default"])(stateToRender.items, {
|
|
154
|
+
virtualScroller: virtualScroller,
|
|
155
|
+
usesAutogeneratedItemKeys: usesAutogeneratedItemKeys,
|
|
156
|
+
updateItemKeysForNewItems: updateItemKeysForNewItems
|
|
157
|
+
}); // Cache per-item `setItemState` functions' "references"
|
|
158
|
+
// so that item components don't get re-rendered needlessly.
|
|
197
159
|
|
|
198
160
|
var getSetItemState = (0, _useSetItemState["default"])({
|
|
199
161
|
getItemKey: getItemKey,
|
|
@@ -206,20 +168,6 @@ function VirtualScroller(_ref, ref) {
|
|
|
206
168
|
getItemKey: getItemKey,
|
|
207
169
|
onItemKeysReset: onItemKeysReset,
|
|
208
170
|
virtualScroller: virtualScroller
|
|
209
|
-
}); // Calls `.setItems()` if `items` property has changed.
|
|
210
|
-
|
|
211
|
-
(0, _useSetNewItemsOnItemsPropertyChange["default"])(itemsProperty, {
|
|
212
|
-
virtualScroller: virtualScroller,
|
|
213
|
-
// `preserveScrollPosition` property name is deprecated,
|
|
214
|
-
// use `preserveScrollPositionOnPrependItems` property instead.
|
|
215
|
-
preserveScrollPosition: preserveScrollPosition,
|
|
216
|
-
preserveScrollPositionOnPrependItems: preserveScrollPositionOnPrependItems
|
|
217
|
-
}); // Updates `key`s if item indexes have changed.
|
|
218
|
-
|
|
219
|
-
(0, _useUpdateItemKeysOnItemsChange["default"])(stateToRender.items, {
|
|
220
|
-
virtualScroller: virtualScroller,
|
|
221
|
-
usesAutogeneratedItemKeys: usesAutogeneratedItemKeys,
|
|
222
|
-
updateItemKeysForNewItems: updateItemKeysForNewItems
|
|
223
171
|
}); // Add instance methods to the React component.
|
|
224
172
|
|
|
225
173
|
(0, _useInstanceMethods["default"])(ref, {
|
|
@@ -233,14 +181,7 @@ function VirtualScroller(_ref, ref) {
|
|
|
233
181
|
(0, _debug.warn)('`onMount` property is deprecated');
|
|
234
182
|
onMount();
|
|
235
183
|
}
|
|
236
|
-
}, []); //
|
|
237
|
-
// when using a `<tbody/>` as a container for list items.
|
|
238
|
-
// This hook validates that the developer didn't "forget" to do that in such case.
|
|
239
|
-
|
|
240
|
-
(0, _useValidateTableBodyItemsContainer["default"])({
|
|
241
|
-
virtualScroller: virtualScroller,
|
|
242
|
-
tbody: tbody
|
|
243
|
-
}); // `willRender()` function is no longer used.
|
|
184
|
+
}, []); // `willRender()` function is no longer used.
|
|
244
185
|
//
|
|
245
186
|
// // `getSnapshotBeforeUpdate()` is called right before `componentDidUpdate()`.
|
|
246
187
|
// // A hook equivalent/workaround for `getSnapshotBeforeUpdate()`:
|
|
@@ -255,15 +196,6 @@ function VirtualScroller(_ref, ref) {
|
|
|
255
196
|
// return null
|
|
256
197
|
// }
|
|
257
198
|
|
|
258
|
-
var classNamePassThrough = classNameProperty || itemsContainerComponentProps && itemsContainerComponentProps.className;
|
|
259
|
-
var className = (0, _useClassName["default"])(classNamePassThrough, {
|
|
260
|
-
tbody: tbody
|
|
261
|
-
});
|
|
262
|
-
var stylePassThrough = itemsContainerComponentProps && itemsContainerComponentProps.style;
|
|
263
|
-
var style = (0, _useStyle["default"])(stylePassThrough, {
|
|
264
|
-
tbody: tbody,
|
|
265
|
-
state: stateToRender
|
|
266
|
-
});
|
|
267
199
|
var currentItems = stateToRender.items,
|
|
268
200
|
itemStates = stateToRender.itemStates,
|
|
269
201
|
firstShownItemIndex = stateToRender.firstShownItemIndex,
|
|
@@ -343,9 +275,7 @@ VirtualScroller.propTypes = {
|
|
|
343
275
|
getEstimatedInterItemVerticalSpacing: _propTypes["default"].func,
|
|
344
276
|
bypass: _propTypes["default"].bool,
|
|
345
277
|
// bypassBatchSize: PropTypes.number,
|
|
346
|
-
|
|
347
|
-
// Pass `as: "tbody"` property instead.
|
|
348
|
-
// tbody: PropTypes.bool,
|
|
278
|
+
tbody: _propTypes["default"].bool,
|
|
349
279
|
preserveScrollPositionOnPrependItems: _propTypes["default"].bool,
|
|
350
280
|
// `preserveScrollPosition` property name is deprecated,
|
|
351
281
|
// use `preserveScrollPositionOnPrependItems` instead.
|
|
@@ -378,5 +308,17 @@ VirtualScroller.propTypes = {
|
|
|
378
308
|
verticalSpacing: _propTypes["default"].number
|
|
379
309
|
}),
|
|
380
310
|
getInitialItemState: _propTypes["default"].func
|
|
381
|
-
};
|
|
311
|
+
}; // Legacy compatibility:
|
|
312
|
+
//
|
|
313
|
+
// Originally, the default export of the `virtual-scroller/react` subpackage
|
|
314
|
+
// was only the `VirtualScroller` component, and there were no other exports.
|
|
315
|
+
//
|
|
316
|
+
// Later, `useVirtualScroller()` hook export was added.
|
|
317
|
+
// In order to maintain legacy compatibility, the new exports shouldn't "break"
|
|
318
|
+
// the existing environments that were using the old versions of the package.
|
|
319
|
+
// This means that in non-ES6-import environments, any additional exports
|
|
320
|
+
// should be added directly to the default `VirtualScroller` export.
|
|
321
|
+
//
|
|
322
|
+
|
|
323
|
+
VirtualScroller.useVirtualScroller = _useVirtualScroller2["default"];
|
|
382
324
|
//# sourceMappingURL=VirtualScroller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualScroller.js","names":["VirtualScroller","ref","as","itemsProperty","items","ItemComponent","itemComponent","itemComponentProps","ItemsContainerComponent","itemsContainerComponent","itemsContainerComponentProps","itemsContainerRef","estimatedItemHeight","getEstimatedItemHeight","getEstimatedVisibleItemRowsCount","getEstimatedInterItemVerticalSpacing","onMount","tbody","readyToStart","classNameProperty","className","bypass","preserveScrollPosition","preserveScrollPositionOnPrependItems","measureItemsBatchSize","scrollableContainer","getScrollableContainer","getColumnsCount","getItemId","onItemFirstRender","onItemInitialRender","initialScrollPosition","onScrollPositionChange","initialState","getInitialItemState","onStateChange","rest","undefined","useForwardedRef","setItemsContainerRef","setRef","itemsContainer","internalRef","virtualScroller","useVirtualScroller","_initialState","useMemo","getInitialState","useState","onRender","getState","setState","stateToRender","useVirtualScrollerStartStop","useItemKeys","getItemKey","onItemKeysReset","usesAutogeneratedItemKeys","updateItemKeysForNewItems","getSetItemState","useSetItemState","getOnItemHeightDidChange","useOnItemHeightDidChange","useSetNewItemsOnItemsPropertyChange","useUpdateItemKeysOnItemsChange","useInstanceMethods","useLayoutEffect","warn","useValidateTableBodyItemsContainer","classNamePassThrough","useClassName","stylePassThrough","style","useStyle","state","currentItems","itemStates","firstShownItemIndex","lastShownItemIndex","map","item","i","React","forwardRef","elementType","PropTypes","oneOfType","string","func","object","propTypes","arrayOf","any","isRequired","shape","current","number","bool","beforeItemsHeight","afterItemsHeight","itemHeights","columnsCount","verticalSpacing"],"sources":["../../source/react/VirtualScroller.js"],"sourcesContent":["import React, { useMemo, useLayoutEffect } from 'react'\r\nimport PropTypes from 'prop-types'\r\n\r\nimport useState from './useState.js'\r\nimport useVirtualScroller from './useVirtualScroller.js'\r\nimport useVirtualScrollerStartStop from './useVirtualScrollerStartStop.js'\r\nimport useInstanceMethods from './useInstanceMethods.js'\r\nimport useItemKeys from './useItemKeys.js'\r\nimport useSetItemState from './useSetItemState.js'\r\nimport useOnItemHeightDidChange from './useOnItemHeightDidChange.js'\r\nimport useSetNewItemsOnItemsPropertyChange from './useSetNewItemsOnItemsPropertyChange.js'\r\nimport useUpdateItemKeysOnItemsChange from './useUpdateItemKeysOnItemsChange.js'\r\nimport useValidateTableBodyItemsContainer from './useValidateTableBodyItemsContainer.js'\r\nimport useForwardedRef from './useForwardedRef.js'\r\nimport useClassName from './useClassName.js'\r\nimport useStyle from './useStyle.js'\r\n\r\nimport { warn } from '../utility/debug.js'\r\n\r\n// When `items` property changes:\r\n// * A new `items` property is supplied to the React component.\r\n// * The React component re-renders itself.\r\n// * `useSetNewItemsOnItemsPropertyChange()` hook is run.\r\n// * `useSetNewItemsOnItemsPropertyChange()` hook detects that the `items` property\r\n// has changed and calls `VirtualScroller.setItems(items)`.\r\n// * `VirtualScroller.setItems(items)` calls `VirtualScroller.setState()`.\r\n// * `VirtualScroller.setState()` calls the `setState()` function.\r\n// * The `setState()` function calls a setter from a `useState()` hook.\r\n// * The React component re-renders itself the second time.\r\n\r\nfunction VirtualScroller({\r\n\t// The following are `<VirtualScroller/>` properties.\r\n\t//\r\n\t// `as` property is deprecated, use `itemsContainerComponent` property instead.\r\n\tas,\r\n\titems: itemsProperty,\r\n\titemComponent: ItemComponent,\r\n\titemComponentProps,\r\n\titemsContainerComponent: ItemsContainerComponent,\r\n\titemsContainerComponentProps,\r\n\titemsContainerRef,\r\n\t// `estimatedItemHeight` property name is deprecated,\r\n\t// use `getEstimatedItemHeight` property instead.\r\n\testimatedItemHeight,\r\n\tgetEstimatedItemHeight,\r\n\tgetEstimatedVisibleItemRowsCount,\r\n\tgetEstimatedInterItemVerticalSpacing,\r\n\tonMount,\r\n\t// `tbody` property is deprecated.\r\n\t// Pass `as: \"tbody\"` property instead.\r\n\ttbody,\r\n\treadyToStart,\r\n\tclassName: classNameProperty,\r\n\r\n\t// The following are the \"core\" component options.\r\n\t//\r\n\tbypass,\r\n\t// `preserveScrollPosition` property name is deprecated,\r\n\t// use `preserveScrollPositionOnPrependItems` property instead.\r\n\tpreserveScrollPosition,\r\n\tpreserveScrollPositionOnPrependItems,\r\n\tmeasureItemsBatchSize,\r\n\t// `scrollableContainer` property is deprecated.\r\n\t// Use `getScrollableContainer()` property instead.\r\n\tscrollableContainer,\r\n\tgetScrollableContainer,\r\n\tgetColumnsCount,\r\n\tgetItemId,\r\n\t// `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.\r\n\tonItemFirstRender,\r\n\tonItemInitialRender,\r\n\tinitialScrollPosition,\r\n\tonScrollPositionChange,\r\n\tinitialState,\r\n\tgetInitialItemState,\r\n\tonStateChange,\r\n\r\n\t// \"Rest\" properties that will be passed through to the `itemsContainerComponent`.\r\n\t...rest\r\n}, ref) {\r\n\t// Previously, `as` property was being used instead of `itemsContainerComponent`,\r\n\t// and the default `as` property value was a generic `<div/>`.\r\n\t// Starting from version `1.14.1`, it is recommended to explicitly specify the `itemsContainerComponent`.\r\n\t// The default `\"div\"` fallback value is just a legacy compatibility relic, and so is the `as` property.\r\n\tif (!ItemsContainerComponent) {\r\n\t\tItemsContainerComponent = as || 'div'\r\n\t}\r\n\r\n\t// It turns out that since May 2022, `useVirtualScroller()` hook completely ignored the `tbody` property.\r\n\t// Instead, it always derived `tbody` property value from `as` property value by comparing it to `\"tbody\"` string.\r\n\t// As a result, it seemed like the explicit passing of `tbody` property didn't really work as intended.\r\n\t// In the end, it was decided that perhaps `tbody` property value should always be derived from `as` property\r\n\t// without a developer having to manually specify it. So the `tbody` property was deprecated.\r\n\t// It still exists though for backwards compatibility with the older versions of the package.\r\n\tif (tbody === undefined) {\r\n\t\t// `tbody` should be somehow detected before any DOM Elements have been mounted.\r\n\t\t// This is because during Server-Side Render there's no DOM Elements tree at all.\r\n\t\t// And server-sider render result is required to be exactly the same as client-side render result.\r\n\t\t// This means that `tbody` detection for the purposes of getting the initial\r\n\t\t// `className` or `style` property values must not rely on any DOM Elements at all,\r\n\t\t// and should use some other means such as explicitly passing a `tbody: true` property\r\n\t\t// (as it used to be in the past) or detecting `<tbody/>` tag usage from the\r\n\t\t// `itemsContainerCompoent` property value.\r\n\t\ttbody = ItemsContainerComponent === 'tbody'\r\n\t}\r\n\r\n\t// List items \"container\" DOM Element reference.\r\n\tconst {\r\n\t\tsetRef: setItemsContainerRef,\r\n\t\tinternalRef: itemsContainer\r\n\t} = useForwardedRef(itemsContainerRef)\r\n\r\n\t// Create a `VirtualScroller` instance.\r\n\tconst virtualScroller = useVirtualScroller({\r\n\t\titems: itemsProperty,\r\n\t\t// `estimatedItemHeight` property name is deprecated,\r\n\t\t// use `getEstimatedItemHeight` property instead.\r\n\t\testimatedItemHeight,\r\n\t\tgetEstimatedItemHeight,\r\n\t\tgetEstimatedVisibleItemRowsCount,\r\n\t\tgetEstimatedInterItemVerticalSpacing,\r\n\t\tbypass,\r\n\t\t// bypassBatchSize,\r\n\t\tonItemInitialRender,\r\n\t\t// `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.\r\n\t\tonItemFirstRender,\r\n\t\tinitialScrollPosition,\r\n\t\tonScrollPositionChange,\r\n\t\tmeasureItemsBatchSize,\r\n\t\t// `scrollableContainer` property is deprecated.\r\n\t\t// Use `getScrollableContainer()` property instead.\r\n\t\tscrollableContainer,\r\n\t\tgetScrollableContainer,\r\n\t\tgetColumnsCount,\r\n\t\tgetItemId,\r\n\t\tinitialState,\r\n\t\tgetInitialItemState,\r\n\t\tonStateChange\r\n\t}, {\r\n\t\titemsContainer\r\n\t})\r\n\r\n\t// Only compute the initial state once.\r\n\tconst _initialState = useMemo(() => {\r\n\t\treturn virtualScroller.getInitialState()\r\n\t}, [])\r\n\r\n\t// Use React's `useState()` hook for managing `VirtualScroller`'s state lifecycle.\r\n\t// This way, React will re-render the component on every state update.\r\n\tconst {\r\n\t\tgetState,\r\n\t\tsetState,\r\n\t\tstateToRender\r\n\t} = useState({\r\n\t\tinitialState: _initialState,\r\n\t\tonRender: virtualScroller.onRender\r\n\t})\r\n\r\n\t// Use custom (external) state storage in the `VirtualScroller`.\r\n\tuseMemo(() => {\r\n\t\tvirtualScroller.useState({\r\n\t\t\tgetState,\r\n\t\t\tsetState\r\n\t\t})\r\n\t}, [])\r\n\r\n\t// Start `VirtualScroller` on mount.\r\n\t// Stop `VirtualScroller` on unmount.\r\n\tuseVirtualScrollerStartStop(virtualScroller, { readyToStart })\r\n\r\n\t// List items are rendered with `key`s so that React doesn't\r\n\t// \"reuse\" `itemComponent`s in cases when `items` are changed.\r\n\tconst {\r\n\t\tgetItemKey,\r\n\t\tonItemKeysReset,\r\n\t\tusesAutogeneratedItemKeys,\r\n\t\tupdateItemKeysForNewItems\r\n\t} = useItemKeys({\r\n\t\tgetItemId\r\n\t})\r\n\r\n\t// Cache per-item `setItemState` functions' \"references\"\r\n\t// so that item components don't get re-rendered needlessly.\r\n\tconst getSetItemState = useSetItemState({\r\n\t\tgetItemKey,\r\n\t\tonItemKeysReset,\r\n\t\tvirtualScroller\r\n\t})\r\n\r\n\t// Cache per-item `onItemHeightDidChange` functions' \"references\"\r\n\t// so that item components don't get re-rendered needlessly.\r\n\tconst getOnItemHeightDidChange = useOnItemHeightDidChange({\r\n\t\tgetItemKey,\r\n\t\tonItemKeysReset,\r\n\t\tvirtualScroller\r\n\t})\r\n\r\n\t// Calls `.setItems()` if `items` property has changed.\r\n\tuseSetNewItemsOnItemsPropertyChange(itemsProperty, {\r\n\t\tvirtualScroller,\r\n\t\t// `preserveScrollPosition` property name is deprecated,\r\n\t\t// use `preserveScrollPositionOnPrependItems` property instead.\r\n\t\tpreserveScrollPosition,\r\n\t\tpreserveScrollPositionOnPrependItems\r\n\t})\r\n\r\n\t// Updates `key`s if item indexes have changed.\r\n\tuseUpdateItemKeysOnItemsChange(stateToRender.items, {\r\n\t\tvirtualScroller,\r\n\t\tusesAutogeneratedItemKeys,\r\n\t\tupdateItemKeysForNewItems\r\n\t})\r\n\r\n\t// Add instance methods to the React component.\r\n\tuseInstanceMethods(ref, {\r\n\t\tvirtualScroller\r\n\t})\r\n\r\n\tuseLayoutEffect(() => {\r\n\t\t// (deprecated)\r\n\t\t// `onMount()` option is deprecated due to no longer being used.\r\n\t\t// If someone thinks there's a valid use case for it, create an issue.\r\n\t\tif (onMount) {\r\n\t\t\twarn('`onMount` property is deprecated')\r\n\t\t\tonMount()\r\n\t\t}\r\n\t}, [])\r\n\r\n\t// A developer might \"forget\" to pass `itemsContainerComponent=\"tbody\"` property\r\n\t// when using a `<tbody/>` as a container for list items.\r\n\t// This hook validates that the developer didn't \"forget\" to do that in such case.\r\n\tuseValidateTableBodyItemsContainer({\r\n\t\tvirtualScroller,\r\n\t\ttbody\r\n\t})\r\n\r\n\t// `willRender()` function is no longer used.\r\n\t//\r\n\t// // `getSnapshotBeforeUpdate()` is called right before `componentDidUpdate()`.\r\n\t// // A hook equivalent/workaround for `getSnapshotBeforeUpdate()`:\r\n\t// // https://github.com/facebook/react/issues/15221#issuecomment-583448887\r\n\t// //\r\n\t// getSnapshotBeforeUpdate(prevProps, prevState) {\r\n\t// \tif (this.state !== prevState) {\r\n\t// \t\tthis.willRender(this.state, prevState)\r\n\t// \t}\r\n\t// \t// Returns `null` to avoid React warning:\r\n\t// \t// \"A snapshot value (or null) must be returned. You have returned undefined\".\r\n\t// \treturn null\r\n\t// }\r\n\r\n\tconst classNamePassThrough = classNameProperty || itemsContainerComponentProps && itemsContainerComponentProps.className\r\n\r\n\tconst className = useClassName(classNamePassThrough, {\r\n\t\ttbody\r\n\t})\r\n\r\n\tconst stylePassThrough = itemsContainerComponentProps && itemsContainerComponentProps.style\r\n\r\n\tconst style = useStyle(stylePassThrough, {\r\n\t\ttbody,\r\n\t\tstate: stateToRender\r\n\t})\r\n\r\n\tconst {\r\n\t\titems: currentItems,\r\n\t\titemStates,\r\n\t\tfirstShownItemIndex,\r\n\t\tlastShownItemIndex\r\n\t} = stateToRender\r\n\r\n\treturn (\r\n\t\t<ItemsContainerComponent\r\n\t\t\t{...itemsContainerComponentProps}\r\n\t\t\t{...rest}\r\n\t\t\tref={setItemsContainerRef}\r\n\t\t\tclassName={className}\r\n\t\t\tstyle={style}>\r\n\t\t\t{currentItems.map((item, i) => {\r\n\t\t\t\tif (i >= firstShownItemIndex && i <= lastShownItemIndex) {\r\n\t\t\t\t\t// * Passing the `item` as `children` property is legacy and is deprecated.\r\n\t\t\t\t\t// If version `2.x` is published in some hypothetical future,\r\n\t\t\t\t\t// the `item` property should be moved below `{...itemComponentProps}`.\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// * Passing `itemIndex` property is legacy and is deprecated\r\n\t\t\t\t\t// and could be removed in some future.\r\n\t\t\t\t\t// The rationale for deprecation is that the `items` property\r\n\t\t\t\t\t// is not constant and could change, in which case the `itemIndex` value\r\n\t\t\t\t\t// would be of no use because the application wouldn't know\r\n\t\t\t\t\t// which exact `items` it corresponds to at any given moment in time.\r\n\t\t\t\t\t// Having just the `itemIndex` and no actual `item` is therefore considered useless.\r\n\t\t\t\t\t// Instead, a developer could simply use `getItemKey(item)` function.\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// * `onStateChange` property is passed here for legacy reasons.\r\n\t\t\t\t\t// The new property name is `setState`.\r\n\t\t\t\t\t// The old property name `onStateChange` is deprecated\r\n\t\t\t\t\t// and could be removed in some future.\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// * `onHeightChange` property is passed here for legacy reasons.\r\n\t\t\t\t\t// The new property name is `onHeightDidChange`.\r\n\t\t\t\t\t// The old property name `onHeightChange` is deprecated\r\n\t\t\t\t\t// and could be removed in some future.\r\n\t\t\t\t\t//\r\n\t\t\t\t\treturn (\r\n\t\t\t\t\t\t<ItemComponent\r\n\t\t\t\t\t\t\titem={item}\r\n\t\t\t\t\t\t\titemIndex={i}\r\n\t\t\t\t\t\t\t{...itemComponentProps}\r\n\t\t\t\t\t\t\tkey={getItemKey(item, i)}\r\n\t\t\t\t\t\t\tstate={itemStates && itemStates[i]}\r\n\t\t\t\t\t\t\tsetState={getSetItemState(i)}\r\n\t\t\t\t\t\t\tonStateChange={getSetItemState(i)}\r\n\t\t\t\t\t\t\tonHeightChange={getOnItemHeightDidChange(i)}\r\n\t\t\t\t\t\t\tonHeightDidChange={getOnItemHeightDidChange(i)}>\r\n\t\t\t\t\t\t\t{item}\r\n\t\t\t\t\t\t</ItemComponent>\r\n\t\t\t\t\t)\r\n\t\t\t\t}\r\n\t\t\t\treturn null\r\n\t\t\t})}\r\n\t\t</ItemsContainerComponent>\r\n\t)\r\n}\r\n\r\nVirtualScroller = React.forwardRef(VirtualScroller)\r\n\r\nexport default VirtualScroller\r\n\r\n// `PropTypes.elementType` is available in some version of `prop-types`.\r\n// https://github.com/facebook/prop-types/issues/200\r\nconst elementType = PropTypes.elementType || PropTypes.oneOfType([\r\n\tPropTypes.string,\r\n\tPropTypes.func,\r\n\tPropTypes.object\r\n])\r\n\r\nVirtualScroller.propTypes = {\r\n\t// `as` property is deprecated, use `itemsContainerComponent` property instead.\r\n\tas: elementType,\r\n\titems: PropTypes.arrayOf(PropTypes.any).isRequired,\r\n\titemComponent: elementType.isRequired,\r\n\titemComponentProps: PropTypes.object,\r\n\t// `itemsContainerComponent` property is not required just for legacy compatibility reasons.\r\n\t// Any new applications should explicitly specify it.\r\n\titemsContainerComponent: elementType,\r\n\titemsContainerComponentProps: PropTypes.object,\r\n\titemsContainerRef: PropTypes.oneOfType([\r\n\t\tPropTypes.func,\r\n\t\tPropTypes.shape({ current: PropTypes.object })\r\n\t]),\r\n\t// `estimatedItemHeight` property name is deprecated,\r\n\t// use `getEstimatedItemHeight` property instead.\r\n\testimatedItemHeight: PropTypes.number,\r\n\tgetEstimatedItemHeight: PropTypes.func,\r\n\tgetEstimatedVisibleItemRowsCount: PropTypes.func,\r\n\tgetEstimatedInterItemVerticalSpacing: PropTypes.func,\r\n\tbypass: PropTypes.bool,\r\n\t// bypassBatchSize: PropTypes.number,\r\n\t// `tbody` property is deprecated.\r\n\t// Pass `as: \"tbody\"` property instead.\r\n\t// tbody: PropTypes.bool,\r\n\tpreserveScrollPositionOnPrependItems: PropTypes.bool,\r\n\t// `preserveScrollPosition` property name is deprecated,\r\n\t// use `preserveScrollPositionOnPrependItems` instead.\r\n\tpreserveScrollPosition: PropTypes.bool,\r\n\tmeasureItemsBatchSize: PropTypes.number,\r\n\t// `scrollableContainer` property is deprecated.\r\n\t// Use `getScrollableContainer()` property instead.\r\n\tscrollableContainer: PropTypes.any,\r\n\tgetScrollableContainer: PropTypes.func,\r\n\tgetColumnsCount: PropTypes.func,\r\n\tgetItemId: PropTypes.func,\r\n\tclassName: PropTypes.string,\r\n\treadyToStart: PropTypes.bool,\r\n\tonMount: PropTypes.func,\r\n\tonItemInitialRender: PropTypes.func,\r\n\t// `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.\r\n\tonItemFirstRender: PropTypes.func,\r\n\tinitialScrollPosition: PropTypes.number,\r\n\tonScrollPositionChange: PropTypes.func,\r\n\tonStateChange: PropTypes.func,\r\n\tinitialState: PropTypes.shape({\r\n\t\titems: PropTypes.arrayOf(PropTypes.object).isRequired,\r\n\t\titemStates: PropTypes.arrayOf(PropTypes.any).isRequired,\r\n\t\tfirstShownItemIndex: PropTypes.number.isRequired,\r\n\t\tlastShownItemIndex: PropTypes.number.isRequired,\r\n\t\tbeforeItemsHeight: PropTypes.number.isRequired,\r\n\t\tafterItemsHeight: PropTypes.number.isRequired,\r\n\t\titemHeights: PropTypes.arrayOf(PropTypes.number).isRequired,\r\n\t\tcolumnsCount: PropTypes.number,\r\n\t\tverticalSpacing: PropTypes.number\r\n\t}),\r\n\tgetInitialItemState: PropTypes.func\r\n}\r\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,eAAT,OAiDGC,GAjDH,EAiDQ;EAAA,IA7CPC,EA6CO,QA7CPA,EA6CO;EAAA,IA5CAC,aA4CA,QA5CPC,KA4CO;EAAA,IA3CQC,aA2CR,QA3CPC,aA2CO;EAAA,IA1CPC,kBA0CO,QA1CPA,kBA0CO;EAAA,IAzCkBC,uBAyClB,QAzCPC,uBAyCO;EAAA,IAxCPC,4BAwCO,QAxCPA,4BAwCO;EAAA,IAvCPC,iBAuCO,QAvCPA,iBAuCO;EAAA,IApCPC,mBAoCO,QApCPA,mBAoCO;EAAA,IAnCPC,sBAmCO,QAnCPA,sBAmCO;EAAA,IAlCPC,gCAkCO,QAlCPA,gCAkCO;EAAA,IAjCPC,oC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H,UAJR;IAK7BK,iBAAiB,EAAEb,qBAAA,CAAUW,MAAV,CAAiBH,UALP;IAM7BM,gBAAgB,EAAEd,qBAAA,CAAUW,MAAV,CAAiBH,UANN;IAO7BO,WAAW,EAAEf,qBAAA,CAAUM,OAAV,CAAkBN,qBAAA,CAAUW,MAA5B,EAAoCH,UAPpB;IAQ7BQ,YAAY,EAAEhB,qBAAA,CAAUW,MARK;IAS7BM,eAAe,EAAEjB,qBAAA,CAAUW;EATE,CAAhB,CA7Ca;EAwD3B9D,mBAAmB,EAAEmD,qBAAA,CAAUG;AAxDJ,CAA5B"}
|
|
1
|
+
{"version":3,"file":"VirtualScroller.js","names":["VirtualScroller","ref","as","itemsProperty","items","ItemComponent","itemComponent","itemComponentProps","ItemsContainerComponent","itemsContainerComponent","itemsContainerComponentProps","itemsContainerRefProperty","itemsContainerRef","onMount","tbody","readyToStart","classNameProperty","className","bypass","preserveScrollPosition","preserveScrollPositionOnPrependItems","measureItemsBatchSize","scrollableContainer","getScrollableContainer","getColumnsCount","getItemId","onItemFirstRender","onItemInitialRender","initialScrollPosition","onScrollPositionChange","initialState","getInitialItemState","onStateChange","estimatedItemHeight","getEstimatedItemHeight","getEstimatedVisibleItemRowsCount","getEstimatedInterItemVerticalSpacing","rest","undefined","useVirtualScroller","style","stateToRender","state","virtualScroller","setItemsContainerRef","useMergeRefs","useItemKeys","getItemKey","onItemKeysReset","usesAutogeneratedItemKeys","updateItemKeysForNewItems","useUpdateItemKeysOnItemsChange","getSetItemState","useSetItemState","getOnItemHeightDidChange","useOnItemHeightDidChange","useInstanceMethods","useLayoutEffect","warn","currentItems","itemStates","firstShownItemIndex","lastShownItemIndex","map","item","i","React","forwardRef","elementType","PropTypes","oneOfType","string","func","object","propTypes","arrayOf","any","isRequired","shape","current","number","bool","beforeItemsHeight","afterItemsHeight","itemHeights","columnsCount","verticalSpacing"],"sources":["../../source/react/VirtualScroller.js"],"sourcesContent":["import React, { useLayoutEffect } from 'react'\r\nimport PropTypes from 'prop-types'\r\n\r\nimport useVirtualScroller from './useVirtualScroller.js'\r\nimport useItemKeys from './useItemKeys.js'\r\nimport useSetItemState from './useSetItemState.js'\r\nimport useOnItemHeightDidChange from './useOnItemHeightDidChange.js'\r\nimport useMergeRefs from './useMergeRefs.js'\r\nimport useInstanceMethods from './useInstanceMethods.js'\r\nimport useUpdateItemKeysOnItemsChange from './useUpdateItemKeysOnItemsChange.js'\r\n\r\nimport { warn } from '../utility/debug.js'\r\n\r\nfunction VirtualScroller({\r\n\t// The following are `<VirtualScroller/>` properties.\r\n\t//\r\n\t// `as` property is deprecated, use `itemsContainerComponent` property instead.\r\n\tas,\r\n\titems: itemsProperty,\r\n\titemComponent: ItemComponent,\r\n\titemComponentProps,\r\n\titemsContainerComponent: ItemsContainerComponent,\r\n\titemsContainerComponentProps,\r\n\titemsContainerRef: itemsContainerRefProperty,\r\n\tonMount,\r\n\ttbody,\r\n\treadyToStart,\r\n\tclassName: classNameProperty,\r\n\r\n\t// The following are the \"core\" component options.\r\n\t//\r\n\tbypass,\r\n\t// `preserveScrollPosition` property name is deprecated,\r\n\t// use `preserveScrollPositionOnPrependItems` property instead.\r\n\tpreserveScrollPosition,\r\n\tpreserveScrollPositionOnPrependItems,\r\n\tmeasureItemsBatchSize,\r\n\t// `scrollableContainer` property is deprecated.\r\n\t// Use `getScrollableContainer()` property instead.\r\n\tscrollableContainer,\r\n\tgetScrollableContainer,\r\n\tgetColumnsCount,\r\n\tgetItemId,\r\n\t// `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.\r\n\tonItemFirstRender,\r\n\tonItemInitialRender,\r\n\tinitialScrollPosition,\r\n\tonScrollPositionChange,\r\n\tinitialState,\r\n\tgetInitialItemState,\r\n\tonStateChange,\r\n\t// `estimatedItemHeight` property name is deprecated,\r\n\t// use `getEstimatedItemHeight` property instead.\r\n\testimatedItemHeight,\r\n\tgetEstimatedItemHeight,\r\n\tgetEstimatedVisibleItemRowsCount,\r\n\tgetEstimatedInterItemVerticalSpacing,\r\n\r\n\t// \"Rest\" properties that will be passed through to the `itemsContainerComponent`.\r\n\t...rest\r\n}, ref) {\r\n\t// Previously, `as` property was being used instead of `itemsContainerComponent`,\r\n\t// and the default `as` property value was a generic `<div/>`.\r\n\t// Starting from version `1.14.1`, it is recommended to explicitly specify the `itemsContainerComponent`.\r\n\t// The default `\"div\"` fallback value is just a legacy compatibility relic, and so is the `as` property.\r\n\tif (!ItemsContainerComponent) {\r\n\t\tItemsContainerComponent = as || 'div'\r\n\t}\r\n\r\n\t// In simple cases, the use of a `<tbody/>` tag as an items container component could be auto-detected.\r\n\tif (tbody === undefined) {\r\n\t\t// `tbody` auto-detection should happen before any DOM Elements have been mounted,\r\n\t\t// i.e. it can't rely on the trivial `getItemsContainerElement().tagName === 'TBODY'` check.\r\n\t\t// This is because during Server-Side Render there's no DOM Elements tree at all.\r\n\t\t// And server-sider render result is required to be exactly the same as client-side render result.\r\n\t\t// This means that `tbody` detection for the purposes of getting the initial\r\n\t\t// `className` or `style` property values must not rely on any DOM Elements at all,\r\n\t\t// and should use some other means such as explicitly passing a `tbody: true` property\r\n\t\t// or detecting `<tbody/>` tag usage from the `itemsContainerCompoent` property value.\r\n\t\ttbody = ItemsContainerComponent === 'tbody'\r\n\t}\r\n\r\n\tconst {\r\n\t\tstate: stateToRender,\r\n\t\tstyle,\r\n\t\tclassName,\r\n\t\titemsContainerRef,\r\n\t\tvirtualScroller\r\n\t} = useVirtualScroller({\r\n\t\titems: itemsProperty,\r\n\t\ttbody,\r\n\t\treadyToStart,\r\n\t\tstyle: itemsContainerComponentProps && itemsContainerComponentProps.style,\r\n\t\tclassName: classNameProperty || itemsContainerComponentProps && itemsContainerComponentProps.className,\r\n\r\n\t\t// The following are the \"core\" component options.\r\n\t\t//\r\n\t\tbypass,\r\n\t\t// `preserveScrollPosition` property name is deprecated,\r\n\t\t// use `preserveScrollPositionOnPrependItems` property instead.\r\n\t\tpreserveScrollPosition,\r\n\t\tpreserveScrollPositionOnPrependItems,\r\n\t\tmeasureItemsBatchSize,\r\n\t\t// `scrollableContainer` property is deprecated.\r\n\t\t// Use `getScrollableContainer()` property instead.\r\n\t\tscrollableContainer,\r\n\t\tgetScrollableContainer,\r\n\t\tgetColumnsCount,\r\n\t\tgetItemId,\r\n\t\t// `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.\r\n\t\tonItemFirstRender,\r\n\t\tonItemInitialRender,\r\n\t\tinitialScrollPosition,\r\n\t\tonScrollPositionChange,\r\n\t\tinitialState,\r\n\t\tgetInitialItemState,\r\n\t\tonStateChange,\r\n\t\tgetEstimatedItemHeight: getEstimatedItemHeight ||\r\n\t\t\t// `estimatedItemHeight` property name is deprecated,\r\n\t\t\t// use `getEstimatedItemHeight` property instead.\r\n\t\t\t(typeof estimatedItemHeight === 'number' ? () => estimatedItemHeight : undefined),\r\n\t\tgetEstimatedVisibleItemRowsCount,\r\n\t\tgetEstimatedInterItemVerticalSpacing\r\n\t})\r\n\r\n\t// List items \"container\" DOM Element reference.\r\n\tconst setItemsContainerRef = useMergeRefs(itemsContainerRef, itemsContainerRefProperty)\r\n\r\n\t// List items are rendered with `key`s so that React doesn't\r\n\t// \"reuse\" `itemComponent`s in cases when `items` are changed.\r\n\tconst {\r\n\t\tgetItemKey,\r\n\t\tonItemKeysReset,\r\n\t\tusesAutogeneratedItemKeys,\r\n\t\tupdateItemKeysForNewItems\r\n\t} = useItemKeys({\r\n\t\tgetItemId\r\n\t})\r\n\r\n\t// Updates `key`s if item indexes have changed.\r\n\tuseUpdateItemKeysOnItemsChange(stateToRender.items, {\r\n\t\tvirtualScroller,\r\n\t\tusesAutogeneratedItemKeys,\r\n\t\tupdateItemKeysForNewItems\r\n\t})\r\n\r\n\t// Cache per-item `setItemState` functions' \"references\"\r\n\t// so that item components don't get re-rendered needlessly.\r\n\tconst getSetItemState = useSetItemState({\r\n\t\tgetItemKey,\r\n\t\tonItemKeysReset,\r\n\t\tvirtualScroller\r\n\t})\r\n\r\n\t// Cache per-item `onItemHeightDidChange` functions' \"references\"\r\n\t// so that item components don't get re-rendered needlessly.\r\n\tconst getOnItemHeightDidChange = useOnItemHeightDidChange({\r\n\t\tgetItemKey,\r\n\t\tonItemKeysReset,\r\n\t\tvirtualScroller\r\n\t})\r\n\r\n\t// Add instance methods to the React component.\r\n\tuseInstanceMethods(ref, {\r\n\t\tvirtualScroller\r\n\t})\r\n\r\n\tuseLayoutEffect(() => {\r\n\t\t// (deprecated)\r\n\t\t// `onMount()` option is deprecated due to no longer being used.\r\n\t\t// If someone thinks there's a valid use case for it, create an issue.\r\n\t\tif (onMount) {\r\n\t\t\twarn('`onMount` property is deprecated')\r\n\t\t\tonMount()\r\n\t\t}\r\n\t}, [])\r\n\r\n\t// `willRender()` function is no longer used.\r\n\t//\r\n\t// // `getSnapshotBeforeUpdate()` is called right before `componentDidUpdate()`.\r\n\t// // A hook equivalent/workaround for `getSnapshotBeforeUpdate()`:\r\n\t// // https://github.com/facebook/react/issues/15221#issuecomment-583448887\r\n\t// //\r\n\t// getSnapshotBeforeUpdate(prevProps, prevState) {\r\n\t// \tif (this.state !== prevState) {\r\n\t// \t\tthis.willRender(this.state, prevState)\r\n\t// \t}\r\n\t// \t// Returns `null` to avoid React warning:\r\n\t// \t// \"A snapshot value (or null) must be returned. You have returned undefined\".\r\n\t// \treturn null\r\n\t// }\r\n\r\n\tconst {\r\n\t\titems: currentItems,\r\n\t\titemStates,\r\n\t\tfirstShownItemIndex,\r\n\t\tlastShownItemIndex\r\n\t} = stateToRender\r\n\r\n\treturn (\r\n\t\t<ItemsContainerComponent\r\n\t\t\t{...itemsContainerComponentProps}\r\n\t\t\t{...rest}\r\n\t\t\tref={setItemsContainerRef}\r\n\t\t\tclassName={className}\r\n\t\t\tstyle={style}>\r\n\t\t\t{currentItems.map((item, i) => {\r\n\t\t\t\tif (i >= firstShownItemIndex && i <= lastShownItemIndex) {\r\n\t\t\t\t\t// * Passing the `item` as `children` property is legacy and is deprecated.\r\n\t\t\t\t\t// If version `2.x` is published in some hypothetical future,\r\n\t\t\t\t\t// the `item` property should be moved below `{...itemComponentProps}`.\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// * Passing `itemIndex` property is legacy and is deprecated\r\n\t\t\t\t\t// and could be removed in some future.\r\n\t\t\t\t\t// The rationale for deprecation is that the `items` property\r\n\t\t\t\t\t// is not constant and could change, in which case the `itemIndex` value\r\n\t\t\t\t\t// would be of no use because the application wouldn't know\r\n\t\t\t\t\t// which exact `items` it corresponds to at any given moment in time.\r\n\t\t\t\t\t// Having just the `itemIndex` and no actual `item` is therefore considered useless.\r\n\t\t\t\t\t// Instead, a developer could simply use `getItemKey(item)` function.\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// * `onStateChange` property is passed here for legacy reasons.\r\n\t\t\t\t\t// The new property name is `setState`.\r\n\t\t\t\t\t// The old property name `onStateChange` is deprecated\r\n\t\t\t\t\t// and could be removed in some future.\r\n\t\t\t\t\t//\r\n\t\t\t\t\t// * `onHeightChange` property is passed here for legacy reasons.\r\n\t\t\t\t\t// The new property name is `onHeightDidChange`.\r\n\t\t\t\t\t// The old property name `onHeightChange` is deprecated\r\n\t\t\t\t\t// and could be removed in some future.\r\n\t\t\t\t\t//\r\n\t\t\t\t\treturn (\r\n\t\t\t\t\t\t<ItemComponent\r\n\t\t\t\t\t\t\titem={item}\r\n\t\t\t\t\t\t\titemIndex={i}\r\n\t\t\t\t\t\t\t{...itemComponentProps}\r\n\t\t\t\t\t\t\tkey={getItemKey(item, i)}\r\n\t\t\t\t\t\t\tstate={itemStates && itemStates[i]}\r\n\t\t\t\t\t\t\tsetState={getSetItemState(i)}\r\n\t\t\t\t\t\t\tonStateChange={getSetItemState(i)}\r\n\t\t\t\t\t\t\tonHeightChange={getOnItemHeightDidChange(i)}\r\n\t\t\t\t\t\t\tonHeightDidChange={getOnItemHeightDidChange(i)}>\r\n\t\t\t\t\t\t\t{item}\r\n\t\t\t\t\t\t</ItemComponent>\r\n\t\t\t\t\t)\r\n\t\t\t\t}\r\n\t\t\t\treturn null\r\n\t\t\t})}\r\n\t\t</ItemsContainerComponent>\r\n\t)\r\n}\r\n\r\nVirtualScroller = React.forwardRef(VirtualScroller)\r\n\r\nexport default VirtualScroller\r\n\r\n// `PropTypes.elementType` is available in some version of `prop-types`.\r\n// https://github.com/facebook/prop-types/issues/200\r\nconst elementType = PropTypes.elementType || PropTypes.oneOfType([\r\n\tPropTypes.string,\r\n\tPropTypes.func,\r\n\tPropTypes.object\r\n])\r\n\r\nVirtualScroller.propTypes = {\r\n\t// `as` property is deprecated, use `itemsContainerComponent` property instead.\r\n\tas: elementType,\r\n\titems: PropTypes.arrayOf(PropTypes.any).isRequired,\r\n\titemComponent: elementType.isRequired,\r\n\titemComponentProps: PropTypes.object,\r\n\t// `itemsContainerComponent` property is not required just for legacy compatibility reasons.\r\n\t// Any new applications should explicitly specify it.\r\n\titemsContainerComponent: elementType,\r\n\titemsContainerComponentProps: PropTypes.object,\r\n\titemsContainerRef: PropTypes.oneOfType([\r\n\t\tPropTypes.func,\r\n\t\tPropTypes.shape({ current: PropTypes.object })\r\n\t]),\r\n\t// `estimatedItemHeight` property name is deprecated,\r\n\t// use `getEstimatedItemHeight` property instead.\r\n\testimatedItemHeight: PropTypes.number,\r\n\tgetEstimatedItemHeight: PropTypes.func,\r\n\tgetEstimatedVisibleItemRowsCount: PropTypes.func,\r\n\tgetEstimatedInterItemVerticalSpacing: PropTypes.func,\r\n\tbypass: PropTypes.bool,\r\n\t// bypassBatchSize: PropTypes.number,\r\n\ttbody: PropTypes.bool,\r\n\tpreserveScrollPositionOnPrependItems: PropTypes.bool,\r\n\t// `preserveScrollPosition` property name is deprecated,\r\n\t// use `preserveScrollPositionOnPrependItems` instead.\r\n\tpreserveScrollPosition: PropTypes.bool,\r\n\tmeasureItemsBatchSize: PropTypes.number,\r\n\t// `scrollableContainer` property is deprecated.\r\n\t// Use `getScrollableContainer()` property instead.\r\n\tscrollableContainer: PropTypes.any,\r\n\tgetScrollableContainer: PropTypes.func,\r\n\tgetColumnsCount: PropTypes.func,\r\n\tgetItemId: PropTypes.func,\r\n\tclassName: PropTypes.string,\r\n\treadyToStart: PropTypes.bool,\r\n\tonMount: PropTypes.func,\r\n\tonItemInitialRender: PropTypes.func,\r\n\t// `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.\r\n\tonItemFirstRender: PropTypes.func,\r\n\tinitialScrollPosition: PropTypes.number,\r\n\tonScrollPositionChange: PropTypes.func,\r\n\tonStateChange: PropTypes.func,\r\n\tinitialState: PropTypes.shape({\r\n\t\titems: PropTypes.arrayOf(PropTypes.object).isRequired,\r\n\t\titemStates: PropTypes.arrayOf(PropTypes.any).isRequired,\r\n\t\tfirstShownItemIndex: PropTypes.number.isRequired,\r\n\t\tlastShownItemIndex: PropTypes.number.isRequired,\r\n\t\tbeforeItemsHeight: PropTypes.number.isRequired,\r\n\t\tafterItemsHeight: PropTypes.number.isRequired,\r\n\t\titemHeights: PropTypes.arrayOf(PropTypes.number).isRequired,\r\n\t\tcolumnsCount: PropTypes.number,\r\n\t\tverticalSpacing: PropTypes.number\r\n\t}),\r\n\tgetInitialItemState: PropTypes.func\r\n}\r\n\r\n// Legacy compatibility:\r\n//\r\n// Originally, the default export of the `virtual-scroller/react` subpackage\r\n// was only the `VirtualScroller` component, and there were no other exports.\r\n//\r\n// Later, `useVirtualScroller()` hook export was added.\r\n// In order to maintain legacy compatibility, the new exports shouldn't \"break\"\r\n// the existing environments that were using the old versions of the package.\r\n// This means that in non-ES6-import environments, any additional exports\r\n// should be added directly to the default `VirtualScroller` export.\r\n//\r\nVirtualScroller.useVirtualScroller = useVirtualScroller"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;;;;;;;AAEA,SAASA,eAAT,OA+CGC,GA/CH,EA+CQ;EAAA,IA3CPC,EA2CO,QA3CPA,EA2CO;EAAA,IA1CAC,aA0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
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = useVirtualScroller;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _VirtualScroller = _interopRequireDefault(require("../VirtualScroller.js"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
14
|
+
// Creates a `VirtualScroller` instance.
|
|
15
|
+
function useVirtualScroller(_ref, _ref2) {
|
|
16
|
+
var items = _ref.items,
|
|
17
|
+
estimatedItemHeight = _ref.estimatedItemHeight,
|
|
18
|
+
getEstimatedItemHeight = _ref.getEstimatedItemHeight,
|
|
19
|
+
getEstimatedVisibleItemRowsCount = _ref.getEstimatedVisibleItemRowsCount,
|
|
20
|
+
getEstimatedInterItemVerticalSpacing = _ref.getEstimatedInterItemVerticalSpacing,
|
|
21
|
+
bypass = _ref.bypass,
|
|
22
|
+
onItemInitialRender = _ref.onItemInitialRender,
|
|
23
|
+
onItemFirstRender = _ref.onItemFirstRender,
|
|
24
|
+
initialScrollPosition = _ref.initialScrollPosition,
|
|
25
|
+
onScrollPositionChange = _ref.onScrollPositionChange,
|
|
26
|
+
measureItemsBatchSize = _ref.measureItemsBatchSize,
|
|
27
|
+
scrollableContainer = _ref.scrollableContainer,
|
|
28
|
+
getScrollableContainer = _ref.getScrollableContainer,
|
|
29
|
+
getColumnsCount = _ref.getColumnsCount,
|
|
30
|
+
getItemId = _ref.getItemId,
|
|
31
|
+
initialState = _ref.initialState,
|
|
32
|
+
getInitialItemState = _ref.getInitialItemState,
|
|
33
|
+
onStateChange = _ref.onStateChange;
|
|
34
|
+
var getItemsContainerElement = _ref2.getItemsContainerElement;
|
|
35
|
+
return (0, _react.useMemo)(function () {
|
|
36
|
+
// Create `virtual-scroller` instance.
|
|
37
|
+
return new _VirtualScroller["default"](getItemsContainerElement, items, {
|
|
38
|
+
_useTimeoutInRenderLoop: true,
|
|
39
|
+
// `estimatedItemHeight` is deprecated, use `getEstimatedItemHeight()` instead.
|
|
40
|
+
estimatedItemHeight: estimatedItemHeight,
|
|
41
|
+
getEstimatedItemHeight: getEstimatedItemHeight,
|
|
42
|
+
getEstimatedVisibleItemRowsCount: getEstimatedVisibleItemRowsCount,
|
|
43
|
+
getEstimatedInterItemVerticalSpacing: getEstimatedInterItemVerticalSpacing,
|
|
44
|
+
bypass: bypass,
|
|
45
|
+
// bypassBatchSize,
|
|
46
|
+
onItemInitialRender: onItemInitialRender,
|
|
47
|
+
// `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.
|
|
48
|
+
onItemFirstRender: onItemFirstRender,
|
|
49
|
+
initialScrollPosition: initialScrollPosition,
|
|
50
|
+
onScrollPositionChange: onScrollPositionChange,
|
|
51
|
+
measureItemsBatchSize: measureItemsBatchSize,
|
|
52
|
+
// `scrollableContainer` property is deprecated.
|
|
53
|
+
// Use `getScrollableContainer()` property instead.
|
|
54
|
+
scrollableContainer: scrollableContainer,
|
|
55
|
+
getScrollableContainer: getScrollableContainer,
|
|
56
|
+
getColumnsCount: getColumnsCount,
|
|
57
|
+
getItemId: getItemId,
|
|
58
|
+
state: initialState,
|
|
59
|
+
getInitialItemState: getInitialItemState,
|
|
60
|
+
onStateChange: onStateChange
|
|
61
|
+
});
|
|
62
|
+
}, []);
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=useCreateVirtualScroller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCreateVirtualScroller.js","names":["useVirtualScroller","items","estimatedItemHeight","getEstimatedItemHeight","getEstimatedVisibleItemRowsCount","getEstimatedInterItemVerticalSpacing","bypass","onItemInitialRender","onItemFirstRender","initialScrollPosition","onScrollPositionChange","measureItemsBatchSize","scrollableContainer","getScrollableContainer","getColumnsCount","getItemId","initialState","getInitialItemState","onStateChange","getItemsContainerElement","useMemo","VirtualScroller","_useTimeoutInRenderLoop","state"],"sources":["../../source/react/useCreateVirtualScroller.js"],"sourcesContent":["import { useMemo } from 'react'\r\n\r\nimport VirtualScroller from '../VirtualScroller.js'\r\n\r\n// Creates a `VirtualScroller` instance.\r\nexport default function useVirtualScroller({\r\n\titems,\r\n\t// `estimatedItemHeight` is deprecated, use `getEstimatedItemHeight()` instead.\r\n\testimatedItemHeight,\r\n\tgetEstimatedItemHeight,\r\n\tgetEstimatedVisibleItemRowsCount,\r\n\tgetEstimatedInterItemVerticalSpacing,\r\n\tbypass,\r\n\t// bypassBatchSize,\r\n\tonItemInitialRender,\r\n\t// `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.\r\n\tonItemFirstRender,\r\n\tinitialScrollPosition,\r\n\tonScrollPositionChange,\r\n\tmeasureItemsBatchSize,\r\n\t// `scrollableContainer` property is deprecated.\r\n\t// Use `getScrollableContainer()` property instead.\r\n\tscrollableContainer,\r\n\tgetScrollableContainer,\r\n\tgetColumnsCount,\r\n\tgetItemId,\r\n\tinitialState,\r\n\tgetInitialItemState,\r\n\tonStateChange\r\n}, {\r\n\tgetItemsContainerElement\r\n}) {\r\n\treturn useMemo(() => {\r\n\t\t// Create `virtual-scroller` instance.\r\n\t\treturn new VirtualScroller(\r\n\t\t\tgetItemsContainerElement,\r\n\t\t\titems,\r\n\t\t\t{\r\n\t\t\t\t_useTimeoutInRenderLoop: true,\r\n\t\t\t\t// `estimatedItemHeight` is deprecated, use `getEstimatedItemHeight()` instead.\r\n\t\t\t\testimatedItemHeight,\r\n\t\t\t\tgetEstimatedItemHeight,\r\n\t\t\t\tgetEstimatedVisibleItemRowsCount,\r\n\t\t\t\tgetEstimatedInterItemVerticalSpacing,\r\n\t\t\t\tbypass,\r\n\t\t\t\t// bypassBatchSize,\r\n\t\t\t\tonItemInitialRender,\r\n\t\t\t\t// `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.\r\n\t\t\t\tonItemFirstRender,\r\n\t\t\t\tinitialScrollPosition,\r\n\t\t\t\tonScrollPositionChange,\r\n\t\t\t\tmeasureItemsBatchSize,\r\n\t\t\t\t// `scrollableContainer` property is deprecated.\r\n\t\t\t\t// Use `getScrollableContainer()` property instead.\r\n\t\t\t\tscrollableContainer,\r\n\t\t\t\tgetScrollableContainer,\r\n\t\t\t\tgetColumnsCount,\r\n\t\t\t\tgetItemId,\r\n\t\t\t\tstate: initialState,\r\n\t\t\t\tgetInitialItemState,\r\n\t\t\t\tonStateChange\r\n\t\t\t}\r\n\t\t)\r\n\t}, [])\r\n}"],"mappings":";;;;;;;AAAA;;AAEA;;;;AAEA;AACe,SAASA,kBAAT,cA0BZ;EAAA,IAzBFC,KAyBE,QAzBFA,KAyBE;EAAA,IAvBFC,mBAuBE,QAvBFA,mBAuBE;EAAA,IAtBFC,sBAsBE,QAtBFA,sBAsBE;EAAA,IArBFC,gCAqBE,QArBFA,gCAqBE;EAAA,IApBFC,oCAoBE,QApBFA,oCAoBE;EAAA,IAnBFC,MAmBE,QAnBFA,MAmBE;EAAA,IAjBFC,mBAiBE,QAjBFA,mBAiBE;EAAA,IAfFC,iBAeE,QAfFA,iBAeE;EAAA,IAdFC,qBAcE,QAdFA,qBAcE;EAAA,IAbFC,sBAaE,QAbFA,sBAaE;EAAA,IAZFC,qBAYE,QAZFA,qBAYE;EAAA,IATFC,mBASE,QATFA,mBASE;EAAA,IARFC,sBAQE,QARFA,sBAQE;EAAA,IAPFC,eAOE,QAPFA,eAOE;EAAA,IANFC,SAME,QANFA,SAME;EAAA,IALFC,YAKE,QALFA,YAKE;EAAA,IAJFC,mBAIE,QAJFA,mBAIE;EAAA,IAHFC,aAGE,QAHFA,aAGE;EAAA,IADFC,wBACE,SADFA,wBACE;EACF,OAAO,IAAAC,cAAA,EAAQ,YAAM;IACpB;IACA,OAAO,IAAIC,2BAAJ,CACNF,wBADM,EAENlB,KAFM,EAGN;MACCqB,uBAAuB,EAAE,IAD1B;MAEC;MACApB,mBAAmB,EAAnBA,mBAHD;MAICC,sBAAsB,EAAtBA,sBAJD;MAKCC,gCAAgC,EAAhCA,gCALD;MAMCC,oCAAoC,EAApCA,oCAND;MAOCC,MAAM,EAANA,MAPD;MAQC;MACAC,mBAAmB,EAAnBA,mBATD;MAUC;MACAC,iBAAiB,EAAjBA,iBAXD;MAYCC,qBAAqB,EAArBA,qBAZD;MAaCC,sBAAsB,EAAtBA,sBAbD;MAcCC,qBAAqB,EAArBA,qBAdD;MAeC;MACA;MACAC,mBAAmB,EAAnBA,mBAjBD;MAkBCC,sBAAsB,EAAtBA,sBAlBD;MAmBCC,eAAe,EAAfA,eAnBD;MAoBCC,SAAS,EAATA,SApBD;MAqBCQ,KAAK,EAAEP,YArBR;MAsBCC,mBAAmB,EAAnBA,mBAtBD;MAuBCC,aAAa,EAAbA;IAvBD,CAHM,CAAP;EA6BA,CA/BM,EA+BJ,EA/BI,CAAP;AAgCA"}
|
|
@@ -25,11 +25,11 @@ function useInstanceMethods(ref, _ref) {
|
|
|
25
25
|
},
|
|
26
26
|
// (deprecated)
|
|
27
27
|
updateItem: function updateItem(i) {
|
|
28
|
-
(0, _debug.reportError)("
|
|
28
|
+
(0, _debug.reportError)("\".updateItem(i)\" method of React <VirtualScroller/> has been removed");
|
|
29
29
|
},
|
|
30
30
|
// (deprecated)
|
|
31
31
|
renderItem: function renderItem(i) {
|
|
32
|
-
(0, _debug.reportError)("
|
|
32
|
+
(0, _debug.reportError)("\".renderItem(i)\" method of React <VirtualScroller/> has been removed");
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
}, [virtualScroller]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInstanceMethods.js","names":["useInstanceMethods","ref","virtualScroller","useImperativeHandle","updateLayout","layout","updateItem","i","reportError","renderItem"],"sources":["../../source/react/useInstanceMethods.js"],"sourcesContent":["import { useImperativeHandle } from 'react'\r\n\r\nimport { reportError } from '../utility/debug.js'\r\n\r\n// Adds instance methods to the React component.\r\nexport default function useInstanceMethods(ref, {\r\n\tvirtualScroller\r\n}) {\r\n\tuseImperativeHandle(ref, () => ({\r\n\t\t// This is a proxy for `VirtualScroller`'s `.updateLayout` instance method.\r\n\t\tupdateLayout: () => {\r\n\t\t\tvirtualScroller.updateLayout()\r\n\t\t},\r\n\r\n\t\t// (deprecated)\r\n\t\t// `.layout()` method name is deprecated, use `.updateLayout()` instead.\r\n layout: () => {\r\n\t\t\tvirtualScroller.updateLayout()\r\n\t\t},\r\n\r\n\t\t// (deprecated)\r\n\t\tupdateItem: (i) => {\r\n\t\t\treportError(
|
|
1
|
+
{"version":3,"file":"useInstanceMethods.js","names":["useInstanceMethods","ref","virtualScroller","useImperativeHandle","updateLayout","layout","updateItem","i","reportError","renderItem"],"sources":["../../source/react/useInstanceMethods.js"],"sourcesContent":["import { useImperativeHandle } from 'react'\r\n\r\nimport { reportError } from '../utility/debug.js'\r\n\r\n// Adds instance methods to the React component.\r\nexport default function useInstanceMethods(ref, {\r\n\tvirtualScroller\r\n}) {\r\n\tuseImperativeHandle(ref, () => ({\r\n\t\t// This is a proxy for `VirtualScroller`'s `.updateLayout` instance method.\r\n\t\tupdateLayout: () => {\r\n\t\t\tvirtualScroller.updateLayout()\r\n\t\t},\r\n\r\n\t\t// (deprecated)\r\n\t\t// `.layout()` method name is deprecated, use `.updateLayout()` instead.\r\n layout: () => {\r\n\t\t\tvirtualScroller.updateLayout()\r\n\t\t},\r\n\r\n\t\t// (deprecated)\r\n\t\tupdateItem: (i) => {\r\n\t\t\treportError(`\".updateItem(i)\" method of React <VirtualScroller/> has been removed`)\r\n\t\t},\r\n\r\n\t\t// (deprecated)\r\n\t\trenderItem: (i) => {\r\n\t\t\treportError(`\".renderItem(i)\" method of React <VirtualScroller/> has been removed`)\r\n\t\t}\r\n\t}), [\r\n\t\tvirtualScroller\r\n\t])\r\n}"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;AACe,SAASA,kBAAT,CAA4BC,GAA5B,QAEZ;EAAA,IADFC,eACE,QADFA,eACE;EACF,IAAAC,0BAAA,EAAoBF,GAApB,EAAyB;IAAA,OAAO;MAC/B;MACAG,YAAY,EAAE,wBAAM;QACnBF,eAAe,CAACE,YAAhB;MACA,CAJ8B;MAM/B;MACA;MACEC,MAAM,EAAE,kBAAM;QACfH,eAAe,CAACE,YAAhB;MACA,CAV8B;MAY/B;MACAE,UAAU,EAAE,oBAACC,CAAD,EAAO;QAClB,IAAAC,kBAAA;MACA,CAf8B;MAiB/B;MACAC,UAAU,EAAE,oBAACF,CAAD,EAAO;QAClB,IAAAC,kBAAA;MACA;IApB8B,CAAP;EAAA,CAAzB,EAqBI,CACHN,eADG,CArBJ;AAwBA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = useMergeRefs;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
// import type { MutableRefObject } from 'react'
|
|
11
|
+
// use this hook when a React component receives a `ref` which it is supposed to "forward"
|
|
12
|
+
// and when it would also like to access that `ref`'s value in its code.
|
|
13
|
+
//
|
|
14
|
+
// ```js
|
|
15
|
+
// const FormWithAutoFocus = forwardRef((props, ref) => {
|
|
16
|
+
// const duplicateRef = useRef()
|
|
17
|
+
// const setRef = useMergeRefs<RefValueType>(ref, duplicateRef)
|
|
18
|
+
//
|
|
19
|
+
// useEffect(() => {
|
|
20
|
+
// duplicateRef.current.focus()
|
|
21
|
+
// }, [])
|
|
22
|
+
//
|
|
23
|
+
// return (
|
|
24
|
+
// <Form ref={setRef} {...props}/>
|
|
25
|
+
// )
|
|
26
|
+
// })
|
|
27
|
+
// ```
|
|
28
|
+
//
|
|
29
|
+
// export default function useMergeRefs<T extends MutableRefObject<any>>(ref1, ref2, ref3) {
|
|
30
|
+
function useMergeRefs(ref1, ref2, ref3, otherArgument) {
|
|
31
|
+
if (otherArgument) {
|
|
32
|
+
throw new Error('A maximum of 3 refs is supported');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var setRef = (0, _react.useCallback)(function (instance) {
|
|
36
|
+
setRefValue(ref1, instance);
|
|
37
|
+
setRefValue(ref2, instance);
|
|
38
|
+
setRefValue(ref3, instance);
|
|
39
|
+
}, [ref1, ref2, ref3]);
|
|
40
|
+
return setRef;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function setRefValue(ref, instance) {
|
|
44
|
+
if (ref) {
|
|
45
|
+
if (typeof ref === 'function') {
|
|
46
|
+
ref(instance);
|
|
47
|
+
} else {
|
|
48
|
+
ref.current = instance;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=useMergeRefs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMergeRefs.js","names":["useMergeRefs","ref1","ref2","ref3","otherArgument","Error","setRef","useCallback","instance","setRefValue","ref","current"],"sources":["../../source/react/useMergeRefs.js"],"sourcesContent":["// import type { MutableRefObject } from 'react'\r\nimport { useCallback } from 'react'\r\n\r\n// use this hook when a React component receives a `ref` which it is supposed to \"forward\"\r\n// and when it would also like to access that `ref`'s value in its code.\r\n//\r\n// ```js\r\n// const FormWithAutoFocus = forwardRef((props, ref) => {\r\n// const duplicateRef = useRef()\r\n// const setRef = useMergeRefs<RefValueType>(ref, duplicateRef)\r\n//\r\n// useEffect(() => {\r\n// duplicateRef.current.focus()\r\n// }, [])\r\n//\r\n// return (\r\n// <Form ref={setRef} {...props}/>\r\n// )\r\n// })\r\n// ```\r\n//\r\n// export default function useMergeRefs<T extends MutableRefObject<any>>(ref1, ref2, ref3) {\r\nexport default function useMergeRefs(ref1, ref2, ref3, otherArgument) {\r\n\tif (otherArgument) {\r\n\t\tthrow new Error('A maximum of 3 refs is supported')\r\n\t}\r\n\r\n\tconst setRef = useCallback((instance) => {\r\n\t\tsetRefValue(ref1, instance)\r\n\t\tsetRefValue(ref2, instance)\r\n\t\tsetRefValue(ref3, instance)\r\n\t}, [ref1, ref2, ref3])\r\n\r\n\treturn setRef\r\n}\r\n\r\nfunction setRefValue(ref, instance) {\r\n\tif (ref) {\r\n\t\tif (typeof ref === 'function') {\r\n\t\t\tref(instance)\r\n\t\t} else {\r\n\t\t\tref.current = instance\r\n\t\t}\r\n\t}\r\n}"],"mappings":";;;;;;;AACA;;AADA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,YAAT,CAAsBC,IAAtB,EAA4BC,IAA5B,EAAkCC,IAAlC,EAAwCC,aAAxC,EAAuD;EACrE,IAAIA,aAAJ,EAAmB;IAClB,MAAM,IAAIC,KAAJ,CAAU,kCAAV,CAAN;EACA;;EAED,IAAMC,MAAM,GAAG,IAAAC,kBAAA,EAAY,UAACC,QAAD,EAAc;IACxCC,WAAW,CAACR,IAAD,EAAOO,QAAP,CAAX;IACAC,WAAW,CAACP,IAAD,EAAOM,QAAP,CAAX;IACAC,WAAW,CAACN,IAAD,EAAOK,QAAP,CAAX;EACA,CAJc,EAIZ,CAACP,IAAD,EAAOC,IAAP,EAAaC,IAAb,CAJY,CAAf;EAMA,OAAOG,MAAP;AACA;;AAED,SAASG,WAAT,CAAqBC,GAArB,EAA0BF,QAA1B,EAAoC;EACnC,IAAIE,GAAJ,EAAS;IACR,IAAI,OAAOA,GAAP,KAAe,UAAnB,EAA+B;MAC9BA,GAAG,CAACF,QAAD,CAAH;IACA,CAFD,MAEO;MACNE,GAAG,CAACC,OAAJ,GAAcH,QAAd;IACA;EACD;AACD"}
|
package/commonjs/react/{useVirtualScrollerStartStop.js.map → useStartStopVirtualScroller.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"useStartStopVirtualScroller.js","names":["useVirtualScrollerStartStop","virtualScroller","readyToStart","hasStarted","useRef","startIfReadyToStartAndNotStarted","current","log","start","stopIfStarted","stop","useLayoutEffect","readyToStartPrev","useEffect"],"sources":["../../source/react/useStartStopVirtualScroller.js"],"sourcesContent":["import { useLayoutEffect, useEffect, useRef } from 'react'\r\n\r\nimport log from '../utility/debug.js'\r\n\r\nexport default function useVirtualScrollerStartStop(virtualScroller, { readyToStart }) {\r\n\tconst hasStarted = useRef(false)\r\n\r\n\tconst startIfReadyToStartAndNotStarted = () => {\r\n\t\tif (!hasStarted.current) {\r\n\t\t\tif (readyToStart === false) {\r\n\t\t\t\tlog('Could\\'ve started but isn\\'t ready to start')\r\n\t\t\t} else {\r\n\t\t\t\thasStarted.current = true\r\n\t\t\t\t// Start listening to scroll events.\r\n\t\t\t\tvirtualScroller.start()\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tconst stopIfStarted = () => {\r\n\t\tif (hasStarted.current) {\r\n\t\t\t// Stop listening to scroll events.\r\n\t\t\tvirtualScroller.stop()\r\n\t\t\t// Can be re-started.\r\n\t\t\thasStarted.current = false\r\n\t\t}\r\n\t}\r\n\r\n\t// Uses `useLayoutEffect()` here rather than just `useEffect()`\r\n\t// in order to reduce the timeframe of showing an empty list to the user.\r\n\tuseLayoutEffect(() => {\r\n\t\tstartIfReadyToStartAndNotStarted()\r\n\t\treturn stopIfStarted\r\n\t}, [])\r\n\r\n\tconst readyToStartPrev = useRef(readyToStart)\r\n\r\n\tuseEffect(() => {\r\n\t\tif (readyToStartPrev.current === false && readyToStart !== false) {\r\n\t\t\treadyToStartPrev.current = readyToStart\r\n\t\t\tlog('Is ready to start')\r\n\t\t\tstartIfReadyToStartAndNotStarted()\r\n\t\t}\r\n\t}, [readyToStart])\r\n}"],"mappings":";;;;;;;AAAA;;AAEA;;;;AAEe,SAASA,2BAAT,CAAqCC,eAArC,QAAwE;EAAA,IAAhBC,YAAgB,QAAhBA,YAAgB;EACtF,IAAMC,UAAU,GAAG,IAAAC,aAAA,EAAO,KAAP,CAAnB;;EAEA,IAAMC,gCAAgC,GAAG,SAAnCA,gCAAmC,GAAM;IAC9C,IAAI,CAACF,UAAU,CAACG,OAAhB,EAAyB;MACxB,IAAIJ,YAAY,KAAK,KAArB,EAA4B;QAC3B,IAAAK,iBAAA,EAAI,6CAAJ;MACA,CAFD,MAEO;QACNJ,UAAU,CAACG,OAAX,GAAqB,IAArB,CADM,CAEN;;QACAL,eAAe,CAACO,KAAhB;MACA;IACD;EACD,CAVD;;EAYA,IAAMC,aAAa,GAAG,SAAhBA,aAAgB,GAAM;IAC3B,IAAIN,UAAU,CAACG,OAAf,EAAwB;MACvB;MACAL,eAAe,CAACS,IAAhB,GAFuB,CAGvB;;MACAP,UAAU,CAACG,OAAX,GAAqB,KAArB;IACA;EACD,CAPD,CAfsF,CAwBtF;EACA;;;EACA,IAAAK,sBAAA,EAAgB,YAAM;IACrBN,gCAAgC;IAChC,OAAOI,aAAP;EACA,CAHD,EAGG,EAHH;EAKA,IAAMG,gBAAgB,GAAG,IAAAR,aAAA,EAAOF,YAAP,CAAzB;EAEA,IAAAW,gBAAA,EAAU,YAAM;IACf,IAAID,gBAAgB,CAACN,OAAjB,KAA6B,KAA7B,IAAsCJ,YAAY,KAAK,KAA3D,EAAkE;MACjEU,gBAAgB,CAACN,OAAjB,GAA2BJ,YAA3B;MACA,IAAAK,iBAAA,EAAI,mBAAJ;MACAF,gCAAgC;IAChC;EACD,CAND,EAMG,CAACH,YAAD,CANH;AAOA"}
|