@shopify/flash-list 1.8.0 → 2.0.0-alpha.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/README.md +147 -26
- package/dist/FlashListProps.d.ts +65 -2
- package/dist/FlashListProps.d.ts.map +1 -1
- package/dist/__tests__/AverageWindow.test.js +35 -0
- package/dist/__tests__/AverageWindow.test.js.map +1 -1
- package/dist/enableNewCore.d.ts +3 -0
- package/dist/enableNewCore.d.ts.map +1 -0
- package/dist/enableNewCore.js +25 -0
- package/dist/enableNewCore.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -8
- package/dist/index.js.map +1 -1
- package/dist/recyclerview/RecycleKeyManager.d.ts +82 -0
- package/dist/recyclerview/RecycleKeyManager.d.ts.map +1 -0
- package/dist/recyclerview/RecycleKeyManager.js +135 -0
- package/dist/recyclerview/RecycleKeyManager.js.map +1 -0
- package/dist/recyclerview/RecyclerView.d.ts +12 -0
- package/dist/recyclerview/RecyclerView.d.ts.map +1 -0
- package/dist/recyclerview/RecyclerView.js +283 -0
- package/dist/recyclerview/RecyclerView.js.map +1 -0
- package/dist/recyclerview/RecyclerViewContextProvider.d.ts +12 -0
- package/dist/recyclerview/RecyclerViewContextProvider.d.ts.map +1 -0
- package/dist/recyclerview/RecyclerViewContextProvider.js +11 -0
- package/dist/recyclerview/RecyclerViewContextProvider.js.map +1 -0
- package/dist/recyclerview/RecyclerViewManager.d.ts +52 -0
- package/dist/recyclerview/RecyclerViewManager.d.ts.map +1 -0
- package/dist/recyclerview/RecyclerViewManager.js +323 -0
- package/dist/recyclerview/RecyclerViewManager.js.map +1 -0
- package/dist/recyclerview/RecyclerViewProps.d.ts +9 -0
- package/dist/recyclerview/RecyclerViewProps.d.ts.map +1 -0
- package/dist/recyclerview/RecyclerViewProps.js +3 -0
- package/dist/recyclerview/RecyclerViewProps.js.map +1 -0
- package/dist/recyclerview/ViewHolder.d.ts +45 -0
- package/dist/recyclerview/ViewHolder.d.ts.map +1 -0
- package/dist/recyclerview/ViewHolder.js +96 -0
- package/dist/recyclerview/ViewHolder.js.map +1 -0
- package/dist/recyclerview/ViewHolderCollection.d.ts +57 -0
- package/dist/recyclerview/ViewHolderCollection.d.ts.map +1 -0
- package/dist/recyclerview/ViewHolderCollection.js +75 -0
- package/dist/recyclerview/ViewHolderCollection.js.map +1 -0
- package/dist/recyclerview/components/CompatScroller.d.ts +7 -0
- package/dist/recyclerview/components/CompatScroller.d.ts.map +1 -0
- package/dist/recyclerview/components/CompatScroller.js +8 -0
- package/dist/recyclerview/components/CompatScroller.js.map +1 -0
- package/dist/recyclerview/components/CompatView.d.ts +7 -0
- package/dist/recyclerview/components/CompatView.d.ts.map +1 -0
- package/dist/recyclerview/components/CompatView.js +8 -0
- package/dist/recyclerview/components/CompatView.js.map +1 -0
- package/dist/recyclerview/components/ScrollAnchor.d.ts +28 -0
- package/dist/recyclerview/components/ScrollAnchor.d.ts.map +1 -0
- package/dist/recyclerview/components/ScrollAnchor.js +35 -0
- package/dist/recyclerview/components/ScrollAnchor.js.map +1 -0
- package/dist/recyclerview/components/StickyHeaders.d.ts +38 -0
- package/dist/recyclerview/components/StickyHeaders.d.ts.map +1 -0
- package/dist/recyclerview/components/StickyHeaders.js +119 -0
- package/dist/recyclerview/components/StickyHeaders.js.map +1 -0
- package/dist/recyclerview/helpers/ConsecutiveNumbers.d.ts +51 -0
- package/dist/recyclerview/helpers/ConsecutiveNumbers.d.ts.map +1 -0
- package/dist/recyclerview/helpers/ConsecutiveNumbers.js +122 -0
- package/dist/recyclerview/helpers/ConsecutiveNumbers.js.map +1 -0
- package/dist/recyclerview/helpers/EngagedIndicesTracker.d.ts +59 -0
- package/dist/recyclerview/helpers/EngagedIndicesTracker.d.ts.map +1 -0
- package/dist/recyclerview/helpers/EngagedIndicesTracker.js +138 -0
- package/dist/recyclerview/helpers/EngagedIndicesTracker.js.map +1 -0
- package/dist/recyclerview/hooks/useBoundDetection.d.ts +19 -0
- package/dist/recyclerview/hooks/useBoundDetection.d.ts.map +1 -0
- package/dist/recyclerview/hooks/useBoundDetection.js +103 -0
- package/dist/recyclerview/hooks/useBoundDetection.js.map +1 -0
- package/dist/recyclerview/hooks/useLayoutState.d.ts +12 -0
- package/dist/recyclerview/hooks/useLayoutState.d.ts.map +1 -0
- package/dist/recyclerview/hooks/useLayoutState.js +43 -0
- package/dist/recyclerview/hooks/useLayoutState.js.map +1 -0
- package/dist/recyclerview/hooks/useOnLoad.d.ts +25 -0
- package/dist/recyclerview/hooks/useOnLoad.d.ts.map +1 -0
- package/dist/recyclerview/hooks/useOnLoad.js +73 -0
- package/dist/recyclerview/hooks/useOnLoad.js.map +1 -0
- package/dist/recyclerview/hooks/useRecyclerViewController.d.ts +72 -0
- package/dist/recyclerview/hooks/useRecyclerViewController.d.ts.map +1 -0
- package/dist/recyclerview/hooks/useRecyclerViewController.js +370 -0
- package/dist/recyclerview/hooks/useRecyclerViewController.js.map +1 -0
- package/dist/recyclerview/hooks/useRecyclerViewManager.d.ts +6 -0
- package/dist/recyclerview/hooks/useRecyclerViewManager.d.ts.map +1 -0
- package/dist/recyclerview/hooks/useRecyclerViewManager.js +27 -0
- package/dist/recyclerview/hooks/useRecyclerViewManager.js.map +1 -0
- package/dist/recyclerview/hooks/useRecyclingState.d.ts +16 -0
- package/dist/recyclerview/hooks/useRecyclingState.d.ts.map +1 -0
- package/dist/recyclerview/hooks/useRecyclingState.js +54 -0
- package/dist/recyclerview/hooks/useRecyclingState.js.map +1 -0
- package/dist/recyclerview/hooks/useSecondaryProps.d.ts +27 -0
- package/dist/recyclerview/hooks/useSecondaryProps.d.ts.map +1 -0
- package/dist/recyclerview/hooks/useSecondaryProps.js +93 -0
- package/dist/recyclerview/hooks/useSecondaryProps.js.map +1 -0
- package/dist/recyclerview/hooks/useUnmountFlag.d.ts +11 -0
- package/dist/recyclerview/hooks/useUnmountFlag.d.ts.map +1 -0
- package/dist/recyclerview/hooks/useUnmountFlag.js +28 -0
- package/dist/recyclerview/hooks/useUnmountFlag.js.map +1 -0
- package/dist/recyclerview/layout-managers/GridLayoutManager.d.ts +65 -0
- package/dist/recyclerview/layout-managers/GridLayoutManager.d.ts.map +1 -0
- package/dist/recyclerview/layout-managers/GridLayoutManager.js +204 -0
- package/dist/recyclerview/layout-managers/GridLayoutManager.js.map +1 -0
- package/dist/recyclerview/layout-managers/LayoutManager.d.ts +281 -0
- package/dist/recyclerview/layout-managers/LayoutManager.d.ts.map +1 -0
- package/dist/recyclerview/layout-managers/LayoutManager.js +250 -0
- package/dist/recyclerview/layout-managers/LayoutManager.js.map +1 -0
- package/dist/recyclerview/layout-managers/LinearLayoutManager.d.ts +52 -0
- package/dist/recyclerview/layout-managers/LinearLayoutManager.d.ts.map +1 -0
- package/dist/recyclerview/layout-managers/LinearLayoutManager.js +191 -0
- package/dist/recyclerview/layout-managers/LinearLayoutManager.js.map +1 -0
- package/dist/recyclerview/layout-managers/MasonryLayoutManager.d.ts +73 -0
- package/dist/recyclerview/layout-managers/MasonryLayoutManager.d.ts.map +1 -0
- package/dist/recyclerview/layout-managers/MasonryLayoutManager.js +274 -0
- package/dist/recyclerview/layout-managers/MasonryLayoutManager.js.map +1 -0
- package/dist/recyclerview/utils/adjustOffsetForRTL.d.ts +12 -0
- package/dist/recyclerview/utils/adjustOffsetForRTL.d.ts.map +1 -0
- package/dist/recyclerview/utils/adjustOffsetForRTL.js +18 -0
- package/dist/recyclerview/utils/adjustOffsetForRTL.js.map +1 -0
- package/dist/recyclerview/utils/componentUtils.d.ts +19 -0
- package/dist/recyclerview/utils/componentUtils.d.ts.map +1 -0
- package/dist/recyclerview/utils/componentUtils.js +32 -0
- package/dist/recyclerview/utils/componentUtils.js.map +1 -0
- package/dist/recyclerview/utils/findVisibleIndex.d.ts +24 -0
- package/dist/recyclerview/utils/findVisibleIndex.d.ts.map +1 -0
- package/dist/recyclerview/utils/findVisibleIndex.js +82 -0
- package/dist/recyclerview/utils/findVisibleIndex.js.map +1 -0
- package/dist/recyclerview/utils/measureLayout.d.ts +56 -0
- package/dist/recyclerview/utils/measureLayout.d.ts.map +1 -0
- package/dist/recyclerview/utils/measureLayout.js +77 -0
- package/dist/recyclerview/utils/measureLayout.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/AverageWindow.d.ts +13 -0
- package/dist/utils/AverageWindow.d.ts.map +1 -1
- package/dist/utils/AverageWindow.js +30 -1
- package/dist/utils/AverageWindow.js.map +1 -1
- package/package.json +1 -1
- package/src/FlashListProps.ts +73 -2
- package/src/__tests__/AverageWindow.test.ts +49 -1
- package/src/enableNewCore.ts +22 -0
- package/src/index.ts +21 -0
- package/src/recyclerview/RecycleKeyManager.ts +185 -0
- package/src/recyclerview/RecyclerView.tsx +500 -0
- package/src/recyclerview/RecyclerViewContextProvider.ts +19 -0
- package/src/recyclerview/RecyclerViewManager.ts +379 -0
- package/src/recyclerview/RecyclerViewProps.ts +10 -0
- package/src/recyclerview/ViewHolder.tsx +173 -0
- package/src/recyclerview/ViewHolderCollection.tsx +164 -0
- package/src/recyclerview/components/CompatScroller.ts +9 -0
- package/src/recyclerview/components/CompatView.ts +9 -0
- package/src/recyclerview/components/ScrollAnchor.tsx +53 -0
- package/src/recyclerview/components/StickyHeaders.tsx +210 -0
- package/src/recyclerview/helpers/ConsecutiveNumbers.ts +120 -0
- package/src/recyclerview/helpers/EngagedIndicesTracker.ts +191 -0
- package/src/recyclerview/hooks/useBoundDetection.ts +127 -0
- package/src/recyclerview/hooks/useLayoutState.ts +46 -0
- package/src/recyclerview/hooks/useOnLoad.ts +78 -0
- package/src/recyclerview/hooks/useRecyclerViewController.tsx +487 -0
- package/src/recyclerview/hooks/useRecyclerViewManager.ts +30 -0
- package/src/recyclerview/hooks/useRecyclingState.ts +63 -0
- package/src/recyclerview/hooks/useSecondaryProps.tsx +119 -0
- package/src/recyclerview/hooks/useUnmountFlag.ts +26 -0
- package/src/recyclerview/layout-managers/GridLayoutManager.ts +215 -0
- package/src/recyclerview/layout-managers/LayoutManager.ts +493 -0
- package/src/recyclerview/layout-managers/LinearLayoutManager.ts +167 -0
- package/src/recyclerview/layout-managers/MasonryLayoutManager.ts +302 -0
- package/src/recyclerview/utils/adjustOffsetForRTL.ts +17 -0
- package/src/recyclerview/utils/componentUtils.ts +28 -0
- package/src/recyclerview/utils/findVisibleIndex.ts +94 -0
- package/src/recyclerview/utils/measureLayout.ts +89 -0
- package/src/utils/AverageWindow.ts +33 -0
- package/src/viewability/ViewToken.ts +1 -1
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Interface of layout manager for app's listviews
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.RVLayoutManager = void 0;
|
|
5
|
+
var tslib_1 = require("tslib");
|
|
6
|
+
var AverageWindow_1 = require("../../utils/AverageWindow");
|
|
7
|
+
var ConsecutiveNumbers_1 = require("../helpers/ConsecutiveNumbers");
|
|
8
|
+
var findVisibleIndex_1 = require("../utils/findVisibleIndex");
|
|
9
|
+
var measureLayout_1 = require("../utils/measureLayout");
|
|
10
|
+
/**
|
|
11
|
+
* Base abstract class for layout managers in the recycler view system.
|
|
12
|
+
* Provides common functionality for managing item layouts and dimensions.
|
|
13
|
+
* Supports both horizontal and vertical layouts with dynamic item sizing.
|
|
14
|
+
*/
|
|
15
|
+
var RVLayoutManager = /** @class */ (function () {
|
|
16
|
+
function RVLayoutManager(params, previousLayoutManager) {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
/** Information about item spans and sizes */
|
|
19
|
+
this.spanSizeInfo = {};
|
|
20
|
+
/** Flag indicating if the layout requires repainting */
|
|
21
|
+
this.requiresRepaint = false;
|
|
22
|
+
/** Maximum number of items to process in a single layout pass */
|
|
23
|
+
this.maxItemsToProcess = 250; // TODO: make this dynamic
|
|
24
|
+
this.heightAverageWindow = new AverageWindow_1.MultiTypeAverageWindow(5, 200);
|
|
25
|
+
this.widthAverageWindow = new AverageWindow_1.MultiTypeAverageWindow(5, 200);
|
|
26
|
+
this._getItemType = params.getItemType;
|
|
27
|
+
this.overrideItemLayout = params.overrideItemLayout;
|
|
28
|
+
this.layouts = (_a = previousLayoutManager === null || previousLayoutManager === void 0 ? void 0 : previousLayoutManager.layouts) !== null && _a !== void 0 ? _a : [];
|
|
29
|
+
if (previousLayoutManager) {
|
|
30
|
+
this.updateLayoutParams(params);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
this.horizontal = Boolean(params.horizontal);
|
|
34
|
+
this.windowSize = params.windowSize;
|
|
35
|
+
this.maxColumns = (_b = params.maxColumns) !== null && _b !== void 0 ? _b : 1;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Gets the type of an item at the given index.
|
|
40
|
+
* @param index Index of the item
|
|
41
|
+
* @returns Item type or "default" if not specified
|
|
42
|
+
*/
|
|
43
|
+
RVLayoutManager.prototype.getItemType = function (index) {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
return (_b = (_a = this._getItemType) === null || _a === void 0 ? void 0 : _a.call(this, index)) !== null && _b !== void 0 ? _b : "default";
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Gets the estimated width for an item based on its type.
|
|
49
|
+
* @param index Index of the item
|
|
50
|
+
* @returns Estimated width
|
|
51
|
+
*/
|
|
52
|
+
RVLayoutManager.prototype.getEstimatedWidth = function (index) {
|
|
53
|
+
return this.widthAverageWindow.getCurrentValue(this.getItemType(index));
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Gets the estimated height for an item based on its type.
|
|
57
|
+
* @param index Index of the item
|
|
58
|
+
* @returns Estimated height
|
|
59
|
+
*/
|
|
60
|
+
RVLayoutManager.prototype.getEstimatedHeight = function (index) {
|
|
61
|
+
return this.heightAverageWindow.getCurrentValue(this.getItemType(index));
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Checks if the layout is horizontal.
|
|
65
|
+
* @returns True if horizontal, false if vertical
|
|
66
|
+
*/
|
|
67
|
+
RVLayoutManager.prototype.isHorizontal = function () {
|
|
68
|
+
return this.horizontal;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Gets the dimensions of the visible window.
|
|
72
|
+
* @returns Window dimensions
|
|
73
|
+
*/
|
|
74
|
+
RVLayoutManager.prototype.getWindowsSize = function () {
|
|
75
|
+
return this.windowSize;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Gets indices of items currently visible in the viewport.
|
|
79
|
+
* Uses binary search for efficient lookup.
|
|
80
|
+
* @param unboundDimensionStart Start position of viewport
|
|
81
|
+
* @param unboundDimensionEnd End position of viewport
|
|
82
|
+
* @returns ConsecutiveNumbers containing visible indices
|
|
83
|
+
*/
|
|
84
|
+
RVLayoutManager.prototype.getVisibleLayouts = function (unboundDimensionStart, unboundDimensionEnd) {
|
|
85
|
+
// Find the first visible index
|
|
86
|
+
var firstVisibleIndex = (0, findVisibleIndex_1.findFirstVisibleIndex)(this.layouts, unboundDimensionStart, this.horizontal);
|
|
87
|
+
// Find the last visible index
|
|
88
|
+
var lastVisibleIndex = (0, findVisibleIndex_1.findLastVisibleIndex)(this.layouts, unboundDimensionEnd, this.horizontal);
|
|
89
|
+
// Collect the indices in the range
|
|
90
|
+
if (firstVisibleIndex !== -1 && lastVisibleIndex !== -1) {
|
|
91
|
+
return new ConsecutiveNumbers_1.ConsecutiveNumbers(firstVisibleIndex, lastVisibleIndex);
|
|
92
|
+
}
|
|
93
|
+
return ConsecutiveNumbers_1.ConsecutiveNumbers.EMPTY;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Removes layout information for specified indices and recomputes layout.
|
|
97
|
+
* @param indices Array of indices to remove
|
|
98
|
+
*/
|
|
99
|
+
RVLayoutManager.prototype.deleteLayout = function (indices) {
|
|
100
|
+
var e_1, _a;
|
|
101
|
+
// Sort indices in descending order
|
|
102
|
+
indices.sort(function (num1, num2) { return num2 - num1; });
|
|
103
|
+
try {
|
|
104
|
+
// Remove elements from the array
|
|
105
|
+
for (var indices_1 = tslib_1.__values(indices), indices_1_1 = indices_1.next(); !indices_1_1.done; indices_1_1 = indices_1.next()) {
|
|
106
|
+
var index = indices_1_1.value;
|
|
107
|
+
this.layouts.splice(index, 1);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
111
|
+
finally {
|
|
112
|
+
try {
|
|
113
|
+
if (indices_1_1 && !indices_1_1.done && (_a = indices_1.return)) _a.call(indices_1);
|
|
114
|
+
}
|
|
115
|
+
finally { if (e_1) throw e_1.error; }
|
|
116
|
+
}
|
|
117
|
+
var startIndex = Math.min.apply(Math, tslib_1.__spreadArray([], tslib_1.__read(indices), false));
|
|
118
|
+
// Recompute layouts starting from the smallest index in the original indices array
|
|
119
|
+
this.recomputeLayouts(this.getMinRecomputeIndex(startIndex), this.getMaxRecomputeIndex(startIndex));
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Updates layout information for items and recomputes layout if necessary.
|
|
123
|
+
* @param layoutInfo Array of layout information for items (real measurements)
|
|
124
|
+
* @param totalItemCount Total number of items in the list
|
|
125
|
+
*/
|
|
126
|
+
RVLayoutManager.prototype.modifyLayout = function (layoutInfo, totalItemCount) {
|
|
127
|
+
var _a;
|
|
128
|
+
var minRecomputeIndex = Number.MAX_VALUE;
|
|
129
|
+
if (this.layouts.length > totalItemCount) {
|
|
130
|
+
this.layouts.length = totalItemCount;
|
|
131
|
+
minRecomputeIndex = totalItemCount - 1; // <0 gets skipped so it's safe to set to totalItemCount - 1
|
|
132
|
+
}
|
|
133
|
+
// update average windows
|
|
134
|
+
minRecomputeIndex = Math.min(minRecomputeIndex, this.computeEstimatesAndMinRecomputeIndex(layoutInfo));
|
|
135
|
+
if (this.layouts.length < totalItemCount && totalItemCount > 0) {
|
|
136
|
+
var startIndex = this.layouts.length;
|
|
137
|
+
this.layouts.length = totalItemCount;
|
|
138
|
+
for (var i = startIndex; i < totalItemCount; i++) {
|
|
139
|
+
this.getLayout(i);
|
|
140
|
+
}
|
|
141
|
+
this.recomputeLayouts(startIndex, totalItemCount - 1);
|
|
142
|
+
}
|
|
143
|
+
minRecomputeIndex = Math.min(minRecomputeIndex, (_a = this.processLayoutInfo(layoutInfo, totalItemCount)) !== null && _a !== void 0 ? _a : minRecomputeIndex);
|
|
144
|
+
// compute minRecomputeIndex
|
|
145
|
+
minRecomputeIndex = Math.min(minRecomputeIndex, this.computeEstimatesAndMinRecomputeIndex(layoutInfo));
|
|
146
|
+
if (minRecomputeIndex >= 0 && minRecomputeIndex < totalItemCount) {
|
|
147
|
+
this.recomputeLayouts(this.getMinRecomputeIndex(minRecomputeIndex), this.getMaxRecomputeIndex(minRecomputeIndex));
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Gets layout information for an item at the given index.
|
|
152
|
+
* Creates and initializes a new layout if one doesn't exist.
|
|
153
|
+
* @param index Index of the item
|
|
154
|
+
* @returns Layout information for the item
|
|
155
|
+
*/
|
|
156
|
+
RVLayoutManager.prototype.getLayout = function (index) {
|
|
157
|
+
if (index >= this.layouts.length) {
|
|
158
|
+
throw new Error("index out of bounds, not enough layouts");
|
|
159
|
+
}
|
|
160
|
+
var layout = this.layouts[index];
|
|
161
|
+
if (!layout) {
|
|
162
|
+
// Create new layout with estimated dimensions
|
|
163
|
+
layout = {
|
|
164
|
+
x: 0,
|
|
165
|
+
y: 0,
|
|
166
|
+
width: 0,
|
|
167
|
+
height: 0,
|
|
168
|
+
};
|
|
169
|
+
this.layouts[index] = layout;
|
|
170
|
+
}
|
|
171
|
+
if (!layout.isWidthMeasured || !layout.isHeightMeasured) {
|
|
172
|
+
this.estimateLayout(index);
|
|
173
|
+
}
|
|
174
|
+
return layout;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Updates layout parameters and triggers recomputation if necessary.
|
|
178
|
+
* @param params New layout parameters
|
|
179
|
+
*/
|
|
180
|
+
RVLayoutManager.prototype.updateLayoutParams = function (params) {
|
|
181
|
+
var _a, _b, _c;
|
|
182
|
+
this.windowSize = params.windowSize;
|
|
183
|
+
this.horizontal = (_a = params.horizontal) !== null && _a !== void 0 ? _a : this.horizontal;
|
|
184
|
+
this.maxColumns = (_b = params.maxColumns) !== null && _b !== void 0 ? _b : this.maxColumns;
|
|
185
|
+
this.optimizeItemArrangement =
|
|
186
|
+
(_c = params.optimizeItemArrangement) !== null && _c !== void 0 ? _c : this.optimizeItemArrangement;
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* Gets span size information for an item, applying any overrides.
|
|
190
|
+
* @param index Index of the item
|
|
191
|
+
* @returns SpanSizeInfo for the item
|
|
192
|
+
*/
|
|
193
|
+
RVLayoutManager.prototype.getSpanSizeInfo = function (index) {
|
|
194
|
+
var _a;
|
|
195
|
+
this.spanSizeInfo.span = undefined;
|
|
196
|
+
(_a = this.overrideItemLayout) === null || _a === void 0 ? void 0 : _a.call(this, index, this.spanSizeInfo);
|
|
197
|
+
return this.spanSizeInfo;
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* Gets the maximum index to process in a single layout pass.
|
|
201
|
+
* @param startIndex Starting index
|
|
202
|
+
* @returns Maximum index to process
|
|
203
|
+
*/
|
|
204
|
+
RVLayoutManager.prototype.getMaxRecomputeIndex = function (startIndex) {
|
|
205
|
+
return Math.min(startIndex + this.maxItemsToProcess, this.layouts.length - 1);
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* Gets the minimum index to process in a single layout pass.
|
|
209
|
+
* @param startIndex Starting index
|
|
210
|
+
* @returns Minimum index to process
|
|
211
|
+
*/
|
|
212
|
+
RVLayoutManager.prototype.getMinRecomputeIndex = function (startIndex) {
|
|
213
|
+
return startIndex;
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Computes size estimates and finds the minimum recompute index.
|
|
217
|
+
* @param layoutInfo Array of layout information for items
|
|
218
|
+
* @returns Minimum index that needs recomputation
|
|
219
|
+
*/
|
|
220
|
+
RVLayoutManager.prototype.computeEstimatesAndMinRecomputeIndex = function (layoutInfo) {
|
|
221
|
+
var e_2, _a;
|
|
222
|
+
var minRecomputeIndex = Number.MAX_VALUE;
|
|
223
|
+
try {
|
|
224
|
+
for (var layoutInfo_1 = tslib_1.__values(layoutInfo), layoutInfo_1_1 = layoutInfo_1.next(); !layoutInfo_1_1.done; layoutInfo_1_1 = layoutInfo_1.next()) {
|
|
225
|
+
var info = layoutInfo_1_1.value;
|
|
226
|
+
var index = info.index, dimensions = info.dimensions;
|
|
227
|
+
var storedLayout = this.layouts[index];
|
|
228
|
+
if (!storedLayout.isHeightMeasured ||
|
|
229
|
+
!storedLayout.isWidthMeasured ||
|
|
230
|
+
(0, measureLayout_1.areDimensionsNotEqual)(storedLayout.height, dimensions.height) ||
|
|
231
|
+
(0, measureLayout_1.areDimensionsNotEqual)(storedLayout.width, dimensions.width)) {
|
|
232
|
+
minRecomputeIndex = Math.min(minRecomputeIndex, index);
|
|
233
|
+
}
|
|
234
|
+
this.heightAverageWindow.addValue(dimensions.height, this.getItemType(index));
|
|
235
|
+
this.widthAverageWindow.addValue(dimensions.width, this.getItemType(index));
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
239
|
+
finally {
|
|
240
|
+
try {
|
|
241
|
+
if (layoutInfo_1_1 && !layoutInfo_1_1.done && (_a = layoutInfo_1.return)) _a.call(layoutInfo_1);
|
|
242
|
+
}
|
|
243
|
+
finally { if (e_2) throw e_2.error; }
|
|
244
|
+
}
|
|
245
|
+
return minRecomputeIndex;
|
|
246
|
+
};
|
|
247
|
+
return RVLayoutManager;
|
|
248
|
+
}());
|
|
249
|
+
exports.RVLayoutManager = RVLayoutManager;
|
|
250
|
+
//# sourceMappingURL=LayoutManager.js.map
|
|
@@ -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AAU,CAAC,MAAM,CAAC;oBAC7D,IAAA,qCAAqB,EAAC,YAAY,CAAC,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,EAC3D;oBACA,iBAAiB,GAAG,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;iBACxD;gBACD,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAC/B,UAAU,CAAC,MAAM,EACjB,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CACxB,CAAC;gBACF,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAC9B,UAAU,CAAC,KAAK,EAChB,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CACxB,CAAC;aACH;;;;;;;;;QACD,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IACH,sBAAC;AAAD,CAAC,AA1TD,IA0TC;AA1TqB,0CAAe"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { LayoutParams, RVDimension, RVLayoutInfo } from "./LayoutManager";
|
|
2
|
+
import { RVLayoutManager } from "./LayoutManager";
|
|
3
|
+
/**
|
|
4
|
+
* LinearLayoutManager implementation that arranges items in a single row or column.
|
|
5
|
+
* Supports both horizontal and vertical layouts with dynamic item sizing.
|
|
6
|
+
*/
|
|
7
|
+
export declare class RVLinearLayoutManagerImpl extends RVLayoutManager {
|
|
8
|
+
/** The bounded size (width for vertical, height for horizontal) */
|
|
9
|
+
private boundedSize;
|
|
10
|
+
/** Whether the bounded size has been set */
|
|
11
|
+
private hasSize;
|
|
12
|
+
/** Reference to the tallest item in the layout */
|
|
13
|
+
private tallestItem?;
|
|
14
|
+
/** Height of the tallest item */
|
|
15
|
+
private tallestItemHeight;
|
|
16
|
+
constructor(params: LayoutParams, previousLayoutManager?: RVLayoutManager);
|
|
17
|
+
/**
|
|
18
|
+
* Updates layout parameters and triggers recomputation if necessary.
|
|
19
|
+
* @param params New layout parameters
|
|
20
|
+
*/
|
|
21
|
+
updateLayoutParams(params: LayoutParams): void;
|
|
22
|
+
/**
|
|
23
|
+
* Processes layout information for items, updating their dimensions.
|
|
24
|
+
* For horizontal layouts, also normalizes heights of items.
|
|
25
|
+
* @param layoutInfo Array of layout information for items
|
|
26
|
+
* @param itemCount Total number of items in the list
|
|
27
|
+
*/
|
|
28
|
+
processLayoutInfo(layoutInfo: RVLayoutInfo[], itemCount: number): void;
|
|
29
|
+
/**
|
|
30
|
+
* Estimates layout dimensions for an item at the given index.
|
|
31
|
+
* @param index Index of the item to estimate layout for
|
|
32
|
+
*/
|
|
33
|
+
estimateLayout(index: number): void;
|
|
34
|
+
/**
|
|
35
|
+
* Returns the total size of the layout area.
|
|
36
|
+
* @returns RVDimension containing width and height of the layout
|
|
37
|
+
*/
|
|
38
|
+
getLayoutSize(): RVDimension;
|
|
39
|
+
/**
|
|
40
|
+
* Normalizes heights of items in horizontal layout to match the tallest item.
|
|
41
|
+
* @param layoutInfo Array of layout information for items
|
|
42
|
+
*/
|
|
43
|
+
private normalizeLayoutHeights;
|
|
44
|
+
/**
|
|
45
|
+
* Recomputes layouts for items in the given range.
|
|
46
|
+
* Positions items sequentially based on layout direction.
|
|
47
|
+
* @param startIndex Starting index of items to recompute
|
|
48
|
+
* @param endIndex Ending index of items to recompute
|
|
49
|
+
*/
|
|
50
|
+
recomputeLayouts(startIndex: number, endIndex: number): void;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=LinearLayoutManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinearLayoutManager.d.ts","sourceRoot":"","sources":["../../../src/recyclerview/layout-managers/LinearLayoutManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE1E,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD;;;GAGG;AACH,qBAAa,yBAA0B,SAAQ,eAAe;IAC5D,mEAAmE;IACnE,OAAO,CAAC,WAAW,CAAS;IAC5B,4CAA4C;IAC5C,OAAO,CAAC,OAAO,CAAkB;IAEjC,kDAAkD;IAClD,OAAO,CAAC,WAAW,CAAC,CAAW;IAC/B,iCAAiC;IACjC,OAAO,CAAC,iBAAiB,CAAa;gBAE1B,MAAM,EAAE,YAAY,EAAE,qBAAqB,CAAC,EAAE,eAAe;IAQzE;;;OAGG;IACH,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAmB9C;;;;;OAKG;IACH,iBAAiB,CAAC,UAAU,EAAE,YAAY,EAAE,EAAE,SAAS,EAAE,MAAM;IAgB/D;;;OAGG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM;IAU5B;;;OAGG;IACH,aAAa,IAAI,WAAW;IAa5B;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IA+B9B;;;;;OAKG;IACH,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;CAsB7D"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RVLinearLayoutManagerImpl = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var LayoutManager_1 = require("./LayoutManager");
|
|
6
|
+
/**
|
|
7
|
+
* LinearLayoutManager implementation that arranges items in a single row or column.
|
|
8
|
+
* Supports both horizontal and vertical layouts with dynamic item sizing.
|
|
9
|
+
*/
|
|
10
|
+
var RVLinearLayoutManagerImpl = /** @class */ (function (_super) {
|
|
11
|
+
tslib_1.__extends(RVLinearLayoutManagerImpl, _super);
|
|
12
|
+
function RVLinearLayoutManagerImpl(params, previousLayoutManager) {
|
|
13
|
+
var _this = _super.call(this, params, previousLayoutManager) || this;
|
|
14
|
+
/** Whether the bounded size has been set */
|
|
15
|
+
_this.hasSize = false;
|
|
16
|
+
/** Height of the tallest item */
|
|
17
|
+
_this.tallestItemHeight = 0;
|
|
18
|
+
_this.boundedSize = _this.horizontal
|
|
19
|
+
? params.windowSize.height
|
|
20
|
+
: params.windowSize.width;
|
|
21
|
+
_this.hasSize = _this.boundedSize > 0;
|
|
22
|
+
return _this;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Updates layout parameters and triggers recomputation if necessary.
|
|
26
|
+
* @param params New layout parameters
|
|
27
|
+
*/
|
|
28
|
+
RVLinearLayoutManagerImpl.prototype.updateLayoutParams = function (params) {
|
|
29
|
+
var prevHorizontal = this.horizontal;
|
|
30
|
+
_super.prototype.updateLayoutParams.call(this, params);
|
|
31
|
+
var oldBoundedSize = this.boundedSize;
|
|
32
|
+
this.boundedSize = this.horizontal
|
|
33
|
+
? params.windowSize.height
|
|
34
|
+
: params.windowSize.width;
|
|
35
|
+
if (oldBoundedSize !== this.boundedSize ||
|
|
36
|
+
prevHorizontal !== this.horizontal) {
|
|
37
|
+
if (this.layouts.length > 0) {
|
|
38
|
+
//console.log("-----> recomputeLayouts", this.horizontal);
|
|
39
|
+
this.recomputeLayouts(0, this.layouts.length - 1);
|
|
40
|
+
this.requiresRepaint = true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Processes layout information for items, updating their dimensions.
|
|
46
|
+
* For horizontal layouts, also normalizes heights of items.
|
|
47
|
+
* @param layoutInfo Array of layout information for items
|
|
48
|
+
* @param itemCount Total number of items in the list
|
|
49
|
+
*/
|
|
50
|
+
RVLinearLayoutManagerImpl.prototype.processLayoutInfo = function (layoutInfo, itemCount) {
|
|
51
|
+
var e_1, _a;
|
|
52
|
+
try {
|
|
53
|
+
// Update layout information
|
|
54
|
+
for (var layoutInfo_1 = tslib_1.__values(layoutInfo), layoutInfo_1_1 = layoutInfo_1.next(); !layoutInfo_1_1.done; layoutInfo_1_1 = layoutInfo_1.next()) {
|
|
55
|
+
var info = layoutInfo_1_1.value;
|
|
56
|
+
var index = info.index, dimensions = info.dimensions;
|
|
57
|
+
var layout = this.layouts[index];
|
|
58
|
+
layout.width = this.horizontal ? dimensions.width : this.boundedSize;
|
|
59
|
+
layout.isHeightMeasured = true;
|
|
60
|
+
layout.isWidthMeasured = true;
|
|
61
|
+
layout.height = dimensions.height;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
65
|
+
finally {
|
|
66
|
+
try {
|
|
67
|
+
if (layoutInfo_1_1 && !layoutInfo_1_1.done && (_a = layoutInfo_1.return)) _a.call(layoutInfo_1);
|
|
68
|
+
}
|
|
69
|
+
finally { if (e_1) throw e_1.error; }
|
|
70
|
+
}
|
|
71
|
+
if (this.horizontal && !this.hasSize) {
|
|
72
|
+
this.normalizeLayoutHeights(layoutInfo);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Estimates layout dimensions for an item at the given index.
|
|
77
|
+
* @param index Index of the item to estimate layout for
|
|
78
|
+
*/
|
|
79
|
+
RVLinearLayoutManagerImpl.prototype.estimateLayout = function (index) {
|
|
80
|
+
var layout = this.layouts[index];
|
|
81
|
+
layout.width = this.horizontal
|
|
82
|
+
? this.getEstimatedWidth(index)
|
|
83
|
+
: this.boundedSize;
|
|
84
|
+
layout.height = this.getEstimatedHeight(index);
|
|
85
|
+
layout.isWidthMeasured = !this.horizontal;
|
|
86
|
+
layout.enforcedWidth = !this.horizontal;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Returns the total size of the layout area.
|
|
90
|
+
* @returns RVDimension containing width and height of the layout
|
|
91
|
+
*/
|
|
92
|
+
RVLinearLayoutManagerImpl.prototype.getLayoutSize = function () {
|
|
93
|
+
var _a, _b;
|
|
94
|
+
if (this.layouts.length === 0)
|
|
95
|
+
return { width: 0, height: 0 };
|
|
96
|
+
var lastLayout = this.layouts[this.layouts.length - 1];
|
|
97
|
+
return {
|
|
98
|
+
width: this.horizontal
|
|
99
|
+
? lastLayout.x + lastLayout.width
|
|
100
|
+
: this.boundedSize,
|
|
101
|
+
height: this.horizontal
|
|
102
|
+
? (_b = (_a = this.tallestItem) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 0
|
|
103
|
+
: lastLayout.y + lastLayout.height,
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Normalizes heights of items in horizontal layout to match the tallest item.
|
|
108
|
+
* @param layoutInfo Array of layout information for items
|
|
109
|
+
*/
|
|
110
|
+
RVLinearLayoutManagerImpl.prototype.normalizeLayoutHeights = function (layoutInfo) {
|
|
111
|
+
var e_2, _a, e_3, _b;
|
|
112
|
+
var _c, _d;
|
|
113
|
+
var newTallestItem;
|
|
114
|
+
try {
|
|
115
|
+
for (var layoutInfo_2 = tslib_1.__values(layoutInfo), layoutInfo_2_1 = layoutInfo_2.next(); !layoutInfo_2_1.done; layoutInfo_2_1 = layoutInfo_2.next()) {
|
|
116
|
+
var info = layoutInfo_2_1.value;
|
|
117
|
+
var index = info.index;
|
|
118
|
+
var layout = this.layouts[index];
|
|
119
|
+
if (layout.height > ((_c = layout.minHeight) !== null && _c !== void 0 ? _c : 0) &&
|
|
120
|
+
layout.height > ((_d = newTallestItem === null || newTallestItem === void 0 ? void 0 : newTallestItem.height) !== null && _d !== void 0 ? _d : 0)) {
|
|
121
|
+
newTallestItem = layout;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
126
|
+
finally {
|
|
127
|
+
try {
|
|
128
|
+
if (layoutInfo_2_1 && !layoutInfo_2_1.done && (_a = layoutInfo_2.return)) _a.call(layoutInfo_2);
|
|
129
|
+
}
|
|
130
|
+
finally { if (e_2) throw e_2.error; }
|
|
131
|
+
}
|
|
132
|
+
if (newTallestItem && newTallestItem.height !== this.tallestItemHeight) {
|
|
133
|
+
var targetMinHeight = newTallestItem.height;
|
|
134
|
+
if (newTallestItem.height < this.tallestItemHeight) {
|
|
135
|
+
this.requiresRepaint = true;
|
|
136
|
+
targetMinHeight = 0;
|
|
137
|
+
}
|
|
138
|
+
try {
|
|
139
|
+
//set minHeight for all layouts
|
|
140
|
+
for (var _e = tslib_1.__values(this.layouts), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
141
|
+
var layout = _f.value;
|
|
142
|
+
if (targetMinHeight > 0) {
|
|
143
|
+
layout.height = newTallestItem.height;
|
|
144
|
+
}
|
|
145
|
+
layout.minHeight = targetMinHeight;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
149
|
+
finally {
|
|
150
|
+
try {
|
|
151
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
152
|
+
}
|
|
153
|
+
finally { if (e_3) throw e_3.error; }
|
|
154
|
+
}
|
|
155
|
+
newTallestItem.minHeight = 0;
|
|
156
|
+
this.tallestItem = newTallestItem;
|
|
157
|
+
this.tallestItemHeight = newTallestItem.height;
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* Recomputes layouts for items in the given range.
|
|
162
|
+
* Positions items sequentially based on layout direction.
|
|
163
|
+
* @param startIndex Starting index of items to recompute
|
|
164
|
+
* @param endIndex Ending index of items to recompute
|
|
165
|
+
*/
|
|
166
|
+
RVLinearLayoutManagerImpl.prototype.recomputeLayouts = function (startIndex, endIndex) {
|
|
167
|
+
for (var i = startIndex; i <= endIndex; i++) {
|
|
168
|
+
var layout = this.getLayout(i);
|
|
169
|
+
// Set positions based on whether this is the first item or not
|
|
170
|
+
if (i === 0) {
|
|
171
|
+
layout.x = 0;
|
|
172
|
+
layout.y = 0;
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
var prevLayout = this.getLayout(i - 1);
|
|
176
|
+
layout.x = this.horizontal ? prevLayout.x + prevLayout.width : 0;
|
|
177
|
+
layout.y = this.horizontal ? 0 : prevLayout.y + prevLayout.height;
|
|
178
|
+
}
|
|
179
|
+
// Set width for vertical layouts
|
|
180
|
+
if (!this.horizontal) {
|
|
181
|
+
layout.width = this.boundedSize;
|
|
182
|
+
}
|
|
183
|
+
else if (this.hasSize) {
|
|
184
|
+
layout.minHeight = this.boundedSize;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
return RVLinearLayoutManagerImpl;
|
|
189
|
+
}(LayoutManager_1.RVLayoutManager));
|
|
190
|
+
exports.RVLinearLayoutManagerImpl = RVLinearLayoutManagerImpl;
|
|
191
|
+
//# sourceMappingURL=LinearLayoutManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinearLayoutManager.js","sourceRoot":"","sources":["../../../src/recyclerview/layout-managers/LinearLayoutManager.ts"],"names":[],"mappings":";;;;AAEA,iDAAkD;AAElD;;;GAGG;AACH;IAA+C,qDAAe;IAW5D,mCAAY,MAAoB,EAAE,qBAAuC;QAAzE,YACE,kBAAM,MAAM,EAAE,qBAAqB,CAAC,SAKrC;QAdD,4CAA4C;QACpC,aAAO,GAAY,KAAK,CAAC;QAIjC,iCAAiC;QACzB,uBAAiB,GAAW,CAAC,CAAC;QAIpC,KAAI,CAAC,WAAW,GAAG,KAAI,CAAC,UAAU;YAChC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM;YAC1B,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC;QAC5B,KAAI,CAAC,OAAO,GAAG,KAAI,CAAC,WAAW,GAAG,CAAC,CAAC;;IACtC,CAAC;IAED;;;OAGG;IACH,sDAAkB,GAAlB,UAAmB,MAAoB;QACrC,IAAM,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC;QACvC,iBAAM,kBAAkB,YAAC,MAAM,CAAC,CAAC;QACjC,IAAM,cAAc,GAAG,IAAI,CAAC,WAAW,CAAC;QACxC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU;YAChC,CAAC,CAAC,MA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,CAAC,EAAE;gBACX,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;gBACb,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;aACd;iBAAM;gBACL,IAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;gBACzC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBACjE,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC;aACnE;YAED,iCAAiC;YACjC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;gBACpB,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC;aACjC;iBAAM,IAAI,IAAI,CAAC,OAAO,EAAE;gBACvB,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC;aACrC;SACF;IACH,CAAC;IACH,gCAAC;AAAD,CAAC,AA9JD,CAA+C,+BAAe,GA8J7D;AA9JY,8DAAyB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { LayoutParams, RVDimension, RVLayoutInfo, RVLayoutManager } from "./LayoutManager";
|
|
2
|
+
/**
|
|
3
|
+
* MasonryLayoutManager implementation that arranges items in a masonry/pinterest-style layout.
|
|
4
|
+
* Items are placed in columns, with support for items spanning multiple columns.
|
|
5
|
+
* Can optimize item placement to minimize column height differences.
|
|
6
|
+
*/
|
|
7
|
+
export declare class RVMasonryLayoutManagerImpl extends RVLayoutManager {
|
|
8
|
+
/** The width of the bounded area for the masonry layout */
|
|
9
|
+
private boundedSize;
|
|
10
|
+
/** Array tracking the current height of each column */
|
|
11
|
+
private columnHeights;
|
|
12
|
+
/** Current column index for sequential placement */
|
|
13
|
+
private currentColumn;
|
|
14
|
+
constructor(params: LayoutParams, previousLayoutManager?: RVLayoutManager);
|
|
15
|
+
/**
|
|
16
|
+
* Updates layout parameters and triggers recomputation if necessary.
|
|
17
|
+
* @param params New layout parameters
|
|
18
|
+
*/
|
|
19
|
+
updateLayoutParams(params: LayoutParams): void;
|
|
20
|
+
/**
|
|
21
|
+
* Processes layout information for items, updating their dimensions.
|
|
22
|
+
* @param layoutInfo Array of layout information for items (real measurements)
|
|
23
|
+
* @param itemCount Total number of items in the list
|
|
24
|
+
*/
|
|
25
|
+
processLayoutInfo(layoutInfo: RVLayoutInfo[], itemCount: number): void;
|
|
26
|
+
/**
|
|
27
|
+
* Estimates layout dimensions for an item at the given index.
|
|
28
|
+
* Can be called by base class if estimate is required.
|
|
29
|
+
* @param index Index of the item to estimate layout for
|
|
30
|
+
*/
|
|
31
|
+
estimateLayout(index: number): void;
|
|
32
|
+
/**
|
|
33
|
+
* Returns the total size of the layout area.
|
|
34
|
+
* @returns RVDimension containing width and height of the layout
|
|
35
|
+
*/
|
|
36
|
+
getLayoutSize(): RVDimension;
|
|
37
|
+
/**
|
|
38
|
+
* Recomputes layouts for items in the given range.
|
|
39
|
+
* Uses different placement strategies based on optimization settings.
|
|
40
|
+
* @param startIndex Starting index of items to recompute
|
|
41
|
+
* @param endIndex Ending index of items to recompute
|
|
42
|
+
*/
|
|
43
|
+
recomputeLayouts(startIndex: number, endIndex: number): void;
|
|
44
|
+
/**
|
|
45
|
+
* Calculates the width of an item based on its span.
|
|
46
|
+
* @param index Index of the item
|
|
47
|
+
* @returns Width of the item
|
|
48
|
+
*/
|
|
49
|
+
private getWidth;
|
|
50
|
+
/**
|
|
51
|
+
* Places an item sequentially in the next available position.
|
|
52
|
+
* @param layout Layout information for the item
|
|
53
|
+
* @param span Number of columns the item spans
|
|
54
|
+
*/
|
|
55
|
+
private placeItemSequentially;
|
|
56
|
+
/**
|
|
57
|
+
* Places a single-column item in the shortest available column.
|
|
58
|
+
* @param layout Layout information for the item
|
|
59
|
+
*/
|
|
60
|
+
private placeSingleColumnItem;
|
|
61
|
+
/**
|
|
62
|
+
* Places a multi-column item in the position that minimizes total column heights.
|
|
63
|
+
* @param layout Layout information for the item
|
|
64
|
+
* @param span Number of columns the item spans
|
|
65
|
+
*/
|
|
66
|
+
private placeOptimizedMultiColumnItem;
|
|
67
|
+
/**
|
|
68
|
+
* Updates column heights up to a given index by recalculating item positions.
|
|
69
|
+
* @param index Index to update column heights up to
|
|
70
|
+
*/
|
|
71
|
+
private updateColumnHeightsToIndex;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=MasonryLayoutManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MasonryLayoutManager.d.ts","sourceRoot":"","sources":["../../../src/recyclerview/layout-managers/MasonryLayoutManager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EAEX,YAAY,EACZ,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB;;;;GAIG;AACH,qBAAa,0BAA2B,SAAQ,eAAe;IAC7D,2DAA2D;IAC3D,OAAO,CAAC,WAAW,CAAS;IAC5B,uDAAuD;IACvD,OAAO,CAAC,aAAa,CAAW;IAChC,oDAAoD;IACpD,OAAO,CAAC,aAAa,CAAa;gBAEtB,MAAM,EAAE,YAAY,EAAE,qBAAqB,CAAC,EAAE,eAAe;IAOzE;;;OAGG;IACH,kBAAkB,CAAC,MAAM,EAAE,YAAY;IAyBvC;;;;OAIG;IACH,iBAAiB,CAAC,UAAU,EAAE,YAAY,EAAE,EAAE,SAAS,EAAE,MAAM;IAY/D;;;;OAIG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM;IAW5B;;;OAGG;IACH,aAAa,IAAI,WAAW;IAY5B;;;;;OAKG;IACH,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAgC5D;;;;OAIG;IACH,OAAO,CAAC,QAAQ;IAKhB;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IAqC7B;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAoB7B;;;;OAIG;IACH,OAAO,CAAC,6BAA6B;IA0CrC;;;OAGG;IACH,OAAO,CAAC,0BAA0B;CA8BnC"}
|