@dbcdk/react-components 0.0.194 → 0.0.196
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/README.md +78 -10
- package/dist/client.cjs +486 -614
- package/dist/client.d.ts +176 -102
- package/dist/client.js +102 -102
- package/dist/components/color-scheme-button/ColorSchemeButton.cjs +7 -4
- package/dist/components/color-scheme-button/ColorSchemeButton.d.ts +7 -3
- package/dist/components/color-scheme-button/ColorSchemeButton.js +7 -4
- package/dist/components/forms/text-area/Textarea.cjs +2 -1
- package/dist/components/forms/text-area/Textarea.d.ts +1 -0
- package/dist/components/forms/text-area/Textarea.js +2 -1
- package/dist/components/highlighted-text/HighlightedText.cjs +6 -3
- package/dist/components/highlighted-text/HighlightedText.js +7 -4
- package/dist/components/json-viewer/JsonNode.cjs +27 -67
- package/dist/components/json-viewer/JsonNode.d.ts +10 -0
- package/dist/components/json-viewer/JsonNode.js +28 -68
- package/dist/components/json-viewer/JsonRow.cjs +85 -0
- package/dist/components/json-viewer/JsonRow.d.ts +5 -0
- package/dist/components/json-viewer/JsonRow.js +79 -0
- package/dist/components/json-viewer/JsonViewer.cjs +36 -256
- package/dist/components/json-viewer/JsonViewer.js +37 -253
- package/dist/components/json-viewer/JsonViewerShell.cjs +208 -0
- package/dist/components/json-viewer/JsonViewerShell.d.ts +25 -0
- package/dist/components/json-viewer/JsonViewerShell.js +202 -0
- package/dist/components/json-viewer/TanstackJsonViewer.cjs +127 -0
- package/dist/components/json-viewer/TanstackJsonViewer.d.ts +17 -0
- package/dist/components/json-viewer/TanstackJsonViewer.js +121 -0
- package/dist/components/json-viewer/types.d.ts +27 -0
- package/dist/components/json-viewer/useJsonViewerState.cjs +111 -0
- package/dist/components/json-viewer/useJsonViewerState.d.ts +42 -0
- package/dist/components/json-viewer/useJsonViewerState.js +108 -0
- package/dist/components/json-viewer/utils.cjs +36 -0
- package/dist/components/json-viewer/utils.d.ts +21 -1
- package/dist/components/json-viewer/utils.js +35 -1
- package/dist/components/lightbox/Lightbox.cjs +2 -2
- package/dist/components/lightbox/Lightbox.d.ts +1 -1
- package/dist/components/lightbox/Lightbox.js +1 -1
- package/dist/components/line-viewer/LineViewer.cjs +2 -3
- package/dist/components/line-viewer/LineViewer.js +2 -3
- package/dist/components/line-viewer/tokenizeLineFormat.cjs +37 -17
- package/dist/components/line-viewer/tokenizeLineFormat.d.ts +5 -4
- package/dist/components/line-viewer/tokenizeLineFormat.js +37 -17
- package/dist/components/menu/Menu.cjs +3 -23
- package/dist/components/menu/Menu.js +3 -23
- package/dist/components/menu/Menu.module.css +4 -3
- package/dist/components/metric-tile/MetricTile.cjs +3 -2
- package/dist/components/metric-tile/MetricTile.js +2 -1
- package/dist/components/overlay/tooltip/Tooltip.cjs +7 -2
- package/dist/components/overlay/tooltip/Tooltip.d.ts +7 -1
- package/dist/components/overlay/tooltip/Tooltip.js +7 -2
- package/dist/components/overlay/tooltip/useTooltipTrigger.cjs +7 -1
- package/dist/components/overlay/tooltip/useTooltipTrigger.js +7 -1
- package/dist/components/page-layout/PageLayout.module.css +1 -1
- package/dist/components/table/Table.cjs +45 -16
- package/dist/components/table/Table.d.ts +1 -1
- package/dist/components/table/Table.js +47 -18
- package/dist/components/table/Table.module.css +135 -7
- package/dist/components/table/Table.types.d.ts +47 -1
- package/dist/components/table/TanstackTable.cjs +30 -2
- package/dist/components/table/TanstackTable.js +31 -3
- package/dist/components/table/components/TableBody.d.ts +1 -2
- package/dist/components/table/components/TableHeader.cjs +6 -4
- package/dist/components/table/components/TableHeader.d.ts +2 -1
- package/dist/components/table/components/TableHeader.js +6 -4
- package/dist/components/table/components/TableHeaderCell.cjs +5 -4
- package/dist/components/table/components/TableHeaderCell.d.ts +3 -1
- package/dist/components/table/components/TableHeaderCell.js +5 -4
- package/dist/components/table/components/TableRow.cjs +1 -1
- package/dist/components/table/components/TableRow.d.ts +1 -2
- package/dist/components/table/components/TableRow.js +1 -1
- package/dist/components/table/components/TableSkeletonBody.cjs +30 -0
- package/dist/components/table/components/TableSkeletonBody.d.ts +13 -0
- package/dist/components/table/components/TableSkeletonBody.js +24 -0
- package/dist/components/table/components/table-settings/TableHeaderSettings.cjs +28 -0
- package/dist/components/table/components/table-settings/TableHeaderSettings.d.ts +11 -0
- package/dist/components/table/components/table-settings/TableHeaderSettings.js +26 -0
- package/dist/components/table/components/table-settings/TableSettings.cjs +82 -32
- package/dist/components/table/components/table-settings/TableSettings.d.ts +14 -6
- package/dist/components/table/components/table-settings/TableSettings.js +84 -34
- package/dist/components/table/table.utils.cjs +2 -0
- package/dist/components/table/table.utils.d.ts +6 -0
- package/dist/components/table/table.utils.js +2 -1
- package/dist/components/table/tableSettings.utils.cjs +29 -0
- package/dist/components/table/tableSettings.utils.d.ts +9 -0
- package/dist/components/table/tableSettings.utils.js +24 -0
- package/dist/components/table/tanstackTable.utils.cjs +18 -0
- package/dist/components/table/tanstackTable.utils.js +19 -1
- package/dist/components/theme-button/ThemeButton.cjs +9 -4
- package/dist/components/theme-button/ThemeButton.d.ts +4 -2
- package/dist/components/theme-button/ThemeButton.js +9 -4
- package/dist/components/theme-script/ThemeScript.cjs +10 -4
- package/dist/components/theme-script/ThemeScript.d.ts +9 -1
- package/dist/components/theme-script/ThemeScript.js +10 -4
- package/dist/components/xml-viewer/XmlViewer.cjs +2 -3
- package/dist/components/xml-viewer/XmlViewer.js +2 -3
- package/dist/hooks/useColorScheme.cjs +18 -14
- package/dist/hooks/useColorScheme.d.ts +11 -1
- package/dist/hooks/useColorScheme.js +19 -15
- package/dist/hooks/useGetActiveTheme.cjs +4 -3
- package/dist/hooks/useGetActiveTheme.d.ts +7 -1
- package/dist/hooks/useGetActiveTheme.js +4 -3
- package/dist/hooks/useTableData.cjs +11 -7
- package/dist/hooks/useTableData.d.ts +8 -2
- package/dist/hooks/useTableData.js +11 -7
- package/dist/hooks/useTableSettings.cjs +25 -9
- package/dist/hooks/useTableSettings.d.ts +9 -6
- package/dist/hooks/useTableSettings.js +25 -9
- package/dist/hooks/useTheme.d.ts +6 -0
- package/dist/styles/styles.css +7 -3
- package/dist/styles/themes/dbc/colors.css +1 -1
- package/dist/styles.css +1 -476
- package/dist/tanstack-virtual.cjs +12 -0
- package/dist/tanstack-virtual.d.ts +1 -0
- package/dist/tanstack-virtual.js +1 -0
- package/package.json +13 -1
|
@@ -5,6 +5,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var reactTable = require('@tanstack/react-table');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var ColumnResizer = require('./components/column-resizer/ColumnResizer');
|
|
8
|
+
var TableHeaderSettings = require('./components/table-settings/TableHeaderSettings');
|
|
8
9
|
var Table = require('./Table');
|
|
9
10
|
var table_utils = require('./table.utils');
|
|
10
11
|
var tanstackTable_utils = require('./tanstackTable.utils');
|
|
@@ -40,12 +41,18 @@ function TanstackTable(props) {
|
|
|
40
41
|
sorting: controlledSorting,
|
|
41
42
|
onSortingChange,
|
|
42
43
|
optimisticSortingUi = true,
|
|
43
|
-
visibleColumnIds,
|
|
44
|
+
visibleColumnIds: visibleColumnIdsProp,
|
|
44
45
|
manualSorting,
|
|
46
|
+
viewMode,
|
|
47
|
+
striped,
|
|
48
|
+
settings,
|
|
49
|
+
settingsOptions,
|
|
50
|
+
headerActions: headerActionsProp,
|
|
45
51
|
selectedRows,
|
|
46
52
|
onRowSelect,
|
|
47
53
|
...tableProps
|
|
48
54
|
} = props;
|
|
55
|
+
const visibleColumnIds = visibleColumnIdsProp != null ? visibleColumnIdsProp : settings == null ? void 0 : settings.visibleColumnIds;
|
|
49
56
|
const isControlledSorting = controlledSorting != null;
|
|
50
57
|
const [uiSorting, setUiSorting] = React__namespace.useState(controlledSorting != null ? controlledSorting : []);
|
|
51
58
|
React__namespace.useEffect(() => {
|
|
@@ -116,7 +123,11 @@ function TanstackTable(props) {
|
|
|
116
123
|
return tanstackTable_utils.buildDistributedColumnWidths({
|
|
117
124
|
table,
|
|
118
125
|
hasSelection: Boolean(selectedRows && onRowSelect && dataKey),
|
|
119
|
-
|
|
126
|
+
// Row actions (context menu, expand toggle) and header actions (e.g. the
|
|
127
|
+
// settings menu) all reserve space at the end of the last column.
|
|
128
|
+
hasContextMenu: Boolean(
|
|
129
|
+
tableProps.getContextMenuItems || tableProps.expandableRows || settings || headerActionsProp != null
|
|
130
|
+
),
|
|
120
131
|
defaultMinPx: 80,
|
|
121
132
|
columnSizing,
|
|
122
133
|
availableWidth
|
|
@@ -127,6 +138,9 @@ function TanstackTable(props) {
|
|
|
127
138
|
onRowSelect,
|
|
128
139
|
dataKey,
|
|
129
140
|
tableProps.getContextMenuItems,
|
|
141
|
+
tableProps.expandableRows,
|
|
142
|
+
settings,
|
|
143
|
+
headerActionsProp,
|
|
130
144
|
columnSizing,
|
|
131
145
|
availableWidth
|
|
132
146
|
]);
|
|
@@ -168,10 +182,24 @@ function TanstackTable(props) {
|
|
|
168
182
|
},
|
|
169
183
|
[table]
|
|
170
184
|
);
|
|
185
|
+
const headerActions = headerActionsProp != null || settings ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
186
|
+
headerActionsProp,
|
|
187
|
+
settings ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
188
|
+
TableHeaderSettings.TableHeaderSettings,
|
|
189
|
+
{
|
|
190
|
+
settings,
|
|
191
|
+
options: settingsOptions,
|
|
192
|
+
columns
|
|
193
|
+
}
|
|
194
|
+
) : null
|
|
195
|
+
] }) : void 0;
|
|
171
196
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
172
197
|
Table.Table,
|
|
173
198
|
{
|
|
174
199
|
...tableProps,
|
|
200
|
+
viewMode: viewMode != null ? viewMode : settings == null ? void 0 : settings.viewMode,
|
|
201
|
+
striped: striped != null ? striped : settings == null ? void 0 : settings.striped,
|
|
202
|
+
headerActions,
|
|
175
203
|
tableRootRef: containerRef,
|
|
176
204
|
onSortChange: handleSortChange,
|
|
177
205
|
dataKey,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { useReactTable, getSortedRowModel, getCoreRowModel } from '@tanstack/react-table';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import ColumnResizer from './components/column-resizer/ColumnResizer';
|
|
6
|
+
import { TableHeaderSettings } from './components/table-settings/TableHeaderSettings';
|
|
6
7
|
import { Table } from './Table';
|
|
7
8
|
import { DEFAULT_COLUMN_PX } from './table.utils';
|
|
8
9
|
import { sortingEqual, buildColumnVisibilityFromVisibleIds, buildDistributedColumnWidths, mapDefsToColumnItems, getSortPropsFromSorting } from './tanstackTable.utils';
|
|
@@ -15,12 +16,18 @@ function TanstackTable(props) {
|
|
|
15
16
|
sorting: controlledSorting,
|
|
16
17
|
onSortingChange,
|
|
17
18
|
optimisticSortingUi = true,
|
|
18
|
-
visibleColumnIds,
|
|
19
|
+
visibleColumnIds: visibleColumnIdsProp,
|
|
19
20
|
manualSorting,
|
|
21
|
+
viewMode,
|
|
22
|
+
striped,
|
|
23
|
+
settings,
|
|
24
|
+
settingsOptions,
|
|
25
|
+
headerActions: headerActionsProp,
|
|
20
26
|
selectedRows,
|
|
21
27
|
onRowSelect,
|
|
22
28
|
...tableProps
|
|
23
29
|
} = props;
|
|
30
|
+
const visibleColumnIds = visibleColumnIdsProp != null ? visibleColumnIdsProp : settings == null ? void 0 : settings.visibleColumnIds;
|
|
24
31
|
const isControlledSorting = controlledSorting != null;
|
|
25
32
|
const [uiSorting, setUiSorting] = React.useState(controlledSorting != null ? controlledSorting : []);
|
|
26
33
|
React.useEffect(() => {
|
|
@@ -91,7 +98,11 @@ function TanstackTable(props) {
|
|
|
91
98
|
return buildDistributedColumnWidths({
|
|
92
99
|
table,
|
|
93
100
|
hasSelection: Boolean(selectedRows && onRowSelect && dataKey),
|
|
94
|
-
|
|
101
|
+
// Row actions (context menu, expand toggle) and header actions (e.g. the
|
|
102
|
+
// settings menu) all reserve space at the end of the last column.
|
|
103
|
+
hasContextMenu: Boolean(
|
|
104
|
+
tableProps.getContextMenuItems || tableProps.expandableRows || settings || headerActionsProp != null
|
|
105
|
+
),
|
|
95
106
|
defaultMinPx: 80,
|
|
96
107
|
columnSizing,
|
|
97
108
|
availableWidth
|
|
@@ -102,6 +113,9 @@ function TanstackTable(props) {
|
|
|
102
113
|
onRowSelect,
|
|
103
114
|
dataKey,
|
|
104
115
|
tableProps.getContextMenuItems,
|
|
116
|
+
tableProps.expandableRows,
|
|
117
|
+
settings,
|
|
118
|
+
headerActionsProp,
|
|
105
119
|
columnSizing,
|
|
106
120
|
availableWidth
|
|
107
121
|
]);
|
|
@@ -143,10 +157,24 @@ function TanstackTable(props) {
|
|
|
143
157
|
},
|
|
144
158
|
[table]
|
|
145
159
|
);
|
|
160
|
+
const headerActions = headerActionsProp != null || settings ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
161
|
+
headerActionsProp,
|
|
162
|
+
settings ? /* @__PURE__ */ jsx(
|
|
163
|
+
TableHeaderSettings,
|
|
164
|
+
{
|
|
165
|
+
settings,
|
|
166
|
+
options: settingsOptions,
|
|
167
|
+
columns
|
|
168
|
+
}
|
|
169
|
+
) : null
|
|
170
|
+
] }) : void 0;
|
|
146
171
|
return /* @__PURE__ */ jsx(
|
|
147
172
|
Table,
|
|
148
173
|
{
|
|
149
174
|
...tableProps,
|
|
175
|
+
viewMode: viewMode != null ? viewMode : settings == null ? void 0 : settings.viewMode,
|
|
176
|
+
striped: striped != null ? striped : settings == null ? void 0 : settings.striped,
|
|
177
|
+
headerActions,
|
|
150
178
|
tableRootRef: containerRef,
|
|
151
179
|
onSortChange: handleSortChange,
|
|
152
180
|
dataKey,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type { ViewMode } from '../../../
|
|
3
|
-
import type { ColumnItem, TableContextMenuItem } from '../Table.types';
|
|
2
|
+
import type { ViewMode, ColumnItem, TableContextMenuItem } from '../../../components/table/Table.types';
|
|
4
3
|
type Props<T extends Record<string, any>> = {
|
|
5
4
|
data: T[];
|
|
6
5
|
dataKey: keyof T;
|
|
@@ -20,14 +20,15 @@ function TableHeader({
|
|
|
20
20
|
sortDirection,
|
|
21
21
|
onSortChange,
|
|
22
22
|
headerExtras,
|
|
23
|
-
stickyTop
|
|
23
|
+
stickyTop,
|
|
24
|
+
headerActions
|
|
24
25
|
}) {
|
|
25
26
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
26
27
|
"thead",
|
|
27
28
|
{
|
|
28
29
|
className: styles__default.default.header,
|
|
29
30
|
"data-sticky": Boolean(stickyTop),
|
|
30
|
-
style: stickyTop ? { top: stickyTop, position: "sticky"
|
|
31
|
+
style: stickyTop ? { top: stickyTop, position: "sticky" } : void 0,
|
|
31
32
|
children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: styles__default.default.headerRow, children: [
|
|
32
33
|
hasSelection ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
33
34
|
TableSelectionCell.TableSelectionCell,
|
|
@@ -43,13 +44,14 @@ function TableHeader({
|
|
|
43
44
|
{
|
|
44
45
|
column,
|
|
45
46
|
index,
|
|
46
|
-
reserveInlineEnd: hasRowContextMenu && index === columns.length - 1,
|
|
47
|
+
reserveInlineEnd: (hasRowContextMenu || headerActions != null) && index === columns.length - 1,
|
|
48
|
+
endAction: index === columns.length - 1 ? headerActions : void 0,
|
|
47
49
|
sortById,
|
|
48
50
|
sortDirection,
|
|
49
51
|
onSortChange,
|
|
50
52
|
extraContent: headerExtras == null ? void 0 : headerExtras({ column, index })
|
|
51
53
|
},
|
|
52
|
-
column.id
|
|
54
|
+
index === columns.length - 1 && headerActions != null ? "__last" : column.id
|
|
53
55
|
))
|
|
54
56
|
] })
|
|
55
57
|
}
|
|
@@ -12,6 +12,7 @@ type Props<T> = {
|
|
|
12
12
|
onSortChange?: (column: ColumnItem<T>, direction: SortDirection) => void;
|
|
13
13
|
headerExtras?: (args: HeaderExtrasArgs<T>) => ReactNode;
|
|
14
14
|
stickyTop?: string;
|
|
15
|
+
headerActions?: ReactNode;
|
|
15
16
|
};
|
|
16
|
-
export declare function TableHeader<T>({ columns, hasSelection, selectionMode, hasRowContextMenu, allRowsSelected, onSelectAllRows, sortById, sortDirection, onSortChange, headerExtras, stickyTop, }: Props<T>): React.ReactNode;
|
|
17
|
+
export declare function TableHeader<T>({ columns, hasSelection, selectionMode, hasRowContextMenu, allRowsSelected, onSelectAllRows, sortById, sortDirection, onSortChange, headerExtras, stickyTop, headerActions, }: Props<T>): React.ReactNode;
|
|
17
18
|
export {};
|
|
@@ -14,14 +14,15 @@ function TableHeader({
|
|
|
14
14
|
sortDirection,
|
|
15
15
|
onSortChange,
|
|
16
16
|
headerExtras,
|
|
17
|
-
stickyTop
|
|
17
|
+
stickyTop,
|
|
18
|
+
headerActions
|
|
18
19
|
}) {
|
|
19
20
|
return /* @__PURE__ */ jsx(
|
|
20
21
|
"thead",
|
|
21
22
|
{
|
|
22
23
|
className: styles.header,
|
|
23
24
|
"data-sticky": Boolean(stickyTop),
|
|
24
|
-
style: stickyTop ? { top: stickyTop, position: "sticky"
|
|
25
|
+
style: stickyTop ? { top: stickyTop, position: "sticky" } : void 0,
|
|
25
26
|
children: /* @__PURE__ */ jsxs("tr", { className: styles.headerRow, children: [
|
|
26
27
|
hasSelection ? /* @__PURE__ */ jsx(
|
|
27
28
|
TableSelectionCell,
|
|
@@ -37,13 +38,14 @@ function TableHeader({
|
|
|
37
38
|
{
|
|
38
39
|
column,
|
|
39
40
|
index,
|
|
40
|
-
reserveInlineEnd: hasRowContextMenu && index === columns.length - 1,
|
|
41
|
+
reserveInlineEnd: (hasRowContextMenu || headerActions != null) && index === columns.length - 1,
|
|
42
|
+
endAction: index === columns.length - 1 ? headerActions : void 0,
|
|
41
43
|
sortById,
|
|
42
44
|
sortDirection,
|
|
43
45
|
onSortChange,
|
|
44
46
|
extraContent: headerExtras == null ? void 0 : headerExtras({ column, index })
|
|
45
47
|
},
|
|
46
|
-
column.id
|
|
48
|
+
index === columns.length - 1 && headerActions != null ? "__last" : column.id
|
|
47
49
|
))
|
|
48
50
|
] })
|
|
49
51
|
}
|
|
@@ -17,7 +17,8 @@ function TableHeaderCell({
|
|
|
17
17
|
sortById,
|
|
18
18
|
sortDirection,
|
|
19
19
|
onSortChange,
|
|
20
|
-
extraContent
|
|
20
|
+
extraContent,
|
|
21
|
+
endAction
|
|
21
22
|
}) {
|
|
22
23
|
const active = table_utils.isActiveSort(sortById, column.id);
|
|
23
24
|
const ariaSort = table_utils.getAriaSort(column.sortable, active, sortDirection != null ? sortDirection : null);
|
|
@@ -59,10 +60,10 @@ function TableHeaderCell({
|
|
|
59
60
|
]
|
|
60
61
|
}
|
|
61
62
|
) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: alignClasses.label, children: table_utils.getHeaderLabel(column.header) }) }) }),
|
|
62
|
-
extraContent != null ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.thOverlayExtras, children: extraContent }) : null
|
|
63
|
+
extraContent != null ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.thOverlayExtras, children: extraContent }) : null,
|
|
64
|
+
endAction != null ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.thEndAction, children: endAction }) : null
|
|
63
65
|
]
|
|
64
|
-
}
|
|
65
|
-
column.id
|
|
66
|
+
}
|
|
66
67
|
);
|
|
67
68
|
}
|
|
68
69
|
|
|
@@ -8,6 +8,8 @@ type Props<T> = {
|
|
|
8
8
|
sortDirection?: SortDirection;
|
|
9
9
|
onSortChange?: (column: ColumnItem<T>, direction: SortDirection) => void;
|
|
10
10
|
extraContent?: ReactNode;
|
|
11
|
+
/** Rendered at the cell's inline end, in the space kept free by `reserveInlineEnd`. */
|
|
12
|
+
endAction?: ReactNode;
|
|
11
13
|
};
|
|
12
|
-
export declare function TableHeaderCell<T>({ column, index, reserveInlineEnd, sortById, sortDirection, onSortChange, extraContent, }: Props<T>): ReactNode;
|
|
14
|
+
export declare function TableHeaderCell<T>({ column, index, reserveInlineEnd, sortById, sortDirection, onSortChange, extraContent, endAction, }: Props<T>): ReactNode;
|
|
13
15
|
export {};
|
|
@@ -11,7 +11,8 @@ function TableHeaderCell({
|
|
|
11
11
|
sortById,
|
|
12
12
|
sortDirection,
|
|
13
13
|
onSortChange,
|
|
14
|
-
extraContent
|
|
14
|
+
extraContent,
|
|
15
|
+
endAction
|
|
15
16
|
}) {
|
|
16
17
|
const active = isActiveSort(sortById, column.id);
|
|
17
18
|
const ariaSort = getAriaSort(column.sortable, active, sortDirection != null ? sortDirection : null);
|
|
@@ -53,10 +54,10 @@ function TableHeaderCell({
|
|
|
53
54
|
]
|
|
54
55
|
}
|
|
55
56
|
) : /* @__PURE__ */ jsx("span", { className: alignClasses.label, children: getHeaderLabel(column.header) }) }) }),
|
|
56
|
-
extraContent != null ? /* @__PURE__ */ jsx("div", { className: styles.thOverlayExtras, children: extraContent }) : null
|
|
57
|
+
extraContent != null ? /* @__PURE__ */ jsx("div", { className: styles.thOverlayExtras, children: extraContent }) : null,
|
|
58
|
+
endAction != null ? /* @__PURE__ */ jsx("div", { className: styles.thEndAction, children: endAction }) : null
|
|
57
59
|
]
|
|
58
|
-
}
|
|
59
|
-
column.id
|
|
60
|
+
}
|
|
60
61
|
);
|
|
61
62
|
}
|
|
62
63
|
|
|
@@ -48,7 +48,7 @@ function TableRow({
|
|
|
48
48
|
rowId,
|
|
49
49
|
open: () => onRowClick == null ? void 0 : onRowClick(row)
|
|
50
50
|
});
|
|
51
|
-
const hasContextMenu = Boolean(contextMenuItems == null ? void 0 : contextMenuItems.length);
|
|
51
|
+
const hasContextMenu = Boolean(contextMenuItems == null ? void 0 : contextMenuItems.length) || canExpand && viewMode !== "wrapped";
|
|
52
52
|
const { handleRowClick, handleRowKeyDown } = useTableRowInteractions.useTableRowInteractions({
|
|
53
53
|
row,
|
|
54
54
|
rowId,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ViewMode } from '../../../
|
|
3
|
-
import type { ColumnItem, TableContextMenuItem } from '../Table.types';
|
|
2
|
+
import type { ViewMode, ColumnItem, TableContextMenuItem } from '../../../components/table/Table.types';
|
|
4
3
|
type Props<T extends Record<string, any>> = {
|
|
5
4
|
row: T;
|
|
6
5
|
rowId: string | number;
|
|
@@ -42,7 +42,7 @@ function TableRow({
|
|
|
42
42
|
rowId,
|
|
43
43
|
open: () => onRowClick == null ? void 0 : onRowClick(row)
|
|
44
44
|
});
|
|
45
|
-
const hasContextMenu = Boolean(contextMenuItems == null ? void 0 : contextMenuItems.length);
|
|
45
|
+
const hasContextMenu = Boolean(contextMenuItems == null ? void 0 : contextMenuItems.length) || canExpand && viewMode !== "wrapped";
|
|
46
46
|
const { handleRowClick, handleRowKeyDown } = useTableRowInteractions({
|
|
47
47
|
row,
|
|
48
48
|
rowId,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var SkeletonLoaderItem = require('../../../components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem');
|
|
5
|
+
var table_classes = require('../table.classes');
|
|
6
|
+
var styles = require('../Table.module.css');
|
|
7
|
+
|
|
8
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
|
|
10
|
+
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
11
|
+
|
|
12
|
+
function TableSkeletonBody({ columns, rows, hasSelection }) {
|
|
13
|
+
return /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: styles__default.default.body, "aria-busy": "true", children: Array.from({ length: rows }).map((_, rowIndex) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: styles__default.default.row, children: [
|
|
14
|
+
hasSelection ? /* @__PURE__ */ jsxRuntime.jsx("td", { className: table_classes.cx(styles__default.default.cell, styles__default.default.selectionCell) }) : null,
|
|
15
|
+
columns.map((column, columnIndex) => {
|
|
16
|
+
var _a;
|
|
17
|
+
return /* @__PURE__ */ jsxRuntime.jsx("td", { className: styles__default.default.cell, "data-align": (_a = column.align) != null ? _a : "left", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.skeletonCellContent, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
18
|
+
SkeletonLoaderItem.SkeletonLoaderItem,
|
|
19
|
+
{
|
|
20
|
+
width: `${55 + (rowIndex + columnIndex) % 3 * 15}%`,
|
|
21
|
+
height: 12,
|
|
22
|
+
radius: 4,
|
|
23
|
+
ariaLabel: "Indl\xE6ser r\xE6kke"
|
|
24
|
+
}
|
|
25
|
+
) }) }, column.id);
|
|
26
|
+
})
|
|
27
|
+
] }, rowIndex)) });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
exports.TableSkeletonBody = TableSkeletonBody;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ColumnItem } from '../Table.types';
|
|
3
|
+
type Props<T> = {
|
|
4
|
+
columns: ColumnItem<T>[];
|
|
5
|
+
rows: number;
|
|
6
|
+
hasSelection: boolean;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Placeholder rows shown while a table loads, laid out in the table's own
|
|
10
|
+
* columns so the header stays in place and the skeleton starts at the top.
|
|
11
|
+
*/
|
|
12
|
+
export declare function TableSkeletonBody<T>({ columns, rows, hasSelection }: Props<T>): ReactNode;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { SkeletonLoaderItem } from '../../../components/skeleton-loader/skeleton-loader-item/SkeletonLoaderItem';
|
|
3
|
+
import { cx } from '../table.classes';
|
|
4
|
+
import styles from '../Table.module.css';
|
|
5
|
+
|
|
6
|
+
function TableSkeletonBody({ columns, rows, hasSelection }) {
|
|
7
|
+
return /* @__PURE__ */ jsx("tbody", { className: styles.body, "aria-busy": "true", children: Array.from({ length: rows }).map((_, rowIndex) => /* @__PURE__ */ jsxs("tr", { className: styles.row, children: [
|
|
8
|
+
hasSelection ? /* @__PURE__ */ jsx("td", { className: cx(styles.cell, styles.selectionCell) }) : null,
|
|
9
|
+
columns.map((column, columnIndex) => {
|
|
10
|
+
var _a;
|
|
11
|
+
return /* @__PURE__ */ jsx("td", { className: styles.cell, "data-align": (_a = column.align) != null ? _a : "left", children: /* @__PURE__ */ jsx("div", { className: styles.skeletonCellContent, children: /* @__PURE__ */ jsx(
|
|
12
|
+
SkeletonLoaderItem,
|
|
13
|
+
{
|
|
14
|
+
width: `${55 + (rowIndex + columnIndex) % 3 * 15}%`,
|
|
15
|
+
height: 12,
|
|
16
|
+
radius: 4,
|
|
17
|
+
ariaLabel: "Indl\xE6ser r\xE6kke"
|
|
18
|
+
}
|
|
19
|
+
) }) }, column.id);
|
|
20
|
+
})
|
|
21
|
+
] }, rowIndex)) });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { TableSkeletonBody };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var TableSettings = require('./TableSettings');
|
|
6
|
+
|
|
7
|
+
function TableHeaderSettings({
|
|
8
|
+
settings,
|
|
9
|
+
options,
|
|
10
|
+
columns
|
|
11
|
+
}) {
|
|
12
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
13
|
+
TableSettings.TableSettings,
|
|
14
|
+
{
|
|
15
|
+
...options,
|
|
16
|
+
triggerVariant: "icon",
|
|
17
|
+
columns,
|
|
18
|
+
viewMode: settings.viewMode,
|
|
19
|
+
handleChangeViewMode: settings.setViewMode,
|
|
20
|
+
striped: settings.striped,
|
|
21
|
+
onStripedChange: settings.setStriped,
|
|
22
|
+
visibleColumnIds: settings.visibleColumnIds,
|
|
23
|
+
onVisibleColumnIdsChange: settings.setVisibleColumnIds
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
exports.TableHeaderSettings = TableHeaderSettings;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { ColumnItem, TableSettingsColumn, TableSettingsController, TableSettingsMenuOptions } from '../../Table.types';
|
|
3
|
+
/**
|
|
4
|
+
* The icon-only settings trigger that `Table`/`TanstackTable` render in their
|
|
5
|
+
* header when given `settings`. Internal - apps pass `settings` to the table.
|
|
6
|
+
*/
|
|
7
|
+
export declare function TableHeaderSettings<T extends Record<string, any>>({ settings, options, columns, }: {
|
|
8
|
+
settings: TableSettingsController;
|
|
9
|
+
options?: TableSettingsMenuOptions;
|
|
10
|
+
columns: ReadonlyArray<ColumnItem<T> | TableSettingsColumn>;
|
|
11
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { TableSettings } from './TableSettings';
|
|
4
|
+
|
|
5
|
+
function TableHeaderSettings({
|
|
6
|
+
settings,
|
|
7
|
+
options,
|
|
8
|
+
columns
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ jsx(
|
|
11
|
+
TableSettings,
|
|
12
|
+
{
|
|
13
|
+
...options,
|
|
14
|
+
triggerVariant: "icon",
|
|
15
|
+
columns,
|
|
16
|
+
viewMode: settings.viewMode,
|
|
17
|
+
handleChangeViewMode: settings.setViewMode,
|
|
18
|
+
striped: settings.striped,
|
|
19
|
+
onStripedChange: settings.setStriped,
|
|
20
|
+
visibleColumnIds: settings.visibleColumnIds,
|
|
21
|
+
onVisibleColumnIdsChange: settings.setVisibleColumnIds
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { TableHeaderSettings };
|