@navikt/ds-react 8.10.6 → 8.11.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/cjs/data/drag-and-drop/root/DragAndDropRoot.d.ts +1 -1
- package/cjs/data/drag-and-drop/root/DragAndDropRoot.js +2 -2
- package/cjs/data/drag-and-drop/root/DragAndDropRoot.js.map +1 -1
- package/cjs/data/stories/Data.test-data.d.ts +2 -2
- package/cjs/data/stories/Data.test-data.js +37 -42
- package/cjs/data/stories/Data.test-data.js.map +1 -1
- package/cjs/data/table/base-cell/DataTableBaseCell.d.ts +4 -4
- package/cjs/data/table/base-cell/DataTableBaseCell.js +2 -2
- package/cjs/data/table/base-cell/DataTableBaseCell.js.map +1 -1
- package/cjs/data/table/column-header/DataTableColumnHeader.d.ts +3 -15
- package/cjs/data/table/column-header/DataTableColumnHeader.js +8 -5
- package/cjs/data/table/column-header/DataTableColumnHeader.js.map +1 -1
- package/cjs/data/table/column-header/useTableColumnResize.d.ts +2 -2
- package/cjs/data/table/column-header/useTableColumnResize.js +10 -10
- package/cjs/data/table/column-header/useTableColumnResize.js.map +1 -1
- package/cjs/data/table/helpers/collectTableRowEntries.d.ts +1 -1
- package/cjs/data/table/helpers/selection/getMultipleSelectProps.d.ts +6 -5
- package/cjs/data/table/helpers/selection/getMultipleSelectProps.js +6 -2
- package/cjs/data/table/helpers/selection/getMultipleSelectProps.js.map +1 -1
- package/cjs/data/table/helpers/selection/getSingleSelectProps.d.ts +3 -3
- package/cjs/data/table/helpers/selection/getSingleSelectProps.js +1 -1
- package/cjs/data/table/helpers/selection/getSingleSelectProps.js.map +1 -1
- package/cjs/data/table/helpers/selection/selection.types.d.ts +19 -27
- package/cjs/data/table/helpers/selection/selection.utils.d.ts +1 -1
- package/cjs/data/table/hooks/useColumnOptions.d.ts +3 -3
- package/cjs/data/table/hooks/useColumnOptions.js +2 -2
- package/cjs/data/table/hooks/useColumnOptions.js.map +1 -1
- package/cjs/data/table/hooks/useTableDetailsPanel.d.ts +8 -9
- package/cjs/data/table/hooks/useTableDetailsPanel.js.map +1 -1
- package/cjs/data/table/hooks/useTableItems.d.ts +10 -11
- package/cjs/data/table/hooks/useTableItems.js +11 -3
- package/cjs/data/table/hooks/useTableItems.js.map +1 -1
- package/cjs/data/table/hooks/useTableSelection.d.ts +2 -1
- package/cjs/data/table/hooks/useTableSelection.js +46 -29
- package/cjs/data/table/hooks/useTableSelection.js.map +1 -1
- package/cjs/data/table/hooks/useTableSort.d.ts +13 -7
- package/cjs/data/table/hooks/useTableSort.js +8 -9
- package/cjs/data/table/hooks/useTableSort.js.map +1 -1
- package/cjs/data/table/index.d.ts +1 -1
- package/cjs/data/table/index.js +3 -23
- package/cjs/data/table/index.js.map +1 -1
- package/cjs/data/table/root/{DataTable.types.d.ts → DataGridTable.types.d.ts} +16 -26
- package/cjs/data/table/root/DataGridTable.types.js +3 -0
- package/cjs/data/table/root/DataGridTable.types.js.map +1 -0
- package/cjs/data/table/root/DataGridTableRoot.d.ts +104 -0
- package/cjs/data/table/root/{DataTableRoot.js → DataGridTableRoot.js} +57 -37
- package/cjs/data/table/root/DataGridTableRoot.js.map +1 -0
- package/cjs/data/table/root/DataTableRoot.context.d.ts +6 -2
- package/cjs/data/table/root/DataTableRoot.context.js.map +1 -1
- package/cjs/data/table/tbody/DataTableTbody.js +3 -3
- package/cjs/data/table/tbody/DataTableTbody.js.map +1 -1
- package/cjs/data/table/tr/DataTableTr.d.ts +3 -3
- package/cjs/data/table/tr/DataTableTr.js +44 -20
- package/cjs/data/table/tr/DataTableTr.js.map +1 -1
- package/cjs/data/token-filter/TokenFilter.d.ts +0 -6
- package/cjs/data/token-filter/TokenFilter.js +1 -1
- package/cjs/data-grid/index.d.ts +2 -0
- package/cjs/data-grid/index.js +9 -0
- package/cjs/data-grid/index.js.map +1 -0
- package/cjs/data-grid/root/DataGrid.types.d.ts +35 -0
- package/cjs/{data/table/root/DataTable.types.js → data-grid/root/DataGrid.types.js} +1 -1
- package/cjs/data-grid/root/DataGrid.types.js.map +1 -0
- package/cjs/data-grid/root/DataGridRoot.context.d.ts +16 -0
- package/cjs/{data/data-grid → data-grid}/root/DataGridRoot.context.js +1 -1
- package/cjs/data-grid/root/DataGridRoot.context.js.map +1 -0
- package/cjs/data-grid/root/DataGridRoot.d.ts +89 -0
- package/cjs/{data/data-grid → data-grid}/root/DataGridRoot.js +33 -8
- package/cjs/data-grid/root/DataGridRoot.js.map +1 -0
- package/cjs/preview.d.ts +1 -0
- package/cjs/{data/data-grid/index.js → preview.js} +3 -3
- package/cjs/preview.js.map +1 -0
- package/cjs/table/ColumnHeader.js.map +1 -1
- package/esm/data/drag-and-drop/root/DragAndDropRoot.d.ts +1 -1
- package/esm/data/drag-and-drop/root/DragAndDropRoot.js +2 -2
- package/esm/data/drag-and-drop/root/DragAndDropRoot.js.map +1 -1
- package/esm/data/stories/Data.test-data.d.ts +2 -2
- package/esm/data/stories/Data.test-data.js +37 -42
- package/esm/data/stories/Data.test-data.js.map +1 -1
- package/esm/data/table/base-cell/DataTableBaseCell.d.ts +4 -4
- package/esm/data/table/base-cell/DataTableBaseCell.js +2 -2
- package/esm/data/table/base-cell/DataTableBaseCell.js.map +1 -1
- package/esm/data/table/column-header/DataTableColumnHeader.d.ts +3 -15
- package/esm/data/table/column-header/DataTableColumnHeader.js +8 -5
- package/esm/data/table/column-header/DataTableColumnHeader.js.map +1 -1
- package/esm/data/table/column-header/useTableColumnResize.d.ts +2 -2
- package/esm/data/table/column-header/useTableColumnResize.js +10 -10
- package/esm/data/table/column-header/useTableColumnResize.js.map +1 -1
- package/esm/data/table/helpers/collectTableRowEntries.d.ts +1 -1
- package/esm/data/table/helpers/selection/getMultipleSelectProps.d.ts +6 -5
- package/esm/data/table/helpers/selection/getMultipleSelectProps.js +6 -2
- package/esm/data/table/helpers/selection/getMultipleSelectProps.js.map +1 -1
- package/esm/data/table/helpers/selection/getSingleSelectProps.d.ts +3 -3
- package/esm/data/table/helpers/selection/getSingleSelectProps.js +1 -1
- package/esm/data/table/helpers/selection/getSingleSelectProps.js.map +1 -1
- package/esm/data/table/helpers/selection/selection.types.d.ts +19 -27
- package/esm/data/table/helpers/selection/selection.utils.d.ts +1 -1
- package/esm/data/table/hooks/useColumnOptions.d.ts +3 -3
- package/esm/data/table/hooks/useColumnOptions.js +2 -2
- package/esm/data/table/hooks/useColumnOptions.js.map +1 -1
- package/esm/data/table/hooks/useTableDetailsPanel.d.ts +8 -9
- package/esm/data/table/hooks/useTableDetailsPanel.js.map +1 -1
- package/esm/data/table/hooks/useTableItems.d.ts +10 -11
- package/esm/data/table/hooks/useTableItems.js +11 -3
- package/esm/data/table/hooks/useTableItems.js.map +1 -1
- package/esm/data/table/hooks/useTableSelection.d.ts +2 -1
- package/esm/data/table/hooks/useTableSelection.js +46 -29
- package/esm/data/table/hooks/useTableSelection.js.map +1 -1
- package/esm/data/table/hooks/useTableSort.d.ts +13 -7
- package/esm/data/table/hooks/useTableSort.js +9 -10
- package/esm/data/table/hooks/useTableSort.js.map +1 -1
- package/esm/data/table/index.d.ts +1 -1
- package/esm/data/table/index.js +1 -21
- package/esm/data/table/index.js.map +1 -1
- package/esm/data/table/root/{DataTable.types.d.ts → DataGridTable.types.d.ts} +16 -26
- package/esm/data/table/root/DataGridTable.types.js +2 -0
- package/esm/data/table/root/DataGridTable.types.js.map +1 -0
- package/esm/data/table/root/DataGridTableRoot.d.ts +104 -0
- package/esm/data/table/root/{DataTableRoot.js → DataGridTableRoot.js} +59 -38
- package/esm/data/table/root/DataGridTableRoot.js.map +1 -0
- package/esm/data/table/root/DataTableRoot.context.d.ts +6 -2
- package/esm/data/table/root/DataTableRoot.context.js.map +1 -1
- package/esm/data/table/tbody/DataTableTbody.js +3 -3
- package/esm/data/table/tbody/DataTableTbody.js.map +1 -1
- package/esm/data/table/tr/DataTableTr.d.ts +3 -3
- package/esm/data/table/tr/DataTableTr.js +44 -20
- package/esm/data/table/tr/DataTableTr.js.map +1 -1
- package/esm/data/token-filter/TokenFilter.d.ts +0 -6
- package/esm/data/token-filter/TokenFilter.js +1 -1
- package/esm/data-grid/index.d.ts +2 -0
- package/esm/data-grid/index.js +4 -0
- package/esm/data-grid/index.js.map +1 -0
- package/esm/data-grid/root/DataGrid.types.d.ts +35 -0
- package/esm/data-grid/root/DataGrid.types.js +2 -0
- package/esm/data-grid/root/DataGrid.types.js.map +1 -0
- package/esm/data-grid/root/DataGridRoot.context.d.ts +16 -0
- package/esm/{data/data-grid → data-grid}/root/DataGridRoot.context.js +1 -1
- package/esm/data-grid/root/DataGridRoot.context.js.map +1 -0
- package/esm/data-grid/root/DataGridRoot.d.ts +89 -0
- package/esm/data-grid/root/DataGridRoot.js +57 -0
- package/esm/data-grid/root/DataGridRoot.js.map +1 -0
- package/esm/preview.d.ts +1 -0
- package/esm/preview.js +3 -0
- package/esm/preview.js.map +1 -0
- package/esm/table/ColumnHeader.js.map +1 -1
- package/package.json +23 -3
- package/src/data/drag-and-drop/root/DragAndDropRoot.tsx +3 -3
- package/src/data/stories/Data.test-data.tsx +53 -51
- package/src/data/table/base-cell/DataTableBaseCell.tsx +6 -6
- package/src/data/table/column-header/DataTableColumnHeader.tsx +17 -20
- package/src/data/table/column-header/useTableColumnResize.ts +14 -14
- package/src/data/table/helpers/collectTableRowEntries.ts +1 -1
- package/src/data/table/helpers/selection/getMultipleSelectProps.ts +11 -5
- package/src/data/table/helpers/selection/getSingleSelectProps.ts +4 -4
- package/src/data/table/helpers/selection/selection.types.ts +19 -29
- package/src/data/table/helpers/selection/selection.utils.test.ts +1 -1
- package/src/data/table/helpers/selection/selection.utils.ts +1 -1
- package/src/data/table/hooks/__tests__/useTableItems.test.ts +1 -1
- package/src/data/table/hooks/useColumnOptions.ts +5 -5
- package/src/data/table/hooks/useTableDetailsPanel.tsx +14 -18
- package/src/data/table/hooks/useTableItems.ts +37 -23
- package/src/data/table/hooks/useTableSelection.ts +62 -45
- package/src/data/table/hooks/useTableSort.ts +29 -17
- package/src/data/table/index.tsx +4 -21
- package/src/data/table/root/{DataTable.types.ts → DataGridTable.types.ts} +17 -30
- package/src/data/table/root/{DataTableRoot.tsx → DataGridTableRoot.tsx} +196 -143
- package/src/data/table/root/DataTableRoot.context.ts +10 -8
- package/src/data/table/sub-row-toggle/DataTableSubRowToggle.tsx +1 -1
- package/src/data/table/tbody/DataTableTbody.tsx +3 -3
- package/src/data/table/tr/DataTableTr.tsx +51 -16
- package/src/data/token-filter/TokenFilter.tsx +1 -1
- package/src/data-grid/index.ts +3 -0
- package/src/data-grid/root/DataGrid.types.ts +36 -0
- package/src/data-grid/root/DataGridRoot.context.ts +21 -0
- package/src/data-grid/root/DataGridRoot.tsx +152 -0
- package/src/preview.ts +2 -0
- package/src/table/ColumnHeader.tsx +1 -0
- package/cjs/data/data-grid/index.d.ts +0 -2
- package/cjs/data/data-grid/index.js.map +0 -1
- package/cjs/data/data-grid/root/DataGridRoot.context.d.ts +0 -11
- package/cjs/data/data-grid/root/DataGridRoot.context.js.map +0 -1
- package/cjs/data/data-grid/root/DataGridRoot.d.ts +0 -38
- package/cjs/data/data-grid/root/DataGridRoot.js.map +0 -1
- package/cjs/data/table/root/DataTable.types.js.map +0 -1
- package/cjs/data/table/root/DataTableRoot.d.ts +0 -118
- package/cjs/data/table/root/DataTableRoot.js.map +0 -1
- package/cjs/data/table/root/DataTableRoot.legacy.d.ts +0 -172
- package/cjs/data/table/root/DataTableRoot.legacy.js +0 -118
- package/cjs/data/table/root/DataTableRoot.legacy.js.map +0 -1
- package/esm/data/data-grid/index.d.ts +0 -2
- package/esm/data/data-grid/index.js +0 -3
- package/esm/data/data-grid/index.js.map +0 -1
- package/esm/data/data-grid/root/DataGridRoot.context.d.ts +0 -11
- package/esm/data/data-grid/root/DataGridRoot.context.js.map +0 -1
- package/esm/data/data-grid/root/DataGridRoot.d.ts +0 -38
- package/esm/data/data-grid/root/DataGridRoot.js +0 -32
- package/esm/data/data-grid/root/DataGridRoot.js.map +0 -1
- package/esm/data/table/root/DataTable.types.js +0 -2
- package/esm/data/table/root/DataTable.types.js.map +0 -1
- package/esm/data/table/root/DataTableRoot.d.ts +0 -118
- package/esm/data/table/root/DataTableRoot.js.map +0 -1
- package/esm/data/table/root/DataTableRoot.legacy.d.ts +0 -172
- package/esm/data/table/root/DataTableRoot.legacy.js +0 -73
- package/esm/data/table/root/DataTableRoot.legacy.js.map +0 -1
- package/src/data/data-grid/index.ts +0 -3
- package/src/data/data-grid/root/DataGridRoot.context.ts +0 -16
- package/src/data/data-grid/root/DataGridRoot.tsx +0 -71
- package/src/data/table/Readme.md +0 -11
- package/src/data/table/agent-component-review.md +0 -175
- package/src/data/table/root/DataTableRoot.legacy.tsx +0 -305
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MenuElipsisVerticalIcon } from "@navikt/aksel-icons";
|
|
3
|
+
import { ActionMenu } from "../../action-menu";
|
|
3
4
|
import { Button } from "../../button";
|
|
5
|
+
import { HStack } from "../../primitives/stack";
|
|
4
6
|
import { Tag } from "../../tag";
|
|
5
|
-
import type { ColumnDefinitions } from "../table/root/
|
|
7
|
+
import type { ColumnDefinitions } from "../table/root/DataGridTable.types";
|
|
6
8
|
|
|
7
9
|
type SWData = {
|
|
8
10
|
id: number;
|
|
@@ -22,47 +24,48 @@ type SWData = {
|
|
|
22
24
|
const columnDef_TEST_DATA: ColumnDefinitions<SWData> = [
|
|
23
25
|
{
|
|
24
26
|
id: "id",
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
header: "Id",
|
|
28
|
+
bodyCell: (row) => row.id,
|
|
27
29
|
width: { autoResizeOnce: true },
|
|
28
30
|
},
|
|
29
31
|
{
|
|
30
|
-
|
|
32
|
+
header: "Name",
|
|
31
33
|
id: "name",
|
|
32
|
-
|
|
34
|
+
isRowHeader: true,
|
|
35
|
+
bodyCell: (row) =>
|
|
33
36
|
`${row.name} ${row?.nestedRows?.length > 0 ? `(${row?.nestedRows?.length})` : ""}`,
|
|
34
37
|
},
|
|
35
38
|
{
|
|
36
|
-
|
|
39
|
+
header: "National id",
|
|
37
40
|
id: "nationalId",
|
|
38
|
-
|
|
41
|
+
bodyCell: (row) => row.nationalId,
|
|
39
42
|
align: "right",
|
|
40
43
|
width: { autoResizeOnce: true },
|
|
41
44
|
},
|
|
42
45
|
{
|
|
43
|
-
|
|
46
|
+
header: "Day job",
|
|
44
47
|
id: "dayJob",
|
|
45
|
-
|
|
48
|
+
bodyCell: (row) => row.dayJob,
|
|
46
49
|
},
|
|
47
50
|
{
|
|
48
|
-
|
|
51
|
+
header: "Supervisor",
|
|
49
52
|
id: "supervisor",
|
|
50
|
-
|
|
53
|
+
bodyCell: (row) => row.supervisor,
|
|
51
54
|
},
|
|
52
55
|
{
|
|
53
|
-
|
|
56
|
+
header: "Date received",
|
|
54
57
|
id: "dateReceived",
|
|
55
|
-
|
|
58
|
+
bodyCell: (row) => row.dateReceived,
|
|
56
59
|
},
|
|
57
60
|
{
|
|
58
|
-
|
|
61
|
+
header: "Message",
|
|
59
62
|
id: "message",
|
|
60
|
-
|
|
63
|
+
bodyCell: (row) => row.message,
|
|
61
64
|
},
|
|
62
65
|
{
|
|
63
|
-
|
|
66
|
+
header: "Age",
|
|
64
67
|
id: "age",
|
|
65
|
-
|
|
68
|
+
bodyCell: (row) => row.age,
|
|
66
69
|
align: "right",
|
|
67
70
|
width: { autoResizeOnce: true },
|
|
68
71
|
|
|
@@ -77,9 +80,9 @@ const columnDef_TEST_DATA: ColumnDefinitions<SWData> = [
|
|
|
77
80
|
}, */
|
|
78
81
|
},
|
|
79
82
|
{
|
|
80
|
-
|
|
83
|
+
header: "Force sensitive",
|
|
81
84
|
id: "forceSensitive",
|
|
82
|
-
|
|
85
|
+
bodyCell: (row) => (
|
|
83
86
|
<Tag
|
|
84
87
|
size="small"
|
|
85
88
|
variant="moderate"
|
|
@@ -90,41 +93,29 @@ const columnDef_TEST_DATA: ColumnDefinitions<SWData> = [
|
|
|
90
93
|
align: "center",
|
|
91
94
|
},
|
|
92
95
|
{
|
|
93
|
-
|
|
96
|
+
header: "Home system",
|
|
94
97
|
id: "homeSystem",
|
|
95
|
-
|
|
98
|
+
bodyCell: (row) => row.homeSystem,
|
|
96
99
|
},
|
|
97
100
|
{
|
|
98
|
-
|
|
101
|
+
header: "Skills",
|
|
99
102
|
id: "skills",
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
<Tag key={skill} size="small" variant="moderate">
|
|
103
|
-
{skill}
|
|
104
|
-
</Tag>
|
|
105
|
-
)),
|
|
106
|
-
/* cell: (row) => (
|
|
107
|
-
<Bleed marginBlock="space-4" marginInline="space-4">
|
|
103
|
+
bodyCell: (row) => (
|
|
104
|
+
<HStack gap="space-8" wrap={false}>
|
|
108
105
|
{row.skills.map((skill) => (
|
|
109
|
-
<
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
padding="space-4"
|
|
113
|
-
>
|
|
114
|
-
<Tag size="small" variant="moderate">
|
|
115
|
-
{skill}
|
|
116
|
-
</Tag>
|
|
117
|
-
</Box>
|
|
106
|
+
<Tag key={skill} size="small" variant="moderate">
|
|
107
|
+
{skill}
|
|
108
|
+
</Tag>
|
|
118
109
|
))}
|
|
119
|
-
</
|
|
120
|
-
),
|
|
110
|
+
</HStack>
|
|
111
|
+
),
|
|
121
112
|
},
|
|
122
113
|
{
|
|
123
|
-
|
|
114
|
+
header: "Actions",
|
|
124
115
|
id: "actions",
|
|
125
116
|
width: { autoResizeOnce: true },
|
|
126
|
-
|
|
127
|
-
|
|
117
|
+
bodyCell: (row) => (
|
|
118
|
+
<HStack gap="space-8">
|
|
128
119
|
<Button
|
|
129
120
|
size="xsmall"
|
|
130
121
|
variant="secondary"
|
|
@@ -133,13 +124,24 @@ const columnDef_TEST_DATA: ColumnDefinitions<SWData> = [
|
|
|
133
124
|
>
|
|
134
125
|
Edit
|
|
135
126
|
</Button>
|
|
136
|
-
<
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
127
|
+
<ActionMenu>
|
|
128
|
+
<ActionMenu.Trigger>
|
|
129
|
+
<Button
|
|
130
|
+
size="xsmall"
|
|
131
|
+
variant="secondary"
|
|
132
|
+
data-color="neutral"
|
|
133
|
+
icon={<MenuElipsisVerticalIcon title="Menu" />}
|
|
134
|
+
/>
|
|
135
|
+
</ActionMenu.Trigger>
|
|
136
|
+
<ActionMenu.Content>
|
|
137
|
+
<ActionMenu.Group label="Actions">
|
|
138
|
+
<ActionMenu.Item>Delete</ActionMenu.Item>
|
|
139
|
+
<ActionMenu.Item>Assign</ActionMenu.Item>
|
|
140
|
+
<ActionMenu.Item>Change status</ActionMenu.Item>
|
|
141
|
+
</ActionMenu.Group>
|
|
142
|
+
</ActionMenu.Content>
|
|
143
|
+
</ActionMenu>
|
|
144
|
+
</HStack>
|
|
143
145
|
),
|
|
144
146
|
},
|
|
145
147
|
];
|
|
@@ -7,12 +7,12 @@ interface DataTableBaseCellProps extends Omit<
|
|
|
7
7
|
"width"
|
|
8
8
|
> {
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Text alignment inside cell.
|
|
11
11
|
*
|
|
12
12
|
* Quantitative figures like amounts and percentages should be right‑aligned (but not phone numbers, postal codes etc.)
|
|
13
13
|
* @default "left"
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
align?: "left" | "center" | "right";
|
|
16
16
|
/**
|
|
17
17
|
* Internal cell type that controls padding, alignment, row-click prevention, and resize behavior.
|
|
18
18
|
* - `"action"`: Centers content, removes cell padding, prevents row click, and disables column resize.
|
|
@@ -20,7 +20,7 @@ interface DataTableBaseCellProps extends Omit<
|
|
|
20
20
|
*/
|
|
21
21
|
cellType?: "action";
|
|
22
22
|
/**
|
|
23
|
-
* When true, clicking this cell will not trigger `
|
|
23
|
+
* When true, clicking this cell will not trigger `onRowAction` on the row.
|
|
24
24
|
* Useful for cells that contain their own interactive content or actions
|
|
25
25
|
* that should be independent of row-level click handling.
|
|
26
26
|
*/
|
|
@@ -28,7 +28,7 @@ interface DataTableBaseCellProps extends Omit<
|
|
|
28
28
|
/**
|
|
29
29
|
* Sets a max-width on the content wrapper div inside the cell.
|
|
30
30
|
* This is only needed when using `layout="auto"` together with
|
|
31
|
-
* `truncateContent` on `<
|
|
31
|
+
* `truncateContent` on `<DataGrid.Table>` and you want the cell to be truncated.
|
|
32
32
|
*/
|
|
33
33
|
contentMaxWidth?: number | string;
|
|
34
34
|
/**
|
|
@@ -58,7 +58,7 @@ const DataTableBaseCell = forwardRef<
|
|
|
58
58
|
children,
|
|
59
59
|
as: Component,
|
|
60
60
|
beforeContent,
|
|
61
|
-
|
|
61
|
+
align = "left",
|
|
62
62
|
cellType,
|
|
63
63
|
preventRowClick,
|
|
64
64
|
contentMaxWidth,
|
|
@@ -77,7 +77,7 @@ const DataTableBaseCell = forwardRef<
|
|
|
77
77
|
ref={forwardedRef}
|
|
78
78
|
className={cl("aksel-data-table__cell", className)}
|
|
79
79
|
tabIndex={withKeyboardNav ? -1 : undefined}
|
|
80
|
-
data-align={
|
|
80
|
+
data-align={align}
|
|
81
81
|
data-cell-type={cellType || undefined}
|
|
82
82
|
data-prevent-row-click={
|
|
83
83
|
preventRowClick || cellType === "action" || undefined
|
|
@@ -6,21 +6,21 @@ import {
|
|
|
6
6
|
SortDownIcon,
|
|
7
7
|
SortUpIcon,
|
|
8
8
|
} from "@navikt/aksel-icons";
|
|
9
|
+
import { useDataGridContext } from "../../../data-grid/root/DataGridRoot.context";
|
|
9
10
|
import { cl } from "../../../utils/helpers";
|
|
10
11
|
import { useMergeRefs } from "../../../utils/hooks";
|
|
11
12
|
import {
|
|
12
13
|
DataTableBaseCell,
|
|
13
14
|
type DataTableBaseCellProps,
|
|
14
15
|
} from "../base-cell/DataTableBaseCell";
|
|
15
|
-
import type { SortDirection } from "../root/DataTable.types";
|
|
16
16
|
import { useDataTableContext } from "../root/DataTableRoot.context";
|
|
17
17
|
import { type ResizeProps, useTableColumnResize } from "./useTableColumnResize";
|
|
18
18
|
|
|
19
19
|
interface DataTableColumnHeaderProps extends DataTableBaseCellProps {
|
|
20
20
|
/**
|
|
21
|
-
* Unique identifier for the column.
|
|
21
|
+
* Unique identifier for the column. Used when sorting to identify which column is being sorted.
|
|
22
22
|
*/
|
|
23
|
-
id
|
|
23
|
+
id: string;
|
|
24
24
|
/**
|
|
25
25
|
* Accessible name of the column.
|
|
26
26
|
*/
|
|
@@ -29,18 +29,7 @@ interface DataTableColumnHeaderProps extends DataTableBaseCellProps {
|
|
|
29
29
|
* Makes the column sortable by clicking on the header.
|
|
30
30
|
* The entire header cell content becomes a clickable button when true.
|
|
31
31
|
*/
|
|
32
|
-
sortable?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Current sort direction. Only relevant when `sortable` is true.
|
|
35
|
-
* Uses values matching the `aria-sort` attribute directly. // TODO: What does this mean? (Can we just remove it?)
|
|
36
|
-
* @default "none"
|
|
37
|
-
*/
|
|
38
|
-
sortDirection?: SortDirection; // TODO Not in use???
|
|
39
|
-
/**
|
|
40
|
-
* Called when the user clicks the header. Only relevant when `sortable` is true.
|
|
41
|
-
* The consumer is responsible for determining and setting the next sort state. // TODO: We don't use the term "consumer" in JSDoc anywhere else
|
|
42
|
-
*/
|
|
43
|
-
onSortClick?: (event: React.MouseEvent<HTMLElement>) => void; // TODO Not in use???
|
|
32
|
+
sortable?: boolean;
|
|
44
33
|
/**
|
|
45
34
|
* Object with props related to column width and resizing. Summary:
|
|
46
35
|
*
|
|
@@ -49,7 +38,7 @@ interface DataTableColumnHeaderProps extends DataTableBaseCellProps {
|
|
|
49
38
|
* - `resizeMin?: number` - Minimum width of the column when resizing.
|
|
50
39
|
* - `resizeMax?: number` - Maximum width of the column when resizing.
|
|
51
40
|
* - `value?: number | string` - Controlled width of the column.
|
|
52
|
-
* - `
|
|
41
|
+
* - `defaultValue?: number | string` - Initial width of the column.
|
|
53
42
|
* - `onChange?: (width: number) => void` - Called when the column width changes.
|
|
54
43
|
*
|
|
55
44
|
* See individual props for details and defaults.
|
|
@@ -57,7 +46,7 @@ interface DataTableColumnHeaderProps extends DataTableBaseCellProps {
|
|
|
57
46
|
width?: ResizeProps;
|
|
58
47
|
}
|
|
59
48
|
|
|
60
|
-
const SORT_ICON: Record<
|
|
49
|
+
const SORT_ICON: Record<"asc" | "desc" | "none", React.ElementType> = {
|
|
61
50
|
asc: SortUpIcon,
|
|
62
51
|
desc: SortDownIcon,
|
|
63
52
|
none: ArrowsUpDownIcon,
|
|
@@ -86,6 +75,7 @@ const DataTableColumnHeader = forwardRef<
|
|
|
86
75
|
},
|
|
87
76
|
forwardedRef,
|
|
88
77
|
) => {
|
|
78
|
+
const { isLoading } = useDataGridContext();
|
|
89
79
|
const thRef = useRef<HTMLTableCellElement>(null);
|
|
90
80
|
const mergedRef = useMergeRefs(forwardedRef, thRef);
|
|
91
81
|
const { sortingState } = useDataTableContext();
|
|
@@ -106,6 +96,8 @@ const DataTableColumnHeader = forwardRef<
|
|
|
106
96
|
|
|
107
97
|
const SortIcon = canSort ? SORT_ICON[sortDirection] : null;
|
|
108
98
|
|
|
99
|
+
const contentId = `th-content-${id.replace(/\s/g, "-")}`;
|
|
100
|
+
|
|
109
101
|
return (
|
|
110
102
|
<DataTableBaseCell
|
|
111
103
|
as="th"
|
|
@@ -116,14 +108,18 @@ const DataTableColumnHeader = forwardRef<
|
|
|
116
108
|
style={{ ...style, width: resizeResult.width }}
|
|
117
109
|
aria-sort={canSort ? getAriaSort(sortDirection) : undefined}
|
|
118
110
|
cellType={cellType}
|
|
111
|
+
aria-labelledby={contentId} // Avoids VO announcing "Endre bredde" when navigating horizontally in tbody
|
|
119
112
|
>
|
|
120
113
|
{canSort ? (
|
|
121
114
|
<button
|
|
122
115
|
type="button"
|
|
123
116
|
className="aksel-data-table__th-sort-button"
|
|
124
117
|
onClick={(event) => onSortClick(id, event)}
|
|
118
|
+
disabled={isLoading}
|
|
125
119
|
>
|
|
126
|
-
<div className="aksel-data-table__th-content">
|
|
120
|
+
<div id={contentId} className="aksel-data-table__th-content">
|
|
121
|
+
{children}
|
|
122
|
+
</div>
|
|
127
123
|
{SortIcon && (
|
|
128
124
|
<SortIcon
|
|
129
125
|
aria-hidden
|
|
@@ -135,6 +131,7 @@ const DataTableColumnHeader = forwardRef<
|
|
|
135
131
|
</button>
|
|
136
132
|
) : (
|
|
137
133
|
<div
|
|
134
|
+
id={contentId}
|
|
138
135
|
className={cl({
|
|
139
136
|
"aksel-data-table__th-content": cellType !== "action",
|
|
140
137
|
})}
|
|
@@ -164,7 +161,7 @@ const DataTableColumnHeader = forwardRef<
|
|
|
164
161
|
typeof resizeResult.width === "number" &&
|
|
165
162
|
resizeResult.isResizingWithKeyboard
|
|
166
163
|
? resizeResult.width.toString()
|
|
167
|
-
: "" // Needs to be blank when not in keyboard resizing mode to avoid NVDA announcing the value as part of the column heading
|
|
164
|
+
: " " // Needs to be blank when not in keyboard resizing mode to avoid NVDA announcing the value as part of the column heading
|
|
168
165
|
} // Need either this or aria-valuemax to get SR (at least NVDA) to announce the value
|
|
169
166
|
>
|
|
170
167
|
{resizeResult.isResizingWithKeyboard && (
|
|
@@ -185,7 +182,7 @@ const DataTableColumnHeader = forwardRef<
|
|
|
185
182
|
);
|
|
186
183
|
|
|
187
184
|
function getAriaSort(
|
|
188
|
-
sortDirection:
|
|
185
|
+
sortDirection: "asc" | "desc" | "none" | undefined,
|
|
189
186
|
): "ascending" | "descending" | "none" | undefined {
|
|
190
187
|
if (sortDirection === "asc") return "ascending";
|
|
191
188
|
if (sortDirection === "desc") return "descending";
|
|
@@ -55,7 +55,7 @@ type ResizeProps = {
|
|
|
55
55
|
* **NB:** Percentage as initial width does not work well with resizing.
|
|
56
56
|
* @default 140px
|
|
57
57
|
*/
|
|
58
|
-
|
|
58
|
+
defaultValue?: number | string;
|
|
59
59
|
/**
|
|
60
60
|
* Called when the column width changes.
|
|
61
61
|
* @param width New width in pixels.
|
|
@@ -98,7 +98,7 @@ function useTableColumnResize({
|
|
|
98
98
|
resizeMin = 40,
|
|
99
99
|
resizeMax = Infinity,
|
|
100
100
|
value,
|
|
101
|
-
|
|
101
|
+
defaultValue,
|
|
102
102
|
onChange,
|
|
103
103
|
thRef,
|
|
104
104
|
colSpan,
|
|
@@ -110,7 +110,7 @@ function useTableColumnResize({
|
|
|
110
110
|
|
|
111
111
|
const [width, setWidth] = useControllableState({
|
|
112
112
|
value,
|
|
113
|
-
defaultValue:
|
|
113
|
+
defaultValue: defaultValue ?? (colSpan ?? 1) * 140,
|
|
114
114
|
/**
|
|
115
115
|
* TODO:
|
|
116
116
|
* - Potential optimization: Only call when width as "stopped" changing, e.g. on mouse up or after a debounce when resizing with keyboard.
|
|
@@ -344,18 +344,18 @@ function getAutoColumnWidth(
|
|
|
344
344
|
// Find needed width
|
|
345
345
|
const cellContent = cell.querySelector(
|
|
346
346
|
".aksel-data-table__cell-content",
|
|
347
|
-
) as HTMLElement;
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
const
|
|
355
|
-
|
|
356
|
-
|
|
347
|
+
) as HTMLElement | null;
|
|
348
|
+
|
|
349
|
+
if (!cellContent) {
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
cellContent.style.width = "fit-content";
|
|
354
|
+
const cellContentWidth = cellContent.scrollWidth;
|
|
355
|
+
cellContent.style.removeProperty("width");
|
|
356
|
+
const widthNeededForThisCell = (cellContentWidth + 1) / cell.colSpan;
|
|
357
357
|
if (widthNeededForThisCell > newColumnWidth) {
|
|
358
|
-
newColumnWidth = widthNeededForThisCell;
|
|
358
|
+
newColumnWidth = Math.ceil(widthNeededForThisCell);
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
361
|
|
|
@@ -2,15 +2,16 @@ import type { ChangeEventHandler, SetStateAction } from "react";
|
|
|
2
2
|
import type { CheckboxInputProps } from "../../../../form/checkbox/checkbox-input/CheckboxInput";
|
|
3
3
|
import { consoleWarning } from "../../../../utils/helpers/consoleWarning";
|
|
4
4
|
import type { UseTableItemsReturn } from "../../hooks/useTableItems";
|
|
5
|
-
import type { TableRowEntryId } from "../../root/
|
|
6
|
-
import type {
|
|
5
|
+
import type { TableRowEntryId } from "../../root/DataGridTable.types";
|
|
6
|
+
import type { SelectionProps } from "./selection.types";
|
|
7
7
|
import { canSelectTableRow, mutateRowSelection } from "./selection.utils";
|
|
8
8
|
|
|
9
9
|
type GetMultipleSelectPropsArgs<T> = {
|
|
10
10
|
selectedKeysSet: Set<TableRowEntryId>;
|
|
11
|
-
selectedKeys:
|
|
12
|
-
setSelectedKeys: (next: SetStateAction<
|
|
11
|
+
selectedKeys: string[];
|
|
12
|
+
setSelectedKeys: (next: SetStateAction<string[]>) => void;
|
|
13
13
|
tableItems: UseTableItemsReturn<T>;
|
|
14
|
+
isLoading?: boolean;
|
|
14
15
|
} & Pick<SelectionProps<T>, "enableRowSelection">;
|
|
15
16
|
|
|
16
17
|
function getMultipleSelectProps<T>({
|
|
@@ -19,6 +20,7 @@ function getMultipleSelectProps<T>({
|
|
|
19
20
|
setSelectedKeys,
|
|
20
21
|
enableRowSelection,
|
|
21
22
|
tableItems,
|
|
23
|
+
isLoading,
|
|
22
24
|
}: GetMultipleSelectPropsArgs<T>) {
|
|
23
25
|
const selectableIdsSet: Set<TableRowEntryId> = new Set();
|
|
24
26
|
|
|
@@ -40,7 +42,7 @@ function getMultipleSelectProps<T>({
|
|
|
40
42
|
const handleToggleRow = (key: TableRowEntryId, row: T) => {
|
|
41
43
|
if (!row) {
|
|
42
44
|
consoleWarning(
|
|
43
|
-
`Row data is undefined for key ${key}. This may cause issues with selection if enableRowSelection is used.`,
|
|
45
|
+
`DataGrid.Table: Row data is undefined for key ${key}. This may cause issues with selection if enableRowSelection is used.`,
|
|
44
46
|
);
|
|
45
47
|
}
|
|
46
48
|
|
|
@@ -62,6 +64,9 @@ function getMultipleSelectProps<T>({
|
|
|
62
64
|
const toggleAllRowSelected: ChangeEventHandler<HTMLInputElement> = (
|
|
63
65
|
event,
|
|
64
66
|
) => {
|
|
67
|
+
if (isLoading) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
65
70
|
if (event.target.checked) {
|
|
66
71
|
const preserved = selectedKeys.filter((k) => !selectableIdsSet.has(k));
|
|
67
72
|
setSelectedKeys([...preserved, ...selectableIdsSet]);
|
|
@@ -75,6 +80,7 @@ function getMultipleSelectProps<T>({
|
|
|
75
80
|
checked: isAllSelected,
|
|
76
81
|
indeterminate: !isAllSelected && someSelected,
|
|
77
82
|
onChange: toggleAllRowSelected,
|
|
83
|
+
disabled: selectableIdsSet.size === 0 || isLoading,
|
|
78
84
|
}),
|
|
79
85
|
getRowCheckboxProps: (key: TableRowEntryId, row: T): CheckboxInputProps => {
|
|
80
86
|
return {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { RadioInputProps } from "../../../../form/radio/radio-input/RadioInput";
|
|
2
2
|
import { consoleWarning } from "../../../../utils/helpers/consoleWarning";
|
|
3
|
-
import type { TableRowEntryId } from "../../root/
|
|
4
|
-
import type {
|
|
3
|
+
import type { TableRowEntryId } from "../../root/DataGridTable.types";
|
|
4
|
+
import type { SelectionProps } from "./selection.types";
|
|
5
5
|
import { canSelectTableRow } from "./selection.utils";
|
|
6
6
|
|
|
7
7
|
type GetSingleSelectPropsArgs<T> = {
|
|
8
8
|
selectedKeysSet: Set<TableRowEntryId>;
|
|
9
|
-
setSelectedKeys: (keys:
|
|
9
|
+
setSelectedKeys: (keys: string[]) => void;
|
|
10
10
|
name: string;
|
|
11
11
|
} & Pick<SelectionProps<T>, "enableRowSelection">;
|
|
12
12
|
|
|
@@ -19,7 +19,7 @@ function getSingleSelectProps<T>({
|
|
|
19
19
|
const handleSelectionChange = (key: TableRowEntryId, row: T) => {
|
|
20
20
|
if (!row) {
|
|
21
21
|
consoleWarning(
|
|
22
|
-
`Row data is undefined for key ${key}. This may cause issues with selection if enableRowSelection is used.`,
|
|
22
|
+
`DataGrid.Table: Row data is undefined for key ${key}. This may cause issues with selection if enableRowSelection is used.`,
|
|
23
23
|
);
|
|
24
24
|
}
|
|
25
25
|
if (!canSelectTableRow(enableRowSelection, { row, id: key })) {
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import type { CheckboxInputProps } from "../../../../form/checkbox/checkbox-input/CheckboxInput";
|
|
2
2
|
import type { RadioInputProps } from "../../../../form/radio/radio-input/RadioInput";
|
|
3
|
-
import type { TableRowEntryId } from "../../root/DataTable.types";
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// TODO: Remove `any` if possible
|
|
8
|
-
type SelectionProps<T = any> = {
|
|
4
|
+
// TODO: Remove `= unknown` if possible
|
|
5
|
+
type SelectionProps<T = unknown> = {
|
|
9
6
|
/**
|
|
10
7
|
* Enables selection of rows.
|
|
11
8
|
*
|
|
@@ -16,57 +13,51 @@ type SelectionProps<T = any> = {
|
|
|
16
13
|
*
|
|
17
14
|
* @default "none"
|
|
18
15
|
*/
|
|
19
|
-
|
|
16
|
+
mode: "none" | "single" | "multiple";
|
|
20
17
|
/**
|
|
21
|
-
* Controlled selected keys. Should be used in conjunction with `
|
|
18
|
+
* Controlled selected keys. Should be used in conjunction with `onSelectedRowIdsChange`.
|
|
22
19
|
*/
|
|
23
|
-
|
|
20
|
+
selectedRowIds?: string[];
|
|
24
21
|
/**
|
|
25
22
|
* Default selected keys when using uncontrolled selection. Should not be used together with `selectedKeys`.
|
|
26
23
|
*/
|
|
27
|
-
|
|
24
|
+
defaultSelectedRowIds?: string[];
|
|
28
25
|
/**
|
|
29
26
|
* Callback with array of selected keys.
|
|
30
27
|
*/
|
|
31
|
-
|
|
28
|
+
onSelectedRowIdsChange?: (ids: string[]) => void;
|
|
32
29
|
/**
|
|
33
30
|
* Callback to determine if a row should be enabled for selection.
|
|
34
31
|
*
|
|
35
|
-
*
|
|
36
32
|
* If set to a boolean, it will enable selection for all rows when true, and disable selection for all rows when false.
|
|
37
33
|
*/
|
|
38
34
|
enableRowSelection?:
|
|
39
|
-
| (({ row, id }: { row: T; id:
|
|
35
|
+
| (({ row, id }: { row: T; id: string }) => boolean)
|
|
40
36
|
| boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Determines if selection is triggered by clicking the row or the selection control (checkbox/radio).
|
|
43
|
-
* @default "row"
|
|
44
|
-
*/
|
|
45
|
-
selectionTrigger?: "row" | "control";
|
|
46
37
|
};
|
|
47
38
|
|
|
48
39
|
type NoneSelection = {
|
|
49
|
-
|
|
50
|
-
selectedKeys:
|
|
40
|
+
mode: "none";
|
|
41
|
+
selectedKeys: string[];
|
|
51
42
|
};
|
|
52
43
|
|
|
53
44
|
type SingleSelection = {
|
|
54
|
-
|
|
55
|
-
selectedKeys:
|
|
56
|
-
getRowRadioProps: (key:
|
|
57
|
-
toggleSelection: (key:
|
|
45
|
+
mode: "single";
|
|
46
|
+
selectedKeys: string[];
|
|
47
|
+
getRowRadioProps: (key: string, row: any) => RadioInputProps;
|
|
48
|
+
toggleSelection: (key: string, row: any) => void;
|
|
58
49
|
};
|
|
59
50
|
|
|
60
51
|
type MultipleSelection = {
|
|
61
|
-
|
|
62
|
-
selectedKeys:
|
|
52
|
+
mode: "multiple";
|
|
53
|
+
selectedKeys: string[];
|
|
63
54
|
getTheadCheckboxProps: () => CheckboxInputProps;
|
|
64
|
-
getRowCheckboxProps: (key:
|
|
65
|
-
toggleSelection: (key:
|
|
55
|
+
getRowCheckboxProps: (key: string, row: any) => CheckboxInputProps;
|
|
56
|
+
toggleSelection: (key: string, row: any) => void;
|
|
66
57
|
};
|
|
67
58
|
|
|
68
59
|
type TableSelectionBase = {
|
|
69
|
-
isRowSelected: (rowId:
|
|
60
|
+
isRowSelected: (rowId: string) => boolean;
|
|
70
61
|
};
|
|
71
62
|
|
|
72
63
|
type TableSelection = TableSelectionBase &
|
|
@@ -75,7 +66,6 @@ type TableSelection = TableSelectionBase &
|
|
|
75
66
|
export type {
|
|
76
67
|
MultipleSelection,
|
|
77
68
|
NoneSelection,
|
|
78
|
-
SelectedKeysT,
|
|
79
69
|
SelectionProps,
|
|
80
70
|
SingleSelection,
|
|
81
71
|
TableSelection,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, test } from "vitest";
|
|
2
|
-
import type { TableRowEntryId } from "../../root/
|
|
2
|
+
import type { TableRowEntryId } from "../../root/DataGridTable.types";
|
|
3
3
|
import type { ItemDetail } from "../collectTableRowEntries";
|
|
4
4
|
import { mutateRowSelection } from "./selection.utils";
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { renderHook } from "@testing-library/react";
|
|
2
2
|
import { describe, expect, test } from "vitest";
|
|
3
|
-
import type { TableRowEntryId } from "../../root/
|
|
3
|
+
import type { TableRowEntryId } from "../../root/DataGridTable.types";
|
|
4
4
|
import { useTableItems } from "../useTableItems";
|
|
5
5
|
|
|
6
6
|
type TestRow = {
|
|
@@ -2,13 +2,13 @@ import { useMemo } from "react";
|
|
|
2
2
|
import type {
|
|
3
3
|
ColumnDefinition,
|
|
4
4
|
ColumnDefinitions,
|
|
5
|
-
} from "../root/
|
|
5
|
+
} from "../root/DataGridTable.types";
|
|
6
6
|
import { ACTION_CELL_WIDTH } from "../tr/DataTableTr";
|
|
7
7
|
|
|
8
8
|
type UseColumnOptions = {
|
|
9
9
|
stickyColumns?: {
|
|
10
|
-
start?:
|
|
11
|
-
end?:
|
|
10
|
+
start?: 1;
|
|
11
|
+
end?: 1;
|
|
12
12
|
};
|
|
13
13
|
hasSelection: boolean;
|
|
14
14
|
hasDetailsPanel: boolean;
|
|
@@ -39,7 +39,7 @@ function useColumnOptions<T>(
|
|
|
39
39
|
): UseColumnOptionsResult<T> {
|
|
40
40
|
const { stickyColumns, hasSelection, hasDetailsPanel, layout } = options;
|
|
41
41
|
|
|
42
|
-
const hasStickyStart = stickyColumns?.start ===
|
|
42
|
+
const hasStickyStart = stickyColumns?.start === 1;
|
|
43
43
|
|
|
44
44
|
const stickyExpansion = hasStickyStart && hasDetailsPanel;
|
|
45
45
|
const stickySelection = hasStickyStart && hasSelection;
|
|
@@ -53,7 +53,7 @@ function useColumnOptions<T>(
|
|
|
53
53
|
return columnDefinitions.map((colDef, index) => {
|
|
54
54
|
const isFirstSticky = hasStickyStart && index === 0;
|
|
55
55
|
const isLastSticky =
|
|
56
|
-
stickyColumns?.end ===
|
|
56
|
+
stickyColumns?.end === 1 && index === columnDefinitions.length - 1;
|
|
57
57
|
|
|
58
58
|
return {
|
|
59
59
|
isSticky: isFirstSticky
|