Initial commit: update

This commit is contained in:
chris
2026-10-20 20:22:38 +00:00
parent b6a6c5de5c
commit 1814ea3a0f
225 changed files with 15006 additions and 1 deletions

View File

@@ -0,0 +1,58 @@
(function () {
function isFilled(cell) {
return cell !== null && cell !== undefined && String(cell).trim() !== "";
}
function escapeText(value) {
return String(value ?? "")
.replace(/&/g, "&")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#39;");
}
window.WorkbenchExcelPreview = {
filledRows(rows) {
return rows.filter(row => Array.isArray(row) && row.some(isFilled));
},
render(containerId, headers, rows) {
const container = document.getElementById(containerId);
if (!container) return;
if (!rows || rows.length === 0) {
container.innerHTML = '<div class="empty-preview">Keine Excel-Daten geladen.</div>';
return;
}
const headerHtml = headers
.map(header => `<th>${escapeText(header)}</th>`)
.join("");
const bodyHtml = rows
.map(row => `<tr>${headers.map((_, index) => `<td>${escapeText(row[index])}</td>`).join("")}</tr>`)
.join("");
container.innerHTML = `
<div class="excel-preview-scroll">
<table class="excel-preview-table">
<thead><tr>${headerHtml}</tr></thead>
<tbody>${bodyHtml}</tbody>
</table>
</div>
<div class="preview-count">${rows.length} Zeilen geladen</div>
`;
},
rowsToObjects(headers, rows) {
return rows.map(row => {
const obj = {};
headers.forEach((header, index) => {
obj[header] = row[index] || "";
});
return obj;
});
}
};
})();