@wavemaker/angular-codegen 11.0.0-next.140021 → 11.0.0-next.140028
Sign up to get free protection for your applications and to get access to all the features.
- angular-codegen/angular-app/angular.json +111 -80
- angular-codegen/angular-app/package-lock.json +60768 -17477
- angular-codegen/angular-app/package.json +21 -20
- angular-codegen/angular-app/src/assets/styles/css/wm-style.css +1 -1
- angular-codegen/angular-app/src/framework/services/lazy-component-ref-provider.service.ts +31 -31
- angular-codegen/angular-app/src/framework/util/lazy-module-routes.ts +4 -0
- angular-codegen/angular-app/src/main.ts +1 -1
- angular-codegen/angular-app/tsconfig.json +9 -0
- angular-codegen/angular-app/tsconfig.web-app.json +9 -0
- angular-codegen/dependencies/transpilation-mobile.cjs.js +9293 -7416
- angular-codegen/dependencies/transpilation-web.cjs.js +9293 -7416
- angular-codegen/download-packages.js +1 -1
- angular-codegen/package-lock.json +6540 -1253
- angular-codegen/package.json +1 -1
- angular-codegen/src/codegen.js +1 -1
- angular-codegen/src/gen-lazy-module-routes.js +1 -0
- angular-codegen/src/handlebar-helpers.js +1 -1
- angular-codegen/src/update-angular-json.js +1 -1
- angular-codegen/templates/app.module.ts.hbs +2 -0
- angular-codegen/templates/lazy-module-routes.ts.hbs +3 -0
@@ -1,55 +1,55 @@
|
|
1
1
|
import {
|
2
2
|
Injectable,
|
3
|
-
NgModuleFactoryLoader,
|
4
3
|
NgModuleRef,
|
5
4
|
Type,
|
6
5
|
Injector,
|
7
|
-
|
8
|
-
|
9
|
-
NgModuleFactory
|
6
|
+
Compiler,
|
7
|
+
NgModuleFactory,
|
10
8
|
} from '@angular/core';
|
11
9
|
import { PartialRefProvider } from '@wm/core';
|
12
10
|
import { ComponentType } from '@wm/runtime/base';
|
13
|
-
|
11
|
+
import { partialLazyModules, prefabLazyModules, prefabPartialLazyModules } from '../util/lazy-module-routes';
|
14
12
|
|
15
13
|
type ModuleWithRoot = Type<any> & { rootComponent: Type<any> };
|
14
|
+
type Options = {
|
15
|
+
prefab: string
|
16
|
+
};
|
16
17
|
|
17
18
|
@Injectable({
|
18
19
|
providedIn: 'root'
|
19
20
|
})
|
20
21
|
export class LazyComponentRefProviderService extends PartialRefProvider {
|
21
22
|
private moduleRef: NgModuleRef<any>;
|
22
|
-
|
23
|
-
|
24
|
-
private injector: Injector
|
25
|
-
) {
|
23
|
+
|
24
|
+
constructor(private injector: Injector, private compiler: Compiler) {
|
26
25
|
super();
|
27
26
|
}
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
27
|
+
|
28
|
+
private getLazyModule(componentName: string, componentType: ComponentType, options?: Options) {
|
29
|
+
if (componentType === ComponentType.PARTIAL && options && options.prefab) {
|
30
|
+
return prefabPartialLazyModules[`${options.prefab}_${componentName}`];
|
31
|
+
}
|
32
|
+
if (componentType === ComponentType.PARTIAL) {
|
33
|
+
return partialLazyModules[componentName];
|
34
|
+
}
|
35
|
+
if (componentType === ComponentType.PREFAB) {
|
36
|
+
return prefabLazyModules[componentName];
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
private async getModuleFactory(moduleOrFactory: NgModuleFactory<any> | Type<any>): Promise<NgModuleFactory<any>> {
|
41
|
+
if (moduleOrFactory instanceof NgModuleFactory) {
|
42
|
+
return moduleOrFactory;
|
43
|
+
} else {
|
44
|
+
return this.compiler.compileModuleAsync(moduleOrFactory);
|
44
45
|
}
|
45
|
-
return null;
|
46
46
|
}
|
47
|
-
|
48
|
-
|
47
|
+
|
48
|
+
public async getComponentFactoryRef(componentName: string, componentType: ComponentType, options?: Options) {
|
49
49
|
try {
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
const moduleOrFactory = await this.getLazyModule(componentName, componentType, options).loadChildren();
|
51
|
+
const moduleFactory = await this.getModuleFactory(moduleOrFactory);
|
52
|
+
|
53
53
|
this.moduleRef = moduleFactory.create(this.injector);
|
54
54
|
const rootComponent = (moduleFactory.moduleType as ModuleWithRoot)
|
55
55
|
.rootComponent;
|
@@ -19,6 +19,15 @@
|
|
19
19
|
"dom"
|
20
20
|
],
|
21
21
|
"paths": {
|
22
|
+
"rxjs/observable/throw": [
|
23
|
+
"node_modules/rxjs-compat/_esm2015/observable/throw"
|
24
|
+
],
|
25
|
+
"rxjs/observable/*": [
|
26
|
+
"node_modules/rxjs-compat/_esm2015/observable/*"
|
27
|
+
],
|
28
|
+
"rxjs/Observable": [
|
29
|
+
"node_modules/rxjs-compat/_esm2015/Observable"
|
30
|
+
],
|
22
31
|
"@wm/build-task": [
|
23
32
|
"node_modules/@wavemaker/app-ng-runtime/build-task/"
|
24
33
|
],
|
@@ -19,6 +19,15 @@
|
|
19
19
|
"dom"
|
20
20
|
],
|
21
21
|
"paths": {
|
22
|
+
"rxjs/observable/throw": [
|
23
|
+
"node_modules/rxjs-compat/_esm2015/observable/throw"
|
24
|
+
],
|
25
|
+
"rxjs/observable/*": [
|
26
|
+
"node_modules/rxjs-compat/_esm2015/observable/*"
|
27
|
+
],
|
28
|
+
"rxjs/Observable": [
|
29
|
+
"node_modules/rxjs-compat/_esm2015/Observable"
|
30
|
+
],
|
22
31
|
"@wm/build-task": [
|
23
32
|
"node_modules/@wavemaker/app-ng-runtime/build-task/"
|
24
33
|
],
|