@tap-payments/os-micro-frontend-shared 0.1.22 → 0.1.23

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.
Files changed (75) hide show
  1. package/build/components/AccountDropdown/style.d.ts +1 -1
  2. package/build/components/ActivityAreaChart/styles.d.ts +3 -3
  3. package/build/components/AppServices/style.d.ts +1 -1
  4. package/build/components/CircularProgressWithLabel/style.d.ts +1 -1
  5. package/build/components/DockButton/style.d.ts +1 -1
  6. package/build/components/FileUpload/style.d.ts +2 -2
  7. package/build/components/FileUploader/style.d.ts +1 -1
  8. package/build/components/IconWithLabel/style.d.ts +1 -1
  9. package/build/components/IconsDropdown/style.d.ts +2 -2
  10. package/build/components/JSONViewer/style.d.ts +1 -1
  11. package/build/components/LabeledIconDropdown/style.d.ts +3 -3
  12. package/build/components/MultiSelectWithSearch/style.d.ts +3 -3
  13. package/build/components/NestedDropdown/styles.d.ts +1 -1
  14. package/build/components/ProgressBar/style.d.ts +1 -1
  15. package/build/components/ProgressRing/style.d.ts +2 -2
  16. package/build/components/RFH/Inputs/SelectWithAccordion/style.d.ts +3 -3
  17. package/build/components/SelectDropdown/style.d.ts +1 -1
  18. package/build/components/SelectWithSearch/style.d.ts +3 -3
  19. package/build/components/StatusBar/StatusBar.js +3 -2
  20. package/build/components/StatusLabel/style.d.ts +1 -1
  21. package/build/components/TableCells/CustomCells/DestinationCell/DestinationCell.js +2 -2
  22. package/build/components/TableHeader/style.d.ts +1 -1
  23. package/build/components/Timepicker/style.d.ts +2 -2
  24. package/build/components/ToolbarIcon/ExpandButton/style.d.ts +1 -1
  25. package/build/components/VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable.d.ts +1 -6
  26. package/build/components/VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable.js +59 -161
  27. package/build/components/VirtualTables/SheetViewVirtualTable/components/LoadingMainTable.d.ts +5 -0
  28. package/build/components/VirtualTables/SheetViewVirtualTable/components/LoadingMainTable.js +19 -0
  29. package/build/components/VirtualTables/SheetViewVirtualTable/components/MainTable.d.ts +5 -0
  30. package/build/components/VirtualTables/SheetViewVirtualTable/components/MainTable.js +15 -0
  31. package/build/components/VirtualTables/SheetViewVirtualTable/components/NoDataView.d.ts +5 -0
  32. package/build/components/VirtualTables/SheetViewVirtualTable/components/NoDataView.js +13 -0
  33. package/build/components/VirtualTables/SheetViewVirtualTable/components/PinnedColumn.d.ts +5 -0
  34. package/build/components/VirtualTables/SheetViewVirtualTable/components/PinnedColumn.js +20 -0
  35. package/build/components/VirtualTables/SheetViewVirtualTable/components/{SheetViewTableHeader/SheetViewTableHeader.d.ts → SheetViewTableHeader.d.ts} +1 -1
  36. package/build/components/VirtualTables/SheetViewVirtualTable/components/{SheetViewTableHeader/SheetViewTableHeader.js → SheetViewTableHeader.js} +3 -3
  37. package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeaderCell.d.ts +14 -0
  38. package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeaderCell.js +49 -0
  39. package/build/components/VirtualTables/SheetViewVirtualTable/components/VirtualTable.d.ts +44 -0
  40. package/build/components/VirtualTables/SheetViewVirtualTable/components/VirtualTable.js +33 -0
  41. package/build/components/VirtualTables/SheetViewVirtualTable/components/index.d.ts +6 -0
  42. package/build/components/VirtualTables/SheetViewVirtualTable/components/index.js +6 -0
  43. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/index.d.ts +6 -0
  44. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/index.js +6 -0
  45. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/usePinnedColumnsWidths.d.ts +5 -0
  46. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/usePinnedColumnsWidths.js +15 -0
  47. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableData.d.ts +20 -0
  48. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableData.js +40 -0
  49. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableState.d.ts +15 -0
  50. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableState.js +31 -0
  51. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.d.ts +44 -0
  52. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.js +53 -0
  53. package/build/components/VirtualTables/SheetViewVirtualTable/index.d.ts +2 -0
  54. package/build/components/VirtualTables/SheetViewVirtualTable/index.js +2 -0
  55. package/build/components/VirtualTables/SheetViewVirtualTable/types.d.ts +89 -0
  56. package/build/components/VirtualTables/components/TableFooter/style.d.ts +2 -2
  57. package/build/components/VirtualTables/components/TableHeader/components/TableCell/TableCell.js +7 -5
  58. package/build/components/VirtualTables/components/TableRow.js +1 -1
  59. package/build/components/VirtualTables/components/style.d.ts +3 -0
  60. package/build/components/VirtualTables/components/style.js +6 -0
  61. package/build/components/Widget/style.d.ts +1 -1
  62. package/build/components/WindowAppIcon/style.d.ts +1 -1
  63. package/build/utils/index.d.ts +1 -0
  64. package/build/utils/index.js +1 -0
  65. package/build/utils/style.d.ts +9 -0
  66. package/build/utils/style.js +62 -0
  67. package/package.json +1 -1
  68. package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/TableCell.d.ts +0 -14
  69. package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/TableCell.js +0 -46
  70. package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/index.d.ts +0 -2
  71. package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/index.js +0 -2
  72. package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/type.d.ts +0 -19
  73. package/build/components/VirtualTables/utils/getSelectionStyles.d.ts +0 -55
  74. package/build/components/VirtualTables/utils/getSelectionStyles.js +0 -31
  75. /package/build/components/VirtualTables/SheetViewVirtualTable/{components/SheetViewTableHeader/type.js → types.js} +0 -0
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import { useTheme } from '@mui/material/styles';
4
+ import { StyledTableBox, TableWrapper, StyledBox } from '../../components/style';
5
+ import { MainTableWrapper, UnpinnedTableHeaderWrapper } from '../style';
6
+ import SheetViewTableHeader from './SheetViewTableHeader';
7
+ import SheetViewTableLoading from './SheetViewTableLoading';
8
+ function LoadingMainTable({ hasPinnedStart, hasPinnedEnd, unpinnedColumnsData, showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, pinnedStartColumns, pinnedEndColumns, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, hasTimeoutError, tableMode, showNoDataView, tableBodyStyles, }) {
9
+ const theme = useTheme();
10
+ return (_jsx(MainTableWrapper, Object.assign({ hasPinnedStart: hasPinnedStart, hasPinnedEnd: hasPinnedEnd }, { children: _jsx(StyledTableBox, Object.assign({ as: "main", id: "sheet-table-box-container", "aria-labelledby": "sheet-table-box-container", "data-testid": "SheetViewVirtualTable_StyledTableBox_Loading", "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_LoadingTableWrapper", showNoDataView: showNoDataView, sx: Object.assign(Object.assign({}, tableBodyStyles), { display: 'flex', flexDirection: 'column', height: '100%' }) }, { children: [showHeader && (_jsx(UnpinnedTableHeaderWrapper, { children: _jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_LoadingTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: unpinnedColumnsData, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: [...pinnedStartColumns, ...pinnedEndColumns], onColumnPin: onColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: onColumnClick, tablePosition: "scrollable", hasPinnedStart: hasPinnedStart, hasPinnedEnd: hasPinnedEnd }) })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_LoadingTableWrapper", sx: {
11
+ width: '100%',
12
+ minWidth: 'fit-content',
13
+ } }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_LoadingStyledBox", hidePadding: true, className: "list-wrapper", sx: {
14
+ height: '100%',
15
+ display: 'flex',
16
+ flexDirection: 'column',
17
+ } }, { children: _jsx(SheetViewTableLoading, { "data-testid": "SheetViewVirtualTable_TableLoading", columns: unpinnedColumnsData, isLoading: true, isPinned: false }) })) }))] })) })) })));
18
+ }
19
+ export default memo(LoadingMainTable);
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import type { MainTableProps } from '../types';
3
+ declare function MainTable({ hasPinnedStart, hasPinnedEnd, unpinnedColumnsData, showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, pinnedStartColumns, pinnedEndColumns, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, hasTimeoutError, tableMode, showNoDataView, tableBodyStyles, tableLoading, createVirtualTableContainer, }: MainTableProps): import("react/jsx-runtime").JSX.Element;
4
+ declare const _default: import("react").MemoExoticComponent<typeof MainTable>;
5
+ export default _default;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import { useTheme } from '@mui/material/styles';
4
+ import { StyledTableBox, TableWrapper, StyledBox } from '../../components/style';
5
+ import { MainTableWrapper, UnpinnedTableHeaderWrapper } from '../style';
6
+ import SheetViewTableHeader from './SheetViewTableHeader';
7
+ import SheetViewTableLoading from './SheetViewTableLoading';
8
+ function MainTable({ hasPinnedStart, hasPinnedEnd, unpinnedColumnsData, showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, pinnedStartColumns, pinnedEndColumns, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, hasTimeoutError, tableMode, showNoDataView, tableBodyStyles, tableLoading, createVirtualTableContainer, }) {
9
+ const theme = useTheme();
10
+ return (_jsx(MainTableWrapper, Object.assign({ hasPinnedStart: hasPinnedStart, hasPinnedEnd: hasPinnedEnd }, { 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, { children: _jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_UnpinnedTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: unpinnedColumnsData, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: [...pinnedStartColumns, ...pinnedEndColumns], onColumnPin: onColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: onColumnClick, tablePosition: "scrollable", hasPinnedStart: hasPinnedStart, hasPinnedEnd: hasPinnedEnd }) })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
11
+ width: '100%',
12
+ minWidth: 'fit-content',
13
+ } }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_ScrollableStyledBox", hidePadding: true, className: "list-wrapper" }, { children: tableLoading ? (_jsx(SheetViewTableLoading, { "data-testid": "SheetViewVirtualTable_TableLoading", columns: unpinnedColumnsData, isLoading: true, isPinned: false })) : (createVirtualTableContainer(unpinnedColumnsData, 'scrollable', false)) })) }))] })) })) })));
14
+ }
15
+ export default memo(MainTable);
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import type { NoDataViewProps } from '../types';
3
+ declare function NoDataView({ tableLoading, tableError, tableEmpty, hasTimeoutError, orderedColumns, showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, onColumnPin, lastColumnId, selectedColumn, onColumnClick, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, tableMode, tableBodyStyles, error, triggerDataRefetch, footerProps, }: NoDataViewProps): import("react/jsx-runtime").JSX.Element;
4
+ declare const _default: import("react").MemoExoticComponent<typeof NoDataView>;
5
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import { useTheme } from '@mui/material/styles';
4
+ import { StyledTableBox, TableWrapper } from '../../components/style';
5
+ import { UnpinnedTableHeaderWrapper } from '../style';
6
+ import TableNoData from '../../components/TableNoData';
7
+ import SheetViewTableHeader from './SheetViewTableHeader';
8
+ function NoDataView({ tableLoading, tableError, tableEmpty, hasTimeoutError, orderedColumns, showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, onColumnPin, lastColumnId, selectedColumn, onColumnClick, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, tableMode, tableBodyStyles, error, triggerDataRefetch, footerProps, }) {
9
+ const theme = useTheme();
10
+ const showNoDataView = tableLoading || tableError || tableEmpty || hasTimeoutError;
11
+ return (_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 }, { children: _jsxs(TableWrapper, Object.assign({ "data-testid": "SheetViewVirtualTable_TableWrapper", showNoDataView: showNoDataView, sx: tableBodyStyles }, { children: [showHeader && (_jsx(UnpinnedTableHeaderWrapper, { children: _jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_LoadingTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: orderedColumns, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: [], onColumnPin: onColumnPin, isPinnable: false, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: onColumnClick }) })), _jsx(TableNoData, { error: error || null, tableEmpty: tableEmpty, isTimeoutError: hasTimeoutError, tableError: tableError, tableLoading: tableLoading, orderedColumns: orderedColumns, triggerDataRefetch: triggerDataRefetch || (() => Promise.resolve()), footerProps: footerProps })] })) })));
12
+ }
13
+ export default memo(NoDataView);
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import type { PinnedColumnProps } from '../types';
3
+ declare function PinnedColumn({ position, columnsData, columnsWidth, pinnedColumnsList, showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, hasPinnedStart, hasPinnedEnd, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, hasTimeoutError, tableMode, showNoDataView, tableLoading, createVirtualTableContainer, }: PinnedColumnProps): import("react/jsx-runtime").JSX.Element | null;
4
+ declare const _default: import("react").MemoExoticComponent<typeof PinnedColumn>;
5
+ export default _default;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import { useTheme } from '@mui/material/styles';
4
+ import { StyledTableBox, TableWrapper, StyledBox } from '../../components/style';
5
+ import { PinnedStartColumnWrapper, PinnedEndColumnWrapper } from '../style';
6
+ import SheetViewTableHeader from './SheetViewTableHeader';
7
+ import SheetViewTableLoading from './SheetViewTableLoading';
8
+ function PinnedColumn({ position, columnsData, columnsWidth, pinnedColumnsList, showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, hasPinnedStart, hasPinnedEnd, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, hasTimeoutError, tableMode, showNoDataView, tableLoading, createVirtualTableContainer, }) {
9
+ const theme = useTheme();
10
+ if (columnsData.length === 0)
11
+ return null;
12
+ const Wrapper = position === 'start' ? PinnedStartColumnWrapper : PinnedEndColumnWrapper;
13
+ const containerKey = position === 'start' ? 'pinnedStart' : 'pinnedEnd';
14
+ return (_jsx(Wrapper, { children: _jsxs(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 }, { children: [showHeader && (_jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_PinnedTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: columnsData, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: pinnedColumnsList, onColumnPin: onColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: onColumnClick, tablePosition: position === 'start' ? 'pinnedStart' : 'pinnedEnd', hasPinnedStart: hasPinnedStart, hasPinnedEnd: hasPinnedEnd })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
15
+ width: '100%',
16
+ minWidth: 'fit-content',
17
+ overflowX: 'hidden',
18
+ } }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_PinnedStyledBox", hidePadding: true, className: "list-wrapper" }, { children: tableLoading ? (_jsx(SheetViewTableLoading, { "data-testid": `SheetViewVirtualTable_PinnedTableLoading_${position}`, columns: columnsData, isLoading: true, isPinned: true })) : (createVirtualTableContainer(columnsData, containerKey, true, columnsWidth)) })) }))] })) }));
19
+ }
20
+ export default memo(PinnedColumn);
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { SheetViewTableHeaderProps } from './type';
2
+ import { SheetViewTableHeaderProps } from '../types';
3
3
  declare function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, }: SheetViewTableHeaderProps): import("react/jsx-runtime").JSX.Element;
4
4
  declare const _default: import("react").MemoExoticComponent<typeof SheetViewTableHeader>;
5
5
  export default _default;
@@ -1,12 +1,12 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { memo } from 'react';
3
- import { StyledHeader, StyledMUITableRow } from '../../style';
4
- import TableCell from './TableCell';
3
+ import { StyledHeader, StyledMUITableRow } from '../style';
4
+ import SheetViewTableHeaderCell from './SheetViewTableHeaderCell';
5
5
  function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns = [], onColumnPin, isPinnable = false, lastColumnId, selectedColumn = null, onColumnClick, }) {
6
6
  return (_jsx(StyledHeader, Object.assign({ component: "nav", "data-testid": "SheetViewVirtualTable_TableHeader_StyledHeader", showBackDrop: showBackDrop }, headerProps, { children: _jsx(StyledMUITableRow, Object.assign({ component: "section", "data-testid": "SheetViewVirtualTable_TableHeader_StyledMUITableRow" }, { children: columns.map((column, colIndex) => {
7
7
  var _a;
8
8
  const columnKey = `${(_a = column.pinned) !== null && _a !== void 0 ? _a : 'default'}-${colIndex}`;
9
- return (_jsx(TableCell, { column: column, colIndex: colIndex, isFirst: column.id === columns[0].id, isLast: column.id === columns[columns.length - 1].id, isDefaultPinned: !!column.isDefaultPinned, isSelected: selectedColumn === columnKey, onColumnSort: onColumnSort, columnsSorting: columnsSorting, pinnedColumns: pinnedColumns, onColumnPin: onColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, onColumnClick: onColumnClick }, `${column.id}-${colIndex}`));
9
+ return (_jsx(SheetViewTableHeaderCell, { column: column, colIndex: colIndex, isFirst: column.id === columns[0].id, isLast: column.id === columns[columns.length - 1].id, isDefaultPinned: !!column.isDefaultPinned, isSelected: selectedColumn === columnKey, onColumnSort: onColumnSort, columnsSorting: columnsSorting, pinnedColumns: pinnedColumns, onColumnPin: onColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, onColumnClick: onColumnClick }, `${column.id}-${colIndex}`));
10
10
  }) })) })));
11
11
  }
12
12
  export default memo(SheetViewTableHeader);
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import type { IColumnProps } from '../../../../types/index.js';
3
+ import { SheetViewTableHeaderProps } from '../types';
4
+ interface SheetViewTableHeaderCellProps extends Pick<SheetViewTableHeaderProps, 'onColumnSort' | 'columnsSorting' | 'onColumnPin' | 'isPinnable' | 'lastColumnId' | 'onColumnClick' | 'pinnedColumns'> {
5
+ column: IColumnProps;
6
+ colIndex: number;
7
+ isFirst: boolean;
8
+ isLast: boolean;
9
+ isSelected: boolean;
10
+ isDefaultPinned: boolean;
11
+ }
12
+ declare function SheetViewTableHeaderCell({ column: { header, id, align, headerStyle, sortable, filter, pinnable, width, order, tableViewId, pinned }, colIndex, isFirst, isLast, isSelected, isDefaultPinned, onColumnSort, columnsSorting, onColumnPin, isPinnable, lastColumnId, onColumnClick, pinnedColumns, }: SheetViewTableHeaderCellProps): import("react/jsx-runtime").JSX.Element;
13
+ declare const _default: import("react").MemoExoticComponent<typeof SheetViewTableHeaderCell>;
14
+ export default _default;
@@ -0,0 +1,49 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo, useCallback, useMemo, useRef, useState } from 'react';
3
+ import Box from '@mui/material/Box';
4
+ import { pinIcon, unpinIcon } from '../../../../constants/index.js';
5
+ import ColumnFilter from '../../components/ColumnFilter';
6
+ import { StyledCell, TableHeaderInner } from '../../components/style';
7
+ import { PinIconContainer, HeaderText } from '../style';
8
+ import ColumnSort from '../../components/ColumnSort';
9
+ function SheetViewTableHeaderCell({ column: { header, id, align, headerStyle, sortable, filter, pinnable, width, order, tableViewId, pinned }, colIndex, isFirst, isLast, isSelected, isDefaultPinned, onColumnSort, columnsSorting, onColumnPin, isPinnable, lastColumnId, onColumnClick, pinnedColumns, }) {
10
+ const [columnFilterEl, setColumnFilterEl] = useState(null);
11
+ const cellRef = useRef(null);
12
+ const checkIsPanned = useCallback((columnId) => pinnedColumns === null || pinnedColumns === void 0 ? void 0 : pinnedColumns.includes(columnId), [pinnedColumns]);
13
+ const isPinned = useMemo(() => checkIsPanned(id), [id, checkIsPanned]);
14
+ const handlePinClick = (columnId) => {
15
+ if (checkIsPanned(columnId)) {
16
+ onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId, 'unpin');
17
+ }
18
+ else {
19
+ if (columnId === lastColumnId) {
20
+ onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId, 'end');
21
+ }
22
+ else {
23
+ onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId, 'start');
24
+ }
25
+ }
26
+ };
27
+ const onOpenFilterDropdown = () => {
28
+ setColumnFilterEl(cellRef.current);
29
+ };
30
+ return (_jsx(StyledCell, Object.assign({ "data-id": id, component: "div", "data-testid": "SheetViewVirtualTable_TableHeader_StyledCell", "data-column-id": id, "data-column-width": width, "data-column-width-used": width, "data-column-align": align, "data-column-order": order, "data-column-header": typeof header === 'string' ? header : 'component', "data-column-sortable": !!sortable, "data-column-filterable": !!filter, "data-column-pinned": isPinned, isFirst: isFirst, isLast: isLast, isSheetView: true, ref: cellRef, onClick: (event) => {
31
+ onColumnClick === null || onColumnClick === void 0 ? void 0 : onColumnClick(colIndex, event, pinned);
32
+ }, sx: (theme) => (Object.assign({ display: 'flex', gap: theme.spacing(0.5), alignItems: 'center', justifyContent: align === 'right' ? 'flex-end' : 'flex-start', width, textAlign: align, overflow: 'unset', cursor: 'pointer', boxSizing: 'border-box', border: isSelected ? '1px solid #1F88D0' : '1px solid #F2F2F2', backgroundColor: isSelected ? '#F2F2F2' : '#FCFCFC', minHeight: isSelected ? '28px' : 'auto', position: 'relative', '&:before': {
33
+ content: '""',
34
+ border: isSelected ? '1px solid #1F88D0' : '1px solid transparent',
35
+ position: 'absolute',
36
+ top: 0,
37
+ right: 0,
38
+ left: 0,
39
+ bottom: 0,
40
+ } }, headerStyle)) }, { children: _jsxs(TableHeaderInner, Object.assign({ onClick: onOpenFilterDropdown }, { children: [typeof header === 'function' ? (header()) : (_jsx(Box, Object.assign({ "data-testid": "SheetViewTableHeader_columns_header", sx: { maxWidth: '100%', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, { children: header && _jsx(HeaderText, Object.assign({ "data-testid": "SheetViewVirtualTable_TableHeader_StyledCell_header_text" }, { children: header })) }))), filter && (_jsx(ColumnFilter, Object.assign({}, filter, { anchorEl: columnFilterEl, setAnchorEl: setColumnFilterEl, onClose: (event) => {
41
+ onColumnClick === null || onColumnClick === void 0 ? void 0 : onColumnClick(colIndex, event, pinned);
42
+ } }))), sortable && (_jsx(ColumnSort, { columnId: id, onColumnSort: onColumnSort, columnsSorting: columnsSorting, onClick: (e) => {
43
+ onColumnClick === null || onColumnClick === void 0 ? void 0 : onColumnClick(colIndex, e, pinned);
44
+ } })), isPinnable && pinnable && !isDefaultPinned && !isLast && (_jsx(PinIconContainer, Object.assign({ onClick: (event) => {
45
+ event.stopPropagation();
46
+ handlePinClick(id);
47
+ }, title: isPinned ? 'Unpin column' : 'Pin column' }, { children: _jsx("img", { src: isPinned ? unpinIcon : pinIcon, alt: "pin-icon" }) })))] })) })));
48
+ }
49
+ export default memo(SheetViewTableHeaderCell);
@@ -0,0 +1,44 @@
1
+ /// <reference types="react" />
2
+ import { ListOnScrollProps, VariableSizeList } from 'react-window';
3
+ import type { IColumnProps } from '../../../../types/index.js';
4
+ type VirtualTableItemData = {
5
+ columns: IColumnProps[];
6
+ isLoading: boolean;
7
+ rows: unknown[];
8
+ rowProps: unknown;
9
+ scrollToIndex?: number;
10
+ totalCount: number;
11
+ lastItemIndex: number;
12
+ isError: boolean;
13
+ areAllRowsLoaded: boolean;
14
+ limit: number;
15
+ newLoadedRowsEndIndex: number;
16
+ isSheetView: boolean;
17
+ isPinned: boolean;
18
+ selectedCell: string | null;
19
+ selectedColumn: string | null;
20
+ onCellClick: (rowIndex: number, columnIndex: number, event: React.MouseEvent, pinnedType?: 'start' | 'end') => void;
21
+ containerHeight: number;
22
+ rowHeight: number;
23
+ };
24
+ interface VirtualTableProps {
25
+ columnsData: IColumnProps[];
26
+ itemCount: number;
27
+ lastItemIndex: number;
28
+ areAllRowsLoaded?: boolean;
29
+ loadMoreItems?: () => Promise<unknown>;
30
+ threshold: number;
31
+ getItemSize: (index: number, height: number) => number;
32
+ getItemData: (columnsData: IColumnProps[], isPinned: boolean, height: number) => VirtualTableItemData;
33
+ isPinned: boolean;
34
+ fixedWidth?: number;
35
+ scrollToIndex?: number;
36
+ areTotalRowsNotFillingHeight: boolean;
37
+ clearBackdropVisibilityTimeout: number;
38
+ onScroll?: (scrollProps: ListOnScrollProps) => void;
39
+ setBackdropVisibility: (visible: boolean) => void;
40
+ listRef: React.RefObject<VariableSizeList>;
41
+ }
42
+ declare function VirtualTable({ columnsData, itemCount, lastItemIndex, areAllRowsLoaded, loadMoreItems, threshold, getItemSize, getItemData, isPinned, fixedWidth, scrollToIndex, areTotalRowsNotFillingHeight, clearBackdropVisibilityTimeout, onScroll, setBackdropVisibility, listRef, }: VirtualTableProps): import("react/jsx-runtime").JSX.Element;
43
+ declare const _default: import("react").MemoExoticComponent<typeof VirtualTable>;
44
+ export default _default;
@@ -0,0 +1,33 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { memo } from 'react';
12
+ import InfiniteLoader from 'react-window-infinite-loader';
13
+ import AutoSizer from 'react-virtualized-auto-sizer';
14
+ import { TABLE_LIST_OVER_SCAN } from '../../../../constants/index.js';
15
+ import ListItemWrapper from '../../components/virtualScroll/ListItemWrapper';
16
+ import { StyledVirtualList } from '../../components/style';
17
+ function VirtualTable({ columnsData, itemCount, lastItemIndex, areAllRowsLoaded, loadMoreItems, threshold, getItemSize, getItemData, isPinned, fixedWidth, scrollToIndex, areTotalRowsNotFillingHeight, clearBackdropVisibilityTimeout, onScroll, setBackdropVisibility, listRef, }) {
18
+ const handleOnLoadMoreItems = () => __awaiter(this, void 0, void 0, function* () {
19
+ if (areAllRowsLoaded)
20
+ return;
21
+ yield (loadMoreItems === null || loadMoreItems === void 0 ? void 0 : loadMoreItems());
22
+ });
23
+ return (_jsx(InfiniteLoader, Object.assign({ isItemLoaded: (index) => index !== lastItemIndex, itemCount: itemCount, loadMoreItems: handleOnLoadMoreItems, threshold: threshold }, { children: ({ onItemsRendered, ref }) => (_jsx(AutoSizer, Object.assign({ ref: ref }, { children: ({ height, width }) => {
24
+ const itemSize = (index) => getItemSize(index, height);
25
+ const itemData = getItemData(columnsData, isPinned, height);
26
+ return (_jsx(StyledVirtualList, Object.assign({ listRef: listRef, height: height, width: fixedWidth || width, itemCount: itemCount, itemSize: itemSize, itemData: itemData, onItemsRendered: onItemsRendered, overscanCount: TABLE_LIST_OVER_SCAN, setBackdropVisibility: setBackdropVisibility, scrollToIndex: scrollToIndex, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, useIsScrolling: true, onScroll: onScroll, clearBackdropVisibilityTimeout: clearBackdropVisibilityTimeout, style: {
27
+ overflowX: isPinned ? 'hidden' : 'auto',
28
+ paddingBottom: isPinned ? '25px' : '13px',
29
+ backgroundColor: isPinned ? 'transparent' : '#F6F8FACC',
30
+ } }, { children: ListItemWrapper })));
31
+ } }))) })));
32
+ }
33
+ export default memo(VirtualTable);
@@ -1,3 +1,9 @@
1
1
  export { default as SheetViewTableLoading } from './SheetViewTableLoading';
2
2
  export { default as SheetViewTableRowLoading } from './SheetViewTableRowLoading';
3
3
  export { default as SheetViewTableNoData } from './SheetViewTableNoData';
4
+ export { default as SheetViewTableHeader } from './SheetViewTableHeader';
5
+ export { default as VirtualTable } from './VirtualTable';
6
+ export { default as PinnedColumn } from './PinnedColumn';
7
+ export { default as MainTable } from './MainTable';
8
+ export { default as LoadingMainTable } from './LoadingMainTable';
9
+ export { default as NoDataView } from './NoDataView';
@@ -1,3 +1,9 @@
1
1
  export { default as SheetViewTableLoading } from './SheetViewTableLoading';
2
2
  export { default as SheetViewTableRowLoading } from './SheetViewTableRowLoading';
3
3
  export { default as SheetViewTableNoData } from './SheetViewTableNoData';
4
+ export { default as SheetViewTableHeader } from './SheetViewTableHeader';
5
+ export { default as VirtualTable } from './VirtualTable';
6
+ export { default as PinnedColumn } from './PinnedColumn';
7
+ export { default as MainTable } from './MainTable';
8
+ export { default as LoadingMainTable } from './LoadingMainTable';
9
+ export { default as NoDataView } from './NoDataView';
@@ -0,0 +1,6 @@
1
+ export { usePinnedColumns } from './usePinnedColumns';
2
+ export { useSynchronizedScroll } from './useSynchronizedScroll';
3
+ export { useTableState } from './useTableState';
4
+ export { useTableData } from './useTableData';
5
+ export { useVirtualTableContainer } from './useVirtualTableContainer';
6
+ export { usePinnedColumnsWidths } from './usePinnedColumnsWidths';
@@ -0,0 +1,6 @@
1
+ export { usePinnedColumns } from './usePinnedColumns';
2
+ export { useSynchronizedScroll } from './useSynchronizedScroll';
3
+ export { useTableState } from './useTableState';
4
+ export { useTableData } from './useTableData';
5
+ export { useVirtualTableContainer } from './useVirtualTableContainer';
6
+ export { usePinnedColumnsWidths } from './usePinnedColumnsWidths';
@@ -0,0 +1,5 @@
1
+ import type { IColumnProps } from '../../../../types/index.js';
2
+ export declare const usePinnedColumnsWidths: (pinnedStartColumnsData: IColumnProps[], pinnedEndColumnsData: IColumnProps[]) => {
3
+ pinnedStartColumnsWidth: number;
4
+ pinnedEndColumnsWidth: number;
5
+ };
@@ -0,0 +1,15 @@
1
+ import { useMemo } from 'react';
2
+ export const usePinnedColumnsWidths = (pinnedStartColumnsData, pinnedEndColumnsData) => {
3
+ const pinnedStartColumnsWidth = useMemo(() => pinnedStartColumnsData.reduce((acc, col) => {
4
+ const width = typeof col.width === 'string' ? parseInt(col.width) : col.width || 100;
5
+ return acc + width;
6
+ }, 0.2), [pinnedStartColumnsData]);
7
+ const pinnedEndColumnsWidth = useMemo(() => pinnedEndColumnsData.reduce((acc, col) => {
8
+ const width = typeof col.width === 'string' ? parseInt(col.width) : col.width || 100;
9
+ return acc + width;
10
+ }, 0.2), [pinnedEndColumnsData]);
11
+ return {
12
+ pinnedStartColumnsWidth,
13
+ pinnedEndColumnsWidth,
14
+ };
15
+ };
@@ -0,0 +1,20 @@
1
+ interface UseTableDataProps<T = unknown> {
2
+ rows: T[];
3
+ isLoading?: boolean;
4
+ error?: Error | null;
5
+ isFetchingNextPage?: boolean;
6
+ areAllRowsLoaded?: boolean;
7
+ }
8
+ export declare const useTableData: <T = unknown>({ rows, isLoading, error, isFetchingNextPage, areAllRowsLoaded }: UseTableDataProps<T>) => {
9
+ isDelayedFetchingNextPage: boolean;
10
+ lastItemIndex: number;
11
+ areTotalRowsNotFillingHeight: boolean;
12
+ itemsCount: number;
13
+ isError: boolean;
14
+ tableLoading: boolean;
15
+ tableError: boolean;
16
+ tableEmpty: boolean;
17
+ hasTimeoutError: boolean;
18
+ showNoDataView: boolean;
19
+ };
20
+ export {};
@@ -0,0 +1,40 @@
1
+ import { useMemo } from 'react';
2
+ import { useDelayToSetValue } from '../../../../hooks/index.js';
3
+ import { isHeightNotFullyFilledByRows, isNotFoundError, isTimeoutError, hasError } from '../../../../utils/index.js';
4
+ const isAxiosError = (error) => {
5
+ return error !== null && 'isAxiosError' in error && error.isAxiosError === true;
6
+ };
7
+ export const useTableData = ({ rows, isLoading, error, isFetchingNextPage, areAllRowsLoaded }) => {
8
+ const isDelayedFetchingNextPage = useDelayToSetValue({
9
+ value: isFetchingNextPage,
10
+ delay: 1000,
11
+ });
12
+ const tableStates = useMemo(() => {
13
+ const isError = hasError(error || null);
14
+ const tableLoading = isLoading !== null && isLoading !== void 0 ? isLoading : true;
15
+ const axiosError = error && isAxiosError(error) ? error : null;
16
+ const tableError = !isLoading && rows.length === 0 && isError && !isNotFoundError(axiosError);
17
+ const tableEmpty = !isLoading && rows.length === 0;
18
+ const hasTimeoutError = isTimeoutError(axiosError);
19
+ const showNoDataView = tableLoading || tableError || tableEmpty || hasTimeoutError;
20
+ return {
21
+ isError,
22
+ tableLoading,
23
+ tableError,
24
+ tableEmpty,
25
+ hasTimeoutError,
26
+ showNoDataView,
27
+ };
28
+ }, [rows.length, isLoading, error]);
29
+ const tableMetrics = useMemo(() => {
30
+ const lastItemIndex = rows.length - 1;
31
+ const areTotalRowsNotFillingHeight = isHeightNotFullyFilledByRows(rows.length) && !tableStates.tableLoading;
32
+ const itemsCount = (isDelayedFetchingNextPage !== null && isDelayedFetchingNextPage !== void 0 ? isDelayedFetchingNextPage : false) || areAllRowsLoaded ? rows.length + 1 : rows.length;
33
+ return {
34
+ lastItemIndex,
35
+ areTotalRowsNotFillingHeight,
36
+ itemsCount,
37
+ };
38
+ }, [rows.length, tableStates.tableLoading, isDelayedFetchingNextPage, areAllRowsLoaded]);
39
+ return Object.assign(Object.assign(Object.assign({}, tableStates), tableMetrics), { isDelayedFetchingNextPage: isDelayedFetchingNextPage !== null && isDelayedFetchingNextPage !== void 0 ? isDelayedFetchingNextPage : false });
40
+ };
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ export interface TableState {
3
+ selectedCell: string | null;
4
+ selectedColumn: string | null;
5
+ showBackDrop: boolean;
6
+ }
7
+ export declare const useTableState: () => {
8
+ selectedCell: string | null;
9
+ selectedColumn: string | null;
10
+ showBackDrop: boolean;
11
+ setShowBackdrop: import("react").Dispatch<import("react").SetStateAction<boolean>>;
12
+ handleCellClick: (rowIndex: number, columnIndex: number, event: React.MouseEvent, pinnedType?: 'start' | 'end') => void;
13
+ handleColumnClick: (columnIndex: number, event: React.MouseEvent, pinnedType?: 'start' | 'end') => void;
14
+ resetSelection: () => void;
15
+ };
@@ -0,0 +1,31 @@
1
+ import { useState, useCallback } from 'react';
2
+ export const useTableState = () => {
3
+ const [selectedCell, setSelectedCell] = useState(null);
4
+ const [selectedColumn, setSelectedColumn] = useState(null);
5
+ const [showBackDrop, setShowBackdrop] = useState(false);
6
+ const handleCellClick = useCallback((rowIndex, columnIndex, event, pinnedType) => {
7
+ event.stopPropagation();
8
+ const cellKey = `${pinnedType !== null && pinnedType !== void 0 ? pinnedType : 'default'}-${rowIndex}-${columnIndex}`;
9
+ setSelectedCell((prev) => (prev === cellKey ? null : cellKey));
10
+ setSelectedColumn(null);
11
+ }, []);
12
+ const handleColumnClick = useCallback((columnIndex, event, pinnedType) => {
13
+ event.stopPropagation();
14
+ const columnKey = `${pinnedType !== null && pinnedType !== void 0 ? pinnedType : 'default'}-${columnIndex}`;
15
+ setSelectedColumn((prev) => (prev === columnKey ? null : columnKey));
16
+ setSelectedCell(null);
17
+ }, []);
18
+ const resetSelection = useCallback(() => {
19
+ setSelectedCell(null);
20
+ setSelectedColumn(null);
21
+ }, []);
22
+ return {
23
+ selectedCell,
24
+ selectedColumn,
25
+ showBackDrop,
26
+ setShowBackdrop,
27
+ handleCellClick,
28
+ handleColumnClick,
29
+ resetSelection,
30
+ };
31
+ };
@@ -0,0 +1,44 @@
1
+ /// <reference types="react" />
2
+ import type { IColumnProps } from '../../../../types/index.js';
3
+ import type { TableRowProps } from '@mui/material/TableRow';
4
+ interface UseVirtualTableContainerProps<T = unknown> {
5
+ rowHeight: number;
6
+ areAllRowsLoaded?: boolean;
7
+ rows: T[];
8
+ isDelayedFetchingNextPage: boolean;
9
+ rowProps?: TableRowProps & {
10
+ onRowClick?: (row: T, index: number) => void;
11
+ };
12
+ scrollToIndex?: number;
13
+ footerProps?: {
14
+ totalCount?: number;
15
+ };
16
+ isError: boolean;
17
+ selectedCell: string | null;
18
+ selectedColumn: string | null;
19
+ handleCellClick: (rowIndex: number, columnIndex: number, event: React.MouseEvent, pinnedType?: 'start' | 'end') => void;
20
+ }
21
+ export declare const useVirtualTableContainer: <T = unknown>({ rowHeight, areAllRowsLoaded, rows, isDelayedFetchingNextPage, rowProps, scrollToIndex, footerProps, isError, selectedCell, selectedColumn, handleCellClick, }: UseVirtualTableContainerProps<T>) => {
22
+ getItemSize: (index: number, height: number) => number;
23
+ getItemDataForContainer: (columnsData: IColumnProps[], isPinnedColumn: boolean, height: number) => {
24
+ columns: any;
25
+ isLoading: any;
26
+ rows: any;
27
+ rowProps: any;
28
+ scrollToIndex: any;
29
+ totalCount: any;
30
+ lastItemIndex: any;
31
+ isError: any;
32
+ areAllRowsLoaded: any;
33
+ limit: any;
34
+ newLoadedRowsEndIndex: any;
35
+ isSheetView: boolean;
36
+ isPinned: any;
37
+ selectedCell: any;
38
+ selectedColumn: any;
39
+ onCellClick: any;
40
+ containerHeight: any;
41
+ rowHeight: any;
42
+ };
43
+ };
44
+ export {};
@@ -0,0 +1,53 @@
1
+ import { useCallback, useMemo } from 'react';
2
+ import memoize from 'memoize-one';
3
+ const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToIndex, lastItemIndex, totalCount, isError, areAllRowsLoaded, isPinned, selectedCell, selectedColumn, onCellClick, containerHeight, rowHeight) => ({
4
+ columns,
5
+ isLoading,
6
+ rows,
7
+ rowProps,
8
+ scrollToIndex,
9
+ totalCount,
10
+ lastItemIndex,
11
+ isError,
12
+ areAllRowsLoaded,
13
+ limit: totalCount,
14
+ newLoadedRowsEndIndex: lastItemIndex,
15
+ isSheetView: true,
16
+ isPinned,
17
+ selectedCell,
18
+ selectedColumn,
19
+ onCellClick,
20
+ containerHeight,
21
+ rowHeight,
22
+ }));
23
+ export const useVirtualTableContainer = ({ rowHeight, areAllRowsLoaded, rows, isDelayedFetchingNextPage, rowProps, scrollToIndex, footerProps, isError, selectedCell, selectedColumn, handleCellClick, }) => {
24
+ const getItemSize = useCallback((index, height) => {
25
+ const isLastRow = areAllRowsLoaded && index === rows.length;
26
+ if (isLastRow) {
27
+ const usedHeight = rows.length * rowHeight;
28
+ const remainingHeight = height - usedHeight;
29
+ const minimumLastRowHeight = rowHeight * 2;
30
+ return Math.max(remainingHeight, minimumLastRowHeight);
31
+ }
32
+ return rowHeight;
33
+ }, [areAllRowsLoaded, rows.length, rowHeight]);
34
+ const commonItemDataParams = useMemo(() => {
35
+ var _a;
36
+ return [
37
+ isDelayedFetchingNextPage,
38
+ rows,
39
+ rowProps,
40
+ scrollToIndex,
41
+ rows.length - 1,
42
+ (_a = footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount) !== null && _a !== void 0 ? _a : 0,
43
+ isError,
44
+ areAllRowsLoaded,
45
+ ];
46
+ }, [isDelayedFetchingNextPage, rows, rowProps, scrollToIndex, footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount, isError, areAllRowsLoaded]);
47
+ const commonItemDataSuffix = useMemo(() => [selectedCell, selectedColumn, handleCellClick], [selectedCell, selectedColumn, handleCellClick]);
48
+ const getItemDataForContainer = useCallback((columnsData, isPinnedColumn, height) => createItemData(columnsData, ...commonItemDataParams, isPinnedColumn, ...commonItemDataSuffix, height, rowHeight), [commonItemDataParams, commonItemDataSuffix, rowHeight]);
49
+ return {
50
+ getItemSize,
51
+ getItemDataForContainer,
52
+ };
53
+ };
@@ -1,3 +1,5 @@
1
1
  export { default as SheetViewVirtualTable } from './SheetViewVirtualTable';
2
2
  export { default as SheetViewTableHeader } from './components/SheetViewTableHeader';
3
3
  export * from './style';
4
+ export * from './hooks';
5
+ export * from './components';
@@ -1,3 +1,5 @@
1
1
  export { default as SheetViewVirtualTable } from './SheetViewVirtualTable';
2
2
  export { default as SheetViewTableHeader } from './components/SheetViewTableHeader';
3
3
  export * from './style';
4
+ export * from './hooks';
5
+ export * from './components';