@cdmx/wappler_ag_grid 2.0.4 → 2.0.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/dmx-ag-grid.js +17 -58
- package/package.json +1 -1
package/dmx-ag-grid.js
CHANGED
|
@@ -488,8 +488,16 @@ dmx.Component('ag-grid', {
|
|
|
488
488
|
let exportToCSV = this.props.export_to_csv;
|
|
489
489
|
let exportToPDF = this.props.export_to_pdf;
|
|
490
490
|
let cellRenderer;
|
|
491
|
-
|
|
492
|
-
|
|
491
|
+
|
|
492
|
+
// Set up theme mode
|
|
493
|
+
this.$node.innerHTML = `<div id=${options.id}-grid class="${options.grid_theme}"></div>`;
|
|
494
|
+
|
|
495
|
+
// Apply theme mode using dark_mode attribute
|
|
496
|
+
const themeContainer = this.$node.querySelector(`#${options.id}-grid`);
|
|
497
|
+
if (themeContainer) {
|
|
498
|
+
themeContainer.dataset.agThemeMode = options.dark_mode ? 'dark' : 'light';
|
|
499
|
+
}
|
|
500
|
+
|
|
493
501
|
let idFieldPresent = false;
|
|
494
502
|
window.cellClickEvent = (columnName, value, idValue) => {
|
|
495
503
|
this.set('fields', {"field": columnName, "data": value});
|
|
@@ -1049,41 +1057,14 @@ dmx.Component('ag-grid', {
|
|
|
1049
1057
|
};
|
|
1050
1058
|
}
|
|
1051
1059
|
|
|
1052
|
-
// Custom HTML Tooltip Component
|
|
1053
|
-
function CustomTooltipComponent() {}
|
|
1054
1060
|
|
|
1061
|
+
//Tooltip Component
|
|
1062
|
+
function CustomTooltipComponent() {}
|
|
1055
1063
|
CustomTooltipComponent.prototype.init = function(params) {
|
|
1056
|
-
const eGui = this.eGui = document.createElement('div');
|
|
1057
|
-
eGui.classList.add('custom-tooltip');
|
|
1058
|
-
|
|
1059
|
-
// Use the dark_mode option from grid configuration
|
|
1060
|
-
const isDarkMode = params.context && params.context.dark_mode ? params.context.dark_mode : false;
|
|
1061
|
-
|
|
1062
|
-
// Apply theme-aware styling
|
|
1063
|
-
if (isDarkMode) {
|
|
1064
|
-
eGui.style.backgroundColor = '#2d3748';
|
|
1065
|
-
eGui.style.border = '1px solid #4a5568';
|
|
1066
|
-
eGui.style.color = '#e2e8f0';
|
|
1067
|
-
} else {
|
|
1068
|
-
eGui.style.backgroundColor = 'white';
|
|
1069
|
-
eGui.style.border = '1px solid #ccc';
|
|
1070
|
-
eGui.style.color = '#333';
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
eGui.style.borderRadius = '4px';
|
|
1074
|
-
eGui.style.padding = '8px';
|
|
1075
|
-
eGui.style.boxShadow = '0 2px 8px rgba(0,0,0,0.15)';
|
|
1076
|
-
eGui.style.maxWidth = '300px';
|
|
1077
|
-
eGui.style.fontSize = '13px';
|
|
1078
|
-
eGui.style.zIndex = '9999';
|
|
1079
|
-
|
|
1080
1064
|
const tooltipValue = params.value || params.valueFormatted || '';
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
} else {
|
|
1085
|
-
eGui.textContent = tooltipValue;
|
|
1086
|
-
}
|
|
1065
|
+
const eGui = this.eGui = document.createElement('div');
|
|
1066
|
+
eGui.classList.add('ag-tooltip');
|
|
1067
|
+
eGui.innerHTML = tooltipValue;
|
|
1087
1068
|
};
|
|
1088
1069
|
|
|
1089
1070
|
CustomTooltipComponent.prototype.getGui = function() {
|
|
@@ -1477,30 +1458,8 @@ dmx.Component('ag-grid', {
|
|
|
1477
1458
|
...(tooltipComponent ? {
|
|
1478
1459
|
tooltipComponent: tooltipComponent,
|
|
1479
1460
|
tooltipValueGetter: tooltipValueGetter
|
|
1480
|
-
} : tooltipValueGetter && typeof tooltipValueGetter === 'function' ?
|
|
1481
|
-
|
|
1482
|
-
const sampleParams = { data: rowData[0] || {}, value: '' };
|
|
1483
|
-
const sampleTooltip = tooltipValueGetter(sampleParams);
|
|
1484
|
-
const containsHtml = typeof sampleTooltip === 'string' &&
|
|
1485
|
-
(sampleTooltip.includes('<') && sampleTooltip.includes('>'));
|
|
1486
|
-
|
|
1487
|
-
return containsHtml ? {
|
|
1488
|
-
tooltipComponent: 'CustomTooltipComponent',
|
|
1489
|
-
tooltipValueGetter: tooltipValueGetter
|
|
1490
|
-
} : {
|
|
1491
|
-
tooltipValueGetter: tooltipValueGetter
|
|
1492
|
-
};
|
|
1493
|
-
})() : tooltipValueGetter && typeof tooltipValueGetter === 'object' && tooltipValueGetter.isHtml ? {
|
|
1494
|
-
tooltipComponent: function(params) {
|
|
1495
|
-
return {
|
|
1496
|
-
getGui: function() {
|
|
1497
|
-
const element = document.createElement('div');
|
|
1498
|
-
element.innerHTML = tooltipValueGetter.htmlContent;
|
|
1499
|
-
element.className = 'ag-tooltip-custom';
|
|
1500
|
-
return element;
|
|
1501
|
-
}
|
|
1502
|
-
};
|
|
1503
|
-
}
|
|
1461
|
+
} : tooltipValueGetter && typeof tooltipValueGetter === 'function' ? {
|
|
1462
|
+
tooltipValueGetter: tooltipValueGetter
|
|
1504
1463
|
} : {}),
|
|
1505
1464
|
cellStyle: applyCellStyle,
|
|
1506
1465
|
...(cwidths.hasOwnProperty(key) && {
|
package/package.json
CHANGED