mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
#9 new 'folderChange' event
- introduce new ‘folderChange’ event - deprecated ‘folderClick’ event - improved automation-id generation for cells
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
<td *ngFor="#col of columns" [ngSwitch]="col.source"
|
||||
class="mdl-data-table__cell--non-numeric {{content.entry.isFolder ? 'folder-row-cell' : 'document-row-cell'}} {{col.cssClass}}"
|
||||
(click)="onItemClick(content, $event)"
|
||||
[attr.data-automation-id]="col.source === '$thumbnail' ? '$thumbnail' : getObjectValue(content.entry, col.source)">
|
||||
[attr.data-automation-id]="col.source === '$thumbnail' ? '$thumbnail' : col.source + '_' + getObjectValue(content.entry, col.source)">
|
||||
<div *ngSwitchWhen="'$thumbnail'">
|
||||
<div *ngIf="content.entry.isFolder">
|
||||
<i class="material-icons folder-thumbnail">{{folderIcon || 'folder_open'}}</i>
|
||||
|
@@ -57,7 +57,7 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit
|
||||
itemClick: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
@Output()
|
||||
folderClick: EventEmitter<any> = new EventEmitter();
|
||||
folderChange: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
rootFolder = {
|
||||
name: '',
|
||||
@@ -67,14 +67,30 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit
|
||||
@Input()
|
||||
currentFolderPath: string = '';
|
||||
|
||||
folder: NodePaging;
|
||||
errorMessage;
|
||||
|
||||
route: any[] = [];
|
||||
|
||||
actions: ContentActionModel[] = [];
|
||||
columns: ContentColumnModel[] = [];
|
||||
|
||||
private _folder: NodePaging;
|
||||
|
||||
get folder(): NodePaging {
|
||||
return this._folder;
|
||||
}
|
||||
|
||||
set folder(value: NodePaging) {
|
||||
let isChanged = this._folder !== value;
|
||||
this._folder = value;
|
||||
if (isChanged) {
|
||||
this.folderChange.emit({
|
||||
value: value,
|
||||
absolutePath: this.currentFolderPath,
|
||||
relativePath: this.getRelativePath(this.currentFolderPath)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
sorting: ColumnSortingModel = {
|
||||
key: 'name',
|
||||
direction: 'asc'
|
||||
@@ -158,9 +174,6 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit
|
||||
this.route.pop();
|
||||
let parent = this.route.length > 0 ? this.route[this.route.length - 1] : this.rootFolder;
|
||||
if (parent) {
|
||||
this.folderClick.emit({
|
||||
value: parent.path
|
||||
});
|
||||
this.displayFolderContent(parent.path);
|
||||
}
|
||||
}
|
||||
@@ -183,11 +196,6 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit
|
||||
if (this.navigate && item && item.entry) {
|
||||
if (item.entry.isFolder) {
|
||||
let path = this.getNodePath(item);
|
||||
|
||||
this.folderClick.emit({
|
||||
value: path
|
||||
});
|
||||
|
||||
this.route.push({
|
||||
name: item.entry.name,
|
||||
path: path
|
||||
@@ -376,4 +384,12 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit
|
||||
private _isSortableColumn(column: ContentColumnModel) {
|
||||
return column && column.source && !column.source.startsWith('$');
|
||||
}
|
||||
|
||||
private getRelativePath(path: string): string {
|
||||
if (path.indexOf('/Sites/swsdp/documentLibrary/') !== -1) {
|
||||
return path.replace('/Sites/swsdp/documentLibrary/', '');
|
||||
} else {
|
||||
return path.replace('/Sites/swsdp/documentLibrary', '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user