From f6061493442bb6ebf65d0a15ca52b9f7d2c618cf Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 7 Aug 2018 23:03:20 +0100 Subject: [PATCH] [ADF-3380] lazy loading fixes (#3609) * lazy loading file viewer * fix issue with CoreModule referencing * fix issue with app config and lazy loading * test fixes * fix import * lazy loading workaround for content module * fix providers for lazy loading * fix tests * lazy loading for Process Services lib * lazy loading for Insights, module cleanup * fix issue with Translate module, optimise imports * lazy-load blob viewer (demo shell) * remove duplicate pdf init * update to more stable pdfjs * fix license header * fix lint issues * fix test import * fix pdf version --- demo-shell/src/app/adf.module.ts | 39 ------ demo-shell/src/app/app.component.spec.ts | 10 +- demo-shell/src/app/app.module.ts | 25 ++-- demo-shell/src/app/app.routes.ts | 30 ++++- .../blob-preview/blob-preview.module.ts | 53 ++++++++ .../components/file-view/file-view.module.ts | 51 ++++++++ demo-shell/src/main.ts | 7 -- .../breadcrumb/breadcrumb.module.ts | 4 +- .../content-metadata.module.ts | 6 +- .../content-node-selector.module.ts | 21 +--- lib/content-services/content.module.ts | 114 ++++++++++++++++-- lib/content-services/dialogs/dialog.module.ts | 12 +- .../document-list/document-list.module.ts | 23 +--- .../permission-manager.module.ts | 17 +-- lib/content-services/search/search.module.ts | 7 +- .../site-dropdown/sites-dropdown.module.ts | 6 +- lib/content-services/tag/tag.module.ts | 10 +- .../testing/content.testing.module.ts | 2 +- lib/content-services/upload/upload.module.ts | 8 +- .../version-manager/version-manager.module.ts | 7 +- .../webscript/webscript.module.ts | 7 +- lib/core/about/about.module.ts | 2 +- lib/core/app-config/app-config.module.ts | 4 - lib/core/buttons-menu/buttons-menu.module.ts | 2 +- lib/core/card-view/card-view.module.ts | 2 +- lib/core/collapsable/collapsable.module.ts | 3 - lib/core/comments/comments.module.ts | 2 +- .../context-menu-holder.component.spec.ts | 2 + lib/core/context-menu/context-menu.module.ts | 6 +- lib/core/core.module.ts | 24 +++- lib/core/datatable/datatable.module.ts | 2 +- lib/core/form/form.module.ts | 19 +-- lib/core/login/login.module.ts | 10 +- lib/core/package.json | 2 +- lib/core/pagination/pagination.module.ts | 2 +- lib/core/settings/host-settings.module.ts | 2 +- .../sorting-picker/sorting-picker.module.ts | 2 +- lib/core/templates/template.module.ts | 2 +- lib/core/userinfo/userinfo.module.ts | 8 +- lib/core/viewer/viewer.module.ts | 2 +- .../analytics-process.module.ts | 11 +- lib/insights/diagram/diagram.module.ts | 14 +-- lib/insights/insights.module.ts | 62 +++++++++- .../testing/insights.testing.module.ts | 9 +- .../app-list/apps-list.module.ts | 4 +- .../attachment/attachment.module.ts | 2 +- .../attach-file-widget.components.spec.ts | 7 +- .../content-widget/content-widget.module.ts | 2 +- lib/process-services/people/people.module.ts | 7 +- .../process-comments.module.ts | 8 +- .../process-list/process-list.module.ts | 12 +- lib/process-services/process.module.ts | 78 ++++++++++-- .../task-list/task-list.module.ts | 14 +-- .../testing/process.testing.module.ts | 9 +- package.json | 2 +- 55 files changed, 498 insertions(+), 300 deletions(-) delete mode 100644 demo-shell/src/app/adf.module.ts create mode 100644 demo-shell/src/app/components/blob-preview/blob-preview.module.ts create mode 100644 demo-shell/src/app/components/file-view/file-view.module.ts diff --git a/demo-shell/src/app/adf.module.ts b/demo-shell/src/app/adf.module.ts deleted file mode 100644 index 284798d9d6..0000000000 --- a/demo-shell/src/app/adf.module.ts +++ /dev/null @@ -1,39 +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. - */ - -import { NgModule } from '@angular/core'; - -import { ContentModule } from '@alfresco/adf-content-services'; -import { ProcessModule } from '@alfresco/adf-process-services'; -import { CoreModule } from '@alfresco/adf-core'; -import { InsightsModule } from '@alfresco/adf-insights'; - -export function modules() { - return [ - CoreModule, - ContentModule, - InsightsModule, - ProcessModule - ]; -} - -@NgModule({ - imports: modules(), - exports: modules() -}) -export class AdfModule { -} diff --git a/demo-shell/src/app/app.component.spec.ts b/demo-shell/src/app/app.component.spec.ts index a9a112553c..6d7fd4e156 100644 --- a/demo-shell/src/app/app.component.spec.ts +++ b/demo-shell/src/app/app.component.spec.ts @@ -17,8 +17,11 @@ import { TestBed, async } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; +import { ContentModule } from '@alfresco/adf-content-services'; +import { ProcessModule } from '@alfresco/adf-process-services'; +import { CoreModule } from '@alfresco/adf-core'; +import { InsightsModule } from '@alfresco/adf-insights'; -import { AdfModule } from './adf.module'; import { AppComponent } from './app.component'; describe('AppComponent', () => { @@ -26,7 +29,10 @@ describe('AppComponent', () => { TestBed.configureTestingModule({ imports: [ RouterTestingModule, - AdfModule + CoreModule.forRoot(), + ContentModule.forRoot(), + InsightsModule, + ProcessModule ], declarations: [ AppComponent diff --git a/demo-shell/src/app/app.module.ts b/demo-shell/src/app/app.module.ts index c27b7fbd04..ad4127be32 100644 --- a/demo-shell/src/app/app.module.ts +++ b/demo-shell/src/app/app.module.ts @@ -23,9 +23,8 @@ import { ChartsModule } from 'ng2-charts'; import { HttpClientModule } from '@angular/common/http'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; -import { AppConfigService, TRANSLATION_PROVIDER, DebugAppConfigService } from '@alfresco/adf-core'; +import { AppConfigService, TRANSLATION_PROVIDER, DebugAppConfigService, CoreModule } from '@alfresco/adf-core'; import { AppComponent } from './app.component'; -import { AdfModule } from './adf.module'; import { MaterialModule } from './material.module'; import { LoginComponent } from './components/login/login.component'; import { LogoutComponent } from './components/logout/logout.component'; @@ -51,13 +50,11 @@ import { AppsViewComponent } from './components/process-service/apps-view.compon import { DataTableComponent } from './components/datatable/datatable.component'; import { TrashcanComponent } from './components/trashcan/trashcan.component'; import { FilesComponent } from './components/files/files.component'; -import { FileViewComponent } from './components/file-view/file-view.component'; import { WebscriptComponent } from './components/webscript/webscript.component'; import { TagComponent } from './components/tag/tag.component'; import { SocialComponent } from './components/social/social.component'; import { VersionManagerDialogAdapterComponent } from './components/files/version-manager-dialog-adapter.component'; import { MetadataDialogAdapterComponent } from './components/files/metadata-dialog-adapter.component'; -import { BlobPreviewComponent } from './components/blob-preview/blob-preview.component'; import { ThemePickerModule } from './components/theme-picker/theme-picker'; @@ -79,6 +76,9 @@ import { HeaderDataComponent } from './components/header-data/header-data.compon import { ConfigEditorComponent } from './components/config-editor/config-editor.component'; import { HeaderDataService } from './components/header-data/header-data.service'; import { MonacoEditorModule } from 'ngx-monaco-editor'; +import { ContentModule } from '@alfresco/adf-content-services'; +import { InsightsModule } from '@alfresco/adf-insights'; +import { ProcessModule } from '@alfresco/adf-process-services'; @NgModule({ imports: [ @@ -87,13 +87,16 @@ import { MonacoEditorModule } from 'ngx-monaco-editor'; ReactiveFormsModule, routing, FormsModule, - MaterialModule, - ThemePickerModule, - FlexLayoutModule, - ChartsModule, HttpClientModule, - AdfModule, - MonacoEditorModule.forRoot() + MaterialModule, + FlexLayoutModule, + CoreModule.forRoot(), + ContentModule.forRoot(), + InsightsModule.forRoot(), + ProcessModule.forRoot(), + ThemePickerModule, + ChartsModule, + MonacoEditorModule.forRoot(), ], declarations: [ AppComponent, @@ -114,7 +117,6 @@ import { MonacoEditorModule } from 'ngx-monaco-editor'; AppsViewComponent, DataTableComponent, FilesComponent, - FileViewComponent, TrashcanComponent, FormComponent, FormListComponent, @@ -131,7 +133,6 @@ import { MonacoEditorModule } from 'ngx-monaco-editor'; FormLoadingComponent, DemoPermissionComponent, FormLoadingComponent, - BlobPreviewComponent, BreadcrumbDemoComponent, NotificationsComponent, CardViewComponent, diff --git a/demo-shell/src/app/app.routes.ts b/demo-shell/src/app/app.routes.ts index babc45e831..b5b733a358 100644 --- a/demo-shell/src/app/app.routes.ts +++ b/demo-shell/src/app/app.routes.ts @@ -40,14 +40,12 @@ import { SocialComponent } from './components/social/social.component'; import { FilesComponent } from './components/files/files.component'; import { FormComponent } from './components/form/form.component'; -import { FileViewComponent } from './components/file-view/file-view.component'; import { CustomSourcesComponent } from './components/files/custom-sources.component'; import { FormListComponent } from './components/form/form-list.component'; import { OverlayViewerComponent } from './components/overlay-viewer/overlay-viewer.component'; import { SharedLinkViewComponent } from './components/shared-link-view/shared-link-view.component'; import { FormLoadingComponent } from './components/form/form-loading.component'; import { DemoPermissionComponent } from './components/permissions/demo-permissions.component'; -import { BlobPreviewComponent } from './components/blob-preview/blob-preview.component'; import { BreadcrumbDemoComponent } from './components/breadcrumb-demo/breadcrumb-demo.component'; import { TaskListDemoComponent } from './components/task-list-demo/task-list-demo.component'; import { ProcessListDemoComponent } from './components/process-list-demo/process-list-demo.component'; @@ -57,13 +55,37 @@ import { ContentNodeSelectorComponent } from './components/content-node-selector import { ReportIssueComponent } from './components/report-issue/report-issue.component'; import { HeaderDataComponent } from './components/header-data/header-data.component'; import { ConfigEditorComponent } from './components/config-editor/config-editor.component'; +import { AppComponent } from './app.component'; export const appRoutes: Routes = [ { path: 'login', component: LoginComponent }, { path: 'logout', component: LogoutComponent }, { path: 'settings', component: SettingsComponent }, - { path: 'files/:nodeId/view', component: FileViewComponent, canActivate: [ AuthGuardEcm ], outlet: 'overlay' }, - { path: 'preview/blob', component: BlobPreviewComponent, outlet: 'overlay', pathMatch: 'full' }, + { + path: 'files/:nodeId/view', + component: AppComponent, + canActivate: [ AuthGuardEcm ], + canActivateChild: [ AuthGuardEcm ], + outlet: 'overlay', + children: [ + { + path: '', + loadChildren: 'app/components/file-view/file-view.module#FileViewModule' + } + ] + }, + { + path: 'preview/blob', + component: AppComponent, + outlet: 'overlay', + pathMatch: 'full', + children: [ + { + path: '', + loadChildren: 'app/components/blob-preview/blob-preview.module#BlobPreviewModule' + } + ] + }, { path: 'preview/s/:id', component: SharedLinkViewComponent }, { path: 'breadcrumb', diff --git a/demo-shell/src/app/components/blob-preview/blob-preview.module.ts b/demo-shell/src/app/components/blob-preview/blob-preview.module.ts new file mode 100644 index 0000000000..2f23b198fa --- /dev/null +++ b/demo-shell/src/app/components/blob-preview/blob-preview.module.ts @@ -0,0 +1,53 @@ +/*! + * @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 { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import { CommonModule } from '@angular/common'; +import { CoreModule, InfoDrawerModule } from '@alfresco/adf-core'; +import { ContentDirectiveModule, ContentMetadataModule, VersionManagerModule } from '@alfresco/adf-content-services'; +import { BlobPreviewComponent } from './blob-preview.component'; + +import * as pdfjsLib from 'pdfjs-dist'; +pdfjsLib.PDFJS.workerSrc = 'pdf.worker.js'; +pdfjsLib.PDFJS.disableFontFace = true; + +const routes: Routes = [ + { + path: '', + component: BlobPreviewComponent + } +]; + +@NgModule({ + imports: [ + CommonModule, + RouterModule.forChild(routes), + CoreModule.forChild(), + InfoDrawerModule, + ContentDirectiveModule, + ContentMetadataModule, + VersionManagerModule + ], + declarations: [ + BlobPreviewComponent + ], + exports: [ + BlobPreviewComponent + ] +}) +export class BlobPreviewModule {} diff --git a/demo-shell/src/app/components/file-view/file-view.module.ts b/demo-shell/src/app/components/file-view/file-view.module.ts new file mode 100644 index 0000000000..c3e909a357 --- /dev/null +++ b/demo-shell/src/app/components/file-view/file-view.module.ts @@ -0,0 +1,51 @@ +/*! + * @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 { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { Routes, RouterModule } from '@angular/router'; +import { CoreModule, InfoDrawerModule } from '@alfresco/adf-core'; +import { ContentDirectiveModule, VersionManagerModule, ContentMetadataModule } from '@alfresco/adf-content-services'; +import { FileViewComponent } from './file-view.component'; + +import * as pdfjsLib from 'pdfjs-dist'; +pdfjsLib.PDFJS.workerSrc = 'pdf.worker.js'; +pdfjsLib.PDFJS.disableFontFace = true; + +const routes: Routes = [ + { + path: '', + component: FileViewComponent + } +]; + +@NgModule({ + imports: [ + CommonModule, + RouterModule.forChild(routes), + CoreModule.forChild(), + InfoDrawerModule, + ContentDirectiveModule, + ContentMetadataModule, + VersionManagerModule + ], + declarations: [FileViewComponent], + exports: [FileViewComponent] +}) +export class FileViewModule { + +} diff --git a/demo-shell/src/main.ts b/demo-shell/src/main.ts index b86503648f..04f3b3f925 100644 --- a/demo-shell/src/main.ts +++ b/demo-shell/src/main.ts @@ -20,18 +20,11 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { AppModule } from './app/app.module'; import { environment } from './environments/environment'; -import { PDFJSStatic } from 'pdfjs-dist'; - -declare global { - const PDFJS: PDFJSStatic; -} import 'hammerjs'; import 'chart.js'; import 'ng2-charts'; -PDFJS.workerSrc = 'pdf.worker.min.js'; - if (environment.production) { enableProdMode(); } diff --git a/lib/content-services/breadcrumb/breadcrumb.module.ts b/lib/content-services/breadcrumb/breadcrumb.module.ts index 8ca9346de8..122518359a 100644 --- a/lib/content-services/breadcrumb/breadcrumb.module.ts +++ b/lib/content-services/breadcrumb/breadcrumb.module.ts @@ -18,16 +18,16 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { MaterialModule } from '../material.module'; -import { TranslateModule } from '@ngx-translate/core'; import { BreadcrumbComponent } from './breadcrumb.component'; import { DropdownBreadcrumbComponent } from './dropdown-breadcrumb.component'; +import { CoreModule } from '@alfresco/adf-core'; @NgModule({ imports: [ CommonModule, MaterialModule, - TranslateModule + CoreModule.forChild() ], exports: [ BreadcrumbComponent, diff --git a/lib/content-services/content-metadata/content-metadata.module.ts b/lib/content-services/content-metadata/content-metadata.module.ts index 4be0a1aed3..b17c8b1e96 100644 --- a/lib/content-services/content-metadata/content-metadata.module.ts +++ b/lib/content-services/content-metadata/content-metadata.module.ts @@ -18,9 +18,8 @@ import { CommonModule } from '@angular/common'; import { FlexLayoutModule } from '@angular/flex-layout'; import { NgModule } from '@angular/core'; -import { TranslateModule } from '@ngx-translate/core'; import { MaterialModule } from '../material.module'; -import { CardViewModule } from '@alfresco/adf-core'; +import { CoreModule } from '@alfresco/adf-core'; import { ContentMetadataComponent } from './components/content-metadata/content-metadata.component'; import { ContentMetadataCardComponent } from './components/content-metadata-card/content-metadata-card.component'; @@ -28,9 +27,8 @@ import { ContentMetadataCardComponent } from './components/content-metadata-card imports: [ CommonModule, MaterialModule, - TranslateModule, FlexLayoutModule, - CardViewModule + CoreModule.forChild() ], exports: [ ContentMetadataComponent, diff --git a/lib/content-services/content-node-selector/content-node-selector.module.ts b/lib/content-services/content-node-selector/content-node-selector.module.ts index b1919a54c7..09074de241 100644 --- a/lib/content-services/content-node-selector/content-node-selector.module.ts +++ b/lib/content-services/content-node-selector/content-node-selector.module.ts @@ -19,15 +19,12 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { MaterialModule } from '../material.module'; -import { TranslateModule } from '@ngx-translate/core'; import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component'; import { ContentNodeSelectorComponent } from './content-node-selector.component'; -import { ContentNodeSelectorService } from './content-node-selector.service'; -import { ContentNodeDialogService } from './content-node-dialog.service'; import { SitesDropdownModule } from '../site-dropdown/sites-dropdown.module'; import { BreadcrumbModule } from '../breadcrumb/breadcrumb.module'; -import { PaginationModule, ToolbarModule, DirectiveModule, DataColumnModule, DataTableModule } from '@alfresco/adf-core'; +import { CoreModule } from '@alfresco/adf-core'; import { DocumentListModule } from '../document-list/document-list.module'; import { NameLocationCellComponent } from './name-location-cell/name-location-cell.component'; @@ -35,17 +32,12 @@ import { NameLocationCellComponent } from './name-location-cell/name-location-ce imports: [ FormsModule, ReactiveFormsModule, - DirectiveModule, + CoreModule.forChild(), CommonModule, MaterialModule, - TranslateModule, SitesDropdownModule, BreadcrumbModule, - ToolbarModule, - DocumentListModule, - DataColumnModule, - DataTableModule, - PaginationModule + DocumentListModule ], exports: [ ContentNodeSelectorPanelComponent, @@ -53,16 +45,13 @@ import { NameLocationCellComponent } from './name-location-cell/name-location-ce ContentNodeSelectorComponent ], entryComponents: [ - ContentNodeSelectorPanelComponent, ContentNodeSelectorComponent + ContentNodeSelectorPanelComponent, + ContentNodeSelectorComponent ], declarations: [ ContentNodeSelectorPanelComponent, NameLocationCellComponent, ContentNodeSelectorComponent - ], - providers: [ - ContentNodeSelectorService, - ContentNodeDialogService ] }) export class ContentNodeSelectorModule {} diff --git a/lib/content-services/content.module.ts b/lib/content-services/content.module.ts index 6dd253dd5d..f827a9c00a 100644 --- a/lib/content-services/content.module.ts +++ b/lib/content-services/content.module.ts @@ -16,7 +16,7 @@ */ import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; +import { NgModule, ModuleWithProviders } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { CoreModule, TRANSLATION_PROVIDER } from '@alfresco/adf-core'; @@ -45,10 +45,86 @@ import { BasicPropertiesService } from './content-metadata/services/basic-proper import { PropertyGroupTranslatorService } from './content-metadata/services/property-groups-translator.service'; import { SearchQueryBuilderService } from './search/search-query-builder.service'; import { SearchFilterService } from './search/components/search-filter/search-filter.service'; +import { ContentNodeSelectorService } from './content-node-selector/content-node-selector.service'; +import { ContentNodeDialogService } from './content-node-selector/content-node-dialog.service'; +import { DocumentListService } from './document-list/services/document-list.service'; +import { FolderActionsService } from './document-list/services/folder-actions.service'; +import { DocumentActionsService } from './document-list/services/document-actions.service'; +import { NodeActionsService } from './document-list/services/node-actions.service'; +import { CustomResourcesService } from './document-list/services/custom-resources.service'; +import { NodePermissionDialogService } from './permission-manager/services/node-permission-dialog.service'; +import { NodePermissionService } from './permission-manager/services/node-permission.service'; +import { TagService } from './tag/services/tag.service'; + +export function providers() { + return [ + RatingService, + ContentMetadataService, + PropertyDescriptorsService, + ContentMetadataConfigFactory, + BasicPropertiesService, + PropertyGroupTranslatorService, + SearchQueryBuilderService, + SearchFilterService, + ContentNodeSelectorService, + ContentNodeDialogService, + DocumentListService, + FolderActionsService, + DocumentActionsService, + NodeActionsService, + CustomResourcesService, + NodePermissionDialogService, + NodePermissionService, + TagService + ]; +} @NgModule({ imports: [ - CoreModule, + CoreModule.forChild(), + SocialModule, + TagModule, + CommonModule, + WebScriptModule, + FormsModule, + ReactiveFormsModule, + DialogModule, + SearchModule, + DocumentListModule, + UploadModule, + MaterialModule, + SitesDropdownModule, + BreadcrumbModule, + ContentNodeSelectorModule, + ContentMetadataModule, + FolderDirectiveModule, + ContentDirectiveModule, + PermissionManagerModule, + VersionManagerModule + ], + exports: [ + SocialModule, + TagModule, + WebScriptModule, + DocumentListModule, + UploadModule, + SearchModule, + SitesDropdownModule, + BreadcrumbModule, + ContentNodeSelectorModule, + ContentMetadataModule, + DialogModule, + FolderDirectiveModule, + ContentDirectiveModule, + PermissionManagerModule, + VersionManagerModule + ] +}) +export class ContentModuleLazy {} + +@NgModule({ + imports: [ + CoreModule.forChild(), SocialModule, TagModule, CommonModule, @@ -70,6 +146,7 @@ import { SearchFilterService } from './search/components/search-filter/search-fi VersionManagerModule ], providers: [ + ...providers(), { provide: TRANSLATION_PROVIDER, multi: true, @@ -77,18 +154,9 @@ import { SearchFilterService } from './search/components/search-filter/search-fi name: 'adf-content-services', source: 'assets/adf-content-services' } - }, - RatingService, - ContentMetadataService, - PropertyDescriptorsService, - ContentMetadataConfigFactory, - BasicPropertiesService, - PropertyGroupTranslatorService, - SearchQueryBuilderService, - SearchFilterService + } ], exports: [ - CoreModule, SocialModule, TagModule, WebScriptModule, @@ -107,4 +175,26 @@ import { SearchFilterService } from './search/components/search-filter/search-fi ] }) export class ContentModule { + static forRoot(): ModuleWithProviders { + return { + ngModule: ContentModule, + providers: [ + ...providers(), + { + provide: TRANSLATION_PROVIDER, + multi: true, + useValue: { + name: 'adf-content-services', + source: 'assets/adf-content-services' + } + } + ] + }; + } + + static forChild(): ModuleWithProviders { + return { + ngModule: ContentModuleLazy + }; + } } diff --git a/lib/content-services/dialogs/dialog.module.ts b/lib/content-services/dialogs/dialog.module.ts index a07d6f4625..5d752b22c7 100644 --- a/lib/content-services/dialogs/dialog.module.ts +++ b/lib/content-services/dialogs/dialog.module.ts @@ -17,18 +17,15 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { MaterialModule } from '../material.module'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { CoreModule } from '@alfresco/adf-core'; +import { MaterialModule } from '../material.module'; import { DownloadZipDialogComponent } from './download-zip.dialog'; import { FolderDialogComponent } from './folder.dialog'; import { NodeLockDialogComponent } from './node-lock.dialog'; import { ShareDialogComponent } from './share.dialog'; import { ConfirmDialogComponent } from './confirm.dialog'; - -import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { TranslateModule } from '@ngx-translate/core'; - -import { FormModule } from '@alfresco/adf-core'; import { MatDatetimepickerModule } from '@mat-datetimepicker/core'; import { MatMomentDatetimeModule } from '@mat-datetimepicker/moment'; @@ -36,9 +33,8 @@ import { MatMomentDatetimeModule } from '@mat-datetimepicker/moment'; imports: [ CommonModule, MaterialModule, - TranslateModule, + CoreModule.forChild(), FormsModule, - FormModule, ReactiveFormsModule, MatMomentDatetimeModule, MatDatetimepickerModule diff --git a/lib/content-services/document-list/document-list.module.ts b/lib/content-services/document-list/document-list.module.ts index f089331d6c..6e493fc5cb 100644 --- a/lib/content-services/document-list/document-list.module.ts +++ b/lib/content-services/document-list/document-list.module.ts @@ -18,8 +18,7 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FlexLayoutModule } from '@angular/flex-layout'; -import { TranslateModule } from '@ngx-translate/core'; -import { DataTableModule, PaginationModule, ToolbarModule } from '@alfresco/adf-core'; +import { CoreModule } from '@alfresco/adf-core'; import { MaterialModule } from '../material.module'; import { UploadModule } from '../upload/upload.module'; @@ -33,22 +32,13 @@ import { DocumentListComponent } from './components/document-list.component'; import { EmptyFolderContentDirective } from './components/empty-folder/empty-folder-content.directive'; import { NoPermissionContentDirective } from './components/no-permission/no-permission-content.directive'; -import { DocumentActionsService } from './services/document-actions.service'; -import { DocumentListService } from './services/document-list.service'; -import { FolderActionsService } from './services/folder-actions.service'; -import { NodeActionsService } from './services/node-actions.service'; -import { CustomResourcesService } from './services/custom-resources.service'; - @NgModule({ imports: [ - ToolbarModule, + CoreModule.forChild(), CommonModule, - DataTableModule, FlexLayoutModule, MaterialModule, - UploadModule, - TranslateModule, - PaginationModule + UploadModule ], declarations: [ DocumentListComponent, @@ -59,13 +49,6 @@ import { CustomResourcesService } from './services/custom-resources.service'; EmptyFolderContentDirective, NoPermissionContentDirective ], - providers: [ - DocumentListService, - FolderActionsService, - DocumentActionsService, - NodeActionsService, - CustomResourcesService - ], exports: [ DocumentListComponent, ContentColumnComponent, diff --git a/lib/content-services/permission-manager/permission-manager.module.ts b/lib/content-services/permission-manager/permission-manager.module.ts index b64538de7e..0481cd0a22 100644 --- a/lib/content-services/permission-manager/permission-manager.module.ts +++ b/lib/content-services/permission-manager/permission-manager.module.ts @@ -18,28 +18,23 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { TranslateModule } from '@ngx-translate/core'; import { MaterialModule } from '../material.module'; import { PermissionListComponent } from './components/permission-list/permission-list.component'; import { AddPermissionComponent } from './components/add-permission/add-permission.component'; import { AddPermissionDialogComponent } from './components/add-permission/add-permission-dialog.component'; -import { DataTableModule, DataColumnModule } from '@alfresco/adf-core'; +import { CoreModule } from '@alfresco/adf-core'; import { InheritPermissionDirective } from './components/inherited-button.directive'; -import { NodePermissionService } from './services/node-permission.service'; import { NoPermissionTemplateComponent } from './components/permission-list/no-permission.component'; -import { NodePermissionDialogService } from './services/node-permission-dialog.service'; import { AddPermissionPanelComponent } from './components/add-permission/add-permission-panel.component'; import { SearchModule } from '../search/search.module'; @NgModule({ imports: [ + CoreModule.forChild(), CommonModule, FormsModule, ReactiveFormsModule, MaterialModule, - TranslateModule, - DataTableModule, - DataColumnModule, SearchModule ], declarations: [ @@ -50,11 +45,11 @@ import { SearchModule } from '../search/search.module'; AddPermissionComponent, AddPermissionDialogComponent ], - providers: [ - NodePermissionDialogService, - NodePermissionService + entryComponents: [ + AddPermissionPanelComponent, + AddPermissionComponent, + AddPermissionDialogComponent ], - entryComponents: [ AddPermissionPanelComponent, AddPermissionComponent, AddPermissionDialogComponent ], exports: [ PermissionListComponent, NoPermissionTemplateComponent, diff --git a/lib/content-services/search/search.module.ts b/lib/content-services/search/search.module.ts index 6e3f210f37..86fc662315 100644 --- a/lib/content-services/search/search.module.ts +++ b/lib/content-services/search/search.module.ts @@ -18,10 +18,9 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { TranslateModule } from '@ngx-translate/core'; import { MaterialModule } from '../material.module'; -import { PipeModule, CoreModule } from '@alfresco/adf-core'; +import { CoreModule } from '@alfresco/adf-core'; import { SearchTriggerDirective } from './components/search-trigger.directive'; @@ -50,13 +49,11 @@ export const ALFRESCO_SEARCH_DIRECTIVES: any[] = [ @NgModule({ imports: [ - CoreModule, CommonModule, FormsModule, ReactiveFormsModule, MaterialModule, - PipeModule, - TranslateModule + CoreModule.forChild() ], declarations: [ ...ALFRESCO_SEARCH_DIRECTIVES, diff --git a/lib/content-services/site-dropdown/sites-dropdown.module.ts b/lib/content-services/site-dropdown/sites-dropdown.module.ts index cac757251d..ab1734fd11 100644 --- a/lib/content-services/site-dropdown/sites-dropdown.module.ts +++ b/lib/content-services/site-dropdown/sites-dropdown.module.ts @@ -18,18 +18,18 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { MaterialModule } from '../material.module'; -import { TranslateModule } from '@ngx-translate/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { DropdownSitesComponent } from './sites-dropdown.component'; +import { CoreModule } from '@alfresco/adf-core'; @NgModule({ imports: [ CommonModule, MaterialModule, - TranslateModule, FormsModule, - ReactiveFormsModule + ReactiveFormsModule, + CoreModule.forChild() ], exports: [ DropdownSitesComponent diff --git a/lib/content-services/tag/tag.module.ts b/lib/content-services/tag/tag.module.ts index 7b6e8e8ffe..190bd64d9e 100644 --- a/lib/content-services/tag/tag.module.ts +++ b/lib/content-services/tag/tag.module.ts @@ -18,21 +18,20 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { TranslateModule } from '@ngx-translate/core'; import { MaterialModule } from '../material.module'; import { TagActionsComponent } from './tag-actions.component'; import { TagListComponent } from './tag-list.component'; import { TagNodeListComponent } from './tag-node-list.component'; -import { TagService } from './services/tag.service'; +import { CoreModule } from '@alfresco/adf-core'; @NgModule({ imports: [ CommonModule, MaterialModule, - TranslateModule, FormsModule, - ReactiveFormsModule + ReactiveFormsModule, + CoreModule.forChild() ], exports: [ TagActionsComponent, @@ -43,9 +42,6 @@ import { TagService } from './services/tag.service'; TagActionsComponent, TagListComponent, TagNodeListComponent - ], - providers: [ - TagService ] }) export class TagModule {} diff --git a/lib/content-services/testing/content.testing.module.ts b/lib/content-services/testing/content.testing.module.ts index 0c9f664f6d..e80a371033 100644 --- a/lib/content-services/testing/content.testing.module.ts +++ b/lib/content-services/testing/content.testing.module.ts @@ -36,7 +36,7 @@ import { ContentModule } from '../content.module'; NoopAnimationsModule, RouterTestingModule, CoreModule.forRoot(), - ContentModule + ContentModule.forRoot() ], providers: [ { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }, diff --git a/lib/content-services/upload/upload.module.ts b/lib/content-services/upload/upload.module.ts index ef235238ba..aebb09eb81 100644 --- a/lib/content-services/upload/upload.module.ts +++ b/lib/content-services/upload/upload.module.ts @@ -17,7 +17,6 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { TranslateModule } from '@ngx-translate/core'; import { MaterialModule } from '../material.module'; import { FileUploadingDialogComponent } from './components/file-uploading-dialog.component'; @@ -27,15 +26,14 @@ import { UploadButtonComponent } from './components/upload-button.component'; import { UploadVersionButtonComponent } from './components/upload-version-button.component'; import { UploadDragAreaComponent } from './components/upload-drag-area.component'; -import { PipeModule } from '@alfresco/adf-core'; +import { CoreModule } from '@alfresco/adf-core'; import { FileDraggableDirective } from './directives/file-draggable.directive'; @NgModule({ imports: [ + CoreModule.forChild(), CommonModule, - MaterialModule, - TranslateModule, - PipeModule + MaterialModule ], declarations: [ FileDraggableDirective, diff --git a/lib/content-services/version-manager/version-manager.module.ts b/lib/content-services/version-manager/version-manager.module.ts index 826fbf75ee..3c6b8c5ee8 100644 --- a/lib/content-services/version-manager/version-manager.module.ts +++ b/lib/content-services/version-manager/version-manager.module.ts @@ -19,18 +19,18 @@ import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { NgModule } from '@angular/core'; import { MaterialModule } from '../material.module'; -import { TranslateModule } from '@ngx-translate/core'; import { VersionUploadComponent } from './version-upload.component'; import { VersionManagerComponent } from './version-manager.component'; import { VersionListComponent } from './version-list.component'; import { UploadModule } from '../upload/upload.module'; +import { CoreModule } from '@alfresco/adf-core'; @NgModule({ imports: [ CommonModule, MaterialModule, - TranslateModule, + CoreModule.forChild(), UploadModule, FormsModule ], @@ -44,7 +44,6 @@ import { UploadModule } from '../upload/upload.module'; VersionUploadComponent, VersionManagerComponent, VersionListComponent - ], - providers: [] + ] }) export class VersionManagerModule {} diff --git a/lib/content-services/webscript/webscript.module.ts b/lib/content-services/webscript/webscript.module.ts index b6ebbdb6a5..72229fda0c 100644 --- a/lib/content-services/webscript/webscript.module.ts +++ b/lib/content-services/webscript/webscript.module.ts @@ -15,10 +15,9 @@ * limitations under the License. */ -import { DataTableModule, PipeModule } from '@alfresco/adf-core'; +import { CoreModule } from '@alfresco/adf-core'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { TranslateModule } from '@ngx-translate/core'; import { MaterialModule } from '../material.module'; import { WebscriptComponent } from './webscript.component'; @@ -26,10 +25,8 @@ import { WebscriptComponent } from './webscript.component'; @NgModule({ imports: [ CommonModule, - PipeModule, MaterialModule, - DataTableModule, - TranslateModule + CoreModule.forChild() ], exports: [ WebscriptComponent diff --git a/lib/core/about/about.module.ts b/lib/core/about/about.module.ts index 17cfa33210..9f87dc2ef8 100644 --- a/lib/core/about/about.module.ts +++ b/lib/core/about/about.module.ts @@ -27,7 +27,7 @@ import { DataColumnModule } from '../data-column/data-column.module'; imports: [ CommonModule, MaterialModule, - TranslateModule, + TranslateModule.forChild(), DataTableModule, DataColumnModule ], diff --git a/lib/core/app-config/app-config.module.ts b/lib/core/app-config/app-config.module.ts index cab0c81744..3ce8477dd3 100644 --- a/lib/core/app-config/app-config.module.ts +++ b/lib/core/app-config/app-config.module.ts @@ -17,7 +17,6 @@ import { HttpClientModule } from '@angular/common/http'; import { NgModule } from '@angular/core'; -import { AppConfigService } from './app-config.service'; import { AppConfigPipe } from './app-config.pipe'; @NgModule({ @@ -27,9 +26,6 @@ import { AppConfigPipe } from './app-config.pipe'; declarations: [ AppConfigPipe ], - providers: [ - AppConfigService - ], exports: [ AppConfigPipe ] diff --git a/lib/core/buttons-menu/buttons-menu.module.ts b/lib/core/buttons-menu/buttons-menu.module.ts index dc350c7a79..29e5ddfd51 100644 --- a/lib/core/buttons-menu/buttons-menu.module.ts +++ b/lib/core/buttons-menu/buttons-menu.module.ts @@ -26,7 +26,7 @@ import { FlexLayoutModule } from '@angular/flex-layout'; imports: [ CommonModule, MaterialModule, - TranslateModule, + TranslateModule.forChild(), FlexLayoutModule ], declarations: [ diff --git a/lib/core/card-view/card-view.module.ts b/lib/core/card-view/card-view.module.ts index 5f74fe526e..4f2e8d5a1a 100644 --- a/lib/core/card-view/card-view.module.ts +++ b/lib/core/card-view/card-view.module.ts @@ -47,7 +47,7 @@ import { CardViewSelectItemComponent } from './components/card-view-selectitem/c CommonModule, FormsModule, FlexLayoutModule, - TranslateModule, + TranslateModule.forChild(), MatDatepickerModule, MatNativeDateModule, MatCheckboxModule, diff --git a/lib/core/collapsable/collapsable.module.ts b/lib/core/collapsable/collapsable.module.ts index d419fc7f30..3e17249a3b 100644 --- a/lib/core/collapsable/collapsable.module.ts +++ b/lib/core/collapsable/collapsable.module.ts @@ -36,9 +36,6 @@ import { AccordionComponent } from './accordion.component'; exports: [ AccordionComponent, AccordionGroupComponent - ], - providers: [ - AccordionComponent ] }) export class CollapsableModule {} diff --git a/lib/core/comments/comments.module.ts b/lib/core/comments/comments.module.ts index 2f870935bf..9f7640233a 100644 --- a/lib/core/comments/comments.module.ts +++ b/lib/core/comments/comments.module.ts @@ -36,7 +36,7 @@ import { CommentsComponent } from './comments.component'; ReactiveFormsModule, MaterialModule, CommonModule, - TranslateModule + TranslateModule.forChild() ], declarations: [ CommentListComponent, diff --git a/lib/core/context-menu/context-menu-holder.component.spec.ts b/lib/core/context-menu/context-menu-holder.component.spec.ts index dd867f3afa..8909201afd 100644 --- a/lib/core/context-menu/context-menu-holder.component.spec.ts +++ b/lib/core/context-menu/context-menu-holder.component.spec.ts @@ -21,6 +21,7 @@ import { fakeAsync, ComponentFixture, TestBed, tick } from '@angular/core/testin import { ContextMenuHolderComponent } from './context-menu-holder.component'; import { ContextMenuModule } from './context-menu.module'; import { ContextMenuService } from './context-menu.service'; +import { CoreModule } from '../core.module'; describe('ContextMenuHolderComponent', () => { let fixture: ComponentFixture; @@ -53,6 +54,7 @@ describe('ContextMenuHolderComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ imports: [ + CoreModule.forRoot(), ContextMenuModule ], providers: [ diff --git a/lib/core/context-menu/context-menu.module.ts b/lib/core/context-menu/context-menu.module.ts index 06bbbc88d0..6636fb0185 100644 --- a/lib/core/context-menu/context-menu.module.ts +++ b/lib/core/context-menu/context-menu.module.ts @@ -22,13 +22,12 @@ import { TranslateModule } from '@ngx-translate/core'; import { ContextMenuHolderComponent } from './context-menu-holder.component'; import { ContextMenuDirective } from './context-menu.directive'; -import { ContextMenuService } from './context-menu.service'; @NgModule({ imports: [ CommonModule, MaterialModule, - TranslateModule + TranslateModule.forChild() ], declarations: [ ContextMenuHolderComponent, @@ -37,9 +36,6 @@ import { ContextMenuService } from './context-menu.service'; exports: [ ContextMenuHolderComponent, ContextMenuDirective - ], - providers: [ - ContextMenuService ] }) export class ContextMenuModule {} diff --git a/lib/core/core.module.ts b/lib/core/core.module.ts index d51059b806..cc70998f28 100644 --- a/lib/core/core.module.ts +++ b/lib/core/core.module.ts @@ -83,6 +83,17 @@ import { UserPreferencesService } from './services/user-preferences.service'; import { SearchConfigurationService } from './services/search-configuration.service'; import { startupServiceFactory } from './services/startup-service-factory'; import { SortingPickerModule } from './sorting-picker/sorting-picker.module'; +import { AppConfigService } from './app-config/app-config.service'; +import { ContextMenuService } from './context-menu/context-menu.service'; +import { ActivitiContentService } from './form/services/activiti-alfresco.service'; +import { EcmModelService } from './form/services/ecm-model.service'; +import { FormRenderingService } from './form/services/form-rendering.service'; +import { FormService } from './form/services/form.service'; +import { NodeService } from './form/services/node.service'; +import { ProcessContentService } from './form/services/process-content.service'; +import { WidgetVisibilityService } from './form/services/widget-visibility.service'; +import { EcmUserService } from './userinfo/services/ecm-user.service'; +import { BpmUserService } from './userinfo/services/bpm-user.service'; export function createTranslateLoader(http: HttpClient, logService: LogService) { return new TranslateLoaderService(http, logService); @@ -124,7 +135,18 @@ export function providers() { CommentProcessService, CommentContentService, SearchConfigurationService, - DatePipe + DatePipe, + AppConfigService, + ContextMenuService, + ActivitiContentService, + EcmModelService, + FormRenderingService, + FormService, + NodeService, + ProcessContentService, + WidgetVisibilityService, + EcmUserService, + BpmUserService ]; } diff --git a/lib/core/datatable/datatable.module.ts b/lib/core/datatable/datatable.module.ts index 88394d4d5d..85d4199942 100644 --- a/lib/core/datatable/datatable.module.ts +++ b/lib/core/datatable/datatable.module.ts @@ -44,7 +44,7 @@ import { EmptyCustomContentDirective } from './directives/empty-custom-content.d RouterModule, MaterialModule, CommonModule, - TranslateModule, + TranslateModule.forChild(), ContextMenuModule, PipeModule, DirectiveModule diff --git a/lib/core/form/form.module.ts b/lib/core/form/form.module.ts index dcfd86ea13..ba9271c7ee 100644 --- a/lib/core/form/form.module.ts +++ b/lib/core/form/form.module.ts @@ -36,14 +36,6 @@ import { FormComponent } from './components/form.component'; import { StartFormComponent } from './components/start-form.component'; import { ContentWidgetComponent } from './components/widgets/content/content.widget'; import { WidgetComponent } from './components/widgets/widget.component'; - -import { ActivitiContentService } from './services/activiti-alfresco.service'; -import { EcmModelService } from './services/ecm-model.service'; -import { FormRenderingService } from './services/form-rendering.service'; -import { FormService } from './services/form.service'; -import { NodeService } from './services/node.service'; -import { ProcessContentService } from './services/process-content.service'; -import { WidgetVisibilityService } from './services/widget-visibility.service'; import { MatDatetimepickerModule, MatNativeDatetimeModule } from '@mat-datetimepicker/core'; @NgModule({ @@ -52,7 +44,7 @@ import { MatDatetimepickerModule, MatNativeDatetimeModule } from '@mat-datetimep DataTableModule, HttpClientModule, MaterialModule, - TranslateModule, + TranslateModule.forChild(), FormsModule, ReactiveFormsModule, DataColumnModule, @@ -74,15 +66,6 @@ import { MatDatetimepickerModule, MatNativeDatetimeModule } from '@mat-datetimep entryComponents: [ ...WIDGET_DIRECTIVES ], - providers: [ - ActivitiContentService, - EcmModelService, - FormRenderingService, - FormService, - NodeService, - ProcessContentService, - WidgetVisibilityService - ], exports: [ ContentWidgetComponent, FormFieldComponent, diff --git a/lib/core/login/login.module.ts b/lib/core/login/login.module.ts index 9e80aa563e..6b79eaf007 100644 --- a/lib/core/login/login.module.ts +++ b/lib/core/login/login.module.ts @@ -33,7 +33,7 @@ import { LoginHeaderDirective } from './directives/login-header.directive'; FormsModule, ReactiveFormsModule, CommonModule, - TranslateModule + TranslateModule.forChild() ], declarations: [ LoginComponent, @@ -41,11 +41,9 @@ import { LoginHeaderDirective } from './directives/login-header.directive'; LoginHeaderDirective ], exports: [ - [ - LoginComponent, - LoginFooterDirective, - LoginHeaderDirective - ] + LoginComponent, + LoginFooterDirective, + LoginHeaderDirective ] }) export class LoginModule { diff --git a/lib/core/package.json b/lib/core/package.json index 04cc351239..a0d6da5817 100644 --- a/lib/core/package.json +++ b/lib/core/package.json @@ -32,7 +32,7 @@ "hammerjs": "2.0.8", "minimatch-browser": "1.0.0", "moment": "^2.22.2", - "pdfjs-dist": "1.5.404", + "pdfjs-dist": "2.0.303", "reflect-metadata": "^0.1.12", "zone.js": "^0.8.26" }, diff --git a/lib/core/pagination/pagination.module.ts b/lib/core/pagination/pagination.module.ts index 9d02ec6866..8bf90d2ad4 100644 --- a/lib/core/pagination/pagination.module.ts +++ b/lib/core/pagination/pagination.module.ts @@ -26,7 +26,7 @@ import { PaginationComponent } from './pagination.component'; imports: [ CommonModule, MaterialModule, - TranslateModule + TranslateModule.forChild() ], declarations: [ InfinitePaginationComponent, diff --git a/lib/core/settings/host-settings.module.ts b/lib/core/settings/host-settings.module.ts index 4716a20787..321ba06493 100644 --- a/lib/core/settings/host-settings.module.ts +++ b/lib/core/settings/host-settings.module.ts @@ -27,7 +27,7 @@ import { HostSettingsComponent } from './host-settings.component'; imports: [ CommonModule, MaterialModule, - TranslateModule, + TranslateModule.forChild(), FormsModule, ReactiveFormsModule ], diff --git a/lib/core/sorting-picker/sorting-picker.module.ts b/lib/core/sorting-picker/sorting-picker.module.ts index 138d079317..dbfde9c67e 100644 --- a/lib/core/sorting-picker/sorting-picker.module.ts +++ b/lib/core/sorting-picker/sorting-picker.module.ts @@ -25,7 +25,7 @@ import { SortingPickerComponent } from './sorting-picker.component'; imports: [ CommonModule, MaterialModule, - TranslateModule + TranslateModule.forChild() ], declarations: [ SortingPickerComponent diff --git a/lib/core/templates/template.module.ts b/lib/core/templates/template.module.ts index fb6ec2d54e..c3950b638f 100644 --- a/lib/core/templates/template.module.ts +++ b/lib/core/templates/template.module.ts @@ -26,7 +26,7 @@ import { EmptyContentComponent } from './empty-content/empty-content.component'; imports: [ CommonModule, MaterialModule, - TranslateModule + TranslateModule.forChild() ], declarations: [ ErrorContentComponent, diff --git a/lib/core/userinfo/userinfo.module.ts b/lib/core/userinfo/userinfo.module.ts index 5d7262b1e2..4a1b6f2cac 100644 --- a/lib/core/userinfo/userinfo.module.ts +++ b/lib/core/userinfo/userinfo.module.ts @@ -22,23 +22,17 @@ import { TranslateModule } from '@ngx-translate/core'; import { MaterialModule } from '../material.module'; import { PipeModule } from '../pipes/pipe.module'; import { UserInfoComponent } from './components/user-info.component'; -import { BpmUserService } from './services/bpm-user.service'; -import { EcmUserService } from './services/ecm-user.service'; @NgModule({ imports: [ CommonModule, MaterialModule, - TranslateModule, + TranslateModule.forChild(), PipeModule ], declarations: [ UserInfoComponent ], - providers: [ - EcmUserService, - BpmUserService - ], exports: [ UserInfoComponent ] diff --git a/lib/core/viewer/viewer.module.ts b/lib/core/viewer/viewer.module.ts index 3832bf45b0..fa877f18d4 100644 --- a/lib/core/viewer/viewer.module.ts +++ b/lib/core/viewer/viewer.module.ts @@ -44,7 +44,7 @@ import { ViewerToolbarActionsComponent } from './components/viewer-toolbar-actio imports: [ CommonModule, MaterialModule, - TranslateModule, + TranslateModule.forChild(), FormsModule, ReactiveFormsModule, ToolbarModule, diff --git a/lib/insights/analytics-process/analytics-process.module.ts b/lib/insights/analytics-process/analytics-process.module.ts index c1070452ba..fd3cd9bff2 100644 --- a/lib/insights/analytics-process/analytics-process.module.ts +++ b/lib/insights/analytics-process/analytics-process.module.ts @@ -18,13 +18,12 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { TranslateModule } from '@ngx-translate/core'; import { DiagramsModule } from '../diagram/diagram.module'; import { MaterialModule } from '../material.module'; import { ChartsModule } from 'ng2-charts'; -import { ToolbarModule, ButtonsMenuModule } from '@alfresco/adf-core'; +import { CoreModule } from '@alfresco/adf-core'; import { AnalyticsGeneratorComponent } from './components/analytics-generator.component'; import { AnalyticsReportHeatMapComponent } from './components/analytics-report-heat-map.component'; import { AnalyticsReportListComponent } from './components/analytics-report-list.component'; @@ -37,7 +36,6 @@ import { DropdownWidgetAanalyticsComponent } from './components/widgets/dropdown import { DurationWidgetComponent } from './components/widgets/duration/duration.widget'; import { NumberWidgetAanlyticsComponent } from './components/widgets/number/number.widget'; -import { AnalyticsService } from './services/analytics.service'; import { FlexLayoutModule } from '@angular/flex-layout'; @NgModule({ @@ -48,10 +46,8 @@ import { FlexLayoutModule } from '@angular/flex-layout'; ChartsModule, DiagramsModule, MaterialModule, - TranslateModule, - ToolbarModule, FlexLayoutModule, - ButtonsMenuModule + CoreModule.forChild() ], declarations: [ AnalyticsComponent, @@ -65,9 +61,6 @@ import { FlexLayoutModule } from '@angular/flex-layout'; CheckboxWidgetAanalyticsComponent, DateRangeWidgetComponent ], - providers: [ - AnalyticsService - ], exports: [ AnalyticsComponent, AnalyticsReportListComponent, diff --git a/lib/insights/diagram/diagram.module.ts b/lib/insights/diagram/diagram.module.ts index e34b1be646..542654ed47 100644 --- a/lib/insights/diagram/diagram.module.ts +++ b/lib/insights/diagram/diagram.module.ts @@ -17,7 +17,6 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { TranslateModule } from '@ngx-translate/core'; import { DiagramEndEventComponent } from './components/events/diagram-end-event.component'; import { DiagramEventComponent } from './components/events/diagram-event.component'; @@ -83,11 +82,6 @@ import { DiagramLanesComponent } from './components/swimlanes/diagram-lanes.comp import { DiagramTooltipComponent } from './components/tooltip/diagram-tooltip.component'; -import { DiagramColorService } from './services/diagram-color.service'; -import { DiagramsService } from './services/diagrams.service'; - -import { RaphaelService } from './components/raphael/raphael.service'; - import { RaphaelCircleDirective } from './components/raphael/raphael-circle.component'; import { RaphaelCrossDirective } from './components/raphael/raphael-cross.component'; import { RaphaelFlowArrowDirective } from './components/raphael/raphael-flow-arrow.component'; @@ -115,11 +109,12 @@ import { RaphaelIconServiceDirective } from './components/raphael/icons/raphael- import { RaphaelIconSignalDirective } from './components/raphael/icons/raphael-icon-signal.component'; import { RaphaelIconTimerDirective } from './components/raphael/icons/raphael-icon-timer.component'; import { RaphaelIconUserDirective } from './components/raphael/icons/raphael-icon-user.component'; +import { CoreModule } from '@alfresco/adf-core'; @NgModule({ imports: [ CommonModule, - TranslateModule + CoreModule.forChild() ], declarations: [ DiagramComponent, @@ -202,11 +197,6 @@ import { RaphaelIconUserDirective } from './components/raphael/icons/raphael-ico RaphaelIconSignalDirective, RaphaelIconMessageDirective ], - providers: [ - DiagramsService, - DiagramColorService, - RaphaelService - ], exports: [ DiagramComponent, DiagramEventComponent, diff --git a/lib/insights/insights.module.ts b/lib/insights/insights.module.ts index 41db783dd1..43fd686823 100644 --- a/lib/insights/insights.module.ts +++ b/lib/insights/insights.module.ts @@ -16,7 +16,7 @@ */ import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; +import { NgModule, ModuleWithProviders } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { CoreModule, TRANSLATION_PROVIDER } from '@alfresco/adf-core'; @@ -24,10 +24,23 @@ import { DiagramsModule } from './diagram/diagram.module'; import { AnalyticsProcessModule } from './analytics-process/analytics-process.module'; import { MaterialModule } from './material.module'; +import { DiagramsService } from './diagram/services/diagrams.service'; +import { DiagramColorService } from './diagram/services/diagram-color.service'; +import { RaphaelService } from './diagram/components/raphael/raphael.service'; +import { AnalyticsService } from './analytics-process/services/analytics.service'; + +export function providers() { + return [ + AnalyticsService, + DiagramsService, + DiagramColorService, + RaphaelService + ]; +} @NgModule({ imports: [ - CoreModule, + CoreModule.forChild(), CommonModule, FormsModule, ReactiveFormsModule, @@ -36,6 +49,7 @@ import { MaterialModule } from './material.module'; AnalyticsProcessModule ], providers: [ + ...providers(), { provide: TRANSLATION_PROVIDER, multi: true, @@ -46,7 +60,6 @@ import { MaterialModule } from './material.module'; } ], exports: [ - CoreModule, CommonModule, FormsModule, ReactiveFormsModule, @@ -56,4 +69,47 @@ import { MaterialModule } from './material.module'; ] }) export class InsightsModule { + static forRoot(): ModuleWithProviders { + return { + ngModule: InsightsModule, + providers: [ + ...providers(), + { + provide: TRANSLATION_PROVIDER, + multi: true, + useValue: { + name: 'adf-insights', + source: 'assets/adf-insights' + } + } + ] + }; + } + + static forChild(): ModuleWithProviders { + return { + ngModule: InsightsModuleLazy + }; + } } + +@NgModule({ + imports: [ + CoreModule.forChild(), + CommonModule, + FormsModule, + ReactiveFormsModule, + MaterialModule, + DiagramsModule, + AnalyticsProcessModule + ], + exports: [ + CommonModule, + FormsModule, + ReactiveFormsModule, + MaterialModule, + DiagramsModule, + AnalyticsProcessModule + ] +}) +export class InsightsModuleLazy {} diff --git a/lib/insights/testing/insights.testing.module.ts b/lib/insights/testing/insights.testing.module.ts index c276bebd08..1e43bef9c9 100644 --- a/lib/insights/testing/insights.testing.module.ts +++ b/lib/insights/testing/insights.testing.module.ts @@ -24,11 +24,16 @@ import { AppConfigService, AppConfigServiceMock, TranslationService, - TranslationMock + TranslationMock, + CoreModule } from '@alfresco/adf-core'; @NgModule({ - imports: [NoopAnimationsModule, InsightsModule], + imports: [ + NoopAnimationsModule, + CoreModule.forRoot(), + InsightsModule.forRoot() + ], providers: [ { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }, { provide: AppConfigService, useClass: AppConfigServiceMock }, diff --git a/lib/process-services/app-list/apps-list.module.ts b/lib/process-services/app-list/apps-list.module.ts index 304455c87c..f7e38b9b52 100644 --- a/lib/process-services/app-list/apps-list.module.ts +++ b/lib/process-services/app-list/apps-list.module.ts @@ -19,7 +19,6 @@ import { CommonModule } from '@angular/common'; import { FlexLayoutModule } from '@angular/flex-layout'; import { NgModule } from '@angular/core'; import { MaterialModule } from '../material.module'; -import { TranslateModule } from '@ngx-translate/core'; import { CoreModule } from '@alfresco/adf-core'; import { AppsListComponent } from './apps-list.component'; @@ -30,8 +29,7 @@ import { SelectAppsDialogComponent } from './select-apps-dialog-component'; CommonModule, MaterialModule, FlexLayoutModule, - TranslateModule, - CoreModule + CoreModule.forChild() ], declarations: [ AppsListComponent, diff --git a/lib/process-services/attachment/attachment.module.ts b/lib/process-services/attachment/attachment.module.ts index 89f140640e..1fe6c5ddd0 100644 --- a/lib/process-services/attachment/attachment.module.ts +++ b/lib/process-services/attachment/attachment.module.ts @@ -26,7 +26,7 @@ import { CoreModule } from '@alfresco/adf-core'; @NgModule({ imports: [ - CoreModule, + CoreModule.forChild(), MaterialModule ], declarations: [ diff --git a/lib/process-services/content-widget/attach-file-widget.components.spec.ts b/lib/process-services/content-widget/attach-file-widget.components.spec.ts index 834aef2f75..748c93708a 100644 --- a/lib/process-services/content-widget/attach-file-widget.components.spec.ts +++ b/lib/process-services/content-widget/attach-file-widget.components.spec.ts @@ -29,7 +29,7 @@ import { ContentService, setupTestBed } from '@alfresco/adf-core'; -import { ContentNodeDialogService, ContentNodeSelectorModule } from '@alfresco/adf-content-services'; +import { ContentNodeDialogService, ContentModule } from '@alfresco/adf-content-services'; import { of } from 'rxjs'; import { MinimalNodeEntryEntity } from 'alfresco-js-api'; import { ProcessTestingModule } from '../testing/process.testing.module'; @@ -104,7 +104,10 @@ describe('AttachFileWidgetComponent', () => { let formService: FormService; setupTestBed({ - imports: [ProcessTestingModule, ContentNodeSelectorModule] + imports: [ + ProcessTestingModule, + ContentModule.forRoot() + ] }); beforeEach(async(() => { diff --git a/lib/process-services/content-widget/content-widget.module.ts b/lib/process-services/content-widget/content-widget.module.ts index 39587d501f..41814ab812 100644 --- a/lib/process-services/content-widget/content-widget.module.ts +++ b/lib/process-services/content-widget/content-widget.module.ts @@ -24,7 +24,7 @@ import { AttachFolderWidgetComponent } from './attach-folder-widget.component'; @NgModule({ imports: [ - CoreModule, + CoreModule.forChild(), MaterialModule ], entryComponents: [ diff --git a/lib/process-services/people/people.module.ts b/lib/process-services/people/people.module.ts index 744a31b789..4347058513 100644 --- a/lib/process-services/people/people.module.ts +++ b/lib/process-services/people/people.module.ts @@ -17,11 +17,10 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { TranslateModule } from '@ngx-translate/core'; import { MaterialModule } from '../material.module'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { DataColumnModule, DataTableModule } from '@alfresco/adf-core'; +import { CoreModule } from '@alfresco/adf-core'; import { PeopleComponent } from './components/people/people.component'; import { PeopleListComponent } from './components/people-list/people-list.component'; import { PeopleSearchComponent } from './components/people-search/people-search.component'; @@ -35,11 +34,9 @@ import { PeopleSearchTitleDirective } from './directives/people-search-title.dir imports: [ FormsModule, ReactiveFormsModule, - DataColumnModule, - DataTableModule, MaterialModule, CommonModule, - TranslateModule + CoreModule.forChild() ], declarations: [ PeopleComponent, diff --git a/lib/process-services/process-comments/process-comments.module.ts b/lib/process-services/process-comments/process-comments.module.ts index cfdec735f8..c26ca698df 100644 --- a/lib/process-services/process-comments/process-comments.module.ts +++ b/lib/process-services/process-comments/process-comments.module.ts @@ -17,23 +17,19 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { TranslateModule } from '@ngx-translate/core'; import { MaterialModule } from '../material.module'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { DataColumnModule, DataTableModule, CommentsModule } from '@alfresco/adf-core'; +import { CoreModule } from '@alfresco/adf-core'; import { ProcessCommentsComponent } from './process-comments.component'; @NgModule({ imports: [ - DataColumnModule, - DataTableModule, FormsModule, ReactiveFormsModule, MaterialModule, CommonModule, - TranslateModule, - CommentsModule + CoreModule.forChild() ], declarations: [ ProcessCommentsComponent diff --git a/lib/process-services/process-list/process-list.module.ts b/lib/process-services/process-list/process-list.module.ts index 3d29c43a4d..101e784270 100644 --- a/lib/process-services/process-list/process-list.module.ts +++ b/lib/process-services/process-list/process-list.module.ts @@ -19,11 +19,9 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FlexLayoutModule } from '@angular/flex-layout'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { TranslateModule } from '@ngx-translate/core'; import { CoreModule } from '@alfresco/adf-core'; import { MaterialModule } from '../material.module'; import { ProcessCommentsModule } from '../process-comments/process-comments.module'; -import { CardViewModule, DataColumnModule, DataTableModule, DirectiveModule, PipeModule } from '@alfresco/adf-core'; import { TaskListModule } from '../task-list/task-list.module'; import { PeopleModule } from '../people/people.module'; import { ContentWidgetModule } from '../content-widget/content-widget.module'; @@ -39,18 +37,12 @@ import { StartProcessInstanceComponent } from './components/start-process.compon @NgModule({ imports: [ CommonModule, - DataTableModule, - CoreModule, - TaskListModule, MaterialModule, FlexLayoutModule, - TranslateModule, - CardViewModule, FormsModule, ReactiveFormsModule, - PipeModule, - DataColumnModule, - DirectiveModule, + CoreModule.forChild(), + TaskListModule, PeopleModule, ContentWidgetModule, ProcessCommentsModule diff --git a/lib/process-services/process.module.ts b/lib/process-services/process.module.ts index 1aa8d83582..84b0589470 100644 --- a/lib/process-services/process.module.ts +++ b/lib/process-services/process.module.ts @@ -16,9 +16,9 @@ */ import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; +import { NgModule, ModuleWithProviders } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { CoreModule, TRANSLATION_PROVIDER, CommentsModule } from '@alfresco/adf-core'; +import { CoreModule, TRANSLATION_PROVIDER } from '@alfresco/adf-core'; import { MaterialModule } from './material.module'; @@ -30,12 +30,26 @@ import { AttachmentModule } from './attachment/attachment.module'; import { PeopleModule } from './people/people.module'; import { ProcessService } from './process-list/services/process.service'; import { ProcessFilterService } from './process-list/services/process-filter.service'; +import { TaskListService } from './task-list/services/tasklist.service'; +import { TaskFilterService } from './task-list/services/task-filter.service'; +import { TaskUploadService } from './task-list/services/task-upload.service'; +import { ProcessUploadService } from './task-list/services/process-upload.service'; + +export function providers() { + return [ + ProcessService, + ProcessFilterService, + TaskListService, + TaskFilterService, + TaskUploadService, + ProcessUploadService + ]; +} @NgModule({ imports: [ - CoreModule, + CoreModule.forChild(), CommonModule, - CommentsModule, ProcessCommentsModule, FormsModule, ReactiveFormsModule, @@ -47,6 +61,7 @@ import { ProcessFilterService } from './process-list/services/process-filter.ser PeopleModule ], providers: [ + ...providers(), { provide: TRANSLATION_PROVIDER, multi: true, @@ -54,13 +69,10 @@ import { ProcessFilterService } from './process-list/services/process-filter.ser name: 'adf-process-services', source: 'assets/adf-process-services' } - }, - ProcessService, - ProcessFilterService + } ], exports: [ CommonModule, - CommentsModule, ProcessCommentsModule, FormsModule, ReactiveFormsModule, @@ -72,4 +84,54 @@ import { ProcessFilterService } from './process-list/services/process-filter.ser ] }) export class ProcessModule { + static forRoot(): ModuleWithProviders { + return { + ngModule: ProcessModule, + providers: [ + ...providers(), + { + provide: TRANSLATION_PROVIDER, + multi: true, + useValue: { + name: 'adf-process-services', + source: 'assets/adf-process-services' + } + } + ] + }; + } + + static forChild(): ModuleWithProviders { + return { + ngModule: ProcessModuleLazy + }; + } } + +@NgModule({ + imports: [ + CoreModule.forChild(), + CommonModule, + ProcessCommentsModule, + FormsModule, + ReactiveFormsModule, + MaterialModule, + ProcessListModule, + TaskListModule, + AppsListModule, + AttachmentModule, + PeopleModule + ], + exports: [ + CommonModule, + ProcessCommentsModule, + FormsModule, + ReactiveFormsModule, + ProcessListModule, + TaskListModule, + AppsListModule, + AttachmentModule, + PeopleModule + ] +}) +export class ProcessModuleLazy {} diff --git a/lib/process-services/task-list/task-list.module.ts b/lib/process-services/task-list/task-list.module.ts index 2fea44c18d..bf2f3a5e76 100644 --- a/lib/process-services/task-list/task-list.module.ts +++ b/lib/process-services/task-list/task-list.module.ts @@ -18,7 +18,6 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FlexLayoutModule } from '@angular/flex-layout'; -import { TranslateModule } from '@ngx-translate/core'; import { CoreModule } from '@alfresco/adf-core'; import { ProcessCommentsModule } from '../process-comments/process-comments.module'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; @@ -26,10 +25,6 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { MaterialModule } from '../material.module'; import { PeopleModule } from '../people/people.module'; import { ContentWidgetModule } from '../content-widget/content-widget.module'; -import { TaskUploadService } from './services/task-upload.service'; -import { ProcessUploadService } from './services/process-upload.service'; -import { TaskListService } from './services/tasklist.service'; -import { TaskFilterService } from './services/task-filter.service'; import { ChecklistComponent } from './components/checklist.component'; import { NoTaskDetailsTemplateDirective } from './components/no-task-detail-template.directive'; @@ -44,13 +39,12 @@ import { AttachFormComponent } from './components/attach-form.component'; @NgModule({ imports: [ - CoreModule, CommonModule, FlexLayoutModule, MaterialModule, - TranslateModule, FormsModule, ReactiveFormsModule, + CoreModule.forChild(), PeopleModule, ProcessCommentsModule, ContentWidgetModule @@ -67,12 +61,6 @@ import { AttachFormComponent } from './components/attach-form.component'; TaskStandaloneComponent, AttachFormComponent ], - providers: [ - TaskListService, - TaskFilterService, - TaskUploadService, - ProcessUploadService - ], exports: [ NoTaskDetailsTemplateDirective, TaskFiltersComponent, diff --git a/lib/process-services/testing/process.testing.module.ts b/lib/process-services/testing/process.testing.module.ts index 1cb4b7d369..c4b43f2883 100644 --- a/lib/process-services/testing/process.testing.module.ts +++ b/lib/process-services/testing/process.testing.module.ts @@ -24,11 +24,16 @@ import { AppConfigService, AppConfigServiceMock, TranslationService, - TranslationMock + TranslationMock, + CoreModule } from '@alfresco/adf-core'; @NgModule({ - imports: [NoopAnimationsModule, ProcessModule], + imports: [ + NoopAnimationsModule, + CoreModule.forRoot(), + ProcessModule + ], providers: [ { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }, { provide: AppConfigService, useClass: AppConfigServiceMock }, diff --git a/package.json b/package.json index 2dcc70d583..ebaf1fcdc6 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,7 @@ "moment-es6": "^1.0.0", "ng2-charts": "1.6.0", "ngx-monaco-editor": "^5.0.0", - "pdfjs-dist": "2.0.265", + "pdfjs-dist": "2.0.303", "raphael": "2.2.7", "reflect-metadata": "0.1.10", "rxjs": "^6.0.0",