@tap-payments/os-micro-frontend-shared 0.1.9-test.1-test.2 → 0.1.9-test.1-test.2-test.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.
@@ -16,18 +16,12 @@ import { useSynchronizedScroll } from './hooks/useSynchronizedScroll';
16
16
  import { usePinnedWidths } from './hooks/usePinnedWidths';
17
17
  import { useSelection } from './hooks/useSelection';
18
18
  import { useSheetViewStates } from './hooks/useSheetViewStates';
19
- import { useSharedItemSize } from './hooks/useSharedItemSize';
20
19
  function SheetViewVirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader, headerProps, rowProps, footerProps, rowHeight = 28, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded = false, tableBodyStyles, tableTitle, dragControls, onColumnPin, clearBackdropVisibilityTimeout = 100, isPinnable = false, tableMode, }) {
21
20
  var _a;
22
21
  const [showBackDrop, setShowBackdrop] = useState(false);
23
22
  const theme = useTheme();
24
23
  const { pinnedStartColumns, pinnedEndColumns, handleColumnPin, pinnedStartColumnsData, pinnedEndColumnsData, unpinnedColumnsData, orderedColumns, lastColumnId, } = usePinnedColumns(columns, isPinnable, onColumnPin);
25
24
  const { pinnedStartVirtualListRef, scrollableVirtualListRef, pinnedEndVirtualListRef, handleScroll } = useSynchronizedScroll();
26
- const { getItemSize, updateReferenceHeight } = useSharedItemSize({
27
- rowsLength: rows.length,
28
- areAllRowsLoaded,
29
- rowHeight,
30
- });
31
25
  const { selectedCell, selectedColumn, handleCellClick, handleColumnClick } = useSelection();
32
26
  const isDelayedFetchingNextPage = useDelayToSetValue({ value: isFetchingNextPage, delay: 1000 });
33
27
  const { isError, tableLoading, tableError, tableEmpty, hasTimeoutError, showNoDataView } = useSheetViewStates({
@@ -41,7 +35,7 @@ function SheetViewVirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, sho
41
35
  const renderPinnedColumn = (position, columnsData, columnsWidth, pinnedColumnsList) => {
42
36
  var _a;
43
37
  const listRef = position === 'start' ? pinnedStartVirtualListRef : pinnedEndVirtualListRef;
44
- return (_jsx(PinnedColumnSection, { "data-testid": `SheetViewVirtualTable_PinnedColumnSection_${position}`, position: position, columnsData: columnsData, columnsWidth: columnsWidth, pinnedColumnsList: pinnedColumnsList, showHeader: showHeader, headerProps: headerProps, columnsSorting: columnsSorting, onColumnSort: onColumnSort, showBackDrop: showBackDrop, onColumnPin: handleColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: handleColumnClick, listRef: listRef, itemsCount: itemsCount, rows: rows, rowProps: rowProps, rowsLength: rows.length, loadMoreItems: loadMoreItems, threshold: threshold, areAllRowsLoaded: areAllRowsLoaded, rowHeight: rowHeight, scrollToIndex: scrollToIndex, totalCount: (_a = footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount) !== null && _a !== void 0 ? _a : 0, isError: isError, isDelayedFetchingNextPage: Boolean(isDelayedFetchingNextPage), selectedCell: selectedCell, selectedColumnValue: selectedColumn, handleCellClick: handleCellClick, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, setShowBackdrop: setShowBackdrop, handleScroll: handleScroll, clearBackdropVisibilityTimeout: clearBackdropVisibilityTimeout, getItemSize: getItemSize, tableTitle: tableTitle, areAllRowsLoadedDataAttr: !!areAllRowsLoaded, isFetchingNextPageDataAttr: !!isFetchingNextPage, isLoadingDataAttr: !!isLoading, hasTimeoutErrorDataAttr: !!hasTimeoutError, tableMode: tableMode, showNoDataView: showNoDataView }));
38
+ return (_jsx(PinnedColumnSection, { "data-testid": `SheetViewVirtualTable_PinnedColumnSection_${position}`, position: position, columnsData: columnsData, columnsWidth: columnsWidth, pinnedColumnsList: pinnedColumnsList, showHeader: showHeader, headerProps: headerProps, columnsSorting: columnsSorting, onColumnSort: onColumnSort, showBackDrop: showBackDrop, onColumnPin: handleColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: handleColumnClick, listRef: listRef, itemsCount: itemsCount, rows: rows, rowProps: rowProps, rowsLength: rows.length, loadMoreItems: loadMoreItems, threshold: threshold, areAllRowsLoaded: areAllRowsLoaded, rowHeight: rowHeight, scrollToIndex: scrollToIndex, totalCount: (_a = footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount) !== null && _a !== void 0 ? _a : 0, isError: isError, isDelayedFetchingNextPage: Boolean(isDelayedFetchingNextPage), selectedCell: selectedCell, selectedColumnValue: selectedColumn, handleCellClick: handleCellClick, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, setShowBackdrop: setShowBackdrop, handleScroll: handleScroll, clearBackdropVisibilityTimeout: clearBackdropVisibilityTimeout, tableTitle: tableTitle, areAllRowsLoadedDataAttr: !!areAllRowsLoaded, isFetchingNextPageDataAttr: !!isFetchingNextPage, isLoadingDataAttr: !!isLoading, hasTimeoutErrorDataAttr: !!hasTimeoutError, tableMode: tableMode, showNoDataView: showNoDataView }));
45
39
  };
46
40
  const onPointerDown = (e) => {
47
41
  dragControls === null || dragControls === void 0 ? void 0 : dragControls.start(e);
@@ -49,6 +43,6 @@ function SheetViewVirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, sho
49
43
  return (_jsxs(_Fragment, { children: [_jsx(TableContainer, Object.assign({ "data-testid": "SheetViewVirtualTable_TableContainer" }, { children: showNoDataView ? (_jsx(NoDataSection, { "data-testid": "SheetViewVirtualTable_NoDataSection", showHeader: showHeader, headerProps: headerProps, columnsSorting: columnsSorting, onColumnSort: onColumnSort, showBackDrop: showBackDrop, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: handleColumnClick, orderedColumns: orderedColumns, showNoDataView: showNoDataView, tableLoading: tableLoading, tableTitle: tableTitle, areAllRowsLoaded: areAllRowsLoaded, isFetchingNextPage: isFetchingNextPage, isLoading: isLoading, isError: isError, hasTimeoutError: hasTimeoutError, tableEmpty: tableEmpty, tableError: tableError, error: error, triggerDataRefetch: triggerDataRefetch, footerProps: footerProps, tableBodyStyles: tableBodyStyles, tableMode: tableMode, scrollToIndex: scrollToIndex })) : (_jsxs(SheetViewVirtualTableWrapper, Object.assign({ "data-testid": "SheetViewVirtualTable_Wrapper" }, { children: [renderPinnedColumn('start', pinnedStartColumnsData, pinnedStartColumnsWidth, pinnedStartColumns), _jsx(MainTableWrapper, Object.assign({ hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0, "data-testid": "SheetViewVirtualTable_MainTableWrapper" }, { children: _jsx(StyledTableBox, Object.assign({ as: "main", id: "sheet-table-box-container", "aria-labelledby": "sheet-table-box-container", "data-testid": "SheetViewVirtualTable_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, scrollable: true }, { children: _jsxs(TableWrapper, Object.assign({ "data-testid": "SheetViewVirtualTable_TableWrapper", showNoDataView: showNoDataView, sx: Object.assign(Object.assign({}, tableBodyStyles), { display: 'flex', flexDirection: 'column', height: '100%' }) }, { children: [showHeader && (_jsx(UnpinnedTableHeaderWrapper, Object.assign({ "data-testid": "SheetViewVirtualTable_UnpinnedTableHeaderWrapper" }, { children: _jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_UnpinnedTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: unpinnedColumnsData, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: [...pinnedStartColumns, ...pinnedEndColumns], onColumnPin: handleColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: handleColumnClick }) }))), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
50
44
  width: '100%',
51
45
  minWidth: 'fit-content',
52
- } }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_ScrollableStyledBox", hidePadding: true, className: "list-wrapper" }, { children: _jsx(VirtualListSection, { "data-testid": "SheetViewVirtualTable_VirtualListSection_scrollable", containerKey: "scrollable", isPinned: false, listRef: scrollableVirtualListRef, columnsData: unpinnedColumnsData, itemsCount: itemsCount, rows: rows, rowProps: rowProps, rowsLength: rows.length, loadMoreItems: loadMoreItems, threshold: threshold, areAllRowsLoaded: areAllRowsLoaded, rowHeight: rowHeight, scrollToIndex: scrollToIndex, totalCount: (_a = footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount) !== null && _a !== void 0 ? _a : 0, isError: isError, isDelayedFetchingNextPage: Boolean(isDelayedFetchingNextPage), selectedCell: selectedCell, selectedColumn: selectedColumn, handleCellClick: handleCellClick, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, setShowBackdrop: setShowBackdrop, handleScroll: handleScroll, clearBackdropVisibilityTimeout: clearBackdropVisibilityTimeout, getItemSize: getItemSize, updateReferenceHeight: updateReferenceHeight }) })) }))] })) })) })), renderPinnedColumn('end', pinnedEndColumnsData, pinnedEndColumnsWidth, [...pinnedStartColumns, ...pinnedEndColumns])] }))) })), _jsx(TableFooter, Object.assign({ "data-testid": "SheetViewVirtualTable_TableFooter", showSeparator: true, showBackDrop: showBackDrop, onPointerDown: onPointerDown }, footerProps))] }));
46
+ } }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_ScrollableStyledBox", hidePadding: true, className: "list-wrapper" }, { children: _jsx(VirtualListSection, { "data-testid": "SheetViewVirtualTable_VirtualListSection_scrollable", containerKey: "scrollable", isPinned: false, listRef: scrollableVirtualListRef, columnsData: unpinnedColumnsData, itemsCount: itemsCount, rows: rows, rowProps: rowProps, rowsLength: rows.length, loadMoreItems: loadMoreItems, threshold: threshold, areAllRowsLoaded: areAllRowsLoaded, rowHeight: rowHeight, scrollToIndex: scrollToIndex, totalCount: (_a = footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount) !== null && _a !== void 0 ? _a : 0, isError: isError, isDelayedFetchingNextPage: Boolean(isDelayedFetchingNextPage), selectedCell: selectedCell, selectedColumn: selectedColumn, handleCellClick: handleCellClick, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, setShowBackdrop: setShowBackdrop, handleScroll: handleScroll, clearBackdropVisibilityTimeout: clearBackdropVisibilityTimeout }) })) }))] })) })) })), renderPinnedColumn('end', pinnedEndColumnsData, pinnedEndColumnsWidth, [...pinnedStartColumns, ...pinnedEndColumns])] }))) })), _jsx(TableFooter, Object.assign({ "data-testid": "SheetViewVirtualTable_TableFooter", showSeparator: true, showBackDrop: showBackDrop, onPointerDown: onPointerDown }, footerProps))] }));
53
47
  }
54
48
  export default memo(SheetViewVirtualTable);
@@ -36,8 +36,6 @@ interface PinnedColumnSectionProps {
36
36
  setShowBackdrop: (v: boolean) => void;
37
37
  handleScroll: (scrollProps: ListOnScrollProps, source: 'start' | 'end' | 'scrollable') => void;
38
38
  clearBackdropVisibilityTimeout: number;
39
- getItemSize?: (index: number) => number;
40
- updateReferenceHeight?: (height: number) => void;
41
39
  tableTitle?: string;
42
40
  areAllRowsLoadedDataAttr: boolean;
43
41
  isFetchingNextPageDataAttr?: boolean;
@@ -46,6 +44,6 @@ interface PinnedColumnSectionProps {
46
44
  tableMode?: string;
47
45
  showNoDataView: boolean;
48
46
  }
49
- declare function PinnedColumnSection({ position, columnsData, columnsWidth, pinnedColumnsList, showHeader, headerProps, columnsSorting, onColumnSort, showBackDrop, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, listRef, itemsCount, rows, rowProps, rowsLength, loadMoreItems, threshold, areAllRowsLoaded, rowHeight, scrollToIndex, totalCount, isError, isDelayedFetchingNextPage, selectedCell, selectedColumnValue, handleCellClick, areTotalRowsNotFillingHeight, setShowBackdrop, handleScroll, clearBackdropVisibilityTimeout, getItemSize, updateReferenceHeight, tableTitle, areAllRowsLoadedDataAttr, isFetchingNextPageDataAttr, isLoadingDataAttr, hasTimeoutErrorDataAttr, tableMode, showNoDataView, }: Readonly<PinnedColumnSectionProps>): import("react/jsx-runtime").JSX.Element | null;
47
+ declare function PinnedColumnSection({ position, columnsData, columnsWidth, pinnedColumnsList, showHeader, headerProps, columnsSorting, onColumnSort, showBackDrop, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, listRef, itemsCount, rows, rowProps, rowsLength, loadMoreItems, threshold, areAllRowsLoaded, rowHeight, scrollToIndex, totalCount, isError, isDelayedFetchingNextPage, selectedCell, selectedColumnValue, handleCellClick, areTotalRowsNotFillingHeight, setShowBackdrop, handleScroll, clearBackdropVisibilityTimeout, tableTitle, areAllRowsLoadedDataAttr, isFetchingNextPageDataAttr, isLoadingDataAttr, hasTimeoutErrorDataAttr, tableMode, showNoDataView, }: Readonly<PinnedColumnSectionProps>): import("react/jsx-runtime").JSX.Element | null;
50
48
  declare const _default: import("react").MemoExoticComponent<typeof PinnedColumnSection>;
51
49
  export default _default;
@@ -5,7 +5,7 @@ import { StyledBox, StyledTableBox, TableWrapper } from '../../components/style'
5
5
  import { PinnedStartColumnWrapper, PinnedEndColumnWrapper } from '../style';
6
6
  import SheetViewTableHeader from './SheetViewTableHeader';
7
7
  import VirtualListSection from './VirtualListSection';
8
- function PinnedColumnSection({ position, columnsData, columnsWidth, pinnedColumnsList, showHeader, headerProps, columnsSorting, onColumnSort, showBackDrop, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, listRef, itemsCount, rows, rowProps, rowsLength, loadMoreItems, threshold, areAllRowsLoaded, rowHeight, scrollToIndex, totalCount, isError, isDelayedFetchingNextPage, selectedCell, selectedColumnValue, handleCellClick, areTotalRowsNotFillingHeight, setShowBackdrop, handleScroll, clearBackdropVisibilityTimeout, getItemSize, updateReferenceHeight, tableTitle, areAllRowsLoadedDataAttr, isFetchingNextPageDataAttr, isLoadingDataAttr, hasTimeoutErrorDataAttr, tableMode, showNoDataView, }) {
8
+ function PinnedColumnSection({ position, columnsData, columnsWidth, pinnedColumnsList, showHeader, headerProps, columnsSorting, onColumnSort, showBackDrop, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, listRef, itemsCount, rows, rowProps, rowsLength, loadMoreItems, threshold, areAllRowsLoaded, rowHeight, scrollToIndex, totalCount, isError, isDelayedFetchingNextPage, selectedCell, selectedColumnValue, handleCellClick, areTotalRowsNotFillingHeight, setShowBackdrop, handleScroll, clearBackdropVisibilityTimeout, tableTitle, areAllRowsLoadedDataAttr, isFetchingNextPageDataAttr, isLoadingDataAttr, hasTimeoutErrorDataAttr, tableMode, showNoDataView, }) {
9
9
  const theme = useTheme();
10
10
  const Wrapper = position === 'start' ? PinnedStartColumnWrapper : PinnedEndColumnWrapper;
11
11
  const containerKey = position === 'start' ? 'pinnedStart' : 'pinnedEnd';
@@ -15,6 +15,6 @@ function PinnedColumnSection({ position, columnsData, columnsWidth, pinnedColumn
15
15
  width: '100%',
16
16
  minWidth: 'fit-content',
17
17
  overflowX: 'hidden',
18
- } }, { children: _jsx(StyledBox, Object.assign({ "data-testid": `SheetViewVirtualTable_PinnedStyledBox_${position}`, hidePadding: true, className: "list-wrapper" }, { children: _jsx(VirtualListSection, { "data-testid": `SheetViewVirtualTable_VirtualListSection_${position}`, containerKey: containerKey, isPinned: true, fixedWidth: columnsWidth, listRef: listRef, columnsData: columnsData, itemsCount: itemsCount, rows: rows, rowProps: rowProps, rowsLength: rowsLength, loadMoreItems: loadMoreItems, threshold: threshold, areAllRowsLoaded: areAllRowsLoaded, rowHeight: rowHeight, scrollToIndex: scrollToIndex, totalCount: totalCount, isError: isError, isDelayedFetchingNextPage: isDelayedFetchingNextPage, selectedCell: selectedCell, selectedColumn: selectedColumnValue, handleCellClick: handleCellClick, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, setShowBackdrop: setShowBackdrop, handleScroll: handleScroll, clearBackdropVisibilityTimeout: clearBackdropVisibilityTimeout, getItemSize: getItemSize, updateReferenceHeight: updateReferenceHeight }) })) }))] })) })));
18
+ } }, { children: _jsx(StyledBox, Object.assign({ "data-testid": `SheetViewVirtualTable_PinnedStyledBox_${position}`, hidePadding: true, className: "list-wrapper" }, { children: _jsx(VirtualListSection, { "data-testid": `SheetViewVirtualTable_VirtualListSection_${position}`, containerKey: containerKey, isPinned: true, fixedWidth: columnsWidth, listRef: listRef, columnsData: columnsData, itemsCount: itemsCount, rows: rows, rowProps: rowProps, rowsLength: rowsLength, loadMoreItems: loadMoreItems, threshold: threshold, areAllRowsLoaded: areAllRowsLoaded, rowHeight: rowHeight, scrollToIndex: scrollToIndex, totalCount: totalCount, isError: isError, isDelayedFetchingNextPage: isDelayedFetchingNextPage, selectedCell: selectedCell, selectedColumn: selectedColumnValue, handleCellClick: handleCellClick, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, setShowBackdrop: setShowBackdrop, handleScroll: handleScroll, clearBackdropVisibilityTimeout: clearBackdropVisibilityTimeout }) })) }))] })) })));
19
19
  }
20
20
  export default memo(PinnedColumnSection);
@@ -26,9 +26,7 @@ interface VirtualListSectionProps {
26
26
  setShowBackdrop: (v: boolean) => void;
27
27
  handleScroll: (scrollProps: ListOnScrollProps, source: 'start' | 'end' | 'scrollable') => void;
28
28
  clearBackdropVisibilityTimeout: number;
29
- getItemSize?: (index: number) => number;
30
- updateReferenceHeight?: (height: number) => void;
31
29
  }
32
- declare function VirtualListSection({ containerKey, isPinned, fixedWidth, listRef, columnsData, itemsCount, rows, rowProps, rowsLength, loadMoreItems, threshold, areAllRowsLoaded, rowHeight, scrollToIndex, totalCount, isError, isDelayedFetchingNextPage, selectedCell, selectedColumn, handleCellClick, areTotalRowsNotFillingHeight, setShowBackdrop, handleScroll, clearBackdropVisibilityTimeout, getItemSize: externalGetItemSize, updateReferenceHeight, }: Readonly<VirtualListSectionProps>): import("react/jsx-runtime").JSX.Element;
30
+ declare function VirtualListSection({ containerKey, isPinned, fixedWidth, listRef, columnsData, itemsCount, rows, rowProps, rowsLength, loadMoreItems, threshold, areAllRowsLoaded, rowHeight, scrollToIndex, totalCount, isError, isDelayedFetchingNextPage, selectedCell, selectedColumn, handleCellClick, areTotalRowsNotFillingHeight, setShowBackdrop, handleScroll, clearBackdropVisibilityTimeout, }: Readonly<VirtualListSectionProps>): import("react/jsx-runtime").JSX.Element;
33
31
  declare const _default: import("react").MemoExoticComponent<typeof VirtualListSection>;
34
32
  export default _default;
@@ -34,7 +34,7 @@ const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToInde
34
34
  containerHeight,
35
35
  rowHeight,
36
36
  }));
37
- function VirtualListSection({ containerKey, isPinned, fixedWidth, listRef, columnsData, itemsCount, rows, rowProps, rowsLength, loadMoreItems, threshold, areAllRowsLoaded, rowHeight, scrollToIndex, totalCount, isError, isDelayedFetchingNextPage, selectedCell, selectedColumn, handleCellClick, areTotalRowsNotFillingHeight, setShowBackdrop, handleScroll, clearBackdropVisibilityTimeout, getItemSize: externalGetItemSize, updateReferenceHeight, }) {
37
+ function VirtualListSection({ containerKey, isPinned, fixedWidth, listRef, columnsData, itemsCount, rows, rowProps, rowsLength, loadMoreItems, threshold, areAllRowsLoaded, rowHeight, scrollToIndex, totalCount, isError, isDelayedFetchingNextPage, selectedCell, selectedColumn, handleCellClick, areTotalRowsNotFillingHeight, setShowBackdrop, handleScroll, clearBackdropVisibilityTimeout, }) {
38
38
  const onItemsRenderedSource = useMemo(() => (containerKey === 'pinnedStart' ? 'start' : containerKey === 'pinnedEnd' ? 'end' : 'scrollable'), [containerKey]);
39
39
  const listStyle = useMemo(() => ({
40
40
  overflowX: (isPinned ? 'hidden' : 'auto'),
@@ -55,20 +55,16 @@ function VirtualListSection({ containerKey, isPinned, fixedWidth, listRef, colum
55
55
  handleScroll(scrollProps, onItemsRenderedSource);
56
56
  }, [handleScroll, onItemsRenderedSource]);
57
57
  return (_jsx(InfiniteLoader, Object.assign({ "data-testid": `SheetViewVirtualTable_VirtualListSection_InfiniteLoader_${containerKey}`, isItemLoaded: isItemLoaded, itemCount: itemsCount, loadMoreItems: onLoadMore, threshold: threshold }, { children: ({ onItemsRendered, ref }) => (_jsx(AutoSizer, Object.assign({ ref: ref, "data-testid": "VirtualListSection_AutoSizer" }, { children: ({ height, width }) => {
58
- if (!isPinned && updateReferenceHeight) {
59
- updateReferenceHeight(height);
60
- }
61
- const getItemSize = externalGetItemSize ||
62
- ((index) => {
63
- const isLastRow = areAllRowsLoaded && index === rowsLength;
64
- if (isLastRow) {
65
- const usedHeight = rowsLength * rowHeight;
66
- const remainingHeight = height - usedHeight;
67
- const minimumLastRowHeight = rowHeight * 2;
68
- return Math.max(remainingHeight, minimumLastRowHeight);
69
- }
70
- return rowHeight;
71
- });
58
+ const getItemSize = (index) => {
59
+ const isLastRow = areAllRowsLoaded && index === rowsLength;
60
+ if (isLastRow) {
61
+ const usedHeight = rowsLength * rowHeight;
62
+ const remainingHeight = height - usedHeight;
63
+ const minimumLastRowHeight = rowHeight * 2;
64
+ return Math.max(remainingHeight, minimumLastRowHeight);
65
+ }
66
+ return rowHeight;
67
+ };
72
68
  const itemData = createItemData(columnsData, isDelayedFetchingNextPage, rows, rowProps, scrollToIndex, totalCount, isError, areAllRowsLoaded, isPinned, selectedCell, selectedColumn, handleCellClick, height, rowHeight);
73
69
  return (_jsx(StyledVirtualList, Object.assign({ "data-testid": `SheetViewVirtualTable_VirtualListSection_StyledVirtualList_${containerKey}`, listRef: listRef, height: height, width: fixedWidth || width, itemCount: itemsCount, itemSize: getItemSize, itemData: itemData, onItemsRendered: onItemsRendered, overscanCount: TABLE_LIST_OVER_SCAN, setBackdropVisibility: setShowBackdrop, scrollToIndex: scrollToIndex, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, useIsScrolling: true, onScroll: onScrollSync, clearBackdropVisibilityTimeout: clearBackdropVisibilityTimeout, style: listStyle }, { children: ListItemWrapper })));
74
70
  } }))) })));
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@tap-payments/os-micro-frontend-shared",
3
3
  "description": "Shared components and utilities for Tap Payments micro frontends",
4
- "version": "0.1.9-test.1-test.2",
5
- "testVersion": 2,
4
+ "version": "0.1.9-test.1-test.2-test.3",
5
+ "testVersion": 3,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",
@@ -1,10 +0,0 @@
1
- interface UseSharedItemSizeProps {
2
- rowsLength: number;
3
- areAllRowsLoaded: boolean;
4
- rowHeight: number;
5
- }
6
- export declare const useSharedItemSize: ({ rowsLength, areAllRowsLoaded, rowHeight }: UseSharedItemSizeProps) => {
7
- getItemSize: (index: number) => number;
8
- updateReferenceHeight: (height: number) => void;
9
- };
10
- export {};
@@ -1,21 +0,0 @@
1
- import { useCallback, useRef } from 'react';
2
- export const useSharedItemSize = ({ rowsLength, areAllRowsLoaded, rowHeight }) => {
3
- const referenceHeightRef = useRef(0);
4
- const updateReferenceHeight = useCallback((height) => {
5
- referenceHeightRef.current = height;
6
- }, []);
7
- const getItemSize = useCallback((index) => {
8
- const isLastRow = areAllRowsLoaded && index === rowsLength;
9
- if (isLastRow) {
10
- const usedHeight = rowsLength * rowHeight;
11
- const remainingHeight = referenceHeightRef.current - usedHeight;
12
- const minimumLastRowHeight = rowHeight * 2;
13
- return Math.max(remainingHeight, minimumLastRowHeight);
14
- }
15
- return rowHeight;
16
- }, [areAllRowsLoaded, rowsLength, rowHeight]);
17
- return {
18
- getItemSize,
19
- updateReferenceHeight,
20
- };
21
- };