@react-aria/virtualizer 3.10.2-nightly.4649 → 3.10.2-nightly.4656
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/dist/ScrollView.main.js +4 -2
- package/dist/ScrollView.main.js.map +1 -1
- package/dist/ScrollView.mjs +4 -2
- package/dist/ScrollView.module.js +4 -2
- package/dist/ScrollView.module.js.map +1 -1
- package/dist/Virtualizer.main.js +16 -98
- package/dist/Virtualizer.main.js.map +1 -1
- package/dist/Virtualizer.mjs +17 -99
- package/dist/Virtualizer.module.js +17 -99
- package/dist/Virtualizer.module.js.map +1 -1
- package/dist/VirtualizerItem.main.js +0 -4
- package/dist/VirtualizerItem.main.js.map +1 -1
- package/dist/VirtualizerItem.mjs +0 -4
- package/dist/VirtualizerItem.module.js +0 -4
- package/dist/VirtualizerItem.module.js.map +1 -1
- package/dist/types.d.ts +6 -16
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/ScrollView.tsx +2 -2
- package/src/Virtualizer.tsx +18 -109
- package/src/VirtualizerItem.tsx +0 -4
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {ScrollView as $44a6ee657928b002$export$5665e3d6be6adea} from "./ScrollView.module.js";
|
|
2
2
|
import {VirtualizerItem as $ccf8a0a04e4175ae$export$6796df8ba7398521} from "./VirtualizerItem.module.js";
|
|
3
|
-
import {getInteractionModality as $9WwqA$getInteractionModality} from "@react-aria/interactions";
|
|
4
3
|
import {useVirtualizerState as $9WwqA$useVirtualizerState} from "@react-stately/virtualizer";
|
|
5
4
|
import {mergeProps as $9WwqA$mergeProps, useLayoutEffect as $9WwqA$useLayoutEffect} from "@react-aria/utils";
|
|
6
|
-
import $9WwqA$react, {createContext as $9WwqA$createContext, useRef as $9WwqA$useRef,
|
|
5
|
+
import $9WwqA$react, {createContext as $9WwqA$createContext, useRef as $9WwqA$useRef, useMemo as $9WwqA$useMemo, useCallback as $9WwqA$useCallback} from "react";
|
|
7
6
|
|
|
8
7
|
/*
|
|
9
8
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -20,20 +19,14 @@ import $9WwqA$react, {createContext as $9WwqA$createContext, useRef as $9WwqA$us
|
|
|
20
19
|
|
|
21
20
|
|
|
22
21
|
|
|
23
|
-
|
|
24
22
|
const $6d0a5c394373ae64$export$d288a7dd40372bc = /*#__PURE__*/ (0, $9WwqA$createContext)(null);
|
|
25
23
|
function $6d0a5c394373ae64$var$Virtualizer(props, ref) {
|
|
26
|
-
let { children: renderView, renderWrapper: renderWrapper, layout: layout, collection: collection, sizeToFit: sizeToFit, scrollDirection: scrollDirection,
|
|
24
|
+
let { children: renderView, renderWrapper: renderWrapper, layout: layout, collection: collection, sizeToFit: sizeToFit, scrollDirection: scrollDirection, isLoading: // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
27
25
|
isLoading, onLoadMore: // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
28
|
-
onLoadMore, focusedKey:
|
|
29
|
-
focusedKey, shouldUseVirtualFocus: // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
30
|
-
shouldUseVirtualFocus, scrollToItem: // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
31
|
-
scrollToItem, autoFocus: // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
32
|
-
autoFocus, ...otherProps } = props;
|
|
26
|
+
onLoadMore, focusedKey: focusedKey, layoutOptions: layoutOptions, ...otherProps } = props;
|
|
33
27
|
let fallbackRef = (0, $9WwqA$useRef)();
|
|
34
28
|
ref = ref || fallbackRef;
|
|
35
29
|
let state = (0, $9WwqA$useVirtualizerState)({
|
|
36
|
-
transitionDuration: transitionDuration,
|
|
37
30
|
layout: layout,
|
|
38
31
|
collection: collection,
|
|
39
32
|
renderView: renderView,
|
|
@@ -41,15 +34,18 @@ function $6d0a5c394373ae64$var$Virtualizer(props, ref) {
|
|
|
41
34
|
onVisibleRectChange (rect) {
|
|
42
35
|
ref.current.scrollLeft = rect.x;
|
|
43
36
|
ref.current.scrollTop = rect.y;
|
|
44
|
-
}
|
|
37
|
+
},
|
|
38
|
+
persistedKeys: (0, $9WwqA$useMemo)(()=>focusedKey ? new Set([
|
|
39
|
+
focusedKey
|
|
40
|
+
]) : new Set(), [
|
|
41
|
+
focusedKey
|
|
42
|
+
]),
|
|
43
|
+
layoutOptions: layoutOptions
|
|
45
44
|
});
|
|
46
45
|
let { virtualizerProps: virtualizerProps, scrollViewProps: scrollViewProps } = $6d0a5c394373ae64$export$dd6d526d88b5a137(props, state, ref);
|
|
47
46
|
return /*#__PURE__*/ (0, $9WwqA$react).createElement((0, $44a6ee657928b002$export$5665e3d6be6adea), {
|
|
48
47
|
...(0, $9WwqA$mergeProps)(otherProps, virtualizerProps, scrollViewProps),
|
|
49
48
|
ref: ref,
|
|
50
|
-
innerStyle: state.isAnimating ? {
|
|
51
|
-
transition: `none ${state.virtualizer.transitionDuration}ms`
|
|
52
|
-
} : undefined,
|
|
53
49
|
contentSize: state.contentSize,
|
|
54
50
|
onScrollStart: state.startScrolling,
|
|
55
51
|
onScrollEnd: state.endScrolling,
|
|
@@ -60,87 +56,15 @@ function $6d0a5c394373ae64$var$Virtualizer(props, ref) {
|
|
|
60
56
|
}, state.visibleViews));
|
|
61
57
|
}
|
|
62
58
|
function $6d0a5c394373ae64$export$dd6d526d88b5a137(props, state, ref) {
|
|
63
|
-
let {
|
|
64
|
-
let { virtualizer: virtualizer } = state;
|
|
65
|
-
// Scroll to the focusedKey when it changes. Actually focusing the focusedKey
|
|
66
|
-
// is up to the implementation using Virtualizer since we don't have refs
|
|
67
|
-
// to all of the item DOM nodes.
|
|
68
|
-
let lastFocusedKey = (0, $9WwqA$useRef)(null);
|
|
69
|
-
let isFocusWithin = (0, $9WwqA$useRef)(false);
|
|
70
|
-
let autoFocus = (0, $9WwqA$useRef)(props.autoFocus);
|
|
71
|
-
(0, $9WwqA$useEffect)(()=>{
|
|
72
|
-
if (virtualizer.visibleRect.height === 0) return;
|
|
73
|
-
// Only scroll the focusedKey into view if the modality is not pointer to avoid jumps in position when clicking/pressing tall items.
|
|
74
|
-
let modality = (0, $9WwqA$getInteractionModality)();
|
|
75
|
-
if (focusedKey !== lastFocusedKey.current && (modality !== 'pointer' || autoFocus.current)) {
|
|
76
|
-
autoFocus.current = false;
|
|
77
|
-
if (scrollToItem) // If user provides scrolltoitem, then it is their responsibility to call scrollIntoViewport if desired
|
|
78
|
-
// since we don't know if their scrollToItem may take some time to actually bring the active element into the virtualizer's visible rect.
|
|
79
|
-
scrollToItem(focusedKey);
|
|
80
|
-
else virtualizer.scrollToItem(focusedKey, {
|
|
81
|
-
duration: 0
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
lastFocusedKey.current = focusedKey;
|
|
85
|
-
}, [
|
|
86
|
-
focusedKey,
|
|
87
|
-
virtualizer.visibleRect.height,
|
|
88
|
-
virtualizer,
|
|
89
|
-
lastFocusedKey,
|
|
90
|
-
scrollToItem,
|
|
91
|
-
ref
|
|
92
|
-
]);
|
|
93
|
-
// Persist the focusedKey and prevent it from being removed from the DOM when scrolled out of view.
|
|
94
|
-
virtualizer.persistedKeys = (0, $9WwqA$useMemo)(()=>focusedKey ? new Set([
|
|
95
|
-
focusedKey
|
|
96
|
-
]) : new Set(), [
|
|
97
|
-
focusedKey
|
|
98
|
-
]);
|
|
99
|
-
let onFocus = (0, $9WwqA$useCallback)((e)=>{
|
|
100
|
-
// If the focused item is scrolled out of view and is not in the DOM, the collection
|
|
101
|
-
// will have tabIndex={0}. When tabbing in from outside, scroll the focused item into view.
|
|
102
|
-
// Ignore focus events that bubble through portals (e.g. focus that happens on a menu popover child of the virtualizer)
|
|
103
|
-
// Don't scroll focused key into view if modality is pointer to prevent sudden jump in position (e.g. CardView).
|
|
104
|
-
let modality = (0, $9WwqA$getInteractionModality)();
|
|
105
|
-
if (!isFocusWithin.current && ref.current.contains(e.target) && modality !== 'pointer') {
|
|
106
|
-
if (scrollToItem) scrollToItem(focusedKey);
|
|
107
|
-
else virtualizer.scrollToItem(focusedKey, {
|
|
108
|
-
duration: 0
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
isFocusWithin.current = e.target !== ref.current;
|
|
112
|
-
}, [
|
|
113
|
-
ref,
|
|
114
|
-
virtualizer,
|
|
115
|
-
focusedKey,
|
|
116
|
-
scrollToItem
|
|
117
|
-
]);
|
|
118
|
-
let onBlur = (0, $9WwqA$useCallback)((e)=>{
|
|
119
|
-
isFocusWithin.current = ref.current.contains(e.relatedTarget);
|
|
120
|
-
}, [
|
|
121
|
-
ref
|
|
122
|
-
]);
|
|
123
|
-
// Set tabIndex to -1 if there is a focused key, otherwise 0 so that the collection
|
|
124
|
-
// itself is tabbable. When the collection receives focus, we scroll the focused item back into
|
|
125
|
-
// view, which will allow it to be properly focused. If using virtual focus, don't set a
|
|
126
|
-
// tabIndex at all so that VoiceOver on iOS 14 doesn't try to move real DOM focus to the element anyway.
|
|
127
|
-
let tabIndex;
|
|
128
|
-
if (!shouldUseVirtualFocus) {
|
|
129
|
-
// When there is no focusedKey the default tabIndex is 0. We include logic for empty collections too.
|
|
130
|
-
// For collections that are empty, but have a link in the empty children we want to skip focusing this
|
|
131
|
-
// and let focus move to the link similar to link moving to children.
|
|
132
|
-
tabIndex = focusedKey != null ? -1 : 0;
|
|
133
|
-
// If the collection is empty, we want the tabIndex provided from props (if any)
|
|
134
|
-
// so that we handle when tabbable items are added to the empty state.
|
|
135
|
-
if (virtualizer.collection.size === 0 && props.tabIndex != null) tabIndex = props.tabIndex;
|
|
136
|
-
}
|
|
59
|
+
let { isLoading: isLoading, onLoadMore: onLoadMore } = props;
|
|
60
|
+
let { setVisibleRect: setVisibleRect, virtualizer: virtualizer } = state;
|
|
137
61
|
// Handle scrolling, and call onLoadMore when nearing the bottom.
|
|
138
62
|
let isLoadingRef = (0, $9WwqA$useRef)(isLoading);
|
|
139
63
|
let prevProps = (0, $9WwqA$useRef)(props);
|
|
140
64
|
let onVisibleRectChange = (0, $9WwqA$useCallback)((rect)=>{
|
|
141
|
-
|
|
65
|
+
setVisibleRect(rect);
|
|
142
66
|
if (!isLoadingRef.current && onLoadMore) {
|
|
143
|
-
let scrollOffset =
|
|
67
|
+
let scrollOffset = virtualizer.contentSize.height - rect.height * 2;
|
|
144
68
|
if (rect.y > scrollOffset) {
|
|
145
69
|
isLoadingRef.current = true;
|
|
146
70
|
onLoadMore();
|
|
@@ -148,12 +72,11 @@ function $6d0a5c394373ae64$export$dd6d526d88b5a137(props, state, ref) {
|
|
|
148
72
|
}
|
|
149
73
|
}, [
|
|
150
74
|
onLoadMore,
|
|
151
|
-
|
|
75
|
+
setVisibleRect,
|
|
76
|
+
virtualizer
|
|
152
77
|
]);
|
|
153
78
|
let lastContentSize = (0, $9WwqA$useRef)(0);
|
|
154
79
|
(0, $9WwqA$useLayoutEffect)(()=>{
|
|
155
|
-
// If animating, wait until we're done.
|
|
156
|
-
if (state.isAnimating) return;
|
|
157
80
|
// Only update isLoadingRef if props object actually changed,
|
|
158
81
|
// not if a local state change occurred.
|
|
159
82
|
let wasLoading = isLoadingRef.current;
|
|
@@ -169,18 +92,13 @@ function $6d0a5c394373ae64$export$dd6d526d88b5a137(props, state, ref) {
|
|
|
169
92
|
lastContentSize.current = state.contentSize.height;
|
|
170
93
|
}, [
|
|
171
94
|
state.contentSize,
|
|
172
|
-
state.isAnimating,
|
|
173
95
|
state.virtualizer,
|
|
174
96
|
isLoading,
|
|
175
97
|
onLoadMore,
|
|
176
98
|
props
|
|
177
99
|
]);
|
|
178
100
|
return {
|
|
179
|
-
virtualizerProps: {
|
|
180
|
-
tabIndex: tabIndex,
|
|
181
|
-
onFocus: onFocus,
|
|
182
|
-
onBlur: onBlur
|
|
183
|
-
},
|
|
101
|
+
virtualizerProps: {},
|
|
184
102
|
scrollViewProps: {
|
|
185
103
|
onVisibleRectChange: onVisibleRectChange
|
|
186
104
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;A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AAC,MAAM,GAAG,KAC3B,MAAM,WAAW,CAAC,MAAM,IAAI,MAAM,WAAW,CAAC,WAAW,CAAC,MAAM,IAG/D,CAAA,cAAc,MAAM,WAAW,CAAC,MAAM,KAAK,gBAAgB,OAAO,AAAD;QAEvE,IAAI,gBAAgB;YAClB,aAAa,OAAO,GAAG;YACvB;QACF;QACA,gBAAgB,OAAO,GAAG,MAAM,WAAW,CAAC,MAAM;IACpD,GAAG;QAAC,MAAM,WAAW;QAAE,MAAM,WAAW;QAAE,MAAM,WAAW;QAAE;QAAW;QAAY;KAAM;IAE1F,OAAO;QACL,kBAAkB;sBAChB;qBACA;oBACA;QACF;QACA,iBAAiB;iCACf;QACF;IACF;AACF;AAEA,wFAAwF;AACxF,2GAA2G;AAC3G,MAAM,0DAAe,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC;AAGtC,SAAS,2CACP,MAAiC,EACjC,YAAgC;IAEhC,qBACE,gCAAC,CAAA,GAAA,yCAAc;QACb,KAAK,aAAa,GAAG;QACrB,YAAY,aAAa,UAAU;QACnC,aAAa,aAAa,WAAW;QACrC,MAAM,EAAE,mBAAA,6BAAA,OAAQ,UAAU;OACzB,aAAa,QAAQ;AAG5B","sources":["packages/@react-aria/virtualizer/src/Virtualizer.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection, Key} from '@react-types/shared';\nimport {getInteractionModality} from '@react-aria/interactions';\nimport {Layout, Rect, ReusableView, useVirtualizerState, VirtualizerState} from '@react-stately/virtualizer';\nimport {mergeProps, useLayoutEffect} from '@react-aria/utils';\nimport React, {createContext, FocusEvent, HTMLAttributes, ReactElement, ReactNode, RefObject, useCallback, useEffect, useMemo, useRef} from 'react';\nimport {ScrollView} from './ScrollView';\nimport {VirtualizerItem} from './VirtualizerItem';\n\ninterface VirtualizerProps<T extends object, V> extends Omit<HTMLAttributes<HTMLElement>, 'children'> {\n children: (type: string, content: T) => V,\n renderWrapper?: (\n parent: ReusableView<T, V> | null,\n reusableView: ReusableView<T, V>,\n children: ReusableView<T, V>[],\n renderChildren: (views: ReusableView<T, V>[]) => ReactElement[]\n ) => ReactElement,\n layout: Layout<T>,\n collection: Collection<T>,\n focusedKey?: Key,\n sizeToFit?: 'width' | 'height',\n scrollDirection?: 'horizontal' | 'vertical' | 'both',\n transitionDuration?: number,\n isLoading?: boolean,\n onLoadMore?: () => void,\n shouldUseVirtualFocus?: boolean,\n scrollToItem?: (key: Key) => void,\n autoFocus?: boolean\n}\n\nexport const VirtualizerContext = createContext<VirtualizerState<any, any, any> | null>(null);\n\nfunction Virtualizer<T extends object, V extends ReactNode>(props: VirtualizerProps<T, V>, ref: RefObject<HTMLDivElement>) {\n let {\n children: renderView,\n renderWrapper,\n layout,\n collection,\n sizeToFit,\n scrollDirection,\n transitionDuration,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n isLoading,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n onLoadMore,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n focusedKey,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n shouldUseVirtualFocus,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n scrollToItem,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n autoFocus,\n ...otherProps\n } = props;\n\n let fallbackRef = useRef<HTMLDivElement>();\n ref = ref || fallbackRef;\n\n let state = useVirtualizerState({\n transitionDuration,\n layout,\n collection,\n renderView,\n renderWrapper: renderWrapper || defaultRenderWrapper,\n onVisibleRectChange(rect) {\n ref.current.scrollLeft = rect.x;\n ref.current.scrollTop = rect.y;\n }\n });\n\n let {virtualizerProps, scrollViewProps} = useVirtualizer(props, state, ref);\n\n return (\n <ScrollView\n {...mergeProps(otherProps, virtualizerProps, scrollViewProps)}\n ref={ref}\n innerStyle={state.isAnimating ? {transition: `none ${state.virtualizer.transitionDuration}ms`} : undefined}\n contentSize={state.contentSize}\n onScrollStart={state.startScrolling}\n onScrollEnd={state.endScrolling}\n sizeToFit={sizeToFit}\n scrollDirection={scrollDirection}>\n <VirtualizerContext.Provider value={state}>\n {state.visibleViews}\n </VirtualizerContext.Provider>\n </ScrollView>\n );\n}\n\ninterface VirtualizerOptions {\n tabIndex?: number,\n focusedKey?: Key,\n scrollToItem?: (key: Key) => void,\n shouldUseVirtualFocus?: boolean,\n autoFocus?: boolean,\n isLoading?: boolean,\n onLoadMore?: () => void\n}\n\nexport function useVirtualizer<T extends object, V extends ReactNode, W>(props: VirtualizerOptions, state: VirtualizerState<T, V, W>, ref: RefObject<HTMLElement>) {\n let {focusedKey, scrollToItem, shouldUseVirtualFocus, isLoading, onLoadMore} = props;\n let {virtualizer} = state;\n // Scroll to the focusedKey when it changes. Actually focusing the focusedKey\n // is up to the implementation using Virtualizer since we don't have refs\n // to all of the item DOM nodes.\n let lastFocusedKey = useRef(null);\n let isFocusWithin = useRef(false);\n let autoFocus = useRef(props.autoFocus);\n useEffect(() => {\n if (virtualizer.visibleRect.height === 0) {\n return;\n }\n\n // Only scroll the focusedKey into view if the modality is not pointer to avoid jumps in position when clicking/pressing tall items.\n let modality = getInteractionModality();\n if (focusedKey !== lastFocusedKey.current && (modality !== 'pointer' || autoFocus.current)) {\n autoFocus.current = false;\n if (scrollToItem) {\n // If user provides scrolltoitem, then it is their responsibility to call scrollIntoViewport if desired\n // since we don't know if their scrollToItem may take some time to actually bring the active element into the virtualizer's visible rect.\n scrollToItem(focusedKey);\n } else {\n virtualizer.scrollToItem(focusedKey, {duration: 0});\n\n }\n }\n\n lastFocusedKey.current = focusedKey;\n }, [focusedKey, virtualizer.visibleRect.height, virtualizer, lastFocusedKey, scrollToItem, ref]);\n\n // Persist the focusedKey and prevent it from being removed from the DOM when scrolled out of view.\n virtualizer.persistedKeys = useMemo(() => focusedKey ? new Set([focusedKey]) : new Set(), [focusedKey]);\n\n let onFocus = useCallback((e: FocusEvent) => {\n // If the focused item is scrolled out of view and is not in the DOM, the collection\n // will have tabIndex={0}. When tabbing in from outside, scroll the focused item into view.\n // Ignore focus events that bubble through portals (e.g. focus that happens on a menu popover child of the virtualizer)\n // Don't scroll focused key into view if modality is pointer to prevent sudden jump in position (e.g. CardView).\n let modality = getInteractionModality();\n if (!isFocusWithin.current && ref.current.contains(e.target) && modality !== 'pointer') {\n if (scrollToItem) {\n scrollToItem(focusedKey);\n } else {\n virtualizer.scrollToItem(focusedKey, {duration: 0});\n }\n }\n\n isFocusWithin.current = e.target !== ref.current;\n }, [ref, virtualizer, focusedKey, scrollToItem]);\n\n let onBlur = useCallback((e: FocusEvent) => {\n isFocusWithin.current = ref.current.contains(e.relatedTarget as Element);\n }, [ref]);\n\n // Set tabIndex to -1 if there is a focused key, otherwise 0 so that the collection\n // itself is tabbable. When the collection receives focus, we scroll the focused item back into\n // view, which will allow it to be properly focused. If using virtual focus, don't set a\n // tabIndex at all so that VoiceOver on iOS 14 doesn't try to move real DOM focus to the element anyway.\n let tabIndex: number;\n if (!shouldUseVirtualFocus) {\n // When there is no focusedKey the default tabIndex is 0. We include logic for empty collections too.\n // For collections that are empty, but have a link in the empty children we want to skip focusing this\n // and let focus move to the link similar to link moving to children.\n tabIndex = focusedKey != null ? -1 : 0;\n\n // If the collection is empty, we want the tabIndex provided from props (if any)\n // so that we handle when tabbable items are added to the empty state.\n if (virtualizer.collection.size === 0 && props.tabIndex != null) {\n tabIndex = props.tabIndex;\n }\n }\n\n // Handle scrolling, and call onLoadMore when nearing the bottom.\n let isLoadingRef = useRef(isLoading);\n let prevProps = useRef(props);\n let onVisibleRectChange = useCallback((rect: Rect) => {\n state.setVisibleRect(rect);\n\n if (!isLoadingRef.current && onLoadMore) {\n let scrollOffset = state.virtualizer.contentSize.height - rect.height * 2;\n if (rect.y > scrollOffset) {\n isLoadingRef.current = true;\n onLoadMore();\n }\n }\n }, [onLoadMore, state]);\n\n let lastContentSize = useRef(0);\n useLayoutEffect(() => {\n // If animating, wait until we're done.\n if (state.isAnimating) {\n return;\n }\n\n // Only update isLoadingRef if props object actually changed,\n // not if a local state change occurred.\n let wasLoading = isLoadingRef.current;\n if (props !== prevProps.current) {\n isLoadingRef.current = isLoading;\n prevProps.current = props;\n }\n\n let shouldLoadMore = !isLoadingRef.current\n && onLoadMore\n && state.contentSize.height > 0\n && state.contentSize.height <= state.virtualizer.visibleRect.height\n // Only try loading more if the content size changed, or if we just finished\n // loading and still have room for more items.\n && (wasLoading || state.contentSize.height !== lastContentSize.current);\n\n if (shouldLoadMore) {\n isLoadingRef.current = true;\n onLoadMore();\n }\n lastContentSize.current = state.contentSize.height;\n }, [state.contentSize, state.isAnimating, state.virtualizer, isLoading, onLoadMore, props]);\n\n return {\n virtualizerProps: {\n tabIndex,\n onFocus,\n onBlur\n },\n scrollViewProps: {\n onVisibleRectChange\n }\n };\n}\n\n// forwardRef doesn't support generic parameters, so cast the result to the correct type\n// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref\nconst _Virtualizer = React.forwardRef(Virtualizer) as <T extends object, V>(props: VirtualizerProps<T, V> & {ref?: RefObject<HTMLDivElement>}) => ReactElement;\nexport {_Virtualizer as Virtualizer};\n\nfunction defaultRenderWrapper<T extends object, V extends ReactNode>(\n parent: ReusableView<T, V> | null,\n reusableView: ReusableView<T, V>\n) {\n return (\n <VirtualizerItem\n key={reusableView.key}\n layoutInfo={reusableView.layoutInfo}\n virtualizer={reusableView.virtualizer}\n parent={parent?.layoutInfo}>\n {reusableView.rendered}\n </VirtualizerItem>\n );\n}\n"],"names":[],"version":3,"file":"Virtualizer.module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;AAAA;;;;;;;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AAU;QACnC,aAAa,aAAa,WAAW;QACrC,MAAM,EAAE,mBAAA,6BAAA,OAAQ,UAAU;OACzB,aAAa,QAAQ;AAG5B","sources":["packages/@react-aria/virtualizer/src/Virtualizer.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection, Key} from '@react-types/shared';\nimport {Layout, Rect, ReusableView, useVirtualizerState, VirtualizerState} from '@react-stately/virtualizer';\nimport {mergeProps, useLayoutEffect} from '@react-aria/utils';\nimport React, {createContext, HTMLAttributes, ReactElement, ReactNode, RefObject, useCallback, useMemo, useRef} from 'react';\nimport {ScrollView} from './ScrollView';\nimport {VirtualizerItem} from './VirtualizerItem';\n\ninterface VirtualizerProps<T extends object, V, O> extends Omit<HTMLAttributes<HTMLElement>, 'children'> {\n children: (type: string, content: T) => V,\n renderWrapper?: (\n parent: ReusableView<T, V> | null,\n reusableView: ReusableView<T, V>,\n children: ReusableView<T, V>[],\n renderChildren: (views: ReusableView<T, V>[]) => ReactElement[]\n ) => ReactElement,\n layout: Layout<T, O>,\n collection: Collection<T>,\n focusedKey?: Key,\n sizeToFit?: 'width' | 'height',\n scrollDirection?: 'horizontal' | 'vertical' | 'both',\n isLoading?: boolean,\n onLoadMore?: () => void,\n layoutOptions?: O\n}\n\nexport const VirtualizerContext = createContext<VirtualizerState<any, any, any> | null>(null);\n\nfunction Virtualizer<T extends object, V extends ReactNode, O>(props: VirtualizerProps<T, V, O>, ref: RefObject<HTMLDivElement>) {\n let {\n children: renderView,\n renderWrapper,\n layout,\n collection,\n sizeToFit,\n scrollDirection,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n isLoading,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n onLoadMore,\n focusedKey,\n layoutOptions,\n ...otherProps\n } = props;\n\n let fallbackRef = useRef<HTMLDivElement>();\n ref = ref || fallbackRef;\n\n let state = useVirtualizerState({\n layout,\n collection,\n renderView,\n renderWrapper: renderWrapper || defaultRenderWrapper,\n onVisibleRectChange(rect) {\n ref.current.scrollLeft = rect.x;\n ref.current.scrollTop = rect.y;\n },\n persistedKeys: useMemo(() => focusedKey ? new Set([focusedKey]) : new Set(), [focusedKey]),\n layoutOptions\n });\n\n let {virtualizerProps, scrollViewProps} = useVirtualizer(props, state, ref);\n\n return (\n <ScrollView\n {...mergeProps(otherProps, virtualizerProps, scrollViewProps)}\n ref={ref}\n contentSize={state.contentSize}\n onScrollStart={state.startScrolling}\n onScrollEnd={state.endScrolling}\n sizeToFit={sizeToFit}\n scrollDirection={scrollDirection}>\n <VirtualizerContext.Provider value={state}>\n {state.visibleViews}\n </VirtualizerContext.Provider>\n </ScrollView>\n );\n}\n\ninterface VirtualizerOptions {\n tabIndex?: number,\n focusedKey?: Key,\n isLoading?: boolean,\n onLoadMore?: () => void\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function useVirtualizer<T extends object, V extends ReactNode, W>(props: VirtualizerOptions, state: VirtualizerState<T, V, W>, ref: RefObject<HTMLElement>) {\n let {isLoading, onLoadMore} = props;\n let {setVisibleRect, virtualizer} = state;\n\n // Handle scrolling, and call onLoadMore when nearing the bottom.\n let isLoadingRef = useRef(isLoading);\n let prevProps = useRef(props);\n let onVisibleRectChange = useCallback((rect: Rect) => {\n setVisibleRect(rect);\n\n if (!isLoadingRef.current && onLoadMore) {\n let scrollOffset = virtualizer.contentSize.height - rect.height * 2;\n if (rect.y > scrollOffset) {\n isLoadingRef.current = true;\n onLoadMore();\n }\n }\n }, [onLoadMore, setVisibleRect, virtualizer]);\n\n let lastContentSize = useRef(0);\n useLayoutEffect(() => {\n // Only update isLoadingRef if props object actually changed,\n // not if a local state change occurred.\n let wasLoading = isLoadingRef.current;\n if (props !== prevProps.current) {\n isLoadingRef.current = isLoading;\n prevProps.current = props;\n }\n\n let shouldLoadMore = !isLoadingRef.current\n && onLoadMore\n && state.contentSize.height > 0\n && state.contentSize.height <= state.virtualizer.visibleRect.height\n // Only try loading more if the content size changed, or if we just finished\n // loading and still have room for more items.\n && (wasLoading || state.contentSize.height !== lastContentSize.current);\n\n if (shouldLoadMore) {\n isLoadingRef.current = true;\n onLoadMore();\n }\n lastContentSize.current = state.contentSize.height;\n }, [state.contentSize, state.virtualizer, isLoading, onLoadMore, props]);\n\n return {\n virtualizerProps: {},\n scrollViewProps: {\n onVisibleRectChange\n }\n };\n}\n\n// forwardRef doesn't support generic parameters, so cast the result to the correct type\n// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref\nconst _Virtualizer = React.forwardRef(Virtualizer) as <T extends object, V, O>(props: VirtualizerProps<T, V, O> & {ref?: RefObject<HTMLDivElement>}) => ReactElement;\nexport {_Virtualizer as Virtualizer};\n\nfunction defaultRenderWrapper<T extends object, V extends ReactNode>(\n parent: ReusableView<T, V> | null,\n reusableView: ReusableView<T, V>\n) {\n return (\n <VirtualizerItem\n key={reusableView.key}\n layoutInfo={reusableView.layoutInfo}\n virtualizer={reusableView.virtualizer}\n parent={parent?.layoutInfo}>\n {reusableView.rendered}\n </VirtualizerItem>\n );\n}\n"],"names":[],"version":3,"file":"Virtualizer.module.js.map"}
|
|
@@ -68,10 +68,6 @@ function $d6a26279cc31826b$export$1481e64fbe01b8b3(layoutInfo, dir, parent) {
|
|
|
68
68
|
// Sticky elements are positioned in normal document flow. Display inline-block so that they don't push other sticky columns onto the following rows.
|
|
69
69
|
display: layoutInfo.isSticky ? 'inline-block' : undefined,
|
|
70
70
|
overflow: layoutInfo.allowOverflow ? 'visible' : 'hidden',
|
|
71
|
-
transition: 'all',
|
|
72
|
-
WebkitTransition: 'all',
|
|
73
|
-
WebkitTransitionDuration: 'inherit',
|
|
74
|
-
transitionDuration: 'inherit',
|
|
75
71
|
opacity: layoutInfo.opacity,
|
|
76
72
|
zIndex: layoutInfo.zIndex,
|
|
77
73
|
transform: layoutInfo.transform,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAcM,SAAS,0CAAgB,KAA2B;IACzD,IAAI,aAAC,SAAS,cAAE,UAAU,eAAE,WAAW,UAAE,MAAM,YAAE,QAAQ,EAAC,GAAG;IAC7D,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,8BAAQ;IAC1B,IAAI,MAAM,CAAA,GAAA,mBAAK;IACf,CAAA,GAAA,4CAAiB,EAAE;oBACjB;qBACA;aACA;IACF;IAEA,qBACE,0DAAC;QAAI,MAAK;QAAe,KAAK;QAAK,WAAW;QAAW,OAAO,0CAAkB,YAAY,WAAW;OACtG;AAGP;AAEA,IAAI,8BAAQ,IAAI;AACT,SAAS,0CAAkB,UAAsB,EAAE,GAAc,EAAE,MAA0B;IAClG,IAAI,YAAY,QAAQ,QAAQ,UAAU;IAC1C,IAAI,SAAS,4BAAM,GAAG,CAAC;IACvB,IAAI,UAAU,MAAM,CAAC,UAAU,IAAI,MAAM;QACvC,IAAI,CAAC,QACH,OAAO;QAGT,6CAA6C;QAC7C,IAAI,MAAM,WAAW,IAAI,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;QAC3C,IAAI,IAAI,WAAW,IAAI,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;QACzC,IAAI,OAAO,GAAG,KAAK,OAAO,MAAM,CAAC,UAAU,KAAK,GAC9C,OAAO;IAEX;IAEA,IAAI,aAAa;QACf,KAAK,WAAW,IAAI,CAAC,CAAC,GAAI,CAAA,SAAS,OAAO,IAAI,CAAC,CAAC,GAAG,CAAA;QACnD,CAAC,UAAU,EAAE,WAAW,IAAI,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,IAAI,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;QACzC,IAAI,OAAO,GAAG,KAAK,OAAO,MAAM,CAAC,UAAU,KAAK,GAC9C,OAAO;IAEX;IAEA,IAAI,aAAa;QACf,KAAK,WAAW,IAAI,CAAC,CAAC,GAAI,CAAA,SAAS,OAAO,IAAI,CAAC,CAAC,GAAG,CAAA;QACnD,CAAC,UAAU,EAAE,WAAW,IAAI,CAAC,CAAC,GAAI,CAAA,SAAS,OAAO,IAAI,CAAC,CAAC,GAAG,CAAA;QAC3D,OAAO,WAAW,IAAI,CAAC,KAAK;QAC5B,QAAQ,WAAW,IAAI,CAAC,MAAM;IAChC;IAEA,sEAAsE;IACtE,OAAO,OAAO,CAAC,YAAY,OAAO,CAAC,CAAC,CAAC,KAAK,MAAM;QAC9C,IAAI,CAAC,OAAO,QAAQ,CAAC,QACnB,UAAU,CAAC,IAAI,GAAG;IAEtB;IAEA,IAAI,QAAuB;QACzB,UAAU,WAAW,QAAQ,GAAG,WAAW;QAC3C,qJAAqJ;QACrJ,SAAS,WAAW,QAAQ,GAAG,iBAAiB;QAChD,UAAU,WAAW,aAAa,GAAG,YAAY;QACjD,SAAS,WAAW,OAAO;QAC3B,QAAQ,WAAW,MAAM;QACzB,WAAW,WAAW,SAAS;QAC/B,SAAS;QACT,GAAG,UAAU;IACf;IAEA,4BAAM,GAAG,CAAC,YAAY;IACtB,OAAO;AACT","sources":["packages/@react-aria/virtualizer/src/VirtualizerItem.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Direction} from '@react-types/shared';\nimport {LayoutInfo} from '@react-stately/virtualizer';\nimport React, {CSSProperties, ReactNode, useRef} from 'react';\nimport {useLocale} from '@react-aria/i18n';\nimport {useVirtualizerItem, VirtualizerItemOptions} from './useVirtualizerItem';\n\ninterface VirtualizerItemProps extends Omit<VirtualizerItemOptions, 'ref'> {\n parent?: LayoutInfo,\n className?: string,\n children: ReactNode\n}\n\nexport function VirtualizerItem(props: VirtualizerItemProps) {\n let {className, layoutInfo, virtualizer, parent, children} = props;\n let {direction} = useLocale();\n let ref = useRef();\n useVirtualizerItem({\n layoutInfo,\n virtualizer,\n ref\n });\n\n return (\n <div role=\"presentation\" ref={ref} className={className} style={layoutInfoToStyle(layoutInfo, direction, parent)}>\n {children}\n </div>\n );\n}\n\nlet cache = new WeakMap();\nexport function layoutInfoToStyle(layoutInfo: LayoutInfo, dir: Direction, parent?: LayoutInfo | null): CSSProperties {\n let xProperty = dir === 'rtl' ? 'right' : 'left';\n let cached = cache.get(layoutInfo);\n if (cached && cached[xProperty] != null) {\n if (!parent) {\n return cached;\n }\n\n // Invalidate if the parent position changed.\n let top = layoutInfo.rect.y - parent.rect.y;\n let x = layoutInfo.rect.x - parent.rect.x;\n if (cached.top === top && cached[xProperty] === x) {\n return cached;\n }\n }\n\n let rectStyles = {\n top: layoutInfo.rect.y - (parent ? parent.rect.y : 0),\n [xProperty]: layoutInfo.rect.x - (parent ? parent.rect.x : 0),\n width: layoutInfo.rect.width,\n height: layoutInfo.rect.height\n };\n\n // Get rid of any non finite values since they aren't valid css values\n Object.entries(rectStyles).forEach(([key, value]) => {\n if (!Number.isFinite(value)) {\n rectStyles[key] = undefined;\n }\n });\n\n let style: CSSProperties = {\n position: layoutInfo.isSticky ? 'sticky' : 'absolute',\n // Sticky elements are positioned in normal document flow. Display inline-block so that they don't push other sticky columns onto the following rows.\n display: layoutInfo.isSticky ? 'inline-block' : undefined,\n overflow: layoutInfo.allowOverflow ? 'visible' : 'hidden',\n opacity: layoutInfo.opacity,\n zIndex: layoutInfo.zIndex,\n transform: layoutInfo.transform,\n contain: 'size layout style',\n ...rectStyles\n };\n\n cache.set(layoutInfo, style);\n return style;\n}\n"],"names":[],"version":3,"file":"VirtualizerItem.main.js.map"}
|
package/dist/VirtualizerItem.mjs
CHANGED
|
@@ -57,10 +57,6 @@ function $ccf8a0a04e4175ae$export$1481e64fbe01b8b3(layoutInfo, dir, parent) {
|
|
|
57
57
|
// Sticky elements are positioned in normal document flow. Display inline-block so that they don't push other sticky columns onto the following rows.
|
|
58
58
|
display: layoutInfo.isSticky ? 'inline-block' : undefined,
|
|
59
59
|
overflow: layoutInfo.allowOverflow ? 'visible' : 'hidden',
|
|
60
|
-
transition: 'all',
|
|
61
|
-
WebkitTransition: 'all',
|
|
62
|
-
WebkitTransitionDuration: 'inherit',
|
|
63
|
-
transitionDuration: 'inherit',
|
|
64
60
|
opacity: layoutInfo.opacity,
|
|
65
61
|
zIndex: layoutInfo.zIndex,
|
|
66
62
|
transform: layoutInfo.transform,
|
|
@@ -57,10 +57,6 @@ function $ccf8a0a04e4175ae$export$1481e64fbe01b8b3(layoutInfo, dir, parent) {
|
|
|
57
57
|
// Sticky elements are positioned in normal document flow. Display inline-block so that they don't push other sticky columns onto the following rows.
|
|
58
58
|
display: layoutInfo.isSticky ? 'inline-block' : undefined,
|
|
59
59
|
overflow: layoutInfo.allowOverflow ? 'visible' : 'hidden',
|
|
60
|
-
transition: 'all',
|
|
61
|
-
WebkitTransition: 'all',
|
|
62
|
-
WebkitTransitionDuration: 'inherit',
|
|
63
|
-
transitionDuration: 'inherit',
|
|
64
60
|
opacity: layoutInfo.opacity,
|
|
65
61
|
zIndex: layoutInfo.zIndex,
|
|
66
62
|
transform: layoutInfo.transform,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAcM,SAAS,0CAAgB,KAA2B;IACzD,IAAI,aAAC,SAAS,cAAE,UAAU,eAAE,WAAW,UAAE,MAAM,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,IAAI,CAAC,KAAK;QAC5B,QAAQ,WAAW,IAAI,CAAC,MAAM;IAChC;IAEA,sEAAsE;IACtE,OAAO,OAAO,CAAC,YAAY,OAAO,CAAC,CAAC,CAAC,KAAK,MAAM;QAC9C,IAAI,CAAC,OAAO,QAAQ,CAAC,QACnB,UAAU,CAAC,IAAI,GAAG;IAEtB;IAEA,IAAI,QAAuB;QACzB,UAAU,WAAW,QAAQ,GAAG,WAAW;QAC3C,qJAAqJ;QACrJ,SAAS,WAAW,QAAQ,GAAG,iBAAiB;QAChD,UAAU,WAAW,aAAa,GAAG,YAAY;QACjD,SAAS,WAAW,OAAO;QAC3B,QAAQ,WAAW,MAAM;QACzB,WAAW,WAAW,SAAS;QAC/B,SAAS;QACT,GAAG,UAAU;IACf;IAEA,4BAAM,GAAG,CAAC,YAAY;IACtB,OAAO;AACT","sources":["packages/@react-aria/virtualizer/src/VirtualizerItem.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Direction} from '@react-types/shared';\nimport {LayoutInfo} from '@react-stately/virtualizer';\nimport React, {CSSProperties, ReactNode, useRef} from 'react';\nimport {useLocale} from '@react-aria/i18n';\nimport {useVirtualizerItem, VirtualizerItemOptions} from './useVirtualizerItem';\n\ninterface VirtualizerItemProps extends Omit<VirtualizerItemOptions, 'ref'> {\n parent?: LayoutInfo,\n className?: string,\n children: ReactNode\n}\n\nexport function VirtualizerItem(props: VirtualizerItemProps) {\n let {className, layoutInfo, virtualizer, parent, children} = props;\n let {direction} = useLocale();\n let ref = useRef();\n useVirtualizerItem({\n layoutInfo,\n virtualizer,\n ref\n });\n\n return (\n <div role=\"presentation\" ref={ref} className={className} style={layoutInfoToStyle(layoutInfo, direction, parent)}>\n {children}\n </div>\n );\n}\n\nlet cache = new WeakMap();\nexport function layoutInfoToStyle(layoutInfo: LayoutInfo, dir: Direction, parent?: LayoutInfo | null): CSSProperties {\n let xProperty = dir === 'rtl' ? 'right' : 'left';\n let cached = cache.get(layoutInfo);\n if (cached && cached[xProperty] != null) {\n if (!parent) {\n return cached;\n }\n\n // Invalidate if the parent position changed.\n let top = layoutInfo.rect.y - parent.rect.y;\n let x = layoutInfo.rect.x - parent.rect.x;\n if (cached.top === top && cached[xProperty] === x) {\n return cached;\n }\n }\n\n let rectStyles = {\n top: layoutInfo.rect.y - (parent ? parent.rect.y : 0),\n [xProperty]: layoutInfo.rect.x - (parent ? parent.rect.x : 0),\n width: layoutInfo.rect.width,\n height: layoutInfo.rect.height\n };\n\n // Get rid of any non finite values since they aren't valid css values\n Object.entries(rectStyles).forEach(([key, value]) => {\n if (!Number.isFinite(value)) {\n rectStyles[key] = undefined;\n }\n });\n\n let style: CSSProperties = {\n position: layoutInfo.isSticky ? 'sticky' : 'absolute',\n // Sticky elements are positioned in normal document flow. Display inline-block so that they don't push other sticky columns onto the following rows.\n display: layoutInfo.isSticky ? 'inline-block' : undefined,\n overflow: layoutInfo.allowOverflow ? 'visible' : 'hidden',\n opacity: layoutInfo.opacity,\n zIndex: layoutInfo.zIndex,\n transform: layoutInfo.transform,\n contain: 'size layout style',\n ...rectStyles\n };\n\n cache.set(layoutInfo, style);\n return style;\n}\n"],"names":[],"version":3,"file":"VirtualizerItem.module.js.map"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Direction, Key, Collection } from "@react-types/shared";
|
|
2
2
|
import { LayoutInfo, Size, Rect, Layout, ReusableView, VirtualizerState } from "@react-stately/virtualizer";
|
|
3
|
-
import React, { RefObject, CSSProperties, HTMLAttributes, ReactNode,
|
|
3
|
+
import React, { RefObject, CSSProperties, HTMLAttributes, ReactNode, ReactElement } from "react";
|
|
4
4
|
export type RTLOffsetType = 'negative' | 'positive-descending' | 'positive-ascending';
|
|
5
5
|
export function getRTLOffsetType(recalculate?: boolean): RTLOffsetType;
|
|
6
6
|
export function getScrollLeft(node: Element, direction: Direction): number;
|
|
@@ -34,42 +34,32 @@ interface VirtualizerItemProps extends Omit<VirtualizerItemOptions, 'ref'> {
|
|
|
34
34
|
}
|
|
35
35
|
export function VirtualizerItem(props: VirtualizerItemProps): React.JSX.Element;
|
|
36
36
|
export function layoutInfoToStyle(layoutInfo: LayoutInfo, dir: Direction, parent?: LayoutInfo | null): CSSProperties;
|
|
37
|
-
interface VirtualizerProps<T extends object, V> extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
|
|
37
|
+
interface VirtualizerProps<T extends object, V, O> extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
|
|
38
38
|
children: (type: string, content: T) => V;
|
|
39
39
|
renderWrapper?: (parent: ReusableView<T, V> | null, reusableView: ReusableView<T, V>, children: ReusableView<T, V>[], renderChildren: (views: ReusableView<T, V>[]) => ReactElement[]) => ReactElement;
|
|
40
|
-
layout: Layout<T>;
|
|
40
|
+
layout: Layout<T, O>;
|
|
41
41
|
collection: Collection<T>;
|
|
42
42
|
focusedKey?: Key;
|
|
43
43
|
sizeToFit?: 'width' | 'height';
|
|
44
44
|
scrollDirection?: 'horizontal' | 'vertical' | 'both';
|
|
45
|
-
transitionDuration?: number;
|
|
46
45
|
isLoading?: boolean;
|
|
47
46
|
onLoadMore?: () => void;
|
|
48
|
-
|
|
49
|
-
scrollToItem?: (key: Key) => void;
|
|
50
|
-
autoFocus?: boolean;
|
|
47
|
+
layoutOptions?: O;
|
|
51
48
|
}
|
|
52
49
|
export const VirtualizerContext: React.Context<VirtualizerState<any, any, any>>;
|
|
53
50
|
interface VirtualizerOptions {
|
|
54
51
|
tabIndex?: number;
|
|
55
52
|
focusedKey?: Key;
|
|
56
|
-
scrollToItem?: (key: Key) => void;
|
|
57
|
-
shouldUseVirtualFocus?: boolean;
|
|
58
|
-
autoFocus?: boolean;
|
|
59
53
|
isLoading?: boolean;
|
|
60
54
|
onLoadMore?: () => void;
|
|
61
55
|
}
|
|
62
56
|
export function useVirtualizer<T extends object, V extends ReactNode, W>(props: VirtualizerOptions, state: VirtualizerState<T, V, W>, ref: RefObject<HTMLElement>): {
|
|
63
|
-
virtualizerProps: {
|
|
64
|
-
tabIndex: number;
|
|
65
|
-
onFocus: (e: FocusEvent) => void;
|
|
66
|
-
onBlur: (e: FocusEvent) => void;
|
|
67
|
-
};
|
|
57
|
+
virtualizerProps: {};
|
|
68
58
|
scrollViewProps: {
|
|
69
59
|
onVisibleRectChange: (rect: Rect) => void;
|
|
70
60
|
};
|
|
71
61
|
};
|
|
72
|
-
export const Virtualizer: <T extends object, V>(props: VirtualizerProps<T, V> & {
|
|
62
|
+
export const Virtualizer: <T extends object, V, O>(props: VirtualizerProps<T, V, O> & {
|
|
73
63
|
ref?: RefObject<HTMLDivElement>;
|
|
74
64
|
}) => ReactElement;
|
|
75
65
|
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;AAcA,4BACI,UAAU,GACV,qBAAqB,GACrB,oBAAoB,CAAC;AAezB,iCAAiC,WAAW,GAAE,OAAe,GAAG,aAAa,CAmC5E;AAED,8BAA8B,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,GAAG,MAAM,CAkBzE;AAED,8BAA8B,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,QAiBpF;ACzFD;IACE,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAAA;CAC3C;AAED;IACE,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,EAAE,YAAY,CAAC;IAC1B,GAAG,EAAE,UAAU,WAAW,CAAC,CAAA;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ChC,QAAQ,EAAE,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,EAC9B,cAAc,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,YAAY,EAAE,KAC5D,YAAY,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;IACrB,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;IAC1B,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC/B,eAAe,CAAC,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,CAAC;IACrD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,aAAa,CAAC,EAAE,CAAC,CAAA;CAClB;AAED,OAAO,MAAM,kEAAgF,CAAC;AAqD9F;IACE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;CACxB;AAGD,+BAA+B,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,iBAAiB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,WAAW,CAAC;;;oCAOlH,IAAI;;EA2ClD;AAID,OAAA,MAAM;UAAmH,UAAU,cAAc,CAAC;MAAM,YAAY,CAAC","sources":["packages/@react-aria/virtualizer/src/packages/@react-aria/virtualizer/src/utils.ts","packages/@react-aria/virtualizer/src/packages/@react-aria/virtualizer/src/useVirtualizerItem.ts","packages/@react-aria/virtualizer/src/packages/@react-aria/virtualizer/src/ScrollView.tsx","packages/@react-aria/virtualizer/src/packages/@react-aria/virtualizer/src/VirtualizerItem.tsx","packages/@react-aria/virtualizer/src/packages/@react-aria/virtualizer/src/Virtualizer.tsx","packages/@react-aria/virtualizer/src/packages/@react-aria/virtualizer/src/index.ts","packages/@react-aria/virtualizer/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport type {RTLOffsetType} from './utils';\nexport type {VirtualizerItemOptions} from './useVirtualizerItem';\nexport {useVirtualizer, Virtualizer, VirtualizerContext} from './Virtualizer';\nexport {useVirtualizerItem} from './useVirtualizerItem';\nexport {VirtualizerItem, layoutInfoToStyle} from './VirtualizerItem';\nexport {ScrollView} from './ScrollView';\nexport {getRTLOffsetType, getScrollLeft, setScrollLeft} from './utils';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/virtualizer",
|
|
3
|
-
"version": "3.10.2-nightly.
|
|
3
|
+
"version": "3.10.2-nightly.4656+0c17289de",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@react-aria/i18n": "3.0.0-nightly.
|
|
26
|
-
"@react-aria/interactions": "3.0.0-nightly.
|
|
27
|
-
"@react-aria/utils": "3.0.0-nightly.
|
|
28
|
-
"@react-stately/virtualizer": "3.7.2-nightly.
|
|
29
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
25
|
+
"@react-aria/i18n": "3.0.0-nightly.2944+0c17289de",
|
|
26
|
+
"@react-aria/interactions": "3.0.0-nightly.2944+0c17289de",
|
|
27
|
+
"@react-aria/utils": "3.0.0-nightly.2944+0c17289de",
|
|
28
|
+
"@react-stately/virtualizer": "3.7.2-nightly.4656+0c17289de",
|
|
29
|
+
"@react-types/shared": "3.0.0-nightly.2944+0c17289de",
|
|
30
30
|
"@swc/helpers": "^0.5.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "0c17289de18041e6f8b99df26a5a3ca922cc5145"
|
|
40
40
|
}
|
package/src/ScrollView.tsx
CHANGED
|
@@ -155,7 +155,7 @@ function ScrollView(props: ScrollViewProps, ref: RefObject<HTMLDivElement>) {
|
|
|
155
155
|
updateSize();
|
|
156
156
|
}, [updateSize]);
|
|
157
157
|
let raf = useRef<ReturnType<typeof requestAnimationFrame> | null>();
|
|
158
|
-
let onResize = () => {
|
|
158
|
+
let onResize = useCallback(() => {
|
|
159
159
|
if (isOldReact) {
|
|
160
160
|
raf.current ??= requestAnimationFrame(() => {
|
|
161
161
|
updateSize();
|
|
@@ -164,7 +164,7 @@ function ScrollView(props: ScrollViewProps, ref: RefObject<HTMLDivElement>) {
|
|
|
164
164
|
} else {
|
|
165
165
|
updateSize();
|
|
166
166
|
}
|
|
167
|
-
};
|
|
167
|
+
}, [updateSize]);
|
|
168
168
|
useResizeObserver({ref, onResize});
|
|
169
169
|
useEffect(() => {
|
|
170
170
|
return () => {
|