diff --git a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.html b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.html
index d5eb29e90..eef92c4eb 100644
--- a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.html
+++ b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.html
@@ -8,8 +8,10 @@
-
selected
+
+ selected
From 0993fc07a3d813b8e200bb1df1fdfe295e389773 Mon Sep 17 00:00:00 2001
From: Michael Shamoon <4887959+shamoon@users.noreply.github.com>
Date: Sat, 29 Oct 2022 15:03:27 -0700
Subject: [PATCH 5/6] Add "clearable" badge
---
src-ui/src/app/app.module.ts | 2 ++
.../clearable-badge.component.html | 9 +++++
.../clearable-badge.component.scss | 25 ++++++++++++++
.../clearable-badge.component.ts | 33 +++++++++++++++++++
.../date-dropdown.component.html | 6 +---
.../date-dropdown/date-dropdown.component.ts | 7 ++++
.../filterable-dropdown.component.html | 9 +----
.../filterable-dropdown.component.ts | 5 +++
8 files changed, 83 insertions(+), 13 deletions(-)
create mode 100644 src-ui/src/app/components/common/clearable-badge/clearable-badge.component.html
create mode 100644 src-ui/src/app/components/common/clearable-badge/clearable-badge.component.scss
create mode 100644 src-ui/src/app/components/common/clearable-badge/clearable-badge.component.ts
diff --git a/src-ui/src/app/app.module.ts b/src-ui/src/app/app.module.ts
index 02fd8ea66..c5afc6942 100644
--- a/src-ui/src/app/app.module.ts
+++ b/src-ui/src/app/app.module.ts
@@ -24,6 +24,7 @@ import { CorrespondentEditDialogComponent } from './components/common/edit-dialo
import { TagEditDialogComponent } from './components/common/edit-dialog/tag-edit-dialog/tag-edit-dialog.component'
import { DocumentTypeEditDialogComponent } from './components/common/edit-dialog/document-type-edit-dialog/document-type-edit-dialog.component'
import { TagComponent } from './components/common/tag/tag.component'
+import { ClearableBadge } from './components/common/clearable-badge/clearable-badge.component'
import { PageHeaderComponent } from './components/common/page-header/page-header.component'
import { AppFrameComponent } from './components/app-frame/app-frame.component'
import { ToastsComponent } from './components/common/toasts/toasts.component'
@@ -141,6 +142,7 @@ function initializeApp(settings: SettingsService) {
DocumentTypeEditDialogComponent,
StoragePathEditDialogComponent,
TagComponent,
+ ClearableBadge,
PageHeaderComponent,
AppFrameComponent,
ToastsComponent,
diff --git a/src-ui/src/app/components/common/clearable-badge/clearable-badge.component.html b/src-ui/src/app/components/common/clearable-badge/clearable-badge.component.html
new file mode 100644
index 000000000..64727e0d8
--- /dev/null
+++ b/src-ui/src/app/components/common/clearable-badge/clearable-badge.component.html
@@ -0,0 +1,9 @@
+
diff --git a/src-ui/src/app/components/common/clearable-badge/clearable-badge.component.scss b/src-ui/src/app/components/common/clearable-badge/clearable-badge.component.scss
new file mode 100644
index 000000000..14ca3fd2b
--- /dev/null
+++ b/src-ui/src/app/components/common/clearable-badge/clearable-badge.component.scss
@@ -0,0 +1,25 @@
+.badge {
+ width: 20px;
+ height: 20px;
+}
+
+.x {
+ display: none;
+}
+
+.number {
+ width: 1em;
+ height: 1em;
+ display: inline-block;
+}
+
+button:hover {
+ .check,
+ .number {
+ display: none;
+ }
+
+ .x {
+ display: inline-block;
+ }
+}
diff --git a/src-ui/src/app/components/common/clearable-badge/clearable-badge.component.ts b/src-ui/src/app/components/common/clearable-badge/clearable-badge.component.ts
new file mode 100644
index 000000000..93f63d4d8
--- /dev/null
+++ b/src-ui/src/app/components/common/clearable-badge/clearable-badge.component.ts
@@ -0,0 +1,33 @@
+import { Component, Input, Output, EventEmitter } from '@angular/core'
+
+@Component({
+ selector: 'app-clearable-badge',
+ templateUrl: './clearable-badge.component.html',
+ styleUrls: ['./clearable-badge.component.scss'],
+})
+export class ClearableBadge {
+ constructor() {}
+
+ @Input()
+ number: number
+
+ @Input()
+ selected: boolean
+
+ @Output()
+ cleared: EventEmitter
= new EventEmitter()
+
+ get active(): boolean {
+ return this.selected || this.number > -1
+ }
+
+ get isNumbered(): boolean {
+ return this.number > -1
+ }
+
+ onClick(event: PointerEvent) {
+ this.cleared.emit(true)
+ event.stopImmediatePropagation()
+ event.preventDefault()
+ }
+}
diff --git a/src-ui/src/app/components/common/date-dropdown/date-dropdown.component.html b/src-ui/src/app/components/common/date-dropdown/date-dropdown.component.html
index dc8ae8688..58634b4d0 100644
--- a/src-ui/src/app/components/common/date-dropdown/date-dropdown.component.html
+++ b/src-ui/src/app/components/common/date-dropdown/date-dropdown.component.html
@@ -1,11 +1,7 @@
diff --git a/src-ui/src/app/components/common/date-dropdown/date-dropdown.component.ts b/src-ui/src/app/components/common/date-dropdown/date-dropdown.component.ts
index 9eb4c477a..e901acfeb 100644
--- a/src-ui/src/app/components/common/date-dropdown/date-dropdown.component.ts
+++ b/src-ui/src/app/components/common/date-dropdown/date-dropdown.component.ts
@@ -106,6 +106,13 @@ export class DateDropdownComponent implements OnInit, OnDestroy {
}
}
+ reset() {
+ this.dateBefore = null
+ this.dateAfter = null
+ this.relativeDate = null
+ this.onChange()
+ }
+
setRelativeDate(rd: RelativeDate) {
this.dateBefore = null
this.dateAfter = null
diff --git a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.html b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.html
index eef92c4eb..9ce3c8da2 100644
--- a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.html
+++ b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.html
@@ -5,14 +5,7 @@
{{title}}
0">
-
- {{selectionModel.totalCount}}selected
-
-
- selected
-
+ 0" (cleared)="reset()">
diff --git a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.ts b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.ts
index 9a16b4426..373f0aa5d 100644
--- a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.ts
+++ b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.ts
@@ -384,4 +384,9 @@ export class FilterableDropdownComponent {
this.selectionModel.exclude(itemID)
}
}
+
+ reset() {
+ this.selectionModel.reset()
+ this.selectionModelChange.emit(this.selectionModel)
+ }
}
From 9b3243533c1a3c511742e2cd0011fe7b6e4a61df Mon Sep 17 00:00:00 2001
From: Michael Shamoon <4887959+shamoon@users.noreply.github.com>
Date: Sat, 29 Oct 2022 15:29:50 -0700
Subject: [PATCH 6/6] better positioning in clearable badges
---
.../clearable-badge/clearable-badge.component.html | 2 +-
.../clearable-badge/clearable-badge.component.scss | 13 ++++++++-----
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/src-ui/src/app/components/common/clearable-badge/clearable-badge.component.html b/src-ui/src/app/components/common/clearable-badge/clearable-badge.component.html
index 64727e0d8..57b3ba39a 100644
--- a/src-ui/src/app/components/common/clearable-badge/clearable-badge.component.html
+++ b/src-ui/src/app/components/common/clearable-badge/clearable-badge.component.html
@@ -1,4 +1,4 @@
-