Skip to content

Commit 68ae61c

Browse files
committed
geometry, scroll…
1 parent 6c00b27 commit 68ae61c

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

docs/summary-table.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,21 @@ const Inputs = ({..._Inputs, table})
4848

4949
function table(data, options = {}) {
5050
if (!data) return data;
51+
const table = _Inputs.table(data, options);
5152

52-
const container = document.createElement("div");
53-
container.append(_Inputs.table(data, options));
54-
55-
// Duck typing Arrow table
53+
// Duck typing Arrow table
5654
if (!Array.isArray(data?.schema?.fields)) return container;
5755

5856
// Get the fields as described by Arrow, in the order given (potentially) by the options.
5957
const fields = (options.columns?.map(k => data.schema.find(({name}) => name === k)) ?? data.schema.fields).map(({name, type}) => ({name: String(name), type: String(type), values: data.getChild(name)}));
6058

59+
const container = document.createElement("div");
60+
container.append(table);
61+
container.setAttribute("class", "summary-table");
62+
d3.select(table)
63+
.style("min-width", `${120 * fields.length}px`)
64+
.style("max-width", `${280 * fields.length}px`);
65+
6166
const th = d3.select(container).select("thead").selectAll("th").data([{}, ...fields]);
6267
th.append("div").classed("type", true).html(({type}) => type);
6368
const summaries = th.append("div").classed("summary", true);
@@ -192,8 +197,9 @@ async function summary(div) {
192197
193198
<style>
194199
195-
table .type {font-size: smaller; font-weight: normal; color: var(--theme-foreground-muted); height: 1.35em;}
196-
table .summary {font-size: smaller; font-weight: normal; height: 33px;}
197-
footer {font-family: var(--sans-serif); font-size: small; color: var(--theme-foreground-faint)}
200+
.summary-table {max-width: 100%; overflow-x: auto;}
201+
.summary-table table .type {font-size: smaller; font-weight: normal; color: var(--theme-foreground-muted); height: 1.35em;}
202+
.summary-table table .summary {font-size: smaller; font-weight: normal; height: 33px;}
203+
.summary-table footer {font-family: var(--sans-serif); font-size: small; color: var(--theme-foreground-faint)}
198204
199205
</style>

0 commit comments

Comments
 (0)