@dbcdk/react-components 0.0.20 → 0.0.21
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/button/Button.module.css +13 -6
- package/dist/components/chip/Chip.d.ts +3 -2
- package/dist/components/chip/Chip.js +2 -1
- package/dist/components/chip/Chip.module.css +107 -67
- package/dist/components/filter-field/FilterField.d.ts +2 -1
- package/dist/components/filter-field/FilterField.js +4 -9
- package/dist/components/filter-field/FilterField.module.css +203 -152
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.d.ts +2 -3
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.js +3 -5
- package/dist/components/filtering/chip-multi-toggle/ChipMultiToggle.module.css +13 -13
- package/dist/components/forms/input/Input.d.ts +1 -1
- package/dist/components/forms/input/Input.js +3 -9
- package/dist/components/forms/input/Input.module.css +106 -17
- package/dist/components/hyperlink/Hyperlink.module.css +14 -3
- package/dist/components/interval-select/IntervalSelect.js +2 -2
- package/dist/components/popover/Popover.module.css +4 -1
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.d.ts +4 -2
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.js +17 -19
- package/dist/components/segmented-progress-bar/SegmentedProgressBar.module.css +128 -20
- package/dist/components/sidebar/Sidebar.d.ts +2 -1
- package/dist/components/sidebar/Sidebar.js +2 -2
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.d.ts +2 -3
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.js +2 -4
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.module.css +2 -1
- package/dist/components/table/Table.d.ts +2 -7
- package/dist/components/table/Table.js +90 -47
- package/dist/components/table/Table.module.css +301 -72
- package/dist/components/table/TanstackTable.js +3 -27
- package/dist/components/table/table.utils.d.ts +1 -1
- package/dist/components/table/table.utils.js +2 -1
- package/dist/components/table/tanstackTable.utils.d.ts +9 -10
- package/dist/components/table/tanstackTable.utils.js +50 -30
- package/dist/hooks/useViewportFill.d.ts +6 -5
- package/dist/hooks/useViewportFill.js +43 -41
- package/dist/src/styles/styles.css +5 -2
- package/dist/styles/styles.css +5 -2
- package/dist/styles/themes/dbc/base.css +0 -3
- package/dist/styles/themes/dbc/dark.css +44 -12
- package/dist/styles/themes/dbc/light.css +33 -7
- package/package.json +1 -1
|
@@ -1,32 +1,90 @@
|
|
|
1
|
-
.
|
|
1
|
+
.fillViewportRoot {
|
|
2
|
+
display: flex;
|
|
3
|
+
position: relative;
|
|
4
|
+
block-size: 100%;
|
|
5
|
+
min-block-size: 0;
|
|
6
|
+
min-inline-size: 0;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.inlineRoot {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
min-block-size: 0;
|
|
14
|
+
min-inline-size: 0;
|
|
2
15
|
inline-size: 100%;
|
|
3
16
|
max-inline-size: 100%;
|
|
4
|
-
|
|
5
|
-
font-size: var(--font-size-sm);
|
|
6
|
-
color: var(--color-fg-default);
|
|
7
|
-
background: var(--color-bg-surface);
|
|
17
|
+
position: relative;
|
|
8
18
|
}
|
|
9
19
|
|
|
10
|
-
.
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
.toolbarSlot {
|
|
21
|
+
margin-bottom: 12px;
|
|
22
|
+
flex: 0 0 auto;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.tableViewport {
|
|
26
|
+
flex: 1 1 auto;
|
|
27
|
+
min-block-size: 0;
|
|
28
|
+
min-inline-size: 0;
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.paginationSlot {
|
|
35
|
+
flex: 0 0 auto;
|
|
36
|
+
overflow: visible;
|
|
37
|
+
margin-top: auto;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.paginationSlot:not(.paginationSlotTop) {
|
|
41
|
+
padding-top: var(--spacing-sm);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.paginationSlot.paginationSlotTop {
|
|
45
|
+
padding-bottom: var(--spacing-sm);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.tableRoot {
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
flex: 1 1 auto;
|
|
52
|
+
min-block-size: 0;
|
|
53
|
+
min-inline-size: 0;
|
|
54
|
+
inline-size: 100%;
|
|
13
55
|
max-inline-size: 100%;
|
|
14
|
-
-
|
|
56
|
+
font-family: var(--font-family);
|
|
57
|
+
font-size: var(--font-size-sm);
|
|
58
|
+
color: var(--table-cell-fg);
|
|
59
|
+
background: var(--table-row-bg);
|
|
60
|
+
overflow: auto;
|
|
15
61
|
}
|
|
16
62
|
|
|
17
|
-
/* Header wrapper sticky */
|
|
18
63
|
.header {
|
|
19
64
|
position: sticky;
|
|
20
65
|
top: 0;
|
|
21
66
|
z-index: 10;
|
|
22
|
-
background-color: var(--
|
|
67
|
+
background-color: var(--table-header-bg);
|
|
68
|
+
border-block-end: 1px solid var(--table-border-header);
|
|
69
|
+
margin-bottom: 0;
|
|
70
|
+
flex: 0 0 auto;
|
|
23
71
|
}
|
|
24
72
|
|
|
25
|
-
.
|
|
26
|
-
|
|
73
|
+
.bodyScroll {
|
|
74
|
+
flex: 1 1 auto;
|
|
75
|
+
min-block-size: 0;
|
|
76
|
+
min-inline-size: 0;
|
|
77
|
+
max-inline-size: 100%;
|
|
78
|
+
-webkit-overflow-scrolling: touch;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.emptyStateSlot {
|
|
82
|
+
display: grid;
|
|
83
|
+
place-items: center;
|
|
84
|
+
min-block-size: 100%;
|
|
85
|
+
padding: var(--spacing-lg);
|
|
27
86
|
}
|
|
28
87
|
|
|
29
|
-
/* Shared row grid template */
|
|
30
88
|
.headerRow,
|
|
31
89
|
.row {
|
|
32
90
|
position: relative;
|
|
@@ -34,46 +92,73 @@
|
|
|
34
92
|
grid-template-columns: var(--grid-template);
|
|
35
93
|
align-items: stretch;
|
|
36
94
|
inline-size: 100%;
|
|
95
|
+
min-inline-size: 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.body {
|
|
99
|
+
min-block-size: 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.body::before {
|
|
103
|
+
display: none;
|
|
37
104
|
}
|
|
38
105
|
|
|
39
|
-
/* Header cells */
|
|
40
106
|
.headerCell {
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
41
109
|
position: relative;
|
|
42
|
-
|
|
110
|
+
min-block-size: 44px;
|
|
111
|
+
padding-block: var(--spacing-xxs);
|
|
43
112
|
padding-inline: var(--spacing-sm);
|
|
44
|
-
|
|
45
|
-
/* Typography */
|
|
46
113
|
font-size: var(--font-size-xs);
|
|
47
|
-
font-weight: var(--font-weight-
|
|
114
|
+
font-weight: var(--font-weight-medium);
|
|
48
115
|
letter-spacing: var(--letter-spacing-wide);
|
|
49
116
|
text-transform: uppercase;
|
|
50
|
-
color: var(--
|
|
51
|
-
|
|
52
|
-
/* Truncation */
|
|
117
|
+
color: var(--table-header-fg);
|
|
53
118
|
white-space: nowrap;
|
|
54
119
|
overflow: hidden;
|
|
55
120
|
text-overflow: ellipsis;
|
|
56
|
-
|
|
57
121
|
min-width: 0;
|
|
58
122
|
}
|
|
59
123
|
|
|
60
124
|
.sm .headerCell {
|
|
61
|
-
|
|
125
|
+
min-block-size: 40px;
|
|
126
|
+
padding-block: var(--spacing-xxs);
|
|
127
|
+
padding-inline: var(--spacing-sm);
|
|
62
128
|
}
|
|
63
129
|
|
|
64
|
-
|
|
65
|
-
|
|
130
|
+
.row {
|
|
131
|
+
background: var(--table-row-bg);
|
|
132
|
+
transition:
|
|
133
|
+
background-color 140ms ease,
|
|
134
|
+
box-shadow 140ms ease;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.row::after {
|
|
66
138
|
content: '';
|
|
67
|
-
|
|
68
|
-
|
|
139
|
+
position: absolute;
|
|
140
|
+
inset: 0;
|
|
141
|
+
pointer-events: none;
|
|
142
|
+
z-index: 4;
|
|
143
|
+
opacity: 0;
|
|
144
|
+
box-shadow: inset 0 0 0 2px var(--color-brand);
|
|
145
|
+
transition: opacity 140ms ease;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.row:focus-within {
|
|
149
|
+
outline: none;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.row:focus-within::after {
|
|
153
|
+
opacity: 1;
|
|
69
154
|
}
|
|
70
155
|
|
|
71
|
-
/* Data cells */
|
|
72
156
|
.cell {
|
|
73
157
|
position: relative;
|
|
74
|
-
|
|
158
|
+
min-block-size: var(--component-size-md);
|
|
159
|
+
padding-block: 6px;
|
|
75
160
|
padding-inline: var(--spacing-sm);
|
|
76
|
-
border-block-end:
|
|
161
|
+
border-block-end: 1px solid var(--table-border-subtle);
|
|
77
162
|
text-align: start;
|
|
78
163
|
vertical-align: top;
|
|
79
164
|
min-width: 0;
|
|
@@ -82,8 +167,9 @@
|
|
|
82
167
|
}
|
|
83
168
|
|
|
84
169
|
.sm .cell {
|
|
85
|
-
|
|
86
|
-
padding-
|
|
170
|
+
min-block-size: var(--component-size-sm);
|
|
171
|
+
padding-block: 6px;
|
|
172
|
+
padding-inline: var(--spacing-sm);
|
|
87
173
|
font-size: var(--font-size-xs);
|
|
88
174
|
line-height: var(--line-height-normal);
|
|
89
175
|
}
|
|
@@ -99,18 +185,14 @@
|
|
|
99
185
|
text-align: center;
|
|
100
186
|
}
|
|
101
187
|
|
|
102
|
-
/* Selection column */
|
|
103
188
|
.selectionCell {
|
|
104
|
-
padding: inherit
|
|
189
|
+
padding-block: inherit !important;
|
|
190
|
+
padding-inline: 0 !important;
|
|
105
191
|
overflow: visible !important;
|
|
106
192
|
display: flex;
|
|
107
|
-
align-items:
|
|
108
|
-
justify-content:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
/* Rows (interaction + states) */
|
|
112
|
-
.row {
|
|
113
|
-
background: transparent;
|
|
193
|
+
align-items: center;
|
|
194
|
+
justify-content: flex-start;
|
|
195
|
+
min-width: 0;
|
|
114
196
|
}
|
|
115
197
|
|
|
116
198
|
.clickableRow {
|
|
@@ -118,36 +200,23 @@
|
|
|
118
200
|
}
|
|
119
201
|
|
|
120
202
|
.clickableRow:hover {
|
|
121
|
-
background-color: var(--
|
|
203
|
+
background-color: var(--table-row-bg-hover);
|
|
122
204
|
}
|
|
123
205
|
|
|
124
206
|
.selectedRow {
|
|
125
|
-
background-color: var(--
|
|
207
|
+
background-color: var(--table-row-bg-selected);
|
|
126
208
|
}
|
|
127
209
|
|
|
128
210
|
.selectedRow:hover {
|
|
129
|
-
background-color: var(--
|
|
211
|
+
background-color: var(--table-row-bg-selected-hover);
|
|
130
212
|
}
|
|
131
213
|
|
|
132
214
|
.striped .row:nth-child(even):not(.selectedRow):not(:hover) {
|
|
133
|
-
background-color: var(--
|
|
215
|
+
background-color: var(--table-row-bg-alt);
|
|
134
216
|
}
|
|
135
217
|
|
|
136
|
-
/* Focus ring: apply when something inside row is focused */
|
|
137
|
-
.row:focus-within {
|
|
138
|
-
outline: none;
|
|
139
|
-
box-shadow:
|
|
140
|
-
inset 2px 0 0 var(--color-brand),
|
|
141
|
-
inset -2px 0 0 var(--color-brand),
|
|
142
|
-
inset 0 2px 0 var(--color-brand),
|
|
143
|
-
inset 0 -2px 0 var(--color-brand);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/* Content utilities */
|
|
147
218
|
.nowrap {
|
|
148
219
|
white-space: nowrap;
|
|
149
|
-
overflow: hidden;
|
|
150
|
-
text-overflow: ellipsis;
|
|
151
220
|
}
|
|
152
221
|
|
|
153
222
|
.allowWrap {
|
|
@@ -156,20 +225,44 @@
|
|
|
156
225
|
word-break: normal;
|
|
157
226
|
}
|
|
158
227
|
|
|
159
|
-
/* Header inner layout (same as before) */
|
|
160
228
|
.thInner {
|
|
161
229
|
display: flex;
|
|
162
230
|
align-items: center;
|
|
163
231
|
inline-size: 100%;
|
|
232
|
+
min-width: 0;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.thInnerRight {
|
|
236
|
+
justify-content: flex-end;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.thInnerCenter {
|
|
240
|
+
justify-content: center;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.thMain {
|
|
244
|
+
flex: 1 1 auto;
|
|
245
|
+
min-width: 0;
|
|
246
|
+
display: flex;
|
|
247
|
+
align-items: center;
|
|
248
|
+
justify-content: flex-start;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.thMainRight {
|
|
252
|
+
justify-content: flex-end;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.thMainCenter {
|
|
256
|
+
justify-content: center;
|
|
164
257
|
}
|
|
165
258
|
|
|
166
|
-
/* Sort button */
|
|
167
259
|
.thButton {
|
|
168
260
|
all: unset;
|
|
169
|
-
display: flex;
|
|
261
|
+
display: inline-flex;
|
|
170
262
|
align-items: center;
|
|
171
|
-
gap:
|
|
172
|
-
|
|
263
|
+
gap: 4px;
|
|
264
|
+
min-width: 0;
|
|
265
|
+
max-inline-size: 100%;
|
|
173
266
|
cursor: pointer;
|
|
174
267
|
user-select: none;
|
|
175
268
|
border-radius: var(--border-radius-default);
|
|
@@ -196,21 +289,36 @@
|
|
|
196
289
|
|
|
197
290
|
.thLabelRight {
|
|
198
291
|
text-align: right;
|
|
292
|
+
width: 100%;
|
|
199
293
|
}
|
|
200
294
|
|
|
201
295
|
.thLabelCenter {
|
|
202
296
|
text-align: center;
|
|
297
|
+
width: 100%;
|
|
203
298
|
}
|
|
204
299
|
|
|
205
|
-
.
|
|
206
|
-
|
|
300
|
+
.thOverlayExtras {
|
|
301
|
+
position: absolute;
|
|
302
|
+
inset-block: 0;
|
|
303
|
+
inset-inline-end: 0;
|
|
304
|
+
display: flex;
|
|
207
305
|
align-items: center;
|
|
306
|
+
justify-content: center;
|
|
307
|
+
min-width: 0;
|
|
308
|
+
pointer-events: none;
|
|
309
|
+
z-index: 5;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.thOverlayExtras > * {
|
|
313
|
+
pointer-events: auto;
|
|
208
314
|
}
|
|
209
315
|
|
|
210
316
|
.sortIndicator {
|
|
211
317
|
display: inline-flex;
|
|
212
318
|
flex: 0 0 auto;
|
|
213
319
|
align-items: center;
|
|
320
|
+
color: var(--color-fg-subtle);
|
|
321
|
+
opacity: 0.9;
|
|
214
322
|
}
|
|
215
323
|
|
|
216
324
|
.sortIndicator svg {
|
|
@@ -218,21 +326,142 @@
|
|
|
218
326
|
block-size: var(--icon-size-sm);
|
|
219
327
|
}
|
|
220
328
|
|
|
329
|
+
.cellContent {
|
|
330
|
+
display: block;
|
|
331
|
+
inline-size: 100%;
|
|
332
|
+
min-width: 0;
|
|
333
|
+
max-inline-size: 100%;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.cellContent > * {
|
|
337
|
+
min-width: 0;
|
|
338
|
+
max-inline-size: 100%;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.cellValueEllipsis {
|
|
342
|
+
display: block;
|
|
343
|
+
inline-size: 100%;
|
|
344
|
+
min-width: 0;
|
|
345
|
+
max-inline-size: 100%;
|
|
346
|
+
white-space: nowrap;
|
|
347
|
+
overflow: hidden;
|
|
348
|
+
text-overflow: ellipsis;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.allowWrap .cellContent {
|
|
352
|
+
white-space: normal;
|
|
353
|
+
overflow-wrap: break-word;
|
|
354
|
+
word-break: normal;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.severityTable {
|
|
358
|
+
--row-rail-width: 4px;
|
|
359
|
+
--row-rail-gap: 10px;
|
|
360
|
+
--row-rail-offset: calc(var(--row-rail-width) + var(--row-rail-gap));
|
|
361
|
+
--row-rail-inset-block: 1px;
|
|
362
|
+
--row-rail-radius: 0 2px 2px 0;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.severityTable .headerRow .selectionCell,
|
|
366
|
+
.severityTable .row .selectionCell {
|
|
367
|
+
padding-inline-start: var(--row-rail-offset) !important;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.severityTable .row.severity {
|
|
371
|
+
--row-severity-color: transparent;
|
|
372
|
+
--row-severity-bg: transparent;
|
|
373
|
+
--row-severity-bg-hover: transparent;
|
|
374
|
+
background-color: var(--row-severity-bg);
|
|
375
|
+
}
|
|
376
|
+
|
|
221
377
|
.severityTable .row.severity::before {
|
|
222
378
|
content: '';
|
|
223
379
|
position: absolute;
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
380
|
+
inset-inline-start: 0;
|
|
381
|
+
inset-block-start: var(--row-rail-inset-block);
|
|
382
|
+
inset-block-end: var(--row-rail-inset-block);
|
|
383
|
+
inline-size: var(--row-rail-width);
|
|
228
384
|
background-color: var(--row-severity-color);
|
|
229
|
-
border-radius:
|
|
385
|
+
border-radius: var(--row-rail-radius);
|
|
230
386
|
z-index: 2;
|
|
231
387
|
pointer-events: none;
|
|
388
|
+
opacity: 0.95;
|
|
389
|
+
transition:
|
|
390
|
+
inline-size 140ms ease,
|
|
391
|
+
opacity 140ms ease,
|
|
392
|
+
filter 140ms ease;
|
|
232
393
|
}
|
|
233
394
|
|
|
234
|
-
/* Ensure content is above the rail */
|
|
235
395
|
.severityTable .row.severity > * {
|
|
236
396
|
position: relative;
|
|
237
397
|
z-index: 3;
|
|
238
398
|
}
|
|
399
|
+
|
|
400
|
+
.severityTable .row.severity.clickableRow:hover::before,
|
|
401
|
+
.severityTable .row.severity:hover::before {
|
|
402
|
+
opacity: 1;
|
|
403
|
+
filter: saturate(1.08);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.severityTable .row.severity.clickableRow:hover,
|
|
407
|
+
.severityTable .row.severity:hover {
|
|
408
|
+
background-color: var(--row-severity-bg-hover);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
.severityTable .row.severity.selectedRow {
|
|
412
|
+
background-color: var(--table-row-bg-selected);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.severityTable .row.severity.selectedRow:hover {
|
|
416
|
+
background-color: var(--table-row-bg-selected-hover);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.severityTable .row.severity:focus-within::before {
|
|
420
|
+
inline-size: 6px;
|
|
421
|
+
opacity: 1;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.striped .severityTable .row.severity:nth-child(even):not(.selectedRow):not(:hover) {
|
|
425
|
+
background-image:
|
|
426
|
+
linear-gradient(var(--row-severity-bg), var(--row-severity-bg)),
|
|
427
|
+
linear-gradient(var(--table-row-bg-alt), var(--table-row-bg-alt));
|
|
428
|
+
background-blend-mode: normal;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.severityTable .row.severityFailed::before {
|
|
432
|
+
box-shadow: 1px 0 0 color-mix(in srgb, var(--row-severity-color) 20%, transparent);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.sm .severityTable {
|
|
436
|
+
--row-rail-width: 4px;
|
|
437
|
+
--row-rail-gap: 8px;
|
|
438
|
+
--row-rail-inset-block: 1px;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
.dividerLeft {
|
|
442
|
+
position: relative;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
.dividerLeft::before {
|
|
446
|
+
content: '';
|
|
447
|
+
position: absolute;
|
|
448
|
+
left: 0;
|
|
449
|
+
top: 8px;
|
|
450
|
+
bottom: 8px;
|
|
451
|
+
width: 1px;
|
|
452
|
+
background: var(--table-divider);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
.dividerRight {
|
|
456
|
+
position: relative;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.dividerRight::after {
|
|
460
|
+
content: '';
|
|
461
|
+
position: absolute;
|
|
462
|
+
right: 0;
|
|
463
|
+
top: 8px;
|
|
464
|
+
bottom: 8px;
|
|
465
|
+
width: 1px;
|
|
466
|
+
background: var(--table-divider);
|
|
467
|
+
}
|
|
@@ -4,31 +4,7 @@ import { useReactTable, getCoreRowModel, getSortedRowModel, getFilteredRowModel,
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import ColumnResizer from './components/column-resizer/ColumnResizer';
|
|
6
6
|
import { Table } from './Table';
|
|
7
|
-
import { buildColumnVisibilityFromVisibleIds, mapDefsToColumnItems, sortingEqual, getSortPropsFromSorting, columnItemsToIdSet, } from './tanstackTable.utils';
|
|
8
|
-
function buildGridTemplateColumns(args) {
|
|
9
|
-
var _a, _b, _c, _d;
|
|
10
|
-
const { table, allowedIds, hasSelection, selectionPx, defaultMinPx } = args;
|
|
11
|
-
const parts = [];
|
|
12
|
-
if (hasSelection)
|
|
13
|
-
parts.push(`${selectionPx}px`);
|
|
14
|
-
const leaf = table.getVisibleLeafColumns().filter(c => allowedIds.has(c.id));
|
|
15
|
-
for (const c of leaf) {
|
|
16
|
-
const def = c.columnDef;
|
|
17
|
-
const min = Number((_a = def.minSize) !== null && _a !== void 0 ? _a : defaultMinPx);
|
|
18
|
-
const maxRaw = def.maxSize;
|
|
19
|
-
const max = maxRaw == null ? Number.POSITIVE_INFINITY : Number(maxRaw);
|
|
20
|
-
const size = Number((_d = (_c = (_b = c.getSize) === null || _b === void 0 ? void 0 : _b.call(c)) !== null && _c !== void 0 ? _c : def.size) !== null && _d !== void 0 ? _d : min);
|
|
21
|
-
if (Number.isFinite(min) && Number.isFinite(max) && min > 0 && max === min) {
|
|
22
|
-
parts.push(`${Math.round(min)}px`);
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
// Weight based on size so wide columns keep more room
|
|
26
|
-
const weight = Math.max(1, Math.min(6, Math.round(size / 100)));
|
|
27
|
-
// Respect minSize; scroll if mins don't fit
|
|
28
|
-
parts.push(`minmax(${Math.round(min)}px, ${weight}fr)`);
|
|
29
|
-
}
|
|
30
|
-
return parts.join(' ');
|
|
31
|
-
}
|
|
7
|
+
import { buildColumnVisibilityFromVisibleIds, mapDefsToColumnItems, sortingEqual, getSortPropsFromSorting, columnItemsToIdSet, buildDistributedGridTemplateColumns, } from './tanstackTable.utils';
|
|
32
8
|
export function TanstackTable(props) {
|
|
33
9
|
const { data, dataKey, columns, sorting: controlledSorting, onSortingChange, optimisticSortingUi = true, visibleColumnIds, manualSorting, selectedRows, onRowSelect, ...tableProps } = props;
|
|
34
10
|
const isControlledSorting = controlledSorting != null;
|
|
@@ -70,7 +46,6 @@ export function TanstackTable(props) {
|
|
|
70
46
|
enableResizing: true,
|
|
71
47
|
minSize: 80,
|
|
72
48
|
size: 180,
|
|
73
|
-
maxSize: 300,
|
|
74
49
|
},
|
|
75
50
|
});
|
|
76
51
|
const columnItems = React.useMemo(() => mapDefsToColumnItems(columns, columnVisibility), [columns, columnVisibility]);
|
|
@@ -98,12 +73,13 @@ export function TanstackTable(props) {
|
|
|
98
73
|
}, [table]);
|
|
99
74
|
const hasSelection = Boolean(selectedRows && onRowSelect && dataKey);
|
|
100
75
|
const gridTemplateColumns = React.useMemo(() => {
|
|
101
|
-
return
|
|
76
|
+
return buildDistributedGridTemplateColumns({
|
|
102
77
|
table,
|
|
103
78
|
allowedIds,
|
|
104
79
|
hasSelection,
|
|
105
80
|
selectionPx: 36,
|
|
106
81
|
defaultMinPx: 80,
|
|
82
|
+
columnSizing,
|
|
107
83
|
});
|
|
108
84
|
}, [table, allowedIds, hasSelection, columnSizing]);
|
|
109
85
|
return (_jsx(Table, { ...tableProps, onSortChange: handleSortChange, dataKey: dataKey, data: visibleData, columns: columnItems, sortById: sortById, sortDirection: sortDirection, gridTemplateColumns: gridTemplateColumns, headerExtras: headerExtras, selectedRows: selectedRows, onRowSelect: onRowSelect }));
|
|
@@ -2,7 +2,7 @@ import type { CSSProperties, ReactNode } from 'react';
|
|
|
2
2
|
import type { ColumnItem } from './Table';
|
|
3
3
|
export type SortDirection = 'asc' | 'desc' | null;
|
|
4
4
|
export declare function getVisibleColumns<T>(columns: Array<ColumnItem<T>>): Array<ColumnItem<T>>;
|
|
5
|
-
export declare function getColumnStyle(columnId: string, columnStyles: Partial<Record<string, CSSProperties>> | undefined, alignment?: 'left' | 'right' | 'center', verticalAlignment?: 'top' | 'middle' | 'bottom'): CSSProperties;
|
|
5
|
+
export declare function getColumnStyle(columnId: string, columnStyles: Partial<Record<string, CSSProperties>> | undefined, alignment?: 'left' | 'right' | 'center', verticalAlignment?: 'top' | 'middle' | 'bottom', divider?: boolean): CSSProperties;
|
|
6
6
|
export declare function getHeaderLabel(header: string | (() => ReactNode)): ReactNode;
|
|
7
7
|
export declare function isActiveSort(sortById: string | undefined, columnId: string): boolean;
|
|
8
8
|
export declare function getAriaSort(sortable: boolean | undefined, active: boolean, direction: SortDirection): 'ascending' | 'descending' | 'none';
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
export function getVisibleColumns(columns) {
|
|
2
2
|
return columns.filter(c => !c.hidden);
|
|
3
3
|
}
|
|
4
|
-
export function getColumnStyle(columnId, columnStyles, alignment, verticalAlignment) {
|
|
4
|
+
export function getColumnStyle(columnId, columnStyles, alignment, verticalAlignment, divider) {
|
|
5
5
|
const baseStyle = columnStyles === null || columnStyles === void 0 ? void 0 : columnStyles[columnId];
|
|
6
6
|
return {
|
|
7
7
|
...(baseStyle !== null && baseStyle !== void 0 ? baseStyle : {}),
|
|
8
8
|
...(alignment === 'right' ? { fontVariantNumeric: 'tabular-nums' } : null),
|
|
9
9
|
verticalAlign: verticalAlignment !== null && verticalAlignment !== void 0 ? verticalAlignment : 'top',
|
|
10
10
|
textAlign: alignment !== null && alignment !== void 0 ? alignment : 'left',
|
|
11
|
+
...(divider ? { borderLeft: '1px solid var(--color-border-subtle)' } : null),
|
|
11
12
|
};
|
|
12
13
|
}
|
|
13
14
|
export function getHeaderLabel(header) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { ColumnDef, SortingState, VisibilityState
|
|
2
|
-
import type { CSSProperties } from 'react';
|
|
1
|
+
import type { ColumnDef, ColumnSizingState, SortingState, VisibilityState } from '@tanstack/react-table';
|
|
3
2
|
import type { ColumnItem } from './Table';
|
|
4
3
|
type AnyRecord = Record<string, any>;
|
|
5
4
|
export declare function getColumnId<T>(def: ColumnDef<T, any>, index: number): string;
|
|
@@ -10,13 +9,13 @@ export declare function getSortPropsFromSorting(sorting: SortingState): {
|
|
|
10
9
|
sortById?: string;
|
|
11
10
|
sortDirection: 'asc' | 'desc' | null;
|
|
12
11
|
};
|
|
13
|
-
/**
|
|
14
|
-
* Builds `columnStyles` where TanStack is source of truth.
|
|
15
|
-
* Keep this util pure by passing in the leaf columns and the set of allowed IDs.
|
|
16
|
-
*/
|
|
17
|
-
export declare function buildColumnStyles(leafColumns: Array<Pick<Column<any, any>, 'id' | 'getSize' | 'columnDef'>>, allowedIds: Set<string>, defaults?: {
|
|
18
|
-
minWidth: number;
|
|
19
|
-
maxWidth: number;
|
|
20
|
-
}): Record<string, CSSProperties>;
|
|
21
12
|
export declare function columnItemsToIdSet<T>(items: Array<ColumnItem<T>>): Set<string>;
|
|
13
|
+
export declare function buildDistributedGridTemplateColumns(args: {
|
|
14
|
+
table: any;
|
|
15
|
+
allowedIds: Set<string>;
|
|
16
|
+
hasSelection: boolean;
|
|
17
|
+
selectionPx: number;
|
|
18
|
+
defaultMinPx: number;
|
|
19
|
+
columnSizing: ColumnSizingState;
|
|
20
|
+
}): string;
|
|
22
21
|
export {};
|