@wavemaker/angular-codegen 12.0.0-next.142016 → 12.0.0-next.28533

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 (208) hide show
  1. {angular-codegen → package}/angular-app/angular.json +92 -99
  2. {angular-codegen → package}/angular-app/build-scripts/build.js +1 -0
  3. package/angular-app/build-scripts/index-html-transform-ng-serve.ts +20 -0
  4. {angular-codegen → package}/angular-app/build-scripts/post-build.js +17 -111
  5. package/angular-app/dependency-report.html +124 -0
  6. package/angular-app/generate-dependency-report.js +240 -0
  7. package/angular-app/npm-shrinkwrap.json +24046 -0
  8. {angular-codegen → package}/angular-app/package-lock.json +14731 -14457
  9. package/angular-app/package.json +129 -0
  10. package/angular-app/proxy.conf.js +14 -0
  11. package/angular-app/src/app/lazy-load-scripts.resolve.ts +13 -0
  12. package/angular-app/src/assets/styles/css/font/summernote.eot +0 -0
  13. package/angular-app/src/assets/styles/css/font/summernote.ttf +0 -0
  14. package/angular-app/src/assets/styles/css/font/summernote.woff +0 -0
  15. package/angular-app/src/assets/styles/css/font/summernote.woff2 +0 -0
  16. package/angular-app/src/assets/styles/css/wm-style.css +1 -0
  17. {angular-codegen → package}/angular-app/src/framework/services/component-ref-provider.service.ts +4 -0
  18. package/angular-app/src/framework/services/customwidget-config-provider.service.ts +13 -0
  19. package/angular-app/src/framework/services/lazy-component-ref-provider.service.ts +56 -0
  20. package/angular-app/src/framework/util/page-util.ts +7 -0
  21. {angular-codegen → package}/angular-app/src/index.html +1 -1
  22. package/angular-app/src/main.ts +70 -0
  23. {angular-codegen → package}/angular-app/src/setup-jest.js +10 -10
  24. {angular-codegen → package}/angular-app/src/tsconfig.app.json +5 -2
  25. {angular-codegen → package}/angular-app/tsconfig.json +9 -36
  26. {angular-codegen → package}/angular-app/tsconfig.web-app.json +2 -23
  27. package/angular-app/wm-custom-webpack.config.js +51 -0
  28. package/build-angular-app.js +522 -0
  29. package/dependencies/app.component.html +40 -0
  30. package/dependencies/custom-widgets-bundle.cjs.js +421 -0
  31. {angular-codegen → package}/dependencies/expression-parser.cjs.js +20415 -40794
  32. {angular-codegen → package}/dependencies/pipe-provider.cjs.js +98263 -96194
  33. {angular-codegen → package}/dependencies/transpilation-web.cjs.js +47606 -45796
  34. package/download-packages.js +197 -0
  35. {angular-codegen → package}/generate-angular-app.js +3 -1
  36. package/npm-shrinkwrap.json +7959 -0
  37. package/package-lock.json +7959 -0
  38. {angular-codegen → package}/package.json +9 -3
  39. package/src/codegen-args-cli.js +1 -0
  40. package/src/codegen-cli.js +1 -0
  41. package/src/codegen.js +1 -0
  42. package/src/copy-utils.js +1 -0
  43. package/src/eslintrc_config.js +1 -0
  44. package/src/gen-app-codegen-module.js +1 -0
  45. package/src/gen-app-override-css.js +1 -0
  46. package/src/gen-app-routes.js +1 -0
  47. package/src/gen-app-skeleton.js +1 -0
  48. package/src/gen-components.js +1 -0
  49. package/src/gen-customwidget-config.js +1 -0
  50. package/src/gen-index-html.js +1 -0
  51. package/src/gen-layouts.js +1 -0
  52. package/src/gen-lazy-module-routes.js +1 -0
  53. package/src/handlebar-helpers.js +1 -0
  54. package/src/pages-util.js +1 -0
  55. package/src/project-meta.js +1 -0
  56. package/src/update-angular-json.js +1 -0
  57. package/src/wm-utils.js +1 -0
  58. package/templates/app-routes.ts.hbs +14 -0
  59. package/templates/app.config.ts.hbs +211 -0
  60. {angular-codegen → package}/templates/app.module.ts.hbs +5 -3
  61. package/templates/component.config.ts.hbs +1 -0
  62. package/templates/customwidget/customwidget-config.ts.hbs +6 -0
  63. package/templates/customwidget/customwidget.component.script.js.hbs +3 -0
  64. angular-codegen/templates/page/page.component.ts.hbs → package/templates/customwidget/customwidget.component.ts.hbs +11 -14
  65. {angular-codegen → package}/templates/layout/layout.component.ts.hbs +27 -4
  66. package/templates/page/page.component.ts.hbs +74 -0
  67. {angular-codegen → package}/templates/page/page.module.ts.hbs +12 -1
  68. {angular-codegen → package}/templates/partial/partial.component.ts.hbs +19 -4
  69. {angular-codegen → package}/templates/prefab/prefab.component.ts.hbs +22 -5
  70. angular-codegen/angular-app/package.json +0 -136
  71. angular-codegen/angular-app/src/app/app-codegen.module.ts +0 -11
  72. angular-codegen/angular-app/src/app/lazy-load-scripts.resolve.ts +0 -20
  73. angular-codegen/angular-app/src/assets/styles/css/font/summernote.eot +0 -0
  74. angular-codegen/angular-app/src/assets/styles/css/font/summernote.ttf +0 -0
  75. angular-codegen/angular-app/src/assets/styles/css/font/summernote.woff +0 -0
  76. angular-codegen/angular-app/src/assets/styles/css/wm-style.css +0 -1
  77. angular-codegen/angular-app/src/framework/angular1.polyfills.ts +0 -36
  78. angular-codegen/angular-app/src/framework/services/lazy-component-ref-provider.service.ts +0 -64
  79. angular-codegen/angular-app/src/framework/util/page-util.ts +0 -5
  80. angular-codegen/angular-app/src/main.ts +0 -30
  81. angular-codegen/angular-app/wm-custom-webpack.config.js +0 -94
  82. angular-codegen/build-angular-app.js +0 -79
  83. angular-codegen/dependencies/app.component.html +0 -28
  84. angular-codegen/dependencies/transpilation-mobile.cjs.js +0 -93296
  85. angular-codegen/download-packages.js +0 -69
  86. angular-codegen/package-lock.json +0 -6059
  87. angular-codegen/src/codegen-args-cli.js +0 -1
  88. angular-codegen/src/codegen-cli.js +0 -1
  89. angular-codegen/src/codegen.js +0 -1
  90. angular-codegen/src/gen-app-codegen-module.js +0 -1
  91. angular-codegen/src/gen-app-routes.js +0 -1
  92. angular-codegen/src/gen-app-skeleton.js +0 -1
  93. angular-codegen/src/gen-components.js +0 -1
  94. angular-codegen/src/gen-index-html.js +0 -1
  95. angular-codegen/src/gen-layouts.js +0 -1
  96. angular-codegen/src/gen-lazy-module-routes.js +0 -1
  97. angular-codegen/src/handlebar-helpers.js +0 -1
  98. angular-codegen/src/pages-util.js +0 -1
  99. angular-codegen/src/project-meta.js +0 -1
  100. angular-codegen/src/update-angular-json.js +0 -1
  101. angular-codegen/src/wm-utils.js +0 -1
  102. angular-codegen/templates/app-routes.ts.hbs +0 -17
  103. {angular-codegen → package}/.npmrc +0 -0
  104. {angular-codegen → package}/angular-app/.npmrc +0 -0
  105. {angular-codegen → package}/angular-app/build-scripts/index-html-transform.js +0 -0
  106. {angular-codegen → package}/angular-app/build-scripts/optimize-css.gulpfile.js +0 -0
  107. {angular-codegen → package}/angular-app/build-scripts/update-version.js +0 -0
  108. {angular-codegen → package}/angular-app/src/.browserslistrc +0 -0
  109. {angular-codegen → package}/angular-app/src/app/app.component.css +0 -0
  110. {angular-codegen → package}/angular-app/src/app/app.component.script.js +0 -0
  111. {angular-codegen → package}/angular-app/src/app/app.component.variables.ts +0 -0
  112. {angular-codegen → package}/angular-app/src/app/app.routes.ts +0 -0
  113. {angular-codegen → package}/angular-app/src/app/prefabs/prefab-config.js +0 -0
  114. {angular-codegen → package}/angular-app/src/app/wm-project-properties.ts +0 -0
  115. {angular-codegen → package}/angular-app/src/assets/.gitkeep +0 -0
  116. {angular-codegen → package}/angular-app/src/assets/print.css +0 -0
  117. {angular-codegen → package}/angular-app/src/assets/styles/css/bootstrap.css.map +0 -0
  118. {angular-codegen → package}/angular-app/src/assets/styles/css/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  119. {angular-codegen → package}/angular-app/src/assets/styles/css/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  120. {angular-codegen → package}/angular-app/src/assets/styles/css/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  121. {angular-codegen → package}/angular-app/src/assets/styles/css/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  122. {angular-codegen → package}/angular-app/src/assets/styles/css/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  123. {angular-codegen → package}/angular-app/src/assets/styles/css/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  124. {angular-codegen → package}/angular-app/src/assets/styles/css/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  125. {angular-codegen → package}/angular-app/src/assets/styles/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  126. {angular-codegen → package}/angular-app/src/assets/styles/css/images/ui-icons_222222_256x240.png +0 -0
  127. {angular-codegen → package}/angular-app/src/assets/styles/css/images/ui-icons_2e83ff_256x240.png +0 -0
  128. {angular-codegen → package}/angular-app/src/assets/styles/css/images/ui-icons_444444_256x240.png +0 -0
  129. {angular-codegen → package}/angular-app/src/assets/styles/css/images/ui-icons_454545_256x240.png +0 -0
  130. {angular-codegen → package}/angular-app/src/assets/styles/css/images/ui-icons_555555_256x240.png +0 -0
  131. {angular-codegen → package}/angular-app/src/assets/styles/css/images/ui-icons_777620_256x240.png +0 -0
  132. {angular-codegen → package}/angular-app/src/assets/styles/css/images/ui-icons_777777_256x240.png +0 -0
  133. {angular-codegen → package}/angular-app/src/assets/styles/css/images/ui-icons_888888_256x240.png +0 -0
  134. {angular-codegen → package}/angular-app/src/assets/styles/css/images/ui-icons_cc0000_256x240.png +0 -0
  135. {angular-codegen → package}/angular-app/src/assets/styles/css/images/ui-icons_cd0a0a_256x240.png +0 -0
  136. {angular-codegen → package}/angular-app/src/assets/styles/css/images/ui-icons_ffffff_256x240.png +0 -0
  137. {angular-codegen → package}/angular-app/src/assets/styles/css/wm-responsive.css +0 -0
  138. {angular-codegen → package}/angular-app/src/assets/styles/fonts/FontAwesome.otf +0 -0
  139. {angular-codegen → package}/angular-app/src/assets/styles/fonts/fontawesome-webfont.eot +0 -0
  140. {angular-codegen → package}/angular-app/src/assets/styles/fonts/fontawesome-webfont.svg +0 -0
  141. {angular-codegen → package}/angular-app/src/assets/styles/fonts/fontawesome-webfont.ttf +0 -0
  142. {angular-codegen → package}/angular-app/src/assets/styles/fonts/fontawesome-webfont.woff +0 -0
  143. {angular-codegen → package}/angular-app/src/assets/styles/fonts/fontawesome-webfont.woff2 +0 -0
  144. {angular-codegen → package}/angular-app/src/assets/styles/fonts/glyphicons-halflings-regular.eot +0 -0
  145. {angular-codegen → package}/angular-app/src/assets/styles/fonts/glyphicons-halflings-regular.svg +0 -0
  146. {angular-codegen → package}/angular-app/src/assets/styles/fonts/glyphicons-halflings-regular.ttf +0 -0
  147. {angular-codegen → package}/angular-app/src/assets/styles/fonts/glyphicons-halflings-regular.woff +0 -0
  148. {angular-codegen → package}/angular-app/src/assets/styles/fonts/glyphicons-halflings-regular.woff2 +0 -0
  149. {angular-codegen → package}/angular-app/src/assets/styles/fonts/wavicon.eot +0 -0
  150. {angular-codegen → package}/angular-app/src/assets/styles/fonts/wavicon.ttf +0 -0
  151. {angular-codegen → package}/angular-app/src/assets/styles/fonts/wavicon.woff +0 -0
  152. {angular-codegen → package}/angular-app/src/assets/styles/fonts/wm-streamline-light-icon.eot +0 -0
  153. {angular-codegen → package}/angular-app/src/assets/styles/fonts/wm-streamline-light-icon.ttf +0 -0
  154. {angular-codegen → package}/angular-app/src/assets/styles/fonts/wm-streamline-light-icon.woff +0 -0
  155. {angular-codegen → package}/angular-app/src/assets/styles/fonts/wm-streamline-regular-icon.eot +0 -0
  156. {angular-codegen → package}/angular-app/src/assets/styles/fonts/wm-streamline-regular-icon.ttf +0 -0
  157. {angular-codegen → package}/angular-app/src/assets/styles/fonts/wm-streamline-regular-icon.woff +0 -0
  158. {angular-codegen → package}/angular-app/src/assets/styles/images/live-sync-icon.png +0 -0
  159. {angular-codegen → package}/angular-app/src/assets/styles/images/live-sync-touch-icon.png +0 -0
  160. {angular-codegen → package}/angular-app/src/assets/styles/images/loader.gif +0 -0
  161. {angular-codegen → package}/angular-app/src/assets/styles/images/spinner-small.gif +0 -0
  162. {angular-codegen → package}/angular-app/src/assets/styles/images/ui-icons.png +0 -0
  163. {angular-codegen → package}/angular-app/src/environments/environment.dev.ts +0 -0
  164. {angular-codegen → package}/angular-app/src/environments/environment.prod.ts +0 -0
  165. {angular-codegen → package}/angular-app/src/environments/environment.ts +0 -0
  166. {angular-codegen → package}/angular-app/src/framework/services/app-extension.service.ts +0 -0
  167. {angular-codegen → package}/angular-app/src/framework/services/app-js-provider.service.ts +0 -0
  168. {angular-codegen → package}/angular-app/src/framework/services/app-variables-provider.service.ts +0 -0
  169. {angular-codegen → package}/angular-app/src/framework/services/prefab-config-provider.service.ts +0 -0
  170. {angular-codegen → package}/angular-app/src/framework/util/lazy-module-routes.ts +0 -0
  171. {angular-codegen → package}/angular-app/src/polyfills.ts +0 -0
  172. {angular-codegen → package}/angular-app/src/styles.css +0 -0
  173. {angular-codegen → package}/angular-app/src/tslint.json +0 -0
  174. {angular-codegen → package}/build-util.js +0 -0
  175. {angular-codegen → package}/pwa-assets/icons/icon-128x128.png +0 -0
  176. {angular-codegen → package}/pwa-assets/icons/icon-144x144.png +0 -0
  177. {angular-codegen → package}/pwa-assets/icons/icon-152x152.png +0 -0
  178. {angular-codegen → package}/pwa-assets/icons/icon-192x192.png +0 -0
  179. {angular-codegen → package}/pwa-assets/icons/icon-384x384.png +0 -0
  180. {angular-codegen → package}/pwa-assets/icons/icon-512x512.png +0 -0
  181. {angular-codegen → package}/pwa-assets/icons/icon-72x72.png +0 -0
  182. {angular-codegen → package}/pwa-assets/icons/icon-96x96.png +0 -0
  183. {angular-codegen → package}/pwa-assets/manifest.json +0 -0
  184. {angular-codegen → package}/pwa-assets/ngsw-config.json +0 -0
  185. {angular-codegen → package}/pwa-assets/wmsw-worker.js +0 -0
  186. {angular-codegen → package}/src/expr-parser-utils.js +0 -0
  187. {angular-codegen → package}/src/gen-app-js.js +0 -0
  188. {angular-codegen → package}/src/gen-app-prefabs-module.js +0 -0
  189. {angular-codegen → package}/src/gen-app-variables.js +0 -0
  190. {angular-codegen → package}/src/gen-prefabs.js +0 -0
  191. {angular-codegen → package}/src/gen-pwa-files.js +0 -0
  192. {angular-codegen → package}/src/gen-tsconfig.js +0 -0
  193. {angular-codegen → package}/src/gen-wm-project-properties.js +0 -0
  194. {angular-codegen → package}/templates/app-codegen.module.ts.hbs +0 -0
  195. {angular-codegen → package}/templates/app-prefabs.module.ts.hbs +0 -0
  196. {angular-codegen → package}/templates/app.component.script.js.hbs +0 -0
  197. {angular-codegen → package}/templates/component.expressions.ts.hbs +0 -0
  198. {angular-codegen → package}/templates/component.variables.ts.hbs +0 -0
  199. {angular-codegen → package}/templates/expr-vs-fn.hbs +0 -0
  200. {angular-codegen → package}/templates/layout/layout.module.ts.hbs +0 -0
  201. {angular-codegen → package}/templates/lazy-module-routes.ts.hbs +0 -0
  202. {angular-codegen → package}/templates/page/page.component.script.js.hbs +0 -0
  203. {angular-codegen → package}/templates/partial/partial.component.script.js.hbs +0 -0
  204. {angular-codegen → package}/templates/partial/partial.module.ts.hbs +0 -0
  205. {angular-codegen → package}/templates/prefab/prefab-config.ts.hbs +0 -0
  206. {angular-codegen → package}/templates/prefab/prefab.component.script.js.hbs +0 -0
  207. {angular-codegen → package}/templates/prefab/prefab.module.ts.hbs +0 -0
  208. {angular-codegen → package}/templates/wm-project-properties.ts.hbs +0 -0
@@ -32,6 +32,10 @@ export class ComponentRefProviderService extends ComponentRefProvider {
32
32
  return Promise.resolve(partialRef);
33
33
  }
34
34
  }
35
+ // Guard against undefined value
36
+ if (!value) {
37
+ return Promise.resolve(null);
38
+ }
35
39
  if (!value.componentFactory) {
36
40
  value.componentFactory = this.componentFactoryResolver.resolveComponentFactory(value.ref);
37
41
  }
@@ -0,0 +1,13 @@
1
+ import { Injectable } from '@angular/core';
2
+
3
+ import { CustomwidgetConfigProvider } from '@wm/runtime/base';
4
+
5
+ import { getCustomWidgetConfig } from '../util/page-util';
6
+
7
+ @Injectable()
8
+ export class CustomwidgetConfigProviderService extends CustomwidgetConfigProvider {
9
+
10
+ public getConfig(widgetname: string): Promise<any> {
11
+ return Promise.resolve(getCustomWidgetConfig(widgetname));
12
+ }
13
+ }
@@ -0,0 +1,56 @@
1
+ import { Injectable, ComponentFactoryResolver } from '@angular/core';
2
+ import { PartialRefProvider } from '@wm/core';
3
+ import { ComponentType } from '@wm/runtime/base';
4
+ import { partialLazyModules, prefabLazyModules, prefabPartialLazyModules } from '../util/lazy-module-routes';
5
+
6
+ type Options = {
7
+ prefab: string
8
+ };
9
+
10
+ @Injectable({
11
+ providedIn: 'root'
12
+ })
13
+ export class LazyComponentRefProviderService extends PartialRefProvider {
14
+ constructor(
15
+ private componentFactoryResolver: ComponentFactoryResolver
16
+ ) {
17
+ super();
18
+ }
19
+
20
+ private getLazyModule(componentName: string, componentType: ComponentType, options?: Options) {
21
+ if (componentType === ComponentType.PARTIAL && options && options.prefab) {
22
+ return prefabPartialLazyModules[`${options.prefab}_${componentName}`];
23
+ }
24
+ if (componentType === ComponentType.PARTIAL) {
25
+ return partialLazyModules[componentName];
26
+ }
27
+ if (componentType === ComponentType.PREFAB) {
28
+ return prefabLazyModules[componentName];
29
+ }
30
+ }
31
+
32
+ public async getComponentFactoryRef(componentName: string, componentType: ComponentType, options?: Options) {
33
+ try {
34
+ const lazyModule = this.getLazyModule(componentName, componentType, options);
35
+
36
+ if (!lazyModule) {
37
+ console.error(`No lazy module found for ${componentName}`);
38
+ return null;
39
+ }
40
+
41
+ // Load the component
42
+ const loadedComponent = await lazyModule.loadComponent();
43
+
44
+ if (!loadedComponent) {
45
+ console.error(`Failed to load component ${componentName}`);
46
+ return null;
47
+ }
48
+
49
+ // For standalone components, create a component factory
50
+ return this.componentFactoryResolver.resolveComponentFactory(loadedComponent);
51
+ } catch (e) {
52
+ console.error('Error in getComponentFactoryRef:', e);
53
+ return null;
54
+ }
55
+ }
56
+ }
@@ -0,0 +1,7 @@
1
+ const prefabConfigs = new Map<string, any>();
2
+ const customWidgetConfigs = new Map<string, any>();
3
+
4
+ export const registerPrefabConfig = (prefabName: string, config: any) => prefabConfigs.set(prefabName, config);
5
+ export const getPrefabConfig = prefabName => prefabConfigs.get(prefabName);
6
+ export const registerCustomWidgetConfig = (customWidget: string, config: any) => customWidgetConfigs.set(customWidget, config);
7
+ export const getCustomWidgetConfig = customWidget => customWidgetConfigs.get(customWidget);
@@ -11,7 +11,7 @@
11
11
  <link rel="icon" type="image/x-icon" href="favicon.ico">
12
12
 
13
13
  </head>
14
- <body class="wm-app">
14
+ <body class="wm-app">
15
15
  <app-root></app-root>
16
16
  </body>
17
17
  </html>
@@ -0,0 +1,70 @@
1
+ import { ApplicationRef, enableProdMode } from '@angular/core';
2
+ import { bootstrapApplication } from '@angular/platform-browser';
3
+ import { environment } from './environments/environment';
4
+ import initWmProjectProperties from './app/wm-project-properties';
5
+ import { WMAppProperties } from './app/wmProperties';
6
+ import * as fontConfig from './font.config';
7
+ import { appConfig } from './app/app.config';
8
+ import { AppComponent } from '@wm/runtime/base';
9
+
10
+ // Format Accept-Language header
11
+ const formatAcceptHeader = (languages: string[]): string => {
12
+ const result: string[] = [];
13
+ const addedLanguages = new Set<string>(); // To track already added languages
14
+ let qValue = 1.0;
15
+
16
+ languages.forEach((lang: string) => {
17
+ if (!addedLanguages.has(lang)) {
18
+ // Add the full language (e.g., en-US or en) if not already added
19
+ result.push(`${lang}${qValue === 1.0 ? '' : `;q=${qValue.toFixed(1)}`}`);
20
+ addedLanguages.add(lang);
21
+ // Decrease qValue for the next language
22
+ qValue = Math.max(0.1, qValue - 0.1); // Decrease qValue, minimum is 0.1
23
+ }
24
+
25
+ // If language has a region code (e.g., en-US), also add the base language (e.g., en)
26
+ if (lang.includes('-')) {
27
+ const baseLang = lang.split('-')[0];
28
+ if (!addedLanguages.has(baseLang)) {
29
+ result.push(`${baseLang};q=${qValue.toFixed(1)}`);
30
+ addedLanguages.add(baseLang);
31
+
32
+ // Decrease qValue for the next language
33
+ qValue = Math.max(0.1, qValue - 0.1);
34
+ }
35
+ }
36
+ });
37
+
38
+ return result.join(',');
39
+ };
40
+
41
+ // Initialize WMAppProperties
42
+ WMAppProperties['preferredLanguage'] = formatAcceptHeader((navigator as any).languages);
43
+ WMAppProperties['fontConfig'] = fontConfig;
44
+ (window as any)._WM_APP_PROPERTIES = WMAppProperties;
45
+ initWmProjectProperties();
46
+
47
+ if (environment.production) {
48
+ enableProdMode();
49
+ }
50
+
51
+ // MEMORY LEAK FIX: Store event listener references for cleanup (though these are one-time bootstrap events)
52
+ const boundDOMContentLoadedHandler = () => {
53
+ new Promise<Event | void>(resolve => {
54
+ resolve();
55
+ }).then(() => bootstrapApplication(AppComponent, appConfig))
56
+ .then((appRef: ApplicationRef) => {
57
+ // MEMORY LEAK FIX: Store unload handler reference
58
+ const boundUnloadHandler = () => {
59
+ appRef.components.map(c => c?.destroy());
60
+ // MEMORY LEAK FIX: Remove unload listener after cleanup (though unload is typically final)
61
+ window.removeEventListener('unload', boundUnloadHandler);
62
+ };
63
+ window.addEventListener('unload', boundUnloadHandler);
64
+ })
65
+ .catch(err => console.error('Error bootstrapping app:', err));
66
+ // MEMORY LEAK FIX: Remove DOMContentLoaded listener after execution (one-time event)
67
+ document.removeEventListener('DOMContentLoaded', boundDOMContentLoadedHandler);
68
+ };
69
+
70
+ document.addEventListener('DOMContentLoaded', boundDOMContentLoadedHandler);
@@ -1,9 +1,13 @@
1
- import "jest-preset-angular/setup-jest";
1
+
2
+ // This file is automatically loaded when running `jest` commands
3
+ import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';
2
4
  import { ToastrModule } from 'ngx-toastr';
3
5
  import { TestBed } from '@angular/core/testing';
4
6
  import _ from 'lodash-es';
5
7
  import 'jest-canvas-mock';
6
8
 
9
+ setupZoneTestEnv();
10
+
7
11
  // Mock global objects if necessary
8
12
  global.jQuery = require("jquery");
9
13
  global.$ = global.jQuery;
@@ -67,7 +71,6 @@ import "jquery-ui/ui/widgets/draggable.js";
67
71
  import "jquery-ui/ui/widgets/droppable.js";
68
72
  import "libraries/scripts/jquery.ui.touch-punch/jquery.ui.touch-punch.min.js";
69
73
  import "moment-timezone/builds/moment-timezone.min.js";
70
- import "hammerjs/hammer.min.js";
71
74
  import "iscroll/build/iscroll.js";
72
75
  import "tabbable/dist/index.umd.min.js";
73
76
  import "@wavemaker/focus-trap/dist/focus-trap.umd.min.js";
@@ -81,16 +84,11 @@ beforeEach(() => {
81
84
  ToastrModule.forRoot(),
82
85
  ],
83
86
  })
84
- Object.defineProperties(window, {
85
- location: {
86
- writable: true,
87
- value: {
88
- reload: jest.fn(),
89
- },
90
- },
91
- });
92
87
  });
93
88
 
89
+ // Mock window.location for tests
90
+ // We'll use a simpler approach that doesn't try to redefine read-only properties
91
+ // The tests will handle their own window.location mocking as needed
94
92
  // jest.setup.js
95
93
  Object.defineProperty(global.HTMLMediaElement.prototype, 'load', {
96
94
  configurable: true,
@@ -119,3 +117,5 @@ Object.defineProperty(global.HTMLMediaElement.prototype, 'addTextTrack', {
119
117
  writable: true,
120
118
  value: jest.fn(),
121
119
  });
120
+
121
+
@@ -8,7 +8,10 @@
8
8
  "allowJs": true
9
9
  },
10
10
  "exclude": [
11
- "test.ts",
12
- "**/*.spec.ts"
11
+ "**/*.spec.ts",
12
+ "app/extensions/formatters.js",
13
+ "environments/environment.*.ts",
14
+ "setup-jest.js",
15
+ "test.ts"
13
16
  ]
14
17
  }
@@ -7,7 +7,7 @@
7
7
  "sourceMap": true,
8
8
  "declaration": false,
9
9
  "target": "es2022",
10
- "module": "es2020",
10
+ "module": "es2022",
11
11
  "moduleResolution": "node",
12
12
  "esModuleInterop": true,
13
13
  "emitDecoratorMetadata": true,
@@ -16,7 +16,7 @@
16
16
  "node_modules/@types"
17
17
  ],
18
18
  "lib": [
19
- "es2018",
19
+ "es2022",
20
20
  "dom"
21
21
  ],
22
22
  "paths": {
@@ -32,39 +32,30 @@
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
  ],
41
38
  "@wavemaker/variables": [
42
39
  "node_modules/@wavemaker/variables/"
43
40
  ],
41
+ "@wavemaker/custom-widgets-m3": [
42
+ "node_modules/@wavemaker/custom-widgets-m3/"
43
+ ],
44
44
  "@wm/components/base": [
45
45
  "node_modules/@wavemaker/app-ng-runtime/components/base"
46
46
  ],
47
- "@wm/components/basic": [
48
- "node_modules/@wavemaker/app-ng-runtime/components/basic/default"
47
+ "@wm/components/basic/*": [
48
+ "node_modules/@wavemaker/app-ng-runtime/components/basic/*"
49
49
  ],
50
- "@wm/components/input": [
51
- "node_modules/@wavemaker/app-ng-runtime/components/input/default"
50
+ "@wm/components/input/*": [
51
+ "node_modules/@wavemaker/app-ng-runtime/components/input/*"
52
52
  ],
53
53
  "@wm/components/page": [
54
54
  "node_modules/@wavemaker/app-ng-runtime/components/page/default"
55
55
  ],
56
- "@wm/mobile/components/basic": [
57
- "node_modules/@wavemaker/app-ng-runtime/mobile/components/basic/default"
58
- ],
59
- "@wm/mobile/components/page": [
60
- "node_modules/@wavemaker/app-ng-runtime/mobile/components/page/default"
61
- ],
62
56
  "@wm/components/dialogs": [
63
57
  "node_modules/@wavemaker/app-ng-runtime/components/dialogs/default"
64
58
  ],
65
- "@wm/mobile/components/*": [
66
- "node_modules/@wavemaker/app-ng-runtime/mobile/components/*"
67
- ],
68
59
  "@wm/components/*": [
69
60
  "node_modules/@wavemaker/app-ng-runtime/components/*"
70
61
  ],
@@ -86,29 +77,11 @@
86
77
  "@wm/variables": [
87
78
  "node_modules/@wavemaker/app-ng-runtime/variables"
88
79
  ],
89
- "@wm/mobile/core": [
90
- "node_modules/@wavemaker/app-ng-runtime/mobile/core"
91
- ],
92
- "@wm/mobile/components": [
93
- "node_modules/@wavemaker/app-ng-runtime/mobile/components"
94
- ],
95
- "@wm/mobile/offline": [
96
- "node_modules/@wavemaker/app-ng-runtime/mobile/offline"
97
- ],
98
- "@wm/mobile/variables": [
99
- "node_modules/@wavemaker/app-ng-runtime/mobile/variables"
100
- ],
101
80
  "@wm/runtime/base": [
102
81
  "node_modules/@wavemaker/app-ng-runtime/runtime/base"
103
82
  ],
104
83
  "@wm/runtime/dynamic": [
105
84
  "node_modules/@wavemaker/app-ng-runtime/runtime/dynamic"
106
- ],
107
- "@wm/mobile/runtime": [
108
- "node_modules/@wavemaker/app-ng-runtime/mobile/runtime"
109
- ],
110
- "@wm/mobile/runtime/dynamic": [
111
- "node_modules/@wavemaker/app-ng-runtime/mobile/runtime-dynamic"
112
85
  ]
113
86
  },
114
87
  "useDefineForClassFields": false
@@ -31,14 +31,11 @@
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
  ],
40
- "@wm/components/basic": [
41
- "node_modules/@wavemaker/app-ng-runtime/components/basic/default"
37
+ "@wm/components/basic/*": [
38
+ "node_modules/@wavemaker/app-ng-runtime/components/basic/*"
42
39
  ],
43
40
  "@wm/components/input": [
44
41
  "node_modules/@wavemaker/app-ng-runtime/components/input/default"
@@ -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
  },
@@ -0,0 +1,51 @@
1
+ const CompressionPlugin = require(`compression-webpack-plugin`);
2
+ const path = require(`path`);
3
+ const MomentLocalesPlugin = require('moment-locales-webpack-plugin');
4
+
5
+ const wmPropertiesPath = path.join(__dirname, '/src/app/wmProperties.js');
6
+
7
+ const { WMAppProperties } = require(wmPropertiesPath);
8
+
9
+ const localesToKeep = Object.values(WMAppProperties.supportedLanguages)
10
+ .map(lang => lang.moment)
11
+ .filter(locale => locale !== null);
12
+
13
+ const includeMomentPlugin = WMAppProperties.languageBundleSources === "STATIC";
14
+
15
+ module.exports = {
16
+ resolve:{
17
+ alias:{
18
+ themes: path.resolve(__dirname,`src/assets/themes/`)
19
+ }
20
+ },
21
+ plugins:[
22
+ new CompressionPlugin({
23
+ test: /\.(js|css|html|svg|txt|eot|otf|ttf|gif)$/,
24
+ filename: "[name].gzip[ext]",
25
+ algorithm: "gzip"
26
+ }),
27
+ new CompressionPlugin({
28
+ test: /\.(js|css|html|svg|txt|eot|otf|ttf|gif)$/,
29
+ filename: "[name].br[ext]",
30
+ algorithm: "brotliCompress"
31
+ }),
32
+ // On STATIC WMAppProperties.languageBundleSources, required moment locales are included in the bundle
33
+
34
+ /**
35
+ * MomentLocalesPlugin is used to include only the required moment locales in the bundle.
36
+ */
37
+ ...(includeMomentPlugin ? [ new MomentLocalesPlugin({ localesToKeep }) ] : [])
38
+ ],
39
+ optimization: {
40
+ splitChunks: {
41
+ automaticNameDelimiter:'-',
42
+ cacheGroups: {
43
+ vendor: {
44
+ minSize: 1000000,
45
+ maxSize: 1000000,
46
+ test: /[\\/]node_modules(?![\\/]wm)[\\/]/
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }