@wavemaker/angular-codegen 11.0.1-next.138729 → 11.0.1-next.138732

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. angular-codegen/angular-app/build-scripts/post-build.js +30 -50
  2. angular-codegen/angular-app/package-lock.json +252 -24494
  3. angular-codegen/angular-app/package.json +1 -1
  4. angular-codegen/angular-app/src/assets/styles/css/wm-style.css +1 -1
  5. angular-codegen/dependencies/app.component.html +22 -0
  6. angular-codegen/dependencies/expression-parser.cjs.js +17809 -0
  7. angular-codegen/dependencies/pipe-provider.cjs.js +69090 -0
  8. angular-codegen/dependencies/transpilation-mobile.cjs.js +557 -381
  9. angular-codegen/dependencies/transpilation-web.cjs.js +557 -381
  10. angular-codegen/package-lock.json +18 -5488
  11. angular-codegen/package.json +1 -1
  12. angular-codegen/src/codegen-args-cli.js +1 -1
  13. angular-codegen/src/codegen-cli.js +1 -1
  14. angular-codegen/src/codegen.js +1 -1
  15. angular-codegen/src/expr-parser-utils.js +1 -0
  16. angular-codegen/src/gen-app-skeleton.js +1 -1
  17. angular-codegen/src/gen-app-variables.js +1 -1
  18. angular-codegen/src/gen-components.js +1 -1
  19. angular-codegen/src/gen-layouts.js +1 -0
  20. angular-codegen/src/handlebar-helpers.js +1 -1
  21. angular-codegen/src/pages-util.js +1 -1
  22. angular-codegen/src/wm-utils.js +1 -1
  23. angular-codegen/templates/app-routes.ts.hbs +1 -1
  24. angular-codegen/templates/app.component.script.js.hbs +6 -1
  25. angular-codegen/templates/component.expressions.ts.hbs +3 -0
  26. angular-codegen/templates/expr-vs-fn.hbs +3 -0
  27. angular-codegen/templates/layout/layout.component.ts.hbs +4 -18
  28. angular-codegen/templates/layout/layout.module.ts.hbs +2 -4
  29. angular-codegen/templates/page/page.component.ts.hbs +9 -3
  30. angular-codegen/templates/partial/partial.component.ts.hbs +7 -0
  31. angular-codegen/templates/prefab/prefab.component.ts.hbs +7 -0
  32. angular-codegen/templates/layout/layout.component.script.js.hbs +0 -3
@@ -74,8 +74,8 @@ const setMobileProjectType = (angularJson) => {
74
74
  const addMobileSpecificStyles = async (deployUrl) => {
75
75
  if (isDevBuild) {
76
76
  $("body").append(
77
- `<script> const WMStylesPath ="${deployUrl}/wm-android-styles.js" </script>`
78
- )
77
+ `<script type="text/javascript" defer="true" src="${deployUrl}/wm-android-styles.js"></script>`
78
+ );
79
79
  }
80
80
 
81
81
  if (isProdBuild) {
@@ -92,40 +92,23 @@ const addMobileSpecificStyles = async (deployUrl) => {
92
92
  }
93
93
  }
94
94
 
95
- const addScriptForWMStylesPath = () => {
96
- // Add print css on load
97
- $("body").append(`<script>
98
- (function () {
99
- if (typeof WMStylesPath !== "undefined") {
100
- let styleType = WMStylesPath.split(".").pop();
101
- let styleNode;
102
- if(styleType==="css"){
103
- styleNode = document.createElement("link");
104
- styleNode.type = "text/css";
105
- styleNode.rel = "stylesheet";
106
- styleNode.href = WMStylesPath;
107
- }
108
- else if(styleType==="js"){
109
- styleNode = document.createElement("script");
110
- styleNode.type = "text/javascript";
111
- styleNode.src = WMStylesPath;
112
- styleNode.defer = true;
113
- }
114
-
115
- styleNode && document
116
- .getElementsByTagName("head")[0]
117
- .appendChild(styleNode);
118
- }
119
- })()
120
- window.onload = function() {
121
- var printCssNode = document.createElement('link');
122
- printCssNode.type = 'text/css';
123
- printCssNode.rel = 'stylesheet';
124
- printCssNode.href = 'print.css';
125
- printCssNode.media = 'print';
126
- document.getElementsByTagName("head")[0].appendChild(printCssNode);
127
- }
128
- </script>`);
95
+ const addScriptForWMStylesPath = (wm_styles_path) => {
96
+ // wm_styles_path will not be present for mobile apps
97
+ if (wm_styles_path) {
98
+ let styleType = wm_styles_path.split(".").pop();
99
+ if(styleType==="css"){
100
+ $("head").append(
101
+ `<link rel="stylesheet" type="text/css" href="${wm_styles_path}"/>`
102
+ );
103
+ } else {
104
+ $("body").append(
105
+ `<script type="text/javascript" defer="true" src="${wm_styles_path}"></script>`
106
+ );
107
+ }
108
+ }
109
+ $("head").append(
110
+ `<link rel="stylesheet" type="text/css" media="print" href="print.css"/>`
111
+ );
129
112
  }
130
113
 
131
114
  /**
@@ -155,9 +138,9 @@ const SKIP_UPDATE = ['index.html', 'manifest.json'];
155
138
  /**
156
139
  * Checks if a file's name has been changed during the build process
157
140
  * and if changed, returns an updated file path.
158
- *
141
+ *
159
142
  * @param {string} deployUrl deployment url
160
- * @param {string} url an absolute url to check if its filename has changed
143
+ * @param {string} url an absolute url to check if its filename has changed
161
144
  * @param {object} updatedFileNames a map from old filenames to new filenames
162
145
  * @returns {string} an updated file path
163
146
  */
@@ -176,8 +159,8 @@ const getUpdatedFileName = (deployUrl, url, updatedFileNames) => {
176
159
  /**
177
160
  * Checks if a file's content has been changed during the build process
178
161
  * and if changed, returns a new hash to be updated in ngsw.json
179
- *
180
- * @param {string} url an absolute url to check if its filename has changed
162
+ *
163
+ * @param {string} url an absolute url to check if its filename has changed
181
164
  * @param {object} updatedFileHashes a map from filenames to file hashes
182
165
  * @returns {string} an updated file hash
183
166
  */
@@ -191,7 +174,7 @@ const getUpdatedFileHashes = (url, oldHash, updatedFileHashes) => {
191
174
 
192
175
  /**
193
176
  * Get the path of the icon without '/ng-bundle'
194
- *
177
+ *
195
178
  * @param {string} iconPath path with '/ng-bundle'
196
179
  * @returns {string} path of the icon without '/ng-bundle'
197
180
  */
@@ -202,7 +185,7 @@ const getIconPath = (iconPath) => {
202
185
 
203
186
  /**
204
187
  * Updates name, location and content of PWA related assets.
205
- *
188
+ *
206
189
  * @param {string} deployUrl deployment url
207
190
  * @param {object} updatedFileNames a map from old filenames to new filenames
208
191
  * @returns {void}
@@ -245,7 +228,7 @@ const updatePwaAssets = (deployUrl, updatedFileNames, updatedFileHashes) => {
245
228
 
246
229
  /**
247
230
  * Generated sha1 hash for the content supplied.
248
- *
231
+ *
249
232
  * @param {string} content the content to be hashed
250
233
  * @returns {string} the hash value
251
234
  */
@@ -291,26 +274,23 @@ const generateSha1 = (content) => {
291
274
  const serviceWorkerEnabled = build['configurations']['production']['serviceWorker'];
292
275
  const updatedFilenames = {}
293
276
  const updatedFileHashes = {}
277
+ let wm_styles_path;
294
278
 
295
279
  if (isMobileProject) {
296
280
  await addMobileSpecificStyles(deployUrl);
297
281
  } else {
298
282
  if (isDevBuild) {
299
- $("head").append(
300
- `<script> const WMStylesPath = "${deployUrl}/wm-styles.js" </script>`
301
- )
283
+ wm_styles_path = `${deployUrl}/wm-styles.js`;
302
284
  } else {
303
285
  const fileName = 'wm-styles';
304
286
  const hash = await generateHash(`${opPath}/${fileName}.css`);
305
287
  copyCssFiles(hash, updatedFilenames);
306
288
  const updatedFileName = `${fileName}.${hash}.css`
307
- $("head").append(
308
- `<script> const WMStylesPath = "${deployUrl}/${updatedFileName}" </script>`
309
- );
289
+ wm_styles_path = `${deployUrl}/${updatedFileName}`;
310
290
  }
311
291
  }
312
292
 
313
- addScriptForWMStylesPath();
293
+ addScriptForWMStylesPath(wm_styles_path);
314
294
  const htmlContent = $.html();
315
295
  await writeFile(`./dist/index.html`, htmlContent);
316
296