@@ -147,7 +147,7 @@
|
- {{(d.correspondent$ | async)?.name}}
+ {{(d.correspondent$ | async)?.name}}
|
@@ -156,7 +156,7 @@
|
- {{(d.document_type$ | async)?.name}}
+ {{(d.document_type$ | async)?.name}}
|
From 6d786f89878f3d683778d71ce1a2e3582273f0b0 Mon Sep 17 00:00:00 2001
From: Michael Shamoon <4887959+nikonratm@users.noreply.github.com>
Date: Fri, 15 Jan 2021 01:11:06 -0800
Subject: [PATCH 04/61] remove log statement
---
src-ui/src/app/services/document-list-view.service.ts | 1 -
1 file changed, 1 deletion(-)
diff --git a/src-ui/src/app/services/document-list-view.service.ts b/src-ui/src/app/services/document-list-view.service.ts
index 407c81572..13c362918 100644
--- a/src-ui/src/app/services/document-list-view.service.ts
+++ b/src-ui/src/app/services/document-list-view.service.ts
@@ -258,7 +258,6 @@ export class DocumentListViewService {
if (includeRange && this.lastSelectedDocumentIndex !== null) {
const toIndex = this.documentIndexInCurrentView(d.id)
- console.log('select from', this.lastSelectedDocumentIndex, 'to', toIndex);
this.documents.slice(Math.min(this.lastSelectedDocumentIndex, toIndex), Math.max(this.lastSelectedDocumentIndex, toIndex)).forEach(d => {
this.selected.add(d.id)
})
From f94da1cf2730cb520770de650ae9c21eed6f5556 Mon Sep 17 00:00:00 2001
From: Michael Shamoon <4887959+nikonratm@users.noreply.github.com>
Date: Fri, 15 Jan 2021 01:54:33 -0800
Subject: [PATCH 05/61] Allow reversing selection range
---
.../services/document-list-view.service.ts | 30 ++++++++++++++-----
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/src-ui/src/app/services/document-list-view.service.ts b/src-ui/src/app/services/document-list-view.service.ts
index 13c362918..bcfb5468f 100644
--- a/src-ui/src/app/services/document-list-view.service.ts
+++ b/src-ui/src/app/services/document-list-view.service.ts
@@ -28,6 +28,7 @@ export class DocumentListViewService {
currentPageSize: number = this.settings.get(SETTINGS_KEYS.DOCUMENT_LIST_SIZE)
collectionSize: number
lastSelectedDocumentIndex: number
+ lastSelectedDocumentToIndex: number
/**
* This is the current config for the document list. The service will always remember the last settings used for the document list.
@@ -109,7 +110,7 @@ export class DocumentListViewService {
if (onFinish) {
onFinish()
}
- this.lastSelectedDocumentIndex = null
+ this.lastSelectedDocumentIndex = this.lastSelectedDocumentToIndex = null
this.isReloading = false
},
error => {
@@ -220,7 +221,7 @@ export class DocumentListViewService {
selectNone() {
this.selected.clear()
- this.lastSelectedDocumentIndex = null
+ this.lastSelectedDocumentIndex = this.lastSelectedDocumentToIndex = null
}
reduceSelectionToFilter() {
@@ -253,17 +254,30 @@ export class DocumentListViewService {
}
toggleSelected(d: PaperlessDocument, includeRange: boolean): void {
- if (this.selected.has(d.id) && !includeRange) this.selected.delete(d.id)
- else this.selected.add(d.id)
+ if (!includeRange) {
+ // regular i.e. no shift key toggle
+ if (this.selected.has(d.id)) this.selected.delete(d.id)
+ else this.selected.add(d.id)
+ } else if (includeRange && this.lastSelectedDocumentIndex !== null) {
+ const documentToIndex = this.documentIndexInCurrentView(d.id)
+ const fromIndex = Math.min(this.lastSelectedDocumentIndex, documentToIndex)
+ const toIndex = Math.max(this.lastSelectedDocumentIndex, documentToIndex)
+
+ if ((this.lastSelectedDocumentToIndex > this.lastSelectedDocumentIndex && documentToIndex < this.lastSelectedDocumentIndex) ||
+ (this.lastSelectedDocumentToIndex < this.lastSelectedDocumentIndex && documentToIndex > this.lastSelectedDocumentIndex)) {
+ // invert last selected
+ this.documents.slice(Math.min(this.lastSelectedDocumentIndex, this.lastSelectedDocumentToIndex), Math.max(this.lastSelectedDocumentIndex, this.lastSelectedDocumentToIndex) + 1).forEach(d => {
+ this.selected.delete(d.id)
+ })
+ }
- if (includeRange && this.lastSelectedDocumentIndex !== null) {
- const toIndex = this.documentIndexInCurrentView(d.id)
- this.documents.slice(Math.min(this.lastSelectedDocumentIndex, toIndex), Math.max(this.lastSelectedDocumentIndex, toIndex)).forEach(d => {
+ this.documents.slice(fromIndex, toIndex + 1).forEach(d => {
this.selected.add(d.id)
})
+ this.lastSelectedDocumentToIndex = documentToIndex
}
- if (!includeRange || (includeRange && this.lastSelectedDocumentIndex == null)) {
+ if (!includeRange || (includeRange && this.lastSelectedDocumentIndex == null)) { // e.g. shift key but first click
this.lastSelectedDocumentIndex = this.documentIndexInCurrentView(d.id)
}
}
From 48220ceeb8cdba13c81f86f3556163a44c4c3642 Mon Sep 17 00:00:00 2001
From: Michael Shamoon <4887959+nikonratm@users.noreply.github.com>
Date: Fri, 15 Jan 2021 01:59:29 -0800
Subject: [PATCH 06/61] Refactor selection functions to two separate ones for
clarity
---
.../document-list/document-list.component.ts | 3 ++-
.../services/document-list-view.service.ts | 20 +++++++++----------
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/src-ui/src/app/components/document-list/document-list.component.ts b/src-ui/src/app/components/document-list/document-list.component.ts
index a3ec2d664..509c0a735 100644
--- a/src-ui/src/app/components/document-list/document-list.component.ts
+++ b/src-ui/src/app/components/document-list/document-list.component.ts
@@ -161,7 +161,8 @@ export class DocumentListComponent implements OnInit {
}
toggleSelected(document: PaperlessDocument, event: MouseEvent): void {
- this.list.toggleSelected(document, event.shiftKey)
+ if (!event.shiftKey) this.list.toggleSelected(document)
+ else this.list.selectRangeTo(document)
}
clickTag(tagID: number) {
diff --git a/src-ui/src/app/services/document-list-view.service.ts b/src-ui/src/app/services/document-list-view.service.ts
index bcfb5468f..d2b9d75c2 100644
--- a/src-ui/src/app/services/document-list-view.service.ts
+++ b/src-ui/src/app/services/document-list-view.service.ts
@@ -253,19 +253,21 @@ export class DocumentListViewService {
return this.selected.has(d.id)
}
- toggleSelected(d: PaperlessDocument, includeRange: boolean): void {
- if (!includeRange) {
- // regular i.e. no shift key toggle
- if (this.selected.has(d.id)) this.selected.delete(d.id)
- else this.selected.add(d.id)
- } else if (includeRange && this.lastSelectedDocumentIndex !== null) {
+ toggleSelected(d: PaperlessDocument): void {
+ if (this.selected.has(d.id)) this.selected.delete(d.id)
+ else this.selected.add(d.id)
+ this.lastSelectedDocumentIndex = this.documentIndexInCurrentView(d.id)
+ }
+
+ selectRangeTo(d: PaperlessDocument) {
+ if (this.lastSelectedDocumentIndex !== null) {
const documentToIndex = this.documentIndexInCurrentView(d.id)
const fromIndex = Math.min(this.lastSelectedDocumentIndex, documentToIndex)
const toIndex = Math.max(this.lastSelectedDocumentIndex, documentToIndex)
if ((this.lastSelectedDocumentToIndex > this.lastSelectedDocumentIndex && documentToIndex < this.lastSelectedDocumentIndex) ||
(this.lastSelectedDocumentToIndex < this.lastSelectedDocumentIndex && documentToIndex > this.lastSelectedDocumentIndex)) {
- // invert last selected
+ // new click is "opposite side" of anchor so we invert the old selection
this.documents.slice(Math.min(this.lastSelectedDocumentIndex, this.lastSelectedDocumentToIndex), Math.max(this.lastSelectedDocumentIndex, this.lastSelectedDocumentToIndex) + 1).forEach(d => {
this.selected.delete(d.id)
})
@@ -275,9 +277,7 @@ export class DocumentListViewService {
this.selected.add(d.id)
})
this.lastSelectedDocumentToIndex = documentToIndex
- }
-
- if (!includeRange || (includeRange && this.lastSelectedDocumentIndex == null)) { // e.g. shift key but first click
+ } else { // e.g. shift key but was first click
this.lastSelectedDocumentIndex = this.documentIndexInCurrentView(d.id)
}
}
From 86376c8c5f112ce7f014f4988e3a332c7a02f993 Mon Sep 17 00:00:00 2001
From: Michael Shamoon <4887959+nikonratm@users.noreply.github.com>
Date: Fri, 15 Jan 2021 02:09:13 -0800
Subject: [PATCH 07/61] Fix repeat range selections were clashing
---
.../app/services/document-list-view.service.ts | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/src-ui/src/app/services/document-list-view.service.ts b/src-ui/src/app/services/document-list-view.service.ts
index d2b9d75c2..1ebf86d12 100644
--- a/src-ui/src/app/services/document-list-view.service.ts
+++ b/src-ui/src/app/services/document-list-view.service.ts
@@ -257,6 +257,7 @@ export class DocumentListViewService {
if (this.selected.has(d.id)) this.selected.delete(d.id)
else this.selected.add(d.id)
this.lastSelectedDocumentIndex = this.documentIndexInCurrentView(d.id)
+ this.lastSelectedDocumentToIndex = null
}
selectRangeTo(d: PaperlessDocument) {
@@ -265,12 +266,15 @@ export class DocumentListViewService {
const fromIndex = Math.min(this.lastSelectedDocumentIndex, documentToIndex)
const toIndex = Math.max(this.lastSelectedDocumentIndex, documentToIndex)
- if ((this.lastSelectedDocumentToIndex > this.lastSelectedDocumentIndex && documentToIndex < this.lastSelectedDocumentIndex) ||
- (this.lastSelectedDocumentToIndex < this.lastSelectedDocumentIndex && documentToIndex > this.lastSelectedDocumentIndex)) {
- // new click is "opposite side" of anchor so we invert the old selection
- this.documents.slice(Math.min(this.lastSelectedDocumentIndex, this.lastSelectedDocumentToIndex), Math.max(this.lastSelectedDocumentIndex, this.lastSelectedDocumentToIndex) + 1).forEach(d => {
- this.selected.delete(d.id)
- })
+ if (this.lastSelectedDocumentToIndex !== null &&
+ ((this.lastSelectedDocumentToIndex > this.lastSelectedDocumentIndex && documentToIndex < this.lastSelectedDocumentIndex) ||
+ (this.lastSelectedDocumentToIndex < this.lastSelectedDocumentIndex && documentToIndex > this.lastSelectedDocumentIndex))) {
+ console.log('invert');
+
+ // new click is "opposite side" of anchor so we invert the old selection
+ this.documents.slice(Math.min(this.lastSelectedDocumentIndex, this.lastSelectedDocumentToIndex), Math.max(this.lastSelectedDocumentIndex, this.lastSelectedDocumentToIndex) + 1).forEach(d => {
+ this.selected.delete(d.id)
+ })
}
this.documents.slice(fromIndex, toIndex + 1).forEach(d => {
From 8d606b9f34ab13e38b3188e831c84c880c53fba7 Mon Sep 17 00:00:00 2001
From: Michael Shamoon <4887959+nikonratm@users.noreply.github.com>
Date: Fri, 15 Jan 2021 02:13:21 -0800
Subject: [PATCH 08/61] Handle shift-clicking orignal item
---
src-ui/src/app/services/document-list-view.service.ts | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src-ui/src/app/services/document-list-view.service.ts b/src-ui/src/app/services/document-list-view.service.ts
index 1ebf86d12..c7ddbd44e 100644
--- a/src-ui/src/app/services/document-list-view.service.ts
+++ b/src-ui/src/app/services/document-list-view.service.ts
@@ -267,9 +267,8 @@ export class DocumentListViewService {
const toIndex = Math.max(this.lastSelectedDocumentIndex, documentToIndex)
if (this.lastSelectedDocumentToIndex !== null &&
- ((this.lastSelectedDocumentToIndex > this.lastSelectedDocumentIndex && documentToIndex < this.lastSelectedDocumentIndex) ||
- (this.lastSelectedDocumentToIndex < this.lastSelectedDocumentIndex && documentToIndex > this.lastSelectedDocumentIndex))) {
- console.log('invert');
+ ((this.lastSelectedDocumentToIndex > this.lastSelectedDocumentIndex && documentToIndex <= this.lastSelectedDocumentIndex) ||
+ (this.lastSelectedDocumentToIndex < this.lastSelectedDocumentIndex && documentToIndex >= this.lastSelectedDocumentIndex))) {
// new click is "opposite side" of anchor so we invert the old selection
this.documents.slice(Math.min(this.lastSelectedDocumentIndex, this.lastSelectedDocumentToIndex), Math.max(this.lastSelectedDocumentIndex, this.lastSelectedDocumentToIndex) + 1).forEach(d => {
@@ -282,7 +281,7 @@ export class DocumentListViewService {
})
this.lastSelectedDocumentToIndex = documentToIndex
} else { // e.g. shift key but was first click
- this.lastSelectedDocumentIndex = this.documentIndexInCurrentView(d.id)
+ this.toggleSelected(d)
}
}
From 01cd4c7546dd645eda6b3090109a264580fcdde1 Mon Sep 17 00:00:00 2001
From: Michael Shamoon <4887959+nikonratm@users.noreply.github.com>
Date: Fri, 15 Jan 2021 02:15:26 -0800
Subject: [PATCH 09/61] Refactor variable names for clarity
---
.../services/document-list-view.service.ts | 28 +++++++++----------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/src-ui/src/app/services/document-list-view.service.ts b/src-ui/src/app/services/document-list-view.service.ts
index c7ddbd44e..35b6296cc 100644
--- a/src-ui/src/app/services/document-list-view.service.ts
+++ b/src-ui/src/app/services/document-list-view.service.ts
@@ -27,8 +27,8 @@ export class DocumentListViewService {
currentPage = 1
currentPageSize: number = this.settings.get(SETTINGS_KEYS.DOCUMENT_LIST_SIZE)
collectionSize: number
- lastSelectedDocumentIndex: number
- lastSelectedDocumentToIndex: number
+ rangeSelectionAnchorIndex: number
+ lastRangeSelectionToIndex: number
/**
* This is the current config for the document list. The service will always remember the last settings used for the document list.
@@ -110,7 +110,7 @@ export class DocumentListViewService {
if (onFinish) {
onFinish()
}
- this.lastSelectedDocumentIndex = this.lastSelectedDocumentToIndex = null
+ this.rangeSelectionAnchorIndex = this.lastRangeSelectionToIndex = null
this.isReloading = false
},
error => {
@@ -221,7 +221,7 @@ export class DocumentListViewService {
selectNone() {
this.selected.clear()
- this.lastSelectedDocumentIndex = this.lastSelectedDocumentToIndex = null
+ this.rangeSelectionAnchorIndex = this.lastRangeSelectionToIndex = null
}
reduceSelectionToFilter() {
@@ -256,22 +256,22 @@ export class DocumentListViewService {
toggleSelected(d: PaperlessDocument): void {
if (this.selected.has(d.id)) this.selected.delete(d.id)
else this.selected.add(d.id)
- this.lastSelectedDocumentIndex = this.documentIndexInCurrentView(d.id)
- this.lastSelectedDocumentToIndex = null
+ this.rangeSelectionAnchorIndex = this.documentIndexInCurrentView(d.id)
+ this.lastRangeSelectionToIndex = null
}
selectRangeTo(d: PaperlessDocument) {
- if (this.lastSelectedDocumentIndex !== null) {
+ if (this.rangeSelectionAnchorIndex !== null) {
const documentToIndex = this.documentIndexInCurrentView(d.id)
- const fromIndex = Math.min(this.lastSelectedDocumentIndex, documentToIndex)
- const toIndex = Math.max(this.lastSelectedDocumentIndex, documentToIndex)
+ const fromIndex = Math.min(this.rangeSelectionAnchorIndex, documentToIndex)
+ const toIndex = Math.max(this.rangeSelectionAnchorIndex, documentToIndex)
- if (this.lastSelectedDocumentToIndex !== null &&
- ((this.lastSelectedDocumentToIndex > this.lastSelectedDocumentIndex && documentToIndex <= this.lastSelectedDocumentIndex) ||
- (this.lastSelectedDocumentToIndex < this.lastSelectedDocumentIndex && documentToIndex >= this.lastSelectedDocumentIndex))) {
+ if (this.lastRangeSelectionToIndex !== null &&
+ ((this.lastRangeSelectionToIndex > this.rangeSelectionAnchorIndex && documentToIndex <= this.rangeSelectionAnchorIndex) ||
+ (this.lastRangeSelectionToIndex < this.rangeSelectionAnchorIndex && documentToIndex >= this.rangeSelectionAnchorIndex))) {
// new click is "opposite side" of anchor so we invert the old selection
- this.documents.slice(Math.min(this.lastSelectedDocumentIndex, this.lastSelectedDocumentToIndex), Math.max(this.lastSelectedDocumentIndex, this.lastSelectedDocumentToIndex) + 1).forEach(d => {
+ this.documents.slice(Math.min(this.rangeSelectionAnchorIndex, this.lastRangeSelectionToIndex), Math.max(this.rangeSelectionAnchorIndex, this.lastRangeSelectionToIndex) + 1).forEach(d => {
this.selected.delete(d.id)
})
}
@@ -279,7 +279,7 @@ export class DocumentListViewService {
this.documents.slice(fromIndex, toIndex + 1).forEach(d => {
this.selected.add(d.id)
})
- this.lastSelectedDocumentToIndex = documentToIndex
+ this.lastRangeSelectionToIndex = documentToIndex
} else { // e.g. shift key but was first click
this.toggleSelected(d)
}
From 59008ea765cbe8c69425a2add311a8a68f78b9a0 Mon Sep 17 00:00:00 2001
From: Michael Shamoon <4887959+nikonratm@users.noreply.github.com>
Date: Fri, 15 Jan 2021 02:22:10 -0800
Subject: [PATCH 10/61] remove new line =/
---
src-ui/src/app/services/document-list-view.service.ts | 1 -
1 file changed, 1 deletion(-)
diff --git a/src-ui/src/app/services/document-list-view.service.ts b/src-ui/src/app/services/document-list-view.service.ts
index 35b6296cc..1fc5e09c5 100644
--- a/src-ui/src/app/services/document-list-view.service.ts
+++ b/src-ui/src/app/services/document-list-view.service.ts
@@ -269,7 +269,6 @@ export class DocumentListViewService {
if (this.lastRangeSelectionToIndex !== null &&
((this.lastRangeSelectionToIndex > this.rangeSelectionAnchorIndex && documentToIndex <= this.rangeSelectionAnchorIndex) ||
(this.lastRangeSelectionToIndex < this.rangeSelectionAnchorIndex && documentToIndex >= this.rangeSelectionAnchorIndex))) {
-
// new click is "opposite side" of anchor so we invert the old selection
this.documents.slice(Math.min(this.rangeSelectionAnchorIndex, this.lastRangeSelectionToIndex), Math.max(this.rangeSelectionAnchorIndex, this.lastRangeSelectionToIndex) + 1).forEach(d => {
this.selected.delete(d.id)
From 09262666634e92193ff84626cd79d7f1f59d57dc Mon Sep 17 00:00:00 2001
From: jonaswinkler
Date: Fri, 15 Jan 2021 12:50:34 +0100
Subject: [PATCH 11/61] add a language switcher fixes #352
---
src-ui/messages.xlf | 87 +++++++++++++++----
.../manage/settings/settings.component.html | 15 ++++
.../manage/settings/settings.component.ts | 8 +-
src-ui/src/app/services/settings.service.ts | 36 +++++++-
4 files changed, 125 insertions(+), 21 deletions(-)
diff --git a/src-ui/messages.xlf b/src-ui/messages.xlf
index 9b6324a76..a1f0e8b88 100644
--- a/src-ui/messages.xlf
+++ b/src-ui/messages.xlf
@@ -475,21 +475,21 @@
src/app/components/manage/settings/settings.component.ts
- 55
+ 56
src/app/components/manage/settings/settings.component.ts
- 68
+ 70
src/app/components/manage/settings/settings.component.ts
- 80
+ 86
@@ -510,7 +510,7 @@
src/app/components/manage/settings/settings.component.html
- 64
+ 79
@@ -520,109 +520,123 @@
13
+
+
+
+ src/app/components/manage/settings/settings.component.html
+ 17
+
+
+
+
+
+ src/app/components/manage/settings/settings.component.html
+ 25
+
+
src/app/components/manage/settings/settings.component.html
- 17
+ 32
src/app/components/manage/settings/settings.component.html
- 33
+ 48
src/app/components/manage/settings/settings.component.html
- 37
+ 52
src/app/components/manage/settings/settings.component.html
- 37
+ 52
src/app/components/manage/settings/settings.component.html
- 44
+ 59
src/app/components/manage/settings/settings.component.html
- 47
+ 62
src/app/components/manage/settings/settings.component.html
- 48
+ 63
src/app/components/manage/settings/settings.component.html
- 52
+ 67
src/app/components/manage/settings/settings.component.html
- 56
+ 71
src/app/components/manage/settings/settings.component.html
- 56
+ 71
src/app/components/manage/settings/settings.component.html
- 57
+ 72
src/app/components/manage/settings/settings.component.html
- 76
+ 91
src/app/components/manage/settings/settings.component.html
- 79
+ 94
src/app/components/manage/settings/settings.component.html
- 83
+ 98
src/app/components/manage/settings/settings.component.html
- 93
+ 108
@@ -1400,6 +1414,41 @@
12
+
+
+
+ src/app/services/settings.service.ts
+ 64
+
+
+
+
+
+ src/app/services/settings.service.ts
+ 65
+
+
+
+
+
+ src/app/services/settings.service.ts
+ 66
+
+
+
+
+
+ src/app/services/settings.service.ts
+ 67
+
+
+
+
+
+ src/app/services/settings.service.ts
+ 68
+
+
diff --git a/src-ui/src/app/components/manage/settings/settings.component.html b/src-ui/src/app/components/manage/settings/settings.component.html
index cc4de9bf0..e7fac646f 100644
--- a/src-ui/src/app/components/manage/settings/settings.component.html
+++ b/src-ui/src/app/components/manage/settings/settings.component.html
@@ -12,6 +12,21 @@
Appearance
+
+
|