virtual-scroller 1.15.0 → 1.15.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.
- 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/VirtualScroller.constructor.js +3 -1
- package/commonjs/VirtualScroller.constructor.js.map +1 -1
- package/commonjs/VirtualScroller.items.js +19 -0
- package/commonjs/VirtualScroller.items.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/commonjs/test/VirtualScroller.js +17 -1
- package/commonjs/test/VirtualScroller.js.map +1 -1
- package/modules/VirtualScroller.constructor.js +3 -1
- package/modules/VirtualScroller.constructor.js.map +1 -1
- package/modules/VirtualScroller.items.js +19 -0
- package/modules/VirtualScroller.items.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/modules/test/VirtualScroller.js +17 -1
- package/modules/test/VirtualScroller.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/VirtualScroller.constructor.js +3 -0
- package/source/VirtualScroller.items.js +14 -0
- 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/source/test/VirtualScroller.js +11 -1
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["as", "items", "itemComponent", "itemComponentProps", "itemsContainerComponent", "itemsContainerComponentProps", "itemsContainerRef", "
|
|
1
|
+
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"];
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
@@ -6,31 +6,16 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
6
6
|
|
|
7
7
|
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; }
|
|
8
8
|
|
|
9
|
-
import React, {
|
|
9
|
+
import React, { useLayoutEffect } from 'react';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
|
-
import useState from './useState.js';
|
|
12
11
|
import useVirtualScroller from './useVirtualScroller.js';
|
|
13
|
-
import useVirtualScrollerStartStop from './useVirtualScrollerStartStop.js';
|
|
14
|
-
import useInstanceMethods from './useInstanceMethods.js';
|
|
15
12
|
import useItemKeys from './useItemKeys.js';
|
|
16
13
|
import useSetItemState from './useSetItemState.js';
|
|
17
14
|
import useOnItemHeightDidChange from './useOnItemHeightDidChange.js';
|
|
18
|
-
import
|
|
15
|
+
import useMergeRefs from './useMergeRefs.js';
|
|
16
|
+
import useInstanceMethods from './useInstanceMethods.js';
|
|
19
17
|
import useUpdateItemKeysOnItemsChange from './useUpdateItemKeysOnItemsChange.js';
|
|
20
|
-
import
|
|
21
|
-
import useForwardedRef from './useForwardedRef.js';
|
|
22
|
-
import useClassName from './useClassName.js';
|
|
23
|
-
import useStyle from './useStyle.js';
|
|
24
|
-
import { warn } from '../utility/debug.js'; // When `items` property changes:
|
|
25
|
-
// * A new `items` property is supplied to the React component.
|
|
26
|
-
// * The React component re-renders itself.
|
|
27
|
-
// * `useSetNewItemsOnItemsPropertyChange()` hook is run.
|
|
28
|
-
// * `useSetNewItemsOnItemsPropertyChange()` hook detects that the `items` property
|
|
29
|
-
// has changed and calls `VirtualScroller.setItems(items)`.
|
|
30
|
-
// * `VirtualScroller.setItems(items)` calls `VirtualScroller.setState()`.
|
|
31
|
-
// * `VirtualScroller.setState()` calls the `setState()` function.
|
|
32
|
-
// * The `setState()` function calls a setter from a `useState()` hook.
|
|
33
|
-
// * The React component re-renders itself the second time.
|
|
18
|
+
import { warn } from '../utility/debug.js';
|
|
34
19
|
|
|
35
20
|
function VirtualScroller(_ref, ref) {
|
|
36
21
|
var as = _ref.as,
|
|
@@ -39,11 +24,7 @@ function VirtualScroller(_ref, ref) {
|
|
|
39
24
|
itemComponentProps = _ref.itemComponentProps,
|
|
40
25
|
ItemsContainerComponent = _ref.itemsContainerComponent,
|
|
41
26
|
itemsContainerComponentProps = _ref.itemsContainerComponentProps,
|
|
42
|
-
|
|
43
|
-
estimatedItemHeight = _ref.estimatedItemHeight,
|
|
44
|
-
getEstimatedItemHeight = _ref.getEstimatedItemHeight,
|
|
45
|
-
getEstimatedVisibleItemRowsCount = _ref.getEstimatedVisibleItemRowsCount,
|
|
46
|
-
getEstimatedInterItemVerticalSpacing = _ref.getEstimatedInterItemVerticalSpacing,
|
|
27
|
+
itemsContainerRefProperty = _ref.itemsContainerRef,
|
|
47
28
|
onMount = _ref.onMount,
|
|
48
29
|
tbody = _ref.tbody,
|
|
49
30
|
readyToStart = _ref.readyToStart,
|
|
@@ -63,6 +44,10 @@ function VirtualScroller(_ref, ref) {
|
|
|
63
44
|
initialState = _ref.initialState,
|
|
64
45
|
getInitialItemState = _ref.getInitialItemState,
|
|
65
46
|
onStateChange = _ref.onStateChange,
|
|
47
|
+
estimatedItemHeight = _ref.estimatedItemHeight,
|
|
48
|
+
getEstimatedItemHeight = _ref.getEstimatedItemHeight,
|
|
49
|
+
getEstimatedVisibleItemRowsCount = _ref.getEstimatedVisibleItemRowsCount,
|
|
50
|
+
getEstimatedInterItemVerticalSpacing = _ref.getEstimatedInterItemVerticalSpacing,
|
|
66
51
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
67
52
|
|
|
68
53
|
// Previously, `as` property was being used instead of `itemsContainerComponent`,
|
|
@@ -71,47 +56,34 @@ function VirtualScroller(_ref, ref) {
|
|
|
71
56
|
// The default `"div"` fallback value is just a legacy compatibility relic, and so is the `as` property.
|
|
72
57
|
if (!ItemsContainerComponent) {
|
|
73
58
|
ItemsContainerComponent = as || 'div';
|
|
74
|
-
} //
|
|
75
|
-
// Instead, it always derived `tbody` property value from `as` property value by comparing it to `"tbody"` string.
|
|
76
|
-
// As a result, it seemed like the explicit passing of `tbody` property didn't really work as intended.
|
|
77
|
-
// In the end, it was decided that perhaps `tbody` property value should always be derived from `as` property
|
|
78
|
-
// without a developer having to manually specify it. So the `tbody` property was deprecated.
|
|
79
|
-
// It still exists though for backwards compatibility with the older versions of the package.
|
|
59
|
+
} // In simple cases, the use of a `<tbody/>` tag as an items container component could be auto-detected.
|
|
80
60
|
|
|
81
61
|
|
|
82
62
|
if (tbody === undefined) {
|
|
83
|
-
// `tbody` should
|
|
63
|
+
// `tbody` auto-detection should happen before any DOM Elements have been mounted,
|
|
64
|
+
// i.e. it can't rely on the trivial `getItemsContainerElement().tagName === 'TBODY'` check.
|
|
84
65
|
// This is because during Server-Side Render there's no DOM Elements tree at all.
|
|
85
66
|
// And server-sider render result is required to be exactly the same as client-side render result.
|
|
86
67
|
// This means that `tbody` detection for the purposes of getting the initial
|
|
87
68
|
// `className` or `style` property values must not rely on any DOM Elements at all,
|
|
88
69
|
// and should use some other means such as explicitly passing a `tbody: true` property
|
|
89
|
-
//
|
|
90
|
-
// `itemsContainerCompoent` property value.
|
|
70
|
+
// or detecting `<tbody/>` tag usage from the `itemsContainerCompoent` property value.
|
|
91
71
|
tbody = ItemsContainerComponent === 'tbody';
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
var _useForwardedRef = useForwardedRef(itemsContainerRef),
|
|
96
|
-
setItemsContainerRef = _useForwardedRef.setRef,
|
|
97
|
-
itemsContainer = _useForwardedRef.internalRef; // Create a `VirtualScroller` instance.
|
|
72
|
+
}
|
|
98
73
|
|
|
99
|
-
|
|
100
|
-
var virtualScroller = useVirtualScroller({
|
|
74
|
+
var _useVirtualScroller = useVirtualScroller({
|
|
101
75
|
items: itemsProperty,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
76
|
+
tbody: tbody,
|
|
77
|
+
readyToStart: readyToStart,
|
|
78
|
+
style: itemsContainerComponentProps && itemsContainerComponentProps.style,
|
|
79
|
+
className: classNameProperty || itemsContainerComponentProps && itemsContainerComponentProps.className,
|
|
80
|
+
// The following are the "core" component options.
|
|
81
|
+
//
|
|
108
82
|
bypass: bypass,
|
|
109
|
-
//
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
initialScrollPosition: initialScrollPosition,
|
|
114
|
-
onScrollPositionChange: onScrollPositionChange,
|
|
83
|
+
// `preserveScrollPosition` property name is deprecated,
|
|
84
|
+
// use `preserveScrollPositionOnPrependItems` property instead.
|
|
85
|
+
preserveScrollPosition: preserveScrollPosition,
|
|
86
|
+
preserveScrollPositionOnPrependItems: preserveScrollPositionOnPrependItems,
|
|
115
87
|
measureItemsBatchSize: measureItemsBatchSize,
|
|
116
88
|
// `scrollableContainer` property is deprecated.
|
|
117
89
|
// Use `getScrollableContainer()` property instead.
|
|
@@ -119,39 +91,30 @@ function VirtualScroller(_ref, ref) {
|
|
|
119
91
|
getScrollableContainer: getScrollableContainer,
|
|
120
92
|
getColumnsCount: getColumnsCount,
|
|
121
93
|
getItemId: getItemId,
|
|
94
|
+
// `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.
|
|
95
|
+
onItemFirstRender: onItemFirstRender,
|
|
96
|
+
onItemInitialRender: onItemInitialRender,
|
|
97
|
+
initialScrollPosition: initialScrollPosition,
|
|
98
|
+
onScrollPositionChange: onScrollPositionChange,
|
|
122
99
|
initialState: initialState,
|
|
123
100
|
getInitialItemState: getInitialItemState,
|
|
124
|
-
onStateChange: onStateChange
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
// This way, React will re-render the component on every state update.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
var _useState = useState({
|
|
136
|
-
initialState: _initialState,
|
|
137
|
-
onRender: virtualScroller.onRender
|
|
101
|
+
onStateChange: onStateChange,
|
|
102
|
+
getEstimatedItemHeight: getEstimatedItemHeight || ( // `estimatedItemHeight` property name is deprecated,
|
|
103
|
+
// use `getEstimatedItemHeight` property instead.
|
|
104
|
+
typeof estimatedItemHeight === 'number' ? function () {
|
|
105
|
+
return estimatedItemHeight;
|
|
106
|
+
} : undefined),
|
|
107
|
+
getEstimatedVisibleItemRowsCount: getEstimatedVisibleItemRowsCount,
|
|
108
|
+
getEstimatedInterItemVerticalSpacing: getEstimatedInterItemVerticalSpacing
|
|
138
109
|
}),
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
110
|
+
stateToRender = _useVirtualScroller.state,
|
|
111
|
+
style = _useVirtualScroller.style,
|
|
112
|
+
className = _useVirtualScroller.className,
|
|
113
|
+
itemsContainerRef = _useVirtualScroller.itemsContainerRef,
|
|
114
|
+
virtualScroller = _useVirtualScroller.virtualScroller; // List items "container" DOM Element reference.
|
|
143
115
|
|
|
144
|
-
useMemo(function () {
|
|
145
|
-
virtualScroller.useState({
|
|
146
|
-
getState: getState,
|
|
147
|
-
setState: setState
|
|
148
|
-
});
|
|
149
|
-
}, []); // Start `VirtualScroller` on mount.
|
|
150
|
-
// Stop `VirtualScroller` on unmount.
|
|
151
116
|
|
|
152
|
-
|
|
153
|
-
readyToStart: readyToStart
|
|
154
|
-
}); // List items are rendered with `key`s so that React doesn't
|
|
117
|
+
var setItemsContainerRef = useMergeRefs(itemsContainerRef, itemsContainerRefProperty); // List items are rendered with `key`s so that React doesn't
|
|
155
118
|
// "reuse" `itemComponent`s in cases when `items` are changed.
|
|
156
119
|
|
|
157
120
|
var _useItemKeys = useItemKeys({
|
|
@@ -160,10 +123,16 @@ function VirtualScroller(_ref, ref) {
|
|
|
160
123
|
getItemKey = _useItemKeys.getItemKey,
|
|
161
124
|
onItemKeysReset = _useItemKeys.onItemKeysReset,
|
|
162
125
|
usesAutogeneratedItemKeys = _useItemKeys.usesAutogeneratedItemKeys,
|
|
163
|
-
updateItemKeysForNewItems = _useItemKeys.updateItemKeysForNewItems; //
|
|
164
|
-
// so that item components don't get re-rendered needlessly.
|
|
126
|
+
updateItemKeysForNewItems = _useItemKeys.updateItemKeysForNewItems; // Updates `key`s if item indexes have changed.
|
|
165
127
|
|
|
166
128
|
|
|
129
|
+
useUpdateItemKeysOnItemsChange(stateToRender.items, {
|
|
130
|
+
virtualScroller: virtualScroller,
|
|
131
|
+
usesAutogeneratedItemKeys: usesAutogeneratedItemKeys,
|
|
132
|
+
updateItemKeysForNewItems: updateItemKeysForNewItems
|
|
133
|
+
}); // Cache per-item `setItemState` functions' "references"
|
|
134
|
+
// so that item components don't get re-rendered needlessly.
|
|
135
|
+
|
|
167
136
|
var getSetItemState = useSetItemState({
|
|
168
137
|
getItemKey: getItemKey,
|
|
169
138
|
onItemKeysReset: onItemKeysReset,
|
|
@@ -175,20 +144,6 @@ function VirtualScroller(_ref, ref) {
|
|
|
175
144
|
getItemKey: getItemKey,
|
|
176
145
|
onItemKeysReset: onItemKeysReset,
|
|
177
146
|
virtualScroller: virtualScroller
|
|
178
|
-
}); // Calls `.setItems()` if `items` property has changed.
|
|
179
|
-
|
|
180
|
-
useSetNewItemsOnItemsPropertyChange(itemsProperty, {
|
|
181
|
-
virtualScroller: virtualScroller,
|
|
182
|
-
// `preserveScrollPosition` property name is deprecated,
|
|
183
|
-
// use `preserveScrollPositionOnPrependItems` property instead.
|
|
184
|
-
preserveScrollPosition: preserveScrollPosition,
|
|
185
|
-
preserveScrollPositionOnPrependItems: preserveScrollPositionOnPrependItems
|
|
186
|
-
}); // Updates `key`s if item indexes have changed.
|
|
187
|
-
|
|
188
|
-
useUpdateItemKeysOnItemsChange(stateToRender.items, {
|
|
189
|
-
virtualScroller: virtualScroller,
|
|
190
|
-
usesAutogeneratedItemKeys: usesAutogeneratedItemKeys,
|
|
191
|
-
updateItemKeysForNewItems: updateItemKeysForNewItems
|
|
192
147
|
}); // Add instance methods to the React component.
|
|
193
148
|
|
|
194
149
|
useInstanceMethods(ref, {
|
|
@@ -202,14 +157,7 @@ function VirtualScroller(_ref, ref) {
|
|
|
202
157
|
warn('`onMount` property is deprecated');
|
|
203
158
|
onMount();
|
|
204
159
|
}
|
|
205
|
-
}, []); //
|
|
206
|
-
// when using a `<tbody/>` as a container for list items.
|
|
207
|
-
// This hook validates that the developer didn't "forget" to do that in such case.
|
|
208
|
-
|
|
209
|
-
useValidateTableBodyItemsContainer({
|
|
210
|
-
virtualScroller: virtualScroller,
|
|
211
|
-
tbody: tbody
|
|
212
|
-
}); // `willRender()` function is no longer used.
|
|
160
|
+
}, []); // `willRender()` function is no longer used.
|
|
213
161
|
//
|
|
214
162
|
// // `getSnapshotBeforeUpdate()` is called right before `componentDidUpdate()`.
|
|
215
163
|
// // A hook equivalent/workaround for `getSnapshotBeforeUpdate()`:
|
|
@@ -224,15 +172,6 @@ function VirtualScroller(_ref, ref) {
|
|
|
224
172
|
// return null
|
|
225
173
|
// }
|
|
226
174
|
|
|
227
|
-
var classNamePassThrough = classNameProperty || itemsContainerComponentProps && itemsContainerComponentProps.className;
|
|
228
|
-
var className = useClassName(classNamePassThrough, {
|
|
229
|
-
tbody: tbody
|
|
230
|
-
});
|
|
231
|
-
var stylePassThrough = itemsContainerComponentProps && itemsContainerComponentProps.style;
|
|
232
|
-
var style = useStyle(stylePassThrough, {
|
|
233
|
-
tbody: tbody,
|
|
234
|
-
state: stateToRender
|
|
235
|
-
});
|
|
236
175
|
var currentItems = stateToRender.items,
|
|
237
176
|
itemStates = stateToRender.itemStates,
|
|
238
177
|
firstShownItemIndex = stateToRender.firstShownItemIndex,
|
|
@@ -309,9 +248,7 @@ VirtualScroller.propTypes = {
|
|
|
309
248
|
getEstimatedInterItemVerticalSpacing: PropTypes.func,
|
|
310
249
|
bypass: PropTypes.bool,
|
|
311
250
|
// bypassBatchSize: PropTypes.number,
|
|
312
|
-
|
|
313
|
-
// Pass `as: "tbody"` property instead.
|
|
314
|
-
// tbody: PropTypes.bool,
|
|
251
|
+
tbody: PropTypes.bool,
|
|
315
252
|
preserveScrollPositionOnPrependItems: PropTypes.bool,
|
|
316
253
|
// `preserveScrollPosition` property name is deprecated,
|
|
317
254
|
// use `preserveScrollPositionOnPrependItems` instead.
|
|
@@ -344,5 +281,17 @@ VirtualScroller.propTypes = {
|
|
|
344
281
|
verticalSpacing: PropTypes.number
|
|
345
282
|
}),
|
|
346
283
|
getInitialItemState: PropTypes.func
|
|
347
|
-
};
|
|
284
|
+
}; // Legacy compatibility:
|
|
285
|
+
//
|
|
286
|
+
// Originally, the default export of the `virtual-scroller/react` subpackage
|
|
287
|
+
// was only the `VirtualScroller` component, and there were no other exports.
|
|
288
|
+
//
|
|
289
|
+
// Later, `useVirtualScroller()` hook export was added.
|
|
290
|
+
// In order to maintain legacy compatibility, the new exports shouldn't "break"
|
|
291
|
+
// the existing environments that were using the old versions of the package.
|
|
292
|
+
// This means that in non-ES6-import environments, any additional exports
|
|
293
|
+
// should be added directly to the default `VirtualScroller` export.
|
|
294
|
+
//
|
|
295
|
+
|
|
296
|
+
VirtualScroller.useVirtualScroller = useVirtualScroller;
|
|
348
297
|
//# sourceMappingURL=VirtualScroller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualScroller.js","names":["React","useMemo","useLayoutEffect","PropTypes","useState","useVirtualScroller","useVirtualScrollerStartStop","useInstanceMethods","useItemKeys","useSetItemState","useOnItemHeightDidChange","useSetNewItemsOnItemsPropertyChange","useUpdateItemKeysOnItemsChange","useValidateTableBodyItemsContainer","useForwardedRef","useClassName","useStyle","warn","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","setItemsContainerRef","setRef","itemsContainer","internalRef","virtualScroller","_initialState","getInitialState","onRender","getState","setState","stateToRender","getItemKey","onItemKeysReset","usesAutogeneratedItemKeys","updateItemKeysForNewItems","getSetItemState","getOnItemHeightDidChange","classNamePassThrough","stylePassThrough","style","state","currentItems","itemStates","firstShownItemIndex","lastShownItemIndex","map","item","i","forwardRef","elementType","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,OAAOA,KAAP,IAAgBC,OAAhB,EAAyBC,eAAzB,QAAgD,OAAhD;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,QAAP,MAAqB,eAArB;AACA,OAAOC,kBAAP,MAA+B,yBAA/B;AACA,OAAOC,2BAAP,MAAwC,kCAAxC;AACA,OAAOC,kBAAP,MAA+B,yBAA/B;AACA,OAAOC,WAAP,MAAwB,kBAAxB;AACA,OAAOC,eAAP,MAA4B,sBAA5B;AACA,OAAOC,wBAAP,MAAqC,+BAArC;AACA,OAAOC,mCAAP,MAAgD,0CAAhD;AACA,OAAOC,8BAAP,MAA2C,qCAA3C;AACA,OAAOC,kCAAP,MAA+C,yCAA/C;AACA,OAAOC,eAAP,MAA4B,sBAA5B;AACA,OAAOC,YAAP,MAAyB,mBAAzB;AACA,OAAOC,QAAP,MAAqB,eAArB;AAEA,SAASC,IAAT,QAAqB,qBAArB,C,CAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASC,eAAT,OAiDGC,GAjDH,EAiDQ;EAAA,IA7CPC,EA6CO,QA7CPA,EA6CO;EAAA,IA5CAC,aA4CA,QA5CPC,KA4CO;EAAA,IA3CQC,aA2CR,QA3CPC,aA2CO;EAAA,IA1CPC,kBA0CO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AAS,CAACwF,OAAV,CAAkBxF,SAAS,CAACyF,GAA5B,EAAiCC,UAFhB;IAG7Bd,mBAAmB,EAAE5E,SAAS,CAAC6F,MAAV,CAAiBH,UAHT;IAI7Bb,kBAAkB,EAAE7E,SAAS,CAAC6F,MAAV,CAAiBH,UAJR;IAK7BK,iBAAiB,EAAE/F,SAAS,CAAC6F,MAAV,CAAiBH,UALP;IAM7BM,gBAAgB,EAAEhG,SAAS,CAAC6F,MAAV,CAAiBH,UANN;IAO7BO,WAAW,EAAEjG,SAAS,CAACwF,OAAV,CAAkBxF,SAAS,CAAC6F,MAA5B,EAAoCH,UAPpB;IAQ7BQ,YAAY,EAAElG,SAAS,CAAC6F,MARK;IAS7BM,eAAe,EAAEnG,SAAS,CAAC6F;EATE,CAAhB,CA7Ca;EAwD3B5C,mBAAmB,EAAEjD,SAAS,CAACqF;AAxDJ,CAA5B"}
|
|
1
|
+
{"version":3,"file":"VirtualScroller.js","names":["React","useLayoutEffect","PropTypes","useVirtualScroller","useItemKeys","useSetItemState","useOnItemHeightDidChange","useMergeRefs","useInstanceMethods","useUpdateItemKeysOnItemsChange","warn","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","style","stateToRender","state","virtualScroller","setItemsContainerRef","getItemKey","onItemKeysReset","usesAutogeneratedItemKeys","updateItemKeysForNewItems","getSetItemState","getOnItemHeightDidChange","currentItems","itemStates","firstShownItemIndex","lastShownItemIndex","map","item","i","forwardRef","elementType","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":";;;;;;;;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AAS,CAACyE,OAAV,CAAkBzE,SAAS,CAAC8E,MAA5B,EAAoCH,UAPpB;IAQ7BQ,YAAY,EAAEnF,SAAS,CAAC8E,MARK;IAS7BM,eAAe,EAAEpF,SAAS,CAAC8E;EATE,CAAhB,CA3Ca;EAsD3BtC,mBAAmB,EAAExC,SAAS,CAACsE;AAtDJ,CAA5B,C,CAyDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA7D,eAAe,CAACR,kBAAhB,GAAqCA,kBAArC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import VirtualScroller from '../VirtualScroller.js'; // Creates a `VirtualScroller` instance.
|
|
3
|
+
|
|
4
|
+
export default function useVirtualScroller(_ref, _ref2) {
|
|
5
|
+
var items = _ref.items,
|
|
6
|
+
estimatedItemHeight = _ref.estimatedItemHeight,
|
|
7
|
+
getEstimatedItemHeight = _ref.getEstimatedItemHeight,
|
|
8
|
+
getEstimatedVisibleItemRowsCount = _ref.getEstimatedVisibleItemRowsCount,
|
|
9
|
+
getEstimatedInterItemVerticalSpacing = _ref.getEstimatedInterItemVerticalSpacing,
|
|
10
|
+
bypass = _ref.bypass,
|
|
11
|
+
onItemInitialRender = _ref.onItemInitialRender,
|
|
12
|
+
onItemFirstRender = _ref.onItemFirstRender,
|
|
13
|
+
initialScrollPosition = _ref.initialScrollPosition,
|
|
14
|
+
onScrollPositionChange = _ref.onScrollPositionChange,
|
|
15
|
+
measureItemsBatchSize = _ref.measureItemsBatchSize,
|
|
16
|
+
scrollableContainer = _ref.scrollableContainer,
|
|
17
|
+
getScrollableContainer = _ref.getScrollableContainer,
|
|
18
|
+
getColumnsCount = _ref.getColumnsCount,
|
|
19
|
+
getItemId = _ref.getItemId,
|
|
20
|
+
initialState = _ref.initialState,
|
|
21
|
+
getInitialItemState = _ref.getInitialItemState,
|
|
22
|
+
onStateChange = _ref.onStateChange;
|
|
23
|
+
var getItemsContainerElement = _ref2.getItemsContainerElement;
|
|
24
|
+
return useMemo(function () {
|
|
25
|
+
// Create `virtual-scroller` instance.
|
|
26
|
+
return new VirtualScroller(getItemsContainerElement, items, {
|
|
27
|
+
_useTimeoutInRenderLoop: true,
|
|
28
|
+
// `estimatedItemHeight` is deprecated, use `getEstimatedItemHeight()` instead.
|
|
29
|
+
estimatedItemHeight: estimatedItemHeight,
|
|
30
|
+
getEstimatedItemHeight: getEstimatedItemHeight,
|
|
31
|
+
getEstimatedVisibleItemRowsCount: getEstimatedVisibleItemRowsCount,
|
|
32
|
+
getEstimatedInterItemVerticalSpacing: getEstimatedInterItemVerticalSpacing,
|
|
33
|
+
bypass: bypass,
|
|
34
|
+
// bypassBatchSize,
|
|
35
|
+
onItemInitialRender: onItemInitialRender,
|
|
36
|
+
// `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.
|
|
37
|
+
onItemFirstRender: onItemFirstRender,
|
|
38
|
+
initialScrollPosition: initialScrollPosition,
|
|
39
|
+
onScrollPositionChange: onScrollPositionChange,
|
|
40
|
+
measureItemsBatchSize: measureItemsBatchSize,
|
|
41
|
+
// `scrollableContainer` property is deprecated.
|
|
42
|
+
// Use `getScrollableContainer()` property instead.
|
|
43
|
+
scrollableContainer: scrollableContainer,
|
|
44
|
+
getScrollableContainer: getScrollableContainer,
|
|
45
|
+
getColumnsCount: getColumnsCount,
|
|
46
|
+
getItemId: getItemId,
|
|
47
|
+
state: initialState,
|
|
48
|
+
getInitialItemState: getInitialItemState,
|
|
49
|
+
onStateChange: onStateChange
|
|
50
|
+
});
|
|
51
|
+
}, []);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=useCreateVirtualScroller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCreateVirtualScroller.js","names":["useMemo","VirtualScroller","useVirtualScroller","items","estimatedItemHeight","getEstimatedItemHeight","getEstimatedVisibleItemRowsCount","getEstimatedInterItemVerticalSpacing","bypass","onItemInitialRender","onItemFirstRender","initialScrollPosition","onScrollPositionChange","measureItemsBatchSize","scrollableContainer","getScrollableContainer","getColumnsCount","getItemId","initialState","getInitialItemState","onStateChange","getItemsContainerElement","_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,SAASA,OAAT,QAAwB,OAAxB;AAEA,OAAOC,eAAP,MAA4B,uBAA5B,C,CAEA;;AACA,eAAe,SAASC,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,OAAOrB,OAAO,CAAC,YAAM;IACpB;IACA,OAAO,IAAIC,eAAJ,CACNoB,wBADM,EAENlB,KAFM,EAGN;MACCmB,uBAAuB,EAAE,IAD1B;MAEC;MACAlB,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;MAqBCM,KAAK,EAAEL,YArBR;MAsBCC,mBAAmB,EAAnBA,mBAtBD;MAuBCC,aAAa,EAAbA;IAvBD,CAHM,CAAP;EA6BA,CA/Ba,EA+BX,EA/BW,CAAd;AAgCA"}
|
|
@@ -16,11 +16,11 @@ export default function useInstanceMethods(ref, _ref) {
|
|
|
16
16
|
},
|
|
17
17
|
// (deprecated)
|
|
18
18
|
updateItem: function updateItem(i) {
|
|
19
|
-
reportError("
|
|
19
|
+
reportError("\".updateItem(i)\" method of React <VirtualScroller/> has been removed");
|
|
20
20
|
},
|
|
21
21
|
// (deprecated)
|
|
22
22
|
renderItem: function renderItem(i) {
|
|
23
|
-
reportError("
|
|
23
|
+
reportError("\".renderItem(i)\" method of React <VirtualScroller/> has been removed");
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
}, [virtualScroller]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInstanceMethods.js","names":["useImperativeHandle","reportError","useInstanceMethods","ref","virtualScroller","updateLayout","layout","updateItem","i","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":["useImperativeHandle","reportError","useInstanceMethods","ref","virtualScroller","updateLayout","layout","updateItem","i","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,SAASA,mBAAT,QAAoC,OAApC;AAEA,SAASC,WAAT,QAA4B,qBAA5B,C,CAEA;;AACA,eAAe,SAASC,kBAAT,CAA4BC,GAA5B,QAEZ;EAAA,IADFC,eACE,QADFA,eACE;EACFJ,mBAAmB,CAACG,GAAD,EAAM;IAAA,OAAO;MAC/B;MACAE,YAAY,EAAE,wBAAM;QACnBD,eAAe,CAACC,YAAhB;MACA,CAJ8B;MAM/B;MACA;MACEC,MAAM,EAAE,kBAAM;QACfF,eAAe,CAACC,YAAhB;MACA,CAV8B;MAY/B;MACAE,UAAU,EAAE,oBAACC,CAAD,EAAO;QAClBP,WAAW,0EAAX;MACA,CAf8B;MAiB/B;MACAQ,UAAU,EAAE,oBAACD,CAAD,EAAO;QAClBP,WAAW,0EAAX;MACA;IApB8B,CAAP;EAAA,CAAN,EAqBf,CACHG,eADG,CArBe,CAAnB;AAwBA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// import type { MutableRefObject } from 'react'
|
|
2
|
+
import { useCallback } from 'react'; // use this hook when a React component receives a `ref` which it is supposed to "forward"
|
|
3
|
+
// and when it would also like to access that `ref`'s value in its code.
|
|
4
|
+
//
|
|
5
|
+
// ```js
|
|
6
|
+
// const FormWithAutoFocus = forwardRef((props, ref) => {
|
|
7
|
+
// const duplicateRef = useRef()
|
|
8
|
+
// const setRef = useMergeRefs<RefValueType>(ref, duplicateRef)
|
|
9
|
+
//
|
|
10
|
+
// useEffect(() => {
|
|
11
|
+
// duplicateRef.current.focus()
|
|
12
|
+
// }, [])
|
|
13
|
+
//
|
|
14
|
+
// return (
|
|
15
|
+
// <Form ref={setRef} {...props}/>
|
|
16
|
+
// )
|
|
17
|
+
// })
|
|
18
|
+
// ```
|
|
19
|
+
//
|
|
20
|
+
// export default function useMergeRefs<T extends MutableRefObject<any>>(ref1, ref2, ref3) {
|
|
21
|
+
|
|
22
|
+
export default function useMergeRefs(ref1, ref2, ref3, otherArgument) {
|
|
23
|
+
if (otherArgument) {
|
|
24
|
+
throw new Error('A maximum of 3 refs is supported');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var setRef = useCallback(function (instance) {
|
|
28
|
+
setRefValue(ref1, instance);
|
|
29
|
+
setRefValue(ref2, instance);
|
|
30
|
+
setRefValue(ref3, instance);
|
|
31
|
+
}, [ref1, ref2, ref3]);
|
|
32
|
+
return setRef;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function setRefValue(ref, instance) {
|
|
36
|
+
if (ref) {
|
|
37
|
+
if (typeof ref === 'function') {
|
|
38
|
+
ref(instance);
|
|
39
|
+
} else {
|
|
40
|
+
ref.current = instance;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=useMergeRefs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMergeRefs.js","names":["useCallback","useMergeRefs","ref1","ref2","ref3","otherArgument","Error","setRef","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":"AAAA;AACA,SAASA,WAAT,QAA4B,OAA5B,C,CAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,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,GAAGP,WAAW,CAAC,UAACQ,QAAD,EAAc;IACxCC,WAAW,CAACP,IAAD,EAAOM,QAAP,CAAX;IACAC,WAAW,CAACN,IAAD,EAAOK,QAAP,CAAX;IACAC,WAAW,CAACL,IAAD,EAAOI,QAAP,CAAX;EACA,CAJyB,EAIvB,CAACN,IAAD,EAAOC,IAAP,EAAaC,IAAb,CAJuB,CAA1B;EAMA,OAAOG,MAAP;AACA;;AAED,SAASE,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/modules/react/{useVirtualScrollerStartStop.js.map → useStartStopVirtualScroller.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"useStartStopVirtualScroller.js","names":["useLayoutEffect","useEffect","useRef","log","useVirtualScrollerStartStop","virtualScroller","readyToStart","hasStarted","startIfReadyToStartAndNotStarted","current","start","stopIfStarted","stop","readyToStartPrev"],"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,SAASA,eAAT,EAA0BC,SAA1B,EAAqCC,MAArC,QAAmD,OAAnD;AAEA,OAAOC,GAAP,MAAgB,qBAAhB;AAEA,eAAe,SAASC,2BAAT,CAAqCC,eAArC,QAAwE;EAAA,IAAhBC,YAAgB,QAAhBA,YAAgB;EACtF,IAAMC,UAAU,GAAGL,MAAM,CAAC,KAAD,CAAzB;;EAEA,IAAMM,gCAAgC,GAAG,SAAnCA,gCAAmC,GAAM;IAC9C,IAAI,CAACD,UAAU,CAACE,OAAhB,EAAyB;MACxB,IAAIH,YAAY,KAAK,KAArB,EAA4B;QAC3BH,GAAG,CAAC,6CAAD,CAAH;MACA,CAFD,MAEO;QACNI,UAAU,CAACE,OAAX,GAAqB,IAArB,CADM,CAEN;;QACAJ,eAAe,CAACK,KAAhB;MACA;IACD;EACD,CAVD;;EAYA,IAAMC,aAAa,GAAG,SAAhBA,aAAgB,GAAM;IAC3B,IAAIJ,UAAU,CAACE,OAAf,EAAwB;MACvB;MACAJ,eAAe,CAACO,IAAhB,GAFuB,CAGvB;;MACAL,UAAU,CAACE,OAAX,GAAqB,KAArB;IACA;EACD,CAPD,CAfsF,CAwBtF;EACA;;;EACAT,eAAe,CAAC,YAAM;IACrBQ,gCAAgC;IAChC,OAAOG,aAAP;EACA,CAHc,EAGZ,EAHY,CAAf;EAKA,IAAME,gBAAgB,GAAGX,MAAM,CAACI,YAAD,CAA/B;EAEAL,SAAS,CAAC,YAAM;IACf,IAAIY,gBAAgB,CAACJ,OAAjB,KAA6B,KAA7B,IAAsCH,YAAY,KAAK,KAA3D,EAAkE;MACjEO,gBAAgB,CAACJ,OAAjB,GAA2BH,YAA3B;MACAH,GAAG,CAAC,mBAAD,CAAH;MACAK,gCAAgC;IAChC;EACD,CANQ,EAMN,CAACF,YAAD,CANM,CAAT;AAOA"}
|
|
@@ -5,12 +5,29 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
7
|
import px from '../utility/px.js';
|
|
8
|
+
import { reportError } from '../utility/debug.js';
|
|
8
9
|
export default function useStyle(style, _ref) {
|
|
9
10
|
var tbody = _ref.tbody,
|
|
10
11
|
state = _ref.state;
|
|
11
12
|
|
|
12
13
|
if (tbody) {
|
|
13
14
|
return style;
|
|
15
|
+
} // Validate that the passed `style` property doesn't include
|
|
16
|
+
// `padding-top` or `padding-bottom` or `padding`.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
if (style) {
|
|
20
|
+
if (typeof style.padding === 'number') {
|
|
21
|
+
reportError('`style` property can\'t include any `padding`');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (typeof style.paddingTop === 'number') {
|
|
25
|
+
reportError('`style` property can\'t include any `paddingTop`');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (typeof style.paddingBottom === 'number') {
|
|
29
|
+
reportError('`style` property can\'t include any `paddingBottom`');
|
|
30
|
+
}
|
|
14
31
|
}
|
|
15
32
|
|
|
16
33
|
var beforeItemsHeight = state.beforeItemsHeight,
|