diff --git a/ng2-components/ng2-alfresco-datatable/index.ts b/ng2-components/ng2-alfresco-datatable/index.ts
index 902efba726..31d861bf0f 100644
--- a/ng2-components/ng2-alfresco-datatable/index.ts
+++ b/ng2-components/ng2-alfresco-datatable/index.ts
@@ -30,10 +30,12 @@ export { DataRowActionEvent, DataRowActionModel } from './src/components/datatab
import { DataTableCellComponent } from './src/components/datatable/datatable-cell.component';
import { DataTableComponent } from './src/components/datatable/datatable.component';
+import { DateCellComponent } from './src/components/datatable/date-cell.component';
import { EmptyListBodyDirective,
EmptyListComponent,
EmptyListFooterDirective,
EmptyListHeaderDirective } from './src/components/datatable/empty-list.component';
+import { FileSizeCellComponent } from './src/components/datatable/filesize-cell.component';
import { LocationCellComponent } from './src/components/datatable/location-cell.component';
import { LoadingContentTemplateDirective } from './src/directives/loading-template.directive';
import { NoContentTemplateDirective } from './src/directives/no-content-template.directive';
@@ -46,6 +48,8 @@ export function directives() {
EmptyListBodyDirective,
EmptyListFooterDirective,
DataTableCellComponent,
+ DateCellComponent,
+ FileSizeCellComponent,
LocationCellComponent,
NoContentTemplateDirective,
LoadingContentTemplateDirective
@@ -76,7 +80,9 @@ export function directives() {
]
})
export class DataTableModule {
+ /** @deprecated in 1.9.0 */
static forRoot(): ModuleWithProviders {
+ console.log('DataTableModule.forRoot is deprecated and will be removed in future versions');
return {
ngModule: DataTableModule
};
diff --git a/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable-cell.component.ts b/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable-cell.component.ts
index 4bd99be856..17d4994799 100644
--- a/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable-cell.component.ts
+++ b/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable-cell.component.ts
@@ -15,13 +15,18 @@
* limitations under the License.
*/
-import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
+import { ChangeDetectionStrategy, Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
import { DataColumn, DataRow, DataTableAdapter } from '../../data/datatable-adapter';
@Component({
selector: 'adf-datatable-cell, alfresco-datatable-cell',
changeDetection: ChangeDetectionStrategy.OnPush,
- template: '{{value}}'
+ template: `
+
+ {{value}}
+ `,
+ encapsulation: ViewEncapsulation.None,
+ host: { class: 'adf-datatable-cell' }
})
export class DataTableCellComponent implements OnInit {
@@ -37,9 +42,16 @@ export class DataTableCellComponent implements OnInit {
@Input()
value: any;
+ @Input()
+ tooltip: string;
+
ngOnInit() {
if (!this.value && this.column && this.column.key && this.row && this.data) {
this.value = this.data.getValue(this.row, this.column);
+
+ if (!this.tooltip) {
+ this.tooltip = this.value;
+ }
}
}
diff --git a/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.html b/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.html
index 4f5779163b..ae689379c6 100644
--- a/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.html
+++ b/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.html
@@ -22,7 +22,7 @@
(keyup.enter)="onColumnHeaderClick(col)"
role="button"
tabindex="0"
- title="{{ col.title }}">
+ title="{{ col.title | translate }}">
{{ col.srTitle | translate }}
{{ col.title | translate}}
@@ -88,24 +88,40 @@
(error)="onImageLoadingError($event)">
diff --git a/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.spec.ts b/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.spec.ts
index a1e0607229..d2c7ffe302 100644
--- a/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.spec.ts
+++ b/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.spec.ts
@@ -30,6 +30,8 @@ import {
} from './../../data/index';
import { DataTableCellComponent } from './datatable-cell.component';
import { DataTableComponent } from './datatable.component';
+import { DateCellComponent } from './date-cell.component';
+import { FileSizeCellComponent } from './filesize-cell.component';
import { LocationCellComponent } from './location-cell.component';
describe('DataTable', () => {
@@ -49,6 +51,8 @@ describe('DataTable', () => {
declarations: [
DataTableCellComponent,
LocationCellComponent,
+ FileSizeCellComponent,
+ DateCellComponent,
DataTableComponent
]
}).compileComponents();
diff --git a/ng2-components/ng2-alfresco-datatable/src/components/datatable/date-cell.component.ts b/ng2-components/ng2-alfresco-datatable/src/components/datatable/date-cell.component.ts
new file mode 100644
index 0000000000..1e40b9c332
--- /dev/null
+++ b/ng2-components/ng2-alfresco-datatable/src/components/datatable/date-cell.component.ts
@@ -0,0 +1,32 @@
+/*!
+ * @license
+ * Copyright 2016 Alfresco Software, Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';
+import { DataTableCellComponent } from './datatable-cell.component';
+
+@Component({
+ selector: 'adf-date-cell',
+ changeDetection: ChangeDetectionStrategy.OnPush,
+ template: `
+
+ {{value}}
+
+ `,
+ encapsulation: ViewEncapsulation.None,
+ host: { class: 'adf-date-cell' }
+})
+export class DateCellComponent extends DataTableCellComponent {}
diff --git a/ng2-components/ng2-alfresco-datatable/src/components/datatable/filesize-cell.component.ts b/ng2-components/ng2-alfresco-datatable/src/components/datatable/filesize-cell.component.ts
new file mode 100644
index 0000000000..4413ace72e
--- /dev/null
+++ b/ng2-components/ng2-alfresco-datatable/src/components/datatable/filesize-cell.component.ts
@@ -0,0 +1,32 @@
+/*!
+ * @license
+ * Copyright 2016 Alfresco Software, Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';
+import { DataTableCellComponent } from './datatable-cell.component';
+
+@Component({
+ selector: 'adf-filesize-cell',
+ changeDetection: ChangeDetectionStrategy.OnPush,
+ template: `
+
+ {{ value | adfFileSize }}
+
+ `,
+ encapsulation: ViewEncapsulation.None,
+ host: { class: 'adf-filesize-cell' }
+})
+export class FileSizeCellComponent extends DataTableCellComponent {}
diff --git a/ng2-components/ng2-alfresco-datatable/src/components/datatable/location-cell.component.ts b/ng2-components/ng2-alfresco-datatable/src/components/datatable/location-cell.component.ts
index eb2f80348d..744854475e 100644
--- a/ng2-components/ng2-alfresco-datatable/src/components/datatable/location-cell.component.ts
+++ b/ng2-components/ng2-alfresco-datatable/src/components/datatable/location-cell.component.ts
@@ -34,9 +34,6 @@ import { DataTableCellComponent } from './datatable-cell.component';
})
export class LocationCellComponent extends DataTableCellComponent implements OnInit {
- @Input()
- tooltip: string = '';
-
@Input()
link: any[];
@@ -50,7 +47,10 @@ export class LocationCellComponent extends DataTableCellComponent implements OnI
if (path) {
this.value = path;
this.displayText = path.name.split('/').pop();
- this.tooltip = path.name;
+
+ if (!this.tooltip) {
+ this.tooltip = path.name;
+ }
const parent = path.elements[path.elements.length - 1];
this.link = [ this.column.format, parent.id ];
diff --git a/ng2-components/ng2-alfresco-datatable/src/directives/loading-template.directive.spec.ts b/ng2-components/ng2-alfresco-datatable/src/directives/loading-template.directive.spec.ts
index 2f61f788ef..43fdc2f750 100644
--- a/ng2-components/ng2-alfresco-datatable/src/directives/loading-template.directive.spec.ts
+++ b/ng2-components/ng2-alfresco-datatable/src/directives/loading-template.directive.spec.ts
@@ -20,6 +20,8 @@ import { RouterTestingModule } from '@angular/router/testing';
import { CoreModule } from 'ng2-alfresco-core';
import { DataTableCellComponent } from '../components/datatable/datatable-cell.component';
import { DataTableComponent } from '../components/datatable/datatable.component';
+import { DateCellComponent } from '../components/datatable/date-cell.component';
+import { FileSizeCellComponent } from '../components/datatable/filesize-cell.component';
import { LocationCellComponent } from '../components/datatable/location-cell.component';
import { MaterialModule } from '../material.module';
import { LoadingContentTemplateDirective } from './loading-template.directive';
@@ -40,7 +42,9 @@ describe('LoadingContentTemplateDirective', () => {
DataTableComponent,
DataTableCellComponent,
LocationCellComponent,
- LoadingContentTemplateDirective
+ LoadingContentTemplateDirective,
+ DateCellComponent,
+ FileSizeCellComponent
]
}).compileComponents();
}));
diff --git a/ng2-components/ng2-alfresco-datatable/src/directives/no-content-template.directive.spec.ts b/ng2-components/ng2-alfresco-datatable/src/directives/no-content-template.directive.spec.ts
index c00198e343..3bfd1cf9a5 100644
--- a/ng2-components/ng2-alfresco-datatable/src/directives/no-content-template.directive.spec.ts
+++ b/ng2-components/ng2-alfresco-datatable/src/directives/no-content-template.directive.spec.ts
@@ -20,6 +20,8 @@ import { RouterTestingModule } from '@angular/router/testing';
import { CoreModule } from 'ng2-alfresco-core';
import { DataTableCellComponent } from '../components/datatable/datatable-cell.component';
import { DataTableComponent } from '../components/datatable/datatable.component';
+import { DateCellComponent } from '../components/datatable/date-cell.component';
+import { FileSizeCellComponent } from '../components/datatable/filesize-cell.component';
import { LocationCellComponent } from '../components/datatable/location-cell.component';
import { MaterialModule } from '../material.module';
import { NoContentTemplateDirective } from './no-content-template.directive';
@@ -39,8 +41,10 @@ describe('NoContentTemplateDirective', () => {
declarations: [
DataTableComponent,
DataTableCellComponent,
+ DateCellComponent,
NoContentTemplateDirective,
- LocationCellComponent
+ LocationCellComponent,
+ FileSizeCellComponent
]
}).compileComponents();
}));