@wavemaker/angular-codegen 11.0.1-next.139249 → 11.0.1-next.139250
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.
- angular-codegen/angular-app/package.json +1 -1
- angular-codegen/dependencies/expression-parser.cjs.js +69 -42
- angular-codegen/dependencies/pipe-provider.cjs.js +86 -52
- angular-codegen/dependencies/transpilation-mobile.cjs.js +88 -54
- angular-codegen/dependencies/transpilation-web.cjs.js +88 -54
- angular-codegen/package.json +1 -1
- angular-codegen/src/expr-parser-utils.js +1 -1
|
@@ -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.139250"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@ampproject/rollup-plugin-closure-compiler": "0.8.5",
|
|
@@ -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,47 +17619,53 @@ 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
|
-
|
|
17610
|
-
fn = noop;
|
|
17611
|
-
boundFn = fn;
|
|
17622
|
+
// If CSP enabled, avoid multiple browser errors. [What do we say to death, NOT TODAY!]
|
|
17623
|
+
if (isCSPEnabled()) {
|
|
17624
|
+
boundFn = noop;
|
|
17612
17625
|
}
|
|
17613
17626
|
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);
|
|
17627
|
+
const parser = new Parser$1(new Lexer);
|
|
17628
|
+
const ast = parser.parseBinding(expr, '', 0);
|
|
17629
|
+
if (ast.errors.length) {
|
|
17630
|
+
fn = noop;
|
|
17631
|
+
boundFn = fn;
|
|
17632
|
+
}
|
|
17633
|
+
else {
|
|
17634
|
+
const pipeNameVsIsPureMap = pipeProvider.getPipeNameVsIsPureMap();
|
|
17635
|
+
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Binding, pipeNameVsIsPureMap);
|
|
17636
|
+
fn = astCompiler.compile(defOnly);
|
|
17637
|
+
if (defOnly) {
|
|
17638
|
+
return fn;
|
|
17639
|
+
}
|
|
17640
|
+
if (fn.usedPipes.length) {
|
|
17641
|
+
const pipeArgs = [];
|
|
17642
|
+
let hasPurePipe = false;
|
|
17643
|
+
for (const [pipeName] of fn.usedPipes) {
|
|
17644
|
+
const pipeInfo = pipeProvider.meta(pipeName);
|
|
17645
|
+
let pipeInstance;
|
|
17646
|
+
if (!pipeInfo) {
|
|
17647
|
+
pipeInstance = nullPipe;
|
|
17636
17648
|
}
|
|
17637
|
-
|
|
17638
|
-
|
|
17649
|
+
else {
|
|
17650
|
+
if (pipeInfo.pure) {
|
|
17651
|
+
hasPurePipe = true;
|
|
17652
|
+
pipeInstance = purePipes.get(pipeName);
|
|
17653
|
+
}
|
|
17654
|
+
if (!pipeInstance) {
|
|
17655
|
+
pipeInstance = pipeProvider.getInstance(pipeName);
|
|
17656
|
+
}
|
|
17657
|
+
if (pipeInfo.pure) {
|
|
17658
|
+
purePipes.set(pipeName, pipeInstance);
|
|
17659
|
+
}
|
|
17639
17660
|
}
|
|
17661
|
+
pipeArgs.push(pipeInstance);
|
|
17640
17662
|
}
|
|
17641
|
-
pipeArgs.
|
|
17663
|
+
pipeArgs.unshift(hasPurePipe ? new Map() : undefined);
|
|
17664
|
+
boundFn = fn.bind(undefined, ...pipeArgs);
|
|
17665
|
+
}
|
|
17666
|
+
else {
|
|
17667
|
+
boundFn = fn.bind(undefined, undefined);
|
|
17642
17668
|
}
|
|
17643
|
-
pipeArgs.unshift(hasPurePipe ? new Map() : undefined);
|
|
17644
|
-
boundFn = fn.bind(undefined, ...pipeArgs);
|
|
17645
|
-
}
|
|
17646
|
-
else {
|
|
17647
|
-
boundFn = fn.bind(undefined, undefined);
|
|
17648
17669
|
}
|
|
17649
17670
|
}
|
|
17650
17671
|
}
|
|
@@ -17668,13 +17689,18 @@ function $parseEvent(expr, defOnly) {
|
|
|
17668
17689
|
}
|
|
17669
17690
|
// fallback to generate function in runtime. This will break if CSP is enabled
|
|
17670
17691
|
if (!fn) {
|
|
17671
|
-
|
|
17672
|
-
|
|
17673
|
-
|
|
17674
|
-
|
|
17692
|
+
if (isCSPEnabled()) {
|
|
17693
|
+
fn = noop;
|
|
17694
|
+
}
|
|
17695
|
+
else {
|
|
17696
|
+
const parser = new Parser$1(new Lexer);
|
|
17697
|
+
const ast = parser.parseAction(expr, '', 0);
|
|
17698
|
+
if (ast.errors.length) {
|
|
17699
|
+
return noop;
|
|
17700
|
+
}
|
|
17701
|
+
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Action);
|
|
17702
|
+
fn = astCompiler.compile(defOnly);
|
|
17675
17703
|
}
|
|
17676
|
-
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Action);
|
|
17677
|
-
fn = astCompiler.compile(defOnly);
|
|
17678
17704
|
}
|
|
17679
17705
|
eventFnCache.set(expr, fn);
|
|
17680
17706
|
return fn;
|
|
@@ -17731,7 +17757,7 @@ const fnExecutor = (expr, exprType) => {
|
|
|
17731
17757
|
}
|
|
17732
17758
|
return fn;
|
|
17733
17759
|
};
|
|
17734
|
-
const ɵ
|
|
17760
|
+
const ɵ12 = fnExecutor;
|
|
17735
17761
|
const getFnForBindExpr = (expr) => {
|
|
17736
17762
|
return fnExecutor(expr, ExpressionType$1.Binding);
|
|
17737
17763
|
};
|
|
@@ -17758,3 +17784,4 @@ exports.ɵ8 = ɵ8;
|
|
|
17758
17784
|
exports.ɵ9 = ɵ9;
|
|
17759
17785
|
exports.ɵ10 = ɵ10;
|
|
17760
17786
|
exports.ɵ11 = ɵ11;
|
|
17787
|
+
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,47 +42703,53 @@ 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
|
-
|
|
42695
|
-
fn = noop$1$1;
|
|
42696
|
-
boundFn = fn;
|
|
42706
|
+
// If CSP enabled, avoid multiple browser errors. [What do we say to death, NOT TODAY!]
|
|
42707
|
+
if (isCSPEnabled()) {
|
|
42708
|
+
boundFn = noop$1$1;
|
|
42697
42709
|
}
|
|
42698
42710
|
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);
|
|
42711
|
+
const parser = new Parser$1(new Lexer);
|
|
42712
|
+
const ast = parser.parseBinding(expr, '', 0);
|
|
42713
|
+
if (ast.errors.length) {
|
|
42714
|
+
fn = noop$1$1;
|
|
42715
|
+
boundFn = fn;
|
|
42716
|
+
}
|
|
42717
|
+
else {
|
|
42718
|
+
const pipeNameVsIsPureMap = pipeProvider.getPipeNameVsIsPureMap();
|
|
42719
|
+
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Binding, pipeNameVsIsPureMap);
|
|
42720
|
+
fn = astCompiler.compile(defOnly);
|
|
42721
|
+
if (defOnly) {
|
|
42722
|
+
return fn;
|
|
42723
|
+
}
|
|
42724
|
+
if (fn.usedPipes.length) {
|
|
42725
|
+
const pipeArgs = [];
|
|
42726
|
+
let hasPurePipe = false;
|
|
42727
|
+
for (const [pipeName] of fn.usedPipes) {
|
|
42728
|
+
const pipeInfo = pipeProvider.meta(pipeName);
|
|
42729
|
+
let pipeInstance;
|
|
42730
|
+
if (!pipeInfo) {
|
|
42731
|
+
pipeInstance = nullPipe;
|
|
42721
42732
|
}
|
|
42722
|
-
|
|
42723
|
-
|
|
42733
|
+
else {
|
|
42734
|
+
if (pipeInfo.pure) {
|
|
42735
|
+
hasPurePipe = true;
|
|
42736
|
+
pipeInstance = purePipes.get(pipeName);
|
|
42737
|
+
}
|
|
42738
|
+
if (!pipeInstance) {
|
|
42739
|
+
pipeInstance = pipeProvider.getInstance(pipeName);
|
|
42740
|
+
}
|
|
42741
|
+
if (pipeInfo.pure) {
|
|
42742
|
+
purePipes.set(pipeName, pipeInstance);
|
|
42743
|
+
}
|
|
42724
42744
|
}
|
|
42745
|
+
pipeArgs.push(pipeInstance);
|
|
42725
42746
|
}
|
|
42726
|
-
pipeArgs.
|
|
42747
|
+
pipeArgs.unshift(hasPurePipe ? new Map() : undefined);
|
|
42748
|
+
boundFn = fn.bind(undefined, ...pipeArgs);
|
|
42749
|
+
}
|
|
42750
|
+
else {
|
|
42751
|
+
boundFn = fn.bind(undefined, undefined);
|
|
42727
42752
|
}
|
|
42728
|
-
pipeArgs.unshift(hasPurePipe ? new Map() : undefined);
|
|
42729
|
-
boundFn = fn.bind(undefined, ...pipeArgs);
|
|
42730
|
-
}
|
|
42731
|
-
else {
|
|
42732
|
-
boundFn = fn.bind(undefined, undefined);
|
|
42733
42753
|
}
|
|
42734
42754
|
}
|
|
42735
42755
|
}
|
|
@@ -42753,13 +42773,18 @@ function $parseEvent(expr, defOnly) {
|
|
|
42753
42773
|
}
|
|
42754
42774
|
// fallback to generate function in runtime. This will break if CSP is enabled
|
|
42755
42775
|
if (!fn) {
|
|
42756
|
-
|
|
42757
|
-
|
|
42758
|
-
|
|
42759
|
-
|
|
42776
|
+
if (isCSPEnabled()) {
|
|
42777
|
+
fn = noop$1$1;
|
|
42778
|
+
}
|
|
42779
|
+
else {
|
|
42780
|
+
const parser = new Parser$1(new Lexer);
|
|
42781
|
+
const ast = parser.parseAction(expr, '', 0);
|
|
42782
|
+
if (ast.errors.length) {
|
|
42783
|
+
return noop$1$1;
|
|
42784
|
+
}
|
|
42785
|
+
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Action);
|
|
42786
|
+
fn = astCompiler.compile(defOnly);
|
|
42760
42787
|
}
|
|
42761
|
-
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Action);
|
|
42762
|
-
fn = astCompiler.compile(defOnly);
|
|
42763
42788
|
}
|
|
42764
42789
|
eventFnCache.set(expr, fn);
|
|
42765
42790
|
return fn;
|
|
@@ -43657,10 +43682,26 @@ const loadScript = (url, loadViaScriptTag, cacheable = false) => __awaiter$1(voi
|
|
|
43657
43682
|
return Promise.resolve();
|
|
43658
43683
|
}
|
|
43659
43684
|
if (loadViaScriptTag) {
|
|
43660
|
-
return
|
|
43661
|
-
|
|
43662
|
-
script.
|
|
43663
|
-
|
|
43685
|
+
return new Promise((resolve, reject) => {
|
|
43686
|
+
let script = document.createElement('script');
|
|
43687
|
+
script.type = 'text/javascript';
|
|
43688
|
+
script.src = _url;
|
|
43689
|
+
script.async = false;
|
|
43690
|
+
if (script.readyState) { //IE
|
|
43691
|
+
script.onreadystatechange = () => {
|
|
43692
|
+
if (script.readyState === "loaded" || script.readyState === "complete") {
|
|
43693
|
+
script.onreadystatechange = null;
|
|
43694
|
+
resolve(true);
|
|
43695
|
+
}
|
|
43696
|
+
};
|
|
43697
|
+
}
|
|
43698
|
+
else { //Other browsers
|
|
43699
|
+
script.onload = () => {
|
|
43700
|
+
resolve(true);
|
|
43701
|
+
};
|
|
43702
|
+
}
|
|
43703
|
+
script.onerror = (error) => reject(error);
|
|
43704
|
+
document.getElementsByTagName('head')[0].appendChild(script);
|
|
43664
43705
|
});
|
|
43665
43706
|
}
|
|
43666
43707
|
else if (cacheable) {
|
|
@@ -43676,13 +43717,6 @@ const loadScript = (url, loadViaScriptTag, cacheable = false) => __awaiter$1(voi
|
|
|
43676
43717
|
.done(response => response)
|
|
43677
43718
|
.fail(reason => reason);
|
|
43678
43719
|
}
|
|
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
43720
|
});
|
|
43687
43721
|
const loadScripts = (urls = [], loadViaScriptTag = true) => __awaiter$1(void 0, void 0, void 0, function* () {
|
|
43688
43722
|
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,47 +38691,53 @@ 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
|
-
|
|
38683
|
-
fn = noop$1$1;
|
|
38684
|
-
boundFn = fn;
|
|
38694
|
+
// If CSP enabled, avoid multiple browser errors. [What do we say to death, NOT TODAY!]
|
|
38695
|
+
if (isCSPEnabled()) {
|
|
38696
|
+
boundFn = noop$1$1;
|
|
38685
38697
|
}
|
|
38686
38698
|
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);
|
|
38699
|
+
const parser = new Parser$1(new Lexer);
|
|
38700
|
+
const ast = parser.parseBinding(expr, '', 0);
|
|
38701
|
+
if (ast.errors.length) {
|
|
38702
|
+
fn = noop$1$1;
|
|
38703
|
+
boundFn = fn;
|
|
38704
|
+
}
|
|
38705
|
+
else {
|
|
38706
|
+
const pipeNameVsIsPureMap = pipeProvider.getPipeNameVsIsPureMap();
|
|
38707
|
+
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Binding, pipeNameVsIsPureMap);
|
|
38708
|
+
fn = astCompiler.compile(defOnly);
|
|
38709
|
+
if (defOnly) {
|
|
38710
|
+
return fn;
|
|
38711
|
+
}
|
|
38712
|
+
if (fn.usedPipes.length) {
|
|
38713
|
+
const pipeArgs = [];
|
|
38714
|
+
let hasPurePipe = false;
|
|
38715
|
+
for (const [pipeName] of fn.usedPipes) {
|
|
38716
|
+
const pipeInfo = pipeProvider.meta(pipeName);
|
|
38717
|
+
let pipeInstance;
|
|
38718
|
+
if (!pipeInfo) {
|
|
38719
|
+
pipeInstance = nullPipe;
|
|
38709
38720
|
}
|
|
38710
|
-
|
|
38711
|
-
|
|
38721
|
+
else {
|
|
38722
|
+
if (pipeInfo.pure) {
|
|
38723
|
+
hasPurePipe = true;
|
|
38724
|
+
pipeInstance = purePipes.get(pipeName);
|
|
38725
|
+
}
|
|
38726
|
+
if (!pipeInstance) {
|
|
38727
|
+
pipeInstance = pipeProvider.getInstance(pipeName);
|
|
38728
|
+
}
|
|
38729
|
+
if (pipeInfo.pure) {
|
|
38730
|
+
purePipes.set(pipeName, pipeInstance);
|
|
38731
|
+
}
|
|
38712
38732
|
}
|
|
38733
|
+
pipeArgs.push(pipeInstance);
|
|
38713
38734
|
}
|
|
38714
|
-
pipeArgs.
|
|
38735
|
+
pipeArgs.unshift(hasPurePipe ? new Map() : undefined);
|
|
38736
|
+
boundFn = fn.bind(undefined, ...pipeArgs);
|
|
38737
|
+
}
|
|
38738
|
+
else {
|
|
38739
|
+
boundFn = fn.bind(undefined, undefined);
|
|
38715
38740
|
}
|
|
38716
|
-
pipeArgs.unshift(hasPurePipe ? new Map() : undefined);
|
|
38717
|
-
boundFn = fn.bind(undefined, ...pipeArgs);
|
|
38718
|
-
}
|
|
38719
|
-
else {
|
|
38720
|
-
boundFn = fn.bind(undefined, undefined);
|
|
38721
38741
|
}
|
|
38722
38742
|
}
|
|
38723
38743
|
}
|
|
@@ -38741,13 +38761,18 @@ function $parseEvent(expr, defOnly) {
|
|
|
38741
38761
|
}
|
|
38742
38762
|
// fallback to generate function in runtime. This will break if CSP is enabled
|
|
38743
38763
|
if (!fn) {
|
|
38744
|
-
|
|
38745
|
-
|
|
38746
|
-
|
|
38747
|
-
|
|
38764
|
+
if (isCSPEnabled()) {
|
|
38765
|
+
fn = noop$1$1;
|
|
38766
|
+
}
|
|
38767
|
+
else {
|
|
38768
|
+
const parser = new Parser$1(new Lexer);
|
|
38769
|
+
const ast = parser.parseAction(expr, '', 0);
|
|
38770
|
+
if (ast.errors.length) {
|
|
38771
|
+
return noop$1$1;
|
|
38772
|
+
}
|
|
38773
|
+
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Action);
|
|
38774
|
+
fn = astCompiler.compile(defOnly);
|
|
38748
38775
|
}
|
|
38749
|
-
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Action);
|
|
38750
|
-
fn = astCompiler.compile(defOnly);
|
|
38751
38776
|
}
|
|
38752
38777
|
eventFnCache.set(expr, fn);
|
|
38753
38778
|
return fn;
|
|
@@ -39645,10 +39670,26 @@ const loadScript = (url, loadViaScriptTag, cacheable = false) => __awaiter$1(voi
|
|
|
39645
39670
|
return Promise.resolve();
|
|
39646
39671
|
}
|
|
39647
39672
|
if (loadViaScriptTag) {
|
|
39648
|
-
return
|
|
39649
|
-
|
|
39650
|
-
script.
|
|
39651
|
-
|
|
39673
|
+
return new Promise((resolve, reject) => {
|
|
39674
|
+
let script = document.createElement('script');
|
|
39675
|
+
script.type = 'text/javascript';
|
|
39676
|
+
script.src = _url;
|
|
39677
|
+
script.async = false;
|
|
39678
|
+
if (script.readyState) { //IE
|
|
39679
|
+
script.onreadystatechange = () => {
|
|
39680
|
+
if (script.readyState === "loaded" || script.readyState === "complete") {
|
|
39681
|
+
script.onreadystatechange = null;
|
|
39682
|
+
resolve(true);
|
|
39683
|
+
}
|
|
39684
|
+
};
|
|
39685
|
+
}
|
|
39686
|
+
else { //Other browsers
|
|
39687
|
+
script.onload = () => {
|
|
39688
|
+
resolve(true);
|
|
39689
|
+
};
|
|
39690
|
+
}
|
|
39691
|
+
script.onerror = (error) => reject(error);
|
|
39692
|
+
document.getElementsByTagName('head')[0].appendChild(script);
|
|
39652
39693
|
});
|
|
39653
39694
|
}
|
|
39654
39695
|
else if (cacheable) {
|
|
@@ -39664,13 +39705,6 @@ const loadScript = (url, loadViaScriptTag, cacheable = false) => __awaiter$1(voi
|
|
|
39664
39705
|
.done(response => response)
|
|
39665
39706
|
.fail(reason => reason);
|
|
39666
39707
|
}
|
|
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
39708
|
});
|
|
39675
39709
|
const loadScripts = (urls = [], loadViaScriptTag = true) => __awaiter$1(void 0, void 0, void 0, function* () {
|
|
39676
39710
|
for (const url of urls) {
|
|
@@ -41920,7 +41954,7 @@ const setDimensionProp = (cssObj, key, nv) => {
|
|
|
41920
41954
|
cssObj[cssKey] = nv;
|
|
41921
41955
|
}
|
|
41922
41956
|
};
|
|
41923
|
-
const ɵ12 = setDimensionProp;
|
|
41957
|
+
const ɵ12$1 = setDimensionProp;
|
|
41924
41958
|
const processDimensionAttributes = attrMap => {
|
|
41925
41959
|
const attrKeys = Array.from(attrMap.keys());
|
|
41926
41960
|
attrKeys.forEach((attrKey) => {
|
|
@@ -45074,7 +45108,7 @@ exports.ɵ0 = ɵ0$h;
|
|
|
45074
45108
|
exports.ɵ1 = ɵ1$5;
|
|
45075
45109
|
exports.ɵ10 = ɵ10$1;
|
|
45076
45110
|
exports.ɵ11 = ɵ11$1;
|
|
45077
|
-
exports.ɵ12 = ɵ12;
|
|
45111
|
+
exports.ɵ12 = ɵ12$1;
|
|
45078
45112
|
exports.ɵ13 = ɵ13;
|
|
45079
45113
|
exports.ɵ14 = ɵ14;
|
|
45080
45114
|
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,47 +38691,53 @@ 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
|
-
|
|
38683
|
-
fn = noop$1$1;
|
|
38684
|
-
boundFn = fn;
|
|
38694
|
+
// If CSP enabled, avoid multiple browser errors. [What do we say to death, NOT TODAY!]
|
|
38695
|
+
if (isCSPEnabled()) {
|
|
38696
|
+
boundFn = noop$1$1;
|
|
38685
38697
|
}
|
|
38686
38698
|
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);
|
|
38699
|
+
const parser = new Parser$1(new Lexer);
|
|
38700
|
+
const ast = parser.parseBinding(expr, '', 0);
|
|
38701
|
+
if (ast.errors.length) {
|
|
38702
|
+
fn = noop$1$1;
|
|
38703
|
+
boundFn = fn;
|
|
38704
|
+
}
|
|
38705
|
+
else {
|
|
38706
|
+
const pipeNameVsIsPureMap = pipeProvider.getPipeNameVsIsPureMap();
|
|
38707
|
+
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Binding, pipeNameVsIsPureMap);
|
|
38708
|
+
fn = astCompiler.compile(defOnly);
|
|
38709
|
+
if (defOnly) {
|
|
38710
|
+
return fn;
|
|
38711
|
+
}
|
|
38712
|
+
if (fn.usedPipes.length) {
|
|
38713
|
+
const pipeArgs = [];
|
|
38714
|
+
let hasPurePipe = false;
|
|
38715
|
+
for (const [pipeName] of fn.usedPipes) {
|
|
38716
|
+
const pipeInfo = pipeProvider.meta(pipeName);
|
|
38717
|
+
let pipeInstance;
|
|
38718
|
+
if (!pipeInfo) {
|
|
38719
|
+
pipeInstance = nullPipe;
|
|
38709
38720
|
}
|
|
38710
|
-
|
|
38711
|
-
|
|
38721
|
+
else {
|
|
38722
|
+
if (pipeInfo.pure) {
|
|
38723
|
+
hasPurePipe = true;
|
|
38724
|
+
pipeInstance = purePipes.get(pipeName);
|
|
38725
|
+
}
|
|
38726
|
+
if (!pipeInstance) {
|
|
38727
|
+
pipeInstance = pipeProvider.getInstance(pipeName);
|
|
38728
|
+
}
|
|
38729
|
+
if (pipeInfo.pure) {
|
|
38730
|
+
purePipes.set(pipeName, pipeInstance);
|
|
38731
|
+
}
|
|
38712
38732
|
}
|
|
38733
|
+
pipeArgs.push(pipeInstance);
|
|
38713
38734
|
}
|
|
38714
|
-
pipeArgs.
|
|
38735
|
+
pipeArgs.unshift(hasPurePipe ? new Map() : undefined);
|
|
38736
|
+
boundFn = fn.bind(undefined, ...pipeArgs);
|
|
38737
|
+
}
|
|
38738
|
+
else {
|
|
38739
|
+
boundFn = fn.bind(undefined, undefined);
|
|
38715
38740
|
}
|
|
38716
|
-
pipeArgs.unshift(hasPurePipe ? new Map() : undefined);
|
|
38717
|
-
boundFn = fn.bind(undefined, ...pipeArgs);
|
|
38718
|
-
}
|
|
38719
|
-
else {
|
|
38720
|
-
boundFn = fn.bind(undefined, undefined);
|
|
38721
38741
|
}
|
|
38722
38742
|
}
|
|
38723
38743
|
}
|
|
@@ -38741,13 +38761,18 @@ function $parseEvent(expr, defOnly) {
|
|
|
38741
38761
|
}
|
|
38742
38762
|
// fallback to generate function in runtime. This will break if CSP is enabled
|
|
38743
38763
|
if (!fn) {
|
|
38744
|
-
|
|
38745
|
-
|
|
38746
|
-
|
|
38747
|
-
|
|
38764
|
+
if (isCSPEnabled()) {
|
|
38765
|
+
fn = noop$1$1;
|
|
38766
|
+
}
|
|
38767
|
+
else {
|
|
38768
|
+
const parser = new Parser$1(new Lexer);
|
|
38769
|
+
const ast = parser.parseAction(expr, '', 0);
|
|
38770
|
+
if (ast.errors.length) {
|
|
38771
|
+
return noop$1$1;
|
|
38772
|
+
}
|
|
38773
|
+
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Action);
|
|
38774
|
+
fn = astCompiler.compile(defOnly);
|
|
38748
38775
|
}
|
|
38749
|
-
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Action);
|
|
38750
|
-
fn = astCompiler.compile(defOnly);
|
|
38751
38776
|
}
|
|
38752
38777
|
eventFnCache.set(expr, fn);
|
|
38753
38778
|
return fn;
|
|
@@ -39645,10 +39670,26 @@ const loadScript = (url, loadViaScriptTag, cacheable = false) => __awaiter$1(voi
|
|
|
39645
39670
|
return Promise.resolve();
|
|
39646
39671
|
}
|
|
39647
39672
|
if (loadViaScriptTag) {
|
|
39648
|
-
return
|
|
39649
|
-
|
|
39650
|
-
script.
|
|
39651
|
-
|
|
39673
|
+
return new Promise((resolve, reject) => {
|
|
39674
|
+
let script = document.createElement('script');
|
|
39675
|
+
script.type = 'text/javascript';
|
|
39676
|
+
script.src = _url;
|
|
39677
|
+
script.async = false;
|
|
39678
|
+
if (script.readyState) { //IE
|
|
39679
|
+
script.onreadystatechange = () => {
|
|
39680
|
+
if (script.readyState === "loaded" || script.readyState === "complete") {
|
|
39681
|
+
script.onreadystatechange = null;
|
|
39682
|
+
resolve(true);
|
|
39683
|
+
}
|
|
39684
|
+
};
|
|
39685
|
+
}
|
|
39686
|
+
else { //Other browsers
|
|
39687
|
+
script.onload = () => {
|
|
39688
|
+
resolve(true);
|
|
39689
|
+
};
|
|
39690
|
+
}
|
|
39691
|
+
script.onerror = (error) => reject(error);
|
|
39692
|
+
document.getElementsByTagName('head')[0].appendChild(script);
|
|
39652
39693
|
});
|
|
39653
39694
|
}
|
|
39654
39695
|
else if (cacheable) {
|
|
@@ -39664,13 +39705,6 @@ const loadScript = (url, loadViaScriptTag, cacheable = false) => __awaiter$1(voi
|
|
|
39664
39705
|
.done(response => response)
|
|
39665
39706
|
.fail(reason => reason);
|
|
39666
39707
|
}
|
|
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
39708
|
});
|
|
39675
39709
|
const loadScripts = (urls = [], loadViaScriptTag = true) => __awaiter$1(void 0, void 0, void 0, function* () {
|
|
39676
39710
|
for (const url of urls) {
|
|
@@ -41920,7 +41954,7 @@ const setDimensionProp = (cssObj, key, nv) => {
|
|
|
41920
41954
|
cssObj[cssKey] = nv;
|
|
41921
41955
|
}
|
|
41922
41956
|
};
|
|
41923
|
-
const ɵ12 = setDimensionProp;
|
|
41957
|
+
const ɵ12$1 = setDimensionProp;
|
|
41924
41958
|
const processDimensionAttributes = attrMap => {
|
|
41925
41959
|
const attrKeys = Array.from(attrMap.keys());
|
|
41926
41960
|
attrKeys.forEach((attrKey) => {
|
|
@@ -45074,7 +45108,7 @@ exports.ɵ0 = ɵ0$h;
|
|
|
45074
45108
|
exports.ɵ1 = ɵ1$5;
|
|
45075
45109
|
exports.ɵ10 = ɵ10$1;
|
|
45076
45110
|
exports.ɵ11 = ɵ11$1;
|
|
45077
|
-
exports.ɵ12 = ɵ12;
|
|
45111
|
+
exports.ɵ12 = ɵ12$1;
|
|
45078
45112
|
exports.ɵ13 = ɵ13;
|
|
45079
45113
|
exports.ɵ14 = ɵ14;
|
|
45080
45114
|
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};
|