feat(admin): shift-select multiple sessions in process list
This commit is contained in:
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);
|
||||
}
|
||||
Reference in new issue
Block a user