A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Performance: use NgOptimizedImage for thumbnail lazy loading (#13169)
shamoon80210bd3bf54
diff --git a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.htmlindex 08d232185..facd0ca27 100644--- a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html+++ b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html@@ -2,7 +2,7 @@<div class="row g-0"><div class="col-md-2 doc-img-container rounded-start" (click)="this.toggleSelected.emit($event)" (dblclick)="dblClickDocument.emit()">@if (document()) {- <img [src]="getThumbUrl()" class="card-img doc-img border-end rounded-start" [class.inverted]="getIsThumbInverted()">+ <img [ngSrc]="getThumbUrl()" fill class="card-img doc-img border-end rounded-start" [class.inverted]="getIsThumbInverted()"><div class="border-end border-bottom bg-light document-card-check"><div class="form-check">diff --git a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.spec.ts b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.spec.tsindex d50bba65f..421754618 100644--- a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.spec.ts+++ b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.spec.ts@@ -88,6 +88,12 @@ describe('DocumentCardLargeComponent', () => {expect(fixture.nativeElement.textContent).toContain('8 pages')})+ it('should lazy load the thumbnail', () => {+ const thumbnail: HTMLImageElement =+ fixture.nativeElement.querySelector('img.doc-img')+ expect(thumbnail.getAttribute('loading')).toEqual('lazy')+ })+it('should trim content', () => {expect(component.contentTrimmed).toHaveLength(503) // includes ...})diff --git a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.ts b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.tsindex 1dac73959..9304d1168 100644--- a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.ts+++ b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.ts@@ -1,4 +1,4 @@-import { AsyncPipe } from '@angular/common'+import { AsyncPipe, NgOptimizedImage } from '@angular/common'import {AfterViewInit,Component,@@ -46,6 +46,7 @@ import { LoadingComponentWithPermissions } from '../../loading-component/loadingTagComponent,CustomFieldDisplayComponent,AsyncPipe,+ NgOptimizedImage,UsernamePipe,CorrespondentNamePipe,DocumentTypeNamePipe,diff --git a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.htmlindex a7a30c790..7a0a507e6 100644--- a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html+++ b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html@@ -2,7 +2,7 @@<div class="card h-100 shadow-sm document-card" [class.placeholder-glow]="!document()" [class.card-selected]="selected()" (mouseleave)="mouseLeaveCard()"><div class="border-bottom doc-img-container rounded-top" (click)="this.toggleSelected.emit($event)" (dblclick)="dblClickDocument.emit(this)">@if (document()) {- <img class="card-img doc-img" [class.inverted]="getIsThumbInverted()" [src]="getThumbUrl()">+ <img class="card-img doc-img" [class.inverted]="getIsThumbInverted()" [ngSrc]="getThumbUrl()" fill><div class="border-end border-bottom bg-light py-1 px-2 document-card-check"><div class="form-check">diff --git a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.scss b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.scssindex 6f2260e47..9dd7ed5cf 100644--- a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.scss+++ b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.scss@@ -22,10 +22,14 @@}}+.doc-img-container {+ position: relative;+ height: 180px;+}+.doc-img {object-fit: cover;object-position: top left;- height: 180px;}.document-card-check {diff --git a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.spec.ts b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.spec.tsindex 45b812462..c6127494b 100644--- a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.spec.ts+++ b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.spec.ts@@ -61,6 +61,12 @@ describe('DocumentCardSmallComponent', () => {expect(fixture.nativeElement.textContent).toContain('12 pages')})+ it('should lazy load the thumbnail', () => {+ const thumbnail: HTMLImageElement =+ fixture.nativeElement.querySelector('img.doc-img')+ expect(thumbnail.getAttribute('loading')).toEqual('lazy')+ })+it('should display a document, limit tags to 5', () => {expect(fixture.nativeElement.textContent).toContain('Document 10')expect(diff --git a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.tsindex 1e45b982a..633ad3e2e 100644--- a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts+++ b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts@@ -1,4 +1,4 @@-import { AsyncPipe } from '@angular/common'+import { AsyncPipe, NgOptimizedImage } from '@angular/common'import {AfterViewInit,Component,@@ -46,6 +46,7 @@ import { LoadingComponentWithPermissions } from '../../loading-component/loadingTagComponent,CustomFieldDisplayComponent,AsyncPipe,+ NgOptimizedImage,UsernamePipe,CorrespondentNamePipe,DocumentTypeNamePipe,