diff --git a/demo/demo.css b/demo/demo.css index 54efbec..cc8754f 100644 --- a/demo/demo.css +++ b/demo/demo.css @@ -16,6 +16,8 @@ nav { overflow-x: hidden; overflow-y: auto; padding: 10px; + min-width: 0; + max-width: 40%; width: 320px; } h1 { @@ -26,7 +28,6 @@ h2 { } p { margin: 10px 0; - width: 300px; } .error { color: #c11; @@ -131,6 +132,21 @@ th, td { overflow: hidden; white-space: pre-wrap; } +/* row numbers */ +td:first-child { + background-color: #eaeaeb; + border-right: 1px solid #ddd; + color: #888; + font-size: 10px; + padding: 0 2px; + position: sticky; + left: 0; + text-align: center; + user-select: none; + min-width: 32px; + max-width: none; + width: 32px; +} #filename { font-size: 10pt; diff --git a/demo/demo.js b/demo/demo.js index fd70262..baf1d94 100644 --- a/demo/demo.js +++ b/demo/demo.js @@ -179,6 +179,7 @@ function renderTable(header, data) { const thead = document.createElement('thead') const tbody = document.createElement('tbody') const headerRow = document.createElement('tr') + headerRow.appendChild(document.createElement('th')) for (const columnName of header) { const th = document.createElement('th') th.innerText = columnName @@ -188,6 +189,9 @@ function renderTable(header, data) { table.appendChild(thead) for (const row of data) { const tr = document.createElement('tr') + const rowNumber = document.createElement('td') + rowNumber.innerText = String(tbody.children.length + 1) + tr.appendChild(rowNumber) for (const value of Object.values(row)) { const td = document.createElement('td') td.innerText = stringify(value) diff --git a/index.html b/index.html index 67a311f..5d132e4 100644 --- a/index.html +++ b/index.html @@ -5,6 +5,7 @@