@wavemaker/app-ng-runtime 11.14.1-33.647787 → 11.14.1-34.647830
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.
- package/build-task/bundles/index.umd.js +1 -1
- package/build-task/esm2022/data/form/form-field/form-field.build.mjs +2 -2
- package/build-task/fesm2022/index.mjs +1 -1
- package/build-task/fesm2022/index.mjs.map +1 -1
- package/components/base/bundles/index.umd.js +71 -17
- package/components/base/esm2022/pipes/custom-pipes.mjs +10 -10
- package/components/base/esm2022/utils/widget-utils.mjs +3 -3
- package/components/base/esm2022/widgets/common/base/base.component.mjs +51 -6
- package/components/base/esm2022/widgets/common/lazy-load/lazy-load.directive.mjs +7 -3
- package/components/base/esm2022/widgets/framework/property-change-handler.mjs +7 -2
- package/components/base/fesm2022/index.mjs +72 -18
- package/components/base/fesm2022/index.mjs.map +1 -1
- package/components/base/pipes/custom-pipes.d.ts +5 -5
- package/components/basic/label/bundles/index.umd.js +9 -1
- package/components/basic/label/esm2022/label.directive.mjs +10 -2
- package/components/basic/label/fesm2022/index.mjs +9 -1
- package/components/basic/label/fesm2022/index.mjs.map +1 -1
- package/components/basic/search/bundles/index.umd.js +2 -2
- package/components/basic/search/esm2022/search.component.mjs +3 -3
- package/components/basic/search/fesm2022/index.mjs +2 -2
- package/components/basic/search/fesm2022/index.mjs.map +1 -1
- package/components/chart/bundles/index.umd.js +2 -2
- package/components/chart/esm2022/chart.utils.mjs +3 -3
- package/components/chart/fesm2022/index.mjs +2 -2
- package/components/chart/fesm2022/index.mjs.map +1 -1
- package/components/containers/wizard/bundles/index.umd.js +21 -2
- package/components/containers/wizard/esm2022/wizard-step/wizard-step.component.mjs +3 -1
- package/components/containers/wizard/esm2022/wizard.component.mjs +20 -3
- package/components/containers/wizard/fesm2022/index.mjs +21 -2
- package/components/containers/wizard/fesm2022/index.mjs.map +1 -1
- package/components/containers/wizard/wizard-step/wizard-step.component.d.ts +2 -0
- package/components/data/pagination/bundles/index.umd.js +6 -1
- package/components/data/pagination/esm2022/pagination.component.mjs +7 -2
- package/components/data/pagination/fesm2022/index.mjs +6 -1
- package/components/data/pagination/fesm2022/index.mjs.map +1 -1
- package/components/data/table/bundles/index.umd.js +546 -28
- package/components/data/table/esm2022/table-action/table-action.directive.mjs +12 -2
- package/components/data/table/esm2022/table-column/table-column.directive.mjs +108 -4
- package/components/data/table/esm2022/table-column-group/table-column-group.directive.mjs +9 -1
- package/components/data/table/esm2022/table-cud.directive.mjs +22 -5
- package/components/data/table/esm2022/table-filter.directive.mjs +43 -4
- package/components/data/table/esm2022/table-row/table-row.directive.mjs +8 -1
- package/components/data/table/esm2022/table-row-action/table-row-action.directive.mjs +8 -1
- package/components/data/table/esm2022/table.component.mjs +345 -19
- package/components/data/table/fesm2022/index.mjs +548 -30
- package/components/data/table/fesm2022/index.mjs.map +1 -1
- package/components/data/table/table-action/table-action.directive.d.ts +3 -2
- package/components/data/table/table-column/table-column.directive.d.ts +3 -2
- package/components/data/table/table-column-group/table-column-group.directive.d.ts +3 -2
- package/components/data/table/table-cud.directive.d.ts +3 -1
- package/components/data/table/table-filter.directive.d.ts +3 -1
- package/components/data/table/table-row/table-row.directive.d.ts +3 -2
- package/components/data/table/table-row-action/table-row-action.directive.d.ts +3 -2
- package/components/data/table/table.component.d.ts +16 -2
- package/components/input/checkboxset/bundles/index.umd.js +2 -2
- package/components/input/checkboxset/esm2022/checkboxset.component.mjs +3 -3
- package/components/input/checkboxset/fesm2022/index.mjs +2 -2
- package/components/input/checkboxset/fesm2022/index.mjs.map +1 -1
- package/components/input/radioset/bundles/index.umd.js +2 -2
- package/components/input/radioset/esm2022/radioset.component.mjs +3 -3
- package/components/input/radioset/fesm2022/index.mjs +2 -2
- package/components/input/radioset/fesm2022/index.mjs.map +1 -1
- package/components/navigation/breadcrumb/bundles/index.umd.js +6 -6
- package/components/navigation/breadcrumb/esm2022/breadcrumb.component.mjs +4 -3
- package/components/navigation/breadcrumb/fesm2022/index.mjs +3 -2
- package/components/navigation/breadcrumb/fesm2022/index.mjs.map +1 -1
- package/components/navigation/menu/bundles/index.umd.js +5 -0
- package/components/navigation/menu/esm2022/menu.component.mjs +6 -1
- package/components/navigation/menu/fesm2022/index.mjs +5 -0
- package/components/navigation/menu/fesm2022/index.mjs.map +1 -1
- package/components/navigation/popover/bundles/index.umd.js +6 -6
- package/components/navigation/popover/esm2022/popover.component.mjs +4 -4
- package/components/navigation/popover/fesm2022/index.mjs +3 -3
- package/components/navigation/popover/fesm2022/index.mjs.map +1 -1
- package/components/navigation/popover/popover.component.d.ts +6 -0
- package/components/page/default/bundles/index.umd.js +1 -0
- package/components/page/default/esm2022/page.directive.mjs +2 -1
- package/components/page/default/fesm2022/index.mjs +1 -0
- package/components/page/default/fesm2022/index.mjs.map +1 -1
- package/core/bundles/index.umd.js +120 -15
- package/core/esm2022/public_api.mjs +2 -2
- package/core/esm2022/utils/utils.mjs +6 -2
- package/core/esm2022/utils/watcher.mjs +118 -15
- package/core/fesm2022/index.mjs +124 -15
- package/core/fesm2022/index.mjs.map +1 -1
- package/core/public_api.d.ts +1 -1
- package/core/utils/utils.d.ts +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package-lock.json +2 -2
- package/package.json +1 -1
- package/runtime/base/bundles/index.umd.js +23 -14
- package/runtime/base/components/base-prefab.component.d.ts +6 -4
- package/runtime/base/esm2022/components/base-page.component.mjs +2 -1
- package/runtime/base/esm2022/components/base-partial.component.mjs +2 -2
- package/runtime/base/esm2022/components/base-prefab.component.mjs +20 -12
- package/runtime/base/esm2022/services/pipe-provider.service.mjs +4 -4
- package/runtime/base/fesm2022/index.mjs +23 -14
- package/runtime/base/fesm2022/index.mjs.map +1 -1
- package/runtime/dynamic/bundles/index.umd.js +4 -0
- package/runtime/dynamic/esm2022/app/app.config.mjs +6 -2
- package/runtime/dynamic/fesm2022/index.mjs +5 -1
- package/runtime/dynamic/fesm2022/index.mjs.map +1 -1
- package/scripts/datatable/datatable.js +359 -35
|
@@ -8,14 +8,14 @@ import { ViewContainerRef, HostListener, ViewChild, ContentChild, ContentChildre
|
|
|
8
8
|
import * as i1 from '@angular/forms';
|
|
9
9
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
10
10
|
import * as i2 from '@wm/core';
|
|
11
|
-
import { isDefined, getClonedObject, closePopover, triggerFn, $appDigest, $unwatch, $watch, DataSource, isDataSourceEqual, isMobile, $invokeWatchers, getValidJSON, extendProto, getDatasourceFromExpr, $parseEvent, extractCurrentItemExpr, isNumberType, DataType, adjustContainerRightEdges, FormWidgetType, isDateTimeType, getDisplayDateTimeFormat } from '@wm/core';
|
|
11
|
+
import { isDefined, getClonedObject, closePopover, triggerFn, $appDigest, $unwatch, $watch, muteWatchers, unMuteWatchers, DataSource, isDataSourceEqual, isMobile, $invokeWatchers, getValidJSON, extendProto, getDatasourceFromExpr, $parseEvent, extractCurrentItemExpr, isNumberType, DataType, adjustContainerRightEdges, FormWidgetType, isDateTimeType, getDisplayDateTimeFormat } from '@wm/core';
|
|
12
12
|
import { Subject } from 'rxjs';
|
|
13
13
|
import * as i4 from '@wm/components/base';
|
|
14
14
|
import { register, PROP_BOOLEAN, PROP_STRING, PROP_NUMBER, PROP_ANY, StylableComponent, DEBOUNCE_TIMES, getConditionalClasses, unsupportedStatePersistenceTypes, styler, extractDataSourceName, EDIT_MODE, getRowOperationsColumn, transformData, prepareFieldDefs, getOrderByExpr, NAVIGATION_TYPE, provideAs, provideAsWidgetRef, refreshDataSource, getMatchModeTypesMap, getMatchModeMsgs, isDataSetWidget, BaseComponent, setHeaderConfigForTable, BaseFieldValidations, applyFilterOnField, getDistinctFieldProperties, getDistinctValues, getWatchIdentifier, fetchRelatedFieldData, getDistinctValuesForField, getEditModeWidget, getDataTableFilterWidget, getDefaultValue, Context } from '@wm/components/base';
|
|
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,
|
|
18
|
+
import { get, isEmpty, floor, debounce, isUndefined, isNaN as isNaN$1, extend, 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';
|
|
@@ -98,7 +98,7 @@ const exportIconMapping = {
|
|
|
98
98
|
const ROW_OPS_FIELD = 'rowOperations';
|
|
99
99
|
const noop = () => { };
|
|
100
100
|
const isInputBodyWrapper = target => {
|
|
101
|
-
const classes = ['.dropdown-menu', '.uib-typeahead-match', '.modal-dialog', '.toast'];
|
|
101
|
+
const classes = ['.dropdown-menu', '.uib-typeahead-match', '.modal-dialog', '.toast', '.bs-datepicker-container'];
|
|
102
102
|
let isInput = false;
|
|
103
103
|
classes.forEach(cls => {
|
|
104
104
|
if (target.closest(cls).length) {
|
|
@@ -119,6 +119,19 @@ const isInputBodyWrapper = target => {
|
|
|
119
119
|
};
|
|
120
120
|
class TableComponent extends StylableComponent {
|
|
121
121
|
static { this.initializeProps = registerProps$5(); }
|
|
122
|
+
/** wm.Variable + inline or quickedit (editmode is string from markup; normalize case). */
|
|
123
|
+
isModelVariableInlineOrQuickEdit() {
|
|
124
|
+
if (get(this.datasource, 'category') !== 'wm.Variable') {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
const em = String(this.editmode || '').toLowerCase();
|
|
128
|
+
return em === 'quickedit' || em === 'inline';
|
|
129
|
+
}
|
|
130
|
+
/** True while an inline/quickedit row save is updating the grid (incl. delayed navigator emit). */
|
|
131
|
+
shouldSoftRefreshAfterModelVarRowSave() {
|
|
132
|
+
return this.isModelVariableInlineOrQuickEdit()
|
|
133
|
+
&& (this._isInlineEditSave || this._modelVarEditSoftRefreshActiveUntil > Date.now());
|
|
134
|
+
}
|
|
122
135
|
set gridData(newValue) {
|
|
123
136
|
this.isDataLoading = false;
|
|
124
137
|
// Fix for [WMS-24012]: hide no datafound msg when variableInflight is true and dataset is empty
|
|
@@ -176,10 +189,24 @@ class TableComponent extends StylableComponent {
|
|
|
176
189
|
this.setDataGridOption('colDefs', getClonedObject(this.fieldDefs));
|
|
177
190
|
}
|
|
178
191
|
// If data and colDefs are present, call on before data render event
|
|
192
|
+
// Note: Errors in beforedatarender should not prevent table rendering
|
|
179
193
|
if (!this.isdynamictable && !isEmpty(newValue) && gridOptions.colDefs.length) {
|
|
180
|
-
|
|
194
|
+
try {
|
|
195
|
+
this.invokeEventCallback('beforedatarender', { $data: this._gridData, $columns: this.columns, data: this._gridData, columns: this.columns });
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
// Log error but continue with rendering - beforedatarender errors should not block table rendering
|
|
199
|
+
console.warn('Error in beforedatarender event callback, continuing with table rendering:', error);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (this.shouldSoftRefreshAfterModelVarRowSave()) {
|
|
203
|
+
const clonedData = getClonedObject(this._gridData);
|
|
204
|
+
this.gridOptions.data = clonedData;
|
|
205
|
+
this.callDataGridMethod('softRefreshData', clonedData);
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
this.setDataGridOption('data', getClonedObject(this._gridData));
|
|
181
209
|
}
|
|
182
|
-
this.setDataGridOption('data', getClonedObject(this._gridData));
|
|
183
210
|
}
|
|
184
211
|
}
|
|
185
212
|
get gridData() {
|
|
@@ -232,6 +259,8 @@ class TableComponent extends StylableComponent {
|
|
|
232
259
|
this.formfields = {};
|
|
233
260
|
this.enablesort = true;
|
|
234
261
|
this.showviewlessbutton = false;
|
|
262
|
+
/** Covers async navigator/dataset updates after inline/quickedit save (wm.Variable). */
|
|
263
|
+
this._modelVarEditSoftRefreshActiveUntil = 0;
|
|
235
264
|
this.primaryKey = [];
|
|
236
265
|
this.selectedItems = [];
|
|
237
266
|
this.selectedItemChange = new Subject();
|
|
@@ -570,7 +599,25 @@ class TableComponent extends StylableComponent {
|
|
|
570
599
|
this.prevData = getClonedObject(row);
|
|
571
600
|
},
|
|
572
601
|
afterRowUpdate: (row, e, callBack, options) => {
|
|
573
|
-
|
|
602
|
+
const isModelVarInlineOrQuick = this.isModelVariableInlineOrQuickEdit();
|
|
603
|
+
if (isModelVarInlineOrQuick) {
|
|
604
|
+
this._isInlineEditSave = true;
|
|
605
|
+
// Inline save triggers navigatePage / dataset emit asynchronously; a
|
|
606
|
+
// microtask timeout cleared the flag before gridData ran → full rerender.
|
|
607
|
+
this._modelVarEditSoftRefreshActiveUntil = Date.now() + 550;
|
|
608
|
+
}
|
|
609
|
+
muteWatchers();
|
|
610
|
+
const v = get(this.datasource, 'category') === 'wm.Variable' && options && options.rowindex != null;
|
|
611
|
+
this.updateRecord(extend({}, options, { row, prevData: v ? options.rowindex : this.prevData, event: e, callBack }));
|
|
612
|
+
setTimeout(() => {
|
|
613
|
+
unMuteWatchers();
|
|
614
|
+
if (isModelVarInlineOrQuick) {
|
|
615
|
+
setTimeout(() => {
|
|
616
|
+
this._isInlineEditSave = false;
|
|
617
|
+
this._modelVarEditSoftRefreshActiveUntil = 0;
|
|
618
|
+
}, 520);
|
|
619
|
+
}
|
|
620
|
+
}, 10);
|
|
574
621
|
},
|
|
575
622
|
onBeforeRowUpdate: (row, e, options) => {
|
|
576
623
|
return this.invokeEventCallback('beforerowupdate', { $event: e, $data: row, row, options: options });
|
|
@@ -642,11 +689,67 @@ class TableComponent extends StylableComponent {
|
|
|
642
689
|
this.customExprCompiledTl = {};
|
|
643
690
|
this.customExprCompiledSummaryTl = {};
|
|
644
691
|
},
|
|
692
|
+
updateCustomExpressionContexts: (preparedData) => {
|
|
693
|
+
const viewCount = this.customExprViewRef.length;
|
|
694
|
+
for (let i = 0; i < viewCount; i++) {
|
|
695
|
+
const viewRef = this.customExprViewRef.get(i);
|
|
696
|
+
if (!viewRef || !viewRef.context || !viewRef.context.row || viewRef.context.row.$index === undefined) {
|
|
697
|
+
continue;
|
|
698
|
+
}
|
|
699
|
+
const existingRow = viewRef.context.row;
|
|
700
|
+
const rowIndex = existingRow.$index - 1;
|
|
701
|
+
const dataRow = preparedData[rowIndex];
|
|
702
|
+
if (!dataRow) {
|
|
703
|
+
continue;
|
|
704
|
+
}
|
|
705
|
+
Object.keys(dataRow).forEach(key => {
|
|
706
|
+
if (key !== '$$index' && key !== '$$pk') {
|
|
707
|
+
existingRow[key] = dataRow[key];
|
|
708
|
+
}
|
|
709
|
+
});
|
|
710
|
+
existingRow.$isFirst = existingRow.$index === 1;
|
|
711
|
+
existingRow.$isLast = this.gridData.length === existingRow.$index;
|
|
712
|
+
viewRef.markForCheck();
|
|
713
|
+
}
|
|
714
|
+
},
|
|
645
715
|
clearRowDetailExpression: () => {
|
|
646
716
|
this.rowDetailViewRef.clear();
|
|
647
717
|
this.rowDefMap = {};
|
|
648
718
|
this.rowDefInstances = {};
|
|
649
719
|
},
|
|
720
|
+
invalidateRowDetailCache: (preparedData) => {
|
|
721
|
+
this.rowDefMap = {};
|
|
722
|
+
this.rowDefInstances = {};
|
|
723
|
+
// Update existing row detail view contexts in-place so currently
|
|
724
|
+
// expanded partials pick up the new row data via change detection.
|
|
725
|
+
const viewCount = this.rowDetailViewRef.length;
|
|
726
|
+
for (let i = 0; i < viewCount; i++) {
|
|
727
|
+
const viewRef = this.rowDetailViewRef.get(i);
|
|
728
|
+
if (!viewRef || !viewRef.context || !viewRef.context.row) {
|
|
729
|
+
continue;
|
|
730
|
+
}
|
|
731
|
+
const existingRow = viewRef.context.row;
|
|
732
|
+
const rowIndex = existingRow.$index - 1;
|
|
733
|
+
const dataRow = preparedData[rowIndex];
|
|
734
|
+
if (!dataRow) {
|
|
735
|
+
continue;
|
|
736
|
+
}
|
|
737
|
+
Object.keys(dataRow).forEach(key => {
|
|
738
|
+
if (key !== '$$index' && key !== '$$pk') {
|
|
739
|
+
existingRow[key] = dataRow[key];
|
|
740
|
+
}
|
|
741
|
+
});
|
|
742
|
+
viewRef.markForCheck();
|
|
743
|
+
}
|
|
744
|
+
},
|
|
745
|
+
refreshSelectedItems: () => {
|
|
746
|
+
const selectedRows = this.callDataGridMethod('getSelectedRows');
|
|
747
|
+
if (selectedRows.length) {
|
|
748
|
+
this.items.length = 0;
|
|
749
|
+
selectedRows.forEach(row => this.items.push(row));
|
|
750
|
+
this.selectedItemChange.next(selectedRows);
|
|
751
|
+
}
|
|
752
|
+
},
|
|
650
753
|
generateCustomExpressions: (rowData, index, summaryRow) => {
|
|
651
754
|
const row = this.getClonedRowObject(rowData);
|
|
652
755
|
const compileTemplate = (tmpl) => {
|
|
@@ -1108,7 +1211,9 @@ class TableComponent extends StylableComponent {
|
|
|
1108
1211
|
this.applyProps.forEach(args => this.callDataGridMethod(...args));
|
|
1109
1212
|
if (this.editmode === EDIT_MODE.QUICK_EDIT) {
|
|
1110
1213
|
this.documentClickBind = this._documentClickBind.bind(this);
|
|
1111
|
-
|
|
1214
|
+
// Use capture phase so a click on another grid (which calls stopPropagation) still reaches this
|
|
1215
|
+
// listener and lets the current grid save/close its editing row.
|
|
1216
|
+
document.addEventListener('click', this.documentClickBind, true);
|
|
1112
1217
|
}
|
|
1113
1218
|
}
|
|
1114
1219
|
getConfiguredState() {
|
|
@@ -1224,6 +1329,10 @@ class TableComponent extends StylableComponent {
|
|
|
1224
1329
|
return this.actualPageSize || 5;
|
|
1225
1330
|
}
|
|
1226
1331
|
watchVariableDataSet(newVal) {
|
|
1332
|
+
// Guard against component destruction
|
|
1333
|
+
if (this.isDestroyed) {
|
|
1334
|
+
return;
|
|
1335
|
+
}
|
|
1227
1336
|
let result;
|
|
1228
1337
|
// Check for Variable filters if applied
|
|
1229
1338
|
if (this.gridOptions.isNavTypeScrollOrOndemand()) {
|
|
@@ -1281,6 +1390,12 @@ class TableComponent extends StylableComponent {
|
|
|
1281
1390
|
}
|
|
1282
1391
|
/*Return if data is invalid.*/
|
|
1283
1392
|
if (!this.isDataValid()) {
|
|
1393
|
+
// If data is invalid and variableInflight is still true, clear loading state
|
|
1394
|
+
// This prevents tables from getting stuck in loading when data is invalid
|
|
1395
|
+
if (this.variableInflight) {
|
|
1396
|
+
this.variableInflight = false;
|
|
1397
|
+
this.setGridData([]);
|
|
1398
|
+
}
|
|
1284
1399
|
return;
|
|
1285
1400
|
}
|
|
1286
1401
|
// If value is empty or in studio mode, dont enable the navigation
|
|
@@ -1308,7 +1423,13 @@ class TableComponent extends StylableComponent {
|
|
|
1308
1423
|
// @ts-ignore
|
|
1309
1424
|
if (!isObject(newVal) || newVal === '' || (newVal && newVal.dataValue === '')) {
|
|
1310
1425
|
if (!this.variableInflight) {
|
|
1311
|
-
// If variable has finished loading and resultSet is empty,
|
|
1426
|
+
// If variable has finished loading and resultSet is empty, render empty data
|
|
1427
|
+
this.setGridData([]);
|
|
1428
|
+
}
|
|
1429
|
+
else {
|
|
1430
|
+
// If variableInflight is still true but we have invalid/empty data, clear loading state
|
|
1431
|
+
// This handles cases where data never arrives or is invalid
|
|
1432
|
+
this.variableInflight = false;
|
|
1312
1433
|
this.setGridData([]);
|
|
1313
1434
|
}
|
|
1314
1435
|
return;
|
|
@@ -1318,13 +1439,144 @@ class TableComponent extends StylableComponent {
|
|
|
1318
1439
|
}
|
|
1319
1440
|
}
|
|
1320
1441
|
ngOnDestroy() {
|
|
1321
|
-
|
|
1442
|
+
this._modelVarEditSoftRefreshActiveUntil = 0;
|
|
1443
|
+
this._isInlineEditSave = false;
|
|
1444
|
+
// MEMORY LEAK FIX: Remove document click listener
|
|
1445
|
+
document.removeEventListener('click', this.documentClickBind, true);
|
|
1446
|
+
// MEMORY LEAK FIX: Unsubscribe from navigator watches
|
|
1322
1447
|
if (this.navigatorResultWatch) {
|
|
1323
1448
|
this.navigatorResultWatch.unsubscribe();
|
|
1449
|
+
this.navigatorResultWatch = null;
|
|
1324
1450
|
}
|
|
1325
1451
|
if (this.navigatorMaxResultWatch) {
|
|
1326
1452
|
this.navigatorMaxResultWatch.unsubscribe();
|
|
1453
|
+
this.navigatorMaxResultWatch = null;
|
|
1454
|
+
}
|
|
1455
|
+
// MEMORY LEAK FIX: Clear all ViewContainerRef embedded views
|
|
1456
|
+
// These hold references to row data, custom expressions, and inline widgets
|
|
1457
|
+
if (this.customExprViewRef) {
|
|
1458
|
+
this.customExprViewRef.clear();
|
|
1459
|
+
}
|
|
1460
|
+
if (this.rowActionsViewRef) {
|
|
1461
|
+
this.rowActionsViewRef.clear();
|
|
1462
|
+
}
|
|
1463
|
+
if (this.filterViewRef) {
|
|
1464
|
+
this.filterViewRef.clear();
|
|
1465
|
+
}
|
|
1466
|
+
if (this.inlineEditViewRef) {
|
|
1467
|
+
this.inlineEditViewRef.clear();
|
|
1327
1468
|
}
|
|
1469
|
+
if (this.inlineEditNewViewRef) {
|
|
1470
|
+
this.inlineEditNewViewRef.clear();
|
|
1471
|
+
}
|
|
1472
|
+
if (this.rowDetailViewRef) {
|
|
1473
|
+
this.rowDetailViewRef.clear();
|
|
1474
|
+
}
|
|
1475
|
+
if (this.rowExpansionActionViewRef) {
|
|
1476
|
+
this.rowExpansionActionViewRef.clear();
|
|
1477
|
+
}
|
|
1478
|
+
if (this.dynamicTableRef) {
|
|
1479
|
+
this.dynamicTableRef.clear();
|
|
1480
|
+
}
|
|
1481
|
+
// MEMORY LEAK FIX: Clear compiled template caches
|
|
1482
|
+
this.rowActionsCompiledTl = {};
|
|
1483
|
+
this.rowFilterCompliedTl = {};
|
|
1484
|
+
this.inlineCompliedTl = {};
|
|
1485
|
+
this.inlineNewCompliedTl = {};
|
|
1486
|
+
this.customExprCompiledTl = {};
|
|
1487
|
+
this.customExprCompiledSummaryTl = {};
|
|
1488
|
+
this.rowDefInstances = {};
|
|
1489
|
+
this.rowDefMap = {};
|
|
1490
|
+
this.rowExpansionActionTl = {};
|
|
1491
|
+
// MEMORY LEAK FIX: Clear dynamic context
|
|
1492
|
+
if (this._dynamicContext) {
|
|
1493
|
+
Object.keys(this._dynamicContext).forEach(key => {
|
|
1494
|
+
delete this._dynamicContext[key];
|
|
1495
|
+
});
|
|
1496
|
+
this._dynamicContext = null;
|
|
1497
|
+
}
|
|
1498
|
+
// MEMORY LEAK FIX: Clear data arrays
|
|
1499
|
+
this._gridData = [];
|
|
1500
|
+
this.items = [];
|
|
1501
|
+
this.selectedItems = [];
|
|
1502
|
+
this.fieldDefs = [];
|
|
1503
|
+
this.fullFieldDefs = [];
|
|
1504
|
+
this.__fullData = null;
|
|
1505
|
+
// MEMORY LEAK FIX: Destroy jQuery datatable widget before clearing gridOptions
|
|
1506
|
+
if (this.datagridElement && this.datagridElement.datatable) {
|
|
1507
|
+
try {
|
|
1508
|
+
this.datagridElement.datatable('destroy');
|
|
1509
|
+
}
|
|
1510
|
+
catch (e) {
|
|
1511
|
+
// Ignore errors during destroy
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
// MEMORY LEAK FIX: Clear gridOptions to release all function closures and data
|
|
1515
|
+
// gridOptions holds many closures that capture 'this' and prevent GC
|
|
1516
|
+
if (this.gridOptions) {
|
|
1517
|
+
// Clear data array
|
|
1518
|
+
if (this.gridOptions.data) {
|
|
1519
|
+
this.gridOptions.data = [];
|
|
1520
|
+
}
|
|
1521
|
+
// Clear column definitions
|
|
1522
|
+
if (this.gridOptions.colDefs) {
|
|
1523
|
+
this.gridOptions.colDefs = [];
|
|
1524
|
+
}
|
|
1525
|
+
// Clear row actions
|
|
1526
|
+
if (this.gridOptions.rowActions) {
|
|
1527
|
+
this.gridOptions.rowActions = [];
|
|
1528
|
+
}
|
|
1529
|
+
// Clear header config
|
|
1530
|
+
if (this.gridOptions.headerConfig) {
|
|
1531
|
+
this.gridOptions.headerConfig = [];
|
|
1532
|
+
}
|
|
1533
|
+
// Nullify all function references to break closures
|
|
1534
|
+
Object.keys(this.gridOptions).forEach(key => {
|
|
1535
|
+
if (typeof this.gridOptions[key] === 'function') {
|
|
1536
|
+
this.gridOptions[key] = null;
|
|
1537
|
+
}
|
|
1538
|
+
});
|
|
1539
|
+
}
|
|
1540
|
+
// MEMORY LEAK FIX: Clear other data structures
|
|
1541
|
+
this.columns = {};
|
|
1542
|
+
this.formfields = {};
|
|
1543
|
+
this.rowFilter = {};
|
|
1544
|
+
this.actions = [];
|
|
1545
|
+
this._actions = { header: [], footer: [] };
|
|
1546
|
+
this.exportOptions = [];
|
|
1547
|
+
this.headerConfig = [];
|
|
1548
|
+
this.rowActions = [];
|
|
1549
|
+
// MEMORY LEAK FIX: Clear all @ContentChildren QueryLists holding template references
|
|
1550
|
+
// These QueryLists hold TemplateRef instances that create circular references to the parent LView
|
|
1551
|
+
if (this.rowActionTmpl) {
|
|
1552
|
+
this.rowActionTmpl.reset([]);
|
|
1553
|
+
}
|
|
1554
|
+
if (this.filterTmpl) {
|
|
1555
|
+
this.filterTmpl.reset([]);
|
|
1556
|
+
}
|
|
1557
|
+
if (this.inlineWidgetTmpl) {
|
|
1558
|
+
this.inlineWidgetTmpl.reset([]);
|
|
1559
|
+
}
|
|
1560
|
+
if (this.inlineWidgetNewTmpl) {
|
|
1561
|
+
this.inlineWidgetNewTmpl.reset([]);
|
|
1562
|
+
}
|
|
1563
|
+
if (this.customExprTmpl) {
|
|
1564
|
+
this.customExprTmpl.reset([]);
|
|
1565
|
+
}
|
|
1566
|
+
if (this.rowExpansionActionTmpl) {
|
|
1567
|
+
this.rowExpansionActionTmpl.reset([]);
|
|
1568
|
+
}
|
|
1569
|
+
// MEMORY LEAK FIX: Clear @ContentChild template reference
|
|
1570
|
+
this.rowExpansionTmpl = null;
|
|
1571
|
+
// MEMORY LEAK FIX: Complete and clear subjects
|
|
1572
|
+
if (this.selectedItemChange) {
|
|
1573
|
+
this.selectedItemChange.complete();
|
|
1574
|
+
this.selectedItemChange = null;
|
|
1575
|
+
}
|
|
1576
|
+
// MEMORY LEAK FIX: Clear ViewChild references
|
|
1577
|
+
this.dataNavigator = null;
|
|
1578
|
+
this._tableElement = null;
|
|
1579
|
+
// console.log("table component destroyed");
|
|
1328
1580
|
super.ngOnDestroy();
|
|
1329
1581
|
}
|
|
1330
1582
|
addRowIndex(row) {
|
|
@@ -1361,6 +1613,7 @@ class TableComponent extends StylableComponent {
|
|
|
1361
1613
|
row.$isLast = this.gridData.length === row.$index;
|
|
1362
1614
|
delete row.$$index;
|
|
1363
1615
|
delete row.$$pk;
|
|
1616
|
+
delete row.$$wmSourceListIndex;
|
|
1364
1617
|
return row;
|
|
1365
1618
|
}
|
|
1366
1619
|
handleLoading(data) {
|
|
@@ -1395,6 +1648,9 @@ class TableComponent extends StylableComponent {
|
|
|
1395
1648
|
if (!key.endsWith('_filter') && ((key.endsWith('_new') && newRow) || (!key.endsWith('_new') && !newRow))) {
|
|
1396
1649
|
ctrls[key].setValue('');
|
|
1397
1650
|
this.resetFormControl(ctrls[key]);
|
|
1651
|
+
// MEMORY LEAK FIX: Clear validators to release references
|
|
1652
|
+
ctrls[key].clearValidators();
|
|
1653
|
+
ctrls[key].clearAsyncValidators();
|
|
1398
1654
|
}
|
|
1399
1655
|
});
|
|
1400
1656
|
}
|
|
@@ -1599,6 +1855,14 @@ class TableComponent extends StylableComponent {
|
|
|
1599
1855
|
// Apply filter and sort, if data is refreshed through Refresh data method
|
|
1600
1856
|
if (!this.isNavigationEnabled() && this._isClientSearch) {
|
|
1601
1857
|
data = getClonedObject(serviceData);
|
|
1858
|
+
if (isObject(data) && !isArray(data)) {
|
|
1859
|
+
data = [data];
|
|
1860
|
+
}
|
|
1861
|
+
if (get(this.datasource, 'category') === 'wm.Variable' && isArray(data)) {
|
|
1862
|
+
for (let i = 0; i < data.length; i++) {
|
|
1863
|
+
data[i].$$wmSourceListIndex = i;
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1602
1866
|
data = this.getSearchResult(data, this.filterInfo);
|
|
1603
1867
|
data = this.getSortResult(data, this.sortInfo);
|
|
1604
1868
|
this.serverData = data;
|
|
@@ -1714,7 +1978,14 @@ class TableComponent extends StylableComponent {
|
|
|
1714
1978
|
defaultFieldDefs.forEach(col => {
|
|
1715
1979
|
this.columns[col.field] = col;
|
|
1716
1980
|
});
|
|
1717
|
-
|
|
1981
|
+
// Note: Errors in beforedatarender should not prevent table rendering
|
|
1982
|
+
try {
|
|
1983
|
+
this.invokeEventCallback('beforedatarender', { $data: data, $columns: this.columns, data: data, columns: this.columns });
|
|
1984
|
+
}
|
|
1985
|
+
catch (error) {
|
|
1986
|
+
// Log error but continue with rendering - beforedatarender errors should not block table rendering
|
|
1987
|
+
console.warn('Error in beforedatarender event callback, continuing with table rendering:', error);
|
|
1988
|
+
}
|
|
1718
1989
|
defaultFieldDefs = [];
|
|
1719
1990
|
// Apply the changes made by the user
|
|
1720
1991
|
forEach(this.columns, val => {
|
|
@@ -1753,19 +2024,23 @@ class TableComponent extends StylableComponent {
|
|
|
1753
2024
|
return sortExp || '';
|
|
1754
2025
|
}
|
|
1755
2026
|
onPropertyChange(key, nv, ov) {
|
|
2027
|
+
// Guard against property changes after component destruction
|
|
2028
|
+
if (this.isDestroyed) {
|
|
2029
|
+
return;
|
|
2030
|
+
}
|
|
1756
2031
|
let enableNewRow, widgetState;
|
|
1757
2032
|
switch (key) {
|
|
1758
2033
|
case 'datasource':
|
|
1759
2034
|
// Fix for [WMS-23653] when startUpdate is false (request on page load property is unchecked),
|
|
1760
2035
|
// then set status msg as "No data found"
|
|
1761
|
-
if (this.allowpagesizechange) {
|
|
2036
|
+
if (this.allowpagesizechange && this.datasource) {
|
|
1762
2037
|
this.datasource.maxResults = this.pagesize || this.datasource.maxResults;
|
|
1763
2038
|
}
|
|
1764
|
-
if (nv.startUpdate === false) {
|
|
2039
|
+
if (nv && nv.startUpdate === false) {
|
|
1765
2040
|
this.variableInflight = false;
|
|
1766
2041
|
this.callDataGridMethod('setStatus', 'nodata', this.nodatamessage);
|
|
1767
2042
|
}
|
|
1768
|
-
if (get(this.datasource, 'category') !== 'wm.Variable') {
|
|
2043
|
+
if (this.datasource && get(this.datasource, 'category') !== 'wm.Variable') {
|
|
1769
2044
|
this.headerselectall = false;
|
|
1770
2045
|
this.setDataGridOption("headerselectall", false);
|
|
1771
2046
|
}
|
|
@@ -1777,6 +2052,12 @@ class TableComponent extends StylableComponent {
|
|
|
1777
2052
|
this.gridOptions.setIsNextPageData(false);
|
|
1778
2053
|
}
|
|
1779
2054
|
if (this.binddatasource && !this.datasource) {
|
|
2055
|
+
// If datasource is not set yet, clear loading state and show no data
|
|
2056
|
+
// This prevents tables from being stuck in loading state
|
|
2057
|
+
if (this.variableInflight) {
|
|
2058
|
+
this.variableInflight = false;
|
|
2059
|
+
this.callDataGridMethod('setStatus', 'nodata', this.nodatamessage);
|
|
2060
|
+
}
|
|
1780
2061
|
return;
|
|
1781
2062
|
}
|
|
1782
2063
|
// if table is inside list then table dataset will be set as "item.XXX" and there is no datasource.
|
|
@@ -1880,9 +2161,11 @@ class TableComponent extends StylableComponent {
|
|
|
1880
2161
|
this.allowpagesizechange = nv;
|
|
1881
2162
|
break;
|
|
1882
2163
|
case 'pagesizeoptions':
|
|
1883
|
-
this.
|
|
1884
|
-
this.pagesizeoptions = nv;
|
|
1885
|
-
this.
|
|
2164
|
+
this.prevPagesizeoptions = this.sanitizeCommaSeparatedIntegers(ov);
|
|
2165
|
+
this.gridOptions.pagesizeoptions = this.sanitizeCommaSeparatedIntegers(nv);
|
|
2166
|
+
this.pagesizeoptions = this.sanitizeCommaSeparatedIntegers(nv);
|
|
2167
|
+
if (this.allowpagesizechange)
|
|
2168
|
+
this.setDefaultPageSize(nv);
|
|
1886
2169
|
break;
|
|
1887
2170
|
case 'multiselecttitle':
|
|
1888
2171
|
this.setDataGridOption('multiselecttitle', nv);
|
|
@@ -1906,6 +2189,10 @@ class TableComponent extends StylableComponent {
|
|
|
1906
2189
|
case 'show':
|
|
1907
2190
|
if (nv) {
|
|
1908
2191
|
this.invokeEventCallback('show');
|
|
2192
|
+
// recompute layout now that the table is visible again
|
|
2193
|
+
if (this.datagridElement) {
|
|
2194
|
+
this.redraw(false);
|
|
2195
|
+
}
|
|
1909
2196
|
}
|
|
1910
2197
|
else {
|
|
1911
2198
|
this.invokeEventCallback('hide');
|
|
@@ -1926,12 +2213,41 @@ class TableComponent extends StylableComponent {
|
|
|
1926
2213
|
this.pagesize = nv;
|
|
1927
2214
|
}
|
|
1928
2215
|
this.updatedPageSize = nv;
|
|
2216
|
+
if (this.isPageSizeOptionsChanged()) {
|
|
2217
|
+
this.dataNavigator.defaultPageSizeOptions = this.pagesizeoptions?.split(',').map(Number).sort((a, b) => a - b) || [];
|
|
2218
|
+
this.dataNavigator.pageSizeOptions = [...this.dataNavigator.defaultPageSizeOptions];
|
|
2219
|
+
}
|
|
1929
2220
|
}
|
|
1930
2221
|
this.dataNavigator.options = {
|
|
1931
2222
|
maxResults: nv
|
|
1932
2223
|
};
|
|
1933
2224
|
this.dataNavigator.widget.maxResults = nv;
|
|
1934
2225
|
this.dataNavigator.maxResults = nv;
|
|
2226
|
+
if (this.datasource) {
|
|
2227
|
+
this.datasource.maxResults = this.pagesize || this.datasource.maxResults;
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
isPageSizeOptionsChanged() {
|
|
2231
|
+
return !isEqual(this.prevPagesizeoptions, this.pagesizeoptions);
|
|
2232
|
+
}
|
|
2233
|
+
selectPageSize(pagesize) {
|
|
2234
|
+
if (!this.allowpagesizechange && !pagesize)
|
|
2235
|
+
return;
|
|
2236
|
+
if (pagesize < this.dataNavigator.pageSizeOptions[0] || pagesize > this.dataNavigator.pageSizeOptions[this.dataNavigator.pageSizeOptions.length - 1]
|
|
2237
|
+
|| !this.dataNavigator.pageSizeOptions.includes(Number(pagesize))) {
|
|
2238
|
+
pagesize = this.dataNavigator.pageSizeOptions[0];
|
|
2239
|
+
}
|
|
2240
|
+
this.dataNavigator.onPageSizeChange(undefined, pagesize);
|
|
2241
|
+
}
|
|
2242
|
+
sanitizeCommaSeparatedIntegers(input) {
|
|
2243
|
+
if (!input)
|
|
2244
|
+
return "";
|
|
2245
|
+
const uniqueNumbers = Array.from(new Set(input
|
|
2246
|
+
.split(",")
|
|
2247
|
+
.map(v => v.trim())
|
|
2248
|
+
.filter(v => /^-?\d+$/.test(v))
|
|
2249
|
+
.map(v => Math.abs(parseInt(v, 10)))));
|
|
2250
|
+
return uniqueNumbers.join(",");
|
|
1935
2251
|
}
|
|
1936
2252
|
onDataSourceChange() {
|
|
1937
2253
|
this.fieldDefs.forEach(col => {
|
|
@@ -2051,6 +2367,11 @@ class TableComponent extends StylableComponent {
|
|
|
2051
2367
|
if (isObject(data) && !isArray(data)) {
|
|
2052
2368
|
data = [data];
|
|
2053
2369
|
}
|
|
2370
|
+
if (get(this.datasource, 'category') === 'wm.Variable' && isArray(data)) {
|
|
2371
|
+
for (let i = 0; i < data.length; i++) {
|
|
2372
|
+
data[i].$$wmSourceListIndex = i;
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2054
2375
|
data = this.getSearchResult(data, this.filterInfo);
|
|
2055
2376
|
data = this.getSortResult(data, this.sortInfo);
|
|
2056
2377
|
return data;
|
|
@@ -2111,11 +2432,16 @@ class TableComponent extends StylableComponent {
|
|
|
2111
2432
|
}
|
|
2112
2433
|
_documentClickBind(event) {
|
|
2113
2434
|
const $target = event.target;
|
|
2114
|
-
// If click
|
|
2435
|
+
// If the click is within this table, a dialog, or a date picker, do not save the row.
|
|
2115
2436
|
if (this.$element[0].contains($target) || event.target.doctype || isInputBodyWrapper($($target))) {
|
|
2116
2437
|
return;
|
|
2117
2438
|
}
|
|
2118
|
-
this.
|
|
2439
|
+
// If click is inside another datatable, that table's edit handler saves this row — skip to avoid a duplicate save. [WMS-31104]
|
|
2440
|
+
if ($($target).closest('.app-datagrid').length) {
|
|
2441
|
+
return;
|
|
2442
|
+
}
|
|
2443
|
+
// Click is outside all tables — save the editing row without returning focus to this table. [WMS-31104]
|
|
2444
|
+
this.callDataGridMethod('saveRow', undefined, true);
|
|
2119
2445
|
}
|
|
2120
2446
|
_redraw(forceRender) {
|
|
2121
2447
|
if (forceRender) {
|
|
@@ -2123,7 +2449,7 @@ class TableComponent extends StylableComponent {
|
|
|
2123
2449
|
}
|
|
2124
2450
|
else {
|
|
2125
2451
|
setTimeout(() => {
|
|
2126
|
-
this.callDataGridMethod('setColGroupWidths');
|
|
2452
|
+
this.callDataGridMethod(forceRender === false ? 'refreshColumnWidths' : 'setColGroupWidths');
|
|
2127
2453
|
this.callDataGridMethod('addOrRemoveScroll');
|
|
2128
2454
|
});
|
|
2129
2455
|
}
|
|
@@ -2453,11 +2779,11 @@ class TableCUDDirective {
|
|
|
2453
2779
|
this.table.toggleMessage(true, 'success', this.table.updatemessage);
|
|
2454
2780
|
}
|
|
2455
2781
|
if (this.table.datasource.execute(DataSource.Operation.SUPPORTS_CRUD)) {
|
|
2456
|
-
this.table.initiateSelectItem('current', response,
|
|
2782
|
+
this.table.initiateSelectItem('current', response, options.skipFocus, false, options.callBack);
|
|
2457
2783
|
this.updateVariable(response, options.callBack);
|
|
2458
2784
|
}
|
|
2459
2785
|
else if (!this.table.datasource.execute(DataSource.Operation.IS_API_AWARE)) {
|
|
2460
|
-
this.table.initiateSelectItem('current', response,
|
|
2786
|
+
this.table.initiateSelectItem('current', response, options.skipFocus, this.table.datasource.category === 'wm.Variable', options.callBack);
|
|
2461
2787
|
}
|
|
2462
2788
|
triggerFn(options.success, response);
|
|
2463
2789
|
this.table.invokeEventCallback('rowupdate', { $event: options.event, $data: response, row: response });
|
|
@@ -2478,7 +2804,11 @@ class TableCUDDirective {
|
|
|
2478
2804
|
if (dataSource.execute(DataSource.Operation.SUPPORTS_CRUD) || !dataSource.execute(DataSource.Operation.IS_API_AWARE) || dataSource.category === 'wm.CrudVariable') {
|
|
2479
2805
|
if (!dataSource.execute(DataSource.Operation.IS_API_AWARE)) {
|
|
2480
2806
|
const extraOptions = this.generatePath(this.table.binddataset);
|
|
2481
|
-
|
|
2807
|
+
const item = options.row;
|
|
2808
|
+
if (dataSource.category === 'wm.Variable' && item) {
|
|
2809
|
+
delete item['$$wmSourceListIndex'];
|
|
2810
|
+
}
|
|
2811
|
+
dataSource.execute(DataSource.Operation.SET_ITEM, { prevItem: options.prevData, item, path: extraOptions.path, parentIndex: extraOptions.index });
|
|
2482
2812
|
this.updateSuccessHandler(options.row, options);
|
|
2483
2813
|
return;
|
|
2484
2814
|
}
|
|
@@ -2561,7 +2891,14 @@ class TableCUDDirective {
|
|
|
2561
2891
|
if (dataSource.execute(DataSource.Operation.SUPPORTS_CRUD) || !dataSource.execute(DataSource.Operation.IS_API_AWARE) || this.table._isDependent || dataSource.category === 'wm.CrudVariable') {
|
|
2562
2892
|
if (!dataSource.execute(DataSource.Operation.IS_API_AWARE)) {
|
|
2563
2893
|
const extraOptions = this.generatePath(this.table.binddataset);
|
|
2564
|
-
|
|
2894
|
+
let item = options.row;
|
|
2895
|
+
if (dataSource.category === 'wm.Variable' && options.rowindex != null) {
|
|
2896
|
+
item = options.rowindex;
|
|
2897
|
+
}
|
|
2898
|
+
else if (dataSource.category === 'wm.Variable' && item) {
|
|
2899
|
+
delete item['$$wmSourceListIndex'];
|
|
2900
|
+
}
|
|
2901
|
+
dataSource.execute(DataSource.Operation.REMOVE_ITEM, { item, path: extraOptions.path, parentIndex: extraOptions.index });
|
|
2565
2902
|
this.deleteSuccessHandler(options.row, undefined, options.evt, options.callBack);
|
|
2566
2903
|
return;
|
|
2567
2904
|
}
|
|
@@ -2707,6 +3044,12 @@ class TableCUDDirective {
|
|
|
2707
3044
|
this.table.callDataGridMethod('cancelEdit', $row);
|
|
2708
3045
|
}
|
|
2709
3046
|
}
|
|
3047
|
+
ngOnDestroy() {
|
|
3048
|
+
// MEMORY LEAK FIX: Clear all references
|
|
3049
|
+
this.table = null;
|
|
3050
|
+
this.dialogService = null;
|
|
3051
|
+
this.app = null;
|
|
3052
|
+
}
|
|
2710
3053
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TableCUDDirective, deps: [{ token: TableComponent, self: true }, { token: i2.AbstractDialogService }, { token: i2.App }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2711
3054
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: TableCUDDirective, isStandalone: true, selector: "[wmTableCUD]", ngImport: i0 }); }
|
|
2712
3055
|
}
|
|
@@ -3018,7 +3361,19 @@ class TableFilterSortDirective {
|
|
|
3018
3361
|
}
|
|
3019
3362
|
// Function that checks if a given string is a valid date and returns the timestamp if it is, or NaN if it's not.
|
|
3020
3363
|
parseDateString(dateString) {
|
|
3364
|
+
if (typeof dateString !== 'string') {
|
|
3365
|
+
return NaN;
|
|
3366
|
+
}
|
|
3367
|
+
const trimmed = dateString.trim();
|
|
3368
|
+
if (!trimmed) {
|
|
3369
|
+
return NaN;
|
|
3370
|
+
}
|
|
3021
3371
|
const timestamp = Date.parse(dateString);
|
|
3372
|
+
// handling case when string starts with string and end with number
|
|
3373
|
+
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;
|
|
3374
|
+
if (/^[A-Za-z]+/.test(trimmed) && /\d+$/.test(trimmed) && !monthRegex.test(trimmed)) {
|
|
3375
|
+
return NaN;
|
|
3376
|
+
}
|
|
3022
3377
|
if (!isNaN(timestamp)) {
|
|
3023
3378
|
return timestamp;
|
|
3024
3379
|
}
|
|
@@ -3031,20 +3386,38 @@ class TableFilterSortDirective {
|
|
|
3031
3386
|
// Returns data sorted using sortObj
|
|
3032
3387
|
getSortResult(data, sortObj) {
|
|
3033
3388
|
if (sortObj && sortObj.direction) {
|
|
3034
|
-
const
|
|
3389
|
+
const sampleItem = find(data, (item) => {
|
|
3390
|
+
const v = get(item, sortObj.field);
|
|
3391
|
+
return typeof v === 'string' && !!v.trim();
|
|
3392
|
+
});
|
|
3393
|
+
const fieldValue = sampleItem ? get(sampleItem, sortObj.field) : undefined;
|
|
3035
3394
|
const isValidDateString = typeof fieldValue === 'string' ? this.parseDateString(fieldValue) : NaN;
|
|
3036
3395
|
if (!isNaN(isValidDateString)) { // if the field is a date string
|
|
3037
|
-
data = orderBy(data, [
|
|
3396
|
+
data = orderBy(data, [
|
|
3397
|
+
(item) => {
|
|
3398
|
+
const v = get(item, sortObj.field);
|
|
3399
|
+
return v === null || v === undefined || v === '' ? 1 : 0;
|
|
3400
|
+
},
|
|
3401
|
+
(item) => {
|
|
3402
|
+
const ts = this.parseDateString(get(item, sortObj.field));
|
|
3403
|
+
return isNaN(ts) ? 1 : 0;
|
|
3404
|
+
},
|
|
3405
|
+
(item) => this.parseDateString(get(item, sortObj.field))
|
|
3406
|
+
], ['asc', 'asc', sortObj.direction]);
|
|
3038
3407
|
}
|
|
3039
3408
|
else if (sortObj.sortBy ? this.table.columns[sortObj.sortBy]?.caseinsensitive : this.table.columns[sortObj.field]?.caseinsensitive) {
|
|
3040
3409
|
//Fix for [WMS-27505]: Added case-insensitive sorting so that uppercase and lowercase letters are treated the same when sorting.
|
|
3041
3410
|
data = orderBy(data, [
|
|
3411
|
+
(item) => {
|
|
3412
|
+
const val = get(item, sortObj.field);
|
|
3413
|
+
return val === null || val === undefined || val === '' ? 1 : 0;
|
|
3414
|
+
},
|
|
3042
3415
|
(item) => {
|
|
3043
3416
|
const val = get(item, sortObj.field);
|
|
3044
3417
|
return typeof val === 'string' ? val.toLowerCase() : val;
|
|
3045
3418
|
},
|
|
3046
3419
|
(item) => get(item, sortObj.field) // fallback to original value
|
|
3047
|
-
], [sortObj.direction, sortObj.direction]);
|
|
3420
|
+
], ['asc', sortObj.direction, sortObj.direction]);
|
|
3048
3421
|
}
|
|
3049
3422
|
else {
|
|
3050
3423
|
data = orderBy(data, sortObj.field, sortObj.direction);
|
|
@@ -3066,6 +3439,11 @@ class TableFilterSortDirective {
|
|
|
3066
3439
|
if (isObject(data) && !isArray(data)) {
|
|
3067
3440
|
data = [data];
|
|
3068
3441
|
}
|
|
3442
|
+
if (get(this.table.datasource, 'category') === 'wm.Variable' && isArray(data)) {
|
|
3443
|
+
for (let i = 0; i < data.length; i++) {
|
|
3444
|
+
data[i].$$wmSourceListIndex = i;
|
|
3445
|
+
}
|
|
3446
|
+
}
|
|
3069
3447
|
/*Both the functions return same 'data' if arguments are undefined*/
|
|
3070
3448
|
data = this.getSearchResult(data, this.table.filterInfo);
|
|
3071
3449
|
data = this.getSortResult(data, this.table.sortInfo);
|
|
@@ -3396,6 +3774,10 @@ class TableFilterSortDirective {
|
|
|
3396
3774
|
condition: logicalOp
|
|
3397
3775
|
});
|
|
3398
3776
|
}
|
|
3777
|
+
ngOnDestroy() {
|
|
3778
|
+
// MEMORY LEAK FIX: Clear table reference
|
|
3779
|
+
this.table = null;
|
|
3780
|
+
}
|
|
3399
3781
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TableFilterSortDirective, deps: [{ token: TableComponent, self: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3400
3782
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: TableFilterSortDirective, isStandalone: true, selector: "[wmTableFilterSort]", ngImport: i0 }); }
|
|
3401
3783
|
}
|
|
@@ -3453,7 +3835,7 @@ class TableActionDirective extends BaseComponent {
|
|
|
3453
3835
|
title: isUndefined(this.title) ? (this['display-name'] || '') : this.title,
|
|
3454
3836
|
action: this.action,
|
|
3455
3837
|
accessroles: this.accessroles,
|
|
3456
|
-
shortcutkey: this.shortcutkey,
|
|
3838
|
+
shortcutkey: this.shortcutkey || undefined,
|
|
3457
3839
|
disabled: this.disabled,
|
|
3458
3840
|
tabindex: this.tabindex,
|
|
3459
3841
|
icon: this.icon,
|
|
@@ -3478,10 +3860,20 @@ class TableActionDirective extends BaseComponent {
|
|
|
3478
3860
|
if (key === 'display-name') {
|
|
3479
3861
|
this.buttonDef.displayName = nv;
|
|
3480
3862
|
}
|
|
3863
|
+
else if (key === 'shortcutkey') {
|
|
3864
|
+
this.buttonDef.shortcutkey = nv || undefined;
|
|
3865
|
+
}
|
|
3481
3866
|
else {
|
|
3482
3867
|
this.buttonDef[key] = nv;
|
|
3483
3868
|
}
|
|
3484
3869
|
}
|
|
3870
|
+
ngOnDestroy() {
|
|
3871
|
+
// MEMORY LEAK FIX: Clear table and buttonDef references
|
|
3872
|
+
this.table = null;
|
|
3873
|
+
this.buttonDef = null;
|
|
3874
|
+
// Call parent ngOnDestroy (BaseComponent has cleanup)
|
|
3875
|
+
super.ngOnDestroy();
|
|
3876
|
+
}
|
|
3485
3877
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TableActionDirective, deps: [{ token: i0.Injector }, { token: TableComponent, optional: true }, { token: 'EXPLICIT_CONTEXT', optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3486
3878
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: TableActionDirective, isStandalone: true, selector: "[wmTableAction]", providers: [
|
|
3487
3879
|
provideAsWidgetRef(TableActionDirective)
|
|
@@ -3646,6 +4038,14 @@ class TableColumnGroupDirective extends BaseComponent {
|
|
|
3646
4038
|
const fieldName = this.group && this.group.name;
|
|
3647
4039
|
setHeaderConfigForTable(this.table.headerConfig, this.config, fieldName, fieldName ? colIndex : headerIndex);
|
|
3648
4040
|
}
|
|
4041
|
+
ngOnDestroy() {
|
|
4042
|
+
// MEMORY LEAK FIX: Clear table, group, and config references
|
|
4043
|
+
this.table = null;
|
|
4044
|
+
this.group = null;
|
|
4045
|
+
this.config = null;
|
|
4046
|
+
// Call parent ngOnDestroy (BaseComponent has cleanup)
|
|
4047
|
+
super.ngOnDestroy();
|
|
4048
|
+
}
|
|
3649
4049
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TableColumnGroupDirective, deps: [{ token: i0.Injector }, { token: TableColumnGroupDirective, optional: true, skipSelf: true }, { token: TableComponent, optional: true }, { token: 'EXPLICIT_CONTEXT', optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3650
4050
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: TableColumnGroupDirective, isStandalone: true, selector: "[wmTableColumnGroup]", providers: [
|
|
3651
4051
|
provideAsWidgetRef(TableColumnGroupDirective)
|
|
@@ -3840,6 +4240,10 @@ class TableColumnDirective extends BaseComponent {
|
|
|
3840
4240
|
}
|
|
3841
4241
|
// Remove validators for the inline widget and set form to untouched
|
|
3842
4242
|
removeValidations() {
|
|
4243
|
+
// Guard against component destruction or table/ngform being null
|
|
4244
|
+
if (this.isDestroyed || !this.table || !this.table.ngform) {
|
|
4245
|
+
return;
|
|
4246
|
+
}
|
|
3843
4247
|
this.table.ngform.markAsUntouched();
|
|
3844
4248
|
const control = this.getFormControl();
|
|
3845
4249
|
if (!control) {
|
|
@@ -3851,6 +4255,10 @@ class TableColumnDirective extends BaseComponent {
|
|
|
3851
4255
|
}
|
|
3852
4256
|
// Apply default|sync|async|prop validators for QuickEdit new row form control
|
|
3853
4257
|
applyNewRowValidations() {
|
|
4258
|
+
// Guard against component destruction or table/ngform being null
|
|
4259
|
+
if (this.isDestroyed || !this.table || !this.table.ngform) {
|
|
4260
|
+
return;
|
|
4261
|
+
}
|
|
3854
4262
|
if (!this._checkNewEditableRowControl()) {
|
|
3855
4263
|
return;
|
|
3856
4264
|
}
|
|
@@ -3867,22 +4275,37 @@ class TableColumnDirective extends BaseComponent {
|
|
|
3867
4275
|
}
|
|
3868
4276
|
// Remove validators for the QuickEdit new row widget and set form to untouched
|
|
3869
4277
|
removeNewRowValidations() {
|
|
4278
|
+
// Guard against component destruction or table/ngform being null
|
|
4279
|
+
if (this.isDestroyed || !this.table || !this.table.ngform) {
|
|
4280
|
+
return;
|
|
4281
|
+
}
|
|
3870
4282
|
this.table.ngform.markAsUntouched();
|
|
3871
4283
|
if (!this._checkNewEditableRowControl()) {
|
|
3872
4284
|
return;
|
|
3873
4285
|
}
|
|
3874
4286
|
const control = this.getFormControl('_new');
|
|
4287
|
+
if (!control) {
|
|
4288
|
+
return;
|
|
4289
|
+
}
|
|
3875
4290
|
control.clearValidators();
|
|
3876
4291
|
control.clearAsyncValidators();
|
|
3877
4292
|
control.updateValueAndValidity();
|
|
3878
4293
|
}
|
|
3879
4294
|
addFormControl(suffix) {
|
|
4295
|
+
// Guard against component destruction or table/ngform being null
|
|
4296
|
+
if (this.isDestroyed || !this.table || !this.table.ngform) {
|
|
4297
|
+
return;
|
|
4298
|
+
}
|
|
3880
4299
|
const ctrlName = suffix ? (this.binding + suffix) : this.binding;
|
|
3881
4300
|
this.table.ngform.addControl(ctrlName, this.table.fb.control(''));
|
|
3882
4301
|
}
|
|
3883
4302
|
getFormControl(suffix) {
|
|
4303
|
+
// Guard against component destruction or table/ngform being null
|
|
4304
|
+
if (this.isDestroyed || !this.table || !this.table.ngform) {
|
|
4305
|
+
return null;
|
|
4306
|
+
}
|
|
3884
4307
|
const ctrlName = suffix ? (this.binding + suffix) : this.binding;
|
|
3885
|
-
return this.table.ngform.controls[ctrlName];
|
|
4308
|
+
return this.table.ngform.controls[ctrlName] || null;
|
|
3886
4309
|
}
|
|
3887
4310
|
_checkNewEditableRowControl() {
|
|
3888
4311
|
return this._isNewEditableRow && this.getFormControl('_new');
|
|
@@ -3956,12 +4379,16 @@ class TableColumnDirective extends BaseComponent {
|
|
|
3956
4379
|
}
|
|
3957
4380
|
// On field value change, apply cascading filter and set validation message
|
|
3958
4381
|
onValueChange(val, widget) {
|
|
4382
|
+
// Guard against component destruction or table being null
|
|
4383
|
+
if (this.isDestroyed || !this.table) {
|
|
4384
|
+
return;
|
|
4385
|
+
}
|
|
3959
4386
|
if (val !== null) {
|
|
3960
4387
|
applyFilterOnField(this.table.datasource, this.widget, this.table.fieldDefs, val, {
|
|
3961
4388
|
widget: 'edit-widget-type'
|
|
3962
4389
|
});
|
|
3963
4390
|
}
|
|
3964
|
-
if (this.table.ngform.touched) {
|
|
4391
|
+
if (this.table.ngform && this.table.ngform.touched) {
|
|
3965
4392
|
this.activeControlType = widget;
|
|
3966
4393
|
if (widget === 'inlineInstance') {
|
|
3967
4394
|
this.notifyChanges();
|
|
@@ -4219,7 +4646,7 @@ class TableColumnDirective extends BaseComponent {
|
|
|
4219
4646
|
this.defaultvalue = getDefaultValue(this.defaultvalue, this.type, this.editWidgetType);
|
|
4220
4647
|
break;
|
|
4221
4648
|
case 'show':
|
|
4222
|
-
this.table.redraw(
|
|
4649
|
+
this.table.redraw(false);
|
|
4223
4650
|
this.showinfilter = this.nativeElement.hasAttribute('showinfilter') ? this.nativeElement.getAttribute('showinfilter') : nv;
|
|
4224
4651
|
break;
|
|
4225
4652
|
case 'filterdataset':
|
|
@@ -4252,6 +4679,83 @@ class TableColumnDirective extends BaseComponent {
|
|
|
4252
4679
|
this.table.redraw(true);
|
|
4253
4680
|
}
|
|
4254
4681
|
}
|
|
4682
|
+
ngOnDestroy() {
|
|
4683
|
+
// MEMORY LEAK FIX: Clear ContentChildren QueryLists
|
|
4684
|
+
if (this._filterInstances) {
|
|
4685
|
+
try {
|
|
4686
|
+
this._filterInstances.reset([]);
|
|
4687
|
+
}
|
|
4688
|
+
catch (e) {
|
|
4689
|
+
// Silently handle cleanup errors - QueryList might already be destroyed
|
|
4690
|
+
}
|
|
4691
|
+
}
|
|
4692
|
+
if (this._inlineInstances) {
|
|
4693
|
+
try {
|
|
4694
|
+
this._inlineInstances.reset([]);
|
|
4695
|
+
}
|
|
4696
|
+
catch (e) {
|
|
4697
|
+
// Silently handle cleanup errors - QueryList might already be destroyed
|
|
4698
|
+
}
|
|
4699
|
+
}
|
|
4700
|
+
if (this._inlineInstancesNew) {
|
|
4701
|
+
try {
|
|
4702
|
+
this._inlineInstancesNew.reset([]);
|
|
4703
|
+
}
|
|
4704
|
+
catch (e) {
|
|
4705
|
+
// Silently handle cleanup errors - QueryList might already be destroyed
|
|
4706
|
+
}
|
|
4707
|
+
}
|
|
4708
|
+
// MEMORY LEAK FIX: Clear all widget instance references
|
|
4709
|
+
this.filterInstance = null;
|
|
4710
|
+
this.inlineInstance = null;
|
|
4711
|
+
this.inlineInstanceNew = null;
|
|
4712
|
+
// MEMORY LEAK FIX: Clear template references
|
|
4713
|
+
this.customExprTmpl = null;
|
|
4714
|
+
this.inlineWidthTempRef = null;
|
|
4715
|
+
this.filterTemplateRef = null;
|
|
4716
|
+
// MEMORY LEAK FIX: Clear dataset references
|
|
4717
|
+
this._filterDataSet = null;
|
|
4718
|
+
this.dataset = null;
|
|
4719
|
+
this._dataoptions = null;
|
|
4720
|
+
this._datasource = null;
|
|
4721
|
+
// MEMORY LEAK FIX: Clear validation objects
|
|
4722
|
+
if (this.fieldValidations) {
|
|
4723
|
+
try {
|
|
4724
|
+
this.fieldValidations.destroy();
|
|
4725
|
+
}
|
|
4726
|
+
catch (e) {
|
|
4727
|
+
// Silently handle cleanup errors
|
|
4728
|
+
}
|
|
4729
|
+
this.fieldValidations = null;
|
|
4730
|
+
}
|
|
4731
|
+
if (this.fieldValidations_new) {
|
|
4732
|
+
try {
|
|
4733
|
+
this.fieldValidations_new.destroy();
|
|
4734
|
+
}
|
|
4735
|
+
catch (e) {
|
|
4736
|
+
// Silently handle cleanup errors
|
|
4737
|
+
}
|
|
4738
|
+
this.fieldValidations_new = null;
|
|
4739
|
+
}
|
|
4740
|
+
this.syncValidators = [];
|
|
4741
|
+
this.asyncValidators = [];
|
|
4742
|
+
// MEMORY LEAK FIX: Clear filter control reference
|
|
4743
|
+
this.filterControl = null;
|
|
4744
|
+
// MEMORY LEAK FIX: Clear notify fields array
|
|
4745
|
+
if (this.notifyForFields) {
|
|
4746
|
+
this.notifyForFields = [];
|
|
4747
|
+
}
|
|
4748
|
+
// MEMORY LEAK FIX: Clear observe fields array
|
|
4749
|
+
if (this.observeOnFields) {
|
|
4750
|
+
this.observeOnFields = [];
|
|
4751
|
+
}
|
|
4752
|
+
// MEMORY LEAK FIX: Clear table and group references
|
|
4753
|
+
// Note: These are injected dependencies, but clearing helps GC
|
|
4754
|
+
this.table = null;
|
|
4755
|
+
this.group = null;
|
|
4756
|
+
// Call parent ngOnDestroy
|
|
4757
|
+
super.ngOnDestroy();
|
|
4758
|
+
}
|
|
4255
4759
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TableColumnDirective, deps: [{ token: i0.Injector }, { token: i2.AppDefaults }, { token: TableComponent, optional: true }, { token: TableColumnGroupDirective, optional: true }, { token: 'filterdataset.bind', attribute: true }, { token: 'dataset.bind', attribute: true }, { token: 'EXPLICIT_CONTEXT', optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
4256
4760
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: TableColumnDirective, isStandalone: true, selector: "[wmTableColumn]", providers: [
|
|
4257
4761
|
provideAsWidgetRef(TableColumnDirective)
|
|
@@ -4346,6 +4850,13 @@ class TableRowDirective extends BaseComponent {
|
|
|
4346
4850
|
this.config.content = this.content;
|
|
4347
4851
|
}
|
|
4348
4852
|
}
|
|
4853
|
+
ngOnDestroy() {
|
|
4854
|
+
// MEMORY LEAK FIX: Clear table and config references
|
|
4855
|
+
this.table = null;
|
|
4856
|
+
this.config = null;
|
|
4857
|
+
// Call parent ngOnDestroy (BaseComponent has cleanup)
|
|
4858
|
+
super.ngOnDestroy();
|
|
4859
|
+
}
|
|
4349
4860
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TableRowDirective, deps: [{ token: i0.Injector }, { token: TableComponent, optional: true, skipSelf: true }, { token: 'EXPLICIT_CONTEXT', optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
4350
4861
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: TableRowDirective, isStandalone: true, selector: "[wmTableRow]", providers: [
|
|
4351
4862
|
provideAsWidgetRef(TableRowDirective)
|
|
@@ -4427,6 +4938,13 @@ class TableRowActionDirective extends BaseComponent {
|
|
|
4427
4938
|
this.populateAction();
|
|
4428
4939
|
this.table.registerRowActions(this.buttonDef);
|
|
4429
4940
|
}
|
|
4941
|
+
ngOnDestroy() {
|
|
4942
|
+
// MEMORY LEAK FIX: Clear table reference and button definition
|
|
4943
|
+
this.table = null;
|
|
4944
|
+
this.buttonDef = null;
|
|
4945
|
+
// Call parent ngOnDestroy (BaseComponent has cleanup)
|
|
4946
|
+
super.ngOnDestroy();
|
|
4947
|
+
}
|
|
4430
4948
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TableRowActionDirective, deps: [{ token: i0.Injector }, { token: TableComponent, optional: true }, { token: Context, self: true }, { token: 'EXPLICIT_CONTEXT', optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
4431
4949
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: TableRowActionDirective, isStandalone: true, selector: "[wmTableRowAction]", providers: [
|
|
4432
4950
|
provideAsWidgetRef(TableRowActionDirective),
|