@tap-payments/os-micro-frontend-shared 0.1.11-test.1 → 0.1.11-test.2-test.3
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 +2 -2
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/SheetViewTableHeader.d.ts +5 -2
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/SheetViewTableHeader.js +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/style.js +10 -4
- package/build/components/VirtualTables/VirtualTable/VirtualTable.js +1 -1
- package/build/components/VirtualTables/components/TableRow.js +9 -1
- 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 +1 -2
- package/build/constants/assets.js +1 -2
- package/build/types/table.d.ts +1 -0
- package/package.json +2 -2
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
|
+
```
|
|
@@ -166,7 +166,7 @@ function SheetViewVirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, sho
|
|
|
166
166
|
const containerKey = position === 'start' ? 'pinnedStart' : 'pinnedEnd';
|
|
167
167
|
if (columnsData.length === 0)
|
|
168
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-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: {
|
|
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, tablePosition: position === 'start' ? 'pinnedStart' : 'pinnedEnd', hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0 })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
|
170
170
|
width: '100%',
|
|
171
171
|
minWidth: 'fit-content',
|
|
172
172
|
overflowX: 'hidden',
|
|
@@ -186,7 +186,7 @@ function SheetViewVirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, sho
|
|
|
186
186
|
height: 'auto',
|
|
187
187
|
display: 'flex',
|
|
188
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({
|
|
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({ "data-testid": "SheetViewVirtualTable_TableWrapper", showNoDataView: showNoDataView, sx: tableBodyStyles }, { children: [showHeader && (_jsx(UnpinnedTableHeaderWrapper, { children: _jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_LoadingTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: orderedColumns, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: [], onColumnPin: handleColumnPin, isPinnable: false, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: handleColumnClick }) })), _jsx(TableNoData, { error: error, tableEmpty: tableEmpty, isTimeoutError: hasTimeoutError, tableError: tableError, tableLoading: tableLoading, orderedColumns: orderedColumns, triggerDataRefetch: triggerDataRefetch, footerProps: footerProps })] })) })))) : (_jsxs(SheetViewVirtualTableWrapper, { children: [renderPinnedColumn('start', pinnedStartColumnsData, pinnedStartColumnsWidth, pinnedStartColumns), _jsx(MainTableWrapper, Object.assign({ hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0 }, { children: _jsx(StyledTableBox, Object.assign({ as: "main", id: "sheet-table-box-container", "aria-labelledby": "sheet-table-box-container", "data-testid": "SheetViewVirtualTable_StyledTableBox", "data-title": tableTitle, "data-direction": theme.direction, "data-are-all-rows-loaded": !!areAllRowsLoaded, "data-is-fetching-next-page": !!isFetchingNextPage, "data-scroll-to-index": scrollToIndex, "data-is-loading": !!isLoading, "data-is-error": !!isError, "data-is-error-timeout": !!hasTimeoutError, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showNoDataView: showNoDataView, scrollable: true }, { children: _jsxs(TableWrapper, Object.assign({ "data-testid": "SheetViewVirtualTable_TableWrapper", showNoDataView: showNoDataView, sx: Object.assign(Object.assign({}, tableBodyStyles), { display: 'flex', flexDirection: 'column', height: '100%' }) }, { children: [showHeader && (_jsx(UnpinnedTableHeaderWrapper, { children: _jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_UnpinnedTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: unpinnedColumnsData, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: [...pinnedStartColumns, ...pinnedEndColumns], onColumnPin: handleColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: handleColumnClick, tablePosition: "scrollable", hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0 }) })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
|
190
190
|
width: '100%',
|
|
191
191
|
minWidth: 'fit-content',
|
|
192
192
|
} }, { 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,7 +2,7 @@ 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
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}`));
|
|
8
8
|
}) })) })));
|
|
@@ -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))] }));
|
|
@@ -25,7 +25,15 @@ function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = n
|
|
|
25
25
|
isColumnSelected,
|
|
26
26
|
isLastRow,
|
|
27
27
|
});
|
|
28
|
-
|
|
28
|
+
const isFirstColumn = column.id === columns[0].id;
|
|
29
|
+
const isLastColumn = column.id === columns[columns.length - 1].id;
|
|
30
|
+
let effectiveFirst = isFirstColumn;
|
|
31
|
+
let effectiveLast = isLastColumn;
|
|
32
|
+
if (!column.pinned) {
|
|
33
|
+
effectiveFirst = isFirstColumn && column.pinned !== 'start';
|
|
34
|
+
effectiveLast = isLastColumn && column.pinned !== 'end';
|
|
35
|
+
}
|
|
36
|
+
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) }), `${column.id}-${colIndex}`));
|
|
29
37
|
}) })), [columns, row, index, selectedCell, selectedColumn, onCellClick, isLastRow]);
|
|
30
38
|
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
39
|
}
|
|
@@ -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
|
}
|
|
@@ -515,5 +515,4 @@ export declare const dashedOutlinedCircle: string;
|
|
|
515
515
|
export declare const deactivatedCircle: string;
|
|
516
516
|
export declare const exclamationOutlinedCircle: string;
|
|
517
517
|
export declare const outlinedCircle: string;
|
|
518
|
-
export declare const
|
|
519
|
-
export declare const radioButtonUnchecked: string;
|
|
518
|
+
export declare const greenCheck2ACE00: string;
|
|
@@ -519,5 +519,4 @@ export const dashedOutlinedCircle = `${lightUrl}/dashedOutlinedCircle.svg`;
|
|
|
519
519
|
export const deactivatedCircle = `${lightUrl}/deactivatedCircle.svg`;
|
|
520
520
|
export const exclamationOutlinedCircle = `${lightUrl}/exclamationOutlinedCircle.svg`;
|
|
521
521
|
export const outlinedCircle = `${lightUrl}/outlinedCircle.svg`;
|
|
522
|
-
export const
|
|
523
|
-
export const radioButtonUnchecked = `${lightUrl}/radioButtonUnchecked.svg`;
|
|
522
|
+
export const greenCheck2ACE00 = `${lightUrl}/greenCheck2ACE00.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.11-test.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.11-test.2-test.3",
|
|
5
|
+
"testVersion": 3,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|