@legendapp/list 3.3.6 → 3.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/react-native.js +32 -23
- package/react-native.mjs +32 -23
- package/react-native.web.js +32 -23
- package/react-native.web.mjs +32 -23
- package/react.js +32 -23
- package/react.mjs +32 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## 3.3.7
|
|
2
|
+
|
|
3
|
+
- Fix: Recycled rows no longer briefly show content from the wrong item when data is prepended.
|
|
4
|
+
|
|
1
5
|
## 3.3.6
|
|
2
6
|
|
|
3
7
|
- Fix: Animated `maintainScrollAtEnd` follows rapid and first-load content growth, including short `alignItemsAtEnd` lists, and stops when the user scrolls away.
|
package/package.json
CHANGED
package/react-native.js
CHANGED
|
@@ -401,6 +401,7 @@ var IsNewArchitecture = f !== void 0 && f != null;
|
|
|
401
401
|
// src/core/containerItemMetadata.ts
|
|
402
402
|
function createContainerItemMetadata(state, itemIndex, itemData, itemType) {
|
|
403
403
|
return {
|
|
404
|
+
data: state.props.data,
|
|
404
405
|
dataChangeEpoch: state.dataChangeEpoch,
|
|
405
406
|
getFixedItemSize: state.props.getFixedItemSize,
|
|
406
407
|
getItemType: state.props.getItemType,
|
|
@@ -409,25 +410,29 @@ function createContainerItemMetadata(state, itemIndex, itemData, itemType) {
|
|
|
409
410
|
itemType
|
|
410
411
|
};
|
|
411
412
|
}
|
|
412
|
-
function
|
|
413
|
-
var _a3
|
|
414
|
-
const {
|
|
413
|
+
function updateContainerItemMetadata(state, containerId, itemIndex, itemData, itemType) {
|
|
414
|
+
var _a3;
|
|
415
|
+
const { getItemType } = state.props;
|
|
415
416
|
const previousMetadata = state.containerItemMetadata.get(containerId);
|
|
416
|
-
let metadata;
|
|
417
417
|
if ((previousMetadata == null ? void 0 : previousMetadata.dataChangeEpoch) === state.dataChangeEpoch && previousMetadata.getItemType === getItemType && previousMetadata.itemData === itemData && previousMetadata.itemIndex === itemIndex) {
|
|
418
|
-
|
|
419
|
-
} else {
|
|
420
|
-
const itemType = getItemType ? (_a3 = getItemType(itemData, itemIndex)) != null ? _a3 : "" : void 0;
|
|
421
|
-
metadata = createContainerItemMetadata(state, itemIndex, itemData, itemType);
|
|
422
|
-
state.containerItemMetadata.set(containerId, metadata);
|
|
418
|
+
return previousMetadata;
|
|
423
419
|
}
|
|
420
|
+
const resolvedItemType = getItemType ? (_a3 = getItemType(itemData, itemIndex)) != null ? _a3 : "" : void 0;
|
|
421
|
+
const metadata = createContainerItemMetadata(state, itemIndex, itemData, resolvedItemType);
|
|
422
|
+
state.containerItemMetadata.set(containerId, metadata);
|
|
423
|
+
return metadata;
|
|
424
|
+
}
|
|
425
|
+
function resolveContainerItemMetadata(state, containerId, itemIndex, itemData) {
|
|
426
|
+
var _a3;
|
|
427
|
+
const { getFixedItemSize } = state.props;
|
|
428
|
+
const metadata = updateContainerItemMetadata(state, containerId, itemIndex, itemData);
|
|
424
429
|
if (metadata.getFixedItemSize !== getFixedItemSize) {
|
|
425
430
|
metadata.didResolveFixedItemSize = false;
|
|
426
431
|
metadata.fixedItemSize = void 0;
|
|
427
432
|
metadata.getFixedItemSize = getFixedItemSize;
|
|
428
433
|
}
|
|
429
434
|
if (getFixedItemSize && !metadata.didResolveFixedItemSize) {
|
|
430
|
-
metadata.fixedItemSize = getFixedItemSize(itemData, itemIndex, (
|
|
435
|
+
metadata.fixedItemSize = getFixedItemSize(itemData, itemIndex, (_a3 = metadata.itemType) != null ? _a3 : "");
|
|
431
436
|
metadata.didResolveFixedItemSize = true;
|
|
432
437
|
}
|
|
433
438
|
return metadata;
|
|
@@ -3294,6 +3299,7 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
|
|
|
3294
3299
|
return { didChangePosition: false, didRefreshData: false };
|
|
3295
3300
|
}
|
|
3296
3301
|
const itemKey = (_a3 = state.idCache[itemIndex]) != null ? _a3 : getId(state, itemIndex);
|
|
3302
|
+
const metadata = updateContainerItemMetadata(state, containerIndex, itemIndex, item);
|
|
3297
3303
|
const updateLayout = (_b = options == null ? void 0 : options.updateLayout) != null ? _b : true;
|
|
3298
3304
|
let didChangePosition = false;
|
|
3299
3305
|
let didRefreshData = false;
|
|
@@ -3304,7 +3310,7 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
|
|
|
3304
3310
|
return { didChangePosition: false, didRefreshData: false };
|
|
3305
3311
|
}
|
|
3306
3312
|
const logicalPosition = (positionValue || 0) - ((_c = options == null ? void 0 : options.scrollAdjustPending) != null ? _c : 0);
|
|
3307
|
-
const itemSize = (_d = state.sizes.get(itemKey)) != null ? _d : getItemSize(ctx, itemKey, itemIndex, item);
|
|
3313
|
+
const itemSize = (_d = state.sizes.get(itemKey)) != null ? _d : getItemSize(ctx, itemKey, itemIndex, item, void 0, void 0, void 0, metadata);
|
|
3308
3314
|
const position = toPhysicalHorizontalItemPosition(state, logicalPosition, itemSize, peek$(ctx, "totalSize"));
|
|
3309
3315
|
const column = columns[itemIndex] || 1;
|
|
3310
3316
|
const span = columnSpans[itemIndex] || 1;
|
|
@@ -4595,13 +4601,13 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4595
4601
|
changedContainerIds.add(containerIndex);
|
|
4596
4602
|
state.containerItemGenerations[containerIndex] = ((_p = state.containerItemGenerations[containerIndex]) != null ? _p : 0) + 1;
|
|
4597
4603
|
}
|
|
4598
|
-
set$(ctx, `containerItemKey${containerIndex}`, id);
|
|
4599
|
-
set$(ctx, `containerItemIndex${containerIndex}`, i);
|
|
4600
|
-
set$(ctx, `containerItemData${containerIndex}`, data[i]);
|
|
4601
4604
|
state.containerItemMetadata.set(
|
|
4602
4605
|
containerIndex,
|
|
4603
4606
|
createContainerItemMetadata(state, i, data[i], allocation.itemType)
|
|
4604
4607
|
);
|
|
4608
|
+
set$(ctx, `containerItemKey${containerIndex}`, id);
|
|
4609
|
+
set$(ctx, `containerItemIndex${containerIndex}`, i);
|
|
4610
|
+
set$(ctx, `containerItemData${containerIndex}`, data[i]);
|
|
4605
4611
|
containerItemKeys.set(id, containerIndex);
|
|
4606
4612
|
(_q = state.userScrollAnchorReset) == null ? void 0 : _q.keys.add(id);
|
|
4607
4613
|
const containerSticky = `containerSticky${containerIndex}`;
|
|
@@ -5744,7 +5750,7 @@ var Container = typedMemo(function Container2({
|
|
|
5744
5750
|
]
|
|
5745
5751
|
);
|
|
5746
5752
|
const renderedItemInfo = React2.useMemo(
|
|
5747
|
-
() => itemKey !== void 0 ? getRenderedItem2(itemKey) : null,
|
|
5753
|
+
() => itemKey !== void 0 ? getRenderedItem2(itemKey, id) : null,
|
|
5748
5754
|
[itemKey, data, extraData]
|
|
5749
5755
|
);
|
|
5750
5756
|
const { renderedItem } = renderedItemInfo || {};
|
|
@@ -6995,34 +7001,37 @@ function getAlwaysRenderIndices(config, data, keyExtractor, anchoredEndSpaceAnch
|
|
|
6995
7001
|
}
|
|
6996
7002
|
|
|
6997
7003
|
// src/utils/getRenderedItem.ts
|
|
6998
|
-
function getRenderedItem(ctx, key) {
|
|
6999
|
-
var _a3;
|
|
7004
|
+
function getRenderedItem(ctx, key, containerId) {
|
|
7005
|
+
var _a3, _b, _c;
|
|
7000
7006
|
const state = ctx.state;
|
|
7001
7007
|
if (!state) {
|
|
7002
7008
|
return null;
|
|
7003
7009
|
}
|
|
7010
|
+
const metadata = state.containerItemMetadata.get(containerId);
|
|
7011
|
+
const useAssignedGeneration = metadata && metadata.dataChangeEpoch !== state.dataChangeEpoch;
|
|
7004
7012
|
const {
|
|
7005
7013
|
indexByKey,
|
|
7006
|
-
props: { data, getItemType, renderItem }
|
|
7014
|
+
props: { data: currentData, getItemType, renderItem }
|
|
7007
7015
|
} = state;
|
|
7008
|
-
const
|
|
7016
|
+
const data = useAssignedGeneration ? metadata.data : currentData;
|
|
7017
|
+
const index = (_a3 = metadata == null ? void 0 : metadata.itemIndex) != null ? _a3 : indexByKey.get(key);
|
|
7009
7018
|
if (index === void 0) {
|
|
7010
7019
|
return null;
|
|
7011
7020
|
}
|
|
7012
7021
|
let renderedItem = null;
|
|
7013
7022
|
const extraData = peek$(ctx, "extraData");
|
|
7014
|
-
const item = data[index];
|
|
7023
|
+
const item = useAssignedGeneration ? metadata.itemData : data[index];
|
|
7015
7024
|
if (renderItem && !isNullOrUndefined(item)) {
|
|
7016
7025
|
const itemProps = {
|
|
7017
7026
|
data,
|
|
7018
7027
|
extraData,
|
|
7019
7028
|
index,
|
|
7020
7029
|
item,
|
|
7021
|
-
type: getItemType ? (
|
|
7030
|
+
type: useAssignedGeneration ? (_b = metadata.itemType) != null ? _b : "" : getItemType ? (_c = getItemType(item, index)) != null ? _c : "" : ""
|
|
7022
7031
|
};
|
|
7023
7032
|
renderedItem = renderItem(itemProps);
|
|
7024
7033
|
}
|
|
7025
|
-
return { index, item
|
|
7034
|
+
return { index, item, renderedItem };
|
|
7026
7035
|
}
|
|
7027
7036
|
|
|
7028
7037
|
// src/utils/normalizeMaintainScrollAtEnd.ts
|
|
@@ -7746,7 +7755,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
7746
7755
|
}, [ctx, usesBootstrapInitialScroll]);
|
|
7747
7756
|
const fns = React2.useMemo(
|
|
7748
7757
|
() => ({
|
|
7749
|
-
getRenderedItem: (key) => getRenderedItem(ctx, key),
|
|
7758
|
+
getRenderedItem: (key, containerId) => getRenderedItem(ctx, key, containerId),
|
|
7750
7759
|
onMomentumScrollEnd: (event) => {
|
|
7751
7760
|
checkFinishedScrollFallback(ctx);
|
|
7752
7761
|
if (state.props.onMomentumScrollEnd) {
|
package/react-native.mjs
CHANGED
|
@@ -380,6 +380,7 @@ var IsNewArchitecture = f !== void 0 && f != null;
|
|
|
380
380
|
// src/core/containerItemMetadata.ts
|
|
381
381
|
function createContainerItemMetadata(state, itemIndex, itemData, itemType) {
|
|
382
382
|
return {
|
|
383
|
+
data: state.props.data,
|
|
383
384
|
dataChangeEpoch: state.dataChangeEpoch,
|
|
384
385
|
getFixedItemSize: state.props.getFixedItemSize,
|
|
385
386
|
getItemType: state.props.getItemType,
|
|
@@ -388,25 +389,29 @@ function createContainerItemMetadata(state, itemIndex, itemData, itemType) {
|
|
|
388
389
|
itemType
|
|
389
390
|
};
|
|
390
391
|
}
|
|
391
|
-
function
|
|
392
|
-
var _a3
|
|
393
|
-
const {
|
|
392
|
+
function updateContainerItemMetadata(state, containerId, itemIndex, itemData, itemType) {
|
|
393
|
+
var _a3;
|
|
394
|
+
const { getItemType } = state.props;
|
|
394
395
|
const previousMetadata = state.containerItemMetadata.get(containerId);
|
|
395
|
-
let metadata;
|
|
396
396
|
if ((previousMetadata == null ? void 0 : previousMetadata.dataChangeEpoch) === state.dataChangeEpoch && previousMetadata.getItemType === getItemType && previousMetadata.itemData === itemData && previousMetadata.itemIndex === itemIndex) {
|
|
397
|
-
|
|
398
|
-
} else {
|
|
399
|
-
const itemType = getItemType ? (_a3 = getItemType(itemData, itemIndex)) != null ? _a3 : "" : void 0;
|
|
400
|
-
metadata = createContainerItemMetadata(state, itemIndex, itemData, itemType);
|
|
401
|
-
state.containerItemMetadata.set(containerId, metadata);
|
|
397
|
+
return previousMetadata;
|
|
402
398
|
}
|
|
399
|
+
const resolvedItemType = getItemType ? (_a3 = getItemType(itemData, itemIndex)) != null ? _a3 : "" : void 0;
|
|
400
|
+
const metadata = createContainerItemMetadata(state, itemIndex, itemData, resolvedItemType);
|
|
401
|
+
state.containerItemMetadata.set(containerId, metadata);
|
|
402
|
+
return metadata;
|
|
403
|
+
}
|
|
404
|
+
function resolveContainerItemMetadata(state, containerId, itemIndex, itemData) {
|
|
405
|
+
var _a3;
|
|
406
|
+
const { getFixedItemSize } = state.props;
|
|
407
|
+
const metadata = updateContainerItemMetadata(state, containerId, itemIndex, itemData);
|
|
403
408
|
if (metadata.getFixedItemSize !== getFixedItemSize) {
|
|
404
409
|
metadata.didResolveFixedItemSize = false;
|
|
405
410
|
metadata.fixedItemSize = void 0;
|
|
406
411
|
metadata.getFixedItemSize = getFixedItemSize;
|
|
407
412
|
}
|
|
408
413
|
if (getFixedItemSize && !metadata.didResolveFixedItemSize) {
|
|
409
|
-
metadata.fixedItemSize = getFixedItemSize(itemData, itemIndex, (
|
|
414
|
+
metadata.fixedItemSize = getFixedItemSize(itemData, itemIndex, (_a3 = metadata.itemType) != null ? _a3 : "");
|
|
410
415
|
metadata.didResolveFixedItemSize = true;
|
|
411
416
|
}
|
|
412
417
|
return metadata;
|
|
@@ -3273,6 +3278,7 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
|
|
|
3273
3278
|
return { didChangePosition: false, didRefreshData: false };
|
|
3274
3279
|
}
|
|
3275
3280
|
const itemKey = (_a3 = state.idCache[itemIndex]) != null ? _a3 : getId(state, itemIndex);
|
|
3281
|
+
const metadata = updateContainerItemMetadata(state, containerIndex, itemIndex, item);
|
|
3276
3282
|
const updateLayout = (_b = options == null ? void 0 : options.updateLayout) != null ? _b : true;
|
|
3277
3283
|
let didChangePosition = false;
|
|
3278
3284
|
let didRefreshData = false;
|
|
@@ -3283,7 +3289,7 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
|
|
|
3283
3289
|
return { didChangePosition: false, didRefreshData: false };
|
|
3284
3290
|
}
|
|
3285
3291
|
const logicalPosition = (positionValue || 0) - ((_c = options == null ? void 0 : options.scrollAdjustPending) != null ? _c : 0);
|
|
3286
|
-
const itemSize = (_d = state.sizes.get(itemKey)) != null ? _d : getItemSize(ctx, itemKey, itemIndex, item);
|
|
3292
|
+
const itemSize = (_d = state.sizes.get(itemKey)) != null ? _d : getItemSize(ctx, itemKey, itemIndex, item, void 0, void 0, void 0, metadata);
|
|
3287
3293
|
const position = toPhysicalHorizontalItemPosition(state, logicalPosition, itemSize, peek$(ctx, "totalSize"));
|
|
3288
3294
|
const column = columns[itemIndex] || 1;
|
|
3289
3295
|
const span = columnSpans[itemIndex] || 1;
|
|
@@ -4574,13 +4580,13 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4574
4580
|
changedContainerIds.add(containerIndex);
|
|
4575
4581
|
state.containerItemGenerations[containerIndex] = ((_p = state.containerItemGenerations[containerIndex]) != null ? _p : 0) + 1;
|
|
4576
4582
|
}
|
|
4577
|
-
set$(ctx, `containerItemKey${containerIndex}`, id);
|
|
4578
|
-
set$(ctx, `containerItemIndex${containerIndex}`, i);
|
|
4579
|
-
set$(ctx, `containerItemData${containerIndex}`, data[i]);
|
|
4580
4583
|
state.containerItemMetadata.set(
|
|
4581
4584
|
containerIndex,
|
|
4582
4585
|
createContainerItemMetadata(state, i, data[i], allocation.itemType)
|
|
4583
4586
|
);
|
|
4587
|
+
set$(ctx, `containerItemKey${containerIndex}`, id);
|
|
4588
|
+
set$(ctx, `containerItemIndex${containerIndex}`, i);
|
|
4589
|
+
set$(ctx, `containerItemData${containerIndex}`, data[i]);
|
|
4584
4590
|
containerItemKeys.set(id, containerIndex);
|
|
4585
4591
|
(_q = state.userScrollAnchorReset) == null ? void 0 : _q.keys.add(id);
|
|
4586
4592
|
const containerSticky = `containerSticky${containerIndex}`;
|
|
@@ -5723,7 +5729,7 @@ var Container = typedMemo(function Container2({
|
|
|
5723
5729
|
]
|
|
5724
5730
|
);
|
|
5725
5731
|
const renderedItemInfo = useMemo(
|
|
5726
|
-
() => itemKey !== void 0 ? getRenderedItem2(itemKey) : null,
|
|
5732
|
+
() => itemKey !== void 0 ? getRenderedItem2(itemKey, id) : null,
|
|
5727
5733
|
[itemKey, data, extraData]
|
|
5728
5734
|
);
|
|
5729
5735
|
const { renderedItem } = renderedItemInfo || {};
|
|
@@ -6974,34 +6980,37 @@ function getAlwaysRenderIndices(config, data, keyExtractor, anchoredEndSpaceAnch
|
|
|
6974
6980
|
}
|
|
6975
6981
|
|
|
6976
6982
|
// src/utils/getRenderedItem.ts
|
|
6977
|
-
function getRenderedItem(ctx, key) {
|
|
6978
|
-
var _a3;
|
|
6983
|
+
function getRenderedItem(ctx, key, containerId) {
|
|
6984
|
+
var _a3, _b, _c;
|
|
6979
6985
|
const state = ctx.state;
|
|
6980
6986
|
if (!state) {
|
|
6981
6987
|
return null;
|
|
6982
6988
|
}
|
|
6989
|
+
const metadata = state.containerItemMetadata.get(containerId);
|
|
6990
|
+
const useAssignedGeneration = metadata && metadata.dataChangeEpoch !== state.dataChangeEpoch;
|
|
6983
6991
|
const {
|
|
6984
6992
|
indexByKey,
|
|
6985
|
-
props: { data, getItemType, renderItem }
|
|
6993
|
+
props: { data: currentData, getItemType, renderItem }
|
|
6986
6994
|
} = state;
|
|
6987
|
-
const
|
|
6995
|
+
const data = useAssignedGeneration ? metadata.data : currentData;
|
|
6996
|
+
const index = (_a3 = metadata == null ? void 0 : metadata.itemIndex) != null ? _a3 : indexByKey.get(key);
|
|
6988
6997
|
if (index === void 0) {
|
|
6989
6998
|
return null;
|
|
6990
6999
|
}
|
|
6991
7000
|
let renderedItem = null;
|
|
6992
7001
|
const extraData = peek$(ctx, "extraData");
|
|
6993
|
-
const item = data[index];
|
|
7002
|
+
const item = useAssignedGeneration ? metadata.itemData : data[index];
|
|
6994
7003
|
if (renderItem && !isNullOrUndefined(item)) {
|
|
6995
7004
|
const itemProps = {
|
|
6996
7005
|
data,
|
|
6997
7006
|
extraData,
|
|
6998
7007
|
index,
|
|
6999
7008
|
item,
|
|
7000
|
-
type: getItemType ? (
|
|
7009
|
+
type: useAssignedGeneration ? (_b = metadata.itemType) != null ? _b : "" : getItemType ? (_c = getItemType(item, index)) != null ? _c : "" : ""
|
|
7001
7010
|
};
|
|
7002
7011
|
renderedItem = renderItem(itemProps);
|
|
7003
7012
|
}
|
|
7004
|
-
return { index, item
|
|
7013
|
+
return { index, item, renderedItem };
|
|
7005
7014
|
}
|
|
7006
7015
|
|
|
7007
7016
|
// src/utils/normalizeMaintainScrollAtEnd.ts
|
|
@@ -7725,7 +7734,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
7725
7734
|
}, [ctx, usesBootstrapInitialScroll]);
|
|
7726
7735
|
const fns = useMemo(
|
|
7727
7736
|
() => ({
|
|
7728
|
-
getRenderedItem: (key) => getRenderedItem(ctx, key),
|
|
7737
|
+
getRenderedItem: (key, containerId) => getRenderedItem(ctx, key, containerId),
|
|
7729
7738
|
onMomentumScrollEnd: (event) => {
|
|
7730
7739
|
checkFinishedScrollFallback(ctx);
|
|
7731
7740
|
if (state.props.onMomentumScrollEnd) {
|
package/react-native.web.js
CHANGED
|
@@ -2952,6 +2952,7 @@ function abortBootstrapInitialScroll(ctx) {
|
|
|
2952
2952
|
// src/core/containerItemMetadata.ts
|
|
2953
2953
|
function createContainerItemMetadata(state, itemIndex, itemData, itemType) {
|
|
2954
2954
|
return {
|
|
2955
|
+
data: state.props.data,
|
|
2955
2956
|
dataChangeEpoch: state.dataChangeEpoch,
|
|
2956
2957
|
getFixedItemSize: state.props.getFixedItemSize,
|
|
2957
2958
|
getItemType: state.props.getItemType,
|
|
@@ -2960,25 +2961,29 @@ function createContainerItemMetadata(state, itemIndex, itemData, itemType) {
|
|
|
2960
2961
|
itemType
|
|
2961
2962
|
};
|
|
2962
2963
|
}
|
|
2963
|
-
function
|
|
2964
|
-
var _a3
|
|
2965
|
-
const {
|
|
2964
|
+
function updateContainerItemMetadata(state, containerId, itemIndex, itemData, itemType) {
|
|
2965
|
+
var _a3;
|
|
2966
|
+
const { getItemType } = state.props;
|
|
2966
2967
|
const previousMetadata = state.containerItemMetadata.get(containerId);
|
|
2967
|
-
let metadata;
|
|
2968
2968
|
if ((previousMetadata == null ? void 0 : previousMetadata.dataChangeEpoch) === state.dataChangeEpoch && previousMetadata.getItemType === getItemType && previousMetadata.itemData === itemData && previousMetadata.itemIndex === itemIndex) {
|
|
2969
|
-
|
|
2970
|
-
} else {
|
|
2971
|
-
const itemType = getItemType ? (_a3 = getItemType(itemData, itemIndex)) != null ? _a3 : "" : void 0;
|
|
2972
|
-
metadata = createContainerItemMetadata(state, itemIndex, itemData, itemType);
|
|
2973
|
-
state.containerItemMetadata.set(containerId, metadata);
|
|
2969
|
+
return previousMetadata;
|
|
2974
2970
|
}
|
|
2971
|
+
const resolvedItemType = getItemType ? (_a3 = getItemType(itemData, itemIndex)) != null ? _a3 : "" : void 0;
|
|
2972
|
+
const metadata = createContainerItemMetadata(state, itemIndex, itemData, resolvedItemType);
|
|
2973
|
+
state.containerItemMetadata.set(containerId, metadata);
|
|
2974
|
+
return metadata;
|
|
2975
|
+
}
|
|
2976
|
+
function resolveContainerItemMetadata(state, containerId, itemIndex, itemData) {
|
|
2977
|
+
var _a3;
|
|
2978
|
+
const { getFixedItemSize } = state.props;
|
|
2979
|
+
const metadata = updateContainerItemMetadata(state, containerId, itemIndex, itemData);
|
|
2975
2980
|
if (metadata.getFixedItemSize !== getFixedItemSize) {
|
|
2976
2981
|
metadata.didResolveFixedItemSize = false;
|
|
2977
2982
|
metadata.fixedItemSize = void 0;
|
|
2978
2983
|
metadata.getFixedItemSize = getFixedItemSize;
|
|
2979
2984
|
}
|
|
2980
2985
|
if (getFixedItemSize && !metadata.didResolveFixedItemSize) {
|
|
2981
|
-
metadata.fixedItemSize = getFixedItemSize(itemData, itemIndex, (
|
|
2986
|
+
metadata.fixedItemSize = getFixedItemSize(itemData, itemIndex, (_a3 = metadata.itemType) != null ? _a3 : "");
|
|
2982
2987
|
metadata.didResolveFixedItemSize = true;
|
|
2983
2988
|
}
|
|
2984
2989
|
return metadata;
|
|
@@ -3323,6 +3328,7 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
|
|
|
3323
3328
|
return { didChangePosition: false, didRefreshData: false };
|
|
3324
3329
|
}
|
|
3325
3330
|
const itemKey = (_a3 = state.idCache[itemIndex]) != null ? _a3 : getId(state, itemIndex);
|
|
3331
|
+
const metadata = updateContainerItemMetadata(state, containerIndex, itemIndex, item);
|
|
3326
3332
|
const updateLayout = (_b = options == null ? void 0 : options.updateLayout) != null ? _b : true;
|
|
3327
3333
|
let didChangePosition = false;
|
|
3328
3334
|
let didRefreshData = false;
|
|
@@ -3333,7 +3339,7 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
|
|
|
3333
3339
|
return { didChangePosition: false, didRefreshData: false };
|
|
3334
3340
|
}
|
|
3335
3341
|
const logicalPosition = (positionValue || 0) - ((_c = options == null ? void 0 : options.scrollAdjustPending) != null ? _c : 0);
|
|
3336
|
-
const itemSize = (_d = state.sizes.get(itemKey)) != null ? _d : getItemSize(ctx, itemKey, itemIndex, item);
|
|
3342
|
+
const itemSize = (_d = state.sizes.get(itemKey)) != null ? _d : getItemSize(ctx, itemKey, itemIndex, item, void 0, void 0, void 0, metadata);
|
|
3337
3343
|
const position = toPhysicalHorizontalItemPosition(state, logicalPosition, itemSize, peek$(ctx, "totalSize"));
|
|
3338
3344
|
const column = columns[itemIndex] || 1;
|
|
3339
3345
|
const span = columnSpans[itemIndex] || 1;
|
|
@@ -4624,13 +4630,13 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4624
4630
|
changedContainerIds.add(containerIndex);
|
|
4625
4631
|
state.containerItemGenerations[containerIndex] = ((_p = state.containerItemGenerations[containerIndex]) != null ? _p : 0) + 1;
|
|
4626
4632
|
}
|
|
4627
|
-
set$(ctx, `containerItemKey${containerIndex}`, id);
|
|
4628
|
-
set$(ctx, `containerItemIndex${containerIndex}`, i);
|
|
4629
|
-
set$(ctx, `containerItemData${containerIndex}`, data[i]);
|
|
4630
4633
|
state.containerItemMetadata.set(
|
|
4631
4634
|
containerIndex,
|
|
4632
4635
|
createContainerItemMetadata(state, i, data[i], allocation.itemType)
|
|
4633
4636
|
);
|
|
4637
|
+
set$(ctx, `containerItemKey${containerIndex}`, id);
|
|
4638
|
+
set$(ctx, `containerItemIndex${containerIndex}`, i);
|
|
4639
|
+
set$(ctx, `containerItemData${containerIndex}`, data[i]);
|
|
4634
4640
|
containerItemKeys.set(id, containerIndex);
|
|
4635
4641
|
(_q = state.userScrollAnchorReset) == null ? void 0 : _q.keys.add(id);
|
|
4636
4642
|
const containerSticky = `containerSticky${containerIndex}`;
|
|
@@ -5693,7 +5699,7 @@ var Container = typedMemo(function Container2({
|
|
|
5693
5699
|
]
|
|
5694
5700
|
);
|
|
5695
5701
|
const renderedItemInfo = React3.useMemo(
|
|
5696
|
-
() => itemKey !== void 0 ? getRenderedItem2(itemKey) : null,
|
|
5702
|
+
() => itemKey !== void 0 ? getRenderedItem2(itemKey, id) : null,
|
|
5697
5703
|
[itemKey, data, extraData]
|
|
5698
5704
|
);
|
|
5699
5705
|
const { renderedItem } = renderedItemInfo || {};
|
|
@@ -7638,34 +7644,37 @@ function getAlwaysRenderIndices(config, data, keyExtractor, anchoredEndSpaceAnch
|
|
|
7638
7644
|
}
|
|
7639
7645
|
|
|
7640
7646
|
// src/utils/getRenderedItem.ts
|
|
7641
|
-
function getRenderedItem(ctx, key) {
|
|
7642
|
-
var _a3;
|
|
7647
|
+
function getRenderedItem(ctx, key, containerId) {
|
|
7648
|
+
var _a3, _b, _c;
|
|
7643
7649
|
const state = ctx.state;
|
|
7644
7650
|
if (!state) {
|
|
7645
7651
|
return null;
|
|
7646
7652
|
}
|
|
7653
|
+
const metadata = state.containerItemMetadata.get(containerId);
|
|
7654
|
+
const useAssignedGeneration = metadata && metadata.dataChangeEpoch !== state.dataChangeEpoch;
|
|
7647
7655
|
const {
|
|
7648
7656
|
indexByKey,
|
|
7649
|
-
props: { data, getItemType, renderItem }
|
|
7657
|
+
props: { data: currentData, getItemType, renderItem }
|
|
7650
7658
|
} = state;
|
|
7651
|
-
const
|
|
7659
|
+
const data = useAssignedGeneration ? metadata.data : currentData;
|
|
7660
|
+
const index = (_a3 = metadata == null ? void 0 : metadata.itemIndex) != null ? _a3 : indexByKey.get(key);
|
|
7652
7661
|
if (index === void 0) {
|
|
7653
7662
|
return null;
|
|
7654
7663
|
}
|
|
7655
7664
|
let renderedItem = null;
|
|
7656
7665
|
const extraData = peek$(ctx, "extraData");
|
|
7657
|
-
const item = data[index];
|
|
7666
|
+
const item = useAssignedGeneration ? metadata.itemData : data[index];
|
|
7658
7667
|
if (renderItem && !isNullOrUndefined(item)) {
|
|
7659
7668
|
const itemProps = {
|
|
7660
7669
|
data,
|
|
7661
7670
|
extraData,
|
|
7662
7671
|
index,
|
|
7663
7672
|
item,
|
|
7664
|
-
type: getItemType ? (
|
|
7673
|
+
type: useAssignedGeneration ? (_b = metadata.itemType) != null ? _b : "" : getItemType ? (_c = getItemType(item, index)) != null ? _c : "" : ""
|
|
7665
7674
|
};
|
|
7666
7675
|
renderedItem = renderItem(itemProps);
|
|
7667
7676
|
}
|
|
7668
|
-
return { index, item
|
|
7677
|
+
return { index, item, renderedItem };
|
|
7669
7678
|
}
|
|
7670
7679
|
|
|
7671
7680
|
// src/utils/normalizeMaintainScrollAtEnd.ts
|
|
@@ -8381,7 +8390,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
8381
8390
|
}, [ctx, usesBootstrapInitialScroll]);
|
|
8382
8391
|
const fns = React3.useMemo(
|
|
8383
8392
|
() => ({
|
|
8384
|
-
getRenderedItem: (key) => getRenderedItem(ctx, key),
|
|
8393
|
+
getRenderedItem: (key, containerId) => getRenderedItem(ctx, key, containerId),
|
|
8385
8394
|
onMomentumScrollEnd: (event) => {
|
|
8386
8395
|
checkFinishedScrollFallback(ctx);
|
|
8387
8396
|
if (state.props.onMomentumScrollEnd) {
|
package/react-native.web.mjs
CHANGED
|
@@ -2931,6 +2931,7 @@ function abortBootstrapInitialScroll(ctx) {
|
|
|
2931
2931
|
// src/core/containerItemMetadata.ts
|
|
2932
2932
|
function createContainerItemMetadata(state, itemIndex, itemData, itemType) {
|
|
2933
2933
|
return {
|
|
2934
|
+
data: state.props.data,
|
|
2934
2935
|
dataChangeEpoch: state.dataChangeEpoch,
|
|
2935
2936
|
getFixedItemSize: state.props.getFixedItemSize,
|
|
2936
2937
|
getItemType: state.props.getItemType,
|
|
@@ -2939,25 +2940,29 @@ function createContainerItemMetadata(state, itemIndex, itemData, itemType) {
|
|
|
2939
2940
|
itemType
|
|
2940
2941
|
};
|
|
2941
2942
|
}
|
|
2942
|
-
function
|
|
2943
|
-
var _a3
|
|
2944
|
-
const {
|
|
2943
|
+
function updateContainerItemMetadata(state, containerId, itemIndex, itemData, itemType) {
|
|
2944
|
+
var _a3;
|
|
2945
|
+
const { getItemType } = state.props;
|
|
2945
2946
|
const previousMetadata = state.containerItemMetadata.get(containerId);
|
|
2946
|
-
let metadata;
|
|
2947
2947
|
if ((previousMetadata == null ? void 0 : previousMetadata.dataChangeEpoch) === state.dataChangeEpoch && previousMetadata.getItemType === getItemType && previousMetadata.itemData === itemData && previousMetadata.itemIndex === itemIndex) {
|
|
2948
|
-
|
|
2949
|
-
} else {
|
|
2950
|
-
const itemType = getItemType ? (_a3 = getItemType(itemData, itemIndex)) != null ? _a3 : "" : void 0;
|
|
2951
|
-
metadata = createContainerItemMetadata(state, itemIndex, itemData, itemType);
|
|
2952
|
-
state.containerItemMetadata.set(containerId, metadata);
|
|
2948
|
+
return previousMetadata;
|
|
2953
2949
|
}
|
|
2950
|
+
const resolvedItemType = getItemType ? (_a3 = getItemType(itemData, itemIndex)) != null ? _a3 : "" : void 0;
|
|
2951
|
+
const metadata = createContainerItemMetadata(state, itemIndex, itemData, resolvedItemType);
|
|
2952
|
+
state.containerItemMetadata.set(containerId, metadata);
|
|
2953
|
+
return metadata;
|
|
2954
|
+
}
|
|
2955
|
+
function resolveContainerItemMetadata(state, containerId, itemIndex, itemData) {
|
|
2956
|
+
var _a3;
|
|
2957
|
+
const { getFixedItemSize } = state.props;
|
|
2958
|
+
const metadata = updateContainerItemMetadata(state, containerId, itemIndex, itemData);
|
|
2954
2959
|
if (metadata.getFixedItemSize !== getFixedItemSize) {
|
|
2955
2960
|
metadata.didResolveFixedItemSize = false;
|
|
2956
2961
|
metadata.fixedItemSize = void 0;
|
|
2957
2962
|
metadata.getFixedItemSize = getFixedItemSize;
|
|
2958
2963
|
}
|
|
2959
2964
|
if (getFixedItemSize && !metadata.didResolveFixedItemSize) {
|
|
2960
|
-
metadata.fixedItemSize = getFixedItemSize(itemData, itemIndex, (
|
|
2965
|
+
metadata.fixedItemSize = getFixedItemSize(itemData, itemIndex, (_a3 = metadata.itemType) != null ? _a3 : "");
|
|
2961
2966
|
metadata.didResolveFixedItemSize = true;
|
|
2962
2967
|
}
|
|
2963
2968
|
return metadata;
|
|
@@ -3302,6 +3307,7 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
|
|
|
3302
3307
|
return { didChangePosition: false, didRefreshData: false };
|
|
3303
3308
|
}
|
|
3304
3309
|
const itemKey = (_a3 = state.idCache[itemIndex]) != null ? _a3 : getId(state, itemIndex);
|
|
3310
|
+
const metadata = updateContainerItemMetadata(state, containerIndex, itemIndex, item);
|
|
3305
3311
|
const updateLayout = (_b = options == null ? void 0 : options.updateLayout) != null ? _b : true;
|
|
3306
3312
|
let didChangePosition = false;
|
|
3307
3313
|
let didRefreshData = false;
|
|
@@ -3312,7 +3318,7 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
|
|
|
3312
3318
|
return { didChangePosition: false, didRefreshData: false };
|
|
3313
3319
|
}
|
|
3314
3320
|
const logicalPosition = (positionValue || 0) - ((_c = options == null ? void 0 : options.scrollAdjustPending) != null ? _c : 0);
|
|
3315
|
-
const itemSize = (_d = state.sizes.get(itemKey)) != null ? _d : getItemSize(ctx, itemKey, itemIndex, item);
|
|
3321
|
+
const itemSize = (_d = state.sizes.get(itemKey)) != null ? _d : getItemSize(ctx, itemKey, itemIndex, item, void 0, void 0, void 0, metadata);
|
|
3316
3322
|
const position = toPhysicalHorizontalItemPosition(state, logicalPosition, itemSize, peek$(ctx, "totalSize"));
|
|
3317
3323
|
const column = columns[itemIndex] || 1;
|
|
3318
3324
|
const span = columnSpans[itemIndex] || 1;
|
|
@@ -4603,13 +4609,13 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4603
4609
|
changedContainerIds.add(containerIndex);
|
|
4604
4610
|
state.containerItemGenerations[containerIndex] = ((_p = state.containerItemGenerations[containerIndex]) != null ? _p : 0) + 1;
|
|
4605
4611
|
}
|
|
4606
|
-
set$(ctx, `containerItemKey${containerIndex}`, id);
|
|
4607
|
-
set$(ctx, `containerItemIndex${containerIndex}`, i);
|
|
4608
|
-
set$(ctx, `containerItemData${containerIndex}`, data[i]);
|
|
4609
4612
|
state.containerItemMetadata.set(
|
|
4610
4613
|
containerIndex,
|
|
4611
4614
|
createContainerItemMetadata(state, i, data[i], allocation.itemType)
|
|
4612
4615
|
);
|
|
4616
|
+
set$(ctx, `containerItemKey${containerIndex}`, id);
|
|
4617
|
+
set$(ctx, `containerItemIndex${containerIndex}`, i);
|
|
4618
|
+
set$(ctx, `containerItemData${containerIndex}`, data[i]);
|
|
4613
4619
|
containerItemKeys.set(id, containerIndex);
|
|
4614
4620
|
(_q = state.userScrollAnchorReset) == null ? void 0 : _q.keys.add(id);
|
|
4615
4621
|
const containerSticky = `containerSticky${containerIndex}`;
|
|
@@ -5672,7 +5678,7 @@ var Container = typedMemo(function Container2({
|
|
|
5672
5678
|
]
|
|
5673
5679
|
);
|
|
5674
5680
|
const renderedItemInfo = useMemo(
|
|
5675
|
-
() => itemKey !== void 0 ? getRenderedItem2(itemKey) : null,
|
|
5681
|
+
() => itemKey !== void 0 ? getRenderedItem2(itemKey, id) : null,
|
|
5676
5682
|
[itemKey, data, extraData]
|
|
5677
5683
|
);
|
|
5678
5684
|
const { renderedItem } = renderedItemInfo || {};
|
|
@@ -7617,34 +7623,37 @@ function getAlwaysRenderIndices(config, data, keyExtractor, anchoredEndSpaceAnch
|
|
|
7617
7623
|
}
|
|
7618
7624
|
|
|
7619
7625
|
// src/utils/getRenderedItem.ts
|
|
7620
|
-
function getRenderedItem(ctx, key) {
|
|
7621
|
-
var _a3;
|
|
7626
|
+
function getRenderedItem(ctx, key, containerId) {
|
|
7627
|
+
var _a3, _b, _c;
|
|
7622
7628
|
const state = ctx.state;
|
|
7623
7629
|
if (!state) {
|
|
7624
7630
|
return null;
|
|
7625
7631
|
}
|
|
7632
|
+
const metadata = state.containerItemMetadata.get(containerId);
|
|
7633
|
+
const useAssignedGeneration = metadata && metadata.dataChangeEpoch !== state.dataChangeEpoch;
|
|
7626
7634
|
const {
|
|
7627
7635
|
indexByKey,
|
|
7628
|
-
props: { data, getItemType, renderItem }
|
|
7636
|
+
props: { data: currentData, getItemType, renderItem }
|
|
7629
7637
|
} = state;
|
|
7630
|
-
const
|
|
7638
|
+
const data = useAssignedGeneration ? metadata.data : currentData;
|
|
7639
|
+
const index = (_a3 = metadata == null ? void 0 : metadata.itemIndex) != null ? _a3 : indexByKey.get(key);
|
|
7631
7640
|
if (index === void 0) {
|
|
7632
7641
|
return null;
|
|
7633
7642
|
}
|
|
7634
7643
|
let renderedItem = null;
|
|
7635
7644
|
const extraData = peek$(ctx, "extraData");
|
|
7636
|
-
const item = data[index];
|
|
7645
|
+
const item = useAssignedGeneration ? metadata.itemData : data[index];
|
|
7637
7646
|
if (renderItem && !isNullOrUndefined(item)) {
|
|
7638
7647
|
const itemProps = {
|
|
7639
7648
|
data,
|
|
7640
7649
|
extraData,
|
|
7641
7650
|
index,
|
|
7642
7651
|
item,
|
|
7643
|
-
type: getItemType ? (
|
|
7652
|
+
type: useAssignedGeneration ? (_b = metadata.itemType) != null ? _b : "" : getItemType ? (_c = getItemType(item, index)) != null ? _c : "" : ""
|
|
7644
7653
|
};
|
|
7645
7654
|
renderedItem = renderItem(itemProps);
|
|
7646
7655
|
}
|
|
7647
|
-
return { index, item
|
|
7656
|
+
return { index, item, renderedItem };
|
|
7648
7657
|
}
|
|
7649
7658
|
|
|
7650
7659
|
// src/utils/normalizeMaintainScrollAtEnd.ts
|
|
@@ -8360,7 +8369,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
8360
8369
|
}, [ctx, usesBootstrapInitialScroll]);
|
|
8361
8370
|
const fns = useMemo(
|
|
8362
8371
|
() => ({
|
|
8363
|
-
getRenderedItem: (key) => getRenderedItem(ctx, key),
|
|
8372
|
+
getRenderedItem: (key, containerId) => getRenderedItem(ctx, key, containerId),
|
|
8364
8373
|
onMomentumScrollEnd: (event) => {
|
|
8365
8374
|
checkFinishedScrollFallback(ctx);
|
|
8366
8375
|
if (state.props.onMomentumScrollEnd) {
|
package/react.js
CHANGED
|
@@ -2952,6 +2952,7 @@ function abortBootstrapInitialScroll(ctx) {
|
|
|
2952
2952
|
// src/core/containerItemMetadata.ts
|
|
2953
2953
|
function createContainerItemMetadata(state, itemIndex, itemData, itemType) {
|
|
2954
2954
|
return {
|
|
2955
|
+
data: state.props.data,
|
|
2955
2956
|
dataChangeEpoch: state.dataChangeEpoch,
|
|
2956
2957
|
getFixedItemSize: state.props.getFixedItemSize,
|
|
2957
2958
|
getItemType: state.props.getItemType,
|
|
@@ -2960,25 +2961,29 @@ function createContainerItemMetadata(state, itemIndex, itemData, itemType) {
|
|
|
2960
2961
|
itemType
|
|
2961
2962
|
};
|
|
2962
2963
|
}
|
|
2963
|
-
function
|
|
2964
|
-
var _a3
|
|
2965
|
-
const {
|
|
2964
|
+
function updateContainerItemMetadata(state, containerId, itemIndex, itemData, itemType) {
|
|
2965
|
+
var _a3;
|
|
2966
|
+
const { getItemType } = state.props;
|
|
2966
2967
|
const previousMetadata = state.containerItemMetadata.get(containerId);
|
|
2967
|
-
let metadata;
|
|
2968
2968
|
if ((previousMetadata == null ? void 0 : previousMetadata.dataChangeEpoch) === state.dataChangeEpoch && previousMetadata.getItemType === getItemType && previousMetadata.itemData === itemData && previousMetadata.itemIndex === itemIndex) {
|
|
2969
|
-
|
|
2970
|
-
} else {
|
|
2971
|
-
const itemType = getItemType ? (_a3 = getItemType(itemData, itemIndex)) != null ? _a3 : "" : void 0;
|
|
2972
|
-
metadata = createContainerItemMetadata(state, itemIndex, itemData, itemType);
|
|
2973
|
-
state.containerItemMetadata.set(containerId, metadata);
|
|
2969
|
+
return previousMetadata;
|
|
2974
2970
|
}
|
|
2971
|
+
const resolvedItemType = getItemType ? (_a3 = getItemType(itemData, itemIndex)) != null ? _a3 : "" : void 0;
|
|
2972
|
+
const metadata = createContainerItemMetadata(state, itemIndex, itemData, resolvedItemType);
|
|
2973
|
+
state.containerItemMetadata.set(containerId, metadata);
|
|
2974
|
+
return metadata;
|
|
2975
|
+
}
|
|
2976
|
+
function resolveContainerItemMetadata(state, containerId, itemIndex, itemData) {
|
|
2977
|
+
var _a3;
|
|
2978
|
+
const { getFixedItemSize } = state.props;
|
|
2979
|
+
const metadata = updateContainerItemMetadata(state, containerId, itemIndex, itemData);
|
|
2975
2980
|
if (metadata.getFixedItemSize !== getFixedItemSize) {
|
|
2976
2981
|
metadata.didResolveFixedItemSize = false;
|
|
2977
2982
|
metadata.fixedItemSize = void 0;
|
|
2978
2983
|
metadata.getFixedItemSize = getFixedItemSize;
|
|
2979
2984
|
}
|
|
2980
2985
|
if (getFixedItemSize && !metadata.didResolveFixedItemSize) {
|
|
2981
|
-
metadata.fixedItemSize = getFixedItemSize(itemData, itemIndex, (
|
|
2986
|
+
metadata.fixedItemSize = getFixedItemSize(itemData, itemIndex, (_a3 = metadata.itemType) != null ? _a3 : "");
|
|
2982
2987
|
metadata.didResolveFixedItemSize = true;
|
|
2983
2988
|
}
|
|
2984
2989
|
return metadata;
|
|
@@ -3323,6 +3328,7 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
|
|
|
3323
3328
|
return { didChangePosition: false, didRefreshData: false };
|
|
3324
3329
|
}
|
|
3325
3330
|
const itemKey = (_a3 = state.idCache[itemIndex]) != null ? _a3 : getId(state, itemIndex);
|
|
3331
|
+
const metadata = updateContainerItemMetadata(state, containerIndex, itemIndex, item);
|
|
3326
3332
|
const updateLayout = (_b = options == null ? void 0 : options.updateLayout) != null ? _b : true;
|
|
3327
3333
|
let didChangePosition = false;
|
|
3328
3334
|
let didRefreshData = false;
|
|
@@ -3333,7 +3339,7 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
|
|
|
3333
3339
|
return { didChangePosition: false, didRefreshData: false };
|
|
3334
3340
|
}
|
|
3335
3341
|
const logicalPosition = (positionValue || 0) - ((_c = options == null ? void 0 : options.scrollAdjustPending) != null ? _c : 0);
|
|
3336
|
-
const itemSize = (_d = state.sizes.get(itemKey)) != null ? _d : getItemSize(ctx, itemKey, itemIndex, item);
|
|
3342
|
+
const itemSize = (_d = state.sizes.get(itemKey)) != null ? _d : getItemSize(ctx, itemKey, itemIndex, item, void 0, void 0, void 0, metadata);
|
|
3337
3343
|
const position = toPhysicalHorizontalItemPosition(state, logicalPosition, itemSize, peek$(ctx, "totalSize"));
|
|
3338
3344
|
const column = columns[itemIndex] || 1;
|
|
3339
3345
|
const span = columnSpans[itemIndex] || 1;
|
|
@@ -4624,13 +4630,13 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4624
4630
|
changedContainerIds.add(containerIndex);
|
|
4625
4631
|
state.containerItemGenerations[containerIndex] = ((_p = state.containerItemGenerations[containerIndex]) != null ? _p : 0) + 1;
|
|
4626
4632
|
}
|
|
4627
|
-
set$(ctx, `containerItemKey${containerIndex}`, id);
|
|
4628
|
-
set$(ctx, `containerItemIndex${containerIndex}`, i);
|
|
4629
|
-
set$(ctx, `containerItemData${containerIndex}`, data[i]);
|
|
4630
4633
|
state.containerItemMetadata.set(
|
|
4631
4634
|
containerIndex,
|
|
4632
4635
|
createContainerItemMetadata(state, i, data[i], allocation.itemType)
|
|
4633
4636
|
);
|
|
4637
|
+
set$(ctx, `containerItemKey${containerIndex}`, id);
|
|
4638
|
+
set$(ctx, `containerItemIndex${containerIndex}`, i);
|
|
4639
|
+
set$(ctx, `containerItemData${containerIndex}`, data[i]);
|
|
4634
4640
|
containerItemKeys.set(id, containerIndex);
|
|
4635
4641
|
(_q = state.userScrollAnchorReset) == null ? void 0 : _q.keys.add(id);
|
|
4636
4642
|
const containerSticky = `containerSticky${containerIndex}`;
|
|
@@ -5693,7 +5699,7 @@ var Container = typedMemo(function Container2({
|
|
|
5693
5699
|
]
|
|
5694
5700
|
);
|
|
5695
5701
|
const renderedItemInfo = React3.useMemo(
|
|
5696
|
-
() => itemKey !== void 0 ? getRenderedItem2(itemKey) : null,
|
|
5702
|
+
() => itemKey !== void 0 ? getRenderedItem2(itemKey, id) : null,
|
|
5697
5703
|
[itemKey, data, extraData]
|
|
5698
5704
|
);
|
|
5699
5705
|
const { renderedItem } = renderedItemInfo || {};
|
|
@@ -7638,34 +7644,37 @@ function getAlwaysRenderIndices(config, data, keyExtractor, anchoredEndSpaceAnch
|
|
|
7638
7644
|
}
|
|
7639
7645
|
|
|
7640
7646
|
// src/utils/getRenderedItem.ts
|
|
7641
|
-
function getRenderedItem(ctx, key) {
|
|
7642
|
-
var _a3;
|
|
7647
|
+
function getRenderedItem(ctx, key, containerId) {
|
|
7648
|
+
var _a3, _b, _c;
|
|
7643
7649
|
const state = ctx.state;
|
|
7644
7650
|
if (!state) {
|
|
7645
7651
|
return null;
|
|
7646
7652
|
}
|
|
7653
|
+
const metadata = state.containerItemMetadata.get(containerId);
|
|
7654
|
+
const useAssignedGeneration = metadata && metadata.dataChangeEpoch !== state.dataChangeEpoch;
|
|
7647
7655
|
const {
|
|
7648
7656
|
indexByKey,
|
|
7649
|
-
props: { data, getItemType, renderItem }
|
|
7657
|
+
props: { data: currentData, getItemType, renderItem }
|
|
7650
7658
|
} = state;
|
|
7651
|
-
const
|
|
7659
|
+
const data = useAssignedGeneration ? metadata.data : currentData;
|
|
7660
|
+
const index = (_a3 = metadata == null ? void 0 : metadata.itemIndex) != null ? _a3 : indexByKey.get(key);
|
|
7652
7661
|
if (index === void 0) {
|
|
7653
7662
|
return null;
|
|
7654
7663
|
}
|
|
7655
7664
|
let renderedItem = null;
|
|
7656
7665
|
const extraData = peek$(ctx, "extraData");
|
|
7657
|
-
const item = data[index];
|
|
7666
|
+
const item = useAssignedGeneration ? metadata.itemData : data[index];
|
|
7658
7667
|
if (renderItem && !isNullOrUndefined(item)) {
|
|
7659
7668
|
const itemProps = {
|
|
7660
7669
|
data,
|
|
7661
7670
|
extraData,
|
|
7662
7671
|
index,
|
|
7663
7672
|
item,
|
|
7664
|
-
type: getItemType ? (
|
|
7673
|
+
type: useAssignedGeneration ? (_b = metadata.itemType) != null ? _b : "" : getItemType ? (_c = getItemType(item, index)) != null ? _c : "" : ""
|
|
7665
7674
|
};
|
|
7666
7675
|
renderedItem = renderItem(itemProps);
|
|
7667
7676
|
}
|
|
7668
|
-
return { index, item
|
|
7677
|
+
return { index, item, renderedItem };
|
|
7669
7678
|
}
|
|
7670
7679
|
|
|
7671
7680
|
// src/utils/normalizeMaintainScrollAtEnd.ts
|
|
@@ -8381,7 +8390,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
8381
8390
|
}, [ctx, usesBootstrapInitialScroll]);
|
|
8382
8391
|
const fns = React3.useMemo(
|
|
8383
8392
|
() => ({
|
|
8384
|
-
getRenderedItem: (key) => getRenderedItem(ctx, key),
|
|
8393
|
+
getRenderedItem: (key, containerId) => getRenderedItem(ctx, key, containerId),
|
|
8385
8394
|
onMomentumScrollEnd: (event) => {
|
|
8386
8395
|
checkFinishedScrollFallback(ctx);
|
|
8387
8396
|
if (state.props.onMomentumScrollEnd) {
|
package/react.mjs
CHANGED
|
@@ -2931,6 +2931,7 @@ function abortBootstrapInitialScroll(ctx) {
|
|
|
2931
2931
|
// src/core/containerItemMetadata.ts
|
|
2932
2932
|
function createContainerItemMetadata(state, itemIndex, itemData, itemType) {
|
|
2933
2933
|
return {
|
|
2934
|
+
data: state.props.data,
|
|
2934
2935
|
dataChangeEpoch: state.dataChangeEpoch,
|
|
2935
2936
|
getFixedItemSize: state.props.getFixedItemSize,
|
|
2936
2937
|
getItemType: state.props.getItemType,
|
|
@@ -2939,25 +2940,29 @@ function createContainerItemMetadata(state, itemIndex, itemData, itemType) {
|
|
|
2939
2940
|
itemType
|
|
2940
2941
|
};
|
|
2941
2942
|
}
|
|
2942
|
-
function
|
|
2943
|
-
var _a3
|
|
2944
|
-
const {
|
|
2943
|
+
function updateContainerItemMetadata(state, containerId, itemIndex, itemData, itemType) {
|
|
2944
|
+
var _a3;
|
|
2945
|
+
const { getItemType } = state.props;
|
|
2945
2946
|
const previousMetadata = state.containerItemMetadata.get(containerId);
|
|
2946
|
-
let metadata;
|
|
2947
2947
|
if ((previousMetadata == null ? void 0 : previousMetadata.dataChangeEpoch) === state.dataChangeEpoch && previousMetadata.getItemType === getItemType && previousMetadata.itemData === itemData && previousMetadata.itemIndex === itemIndex) {
|
|
2948
|
-
|
|
2949
|
-
} else {
|
|
2950
|
-
const itemType = getItemType ? (_a3 = getItemType(itemData, itemIndex)) != null ? _a3 : "" : void 0;
|
|
2951
|
-
metadata = createContainerItemMetadata(state, itemIndex, itemData, itemType);
|
|
2952
|
-
state.containerItemMetadata.set(containerId, metadata);
|
|
2948
|
+
return previousMetadata;
|
|
2953
2949
|
}
|
|
2950
|
+
const resolvedItemType = getItemType ? (_a3 = getItemType(itemData, itemIndex)) != null ? _a3 : "" : void 0;
|
|
2951
|
+
const metadata = createContainerItemMetadata(state, itemIndex, itemData, resolvedItemType);
|
|
2952
|
+
state.containerItemMetadata.set(containerId, metadata);
|
|
2953
|
+
return metadata;
|
|
2954
|
+
}
|
|
2955
|
+
function resolveContainerItemMetadata(state, containerId, itemIndex, itemData) {
|
|
2956
|
+
var _a3;
|
|
2957
|
+
const { getFixedItemSize } = state.props;
|
|
2958
|
+
const metadata = updateContainerItemMetadata(state, containerId, itemIndex, itemData);
|
|
2954
2959
|
if (metadata.getFixedItemSize !== getFixedItemSize) {
|
|
2955
2960
|
metadata.didResolveFixedItemSize = false;
|
|
2956
2961
|
metadata.fixedItemSize = void 0;
|
|
2957
2962
|
metadata.getFixedItemSize = getFixedItemSize;
|
|
2958
2963
|
}
|
|
2959
2964
|
if (getFixedItemSize && !metadata.didResolveFixedItemSize) {
|
|
2960
|
-
metadata.fixedItemSize = getFixedItemSize(itemData, itemIndex, (
|
|
2965
|
+
metadata.fixedItemSize = getFixedItemSize(itemData, itemIndex, (_a3 = metadata.itemType) != null ? _a3 : "");
|
|
2961
2966
|
metadata.didResolveFixedItemSize = true;
|
|
2962
2967
|
}
|
|
2963
2968
|
return metadata;
|
|
@@ -3302,6 +3307,7 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
|
|
|
3302
3307
|
return { didChangePosition: false, didRefreshData: false };
|
|
3303
3308
|
}
|
|
3304
3309
|
const itemKey = (_a3 = state.idCache[itemIndex]) != null ? _a3 : getId(state, itemIndex);
|
|
3310
|
+
const metadata = updateContainerItemMetadata(state, containerIndex, itemIndex, item);
|
|
3305
3311
|
const updateLayout = (_b = options == null ? void 0 : options.updateLayout) != null ? _b : true;
|
|
3306
3312
|
let didChangePosition = false;
|
|
3307
3313
|
let didRefreshData = false;
|
|
@@ -3312,7 +3318,7 @@ function syncMountedContainer(ctx, containerIndex, itemIndex, options) {
|
|
|
3312
3318
|
return { didChangePosition: false, didRefreshData: false };
|
|
3313
3319
|
}
|
|
3314
3320
|
const logicalPosition = (positionValue || 0) - ((_c = options == null ? void 0 : options.scrollAdjustPending) != null ? _c : 0);
|
|
3315
|
-
const itemSize = (_d = state.sizes.get(itemKey)) != null ? _d : getItemSize(ctx, itemKey, itemIndex, item);
|
|
3321
|
+
const itemSize = (_d = state.sizes.get(itemKey)) != null ? _d : getItemSize(ctx, itemKey, itemIndex, item, void 0, void 0, void 0, metadata);
|
|
3316
3322
|
const position = toPhysicalHorizontalItemPosition(state, logicalPosition, itemSize, peek$(ctx, "totalSize"));
|
|
3317
3323
|
const column = columns[itemIndex] || 1;
|
|
3318
3324
|
const span = columnSpans[itemIndex] || 1;
|
|
@@ -4603,13 +4609,13 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4603
4609
|
changedContainerIds.add(containerIndex);
|
|
4604
4610
|
state.containerItemGenerations[containerIndex] = ((_p = state.containerItemGenerations[containerIndex]) != null ? _p : 0) + 1;
|
|
4605
4611
|
}
|
|
4606
|
-
set$(ctx, `containerItemKey${containerIndex}`, id);
|
|
4607
|
-
set$(ctx, `containerItemIndex${containerIndex}`, i);
|
|
4608
|
-
set$(ctx, `containerItemData${containerIndex}`, data[i]);
|
|
4609
4612
|
state.containerItemMetadata.set(
|
|
4610
4613
|
containerIndex,
|
|
4611
4614
|
createContainerItemMetadata(state, i, data[i], allocation.itemType)
|
|
4612
4615
|
);
|
|
4616
|
+
set$(ctx, `containerItemKey${containerIndex}`, id);
|
|
4617
|
+
set$(ctx, `containerItemIndex${containerIndex}`, i);
|
|
4618
|
+
set$(ctx, `containerItemData${containerIndex}`, data[i]);
|
|
4613
4619
|
containerItemKeys.set(id, containerIndex);
|
|
4614
4620
|
(_q = state.userScrollAnchorReset) == null ? void 0 : _q.keys.add(id);
|
|
4615
4621
|
const containerSticky = `containerSticky${containerIndex}`;
|
|
@@ -5672,7 +5678,7 @@ var Container = typedMemo(function Container2({
|
|
|
5672
5678
|
]
|
|
5673
5679
|
);
|
|
5674
5680
|
const renderedItemInfo = useMemo(
|
|
5675
|
-
() => itemKey !== void 0 ? getRenderedItem2(itemKey) : null,
|
|
5681
|
+
() => itemKey !== void 0 ? getRenderedItem2(itemKey, id) : null,
|
|
5676
5682
|
[itemKey, data, extraData]
|
|
5677
5683
|
);
|
|
5678
5684
|
const { renderedItem } = renderedItemInfo || {};
|
|
@@ -7617,34 +7623,37 @@ function getAlwaysRenderIndices(config, data, keyExtractor, anchoredEndSpaceAnch
|
|
|
7617
7623
|
}
|
|
7618
7624
|
|
|
7619
7625
|
// src/utils/getRenderedItem.ts
|
|
7620
|
-
function getRenderedItem(ctx, key) {
|
|
7621
|
-
var _a3;
|
|
7626
|
+
function getRenderedItem(ctx, key, containerId) {
|
|
7627
|
+
var _a3, _b, _c;
|
|
7622
7628
|
const state = ctx.state;
|
|
7623
7629
|
if (!state) {
|
|
7624
7630
|
return null;
|
|
7625
7631
|
}
|
|
7632
|
+
const metadata = state.containerItemMetadata.get(containerId);
|
|
7633
|
+
const useAssignedGeneration = metadata && metadata.dataChangeEpoch !== state.dataChangeEpoch;
|
|
7626
7634
|
const {
|
|
7627
7635
|
indexByKey,
|
|
7628
|
-
props: { data, getItemType, renderItem }
|
|
7636
|
+
props: { data: currentData, getItemType, renderItem }
|
|
7629
7637
|
} = state;
|
|
7630
|
-
const
|
|
7638
|
+
const data = useAssignedGeneration ? metadata.data : currentData;
|
|
7639
|
+
const index = (_a3 = metadata == null ? void 0 : metadata.itemIndex) != null ? _a3 : indexByKey.get(key);
|
|
7631
7640
|
if (index === void 0) {
|
|
7632
7641
|
return null;
|
|
7633
7642
|
}
|
|
7634
7643
|
let renderedItem = null;
|
|
7635
7644
|
const extraData = peek$(ctx, "extraData");
|
|
7636
|
-
const item = data[index];
|
|
7645
|
+
const item = useAssignedGeneration ? metadata.itemData : data[index];
|
|
7637
7646
|
if (renderItem && !isNullOrUndefined(item)) {
|
|
7638
7647
|
const itemProps = {
|
|
7639
7648
|
data,
|
|
7640
7649
|
extraData,
|
|
7641
7650
|
index,
|
|
7642
7651
|
item,
|
|
7643
|
-
type: getItemType ? (
|
|
7652
|
+
type: useAssignedGeneration ? (_b = metadata.itemType) != null ? _b : "" : getItemType ? (_c = getItemType(item, index)) != null ? _c : "" : ""
|
|
7644
7653
|
};
|
|
7645
7654
|
renderedItem = renderItem(itemProps);
|
|
7646
7655
|
}
|
|
7647
|
-
return { index, item
|
|
7656
|
+
return { index, item, renderedItem };
|
|
7648
7657
|
}
|
|
7649
7658
|
|
|
7650
7659
|
// src/utils/normalizeMaintainScrollAtEnd.ts
|
|
@@ -8360,7 +8369,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
8360
8369
|
}, [ctx, usesBootstrapInitialScroll]);
|
|
8361
8370
|
const fns = useMemo(
|
|
8362
8371
|
() => ({
|
|
8363
|
-
getRenderedItem: (key) => getRenderedItem(ctx, key),
|
|
8372
|
+
getRenderedItem: (key, containerId) => getRenderedItem(ctx, key, containerId),
|
|
8364
8373
|
onMomentumScrollEnd: (event) => {
|
|
8365
8374
|
checkFinishedScrollFallback(ctx);
|
|
8366
8375
|
if (state.props.onMomentumScrollEnd) {
|