@tap-payments/os-micro-frontend-shared 0.1.160 → 0.1.161
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.
|
@@ -45,6 +45,13 @@ function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader,
|
|
|
45
45
|
delay: 1000,
|
|
46
46
|
});
|
|
47
47
|
const [showBackDrop, setShowBackdrop] = useState(false);
|
|
48
|
+
// Dynamic AutoSizer key that updates asynchronously when layout-affecting props change
|
|
49
|
+
const [autoSizerKey, setAutoSizerKey] = useState('INITIAL_KEY');
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
const depsKey = `${footerProps === null || footerProps === void 0 ? void 0 : footerProps.maximized}-${isMinimized}`;
|
|
52
|
+
const frame = requestAnimationFrame(() => setAutoSizerKey(depsKey));
|
|
53
|
+
return () => cancelAnimationFrame(frame);
|
|
54
|
+
}, [footerProps === null || footerProps === void 0 ? void 0 : footerProps.maximized, isMinimized]);
|
|
48
55
|
const isError = hasError(error);
|
|
49
56
|
const tableLoading = isLoading !== null && isLoading !== void 0 ? isLoading : true;
|
|
50
57
|
const tableError = !isLoading && rows.length === 0 && isError && !isNotFoundError(error);
|
|
@@ -78,10 +85,8 @@ function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader,
|
|
|
78
85
|
});
|
|
79
86
|
return (
|
|
80
87
|
// @ts-ignore
|
|
81
|
-
_jsx(InfiniteLoader, Object.assign({ "data-testid": "VirtualTable_InfiniteLoader", isItemLoaded: (index) => index !== lastItemIndex, itemCount: itemsCount, loadMoreItems: handleOnLoadMoreItems, threshold: threshold }, { children: ({ onItemsRendered, ref }) => (_jsx(AutoSizer, Object.assign({ ref: ref, "data-testid": "VirtualTable_AutoSizer" }, { children: ({ height, width }) => (_jsx(StyledVirtualList, Object.assign({ "data-testid": "VirtualTable_VirtualList", useIsScrolling: true, className: "list", itemData: itemData, height: height || 0, width: width || 0, itemCount: itemsCount, itemSize: () => tableRowHeight, onItemsRendered: onItemsRendered, setBackdropVisibility: setBackdropVisibility, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, scrollToIndex: scrollToIndex, overscanCount: TABLE_LIST_OVER_SCAN, isSheetView: isSheetView, listRef: listRef }, { children: ListItemWrapper }))) }),
|
|
88
|
+
_jsx(InfiniteLoader, Object.assign({ "data-testid": "VirtualTable_InfiniteLoader", isItemLoaded: (index) => index !== lastItemIndex, itemCount: itemsCount, loadMoreItems: handleOnLoadMoreItems, threshold: threshold }, { children: ({ onItemsRendered, ref }) => (_jsx(AutoSizer, Object.assign({ ref: ref, "data-testid": "VirtualTable_AutoSizer" }, { children: ({ height, width }) => (_jsx(StyledVirtualList, Object.assign({ "data-testid": "VirtualTable_VirtualList", useIsScrolling: true, className: "list", itemData: itemData, height: height || 0, width: width || 0, itemCount: itemsCount, itemSize: () => tableRowHeight, onItemsRendered: onItemsRendered, setBackdropVisibility: setBackdropVisibility, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, scrollToIndex: scrollToIndex, overscanCount: TABLE_LIST_OVER_SCAN, isSheetView: isSheetView, listRef: listRef }, { children: ListItemWrapper }))) }), autoSizerKey)) })));
|
|
82
89
|
}, [
|
|
83
|
-
isMinimized,
|
|
84
|
-
footerProps === null || footerProps === void 0 ? void 0 : footerProps.maximized,
|
|
85
90
|
lastItemIndex,
|
|
86
91
|
loadMoreItems,
|
|
87
92
|
threshold,
|
|
@@ -92,6 +97,7 @@ function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader,
|
|
|
92
97
|
isSheetView,
|
|
93
98
|
itemData,
|
|
94
99
|
scrollToIndex,
|
|
100
|
+
autoSizerKey,
|
|
95
101
|
]);
|
|
96
102
|
const showNoDataView = tableLoading || tableError || tableEmpty || hasTimeoutError;
|
|
97
103
|
return (_jsxs(_Fragment, { children: [_jsxs(TableContainer, { children: [_jsx(StyledTableBox, Object.assign({ as: "main", id: "table-box-container", "aria-labelledby": "table-box-container", "data-testid": "VirtualTable_StyledTableBox", "data-title": tableTitle, "data-direction": theme.direction, "data-are-all-rows-loaded": !!areAllRowsLoaded, "data-is-fetching-next-page": !!isFetchingNextPage, "data-scroll-to-index": scrollToIndex, "data-is-loading": !!isLoading, "data-is-error": !!isError, "data-is-error-timeout": !!hasTimeoutError, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showNoDataView: showNoDataView }, { children: _jsxs(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", showNoDataView: showNoDataView, sx: Object.assign({}, tableBodyStyles) }, { children: [showHeader && (_jsx(TableHeader, { "data-testid": "VirtualTable_TableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: orderedColumns, headerProps: headerProps, showBackDrop: showBackDrop, isSheetView: isSheetView })), showNoDataView ? (_jsx(TableNoData, { error: error, tableEmpty: tableEmpty, isTimeoutError: hasTimeoutError, tableError: tableError, tableLoading: tableLoading, orderedColumns: orderedColumns, triggerDataRefetch: triggerDataRefetch, footerProps: footerProps })) : (_jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
package/package.json
CHANGED