@dbcdk/react-components 0.0.158 → 0.0.160
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/forms/typeahead/Typeahead.cjs +6 -6
- package/dist/components/forms/typeahead/Typeahead.d.ts +1 -0
- package/dist/components/forms/typeahead/Typeahead.js +6 -6
- 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 +41 -44
- 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/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/hooks/useDeviceSize.cjs +2 -4
- package/dist/hooks/useDeviceSize.js +2 -4
- package/dist/styles/themes/dbc/colors.css +6 -0
- package/dist/styles/themes/filmstriben-budget/theme.css +22 -0
- 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
|
@@ -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
|
);
|
|
@@ -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 {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { MoreVertical } from 'lucide-react';
|
|
2
|
+
import { MoreVertical, ChevronsUpDown } from 'lucide-react';
|
|
3
3
|
import { useRef } from 'react';
|
|
4
4
|
import { Checkbox } from '../../../components/forms/checkbox/Checkbox';
|
|
5
5
|
import { RadioButton } from '../../../components/forms/radio-buttons/RadioButton';
|
|
@@ -24,14 +24,19 @@ function TableRow({
|
|
|
24
24
|
getRowSeverity,
|
|
25
25
|
getContextMenuItems,
|
|
26
26
|
showContextMenuOnHover,
|
|
27
|
+
expandableRows,
|
|
28
|
+
expandedRows,
|
|
27
29
|
onRowClick,
|
|
28
30
|
onRowMouseEnter,
|
|
29
|
-
onRowSelect
|
|
31
|
+
onRowSelect,
|
|
32
|
+
onToggleRowExpand
|
|
30
33
|
}) {
|
|
31
|
-
var _a;
|
|
34
|
+
var _a, _b;
|
|
32
35
|
const isSelected = (_a = selectedRows == null ? void 0 : selectedRows.has(rowId)) != null ? _a : false;
|
|
36
|
+
const isExpanded = (_b = expandedRows == null ? void 0 : expandedRows.has(rowId)) != null ? _b : false;
|
|
33
37
|
const rowSeverity = getRowSeverity == null ? void 0 : getRowSeverity(row);
|
|
34
38
|
const canSelect = Boolean(selectedRows && onRowSelect);
|
|
39
|
+
const canExpand = Boolean(expandableRows && onToggleRowExpand);
|
|
35
40
|
const contextMenuItems = getContextMenuItems == null ? void 0 : getContextMenuItems({
|
|
36
41
|
row,
|
|
37
42
|
rowId,
|
|
@@ -122,32 +127,32 @@ function TableRow({
|
|
|
122
127
|
)
|
|
123
128
|
}
|
|
124
129
|
) }) : null,
|
|
125
|
-
columns.map((column) => {
|
|
126
|
-
var _a2,
|
|
127
|
-
const allowWrap = shouldAllowWrap(column.allowWrap, isSelected, viewMode);
|
|
130
|
+
columns.map((column, index) => {
|
|
131
|
+
var _a2, _b2, _c, _d;
|
|
132
|
+
const allowWrap = shouldAllowWrap(column.allowWrap, isSelected || isExpanded, viewMode);
|
|
128
133
|
const allowOverflow = column.allowOverflow;
|
|
129
134
|
const cellValue = getCellDisplayValue(row, column);
|
|
130
|
-
const
|
|
135
|
+
const showRowActions = index === columns.length - 1 && hasContextMenu;
|
|
131
136
|
return /* @__PURE__ */ jsx(
|
|
132
137
|
"td",
|
|
133
138
|
{
|
|
134
139
|
className: cx(
|
|
135
140
|
styles.cell,
|
|
141
|
+
showRowActions && styles.actionCell,
|
|
136
142
|
allowOverflow && styles.allowOverflow,
|
|
137
143
|
allowWrap ? styles.allowWrap : styles.nowrap,
|
|
138
|
-
hasContextMenu && isLastColumn && styles.contextMenuAnchorCell,
|
|
139
144
|
column.divider === "left" && styles.dividerLeft,
|
|
140
145
|
column.divider === "right" && styles.dividerRight
|
|
141
146
|
),
|
|
142
|
-
"data-align": (
|
|
143
|
-
"data-vertical-align": (
|
|
147
|
+
"data-align": (_a2 = column.align) != null ? _a2 : "left",
|
|
148
|
+
"data-vertical-align": (_b2 = column.verticalAlign) != null ? _b2 : "top",
|
|
144
149
|
"data-divider": column.divider,
|
|
145
150
|
children: /* @__PURE__ */ jsxs(
|
|
146
151
|
"div",
|
|
147
152
|
{
|
|
148
|
-
className: styles.cellContent,
|
|
149
|
-
"data-align": (
|
|
150
|
-
"data-vertical-align": (
|
|
153
|
+
className: cx(styles.cellContent, showRowActions && styles.cellContentWithActions),
|
|
154
|
+
"data-align": (_c = column.align) != null ? _c : "left",
|
|
155
|
+
"data-vertical-align": (_d = column.verticalAlign) != null ? _d : "top",
|
|
151
156
|
children: [
|
|
152
157
|
/* @__PURE__ */ jsx(
|
|
153
158
|
"div",
|
|
@@ -156,11 +161,14 @@ function TableRow({
|
|
|
156
161
|
children: cellValue
|
|
157
162
|
}
|
|
158
163
|
),
|
|
159
|
-
|
|
160
|
-
|
|
164
|
+
showRowActions ? /* @__PURE__ */ jsx(
|
|
165
|
+
RowActions,
|
|
161
166
|
{
|
|
162
167
|
rowId,
|
|
163
168
|
items: contextMenuItems,
|
|
169
|
+
expandable: canExpand && viewMode !== "wrapped",
|
|
170
|
+
isExpanded,
|
|
171
|
+
onToggleExpand: onToggleRowExpand ? () => onToggleRowExpand(rowId) : void 0,
|
|
164
172
|
onRowClick: onRowClick ? () => onRowClick(row) : void 0
|
|
165
173
|
}
|
|
166
174
|
) : null
|
|
@@ -175,12 +183,23 @@ function TableRow({
|
|
|
175
183
|
}
|
|
176
184
|
);
|
|
177
185
|
}
|
|
178
|
-
function
|
|
186
|
+
function RowActions({
|
|
179
187
|
rowId,
|
|
180
188
|
items,
|
|
189
|
+
expandable,
|
|
190
|
+
isExpanded,
|
|
191
|
+
onToggleExpand,
|
|
181
192
|
onRowClick
|
|
182
193
|
}) {
|
|
183
194
|
const toggleRef = useRef(null);
|
|
195
|
+
const expandItem = expandable ? {
|
|
196
|
+
label: "Udvid r\xE6kke",
|
|
197
|
+
active: isExpanded,
|
|
198
|
+
icon: /* @__PURE__ */ jsx(ChevronsUpDown, { size: 16 }),
|
|
199
|
+
onClick: () => onToggleExpand == null ? void 0 : onToggleExpand()
|
|
200
|
+
} : null;
|
|
201
|
+
const menuItems = [...expandItem ? [expandItem] : [], ...items != null ? items : []];
|
|
202
|
+
const hasMenu = Boolean(menuItems.length);
|
|
184
203
|
return /* @__PURE__ */ jsx(
|
|
185
204
|
"div",
|
|
186
205
|
{
|
|
@@ -188,15 +207,17 @@ function RowContextMenu({
|
|
|
188
207
|
"data-row-context-menu": "true",
|
|
189
208
|
onClick: (e) => {
|
|
190
209
|
var _a;
|
|
210
|
+
if (!hasMenu) return;
|
|
191
211
|
e.stopPropagation();
|
|
192
212
|
(_a = toggleRef.current) == null ? void 0 : _a.call(toggleRef, e);
|
|
193
213
|
},
|
|
194
214
|
onContextMenu: (e) => {
|
|
215
|
+
if (!hasMenu) return;
|
|
195
216
|
e.preventDefault();
|
|
196
217
|
e.stopPropagation();
|
|
197
218
|
onRowClick == null ? void 0 : onRowClick();
|
|
198
219
|
},
|
|
199
|
-
children: /* @__PURE__ */ jsx(
|
|
220
|
+
children: hasMenu ? /* @__PURE__ */ jsx(
|
|
200
221
|
Popover,
|
|
201
222
|
{
|
|
202
223
|
matchTriggerWidth: false,
|
|
@@ -223,7 +244,7 @@ function RowContextMenu({
|
|
|
223
244
|
}
|
|
224
245
|
);
|
|
225
246
|
},
|
|
226
|
-
children: (close) => /* @__PURE__ */ jsx(Menu, { children:
|
|
247
|
+
children: (close) => /* @__PURE__ */ jsx(Menu, { children: menuItems.map(
|
|
227
248
|
(item, index) => item.type === "header" ? /* @__PURE__ */ jsx(Menu.Header, { children: item.label }, index) : /* @__PURE__ */ jsx(
|
|
228
249
|
Menu.Item,
|
|
229
250
|
{
|
|
@@ -252,7 +273,7 @@ function RowContextMenu({
|
|
|
252
273
|
)
|
|
253
274
|
) })
|
|
254
275
|
}
|
|
255
|
-
)
|
|
276
|
+
) : null
|
|
256
277
|
}
|
|
257
278
|
);
|
|
258
279
|
}
|
|
@@ -73,7 +73,7 @@ function TableSettings({
|
|
|
73
73
|
children: (close) => /* @__PURE__ */ jsxRuntime.jsxs(Menu.Menu, { children: [
|
|
74
74
|
additionalSettings == null ? void 0 : additionalSettings(close),
|
|
75
75
|
/* @__PURE__ */ jsxRuntime.jsx(Menu.Menu.Item, { active: viewMode === "wrapped", children: /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", onClick: () => handleViewModeChange(viewMode, close), children: [
|
|
76
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.
|
|
76
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ListChevronsUpDown, {}),
|
|
77
77
|
"Ombryd tekst"
|
|
78
78
|
] }) }),
|
|
79
79
|
hideableColumns.length > 0 && onVisibleColumnIdsChange ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
3
|
+
import { ListChevronsUpDown, Settings } from 'lucide-react';
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
import { Button } from '../../../button/Button';
|
|
6
6
|
import { Menu } from '../../../menu/Menu';
|
|
@@ -71,7 +71,7 @@ function TableSettings({
|
|
|
71
71
|
children: (close) => /* @__PURE__ */ jsxs(Menu, { children: [
|
|
72
72
|
additionalSettings == null ? void 0 : additionalSettings(close),
|
|
73
73
|
/* @__PURE__ */ jsx(Menu.Item, { active: viewMode === "wrapped", children: /* @__PURE__ */ jsxs("button", { type: "button", onClick: () => handleViewModeChange(viewMode, close), children: [
|
|
74
|
-
/* @__PURE__ */ jsx(
|
|
74
|
+
/* @__PURE__ */ jsx(ListChevronsUpDown, {}),
|
|
75
75
|
"Ombryd tekst"
|
|
76
76
|
] }) }),
|
|
77
77
|
hideableColumns.length > 0 && onVisibleColumnIdsChange ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const SELECTION_COLUMN_PX = 40;
|
|
4
|
+
const ACTIONS_COLUMN_PX = 0;
|
|
4
5
|
const DEFAULT_COLUMN_PX = 150;
|
|
5
6
|
function getVisibleColumns(columns) {
|
|
6
7
|
return columns.filter((column) => !column.hidden);
|
|
@@ -44,6 +45,7 @@ function getCellDisplayValue(row, column) {
|
|
|
44
45
|
return empty;
|
|
45
46
|
}
|
|
46
47
|
|
|
48
|
+
exports.ACTIONS_COLUMN_PX = ACTIONS_COLUMN_PX;
|
|
47
49
|
exports.DEFAULT_COLUMN_PX = DEFAULT_COLUMN_PX;
|
|
48
50
|
exports.SELECTION_COLUMN_PX = SELECTION_COLUMN_PX;
|
|
49
51
|
exports.getAriaSort = getAriaSort;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { ColumnItem } from './Table.types';
|
|
3
3
|
export declare const SELECTION_COLUMN_PX: 40;
|
|
4
|
+
export declare const ACTIONS_COLUMN_PX: 0;
|
|
4
5
|
export declare const DEFAULT_COLUMN_PX: 150;
|
|
5
6
|
export type SortDirection = 'asc' | 'desc' | null;
|
|
6
7
|
export declare function getVisibleColumns<T>(columns: Array<ColumnItem<T>>): Array<ColumnItem<T>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const SELECTION_COLUMN_PX = 40;
|
|
2
|
+
const ACTIONS_COLUMN_PX = 0;
|
|
2
3
|
const DEFAULT_COLUMN_PX = 150;
|
|
3
4
|
function getVisibleColumns(columns) {
|
|
4
5
|
return columns.filter((column) => !column.hidden);
|
|
@@ -42,4 +43,4 @@ function getCellDisplayValue(row, column) {
|
|
|
42
43
|
return empty;
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
export { DEFAULT_COLUMN_PX, SELECTION_COLUMN_PX, getAriaSort, getCellDisplayValue, getHeaderLabel, getNextSortDirection, getVisibleColumns, isActiveSort, isModifierClick, shouldAllowWrap, shouldToggleOnKey };
|
|
46
|
+
export { ACTIONS_COLUMN_PX, DEFAULT_COLUMN_PX, SELECTION_COLUMN_PX, getAriaSort, getCellDisplayValue, getHeaderLabel, getNextSortDirection, getVisibleColumns, isActiveSort, isModifierClick, shouldAllowWrap, shouldToggleOnKey };
|
|
@@ -13,11 +13,9 @@ function getDeviceSize(width) {
|
|
|
13
13
|
return "desktop";
|
|
14
14
|
}
|
|
15
15
|
function useDeviceSize() {
|
|
16
|
-
const [deviceSize, setDeviceSize] = react.useState(
|
|
17
|
-
if (typeof window === "undefined") return "desktop";
|
|
18
|
-
return getDeviceSize(window.innerWidth);
|
|
19
|
-
});
|
|
16
|
+
const [deviceSize, setDeviceSize] = react.useState("desktop");
|
|
20
17
|
react.useEffect(() => {
|
|
18
|
+
setDeviceSize(getDeviceSize(window.innerWidth));
|
|
21
19
|
const mediaQueries = [
|
|
22
20
|
window.matchMedia(`(max-width: ${BREAKPOINTS.tablet - 1}px)`),
|
|
23
21
|
window.matchMedia(
|
|
@@ -11,11 +11,9 @@ function getDeviceSize(width) {
|
|
|
11
11
|
return "desktop";
|
|
12
12
|
}
|
|
13
13
|
function useDeviceSize() {
|
|
14
|
-
const [deviceSize, setDeviceSize] = useState(
|
|
15
|
-
if (typeof window === "undefined") return "desktop";
|
|
16
|
-
return getDeviceSize(window.innerWidth);
|
|
17
|
-
});
|
|
14
|
+
const [deviceSize, setDeviceSize] = useState("desktop");
|
|
18
15
|
useEffect(() => {
|
|
16
|
+
setDeviceSize(getDeviceSize(window.innerWidth));
|
|
19
17
|
const mediaQueries = [
|
|
20
18
|
window.matchMedia(`(max-width: ${BREAKPOINTS.tablet - 1}px)`),
|
|
21
19
|
window.matchMedia(
|
|
@@ -239,6 +239,12 @@ html {
|
|
|
239
239
|
--button-bg-primary-hover: var(--color-brand-hover);
|
|
240
240
|
--button-fg-primary: var(--color-fg-on-brand);
|
|
241
241
|
|
|
242
|
+
/* Product / logo lockup — generic defaults; apps with a custom identity
|
|
243
|
+
override these tokens only (see e.g. filmstriben-budget/theme.css) */
|
|
244
|
+
--color-logo: var(--color-brand);
|
|
245
|
+
--color-logo-bg: color-mix(in srgb, var(--color-logo) 10%, var(--color-bg-surface));
|
|
246
|
+
--color-logo-fg: var(--color-fg-default);
|
|
247
|
+
|
|
242
248
|
/* Tables */
|
|
243
249
|
--table-header-bg: light-dark(#f8f9fb, #1b2533);
|
|
244
250
|
--table-row-bg: light-dark(#ffffff, #111827);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* Filmstriben Budget theme entrypoint.
|
|
2
|
+
*
|
|
3
|
+
* Usage in the consuming app — only two imports needed:
|
|
4
|
+
* @import '@dbcdk/react-components/styles/themes/dbc/base.css';
|
|
5
|
+
* @import '@dbcdk/react-components/styles/themes/filmstriben-budget/theme.css';
|
|
6
|
+
*
|
|
7
|
+
* Pulls in the shared DBC color layer, then overrides only the
|
|
8
|
+
* --color-logo-* tokens. --color-brand and every other semantic/app color
|
|
9
|
+
* stay on the shared DBC palette — buttons, links, focus rings, selected
|
|
10
|
+
* states, charts, and warnings are unaffected.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
@import '../dbc/colors.css';
|
|
14
|
+
|
|
15
|
+
:root {
|
|
16
|
+
--filmstriben-yellow: #ffc107;
|
|
17
|
+
--filmstriben-black: #212529;
|
|
18
|
+
|
|
19
|
+
--color-logo: var(--filmstriben-yellow);
|
|
20
|
+
--color-logo-bg: color-mix(in srgb, var(--color-logo) 10%, var(--color-bg-surface));
|
|
21
|
+
--color-logo-fg: var(--filmstriben-black);
|
|
22
|
+
}
|
|
@@ -3,7 +3,15 @@
|
|
|
3
3
|
function formatDate(date, options = {}) {
|
|
4
4
|
const d = date instanceof Date ? date : new Date(date);
|
|
5
5
|
if (isNaN(d.getTime())) return "";
|
|
6
|
-
const {
|
|
6
|
+
const {
|
|
7
|
+
showTime = false,
|
|
8
|
+
showSeconds = false,
|
|
9
|
+
userFriendlyLabel = false,
|
|
10
|
+
timeOnly = false,
|
|
11
|
+
ignoreDate = false,
|
|
12
|
+
ignoreDateIfSame = false
|
|
13
|
+
} = options;
|
|
14
|
+
const useTimeOnly = timeOnly || ignoreDate;
|
|
7
15
|
const pad = (n) => n.toString().padStart(2, "0");
|
|
8
16
|
const formatTime = () => {
|
|
9
17
|
const hours = pad(d.getHours());
|
|
@@ -13,6 +21,12 @@ function formatDate(date, options = {}) {
|
|
|
13
21
|
return `${hours}:${minutes}:${seconds}`;
|
|
14
22
|
};
|
|
15
23
|
const isSameCalendarDay = (a, b) => a.getDate() === b.getDate() && a.getMonth() === b.getMonth() && a.getFullYear() === b.getFullYear();
|
|
24
|
+
if (useTimeOnly) {
|
|
25
|
+
return formatTime();
|
|
26
|
+
}
|
|
27
|
+
if (ignoreDateIfSame && isSameCalendarDay(d, /* @__PURE__ */ new Date())) {
|
|
28
|
+
return formatTime();
|
|
29
|
+
}
|
|
16
30
|
if (userFriendlyLabel) {
|
|
17
31
|
const now = /* @__PURE__ */ new Date();
|
|
18
32
|
const yesterday = new Date(now);
|
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Formats a Date as "dd/mm/yyyy"
|
|
2
|
+
* Formats a Date as "dd/mm/yyyy", "dd/mm/yyyy hh:mm:ss", or time-only.
|
|
3
3
|
* Optionally returns user-friendly Danish labels like "I dag" or "I går".
|
|
4
4
|
*
|
|
5
5
|
* Examples:
|
|
6
6
|
* - formatDate(new Date(), { userFriendlyLabel: true }) => "I dag"
|
|
7
7
|
* - formatDate(new Date(), { userFriendlyLabel: true, showTime: true }) => "I dag, kl. 14:30"
|
|
8
8
|
* - formatDate(date, { showTime: true }) => "10.03.2026 14:30"
|
|
9
|
+
* - formatDate(date, { timeOnly: true }) => "14:30"
|
|
10
|
+
* - formatDate(date, { showTime: true, ignoreDateIfSame: true }) => "14:30" for today, otherwise "10.03.2026 14:30"
|
|
9
11
|
*
|
|
10
12
|
* @param date - The Date or date-parsable value to format
|
|
11
13
|
* @param options.showTime - If true, append time "hh:mm" or "hh:mm:ss"
|
|
12
14
|
* @param options.showSeconds - If true, append seconds when showTime is enabled
|
|
13
15
|
* @param options.userFriendlyLabel - If true, use "I dag" / "I går" when applicable
|
|
16
|
+
* @param options.timeOnly - If true, return only the time portion
|
|
17
|
+
* @param options.ignoreDate - Alias for timeOnly
|
|
18
|
+
* @param options.ignoreDateIfSame - If true, return only the time when the date is today
|
|
14
19
|
* @returns A formatted string
|
|
15
20
|
*/
|
|
16
21
|
export declare function formatDate(date: Date | string | number, options?: {
|
|
17
22
|
showTime?: boolean;
|
|
18
23
|
showSeconds?: boolean;
|
|
19
24
|
userFriendlyLabel?: boolean;
|
|
25
|
+
timeOnly?: boolean;
|
|
26
|
+
ignoreDate?: boolean;
|
|
27
|
+
ignoreDateIfSame?: boolean;
|
|
20
28
|
}): string;
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
function formatDate(date, options = {}) {
|
|
2
2
|
const d = date instanceof Date ? date : new Date(date);
|
|
3
3
|
if (isNaN(d.getTime())) return "";
|
|
4
|
-
const {
|
|
4
|
+
const {
|
|
5
|
+
showTime = false,
|
|
6
|
+
showSeconds = false,
|
|
7
|
+
userFriendlyLabel = false,
|
|
8
|
+
timeOnly = false,
|
|
9
|
+
ignoreDate = false,
|
|
10
|
+
ignoreDateIfSame = false
|
|
11
|
+
} = options;
|
|
12
|
+
const useTimeOnly = timeOnly || ignoreDate;
|
|
5
13
|
const pad = (n) => n.toString().padStart(2, "0");
|
|
6
14
|
const formatTime = () => {
|
|
7
15
|
const hours = pad(d.getHours());
|
|
@@ -11,6 +19,12 @@ function formatDate(date, options = {}) {
|
|
|
11
19
|
return `${hours}:${minutes}:${seconds}`;
|
|
12
20
|
};
|
|
13
21
|
const isSameCalendarDay = (a, b) => a.getDate() === b.getDate() && a.getMonth() === b.getMonth() && a.getFullYear() === b.getFullYear();
|
|
22
|
+
if (useTimeOnly) {
|
|
23
|
+
return formatTime();
|
|
24
|
+
}
|
|
25
|
+
if (ignoreDateIfSame && isSameCalendarDay(d, /* @__PURE__ */ new Date())) {
|
|
26
|
+
return formatTime();
|
|
27
|
+
}
|
|
14
28
|
if (userFriendlyLabel) {
|
|
15
29
|
const now = /* @__PURE__ */ new Date();
|
|
16
30
|
const yesterday = new Date(now);
|