@tap-payments/os-micro-frontend-shared 0.0.273-test.10 → 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 (30) hide show
  1. package/build/components/VirtualTable/SheetView/SheetViewVirtualTable.js +2 -2
  2. package/build/components/VirtualTable/SheetView/components/SheetViewTableHeader/SheetViewTableHeader.d.ts +1 -1
  3. package/build/components/VirtualTable/SheetView/components/SheetViewTableHeader/SheetViewTableHeader.js +7 -77
  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/type.d.ts +16 -0
  7. package/build/components/VirtualTable/SheetView/components/SheetViewTableHeader/type.js +1 -0
  8. package/build/components/VirtualTable/SheetView/index.d.ts +1 -1
  9. package/build/components/VirtualTable/SheetView/index.js +1 -1
  10. package/build/components/VirtualTable/SheetView/style.d.ts +17 -20
  11. package/build/components/VirtualTable/SheetView/style.js +4 -3
  12. package/build/components/VirtualTable/VirtualTable.js +1 -1
  13. package/build/components/VirtualTable/components/{TableHeader/components/ColumnSort → ColumnSort}/ColumnSort.d.ts +2 -2
  14. package/build/components/VirtualTable/components/{TableHeader/components/ColumnSort → ColumnSort}/ColumnSort.js +8 -8
  15. package/build/components/VirtualTable/components/TableHeader/TableHeader.d.ts +1 -10
  16. package/build/components/VirtualTable/components/TableHeader/TableHeader.js +1 -1
  17. package/build/components/VirtualTable/components/TableHeader/components/TableCell/TableCell.d.ts +1 -1
  18. package/build/components/VirtualTable/components/TableHeader/components/TableCell/TableCell.js +3 -3
  19. package/build/components/VirtualTable/components/TableHeader/components/index.d.ts +0 -1
  20. package/build/components/VirtualTable/components/TableHeader/components/index.js +0 -1
  21. package/build/components/VirtualTable/components/TableHeader/index.d.ts +1 -0
  22. package/build/components/VirtualTable/components/TableHeader/index.js +1 -0
  23. package/build/components/VirtualTable/components/TableHeader/style.js +3 -2
  24. package/build/components/VirtualTable/components/TableHeader/type.d.ts +10 -0
  25. package/build/components/VirtualTable/components/TableHeader/type.js +1 -0
  26. package/package.json +2 -2
  27. /package/build/components/VirtualTable/components/{TableHeader/components/ColumnSort → ColumnSort}/index.d.ts +0 -0
  28. /package/build/components/VirtualTable/components/{TableHeader/components/ColumnSort → ColumnSort}/index.js +0 -0
  29. /package/build/components/VirtualTable/components/{TableHeader/components/ColumnSort → ColumnSort}/style.d.ts +0 -0
  30. /package/build/components/VirtualTable/components/{TableHeader/components/ColumnSort → ColumnSort}/style.js +0 -0
@@ -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/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, 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';
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
- const [anchorEl, setAnchorEl] = useState(null);
11
- const [columnFilterEl, setColumnFilterEl] = useState(null);
12
- const open = Boolean(anchorEl);
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);
@@ -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,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 './components/SheetViewTableHeader/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/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',
@@ -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/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';
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import type { IColumnProps } from '../../../../../../types/index.js';
3
- import { TableHeaderProps } from '../../TableHeader';
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, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
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 '../../../../../DropdownMenu';
5
- import { columnIcon, sortAzIcon, sortZaIcon } from '../../../../../../constants/index.js';
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 = (columnId, order) => {
18
- if (columnId) {
17
+ const handleSortingOption = (id, order) => {
18
+ if (id) {
19
19
  onColumnSort === null || onColumnSort === void 0 ? void 0 : onColumnSort({
20
- [columnId]: order,
20
+ [id]: order,
21
21
  });
22
22
  handleClose();
23
23
  }
24
24
  };
25
- return (_jsxs(_Fragment, { children: [_jsx(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: [
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 { type TableHeadProps } from '@mui/material/TableHead';
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, { 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) => {
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
  }
@@ -1,5 +1,5 @@
1
1
  import type { IColumnProps } from '../../../../../../types/index.js';
2
- import { TableHeaderProps } from '../../TableHeader';
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;
@@ -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 '../../../ColumnFilter';
5
- import { StyledCell } from '../../../../style';
6
- import ColumnSort from '../ColumnSort/ColumnSort';
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) => {
@@ -1,2 +1 @@
1
- export { default as ColumnSort } from './ColumnSort';
2
1
  export { default as TableCell } from './TableCell';
@@ -1,2 +1 @@
1
- export { default as ColumnSort } from './ColumnSort';
2
1
  export { default as TableCell } from './TableCell';
@@ -1,2 +1,3 @@
1
1
  import TableHeader from './TableHeader';
2
+ export * from './type';
2
3
  export default TableHeader;
@@ -1,2 +1,3 @@
1
1
  import TableHeader from './TableHeader';
2
+ export * from './type';
2
3
  export default TableHeader;
@@ -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
+ }
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.10",
5
- "testVersion": 10,
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",