diff --git a/config/current.ver b/config/current.ver index 03fcdbc..a366a08 100644 --- a/config/current.ver +++ b/config/current.ver @@ -1 +1 @@ -1.2.73 +1.2.74 diff --git a/public/assets/js/bridge/table-builder.js b/public/assets/js/bridge/table-builder.js index a13d765..5213c0a 100644 --- a/public/assets/js/bridge/table-builder.js +++ b/public/assets/js/bridge/table-builder.js @@ -29,7 +29,7 @@ const buildTableHtml = (rows, cols, existing) => { const safeRows = Math.max(1, Math.min(20, Number(rows) || 1)); - const safeCols = Math.max(2, Math.min(2, Number(cols) || 2)); + const safeCols = Math.max(1, Math.min(6, Number(cols) || 2)); const cellStyle = "padding:8px;border:1px solid #e2e8f0;font-size:13px"; const headStyle = "text-align:left;padding:8px;border:1px solid #e2e8f0;background-color:#f8fafc;font-size:13px"; let html = ''; @@ -39,9 +39,9 @@ const existingVal = existing?.[r]?.[c] || ''; const label = existingVal || (r === 0 ? `Spalte ${String.fromCharCode(65 + c)}` : `Zeile ${r} / ${c + 1}`); if (r === 0) { - html += `${label}`; + html += `${label}`; } else { - html += `${label}`; + html += `${label}`; } } html += ''; @@ -55,6 +55,7 @@ if (!modal) return; const attrs = (component.get && component.get('attributes')) || {}; const rows = Number(attrs['data-bridge-rows'] || 3) || 3; + const cols = Number(attrs['data-bridge-cols'] || 2) || 2; const container = document.createElement('div'); container.style.display = 'flex'; @@ -80,6 +81,24 @@ label.appendChild(input); container.appendChild(label); + const colLabel = document.createElement('label'); + colLabel.textContent = 'Anzahl Spalten'; + colLabel.style.fontSize = '13px'; + colLabel.style.fontWeight = '600'; + + const colInput = document.createElement('input'); + colInput.type = 'number'; + colInput.min = '1'; + colInput.max = '6'; + colInput.value = String(cols); + colInput.style.width = '100%'; + colInput.style.padding = '6px 8px'; + colInput.style.border = '1px solid #cbd5f5'; + colInput.style.borderRadius = '4px'; + + colLabel.appendChild(colInput); + container.appendChild(colLabel); + const actions = document.createElement('div'); actions.style.display = 'flex'; actions.style.justifyContent = 'flex-end'; @@ -89,19 +108,26 @@ cancelBtn.type = 'button'; cancelBtn.textContent = 'Abbrechen'; cancelBtn.className = 'btn'; - cancelBtn.addEventListener('click', () => modal.close()); + cancelBtn.addEventListener('click', (event) => { + event.preventDefault(); + event.stopPropagation(); + modal.close(); + }); const saveBtn = document.createElement('button'); saveBtn.type = 'button'; saveBtn.textContent = 'Uebernehmen'; saveBtn.className = 'btn'; - saveBtn.addEventListener('click', () => { + saveBtn.addEventListener('click', (event) => { + event.preventDefault(); + event.stopPropagation(); const nextRows = Math.max(1, Math.min(20, Number(input.value) || 1)); + const nextCols = Math.max(1, Math.min(6, Number(colInput.value) || 1)); const existing = collectTableCells(component); - const html = buildTableHtml(nextRows, 2, existing); + const html = buildTableHtml(nextRows, nextCols, existing); component.addAttributes && component.addAttributes({ 'data-bridge-rows': String(nextRows), - 'data-bridge-cols': '2', + 'data-bridge-cols': String(nextCols), }); if (component.components) { component.components(html);