@wavemaker/angular-codegen 11.0.0-next.71007 → 11.0.0-next.71016

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,15 +18,15 @@
18
18
  },
19
19
  "private": true,
20
20
  "dependencies": {
21
- "@angular/animations": "10.2.5",
22
- "@angular/common": "10.2.5",
23
- "@angular/compiler": "10.2.5",
24
- "@angular/core": "10.2.5",
25
- "@angular/forms": "10.2.5",
26
- "@angular/platform-browser": "10.2.5",
27
- "@angular/platform-browser-dynamic": "10.2.5",
28
- "@angular/router": "10.2.5",
29
- "@angular/service-worker": "10.2.5",
21
+ "@angular/animations": "11.2.14",
22
+ "@angular/common": "11.2.14",
23
+ "@angular/compiler": "11.2.14",
24
+ "@angular/core": "11.2.14",
25
+ "@angular/forms": "11.2.14",
26
+ "@angular/platform-browser": "11.2.14",
27
+ "@angular/platform-browser-dynamic": "11.2.14",
28
+ "@angular/router": "11.2.14",
29
+ "@angular/service-worker": "11.2.14",
30
30
  "@babel/runtime": "^7.14.8",
31
31
  "@ionic-native/app-version": "4.10.0",
32
32
  "@ionic-native/barcode-scanner": "4.10.0",
@@ -68,16 +68,15 @@
68
68
  "tslib": "^2.0.0",
69
69
  "x2js": "3.2.6",
70
70
  "zone.js": "~0.10.3",
71
- "@wavemaker/app-ng-runtime": "11.0.0-next.71007"
71
+ "@wavemaker/app-ng-runtime": "11.0.0-next.71016"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@ampproject/rollup-plugin-closure-compiler": "0.8.5",
75
- "@angular-builders/custom-webpack": "9.2.0",
76
- "@angular-devkit/build-angular": "0.1002.3",
77
- "@angular-devkit/build-ng-packagr": "0.1002.3",
78
- "@angular/cli": "10.2.3",
79
- "@angular/compiler-cli": "10.2.5",
80
- "@angular/language-service": "10.2.5",
75
+ "@angular-builders/custom-webpack": "11.1.1",
76
+ "@angular-devkit/build-angular": "0.1102.15",
77
+ "@angular/cli": "11.2.15",
78
+ "@angular/compiler-cli": "11.2.14",
79
+ "@angular/language-service": "11.2.14",
81
80
  "@babel/plugin-transform-runtime": "^7.14.5",
82
81
  "@compodoc/compodoc": "1.1.11",
83
82
  "@types/jasmine": "2.8.8",
@@ -103,7 +102,7 @@
103
102
  "karma-jasmine-html-reporter": "^1.5.0",
104
103
  "karma-mocha-reporter": "2.2.5",
105
104
  "moment": "2.24.0",
106
- "ng-packagr": "^10.1.2",
105
+ "ng-packagr": "11.2.4",
107
106
  "npm-run-all": "4.1.5",
108
107
  "rimraf": "2.6.3",
109
108
  "rollup": "0.65.2",
@@ -114,7 +113,7 @@
114
113
  "rollup-plugin-node-resolve": "3.4.0",
115
114
  "ts-node": "7.0.1",
116
115
  "tslint": "~6.1.0",
117
- "typescript": "3.9.10",
116
+ "typescript": "4.1.6",
118
117
  "util": "0.11.1"
119
118
  }
120
119
  }
@@ -1,55 +1,55 @@
1
1
  import {
2
2
  Injectable,
3
- NgModuleFactoryLoader,
4
3
  NgModuleRef,
5
4
  Type,
6
5
  Injector,
7
- SystemJsNgModuleLoader,
8
- Inject,
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
- constructor(
23
- @Inject(NgModuleFactoryLoader) private loader: SystemJsNgModuleLoader,
24
- private injector: Injector
25
- ) {
23
+
24
+ constructor(private injector: Injector, private compiler: Compiler) {
26
25
  super();
27
26
  }
28
- private getModulePath(componentName: string, componentType: ComponentType, options?: any): string {
29
- if (componentName.length > 0) {
30
- if (componentType === ComponentType.PARTIAL && options && options.prefab) {
31
- return `src/app/prefabs/${options.prefab}/partials/${componentName}/${componentName}.module#${componentName
32
- .charAt(0)
33
- .toUpperCase()}${componentName.slice(1)}Module`;
34
- }
35
- if (componentType === ComponentType.PARTIAL) {
36
- return `src/app/partials/${componentName}/${componentName}.module#${componentName
37
- .charAt(0)
38
- .toUpperCase()}${componentName.slice(1)}Module`;
39
- } else if (componentType === ComponentType.PREFAB) {
40
- return `src/app/prefabs/${componentName}/${componentName}.module#${componentName
41
- .charAt(0)
42
- .toUpperCase()}${componentName.slice(1)}Module`;
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
- public async getComponentFactoryRef(componentName: string, componentType: ComponentType, options?: {}) {
48
- let moduleFactory: NgModuleFactory<any>;
47
+
48
+ public async getComponentFactoryRef(componentName: string, componentType: ComponentType, options?: Options) {
49
49
  try {
50
- moduleFactory = await this.loader.load(
51
- this.getModulePath(componentName, componentType, options)
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;
@@ -0,0 +1,4 @@
1
+ // These three objects will be initialized in the code generation phase.
2
+ export const prefabLazyModules = {};
3
+ export const partialLazyModules = {};
4
+ export const prefabPartialLazyModules = {};
@@ -15,7 +15,7 @@ if (environment.production) {
15
15
  }
16
16
 
17
17
  document.addEventListener('DOMContentLoaded', () => {
18
- new Promise( resolve => {
18
+ new Promise<Event | void>( resolve => {
19
19
  if (isSpotcues) {
20
20
  initSpotCues().then(resolve);
21
21
  } else if (window['cordova']) {
@@ -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
  ],