basesite-shared-grid-lib 15.10.265 → 15.10.267
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/basesite-shared-grid-lib-15.10.267.tgz +0 -0
- package/fesm2022/basesite-shared-grid-lib.mjs +203 -3
- package/fesm2022/basesite-shared-grid-lib.mjs.map +1 -1
- package/lib/grid-library.component.d.ts +8 -0
- package/package.json +1 -1
- package/src/lib/styles/styles.scss +495 -439
- package/basesite-shared-grid-lib-15.10.265.tgz +0 -0
|
Binary file
|
|
@@ -1579,7 +1579,6 @@ class GridLibraryComponent {
|
|
|
1579
1579
|
return `${serverUrl}${options}`;
|
|
1580
1580
|
}
|
|
1581
1581
|
onGridReady(params) {
|
|
1582
|
-
//this.gridPageSize = this.pageSize;
|
|
1583
1582
|
this.gridAPI = params.api;
|
|
1584
1583
|
if (this.enableServerSidePaging == true) {
|
|
1585
1584
|
// Show loading overlay immediately when server-side paging is enabled
|
|
@@ -1598,11 +1597,9 @@ class GridLibraryComponent {
|
|
|
1598
1597
|
const url = this.setExternalFilters(options);
|
|
1599
1598
|
console.log('Server-side API call:', url);
|
|
1600
1599
|
localStorage.setItem('ServerSideUrl', url);
|
|
1601
|
-
// Create a timeout promise
|
|
1602
1600
|
const timeoutPromise = new Promise((_, reject) => {
|
|
1603
1601
|
setTimeout(() => reject(new Error('API request timeout')), API_TIMEOUT);
|
|
1604
1602
|
});
|
|
1605
|
-
// Create the fetch promise
|
|
1606
1603
|
const fetchPromise = fetch(url, {
|
|
1607
1604
|
headers: reqHeaders,
|
|
1608
1605
|
})
|
|
@@ -1641,6 +1638,12 @@ class GridLibraryComponent {
|
|
|
1641
1638
|
}
|
|
1642
1639
|
}));
|
|
1643
1640
|
}
|
|
1641
|
+
// Apply initial filter highlighting
|
|
1642
|
+
setTimeout(() => this.updateFilteredColumnHighlighting(), 500);
|
|
1643
|
+
// Event listeners for highlighting
|
|
1644
|
+
if (this.floatingFilter) {
|
|
1645
|
+
this.setupFilterInputListeners();
|
|
1646
|
+
}
|
|
1644
1647
|
}
|
|
1645
1648
|
setGridState() {
|
|
1646
1649
|
if (this.gridColumns && this.gridColumns.length > 0) {
|
|
@@ -1666,6 +1669,8 @@ class GridLibraryComponent {
|
|
|
1666
1669
|
if (this.gridColumnState.filter) {
|
|
1667
1670
|
var filterModel = this.gridColumnState.filter.filterModel;
|
|
1668
1671
|
this.gridAPI?.setFilterModel(filterModel);
|
|
1672
|
+
// Apply highlighting after setting filter model
|
|
1673
|
+
setTimeout(() => this.updateFilteredColumnHighlighting(), 100);
|
|
1669
1674
|
}
|
|
1670
1675
|
if (this.gridColumnState.columnVisibility) {
|
|
1671
1676
|
var hiddenColumns = this.gridColumnState.columnVisibility.hiddenColIds;
|
|
@@ -1823,6 +1828,63 @@ class GridLibraryComponent {
|
|
|
1823
1828
|
onFilterChanged(e) {
|
|
1824
1829
|
this.saveGridState(e);
|
|
1825
1830
|
this.filterChanged.emit(e);
|
|
1831
|
+
this.updateFilteredColumnHighlighting();
|
|
1832
|
+
}
|
|
1833
|
+
clearFilterInputHighlighting() {
|
|
1834
|
+
if (!this.floatingFilter || !this.gridAPI)
|
|
1835
|
+
return;
|
|
1836
|
+
const allSelectors = [
|
|
1837
|
+
'.ag-floating-filter-body input',
|
|
1838
|
+
'.ag-floating-filter-body .ag-input-field-input',
|
|
1839
|
+
'.ag-floating-filter-body .ag-text-field-input',
|
|
1840
|
+
'.ag-floating-filter-body .ag-number-field-input',
|
|
1841
|
+
'.ag-floating-filter-body .ag-date-field-input',
|
|
1842
|
+
'.ag-floating-filter-body .ag-select-field-input',
|
|
1843
|
+
'.ag-floating-filter input',
|
|
1844
|
+
'.ag-floating-filter .ag-input-field-input',
|
|
1845
|
+
'.ag-floating-filter .ag-text-field-input',
|
|
1846
|
+
'.ag-floating-filter .ag-number-field-input',
|
|
1847
|
+
'.ag-floating-filter .ag-date-field-input',
|
|
1848
|
+
'.ag-floating-filter .ag-select-field-input'
|
|
1849
|
+
];
|
|
1850
|
+
allSelectors.forEach(selector => {
|
|
1851
|
+
const inputs = document.querySelectorAll(selector);
|
|
1852
|
+
inputs.forEach((input) => {
|
|
1853
|
+
const inputElement = input;
|
|
1854
|
+
if (inputElement.value !== undefined) {
|
|
1855
|
+
inputElement.value = '';
|
|
1856
|
+
}
|
|
1857
|
+
// Remove highlighting
|
|
1858
|
+
inputElement.classList.remove('ag-filter-input-active');
|
|
1859
|
+
const inputEvent = new Event('input', { bubbles: true });
|
|
1860
|
+
const changeEvent = new Event('change', { bubbles: true });
|
|
1861
|
+
inputElement.dispatchEvent(inputEvent);
|
|
1862
|
+
inputElement.dispatchEvent(changeEvent);
|
|
1863
|
+
});
|
|
1864
|
+
});
|
|
1865
|
+
const filterContainers = document.querySelectorAll('.ag-floating-filter-body, .ag-floating-filter');
|
|
1866
|
+
filterContainers.forEach(container => {
|
|
1867
|
+
container.classList.remove('ag-filter-input-active');
|
|
1868
|
+
});
|
|
1869
|
+
setTimeout(() => {
|
|
1870
|
+
if (this.gridAPI) {
|
|
1871
|
+
this.gridAPI.redrawRows();
|
|
1872
|
+
}
|
|
1873
|
+
}, 50);
|
|
1874
|
+
}
|
|
1875
|
+
handleExternalFilterReset() {
|
|
1876
|
+
if (!this.gridAPI)
|
|
1877
|
+
return;
|
|
1878
|
+
// Clear all filter inputs and highlighting
|
|
1879
|
+
this.clearFilterInputHighlighting();
|
|
1880
|
+
// Force ag-grid to refresh all filter components
|
|
1881
|
+
setTimeout(() => {
|
|
1882
|
+
if (this.gridAPI) {
|
|
1883
|
+
this.gridAPI.refreshHeader();
|
|
1884
|
+
this.updateFilteredColumnHighlighting();
|
|
1885
|
+
this.gridAPI.redrawRows();
|
|
1886
|
+
}
|
|
1887
|
+
}, 100);
|
|
1826
1888
|
}
|
|
1827
1889
|
onFirstDataRendered(e) {
|
|
1828
1890
|
const storedPageNumber = localStorage.getItem('pageNumber');
|
|
@@ -1832,6 +1894,7 @@ class GridLibraryComponent {
|
|
|
1832
1894
|
}
|
|
1833
1895
|
this.dataLoaded = true;
|
|
1834
1896
|
setTimeout(() => this.updatePaginationInfo(), 0);
|
|
1897
|
+
setTimeout(() => this.updateFilteredColumnHighlighting(), 100);
|
|
1835
1898
|
this.firstDataRendered.emit(e);
|
|
1836
1899
|
}
|
|
1837
1900
|
onGridReadyExcel(params) {
|
|
@@ -1909,6 +1972,143 @@ class GridLibraryComponent {
|
|
|
1909
1972
|
}
|
|
1910
1973
|
}
|
|
1911
1974
|
//custom pagination ends...
|
|
1975
|
+
updateFilteredColumnHighlighting() {
|
|
1976
|
+
if (!this.gridAPI)
|
|
1977
|
+
return;
|
|
1978
|
+
const filterModel = this.gridAPI.getFilterModel();
|
|
1979
|
+
const allColumns = this.gridAPI.getColumns();
|
|
1980
|
+
if (allColumns) {
|
|
1981
|
+
allColumns.forEach((column) => {
|
|
1982
|
+
const columnId = column.getColId();
|
|
1983
|
+
const isFiltered = filterModel && filterModel[columnId];
|
|
1984
|
+
const headerElement = document.querySelector(`[col-id="${columnId}"]`);
|
|
1985
|
+
if (headerElement) {
|
|
1986
|
+
if (isFiltered) {
|
|
1987
|
+
headerElement.classList.add('ag-header-cell-filtered');
|
|
1988
|
+
}
|
|
1989
|
+
else {
|
|
1990
|
+
headerElement.classList.remove('ag-header-cell-filtered');
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
this.highlightFilterInputs(columnId, isFiltered);
|
|
1994
|
+
});
|
|
1995
|
+
}
|
|
1996
|
+
// If filter model is empty or null, clear all input highlighting
|
|
1997
|
+
if (!filterModel || Object.keys(filterModel).length === 0) {
|
|
1998
|
+
this.clearFilterInputHighlighting();
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
// Highlight filter inputs when they have values
|
|
2002
|
+
highlightFilterInputs(columnId, isFiltered) {
|
|
2003
|
+
if (!this.floatingFilter)
|
|
2004
|
+
return;
|
|
2005
|
+
const selectors = [
|
|
2006
|
+
`[col-id="${columnId}"] .ag-floating-filter-body input`,
|
|
2007
|
+
`[col-id="${columnId}"] .ag-floating-filter-body .ag-input-field-input`,
|
|
2008
|
+
`[col-id="${columnId}"] .ag-floating-filter-body .ag-text-field-input`,
|
|
2009
|
+
`[col-id="${columnId}"] .ag-floating-filter-body .ag-number-field-input`,
|
|
2010
|
+
`[col-id="${columnId}"] .ag-floating-filter-body .ag-date-field-input`,
|
|
2011
|
+
`[col-id="${columnId}"] .ag-floating-filter-body .ag-select-field-input`
|
|
2012
|
+
];
|
|
2013
|
+
selectors.forEach(selector => {
|
|
2014
|
+
const inputs = document.querySelectorAll(selector);
|
|
2015
|
+
inputs.forEach((input) => {
|
|
2016
|
+
const inputElement = input;
|
|
2017
|
+
if (isFiltered) {
|
|
2018
|
+
inputElement.classList.add('ag-filter-input-active');
|
|
2019
|
+
}
|
|
2020
|
+
else {
|
|
2021
|
+
inputElement.classList.remove('ag-filter-input-active');
|
|
2022
|
+
}
|
|
2023
|
+
});
|
|
2024
|
+
});
|
|
2025
|
+
// Check for filter values in the filter model
|
|
2026
|
+
if (isFiltered) {
|
|
2027
|
+
const filterModel = this.gridAPI.getFilterModel();
|
|
2028
|
+
const columnFilter = filterModel[columnId];
|
|
2029
|
+
if (columnFilter) {
|
|
2030
|
+
const hasValue = this.filterHasValue(columnFilter);
|
|
2031
|
+
if (hasValue) {
|
|
2032
|
+
const valueInputs = document.querySelectorAll(`[col-id="${columnId}"] .ag-floating-filter-body input[value], [col-id="${columnId}"] .ag-floating-filter-body .ag-input-field-input[value]`);
|
|
2033
|
+
valueInputs.forEach((input) => {
|
|
2034
|
+
const inputElement = input;
|
|
2035
|
+
if (inputElement.value && inputElement.value.trim() !== '') {
|
|
2036
|
+
inputElement.classList.add('ag-filter-input-active');
|
|
2037
|
+
}
|
|
2038
|
+
});
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
filterHasValue(filter) {
|
|
2044
|
+
if (!filter)
|
|
2045
|
+
return false;
|
|
2046
|
+
if (filter.filter) {
|
|
2047
|
+
return filter.filter !== '' && filter.filter !== null && filter.filter !== undefined;
|
|
2048
|
+
}
|
|
2049
|
+
if (filter.condition1 && filter.condition1.filter) {
|
|
2050
|
+
return filter.condition1.filter !== '' && filter.condition1.filter !== null && filter.condition1.filter !== undefined;
|
|
2051
|
+
}
|
|
2052
|
+
if (filter.condition2 && filter.condition2.filter) {
|
|
2053
|
+
return filter.condition2.filter !== '' && filter.condition2.filter !== null && filter.condition2.filter !== undefined;
|
|
2054
|
+
}
|
|
2055
|
+
if (filter.dateFrom || filter.dateTo) {
|
|
2056
|
+
return (filter.dateFrom && filter.dateFrom !== '') || (filter.dateTo && filter.dateTo !== '');
|
|
2057
|
+
}
|
|
2058
|
+
if (filter.filterTo || filter.filterFrom) {
|
|
2059
|
+
return (filter.filterFrom !== null && filter.filterFrom !== undefined && filter.filterFrom !== '') ||
|
|
2060
|
+
(filter.filterTo !== null && filter.filterTo !== undefined && filter.filterTo !== '');
|
|
2061
|
+
}
|
|
2062
|
+
return false;
|
|
2063
|
+
}
|
|
2064
|
+
setupFilterInputListeners() {
|
|
2065
|
+
const observer = new MutationObserver((mutations) => {
|
|
2066
|
+
mutations.forEach((mutation) => {
|
|
2067
|
+
mutation.addedNodes.forEach((node) => {
|
|
2068
|
+
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
2069
|
+
const element = node;
|
|
2070
|
+
this.addInputListenersToElement(element);
|
|
2071
|
+
// Check child elements
|
|
2072
|
+
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');
|
|
2073
|
+
inputs.forEach(input => this.addInputListener(input));
|
|
2074
|
+
}
|
|
2075
|
+
});
|
|
2076
|
+
});
|
|
2077
|
+
});
|
|
2078
|
+
const gridContainer = document.querySelector('.ag-root-wrapper');
|
|
2079
|
+
if (gridContainer) {
|
|
2080
|
+
observer.observe(gridContainer, {
|
|
2081
|
+
childList: true,
|
|
2082
|
+
subtree: true
|
|
2083
|
+
});
|
|
2084
|
+
}
|
|
2085
|
+
setTimeout(() => {
|
|
2086
|
+
const existingInputs = document.querySelectorAll('.ag-floating-filter-body input, .ag-floating-filter-body .ag-input-field-input, .ag-floating-filter-body .ag-text-field-input, .ag-floating-filter-body .ag-number-field-input, .ag-floating-filter-body .ag-date-field-input, .ag-floating-filter-body .ag-select-field-input');
|
|
2087
|
+
existingInputs.forEach(input => this.addInputListener(input));
|
|
2088
|
+
}, 1000);
|
|
2089
|
+
}
|
|
2090
|
+
addInputListenersToElement(element) {
|
|
2091
|
+
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');
|
|
2092
|
+
inputs.forEach(input => this.addInputListener(input));
|
|
2093
|
+
}
|
|
2094
|
+
addInputListener(input) {
|
|
2095
|
+
if (!input)
|
|
2096
|
+
return;
|
|
2097
|
+
const highlightInput = () => {
|
|
2098
|
+
if (input.value && input.value.trim() !== '') {
|
|
2099
|
+
input.classList.add('ag-filter-input-active');
|
|
2100
|
+
}
|
|
2101
|
+
else {
|
|
2102
|
+
input.classList.remove('ag-filter-input-active');
|
|
2103
|
+
}
|
|
2104
|
+
};
|
|
2105
|
+
input.addEventListener('input', highlightInput);
|
|
2106
|
+
input.addEventListener('change', highlightInput);
|
|
2107
|
+
input.addEventListener('keyup', highlightInput);
|
|
2108
|
+
input.addEventListener('paste', highlightInput);
|
|
2109
|
+
// First check
|
|
2110
|
+
highlightInput();
|
|
2111
|
+
}
|
|
1912
2112
|
//destroy all associated subscriptions on component destroy
|
|
1913
2113
|
ngOnDestroy() {
|
|
1914
2114
|
this.unsubscribe$.next();
|