@cdmx/wappler_ag_grid 1.7.5 → 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 +3 -3
- package/dmx-ag-grid.js +37 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -126,7 +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
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").
|
|
131
131
|
|
|
132
132
|
# Tooltip Settings
|
|
@@ -186,7 +186,7 @@ The grid has the following settings:
|
|
|
186
186
|
1. **Field**: The field name for which you want to apply the custom data changes.
|
|
187
187
|
2. **Function**: Create a JavaScript function that defines the custom rendering logic. In your HTML or script section, define the JS function.
|
|
188
188
|
ex: jsChanges.
|
|
189
|
-
|
|
189
|
+
```javascript
|
|
190
190
|
<script>
|
|
191
191
|
function jsChanges(data) {
|
|
192
192
|
const html = `
|
|
@@ -195,7 +195,7 @@ ex: jsChanges.
|
|
|
195
195
|
return html;
|
|
196
196
|
}
|
|
197
197
|
</script>
|
|
198
|
-
|
|
198
|
+
```
|
|
199
199
|
---
|
|
200
200
|
# Custom Headers
|
|
201
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
|
-
|
|
793
|
-
|
|
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
|
-
|
|
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;
|