Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c80591531 | ||
|
|
a8116e78f5 | ||
|
|
fa8789a589 | ||
|
|
b38c878724 |
@@ -289,10 +289,6 @@ body {
|
|||||||
border-top: 0;
|
border-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.data-table thead th:has(.col-filter) {
|
|
||||||
padding: 6px 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.kv-table th {
|
.kv-table th {
|
||||||
width: 1%;
|
width: 1%;
|
||||||
}
|
}
|
||||||
@@ -339,40 +335,29 @@ body {
|
|||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.filter-row th {
|
||||||
|
background: var(--surface-2);
|
||||||
|
padding: 5px 8px;
|
||||||
|
border-top: 1px solid var(--border-lite);
|
||||||
|
}
|
||||||
|
|
||||||
.col-filter-text {
|
.col-filter-text {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-width: 40px;
|
min-width: 40px;
|
||||||
border: 1px solid transparent;
|
border: 1px solid var(--border);
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
padding: 2px 4px;
|
padding: 4px 6px;
|
||||||
font: inherit;
|
font: inherit;
|
||||||
font-size: inherit;
|
font-size: 12px;
|
||||||
font-weight: 700;
|
|
||||||
background: transparent;
|
|
||||||
color: var(--ink);
|
|
||||||
}
|
|
||||||
|
|
||||||
.col-filter-text::placeholder {
|
|
||||||
color: var(--ink);
|
|
||||||
opacity: 1;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
|
|
||||||
.col-filter-text:focus-visible,
|
|
||||||
.col-filter-text:hover {
|
|
||||||
border-color: var(--border);
|
|
||||||
background: var(--surface);
|
background: var(--surface);
|
||||||
font-weight: 400;
|
color: var(--ink);
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-filter-text:focus-visible {
|
||||||
outline: 2px solid var(--accent);
|
outline: 2px solid var(--accent);
|
||||||
outline-offset: 1px;
|
outline-offset: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.col-filter-text:not(:placeholder-shown) {
|
|
||||||
border-color: var(--border);
|
|
||||||
background: var(--surface);
|
|
||||||
font-weight: 400;
|
|
||||||
}
|
|
||||||
|
|
||||||
.col-filter-select {
|
.col-filter-select {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-width: 40px;
|
min-width: 40px;
|
||||||
|
|||||||
@@ -36,8 +36,14 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
if (emptyNotice) emptyNotice.hidden = visibleCount > 0;
|
if (emptyNotice) emptyNotice.hidden = visibleCount > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const filterRow = document.createElement("tr");
|
||||||
|
filterRow.className = "filter-row";
|
||||||
|
|
||||||
headerCells.forEach((th, colIndex) => {
|
headerCells.forEach((th, colIndex) => {
|
||||||
const colName = th.dataset.col || "";
|
const colName = th.dataset.col || "";
|
||||||
|
const filterTh = document.createElement("th");
|
||||||
|
if (th.className) filterTh.className = th.className;
|
||||||
|
|
||||||
const isIconCol = colName === "severity_icon" || colName === "status";
|
const isIconCol = colName === "severity_icon" || colName === "status";
|
||||||
|
|
||||||
if (isIconCol) {
|
if (isIconCol) {
|
||||||
@@ -68,15 +74,12 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
activeFilters.set(colIndex, select.value);
|
activeFilters.set(colIndex, select.value);
|
||||||
applyFilters();
|
applyFilters();
|
||||||
});
|
});
|
||||||
th.textContent = "";
|
filterTh.appendChild(select);
|
||||||
th.appendChild(select);
|
|
||||||
}
|
}
|
||||||
} else if (colName) {
|
} else if (colName) {
|
||||||
const input = document.createElement("input");
|
const input = document.createElement("input");
|
||||||
input.type = "text";
|
input.type = "text";
|
||||||
input.className = "col-filter col-filter-text";
|
input.className = "col-filter col-filter-text";
|
||||||
input.placeholder = colName;
|
|
||||||
input.style.minWidth = `${colName.length + 1}ch`;
|
|
||||||
input.setAttribute("aria-label", "filter " + colName);
|
input.setAttribute("aria-label", "filter " + colName);
|
||||||
let debounceTimer;
|
let debounceTimer;
|
||||||
input.addEventListener("input", () => {
|
input.addEventListener("input", () => {
|
||||||
@@ -86,9 +89,12 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
applyFilters();
|
applyFilters();
|
||||||
}, 300);
|
}, 300);
|
||||||
});
|
});
|
||||||
th.textContent = "";
|
filterTh.appendChild(input);
|
||||||
th.appendChild(input);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filterRow.appendChild(filterTh);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
thead.appendChild(filterRow);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user