mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[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
This commit is contained in:
committed by
Eugenio Romano
parent
f3a513ca72
commit
f606149344
@@ -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 {
|
||||
}
|
@@ -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
|
||||
|
@@ -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,
|
||||
|
@@ -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',
|
||||
|
@@ -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 {}
|
51
demo-shell/src/app/components/file-view/file-view.module.ts
Normal file
51
demo-shell/src/app/components/file-view/file-view.module.ts
Normal file
@@ -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 {
|
||||
|
||||
}
|
@@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user