basesite-shared-grid-lib 15.10.267 → 15.10.283
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.
|
Binary file
|
|
@@ -1065,10 +1065,10 @@ class FillCellRendererComponent {
|
|
|
1065
1065
|
<span class="status-fill-cell text-white" *ngIf="params.value && params.field === 'completionStatus'" [ngStyle]="{'background': rowData.pocIndicator? rowData.pocIndicator:'#fff'}" >
|
|
1066
1066
|
{{ params.value }}
|
|
1067
1067
|
</span>
|
|
1068
|
-
<span class="status-fill-cell
|
|
1068
|
+
<span class="status-fill-cell" *ngIf="params.value && params.field === 'funding'">
|
|
1069
1069
|
{{ params.value }}
|
|
1070
1070
|
</span>
|
|
1071
|
-
<span class="status-fill-cell
|
|
1071
|
+
<span class="status-fill-cell" *ngIf="params.value && params.field === 'layout'" >
|
|
1072
1072
|
{{ params.value }}
|
|
1073
1073
|
</span>
|
|
1074
1074
|
<span class="info-fill-cell text-white" *ngIf="params.value && params.field === 'facilityName'" [ngStyle]="{'background': 'var(--primary)'}" >
|
|
@@ -1091,10 +1091,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
1091
1091
|
<span class="status-fill-cell text-white" *ngIf="params.value && params.field === 'completionStatus'" [ngStyle]="{'background': rowData.pocIndicator? rowData.pocIndicator:'#fff'}" >
|
|
1092
1092
|
{{ params.value }}
|
|
1093
1093
|
</span>
|
|
1094
|
-
<span class="status-fill-cell
|
|
1094
|
+
<span class="status-fill-cell" *ngIf="params.value && params.field === 'funding'">
|
|
1095
1095
|
{{ params.value }}
|
|
1096
1096
|
</span>
|
|
1097
|
-
<span class="status-fill-cell
|
|
1097
|
+
<span class="status-fill-cell" *ngIf="params.value && params.field === 'layout'" >
|
|
1098
1098
|
{{ params.value }}
|
|
1099
1099
|
</span>
|
|
1100
1100
|
<span class="info-fill-cell text-white" *ngIf="params.value && params.field === 'facilityName'" [ngStyle]="{'background': 'var(--primary)'}" >
|
|
@@ -1140,7 +1140,6 @@ class GridLibraryComponent {
|
|
|
1140
1140
|
this.gridService = gridService;
|
|
1141
1141
|
this.formatterService = formatterService;
|
|
1142
1142
|
this._tokenSharingService = _tokenSharingService;
|
|
1143
|
-
//@Input() pageSize: number = 20;
|
|
1144
1143
|
this.paginationAutoPageSize = true;
|
|
1145
1144
|
this.rowSelection = 'multiple';
|
|
1146
1145
|
this.enableServerSidePaging = false;
|
|
@@ -1155,8 +1154,6 @@ class GridLibraryComponent {
|
|
|
1155
1154
|
this.filterChanged = new EventEmitter();
|
|
1156
1155
|
this.selectionChanged = new EventEmitter();
|
|
1157
1156
|
this.totalRowCount = new EventEmitter();
|
|
1158
|
-
//viewChilds
|
|
1159
|
-
//@ViewChild('agGrid') agGrid!: AgGridAngular;
|
|
1160
1157
|
//paramters
|
|
1161
1158
|
this.initialColumnDef = [];
|
|
1162
1159
|
this.rowDataHidden = [];
|
|
@@ -1203,6 +1200,7 @@ class GridLibraryComponent {
|
|
|
1203
1200
|
};
|
|
1204
1201
|
// Custom right click Context Menu to support custom excel exports
|
|
1205
1202
|
this.getContextMenuItems = (params) => {
|
|
1203
|
+
return [];
|
|
1206
1204
|
let res = [
|
|
1207
1205
|
'cut',
|
|
1208
1206
|
'copy',
|
|
@@ -1238,6 +1236,10 @@ class GridLibraryComponent {
|
|
|
1238
1236
|
setTimeout(() => this.updatePaginationInfo(), 0);
|
|
1239
1237
|
}
|
|
1240
1238
|
};
|
|
1239
|
+
this.filterHighlightingObserver = null;
|
|
1240
|
+
this.filterHighlightingRetryCount = 0;
|
|
1241
|
+
this.MAX_RETRY_ATTEMPTS = 10;
|
|
1242
|
+
this.RETRY_DELAY = 200;
|
|
1241
1243
|
this.gridStateLoaded$.subscribe(val => {
|
|
1242
1244
|
if (val) {
|
|
1243
1245
|
this.configureDataState();
|
|
@@ -1250,7 +1252,9 @@ class GridLibraryComponent {
|
|
|
1250
1252
|
}
|
|
1251
1253
|
saveGridState(e) {
|
|
1252
1254
|
if (!this.overrideColumnDefs) {
|
|
1253
|
-
setTimeout(() => {
|
|
1255
|
+
//setTimeout(() => {
|
|
1256
|
+
this.onSaveGridColumnState(e);
|
|
1257
|
+
//}, 2000)
|
|
1254
1258
|
}
|
|
1255
1259
|
}
|
|
1256
1260
|
ngOnInit() {
|
|
@@ -1263,11 +1267,23 @@ class GridLibraryComponent {
|
|
|
1263
1267
|
else {
|
|
1264
1268
|
this.rowModelType = 'clientSide';
|
|
1265
1269
|
}
|
|
1266
|
-
// this.gridPageSize = this.pageSize;
|
|
1267
1270
|
this.cacheBlockSize = this.cacheBlockSize = 0 ? 100 : this.cacheBlockSize;
|
|
1268
1271
|
this.gridService.setBaseUrl(this.environment);
|
|
1269
|
-
|
|
1270
|
-
|
|
1272
|
+
this.setupWindowFocusListener();
|
|
1273
|
+
}
|
|
1274
|
+
// Handling page refresh scenarios
|
|
1275
|
+
setupWindowFocusListener() {
|
|
1276
|
+
const handleWindowFocus = () => {
|
|
1277
|
+
setTimeout(() => {
|
|
1278
|
+
if (this.gridAPI && this.floatingFilter) {
|
|
1279
|
+
this.applyFilterHighlightingWithRetry();
|
|
1280
|
+
}
|
|
1281
|
+
}, 500);
|
|
1282
|
+
};
|
|
1283
|
+
window.addEventListener('focus', handleWindowFocus);
|
|
1284
|
+
this.unsubscribe$.subscribe(() => {
|
|
1285
|
+
window.removeEventListener('focus', handleWindowFocus);
|
|
1286
|
+
});
|
|
1271
1287
|
}
|
|
1272
1288
|
get isOverride() {
|
|
1273
1289
|
return (!!this.overrideColumnDefs);
|
|
@@ -1279,7 +1295,6 @@ class GridLibraryComponent {
|
|
|
1279
1295
|
else {
|
|
1280
1296
|
this.gridAPI.resetColumnState();
|
|
1281
1297
|
this.getGridState();
|
|
1282
|
-
//setTimeout(() => { this.setGridState(); }, 2000);
|
|
1283
1298
|
}
|
|
1284
1299
|
}
|
|
1285
1300
|
ngOnChanges(changes) {
|
|
@@ -1313,7 +1328,6 @@ class GridLibraryComponent {
|
|
|
1313
1328
|
this.columnDefs = coldef;
|
|
1314
1329
|
this.gridColumns = coldef;
|
|
1315
1330
|
this.getGridState();
|
|
1316
|
-
// this.agGrid.gridOptions?.api?.setColumnDefs(coldef);
|
|
1317
1331
|
}
|
|
1318
1332
|
else {
|
|
1319
1333
|
console.log('ColDef Read Error=>', response.message);
|
|
@@ -1389,6 +1403,7 @@ class GridLibraryComponent {
|
|
|
1389
1403
|
}
|
|
1390
1404
|
else if (res.columnType === 'date') {
|
|
1391
1405
|
return {
|
|
1406
|
+
width: 120,
|
|
1392
1407
|
pinned: res.pinPosition,
|
|
1393
1408
|
field: res.field,
|
|
1394
1409
|
headerName: res.title,
|
|
@@ -1400,7 +1415,6 @@ class GridLibraryComponent {
|
|
|
1400
1415
|
valueFormatter: (params) => this.formatterService.colValueFormatter(params, res.columnType),
|
|
1401
1416
|
filterable: res.filterable,
|
|
1402
1417
|
filter: 'agDateColumnFilter',
|
|
1403
|
-
//headerComponent: DateHeaderComponent,
|
|
1404
1418
|
filterParams: {
|
|
1405
1419
|
comparator: (filterLocalDateAtMidnight, cellValue) => {
|
|
1406
1420
|
const dateAsString = cellValue;
|
|
@@ -1421,6 +1435,7 @@ class GridLibraryComponent {
|
|
|
1421
1435
|
}
|
|
1422
1436
|
else if (res.columnType === 'fill') {
|
|
1423
1437
|
return {
|
|
1438
|
+
width: 120,
|
|
1424
1439
|
pinned: res.pinPosition,
|
|
1425
1440
|
field: res.field,
|
|
1426
1441
|
headerName: res.title,
|
|
@@ -1458,8 +1473,8 @@ class GridLibraryComponent {
|
|
|
1458
1473
|
};
|
|
1459
1474
|
}
|
|
1460
1475
|
else {
|
|
1461
|
-
// if (!hideDacStatus) {
|
|
1462
1476
|
return {
|
|
1477
|
+
width: 120,
|
|
1463
1478
|
pinned: res.pinPosition,
|
|
1464
1479
|
field: res.field,
|
|
1465
1480
|
headerName: res.title,
|
|
@@ -1499,14 +1514,9 @@ class GridLibraryComponent {
|
|
|
1499
1514
|
buttons: ['reset'],
|
|
1500
1515
|
},
|
|
1501
1516
|
};
|
|
1502
|
-
// }
|
|
1503
|
-
// else {
|
|
1504
|
-
// return;
|
|
1505
|
-
// }
|
|
1506
1517
|
}
|
|
1507
1518
|
}
|
|
1508
1519
|
else {
|
|
1509
|
-
// if (!hideBtn) {
|
|
1510
1520
|
return {
|
|
1511
1521
|
field: res.field,
|
|
1512
1522
|
headerName: res.title,
|
|
@@ -1534,9 +1544,6 @@ class GridLibraryComponent {
|
|
|
1534
1544
|
lockPinned: true,
|
|
1535
1545
|
width: res.label ? 100 : 40,
|
|
1536
1546
|
};
|
|
1537
|
-
// } else {
|
|
1538
|
-
// return;
|
|
1539
|
-
// }
|
|
1540
1547
|
}
|
|
1541
1548
|
});
|
|
1542
1549
|
}
|
|
@@ -1545,7 +1552,6 @@ class GridLibraryComponent {
|
|
|
1545
1552
|
const isAEGroup = this.userRoles.some((role) => role?.toLowerCase().includes('ae'));
|
|
1546
1553
|
const isDesignManager = this.userRoles.includes(this._Design_Manager);
|
|
1547
1554
|
return isAEGroup || isDesignManager ? true : false;
|
|
1548
|
-
//return !(isAEGroup || isDesignManager);
|
|
1549
1555
|
}
|
|
1550
1556
|
return false;
|
|
1551
1557
|
}
|
|
@@ -1638,8 +1644,8 @@ class GridLibraryComponent {
|
|
|
1638
1644
|
}
|
|
1639
1645
|
}));
|
|
1640
1646
|
}
|
|
1641
|
-
// Apply initial filter highlighting
|
|
1642
|
-
|
|
1647
|
+
// Apply initial filter highlighting with retry mechanism
|
|
1648
|
+
this.applyFilterHighlightingWithRetry();
|
|
1643
1649
|
// Event listeners for highlighting
|
|
1644
1650
|
if (this.floatingFilter) {
|
|
1645
1651
|
this.setupFilterInputListeners();
|
|
@@ -1661,6 +1667,7 @@ class GridLibraryComponent {
|
|
|
1661
1667
|
}
|
|
1662
1668
|
this.columnDefs = this.gridColumns;
|
|
1663
1669
|
}
|
|
1670
|
+
debugger;
|
|
1664
1671
|
if (this.gridColumnState) {
|
|
1665
1672
|
this.gridAPI?.applyColumnState({ state: this.gridColumnState.columnSizing?.columnSizingModel, applyOrder: true });
|
|
1666
1673
|
if (this.gridColumnState.sort) {
|
|
@@ -1676,30 +1683,54 @@ class GridLibraryComponent {
|
|
|
1676
1683
|
var hiddenColumns = this.gridColumnState.columnVisibility.hiddenColIds;
|
|
1677
1684
|
this.gridAPI?.setColumnsVisible(hiddenColumns, false);
|
|
1678
1685
|
}
|
|
1686
|
+
this.applyPinnedColumnState(this.gridColumnState);
|
|
1679
1687
|
}
|
|
1680
|
-
else {
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1688
|
+
//else {
|
|
1689
|
+
// var columns = this.gridAPI.getColumns();
|
|
1690
|
+
// if (columns && columns.length > 0) {
|
|
1691
|
+
// if (columns.length > 15) {
|
|
1692
|
+
// const allColumnIds: string[] = [];
|
|
1693
|
+
// this.gridAPI!.getColumns()!.forEach((column: any) => {
|
|
1694
|
+
// allColumnIds.push(column.getId());
|
|
1695
|
+
// });
|
|
1696
|
+
// this.gridAPI.autoSizeColumns(allColumnIds, false);
|
|
1697
|
+
// } else {
|
|
1698
|
+
// this.gridAPI.sizeColumnsToFit();
|
|
1699
|
+
// }
|
|
1700
|
+
// }
|
|
1701
|
+
//}
|
|
1702
|
+
}
|
|
1703
|
+
applyPinnedColumnState(gridState) {
|
|
1704
|
+
const pinnedMap = {};
|
|
1705
|
+
for (const colId of gridState.columnPinning?.leftColIds || []) {
|
|
1706
|
+
pinnedMap[colId] = 'left';
|
|
1707
|
+
}
|
|
1708
|
+
for (const colId of gridState.columnPinning?.rightColIds || []) {
|
|
1709
|
+
pinnedMap[colId] = 'right';
|
|
1694
1710
|
}
|
|
1711
|
+
// Create a map of column widths
|
|
1712
|
+
const widthMap = new Map((gridState.columnSizing?.columnSizingModel || []).map((c) => [c.colId, c.width]));
|
|
1713
|
+
// Merge all into a final state array
|
|
1714
|
+
const columnState = (gridState.columnOrder?.orderedColIds || []).map((colId) => ({
|
|
1715
|
+
colId: colId,
|
|
1716
|
+
pinned: pinnedMap[colId] || null,
|
|
1717
|
+
width: widthMap.get(colId),
|
|
1718
|
+
hide: gridState.columnVisibility?.hiddenColIds?.includes(colId) || false,
|
|
1719
|
+
}));
|
|
1720
|
+
// Apply the full column state
|
|
1721
|
+
this.gridAPI.applyColumnState({
|
|
1722
|
+
state: columnState,
|
|
1723
|
+
applyOrder: true
|
|
1724
|
+
});
|
|
1695
1725
|
}
|
|
1696
1726
|
overrideGridState(overrideStateData) {
|
|
1697
1727
|
this.gridAPI.showLoadingOverlay();
|
|
1698
1728
|
this.gridAPI.resetColumnState();
|
|
1729
|
+
this.gridAPI.setFilterModel(null);
|
|
1699
1730
|
this.gridColumnState = JSON.parse(overrideStateData);
|
|
1700
1731
|
this.setGridState();
|
|
1701
|
-
this.gridAPI.autoSizeAllColumns();
|
|
1702
|
-
setTimeout(() => { this.gridAPI.autoSizeAllColumns(); }, 2000);
|
|
1732
|
+
//this.gridAPI.autoSizeAllColumns();
|
|
1733
|
+
//setTimeout(() => { this.gridAPI.autoSizeAllColumns(); }, 2000);
|
|
1703
1734
|
setTimeout(() => { this.gridAPI.hideOverlay(); }, 500);
|
|
1704
1735
|
}
|
|
1705
1736
|
getGridState() {
|
|
@@ -1716,14 +1747,11 @@ class GridLibraryComponent {
|
|
|
1716
1747
|
this.gridAPI.showLoadingOverlay();
|
|
1717
1748
|
this.gridColumnState = JSON.parse(response.result.gridConfig);
|
|
1718
1749
|
this.setGridState();
|
|
1719
|
-
setTimeout(() => { this.gridStateLoaded = true; this.gridAPI.hideOverlay(); }, 1000);
|
|
1720
|
-
//let manualEvent = { type: 'columnResized' };
|
|
1721
|
-
//this.onSaveGridColumnState(manualEvent);
|
|
1722
1750
|
}
|
|
1723
1751
|
else {
|
|
1724
|
-
//this.setGridState();
|
|
1725
1752
|
console.log('no grid state found.');
|
|
1726
1753
|
}
|
|
1754
|
+
setTimeout(() => { this.gridStateLoaded = true; this.gridAPI.hideOverlay(); }, 1000);
|
|
1727
1755
|
if (this.overrideColumnDefs != null && this.overrideColumnDefs != undefined) {
|
|
1728
1756
|
this.gridStateLoaded$.next(true);
|
|
1729
1757
|
}
|
|
@@ -1753,7 +1781,6 @@ class GridLibraryComponent {
|
|
|
1753
1781
|
this.gridService.saveColumnConfig(columnData)
|
|
1754
1782
|
.pipe(takeUntil(this.unsubscribe$))
|
|
1755
1783
|
.subscribe((res) => {
|
|
1756
|
-
//this.setGridState();
|
|
1757
1784
|
if (res.status == 0) {
|
|
1758
1785
|
console.log('Error while saving column configuration:', res.message);
|
|
1759
1786
|
}
|
|
@@ -1877,15 +1904,20 @@ class GridLibraryComponent {
|
|
|
1877
1904
|
return;
|
|
1878
1905
|
// Clear all filter inputs and highlighting
|
|
1879
1906
|
this.clearFilterInputHighlighting();
|
|
1880
|
-
// Force ag-grid to refresh all filter components
|
|
1907
|
+
// Force ag-grid to refresh all filter components with retry mechanism
|
|
1881
1908
|
setTimeout(() => {
|
|
1882
1909
|
if (this.gridAPI) {
|
|
1883
1910
|
this.gridAPI.refreshHeader();
|
|
1884
|
-
|
|
1911
|
+
// Use robust highlighting approach
|
|
1912
|
+
this.applyFilterHighlightingWithRetry();
|
|
1885
1913
|
this.gridAPI.redrawRows();
|
|
1886
1914
|
}
|
|
1887
1915
|
}, 100);
|
|
1888
1916
|
}
|
|
1917
|
+
// Public method to force refresh of filter highlighting (can be called externally when needed)
|
|
1918
|
+
refreshFilterHighlighting() {
|
|
1919
|
+
this.applyFilterHighlightingWithRetry();
|
|
1920
|
+
}
|
|
1889
1921
|
onFirstDataRendered(e) {
|
|
1890
1922
|
const storedPageNumber = localStorage.getItem('pageNumber');
|
|
1891
1923
|
this.pageNumber = storedPageNumber ? parseInt(storedPageNumber) : 0;
|
|
@@ -1894,7 +1926,7 @@ class GridLibraryComponent {
|
|
|
1894
1926
|
}
|
|
1895
1927
|
this.dataLoaded = true;
|
|
1896
1928
|
setTimeout(() => this.updatePaginationInfo(), 0);
|
|
1897
|
-
setTimeout(() => this.
|
|
1929
|
+
setTimeout(() => this.applyFilterHighlightingWithRetry(), 100);
|
|
1898
1930
|
this.firstDataRendered.emit(e);
|
|
1899
1931
|
}
|
|
1900
1932
|
onGridReadyExcel(params) {
|
|
@@ -1975,29 +2007,64 @@ class GridLibraryComponent {
|
|
|
1975
2007
|
updateFilteredColumnHighlighting() {
|
|
1976
2008
|
if (!this.gridAPI)
|
|
1977
2009
|
return;
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
allColumns
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
2010
|
+
try {
|
|
2011
|
+
const filterModel = this.gridAPI.getFilterModel();
|
|
2012
|
+
const allColumns = this.gridAPI.getColumns();
|
|
2013
|
+
if (allColumns) {
|
|
2014
|
+
allColumns.forEach((column) => {
|
|
2015
|
+
const columnId = column.getColId();
|
|
2016
|
+
const isFiltered = filterModel && filterModel[columnId];
|
|
2017
|
+
// Update header highlighting
|
|
2018
|
+
const headerElement = document.querySelector(`[col-id="${columnId}"]`);
|
|
2019
|
+
if (headerElement) {
|
|
2020
|
+
if (isFiltered) {
|
|
2021
|
+
headerElement.classList.add('ag-header-cell-filtered');
|
|
2022
|
+
}
|
|
2023
|
+
else {
|
|
2024
|
+
headerElement.classList.remove('ag-header-cell-filtered');
|
|
2025
|
+
}
|
|
1991
2026
|
}
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
2027
|
+
// Update filter input highlighting
|
|
2028
|
+
this.highlightFilterInputs(columnId, isFiltered);
|
|
2029
|
+
});
|
|
2030
|
+
}
|
|
2031
|
+
// Clear all highlighting when no filter model
|
|
2032
|
+
if (!filterModel || Object.keys(filterModel).length === 0) {
|
|
2033
|
+
this.clearFilterInputHighlighting();
|
|
2034
|
+
}
|
|
2035
|
+
this.ensureAllValuedInputsAreHighlighted();
|
|
1995
2036
|
}
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
this.clearFilterInputHighlighting();
|
|
2037
|
+
catch (error) {
|
|
2038
|
+
console.warn('Error updating filter highlighting:', error);
|
|
1999
2039
|
}
|
|
2000
2040
|
}
|
|
2041
|
+
ensureAllValuedInputsAreHighlighted() {
|
|
2042
|
+
if (!this.floatingFilter)
|
|
2043
|
+
return;
|
|
2044
|
+
const allFilterInputs = document.querySelectorAll(`
|
|
2045
|
+
.ag-floating-filter-body input,
|
|
2046
|
+
.ag-floating-filter-body .ag-input-field-input,
|
|
2047
|
+
.ag-floating-filter-body .ag-text-field-input,
|
|
2048
|
+
.ag-floating-filter-body .ag-number-field-input,
|
|
2049
|
+
.ag-floating-filter-body .ag-date-field-input,
|
|
2050
|
+
.ag-floating-filter-body .ag-select-field-input,
|
|
2051
|
+
.ag-floating-filter input,
|
|
2052
|
+
.ag-floating-filter .ag-input-field-input,
|
|
2053
|
+
.ag-floating-filter .ag-text-field-input,
|
|
2054
|
+
.ag-floating-filter .ag-number-field-input,
|
|
2055
|
+
.ag-floating-filter .ag-date-field-input,
|
|
2056
|
+
.ag-floating-filter .ag-select-field-input
|
|
2057
|
+
`);
|
|
2058
|
+
allFilterInputs.forEach((input) => {
|
|
2059
|
+
const inputElement = input;
|
|
2060
|
+
if (inputElement.value && inputElement.value.trim() !== '') {
|
|
2061
|
+
inputElement.classList.add('ag-filter-input-active');
|
|
2062
|
+
}
|
|
2063
|
+
else {
|
|
2064
|
+
inputElement.classList.remove('ag-filter-input-active');
|
|
2065
|
+
}
|
|
2066
|
+
});
|
|
2067
|
+
}
|
|
2001
2068
|
// Highlight filter inputs when they have values
|
|
2002
2069
|
highlightFilterInputs(columnId, isFiltered) {
|
|
2003
2070
|
if (!this.floatingFilter)
|
|
@@ -2062,11 +2129,20 @@ class GridLibraryComponent {
|
|
|
2062
2129
|
return false;
|
|
2063
2130
|
}
|
|
2064
2131
|
setupFilterInputListeners() {
|
|
2132
|
+
if (this.filterHighlightingObserver) {
|
|
2133
|
+
this.filterHighlightingObserver.disconnect();
|
|
2134
|
+
}
|
|
2065
2135
|
const observer = new MutationObserver((mutations) => {
|
|
2136
|
+
let shouldUpdateHighlighting = false;
|
|
2066
2137
|
mutations.forEach((mutation) => {
|
|
2067
2138
|
mutation.addedNodes.forEach((node) => {
|
|
2068
2139
|
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
2069
2140
|
const element = node;
|
|
2141
|
+
if (element.classList.contains('ag-floating-filter-body') ||
|
|
2142
|
+
element.classList.contains('ag-floating-filter') ||
|
|
2143
|
+
element.querySelector('.ag-floating-filter-body, .ag-floating-filter')) {
|
|
2144
|
+
shouldUpdateHighlighting = true;
|
|
2145
|
+
}
|
|
2070
2146
|
this.addInputListenersToElement(element);
|
|
2071
2147
|
// Check child elements
|
|
2072
2148
|
const inputs = element.querySelectorAll('input, .ag-input-field-input, .ag-text-field-input, .ag-number-field-input, .ag-date-field-input, .ag-select-field-input');
|
|
@@ -2074,18 +2150,56 @@ class GridLibraryComponent {
|
|
|
2074
2150
|
}
|
|
2075
2151
|
});
|
|
2076
2152
|
});
|
|
2153
|
+
// Update highlighting if filter elements were added
|
|
2154
|
+
if (shouldUpdateHighlighting) {
|
|
2155
|
+
setTimeout(() => this.updateFilteredColumnHighlighting(), 50);
|
|
2156
|
+
}
|
|
2077
2157
|
});
|
|
2078
|
-
|
|
2158
|
+
this.filterHighlightingObserver = observer;
|
|
2159
|
+
// Observe the entire document body to catch all changes
|
|
2160
|
+
const gridContainer = document.querySelector('.ag-root-wrapper') || document.body;
|
|
2079
2161
|
if (gridContainer) {
|
|
2080
2162
|
observer.observe(gridContainer, {
|
|
2081
2163
|
childList: true,
|
|
2082
|
-
subtree: true
|
|
2164
|
+
subtree: true,
|
|
2165
|
+
attributes: true,
|
|
2166
|
+
attributeFilter: ['class', 'style']
|
|
2083
2167
|
});
|
|
2084
2168
|
}
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2169
|
+
this.applyListenersToExistingInputs();
|
|
2170
|
+
}
|
|
2171
|
+
applyListenersToExistingInputs() {
|
|
2172
|
+
const selectors = [
|
|
2173
|
+
'.ag-floating-filter-body input',
|
|
2174
|
+
'.ag-floating-filter-body .ag-input-field-input',
|
|
2175
|
+
'.ag-floating-filter-body .ag-text-field-input',
|
|
2176
|
+
'.ag-floating-filter-body .ag-number-field-input',
|
|
2177
|
+
'.ag-floating-filter-body .ag-date-field-input',
|
|
2178
|
+
'.ag-floating-filter-body .ag-select-field-input',
|
|
2179
|
+
'.ag-floating-filter input',
|
|
2180
|
+
'.ag-floating-filter .ag-input-field-input',
|
|
2181
|
+
'.ag-floating-filter .ag-text-field-input',
|
|
2182
|
+
'.ag-floating-filter .ag-number-field-input',
|
|
2183
|
+
'.ag-floating-filter .ag-date-field-input',
|
|
2184
|
+
'.ag-floating-filter .ag-select-field-input'
|
|
2185
|
+
];
|
|
2186
|
+
let attempts = 0;
|
|
2187
|
+
const maxAttempts = 5;
|
|
2188
|
+
const attemptInterval = 200;
|
|
2189
|
+
const attemptToApplyListeners = () => {
|
|
2190
|
+
const existingInputs = document.querySelectorAll(selectors.join(', '));
|
|
2191
|
+
if (existingInputs.length > 0) {
|
|
2192
|
+
existingInputs.forEach(input => this.addInputListener(input));
|
|
2193
|
+
// update highlighting for existing inputs
|
|
2194
|
+
setTimeout(() => this.updateFilteredColumnHighlighting(), 50);
|
|
2195
|
+
return;
|
|
2196
|
+
}
|
|
2197
|
+
if (attempts < maxAttempts) {
|
|
2198
|
+
attempts++;
|
|
2199
|
+
setTimeout(attemptToApplyListeners, attemptInterval * attempts);
|
|
2200
|
+
}
|
|
2201
|
+
};
|
|
2202
|
+
attemptToApplyListeners();
|
|
2089
2203
|
}
|
|
2090
2204
|
addInputListenersToElement(element) {
|
|
2091
2205
|
const inputs = element.querySelectorAll('input, .ag-input-field-input, .ag-text-field-input, .ag-number-field-input, .ag-date-field-input, .ag-select-field-input');
|
|
@@ -2109,8 +2223,48 @@ class GridLibraryComponent {
|
|
|
2109
2223
|
// First check
|
|
2110
2224
|
highlightInput();
|
|
2111
2225
|
}
|
|
2226
|
+
applyFilterHighlightingWithRetry() {
|
|
2227
|
+
this.filterHighlightingRetryCount = 0;
|
|
2228
|
+
this.attemptFilterHighlighting();
|
|
2229
|
+
}
|
|
2230
|
+
attemptFilterHighlighting() {
|
|
2231
|
+
if (!this.gridAPI) {
|
|
2232
|
+
this.scheduleRetry();
|
|
2233
|
+
return;
|
|
2234
|
+
}
|
|
2235
|
+
// Check if grid is ready/has columns
|
|
2236
|
+
const columns = this.gridAPI.getColumns();
|
|
2237
|
+
if (!columns || columns.length === 0) {
|
|
2238
|
+
this.scheduleRetry();
|
|
2239
|
+
return;
|
|
2240
|
+
}
|
|
2241
|
+
// Check if filter elements exist
|
|
2242
|
+
const filterElements = document.querySelectorAll('.ag-floating-filter-body, .ag-floating-filter');
|
|
2243
|
+
if (filterElements.length === 0) {
|
|
2244
|
+
this.scheduleRetry();
|
|
2245
|
+
return;
|
|
2246
|
+
}
|
|
2247
|
+
this.updateFilteredColumnHighlighting();
|
|
2248
|
+
this.setupFilterInputListeners();
|
|
2249
|
+
this.filterHighlightingRetryCount = 0;
|
|
2250
|
+
}
|
|
2251
|
+
scheduleRetry() {
|
|
2252
|
+
if (this.filterHighlightingRetryCount < this.MAX_RETRY_ATTEMPTS) {
|
|
2253
|
+
this.filterHighlightingRetryCount++;
|
|
2254
|
+
setTimeout(() => {
|
|
2255
|
+
this.attemptFilterHighlighting();
|
|
2256
|
+
}, this.RETRY_DELAY * this.filterHighlightingRetryCount);
|
|
2257
|
+
}
|
|
2258
|
+
else {
|
|
2259
|
+
console.warn('Filter highlighting retry limit reached. Some filter inputs may not be highlighted.');
|
|
2260
|
+
}
|
|
2261
|
+
}
|
|
2112
2262
|
//destroy all associated subscriptions on component destroy
|
|
2113
2263
|
ngOnDestroy() {
|
|
2264
|
+
if (this.filterHighlightingObserver) {
|
|
2265
|
+
this.filterHighlightingObserver.disconnect();
|
|
2266
|
+
this.filterHighlightingObserver = null;
|
|
2267
|
+
}
|
|
2114
2268
|
this.unsubscribe$.next();
|
|
2115
2269
|
this.unsubscribe$.complete();
|
|
2116
2270
|
}
|