adasd
This commit is contained in:
@@ -1 +1 @@
|
|||||||
1.2.73
|
1.2.74
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
const buildTableHtml = (rows, cols, existing) => {
|
const buildTableHtml = (rows, cols, existing) => {
|
||||||
const safeRows = Math.max(1, Math.min(20, Number(rows) || 1));
|
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 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";
|
const headStyle = "text-align:left;padding:8px;border:1px solid #e2e8f0;background-color:#f8fafc;font-size:13px";
|
||||||
let html = '';
|
let html = '';
|
||||||
@@ -39,9 +39,9 @@
|
|||||||
const existingVal = existing?.[r]?.[c] || '';
|
const existingVal = existing?.[r]?.[c] || '';
|
||||||
const label = existingVal || (r === 0 ? `Spalte ${String.fromCharCode(65 + c)}` : `Zeile ${r} / ${c + 1}`);
|
const label = existingVal || (r === 0 ? `Spalte ${String.fromCharCode(65 + c)}` : `Zeile ${r} / ${c + 1}`);
|
||||||
if (r === 0) {
|
if (r === 0) {
|
||||||
html += `<th style="${headStyle}">${label}</th>`;
|
html += `<th data-gjs-selectable="false" data-gjs-draggable="false" style="${headStyle}">${label}</th>`;
|
||||||
} else {
|
} else {
|
||||||
html += `<td style="${cellStyle}">${label}</td>`;
|
html += `<td data-gjs-selectable="false" data-gjs-draggable="false" style="${cellStyle}">${label}</td>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
html += '</tr>';
|
html += '</tr>';
|
||||||
@@ -55,6 +55,7 @@
|
|||||||
if (!modal) return;
|
if (!modal) return;
|
||||||
const attrs = (component.get && component.get('attributes')) || {};
|
const attrs = (component.get && component.get('attributes')) || {};
|
||||||
const rows = Number(attrs['data-bridge-rows'] || 3) || 3;
|
const rows = Number(attrs['data-bridge-rows'] || 3) || 3;
|
||||||
|
const cols = Number(attrs['data-bridge-cols'] || 2) || 2;
|
||||||
|
|
||||||
const container = document.createElement('div');
|
const container = document.createElement('div');
|
||||||
container.style.display = 'flex';
|
container.style.display = 'flex';
|
||||||
@@ -80,6 +81,24 @@
|
|||||||
label.appendChild(input);
|
label.appendChild(input);
|
||||||
container.appendChild(label);
|
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');
|
const actions = document.createElement('div');
|
||||||
actions.style.display = 'flex';
|
actions.style.display = 'flex';
|
||||||
actions.style.justifyContent = 'flex-end';
|
actions.style.justifyContent = 'flex-end';
|
||||||
@@ -89,19 +108,26 @@
|
|||||||
cancelBtn.type = 'button';
|
cancelBtn.type = 'button';
|
||||||
cancelBtn.textContent = 'Abbrechen';
|
cancelBtn.textContent = 'Abbrechen';
|
||||||
cancelBtn.className = 'btn';
|
cancelBtn.className = 'btn';
|
||||||
cancelBtn.addEventListener('click', () => modal.close());
|
cancelBtn.addEventListener('click', (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
modal.close();
|
||||||
|
});
|
||||||
|
|
||||||
const saveBtn = document.createElement('button');
|
const saveBtn = document.createElement('button');
|
||||||
saveBtn.type = 'button';
|
saveBtn.type = 'button';
|
||||||
saveBtn.textContent = 'Uebernehmen';
|
saveBtn.textContent = 'Uebernehmen';
|
||||||
saveBtn.className = 'btn';
|
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 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 existing = collectTableCells(component);
|
||||||
const html = buildTableHtml(nextRows, 2, existing);
|
const html = buildTableHtml(nextRows, nextCols, existing);
|
||||||
component.addAttributes && component.addAttributes({
|
component.addAttributes && component.addAttributes({
|
||||||
'data-bridge-rows': String(nextRows),
|
'data-bridge-rows': String(nextRows),
|
||||||
'data-bridge-cols': '2',
|
'data-bridge-cols': String(nextCols),
|
||||||
});
|
});
|
||||||
if (component.components) {
|
if (component.components) {
|
||||||
component.components(html);
|
component.components(html);
|
||||||
|
|||||||
Reference in New Issue
Block a user