@equinor/apollo-components 3.1.2-rowfix.21 → 3.1.2-rowfix.22
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 +42 -49
- package/dist/index.mjs +42 -49
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -661,7 +661,6 @@ 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
665
|
var import_react7 = require("react");
|
|
667
666
|
var import_styled_components16 = __toESM(require("styled-components"));
|
|
@@ -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,13 +938,12 @@ 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,
|
|
947
|
-
hasRef,
|
|
948
947
|
containerRef,
|
|
949
948
|
...props
|
|
950
949
|
}) {
|
|
@@ -952,37 +951,45 @@ function VirtualTableBody({
|
|
|
952
951
|
const { rows } = table.getRowModel();
|
|
953
952
|
const rowVirtualizer = (0, import_react_virtual.useVirtualizer)({
|
|
954
953
|
count: rows.length,
|
|
955
|
-
getScrollElement: () => containerRef.current,
|
|
956
954
|
estimateSize: () => 48,
|
|
955
|
+
getScrollElement: () => containerRef.current,
|
|
957
956
|
measureElement: (element) => element == null ? void 0 : element.getBoundingClientRect().height,
|
|
958
|
-
overscan:
|
|
957
|
+
overscan: 5
|
|
959
958
|
});
|
|
960
|
-
if (!rowVirtualizer)
|
|
961
|
-
return null;
|
|
962
959
|
const virtualRows = rowVirtualizer.getVirtualItems();
|
|
963
|
-
console.log("VirtualTableBody", { container: containerRef.current, virtualRows, hasRef });
|
|
964
960
|
const paddingTop = virtualRows.length > 0 ? ((_a = virtualRows == null ? void 0 : virtualRows[0]) == null ? void 0 : _a.start) || 0 : 0;
|
|
965
961
|
const paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (((_b = virtualRows == null ? void 0 : virtualRows[virtualRows.length - 1]) == null ? void 0 : _b.end) || 0) : 0;
|
|
966
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
967
|
-
style: { height: rowVirtualizer.getTotalSize() },
|
|
962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_eds_core_react18.Table, {
|
|
968
963
|
children: [
|
|
969
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
970
|
-
|
|
964
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_eds_core_react18.Table.Caption, {
|
|
965
|
+
hidden: true,
|
|
966
|
+
children: props.tableCaption
|
|
971
967
|
}),
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
row,
|
|
976
|
-
rowConfig,
|
|
977
|
-
cellConfig,
|
|
978
|
-
measureElement: rowVirtualizer.measureElement,
|
|
979
|
-
index: virtualRow.index
|
|
980
|
-
}, row.id);
|
|
981
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PlaceholderRow, {
|
|
982
|
-
isLoading: props.isLoading
|
|
968
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TableHeader, {
|
|
969
|
+
sticky: props.stickyHeader,
|
|
970
|
+
table
|
|
983
971
|
}),
|
|
984
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.
|
|
985
|
-
|
|
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
|
+
]
|
|
986
993
|
})
|
|
987
994
|
]
|
|
988
995
|
});
|
|
@@ -1121,7 +1128,6 @@ function DataTable(props) {
|
|
|
1121
1128
|
}, [table, (_p = props.expansion) == null ? void 0 : _p.expandAllByDefault]);
|
|
1122
1129
|
const { isLoading, rowConfig } = props;
|
|
1123
1130
|
const tableContainerRef = (0, import_react7.useRef)(null);
|
|
1124
|
-
console.log("DataTable", { container: tableContainerRef.current });
|
|
1125
1131
|
const onTableContainerScroll = useFetchMoreOnBottomReached(
|
|
1126
1132
|
tableContainerRef,
|
|
1127
1133
|
props.infiniteScroll
|
|
@@ -1149,7 +1155,6 @@ function DataTable(props) {
|
|
|
1149
1155
|
onScroll: ((_r = props.tableContainerProps) == null ? void 0 : _r.onScroll) ?? onTableContainerScroll,
|
|
1150
1156
|
ref: (node) => {
|
|
1151
1157
|
var _a2;
|
|
1152
|
-
console.log({ node });
|
|
1153
1158
|
if (node) {
|
|
1154
1159
|
tableContainerRef.current = node;
|
|
1155
1160
|
if ((_a2 = props.tableContainerProps) == null ? void 0 : _a2.ref) {
|
|
@@ -1157,26 +1162,14 @@ function DataTable(props) {
|
|
|
1157
1162
|
}
|
|
1158
1163
|
}
|
|
1159
1164
|
},
|
|
1160
|
-
children: (props == null ? void 0 : props.virtual) ? /* @__PURE__ */ (0, import_jsx_runtime19.
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
table
|
|
1169
|
-
}),
|
|
1170
|
-
tableContainerRef.current !== null && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(VirtualTableBody, {
|
|
1171
|
-
containerRef: tableContainerRef,
|
|
1172
|
-
tableCaption: props.tableCaption,
|
|
1173
|
-
table,
|
|
1174
|
-
rowConfig,
|
|
1175
|
-
cellConfig,
|
|
1176
|
-
isLoading,
|
|
1177
|
-
stickyHeader: props.stickyHeader
|
|
1178
|
-
})
|
|
1179
|
-
]
|
|
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
|
|
1180
1173
|
}) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BasicTable, {
|
|
1181
1174
|
tableCaption: props.tableCaption,
|
|
1182
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,
|
|
@@ -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,13 +895,12 @@ 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,
|
|
904
|
-
hasRef,
|
|
905
904
|
containerRef,
|
|
906
905
|
...props
|
|
907
906
|
}) {
|
|
@@ -909,37 +908,45 @@ function VirtualTableBody({
|
|
|
909
908
|
const { rows } = table.getRowModel();
|
|
910
909
|
const rowVirtualizer = useVirtualizer({
|
|
911
910
|
count: rows.length,
|
|
912
|
-
getScrollElement: () => containerRef.current,
|
|
913
911
|
estimateSize: () => 48,
|
|
912
|
+
getScrollElement: () => containerRef.current,
|
|
914
913
|
measureElement: (element) => element == null ? void 0 : element.getBoundingClientRect().height,
|
|
915
|
-
overscan:
|
|
914
|
+
overscan: 5
|
|
916
915
|
});
|
|
917
|
-
if (!rowVirtualizer)
|
|
918
|
-
return null;
|
|
919
916
|
const virtualRows = rowVirtualizer.getVirtualItems();
|
|
920
|
-
console.log("VirtualTableBody", { container: containerRef.current, virtualRows, hasRef });
|
|
921
917
|
const paddingTop = virtualRows.length > 0 ? ((_a = virtualRows == null ? void 0 : virtualRows[0]) == null ? void 0 : _a.start) || 0 : 0;
|
|
922
918
|
const paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (((_b = virtualRows == null ? void 0 : virtualRows[virtualRows.length - 1]) == null ? void 0 : _b.end) || 0) : 0;
|
|
923
|
-
return /* @__PURE__ */ jsxs10(
|
|
924
|
-
style: { height: rowVirtualizer.getTotalSize() },
|
|
919
|
+
return /* @__PURE__ */ jsxs10(Table9, {
|
|
925
920
|
children: [
|
|
926
|
-
/* @__PURE__ */ jsx18(
|
|
927
|
-
|
|
921
|
+
/* @__PURE__ */ jsx18(Table9.Caption, {
|
|
922
|
+
hidden: true,
|
|
923
|
+
children: props.tableCaption
|
|
928
924
|
}),
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
row,
|
|
933
|
-
rowConfig,
|
|
934
|
-
cellConfig,
|
|
935
|
-
measureElement: rowVirtualizer.measureElement,
|
|
936
|
-
index: virtualRow.index
|
|
937
|
-
}, row.id);
|
|
938
|
-
}) : /* @__PURE__ */ jsx18(PlaceholderRow, {
|
|
939
|
-
isLoading: props.isLoading
|
|
925
|
+
/* @__PURE__ */ jsx18(TableHeader, {
|
|
926
|
+
sticky: props.stickyHeader,
|
|
927
|
+
table
|
|
940
928
|
}),
|
|
941
|
-
/* @__PURE__ */
|
|
942
|
-
|
|
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
|
+
]
|
|
943
950
|
})
|
|
944
951
|
]
|
|
945
952
|
});
|
|
@@ -1078,7 +1085,6 @@ function DataTable(props) {
|
|
|
1078
1085
|
}, [table, (_p = props.expansion) == null ? void 0 : _p.expandAllByDefault]);
|
|
1079
1086
|
const { isLoading, rowConfig } = props;
|
|
1080
1087
|
const tableContainerRef = useRef3(null);
|
|
1081
|
-
console.log("DataTable", { container: tableContainerRef.current });
|
|
1082
1088
|
const onTableContainerScroll = useFetchMoreOnBottomReached(
|
|
1083
1089
|
tableContainerRef,
|
|
1084
1090
|
props.infiniteScroll
|
|
@@ -1106,7 +1112,6 @@ function DataTable(props) {
|
|
|
1106
1112
|
onScroll: ((_r = props.tableContainerProps) == null ? void 0 : _r.onScroll) ?? onTableContainerScroll,
|
|
1107
1113
|
ref: (node) => {
|
|
1108
1114
|
var _a2;
|
|
1109
|
-
console.log({ node });
|
|
1110
1115
|
if (node) {
|
|
1111
1116
|
tableContainerRef.current = node;
|
|
1112
1117
|
if ((_a2 = props.tableContainerProps) == null ? void 0 : _a2.ref) {
|
|
@@ -1114,26 +1119,14 @@ function DataTable(props) {
|
|
|
1114
1119
|
}
|
|
1115
1120
|
}
|
|
1116
1121
|
},
|
|
1117
|
-
children: (props == null ? void 0 : props.virtual) ? /* @__PURE__ */
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
table
|
|
1126
|
-
}),
|
|
1127
|
-
tableContainerRef.current !== null && /* @__PURE__ */ jsx19(VirtualTableBody, {
|
|
1128
|
-
containerRef: tableContainerRef,
|
|
1129
|
-
tableCaption: props.tableCaption,
|
|
1130
|
-
table,
|
|
1131
|
-
rowConfig,
|
|
1132
|
-
cellConfig,
|
|
1133
|
-
isLoading,
|
|
1134
|
-
stickyHeader: props.stickyHeader
|
|
1135
|
-
})
|
|
1136
|
-
]
|
|
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
|
|
1137
1130
|
}) : /* @__PURE__ */ jsx19(BasicTable, {
|
|
1138
1131
|
tableCaption: props.tableCaption,
|
|
1139
1132
|
table,
|