@wavemaker-ai/angular-codegen 1.0.0-rc.647469
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.
- package/.npmrc +1 -0
- package/angular-app/.npmrc +1 -0
- package/angular-app/angular.json +274 -0
- package/angular-app/build-scripts/build.js +36 -0
- package/angular-app/build-scripts/index-html-transform-ng-serve.ts +20 -0
- package/angular-app/build-scripts/index-html-transform.js +28 -0
- package/angular-app/build-scripts/optimize-css.gulpfile.js +101 -0
- package/angular-app/build-scripts/post-build.js +217 -0
- package/angular-app/build-scripts/update-version.js +25 -0
- package/angular-app/dependency-report.html +124 -0
- package/angular-app/generate-dependency-report.js +240 -0
- package/angular-app/npm-shrinkwrap.json +24224 -0
- package/angular-app/package-lock.json +24224 -0
- package/angular-app/package.json +129 -0
- package/angular-app/proxy.conf.js +14 -0
- package/angular-app/src/.browserslistrc +12 -0
- package/angular-app/src/app/app.component.css +0 -0
- package/angular-app/src/app/app.component.script.js +3 -0
- package/angular-app/src/app/app.component.variables.ts +3 -0
- package/angular-app/src/app/app.routes.ts +5 -0
- package/angular-app/src/app/lazy-load-scripts.resolve.ts +13 -0
- package/angular-app/src/app/prefabs/prefab-config.js +2 -0
- package/angular-app/src/app/wm-project-properties.ts +3 -0
- package/angular-app/src/assets/.gitkeep +0 -0
- package/angular-app/src/assets/print.css +32 -0
- package/angular-app/src/assets/styles/css/bootstrap.css.map +1 -0
- package/angular-app/src/assets/styles/css/font/summernote.eot +0 -0
- package/angular-app/src/assets/styles/css/font/summernote.ttf +0 -0
- package/angular-app/src/assets/styles/css/font/summernote.woff +0 -0
- package/angular-app/src/assets/styles/css/font/summernote.woff2 +0 -0
- package/angular-app/src/assets/styles/css/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- package/angular-app/src/assets/styles/css/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- package/angular-app/src/assets/styles/css/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- package/angular-app/src/assets/styles/css/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- package/angular-app/src/assets/styles/css/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- package/angular-app/src/assets/styles/css/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- package/angular-app/src/assets/styles/css/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- package/angular-app/src/assets/styles/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- package/angular-app/src/assets/styles/css/images/ui-icons_222222_256x240.png +0 -0
- package/angular-app/src/assets/styles/css/images/ui-icons_2e83ff_256x240.png +0 -0
- package/angular-app/src/assets/styles/css/images/ui-icons_444444_256x240.png +0 -0
- package/angular-app/src/assets/styles/css/images/ui-icons_454545_256x240.png +0 -0
- package/angular-app/src/assets/styles/css/images/ui-icons_555555_256x240.png +0 -0
- package/angular-app/src/assets/styles/css/images/ui-icons_777620_256x240.png +0 -0
- package/angular-app/src/assets/styles/css/images/ui-icons_777777_256x240.png +0 -0
- package/angular-app/src/assets/styles/css/images/ui-icons_888888_256x240.png +0 -0
- package/angular-app/src/assets/styles/css/images/ui-icons_cc0000_256x240.png +0 -0
- package/angular-app/src/assets/styles/css/images/ui-icons_cd0a0a_256x240.png +0 -0
- package/angular-app/src/assets/styles/css/images/ui-icons_ffffff_256x240.png +0 -0
- package/angular-app/src/assets/styles/css/wm-responsive.css +1 -0
- package/angular-app/src/assets/styles/css/wm-style.css +1 -0
- package/angular-app/src/assets/styles/fonts/FontAwesome.otf +0 -0
- package/angular-app/src/assets/styles/fonts/fontawesome-webfont.eot +0 -0
- package/angular-app/src/assets/styles/fonts/fontawesome-webfont.svg +2671 -0
- package/angular-app/src/assets/styles/fonts/fontawesome-webfont.ttf +0 -0
- package/angular-app/src/assets/styles/fonts/fontawesome-webfont.woff +0 -0
- package/angular-app/src/assets/styles/fonts/fontawesome-webfont.woff2 +0 -0
- package/angular-app/src/assets/styles/fonts/glyphicons-halflings-regular.eot +0 -0
- package/angular-app/src/assets/styles/fonts/glyphicons-halflings-regular.svg +288 -0
- package/angular-app/src/assets/styles/fonts/glyphicons-halflings-regular.ttf +0 -0
- package/angular-app/src/assets/styles/fonts/glyphicons-halflings-regular.woff +0 -0
- package/angular-app/src/assets/styles/fonts/glyphicons-halflings-regular.woff2 +0 -0
- package/angular-app/src/assets/styles/fonts/wavicon.eot +0 -0
- package/angular-app/src/assets/styles/fonts/wavicon.ttf +0 -0
- package/angular-app/src/assets/styles/fonts/wavicon.woff +0 -0
- package/angular-app/src/assets/styles/fonts/wm-streamline-light-icon.eot +0 -0
- package/angular-app/src/assets/styles/fonts/wm-streamline-light-icon.ttf +0 -0
- package/angular-app/src/assets/styles/fonts/wm-streamline-light-icon.woff +0 -0
- package/angular-app/src/assets/styles/fonts/wm-streamline-regular-icon.eot +0 -0
- package/angular-app/src/assets/styles/fonts/wm-streamline-regular-icon.ttf +0 -0
- package/angular-app/src/assets/styles/fonts/wm-streamline-regular-icon.woff +0 -0
- package/angular-app/src/assets/styles/images/live-sync-icon.png +0 -0
- package/angular-app/src/assets/styles/images/live-sync-touch-icon.png +0 -0
- package/angular-app/src/assets/styles/images/loader.gif +0 -0
- package/angular-app/src/assets/styles/images/spinner-small.gif +0 -0
- package/angular-app/src/assets/styles/images/ui-icons.png +0 -0
- package/angular-app/src/environments/environment.dev.ts +3 -0
- package/angular-app/src/environments/environment.prod.ts +3 -0
- package/angular-app/src/environments/environment.ts +16 -0
- package/angular-app/src/framework/services/app-extension.service.ts +20 -0
- package/angular-app/src/framework/services/app-js-provider.service.ts +15 -0
- package/angular-app/src/framework/services/app-variables-provider.service.ts +15 -0
- package/angular-app/src/framework/services/component-ref-provider.service.ts +44 -0
- package/angular-app/src/framework/services/customwidget-config-provider.service.ts +13 -0
- package/angular-app/src/framework/services/lazy-component-ref-provider.service.ts +56 -0
- package/angular-app/src/framework/services/prefab-config-provider.service.ts +13 -0
- package/angular-app/src/framework/util/lazy-module-routes.ts +4 -0
- package/angular-app/src/framework/util/page-util.ts +7 -0
- package/angular-app/src/index.html +17 -0
- package/angular-app/src/main.ts +70 -0
- package/angular-app/src/polyfills.ts +53 -0
- package/angular-app/src/setup-jest.js +121 -0
- package/angular-app/src/styles.css +1 -0
- package/angular-app/src/tsconfig.app.json +17 -0
- package/angular-app/src/tslint.json +17 -0
- package/angular-app/src/wm-namespace.js +13 -0
- package/angular-app/tsconfig.json +94 -0
- package/angular-app/tsconfig.web-app.json +81 -0
- package/angular-app/wm-custom-webpack.config.js +51 -0
- package/build-angular-app.js +522 -0
- package/build-util.js +89 -0
- package/dependencies/app.component.html +40 -0
- package/dependencies/custom-widgets-bundle.cjs.js +421 -0
- package/dependencies/expression-parser.cjs.js +30154 -0
- package/dependencies/pipe-provider.cjs.js +208853 -0
- package/dependencies/transpilation-web.cjs.js +106547 -0
- package/download-packages.js +197 -0
- package/generate-angular-app.js +41 -0
- package/npm-shrinkwrap.json +8093 -0
- package/package-lock.json +8093 -0
- package/package.json +44 -0
- package/pwa-assets/icons/icon-128x128.png +0 -0
- package/pwa-assets/icons/icon-144x144.png +0 -0
- package/pwa-assets/icons/icon-152x152.png +0 -0
- package/pwa-assets/icons/icon-192x192.png +0 -0
- package/pwa-assets/icons/icon-384x384.png +0 -0
- package/pwa-assets/icons/icon-512x512.png +0 -0
- package/pwa-assets/icons/icon-72x72.png +0 -0
- package/pwa-assets/icons/icon-96x96.png +0 -0
- package/pwa-assets/manifest.json +59 -0
- package/pwa-assets/ngsw-config.json +30 -0
- package/pwa-assets/wmsw-worker.js +24 -0
- package/src/codegen-args-cli.js +1 -0
- package/src/codegen-cli.js +1 -0
- package/src/codegen.js +1 -0
- package/src/copy-utils.js +1 -0
- package/src/eslintrc_config.js +1 -0
- package/src/expr-parser-utils.js +1 -0
- package/src/gen-app-codegen-module.js +1 -0
- package/src/gen-app-js.js +1 -0
- package/src/gen-app-override-css.js +1 -0
- package/src/gen-app-prefabs-module.js +1 -0
- package/src/gen-app-routes.js +1 -0
- package/src/gen-app-skeleton.js +1 -0
- package/src/gen-app-variables.js +1 -0
- package/src/gen-components.js +1 -0
- package/src/gen-customwidget-config.js +1 -0
- package/src/gen-index-html.js +1 -0
- package/src/gen-layouts.js +1 -0
- package/src/gen-lazy-module-routes.js +1 -0
- package/src/gen-prefabs.js +1 -0
- package/src/gen-pwa-files.js +1 -0
- package/src/gen-tsconfig.js +1 -0
- package/src/gen-wm-project-properties.js +1 -0
- package/src/handlebar-helpers.js +1 -0
- package/src/pages-util.js +1 -0
- package/src/project-meta.js +1 -0
- package/src/update-angular-json.js +1 -0
- package/src/wm-namespace.js +1 -0
- package/src/wm-utils.js +1 -0
- package/templates/app-codegen.module.ts.hbs +21 -0
- package/templates/app-prefabs.module.ts.hbs +31 -0
- package/templates/app-routes.ts.hbs +14 -0
- package/templates/app.component.script.js.hbs +8 -0
- package/templates/app.config.ts.hbs +211 -0
- package/templates/app.module.ts.hbs +294 -0
- package/templates/component.config.ts.hbs +1 -0
- package/templates/component.expressions.ts.hbs +3 -0
- package/templates/component.variables.ts.hbs +3 -0
- package/templates/customwidget/customwidget-config.ts.hbs +6 -0
- package/templates/customwidget/customwidget.component.script.js.hbs +3 -0
- package/templates/customwidget/customwidget.component.ts.hbs +42 -0
- package/templates/expr-vs-fn.hbs +3 -0
- package/templates/layout/layout.component.ts.hbs +55 -0
- package/templates/layout/layout.module.ts.hbs +42 -0
- package/templates/lazy-module-routes.ts.hbs +3 -0
- package/templates/page/page.component.script.js.hbs +3 -0
- package/templates/page/page.component.ts.hbs +74 -0
- package/templates/page/page.module.ts.hbs +61 -0
- package/templates/partial/partial.component.script.js.hbs +3 -0
- package/templates/partial/partial.component.ts.hbs +61 -0
- package/templates/partial/partial.module.ts.hbs +43 -0
- package/templates/prefab/prefab-config.ts.hbs +6 -0
- package/templates/prefab/prefab.component.script.js.hbs +3 -0
- package/templates/prefab/prefab.component.ts.hbs +63 -0
- package/templates/prefab/prefab.module.ts.hbs +38 -0
- package/templates/wm-project-properties.ts.hbs +7 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
import { AppJSProvider } from '@wm/runtime/base';
|
|
4
|
+
|
|
5
|
+
import { initScript } from '../../app/app.component.script';
|
|
6
|
+
|
|
7
|
+
@Injectable({
|
|
8
|
+
providedIn: 'root'
|
|
9
|
+
})
|
|
10
|
+
export class AppJSProviderService extends AppJSProvider {
|
|
11
|
+
|
|
12
|
+
public getAppScriptFn(): Promise<Function> {
|
|
13
|
+
return Promise.resolve(initScript);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
import { AppVariablesProvider } from '@wm/runtime/base';
|
|
4
|
+
|
|
5
|
+
import { variables } from '../../app/app.component.variables';
|
|
6
|
+
|
|
7
|
+
@Injectable({
|
|
8
|
+
providedIn: 'root'
|
|
9
|
+
})
|
|
10
|
+
export class AppVariablesProviderService extends AppVariablesProvider {
|
|
11
|
+
|
|
12
|
+
public async getAppVariables(): Promise<any> {
|
|
13
|
+
return Promise.resolve(variables);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ComponentFactoryResolver, Injectable, Inject } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
import { ComponentRefProvider, ComponentType } from '@wm/runtime/base';
|
|
4
|
+
import { LazyComponentRefProviderService } from './lazy-component-ref-provider.service';
|
|
5
|
+
|
|
6
|
+
const componentRefCache = new Map<ComponentType, Map<string, any>>();
|
|
7
|
+
|
|
8
|
+
componentRefCache.set(ComponentType.PAGE, new Map<string, any>());
|
|
9
|
+
componentRefCache.set(ComponentType.PARTIAL, new Map<string, any>());
|
|
10
|
+
componentRefCache.set(ComponentType.PREFAB, new Map<string, any>());
|
|
11
|
+
|
|
12
|
+
@Injectable()
|
|
13
|
+
export class ComponentRefProviderService extends ComponentRefProvider {
|
|
14
|
+
|
|
15
|
+
static registerComponentRef(name: string, type: ComponentType, ref: any, componentFactory?: any) {
|
|
16
|
+
componentRefCache.get(type).set(name, {ref: ref, componentFactory: componentFactory});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
constructor(private componentFactoryResolver: ComponentFactoryResolver, @Inject(LazyComponentRefProviderService) private lazyComponentRef) {
|
|
20
|
+
super();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public async getComponentFactoryRef(componentName: string, componentType: ComponentType, options?: {}): Promise<any> {
|
|
24
|
+
const value = componentRefCache.get(componentType).get(componentName);
|
|
25
|
+
if (!value && (componentType === ComponentType.PARTIAL || componentType === ComponentType.PREFAB)) {
|
|
26
|
+
const partialRef = await this.lazyComponentRef.getComponentFactoryRef(
|
|
27
|
+
componentName,
|
|
28
|
+
componentType,
|
|
29
|
+
options
|
|
30
|
+
);
|
|
31
|
+
if (partialRef) {
|
|
32
|
+
return Promise.resolve(partialRef);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// Guard against undefined value
|
|
36
|
+
if (!value) {
|
|
37
|
+
return Promise.resolve(null);
|
|
38
|
+
}
|
|
39
|
+
if (!value.componentFactory) {
|
|
40
|
+
value.componentFactory = this.componentFactoryResolver.resolveComponentFactory(value.ref);
|
|
41
|
+
}
|
|
42
|
+
return Promise.resolve(value.componentFactory);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -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,13 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
import { PrefabConfigProvider } from '@wm/runtime/base';
|
|
4
|
+
|
|
5
|
+
import { getPrefabConfig } from '../util/page-util';
|
|
6
|
+
|
|
7
|
+
@Injectable()
|
|
8
|
+
export class PrefabConfigProviderService extends PrefabConfigProvider {
|
|
9
|
+
|
|
10
|
+
public getConfig(prefabName: string): Promise<any> {
|
|
11
|
+
return Promise.resolve(getPrefabConfig(prefabName));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -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);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Runtime Angular App</title>
|
|
6
|
+
<base href="/">
|
|
7
|
+
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
9
|
+
<link rel="stylesheet" href="//localhost:8080/wavemaker/_static_/9.9.9/wmapp/styles/css/wm-style.css">
|
|
10
|
+
<link rel="stylesheet" href="//localhost:8080/b/themes/material/style.css">
|
|
11
|
+
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
|
12
|
+
|
|
13
|
+
</head>
|
|
14
|
+
<body class="wm-app">
|
|
15
|
+
<app-root></app-root>
|
|
16
|
+
</body>
|
|
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);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file includes polyfills needed by Angular and is loaded before the app.
|
|
3
|
+
* You can add your own extra polyfills to this file.
|
|
4
|
+
*
|
|
5
|
+
* This file is divided into 2 sections:
|
|
6
|
+
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
|
7
|
+
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
|
8
|
+
* file.
|
|
9
|
+
*
|
|
10
|
+
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
|
11
|
+
* automatically update themselves. This includes recent versions of Safari, Chrome (including
|
|
12
|
+
* Opera), Edge on the desktop, and iOS and Chrome on mobile.
|
|
13
|
+
*
|
|
14
|
+
* Learn more in https://angular.io/guide/browser-support
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/***************************************************************************************************
|
|
18
|
+
* BROWSER POLYFILLS
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* By default, zone.js will patch all possible macroTask and DomEvents
|
|
23
|
+
* user can disable parts of macroTask/DomEvents patch by setting following flags
|
|
24
|
+
* because those flags need to be set before `zone.js` being loaded, and webpack
|
|
25
|
+
* will put import in the top of bundle, so user need to create a separate file
|
|
26
|
+
* in this directory (for example: zone-flags.ts), and put the following flags
|
|
27
|
+
* into that file, and then add the following code before importing zone.js.
|
|
28
|
+
* import './zone-flags';
|
|
29
|
+
*
|
|
30
|
+
* The flags allowed in zone-flags.ts are listed here.
|
|
31
|
+
*
|
|
32
|
+
* The following flags will work for all browsers.
|
|
33
|
+
*
|
|
34
|
+
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
|
35
|
+
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
|
36
|
+
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
|
37
|
+
*
|
|
38
|
+
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
|
|
39
|
+
* with the following flag, it will bypass `zone.js` patch for IE/Edge
|
|
40
|
+
*
|
|
41
|
+
* (window as any).__Zone_enable_cross_context_check = true;
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/***************************************************************************************************
|
|
46
|
+
* Zone JS is required by default for Angular itself.
|
|
47
|
+
*/
|
|
48
|
+
import 'zone.js'; // Included with Angular CLI.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
/***************************************************************************************************
|
|
52
|
+
* APPLICATION IMPORTS
|
|
53
|
+
*/
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
|
|
2
|
+
// This file is automatically loaded when running `jest` commands
|
|
3
|
+
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';
|
|
4
|
+
import { ToastrModule } from 'ngx-toastr';
|
|
5
|
+
import { TestBed } from '@angular/core/testing';
|
|
6
|
+
import _ from 'lodash-es';
|
|
7
|
+
import 'jest-canvas-mock';
|
|
8
|
+
|
|
9
|
+
setupZoneTestEnv();
|
|
10
|
+
|
|
11
|
+
// Mock global objects if necessary
|
|
12
|
+
global.jQuery = require("jquery");
|
|
13
|
+
global.$ = global.jQuery;
|
|
14
|
+
global._ = _;
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
global.moment = require("moment");
|
|
18
|
+
|
|
19
|
+
class IntersectionObserver {
|
|
20
|
+
constructor(callback, options) {
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
observe(element) {
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
unobserve() {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
disconnect() {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
global.IntersectionObserver = IntersectionObserver;
|
|
37
|
+
// jest.setup.js
|
|
38
|
+
|
|
39
|
+
// Mock MSCSSMatrix
|
|
40
|
+
class MockMSCSSMatrix {
|
|
41
|
+
constructor() {
|
|
42
|
+
// Initialize with default values or any necessary properties
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Add any methods that your tests might call
|
|
46
|
+
setMatrixValue(value) {
|
|
47
|
+
// Mock implementation of setMatrixValue
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
multiply(matrix) {
|
|
51
|
+
// Mock implementation of multiply
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Add other methods as needed
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Attach the mock to the global scope
|
|
59
|
+
global.MSCSSMatrix = MockMSCSSMatrix;
|
|
60
|
+
|
|
61
|
+
import "jquery-ui/ui/disable-selection.js";
|
|
62
|
+
import "jquery-ui/ui/version.js";
|
|
63
|
+
import "jquery-ui/ui/widget.js";
|
|
64
|
+
import "jquery-ui/ui/scroll-parent.js";
|
|
65
|
+
import "jquery-ui/ui/plugin.js";
|
|
66
|
+
import "jquery-ui/ui/data.js";
|
|
67
|
+
import "jquery-ui/ui/widgets/mouse.js";
|
|
68
|
+
import "jquery-ui/ui/widgets/resizable.js";
|
|
69
|
+
import "jquery-ui/ui/widgets/sortable.js";
|
|
70
|
+
import "jquery-ui/ui/widgets/draggable.js";
|
|
71
|
+
import "jquery-ui/ui/widgets/droppable.js";
|
|
72
|
+
import "libraries/scripts/jquery.ui.touch-punch/jquery.ui.touch-punch.min.js";
|
|
73
|
+
import "moment-timezone/builds/moment-timezone.min.js";
|
|
74
|
+
import "iscroll/build/iscroll.js";
|
|
75
|
+
import "tabbable/dist/index.umd.min.js";
|
|
76
|
+
import "@wavemaker/focus-trap/dist/focus-trap.umd.min.js";
|
|
77
|
+
import "x2js"
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
beforeEach(() => {
|
|
82
|
+
TestBed.configureTestingModule({
|
|
83
|
+
imports : [
|
|
84
|
+
ToastrModule.forRoot(),
|
|
85
|
+
],
|
|
86
|
+
})
|
|
87
|
+
});
|
|
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
|
|
92
|
+
// jest.setup.js
|
|
93
|
+
Object.defineProperty(global.HTMLMediaElement.prototype, 'load', {
|
|
94
|
+
configurable: true,
|
|
95
|
+
enumerable: true,
|
|
96
|
+
writable: true,
|
|
97
|
+
value: jest.fn(),
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
Object.defineProperty(global.HTMLMediaElement.prototype, 'play', {
|
|
101
|
+
configurable: true,
|
|
102
|
+
enumerable: true,
|
|
103
|
+
writable: true,
|
|
104
|
+
value: jest.fn().mockResolvedValue(),
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
Object.defineProperty(global.HTMLMediaElement.prototype, 'pause', {
|
|
108
|
+
configurable: true,
|
|
109
|
+
enumerable: true,
|
|
110
|
+
writable: true,
|
|
111
|
+
value: jest.fn(),
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
Object.defineProperty(global.HTMLMediaElement.prototype, 'addTextTrack', {
|
|
115
|
+
configurable: true,
|
|
116
|
+
enumerable: true,
|
|
117
|
+
writable: true,
|
|
118
|
+
value: jest.fn(),
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* You can add global styles to this file, and also import other style files */
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../out-tsc/app",
|
|
5
|
+
"types": [
|
|
6
|
+
"jquery"
|
|
7
|
+
],
|
|
8
|
+
"allowJs": true
|
|
9
|
+
},
|
|
10
|
+
"exclude": [
|
|
11
|
+
"**/*.spec.ts",
|
|
12
|
+
"app/extensions/formatters.js",
|
|
13
|
+
"environments/environment.*.ts",
|
|
14
|
+
"setup-jest.js",
|
|
15
|
+
"test.ts"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Central WaveMaker npm namespace configuration.
|
|
3
|
+
*
|
|
4
|
+
* All source files import WM_NPM_SCOPE from here instead of hardcoding
|
|
5
|
+
* '@wavemaker'. Override via the WM_NPM_SCOPE environment variable to
|
|
6
|
+
* switch namespaces at build or runtime.
|
|
7
|
+
*
|
|
8
|
+
* Default: '@wavemaker-ai'
|
|
9
|
+
* Override: WM_NPM_SCOPE=@wavemaker sh build.sh
|
|
10
|
+
*/
|
|
11
|
+
const WM_NPM_SCOPE = process.env.WM_NPM_SCOPE || '@wavemaker-ai';
|
|
12
|
+
|
|
13
|
+
module.exports = { WM_NPM_SCOPE };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compileOnSave": false,
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": "./",
|
|
5
|
+
"downlevelIteration": true,
|
|
6
|
+
"outDir": "./dist/out-tsc",
|
|
7
|
+
"sourceMap": true,
|
|
8
|
+
"declaration": false,
|
|
9
|
+
"target": "es2022",
|
|
10
|
+
"module": "es2022",
|
|
11
|
+
"moduleResolution": "node",
|
|
12
|
+
"esModuleInterop": true,
|
|
13
|
+
"emitDecoratorMetadata": true,
|
|
14
|
+
"experimentalDecorators": true,
|
|
15
|
+
"typeRoots": [
|
|
16
|
+
"node_modules/@types"
|
|
17
|
+
],
|
|
18
|
+
"lib": [
|
|
19
|
+
"es2022",
|
|
20
|
+
"dom"
|
|
21
|
+
],
|
|
22
|
+
"paths": {
|
|
23
|
+
"rxjs/observable/throw": [
|
|
24
|
+
"node_modules/rxjs-compat/_esm2015/observable/throw"
|
|
25
|
+
],
|
|
26
|
+
"rxjs/observable/*": [
|
|
27
|
+
"node_modules/rxjs-compat/_esm2015/observable/*"
|
|
28
|
+
],
|
|
29
|
+
"rxjs/Observable": [
|
|
30
|
+
"node_modules/rxjs-compat/_esm2015/Observable"
|
|
31
|
+
],
|
|
32
|
+
"@wm/build-task": [
|
|
33
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/build-task/"
|
|
34
|
+
],
|
|
35
|
+
"@wm/core": [
|
|
36
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/core"
|
|
37
|
+
],
|
|
38
|
+
"@wavemaker-ai/variables": [
|
|
39
|
+
"node_modules/@wavemaker-ai/variables/"
|
|
40
|
+
],
|
|
41
|
+
"@wavemaker-ai/custom-widgets-m3": [
|
|
42
|
+
"node_modules/@wavemaker-ai/custom-widgets-m3/"
|
|
43
|
+
],
|
|
44
|
+
"@wm/components/base": [
|
|
45
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/components/base"
|
|
46
|
+
],
|
|
47
|
+
"@wm/components/basic/*": [
|
|
48
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/components/basic/*"
|
|
49
|
+
],
|
|
50
|
+
"@wm/components/input/*": [
|
|
51
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/components/input/*"
|
|
52
|
+
],
|
|
53
|
+
"@wm/components/page": [
|
|
54
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/components/page/default"
|
|
55
|
+
],
|
|
56
|
+
"@wm/components/dialogs": [
|
|
57
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/components/dialogs/default"
|
|
58
|
+
],
|
|
59
|
+
"@wm/components/*": [
|
|
60
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/components/*"
|
|
61
|
+
],
|
|
62
|
+
"@wm/transpiler": [
|
|
63
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/transpiler"
|
|
64
|
+
],
|
|
65
|
+
"@wm/security": [
|
|
66
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/security"
|
|
67
|
+
],
|
|
68
|
+
"@swipey": [
|
|
69
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/swipey"
|
|
70
|
+
],
|
|
71
|
+
"@wm/http": [
|
|
72
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/http"
|
|
73
|
+
],
|
|
74
|
+
"@wm/oAuth": [
|
|
75
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/oAuth"
|
|
76
|
+
],
|
|
77
|
+
"@wm/variables": [
|
|
78
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/variables"
|
|
79
|
+
],
|
|
80
|
+
"@wm/runtime/base": [
|
|
81
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/runtime/base"
|
|
82
|
+
],
|
|
83
|
+
"@wm/runtime/dynamic": [
|
|
84
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/runtime/dynamic"
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
"useDefineForClassFields": false
|
|
88
|
+
},
|
|
89
|
+
"angularCompilerOptions": {
|
|
90
|
+
"compilationMode": "full",
|
|
91
|
+
"strictMetadataEmit": false,
|
|
92
|
+
"fullTemplateTypeCheck": false
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compileOnSave": false,
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": "./",
|
|
5
|
+
"downlevelIteration": true,
|
|
6
|
+
"outDir": "./dist/out-tsc",
|
|
7
|
+
"sourceMap": true,
|
|
8
|
+
"declaration": false,
|
|
9
|
+
"target": "es2022",
|
|
10
|
+
"module": "es2020",
|
|
11
|
+
"moduleResolution": "node",
|
|
12
|
+
"emitDecoratorMetadata": true,
|
|
13
|
+
"experimentalDecorators": true,
|
|
14
|
+
"typeRoots": [
|
|
15
|
+
"node_modules/@types"
|
|
16
|
+
],
|
|
17
|
+
"lib": [
|
|
18
|
+
"es2018",
|
|
19
|
+
"dom"
|
|
20
|
+
],
|
|
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
|
+
],
|
|
31
|
+
"@wm/build-task": [
|
|
32
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/build-task/"
|
|
33
|
+
],
|
|
34
|
+
"@wm/core": [
|
|
35
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/core"
|
|
36
|
+
],
|
|
37
|
+
"@wm/components/basic/*": [
|
|
38
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/components/basic/*"
|
|
39
|
+
],
|
|
40
|
+
"@wm/components/input": [
|
|
41
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/components/input/default"
|
|
42
|
+
],
|
|
43
|
+
"@wm/components/page": [
|
|
44
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/components/page/default"
|
|
45
|
+
],
|
|
46
|
+
"@wm/components/dialogs": [
|
|
47
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/components/dialogs/default"
|
|
48
|
+
],
|
|
49
|
+
"@wm/components/*": [
|
|
50
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/components/*"
|
|
51
|
+
],
|
|
52
|
+
"@wm/transpiler": [
|
|
53
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/transpiler"
|
|
54
|
+
],
|
|
55
|
+
"@wm/security": [
|
|
56
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/security"
|
|
57
|
+
],
|
|
58
|
+
"@swipey": [
|
|
59
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/swipey"
|
|
60
|
+
],
|
|
61
|
+
"@wm/http": [
|
|
62
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/http"
|
|
63
|
+
],
|
|
64
|
+
"@wm/oAuth": [
|
|
65
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/oAuth"
|
|
66
|
+
],
|
|
67
|
+
"@wm/variables": [
|
|
68
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/variables"
|
|
69
|
+
],
|
|
70
|
+
"@wm/runtime/base": [
|
|
71
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/runtime/base"
|
|
72
|
+
],
|
|
73
|
+
"@wm/runtime/dynamic": [
|
|
74
|
+
"node_modules/@wavemaker-ai/app-ng-runtime/runtime/dynamic"
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"angularCompilerOptions": {
|
|
79
|
+
"compilationMode": "full"
|
|
80
|
+
}
|
|
81
|
+
}
|