@spectric/ui 0.0.21 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/dialog/dialog.d.ts +1 -0
- package/dist/components/pagination/pagination.d.ts +1 -1
- package/dist/components/query_bar/QueryBar.d.ts +30 -10
- package/dist/components/query_bar/dateTimePopup.d.ts +2 -0
- package/dist/components/query_bar/geojsonPopup.d.ts +2 -0
- package/dist/components/query_bar/querylanguage/kuery/functions/geospatial.d.ts +19 -0
- package/dist/components/query_bar/querylanguage/outputTypes/toCQL.d.ts +2 -1
- package/dist/components/query_bar/querylanguage/outputTypes/toMongo.d.ts +6 -1
- package/dist/components/symbols.d.ts +6 -0
- package/dist/components/table/cell.d.ts +1 -1
- package/dist/components/table/table.d.ts +5 -1
- package/dist/custom-elements.json +5 -5
- package/dist/index.d.ts +4 -0
- package/dist/index.es.js +4382 -2795
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +349 -248
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +6 -1
- package/src/components/dialog/dialog.css.ts +29 -29
- package/src/components/dialog/dialog.ts +3 -1
- package/src/components/input.ts +49 -39
- package/src/components/pagination/pagination.ts +167 -113
- package/src/components/query_bar/QueryBar.ts +438 -187
- package/src/components/query_bar/dateTimePopup.ts +54 -0
- package/src/components/query_bar/geojsonPopup.ts +44 -0
- package/src/components/query_bar/querylanguage/kuery/ast/_generated_/kuery.js +1836 -2745
- package/src/components/query_bar/querylanguage/kuery/ast/ast.ts +15 -13
- package/src/components/query_bar/querylanguage/kuery/ast/kuery.peg +92 -126
- package/src/components/query_bar/querylanguage/kuery/functions/geospatial.ts +25 -0
- package/src/components/query_bar/querylanguage/kuery/functions/index.ts +9 -7
- package/src/components/query_bar/querylanguage/outputTypes/toCQL.ts +56 -34
- package/src/components/query_bar/querylanguage/outputTypes/toMongo.ts +46 -34
- package/src/components/symbols.ts +6 -0
- package/src/components/table/__tests__/table.spec.ts +2 -2
- package/src/components/table/cell.ts +7 -3
- package/src/components/table/header.ts +3 -2
- package/src/components/table/table.css +4 -2
- package/src/components/table/table.ts +61 -5
- package/src/components/table/virtualBody.ts +8 -3
- package/src/components/tooltip/popover.ts +263 -225
- package/src/stories/Dialog.stories.ts +59 -0
- package/src/stories/QueryBar.stories.ts +46 -37
- package/src/stories/fixtures/data.ts +195 -36
- package/src/stories/table.stories.ts +70 -22
|
@@ -1,55 +1,64 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/web-components";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
SupportedLanguages,
|
|
5
|
+
type IQueryProps,
|
|
6
|
+
} from "../components/query_bar/QueryBar";
|
|
7
|
+
import "../components";
|
|
8
|
+
import { html } from "lit";
|
|
9
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
10
|
+
import { useArgs } from "@storybook/client-api";
|
|
11
|
+
import { filterByColumn } from "./fixtures/data";
|
|
9
12
|
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
10
|
-
var code = ""
|
|
13
|
+
var code = "";
|
|
11
14
|
|
|
12
15
|
const meta = {
|
|
13
|
-
title:
|
|
14
|
-
tags: [
|
|
16
|
+
title: "UI/Query",
|
|
17
|
+
tags: ["autodocs"],
|
|
15
18
|
component: "spectric-query",
|
|
16
19
|
render: (args) => {
|
|
17
20
|
const [_, updateArgs] = useArgs();
|
|
18
21
|
const fakevalues = async (field, text) => {
|
|
19
|
-
if (!args.fields.find(f => f.name === field)) {
|
|
20
|
-
return []
|
|
22
|
+
if (!args.fields.find((f) => f.name === field)) {
|
|
23
|
+
return [];
|
|
21
24
|
}
|
|
22
|
-
return filterByColumn(field, text)
|
|
23
|
-
}
|
|
25
|
+
return filterByColumn(field, text);
|
|
26
|
+
};
|
|
24
27
|
return html`
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
<pre>
|
|
28
|
+
<spectric-query
|
|
29
|
+
.fields=${args.fields}
|
|
30
|
+
.getValuesForField=${fakevalues}
|
|
31
|
+
value=${ifDefined(args.value)}
|
|
32
|
+
@change=${(e: CustomEvent<any>) => {
|
|
33
|
+
code = e.detail;
|
|
34
|
+
updateArgs({ ...args });
|
|
35
|
+
}}
|
|
36
|
+
outputLanguage=${args.outputLanguage}
|
|
37
|
+
>
|
|
38
|
+
</spectric-query>
|
|
39
|
+
<pre>
|
|
38
40
|
${JSON.stringify(code, null, 2)}
|
|
39
|
-
</pre
|
|
40
|
-
|
|
41
|
+
</pre
|
|
42
|
+
>
|
|
43
|
+
`;
|
|
44
|
+
},
|
|
41
45
|
argTypes: {
|
|
42
|
-
|
|
43
46
|
outputLanguage: {
|
|
44
|
-
control: { type:
|
|
47
|
+
control: { type: "select" },
|
|
45
48
|
options: Object.values(SupportedLanguages),
|
|
46
49
|
},
|
|
47
50
|
},
|
|
48
51
|
args: {
|
|
49
|
-
outputLanguage:
|
|
50
|
-
fields: [
|
|
52
|
+
outputLanguage: "toDSL",
|
|
53
|
+
fields: [
|
|
54
|
+
{ name: "test", type: "string" },
|
|
55
|
+
{ name: "test_num", type: "number" },
|
|
56
|
+
{ name: "test_bool", type: "boolean" },
|
|
57
|
+
{ name: "modulations", type: "string" },
|
|
58
|
+
{ name: "time_seen", type: "string", format: "date-time" },
|
|
59
|
+
{ name: "geo_center", type: "object", format: "geojson" },
|
|
60
|
+
],
|
|
51
61
|
},
|
|
52
|
-
|
|
53
62
|
} satisfies Meta<IQueryProps>;
|
|
54
63
|
|
|
55
64
|
export default meta;
|
|
@@ -58,13 +67,13 @@ type Story = StoryObj<IQueryProps>;
|
|
|
58
67
|
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
59
68
|
export const Basic: Story = {
|
|
60
69
|
args: {
|
|
61
|
-
outputLanguage: "toCql"
|
|
70
|
+
outputLanguage: "toCql",
|
|
62
71
|
},
|
|
63
72
|
};
|
|
64
73
|
|
|
65
74
|
export const ShouldHaveValue: Story = {
|
|
66
75
|
args: {
|
|
67
76
|
outputLanguage: "toCql",
|
|
68
|
-
value:"test: * and test_num > 10"
|
|
77
|
+
value: "test: * and test_num > 10",
|
|
69
78
|
},
|
|
70
|
-
};
|
|
79
|
+
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ColumnSettings } from "../../components/table";
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
export const modulations = [
|
|
5
4
|
"AM",
|
|
6
5
|
"FM",
|
|
@@ -11,54 +10,214 @@ export const modulations = [
|
|
|
11
10
|
"PSK",
|
|
12
11
|
"OFDM",
|
|
13
12
|
"PCM",
|
|
14
|
-
"DPSK"
|
|
13
|
+
"DPSK",
|
|
15
14
|
];
|
|
16
15
|
//pulled from https://www.sigidwiki.com/wiki/Category:Digital signals that don't have a space or -
|
|
17
|
-
export const signals = [
|
|
16
|
+
export const signals = [
|
|
17
|
+
"802.11n",
|
|
18
|
+
"8PSK",
|
|
19
|
+
"ASCII",
|
|
20
|
+
"AUTOSPEC",
|
|
21
|
+
"Aprizesat",
|
|
22
|
+
"Autocab",
|
|
23
|
+
"Bluetooth",
|
|
24
|
+
"CCITT",
|
|
25
|
+
"CDMA420",
|
|
26
|
+
"CHIP",
|
|
27
|
+
"CHU",
|
|
28
|
+
"COFDMTV",
|
|
29
|
+
"CompuLert",
|
|
30
|
+
"Contestia",
|
|
31
|
+
"Coquelet",
|
|
32
|
+
"DCF77",
|
|
33
|
+
"DominoEX",
|
|
34
|
+
"DominoF",
|
|
35
|
+
"EIA",
|
|
36
|
+
"FLEX",
|
|
37
|
+
"FSK441",
|
|
38
|
+
"FSQ",
|
|
39
|
+
"FST4W",
|
|
40
|
+
"FT4",
|
|
41
|
+
"FT8",
|
|
42
|
+
"Hellschreiber",
|
|
43
|
+
"ISCAT",
|
|
44
|
+
"JS8",
|
|
45
|
+
"JT4",
|
|
46
|
+
"JT65",
|
|
47
|
+
"JT6M",
|
|
48
|
+
"JT9",
|
|
49
|
+
"JTMS",
|
|
50
|
+
"Kiwi",
|
|
51
|
+
"Lentus",
|
|
52
|
+
"LoRa",
|
|
53
|
+
"MDC1200",
|
|
54
|
+
"MOBITEX",
|
|
55
|
+
"MSK144",
|
|
56
|
+
"MT63",
|
|
57
|
+
"Milstar",
|
|
58
|
+
"NML",
|
|
59
|
+
"NOV",
|
|
60
|
+
"NPM",
|
|
61
|
+
"NWC",
|
|
62
|
+
"Olivia",
|
|
63
|
+
"OpenSky",
|
|
64
|
+
"Orbcomm",
|
|
65
|
+
"PACKET",
|
|
66
|
+
"PAX",
|
|
67
|
+
"PI4",
|
|
68
|
+
"POCSAG",
|
|
69
|
+
"PSK2K",
|
|
70
|
+
"Piccolo",
|
|
71
|
+
"ProVoice",
|
|
72
|
+
"Q15X25",
|
|
73
|
+
"ROS",
|
|
74
|
+
"RTTYM",
|
|
75
|
+
"ReFLEX",
|
|
76
|
+
"SIGFOX",
|
|
77
|
+
"SPREAD",
|
|
78
|
+
"Serdolik",
|
|
79
|
+
"SkyOFDM",
|
|
80
|
+
"THOR",
|
|
81
|
+
"THROB",
|
|
82
|
+
"TT2300",
|
|
83
|
+
"TWINPLEX",
|
|
84
|
+
"Tetrapol",
|
|
85
|
+
"VISEL",
|
|
86
|
+
"VOICE",
|
|
87
|
+
"WSPR",
|
|
88
|
+
"WiMAX",
|
|
89
|
+
"WinDRM",
|
|
90
|
+
];
|
|
18
91
|
export const filterByColumn = async (field, text) => {
|
|
92
|
+
if (field === "geo_center") {
|
|
93
|
+
return [
|
|
94
|
+
{
|
|
95
|
+
label: "Tucuman Argentina",
|
|
96
|
+
value:
|
|
97
|
+
"POLYGON ((-66.20361328125 -26.62781822639305, -66.0498046875 -26.64745870265937, -65.830078125 -26.725986812271756, -65.89599609375 -26.92206991673281, -66.181640625 -27.274161117374668, -65.6103515625 -27.994401411046148, -65.4345703125 -27.89734922968425, -65.0390625 -27.89734922968425, -64.4677734375 -26.29341500426577, -65.36865234375 -26.07652055985696, -65.85205078125 -26.31311263768267, -66.11572265625 -26.2145910237943, -66.20361328125 -26.62781822639305))",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
label: "Santiago Argentina",
|
|
101
|
+
value:
|
|
102
|
+
"POLYGON ((-64.42108154296874 -26.28356493253137, -65.0390625 -27.885211577912145, -65.18463134765625 -27.931327412293648, -65.08026123046874 -28.738763971370293, -64.88250732421875 -28.7965462417692, -64.81658935546872 -29.506549442788607, -62.79510498046873 -29.869228848968298, -62.091979980468736 -30.439202087235568, -61.58660888671873 -25.671235828577018, -64.22332763671874 -25.651430347039724, -64.42108154296874 -26.28356493253137))",
|
|
103
|
+
},
|
|
104
|
+
];
|
|
105
|
+
}
|
|
19
106
|
if (field === "time_seen") {
|
|
20
|
-
return []
|
|
107
|
+
return [];
|
|
21
108
|
}
|
|
22
109
|
if (field === "modulations") {
|
|
23
|
-
return modulations.filter(v => v.match(new RegExp(text, "gi")))
|
|
110
|
+
return modulations.filter((v) => v.match(new RegExp(text, "gi")));
|
|
24
111
|
}
|
|
25
112
|
if (field === "signal") {
|
|
26
|
-
return signals.filter(v => v.match(new RegExp(text, "gi")))
|
|
113
|
+
return signals.filter((v) => v.match(new RegExp(text, "gi")));
|
|
27
114
|
}
|
|
28
|
-
let ipsum = `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
|
|
29
|
-
let values = [
|
|
115
|
+
let ipsum = `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.`;
|
|
116
|
+
let values = [
|
|
117
|
+
"test",
|
|
118
|
+
"some value",
|
|
119
|
+
"10000",
|
|
120
|
+
...ipsum.split(" ").map((v) => `${v}`),
|
|
121
|
+
];
|
|
30
122
|
if (text == "") {
|
|
31
|
-
return values
|
|
123
|
+
return values;
|
|
32
124
|
}
|
|
33
|
-
return values.filter(v => v.includes(text))
|
|
34
|
-
}
|
|
125
|
+
return values.filter((v) => v.includes(text));
|
|
126
|
+
};
|
|
35
127
|
|
|
36
128
|
export type TestData = {
|
|
37
|
-
name: string
|
|
38
|
-
company: string
|
|
39
|
-
contact: string
|
|
129
|
+
name: string;
|
|
130
|
+
company: string;
|
|
131
|
+
contact: string;
|
|
40
132
|
location: {
|
|
41
|
-
country: string
|
|
42
|
-
state: string
|
|
43
|
-
}
|
|
44
|
-
years: number
|
|
45
|
-
}
|
|
133
|
+
country: string;
|
|
134
|
+
state: string;
|
|
135
|
+
};
|
|
136
|
+
years: number;
|
|
137
|
+
};
|
|
46
138
|
export const tabledata: TestData[] = [
|
|
47
|
-
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
139
|
+
{
|
|
140
|
+
name: "Sean",
|
|
141
|
+
company: "Spectric Labs",
|
|
142
|
+
contact: "123-4567",
|
|
143
|
+
location: { country: "US", state: "VA" },
|
|
144
|
+
years: 11,
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "Kipp",
|
|
148
|
+
company: "Spectric Labs",
|
|
149
|
+
contact: "123-4567",
|
|
150
|
+
location: { country: "UK", state: "N/A" },
|
|
151
|
+
years: 5,
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: "Adam",
|
|
155
|
+
company: "Spectric Labs",
|
|
156
|
+
contact: "123-4567",
|
|
157
|
+
location: { country: "US", state: "VA" },
|
|
158
|
+
years: 19,
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: "Chris",
|
|
162
|
+
company: "Spectric Labs",
|
|
163
|
+
contact: "123-4567",
|
|
164
|
+
location: { country: "US", state: "VA" },
|
|
165
|
+
years: 27,
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: "Michael",
|
|
169
|
+
company: "Spectric Labs",
|
|
170
|
+
contact: "123-4567",
|
|
171
|
+
location: { country: "US", state: "VA" },
|
|
172
|
+
years: 3,
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: "Matt",
|
|
176
|
+
company: "Spectric Labs",
|
|
177
|
+
contact: "123-4567",
|
|
178
|
+
location: { country: "US", state: "VA" },
|
|
179
|
+
years: 9,
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: "Matt",
|
|
183
|
+
company: "Spectric Labs",
|
|
184
|
+
contact: "865-6343",
|
|
185
|
+
location: { country: "UK", state: "VA" },
|
|
186
|
+
years: 5,
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
name: "Matt",
|
|
190
|
+
company: "Spectric Labs",
|
|
191
|
+
contact: "253-6795",
|
|
192
|
+
location: { country: "UK", state: "VA" },
|
|
193
|
+
years: 15,
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: "Matt",
|
|
197
|
+
company: "Spectric Labs (Intern)",
|
|
198
|
+
contact: "253-6795",
|
|
199
|
+
location: { country: "US", state: "CO" },
|
|
200
|
+
years: 1,
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
name: "Matt",
|
|
204
|
+
company: "Spectric Labs",
|
|
205
|
+
contact: "912-1230",
|
|
206
|
+
location: { country: "UK", state: "VA" },
|
|
207
|
+
years: 24,
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
name: "Grant",
|
|
211
|
+
company: "Spectric Labs",
|
|
212
|
+
contact: "123-4567",
|
|
213
|
+
location: { country: "US", state: "VA" },
|
|
214
|
+
years: 100,
|
|
215
|
+
},
|
|
216
|
+
];
|
|
58
217
|
export const tablecolumns: ColumnSettings<TestData>[] = [
|
|
59
|
-
{
|
|
60
|
-
{
|
|
61
|
-
{
|
|
62
|
-
{
|
|
63
|
-
{
|
|
64
|
-
]
|
|
218
|
+
{ title: "Company", key: "company", width: 200 },
|
|
219
|
+
{ title: "Name", key: "name", sortable: true },
|
|
220
|
+
{ title: "Contact", key: "contact" },
|
|
221
|
+
{ title: "Country", key: "location.country", filterable: true },
|
|
222
|
+
{ title: "Years Employed", key: "years", sortable: true },
|
|
223
|
+
];
|
|
@@ -2,15 +2,54 @@ import type { Meta, StoryObj } from "@storybook/web-components";
|
|
|
2
2
|
|
|
3
3
|
//import { ColumnSettings, PaginationChangeProps, TableElement, TableSelectOptions, TableSortDirection, TableSortOption, type TableProps as Props } from "../components/";
|
|
4
4
|
import { html } from "lit";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
ColumnSettings,
|
|
7
|
+
PaginationChangeProps,
|
|
8
|
+
SpectricTableElement,
|
|
9
|
+
TableDataOptions,
|
|
10
|
+
TableSelectOptions,
|
|
11
|
+
TableSortDirection,
|
|
12
|
+
TableSortOption,
|
|
13
|
+
type TableProps as Props,
|
|
14
|
+
} from "../index";
|
|
6
15
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
7
16
|
import { useArgs } from "@storybook/client-api";
|
|
8
17
|
import { FilterEvent, rowGetValue } from "../components/table/cell";
|
|
9
18
|
import { tablecolumns, tabledata } from "./fixtures/data";
|
|
10
19
|
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
11
|
-
const data = JSON.parse(
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
const data = JSON.parse(
|
|
21
|
+
JSON.stringify([
|
|
22
|
+
...tabledata,
|
|
23
|
+
...tabledata,
|
|
24
|
+
...tabledata,
|
|
25
|
+
...tabledata,
|
|
26
|
+
...tabledata,
|
|
27
|
+
...tabledata,
|
|
28
|
+
...tabledata,
|
|
29
|
+
...tabledata,
|
|
30
|
+
...tabledata,
|
|
31
|
+
...tabledata,
|
|
32
|
+
...tabledata,
|
|
33
|
+
...tabledata,
|
|
34
|
+
...tabledata,
|
|
35
|
+
...tabledata,
|
|
36
|
+
...tabledata,
|
|
37
|
+
...tabledata,
|
|
38
|
+
...tabledata,
|
|
39
|
+
...tabledata,
|
|
40
|
+
...tabledata,
|
|
41
|
+
...tabledata,
|
|
42
|
+
...tabledata,
|
|
43
|
+
...tabledata,
|
|
44
|
+
...tabledata,
|
|
45
|
+
...tabledata,
|
|
46
|
+
])
|
|
47
|
+
);
|
|
48
|
+
const columns = tablecolumns;
|
|
49
|
+
const getData =
|
|
50
|
+
SpectricTableElement.getDefaultDataSorterAndPaginatior<(typeof tabledata)[0]>(
|
|
51
|
+
data
|
|
52
|
+
);
|
|
14
53
|
const meta = {
|
|
15
54
|
title: "UI/Table",
|
|
16
55
|
tags: ["autodocs"],
|
|
@@ -27,23 +66,33 @@ const meta = {
|
|
|
27
66
|
select=${ifDefined(args.select)}
|
|
28
67
|
sort=${ifDefined(args.sort)}
|
|
29
68
|
rowHeight=${ifDefined(args.rowHeight)}
|
|
30
|
-
@selected=${(e) => {
|
|
69
|
+
@selected=${(e) => {}}
|
|
31
70
|
@filter=${(e: CustomEvent<FilterEvent<any>>) => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
71
|
+
alert(
|
|
72
|
+
`filter ${e.detail.include ? "for" : "out"} event value ${
|
|
73
|
+
e.detail.value
|
|
74
|
+
}`
|
|
75
|
+
);
|
|
76
|
+
}}
|
|
77
|
+
@change=${(e: CustomEvent<TableDataOptions<(typeof tabledata)[0]>>) => {
|
|
78
|
+
updateArgs({ ...e.detail });
|
|
79
|
+
if (e.target && e.target instanceof SpectricTableElement) {
|
|
80
|
+
e.target.data = getData({ ...args, ...e.detail });
|
|
81
|
+
}
|
|
82
|
+
}}
|
|
40
83
|
>
|
|
41
84
|
</spectric-table>
|
|
42
85
|
`;
|
|
43
86
|
},
|
|
44
87
|
argTypes: {
|
|
45
|
-
select: {
|
|
46
|
-
|
|
88
|
+
select: {
|
|
89
|
+
control: { type: "select" },
|
|
90
|
+
options: Object.values(TableSelectOptions),
|
|
91
|
+
},
|
|
92
|
+
sort: {
|
|
93
|
+
control: { type: "select" },
|
|
94
|
+
options: Object.values(TableSortOption),
|
|
95
|
+
},
|
|
47
96
|
},
|
|
48
97
|
args: {
|
|
49
98
|
pagination: {
|
|
@@ -53,12 +102,12 @@ const meta = {
|
|
|
53
102
|
totalItems: data.length,
|
|
54
103
|
},
|
|
55
104
|
columns: JSON.parse(JSON.stringify(columns)),
|
|
56
|
-
select: TableSelectOptions.none
|
|
105
|
+
select: TableSelectOptions.none,
|
|
57
106
|
},
|
|
58
|
-
} satisfies Meta<Props<typeof tabledata[0]>>;
|
|
107
|
+
} satisfies Meta<Props<(typeof tabledata)[0]>>;
|
|
59
108
|
|
|
60
109
|
export default meta;
|
|
61
|
-
type Story = StoryObj<Props<typeof tabledata[0]>>;
|
|
110
|
+
type Story = StoryObj<Props<(typeof tabledata)[0]>>;
|
|
62
111
|
|
|
63
112
|
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
64
113
|
export const Basic: Story = {
|
|
@@ -81,7 +130,7 @@ export const NoPagination: Story = {
|
|
|
81
130
|
},
|
|
82
131
|
};
|
|
83
132
|
|
|
84
|
-
export const
|
|
133
|
+
export const MultiSelect: Story = {
|
|
85
134
|
args: {
|
|
86
135
|
select: "multi",
|
|
87
136
|
columns: JSON.parse(JSON.stringify(columns)),
|
|
@@ -95,7 +144,6 @@ export const SingleSelect: Story = {
|
|
|
95
144
|
},
|
|
96
145
|
};
|
|
97
146
|
|
|
98
|
-
|
|
99
147
|
/**
|
|
100
148
|
* The spectric table by default is set to single column sorting, but you can enable multicolumn sorting with the sort="multi" attribute
|
|
101
149
|
*/
|
|
@@ -103,6 +151,6 @@ export const MultiColumnSort: Story = {
|
|
|
103
151
|
args: {
|
|
104
152
|
sort: "multi",
|
|
105
153
|
columns: JSON.parse(JSON.stringify(columns)),
|
|
106
|
-
pagination: { pageSize: 20, page: 1 }
|
|
154
|
+
pagination: { pageSize: 20, page: 1 },
|
|
107
155
|
},
|
|
108
|
-
};
|
|
156
|
+
};
|