From 9b244d02655c7837323633b71826a89473b6e19a Mon Sep 17 00:00:00 2001
From: Michael Shamoon <4887959+nikonratm@users.noreply.github.com>
Date: Thu, 17 Dec 2020 23:09:27 -0800
Subject: [PATCH 1/5] Use ng-select for document detail screen
---
src-ui/package-lock.json | 8 +++++++
src-ui/package.json | 1 +
src-ui/src/app/app.module.ts | 4 +++-
.../common/input/select/select.component.html | 18 +++++++++------
.../common/input/select/select.component.scss | 1 +
src-ui/src/styles.scss | 23 ++++++++++++++++++-
6 files changed, 46 insertions(+), 9 deletions(-)
diff --git a/src-ui/package-lock.json b/src-ui/package-lock.json
index 5eca0b3c0..10215a32d 100644
--- a/src-ui/package-lock.json
+++ b/src-ui/package-lock.json
@@ -2056,6 +2056,14 @@
"tslib": "^2.0.0"
}
},
+ "@ng-select/ng-select": {
+ "version": "5.0.9",
+ "resolved": "https://registry.npmjs.org/@ng-select/ng-select/-/ng-select-5.0.9.tgz",
+ "integrity": "sha512-YZeSAiS8/Nx/eHZJPmOOYL8YmcvSq+dr1P8WIrsKmRA7mueorBpPc5xlUj+nLQbpLtsiQvdWDQspf/ykOvD/lA==",
+ "requires": {
+ "tslib": "^2.0.0"
+ }
+ },
"@ngtools/webpack": {
"version": "10.2.0",
"resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-10.2.0.tgz",
diff --git a/src-ui/package.json b/src-ui/package.json
index 6293f2672..14d828483 100644
--- a/src-ui/package.json
+++ b/src-ui/package.json
@@ -21,6 +21,7 @@
"@angular/platform-browser-dynamic": "~10.1.5",
"@angular/router": "~10.1.5",
"@ng-bootstrap/ng-bootstrap": "^8.0.0",
+ "@ng-select/ng-select": "^5.0.9",
"bootstrap": "^4.5.0",
"ng-bootstrap": "^1.6.3",
"ng2-pdf-viewer": "^6.3.2",
diff --git a/src-ui/src/app/app.module.ts b/src-ui/src/app/app.module.ts
index 3c00cd0b7..d9c3800d6 100644
--- a/src-ui/src/app/app.module.ts
+++ b/src-ui/src/app/app.module.ts
@@ -54,6 +54,7 @@ import { FileSizePipe } from './pipes/file-size.pipe';
import { FilterPipe } from './pipes/filter.pipe';
import { DocumentTitlePipe } from './pipes/document-title.pipe';
import { MetadataCollapseComponent } from './components/document-detail/metadata-collapse/metadata-collapse.component';
+import { NgSelectModule } from '@ng-select/ng-select';
@NgModule({
declarations: [
@@ -110,7 +111,8 @@ import { MetadataCollapseComponent } from './components/document-detail/metadata
ReactiveFormsModule,
NgxFileDropModule,
InfiniteScrollModule,
- PdfViewerModule
+ PdfViewerModule,
+ NgSelectModule
],
providers: [
DatePipe,
diff --git a/src-ui/src/app/components/common/input/select/select.component.html b/src-ui/src/app/components/common/input/select/select.component.html
index 717aa7964..655adbe74 100644
--- a/src-ui/src/app/components/common/input/select/select.component.html
+++ b/src-ui/src/app/components/common/input/select/select.component.html
@@ -1,11 +1,15 @@
-
diff --git a/src-ui/src/app/components/common/input/select/select.component.scss b/src-ui/src/app/components/common/input/select/select.component.scss
index e69de29bb..8faec3bc0 100644
--- a/src-ui/src/app/components/common/input/select/select.component.scss
+++ b/src-ui/src/app/components/common/input/select/select.component.scss
@@ -0,0 +1 @@
+// styles for ng-select child are in styles.scss
diff --git a/src-ui/src/styles.scss b/src-ui/src/styles.scss
index b0b66b7f9..2eeb40d41 100644
--- a/src-ui/src/styles.scss
+++ b/src-ui/src/styles.scss
@@ -2,6 +2,7 @@
@import "node_modules/bootstrap/scss/bootstrap";
+@import "~@ng-select/ng-select/themes/default.theme.css";
.toolbaricon {
width: 1.2em;
@@ -65,4 +66,24 @@ body {
display: block;
background-size: 1rem;
float: right;
-}
\ No newline at end of file
+}
+
+.paperless-input-select {
+ .ng-select {
+ position: relative;
+ flex: 1 1 auto;
+ margin-bottom: 0;
+ height: calc(1.5em + 0.75rem + 5px);
+ line-height: 1.5;
+
+ .ng-select-container {
+ height: 100%;
+ border-top-right-radius: 0;
+ border-bottom-right-radius: 0;
+
+ .ng-value-container .ng-input {
+ top: 8px;
+ }
+ }
+ }
+}
From e10a2391c44dcb48db992b0d477a8f150a0bb481 Mon Sep 17 00:00:00 2001
From: Michael Shamoon <4887959+nikonratm@users.noreply.github.com>
Date: Fri, 18 Dec 2020 00:53:01 -0800
Subject: [PATCH 2/5] Use ng-select for document detail screen tags
---
.../common/input/tags/tags.component.html | 36 ++++++++++---------
.../common/input/tags/tags.component.scss | 12 ++-----
.../common/input/tags/tags.component.ts | 23 ++++++------
.../document-detail.component.html | 4 +--
src-ui/src/styles.scss | 15 ++++++--
5 files changed, 48 insertions(+), 42 deletions(-)
diff --git a/src-ui/src/app/components/common/input/tags/tags.component.html b/src-ui/src/app/components/common/input/tags/tags.component.html
index 8029dd860..89e391813 100644
--- a/src-ui/src/app/components/common/input/tags/tags.component.html
+++ b/src-ui/src/app/components/common/input/tags/tags.component.html
@@ -1,30 +1,34 @@
-
diff --git a/src-ui/src/app/components/common/input/tags/tags.component.scss b/src-ui/src/app/components/common/input/tags/tags.component.scss
index f2635b7f2..41fc6acc4 100644
--- a/src-ui/src/app/components/common/input/tags/tags.component.scss
+++ b/src-ui/src/app/components/common/input/tags/tags.component.scss
@@ -1,10 +1,4 @@
-.tags-form-control {
- height: auto;
+.selected-icon {
+ min-width: 1em;
+ min-height: 1em;
}
-
-
-.scrollable-menu {
- height: auto;
- max-height: 300px;
- overflow-x: hidden;
-}
\ No newline at end of file
diff --git a/src-ui/src/app/components/common/input/tags/tags.component.ts b/src-ui/src/app/components/common/input/tags/tags.component.ts
index cca99cc55..5501ac5a6 100644
--- a/src-ui/src/app/components/common/input/tags/tags.component.ts
+++ b/src-ui/src/app/components/common/input/tags/tags.component.ts
@@ -21,7 +21,7 @@ export class TagsComponent implements OnInit, ControlValueAccessor {
onChange = (newValue: number[]) => {};
-
+
onTouched = () => {};
writeValue(newValue: number[]): void {
@@ -66,29 +66,28 @@ export class TagsComponent implements OnInit, ControlValueAccessor {
removeTag(id) {
let index = this.displayValue.indexOf(id)
if (index > -1) {
- this.displayValue.splice(index, 1)
+ let oldValue = this.displayValue
+ oldValue.splice(index, 1)
+ this.displayValue = [...oldValue]
this.onChange(this.displayValue)
}
}
- addTag(id) {
- let index = this.displayValue.indexOf(id)
- if (index == -1) {
- this.displayValue.push(id)
- this.onChange(this.displayValue)
- }
- }
-
-
createTag() {
var modal = this.modalService.open(TagEditDialogComponent, {backdrop: 'static'})
modal.componentInstance.dialogMode = 'create'
modal.componentInstance.success.subscribe(newTag => {
this.tagService.listAll().subscribe(tags => {
this.tags = tags.results
- this.addTag(newTag.id)
+ this.displayValue = [...this.displayValue, newTag.id]
+ this.onChange(this.displayValue)
})
})
}
+ ngSelectChange() {
+ this.value = this.displayValue
+ this.onChange(this.displayValue)
+ }
+
}
diff --git a/src-ui/src/app/components/document-detail/document-detail.component.html b/src-ui/src/app/components/document-detail/document-detail.component.html
index f4a64c2cc..a3bc7e1e6 100644
--- a/src-ui/src/app/components/document-detail/document-detail.component.html
+++ b/src-ui/src/app/components/document-detail/document-detail.component.html
@@ -52,9 +52,9 @@
+ (createNew)="createCorrespondent()">
+ (createNew)="createDocumentType()">
diff --git a/src-ui/src/styles.scss b/src-ui/src/styles.scss
index 2eeb40d41..0dc662e31 100644
--- a/src-ui/src/styles.scss
+++ b/src-ui/src/styles.scss
@@ -1,7 +1,5 @@
@import "theme";
-
@import "node_modules/bootstrap/scss/bootstrap";
-
@import "~@ng-select/ng-select/themes/default.theme.css";
.toolbaricon {
@@ -21,7 +19,7 @@
}
body {
- font-size: .875rem;
+ font-size: 0.875rem;
}
.form-control-dark {
@@ -85,5 +83,16 @@ body {
top: 8px;
}
}
+
+ .ng-dropdown-panel .ng-dropdown-panel-items .ng-option.ng-option-selected,
+ .ng-dropdown-panel .ng-dropdown-panel-items .ng-option.ng-option-selected.ng-option-marked {
+ background: none;
+ }
+ }
+}
+
+.paperless-input-tags {
+ .ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value {
+ background-color: transparent;
}
}
From 55c4c690ef8eec3ba494cd6c3a74dc9b5cd810ec Mon Sep 17 00:00:00 2001
From: Michael Shamoon <4887959+nikonratm@users.noreply.github.com>
Date: Fri, 18 Dec 2020 01:13:30 -0800
Subject: [PATCH 3/5] Fix wrapping with multiple tags, embiggen tags, pretty
icons
---
.../common/input/tags/tags.component.html | 21 ++++++++++++-------
.../common/input/tags/tags.component.scss | 8 +++++++
src-ui/src/styles.scss | 2 +-
3 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/src-ui/src/app/components/common/input/tags/tags.component.html b/src-ui/src/app/components/common/input/tags/tags.component.html
index 89e391813..8a5dbc4f2 100644
--- a/src-ui/src/app/components/common/input/tags/tags.component.html
+++ b/src-ui/src/app/components/common/input/tags/tags.component.html
@@ -1,7 +1,7 @@