@wavemaker/angular-codegen 11.0.1-next.139247 → 11.0.1-next.139251
Sign up to get free protection for your applications and to get access to all the features.
- angular-codegen/angular-app/build-scripts/post-build.js +27 -50
- angular-codegen/angular-app/package.json +1 -1
- angular-codegen/dependencies/app.component.html +22 -0
- angular-codegen/dependencies/expression-parser.cjs.js +92 -43
- angular-codegen/dependencies/pipe-provider.cjs.js +109 -52
- angular-codegen/dependencies/transpilation-mobile.cjs.js +111 -54
- angular-codegen/dependencies/transpilation-web.cjs.js +111 -54
- angular-codegen/package.json +1 -1
- angular-codegen/src/expr-parser-utils.js +1 -1
- angular-codegen/src/gen-app-variables.js +1 -1
@@ -74,8 +74,8 @@ const setMobileProjectType = (angularJson) => {
|
|
74
74
|
const addMobileSpecificStyles = async (deployUrl) => {
|
75
75
|
if (isDevBuild) {
|
76
76
|
$("body").append(
|
77
|
-
`<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,20 @@ const addMobileSpecificStyles = async (deployUrl) => {
|
|
92
92
|
}
|
93
93
|
}
|
94
94
|
|
95
|
-
const addScriptForWMStylesPath = () => {
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
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
|
+
let styleType = wm_styles_path.split(".").pop();
|
97
|
+
if(styleType==="css"){
|
98
|
+
$("head").append(
|
99
|
+
`<link rel="stylesheet" type="text/css" href="${wm_styles_path}"/>`
|
100
|
+
);
|
101
|
+
} else {
|
102
|
+
$("body").append(
|
103
|
+
`<script type="text/javascript" defer="true" src="${wm_styles_path}"></script>`
|
104
|
+
);
|
105
|
+
}
|
106
|
+
$("head").append(
|
107
|
+
`<link rel="stylesheet" type="text/css" media="print" href="print.css"/>`
|
108
|
+
);
|
129
109
|
}
|
130
110
|
|
131
111
|
/**
|
@@ -155,9 +135,9 @@ const SKIP_UPDATE = ['index.html', 'manifest.json'];
|
|
155
135
|
/**
|
156
136
|
* Checks if a file's name has been changed during the build process
|
157
137
|
* and if changed, returns an updated file path.
|
158
|
-
*
|
138
|
+
*
|
159
139
|
* @param {string} deployUrl deployment url
|
160
|
-
* @param {string} url an absolute url to check if its filename has changed
|
140
|
+
* @param {string} url an absolute url to check if its filename has changed
|
161
141
|
* @param {object} updatedFileNames a map from old filenames to new filenames
|
162
142
|
* @returns {string} an updated file path
|
163
143
|
*/
|
@@ -176,8 +156,8 @@ const getUpdatedFileName = (deployUrl, url, updatedFileNames) => {
|
|
176
156
|
/**
|
177
157
|
* Checks if a file's content has been changed during the build process
|
178
158
|
* 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
|
159
|
+
*
|
160
|
+
* @param {string} url an absolute url to check if its filename has changed
|
181
161
|
* @param {object} updatedFileHashes a map from filenames to file hashes
|
182
162
|
* @returns {string} an updated file hash
|
183
163
|
*/
|
@@ -191,7 +171,7 @@ const getUpdatedFileHashes = (url, oldHash, updatedFileHashes) => {
|
|
191
171
|
|
192
172
|
/**
|
193
173
|
* Get the path of the icon without '/ng-bundle'
|
194
|
-
*
|
174
|
+
*
|
195
175
|
* @param {string} iconPath path with '/ng-bundle'
|
196
176
|
* @returns {string} path of the icon without '/ng-bundle'
|
197
177
|
*/
|
@@ -202,7 +182,7 @@ const getIconPath = (iconPath) => {
|
|
202
182
|
|
203
183
|
/**
|
204
184
|
* Updates name, location and content of PWA related assets.
|
205
|
-
*
|
185
|
+
*
|
206
186
|
* @param {string} deployUrl deployment url
|
207
187
|
* @param {object} updatedFileNames a map from old filenames to new filenames
|
208
188
|
* @returns {void}
|
@@ -245,7 +225,7 @@ const updatePwaAssets = (deployUrl, updatedFileNames, updatedFileHashes) => {
|
|
245
225
|
|
246
226
|
/**
|
247
227
|
* Generated sha1 hash for the content supplied.
|
248
|
-
*
|
228
|
+
*
|
249
229
|
* @param {string} content the content to be hashed
|
250
230
|
* @returns {string} the hash value
|
251
231
|
*/
|
@@ -291,26 +271,23 @@ const generateSha1 = (content) => {
|
|
291
271
|
const serviceWorkerEnabled = build['configurations']['production']['serviceWorker'];
|
292
272
|
const updatedFilenames = {}
|
293
273
|
const updatedFileHashes = {}
|
274
|
+
let wm_styles_path;
|
294
275
|
|
295
276
|
if (isMobileProject) {
|
296
277
|
await addMobileSpecificStyles(deployUrl);
|
297
278
|
} else {
|
298
279
|
if (isDevBuild) {
|
299
|
-
|
300
|
-
`<script> const WMStylesPath = "${deployUrl}/wm-styles.js" </script>`
|
301
|
-
)
|
280
|
+
wm_styles_path = `${deployUrl}/wm-styles.js`;
|
302
281
|
} else {
|
303
282
|
const fileName = 'wm-styles';
|
304
283
|
const hash = await generateHash(`${opPath}/${fileName}.css`);
|
305
284
|
copyCssFiles(hash, updatedFilenames);
|
306
285
|
const updatedFileName = `${fileName}.${hash}.css`
|
307
|
-
|
308
|
-
`<script> const WMStylesPath = "${deployUrl}/${updatedFileName}" </script>`
|
309
|
-
);
|
286
|
+
wm_styles_path = `${deployUrl}/${updatedFileName}`;
|
310
287
|
}
|
311
288
|
}
|
312
289
|
|
313
|
-
addScriptForWMStylesPath();
|
290
|
+
addScriptForWMStylesPath(wm_styles_path);
|
314
291
|
const htmlContent = $.html();
|
315
292
|
await writeFile(`./dist/index.html`, htmlContent);
|
316
293
|
|
@@ -68,7 +68,7 @@
|
|
68
68
|
"tslib": "^2.0.0",
|
69
69
|
"x2js": "3.2.6",
|
70
70
|
"zone.js": "~0.10.3",
|
71
|
-
"@wavemaker/app-ng-runtime": "11.0.1-next.
|
71
|
+
"@wavemaker/app-ng-runtime": "11.0.1-next.139251"
|
72
72
|
},
|
73
73
|
"devDependencies": {
|
74
74
|
"@ampproject/rollup-plugin-closure-compiler": "0.8.5",
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<ng-container *ngIf="startApp">
|
2
|
+
<router-outlet></router-outlet>
|
3
|
+
<div wmContainer partialContainer content="Common" hidden class="ng-hide" *ngIf="isApplicationType"></div>
|
4
|
+
<app-spinner name="globalspinner" classname="global-spinner" role="alert" aria-live="assertive" [attr.aria-label]="spinner.arialabel || 'Loading'" [show]="spinner.show" [spinnermessages]="spinner.messages"></app-spinner>
|
5
|
+
<div wmDialog name="oAuthLoginDialog" title="Application is requesting you to sign in with"
|
6
|
+
close.event="closeOAuthDialog()">
|
7
|
+
<ng-template #dialogBody>
|
8
|
+
<ul class="list-items">
|
9
|
+
<li class="list-item" *ngFor="let provider of providersConfig">
|
10
|
+
<button class="btn" (click)="provider.invoke()">{{provider.name}}</button>
|
11
|
+
</li>
|
12
|
+
</ul>
|
13
|
+
</ng-template>
|
14
|
+
</div>
|
15
|
+
<div wmConfirmDialog name="_app-confirm-dialog" title.bind="title" message.bind="message" oktext.bind="oktext"
|
16
|
+
canceltext.bind="canceltext" closable="false" iconclass.bind="iconclass"
|
17
|
+
escape.event="onEscape()" ok.event="onOk()" cancel.event="onCancel()" close.event="onClose()" opened.event="onOpen()"></div>
|
18
|
+
<div wmAppExt></div>
|
19
|
+
<i id="wm-mobile-display"></i>
|
20
|
+
</ng-container>
|
21
|
+
<!--Dummy container to create the component dynamically-->
|
22
|
+
<ng-container #dynamicComponent></ng-container>
|
@@ -17570,6 +17570,21 @@ const nullPipe = () => {
|
|
17570
17570
|
};
|
17571
17571
|
};
|
17572
17572
|
const ɵ10 = nullPipe;
|
17573
|
+
let _cspEnabled;
|
17574
|
+
const isCSPEnabled = () => {
|
17575
|
+
if (typeof _cspEnabled !== 'undefined') {
|
17576
|
+
return _cspEnabled;
|
17577
|
+
}
|
17578
|
+
try {
|
17579
|
+
new Function();
|
17580
|
+
_cspEnabled = false;
|
17581
|
+
}
|
17582
|
+
catch (e) {
|
17583
|
+
_cspEnabled = true;
|
17584
|
+
}
|
17585
|
+
return _cspEnabled;
|
17586
|
+
};
|
17587
|
+
const ɵ11 = isCSPEnabled;
|
17573
17588
|
let pipeProvider;
|
17574
17589
|
function setPipeProvider(_pipeProvider) {
|
17575
17590
|
pipeProvider = _pipeProvider;
|
@@ -17604,53 +17619,82 @@ function $parseExpr(expr, defOnly) {
|
|
17604
17619
|
}
|
17605
17620
|
// fallback to generate function in runtime. This will break if CSP is enabled
|
17606
17621
|
if (!boundFn) {
|
17607
|
-
|
17608
|
-
|
17609
|
-
if (
|
17610
|
-
|
17611
|
-
|
17622
|
+
// If CSP enabled, function def not found from the generated fn expressions for the page.
|
17623
|
+
// Handle bind expressions used internally inside WM components. e.g. wmAnchor used inside nav.comp.html
|
17624
|
+
if (isCSPEnabled()) {
|
17625
|
+
boundFn = function (ctx, locals) {
|
17626
|
+
// handle internal bindings for wm widgets used inside a component
|
17627
|
+
let _ctx = Object.assign({}, locals);
|
17628
|
+
Object.setPrototypeOf(_ctx, ctx);
|
17629
|
+
return _.get(_ctx, expr);
|
17630
|
+
};
|
17612
17631
|
}
|
17613
17632
|
else {
|
17614
|
-
const
|
17615
|
-
const
|
17616
|
-
|
17617
|
-
|
17618
|
-
|
17619
|
-
}
|
17620
|
-
|
17621
|
-
const
|
17622
|
-
|
17623
|
-
|
17624
|
-
|
17625
|
-
|
17626
|
-
|
17627
|
-
|
17628
|
-
|
17629
|
-
|
17630
|
-
|
17631
|
-
|
17632
|
-
|
17633
|
-
|
17634
|
-
|
17635
|
-
pipeInstance = pipeProvider.getInstance(pipeName);
|
17633
|
+
const parser = new Parser$1(new Lexer);
|
17634
|
+
const ast = parser.parseBinding(expr, '', 0);
|
17635
|
+
if (ast.errors.length) {
|
17636
|
+
fn = noop;
|
17637
|
+
boundFn = fn;
|
17638
|
+
}
|
17639
|
+
else {
|
17640
|
+
const pipeNameVsIsPureMap = pipeProvider.getPipeNameVsIsPureMap();
|
17641
|
+
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Binding, pipeNameVsIsPureMap);
|
17642
|
+
fn = astCompiler.compile(defOnly);
|
17643
|
+
if (defOnly) {
|
17644
|
+
return fn;
|
17645
|
+
}
|
17646
|
+
if (fn.usedPipes.length) {
|
17647
|
+
const pipeArgs = [];
|
17648
|
+
let hasPurePipe = false;
|
17649
|
+
for (const [pipeName] of fn.usedPipes) {
|
17650
|
+
const pipeInfo = pipeProvider.meta(pipeName);
|
17651
|
+
let pipeInstance;
|
17652
|
+
if (!pipeInfo) {
|
17653
|
+
pipeInstance = nullPipe;
|
17636
17654
|
}
|
17637
|
-
|
17638
|
-
|
17655
|
+
else {
|
17656
|
+
if (pipeInfo.pure) {
|
17657
|
+
hasPurePipe = true;
|
17658
|
+
pipeInstance = purePipes.get(pipeName);
|
17659
|
+
}
|
17660
|
+
if (!pipeInstance) {
|
17661
|
+
pipeInstance = pipeProvider.getInstance(pipeName);
|
17662
|
+
}
|
17663
|
+
if (pipeInfo.pure) {
|
17664
|
+
purePipes.set(pipeName, pipeInstance);
|
17665
|
+
}
|
17639
17666
|
}
|
17667
|
+
pipeArgs.push(pipeInstance);
|
17640
17668
|
}
|
17641
|
-
pipeArgs.
|
17669
|
+
pipeArgs.unshift(hasPurePipe ? new Map() : undefined);
|
17670
|
+
boundFn = fn.bind(undefined, ...pipeArgs);
|
17671
|
+
}
|
17672
|
+
else {
|
17673
|
+
boundFn = fn.bind(undefined, undefined);
|
17642
17674
|
}
|
17643
|
-
pipeArgs.unshift(hasPurePipe ? new Map() : undefined);
|
17644
|
-
boundFn = fn.bind(undefined, ...pipeArgs);
|
17645
|
-
}
|
17646
|
-
else {
|
17647
|
-
boundFn = fn.bind(undefined, undefined);
|
17648
17675
|
}
|
17649
17676
|
}
|
17650
17677
|
}
|
17651
17678
|
exprFnCache.set(expr, boundFn);
|
17652
17679
|
return boundFn;
|
17653
17680
|
}
|
17681
|
+
function simpleFunctionEvaluator(expr, ctx, locals) {
|
17682
|
+
let _ctx = Object.assign({}, locals);
|
17683
|
+
Object.setPrototypeOf(_ctx, ctx);
|
17684
|
+
let parts = expr.split('(');
|
17685
|
+
let fnName = parts[0];
|
17686
|
+
let computedFn = _.get(ctx, fnName);
|
17687
|
+
if (computedFn) {
|
17688
|
+
let args = parts[1].replace(')', '');
|
17689
|
+
args = args.split(',');
|
17690
|
+
let computedArgs = [];
|
17691
|
+
args.forEach((arg) => {
|
17692
|
+
arg = arg && arg.trim();
|
17693
|
+
computedArgs.push(_.get(_ctx, arg));
|
17694
|
+
});
|
17695
|
+
return computedFn.bind(_ctx)(...computedArgs);
|
17696
|
+
}
|
17697
|
+
}
|
17654
17698
|
function $parseEvent(expr, defOnly) {
|
17655
17699
|
if (!isString(expr)) {
|
17656
17700
|
return noop;
|
@@ -17668,20 +17712,24 @@ function $parseEvent(expr, defOnly) {
|
|
17668
17712
|
}
|
17669
17713
|
// fallback to generate function in runtime. This will break if CSP is enabled
|
17670
17714
|
if (!fn) {
|
17671
|
-
|
17672
|
-
|
17673
|
-
|
17674
|
-
|
17715
|
+
if (isCSPEnabled()) {
|
17716
|
+
fn = simpleFunctionEvaluator.bind(undefined, expr);
|
17717
|
+
}
|
17718
|
+
else {
|
17719
|
+
const parser = new Parser$1(new Lexer);
|
17720
|
+
const ast = parser.parseAction(expr, '', 0);
|
17721
|
+
if (ast.errors.length) {
|
17722
|
+
return noop;
|
17723
|
+
}
|
17724
|
+
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Action);
|
17725
|
+
fn = astCompiler.compile(defOnly);
|
17675
17726
|
}
|
17676
|
-
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Action);
|
17677
|
-
fn = astCompiler.compile(defOnly);
|
17678
17727
|
}
|
17679
17728
|
eventFnCache.set(expr, fn);
|
17680
17729
|
return fn;
|
17681
17730
|
}
|
17682
17731
|
const fnNameMap = new Map();
|
17683
17732
|
const registerFnByExpr = (expr, fn, usedPipes) => {
|
17684
|
-
console.log('registering function for: ', expr);
|
17685
17733
|
fn.usedPipes = usedPipes || [];
|
17686
17734
|
fnNameMap.set(expr, fn);
|
17687
17735
|
};
|
@@ -17732,7 +17780,7 @@ const fnExecutor = (expr, exprType) => {
|
|
17732
17780
|
}
|
17733
17781
|
return fn;
|
17734
17782
|
};
|
17735
|
-
const ɵ
|
17783
|
+
const ɵ12 = fnExecutor;
|
17736
17784
|
const getFnForBindExpr = (expr) => {
|
17737
17785
|
return fnExecutor(expr, ExpressionType$1.Binding);
|
17738
17786
|
};
|
@@ -17759,3 +17807,4 @@ exports.ɵ8 = ɵ8;
|
|
17759
17807
|
exports.ɵ9 = ɵ9;
|
17760
17808
|
exports.ɵ10 = ɵ10;
|
17761
17809
|
exports.ɵ11 = ɵ11;
|
17810
|
+
exports.ɵ12 = ɵ12;
|
@@ -42658,6 +42658,20 @@ const nullPipe = () => {
|
|
42658
42658
|
transform: noop$1$1
|
42659
42659
|
};
|
42660
42660
|
};
|
42661
|
+
let _cspEnabled;
|
42662
|
+
const isCSPEnabled = () => {
|
42663
|
+
if (typeof _cspEnabled !== 'undefined') {
|
42664
|
+
return _cspEnabled;
|
42665
|
+
}
|
42666
|
+
try {
|
42667
|
+
new Function();
|
42668
|
+
_cspEnabled = false;
|
42669
|
+
}
|
42670
|
+
catch (e) {
|
42671
|
+
_cspEnabled = true;
|
42672
|
+
}
|
42673
|
+
return _cspEnabled;
|
42674
|
+
};
|
42661
42675
|
let pipeProvider;
|
42662
42676
|
var ExpressionType$1;
|
42663
42677
|
(function (ExpressionType$$1) {
|
@@ -42689,53 +42703,82 @@ function $parseExpr(expr, defOnly) {
|
|
42689
42703
|
}
|
42690
42704
|
// fallback to generate function in runtime. This will break if CSP is enabled
|
42691
42705
|
if (!boundFn) {
|
42692
|
-
|
42693
|
-
|
42694
|
-
if (
|
42695
|
-
|
42696
|
-
|
42706
|
+
// If CSP enabled, function def not found from the generated fn expressions for the page.
|
42707
|
+
// Handle bind expressions used internally inside WM components. e.g. wmAnchor used inside nav.comp.html
|
42708
|
+
if (isCSPEnabled()) {
|
42709
|
+
boundFn = function (ctx, locals) {
|
42710
|
+
// handle internal bindings for wm widgets used inside a component
|
42711
|
+
let _ctx = Object.assign({}, locals);
|
42712
|
+
Object.setPrototypeOf(_ctx, ctx);
|
42713
|
+
return _.get(_ctx, expr);
|
42714
|
+
};
|
42697
42715
|
}
|
42698
42716
|
else {
|
42699
|
-
const
|
42700
|
-
const
|
42701
|
-
|
42702
|
-
|
42703
|
-
|
42704
|
-
}
|
42705
|
-
|
42706
|
-
const
|
42707
|
-
|
42708
|
-
|
42709
|
-
|
42710
|
-
|
42711
|
-
|
42712
|
-
|
42713
|
-
|
42714
|
-
|
42715
|
-
|
42716
|
-
|
42717
|
-
|
42718
|
-
|
42719
|
-
|
42720
|
-
pipeInstance = pipeProvider.getInstance(pipeName);
|
42717
|
+
const parser = new Parser$1(new Lexer);
|
42718
|
+
const ast = parser.parseBinding(expr, '', 0);
|
42719
|
+
if (ast.errors.length) {
|
42720
|
+
fn = noop$1$1;
|
42721
|
+
boundFn = fn;
|
42722
|
+
}
|
42723
|
+
else {
|
42724
|
+
const pipeNameVsIsPureMap = pipeProvider.getPipeNameVsIsPureMap();
|
42725
|
+
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Binding, pipeNameVsIsPureMap);
|
42726
|
+
fn = astCompiler.compile(defOnly);
|
42727
|
+
if (defOnly) {
|
42728
|
+
return fn;
|
42729
|
+
}
|
42730
|
+
if (fn.usedPipes.length) {
|
42731
|
+
const pipeArgs = [];
|
42732
|
+
let hasPurePipe = false;
|
42733
|
+
for (const [pipeName] of fn.usedPipes) {
|
42734
|
+
const pipeInfo = pipeProvider.meta(pipeName);
|
42735
|
+
let pipeInstance;
|
42736
|
+
if (!pipeInfo) {
|
42737
|
+
pipeInstance = nullPipe;
|
42721
42738
|
}
|
42722
|
-
|
42723
|
-
|
42739
|
+
else {
|
42740
|
+
if (pipeInfo.pure) {
|
42741
|
+
hasPurePipe = true;
|
42742
|
+
pipeInstance = purePipes.get(pipeName);
|
42743
|
+
}
|
42744
|
+
if (!pipeInstance) {
|
42745
|
+
pipeInstance = pipeProvider.getInstance(pipeName);
|
42746
|
+
}
|
42747
|
+
if (pipeInfo.pure) {
|
42748
|
+
purePipes.set(pipeName, pipeInstance);
|
42749
|
+
}
|
42724
42750
|
}
|
42751
|
+
pipeArgs.push(pipeInstance);
|
42725
42752
|
}
|
42726
|
-
pipeArgs.
|
42753
|
+
pipeArgs.unshift(hasPurePipe ? new Map() : undefined);
|
42754
|
+
boundFn = fn.bind(undefined, ...pipeArgs);
|
42755
|
+
}
|
42756
|
+
else {
|
42757
|
+
boundFn = fn.bind(undefined, undefined);
|
42727
42758
|
}
|
42728
|
-
pipeArgs.unshift(hasPurePipe ? new Map() : undefined);
|
42729
|
-
boundFn = fn.bind(undefined, ...pipeArgs);
|
42730
|
-
}
|
42731
|
-
else {
|
42732
|
-
boundFn = fn.bind(undefined, undefined);
|
42733
42759
|
}
|
42734
42760
|
}
|
42735
42761
|
}
|
42736
42762
|
exprFnCache.set(expr, boundFn);
|
42737
42763
|
return boundFn;
|
42738
42764
|
}
|
42765
|
+
function simpleFunctionEvaluator(expr, ctx, locals) {
|
42766
|
+
let _ctx = Object.assign({}, locals);
|
42767
|
+
Object.setPrototypeOf(_ctx, ctx);
|
42768
|
+
let parts = expr.split('(');
|
42769
|
+
let fnName = parts[0];
|
42770
|
+
let computedFn = _.get(ctx, fnName);
|
42771
|
+
if (computedFn) {
|
42772
|
+
let args = parts[1].replace(')', '');
|
42773
|
+
args = args.split(',');
|
42774
|
+
let computedArgs = [];
|
42775
|
+
args.forEach((arg) => {
|
42776
|
+
arg = arg && arg.trim();
|
42777
|
+
computedArgs.push(_.get(_ctx, arg));
|
42778
|
+
});
|
42779
|
+
return computedFn.bind(_ctx)(...computedArgs);
|
42780
|
+
}
|
42781
|
+
}
|
42739
42782
|
function $parseEvent(expr, defOnly) {
|
42740
42783
|
if (!isString$1(expr)) {
|
42741
42784
|
return noop$1$1;
|
@@ -42753,13 +42796,18 @@ function $parseEvent(expr, defOnly) {
|
|
42753
42796
|
}
|
42754
42797
|
// fallback to generate function in runtime. This will break if CSP is enabled
|
42755
42798
|
if (!fn) {
|
42756
|
-
|
42757
|
-
|
42758
|
-
|
42759
|
-
|
42799
|
+
if (isCSPEnabled()) {
|
42800
|
+
fn = simpleFunctionEvaluator.bind(undefined, expr);
|
42801
|
+
}
|
42802
|
+
else {
|
42803
|
+
const parser = new Parser$1(new Lexer);
|
42804
|
+
const ast = parser.parseAction(expr, '', 0);
|
42805
|
+
if (ast.errors.length) {
|
42806
|
+
return noop$1$1;
|
42807
|
+
}
|
42808
|
+
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Action);
|
42809
|
+
fn = astCompiler.compile(defOnly);
|
42760
42810
|
}
|
42761
|
-
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Action);
|
42762
|
-
fn = astCompiler.compile(defOnly);
|
42763
42811
|
}
|
42764
42812
|
eventFnCache.set(expr, fn);
|
42765
42813
|
return fn;
|
@@ -43657,10 +43705,26 @@ const loadScript = (url, loadViaScriptTag, cacheable = false) => __awaiter$1(voi
|
|
43657
43705
|
return Promise.resolve();
|
43658
43706
|
}
|
43659
43707
|
if (loadViaScriptTag) {
|
43660
|
-
return
|
43661
|
-
|
43662
|
-
script.
|
43663
|
-
|
43708
|
+
return new Promise((resolve, reject) => {
|
43709
|
+
let script = document.createElement('script');
|
43710
|
+
script.type = 'text/javascript';
|
43711
|
+
script.src = _url;
|
43712
|
+
script.async = false;
|
43713
|
+
if (script.readyState) { //IE
|
43714
|
+
script.onreadystatechange = () => {
|
43715
|
+
if (script.readyState === "loaded" || script.readyState === "complete") {
|
43716
|
+
script.onreadystatechange = null;
|
43717
|
+
resolve(true);
|
43718
|
+
}
|
43719
|
+
};
|
43720
|
+
}
|
43721
|
+
else { //Other browsers
|
43722
|
+
script.onload = () => {
|
43723
|
+
resolve(true);
|
43724
|
+
};
|
43725
|
+
}
|
43726
|
+
script.onerror = (error) => reject(error);
|
43727
|
+
document.getElementsByTagName('head')[0].appendChild(script);
|
43664
43728
|
});
|
43665
43729
|
}
|
43666
43730
|
else if (cacheable) {
|
@@ -43676,13 +43740,6 @@ const loadScript = (url, loadViaScriptTag, cacheable = false) => __awaiter$1(voi
|
|
43676
43740
|
.done(response => response)
|
43677
43741
|
.fail(reason => reason);
|
43678
43742
|
}
|
43679
|
-
// return fetch(_url)
|
43680
|
-
// .then(response => response.text())
|
43681
|
-
// .then(text => {
|
43682
|
-
// const script = document.createElement('script');
|
43683
|
-
// script.textContent = text;
|
43684
|
-
// document.head.appendChild(script);
|
43685
|
-
// });
|
43686
43743
|
});
|
43687
43744
|
const loadScripts = (urls = [], loadViaScriptTag = true) => __awaiter$1(void 0, void 0, void 0, function* () {
|
43688
43745
|
for (const url of urls) {
|
@@ -38646,6 +38646,20 @@ const nullPipe = () => {
|
|
38646
38646
|
transform: noop$1$1
|
38647
38647
|
};
|
38648
38648
|
};
|
38649
|
+
let _cspEnabled;
|
38650
|
+
const isCSPEnabled = () => {
|
38651
|
+
if (typeof _cspEnabled !== 'undefined') {
|
38652
|
+
return _cspEnabled;
|
38653
|
+
}
|
38654
|
+
try {
|
38655
|
+
new Function();
|
38656
|
+
_cspEnabled = false;
|
38657
|
+
}
|
38658
|
+
catch (e) {
|
38659
|
+
_cspEnabled = true;
|
38660
|
+
}
|
38661
|
+
return _cspEnabled;
|
38662
|
+
};
|
38649
38663
|
let pipeProvider;
|
38650
38664
|
var ExpressionType$1;
|
38651
38665
|
(function (ExpressionType$$1) {
|
@@ -38677,53 +38691,82 @@ function $parseExpr(expr, defOnly) {
|
|
38677
38691
|
}
|
38678
38692
|
// fallback to generate function in runtime. This will break if CSP is enabled
|
38679
38693
|
if (!boundFn) {
|
38680
|
-
|
38681
|
-
|
38682
|
-
if (
|
38683
|
-
|
38684
|
-
|
38694
|
+
// If CSP enabled, function def not found from the generated fn expressions for the page.
|
38695
|
+
// Handle bind expressions used internally inside WM components. e.g. wmAnchor used inside nav.comp.html
|
38696
|
+
if (isCSPEnabled()) {
|
38697
|
+
boundFn = function (ctx, locals) {
|
38698
|
+
// handle internal bindings for wm widgets used inside a component
|
38699
|
+
let _ctx = Object.assign({}, locals);
|
38700
|
+
Object.setPrototypeOf(_ctx, ctx);
|
38701
|
+
return _.get(_ctx, expr);
|
38702
|
+
};
|
38685
38703
|
}
|
38686
38704
|
else {
|
38687
|
-
const
|
38688
|
-
const
|
38689
|
-
|
38690
|
-
|
38691
|
-
|
38692
|
-
}
|
38693
|
-
|
38694
|
-
const
|
38695
|
-
|
38696
|
-
|
38697
|
-
|
38698
|
-
|
38699
|
-
|
38700
|
-
|
38701
|
-
|
38702
|
-
|
38703
|
-
|
38704
|
-
|
38705
|
-
|
38706
|
-
|
38707
|
-
|
38708
|
-
pipeInstance = pipeProvider.getInstance(pipeName);
|
38705
|
+
const parser = new Parser$1(new Lexer);
|
38706
|
+
const ast = parser.parseBinding(expr, '', 0);
|
38707
|
+
if (ast.errors.length) {
|
38708
|
+
fn = noop$1$1;
|
38709
|
+
boundFn = fn;
|
38710
|
+
}
|
38711
|
+
else {
|
38712
|
+
const pipeNameVsIsPureMap = pipeProvider.getPipeNameVsIsPureMap();
|
38713
|
+
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Binding, pipeNameVsIsPureMap);
|
38714
|
+
fn = astCompiler.compile(defOnly);
|
38715
|
+
if (defOnly) {
|
38716
|
+
return fn;
|
38717
|
+
}
|
38718
|
+
if (fn.usedPipes.length) {
|
38719
|
+
const pipeArgs = [];
|
38720
|
+
let hasPurePipe = false;
|
38721
|
+
for (const [pipeName] of fn.usedPipes) {
|
38722
|
+
const pipeInfo = pipeProvider.meta(pipeName);
|
38723
|
+
let pipeInstance;
|
38724
|
+
if (!pipeInfo) {
|
38725
|
+
pipeInstance = nullPipe;
|
38709
38726
|
}
|
38710
|
-
|
38711
|
-
|
38727
|
+
else {
|
38728
|
+
if (pipeInfo.pure) {
|
38729
|
+
hasPurePipe = true;
|
38730
|
+
pipeInstance = purePipes.get(pipeName);
|
38731
|
+
}
|
38732
|
+
if (!pipeInstance) {
|
38733
|
+
pipeInstance = pipeProvider.getInstance(pipeName);
|
38734
|
+
}
|
38735
|
+
if (pipeInfo.pure) {
|
38736
|
+
purePipes.set(pipeName, pipeInstance);
|
38737
|
+
}
|
38712
38738
|
}
|
38739
|
+
pipeArgs.push(pipeInstance);
|
38713
38740
|
}
|
38714
|
-
pipeArgs.
|
38741
|
+
pipeArgs.unshift(hasPurePipe ? new Map() : undefined);
|
38742
|
+
boundFn = fn.bind(undefined, ...pipeArgs);
|
38743
|
+
}
|
38744
|
+
else {
|
38745
|
+
boundFn = fn.bind(undefined, undefined);
|
38715
38746
|
}
|
38716
|
-
pipeArgs.unshift(hasPurePipe ? new Map() : undefined);
|
38717
|
-
boundFn = fn.bind(undefined, ...pipeArgs);
|
38718
|
-
}
|
38719
|
-
else {
|
38720
|
-
boundFn = fn.bind(undefined, undefined);
|
38721
38747
|
}
|
38722
38748
|
}
|
38723
38749
|
}
|
38724
38750
|
exprFnCache.set(expr, boundFn);
|
38725
38751
|
return boundFn;
|
38726
38752
|
}
|
38753
|
+
function simpleFunctionEvaluator(expr, ctx, locals) {
|
38754
|
+
let _ctx = Object.assign({}, locals);
|
38755
|
+
Object.setPrototypeOf(_ctx, ctx);
|
38756
|
+
let parts = expr.split('(');
|
38757
|
+
let fnName = parts[0];
|
38758
|
+
let computedFn = _.get(ctx, fnName);
|
38759
|
+
if (computedFn) {
|
38760
|
+
let args = parts[1].replace(')', '');
|
38761
|
+
args = args.split(',');
|
38762
|
+
let computedArgs = [];
|
38763
|
+
args.forEach((arg) => {
|
38764
|
+
arg = arg && arg.trim();
|
38765
|
+
computedArgs.push(_.get(_ctx, arg));
|
38766
|
+
});
|
38767
|
+
return computedFn.bind(_ctx)(...computedArgs);
|
38768
|
+
}
|
38769
|
+
}
|
38727
38770
|
function $parseEvent(expr, defOnly) {
|
38728
38771
|
if (!isString$1(expr)) {
|
38729
38772
|
return noop$1$1;
|
@@ -38741,13 +38784,18 @@ function $parseEvent(expr, defOnly) {
|
|
38741
38784
|
}
|
38742
38785
|
// fallback to generate function in runtime. This will break if CSP is enabled
|
38743
38786
|
if (!fn) {
|
38744
|
-
|
38745
|
-
|
38746
|
-
|
38747
|
-
|
38787
|
+
if (isCSPEnabled()) {
|
38788
|
+
fn = simpleFunctionEvaluator.bind(undefined, expr);
|
38789
|
+
}
|
38790
|
+
else {
|
38791
|
+
const parser = new Parser$1(new Lexer);
|
38792
|
+
const ast = parser.parseAction(expr, '', 0);
|
38793
|
+
if (ast.errors.length) {
|
38794
|
+
return noop$1$1;
|
38795
|
+
}
|
38796
|
+
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Action);
|
38797
|
+
fn = astCompiler.compile(defOnly);
|
38748
38798
|
}
|
38749
|
-
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Action);
|
38750
|
-
fn = astCompiler.compile(defOnly);
|
38751
38799
|
}
|
38752
38800
|
eventFnCache.set(expr, fn);
|
38753
38801
|
return fn;
|
@@ -39645,10 +39693,26 @@ const loadScript = (url, loadViaScriptTag, cacheable = false) => __awaiter$1(voi
|
|
39645
39693
|
return Promise.resolve();
|
39646
39694
|
}
|
39647
39695
|
if (loadViaScriptTag) {
|
39648
|
-
return
|
39649
|
-
|
39650
|
-
script.
|
39651
|
-
|
39696
|
+
return new Promise((resolve, reject) => {
|
39697
|
+
let script = document.createElement('script');
|
39698
|
+
script.type = 'text/javascript';
|
39699
|
+
script.src = _url;
|
39700
|
+
script.async = false;
|
39701
|
+
if (script.readyState) { //IE
|
39702
|
+
script.onreadystatechange = () => {
|
39703
|
+
if (script.readyState === "loaded" || script.readyState === "complete") {
|
39704
|
+
script.onreadystatechange = null;
|
39705
|
+
resolve(true);
|
39706
|
+
}
|
39707
|
+
};
|
39708
|
+
}
|
39709
|
+
else { //Other browsers
|
39710
|
+
script.onload = () => {
|
39711
|
+
resolve(true);
|
39712
|
+
};
|
39713
|
+
}
|
39714
|
+
script.onerror = (error) => reject(error);
|
39715
|
+
document.getElementsByTagName('head')[0].appendChild(script);
|
39652
39716
|
});
|
39653
39717
|
}
|
39654
39718
|
else if (cacheable) {
|
@@ -39664,13 +39728,6 @@ const loadScript = (url, loadViaScriptTag, cacheable = false) => __awaiter$1(voi
|
|
39664
39728
|
.done(response => response)
|
39665
39729
|
.fail(reason => reason);
|
39666
39730
|
}
|
39667
|
-
// return fetch(_url)
|
39668
|
-
// .then(response => response.text())
|
39669
|
-
// .then(text => {
|
39670
|
-
// const script = document.createElement('script');
|
39671
|
-
// script.textContent = text;
|
39672
|
-
// document.head.appendChild(script);
|
39673
|
-
// });
|
39674
39731
|
});
|
39675
39732
|
const loadScripts = (urls = [], loadViaScriptTag = true) => __awaiter$1(void 0, void 0, void 0, function* () {
|
39676
39733
|
for (const url of urls) {
|
@@ -41920,7 +41977,7 @@ const setDimensionProp = (cssObj, key, nv) => {
|
|
41920
41977
|
cssObj[cssKey] = nv;
|
41921
41978
|
}
|
41922
41979
|
};
|
41923
|
-
const ɵ12 = setDimensionProp;
|
41980
|
+
const ɵ12$1 = setDimensionProp;
|
41924
41981
|
const processDimensionAttributes = attrMap => {
|
41925
41982
|
const attrKeys = Array.from(attrMap.keys());
|
41926
41983
|
attrKeys.forEach((attrKey) => {
|
@@ -45074,7 +45131,7 @@ exports.ɵ0 = ɵ0$h;
|
|
45074
45131
|
exports.ɵ1 = ɵ1$5;
|
45075
45132
|
exports.ɵ10 = ɵ10$1;
|
45076
45133
|
exports.ɵ11 = ɵ11$1;
|
45077
|
-
exports.ɵ12 = ɵ12;
|
45134
|
+
exports.ɵ12 = ɵ12$1;
|
45078
45135
|
exports.ɵ13 = ɵ13;
|
45079
45136
|
exports.ɵ14 = ɵ14;
|
45080
45137
|
exports.ɵ2 = ɵ2$4;
|
@@ -38646,6 +38646,20 @@ const nullPipe = () => {
|
|
38646
38646
|
transform: noop$1$1
|
38647
38647
|
};
|
38648
38648
|
};
|
38649
|
+
let _cspEnabled;
|
38650
|
+
const isCSPEnabled = () => {
|
38651
|
+
if (typeof _cspEnabled !== 'undefined') {
|
38652
|
+
return _cspEnabled;
|
38653
|
+
}
|
38654
|
+
try {
|
38655
|
+
new Function();
|
38656
|
+
_cspEnabled = false;
|
38657
|
+
}
|
38658
|
+
catch (e) {
|
38659
|
+
_cspEnabled = true;
|
38660
|
+
}
|
38661
|
+
return _cspEnabled;
|
38662
|
+
};
|
38649
38663
|
let pipeProvider;
|
38650
38664
|
var ExpressionType$1;
|
38651
38665
|
(function (ExpressionType$$1) {
|
@@ -38677,53 +38691,82 @@ function $parseExpr(expr, defOnly) {
|
|
38677
38691
|
}
|
38678
38692
|
// fallback to generate function in runtime. This will break if CSP is enabled
|
38679
38693
|
if (!boundFn) {
|
38680
|
-
|
38681
|
-
|
38682
|
-
if (
|
38683
|
-
|
38684
|
-
|
38694
|
+
// If CSP enabled, function def not found from the generated fn expressions for the page.
|
38695
|
+
// Handle bind expressions used internally inside WM components. e.g. wmAnchor used inside nav.comp.html
|
38696
|
+
if (isCSPEnabled()) {
|
38697
|
+
boundFn = function (ctx, locals) {
|
38698
|
+
// handle internal bindings for wm widgets used inside a component
|
38699
|
+
let _ctx = Object.assign({}, locals);
|
38700
|
+
Object.setPrototypeOf(_ctx, ctx);
|
38701
|
+
return _.get(_ctx, expr);
|
38702
|
+
};
|
38685
38703
|
}
|
38686
38704
|
else {
|
38687
|
-
const
|
38688
|
-
const
|
38689
|
-
|
38690
|
-
|
38691
|
-
|
38692
|
-
}
|
38693
|
-
|
38694
|
-
const
|
38695
|
-
|
38696
|
-
|
38697
|
-
|
38698
|
-
|
38699
|
-
|
38700
|
-
|
38701
|
-
|
38702
|
-
|
38703
|
-
|
38704
|
-
|
38705
|
-
|
38706
|
-
|
38707
|
-
|
38708
|
-
pipeInstance = pipeProvider.getInstance(pipeName);
|
38705
|
+
const parser = new Parser$1(new Lexer);
|
38706
|
+
const ast = parser.parseBinding(expr, '', 0);
|
38707
|
+
if (ast.errors.length) {
|
38708
|
+
fn = noop$1$1;
|
38709
|
+
boundFn = fn;
|
38710
|
+
}
|
38711
|
+
else {
|
38712
|
+
const pipeNameVsIsPureMap = pipeProvider.getPipeNameVsIsPureMap();
|
38713
|
+
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Binding, pipeNameVsIsPureMap);
|
38714
|
+
fn = astCompiler.compile(defOnly);
|
38715
|
+
if (defOnly) {
|
38716
|
+
return fn;
|
38717
|
+
}
|
38718
|
+
if (fn.usedPipes.length) {
|
38719
|
+
const pipeArgs = [];
|
38720
|
+
let hasPurePipe = false;
|
38721
|
+
for (const [pipeName] of fn.usedPipes) {
|
38722
|
+
const pipeInfo = pipeProvider.meta(pipeName);
|
38723
|
+
let pipeInstance;
|
38724
|
+
if (!pipeInfo) {
|
38725
|
+
pipeInstance = nullPipe;
|
38709
38726
|
}
|
38710
|
-
|
38711
|
-
|
38727
|
+
else {
|
38728
|
+
if (pipeInfo.pure) {
|
38729
|
+
hasPurePipe = true;
|
38730
|
+
pipeInstance = purePipes.get(pipeName);
|
38731
|
+
}
|
38732
|
+
if (!pipeInstance) {
|
38733
|
+
pipeInstance = pipeProvider.getInstance(pipeName);
|
38734
|
+
}
|
38735
|
+
if (pipeInfo.pure) {
|
38736
|
+
purePipes.set(pipeName, pipeInstance);
|
38737
|
+
}
|
38712
38738
|
}
|
38739
|
+
pipeArgs.push(pipeInstance);
|
38713
38740
|
}
|
38714
|
-
pipeArgs.
|
38741
|
+
pipeArgs.unshift(hasPurePipe ? new Map() : undefined);
|
38742
|
+
boundFn = fn.bind(undefined, ...pipeArgs);
|
38743
|
+
}
|
38744
|
+
else {
|
38745
|
+
boundFn = fn.bind(undefined, undefined);
|
38715
38746
|
}
|
38716
|
-
pipeArgs.unshift(hasPurePipe ? new Map() : undefined);
|
38717
|
-
boundFn = fn.bind(undefined, ...pipeArgs);
|
38718
|
-
}
|
38719
|
-
else {
|
38720
|
-
boundFn = fn.bind(undefined, undefined);
|
38721
38747
|
}
|
38722
38748
|
}
|
38723
38749
|
}
|
38724
38750
|
exprFnCache.set(expr, boundFn);
|
38725
38751
|
return boundFn;
|
38726
38752
|
}
|
38753
|
+
function simpleFunctionEvaluator(expr, ctx, locals) {
|
38754
|
+
let _ctx = Object.assign({}, locals);
|
38755
|
+
Object.setPrototypeOf(_ctx, ctx);
|
38756
|
+
let parts = expr.split('(');
|
38757
|
+
let fnName = parts[0];
|
38758
|
+
let computedFn = _.get(ctx, fnName);
|
38759
|
+
if (computedFn) {
|
38760
|
+
let args = parts[1].replace(')', '');
|
38761
|
+
args = args.split(',');
|
38762
|
+
let computedArgs = [];
|
38763
|
+
args.forEach((arg) => {
|
38764
|
+
arg = arg && arg.trim();
|
38765
|
+
computedArgs.push(_.get(_ctx, arg));
|
38766
|
+
});
|
38767
|
+
return computedFn.bind(_ctx)(...computedArgs);
|
38768
|
+
}
|
38769
|
+
}
|
38727
38770
|
function $parseEvent(expr, defOnly) {
|
38728
38771
|
if (!isString$1(expr)) {
|
38729
38772
|
return noop$1$1;
|
@@ -38741,13 +38784,18 @@ function $parseEvent(expr, defOnly) {
|
|
38741
38784
|
}
|
38742
38785
|
// fallback to generate function in runtime. This will break if CSP is enabled
|
38743
38786
|
if (!fn) {
|
38744
|
-
|
38745
|
-
|
38746
|
-
|
38747
|
-
|
38787
|
+
if (isCSPEnabled()) {
|
38788
|
+
fn = simpleFunctionEvaluator.bind(undefined, expr);
|
38789
|
+
}
|
38790
|
+
else {
|
38791
|
+
const parser = new Parser$1(new Lexer);
|
38792
|
+
const ast = parser.parseAction(expr, '', 0);
|
38793
|
+
if (ast.errors.length) {
|
38794
|
+
return noop$1$1;
|
38795
|
+
}
|
38796
|
+
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Action);
|
38797
|
+
fn = astCompiler.compile(defOnly);
|
38748
38798
|
}
|
38749
|
-
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Action);
|
38750
|
-
fn = astCompiler.compile(defOnly);
|
38751
38799
|
}
|
38752
38800
|
eventFnCache.set(expr, fn);
|
38753
38801
|
return fn;
|
@@ -39645,10 +39693,26 @@ const loadScript = (url, loadViaScriptTag, cacheable = false) => __awaiter$1(voi
|
|
39645
39693
|
return Promise.resolve();
|
39646
39694
|
}
|
39647
39695
|
if (loadViaScriptTag) {
|
39648
|
-
return
|
39649
|
-
|
39650
|
-
script.
|
39651
|
-
|
39696
|
+
return new Promise((resolve, reject) => {
|
39697
|
+
let script = document.createElement('script');
|
39698
|
+
script.type = 'text/javascript';
|
39699
|
+
script.src = _url;
|
39700
|
+
script.async = false;
|
39701
|
+
if (script.readyState) { //IE
|
39702
|
+
script.onreadystatechange = () => {
|
39703
|
+
if (script.readyState === "loaded" || script.readyState === "complete") {
|
39704
|
+
script.onreadystatechange = null;
|
39705
|
+
resolve(true);
|
39706
|
+
}
|
39707
|
+
};
|
39708
|
+
}
|
39709
|
+
else { //Other browsers
|
39710
|
+
script.onload = () => {
|
39711
|
+
resolve(true);
|
39712
|
+
};
|
39713
|
+
}
|
39714
|
+
script.onerror = (error) => reject(error);
|
39715
|
+
document.getElementsByTagName('head')[0].appendChild(script);
|
39652
39716
|
});
|
39653
39717
|
}
|
39654
39718
|
else if (cacheable) {
|
@@ -39664,13 +39728,6 @@ const loadScript = (url, loadViaScriptTag, cacheable = false) => __awaiter$1(voi
|
|
39664
39728
|
.done(response => response)
|
39665
39729
|
.fail(reason => reason);
|
39666
39730
|
}
|
39667
|
-
// return fetch(_url)
|
39668
|
-
// .then(response => response.text())
|
39669
|
-
// .then(text => {
|
39670
|
-
// const script = document.createElement('script');
|
39671
|
-
// script.textContent = text;
|
39672
|
-
// document.head.appendChild(script);
|
39673
|
-
// });
|
39674
39731
|
});
|
39675
39732
|
const loadScripts = (urls = [], loadViaScriptTag = true) => __awaiter$1(void 0, void 0, void 0, function* () {
|
39676
39733
|
for (const url of urls) {
|
@@ -41920,7 +41977,7 @@ const setDimensionProp = (cssObj, key, nv) => {
|
|
41920
41977
|
cssObj[cssKey] = nv;
|
41921
41978
|
}
|
41922
41979
|
};
|
41923
|
-
const ɵ12 = setDimensionProp;
|
41980
|
+
const ɵ12$1 = setDimensionProp;
|
41924
41981
|
const processDimensionAttributes = attrMap => {
|
41925
41982
|
const attrKeys = Array.from(attrMap.keys());
|
41926
41983
|
attrKeys.forEach((attrKey) => {
|
@@ -45074,7 +45131,7 @@ exports.ɵ0 = ɵ0$h;
|
|
45074
45131
|
exports.ɵ1 = ɵ1$5;
|
45075
45132
|
exports.ɵ10 = ɵ10$1;
|
45076
45133
|
exports.ɵ11 = ɵ11$1;
|
45077
|
-
exports.ɵ12 = ɵ12;
|
45134
|
+
exports.ɵ12 = ɵ12$1;
|
45078
45135
|
exports.ɵ13 = ɵ13;
|
45079
45136
|
exports.ɵ14 = ɵ14;
|
45080
45137
|
exports.ɵ2 = ɵ2$4;
|
angular-codegen/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
const{getHandlebarTemplate:getHandlebarTemplate,safeString:safeString}=require("./handlebar-helpers"),cheerio=require("cheerio");let processedPageExpr=[];const isDisplayExpressionAttr=e=>{return["displayexpression","displaylabel","displayimagesrc","nodelabel","nodeicon","nodechildren","nodeid","itemid","itemlabel","itemicon","itemaction","itembadge","itemchildren","itemlink","itemtarget","userrole","isactive"].includes(e)},checkIsCustomPipeExpression=function(e){let r=e.match(/(custom(\s*:))/g);return r&&r.length},updateBindExpressionForDisplayexpression=e=>{let r,t,n,s,
|
1
|
+
const{getHandlebarTemplate:getHandlebarTemplate,safeString:safeString}=require("./handlebar-helpers"),cheerio=require("cheerio");let processedPageExpr=[];const isDisplayExpressionAttr=e=>{return["displayexpression","displaylabel","displayimagesrc","nodelabel","nodeicon","nodechildren","nodeid","itemid","itemlabel","itemicon","itemaction","itembadge","itemchildren","itemlink","itemtarget","userrole","isactive"].includes(e)},checkIsCustomPipeExpression=function(e){let r=e.match(/(custom(\s*:))/g);return r&&r.length},updateBindExpressionForDisplayexpression=e=>{let r,t,n,i,s,a,o,l,p,d="";for(checkIsCustomPipeExpression(e)&&(e+=": __1"),e=e.replace(/\$\[data\[\$i\]/g,"$[__1"),n=0;n<e.length;n++)if(r=e[n],t=e[n+1],"$"===r&&"["===t){for(a=1,p=!1,o=!1,i=n+2;i<e.length;i++)if(" "!==(s=e[i])&&(p||(o='"'===e[i]||"'"===e[i],p=!0),"["===s?a++:"]"===s&&a--,!a)){l=e.substring(n+2,i),d+=o?"__1["+l+"]":l;break}n=i}else d+=r;return d},updateArrTypeExpr=(e,r,t)=>{let n=/\[\$i\]/g;return isArrayTypeProperty(r,t)?e.substr(0,e.lastIndexOf("[$i]")).replace("[$i]","[0]"):e.replace(n,"[0]")},isArrayTypeProperty=(e,r)=>{const t=r?r.attribs:{};return["dataset","dataoptions","customcolors"].includes(e)||"datavalue"===e&&void 0!==t.wmcheckbox||"selecteditem"===e&&void 0!==t.wmtable||"selecteditem"===e&&void 0!==t.wmlist||"datavalue"===e&&t.wmselect&&t.multiple},getFnForExpr=(e,r)=>{let t=(r=r||{}).isEvent,n=r.widgetNode,i=r.prop;if(t||-1===e.indexOf("[$i]")||(e=updateArrTypeExpr(e,i,n)),processedPageExpr.includes(e))return"";processedPageExpr.push(e);let s,a="";const o=require("../dependencies/expression-parser.cjs");s=t?o.$parseEvent(e,!0):o.$parseExpr(e,!0);const l=safeString(s.fnArgs),p=safeString(s.fnBody),d=s.pipes||[];d.forEach((e,r)=>{a+="["+e.reduce((e,r)=>"'"+e+"','"+r+"'")+"]"+(r<d.length?",":"")}),a=safeString(a);const c=safeString(e.replace(/"/g,'\\"'));return getHandlebarTemplate("expr-vs-fn")({expr:c,fnArgs:l,fnBody:p,fnPipes:a})+","},getExprForBinding=e=>{let r="";return"string"==typeof e&&e.startsWith("bind:")&&(r=getFnForExpr(e.replace("bind:",""))),r},generateFilterExprBindings=e=>{let r="";return e.rules&&_.forEach(e.rules,(e,t)=>{e.rules?r+=generateFilterExprBindings(e):("between"===e.matchMode&&(r+=getExprForBinding(e.secondvalue)),r+=getExprForBinding(e.value))}),r},getCRUDVariableExpressions=e=>{let r=e.dataBinding||{},t="";for(let e in r){(r[e]||[]).forEach(e=>{t+=getExprForBinding(e.value)})}return t},generateVariableExpressions=e=>{let r="";e=JSON.parse(e);const t=["onBefore","onBeforeUpdate","onResult","onBeforeOpen","onOpen","onBeforeMessageSend","onMessageReceive","onProgress","onError","onBeforeDatasetReady","onCanUpdate","onClick","onHide","onOk","onCancel","onBeforeClose","onClose","onTimerFire","onSuccess","onOnline","onOffline"];for(const n in e){const i=e[n];if("wm.LiveVariable"===i.category&&"read"===i.operation)r+=generateFilterExprBindings(i.filterExpressions);else if("wm.CrudVariable"===i.category)r+=getCRUDVariableExpressions(i);else{(i.dataBinding||[]).forEach(e=>{r+=getExprForBinding(e.value)})}t.forEach(e=>{i[e]&&(r+=getFnForExpr(i[e],{isEvent:!0}))})}return r},generateExtraWidgetBindings=(e,r)=>{let t="";switch(r){case"wmalertdialog":t+=getFnForExpr("oktext");break;case"wmconfirmdialog":t+=getFnForExpr("oktext"),t+=getFnForExpr("canceltext");break;case"wmtable":t+=e.attribs.rowngclass?getFnForExpr(e.attribs.rowngclass):"";break;case"wmtablecolumn":t+=e.attribs["col-ng-class"]?getFnForExpr(e.attribs["col-ng-class"]):""}return t},isActionTypeNode=e=>["wmtableaction","wmtablerowaction","wmformaction"].some(r=>void 0!==e.attribs[r]),generatePageExpressions=(e,r,t)=>{let n,i,s="";const a=cheerio.load(e);if(processedPageExpr.length=0,a("*").each((e,r)=>{for(let e in r.attribs)e.endsWith(".bind")?(i=e.replace(".bind",""),n=r.attribs[e],isDisplayExpressionAttr(i)&&(n=updateBindExpressionForDisplayexpression(n),console.log("++++++++displayexpressoin binding updated",n)),s+=getFnForExpr(n,{prop:i,widgetNode:r})):e.endsWith(".event")?(i=e.replace(".event",""),n=r.attribs[e],s+=getFnForExpr(n,{isEvent:!0})):"displayexpression"===e?(n=r.attribs[e],s+=getFnForExpr(n)):"action"===e&&isActionTypeNode(r)&&(n=r.attribs[e],console.warn("<<<<<<<<found action node",n),s+=getFnForExpr(n));["wmalertdialog","wmconfirmdialog","wmtable","wmtablecolumn"].forEach(e=>{void 0!==r.attribs[e]&&(s+=generateExtraWidgetBindings(r,e))})}),s+=generateVariableExpressions(r),t){const e=(t=JSON.parse(t.toString())).properties||{};Object.keys(e).forEach(r=>{let t=e[r];"string"==typeof t.value&&t.value.startsWith("bind:")&&(s+=getFnForExpr(t.value.replace("bind:","")))})}return s};module.exports={generatePageExpressions:generatePageExpressions,generateVariableExpressions:generateVariableExpressions};
|
@@ -1 +1 @@
|
|
1
|
-
const{getHandlebarTemplate:getHandlebarTemplate,safeString:safeString}=require("./handlebar-helpers"),{readFile:readFile,writeFile:writeFile,getAppVariablesFilePath:getAppVariablesFilePath,formatContents:formatContents}=require("./wm-utils"),{
|
1
|
+
const{getHandlebarTemplate:getHandlebarTemplate,safeString:safeString}=require("./handlebar-helpers"),{readFile:readFile,writeFile:writeFile,getAppVariablesFilePath:getAppVariablesFilePath,formatContents:formatContents,getCodegenPath:getCodegenPath}=require("./wm-utils"),{generatePageExpressions:generatePageExpressions}=require("./expr-parser-utils"),generateAppVariableExpressions=async(e,a)=>{const t=await readFile(`${getCodegenPath()}/dependencies/app.component.html`,"utf-8")||"",r=safeString(generatePageExpressions(t,e)),s=getHandlebarTemplate("component-expressions")({expressions:r});await writeFile(`${a}/src/app/app.component.expressions.ts`,formatContents(s,"javascript"))},generateAppVariables=async(e,a)=>{const t=getHandlebarTemplate("component-variables");let r=await readFile(getAppVariablesFilePath(e),"utf8")||"{}";const s=t({variables:safeString(r)});await writeFile(`${a}/src/app/app.component.variables.ts`,s),await generateAppVariableExpressions(r,a)};module.exports={generateAppVariables:generateAppVariables};
|