@ascentgl/ads-ui 21.76.1 → 21.77.0
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.
|
@@ -7720,10 +7720,9 @@ class AdsTableComponent {
|
|
|
7720
7720
|
// For columns without explicit config (like supplier, destination),
|
|
7721
7721
|
// always apply the filter based on selectedValues
|
|
7722
7722
|
const cellValue = node.data[field];
|
|
7723
|
-
//
|
|
7724
|
-
const
|
|
7725
|
-
|
|
7726
|
-
: '';
|
|
7723
|
+
// Use formatter if available to produce a consistent key for comparison
|
|
7724
|
+
const formatter = this.getFilterValueFormatterForField(field);
|
|
7725
|
+
const cellValueStr = this.serializeCellValueForFilter(cellValue, formatter);
|
|
7727
7726
|
if (!selectedValues.includes(cellValueStr)) {
|
|
7728
7727
|
return false;
|
|
7729
7728
|
}
|
|
@@ -8096,6 +8095,22 @@ class AdsTableComponent {
|
|
|
8096
8095
|
}
|
|
8097
8096
|
}
|
|
8098
8097
|
// ============ Custom Sort/Filter Menu Methods ============
|
|
8098
|
+
/** @ignore - Get the filterValueFormatter for a given column field */
|
|
8099
|
+
getFilterValueFormatterForField(field) {
|
|
8100
|
+
const config = this.columnSortFilterConfigs.find(c => c.field === field);
|
|
8101
|
+
return config?.filterValueFormatter;
|
|
8102
|
+
}
|
|
8103
|
+
/**
|
|
8104
|
+
* @ignore - Serialize a cell value for filter key purposes.
|
|
8105
|
+
* When a filterValueFormatter exists, uses the formatted value as the key
|
|
8106
|
+
* so that values with the same display (e.g. same date, different time) are deduplicated.
|
|
8107
|
+
*/
|
|
8108
|
+
serializeCellValueForFilter(value, formatter) {
|
|
8109
|
+
if (formatter) {
|
|
8110
|
+
return formatter(value);
|
|
8111
|
+
}
|
|
8112
|
+
return this.serializeCellValue(value);
|
|
8113
|
+
}
|
|
8099
8114
|
/** @ignore - Extract unique RAW values from a column in rowData (with caching) */
|
|
8100
8115
|
getUniqueColumnValues(field) {
|
|
8101
8116
|
if (!this.rowData || this.rowData.length === 0) {
|
|
@@ -8107,14 +8122,17 @@ class AdsTableComponent {
|
|
|
8107
8122
|
if (cached) {
|
|
8108
8123
|
return cached;
|
|
8109
8124
|
}
|
|
8125
|
+
const formatter = this.getFilterValueFormatterForField(field);
|
|
8110
8126
|
// Use a Map to dedupe by serialized key while preserving raw values
|
|
8111
8127
|
const byKey = new Map();
|
|
8112
8128
|
this.rowData.forEach(row => {
|
|
8113
8129
|
const value = row[field];
|
|
8114
8130
|
if (value !== null && value !== undefined) {
|
|
8115
|
-
const key = this.
|
|
8131
|
+
const key = this.serializeCellValueForFilter(value, formatter);
|
|
8116
8132
|
if (!byKey.has(key)) {
|
|
8117
|
-
|
|
8133
|
+
// When a formatter exists, store the formatted string as the value
|
|
8134
|
+
// so downstream consumers (menu, filter matching) use a consistent key
|
|
8135
|
+
byKey.set(key, formatter ? key : value);
|
|
8118
8136
|
}
|
|
8119
8137
|
}
|
|
8120
8138
|
});
|
|
@@ -8150,6 +8168,7 @@ class AdsTableComponent {
|
|
|
8150
8168
|
this.filteredColumnValuesCache.set(cacheKey, values);
|
|
8151
8169
|
return values;
|
|
8152
8170
|
}
|
|
8171
|
+
const formatter = this.getFilterValueFormatterForField(field);
|
|
8153
8172
|
// Use a Map to dedupe by serialized key while preserving raw values
|
|
8154
8173
|
const byKey = new Map();
|
|
8155
8174
|
// Iterate through all rows and check if they pass filters from OTHER columns
|
|
@@ -8157,9 +8176,9 @@ class AdsTableComponent {
|
|
|
8157
8176
|
if (this.doesRowPassFiltersExcluding(row, field)) {
|
|
8158
8177
|
const value = row[field];
|
|
8159
8178
|
if (value !== null && value !== undefined) {
|
|
8160
|
-
const key = this.
|
|
8179
|
+
const key = this.serializeCellValueForFilter(value, formatter);
|
|
8161
8180
|
if (!byKey.has(key)) {
|
|
8162
|
-
byKey.set(key, value);
|
|
8181
|
+
byKey.set(key, formatter ? key : value);
|
|
8163
8182
|
}
|
|
8164
8183
|
}
|
|
8165
8184
|
}
|
|
@@ -8223,10 +8242,9 @@ class AdsTableComponent {
|
|
|
8223
8242
|
return false;
|
|
8224
8243
|
}
|
|
8225
8244
|
const cellValue = row[field];
|
|
8226
|
-
//
|
|
8227
|
-
const
|
|
8228
|
-
|
|
8229
|
-
: '';
|
|
8245
|
+
// Use formatter if available to produce a consistent key for comparison
|
|
8246
|
+
const formatter = this.getFilterValueFormatterForField(field);
|
|
8247
|
+
const cellValueStr = this.serializeCellValueForFilter(cellValue, formatter);
|
|
8230
8248
|
if (!selectedValues.includes(cellValueStr)) {
|
|
8231
8249
|
return false;
|
|
8232
8250
|
}
|