@cdmx/wappler_ag_grid 1.7.4 → 1.7.5
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/dmx-ag-grid.js +16 -2
- package/package.json +1 -1
package/dmx-ag-grid.js
CHANGED
|
@@ -943,7 +943,7 @@ dmx.Component('ag-grid', {
|
|
|
943
943
|
}
|
|
944
944
|
};
|
|
945
945
|
}
|
|
946
|
-
createCombinedFilterValueGetter = (key, dataChanges, dataBindedChanges) => {
|
|
946
|
+
createCombinedFilterValueGetter = (key, dataChanges, dataBindedChanges, displayDataChanges) => {
|
|
947
947
|
const keyLookup = {};
|
|
948
948
|
|
|
949
949
|
dataBindedChanges.forEach(change => {
|
|
@@ -961,6 +961,20 @@ dmx.Component('ag-grid', {
|
|
|
961
961
|
|
|
962
962
|
return function (params) {
|
|
963
963
|
const value = params.data[key];
|
|
964
|
+
if ((displayDataChanges.length > 0) && displayDataChanges.some(change => change.field === key)) {
|
|
965
|
+
const placeholderMap = Object.fromEntries(
|
|
966
|
+
Object.entries(params.data).map(([field, fieldValue]) => [`%${field}%`, fieldValue !== null ? fieldValue : ''])
|
|
967
|
+
);
|
|
968
|
+
return displayDataChanges.reduce((filterValue, change) => {
|
|
969
|
+
if (change.field === key) {
|
|
970
|
+
const placeholders = Object.keys(placeholderMap).join('|');
|
|
971
|
+
// Add a default value for unknown placeholders
|
|
972
|
+
const regex = new RegExp(placeholders + '|%[^%]+%', 'g');
|
|
973
|
+
filterValue = change.data.replace(regex, match => placeholderMap[match] || '');
|
|
974
|
+
}
|
|
975
|
+
return filterValue;
|
|
976
|
+
}, value);
|
|
977
|
+
}
|
|
964
978
|
// Check if there's a matching change in dataChanges
|
|
965
979
|
const matchingChange = dataChanges.find(change => change.field === key && change.value === String(value));
|
|
966
980
|
if (matchingChange) {
|
|
@@ -1056,7 +1070,7 @@ dmx.Component('ag-grid', {
|
|
|
1056
1070
|
}
|
|
1057
1071
|
else {
|
|
1058
1072
|
valueGetter = createCombinedValueGetter(key, options.data_changes, options.data_binded_changes, options.display_data_changes);
|
|
1059
|
-
filterValueGetter = createCombinedFilterValueGetter(key, options.data_changes, options.data_binded_changes);
|
|
1073
|
+
filterValueGetter = createCombinedFilterValueGetter(key, options.data_changes, options.data_binded_changes, options.display_data_changes);
|
|
1060
1074
|
tooltipValueGetter = createCombinedTooltipValueGetter(key, options.data_changes, options.data_binded_changes);
|
|
1061
1075
|
|
|
1062
1076
|
}
|