@tap-payments/os-micro-frontend-shared 0.0.273-test.1 → 0.0.273-test.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.
Files changed (56) hide show
  1. package/build/components/VirtualTable/SheetView/SheetViewVirtualTable.js +2 -2
  2. package/build/components/VirtualTable/SheetView/{SheetViewTableHeader.d.ts → components/SheetViewTableHeader/SheetViewTableHeader.d.ts} +2 -2
  3. package/build/components/VirtualTable/SheetView/components/SheetViewTableHeader/SheetViewTableHeader.js +10 -0
  4. package/build/components/VirtualTable/SheetView/components/SheetViewTableHeader/TableCell.d.ts +13 -0
  5. package/build/components/VirtualTable/SheetView/components/SheetViewTableHeader/TableCell.js +53 -0
  6. package/build/components/VirtualTable/SheetView/components/SheetViewTableHeader/index.d.ts +2 -0
  7. package/build/components/VirtualTable/SheetView/components/SheetViewTableHeader/index.js +2 -0
  8. package/build/components/VirtualTable/SheetView/components/SheetViewTableHeader/type.d.ts +16 -0
  9. package/build/components/VirtualTable/SheetView/components/SheetViewTableHeader/type.js +1 -0
  10. package/build/components/VirtualTable/SheetView/index.d.ts +1 -1
  11. package/build/components/VirtualTable/SheetView/index.js +1 -1
  12. package/build/components/VirtualTable/SheetView/style.d.ts +17 -20
  13. package/build/components/VirtualTable/SheetView/style.js +5 -3
  14. package/build/components/VirtualTable/components/ColumnFilter/ColumnFilter.d.ts +2 -2
  15. package/build/components/VirtualTable/components/ColumnFilter/ColumnFilter.js +11 -10
  16. package/build/components/VirtualTable/components/ColumnFilter/Inputs/Inputs.d.ts +2 -1
  17. package/build/components/VirtualTable/components/ColumnFilter/Inputs/Inputs.js +4 -4
  18. package/build/components/VirtualTable/components/ColumnFilter/List/List.d.ts +2 -2
  19. package/build/components/VirtualTable/components/ColumnFilter/List/List.js +4 -4
  20. package/build/components/VirtualTable/components/ColumnFilter/type.d.ts +7 -0
  21. package/build/components/VirtualTable/components/ColumnFilter/type.js +1 -0
  22. package/build/components/VirtualTable/components/ColumnSort/ColumnSort.d.ts +9 -0
  23. package/build/components/VirtualTable/components/ColumnSort/ColumnSort.js +46 -0
  24. package/build/components/VirtualTable/components/ColumnSort/index.d.ts +2 -0
  25. package/build/components/VirtualTable/components/ColumnSort/index.js +2 -0
  26. package/build/components/VirtualTable/components/ColumnSort/style.d.ts +3 -0
  27. package/build/components/VirtualTable/components/ColumnSort/style.js +10 -0
  28. package/build/components/VirtualTable/components/TableHeader/TableHeader.d.ts +5 -0
  29. package/build/components/VirtualTable/components/TableHeader/TableHeader.js +10 -0
  30. package/build/components/VirtualTable/components/TableHeader/components/TableCell/TableCell.d.ts +9 -0
  31. package/build/components/VirtualTable/components/TableHeader/components/TableCell/TableCell.js +12 -0
  32. package/build/components/VirtualTable/components/TableHeader/components/TableCell/index.d.ts +2 -0
  33. package/build/components/VirtualTable/components/TableHeader/components/TableCell/index.js +2 -0
  34. package/build/components/VirtualTable/components/TableHeader/components/index.d.ts +1 -0
  35. package/build/components/VirtualTable/components/TableHeader/components/index.js +1 -0
  36. package/build/components/VirtualTable/components/TableHeader/constant.d.ts +5 -0
  37. package/build/components/VirtualTable/components/TableHeader/constant.js +6 -0
  38. package/build/components/VirtualTable/components/TableHeader/index.d.ts +3 -0
  39. package/build/components/VirtualTable/components/TableHeader/index.js +3 -0
  40. package/build/components/VirtualTable/components/TableHeader/style.d.ts +12 -0
  41. package/build/components/VirtualTable/components/TableHeader/style.js +23 -0
  42. package/build/components/VirtualTable/components/TableHeader/type.d.ts +10 -0
  43. package/build/components/VirtualTable/components/TableHeader/type.js +1 -0
  44. package/build/components/VirtualTable/components/TableNoData.d.ts +1 -1
  45. package/build/components/VirtualTable/components/TableNoData.js +22 -3
  46. package/build/components/VirtualTable/components/index.d.ts +0 -1
  47. package/build/components/VirtualTable/components/index.js +0 -1
  48. package/build/components/VirtualTable/style.js +1 -1
  49. package/build/components/index.d.ts +1 -1
  50. package/build/components/index.js +1 -1
  51. package/package.json +2 -2
  52. package/build/components/VirtualTable/SheetView/SheetViewTableHeader.js +0 -73
  53. package/build/components/VirtualTable/components/TableError.d.ts +0 -11
  54. package/build/components/VirtualTable/components/TableError.js +0 -23
  55. package/build/components/VirtualTable/components/TableHeader.d.ts +0 -27
  56. package/build/components/VirtualTable/components/TableHeader.js +0 -87
@@ -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 './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,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { type TableHeadProps } from '@mui/material';
3
- import type { IColumnProps, IVirtualTable } from '../../../types/index.js';
2
+ import { type TableHeadProps } from '@mui/material/TableHead';
3
+ import type { IColumnProps, IVirtualTable } from '../../../../../types/index.js';
4
4
  interface SheetViewTableHeaderProps {
5
5
  columns: IColumnProps[];
6
6
  headerProps?: TableHeadProps;
@@ -0,0 +1,10 @@
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';
5
+ function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns = [], onColumnPin, isPinnable = false, lastColumnId, selectedColumn = null, onColumnClick, }) {
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
+ }) })) })));
9
+ }
10
+ export default memo(SheetViewTableHeader);
@@ -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,53 @@
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 [anchorEl, setAnchorEl] = useState(null);
12
+ const open = Boolean(anchorEl);
13
+ const checkIsPanned = useCallback((columnId) => pinnedColumns === null || pinnedColumns === void 0 ? void 0 : pinnedColumns.includes(columnId), [pinnedColumns]);
14
+ const isPinned = useMemo(() => checkIsPanned(id), [id, checkIsPanned]);
15
+ const handleClose = () => {
16
+ setAnchorEl(null);
17
+ };
18
+ const handleClick = (event) => {
19
+ event.stopPropagation();
20
+ setAnchorEl(event.currentTarget);
21
+ };
22
+ const handlePinClick = (columnId) => {
23
+ if (checkIsPanned(columnId)) {
24
+ onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId, 'unpin');
25
+ }
26
+ else {
27
+ if (columnId === lastColumnId) {
28
+ onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId, 'end');
29
+ }
30
+ else {
31
+ onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId, 'start');
32
+ }
33
+ }
34
+ };
35
+ const handleSortingOption = (columnId, columnOrder) => {
36
+ if (columnId) {
37
+ onColumnSort === null || onColumnSort === void 0 ? void 0 : onColumnSort({
38
+ [columnId]: columnOrder,
39
+ });
40
+ handleClose();
41
+ }
42
+ };
43
+ 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) => {
44
+ onColumnClick === null || onColumnClick === void 0 ? void 0 : onColumnClick(id, event);
45
+ setColumnFilterEl(event.currentTarget);
46
+ }, 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) => {
47
+ onColumnClick === null || onColumnClick === void 0 ? void 0 : onColumnClick(id, event);
48
+ } }))), sortable && _jsx(ColumnSort, { columnId: id, onColumnSort: onColumnSort, columnsSorting: columnsSorting }), isPinnable && pinnable && !isDefaultPinned && !isLast && (_jsx(PinIconContainer, Object.assign({ onClick: (event) => {
49
+ event.stopPropagation();
50
+ handlePinClick(id);
51
+ }, title: isPinned ? 'Unpin column' : 'Pin column' }, { children: _jsx("img", { src: isPinned ? unpinIcon : pinIcon, alt: "pin-icon" }) })))] })));
52
+ }
53
+ export default memo(TableCell);
@@ -0,0 +1,2 @@
1
+ import SheetViewTableHeader from './SheetViewTableHeader';
2
+ export default SheetViewTableHeader;
@@ -0,0 +1,2 @@
1
+ import SheetViewTableHeader from './SheetViewTableHeader';
2
+ export default SheetViewTableHeader;
@@ -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
+ }
@@ -1,3 +1,3 @@
1
1
  export { default as SheetViewVirtualTable } from './SheetViewVirtualTable';
2
- export { default as SheetViewTableHeader } from './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 './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
- interface StyledHeaderProps {
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> & StyledHeaderProps, {}, {}>;
12
- interface StyledMUITableRowProps {
13
- component: string;
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> & StyledMUITableRowProps, {}, {}>;
18
- export declare const SheetViewVirtualTableWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
19
- export declare const PinnedStartColumnWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, {}, {}>;
20
- export declare const PinnedEndColumnWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, {}, {}>;
21
- export declare const MainTableWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
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 { TableHead } from '@mui/material';
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',
@@ -9,6 +9,7 @@ export const ColumnIcon = styled('img')(() => ({
9
9
  width: '8px',
10
10
  height: '6.4px',
11
11
  cursor: 'pointer',
12
+ marginTop: '2px',
12
13
  }));
13
14
  export const HeaderText = styled('span')(({ theme }) => ({
14
15
  color: theme.palette.text.primary,
@@ -32,12 +33,13 @@ export const PinIconContainer = styled('div')(() => ({
32
33
  export const StyledHeader = styled(TableHead, {
33
34
  shouldForwardProp: (prop) => prop !== 'showBackDrop',
34
35
  })(({ showBackDrop, theme }) => ({
35
- width: '100%',
36
- minWidth: 'fit-content',
37
36
  flex: '0 0 auto',
38
37
  boxShadow: showBackDrop ? theme.shadows[23] : 'none',
39
38
  backgroundColor: theme.palette.background.default,
40
39
  zIndex: 1,
40
+ width: '100%',
41
+ minWidth: 'auto',
42
+ overflowX: 'scroll',
41
43
  }));
42
44
  export const StyledMUITableRow = styled(MUITableRow)(({ theme }) => ({
43
45
  display: 'flex',
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { IColumnFilter } from '../../../../types/index.js';
3
- declare function ColumnFilter(filter: IColumnFilter): import("react/jsx-runtime").JSX.Element;
2
+ import { ColumnFilterProps } from './type';
3
+ declare function ColumnFilter(filter: ColumnFilterProps): import("react/jsx-runtime").JSX.Element;
4
4
  declare const _default: import("react").MemoExoticComponent<typeof ColumnFilter>;
5
5
  export default _default;
@@ -1,7 +1,6 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { memo, useMemo, useState } from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { memo, useMemo } from 'react';
3
3
  import Box from '@mui/material/Box';
4
- import ClickAwayListener from '@mui/material/ClickAwayListener';
5
4
  import Popper from '@mui/material/Popper';
6
5
  import { closeIcon, columnIcon, whiteFilterIcon } from '../../../../constants/index.js';
7
6
  import Inputs from './Inputs';
@@ -9,12 +8,14 @@ import List from './List';
9
8
  import { FilterWrapper } from './style';
10
9
  import CustomBackdrop from '../../../CustomBackdrop';
11
10
  function ColumnFilter(filter) {
12
- const [anchorEl, setAnchorEl] = useState(null);
11
+ const { anchorEl, setAnchorEl, onClose } = filter;
13
12
  const openDropdown = (event) => {
14
13
  setAnchorEl(event.currentTarget);
15
14
  };
16
- const onCloseDropdown = () => {
15
+ const onCloseDropdown = (event) => {
16
+ event.stopPropagation();
17
17
  setAnchorEl(null);
18
+ onClose === null || onClose === void 0 ? void 0 : onClose(event);
18
19
  };
19
20
  const filterData = useMemo(() => { var _a; return ((_a = filter === null || filter === void 0 ? void 0 : filter.options) === null || _a === void 0 ? void 0 : _a.reduce((acc, { apiKey }) => { var _a; return (Object.assign(Object.assign({}, acc), { [apiKey]: (_a = filter === null || filter === void 0 ? void 0 : filter.data) === null || _a === void 0 ? void 0 : _a[apiKey] })); }, {})) || {}; }, [filter]);
20
21
  const listFilterData = useMemo(() => {
@@ -50,10 +51,10 @@ function ColumnFilter(filter) {
50
51
  }
51
52
  return null;
52
53
  }, [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: 'flex', alignItems: 'center' } }, { 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
- filter.onClear(filterApiKeys);
55
- } })] })) : (_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", sx: {
56
- zIndex: 9999,
57
- } }, { children: renderFilter }))] })) })));
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
+ 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", sx: {
57
+ zIndex: 9999,
58
+ } }, { children: renderFilter }))] }));
58
59
  }
59
60
  export default memo(ColumnFilter);
@@ -1,6 +1,7 @@
1
+ import { MouseEvent } from 'react';
1
2
  import type { IColumnFilter, IColumnFilterInputs } from '../../../../../types/index.js';
2
3
  interface InputsI {
3
- onCloseDropdown: () => void;
4
+ onCloseDropdown: (e: MouseEvent<HTMLElement>) => void;
4
5
  filter: IColumnFilter & IColumnFilterInputs;
5
6
  }
6
7
  declare function Inputs({ onCloseDropdown, filter: { options, onConfirm, data, isOnlyOneFilter, onColumnFilterClearClick, wrapperSx } }: InputsI): import("react/jsx-runtime").JSX.Element;
@@ -13,12 +13,12 @@ function Inputs({ onCloseDropdown, filter: { options = [], onConfirm, data, isOn
13
13
  setValues((options || []).reduce((acc, { apiKey }) => { var _a; return (Object.assign(Object.assign({}, acc), { [apiKey]: (_a = data === null || data === void 0 ? void 0 : data[apiKey]) !== null && _a !== void 0 ? _a : '' })); }, {}));
14
14
  }, []);
15
15
  const { t } = useTranslation();
16
- const onClickOkay = () => {
16
+ const onClickOkay = (e) => {
17
17
  onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm(values);
18
- onCloseDropdown();
18
+ onCloseDropdown(e);
19
19
  };
20
- const onClickCancel = () => {
21
- onCloseDropdown();
20
+ const onClickCancel = (e) => {
21
+ onCloseDropdown(e);
22
22
  };
23
23
  const onClickClear = () => {
24
24
  onColumnFilterClearClick === null || onColumnFilterClearClick === void 0 ? void 0 : onColumnFilterClearClick();
@@ -1,7 +1,7 @@
1
- import React from 'react';
1
+ import React, { MouseEvent } from 'react';
2
2
  import type { IColumnFilter, IColumnFilterList } from '../../../../../types/index.js';
3
3
  interface ListI {
4
- onCloseDropdown: () => void;
4
+ onCloseDropdown: (e: MouseEvent<HTMLElement>) => void;
5
5
  filter: IColumnFilter & IColumnFilterList;
6
6
  styles?: React.CSSProperties;
7
7
  }
@@ -25,10 +25,10 @@ function List({ onCloseDropdown, filter, styles }) {
25
25
  if (filter.options)
26
26
  setItemsList(renderItems(filter.options));
27
27
  }, [filter === null || filter === void 0 ? void 0 : filter.data]);
28
- const onClickCancel = () => {
29
- onCloseDropdown();
28
+ const onClickCancel = (e) => {
29
+ onCloseDropdown(e);
30
30
  };
31
- const onClickOkay = () => {
31
+ const onClickOkay = (e) => {
32
32
  var _a;
33
33
  const selectedValues = values.reduce((acc, { options, apiKey: parentKey, isSelected: isParentSelected }) => {
34
34
  if (options) {
@@ -45,7 +45,7 @@ function List({ onCloseDropdown, filter, styles }) {
45
45
  const selectedValueSet = new Set(selectedValues);
46
46
  if (Object.keys(values).length)
47
47
  (_a = filter === null || filter === void 0 ? void 0 : filter.onConfirm) === null || _a === void 0 ? void 0 : _a.call(filter, { [filter.apiKey]: [...selectedValueSet] });
48
- onCloseDropdown();
48
+ onCloseDropdown(e);
49
49
  };
50
50
  const onUpdateMenuItems = (latestMenuItems) => {
51
51
  const resetItems = (items) => items.map(({ name, selected, menuItems, label }) => (Object.assign(Object.assign(Object.assign({}, (label && { placeholder: label })), { apiKey: name, isSelected: selected }), ((menuItems === null || menuItems === void 0 ? void 0 : menuItems.length) && { options: resetItems(menuItems) }))));
@@ -0,0 +1,7 @@
1
+ import { MouseEvent } from 'react';
2
+ import { IColumnFilter } from '../../../../types/index.js';
3
+ export type ColumnFilterProps = IColumnFilter & {
4
+ anchorEl: HTMLElement | null;
5
+ setAnchorEl: (el: HTMLElement | null) => void;
6
+ onClose?: (e: MouseEvent<HTMLElement>) => void;
7
+ };
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import type { IColumnProps } from '../../../../types/index.js';
3
+ import { TableHeaderProps } from '../TableHeader/type';
4
+ interface ColumnSortProps extends Pick<TableHeaderProps, 'onColumnSort' | 'columnsSorting'> {
5
+ columnId: IColumnProps['id'];
6
+ }
7
+ declare function ColumnSort({ onColumnSort, columnsSorting, columnId }: ColumnSortProps): import("react/jsx-runtime").JSX.Element;
8
+ declare const _default: import("react").MemoExoticComponent<typeof ColumnSort>;
9
+ export default _default;
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo, useState } from 'react';
3
+ import Box from '@mui/material/Box';
4
+ import Dropdown from '../../../DropdownMenu';
5
+ import { columnIcon, sortAzIcon, sortZaIcon } from '../../../../constants/index.js';
6
+ import { ActionIcon, ColumnIcon } from './style';
7
+ function ColumnSort({ onColumnSort, columnsSorting, columnId }) {
8
+ const [anchorEl, setAnchorEl] = useState(null);
9
+ const open = Boolean(anchorEl);
10
+ const handleClick = (event) => {
11
+ event.stopPropagation();
12
+ setAnchorEl(event.currentTarget);
13
+ };
14
+ const handleClose = () => {
15
+ setAnchorEl(null);
16
+ };
17
+ const handleSortingOption = (id, order) => {
18
+ if (id) {
19
+ onColumnSort === null || onColumnSort === void 0 ? void 0 : onColumnSort({
20
+ [id]: order,
21
+ });
22
+ handleClose();
23
+ }
24
+ };
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
+ {
27
+ label: 'Sort A-Z',
28
+ name: 'asc',
29
+ icon: _jsx(ActionIcon, { src: sortAzIcon, alt: "sort-icon" }),
30
+ selected: (columnsSorting === null || columnsSorting === void 0 ? void 0 : columnsSorting[(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id) || '']) === 'asc',
31
+ onClick: () => {
32
+ handleSortingOption(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id, 'asc');
33
+ },
34
+ },
35
+ {
36
+ label: 'Sort Z-A',
37
+ name: 'desc',
38
+ icon: _jsx(ActionIcon, { src: sortZaIcon, alt: "sort-icon" }),
39
+ selected: (columnsSorting === null || columnsSorting === void 0 ? void 0 : columnsSorting[(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id) || '']) === 'desc',
40
+ onClick: () => {
41
+ handleSortingOption(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id, 'desc');
42
+ },
43
+ },
44
+ ] })] })));
45
+ }
46
+ export default memo(ColumnSort);
@@ -0,0 +1,2 @@
1
+ import ColumnSort from './ColumnSort';
2
+ export default ColumnSort;
@@ -0,0 +1,2 @@
1
+ import ColumnSort from './ColumnSort';
2
+ export default ColumnSort;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
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>, {}>;
@@ -0,0 +1,10 @@
1
+ import { styled } from '@mui/material/styles';
2
+ export const ActionIcon = styled('img')(() => ({
3
+ width: '13.3px',
4
+ height: '13.3px',
5
+ }));
6
+ export const ColumnIcon = styled('img')(() => ({
7
+ width: '8px',
8
+ height: '6.4px',
9
+ cursor: 'pointer',
10
+ }));
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { TableHeaderProps } from './type';
3
+ declare function TableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, isSheetView }: TableHeaderProps): import("react/jsx-runtime").JSX.Element;
4
+ declare const _default: import("react").MemoExoticComponent<typeof TableHeader>;
5
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import { TableCell } from './components';
4
+ import { StyledHeader, StyledMUITableRow } from './style';
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, { children: _jsx(StyledMUITableRow, Object.assign({ component: "section", "data-testid": "VirtualTable_TableHeader_StyledMUITableRow", isSheetView: isSheetView }, { 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, onColumnSort: onColumnSort, columnsSorting: columnsSorting, isSheetView: isSheetView }, `${column.id}-${colIndex}`));
8
+ }) })) })));
9
+ }
10
+ export default memo(TableHeader);
@@ -0,0 +1,9 @@
1
+ import type { IColumnProps } from '../../../../../../types/index.js';
2
+ import { TableHeaderProps } from '../../../../../VirtualTable/components/TableHeader';
3
+ interface TableCellProps extends Pick<TableHeaderProps, 'onColumnSort' | 'isSheetView' | 'columnsSorting'> {
4
+ column: IColumnProps;
5
+ isFirst: boolean;
6
+ isLast: boolean;
7
+ }
8
+ export declare function TableCell({ column: { header, id, align, headerStyle, sortable, filter, width, order }, isFirst, isLast, isSheetView, onColumnSort, columnsSorting, }: TableCellProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import Box from '@mui/material/Box';
4
+ import ColumnFilter from '../../../../../VirtualTable/components/ColumnFilter';
5
+ import ColumnSort from '../../../../../VirtualTable/components/ColumnSort';
6
+ import { StyledCell } from '../../../../../VirtualTable/style';
7
+ export function TableCell({ column: { header, id, align, headerStyle, sortable, filter, width, order }, isFirst, isLast, isSheetView, onColumnSort, columnsSorting, }) {
8
+ const [columnFilterEl, setColumnFilterEl] = useState(null);
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) => {
10
+ setColumnFilterEl(event.currentTarget);
11
+ }, sx: (theme) => (Object.assign({ paddingInline: '0.6875rem', paddingLeft: isFirst ? '0' : '0.6875rem', paddingRight: isLast ? '0' : '0.6875rem', display: 'flex', gap: theme.spacing(0.5), alignItems: 'center', justifyContent: align === 'right' ? 'flex-end' : 'flex-start', width: width, textAlign: align, overflow: 'unset', fontWeight: 600 }, headerStyle)), isSheetView: isSheetView }, { 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, { anchorEl: columnFilterEl, setAnchorEl: setColumnFilterEl })), sortable && _jsx(ColumnSort, { onColumnSort: onColumnSort, columnsSorting: columnsSorting, columnId: id })] })));
12
+ }
@@ -0,0 +1,2 @@
1
+ import { TableCell } from './TableCell';
2
+ export default TableCell;
@@ -0,0 +1,2 @@
1
+ import { TableCell } from './TableCell';
2
+ export default TableCell;
@@ -0,0 +1 @@
1
+ export { default as TableCell } from './TableCell';
@@ -0,0 +1 @@
1
+ export { default as TableCell } from './TableCell';
@@ -0,0 +1,5 @@
1
+ export declare const actionsIcons: {
2
+ flag: string;
3
+ dispute: string;
4
+ refund: string;
5
+ };
@@ -0,0 +1,6 @@
1
+ import { disputeIcon, flagIcon, refundInitiatedIcon } from '../../../../constants/index.js';
2
+ export const actionsIcons = {
3
+ flag: flagIcon,
4
+ dispute: disputeIcon,
5
+ refund: refundInitiatedIcon,
6
+ };
@@ -0,0 +1,3 @@
1
+ import TableHeader from './TableHeader';
2
+ export * from './type';
3
+ export default TableHeader;
@@ -0,0 +1,3 @@
1
+ import TableHeader from './TableHeader';
2
+ export * from './type';
3
+ export default TableHeader;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ 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"> & {
3
+ ref?: ((instance: HTMLTableSectionElement | null) => void) | import("react").RefObject<HTMLTableSectionElement> | null | undefined;
4
+ }, "className" | "style" | "classes" | "children" | "sx"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
5
+ showBackDrop: boolean;
6
+ }, {}, {}>;
7
+ 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"> & {
8
+ ref?: ((instance: HTMLTableRowElement | null) => void) | import("react").RefObject<HTMLTableRowElement> | null | undefined;
9
+ }, "className" | "style" | "classes" | "children" | "sx" | "hover" | "selected"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
10
+ isSheetView?: boolean | undefined;
11
+ component: string;
12
+ }, {}, {}>;
@@ -0,0 +1,23 @@
1
+ import { styled } from '@mui/material/styles';
2
+ import TableHead from '@mui/material/TableHead';
3
+ import MUITableRow from '@mui/material/TableRow';
4
+ export const StyledHeader = styled(TableHead, {
5
+ shouldForwardProp: (prop) => prop !== 'showBackDrop',
6
+ })(({ showBackDrop, theme }) => ({
7
+ flex: '0 0 auto',
8
+ boxShadow: showBackDrop ? theme.shadows[23] : 'none',
9
+ backgroundColor: theme.palette.background.default,
10
+ zIndex: 1,
11
+ width: '100%',
12
+ minWidth: 'auto',
13
+ overflowX: 'scroll',
14
+ }));
15
+ export const StyledMUITableRow = styled(MUITableRow, {
16
+ shouldForwardProp: (prop) => prop !== 'isSheetView',
17
+ })(({ theme, isSheetView }) => (Object.assign({ display: 'flex', justifyContent: 'flex-start', width: '100%', minWidth: 'fit-content', paddingInline: '32px', paddingBlock: '16px' }, (isSheetView && {
18
+ height: '28px',
19
+ borderBottom: `1px solid ${theme.palette.divider}`,
20
+ backgroundColor: theme.palette.primary.light,
21
+ paddingInline: 0,
22
+ paddingBlock: 0,
23
+ }))));
@@ -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
+ }
@@ -10,7 +10,7 @@ interface TableNoDataProps {
10
10
  triggerDataRefetch: () => Promise<unknown>;
11
11
  footerProps: IVirtualTable['footerProps'];
12
12
  }
13
- declare function TableNoData({ error, tableEmpty, isTimeoutError, tableError, tableLoading, orderedColumns, triggerDataRefetch, footerProps, }: TableNoDataProps): import("react/jsx-runtime").JSX.Element;
13
+ declare function TableNoData({ error, tableEmpty, isTimeoutError, tableError, tableLoading, orderedColumns, triggerDataRefetch, footerProps, }: TableNoDataProps): JSX.Element;
14
14
  declare namespace TableNoData {
15
15
  var displayName: string;
16
16
  }
@@ -1,13 +1,32 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { memo } from 'react';
3
+ import { backendErrorHandler } from '../../../utils/index.js';
4
+ import EmptyList from './EmptyList/EmptyList';
5
+ import ErrorList from './ErrorList/ErrorList';
3
6
  import TableLoading from './TableLoading';
4
7
  import { StyledSolidBackground } from '../style';
5
- import TableError from './TableError';
6
8
  function TableNoData({ error, tableEmpty, isTimeoutError, tableError, tableLoading, orderedColumns, triggerDataRefetch, footerProps, }) {
9
+ let content;
7
10
  if (tableLoading) {
8
- return (_jsx(StyledSolidBackground, Object.assign({ "data-testid": "VirtualTable_SolidBackground" }, { children: _jsx(TableLoading, { "data-testid": "VirtualTable_TableLoading", columns: orderedColumns, isLoading: true }) })));
11
+ content = (_jsx(StyledSolidBackground, Object.assign({ "data-testid": "VirtualTable_SolidBackground" }, { children: _jsx(TableLoading, { "data-testid": "VirtualTable_TableLoading", columns: orderedColumns, isLoading: true }) })));
9
12
  }
10
- return (_jsx(TableError, { isTimeoutError: isTimeoutError, tableEmpty: tableEmpty, tableError: tableError, sandboxMode: footerProps === null || footerProps === void 0 ? void 0 : footerProps.sandboxMode, error: error, triggerDataRefetch: triggerDataRefetch }));
13
+ else if (isTimeoutError) {
14
+ content = (_jsx(ErrorList, { "data-testid": "VirtualTable_ErrorList_timeoutError", shouldMinimizeWidth: true, heading: "timeOut", message: "yourRequestOutPleaseTryAgain", triggerDataRefetch: triggerDataRefetch, sandboxMode: footerProps === null || footerProps === void 0 ? void 0 : footerProps.sandboxMode }));
15
+ }
16
+ else if (tableError) {
17
+ const axiosErr = error;
18
+ const { formatted } = backendErrorHandler({ error: axiosErr, fallbackMessage: 'connectionErrorMsg' });
19
+ content = (_jsx(ErrorList, { "data-testid": "VirtualTable_ErrorList_tableError", heading: "somethingWentWrong", message: formatted, triggerDataRefetch: triggerDataRefetch, sandboxMode: footerProps === null || footerProps === void 0 ? void 0 : footerProps.sandboxMode }));
20
+ }
21
+ else if (tableEmpty) {
22
+ const axiosErr = error;
23
+ const { formatted } = backendErrorHandler({ error: axiosErr, fallbackMessage: 'tryAdjustingTheDateOrFilters' });
24
+ content = _jsx(EmptyList, { sandboxMode: footerProps === null || footerProps === void 0 ? void 0 : footerProps.sandboxMode, heading: "nothingFound", message: formatted });
25
+ }
26
+ else {
27
+ content = (_jsx(ErrorList, { "data-testid": "VirtualTable_ErrorList_tableError", heading: "somethingWentWrong", message: "connectionErrorMsg", triggerDataRefetch: triggerDataRefetch, sandboxMode: footerProps === null || footerProps === void 0 ? void 0 : footerProps.sandboxMode }));
28
+ }
29
+ return content;
11
30
  }
12
31
  TableNoData.displayName = 'TableNoData';
13
32
  export default memo(TableNoData);
@@ -3,7 +3,6 @@ export * from './EmptyList';
3
3
  export * from './ErrorList';
4
4
  export * from './TableFooter';
5
5
  export { default as TableFooter } from './TableFooter';
6
- export { default as TableError } from './TableError';
7
6
  export * from './virtualScroll';
8
7
  export * from './RowErrorState';
9
8
  export { default as TableHeader } from './TableHeader';
@@ -3,7 +3,6 @@ export * from './EmptyList';
3
3
  export * from './ErrorList';
4
4
  export * from './TableFooter';
5
5
  export { default as TableFooter } from './TableFooter';
6
- export { default as TableError } from './TableError';
7
6
  export * from './virtualScroll';
8
7
  export * from './RowErrorState';
9
8
  export { default as TableHeader } from './TableHeader';
@@ -29,7 +29,7 @@ export const StyledSolidBackground = styled(Box)(({ theme }) => ({
29
29
  backgroundColor: theme.palette.background.default,
30
30
  }));
31
31
  export const StyledCell = styled(TableCell, {
32
- shouldForwardProp: (prop) => !['isLast', 'isFirst', 'isSheetView'].includes(prop),
32
+ shouldForwardProp: (prop) => !['isLast', 'isFirst', 'isSheetView', 'isSelected'].includes(prop),
33
33
  })(({ theme, isLast, isFirst, isSheetView, isSelected }) => (Object.assign(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' }, (isSheetView && {
34
34
  borderRight: isLast ? 'none' : `1px solid ${theme.palette.divider}`,
35
35
  paddingInline: '8px !important',
@@ -12,7 +12,7 @@ export { default as Checkbox } from './Checkbox';
12
12
  export { default as Dialog, DialogToolbar } from './Dialog';
13
13
  export { default as Tooltip } from './Tooltip';
14
14
  export * from './RFH';
15
- export { default as VirtualTable, TableRowLoading, TableHeader as VirtualTableHeader, TableLastItem, TableLoading, TableLoadingWithCard, TableNoData, TableNoDataWithCard, LastRowContent, ListItemWrapperWithCard, RowErrorState, StyledItemWrapper, TableRow, TableRowLoadingWithCard, TableRowWithCard, VirtualScrollInner, VirtualScrollList, VirtualScrollOuter, VirtualTableWithCard, Inputs, List, ColumnFilter, StyledCell, TableFooter, TableError, } from './VirtualTable';
15
+ export { default as VirtualTable, TableRowLoading, TableHeader as VirtualTableHeader, TableLastItem, TableLoading, TableLoadingWithCard, TableNoData, TableNoDataWithCard, LastRowContent, ListItemWrapperWithCard, RowErrorState, StyledItemWrapper, TableRow, TableRowLoadingWithCard, TableRowWithCard, VirtualScrollInner, VirtualScrollList, VirtualScrollOuter, VirtualTableWithCard, Inputs, List, ColumnFilter, StyledCell, TableFooter, } from './VirtualTable';
16
16
  export { default as SheetViewVirtualTable } from './VirtualTable/SheetView/SheetViewVirtualTable';
17
17
  export { default as Widget, ListItem, WidgetHeader, WidgetList } from './Widget';
18
18
  export { default as TapLogo } from './TapLogo';
@@ -12,7 +12,7 @@ export { default as Checkbox } from './Checkbox';
12
12
  export { default as Dialog, DialogToolbar } from './Dialog';
13
13
  export { default as Tooltip } from './Tooltip';
14
14
  export * from './RFH';
15
- export { default as VirtualTable, TableRowLoading, TableHeader as VirtualTableHeader, TableLastItem, TableLoading, TableLoadingWithCard, TableNoData, TableNoDataWithCard, LastRowContent, ListItemWrapperWithCard, RowErrorState, StyledItemWrapper, TableRow, TableRowLoadingWithCard, TableRowWithCard, VirtualScrollInner, VirtualScrollList, VirtualScrollOuter, VirtualTableWithCard, Inputs, List, ColumnFilter, StyledCell, TableFooter, TableError, } from './VirtualTable';
15
+ export { default as VirtualTable, TableRowLoading, TableHeader as VirtualTableHeader, TableLastItem, TableLoading, TableLoadingWithCard, TableNoData, TableNoDataWithCard, LastRowContent, ListItemWrapperWithCard, RowErrorState, StyledItemWrapper, TableRow, TableRowLoadingWithCard, TableRowWithCard, VirtualScrollInner, VirtualScrollList, VirtualScrollOuter, VirtualTableWithCard, Inputs, List, ColumnFilter, StyledCell, TableFooter, } from './VirtualTable';
16
16
  export { default as SheetViewVirtualTable } from './VirtualTable/SheetView/SheetViewVirtualTable';
17
17
  export { default as Widget, ListItem, WidgetHeader, WidgetList } from './Widget';
18
18
  export { default as TapLogo } from './TapLogo';
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.1",
5
- "testVersion": 1,
4
+ "version": "0.0.273-test.11",
5
+ "testVersion": 11,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",
@@ -1,73 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { memo, useState } from 'react';
3
- import { Box, useTheme } from '@mui/material';
4
- import Dropdown from '../../DropdownMenu';
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';
9
- function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns = [], onColumnPin, isPinnable = false, lastColumnId, selectedColumn = null, onColumnClick, }) {
10
- const [anchorEl, setAnchorEl] = useState(null);
11
- const open = Boolean(anchorEl);
12
- const theme = useTheme();
13
- const handleClick = (event) => {
14
- setAnchorEl(event.currentTarget);
15
- };
16
- const handleClose = () => {
17
- setAnchorEl(null);
18
- };
19
- const handleSortingOption = (columnId, order) => {
20
- if (columnId) {
21
- onColumnSort === null || onColumnSort === void 0 ? void 0 : onColumnSort({
22
- [columnId]: order,
23
- });
24
- handleClose();
25
- }
26
- };
27
- const handlePinClick = (columnId) => {
28
- const isCurrentlyPinned = pinnedColumns.includes(columnId);
29
- if (isCurrentlyPinned) {
30
- onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId, 'unpin');
31
- }
32
- else {
33
- if (columnId === lastColumnId) {
34
- onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId, 'end');
35
- }
36
- else {
37
- onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId, 'start');
38
- }
39
- }
40
- };
41
- 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) => {
42
- const { header, id, align, headerStyle, sortable, filter, pinnable } = column;
43
- const isFirst = id === columns[0].id;
44
- const isLast = id === columns[columns.length - 1].id;
45
- const isPinned = pinnedColumns.includes(id);
46
- const isDefaultPinned = !!column.isDefaultPinned;
47
- const isSelected = selectedColumn === id;
48
- 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) => onColumnClick === null || onColumnClick === void 0 ? void 0 : onColumnClick(id, event), 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)), sortable && _jsx(ColumnIcon, { onClick: sortable ? handleClick : undefined, src: columnIcon, alt: "column-icon", "data-id": id }), isPinnable && pinnable && !isDefaultPinned && !isLast && (_jsx(PinIconContainer, Object.assign({ onClick: (event) => {
49
- event.stopPropagation();
50
- handlePinClick(id);
51
- }, title: isPinned ? 'Unpin column' : 'Pin column' }, { children: _jsx("img", { src: isPinned ? unpinIcon : pinIcon, alt: "pin-icon" }) })))] }), `${id}-${colIndex}`));
52
- }) })), _jsx(Dropdown, { open: open, onClose: handleClose, anchorEl: anchorEl, menuItems: [
53
- {
54
- label: 'Sort A-Z',
55
- name: 'asc',
56
- icon: _jsx(ActionIcon, { src: sortAzIcon, alt: "sort-icon" }),
57
- selected: (columnsSorting === null || columnsSorting === void 0 ? void 0 : columnsSorting[(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id) || '']) === 'asc',
58
- onClick: () => {
59
- handleSortingOption(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id, 'asc');
60
- },
61
- },
62
- {
63
- label: 'Sort Z-A',
64
- name: 'desc',
65
- icon: _jsx(ActionIcon, { src: sortZaIcon, alt: "sort-icon" }),
66
- selected: (columnsSorting === null || columnsSorting === void 0 ? void 0 : columnsSorting[(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id) || '']) === 'desc',
67
- onClick: () => {
68
- handleSortingOption(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id, 'desc');
69
- },
70
- },
71
- ] })] })));
72
- }
73
- export default memo(SheetViewTableHeader);
@@ -1,11 +0,0 @@
1
- /// <reference types="react" />
2
- export type TableErrorProps = {
3
- isTimeoutError?: boolean;
4
- tableError?: boolean;
5
- sandboxMode?: boolean;
6
- tableEmpty?: boolean;
7
- error: Error | null;
8
- triggerDataRefetch: () => Promise<unknown>;
9
- };
10
- declare const _default: import("react").MemoExoticComponent<(props: TableErrorProps) => import("react/jsx-runtime").JSX.Element>;
11
- export default _default;
@@ -1,23 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { memo } from 'react';
3
- import ErrorList from './ErrorList';
4
- import { backendErrorHandler } from '../../../utils/index.js';
5
- import EmptyList from './EmptyList';
6
- const TableError = (props) => {
7
- const { isTimeoutError, tableError, triggerDataRefetch, sandboxMode, tableEmpty, error } = props;
8
- if (isTimeoutError) {
9
- return (_jsx(ErrorList, { "data-testid": "VirtualTable_ErrorList_timeoutError", shouldMinimizeWidth: true, heading: "timeOut", message: "yourRequestOutPleaseTryAgain", triggerDataRefetch: triggerDataRefetch, sandboxMode: sandboxMode }));
10
- }
11
- if (tableError) {
12
- const axiosErr = error;
13
- const { formatted } = backendErrorHandler({ error: axiosErr, fallbackMessage: 'connectionErrorMsg' });
14
- return (_jsx(ErrorList, { "data-testid": "VirtualTable_ErrorList_tableError", heading: "somethingWentWrong", message: formatted, triggerDataRefetch: triggerDataRefetch, sandboxMode: sandboxMode }));
15
- }
16
- if (tableEmpty) {
17
- const axiosErr = error;
18
- const { formatted } = backendErrorHandler({ error: axiosErr, fallbackMessage: 'tryAdjustingTheDateOrFilters' });
19
- return _jsx(EmptyList, { sandboxMode: sandboxMode, heading: "nothingFound", message: formatted });
20
- }
21
- return (_jsx(ErrorList, { "data-testid": "VirtualTable_ErrorList_tableError", heading: "somethingWentWrong", message: "connectionErrorMsg", triggerDataRefetch: triggerDataRefetch, sandboxMode: sandboxMode }));
22
- };
23
- export default memo(TableError);
@@ -1,27 +0,0 @@
1
- /// <reference types="react" />
2
- import { type TableHeadProps } from '@mui/material';
3
- import type { IColumnProps, IVirtualTable } from '../../../types/index.js';
4
- export declare const actionsIcons: {
5
- flag: string;
6
- dispute: string;
7
- refund: string;
8
- };
9
- export declare const ActionIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
10
- export declare const ColumnIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
11
- interface StyledHeaderProps {
12
- showBackDrop: boolean;
13
- }
14
- 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"> & {
15
- ref?: ((instance: HTMLTableSectionElement | null) => void) | import("react").RefObject<HTMLTableSectionElement> | null | undefined;
16
- }, "className" | "style" | "classes" | "children" | "sx"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & StyledHeaderProps, {}, {}>;
17
- interface TableHeaderProps {
18
- columns: IColumnProps[];
19
- headerProps?: TableHeadProps;
20
- columnsSorting?: IVirtualTable['columnsSorting'];
21
- onColumnSort?: IVirtualTable['onColumnSort'];
22
- showBackDrop: boolean;
23
- isSheetView?: boolean;
24
- }
25
- declare function TableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, isSheetView }: TableHeaderProps): import("react/jsx-runtime").JSX.Element;
26
- declare const _default: import("react").MemoExoticComponent<typeof TableHeader>;
27
- export default _default;
@@ -1,87 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { memo, useState } from 'react';
3
- import { Box, styled, useTheme } from '@mui/material';
4
- import TableHead from '@mui/material/TableHead';
5
- import MUITableRow from '@mui/material/TableRow';
6
- import Dropdown from '../../DropdownMenu';
7
- import { columnIcon, disputeIcon, flagIcon, refundInitiatedIcon, sortAzIcon, sortZaIcon } from '../../../constants/index.js';
8
- import ColumnFilter from './ColumnFilter';
9
- import { StyledCell } from '../style';
10
- export const actionsIcons = {
11
- flag: flagIcon,
12
- dispute: disputeIcon,
13
- refund: refundInitiatedIcon,
14
- };
15
- export const ActionIcon = styled('img')(() => ({
16
- width: '13.3px',
17
- height: '13.3px',
18
- }));
19
- export const ColumnIcon = styled('img')(() => ({
20
- width: '8px',
21
- height: '6.4px',
22
- cursor: 'pointer',
23
- }));
24
- export const StyledHeader = styled(TableHead, {
25
- shouldForwardProp: (prop) => prop !== 'showBackDrop',
26
- })(({ showBackDrop, theme }) => ({
27
- width: '100%',
28
- minWidth: 'fit-content',
29
- flex: '0 0 auto',
30
- boxShadow: showBackDrop ? theme.shadows[23] : 'none',
31
- backgroundColor: theme.palette.background.default,
32
- zIndex: 1,
33
- }));
34
- const StyledMUITableRow = styled(MUITableRow, {
35
- shouldForwardProp: (prop) => prop !== 'isSheetView',
36
- })(({ theme, isSheetView }) => (Object.assign({ display: 'flex', justifyContent: 'flex-start', width: '100%', minWidth: 'fit-content', paddingInline: '32px', paddingBlock: '16px' }, (isSheetView && {
37
- height: '28px',
38
- borderBottom: `1px solid ${theme.palette.divider}`,
39
- backgroundColor: theme.palette.primary.light,
40
- paddingInline: 0,
41
- paddingBlock: 0,
42
- }))));
43
- function TableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, isSheetView }) {
44
- const [anchorEl, setAnchorEl] = useState(null);
45
- const open = Boolean(anchorEl);
46
- const theme = useTheme();
47
- const handleClick = (event) => {
48
- setAnchorEl(event.currentTarget);
49
- };
50
- const handleClose = () => {
51
- setAnchorEl(null);
52
- };
53
- const handleSortingOption = (columnId, order) => {
54
- if (columnId) {
55
- onColumnSort === null || onColumnSort === void 0 ? void 0 : onColumnSort({
56
- [columnId]: order,
57
- });
58
- handleClose();
59
- }
60
- };
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", isSheetView: isSheetView }, { children: columns.map((column, colIndex) => {
62
- const { header, id, align, headerStyle, sortable, filter } = column;
63
- const isFirst = id === columns[0].id;
64
- 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: 'center', justifyContent: align === 'right' ? 'flex-end' : 'flex-start', width: column.width, textAlign: align, overflow: 'unset', fontWeight: 600 }, headerStyle), isSheetView: isSheetView }, { 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
- }) })), _jsx(Dropdown, { open: open, onClose: handleClose, anchorEl: anchorEl, menuItems: [
67
- {
68
- label: 'Sort A-Z',
69
- name: 'asc',
70
- icon: _jsx(ActionIcon, { src: sortAzIcon, alt: "sort-icon" }),
71
- selected: (columnsSorting === null || columnsSorting === void 0 ? void 0 : columnsSorting[(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id) || '']) === 'asc',
72
- onClick: () => {
73
- handleSortingOption(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id, 'asc');
74
- },
75
- },
76
- {
77
- label: 'Sort Z-A',
78
- name: 'desc',
79
- icon: _jsx(ActionIcon, { src: sortZaIcon, alt: "sort-icon" }),
80
- selected: (columnsSorting === null || columnsSorting === void 0 ? void 0 : columnsSorting[(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id) || '']) === 'desc',
81
- onClick: () => {
82
- handleSortingOption(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id, 'desc');
83
- },
84
- },
85
- ] })] })));
86
- }
87
- export default memo(TableHeader);