mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Use ng-select for document detail screen
This commit is contained in:
		
							
								
								
									
										8
									
								
								src-ui/package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										8
									
								
								src-ui/package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -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", | ||||
|   | ||||
| @@ -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", | ||||
|   | ||||
| @@ -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, | ||||
|   | ||||
| @@ -1,11 +1,15 @@ | ||||
| <div class="form-group"> | ||||
| <div class="form-group paperless-input-select"> | ||||
|   <label [for]="inputId">{{title}}</label> | ||||
|   <div [class.input-group]="showPlusButton()"> | ||||
|     <select class="form-control" [id]="inputId" [(ngModel)]="value" (change)="onChange(value)" (blur)="onTouched()" | ||||
|       [disabled]="disabled" [style.color]="textColor" [style.background]="backgroundColor"> | ||||
|       <option *ngIf="allowNull" [ngValue]="null" class="form-control">---</option> | ||||
|       <option *ngFor="let i of items" [ngValue]="i.id" class="form-control">{{i.name}}</option> | ||||
|     </select> | ||||
|     <ng-select name="correspondent" [(ngModel)]="value" | ||||
|       [disabled]="disabled" | ||||
|       [style.color]="textColor" | ||||
|       [style.background]="backgroundColor" | ||||
|       (change)="onChange(value)" | ||||
|       (blur)="onTouched()"> | ||||
|       <ng-option *ngFor="let i of items" [value]="i.id">{{i.name}}</ng-option> | ||||
|     </ng-select> | ||||
|  | ||||
|     <div *ngIf="showPlusButton()" class="input-group-append"> | ||||
|       <button class="btn btn-outline-secondary" type="button" (click)="createNew.emit()"> | ||||
|         <svg class="buttonicon" fill="currentColor"> | ||||
| @@ -15,4 +19,4 @@ | ||||
|     </div> | ||||
|   </div> | ||||
|   <small *ngIf="hint" class="form-text text-muted">{{hint}}</small> | ||||
| </div> | ||||
| </div> | ||||
|   | ||||
| @@ -0,0 +1 @@ | ||||
| // styles for ng-select child are in 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; | ||||
| } | ||||
| } | ||||
|  | ||||
| .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; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon