Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Merge branch 'fix/issue-401' into feature/any-all-filtering

Michael Shamoon14d04ff8d291
diff --cc src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.scss
index a937291f3,5863cc5b6..51c42b859
--- a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.scss
+++ b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.scss
@@@ -13,25 -13,14 +13,37 @@@
}
}
+.btn-group-xs {
+ > .btn {
+ padding: 0.2rem 0.25rem;
+ font-size: 0.675rem;
+ line-height: 1.2;
+ border-radius: 0.15rem;
+ }
+
+ > .btn:not(:first-child) {
+ border-top-left-radius: 0;
+ border-bottom-left-radius: 0;
+ }
+
+ > .btn:not(:last-child) {
+ border-top-right-radius: 0;
+ border-bottom-right-radius: 0;
+ }
+}
+
+.btn-group > label.disabled {
+ filter: brightness(0.5);
+}
++
+ small > svg {
+ margin-top: -2px;
+ }
+
+ .list-group-item-note {
+ line-height: 1;
+
+ small {
+ font-size: 70%;
+ }
+ }
diff --cc src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.ts
index a63183575,70361e255..090385fac
--- 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
@@@ -85,7 -87,28 +89,27 @@@ export class FilterableDropdownSelectio
if (fireEvent) {
this.changed.next(this)
}
-
+ }
+
+ exclude(id: number, fireEvent:boolean = true) {
+ let state = this.temporarySelectionStates.get(id)
+ if (state == null || state != ToggleableItemState.Excluded) {
+ this.temporarySelectionStates.set(id, ToggleableItemState.Excluded)
+ } else if (state == ToggleableItemState.Excluded) {
+ this.temporarySelectionStates.delete(id)
+ }
+
+ if (!this.multiple) {
+ for (let key of this.temporarySelectionStates.keys()) {
+ if (key != id) {
+ this.temporarySelectionStates.delete(key)
+ }
+ }
+ }
+ if (fireEvent) {
+ this.changed.next(this)
+ }
}
private getNonTemporary(id: number) {
diff --cc src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts
index b12fe00f0,597e15c61..b5cca38ac
--- 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 +8,7 @@@ import { DocumentTypeService } from 'sr
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_TAGS_ALL, FILTER_HAS_TAGS_ANY, 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 { FILTER_ADDED_AFTER, FILTER_ADDED_BEFORE, FILTER_CORRESPONDENT, FILTER_CREATED_AFTER, FILTER_CREATED_BEFORE, FILTER_DOCUMENT_TYPE, FILTER_HAS_ANY_TAG, FILTER_HAS_TAGS_ALL, FILTER_HAS_TAGS_ANY, 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';
@@@ -129,10 -128,12 +132,13 @@@ export class FilterEditorComponent impl
if (this.tagSelectionModel.isNoneSelected()) {
filterRules.push({rule_type: FILTER_HAS_ANY_TAG, value: "false"})
} else {
+ const tagFilterType = this.tagSelectionModel.logicalOperator == 'and' ? FILTER_HAS_TAGS_ALL : FILTER_HAS_TAGS_ANY
this.tagSelectionModel.getSelectedItems().filter(tag => tag.id).forEach(tag => {
- filterRules.push({rule_type: FILTER_HAS_TAG, value: tag.id?.toString()})
+ filterRules.push({rule_type: tagFilterType, 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()})