Spaces:
Running
Running
Display tables in alphabetic order.
Browse files
lynxkite-app/web/src/workspace/nodes/NodeWithTableView.tsx
CHANGED
@@ -19,45 +19,45 @@ export default function NodeWithTableView(props: any) {
|
|
19 |
const display = props.data.display?.value;
|
20 |
const single =
|
21 |
display?.dataframes && Object.keys(display?.dataframes).length === 1;
|
|
|
|
|
22 |
return (
|
23 |
<LynxKiteNode {...props}>
|
24 |
{display && [
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
{
|
47 |
-
<
|
48 |
-
|
49 |
-
<
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
)
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
),
|
60 |
-
),
|
61 |
Object.entries(display.others || {}).map(([name, o]) => (
|
62 |
<>
|
63 |
<div
|
|
|
19 |
const display = props.data.display?.value;
|
20 |
const single =
|
21 |
display?.dataframes && Object.keys(display?.dataframes).length === 1;
|
22 |
+
const dfs = Object.entries(display.dataframes || {});
|
23 |
+
dfs.sort();
|
24 |
return (
|
25 |
<LynxKiteNode {...props}>
|
26 |
{display && [
|
27 |
+
dfs.map(([name, df]: [string, any]) => (
|
28 |
+
<React.Fragment key={name}>
|
29 |
+
{!single && (
|
30 |
+
<div
|
31 |
+
key={`${name}-header`}
|
32 |
+
className="df-head"
|
33 |
+
onClick={() => setOpen({ ...open, [name]: !open[name] })}
|
34 |
+
>
|
35 |
+
{name}
|
36 |
+
</div>
|
37 |
+
)}
|
38 |
+
{(single || open[name]) &&
|
39 |
+
(df.data.length > 1 ? (
|
40 |
+
<Table
|
41 |
+
key={`${name}-table`}
|
42 |
+
columns={df.columns}
|
43 |
+
data={df.data}
|
44 |
+
/>
|
45 |
+
) : df.data.length ? (
|
46 |
+
<dl key={`${name}-dl`}>
|
47 |
+
{df.columns.map((c: string, i: number) => (
|
48 |
+
<React.Fragment key={`${name}-${c}`}>
|
49 |
+
<dt>{c}</dt>
|
50 |
+
<dd>
|
51 |
+
<Markdown>{toMD(df.data[0][i])}</Markdown>
|
52 |
+
</dd>
|
53 |
+
</React.Fragment>
|
54 |
+
))}
|
55 |
+
</dl>
|
56 |
+
) : (
|
57 |
+
JSON.stringify(df.data)
|
58 |
+
))}
|
59 |
+
</React.Fragment>
|
60 |
+
)),
|
|
|
|
|
61 |
Object.entries(display.others || {}).map(([name, o]) => (
|
62 |
<>
|
63 |
<div
|