@tap-payments/os-micro-frontend-shared 0.1.277 → 0.1.279-test.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/Chip/style.d.ts +0 -1
- package/build/components/CountBadge/style.d.ts +0 -1
- package/build/components/CountryFilter/index.d.ts +1 -2
- package/build/components/CountryFilter/index.js +1 -2
- package/build/components/Dialog/style.d.ts +0 -1
- package/build/components/Filters/index.d.ts +1 -0
- package/build/components/Filters/index.js +1 -0
- package/build/components/Filters/style.d.ts +15 -0
- package/build/components/Filters/style.js +51 -0
- package/build/components/FlippingCard/style.d.ts +0 -1
- package/build/components/ImageWrapper/ImageWrapper.d.ts +0 -1
- package/build/components/JSONViewer/style.d.ts +0 -1
- package/build/components/LeftPeekRightExpandingChip/style.d.ts +0 -1
- package/build/components/PaymentSourceFilter/PaymentInitiated.d.ts +8 -0
- package/build/components/PaymentSourceFilter/PaymentInitiated.js +29 -0
- package/build/components/PaymentSourceFilter/PaymentMethod.d.ts +6 -0
- package/build/components/PaymentSourceFilter/PaymentMethod.js +54 -0
- package/build/components/PaymentSourceFilter/PaymentMethods.d.ts +7 -0
- package/build/components/PaymentSourceFilter/PaymentMethods.js +48 -0
- package/build/components/PaymentSourceFilter/PaymentSchemes.d.ts +7 -0
- package/build/components/PaymentSourceFilter/PaymentSchemes.js +51 -0
- package/build/components/PaymentSourceFilter/PaymentSourceFilter.d.ts +15 -0
- package/build/components/PaymentSourceFilter/PaymentSourceFilter.js +15 -0
- package/build/components/PaymentSourceFilter/index.d.ts +2 -0
- package/build/components/PaymentSourceFilter/index.js +1 -0
- package/build/components/PaymentSourceFilter/style.d.ts +1 -0
- package/build/components/PaymentSourceFilter/style.js +12 -0
- package/build/components/PaymentSourceFilter/type.d.ts +10 -0
- package/build/components/PaymentSourceFilter/type.js +1 -0
- package/build/components/PhoneFilter/index.d.ts +1 -2
- package/build/components/PhoneFilter/index.js +1 -2
- package/build/components/RightLeftExpandingCenterChip/style.d.ts +0 -1
- package/build/components/SearchButton/styles.d.ts +0 -1
- package/build/components/StatusButton/constant.d.ts +2 -0
- package/build/components/StatusButton/constant.js +3 -1
- package/build/components/StatusButton/style.d.ts +1 -1
- package/build/components/StatusChip/StatusChip.js +2 -2
- package/build/components/StatusFilter/StatusFilter.d.ts +16 -0
- package/build/components/StatusFilter/StatusFilter.js +88 -0
- package/build/components/StatusFilter/index.d.ts +1 -0
- package/build/components/StatusFilter/index.js +1 -0
- package/build/components/StatusFilter/type.d.ts +5 -0
- package/build/components/StatusFilter/type.js +6 -0
- package/build/components/StatusFilter/utils.d.ts +4 -0
- package/build/components/StatusFilter/utils.js +10 -0
- package/build/components/StatusIcons/AuthIcons/style.d.ts +0 -1
- package/build/components/StatusIcons/AuthorizationAutoIcons/style.d.ts +0 -1
- package/build/components/StatusIcons/ChargeStatusIcon/style.d.ts +0 -1
- package/build/components/StatusIcons/SourceIcons/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/ActionCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/ApplicationStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/AuthenticationCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/AuthenticationStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/AuthenticationTypeCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/BalanceCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/ChannelsCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/CheckoutStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/DestinationStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/DueDateCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/IDButton/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/IntentsStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/InvoiceStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/PayoutStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/ProductsCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/ReferenceCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/RefundChargeCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/RefundStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/SalesChannelCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/SegmentsCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/SourceCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/StatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/TokenStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/style.d.ts +0 -1
- package/build/components/VirtualTables/components/TableRow.d.ts +2 -2
- package/build/components/VirtualTables/components/TableRow.js +72 -47
- package/build/components/VirtualTables/components/style.d.ts +0 -1
- package/build/components/index.d.ts +5 -2
- package/build/components/index.js +5 -2
- package/build/constants/payment.d.ts +5 -0
- package/build/constants/payment.js +4 -0
- package/package.json +3 -3
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useRef, useState } from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import Box from '@mui/material/Box';
|
|
5
|
+
import { Menu, MenuItem, RadioGroup } from '../index.js';
|
|
6
|
+
import { FilterCancelButton, FilterFooter, FilterOkayButton, FilterTitle } from '../Filters';
|
|
7
|
+
import { rightArrow } from '../../constants/index.js';
|
|
8
|
+
import { ClickAwayListener, Popper } from '@mui/material';
|
|
9
|
+
import { StatusValue } from './type';
|
|
10
|
+
import { getInitialStatuses } from './utils';
|
|
11
|
+
export default function StatusFilter({ anchorEl, options, apiKey = 'statuses', initialStatuses, onCloseDropdown, onClear, onConfirm, }) {
|
|
12
|
+
const open = Boolean(anchorEl);
|
|
13
|
+
const { t } = useTranslation();
|
|
14
|
+
const [statuses, setStatuses] = useState(() => {
|
|
15
|
+
return getInitialStatuses(initialStatuses, options);
|
|
16
|
+
});
|
|
17
|
+
const containerRef = useRef(null);
|
|
18
|
+
const [childAnchorEl, setChildAnchorEl] = useState(null);
|
|
19
|
+
const [hoveredStatus, setHoveredStatus] = useState(null);
|
|
20
|
+
const onChildMouseOver = (event, status) => {
|
|
21
|
+
setChildAnchorEl(event.currentTarget);
|
|
22
|
+
setHoveredStatus(status);
|
|
23
|
+
};
|
|
24
|
+
const onChildLeave = useCallback(() => {
|
|
25
|
+
setChildAnchorEl(null);
|
|
26
|
+
setHoveredStatus(null);
|
|
27
|
+
}, []);
|
|
28
|
+
const onCloseDropdowns = useCallback((e) => {
|
|
29
|
+
onCloseDropdown(e);
|
|
30
|
+
onChildLeave();
|
|
31
|
+
}, [onChildLeave, onCloseDropdown]);
|
|
32
|
+
const handleOkButtonClick = (e) => {
|
|
33
|
+
const newStatuses = Object.keys(statuses).reduce((acc, key) => {
|
|
34
|
+
const value = statuses[key];
|
|
35
|
+
if (value !== StatusValue.ALL) {
|
|
36
|
+
acc[key] = value;
|
|
37
|
+
}
|
|
38
|
+
return acc;
|
|
39
|
+
}, {});
|
|
40
|
+
const isAllStatuses = Object.values(statuses).every((value) => value === StatusValue.ALL);
|
|
41
|
+
if (isAllStatuses) {
|
|
42
|
+
// when all statuses are selected as `all`, remove the active filter icon if it exists
|
|
43
|
+
onClear([apiKey]);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
onConfirm({ [apiKey]: newStatuses });
|
|
47
|
+
}
|
|
48
|
+
onCloseDropdown(e);
|
|
49
|
+
};
|
|
50
|
+
const onClickStatus = (value) => {
|
|
51
|
+
if (hoveredStatus) {
|
|
52
|
+
setStatuses((prev) => (Object.assign(Object.assign({}, prev), { [hoveredStatus]: value })));
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
return (_jsx(ClickAwayListener, Object.assign({ onClickAway: (e) => {
|
|
56
|
+
e.stopPropagation();
|
|
57
|
+
onCloseDropdown(e);
|
|
58
|
+
} }, { children: _jsxs(Box, Object.assign({ ref: containerRef }, { children: [_jsxs(Menu, Object.assign({ open: open, anchorEl: anchorEl }, { children: [_jsx(FilterTitle, Object.assign({ component: "span" }, { children: t('filterBy') })), options.map(({ value, label }) => (_jsxs(MenuItem, Object.assign({ onClick: (e) => {
|
|
59
|
+
setChildAnchorEl(e.currentTarget);
|
|
60
|
+
}, onMouseOver: (e) => {
|
|
61
|
+
onChildMouseOver(e, value);
|
|
62
|
+
}, sx: {
|
|
63
|
+
minHeight: '35px',
|
|
64
|
+
padding: '8px 16px',
|
|
65
|
+
display: 'flex',
|
|
66
|
+
alignItems: 'center',
|
|
67
|
+
justifyContent: 'space-between',
|
|
68
|
+
cursor: 'pointer',
|
|
69
|
+
'&:hover': { backgroundColor: '#fff', boxShadow: '0px 0px 16px 0px #00000021' },
|
|
70
|
+
}, hideCheckbox: true }, { children: [_jsx(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center', gap: '4px' } }, { children: label })), _jsx(Box, { component: "img", src: rightArrow, width: 16, height: 12, sx: { marginLeft: 'auto' } })] }), value))), _jsxs(FilterFooter, { children: [_jsx(FilterCancelButton, Object.assign({ onClick: onCloseDropdowns }, { children: t('cancel') })), _jsx(FilterOkayButton, Object.assign({ onClick: handleOkButtonClick }, { children: t('okay') }))] })] })), _jsx(Popper, Object.assign({ open: Boolean(childAnchorEl), anchorEl: childAnchorEl, placement: "right-start", onMouseLeave: onChildLeave }, { children: _jsx(Box, Object.assign({ sx: {
|
|
71
|
+
backgroundColor: '#fff',
|
|
72
|
+
borderEndEndRadius: '8px',
|
|
73
|
+
border: '1px solid #F2F2F2',
|
|
74
|
+
} }, { children: _jsx(RadioGroup, { options: [
|
|
75
|
+
{
|
|
76
|
+
value: StatusValue.ALL,
|
|
77
|
+
label: 'All',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
value: StatusValue.ENABLED,
|
|
81
|
+
label: 'Enabled',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
value: StatusValue.DISABLED,
|
|
85
|
+
label: 'Disabled',
|
|
86
|
+
},
|
|
87
|
+
], value: statuses[hoveredStatus || ''], onOptionChange: onClickStatus }) })) }))] })) })));
|
|
88
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as StatusFilter } from './StatusFilter';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as StatusFilter } from './StatusFilter';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StatusValue } from './type';
|
|
2
|
+
export const getInitialStatuses = (statuses, options) => {
|
|
3
|
+
const rawStatuses = (statuses || {});
|
|
4
|
+
const mappedStatuses = {};
|
|
5
|
+
options === null || options === void 0 ? void 0 : options.forEach(({ value }) => {
|
|
6
|
+
const statusValue = rawStatuses === null || rawStatuses === void 0 ? void 0 : rawStatuses[value];
|
|
7
|
+
mappedStatuses[value] = statusValue === undefined ? StatusValue.ALL : statusValue;
|
|
8
|
+
});
|
|
9
|
+
return mappedStatuses;
|
|
10
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
2
|
export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
4
3
|
export declare const StyledSourceImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
5
4
|
export declare const PaymentSourcesContainer: import("@emotion/styled").StyledComponent<{
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
2
|
export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
4
3
|
export declare const StyledSourceImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
5
4
|
export declare const PaymentSourcesContainer: import("@emotion/styled").StyledComponent<{
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
2
|
import { TableMode } from '../../../../types/index.js';
|
|
4
3
|
export declare const ActionCellContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
5
4
|
tableMode?: TableMode | undefined;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
2
|
export declare const StyledAppsCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
4
3
|
export declare const AppsStatusContainer: import("@emotion/styled").StyledComponent<{
|
|
5
4
|
hidden?: boolean | undefined;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
2
|
export declare const AuthIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
4
3
|
export declare const AuthCellContainer: import("@emotion/styled").StyledComponent<{
|
|
5
4
|
hidden?: boolean | undefined;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
2
|
export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
4
3
|
export declare const StyledSourceImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
5
4
|
export declare const PaymentSourcesContainer: import("@emotion/styled").StyledComponent<{
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
2
|
export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
4
3
|
export declare const StyledSourceImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
5
4
|
export declare const ReferenceSourcesContainer: import("@emotion/styled").StyledComponent<{
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
2
|
export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
4
3
|
export declare const StyledSourceImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
5
4
|
export declare const SalesChannelsContainer: import("@emotion/styled").StyledComponent<{
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
2
|
export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
4
3
|
export declare const ReferenceSourcesContainer: import("@emotion/styled").StyledComponent<{
|
|
5
4
|
hidden?: boolean | undefined;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
2
|
export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
4
3
|
export declare const StyledSourceImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
5
4
|
export declare const PaymentSourcesContainer: import("@emotion/styled").StyledComponent<{
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
2
|
export declare const GeographyBox: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
4
3
|
variant?: "Global" | "Regional" | "Local" | undefined;
|
|
5
4
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { type TableRowProps } from '@mui/material';
|
|
3
3
|
import type { IColumnProps } from '../../../types/index.js';
|
|
4
4
|
interface ITableRowProps<R = any> {
|
|
@@ -20,5 +20,5 @@ interface ITableRowProps<R = any> {
|
|
|
20
20
|
isLastRow?: boolean;
|
|
21
21
|
}
|
|
22
22
|
declare function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell, selectedColumn, selectedRow, selectedChip, onCellClick, isLastRow, onChipClick, }: Readonly<ITableRowProps>): import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
declare const _default:
|
|
23
|
+
declare const _default: React.MemoExoticComponent<typeof TableRow>;
|
|
24
24
|
export default _default;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { createElement as _createElement } from "react";
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { memo, useMemo } from 'react';
|
|
3
|
+
import React, { memo, useMemo } from 'react';
|
|
4
4
|
import { Box } from '@mui/material';
|
|
5
5
|
import { areEqual } from 'react-window';
|
|
6
6
|
import { StyledCell, StyledTableRow } from './style';
|
|
7
7
|
import { getSelectionStyles, getRowSelectionBorderStyles } from '../../../utils/index.js';
|
|
8
8
|
function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = null, selectedColumn = null, selectedRow = null, selectedChip = null, onCellClick, isLastRow = false, onChipClick, }) {
|
|
9
|
-
|
|
9
|
+
// Memoize chip click handler to prevent recreation on every render
|
|
10
|
+
const handleChipClick = React.useCallback((colIndex, pinned) => (event, chipIndex) => {
|
|
11
|
+
onChipClick === null || onChipClick === void 0 ? void 0 : onChipClick(index, colIndex, event, chipIndex, pinned);
|
|
12
|
+
}, [onChipClick, index]);
|
|
13
|
+
// Memoize cell renderer to prevent recreation
|
|
14
|
+
const renderCell = React.useCallback((column, rowIndex, colIndex) => {
|
|
10
15
|
const { render, format, selector } = column;
|
|
11
|
-
const handleChipClick = (event, chipIndex) => {
|
|
12
|
-
onChipClick === null || onChipClick === void 0 ? void 0 : onChipClick(rowIndex, colIndex, event, chipIndex, column.pinned);
|
|
13
|
-
};
|
|
14
16
|
if (!(column === null || column === void 0 ? void 0 : column.id) || !row)
|
|
15
17
|
return null;
|
|
16
18
|
const value = selector ? selector({ row, index, value: row[column === null || column === void 0 ? void 0 : column.id] }) : row[column === null || column === void 0 ? void 0 : column.id];
|
|
@@ -20,49 +22,72 @@ function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = n
|
|
|
20
22
|
column,
|
|
21
23
|
index,
|
|
22
24
|
value: row[column === null || column === void 0 ? void 0 : column.id],
|
|
23
|
-
selectionProps: { onClick: handleChipClick, rowIndex, colIndex, selectedId: selectedChip },
|
|
25
|
+
selectionProps: { onClick: handleChipClick(colIndex, column.pinned), rowIndex, colIndex, selectedId: selectedChip },
|
|
24
26
|
})) : (_jsx(_Fragment, { children: formattedValue }));
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
27
|
+
}, [row, index, selectedChip, handleChipClick]);
|
|
28
|
+
// Pre-compute if any selection is active
|
|
29
|
+
const hasActiveSelection = selectedCell !== null || selectedColumn !== null || selectedRow !== null;
|
|
30
|
+
// Memoize cell click handler
|
|
31
|
+
const handleCellClick = React.useCallback((colIndex, pinned) => (event) => {
|
|
32
|
+
onCellClick === null || onCellClick === void 0 ? void 0 : onCellClick(index, colIndex, event, pinned);
|
|
33
|
+
}, [onCellClick, index]);
|
|
34
|
+
const content = useMemo(() => {
|
|
35
|
+
var _a, _b;
|
|
36
|
+
const firstColumnId = (_a = columns[0]) === null || _a === void 0 ? void 0 : _a.id;
|
|
37
|
+
const lastColumnId = (_b = columns[columns.length - 1]) === null || _b === void 0 ? void 0 : _b.id;
|
|
38
|
+
const isRowSelected = selectedRow === index;
|
|
39
|
+
return (_jsx(_Fragment, { children: columns.map((column, colIndex) => {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
// Early exit for invalid columns
|
|
42
|
+
if (!(column === null || column === void 0 ? void 0 : column.id))
|
|
43
|
+
return null;
|
|
44
|
+
// Cache cell identifiers
|
|
45
|
+
const cellKey = `${(_a = column.pinned) !== null && _a !== void 0 ? _a : 'default'}-${index}-${colIndex}`;
|
|
46
|
+
const columnKey = `${(_b = column.pinned) !== null && _b !== void 0 ? _b : 'default'}-${colIndex}`;
|
|
47
|
+
// Calculate selection states only if there's an active selection
|
|
48
|
+
const isCellSelected = hasActiveSelection && selectedCell === cellKey;
|
|
49
|
+
const isColumnSelected = hasActiveSelection && selectedColumn === columnKey;
|
|
50
|
+
const isSelected = hasActiveSelection && (isCellSelected || isColumnSelected || isRowSelected);
|
|
51
|
+
// getSelectionStyles already handles the empty return if !isSelected
|
|
52
|
+
const selectionStyles = getSelectionStyles({
|
|
53
|
+
isSelected,
|
|
54
|
+
isCellSelected,
|
|
55
|
+
isColumnSelected,
|
|
56
|
+
isRowSelected,
|
|
57
|
+
isLastRow,
|
|
58
|
+
});
|
|
59
|
+
// Determine if this cell should be treated as first/last for border radius
|
|
60
|
+
const isFirstColumn = column.id === firstColumnId;
|
|
61
|
+
const isLastColumn = column.id === lastColumnId;
|
|
62
|
+
// For scrollable table, adjust first/last based on pinned tables
|
|
63
|
+
const effectiveFirst = !column.pinned ? isFirstColumn && column.pinned !== 'start' : isFirstColumn;
|
|
64
|
+
const effectiveLast = !column.pinned ? isLastColumn && column.pinned !== 'end' : isLastColumn;
|
|
65
|
+
// Handle border styling for row selection only when needed
|
|
66
|
+
const rowSelectionBorderStyles = isRowSelected && hasActiveSelection
|
|
67
|
+
? getRowSelectionBorderStyles({
|
|
68
|
+
effectiveFirst,
|
|
69
|
+
isPinnedStart: column.pinned === 'start',
|
|
70
|
+
isPinnedEnd: column.pinned === 'end',
|
|
71
|
+
})
|
|
72
|
+
: {};
|
|
73
|
+
const isIndexColumn = column.pinned === 'start' && effectiveFirst;
|
|
74
|
+
return (_jsx(StyledCell, Object.assign({ component: "div", "data-testid": "TableRow_TableCell", "data-column-id": column.id, "data-column-width": column.width, "data-column-width-used": column.width, "data-column-align": column.align, "data-column-order": column.order, "data-column-header": typeof column.header === 'string' ? column.header : 'component', "data-column-sortable": !!column.sortable, "data-column-filterable": !!column.filter, isFirst: effectiveFirst, isLast: effectiveLast, onClick: handleCellClick(colIndex, column.pinned), sx: Object.assign(Object.assign(Object.assign({ width: column.width, minWidth: column.width, textAlign: column.align, justifyContent: isIndexColumn ? 'center' : column.align === 'right' ? 'flex-end' : 'flex-start', cursor: onCellClick ? 'pointer' : 'default' }, selectionStyles), rowSelectionBorderStyles), column.cellStyle), isSheetView: isSheetView, isSelected: isCellSelected }, { children: isSheetView ? (_jsx(Box, Object.assign({ sx: { position: 'relative', zIndex: 1 } }, { children: renderCell(column, index, colIndex) }))) : (_jsx(_Fragment, { children: renderCell(column, index, colIndex) })) }), `${column.id}-${colIndex}`));
|
|
75
|
+
}) }));
|
|
76
|
+
}, [
|
|
77
|
+
columns,
|
|
78
|
+
row,
|
|
79
|
+
index,
|
|
80
|
+
selectedCell,
|
|
81
|
+
selectedColumn,
|
|
82
|
+
selectedRow,
|
|
83
|
+
hasActiveSelection,
|
|
84
|
+
onCellClick,
|
|
85
|
+
isLastRow,
|
|
86
|
+
selectedChip,
|
|
87
|
+
isSheetView,
|
|
88
|
+
renderCell,
|
|
89
|
+
handleCellClick,
|
|
90
|
+
]);
|
|
66
91
|
return (_createElement(StyledTableRow, Object.assign({ "data-testid": "TableRow", onClick: rowProps === null || rowProps === void 0 ? void 0 : rowProps.onRowClick, showShadowHighlight: rowProps === null || rowProps === void 0 ? void 0 : rowProps.showShadowHighlight, showLoadedStyle: rowProps === null || rowProps === void 0 ? void 0 : rowProps.showLoadedStyle, component: "article" }, rowProps, { key: index, isSheetView: isSheetView }), content));
|
|
67
92
|
}
|
|
68
93
|
export default memo(TableRow, areEqual);
|
|
@@ -129,8 +129,8 @@ export * from './VAT';
|
|
|
129
129
|
export * from './Discount';
|
|
130
130
|
export * from './MerchantLogo';
|
|
131
131
|
export * from './FilterDropdown';
|
|
132
|
-
export
|
|
133
|
-
export
|
|
132
|
+
export * from './PhoneFilter';
|
|
133
|
+
export * from './CountryFilter';
|
|
134
134
|
export * from './Customer';
|
|
135
135
|
export * from './MerchantCurrencyDropdown';
|
|
136
136
|
export * from './OpenFileInNewTab';
|
|
@@ -139,3 +139,6 @@ export * from './FileInputPreview';
|
|
|
139
139
|
export * from './ReceiptsViewer';
|
|
140
140
|
export * from './MerchantsDropdown';
|
|
141
141
|
export * from './ViewColumnRadioFilter';
|
|
142
|
+
export * from './Filters';
|
|
143
|
+
export * from './StatusFilter';
|
|
144
|
+
export * from './PaymentSourceFilter';
|
|
@@ -129,8 +129,8 @@ export * from './VAT';
|
|
|
129
129
|
export * from './Discount';
|
|
130
130
|
export * from './MerchantLogo';
|
|
131
131
|
export * from './FilterDropdown';
|
|
132
|
-
export
|
|
133
|
-
export
|
|
132
|
+
export * from './PhoneFilter';
|
|
133
|
+
export * from './CountryFilter';
|
|
134
134
|
export * from './Customer';
|
|
135
135
|
export * from './MerchantCurrencyDropdown';
|
|
136
136
|
export * from './OpenFileInNewTab';
|
|
@@ -139,3 +139,6 @@ export * from './FileInputPreview';
|
|
|
139
139
|
export * from './ReceiptsViewer';
|
|
140
140
|
export * from './MerchantsDropdown';
|
|
141
141
|
export * from './ViewColumnRadioFilter';
|
|
142
|
+
export * from './Filters';
|
|
143
|
+
export * from './StatusFilter';
|
|
144
|
+
export * from './PaymentSourceFilter';
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/os-micro-frontend-shared",
|
|
3
3
|
"description": "Shared components and utilities for Tap Payments micro frontends",
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.279-test.1",
|
|
5
|
+
"testVersion": 1,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|
|
@@ -164,4 +164,4 @@
|
|
|
164
164
|
"publishConfig": {
|
|
165
165
|
"registry": "https://registry.npmjs.org/"
|
|
166
166
|
}
|
|
167
|
-
}
|
|
167
|
+
}
|