AOT compatibility enhancements (#2015)

* aot compatibility updates

- remove index files where needed
- move material dependencies to a separete module
- use aot compatible lambda functions for module export

* remove unused imports

* re-export Material module

* core module enhancements

- fix AOT issue with providers (use lambda instead of variable)
- move context menu to a separate module

* core module enhancements

* feature modules
This commit is contained in:
Denys Vuika
2017-06-30 22:20:12 +01:00
committed by Eugenio Romano
parent b0cdd4557d
commit 98598f03b2
16 changed files with 135 additions and 207 deletions

View File

@@ -16,14 +16,16 @@
*/
import { NgModule, ModuleWithProviders } from '@angular/core';
import { MdCheckboxModule, MdMenuModule, MdIconModule, MdButtonModule } from '@angular/material';
import { CoreModule } from 'ng2-alfresco-core';
import { MaterialModule } from './src/material.module';
export * from './src/data/index';
export * from './src/components/index';
export * from './src/components/pagination/index';
export * from './src/components/datatable/data-cell.event';
export * from './src/components/datatable/data-row-action.event';
export { DataTableCellComponent } from './src/components/datatable/datatable-cell.component';
export { DataTableComponent } from './src/components/datatable/datatable.component';
export { PaginationComponent } from './src/components/pagination/pagination.component';
export { DataCellEvent, DataCellEventModel } from './src/components/datatable/data-cell.event';
export { DataRowActionEvent, DataRowActionModel } from './src/components/datatable/data-row-action.event';
import { DataTableComponent } from './src/components/datatable/datatable.component';
import { NoContentTemplateComponent } from './src/directives/no-content-template.component';
@@ -31,31 +33,25 @@ import { LoadingContentTemplateComponent } from './src/directives/loading-templa
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,
LoadingContentTemplateComponent,
PaginationComponent
];
export function directives() {
return [
DataTableComponent,
DataTableCellComponent,
NoContentTemplateComponent,
LoadingContentTemplateComponent,
PaginationComponent
];
}
@NgModule({
imports: [
CoreModule,
MdCheckboxModule,
MdMenuModule,
MdIconModule,
MdButtonModule
],
declarations: [
...ALFRESCO_DATATABLE_DIRECTIVES
MaterialModule
],
declarations: directives(),
exports: [
...ALFRESCO_DATATABLE_DIRECTIVES,
MdCheckboxModule,
MdMenuModule,
MdIconModule,
MdButtonModule
...directives(),
MaterialModule
]
})
export class DataTableModule {

View File

@@ -16,7 +16,7 @@
*/
import { Component, Input, ChangeDetectionStrategy } from '@angular/core';
import { DataTableAdapter, DataColumn, DataRow } from '../../data/index';
import { DataTableAdapter, DataColumn, DataRow } from '../../data/datatable-adapter';
@Component({
selector: 'alfresco-datatable-cell',

View File

@@ -16,12 +16,14 @@
*/
import { Component, OnChanges, SimpleChange, SimpleChanges, Input, Output, EventEmitter, ElementRef, TemplateRef, AfterContentInit, ContentChild, Optional } from '@angular/core';
import { DataTableAdapter, DataRow, DataColumn, DataSorting, DataRowEvent, ObjectDataTableAdapter, ObjectDataRow } from '../../data/index';
import { DataCellEvent } from './data-cell.event';
import { DataRowActionEvent } from './data-row-action.event';
import { DataColumnListComponent } from 'ng2-alfresco-core';
import { MdCheckboxChange } from '@angular/material';
import { Observable, Observer } from 'rxjs/Rx';
import { DataColumnListComponent } from 'ng2-alfresco-core';
import { DataTableAdapter, DataRow, DataColumn, DataSorting, DataRowEvent } from '../../data/datatable-adapter';
import { ObjectDataTableAdapter, ObjectDataRow } from '../../data/object-datatable-adapter';
import { DataCellEvent } from './data-cell.event';
import { DataRowActionEvent } from './data-row-action.event';
declare var componentHandler;

View File

@@ -1,19 +0,0 @@
/*!
* @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.
*/
export * from './datatable/index';
export * from './pagination/index';

View File

@@ -1,18 +0,0 @@
/*!
* @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.
*/
export * from './pagination.component';

View File

@@ -15,5 +15,5 @@
* limitations under the License.
*/
export * from './datatable-adapter';
export * from './object-datatable-adapter';
export { DataColumn, DataRow, DataRowEvent, DataSorting, DataTableAdapter } from './datatable-adapter';
export { ObjectDataColumn, ObjectDataRow, ObjectDataTableAdapter } from './object-datatable-adapter';

View File

@@ -1,19 +0,0 @@
/*!
* @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.
*/
export * from './no-content-template.component';
export * from './loading-template.component';

View File

@@ -15,5 +15,20 @@
* limitations under the License.
*/
export * from './datatable.component';
export * from './datatable-cell.component';
import { NgModule } from '@angular/core';
import { MdCheckboxModule, MdMenuModule, MdIconModule, MdButtonModule } from '@angular/material';
export function modules() {
return [
MdCheckboxModule,
MdMenuModule,
MdIconModule,
MdButtonModule
];
}
@NgModule({
imports: modules(),
exports: modules()
})
export class MaterialModule {}