File size: 1,538 Bytes
8766bc5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | <script>
import { Meta, Template, Story } from "@storybook/addon-svelte-csf";
import Table from "./shared/Table.svelte";
</script>
<Meta
title="Components/DataFrame"
component={Table}
argTypes={{
editable: {
control: [true, false],
description: "Whether the DataFrame is editable",
name: "interactive",
value: true
}
}}
/>
<Template let:args>
<Table {...args} />
</Template>
<Story
name="Interactive dataframe"
args={{
values: [
["Cat", 5],
["Horse", 3],
["Snake", 1]
],
headers: ["Animal", "Votes"],
label: "Animals",
col_count: [2, "dynamic"],
row_count: [3, "dynamic"]
}}
/>
<Story
name="Static dataframe"
args={{
values: [
["Cat", 5],
["Horse", 3],
["Snake", 1]
],
headers: ["Animal", "Votes"],
label: "Animals",
col_count: [2, "dynamic"],
row_count: [3, "dynamic"],
editable: false
}}
/>
<Story
name="Dataframe with markdown and math"
args={{
values: [
["Linear", "$y=x$", "Has a *maximum* of 1 root"],
["Quadratic", "$y=x^2$", "Has a *maximum* of 2 roots"],
["Cubic", "$y=x^3$", "Has a *maximum* of 3 roots"]
],
headers: ["Type", "Example", "Roots"],
datatype: ["str", "markdown", "markdown"],
latex_delimiters: [{ left: "$", right: "$", display: false }],
label: "Math",
col_count: [3, "dynamic"],
row_count: [3, "dynamic"],
editable: false
}}
/>
<Story
name="Empty dataframe"
args={{
values: [[]],
headers: ["Animal", "Votes"],
label: "Animals",
col_count: [2, "dynamic"],
row_count: [0, "dynamic"]
}}
/>
|