mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Integrating datatable into document list (wip)
This commit is contained in:
@@ -29,7 +29,8 @@ import {
|
||||
DataTableAdapter,
|
||||
DataRow,
|
||||
DataColumn,
|
||||
DataSorting
|
||||
DataSorting,
|
||||
DataRowEvent
|
||||
} from './../data/datatable-adapter';
|
||||
import { ObjectDataTableAdapter } from '../data/object-datatable-adapter';
|
||||
|
||||
@@ -54,10 +55,10 @@ export class DataTableComponent implements OnInit, AfterViewChecked {
|
||||
actions: boolean = false;
|
||||
|
||||
@Output()
|
||||
rowClick: EventEmitter<any> = new EventEmitter();
|
||||
rowClick: EventEmitter<DataRowEvent> = new EventEmitter();
|
||||
|
||||
@Output()
|
||||
rowDblClick: EventEmitter<any> = new EventEmitter();
|
||||
rowDblClick: EventEmitter<DataRowEvent> = new EventEmitter();
|
||||
|
||||
isSelectAllChecked: boolean = false;
|
||||
|
||||
@@ -84,7 +85,8 @@ export class DataTableComponent implements OnInit, AfterViewChecked {
|
||||
}
|
||||
|
||||
this.rowClick.emit({
|
||||
value: row
|
||||
value: row,
|
||||
event: e
|
||||
});
|
||||
}
|
||||
|
||||
@@ -94,7 +96,8 @@ export class DataTableComponent implements OnInit, AfterViewChecked {
|
||||
}
|
||||
|
||||
this.rowDblClick.emit({
|
||||
value: row
|
||||
value: row,
|
||||
event: e
|
||||
});
|
||||
}
|
||||
|
||||
@@ -134,14 +137,16 @@ export class DataTableComponent implements OnInit, AfterViewChecked {
|
||||
|
||||
isIconValue(row: DataRow, col: DataColumn) {
|
||||
if (row && col) {
|
||||
return row.getValue(col.key).startsWith('material-icons://');
|
||||
let value = row.getValue(col.key);
|
||||
return value && value.startsWith('material-icons://');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
asIconValue(row: DataRow, col: DataColumn) {
|
||||
if (this.isIconValue(row, col)) {
|
||||
return row.getValue(col.key).replace('material-icons://', '');
|
||||
let value = row.getValue(col.key) || '';
|
||||
return value.replace('material-icons://', '');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
export interface DataTableAdapter {
|
||||
|
||||
getRows(): Array<DataRow>;
|
||||
setRows(rows: Array<DataRow>): void;
|
||||
getColumns(): Array<DataColumn>;
|
||||
@@ -25,19 +24,15 @@ export interface DataTableAdapter {
|
||||
getSorting(): DataSorting;
|
||||
setSorting(sorting: DataSorting): void;
|
||||
sort(key?: string, direction?: string): void;
|
||||
|
||||
}
|
||||
|
||||
export interface DataRow {
|
||||
|
||||
isSelected: boolean;
|
||||
hasValue(key: string): boolean;
|
||||
getValue(key: string): any;
|
||||
|
||||
}
|
||||
|
||||
export interface DataColumn {
|
||||
|
||||
key: string;
|
||||
type: string; // text|image|date
|
||||
format?: string;
|
||||
@@ -45,14 +40,16 @@ export interface DataColumn {
|
||||
title?: string;
|
||||
srTitle?: string;
|
||||
cssClass?: string;
|
||||
|
||||
}
|
||||
|
||||
export class DataSorting {
|
||||
|
||||
constructor(
|
||||
public key?: string,
|
||||
public direction?: string) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export interface DataRowEvent {
|
||||
value?: DataRow;
|
||||
event: Event;
|
||||
}
|
||||
|
Reference in New Issue
Block a user