diff --git a/demo-shell-ng2/app/components/files/files.component.html b/demo-shell-ng2/app/components/files/files.component.html index e07602fd09..5787f84ba3 100644 --- a/demo-shell-ng2/app/components/files/files.component.html +++ b/demo-shell-ng2/app/components/files/files.component.html @@ -45,6 +45,8 @@ --> + + @@ -82,6 +85,15 @@ export class ContextMenuHolderComponent { this.isShown = false; } + onMenuItemClick(event: Event, menuItem: any): void { + if (menuItem && menuItem.model && menuItem.model.disabled) { + event.preventDefault(); + event.stopImmediatePropagation(); + return; + } + menuItem.subject.next(menuItem); + } + showMenu(e, links) { this.isShown = true; this.links = links; diff --git a/ng2-components/ng2-alfresco-core/tsconfig.json b/ng2-components/ng2-alfresco-core/tsconfig.json index ba1ef9cea2..42e2a54cc8 100644 --- a/ng2-components/ng2-alfresco-core/tsconfig.json +++ b/ng2-components/ng2-alfresco-core/tsconfig.json @@ -41,9 +41,6 @@ "es2015", "dom" ], - "typeRoots": [ - "./node_modules/@types" - ], "suppressImplicitAnyIndexErrors": true }, "exclude": [ diff --git a/ng2-components/ng2-alfresco-datatable/index.ts b/ng2-components/ng2-alfresco-datatable/index.ts index 6e3c447446..4ebed2eb97 100644 --- a/ng2-components/ng2-alfresco-datatable/index.ts +++ b/ng2-components/ng2-alfresco-datatable/index.ts @@ -27,9 +27,11 @@ export * from './src/components/datatable/data-row-action.event'; import { DataTableComponent } from './src/components/datatable/datatable.component'; import { NoContentTemplateComponent } from './src/components/datatable/no-content-template.component'; import { PaginationComponent } from './src/components/pagination/pagination.component'; +import { DataTableCellComponent } from './src/components/datatable/datatable-cell.component'; export const ALFRESCO_DATATABLE_DIRECTIVES: [any] = [ DataTableComponent, + DataTableCellComponent, NoContentTemplateComponent, PaginationComponent ]; 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 new file mode 100644 index 0000000000..d03020274c --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable-cell.component.ts @@ -0,0 +1,48 @@ +/*! + * @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 { Component, Input, ChangeDetectionStrategy } from '@angular/core'; +import { DataTableAdapter, DataColumn, DataRow } from '../../data/index'; + +@Component({ + selector: 'alfresco-datatable-cell', + changeDetection: ChangeDetectionStrategy.OnPush, + template: '{{value}}' +}) +export class DataTableCellComponent { + + @Input() + data: DataTableAdapter; + + @Input() + column: DataColumn; + + @Input() + row: DataRow; + + @Input() + value: any; + + constructor() { } + + ngOnInit() { + if (this.column && this.column.key && this.row && this.data) { + this.value = this.data.getValue(this.row, this.column); + } + } + +} 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 db3f470479..b3894ed078 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 @@ -70,10 +70,10 @@ (error)="onImageLoadingError($event)">
- {{data.getValue(row, col)}} +
- {{data.getValue(row, col)}} +
@@ -95,7 +95,7 @@