@wavemaker-ai/angular-codegen 1.0.0-next.27766
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 +53 -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/ngx-bootstrap-patch.mjs +287 -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 +25806 -0
- package/angular-app/package-lock.json +25806 -0
- package/angular-app/package.json +131 -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/app/wmProperties.js +13 -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 +70 -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 +79 -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/typings.d.ts +27 -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 +436 -0
- package/dependencies/expression-parser.cjs.js +33229 -0
- package/dependencies/pipe-provider.cjs.js +220499 -0
- package/dependencies/transpilation-web.cjs.js +107451 -0
- package/download-packages.js +197 -0
- package/generate-angular-app.js +41 -0
- package/npm-shrinkwrap.json +8073 -0
- package/package-lock.json +8073 -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,70 @@
|
|
|
1
|
+
import { Injectable, Inject, Type } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
import { ComponentRefProvider, ComponentType } from '@wm/runtime/base';
|
|
4
|
+
import { LazyComponentRefProviderService } from './lazy-component-ref-provider.service';
|
|
5
|
+
|
|
6
|
+
interface ComponentCacheEntry {
|
|
7
|
+
ref: Type<unknown>;
|
|
8
|
+
componentFactory?: any; // Legacy support for non-standalone components
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const componentCache = new Map<ComponentType, Map<string, ComponentCacheEntry>>();
|
|
12
|
+
|
|
13
|
+
componentCache.set(ComponentType.PAGE, new Map<string, ComponentCacheEntry>());
|
|
14
|
+
componentCache.set(ComponentType.PARTIAL, new Map<string, ComponentCacheEntry>());
|
|
15
|
+
componentCache.set(ComponentType.PREFAB, new Map<string, ComponentCacheEntry>());
|
|
16
|
+
|
|
17
|
+
@Injectable()
|
|
18
|
+
export class ComponentRefProviderService extends ComponentRefProvider {
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Register a component class for dynamic instantiation
|
|
22
|
+
* @param name - Component name identifier
|
|
23
|
+
* @param type - Component type (PAGE, PARTIAL, PREFAB)
|
|
24
|
+
* @param ref - Component class reference
|
|
25
|
+
* @param componentFactory - Optional legacy component factory (for backward compatibility)
|
|
26
|
+
*/
|
|
27
|
+
static registerComponentRef(name: string, type: ComponentType, ref: Type<unknown>, componentFactory?: any): void {
|
|
28
|
+
componentCache.get(type).set(name, { ref, componentFactory });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
constructor(@Inject(LazyComponentRefProviderService) private lazyComponentLoader: LazyComponentRefProviderService) {
|
|
32
|
+
super();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Get component class for dynamic instantiation
|
|
37
|
+
* Returns the component Type which can be used with ViewContainerRef.createComponent()
|
|
38
|
+
*
|
|
39
|
+
* @param componentName - Name of the component to load
|
|
40
|
+
* @param componentType - Type of component (PAGE, PARTIAL, PREFAB)
|
|
41
|
+
* @param options - Additional options (e.g., prefab name for partial resolution)
|
|
42
|
+
* @returns Promise resolving to component Type or null if not found
|
|
43
|
+
*/
|
|
44
|
+
public async getComponentFactoryRef(componentName: string, componentType: ComponentType, options?: Record<string, unknown>): Promise<Type<unknown> | null> {
|
|
45
|
+
const cachedEntry = componentCache.get(componentType)?.get(componentName);
|
|
46
|
+
|
|
47
|
+
// Try lazy loading for PARTIAL and PREFAB types if not in cache
|
|
48
|
+
if (!cachedEntry && (componentType === ComponentType.PARTIAL || componentType === ComponentType.PREFAB)) {
|
|
49
|
+
const lazyComponent = await this.lazyComponentLoader.getComponentFactoryRef(
|
|
50
|
+
componentName,
|
|
51
|
+
componentType,
|
|
52
|
+
options
|
|
53
|
+
);
|
|
54
|
+
if (lazyComponent) {
|
|
55
|
+
return lazyComponent;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Return null if component not found
|
|
60
|
+
if (!cachedEntry) {
|
|
61
|
+
console.warn(`Component not found: ${componentName} (type: ${componentType})`);
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Return component class (modern Angular 13+ approach for standalone components)
|
|
66
|
+
// For legacy components, the componentFactory would be used, but we return the ref
|
|
67
|
+
// as createComponent() handles both standalone and non-standalone components
|
|
68
|
+
return cachedEntry.ref;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -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,79 @@
|
|
|
1
|
+
import { Injectable, Type } 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
|
+
interface LazyLoadOptions {
|
|
7
|
+
prefab?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface LazyModule {
|
|
11
|
+
loadComponent: () => Promise<Type<unknown>>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@Injectable({
|
|
15
|
+
providedIn: 'root'
|
|
16
|
+
})
|
|
17
|
+
export class LazyComponentRefProviderService extends PartialRefProvider {
|
|
18
|
+
constructor() {
|
|
19
|
+
super();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Resolve the appropriate lazy module based on component type and options
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
private getLazyModule(componentName: string, componentType: ComponentType, options?: LazyLoadOptions): LazyModule | undefined {
|
|
27
|
+
// Prefab-scoped partial (e.g., partial inside a prefab)
|
|
28
|
+
if (componentType === ComponentType.PARTIAL && options?.prefab) {
|
|
29
|
+
return prefabPartialLazyModules[`${options.prefab}_${componentName}`];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Standard partial
|
|
33
|
+
if (componentType === ComponentType.PARTIAL) {
|
|
34
|
+
return partialLazyModules[componentName];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Prefab
|
|
38
|
+
if (componentType === ComponentType.PREFAB) {
|
|
39
|
+
return prefabLazyModules[componentName];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Lazy load and return a component class
|
|
47
|
+
* Returns the component Type which can be used with ViewContainerRef.createComponent()
|
|
48
|
+
*
|
|
49
|
+
* @param componentName - Name of the component to lazy load
|
|
50
|
+
* @param componentType - Type of component (PARTIAL, PREFAB)
|
|
51
|
+
* @param options - Additional options (e.g., prefab name for partial resolution)
|
|
52
|
+
* @returns Promise resolving to component Type or null if loading fails
|
|
53
|
+
*/
|
|
54
|
+
public async getComponentFactoryRef(componentName: string, componentType: ComponentType, options?: LazyLoadOptions): Promise<Type<unknown> | null> {
|
|
55
|
+
try {
|
|
56
|
+
const lazyModule = this.getLazyModule(componentName, componentType, options);
|
|
57
|
+
|
|
58
|
+
if (!lazyModule) {
|
|
59
|
+
console.error(`No lazy module found for ${componentName}`);
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Dynamically load the component class
|
|
64
|
+
const componentClass = await lazyModule.loadComponent();
|
|
65
|
+
|
|
66
|
+
if (!componentClass) {
|
|
67
|
+
console.error(`Failed to load component class: ${componentName}`);
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Return the component class directly (Angular 13+ standalone component approach)
|
|
72
|
+
// This can be used directly with ViewContainerRef.createComponent()
|
|
73
|
+
return componentClass;
|
|
74
|
+
} catch (error) {
|
|
75
|
+
console.error(`Error lazy loading component ${componentName}:`, error);
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -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 "projects/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,27 @@
|
|
|
1
|
+
// Global type declarations for jQuery extensions
|
|
2
|
+
// Using declaration merging to extend existing jQuery types
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
interface JQueryStatic {
|
|
6
|
+
ui?: {
|
|
7
|
+
widget?: any;
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface JQuery {
|
|
13
|
+
DataTable?(options?: any): any;
|
|
14
|
+
destroy?(): void;
|
|
15
|
+
datatable?(method: string, ...args: any[]): any;
|
|
16
|
+
datatable?(options?: any): any;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Extend jQuery.fn namespace for DataTable plugin
|
|
20
|
+
namespace JQueryStatic {
|
|
21
|
+
interface fn {
|
|
22
|
+
DataTable?: any;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export {};
|
|
@@ -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
|
+
"strictTemplates": false
|
|
93
|
+
}
|
|
94
|
+
}
|