mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-2064] Lazy loading support (#2811)
* remove BrowserAnimationsModule dependency * improve test shim * update test shim * test shim updates * example of lazy-loaded datatable * local and global i18n demo for lazy modules * lazy loading support for CoreModule providers * test shim updates * update test shim * support global i18n for lazy modules * cleanup lazy loading example * update card view after rebase * backwards compatibility * cleanup files * fix code after rebase
This commit is contained in:
committed by
Eugenio Romano
parent
49456b3fcd
commit
0d93c65fd7
5
demo-shell/src/app/components/lazy-loading/i18n/en.json
Normal file
5
demo-shell/src/app/components/lazy-loading/i18n/en.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"LAZY": {
|
||||
"TEXT": "Text from lazy component resources"
|
||||
}
|
||||
}
|
@@ -0,0 +1,54 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { ObjectDataTableAdapter, AuthenticationService } from '@alfresco/adf-core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-lazy-component',
|
||||
template: `
|
||||
<adf-datatable [data]="data"></adf-datatable>
|
||||
|
||||
<ul>
|
||||
<li>Global i18n: {{ 'APP_LAYOUT.DATATABLE_LAZY' | translate }}</li>
|
||||
<li>Local i18n (work in progress): {{ 'LAZY.TEXT' | translate }}</li>
|
||||
<li>isLoggedIn: {{ isLoggedIn }}</li>
|
||||
<li>ECM username: {{ username }}
|
||||
</ul>
|
||||
`
|
||||
})
|
||||
export class LazyLoadingComponent {
|
||||
|
||||
data: ObjectDataTableAdapter;
|
||||
|
||||
get isLoggedIn(): boolean {
|
||||
return this.auth.isLoggedIn();
|
||||
}
|
||||
|
||||
get username(): string {
|
||||
return this.auth.getEcmUsername();
|
||||
}
|
||||
|
||||
constructor(private auth: AuthenticationService) {
|
||||
this.data = new ObjectDataTableAdapter(
|
||||
// data
|
||||
[
|
||||
{id: 1, name: 'Name 1'},
|
||||
{id: 2, name: 'Name 2'}
|
||||
],
|
||||
// schema
|
||||
[
|
||||
{
|
||||
type: 'text',
|
||||
key: 'id',
|
||||
title: 'Id',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
key: 'name',
|
||||
title: 'Name',
|
||||
cssClass: 'full-width',
|
||||
sortable: true
|
||||
}
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CoreModule, TranslationService } from '@alfresco/adf-core';
|
||||
|
||||
import { LazyLoadingRoutes } from './lazy-loading.routes';
|
||||
import { LazyLoadingComponent } from './lazy-loading.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CoreModule.forChild(),
|
||||
LazyLoadingRoutes
|
||||
],
|
||||
declarations: [
|
||||
LazyLoadingComponent
|
||||
]
|
||||
})
|
||||
export class LazyLoadingModule {
|
||||
constructor(translation: TranslationService) {
|
||||
}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { LazyLoadingComponent } from './lazy-loading.component';
|
||||
|
||||
export const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: LazyLoadingComponent
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild(routes)
|
||||
],
|
||||
exports: [
|
||||
RouterModule
|
||||
]
|
||||
})
|
||||
export class LazyLoadingRoutes {
|
||||
}
|
Reference in New Issue
Block a user