@tap-payments/os-micro-frontend-shared 0.0.312 → 0.1.1-test.54
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/build/components/JSONViewer/JSONViewer.js +1 -1
- package/build/components/MultiSelectDropdownButton/MultiSelectDropdownButton.js +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable.js +87 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/components/LoadingState.d.ts +34 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/components/LoadingState.js +37 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/components/NoDataState.d.ts +34 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/components/NoDataState.js +21 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/components/PinnedColumnSection.d.ts +32 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/components/PinnedColumnSection.js +16 -0
- package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/components/SheetViewTableHeader/SheetViewTableHeader.d.ts +2 -1
- package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/components/SheetViewTableHeader/SheetViewTableHeader.js +2 -2
- package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/components/SheetViewTableHeader/TableCell.d.ts +2 -2
- package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/components/SheetViewTableHeader/TableCell.js +7 -15
- package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/components/SheetViewTableHeader/type.d.ts +2 -1
- package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/components/SheetViewTableNoData.js +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/components/VirtualListContainer.d.ts +31 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/components/VirtualListContainer.js +71 -0
- package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/hooks/usePinnedColumns.d.ts +4 -0
- package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/hooks/usePinnedColumns.js +18 -8
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useSelection.d.ts +6 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useSelection.js +17 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableDisplayState.d.ts +9 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableDisplayState.js +20 -0
- package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/style.js +0 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/utils.d.ts +2 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/utils.js +6 -0
- package/build/components/{VirtualTable → VirtualTables/VirtualTable}/VirtualTable.d.ts +1 -1
- package/build/components/{VirtualTable → VirtualTables/VirtualTable}/VirtualTable.js +9 -9
- package/build/components/{VirtualTable → VirtualTables/VirtualTableWithCard}/VirtualTableWithCard.d.ts +1 -1
- package/build/components/{VirtualTable → VirtualTables/VirtualTableWithCard}/VirtualTableWithCard.js +7 -7
- package/build/components/{VirtualTable → VirtualTables}/components/ColumnSort/ColumnSort.js +1 -1
- package/build/components/{VirtualTable → VirtualTables}/components/TableHeader/components/TableCell/TableCell.d.ts +1 -1
- package/build/components/{VirtualTable → VirtualTables}/components/TableHeader/components/TableCell/TableCell.js +3 -3
- package/build/components/{VirtualTable → VirtualTables}/components/TableLoadingWithCard.d.ts +2 -3
- package/build/components/{VirtualTable → VirtualTables}/components/TableNoData.js +1 -1
- package/build/components/{VirtualTable → VirtualTables}/components/TableNoDataWithCard.d.ts +3 -4
- package/build/components/{VirtualTable → VirtualTables}/components/TableNoDataWithCard.js +1 -1
- package/build/components/{VirtualTable → VirtualTables}/components/TableRow.js +3 -3
- package/build/components/{VirtualTable → VirtualTables}/components/TableRowLoadingWithCard.d.ts +2 -3
- package/build/components/{VirtualTable → VirtualTables}/components/TableRowWithCard.d.ts +2 -3
- package/build/components/{VirtualTable → VirtualTables}/components/TableRowWithCard.js +1 -1
- package/build/components/{VirtualTable → VirtualTables/components}/style.js +9 -12
- package/build/components/{VirtualTable/utils/getSelectionStyles.d.ts → VirtualTables/components/utils.d.ts} +0 -11
- package/build/components/{VirtualTable/utils/getSelectionStyles.js → VirtualTables/components/utils.js} +1 -8
- package/build/components/{VirtualTable → VirtualTables}/components/virtualScroll/ListItemWrapper.js +2 -2
- package/build/components/VirtualTables/index.d.ts +6 -0
- package/build/components/VirtualTables/index.js +6 -0
- package/build/components/index.d.ts +2 -2
- package/build/components/index.js +2 -2
- package/build/types/table.d.ts +1 -1
- package/package.json +3 -3
- package/build/components/VirtualTable/SheetView/SheetViewVirtualTable.js +0 -194
- package/build/components/VirtualTable/index.d.ts +0 -6
- package/build/components/VirtualTable/index.js +0 -6
- package/build/playground/VTDemo.d.ts +0 -1
- package/build/playground/VTDemo.js +0 -58
- package/build/playground/index.d.ts +0 -1
- package/build/playground/index.js +0 -1
- /package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/SheetViewVirtualTable.d.ts +0 -0
- /package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/components/SheetViewTableHeader/index.d.ts +0 -0
- /package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/components/SheetViewTableHeader/index.js +0 -0
- /package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/components/SheetViewTableHeader/type.js +0 -0
- /package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/components/SheetViewTableLoading.d.ts +0 -0
- /package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/components/SheetViewTableLoading.js +0 -0
- /package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/components/SheetViewTableNoData.d.ts +0 -0
- /package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/components/SheetViewTableRowLoading.d.ts +0 -0
- /package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/components/SheetViewTableRowLoading.js +0 -0
- /package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/components/index.d.ts +0 -0
- /package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/components/index.js +0 -0
- /package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/hooks/useSynchronizedScroll.d.ts +0 -0
- /package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/hooks/useSynchronizedScroll.js +0 -0
- /package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/index.d.ts +0 -0
- /package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/index.js +0 -0
- /package/build/components/{VirtualTable/SheetView → VirtualTables/SheetViewVirtualTable}/style.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ColumnFilter/ColumnFilter.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ColumnFilter/ColumnFilter.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ColumnFilter/Inputs/Inputs.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ColumnFilter/Inputs/Inputs.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ColumnFilter/Inputs/index.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ColumnFilter/Inputs/index.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ColumnFilter/Inputs/style.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ColumnFilter/Inputs/style.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ColumnFilter/List/List.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ColumnFilter/List/List.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ColumnFilter/List/index.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ColumnFilter/List/index.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ColumnFilter/index.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ColumnFilter/index.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ColumnFilter/style.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ColumnFilter/style.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ColumnFilter/type.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ColumnFilter/type.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ColumnSort/ColumnSort.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ColumnSort/index.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ColumnSort/index.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ColumnSort/style.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ColumnSort/style.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/EmptyList/EmptyList.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/EmptyList/EmptyList.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/EmptyList/index.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/EmptyList/index.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/EmptyList/styles.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/EmptyList/styles.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ErrorList/ErrorList.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ErrorList/ErrorList.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ErrorList/index.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ErrorList/index.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ErrorList/styles.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/ErrorList/styles.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/RowErrorState.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/RowErrorState.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableError.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableError.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableFooter/TableFooter.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableFooter/TableFooter.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableFooter/index.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableFooter/index.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableFooter/style.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableFooter/style.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableHeader/TableHeader.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableHeader/TableHeader.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableHeader/components/TableCell/index.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableHeader/components/TableCell/index.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableHeader/components/index.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableHeader/components/index.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableHeader/constant.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableHeader/constant.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableHeader/index.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableHeader/index.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableHeader/style.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableHeader/style.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableHeader/type.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableHeader/type.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableLastItem.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableLastItem.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableLoading.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableLoading.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableLoadingWithCard.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableNoData.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableRow.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableRowLoading.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableRowLoading.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/TableRowLoadingWithCard.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/index.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/index.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables/components}/style.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/virtualScroll/ListItemWrapper.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/virtualScroll/ListItemWrapperWithCard.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/virtualScroll/ListItemWrapperWithCard.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/virtualScroll/VirtualScrollInner.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/virtualScroll/VirtualScrollInner.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/virtualScroll/VirtualScrollList.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/virtualScroll/VirtualScrollList.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/virtualScroll/VirtualScrollOuter.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/virtualScroll/VirtualScrollOuter.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/virtualScroll/index.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/components/virtualScroll/index.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/context/Provider.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/context/Provider.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/context/context.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/context/context.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/context/index.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/context/index.js +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/hooks/useScrollBackShadow.d.ts +0 -0
- /package/build/components/{VirtualTable → VirtualTables}/hooks/useScrollBackShadow.js +0 -0
|
@@ -11,7 +11,7 @@ import { isSafariBrowser } from '../../utils/index.js';
|
|
|
11
11
|
import AnimatedButton from './components/FooterButton';
|
|
12
12
|
import JSONTitleBar from './components/JSONTitleBar';
|
|
13
13
|
import { ButtonsWrapper, FooterWrapper, JSONContainer, JSONViewerWrapper, SectionWrapper, StyledCopyButton, StyledHeaderWrapper, StyledTitle, jsonTheme, requestJsonTheme, TITLE_BAR_HEIGHT, VIEWER_HEIGHT, FOOTER_HEIGHT, } from './style';
|
|
14
|
-
import TableFooter from '../
|
|
14
|
+
import TableFooter from '../VirtualTables/components/TableFooter';
|
|
15
15
|
const VIEWER_WIDTH = 400;
|
|
16
16
|
const animationDuration = 0.5;
|
|
17
17
|
export default function JSONViewer({ index, json, requestJson = {}, isWindowMinimized, windowOrder, onClose }) {
|
|
@@ -4,7 +4,7 @@ import { Popper } from '@mui/material';
|
|
|
4
4
|
import { ButtonLabel } from './style';
|
|
5
5
|
import CustomBackdrop from '../CustomBackdrop';
|
|
6
6
|
import StatusButton from '../StatusButton';
|
|
7
|
-
import ListColumnFilter from '../
|
|
7
|
+
import ListColumnFilter from '../VirtualTables/components/ColumnFilter/List';
|
|
8
8
|
import { downArrowIcon } from '../../constants/index.js';
|
|
9
9
|
function MultiSelectDropdownButton({ buttonLabel, onClear, onConfirm, dropdownItems, apiKey, data, styles, buttonDisabled, }) {
|
|
10
10
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
@@ -0,0 +1,87 @@
|
|
|
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, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
+
import { useMemo, memo, useState, useCallback } from 'react';
|
|
12
|
+
import { useTheme } from '@mui/material/styles';
|
|
13
|
+
import { TABLE_THRESHOLD } from '../../../constants/index.js';
|
|
14
|
+
import { useDelayToSetValue } from '../../../hooks/index.js';
|
|
15
|
+
import TableFooter from '../components/TableFooter/TableFooter';
|
|
16
|
+
import { StyledBox, StyledTableBox, TableContainer, TableWrapper } from '../components/style';
|
|
17
|
+
import { SheetViewVirtualTableWrapper, MainTableWrapper, UnpinnedTableHeaderWrapper } from './style';
|
|
18
|
+
import SheetViewTableHeader from './components/SheetViewTableHeader';
|
|
19
|
+
import { usePinnedColumns } from './hooks/usePinnedColumns';
|
|
20
|
+
import { useSynchronizedScroll } from './hooks/useSynchronizedScroll';
|
|
21
|
+
import VirtualListContainer from './components/VirtualListContainer';
|
|
22
|
+
import PinnedColumnSection from './components/PinnedColumnSection';
|
|
23
|
+
import LoadingState from './components/LoadingState';
|
|
24
|
+
import NoDataState from './components/NoDataState';
|
|
25
|
+
import { useSelection } from './hooks/useSelection';
|
|
26
|
+
import { useTableDisplayState } from './hooks/useTableDisplayState';
|
|
27
|
+
import { getColumnsTotalWidth } from './utils';
|
|
28
|
+
function SheetViewVirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader, headerProps, rowProps, footerProps, rowHeight = 28, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, showBackgroundColor, areAllRowsLoaded = false, tableBodyStyles, tableTitle, dragControls, onColumnPin, clearBackdropVisibilityTimeout = 100, isPinnable = false, tableMode, }) {
|
|
29
|
+
const [showBackDrop, setShowBackdrop] = useState(false);
|
|
30
|
+
const theme = useTheme();
|
|
31
|
+
const { pinnedStartColumns, pinnedEndColumns, handleColumnPin, pinnedStartColumnsData, pinnedEndColumnsData, unpinnedColumnsData, orderedColumns, lastColumnId, isColumnPinned, } = usePinnedColumns(columns, isPinnable, onColumnPin);
|
|
32
|
+
const { pinnedStartVirtualListRef, scrollableVirtualListRef, pinnedEndVirtualListRef, handleScroll } = useSynchronizedScroll();
|
|
33
|
+
const { selectedCell, selectedColumn, handleCellClick, handleColumnClick } = useSelection();
|
|
34
|
+
const isDelayedFetchingNextPage = useDelayToSetValue({
|
|
35
|
+
value: isFetchingNextPage,
|
|
36
|
+
delay: 1000,
|
|
37
|
+
});
|
|
38
|
+
const { isError, tableLoading, tableError, tableEmpty, hasTimeoutError, areTotalRowsNotFillingHeight, showNoDataView } = useTableDisplayState(rows.length, isLoading, error);
|
|
39
|
+
const pinnedAllColumns = useMemo(() => [...pinnedStartColumns, ...pinnedEndColumns], [pinnedStartColumns, pinnedEndColumns]);
|
|
40
|
+
const onScrollByKey = useMemo(() => ({
|
|
41
|
+
pinnedStart: (sp) => handleScroll(sp, 'start'),
|
|
42
|
+
pinnedEnd: (sp) => handleScroll(sp, 'end'),
|
|
43
|
+
scrollable: (sp) => handleScroll(sp, 'scrollable'),
|
|
44
|
+
}), [handleScroll]);
|
|
45
|
+
const pinnedStartColumnsWidth = useMemo(() => getColumnsTotalWidth(pinnedStartColumnsData), [pinnedStartColumnsData]);
|
|
46
|
+
const pinnedEndColumnsWidth = useMemo(() => getColumnsTotalWidth(pinnedEndColumnsData), [pinnedEndColumnsData]);
|
|
47
|
+
const onPointerDown = (e) => {
|
|
48
|
+
dragControls === null || dragControls === void 0 ? void 0 : dragControls.start(e);
|
|
49
|
+
};
|
|
50
|
+
const onLoadMoreItems = useCallback(() => __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
if (areAllRowsLoaded)
|
|
52
|
+
return;
|
|
53
|
+
yield (loadMoreItems === null || loadMoreItems === void 0 ? void 0 : loadMoreItems());
|
|
54
|
+
}), [areAllRowsLoaded, loadMoreItems]);
|
|
55
|
+
const createVirtualTableContainer = useCallback((columnsToRender, containerKey, isPinned = false, fixedWidth) => {
|
|
56
|
+
var _a;
|
|
57
|
+
const listRef = containerKey === 'pinnedStart' ? pinnedStartVirtualListRef : containerKey === 'pinnedEnd' ? pinnedEndVirtualListRef : scrollableVirtualListRef;
|
|
58
|
+
return (_jsx(VirtualListContainer, { columns: columnsToRender, isPinned: isPinned, fixedWidth: fixedWidth, listRef: listRef, rows: rows, rowProps: rowProps, totalCount: (_a = footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount) !== null && _a !== void 0 ? _a : 0, rowHeight: rowHeight, isError: isError, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, areAllRowsLoaded: areAllRowsLoaded, isFetchingNextPage: isDelayedFetchingNextPage, isLoading: isLoading, scrollToIndex: scrollToIndex, selectedCell: selectedCell, selectedColumn: selectedColumn, onCellClick: handleCellClick, onScroll: onScrollByKey[containerKey], loadMoreItems: onLoadMoreItems, threshold: threshold, clearBackdropVisibilityTimeout: clearBackdropVisibilityTimeout, useLoader: true, setBackdropVisibility: setShowBackdrop }));
|
|
59
|
+
}, [
|
|
60
|
+
rows,
|
|
61
|
+
rowProps,
|
|
62
|
+
footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount,
|
|
63
|
+
rowHeight,
|
|
64
|
+
isError,
|
|
65
|
+
areTotalRowsNotFillingHeight,
|
|
66
|
+
areAllRowsLoaded,
|
|
67
|
+
isDelayedFetchingNextPage,
|
|
68
|
+
isLoading,
|
|
69
|
+
scrollToIndex,
|
|
70
|
+
selectedCell,
|
|
71
|
+
selectedColumn,
|
|
72
|
+
handleCellClick,
|
|
73
|
+
onScrollByKey,
|
|
74
|
+
onLoadMoreItems,
|
|
75
|
+
threshold,
|
|
76
|
+
clearBackdropVisibilityTimeout,
|
|
77
|
+
pinnedEndVirtualListRef,
|
|
78
|
+
pinnedStartVirtualListRef,
|
|
79
|
+
scrollableVirtualListRef,
|
|
80
|
+
]);
|
|
81
|
+
const renderPinnedColumn = (position, columnsData, columnsWidth, pinnedColumnsList) => (_jsx(PinnedColumnSection, { position: position, columnsData: columnsData, columnsWidth: columnsWidth, pinnedColumnsList: pinnedColumnsList, showHeader: showHeader, columnsSorting: columnsSorting, onColumnSort: onColumnSort, headerProps: headerProps, showBackDrop: showBackDrop, onColumnPin: handleColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: handleColumnClick, tableTitle: tableTitle, areAllRowsLoaded: areAllRowsLoaded, isFetchingNextPage: isFetchingNextPage, scrollToIndex: scrollToIndex, isLoading: isLoading, isError: isError, hasTimeoutError: hasTimeoutError, showBackgroundColor: showBackgroundColor, tableMode: tableMode, showNoDataView: showNoDataView, renderContainer: createVirtualTableContainer }));
|
|
82
|
+
return (_jsxs(_Fragment, { children: [_jsx(TableContainer, { children: showNoDataView ? (tableLoading ? (_jsx(LoadingState, { showHeader: showHeader, orderedColumns: orderedColumns, headerProps: headerProps, columnsSorting: columnsSorting, onColumnSort: onColumnSort, showBackDrop: showBackDrop, onColumnPin: handleColumnPin, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: handleColumnClick, tableBodyStyles: tableBodyStyles, error: error, tableEmpty: tableEmpty, isTimeoutError: hasTimeoutError, tableError: tableError, tableLoading: tableLoading, triggerDataRefetch: triggerDataRefetch, footerProps: footerProps, tableTitle: tableTitle, areAllRowsLoaded: areAllRowsLoaded, isFetchingNextPage: isFetchingNextPage, scrollToIndex: scrollToIndex, isLoading: isLoading, isError: isError, showBackgroundColor: showBackgroundColor, tableMode: tableMode, showNoDataView: showNoDataView })) : (_jsx(NoDataState, { showHeader: showHeader, orderedColumns: orderedColumns, headerProps: headerProps, columnsSorting: columnsSorting, onColumnSort: onColumnSort, showBackDrop: showBackDrop, onColumnPin: handleColumnPin, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: handleColumnClick, tableBodyStyles: tableBodyStyles, error: error, tableEmpty: tableEmpty, isTimeoutError: hasTimeoutError, tableError: tableError, tableLoading: tableLoading, triggerDataRefetch: triggerDataRefetch, footerProps: footerProps, tableTitle: tableTitle, areAllRowsLoaded: areAllRowsLoaded, isFetchingNextPage: isFetchingNextPage, scrollToIndex: scrollToIndex, isLoading: isLoading, isError: isError, showBackgroundColor: showBackgroundColor, tableMode: tableMode, showNoDataView: showNoDataView }))) : (_jsxs(SheetViewVirtualTableWrapper, { children: [renderPinnedColumn('start', pinnedStartColumnsData, pinnedStartColumnsWidth, pinnedStartColumns), _jsx(MainTableWrapper, Object.assign({ hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0 }, { 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-show-background-color": !!showBackgroundColor, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showBackgroundColor: showBackgroundColor, 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: pinnedAllColumns, onColumnPin: handleColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: handleColumnClick, isColumnPinned: isColumnPinned }) })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
|
83
|
+
width: '100%',
|
|
84
|
+
minWidth: 'fit-content',
|
|
85
|
+
} }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_ScrollableStyledBox", hidePadding: true, className: "list-wrapper" }, { children: createVirtualTableContainer(unpinnedColumnsData, 'scrollable', false) })) }))] })) })) })), renderPinnedColumn('end', pinnedEndColumnsData, pinnedEndColumnsWidth, pinnedAllColumns)] })) }), _jsx(TableFooter, Object.assign({ "data-testid": "SheetViewVirtualTable_TableFooter", showSeparator: true, showBackDrop: showBackDrop, onPointerDown: onPointerDown }, footerProps))] }));
|
|
86
|
+
}
|
|
87
|
+
export default memo(SheetViewVirtualTable);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { IColumnProps, IVirtualTable } from '../../../../types/index.js';
|
|
3
|
+
export interface LoadingStateProps {
|
|
4
|
+
showHeader?: boolean;
|
|
5
|
+
orderedColumns: IColumnProps[];
|
|
6
|
+
headerProps?: any;
|
|
7
|
+
columnsSorting?: IVirtualTable['columnsSorting'];
|
|
8
|
+
onColumnSort?: IVirtualTable['onColumnSort'];
|
|
9
|
+
showBackDrop: boolean;
|
|
10
|
+
onColumnPin?: (columnId: string, position: 'start' | 'end' | 'unpin') => void;
|
|
11
|
+
lastColumnId?: string | null;
|
|
12
|
+
selectedColumn?: string | null;
|
|
13
|
+
onColumnClick?: (columnId: string, event: React.MouseEvent) => void;
|
|
14
|
+
tableBodyStyles?: any;
|
|
15
|
+
error?: unknown;
|
|
16
|
+
tableEmpty: boolean;
|
|
17
|
+
isTimeoutError: boolean;
|
|
18
|
+
tableError: boolean;
|
|
19
|
+
tableLoading: boolean;
|
|
20
|
+
triggerDataRefetch?: () => Promise<unknown>;
|
|
21
|
+
footerProps?: IVirtualTable['footerProps'];
|
|
22
|
+
tableTitle?: string;
|
|
23
|
+
areAllRowsLoaded: boolean;
|
|
24
|
+
isFetchingNextPage?: boolean;
|
|
25
|
+
scrollToIndex?: number;
|
|
26
|
+
isLoading?: boolean;
|
|
27
|
+
isError: boolean;
|
|
28
|
+
showBackgroundColor?: boolean;
|
|
29
|
+
tableMode?: string;
|
|
30
|
+
showNoDataView: boolean;
|
|
31
|
+
}
|
|
32
|
+
declare function LoadingState({ showHeader, orderedColumns, headerProps, columnsSorting, onColumnSort, showBackDrop, onColumnPin, lastColumnId, selectedColumn, onColumnClick, tableBodyStyles, error, tableEmpty, isTimeoutError, tableError, tableLoading, triggerDataRefetch, footerProps, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, showBackgroundColor, tableMode, showNoDataView, }: LoadingStateProps): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
declare const _default: import("react").MemoExoticComponent<typeof LoadingState>;
|
|
34
|
+
export default _default;
|
|
@@ -0,0 +1,37 @@
|
|
|
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, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { memo } from 'react';
|
|
12
|
+
import { useTheme } from '@mui/material/styles';
|
|
13
|
+
import { StyledBox, StyledTableBox, TableWrapper } from '../../components/style';
|
|
14
|
+
import { UnpinnedTableHeaderWrapper } from '../style';
|
|
15
|
+
import SheetViewTableHeader from './SheetViewTableHeader';
|
|
16
|
+
import { SheetViewTableNoData } from '.';
|
|
17
|
+
const EMPTY_PINNED_COLUMNS = [];
|
|
18
|
+
function LoadingState({ showHeader, orderedColumns, headerProps, columnsSorting, onColumnSort, showBackDrop, onColumnPin, lastColumnId, selectedColumn, onColumnClick, tableBodyStyles, error, tableEmpty, isTimeoutError, tableError, tableLoading, triggerDataRefetch, footerProps, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, showBackgroundColor, tableMode, showNoDataView, }) {
|
|
19
|
+
var _a;
|
|
20
|
+
const theme = useTheme();
|
|
21
|
+
return (_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": !!isTimeoutError, "data-show-background-color": !!showBackgroundColor, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showBackgroundColor: !!showBackgroundColor, showNoDataView: showNoDataView, scrollable: true, sx: {
|
|
22
|
+
marginLeft: '28px',
|
|
23
|
+
maxHeight: 'calc(100vh - 300px)',
|
|
24
|
+
overflow: 'auto',
|
|
25
|
+
} }, { children: _jsxs(TableWrapper, Object.assign({ "data-testid": "SheetViewVirtualTable_LoadingTableWrapper", showNoDataView: showNoDataView, sx: Object.assign(Object.assign({}, tableBodyStyles), { display: 'flex', flexDirection: 'column', height: 'auto' }) }, { children: [showHeader && (_jsx(UnpinnedTableHeaderWrapper, { children: _jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_LoadingTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: orderedColumns, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: EMPTY_PINNED_COLUMNS, onColumnPin: onColumnPin, isPinnable: false, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: onColumnClick }) })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_LoadingTableWrapper", sx: {
|
|
26
|
+
width: '100%',
|
|
27
|
+
minWidth: 'fit-content',
|
|
28
|
+
height: 'auto',
|
|
29
|
+
display: 'flex',
|
|
30
|
+
flexDirection: 'column',
|
|
31
|
+
} }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_LoadingStyledBox", hidePadding: true, className: "list-wrapper", sx: {
|
|
32
|
+
height: 'auto',
|
|
33
|
+
display: 'flex',
|
|
34
|
+
flexDirection: 'column',
|
|
35
|
+
} }, { children: _jsx(SheetViewTableNoData, { error: (_a = error) !== null && _a !== void 0 ? _a : null, tableEmpty: tableEmpty, isTimeoutError: isTimeoutError, tableError: tableError, tableLoading: tableLoading, orderedColumns: orderedColumns, triggerDataRefetch: triggerDataRefetch ? () => __awaiter(this, void 0, void 0, function* () { return triggerDataRefetch(); }) : () => __awaiter(this, void 0, void 0, function* () { }), footerProps: footerProps }) })) }))] })) })));
|
|
36
|
+
}
|
|
37
|
+
export default memo(LoadingState);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { IColumnProps, IVirtualTable } from '../../../../types/index.js';
|
|
3
|
+
export interface NoDataStateProps {
|
|
4
|
+
showHeader?: boolean;
|
|
5
|
+
orderedColumns: IColumnProps[];
|
|
6
|
+
headerProps?: any;
|
|
7
|
+
columnsSorting?: IVirtualTable['columnsSorting'];
|
|
8
|
+
onColumnSort?: IVirtualTable['onColumnSort'];
|
|
9
|
+
showBackDrop: boolean;
|
|
10
|
+
onColumnPin?: (columnId: string, position: 'start' | 'end' | 'unpin') => void;
|
|
11
|
+
lastColumnId?: string | null;
|
|
12
|
+
selectedColumn?: string | null;
|
|
13
|
+
onColumnClick?: (columnId: string, event: React.MouseEvent) => void;
|
|
14
|
+
tableBodyStyles?: any;
|
|
15
|
+
error?: unknown;
|
|
16
|
+
tableEmpty: boolean;
|
|
17
|
+
isTimeoutError: boolean;
|
|
18
|
+
tableError: boolean;
|
|
19
|
+
tableLoading: boolean;
|
|
20
|
+
triggerDataRefetch?: () => Promise<unknown>;
|
|
21
|
+
footerProps?: IVirtualTable['footerProps'];
|
|
22
|
+
tableTitle?: string;
|
|
23
|
+
areAllRowsLoaded: boolean;
|
|
24
|
+
isFetchingNextPage?: boolean;
|
|
25
|
+
scrollToIndex?: number;
|
|
26
|
+
isLoading?: boolean;
|
|
27
|
+
isError: boolean;
|
|
28
|
+
showBackgroundColor?: boolean;
|
|
29
|
+
tableMode?: string;
|
|
30
|
+
showNoDataView: boolean;
|
|
31
|
+
}
|
|
32
|
+
declare function NoDataState({ showHeader, orderedColumns, headerProps, columnsSorting, onColumnSort, showBackDrop, onColumnPin, lastColumnId, selectedColumn, onColumnClick, tableBodyStyles, error, tableEmpty, isTimeoutError, tableError, tableLoading, triggerDataRefetch, footerProps, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, showBackgroundColor, tableMode, showNoDataView, }: NoDataStateProps): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
declare const _default: import("react").MemoExoticComponent<typeof NoDataState>;
|
|
34
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
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, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { memo } from 'react';
|
|
12
|
+
import { useTheme } from '@mui/material/styles';
|
|
13
|
+
import { StyledTableBox, TableWrapper } from '../../components/style';
|
|
14
|
+
import { UnpinnedTableHeaderWrapper } from '../style';
|
|
15
|
+
import SheetViewTableHeader from './SheetViewTableHeader';
|
|
16
|
+
import TableNoData from '../../components/TableNoData';
|
|
17
|
+
function NoDataState({ showHeader, orderedColumns, headerProps, columnsSorting, onColumnSort, showBackDrop, onColumnPin, lastColumnId, selectedColumn, onColumnClick, tableBodyStyles, error, tableEmpty, isTimeoutError, tableError, tableLoading, triggerDataRefetch, footerProps, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, showBackgroundColor, tableMode, showNoDataView, }) {
|
|
18
|
+
const theme = useTheme();
|
|
19
|
+
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": !!isTimeoutError, "data-show-background-color": !!showBackgroundColor, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showBackgroundColor: !!showBackgroundColor, showNoDataView: showNoDataView }, { children: _jsxs(TableWrapper, Object.assign({ isSheetView: true, "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, tableEmpty: tableEmpty, isTimeoutError: isTimeoutError, tableError: tableError, tableLoading: tableLoading, orderedColumns: orderedColumns, triggerDataRefetch: triggerDataRefetch !== null && triggerDataRefetch !== void 0 ? triggerDataRefetch : (() => __awaiter(this, void 0, void 0, function* () { })), footerProps: footerProps })] })) })));
|
|
20
|
+
}
|
|
21
|
+
export default memo(NoDataState);
|
package/build/components/VirtualTables/SheetViewVirtualTable/components/PinnedColumnSection.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { IColumnProps, IVirtualTable } from '../../../../types/index.js';
|
|
3
|
+
interface PinnedColumnSectionProps {
|
|
4
|
+
position: 'start' | 'end';
|
|
5
|
+
columnsData: IColumnProps[];
|
|
6
|
+
columnsWidth: number;
|
|
7
|
+
pinnedColumnsList: string[];
|
|
8
|
+
showHeader?: boolean;
|
|
9
|
+
columnsSorting?: IVirtualTable['columnsSorting'];
|
|
10
|
+
onColumnSort?: IVirtualTable['onColumnSort'];
|
|
11
|
+
headerProps?: any;
|
|
12
|
+
showBackDrop: boolean;
|
|
13
|
+
onColumnPin?: (columnId: string, position: 'start' | 'end' | 'unpin') => void;
|
|
14
|
+
isPinnable?: boolean;
|
|
15
|
+
lastColumnId?: string | null;
|
|
16
|
+
selectedColumn?: string | null;
|
|
17
|
+
onColumnClick?: (columnId: string, event: React.MouseEvent) => void;
|
|
18
|
+
tableTitle?: string;
|
|
19
|
+
areAllRowsLoaded: boolean;
|
|
20
|
+
isFetchingNextPage?: boolean;
|
|
21
|
+
scrollToIndex?: number;
|
|
22
|
+
isLoading?: boolean;
|
|
23
|
+
isError: boolean;
|
|
24
|
+
hasTimeoutError: boolean;
|
|
25
|
+
showBackgroundColor?: boolean;
|
|
26
|
+
tableMode?: string;
|
|
27
|
+
showNoDataView: boolean;
|
|
28
|
+
renderContainer: (columnsToRender: IColumnProps[], containerKey: 'pinnedStart' | 'pinnedEnd' | 'scrollable', isPinned?: boolean, fixedWidth?: number) => JSX.Element;
|
|
29
|
+
}
|
|
30
|
+
declare function PinnedColumnSection({ position, columnsData, columnsWidth, pinnedColumnsList, showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, hasTimeoutError, showBackgroundColor, tableMode, showNoDataView, renderContainer, }: PinnedColumnSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
declare const _default: import("react").MemoExoticComponent<typeof PinnedColumnSection>;
|
|
32
|
+
export default _default;
|
package/build/components/VirtualTables/SheetViewVirtualTable/components/PinnedColumnSection.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
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 { StyledBox, StyledTableBox, TableWrapper } from '../../components/style';
|
|
5
|
+
import { PinnedStartColumnWrapper, PinnedEndColumnWrapper, UnpinnedTableHeaderWrapper } from '../style';
|
|
6
|
+
import SheetViewTableHeader from './SheetViewTableHeader';
|
|
7
|
+
const EMPTY_PINNED_COLUMNS = [];
|
|
8
|
+
function PinnedColumnSection({ position, columnsData, columnsWidth, pinnedColumnsList, showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, hasTimeoutError, showBackgroundColor, tableMode, showNoDataView, renderContainer, }) {
|
|
9
|
+
const theme = useTheme();
|
|
10
|
+
const fixedWidth = columnsWidth;
|
|
11
|
+
const isStart = position === 'start';
|
|
12
|
+
const containerKey = isStart ? 'pinnedStart' : 'pinnedEnd';
|
|
13
|
+
const Wrapper = isStart ? PinnedStartColumnWrapper : PinnedEndColumnWrapper;
|
|
14
|
+
return (_jsx(Wrapper, Object.assign({ "data-testid": `SheetViewVirtualTable_PinnedTableWrapper_${position}`, style: { width: fixedWidth } }, { children: _jsx(StyledTableBox, Object.assign({ as: "nav", id: `sheet-pinned-${position}-box-container`, "aria-labelledby": `sheet-pinned-${position}-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-show-background-color": !!showBackgroundColor, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showBackgroundColor: !!showBackgroundColor, showNoDataView: showNoDataView, scrollable: false }, { children: _jsxs(TableWrapper, Object.assign({ "data-testid": "SheetViewVirtualTable_TableWrapper", showNoDataView: showNoDataView, sx: { height: '100%' } }, { children: [showHeader && (_jsx(UnpinnedTableHeaderWrapper, { children: _jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_PinnedTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: columnsData, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: isStart ? pinnedColumnsList : EMPTY_PINNED_COLUMNS, onColumnPin: onColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: onColumnClick }) })), _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_PinnedStyledBox", hidePadding: true, className: "list-wrapper" }, { children: renderContainer(columnsData, containerKey, true, fixedWidth) }))] })) })) })));
|
|
15
|
+
}
|
|
16
|
+
export default memo(PinnedColumnSection);
|
|
@@ -13,7 +13,8 @@ interface SheetViewTableHeaderProps {
|
|
|
13
13
|
lastColumnId?: string | null;
|
|
14
14
|
selectedColumn?: string | null;
|
|
15
15
|
onColumnClick?: (columnId: string, event: React.MouseEvent) => void;
|
|
16
|
+
isColumnPinned?: (id: string) => boolean;
|
|
16
17
|
}
|
|
17
|
-
declare function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, }: SheetViewTableHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
declare function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, isColumnPinned, }: SheetViewTableHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
18
19
|
declare const _default: import("react").MemoExoticComponent<typeof SheetViewTableHeader>;
|
|
19
20
|
export default _default;
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { memo } from 'react';
|
|
3
3
|
import { StyledHeader, StyledMUITableRow } from '../../style';
|
|
4
4
|
import TableCell from './TableCell';
|
|
5
|
-
function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns = [], onColumnPin, isPinnable = false, lastColumnId, selectedColumn = null, onColumnClick, }) {
|
|
5
|
+
function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns = [], onColumnPin, isPinnable = false, lastColumnId, selectedColumn = null, onColumnClick, isColumnPinned, }) {
|
|
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
|
-
return (_jsx(TableCell, { column: column, isFirst: column.id === columns[0].id, isLast: column.id === columns[columns.length - 1].id, isDefaultPinned: !!column.isDefaultPinned, isSelected: selectedColumn === column.id, onColumnSort: onColumnSort, columnsSorting: columnsSorting, pinnedColumns: pinnedColumns, onColumnPin: onColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, onColumnClick: onColumnClick }, `${column.id}-${colIndex}`));
|
|
7
|
+
return (_jsx(TableCell, { column: column, isFirst: column.id === columns[0].id, isLast: column.id === columns[columns.length - 1].id, isDefaultPinned: !!column.isDefaultPinned, isSelected: selectedColumn === column.id, onColumnSort: onColumnSort, columnsSorting: columnsSorting, pinnedColumns: pinnedColumns, onColumnPin: onColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, onColumnClick: onColumnClick, isColumnPinned: isColumnPinned }, `${column.id}-${colIndex}`));
|
|
8
8
|
}) })) })));
|
|
9
9
|
}
|
|
10
10
|
export default memo(SheetViewTableHeader);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { IColumnProps } from '../../../../../types/index.js';
|
|
3
3
|
import { SheetViewTableHeaderProps } from './type';
|
|
4
|
-
interface TableCellProps extends Pick<SheetViewTableHeaderProps, 'onColumnSort' | 'columnsSorting' | 'onColumnPin' | 'isPinnable' | 'lastColumnId' | 'onColumnClick' | 'pinnedColumns'> {
|
|
4
|
+
interface TableCellProps extends Pick<SheetViewTableHeaderProps, 'onColumnSort' | 'columnsSorting' | 'onColumnPin' | 'isPinnable' | 'lastColumnId' | 'onColumnClick' | 'pinnedColumns' | 'isColumnPinned'> {
|
|
5
5
|
column: IColumnProps;
|
|
6
6
|
isFirst: boolean;
|
|
7
7
|
isLast: boolean;
|
|
8
8
|
isSelected: boolean;
|
|
9
9
|
isDefaultPinned: boolean;
|
|
10
10
|
}
|
|
11
|
-
declare function TableCell({ column: { header, id, align, headerStyle, sortable, filter, pinnable, width, order }, isFirst, isLast, isSelected, isDefaultPinned, onColumnSort, columnsSorting, onColumnPin, isPinnable, lastColumnId, onColumnClick, pinnedColumns, }: TableCellProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare function TableCell({ column: { header, id, align, headerStyle, sortable, filter, pinnable, width, order }, isFirst, isLast, isSelected, isDefaultPinned, onColumnSort, columnsSorting, onColumnPin, isPinnable, lastColumnId, onColumnClick, pinnedColumns, isColumnPinned, }: TableCellProps): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
declare const _default: import("react").MemoExoticComponent<typeof TableCell>;
|
|
13
13
|
export default _default;
|
|
@@ -3,15 +3,15 @@ import { memo, useCallback, useMemo, useState } from 'react';
|
|
|
3
3
|
import Box from '@mui/material/Box';
|
|
4
4
|
import { pinIcon, unpinIcon } from '../../../../../constants/index.js';
|
|
5
5
|
import ColumnFilter from '../../../components/ColumnFilter';
|
|
6
|
-
import { StyledCell } from '../../../style';
|
|
6
|
+
import { StyledCell } from '../../../components/style';
|
|
7
7
|
import { PinIconContainer, HeaderText } from '../../style';
|
|
8
|
-
import ColumnSort from '../../../../
|
|
9
|
-
function TableCell({ column: { header, id, align, headerStyle, sortable, filter, pinnable, width, order }, isFirst, isLast, isSelected, isDefaultPinned, onColumnSort, columnsSorting, onColumnPin, isPinnable, lastColumnId, onColumnClick, pinnedColumns, }) {
|
|
8
|
+
import ColumnSort from '../../../../VirtualTables/components/ColumnSort';
|
|
9
|
+
function TableCell({ column: { header, id, align, headerStyle, sortable, filter, pinnable, width, order }, isFirst, isLast, isSelected, isDefaultPinned, onColumnSort, columnsSorting, onColumnPin, isPinnable, lastColumnId, onColumnClick, pinnedColumns, isColumnPinned, }) {
|
|
10
10
|
const [columnFilterEl, setColumnFilterEl] = useState(null);
|
|
11
|
-
const
|
|
12
|
-
const isPinned = useMemo(() =>
|
|
11
|
+
const checkIsPinnedFast = useCallback((columnId) => (isColumnPinned ? isColumnPinned(columnId) : pinnedColumns === null || pinnedColumns === void 0 ? void 0 : pinnedColumns.includes(columnId)), [isColumnPinned, pinnedColumns]);
|
|
12
|
+
const isPinned = useMemo(() => checkIsPinnedFast(id), [id, checkIsPinnedFast]);
|
|
13
13
|
const handlePinClick = (columnId) => {
|
|
14
|
-
if (
|
|
14
|
+
if (checkIsPinnedFast(columnId)) {
|
|
15
15
|
onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId, 'unpin');
|
|
16
16
|
}
|
|
17
17
|
else {
|
|
@@ -26,15 +26,7 @@ function TableCell({ column: { header, id, align, headerStyle, sortable, filter,
|
|
|
26
26
|
return (_jsxs(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, onClick: (event) => {
|
|
27
27
|
onColumnClick === null || onColumnClick === void 0 ? void 0 : onColumnClick(id, event);
|
|
28
28
|
setColumnFilterEl(event.currentTarget);
|
|
29
|
-
}, 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 ? '
|
|
30
|
-
content: '""',
|
|
31
|
-
border: isSelected ? '1px solid #1F88D0' : '1px solid transparent',
|
|
32
|
-
position: 'absolute',
|
|
33
|
-
top: 0,
|
|
34
|
-
right: 0,
|
|
35
|
-
left: 0,
|
|
36
|
-
bottom: 0,
|
|
37
|
-
} }, headerStyle)) }, { 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) => {
|
|
29
|
+
}, 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 ? '2px solid #1F88D0' : '1px solid #F2F2F2', backgroundColor: isSelected ? '#F2F2F2' : '#FCFCFC', height: isSelected ? '100%' : 'auto', minHeight: isSelected ? '28px' : 'auto' }, headerStyle)) }, { 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) => {
|
|
38
30
|
onColumnClick === null || onColumnClick === void 0 ? void 0 : onColumnClick(id, event);
|
|
39
31
|
} }))), sortable && (_jsx(ColumnSort, { columnId: id, onColumnSort: onColumnSort, columnsSorting: columnsSorting, onClick: (e) => {
|
|
40
32
|
onColumnClick === null || onColumnClick === void 0 ? void 0 : onColumnClick(id, e);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { TableHeaderProps } from '../../../../
|
|
2
|
+
import { TableHeaderProps } from '../../../../VirtualTables/components/TableHeader/type';
|
|
3
3
|
import { IColumnProps, IVirtualTable } from '../../../../../types/index.js';
|
|
4
4
|
export interface SheetViewTableHeaderProps {
|
|
5
5
|
columns: IColumnProps[];
|
|
@@ -13,4 +13,5 @@ export interface SheetViewTableHeaderProps {
|
|
|
13
13
|
lastColumnId?: string | null;
|
|
14
14
|
selectedColumn?: string | null;
|
|
15
15
|
onColumnClick?: (columnId: string, event: React.MouseEvent) => void;
|
|
16
|
+
isColumnPinned?: (id: string) => boolean;
|
|
16
17
|
}
|
|
@@ -4,7 +4,7 @@ import { backendErrorHandler } from '../../../../utils/index.js';
|
|
|
4
4
|
import EmptyList from '../../components/EmptyList/EmptyList';
|
|
5
5
|
import ErrorList from '../../components/ErrorList/ErrorList';
|
|
6
6
|
import SheetViewTableLoading from './SheetViewTableLoading';
|
|
7
|
-
import { StyledSolidBackground } from '../../style';
|
|
7
|
+
import { StyledSolidBackground } from '../../components/style';
|
|
8
8
|
function SheetViewTableNoData({ error, tableEmpty, isTimeoutError, tableError, tableLoading, orderedColumns, triggerDataRefetch, footerProps, }) {
|
|
9
9
|
let content;
|
|
10
10
|
if (tableLoading) {
|
package/build/components/VirtualTables/SheetViewVirtualTable/components/VirtualListContainer.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ListOnScrollProps, VariableSizeList } from 'react-window';
|
|
3
|
+
import type { IColumnProps, IVirtualTable } from '../../../../types/index.js';
|
|
4
|
+
export interface VirtualListContainerProps {
|
|
5
|
+
columns: IColumnProps[];
|
|
6
|
+
isPinned: boolean;
|
|
7
|
+
fixedWidth?: number;
|
|
8
|
+
listRef: React.RefObject<VariableSizeList>;
|
|
9
|
+
rows: IVirtualTable['rows'];
|
|
10
|
+
rowProps: IVirtualTable['rowProps'];
|
|
11
|
+
totalCount: number;
|
|
12
|
+
rowHeight: number;
|
|
13
|
+
isError: boolean;
|
|
14
|
+
areAllRowsLoaded: boolean;
|
|
15
|
+
isFetchingNextPage: boolean | undefined;
|
|
16
|
+
isLoading: boolean | undefined;
|
|
17
|
+
scrollToIndex: IVirtualTable['scrollToIndex'];
|
|
18
|
+
selectedCell: string | null;
|
|
19
|
+
selectedColumn: string | null;
|
|
20
|
+
onCellClick: (rowIndex: number, columnId: string, event: React.MouseEvent) => void;
|
|
21
|
+
onScroll: (scrollProps: ListOnScrollProps) => void;
|
|
22
|
+
loadMoreItems?: () => Promise<void> | void;
|
|
23
|
+
threshold: number;
|
|
24
|
+
clearBackdropVisibilityTimeout: number;
|
|
25
|
+
areTotalRowsNotFillingHeight: boolean;
|
|
26
|
+
useLoader: boolean;
|
|
27
|
+
setBackdropVisibility?: (visible: boolean) => void;
|
|
28
|
+
}
|
|
29
|
+
declare function VirtualListContainerInner({ columns, isPinned, fixedWidth, listRef, rows, rowProps, totalCount, rowHeight, isError, areAllRowsLoaded, isFetchingNextPage, isLoading, scrollToIndex, selectedCell, selectedColumn, onCellClick, onScroll, loadMoreItems, threshold, clearBackdropVisibilityTimeout, areTotalRowsNotFillingHeight, useLoader, setBackdropVisibility, }: VirtualListContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
declare const _default: import("react").MemoExoticComponent<typeof VirtualListContainerInner>;
|
|
31
|
+
export default _default;
|
package/build/components/VirtualTables/SheetViewVirtualTable/components/VirtualListContainer.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
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, useCallback, useMemo } from 'react';
|
|
12
|
+
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
13
|
+
import InfiniteLoader from 'react-window-infinite-loader';
|
|
14
|
+
import memoize from 'memoize-one';
|
|
15
|
+
import { TABLE_LIST_OVER_SCAN } from '../../../../constants/index.js';
|
|
16
|
+
import { StyledVirtualList } from '../../components/style';
|
|
17
|
+
import ListItemWrapper from '../../components/virtualScroll/ListItemWrapper';
|
|
18
|
+
const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToIndex, lastItemIndex, totalCount, isError, areAllRowsLoaded, isPinned, selectedCell, selectedColumn, onCellClick, containerHeight, rowHeight) => ({
|
|
19
|
+
columns,
|
|
20
|
+
isLoading,
|
|
21
|
+
rows,
|
|
22
|
+
rowProps,
|
|
23
|
+
scrollToIndex,
|
|
24
|
+
totalCount,
|
|
25
|
+
lastItemIndex,
|
|
26
|
+
isError,
|
|
27
|
+
areAllRowsLoaded,
|
|
28
|
+
limit: totalCount,
|
|
29
|
+
newLoadedRowsEndIndex: lastItemIndex,
|
|
30
|
+
isSheetView: true,
|
|
31
|
+
isPinned,
|
|
32
|
+
selectedCell,
|
|
33
|
+
selectedColumn,
|
|
34
|
+
onCellClick,
|
|
35
|
+
containerHeight,
|
|
36
|
+
rowHeight,
|
|
37
|
+
}));
|
|
38
|
+
function VirtualListContainerInner({ columns, isPinned, fixedWidth, listRef, rows, rowProps, totalCount, rowHeight, isError, areAllRowsLoaded, isFetchingNextPage, isLoading, scrollToIndex, selectedCell, selectedColumn, onCellClick, onScroll, loadMoreItems, threshold, clearBackdropVisibilityTimeout, areTotalRowsNotFillingHeight, useLoader, setBackdropVisibility, }) {
|
|
39
|
+
const hasExtraRow = areAllRowsLoaded || !!isFetchingNextPage;
|
|
40
|
+
const itemCount = hasExtraRow ? rows.length + 1 : rows.length;
|
|
41
|
+
const handleOnLoadMoreItems = useCallback(() => __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
if (areAllRowsLoaded)
|
|
43
|
+
return;
|
|
44
|
+
yield (loadMoreItems === null || loadMoreItems === void 0 ? void 0 : loadMoreItems());
|
|
45
|
+
}), [areAllRowsLoaded, loadMoreItems]);
|
|
46
|
+
const listStyle = useMemo(() => ({
|
|
47
|
+
overflowX: isPinned ? 'hidden' : 'auto',
|
|
48
|
+
paddingBottom: isPinned ? 25 : 13,
|
|
49
|
+
backgroundColor: isPinned ? 'transparent' : '#F6F8FACC',
|
|
50
|
+
}), [isPinned]);
|
|
51
|
+
const renderList = (onItemsRendered) => (_jsx(AutoSizer, { children: ({ height, width }) => {
|
|
52
|
+
const getItemSize = (index) => {
|
|
53
|
+
const isFillerRow = areAllRowsLoaded && index === rows.length;
|
|
54
|
+
if (isFillerRow) {
|
|
55
|
+
const usedHeight = rows.length * rowHeight;
|
|
56
|
+
const remainingHeight = height - usedHeight;
|
|
57
|
+
const minimumLastRowHeight = rowHeight * 2;
|
|
58
|
+
return Math.max(remainingHeight, minimumLastRowHeight);
|
|
59
|
+
}
|
|
60
|
+
return rowHeight;
|
|
61
|
+
};
|
|
62
|
+
const lastItemIndex = rows.length - 1;
|
|
63
|
+
const itemData = createItemData(columns, isLoading, rows, rowProps, scrollToIndex, lastItemIndex, totalCount, isError, areAllRowsLoaded, isPinned, selectedCell, selectedColumn, onCellClick, height, rowHeight);
|
|
64
|
+
return (_jsx(StyledVirtualList, Object.assign({ listRef: listRef, height: height, width: fixedWidth || width, itemCount: itemCount, itemSize: getItemSize, itemData: itemData, onItemsRendered: onItemsRendered, overscanCount: TABLE_LIST_OVER_SCAN, setBackdropVisibility: setBackdropVisibility !== null && setBackdropVisibility !== void 0 ? setBackdropVisibility : (() => { }), scrollToIndex: scrollToIndex, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, useIsScrolling: true, onScroll: onScroll, clearBackdropVisibilityTimeout: clearBackdropVisibilityTimeout, style: listStyle }, { children: ListItemWrapper })));
|
|
65
|
+
} }));
|
|
66
|
+
if (!useLoader) {
|
|
67
|
+
return renderList();
|
|
68
|
+
}
|
|
69
|
+
return (_jsx(InfiniteLoader, Object.assign({ isItemLoaded: (index) => index < rows.length, itemCount: itemCount, loadMoreItems: handleOnLoadMoreItems, threshold: threshold }, { children: ({ onItemsRendered }) => renderList(onItemsRendered) })));
|
|
70
|
+
}
|
|
71
|
+
export default memo(VirtualListContainerInner);
|
|
@@ -8,4 +8,8 @@ export declare const usePinnedColumns: (columns: readonly IColumnProps[], isPinn
|
|
|
8
8
|
unpinnedColumnsData: IColumnProps<any>[];
|
|
9
9
|
orderedColumns: IColumnProps<any>[];
|
|
10
10
|
lastColumnId: string | null;
|
|
11
|
+
pinnedStartSet: Set<string>;
|
|
12
|
+
pinnedEndSet: Set<string>;
|
|
13
|
+
pinnedAllSet: Set<string>;
|
|
14
|
+
isColumnPinned: (id: string) => boolean;
|
|
11
15
|
};
|
|
@@ -16,6 +16,7 @@ export const usePinnedColumns = (columns, isPinnable, onColumnPin) => {
|
|
|
16
16
|
}
|
|
17
17
|
return userPinned;
|
|
18
18
|
});
|
|
19
|
+
const shownColumns = useMemo(() => columns.filter((column) => !column.hidden), [columns]);
|
|
19
20
|
const handleColumnPin = useCallback((columnId, position = 'start') => {
|
|
20
21
|
if (!isPinnable)
|
|
21
22
|
return;
|
|
@@ -38,20 +39,25 @@ export const usePinnedColumns = (columns, isPinnable, onColumnPin) => {
|
|
|
38
39
|
const isPinned = newPinnedStart.includes(columnId) || newPinnedEnd.includes(columnId);
|
|
39
40
|
onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId, isPinned);
|
|
40
41
|
}, [pinnedStartColumns, pinnedEndColumns, onColumnPin, isPinnable]);
|
|
41
|
-
const
|
|
42
|
+
const pinnedStartSet = useMemo(() => new Set(pinnedStartColumns), [pinnedStartColumns]);
|
|
43
|
+
const pinnedEndSet = useMemo(() => new Set(pinnedEndColumns), [pinnedEndColumns]);
|
|
44
|
+
const pinnedAllSet = useMemo(() => new Set([...pinnedStartColumns, ...pinnedEndColumns]), [pinnedStartColumns, pinnedEndColumns]);
|
|
45
|
+
const isColumnPinned = useCallback((id) => pinnedStartSet.has(id) || pinnedEndSet.has(id), [pinnedStartSet, pinnedEndSet]);
|
|
46
|
+
const ORDER_FALLBACK = 1000000;
|
|
42
47
|
const { pinnedStartColumnsData, pinnedEndColumnsData, unpinnedColumnsData } = useMemo(() => {
|
|
43
|
-
const start = shownColumns.filter((column) =>
|
|
44
|
-
const end = shownColumns.filter((column) =>
|
|
45
|
-
const unpinned = shownColumns.filter((column) => !
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
48
|
+
const start = shownColumns.filter((column) => pinnedStartSet.has(column.id));
|
|
49
|
+
const end = shownColumns.filter((column) => pinnedEndSet.has(column.id));
|
|
50
|
+
const unpinned = shownColumns.filter((column) => !pinnedStartSet.has(column.id) && !pinnedEndSet.has(column.id));
|
|
51
|
+
const byOrder = (a, b) => { var _a, _b; return ((_a = a === null || a === void 0 ? void 0 : a.order) !== null && _a !== void 0 ? _a : ORDER_FALLBACK) - ((_b = b === null || b === void 0 ? void 0 : b.order) !== null && _b !== void 0 ? _b : ORDER_FALLBACK); };
|
|
52
|
+
const sortedStart = start.sort(byOrder);
|
|
53
|
+
const sortedEnd = end.sort(byOrder);
|
|
54
|
+
const sortedUnpinned = unpinned.sort(byOrder);
|
|
49
55
|
return {
|
|
50
56
|
pinnedStartColumnsData: sortedStart,
|
|
51
57
|
pinnedEndColumnsData: sortedEnd,
|
|
52
58
|
unpinnedColumnsData: sortedUnpinned,
|
|
53
59
|
};
|
|
54
|
-
}, [shownColumns,
|
|
60
|
+
}, [shownColumns, pinnedStartSet, pinnedEndSet]);
|
|
55
61
|
const orderedColumns = useMemo(() => [...pinnedStartColumnsData, ...unpinnedColumnsData, ...pinnedEndColumnsData], [pinnedStartColumnsData, unpinnedColumnsData, pinnedEndColumnsData]);
|
|
56
62
|
const lastColumnId = useMemo(() => {
|
|
57
63
|
const lastCol = orderedColumns[orderedColumns.length - 1];
|
|
@@ -66,5 +72,9 @@ export const usePinnedColumns = (columns, isPinnable, onColumnPin) => {
|
|
|
66
72
|
unpinnedColumnsData,
|
|
67
73
|
orderedColumns,
|
|
68
74
|
lastColumnId,
|
|
75
|
+
pinnedStartSet,
|
|
76
|
+
pinnedEndSet,
|
|
77
|
+
pinnedAllSet,
|
|
78
|
+
isColumnPinned,
|
|
69
79
|
};
|
|
70
80
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function useSelection(): {
|
|
2
|
+
selectedCell: string | null;
|
|
3
|
+
selectedColumn: string | null;
|
|
4
|
+
handleCellClick: (rowIndex: number, columnId: string, event: React.MouseEvent) => void;
|
|
5
|
+
handleColumnClick: (columnId: string, event: React.MouseEvent) => void;
|
|
6
|
+
};
|