@wavemaker/app-ng-runtime 11.14.1-6.6324 → 11.14.1-8.6337

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 (50) hide show
  1. package/components/base/bundles/index.umd.js +74 -7
  2. package/components/base/esm2022/pipes/custom-pipes.mjs +1 -1
  3. package/components/base/esm2022/widgets/common/base/base.component.mjs +67 -7
  4. package/components/base/esm2022/widgets/common/lazy-load/lazy-load.directive.mjs +4 -2
  5. package/components/base/esm2022/widgets/framework/property-change-handler.mjs +7 -2
  6. package/components/base/fesm2022/index.mjs +75 -8
  7. package/components/base/fesm2022/index.mjs.map +1 -1
  8. package/components/basic/label/bundles/index.umd.js +9 -1
  9. package/components/basic/label/esm2022/label.directive.mjs +10 -2
  10. package/components/basic/label/fesm2022/index.mjs +9 -1
  11. package/components/basic/label/fesm2022/index.mjs.map +1 -1
  12. package/components/data/pagination/bundles/index.umd.js +4 -0
  13. package/components/data/pagination/esm2022/pagination.component.mjs +5 -1
  14. package/components/data/pagination/fesm2022/index.mjs +4 -0
  15. package/components/data/pagination/fesm2022/index.mjs.map +1 -1
  16. package/components/data/table/bundles/index.umd.js +226 -13
  17. package/components/data/table/esm2022/table-cud.directive.mjs +2 -2
  18. package/components/data/table/esm2022/table-filter.directive.mjs +8 -2
  19. package/components/data/table/esm2022/table.component.mjs +219 -12
  20. package/components/data/table/fesm2022/index.mjs +226 -13
  21. package/components/data/table/fesm2022/index.mjs.map +1 -1
  22. package/components/data/table/table.component.d.ts +6 -2
  23. package/components/navigation/menu/bundles/index.umd.js +5 -0
  24. package/components/navigation/menu/esm2022/menu.component.mjs +6 -1
  25. package/components/navigation/menu/fesm2022/index.mjs +5 -0
  26. package/components/navigation/menu/fesm2022/index.mjs.map +1 -1
  27. package/components/navigation/popover/bundles/index.umd.js +6 -6
  28. package/components/navigation/popover/esm2022/popover.component.mjs +4 -4
  29. package/components/navigation/popover/fesm2022/index.mjs +3 -3
  30. package/components/navigation/popover/fesm2022/index.mjs.map +1 -1
  31. package/components/navigation/popover/popover.component.d.ts +6 -0
  32. package/core/bundles/index.umd.js +395 -82
  33. package/core/esm2022/public_api.mjs +2 -2
  34. package/core/esm2022/utils/watcher.mjs +392 -81
  35. package/core/fesm2022/index.mjs +395 -84
  36. package/core/fesm2022/index.mjs.map +1 -1
  37. package/core/public_api.d.ts +1 -1
  38. package/core/utils/watcher.d.ts +28 -5
  39. package/npm-shrinkwrap.json +2 -2
  40. package/package-lock.json +2 -2
  41. package/package.json +1 -1
  42. package/runtime/base/bundles/index.umd.js +20 -0
  43. package/runtime/base/esm2022/components/app-component/app.component.mjs +4 -2
  44. package/runtime/base/esm2022/components/base-page.component.mjs +6 -2
  45. package/runtime/base/esm2022/components/base-partial.component.mjs +7 -2
  46. package/runtime/base/esm2022/components/base-prefab.component.mjs +7 -2
  47. package/runtime/base/esm2022/components/base-spa-page.component.mjs +6 -2
  48. package/runtime/base/fesm2022/index.mjs +21 -1
  49. package/runtime/base/fesm2022/index.mjs.map +1 -1
  50. package/scripts/datatable/datatable.js +34 -2
@@ -186,8 +186,15 @@
186
186
  this.setDataGridOption('colDefs', i2.getClonedObject(this.fieldDefs));
187
187
  }
188
188
  // If data and colDefs are present, call on before data render event
189
+ // Note: Errors in beforedatarender should not prevent table rendering
189
190
  if (!this.isdynamictable && !lodashEs.isEmpty(newValue) && gridOptions.colDefs.length) {
190
- this.invokeEventCallback('beforedatarender', { $data: this._gridData, $columns: this.columns, data: this._gridData, columns: this.columns });
191
+ try {
192
+ this.invokeEventCallback('beforedatarender', { $data: this._gridData, $columns: this.columns, data: this._gridData, columns: this.columns });
193
+ }
194
+ catch (error) {
195
+ // Log error but continue with rendering - beforedatarender errors should not block table rendering
196
+ console.warn('Error in beforedatarender event callback, continuing with table rendering:', error);
197
+ }
191
198
  }
192
199
  this.setDataGridOption('data', i2.getClonedObject(this._gridData));
193
200
  }
@@ -580,7 +587,7 @@
580
587
  this.prevData = i2.getClonedObject(row);
581
588
  },
582
589
  afterRowUpdate: (row, e, callBack, options) => {
583
- this.updateRecord(lodashEs.extend({}, options, { row, 'prevData': this.prevData, 'event': e, 'callBack': callBack }));
590
+ this.updateRecord(lodashEs.extend({}, options, { row, 'prevData': options.rowindex ? options.rowindex : this.prevData, 'event': e, 'callBack': callBack }));
584
591
  },
585
592
  onBeforeRowUpdate: (row, e, options) => {
586
593
  return this.invokeEventCallback('beforerowupdate', { $event: e, $data: row, row, options: options });
@@ -1234,6 +1241,10 @@
1234
1241
  return this.actualPageSize || 5;
1235
1242
  }
1236
1243
  watchVariableDataSet(newVal) {
1244
+ // Guard against component destruction
1245
+ if (this.isDestroyed) {
1246
+ return;
1247
+ }
1237
1248
  let result;
1238
1249
  // Check for Variable filters if applied
1239
1250
  if (this.gridOptions.isNavTypeScrollOrOndemand()) {
@@ -1291,6 +1302,12 @@
1291
1302
  }
1292
1303
  /*Return if data is invalid.*/
1293
1304
  if (!this.isDataValid()) {
1305
+ // If data is invalid and variableInflight is still true, clear loading state
1306
+ // This prevents tables from getting stuck in loading when data is invalid
1307
+ if (this.variableInflight) {
1308
+ this.variableInflight = false;
1309
+ this.setGridData([]);
1310
+ }
1294
1311
  return;
1295
1312
  }
1296
1313
  // If value is empty or in studio mode, dont enable the navigation
@@ -1318,7 +1335,13 @@
1318
1335
  // @ts-ignore
1319
1336
  if (!lodashEs.isObject(newVal) || newVal === '' || (newVal && newVal.dataValue === '')) {
1320
1337
  if (!this.variableInflight) {
1321
- // If variable has finished loading and resultSet is empty, ender empty data
1338
+ // If variable has finished loading and resultSet is empty, render empty data
1339
+ this.setGridData([]);
1340
+ }
1341
+ else {
1342
+ // If variableInflight is still true but we have invalid/empty data, clear loading state
1343
+ // This handles cases where data never arrives or is invalid
1344
+ this.variableInflight = false;
1322
1345
  this.setGridData([]);
1323
1346
  }
1324
1347
  return;
@@ -1328,13 +1351,143 @@
1328
1351
  }
1329
1352
  }
1330
1353
  ngOnDestroy() {
1354
+ // MEMORY LEAK FIX: Remove document click listener
1331
1355
  document.removeEventListener('click', this.documentClickBind);
1356
+ // MEMORY LEAK FIX: Unsubscribe from navigator watches
1332
1357
  if (this.navigatorResultWatch) {
1333
1358
  this.navigatorResultWatch.unsubscribe();
1359
+ this.navigatorResultWatch = null;
1334
1360
  }
1335
1361
  if (this.navigatorMaxResultWatch) {
1336
1362
  this.navigatorMaxResultWatch.unsubscribe();
1363
+ this.navigatorMaxResultWatch = null;
1364
+ }
1365
+ // MEMORY LEAK FIX: Clear all ViewContainerRef embedded views
1366
+ // These hold references to row data, custom expressions, and inline widgets
1367
+ if (this.customExprViewRef) {
1368
+ this.customExprViewRef.clear();
1369
+ }
1370
+ if (this.rowActionsViewRef) {
1371
+ this.rowActionsViewRef.clear();
1372
+ }
1373
+ if (this.filterViewRef) {
1374
+ this.filterViewRef.clear();
1375
+ }
1376
+ if (this.inlineEditViewRef) {
1377
+ this.inlineEditViewRef.clear();
1378
+ }
1379
+ if (this.inlineEditNewViewRef) {
1380
+ this.inlineEditNewViewRef.clear();
1381
+ }
1382
+ if (this.rowDetailViewRef) {
1383
+ this.rowDetailViewRef.clear();
1337
1384
  }
1385
+ if (this.rowExpansionActionViewRef) {
1386
+ this.rowExpansionActionViewRef.clear();
1387
+ }
1388
+ if (this.dynamicTableRef) {
1389
+ this.dynamicTableRef.clear();
1390
+ }
1391
+ // MEMORY LEAK FIX: Clear compiled template caches
1392
+ this.rowActionsCompiledTl = {};
1393
+ this.rowFilterCompliedTl = {};
1394
+ this.inlineCompliedTl = {};
1395
+ this.inlineNewCompliedTl = {};
1396
+ this.customExprCompiledTl = {};
1397
+ this.customExprCompiledSummaryTl = {};
1398
+ this.rowDefInstances = {};
1399
+ this.rowDefMap = {};
1400
+ this.rowExpansionActionTl = {};
1401
+ // MEMORY LEAK FIX: Clear dynamic context
1402
+ if (this._dynamicContext) {
1403
+ Object.keys(this._dynamicContext).forEach(key => {
1404
+ delete this._dynamicContext[key];
1405
+ });
1406
+ this._dynamicContext = null;
1407
+ }
1408
+ // MEMORY LEAK FIX: Clear data arrays
1409
+ this._gridData = [];
1410
+ this.items = [];
1411
+ this.selectedItems = [];
1412
+ this.fieldDefs = [];
1413
+ this.fullFieldDefs = [];
1414
+ this.gridData = [];
1415
+ this.__fullData = null;
1416
+ // MEMORY LEAK FIX: Destroy jQuery datatable widget before clearing gridOptions
1417
+ if (this.datagridElement && this.datagridElement.datatable) {
1418
+ try {
1419
+ this.datagridElement.datatable('destroy');
1420
+ }
1421
+ catch (e) {
1422
+ // Ignore errors during destroy
1423
+ }
1424
+ }
1425
+ // MEMORY LEAK FIX: Clear gridOptions to release all function closures and data
1426
+ // gridOptions holds many closures that capture 'this' and prevent GC
1427
+ if (this.gridOptions) {
1428
+ // Clear data array
1429
+ if (this.gridOptions.data) {
1430
+ this.gridOptions.data = [];
1431
+ }
1432
+ // Clear column definitions
1433
+ if (this.gridOptions.colDefs) {
1434
+ this.gridOptions.colDefs = [];
1435
+ }
1436
+ // Clear row actions
1437
+ if (this.gridOptions.rowActions) {
1438
+ this.gridOptions.rowActions = [];
1439
+ }
1440
+ // Clear header config
1441
+ if (this.gridOptions.headerConfig) {
1442
+ this.gridOptions.headerConfig = [];
1443
+ }
1444
+ // Nullify all function references to break closures
1445
+ Object.keys(this.gridOptions).forEach(key => {
1446
+ if (typeof this.gridOptions[key] === 'function') {
1447
+ this.gridOptions[key] = null;
1448
+ }
1449
+ });
1450
+ }
1451
+ // MEMORY LEAK FIX: Clear other data structures
1452
+ this.columns = {};
1453
+ this.formfields = {};
1454
+ this.rowFilter = {};
1455
+ this.actions = [];
1456
+ this._actions = { header: [], footer: [] };
1457
+ this.exportOptions = [];
1458
+ this.headerConfig = [];
1459
+ this.rowActions = [];
1460
+ // MEMORY LEAK FIX: Clear all @ContentChildren QueryLists holding template references
1461
+ // These QueryLists hold TemplateRef instances that create circular references to the parent LView
1462
+ if (this.rowActionTmpl) {
1463
+ this.rowActionTmpl.reset([]);
1464
+ }
1465
+ if (this.filterTmpl) {
1466
+ this.filterTmpl.reset([]);
1467
+ }
1468
+ if (this.inlineWidgetTmpl) {
1469
+ this.inlineWidgetTmpl.reset([]);
1470
+ }
1471
+ if (this.inlineWidgetNewTmpl) {
1472
+ this.inlineWidgetNewTmpl.reset([]);
1473
+ }
1474
+ if (this.customExprTmpl) {
1475
+ this.customExprTmpl.reset([]);
1476
+ }
1477
+ if (this.rowExpansionActionTmpl) {
1478
+ this.rowExpansionActionTmpl.reset([]);
1479
+ }
1480
+ // MEMORY LEAK FIX: Clear @ContentChild template reference
1481
+ this.rowExpansionTmpl = null;
1482
+ // MEMORY LEAK FIX: Complete and clear subjects
1483
+ if (this.selectedItemChange) {
1484
+ this.selectedItemChange.complete();
1485
+ this.selectedItemChange = null;
1486
+ }
1487
+ // MEMORY LEAK FIX: Clear ViewChild references
1488
+ this.dataNavigator = null;
1489
+ this._tableElement = null;
1490
+ // console.log("table component destroyed");
1338
1491
  super.ngOnDestroy();
1339
1492
  }
1340
1493
  addRowIndex(row) {
@@ -1405,6 +1558,9 @@
1405
1558
  if (!key.endsWith('_filter') && ((key.endsWith('_new') && newRow) || (!key.endsWith('_new') && !newRow))) {
1406
1559
  ctrls[key].setValue('');
1407
1560
  this.resetFormControl(ctrls[key]);
1561
+ // MEMORY LEAK FIX: Clear validators to release references
1562
+ ctrls[key].clearValidators();
1563
+ ctrls[key].clearAsyncValidators();
1408
1564
  }
1409
1565
  });
1410
1566
  }
@@ -1724,7 +1880,14 @@
1724
1880
  defaultFieldDefs.forEach(col => {
1725
1881
  this.columns[col.field] = col;
1726
1882
  });
1727
- this.invokeEventCallback('beforedatarender', { $data: data, $columns: this.columns, data: data, columns: this.columns });
1883
+ // Note: Errors in beforedatarender should not prevent table rendering
1884
+ try {
1885
+ this.invokeEventCallback('beforedatarender', { $data: data, $columns: this.columns, data: data, columns: this.columns });
1886
+ }
1887
+ catch (error) {
1888
+ // Log error but continue with rendering - beforedatarender errors should not block table rendering
1889
+ console.warn('Error in beforedatarender event callback, continuing with table rendering:', error);
1890
+ }
1728
1891
  defaultFieldDefs = [];
1729
1892
  // Apply the changes made by the user
1730
1893
  lodashEs.forEach(this.columns, val => {
@@ -1763,23 +1926,30 @@
1763
1926
  return sortExp || '';
1764
1927
  }
1765
1928
  onPropertyChange(key, nv, ov) {
1929
+ // Guard against property changes after component destruction
1930
+ if (this.isDestroyed) {
1931
+ return;
1932
+ }
1766
1933
  let enableNewRow;
1767
1934
  switch (key) {
1768
1935
  case 'datasource':
1769
1936
  // Fix for [WMS-23653] when startUpdate is false (request on page load property is unchecked),
1770
1937
  // then set status msg as "No data found"
1771
- if (this.allowpagesizechange) {
1938
+ if (this.allowpagesizechange && this.datasource) {
1772
1939
  this.datasource.maxResults = this.pagesize || this.datasource.maxResults;
1773
1940
  }
1774
- if (nv.startUpdate === false) {
1941
+ if (nv && nv.startUpdate === false) {
1775
1942
  this.variableInflight = false;
1776
1943
  this.callDataGridMethod('setStatus', 'nodata', this.nodatamessage);
1777
1944
  }
1778
- if (lodashEs.get(this.datasource, 'category') !== 'wm.Variable') {
1945
+ if (this.datasource && lodashEs.get(this.datasource, 'category') !== 'wm.Variable') {
1779
1946
  this.headerselectall = false;
1780
1947
  this.setDataGridOption("headerselectall", false);
1781
1948
  }
1782
- this.watchVariableDataSet(this.dataset);
1949
+ // Process dataset when datasource is set, especially if dataset was previously skipped
1950
+ if (this.datasource && this.dataset !== undefined) {
1951
+ this.watchVariableDataSet(this.dataset);
1952
+ }
1783
1953
  this.onDataSourceChange();
1784
1954
  break;
1785
1955
  case 'dataset':
@@ -1787,6 +1957,12 @@
1787
1957
  this.gridOptions.setIsNextPageData(false);
1788
1958
  }
1789
1959
  if (this.binddatasource && !this.datasource) {
1960
+ // If datasource is not set yet, clear loading state and show no data
1961
+ // This prevents tables from being stuck in loading state
1962
+ if (this.variableInflight) {
1963
+ this.variableInflight = false;
1964
+ this.callDataGridMethod('setStatus', 'nodata', this.nodatamessage);
1965
+ }
1790
1966
  return;
1791
1967
  }
1792
1968
  // if table is inside list then table dataset will be set as "item.XXX" and there is no datasource.
@@ -1890,9 +2066,11 @@
1890
2066
  this.allowpagesizechange = nv;
1891
2067
  break;
1892
2068
  case 'pagesizeoptions':
1893
- this.gridOptions.pagesizeoptions = nv;
1894
- this.pagesizeoptions = nv;
1895
- this.setDefaultPageSize(nv);
2069
+ this.prevPagesizeoptions = this.sanitizeCommaSeparatedIntegers(ov);
2070
+ this.gridOptions.pagesizeoptions = this.sanitizeCommaSeparatedIntegers(nv);
2071
+ this.pagesizeoptions = this.sanitizeCommaSeparatedIntegers(nv);
2072
+ if (this.allowpagesizechange)
2073
+ this.setDefaultPageSize(nv);
1896
2074
  break;
1897
2075
  case 'multiselecttitle':
1898
2076
  this.setDataGridOption('multiselecttitle', nv);
@@ -1936,12 +2114,41 @@
1936
2114
  this.pagesize = nv;
1937
2115
  }
1938
2116
  this.updatedPageSize = nv;
2117
+ if (this.isPageSizeOptionsChanged()) {
2118
+ this.dataNavigator.defaultPageSizeOptions = this.pagesizeoptions?.split(',').map(Number).sort((a, b) => a - b) || [];
2119
+ this.dataNavigator.pageSizeOptions = [...this.dataNavigator.defaultPageSizeOptions];
2120
+ }
1939
2121
  }
1940
2122
  this.dataNavigator.options = {
1941
2123
  maxResults: nv
1942
2124
  };
1943
2125
  this.dataNavigator.widget.maxResults = nv;
1944
2126
  this.dataNavigator.maxResults = nv;
2127
+ if (this.datasource) {
2128
+ this.datasource.maxResults = this.pagesize || this.datasource.maxResults;
2129
+ }
2130
+ }
2131
+ isPageSizeOptionsChanged() {
2132
+ return !lodashEs.isEqual(this.prevPagesizeoptions, this.pagesizeoptions);
2133
+ }
2134
+ selectPageSize(pagesize) {
2135
+ if (!this.allowpagesizechange && !pagesize)
2136
+ return;
2137
+ if (pagesize < this.dataNavigator.pageSizeOptions[0] || pagesize > this.dataNavigator.pageSizeOptions[this.dataNavigator.pageSizeOptions.length - 1]
2138
+ || !this.dataNavigator.pageSizeOptions.includes(Number(pagesize))) {
2139
+ pagesize = this.dataNavigator.pageSizeOptions[0];
2140
+ }
2141
+ this.dataNavigator.onPageSizeChange(undefined, pagesize);
2142
+ }
2143
+ sanitizeCommaSeparatedIntegers(input) {
2144
+ if (!input)
2145
+ return "";
2146
+ const uniqueNumbers = Array.from(new Set(input
2147
+ .split(",")
2148
+ .map(v => v.trim())
2149
+ .filter(v => /^-?\d+$/.test(v))
2150
+ .map(v => Math.abs(parseInt(v, 10)))));
2151
+ return uniqueNumbers.join(",");
1945
2152
  }
1946
2153
  onDataSourceChange() {
1947
2154
  this.fieldDefs.forEach(col => {
@@ -2467,7 +2674,7 @@
2467
2674
  this.updateVariable(response, options.callBack);
2468
2675
  }
2469
2676
  else if (!this.table.datasource.execute(i2.DataSource.Operation.IS_API_AWARE)) {
2470
- this.table.initiateSelectItem('current', response, undefined, false, options.callBack);
2677
+ this.table.initiateSelectItem('current', response, undefined, this.table.datasource.category === 'wm.Variable', options.callBack);
2471
2678
  }
2472
2679
  i2.triggerFn(options.success, response);
2473
2680
  this.table.invokeEventCallback('rowupdate', { $event: options.event, $data: response, row: response });
@@ -3029,6 +3236,12 @@
3029
3236
  // Function that checks if a given string is a valid date and returns the timestamp if it is, or NaN if it's not.
3030
3237
  parseDateString(dateString) {
3031
3238
  const timestamp = Date.parse(dateString);
3239
+ // handling case when string starts with string and end with number
3240
+ const trimmed = dateString.trim();
3241
+ const monthRegex = /\b(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:t(?:ember)?)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\b/i;
3242
+ if (/^[A-Za-z]+/.test(trimmed) && /\d+$/.test(trimmed) && !monthRegex.test(trimmed)) {
3243
+ return NaN;
3244
+ }
3032
3245
  if (!isNaN(timestamp)) {
3033
3246
  return timestamp;
3034
3247
  }
@@ -3043,7 +3256,7 @@
3043
3256
  const fieldValue = lodashEs.get(lodashEs.find(data, sortObj.field), sortObj.field);
3044
3257
  const isValidDateString = typeof fieldValue === 'string' ? this.parseDateString(fieldValue) : NaN;
3045
3258
  if (!isNaN(isValidDateString)) { // if the field is a date string
3046
- data = lodashEs.orderBy(data, [(item) => this.parseDateString(item[sortObj.field])], [sortObj.direction]);
3259
+ data = lodashEs.orderBy(data, [(item) => this.parseDateString(lodashEs.get(item, sortObj.field))], [sortObj.direction]);
3047
3260
  }
3048
3261
  else if (sortObj.sortBy ? this.table.columns[sortObj.sortBy]?.caseinsensitive : this.table.columns[sortObj.field]?.caseinsensitive) {
3049
3262
  //Fix for [WMS-27505]: Added case-insensitive sorting so that uppercase and lowercase letters are treated the same when sorting.