[ADF-1040] Change document list style rows based on permissions model (#2085)

* Change document list style rows based on permissions model

* fix test
This commit is contained in:
Eugenio Romano
2017-07-17 17:22:08 +01:00
parent 6947e04208
commit a9142e2ca2
29 changed files with 382 additions and 167 deletions

View File

@@ -531,9 +531,11 @@ interface DataTableAdapter {
}
interface DataRow {
isSelected: boolean;
hasValue(key: string): boolean;
getValue(key: string): any;
isSelected: boolean;
isDropTarget?: boolean;
hasValue(key: string): boolean;
getValue(key: string): any;
cssClass?: string;
}
interface DataColumn {

View File

@@ -35,7 +35,7 @@
[class.is-selected]="row.isSelected"
[adf-upload]="allowDropFiles && rowAllowsDrop(row)" [adf-upload-data]="row"
[ngStyle]="rowStyle"
[ngClass]="rowStyleClass">
[ngClass]="getRowStyle(row)">
<!-- Actions (left) -->
<td *ngIf="actions && actionsPosition === 'left'">

View File

@@ -69,7 +69,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck
rowStyle: string;
@Input()
rowStyleClass: string;
rowStyleClass: string = '';
@Input()
showHeader: boolean = true;
@@ -107,10 +107,9 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck
private singleClickStreamSub: Subscription;
private multiClickStreamSub: Subscription;
constructor(
translateService: AlfrescoTranslationService,
@Optional() private el: ElementRef,
private differs: IterableDiffers) {
constructor(translateService: AlfrescoTranslationService,
@Optional() private el: ElementRef,
private differs: IterableDiffers) {
if (differs) {
this.differ = differs.find([]).create(null);
}
@@ -130,7 +129,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck
if (this.isPropertyChanged(changes['data'])) {
if (this.isTableEmpty()) {
this.initTable();
}else {
} else {
this.data = changes['data'].currentValue;
}
return;
@@ -207,7 +206,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck
}
private unsubscribeClickStream() {
if (this.singleClickStreamSub) {
if (this.singleClickStreamSub) {
this.singleClickStreamSub.unsubscribe();
}
if (this.multiClickStreamSub) {
@@ -379,4 +378,10 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck
return this.selectionMode && this.selectionMode.toLowerCase() === 'multiple';
}
getRowStyle(row: DataRow): string {
row.cssClass = row.cssClass ? row.cssClass : '';
this.rowStyleClass = this.rowStyleClass ? this.rowStyleClass : '';
return `${row.cssClass} ${this.rowStyleClass}`;
}
}

View File

@@ -33,6 +33,7 @@ export interface DataTableAdapter {
export interface DataRow {
isSelected: boolean;
isDropTarget?: boolean;
cssClass?: string;
hasValue(key: string): boolean;
getValue(key: string): any;
}