@wavemaker/angular-codegen 11.10.5-rc.6100 → 11.11.0-next.27920

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/angular-app/angular.json +4 -9
  2. package/angular-app/build-scripts/post-build.js +7 -47
  3. package/angular-app/dependency-report.html +1 -1
  4. package/angular-app/npm-shrinkwrap.json +111 -239
  5. package/angular-app/package-lock.json +111 -239
  6. package/angular-app/package.json +11 -21
  7. package/angular-app/src/app/bootstrap-wrapper.component.ts +10 -0
  8. package/angular-app/src/app/lazy-load-scripts.resolve.ts +2 -9
  9. package/angular-app/src/index.html +1 -0
  10. package/angular-app/src/main.ts +28 -32
  11. package/angular-app/tsconfig.json +0 -30
  12. package/angular-app/tsconfig.web-app.json +0 -21
  13. package/angular-app/wm-custom-webpack.config.js +18 -0
  14. package/dependencies/app.component.html +34 -26
  15. package/dependencies/pipe-provider.cjs.js +23477 -186
  16. package/dependencies/transpilation-web.cjs.js +12587 -816
  17. package/npm-shrinkwrap.json +85 -233
  18. package/package-lock.json +85 -233
  19. package/package.json +2 -2
  20. package/src/codegen.js +1 -1
  21. package/src/gen-app-codegen-module.js +1 -1
  22. package/src/gen-app-routes.js +1 -1
  23. package/src/gen-components.js +1 -1
  24. package/src/gen-index-html.js +1 -1
  25. package/src/gen-layouts.js +1 -1
  26. package/src/handlebar-helpers.js +1 -1
  27. package/src/pages-util.js +1 -1
  28. package/src/project-meta.js +1 -1
  29. package/src/update-angular-json.js +1 -1
  30. package/src/wm-utils.js +1 -1
  31. package/templates/app-routes.ts.hbs +2 -2
  32. package/templates/app.config.ts.hbs +128 -0
  33. package/templates/app.module.ts.hbs +0 -2
  34. package/templates/layout/layout.component.ts.hbs +26 -4
  35. package/templates/page/page.component.ts.hbs +36 -5
  36. package/dependencies/transpilation-mobile.cjs.js +0 -93554
@@ -1,20 +1,20 @@
1
- import { ApplicationRef, enableProdMode, NgModuleRef } from '@angular/core';
2
- import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3
-
4
- import { AppModule } from './app/app.module';
1
+ import { ApplicationRef, enableProdMode } from '@angular/core';
2
+ import { bootstrapApplication } from '@angular/platform-browser';
5
3
  import { environment } from './environments/environment';
6
-
7
4
  import initWmProjectProperties from './app/wm-project-properties';
8
5
  import { WMAppProperties } from './app/wmProperties';
9
6
  import * as fontConfig from './font.config';
10
-
11
-
12
- let formatAcceptHeader = (languages: any) => {
13
- let result: string[] = [];
14
- let addedLanguages = new Set<string>(); // To track already added languages
7
+ import { appConfig } from './app/app.config';
8
+ import { AppComponent } from '@wm/runtime/base';
9
+ import { BootstrapWrapperComponent } from './app/bootstrap-wrapper.component';
10
+
11
+ // Format Accept-Language header
12
+ const formatAcceptHeader = (languages: string[]): string => {
13
+ const result: string[] = [];
14
+ const addedLanguages = new Set<string>(); // To track already added languages
15
15
  let qValue = 1.0;
16
16
 
17
- languages.forEach((lang: any) => {
17
+ languages.forEach((lang: string) => {
18
18
  if (!addedLanguages.has(lang)) {
19
19
  // Add the full language (e.g., en-US or en) if not already added
20
20
  result.push(`${lang}${qValue === 1.0 ? '' : `;q=${qValue.toFixed(1)}`}`);
@@ -37,31 +37,27 @@ let formatAcceptHeader = (languages: any) => {
37
37
  });
38
38
 
39
39
  return result.join(',');
40
- }
41
- WMAppProperties['preferredLanguage'] = formatAcceptHeader(navigator.languages);
42
- WMAppProperties['fontConfig'] = fontConfig;
40
+ };
43
41
 
44
-
45
- (window as any)._WM_APP_PROPERTIES = WMAppProperties
42
+ // Initialize WMAppProperties
43
+ WMAppProperties['preferredLanguage'] = formatAcceptHeader((navigator as any).languages);
44
+ WMAppProperties['fontConfig'] = fontConfig;
45
+ (window as any)._WM_APP_PROPERTIES = WMAppProperties;
46
46
  initWmProjectProperties();
47
47
 
48
48
  if (environment.production) {
49
- enableProdMode();
49
+ enableProdMode();
50
50
  }
51
51
 
52
52
  document.addEventListener('DOMContentLoaded', () => {
53
- new Promise<Event | void>( resolve => {
54
- if (window['cordova']) {
55
- document.addEventListener('deviceready', resolve);
56
- } else {
57
- resolve();
58
- }
59
- }).then(() => platformBrowserDynamic().bootstrapModule(AppModule))
60
- .then((appModuleRef: NgModuleRef<AppModule>) => {
61
- const applicationRef = appModuleRef.injector.get(ApplicationRef);
62
- window.addEventListener('unload', () => {
63
- applicationRef.components.map(c => c && c.destroy());
64
- });
65
- //console.timeEnd('bootstrap'), err => console.log(err);
66
- }, err => console.log(err));
67
- });
53
+ new Promise<Event | void>(resolve => {
54
+ resolve();
55
+ }).then(() => bootstrapApplication(AppComponent, appConfig))
56
+ .then((appRef: ApplicationRef) => {
57
+ appRef.bootstrap(BootstrapWrapperComponent);
58
+ window.addEventListener('unload', () => {
59
+ appRef.components.map(c => c?.destroy());
60
+ });
61
+ })
62
+ .catch(err => console.error('Error bootstrapping app:', err));
63
+ });
@@ -32,9 +32,6 @@
32
32
  "@wm/build-task": [
33
33
  "node_modules/@wavemaker/app-ng-runtime/build-task/"
34
34
  ],
35
- "@wm/mobile-build-task": [
36
- "node_modules/@wavemaker/app-ng-runtime/mobile-build-task"
37
- ],
38
35
  "@wm/core": [
39
36
  "node_modules/@wavemaker/app-ng-runtime/core"
40
37
  ],
@@ -56,18 +53,9 @@
56
53
  "@wm/components/page": [
57
54
  "node_modules/@wavemaker/app-ng-runtime/components/page/default"
58
55
  ],
59
- "@wm/mobile/components/basic": [
60
- "node_modules/@wavemaker/app-ng-runtime/mobile/components/basic/default"
61
- ],
62
- "@wm/mobile/components/page": [
63
- "node_modules/@wavemaker/app-ng-runtime/mobile/components/page/default"
64
- ],
65
56
  "@wm/components/dialogs": [
66
57
  "node_modules/@wavemaker/app-ng-runtime/components/dialogs/default"
67
58
  ],
68
- "@wm/mobile/components/*": [
69
- "node_modules/@wavemaker/app-ng-runtime/mobile/components/*"
70
- ],
71
59
  "@wm/components/*": [
72
60
  "node_modules/@wavemaker/app-ng-runtime/components/*"
73
61
  ],
@@ -89,29 +77,11 @@
89
77
  "@wm/variables": [
90
78
  "node_modules/@wavemaker/app-ng-runtime/variables"
91
79
  ],
92
- "@wm/mobile/core": [
93
- "node_modules/@wavemaker/app-ng-runtime/mobile/core"
94
- ],
95
- "@wm/mobile/components": [
96
- "node_modules/@wavemaker/app-ng-runtime/mobile/components"
97
- ],
98
- "@wm/mobile/offline": [
99
- "node_modules/@wavemaker/app-ng-runtime/mobile/offline"
100
- ],
101
- "@wm/mobile/variables": [
102
- "node_modules/@wavemaker/app-ng-runtime/mobile/variables"
103
- ],
104
80
  "@wm/runtime/base": [
105
81
  "node_modules/@wavemaker/app-ng-runtime/runtime/base"
106
82
  ],
107
83
  "@wm/runtime/dynamic": [
108
84
  "node_modules/@wavemaker/app-ng-runtime/runtime/dynamic"
109
- ],
110
- "@wm/mobile/runtime": [
111
- "node_modules/@wavemaker/app-ng-runtime/mobile/runtime"
112
- ],
113
- "@wm/mobile/runtime/dynamic": [
114
- "node_modules/@wavemaker/app-ng-runtime/mobile/runtime-dynamic"
115
85
  ]
116
86
  },
117
87
  "useDefineForClassFields": false
@@ -31,9 +31,6 @@
31
31
  "@wm/build-task": [
32
32
  "node_modules/@wavemaker/app-ng-runtime/build-task/"
33
33
  ],
34
- "@wm/mobile-build-task": [
35
- "node_modules/@wavemaker/app-ng-runtime/mobile-build-task"
36
- ],
37
34
  "@wm/core": [
38
35
  "node_modules/@wavemaker/app-ng-runtime/core"
39
36
  ],
@@ -70,29 +67,11 @@
70
67
  "@wm/variables": [
71
68
  "node_modules/@wavemaker/app-ng-runtime/variables"
72
69
  ],
73
- "@wm/mobile/core": [
74
- "node_modules/@wavemaker/app-ng-runtime/mobile/core"
75
- ],
76
- "@wm/mobile/components": [
77
- "node_modules/@wavemaker/app-ng-runtime/mobile/components"
78
- ],
79
- "@wm/mobile/offline": [
80
- "node_modules/@wavemaker/app-ng-runtime/mobile/offline"
81
- ],
82
- "@wm/mobile/variables": [
83
- "node_modules/@wavemaker/app-ng-runtime/mobile/variables"
84
- ],
85
70
  "@wm/runtime/base": [
86
71
  "node_modules/@wavemaker/app-ng-runtime/runtime/base"
87
72
  ],
88
73
  "@wm/runtime/dynamic": [
89
74
  "node_modules/@wavemaker/app-ng-runtime/runtime/dynamic"
90
- ],
91
- "@wm/mobile/runtime": [
92
- "node_modules/@wavemaker/app-ng-runtime/mobile/placeholder/runtime"
93
- ],
94
- "@wm/mobile/runtime-dynamic": [
95
- "node_modules/@wavemaker/app-ng-runtime/mobile/placeholder/runtime/dynamic"
96
75
  ]
97
76
  }
98
77
  },
@@ -2,6 +2,18 @@ const CompressionPlugin = require(`compression-webpack-plugin`);
2
2
  const path = require(`path`);
3
3
  const {ConcatSource} = require("webpack-sources");
4
4
 
5
+ const MomentLocalesPlugin = require('moment-locales-webpack-plugin');
6
+
7
+ const wmPropertiesPath = path.join(__dirname, '/src/app/wmProperties.js');
8
+
9
+ const { WMAppProperties } = require(wmPropertiesPath);
10
+
11
+ const localesToKeep = Object.values(WMAppProperties.supportedLanguages)
12
+ .map(lang => lang.moment)
13
+ .filter(locale => locale !== null);
14
+
15
+ const includeMomentPlugin = WMAppProperties.languageBundleSources === "STATIC";
16
+
5
17
  class ModifyCssAssetUrlsPlugin {
6
18
  apply(compiler) {
7
19
  compiler.hooks.compilation.tap('ModifyCssAssetUrlsPlugin', compilation => {
@@ -78,6 +90,12 @@ module.exports = {
78
90
  filename: "[name].br[ext]",
79
91
  algorithm: "brotliCompress"
80
92
  }),
93
+ // On STATIC WMAppProperties.languageBundleSources, required moment locales are included in the bundle
94
+
95
+ /**
96
+ * MomentLocalesPlugin is used to include only the required moment locales in the bundle.
97
+ */
98
+ ...(includeMomentPlugin ? [ new MomentLocalesPlugin({ localesToKeep }) ] : [])
81
99
  ],
82
100
  optimization: {
83
101
  splitChunks: {
@@ -1,28 +1,36 @@
1
- <ng-container *ngIf="startApp">
2
- <router-outlet></router-outlet>
3
- <div wmContainer partialContainer content="Common" hidden class="ng-hide" *ngIf="isApplicationType"></div>
4
- <app-spinner name="globalspinner" classname="global-spinner" role="alert" aria-live="assertive" [attr.aria-label]="spinner.arialabel || 'Loading'" [show]="spinner.show" [spinnermessages]="spinner.messages"></app-spinner>
5
- <div wmDialog name="oAuthLoginDialog" title="Application is requesting you to sign in with"
6
- close.event="closeOAuthDialog()">
7
- <ng-template #dialogBody>
8
- <ul class="list-items">
9
- <li class="list-item" *ngFor="let provider of providersConfig">
10
- <button class="btn" (click)="provider.invoke()">{{provider.name}}</button>
11
- </li>
12
- </ul>
13
- </ng-template>
14
- </div>
15
- <div wmConfirmDialog name="_app-confirm-dialog" title.bind="title" message.bind="message" oktext.bind="oktext"
16
- canceltext.bind="canceltext" closable="false" iconclass.bind="iconclass"
17
- escape.event="onEscape()" ok.event="onOk()" cancel.event="onCancel()" close.event="onClose()" opened.event="onOpen()"></div>
18
- <div *ngIf="!isApplicationType" wmConfirmDialog name="PrefabConfirmDialog" title.bind="title" message.bind="text" oktext.bind="okButtonText"
19
- canceltext.bind="cancelButtonText" closable="false" iconclass.bind="iconclass"
20
- escape.event="onEscape()" ok.event="onOk()" cancel.event="onCancel()" close.event="onClose()" opened.event="onOpen()"></div>
21
- <div *ngIf="!isApplicationType" wmAlertDialog name="PrefabAlertDialog" title.bind="title" message.bind="text" oktext.bind="okButtonText"
22
- canceltext.bind="cancelButtonText" closable="false" iconclass.bind="iconclass"
23
- escape.event="onEscape()" ok.event="onOk()" cancel.event="onCancel()" close.event="onClose()" opened.event="onOpen()"></div>
24
- <div wmAppExt></div>
25
- <i id="wm-mobile-display"></i>
26
- </ng-container>
1
+ @if (startApp) {
2
+ <router-outlet></router-outlet>
3
+ @if (isApplicationType) {
4
+ <div wmContainer partialContainer content="Common" hidden class="ng-hide"></div>
5
+ }
6
+ <app-spinner name="globalspinner" classname="global-spinner" role="alert" aria-live="assertive" [attr.aria-label]="spinner.arialabel || 'Loading'" [show]="spinner.show" [spinnermessages]="spinner.messages"></app-spinner>
7
+ <div wmDialog name="oAuthLoginDialog" title="Application is requesting you to sign in with"
8
+ close.event="closeOAuthDialog()">
9
+ <ng-template #dialogBody>
10
+ <ul class="list-items">
11
+ @for (provider of providersConfig; track provider) {
12
+ <li class="list-item">
13
+ <button class="btn" (click)="provider.invoke()">{{provider.name}}</button>
14
+ </li>
15
+ }
16
+ </ul>
17
+ </ng-template>
18
+ </div>
19
+ <div wmConfirmDialog name="_app-confirm-dialog" title.bind="title" message.bind="message" oktext.bind="oktext"
20
+ canceltext.bind="canceltext" closable="false" iconclass.bind="iconclass"
21
+ escape.event="onEscape()" ok.event="onOk()" cancel.event="onCancel()" close.event="onClose()" opened.event="onOpen()"></div>
22
+ @if (!isApplicationType) {
23
+ <div wmConfirmDialog name="PrefabConfirmDialog" title.bind="title" message.bind="text" oktext.bind="okButtonText"
24
+ canceltext.bind="cancelButtonText" closable="false" iconclass.bind="iconclass"
25
+ escape.event="onEscape()" ok.event="onOk()" cancel.event="onCancel()" close.event="onClose()" opened.event="onOpen()"></div>
26
+ }
27
+ @if (!isApplicationType) {
28
+ <div wmAlertDialog name="PrefabAlertDialog" title.bind="title" message.bind="text" oktext.bind="okButtonText"
29
+ canceltext.bind="cancelButtonText" closable="false" iconclass.bind="iconclass"
30
+ escape.event="onEscape()" ok.event="onOk()" cancel.event="onCancel()" close.event="onClose()" opened.event="onOpen()"></div>
31
+ }
32
+ <div wmAppExt></div>
33
+ <i id="wm-mobile-display"></i>
34
+ }
27
35
  <!--Dummy container to create the component dynamically-->
28
36
  <ng-container #dynamicComponent></ng-container>