@wavemaker/angular-codegen 11.0.1-next.139046 → 11.0.1-next.139247
Sign up to get free protection for your applications and to get access to all the features.
- angular-codegen/angular-app/package-lock.json +32318 -52446
- angular-codegen/angular-app/package.json +17 -17
- angular-codegen/angular-app/src/assets/styles/css/wm-responsive.css +1 -1
- angular-codegen/angular-app/src/assets/styles/css/wm-style.css +1 -1
- angular-codegen/angular-app/src/assets/styles/fonts/wm-streamline-light-icon.eot +0 -0
- angular-codegen/angular-app/src/assets/styles/fonts/wm-streamline-light-icon.ttf +0 -0
- angular-codegen/angular-app/src/assets/styles/fonts/wm-streamline-light-icon.woff +0 -0
- angular-codegen/angular-app/src/assets/styles/fonts/wm-streamline-regular-icon.eot +0 -0
- angular-codegen/angular-app/src/assets/styles/fonts/wm-streamline-regular-icon.ttf +0 -0
- angular-codegen/angular-app/src/assets/styles/fonts/wm-streamline-regular-icon.woff +0 -0
- angular-codegen/dependencies/expression-parser.cjs.js +17761 -0
- angular-codegen/dependencies/pipe-provider.cjs.js +69033 -0
- angular-codegen/dependencies/transpilation-mobile.cjs.js +181 -51
- angular-codegen/dependencies/transpilation-web.cjs.js +181 -51
- angular-codegen/package.json +1 -1
- angular-codegen/src/codegen-cli.js +1 -1
- angular-codegen/src/expr-parser-utils.js +1 -0
- angular-codegen/src/gen-app-variables.js +1 -1
- angular-codegen/src/gen-components.js +1 -1
- angular-codegen/src/handlebar-helpers.js +1 -1
- angular-codegen/src/pages-util.js +1 -1
- angular-codegen/src/wm-utils.js +1 -1
- angular-codegen/templates/app.component.script.js.hbs +6 -1
- angular-codegen/templates/component.expressions.ts.hbs +3 -0
- angular-codegen/templates/expr-vs-fn.hbs +3 -0
- angular-codegen/templates/page/page.component.ts.hbs +7 -1
- angular-codegen/templates/partial/partial.component.ts.hbs +6 -0
- angular-codegen/templates/prefab/prefab.component.ts.hbs +6 -0
@@ -38622,9 +38622,12 @@ class ASTCompiler {
|
|
38622
38622
|
cleanup() {
|
38623
38623
|
this.ast = this.cAst = this.stmts = this.cStmts = this.declarations = this.pipes = this.pipeNameVsIsPureMap = undefined;
|
38624
38624
|
}
|
38625
|
-
compile() {
|
38625
|
+
compile(defOnly) {
|
38626
38626
|
this.extendCtxWithLocals();
|
38627
38627
|
this.addReturnStmt(this.build(this.ast));
|
38628
|
+
if (defOnly) {
|
38629
|
+
return { fnBody: this.fnBody(), fnArgs: this.fnArgs(), pipes: this.pipes };
|
38630
|
+
}
|
38628
38631
|
const fn = new Function(this.fnArgs(), this.fnBody());
|
38629
38632
|
let boundFn;
|
38630
38633
|
if (this.exprType === ExpressionType$1.Binding) {
|
@@ -38649,7 +38652,7 @@ var ExpressionType$1;
|
|
38649
38652
|
ExpressionType$$1[ExpressionType$$1["Binding"] = 0] = "Binding";
|
38650
38653
|
ExpressionType$$1[ExpressionType$$1["Action"] = 1] = "Action";
|
38651
38654
|
})(ExpressionType$1 || (ExpressionType$1 = {}));
|
38652
|
-
function $parseExpr(expr) {
|
38655
|
+
function $parseExpr(expr, defOnly) {
|
38653
38656
|
if (!pipeProvider) {
|
38654
38657
|
console.log('set pipe provider');
|
38655
38658
|
return noop$1$1;
|
@@ -38668,51 +38671,60 @@ function $parseExpr(expr) {
|
|
38668
38671
|
if (fn) {
|
38669
38672
|
return fn;
|
38670
38673
|
}
|
38671
|
-
const parser = new Parser$1(new Lexer);
|
38672
|
-
const ast = parser.parseBinding(expr, '', 0);
|
38673
38674
|
let boundFn;
|
38674
|
-
if (
|
38675
|
-
|
38676
|
-
boundFn = fn;
|
38675
|
+
if (!defOnly) {
|
38676
|
+
boundFn = getFnForBindExpr(expr);
|
38677
38677
|
}
|
38678
|
-
|
38679
|
-
|
38680
|
-
const
|
38681
|
-
|
38682
|
-
if (
|
38683
|
-
|
38684
|
-
|
38685
|
-
|
38686
|
-
|
38687
|
-
|
38688
|
-
|
38689
|
-
|
38690
|
-
|
38691
|
-
|
38692
|
-
|
38693
|
-
|
38694
|
-
|
38695
|
-
|
38696
|
-
|
38697
|
-
|
38678
|
+
// fallback to generate function in runtime. This will break if CSP is enabled
|
38679
|
+
if (!boundFn) {
|
38680
|
+
const parser = new Parser$1(new Lexer);
|
38681
|
+
const ast = parser.parseBinding(expr, '', 0);
|
38682
|
+
if (ast.errors.length) {
|
38683
|
+
fn = noop$1$1;
|
38684
|
+
boundFn = fn;
|
38685
|
+
}
|
38686
|
+
else {
|
38687
|
+
const pipeNameVsIsPureMap = pipeProvider.getPipeNameVsIsPureMap();
|
38688
|
+
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Binding, pipeNameVsIsPureMap);
|
38689
|
+
fn = astCompiler.compile(defOnly);
|
38690
|
+
if (defOnly) {
|
38691
|
+
return fn;
|
38692
|
+
}
|
38693
|
+
if (fn.usedPipes.length) {
|
38694
|
+
const pipeArgs = [];
|
38695
|
+
let hasPurePipe = false;
|
38696
|
+
for (const [pipeName] of fn.usedPipes) {
|
38697
|
+
const pipeInfo = pipeProvider.meta(pipeName);
|
38698
|
+
let pipeInstance;
|
38699
|
+
if (!pipeInfo) {
|
38700
|
+
pipeInstance = nullPipe;
|
38698
38701
|
}
|
38699
|
-
|
38700
|
-
|
38702
|
+
else {
|
38703
|
+
if (pipeInfo.pure) {
|
38704
|
+
hasPurePipe = true;
|
38705
|
+
pipeInstance = purePipes.get(pipeName);
|
38706
|
+
}
|
38707
|
+
if (!pipeInstance) {
|
38708
|
+
pipeInstance = pipeProvider.getInstance(pipeName);
|
38709
|
+
}
|
38710
|
+
if (pipeInfo.pure) {
|
38711
|
+
purePipes.set(pipeName, pipeInstance);
|
38712
|
+
}
|
38701
38713
|
}
|
38714
|
+
pipeArgs.push(pipeInstance);
|
38702
38715
|
}
|
38703
|
-
pipeArgs.
|
38716
|
+
pipeArgs.unshift(hasPurePipe ? new Map() : undefined);
|
38717
|
+
boundFn = fn.bind(undefined, ...pipeArgs);
|
38718
|
+
}
|
38719
|
+
else {
|
38720
|
+
boundFn = fn.bind(undefined, undefined);
|
38704
38721
|
}
|
38705
|
-
pipeArgs.unshift(hasPurePipe ? new Map() : undefined);
|
38706
|
-
boundFn = fn.bind(undefined, ...pipeArgs);
|
38707
|
-
}
|
38708
|
-
else {
|
38709
|
-
boundFn = fn.bind(undefined, undefined);
|
38710
38722
|
}
|
38711
38723
|
}
|
38712
38724
|
exprFnCache.set(expr, boundFn);
|
38713
38725
|
return boundFn;
|
38714
38726
|
}
|
38715
|
-
function $parseEvent(expr) {
|
38727
|
+
function $parseEvent(expr, defOnly) {
|
38716
38728
|
if (!isString$1(expr)) {
|
38717
38729
|
return noop$1$1;
|
38718
38730
|
}
|
@@ -38724,16 +38736,76 @@ function $parseEvent(expr) {
|
|
38724
38736
|
if (fn) {
|
38725
38737
|
return fn;
|
38726
38738
|
}
|
38727
|
-
|
38728
|
-
|
38729
|
-
|
38730
|
-
|
38739
|
+
if (!defOnly) {
|
38740
|
+
fn = getFnForEventExpr(expr);
|
38741
|
+
}
|
38742
|
+
// fallback to generate function in runtime. This will break if CSP is enabled
|
38743
|
+
if (!fn) {
|
38744
|
+
const parser = new Parser$1(new Lexer);
|
38745
|
+
const ast = parser.parseAction(expr, '', 0);
|
38746
|
+
if (ast.errors.length) {
|
38747
|
+
return noop$1$1;
|
38748
|
+
}
|
38749
|
+
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Action);
|
38750
|
+
fn = astCompiler.compile(defOnly);
|
38731
38751
|
}
|
38732
|
-
const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Action);
|
38733
|
-
fn = astCompiler.compile();
|
38734
38752
|
eventFnCache.set(expr, fn);
|
38735
38753
|
return fn;
|
38736
38754
|
}
|
38755
|
+
const fnNameMap = new Map();
|
38756
|
+
const getFnByExpr = (expr) => fnNameMap.get(expr);
|
38757
|
+
const fnExecutor = (expr, exprType) => {
|
38758
|
+
let fn = getFnByExpr(expr);
|
38759
|
+
if (!fn) {
|
38760
|
+
console.warn("didn't find fn for the expr: ", expr, ". Falling back to runtime evaluation");
|
38761
|
+
return;
|
38762
|
+
}
|
38763
|
+
const usedPipes = fn.usedPipes || [];
|
38764
|
+
if (exprType === ExpressionType$1.Binding) {
|
38765
|
+
fn = fn.bind(undefined, plus, minus, isDef, getPurePipeVal);
|
38766
|
+
}
|
38767
|
+
else {
|
38768
|
+
fn = fn.bind(undefined, plus, minus, isDef);
|
38769
|
+
}
|
38770
|
+
if (usedPipes.length) {
|
38771
|
+
const pipeArgs = [];
|
38772
|
+
let hasPurePipe = false;
|
38773
|
+
for (const [pipeName] of usedPipes) {
|
38774
|
+
const pipeInfo = pipeProvider.meta(pipeName);
|
38775
|
+
let pipeInstance;
|
38776
|
+
if (!pipeInfo) {
|
38777
|
+
pipeInstance = nullPipe;
|
38778
|
+
}
|
38779
|
+
else {
|
38780
|
+
if (pipeInfo.pure) {
|
38781
|
+
hasPurePipe = true;
|
38782
|
+
pipeInstance = purePipes.get(pipeName);
|
38783
|
+
}
|
38784
|
+
if (!pipeInstance) {
|
38785
|
+
pipeInstance = pipeProvider.getInstance(pipeName);
|
38786
|
+
}
|
38787
|
+
if (pipeInfo.pure) {
|
38788
|
+
purePipes.set(pipeName, pipeInstance);
|
38789
|
+
}
|
38790
|
+
}
|
38791
|
+
pipeArgs.push(pipeInstance);
|
38792
|
+
}
|
38793
|
+
pipeArgs.unshift(hasPurePipe ? new Map() : undefined);
|
38794
|
+
fn = fn.bind(undefined, ...pipeArgs);
|
38795
|
+
}
|
38796
|
+
else {
|
38797
|
+
if (exprType === ExpressionType$1.Binding) {
|
38798
|
+
fn = fn.bind(undefined, undefined);
|
38799
|
+
}
|
38800
|
+
}
|
38801
|
+
return fn;
|
38802
|
+
};
|
38803
|
+
const getFnForBindExpr = (expr) => {
|
38804
|
+
return fnExecutor(expr, ExpressionType$1.Binding);
|
38805
|
+
};
|
38806
|
+
const getFnForEventExpr = (expr) => {
|
38807
|
+
return fnExecutor(expr, ExpressionType$1.Action);
|
38808
|
+
};
|
38737
38809
|
|
38738
38810
|
const registry = new Map();
|
38739
38811
|
const watchIdGenerator = new IDGenerator('watch-id-');
|
@@ -38868,6 +38940,7 @@ var Operation;
|
|
38868
38940
|
Operation["IS_BOUND_TO_LOCALE"] = "isBoundToLocale";
|
38869
38941
|
Operation["GET_DEFAULT_LOCALE"] = "getDefaultLocale";
|
38870
38942
|
Operation["CANCEL"] = "cancel";
|
38943
|
+
Operation["SET_PAGINATION"] = "setPagination";
|
38871
38944
|
})(Operation || (Operation = {}));
|
38872
38945
|
const DataSource = {
|
38873
38946
|
Operation
|
@@ -39627,7 +39700,8 @@ const setSessionStorageItem = (key, value) => {
|
|
39627
39700
|
* @param key string
|
39628
39701
|
*/
|
39629
39702
|
const getSessionStorageItem = key => {
|
39630
|
-
|
39703
|
+
// sanity check for this to work with ng-codegen
|
39704
|
+
let item = window && window.sessionStorage && window.sessionStorage.getItem(_WM_APP_PROJECT.id);
|
39631
39705
|
if (item) {
|
39632
39706
|
item = JSON.parse(item);
|
39633
39707
|
return item[key];
|
@@ -39851,6 +39925,7 @@ const processFilterExpBindNode = (context, filterExpressions) => {
|
|
39851
39925
|
const filter$ = new Subject();
|
39852
39926
|
const bindFilExpObj = (obj, targetNodeKey) => {
|
39853
39927
|
if (stringStartsWith(obj[targetNodeKey], 'bind:')) {
|
39928
|
+
// [Todo-CSP]: needs a check, where is this used
|
39854
39929
|
destroyFn($watch(obj[targetNodeKey].replace('bind:', ''), context, {}, (newVal, oldVal) => {
|
39855
39930
|
if ((newVal === oldVal && _.isUndefined(newVal)) || (_.isUndefined(newVal) && !_.isUndefined(oldVal))) {
|
39856
39931
|
return;
|
@@ -40094,6 +40169,7 @@ const triggerItemAction = (scope, item) => {
|
|
40094
40169
|
const linkTarget = item.target;
|
40095
40170
|
if (itemAction) {
|
40096
40171
|
if (!scope.itemActionFn) {
|
40172
|
+
//[Todo-CSP]: This will not work as function will be dynamic
|
40097
40173
|
scope.itemActionFn = $parseEvent(itemAction);
|
40098
40174
|
}
|
40099
40175
|
scope.itemActionFn(scope.userDefinedExecutionContext, Object.create(item));
|
@@ -41205,6 +41281,16 @@ class PaginationService {
|
|
41205
41281
|
*/
|
41206
41282
|
updateFieldsOnPagination(parent, newVal) {
|
41207
41283
|
let fieldDefs = parent.widgetType === 'wm-table' ? parent.gridData : parent.fieldDefs;
|
41284
|
+
// remove the deleted row from the list
|
41285
|
+
if (parent.widgetType === 'wm-table' && (parent.gridOptions.isNavTypeScrollOrOndemand()) && parent.gridOptions.deletedRowIndex !== -1) {
|
41286
|
+
fieldDefs.splice(parent.gridOptions.deletedRowIndex, 1);
|
41287
|
+
parent.gridOptions.setDeletedRowIndex(-1);
|
41288
|
+
}
|
41289
|
+
// reset fieldDefs if last action performed is search or sort
|
41290
|
+
if (parent.widgetType === 'wm-table' && (parent.gridOptions.isNavTypeScrollOrOndemand()) && (parent.gridOptions.lastActionPerformed === parent.gridOptions.ACTIONS.SEARCH_OR_SORT || parent.gridOptions.lastActionPerformed === parent.gridOptions.ACTIONS.FILTER_CRITERIA)) {
|
41291
|
+
fieldDefs = [];
|
41292
|
+
parent.gridOptions.setCurrentPage(1);
|
41293
|
+
}
|
41208
41294
|
let currentPage = parent.currentPage;
|
41209
41295
|
const dataNavigator = parent.dataNavigator;
|
41210
41296
|
const pagesize = parent.pagesize;
|
@@ -41225,11 +41311,11 @@ class PaginationService {
|
|
41225
41311
|
newVal = [];
|
41226
41312
|
}
|
41227
41313
|
else if (dataNavigator.dataSize < currentPage * pagesize) {
|
41228
|
-
// if number of elements added to
|
41314
|
+
// if number of elements added to dataNavigator is less than product of currentPage and pageSize we only add elements extra elements added
|
41229
41315
|
itemsLength = dataNavigator.dataSize - fieldDefs.length;
|
41230
41316
|
}
|
41231
41317
|
else {
|
41232
|
-
// if number of elements added to
|
41318
|
+
// if number of elements added to dataNavigator is greater than product of currentPage and pageSize we add elements the extra elements in newVal
|
41233
41319
|
itemsLength = currentPage * pagesize - fieldDefs.length;
|
41234
41320
|
currentPage++;
|
41235
41321
|
}
|
@@ -41242,9 +41328,36 @@ class PaginationService {
|
|
41242
41328
|
}
|
41243
41329
|
newVal = itemsToPush;
|
41244
41330
|
}
|
41245
|
-
|
41331
|
+
// Add unique records to fieldDefs
|
41332
|
+
if (parent.widgetType === 'wm-table' && (parent.gridOptions.lastActionPerformed === parent.gridOptions.ACTIONS.DELETE || parent.gridOptions.lastActionPerformed === parent.gridOptions.ACTIONS.EDIT)) {
|
41333
|
+
fieldDefs = this.getUniqueRecordsInFieldDef(fieldDefs, newVal);
|
41334
|
+
}
|
41335
|
+
else {
|
41336
|
+
fieldDefs = [...fieldDefs, ...newVal];
|
41337
|
+
}
|
41246
41338
|
return [fieldDefs, currentPage];
|
41247
41339
|
}
|
41340
|
+
// Add the unique records to fieldDefs
|
41341
|
+
getUniqueRecordsInFieldDef(fieldDefs, newVal) {
|
41342
|
+
let flag = false;
|
41343
|
+
if (!fieldDefs.length) {
|
41344
|
+
fieldDefs = newVal;
|
41345
|
+
}
|
41346
|
+
else {
|
41347
|
+
newVal.forEach(function (newObj) {
|
41348
|
+
flag = false;
|
41349
|
+
fieldDefs.forEach(function (obj) {
|
41350
|
+
if (_.isEqual(newObj, obj)) {
|
41351
|
+
flag = true;
|
41352
|
+
}
|
41353
|
+
});
|
41354
|
+
if (flag === false) {
|
41355
|
+
fieldDefs.push(newObj);
|
41356
|
+
}
|
41357
|
+
});
|
41358
|
+
}
|
41359
|
+
return fieldDefs;
|
41360
|
+
}
|
41248
41361
|
/**
|
41249
41362
|
* @description
|
41250
41363
|
* This function registers scroll events on the scrollable el, if the page doesn't have a scroll el then wheel event is registered on the requested node
|
@@ -41287,6 +41400,9 @@ class PaginationService {
|
|
41287
41400
|
let scrollTop;
|
41288
41401
|
// scrollingElement is undefined for IE, safari. use body as target Element
|
41289
41402
|
target = target === document ? (target.scrollingElement || document.body) : target;
|
41403
|
+
if (parent.widgetType === 'wm-table' && parent.gridOptions.isNavTypeScrollOrOndemand()) {
|
41404
|
+
evt.stopPropagation();
|
41405
|
+
}
|
41290
41406
|
clientHeight = target.clientHeight;
|
41291
41407
|
totalHeight = target.scrollHeight;
|
41292
41408
|
scrollTop = target === document.body ? $(window).scrollTop() : target.scrollTop;
|
@@ -41301,6 +41417,9 @@ class PaginationService {
|
|
41301
41417
|
else {
|
41302
41418
|
// if there is no scrollable element register wheel event on ul element
|
41303
41419
|
$rootEl.on('wheel.scroll_evt', e => {
|
41420
|
+
if (parent.widgetType === 'wm-table' && parent.gridOptions.isNavTypeScrollOrOndemand()) {
|
41421
|
+
e.stopPropagation();
|
41422
|
+
}
|
41304
41423
|
if (e.originalEvent.deltaY > 0) {
|
41305
41424
|
$rootEl.off('wheel.scroll_evt');
|
41306
41425
|
this.debouncedFetchNextDatasetOnScroll(dataNavigator, debounceNum, parent)();
|
@@ -41766,7 +41885,7 @@ const getRequiredProviders = (nodeDef, providers, nodeAttrs) => {
|
|
41766
41885
|
}
|
41767
41886
|
});
|
41768
41887
|
};
|
41769
|
-
const ɵ11 = getRequiredProviders;
|
41888
|
+
const ɵ11$1 = getRequiredProviders;
|
41770
41889
|
const DIMENSION_PROPS = ['padding', 'borderwidth', 'margin'];
|
41771
41890
|
const SEPARATOR = ' ', UNSET = 'unset';
|
41772
41891
|
const setDimensionProp = (cssObj, key, nv) => {
|
@@ -42381,7 +42500,7 @@ var search_build$1 = /*#__PURE__*/Object.freeze({
|
|
42381
42500
|
const tagName$1m = 'div';
|
42382
42501
|
register('wm-tree', () => {
|
42383
42502
|
return {
|
42384
|
-
pre: attrs => `<${tagName$1m} wmTree
|
42503
|
+
pre: attrs => `<${tagName$1m} wmTree ${getAttrMarkup(attrs)}>`,
|
42385
42504
|
post: () => `</${tagName$1m}>`
|
42386
42505
|
};
|
42387
42506
|
});
|
@@ -44793,10 +44912,21 @@ var video_build$1 = /*#__PURE__*/Object.freeze({
|
|
44793
44912
|
});
|
44794
44913
|
|
44795
44914
|
const tagName$1 = 'div';
|
44915
|
+
const SPACING_KEY = 'parentLinearLayout.spacing';
|
44796
44916
|
register('wm-linearlayout', () => {
|
44797
44917
|
return {
|
44798
|
-
|
44799
|
-
|
44918
|
+
requires: ['wm-linearlayout'],
|
44919
|
+
pre: (attrs, shared, provider) => {
|
44920
|
+
let spacing = attrs.get('spacing');
|
44921
|
+
attrs.set('spacing', (!spacing || spacing === '0') && provider ? provider.get(SPACING_KEY) : spacing);
|
44922
|
+
return `<${tagName$1} wmLinearLayout ${getAttrMarkup(attrs)}>`;
|
44923
|
+
},
|
44924
|
+
post: () => `</${tagName$1}>`,
|
44925
|
+
provide: (attrs, shared) => {
|
44926
|
+
const provider = new Map();
|
44927
|
+
provider.set(SPACING_KEY, attrs.get('spacing'));
|
44928
|
+
return provider;
|
44929
|
+
}
|
44800
44930
|
};
|
44801
44931
|
});
|
44802
44932
|
var linearLayout_build = () => { };
|
@@ -44943,7 +45073,7 @@ exports.transpile = transpile;
|
|
44943
45073
|
exports.ɵ0 = ɵ0$h;
|
44944
45074
|
exports.ɵ1 = ɵ1$5;
|
44945
45075
|
exports.ɵ10 = ɵ10$1;
|
44946
|
-
exports.ɵ11 = ɵ11;
|
45076
|
+
exports.ɵ11 = ɵ11$1;
|
44947
45077
|
exports.ɵ12 = ɵ12;
|
44948
45078
|
exports.ɵ13 = ɵ13;
|
44949
45079
|
exports.ɵ14 = ɵ14;
|