@pathscale/ui 2.2.2 → 2.3.0
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/data-grid/DataGrid.css +238 -0
- package/dist/components/data-grid/DataGrid.generated.d.ts +41 -0
- package/dist/components/data-grid/DataGrid.generated.js +408 -0
- package/dist/components/data-grid/DataGrid.interactions.d.ts +11 -0
- package/dist/components/data-grid/DataGrid.interactions.js +25 -0
- package/dist/components/data-grid/DataGrid.recipe.d.ts +52 -0
- package/dist/components/data-grid/DataGrid.recipe.js +96 -0
- package/dist/components/data-grid/createDataGrid.d.ts +121 -0
- package/dist/components/data-grid/createDataGrid.js +252 -0
- package/dist/components/data-grid/index.d.ts +4 -0
- package/dist/components/data-grid/index.js +2 -0
- package/dist/components/table/ExpandToggle.generated.js +2 -2
- package/dist/components/table/InlineConfirm.generated.js +2 -2
- package/dist/components/table/MobileListView.generated.js +2 -2
- package/dist/components/table/SortIcon.generated.js +2 -2
- package/dist/components/table/Table.context.d.ts +23 -0
- package/dist/components/table/Table.context.js +22 -0
- package/dist/components/table/Table.d.ts +18 -0
- package/dist/components/table/Table.js +33 -0
- package/dist/components/table/Table.recipe.d.ts +130 -16
- package/dist/components/table/Table.recipe.js +420 -78
- package/dist/components/table/TableBody.generated.d.ts +6 -0
- package/dist/components/table/TableBody.generated.js +33 -0
- package/dist/components/table/TableCell.generated.d.ts +6 -0
- package/dist/components/table/TableCell.generated.js +33 -0
- package/dist/components/table/TableColumn.generated.d.ts +11 -0
- package/dist/components/table/TableColumn.generated.js +89 -0
- package/dist/components/table/TableColumnResizer.generated.d.ts +6 -0
- package/dist/components/table/TableColumnResizer.generated.js +42 -0
- package/dist/components/table/TableContent.generated.d.ts +10 -0
- package/dist/components/table/TableContent.generated.js +50 -0
- package/dist/components/table/TableExpandedRow.generated.d.ts +11 -0
- package/dist/components/table/TableExpandedRow.generated.js +50 -0
- package/dist/components/table/TableFooter.generated.d.ts +6 -0
- package/dist/components/table/TableFooter.generated.js +33 -0
- package/dist/components/table/TableHeader.generated.d.ts +6 -0
- package/dist/components/table/TableHeader.generated.js +33 -0
- package/dist/components/table/TableLoadMore.generated.d.ts +6 -0
- package/dist/components/table/TableLoadMore.generated.js +33 -0
- package/dist/components/table/TableLoadMoreContent.generated.d.ts +6 -0
- package/dist/components/table/TableLoadMoreContent.generated.js +33 -0
- package/dist/components/table/TablePageSize.generated.d.ts +13 -0
- package/dist/components/table/TablePageSize.generated.js +57 -0
- package/dist/components/table/TableResizableContainer.generated.d.ts +6 -0
- package/dist/components/table/TableResizableContainer.generated.js +33 -0
- package/dist/components/table/TableRoot.generated.d.ts +10 -0
- package/dist/components/table/TableRoot.generated.js +45 -0
- package/dist/components/table/TableRow.generated.d.ts +6 -0
- package/dist/components/table/TableRow.generated.js +33 -0
- package/dist/components/table/TableScrollContainer.generated.d.ts +6 -0
- package/dist/components/table/TableScrollContainer.generated.js +33 -0
- package/dist/components/table/VirtualSpacerRow.generated.js +2 -2
- package/dist/components/table/index.d.ts +43 -13
- package/dist/components/table/index.js +21 -5
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -0
- package/dist/layouts.manifest.json +4 -1
- package/dist/purge-manifest.json +482 -14
- package/dist/styles/themes/dark.css +3 -0
- package/dist/styles/themes/light.css +3 -0
- package/package.json +2 -2
- package/dist/components/table/Table.generated.d.ts +0 -94
- package/dist/components/table/Table.generated.js +0 -551
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import { createComponent, insert, memo, mergeProps, spread, template } from "solid-js/web";
|
|
2
|
+
import { defineComponent } from "solid-layouts/application-boundary";
|
|
3
|
+
import "./DataGrid.css";
|
|
4
|
+
import { For, Show, splitProps } from "solid-js";
|
|
5
|
+
import { twMerge } from "tailwind-merge";
|
|
6
|
+
import button_0 from "../button/index.js";
|
|
7
|
+
import checkbox_0 from "../checkbox/index.js";
|
|
8
|
+
import { SortIcon, TableBody, TableCell, TableColumn, TableContent, TableFooter, TableHeader, TableRoot, TableRow, TableScrollContainer } from "../table/index.js";
|
|
9
|
+
import { cellContent, columnSpan, formatCell, rangeLabel, readInputValue, searchPlaceholder } from "./DataGrid.interactions.js";
|
|
10
|
+
import { CLASSES, componentRecipe } from "./DataGrid.recipe.js";
|
|
11
|
+
var _tmpl$ = /*#__PURE__*/ template("<div>"), _tmpl$2 = /*#__PURE__*/ template("<caption>"), _tmpl$3 = /*#__PURE__*/ template("<span>"), _tmpl$4 = /*#__PURE__*/ template("<label><span></span><input>");
|
|
12
|
+
const __solidLayoutDataGrid = (_stable, p)=>{
|
|
13
|
+
const [local, rest] = splitProps(p, [
|
|
14
|
+
"model",
|
|
15
|
+
"borders",
|
|
16
|
+
"striping",
|
|
17
|
+
"sticky",
|
|
18
|
+
"interactive",
|
|
19
|
+
"size",
|
|
20
|
+
"width",
|
|
21
|
+
"flavor",
|
|
22
|
+
"caption",
|
|
23
|
+
"empty",
|
|
24
|
+
"renderExpanded",
|
|
25
|
+
"onSortChange",
|
|
26
|
+
"onPageChange",
|
|
27
|
+
"onSelectionChange",
|
|
28
|
+
"class",
|
|
29
|
+
"dataTheme"
|
|
30
|
+
]);
|
|
31
|
+
const borders = ()=>local.borders ?? "rows";
|
|
32
|
+
const striping = ()=>local.striping ?? "none";
|
|
33
|
+
const sticky = ()=>local.sticky ?? "none";
|
|
34
|
+
const size = ()=>local.size ?? "md";
|
|
35
|
+
const searchable = ()=>local.model.visibleColumns().filter((column)=>column.searchable);
|
|
36
|
+
const selects = ()=>"none" !== local.model.selectionMode();
|
|
37
|
+
const paginates = ()=>local.model.pageSize() > 0;
|
|
38
|
+
const span = ()=>columnSpan(local.model.visibleColumns().length, selects());
|
|
39
|
+
const allOnPageSelected = ()=>{
|
|
40
|
+
const rows = local.model.pageRows();
|
|
41
|
+
if (0 === rows.length) return false;
|
|
42
|
+
return rows.every((row, index)=>local.model.isSelected(row, index));
|
|
43
|
+
};
|
|
44
|
+
const changeSort = (descriptor)=>{
|
|
45
|
+
local.model.sortByColumn(descriptor.column);
|
|
46
|
+
local.onSortChange?.(local.model.sort());
|
|
47
|
+
};
|
|
48
|
+
const changePage = (page)=>{
|
|
49
|
+
local.model.switchPage(page);
|
|
50
|
+
local.onPageChange?.(local.model.page());
|
|
51
|
+
};
|
|
52
|
+
const changeSelection = (row, index)=>{
|
|
53
|
+
local.model.toggleCheck(row, index);
|
|
54
|
+
local.onSelectionChange?.(local.model.selectedIds());
|
|
55
|
+
};
|
|
56
|
+
const changeSelectAll = (selected)=>{
|
|
57
|
+
local.model.toggleCheckAll(selected);
|
|
58
|
+
local.onSelectionChange?.(local.model.selectedIds());
|
|
59
|
+
};
|
|
60
|
+
return createComponent(TableRoot, mergeProps(()=>({
|
|
61
|
+
class: twMerge(CLASSES.root, CLASSES.borders[borders()], CLASSES.striping[striping()], CLASSES.sticky[sticky()], CLASSES.size[size()], local.interactive ? CLASSES.interactive : void 0, local.class)
|
|
62
|
+
}), {
|
|
63
|
+
get ["data-theme"] () {
|
|
64
|
+
return local.dataTheme;
|
|
65
|
+
},
|
|
66
|
+
"data-slot": "data-grid",
|
|
67
|
+
get ["data-flavor"] () {
|
|
68
|
+
return local.flavor;
|
|
69
|
+
},
|
|
70
|
+
get ["data-width"] () {
|
|
71
|
+
return local.width;
|
|
72
|
+
},
|
|
73
|
+
get ["data-selection"] () {
|
|
74
|
+
return local.model.selectionMode();
|
|
75
|
+
}
|
|
76
|
+
}, rest, {
|
|
77
|
+
get children () {
|
|
78
|
+
return [
|
|
79
|
+
createComponent(Show, {
|
|
80
|
+
get when () {
|
|
81
|
+
return searchable().length > 0;
|
|
82
|
+
},
|
|
83
|
+
get children () {
|
|
84
|
+
var _el$ = _tmpl$();
|
|
85
|
+
spread(_el$, mergeProps(()=>({
|
|
86
|
+
class: CLASSES.toolbar
|
|
87
|
+
}), {
|
|
88
|
+
"data-slot": "data-grid-toolbar"
|
|
89
|
+
}), false, true);
|
|
90
|
+
insert(_el$, createComponent(For, {
|
|
91
|
+
get each () {
|
|
92
|
+
return searchable();
|
|
93
|
+
},
|
|
94
|
+
children: (column)=>(()=>{
|
|
95
|
+
var _el$4 = _tmpl$4(), _el$5 = _el$4.firstChild, _el$6 = _el$5.nextSibling;
|
|
96
|
+
spread(_el$4, mergeProps(()=>({
|
|
97
|
+
class: CLASSES.search
|
|
98
|
+
}), {
|
|
99
|
+
"data-slot": "data-grid-search"
|
|
100
|
+
}), false, true);
|
|
101
|
+
spread(_el$5, mergeProps(()=>({
|
|
102
|
+
class: CLASSES.searchLabel
|
|
103
|
+
})), false, true);
|
|
104
|
+
insert(_el$5, ()=>searchPlaceholder(column.label));
|
|
105
|
+
spread(_el$6, mergeProps(()=>({
|
|
106
|
+
class: CLASSES.searchInput
|
|
107
|
+
}), {
|
|
108
|
+
type: "search",
|
|
109
|
+
get value () {
|
|
110
|
+
return local.model.queries()[column.name] ?? "";
|
|
111
|
+
},
|
|
112
|
+
get placeholder () {
|
|
113
|
+
return searchPlaceholder(column.label);
|
|
114
|
+
},
|
|
115
|
+
onInput: (event)=>local.model.searchColumn(column.name, readInputValue(event))
|
|
116
|
+
}), false, false);
|
|
117
|
+
return _el$4;
|
|
118
|
+
})()
|
|
119
|
+
}));
|
|
120
|
+
return _el$;
|
|
121
|
+
}
|
|
122
|
+
}),
|
|
123
|
+
createComponent(TableScrollContainer, {
|
|
124
|
+
get children () {
|
|
125
|
+
return createComponent(TableContent, {
|
|
126
|
+
get sortDescriptor () {
|
|
127
|
+
return local.model.sort() ?? void 0;
|
|
128
|
+
},
|
|
129
|
+
onSortChange: changeSort,
|
|
130
|
+
get children () {
|
|
131
|
+
return [
|
|
132
|
+
createComponent(Show, {
|
|
133
|
+
get when () {
|
|
134
|
+
return local.caption;
|
|
135
|
+
},
|
|
136
|
+
get children () {
|
|
137
|
+
var _el$2 = _tmpl$2();
|
|
138
|
+
insert(_el$2, ()=>local.caption);
|
|
139
|
+
return _el$2;
|
|
140
|
+
}
|
|
141
|
+
}),
|
|
142
|
+
createComponent(TableHeader, {
|
|
143
|
+
get children () {
|
|
144
|
+
return createComponent(TableRow, {
|
|
145
|
+
get children () {
|
|
146
|
+
return [
|
|
147
|
+
createComponent(Show, {
|
|
148
|
+
get when () {
|
|
149
|
+
return selects();
|
|
150
|
+
},
|
|
151
|
+
get children () {
|
|
152
|
+
return createComponent(TableColumn, mergeProps({
|
|
153
|
+
id: "__select"
|
|
154
|
+
}, ()=>({
|
|
155
|
+
class: CLASSES.selectCell
|
|
156
|
+
}), {
|
|
157
|
+
get children () {
|
|
158
|
+
return createComponent(checkbox_0, {
|
|
159
|
+
"aria-label": "Select all rows",
|
|
160
|
+
get checked () {
|
|
161
|
+
return allOnPageSelected();
|
|
162
|
+
},
|
|
163
|
+
onChange: ()=>changeSelectAll(!allOnPageSelected())
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}));
|
|
167
|
+
}
|
|
168
|
+
}),
|
|
169
|
+
createComponent(For, {
|
|
170
|
+
get each () {
|
|
171
|
+
return local.model.visibleColumns();
|
|
172
|
+
},
|
|
173
|
+
children: (column)=>createComponent(TableColumn, mergeProps({
|
|
174
|
+
get id () {
|
|
175
|
+
return column.name;
|
|
176
|
+
},
|
|
177
|
+
get allowsSorting () {
|
|
178
|
+
return column.sortable;
|
|
179
|
+
}
|
|
180
|
+
}, ()=>({
|
|
181
|
+
class: CLASSES.headerCell
|
|
182
|
+
}), {
|
|
183
|
+
get ["data-sticky"] () {
|
|
184
|
+
return column.sticky ? "true" : void 0;
|
|
185
|
+
},
|
|
186
|
+
get style () {
|
|
187
|
+
return memo(()=>!!column.width)() ? {
|
|
188
|
+
width: column.width
|
|
189
|
+
} : void 0;
|
|
190
|
+
},
|
|
191
|
+
children: (state)=>(()=>{
|
|
192
|
+
var _el$7 = _tmpl$3();
|
|
193
|
+
spread(_el$7, mergeProps(()=>({
|
|
194
|
+
class: CLASSES.headerButton
|
|
195
|
+
})), false, true);
|
|
196
|
+
insert(_el$7, ()=>column.label, null);
|
|
197
|
+
insert(_el$7, createComponent(Show, {
|
|
198
|
+
get when () {
|
|
199
|
+
return column.sortable;
|
|
200
|
+
},
|
|
201
|
+
get children () {
|
|
202
|
+
return createComponent(SortIcon, {
|
|
203
|
+
get state () {
|
|
204
|
+
return memo(()=>"ascending" === state.sortDirection)() ? "asc" : "descending" === state.sortDirection ? "desc" : "none";
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
}), null);
|
|
209
|
+
return _el$7;
|
|
210
|
+
})()
|
|
211
|
+
}))
|
|
212
|
+
})
|
|
213
|
+
];
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
}),
|
|
218
|
+
createComponent(TableBody, {
|
|
219
|
+
get children () {
|
|
220
|
+
return [
|
|
221
|
+
createComponent(For, {
|
|
222
|
+
get each () {
|
|
223
|
+
return local.model.groupedRows();
|
|
224
|
+
},
|
|
225
|
+
children: (group)=>[
|
|
226
|
+
createComponent(Show, {
|
|
227
|
+
get when () {
|
|
228
|
+
return local.model.groupBy();
|
|
229
|
+
},
|
|
230
|
+
get children () {
|
|
231
|
+
return createComponent(TableRow, mergeProps(()=>({
|
|
232
|
+
class: CLASSES.groupRow
|
|
233
|
+
}), {
|
|
234
|
+
"data-slot": "data-grid-group-row",
|
|
235
|
+
get children () {
|
|
236
|
+
return createComponent(TableCell, {
|
|
237
|
+
get colSpan () {
|
|
238
|
+
return span();
|
|
239
|
+
},
|
|
240
|
+
get children () {
|
|
241
|
+
return formatCell(group.value);
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
}));
|
|
246
|
+
}
|
|
247
|
+
}),
|
|
248
|
+
createComponent(For, {
|
|
249
|
+
get each () {
|
|
250
|
+
return group.rows;
|
|
251
|
+
},
|
|
252
|
+
children: (row, index)=>[
|
|
253
|
+
createComponent(TableRow, {
|
|
254
|
+
get ["data-selected"] () {
|
|
255
|
+
return local.model.isSelected(row, index()) ? "true" : void 0;
|
|
256
|
+
},
|
|
257
|
+
get children () {
|
|
258
|
+
return [
|
|
259
|
+
createComponent(Show, {
|
|
260
|
+
get when () {
|
|
261
|
+
return selects();
|
|
262
|
+
},
|
|
263
|
+
get children () {
|
|
264
|
+
return createComponent(TableCell, mergeProps(()=>({
|
|
265
|
+
class: CLASSES.selectCell
|
|
266
|
+
}), {
|
|
267
|
+
get children () {
|
|
268
|
+
return createComponent(checkbox_0, {
|
|
269
|
+
"aria-label": "Select row",
|
|
270
|
+
get checked () {
|
|
271
|
+
return local.model.isSelected(row, index());
|
|
272
|
+
},
|
|
273
|
+
onChange: ()=>changeSelection(row, index())
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
}));
|
|
277
|
+
}
|
|
278
|
+
}),
|
|
279
|
+
createComponent(For, {
|
|
280
|
+
get each () {
|
|
281
|
+
return local.model.visibleColumns();
|
|
282
|
+
},
|
|
283
|
+
children: (column)=>createComponent(TableCell, mergeProps(()=>({
|
|
284
|
+
class: CLASSES.cell
|
|
285
|
+
}), {
|
|
286
|
+
get ["data-sticky"] () {
|
|
287
|
+
return column.sticky ? "true" : void 0;
|
|
288
|
+
},
|
|
289
|
+
get ["data-align"] () {
|
|
290
|
+
return column.align;
|
|
291
|
+
},
|
|
292
|
+
get children () {
|
|
293
|
+
return cellContent(column, row, index());
|
|
294
|
+
}
|
|
295
|
+
}))
|
|
296
|
+
})
|
|
297
|
+
];
|
|
298
|
+
}
|
|
299
|
+
}),
|
|
300
|
+
createComponent(Show, {
|
|
301
|
+
get when () {
|
|
302
|
+
return local.renderExpanded;
|
|
303
|
+
},
|
|
304
|
+
get children () {
|
|
305
|
+
return createComponent(TableRow, {
|
|
306
|
+
get children () {
|
|
307
|
+
return createComponent(TableCell, {
|
|
308
|
+
get colSpan () {
|
|
309
|
+
return span();
|
|
310
|
+
},
|
|
311
|
+
get children () {
|
|
312
|
+
return local.renderExpanded?.(row);
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
})
|
|
319
|
+
]
|
|
320
|
+
})
|
|
321
|
+
]
|
|
322
|
+
}),
|
|
323
|
+
createComponent(Show, {
|
|
324
|
+
get when () {
|
|
325
|
+
return 0 === local.model.pageRows().length;
|
|
326
|
+
},
|
|
327
|
+
get children () {
|
|
328
|
+
return createComponent(TableRow, {
|
|
329
|
+
get children () {
|
|
330
|
+
return createComponent(TableCell, mergeProps({
|
|
331
|
+
get colSpan () {
|
|
332
|
+
return span();
|
|
333
|
+
}
|
|
334
|
+
}, ()=>({
|
|
335
|
+
class: CLASSES.empty
|
|
336
|
+
}), {
|
|
337
|
+
"data-slot": "data-grid-empty",
|
|
338
|
+
get children () {
|
|
339
|
+
return local.empty ?? "No rows";
|
|
340
|
+
}
|
|
341
|
+
}));
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
})
|
|
346
|
+
];
|
|
347
|
+
}
|
|
348
|
+
})
|
|
349
|
+
];
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
}),
|
|
354
|
+
createComponent(Show, {
|
|
355
|
+
get when () {
|
|
356
|
+
return paginates();
|
|
357
|
+
},
|
|
358
|
+
get children () {
|
|
359
|
+
return createComponent(TableFooter, mergeProps(()=>({
|
|
360
|
+
class: CLASSES.pagination
|
|
361
|
+
}), {
|
|
362
|
+
"data-slot": "data-grid-pagination",
|
|
363
|
+
get children () {
|
|
364
|
+
return [
|
|
365
|
+
(()=>{
|
|
366
|
+
var _el$3 = _tmpl$3();
|
|
367
|
+
spread(_el$3, mergeProps(()=>({
|
|
368
|
+
class: CLASSES.pageStatus
|
|
369
|
+
})), false, true);
|
|
370
|
+
insert(_el$3, ()=>rangeLabel(local.model.page(), local.model.pageSize(), local.model.total()));
|
|
371
|
+
return _el$3;
|
|
372
|
+
})(),
|
|
373
|
+
createComponent(button_0, {
|
|
374
|
+
variant: "ghost",
|
|
375
|
+
size: "sm",
|
|
376
|
+
"aria-label": "Previous page",
|
|
377
|
+
get state () {
|
|
378
|
+
return 0 === local.model.page() ? "disabled" : "default";
|
|
379
|
+
},
|
|
380
|
+
onClick: ()=>changePage(local.model.page() - 1),
|
|
381
|
+
children: "Previous"
|
|
382
|
+
}),
|
|
383
|
+
createComponent(button_0, {
|
|
384
|
+
variant: "ghost",
|
|
385
|
+
size: "sm",
|
|
386
|
+
"aria-label": "Next page",
|
|
387
|
+
get state () {
|
|
388
|
+
return local.model.page() >= local.model.pageCount() - 1 ? "disabled" : "default";
|
|
389
|
+
},
|
|
390
|
+
onClick: ()=>changePage(local.model.page() + 1),
|
|
391
|
+
children: "Next"
|
|
392
|
+
})
|
|
393
|
+
];
|
|
394
|
+
}
|
|
395
|
+
}));
|
|
396
|
+
}
|
|
397
|
+
})
|
|
398
|
+
];
|
|
399
|
+
}
|
|
400
|
+
}));
|
|
401
|
+
};
|
|
402
|
+
const DataGrid = defineComponent({
|
|
403
|
+
recipe: componentRecipe,
|
|
404
|
+
layout: __solidLayoutDataGrid,
|
|
405
|
+
embedded: true
|
|
406
|
+
});
|
|
407
|
+
const DataGrid_generated = DataGrid;
|
|
408
|
+
export default DataGrid_generated;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DataGridColumn, DataGridRow } from "./createDataGrid";
|
|
2
|
+
export declare const formatCell: (value: unknown) => string;
|
|
3
|
+
export declare const columnSpan: (visible: number, hasSelection: boolean) => number;
|
|
4
|
+
/** 1-based, for display. The model counts pages from zero. */
|
|
5
|
+
export declare const pageLabel: (page: number, pageCount: number) => string;
|
|
6
|
+
export declare const rangeLabel: (page: number, pageSize: number, total: number) => string;
|
|
7
|
+
export declare const searchPlaceholder: (label: string) => string;
|
|
8
|
+
export declare const cellContent: <Row extends DataGridRow>(column: DataGridColumn<Row>, row: Row, index: number) => string | number | boolean | Node | import("solid-js").JSX.ArrayElement | null | undefined;
|
|
9
|
+
export declare const readInputValue: (event: {
|
|
10
|
+
currentTarget: HTMLInputElement;
|
|
11
|
+
}) => string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const formatCell = (value)=>{
|
|
2
|
+
if (null == value) return "";
|
|
3
|
+
if (value instanceof Date) return value.toISOString().slice(0, 10);
|
|
4
|
+
return String(value);
|
|
5
|
+
};
|
|
6
|
+
const columnSpan = (visible, hasSelection)=>visible + (hasSelection ? 1 : 0);
|
|
7
|
+
const pageLabel = (page, pageCount)=>`${page + 1} / ${pageCount}`;
|
|
8
|
+
const rangeLabel = (page, pageSize, total)=>{
|
|
9
|
+
if (0 === total) return "0";
|
|
10
|
+
const first = page * pageSize + 1;
|
|
11
|
+
const last = Math.min(total, (page + 1) * pageSize);
|
|
12
|
+
return `${first}–${last} of ${total}`;
|
|
13
|
+
};
|
|
14
|
+
const searchPlaceholder = (label)=>`Search ${label}`;
|
|
15
|
+
const cellContent = (column, row, index)=>{
|
|
16
|
+
if (column.render) return column.render({
|
|
17
|
+
value: row[column.name],
|
|
18
|
+
row,
|
|
19
|
+
column,
|
|
20
|
+
index
|
|
21
|
+
});
|
|
22
|
+
return formatCell(row[column.name]);
|
|
23
|
+
};
|
|
24
|
+
const readInputValue = (event)=>event.currentTarget.value;
|
|
25
|
+
export { cellContent, columnSpan, formatCell, pageLabel, rangeLabel, readInputValue, searchPlaceholder };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export declare const CLASSES: {
|
|
2
|
+
readonly root: "data-grid";
|
|
3
|
+
readonly toolbar: "data-grid__toolbar";
|
|
4
|
+
readonly search: "data-grid__search";
|
|
5
|
+
readonly searchLabel: "data-grid__search-label";
|
|
6
|
+
readonly searchInput: "data-grid__search-input";
|
|
7
|
+
readonly headerCell: "data-grid__header-cell";
|
|
8
|
+
readonly headerButton: "data-grid__header-button";
|
|
9
|
+
readonly cell: "data-grid__cell";
|
|
10
|
+
readonly selectCell: "data-grid__select-cell";
|
|
11
|
+
readonly groupRow: "data-grid__group-row";
|
|
12
|
+
readonly empty: "data-grid__empty";
|
|
13
|
+
readonly pagination: "data-grid__pagination";
|
|
14
|
+
readonly pageStatus: "data-grid__page-status";
|
|
15
|
+
readonly borders: {
|
|
16
|
+
readonly none: "data-grid--borders-none";
|
|
17
|
+
readonly rows: "data-grid--borders-rows";
|
|
18
|
+
readonly cols: "data-grid--borders-cols";
|
|
19
|
+
readonly both: "data-grid--borders-both";
|
|
20
|
+
};
|
|
21
|
+
readonly striping: {
|
|
22
|
+
readonly none: "data-grid--striping-none";
|
|
23
|
+
readonly rows: "data-grid--striping-rows";
|
|
24
|
+
readonly cols: "data-grid--striping-cols";
|
|
25
|
+
};
|
|
26
|
+
readonly sticky: {
|
|
27
|
+
readonly none: "data-grid--sticky-none";
|
|
28
|
+
readonly header: "data-grid--sticky-header";
|
|
29
|
+
readonly columns: "data-grid--sticky-columns";
|
|
30
|
+
readonly both: "data-grid--sticky-both";
|
|
31
|
+
};
|
|
32
|
+
readonly size: {
|
|
33
|
+
readonly xs: "data-grid--size-xs";
|
|
34
|
+
readonly sm: "data-grid--size-sm";
|
|
35
|
+
readonly md: "data-grid--size-md";
|
|
36
|
+
readonly lg: "data-grid--size-lg";
|
|
37
|
+
readonly xl: "data-grid--size-xl";
|
|
38
|
+
};
|
|
39
|
+
readonly interactive: "data-grid--interactive";
|
|
40
|
+
};
|
|
41
|
+
export declare const componentRecipe: import("solid-layouts").Recipe<{
|
|
42
|
+
readonly component: "data-grid";
|
|
43
|
+
readonly slots: {
|
|
44
|
+
readonly root: {};
|
|
45
|
+
readonly "data-grid": {};
|
|
46
|
+
readonly "data-grid-toolbar": {};
|
|
47
|
+
readonly "data-grid-search": {};
|
|
48
|
+
readonly "data-grid-group-row": {};
|
|
49
|
+
readonly "data-grid-empty": {};
|
|
50
|
+
readonly "data-grid-pagination": {};
|
|
51
|
+
};
|
|
52
|
+
}>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { recipe } from "../../lib/layouts/index.js";
|
|
2
|
+
const CLASSES = {
|
|
3
|
+
root: "data-grid",
|
|
4
|
+
toolbar: "data-grid__toolbar",
|
|
5
|
+
search: "data-grid__search",
|
|
6
|
+
searchLabel: "data-grid__search-label",
|
|
7
|
+
searchInput: "data-grid__search-input",
|
|
8
|
+
headerCell: "data-grid__header-cell",
|
|
9
|
+
headerButton: "data-grid__header-button",
|
|
10
|
+
cell: "data-grid__cell",
|
|
11
|
+
selectCell: "data-grid__select-cell",
|
|
12
|
+
groupRow: "data-grid__group-row",
|
|
13
|
+
empty: "data-grid__empty",
|
|
14
|
+
pagination: "data-grid__pagination",
|
|
15
|
+
pageStatus: "data-grid__page-status",
|
|
16
|
+
borders: {
|
|
17
|
+
none: "data-grid--borders-none",
|
|
18
|
+
rows: "data-grid--borders-rows",
|
|
19
|
+
cols: "data-grid--borders-cols",
|
|
20
|
+
both: "data-grid--borders-both"
|
|
21
|
+
},
|
|
22
|
+
striping: {
|
|
23
|
+
none: "data-grid--striping-none",
|
|
24
|
+
rows: "data-grid--striping-rows",
|
|
25
|
+
cols: "data-grid--striping-cols"
|
|
26
|
+
},
|
|
27
|
+
sticky: {
|
|
28
|
+
none: "data-grid--sticky-none",
|
|
29
|
+
header: "data-grid--sticky-header",
|
|
30
|
+
columns: "data-grid--sticky-columns",
|
|
31
|
+
both: "data-grid--sticky-both"
|
|
32
|
+
},
|
|
33
|
+
size: {
|
|
34
|
+
xs: "data-grid--size-xs",
|
|
35
|
+
sm: "data-grid--size-sm",
|
|
36
|
+
md: "data-grid--size-md",
|
|
37
|
+
lg: "data-grid--size-lg",
|
|
38
|
+
xl: "data-grid--size-xl"
|
|
39
|
+
},
|
|
40
|
+
interactive: "data-grid--interactive"
|
|
41
|
+
};
|
|
42
|
+
const componentRecipe = recipe({
|
|
43
|
+
component: "data-grid",
|
|
44
|
+
slots: {
|
|
45
|
+
root: {},
|
|
46
|
+
"data-grid": {},
|
|
47
|
+
"data-grid-toolbar": {},
|
|
48
|
+
"data-grid-search": {},
|
|
49
|
+
"data-grid-group-row": {},
|
|
50
|
+
"data-grid-empty": {},
|
|
51
|
+
"data-grid-pagination": {}
|
|
52
|
+
},
|
|
53
|
+
_layouts: {
|
|
54
|
+
slots: {
|
|
55
|
+
root: {
|
|
56
|
+
base: "",
|
|
57
|
+
axes: {}
|
|
58
|
+
},
|
|
59
|
+
"data-grid": {
|
|
60
|
+
base: "",
|
|
61
|
+
axes: {}
|
|
62
|
+
},
|
|
63
|
+
"data-grid-toolbar": {
|
|
64
|
+
base: "",
|
|
65
|
+
axes: {}
|
|
66
|
+
},
|
|
67
|
+
"data-grid-search": {
|
|
68
|
+
base: "",
|
|
69
|
+
axes: {}
|
|
70
|
+
},
|
|
71
|
+
"data-grid-group-row": {
|
|
72
|
+
base: "",
|
|
73
|
+
axes: {}
|
|
74
|
+
},
|
|
75
|
+
"data-grid-empty": {
|
|
76
|
+
base: "",
|
|
77
|
+
axes: {}
|
|
78
|
+
},
|
|
79
|
+
"data-grid-pagination": {
|
|
80
|
+
base: "",
|
|
81
|
+
axes: {}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
stateKeys: [],
|
|
85
|
+
slotIds: {
|
|
86
|
+
root: 6,
|
|
87
|
+
"data-grid": 0,
|
|
88
|
+
"data-grid-toolbar": 5,
|
|
89
|
+
"data-grid-search": 4,
|
|
90
|
+
"data-grid-group-row": 2,
|
|
91
|
+
"data-grid-empty": 1,
|
|
92
|
+
"data-grid-pagination": 3
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
export { CLASSES, componentRecipe };
|