@cdmx/wappler_ag_grid 1.7.6 → 1.7.7

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,6 +126,7 @@ 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
+ ```
129
130
  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").
130
131
 
131
132
  # Tooltip Settings
@@ -185,7 +186,7 @@ The grid has the following settings:
185
186
  1. **Field**: The field name for which you want to apply the custom data changes.
186
187
  2. **Function**: Create a JavaScript function that defines the custom rendering logic. In your HTML or script section, define the JS function.
187
188
  ex: jsChanges.
188
-
189
+ ```javascript
189
190
  <script>
190
191
  function jsChanges(data) {
191
192
  const html = `
@@ -194,7 +195,7 @@ ex: jsChanges.
194
195
  return html;
195
196
  }
196
197
  </script>
197
-
198
+ ```
198
199
  ---
199
200
  # Custom Headers
200
201
 
package/dmx-ag-grid.js CHANGED
@@ -728,6 +728,32 @@ dmx.Component('ag-grid', {
728
728
  }
729
729
  });
730
730
  }
731
+ function getDateForComparison(value, timezone) {
732
+ if (value) {
733
+ const date = new Date(value);
734
+ if (timezone) {
735
+ const options = {
736
+ timeZone: timezone,
737
+ year: 'numeric',
738
+ month: '2-digit',
739
+ day: '2-digit',
740
+ hour: '2-digit',
741
+ minute: '2-digit',
742
+ second: '2-digit',
743
+ hour12: false,
744
+ };
745
+ const convertedTimestamp = date.toLocaleString('en-US', options);
746
+ const [datePart, timePart] = convertedTimestamp.split(', ');
747
+ const [month, day, year] = datePart.split('/');
748
+ const [hours, minutes, seconds] = timePart.split(':');
749
+ return new Date(`${year}-${month}-${day}T${hours}:${minutes}:${seconds}`);
750
+ } else {
751
+ return date;
752
+ }
753
+ } else {
754
+ return null;
755
+ }
756
+ }
731
757
  function formatTime(params, timezone) {
732
758
  if (params.value) {
733
759
  const date = new Date(params.value)
@@ -789,9 +815,8 @@ dmx.Component('ag-grid', {
789
815
  }
790
816
  dateFilterParams = {
791
817
  comparator: function (filterLocalDateAtMidnight, cellValue) {
792
- var cellDate = new Date(cellValue);
793
- var filterDate = new Date(filterLocalDateAtMidnight);
794
-
818
+ const cellDate = getDateForComparison(cellValue, timezone);
819
+ const filterDate = new Date(filterLocalDateAtMidnight);
795
820
  // Compare the date portion of the cell value with the filter value
796
821
  var cellDateOnly = new Date(cellDate.getFullYear(), cellDate.getMonth(), cellDate.getDate());
797
822
  var filterDateOnly = new Date(filterDate.getFullYear(), filterDate.getMonth(), filterDate.getDate());
@@ -1165,7 +1190,7 @@ dmx.Component('ag-grid', {
1165
1190
  filter = null;
1166
1191
  }
1167
1192
  }
1168
-
1193
+
1169
1194
 
1170
1195
  if (options.hide_sort) {
1171
1196
  const hideSortArray = options.hide_sort.split(',');
@@ -1852,7 +1877,14 @@ dmx.Component('ag-grid', {
1852
1877
  processCellCallback: function (params) {
1853
1878
  const columnDef = params.column.getColDef();
1854
1879
  const valueFormatter = columnDef.valueFormatter;
1855
- if (valueFormatter && typeof valueFormatter === "function") {
1880
+ const cellRenderer = columnDef.cellRenderer;
1881
+ // Apply cellRenderer if it exists
1882
+ if (cellRenderer && typeof cellRenderer === "function") {
1883
+ const cellRendererValue = cellRenderer(params);
1884
+ console.log(cellRendererValue)
1885
+ return cellRendererValue;
1886
+ }
1887
+ else if (valueFormatter && typeof valueFormatter === "function") {
1856
1888
  const formattedValue = valueFormatter(params);
1857
1889
  if (formattedValue !== null && formattedValue !== undefined) {
1858
1890
  return formattedValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "1.7.6",
3
+ "version": "1.7.7",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation.",
6
6
  "license": "MIT",