@wavemaker-ai/app-ng-runtime 1.0.0-rc.312 → 1.0.0-rc.317

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.
@@ -459,7 +459,7 @@ declare class LiveFormDirective implements OnDestroy {
459
459
  onFieldDefaultValueChange(field: any, nv: any): void;
460
460
  onFieldValueChange(field: any, nv: any): void;
461
461
  getBlobURL(dataObj: any, key: any, value: any): string;
462
- setFormData(dataObj: any, formFields?: any): void;
462
+ setFormData(dataObj: any, formFields?: any, formData?: any): void;
463
463
  onDataSourceUpdate(response: any, newForm: any, updateMode: any): void;
464
464
  savePrevformFields(): void;
465
465
  getPrevformFields(): void;
@@ -595,7 +595,8 @@
595
595
  },
596
596
  afterRowUpdate: (row, e, callBack, options) => {
597
597
  i2.muteWatchers();
598
- this.updateRecord(lodashEs.extend({}, options, { row, 'prevData': options.rowindex ? options.rowindex : this.prevData, 'event': e, 'callBack': callBack }));
598
+ const v = lodashEs.get(this.datasource, 'category') === 'wm.Variable' && options && options.rowindex != null;
599
+ this.updateRecord(lodashEs.extend({}, options, { row, prevData: v ? options.rowindex : this.prevData, event: e, callBack }));
599
600
  setTimeout(() => {
600
601
  i2.unMuteWatchers();
601
602
  }, 10);
@@ -677,7 +678,7 @@
677
678
  },
678
679
  generateCustomExpressions: (rowData, index, summaryRow) => {
679
680
  const row = this.getClonedRowObject(rowData);
680
- const compileTemplate = (tmpl, tmplIndex) => {
681
+ const compileTemplate = (tmpl) => {
681
682
  if (!tmpl) {
682
683
  return;
683
684
  }
@@ -687,8 +688,7 @@
687
688
  colDef
688
689
  };
689
690
  this.addEventsToContext(context);
690
- const injectorKey = `customExpr_${tmplIndex ?? 'x'}_${index}`;
691
- const customExprView = this.customExprViewRef.createEmbeddedView(tmpl, context, { injector: this.createCustomInjector(injectorKey, context) });
691
+ const customExprView = this.customExprViewRef.createEmbeddedView(tmpl, context);
692
692
  const rootNode = customExprView.rootNodes[0];
693
693
  const fieldName = rootNode.getAttribute('data-col-identifier');
694
694
  lodashEs.extend(colDef, this.columns[fieldName]);
@@ -701,19 +701,18 @@
701
701
  };
702
702
  if (this.isdynamictable) {
703
703
  this.fieldDefs.forEach(col => {
704
- compileTemplate(col.customExprTmpl, col?.field ? String(col.field) : undefined);
704
+ compileTemplate(col.customExprTmpl);
705
705
  });
706
706
  return;
707
707
  }
708
708
  // For all the columns inside the table, generate the custom expression
709
- this.customExprTmpl.forEach((tmpl, tmplIndex) => compileTemplate(tmpl, tmplIndex));
709
+ this.customExprTmpl.forEach(compileTemplate.bind(this));
710
710
  },
711
711
  generateRowExpansionCell: (rowData, index) => {
712
712
  const row = this.getClonedRowObject(rowData);
713
713
  // For all the columns inside the table, generate the inline widget
714
714
  this.rowExpansionActionTmpl.forEach((tmpl) => {
715
- const context = { row };
716
- this.rowExpansionActionTl[index] = this.rowExpansionActionViewRef.createEmbeddedView(tmpl, context, { injector: this.createCustomInjector(`rowExpansionAction_${index}`, context) }).rootNodes;
715
+ this.rowExpansionActionTl[index] = this.rowExpansionActionViewRef.createEmbeddedView(tmpl, { row }).rootNodes;
717
716
  });
718
717
  },
719
718
  getRowExpansionAction: (index) => {
@@ -755,7 +754,7 @@
755
754
  }, 500);
756
755
  }
757
756
  };
758
- const rootNode = this.rowDetailViewRef.createEmbeddedView(this.rowExpansionTmpl, context, { injector: this.createCustomInjector(`rowDetail_${rowId}`, context) }).rootNodes[0];
757
+ const rootNode = this.rowDetailViewRef.createEmbeddedView(this.rowExpansionTmpl, context).rootNodes[0];
759
758
  $target[0].appendChild(rootNode);
760
759
  i2.$appDigest();
761
760
  },
@@ -786,8 +785,7 @@
786
785
  this.rowActionsCompiledTl[index] = [];
787
786
  // For all the columns inside the table, generate the inline widget
788
787
  this.rowActionTmpl.forEach((tmpl) => {
789
- const context = { row };
790
- this.rowActionsCompiledTl[index].push(...this.rowActionsViewRef.createEmbeddedView(tmpl, context, { injector: this.createCustomInjector(`rowActions_${index}`, context) }).rootNodes);
788
+ this.rowActionsCompiledTl[index].push(...this.rowActionsViewRef.createEmbeddedView(tmpl, { row }).rootNodes);
791
789
  });
792
790
  },
793
791
  getRowAction: (index) => {
@@ -814,7 +812,7 @@
814
812
  return this.columns[fieldName] && this.columns[fieldName].showPendingSpinnerNew;
815
813
  }
816
814
  };
817
- const rootNode = this.inlineEditNewViewRef.createEmbeddedView(tmpl, context, { injector: this.createCustomInjector(`inlineNew_${this.widgetId}`, context) }).rootNodes[0];
815
+ const rootNode = this.inlineEditNewViewRef.createEmbeddedView(tmpl, context).rootNodes[0];
818
816
  fieldName = rootNode.getAttribute('data-col-identifier');
819
817
  this.inlineNewCompliedTl[fieldName] = rootNode;
820
818
  });
@@ -840,7 +838,7 @@
840
838
  return this.columns[fieldName] && this.columns[fieldName].showPendingSpinner;
841
839
  }
842
840
  };
843
- const rootNode = this.inlineEditViewRef.createEmbeddedView(tmpl, context, { injector: this.createCustomInjector(`inline_${this.widgetId}`, context) }).rootNodes[0];
841
+ const rootNode = this.inlineEditViewRef.createEmbeddedView(tmpl, context).rootNodes[0];
844
842
  fieldName = rootNode.getAttribute('data-col-identifier');
845
843
  this.inlineCompliedTl[fieldName] = rootNode;
846
844
  });
@@ -900,7 +898,7 @@
900
898
  return this.emptyMatchModes.indexOf(this.rowFilter[fieldName] && this.rowFilter[fieldName].matchMode) > -1;
901
899
  }
902
900
  };
903
- const rootNode = this.filterViewRef.createEmbeddedView(tmpl, context, { injector: this.createCustomInjector(`filter_${this.widgetId}`, context) }).rootNodes[0];
901
+ const rootNode = this.filterViewRef.createEmbeddedView(tmpl, context).rootNodes[0];
904
902
  this.rowFilterCompliedTl[rootNode.getAttribute('data-col-identifier')] = rootNode;
905
903
  });
906
904
  },
@@ -1542,6 +1540,7 @@
1542
1540
  row.$isLast = this.gridData.length === row.$index;
1543
1541
  delete row.$$index;
1544
1542
  delete row.$$pk;
1543
+ delete row.$$wmSourceListIndex;
1545
1544
  return row;
1546
1545
  }
1547
1546
  handleLoading(data) {
@@ -1786,6 +1785,14 @@
1786
1785
  // Apply filter and sort, if data is refreshed through Refresh data method
1787
1786
  if (!this.isNavigationEnabled() && this._isClientSearch) {
1788
1787
  data = i2.getClonedObject(serviceData);
1788
+ if (lodashEs.isObject(data) && !lodashEs.isArray(data)) {
1789
+ data = [data];
1790
+ }
1791
+ if (lodashEs.get(this.datasource, 'category') === 'wm.Variable' && lodashEs.isArray(data)) {
1792
+ for (let i = 0; i < data.length; i++) {
1793
+ data[i].$$wmSourceListIndex = i;
1794
+ }
1795
+ }
1789
1796
  data = this.getSearchResult(data, this.filterInfo);
1790
1797
  data = this.getSortResult(data, this.sortInfo);
1791
1798
  this.serverData = data;
@@ -2382,6 +2389,11 @@
2382
2389
  if (lodashEs.isObject(data) && !lodashEs.isArray(data)) {
2383
2390
  data = [data];
2384
2391
  }
2392
+ if (lodashEs.get(this.datasource, 'category') === 'wm.Variable' && lodashEs.isArray(data)) {
2393
+ for (let i = 0; i < data.length; i++) {
2394
+ data[i].$$wmSourceListIndex = i;
2395
+ }
2396
+ }
2385
2397
  data = this.getSearchResult(data, this.filterInfo);
2386
2398
  data = this.getSortResult(data, this.sortInfo);
2387
2399
  return data;
@@ -2809,7 +2821,11 @@
2809
2821
  if (dataSource.execute(i2.DataSource.Operation.SUPPORTS_CRUD) || !dataSource.execute(i2.DataSource.Operation.IS_API_AWARE) || dataSource.category === 'wm.CrudVariable') {
2810
2822
  if (!dataSource.execute(i2.DataSource.Operation.IS_API_AWARE)) {
2811
2823
  const extraOptions = this.generatePath(this.table.binddataset);
2812
- dataSource.execute(i2.DataSource.Operation.SET_ITEM, { prevItem: options.prevData, item: options.row, path: extraOptions.path, parentIndex: extraOptions.index });
2824
+ const item = options.row;
2825
+ if (dataSource.category === 'wm.Variable' && item) {
2826
+ delete item['$$wmSourceListIndex'];
2827
+ }
2828
+ dataSource.execute(i2.DataSource.Operation.SET_ITEM, { prevItem: options.prevData, item, path: extraOptions.path, parentIndex: extraOptions.index });
2813
2829
  this.updateSuccessHandler(options.row, options);
2814
2830
  return;
2815
2831
  }
@@ -2892,7 +2908,14 @@
2892
2908
  if (dataSource.execute(i2.DataSource.Operation.SUPPORTS_CRUD) || !dataSource.execute(i2.DataSource.Operation.IS_API_AWARE) || this.table._isDependent || dataSource.category === 'wm.CrudVariable') {
2893
2909
  if (!dataSource.execute(i2.DataSource.Operation.IS_API_AWARE)) {
2894
2910
  const extraOptions = this.generatePath(this.table.binddataset);
2895
- dataSource.execute(i2.DataSource.Operation.REMOVE_ITEM, { item: options.row, path: extraOptions.path, parentIndex: extraOptions.index });
2911
+ let item = options.row;
2912
+ if (dataSource.category === 'wm.Variable' && options.rowindex != null) {
2913
+ item = options.rowindex;
2914
+ }
2915
+ else if (dataSource.category === 'wm.Variable' && item) {
2916
+ delete item['$$wmSourceListIndex'];
2917
+ }
2918
+ dataSource.execute(i2.DataSource.Operation.REMOVE_ITEM, { item, path: extraOptions.path, parentIndex: extraOptions.index });
2896
2919
  this.deleteSuccessHandler(options.row, undefined, options.evt, options.callBack);
2897
2920
  return;
2898
2921
  }
@@ -3432,6 +3455,11 @@
3432
3455
  if (lodashEs.isObject(data) && !lodashEs.isArray(data)) {
3433
3456
  data = [data];
3434
3457
  }
3458
+ if (lodashEs.get(this.table.datasource, 'category') === 'wm.Variable' && lodashEs.isArray(data)) {
3459
+ for (let i = 0; i < data.length; i++) {
3460
+ data[i].$$wmSourceListIndex = i;
3461
+ }
3462
+ }
3435
3463
  /*Both the functions return same 'data' if arguments are undefined*/
3436
3464
  data = this.getSearchResult(data, this.table.filterInfo);
3437
3465
  data = this.getSortResult(data, this.table.sortInfo);
@@ -15,7 +15,7 @@ import { register, PROP_BOOLEAN, PROP_STRING, PROP_NUMBER, PROP_ANY, StylableCom
15
15
  import { PaginationComponent } from '@wm/components/data/pagination';
16
16
  import * as i3 from '@wm/components/data/list';
17
17
  import { debounceTime } from 'rxjs/operators';
18
- import { isEmpty, floor, debounce, isUndefined, isNaN as isNaN$1, extend, pullAllWith, isEqual, get, remove, findIndex, some, set, forEach, isArray, isObject, indexOf, keys, find, toNumber, includes, split, startsWith, omitBy, values, map, parseInt as parseInt$1, last, toString, isNull, filter, range, endsWith, toLower, head, orderBy, round, sum, max, min, mean, cloneDeep } from 'lodash-es';
18
+ import { isEmpty, floor, debounce, isUndefined, isNaN as isNaN$1, extend, get, pullAllWith, isEqual, remove, findIndex, some, set, forEach, isArray, isObject, indexOf, keys, find, toNumber, includes, split, startsWith, omitBy, values, map, parseInt as parseInt$1, last, toString, isNull, filter, range, endsWith, toLower, head, orderBy, round, sum, max, min, mean, cloneDeep } from 'lodash-es';
19
19
  import * as i6 from 'ngx-bootstrap/dropdown';
20
20
  import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
21
21
  import * as momentLib from 'moment';
@@ -585,7 +585,8 @@ class TableComponent extends StylableComponent {
585
585
  },
586
586
  afterRowUpdate: (row, e, callBack, options) => {
587
587
  muteWatchers();
588
- this.updateRecord(extend({}, options, { row, 'prevData': options.rowindex ? options.rowindex : this.prevData, 'event': e, 'callBack': callBack }));
588
+ const v = get(this.datasource, 'category') === 'wm.Variable' && options && options.rowindex != null;
589
+ this.updateRecord(extend({}, options, { row, prevData: v ? options.rowindex : this.prevData, event: e, callBack }));
589
590
  setTimeout(() => {
590
591
  unMuteWatchers();
591
592
  }, 10);
@@ -667,7 +668,7 @@ class TableComponent extends StylableComponent {
667
668
  },
668
669
  generateCustomExpressions: (rowData, index, summaryRow) => {
669
670
  const row = this.getClonedRowObject(rowData);
670
- const compileTemplate = (tmpl, tmplIndex) => {
671
+ const compileTemplate = (tmpl) => {
671
672
  if (!tmpl) {
672
673
  return;
673
674
  }
@@ -677,8 +678,7 @@ class TableComponent extends StylableComponent {
677
678
  colDef
678
679
  };
679
680
  this.addEventsToContext(context);
680
- const injectorKey = `customExpr_${tmplIndex ?? 'x'}_${index}`;
681
- const customExprView = this.customExprViewRef.createEmbeddedView(tmpl, context, { injector: this.createCustomInjector(injectorKey, context) });
681
+ const customExprView = this.customExprViewRef.createEmbeddedView(tmpl, context);
682
682
  const rootNode = customExprView.rootNodes[0];
683
683
  const fieldName = rootNode.getAttribute('data-col-identifier');
684
684
  extend(colDef, this.columns[fieldName]);
@@ -691,19 +691,18 @@ class TableComponent extends StylableComponent {
691
691
  };
692
692
  if (this.isdynamictable) {
693
693
  this.fieldDefs.forEach(col => {
694
- compileTemplate(col.customExprTmpl, col?.field ? String(col.field) : undefined);
694
+ compileTemplate(col.customExprTmpl);
695
695
  });
696
696
  return;
697
697
  }
698
698
  // For all the columns inside the table, generate the custom expression
699
- this.customExprTmpl.forEach((tmpl, tmplIndex) => compileTemplate(tmpl, tmplIndex));
699
+ this.customExprTmpl.forEach(compileTemplate.bind(this));
700
700
  },
701
701
  generateRowExpansionCell: (rowData, index) => {
702
702
  const row = this.getClonedRowObject(rowData);
703
703
  // For all the columns inside the table, generate the inline widget
704
704
  this.rowExpansionActionTmpl.forEach((tmpl) => {
705
- const context = { row };
706
- this.rowExpansionActionTl[index] = this.rowExpansionActionViewRef.createEmbeddedView(tmpl, context, { injector: this.createCustomInjector(`rowExpansionAction_${index}`, context) }).rootNodes;
705
+ this.rowExpansionActionTl[index] = this.rowExpansionActionViewRef.createEmbeddedView(tmpl, { row }).rootNodes;
707
706
  });
708
707
  },
709
708
  getRowExpansionAction: (index) => {
@@ -745,7 +744,7 @@ class TableComponent extends StylableComponent {
745
744
  }, 500);
746
745
  }
747
746
  };
748
- const rootNode = this.rowDetailViewRef.createEmbeddedView(this.rowExpansionTmpl, context, { injector: this.createCustomInjector(`rowDetail_${rowId}`, context) }).rootNodes[0];
747
+ const rootNode = this.rowDetailViewRef.createEmbeddedView(this.rowExpansionTmpl, context).rootNodes[0];
749
748
  $target[0].appendChild(rootNode);
750
749
  $appDigest();
751
750
  },
@@ -776,8 +775,7 @@ class TableComponent extends StylableComponent {
776
775
  this.rowActionsCompiledTl[index] = [];
777
776
  // For all the columns inside the table, generate the inline widget
778
777
  this.rowActionTmpl.forEach((tmpl) => {
779
- const context = { row };
780
- this.rowActionsCompiledTl[index].push(...this.rowActionsViewRef.createEmbeddedView(tmpl, context, { injector: this.createCustomInjector(`rowActions_${index}`, context) }).rootNodes);
778
+ this.rowActionsCompiledTl[index].push(...this.rowActionsViewRef.createEmbeddedView(tmpl, { row }).rootNodes);
781
779
  });
782
780
  },
783
781
  getRowAction: (index) => {
@@ -804,7 +802,7 @@ class TableComponent extends StylableComponent {
804
802
  return this.columns[fieldName] && this.columns[fieldName].showPendingSpinnerNew;
805
803
  }
806
804
  };
807
- const rootNode = this.inlineEditNewViewRef.createEmbeddedView(tmpl, context, { injector: this.createCustomInjector(`inlineNew_${this.widgetId}`, context) }).rootNodes[0];
805
+ const rootNode = this.inlineEditNewViewRef.createEmbeddedView(tmpl, context).rootNodes[0];
808
806
  fieldName = rootNode.getAttribute('data-col-identifier');
809
807
  this.inlineNewCompliedTl[fieldName] = rootNode;
810
808
  });
@@ -830,7 +828,7 @@ class TableComponent extends StylableComponent {
830
828
  return this.columns[fieldName] && this.columns[fieldName].showPendingSpinner;
831
829
  }
832
830
  };
833
- const rootNode = this.inlineEditViewRef.createEmbeddedView(tmpl, context, { injector: this.createCustomInjector(`inline_${this.widgetId}`, context) }).rootNodes[0];
831
+ const rootNode = this.inlineEditViewRef.createEmbeddedView(tmpl, context).rootNodes[0];
834
832
  fieldName = rootNode.getAttribute('data-col-identifier');
835
833
  this.inlineCompliedTl[fieldName] = rootNode;
836
834
  });
@@ -890,7 +888,7 @@ class TableComponent extends StylableComponent {
890
888
  return this.emptyMatchModes.indexOf(this.rowFilter[fieldName] && this.rowFilter[fieldName].matchMode) > -1;
891
889
  }
892
890
  };
893
- const rootNode = this.filterViewRef.createEmbeddedView(tmpl, context, { injector: this.createCustomInjector(`filter_${this.widgetId}`, context) }).rootNodes[0];
891
+ const rootNode = this.filterViewRef.createEmbeddedView(tmpl, context).rootNodes[0];
894
892
  this.rowFilterCompliedTl[rootNode.getAttribute('data-col-identifier')] = rootNode;
895
893
  });
896
894
  },
@@ -1532,6 +1530,7 @@ class TableComponent extends StylableComponent {
1532
1530
  row.$isLast = this.gridData.length === row.$index;
1533
1531
  delete row.$$index;
1534
1532
  delete row.$$pk;
1533
+ delete row.$$wmSourceListIndex;
1535
1534
  return row;
1536
1535
  }
1537
1536
  handleLoading(data) {
@@ -1776,6 +1775,14 @@ class TableComponent extends StylableComponent {
1776
1775
  // Apply filter and sort, if data is refreshed through Refresh data method
1777
1776
  if (!this.isNavigationEnabled() && this._isClientSearch) {
1778
1777
  data = getClonedObject(serviceData);
1778
+ if (isObject(data) && !isArray(data)) {
1779
+ data = [data];
1780
+ }
1781
+ if (get(this.datasource, 'category') === 'wm.Variable' && isArray(data)) {
1782
+ for (let i = 0; i < data.length; i++) {
1783
+ data[i].$$wmSourceListIndex = i;
1784
+ }
1785
+ }
1779
1786
  data = this.getSearchResult(data, this.filterInfo);
1780
1787
  data = this.getSortResult(data, this.sortInfo);
1781
1788
  this.serverData = data;
@@ -2372,6 +2379,11 @@ class TableComponent extends StylableComponent {
2372
2379
  if (isObject(data) && !isArray(data)) {
2373
2380
  data = [data];
2374
2381
  }
2382
+ if (get(this.datasource, 'category') === 'wm.Variable' && isArray(data)) {
2383
+ for (let i = 0; i < data.length; i++) {
2384
+ data[i].$$wmSourceListIndex = i;
2385
+ }
2386
+ }
2375
2387
  data = this.getSearchResult(data, this.filterInfo);
2376
2388
  data = this.getSortResult(data, this.sortInfo);
2377
2389
  return data;
@@ -2799,7 +2811,11 @@ class TableCUDDirective {
2799
2811
  if (dataSource.execute(DataSource.Operation.SUPPORTS_CRUD) || !dataSource.execute(DataSource.Operation.IS_API_AWARE) || dataSource.category === 'wm.CrudVariable') {
2800
2812
  if (!dataSource.execute(DataSource.Operation.IS_API_AWARE)) {
2801
2813
  const extraOptions = this.generatePath(this.table.binddataset);
2802
- dataSource.execute(DataSource.Operation.SET_ITEM, { prevItem: options.prevData, item: options.row, path: extraOptions.path, parentIndex: extraOptions.index });
2814
+ const item = options.row;
2815
+ if (dataSource.category === 'wm.Variable' && item) {
2816
+ delete item['$$wmSourceListIndex'];
2817
+ }
2818
+ dataSource.execute(DataSource.Operation.SET_ITEM, { prevItem: options.prevData, item, path: extraOptions.path, parentIndex: extraOptions.index });
2803
2819
  this.updateSuccessHandler(options.row, options);
2804
2820
  return;
2805
2821
  }
@@ -2882,7 +2898,14 @@ class TableCUDDirective {
2882
2898
  if (dataSource.execute(DataSource.Operation.SUPPORTS_CRUD) || !dataSource.execute(DataSource.Operation.IS_API_AWARE) || this.table._isDependent || dataSource.category === 'wm.CrudVariable') {
2883
2899
  if (!dataSource.execute(DataSource.Operation.IS_API_AWARE)) {
2884
2900
  const extraOptions = this.generatePath(this.table.binddataset);
2885
- dataSource.execute(DataSource.Operation.REMOVE_ITEM, { item: options.row, path: extraOptions.path, parentIndex: extraOptions.index });
2901
+ let item = options.row;
2902
+ if (dataSource.category === 'wm.Variable' && options.rowindex != null) {
2903
+ item = options.rowindex;
2904
+ }
2905
+ else if (dataSource.category === 'wm.Variable' && item) {
2906
+ delete item['$$wmSourceListIndex'];
2907
+ }
2908
+ dataSource.execute(DataSource.Operation.REMOVE_ITEM, { item, path: extraOptions.path, parentIndex: extraOptions.index });
2886
2909
  this.deleteSuccessHandler(options.row, undefined, options.evt, options.callBack);
2887
2910
  return;
2888
2911
  }
@@ -3423,6 +3446,11 @@ class TableFilterSortDirective {
3423
3446
  if (isObject(data) && !isArray(data)) {
3424
3447
  data = [data];
3425
3448
  }
3449
+ if (get(this.table.datasource, 'category') === 'wm.Variable' && isArray(data)) {
3450
+ for (let i = 0; i < data.length; i++) {
3451
+ data[i].$$wmSourceListIndex = i;
3452
+ }
3453
+ }
3426
3454
  /*Both the functions return same 'data' if arguments are undefined*/
3427
3455
  data = this.getSearchResult(data, this.table.filterInfo);
3428
3456
  data = this.getSortResult(data, this.table.sortInfo);