@tap-payments/os-micro-frontend-shared 0.1.9 → 0.1.10-test.1-test.8-test.9
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 +13 -25
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/SheetViewTableHeader.d.ts +5 -2
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/SheetViewTableHeader.js +2 -2
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/TableCell.d.ts +5 -2
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/TableCell.js +8 -2
- package/build/components/VirtualTables/SheetViewVirtualTable/style.js +10 -4
- package/build/components/VirtualTables/VirtualTable/VirtualTable.js +1 -1
- package/build/components/VirtualTables/components/TableRow.d.ts +9 -2
- package/build/components/VirtualTables/components/TableRow.js +40 -6
- package/build/components/VirtualTables/components/style.d.ts +0 -1
- package/build/components/VirtualTables/components/style.js +26 -22
- package/build/components/VirtualTables/components/virtualScroll/ListItemWrapper.d.ts +1 -1
- package/build/components/VirtualTables/components/virtualScroll/ListItemWrapper.js +3 -2
- package/build/constants/assets.d.ts +7 -6
- package/build/constants/assets.js +10 -9
- package/build/types/table.d.ts +1 -0
- package/package.json +3 -3
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
|
+
```
|
|
@@ -17,7 +17,6 @@ import { TABLE_THRESHOLD, TABLE_LIST_OVER_SCAN } from '../../../constants/index.
|
|
|
17
17
|
import { useDelayToSetValue } from '../../../hooks/index.js';
|
|
18
18
|
import { isHeightNotFullyFilledByRows, isNotFoundError, isTimeoutError, hasError } from '../../../utils/index.js';
|
|
19
19
|
import TableFooter from '../components/TableFooter/TableFooter';
|
|
20
|
-
import TableNoData from '../components/TableNoData';
|
|
21
20
|
import { SheetViewTableNoData } from './components';
|
|
22
21
|
import ListItemWrapper from '../components/virtualScroll/ListItemWrapper';
|
|
23
22
|
import { StyledBox, StyledTableBox, StyledVirtualList, TableContainer, TableWrapper } from '../components/style';
|
|
@@ -25,7 +24,7 @@ import { SheetViewVirtualTableWrapper, PinnedStartColumnWrapper, PinnedEndColumn
|
|
|
25
24
|
import SheetViewTableHeader from './components/SheetViewTableHeader';
|
|
26
25
|
import { usePinnedColumns } from './hooks/usePinnedColumns';
|
|
27
26
|
import { useSynchronizedScroll } from './hooks/useSynchronizedScroll';
|
|
28
|
-
const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToIndex, lastItemIndex, totalCount, isError, areAllRowsLoaded, isPinned, selectedCell, selectedColumn, onCellClick, containerHeight, rowHeight) => ({
|
|
27
|
+
const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToIndex, lastItemIndex, totalCount, isError, areAllRowsLoaded, isPinned, selectedCell, selectedColumn, onCellClick, containerHeight, rowHeight, tablePosition, hasPinnedStart, hasPinnedEnd, isLoadMoreLoading = false) => ({
|
|
29
28
|
columns,
|
|
30
29
|
isLoading,
|
|
31
30
|
rows,
|
|
@@ -44,6 +43,10 @@ const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToInde
|
|
|
44
43
|
onCellClick,
|
|
45
44
|
containerHeight,
|
|
46
45
|
rowHeight,
|
|
46
|
+
tablePosition,
|
|
47
|
+
hasPinnedStart,
|
|
48
|
+
hasPinnedEnd,
|
|
49
|
+
isLoadMoreLoading,
|
|
47
50
|
}));
|
|
48
51
|
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
52
|
const theme = useTheme();
|
|
@@ -113,12 +116,10 @@ function SheetViewVirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, sho
|
|
|
113
116
|
areAllRowsLoaded,
|
|
114
117
|
];
|
|
115
118
|
const commonItemDataSuffix = [selectedCell, selectedColumn, handleCellClick, height, rowHeight];
|
|
116
|
-
const getItemDataForContainer = (columnsData, isPinnedColumn) => createItemData(columnsData, ...commonItemDataParams, isPinnedColumn, ...commonItemDataSuffix);
|
|
119
|
+
const getItemDataForContainer = (columnsData, isPinnedColumn, tablePos) => createItemData(columnsData, ...commonItemDataParams, isPinnedColumn, ...commonItemDataSuffix, tablePos, pinnedStartColumnsData.length > 0, pinnedEndColumnsData.length > 0, isFetchingNextPage);
|
|
117
120
|
const currentItemData = containerKey === 'pinnedStart'
|
|
118
|
-
? getItemDataForContainer(pinnedStartColumnsData, true)
|
|
119
|
-
|
|
120
|
-
? getItemDataForContainer(pinnedEndColumnsData, true)
|
|
121
|
-
: getItemDataForContainer(unpinnedColumnsData, false);
|
|
121
|
+
? Object.assign(Object.assign({}, getItemDataForContainer(pinnedStartColumnsData, true, 'pinnedStart')), { isFetchingNextPage: isFetchingNextPage }) : containerKey === 'pinnedEnd'
|
|
122
|
+
? Object.assign(Object.assign({}, getItemDataForContainer(pinnedEndColumnsData, true, 'pinnedEnd')), { isFetchingNextPage: isFetchingNextPage }) : Object.assign(Object.assign({}, getItemDataForContainer(unpinnedColumnsData, false, 'scrollable')), { isFetchingNextPage: isFetchingNextPage });
|
|
122
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: {
|
|
123
124
|
overflowX: isPinned ? 'hidden' : 'auto',
|
|
124
125
|
paddingBottom: isPinned ? '25px' : '13px',
|
|
@@ -150,9 +151,10 @@ function SheetViewVirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, sho
|
|
|
150
151
|
pinnedEndVirtualListRef,
|
|
151
152
|
pinnedStartVirtualListRef,
|
|
152
153
|
scrollableVirtualListRef,
|
|
153
|
-
|
|
154
|
+
isFetchingNextPage,
|
|
155
|
+
tableLoading,
|
|
154
156
|
]);
|
|
155
|
-
const showNoDataView =
|
|
157
|
+
const showNoDataView = tableEmpty || hasTimeoutError;
|
|
156
158
|
const pinnedStartColumnsWidth = useMemo(() => pinnedStartColumnsData.reduce((acc, col) => {
|
|
157
159
|
const width = typeof col.width === 'string' ? parseInt(col.width) : col.width || 100;
|
|
158
160
|
return acc + width;
|
|
@@ -166,27 +168,13 @@ function SheetViewVirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, sho
|
|
|
166
168
|
const containerKey = position === 'start' ? 'pinnedStart' : 'pinnedEnd';
|
|
167
169
|
if (columnsData.length === 0)
|
|
168
170
|
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-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: handleColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: handleColumnClick })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
|
171
|
+
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: handleColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: handleColumnClick, tablePosition: position === 'start' ? 'pinnedStart' : 'pinnedEnd', hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0 })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
|
170
172
|
width: '100%',
|
|
171
173
|
minWidth: 'fit-content',
|
|
172
174
|
overflowX: 'hidden',
|
|
173
175
|
} }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_PinnedStyledBox", hidePadding: true, className: "list-wrapper" }, { children: createVirtualTableContainer(columnsData, containerKey, true, columnsWidth) })) }))] })) }));
|
|
174
176
|
};
|
|
175
|
-
return (_jsxs(_Fragment, { children: [_jsx(TableContainer, { children: showNoDataView ? (tableLoading
|
|
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-table-mode": tableMode, height: "100%", dir: theme.direction, 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-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 }) })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
|
177
|
+
return (_jsxs(_Fragment, { children: [_jsx(TableContainer, { children: showNoDataView ? (_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, tablePosition: "scrollable", hasPinnedStart: false, hasPinnedEnd: false }) })), _jsx(SheetViewTableNoData, { 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: {
|
|
190
178
|
width: '100%',
|
|
191
179
|
minWidth: 'fit-content',
|
|
192
180
|
} }, { 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))] }));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type TableHeadProps } from '@mui/material/TableHead';
|
|
3
|
-
import type { IColumnProps, IVirtualTable } from '../../../../../types/index.js';
|
|
3
|
+
import type { IColumnProps, IVirtualTable, TablePosition } from '../../../../../types/index.js';
|
|
4
4
|
interface SheetViewTableHeaderProps {
|
|
5
5
|
columns: IColumnProps[];
|
|
6
6
|
headerProps?: TableHeadProps;
|
|
@@ -13,7 +13,10 @@ interface SheetViewTableHeaderProps {
|
|
|
13
13
|
lastColumnId?: string | null;
|
|
14
14
|
selectedColumn?: string | null;
|
|
15
15
|
onColumnClick?: (columnId: string, event: React.MouseEvent) => void;
|
|
16
|
+
tablePosition?: TablePosition;
|
|
17
|
+
hasPinnedStart?: boolean;
|
|
18
|
+
hasPinnedEnd?: boolean;
|
|
16
19
|
}
|
|
17
|
-
declare function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, }: SheetViewTableHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
declare function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, tablePosition, hasPinnedStart, hasPinnedEnd, }: SheetViewTableHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
18
21
|
declare const _default: import("react").MemoExoticComponent<typeof SheetViewTableHeader>;
|
|
19
22
|
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, tablePosition = 'scrollable', hasPinnedStart = false, hasPinnedEnd = false, }) {
|
|
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, tablePosition: tablePosition, hasPinnedStart: hasPinnedStart, hasPinnedEnd: hasPinnedEnd }, `${column.id}-${colIndex}`));
|
|
8
8
|
}) })) })));
|
|
9
9
|
}
|
|
10
10
|
export default memo(SheetViewTableHeader);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { IColumnProps } from '../../../../../types/index.js';
|
|
2
|
+
import type { IColumnProps, TablePosition } from '../../../../../types/index.js';
|
|
3
3
|
import { SheetViewTableHeaderProps } from './type';
|
|
4
4
|
interface TableCellProps extends Pick<SheetViewTableHeaderProps, 'onColumnSort' | 'columnsSorting' | 'onColumnPin' | 'isPinnable' | 'lastColumnId' | 'onColumnClick' | 'pinnedColumns'> {
|
|
5
5
|
column: IColumnProps;
|
|
@@ -7,7 +7,10 @@ interface TableCellProps extends Pick<SheetViewTableHeaderProps, 'onColumnSort'
|
|
|
7
7
|
isLast: boolean;
|
|
8
8
|
isSelected: boolean;
|
|
9
9
|
isDefaultPinned: boolean;
|
|
10
|
+
tablePosition?: TablePosition;
|
|
11
|
+
hasPinnedStart?: boolean;
|
|
12
|
+
hasPinnedEnd?: boolean;
|
|
10
13
|
}
|
|
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;
|
|
14
|
+
declare function TableCell({ column: { header, id, align, headerStyle, sortable, filter, pinnable, width, order }, isFirst, isLast, isSelected, isDefaultPinned, onColumnSort, columnsSorting, onColumnPin, isPinnable, lastColumnId, onColumnClick, pinnedColumns, tablePosition, hasPinnedStart, hasPinnedEnd, }: TableCellProps): import("react/jsx-runtime").JSX.Element;
|
|
12
15
|
declare const _default: import("react").MemoExoticComponent<typeof TableCell>;
|
|
13
16
|
export default _default;
|
|
@@ -6,7 +6,7 @@ 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, tablePosition = 'scrollable', hasPinnedStart = false, hasPinnedEnd = false, }) {
|
|
10
10
|
const [columnFilterEl, setColumnFilterEl] = useState(null);
|
|
11
11
|
const checkIsPanned = useCallback((columnId) => pinnedColumns === null || pinnedColumns === void 0 ? void 0 : pinnedColumns.includes(columnId), [pinnedColumns]);
|
|
12
12
|
const isPinned = useMemo(() => checkIsPanned(id), [id, checkIsPanned]);
|
|
@@ -23,7 +23,13 @@ function TableCell({ column: { header, id, align, headerStyle, sortable, filter,
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
let effectiveFirst = isFirst;
|
|
27
|
+
let effectiveLast = isLast;
|
|
28
|
+
if (tablePosition === 'scrollable') {
|
|
29
|
+
effectiveFirst = isFirst && !hasPinnedStart;
|
|
30
|
+
effectiveLast = isLast && !hasPinnedEnd;
|
|
31
|
+
}
|
|
32
|
+
return (_jsxs(StyledCell, Object.assign({ "data-id": id, component: "div", "data-testid": "SheetViewVirtualTable_TableHeader_StyledCell", "data-column-id": id, "data-column-width": width, "data-column-width-used": width, "data-column-align": align, "data-column-order": order, "data-column-header": typeof header === 'string' ? header : 'component', "data-column-sortable": !!sortable, "data-column-filterable": !!filter, "data-column-pinned": isPinned, isFirst: effectiveFirst, isLast: effectiveLast, isSheetView: true, onClick: (event) => {
|
|
27
33
|
onColumnClick === null || onColumnClick === void 0 ? void 0 : onColumnClick(id, event);
|
|
28
34
|
setColumnFilterEl(event.currentTarget);
|
|
29
35
|
}, sx: (theme) => (Object.assign({ display: 'flex', gap: theme.spacing(0.5), alignItems: 'center', justifyContent: align === 'right' ? 'flex-end' : 'flex-start', width, textAlign: align, overflow: 'unset', cursor: 'pointer', boxSizing: 'border-box', border: isSelected ? '1px solid #1F88D0' : '1px solid #F2F2F2', backgroundColor: isSelected ? '#F2F2F2' : '#FCFCFC', minHeight: isSelected ? '28px' : 'auto', position: 'relative', '&:before': {
|
|
@@ -68,18 +68,21 @@ const PinnedColumnBase = styled('div')(({ theme }) => ({
|
|
|
68
68
|
backgroundColor: theme.palette.primary.light,
|
|
69
69
|
borderTop: '1px solid #F2F2F2',
|
|
70
70
|
borderBottom: '1px solid #F2F2F2',
|
|
71
|
+
overflow: 'hidden',
|
|
71
72
|
}));
|
|
72
73
|
export const PinnedStartColumnWrapper = styled(PinnedColumnBase)({
|
|
73
|
-
marginLeft: '32px',
|
|
74
74
|
boxShadow: '4px 0px 24px 0px #00000014',
|
|
75
75
|
borderLeft: '1px solid #F2F2F2',
|
|
76
76
|
borderRight: 'none',
|
|
77
|
+
borderTopLeftRadius: '12px',
|
|
78
|
+
borderBottomLeftRadius: '12px',
|
|
77
79
|
});
|
|
78
80
|
export const PinnedEndColumnWrapper = styled(PinnedColumnBase)({
|
|
79
|
-
marginRight: '32px',
|
|
80
81
|
boxShadow: '-4px 0px 24px 0px #00000014',
|
|
81
82
|
borderRight: '1px solid #F2F2F2',
|
|
82
83
|
borderLeft: 'none',
|
|
84
|
+
borderTopRightRadius: '12px',
|
|
85
|
+
borderBottomRightRadius: '12px',
|
|
83
86
|
});
|
|
84
87
|
export const MainTableWrapper = styled('div', {
|
|
85
88
|
shouldForwardProp: (prop) => prop !== 'hasPinnedStart' && prop !== 'hasPinnedEnd',
|
|
@@ -92,10 +95,13 @@ export const MainTableWrapper = styled('div', {
|
|
|
92
95
|
borderBottom: '1px solid #F2F2F2',
|
|
93
96
|
borderLeft: hasPinnedStart ? 'none' : '1px solid #F2F2F2',
|
|
94
97
|
borderRight: hasPinnedEnd ? 'none' : '1px solid #F2F2F2',
|
|
95
|
-
marginLeft: hasPinnedStart ? '0' : '32px',
|
|
96
|
-
marginRight: hasPinnedEnd ? '0' : '32px',
|
|
97
98
|
position: 'relative',
|
|
98
99
|
scrollbarWidth: 'auto',
|
|
100
|
+
overflow: 'hidden',
|
|
101
|
+
borderTopLeftRadius: hasPinnedStart ? '0' : '12px',
|
|
102
|
+
borderBottomLeftRadius: hasPinnedStart ? '0' : '12px',
|
|
103
|
+
borderTopRightRadius: hasPinnedEnd ? '0' : '12px',
|
|
104
|
+
borderBottomRightRadius: hasPinnedEnd ? '0' : '12px',
|
|
99
105
|
}));
|
|
100
106
|
export const UnpinnedTableHeaderWrapper = styled('div')({
|
|
101
107
|
flexShrink: 0,
|
|
@@ -86,7 +86,7 @@ function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader,
|
|
|
86
86
|
scrollToIndex,
|
|
87
87
|
]);
|
|
88
88
|
const showNoDataView = tableLoading || tableError || tableEmpty || hasTimeoutError;
|
|
89
|
-
return (_jsxs(_Fragment, { children: [_jsxs(TableContainer, { children: [_jsx(StyledTableBox, Object.assign({ as: "main", id: "table-box-container", "aria-labelledby": "table-box-container", "data-testid": "VirtualTable_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({
|
|
89
|
+
return (_jsxs(_Fragment, { children: [_jsxs(TableContainer, { children: [_jsx(StyledTableBox, Object.assign({ as: "main", id: "table-box-container", "aria-labelledby": "table-box-container", "data-testid": "VirtualTable_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": "VirtualTable_TableWrapper", showNoDataView: showNoDataView, sx: Object.assign({}, tableBodyStyles) }, { children: [showHeader && (_jsx(TableHeader, { "data-testid": "VirtualTable_TableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: orderedColumns, headerProps: headerProps, showBackDrop: showBackDrop, isSheetView: isSheetView })), showNoDataView ? (_jsx(TableNoData, { error: error, tableEmpty: tableEmpty, isTimeoutError: hasTimeoutError, tableError: tableError, tableLoading: tableLoading, orderedColumns: orderedColumns, triggerDataRefetch: triggerDataRefetch, footerProps: footerProps })) : (_jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
|
90
90
|
width: '100%',
|
|
91
91
|
minWidth: 'fit-content',
|
|
92
92
|
} }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "VirtualTable_StyledBox", hidePadding: true, className: "list-wrapper" }, { children: renderTableContainer })) })))] })) })), !showNoDataView && areTotalRowsNotFillingHeight && !isFetchingNextPage && (_jsx(TableLastItem, { height: (itemsCount + 1) * tableRowHeight, sandboxMode: footerProps === null || footerProps === void 0 ? void 0 : footerProps.sandboxMode, "data-testid": "VirtualTable_TableLastItem" }))] }), _jsx(TableFooter, Object.assign({ "data-testid": "VirtualTable_TableFooter", showSeparator: true, showBackDrop: showBackDrop, onPointerDown: onPointerDown }, footerProps))] }));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { TableRowProps } from '@mui/material';
|
|
3
|
-
import type { IColumnProps } from '../../../types/index.js';
|
|
3
|
+
import type { IColumnProps, TablePosition } from '../../../types/index.js';
|
|
4
4
|
interface ITableRowProps<R = any> {
|
|
5
5
|
row: R;
|
|
6
6
|
columns: Array<IColumnProps<R>>;
|
|
@@ -15,7 +15,14 @@ interface ITableRowProps<R = any> {
|
|
|
15
15
|
selectedColumn?: string | null;
|
|
16
16
|
onCellClick?: (rowIndex: number, columnId: string, event: React.MouseEvent) => void;
|
|
17
17
|
isLastRow?: boolean;
|
|
18
|
+
isFirstRow?: boolean;
|
|
19
|
+
tablePosition?: TablePosition;
|
|
20
|
+
hasPinnedStart?: boolean;
|
|
21
|
+
hasPinnedEnd?: boolean;
|
|
22
|
+
isLoading?: boolean;
|
|
23
|
+
isFetchingNextPage?: boolean;
|
|
24
|
+
isLoadMoreLoading?: boolean;
|
|
18
25
|
}
|
|
19
|
-
declare function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell, selectedColumn, onCellClick, isLastRow, }: Readonly<ITableRowProps>): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
declare function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell, selectedColumn, onCellClick, isLastRow, isFirstRow, tablePosition, hasPinnedStart, hasPinnedEnd, isLoading, isFetchingNextPage, isLoadMoreLoading, }: Readonly<ITableRowProps>): import("react/jsx-runtime").JSX.Element;
|
|
20
27
|
declare const _default: import("react").MemoExoticComponent<typeof TableRow>;
|
|
21
28
|
export default _default;
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
import { createElement as _createElement } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { memo, useMemo } from 'react';
|
|
4
|
+
import Skeleton from '@mui/material/Skeleton';
|
|
4
5
|
import { areEqual } from 'react-window';
|
|
5
6
|
import { StyledCell, StyledTableRow } from './style';
|
|
6
7
|
import { getSelectionStyles } from '../utils/getSelectionStyles';
|
|
7
|
-
function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = null, selectedColumn = null, onCellClick, isLastRow = false, }) {
|
|
8
|
-
const renderCell = (column) => {
|
|
9
|
-
const { render, format, selector } = column;
|
|
8
|
+
function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = null, selectedColumn = null, onCellClick, isLastRow = false, isFirstRow, tablePosition = 'scrollable', hasPinnedStart, hasPinnedEnd, isLoading, isFetchingNextPage, isLoadMoreLoading, }) {
|
|
9
|
+
const renderCell = (column, colIndex) => {
|
|
10
|
+
const { render, format, selector, pinned } = column;
|
|
10
11
|
if (!(column === null || column === void 0 ? void 0 : column.id) || !row)
|
|
11
12
|
return null;
|
|
13
|
+
const shouldShowSkeleton = isLoading && !(colIndex === 0 && pinned === 'start');
|
|
14
|
+
if (shouldShowSkeleton) {
|
|
15
|
+
return (_jsx(Skeleton, { variant: "rectangular", width: "100%", height: 16, animation: "wave", sx: {
|
|
16
|
+
backgroundColor: '#F4F4F4',
|
|
17
|
+
borderRadius: '64px',
|
|
18
|
+
minWidth: '20px',
|
|
19
|
+
} }));
|
|
20
|
+
}
|
|
12
21
|
const value = selector ? selector({ row, index, value: row[column === null || column === void 0 ? void 0 : column.id] }) : row[column === null || column === void 0 ? void 0 : column.id];
|
|
13
22
|
const formattedValue = format ? format({ value, row, index }) : value;
|
|
14
23
|
return render ? render({ row, column, index, value: row[column === null || column === void 0 ? void 0 : column.id] }) : _jsx(_Fragment, { children: formattedValue });
|
|
@@ -25,8 +34,33 @@ function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = n
|
|
|
25
34
|
isColumnSelected,
|
|
26
35
|
isLastRow,
|
|
27
36
|
});
|
|
28
|
-
|
|
29
|
-
|
|
37
|
+
const isFirstColumn = column.id === columns[0].id;
|
|
38
|
+
const isLastColumn = column.id === columns[columns.length - 1].id;
|
|
39
|
+
let effectiveFirst = isFirstColumn;
|
|
40
|
+
let effectiveLast = isLastColumn;
|
|
41
|
+
if (!column.pinned) {
|
|
42
|
+
effectiveFirst = isFirstColumn && !hasPinnedStart;
|
|
43
|
+
effectiveLast = isLastColumn && !hasPinnedEnd;
|
|
44
|
+
}
|
|
45
|
+
return (_jsx(StyledCell, Object.assign({ component: "div", "data-testid": "TableRow_TableCell", "data-column-id": column.id, "data-column-width": column.width, "data-column-width-used": column.width, "data-column-align": column.align, "data-column-order": column.order, "data-column-header": typeof column.header === 'string' ? column.header : 'component', "data-column-sortable": !!column.sortable, "data-column-filterable": !!column.filter, isFirst: effectiveFirst, isLast: effectiveLast, onClick: (event) => onCellClick === null || onCellClick === void 0 ? void 0 : onCellClick(index, columnIdStr, event), sx: Object.assign(Object.assign({ width: column.width, minWidth: column.width, textAlign: column.align, justifyContent: column.align === 'right' ? 'flex-end' : 'flex-start', cursor: onCellClick ? 'pointer' : 'default' }, selectionStyles), column.cellStyle), isSheetView: isSheetView, isSelected: isCellSelected }, { children: renderCell(column, colIndex) }), `${column.id}-${colIndex}`));
|
|
46
|
+
}) })), [
|
|
47
|
+
columns,
|
|
48
|
+
row,
|
|
49
|
+
index,
|
|
50
|
+
selectedCell,
|
|
51
|
+
selectedColumn,
|
|
52
|
+
onCellClick,
|
|
53
|
+
isLastRow,
|
|
54
|
+
isFirstRow,
|
|
55
|
+
tablePosition,
|
|
56
|
+
hasPinnedStart,
|
|
57
|
+
hasPinnedEnd,
|
|
58
|
+
isLoading,
|
|
59
|
+
isFetchingNextPage,
|
|
60
|
+
isLoadMoreLoading,
|
|
61
|
+
isSheetView,
|
|
62
|
+
renderCell,
|
|
63
|
+
]);
|
|
30
64
|
return (_createElement(StyledTableRow, Object.assign({ "data-testid": "TableRow", onClick: rowProps === null || rowProps === void 0 ? void 0 : rowProps.onRowClick, showShadowHighlight: rowProps === null || rowProps === void 0 ? void 0 : rowProps.showShadowHighlight, showLoadedStyle: rowProps === null || rowProps === void 0 ? void 0 : rowProps.showLoadedStyle, component: "article" }, rowProps, { key: index, isSheetView: isSheetView }), content));
|
|
31
65
|
}
|
|
32
66
|
export default memo(TableRow, areEqual);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
interface TableWrapperProps {
|
|
3
3
|
showNoDataView?: boolean;
|
|
4
|
-
isSheetView?: boolean;
|
|
5
4
|
}
|
|
6
5
|
export declare const TableWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
7
6
|
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
@@ -6,8 +6,8 @@ import { motion } from 'framer-motion';
|
|
|
6
6
|
import { TABLE_FOOTER_HEIGHT } from './TableFooter/style';
|
|
7
7
|
import VirtualScrollList from './virtualScroll/VirtualScrollList';
|
|
8
8
|
export const TableWrapper = styled(Box, {
|
|
9
|
-
shouldForwardProp: (prop) => prop !== 'showNoDataView'
|
|
10
|
-
})(({ showNoDataView
|
|
9
|
+
shouldForwardProp: (prop) => prop !== 'showNoDataView',
|
|
10
|
+
})(({ showNoDataView }) => ({
|
|
11
11
|
display: 'flex',
|
|
12
12
|
flexDirection: 'column',
|
|
13
13
|
height: '100%',
|
|
@@ -15,8 +15,7 @@ export const TableWrapper = styled(Box, {
|
|
|
15
15
|
minWidth: showNoDataView ? 'unset' : 'fit-content',
|
|
16
16
|
overflow: 'hidden',
|
|
17
17
|
overflowX: showNoDataView ? 'hidden' : 'scroll',
|
|
18
|
-
margin:
|
|
19
|
-
border: isSheetView ? '1px solid #F2F2F2' : 'none',
|
|
18
|
+
margin: '0px',
|
|
20
19
|
}));
|
|
21
20
|
export const StyledBox = styled(Box, {
|
|
22
21
|
shouldForwardProp: (prop) => prop !== 'hidePadding',
|
|
@@ -30,24 +29,26 @@ export const StyledSolidBackground = styled(Box)(({ theme }) => ({
|
|
|
30
29
|
}));
|
|
31
30
|
export const StyledCell = styled(TableCell, {
|
|
32
31
|
shouldForwardProp: (prop) => !['isLast', 'isFirst', 'isSheetView', 'isSelected'].includes(prop),
|
|
33
|
-
})(({ theme, isLast, isFirst, isSheetView
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
32
|
+
})(({ theme, isLast, isFirst, isSheetView }) => {
|
|
33
|
+
return Object.assign({ paddingBlock: '0', paddingInline: '0.3875rem !important', paddingLeft: isFirst ? '0 !important' : '0.3875rem !important', paddingRight: isLast ? '0 !important' : '0.3875rem !important', color: isSheetView ? theme.palette.text.primary : theme.palette.grey[700], fontSize: isSheetView ? theme.typography.subtitle1.fontSize : theme.typography.caption.fontSize, height: '100%', fontWeight: isSheetView ? 400 : theme.typography.fontWeightRegular, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: 'flex', alignItems: 'center', cursor: 'pointer' }, (isSheetView && {
|
|
34
|
+
borderRight: isLast ? '1px solid transparent' : `1px solid ${theme.palette.divider}`,
|
|
35
|
+
paddingInline: '8px !important',
|
|
36
|
+
paddingLeft: '8px !important',
|
|
37
|
+
paddingRight: '8px !important',
|
|
38
|
+
position: 'relative',
|
|
39
|
+
borderTop: '1px solid transparent',
|
|
40
|
+
borderLeft: '1px solid transparent',
|
|
41
|
+
'&:before': {
|
|
42
|
+
content: '""',
|
|
43
|
+
borderRight: isLast ? 'none' : '1px solid transparent',
|
|
44
|
+
position: 'absolute',
|
|
45
|
+
top: 0,
|
|
46
|
+
right: 0,
|
|
47
|
+
left: 0,
|
|
48
|
+
bottom: 0,
|
|
49
|
+
},
|
|
50
|
+
}));
|
|
51
|
+
});
|
|
51
52
|
export const StyledVirtualList = styled(VirtualScrollList, {
|
|
52
53
|
shouldForwardProp: (prop) => !['areTotalRowsNotFillingHeight', 'isSheetView'].includes(prop),
|
|
53
54
|
})(({ theme, areTotalRowsNotFillingHeight, isSheetView }) => (Object.assign({ backgroundColor: areTotalRowsNotFillingHeight ? 'transparent' : theme.palette.background.default }, (isSheetView && {
|
|
@@ -132,6 +133,9 @@ export const TableContainer = styled(Box)(() => ({
|
|
|
132
133
|
display: 'flex',
|
|
133
134
|
flexDirection: 'column',
|
|
134
135
|
height: '100%',
|
|
136
|
+
paddingInline: '28px',
|
|
137
|
+
borderRadius: '8px',
|
|
138
|
+
marginBottom: '11px !important',
|
|
135
139
|
}));
|
|
136
140
|
export const StyledCardsBox = styled(Box, {
|
|
137
141
|
shouldForwardProp: (prop) => prop !== 'showNoDataView',
|
|
@@ -10,5 +10,5 @@ export declare const LastRowContent: React.MemoExoticComponent<({ isLoadingRow,
|
|
|
10
10
|
export declare const StyledItemWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
11
11
|
showShadowHighlight?: boolean | undefined;
|
|
12
12
|
}, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
13
|
-
declare function ListItemWrapper({ index, style, data: { renderedScrollTopRef, rows, rowProps, columns, isLoading, scrollToIndex, newLoadedRowsEndIndex, isError, areAllRowsLoaded, isSheetView, isPinned, ...restData }, }: Readonly<ListChildComponentProps>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function ListItemWrapper({ index, style, data: { renderedScrollTopRef, rows, rowProps, columns, isLoading, scrollToIndex, newLoadedRowsEndIndex, isError, areAllRowsLoaded, isSheetView, isPinned, isLoadMoreLoading, ...restData }, }: Readonly<ListChildComponentProps>): import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
export default ListItemWrapper;
|
|
@@ -52,7 +52,7 @@ export const StyledItemWrapper = styled('div', {
|
|
|
52
52
|
}));
|
|
53
53
|
function ListItemWrapper(_a) {
|
|
54
54
|
var _b;
|
|
55
|
-
var { index, style } = _a, _c = _a.data, { renderedScrollTopRef, rows, rowProps, columns, isLoading, scrollToIndex, newLoadedRowsEndIndex, isError, areAllRowsLoaded, isSheetView, isPinned = false } = _c, restData = __rest(_c, ["renderedScrollTopRef", "rows", "rowProps", "columns", "isLoading", "scrollToIndex", "newLoadedRowsEndIndex", "isError", "areAllRowsLoaded", "isSheetView", "isPinned"]);
|
|
55
|
+
var { index, style } = _a, _c = _a.data, { renderedScrollTopRef, rows, rowProps, columns, isLoading, scrollToIndex, newLoadedRowsEndIndex, isError, areAllRowsLoaded, isSheetView, isPinned = false, isLoadMoreLoading = false } = _c, restData = __rest(_c, ["renderedScrollTopRef", "rows", "rowProps", "columns", "isLoading", "scrollToIndex", "newLoadedRowsEndIndex", "isError", "areAllRowsLoaded", "isSheetView", "isPinned", "isLoadMoreLoading"]);
|
|
56
56
|
const lastItemIndex = rows.length - 1;
|
|
57
57
|
const row = rows[index];
|
|
58
58
|
const isLoadingRow = isLoading && index === lastItemIndex + 1;
|
|
@@ -88,7 +88,7 @@ function ListItemWrapper(_a) {
|
|
|
88
88
|
height: '100%',
|
|
89
89
|
} }, { children: isError ? _jsx(RowErrorState, {}) : lastRowContent })) })));
|
|
90
90
|
}
|
|
91
|
-
return (_jsx(TableRow, { index: index, row: row, columns: columns, rowProps: memoizedRowProps, isSheetView: isSheetView,
|
|
91
|
+
return (_jsx(TableRow, Object.assign({ index: index, row: row, columns: columns, rowProps: memoizedRowProps, isSheetView: isSheetView, isLastRow: index === rows.length - 1, isFirstRow: index === 0, isLoading: isLoading, isLoadMoreLoading: isLoadMoreLoading }, restData), `row-${index}`));
|
|
92
92
|
}, [
|
|
93
93
|
restData,
|
|
94
94
|
index,
|
|
@@ -103,6 +103,7 @@ function ListItemWrapper(_a) {
|
|
|
103
103
|
isPinned,
|
|
104
104
|
rows.length,
|
|
105
105
|
renderSheetViewLoadingRow,
|
|
106
|
+
isLoadMoreLoading,
|
|
106
107
|
]);
|
|
107
108
|
return (_jsx("div", Object.assign({ "data-testid": "ListItemWrapper", style: Object.assign(Object.assign({}, style), { top: Number(style.top) - ((_b = renderedScrollTopRef === null || renderedScrollTopRef === void 0 ? void 0 : renderedScrollTopRef.current) !== null && _b !== void 0 ? _b : 0), willChange: 'top' }) }, { children: _jsx(StyledItemWrapper, Object.assign({ "data-testid": "ListItemWrapper_StyledItemWrapper" }, { children: memoizedListItemComponent })) })));
|
|
108
109
|
}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
export declare const lightUrl: string;
|
|
2
2
|
export declare const appBaseUrl: string;
|
|
3
3
|
export declare const functionBaseUrl: string;
|
|
4
|
+
export declare const getLightUrlIcon: (source: string) => string;
|
|
5
|
+
export declare const getPaymentMethodsIcon: (source: string) => string;
|
|
6
|
+
export declare const getPaymentIssuersIcon: (source: string) => string;
|
|
7
|
+
export declare const getCountriesIcon: (source: string) => string;
|
|
8
|
+
export declare const getServiceFunctionIcon: (functionCode: string) => string;
|
|
9
|
+
export declare const getCurrenciesIcon: (currency: string) => string;
|
|
10
|
+
export declare const getAuthorityIcon: (authority: string) => string;
|
|
4
11
|
export declare const SARIconImage: string;
|
|
5
12
|
export declare const DirhamIconImage: string;
|
|
6
13
|
export declare const abandonedIcon: string;
|
|
@@ -360,11 +367,6 @@ export declare const brandPlaceholderIcon: string;
|
|
|
360
367
|
export declare const usersIcon: string;
|
|
361
368
|
export declare const clipboardIcon: string;
|
|
362
369
|
export declare const noAgreementIcon: string;
|
|
363
|
-
export declare const getPaymentMethodsIcon: (source: string) => string;
|
|
364
|
-
export declare const getPaymentIssuersIcon: (source: string) => string;
|
|
365
|
-
export declare const getCountriesIcon: (source: string) => string;
|
|
366
|
-
export declare const getCurrenciesIcon: (currency: string) => string;
|
|
367
|
-
export declare const getAuthorityIcon: (authority: string) => string;
|
|
368
370
|
export declare const acceptanceWindowIcon: string;
|
|
369
371
|
export declare const walletWindowIcon: string;
|
|
370
372
|
export declare const billingWindowIcon: string;
|
|
@@ -424,7 +426,6 @@ export declare const redVerifyIcon: string;
|
|
|
424
426
|
export declare const closedVerifyIcon: string;
|
|
425
427
|
export declare const archivedVerifyIcon: string;
|
|
426
428
|
export declare const penIcon: string;
|
|
427
|
-
export declare const getServiceFunctionIcon: (functionCode: string) => string;
|
|
428
429
|
export declare const listShadowBg: string;
|
|
429
430
|
export declare const defaultCountryIcon: string;
|
|
430
431
|
export declare const defaultDeviceIcon: string;
|
|
@@ -2,6 +2,16 @@ const cdnUrl = 'https://cdn.tap.company/tap-assets';
|
|
|
2
2
|
export const lightUrl = `${cdnUrl}/icons/dashboard/light`;
|
|
3
3
|
export const appBaseUrl = `${lightUrl}/other`;
|
|
4
4
|
export const functionBaseUrl = `${lightUrl}/function`;
|
|
5
|
+
export const getLightUrlIcon = (source) => `${lightUrl}/${source}.svg`;
|
|
6
|
+
export const getPaymentMethodsIcon = (source) => `${lightUrl}/payment-method/v2/${source}.svg`;
|
|
7
|
+
export const getPaymentIssuersIcon = (source) => `${lightUrl}/payment-issuer/${source}.svg`;
|
|
8
|
+
export const getCountriesIcon = (source) => `${lightUrl}/country/${source}.svg`;
|
|
9
|
+
export const getServiceFunctionIcon = (functionCode) => `${lightUrl}/function/${functionCode}.svg`;
|
|
10
|
+
export const getCurrenciesIcon = (currency) => `${cdnUrl}/currency/v2/light/${currency}.svg`;
|
|
11
|
+
export const getAuthorityIcon = (authority) => {
|
|
12
|
+
const authorityWithoutSpaces = authority.replace(/\s/g, '');
|
|
13
|
+
return `${cdnUrl}/icons/dashboard/light/authority/v2/${authorityWithoutSpaces}.svg`;
|
|
14
|
+
};
|
|
5
15
|
export const SARIconImage = `${lightUrl}/currency/sar.svg`;
|
|
6
16
|
export const DirhamIconImage = `${lightUrl}/currency/dirham.svg`;
|
|
7
17
|
export const abandonedIcon = `${lightUrl}/abandoned.svg`;
|
|
@@ -361,14 +371,6 @@ export const brandPlaceholderIcon = `${lightUrl}/brandPlaceholder.svg`;
|
|
|
361
371
|
export const usersIcon = `${lightUrl}/users-icons.svg`;
|
|
362
372
|
export const clipboardIcon = `${lightUrl}/Board-Icons.svg`;
|
|
363
373
|
export const noAgreementIcon = `${appBaseUrl}/No Agreement.svg`;
|
|
364
|
-
export const getPaymentMethodsIcon = (source) => `${lightUrl}/payment-method/v2/${source}.svg`;
|
|
365
|
-
export const getPaymentIssuersIcon = (source) => `${lightUrl}/payment-issuer/${source}.svg`;
|
|
366
|
-
export const getCountriesIcon = (source) => `${lightUrl}/country/${source}.svg`;
|
|
367
|
-
export const getCurrenciesIcon = (currency) => `${cdnUrl}/currency/v2/light/${currency}.svg`;
|
|
368
|
-
export const getAuthorityIcon = (authority) => {
|
|
369
|
-
const authorityWithoutSpaces = authority.replace(/\s/g, '');
|
|
370
|
-
return `${cdnUrl}/icons/dashboard/light/authority/v2/${authorityWithoutSpaces}.svg`;
|
|
371
|
-
};
|
|
372
374
|
export const acceptanceWindowIcon = `${lightUrl}/window/acceptance.svg`;
|
|
373
375
|
export const walletWindowIcon = `${lightUrl}/window/wallet.svg`;
|
|
374
376
|
export const billingWindowIcon = `${lightUrl}/window/billing.svg`;
|
|
@@ -428,7 +430,6 @@ export const redVerifyIcon = `${lightUrl}/redVerifyIcon.svg`;
|
|
|
428
430
|
export const closedVerifyIcon = `${lightUrl}/closedVerifyIcon.svg`;
|
|
429
431
|
export const archivedVerifyIcon = `${lightUrl}/archivedVerifyIcon.svg`;
|
|
430
432
|
export const penIcon = `${lightUrl}/penIcon.svg`;
|
|
431
|
-
export const getServiceFunctionIcon = (functionCode) => `${lightUrl}/function/${functionCode}.svg`;
|
|
432
433
|
export const listShadowBg = `${appBaseUrl}/listShadow.svg`;
|
|
433
434
|
export const defaultCountryIcon = `${lightUrl}/defaultCountryIcon.svg`;
|
|
434
435
|
export const defaultDeviceIcon = `${lightUrl}/defaultDeviceIcon.svg`;
|
package/build/types/table.d.ts
CHANGED
|
@@ -96,6 +96,7 @@ export interface IColumnFilterCustom {
|
|
|
96
96
|
}
|
|
97
97
|
export type AnimationType = false | 'pulse' | 'wave' | undefined;
|
|
98
98
|
export type TableMode = 'sheet' | 'text' | 'default';
|
|
99
|
+
export type TablePosition = 'pinnedStart' | 'pinnedEnd' | 'scrollable';
|
|
99
100
|
export interface IVirtualTable<R = any> {
|
|
100
101
|
rows: R[];
|
|
101
102
|
columns: Array<IColumnProps<R>>;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/os-micro-frontend-shared",
|
|
3
3
|
"description": "Shared components and utilities for Tap Payments micro frontends",
|
|
4
|
-
"version": "0.1.9",
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.10-test.1-test.8-test.9",
|
|
5
|
+
"testVersion": 9,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|
|
@@ -131,4 +131,4 @@
|
|
|
131
131
|
"publishConfig": {
|
|
132
132
|
"registry": "https://registry.npmjs.org/"
|
|
133
133
|
}
|
|
134
|
-
}
|
|
134
|
+
}
|