@cdmx/wappler_ag_grid 1.7.4 → 1.7.6

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/README.md CHANGED
@@ -126,7 +126,6 @@ This grid allows you to define custom color and font settings based on specific
126
126
  return (data.status == 'success');
127
127
  }
128
128
  </script>
129
- </script>
130
129
  2. **Color**: The custom color to apply to row when the condition is met. Enter the color in HEX format (e.g., "#FF0000") or use named colors (e.g., "red").
131
130
 
132
131
  # Tooltip Settings
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "1.7.4",
3
+ "version": "1.7.6",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation.",
6
6
  "license": "MIT",