@dbcdk/react-components 0.0.157 → 0.0.159
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/accordion/components/AccordionRow.cjs +1 -1
- package/dist/components/accordion/components/AccordionRow.js +1 -1
- package/dist/components/breadcrumbs/Breadcrumbs.module.css +3 -6
- package/dist/components/button/Button.module.css +1 -1
- package/dist/components/forms/input/Input.module.css +12 -0
- package/dist/components/forms/radio-buttons/RadioButtons.module.css +10 -3
- package/dist/components/headline/CollapsibleHeadline.cjs +1 -0
- package/dist/components/headline/CollapsibleHeadline.js +1 -0
- package/dist/components/headline/Headline.module.css +2 -26
- package/dist/components/icon/Icon.cjs +16 -5
- package/dist/components/icon/Icon.d.ts +3 -1
- package/dist/components/icon/Icon.js +17 -6
- package/dist/components/icon/Icon.module.css +1 -1
- package/dist/components/menu/Menu.module.css +12 -0
- package/dist/components/nav-bar/NavBar.cjs +4 -1
- package/dist/components/nav-bar/NavBar.js +4 -1
- package/dist/components/nav-bar/NavBar.module.css +18 -0
- package/dist/components/sidebar/Sidebar.cjs +2 -0
- package/dist/components/sidebar/Sidebar.d.ts +1 -1
- package/dist/components/sidebar/Sidebar.js +2 -0
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.cjs +6 -1
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.d.ts +1 -1
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.js +6 -1
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.module.css +30 -2
- package/dist/components/table/Table.cjs +17 -3
- package/dist/components/table/Table.d.ts +1 -1
- package/dist/components/table/Table.js +18 -4
- package/dist/components/table/Table.module.css +57 -50
- package/dist/components/table/Table.types.d.ts +1 -1
- package/dist/components/table/components/TableBody.cjs +9 -5
- package/dist/components/table/components/TableBody.d.ts +4 -2
- package/dist/components/table/components/TableBody.js +9 -5
- package/dist/components/table/components/TableHeaderCell.cjs +3 -4
- package/dist/components/table/components/TableHeaderCell.js +4 -5
- package/dist/components/table/components/TableRow.cjs +39 -18
- package/dist/components/table/components/TableRow.d.ts +4 -1
- package/dist/components/table/components/TableRow.js +40 -19
- package/dist/components/table/components/table-settings/TableSettings.cjs +1 -1
- package/dist/components/table/components/table-settings/TableSettings.js +2 -2
- package/dist/components/table/table.utils.cjs +2 -0
- package/dist/components/table/table.utils.d.ts +1 -0
- package/dist/components/table/table.utils.js +2 -1
- package/dist/components/tabs/Tabs.module.css +1 -1
- package/dist/styles/styles.css +37 -61
- package/dist/styles/themes/dbc/colors.css +8 -3
- package/dist/styles/themes/filmstriben-budget/theme.css +22 -0
- package/dist/styles.css +37 -61
- package/dist/themes/filmstriben-budget.css +3 -0
- package/dist/utils/date/formatDate.cjs +15 -1
- package/dist/utils/date/formatDate.d.ts +9 -1
- package/dist/utils/date/formatDate.js +15 -1
- package/package.json +1 -1
|
@@ -48,11 +48,9 @@
|
|
|
48
48
|
.tableRoot {
|
|
49
49
|
--table-component-header-bg: var(--table-header-bg);
|
|
50
50
|
--table-component-header-fg: var(--table-header-fg);
|
|
51
|
-
--table-component-header-border: var(--table-border-header);
|
|
52
51
|
--table-component-header-font-weight: var(--font-weight-medium);
|
|
53
52
|
--table-component-row-bg: var(--table-row-bg);
|
|
54
|
-
--table-component-row-bg-
|
|
55
|
-
--table-component-row-bg-hover: var(--table-row-bg-hover);
|
|
53
|
+
--table-component-row-bg-hover: var(--color-bg-hover-subtle);
|
|
56
54
|
--table-component-row-bg-selected: var(--table-row-bg-selected);
|
|
57
55
|
--table-component-row-bg-selected-hover: var(--table-row-bg-selected-hover);
|
|
58
56
|
--table-component-cell-fg: var(--table-cell-fg);
|
|
@@ -78,14 +76,8 @@
|
|
|
78
76
|
.embedded {
|
|
79
77
|
--table-component-header-bg: transparent;
|
|
80
78
|
--table-component-header-fg: var(--color-fg-subtle);
|
|
81
|
-
--table-component-header-border: transparent;
|
|
82
79
|
--table-component-header-font-weight: var(--font-weight-default);
|
|
83
80
|
--table-component-row-bg: transparent;
|
|
84
|
-
--table-component-row-bg-alt: color-mix(
|
|
85
|
-
in srgb,
|
|
86
|
-
var(--color-bg-contextual-subtle) 55%,
|
|
87
|
-
transparent
|
|
88
|
-
);
|
|
89
81
|
--table-component-row-bg-hover: var(--color-bg-contextual-subtle);
|
|
90
82
|
--table-component-row-bg-selected: color-mix(in srgb, var(--color-bg-selected) 55%, transparent);
|
|
91
83
|
--table-component-row-bg-selected-hover: color-mix(
|
|
@@ -162,13 +154,10 @@
|
|
|
162
154
|
.headerCell {
|
|
163
155
|
vertical-align: middle;
|
|
164
156
|
background-color: var(--table-component-header-bg);
|
|
165
|
-
border-block-end: 1px solid var(--table-component-header-border);
|
|
166
157
|
padding-block: var(--spacing-xxs);
|
|
167
158
|
padding-inline: var(--spacing-sm);
|
|
168
159
|
font-size: var(--font-size-xs);
|
|
169
160
|
font-weight: var(--table-component-header-font-weight);
|
|
170
|
-
letter-spacing: var(--letter-spacing-wide);
|
|
171
|
-
text-transform: uppercase;
|
|
172
161
|
color: var(--table-component-header-fg);
|
|
173
162
|
white-space: nowrap;
|
|
174
163
|
}
|
|
@@ -212,15 +201,9 @@
|
|
|
212
201
|
height: 32px;
|
|
213
202
|
}
|
|
214
203
|
|
|
215
|
-
.sm .contextMenuOverlay {
|
|
216
|
-
min-block-size: 0;
|
|
217
|
-
block-size: min(100%, 32px);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
204
|
.sm .contextMenuTrigger {
|
|
221
205
|
min-block-size: 0;
|
|
222
206
|
block-size: 100%;
|
|
223
|
-
border-radius: 0;
|
|
224
207
|
}
|
|
225
208
|
|
|
226
209
|
.cell[data-vertical-align='top'] {
|
|
@@ -315,10 +298,6 @@
|
|
|
315
298
|
background-color: var(--table-component-row-bg-selected-hover);
|
|
316
299
|
}
|
|
317
300
|
|
|
318
|
-
.striped > .row:nth-child(even):not(.selectedRow):not(:hover) > .cell {
|
|
319
|
-
background-color: var(--table-component-row-bg-alt);
|
|
320
|
-
}
|
|
321
|
-
|
|
322
301
|
.row:focus-within > .cell {
|
|
323
302
|
box-shadow:
|
|
324
303
|
inset 0 2px 0 var(--color-brand),
|
|
@@ -395,7 +374,7 @@
|
|
|
395
374
|
all: unset;
|
|
396
375
|
display: inline-flex;
|
|
397
376
|
align-items: center;
|
|
398
|
-
gap:
|
|
377
|
+
gap: var(--spacing-2xs);
|
|
399
378
|
min-width: 0;
|
|
400
379
|
max-inline-size: 100%;
|
|
401
380
|
cursor: pointer;
|
|
@@ -404,6 +383,17 @@
|
|
|
404
383
|
padding-block: 2px;
|
|
405
384
|
padding-inline: 2px;
|
|
406
385
|
justify-content: flex-start;
|
|
386
|
+
transition: color var(--transition-fast) var(--ease-standard);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.thButton:hover {
|
|
390
|
+
color: var(--color-fg-default);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.thButton:focus-visible {
|
|
394
|
+
outline: none;
|
|
395
|
+
color: var(--color-fg-default);
|
|
396
|
+
box-shadow: inset 0 0 0 1px var(--color-border-selected);
|
|
407
397
|
}
|
|
408
398
|
|
|
409
399
|
.thButtonRight {
|
|
@@ -469,6 +459,10 @@
|
|
|
469
459
|
opacity: 0.45;
|
|
470
460
|
}
|
|
471
461
|
|
|
462
|
+
.activeSort {
|
|
463
|
+
color: var(--color-fg-default);
|
|
464
|
+
}
|
|
465
|
+
|
|
472
466
|
.cellContent {
|
|
473
467
|
display: flex;
|
|
474
468
|
inline-size: 100%;
|
|
@@ -563,29 +557,35 @@
|
|
|
563
557
|
|
|
564
558
|
.contextMenuTrigger {
|
|
565
559
|
color: var(--color-fg-subtle);
|
|
566
|
-
min-inline-size: var(--component-size-
|
|
567
|
-
min-block-size: var(--component-size-
|
|
568
|
-
border-radius:
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
.contextMenuAnchorCell {
|
|
572
|
-
overflow: visible;
|
|
560
|
+
min-inline-size: calc(var(--component-size-md) + 4px);
|
|
561
|
+
min-block-size: calc(var(--component-size-md) + 4px);
|
|
562
|
+
border-radius: 999px;
|
|
563
|
+
background-color: transparent;
|
|
564
|
+
position: relative;
|
|
573
565
|
z-index: 1;
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
.contextMenuAnchorCell .cellValueEllipsis,
|
|
577
|
-
.contextMenuAnchorCell .cellValueNoEllipsis {
|
|
578
|
-
padding-inline-end: calc(var(--component-size-sm) + var(--spacing-sm));
|
|
566
|
+
overflow: hidden;
|
|
579
567
|
}
|
|
580
568
|
|
|
581
569
|
.contextMenuOverlay {
|
|
582
570
|
position: absolute;
|
|
583
|
-
inset-block:
|
|
584
|
-
inset-inline-end:
|
|
571
|
+
inset-block-start: 50%;
|
|
572
|
+
inset-inline-end: var(--spacing-2xs);
|
|
573
|
+
transform: translateY(-50%);
|
|
585
574
|
display: inline-flex;
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
575
|
+
align-items: center;
|
|
576
|
+
justify-content: flex-end;
|
|
577
|
+
inline-size: max-content;
|
|
578
|
+
block-size: auto;
|
|
579
|
+
min-inline-size: 0;
|
|
580
|
+
padding: 0;
|
|
581
|
+
border-radius: var(--border-radius-rounded);
|
|
582
|
+
background-color: transparent;
|
|
583
|
+
z-index: 2;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
.contextMenuHoverOnly .contextMenuOverlay {
|
|
587
|
+
opacity: 0;
|
|
588
|
+
pointer-events: none;
|
|
589
589
|
}
|
|
590
590
|
|
|
591
591
|
/*
|
|
@@ -600,11 +600,24 @@
|
|
|
600
600
|
.contextMenuOverlay > div,
|
|
601
601
|
.contextMenuOverlay > div > div {
|
|
602
602
|
align-items: center;
|
|
603
|
+
background-color: transparent;
|
|
604
|
+
overflow: visible;
|
|
605
|
+
border-radius: 999px;
|
|
603
606
|
}
|
|
604
607
|
|
|
605
|
-
.
|
|
606
|
-
|
|
607
|
-
|
|
608
|
+
.actionCell {
|
|
609
|
+
overflow: visible;
|
|
610
|
+
position: relative;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
.cellContentWithActions {
|
|
614
|
+
padding-inline-end: calc(var(--component-size-md) + 4px + var(--spacing-sm));
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
.contextMenuTrigger:hover,
|
|
618
|
+
.contextMenuTrigger:focus-visible {
|
|
619
|
+
background-color: var(--table-component-row-bg-hover);
|
|
620
|
+
z-index: 2;
|
|
608
621
|
}
|
|
609
622
|
|
|
610
623
|
.contextMenuItemLabel {
|
|
@@ -618,13 +631,7 @@
|
|
|
618
631
|
min-width: 0;
|
|
619
632
|
}
|
|
620
633
|
|
|
621
|
-
.contextMenuHoverOnly .
|
|
622
|
-
opacity: 0;
|
|
623
|
-
pointer-events: none;
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
.contextMenuHoverOnly:hover .contextMenuTrigger,
|
|
627
|
-
.contextMenuHoverOnly:focus-within .contextMenuTrigger {
|
|
634
|
+
.contextMenuHoverOnly:hover .contextMenuOverlay {
|
|
628
635
|
opacity: 1;
|
|
629
636
|
pointer-events: auto;
|
|
630
637
|
}
|
|
@@ -56,7 +56,6 @@ export type TableProps<T extends Record<string, any>> = Omit<HTMLAttributes<HTML
|
|
|
56
56
|
variant?: TableVariant;
|
|
57
57
|
size?: 'sm' | 'md';
|
|
58
58
|
viewMode?: ViewMode;
|
|
59
|
-
striped?: boolean;
|
|
60
59
|
fillViewport?: boolean;
|
|
61
60
|
fillViewportBottomOffset?: number;
|
|
62
61
|
containScrolling?: boolean;
|
|
@@ -82,6 +81,7 @@ export type TableProps<T extends Record<string, any>> = Omit<HTMLAttributes<HTML
|
|
|
82
81
|
open: () => void;
|
|
83
82
|
}) => TableContextMenuItem[];
|
|
84
83
|
showContextMenuOnHover?: boolean;
|
|
84
|
+
expandableRows?: boolean;
|
|
85
85
|
onRowClick?: (row: T) => void;
|
|
86
86
|
onRowMouseEnter?: (row: T) => void;
|
|
87
87
|
onRowSelect?: (rowId: number | string, isSelected: boolean) => void;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var table_classes = require('../table.classes');
|
|
5
4
|
var styles = require('../Table.module.css');
|
|
6
5
|
var TableRow = require('./TableRow');
|
|
7
6
|
|
|
@@ -13,7 +12,6 @@ function TableBody({
|
|
|
13
12
|
data,
|
|
14
13
|
dataKey,
|
|
15
14
|
columns,
|
|
16
|
-
striped,
|
|
17
15
|
selectedRows,
|
|
18
16
|
hasSelection,
|
|
19
17
|
selectionMode,
|
|
@@ -22,11 +20,14 @@ function TableBody({
|
|
|
22
20
|
getRowSeverity,
|
|
23
21
|
getContextMenuItems,
|
|
24
22
|
showContextMenuOnHover,
|
|
23
|
+
expandableRows,
|
|
24
|
+
expandedRows,
|
|
25
25
|
onRowClick,
|
|
26
26
|
onRowMouseEnter,
|
|
27
|
-
onRowSelect
|
|
27
|
+
onRowSelect,
|
|
28
|
+
onToggleRowExpand
|
|
28
29
|
}) {
|
|
29
|
-
return /* @__PURE__ */ jsxRuntime.jsx("tbody", { className:
|
|
30
|
+
return /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: styles__default.default.body, children: data.map((row) => {
|
|
30
31
|
const rowId = row[dataKey];
|
|
31
32
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
32
33
|
TableRow.TableRow,
|
|
@@ -42,9 +43,12 @@ function TableBody({
|
|
|
42
43
|
getRowSeverity,
|
|
43
44
|
getContextMenuItems,
|
|
44
45
|
showContextMenuOnHover,
|
|
46
|
+
expandableRows,
|
|
47
|
+
expandedRows,
|
|
45
48
|
onRowClick,
|
|
46
49
|
onRowMouseEnter,
|
|
47
|
-
onRowSelect
|
|
50
|
+
onRowSelect,
|
|
51
|
+
onToggleRowExpand
|
|
48
52
|
},
|
|
49
53
|
`gridRow-${rowId}`
|
|
50
54
|
);
|
|
@@ -5,7 +5,6 @@ type Props<T extends Record<string, any>> = {
|
|
|
5
5
|
data: T[];
|
|
6
6
|
dataKey: keyof T;
|
|
7
7
|
columns: ColumnItem<T>[];
|
|
8
|
-
striped?: boolean;
|
|
9
8
|
selectedRows?: Set<number | string>;
|
|
10
9
|
hasSelection: boolean;
|
|
11
10
|
selectionMode: 'single' | 'multiple';
|
|
@@ -18,9 +17,12 @@ type Props<T extends Record<string, any>> = {
|
|
|
18
17
|
open: () => void;
|
|
19
18
|
}) => TableContextMenuItem[];
|
|
20
19
|
showContextMenuOnHover: boolean;
|
|
20
|
+
expandableRows?: boolean;
|
|
21
|
+
expandedRows?: Set<number | string>;
|
|
21
22
|
onRowClick?: (row: T) => void;
|
|
22
23
|
onRowMouseEnter?: (row: T) => void;
|
|
23
24
|
onRowSelect?: (rowId: number | string, isSelected: boolean) => void;
|
|
25
|
+
onToggleRowExpand?: (rowId: number | string) => void;
|
|
24
26
|
};
|
|
25
|
-
export declare function TableBody<T extends Record<string, any>>({ data, dataKey, columns,
|
|
27
|
+
export declare function TableBody<T extends Record<string, any>>({ data, dataKey, columns, selectedRows, hasSelection, selectionMode, selectionInputName, viewMode, getRowSeverity, getContextMenuItems, showContextMenuOnHover, expandableRows, expandedRows, onRowClick, onRowMouseEnter, onRowSelect, onToggleRowExpand, }: Props<T>): ReactNode;
|
|
26
28
|
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { cx } from '../table.classes';
|
|
3
2
|
import styles from '../Table.module.css';
|
|
4
3
|
import { TableRow } from './TableRow';
|
|
5
4
|
|
|
@@ -7,7 +6,6 @@ function TableBody({
|
|
|
7
6
|
data,
|
|
8
7
|
dataKey,
|
|
9
8
|
columns,
|
|
10
|
-
striped,
|
|
11
9
|
selectedRows,
|
|
12
10
|
hasSelection,
|
|
13
11
|
selectionMode,
|
|
@@ -16,11 +14,14 @@ function TableBody({
|
|
|
16
14
|
getRowSeverity,
|
|
17
15
|
getContextMenuItems,
|
|
18
16
|
showContextMenuOnHover,
|
|
17
|
+
expandableRows,
|
|
18
|
+
expandedRows,
|
|
19
19
|
onRowClick,
|
|
20
20
|
onRowMouseEnter,
|
|
21
|
-
onRowSelect
|
|
21
|
+
onRowSelect,
|
|
22
|
+
onToggleRowExpand
|
|
22
23
|
}) {
|
|
23
|
-
return /* @__PURE__ */ jsx("tbody", { className:
|
|
24
|
+
return /* @__PURE__ */ jsx("tbody", { className: styles.body, children: data.map((row) => {
|
|
24
25
|
const rowId = row[dataKey];
|
|
25
26
|
return /* @__PURE__ */ jsx(
|
|
26
27
|
TableRow,
|
|
@@ -36,9 +37,12 @@ function TableBody({
|
|
|
36
37
|
getRowSeverity,
|
|
37
38
|
getContextMenuItems,
|
|
38
39
|
showContextMenuOnHover,
|
|
40
|
+
expandableRows,
|
|
41
|
+
expandedRows,
|
|
39
42
|
onRowClick,
|
|
40
43
|
onRowMouseEnter,
|
|
41
|
-
onRowSelect
|
|
44
|
+
onRowSelect,
|
|
45
|
+
onToggleRowExpand
|
|
42
46
|
},
|
|
43
47
|
`gridRow-${rowId}`
|
|
44
48
|
);
|
|
@@ -21,7 +21,6 @@ function TableHeaderCell({
|
|
|
21
21
|
const active = table_utils.isActiveSort(sortById, column.id);
|
|
22
22
|
const ariaSort = table_utils.getAriaSort(column.sortable, active, sortDirection != null ? sortDirection : null);
|
|
23
23
|
const align = table_classes.getAlignValue(column);
|
|
24
|
-
const dividerClass = table_classes.getDividerClass(column);
|
|
25
24
|
const alignClasses = table_classes.getHeaderAlignClasses(align);
|
|
26
25
|
const handleToggleSort = () => {
|
|
27
26
|
if (!column.sortable || !onSortChange) return;
|
|
@@ -31,7 +30,7 @@ function TableHeaderCell({
|
|
|
31
30
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
32
31
|
"th",
|
|
33
32
|
{
|
|
34
|
-
className:
|
|
33
|
+
className: styles__default.default.headerCell,
|
|
35
34
|
scope: "col",
|
|
36
35
|
"aria-sort": ariaSort,
|
|
37
36
|
"data-align": align,
|
|
@@ -52,8 +51,8 @@ function TableHeaderCell({
|
|
|
52
51
|
children: [
|
|
53
52
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: alignClasses.label, children: table_utils.getHeaderLabel(column.header) }),
|
|
54
53
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles__default.default.sortIndicator, "aria-hidden": "true", children: [
|
|
55
|
-
active && sortDirection === "asc" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUp, {}),
|
|
56
|
-
active && sortDirection === "desc" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowDown, {}),
|
|
54
|
+
active && sortDirection === "asc" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUp, { className: styles__default.default.activeSort }),
|
|
55
|
+
active && sortDirection === "desc" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowDown, { className: styles__default.default.activeSort }),
|
|
57
56
|
!active && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowDown, { className: styles__default.default.inActiveSort })
|
|
58
57
|
] })
|
|
59
58
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { ArrowUp, ArrowDown } from 'lucide-react';
|
|
3
|
-
import { getAlignValue,
|
|
3
|
+
import { getAlignValue, getHeaderAlignClasses } from '../table.classes';
|
|
4
4
|
import styles from '../Table.module.css';
|
|
5
5
|
import { isActiveSort, getAriaSort, getHeaderLabel, shouldToggleOnKey, getNextSortDirection } from '../table.utils';
|
|
6
6
|
|
|
@@ -15,7 +15,6 @@ function TableHeaderCell({
|
|
|
15
15
|
const active = isActiveSort(sortById, column.id);
|
|
16
16
|
const ariaSort = getAriaSort(column.sortable, active, sortDirection != null ? sortDirection : null);
|
|
17
17
|
const align = getAlignValue(column);
|
|
18
|
-
const dividerClass = getDividerClass(column);
|
|
19
18
|
const alignClasses = getHeaderAlignClasses(align);
|
|
20
19
|
const handleToggleSort = () => {
|
|
21
20
|
if (!column.sortable || !onSortChange) return;
|
|
@@ -25,7 +24,7 @@ function TableHeaderCell({
|
|
|
25
24
|
return /* @__PURE__ */ jsxs(
|
|
26
25
|
"th",
|
|
27
26
|
{
|
|
28
|
-
className:
|
|
27
|
+
className: styles.headerCell,
|
|
29
28
|
scope: "col",
|
|
30
29
|
"aria-sort": ariaSort,
|
|
31
30
|
"data-align": align,
|
|
@@ -46,8 +45,8 @@ function TableHeaderCell({
|
|
|
46
45
|
children: [
|
|
47
46
|
/* @__PURE__ */ jsx("span", { className: alignClasses.label, children: getHeaderLabel(column.header) }),
|
|
48
47
|
/* @__PURE__ */ jsxs("span", { className: styles.sortIndicator, "aria-hidden": "true", children: [
|
|
49
|
-
active && sortDirection === "asc" && /* @__PURE__ */ jsx(ArrowUp, {}),
|
|
50
|
-
active && sortDirection === "desc" && /* @__PURE__ */ jsx(ArrowDown, {}),
|
|
48
|
+
active && sortDirection === "asc" && /* @__PURE__ */ jsx(ArrowUp, { className: styles.activeSort }),
|
|
49
|
+
active && sortDirection === "desc" && /* @__PURE__ */ jsx(ArrowDown, { className: styles.activeSort }),
|
|
51
50
|
!active && /* @__PURE__ */ jsx(ArrowDown, { className: styles.inActiveSort })
|
|
52
51
|
] })
|
|
53
52
|
]
|
|
@@ -30,14 +30,19 @@ function TableRow({
|
|
|
30
30
|
getRowSeverity,
|
|
31
31
|
getContextMenuItems,
|
|
32
32
|
showContextMenuOnHover,
|
|
33
|
+
expandableRows,
|
|
34
|
+
expandedRows,
|
|
33
35
|
onRowClick,
|
|
34
36
|
onRowMouseEnter,
|
|
35
|
-
onRowSelect
|
|
37
|
+
onRowSelect,
|
|
38
|
+
onToggleRowExpand
|
|
36
39
|
}) {
|
|
37
|
-
var _a;
|
|
40
|
+
var _a, _b;
|
|
38
41
|
const isSelected = (_a = selectedRows == null ? void 0 : selectedRows.has(rowId)) != null ? _a : false;
|
|
42
|
+
const isExpanded = (_b = expandedRows == null ? void 0 : expandedRows.has(rowId)) != null ? _b : false;
|
|
39
43
|
const rowSeverity = getRowSeverity == null ? void 0 : getRowSeverity(row);
|
|
40
44
|
const canSelect = Boolean(selectedRows && onRowSelect);
|
|
45
|
+
const canExpand = Boolean(expandableRows && onToggleRowExpand);
|
|
41
46
|
const contextMenuItems = getContextMenuItems == null ? void 0 : getContextMenuItems({
|
|
42
47
|
row,
|
|
43
48
|
rowId,
|
|
@@ -128,32 +133,32 @@ function TableRow({
|
|
|
128
133
|
)
|
|
129
134
|
}
|
|
130
135
|
) }) : null,
|
|
131
|
-
columns.map((column) => {
|
|
132
|
-
var _a2,
|
|
133
|
-
const allowWrap = table_utils.shouldAllowWrap(column.allowWrap, isSelected, viewMode);
|
|
136
|
+
columns.map((column, index) => {
|
|
137
|
+
var _a2, _b2, _c, _d;
|
|
138
|
+
const allowWrap = table_utils.shouldAllowWrap(column.allowWrap, isSelected || isExpanded, viewMode);
|
|
134
139
|
const allowOverflow = column.allowOverflow;
|
|
135
140
|
const cellValue = table_utils.getCellDisplayValue(row, column);
|
|
136
|
-
const
|
|
141
|
+
const showRowActions = index === columns.length - 1 && hasContextMenu;
|
|
137
142
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
138
143
|
"td",
|
|
139
144
|
{
|
|
140
145
|
className: table_classes.cx(
|
|
141
146
|
styles__default.default.cell,
|
|
147
|
+
showRowActions && styles__default.default.actionCell,
|
|
142
148
|
allowOverflow && styles__default.default.allowOverflow,
|
|
143
149
|
allowWrap ? styles__default.default.allowWrap : styles__default.default.nowrap,
|
|
144
|
-
hasContextMenu && isLastColumn && styles__default.default.contextMenuAnchorCell,
|
|
145
150
|
column.divider === "left" && styles__default.default.dividerLeft,
|
|
146
151
|
column.divider === "right" && styles__default.default.dividerRight
|
|
147
152
|
),
|
|
148
|
-
"data-align": (
|
|
149
|
-
"data-vertical-align": (
|
|
153
|
+
"data-align": (_a2 = column.align) != null ? _a2 : "left",
|
|
154
|
+
"data-vertical-align": (_b2 = column.verticalAlign) != null ? _b2 : "top",
|
|
150
155
|
"data-divider": column.divider,
|
|
151
156
|
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
152
157
|
"div",
|
|
153
158
|
{
|
|
154
|
-
className: styles__default.default.cellContent,
|
|
155
|
-
"data-align": (
|
|
156
|
-
"data-vertical-align": (
|
|
159
|
+
className: table_classes.cx(styles__default.default.cellContent, showRowActions && styles__default.default.cellContentWithActions),
|
|
160
|
+
"data-align": (_c = column.align) != null ? _c : "left",
|
|
161
|
+
"data-vertical-align": (_d = column.verticalAlign) != null ? _d : "top",
|
|
157
162
|
children: [
|
|
158
163
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
159
164
|
"div",
|
|
@@ -162,11 +167,14 @@ function TableRow({
|
|
|
162
167
|
children: cellValue
|
|
163
168
|
}
|
|
164
169
|
),
|
|
165
|
-
|
|
166
|
-
|
|
170
|
+
showRowActions ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
171
|
+
RowActions,
|
|
167
172
|
{
|
|
168
173
|
rowId,
|
|
169
174
|
items: contextMenuItems,
|
|
175
|
+
expandable: canExpand && viewMode !== "wrapped",
|
|
176
|
+
isExpanded,
|
|
177
|
+
onToggleExpand: onToggleRowExpand ? () => onToggleRowExpand(rowId) : void 0,
|
|
170
178
|
onRowClick: onRowClick ? () => onRowClick(row) : void 0
|
|
171
179
|
}
|
|
172
180
|
) : null
|
|
@@ -181,12 +189,23 @@ function TableRow({
|
|
|
181
189
|
}
|
|
182
190
|
);
|
|
183
191
|
}
|
|
184
|
-
function
|
|
192
|
+
function RowActions({
|
|
185
193
|
rowId,
|
|
186
194
|
items,
|
|
195
|
+
expandable,
|
|
196
|
+
isExpanded,
|
|
197
|
+
onToggleExpand,
|
|
187
198
|
onRowClick
|
|
188
199
|
}) {
|
|
189
200
|
const toggleRef = react.useRef(null);
|
|
201
|
+
const expandItem = expandable ? {
|
|
202
|
+
label: "Udvid r\xE6kke",
|
|
203
|
+
active: isExpanded,
|
|
204
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpDown, { size: 16 }),
|
|
205
|
+
onClick: () => onToggleExpand == null ? void 0 : onToggleExpand()
|
|
206
|
+
} : null;
|
|
207
|
+
const menuItems = [...expandItem ? [expandItem] : [], ...items != null ? items : []];
|
|
208
|
+
const hasMenu = Boolean(menuItems.length);
|
|
190
209
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
191
210
|
"div",
|
|
192
211
|
{
|
|
@@ -194,15 +213,17 @@ function RowContextMenu({
|
|
|
194
213
|
"data-row-context-menu": "true",
|
|
195
214
|
onClick: (e) => {
|
|
196
215
|
var _a;
|
|
216
|
+
if (!hasMenu) return;
|
|
197
217
|
e.stopPropagation();
|
|
198
218
|
(_a = toggleRef.current) == null ? void 0 : _a.call(toggleRef, e);
|
|
199
219
|
},
|
|
200
220
|
onContextMenu: (e) => {
|
|
221
|
+
if (!hasMenu) return;
|
|
201
222
|
e.preventDefault();
|
|
202
223
|
e.stopPropagation();
|
|
203
224
|
onRowClick == null ? void 0 : onRowClick();
|
|
204
225
|
},
|
|
205
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
226
|
+
children: hasMenu ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
206
227
|
Popover.Popover,
|
|
207
228
|
{
|
|
208
229
|
matchTriggerWidth: false,
|
|
@@ -229,7 +250,7 @@ function RowContextMenu({
|
|
|
229
250
|
}
|
|
230
251
|
);
|
|
231
252
|
},
|
|
232
|
-
children: (close) => /* @__PURE__ */ jsxRuntime.jsx(Menu.Menu, { children:
|
|
253
|
+
children: (close) => /* @__PURE__ */ jsxRuntime.jsx(Menu.Menu, { children: menuItems.map(
|
|
233
254
|
(item, index) => item.type === "header" ? /* @__PURE__ */ jsxRuntime.jsx(Menu.Menu.Header, { children: item.label }, index) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
234
255
|
Menu.Menu.Item,
|
|
235
256
|
{
|
|
@@ -258,7 +279,7 @@ function RowContextMenu({
|
|
|
258
279
|
)
|
|
259
280
|
) })
|
|
260
281
|
}
|
|
261
|
-
)
|
|
282
|
+
) : null
|
|
262
283
|
}
|
|
263
284
|
);
|
|
264
285
|
}
|
|
@@ -17,9 +17,12 @@ type Props<T extends Record<string, any>> = {
|
|
|
17
17
|
open: () => void;
|
|
18
18
|
}) => TableContextMenuItem[];
|
|
19
19
|
showContextMenuOnHover: boolean;
|
|
20
|
+
expandableRows?: boolean;
|
|
21
|
+
expandedRows?: Set<number | string>;
|
|
20
22
|
onRowClick?: (row: T) => void;
|
|
21
23
|
onRowMouseEnter?: (row: T) => void;
|
|
22
24
|
onRowSelect?: (rowId: number | string, isSelected: boolean) => void;
|
|
25
|
+
onToggleRowExpand?: (rowId: number | string) => void;
|
|
23
26
|
};
|
|
24
|
-
export declare function TableRow<T extends Record<string, any>>({ row, rowId, columns, selectedRows, hasSelection, selectionMode, selectionInputName, viewMode, getRowSeverity, getContextMenuItems, showContextMenuOnHover, onRowClick, onRowMouseEnter, onRowSelect, }: Props<T>): React.ReactNode;
|
|
27
|
+
export declare function TableRow<T extends Record<string, any>>({ row, rowId, columns, selectedRows, hasSelection, selectionMode, selectionInputName, viewMode, getRowSeverity, getContextMenuItems, showContextMenuOnHover, expandableRows, expandedRows, onRowClick, onRowMouseEnter, onRowSelect, onToggleRowExpand, }: Props<T>): React.ReactNode;
|
|
25
28
|
export {};
|