Skip to content

Commit fb217f1

Browse files
committed
insertion point in src/client/inspect (commented for now)
+ more comments
1 parent 584b6a6 commit fb217f1

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

docs/summary-table.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ display(Inputs.table(await sql`SELECT * FROM aapl`, {columns: ["Date", "Open"]})
5050
// TODO sorting should be stable.
5151
// TODO clip & center categorical/ordinal labels (needs measuring text).
5252
// TODO instead of "other", count "uniques" as in data table cells?
53+
// TODO display nulls cf. https://github.com/observablehq/inputs/pull/214
5354
import * as _Inputs from "npm:@observablehq/inputs"
5455
import * as Arrow from "npm:apache-arrow";
5556
import * as d3 from "npm:d3";
5657
import {html} from "npm:htl";
5758

58-
width; // refresh when resized
59+
width; // refresh when resized (TODO: OK to remove this?)
5960

6061
const Inputs = ({..._Inputs, table});
6162

@@ -117,8 +118,8 @@ function table(data, options = {}) {
117118
const _data = index === index0 ? data : take(data, index);
118119
table.replaceWith(table = _Inputs.table(_data, options));
119120
d3.select(table)
120-
.style("min-width", `${120 * fields.length}px`)
121-
.style("max-width", `${280 * fields.length}px`);
121+
.style("min-width", `${120 * fields.length}px`)
122+
.style("max-width", `${280 * fields.length}px`);
122123
const th = d3.select(table).selectAll("th");
123124
th.append((d, i) => thtype[i]);
124125
th.append((d, i) => thsummary[i]);

src/client/inspect.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
// import {table} from "@observablehq/inputs";
12
import {Inspector} from "observablehq:runtime";
23

34
export function inspect(value) {
5+
// quick and dirty duck-typing of Arrow tables to inspect them as a table.
6+
// if (value && "numRows" in value && Array.isArray(value?.schema?.fields)) value = table(value);
47
const node = document.createElement("div");
58
new Inspector(node).fulfilled(value);
69
return node;

0 commit comments

Comments
 (0)