@tap-payments/os-micro-frontend-shared 0.0.216-test.3 → 0.0.217-test.4
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/LICENSE +21 -21
- package/README.md +12 -12
- package/build/components/TableCells/CustomCells/ActionCell/ActionIconColumn.d.ts +6 -0
- package/build/components/TableCells/CustomCells/ActionCell/ActionIconColumn.js +48 -0
- package/build/components/TableCells/CustomCells/ActionCell/ActionsColumn.d.ts +10 -0
- package/build/components/TableCells/CustomCells/ActionCell/ActionsColumn.js +78 -0
- package/build/components/TableCells/CustomCells/ActionCell/index.d.ts +2 -0
- package/build/components/TableCells/CustomCells/ActionCell/index.js +2 -0
- package/build/components/VirtualTable/SheetView/SheetViewTableHeader.d.ts +3 -1
- package/build/components/VirtualTable/SheetView/SheetViewTableHeader.js +6 -2
- package/build/components/VirtualTable/SheetView/SheetViewVirtualTable.js +25 -6
- package/build/components/VirtualTable/components/TableRow.d.ts +5 -1
- package/build/components/VirtualTable/components/TableRow.js +15 -3
- package/build/components/VirtualTable/components/virtualScroll/ListItemWrapper.js +1 -1
- package/build/components/VirtualTable/utils/getBorderStyle.d.ts +41 -0
- package/build/components/VirtualTable/utils/getBorderStyle.js +24 -0
- package/build/constants/table/cell/chargeTableCellWidth.d.ts +11 -1
- package/build/constants/table/cell/chargeTableCellWidth.js +11 -1
- package/package.json +3 -3
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Tap Payments
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Tap Payments
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# os-micro-frontend-shared
|
|
2
|
-
|
|
3
|
-
## Publishing Workflow
|
|
4
|
-
|
|
5
|
-
1. Update version in package.json
|
|
6
|
-
2. Commit changes
|
|
7
|
-
3. Create and push a tag:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm version patch # or minor, major
|
|
11
|
-
git push origin main --tags
|
|
12
|
-
```
|
|
1
|
+
# os-micro-frontend-shared
|
|
2
|
+
|
|
3
|
+
## Publishing Workflow
|
|
4
|
+
|
|
5
|
+
1. Update version in package.json
|
|
6
|
+
2. Commit changes
|
|
7
|
+
3. Create and push a tag:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm version patch # or minor, major
|
|
11
|
+
git push origin main --tags
|
|
12
|
+
```
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ActionCellProps } from '../type';
|
|
3
|
+
type ActionIconColumnProps = Readonly<Pick<ActionCellProps, 'actions' | 'dropdownAction' | 'onCloseDropdown' | 'isDropdownShown' | 'renderDropdown'>>;
|
|
4
|
+
declare function ActionIconColumn({ actions, dropdownAction, onCloseDropdown, isDropdownShown, renderDropdown, ...props }: ActionIconColumnProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare const _default: React.MemoExoticComponent<typeof ActionIconColumn>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { memo } from 'react';
|
|
14
|
+
import { AnimatePresence } from 'framer-motion';
|
|
15
|
+
import Dropdown from '../../../DropdownMenu';
|
|
16
|
+
import { TableCell } from '../../../TableCells';
|
|
17
|
+
import ActionIconsVariants from './components/ActionIconsVariants';
|
|
18
|
+
import { actionIcons } from './constant';
|
|
19
|
+
import { useActionCell } from './hooks/useActionCell';
|
|
20
|
+
import { ActionIcon, ActionsIconContainer } from './style';
|
|
21
|
+
import { TransparentButton } from '../style';
|
|
22
|
+
function ActionIconColumn(_a) {
|
|
23
|
+
var { actions, dropdownAction, onCloseDropdown, isDropdownShown = true, renderDropdown } = _a, props = __rest(_a, ["actions", "dropdownAction", "onCloseDropdown", "isDropdownShown", "renderDropdown"]);
|
|
24
|
+
const { open, anchorEl, filteredActions, isAnyActionLoading, isAnyActionHasError, isAnyActionSuccessful, areThereAnyShownActions, handleClick, handleClose, setAnchorEl, } = useActionCell({ actions, isDropdownShown, onCloseDropdown, renderDropdown });
|
|
25
|
+
return (_jsx(TableCell, Object.assign({}, props, { sx: {
|
|
26
|
+
overflow: 'visible',
|
|
27
|
+
} }, { children: _jsx("div", Object.assign({ "data-testid": "ActionIconColumn_Container", style: {
|
|
28
|
+
display: 'flex',
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
justifyContent: 'center',
|
|
31
|
+
gap: '5px',
|
|
32
|
+
} }, { children: _jsxs(ActionsIconContainer, Object.assign({ id: "styled-popover", selected: !!dropdownAction || open, "data-testid": "ActionIconColumn_ActionsIconContainer", "data-is-active": areThereAnyShownActions, sx: Object.assign({}, (!areThereAnyShownActions && {
|
|
33
|
+
pointerEvents: 'none',
|
|
34
|
+
})) }, { children: [_jsx(TransparentButton, Object.assign({ onClick: handleClick, "data-testid": "ActionIconColumn_ActionsIconContainer_TransparentButton", "data-is-active": areThereAnyShownActions, sx: Object.assign({}, (!areThereAnyShownActions && {
|
|
35
|
+
pointerEvents: 'none',
|
|
36
|
+
})) }, { children: _jsx(AnimatePresence, Object.assign({ mode: "wait" }, { children: _jsx(ActionIconsVariants, { isAnyActionLoading: isAnyActionLoading, isAnyActionHasError: isAnyActionHasError, isAnyActionSuccessful: isAnyActionSuccessful, areThereAnyShownActions: areThereAnyShownActions }) })) })), renderDropdown ? (renderDropdown(anchorEl, setAnchorEl)) : (_jsxs(_Fragment, { children: [dropdownAction, areThereAnyShownActions && (_jsx(Dropdown, { style: { zIndex: 2000 }, open: open, onClose: handleClose, anchorEl: anchorEl, menuItems: filteredActions.map((action) => (Object.assign(Object.assign({}, action), { onClick: (e) => {
|
|
37
|
+
var _a;
|
|
38
|
+
(_a = action === null || action === void 0 ? void 0 : action.onClick) === null || _a === void 0 ? void 0 : _a.call(action, e);
|
|
39
|
+
if (!action.hasActionMenu) {
|
|
40
|
+
handleClose();
|
|
41
|
+
}
|
|
42
|
+
}, onRightClick: (e) => {
|
|
43
|
+
var _a;
|
|
44
|
+
(_a = action === null || action === void 0 ? void 0 : action.onRightClick) === null || _a === void 0 ? void 0 : _a.call(action, e);
|
|
45
|
+
handleClose();
|
|
46
|
+
}, icon: (_jsx(ActionIcon, { icon: action.icon, src: actionIcons[action.icon], initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 } }, `action.label-${action.label.trim()}`)) }))) }))] }))] })) })) })));
|
|
47
|
+
}
|
|
48
|
+
export default memo(ActionIconColumn);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ActionCellProps } from '../type';
|
|
3
|
+
import { TableMode } from '../../../../types/index.js';
|
|
4
|
+
type ActionsColumnProps = Readonly<Pick<ActionCellProps, 'flag' | 'flagTooltip' | 'flagsCount' | 'row' | 'showJsonViewer' | 'isTextShown' | 'showIdButton' | 'rowId'>> & {
|
|
5
|
+
onJsonViewClick?: () => void;
|
|
6
|
+
tableMode?: TableMode;
|
|
7
|
+
};
|
|
8
|
+
declare function ActionsColumn({ flag, flagTooltip, flagsCount, row, showJsonViewer, isTextShown, showIdButton, rowId, onJsonViewClick, tableMode, ...props }: ActionsColumnProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const _default: React.MemoExoticComponent<typeof ActionsColumn>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
+
import { memo } from 'react';
|
|
14
|
+
import { motion } from 'framer-motion';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
16
|
+
import Tooltip from '../../../Tooltip';
|
|
17
|
+
import { TableCell } from '../../../TableCells';
|
|
18
|
+
import StyledBadge, { BadgeVariants } from '../../../CountBadge';
|
|
19
|
+
import { jsonBlackIcon } from '../../../../constants/index.js';
|
|
20
|
+
import { colorToVariant, flags } from './constant';
|
|
21
|
+
import { ActionCellContainer, ActionIcon } from './style';
|
|
22
|
+
import { IDButton } from '../IDButton';
|
|
23
|
+
import { BadgeWrapper, IdButtonContainer, TextLabel, TransparentButton } from '../style';
|
|
24
|
+
import SheetViewIDButton from '../SheetViewIDButton/SheetViewIDButton';
|
|
25
|
+
function ActionsColumn(_a) {
|
|
26
|
+
var _b, _c;
|
|
27
|
+
var { flag, flagTooltip, flagsCount, row, showJsonViewer = true, isTextShown, showIdButton = true, rowId, onJsonViewClick, tableMode } = _a, props = __rest(_a, ["flag", "flagTooltip", "flagsCount", "row", "showJsonViewer", "isTextShown", "showIdButton", "rowId", "onJsonViewClick", "tableMode"]);
|
|
28
|
+
const { t } = useTranslation();
|
|
29
|
+
return (_jsx(TableCell, Object.assign({}, props, { sx: {
|
|
30
|
+
overflow: 'visible',
|
|
31
|
+
} }, { children: _jsxs(ActionCellContainer, Object.assign({ "data-testid": "ActionsColumn_ActionCellContainer", tableMode: tableMode }, { children: [flag && (_jsx(_Fragment, { children: isTextShown ? (_jsx(Tooltip, Object.assign({ title: flagTooltip }, { children: _jsx(TextLabel, Object.assign({ "data-testid": "ActionsColumn_FlagLabel", sx: {
|
|
32
|
+
textAlign: 'left',
|
|
33
|
+
justifyContent: 'flex-start',
|
|
34
|
+
} }, { children: flagTooltip })) }))) : (_jsx(Tooltip, Object.assign({ title: flagTooltip }, { children: _jsxs(BadgeWrapper, Object.assign({ "data-testid": "ActionsColumn_FlagBadge", sx: {
|
|
35
|
+
paddingInline: '12px',
|
|
36
|
+
width: 'auto',
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
position: 'relative',
|
|
39
|
+
zIndex: 21,
|
|
40
|
+
gap: '0px',
|
|
41
|
+
}, whileHover: ['animate', 'fadeIn'], variants: {
|
|
42
|
+
animate: {
|
|
43
|
+
gap: '4px',
|
|
44
|
+
},
|
|
45
|
+
} }, { children: [_jsx(ActionIcon, { "data-testid": "ActionsColumn_FlagIcon", sx: {
|
|
46
|
+
width: '12px',
|
|
47
|
+
height: '11px',
|
|
48
|
+
}, src: (_b = flags[flag]) === null || _b === void 0 ? void 0 : _b.icon, alt: "flag-icon" }), (flagsCount !== null && flagsCount !== void 0 ? flagsCount : 0) > 1 && (_jsx(motion.div, Object.assign({ "data-testid": "ActionsColumn_StyledBadge_Container", style: {
|
|
49
|
+
alignItems: 'center',
|
|
50
|
+
justifyContent: 'center',
|
|
51
|
+
gap: '4px',
|
|
52
|
+
display: 'flex',
|
|
53
|
+
zIndex: 10,
|
|
54
|
+
}, initial: { width: 0, opacity: 0 }, transition: {
|
|
55
|
+
animate: {
|
|
56
|
+
duration: 0.5,
|
|
57
|
+
},
|
|
58
|
+
fadeIn: {
|
|
59
|
+
duration: 0.2,
|
|
60
|
+
},
|
|
61
|
+
}, variants: {
|
|
62
|
+
animate: {
|
|
63
|
+
width: 'auto',
|
|
64
|
+
},
|
|
65
|
+
fadeIn: {
|
|
66
|
+
transition: {
|
|
67
|
+
delay: 0.5,
|
|
68
|
+
},
|
|
69
|
+
opacity: 1,
|
|
70
|
+
},
|
|
71
|
+
} }, { children: _jsxs(StyledBadge, Object.assign({ compact: true, variant: colorToVariant[(_c = flags[flag]) === null || _c === void 0 ? void 0 : _c.color] || BadgeVariants.ORANGE, "data-testid": "ActionsColumn_StyledBadge" }, { children: [flagsCount, "x"] })) })))] })) }))) })), showIdButton ? (tableMode === 'sheet' ? (_jsx(SheetViewIDButton, { rowId: rowId || row.id })) : (_jsx(IDButton, { rowId: rowId || row.id }))) : null, _jsx("div", Object.assign({ "data-testid": "ActionsColumn_IconsContainer", style: {
|
|
72
|
+
display: 'flex',
|
|
73
|
+
alignItems: 'center',
|
|
74
|
+
justifyContent: 'center',
|
|
75
|
+
gap: '5px',
|
|
76
|
+
} }, { children: showJsonViewer && (_jsx(TransparentButton, Object.assign({ onClick: onJsonViewClick, type: "button", "data-testid": "ActionsColumn_TransparentButton" }, { children: _jsx(Tooltip, Object.assign({ title: t('jsonViewer') }, { children: _jsx(IdButtonContainer, Object.assign({ tableMode: tableMode, "data-testid": "ActionsColumn_IdButtonContainer" }, { children: tableMode === 'sheet' ? (_jsx("span", Object.assign({ style: { fontSize: '11px', fontWeight: 400 } }, { children: "View API" }))) : (_jsx(motion.img, { src: jsonBlackIcon, alt: "icon" }, "id-icon")) })) })) }))) }))] })) })));
|
|
77
|
+
}
|
|
78
|
+
export default memo(ActionsColumn);
|
|
@@ -11,7 +11,9 @@ interface SheetViewTableHeaderProps {
|
|
|
11
11
|
onColumnPin?: (columnId: string, position: 'start' | 'end' | 'unpin') => void;
|
|
12
12
|
isPinnable?: boolean;
|
|
13
13
|
lastColumnId?: string | null;
|
|
14
|
+
selectedColumn?: string | null;
|
|
15
|
+
onColumnClick?: (columnId: string, event: React.MouseEvent) => void;
|
|
14
16
|
}
|
|
15
|
-
declare function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns, onColumnPin, isPinnable, lastColumnId, }: SheetViewTableHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
declare function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, }: SheetViewTableHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
16
18
|
declare const _default: import("react").MemoExoticComponent<typeof SheetViewTableHeader>;
|
|
17
19
|
export default _default;
|
|
@@ -6,7 +6,7 @@ import { columnIcon, pinIcon, sortAzIcon, sortZaIcon, unpinIcon } from '../../..
|
|
|
6
6
|
import ColumnFilter from '../components/ColumnFilter';
|
|
7
7
|
import { StyledCell } from '../style';
|
|
8
8
|
import { ActionIcon, ColumnIcon, PinIconContainer, StyledHeader, StyledMUITableRow } from './style';
|
|
9
|
-
function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns = [], onColumnPin, isPinnable = false, lastColumnId, }) {
|
|
9
|
+
function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns = [], onColumnPin, isPinnable = false, lastColumnId, selectedColumn = null, onColumnClick, }) {
|
|
10
10
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
11
11
|
const open = Boolean(anchorEl);
|
|
12
12
|
const theme = useTheme();
|
|
@@ -44,7 +44,11 @@ function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort
|
|
|
44
44
|
const isLast = id === columns[columns.length - 1].id;
|
|
45
45
|
const isPinned = pinnedColumns.includes(id);
|
|
46
46
|
const isDefaultPinned = !!column.isDefaultPinned;
|
|
47
|
-
|
|
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 ? '1px solid #1F88D0' : '1px solid #F2F2F2', backgroundColor: isSelected ? '#e3f2fd' : '#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("span", Object.assign({ style: { textOverflow: 'ellipsis', width: '80%', overflow: 'hidden' }, "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 && (_jsx(PinIconContainer, Object.assign({ isPinned: isPinned, 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}`));
|
|
48
52
|
}) })), _jsx(Dropdown, { open: open, onClose: handleClose, anchorEl: anchorEl, menuItems: [
|
|
49
53
|
{
|
|
50
54
|
label: 'Sort A-Z',
|
|
@@ -25,7 +25,7 @@ import SheetViewTableHeader from './SheetViewTableHeader';
|
|
|
25
25
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
26
26
|
import { usePinnedColumns } from './hooks/usePinnedColumns';
|
|
27
27
|
import { useSynchronizedScroll } from './hooks/useSynchronizedScroll';
|
|
28
|
-
const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToIndex, lastItemIndex, totalCount, isError, areAllRowsLoaded, isPinned) => ({
|
|
28
|
+
const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToIndex, lastItemIndex, totalCount, isError, areAllRowsLoaded, isPinned, selectedCell, selectedColumn, onCellClick) => ({
|
|
29
29
|
columns,
|
|
30
30
|
isLoading,
|
|
31
31
|
rows,
|
|
@@ -39,12 +39,28 @@ const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToInde
|
|
|
39
39
|
newLoadedRowsEndIndex: lastItemIndex,
|
|
40
40
|
isSheetView: true,
|
|
41
41
|
isPinned,
|
|
42
|
+
selectedCell,
|
|
43
|
+
selectedColumn,
|
|
44
|
+
onCellClick,
|
|
42
45
|
}));
|
|
43
46
|
function SheetViewVirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader, headerProps, rowProps, footerProps, rowHeight = 28, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, showBackgroundColor, areAllRowsLoaded = false, tableBodyStyles, tableTitle, dragControls, onColumnPin, clearBackdropVisibilityTimeout = 100, isPinnable = false, tableMode, }) {
|
|
44
47
|
var _a, _b, _c;
|
|
45
48
|
const theme = useTheme();
|
|
46
49
|
const { pinnedStartColumns, pinnedEndColumns, handleColumnPin, pinnedStartColumnsData, pinnedEndColumnsData, unpinnedColumnsData, orderedColumns, lastColumnId, } = usePinnedColumns(columns, isPinnable, onColumnPin);
|
|
47
50
|
const { pinnedStartVirtualListRef, scrollableVirtualListRef, pinnedEndVirtualListRef, handleScroll } = useSynchronizedScroll();
|
|
51
|
+
const [selectedCell, setSelectedCell] = useState(null);
|
|
52
|
+
const [selectedColumn, setSelectedColumn] = useState(null);
|
|
53
|
+
const handleCellClick = useCallback((rowIndex, columnId, event) => {
|
|
54
|
+
event.stopPropagation();
|
|
55
|
+
const cellKey = `${rowIndex}-${columnId}`;
|
|
56
|
+
setSelectedCell((prev) => (prev === cellKey ? null : cellKey));
|
|
57
|
+
setSelectedColumn(null);
|
|
58
|
+
}, []);
|
|
59
|
+
const handleColumnClick = useCallback((columnId, event) => {
|
|
60
|
+
event.stopPropagation();
|
|
61
|
+
setSelectedColumn((prev) => (prev === columnId ? null : columnId));
|
|
62
|
+
setSelectedCell(null);
|
|
63
|
+
}, []);
|
|
48
64
|
const onPointerDown = (e) => {
|
|
49
65
|
dragControls === null || dragControls === void 0 ? void 0 : dragControls.start(e);
|
|
50
66
|
};
|
|
@@ -61,9 +77,9 @@ function SheetViewVirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, sho
|
|
|
61
77
|
const lastItemIndex = rows.length - 1;
|
|
62
78
|
const areTotalRowsNotFillingHeight = isHeightNotFullyFilledByRows(rows.length) && !tableLoading;
|
|
63
79
|
const itemsCount = isDelayedFetchingNextPage || (areAllRowsLoaded && !areTotalRowsNotFillingHeight) ? rows.length + 1 : rows.length;
|
|
64
|
-
const pinnedStartItemData = createItemData(pinnedStartColumnsData, isDelayedFetchingNextPage, rows, rowProps, scrollToIndex, lastItemIndex, (_a = footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount) !== null && _a !== void 0 ? _a : 0, isError, areAllRowsLoaded && !areTotalRowsNotFillingHeight, true);
|
|
65
|
-
const pinnedEndItemData = createItemData(pinnedEndColumnsData, isDelayedFetchingNextPage, rows, rowProps, scrollToIndex, lastItemIndex, (_b = footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount) !== null && _b !== void 0 ? _b : 0, isError, areAllRowsLoaded && !areTotalRowsNotFillingHeight, true);
|
|
66
|
-
const unpinnedItemData = createItemData(unpinnedColumnsData, isDelayedFetchingNextPage, rows, rowProps, scrollToIndex, lastItemIndex, (_c = footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount) !== null && _c !== void 0 ? _c : 0, isError, areAllRowsLoaded && !areTotalRowsNotFillingHeight, false);
|
|
80
|
+
const pinnedStartItemData = createItemData(pinnedStartColumnsData, isDelayedFetchingNextPage, rows, rowProps, scrollToIndex, lastItemIndex, (_a = footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount) !== null && _a !== void 0 ? _a : 0, isError, areAllRowsLoaded && !areTotalRowsNotFillingHeight, true, selectedCell, selectedColumn, handleCellClick);
|
|
81
|
+
const pinnedEndItemData = createItemData(pinnedEndColumnsData, isDelayedFetchingNextPage, rows, rowProps, scrollToIndex, lastItemIndex, (_b = footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount) !== null && _b !== void 0 ? _b : 0, isError, areAllRowsLoaded && !areTotalRowsNotFillingHeight, true, selectedCell, selectedColumn, handleCellClick);
|
|
82
|
+
const unpinnedItemData = createItemData(unpinnedColumnsData, isDelayedFetchingNextPage, rows, rowProps, scrollToIndex, lastItemIndex, (_c = footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount) !== null && _c !== void 0 ? _c : 0, isError, areAllRowsLoaded && !areTotalRowsNotFillingHeight, false, selectedCell, selectedColumn, handleCellClick);
|
|
67
83
|
const createVirtualTableContainer = useCallback((columnsToRender, containerKey, isPinned = false, fixedWidth) => {
|
|
68
84
|
const tableItemsCount = itemsCount;
|
|
69
85
|
const handleOnLoadMoreItems = () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -94,6 +110,9 @@ function SheetViewVirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, sho
|
|
|
94
110
|
handleScroll,
|
|
95
111
|
scrollToIndex,
|
|
96
112
|
areTotalRowsNotFillingHeight,
|
|
113
|
+
selectedCell,
|
|
114
|
+
selectedColumn,
|
|
115
|
+
handleCellClick,
|
|
97
116
|
]);
|
|
98
117
|
const showNoDataView = tableLoading || tableError || tableEmpty || hasTimeoutError;
|
|
99
118
|
const pinnedStartColumnsWidth = useMemo(() => pinnedStartColumnsData.reduce((acc, col) => {
|
|
@@ -109,12 +128,12 @@ function SheetViewVirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, sho
|
|
|
109
128
|
const containerKey = position === 'start' ? 'pinnedStart' : 'pinnedEnd';
|
|
110
129
|
if (columnsData.length === 0)
|
|
111
130
|
return null;
|
|
112
|
-
return (_jsx(Wrapper, Object.assign({ width: columnsWidth }, { children: _jsxs(StyledTableBox, Object.assign({ as: "main", id: "sheet-table-box-container", "aria-labelledby": "sheet-table-box-container", "data-testid": "SheetViewVirtualTable_StyledTableBox", "data-title": tableTitle, "data-direction": theme.direction, "data-are-all-rows-loaded": !!areAllRowsLoaded, "data-is-fetching-next-page": !!isFetchingNextPage, "data-scroll-to-index": scrollToIndex, "data-is-loading": !!isLoading, "data-is-error": !!isError, "data-is-error-timeout": !!hasTimeoutError, "data-show-background-color": !!showBackgroundColor, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showBackgroundColor: showBackgroundColor, showNoDataView: showNoDataView }, { children: [showHeader && (_jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_PinnedTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: columnsData, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: pinnedColumnsList, onColumnPin: handleColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
|
131
|
+
return (_jsx(Wrapper, Object.assign({ width: columnsWidth }, { children: _jsxs(StyledTableBox, Object.assign({ as: "main", id: "sheet-table-box-container", "aria-labelledby": "sheet-table-box-container", "data-testid": "SheetViewVirtualTable_StyledTableBox", "data-title": tableTitle, "data-direction": theme.direction, "data-are-all-rows-loaded": !!areAllRowsLoaded, "data-is-fetching-next-page": !!isFetchingNextPage, "data-scroll-to-index": scrollToIndex, "data-is-loading": !!isLoading, "data-is-error": !!isError, "data-is-error-timeout": !!hasTimeoutError, "data-show-background-color": !!showBackgroundColor, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showBackgroundColor: showBackgroundColor, showNoDataView: showNoDataView }, { children: [showHeader && (_jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_PinnedTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: columnsData, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: pinnedColumnsList, onColumnPin: handleColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: handleColumnClick })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
|
113
132
|
width: '100%',
|
|
114
133
|
minWidth: 'fit-content',
|
|
115
134
|
} }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_PinnedStyledBox", hidePadding: true, className: "list-wrapper" }, { children: createVirtualTableContainer(columnsData, containerKey, true, columnsWidth) })) }))] })) })));
|
|
116
135
|
};
|
|
117
|
-
return (_jsxs(_Fragment, { children: [_jsxs(TableContainer, { children: [showNoDataView ? (_jsx(StyledTableBox, Object.assign({ as: "main", id: "sheet-table-box-container", "aria-labelledby": "sheet-table-box-container", "data-testid": "SheetViewVirtualTable_StyledTableBox", "data-title": tableTitle, "data-direction": theme.direction, "data-are-all-rows-loaded": !!areAllRowsLoaded, "data-is-fetching-next-page": !!isFetchingNextPage, "data-scroll-to-index": scrollToIndex, "data-is-loading": !!isLoading, "data-is-error": !!isError, "data-is-error-timeout": !!hasTimeoutError, "data-show-background-color": !!showBackgroundColor, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showBackgroundColor: showBackgroundColor, showNoDataView: showNoDataView }, { children: _jsx(TableWrapper, Object.assign({ isSheetView: true, "data-testid": "SheetViewVirtualTable_TableWrapper", showNoDataView: showNoDataView, sx: tableBodyStyles }, { children: _jsx(TableNoData, { error: error, tableEmpty: tableEmpty, isTimeoutError: hasTimeoutError, tableError: tableError, tableLoading: tableLoading, orderedColumns: orderedColumns, triggerDataRefetch: triggerDataRefetch, footerProps: footerProps }) })) }))) : (_jsxs(SheetViewVirtualTableWrapper, { children: [renderPinnedColumn('start', pinnedStartColumnsData, pinnedStartColumnsWidth, pinnedStartColumns), _jsx(MainTableWrapper, Object.assign({ hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0 }, { children: _jsx(StyledTableBox, Object.assign({ as: "main", id: "sheet-table-box-container", "aria-labelledby": "sheet-table-box-container", "data-testid": "SheetViewVirtualTable_StyledTableBox", "data-title": tableTitle, "data-direction": theme.direction, "data-are-all-rows-loaded": !!areAllRowsLoaded, "data-is-fetching-next-page": !!isFetchingNextPage, "data-scroll-to-index": scrollToIndex, "data-is-loading": !!isLoading, "data-is-error": !!isError, "data-is-error-timeout": !!hasTimeoutError, "data-show-background-color": !!showBackgroundColor, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showBackgroundColor: showBackgroundColor, showNoDataView: showNoDataView, scrollable: true }, { children: _jsxs(TableWrapper, Object.assign({ "data-testid": "SheetViewVirtualTable_TableWrapper", showNoDataView: showNoDataView, sx: Object.assign(Object.assign({}, tableBodyStyles), { display: 'flex', flexDirection: 'column', height: '100%' }) }, { children: [showHeader && (_jsx(UnpinnedTableHeaderWrapper, { children: _jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_UnpinnedTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: unpinnedColumnsData, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: [...pinnedStartColumns, ...pinnedEndColumns], onColumnPin: handleColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId }) })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
|
136
|
+
return (_jsxs(_Fragment, { children: [_jsxs(TableContainer, { children: [showNoDataView ? (_jsx(StyledTableBox, Object.assign({ as: "main", id: "sheet-table-box-container", "aria-labelledby": "sheet-table-box-container", "data-testid": "SheetViewVirtualTable_StyledTableBox", "data-title": tableTitle, "data-direction": theme.direction, "data-are-all-rows-loaded": !!areAllRowsLoaded, "data-is-fetching-next-page": !!isFetchingNextPage, "data-scroll-to-index": scrollToIndex, "data-is-loading": !!isLoading, "data-is-error": !!isError, "data-is-error-timeout": !!hasTimeoutError, "data-show-background-color": !!showBackgroundColor, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showBackgroundColor: showBackgroundColor, showNoDataView: showNoDataView }, { children: _jsx(TableWrapper, Object.assign({ isSheetView: true, "data-testid": "SheetViewVirtualTable_TableWrapper", showNoDataView: showNoDataView, sx: tableBodyStyles }, { children: _jsx(TableNoData, { error: error, tableEmpty: tableEmpty, isTimeoutError: hasTimeoutError, tableError: tableError, tableLoading: tableLoading, orderedColumns: orderedColumns, triggerDataRefetch: triggerDataRefetch, footerProps: footerProps }) })) }))) : (_jsxs(SheetViewVirtualTableWrapper, { children: [renderPinnedColumn('start', pinnedStartColumnsData, pinnedStartColumnsWidth, pinnedStartColumns), _jsx(MainTableWrapper, Object.assign({ hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0 }, { children: _jsx(StyledTableBox, Object.assign({ as: "main", id: "sheet-table-box-container", "aria-labelledby": "sheet-table-box-container", "data-testid": "SheetViewVirtualTable_StyledTableBox", "data-title": tableTitle, "data-direction": theme.direction, "data-are-all-rows-loaded": !!areAllRowsLoaded, "data-is-fetching-next-page": !!isFetchingNextPage, "data-scroll-to-index": scrollToIndex, "data-is-loading": !!isLoading, "data-is-error": !!isError, "data-is-error-timeout": !!hasTimeoutError, "data-show-background-color": !!showBackgroundColor, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showBackgroundColor: showBackgroundColor, showNoDataView: showNoDataView, scrollable: true }, { children: _jsxs(TableWrapper, Object.assign({ "data-testid": "SheetViewVirtualTable_TableWrapper", showNoDataView: showNoDataView, sx: Object.assign(Object.assign({}, tableBodyStyles), { display: 'flex', flexDirection: 'column', height: '100%' }) }, { children: [showHeader && (_jsx(UnpinnedTableHeaderWrapper, { children: _jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_UnpinnedTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: unpinnedColumnsData, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: [...pinnedStartColumns, ...pinnedEndColumns], onColumnPin: handleColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: handleColumnClick }) })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
|
118
137
|
width: '100%',
|
|
119
138
|
minWidth: 'fit-content',
|
|
120
139
|
} }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_ScrollableStyledBox", hidePadding: true, className: "list-wrapper" }, { children: createVirtualTableContainer(unpinnedColumnsData, 'scrollable', false) })) }))] })) })) })), renderPinnedColumn('end', pinnedEndColumnsData, pinnedEndColumnsWidth, [...pinnedStartColumns, ...pinnedEndColumns])] })), !showNoDataView && areTotalRowsNotFillingHeight && !isFetchingNextPage && (_jsx(TableLastItem, { height: (itemsCount + 1) * TABLE_ROW_HEIGHT, sandboxMode: footerProps === null || footerProps === void 0 ? void 0 : footerProps.sandboxMode, "data-testid": "SheetViewVirtualTable_TableLastItem" }))] }), _jsx(TableFooter, Object.assign({ "data-testid": "SheetViewVirtualTable_TableFooter", showSeparator: true, showBackDrop: showBackDrop, onPointerDown: onPointerDown }, footerProps))] }));
|
|
@@ -11,7 +11,11 @@ interface ITableRowProps<R = any> {
|
|
|
11
11
|
showLoadedStyle?: boolean;
|
|
12
12
|
};
|
|
13
13
|
isSheetView?: boolean;
|
|
14
|
+
selectedCell?: string | null;
|
|
15
|
+
selectedColumn?: string | null;
|
|
16
|
+
onCellClick?: (rowIndex: number, columnId: string, event: React.MouseEvent) => void;
|
|
17
|
+
isLastRow?: boolean;
|
|
14
18
|
}
|
|
15
|
-
declare function TableRow({ row, columns, index, rowProps, isSheetView }: Readonly<ITableRowProps>): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell, selectedColumn, onCellClick, isLastRow, }: Readonly<ITableRowProps>): import("react/jsx-runtime").JSX.Element;
|
|
16
20
|
declare const _default: import("react").MemoExoticComponent<typeof TableRow>;
|
|
17
21
|
export default _default;
|
|
@@ -3,7 +3,8 @@ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { memo, useMemo } from 'react';
|
|
4
4
|
import { areEqual } from 'react-window';
|
|
5
5
|
import { StyledCell, StyledTableRow } from '../style';
|
|
6
|
-
|
|
6
|
+
import { getBorderStyle } from '../utils/getBorderStyle';
|
|
7
|
+
function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = null, selectedColumn = null, onCellClick, isLastRow = false, }) {
|
|
7
8
|
const renderCell = (column) => {
|
|
8
9
|
const { render, format, selector } = column;
|
|
9
10
|
if (!(column === null || column === void 0 ? void 0 : column.id) || !row)
|
|
@@ -13,8 +14,19 @@ function TableRow({ row, columns, index, rowProps, isSheetView }) {
|
|
|
13
14
|
return render ? render({ row, column, index, value: row[column === null || column === void 0 ? void 0 : column.id] }) : _jsx(_Fragment, { children: formattedValue });
|
|
14
15
|
};
|
|
15
16
|
const content = useMemo(() => (_jsx(_Fragment, { children: columns.map((column, colIndex) => {
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
const columnIdStr = String(column.id);
|
|
18
|
+
const cellKey = `${index}-${columnIdStr}`;
|
|
19
|
+
const isCellSelected = selectedCell === cellKey;
|
|
20
|
+
const isColumnSelected = selectedColumn === columnIdStr;
|
|
21
|
+
const isSelected = isCellSelected || isColumnSelected;
|
|
22
|
+
const borderStyle = getBorderStyle({
|
|
23
|
+
isSelected,
|
|
24
|
+
isCellSelected,
|
|
25
|
+
isColumnSelected,
|
|
26
|
+
isLastRow,
|
|
27
|
+
});
|
|
28
|
+
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: column.id === columns[0].id, isLast: column.id === columns[columns.length - 1].id, onClick: (event) => onCellClick === null || onCellClick === void 0 ? void 0 : onCellClick(index, columnIdStr, event), sx: Object.assign(Object.assign({ width: column.width, minWidth: column.width, textAlign: column.align, justifyContent: column.align === 'right' ? 'flex-end' : 'flex-start', cursor: 'pointer' }, borderStyle), column.cellStyle), isSheetView: isSheetView }, { children: renderCell(column) }), `${column.id}-${colIndex}`));
|
|
29
|
+
}) })), [columns, row, index, selectedCell, selectedColumn, onCellClick, isLastRow]);
|
|
18
30
|
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));
|
|
19
31
|
}
|
|
20
32
|
export default memo(TableRow, areEqual);
|
|
@@ -68,7 +68,7 @@ function ListItemWrapper(_a) {
|
|
|
68
68
|
height: '100%',
|
|
69
69
|
} }, { children: isError ? _jsx(RowErrorState, {}) : lastRowContent })) })));
|
|
70
70
|
}
|
|
71
|
-
return _jsx(TableRow, { index: index, row: row, columns: columns, rowProps: memoizedRowProps, isSheetView: isSheetView }, `row-${index}`);
|
|
71
|
+
return (_jsx(TableRow, { index: index, row: row, columns: columns, rowProps: memoizedRowProps, isSheetView: isSheetView, selectedCell: restData.selectedCell, selectedColumn: restData.selectedColumn, onCellClick: restData.onCellClick, isLastRow: index === rows.length - 1 }, `row-${index}`));
|
|
72
72
|
}, [restData, index, row, columns, memoizedRowProps, isSheetView]);
|
|
73
73
|
return (_jsx("div", Object.assign({ "data-testid": "ListItemWrapper", style: Object.assign(Object.assign({}, style), { top: Number(style.top) - ((_b = renderedScrollTopRef === null || renderedScrollTopRef === void 0 ? void 0 : renderedScrollTopRef.current) !== null && _b !== void 0 ? _b : 0), willChange: 'top' }) }, { children: _jsx(StyledItemWrapper, Object.assign({ "data-testid": "ListItemWrapper_StyledItemWrapper" }, { children: memoizedListItemComponent })) })));
|
|
74
74
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
interface GetBorderStyleParams {
|
|
2
|
+
isSelected: boolean;
|
|
3
|
+
isCellSelected: boolean;
|
|
4
|
+
isColumnSelected: boolean;
|
|
5
|
+
isLastRow: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const getBorderStyle: ({ isSelected, isCellSelected, isColumnSelected, isLastRow }: GetBorderStyleParams) => {
|
|
8
|
+
border?: undefined;
|
|
9
|
+
backgroundColor?: undefined;
|
|
10
|
+
borderWidth?: undefined;
|
|
11
|
+
borderStyle?: undefined;
|
|
12
|
+
borderColor?: undefined;
|
|
13
|
+
borderBottom?: undefined;
|
|
14
|
+
height?: undefined;
|
|
15
|
+
minHeight?: undefined;
|
|
16
|
+
display?: undefined;
|
|
17
|
+
alignItems?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
border: string;
|
|
20
|
+
backgroundColor: string;
|
|
21
|
+
borderWidth?: undefined;
|
|
22
|
+
borderStyle?: undefined;
|
|
23
|
+
borderColor?: undefined;
|
|
24
|
+
borderBottom?: undefined;
|
|
25
|
+
height?: undefined;
|
|
26
|
+
minHeight?: undefined;
|
|
27
|
+
display?: undefined;
|
|
28
|
+
alignItems?: undefined;
|
|
29
|
+
} | {
|
|
30
|
+
borderWidth: string;
|
|
31
|
+
borderStyle: string;
|
|
32
|
+
borderColor: string;
|
|
33
|
+
borderBottom: string;
|
|
34
|
+
backgroundColor: string;
|
|
35
|
+
height: string;
|
|
36
|
+
minHeight: string;
|
|
37
|
+
display: string;
|
|
38
|
+
alignItems: string;
|
|
39
|
+
border?: undefined;
|
|
40
|
+
};
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const getBorderStyle = ({ isSelected, isCellSelected, isColumnSelected, isLastRow }) => {
|
|
2
|
+
if (!isSelected)
|
|
3
|
+
return {};
|
|
4
|
+
if (isCellSelected && !isColumnSelected) {
|
|
5
|
+
return {
|
|
6
|
+
border: '0.5px solid #1F88D0',
|
|
7
|
+
backgroundColor: '#F4F9FC',
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
if (isColumnSelected) {
|
|
11
|
+
return {
|
|
12
|
+
borderWidth: isLastRow ? '0px 0.5px 1px 0.5px' : '0px 0.5px 0px 0.5px',
|
|
13
|
+
borderStyle: 'solid',
|
|
14
|
+
borderColor: '#1F88D0',
|
|
15
|
+
borderBottom: !isLastRow ? '1px solid #F2F2F2' : '0.5px solid #1F88D0',
|
|
16
|
+
backgroundColor: '#F4F9FC',
|
|
17
|
+
height: '100%',
|
|
18
|
+
minHeight: '28px',
|
|
19
|
+
display: 'flex',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return {};
|
|
24
|
+
};
|
|
@@ -97,7 +97,7 @@ export declare const chargeTableCellWidth: {
|
|
|
97
97
|
readonly receipt: {
|
|
98
98
|
readonly default: "85px";
|
|
99
99
|
readonly text: "150px";
|
|
100
|
-
readonly sheet: "
|
|
100
|
+
readonly sheet: "135px";
|
|
101
101
|
};
|
|
102
102
|
readonly fees: {
|
|
103
103
|
readonly default: "150px";
|
|
@@ -159,4 +159,14 @@ export declare const chargeTableCellWidth: {
|
|
|
159
159
|
readonly text: "52px";
|
|
160
160
|
readonly sheet: "52px";
|
|
161
161
|
};
|
|
162
|
+
readonly actionIcon: {
|
|
163
|
+
readonly default: "30px";
|
|
164
|
+
readonly text: "30px";
|
|
165
|
+
readonly sheet: "30px";
|
|
166
|
+
};
|
|
167
|
+
readonly actionIconSheet: {
|
|
168
|
+
readonly default: "100px";
|
|
169
|
+
readonly text: "100px";
|
|
170
|
+
readonly sheet: "300px";
|
|
171
|
+
};
|
|
162
172
|
};
|
|
@@ -97,7 +97,7 @@ export const chargeTableCellWidth = {
|
|
|
97
97
|
receipt: {
|
|
98
98
|
default: '85px',
|
|
99
99
|
text: '150px',
|
|
100
|
-
sheet: '
|
|
100
|
+
sheet: '135px',
|
|
101
101
|
},
|
|
102
102
|
fees: {
|
|
103
103
|
default: '150px',
|
|
@@ -159,4 +159,14 @@ export const chargeTableCellWidth = {
|
|
|
159
159
|
text: '52px',
|
|
160
160
|
sheet: '52px',
|
|
161
161
|
},
|
|
162
|
+
actionIcon: {
|
|
163
|
+
default: '30px',
|
|
164
|
+
text: '30px',
|
|
165
|
+
sheet: '30px',
|
|
166
|
+
},
|
|
167
|
+
actionIconSheet: {
|
|
168
|
+
default: '100px',
|
|
169
|
+
text: '100px',
|
|
170
|
+
sheet: '300px',
|
|
171
|
+
},
|
|
162
172
|
};
|
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.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.0.217-test.4",
|
|
5
|
+
"testVersion": 4,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"scripts": {
|
|
62
62
|
"ts:build": "rm -rf build && tsc -p tsconfig.npm.json && tsc-alias -p tsconfig.npm.json",
|
|
63
63
|
"push": "npm version patch --no-git-tag-version && npm run ts:build && npm publish --access public",
|
|
64
|
-
"test
|
|
64
|
+
"push:test": "node scripts/increment-test-version.cjs && npm run ts:build && npm publish --access public --tag test && node scripts/restore-version.cjs",
|
|
65
65
|
"dev": "vite",
|
|
66
66
|
"build": "tsc -b && vite build ",
|
|
67
67
|
"prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\"",
|