@tap-payments/os-micro-frontend-shared 0.0.69-sheetview-table-v2 → 0.0.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/SearchButton/styles.d.ts +1 -1
- package/build/components/TableCells/CustomCells/ActionCell/style.d.ts +1 -1
- package/build/components/TableCells/CustomCells/SourceMergedCell/style.d.ts +1 -1
- package/build/components/TableCells/CustomCells/StatusCell/style.d.ts +1 -1
- package/build/components/VirtualTable/VirtualTable.d.ts +1 -1
- package/build/components/VirtualTable/VirtualTable.js +7 -10
- package/build/components/VirtualTable/components/ColumnFilter/ColumnFilter.js +1 -1
- package/build/components/VirtualTable/components/TableHeader.d.ts +1 -2
- package/build/components/VirtualTable/components/TableHeader.js +11 -12
- package/build/components/VirtualTable/components/TableRow.d.ts +1 -2
- package/build/components/VirtualTable/components/TableRow.js +3 -3
- package/build/components/VirtualTable/components/virtualScroll/ListItemWrapper.d.ts +1 -1
- package/build/components/VirtualTable/components/virtualScroll/ListItemWrapper.js +5 -5
- package/build/components/VirtualTable/style.d.ts +1 -5
- package/build/components/VirtualTable/style.js +27 -15
- package/build/constants/table.d.ts +0 -1
- package/build/constants/table.js +0 -1
- package/build/types/table.d.ts +0 -1
- package/package.json +1 -1
|
@@ -554,9 +554,9 @@ export declare const Icon: import("@emotion/styled").StyledComponent<{
|
|
|
554
554
|
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLImageElement> | undefined;
|
|
555
555
|
onTransitionEnd?: import("react").TransitionEventHandler<HTMLImageElement> | undefined;
|
|
556
556
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLImageElement> | undefined;
|
|
557
|
-
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
558
557
|
src?: string | undefined;
|
|
559
558
|
alt?: string | undefined;
|
|
559
|
+
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
560
560
|
crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
|
|
561
561
|
useMap?: string | undefined;
|
|
562
562
|
loading?: "eager" | "lazy" | undefined;
|
|
@@ -269,9 +269,9 @@ export declare const ActionIcon: import("@emotion/styled").StyledComponent<{
|
|
|
269
269
|
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLImageElement> | undefined;
|
|
270
270
|
onTransitionEnd?: import("react").TransitionEventHandler<HTMLImageElement> | undefined;
|
|
271
271
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLImageElement> | undefined;
|
|
272
|
-
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
273
272
|
src?: string | undefined;
|
|
274
273
|
alt?: string | undefined;
|
|
274
|
+
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
275
275
|
crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
|
|
276
276
|
useMap?: string | undefined;
|
|
277
277
|
loading?: "eager" | "lazy" | undefined;
|
|
@@ -273,9 +273,9 @@ export declare const MultiRefundIcon: import("@emotion/styled").StyledComponent<
|
|
|
273
273
|
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLImageElement> | undefined;
|
|
274
274
|
onTransitionEnd?: import("react").TransitionEventHandler<HTMLImageElement> | undefined;
|
|
275
275
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLImageElement> | undefined;
|
|
276
|
-
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
277
276
|
src?: string | undefined;
|
|
278
277
|
alt?: string | undefined;
|
|
278
|
+
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
279
279
|
crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
|
|
280
280
|
useMap?: string | undefined;
|
|
281
281
|
loading?: "eager" | "lazy" | undefined;
|
|
@@ -262,9 +262,9 @@ export declare const MultiRefundIcon: import("@emotion/styled").StyledComponent<
|
|
|
262
262
|
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLImageElement> | undefined;
|
|
263
263
|
onTransitionEnd?: import("react").TransitionEventHandler<HTMLImageElement> | undefined;
|
|
264
264
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLImageElement> | undefined;
|
|
265
|
-
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
266
265
|
src?: string | undefined;
|
|
267
266
|
alt?: string | undefined;
|
|
267
|
+
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
268
268
|
crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
|
|
269
269
|
useMap?: string | undefined;
|
|
270
270
|
loading?: "eager" | "lazy" | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { IVirtualTable } from '../../types/index.js';
|
|
3
|
-
declare function VirtualTable({ columns, rows, threshold, showHeader, headerProps, rowProps, footerProps, rowHeight, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, showBackgroundColor, areAllRowsLoaded, tableBodyStyles, tableMode, tableTitle, dragControls,
|
|
3
|
+
declare function VirtualTable({ columns, rows, threshold, showHeader, headerProps, rowProps, footerProps, rowHeight, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, showBackgroundColor, areAllRowsLoaded, tableBodyStyles, tableMode, tableTitle, dragControls, }: Readonly<IVirtualTable>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare const _default: import("react").MemoExoticComponent<typeof VirtualTable>;
|
|
5
5
|
export default _default;
|
|
@@ -13,7 +13,7 @@ import { useTheme } from '@mui/material/styles';
|
|
|
13
13
|
import memoize from 'memoize-one';
|
|
14
14
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
15
15
|
import InfiniteLoader from 'react-window-infinite-loader';
|
|
16
|
-
import { TABLE_ROW_HEIGHT, TABLE_THRESHOLD, TABLE_LIST_OVER_SCAN
|
|
16
|
+
import { TABLE_ROW_HEIGHT, TABLE_THRESHOLD, TABLE_LIST_OVER_SCAN } from '../../constants/index.js';
|
|
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';
|
|
@@ -22,7 +22,7 @@ import TableLastItem from './components/TableLastItem';
|
|
|
22
22
|
import TableNoData from './components/TableNoData';
|
|
23
23
|
import ListItemWrapper from './components/virtualScroll/ListItemWrapper';
|
|
24
24
|
import { StyledBox, StyledTableBox, StyledVirtualList, TableContainer, TableWrapper } from './style';
|
|
25
|
-
const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToIndex, lastItemIndex, totalCount, isError, areAllRowsLoaded
|
|
25
|
+
const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToIndex, lastItemIndex, totalCount, isError, areAllRowsLoaded) => ({
|
|
26
26
|
columns,
|
|
27
27
|
isLoading,
|
|
28
28
|
rows,
|
|
@@ -32,9 +32,8 @@ const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToInde
|
|
|
32
32
|
lastItemIndex,
|
|
33
33
|
isError,
|
|
34
34
|
areAllRowsLoaded,
|
|
35
|
-
isSheetView,
|
|
36
35
|
}));
|
|
37
|
-
function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader, headerProps, rowProps, footerProps, rowHeight = TABLE_ROW_HEIGHT, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, showBackgroundColor, areAllRowsLoaded = false, tableBodyStyles, tableMode, tableTitle, dragControls,
|
|
36
|
+
function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader, headerProps, rowProps, footerProps, rowHeight = TABLE_ROW_HEIGHT, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, showBackgroundColor, areAllRowsLoaded = false, tableBodyStyles, tableMode, tableTitle, dragControls, }) {
|
|
38
37
|
var _a;
|
|
39
38
|
const theme = useTheme();
|
|
40
39
|
const onPointerDown = (e) => {
|
|
@@ -55,8 +54,7 @@ function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader,
|
|
|
55
54
|
const orderedColumns = useMemo(() => shownColumns.sort((a, b) => { var _a, _b; return ((_a = a === null || a === void 0 ? void 0 : a.order) !== null && _a !== void 0 ? _a : 1000000) - ((_b = b === null || b === void 0 ? void 0 : b.order) !== null && _b !== void 0 ? _b : 1000000); }), [shownColumns]);
|
|
56
55
|
const areTotalRowsNotFillingHeight = isHeightNotFullyFilledByRows(rows.length) && !tableLoading;
|
|
57
56
|
const itemsCount = isDelayedFetchingNextPage || (areAllRowsLoaded && !areTotalRowsNotFillingHeight) ? rows.length + 1 : rows.length;
|
|
58
|
-
const itemData = createItemData(orderedColumns, isDelayedFetchingNextPage, rows, rowProps, scrollToIndex, lastItemIndex, (_a = footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount) !== null && _a !== void 0 ? _a : 0, isError, areAllRowsLoaded && !areTotalRowsNotFillingHeight
|
|
59
|
-
const tableRowHeight = isSheetView ? SHEET_VIEW_TABLE_ROW_HEIGHT : TABLE_ROW_HEIGHT;
|
|
57
|
+
const itemData = createItemData(orderedColumns, isDelayedFetchingNextPage, rows, rowProps, scrollToIndex, lastItemIndex, (_a = footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount) !== null && _a !== void 0 ? _a : 0, isError, areAllRowsLoaded && !areTotalRowsNotFillingHeight);
|
|
60
58
|
const renderTableContainer = useMemo(() => {
|
|
61
59
|
const setBackdropVisibility = (isVisible) => {
|
|
62
60
|
setShowBackdrop(isVisible);
|
|
@@ -66,7 +64,7 @@ function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader,
|
|
|
66
64
|
return;
|
|
67
65
|
yield (loadMoreItems === null || loadMoreItems === void 0 ? void 0 : loadMoreItems());
|
|
68
66
|
});
|
|
69
|
-
return (_jsx(InfiniteLoader, Object.assign({ "data-testid": "VirtualTable_InfiniteLoader", isItemLoaded: (index) => index !== lastItemIndex, itemCount: itemsCount, loadMoreItems: handleOnLoadMoreItems, threshold: threshold }, { children: ({ onItemsRendered, ref }) => (_jsx(AutoSizer, Object.assign({ ref: ref, "data-testid": "VirtualTable_AutoSizer" }, { children: ({ height, width }) => (_jsx(StyledVirtualList, Object.assign({ "data-testid": "VirtualTable_VirtualList", useIsScrolling: true, className: "list", itemData: itemData, height: height || 0, width: width || 0, itemCount: itemsCount, itemSize: () =>
|
|
67
|
+
return (_jsx(InfiniteLoader, Object.assign({ "data-testid": "VirtualTable_InfiniteLoader", isItemLoaded: (index) => index !== lastItemIndex, itemCount: itemsCount, loadMoreItems: handleOnLoadMoreItems, threshold: threshold }, { children: ({ onItemsRendered, ref }) => (_jsx(AutoSizer, Object.assign({ ref: ref, "data-testid": "VirtualTable_AutoSizer" }, { children: ({ height, width }) => (_jsx(StyledVirtualList, Object.assign({ "data-testid": "VirtualTable_VirtualList", useIsScrolling: true, className: "list", itemData: itemData, height: height || 0, width: width || 0, itemCount: itemsCount, itemSize: () => TABLE_ROW_HEIGHT, onItemsRendered: onItemsRendered, setBackdropVisibility: setBackdropVisibility, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, scrollToIndex: scrollToIndex, overscanCount: TABLE_LIST_OVER_SCAN }, { children: ListItemWrapper }))) }))) })));
|
|
70
68
|
}, [
|
|
71
69
|
orderedColumns,
|
|
72
70
|
error,
|
|
@@ -83,12 +81,11 @@ function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader,
|
|
|
83
81
|
areAllRowsLoaded,
|
|
84
82
|
areTotalRowsNotFillingHeight,
|
|
85
83
|
itemsCount,
|
|
86
|
-
tableRowHeight,
|
|
87
84
|
]);
|
|
88
85
|
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-show-background-color": !!showBackgroundColor, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showBackgroundColor: showBackgroundColor, showNoDataView: showNoDataView }, { children: _jsxs(TableWrapper, Object.assign({
|
|
86
|
+
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-show-background-color": !!showBackgroundColor, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showBackgroundColor: showBackgroundColor, 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 })), 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
87
|
width: '100%',
|
|
91
88
|
minWidth: 'fit-content',
|
|
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) *
|
|
89
|
+
} }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "VirtualTable_StyledBox", hidePadding: true, className: "list-wrapper" }, { children: renderTableContainer })) })))] })) })), !showNoDataView && areTotalRowsNotFillingHeight && !isFetchingNextPage && (_jsx(TableLastItem, { height: (itemsCount + 1) * TABLE_ROW_HEIGHT, 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))] }));
|
|
93
90
|
}
|
|
94
91
|
export default memo(VirtualTable);
|
|
@@ -50,7 +50,7 @@ function ColumnFilter(filter) {
|
|
|
50
50
|
}
|
|
51
51
|
return null;
|
|
52
52
|
}, [open, filter, anchorEl, setAnchorEl]);
|
|
53
|
-
return (_jsx(ClickAwayListener, Object.assign({ onClickAway: onCloseDropdown }, { children: _jsxs(Box, Object.assign({ component: "section", "data-testid": "ColumnFilter", sx: { position: 'relative', display: '
|
|
53
|
+
return (_jsx(ClickAwayListener, Object.assign({ onClickAway: onCloseDropdown }, { children: _jsxs(Box, Object.assign({ component: "section", "data-testid": "ColumnFilter", sx: { position: 'relative', display: 'inline-block', marginTop: 'auto' } }, { children: [showClearIcon ? (_jsxs(FilterWrapper, { children: [_jsx(Box, { component: "img", "data-testid": "ColumnFilter_whiteFilterIcon", src: whiteFilterIcon, alt: "filter-icon", sx: { marginInlineEnd: '2px', height: 6 }, onClick: openDropdown }), _jsx(Box, { component: "img", "data-testid": "ColumnFilter_closeIcon", src: closeIcon, alt: "close-icon", onClick: () => {
|
|
54
54
|
filter.onClear(filterApiKeys);
|
|
55
55
|
} })] })) : (_jsx(Box, { component: "img", "data-testid": "ColumnFilter_columnIcon", src: columnIcon, alt: "column-icon", sx: { marginInlineStart: '8px', cursor: 'pointer' }, onClick: openDropdown })), open && _jsx(CustomBackdrop, { onClick: onCloseDropdown }), _jsx(Popper, Object.assign({ open: open, anchorEl: anchorEl, placement: "bottom-start", sx: {
|
|
56
56
|
zIndex: 9999,
|
|
@@ -20,8 +20,7 @@ interface TableHeaderProps {
|
|
|
20
20
|
columnsSorting?: IVirtualTable['columnsSorting'];
|
|
21
21
|
onColumnSort?: IVirtualTable['onColumnSort'];
|
|
22
22
|
showBackDrop: boolean;
|
|
23
|
-
isSheetView?: boolean;
|
|
24
23
|
}
|
|
25
|
-
declare function TableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting
|
|
24
|
+
declare function TableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting }: TableHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
26
25
|
declare const _default: import("react").MemoExoticComponent<typeof TableHeader>;
|
|
27
26
|
export default _default;
|
|
@@ -31,16 +31,15 @@ export const StyledHeader = styled(TableHead, {
|
|
|
31
31
|
backgroundColor: theme.palette.background.default,
|
|
32
32
|
zIndex: 1,
|
|
33
33
|
}));
|
|
34
|
-
const StyledMUITableRow = styled(MUITableRow
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
})
|
|
43
|
-
function TableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, isSheetView }) {
|
|
34
|
+
const StyledMUITableRow = styled(MUITableRow)({
|
|
35
|
+
display: 'flex',
|
|
36
|
+
justifyContent: 'flex-start',
|
|
37
|
+
paddingInline: '32px',
|
|
38
|
+
paddingBlock: '16px',
|
|
39
|
+
width: '100%',
|
|
40
|
+
minWidth: 'fit-content',
|
|
41
|
+
});
|
|
42
|
+
function TableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting }) {
|
|
44
43
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
45
44
|
const open = Boolean(anchorEl);
|
|
46
45
|
const theme = useTheme();
|
|
@@ -58,11 +57,11 @@ function TableHeader({ columns, headerProps, showBackDrop, onColumnSort, columns
|
|
|
58
57
|
handleClose();
|
|
59
58
|
}
|
|
60
59
|
};
|
|
61
|
-
return (_jsxs(StyledHeader, Object.assign({ component: "nav", "data-testid": "VirtualTable_TableHeader_StyledHeader", showBackDrop: showBackDrop }, headerProps, { sx: Object.assign({ width: '100%', minWidth: 'auto', overflowX: 'scroll' }, headerProps === null || headerProps === void 0 ? void 0 : headerProps.sx) }, { children: [_jsx(StyledMUITableRow, Object.assign({ component: "section", "data-testid": "VirtualTable_TableHeader_StyledMUITableRow"
|
|
60
|
+
return (_jsxs(StyledHeader, Object.assign({ component: "nav", "data-testid": "VirtualTable_TableHeader_StyledHeader", showBackDrop: showBackDrop }, headerProps, { sx: Object.assign({ width: '100%', minWidth: 'auto', overflowX: 'scroll' }, headerProps === null || headerProps === void 0 ? void 0 : headerProps.sx) }, { children: [_jsx(StyledMUITableRow, Object.assign({ component: "section", "data-testid": "VirtualTable_TableHeader_StyledMUITableRow" }, { children: columns.map((column, colIndex) => {
|
|
62
61
|
const { header, id, align, headerStyle, sortable, filter } = column;
|
|
63
62
|
const isFirst = id === columns[0].id;
|
|
64
63
|
const isLast = id === columns[columns.length - 1].id;
|
|
65
|
-
return (_jsxs(StyledCell, Object.assign({ "data-id": id, component: "div", "data-testid": "VirtualTable_TableHeader_StyledCell", "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: isFirst, isLast: isLast, sx: Object.assign({ paddingInline: '0.6875rem', paddingLeft: isFirst ? '0' : '0.6875rem', paddingRight: isLast ? '0' : '0.6875rem', display: 'flex', gap: theme.spacing(0.5), alignItems: '
|
|
64
|
+
return (_jsxs(StyledCell, Object.assign({ "data-id": id, component: "div", "data-testid": "VirtualTable_TableHeader_StyledCell", "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: isFirst, isLast: isLast, sx: Object.assign({ paddingInline: '0.6875rem', paddingLeft: isFirst ? '0' : '0.6875rem', paddingRight: isLast ? '0' : '0.6875rem', display: 'flex', gap: theme.spacing(0.5), alignItems: 'baseline', justifyContent: align === 'right' ? 'flex-end' : 'flex-start', width: column.width, textAlign: align, overflow: 'unset' }, headerStyle) }, { children: [typeof header === 'function' ? (header()) : (_jsx(Box, Object.assign({ "data-testid": "TableHeader_columns_header", sx: { maxWidth: '100%', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, { children: header && (_jsx("span", Object.assign({ style: { textOverflow: 'ellipsis', width: '80%', overflow: 'hidden' }, "data-testid": "VirtualTable_TableHeader_StyledCell_header_text" }, { children: header }))) }))), filter && _jsx(ColumnFilter, Object.assign({}, filter)), sortable && _jsx(ColumnIcon, { onClick: sortable ? handleClick : undefined, src: columnIcon, alt: "column-icon", "data-id": id })] }), `${id}-${colIndex}`));
|
|
66
65
|
}) })), _jsx(Dropdown, { open: open, onClose: handleClose, anchorEl: anchorEl, menuItems: [
|
|
67
66
|
{
|
|
68
67
|
label: 'Sort A-Z',
|
|
@@ -10,8 +10,7 @@ interface ITableRowProps<R = any> {
|
|
|
10
10
|
onRowClick?: (row: R) => void;
|
|
11
11
|
showLoadedStyle?: boolean;
|
|
12
12
|
};
|
|
13
|
-
isSheetView?: boolean;
|
|
14
13
|
}
|
|
15
|
-
declare function TableRow({ row, columns, index, rowProps
|
|
14
|
+
declare function TableRow({ row, columns, index, rowProps }: Readonly<ITableRowProps>): import("react/jsx-runtime").JSX.Element;
|
|
16
15
|
declare const _default: import("react").MemoExoticComponent<typeof TableRow>;
|
|
17
16
|
export default _default;
|
|
@@ -3,7 +3,7 @@ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { memo, useMemo } from 'react';
|
|
4
4
|
import { areEqual } from 'react-window';
|
|
5
5
|
import { StyledCell, StyledTableRow } from '../style';
|
|
6
|
-
function TableRow({ row, columns, index, rowProps
|
|
6
|
+
function TableRow({ row, columns, index, rowProps }) {
|
|
7
7
|
const renderCell = (column) => {
|
|
8
8
|
const { render, format, selector } = column;
|
|
9
9
|
if (!(column === null || column === void 0 ? void 0 : column.id) || !row)
|
|
@@ -13,8 +13,8 @@ function TableRow({ row, columns, index, rowProps, isSheetView }) {
|
|
|
13
13
|
return render ? render({ row, column, index, value: row[column === null || column === void 0 ? void 0 : column.id] }) : _jsx(_Fragment, { children: formattedValue });
|
|
14
14
|
};
|
|
15
15
|
const content = useMemo(() => (_jsx(_Fragment, { children: columns.map((column, colIndex) => {
|
|
16
|
-
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, sx: Object.assign({ width: column.width, minWidth: column.width, textAlign: column.align, justifyContent: column.align === 'right' ? 'flex-end' : 'flex-start' }, column.cellStyle)
|
|
16
|
+
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, sx: Object.assign({ width: column.width, minWidth: column.width, textAlign: column.align, justifyContent: column.align === 'right' ? 'flex-end' : 'flex-start' }, column.cellStyle) }, { children: renderCell(column) }), `${column.id}-${colIndex}`));
|
|
17
17
|
}) })), [columns, row]);
|
|
18
|
-
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
|
|
18
|
+
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 }), content));
|
|
19
19
|
}
|
|
20
20
|
export default memo(TableRow, areEqual);
|
|
@@ -6,5 +6,5 @@ export declare const LastRowContent: React.MemoExoticComponent<({ isLoadingRow }
|
|
|
6
6
|
export declare const StyledItemWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
7
7
|
showShadowHighlight?: boolean | undefined;
|
|
8
8
|
}, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
9
|
-
declare function ListItemWrapper({ index, style, data: { renderedScrollTopRef, rows, rowProps, columns, isLoading, scrollToIndex, limit, totalCount, newLoadedRowsEndIndex, isError, areAllRowsLoaded,
|
|
9
|
+
declare function ListItemWrapper({ index, style, data: { renderedScrollTopRef, rows, rowProps, columns, isLoading, scrollToIndex, limit, totalCount, newLoadedRowsEndIndex, isError, areAllRowsLoaded, ...restData }, }: Readonly<ListChildComponentProps>): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export default ListItemWrapper;
|
|
@@ -14,7 +14,7 @@ import React from 'react';
|
|
|
14
14
|
import { Box } from '@mui/material';
|
|
15
15
|
import { styled } from '@mui/material/styles';
|
|
16
16
|
import { useTranslation } from 'react-i18next';
|
|
17
|
-
import { blueCircleLoaderIcon, tableBackgroundLoader, TABLE_ROW_HEIGHT
|
|
17
|
+
import { blueCircleLoaderIcon, tableBackgroundLoader, TABLE_ROW_HEIGHT } from '../../../../constants/index.js';
|
|
18
18
|
import { ActionIcon } from '../../style';
|
|
19
19
|
import { RowErrorState } from '../RowErrorState';
|
|
20
20
|
import { StyledParagraph } from '../TableLastItem';
|
|
@@ -44,7 +44,7 @@ export const StyledItemWrapper = styled('div', {
|
|
|
44
44
|
height: '100%',
|
|
45
45
|
}));
|
|
46
46
|
function ListItemWrapper(_a) {
|
|
47
|
-
var { index, style } = _a, _b = _a.data, { renderedScrollTopRef, rows, rowProps, columns, isLoading, scrollToIndex, limit, totalCount, newLoadedRowsEndIndex, isError, areAllRowsLoaded
|
|
47
|
+
var { index, style } = _a, _b = _a.data, { renderedScrollTopRef, rows, rowProps, columns, isLoading, scrollToIndex, limit, totalCount, newLoadedRowsEndIndex, isError, areAllRowsLoaded } = _b, restData = __rest(_b, ["renderedScrollTopRef", "rows", "rowProps", "columns", "isLoading", "scrollToIndex", "limit", "totalCount", "newLoadedRowsEndIndex", "isError", "areAllRowsLoaded"]);
|
|
48
48
|
const lastItemIndex = rows.length - 1;
|
|
49
49
|
const row = rows[index];
|
|
50
50
|
const isLoadingRow = isLoading && index === lastItemIndex + 1;
|
|
@@ -56,7 +56,7 @@ function ListItemWrapper(_a) {
|
|
|
56
56
|
const isLastRow = isLoadingRow || (areAllRowsLoaded && index === lastItemIndex + 1);
|
|
57
57
|
if (isLastRow) {
|
|
58
58
|
return (_jsx(Box, Object.assign({ sx: {
|
|
59
|
-
height:
|
|
59
|
+
height: TABLE_ROW_HEIGHT,
|
|
60
60
|
display: 'flex',
|
|
61
61
|
justifyContent: 'center',
|
|
62
62
|
alignItems: 'center',
|
|
@@ -69,8 +69,8 @@ function ListItemWrapper(_a) {
|
|
|
69
69
|
height: '100%',
|
|
70
70
|
} }, { children: isError ? _jsx(RowErrorState, {}) : lastRowContent })) })));
|
|
71
71
|
}
|
|
72
|
-
return _jsx(TableRow, { index: index, row: row, columns: columns, rowProps: memoizedRowProps
|
|
73
|
-
}, [restData, index, row, columns, memoizedRowProps
|
|
72
|
+
return _jsx(TableRow, { index: index, row: row, columns: columns, rowProps: memoizedRowProps }, `row-${index}`);
|
|
73
|
+
}, [restData, index, row, columns, memoizedRowProps]);
|
|
74
74
|
return (_jsx("div", Object.assign({ "data-testid": "ListItemWrapper", style: Object.assign(Object.assign({}, style), { top: Number(style.top) - renderedScrollTopRef.current, willChange: 'top' }) }, { children: _jsx(StyledItemWrapper, Object.assign({ "data-testid": "ListItemWrapper_StyledItemWrapper" }, { children: memoizedListItemComponent })) })));
|
|
75
75
|
}
|
|
76
76
|
export default ListItemWrapper;
|
|
@@ -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;
|
|
@@ -17,11 +16,9 @@ export declare const StyledSolidBackground: import("@emotion/styled").StyledComp
|
|
|
17
16
|
export declare const StyledCell: import("@emotion/styled").StyledComponent<import("@mui/material").TableCellProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
18
17
|
isLast: boolean;
|
|
19
18
|
isFirst: boolean;
|
|
20
|
-
isSheetView?: boolean | undefined;
|
|
21
19
|
}, {}, {}>;
|
|
22
20
|
interface StyledVirtualListProps {
|
|
23
21
|
areTotalRowsNotFillingHeight: boolean;
|
|
24
|
-
isSheetView?: boolean;
|
|
25
22
|
}
|
|
26
23
|
export declare const StyledVirtualList: import("@emotion/styled").StyledComponent<import("react-window").VariableSizeListProps<any> & {
|
|
27
24
|
setBackdropVisibility: (isVisible: boolean) => void;
|
|
@@ -32,7 +29,6 @@ export declare const StyledTableRow: import("@emotion/styled").StyledComponent<i
|
|
|
32
29
|
}, "className" | "style" | "classes" | "children" | "sx" | "hover" | "selected"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
33
30
|
showShadowHighlight?: boolean | undefined;
|
|
34
31
|
showLoadedStyle?: boolean | undefined;
|
|
35
|
-
isSheetView?: boolean | undefined;
|
|
36
32
|
}, {}, {}>;
|
|
37
33
|
export declare const StyledTableBox: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
38
34
|
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
@@ -303,9 +299,9 @@ export declare const ActionIcon: import("@emotion/styled").StyledComponent<{
|
|
|
303
299
|
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLImageElement> | undefined;
|
|
304
300
|
onTransitionEnd?: import("react").TransitionEventHandler<HTMLImageElement> | undefined;
|
|
305
301
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLImageElement> | undefined;
|
|
306
|
-
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
307
302
|
src?: string | undefined;
|
|
308
303
|
alt?: string | undefined;
|
|
304
|
+
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
309
305
|
crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
|
|
310
306
|
useMap?: string | undefined;
|
|
311
307
|
loading?: "eager" | "lazy" | undefined;
|
|
@@ -6,8 +6,8 @@ import { motion } from 'framer-motion';
|
|
|
6
6
|
import { TABLE_FOOTER_HEIGHT } from './components/TableFooter/style';
|
|
7
7
|
import VirtualScrollList from './components/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,6 @@ export const TableWrapper = styled(Box, {
|
|
|
15
15
|
minWidth: showNoDataView ? 'unset' : 'fit-content',
|
|
16
16
|
overflow: 'hidden',
|
|
17
17
|
overflowX: showNoDataView ? 'hidden' : 'scroll',
|
|
18
|
-
margin: isSheetView ? '0 32px' : '0',
|
|
19
|
-
border: isSheetView ? '1px solid #F2F2F2' : 'none',
|
|
20
18
|
}));
|
|
21
19
|
export const StyledBox = styled(Box, {
|
|
22
20
|
shouldForwardProp: (prop) => prop !== 'hidePadding',
|
|
@@ -29,18 +27,30 @@ export const StyledSolidBackground = styled(Box)(({ theme }) => ({
|
|
|
29
27
|
backgroundColor: theme.palette.background.default,
|
|
30
28
|
}));
|
|
31
29
|
export const StyledCell = styled(TableCell, {
|
|
32
|
-
shouldForwardProp: (prop) =>
|
|
33
|
-
})(({ theme, isLast, isFirst
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
shouldForwardProp: (prop) => prop !== 'isLast' && prop !== 'isFirst',
|
|
31
|
+
})(({ theme, isLast, isFirst }) => ({
|
|
32
|
+
paddingBlock: '0',
|
|
33
|
+
paddingInline: '0.3875rem !important',
|
|
34
|
+
paddingLeft: isFirst ? '0 !important' : '0.3875rem !important',
|
|
35
|
+
paddingRight: isLast ? '0 !important' : '0.3875rem !important',
|
|
36
|
+
color: theme.palette.grey[700],
|
|
37
|
+
fontSize: theme.typography.caption.fontSize,
|
|
38
|
+
height: '100%',
|
|
39
|
+
fontWeight: theme.typography.fontWeightRegular,
|
|
40
|
+
whiteSpace: 'nowrap',
|
|
41
|
+
overflow: 'hidden',
|
|
42
|
+
textOverflow: 'ellipsis',
|
|
43
|
+
display: 'flex',
|
|
44
|
+
alignItems: 'center',
|
|
45
|
+
}));
|
|
36
46
|
export const StyledVirtualList = styled(VirtualScrollList, {
|
|
37
|
-
shouldForwardProp: (prop) =>
|
|
38
|
-
})(({ theme, areTotalRowsNotFillingHeight
|
|
39
|
-
backgroundColor: theme.palette.
|
|
40
|
-
}))
|
|
47
|
+
shouldForwardProp: (prop) => prop !== 'areTotalRowsNotFillingHeight',
|
|
48
|
+
})(({ theme, areTotalRowsNotFillingHeight }) => ({
|
|
49
|
+
backgroundColor: areTotalRowsNotFillingHeight ? 'transparent' : theme.palette.background.default,
|
|
50
|
+
}));
|
|
41
51
|
export const StyledTableRow = styled(MUITableRow, {
|
|
42
|
-
shouldForwardProp: (props) =>
|
|
43
|
-
})(({ theme, showShadowHighlight, showLoadedStyle
|
|
52
|
+
shouldForwardProp: (props) => props !== 'showShadowHighlight' && props !== 'showLoadedStyle',
|
|
53
|
+
})(({ theme, showShadowHighlight, showLoadedStyle }) => (Object.assign(Object.assign({ display: 'flex', borderBottom: `1px solid ${theme === null || theme === void 0 ? void 0 : theme.palette.divider}`, paddingInline: '32px', position: 'relative', height: '100%', width: '100%', '&:hover': {
|
|
44
54
|
boxShadow: theme.shadows[12],
|
|
45
55
|
zIndex: 1,
|
|
46
56
|
'.payment-sources-container': {
|
|
@@ -77,7 +87,7 @@ export const StyledTableRow = styled(MUITableRow, {
|
|
|
77
87
|
position: 'absolute',
|
|
78
88
|
left: 0,
|
|
79
89
|
},
|
|
80
|
-
}))))
|
|
90
|
+
}))));
|
|
81
91
|
export const StyledTableBox = styled(Box, {
|
|
82
92
|
shouldForwardProp: (prop) => prop !== 'showBackgroundColor' && prop !== 'showNoDataView',
|
|
83
93
|
})(({ theme, showBackgroundColor, showNoDataView }) => ({
|
|
@@ -88,6 +98,8 @@ export const StyledTableBox = styled(Box, {
|
|
|
88
98
|
paddingBottom: showBackgroundColor ? '52px' : '0',
|
|
89
99
|
display: 'flex',
|
|
90
100
|
flexDirection: 'column',
|
|
101
|
+
borderBottomLeftRadius: theme.spacing(1.5),
|
|
102
|
+
borderBottomRightRadius: theme.spacing(1.5),
|
|
91
103
|
}));
|
|
92
104
|
export const ActionIcon = styled(motion.img)(() => ({
|
|
93
105
|
width: '24px',
|
package/build/constants/table.js
CHANGED
package/build/types/table.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.0.69
|
|
4
|
+
"version": "0.0.69",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/index.js",
|
|
7
7
|
"module": "build/index.js",
|