@shival99/z-ui 2.0.78 → 2.0.79
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.
|
@@ -6701,6 +6701,22 @@ class ZTableComponent {
|
|
|
6701
6701
|
},
|
|
6702
6702
|
];
|
|
6703
6703
|
_bulkBarExitDuration = 140;
|
|
6704
|
+
/** Stable identity key per virtual index (group/row id, not array index) so cached measured
|
|
6705
|
+
* heights follow row identity — tránh co giật chiều cao khi scroll nhanh do index slot bị tái dùng. */
|
|
6706
|
+
_virtualItemKeys = computed(() => {
|
|
6707
|
+
if (!this.isVirtual()) {
|
|
6708
|
+
return [];
|
|
6709
|
+
}
|
|
6710
|
+
const flatItems = this.virtualGroupedFlatItems();
|
|
6711
|
+
if (flatItems.length > 0) {
|
|
6712
|
+
return flatItems.map((item, index) => item.type === 'group-header' ? `g:${item.groupItem.id}` : `r:${item.rows[0]?.id ?? index}`);
|
|
6713
|
+
}
|
|
6714
|
+
const groupRows = this.dynamicGroupRows();
|
|
6715
|
+
if (groupRows.length > 0) {
|
|
6716
|
+
return groupRows.map((rows, index) => `r:${rows[0]?.id ?? index}`);
|
|
6717
|
+
}
|
|
6718
|
+
return Array.from({ length: this._virtualGroupCount() }, (_, index) => index);
|
|
6719
|
+
}, ...(ngDevMode ? [{ debugName: "_virtualItemKeys" }] : []));
|
|
6704
6720
|
/** Virtualizer instance — operates on groups rather than individual rows */
|
|
6705
6721
|
virtualizer = injectVirtualizer(() => {
|
|
6706
6722
|
const groups = this.dynamicGroups();
|
|
@@ -6710,9 +6726,13 @@ class ZTableComponent {
|
|
|
6710
6726
|
const virtualConfig = this._virtualConfig();
|
|
6711
6727
|
const flatItems = this.virtualGroupedFlatItems();
|
|
6712
6728
|
const isGrouping = flatItems.length > 0;
|
|
6729
|
+
const itemKeys = this._virtualItemKeys();
|
|
6713
6730
|
return {
|
|
6714
6731
|
scrollElement,
|
|
6715
6732
|
count: isGrouping ? flatItems.length : groups.length > 0 ? groups.length : this._virtualGroupCount(),
|
|
6733
|
+
// Stable per-row key so cached measured heights follow row identity, not the recycled
|
|
6734
|
+
// index slot — prevents the height jitter when scrolling fast (see _virtualItemKeys).
|
|
6735
|
+
getItemKey: (index) => itemKeys[index] ?? index,
|
|
6716
6736
|
estimateSize: (index) => {
|
|
6717
6737
|
if (isGrouping) {
|
|
6718
6738
|
return flatItems[index]?.type === 'group-header'
|