@tap-payments/os-micro-frontend-shared 0.1.30 → 0.1.31-test.6
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/RightLeftExpandingCenterChip/RightLeftExpandingCenterChip.d.ts +3 -0
- package/build/components/RightLeftExpandingCenterChip/RightLeftExpandingCenterChip.js +43 -0
- package/build/components/RightLeftExpandingCenterChip/index.d.ts +2 -0
- package/build/components/RightLeftExpandingCenterChip/index.js +2 -0
- package/build/components/RightLeftExpandingCenterChip/style.d.ts +3415 -0
- package/build/components/RightLeftExpandingCenterChip/style.js +104 -0
- package/build/components/RightLeftExpandingCenterChip/type.d.ts +10 -0
- package/build/components/RightLeftExpandingCenterChip/type.js +1 -0
- package/build/components/RightLeftExpandingCenterChip/useRightLeftExpandingCenterChip.d.ts +31 -0
- package/build/components/RightLeftExpandingCenterChip/useRightLeftExpandingCenterChip.js +156 -0
- package/build/components/StatusChip/StatusChip.d.ts +1 -1
- package/build/components/StatusChip/StatusChip.js +36 -3
- package/build/components/StatusChip/style.d.ts +7 -3
- package/build/components/StatusChip/style.js +6 -36
- package/build/components/StatusChip/type.d.ts +2 -0
- package/build/components/StatusGroupChips/style.d.ts +2 -0
- package/build/components/StatusGroupChips/type.d.ts +2 -0
- package/build/components/TableCells/CustomCells/DestinationCell/DestinationCell.d.ts +1 -1
- package/build/components/TableCells/CustomCells/DestinationCell/DestinationCell.js +12 -11
- package/build/components/TableCells/CustomCells/type.d.ts +2 -2
- package/build/components/VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable.js +3 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableState.d.ts +2 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableState.js +19 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.d.ts +7 -3
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.js +5 -3
- package/build/components/VirtualTables/components/TableRow.d.ts +4 -2
- package/build/components/VirtualTables/components/TableRow.js +11 -5
- package/build/components/VirtualTables/components/style.js +1 -1
- package/build/components/VirtualTables/components/virtualScroll/ListItemWrapper.js +1 -1
- package/build/components/index.d.ts +1 -0
- package/build/components/index.js +1 -0
- package/build/constants/assets.d.ts +3 -0
- package/build/constants/assets.js +3 -0
- package/build/constants/table/cell/chargeTableCellWidth.d.ts +5 -0
- package/build/constants/table/cell/chargeTableCellWidth.js +5 -0
- package/build/types/table.d.ts +10 -0
- package/build/utils/style.d.ts +6 -0
- package/build/utils/style.js +1 -1
- package/package.json +2 -2
package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { IColumnProps } from '../../../../types/index.js';
|
|
2
|
+
import type { IColumnProps, TableChipProps } from '../../../../types/index.js';
|
|
3
3
|
import type { TableRowProps } from '@mui/material/TableRow';
|
|
4
|
-
interface UseVirtualTableContainerProps<T = unknown> {
|
|
4
|
+
interface UseVirtualTableContainerProps<T = unknown> extends TableChipProps {
|
|
5
5
|
rowHeight: number;
|
|
6
6
|
areAllRowsLoaded?: boolean;
|
|
7
7
|
rows: T[];
|
|
@@ -16,9 +16,11 @@ interface UseVirtualTableContainerProps<T = unknown> {
|
|
|
16
16
|
isError: boolean;
|
|
17
17
|
selectedCell: string | null;
|
|
18
18
|
selectedColumn: string | null;
|
|
19
|
+
selectedChip: string | null;
|
|
19
20
|
handleCellClick: (rowIndex: number, columnIndex: number, event: React.MouseEvent, pinnedType?: 'start' | 'end') => void;
|
|
21
|
+
handleChipClick: (rowIndex: number, columnIndex: number, event: React.MouseEvent, chipIndex: number, pinnedType?: 'start' | 'end') => void;
|
|
20
22
|
}
|
|
21
|
-
export declare const useVirtualTableContainer: <T = unknown>({ rowHeight, areAllRowsLoaded, rows, isDelayedFetchingNextPage, rowProps, scrollToIndex, footerProps, isError, selectedCell, selectedColumn, handleCellClick, }: UseVirtualTableContainerProps<T>) => {
|
|
23
|
+
export declare const useVirtualTableContainer: <T = unknown>({ rowHeight, areAllRowsLoaded, rows, isDelayedFetchingNextPage, rowProps, scrollToIndex, footerProps, isError, selectedCell, selectedColumn, selectedChip, handleCellClick, handleChipClick, }: UseVirtualTableContainerProps<T>) => {
|
|
22
24
|
getItemSize: (index: number, height: number) => number;
|
|
23
25
|
getItemDataForContainer: (columnsData: IColumnProps[], isPinnedColumn: boolean, height: number) => {
|
|
24
26
|
columns: any;
|
|
@@ -36,7 +38,9 @@ export declare const useVirtualTableContainer: <T = unknown>({ rowHeight, areAll
|
|
|
36
38
|
isPinned: any;
|
|
37
39
|
selectedCell: any;
|
|
38
40
|
selectedColumn: any;
|
|
41
|
+
selectedChip: any;
|
|
39
42
|
onCellClick: any;
|
|
43
|
+
onChipClick: any;
|
|
40
44
|
containerHeight: any;
|
|
41
45
|
rowHeight: any;
|
|
42
46
|
};
|
package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useMemo } from 'react';
|
|
2
2
|
import memoize from 'memoize-one';
|
|
3
|
-
const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToIndex, lastItemIndex, totalCount, isError, areAllRowsLoaded, isPinned, selectedCell, selectedColumn, onCellClick, containerHeight, rowHeight) => ({
|
|
3
|
+
const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToIndex, lastItemIndex, totalCount, isError, areAllRowsLoaded, isPinned, selectedCell, selectedColumn, selectedChip, onCellClick, onChipClick, containerHeight, rowHeight) => ({
|
|
4
4
|
columns,
|
|
5
5
|
isLoading,
|
|
6
6
|
rows,
|
|
@@ -16,11 +16,13 @@ const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToInde
|
|
|
16
16
|
isPinned,
|
|
17
17
|
selectedCell,
|
|
18
18
|
selectedColumn,
|
|
19
|
+
selectedChip,
|
|
19
20
|
onCellClick,
|
|
21
|
+
onChipClick,
|
|
20
22
|
containerHeight,
|
|
21
23
|
rowHeight,
|
|
22
24
|
}));
|
|
23
|
-
export const useVirtualTableContainer = ({ rowHeight, areAllRowsLoaded, rows, isDelayedFetchingNextPage, rowProps, scrollToIndex, footerProps, isError, selectedCell, selectedColumn, handleCellClick, }) => {
|
|
25
|
+
export const useVirtualTableContainer = ({ rowHeight, areAllRowsLoaded, rows, isDelayedFetchingNextPage, rowProps, scrollToIndex, footerProps, isError, selectedCell, selectedColumn, selectedChip, handleCellClick, handleChipClick, }) => {
|
|
24
26
|
const getItemSize = useCallback((index, height) => {
|
|
25
27
|
const isLastRow = areAllRowsLoaded && index === rows.length;
|
|
26
28
|
if (isLastRow) {
|
|
@@ -44,7 +46,7 @@ export const useVirtualTableContainer = ({ rowHeight, areAllRowsLoaded, rows, is
|
|
|
44
46
|
areAllRowsLoaded,
|
|
45
47
|
];
|
|
46
48
|
}, [isDelayedFetchingNextPage, rows, rowProps, scrollToIndex, footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount, isError, areAllRowsLoaded]);
|
|
47
|
-
const commonItemDataSuffix = useMemo(() => [selectedCell, selectedColumn, handleCellClick], [selectedCell, selectedColumn, handleCellClick]);
|
|
49
|
+
const commonItemDataSuffix = useMemo(() => [selectedCell, selectedColumn, selectedChip, handleCellClick, handleChipClick], [selectedCell, selectedColumn, selectedChip, handleCellClick, handleChipClick]);
|
|
48
50
|
const getItemDataForContainer = useCallback((columnsData, isPinnedColumn, height) => createItemData(columnsData, ...commonItemDataParams, isPinnedColumn, ...commonItemDataSuffix, height, rowHeight), [commonItemDataParams, commonItemDataSuffix, rowHeight]);
|
|
49
51
|
return {
|
|
50
52
|
getItemSize,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type
|
|
2
|
+
import { type TableRowProps } from '@mui/material';
|
|
3
3
|
import type { IColumnProps } from '../../../types/index.js';
|
|
4
4
|
interface ITableRowProps<R = any> {
|
|
5
5
|
row: R;
|
|
@@ -13,9 +13,11 @@ interface ITableRowProps<R = any> {
|
|
|
13
13
|
isSheetView?: boolean;
|
|
14
14
|
selectedCell?: string | null;
|
|
15
15
|
selectedColumn?: string | null;
|
|
16
|
+
selectedChip?: string | null;
|
|
16
17
|
onCellClick?: (rowIndex: number, columnIndex: number, event: React.MouseEvent, pinnedType?: 'start' | 'end') => void;
|
|
18
|
+
onChipClick?: (rowIndex: number, columnIndex: number, event: React.MouseEvent, chipIndex: number, pinnedType?: 'start' | 'end') => void;
|
|
17
19
|
isLastRow?: boolean;
|
|
18
20
|
}
|
|
19
|
-
declare function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell, selectedColumn, onCellClick, isLastRow, }: Readonly<ITableRowProps>): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
declare function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell, selectedColumn, selectedChip, onCellClick, isLastRow, onChipClick, }: Readonly<ITableRowProps>): import("react/jsx-runtime").JSX.Element;
|
|
20
22
|
declare const _default: import("react").MemoExoticComponent<typeof TableRow>;
|
|
21
23
|
export default _default;
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { createElement as _createElement } from "react";
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { memo, useMemo } from 'react';
|
|
4
|
+
import { Box } from '@mui/material';
|
|
4
5
|
import { areEqual } from 'react-window';
|
|
5
6
|
import { StyledCell, StyledTableRow } from './style';
|
|
6
7
|
import { getSelectionStyles } from '../../../utils/index.js';
|
|
7
|
-
function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = null, selectedColumn = null, onCellClick, isLastRow = false, }) {
|
|
8
|
-
const renderCell = (column) => {
|
|
8
|
+
function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = null, selectedColumn = null, selectedChip = null, onCellClick, isLastRow = false, onChipClick, }) {
|
|
9
|
+
const renderCell = (column, rowIndex, colIndex) => {
|
|
9
10
|
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
|
+
};
|
|
10
14
|
if (!(column === null || column === void 0 ? void 0 : column.id) || !row)
|
|
11
15
|
return null;
|
|
12
16
|
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];
|
|
13
17
|
const formattedValue = format ? format({ value, row, index }) : value;
|
|
14
|
-
return render ? render({ row, column, index, value: row[column === null || column === void 0 ? void 0 : column.id] }) : _jsx(_Fragment, { children: formattedValue });
|
|
18
|
+
return render ? (render({ row, column, index, value: row[column === null || column === void 0 ? void 0 : column.id], chipSelection: { onChipClick: handleChipClick, rowIndex, colIndex, selectedChip } })) : (_jsx(_Fragment, { children: formattedValue }));
|
|
15
19
|
};
|
|
16
20
|
const content = useMemo(() => (_jsx(_Fragment, { children: columns.map((column, colIndex) => {
|
|
17
21
|
var _a, _b;
|
|
@@ -34,8 +38,10 @@ function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = n
|
|
|
34
38
|
effectiveFirst = isFirstColumn && column.pinned !== 'start';
|
|
35
39
|
effectiveLast = isLastColumn && column.pinned !== 'end';
|
|
36
40
|
}
|
|
37
|
-
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: (event) =>
|
|
38
|
-
|
|
41
|
+
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: (event) => {
|
|
42
|
+
onCellClick === null || onCellClick === void 0 ? void 0 : onCellClick(index, colIndex, event, column.pinned);
|
|
43
|
+
}, sx: Object.assign(Object.assign({ width: column.width, minWidth: column.width, textAlign: column.align, justifyContent: column.align === 'right' ? 'flex-end' : 'flex-start', cursor: onCellClick ? 'pointer' : 'default' }, selectionStyles), column.cellStyle), isSheetView: isSheetView, isSelected: isCellSelected }, { children: _jsx(Box, Object.assign({ sx: { position: 'relative', zIndex: 1, width: '100%' } }, { children: renderCell(column, index, colIndex) })) }), `${column.id}-${colIndex}`));
|
|
44
|
+
}) })), [columns, row, index, selectedCell, selectedColumn, onCellClick, isLastRow, selectedChip, isSheetView]);
|
|
39
45
|
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));
|
|
40
46
|
}
|
|
41
47
|
export default memo(TableRow, areEqual);
|
|
@@ -147,7 +147,7 @@ export const SheetViewTableContainer = styled(Box)(() => ({
|
|
|
147
147
|
height: 'calc(100vh - 300px)',
|
|
148
148
|
paddingInline: '28px',
|
|
149
149
|
borderRadius: '8px',
|
|
150
|
-
marginBottom: '
|
|
150
|
+
marginBottom: '16px !important',
|
|
151
151
|
overflowY: 'hidden',
|
|
152
152
|
}));
|
|
153
153
|
export const StyledCardsBox = styled(Box, {
|
|
@@ -57,7 +57,7 @@ function ListItemWrapper(_a) {
|
|
|
57
57
|
const row = rows[index];
|
|
58
58
|
const isLoadingRow = isLoading && index === lastItemIndex + 1;
|
|
59
59
|
const isLoadedRow = index <= newLoadedRowsEndIndex;
|
|
60
|
-
const rowClickHandler = React.useCallback(createRowClickHandler(row, rowProps === null || rowProps === void 0 ? void 0 : rowProps.onRowClick), [row, rowProps === null || rowProps === void 0 ? void 0 : rowProps.onRowClick]);
|
|
60
|
+
const rowClickHandler = React.useCallback(() => createRowClickHandler(row, rowProps === null || rowProps === void 0 ? void 0 : rowProps.onRowClick), [row, rowProps === null || rowProps === void 0 ? void 0 : rowProps.onRowClick]);
|
|
61
61
|
const memoizedRowProps = React.useMemo(() => (Object.assign(Object.assign({ showShadowHighlight: scrollToIndex === index, showLoadedStyle: isLoadedRow }, rowProps), { onClick: rowClickHandler })), [scrollToIndex, index, isLoadedRow, rowProps, rowClickHandler]);
|
|
62
62
|
const renderSheetViewLoadingRow = React.useCallback((lastRowContent) => {
|
|
63
63
|
return (_jsx(Box, Object.assign({ sx: {
|
|
@@ -106,6 +106,8 @@ export declare const checkboxIcon: string;
|
|
|
106
106
|
export declare const protectIcon: string;
|
|
107
107
|
export declare const unisoIcon: string;
|
|
108
108
|
export declare const addidasIcon: string;
|
|
109
|
+
export declare const RadioButtonCheckedIcon: string;
|
|
110
|
+
export declare const RadioButtonUncheckedIcon: string;
|
|
109
111
|
export declare const macIcon: string;
|
|
110
112
|
export declare const blueZigzagCheckIcon: string;
|
|
111
113
|
export declare const greenZigzagCheckIcon: string;
|
|
@@ -521,3 +523,4 @@ export declare const deactivatedCircle: string;
|
|
|
521
523
|
export declare const exclamationOutlinedCircle: string;
|
|
522
524
|
export declare const outlinedCircle: string;
|
|
523
525
|
export declare const greenCheck2ACE00: string;
|
|
526
|
+
export declare const blueCopyIcon: string;
|
|
@@ -110,6 +110,8 @@ export const checkboxIcon = `${appBaseUrl}/checkboxIcon.svg`;
|
|
|
110
110
|
export const protectIcon = `${appBaseUrl}/checkboxIcon.svg`;
|
|
111
111
|
export const unisoIcon = `${lightUrl}/Uniso.svg`;
|
|
112
112
|
export const addidasIcon = `${lightUrl}/addidas.svg`;
|
|
113
|
+
export const RadioButtonCheckedIcon = `${lightUrl}/radioButtonChecked.svg`;
|
|
114
|
+
export const RadioButtonUncheckedIcon = `${lightUrl}/radioButtonUnchecked.svg`;
|
|
113
115
|
export const macIcon = `${lightUrl}/Mac.svg`;
|
|
114
116
|
export const blueZigzagCheckIcon = `${lightUrl}/blueCheckIconZigzag.svg`;
|
|
115
117
|
export const greenZigzagCheckIcon = `${lightUrl}/greenCheckIconZigzag.svg`;
|
|
@@ -525,3 +527,4 @@ export const deactivatedCircle = `${lightUrl}/deactivatedCircle.svg`;
|
|
|
525
527
|
export const exclamationOutlinedCircle = `${lightUrl}/exclamationOutlinedCircle.svg`;
|
|
526
528
|
export const outlinedCircle = `${lightUrl}/outlinedCircle.svg`;
|
|
527
529
|
export const greenCheck2ACE00 = `${lightUrl}/greenCheck2ACE00.svg`;
|
|
530
|
+
export const blueCopyIcon = `${lightUrl}/blueCopyIcon.svg`;
|
|
@@ -219,6 +219,11 @@ export declare const chargeTableCellWidth: {
|
|
|
219
219
|
readonly text: "30px";
|
|
220
220
|
readonly sheet: "30px";
|
|
221
221
|
};
|
|
222
|
+
readonly consolidated_amount: {
|
|
223
|
+
readonly default: "180px";
|
|
224
|
+
readonly text: "180px";
|
|
225
|
+
readonly sheet: "180px";
|
|
226
|
+
};
|
|
222
227
|
readonly customer_amount: {
|
|
223
228
|
readonly default: "150px";
|
|
224
229
|
readonly text: "150px";
|
package/build/types/table.d.ts
CHANGED
|
@@ -47,11 +47,21 @@ export interface TableFooterProps extends BoxProps {
|
|
|
47
47
|
maximized?: boolean;
|
|
48
48
|
children?: React.ReactNode;
|
|
49
49
|
}
|
|
50
|
+
export interface TableChipProps {
|
|
51
|
+
onChipClick?: (rowIndex: number, columnIndex: number, event: React.MouseEvent, chipIndex: number, pinnedType?: 'start' | 'end') => void;
|
|
52
|
+
}
|
|
53
|
+
export interface ChipSelection {
|
|
54
|
+
onChipClick?: (event: React.MouseEvent, chipIndex: number) => void;
|
|
55
|
+
colIndex?: number;
|
|
56
|
+
rowIndex?: number;
|
|
57
|
+
selectedChip?: string | null;
|
|
58
|
+
}
|
|
50
59
|
export interface IRenderAttr<R, C> {
|
|
51
60
|
row: R;
|
|
52
61
|
column: C;
|
|
53
62
|
index: number;
|
|
54
63
|
value: any;
|
|
64
|
+
chipSelection?: ChipSelection;
|
|
55
65
|
}
|
|
56
66
|
export interface IFormatAttr<R> {
|
|
57
67
|
value: string | Record<string, any> | number;
|
package/build/utils/style.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
export declare const SELECTION_COLORS: {
|
|
2
|
+
readonly primary: "#1F88D0";
|
|
3
|
+
readonly background: "white";
|
|
4
|
+
readonly border: "#F2F2F2";
|
|
5
|
+
readonly transparent: "transparent";
|
|
6
|
+
};
|
|
1
7
|
interface GetSelectionStylesParams {
|
|
2
8
|
isSelected: boolean;
|
|
3
9
|
isCellSelected: boolean;
|
package/build/utils/style.js
CHANGED
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.31-test.6",
|
|
5
|
+
"testVersion": 6,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|