diff --git a/src-ui/src/app/app.module.ts b/src-ui/src/app/app.module.ts
index 29c85341b..3d0a7e3c7 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'
@@ -142,6 +143,7 @@ function initializeApp(settings: SettingsService) {
DocumentTypeEditDialogComponent,
StoragePathEditDialogComponent,
TagComponent,
+ ClearableBadge,
PageHeaderComponent,
AppFrameComponent,
ToastsComponent,
diff --git a/src-ui/src/app/components/app-frame/app-frame.component.html b/src-ui/src/app/components/app-frame/app-frame.component.html
index 3700105f3..41bd50970 100644
--- a/src-ui/src/app/components/app-frame/app-frame.component.html
+++ b/src-ui/src/app/components/app-frame/app-frame.component.html
@@ -16,7 +16,12 @@
+ [formControl]="searchField" [ngbTypeahead]="searchAutoComplete" (keyup)="searchFieldKeyup($event)" (selectItem)="itemSelected($event)" i18n-placeholder>
+
diff --git a/src-ui/src/app/components/app-frame/app-frame.component.scss b/src-ui/src/app/components/app-frame/app-frame.component.scss
index 755f20696..0bd96f33e 100644
--- a/src-ui/src/app/components/app-frame/app-frame.component.scss
+++ b/src-ui/src/app/components/app-frame/app-frame.component.scss
@@ -243,17 +243,18 @@ main {
form {
position: relative;
+
+ > svg {
+ position: absolute;
+ left: 0.6rem;
+ top: 0.5rem;
+ color: rgba(255, 255, 255, 0.6);
+ }
}
- svg {
- position: absolute;
- left: 0.6rem;
- top: 0.5rem;
- color: rgba(255, 255, 255, 0.6);
- }
&:focus-within {
- svg {
+ form > svg {
display: none;
}
diff --git a/src-ui/src/app/components/app-frame/app-frame.component.ts b/src-ui/src/app/components/app-frame/app-frame.component.ts
index b189409a8..d637a32b6 100644
--- a/src-ui/src/app/components/app-frame/app-frame.component.ts
+++ b/src-ui/src/app/components/app-frame/app-frame.component.ts
@@ -93,6 +93,20 @@ export class AppFrameComponent implements OnInit, ComponentCanDeactivate {
searchField = new FormControl('')
+ get searchFieldEmpty(): boolean {
+ return this.searchField.value.trim().length == 0
+ }
+
+ resetSearchField() {
+ this.searchField.reset('')
+ }
+
+ searchFieldKeyup(event: KeyboardEvent) {
+ if (event.key == 'Escape') {
+ this.resetSearchField()
+ }
+ }
+
get openDocuments(): PaperlessDocument[] {
return this.openDocumentsService.getOpenDocuments()
}
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..57b3ba39a
--- /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..68f6478c4
--- /dev/null
+++ b/src-ui/src/app/components/common/clearable-badge/clearable-badge.component.scss
@@ -0,0 +1,28 @@
+.badge {
+ min-width: 20px;
+ min-height: 20px;
+}
+
+.x {
+ display: none;
+}
+
+.number {
+ min-width: 1em;
+ min-height: 1em;
+ display: inline-block;
+}
+
+button:hover {
+ .check,
+ .number {
+ opacity: 0 !important;
+ }
+
+ .x {
+ display: inline-block;
+ position: absolute;
+ top: 5px;
+ left: calc(50% - 4px);
+ }
+}
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 c99c71cda..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,9 +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 d5eb29e90..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,12 +5,7 @@
{{title}}
0">
-
- {{selectionModel.totalCount}}selected
-
-
- selected
-
+ 0" (cleared)="reset()">
diff --git a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.scss b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.scss
index 0e8796b3d..82ad7e7a5 100644
--- a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.scss
+++ b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.scss
@@ -21,3 +21,7 @@
input[type="text"] {
min-width: 120px;
}
+
+.z-10 {
+ z-index: 10;
+}
diff --git a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts
index 14643875f..44f524149 100644
--- a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts
+++ b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts
@@ -709,15 +709,23 @@ export class FilterEditorComponent implements OnInit, OnDestroy {
this.updateRules()
}
- textFilterEnter() {
- const filterString = (
- this.textFilterInput.nativeElement as HTMLInputElement
- ).value
- if (filterString.length) {
- this.updateTextFilter(filterString)
+ textFilterKeyup(event: KeyboardEvent) {
+ if (event.key == 'Enter') {
+ const filterString = (
+ this.textFilterInput.nativeElement as HTMLInputElement
+ ).value
+ if (filterString.length) {
+ this.updateTextFilter(filterString)
+ }
+ } else if (event.key == 'Escape') {
+ this.resetTextField()
}
}
+ resetTextField() {
+ this.updateTextFilter('')
+ }
+
changeTextFilterTarget(target) {
if (
this.textFilterTarget == TEXT_FILTER_TARGET_FULLTEXT_MORELIKE &&
diff --git a/src-ui/src/styles.scss b/src-ui/src/styles.scss
index 0bde8364c..fcb69c913 100644
--- a/src-ui/src/styles.scss
+++ b/src-ui/src/styles.scss
@@ -587,7 +587,7 @@ a.badge {
border-radius: 0.15rem;
}
- > .btn:not(:first-child) {
+ > .btn:not(:first-child):not(:nth-child(2)) {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}