Release Polishing (#2325)

Co-authored-by: Robbie Davis <robbie@therobbiedavis.com>
This commit is contained in:
Joe Milazzo 2023-10-18 17:52:54 -05:00 committed by GitHub
parent 2d3a0c1eda
commit 8e85ba069c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 88 additions and 96 deletions

View file

@ -2,15 +2,6 @@
<ng-container *ngIf="items.length > virtualizeAfter; else dragList">
<div class="example-list list-group-flush">
<!-- <li-virtual-scroll [items]="items" [itemHeight]="itemHeight" [viewCache]="BufferAmount">-->
<!-- <div *liVirtualItem="let item; let i=index" class="d-flex list-container">-->
<!-- <ng-container [ngTemplateOutlet]="handle" [ngTemplateOutletContext]="{ $implicit: item, idx: i, isVirtualized: true }"></ng-container>-->
<!-- <ng-container [ngTemplateOutlet]="itemTemplate" [ngTemplateOutletContext]="{ $implicit: item, idx: i }"></ng-container>-->
<!-- <ng-container [ngTemplateOutlet]="removeBtn" [ngTemplateOutletContext]="{$implicit: item, idx: i}"></ng-container>-->
<!-- </div>-->
<!-- </li-virtual-scroll>-->
<virtual-scroller #scroll [items]="items" [bufferAmount]="BufferAmount" [parentScroll]="parentScroll">
<div class="example-box" *ngFor="let item of scroll.viewPortItems; index as i; trackBy: trackByIdentity">
@ -46,7 +37,7 @@
<ng-container *ngIf="accessibilityMode">
<label for="reorder-{{idx}}" class="form-label visually-hidden">{{t('reorder-label')}}</label>
<input id="reorder-{{idx}}" class="form-control manual-input" type="number" inputmode="numeric" min="0"
[max]="items.length - 1" [value]="idx"
[max]="items.length - 1" [value]="item.order"
(focusout)="updateIndex(idx, item)" (keydown.enter)="updateIndex(idx, item)" aria-describedby="instructions">
</ng-container>
<ng-container *ngIf="bulkMode">

View file

@ -66,8 +66,10 @@ export class DraggableOrderedListComponent {
* When enabled, draggability is disabled and a checkbox renders instead of order box or drag handle
*/
@Input() bulkMode: boolean = false;
@Input({required: true}) itemHeight: number = 60;
@Input() trackByIdentity: TrackByFunction<any> = (index: number, item: any) => `${item.id}_${item.order}_${item.title}`;
/**
* After an item is re-ordered, you MUST reload from backend the new data. This is because accessibility mode will use item.order which needs to be in sync.
*/
@Output() orderUpdated: EventEmitter<IndexUpdateEvent> = new EventEmitter<IndexUpdateEvent>();
@Output() itemRemove: EventEmitter<ItemRemoveEvent> = new EventEmitter<ItemRemoveEvent>();
@ContentChild('draggableItem') itemTemplate!: TemplateRef<any>;

View file

@ -127,7 +127,7 @@
</ng-template>
<app-draggable-ordered-list [items]="items" (orderUpdated)="orderUpdated($event)" [accessibilityMode]="accessibilityMode"
[showRemoveButton]="false" [itemHeight]="148" [virtualizeAfter]="10">
[showRemoveButton]="false">
<ng-template #draggableItem let-item let-position="idx">
<app-reading-list-item [ngClass]="{'content-container': items.length < 100, 'non-virtualized-container': items.length >= 100}" [item]="item" [position]="position" [libraryTypes]="libraryTypes"
[promoted]="item.promoted" (read)="readChapter($event)" (remove)="itemRemoved($event, position)"></app-reading-list-item>

View file

@ -46,7 +46,11 @@ import {Title} from "@angular/platform-browser";
styleUrls: ['./reading-list-detail.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [SideNavCompanionBarComponent, NgIf, CardActionablesComponent, ImageComponent, NgbDropdown, NgbDropdownToggle, NgbDropdownMenu, NgbDropdownItem, ReadMoreComponent, BadgeExpanderComponent, PersonBadgeComponent, A11yClickDirective, LoadingComponent, DraggableOrderedListComponent, ReadingListItemComponent, NgClass, AsyncPipe, DecimalPipe, DatePipe, TranslocoDirective, MetadataDetailComponent]
imports: [SideNavCompanionBarComponent, NgIf, CardActionablesComponent, ImageComponent, NgbDropdown,
NgbDropdownToggle, NgbDropdownMenu, NgbDropdownItem, ReadMoreComponent, BadgeExpanderComponent,
PersonBadgeComponent, A11yClickDirective, LoadingComponent, DraggableOrderedListComponent,
ReadingListItemComponent, NgClass, AsyncPipe, DecimalPipe, DatePipe, TranslocoDirective,
MetadataDetailComponent]
})
export class ReadingListDetailComponent implements OnInit {
items: Array<ReadingListItem> = [];
@ -56,11 +60,7 @@ export class ReadingListDetailComponent implements OnInit {
isAdmin: boolean = false;
isLoading: boolean = false;
accessibilityMode: boolean = false;
// Downloading
hasDownloadingRole: boolean = false;
downloadInProgress: boolean = false;
readingListSummary: string = '';
libraryTypes: {[key: number]: LibraryType} = {};
@ -131,7 +131,7 @@ export class ReadingListDetailComponent implements OnInit {
this.cdRef.markForCheck();
this.readingListService.getListItems(this.listId).subscribe(items => {
this.items = items;
this.items = [...items];
this.isLoading = false;
this.cdRef.markForCheck();
});
@ -178,7 +178,9 @@ export class ReadingListDetailComponent implements OnInit {
orderUpdated(event: IndexUpdateEvent) {
if (!this.readingList) return;
this.readingListService.updatePosition(this.readingList.id, event.item.id, event.fromPosition, event.toPosition).subscribe();
this.readingListService.updatePosition(this.readingList.id, event.item.id, event.fromPosition, event.toPosition).subscribe(() => {
this.getListItems();
});
}
itemRemoved(item: ReadingListItem, position: number) {