Looks nicer

This commit is contained in:
Magnus Åhall 2026-02-23 11:20:16 +01:00
parent 5112113aae
commit ab08d745a1
6 changed files with 279 additions and 79 deletions

View file

@ -18,10 +18,18 @@ body {
.records-tree {
display: grid;
grid-template-columns: min-content 1fr;
grid-template-columns: min-content min-content 1fr;
white-space: nowrap;
.top, .record, .type {
.show {
display: block !important;
}
.top,
.record,
.type,
.value {
display: none;
border-bottom: 1px solid #ccc;
padding: 4px 0px;
}
@ -29,9 +37,38 @@ body {
.top {
font-weight: bold;
background-color: #f8f8f8;
user-select: none;
grid-template-columns: repeat(3, min-content);
align-items: center;
&.open {
.folder.open {
display: inline-block;
}
.folder.closed {
display: none;
}
}
&:not(.open) {
.folder.open {
display: none;
}
.folder.closed {
display: inline-block;
}
}
img {
height: 16px;
display: none;
margin-right: 4px;
}
span:first-child {
/*color: #004680;*/
color: #800033;
}
span:last-child {
@ -39,19 +76,24 @@ body {
font-weight: normal;
}
}
.top + .type {
background-color: #f8f;
.top+.type,
.top+.type+.value {
background-color: #f8f8f8;
}
.top-most,
.top-most + .type,
.top-most + .type + .value
{
display:grid;
}
.record {
/*display: none;*/
display: none;
font-weight: normal;
color: #444;
&.show {
display: block;
}
span:first-child {
color: #800033;
}
@ -61,7 +103,13 @@ body {
}
}
.record + .type {
color: #f0f;
.record+.type,
.record+.type+.value {
display: none;
padding-left: 16px;
}
.record+.type+.value {
color: #800033;
}
}

View file

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="21.200001"
height="16.000025"
viewBox="0 0 5.6091668 4.2333399"
version="1.1"
id="svg1"
inkscape:version="1.4.2 (ebf0e94, 2025-05-08)"
sodipodi:docname="icon_folder.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="px"
inkscape:zoom="22.627417"
inkscape:cx="4.065864"
inkscape:cy="7.6455921"
inkscape:window-width="1916"
inkscape:window-height="1041"
inkscape:window-x="1920"
inkscape:window-y="1098"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs1" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-102.39375,-147.10833)">
<title
id="title1">folder-outline</title>
<rect
style="fill:#ffeeaa;stroke-width:0.352777;stroke-opacity:0.24447;stroke:none"
id="rect1"
width="4.6421375"
height="3.0401909"
x="102.76793"
y="148.04378" />
<path
d="m 107.15625,150.8125 h -4.23333 v -2.64583 h 4.23333 m 0,-0.52917 h -2.11667 l -0.52916,-0.52917 h -1.5875 c -0.29369,0 -0.52917,0.23548 -0.52917,0.52917 v 3.175 a 0.52916667,0.52916667 0 0 0 0.52917,0.52917 h 4.23333 a 0.52916667,0.52916667 0 0 0 0.52917,-0.52917 v -2.64583 c 0,-0.29369 -0.23813,-0.52917 -0.52917,-0.52917 z"
id="path1"
style="stroke-width:0.264583" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="21.200001"
height="16.000025"
viewBox="0 0 5.6091669 4.2333399"
version="1.1"
id="svg1"
inkscape:version="1.4.2 (ebf0e94, 2025-05-08)"
sodipodi:docname="icon_folder_open.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="px"
inkscape:zoom="22.627417"
inkscape:cx="16.440233"
inkscape:cy="12.551145"
inkscape:window-width="1916"
inkscape:window-height="1041"
inkscape:window-x="1920"
inkscape:window-y="1098"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs1" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-98.95417,-154.78124)">
<title
id="title1">folder-outline</title>
<title
id="title1-6">folder-open-outline</title>
<rect
style="fill:#ffeeaa;stroke:none;stroke-width:0.344144;stroke-opacity:0.24447"
id="rect1"
width="4.8876915"
height="2.747865"
x="99.086464"
y="155.83424" />
<path
d="m 100.03896,156.36874 -0.55563,2.11667 v -2.64583 h 4.49792 a 0.52916667,0.52916667 0 0 0 -0.52917,-0.52917 H 101.6 l -0.52917,-0.52917 h -1.5875 a 0.52916667,0.52916667 0 0 0 -0.52916,0.52917 v 3.175 a 0.52916667,0.52916667 0 0 0 0.52916,0.52917 h 3.96875 c 0.23813,0 0.44979,-0.15875 0.50271,-0.39688 l 0.60854,-2.24896 h -4.52437 m 3.41312,2.11667 h -3.43958 l 0.42333,-1.5875 h 3.43959 z"
id="path1"
style="stroke-width:0.264583" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -1,35 +1,6 @@
export class Application {
constructor() {
this.addTopHandlers()
this.moveRecords()
}
moveRecords() {
const records = Array.from(document.querySelectorAll('.record'))
records.sort((a, b) => {
if (a.innerText < b.innerText) return 1
if (a.innerText > b.innerText) return -1
return 0
})
for (const r of records) {
const subTops = document.querySelectorAll(`.top[data-top="${r.dataset.top}"] + .type`)
if (subTops === null) {
continue
}
let lastSubTop = subTops.item(subTops.length - 1)
if (lastSubTop === null) {
lastSubTop = document.querySelector(`.top[data-self="${r.dataset.top}"] + .type`)
}
if (lastSubTop !== null) {
const other = Array.from(document.querySelectorAll(`[data-i="${r.dataset.i}"]`))
console.log(other)
lastSubTop.after(...other)
}
}
}
addTopHandlers() {
@ -39,10 +10,40 @@ export class Application {
handlerTop(event) {
const topEl = event.target.closest('.top')
console.log(topEl.dataset.self)
const records = document.querySelectorAll(`.record[data-top="${topEl.dataset.self}"]`)
for (const r of records) {
r.classList.toggle('show')
let records, types, values
if (topEl.classList.contains('open')) {
records = document.querySelectorAll(`[data-top$="${topEl.dataset.self}"]`)
types = document.querySelectorAll(`[data-top$="${topEl.dataset.self}"] + .type`)
values = document.querySelectorAll(`[data-top$="${topEl.dataset.self}"] + .type + .value`)
for (const r of records) {
r.classList.remove('show')
r.classList.remove('open')
}
for (const r of types)
r.classList.remove('show')
for (const r of values)
r.classList.remove('show')
topEl.classList.remove('open')
} else {
records = document.querySelectorAll(`[data-top="${topEl.dataset.self}"]`)
types = document.querySelectorAll(`[data-top="${topEl.dataset.self}"] + .type`)
values = document.querySelectorAll(`[data-top="${topEl.dataset.self}"] + .type + .value`)
for (const r of records)
r.classList.add('show')
for (const r of types)
r.classList.add('show')
for (const r of values)
r.classList.add('show')
topEl.classList.add('open')
}
}
}