From 962542a4ec853e370ce7d43ca2ef3cdec582ba84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Tue, 31 Aug 2021 16:35:12 +0300 Subject: [PATCH] Active fields listing --- .../active-fields-listing.component.html | 131 +++++++++--------- .../active-fields-listing.component.scss | 72 ++++------ .../active-fields-listing.component.ts | 82 ++++++++--- .../dossier-listing-screen.component.scss | 1 - .../dossier-overview-screen.component.html | 12 +- .../dossier-overview-screen.component.scss | 4 - libs/common-ui | 2 +- 7 files changed, 157 insertions(+), 147 deletions(-) diff --git a/apps/red-ui/src/app/modules/admin/dialogs/file-attributes-csv-import-dialog/active-fields-listing/active-fields-listing.component.html b/apps/red-ui/src/app/modules/admin/dialogs/file-attributes-csv-import-dialog/active-fields-listing/active-fields-listing.component.html index 4af65e5b0..434db87bc 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/file-attributes-csv-import-dialog/active-fields-listing/active-fields-listing.component.html +++ b/apps/red-ui/src/app/modules/admin/dialogs/file-attributes-csv-import-dialog/active-fields-listing/active-fields-listing.component.html @@ -1,74 +1,15 @@ - - - - - -
-
- -
- -
- -
- -
-
- - - - {{ translations[type] | translate }} - - - -
-
- -
- -
- -
- -
- -
-
- -
-
-
-
-
+ emptyColumnWidth="auto" + noDataIcon="red:attribute" +> + @@ -113,3 +54,55 @@ + + +
+ +
+
+ + +
+ +
+
+ + +
+
+ + + + {{ translations[type] | translate }} + + + +
+
+
+ + +
+ +
+
+ + +
+ +
+
diff --git a/apps/red-ui/src/app/modules/admin/dialogs/file-attributes-csv-import-dialog/active-fields-listing/active-fields-listing.component.scss b/apps/red-ui/src/app/modules/admin/dialogs/file-attributes-csv-import-dialog/active-fields-listing/active-fields-listing.component.scss index dbff36713..be28d9506 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/file-attributes-csv-import-dialog/active-fields-listing/active-fields-listing.component.scss +++ b/apps/red-ui/src/app/modules/admin/dialogs/file-attributes-csv-import-dialog/active-fields-listing/active-fields-listing.component.scss @@ -1,47 +1,37 @@ @import '../../../../../../assets/styles/variables'; -iqser-table-header::ng-deep iqser-table-column-name .name { - padding-left: 22px; -} +:host ::ng-deep iqser-table { + iqser-table-header { + iqser-table-column-name .name { + padding-left: 22px; + } -iqser-table-header::ng-deep .header-item { - box-shadow: none; - border-top: 1px solid $separator; + .header-item { + box-shadow: none; + border-top: 1px solid $separator; - .all-caps-label { - margin-right: 10px; - } - - iqser-circle-button { - margin-right: 2px; - } - - .separator { - margin-left: 14px; - background-color: $separator; - width: 1px; - height: 30px; - margin-right: 16px; - } -} - -cdk-virtual-scroll-viewport { - height: calc(100% - 80px); - - ::ng-deep.cdk-virtual-scroll-content-wrapper { - grid-template-columns: 30px minmax(0, 350px) 150px auto auto auto 11px; - - .table-item > div { - height: 50px; - - &:not(.scrollbar-placeholder) { - padding-left: 10px; - - &.center { - align-items: center; - } + .all-caps-label { + margin-right: 10px; } + iqser-circle-button { + margin-right: 2px; + } + + .separator { + margin-left: 14px; + background-color: $separator; + width: 1px; + height: 30px; + margin-right: 16px; + } + } + } + + cdk-virtual-scroll-viewport { + height: calc(100% - 80px) !important; + + .cdk-virtual-scroll-content-wrapper .table-item > div.cell { iqser-editable-input:not(.editing) { padding-left: 12px; } @@ -55,10 +45,4 @@ cdk-virtual-scroll-viewport { } } } - - &.has-scrollbar:hover { - ::ng-deep.cdk-virtual-scroll-content-wrapper { - grid-template-columns: 30px minmax(0, 350px) 150px auto auto auto; - } - } } diff --git a/apps/red-ui/src/app/modules/admin/dialogs/file-attributes-csv-import-dialog/active-fields-listing/active-fields-listing.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/file-attributes-csv-import-dialog/active-fields-listing/active-fields-listing.component.ts index f2bfbeb36..6645dbfa8 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/file-attributes-csv-import-dialog/active-fields-listing/active-fields-listing.component.ts +++ b/apps/red-ui/src/app/modules/admin/dialogs/file-attributes-csv-import-dialog/active-fields-listing/active-fields-listing.component.ts @@ -1,4 +1,16 @@ -import { Component, EventEmitter, Injector, Input, OnChanges, Output, SimpleChanges } from '@angular/core'; +import { + Component, + EventEmitter, + forwardRef, + Injector, + Input, + OnChanges, + OnInit, + Output, + SimpleChanges, + TemplateRef, + ViewChild +} from '@angular/core'; import { Field } from '../file-attributes-csv-import-dialog.component'; import { FileAttributeConfig } from '@redaction/red-ui-http'; import { CircleButtonTypes, DefaultListingServices, ListingComponent, TableColumnConfig } from '@iqser/common-ui'; @@ -9,46 +21,36 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; selector: 'redaction-active-fields-listing', templateUrl: './active-fields-listing.component.html', styleUrls: ['./active-fields-listing.component.scss'], - providers: [...DefaultListingServices] + providers: [...DefaultListingServices, { provide: ListingComponent, useExisting: forwardRef(() => ActiveFieldsListingComponent) }] }) -export class ActiveFieldsListingComponent extends ListingComponent implements OnChanges { - protected readonly _primaryKey = 'csvColumn'; +export class ActiveFieldsListingComponent extends ListingComponent implements OnChanges, OnInit { readonly circleButtonTypes = CircleButtonTypes; readonly translations = fileAttributeTypesTranslations; readonly tableHeaderLabel = _('file-attributes-csv-import.table-header.title'); - readonly tableColumnConfigs: TableColumnConfig[] = [ - { - label: _('file-attributes-csv-import.table-col-names.name'), - class: 'name' - }, - { label: _('file-attributes-csv-import.table-col-names.type') }, - { - label: _('file-attributes-csv-import.table-col-names.read-only'), - class: 'flex-center', - leftIcon: 'red:read-only' - }, - { - label: _('file-attributes-csv-import.table-col-names.primary'), - class: 'flex-center', - rightIcon: 'red:status-info', - rightIconTooltip: _('file-attributes-csv-import.table-col-names.primary-info-tooltip') - } - ]; + tableColumnConfigs: TableColumnConfig[]; readonly typeOptions = [ FileAttributeConfig.TypeEnum.TEXT, FileAttributeConfig.TypeEnum.NUMBER, FileAttributeConfig.TypeEnum.DATE ] as const; - + @ViewChild('labelTemplate', { static: true }) labelTemplate: TemplateRef; + @ViewChild('typeTemplate', { static: true }) typeTemplate: TemplateRef; + @ViewChild('readonlyTemplate', { static: true }) readonlyTemplate: TemplateRef; + @ViewChild('primaryTemplate', { static: true }) primaryTemplate: TemplateRef; @Input() entities: Field[]; @Output() entitiesChange = new EventEmitter(); @Output() setHoveredColumn = new EventEmitter(); @Output() toggleFieldActive = new EventEmitter(); + protected readonly _primaryKey = 'csvColumn'; constructor(protected readonly _injector: Injector) { super(_injector); } + ngOnInit(): void { + this._configureTableColumns(); + } + ngOnChanges(changes: SimpleChanges): void { if (changes.entities) { this.entitiesService.setEntities(this.entities); @@ -80,4 +82,38 @@ export class ActiveFieldsListingComponent extends ListingComponent implem } field.primaryAttribute = true; } + + itemMouseEnterFn = (field: Field) => this.setHoveredColumn.emit(field.csvColumn); + itemMouseLeaveFn = (field: Field) => this.setHoveredColumn.emit(); + + private _configureTableColumns() { + this.tableColumnConfigs = [ + { + label: _('file-attributes-csv-import.table-col-names.name'), + class: 'name', + template: this.labelTemplate, + width: 'minmax(0, 350px)' + }, + { + label: _('file-attributes-csv-import.table-col-names.type'), + template: this.typeTemplate, + width: '150px' + }, + { + label: _('file-attributes-csv-import.table-col-names.read-only'), + class: 'flex-center', + leftIcon: 'red:read-only', + template: this.readonlyTemplate, + width: 'auto' + }, + { + label: _('file-attributes-csv-import.table-col-names.primary'), + class: 'flex-center', + rightIcon: 'red:status-info', + rightIconTooltip: _('file-attributes-csv-import.table-col-names.primary-info-tooltip'), + template: this.primaryTemplate, + width: 'auto' + } + ]; + } } diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.scss b/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.scss index a3cbb4dec..cb00faaf2 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.scss +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.scss @@ -2,7 +2,6 @@ ::ng-deep iqser-table cdk-virtual-scroll-viewport .cdk-virtual-scroll-content-wrapper .table-item > div.cell { &.status-container { width: 160px; - padding-right: 13px; } } diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html index 329642dd5..9d4ab2d4d 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html @@ -76,7 +76,7 @@
-
+
{{ fileStatus.filename }} @@ -138,10 +138,12 @@ -
-
- - {{ fileStatus.numberOfPages }} +
+
+
+ + {{ fileStatus.numberOfPages }} +
diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.scss b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.scss index f52d41a2e..4b6a10bf8 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.scss +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.scss @@ -28,10 +28,6 @@ } > div.cell { - .disabled { - color: $grey-7; - } - .error { color: $primary; } diff --git a/libs/common-ui b/libs/common-ui index 70f3c560d..af46a45b9 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit 70f3c560d3b312d9707f367c2b8d3289ccbf908d +Subproject commit af46a45b97a42380a316396635fecc58372b78eb