@wavemaker/angular-codegen 11.0.1-next.139045 → 11.0.1-next.139246

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.
Files changed (28) hide show
  1. angular-codegen/angular-app/package-lock.json +32318 -52446
  2. angular-codegen/angular-app/package.json +17 -17
  3. angular-codegen/angular-app/src/assets/styles/css/wm-responsive.css +1 -1
  4. angular-codegen/angular-app/src/assets/styles/css/wm-style.css +1 -1
  5. angular-codegen/angular-app/src/assets/styles/fonts/wm-streamline-light-icon.eot +0 -0
  6. angular-codegen/angular-app/src/assets/styles/fonts/wm-streamline-light-icon.ttf +0 -0
  7. angular-codegen/angular-app/src/assets/styles/fonts/wm-streamline-light-icon.woff +0 -0
  8. angular-codegen/angular-app/src/assets/styles/fonts/wm-streamline-regular-icon.eot +0 -0
  9. angular-codegen/angular-app/src/assets/styles/fonts/wm-streamline-regular-icon.ttf +0 -0
  10. angular-codegen/angular-app/src/assets/styles/fonts/wm-streamline-regular-icon.woff +0 -0
  11. angular-codegen/dependencies/expression-parser.cjs.js +17761 -0
  12. angular-codegen/dependencies/pipe-provider.cjs.js +69032 -0
  13. angular-codegen/dependencies/transpilation-mobile.cjs.js +180 -51
  14. angular-codegen/dependencies/transpilation-web.cjs.js +180 -51
  15. angular-codegen/package.json +1 -1
  16. angular-codegen/src/codegen-cli.js +1 -1
  17. angular-codegen/src/expr-parser-utils.js +1 -0
  18. angular-codegen/src/gen-app-variables.js +1 -1
  19. angular-codegen/src/gen-components.js +1 -1
  20. angular-codegen/src/handlebar-helpers.js +1 -1
  21. angular-codegen/src/pages-util.js +1 -1
  22. angular-codegen/src/wm-utils.js +1 -1
  23. angular-codegen/templates/app.component.script.js.hbs +6 -1
  24. angular-codegen/templates/component.expressions.ts.hbs +3 -0
  25. angular-codegen/templates/expr-vs-fn.hbs +3 -0
  26. angular-codegen/templates/page/page.component.ts.hbs +7 -1
  27. angular-codegen/templates/partial/partial.component.ts.hbs +6 -0
  28. 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 (ast.errors.length) {
38675
- fn = noop$1$1;
38676
- boundFn = fn;
38675
+ if (!defOnly) {
38676
+ boundFn = getFnForBindExpr(expr);
38677
38677
  }
38678
- else {
38679
- const pipeNameVsIsPureMap = pipeProvider.getPipeNameVsIsPureMap();
38680
- const astCompiler = new ASTCompiler(ast.ast, ExpressionType$1.Binding, pipeNameVsIsPureMap);
38681
- fn = astCompiler.compile();
38682
- if (fn.usedPipes.length) {
38683
- const pipeArgs = [];
38684
- let hasPurePipe = false;
38685
- for (const [pipeName] of fn.usedPipes) {
38686
- const pipeInfo = pipeProvider.meta(pipeName);
38687
- let pipeInstance;
38688
- if (!pipeInfo) {
38689
- pipeInstance = nullPipe;
38690
- }
38691
- else {
38692
- if (pipeInfo.pure) {
38693
- hasPurePipe = true;
38694
- pipeInstance = purePipes.get(pipeName);
38695
- }
38696
- if (!pipeInstance) {
38697
- pipeInstance = pipeProvider.getInstance(pipeName);
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
- if (pipeInfo.pure) {
38700
- purePipes.set(pipeName, pipeInstance);
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.push(pipeInstance);
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
- const parser = new Parser$1(new Lexer);
38728
- const ast = parser.parseAction(expr, '', 0);
38729
- if (ast.errors.length) {
38730
- return noop$1$1;
38739
+ if (!defOnly) {
38740
+ fn = getFnForEventExpr(expr) || noop$1$1;
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('oops, didnt find fn for this expr', expr);
38761
+ return function () { };
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
@@ -39851,6 +39924,7 @@ const processFilterExpBindNode = (context, filterExpressions) => {
39851
39924
  const filter$ = new Subject();
39852
39925
  const bindFilExpObj = (obj, targetNodeKey) => {
39853
39926
  if (stringStartsWith(obj[targetNodeKey], 'bind:')) {
39927
+ // [Todo-CSP]: needs a check, where is this used
39854
39928
  destroyFn($watch(obj[targetNodeKey].replace('bind:', ''), context, {}, (newVal, oldVal) => {
39855
39929
  if ((newVal === oldVal && _.isUndefined(newVal)) || (_.isUndefined(newVal) && !_.isUndefined(oldVal))) {
39856
39930
  return;
@@ -40094,6 +40168,7 @@ const triggerItemAction = (scope, item) => {
40094
40168
  const linkTarget = item.target;
40095
40169
  if (itemAction) {
40096
40170
  if (!scope.itemActionFn) {
40171
+ //[Todo-CSP]: This will not work as function will be dynamic
40097
40172
  scope.itemActionFn = $parseEvent(itemAction);
40098
40173
  }
40099
40174
  scope.itemActionFn(scope.userDefinedExecutionContext, Object.create(item));
@@ -41205,6 +41280,16 @@ class PaginationService {
41205
41280
  */
41206
41281
  updateFieldsOnPagination(parent, newVal) {
41207
41282
  let fieldDefs = parent.widgetType === 'wm-table' ? parent.gridData : parent.fieldDefs;
41283
+ // remove the deleted row from the list
41284
+ if (parent.widgetType === 'wm-table' && (parent.gridOptions.isNavTypeScrollOrOndemand()) && parent.gridOptions.deletedRowIndex !== -1) {
41285
+ fieldDefs.splice(parent.gridOptions.deletedRowIndex, 1);
41286
+ parent.gridOptions.setDeletedRowIndex(-1);
41287
+ }
41288
+ // reset fieldDefs if last action performed is search or sort
41289
+ 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)) {
41290
+ fieldDefs = [];
41291
+ parent.gridOptions.setCurrentPage(1);
41292
+ }
41208
41293
  let currentPage = parent.currentPage;
41209
41294
  const dataNavigator = parent.dataNavigator;
41210
41295
  const pagesize = parent.pagesize;
@@ -41225,11 +41310,11 @@ class PaginationService {
41225
41310
  newVal = [];
41226
41311
  }
41227
41312
  else if (dataNavigator.dataSize < currentPage * pagesize) {
41228
- // if number of elements added to datanavigator is less than product of currentpage and pagesize we only add elements extra elements added
41313
+ // if number of elements added to dataNavigator is less than product of currentPage and pageSize we only add elements extra elements added
41229
41314
  itemsLength = dataNavigator.dataSize - fieldDefs.length;
41230
41315
  }
41231
41316
  else {
41232
- // if number of elements added to datanavigator is greater than product of currentpage and pagesize we add elements the extra elements in newVal
41317
+ // if number of elements added to dataNavigator is greater than product of currentPage and pageSize we add elements the extra elements in newVal
41233
41318
  itemsLength = currentPage * pagesize - fieldDefs.length;
41234
41319
  currentPage++;
41235
41320
  }
@@ -41242,9 +41327,36 @@ class PaginationService {
41242
41327
  }
41243
41328
  newVal = itemsToPush;
41244
41329
  }
41245
- fieldDefs = [...fieldDefs, ...newVal];
41330
+ // Add unique records to fieldDefs
41331
+ if (parent.widgetType === 'wm-table' && (parent.gridOptions.lastActionPerformed === parent.gridOptions.ACTIONS.DELETE || parent.gridOptions.lastActionPerformed === parent.gridOptions.ACTIONS.EDIT)) {
41332
+ fieldDefs = this.getUniqueRecordsInFieldDef(fieldDefs, newVal);
41333
+ }
41334
+ else {
41335
+ fieldDefs = [...fieldDefs, ...newVal];
41336
+ }
41246
41337
  return [fieldDefs, currentPage];
41247
41338
  }
41339
+ // Add the unique records to fieldDefs
41340
+ getUniqueRecordsInFieldDef(fieldDefs, newVal) {
41341
+ let flag = false;
41342
+ if (!fieldDefs.length) {
41343
+ fieldDefs = newVal;
41344
+ }
41345
+ else {
41346
+ newVal.forEach(function (newObj) {
41347
+ flag = false;
41348
+ fieldDefs.forEach(function (obj) {
41349
+ if (_.isEqual(newObj, obj)) {
41350
+ flag = true;
41351
+ }
41352
+ });
41353
+ if (flag === false) {
41354
+ fieldDefs.push(newObj);
41355
+ }
41356
+ });
41357
+ }
41358
+ return fieldDefs;
41359
+ }
41248
41360
  /**
41249
41361
  * @description
41250
41362
  * 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 +41399,9 @@ class PaginationService {
41287
41399
  let scrollTop;
41288
41400
  // scrollingElement is undefined for IE, safari. use body as target Element
41289
41401
  target = target === document ? (target.scrollingElement || document.body) : target;
41402
+ if (parent.widgetType === 'wm-table' && parent.gridOptions.isNavTypeScrollOrOndemand()) {
41403
+ evt.stopPropagation();
41404
+ }
41290
41405
  clientHeight = target.clientHeight;
41291
41406
  totalHeight = target.scrollHeight;
41292
41407
  scrollTop = target === document.body ? $(window).scrollTop() : target.scrollTop;
@@ -41301,6 +41416,9 @@ class PaginationService {
41301
41416
  else {
41302
41417
  // if there is no scrollable element register wheel event on ul element
41303
41418
  $rootEl.on('wheel.scroll_evt', e => {
41419
+ if (parent.widgetType === 'wm-table' && parent.gridOptions.isNavTypeScrollOrOndemand()) {
41420
+ e.stopPropagation();
41421
+ }
41304
41422
  if (e.originalEvent.deltaY > 0) {
41305
41423
  $rootEl.off('wheel.scroll_evt');
41306
41424
  this.debouncedFetchNextDatasetOnScroll(dataNavigator, debounceNum, parent)();
@@ -41409,7 +41527,7 @@ const DIALOG_MODULE = [...NGX_MODAL_MODULE, ...INPUT_MODULE, { from: '@wm/compon
41409
41527
  const PAGINATION_MODULE = [...NG_FORM_MODULE, ...NGX_PAGINATION_MODULE, { from: '@wm/components/data/pagination', name: 'PaginationModule' }];
41410
41528
  const SEARCH_MODULE = [...NG_FORM_MODULE, ...NGX_TYPE_HEAD_MODULE, { from: '@wm/components/basic/search', name: 'SearchModule' }];
41411
41529
  const ACCORDION_MODULE = [{ from: '@wm/components/containers/accordion', name: 'AccordionModule' }];
41412
- const LINEAR_LAYOUT_MODULE = [{ from: ' @wm/components/containers/linear-layout', name: 'LinearLayoutModule' }];
41530
+ const LINEAR_LAYOUT_MODULE = [{ from: '@wm/components/containers/linear-layout', name: 'LinearLayoutModule' }];
41413
41531
  const ALERT_DIALOG_MODULE = [...DIALOG_MODULE, { from: '@wm/components/dialogs/alert-dialog', name: 'AlertDialogModule' }];
41414
41532
  const BARCODE_SCANNER_MODULE = [{ from: '@wm/mobile/components/device/barcode-scanner', name: 'BarcodeScannerModule' }];
41415
41533
  const MENU_MODULE = [...BASIC_MODULE, ...NGX_DROP_DOWN_MODULE, ...INPUT_MODULE, { from: '@wm/components/navigation/menu', name: 'MenuModule' }];
@@ -41766,7 +41884,7 @@ const getRequiredProviders = (nodeDef, providers, nodeAttrs) => {
41766
41884
  }
41767
41885
  });
41768
41886
  };
41769
- const ɵ11 = getRequiredProviders;
41887
+ const ɵ11$1 = getRequiredProviders;
41770
41888
  const DIMENSION_PROPS = ['padding', 'borderwidth', 'margin'];
41771
41889
  const SEPARATOR = ' ', UNSET = 'unset';
41772
41890
  const setDimensionProp = (cssObj, key, nv) => {
@@ -42381,7 +42499,7 @@ var search_build$1 = /*#__PURE__*/Object.freeze({
42381
42499
  const tagName$1m = 'div';
42382
42500
  register('wm-tree', () => {
42383
42501
  return {
42384
- pre: attrs => `<${tagName$1m} wmTree redrawable ${getAttrMarkup(attrs)}>`,
42502
+ pre: attrs => `<${tagName$1m} wmTree ${getAttrMarkup(attrs)}>`,
42385
42503
  post: () => `</${tagName$1m}>`
42386
42504
  };
42387
42505
  });
@@ -44793,10 +44911,21 @@ var video_build$1 = /*#__PURE__*/Object.freeze({
44793
44911
  });
44794
44912
 
44795
44913
  const tagName$1 = 'div';
44914
+ const SPACING_KEY = 'parentLinearLayout.spacing';
44796
44915
  register('wm-linearlayout', () => {
44797
44916
  return {
44798
- pre: attrs => `<${tagName$1} wmLinearLayout ${getAttrMarkup(attrs)}>`,
44799
- post: () => `</${tagName$1}>`
44917
+ requires: ['wm-linearlayout'],
44918
+ pre: (attrs, shared, provider) => {
44919
+ let spacing = attrs.get('spacing');
44920
+ attrs.set('spacing', (!spacing || spacing === '0') && provider ? provider.get(SPACING_KEY) : spacing);
44921
+ return `<${tagName$1} wmLinearLayout ${getAttrMarkup(attrs)}>`;
44922
+ },
44923
+ post: () => `</${tagName$1}>`,
44924
+ provide: (attrs, shared) => {
44925
+ const provider = new Map();
44926
+ provider.set(SPACING_KEY, attrs.get('spacing'));
44927
+ return provider;
44928
+ }
44800
44929
  };
44801
44930
  });
44802
44931
  var linearLayout_build = () => { };
@@ -44943,7 +45072,7 @@ exports.transpile = transpile;
44943
45072
  exports.ɵ0 = ɵ0$h;
44944
45073
  exports.ɵ1 = ɵ1$5;
44945
45074
  exports.ɵ10 = ɵ10$1;
44946
- exports.ɵ11 = ɵ11;
45075
+ exports.ɵ11 = ɵ11$1;
44947
45076
  exports.ɵ12 = ɵ12;
44948
45077
  exports.ɵ13 = ɵ13;
44949
45078
  exports.ɵ14 = ɵ14;