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

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 (49) hide show
  1. package/components/base/bundles/index.umd.js +87 -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 +68 -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 +88 -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/table/bundles/index.umd.js +218 -11
  15. package/components/data/table/esm2022/table.component.mjs +219 -12
  16. package/components/data/table/fesm2022/index.mjs +218 -11
  17. package/components/data/table/fesm2022/index.mjs.map +1 -1
  18. package/components/data/table/table.component.d.ts +6 -2
  19. package/components/navigation/menu/bundles/index.umd.js +5 -0
  20. package/components/navigation/menu/esm2022/menu.component.mjs +6 -1
  21. package/components/navigation/menu/fesm2022/index.mjs +5 -0
  22. package/components/navigation/menu/fesm2022/index.mjs.map +1 -1
  23. package/components/navigation/popover/bundles/index.umd.js +6 -6
  24. package/components/navigation/popover/esm2022/popover.component.mjs +4 -4
  25. package/components/navigation/popover/fesm2022/index.mjs +3 -3
  26. package/components/navigation/popover/fesm2022/index.mjs.map +1 -1
  27. package/components/navigation/popover/popover.component.d.ts +6 -0
  28. package/core/bundles/index.umd.js +332 -82
  29. package/core/esm2022/public_api.mjs +3 -3
  30. package/core/esm2022/utils/utils.mjs +6 -2
  31. package/core/esm2022/utils/watcher.mjs +323 -81
  32. package/core/fesm2022/index.mjs +331 -84
  33. package/core/fesm2022/index.mjs.map +1 -1
  34. package/core/public_api.d.ts +2 -2
  35. package/core/utils/utils.d.ts +1 -0
  36. package/core/utils/watcher.d.ts +26 -5
  37. package/npm-shrinkwrap.json +2 -2
  38. package/package-lock.json +2 -2
  39. package/package.json +1 -1
  40. package/runtime/base/bundles/index.umd.js +37 -2
  41. package/runtime/base/esm2022/components/app-component/app.component.mjs +7 -2
  42. package/runtime/base/esm2022/components/base-page.component.mjs +9 -2
  43. package/runtime/base/esm2022/components/base-partial.component.mjs +10 -2
  44. package/runtime/base/esm2022/components/base-prefab.component.mjs +10 -2
  45. package/runtime/base/esm2022/components/base-spa-page.component.mjs +9 -2
  46. package/runtime/base/esm2022/services/pipe-provider.service.mjs +4 -4
  47. package/runtime/base/fesm2022/index.mjs +38 -3
  48. package/runtime/base/fesm2022/index.mjs.map +1 -1
  49. package/scripts/datatable/datatable.js +19 -2
@@ -176,8 +176,15 @@ class TableComponent extends StylableComponent {
176
176
  this.setDataGridOption('colDefs', getClonedObject(this.fieldDefs));
177
177
  }
178
178
  // If data and colDefs are present, call on before data render event
179
+ // Note: Errors in beforedatarender should not prevent table rendering
179
180
  if (!this.isdynamictable && !isEmpty(newValue) && gridOptions.colDefs.length) {
180
- this.invokeEventCallback('beforedatarender', { $data: this._gridData, $columns: this.columns, data: this._gridData, columns: this.columns });
181
+ try {
182
+ this.invokeEventCallback('beforedatarender', { $data: this._gridData, $columns: this.columns, data: this._gridData, columns: this.columns });
183
+ }
184
+ catch (error) {
185
+ // Log error but continue with rendering - beforedatarender errors should not block table rendering
186
+ console.warn('Error in beforedatarender event callback, continuing with table rendering:', error);
187
+ }
181
188
  }
182
189
  this.setDataGridOption('data', getClonedObject(this._gridData));
183
190
  }
@@ -570,7 +577,7 @@ class TableComponent extends StylableComponent {
570
577
  this.prevData = getClonedObject(row);
571
578
  },
572
579
  afterRowUpdate: (row, e, callBack, options) => {
573
- this.updateRecord(extend({}, options, { row, 'prevData': this.prevData, 'event': e, 'callBack': callBack }));
580
+ this.updateRecord(extend({}, options, { row, 'prevData': options.rowindex ? options.rowindex : this.prevData, 'event': e, 'callBack': callBack }));
574
581
  },
575
582
  onBeforeRowUpdate: (row, e, options) => {
576
583
  return this.invokeEventCallback('beforerowupdate', { $event: e, $data: row, row, options: options });
@@ -1224,6 +1231,10 @@ class TableComponent extends StylableComponent {
1224
1231
  return this.actualPageSize || 5;
1225
1232
  }
1226
1233
  watchVariableDataSet(newVal) {
1234
+ // Guard against component destruction
1235
+ if (this.isDestroyed) {
1236
+ return;
1237
+ }
1227
1238
  let result;
1228
1239
  // Check for Variable filters if applied
1229
1240
  if (this.gridOptions.isNavTypeScrollOrOndemand()) {
@@ -1281,6 +1292,12 @@ class TableComponent extends StylableComponent {
1281
1292
  }
1282
1293
  /*Return if data is invalid.*/
1283
1294
  if (!this.isDataValid()) {
1295
+ // If data is invalid and variableInflight is still true, clear loading state
1296
+ // This prevents tables from getting stuck in loading when data is invalid
1297
+ if (this.variableInflight) {
1298
+ this.variableInflight = false;
1299
+ this.setGridData([]);
1300
+ }
1284
1301
  return;
1285
1302
  }
1286
1303
  // If value is empty or in studio mode, dont enable the navigation
@@ -1308,7 +1325,13 @@ class TableComponent extends StylableComponent {
1308
1325
  // @ts-ignore
1309
1326
  if (!isObject(newVal) || newVal === '' || (newVal && newVal.dataValue === '')) {
1310
1327
  if (!this.variableInflight) {
1311
- // If variable has finished loading and resultSet is empty, ender empty data
1328
+ // If variable has finished loading and resultSet is empty, render empty data
1329
+ this.setGridData([]);
1330
+ }
1331
+ else {
1332
+ // If variableInflight is still true but we have invalid/empty data, clear loading state
1333
+ // This handles cases where data never arrives or is invalid
1334
+ this.variableInflight = false;
1312
1335
  this.setGridData([]);
1313
1336
  }
1314
1337
  return;
@@ -1318,13 +1341,143 @@ class TableComponent extends StylableComponent {
1318
1341
  }
1319
1342
  }
1320
1343
  ngOnDestroy() {
1344
+ // MEMORY LEAK FIX: Remove document click listener
1321
1345
  document.removeEventListener('click', this.documentClickBind);
1346
+ // MEMORY LEAK FIX: Unsubscribe from navigator watches
1322
1347
  if (this.navigatorResultWatch) {
1323
1348
  this.navigatorResultWatch.unsubscribe();
1349
+ this.navigatorResultWatch = null;
1324
1350
  }
1325
1351
  if (this.navigatorMaxResultWatch) {
1326
1352
  this.navigatorMaxResultWatch.unsubscribe();
1353
+ this.navigatorMaxResultWatch = null;
1354
+ }
1355
+ // MEMORY LEAK FIX: Clear all ViewContainerRef embedded views
1356
+ // These hold references to row data, custom expressions, and inline widgets
1357
+ if (this.customExprViewRef) {
1358
+ this.customExprViewRef.clear();
1359
+ }
1360
+ if (this.rowActionsViewRef) {
1361
+ this.rowActionsViewRef.clear();
1362
+ }
1363
+ if (this.filterViewRef) {
1364
+ this.filterViewRef.clear();
1365
+ }
1366
+ if (this.inlineEditViewRef) {
1367
+ this.inlineEditViewRef.clear();
1368
+ }
1369
+ if (this.inlineEditNewViewRef) {
1370
+ this.inlineEditNewViewRef.clear();
1327
1371
  }
1372
+ if (this.rowDetailViewRef) {
1373
+ this.rowDetailViewRef.clear();
1374
+ }
1375
+ if (this.rowExpansionActionViewRef) {
1376
+ this.rowExpansionActionViewRef.clear();
1377
+ }
1378
+ if (this.dynamicTableRef) {
1379
+ this.dynamicTableRef.clear();
1380
+ }
1381
+ // MEMORY LEAK FIX: Clear compiled template caches
1382
+ this.rowActionsCompiledTl = {};
1383
+ this.rowFilterCompliedTl = {};
1384
+ this.inlineCompliedTl = {};
1385
+ this.inlineNewCompliedTl = {};
1386
+ this.customExprCompiledTl = {};
1387
+ this.customExprCompiledSummaryTl = {};
1388
+ this.rowDefInstances = {};
1389
+ this.rowDefMap = {};
1390
+ this.rowExpansionActionTl = {};
1391
+ // MEMORY LEAK FIX: Clear dynamic context
1392
+ if (this._dynamicContext) {
1393
+ Object.keys(this._dynamicContext).forEach(key => {
1394
+ delete this._dynamicContext[key];
1395
+ });
1396
+ this._dynamicContext = null;
1397
+ }
1398
+ // MEMORY LEAK FIX: Clear data arrays
1399
+ this._gridData = [];
1400
+ this.items = [];
1401
+ this.selectedItems = [];
1402
+ this.fieldDefs = [];
1403
+ this.fullFieldDefs = [];
1404
+ this.gridData = [];
1405
+ this.__fullData = null;
1406
+ // MEMORY LEAK FIX: Destroy jQuery datatable widget before clearing gridOptions
1407
+ if (this.datagridElement && this.datagridElement.datatable) {
1408
+ try {
1409
+ this.datagridElement.datatable('destroy');
1410
+ }
1411
+ catch (e) {
1412
+ // Ignore errors during destroy
1413
+ }
1414
+ }
1415
+ // MEMORY LEAK FIX: Clear gridOptions to release all function closures and data
1416
+ // gridOptions holds many closures that capture 'this' and prevent GC
1417
+ if (this.gridOptions) {
1418
+ // Clear data array
1419
+ if (this.gridOptions.data) {
1420
+ this.gridOptions.data = [];
1421
+ }
1422
+ // Clear column definitions
1423
+ if (this.gridOptions.colDefs) {
1424
+ this.gridOptions.colDefs = [];
1425
+ }
1426
+ // Clear row actions
1427
+ if (this.gridOptions.rowActions) {
1428
+ this.gridOptions.rowActions = [];
1429
+ }
1430
+ // Clear header config
1431
+ if (this.gridOptions.headerConfig) {
1432
+ this.gridOptions.headerConfig = [];
1433
+ }
1434
+ // Nullify all function references to break closures
1435
+ Object.keys(this.gridOptions).forEach(key => {
1436
+ if (typeof this.gridOptions[key] === 'function') {
1437
+ this.gridOptions[key] = null;
1438
+ }
1439
+ });
1440
+ }
1441
+ // MEMORY LEAK FIX: Clear other data structures
1442
+ this.columns = {};
1443
+ this.formfields = {};
1444
+ this.rowFilter = {};
1445
+ this.actions = [];
1446
+ this._actions = { header: [], footer: [] };
1447
+ this.exportOptions = [];
1448
+ this.headerConfig = [];
1449
+ this.rowActions = [];
1450
+ // MEMORY LEAK FIX: Clear all @ContentChildren QueryLists holding template references
1451
+ // These QueryLists hold TemplateRef instances that create circular references to the parent LView
1452
+ if (this.rowActionTmpl) {
1453
+ this.rowActionTmpl.reset([]);
1454
+ }
1455
+ if (this.filterTmpl) {
1456
+ this.filterTmpl.reset([]);
1457
+ }
1458
+ if (this.inlineWidgetTmpl) {
1459
+ this.inlineWidgetTmpl.reset([]);
1460
+ }
1461
+ if (this.inlineWidgetNewTmpl) {
1462
+ this.inlineWidgetNewTmpl.reset([]);
1463
+ }
1464
+ if (this.customExprTmpl) {
1465
+ this.customExprTmpl.reset([]);
1466
+ }
1467
+ if (this.rowExpansionActionTmpl) {
1468
+ this.rowExpansionActionTmpl.reset([]);
1469
+ }
1470
+ // MEMORY LEAK FIX: Clear @ContentChild template reference
1471
+ this.rowExpansionTmpl = null;
1472
+ // MEMORY LEAK FIX: Complete and clear subjects
1473
+ if (this.selectedItemChange) {
1474
+ this.selectedItemChange.complete();
1475
+ this.selectedItemChange = null;
1476
+ }
1477
+ // MEMORY LEAK FIX: Clear ViewChild references
1478
+ this.dataNavigator = null;
1479
+ this._tableElement = null;
1480
+ // console.log("table component destroyed");
1328
1481
  super.ngOnDestroy();
1329
1482
  }
1330
1483
  addRowIndex(row) {
@@ -1395,6 +1548,9 @@ class TableComponent extends StylableComponent {
1395
1548
  if (!key.endsWith('_filter') && ((key.endsWith('_new') && newRow) || (!key.endsWith('_new') && !newRow))) {
1396
1549
  ctrls[key].setValue('');
1397
1550
  this.resetFormControl(ctrls[key]);
1551
+ // MEMORY LEAK FIX: Clear validators to release references
1552
+ ctrls[key].clearValidators();
1553
+ ctrls[key].clearAsyncValidators();
1398
1554
  }
1399
1555
  });
1400
1556
  }
@@ -1714,7 +1870,14 @@ class TableComponent extends StylableComponent {
1714
1870
  defaultFieldDefs.forEach(col => {
1715
1871
  this.columns[col.field] = col;
1716
1872
  });
1717
- this.invokeEventCallback('beforedatarender', { $data: data, $columns: this.columns, data: data, columns: this.columns });
1873
+ // Note: Errors in beforedatarender should not prevent table rendering
1874
+ try {
1875
+ this.invokeEventCallback('beforedatarender', { $data: data, $columns: this.columns, data: data, columns: this.columns });
1876
+ }
1877
+ catch (error) {
1878
+ // Log error but continue with rendering - beforedatarender errors should not block table rendering
1879
+ console.warn('Error in beforedatarender event callback, continuing with table rendering:', error);
1880
+ }
1718
1881
  defaultFieldDefs = [];
1719
1882
  // Apply the changes made by the user
1720
1883
  forEach(this.columns, val => {
@@ -1753,23 +1916,30 @@ class TableComponent extends StylableComponent {
1753
1916
  return sortExp || '';
1754
1917
  }
1755
1918
  onPropertyChange(key, nv, ov) {
1919
+ // Guard against property changes after component destruction
1920
+ if (this.isDestroyed) {
1921
+ return;
1922
+ }
1756
1923
  let enableNewRow, widgetState;
1757
1924
  switch (key) {
1758
1925
  case 'datasource':
1759
1926
  // Fix for [WMS-23653] when startUpdate is false (request on page load property is unchecked),
1760
1927
  // then set status msg as "No data found"
1761
- if (this.allowpagesizechange) {
1928
+ if (this.allowpagesizechange && this.datasource) {
1762
1929
  this.datasource.maxResults = this.pagesize || this.datasource.maxResults;
1763
1930
  }
1764
- if (nv.startUpdate === false) {
1931
+ if (nv && nv.startUpdate === false) {
1765
1932
  this.variableInflight = false;
1766
1933
  this.callDataGridMethod('setStatus', 'nodata', this.nodatamessage);
1767
1934
  }
1768
- if (get(this.datasource, 'category') !== 'wm.Variable') {
1935
+ if (this.datasource && get(this.datasource, 'category') !== 'wm.Variable') {
1769
1936
  this.headerselectall = false;
1770
1937
  this.setDataGridOption("headerselectall", false);
1771
1938
  }
1772
- this.watchVariableDataSet(this.dataset);
1939
+ // Process dataset when datasource is set, especially if dataset was previously skipped
1940
+ if (this.datasource && this.dataset !== undefined) {
1941
+ this.watchVariableDataSet(this.dataset);
1942
+ }
1773
1943
  this.onDataSourceChange();
1774
1944
  break;
1775
1945
  case 'dataset':
@@ -1777,6 +1947,12 @@ class TableComponent extends StylableComponent {
1777
1947
  this.gridOptions.setIsNextPageData(false);
1778
1948
  }
1779
1949
  if (this.binddatasource && !this.datasource) {
1950
+ // If datasource is not set yet, clear loading state and show no data
1951
+ // This prevents tables from being stuck in loading state
1952
+ if (this.variableInflight) {
1953
+ this.variableInflight = false;
1954
+ this.callDataGridMethod('setStatus', 'nodata', this.nodatamessage);
1955
+ }
1780
1956
  return;
1781
1957
  }
1782
1958
  // if table is inside list then table dataset will be set as "item.XXX" and there is no datasource.
@@ -1880,9 +2056,11 @@ class TableComponent extends StylableComponent {
1880
2056
  this.allowpagesizechange = nv;
1881
2057
  break;
1882
2058
  case 'pagesizeoptions':
1883
- this.gridOptions.pagesizeoptions = nv;
1884
- this.pagesizeoptions = nv;
1885
- this.setDefaultPageSize(nv);
2059
+ this.prevPagesizeoptions = this.sanitizeCommaSeparatedIntegers(ov);
2060
+ this.gridOptions.pagesizeoptions = this.sanitizeCommaSeparatedIntegers(nv);
2061
+ this.pagesizeoptions = this.sanitizeCommaSeparatedIntegers(nv);
2062
+ if (this.allowpagesizechange)
2063
+ this.setDefaultPageSize(nv);
1886
2064
  break;
1887
2065
  case 'multiselecttitle':
1888
2066
  this.setDataGridOption('multiselecttitle', nv);
@@ -1926,12 +2104,41 @@ class TableComponent extends StylableComponent {
1926
2104
  this.pagesize = nv;
1927
2105
  }
1928
2106
  this.updatedPageSize = nv;
2107
+ if (this.isPageSizeOptionsChanged()) {
2108
+ this.dataNavigator.defaultPageSizeOptions = this.pagesizeoptions?.split(',').map(Number).sort((a, b) => a - b) || [];
2109
+ this.dataNavigator.pageSizeOptions = [...this.dataNavigator.defaultPageSizeOptions];
2110
+ }
1929
2111
  }
1930
2112
  this.dataNavigator.options = {
1931
2113
  maxResults: nv
1932
2114
  };
1933
2115
  this.dataNavigator.widget.maxResults = nv;
1934
2116
  this.dataNavigator.maxResults = nv;
2117
+ if (this.datasource) {
2118
+ this.datasource.maxResults = this.pagesize || this.datasource.maxResults;
2119
+ }
2120
+ }
2121
+ isPageSizeOptionsChanged() {
2122
+ return !isEqual(this.prevPagesizeoptions, this.pagesizeoptions);
2123
+ }
2124
+ selectPageSize(pagesize) {
2125
+ if (!this.allowpagesizechange && !pagesize)
2126
+ return;
2127
+ if (pagesize < this.dataNavigator.pageSizeOptions[0] || pagesize > this.dataNavigator.pageSizeOptions[this.dataNavigator.pageSizeOptions.length - 1]
2128
+ || !this.dataNavigator.pageSizeOptions.includes(Number(pagesize))) {
2129
+ pagesize = this.dataNavigator.pageSizeOptions[0];
2130
+ }
2131
+ this.dataNavigator.onPageSizeChange(undefined, pagesize);
2132
+ }
2133
+ sanitizeCommaSeparatedIntegers(input) {
2134
+ if (!input)
2135
+ return "";
2136
+ const uniqueNumbers = Array.from(new Set(input
2137
+ .split(",")
2138
+ .map(v => v.trim())
2139
+ .filter(v => /^-?\d+$/.test(v))
2140
+ .map(v => Math.abs(parseInt(v, 10)))));
2141
+ return uniqueNumbers.join(",");
1935
2142
  }
1936
2143
  onDataSourceChange() {
1937
2144
  this.fieldDefs.forEach(col => {