@tap-payments/os-micro-frontend-shared 0.1.1-test.52 → 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/LICENSE +21 -21
- package/README.md +12 -12
- package/build/components/VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable.js +43 -150
- 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/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/SheetViewTableHeader.d.ts +2 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/SheetViewTableHeader.js +2 -2
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/TableCell.d.ts +2 -2
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/TableCell.js +4 -4
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/type.d.ts +1 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/components/VirtualListContainer.d.ts +31 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/components/VirtualListContainer.js +71 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/usePinnedColumns.d.ts +4 -0
- package/build/components/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/VirtualTables/SheetViewVirtualTable/utils.d.ts +2 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/utils.js +6 -0
- package/build/components/VirtualTables/components/TableRow.js +1 -1
- package/build/constants/table/cell/chargeTableCellWidth.d.ts +2 -42
- package/build/constants/table/cell/chargeTableCellWidth.js +2 -42
- package/package.json +2 -2
- /package/build/components/VirtualTables/{utils/getSelectionStyles.d.ts → components/utils.d.ts} +0 -0
- /package/build/components/VirtualTables/{utils/getSelectionStyles.js → components/utils.js} +0 -0
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Tap Payments
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Tap Payments
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# os-micro-frontend-shared
|
|
2
|
-
|
|
3
|
-
## Publishing Workflow
|
|
4
|
-
|
|
5
|
-
1. Update version in package.json
|
|
6
|
-
2. Commit changes
|
|
7
|
-
3. Create and push a tag:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm version patch # or minor, major
|
|
11
|
-
git push origin main --tags
|
|
12
|
-
```
|
|
1
|
+
# os-micro-frontend-shared
|
|
2
|
+
|
|
3
|
+
## Publishing Workflow
|
|
4
|
+
|
|
5
|
+
1. Update version in package.json
|
|
6
|
+
2. Commit changes
|
|
7
|
+
3. Create and push a tag:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm version patch # or minor, major
|
|
11
|
+
git push origin main --tags
|
|
12
|
+
```
|
|
@@ -10,185 +10,78 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
11
|
import { useMemo, memo, useState, useCallback } from 'react';
|
|
12
12
|
import { useTheme } from '@mui/material/styles';
|
|
13
|
-
import
|
|
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';
|
|
13
|
+
import { TABLE_THRESHOLD } from '../../../constants/index.js';
|
|
17
14
|
import { useDelayToSetValue } from '../../../hooks/index.js';
|
|
18
|
-
import { isHeightNotFullyFilledByRows, isNotFoundError, isTimeoutError, hasError } from '../../../utils/index.js';
|
|
19
15
|
import TableFooter from '../components/TableFooter/TableFooter';
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
22
|
-
import ListItemWrapper from '../components/virtualScroll/ListItemWrapper';
|
|
23
|
-
import { StyledBox, StyledTableBox, StyledVirtualList, TableContainer, TableWrapper } from '../components/style';
|
|
24
|
-
import { SheetViewVirtualTableWrapper, PinnedStartColumnWrapper, PinnedEndColumnWrapper, MainTableWrapper, UnpinnedTableHeaderWrapper } from './style';
|
|
16
|
+
import { StyledBox, StyledTableBox, TableContainer, TableWrapper } from '../components/style';
|
|
17
|
+
import { SheetViewVirtualTableWrapper, MainTableWrapper, UnpinnedTableHeaderWrapper } from './style';
|
|
25
18
|
import SheetViewTableHeader from './components/SheetViewTableHeader';
|
|
26
19
|
import { usePinnedColumns } from './hooks/usePinnedColumns';
|
|
27
20
|
import { useSynchronizedScroll } from './hooks/useSynchronizedScroll';
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
}));
|
|
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';
|
|
48
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);
|
|
49
30
|
const theme = useTheme();
|
|
50
|
-
const { pinnedStartColumns, pinnedEndColumns, handleColumnPin, pinnedStartColumnsData, pinnedEndColumnsData, unpinnedColumnsData, orderedColumns, lastColumnId, } = usePinnedColumns(columns, isPinnable, onColumnPin);
|
|
31
|
+
const { pinnedStartColumns, pinnedEndColumns, handleColumnPin, pinnedStartColumnsData, pinnedEndColumnsData, unpinnedColumnsData, orderedColumns, lastColumnId, isColumnPinned, } = usePinnedColumns(columns, isPinnable, onColumnPin);
|
|
51
32
|
const { pinnedStartVirtualListRef, scrollableVirtualListRef, pinnedEndVirtualListRef, handleScroll } = useSynchronizedScroll();
|
|
52
|
-
const
|
|
53
|
-
const [selectedColumn, setSelectedColumn] = useState(null);
|
|
54
|
-
const handleCellClick = useCallback((rowIndex, columnId, event) => {
|
|
55
|
-
event.stopPropagation();
|
|
56
|
-
const cellKey = `${rowIndex}-${columnId}`;
|
|
57
|
-
setSelectedCell((prev) => (prev === cellKey ? null : cellKey));
|
|
58
|
-
setSelectedColumn(null);
|
|
59
|
-
}, []);
|
|
60
|
-
const handleColumnClick = useCallback((columnId, event) => {
|
|
61
|
-
event.stopPropagation();
|
|
62
|
-
setSelectedColumn((prev) => (prev === columnId ? null : columnId));
|
|
63
|
-
setSelectedCell(null);
|
|
64
|
-
}, []);
|
|
65
|
-
const onPointerDown = (e) => {
|
|
66
|
-
dragControls === null || dragControls === void 0 ? void 0 : dragControls.start(e);
|
|
67
|
-
};
|
|
33
|
+
const { selectedCell, selectedColumn, handleCellClick, handleColumnClick } = useSelection();
|
|
68
34
|
const isDelayedFetchingNextPage = useDelayToSetValue({
|
|
69
35
|
value: isFetchingNextPage,
|
|
70
36
|
delay: 1000,
|
|
71
37
|
});
|
|
72
|
-
const
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
const
|
|
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]);
|
|
81
55
|
const createVirtualTableContainer = useCallback((columnsToRender, containerKey, isPinned = false, fixedWidth) => {
|
|
82
|
-
|
|
83
|
-
const handleOnLoadMoreItems = () => __awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
if (areAllRowsLoaded)
|
|
85
|
-
return;
|
|
86
|
-
yield (loadMoreItems === null || loadMoreItems === void 0 ? void 0 : loadMoreItems());
|
|
87
|
-
});
|
|
56
|
+
var _a;
|
|
88
57
|
const listRef = containerKey === 'pinnedStart' ? pinnedStartVirtualListRef : containerKey === 'pinnedEnd' ? pinnedEndVirtualListRef : scrollableVirtualListRef;
|
|
89
|
-
|
|
90
|
-
const source = containerKey === 'pinnedStart' ? 'start' : containerKey === 'pinnedEnd' ? 'end' : 'scrollable';
|
|
91
|
-
handleScroll(scrollProps, source);
|
|
92
|
-
};
|
|
93
|
-
return (_jsx(InfiniteLoader, Object.assign({ isItemLoaded: (index) => index !== lastItemIndex, itemCount: tableItemsCount, loadMoreItems: handleOnLoadMoreItems, threshold: threshold }, { children: ({ onItemsRendered }) => (_jsx(AutoSizer, { children: ({ height, width }) => {
|
|
94
|
-
var _a;
|
|
95
|
-
const getItemSize = (index) => {
|
|
96
|
-
const isLastRow = areAllRowsLoaded && index === rows.length;
|
|
97
|
-
if (isLastRow) {
|
|
98
|
-
const usedHeight = rows.length * rowHeight;
|
|
99
|
-
const remainingHeight = height - usedHeight;
|
|
100
|
-
const minimumLastRowHeight = rowHeight * 2;
|
|
101
|
-
return Math.max(remainingHeight, minimumLastRowHeight);
|
|
102
|
-
}
|
|
103
|
-
return rowHeight;
|
|
104
|
-
};
|
|
105
|
-
const commonItemDataParams = [
|
|
106
|
-
isDelayedFetchingNextPage,
|
|
107
|
-
rows,
|
|
108
|
-
rowProps,
|
|
109
|
-
scrollToIndex,
|
|
110
|
-
lastItemIndex,
|
|
111
|
-
(_a = footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount) !== null && _a !== void 0 ? _a : 0,
|
|
112
|
-
isError,
|
|
113
|
-
areAllRowsLoaded,
|
|
114
|
-
];
|
|
115
|
-
const commonItemDataSuffix = [selectedCell, selectedColumn, handleCellClick, height, rowHeight];
|
|
116
|
-
const getItemDataForContainer = (columnsData, isPinnedColumn) => createItemData(columnsData, ...commonItemDataParams, isPinnedColumn, ...commonItemDataSuffix);
|
|
117
|
-
const currentItemData = containerKey === 'pinnedStart'
|
|
118
|
-
? getItemDataForContainer(pinnedStartColumnsData, true)
|
|
119
|
-
: containerKey === 'pinnedEnd'
|
|
120
|
-
? getItemDataForContainer(pinnedEndColumnsData, true)
|
|
121
|
-
: getItemDataForContainer(unpinnedColumnsData, false);
|
|
122
|
-
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: {
|
|
123
|
-
overflowX: isPinned ? 'hidden' : 'auto',
|
|
124
|
-
paddingBottom: isPinned ? '25px' : '13px',
|
|
125
|
-
backgroundColor: isPinned ? 'transparent' : '#F6F8FACC',
|
|
126
|
-
} }, { children: ListItemWrapper })));
|
|
127
|
-
} })) })));
|
|
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 }));
|
|
128
59
|
}, [
|
|
129
|
-
itemsCount,
|
|
130
|
-
areAllRowsLoaded,
|
|
131
|
-
loadMoreItems,
|
|
132
|
-
threshold,
|
|
133
|
-
rowHeight,
|
|
134
60
|
rows,
|
|
135
|
-
pinnedStartColumnsData,
|
|
136
|
-
pinnedEndColumnsData,
|
|
137
|
-
unpinnedColumnsData,
|
|
138
|
-
isDelayedFetchingNextPage,
|
|
139
61
|
rowProps,
|
|
140
|
-
scrollToIndex,
|
|
141
|
-
lastItemIndex,
|
|
142
62
|
footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount,
|
|
63
|
+
rowHeight,
|
|
143
64
|
isError,
|
|
144
65
|
areTotalRowsNotFillingHeight,
|
|
66
|
+
areAllRowsLoaded,
|
|
67
|
+
isDelayedFetchingNextPage,
|
|
68
|
+
isLoading,
|
|
69
|
+
scrollToIndex,
|
|
145
70
|
selectedCell,
|
|
146
71
|
selectedColumn,
|
|
147
72
|
handleCellClick,
|
|
148
|
-
|
|
73
|
+
onScrollByKey,
|
|
74
|
+
onLoadMoreItems,
|
|
75
|
+
threshold,
|
|
149
76
|
clearBackdropVisibilityTimeout,
|
|
150
77
|
pinnedEndVirtualListRef,
|
|
151
78
|
pinnedStartVirtualListRef,
|
|
152
79
|
scrollableVirtualListRef,
|
|
153
|
-
theme.palette.background.default,
|
|
154
80
|
]);
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
const width = typeof col.width === 'string' ? parseInt(col.width) : col.width || 100;
|
|
158
|
-
return acc + width;
|
|
159
|
-
}, 0.2), [pinnedStartColumnsData]);
|
|
160
|
-
const pinnedEndColumnsWidth = useMemo(() => pinnedEndColumnsData.reduce((acc, col) => {
|
|
161
|
-
const width = typeof col.width === 'string' ? parseInt(col.width) : col.width || 100;
|
|
162
|
-
return acc + width;
|
|
163
|
-
}, 0.2), [pinnedEndColumnsData]);
|
|
164
|
-
const renderPinnedColumn = (position, columnsData, columnsWidth, pinnedColumnsList) => {
|
|
165
|
-
const Wrapper = position === 'start' ? PinnedStartColumnWrapper : PinnedEndColumnWrapper;
|
|
166
|
-
const containerKey = position === 'start' ? 'pinnedStart' : 'pinnedEnd';
|
|
167
|
-
if (columnsData.length === 0)
|
|
168
|
-
return null;
|
|
169
|
-
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-show-background-color": !!showBackgroundColor, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showBackgroundColor: showBackgroundColor, showNoDataView: showNoDataView }, { children: [showHeader && (_jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_PinnedTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: columnsData, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: pinnedColumnsList, onColumnPin: handleColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: handleColumnClick })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
|
170
|
-
width: '100%',
|
|
171
|
-
minWidth: 'fit-content',
|
|
172
|
-
overflowX: 'hidden',
|
|
173
|
-
} }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_PinnedStyledBox", hidePadding: true, className: "list-wrapper" }, { children: createVirtualTableContainer(columnsData, containerKey, true, columnsWidth) })) }))] })) }));
|
|
174
|
-
};
|
|
175
|
-
return (_jsxs(_Fragment, { children: [_jsx(TableContainer, { children: showNoDataView ? (tableLoading ? (_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-show-background-color": !!showBackgroundColor, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showBackgroundColor: showBackgroundColor, showNoDataView: showNoDataView, scrollable: true, sx: {
|
|
176
|
-
marginLeft: '28px',
|
|
177
|
-
maxHeight: 'calc(100vh - 300px)',
|
|
178
|
-
overflow: 'auto',
|
|
179
|
-
} }, { 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: [], onColumnPin: handleColumnPin, isPinnable: false, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: handleColumnClick }) })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_LoadingTableWrapper", sx: {
|
|
180
|
-
width: '100%',
|
|
181
|
-
minWidth: 'fit-content',
|
|
182
|
-
height: 'auto',
|
|
183
|
-
display: 'flex',
|
|
184
|
-
flexDirection: 'column',
|
|
185
|
-
} }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_LoadingStyledBox", hidePadding: true, className: "list-wrapper", sx: {
|
|
186
|
-
height: 'auto',
|
|
187
|
-
display: 'flex',
|
|
188
|
-
flexDirection: 'column',
|
|
189
|
-
} }, { children: _jsx(SheetViewTableNoData, { error: error, tableEmpty: tableEmpty, isTimeoutError: hasTimeoutError, tableError: tableError, tableLoading: tableLoading, orderedColumns: orderedColumns, triggerDataRefetch: triggerDataRefetch, footerProps: footerProps }) })) }))] })) }))) : (_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 }, { 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: 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-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: [...pinnedStartColumns, ...pinnedEndColumns], onColumnPin: handleColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: handleColumnClick }) })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
|
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: {
|
|
190
83
|
width: '100%',
|
|
191
84
|
minWidth: 'fit-content',
|
|
192
|
-
} }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_ScrollableStyledBox", hidePadding: true, className: "list-wrapper" }, { children: createVirtualTableContainer(unpinnedColumnsData, 'scrollable', false) })) }))] })) })) })), renderPinnedColumn('end', pinnedEndColumnsData, pinnedEndColumnsWidth,
|
|
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))] }));
|
|
193
86
|
}
|
|
194
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;
|
|
@@ -6,12 +6,12 @@ import ColumnFilter from '../../../components/ColumnFilter';
|
|
|
6
6
|
import { StyledCell } from '../../../components/style';
|
|
7
7
|
import { PinIconContainer, HeaderText } from '../../style';
|
|
8
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, }) {
|
|
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 {
|
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
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
|
+
export function useSelection() {
|
|
3
|
+
const [selectedCell, setSelectedCell] = useState(null);
|
|
4
|
+
const [selectedColumn, setSelectedColumn] = useState(null);
|
|
5
|
+
const handleCellClick = useCallback((rowIndex, columnId, event) => {
|
|
6
|
+
event.stopPropagation();
|
|
7
|
+
const cellKey = `${rowIndex}-${columnId}`;
|
|
8
|
+
setSelectedCell((prev) => (prev === cellKey ? null : cellKey));
|
|
9
|
+
setSelectedColumn(null);
|
|
10
|
+
}, []);
|
|
11
|
+
const handleColumnClick = useCallback((columnId, event) => {
|
|
12
|
+
event.stopPropagation();
|
|
13
|
+
setSelectedColumn((prev) => (prev === columnId ? null : columnId));
|
|
14
|
+
setSelectedCell(null);
|
|
15
|
+
}, []);
|
|
16
|
+
return { selectedCell, selectedColumn, handleCellClick, handleColumnClick };
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function useTableDisplayState(rowsLength: number, isLoading?: boolean, error?: unknown): {
|
|
2
|
+
isError: boolean;
|
|
3
|
+
tableLoading: boolean;
|
|
4
|
+
tableError: boolean;
|
|
5
|
+
tableEmpty: boolean;
|
|
6
|
+
hasTimeoutError: boolean;
|
|
7
|
+
areTotalRowsNotFillingHeight: boolean;
|
|
8
|
+
showNoDataView: boolean;
|
|
9
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { isHeightNotFullyFilledByRows, isNotFoundError, isTimeoutError, hasError } from '../../../../utils/index.js';
|
|
2
|
+
export function useTableDisplayState(rowsLength, isLoading, error) {
|
|
3
|
+
var _a;
|
|
4
|
+
const isError = hasError((_a = error) !== null && _a !== void 0 ? _a : null);
|
|
5
|
+
const tableLoading = isLoading !== null && isLoading !== void 0 ? isLoading : true;
|
|
6
|
+
const tableError = !isLoading && rowsLength === 0 && isError && !isNotFoundError(error);
|
|
7
|
+
const tableEmpty = !isLoading && rowsLength === 0;
|
|
8
|
+
const hasTimeoutError = isTimeoutError(error);
|
|
9
|
+
const areTotalRowsNotFillingHeight = isHeightNotFullyFilledByRows(rowsLength) && !tableLoading;
|
|
10
|
+
const showNoDataView = tableLoading || tableError || tableEmpty || hasTimeoutError;
|
|
11
|
+
return {
|
|
12
|
+
isError,
|
|
13
|
+
tableLoading,
|
|
14
|
+
tableError,
|
|
15
|
+
tableEmpty,
|
|
16
|
+
hasTimeoutError,
|
|
17
|
+
areTotalRowsNotFillingHeight,
|
|
18
|
+
showNoDataView,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -3,7 +3,7 @@ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { memo, useMemo } from 'react';
|
|
4
4
|
import { areEqual } from 'react-window';
|
|
5
5
|
import { StyledCell, StyledTableRow } from './style';
|
|
6
|
-
import { getSelectionStyles } from '
|
|
6
|
+
import { getSelectionStyles } from './utils';
|
|
7
7
|
function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = null, selectedColumn = null, onCellClick, isLastRow = false, }) {
|
|
8
8
|
const renderCell = (column) => {
|
|
9
9
|
const { render, format, selector } = column;
|
|
@@ -52,48 +52,8 @@ export declare const chargeTableCellWidth: {
|
|
|
52
52
|
readonly payment_agreement: {
|
|
53
53
|
readonly default: "50px";
|
|
54
54
|
readonly text: "150px";
|
|
55
|
-
readonly sheet: "165px";
|
|
56
|
-
};
|
|
57
|
-
readonly payment_initiated: {
|
|
58
|
-
readonly default: "150px";
|
|
59
|
-
readonly text: "150px";
|
|
60
55
|
readonly sheet: "150px";
|
|
61
56
|
};
|
|
62
|
-
readonly payment_issuer: {
|
|
63
|
-
readonly default: "150px";
|
|
64
|
-
readonly text: "150px";
|
|
65
|
-
readonly sheet: "350px";
|
|
66
|
-
};
|
|
67
|
-
readonly payment_method: {
|
|
68
|
-
readonly default: "150px";
|
|
69
|
-
readonly text: "150px";
|
|
70
|
-
readonly sheet: "145px";
|
|
71
|
-
};
|
|
72
|
-
readonly payment_type: {
|
|
73
|
-
readonly default: "150px";
|
|
74
|
-
readonly text: "150px";
|
|
75
|
-
readonly sheet: "120px";
|
|
76
|
-
};
|
|
77
|
-
readonly payment_schema: {
|
|
78
|
-
readonly default: "150px";
|
|
79
|
-
readonly text: "150px";
|
|
80
|
-
readonly sheet: "145px";
|
|
81
|
-
};
|
|
82
|
-
readonly auth_status: {
|
|
83
|
-
readonly default: "150px";
|
|
84
|
-
readonly text: "150px";
|
|
85
|
-
readonly sheet: "165px";
|
|
86
|
-
};
|
|
87
|
-
readonly auth_type: {
|
|
88
|
-
readonly default: "150px";
|
|
89
|
-
readonly text: "150px";
|
|
90
|
-
readonly sheet: "155px";
|
|
91
|
-
};
|
|
92
|
-
readonly eci: {
|
|
93
|
-
readonly default: "150px";
|
|
94
|
-
readonly text: "150px";
|
|
95
|
-
readonly sheet: "90px";
|
|
96
|
-
};
|
|
97
57
|
readonly amount: {
|
|
98
58
|
readonly default: "170px";
|
|
99
59
|
readonly text: "195px";
|
|
@@ -187,7 +147,7 @@ export declare const chargeTableCellWidth: {
|
|
|
187
147
|
readonly card_number: {
|
|
188
148
|
readonly default: "120px";
|
|
189
149
|
readonly text: "120px";
|
|
190
|
-
readonly sheet: "
|
|
150
|
+
readonly sheet: "190px";
|
|
191
151
|
};
|
|
192
152
|
readonly auth_code: {
|
|
193
153
|
readonly default: "80px";
|
|
@@ -202,7 +162,7 @@ export declare const chargeTableCellWidth: {
|
|
|
202
162
|
readonly device: {
|
|
203
163
|
readonly default: "70px";
|
|
204
164
|
readonly text: "190px";
|
|
205
|
-
readonly sheet: "
|
|
165
|
+
readonly sheet: "190px";
|
|
206
166
|
};
|
|
207
167
|
readonly card_no: {
|
|
208
168
|
readonly default: "120px";
|
|
@@ -52,48 +52,8 @@ export const chargeTableCellWidth = {
|
|
|
52
52
|
payment_agreement: {
|
|
53
53
|
default: '50px',
|
|
54
54
|
text: '150px',
|
|
55
|
-
sheet: '165px',
|
|
56
|
-
},
|
|
57
|
-
payment_initiated: {
|
|
58
|
-
default: '150px',
|
|
59
|
-
text: '150px',
|
|
60
55
|
sheet: '150px',
|
|
61
56
|
},
|
|
62
|
-
payment_issuer: {
|
|
63
|
-
default: '150px',
|
|
64
|
-
text: '150px',
|
|
65
|
-
sheet: '350px',
|
|
66
|
-
},
|
|
67
|
-
payment_method: {
|
|
68
|
-
default: '150px',
|
|
69
|
-
text: '150px',
|
|
70
|
-
sheet: '145px',
|
|
71
|
-
},
|
|
72
|
-
payment_type: {
|
|
73
|
-
default: '150px',
|
|
74
|
-
text: '150px',
|
|
75
|
-
sheet: '120px',
|
|
76
|
-
},
|
|
77
|
-
payment_schema: {
|
|
78
|
-
default: '150px',
|
|
79
|
-
text: '150px',
|
|
80
|
-
sheet: '145px',
|
|
81
|
-
},
|
|
82
|
-
auth_status: {
|
|
83
|
-
default: '150px',
|
|
84
|
-
text: '150px',
|
|
85
|
-
sheet: '165px',
|
|
86
|
-
},
|
|
87
|
-
auth_type: {
|
|
88
|
-
default: '150px',
|
|
89
|
-
text: '150px',
|
|
90
|
-
sheet: '155px',
|
|
91
|
-
},
|
|
92
|
-
eci: {
|
|
93
|
-
default: '150px',
|
|
94
|
-
text: '150px',
|
|
95
|
-
sheet: '90px',
|
|
96
|
-
},
|
|
97
57
|
amount: {
|
|
98
58
|
default: '170px',
|
|
99
59
|
text: '195px',
|
|
@@ -187,7 +147,7 @@ export const chargeTableCellWidth = {
|
|
|
187
147
|
card_number: {
|
|
188
148
|
default: '120px',
|
|
189
149
|
text: '120px',
|
|
190
|
-
sheet: '
|
|
150
|
+
sheet: '190px',
|
|
191
151
|
},
|
|
192
152
|
auth_code: {
|
|
193
153
|
default: '80px',
|
|
@@ -202,7 +162,7 @@ export const chargeTableCellWidth = {
|
|
|
202
162
|
device: {
|
|
203
163
|
default: '70px',
|
|
204
164
|
text: '190px',
|
|
205
|
-
sheet: '
|
|
165
|
+
sheet: '190px',
|
|
206
166
|
},
|
|
207
167
|
card_no: {
|
|
208
168
|
default: '120px',
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/os-micro-frontend-shared",
|
|
3
3
|
"description": "Shared components and utilities for Tap Payments micro frontends",
|
|
4
|
-
"version": "0.1.1-test.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.1-test.54",
|
|
5
|
+
"testVersion": 54,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|
/package/build/components/VirtualTables/{utils/getSelectionStyles.d.ts → components/utils.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|