Sortieren und Filtern wie in Excel in jeder Tabelle, Ansichten je Benutzer (0.13.0)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AmyPfuNc4sCRfaF3oURXZz
This commit is contained in:
@@ -186,17 +186,6 @@ export async function bearbeiten(pfad: string, titel: string, felder: Feld[], ze
|
||||
/** Hinweis, der nach dem nächsten Neuaufbau der Seite oben steht */
|
||||
export const hinweis = { text: "" };
|
||||
|
||||
export function tabelle(spalten: { titel: string; wert: (z: Zeile) => string; klasse?: string }[], zeilen: Zeile[], klick?: (z: Zeile) => void): HTMLTableElement {
|
||||
const t = document.createElement("table");
|
||||
t.innerHTML = `<thead><tr>${spalten.map((s) => `<th class="${s.klasse ?? ""}">${esc(s.titel)}</th>`).join("")}</tr></thead>
|
||||
<tbody>${zeilen.map((z, i) => `<tr data-i="${i}" class="${klick ? "klickbar" : ""}">${spalten.map((s) => `<td class="${s.klasse ?? ""}">${s.wert(z)}</td>`).join("")}</tr>`).join("")}</tbody>`;
|
||||
if (klick) t.addEventListener("click", (ev) => {
|
||||
const tr = (ev.target as HTMLElement).closest("tr[data-i]") as HTMLElement | null;
|
||||
if (tr) klick(zeilen[Number(tr.dataset.i)]!);
|
||||
});
|
||||
return t;
|
||||
}
|
||||
|
||||
// Kopf wie bei Plancraft: Titel links, Hauptknopf rechts; darunter eine Leiste für Filter
|
||||
export function seite(titel: string, knopf?: { text: string; aktion: () => void }): HTMLElement {
|
||||
inhalt.innerHTML = `<div class="kopf"><h1>${esc(titel)}</h1></div>${hinweis.text ? `<div class="warnung">${esc(hinweis.text)}</div>` : ""}`;
|
||||
|
||||
Reference in New Issue
Block a user