@schneideress/dashboardframework 20.0.30 → 20.0.31
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.
|
@@ -5049,49 +5049,59 @@ class RADashboardArea {
|
|
|
5049
5049
|
}
|
|
5050
5050
|
return;
|
|
5051
5051
|
}
|
|
5052
|
-
//
|
|
5053
|
-
const
|
|
5054
|
-
|
|
5052
|
+
// Prefer the real data table (ra-grid) so we do not pick unrelated tables when present
|
|
5053
|
+
const dataTable = element.querySelector('table.ra-grid')
|
|
5054
|
+
?? element.querySelector('table');
|
|
5055
|
+
const tbody = dataTable?.querySelector('tbody')
|
|
5056
|
+
?? element.querySelector('tbody');
|
|
5057
|
+
const table = dataTable;
|
|
5055
5058
|
const wcBody = element.querySelector('.wcBody');
|
|
5056
5059
|
const wc = element.querySelector('.wc');
|
|
5057
5060
|
const kendoGridContent = element.querySelector('.k-grid-content');
|
|
5058
5061
|
const kendoGridTable = element.querySelector('.k-grid-table');
|
|
5062
|
+
const addVisibleFilterHeights = (base) => {
|
|
5063
|
+
let h = base;
|
|
5064
|
+
element.querySelectorAll('.ra-widget-filter').forEach((node) => {
|
|
5065
|
+
const fe = node;
|
|
5066
|
+
if (fe.offsetHeight > 0) {
|
|
5067
|
+
h += fe.offsetHeight;
|
|
5068
|
+
}
|
|
5069
|
+
});
|
|
5070
|
+
return h;
|
|
5071
|
+
};
|
|
5059
5072
|
// Measure the actual content height - try multiple strategies to get accurate measurement
|
|
5060
5073
|
let contentHeight = 0;
|
|
5061
5074
|
let measuredElement = null;
|
|
5062
|
-
// Strategy 1:
|
|
5063
|
-
if (
|
|
5075
|
+
// Strategy 1: HTML table / ra-grid — use full table box (thead + tbody), not tbody only (avoids clipping header row)
|
|
5076
|
+
if (table && table.offsetHeight > 0) {
|
|
5077
|
+
measuredElement = table;
|
|
5078
|
+
contentHeight = addVisibleFilterHeights(table.offsetHeight);
|
|
5079
|
+
}
|
|
5080
|
+
// Strategy 2: tbody only (fallback if table not measurable)
|
|
5081
|
+
else if (tbody) {
|
|
5064
5082
|
measuredElement = tbody;
|
|
5065
|
-
// Count actual rows and calculate height
|
|
5066
5083
|
const rows = tbody.querySelectorAll('tr');
|
|
5067
5084
|
if (rows.length > 0) {
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
// Use scrollHeight if available, otherwise use estimated
|
|
5074
|
-
contentHeight = Math.max(tbody.scrollHeight, estimatedHeight);
|
|
5085
|
+
let totalRowHeight = 0;
|
|
5086
|
+
rows.forEach((row) => {
|
|
5087
|
+
totalRowHeight += row.offsetHeight || 30;
|
|
5088
|
+
});
|
|
5089
|
+
contentHeight = addVisibleFilterHeights(totalRowHeight);
|
|
5075
5090
|
}
|
|
5076
5091
|
else {
|
|
5077
|
-
contentHeight = tbody.scrollHeight;
|
|
5092
|
+
contentHeight = addVisibleFilterHeights(tbody.scrollHeight);
|
|
5078
5093
|
}
|
|
5079
5094
|
}
|
|
5080
|
-
// Strategy
|
|
5095
|
+
// Strategy 3: Measure Kendo grid content
|
|
5081
5096
|
else if (kendoGridContent) {
|
|
5082
5097
|
measuredElement = kendoGridContent;
|
|
5083
|
-
contentHeight = kendoGridContent.scrollHeight;
|
|
5098
|
+
contentHeight = addVisibleFilterHeights(kendoGridContent.scrollHeight);
|
|
5084
5099
|
// Also check the table inside
|
|
5085
5100
|
if (kendoGridTable) {
|
|
5086
5101
|
const tableHeight = kendoGridTable.scrollHeight;
|
|
5087
|
-
contentHeight = Math.max(contentHeight, tableHeight);
|
|
5102
|
+
contentHeight = Math.max(contentHeight, addVisibleFilterHeights(tableHeight));
|
|
5088
5103
|
}
|
|
5089
5104
|
}
|
|
5090
|
-
// Strategy 3: Measure table
|
|
5091
|
-
else if (table) {
|
|
5092
|
-
measuredElement = table;
|
|
5093
|
-
contentHeight = table.scrollHeight;
|
|
5094
|
-
}
|
|
5095
5105
|
// Strategy 4: Measure widget content
|
|
5096
5106
|
else if (wc) {
|
|
5097
5107
|
measuredElement = wc;
|
|
@@ -5118,16 +5128,22 @@ class RADashboardArea {
|
|
|
5118
5128
|
// Try offsetHeight
|
|
5119
5129
|
contentHeight = Math.max(contentHeight, offsetH);
|
|
5120
5130
|
}
|
|
5121
|
-
//
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
+
// Sum of tr heights often exceeds table.offsetHeight for many rows (borders/spacing), which grows extra whitespace.
|
|
5132
|
+
// When the table already laid out with a real box height, trust that measurement only.
|
|
5133
|
+
const tableBoxHeightTrusted = !!(table && table.offsetHeight > 0);
|
|
5134
|
+
if (!tableBoxHeightTrusted) {
|
|
5135
|
+
const rowHost = table || tbody;
|
|
5136
|
+
if (rowHost) {
|
|
5137
|
+
const hostEl = rowHost;
|
|
5138
|
+
const allRows = hostEl.querySelectorAll('tr');
|
|
5139
|
+
if (allRows.length > 0) {
|
|
5140
|
+
let totalRowHeight = 0;
|
|
5141
|
+
allRows.forEach((row) => {
|
|
5142
|
+
totalRowHeight += row.offsetHeight || 30;
|
|
5143
|
+
});
|
|
5144
|
+
const withFilters = addVisibleFilterHeights(totalRowHeight);
|
|
5145
|
+
contentHeight = Math.max(contentHeight, withFilters);
|
|
5146
|
+
}
|
|
5131
5147
|
}
|
|
5132
5148
|
}
|
|
5133
5149
|
}
|
|
@@ -5135,8 +5151,8 @@ class RADashboardArea {
|
|
|
5135
5151
|
const header = element.querySelector('.wcheader');
|
|
5136
5152
|
const headerHeight = header ? header.offsetHeight : 46;
|
|
5137
5153
|
// Calculate total height needed (content + header + padding)
|
|
5138
|
-
//
|
|
5139
|
-
const padding =
|
|
5154
|
+
// Slightly less vertical slack for tall tables (grid ceil already adds a partial row).
|
|
5155
|
+
const padding = contentHeight > 380 ? 28 : 36;
|
|
5140
5156
|
const totalHeight = contentHeight + headerHeight + padding;
|
|
5141
5157
|
// Check if content is loaded (reasonable height)
|
|
5142
5158
|
// For expanded view, we expect significant content
|
|
@@ -5146,13 +5162,12 @@ class RADashboardArea {
|
|
|
5146
5162
|
this.measureAndUpdateWidgetDimensions(gridsterItem, attempt + 1, maxAttempts);
|
|
5147
5163
|
return;
|
|
5148
5164
|
}
|
|
5149
|
-
// Calculate rows needed based on grid cell height
|
|
5150
|
-
//
|
|
5151
|
-
const
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
const
|
|
5155
|
-
const newRows = Math.max(Math.ceil(bufferedRows), 4);
|
|
5165
|
+
// Calculate rows needed based on grid cell height.
|
|
5166
|
+
// Blend pixel + fractional cell buffer; keep a bit more for short content to avoid last-row clipping.
|
|
5167
|
+
const bufferPx = contentHeight > 380
|
|
5168
|
+
? Math.max(12, this.gridcellHeight * 0.35)
|
|
5169
|
+
: Math.max(16, this.gridcellHeight * 0.5);
|
|
5170
|
+
const newRows = Math.max(Math.ceil((totalHeight + bufferPx) / this.gridcellHeight), 2);
|
|
5156
5171
|
// For expanded view, use full available width (no spacing needed since widgets stack vertically)
|
|
5157
5172
|
const maxCols = this.responsiveService.maxColsDesktop || 12;
|
|
5158
5173
|
const newCols = maxCols; // Full width
|
|
@@ -5193,8 +5208,12 @@ class RADashboardArea {
|
|
|
5193
5208
|
}
|
|
5194
5209
|
if (el) {
|
|
5195
5210
|
const wcBody = el.querySelector('.wcBody');
|
|
5211
|
+
const tableContainer = el.querySelector('.table-container');
|
|
5212
|
+
const verifyTable = el.querySelector('table.ra-grid')
|
|
5213
|
+
?? el.querySelector('table');
|
|
5196
5214
|
const tbody = el.querySelector('tbody');
|
|
5197
|
-
|
|
5215
|
+
// ra-grid scrolls inside .table-container; measuring tbody alone can miss real overflow
|
|
5216
|
+
const contentEl = tableContainer || verifyTable || tbody || wcBody || el;
|
|
5198
5217
|
// Check if there's scrolling (scrollHeight > clientHeight)
|
|
5199
5218
|
if (contentEl && contentEl.scrollHeight > contentEl.clientHeight + 10) {
|
|
5200
5219
|
// Still has scrolling, need more height
|
|
@@ -5212,6 +5231,23 @@ class RADashboardArea {
|
|
|
5212
5231
|
setTimeout(() => this.setAreaHeight(), 100);
|
|
5213
5232
|
}
|
|
5214
5233
|
}
|
|
5234
|
+
else if (contentEl) {
|
|
5235
|
+
// If there is clear spare space, shrink one row to avoid oversized blank area.
|
|
5236
|
+
// Keep this conservative to prevent oscillation/flapping.
|
|
5237
|
+
const spareHeight = contentEl.clientHeight - contentEl.scrollHeight;
|
|
5238
|
+
const canShrink = spareHeight > (this.gridcellHeight * 0.8) && gridsterItem.rows > 2;
|
|
5239
|
+
if (canShrink) {
|
|
5240
|
+
gridsterItem.rows = gridsterItem.rows - 1;
|
|
5241
|
+
if (gridsterItem.widgetInfo) {
|
|
5242
|
+
gridsterItem.widgetInfo.height = gridsterItem.rows;
|
|
5243
|
+
}
|
|
5244
|
+
this.widgetList = [...this.widgetList];
|
|
5245
|
+
if (this.options && this.options.api) {
|
|
5246
|
+
this.options.api?.optionsChanged();
|
|
5247
|
+
}
|
|
5248
|
+
setTimeout(() => this.setAreaHeight(), 100);
|
|
5249
|
+
}
|
|
5250
|
+
}
|
|
5215
5251
|
}
|
|
5216
5252
|
// Continue with normal retry logic
|
|
5217
5253
|
this.measureAndUpdateWidgetDimensions(gridsterItem, attempt + 1, maxAttempts);
|