fix(downloads): keep collapse rows mounted across viewport
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import type { DownloadLogicalRow } from "./downloads-model";
|
||||
import { DOWNLOAD_FILE_ROW_HEIGHT } from "./download-virtualizer";
|
||||
import {
|
||||
DOWNLOAD_FILE_ROW_HEIGHT,
|
||||
calculateDownloadVirtualWindow,
|
||||
type DownloadVirtualWindowOptions
|
||||
} from "./download-virtualizer";
|
||||
|
||||
export const DOWNLOAD_DISCLOSURE_DURATION_MS = 300;
|
||||
export const DOWNLOAD_DISCLOSURE_MAX_ANIMATED_ITEMS = 64;
|
||||
@@ -149,3 +153,13 @@ export function activateDownloadDisclosureTransition(rows: readonly DownloadDisc
|
||||
: { ...row, height: 0, disclosureOpacity: 0 };
|
||||
});
|
||||
}
|
||||
|
||||
export function getDownloadDisclosurePinnedIds(
|
||||
preparedRows: readonly DownloadDisclosureRow[],
|
||||
options: DownloadVirtualWindowOptions
|
||||
): string[] {
|
||||
const windowOptions = { ...options, pinnedIds: [] };
|
||||
const startRows = calculateDownloadVirtualWindow(preparedRows, windowOptions).rows;
|
||||
const targetRows = calculateDownloadVirtualWindow(activateDownloadDisclosureTransition(preparedRows), windowOptions).rows;
|
||||
return [...new Set([...startRows, ...targetRows].map((entry) => entry.id))];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user