@tap-payments/os-micro-frontend-shared 0.1.21 → 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.
- package/build/components/AccountDropdown/style.d.ts +1 -1
- package/build/components/ActivityAreaChart/styles.d.ts +3 -3
- package/build/components/AppServices/style.d.ts +1 -1
- package/build/components/CircularProgressWithLabel/style.d.ts +1 -1
- package/build/components/DockButton/style.d.ts +1 -1
- package/build/components/FileUpload/style.d.ts +2 -2
- package/build/components/FileUploader/style.d.ts +1 -1
- package/build/components/IconWithLabel/style.d.ts +1 -1
- package/build/components/IconsDropdown/style.d.ts +2 -2
- package/build/components/JSONViewer/style.d.ts +1 -1
- package/build/components/LabeledIconDropdown/style.d.ts +3 -3
- package/build/components/MultiSelectWithSearch/style.d.ts +3 -3
- package/build/components/NestedDropdown/styles.d.ts +1 -1
- package/build/components/ProgressBar/style.d.ts +1 -1
- package/build/components/ProgressRing/style.d.ts +2 -2
- package/build/components/RFH/Inputs/SelectWithAccordion/style.d.ts +3 -3
- package/build/components/SelectDropdown/style.d.ts +1 -1
- package/build/components/SelectWithSearch/style.d.ts +3 -3
- package/build/components/StatusBar/StatusBar.js +13 -7
- package/build/components/StatusBar/index.d.ts +1 -1
- package/build/components/StatusBar/type.d.ts +7 -2
- package/build/components/StatusBar/type.js +6 -0
- package/build/components/StatusLabel/style.d.ts +1 -1
- package/build/components/TableCells/CustomCells/DestinationCell/DestinationCell.js +2 -2
- package/build/components/TableHeader/style.d.ts +1 -1
- package/build/components/Timepicker/style.d.ts +2 -2
- package/build/components/ToolbarIcon/ExpandButton/style.d.ts +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable.d.ts +1 -6
- package/build/components/VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable.js +59 -161
- package/build/components/VirtualTables/SheetViewVirtualTable/components/LoadingMainTable.d.ts +5 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/components/LoadingMainTable.js +19 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/components/MainTable.d.ts +5 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/components/MainTable.js +15 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/components/NoDataView.d.ts +5 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/components/NoDataView.js +13 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/components/PinnedColumn.d.ts +5 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/components/PinnedColumn.js +20 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/components/{SheetViewTableHeader/SheetViewTableHeader.d.ts → SheetViewTableHeader.d.ts} +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/components/{SheetViewTableHeader/SheetViewTableHeader.js → SheetViewTableHeader.js} +3 -3
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeaderCell.d.ts +14 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/components/{SheetViewTableHeader/TableCell.js → SheetViewTableHeaderCell.js} +7 -7
- package/build/components/VirtualTables/SheetViewVirtualTable/components/VirtualTable.d.ts +44 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/components/VirtualTable.js +33 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/components/index.d.ts +6 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/components/index.js +6 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/index.d.ts +6 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/index.js +6 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/usePinnedColumnsWidths.d.ts +5 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/usePinnedColumnsWidths.js +15 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableData.d.ts +20 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableData.js +40 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableState.d.ts +15 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableState.js +31 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.d.ts +44 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.js +53 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/index.d.ts +2 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/index.js +2 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/types.d.ts +89 -0
- package/build/components/VirtualTables/components/TableFooter/style.d.ts +2 -2
- package/build/components/VirtualTables/components/TableRow.js +1 -1
- package/build/components/Widget/style.d.ts +1 -1
- package/build/components/WindowAppIcon/style.d.ts +1 -1
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.js +1 -0
- package/build/utils/style.d.ts +9 -0
- package/build/utils/style.js +62 -0
- package/package.json +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/TableCell.d.ts +0 -14
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/index.d.ts +0 -2
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/index.js +0 -2
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/type.d.ts +0 -19
- package/build/components/VirtualTables/utils/getSelectionStyles.d.ts +0 -55
- package/build/components/VirtualTables/utils/getSelectionStyles.js +0 -31
- /package/build/components/VirtualTables/SheetViewVirtualTable/{components/SheetViewTableHeader/type.js → types.js} +0 -0
|
@@ -1,188 +1,86 @@
|
|
|
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
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import memoize from 'memoize-one';
|
|
14
|
-
import InfiniteLoader from 'react-window-infinite-loader';
|
|
15
|
-
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
16
|
-
import { TABLE_THRESHOLD, TABLE_LIST_OVER_SCAN } from '../../../constants/index.js';
|
|
17
|
-
import { useDelayToSetValue } from '../../../hooks/index.js';
|
|
18
|
-
import { isHeightNotFullyFilledByRows, isNotFoundError, isTimeoutError, hasError } from '../../../utils/index.js';
|
|
2
|
+
import { memo, useCallback } from 'react';
|
|
3
|
+
import { TABLE_THRESHOLD } from '../../../constants/index.js';
|
|
19
4
|
import TableFooter from '../components/TableFooter/TableFooter';
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import SheetViewTableHeader from './components/SheetViewTableHeader';
|
|
25
|
-
import { usePinnedColumns } from './hooks/usePinnedColumns';
|
|
26
|
-
import { useSynchronizedScroll } from './hooks/useSynchronizedScroll';
|
|
27
|
-
import SheetViewTableLoading from './components/SheetViewTableLoading';
|
|
28
|
-
const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToIndex, lastItemIndex, totalCount, isError, areAllRowsLoaded, isPinned, selectedCell, selectedColumn, onCellClick, containerHeight, rowHeight) => ({
|
|
29
|
-
columns,
|
|
30
|
-
isLoading,
|
|
31
|
-
rows,
|
|
32
|
-
rowProps,
|
|
33
|
-
scrollToIndex,
|
|
34
|
-
totalCount,
|
|
35
|
-
lastItemIndex,
|
|
36
|
-
isError,
|
|
37
|
-
areAllRowsLoaded,
|
|
38
|
-
limit: totalCount,
|
|
39
|
-
newLoadedRowsEndIndex: lastItemIndex,
|
|
40
|
-
isSheetView: true,
|
|
41
|
-
isPinned,
|
|
42
|
-
selectedCell,
|
|
43
|
-
selectedColumn,
|
|
44
|
-
onCellClick,
|
|
45
|
-
containerHeight,
|
|
46
|
-
rowHeight,
|
|
47
|
-
}));
|
|
5
|
+
import { SheetViewTableContainer } from '../components/style';
|
|
6
|
+
import { SheetViewVirtualTableWrapper } from './style';
|
|
7
|
+
import { usePinnedColumns, useSynchronizedScroll, useTableState, useTableData, useVirtualTableContainer, usePinnedColumnsWidths } from './hooks';
|
|
8
|
+
import { PinnedColumn, MainTable, LoadingMainTable, NoDataView, VirtualTable } from './components';
|
|
48
9
|
function SheetViewVirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader, headerProps, rowProps, footerProps, rowHeight = 28, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded = false, tableBodyStyles, tableTitle, dragControls, onColumnPin, clearBackdropVisibilityTimeout = 100, isPinnable = false, tableMode, }) {
|
|
49
|
-
const
|
|
10
|
+
const { selectedCell, selectedColumn, showBackDrop, setShowBackdrop, handleCellClick, handleColumnClick } = useTableState();
|
|
11
|
+
const { isError, tableLoading, tableError, tableEmpty, hasTimeoutError, showNoDataView, lastItemIndex, areTotalRowsNotFillingHeight, itemsCount, isDelayedFetchingNextPage, } = useTableData({
|
|
12
|
+
rows,
|
|
13
|
+
isLoading,
|
|
14
|
+
error,
|
|
15
|
+
isFetchingNextPage,
|
|
16
|
+
areAllRowsLoaded,
|
|
17
|
+
});
|
|
50
18
|
const { pinnedStartColumns, pinnedEndColumns, handleColumnPin, pinnedStartColumnsData, pinnedEndColumnsData, unpinnedColumnsData, orderedColumns, lastColumnId, } = usePinnedColumns(columns, isPinnable, onColumnPin);
|
|
51
19
|
const { pinnedStartVirtualListRef, scrollableVirtualListRef, pinnedEndVirtualListRef, handleScroll } = useSynchronizedScroll();
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
20
|
+
const { pinnedStartColumnsWidth, pinnedEndColumnsWidth } = usePinnedColumnsWidths(pinnedStartColumnsData, pinnedEndColumnsData);
|
|
21
|
+
const { getItemSize, getItemDataForContainer } = useVirtualTableContainer({
|
|
22
|
+
rowHeight,
|
|
23
|
+
areAllRowsLoaded,
|
|
24
|
+
rows,
|
|
25
|
+
isDelayedFetchingNextPage,
|
|
26
|
+
rowProps,
|
|
27
|
+
scrollToIndex,
|
|
28
|
+
footerProps,
|
|
29
|
+
isError,
|
|
30
|
+
selectedCell,
|
|
31
|
+
selectedColumn,
|
|
32
|
+
handleCellClick,
|
|
33
|
+
});
|
|
66
34
|
const onPointerDown = (e) => {
|
|
67
35
|
dragControls === null || dragControls === void 0 ? void 0 : dragControls.start(e);
|
|
68
36
|
};
|
|
69
|
-
const
|
|
70
|
-
value: isFetchingNextPage,
|
|
71
|
-
delay: 1000,
|
|
72
|
-
});
|
|
73
|
-
const [showBackDrop, setShowBackdrop] = useState(false);
|
|
74
|
-
const isError = hasError(error);
|
|
75
|
-
const tableLoading = isLoading !== null && isLoading !== void 0 ? isLoading : true;
|
|
76
|
-
const tableError = !isLoading && rows.length === 0 && isError && !isNotFoundError(error);
|
|
77
|
-
const tableEmpty = !isLoading && rows.length === 0;
|
|
78
|
-
const hasTimeoutError = isTimeoutError(error);
|
|
79
|
-
const lastItemIndex = rows.length - 1;
|
|
80
|
-
const areTotalRowsNotFillingHeight = isHeightNotFullyFilledByRows(rows.length) && !tableLoading;
|
|
81
|
-
const itemsCount = isDelayedFetchingNextPage || areAllRowsLoaded ? rows.length + 1 : rows.length;
|
|
82
|
-
const createVirtualTableContainer = useCallback((columnsToRender, containerKey, isPinned = false, fixedWidth) => {
|
|
83
|
-
const tableItemsCount = itemsCount;
|
|
84
|
-
const handleOnLoadMoreItems = () => __awaiter(this, void 0, void 0, function* () {
|
|
85
|
-
if (areAllRowsLoaded)
|
|
86
|
-
return;
|
|
87
|
-
yield (loadMoreItems === null || loadMoreItems === void 0 ? void 0 : loadMoreItems());
|
|
88
|
-
});
|
|
37
|
+
const createVirtualTableContainer = useCallback((columnsData, containerKey, isPinned = false, fixedWidth) => {
|
|
89
38
|
const listRef = containerKey === 'pinnedStart' ? pinnedStartVirtualListRef : containerKey === 'pinnedEnd' ? pinnedEndVirtualListRef : scrollableVirtualListRef;
|
|
90
39
|
const handleScrollCallback = (scrollProps) => {
|
|
91
40
|
const source = containerKey === 'pinnedStart' ? 'start' : containerKey === 'pinnedEnd' ? 'end' : 'scrollable';
|
|
92
41
|
handleScroll(scrollProps, source);
|
|
93
42
|
};
|
|
94
|
-
return (_jsx(
|
|
95
|
-
var _a;
|
|
96
|
-
const getItemSize = (index) => {
|
|
97
|
-
const isLastRow = areAllRowsLoaded && index === rows.length;
|
|
98
|
-
if (isLastRow) {
|
|
99
|
-
const usedHeight = rows.length * rowHeight;
|
|
100
|
-
const remainingHeight = height - usedHeight;
|
|
101
|
-
const minimumLastRowHeight = rowHeight * 2;
|
|
102
|
-
return Math.max(remainingHeight, minimumLastRowHeight);
|
|
103
|
-
}
|
|
104
|
-
return rowHeight;
|
|
105
|
-
};
|
|
106
|
-
const commonItemDataParams = [
|
|
107
|
-
isDelayedFetchingNextPage,
|
|
108
|
-
rows,
|
|
109
|
-
rowProps,
|
|
110
|
-
scrollToIndex,
|
|
111
|
-
lastItemIndex,
|
|
112
|
-
(_a = footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount) !== null && _a !== void 0 ? _a : 0,
|
|
113
|
-
isError,
|
|
114
|
-
areAllRowsLoaded,
|
|
115
|
-
];
|
|
116
|
-
const commonItemDataSuffix = [selectedCell, selectedColumn, handleCellClick, height, rowHeight];
|
|
117
|
-
const getItemDataForContainer = (columnsData, isPinnedColumn) => createItemData(columnsData, ...commonItemDataParams, isPinnedColumn, ...commonItemDataSuffix);
|
|
118
|
-
const currentItemData = containerKey === 'pinnedStart'
|
|
119
|
-
? getItemDataForContainer(pinnedStartColumnsData, true)
|
|
120
|
-
: containerKey === 'pinnedEnd'
|
|
121
|
-
? getItemDataForContainer(pinnedEndColumnsData, true)
|
|
122
|
-
: getItemDataForContainer(unpinnedColumnsData, false);
|
|
123
|
-
return (_jsx(StyledVirtualList, Object.assign({ listRef: listRef, height: height, width: fixedWidth || width, itemCount: tableItemsCount, itemSize: getItemSize, itemData: currentItemData, onItemsRendered: onItemsRendered, overscanCount: TABLE_LIST_OVER_SCAN, setBackdropVisibility: setShowBackdrop, scrollToIndex: scrollToIndex, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, useIsScrolling: true, onScroll: handleScrollCallback, clearBackdropVisibilityTimeout: clearBackdropVisibilityTimeout, style: {
|
|
124
|
-
overflowX: isPinned ? 'hidden' : 'auto',
|
|
125
|
-
paddingBottom: isPinned ? '25px' : '13px',
|
|
126
|
-
backgroundColor: isPinned ? 'transparent' : '#F6F8FACC',
|
|
127
|
-
} }, { children: ListItemWrapper })));
|
|
128
|
-
} })) })));
|
|
43
|
+
return (_jsx(VirtualTable, { columnsData: columnsData, itemCount: itemsCount, lastItemIndex: lastItemIndex, areAllRowsLoaded: areAllRowsLoaded, loadMoreItems: loadMoreItems, threshold: threshold, getItemSize: getItemSize, getItemData: getItemDataForContainer, isPinned: isPinned, fixedWidth: fixedWidth, scrollToIndex: scrollToIndex, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, clearBackdropVisibilityTimeout: clearBackdropVisibilityTimeout, onScroll: handleScrollCallback, setBackdropVisibility: setShowBackdrop, listRef: listRef }));
|
|
129
44
|
}, [
|
|
130
45
|
itemsCount,
|
|
46
|
+
lastItemIndex,
|
|
131
47
|
areAllRowsLoaded,
|
|
132
48
|
loadMoreItems,
|
|
133
49
|
threshold,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
pinnedStartColumnsData,
|
|
137
|
-
pinnedEndColumnsData,
|
|
138
|
-
unpinnedColumnsData,
|
|
139
|
-
isDelayedFetchingNextPage,
|
|
140
|
-
rowProps,
|
|
50
|
+
getItemSize,
|
|
51
|
+
getItemDataForContainer,
|
|
141
52
|
scrollToIndex,
|
|
142
|
-
lastItemIndex,
|
|
143
|
-
footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount,
|
|
144
|
-
isError,
|
|
145
53
|
areTotalRowsNotFillingHeight,
|
|
146
|
-
selectedCell,
|
|
147
|
-
selectedColumn,
|
|
148
|
-
handleCellClick,
|
|
149
|
-
handleScroll,
|
|
150
54
|
clearBackdropVisibilityTimeout,
|
|
151
|
-
|
|
55
|
+
handleScroll,
|
|
56
|
+
setShowBackdrop,
|
|
152
57
|
pinnedStartVirtualListRef,
|
|
58
|
+
pinnedEndVirtualListRef,
|
|
153
59
|
scrollableVirtualListRef,
|
|
154
|
-
theme.palette.background.default,
|
|
155
60
|
]);
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
61
|
+
const baseCommonProps = {
|
|
62
|
+
showHeader,
|
|
63
|
+
columnsSorting,
|
|
64
|
+
onColumnSort,
|
|
65
|
+
headerProps,
|
|
66
|
+
showBackDrop,
|
|
67
|
+
onColumnPin: handleColumnPin,
|
|
68
|
+
isPinnable,
|
|
69
|
+
lastColumnId,
|
|
70
|
+
selectedColumn,
|
|
71
|
+
onColumnClick: handleColumnClick,
|
|
72
|
+
tableTitle,
|
|
73
|
+
areAllRowsLoaded,
|
|
74
|
+
isFetchingNextPage,
|
|
75
|
+
scrollToIndex,
|
|
76
|
+
isLoading,
|
|
77
|
+
isError,
|
|
78
|
+
tableMode,
|
|
79
|
+
showNoDataView,
|
|
80
|
+
tableBodyStyles,
|
|
175
81
|
};
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
} }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_LoadingStyledBox", hidePadding: true, className: "list-wrapper", sx: {
|
|
180
|
-
height: '100%',
|
|
181
|
-
display: 'flex',
|
|
182
|
-
flexDirection: 'column',
|
|
183
|
-
} }, { children: _jsx(SheetViewTableLoading, { "data-testid": "SheetViewVirtualTable_TableLoading", columns: unpinnedColumnsData, isLoading: true, isPinned: false }) })) }))] })) })) })), renderPinnedColumn('end', pinnedEndColumnsData, pinnedEndColumnsWidth, [...pinnedStartColumns, ...pinnedEndColumns])] })) : (_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: handleColumnPin, isPinnable: false, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: handleColumnClick }) })), _jsx(TableNoData, { error: error, tableEmpty: tableEmpty, isTimeoutError: hasTimeoutError, tableError: tableError, tableLoading: tableLoading, orderedColumns: orderedColumns, triggerDataRefetch: triggerDataRefetch, footerProps: footerProps })] })) })))) : (_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-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: handleColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: handleColumnClick, tablePosition: "scrollable", hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0 }) })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
|
184
|
-
width: '100%',
|
|
185
|
-
minWidth: 'fit-content',
|
|
186
|
-
} }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_ScrollableStyledBox", hidePadding: true, className: "list-wrapper" }, { children: createVirtualTableContainer(unpinnedColumnsData, 'scrollable', false) })) }))] })) })) })), renderPinnedColumn('end', pinnedEndColumnsData, pinnedEndColumnsWidth, [...pinnedStartColumns, ...pinnedEndColumns])] })) }), _jsx(TableFooter, Object.assign({ "data-testid": "SheetViewVirtualTable_TableFooter", showSeparator: true, showBackDrop: showBackDrop, onPointerDown: onPointerDown }, footerProps))] }));
|
|
82
|
+
const commonPropsWithTableStates = Object.assign(Object.assign({}, baseCommonProps), { hasTimeoutError,
|
|
83
|
+
tableLoading });
|
|
84
|
+
return (_jsxs(_Fragment, { children: [_jsx(SheetViewTableContainer, { children: showNoDataView ? (tableLoading ? (_jsxs(SheetViewVirtualTableWrapper, { children: [pinnedStartColumnsData.length > 0 && (_jsx(PinnedColumn, Object.assign({ position: "start", columnsData: pinnedStartColumnsData, columnsWidth: pinnedStartColumnsWidth, pinnedColumnsList: pinnedStartColumns, hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0, createVirtualTableContainer: createVirtualTableContainer }, commonPropsWithTableStates))), _jsx(LoadingMainTable, Object.assign({ hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0, unpinnedColumnsData: unpinnedColumnsData, pinnedStartColumns: pinnedStartColumns, pinnedEndColumns: pinnedEndColumns }, commonPropsWithTableStates)), pinnedEndColumnsData.length > 0 && (_jsx(PinnedColumn, Object.assign({ position: "end", columnsData: pinnedEndColumnsData, columnsWidth: pinnedEndColumnsWidth, pinnedColumnsList: [...pinnedStartColumns, ...pinnedEndColumns], hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0, createVirtualTableContainer: createVirtualTableContainer }, commonPropsWithTableStates)))] })) : (_jsx(NoDataView, Object.assign({ tableLoading: tableLoading, tableError: tableError, tableEmpty: tableEmpty, hasTimeoutError: hasTimeoutError, orderedColumns: orderedColumns, error: error, triggerDataRefetch: triggerDataRefetch, footerProps: footerProps }, baseCommonProps)))) : (_jsxs(SheetViewVirtualTableWrapper, { children: [pinnedStartColumnsData.length > 0 && (_jsx(PinnedColumn, Object.assign({ position: "start", columnsData: pinnedStartColumnsData, columnsWidth: pinnedStartColumnsWidth, pinnedColumnsList: pinnedStartColumns, hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0, createVirtualTableContainer: createVirtualTableContainer }, commonPropsWithTableStates))), _jsx(MainTable, Object.assign({ hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0, unpinnedColumnsData: unpinnedColumnsData, pinnedStartColumns: pinnedStartColumns, pinnedEndColumns: pinnedEndColumns, createVirtualTableContainer: createVirtualTableContainer }, commonPropsWithTableStates)), pinnedEndColumnsData.length > 0 && (_jsx(PinnedColumn, Object.assign({ position: "end", columnsData: pinnedEndColumnsData, columnsWidth: pinnedEndColumnsWidth, pinnedColumnsList: [...pinnedStartColumns, ...pinnedEndColumns], hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0, createVirtualTableContainer: createVirtualTableContainer }, commonPropsWithTableStates)))] })) }), _jsx(TableFooter, Object.assign({ "data-testid": "SheetViewVirtualTable_TableFooter", showSeparator: true, showBackDrop: showBackDrop, onPointerDown: onPointerDown }, footerProps))] }));
|
|
187
85
|
}
|
|
188
86
|
export default memo(SheetViewVirtualTable);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { LoadingMainTableProps } from '../types';
|
|
3
|
+
declare 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, }: LoadingMainTableProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare const _default: import("react").MemoExoticComponent<typeof LoadingMainTable>;
|
|
5
|
+
export default _default;
|
|
@@ -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 '
|
|
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 '
|
|
4
|
-
import
|
|
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(
|
|
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;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useCallback, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import Box from '@mui/material/Box';
|
|
4
|
-
import { pinIcon, unpinIcon } from '
|
|
5
|
-
import ColumnFilter from '
|
|
6
|
-
import { StyledCell, TableHeaderInner } from '
|
|
7
|
-
import { PinIconContainer, HeaderText } from '
|
|
8
|
-
import ColumnSort from '
|
|
9
|
-
function
|
|
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
10
|
const [columnFilterEl, setColumnFilterEl] = useState(null);
|
|
11
11
|
const cellRef = useRef(null);
|
|
12
12
|
const checkIsPanned = useCallback((columnId) => pinnedColumns === null || pinnedColumns === void 0 ? void 0 : pinnedColumns.includes(columnId), [pinnedColumns]);
|
|
@@ -46,4 +46,4 @@ function TableCell({ column: { header, id, align, headerStyle, sortable, filter,
|
|
|
46
46
|
handlePinClick(id);
|
|
47
47
|
}, title: isPinned ? 'Unpin column' : 'Pin column' }, { children: _jsx("img", { src: isPinned ? unpinIcon : pinIcon, alt: "pin-icon" }) })))] })) })));
|
|
48
48
|
}
|
|
49
|
-
export default memo(
|
|
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,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
|
+
};
|