@wavemaker/app-ng-runtime 11.14.1-1.6289 → 11.14.1-10.6348

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 (67) hide show
  1. package/components/base/bundles/index.umd.js +86 -17
  2. package/components/base/esm2022/pipes/custom-pipes.mjs +10 -10
  3. package/components/base/esm2022/utils/widget-utils.mjs +3 -3
  4. package/components/base/esm2022/widgets/common/base/base.component.mjs +67 -7
  5. package/components/base/esm2022/widgets/common/lazy-load/lazy-load.directive.mjs +7 -3
  6. package/components/base/esm2022/widgets/framework/property-change-handler.mjs +7 -2
  7. package/components/base/fesm2022/index.mjs +87 -18
  8. package/components/base/fesm2022/index.mjs.map +1 -1
  9. package/components/base/pipes/custom-pipes.d.ts +5 -5
  10. package/components/basic/label/bundles/index.umd.js +9 -1
  11. package/components/basic/label/esm2022/label.directive.mjs +10 -2
  12. package/components/basic/label/fesm2022/index.mjs +9 -1
  13. package/components/basic/label/fesm2022/index.mjs.map +1 -1
  14. package/components/data/pagination/bundles/index.umd.js +4 -0
  15. package/components/data/pagination/esm2022/pagination.component.mjs +5 -1
  16. package/components/data/pagination/fesm2022/index.mjs +4 -0
  17. package/components/data/pagination/fesm2022/index.mjs.map +1 -1
  18. package/components/data/table/bundles/index.umd.js +371 -15
  19. package/components/data/table/esm2022/table-action/table-action.directive.mjs +8 -1
  20. package/components/data/table/esm2022/table-column/table-column.directive.mjs +107 -3
  21. package/components/data/table/esm2022/table-column-group/table-column-group.directive.mjs +9 -1
  22. package/components/data/table/esm2022/table-cud.directive.mjs +8 -2
  23. package/components/data/table/esm2022/table-filter.directive.mjs +12 -2
  24. package/components/data/table/esm2022/table-row/table-row.directive.mjs +8 -1
  25. package/components/data/table/esm2022/table-row-action/table-row-action.directive.mjs +8 -1
  26. package/components/data/table/esm2022/table.component.mjs +219 -12
  27. package/components/data/table/fesm2022/index.mjs +371 -15
  28. package/components/data/table/fesm2022/index.mjs.map +1 -1
  29. package/components/data/table/table-action/table-action.directive.d.ts +3 -2
  30. package/components/data/table/table-column/table-column.directive.d.ts +3 -2
  31. package/components/data/table/table-column-group/table-column-group.directive.d.ts +3 -2
  32. package/components/data/table/table-cud.directive.d.ts +3 -1
  33. package/components/data/table/table-filter.directive.d.ts +3 -1
  34. package/components/data/table/table-row/table-row.directive.d.ts +3 -2
  35. package/components/data/table/table-row-action/table-row-action.directive.d.ts +3 -2
  36. package/components/data/table/table.component.d.ts +6 -2
  37. package/components/navigation/menu/bundles/index.umd.js +5 -0
  38. package/components/navigation/menu/esm2022/menu.component.mjs +6 -1
  39. package/components/navigation/menu/fesm2022/index.mjs +5 -0
  40. package/components/navigation/menu/fesm2022/index.mjs.map +1 -1
  41. package/components/navigation/popover/bundles/index.umd.js +6 -6
  42. package/components/navigation/popover/esm2022/popover.component.mjs +4 -4
  43. package/components/navigation/popover/fesm2022/index.mjs +3 -3
  44. package/components/navigation/popover/fesm2022/index.mjs.map +1 -1
  45. package/components/navigation/popover/popover.component.d.ts +6 -0
  46. package/core/bundles/index.umd.js +411 -82
  47. package/core/esm2022/public_api.mjs +3 -3
  48. package/core/esm2022/utils/utils.mjs +6 -2
  49. package/core/esm2022/utils/watcher.mjs +402 -81
  50. package/core/fesm2022/index.mjs +410 -84
  51. package/core/fesm2022/index.mjs.map +1 -1
  52. package/core/public_api.d.ts +2 -2
  53. package/core/utils/utils.d.ts +1 -0
  54. package/core/utils/watcher.d.ts +28 -5
  55. package/npm-shrinkwrap.json +2 -2
  56. package/package-lock.json +2 -2
  57. package/package.json +1 -1
  58. package/runtime/base/bundles/index.umd.js +22 -2
  59. package/runtime/base/esm2022/components/app-component/app.component.mjs +4 -2
  60. package/runtime/base/esm2022/components/base-page.component.mjs +6 -2
  61. package/runtime/base/esm2022/components/base-partial.component.mjs +7 -2
  62. package/runtime/base/esm2022/components/base-prefab.component.mjs +7 -2
  63. package/runtime/base/esm2022/components/base-spa-page.component.mjs +6 -2
  64. package/runtime/base/esm2022/services/pipe-provider.service.mjs +4 -4
  65. package/runtime/base/fesm2022/index.mjs +23 -3
  66. package/runtime/base/fesm2022/index.mjs.map +1 -1
  67. package/scripts/datatable/datatable.js +101 -15
@@ -507,7 +507,22 @@ $.widget('wm.datatable', {
507
507
 
508
508
  /* function to get start index of the current active page */
509
509
  getPageStartIndex: function() {
510
- var currentPage = this.options.getCurrentPage(), pagesize = this.options.getPageSize();
510
+ // Guard against undefined getCurrentPage or getPageSize functions
511
+ var getCurrentPageFn = this.options.getCurrentPage;
512
+ var getPageSizeFn = this.options.getPageSize;
513
+ var currentPage, pagesize;
514
+ if (!getCurrentPageFn || typeof getCurrentPageFn !== 'function') {
515
+ // Default to page 1 if getCurrentPage is not available
516
+ currentPage = 1;
517
+ } else {
518
+ currentPage = getCurrentPageFn();
519
+ }
520
+ if (!getPageSizeFn || typeof getPageSizeFn !== 'function') {
521
+ // Default to 10 if getPageSize is not available
522
+ pagesize = 10;
523
+ } else {
524
+ pagesize = getPageSizeFn();
525
+ }
511
526
  var isPrevPageUpdated = this.options.actionRowPage < currentPage;
512
527
  var pageIndex = isPrevPageUpdated ? this.options.actionRowPage : currentPage;
513
528
  return ((pageIndex - 1) * pagesize);
@@ -568,6 +583,8 @@ $.widget('wm.datatable', {
568
583
  var self = this, preparedData,$tbody,pageStartIndex = self.getPageStartIndex(),
569
584
  startRowIndex = self.options.startRowIndex,
570
585
  isScrollorOnDemand = self.options.isNavTypeScrollOrOndemand();
586
+ var $activeRow = self.gridElement.find('tr.row-editing:not(.always-new-row)').first();
587
+ var index = $activeRow.index();
571
588
  if(isScrollorOnDemand) {
572
589
  $tbody = this.gridElement;
573
590
  if(this.renderTableOnViewLess) {
@@ -623,6 +640,16 @@ $.widget('wm.datatable', {
623
640
  this.options.setIsDataUpdatedByUser(false);
624
641
  this.options.clearActionRowIndex();
625
642
  }
643
+ if(this.options.editmode===this.CONSTANTS.QUICK_EDIT){
644
+ if (index>=0) {
645
+ const $newActiveRow = self.gridElement.find('tr').eq(index);
646
+ if ($newActiveRow && $newActiveRow.length) {
647
+ $newActiveRow.addClass('active');
648
+ $newActiveRow.trigger('click', [undefined, {action: 'edit', skipFocus:false}]);
649
+ self.setActiveRow($newActiveRow);
650
+ self.focusActiveRow();
651
+ }
652
+ }}
626
653
  return $tbody;
627
654
  },
628
655
 
@@ -1042,7 +1069,9 @@ $.widget('wm.datatable', {
1042
1069
  'value': '',
1043
1070
  'event': null
1044
1071
  },
1045
- compiledCellTemplates: {}
1072
+ compiledCellTemplates: {},
1073
+ // MEMORY LEAK FIX: Store bound function for proper event listener cleanup
1074
+ boundRowClickHandlerOnCapture: null
1046
1075
  });
1047
1076
  // TODO: Variable loading status is getting updated before dataset update. This is resulting in loader going off before data is rendered.
1048
1077
  // Need to update code with suitable fix. For now 250ms is added as workaround
@@ -1264,7 +1293,9 @@ $.widget('wm.datatable', {
1264
1293
  this.element.find('.loading-data-msg').hide();
1265
1294
  this.element.find('.on-demand-load-btn').text(this.options.ondemandmessage);
1266
1295
  this.element.find('.on-demand-load-btn').show();
1267
- } else if((this.options.getCurrentPage() == this.options.getPageCount()) && this.options.showviewlessbutton) {
1296
+ } else if(this.options.getCurrentPage && typeof this.options.getCurrentPage === 'function' &&
1297
+ this.options.getPageCount && typeof this.options.getPageCount === 'function' &&
1298
+ (this.options.getCurrentPage() == this.options.getPageCount()) && this.options.showviewlessbutton) {
1268
1299
  this.element.find('.on-demand-load-btn').show().text(this.options.viewlessmessage);
1269
1300
  this.element.find('.loading-data-msg').hide();
1270
1301
  if(infScroll) {
@@ -1652,8 +1683,8 @@ $.widget('wm.datatable', {
1652
1683
  },
1653
1684
 
1654
1685
  /* Selects a row. */
1655
- selectRow: function (row, value) {
1656
- var rowIndex = _.isNumber(row) ? row : this.Utils.getObjectIndex(this.options.data, row),
1686
+ selectRow: function (row, value,index) {
1687
+ var rowIndex =index?index:( _.isNumber(row) ? row : this.Utils.getObjectIndex(this.options.data, row)),
1657
1688
  selector,
1658
1689
  $row;
1659
1690
  if (rowIndex !== -1) {
@@ -2078,10 +2109,11 @@ $.widget('wm.datatable', {
2078
2109
  });
2079
2110
 
2080
2111
  $editableElements = $row.find('td.cell-editing');
2081
- $editableElements.on('click', function (e) {
2112
+ // PERFORMANCE FIX: Use event delegation on row instead of individual cell listeners
2113
+ $row.on('click.cellEdit', 'td.cell-editing', function (e) {
2082
2114
  e.stopPropagation();
2083
2115
  });
2084
- $editableElements.on('keydown', function (e) {
2116
+ $row.on('keydown.cellEdit', 'td.cell-editing', function (e) {
2085
2117
  //To prevent up and down arrows, navigating to other rows in edit mode
2086
2118
  if ((e.which === 38 || e.which === 40) && (e.currentTarget && !e.currentTarget.closest('.always-new-row'))) {
2087
2119
  e.stopPropagation();
@@ -2150,7 +2182,8 @@ $.widget('wm.datatable', {
2150
2182
  $requiredEls,
2151
2183
  alwaysNewRow = $row.hasClass('always-new-row'),
2152
2184
  advancedEdit = self.options.editmode === self.CONSTANTS.QUICK_EDIT,
2153
- editOptions = {};
2185
+ editOptions = {},
2186
+ rowindex=$row.attr('data-row-id');
2154
2187
 
2155
2188
  // when a row is edited set actionrow variables
2156
2189
  this.options.setActionRowIndex($row.attr('data-row-id'));
@@ -2172,7 +2205,7 @@ $.widget('wm.datatable', {
2172
2205
  }
2173
2206
  //Select the current edited row
2174
2207
  if (options.selectRow) {
2175
- this.selectRow(rowData, true);
2208
+ this.selectRow(rowData, true,rowindex);
2176
2209
  }
2177
2210
  e = e || {};
2178
2211
  e.data = e.data || {};
@@ -2327,6 +2360,9 @@ $.widget('wm.datatable', {
2327
2360
  return;
2328
2361
  }
2329
2362
  }
2363
+ if(this.options?.getDataSource()?.category== "wm.Variable") {
2364
+ editOptions.rowindex = rowindex;
2365
+ }
2330
2366
  this.options.afterRowUpdate(rowData, e, onSaveSuccess, editOptions);
2331
2367
  }
2332
2368
  } else {
@@ -2363,6 +2399,8 @@ $.widget('wm.datatable', {
2363
2399
 
2364
2400
  this.disableActions(false);
2365
2401
  $row.removeClass('row-editing');
2402
+ // PERFORMANCE FIX: Remove namespaced event listeners from row
2403
+ $row.off('.cellEdit');
2366
2404
  $editableElements.off('click');
2367
2405
  $editableElements.each(function () {
2368
2406
  var $el = $(this),
@@ -2411,6 +2449,8 @@ $.widget('wm.datatable', {
2411
2449
  $saveButton = $row.find('.save-edit-row-button'),
2412
2450
  self = this;
2413
2451
  $row.removeClass('row-editing');
2452
+ // PERFORMANCE FIX: Remove namespaced event listeners from row
2453
+ $row.off('.cellEdit');
2414
2454
  $editableElements.off('click');
2415
2455
  this.disableActions(false);
2416
2456
  this._setGridEditMode(false);
@@ -2858,9 +2898,16 @@ $.widget('wm.datatable', {
2858
2898
  self = this;
2859
2899
 
2860
2900
  if (this.options.enableRowSelection) {
2861
- $htm[0].removeEventListener('click', this.rowClickHandlerOnCapture.bind(this));
2901
+ // MEMORY LEAK FIX: Remove old listener if exists before adding new one
2902
+ if (this.boundRowClickHandlerOnCapture && $htm[0]) {
2903
+ $htm[0].removeEventListener('click', this.boundRowClickHandlerOnCapture, true);
2904
+ }
2862
2905
  $htm.off();
2863
- $htm[0].addEventListener('click', this.rowClickHandlerOnCapture.bind(this));
2906
+
2907
+ // MEMORY LEAK FIX: Store bound function reference for proper removal
2908
+ this.boundRowClickHandlerOnCapture = this.rowClickHandlerOnCapture.bind(this);
2909
+ $htm[0].addEventListener('click', this.boundRowClickHandlerOnCapture, true);
2910
+
2864
2911
  // add js click handler for capture phase in order to first listen on grid and
2865
2912
  // assign selectedItems so that any child actions can have access to the selectedItems.
2866
2913
  $htm.on('click', this.rowSelectionHandler.bind(this));
@@ -2906,6 +2953,9 @@ $.widget('wm.datatable', {
2906
2953
  $htm.on('focus', 'tr.app-datagrid-row', function (e) {
2907
2954
  var $row = $(e.currentTarget);
2908
2955
  if (!$row.hasClass('row-editing')) {
2956
+ if(e.target===e.currentTarget && (e.which===0||!e.which)) {
2957
+ return;
2958
+ }
2909
2959
  self.toggleEditRow(e, { $row: $row, action: 'edit'});
2910
2960
  }
2911
2961
  });
@@ -3494,7 +3544,11 @@ $.widget('wm.datatable', {
3494
3544
  this.dataStatusContainer.hide();
3495
3545
  } else {
3496
3546
  // [WMS-23839] always show load more btn if show view less btn is true
3497
- if (this.options.isNavTypeScrollOrOndemand() && (state === 'nodata' || ((this.options.getCurrentPage() == this.options.getPageCount()) && !this.options.showviewlessbutton))) {
3547
+ if (this.options.isNavTypeScrollOrOndemand() &&
3548
+ (state === 'nodata' ||
3549
+ (this.options.getCurrentPage && typeof this.options.getCurrentPage === 'function' &&
3550
+ this.options.getPageCount && typeof this.options.getPageCount === 'function' &&
3551
+ (this.options.getCurrentPage() == this.options.getPageCount()) && !this.options.showviewlessbutton))) {
3498
3552
  this.element.find('.on-demand-datagrid a').hide();
3499
3553
  }
3500
3554
  this.dataStatusContainer.show();
@@ -3504,7 +3558,9 @@ $.widget('wm.datatable', {
3504
3558
  if (state === 'nodata') {
3505
3559
  this.dataStatusContainer.css('height', 'auto');
3506
3560
  this.dataStatus.contentHeight = 0;
3507
- } else if (this.options.isNavTypeScrollOrOndemand() && this.options.getCurrentPage() > 1){
3561
+ } else if (this.options.isNavTypeScrollOrOndemand() &&
3562
+ this.options.getCurrentPage && typeof this.options.getCurrentPage === 'function' &&
3563
+ this.options.getCurrentPage() > 1){
3508
3564
  // showing the loading icon only for the first page
3509
3565
  // from second page there is another loader which is being shown instead of LoadMore btn
3510
3566
  this.dataStatusContainer.hide();
@@ -3514,7 +3570,9 @@ $.widget('wm.datatable', {
3514
3570
  this.dataStatusContainer.css('height', this.dataStatus.height > this.dataStatus.contentHeight ? 'auto' : this.dataStatus.contentHeight);
3515
3571
  }
3516
3572
  }
3517
- if (!isScrollOrOndemand || (isScrollOrOndemand && this.options.getCurrentPage() === 1)) {
3573
+ if (!isScrollOrOndemand || (isScrollOrOndemand &&
3574
+ this.options.getCurrentPage && typeof this.options.getCurrentPage === 'function' &&
3575
+ this.options.getCurrentPage() === 1)) {
3518
3576
  this.gridContainer.addClass("show-msg");
3519
3577
  }
3520
3578
  } else {
@@ -3633,7 +3691,35 @@ $.widget('wm.datatable', {
3633
3691
  },
3634
3692
 
3635
3693
  _destroy: function () {
3694
+ // MEMORY LEAK FIX: Remove native event listener using stored bound function
3695
+ if (this.gridElement && this.gridElement[0] && this.boundRowClickHandlerOnCapture) {
3696
+ this.gridElement[0].removeEventListener('click', this.boundRowClickHandlerOnCapture, true);
3697
+ this.boundRowClickHandlerOnCapture = null;
3698
+ }
3699
+
3700
+ // MEMORY LEAK FIX: Remove all jQuery event handlers
3701
+ if (this.gridHeaderElement) {
3702
+ this.gridHeaderElement.off();
3703
+ }
3704
+ if (this.gridElement) {
3705
+ this.gridElement.off();
3706
+ }
3707
+ if (this.gridSearch) {
3708
+ this.gridSearch.off();
3709
+ }
3710
+ if (this.tableContainer) {
3711
+ this.tableContainer.off();
3712
+ }
3713
+ if (this.gridContainer) {
3714
+ this.gridContainer.off();
3715
+ }
3716
+
3717
+ // MEMORY LEAK FIX: Clear all internal structures
3718
+ this.preparedData = [];
3719
+ this.preparedHeaderData = [];
3720
+ this.compiledCellTemplates = {};
3721
+
3636
3722
  this.element.text('');
3637
3723
  window.clearTimeout(this.refreshGridTimeout);
3638
3724
  }
3639
- });
3725
+ });