@shopify/flash-list 2.0.0-rc.2 → 2.0.0-rc.4
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/FlashListProps.d.ts +10 -2
- package/dist/FlashListProps.d.ts.map +1 -1
- package/dist/FlashListProps.js.map +1 -1
- package/dist/__tests__/RenderStackManager.test.js +1 -2
- package/dist/__tests__/RenderStackManager.test.js.map +1 -1
- package/dist/recyclerview/RecyclerView.d.ts.map +1 -1
- package/dist/recyclerview/RecyclerView.js +11 -3
- package/dist/recyclerview/RecyclerView.js.map +1 -1
- package/dist/recyclerview/RecyclerViewManager.d.ts +1 -0
- package/dist/recyclerview/RecyclerViewManager.d.ts.map +1 -1
- package/dist/recyclerview/RecyclerViewManager.js +5 -0
- package/dist/recyclerview/RecyclerViewManager.js.map +1 -1
- package/dist/recyclerview/RenderStackManager.d.ts +1 -0
- package/dist/recyclerview/RenderStackManager.d.ts.map +1 -1
- package/dist/recyclerview/RenderStackManager.js +26 -7
- package/dist/recyclerview/RenderStackManager.js.map +1 -1
- package/dist/recyclerview/helpers/RenderTimeTracker.d.ts +1 -0
- package/dist/recyclerview/helpers/RenderTimeTracker.d.ts.map +1 -1
- package/dist/recyclerview/helpers/RenderTimeTracker.js +3 -0
- package/dist/recyclerview/helpers/RenderTimeTracker.js.map +1 -1
- package/dist/recyclerview/hooks/useLayoutState.d.ts +3 -1
- package/dist/recyclerview/hooks/useLayoutState.d.ts.map +1 -1
- package/dist/recyclerview/hooks/useLayoutState.js +5 -3
- package/dist/recyclerview/hooks/useLayoutState.js.map +1 -1
- package/dist/recyclerview/hooks/useRecyclerViewController.d.ts +2 -1
- package/dist/recyclerview/hooks/useRecyclerViewController.d.ts.map +1 -1
- package/dist/recyclerview/hooks/useRecyclerViewController.js +237 -190
- package/dist/recyclerview/hooks/useRecyclerViewController.js.map +1 -1
- package/dist/recyclerview/hooks/useRecyclerViewManager.d.ts.map +1 -1
- package/dist/recyclerview/hooks/useRecyclerViewManager.js +2 -1
- package/dist/recyclerview/hooks/useRecyclerViewManager.js.map +1 -1
- package/dist/recyclerview/hooks/useRecyclingState.d.ts +4 -2
- package/dist/recyclerview/hooks/useRecyclingState.d.ts.map +1 -1
- package/dist/recyclerview/hooks/useRecyclingState.js +2 -2
- package/dist/recyclerview/hooks/useRecyclingState.js.map +1 -1
- package/dist/recyclerview/layout-managers/GridLayoutManager.d.ts +14 -6
- package/dist/recyclerview/layout-managers/GridLayoutManager.d.ts.map +1 -1
- package/dist/recyclerview/layout-managers/GridLayoutManager.js +40 -23
- package/dist/recyclerview/layout-managers/GridLayoutManager.js.map +1 -1
- package/dist/recyclerview/layout-managers/LayoutManager.d.ts +26 -6
- package/dist/recyclerview/layout-managers/LayoutManager.d.ts.map +1 -1
- package/dist/recyclerview/layout-managers/LayoutManager.js +89 -15
- package/dist/recyclerview/layout-managers/LayoutManager.js.map +1 -1
- package/dist/recyclerview/layout-managers/MasonryLayoutManager.d.ts +9 -1
- package/dist/recyclerview/layout-managers/MasonryLayoutManager.d.ts.map +1 -1
- package/dist/recyclerview/layout-managers/MasonryLayoutManager.js +28 -12
- package/dist/recyclerview/layout-managers/MasonryLayoutManager.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/viewability/ViewabilityManager.d.ts.map +1 -1
- package/dist/viewability/ViewabilityManager.js +10 -3
- package/dist/viewability/ViewabilityManager.js.map +1 -1
- package/package.json +1 -1
- package/src/FlashListProps.ts +16 -2
- package/src/__tests__/RenderStackManager.test.ts +1 -2
- package/src/recyclerview/RecyclerView.tsx +27 -14
- package/src/recyclerview/RecyclerViewManager.ts +6 -0
- package/src/recyclerview/RenderStackManager.ts +32 -6
- package/src/recyclerview/helpers/RenderTimeTracker.ts +4 -0
- package/src/recyclerview/hooks/useLayoutState.ts +15 -6
- package/src/recyclerview/hooks/useRecyclerViewController.tsx +240 -168
- package/src/recyclerview/hooks/useRecyclerViewManager.ts +3 -1
- package/src/recyclerview/hooks/useRecyclingState.ts +11 -7
- package/src/recyclerview/layout-managers/GridLayoutManager.ts +44 -23
- package/src/recyclerview/layout-managers/LayoutManager.ts +98 -20
- package/src/recyclerview/layout-managers/MasonryLayoutManager.ts +30 -8
- package/src/viewability/ViewabilityManager.ts +10 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRecyclerViewManager.d.ts","sourceRoot":"","sources":["../../../src/recyclerview/hooks/useRecyclerViewManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,eAAO,MAAM,sBAAsB,GAAI,CAAC,EAAE,OAAO,iBAAiB,CAAC,CAAC,CAAC;;;
|
|
1
|
+
{"version":3,"file":"useRecyclerViewManager.d.ts","sourceRoot":"","sources":["../../../src/recyclerview/hooks/useRecyclerViewManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,eAAO,MAAM,sBAAsB,GAAI,CAAC,EAAE,OAAO,iBAAiB,CAAC,CAAC,CAAC;;;CAmCpE,CAAC"}
|
|
@@ -23,11 +23,12 @@ var useRecyclerViewManager = function (props) {
|
|
|
23
23
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24
24
|
}, [data]);
|
|
25
25
|
(0, react_1.useEffect)(function () {
|
|
26
|
+
recyclerViewManager.restoreIfNeeded();
|
|
26
27
|
return function () {
|
|
27
28
|
recyclerViewManager.dispose();
|
|
28
29
|
velocityTracker.cleanUp();
|
|
29
30
|
};
|
|
30
|
-
//
|
|
31
|
+
// Used to perform cleanup on unmount
|
|
31
32
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
32
33
|
}, []);
|
|
33
34
|
return { recyclerViewManager: recyclerViewManager, velocityTracker: velocityTracker };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRecyclerViewManager.js","sourceRoot":"","sources":["../../../src/recyclerview/hooks/useRecyclerViewManager.ts"],"names":[],"mappings":";;;;AAAA,+BAAqD;AAGrD,8DAA6D;AAC7D,8DAA6D;AAEtD,IAAM,sBAAsB,GAAG,UAAI,KAA2B;IAC7D,IAAA,KAAA,eAAwB,IAAA,gBAAQ,EACpC,cAAM,OAAA,IAAI,yCAAmB,CAAC,KAAK,CAAC,EAA9B,CAA8B,CACrC,IAAA,EAFM,mBAAmB,QAEzB,CAAC;IACI,IAAA,KAAA,eAAoB,IAAA,gBAAQ,EAAC,cAAM,OAAA,IAAI,iCAAe,EAAE,EAArB,CAAqB,CAAC,IAAA,EAAxD,eAAe,QAAyC,CAAC;IAExD,IAAA,IAAI,GAAK,KAAK,KAAV,CAAW;IAEvB,IAAA,eAAO,EAAC;QACN,mBAAmB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACvC,+CAA+C;QAC/C,uDAAuD;IACzD,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ;;OAEG;IACH,IAAA,eAAO,EAAC;QACN,mBAAmB,CAAC,iBAAiB,EAAE,CAAC;QACxC,sDAAsD;QACtD,uDAAuD;IACzD,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,IAAA,iBAAS,EAAC;QACR,OAAO;YACL,mBAAmB,CAAC,OAAO,EAAE,CAAC;YAC9B,eAAe,CAAC,OAAO,EAAE,CAAC;QAC5B,CAAC,CAAC;QACF
|
|
1
|
+
{"version":3,"file":"useRecyclerViewManager.js","sourceRoot":"","sources":["../../../src/recyclerview/hooks/useRecyclerViewManager.ts"],"names":[],"mappings":";;;;AAAA,+BAAqD;AAGrD,8DAA6D;AAC7D,8DAA6D;AAEtD,IAAM,sBAAsB,GAAG,UAAI,KAA2B;IAC7D,IAAA,KAAA,eAAwB,IAAA,gBAAQ,EACpC,cAAM,OAAA,IAAI,yCAAmB,CAAC,KAAK,CAAC,EAA9B,CAA8B,CACrC,IAAA,EAFM,mBAAmB,QAEzB,CAAC;IACI,IAAA,KAAA,eAAoB,IAAA,gBAAQ,EAAC,cAAM,OAAA,IAAI,iCAAe,EAAE,EAArB,CAAqB,CAAC,IAAA,EAAxD,eAAe,QAAyC,CAAC;IAExD,IAAA,IAAI,GAAK,KAAK,KAAV,CAAW;IAEvB,IAAA,eAAO,EAAC;QACN,mBAAmB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACvC,+CAA+C;QAC/C,uDAAuD;IACzD,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ;;OAEG;IACH,IAAA,eAAO,EAAC;QACN,mBAAmB,CAAC,iBAAiB,EAAE,CAAC;QACxC,sDAAsD;QACtD,uDAAuD;IACzD,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,IAAA,iBAAS,EAAC;QACR,mBAAmB,CAAC,eAAe,EAAE,CAAC;QAEtC,OAAO;YACL,mBAAmB,CAAC,OAAO,EAAE,CAAC;YAC9B,eAAe,CAAC,OAAO,EAAE,CAAC;QAC5B,CAAC,CAAC;QACF,qCAAqC;QACrC,uDAAuD;IACzD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,mBAAmB,qBAAA,EAAE,eAAe,iBAAA,EAAE,CAAC;AAClD,CAAC,CAAC;AAnCW,QAAA,sBAAsB,0BAmCjC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LayoutStateSetter } from "./useLayoutState";
|
|
2
|
+
export type RecyclingStateSetter<T> = LayoutStateSetter<T>;
|
|
3
|
+
export type RecyclingStateInitialValue<T> = T | (() => T);
|
|
2
4
|
/**
|
|
3
5
|
* A custom hook that provides state management with automatic reset functionality.
|
|
4
6
|
* Similar to useState, but automatically resets the state when specified dependencies change.
|
|
@@ -12,5 +14,5 @@ import { Dispatch, SetStateAction } from "react";
|
|
|
12
14
|
* - The current state value
|
|
13
15
|
* - A setState function that works like useState's setState
|
|
14
16
|
*/
|
|
15
|
-
export declare function useRecyclingState<T>(initialState: T
|
|
17
|
+
export declare function useRecyclingState<T>(initialState: RecyclingStateInitialValue<T>, deps: React.DependencyList, onReset?: () => void): [T, RecyclingStateSetter<T>];
|
|
16
18
|
//# sourceMappingURL=useRecyclingState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRecyclingState.d.ts","sourceRoot":"","sources":["../../../src/recyclerview/hooks/useRecyclingState.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useRecyclingState.d.ts","sourceRoot":"","sources":["../../../src/recyclerview/hooks/useRecyclingState.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAkB,MAAM,kBAAkB,CAAC;AAErE,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAE3D,MAAM,MAAM,0BAA0B,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AAE1D;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,YAAY,EAAE,0BAA0B,CAAC,CAAC,CAAC,EAC3C,IAAI,EAAE,KAAK,CAAC,cAAc,EAC1B,OAAO,CAAC,EAAE,MAAM,IAAI,GACnB,CAAC,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAyC9B"}
|
|
@@ -37,7 +37,7 @@ function useRecyclingState(initialState, deps, onReset) {
|
|
|
37
37
|
* Proxy setState function that updates the stored value and triggers a re-render.
|
|
38
38
|
* Only triggers a re-render if the new value is different from the current value.
|
|
39
39
|
*/
|
|
40
|
-
var setStateProxy = (0, react_1.useCallback)(function (newValue) {
|
|
40
|
+
var setStateProxy = (0, react_1.useCallback)(function (newValue, skipParentLayout) {
|
|
41
41
|
// Calculate next state value from function or direct value
|
|
42
42
|
var nextState = typeof newValue === "function"
|
|
43
43
|
? newValue(valueStore.current)
|
|
@@ -45,7 +45,7 @@ function useRecyclingState(initialState, deps, onReset) {
|
|
|
45
45
|
// Only update and trigger re-render if value has changed
|
|
46
46
|
if (nextState !== valueStore.current) {
|
|
47
47
|
valueStore.current = nextState;
|
|
48
|
-
setCounter(function (prev) { return prev + 1; });
|
|
48
|
+
setCounter(function (prev) { return prev + 1; }, skipParentLayout);
|
|
49
49
|
}
|
|
50
50
|
}, [setCounter]);
|
|
51
51
|
return [valueStore.current, setStateProxy];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRecyclingState.js","sourceRoot":"","sources":["../../../src/recyclerview/hooks/useRecyclingState.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useRecyclingState.js","sourceRoot":"","sources":["../../../src/recyclerview/hooks/useRecyclingState.ts"],"names":[],"mappings":";;AAqBA,8CA6CC;;AAlED,+BAAqD;AAErD,mDAAqE;AAMrE;;;;;;;;;;;;GAYG;AACH,SAAgB,iBAAiB,CAC/B,YAA2C,EAC3C,IAA0B,EAC1B,OAAoB;IAEpB,oEAAoE;IACpE,IAAM,UAAU,GAAG,IAAA,cAAM,GAAK,CAAC;IAC/B,2DAA2D;IACrD,IAAA,KAAA,eAAkB,IAAA,+BAAc,EAAC,CAAC,CAAC,IAAA,EAAlC,CAAC,QAAA,EAAE,UAAU,QAAqB,CAAC;IAE1C,uCAAuC;IACvC,IAAA,eAAO,EAAC;QACN,wDAAwD;QACxD,IAAM,YAAY,GAChB,OAAO,YAAY,KAAK,UAAU;YAChC,CAAC,CAAE,YAAwB,EAAE;YAC7B,CAAC,CAAC,YAAY,CAAC;QACnB,UAAU,CAAC,OAAO,GAAG,YAAY,CAAC;QAClC,oCAAoC;QACpC,OAAO,aAAP,OAAO,uBAAP,OAAO,EAAI,CAAC;QACZ,uDAAuD;IACzD,CAAC,EAAE,IAAI,CAAC,CAAC;IAET;;;OAGG;IACH,IAAM,aAAa,GAA4B,IAAA,mBAAW,EACxD,UAAC,QAAQ,EAAE,gBAAgB;QACzB,2DAA2D;QAC3D,IAAM,SAAS,GACb,OAAO,QAAQ,KAAK,UAAU;YAC5B,CAAC,CAAE,QAAgC,CAAC,UAAU,CAAC,OAAQ,CAAC;YACxD,CAAC,CAAC,QAAQ,CAAC;QAEf,yDAAyD;QACzD,IAAI,SAAS,KAAK,UAAU,CAAC,OAAO,EAAE,CAAC;YACrC,UAAU,CAAC,OAAO,GAAG,SAAS,CAAC;YAC/B,UAAU,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,GAAG,CAAC,EAAR,CAAQ,EAAE,gBAAgB,CAAC,CAAC;QACnD,CAAC;IACH,CAAC,EACD,CAAC,UAAU,CAAC,CACb,CAAC;IAEF,OAAO,CAAC,UAAU,CAAC,OAAQ,EAAE,aAAa,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -6,6 +6,8 @@ import { LayoutParams, RVDimension, RVLayoutInfo, RVLayoutManager } from "./Layo
|
|
|
6
6
|
export declare class RVGridLayoutManagerImpl extends RVLayoutManager {
|
|
7
7
|
/** The width of the bounded area for the grid */
|
|
8
8
|
private boundedSize;
|
|
9
|
+
/** If there's a span change for grid layout, we need to recompute all the widths */
|
|
10
|
+
private fullRelayoutRequired;
|
|
9
11
|
constructor(params: LayoutParams, previousLayoutManager?: RVLayoutManager);
|
|
10
12
|
/**
|
|
11
13
|
* Updates layout parameters and triggers recomputation if necessary.
|
|
@@ -17,12 +19,17 @@ export declare class RVGridLayoutManagerImpl extends RVLayoutManager {
|
|
|
17
19
|
* @param layoutInfo Array of layout information for items
|
|
18
20
|
* @param itemCount Total number of items in the list
|
|
19
21
|
*/
|
|
20
|
-
processLayoutInfo(layoutInfo: RVLayoutInfo[], itemCount: number):
|
|
22
|
+
processLayoutInfo(layoutInfo: RVLayoutInfo[], itemCount: number): 0 | undefined;
|
|
21
23
|
/**
|
|
22
24
|
* Estimates layout dimensions for an item at the given index.
|
|
23
25
|
* @param index Index of the item to estimate layout for
|
|
24
26
|
*/
|
|
25
27
|
estimateLayout(index: number): void;
|
|
28
|
+
/**
|
|
29
|
+
* Handles span change for an item.
|
|
30
|
+
* @param index Index of the item
|
|
31
|
+
*/
|
|
32
|
+
handleSpanChange(index: number): void;
|
|
26
33
|
/**
|
|
27
34
|
* Returns the total size of the layout area.
|
|
28
35
|
* @returns RVDimension containing width and height of the layout
|
|
@@ -44,16 +51,17 @@ export declare class RVGridLayoutManagerImpl extends RVLayoutManager {
|
|
|
44
51
|
* Processes items in a row and returns the tallest item.
|
|
45
52
|
* Also handles height normalization for items in the same row.
|
|
46
53
|
* Tallest item per row helps in forcing tallest items height on neighbouring items.
|
|
47
|
-
* @param
|
|
54
|
+
* @param endIndex Index of the last item in the row
|
|
48
55
|
* @returns The tallest item in the row
|
|
49
56
|
*/
|
|
50
57
|
private processAndReturnTallestItemInRow;
|
|
51
58
|
/**
|
|
52
59
|
* Computes the total height of the layout.
|
|
53
|
-
* @param
|
|
60
|
+
* @param endIndex Index of the last item in the row
|
|
54
61
|
* @returns Total height of the layout
|
|
55
62
|
*/
|
|
56
|
-
private
|
|
63
|
+
private computeTotalHeightTillRow;
|
|
64
|
+
private updateAllWidths;
|
|
57
65
|
/**
|
|
58
66
|
* Checks if an item can fit within the bounded width.
|
|
59
67
|
* @param itemX Starting X position of the item
|
|
@@ -63,9 +71,9 @@ export declare class RVGridLayoutManagerImpl extends RVLayoutManager {
|
|
|
63
71
|
private checkBounds;
|
|
64
72
|
/**
|
|
65
73
|
* Locates the index of the first item in the current row.
|
|
66
|
-
* @param
|
|
74
|
+
* @param itemIndex Index to start searching from
|
|
67
75
|
* @returns Index of the first item in the row
|
|
68
76
|
*/
|
|
69
|
-
private
|
|
77
|
+
private locateFirstIndexInRow;
|
|
70
78
|
}
|
|
71
79
|
//# sourceMappingURL=GridLayoutManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridLayoutManager.d.ts","sourceRoot":"","sources":["../../../src/recyclerview/layout-managers/GridLayoutManager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EAEX,YAAY,EACZ,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,eAAe;IAC1D,iDAAiD;IACjD,OAAO,CAAC,WAAW,CAAS;
|
|
1
|
+
{"version":3,"file":"GridLayoutManager.d.ts","sourceRoot":"","sources":["../../../src/recyclerview/layout-managers/GridLayoutManager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EAEX,YAAY,EACZ,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,eAAe;IAC1D,iDAAiD;IACjD,OAAO,CAAC,WAAW,CAAS;IAE5B,oFAAoF;IACpF,OAAO,CAAC,oBAAoB,CAAS;gBAEzB,MAAM,EAAE,YAAY,EAAE,qBAAqB,CAAC,EAAE,eAAe;IAKzE;;;OAGG;IACH,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAkB9C;;;;OAIG;IACH,iBAAiB,CAAC,UAAU,EAAE,YAAY,EAAE,EAAE,SAAS,EAAE,MAAM;IAiB/D;;;OAGG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM;IAS5B;;;OAGG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM;IAI9B;;;OAGG;IACH,aAAa,IAAI,WAAW;IAS5B;;;;OAIG;IACH,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IA0B5D;;;;OAIG;IACH,OAAO,CAAC,QAAQ;IAIhB;;;;;;OAMG;IACH,OAAO,CAAC,gCAAgC;IAqDxC;;;;OAIG;IACH,OAAO,CAAC,yBAAyB;IAejC,OAAO,CAAC,eAAe;IAMvB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAInB;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;CAY9B"}
|
|
@@ -11,6 +11,8 @@ var RVGridLayoutManagerImpl = /** @class */ (function (_super) {
|
|
|
11
11
|
tslib_1.__extends(RVGridLayoutManagerImpl, _super);
|
|
12
12
|
function RVGridLayoutManagerImpl(params, previousLayoutManager) {
|
|
13
13
|
var _this = _super.call(this, params, previousLayoutManager) || this;
|
|
14
|
+
/** If there's a span change for grid layout, we need to recompute all the widths */
|
|
15
|
+
_this.fullRelayoutRequired = false;
|
|
14
16
|
_this.boundedSize = params.windowSize.width;
|
|
15
17
|
return _this;
|
|
16
18
|
}
|
|
@@ -26,10 +28,7 @@ var RVGridLayoutManagerImpl = /** @class */ (function (_super) {
|
|
|
26
28
|
this.boundedSize = params.windowSize.width;
|
|
27
29
|
if (this.layouts.length > 0) {
|
|
28
30
|
// update all widths
|
|
29
|
-
|
|
30
|
-
this.layouts[i].width = this.getWidth(i);
|
|
31
|
-
}
|
|
32
|
-
// console.log("-----> recomputeLayouts");
|
|
31
|
+
this.updateAllWidths();
|
|
33
32
|
this.recomputeLayouts(0, this.layouts.length - 1);
|
|
34
33
|
this.requiresRepaint = true;
|
|
35
34
|
}
|
|
@@ -59,6 +58,12 @@ var RVGridLayoutManagerImpl = /** @class */ (function (_super) {
|
|
|
59
58
|
}
|
|
60
59
|
finally { if (e_1) throw e_1.error; }
|
|
61
60
|
}
|
|
61
|
+
// TODO: Can be optimized
|
|
62
|
+
if (this.fullRelayoutRequired) {
|
|
63
|
+
this.updateAllWidths();
|
|
64
|
+
this.fullRelayoutRequired = false;
|
|
65
|
+
return 0;
|
|
66
|
+
}
|
|
62
67
|
};
|
|
63
68
|
/**
|
|
64
69
|
* Estimates layout dimensions for an item at the given index.
|
|
@@ -71,6 +76,13 @@ var RVGridLayoutManagerImpl = /** @class */ (function (_super) {
|
|
|
71
76
|
layout.isWidthMeasured = true;
|
|
72
77
|
layout.enforcedWidth = true;
|
|
73
78
|
};
|
|
79
|
+
/**
|
|
80
|
+
* Handles span change for an item.
|
|
81
|
+
* @param index Index of the item
|
|
82
|
+
*/
|
|
83
|
+
RVGridLayoutManagerImpl.prototype.handleSpanChange = function (index) {
|
|
84
|
+
this.fullRelayoutRequired = true;
|
|
85
|
+
};
|
|
74
86
|
/**
|
|
75
87
|
* Returns the total size of the layout area.
|
|
76
88
|
* @returns RVDimension containing width and height of the layout
|
|
@@ -78,7 +90,7 @@ var RVGridLayoutManagerImpl = /** @class */ (function (_super) {
|
|
|
78
90
|
RVGridLayoutManagerImpl.prototype.getLayoutSize = function () {
|
|
79
91
|
if (this.layouts.length === 0)
|
|
80
92
|
return { width: 0, height: 0 };
|
|
81
|
-
var totalHeight = this.
|
|
93
|
+
var totalHeight = this.computeTotalHeightTillRow(this.layouts.length - 1);
|
|
82
94
|
return {
|
|
83
95
|
width: this.boundedSize,
|
|
84
96
|
height: totalHeight,
|
|
@@ -90,7 +102,7 @@ var RVGridLayoutManagerImpl = /** @class */ (function (_super) {
|
|
|
90
102
|
* @param endIndex Ending index of items to recompute
|
|
91
103
|
*/
|
|
92
104
|
RVGridLayoutManagerImpl.prototype.recomputeLayouts = function (startIndex, endIndex) {
|
|
93
|
-
var newStartIndex = this.
|
|
105
|
+
var newStartIndex = this.locateFirstIndexInRow(Math.max(0, startIndex - 1));
|
|
94
106
|
var startVal = this.getLayout(newStartIndex);
|
|
95
107
|
var startX = startVal.x;
|
|
96
108
|
var startY = startVal.y;
|
|
@@ -115,26 +127,23 @@ var RVGridLayoutManagerImpl = /** @class */ (function (_super) {
|
|
|
115
127
|
* @returns Width of the item
|
|
116
128
|
*/
|
|
117
129
|
RVGridLayoutManagerImpl.prototype.getWidth = function (index) {
|
|
118
|
-
|
|
119
|
-
var span = (_a = this.getSpanSizeInfo(index).span) !== null && _a !== void 0 ? _a : 1;
|
|
120
|
-
return (this.boundedSize / this.maxColumns) * span;
|
|
130
|
+
return (this.boundedSize / this.maxColumns) * this.getSpan(index);
|
|
121
131
|
};
|
|
122
132
|
/**
|
|
123
133
|
* Processes items in a row and returns the tallest item.
|
|
124
134
|
* Also handles height normalization for items in the same row.
|
|
125
135
|
* Tallest item per row helps in forcing tallest items height on neighbouring items.
|
|
126
|
-
* @param
|
|
136
|
+
* @param endIndex Index of the last item in the row
|
|
127
137
|
* @returns The tallest item in the row
|
|
128
138
|
*/
|
|
129
|
-
RVGridLayoutManagerImpl.prototype.processAndReturnTallestItemInRow = function (
|
|
139
|
+
RVGridLayoutManagerImpl.prototype.processAndReturnTallestItemInRow = function (endIndex) {
|
|
130
140
|
var _a, _b;
|
|
131
|
-
var startIndex = this.
|
|
132
|
-
var y = this.layouts[startIndex].y;
|
|
141
|
+
var startIndex = this.locateFirstIndexInRow(endIndex);
|
|
133
142
|
var tallestItem;
|
|
134
143
|
var maxHeight = 0;
|
|
135
144
|
var i = startIndex;
|
|
136
145
|
var isMeasured = false;
|
|
137
|
-
while (
|
|
146
|
+
while (i <= endIndex) {
|
|
138
147
|
var layout = this.layouts[i];
|
|
139
148
|
isMeasured = isMeasured || Boolean(layout.isHeightMeasured);
|
|
140
149
|
maxHeight = Math.max(maxHeight, layout.height);
|
|
@@ -147,6 +156,9 @@ var RVGridLayoutManagerImpl = /** @class */ (function (_super) {
|
|
|
147
156
|
break;
|
|
148
157
|
}
|
|
149
158
|
}
|
|
159
|
+
if (!tallestItem && maxHeight > 0) {
|
|
160
|
+
maxHeight = Number.MAX_SAFE_INTEGER;
|
|
161
|
+
}
|
|
150
162
|
tallestItem = tallestItem !== null && tallestItem !== void 0 ? tallestItem : this.layouts[startIndex];
|
|
151
163
|
if (!isMeasured) {
|
|
152
164
|
return tallestItem;
|
|
@@ -158,7 +170,7 @@ var RVGridLayoutManagerImpl = /** @class */ (function (_super) {
|
|
|
158
170
|
this.requiresRepaint = true;
|
|
159
171
|
}
|
|
160
172
|
i = startIndex;
|
|
161
|
-
while (
|
|
173
|
+
while (i <= endIndex) {
|
|
162
174
|
this.layouts[i].minHeight = targetHeight;
|
|
163
175
|
if (targetHeight > 0) {
|
|
164
176
|
this.layouts[i].height = targetHeight;
|
|
@@ -174,15 +186,15 @@ var RVGridLayoutManagerImpl = /** @class */ (function (_super) {
|
|
|
174
186
|
};
|
|
175
187
|
/**
|
|
176
188
|
* Computes the total height of the layout.
|
|
177
|
-
* @param
|
|
189
|
+
* @param endIndex Index of the last item in the row
|
|
178
190
|
* @returns Total height of the layout
|
|
179
191
|
*/
|
|
180
|
-
RVGridLayoutManagerImpl.prototype.
|
|
181
|
-
var startIndex = this.
|
|
192
|
+
RVGridLayoutManagerImpl.prototype.computeTotalHeightTillRow = function (endIndex) {
|
|
193
|
+
var startIndex = this.locateFirstIndexInRow(endIndex);
|
|
182
194
|
var y = this.layouts[startIndex].y;
|
|
183
195
|
var maxHeight = 0;
|
|
184
196
|
var i = startIndex;
|
|
185
|
-
while (
|
|
197
|
+
while (i <= endIndex) {
|
|
186
198
|
maxHeight = Math.max(maxHeight, this.layouts[i].height);
|
|
187
199
|
i++;
|
|
188
200
|
if (i >= this.layouts.length) {
|
|
@@ -191,6 +203,11 @@ var RVGridLayoutManagerImpl = /** @class */ (function (_super) {
|
|
|
191
203
|
}
|
|
192
204
|
return y + maxHeight;
|
|
193
205
|
};
|
|
206
|
+
RVGridLayoutManagerImpl.prototype.updateAllWidths = function () {
|
|
207
|
+
for (var i = 0; i < this.layouts.length; i++) {
|
|
208
|
+
this.layouts[i].width = this.getWidth(i);
|
|
209
|
+
}
|
|
210
|
+
};
|
|
194
211
|
/**
|
|
195
212
|
* Checks if an item can fit within the bounded width.
|
|
196
213
|
* @param itemX Starting X position of the item
|
|
@@ -202,14 +219,14 @@ var RVGridLayoutManagerImpl = /** @class */ (function (_super) {
|
|
|
202
219
|
};
|
|
203
220
|
/**
|
|
204
221
|
* Locates the index of the first item in the current row.
|
|
205
|
-
* @param
|
|
222
|
+
* @param itemIndex Index to start searching from
|
|
206
223
|
* @returns Index of the first item in the row
|
|
207
224
|
*/
|
|
208
|
-
RVGridLayoutManagerImpl.prototype.
|
|
209
|
-
if (
|
|
225
|
+
RVGridLayoutManagerImpl.prototype.locateFirstIndexInRow = function (itemIndex) {
|
|
226
|
+
if (itemIndex === 0) {
|
|
210
227
|
return 0;
|
|
211
228
|
}
|
|
212
|
-
var i =
|
|
229
|
+
var i = itemIndex;
|
|
213
230
|
for (; i >= 0; i--) {
|
|
214
231
|
if (this.layouts[i].x === 0) {
|
|
215
232
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridLayoutManager.js","sourceRoot":"","sources":["../../../src/recyclerview/layout-managers/GridLayoutManager.ts"],"names":[],"mappings":";;;;AAAA,iDAMyB;AAEzB;;;GAGG;AACH;IAA6C,mDAAe;
|
|
1
|
+
{"version":3,"file":"GridLayoutManager.js","sourceRoot":"","sources":["../../../src/recyclerview/layout-managers/GridLayoutManager.ts"],"names":[],"mappings":";;;;AAAA,iDAMyB;AAEzB;;;GAGG;AACH;IAA6C,mDAAe;IAO1D,iCAAY,MAAoB,EAAE,qBAAuC;QACvE,YAAA,MAAK,YAAC,MAAM,EAAE,qBAAqB,CAAC,SAAC;QAJvC,oFAAoF;QAC5E,0BAAoB,GAAG,KAAK,CAAC;QAInC,KAAI,CAAC,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC;;IAC7C,CAAC;IAED;;;OAGG;IACH,oDAAkB,GAAlB,UAAmB,MAAoB;QACrC,IAAM,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC;QACvC,gBAAK,CAAC,kBAAkB,YAAC,MAAM,CAAC,CAAC;QACjC,IACE,IAAI,CAAC,WAAW,KAAK,MAAM,CAAC,UAAU,CAAC,KAAK;YAC5C,cAAc,KAAK,MAAM,CAAC,UAAU,EACpC,CAAC;YACD,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,UAAU,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,EAAE,CAAC,EAAE,EAAE,CAAC;YACnB,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC5B,MAAM;YACR,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACxB,CAAC;IACH,8BAAC;AAAD,CAAC,AAnPD,CAA6C,+BAAe,GAmP3D;AAnPY,0DAAuB"}
|
|
@@ -11,8 +11,6 @@ export declare abstract class RVLayoutManager {
|
|
|
11
11
|
protected layouts: RVLayout[];
|
|
12
12
|
/** Dimensions of the visible window/viewport */
|
|
13
13
|
protected windowSize: RVDimension;
|
|
14
|
-
/** Information about item spans and sizes */
|
|
15
|
-
protected spanSizeInfo: SpanSizeInfo;
|
|
16
14
|
/** Maximum number of columns in the layout */
|
|
17
15
|
protected maxColumns: number;
|
|
18
16
|
/** Whether to optimize item placement for better space utilization */
|
|
@@ -29,6 +27,17 @@ export declare abstract class RVLayoutManager {
|
|
|
29
27
|
private widthAverageWindow;
|
|
30
28
|
/** Maximum number of items to process in a single layout pass */
|
|
31
29
|
private maxItemsToProcess;
|
|
30
|
+
/** Information about item spans and sizes */
|
|
31
|
+
private spanSizeInfo;
|
|
32
|
+
/** Span tracker for each item */
|
|
33
|
+
private spanTracker;
|
|
34
|
+
/** Current max index with changed layout */
|
|
35
|
+
private currentMaxIndexWithChangedLayout;
|
|
36
|
+
/**
|
|
37
|
+
* Last index that was skipped during layout computation.
|
|
38
|
+
* Used to determine if a layout needs to be recomputed.
|
|
39
|
+
*/
|
|
40
|
+
private lastSkippedLayoutIndex;
|
|
32
41
|
constructor(params: LayoutParams, previousLayoutManager?: RVLayoutManager);
|
|
33
42
|
/**
|
|
34
43
|
* Gets the estimated width for an item based on its type.
|
|
@@ -108,11 +117,20 @@ export declare abstract class RVLayoutManager {
|
|
|
108
117
|
*/
|
|
109
118
|
protected abstract estimateLayout(index: number): void;
|
|
110
119
|
/**
|
|
111
|
-
* Gets span
|
|
120
|
+
* Gets span for an item, applying any overrides.
|
|
121
|
+
* This is intended to be called during a relayout call. The value is tracked and used to determine if a span change has occurred.
|
|
122
|
+
* If skipTracking is true, the operation is not tracked. Can be useful if span is required outside of a relayout call.
|
|
123
|
+
* The tracker is used to call handleSpanChange if a span change has occurred before relayout call.
|
|
124
|
+
* // TODO: improve this contract.
|
|
125
|
+
* @param index Index of the item
|
|
126
|
+
* @returns Span for the item
|
|
127
|
+
*/
|
|
128
|
+
protected getSpan(index: number, skipTracking?: boolean): number;
|
|
129
|
+
/**
|
|
130
|
+
* Method to handle span change for an item. Can be overridden by subclasses.
|
|
112
131
|
* @param index Index of the item
|
|
113
|
-
* @returns SpanSizeInfo for the item
|
|
114
132
|
*/
|
|
115
|
-
protected
|
|
133
|
+
protected handleSpanChange(index: number): void;
|
|
116
134
|
/**
|
|
117
135
|
* Gets the maximum index to process in a single layout pass.
|
|
118
136
|
* @param startIndex Starting index
|
|
@@ -125,12 +143,14 @@ export declare abstract class RVLayoutManager {
|
|
|
125
143
|
* @returns Minimum index to process
|
|
126
144
|
*/
|
|
127
145
|
private getMinRecomputeIndex;
|
|
146
|
+
private _recomputeLayouts;
|
|
128
147
|
/**
|
|
129
148
|
* Computes size estimates and finds the minimum recompute index.
|
|
130
149
|
* @param layoutInfo Array of layout information for items
|
|
131
150
|
* @returns Minimum index that needs recomputation
|
|
132
151
|
*/
|
|
133
|
-
private
|
|
152
|
+
private computeEstimatesAndMinMaxChangedLayout;
|
|
153
|
+
private computeMinIndexWithChangedSpan;
|
|
134
154
|
}
|
|
135
155
|
/**
|
|
136
156
|
* Configuration parameters for the layout manager
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutManager.d.ts","sourceRoot":"","sources":["../../../src/recyclerview/layout-managers/LayoutManager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAOnE;;;;GAI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AAM,CAAC;IAElB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -15,12 +15,21 @@ var measureLayout_1 = require("../utils/measureLayout");
|
|
|
15
15
|
var RVLayoutManager = /** @class */ (function () {
|
|
16
16
|
function RVLayoutManager(params, previousLayoutManager) {
|
|
17
17
|
var _a, _b;
|
|
18
|
-
/** Information about item spans and sizes */
|
|
19
|
-
this.spanSizeInfo = {};
|
|
20
18
|
/** Flag indicating if the layout requires repainting */
|
|
21
19
|
this.requiresRepaint = false;
|
|
22
20
|
/** Maximum number of items to process in a single layout pass */
|
|
23
|
-
this.maxItemsToProcess = 250;
|
|
21
|
+
this.maxItemsToProcess = 250;
|
|
22
|
+
/** Information about item spans and sizes */
|
|
23
|
+
this.spanSizeInfo = {};
|
|
24
|
+
/** Span tracker for each item */
|
|
25
|
+
this.spanTracker = [];
|
|
26
|
+
/** Current max index with changed layout */
|
|
27
|
+
this.currentMaxIndexWithChangedLayout = -1;
|
|
28
|
+
/**
|
|
29
|
+
* Last index that was skipped during layout computation.
|
|
30
|
+
* Used to determine if a layout needs to be recomputed.
|
|
31
|
+
*/
|
|
32
|
+
this.lastSkippedLayoutIndex = Number.MAX_VALUE;
|
|
24
33
|
this.heightAverageWindow = new AverageWindow_1.MultiTypeAverageWindow(5, 200);
|
|
25
34
|
this.widthAverageWindow = new AverageWindow_1.MultiTypeAverageWindow(5, 200);
|
|
26
35
|
this.getItemType = params.getItemType;
|
|
@@ -107,7 +116,7 @@ var RVLayoutManager = /** @class */ (function () {
|
|
|
107
116
|
}
|
|
108
117
|
var startIndex = Math.min.apply(Math, tslib_1.__spreadArray([], tslib_1.__read(indices), false));
|
|
109
118
|
// Recompute layouts starting from the smallest index in the original indices array
|
|
110
|
-
this.
|
|
119
|
+
this._recomputeLayouts(this.getMinRecomputeIndex(startIndex), this.getMaxRecomputeIndex(startIndex));
|
|
111
120
|
};
|
|
112
121
|
/**
|
|
113
122
|
* Updates layout information for items and recomputes layout if necessary.
|
|
@@ -116,27 +125,32 @@ var RVLayoutManager = /** @class */ (function () {
|
|
|
116
125
|
*/
|
|
117
126
|
RVLayoutManager.prototype.modifyLayout = function (layoutInfo, totalItemCount) {
|
|
118
127
|
var _a;
|
|
128
|
+
this.maxItemsToProcess = Math.max(this.maxItemsToProcess, layoutInfo.length * 10);
|
|
119
129
|
var minRecomputeIndex = Number.MAX_VALUE;
|
|
120
130
|
if (this.layouts.length > totalItemCount) {
|
|
121
131
|
this.layouts.length = totalItemCount;
|
|
132
|
+
this.spanTracker.length = totalItemCount;
|
|
122
133
|
minRecomputeIndex = totalItemCount - 1; // <0 gets skipped so it's safe to set to totalItemCount - 1
|
|
123
134
|
}
|
|
124
135
|
// update average windows
|
|
125
|
-
minRecomputeIndex = Math.min(minRecomputeIndex, this.
|
|
136
|
+
minRecomputeIndex = Math.min(minRecomputeIndex, this.computeEstimatesAndMinMaxChangedLayout(layoutInfo));
|
|
126
137
|
if (this.layouts.length < totalItemCount && totalItemCount > 0) {
|
|
127
138
|
var startIndex = this.layouts.length;
|
|
128
139
|
this.layouts.length = totalItemCount;
|
|
140
|
+
this.spanTracker.length = totalItemCount;
|
|
129
141
|
for (var i = startIndex; i < totalItemCount; i++) {
|
|
130
142
|
this.getLayout(i);
|
|
143
|
+
this.getSpan(i);
|
|
131
144
|
}
|
|
132
145
|
this.recomputeLayouts(startIndex, totalItemCount - 1);
|
|
133
146
|
}
|
|
134
|
-
minRecomputeIndex = Math.min(minRecomputeIndex, (_a = this.processLayoutInfo(layoutInfo, totalItemCount)) !== null && _a !== void 0 ? _a : minRecomputeIndex);
|
|
135
147
|
// compute minRecomputeIndex
|
|
136
|
-
minRecomputeIndex = Math.min(minRecomputeIndex, this.
|
|
148
|
+
minRecomputeIndex = Math.min(minRecomputeIndex, this.lastSkippedLayoutIndex, this.computeMinIndexWithChangedSpan(layoutInfo), (_a = this.processLayoutInfo(layoutInfo, totalItemCount)) !== null && _a !== void 0 ? _a : minRecomputeIndex, this.computeEstimatesAndMinMaxChangedLayout(layoutInfo));
|
|
137
149
|
if (minRecomputeIndex >= 0 && minRecomputeIndex < totalItemCount) {
|
|
138
|
-
|
|
150
|
+
var maxRecomputeIndex = this.getMaxRecomputeIndex(minRecomputeIndex);
|
|
151
|
+
this._recomputeLayouts(minRecomputeIndex, maxRecomputeIndex);
|
|
139
152
|
}
|
|
153
|
+
this.currentMaxIndexWithChangedLayout = -1;
|
|
140
154
|
};
|
|
141
155
|
/**
|
|
142
156
|
* Gets layout information for an item at the given index.
|
|
@@ -180,22 +194,38 @@ var RVLayoutManager = /** @class */ (function () {
|
|
|
180
194
|
return this.layouts.length;
|
|
181
195
|
};
|
|
182
196
|
/**
|
|
183
|
-
* Gets span
|
|
197
|
+
* Gets span for an item, applying any overrides.
|
|
198
|
+
* This is intended to be called during a relayout call. The value is tracked and used to determine if a span change has occurred.
|
|
199
|
+
* If skipTracking is true, the operation is not tracked. Can be useful if span is required outside of a relayout call.
|
|
200
|
+
* The tracker is used to call handleSpanChange if a span change has occurred before relayout call.
|
|
201
|
+
* // TODO: improve this contract.
|
|
184
202
|
* @param index Index of the item
|
|
185
|
-
* @returns
|
|
203
|
+
* @returns Span for the item
|
|
186
204
|
*/
|
|
187
|
-
RVLayoutManager.prototype.
|
|
205
|
+
RVLayoutManager.prototype.getSpan = function (index, skipTracking) {
|
|
206
|
+
var _a;
|
|
207
|
+
if (skipTracking === void 0) { skipTracking = false; }
|
|
188
208
|
this.spanSizeInfo.span = undefined;
|
|
189
209
|
this.overrideItemLayout(index, this.spanSizeInfo);
|
|
190
|
-
|
|
210
|
+
var span = Math.min((_a = this.spanSizeInfo.span) !== null && _a !== void 0 ? _a : 1, this.maxColumns);
|
|
211
|
+
if (!skipTracking) {
|
|
212
|
+
this.spanTracker[index] = span;
|
|
213
|
+
}
|
|
214
|
+
return span;
|
|
191
215
|
};
|
|
216
|
+
/**
|
|
217
|
+
* Method to handle span change for an item. Can be overridden by subclasses.
|
|
218
|
+
* @param index Index of the item
|
|
219
|
+
*/
|
|
220
|
+
RVLayoutManager.prototype.handleSpanChange = function (index) { };
|
|
192
221
|
/**
|
|
193
222
|
* Gets the maximum index to process in a single layout pass.
|
|
194
223
|
* @param startIndex Starting index
|
|
195
224
|
* @returns Maximum index to process
|
|
196
225
|
*/
|
|
197
226
|
RVLayoutManager.prototype.getMaxRecomputeIndex = function (startIndex) {
|
|
198
|
-
return Math.min(startIndex
|
|
227
|
+
return Math.min(Math.max(startIndex, this.currentMaxIndexWithChangedLayout) +
|
|
228
|
+
this.maxItemsToProcess, this.layouts.length - 1);
|
|
199
229
|
};
|
|
200
230
|
/**
|
|
201
231
|
* Gets the minimum index to process in a single layout pass.
|
|
@@ -205,12 +235,29 @@ var RVLayoutManager = /** @class */ (function () {
|
|
|
205
235
|
RVLayoutManager.prototype.getMinRecomputeIndex = function (startIndex) {
|
|
206
236
|
return startIndex;
|
|
207
237
|
};
|
|
238
|
+
RVLayoutManager.prototype._recomputeLayouts = function (startIndex, endIndex) {
|
|
239
|
+
this.recomputeLayouts(startIndex, endIndex);
|
|
240
|
+
if (this.lastSkippedLayoutIndex >= startIndex &&
|
|
241
|
+
this.lastSkippedLayoutIndex <= endIndex) {
|
|
242
|
+
this.lastSkippedLayoutIndex = Number.MAX_VALUE;
|
|
243
|
+
}
|
|
244
|
+
if (endIndex + 1 < this.layouts.length) {
|
|
245
|
+
this.lastSkippedLayoutIndex = Math.min(endIndex + 1, this.lastSkippedLayoutIndex);
|
|
246
|
+
var lastIndex = this.layouts.length - 1;
|
|
247
|
+
// Since layout managers derive height from last indices we need to make
|
|
248
|
+
// sure they're not too much out of sync.
|
|
249
|
+
if (this.layouts[lastIndex].y < this.layouts[endIndex].y) {
|
|
250
|
+
this.recomputeLayouts(this.lastSkippedLayoutIndex, lastIndex);
|
|
251
|
+
this.lastSkippedLayoutIndex = Number.MAX_VALUE;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
};
|
|
208
255
|
/**
|
|
209
256
|
* Computes size estimates and finds the minimum recompute index.
|
|
210
257
|
* @param layoutInfo Array of layout information for items
|
|
211
258
|
* @returns Minimum index that needs recomputation
|
|
212
259
|
*/
|
|
213
|
-
RVLayoutManager.prototype.
|
|
260
|
+
RVLayoutManager.prototype.computeEstimatesAndMinMaxChangedLayout = function (layoutInfo) {
|
|
214
261
|
var e_2, _a;
|
|
215
262
|
var minRecomputeIndex = Number.MAX_VALUE;
|
|
216
263
|
try {
|
|
@@ -218,12 +265,14 @@ var RVLayoutManager = /** @class */ (function () {
|
|
|
218
265
|
var info = layoutInfo_1_1.value;
|
|
219
266
|
var index = info.index, dimensions = info.dimensions;
|
|
220
267
|
var storedLayout = this.layouts[index];
|
|
221
|
-
if (
|
|
268
|
+
if (index >= this.lastSkippedLayoutIndex ||
|
|
269
|
+
!storedLayout ||
|
|
222
270
|
!storedLayout.isHeightMeasured ||
|
|
223
271
|
!storedLayout.isWidthMeasured ||
|
|
224
272
|
(0, measureLayout_1.areDimensionsNotEqual)(storedLayout.height, dimensions.height) ||
|
|
225
273
|
(0, measureLayout_1.areDimensionsNotEqual)(storedLayout.width, dimensions.width)) {
|
|
226
274
|
minRecomputeIndex = Math.min(minRecomputeIndex, index);
|
|
275
|
+
this.currentMaxIndexWithChangedLayout = Math.max(this.currentMaxIndexWithChangedLayout, index);
|
|
227
276
|
}
|
|
228
277
|
this.heightAverageWindow.addValue(dimensions.height, this.getItemType(index));
|
|
229
278
|
this.widthAverageWindow.addValue(dimensions.width, this.getItemType(index));
|
|
@@ -238,6 +287,31 @@ var RVLayoutManager = /** @class */ (function () {
|
|
|
238
287
|
}
|
|
239
288
|
return minRecomputeIndex;
|
|
240
289
|
};
|
|
290
|
+
RVLayoutManager.prototype.computeMinIndexWithChangedSpan = function (layoutInfo) {
|
|
291
|
+
var e_3, _a;
|
|
292
|
+
var minIndexWithChangedSpan = Number.MAX_VALUE;
|
|
293
|
+
try {
|
|
294
|
+
for (var layoutInfo_2 = tslib_1.__values(layoutInfo), layoutInfo_2_1 = layoutInfo_2.next(); !layoutInfo_2_1.done; layoutInfo_2_1 = layoutInfo_2.next()) {
|
|
295
|
+
var info = layoutInfo_2_1.value;
|
|
296
|
+
var index = info.index;
|
|
297
|
+
var span = this.getSpan(index, true);
|
|
298
|
+
var storedSpan = this.spanTracker[index];
|
|
299
|
+
if (span !== storedSpan) {
|
|
300
|
+
this.spanTracker[index] = span;
|
|
301
|
+
this.handleSpanChange(index);
|
|
302
|
+
minIndexWithChangedSpan = Math.min(minIndexWithChangedSpan, index);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
307
|
+
finally {
|
|
308
|
+
try {
|
|
309
|
+
if (layoutInfo_2_1 && !layoutInfo_2_1.done && (_a = layoutInfo_2.return)) _a.call(layoutInfo_2);
|
|
310
|
+
}
|
|
311
|
+
finally { if (e_3) throw e_3.error; }
|
|
312
|
+
}
|
|
313
|
+
return minIndexWithChangedSpan;
|
|
314
|
+
};
|
|
241
315
|
return RVLayoutManager;
|
|
242
316
|
}());
|
|
243
317
|
exports.RVLayoutManager = RVLayoutManager;
|