@equinor/apollo-components 3.1.2-rowfix.9 → 3.1.3
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.js +62 -56
- package/dist/index.mjs +60 -54
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -661,9 +661,8 @@ function TableHeader({ table, sticky }) {
|
|
|
661
661
|
}
|
|
662
662
|
|
|
663
663
|
// src/DataTable/DataTable.tsx
|
|
664
|
-
var import_eds_core_react18 = require("@equinor/eds-core-react");
|
|
665
664
|
var import_react_table3 = require("@tanstack/react-table");
|
|
666
|
-
var
|
|
665
|
+
var import_react7 = require("react");
|
|
667
666
|
var import_styled_components16 = __toESM(require("styled-components"));
|
|
668
667
|
|
|
669
668
|
// src/DataTable/components/BasicTable.tsx
|
|
@@ -922,7 +921,8 @@ function TableBanner({
|
|
|
922
921
|
});
|
|
923
922
|
}
|
|
924
923
|
|
|
925
|
-
// src/DataTable/components/
|
|
924
|
+
// src/DataTable/components/VirtualTable.tsx
|
|
925
|
+
var import_eds_core_react18 = require("@equinor/eds-core-react");
|
|
926
926
|
var import_react_virtual = require("@tanstack/react-virtual");
|
|
927
927
|
|
|
928
928
|
// src/DataTable/components/PaddingRow.tsx
|
|
@@ -938,9 +938,9 @@ var PaddingRow = (props) => {
|
|
|
938
938
|
});
|
|
939
939
|
};
|
|
940
940
|
|
|
941
|
-
// src/DataTable/components/
|
|
941
|
+
// src/DataTable/components/VirtualTable.tsx
|
|
942
942
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
943
|
-
function
|
|
943
|
+
function VirtualTable({
|
|
944
944
|
table,
|
|
945
945
|
rowConfig,
|
|
946
946
|
cellConfig,
|
|
@@ -951,37 +951,45 @@ function VirtualTableBody({
|
|
|
951
951
|
const { rows } = table.getRowModel();
|
|
952
952
|
const rowVirtualizer = (0, import_react_virtual.useVirtualizer)({
|
|
953
953
|
count: rows.length,
|
|
954
|
-
getScrollElement: () => containerRef,
|
|
955
954
|
estimateSize: () => 48,
|
|
955
|
+
getScrollElement: () => containerRef.current,
|
|
956
956
|
measureElement: (element) => element == null ? void 0 : element.getBoundingClientRect().height,
|
|
957
|
-
overscan:
|
|
957
|
+
overscan: 5
|
|
958
958
|
});
|
|
959
|
-
if (!rowVirtualizer)
|
|
960
|
-
return null;
|
|
961
959
|
const virtualRows = rowVirtualizer.getVirtualItems();
|
|
962
|
-
console.log("VirtualTableBody", { container: containerRef, virtualRows });
|
|
963
960
|
const paddingTop = virtualRows.length > 0 ? ((_a = virtualRows == null ? void 0 : virtualRows[0]) == null ? void 0 : _a.start) || 0 : 0;
|
|
964
961
|
const paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (((_b = virtualRows == null ? void 0 : virtualRows[virtualRows.length - 1]) == null ? void 0 : _b.end) || 0) : 0;
|
|
965
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
966
|
-
style: { height: rowVirtualizer.getTotalSize() },
|
|
962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_eds_core_react18.Table, {
|
|
967
963
|
children: [
|
|
968
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
969
|
-
|
|
964
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_eds_core_react18.Table.Caption, {
|
|
965
|
+
hidden: true,
|
|
966
|
+
children: props.tableCaption
|
|
970
967
|
}),
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
row,
|
|
975
|
-
rowConfig,
|
|
976
|
-
cellConfig,
|
|
977
|
-
measureElement: rowVirtualizer.measureElement,
|
|
978
|
-
index: virtualRow.index
|
|
979
|
-
}, row.id);
|
|
980
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PlaceholderRow, {
|
|
981
|
-
isLoading: props.isLoading
|
|
968
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TableHeader, {
|
|
969
|
+
sticky: props.stickyHeader,
|
|
970
|
+
table
|
|
982
971
|
}),
|
|
983
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.
|
|
984
|
-
|
|
972
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(TableBody, {
|
|
973
|
+
children: [
|
|
974
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PaddingRow, {
|
|
975
|
+
height: paddingTop
|
|
976
|
+
}),
|
|
977
|
+
rows.length ? virtualRows.map((virtualRow) => {
|
|
978
|
+
const row = rows[virtualRow.index];
|
|
979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TableRow, {
|
|
980
|
+
row,
|
|
981
|
+
rowConfig,
|
|
982
|
+
cellConfig,
|
|
983
|
+
index: virtualRow.index,
|
|
984
|
+
measureElement: rowVirtualizer.measureElement
|
|
985
|
+
}, row.id);
|
|
986
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PlaceholderRow, {
|
|
987
|
+
isLoading: props.isLoading
|
|
988
|
+
}),
|
|
989
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PaddingRow, {
|
|
990
|
+
height: paddingBottom
|
|
991
|
+
})
|
|
992
|
+
]
|
|
985
993
|
})
|
|
986
994
|
]
|
|
987
995
|
});
|
|
@@ -1016,6 +1024,13 @@ function useFetchMoreOnBottomReached(tableContainerRef, infiniteScrollConfig) {
|
|
|
1016
1024
|
return onTableContainerScroll;
|
|
1017
1025
|
}
|
|
1018
1026
|
|
|
1027
|
+
// src/DataTable/hooks/useForceRerender.ts
|
|
1028
|
+
var import_react6 = require("react");
|
|
1029
|
+
function useForceRerender() {
|
|
1030
|
+
const [, setTick] = (0, import_react6.useState)(0);
|
|
1031
|
+
return (0, import_react6.useCallback)(() => setTick((tick) => tick + 1), []);
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1019
1034
|
// src/DataTable/DataTable.tsx
|
|
1020
1035
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1021
1036
|
var DataTableWrapper = import_styled_components16.default.div`
|
|
@@ -1038,12 +1053,12 @@ var DataTableWrapper = import_styled_components16.default.div`
|
|
|
1038
1053
|
function DataTable(props) {
|
|
1039
1054
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
1040
1055
|
const { columns, data, bannerConfig, cellConfig, sorting } = props;
|
|
1041
|
-
const [internalColumnVisibility, setInternalColumnVisibility] = (0,
|
|
1056
|
+
const [internalColumnVisibility, setInternalColumnVisibility] = (0, import_react7.useState)({});
|
|
1042
1057
|
const [columnVisibility, setColumnVisibility] = [
|
|
1043
1058
|
((_a = props.columnVisibility) == null ? void 0 : _a.state) ?? internalColumnVisibility,
|
|
1044
1059
|
((_b = props.columnVisibility) == null ? void 0 : _b.onChange) ?? setInternalColumnVisibility
|
|
1045
1060
|
];
|
|
1046
|
-
const [internalGlobalFilterState, setInternalGlobalFilterState] = (0,
|
|
1061
|
+
const [internalGlobalFilterState, setInternalGlobalFilterState] = (0, import_react7.useState)("");
|
|
1047
1062
|
const [globalFilterState, setGlobalFilterState] = [
|
|
1048
1063
|
((_c = props.globalFilter) == null ? void 0 : _c.state) ?? internalGlobalFilterState,
|
|
1049
1064
|
((_d = props.globalFilter) == null ? void 0 : _d.onChange) ?? setInternalGlobalFilterState
|
|
@@ -1052,17 +1067,17 @@ function DataTable(props) {
|
|
|
1052
1067
|
function enableGlobalFilter(value) {
|
|
1053
1068
|
return enableOrUndefined(shouldEnableGlobalFilter, value);
|
|
1054
1069
|
}
|
|
1055
|
-
const [internalSortingState, setInternalSortingState] = (0,
|
|
1070
|
+
const [internalSortingState, setInternalSortingState] = (0, import_react7.useState)([]);
|
|
1056
1071
|
const [sortingState, setSortingState] = [
|
|
1057
1072
|
((_f = props.sorting) == null ? void 0 : _f.state) ?? internalSortingState,
|
|
1058
1073
|
((_g = props.sorting) == null ? void 0 : _g.onChange) ?? setInternalSortingState
|
|
1059
1074
|
];
|
|
1060
|
-
const [internalRowSelectionState, setInternalRowSelectionState] = (0,
|
|
1075
|
+
const [internalRowSelectionState, setInternalRowSelectionState] = (0, import_react7.useState)({});
|
|
1061
1076
|
const [rowSelectionState, setRowSelectionState] = [
|
|
1062
1077
|
((_h = props.rowSelection) == null ? void 0 : _h.state) ?? internalRowSelectionState,
|
|
1063
1078
|
((_i = props.rowSelection) == null ? void 0 : _i.onChange) ?? setInternalRowSelectionState
|
|
1064
1079
|
];
|
|
1065
|
-
const [internalExpandedState, setInternalExpandedState] = (0,
|
|
1080
|
+
const [internalExpandedState, setInternalExpandedState] = (0, import_react7.useState)({});
|
|
1066
1081
|
const [expandedState, setExpandedState] = [
|
|
1067
1082
|
((_j = props.expansion) == null ? void 0 : _j.state) ?? internalExpandedState,
|
|
1068
1083
|
((_k = props.expansion) == null ? void 0 : _k.onChange) ?? setInternalExpandedState
|
|
@@ -1105,19 +1120,23 @@ function DataTable(props) {
|
|
|
1105
1120
|
getSubRows: props == null ? void 0 : props.getSubRows,
|
|
1106
1121
|
getRowId: props == null ? void 0 : props.getRowId
|
|
1107
1122
|
});
|
|
1108
|
-
(0,
|
|
1123
|
+
(0, import_react7.useEffect)(() => {
|
|
1109
1124
|
var _a2;
|
|
1110
1125
|
if ((_a2 = props.expansion) == null ? void 0 : _a2.expandAllByDefault) {
|
|
1111
1126
|
table.toggleAllRowsExpanded();
|
|
1112
1127
|
}
|
|
1113
1128
|
}, [table, (_p = props.expansion) == null ? void 0 : _p.expandAllByDefault]);
|
|
1114
1129
|
const { isLoading, rowConfig } = props;
|
|
1115
|
-
const tableContainerRef = (0,
|
|
1116
|
-
console.log("DataTable", { container: tableContainerRef.current });
|
|
1130
|
+
const tableContainerRef = (0, import_react7.useRef)(null);
|
|
1117
1131
|
const onTableContainerScroll = useFetchMoreOnBottomReached(
|
|
1118
1132
|
tableContainerRef,
|
|
1119
1133
|
props.infiniteScroll
|
|
1120
1134
|
);
|
|
1135
|
+
const forceRerender = useForceRerender();
|
|
1136
|
+
(0, import_react7.useEffect)(() => {
|
|
1137
|
+
if (Boolean(tableContainerRef.current))
|
|
1138
|
+
forceRerender();
|
|
1139
|
+
}, [tableContainerRef.current === null]);
|
|
1121
1140
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(DataTableWrapper, {
|
|
1122
1141
|
height: props == null ? void 0 : props.height,
|
|
1123
1142
|
width: props == null ? void 0 : props.width,
|
|
@@ -1136,7 +1155,6 @@ function DataTable(props) {
|
|
|
1136
1155
|
onScroll: ((_r = props.tableContainerProps) == null ? void 0 : _r.onScroll) ?? onTableContainerScroll,
|
|
1137
1156
|
ref: (node) => {
|
|
1138
1157
|
var _a2;
|
|
1139
|
-
console.log({ node });
|
|
1140
1158
|
if (node) {
|
|
1141
1159
|
tableContainerRef.current = node;
|
|
1142
1160
|
if ((_a2 = props.tableContainerProps) == null ? void 0 : _a2.ref) {
|
|
@@ -1144,26 +1162,14 @@ function DataTable(props) {
|
|
|
1144
1162
|
}
|
|
1145
1163
|
}
|
|
1146
1164
|
},
|
|
1147
|
-
children: (props == null ? void 0 : props.virtual) ? /* @__PURE__ */ (0, import_jsx_runtime19.
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
table
|
|
1156
|
-
}),
|
|
1157
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(VirtualTableBody, {
|
|
1158
|
-
containerRef: tableContainerRef.current,
|
|
1159
|
-
tableCaption: props.tableCaption,
|
|
1160
|
-
table,
|
|
1161
|
-
rowConfig,
|
|
1162
|
-
cellConfig,
|
|
1163
|
-
isLoading,
|
|
1164
|
-
stickyHeader: props.stickyHeader
|
|
1165
|
-
})
|
|
1166
|
-
]
|
|
1165
|
+
children: (props == null ? void 0 : props.virtual) ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(VirtualTable, {
|
|
1166
|
+
containerRef: tableContainerRef,
|
|
1167
|
+
tableCaption: props.tableCaption,
|
|
1168
|
+
table,
|
|
1169
|
+
rowConfig,
|
|
1170
|
+
cellConfig,
|
|
1171
|
+
isLoading,
|
|
1172
|
+
stickyHeader: props.stickyHeader
|
|
1167
1173
|
}) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BasicTable, {
|
|
1168
1174
|
tableCaption: props.tableCaption,
|
|
1169
1175
|
table,
|
package/dist/index.mjs
CHANGED
|
@@ -612,7 +612,6 @@ function TableHeader({ table, sticky }) {
|
|
|
612
612
|
}
|
|
613
613
|
|
|
614
614
|
// src/DataTable/DataTable.tsx
|
|
615
|
-
import { Table as Table9 } from "@equinor/eds-core-react";
|
|
616
615
|
import {
|
|
617
616
|
getCoreRowModel,
|
|
618
617
|
getExpandedRowModel,
|
|
@@ -620,7 +619,7 @@ import {
|
|
|
620
619
|
getSortedRowModel,
|
|
621
620
|
useReactTable
|
|
622
621
|
} from "@tanstack/react-table";
|
|
623
|
-
import { useEffect as useEffect3, useRef as useRef3, useState as
|
|
622
|
+
import { useEffect as useEffect3, useRef as useRef3, useState as useState6 } from "react";
|
|
624
623
|
import styled16 from "styled-components";
|
|
625
624
|
|
|
626
625
|
// src/DataTable/components/BasicTable.tsx
|
|
@@ -879,7 +878,8 @@ function TableBanner({
|
|
|
879
878
|
});
|
|
880
879
|
}
|
|
881
880
|
|
|
882
|
-
// src/DataTable/components/
|
|
881
|
+
// src/DataTable/components/VirtualTable.tsx
|
|
882
|
+
import { Table as Table9 } from "@equinor/eds-core-react";
|
|
883
883
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
884
884
|
|
|
885
885
|
// src/DataTable/components/PaddingRow.tsx
|
|
@@ -895,9 +895,9 @@ var PaddingRow = (props) => {
|
|
|
895
895
|
});
|
|
896
896
|
};
|
|
897
897
|
|
|
898
|
-
// src/DataTable/components/
|
|
898
|
+
// src/DataTable/components/VirtualTable.tsx
|
|
899
899
|
import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
900
|
-
function
|
|
900
|
+
function VirtualTable({
|
|
901
901
|
table,
|
|
902
902
|
rowConfig,
|
|
903
903
|
cellConfig,
|
|
@@ -908,37 +908,45 @@ function VirtualTableBody({
|
|
|
908
908
|
const { rows } = table.getRowModel();
|
|
909
909
|
const rowVirtualizer = useVirtualizer({
|
|
910
910
|
count: rows.length,
|
|
911
|
-
getScrollElement: () => containerRef,
|
|
912
911
|
estimateSize: () => 48,
|
|
912
|
+
getScrollElement: () => containerRef.current,
|
|
913
913
|
measureElement: (element) => element == null ? void 0 : element.getBoundingClientRect().height,
|
|
914
|
-
overscan:
|
|
914
|
+
overscan: 5
|
|
915
915
|
});
|
|
916
|
-
if (!rowVirtualizer)
|
|
917
|
-
return null;
|
|
918
916
|
const virtualRows = rowVirtualizer.getVirtualItems();
|
|
919
|
-
console.log("VirtualTableBody", { container: containerRef, virtualRows });
|
|
920
917
|
const paddingTop = virtualRows.length > 0 ? ((_a = virtualRows == null ? void 0 : virtualRows[0]) == null ? void 0 : _a.start) || 0 : 0;
|
|
921
918
|
const paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (((_b = virtualRows == null ? void 0 : virtualRows[virtualRows.length - 1]) == null ? void 0 : _b.end) || 0) : 0;
|
|
922
|
-
return /* @__PURE__ */ jsxs10(
|
|
923
|
-
style: { height: rowVirtualizer.getTotalSize() },
|
|
919
|
+
return /* @__PURE__ */ jsxs10(Table9, {
|
|
924
920
|
children: [
|
|
925
|
-
/* @__PURE__ */ jsx18(
|
|
926
|
-
|
|
921
|
+
/* @__PURE__ */ jsx18(Table9.Caption, {
|
|
922
|
+
hidden: true,
|
|
923
|
+
children: props.tableCaption
|
|
927
924
|
}),
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
row,
|
|
932
|
-
rowConfig,
|
|
933
|
-
cellConfig,
|
|
934
|
-
measureElement: rowVirtualizer.measureElement,
|
|
935
|
-
index: virtualRow.index
|
|
936
|
-
}, row.id);
|
|
937
|
-
}) : /* @__PURE__ */ jsx18(PlaceholderRow, {
|
|
938
|
-
isLoading: props.isLoading
|
|
925
|
+
/* @__PURE__ */ jsx18(TableHeader, {
|
|
926
|
+
sticky: props.stickyHeader,
|
|
927
|
+
table
|
|
939
928
|
}),
|
|
940
|
-
/* @__PURE__ */
|
|
941
|
-
|
|
929
|
+
/* @__PURE__ */ jsxs10(TableBody, {
|
|
930
|
+
children: [
|
|
931
|
+
/* @__PURE__ */ jsx18(PaddingRow, {
|
|
932
|
+
height: paddingTop
|
|
933
|
+
}),
|
|
934
|
+
rows.length ? virtualRows.map((virtualRow) => {
|
|
935
|
+
const row = rows[virtualRow.index];
|
|
936
|
+
return /* @__PURE__ */ jsx18(TableRow, {
|
|
937
|
+
row,
|
|
938
|
+
rowConfig,
|
|
939
|
+
cellConfig,
|
|
940
|
+
index: virtualRow.index,
|
|
941
|
+
measureElement: rowVirtualizer.measureElement
|
|
942
|
+
}, row.id);
|
|
943
|
+
}) : /* @__PURE__ */ jsx18(PlaceholderRow, {
|
|
944
|
+
isLoading: props.isLoading
|
|
945
|
+
}),
|
|
946
|
+
/* @__PURE__ */ jsx18(PaddingRow, {
|
|
947
|
+
height: paddingBottom
|
|
948
|
+
})
|
|
949
|
+
]
|
|
942
950
|
})
|
|
943
951
|
]
|
|
944
952
|
});
|
|
@@ -973,6 +981,13 @@ function useFetchMoreOnBottomReached(tableContainerRef, infiniteScrollConfig) {
|
|
|
973
981
|
return onTableContainerScroll;
|
|
974
982
|
}
|
|
975
983
|
|
|
984
|
+
// src/DataTable/hooks/useForceRerender.ts
|
|
985
|
+
import { useCallback as useCallback2, useState as useState5 } from "react";
|
|
986
|
+
function useForceRerender() {
|
|
987
|
+
const [, setTick] = useState5(0);
|
|
988
|
+
return useCallback2(() => setTick((tick) => tick + 1), []);
|
|
989
|
+
}
|
|
990
|
+
|
|
976
991
|
// src/DataTable/DataTable.tsx
|
|
977
992
|
import { jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
978
993
|
var DataTableWrapper = styled16.div`
|
|
@@ -995,12 +1010,12 @@ var DataTableWrapper = styled16.div`
|
|
|
995
1010
|
function DataTable(props) {
|
|
996
1011
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
997
1012
|
const { columns, data, bannerConfig, cellConfig, sorting } = props;
|
|
998
|
-
const [internalColumnVisibility, setInternalColumnVisibility] =
|
|
1013
|
+
const [internalColumnVisibility, setInternalColumnVisibility] = useState6({});
|
|
999
1014
|
const [columnVisibility, setColumnVisibility] = [
|
|
1000
1015
|
((_a = props.columnVisibility) == null ? void 0 : _a.state) ?? internalColumnVisibility,
|
|
1001
1016
|
((_b = props.columnVisibility) == null ? void 0 : _b.onChange) ?? setInternalColumnVisibility
|
|
1002
1017
|
];
|
|
1003
|
-
const [internalGlobalFilterState, setInternalGlobalFilterState] =
|
|
1018
|
+
const [internalGlobalFilterState, setInternalGlobalFilterState] = useState6("");
|
|
1004
1019
|
const [globalFilterState, setGlobalFilterState] = [
|
|
1005
1020
|
((_c = props.globalFilter) == null ? void 0 : _c.state) ?? internalGlobalFilterState,
|
|
1006
1021
|
((_d = props.globalFilter) == null ? void 0 : _d.onChange) ?? setInternalGlobalFilterState
|
|
@@ -1009,17 +1024,17 @@ function DataTable(props) {
|
|
|
1009
1024
|
function enableGlobalFilter(value) {
|
|
1010
1025
|
return enableOrUndefined(shouldEnableGlobalFilter, value);
|
|
1011
1026
|
}
|
|
1012
|
-
const [internalSortingState, setInternalSortingState] =
|
|
1027
|
+
const [internalSortingState, setInternalSortingState] = useState6([]);
|
|
1013
1028
|
const [sortingState, setSortingState] = [
|
|
1014
1029
|
((_f = props.sorting) == null ? void 0 : _f.state) ?? internalSortingState,
|
|
1015
1030
|
((_g = props.sorting) == null ? void 0 : _g.onChange) ?? setInternalSortingState
|
|
1016
1031
|
];
|
|
1017
|
-
const [internalRowSelectionState, setInternalRowSelectionState] =
|
|
1032
|
+
const [internalRowSelectionState, setInternalRowSelectionState] = useState6({});
|
|
1018
1033
|
const [rowSelectionState, setRowSelectionState] = [
|
|
1019
1034
|
((_h = props.rowSelection) == null ? void 0 : _h.state) ?? internalRowSelectionState,
|
|
1020
1035
|
((_i = props.rowSelection) == null ? void 0 : _i.onChange) ?? setInternalRowSelectionState
|
|
1021
1036
|
];
|
|
1022
|
-
const [internalExpandedState, setInternalExpandedState] =
|
|
1037
|
+
const [internalExpandedState, setInternalExpandedState] = useState6({});
|
|
1023
1038
|
const [expandedState, setExpandedState] = [
|
|
1024
1039
|
((_j = props.expansion) == null ? void 0 : _j.state) ?? internalExpandedState,
|
|
1025
1040
|
((_k = props.expansion) == null ? void 0 : _k.onChange) ?? setInternalExpandedState
|
|
@@ -1070,11 +1085,15 @@ function DataTable(props) {
|
|
|
1070
1085
|
}, [table, (_p = props.expansion) == null ? void 0 : _p.expandAllByDefault]);
|
|
1071
1086
|
const { isLoading, rowConfig } = props;
|
|
1072
1087
|
const tableContainerRef = useRef3(null);
|
|
1073
|
-
console.log("DataTable", { container: tableContainerRef.current });
|
|
1074
1088
|
const onTableContainerScroll = useFetchMoreOnBottomReached(
|
|
1075
1089
|
tableContainerRef,
|
|
1076
1090
|
props.infiniteScroll
|
|
1077
1091
|
);
|
|
1092
|
+
const forceRerender = useForceRerender();
|
|
1093
|
+
useEffect3(() => {
|
|
1094
|
+
if (Boolean(tableContainerRef.current))
|
|
1095
|
+
forceRerender();
|
|
1096
|
+
}, [tableContainerRef.current === null]);
|
|
1078
1097
|
return /* @__PURE__ */ jsxs11(DataTableWrapper, {
|
|
1079
1098
|
height: props == null ? void 0 : props.height,
|
|
1080
1099
|
width: props == null ? void 0 : props.width,
|
|
@@ -1093,7 +1112,6 @@ function DataTable(props) {
|
|
|
1093
1112
|
onScroll: ((_r = props.tableContainerProps) == null ? void 0 : _r.onScroll) ?? onTableContainerScroll,
|
|
1094
1113
|
ref: (node) => {
|
|
1095
1114
|
var _a2;
|
|
1096
|
-
console.log({ node });
|
|
1097
1115
|
if (node) {
|
|
1098
1116
|
tableContainerRef.current = node;
|
|
1099
1117
|
if ((_a2 = props.tableContainerProps) == null ? void 0 : _a2.ref) {
|
|
@@ -1101,26 +1119,14 @@ function DataTable(props) {
|
|
|
1101
1119
|
}
|
|
1102
1120
|
}
|
|
1103
1121
|
},
|
|
1104
|
-
children: (props == null ? void 0 : props.virtual) ? /* @__PURE__ */
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
table
|
|
1113
|
-
}),
|
|
1114
|
-
/* @__PURE__ */ jsx19(VirtualTableBody, {
|
|
1115
|
-
containerRef: tableContainerRef.current,
|
|
1116
|
-
tableCaption: props.tableCaption,
|
|
1117
|
-
table,
|
|
1118
|
-
rowConfig,
|
|
1119
|
-
cellConfig,
|
|
1120
|
-
isLoading,
|
|
1121
|
-
stickyHeader: props.stickyHeader
|
|
1122
|
-
})
|
|
1123
|
-
]
|
|
1122
|
+
children: (props == null ? void 0 : props.virtual) ? /* @__PURE__ */ jsx19(VirtualTable, {
|
|
1123
|
+
containerRef: tableContainerRef,
|
|
1124
|
+
tableCaption: props.tableCaption,
|
|
1125
|
+
table,
|
|
1126
|
+
rowConfig,
|
|
1127
|
+
cellConfig,
|
|
1128
|
+
isLoading,
|
|
1129
|
+
stickyHeader: props.stickyHeader
|
|
1124
1130
|
}) : /* @__PURE__ */ jsx19(BasicTable, {
|
|
1125
1131
|
tableCaption: props.tableCaption,
|
|
1126
1132
|
table,
|