Table column resizing

This commit is contained in:
aditya.chandel
2025-01-24 22:44:09 -07:00
parent 5d087928c6
commit 51808692ed
2 changed files with 16 additions and 17 deletions
@@ -37,7 +37,7 @@
</a> </a>
<p-menu #sortMenu [popup]="true" [model]="sortOptions" appendTo="body"> <p-menu #sortMenu [popup]="true" [model]="sortOptions" appendTo="body">
<ng-template pTemplate="item" let-item> <ng-template pTemplate="item" let-item>
<div class="flex justify-between items-center w-full px-4 py-2 cursor-pointer" (click)="sortBooks(item.field)"> <div class="flex justify-between items-center px-4 py-2 cursor-pointer" (click)="sortBooks(item.field)">
<span>{{ item.label }}</span> <span>{{ item.label }}</span>
<i *ngIf="item.icon" [class]="item.icon"></i> <i *ngIf="item.icon" [class]="item.icon"></i>
</div> </div>
@@ -45,7 +45,6 @@
</p-menu> </p-menu>
</div> </div>
<a class="topbar-items topbar-item" (click)="toggleTableGrid()"> <a class="topbar-items topbar-item" (click)="toggleTableGrid()">
<i <i
[ngClass]="viewIcon" [ngClass]="viewIcon"
@@ -14,7 +14,10 @@
(onEditComplete)="onEditComplete($event)"> (onEditComplete)="onEditComplete($event)">
<ng-template #header> <ng-template #header>
<tr> <tr>
<th class="max-w-16">Cover</th> <th>
<p-tableHeaderCheckbox/>
</th>
<th class="max-w-14 min-w-14"></th>
<th pResizableColumn>Title</th> <th pResizableColumn>Title</th>
<th pResizableColumn>Authors</th> <th pResizableColumn>Authors</th>
<th pResizableColumn>Publisher</th> <th pResizableColumn>Publisher</th>
@@ -25,20 +28,20 @@
<th>Rating</th> <th>Rating</th>
<th>Pages</th> <th>Pages</th>
<th>Reviews</th> <th>Reviews</th>
<th>
<p-tableHeaderCheckbox/>
</th>
</tr> </tr>
</ng-template> </ng-template>
<ng-template #body let-book> <ng-template #body let-book>
<tr *ngIf="book.metadata as metadata" style="height:46px"> <tr *ngIf="book.metadata as metadata" style="height:46px">
<td class="max-w-16">
<p-tableCheckbox [value]="book"></p-tableCheckbox>
</td>
<td (click)="openMetadataCenter(book.id)"> <td (click)="openMetadataCenter(book.id)">
<img [src]="urlHelper.getCoverUrl(book.id, metadata.coverUpdatedOn)" alt="Book Cover" class="size-7"/> <img [src]="urlHelper.getCoverUrl(book.id, metadata.coverUpdatedOn)" alt="Book Cover" class="size-7"/>
</td> </td>
<td [pEditableColumn]="metadata.title" <td [pEditableColumn]="metadata.title"
pEditableColumnField="metadata.title" pEditableColumnField="metadata.title"
class="min-w-[25rem] max-w-[35rem] overflow-hidden truncate" class="min-w-[15rem] max-w-[20rem] overflow-hidden truncate"
[pEditableColumnRowIndex]="book.id" [pEditableColumnRowIndex]="book.id"
[title]="book.metadata?.id"> [title]="book.metadata?.id">
<p-cellEditor> <p-cellEditor>
@@ -51,11 +54,11 @@
</p-cellEditor> </p-cellEditor>
</td> </td>
<td class="min-w-[10rem] max-w-[15rem] overflow-hidden truncate">{{ getAuthorNames(metadata.authors) }}</td> <td class="min-w-[10rem] max-w-[13rem] overflow-hidden truncate">{{ getAuthorNames(metadata.authors) }}</td>
<td [pEditableColumn]="metadata.publisher" <td [pEditableColumn]="metadata.publisher"
pEditableColumnField="metadata.publisher" pEditableColumnField="metadata.publisher"
class="min-w-[6rem] max-w-[10rem] overflow-hidden truncate" class="min-w-[12rem] max-w-[12rem] overflow-hidden truncate"
[pEditableColumnRowIndex]="book.id"> [pEditableColumnRowIndex]="book.id">
<p-cellEditor> <p-cellEditor>
<ng-template #input> <ng-template #input>
@@ -85,7 +88,7 @@
<td [pEditableColumn]="metadata.isbn10" <td [pEditableColumn]="metadata.isbn10"
pEditableColumnField="metadata.isbn10" pEditableColumnField="metadata.isbn10"
class="overflow-hidden truncate max-w-15" class="overflow-hidden truncate min-w-[8rem] max-w-[8rem]"
[pEditableColumnRowIndex]="book.id"> [pEditableColumnRowIndex]="book.id">
<p-cellEditor> <p-cellEditor>
<ng-template #input> <ng-template #input>
@@ -97,8 +100,8 @@
</p-cellEditor> </p-cellEditor>
</td> </td>
<td class="max-w-28 overflow-hidden truncate">{{ metadata.language }}</td> <td class="min-w-[6rem] max-w-[6rem] overflow-hidden truncate">{{ metadata.language }}</td>
<td class="max-w-30 overflow-hidden truncate"> <td class="min-w-[8rem] max-w-[8rem] overflow-hidden truncate">
<ng-container> <ng-container>
<p-rating <p-rating
[(ngModel)]="metadata.rating" [(ngModel)]="metadata.rating"
@@ -108,11 +111,8 @@
</p-rating> </p-rating>
</ng-container> </ng-container>
</td> </td>
<td class="max-w-32 overflow-hidden truncate">{{ metadata.pageCount }}</td> <td class="min-w-[5rem] max-w-[5rem] overflow-hidden truncate">{{ metadata.pageCount }}</td>
<td class="max-w-32 overflow-hidden truncate">{{ metadata.reviewCount }}</td> <td class="min-w-[5rem] max-w-[5rem] overflow-hidden truncate">{{ metadata.reviewCount }}</td>
<td class="max-w-16">
<p-tableCheckbox [value]="book"></p-tableCheckbox>
</td>
</tr> </tr>
</ng-template> </ng-template>
</p-table> </p-table>