feat(admin): shift-select multiple sessions in process list

This commit is contained in:
zipg authored and GitHub committed 2026-09-20 16:49:57 +08:00
1 parent 08cb9287de
commit ec7bc617c4
8 files changed
+144 -9

No files matched your search

@@ -17,3 +17,12 @@ export function orderedListRangeAnchorIndex(items: OrderedListSelectionItem[], a
const index = items.findIndex((item) => item.type === activeItem.type && item.id === activeItem.id);
return index >= 0 ? index : null;
}
/** Inclusive, clamped index range between two positions in an ordered list. */
export function orderedListRangeIndices(length: number, anchorIndex: number, focusIndex: number): number[] {
if (length <= 0) return [];
if (anchorIndex < 0 || anchorIndex >= length || focusIndex < 0 || focusIndex >= length) return [];
const start = Math.min(anchorIndex, focusIndex);
const end = Math.max(anchorIndex, focusIndex);
return Array.from({ length: end - start + 1 }, (_, offset) => start + offset);
}