mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-621] show drop effect on folders only (#1897)
* show drop effect on folders only - fix `hasValue` api for data rows (avoid 'false' value to be evaluated as missing value) - support for evaluating drop support for rows - document list enables upload zones for folders only * api improvements as per code review
This commit is contained in:
committed by
Eugenio Romano
parent
d8a46c9765
commit
7b17b10ef1
@@ -32,7 +32,7 @@
|
||||
<tr *ngFor="let row of data.getRows(); let idx = index" tabindex="0"
|
||||
class="alfresco-datatable__row"
|
||||
[class.alfresco-datatable__row--selected]="selectedRow === row"
|
||||
[adf-upload]="allowDropFiles" [adf-upload-data]="row">
|
||||
[adf-upload]="allowDropFiles && rowAllowsDrop(row)" [adf-upload-data]="row">
|
||||
|
||||
<!-- Actions (left) -->
|
||||
<td *ngIf="actions && actionsPosition === 'left'" class="alfresco-datatable__actions-cell">
|
||||
|
@@ -264,4 +264,8 @@ export class DataTableComponent implements AfterContentInit, OnChanges {
|
||||
this.executeRowAction.emit(new DataRowActionEvent(row, action));
|
||||
}
|
||||
}
|
||||
|
||||
rowAllowsDrop(row: DataRow): boolean {
|
||||
return row.isDropTarget === true;
|
||||
}
|
||||
}
|
||||
|
@@ -32,6 +32,7 @@ export interface DataTableAdapter {
|
||||
|
||||
export interface DataRow {
|
||||
isSelected: boolean;
|
||||
isDropTarget?: boolean;
|
||||
hasValue(key: string): boolean;
|
||||
getValue(key: string): any;
|
||||
}
|
||||
|
@@ -209,7 +209,7 @@ export class ObjectDataRow implements DataRow {
|
||||
}
|
||||
|
||||
hasValue(key: string): boolean {
|
||||
return this.getValue(key) ? true : false;
|
||||
return this.getValue(key) !== undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -234,6 +234,7 @@ export class ShareDataRow implements DataRow {
|
||||
|
||||
cache: { [key: string]: any } = {};
|
||||
isSelected: boolean = false;
|
||||
readonly isDropTarget;
|
||||
|
||||
get node(): NodeMinimalEntry {
|
||||
return this.obj;
|
||||
@@ -243,6 +244,8 @@ export class ShareDataRow implements DataRow {
|
||||
if (!obj) {
|
||||
throw new Error(ShareDataRow.ERR_OBJECT_NOT_FOUND);
|
||||
}
|
||||
|
||||
this.isDropTarget = obj.entry && obj.entry.isFolder;
|
||||
}
|
||||
|
||||
cacheValue(key: string, value: any): any {
|
||||
@@ -258,7 +261,7 @@ export class ShareDataRow implements DataRow {
|
||||
}
|
||||
|
||||
hasValue(key: string): boolean {
|
||||
return this.getValue(key) ? true : false;
|
||||
return this.getValue(key) !== undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user