@tap-payments/os-micro-frontend-shared 0.0.273-test.10 → 0.0.273-test.12
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/CustomBackdrop/CustomBackdrop.d.ts +1 -1
- package/build/components/CustomBackdrop/CustomBackdrop.js +2 -1
- package/build/components/CustomBackdrop/style.js +1 -1
- package/build/components/VirtualTable/SheetView/SheetViewVirtualTable.js +2 -2
- package/build/components/VirtualTable/SheetView/components/SheetViewTableHeader/SheetViewTableHeader.d.ts +1 -1
- package/build/components/VirtualTable/SheetView/components/SheetViewTableHeader/SheetViewTableHeader.js +7 -77
- package/build/components/VirtualTable/SheetView/components/SheetViewTableHeader/TableCell.d.ts +13 -0
- package/build/components/VirtualTable/SheetView/components/SheetViewTableHeader/TableCell.js +36 -0
- package/build/components/VirtualTable/SheetView/components/SheetViewTableHeader/type.d.ts +16 -0
- package/build/components/VirtualTable/SheetView/components/SheetViewTableHeader/type.js +1 -0
- package/build/components/VirtualTable/SheetView/index.d.ts +1 -1
- package/build/components/VirtualTable/SheetView/index.js +1 -1
- package/build/components/VirtualTable/SheetView/style.d.ts +17 -20
- package/build/components/VirtualTable/SheetView/style.js +4 -3
- package/build/components/VirtualTable/VirtualTable.js +1 -1
- package/build/components/VirtualTable/components/ColumnFilter/ColumnFilter.js +1 -3
- package/build/components/VirtualTable/components/{TableHeader/components/ColumnSort → ColumnSort}/ColumnSort.d.ts +2 -2
- package/build/components/VirtualTable/components/{TableHeader/components/ColumnSort → ColumnSort}/ColumnSort.js +8 -8
- package/build/components/VirtualTable/components/TableHeader/TableHeader.d.ts +1 -10
- package/build/components/VirtualTable/components/TableHeader/TableHeader.js +1 -1
- package/build/components/VirtualTable/components/TableHeader/components/TableCell/TableCell.d.ts +1 -1
- package/build/components/VirtualTable/components/TableHeader/components/TableCell/TableCell.js +3 -3
- package/build/components/VirtualTable/components/TableHeader/components/index.d.ts +0 -1
- package/build/components/VirtualTable/components/TableHeader/components/index.js +0 -1
- package/build/components/VirtualTable/components/TableHeader/index.d.ts +1 -0
- package/build/components/VirtualTable/components/TableHeader/index.js +1 -0
- package/build/components/VirtualTable/components/TableHeader/style.js +3 -2
- package/build/components/VirtualTable/components/TableHeader/type.d.ts +10 -0
- package/build/components/VirtualTable/components/TableHeader/type.js +1 -0
- package/package.json +2 -2
- /package/build/components/VirtualTable/components/{TableHeader/components/ColumnSort → ColumnSort}/index.d.ts +0 -0
- /package/build/components/VirtualTable/components/{TableHeader/components/ColumnSort → ColumnSort}/index.js +0 -0
- /package/build/components/VirtualTable/components/{TableHeader/components/ColumnSort → ColumnSort}/style.d.ts +0 -0
- /package/build/components/VirtualTable/components/{TableHeader/components/ColumnSort → ColumnSort}/style.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BoxProps } from '@mui/material';
|
|
3
|
-
declare function CustomBackdrop(props: BoxProps): import("react
|
|
3
|
+
declare function CustomBackdrop(props: BoxProps): import("react").ReactPortal;
|
|
4
4
|
declare const _default: import("react").MemoExoticComponent<typeof CustomBackdrop>;
|
|
5
5
|
export default _default;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo } from 'react';
|
|
3
|
+
import ReactDOM from 'react-dom';
|
|
3
4
|
import { CustomBackdropStyled } from './style';
|
|
4
5
|
function CustomBackdrop(props) {
|
|
5
|
-
return _jsx(CustomBackdropStyled, Object.assign({}, props));
|
|
6
|
+
return ReactDOM.createPortal(_jsx(CustomBackdropStyled, Object.assign({}, props)), document.body);
|
|
6
7
|
}
|
|
7
8
|
export default memo(CustomBackdrop);
|
|
@@ -12,6 +12,7 @@ import { useMemo, memo, useState, useCallback } from 'react';
|
|
|
12
12
|
import { useTheme } from '@mui/material/styles';
|
|
13
13
|
import memoize from 'memoize-one';
|
|
14
14
|
import InfiniteLoader from 'react-window-infinite-loader';
|
|
15
|
+
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
15
16
|
import { TABLE_THRESHOLD, TABLE_LIST_OVER_SCAN, TABLE_ROW_HEIGHT } from '../../../constants/index.js';
|
|
16
17
|
import { useDelayToSetValue } from '../../../hooks/index.js';
|
|
17
18
|
import { isHeightNotFullyFilledByRows, isNotFoundError, isTimeoutError, hasError } from '../../../utils/index.js';
|
|
@@ -22,8 +23,7 @@ import { SheetViewTableNoData } from './components';
|
|
|
22
23
|
import ListItemWrapper from '../components/virtualScroll/ListItemWrapper';
|
|
23
24
|
import { StyledBox, StyledTableBox, StyledVirtualList, TableContainer, TableWrapper } from '../style';
|
|
24
25
|
import { SheetViewVirtualTableWrapper, PinnedStartColumnWrapper, PinnedEndColumnWrapper, MainTableWrapper, UnpinnedTableHeaderWrapper } from './style';
|
|
25
|
-
import SheetViewTableHeader from './components/SheetViewTableHeader
|
|
26
|
-
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
26
|
+
import SheetViewTableHeader from './components/SheetViewTableHeader';
|
|
27
27
|
import { usePinnedColumns } from './hooks/usePinnedColumns';
|
|
28
28
|
import { useSynchronizedScroll } from './hooks/useSynchronizedScroll';
|
|
29
29
|
const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToIndex, lastItemIndex, totalCount, isError, areAllRowsLoaded, isPinned, selectedCell, selectedColumn, onCellClick) => ({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { type TableHeadProps } from '@mui/material';
|
|
2
|
+
import { type TableHeadProps } from '@mui/material/TableHead';
|
|
3
3
|
import type { IColumnProps, IVirtualTable } from '../../../../../types/index.js';
|
|
4
4
|
interface SheetViewTableHeaderProps {
|
|
5
5
|
columns: IColumnProps[];
|
|
@@ -1,80 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import { memo
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { columnIcon, pinIcon, sortAzIcon, sortZaIcon, unpinIcon } from '../../../../../constants/index.js';
|
|
6
|
-
import ColumnFilter from '../../../components/ColumnFilter';
|
|
7
|
-
import { StyledCell } from '../../../style';
|
|
8
|
-
import { ActionIcon, ColumnIcon, PinIconContainer, StyledHeader, StyledMUITableRow, HeaderText } from '../../style';
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { StyledHeader, StyledMUITableRow } from '../../style';
|
|
4
|
+
import TableCell from './TableCell';
|
|
9
5
|
function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns = [], onColumnPin, isPinnable = false, lastColumnId, selectedColumn = null, onColumnClick, }) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const theme = useTheme();
|
|
14
|
-
const handleClick = (event) => {
|
|
15
|
-
event.stopPropagation();
|
|
16
|
-
setAnchorEl(event.currentTarget);
|
|
17
|
-
};
|
|
18
|
-
const handleClose = () => {
|
|
19
|
-
setAnchorEl(null);
|
|
20
|
-
};
|
|
21
|
-
const handleSortingOption = (columnId, order) => {
|
|
22
|
-
if (columnId) {
|
|
23
|
-
onColumnSort === null || onColumnSort === void 0 ? void 0 : onColumnSort({
|
|
24
|
-
[columnId]: order,
|
|
25
|
-
});
|
|
26
|
-
handleClose();
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
const handlePinClick = (columnId) => {
|
|
30
|
-
const isCurrentlyPinned = pinnedColumns.includes(columnId);
|
|
31
|
-
if (isCurrentlyPinned) {
|
|
32
|
-
onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId, 'unpin');
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
if (columnId === lastColumnId) {
|
|
36
|
-
onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId, 'end');
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId, 'start');
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
return (_jsxs(StyledHeader, Object.assign({ component: "nav", "data-testid": "SheetViewVirtualTable_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": "SheetViewVirtualTable_TableHeader_StyledMUITableRow" }, { children: columns.map((column, colIndex) => {
|
|
44
|
-
const { header, id, align, headerStyle, sortable, filter, pinnable } = column;
|
|
45
|
-
const isFirst = id === columns[0].id;
|
|
46
|
-
const isLast = id === columns[columns.length - 1].id;
|
|
47
|
-
const isPinned = pinnedColumns.includes(id);
|
|
48
|
-
const isDefaultPinned = !!column.isDefaultPinned;
|
|
49
|
-
const isSelected = selectedColumn === id;
|
|
50
|
-
return (_jsxs(StyledCell, Object.assign({ "data-id": id, component: "div", "data-testid": "SheetViewVirtualTable_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, "data-column-pinned": isPinned, isFirst: isFirst, isLast: isLast, isSheetView: true, onClick: (event) => {
|
|
51
|
-
onColumnClick === null || onColumnClick === void 0 ? void 0 : onColumnClick(id, event);
|
|
52
|
-
setColumnFilterEl(event.currentTarget);
|
|
53
|
-
}, sx: Object.assign({ display: 'flex', gap: theme.spacing(0.5), alignItems: 'center', justifyContent: align === 'right' ? 'flex-end' : 'flex-start', width: column.width, textAlign: align, overflow: 'unset', cursor: 'pointer', boxSizing: 'border-box', border: isSelected ? '2px solid #1F88D0' : '1px solid #F2F2F2', backgroundColor: isSelected ? '#F2F2F2' : '#FCFCFC', height: isSelected ? '100%' : 'auto', minHeight: isSelected ? '28px' : 'auto' }, headerStyle) }, { children: [typeof header === 'function' ? (header()) : (_jsx(Box, Object.assign({ "data-testid": "SheetViewTableHeader_columns_header", sx: { maxWidth: '100%', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, { children: header && _jsx(HeaderText, Object.assign({ "data-testid": "SheetViewVirtualTable_TableHeader_StyledCell_header_text" }, { children: header })) }))), filter && (_jsx(ColumnFilter, Object.assign({}, filter, { anchorEl: columnFilterEl, setAnchorEl: setColumnFilterEl, onClose: (event) => {
|
|
54
|
-
onColumnClick === null || onColumnClick === void 0 ? void 0 : onColumnClick(id, event);
|
|
55
|
-
} }))), sortable && (_jsx(Box, Object.assign({ sx: { diplay: 'flex', alignItems: 'center' } }, { children: _jsx(ColumnIcon, { onClick: sortable ? handleClick : undefined, src: columnIcon, alt: "column-icon", "data-id": id }) }))), isPinnable && pinnable && !isDefaultPinned && !isLast && (_jsx(PinIconContainer, Object.assign({ onClick: (event) => {
|
|
56
|
-
event.stopPropagation();
|
|
57
|
-
handlePinClick(id);
|
|
58
|
-
}, title: isPinned ? 'Unpin column' : 'Pin column' }, { children: _jsx("img", { src: isPinned ? unpinIcon : pinIcon, alt: "pin-icon" }) })))] }), `${id}-${colIndex}`));
|
|
59
|
-
}) })), _jsx(Dropdown, { open: open, onClose: handleClose, anchorEl: anchorEl, menuItems: [
|
|
60
|
-
{
|
|
61
|
-
label: 'Sort A-Z',
|
|
62
|
-
name: 'asc',
|
|
63
|
-
icon: _jsx(ActionIcon, { src: sortAzIcon, alt: "sort-icon" }),
|
|
64
|
-
selected: (columnsSorting === null || columnsSorting === void 0 ? void 0 : columnsSorting[(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id) || '']) === 'asc',
|
|
65
|
-
onClick: () => {
|
|
66
|
-
handleSortingOption(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id, 'asc');
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
label: 'Sort Z-A',
|
|
71
|
-
name: 'desc',
|
|
72
|
-
icon: _jsx(ActionIcon, { src: sortZaIcon, alt: "sort-icon" }),
|
|
73
|
-
selected: (columnsSorting === null || columnsSorting === void 0 ? void 0 : columnsSorting[(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id) || '']) === 'desc',
|
|
74
|
-
onClick: () => {
|
|
75
|
-
handleSortingOption(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id, 'desc');
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
] })] })));
|
|
6
|
+
return (_jsx(StyledHeader, Object.assign({ component: "nav", "data-testid": "SheetViewVirtualTable_TableHeader_StyledHeader", showBackDrop: showBackDrop }, headerProps, { children: _jsx(StyledMUITableRow, Object.assign({ component: "section", "data-testid": "SheetViewVirtualTable_TableHeader_StyledMUITableRow" }, { children: columns.map((column, colIndex) => {
|
|
7
|
+
return (_jsx(TableCell, { column: column, isFirst: column.id === columns[0].id, isLast: column.id === columns[columns.length - 1].id, isDefaultPinned: !!column.isDefaultPinned, isSelected: selectedColumn === column.id, onColumnSort: onColumnSort, columnsSorting: columnsSorting, pinnedColumns: pinnedColumns, onColumnPin: onColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, onColumnClick: onColumnClick }, `${column.id}-${colIndex}`));
|
|
8
|
+
}) })) })));
|
|
79
9
|
}
|
|
80
10
|
export default memo(SheetViewTableHeader);
|
package/build/components/VirtualTable/SheetView/components/SheetViewTableHeader/TableCell.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { IColumnProps } from '../../../../../types/index.js';
|
|
3
|
+
import { SheetViewTableHeaderProps } from './type';
|
|
4
|
+
interface TableCellProps extends Pick<SheetViewTableHeaderProps, 'onColumnSort' | 'columnsSorting' | 'onColumnPin' | 'isPinnable' | 'lastColumnId' | 'onColumnClick' | 'pinnedColumns'> {
|
|
5
|
+
column: IColumnProps;
|
|
6
|
+
isFirst: boolean;
|
|
7
|
+
isLast: boolean;
|
|
8
|
+
isSelected: boolean;
|
|
9
|
+
isDefaultPinned: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare function TableCell({ column: { header, id, align, headerStyle, sortable, filter, pinnable, width, order }, isFirst, isLast, isSelected, isDefaultPinned, onColumnSort, columnsSorting, onColumnPin, isPinnable, lastColumnId, onColumnClick, pinnedColumns, }: TableCellProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare const _default: import("react").MemoExoticComponent<typeof TableCell>;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useCallback, useMemo, useState } from 'react';
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import { pinIcon, unpinIcon } from '../../../../../constants/index.js';
|
|
5
|
+
import ColumnFilter from '../../../components/ColumnFilter';
|
|
6
|
+
import { StyledCell } from '../../../style';
|
|
7
|
+
import { PinIconContainer, HeaderText } from '../../style';
|
|
8
|
+
import ColumnSort from '../../../../VirtualTable/components/ColumnSort';
|
|
9
|
+
function TableCell({ column: { header, id, align, headerStyle, sortable, filter, pinnable, width, order }, isFirst, isLast, isSelected, isDefaultPinned, onColumnSort, columnsSorting, onColumnPin, isPinnable, lastColumnId, onColumnClick, pinnedColumns, }) {
|
|
10
|
+
const [columnFilterEl, setColumnFilterEl] = useState(null);
|
|
11
|
+
const checkIsPanned = useCallback((columnId) => pinnedColumns === null || pinnedColumns === void 0 ? void 0 : pinnedColumns.includes(columnId), [pinnedColumns]);
|
|
12
|
+
const isPinned = useMemo(() => checkIsPanned(id), [id, checkIsPanned]);
|
|
13
|
+
const handlePinClick = (columnId) => {
|
|
14
|
+
if (checkIsPanned(columnId)) {
|
|
15
|
+
onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId, 'unpin');
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
if (columnId === lastColumnId) {
|
|
19
|
+
onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId, 'end');
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId, 'start');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return (_jsxs(StyledCell, Object.assign({ "data-id": id, component: "div", "data-testid": "SheetViewVirtualTable_TableHeader_StyledCell", "data-column-id": id, "data-column-width": width, "data-column-width-used": width, "data-column-align": align, "data-column-order": order, "data-column-header": typeof header === 'string' ? header : 'component', "data-column-sortable": !!sortable, "data-column-filterable": !!filter, "data-column-pinned": isPinned, isFirst: isFirst, isLast: isLast, isSheetView: true, onClick: (event) => {
|
|
27
|
+
onColumnClick === null || onColumnClick === void 0 ? void 0 : onColumnClick(id, event);
|
|
28
|
+
setColumnFilterEl(event.currentTarget);
|
|
29
|
+
}, sx: (theme) => (Object.assign({ display: 'flex', gap: theme.spacing(0.5), alignItems: 'center', justifyContent: align === 'right' ? 'flex-end' : 'flex-start', width, textAlign: align, overflow: 'unset', cursor: 'pointer', boxSizing: 'border-box', border: isSelected ? '2px solid #1F88D0' : '1px solid #F2F2F2', backgroundColor: isSelected ? '#F2F2F2' : '#FCFCFC', height: isSelected ? '100%' : 'auto', minHeight: isSelected ? '28px' : 'auto' }, headerStyle)) }, { children: [typeof header === 'function' ? (header()) : (_jsx(Box, Object.assign({ "data-testid": "SheetViewTableHeader_columns_header", sx: { maxWidth: '100%', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, { children: header && _jsx(HeaderText, Object.assign({ "data-testid": "SheetViewVirtualTable_TableHeader_StyledCell_header_text" }, { children: header })) }))), filter && (_jsx(ColumnFilter, Object.assign({}, filter, { anchorEl: columnFilterEl, setAnchorEl: setColumnFilterEl, onClose: (event) => {
|
|
30
|
+
onColumnClick === null || onColumnClick === void 0 ? void 0 : onColumnClick(id, event);
|
|
31
|
+
} }))), sortable && _jsx(ColumnSort, { columnId: id, onColumnSort: onColumnSort, columnsSorting: columnsSorting }), isPinnable && pinnable && !isDefaultPinned && !isLast && (_jsx(PinIconContainer, Object.assign({ onClick: (event) => {
|
|
32
|
+
event.stopPropagation();
|
|
33
|
+
handlePinClick(id);
|
|
34
|
+
}, title: isPinned ? 'Unpin column' : 'Pin column' }, { children: _jsx("img", { src: isPinned ? unpinIcon : pinIcon, alt: "pin-icon" }) })))] })));
|
|
35
|
+
}
|
|
36
|
+
export default memo(TableCell);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TableHeaderProps } from '../../../../VirtualTable/components/TableHeader/type';
|
|
3
|
+
import { IColumnProps, IVirtualTable } from '../../../../../types/index.js';
|
|
4
|
+
export interface SheetViewTableHeaderProps {
|
|
5
|
+
columns: IColumnProps[];
|
|
6
|
+
headerProps?: TableHeaderProps;
|
|
7
|
+
columnsSorting?: IVirtualTable['columnsSorting'];
|
|
8
|
+
onColumnSort?: IVirtualTable['onColumnSort'];
|
|
9
|
+
showBackDrop: boolean;
|
|
10
|
+
pinnedColumns?: string[];
|
|
11
|
+
onColumnPin?: (columnId: string, position: 'start' | 'end' | 'unpin') => void;
|
|
12
|
+
isPinnable?: boolean;
|
|
13
|
+
lastColumnId?: string | null;
|
|
14
|
+
selectedColumn?: string | null;
|
|
15
|
+
onColumnClick?: (columnId: string, event: React.MouseEvent) => void;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { default as SheetViewVirtualTable } from './SheetViewVirtualTable';
|
|
2
|
-
export { default as SheetViewTableHeader } from './components/SheetViewTableHeader
|
|
2
|
+
export { default as SheetViewTableHeader } from './components/SheetViewTableHeader';
|
|
3
3
|
export * from './style';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { default as SheetViewVirtualTable } from './SheetViewVirtualTable';
|
|
2
|
-
export { default as SheetViewTableHeader } from './components/SheetViewTableHeader
|
|
2
|
+
export { default as SheetViewTableHeader } from './components/SheetViewTableHeader';
|
|
3
3
|
export * from './style';
|
|
@@ -1,26 +1,23 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const ActionIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
3
|
-
export declare const ColumnIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
4
|
-
export declare const HeaderText: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
5
|
-
export declare const PinIconContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
|
-
|
|
7
|
-
showBackDrop: boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare const StyledHeader: import("@emotion/styled").StyledComponent<import("@mui/material").TableHeadOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & {
|
|
2
|
+
export declare const ActionIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
3
|
+
export declare const ColumnIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
4
|
+
export declare const HeaderText: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
5
|
+
export declare const PinIconContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
|
+
export declare const StyledHeader: import("@emotion/styled").StyledComponent<import("@mui/material/TableHead").TableHeadOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & {
|
|
10
7
|
ref?: ((instance: HTMLTableSectionElement | null) => void) | import("react").RefObject<HTMLTableSectionElement> | null | undefined;
|
|
11
|
-
}, "className" | "style" | "classes" | "children" | "sx"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> &
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export declare const StyledMUITableRow: import("@emotion/styled").StyledComponent<import("@mui/material").TableRowOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, "ref"> & {
|
|
8
|
+
}, "className" | "style" | "classes" | "children" | "sx"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
9
|
+
showBackDrop: boolean;
|
|
10
|
+
}, {}, {}>;
|
|
11
|
+
export declare const StyledMUITableRow: import("@emotion/styled").StyledComponent<import("@mui/material/TableRow").TableRowOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, "ref"> & {
|
|
16
12
|
ref?: ((instance: HTMLTableRowElement | null) => void) | import("react").RefObject<HTMLTableRowElement> | null | undefined;
|
|
17
|
-
}, "className" | "style" | "classes" | "children" | "sx" | "hover" | "selected"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> &
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export declare const
|
|
21
|
-
export declare const
|
|
13
|
+
}, "className" | "style" | "classes" | "children" | "sx" | "hover" | "selected"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
14
|
+
component: string;
|
|
15
|
+
}, {}, {}>;
|
|
16
|
+
export declare const SheetViewVirtualTableWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
17
|
+
export declare const PinnedStartColumnWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, {}, {}>;
|
|
18
|
+
export declare const PinnedEndColumnWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, {}, {}>;
|
|
19
|
+
export declare const MainTableWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
22
20
|
hasPinnedStart: boolean;
|
|
23
21
|
hasPinnedEnd: boolean;
|
|
24
22
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
25
|
-
export declare const UnpinnedTableHeaderWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
26
|
-
export {};
|
|
23
|
+
export declare const UnpinnedTableHeaderWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { styled } from '@mui/material/styles';
|
|
2
|
-
import
|
|
2
|
+
import TableHead from '@mui/material/TableHead';
|
|
3
3
|
import MUITableRow from '@mui/material/TableRow';
|
|
4
4
|
export const ActionIcon = styled('img')(() => ({
|
|
5
5
|
width: '13.3px',
|
|
@@ -33,12 +33,13 @@ export const PinIconContainer = styled('div')(() => ({
|
|
|
33
33
|
export const StyledHeader = styled(TableHead, {
|
|
34
34
|
shouldForwardProp: (prop) => prop !== 'showBackDrop',
|
|
35
35
|
})(({ showBackDrop, theme }) => ({
|
|
36
|
-
width: '100%',
|
|
37
|
-
minWidth: 'fit-content',
|
|
38
36
|
flex: '0 0 auto',
|
|
39
37
|
boxShadow: showBackDrop ? theme.shadows[23] : 'none',
|
|
40
38
|
backgroundColor: theme.palette.background.default,
|
|
41
39
|
zIndex: 1,
|
|
40
|
+
width: '100%',
|
|
41
|
+
minWidth: 'auto',
|
|
42
|
+
overflowX: 'scroll',
|
|
42
43
|
}));
|
|
43
44
|
export const StyledMUITableRow = styled(MUITableRow)(({ theme }) => ({
|
|
44
45
|
display: 'flex',
|
|
@@ -17,7 +17,7 @@ import { TABLE_ROW_HEIGHT, TABLE_THRESHOLD, TABLE_LIST_OVER_SCAN, SHEET_VIEW_TAB
|
|
|
17
17
|
import { useDelayToSetValue } from '../../hooks/index.js';
|
|
18
18
|
import { isHeightNotFullyFilledByRows, isNotFoundError, isTimeoutError, hasError } from '../../utils/index.js';
|
|
19
19
|
import TableFooter from './components/TableFooter/TableFooter';
|
|
20
|
-
import TableHeader from './components/TableHeader
|
|
20
|
+
import TableHeader from './components/TableHeader';
|
|
21
21
|
import TableLastItem from './components/TableLastItem';
|
|
22
22
|
import TableNoData from './components/TableNoData';
|
|
23
23
|
import ListItemWrapper from './components/virtualScroll/ListItemWrapper';
|
|
@@ -53,8 +53,6 @@ function ColumnFilter(filter) {
|
|
|
53
53
|
}, [open, filter, anchorEl, setAnchorEl]);
|
|
54
54
|
return (_jsxs(_Fragment, { 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: () => {
|
|
55
55
|
filter.onClear(filterApiKeys);
|
|
56
|
-
} })] })) : (_jsx(Box, { component: "img", "data-testid": "ColumnFilter_columnIcon", src: columnIcon, alt: "column-icon", sx: { cursor: 'pointer', marginTop: '2px' }, onClick: openDropdown })), open && _jsx(CustomBackdrop, { onClick: onCloseDropdown }), _jsx(Popper, Object.assign({ open: open, anchorEl: anchorEl, placement: "bottom-start",
|
|
57
|
-
zIndex: 9999,
|
|
58
|
-
} }, { children: renderFilter }))] }));
|
|
56
|
+
} })] })) : (_jsx(Box, { component: "img", "data-testid": "ColumnFilter_columnIcon", src: columnIcon, alt: "column-icon", sx: { cursor: 'pointer', marginTop: '2px' }, onClick: openDropdown })), open && _jsx(CustomBackdrop, { onClick: onCloseDropdown }), _jsx(Popper, Object.assign({ open: open, anchorEl: anchorEl, placement: "bottom-start" }, { children: renderFilter }))] }));
|
|
59
57
|
}
|
|
60
58
|
export default memo(ColumnFilter);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { IColumnProps } from '
|
|
3
|
-
import { TableHeaderProps } from '
|
|
2
|
+
import type { IColumnProps } from '../../../../types/index.js';
|
|
3
|
+
import { TableHeaderProps } from '../TableHeader/type';
|
|
4
4
|
interface ColumnSortProps extends Pick<TableHeaderProps, 'onColumnSort' | 'columnsSorting'> {
|
|
5
5
|
columnId: IColumnProps['id'];
|
|
6
6
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useState } from 'react';
|
|
3
3
|
import Box from '@mui/material/Box';
|
|
4
|
-
import Dropdown from '
|
|
5
|
-
import { columnIcon, sortAzIcon, sortZaIcon } from '
|
|
4
|
+
import Dropdown from '../../../DropdownMenu';
|
|
5
|
+
import { columnIcon, sortAzIcon, sortZaIcon } from '../../../../constants/index.js';
|
|
6
6
|
import { ActionIcon, ColumnIcon } from './style';
|
|
7
7
|
function ColumnSort({ onColumnSort, columnsSorting, columnId }) {
|
|
8
8
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
@@ -14,15 +14,15 @@ function ColumnSort({ onColumnSort, columnsSorting, columnId }) {
|
|
|
14
14
|
const handleClose = () => {
|
|
15
15
|
setAnchorEl(null);
|
|
16
16
|
};
|
|
17
|
-
const handleSortingOption = (
|
|
18
|
-
if (
|
|
17
|
+
const handleSortingOption = (id, order) => {
|
|
18
|
+
if (id) {
|
|
19
19
|
onColumnSort === null || onColumnSort === void 0 ? void 0 : onColumnSort({
|
|
20
|
-
[
|
|
20
|
+
[id]: order,
|
|
21
21
|
});
|
|
22
22
|
handleClose();
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
return (_jsxs(
|
|
25
|
+
return (_jsxs(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' } }, { children: [_jsx(ColumnIcon, { onClick: handleClick, src: columnIcon, alt: "column-icon", "data-id": columnId }), _jsx(Dropdown, { open: open, onClose: handleClose, anchorEl: anchorEl, menuItems: [
|
|
26
26
|
{
|
|
27
27
|
label: 'Sort A-Z',
|
|
28
28
|
name: 'asc',
|
|
@@ -41,6 +41,6 @@ function ColumnSort({ onColumnSort, columnsSorting, columnId }) {
|
|
|
41
41
|
handleSortingOption(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id, 'desc');
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
|
-
] })] }));
|
|
44
|
+
] })] })));
|
|
45
45
|
}
|
|
46
46
|
export default memo(ColumnSort);
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
import type { IColumnProps, IVirtualTable } from '../../../../types/index.js';
|
|
4
|
-
export interface TableHeaderProps {
|
|
5
|
-
columns: IColumnProps[];
|
|
6
|
-
headerProps?: TableHeadProps;
|
|
7
|
-
columnsSorting?: IVirtualTable['columnsSorting'];
|
|
8
|
-
onColumnSort?: IVirtualTable['onColumnSort'];
|
|
9
|
-
showBackDrop: boolean;
|
|
10
|
-
isSheetView?: boolean;
|
|
11
|
-
}
|
|
2
|
+
import { TableHeaderProps } from './type';
|
|
12
3
|
declare function TableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, isSheetView }: TableHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
13
4
|
declare const _default: import("react").MemoExoticComponent<typeof TableHeader>;
|
|
14
5
|
export default _default;
|
|
@@ -3,7 +3,7 @@ import { memo } from 'react';
|
|
|
3
3
|
import { TableCell } from './components';
|
|
4
4
|
import { StyledHeader, StyledMUITableRow } from './style';
|
|
5
5
|
function TableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, isSheetView }) {
|
|
6
|
-
return (_jsx(StyledHeader, Object.assign({ component: "nav", "data-testid": "VirtualTable_TableHeader_StyledHeader", showBackDrop: showBackDrop }, headerProps, {
|
|
6
|
+
return (_jsx(StyledHeader, Object.assign({ component: "nav", "data-testid": "VirtualTable_TableHeader_StyledHeader", showBackDrop: showBackDrop }, headerProps, { children: _jsx(StyledMUITableRow, Object.assign({ component: "section", "data-testid": "VirtualTable_TableHeader_StyledMUITableRow", isSheetView: isSheetView }, { 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, onColumnSort: onColumnSort, columnsSorting: columnsSorting, isSheetView: isSheetView }, `${column.id}-${colIndex}`));
|
|
8
8
|
}) })) })));
|
|
9
9
|
}
|
package/build/components/VirtualTable/components/TableHeader/components/TableCell/TableCell.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IColumnProps } from '../../../../../../types/index.js';
|
|
2
|
-
import { TableHeaderProps } from '
|
|
2
|
+
import { TableHeaderProps } from '../../../../../VirtualTable/components/TableHeader';
|
|
3
3
|
interface TableCellProps extends Pick<TableHeaderProps, 'onColumnSort' | 'isSheetView' | 'columnsSorting'> {
|
|
4
4
|
column: IColumnProps;
|
|
5
5
|
isFirst: boolean;
|
package/build/components/VirtualTable/components/TableHeader/components/TableCell/TableCell.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import Box from '@mui/material/Box';
|
|
4
|
-
import ColumnFilter from '
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import ColumnFilter from '../../../../../VirtualTable/components/ColumnFilter';
|
|
5
|
+
import ColumnSort from '../../../../../VirtualTable/components/ColumnSort';
|
|
6
|
+
import { StyledCell } from '../../../../../VirtualTable/style';
|
|
7
7
|
export function TableCell({ column: { header, id, align, headerStyle, sortable, filter, width, order }, isFirst, isLast, isSheetView, onColumnSort, columnsSorting, }) {
|
|
8
8
|
const [columnFilterEl, setColumnFilterEl] = useState(null);
|
|
9
9
|
return (_jsxs(StyledCell, Object.assign({ "data-id": id, component: "div", "data-testid": "VirtualTable_TableHeader_StyledCell", "data-column-id": id, "data-column-width": width, "data-column-width-used": width, "data-column-align": align, "data-column-order": order, "data-column-header": typeof header === 'string' ? header : 'component', "data-column-sortable": !!sortable, "data-column-filterable": !!filter, isFirst: isFirst, isLast: isLast, onClick: (event) => {
|
|
@@ -4,12 +4,13 @@ import MUITableRow from '@mui/material/TableRow';
|
|
|
4
4
|
export const StyledHeader = styled(TableHead, {
|
|
5
5
|
shouldForwardProp: (prop) => prop !== 'showBackDrop',
|
|
6
6
|
})(({ showBackDrop, theme }) => ({
|
|
7
|
-
width: '100%',
|
|
8
|
-
minWidth: 'fit-content',
|
|
9
7
|
flex: '0 0 auto',
|
|
10
8
|
boxShadow: showBackDrop ? theme.shadows[23] : 'none',
|
|
11
9
|
backgroundColor: theme.palette.background.default,
|
|
12
10
|
zIndex: 1,
|
|
11
|
+
width: '100%',
|
|
12
|
+
minWidth: 'auto',
|
|
13
|
+
overflowX: 'scroll',
|
|
13
14
|
}));
|
|
14
15
|
export const StyledMUITableRow = styled(MUITableRow, {
|
|
15
16
|
shouldForwardProp: (prop) => prop !== 'isSheetView',
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type TableHeadProps } from '@mui/material/TableHead';
|
|
2
|
+
import type { IColumnProps, IVirtualTable } from '../../../../types/index.js';
|
|
3
|
+
export interface TableHeaderProps {
|
|
4
|
+
columns: IColumnProps[];
|
|
5
|
+
headerProps?: TableHeadProps;
|
|
6
|
+
columnsSorting?: IVirtualTable['columnsSorting'];
|
|
7
|
+
onColumnSort?: IVirtualTable['onColumnSort'];
|
|
8
|
+
showBackDrop: boolean;
|
|
9
|
+
isSheetView?: boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
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.0.273-test.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.0.273-test.12",
|
|
5
|
+
"testVersion": 12,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|