feat(book-browser): enable shift-click multi-selection and "Select All" support

- Implemented shift-click selection in grid view to allow selecting a range of books
- Tracked last selected index to determine selection range when shift key is pressed
- Maintained selected book IDs in a Set for fast lookup and deduplication
- Added a "Select All" button in the book browser footer to select all filtered books
- Synced selection state with PrimeNG checkbox behavior
- Ensured selection works correctly with filtered, sorted, or paginated results
This commit is contained in:
aditya.chandel
2025-06-21 16:11:38 -06:00
committed by Aditya Chandel
parent 0e8d1e6124
commit 6f032153b8
5 changed files with 83 additions and 12 deletions
@@ -193,15 +193,17 @@
class="grid"
#container
[ngStyle]="{'grid-template-columns': 'repeat(auto-fill, minmax(' + gridColumnMinWidth + ', 1fr))'}">
@for (book of scroll.viewPortItems; track book) {
@for (book of scroll.viewPortItems; let i = $index; track book) {
<div
class="virtual-scroller-item relative"
[ngStyle]="{width: currentCardSize.width + 'px', height: currentCardSize.height + 'px'}">
<app-book-card
[index]="i"
[book]="book"
[isCheckboxEnabled]="true"
[onBookSelect]="handleBookSelect.bind(this)"
[isSeriesCollapsed]="seriesCollapseFilter.isSeriesCollapsed"
(checkboxClick)="onCheckboxClicked($event)"
[isSelected]="selectedBooks.has(book.id)">
</app-book-card>
</div>
@@ -220,7 +222,7 @@
<p-tieredmenu #menu [model]="metadataMenuItems" [popup]="true" appendTo="body"/>
<p-button
(click)="menu.toggle($event)"
tooltip="Metadata actions"
pTooltip="Metadata actions"
tooltipPosition="top"
outlined="true"
severity="info"
@@ -257,6 +259,14 @@
pTooltip="Lock/Unlock metadata"
tooltipPosition="top">
</p-button>
<p-button
outlined="true"
icon="pi pi-check-square"
severity="success"
(click)="selectAllBooks()"
pTooltip="Select all books"
tooltipPosition="top">
</p-button>
<p-button
outlined="true"
icon="pi pi-times"