hide on card mouseleave

This commit is contained in:
Michael Shamoon 2021-02-06 14:54:36 -08:00
parent 37b3a30619
commit dcb17f2f21
4 changed files with 6 additions and 15 deletions

View File

@ -1,5 +1,5 @@
<div class="col p-2 h-100">
<div class="card h-100 shadow-sm document-card" [class.card-selected]="selected" [class.popover-hidden]="popoverHidden">
<div class="card h-100 shadow-sm document-card" [class.card-selected]="selected" [class.popover-hidden]="popoverHidden" (mouseleave)="mouseLeaveCard()">
<div class="border-bottom doc-img-container" [class.doc-img-background-selected]="selected" (click)="this.toggleSelected.emit($event)">
<img class="card-img doc-img rounded-top" [src]="getThumbUrl()">

View File

@ -32,9 +32,6 @@ export class DocumentCardSmallComponent implements OnInit {
moreTags: number = null
@Output()
showPreview = new EventEmitter<DocumentCardSmallComponent>()
@ViewChild('popover') popover: NgbPopover
mouseOnPreview = false
@ -91,7 +88,6 @@ export class DocumentCardSmallComponent implements OnInit {
if (this.mouseOnPreview) {
// show popover
this.popoverHidden = false
this.showPreview.emit(this)
} else {
this.popover.close()
}
@ -102,4 +98,8 @@ export class DocumentCardSmallComponent implements OnInit {
mouseLeavePreview() {
this.mouseOnPreview = false
}
mouseLeaveCard() {
this.popover.close()
}
}

View File

@ -170,5 +170,5 @@
</table>
<div class="m-n2 row row-cols-paperless-cards" *ngIf="displayMode == 'smallCards'">
<app-document-card-small [selected]="list.isSelected(d)" (toggleSelected)="toggleSelected(d, $event)" (showPreview)="closeAllPopovers($event)" [document]="d" *ngFor="let d of list.documents; trackBy: trackByDocumentId" (clickTag)="clickTag($event)" (clickCorrespondent)="clickCorrespondent($event)"></app-document-card-small>
<app-document-card-small [selected]="list.isSelected(d)" (toggleSelected)="toggleSelected(d, $event)" [document]="d" *ngFor="let d of list.documents; trackBy: trackByDocumentId" (clickTag)="clickTag($event)" (clickCorrespondent)="clickCorrespondent($event)"></app-document-card-small>
</div>

View File

@ -12,7 +12,6 @@ import { SavedViewService } from 'src/app/services/rest/saved-view.service';
import { Toast, ToastService } from 'src/app/services/toast.service';
import { FilterEditorComponent } from './filter-editor/filter-editor.component';
import { SaveViewConfigDialogComponent } from './save-view-config-dialog/save-view-config-dialog.component';
import { DocumentCardSmallComponent } from './document-card-small/document-card-small.component';
@Component({
selector: 'app-document-list',
@ -42,8 +41,6 @@ export class DocumentListComponent implements OnInit, OnDestroy {
private consumptionFinishedSubscription: Subscription
@ViewChildren(DocumentCardSmallComponent) smallCards: QueryList<DocumentCardSmallComponent>
get isFiltered() {
return this.list.filterRules?.length > 0
}
@ -207,10 +204,4 @@ export class DocumentListComponent implements OnInit, OnDestroy {
trackByDocumentId(index, item: PaperlessDocument) {
return item.id
}
closeAllPopovers(cardOpening: DocumentCardSmallComponent) {
this.smallCards.forEach(card => {
if (card !== cardOpening) card.popover.close()
})
}
}