From f8eaf397b792996c77b98a25e7b3230b7d52422f Mon Sep 17 00:00:00 2001 From: "Lisa Flinn (She/Her)" Date: Thu, 16 May 2024 11:33:20 +0100 Subject: [PATCH] initial fix --- src/app/components/fileupload/fileupload.ts | 14 +++++++++++++- src/app/components/table/table.ts | 16 ++++++++++++++++ src/app/showcase/doc/avatar/imagedoc.ts | 2 +- src/app/showcase/doc/fileupload/templatedoc.ts | 4 ++-- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/app/components/fileupload/fileupload.ts b/src/app/components/fileupload/fileupload.ts index 2582bce2b90..6eb20ef3e5b 100755 --- a/src/app/components/fileupload/fileupload.ts +++ b/src/app/components/fileupload/fileupload.ts @@ -140,7 +140,19 @@ import { FileBeforeUploadEvent, FileProgressEvent, FileRemoveEvent, FileSelectEv
diff --git a/src/app/components/table/table.ts b/src/app/components/table/table.ts index 89c318ba1e2..c1904d9be15 100644 --- a/src/app/components/table/table.ts +++ b/src/app/components/table/table.ts @@ -5326,6 +5326,8 @@ export class ColumnFilter implements AfterContentInit { overlayId: any; + applyHasBeenClicked: boolean = false; + get fieldConstraints(): FilterMetadata[] | undefined | null { return this.dt.filters ? this.dt.filters[this.field] : null; } @@ -5572,6 +5574,10 @@ export class ColumnFilter implements AfterContentInit { } onEscape() { + if (this.hasFilterNotBeenApplied()) { + this.clearFilter(); + } + this.applyHasBeenClicked = false; this.overlayVisible = false; this.icon?.nativeElement.focus(); } @@ -5672,6 +5678,10 @@ export class ColumnFilter implements AfterContentInit { return false; } + hasFilterNotBeenApplied(): boolean { + return this.hasFilter() && !this.applyHasBeenClicked; + } + isOutsideClicked(event: any): boolean { return !( DomHandler.hasClass(this.overlay?.nextElementSibling, 'p-overlay') || @@ -5746,6 +5756,10 @@ export class ColumnFilter implements AfterContentInit { } hide() { + if (this.hasFilterNotBeenApplied()) { + this.clearFilter(); + } + this.applyHasBeenClicked = false; this.overlayVisible = false; this.cd.markForCheck(); } @@ -5758,12 +5772,14 @@ export class ColumnFilter implements AfterContentInit { } clearFilter() { + this.applyHasBeenClicked = false; this.initFieldFilterConstraint(); this.dt._filter(); if (this.hideOnClear) this.hide(); } applyFilter() { + this.applyHasBeenClicked = true; this.dt._filter(); this.hide(); } diff --git a/src/app/showcase/doc/avatar/imagedoc.ts b/src/app/showcase/doc/avatar/imagedoc.ts index cdf526c26de..fe9b42a023f 100644 --- a/src/app/showcase/doc/avatar/imagedoc.ts +++ b/src/app/showcase/doc/avatar/imagedoc.ts @@ -16,7 +16,7 @@ import { Code } from '@domain/code';
Badge
- +
Gravatar
diff --git a/src/app/showcase/doc/fileupload/templatedoc.ts b/src/app/showcase/doc/fileupload/templatedoc.ts index 1f12a64e645..e2b5bd02458 100644 --- a/src/app/showcase/doc/fileupload/templatedoc.ts +++ b/src/app/showcase/doc/fileupload/templatedoc.ts @@ -73,9 +73,9 @@ import { MessageService, PrimeNGConfig } from 'primeng/api'; export class TemplateDoc { files = []; - totalSize : number = 0; + totalSize: number = 0; - totalSizePercent : number = 0; + totalSizePercent: number = 0; constructor(private config: PrimeNGConfig, private messageService: MessageService) {}