diff --git a/src-ui/src/app/components/common/filterable-dropdown/toggleable-dropdown-button/toggleable-dropdown-button.component.ts b/src-ui/src/app/components/common/filterable-dropdown/toggleable-dropdown-button/toggleable-dropdown-button.component.ts
index f082dfe67..cf84231b1 100644
--- a/src-ui/src/app/components/common/filterable-dropdown/toggleable-dropdown-button/toggleable-dropdown-button.component.ts
+++ b/src-ui/src/app/components/common/filterable-dropdown/toggleable-dropdown-button/toggleable-dropdown-button.component.ts
@@ -10,7 +10,8 @@ export interface ToggleableItem {
export enum ToggleableItemState {
NotSelected = 0,
Selected = 1,
- PartiallySelected = 2
+ PartiallySelected = 2,
+ Excluded = 3
}
@Component({
@@ -32,12 +33,19 @@ export class ToggleableDropdownButtonComponent {
@Output()
toggle = new EventEmitter()
+ @Output()
+ exclude = new EventEmitter()
+
get isTag(): boolean {
return 'is_inbox_tag' in this.item
}
- toggleItem(): void {
- this.toggle.emit()
+ toggleItem(event: MouseEvent): void {
+ if (event.altKey) {
+ this.exclude.emit()
+ } else {
+ this.toggle.emit()
+ }
}
isChecked() {
@@ -48,4 +56,7 @@ export class ToggleableDropdownButtonComponent {
return this.state == ToggleableItemState.PartiallySelected
}
+ isExcluded() {
+ return this.state == ToggleableItemState.Excluded
+ }
}
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 a9111bc9f..597e15c61 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
@@ -8,7 +8,7 @@ import { DocumentTypeService } from 'src/app/services/rest/document-type.service
import { TagService } from 'src/app/services/rest/tag.service';
import { CorrespondentService } from 'src/app/services/rest/correspondent.service';
import { FilterRule } from 'src/app/data/filter-rule';
-import { FILTER_ADDED_AFTER, FILTER_ADDED_BEFORE, FILTER_CORRESPONDENT, FILTER_CREATED_AFTER, FILTER_CREATED_BEFORE, FILTER_DOCUMENT_TYPE, FILTER_HAS_ANY_TAG, FILTER_HAS_TAG, FILTER_TITLE } from 'src/app/data/filter-rule-type';
+import { FILTER_ADDED_AFTER, FILTER_ADDED_BEFORE, FILTER_CORRESPONDENT, FILTER_CREATED_AFTER, FILTER_CREATED_BEFORE, FILTER_DOCUMENT_TYPE, FILTER_HAS_ANY_TAG, FILTER_HAS_TAG, FILTER_DOES_NOT_HAVE_TAG, FILTER_TITLE } from 'src/app/data/filter-rule-type';
import { FilterableDropdownSelectionModel } from '../../common/filterable-dropdown/filterable-dropdown.component';
import { ToggleableItemState } from '../../common/filterable-dropdown/toggleable-dropdown-button/toggleable-dropdown-button.component';
@@ -107,6 +107,9 @@ export class FilterEditorComponent implements OnInit, OnDestroy {
case FILTER_HAS_ANY_TAG:
this.tagSelectionModel.set(null, ToggleableItemState.Selected, false)
break
+ case FILTER_DOES_NOT_HAVE_TAG:
+ this.tagSelectionModel.set(rule.value ? +rule.value : null, ToggleableItemState.Excluded, false)
+ break
case FILTER_CORRESPONDENT:
this.correspondentSelectionModel.set(rule.value ? +rule.value : null, ToggleableItemState.Selected, false)
break
@@ -128,6 +131,9 @@ export class FilterEditorComponent implements OnInit, OnDestroy {
this.tagSelectionModel.getSelectedItems().filter(tag => tag.id).forEach(tag => {
filterRules.push({rule_type: FILTER_HAS_TAG, value: tag.id?.toString()})
})
+ this.tagSelectionModel.getExcludedItems().filter(tag => tag.id).forEach(tag => {
+ filterRules.push({rule_type: FILTER_DOES_NOT_HAVE_TAG, value: tag.id?.toString()})
+ })
}
this.correspondentSelectionModel.getSelectedItems().forEach(correspondent => {
filterRules.push({rule_type: FILTER_CORRESPONDENT, value: correspondent.id?.toString()})