@tap-payments/os-micro-frontend-shared 0.1.11-test.2-test.3 → 0.1.11
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/TableCells/CustomCells/SourceMergedCell/SourceMergedCell.js +1 -1
- package/build/components/TableCells/CustomCells/SourceMergedCell/type.d.ts +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable.js +2 -2
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/SheetViewTableHeader.d.ts +2 -5
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/SheetViewTableHeader.js +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/style.js +4 -10
- package/build/components/VirtualTables/VirtualTable/VirtualTable.js +1 -1
- package/build/components/VirtualTables/components/TableRow.js +1 -9
- package/build/components/VirtualTables/components/style.d.ts +1 -0
- package/build/components/VirtualTables/components/style.js +22 -26
- package/build/components/VirtualTables/components/virtualScroll/ListItemWrapper.d.ts +1 -1
- package/build/components/VirtualTables/components/virtualScroll/ListItemWrapper.js +2 -3
- package/build/types/table.d.ts +0 -1
- 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
|
+
```
|
|
@@ -55,7 +55,7 @@ function SourceMergedCell(_a) {
|
|
|
55
55
|
} }, { children: _jsx(StatusContainer, Object.assign({ animate: isHovering ? 'hover' : 'initial', onMouseEnter: () => setIsHovering(true), onMouseLeave: () => setIsHovering(false), initial: "initial", sx: {
|
|
56
56
|
minHeight: '20px',
|
|
57
57
|
maxWidth: '55px',
|
|
58
|
-
}, isReversed: isReversed }, { children: _jsxs(_Fragment, { children: [_jsx(CollapsedViewIcon, { hasPreviousIcon: hasPreviousIcon, hasNextIcon: hasNextIcon, isTextShown: isTextShown, collapsedViewIcon: collapsedViewIcon, sx: props.sx }, 'collapsedViewIcon'), iconsList === null || iconsList === void 0 ? void 0 : iconsList.map((icon, index) => {
|
|
58
|
+
}, isReversed: isReversed }, { children: _jsxs(_Fragment, { children: [collapsedViewIcon && (_jsx(CollapsedViewIcon, { hasPreviousIcon: hasPreviousIcon, hasNextIcon: hasNextIcon, isTextShown: isTextShown, collapsedViewIcon: collapsedViewIcon, sx: props.sx }, 'collapsedViewIcon')), iconsList === null || iconsList === void 0 ? void 0 : iconsList.map((icon, index) => {
|
|
59
59
|
if (!icon)
|
|
60
60
|
return;
|
|
61
61
|
const tableMode = isTextShown ? 'text' : 'default';
|
|
@@ -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
|
|
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: {
|
|
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({ "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
|
|
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: {
|
|
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
|
|
3
|
+
import type { IColumnProps, IVirtualTable } from '../../../../../types/index.js';
|
|
4
4
|
interface SheetViewTableHeaderProps {
|
|
5
5
|
columns: IColumnProps[];
|
|
6
6
|
headerProps?: TableHeadProps;
|
|
@@ -13,10 +13,7 @@ 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;
|
|
19
16
|
}
|
|
20
|
-
declare function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick,
|
|
17
|
+
declare function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, }: SheetViewTableHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
21
18
|
declare const _default: import("react").MemoExoticComponent<typeof SheetViewTableHeader>;
|
|
22
19
|
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, }) {
|
|
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,21 +68,18 @@ 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',
|
|
72
71
|
}));
|
|
73
72
|
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',
|
|
79
77
|
});
|
|
80
78
|
export const PinnedEndColumnWrapper = styled(PinnedColumnBase)({
|
|
79
|
+
marginRight: '32px',
|
|
81
80
|
boxShadow: '-4px 0px 24px 0px #00000014',
|
|
82
81
|
borderRight: '1px solid #F2F2F2',
|
|
83
82
|
borderLeft: 'none',
|
|
84
|
-
borderTopRightRadius: '12px',
|
|
85
|
-
borderBottomRightRadius: '12px',
|
|
86
83
|
});
|
|
87
84
|
export const MainTableWrapper = styled('div', {
|
|
88
85
|
shouldForwardProp: (prop) => prop !== 'hasPinnedStart' && prop !== 'hasPinnedEnd',
|
|
@@ -95,13 +92,10 @@ export const MainTableWrapper = styled('div', {
|
|
|
95
92
|
borderBottom: '1px solid #F2F2F2',
|
|
96
93
|
borderLeft: hasPinnedStart ? 'none' : '1px solid #F2F2F2',
|
|
97
94
|
borderRight: hasPinnedEnd ? 'none' : '1px solid #F2F2F2',
|
|
95
|
+
marginLeft: hasPinnedStart ? '0' : '32px',
|
|
96
|
+
marginRight: hasPinnedEnd ? '0' : '32px',
|
|
98
97
|
position: 'relative',
|
|
99
98
|
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',
|
|
105
99
|
}));
|
|
106
100
|
export const UnpinnedTableHeaderWrapper = styled('div')({
|
|
107
101
|
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({ "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: {
|
|
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({ isSheetView: isSheetView, "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,15 +25,7 @@ function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = n
|
|
|
25
25
|
isColumnSelected,
|
|
26
26
|
isLastRow,
|
|
27
27
|
});
|
|
28
|
-
|
|
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}`));
|
|
28
|
+
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: column.id === columns[0].id, isLast: column.id === columns[columns.length - 1].id, 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}`));
|
|
37
29
|
}) })), [columns, row, index, selectedCell, selectedColumn, onCellClick, isLastRow]);
|
|
38
30
|
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));
|
|
39
31
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
interface TableWrapperProps {
|
|
3
3
|
showNoDataView?: boolean;
|
|
4
|
+
isSheetView?: boolean;
|
|
4
5
|
}
|
|
5
6
|
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"> & {
|
|
6
7
|
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' && prop !== 'isSheetView',
|
|
10
|
+
})(({ showNoDataView, isSheetView }) => ({
|
|
11
11
|
display: 'flex',
|
|
12
12
|
flexDirection: 'column',
|
|
13
13
|
height: '100%',
|
|
@@ -15,7 +15,8 @@ export const TableWrapper = styled(Box, {
|
|
|
15
15
|
minWidth: showNoDataView ? 'unset' : 'fit-content',
|
|
16
16
|
overflow: 'hidden',
|
|
17
17
|
overflowX: showNoDataView ? 'hidden' : 'scroll',
|
|
18
|
-
margin: '
|
|
18
|
+
margin: isSheetView ? '0 32px' : '0',
|
|
19
|
+
border: isSheetView ? '1px solid #F2F2F2' : 'none',
|
|
19
20
|
}));
|
|
20
21
|
export const StyledBox = styled(Box, {
|
|
21
22
|
shouldForwardProp: (prop) => prop !== 'hidePadding',
|
|
@@ -29,26 +30,24 @@ export const StyledSolidBackground = styled(Box)(({ theme }) => ({
|
|
|
29
30
|
}));
|
|
30
31
|
export const StyledCell = styled(TableCell, {
|
|
31
32
|
shouldForwardProp: (prop) => !['isLast', 'isFirst', 'isSheetView', 'isSelected'].includes(prop),
|
|
32
|
-
})(({ theme, isLast, isFirst, isSheetView }) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
'
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}));
|
|
51
|
-
});
|
|
33
|
+
})(({ theme, isLast, isFirst, isSheetView, isSelected }) => (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
|
+
}))));
|
|
52
51
|
export const StyledVirtualList = styled(VirtualScrollList, {
|
|
53
52
|
shouldForwardProp: (prop) => !['areTotalRowsNotFillingHeight', 'isSheetView'].includes(prop),
|
|
54
53
|
})(({ theme, areTotalRowsNotFillingHeight, isSheetView }) => (Object.assign({ backgroundColor: areTotalRowsNotFillingHeight ? 'transparent' : theme.palette.background.default }, (isSheetView && {
|
|
@@ -133,9 +132,6 @@ export const TableContainer = styled(Box)(() => ({
|
|
|
133
132
|
display: 'flex',
|
|
134
133
|
flexDirection: 'column',
|
|
135
134
|
height: '100%',
|
|
136
|
-
paddingInline: '28px',
|
|
137
|
-
borderRadius: '8px',
|
|
138
|
-
marginBottom: '11px !important',
|
|
139
135
|
}));
|
|
140
136
|
export const StyledCardsBox = styled(Box, {
|
|
141
137
|
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,
|
|
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;
|
|
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
|
|
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"]);
|
|
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,
|
|
91
|
+
return (_jsx(TableRow, { index: index, row: row, columns: columns, rowProps: memoizedRowProps, isSheetView: isSheetView, selectedCell: restData.selectedCell, selectedColumn: restData.selectedColumn, onCellClick: restData.onCellClick, isLastRow: index === rows.length - 1 }, `row-${index}`));
|
|
92
92
|
}, [
|
|
93
93
|
restData,
|
|
94
94
|
index,
|
|
@@ -103,7 +103,6 @@ function ListItemWrapper(_a) {
|
|
|
103
103
|
isPinned,
|
|
104
104
|
rows.length,
|
|
105
105
|
renderSheetViewLoadingRow,
|
|
106
|
-
isLoadMoreLoading,
|
|
107
106
|
]);
|
|
108
107
|
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 })) })));
|
|
109
108
|
}
|
package/build/types/table.d.ts
CHANGED
|
@@ -96,7 +96,6 @@ 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';
|
|
100
99
|
export interface IVirtualTable<R = any> {
|
|
101
100
|
rows: R[];
|
|
102
101
|
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
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.11",
|
|
5
|
+
"testVersion": 0,
|
|
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
|
+
}
|