@equinor/apollo-components 1.9.0 → 1.10.1
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/index.d.ts +21 -10
- package/dist/index.js +133 -101
- package/dist/index.mjs +129 -97
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -64,14 +64,31 @@ interface RowConfig<T> {
|
|
|
64
64
|
onMouseEnter?: (row: Row<T>) => void;
|
|
65
65
|
onMouseLeave?: (row: Row<T>) => void;
|
|
66
66
|
}
|
|
67
|
+
declare type TruncateMode = 'wrap' | 'hover';
|
|
67
68
|
interface CellConfig<T> {
|
|
68
69
|
getStickyCellColor?: (cell: Cell<T, unknown>) => string;
|
|
69
70
|
getShouldHighlight?: (cell: Cell<T, unknown>) => boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Whether to wrap or truncate default cells. Accepts `"wrap"` or `"hover"` and or a function returning a boolean.
|
|
73
|
+
* Defauls to `"hover"` (i.e. all cells is truncated by default).
|
|
74
|
+
*
|
|
75
|
+
* ***Note**: This only applies to default cells. Custom cells need custom implementation.*
|
|
76
|
+
*/
|
|
77
|
+
truncateMode?: TruncateMode | ((cell: Cell<T, unknown>) => TruncateMode);
|
|
70
78
|
}
|
|
71
79
|
declare type RowSelectionMode = 'single' | 'multiple';
|
|
80
|
+
declare type TableLayout = 'auto' | 'fixed';
|
|
72
81
|
declare type DataTableConfig<T> = {
|
|
73
82
|
height?: string;
|
|
74
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Defaults to `'auto'`.
|
|
85
|
+
*
|
|
86
|
+
* `'auto'` determines column width based on cell content.
|
|
87
|
+
*
|
|
88
|
+
* `'fixed'` uses fixed column width. Specify width (`size` property) in ColumnDef.
|
|
89
|
+
* Default size is 150px.
|
|
90
|
+
*/
|
|
91
|
+
tableLayout?: TableLayout;
|
|
75
92
|
sortable?: boolean;
|
|
76
93
|
virtual?: boolean;
|
|
77
94
|
rowSelectionMode?: RowSelectionMode;
|
|
@@ -143,19 +160,13 @@ declare type DataTableCompoundProps = typeof DataTable$1 & {
|
|
|
143
160
|
};
|
|
144
161
|
declare const DataTable: DataTableCompoundProps;
|
|
145
162
|
|
|
146
|
-
declare function SelectColumnDef<T>(
|
|
163
|
+
declare function SelectColumnDef<T>(props?: DataTableConfig<T>): ColumnDef$1<T, any>;
|
|
147
164
|
|
|
148
165
|
declare const StickyCell: styled_components.StyledComponent<react.ForwardRefExoticComponent<CellProps & react.RefAttributes<HTMLTableCellElement>>, any, {} & CellProps, never>;
|
|
149
166
|
|
|
150
167
|
declare type TypographyProps = {
|
|
151
|
-
|
|
152
|
-
/** Requires noWrap prop in order to function */
|
|
153
|
-
showAllOnHover?: boolean;
|
|
168
|
+
truncate?: boolean;
|
|
154
169
|
} & TypographyProps$1;
|
|
155
|
-
/** A cell used to wrap text in EDS Typography
|
|
156
|
-
*
|
|
157
|
-
* Developed for Plant Tracker.
|
|
158
|
-
*/
|
|
159
170
|
declare const TypographyCustom: (props: TypographyProps) => JSX.Element;
|
|
160
171
|
|
|
161
|
-
export { AppShell, AppSidebar, CellConfig, ChipsCell, ColumnSelect, DataTable, DataTableCommonProps, DataTableConfig, DataTableProps, DataTableRawProps, DynamicCell, FilterConfig, HeaderConfig, HierarchyCell, RowConfig, RowSelectionMode, SelectColumnDef, StickyCell, TableHeader, TableRowWrapper, TableRowWrapperProps, TypographyCustom, capitalizeHeader, globalFilterAtom, prependSelectColumn, rowSelectionAtom, tableSortingAtom };
|
|
172
|
+
export { AppShell, AppSidebar, CellConfig, ChipsCell, ColumnSelect, DataTable, DataTableCommonProps, DataTableConfig, DataTableProps, DataTableRawProps, DynamicCell, FilterConfig, HeaderConfig, HierarchyCell, RowConfig, RowSelectionMode, SelectColumnDef, StickyCell, TableHeader, TableLayout, TableRowWrapper, TableRowWrapperProps, TruncateMode, TypographyCustom, capitalizeHeader, globalFilterAtom, prependSelectColumn, rowSelectionAtom, tableSortingAtom };
|
package/dist/index.js
CHANGED
|
@@ -61,6 +61,7 @@ var Wrapper = import_styled_components.default.div`
|
|
|
61
61
|
}
|
|
62
62
|
.--content-outlet {
|
|
63
63
|
flex: 1;
|
|
64
|
+
max-width: 100%;
|
|
64
65
|
}
|
|
65
66
|
`;
|
|
66
67
|
var AppShell = ({ children, icon, title, sidebar }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Wrapper, {
|
|
@@ -172,7 +173,10 @@ var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
|
172
173
|
var ChipsWrapper = import_styled_components3.default.div`
|
|
173
174
|
display: flex;
|
|
174
175
|
align-items: center;
|
|
176
|
+
flex-wrap: wrap;
|
|
175
177
|
gap: 0.25rem;
|
|
178
|
+
padding-top: 0.25rem;
|
|
179
|
+
padding-bottom: 0.25rem;
|
|
176
180
|
`;
|
|
177
181
|
var Chip = import_styled_components3.default.div`
|
|
178
182
|
border-radius: 25px;
|
|
@@ -226,10 +230,10 @@ var StickyHeaderCell = (0, import_styled_components4.default)(StickyCell)`
|
|
|
226
230
|
// src/cells/DynamicCell.tsx
|
|
227
231
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
228
232
|
var StyledStickyCell = (0, import_styled_components5.default)(StickyCell)`
|
|
229
|
-
${(
|
|
233
|
+
background-color: ${({ backgroundColor: bg }) => bg ? `${bg} !important` : `inherit`};
|
|
230
234
|
`;
|
|
231
235
|
var StyledCell = (0, import_styled_components5.default)(import_eds_core_react4.Table.Cell)`
|
|
232
|
-
${(
|
|
236
|
+
background-color: ${({ backgroundColor: bg }) => bg ? `${bg} !important` : `inherit`};
|
|
233
237
|
`;
|
|
234
238
|
function DynamicCell({ cell, highlight, getStickyCellColor }) {
|
|
235
239
|
var _a;
|
|
@@ -263,53 +267,48 @@ var truncateStyle = {
|
|
|
263
267
|
textOverflow: "ellipsis"
|
|
264
268
|
};
|
|
265
269
|
var TypographyCustom = (props) => {
|
|
266
|
-
const {
|
|
267
|
-
if (
|
|
268
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.
|
|
269
|
-
children:
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
whiteSpace: "nowrap"
|
|
277
|
-
}
|
|
278
|
-
})
|
|
279
|
-
}),
|
|
280
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_eds_core_react5.Typography, {
|
|
281
|
-
...edsTypographyProps,
|
|
282
|
-
style: {
|
|
283
|
-
...styleFromProps,
|
|
284
|
-
...truncateStyle
|
|
285
|
-
}
|
|
286
|
-
})
|
|
287
|
-
]
|
|
270
|
+
const { truncate, style: styleFromProps, ...edsTypographyProps } = props;
|
|
271
|
+
if (truncate)
|
|
272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HoverCapture, {
|
|
273
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_eds_core_react5.Typography, {
|
|
274
|
+
...edsTypographyProps,
|
|
275
|
+
style: {
|
|
276
|
+
...styleFromProps,
|
|
277
|
+
...truncateStyle
|
|
278
|
+
}
|
|
279
|
+
})
|
|
288
280
|
});
|
|
289
281
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_eds_core_react5.Typography, {
|
|
290
282
|
...edsTypographyProps,
|
|
291
|
-
style:
|
|
283
|
+
style: styleFromProps
|
|
292
284
|
});
|
|
293
285
|
};
|
|
294
286
|
var HoverCapture = import_styled_components6.default.div`
|
|
287
|
+
padding: 0.5em 0;
|
|
288
|
+
margin: -0.5em 0;
|
|
289
|
+
height: ${import_eds_tokens3.tokens.typography.table.cell_text.lineHeight};
|
|
290
|
+
background-color: inherit;
|
|
291
|
+
|
|
295
292
|
position: relative;
|
|
296
|
-
|
|
293
|
+
width: 100%;
|
|
297
294
|
|
|
298
|
-
|
|
299
|
-
|
|
295
|
+
&:hover {
|
|
296
|
+
z-index: 1;
|
|
297
|
+
}
|
|
300
298
|
|
|
301
|
-
|
|
302
|
-
|
|
299
|
+
& > * {
|
|
300
|
+
width: inherit;
|
|
301
|
+
position: absolute;
|
|
303
302
|
}
|
|
304
|
-
`;
|
|
305
|
-
var ShowAllWrapperWrapper = import_styled_components6.default.div`
|
|
306
|
-
position: absolute;
|
|
307
|
-
z-index: 1;
|
|
308
|
-
pointer-events: none;
|
|
309
303
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
304
|
+
&:hover > * {
|
|
305
|
+
width: auto;
|
|
306
|
+
z-index: 1;
|
|
307
|
+
padding: 0.5em 1em;
|
|
308
|
+
margin: -0.5em -1em;
|
|
309
|
+
|
|
310
|
+
background-color: inherit;
|
|
311
|
+
}
|
|
313
312
|
`;
|
|
314
313
|
|
|
315
314
|
// src/cells/HierarchyCell.tsx
|
|
@@ -358,15 +357,18 @@ var CellWrapper2 = import_styled_components8.default.div`
|
|
|
358
357
|
margin-left: -16px;
|
|
359
358
|
z-index: 2;
|
|
360
359
|
`;
|
|
361
|
-
function SelectColumnDef(
|
|
360
|
+
function SelectColumnDef(props = {}) {
|
|
361
|
+
const selectionMode = props.rowSelectionMode;
|
|
362
|
+
const showBothSelectAndSubRowsToggle = props.hideExpandControls === false;
|
|
362
363
|
return {
|
|
363
364
|
id: "select",
|
|
365
|
+
size: showBothSelectAndSubRowsToggle ? 96 : 48,
|
|
364
366
|
header: ({ table }) => selectionMode !== "single" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CellWrapper2, {
|
|
365
367
|
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_eds_core_react6.Checkbox, {
|
|
366
368
|
checked: table.getIsAllRowsSelected(),
|
|
367
369
|
indeterminate: table.getIsSomeRowsSelected(),
|
|
368
370
|
"aria-label": table.getIsAllRowsSelected() ? "Deselect all rows" : "Select all rows",
|
|
369
|
-
onChange: table.getToggleAllRowsSelectedHandler()
|
|
371
|
+
onChange: table.getIsSomeRowsSelected() ? () => table.toggleAllRowsSelected(false) : table.getToggleAllRowsSelectedHandler()
|
|
370
372
|
})
|
|
371
373
|
}) : null,
|
|
372
374
|
cell: ({ table, row }) => {
|
|
@@ -405,10 +407,10 @@ function SelectColumnDef(selectionMode) {
|
|
|
405
407
|
|
|
406
408
|
// src/DataTable/DataTableRaw.tsx
|
|
407
409
|
var import_react4 = require("react");
|
|
408
|
-
var
|
|
410
|
+
var import_styled_components16 = __toESM(require("styled-components"));
|
|
409
411
|
|
|
410
412
|
// src/DataTable/components/BasicTable.tsx
|
|
411
|
-
var
|
|
413
|
+
var import_eds_core_react12 = require("@equinor/eds-core-react");
|
|
412
414
|
|
|
413
415
|
// src/DataTable/components/PlaceholderRow.tsx
|
|
414
416
|
var import_eds_core_react7 = require("@equinor/eds-core-react");
|
|
@@ -433,16 +435,25 @@ function PlaceholderRow({ isLoading }) {
|
|
|
433
435
|
});
|
|
434
436
|
}
|
|
435
437
|
|
|
438
|
+
// src/DataTable/components/TableBody.tsx
|
|
439
|
+
var import_eds_core_react8 = require("@equinor/eds-core-react");
|
|
440
|
+
var import_styled_components10 = __toESM(require("styled-components"));
|
|
441
|
+
var TableBody = (0, import_styled_components10.default)(import_eds_core_react8.Table.Body)`
|
|
442
|
+
// The following attribute are important for fixed column width
|
|
443
|
+
// CHANGE THES WITH CAUTION
|
|
444
|
+
background: inherit;
|
|
445
|
+
`;
|
|
446
|
+
|
|
436
447
|
// src/DataTable/components/TableHeader.tsx
|
|
437
|
-
var
|
|
448
|
+
var import_eds_core_react10 = require("@equinor/eds-core-react");
|
|
438
449
|
|
|
439
450
|
// src/cells/HeaderCell.tsx
|
|
440
|
-
var
|
|
451
|
+
var import_eds_core_react9 = require("@equinor/eds-core-react");
|
|
441
452
|
var import_eds_icons4 = require("@equinor/eds-icons");
|
|
442
453
|
var import_react_table2 = require("@tanstack/react-table");
|
|
443
|
-
var
|
|
454
|
+
var import_styled_components11 = __toESM(require("styled-components"));
|
|
444
455
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
445
|
-
var HeaderDiv =
|
|
456
|
+
var HeaderDiv = import_styled_components11.default.div`
|
|
446
457
|
display: flex;
|
|
447
458
|
align-items: center;
|
|
448
459
|
gap: 0.25rem;
|
|
@@ -451,7 +462,7 @@ var HeaderDiv = import_styled_components10.default.div`
|
|
|
451
462
|
var HeaderCell = ({ header }) => {
|
|
452
463
|
var _a;
|
|
453
464
|
const style = {
|
|
454
|
-
width: header.column.getSize()
|
|
465
|
+
width: header.column.getSize()
|
|
455
466
|
};
|
|
456
467
|
const cellProps = {
|
|
457
468
|
style,
|
|
@@ -467,7 +478,7 @@ var HeaderCell = ({ header }) => {
|
|
|
467
478
|
})
|
|
468
479
|
}, header.id);
|
|
469
480
|
}
|
|
470
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_eds_core_react9.Table.Cell, {
|
|
471
482
|
...cellProps,
|
|
472
483
|
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(HeaderContent, {
|
|
473
484
|
header
|
|
@@ -481,13 +492,13 @@ function HeaderContent({ header }) {
|
|
|
481
492
|
children: [
|
|
482
493
|
(0, import_react_table2.flexRender)(header.column.columnDef.header, header.getContext()),
|
|
483
494
|
{
|
|
484
|
-
asc: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
495
|
+
asc: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_eds_core_react9.Icon, {
|
|
485
496
|
data: import_eds_icons4.arrow_drop_up
|
|
486
497
|
}),
|
|
487
|
-
desc: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
498
|
+
desc: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_eds_core_react9.Icon, {
|
|
488
499
|
data: import_eds_icons4.arrow_drop_down
|
|
489
500
|
}),
|
|
490
|
-
none: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
501
|
+
none: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_eds_core_react9.Icon, {
|
|
491
502
|
data: import_eds_icons4.arrow_drop_down
|
|
492
503
|
})
|
|
493
504
|
}[header.column.getIsSorted()] ?? null
|
|
@@ -510,9 +521,9 @@ function getSort({ column }) {
|
|
|
510
521
|
// src/DataTable/components/TableHeader.tsx
|
|
511
522
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
512
523
|
function TableHeader({ table, sticky }) {
|
|
513
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_eds_core_react10.Table.Head, {
|
|
514
525
|
sticky,
|
|
515
|
-
children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
526
|
+
children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_eds_core_react10.Table.Row, {
|
|
516
527
|
children: headerGroup.headers.map((header) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(HeaderCell, {
|
|
517
528
|
header
|
|
518
529
|
}, header.id))
|
|
@@ -521,12 +532,13 @@ function TableHeader({ table, sticky }) {
|
|
|
521
532
|
}
|
|
522
533
|
|
|
523
534
|
// src/DataTable/components/TableRow.tsx
|
|
524
|
-
var
|
|
535
|
+
var import_eds_core_react11 = require("@equinor/eds-core-react");
|
|
536
|
+
var import_styled_components12 = __toESM(require("styled-components"));
|
|
525
537
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
526
538
|
function TableRow({ row, rowConfig, cellConfig }) {
|
|
527
539
|
var _a;
|
|
528
540
|
const rowWrapper = rowConfig == null ? void 0 : rowConfig.rowWrapper;
|
|
529
|
-
const tableRowContent = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
541
|
+
const tableRowContent = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(StyledTableRow, {
|
|
530
542
|
active: row.getIsSelected(),
|
|
531
543
|
style: {
|
|
532
544
|
cursor: (rowConfig == null ? void 0 : rowConfig.onClick) ? "pointer" : "initial",
|
|
@@ -549,6 +561,10 @@ function TableRow({ row, rowConfig, cellConfig }) {
|
|
|
549
561
|
});
|
|
550
562
|
return rowWrapper ? rowWrapper({ row, children: tableRowContent }) : tableRowContent;
|
|
551
563
|
}
|
|
564
|
+
var StyledTableRow = (0, import_styled_components12.default)(import_eds_core_react11.Table.Row)`
|
|
565
|
+
/* Background color must be inherited here. Does not work with inline styling */
|
|
566
|
+
background-color: inherit;
|
|
567
|
+
`;
|
|
552
568
|
function handleRowEvent(row, handler) {
|
|
553
569
|
if (!handler)
|
|
554
570
|
return void 0;
|
|
@@ -567,13 +583,13 @@ function BasicTable({
|
|
|
567
583
|
isLoading
|
|
568
584
|
}) {
|
|
569
585
|
const tableRows = table.getRowModel().rows;
|
|
570
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
586
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_eds_core_react12.Table, {
|
|
571
587
|
children: [
|
|
572
588
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableHeader, {
|
|
573
589
|
sticky: stickyHeader,
|
|
574
590
|
table
|
|
575
591
|
}),
|
|
576
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
592
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableBody, {
|
|
577
593
|
children: tableRows.length ? tableRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableRow, {
|
|
578
594
|
row,
|
|
579
595
|
rowConfig,
|
|
@@ -587,10 +603,10 @@ function BasicTable({
|
|
|
587
603
|
}
|
|
588
604
|
|
|
589
605
|
// src/DataTable/components/DataTableHeader.tsx
|
|
590
|
-
var
|
|
606
|
+
var import_eds_core_react15 = require("@equinor/eds-core-react");
|
|
591
607
|
var import_eds_icons7 = require("@equinor/eds-icons");
|
|
592
608
|
var import_jotai2 = require("jotai");
|
|
593
|
-
var
|
|
609
|
+
var import_styled_components15 = __toESM(require("styled-components"));
|
|
594
610
|
|
|
595
611
|
// src/DataTable/atoms.ts
|
|
596
612
|
var import_jotai = require("jotai");
|
|
@@ -601,15 +617,15 @@ var tableSortingAtom = (0, import_jotai.atom)([]);
|
|
|
601
617
|
var expandedRowsAtom = (0, import_jotai.atom)({});
|
|
602
618
|
|
|
603
619
|
// src/DataTable/filters/DebouncedInput.tsx
|
|
604
|
-
var
|
|
620
|
+
var import_eds_core_react13 = require("@equinor/eds-core-react");
|
|
605
621
|
var import_eds_icons5 = require("@equinor/eds-icons");
|
|
606
622
|
var import_react2 = require("react");
|
|
607
|
-
var
|
|
623
|
+
var import_styled_components13 = __toESM(require("styled-components"));
|
|
608
624
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
609
|
-
var Wrapper3 =
|
|
625
|
+
var Wrapper3 = import_styled_components13.default.div`
|
|
610
626
|
width: 200px;
|
|
611
627
|
`;
|
|
612
|
-
var CloseButton = (0,
|
|
628
|
+
var CloseButton = (0, import_styled_components13.default)(import_eds_core_react13.Button)`
|
|
613
629
|
width: 24px;
|
|
614
630
|
height: 24px;
|
|
615
631
|
`;
|
|
@@ -631,20 +647,20 @@ function DebouncedInput({
|
|
|
631
647
|
return () => clearTimeout(timeout);
|
|
632
648
|
}, [value]);
|
|
633
649
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Wrapper3, {
|
|
634
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
650
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react13.Input, {
|
|
635
651
|
...props,
|
|
636
652
|
value,
|
|
637
|
-
leftAdornments: icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
653
|
+
leftAdornments: icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react13.Icon, {
|
|
638
654
|
name: icon.name,
|
|
639
655
|
data: icon,
|
|
640
656
|
size: 18
|
|
641
657
|
}),
|
|
642
|
-
rightAdornments: !!value && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
658
|
+
rightAdornments: !!value && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react13.Tooltip, {
|
|
643
659
|
title: "Clear input",
|
|
644
660
|
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CloseButton, {
|
|
645
661
|
variant: "ghost_icon",
|
|
646
662
|
onClick: () => setValue(""),
|
|
647
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
663
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react13.Icon, {
|
|
648
664
|
name: import_eds_icons5.close.name,
|
|
649
665
|
data: import_eds_icons5.close,
|
|
650
666
|
size: 18
|
|
@@ -667,10 +683,10 @@ var fuzzyFilter = (row, columnId, value, addMeta) => {
|
|
|
667
683
|
};
|
|
668
684
|
|
|
669
685
|
// src/DataTable/components/ColumnSelect.tsx
|
|
670
|
-
var
|
|
686
|
+
var import_eds_core_react14 = require("@equinor/eds-core-react");
|
|
671
687
|
var import_eds_icons6 = require("@equinor/eds-icons");
|
|
672
688
|
var import_react3 = require("react");
|
|
673
|
-
var
|
|
689
|
+
var import_styled_components14 = __toESM(require("styled-components"));
|
|
674
690
|
|
|
675
691
|
// src/DataTable/utils.tsx
|
|
676
692
|
function capitalizeHeader(context) {
|
|
@@ -690,18 +706,25 @@ function prependSelectColumn(columns, config) {
|
|
|
690
706
|
if (!(config == null ? void 0 : config.selectColumn))
|
|
691
707
|
return columns;
|
|
692
708
|
if (config.selectColumn === "default")
|
|
693
|
-
return [SelectColumnDef(config
|
|
709
|
+
return [SelectColumnDef(config), ...columns];
|
|
694
710
|
return [config.selectColumn(), ...columns];
|
|
695
711
|
}
|
|
712
|
+
function getFunctionValueOrDefault(valueOrFn, fnProps, defaultValue) {
|
|
713
|
+
if (valueOrFn === void 0)
|
|
714
|
+
return defaultValue;
|
|
715
|
+
if (typeof valueOrFn === "function")
|
|
716
|
+
return valueOrFn(fnProps);
|
|
717
|
+
return valueOrFn;
|
|
718
|
+
}
|
|
696
719
|
|
|
697
720
|
// src/DataTable/components/ColumnSelect.tsx
|
|
698
721
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
699
|
-
var ColumnSelectContent =
|
|
722
|
+
var ColumnSelectContent = import_styled_components14.default.div`
|
|
700
723
|
display: grid;
|
|
701
724
|
grid-template-columns: repeat(2, 1fr);
|
|
702
725
|
grid-gap: 0.5rem;
|
|
703
726
|
`;
|
|
704
|
-
var ActionsWrapper =
|
|
727
|
+
var ActionsWrapper = import_styled_components14.default.div`
|
|
705
728
|
display: flex;
|
|
706
729
|
align-items: center;
|
|
707
730
|
justify-content: flex-end;
|
|
@@ -713,7 +736,7 @@ function ColumnSelect({ table }) {
|
|
|
713
736
|
const selectableColumns = table.getAllLeafColumns().filter((column) => column.id !== "select");
|
|
714
737
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, {
|
|
715
738
|
children: [
|
|
716
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
739
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react14.Button, {
|
|
717
740
|
"aria-haspopup": true,
|
|
718
741
|
id: "column-select-anchor",
|
|
719
742
|
"aria-controls": "column-select-popover",
|
|
@@ -721,28 +744,28 @@ function ColumnSelect({ table }) {
|
|
|
721
744
|
ref: referenceElement,
|
|
722
745
|
variant: "ghost_icon",
|
|
723
746
|
onClick: () => setIsOpen(true),
|
|
724
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
747
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react14.Icon, {
|
|
725
748
|
name: "view_column",
|
|
726
749
|
data: import_eds_icons6.view_column
|
|
727
750
|
})
|
|
728
751
|
}),
|
|
729
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
752
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_eds_core_react14.Popover, {
|
|
730
753
|
open: isOpen,
|
|
731
754
|
id: "column-select-popover",
|
|
732
755
|
anchorEl: referenceElement.current,
|
|
733
756
|
placement: "bottom-end",
|
|
734
757
|
onClose: () => setIsOpen(false),
|
|
735
758
|
children: [
|
|
736
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
759
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_eds_core_react14.Popover.Header, {
|
|
737
760
|
children: [
|
|
738
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
761
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react14.Popover.Title, {
|
|
739
762
|
children: "Column settings"
|
|
740
763
|
}),
|
|
741
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
764
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react14.Button, {
|
|
742
765
|
variant: "ghost_icon",
|
|
743
766
|
"aria-label": "Close column select",
|
|
744
767
|
onClick: () => setIsOpen(false),
|
|
745
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
768
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react14.Icon, {
|
|
746
769
|
name: "close",
|
|
747
770
|
data: import_eds_icons6.close,
|
|
748
771
|
size: 24
|
|
@@ -750,22 +773,22 @@ function ColumnSelect({ table }) {
|
|
|
750
773
|
})
|
|
751
774
|
]
|
|
752
775
|
}),
|
|
753
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
776
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_eds_core_react14.Popover.Content, {
|
|
754
777
|
children: [
|
|
755
778
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ColumnSelectContent, {
|
|
756
779
|
children: selectableColumns.map((column) => {
|
|
757
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
780
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react14.Checkbox, {
|
|
758
781
|
checked: column.getIsVisible(),
|
|
759
782
|
label: getColumnHeader(column),
|
|
760
783
|
onChange: column.getToggleVisibilityHandler()
|
|
761
784
|
}, column.id);
|
|
762
785
|
})
|
|
763
786
|
}),
|
|
764
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
787
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react14.Divider, {
|
|
765
788
|
variant: "small"
|
|
766
789
|
}),
|
|
767
790
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ActionsWrapper, {
|
|
768
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
791
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react14.Button, {
|
|
769
792
|
color: "secondary",
|
|
770
793
|
variant: "ghost",
|
|
771
794
|
disabled: table.getIsAllColumnsVisible(),
|
|
@@ -783,14 +806,14 @@ function ColumnSelect({ table }) {
|
|
|
783
806
|
|
|
784
807
|
// src/DataTable/components/DataTableHeader.tsx
|
|
785
808
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
786
|
-
var DataTableHeaderWrapper =
|
|
809
|
+
var DataTableHeaderWrapper = import_styled_components15.default.div`
|
|
787
810
|
display: flex;
|
|
788
811
|
align-items: center;
|
|
789
812
|
justify-content: space-between;
|
|
790
813
|
gap: 0.5rem;
|
|
791
814
|
padding: ${(props) => props.captionPadding ?? "1rem"};
|
|
792
815
|
`;
|
|
793
|
-
var FilterContainer =
|
|
816
|
+
var FilterContainer = import_styled_components15.default.div`
|
|
794
817
|
display: flex;
|
|
795
818
|
align-items: center;
|
|
796
819
|
gap: 1rem;
|
|
@@ -803,7 +826,7 @@ function DataTableHeader({ config, table, ...props }) {
|
|
|
803
826
|
className: "--table-caption",
|
|
804
827
|
captionPadding: props.captionPadding,
|
|
805
828
|
children: [
|
|
806
|
-
(props == null ? void 0 : props.tableCaption) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
829
|
+
(props == null ? void 0 : props.tableCaption) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_eds_core_react15.Typography, {
|
|
807
830
|
variant: "h3",
|
|
808
831
|
children: props == null ? void 0 : props.tableCaption
|
|
809
832
|
}),
|
|
@@ -829,17 +852,17 @@ function DataTableHeader({ config, table, ...props }) {
|
|
|
829
852
|
}
|
|
830
853
|
|
|
831
854
|
// src/DataTable/components/VirtualTable.tsx
|
|
832
|
-
var
|
|
855
|
+
var import_eds_core_react17 = require("@equinor/eds-core-react");
|
|
833
856
|
var import_react_virtual = require("@tanstack/react-virtual");
|
|
834
857
|
|
|
835
858
|
// src/DataTable/components/PaddingRow.tsx
|
|
836
|
-
var
|
|
859
|
+
var import_eds_core_react16 = require("@equinor/eds-core-react");
|
|
837
860
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
838
861
|
var PaddingRow = (props) => {
|
|
839
862
|
if (!props.height)
|
|
840
863
|
return null;
|
|
841
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
842
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
864
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_eds_core_react16.Table.Row, {
|
|
865
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_eds_core_react16.Table.Cell, {
|
|
843
866
|
style: { height: `${props.height}px` }
|
|
844
867
|
})
|
|
845
868
|
});
|
|
@@ -864,13 +887,13 @@ function VirtualTable({
|
|
|
864
887
|
const virtualRows = rowVirtualizer.getVirtualItems();
|
|
865
888
|
const paddingTop = virtualRows.length > 0 ? ((_a = virtualRows == null ? void 0 : virtualRows[0]) == null ? void 0 : _a.start) || 0 : 0;
|
|
866
889
|
const paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (((_b = virtualRows == null ? void 0 : virtualRows[virtualRows.length - 1]) == null ? void 0 : _b.end) || 0) : 0;
|
|
867
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_eds_core_react17.Table, {
|
|
868
891
|
children: [
|
|
869
892
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TableHeader, {
|
|
870
893
|
sticky: props.stickyHeader,
|
|
871
894
|
table
|
|
872
895
|
}),
|
|
873
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
896
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(TableBody, {
|
|
874
897
|
children: [
|
|
875
898
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PaddingRow, {
|
|
876
899
|
height: paddingTop
|
|
@@ -896,7 +919,7 @@ function VirtualTable({
|
|
|
896
919
|
|
|
897
920
|
// src/DataTable/DataTableRaw.tsx
|
|
898
921
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
899
|
-
var DataTableWrapper =
|
|
922
|
+
var DataTableWrapper = import_styled_components16.default.div`
|
|
900
923
|
width: ${(props) => props.width ?? "100%"};
|
|
901
924
|
|
|
902
925
|
.--table-container {
|
|
@@ -906,17 +929,22 @@ var DataTableWrapper = import_styled_components14.default.div`
|
|
|
906
929
|
|
|
907
930
|
table {
|
|
908
931
|
width: 100%;
|
|
909
|
-
|
|
932
|
+
|
|
933
|
+
// The following attributes are important for fixed column width
|
|
934
|
+
// CHANGE THES WITH CAUTION
|
|
935
|
+
overflow: auto;
|
|
936
|
+
table-layout: ${(props) => props.tableLayout ?? "auto"};
|
|
910
937
|
}
|
|
911
938
|
}
|
|
912
939
|
`;
|
|
913
940
|
function DataTableRaw(props) {
|
|
914
|
-
const { isLoading, header, filters, config, rowConfig, table } = props;
|
|
941
|
+
const { isLoading, header, filters, config, rowConfig, cellConfig, table } = props;
|
|
915
942
|
const tableContainerRef = (0, import_react4.useRef)(null);
|
|
916
943
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DataTableWrapper, {
|
|
917
944
|
captionPadding: header == null ? void 0 : header.captionPadding,
|
|
918
945
|
height: config == null ? void 0 : config.height,
|
|
919
946
|
width: config == null ? void 0 : config.width,
|
|
947
|
+
tableLayout: config == null ? void 0 : config.tableLayout,
|
|
920
948
|
children: [
|
|
921
949
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DataTableHeader, {
|
|
922
950
|
tableCaption: header == null ? void 0 : header.tableCaption,
|
|
@@ -931,11 +959,13 @@ function DataTableRaw(props) {
|
|
|
931
959
|
containerRef: tableContainerRef,
|
|
932
960
|
table,
|
|
933
961
|
rowConfig,
|
|
962
|
+
cellConfig,
|
|
934
963
|
isLoading,
|
|
935
964
|
stickyHeader: header == null ? void 0 : header.stickyHeader
|
|
936
965
|
}) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(BasicTable, {
|
|
937
966
|
table,
|
|
938
967
|
rowConfig,
|
|
968
|
+
cellConfig,
|
|
939
969
|
isLoading,
|
|
940
970
|
stickyHeader: header == null ? void 0 : header.stickyHeader
|
|
941
971
|
})
|
|
@@ -950,7 +980,7 @@ var import_jotai3 = require("jotai");
|
|
|
950
980
|
var import_react5 = require("react");
|
|
951
981
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
952
982
|
function useDataTable(props) {
|
|
953
|
-
const { columns, data, filters, config,
|
|
983
|
+
const { columns, data, filters, config, cellConfig } = props;
|
|
954
984
|
const [columnVisibility, setColumnVisibility] = (0, import_jotai3.useAtom)(columnVisibilityAtom);
|
|
955
985
|
const [globalFilter, setGlobalFilter] = (0, import_jotai3.useAtom)(globalFilterAtom);
|
|
956
986
|
const [sorting, setSorting] = (0, import_jotai3.useAtom)(tableSortingAtom);
|
|
@@ -971,12 +1001,14 @@ function useDataTable(props) {
|
|
|
971
1001
|
columnVisibility
|
|
972
1002
|
},
|
|
973
1003
|
defaultColumn: {
|
|
974
|
-
cell: (cell) =>
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
1004
|
+
cell: ({ cell }) => {
|
|
1005
|
+
const truncateMode = getFunctionValueOrDefault(cellConfig == null ? void 0 : cellConfig.truncateMode, cell, "hover");
|
|
1006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TypographyCustom, {
|
|
1007
|
+
truncate: truncateMode === "hover",
|
|
1008
|
+
children: cell.getValue()
|
|
1009
|
+
});
|
|
1010
|
+
}
|
|
978
1011
|
},
|
|
979
|
-
meta,
|
|
980
1012
|
enableSorting: config == null ? void 0 : config.sortable,
|
|
981
1013
|
enableExpanding: !(config == null ? void 0 : config.hideExpandControls),
|
|
982
1014
|
enableMultiRowSelection: (config == null ? void 0 : config.rowSelectionMode) === "multiple",
|
package/dist/index.mjs
CHANGED
|
@@ -14,6 +14,7 @@ var Wrapper = styled.div`
|
|
|
14
14
|
}
|
|
15
15
|
.--content-outlet {
|
|
16
16
|
flex: 1;
|
|
17
|
+
max-width: 100%;
|
|
17
18
|
}
|
|
18
19
|
`;
|
|
19
20
|
var AppShell = ({ children, icon, title, sidebar }) => /* @__PURE__ */ jsxs(Wrapper, {
|
|
@@ -125,7 +126,10 @@ import { jsx as jsx3 } from "react/jsx-runtime";
|
|
|
125
126
|
var ChipsWrapper = styled3.div`
|
|
126
127
|
display: flex;
|
|
127
128
|
align-items: center;
|
|
129
|
+
flex-wrap: wrap;
|
|
128
130
|
gap: 0.25rem;
|
|
131
|
+
padding-top: 0.25rem;
|
|
132
|
+
padding-bottom: 0.25rem;
|
|
129
133
|
`;
|
|
130
134
|
var Chip = styled3.div`
|
|
131
135
|
border-radius: 25px;
|
|
@@ -179,10 +183,10 @@ var StickyHeaderCell = styled4(StickyCell)`
|
|
|
179
183
|
// src/cells/DynamicCell.tsx
|
|
180
184
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
181
185
|
var StyledStickyCell = styled5(StickyCell)`
|
|
182
|
-
${(
|
|
186
|
+
background-color: ${({ backgroundColor: bg }) => bg ? `${bg} !important` : `inherit`};
|
|
183
187
|
`;
|
|
184
188
|
var StyledCell = styled5(Table2.Cell)`
|
|
185
|
-
${(
|
|
189
|
+
background-color: ${({ backgroundColor: bg }) => bg ? `${bg} !important` : `inherit`};
|
|
186
190
|
`;
|
|
187
191
|
function DynamicCell({ cell, highlight, getStickyCellColor }) {
|
|
188
192
|
var _a;
|
|
@@ -211,64 +215,59 @@ import {
|
|
|
211
215
|
} from "@equinor/eds-core-react";
|
|
212
216
|
import { tokens as tokens3 } from "@equinor/eds-tokens";
|
|
213
217
|
import styled6 from "styled-components";
|
|
214
|
-
import { jsx as jsx5
|
|
218
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
215
219
|
var truncateStyle = {
|
|
216
220
|
overflow: "hidden",
|
|
217
221
|
whiteSpace: "nowrap",
|
|
218
222
|
textOverflow: "ellipsis"
|
|
219
223
|
};
|
|
220
224
|
var TypographyCustom = (props) => {
|
|
221
|
-
const {
|
|
222
|
-
if (
|
|
223
|
-
return /* @__PURE__ */
|
|
224
|
-
children:
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
whiteSpace: "nowrap"
|
|
232
|
-
}
|
|
233
|
-
})
|
|
234
|
-
}),
|
|
235
|
-
/* @__PURE__ */ jsx5(EdsTypography, {
|
|
236
|
-
...edsTypographyProps,
|
|
237
|
-
style: {
|
|
238
|
-
...styleFromProps,
|
|
239
|
-
...truncateStyle
|
|
240
|
-
}
|
|
241
|
-
})
|
|
242
|
-
]
|
|
225
|
+
const { truncate, style: styleFromProps, ...edsTypographyProps } = props;
|
|
226
|
+
if (truncate)
|
|
227
|
+
return /* @__PURE__ */ jsx5(HoverCapture, {
|
|
228
|
+
children: /* @__PURE__ */ jsx5(EdsTypography, {
|
|
229
|
+
...edsTypographyProps,
|
|
230
|
+
style: {
|
|
231
|
+
...styleFromProps,
|
|
232
|
+
...truncateStyle
|
|
233
|
+
}
|
|
234
|
+
})
|
|
243
235
|
});
|
|
244
236
|
return /* @__PURE__ */ jsx5(EdsTypography, {
|
|
245
237
|
...edsTypographyProps,
|
|
246
|
-
style:
|
|
238
|
+
style: styleFromProps
|
|
247
239
|
});
|
|
248
240
|
};
|
|
249
241
|
var HoverCapture = styled6.div`
|
|
242
|
+
padding: 0.5em 0;
|
|
243
|
+
margin: -0.5em 0;
|
|
244
|
+
height: ${tokens3.typography.table.cell_text.lineHeight};
|
|
245
|
+
background-color: inherit;
|
|
246
|
+
|
|
250
247
|
position: relative;
|
|
251
|
-
|
|
248
|
+
width: 100%;
|
|
249
|
+
|
|
250
|
+
&:hover {
|
|
251
|
+
z-index: 1;
|
|
252
|
+
}
|
|
252
253
|
|
|
253
|
-
|
|
254
|
-
|
|
254
|
+
& > * {
|
|
255
|
+
width: inherit;
|
|
256
|
+
position: absolute;
|
|
257
|
+
}
|
|
255
258
|
|
|
256
259
|
&:hover > * {
|
|
257
|
-
|
|
260
|
+
width: auto;
|
|
261
|
+
z-index: 1;
|
|
262
|
+
padding: 0.5em 1em;
|
|
263
|
+
margin: -0.5em -1em;
|
|
264
|
+
|
|
265
|
+
background-color: inherit;
|
|
258
266
|
}
|
|
259
267
|
`;
|
|
260
|
-
var ShowAllWrapperWrapper = styled6.div`
|
|
261
|
-
position: absolute;
|
|
262
|
-
z-index: 1;
|
|
263
|
-
pointer-events: none;
|
|
264
|
-
|
|
265
|
-
opacity: 0;
|
|
266
|
-
padding-right: 1em;
|
|
267
|
-
background-color: ${tokens3.colors.interactive.table__cell__fill_hover.hex};
|
|
268
|
-
`;
|
|
269
268
|
|
|
270
269
|
// src/cells/HierarchyCell.tsx
|
|
271
|
-
import { jsx as jsx6, jsxs as
|
|
270
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
272
271
|
var CellWrapper = styled7(TypographyCustom)`
|
|
273
272
|
height: 100%;
|
|
274
273
|
display: flex;
|
|
@@ -289,7 +288,7 @@ var CellWrapper = styled7(TypographyCustom)`
|
|
|
289
288
|
`;
|
|
290
289
|
function HierarchyCell(cell, options = {}) {
|
|
291
290
|
var _a, _b;
|
|
292
|
-
return /* @__PURE__ */
|
|
291
|
+
return /* @__PURE__ */ jsxs3(CellWrapper, {
|
|
293
292
|
depth: ((_a = options.getRowDepth) == null ? void 0 : _a.call(options)) ?? cell.row.depth,
|
|
294
293
|
expanded: cell.row.getIsExpanded(),
|
|
295
294
|
children: [
|
|
@@ -305,7 +304,7 @@ function HierarchyCell(cell, options = {}) {
|
|
|
305
304
|
import { Button as Button2, Checkbox, Icon as Icon3, Radio } from "@equinor/eds-core-react";
|
|
306
305
|
import { chevron_down, chevron_up } from "@equinor/eds-icons";
|
|
307
306
|
import styled8 from "styled-components";
|
|
308
|
-
import { Fragment, jsx as jsx7, jsxs as
|
|
307
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
309
308
|
var CellWrapper2 = styled8.div`
|
|
310
309
|
display: flex;
|
|
311
310
|
align-items: center;
|
|
@@ -313,15 +312,18 @@ var CellWrapper2 = styled8.div`
|
|
|
313
312
|
margin-left: -16px;
|
|
314
313
|
z-index: 2;
|
|
315
314
|
`;
|
|
316
|
-
function SelectColumnDef(
|
|
315
|
+
function SelectColumnDef(props = {}) {
|
|
316
|
+
const selectionMode = props.rowSelectionMode;
|
|
317
|
+
const showBothSelectAndSubRowsToggle = props.hideExpandControls === false;
|
|
317
318
|
return {
|
|
318
319
|
id: "select",
|
|
320
|
+
size: showBothSelectAndSubRowsToggle ? 96 : 48,
|
|
319
321
|
header: ({ table }) => selectionMode !== "single" ? /* @__PURE__ */ jsx7(CellWrapper2, {
|
|
320
322
|
children: /* @__PURE__ */ jsx7(Checkbox, {
|
|
321
323
|
checked: table.getIsAllRowsSelected(),
|
|
322
324
|
indeterminate: table.getIsSomeRowsSelected(),
|
|
323
325
|
"aria-label": table.getIsAllRowsSelected() ? "Deselect all rows" : "Select all rows",
|
|
324
|
-
onChange: table.getToggleAllRowsSelectedHandler()
|
|
326
|
+
onChange: table.getIsSomeRowsSelected() ? () => table.toggleAllRowsSelected(false) : table.getToggleAllRowsSelectedHandler()
|
|
325
327
|
})
|
|
326
328
|
}) : null,
|
|
327
329
|
cell: ({ table, row }) => {
|
|
@@ -329,7 +331,7 @@ function SelectColumnDef(selectionMode) {
|
|
|
329
331
|
return /* @__PURE__ */ jsx7(CellWrapper2, {
|
|
330
332
|
paddingLeft,
|
|
331
333
|
rowDepth: row.depth,
|
|
332
|
-
children: /* @__PURE__ */
|
|
334
|
+
children: /* @__PURE__ */ jsxs4(Fragment, {
|
|
333
335
|
children: [
|
|
334
336
|
selectionMode === "single" ? /* @__PURE__ */ jsx7(Radio, {
|
|
335
337
|
checked: row.getIsSelected(),
|
|
@@ -360,7 +362,7 @@ function SelectColumnDef(selectionMode) {
|
|
|
360
362
|
|
|
361
363
|
// src/DataTable/DataTableRaw.tsx
|
|
362
364
|
import { useRef as useRef2 } from "react";
|
|
363
|
-
import
|
|
365
|
+
import styled16 from "styled-components";
|
|
364
366
|
|
|
365
367
|
// src/DataTable/components/BasicTable.tsx
|
|
366
368
|
import { Table as EdsTable } from "@equinor/eds-core-react";
|
|
@@ -388,16 +390,25 @@ function PlaceholderRow({ isLoading }) {
|
|
|
388
390
|
});
|
|
389
391
|
}
|
|
390
392
|
|
|
393
|
+
// src/DataTable/components/TableBody.tsx
|
|
394
|
+
import { Table as Table4 } from "@equinor/eds-core-react";
|
|
395
|
+
import styled10 from "styled-components";
|
|
396
|
+
var TableBody = styled10(Table4.Body)`
|
|
397
|
+
// The following attribute are important for fixed column width
|
|
398
|
+
// CHANGE THES WITH CAUTION
|
|
399
|
+
background: inherit;
|
|
400
|
+
`;
|
|
401
|
+
|
|
391
402
|
// src/DataTable/components/TableHeader.tsx
|
|
392
|
-
import { Table as
|
|
403
|
+
import { Table as Table6 } from "@equinor/eds-core-react";
|
|
393
404
|
|
|
394
405
|
// src/cells/HeaderCell.tsx
|
|
395
|
-
import { Icon as Icon4, Table as
|
|
406
|
+
import { Icon as Icon4, Table as Table5 } from "@equinor/eds-core-react";
|
|
396
407
|
import { arrow_drop_down, arrow_drop_up } from "@equinor/eds-icons";
|
|
397
408
|
import { flexRender as flexRender2 } from "@tanstack/react-table";
|
|
398
|
-
import
|
|
399
|
-
import { jsx as jsx9, jsxs as
|
|
400
|
-
var HeaderDiv =
|
|
409
|
+
import styled11 from "styled-components";
|
|
410
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
411
|
+
var HeaderDiv = styled11.div`
|
|
401
412
|
display: flex;
|
|
402
413
|
align-items: center;
|
|
403
414
|
gap: 0.25rem;
|
|
@@ -406,7 +417,7 @@ var HeaderDiv = styled10.div`
|
|
|
406
417
|
var HeaderCell = ({ header }) => {
|
|
407
418
|
var _a;
|
|
408
419
|
const style = {
|
|
409
|
-
width: header.column.getSize()
|
|
420
|
+
width: header.column.getSize()
|
|
410
421
|
};
|
|
411
422
|
const cellProps = {
|
|
412
423
|
style,
|
|
@@ -422,7 +433,7 @@ var HeaderCell = ({ header }) => {
|
|
|
422
433
|
})
|
|
423
434
|
}, header.id);
|
|
424
435
|
}
|
|
425
|
-
return /* @__PURE__ */ jsx9(
|
|
436
|
+
return /* @__PURE__ */ jsx9(Table5.Cell, {
|
|
426
437
|
...cellProps,
|
|
427
438
|
children: /* @__PURE__ */ jsx9(HeaderContent, {
|
|
428
439
|
header
|
|
@@ -432,7 +443,7 @@ var HeaderCell = ({ header }) => {
|
|
|
432
443
|
function HeaderContent({ header }) {
|
|
433
444
|
if (header.isPlaceholder)
|
|
434
445
|
return null;
|
|
435
|
-
return /* @__PURE__ */
|
|
446
|
+
return /* @__PURE__ */ jsxs5(HeaderDiv, {
|
|
436
447
|
children: [
|
|
437
448
|
flexRender2(header.column.columnDef.header, header.getContext()),
|
|
438
449
|
{
|
|
@@ -465,9 +476,9 @@ function getSort({ column }) {
|
|
|
465
476
|
// src/DataTable/components/TableHeader.tsx
|
|
466
477
|
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
467
478
|
function TableHeader({ table, sticky }) {
|
|
468
|
-
return /* @__PURE__ */ jsx10(
|
|
479
|
+
return /* @__PURE__ */ jsx10(Table6.Head, {
|
|
469
480
|
sticky,
|
|
470
|
-
children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx10(
|
|
481
|
+
children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx10(Table6.Row, {
|
|
471
482
|
children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx10(HeaderCell, {
|
|
472
483
|
header
|
|
473
484
|
}, header.id))
|
|
@@ -476,12 +487,13 @@ function TableHeader({ table, sticky }) {
|
|
|
476
487
|
}
|
|
477
488
|
|
|
478
489
|
// src/DataTable/components/TableRow.tsx
|
|
479
|
-
import { Table as
|
|
490
|
+
import { Table as Table7 } from "@equinor/eds-core-react";
|
|
491
|
+
import styled12 from "styled-components";
|
|
480
492
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
481
493
|
function TableRow({ row, rowConfig, cellConfig }) {
|
|
482
494
|
var _a;
|
|
483
495
|
const rowWrapper = rowConfig == null ? void 0 : rowConfig.rowWrapper;
|
|
484
|
-
const tableRowContent = /* @__PURE__ */ jsx11(
|
|
496
|
+
const tableRowContent = /* @__PURE__ */ jsx11(StyledTableRow, {
|
|
485
497
|
active: row.getIsSelected(),
|
|
486
498
|
style: {
|
|
487
499
|
cursor: (rowConfig == null ? void 0 : rowConfig.onClick) ? "pointer" : "initial",
|
|
@@ -504,6 +516,10 @@ function TableRow({ row, rowConfig, cellConfig }) {
|
|
|
504
516
|
});
|
|
505
517
|
return rowWrapper ? rowWrapper({ row, children: tableRowContent }) : tableRowContent;
|
|
506
518
|
}
|
|
519
|
+
var StyledTableRow = styled12(Table7.Row)`
|
|
520
|
+
/* Background color must be inherited here. Does not work with inline styling */
|
|
521
|
+
background-color: inherit;
|
|
522
|
+
`;
|
|
507
523
|
function handleRowEvent(row, handler) {
|
|
508
524
|
if (!handler)
|
|
509
525
|
return void 0;
|
|
@@ -513,7 +529,7 @@ function handleRowEvent(row, handler) {
|
|
|
513
529
|
}
|
|
514
530
|
|
|
515
531
|
// src/DataTable/components/BasicTable.tsx
|
|
516
|
-
import { jsx as jsx12, jsxs as
|
|
532
|
+
import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
517
533
|
function BasicTable({
|
|
518
534
|
table,
|
|
519
535
|
rowConfig,
|
|
@@ -522,13 +538,13 @@ function BasicTable({
|
|
|
522
538
|
isLoading
|
|
523
539
|
}) {
|
|
524
540
|
const tableRows = table.getRowModel().rows;
|
|
525
|
-
return /* @__PURE__ */
|
|
541
|
+
return /* @__PURE__ */ jsxs6(EdsTable, {
|
|
526
542
|
children: [
|
|
527
543
|
/* @__PURE__ */ jsx12(TableHeader, {
|
|
528
544
|
sticky: stickyHeader,
|
|
529
545
|
table
|
|
530
546
|
}),
|
|
531
|
-
/* @__PURE__ */ jsx12(
|
|
547
|
+
/* @__PURE__ */ jsx12(TableBody, {
|
|
532
548
|
children: tableRows.length ? tableRows.map((row) => /* @__PURE__ */ jsx12(TableRow, {
|
|
533
549
|
row,
|
|
534
550
|
rowConfig,
|
|
@@ -545,7 +561,7 @@ function BasicTable({
|
|
|
545
561
|
import { Typography as Typography2 } from "@equinor/eds-core-react";
|
|
546
562
|
import { search } from "@equinor/eds-icons";
|
|
547
563
|
import { useAtom } from "jotai";
|
|
548
|
-
import
|
|
564
|
+
import styled15 from "styled-components";
|
|
549
565
|
|
|
550
566
|
// src/DataTable/atoms.ts
|
|
551
567
|
import { atom } from "jotai";
|
|
@@ -559,12 +575,12 @@ var expandedRowsAtom = atom({});
|
|
|
559
575
|
import { Button as Button3, Icon as Icon5, Input, Tooltip } from "@equinor/eds-core-react";
|
|
560
576
|
import { close } from "@equinor/eds-icons";
|
|
561
577
|
import { useEffect, useState as useState2 } from "react";
|
|
562
|
-
import
|
|
578
|
+
import styled13 from "styled-components";
|
|
563
579
|
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
564
|
-
var Wrapper3 =
|
|
580
|
+
var Wrapper3 = styled13.div`
|
|
565
581
|
width: 200px;
|
|
566
582
|
`;
|
|
567
|
-
var CloseButton =
|
|
583
|
+
var CloseButton = styled13(Button3)`
|
|
568
584
|
width: 24px;
|
|
569
585
|
height: 24px;
|
|
570
586
|
`;
|
|
@@ -625,7 +641,7 @@ var fuzzyFilter = (row, columnId, value, addMeta) => {
|
|
|
625
641
|
import { Button as Button4, Checkbox as Checkbox2, Divider, Icon as Icon6, Popover } from "@equinor/eds-core-react";
|
|
626
642
|
import { close as close2, view_column } from "@equinor/eds-icons";
|
|
627
643
|
import { useRef, useState as useState3 } from "react";
|
|
628
|
-
import
|
|
644
|
+
import styled14 from "styled-components";
|
|
629
645
|
|
|
630
646
|
// src/DataTable/utils.tsx
|
|
631
647
|
function capitalizeHeader(context) {
|
|
@@ -645,18 +661,25 @@ function prependSelectColumn(columns, config) {
|
|
|
645
661
|
if (!(config == null ? void 0 : config.selectColumn))
|
|
646
662
|
return columns;
|
|
647
663
|
if (config.selectColumn === "default")
|
|
648
|
-
return [SelectColumnDef(config
|
|
664
|
+
return [SelectColumnDef(config), ...columns];
|
|
649
665
|
return [config.selectColumn(), ...columns];
|
|
650
666
|
}
|
|
667
|
+
function getFunctionValueOrDefault(valueOrFn, fnProps, defaultValue) {
|
|
668
|
+
if (valueOrFn === void 0)
|
|
669
|
+
return defaultValue;
|
|
670
|
+
if (typeof valueOrFn === "function")
|
|
671
|
+
return valueOrFn(fnProps);
|
|
672
|
+
return valueOrFn;
|
|
673
|
+
}
|
|
651
674
|
|
|
652
675
|
// src/DataTable/components/ColumnSelect.tsx
|
|
653
|
-
import { Fragment as Fragment2, jsx as jsx14, jsxs as
|
|
654
|
-
var ColumnSelectContent =
|
|
676
|
+
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
677
|
+
var ColumnSelectContent = styled14.div`
|
|
655
678
|
display: grid;
|
|
656
679
|
grid-template-columns: repeat(2, 1fr);
|
|
657
680
|
grid-gap: 0.5rem;
|
|
658
681
|
`;
|
|
659
|
-
var ActionsWrapper =
|
|
682
|
+
var ActionsWrapper = styled14.div`
|
|
660
683
|
display: flex;
|
|
661
684
|
align-items: center;
|
|
662
685
|
justify-content: flex-end;
|
|
@@ -666,7 +689,7 @@ function ColumnSelect({ table }) {
|
|
|
666
689
|
const [isOpen, setIsOpen] = useState3(false);
|
|
667
690
|
const referenceElement = useRef(null);
|
|
668
691
|
const selectableColumns = table.getAllLeafColumns().filter((column) => column.id !== "select");
|
|
669
|
-
return /* @__PURE__ */
|
|
692
|
+
return /* @__PURE__ */ jsxs7(Fragment2, {
|
|
670
693
|
children: [
|
|
671
694
|
/* @__PURE__ */ jsx14(Button4, {
|
|
672
695
|
"aria-haspopup": true,
|
|
@@ -681,14 +704,14 @@ function ColumnSelect({ table }) {
|
|
|
681
704
|
data: view_column
|
|
682
705
|
})
|
|
683
706
|
}),
|
|
684
|
-
/* @__PURE__ */
|
|
707
|
+
/* @__PURE__ */ jsxs7(Popover, {
|
|
685
708
|
open: isOpen,
|
|
686
709
|
id: "column-select-popover",
|
|
687
710
|
anchorEl: referenceElement.current,
|
|
688
711
|
placement: "bottom-end",
|
|
689
712
|
onClose: () => setIsOpen(false),
|
|
690
713
|
children: [
|
|
691
|
-
/* @__PURE__ */
|
|
714
|
+
/* @__PURE__ */ jsxs7(Popover.Header, {
|
|
692
715
|
children: [
|
|
693
716
|
/* @__PURE__ */ jsx14(Popover.Title, {
|
|
694
717
|
children: "Column settings"
|
|
@@ -705,7 +728,7 @@ function ColumnSelect({ table }) {
|
|
|
705
728
|
})
|
|
706
729
|
]
|
|
707
730
|
}),
|
|
708
|
-
/* @__PURE__ */
|
|
731
|
+
/* @__PURE__ */ jsxs7(Popover.Content, {
|
|
709
732
|
children: [
|
|
710
733
|
/* @__PURE__ */ jsx14(ColumnSelectContent, {
|
|
711
734
|
children: selectableColumns.map((column) => {
|
|
@@ -737,15 +760,15 @@ function ColumnSelect({ table }) {
|
|
|
737
760
|
}
|
|
738
761
|
|
|
739
762
|
// src/DataTable/components/DataTableHeader.tsx
|
|
740
|
-
import { Fragment as Fragment3, jsx as jsx15, jsxs as
|
|
741
|
-
var DataTableHeaderWrapper =
|
|
763
|
+
import { Fragment as Fragment3, jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
764
|
+
var DataTableHeaderWrapper = styled15.div`
|
|
742
765
|
display: flex;
|
|
743
766
|
align-items: center;
|
|
744
767
|
justify-content: space-between;
|
|
745
768
|
gap: 0.5rem;
|
|
746
769
|
padding: ${(props) => props.captionPadding ?? "1rem"};
|
|
747
770
|
`;
|
|
748
|
-
var FilterContainer =
|
|
771
|
+
var FilterContainer = styled15.div`
|
|
749
772
|
display: flex;
|
|
750
773
|
align-items: center;
|
|
751
774
|
gap: 1rem;
|
|
@@ -754,7 +777,7 @@ var FilterContainer = styled13.div`
|
|
|
754
777
|
function DataTableHeader({ config, table, ...props }) {
|
|
755
778
|
var _a;
|
|
756
779
|
const [globalFilter, setGlobalFilter] = useAtom(globalFilterAtom);
|
|
757
|
-
return /* @__PURE__ */
|
|
780
|
+
return /* @__PURE__ */ jsxs8(DataTableHeaderWrapper, {
|
|
758
781
|
className: "--table-caption",
|
|
759
782
|
captionPadding: props.captionPadding,
|
|
760
783
|
children: [
|
|
@@ -764,7 +787,7 @@ function DataTableHeader({ config, table, ...props }) {
|
|
|
764
787
|
}),
|
|
765
788
|
/* @__PURE__ */ jsx15(FilterContainer, {
|
|
766
789
|
className: "--filter-container",
|
|
767
|
-
children: /* @__PURE__ */
|
|
790
|
+
children: /* @__PURE__ */ jsxs8(Fragment3, {
|
|
768
791
|
children: [
|
|
769
792
|
(config == null ? void 0 : config.globalFilter) && /* @__PURE__ */ jsx15(DebouncedInput, {
|
|
770
793
|
value: globalFilter,
|
|
@@ -784,24 +807,24 @@ function DataTableHeader({ config, table, ...props }) {
|
|
|
784
807
|
}
|
|
785
808
|
|
|
786
809
|
// src/DataTable/components/VirtualTable.tsx
|
|
787
|
-
import { Table as
|
|
810
|
+
import { Table as Table9 } from "@equinor/eds-core-react";
|
|
788
811
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
789
812
|
|
|
790
813
|
// src/DataTable/components/PaddingRow.tsx
|
|
791
|
-
import { Table as
|
|
814
|
+
import { Table as Table8 } from "@equinor/eds-core-react";
|
|
792
815
|
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
793
816
|
var PaddingRow = (props) => {
|
|
794
817
|
if (!props.height)
|
|
795
818
|
return null;
|
|
796
|
-
return /* @__PURE__ */ jsx16(
|
|
797
|
-
children: /* @__PURE__ */ jsx16(
|
|
819
|
+
return /* @__PURE__ */ jsx16(Table8.Row, {
|
|
820
|
+
children: /* @__PURE__ */ jsx16(Table8.Cell, {
|
|
798
821
|
style: { height: `${props.height}px` }
|
|
799
822
|
})
|
|
800
823
|
});
|
|
801
824
|
};
|
|
802
825
|
|
|
803
826
|
// src/DataTable/components/VirtualTable.tsx
|
|
804
|
-
import { jsx as jsx17, jsxs as
|
|
827
|
+
import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
805
828
|
function VirtualTable({
|
|
806
829
|
table,
|
|
807
830
|
rowConfig,
|
|
@@ -819,13 +842,13 @@ function VirtualTable({
|
|
|
819
842
|
const virtualRows = rowVirtualizer.getVirtualItems();
|
|
820
843
|
const paddingTop = virtualRows.length > 0 ? ((_a = virtualRows == null ? void 0 : virtualRows[0]) == null ? void 0 : _a.start) || 0 : 0;
|
|
821
844
|
const paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (((_b = virtualRows == null ? void 0 : virtualRows[virtualRows.length - 1]) == null ? void 0 : _b.end) || 0) : 0;
|
|
822
|
-
return /* @__PURE__ */
|
|
845
|
+
return /* @__PURE__ */ jsxs9(Table9, {
|
|
823
846
|
children: [
|
|
824
847
|
/* @__PURE__ */ jsx17(TableHeader, {
|
|
825
848
|
sticky: props.stickyHeader,
|
|
826
849
|
table
|
|
827
850
|
}),
|
|
828
|
-
/* @__PURE__ */
|
|
851
|
+
/* @__PURE__ */ jsxs9(TableBody, {
|
|
829
852
|
children: [
|
|
830
853
|
/* @__PURE__ */ jsx17(PaddingRow, {
|
|
831
854
|
height: paddingTop
|
|
@@ -850,8 +873,8 @@ function VirtualTable({
|
|
|
850
873
|
}
|
|
851
874
|
|
|
852
875
|
// src/DataTable/DataTableRaw.tsx
|
|
853
|
-
import { jsx as jsx18, jsxs as
|
|
854
|
-
var DataTableWrapper =
|
|
876
|
+
import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
877
|
+
var DataTableWrapper = styled16.div`
|
|
855
878
|
width: ${(props) => props.width ?? "100%"};
|
|
856
879
|
|
|
857
880
|
.--table-container {
|
|
@@ -861,17 +884,22 @@ var DataTableWrapper = styled14.div`
|
|
|
861
884
|
|
|
862
885
|
table {
|
|
863
886
|
width: 100%;
|
|
864
|
-
|
|
887
|
+
|
|
888
|
+
// The following attributes are important for fixed column width
|
|
889
|
+
// CHANGE THES WITH CAUTION
|
|
890
|
+
overflow: auto;
|
|
891
|
+
table-layout: ${(props) => props.tableLayout ?? "auto"};
|
|
865
892
|
}
|
|
866
893
|
}
|
|
867
894
|
`;
|
|
868
895
|
function DataTableRaw(props) {
|
|
869
|
-
const { isLoading, header, filters, config, rowConfig, table } = props;
|
|
896
|
+
const { isLoading, header, filters, config, rowConfig, cellConfig, table } = props;
|
|
870
897
|
const tableContainerRef = useRef2(null);
|
|
871
|
-
return /* @__PURE__ */
|
|
898
|
+
return /* @__PURE__ */ jsxs10(DataTableWrapper, {
|
|
872
899
|
captionPadding: header == null ? void 0 : header.captionPadding,
|
|
873
900
|
height: config == null ? void 0 : config.height,
|
|
874
901
|
width: config == null ? void 0 : config.width,
|
|
902
|
+
tableLayout: config == null ? void 0 : config.tableLayout,
|
|
875
903
|
children: [
|
|
876
904
|
/* @__PURE__ */ jsx18(DataTableHeader, {
|
|
877
905
|
tableCaption: header == null ? void 0 : header.tableCaption,
|
|
@@ -886,11 +914,13 @@ function DataTableRaw(props) {
|
|
|
886
914
|
containerRef: tableContainerRef,
|
|
887
915
|
table,
|
|
888
916
|
rowConfig,
|
|
917
|
+
cellConfig,
|
|
889
918
|
isLoading,
|
|
890
919
|
stickyHeader: header == null ? void 0 : header.stickyHeader
|
|
891
920
|
}) : /* @__PURE__ */ jsx18(BasicTable, {
|
|
892
921
|
table,
|
|
893
922
|
rowConfig,
|
|
923
|
+
cellConfig,
|
|
894
924
|
isLoading,
|
|
895
925
|
stickyHeader: header == null ? void 0 : header.stickyHeader
|
|
896
926
|
})
|
|
@@ -911,7 +941,7 @@ import { useAtom as useAtom2 } from "jotai";
|
|
|
911
941
|
import { useEffect as useEffect2 } from "react";
|
|
912
942
|
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
913
943
|
function useDataTable(props) {
|
|
914
|
-
const { columns, data, filters, config,
|
|
944
|
+
const { columns, data, filters, config, cellConfig } = props;
|
|
915
945
|
const [columnVisibility, setColumnVisibility] = useAtom2(columnVisibilityAtom);
|
|
916
946
|
const [globalFilter, setGlobalFilter] = useAtom2(globalFilterAtom);
|
|
917
947
|
const [sorting, setSorting] = useAtom2(tableSortingAtom);
|
|
@@ -932,12 +962,14 @@ function useDataTable(props) {
|
|
|
932
962
|
columnVisibility
|
|
933
963
|
},
|
|
934
964
|
defaultColumn: {
|
|
935
|
-
cell: (cell) =>
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
965
|
+
cell: ({ cell }) => {
|
|
966
|
+
const truncateMode = getFunctionValueOrDefault(cellConfig == null ? void 0 : cellConfig.truncateMode, cell, "hover");
|
|
967
|
+
return /* @__PURE__ */ jsx19(TypographyCustom, {
|
|
968
|
+
truncate: truncateMode === "hover",
|
|
969
|
+
children: cell.getValue()
|
|
970
|
+
});
|
|
971
|
+
}
|
|
939
972
|
},
|
|
940
|
-
meta,
|
|
941
973
|
enableSorting: config == null ? void 0 : config.sortable,
|
|
942
974
|
enableExpanding: !(config == null ? void 0 : config.hideExpandControls),
|
|
943
975
|
enableMultiRowSelection: (config == null ? void 0 : config.rowSelectionMode) === "multiple",
|