@equinor/apollo-components 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +23 -4
- package/dist/index.js +137 -119
- package/dist/index.mjs +134 -117
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IconData } from '@equinor/eds-icons';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { ReactNode, ComponentProps } from 'react';
|
|
4
|
-
import { Cell, CellContext, Row, ColumnDef, RowSelectionState, SortingState,
|
|
3
|
+
import { ReactNode, ReactElement, ComponentProps } from 'react';
|
|
4
|
+
import { Cell, CellContext, Table, Row, ColumnDef, RowSelectionState, SortingState, HeaderContext } from '@tanstack/react-table';
|
|
5
5
|
import { ColumnDef as ColumnDef$1 } from '@tanstack/table-core';
|
|
6
6
|
import * as styled_components from 'styled-components';
|
|
7
7
|
import { CellProps, TypographyProps as TypographyProps$1 } from '@equinor/eds-core-react';
|
|
@@ -41,11 +41,24 @@ interface HeaderConfig {
|
|
|
41
41
|
tableCaption?: string;
|
|
42
42
|
}
|
|
43
43
|
interface FilterConfig {
|
|
44
|
+
columnSelect?: boolean;
|
|
44
45
|
globalFilter?: boolean;
|
|
45
46
|
globalFilterPlaceholder?: string;
|
|
46
47
|
filterFromLeafRows?: boolean;
|
|
48
|
+
filterActions?: <T>(table: Table<T>) => ReactNode;
|
|
49
|
+
}
|
|
50
|
+
interface TableRowWrapper<T> {
|
|
51
|
+
(props: TableRowWrapperProps<T>): ReactElement;
|
|
52
|
+
}
|
|
53
|
+
interface TableRowWrapperProps<T> {
|
|
54
|
+
row: Row<T>;
|
|
55
|
+
children: ReactNode;
|
|
47
56
|
}
|
|
48
57
|
interface RowConfig<T> {
|
|
58
|
+
/**
|
|
59
|
+
* ! Unstable - Row Wrapper has not been tested for compatibility with virtualization. Use with caution.
|
|
60
|
+
*/
|
|
61
|
+
rowWrapper?: TableRowWrapper<T>;
|
|
49
62
|
getRowBackground?: (row: Row<T>) => string | undefined;
|
|
50
63
|
onClick?: (row: Row<T>) => void;
|
|
51
64
|
onMouseEnter?: (row: Row<T>) => void;
|
|
@@ -53,6 +66,7 @@ interface RowConfig<T> {
|
|
|
53
66
|
}
|
|
54
67
|
interface CellConfig<T> {
|
|
55
68
|
getStickyCellColor?: (cell: Cell<T, unknown>) => string;
|
|
69
|
+
getShouldHighlight?: (cell: Cell<T, unknown>) => boolean;
|
|
56
70
|
}
|
|
57
71
|
declare type RowSelectionMode = 'single' | 'multiple';
|
|
58
72
|
declare type DataTableConfig<T> = {
|
|
@@ -81,7 +95,7 @@ interface DataTableProps<T> {
|
|
|
81
95
|
filters?: FilterConfig;
|
|
82
96
|
header?: HeaderConfig;
|
|
83
97
|
}
|
|
84
|
-
declare function DataTable$1<T>({ columns, data, isLoading, header, filters, config, rowConfig, }: DataTableProps<T>): JSX.Element;
|
|
98
|
+
declare function DataTable$1<T>({ columns, data, isLoading, header, filters, config, cellConfig, rowConfig, }: DataTableProps<T>): JSX.Element;
|
|
85
99
|
|
|
86
100
|
declare type DataTableProviderProps = ComponentProps<typeof Provider>;
|
|
87
101
|
declare function DataTableProvider({ children, ...props }: DataTableProviderProps): JSX.Element;
|
|
@@ -96,6 +110,11 @@ declare const tableSortingAtom: jotai.PrimitiveAtom<SortingState> & {
|
|
|
96
110
|
init: SortingState;
|
|
97
111
|
};
|
|
98
112
|
|
|
113
|
+
interface ColumnSelectProps<T> {
|
|
114
|
+
table: Table<T>;
|
|
115
|
+
}
|
|
116
|
+
declare function ColumnSelect<T>({ table }: ColumnSelectProps<T>): JSX.Element;
|
|
117
|
+
|
|
99
118
|
interface TableHeaderProps<T> {
|
|
100
119
|
table: Table<T>;
|
|
101
120
|
sticky?: boolean;
|
|
@@ -133,4 +152,4 @@ declare type TypographyProps = {
|
|
|
133
152
|
*/
|
|
134
153
|
declare const TypographyCustom: (props: TypographyProps) => JSX.Element;
|
|
135
154
|
|
|
136
|
-
export { AppShell, AppSidebar, CellConfig, ChipsCell, DataTable, DataTableConfig, DynamicCell, FilterConfig, HeaderConfig, HierarchyCell, RowConfig, RowSelectionMode, SelectColumnDef, StickyCell, TableHeader, TypographyCustom, capitalizeHeader, globalFilterAtom, prependSelectColumn, rowSelectionAtom, tableSortingAtom };
|
|
155
|
+
export { AppShell, AppSidebar, CellConfig, ChipsCell, ColumnSelect, DataTable, DataTableConfig, DynamicCell, FilterConfig, HeaderConfig, HierarchyCell, RowConfig, RowSelectionMode, SelectColumnDef, StickyCell, TableHeader, TableRowWrapper, TableRowWrapperProps, TypographyCustom, capitalizeHeader, globalFilterAtom, prependSelectColumn, rowSelectionAtom, tableSortingAtom };
|
package/dist/index.js
CHANGED
|
@@ -29,6 +29,7 @@ __export(src_exports, {
|
|
|
29
29
|
AppShell: () => AppShell,
|
|
30
30
|
AppSidebar: () => AppSidebar,
|
|
31
31
|
ChipsCell: () => ChipsCell,
|
|
32
|
+
ColumnSelect: () => ColumnSelect,
|
|
32
33
|
DataTable: () => DataTable2,
|
|
33
34
|
DynamicCell: () => DynamicCell,
|
|
34
35
|
HierarchyCell: () => HierarchyCell,
|
|
@@ -538,20 +539,30 @@ function TableHeader({ table, sticky }) {
|
|
|
538
539
|
var import_eds_core_react10 = require("@equinor/eds-core-react");
|
|
539
540
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
540
541
|
function TableRow({ row, rowConfig, cellConfig }) {
|
|
541
|
-
|
|
542
|
+
var _a;
|
|
543
|
+
const rowWrapper = rowConfig == null ? void 0 : rowConfig.rowWrapper;
|
|
544
|
+
const tableRowContent = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_eds_core_react10.Table.Row, {
|
|
542
545
|
active: row.getIsSelected(),
|
|
543
|
-
style: {
|
|
546
|
+
style: {
|
|
547
|
+
cursor: (rowConfig == null ? void 0 : rowConfig.onClick) ? "pointer" : "initial",
|
|
548
|
+
backgroundColor: (_a = rowConfig == null ? void 0 : rowConfig.getRowBackground) == null ? void 0 : _a.call(rowConfig, row)
|
|
549
|
+
},
|
|
544
550
|
onClick: () => {
|
|
545
|
-
var
|
|
546
|
-
return (
|
|
551
|
+
var _a2;
|
|
552
|
+
return (_a2 = rowConfig == null ? void 0 : rowConfig.onClick) == null ? void 0 : _a2.call(rowConfig, row);
|
|
547
553
|
},
|
|
548
554
|
onMouseEnter: handleRowEvent(row, rowConfig == null ? void 0 : rowConfig.onMouseEnter),
|
|
549
555
|
onMouseLeave: handleRowEvent(row, rowConfig == null ? void 0 : rowConfig.onMouseLeave),
|
|
550
|
-
children: row.getVisibleCells().map((cell) =>
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
556
|
+
children: row.getVisibleCells().map((cell) => {
|
|
557
|
+
var _a2;
|
|
558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DynamicCell, {
|
|
559
|
+
cell,
|
|
560
|
+
getStickyCellColor: cellConfig == null ? void 0 : cellConfig.getStickyCellColor,
|
|
561
|
+
highlight: (_a2 = cellConfig == null ? void 0 : cellConfig.getShouldHighlight) == null ? void 0 : _a2.call(cellConfig, cell)
|
|
562
|
+
}, cell.id);
|
|
563
|
+
})
|
|
554
564
|
});
|
|
565
|
+
return rowWrapper ? rowWrapper({ row, children: tableRowContent }) : tableRowContent;
|
|
555
566
|
}
|
|
556
567
|
function handleRowEvent(row, handler) {
|
|
557
568
|
if (!handler)
|
|
@@ -590,11 +601,83 @@ function BasicTable({
|
|
|
590
601
|
});
|
|
591
602
|
}
|
|
592
603
|
|
|
593
|
-
// src/DataTable/components/
|
|
604
|
+
// src/DataTable/components/DataTableHeader.tsx
|
|
605
|
+
var import_eds_core_react14 = require("@equinor/eds-core-react");
|
|
606
|
+
var import_eds_icons7 = require("@equinor/eds-icons");
|
|
607
|
+
var import_jotai2 = require("jotai");
|
|
608
|
+
var import_styled_components14 = __toESM(require("styled-components"));
|
|
609
|
+
|
|
610
|
+
// src/DataTable/filters/DebouncedInput.tsx
|
|
594
611
|
var import_eds_core_react12 = require("@equinor/eds-core-react");
|
|
595
612
|
var import_eds_icons5 = require("@equinor/eds-icons");
|
|
596
613
|
var import_react2 = require("react");
|
|
597
614
|
var import_styled_components12 = __toESM(require("styled-components"));
|
|
615
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
616
|
+
var Wrapper3 = import_styled_components12.default.div`
|
|
617
|
+
width: 200px;
|
|
618
|
+
`;
|
|
619
|
+
var CloseButton = (0, import_styled_components12.default)(import_eds_core_react12.Button)`
|
|
620
|
+
width: 24px;
|
|
621
|
+
height: 24px;
|
|
622
|
+
`;
|
|
623
|
+
function DebouncedInput({
|
|
624
|
+
value: initialValue,
|
|
625
|
+
onChange,
|
|
626
|
+
icon,
|
|
627
|
+
debounce = 500,
|
|
628
|
+
...props
|
|
629
|
+
}) {
|
|
630
|
+
const [value, setValue] = (0, import_react2.useState)(initialValue);
|
|
631
|
+
(0, import_react2.useEffect)(() => {
|
|
632
|
+
setValue(initialValue);
|
|
633
|
+
}, [initialValue]);
|
|
634
|
+
(0, import_react2.useEffect)(() => {
|
|
635
|
+
const timeout = setTimeout(() => {
|
|
636
|
+
onChange(value);
|
|
637
|
+
}, debounce);
|
|
638
|
+
return () => clearTimeout(timeout);
|
|
639
|
+
}, [value]);
|
|
640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Wrapper3, {
|
|
641
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react12.Input, {
|
|
642
|
+
...props,
|
|
643
|
+
value,
|
|
644
|
+
leftAdornments: icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react12.Icon, {
|
|
645
|
+
name: icon.name,
|
|
646
|
+
data: icon,
|
|
647
|
+
size: 18
|
|
648
|
+
}),
|
|
649
|
+
rightAdornments: !!value && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react12.Tooltip, {
|
|
650
|
+
title: "Clear input",
|
|
651
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CloseButton, {
|
|
652
|
+
variant: "ghost_icon",
|
|
653
|
+
onClick: () => setValue(""),
|
|
654
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react12.Icon, {
|
|
655
|
+
name: import_eds_icons5.close.name,
|
|
656
|
+
data: import_eds_icons5.close,
|
|
657
|
+
size: 18
|
|
658
|
+
})
|
|
659
|
+
})
|
|
660
|
+
}),
|
|
661
|
+
onChange: (event) => setValue(event.target.value)
|
|
662
|
+
})
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
// src/DataTable/filters/functions.ts
|
|
667
|
+
var import_match_sorter_utils = require("@tanstack/match-sorter-utils");
|
|
668
|
+
var fuzzyFilter = (row, columnId, value, addMeta) => {
|
|
669
|
+
const itemRank = (0, import_match_sorter_utils.rankItem)(row.getValue(columnId), value);
|
|
670
|
+
addMeta({
|
|
671
|
+
itemRank
|
|
672
|
+
});
|
|
673
|
+
return itemRank.passed;
|
|
674
|
+
};
|
|
675
|
+
|
|
676
|
+
// src/DataTable/components/ColumnSelect.tsx
|
|
677
|
+
var import_eds_core_react13 = require("@equinor/eds-core-react");
|
|
678
|
+
var import_eds_icons6 = require("@equinor/eds-icons");
|
|
679
|
+
var import_react3 = require("react");
|
|
680
|
+
var import_styled_components13 = __toESM(require("styled-components"));
|
|
598
681
|
|
|
599
682
|
// src/DataTable/utils.tsx
|
|
600
683
|
function capitalizeHeader(context) {
|
|
@@ -619,25 +702,25 @@ function prependSelectColumn(columns, config) {
|
|
|
619
702
|
}
|
|
620
703
|
|
|
621
704
|
// src/DataTable/components/ColumnSelect.tsx
|
|
622
|
-
var
|
|
623
|
-
var ColumnSelectContent =
|
|
705
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
706
|
+
var ColumnSelectContent = import_styled_components13.default.div`
|
|
624
707
|
display: grid;
|
|
625
708
|
grid-template-columns: repeat(2, 1fr);
|
|
626
709
|
grid-gap: 0.5rem;
|
|
627
710
|
`;
|
|
628
|
-
var ActionsWrapper =
|
|
711
|
+
var ActionsWrapper = import_styled_components13.default.div`
|
|
629
712
|
display: flex;
|
|
630
713
|
align-items: center;
|
|
631
714
|
justify-content: flex-end;
|
|
632
715
|
gap: 0.5rem;
|
|
633
716
|
`;
|
|
634
717
|
function ColumnSelect({ table }) {
|
|
635
|
-
const [isOpen, setIsOpen] = (0,
|
|
636
|
-
const referenceElement = (0,
|
|
718
|
+
const [isOpen, setIsOpen] = (0, import_react3.useState)(false);
|
|
719
|
+
const referenceElement = (0, import_react3.useRef)(null);
|
|
637
720
|
const selectableColumns = table.getAllLeafColumns().filter((column) => column.id !== "select");
|
|
638
|
-
return /* @__PURE__ */ (0,
|
|
721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, {
|
|
639
722
|
children: [
|
|
640
|
-
/* @__PURE__ */ (0,
|
|
723
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react13.Button, {
|
|
641
724
|
"aria-haspopup": true,
|
|
642
725
|
id: "column-select-anchor",
|
|
643
726
|
"aria-controls": "column-select-popover",
|
|
@@ -645,51 +728,51 @@ function ColumnSelect({ table }) {
|
|
|
645
728
|
ref: referenceElement,
|
|
646
729
|
variant: "ghost_icon",
|
|
647
730
|
onClick: () => setIsOpen(true),
|
|
648
|
-
children: /* @__PURE__ */ (0,
|
|
731
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react13.Icon, {
|
|
649
732
|
name: "view_column",
|
|
650
|
-
data:
|
|
733
|
+
data: import_eds_icons6.view_column
|
|
651
734
|
})
|
|
652
735
|
}),
|
|
653
|
-
/* @__PURE__ */ (0,
|
|
736
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_eds_core_react13.Popover, {
|
|
654
737
|
open: isOpen,
|
|
655
738
|
id: "column-select-popover",
|
|
656
739
|
anchorEl: referenceElement.current,
|
|
657
740
|
placement: "bottom-end",
|
|
658
741
|
onClose: () => setIsOpen(false),
|
|
659
742
|
children: [
|
|
660
|
-
/* @__PURE__ */ (0,
|
|
743
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_eds_core_react13.Popover.Header, {
|
|
661
744
|
children: [
|
|
662
|
-
/* @__PURE__ */ (0,
|
|
745
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react13.Popover.Title, {
|
|
663
746
|
children: "Column settings"
|
|
664
747
|
}),
|
|
665
|
-
/* @__PURE__ */ (0,
|
|
748
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react13.Button, {
|
|
666
749
|
variant: "ghost_icon",
|
|
667
750
|
"aria-label": "Close column select",
|
|
668
751
|
onClick: () => setIsOpen(false),
|
|
669
|
-
children: /* @__PURE__ */ (0,
|
|
752
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react13.Icon, {
|
|
670
753
|
name: "close",
|
|
671
|
-
data:
|
|
754
|
+
data: import_eds_icons6.close,
|
|
672
755
|
size: 24
|
|
673
756
|
})
|
|
674
757
|
})
|
|
675
758
|
]
|
|
676
759
|
}),
|
|
677
|
-
/* @__PURE__ */ (0,
|
|
760
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_eds_core_react13.Popover.Content, {
|
|
678
761
|
children: [
|
|
679
|
-
/* @__PURE__ */ (0,
|
|
762
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ColumnSelectContent, {
|
|
680
763
|
children: selectableColumns.map((column) => {
|
|
681
|
-
return /* @__PURE__ */ (0,
|
|
764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react13.Checkbox, {
|
|
682
765
|
checked: column.getIsVisible(),
|
|
683
766
|
label: getColumnHeader(column),
|
|
684
767
|
onChange: column.getToggleVisibilityHandler()
|
|
685
768
|
}, column.id);
|
|
686
769
|
})
|
|
687
770
|
}),
|
|
688
|
-
/* @__PURE__ */ (0,
|
|
771
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react13.Divider, {
|
|
689
772
|
variant: "small"
|
|
690
773
|
}),
|
|
691
|
-
/* @__PURE__ */ (0,
|
|
692
|
-
children: /* @__PURE__ */ (0,
|
|
774
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ActionsWrapper, {
|
|
775
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react13.Button, {
|
|
693
776
|
color: "secondary",
|
|
694
777
|
variant: "ghost",
|
|
695
778
|
disabled: table.getIsAllColumnsVisible(),
|
|
@@ -705,78 +788,6 @@ function ColumnSelect({ table }) {
|
|
|
705
788
|
});
|
|
706
789
|
}
|
|
707
790
|
|
|
708
|
-
// src/DataTable/components/DataTableHeader.tsx
|
|
709
|
-
var import_eds_core_react14 = require("@equinor/eds-core-react");
|
|
710
|
-
var import_eds_icons7 = require("@equinor/eds-icons");
|
|
711
|
-
var import_jotai2 = require("jotai");
|
|
712
|
-
var import_styled_components14 = __toESM(require("styled-components"));
|
|
713
|
-
|
|
714
|
-
// src/DataTable/filters/DebouncedInput.tsx
|
|
715
|
-
var import_eds_core_react13 = require("@equinor/eds-core-react");
|
|
716
|
-
var import_eds_icons6 = require("@equinor/eds-icons");
|
|
717
|
-
var import_react3 = require("react");
|
|
718
|
-
var import_styled_components13 = __toESM(require("styled-components"));
|
|
719
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
720
|
-
var Wrapper3 = import_styled_components13.default.div`
|
|
721
|
-
width: 200px;
|
|
722
|
-
`;
|
|
723
|
-
var CloseButton = (0, import_styled_components13.default)(import_eds_core_react13.Button)`
|
|
724
|
-
width: 24px;
|
|
725
|
-
height: 24px;
|
|
726
|
-
`;
|
|
727
|
-
function DebouncedInput({
|
|
728
|
-
value: initialValue,
|
|
729
|
-
onChange,
|
|
730
|
-
icon,
|
|
731
|
-
debounce = 500,
|
|
732
|
-
...props
|
|
733
|
-
}) {
|
|
734
|
-
const [value, setValue] = (0, import_react3.useState)(initialValue);
|
|
735
|
-
(0, import_react3.useEffect)(() => {
|
|
736
|
-
setValue(initialValue);
|
|
737
|
-
}, [initialValue]);
|
|
738
|
-
(0, import_react3.useEffect)(() => {
|
|
739
|
-
const timeout = setTimeout(() => {
|
|
740
|
-
onChange(value);
|
|
741
|
-
}, debounce);
|
|
742
|
-
return () => clearTimeout(timeout);
|
|
743
|
-
}, [value]);
|
|
744
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Wrapper3, {
|
|
745
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react13.Input, {
|
|
746
|
-
...props,
|
|
747
|
-
value,
|
|
748
|
-
leftAdornments: icon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react13.Icon, {
|
|
749
|
-
name: icon.name,
|
|
750
|
-
data: icon,
|
|
751
|
-
size: 18
|
|
752
|
-
}),
|
|
753
|
-
rightAdornments: !!value && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react13.Tooltip, {
|
|
754
|
-
title: "Clear input",
|
|
755
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CloseButton, {
|
|
756
|
-
variant: "ghost_icon",
|
|
757
|
-
onClick: () => setValue(""),
|
|
758
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react13.Icon, {
|
|
759
|
-
name: import_eds_icons6.close.name,
|
|
760
|
-
data: import_eds_icons6.close,
|
|
761
|
-
size: 18
|
|
762
|
-
})
|
|
763
|
-
})
|
|
764
|
-
}),
|
|
765
|
-
onChange: (event) => setValue(event.target.value)
|
|
766
|
-
})
|
|
767
|
-
});
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
// src/DataTable/filters/functions.ts
|
|
771
|
-
var import_match_sorter_utils = require("@tanstack/match-sorter-utils");
|
|
772
|
-
var fuzzyFilter = (row, columnId, value, addMeta) => {
|
|
773
|
-
const itemRank = (0, import_match_sorter_utils.rankItem)(row.getValue(columnId), value);
|
|
774
|
-
addMeta({
|
|
775
|
-
itemRank
|
|
776
|
-
});
|
|
777
|
-
return itemRank.passed;
|
|
778
|
-
};
|
|
779
|
-
|
|
780
791
|
// src/DataTable/components/DataTableHeader.tsx
|
|
781
792
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
782
793
|
var DataTableHeaderWrapper = import_styled_components14.default.div`
|
|
@@ -792,7 +803,8 @@ var FilterContainer = import_styled_components14.default.div`
|
|
|
792
803
|
gap: 1rem;
|
|
793
804
|
justify-content: flex-end;
|
|
794
805
|
`;
|
|
795
|
-
|
|
806
|
+
function DataTableHeader({ config, table, ...props }) {
|
|
807
|
+
var _a;
|
|
796
808
|
const [globalFilter, setGlobalFilter] = (0, import_jotai2.useAtom)(globalFilterAtom);
|
|
797
809
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(DataTableHeaderWrapper, {
|
|
798
810
|
className: "--table-caption",
|
|
@@ -802,21 +814,26 @@ var DataTableHeader = (props) => {
|
|
|
802
814
|
variant: "h3",
|
|
803
815
|
children: props == null ? void 0 : props.tableCaption
|
|
804
816
|
}),
|
|
805
|
-
|
|
817
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FilterContainer, {
|
|
806
818
|
className: "--filter-container",
|
|
807
|
-
children:
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
819
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, {
|
|
820
|
+
children: [
|
|
821
|
+
(config == null ? void 0 : config.globalFilter) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DebouncedInput, {
|
|
822
|
+
value: globalFilter,
|
|
823
|
+
icon: import_eds_icons7.search,
|
|
824
|
+
placeholder: (config == null ? void 0 : config.globalFilterPlaceholder) ?? "Search all columns",
|
|
825
|
+
onChange: (value) => setGlobalFilter(String(value))
|
|
826
|
+
}),
|
|
827
|
+
(_a = config == null ? void 0 : config.filterActions) == null ? void 0 : _a.call(config, table),
|
|
828
|
+
(config == null ? void 0 : config.columnSelect) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ColumnSelect, {
|
|
829
|
+
table
|
|
830
|
+
})
|
|
831
|
+
]
|
|
832
|
+
})
|
|
816
833
|
})
|
|
817
834
|
]
|
|
818
835
|
});
|
|
819
|
-
}
|
|
836
|
+
}
|
|
820
837
|
|
|
821
838
|
// src/DataTable/components/VirtualTable.tsx
|
|
822
839
|
var import_eds_core_react16 = require("@equinor/eds-core-react");
|
|
@@ -907,6 +924,7 @@ function DataTable({
|
|
|
907
924
|
header,
|
|
908
925
|
filters,
|
|
909
926
|
config,
|
|
927
|
+
cellConfig,
|
|
910
928
|
rowConfig
|
|
911
929
|
}) {
|
|
912
930
|
const [columnVisibility, setColumnVisibility] = (0, import_jotai3.useAtom)(columnVisibilityAtom);
|
|
@@ -964,12 +982,9 @@ function DataTable({
|
|
|
964
982
|
children: [
|
|
965
983
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DataTableHeader, {
|
|
966
984
|
tableCaption: header == null ? void 0 : header.tableCaption,
|
|
967
|
-
enableGlobalFilter: filters == null ? void 0 : filters.globalFilter,
|
|
968
|
-
globalFilterPlaceholder: filters == null ? void 0 : filters.globalFilterPlaceholder,
|
|
969
985
|
captionPadding: header == null ? void 0 : header.captionPadding,
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
})
|
|
986
|
+
table,
|
|
987
|
+
config: filters
|
|
973
988
|
}),
|
|
974
989
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", {
|
|
975
990
|
ref: tableContainerRef,
|
|
@@ -978,11 +993,13 @@ function DataTable({
|
|
|
978
993
|
containerRef: tableContainerRef,
|
|
979
994
|
table,
|
|
980
995
|
rowConfig,
|
|
996
|
+
cellConfig,
|
|
981
997
|
isLoading,
|
|
982
998
|
stickyHeader: header == null ? void 0 : header.stickyHeader
|
|
983
999
|
}) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(BasicTable, {
|
|
984
1000
|
table,
|
|
985
1001
|
rowConfig,
|
|
1002
|
+
cellConfig,
|
|
986
1003
|
isLoading,
|
|
987
1004
|
stickyHeader: header == null ? void 0 : header.stickyHeader
|
|
988
1005
|
})
|
|
@@ -1009,6 +1026,7 @@ DataTable2.Provider = DataTableProvider;
|
|
|
1009
1026
|
AppShell,
|
|
1010
1027
|
AppSidebar,
|
|
1011
1028
|
ChipsCell,
|
|
1029
|
+
ColumnSelect,
|
|
1012
1030
|
DataTable,
|
|
1013
1031
|
DynamicCell,
|
|
1014
1032
|
HierarchyCell,
|
package/dist/index.mjs
CHANGED
|
@@ -500,20 +500,30 @@ function TableHeader({ table, sticky }) {
|
|
|
500
500
|
import { Table as Table6 } from "@equinor/eds-core-react";
|
|
501
501
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
502
502
|
function TableRow({ row, rowConfig, cellConfig }) {
|
|
503
|
-
|
|
503
|
+
var _a;
|
|
504
|
+
const rowWrapper = rowConfig == null ? void 0 : rowConfig.rowWrapper;
|
|
505
|
+
const tableRowContent = /* @__PURE__ */ jsx11(Table6.Row, {
|
|
504
506
|
active: row.getIsSelected(),
|
|
505
|
-
style: {
|
|
507
|
+
style: {
|
|
508
|
+
cursor: (rowConfig == null ? void 0 : rowConfig.onClick) ? "pointer" : "initial",
|
|
509
|
+
backgroundColor: (_a = rowConfig == null ? void 0 : rowConfig.getRowBackground) == null ? void 0 : _a.call(rowConfig, row)
|
|
510
|
+
},
|
|
506
511
|
onClick: () => {
|
|
507
|
-
var
|
|
508
|
-
return (
|
|
512
|
+
var _a2;
|
|
513
|
+
return (_a2 = rowConfig == null ? void 0 : rowConfig.onClick) == null ? void 0 : _a2.call(rowConfig, row);
|
|
509
514
|
},
|
|
510
515
|
onMouseEnter: handleRowEvent(row, rowConfig == null ? void 0 : rowConfig.onMouseEnter),
|
|
511
516
|
onMouseLeave: handleRowEvent(row, rowConfig == null ? void 0 : rowConfig.onMouseLeave),
|
|
512
|
-
children: row.getVisibleCells().map((cell) =>
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
517
|
+
children: row.getVisibleCells().map((cell) => {
|
|
518
|
+
var _a2;
|
|
519
|
+
return /* @__PURE__ */ jsx11(DynamicCell, {
|
|
520
|
+
cell,
|
|
521
|
+
getStickyCellColor: cellConfig == null ? void 0 : cellConfig.getStickyCellColor,
|
|
522
|
+
highlight: (_a2 = cellConfig == null ? void 0 : cellConfig.getShouldHighlight) == null ? void 0 : _a2.call(cellConfig, cell)
|
|
523
|
+
}, cell.id);
|
|
524
|
+
})
|
|
516
525
|
});
|
|
526
|
+
return rowWrapper ? rowWrapper({ row, children: tableRowContent }) : tableRowContent;
|
|
517
527
|
}
|
|
518
528
|
function handleRowEvent(row, handler) {
|
|
519
529
|
if (!handler)
|
|
@@ -552,11 +562,83 @@ function BasicTable({
|
|
|
552
562
|
});
|
|
553
563
|
}
|
|
554
564
|
|
|
555
|
-
// src/DataTable/components/
|
|
556
|
-
import {
|
|
557
|
-
import {
|
|
558
|
-
import {
|
|
565
|
+
// src/DataTable/components/DataTableHeader.tsx
|
|
566
|
+
import { Typography as Typography2 } from "@equinor/eds-core-react";
|
|
567
|
+
import { search } from "@equinor/eds-icons";
|
|
568
|
+
import { useAtom } from "jotai";
|
|
569
|
+
import styled13 from "styled-components";
|
|
570
|
+
|
|
571
|
+
// src/DataTable/filters/DebouncedInput.tsx
|
|
572
|
+
import { Button as Button3, Icon as Icon5, Input, Tooltip } from "@equinor/eds-core-react";
|
|
573
|
+
import { close } from "@equinor/eds-icons";
|
|
574
|
+
import { useEffect, useState as useState2 } from "react";
|
|
559
575
|
import styled11 from "styled-components";
|
|
576
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
577
|
+
var Wrapper3 = styled11.div`
|
|
578
|
+
width: 200px;
|
|
579
|
+
`;
|
|
580
|
+
var CloseButton = styled11(Button3)`
|
|
581
|
+
width: 24px;
|
|
582
|
+
height: 24px;
|
|
583
|
+
`;
|
|
584
|
+
function DebouncedInput({
|
|
585
|
+
value: initialValue,
|
|
586
|
+
onChange,
|
|
587
|
+
icon,
|
|
588
|
+
debounce = 500,
|
|
589
|
+
...props
|
|
590
|
+
}) {
|
|
591
|
+
const [value, setValue] = useState2(initialValue);
|
|
592
|
+
useEffect(() => {
|
|
593
|
+
setValue(initialValue);
|
|
594
|
+
}, [initialValue]);
|
|
595
|
+
useEffect(() => {
|
|
596
|
+
const timeout = setTimeout(() => {
|
|
597
|
+
onChange(value);
|
|
598
|
+
}, debounce);
|
|
599
|
+
return () => clearTimeout(timeout);
|
|
600
|
+
}, [value]);
|
|
601
|
+
return /* @__PURE__ */ jsx13(Wrapper3, {
|
|
602
|
+
children: /* @__PURE__ */ jsx13(Input, {
|
|
603
|
+
...props,
|
|
604
|
+
value,
|
|
605
|
+
leftAdornments: icon && /* @__PURE__ */ jsx13(Icon5, {
|
|
606
|
+
name: icon.name,
|
|
607
|
+
data: icon,
|
|
608
|
+
size: 18
|
|
609
|
+
}),
|
|
610
|
+
rightAdornments: !!value && /* @__PURE__ */ jsx13(Tooltip, {
|
|
611
|
+
title: "Clear input",
|
|
612
|
+
children: /* @__PURE__ */ jsx13(CloseButton, {
|
|
613
|
+
variant: "ghost_icon",
|
|
614
|
+
onClick: () => setValue(""),
|
|
615
|
+
children: /* @__PURE__ */ jsx13(Icon5, {
|
|
616
|
+
name: close.name,
|
|
617
|
+
data: close,
|
|
618
|
+
size: 18
|
|
619
|
+
})
|
|
620
|
+
})
|
|
621
|
+
}),
|
|
622
|
+
onChange: (event) => setValue(event.target.value)
|
|
623
|
+
})
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
// src/DataTable/filters/functions.ts
|
|
628
|
+
import { rankItem } from "@tanstack/match-sorter-utils";
|
|
629
|
+
var fuzzyFilter = (row, columnId, value, addMeta) => {
|
|
630
|
+
const itemRank = rankItem(row.getValue(columnId), value);
|
|
631
|
+
addMeta({
|
|
632
|
+
itemRank
|
|
633
|
+
});
|
|
634
|
+
return itemRank.passed;
|
|
635
|
+
};
|
|
636
|
+
|
|
637
|
+
// src/DataTable/components/ColumnSelect.tsx
|
|
638
|
+
import { Button as Button4, Checkbox as Checkbox2, Divider, Icon as Icon6, Popover } from "@equinor/eds-core-react";
|
|
639
|
+
import { close as close2, view_column } from "@equinor/eds-icons";
|
|
640
|
+
import { useRef, useState as useState3 } from "react";
|
|
641
|
+
import styled12 from "styled-components";
|
|
560
642
|
|
|
561
643
|
// src/DataTable/utils.tsx
|
|
562
644
|
function capitalizeHeader(context) {
|
|
@@ -581,25 +663,25 @@ function prependSelectColumn(columns, config) {
|
|
|
581
663
|
}
|
|
582
664
|
|
|
583
665
|
// src/DataTable/components/ColumnSelect.tsx
|
|
584
|
-
import { Fragment as Fragment2, jsx as
|
|
585
|
-
var ColumnSelectContent =
|
|
666
|
+
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
667
|
+
var ColumnSelectContent = styled12.div`
|
|
586
668
|
display: grid;
|
|
587
669
|
grid-template-columns: repeat(2, 1fr);
|
|
588
670
|
grid-gap: 0.5rem;
|
|
589
671
|
`;
|
|
590
|
-
var ActionsWrapper =
|
|
672
|
+
var ActionsWrapper = styled12.div`
|
|
591
673
|
display: flex;
|
|
592
674
|
align-items: center;
|
|
593
675
|
justify-content: flex-end;
|
|
594
676
|
gap: 0.5rem;
|
|
595
677
|
`;
|
|
596
678
|
function ColumnSelect({ table }) {
|
|
597
|
-
const [isOpen, setIsOpen] =
|
|
679
|
+
const [isOpen, setIsOpen] = useState3(false);
|
|
598
680
|
const referenceElement = useRef(null);
|
|
599
681
|
const selectableColumns = table.getAllLeafColumns().filter((column) => column.id !== "select");
|
|
600
682
|
return /* @__PURE__ */ jsxs8(Fragment2, {
|
|
601
683
|
children: [
|
|
602
|
-
/* @__PURE__ */
|
|
684
|
+
/* @__PURE__ */ jsx14(Button4, {
|
|
603
685
|
"aria-haspopup": true,
|
|
604
686
|
id: "column-select-anchor",
|
|
605
687
|
"aria-controls": "column-select-popover",
|
|
@@ -607,7 +689,7 @@ function ColumnSelect({ table }) {
|
|
|
607
689
|
ref: referenceElement,
|
|
608
690
|
variant: "ghost_icon",
|
|
609
691
|
onClick: () => setIsOpen(true),
|
|
610
|
-
children: /* @__PURE__ */
|
|
692
|
+
children: /* @__PURE__ */ jsx14(Icon6, {
|
|
611
693
|
name: "view_column",
|
|
612
694
|
data: view_column
|
|
613
695
|
})
|
|
@@ -621,16 +703,16 @@ function ColumnSelect({ table }) {
|
|
|
621
703
|
children: [
|
|
622
704
|
/* @__PURE__ */ jsxs8(Popover.Header, {
|
|
623
705
|
children: [
|
|
624
|
-
/* @__PURE__ */
|
|
706
|
+
/* @__PURE__ */ jsx14(Popover.Title, {
|
|
625
707
|
children: "Column settings"
|
|
626
708
|
}),
|
|
627
|
-
/* @__PURE__ */
|
|
709
|
+
/* @__PURE__ */ jsx14(Button4, {
|
|
628
710
|
variant: "ghost_icon",
|
|
629
711
|
"aria-label": "Close column select",
|
|
630
712
|
onClick: () => setIsOpen(false),
|
|
631
|
-
children: /* @__PURE__ */
|
|
713
|
+
children: /* @__PURE__ */ jsx14(Icon6, {
|
|
632
714
|
name: "close",
|
|
633
|
-
data:
|
|
715
|
+
data: close2,
|
|
634
716
|
size: 24
|
|
635
717
|
})
|
|
636
718
|
})
|
|
@@ -638,20 +720,20 @@ function ColumnSelect({ table }) {
|
|
|
638
720
|
}),
|
|
639
721
|
/* @__PURE__ */ jsxs8(Popover.Content, {
|
|
640
722
|
children: [
|
|
641
|
-
/* @__PURE__ */
|
|
723
|
+
/* @__PURE__ */ jsx14(ColumnSelectContent, {
|
|
642
724
|
children: selectableColumns.map((column) => {
|
|
643
|
-
return /* @__PURE__ */
|
|
725
|
+
return /* @__PURE__ */ jsx14(Checkbox2, {
|
|
644
726
|
checked: column.getIsVisible(),
|
|
645
727
|
label: getColumnHeader(column),
|
|
646
728
|
onChange: column.getToggleVisibilityHandler()
|
|
647
729
|
}, column.id);
|
|
648
730
|
})
|
|
649
731
|
}),
|
|
650
|
-
/* @__PURE__ */
|
|
732
|
+
/* @__PURE__ */ jsx14(Divider, {
|
|
651
733
|
variant: "small"
|
|
652
734
|
}),
|
|
653
|
-
/* @__PURE__ */
|
|
654
|
-
children: /* @__PURE__ */
|
|
735
|
+
/* @__PURE__ */ jsx14(ActionsWrapper, {
|
|
736
|
+
children: /* @__PURE__ */ jsx14(Button4, {
|
|
655
737
|
color: "secondary",
|
|
656
738
|
variant: "ghost",
|
|
657
739
|
disabled: table.getIsAllColumnsVisible(),
|
|
@@ -668,79 +750,7 @@ function ColumnSelect({ table }) {
|
|
|
668
750
|
}
|
|
669
751
|
|
|
670
752
|
// src/DataTable/components/DataTableHeader.tsx
|
|
671
|
-
import {
|
|
672
|
-
import { search } from "@equinor/eds-icons";
|
|
673
|
-
import { useAtom } from "jotai";
|
|
674
|
-
import styled13 from "styled-components";
|
|
675
|
-
|
|
676
|
-
// src/DataTable/filters/DebouncedInput.tsx
|
|
677
|
-
import { Button as Button4, Icon as Icon6, Input, Tooltip } from "@equinor/eds-core-react";
|
|
678
|
-
import { close as close2 } from "@equinor/eds-icons";
|
|
679
|
-
import { useEffect, useState as useState3 } from "react";
|
|
680
|
-
import styled12 from "styled-components";
|
|
681
|
-
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
682
|
-
var Wrapper3 = styled12.div`
|
|
683
|
-
width: 200px;
|
|
684
|
-
`;
|
|
685
|
-
var CloseButton = styled12(Button4)`
|
|
686
|
-
width: 24px;
|
|
687
|
-
height: 24px;
|
|
688
|
-
`;
|
|
689
|
-
function DebouncedInput({
|
|
690
|
-
value: initialValue,
|
|
691
|
-
onChange,
|
|
692
|
-
icon,
|
|
693
|
-
debounce = 500,
|
|
694
|
-
...props
|
|
695
|
-
}) {
|
|
696
|
-
const [value, setValue] = useState3(initialValue);
|
|
697
|
-
useEffect(() => {
|
|
698
|
-
setValue(initialValue);
|
|
699
|
-
}, [initialValue]);
|
|
700
|
-
useEffect(() => {
|
|
701
|
-
const timeout = setTimeout(() => {
|
|
702
|
-
onChange(value);
|
|
703
|
-
}, debounce);
|
|
704
|
-
return () => clearTimeout(timeout);
|
|
705
|
-
}, [value]);
|
|
706
|
-
return /* @__PURE__ */ jsx14(Wrapper3, {
|
|
707
|
-
children: /* @__PURE__ */ jsx14(Input, {
|
|
708
|
-
...props,
|
|
709
|
-
value,
|
|
710
|
-
leftAdornments: icon && /* @__PURE__ */ jsx14(Icon6, {
|
|
711
|
-
name: icon.name,
|
|
712
|
-
data: icon,
|
|
713
|
-
size: 18
|
|
714
|
-
}),
|
|
715
|
-
rightAdornments: !!value && /* @__PURE__ */ jsx14(Tooltip, {
|
|
716
|
-
title: "Clear input",
|
|
717
|
-
children: /* @__PURE__ */ jsx14(CloseButton, {
|
|
718
|
-
variant: "ghost_icon",
|
|
719
|
-
onClick: () => setValue(""),
|
|
720
|
-
children: /* @__PURE__ */ jsx14(Icon6, {
|
|
721
|
-
name: close2.name,
|
|
722
|
-
data: close2,
|
|
723
|
-
size: 18
|
|
724
|
-
})
|
|
725
|
-
})
|
|
726
|
-
}),
|
|
727
|
-
onChange: (event) => setValue(event.target.value)
|
|
728
|
-
})
|
|
729
|
-
});
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
// src/DataTable/filters/functions.ts
|
|
733
|
-
import { rankItem } from "@tanstack/match-sorter-utils";
|
|
734
|
-
var fuzzyFilter = (row, columnId, value, addMeta) => {
|
|
735
|
-
const itemRank = rankItem(row.getValue(columnId), value);
|
|
736
|
-
addMeta({
|
|
737
|
-
itemRank
|
|
738
|
-
});
|
|
739
|
-
return itemRank.passed;
|
|
740
|
-
};
|
|
741
|
-
|
|
742
|
-
// src/DataTable/components/DataTableHeader.tsx
|
|
743
|
-
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
753
|
+
import { Fragment as Fragment3, jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
744
754
|
var DataTableHeaderWrapper = styled13.div`
|
|
745
755
|
display: flex;
|
|
746
756
|
align-items: center;
|
|
@@ -754,7 +764,8 @@ var FilterContainer = styled13.div`
|
|
|
754
764
|
gap: 1rem;
|
|
755
765
|
justify-content: flex-end;
|
|
756
766
|
`;
|
|
757
|
-
|
|
767
|
+
function DataTableHeader({ config, table, ...props }) {
|
|
768
|
+
var _a;
|
|
758
769
|
const [globalFilter, setGlobalFilter] = useAtom(globalFilterAtom);
|
|
759
770
|
return /* @__PURE__ */ jsxs9(DataTableHeaderWrapper, {
|
|
760
771
|
className: "--table-caption",
|
|
@@ -764,21 +775,26 @@ var DataTableHeader = (props) => {
|
|
|
764
775
|
variant: "h3",
|
|
765
776
|
children: props == null ? void 0 : props.tableCaption
|
|
766
777
|
}),
|
|
767
|
-
|
|
778
|
+
/* @__PURE__ */ jsx15(FilterContainer, {
|
|
768
779
|
className: "--filter-container",
|
|
769
|
-
children:
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
780
|
+
children: /* @__PURE__ */ jsxs9(Fragment3, {
|
|
781
|
+
children: [
|
|
782
|
+
(config == null ? void 0 : config.globalFilter) && /* @__PURE__ */ jsx15(DebouncedInput, {
|
|
783
|
+
value: globalFilter,
|
|
784
|
+
icon: search,
|
|
785
|
+
placeholder: (config == null ? void 0 : config.globalFilterPlaceholder) ?? "Search all columns",
|
|
786
|
+
onChange: (value) => setGlobalFilter(String(value))
|
|
787
|
+
}),
|
|
788
|
+
(_a = config == null ? void 0 : config.filterActions) == null ? void 0 : _a.call(config, table),
|
|
789
|
+
(config == null ? void 0 : config.columnSelect) && /* @__PURE__ */ jsx15(ColumnSelect, {
|
|
790
|
+
table
|
|
791
|
+
})
|
|
792
|
+
]
|
|
793
|
+
})
|
|
778
794
|
})
|
|
779
795
|
]
|
|
780
796
|
});
|
|
781
|
-
}
|
|
797
|
+
}
|
|
782
798
|
|
|
783
799
|
// src/DataTable/components/VirtualTable.tsx
|
|
784
800
|
import { Table as Table8 } from "@equinor/eds-core-react";
|
|
@@ -869,6 +885,7 @@ function DataTable({
|
|
|
869
885
|
header,
|
|
870
886
|
filters,
|
|
871
887
|
config,
|
|
888
|
+
cellConfig,
|
|
872
889
|
rowConfig
|
|
873
890
|
}) {
|
|
874
891
|
const [columnVisibility, setColumnVisibility] = useAtom2(columnVisibilityAtom);
|
|
@@ -926,12 +943,9 @@ function DataTable({
|
|
|
926
943
|
children: [
|
|
927
944
|
/* @__PURE__ */ jsx18(DataTableHeader, {
|
|
928
945
|
tableCaption: header == null ? void 0 : header.tableCaption,
|
|
929
|
-
enableGlobalFilter: filters == null ? void 0 : filters.globalFilter,
|
|
930
|
-
globalFilterPlaceholder: filters == null ? void 0 : filters.globalFilterPlaceholder,
|
|
931
946
|
captionPadding: header == null ? void 0 : header.captionPadding,
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
})
|
|
947
|
+
table,
|
|
948
|
+
config: filters
|
|
935
949
|
}),
|
|
936
950
|
/* @__PURE__ */ jsx18("div", {
|
|
937
951
|
ref: tableContainerRef,
|
|
@@ -940,11 +954,13 @@ function DataTable({
|
|
|
940
954
|
containerRef: tableContainerRef,
|
|
941
955
|
table,
|
|
942
956
|
rowConfig,
|
|
957
|
+
cellConfig,
|
|
943
958
|
isLoading,
|
|
944
959
|
stickyHeader: header == null ? void 0 : header.stickyHeader
|
|
945
960
|
}) : /* @__PURE__ */ jsx18(BasicTable, {
|
|
946
961
|
table,
|
|
947
962
|
rowConfig,
|
|
963
|
+
cellConfig,
|
|
948
964
|
isLoading,
|
|
949
965
|
stickyHeader: header == null ? void 0 : header.stickyHeader
|
|
950
966
|
})
|
|
@@ -970,6 +986,7 @@ export {
|
|
|
970
986
|
AppShell,
|
|
971
987
|
AppSidebar,
|
|
972
988
|
ChipsCell,
|
|
989
|
+
ColumnSelect,
|
|
973
990
|
DataTable2 as DataTable,
|
|
974
991
|
DynamicCell,
|
|
975
992
|
HierarchyCell,
|