@wavemaker-ai/angular-app 1.0.0-rc.309
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.json +274 -0
- package/build-scripts/build.js +53 -0
- package/build-scripts/index-html-transform-ng-serve.ts +20 -0
- package/build-scripts/index-html-transform.js +28 -0
- package/build-scripts/ngx-bootstrap-patch.mjs +287 -0
- package/build-scripts/optimize-css.gulpfile.js +101 -0
- package/build-scripts/post-build.js +217 -0
- package/build-scripts/update-version.js +25 -0
- package/dependencies/app.component.html +40 -0
- package/dependencies/custom-widgets-bundle.cjs.js +421 -0
- package/dependencies/expression-parser.cjs.js +33229 -0
- package/dependencies/pipe-provider.cjs.js +220499 -0
- package/dependencies/transpilation-web.cjs.js +107428 -0
- package/dependency-report.html +124 -0
- package/generate-dependency-report.js +240 -0
- package/npm-shrinkwrap.json +25599 -0
- package/package-lock.json +25599 -0
- package/package.json +131 -0
- package/proxy.conf.js +14 -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/.browserslistrc +12 -0
- package/src/app/app.component.css +0 -0
- package/src/app/app.component.script.js +3 -0
- package/src/app/app.component.variables.ts +3 -0
- package/src/app/app.routes.ts +5 -0
- package/src/app/lazy-load-scripts.resolve.ts +13 -0
- package/src/app/prefabs/prefab-config.js +2 -0
- package/src/app/wm-project-properties.ts +3 -0
- package/src/app/wmProperties.js +13 -0
- package/src/assets/.gitkeep +0 -0
- package/src/assets/print.css +32 -0
- package/src/environments/environment.dev.ts +3 -0
- package/src/environments/environment.prod.ts +3 -0
- package/src/environments/environment.ts +16 -0
- package/src/framework/services/app-extension.service.ts +20 -0
- package/src/framework/services/app-js-provider.service.ts +15 -0
- package/src/framework/services/app-variables-provider.service.ts +15 -0
- package/src/framework/services/component-ref-provider.service.ts +70 -0
- package/src/framework/services/customwidget-config-provider.service.ts +13 -0
- package/src/framework/services/lazy-component-ref-provider.service.ts +79 -0
- package/src/framework/services/prefab-config-provider.service.ts +13 -0
- package/src/framework/util/lazy-module-routes.ts +4 -0
- package/src/framework/util/page-util.ts +7 -0
- package/src/index.html +17 -0
- package/src/main.ts +70 -0
- package/src/polyfills.ts +53 -0
- package/src/setup-jest.js +121 -0
- package/src/styles.css +1 -0
- package/src/tsconfig.app.json +17 -0
- package/src/tslint.json +17 -0
- package/src/typings.d.ts +27 -0
- package/src/wm-namespace.js +13 -0
- package/tsconfig.json +94 -0
- package/tsconfig.web-app.json +81 -0
- package/wm-custom-webpack.config.js +51 -0
package/package.json
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wavemaker-ai/angular-app",
|
|
3
|
+
"version": "1.0.0-rc.309",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"ng": "ng",
|
|
6
|
+
"start": "./node_modules/.bin/ng serve",
|
|
7
|
+
"build": "node build-scripts/build.js",
|
|
8
|
+
"post-build": "node build-scripts/post-build.js",
|
|
9
|
+
"test": "jest --no-cache",
|
|
10
|
+
"test:watch": "jest --watch",
|
|
11
|
+
"test:coverage": "jest --coverage && node jest-code-coverage-report.js",
|
|
12
|
+
"test-prod": "jest --no-cache --no-color --ci --silent 2>&1 | sed 's/\\x1b\\[[0-9;]*m//g' > karma-test-report.txt",
|
|
13
|
+
"lint": "eslint src/",
|
|
14
|
+
"e2e": "./node_modules/.bin/ng e2e",
|
|
15
|
+
"generate-deps": "node generate-dependency-report.js",
|
|
16
|
+
"optimizecss": "gulp --gulpfile build-scripts/optimize-css.gulpfile.js",
|
|
17
|
+
"owasp": "owasp-dependency-check --project \"wavemaker-ng-runtime\" -f \"ALL\""
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"**/*",
|
|
21
|
+
".npmrc"
|
|
22
|
+
],
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@angular/animations": "20.3.19",
|
|
25
|
+
"@angular/common": "20.3.19",
|
|
26
|
+
"@angular/compiler": "20.3.19",
|
|
27
|
+
"@angular/core": "20.3.19",
|
|
28
|
+
"@angular/forms": "20.3.19",
|
|
29
|
+
"@angular/platform-browser": "20.3.19",
|
|
30
|
+
"@angular/platform-browser-dynamic": "20.3.19",
|
|
31
|
+
"@angular/router": "20.3.19",
|
|
32
|
+
"@angular/service-worker": "20.3.19",
|
|
33
|
+
"@fullcalendar/core": "6.1.18",
|
|
34
|
+
"@fullcalendar/daygrid": "6.1.18",
|
|
35
|
+
"@fullcalendar/interaction": "6.1.18",
|
|
36
|
+
"@fullcalendar/list": "6.1.18",
|
|
37
|
+
"@fullcalendar/timegrid": "6.1.18",
|
|
38
|
+
"@metrichor/jmespath": "0.3.1",
|
|
39
|
+
"@wavemaker-ai/custom-widgets-m3": "1.0.0-rc.309",
|
|
40
|
+
"@wavemaker/focus-trap": "1.0.1",
|
|
41
|
+
"@wavemaker-ai/foundation-css": "1.0.0-rc.309",
|
|
42
|
+
"@wavemaker/nvd3": "1.8.16",
|
|
43
|
+
"@wavemaker-ai/variables": "1.0.0-rc.309",
|
|
44
|
+
"@ztree/ztree_v3": "3.5.48",
|
|
45
|
+
"acorn": "8.15.0",
|
|
46
|
+
"angular-imask": "7.6.1",
|
|
47
|
+
"angular2-websocket": "0.9.8",
|
|
48
|
+
"d3": "7.8.5",
|
|
49
|
+
"iscroll": "5.2.0",
|
|
50
|
+
"jquery": "3.7.1",
|
|
51
|
+
"jquery-ui": "1.14.1",
|
|
52
|
+
"jssha": "3.3.1",
|
|
53
|
+
"lodash-es": "4.18.1",
|
|
54
|
+
"moment": "2.30.1",
|
|
55
|
+
"moment-timezone": "0.6.0",
|
|
56
|
+
"ng-circle-progress": "1.7.1",
|
|
57
|
+
"ngx-bootstrap": "20.0.2",
|
|
58
|
+
"ngx-color-picker": "20.1.1",
|
|
59
|
+
"ngx-toastr": "19.1.0",
|
|
60
|
+
"rxjs": "7.8.2",
|
|
61
|
+
"summernote": "0.9.1",
|
|
62
|
+
"tslib": "2.8.1",
|
|
63
|
+
"x2js": "3.4.4",
|
|
64
|
+
"zone.js": "0.15.1",
|
|
65
|
+
"@wavemaker-ai/app-ng-runtime": "1.0.0-rc.309"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@ampproject/rollup-plugin-closure-compiler": "0.27.0",
|
|
69
|
+
"@angular-builders/custom-webpack": "20.0.0",
|
|
70
|
+
"@angular-devkit/build-angular": "20.3.19",
|
|
71
|
+
"@angular-eslint/builder": "20.1.1",
|
|
72
|
+
"@angular-eslint/eslint-plugin": "20.1.1",
|
|
73
|
+
"@angular-eslint/eslint-plugin-template": "20.1.1",
|
|
74
|
+
"@angular-eslint/schematics": "20.1.1",
|
|
75
|
+
"@angular-eslint/template-parser": "20.1.1",
|
|
76
|
+
"@angular/cli": "20.3.19",
|
|
77
|
+
"@angular/compiler-cli": "20.3.19",
|
|
78
|
+
"@angular/language-service": "20.3.19",
|
|
79
|
+
"@compodoc/compodoc": "1.2.1",
|
|
80
|
+
"@rollup/plugin-alias": "5.1.1",
|
|
81
|
+
"@rollup/plugin-commonjs": "28.0.6",
|
|
82
|
+
"@rollup/plugin-multi-entry": "6.0.1",
|
|
83
|
+
"@rollup/plugin-node-resolve": "16.0.1",
|
|
84
|
+
"@rollup/plugin-typescript": "12.3.0",
|
|
85
|
+
"@types/jest": "30.0.0",
|
|
86
|
+
"@types/jquery": "3.5.32",
|
|
87
|
+
"@types/lodash-es": "4.17.12",
|
|
88
|
+
"@types/node": "24.2.0",
|
|
89
|
+
"@typescript-eslint/eslint-plugin": "8.39.0",
|
|
90
|
+
"@typescript-eslint/parser": "8.39.0",
|
|
91
|
+
"cheerio": "1.1.2",
|
|
92
|
+
"compression-webpack-plugin": "12.0.0",
|
|
93
|
+
"core-js": "3.45.0",
|
|
94
|
+
"eslint": "8.45.0",
|
|
95
|
+
"fs": "0.0.1-security",
|
|
96
|
+
"fs-extra": "11.3.1",
|
|
97
|
+
"jest": "30.0.5",
|
|
98
|
+
"jest-canvas-mock": "2.5.2",
|
|
99
|
+
"jest-environment-jsdom": "30.0.5",
|
|
100
|
+
"jest-preset-angular": "15.0.0",
|
|
101
|
+
"license-checker": "25.0.1",
|
|
102
|
+
"moment-locales-webpack-plugin": "1.2.0",
|
|
103
|
+
"ng-packagr": "20.3.2",
|
|
104
|
+
"owasp-dependency-check": "1.0.1",
|
|
105
|
+
"rimraf": "6.0.1",
|
|
106
|
+
"rollup": "4.60.1",
|
|
107
|
+
"sonarqube-scanner": "3.5.0",
|
|
108
|
+
"terser": "5.43.1",
|
|
109
|
+
"typescript": "5.9.3",
|
|
110
|
+
"util": "0.12.5",
|
|
111
|
+
"yargs": "18.0.0"
|
|
112
|
+
},
|
|
113
|
+
"optionalDependencies": {
|
|
114
|
+
"@lmdb/lmdb-linux-x64": "3.4.2",
|
|
115
|
+
"@rollup/rollup-darwin-arm64": "4.60.1",
|
|
116
|
+
"@rollup/rollup-linux-x64-gnu": "4.60.1",
|
|
117
|
+
"@rollup/rollup-win32-x64": "4.60.1"
|
|
118
|
+
},
|
|
119
|
+
"engines": {
|
|
120
|
+
"node": "22.18.0",
|
|
121
|
+
"npm": "10.9.3"
|
|
122
|
+
},
|
|
123
|
+
"overrides": {
|
|
124
|
+
"ajv": "8.18.0",
|
|
125
|
+
"picomatch": "4.0.4",
|
|
126
|
+
"postcss": "8.5.13",
|
|
127
|
+
"uuid": "14.0.0",
|
|
128
|
+
"vite": "7.3.2"
|
|
129
|
+
},
|
|
130
|
+
"engineStrict": true
|
|
131
|
+
}
|
package/proxy.conf.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
"/services": {
|
|
3
|
+
target: "https://<your-deployed-app-url>/",
|
|
4
|
+
secure: true,
|
|
5
|
+
changeOrigin: true
|
|
6
|
+
},
|
|
7
|
+
"/j_spring_security_check": {
|
|
8
|
+
target: "https://<your-deployed-app-url>/",
|
|
9
|
+
secure: true,
|
|
10
|
+
changeOrigin: true,
|
|
11
|
+
cookiePathRewrite: "/",
|
|
12
|
+
cookieDomainRewrite: "localhost"
|
|
13
|
+
}
|
|
14
|
+
};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wm-pwa",
|
|
3
|
+
"short_name": "wm-pwa",
|
|
4
|
+
"theme_color": "#2c3049",
|
|
5
|
+
"background_color": "#fafafa",
|
|
6
|
+
"display": "standalone",
|
|
7
|
+
"scope": "./",
|
|
8
|
+
"start_url": "./",
|
|
9
|
+
"icons": [
|
|
10
|
+
{
|
|
11
|
+
"src": "./ng-bundle/assets/icons/icon-72x72.png",
|
|
12
|
+
"sizes": "72x72",
|
|
13
|
+
"type": "image/png",
|
|
14
|
+
"purpose": "maskable any"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"src": "./ng-bundle/assets/icons/icon-96x96.png",
|
|
18
|
+
"sizes": "96x96",
|
|
19
|
+
"type": "image/png",
|
|
20
|
+
"purpose": "maskable any"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"src": "./ng-bundle/assets/icons/icon-128x128.png",
|
|
24
|
+
"sizes": "128x128",
|
|
25
|
+
"type": "image/png",
|
|
26
|
+
"purpose": "maskable any"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"src": "./ng-bundle/assets/icons/icon-144x144.png",
|
|
30
|
+
"sizes": "144x144",
|
|
31
|
+
"type": "image/png",
|
|
32
|
+
"purpose": "maskable any"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"src": "./ng-bundle/assets/icons/icon-152x152.png",
|
|
36
|
+
"sizes": "152x152",
|
|
37
|
+
"type": "image/png",
|
|
38
|
+
"purpose": "maskable any"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"src": "./ng-bundle/assets/icons/icon-192x192.png",
|
|
42
|
+
"sizes": "192x192",
|
|
43
|
+
"type": "image/png",
|
|
44
|
+
"purpose": "maskable any"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"src": "./ng-bundle/assets/icons/icon-384x384.png",
|
|
48
|
+
"sizes": "384x384",
|
|
49
|
+
"type": "image/png",
|
|
50
|
+
"purpose": "maskable any"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"src": "./ng-bundle/assets/icons/icon-512x512.png",
|
|
54
|
+
"sizes": "512x512",
|
|
55
|
+
"type": "image/png",
|
|
56
|
+
"purpose": "maskable any"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"index": "/index.html",
|
|
3
|
+
"assetGroups": [
|
|
4
|
+
{
|
|
5
|
+
"name": "app",
|
|
6
|
+
"installMode": "prefetch",
|
|
7
|
+
"resources": {
|
|
8
|
+
"files": [
|
|
9
|
+
"/favicon.ico",
|
|
10
|
+
"/index.html",
|
|
11
|
+
"/manifest.json",
|
|
12
|
+
"/*.css",
|
|
13
|
+
"/*.js"
|
|
14
|
+
],
|
|
15
|
+
"urls": []
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "assets",
|
|
20
|
+
"installMode": "lazy",
|
|
21
|
+
"resources": {
|
|
22
|
+
"files": [
|
|
23
|
+
"/assets/**",
|
|
24
|
+
"/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
|
|
25
|
+
],
|
|
26
|
+
"urls": []
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
importScripts("./ngsw-worker.js");
|
|
2
|
+
|
|
3
|
+
(function () {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
self.addEventListener("notificationclick", (event) => {
|
|
7
|
+
const notificationUrl = event.notification.data?.url;
|
|
8
|
+
event.notification.close();
|
|
9
|
+
// Enumerate windows, and call window.focus(), or open a new one.
|
|
10
|
+
event.waitUntil(
|
|
11
|
+
clients.matchAll().then((matchedClients) => {
|
|
12
|
+
for (let client of matchedClients) {
|
|
13
|
+
if (!notificationUrl) {
|
|
14
|
+
return client.focus();
|
|
15
|
+
}
|
|
16
|
+
if (client.url === notificationUrl) {
|
|
17
|
+
return client.focus();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return clients.openWindow(notificationUrl);
|
|
21
|
+
})
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
})();
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
|
|
2
|
+
# For additional information regarding the format and rule options, please see:
|
|
3
|
+
# https://github.com/browserslist/browserslist#queries
|
|
4
|
+
#
|
|
5
|
+
# For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed
|
|
6
|
+
|
|
7
|
+
> 0.5%
|
|
8
|
+
last 2 versions
|
|
9
|
+
Firefox ESR
|
|
10
|
+
not dead
|
|
11
|
+
not IE 9-10
|
|
12
|
+
not IE 11
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { ScriptLoaderService } from '@wm/core';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@Injectable()
|
|
7
|
+
export class LazyLoadScriptsResolve {
|
|
8
|
+
|
|
9
|
+
constructor(private scriptLoaderService: ScriptLoaderService) {}
|
|
10
|
+
|
|
11
|
+
async resolve() {
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Default WMAppProperties - will be overridden by application-specific properties
|
|
2
|
+
export const WMAppProperties = {
|
|
3
|
+
name: 'wavemaker-ng-runtime',
|
|
4
|
+
type: 'APPLICATION',
|
|
5
|
+
platformType: 'WEB',
|
|
6
|
+
supportedLanguages: {
|
|
7
|
+
'en': { moment: 'en' }
|
|
8
|
+
},
|
|
9
|
+
languageBundleSources: 'STATIC',
|
|
10
|
+
preferredLanguage: 'en',
|
|
11
|
+
fontConfig: {}
|
|
12
|
+
};
|
|
13
|
+
|
|
File without changes
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
body {margin:0; padding:0; line-height: 1.4em; word-spacing:1px; letter-spacing:0.2px; font: 13px Arial, Helvetica,"Lucida Grande", serif; color: #000;}
|
|
2
|
+
|
|
3
|
+
/*Header*/
|
|
4
|
+
h2 {color:#000; font-size:25px;}
|
|
5
|
+
|
|
6
|
+
/* Links */
|
|
7
|
+
a:link, a:visited {background: transparent; color:#333; text-decoration:none;}
|
|
8
|
+
a:link[href^="http://"]:after, a[href^="http://"]:visited:after {content: " (" attr(href) ") "; font-size: 11px;}
|
|
9
|
+
a[href^="http://"] {color:#000;}
|
|
10
|
+
|
|
11
|
+
/*Image*/
|
|
12
|
+
img, img a, .more-link a {border:none;}
|
|
13
|
+
|
|
14
|
+
/*Remove Element*/
|
|
15
|
+
.app-header, .app-top-nav, .app-footer, .app-left-panel, .app-right-panel {display: none !important;}
|
|
16
|
+
|
|
17
|
+
/*Remove Form Controls*/
|
|
18
|
+
.app-checkboxset, .app-button, .app-button-group, .app-menu, .app-composite-widget,
|
|
19
|
+
.form-group, .form-control,
|
|
20
|
+
.app-fileupload, .app-grid .table-footer
|
|
21
|
+
{display: none !important;}
|
|
22
|
+
|
|
23
|
+
/*Show all of the grid data*/
|
|
24
|
+
.app-grid .app-datagrid .app-datagrid-cell {
|
|
25
|
+
overflow: visible;
|
|
26
|
+
word-wrap: break-word;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/*Show Grid record data*/
|
|
30
|
+
.app-grid-layout .form-group {
|
|
31
|
+
display: block !important;
|
|
32
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// This file can be replaced during build by using the `fileReplacements` array.
|
|
2
|
+
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
|
|
3
|
+
// The list of file replacements can be found in `angular.json`.
|
|
4
|
+
|
|
5
|
+
export const environment = {
|
|
6
|
+
production: false
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* For easier debugging in development mode, you can import the following file
|
|
11
|
+
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
|
|
12
|
+
*
|
|
13
|
+
* This import should be commented out in production mode because it will have a negative impact
|
|
14
|
+
* on performance if an error is thrown.
|
|
15
|
+
*/
|
|
16
|
+
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
import { AppExtensionProvider } from '@wm/runtime/base';
|
|
4
|
+
|
|
5
|
+
declare const WM_CUSTOM_FORMATTERS;
|
|
6
|
+
@Injectable({
|
|
7
|
+
providedIn: 'root'
|
|
8
|
+
})
|
|
9
|
+
export class AppExtensionProviderService extends AppExtensionProvider {
|
|
10
|
+
|
|
11
|
+
public loadFormatterConfigScript(callback:Function):void {
|
|
12
|
+
try{
|
|
13
|
+
callback(WM_CUSTOM_FORMATTERS);
|
|
14
|
+
|
|
15
|
+
}catch(e){
|
|
16
|
+
console.warn('Error while loading the formatters.js file');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -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
|
+
}
|