@tap-payments/os-micro-frontend-shared 0.0.69-sheetview-pin-v1 → 0.0.69

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 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
+ ```
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import type { IVirtualTable } from '../../types/index.js';
3
- declare function VirtualTable(props: Readonly<IVirtualTable>): import("react/jsx-runtime").JSX.Element;
3
+ declare function VirtualTable({ columns, rows, threshold, showHeader, headerProps, rowProps, footerProps, rowHeight, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, showBackgroundColor, areAllRowsLoaded, tableBodyStyles, tableMode, tableTitle, dragControls, }: Readonly<IVirtualTable>): import("react/jsx-runtime").JSX.Element;
4
4
  declare const _default: import("react").MemoExoticComponent<typeof VirtualTable>;
5
5
  export default _default;
@@ -22,7 +22,7 @@ import TableLastItem from './components/TableLastItem';
22
22
  import TableNoData from './components/TableNoData';
23
23
  import ListItemWrapper from './components/virtualScroll/ListItemWrapper';
24
24
  import { StyledBox, StyledTableBox, StyledVirtualList, TableContainer, TableWrapper } from './style';
25
- const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToIndex, lastItemIndex, totalCount, isError, areAllRowsLoaded, pinnedColumns) => ({
25
+ const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToIndex, lastItemIndex, totalCount, isError, areAllRowsLoaded) => ({
26
26
  columns,
27
27
  isLoading,
28
28
  rows,
@@ -32,30 +32,10 @@ const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToInde
32
32
  lastItemIndex,
33
33
  isError,
34
34
  areAllRowsLoaded,
35
- pinnedColumns,
36
35
  }));
37
- function VirtualTable(props) {
36
+ function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader, headerProps, rowProps, footerProps, rowHeight = TABLE_ROW_HEIGHT, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, showBackgroundColor, areAllRowsLoaded = false, tableBodyStyles, tableMode, tableTitle, dragControls, }) {
38
37
  var _a;
39
- const { columns, rows, threshold = TABLE_THRESHOLD, showHeader, headerProps, rowProps, footerProps, rowHeight = TABLE_ROW_HEIGHT, isLoading, error, columnsSorting, onColumnSort, pinnedColumns: controlledPinnedColumns, onColumnPin: onColumnPinProp, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, showBackgroundColor, areAllRowsLoaded = false, tableBodyStyles, tableMode, tableTitle, dragControls, isSheetView = false, } = props;
40
38
  const theme = useTheme();
41
- const [uncontrolledPinnedColumns, setUncontrolledPinnedColumns] = useState(new Set());
42
- const isControlled = controlledPinnedColumns !== undefined;
43
- const pinnedColumns = isControlled ? controlledPinnedColumns : uncontrolledPinnedColumns;
44
- const handleColumnPin = (columnId, isPinned) => {
45
- if (!isControlled) {
46
- setUncontrolledPinnedColumns((prev) => {
47
- const newSet = new Set(prev);
48
- if (isPinned) {
49
- newSet.add(columnId);
50
- }
51
- else {
52
- newSet.delete(columnId);
53
- }
54
- return newSet;
55
- });
56
- }
57
- onColumnPinProp === null || onColumnPinProp === void 0 ? void 0 : onColumnPinProp(columnId, isPinned);
58
- };
59
39
  const onPointerDown = (e) => {
60
40
  dragControls === null || dragControls === void 0 ? void 0 : dragControls.start(e);
61
41
  };
@@ -74,7 +54,7 @@ function VirtualTable(props) {
74
54
  const orderedColumns = useMemo(() => shownColumns.sort((a, b) => { var _a, _b; return ((_a = a === null || a === void 0 ? void 0 : a.order) !== null && _a !== void 0 ? _a : 1000000) - ((_b = b === null || b === void 0 ? void 0 : b.order) !== null && _b !== void 0 ? _b : 1000000); }), [shownColumns]);
75
55
  const areTotalRowsNotFillingHeight = isHeightNotFullyFilledByRows(rows.length) && !tableLoading;
76
56
  const itemsCount = isDelayedFetchingNextPage || (areAllRowsLoaded && !areTotalRowsNotFillingHeight) ? rows.length + 1 : rows.length;
77
- const itemData = createItemData(orderedColumns, isDelayedFetchingNextPage, rows, rowProps, scrollToIndex, lastItemIndex, (_a = footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount) !== null && _a !== void 0 ? _a : 0, isError, areAllRowsLoaded && !areTotalRowsNotFillingHeight, pinnedColumns);
57
+ const itemData = createItemData(orderedColumns, isDelayedFetchingNextPage, rows, rowProps, scrollToIndex, lastItemIndex, (_a = footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount) !== null && _a !== void 0 ? _a : 0, isError, areAllRowsLoaded && !areTotalRowsNotFillingHeight);
78
58
  const renderTableContainer = useMemo(() => {
79
59
  const setBackdropVisibility = (isVisible) => {
80
60
  setShowBackdrop(isVisible);
@@ -101,11 +81,9 @@ function VirtualTable(props) {
101
81
  areAllRowsLoaded,
102
82
  areTotalRowsNotFillingHeight,
103
83
  itemsCount,
104
- pinnedColumns,
105
84
  ]);
106
85
  const showNoDataView = tableLoading || tableError || tableEmpty || hasTimeoutError;
107
- const hasPinnableColumns = useMemo(() => columns.some((c) => c.pinnable), [columns]);
108
- return (_jsxs(_Fragment, { children: [_jsxs(TableContainer, { children: [_jsx(StyledTableBox, Object.assign({ as: "main", id: "table-box-container", "aria-labelledby": "table-box-container", "data-testid": "VirtualTable_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: _jsxs(TableWrapper, Object.assign({ isSheetView: isSheetView, "data-testid": "VirtualTable_TableWrapper", showNoDataView: showNoDataView, sx: Object.assign({}, tableBodyStyles) }, { children: [showHeader && (_jsx(TableHeader, { "data-testid": "VirtualTable_TableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: orderedColumns, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: pinnedColumns, onColumnPin: hasPinnableColumns ? handleColumnPin : undefined })), showNoDataView ? (_jsx(TableNoData, { error: error, tableEmpty: tableEmpty, isTimeoutError: hasTimeoutError, tableError: tableError, tableLoading: tableLoading, orderedColumns: orderedColumns, triggerDataRefetch: triggerDataRefetch, footerProps: footerProps })) : (_jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
86
+ return (_jsxs(_Fragment, { children: [_jsxs(TableContainer, { children: [_jsx(StyledTableBox, Object.assign({ as: "main", id: "table-box-container", "aria-labelledby": "table-box-container", "data-testid": "VirtualTable_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: _jsxs(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", showNoDataView: showNoDataView, sx: Object.assign({}, tableBodyStyles) }, { children: [showHeader && (_jsx(TableHeader, { "data-testid": "VirtualTable_TableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: orderedColumns, headerProps: headerProps, showBackDrop: showBackDrop })), showNoDataView ? (_jsx(TableNoData, { error: error, tableEmpty: tableEmpty, isTimeoutError: hasTimeoutError, tableError: tableError, tableLoading: tableLoading, orderedColumns: orderedColumns, triggerDataRefetch: triggerDataRefetch, footerProps: footerProps })) : (_jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
109
87
  width: '100%',
110
88
  minWidth: 'fit-content',
111
89
  } }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "VirtualTable_StyledBox", hidePadding: true, className: "list-wrapper" }, { children: renderTableContainer })) })))] })) })), !showNoDataView && areTotalRowsNotFillingHeight && !isFetchingNextPage && (_jsx(TableLastItem, { height: (itemsCount + 1) * TABLE_ROW_HEIGHT, sandboxMode: footerProps === null || footerProps === void 0 ? void 0 : footerProps.sandboxMode, "data-testid": "VirtualTable_TableLastItem" }))] }), _jsx(TableFooter, Object.assign({ "data-testid": "VirtualTable_TableFooter", showSeparator: true, showBackDrop: showBackDrop, onPointerDown: onPointerDown }, footerProps))] }));
@@ -8,9 +8,6 @@ export declare const actionsIcons: {
8
8
  };
9
9
  export declare const ActionIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
10
10
  export declare const ColumnIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
11
- export declare const PinIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
12
- isPinned: boolean;
13
- }, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
14
11
  interface StyledHeaderProps {
15
12
  showBackDrop: boolean;
16
13
  }
@@ -22,10 +19,8 @@ interface TableHeaderProps {
22
19
  headerProps?: TableHeadProps;
23
20
  columnsSorting?: IVirtualTable['columnsSorting'];
24
21
  onColumnSort?: IVirtualTable['onColumnSort'];
25
- pinnedColumns?: IVirtualTable['pinnedColumns'];
26
- onColumnPin?: IVirtualTable['onColumnPin'];
27
22
  showBackDrop: boolean;
28
23
  }
29
- declare function TableHeader(props: Readonly<TableHeaderProps>): import("react/jsx-runtime").JSX.Element;
24
+ declare function TableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting }: TableHeaderProps): import("react/jsx-runtime").JSX.Element;
30
25
  declare const _default: import("react").MemoExoticComponent<typeof TableHeader>;
31
26
  export default _default;
@@ -4,7 +4,7 @@ import { Box, styled, useTheme } from '@mui/material';
4
4
  import TableHead from '@mui/material/TableHead';
5
5
  import MUITableRow from '@mui/material/TableRow';
6
6
  import Dropdown from '../../DropdownMenu';
7
- import { columnIcon, disputeIcon, flagIcon, refundInitiatedIcon, sortAzIcon, sortZaIcon, pinIcon, unpinIcon } from '../../../constants/index.js';
7
+ import { columnIcon, disputeIcon, flagIcon, refundInitiatedIcon, sortAzIcon, sortZaIcon } from '../../../constants/index.js';
8
8
  import ColumnFilter from './ColumnFilter';
9
9
  import { StyledCell } from '../style';
10
10
  export const actionsIcons = {
@@ -21,19 +21,6 @@ export const ColumnIcon = styled('img')(() => ({
21
21
  height: '6.4px',
22
22
  cursor: 'pointer',
23
23
  }));
24
- export const PinIcon = styled('img')(({ isPinned }) => ({
25
- width: '12px',
26
- height: '12px',
27
- cursor: 'pointer',
28
- opacity: isPinned ? 1 : 0.6,
29
- transform: isPinned ? 'scale(1.1)' : 'scale(1)',
30
- transition: 'all 0.2s ease',
31
- filter: isPinned ? 'brightness(1.2)' : 'brightness(1)',
32
- '&:hover': {
33
- opacity: 1,
34
- transform: 'scale(1.1)',
35
- },
36
- }));
37
24
  export const StyledHeader = styled(TableHead, {
38
25
  shouldForwardProp: (prop) => prop !== 'showBackDrop',
39
26
  })(({ showBackDrop, theme }) => ({
@@ -52,22 +39,10 @@ const StyledMUITableRow = styled(MUITableRow)({
52
39
  width: '100%',
53
40
  minWidth: 'fit-content',
54
41
  });
55
- function TableHeader(props) {
56
- const { columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns, onColumnPin } = props;
42
+ function TableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting }) {
57
43
  const [anchorEl, setAnchorEl] = useState(null);
58
44
  const open = Boolean(anchorEl);
59
45
  const theme = useTheme();
60
- console.log('--- TableHeader ---', {
61
- onColumnPinExists: !!onColumnPin,
62
- onColumnPinType: typeof onColumnPin,
63
- });
64
- console.log('TableHeader rendered with:', {
65
- columnsCount: columns.length,
66
- pinnedColumnsCount: (pinnedColumns === null || pinnedColumns === void 0 ? void 0 : pinnedColumns.size) || 0,
67
- pinnedColumnIds: Array.from(pinnedColumns || []),
68
- onColumnPinExists: !!onColumnPin,
69
- pinnableColumns: columns.filter((col) => col.pinnable).map((col) => col.id),
70
- });
71
46
  const handleClick = (event) => {
72
47
  setAnchorEl(event.currentTarget);
73
48
  };
@@ -82,65 +57,11 @@ function TableHeader(props) {
82
57
  handleClose();
83
58
  }
84
59
  };
85
- const handlePinToggle = (columnId) => {
86
- const isPinned = (pinnedColumns === null || pinnedColumns === void 0 ? void 0 : pinnedColumns.has(columnId)) || false;
87
- if (onColumnPin) {
88
- onColumnPin(columnId, !isPinned);
89
- }
90
- else {
91
- console.error('onColumnPin callback is not provided!');
92
- }
93
- };
94
- const calculateLeftPosition = (columnIndex) => {
95
- let left = 0;
96
- for (let i = 0; i < columnIndex; i++) {
97
- const column = columns[i];
98
- if (pinnedColumns === null || pinnedColumns === void 0 ? void 0 : pinnedColumns.has(column.id)) {
99
- const width = typeof column.width === 'string' ? parseInt(column.width) : column.width || 200;
100
- left += width;
101
- }
102
- }
103
- return left;
104
- };
105
60
  return (_jsxs(StyledHeader, Object.assign({ component: "nav", "data-testid": "VirtualTable_TableHeader_StyledHeader", showBackDrop: showBackDrop }, headerProps, { sx: Object.assign({ width: '100%', minWidth: 'auto', overflowX: 'scroll' }, headerProps === null || headerProps === void 0 ? void 0 : headerProps.sx) }, { children: [_jsx(StyledMUITableRow, Object.assign({ component: "section", "data-testid": "VirtualTable_TableHeader_StyledMUITableRow" }, { children: columns.map((column, colIndex) => {
106
- const { header, id, align, headerStyle, sortable, filter, pinnable } = column;
61
+ const { header, id, align, headerStyle, sortable, filter } = column;
107
62
  const isFirst = id === columns[0].id;
108
63
  const isLast = id === columns[columns.length - 1].id;
109
- const isPinned = (pinnedColumns === null || pinnedColumns === void 0 ? void 0 : pinnedColumns.has(id)) || false;
110
- const leftPosition = isPinned ? calculateLeftPosition(colIndex) : undefined;
111
- console.log('Rendering column:', id, 'isPinned:', isPinned, 'pinnedColumns size:', pinnedColumns === null || pinnedColumns === void 0 ? void 0 : pinnedColumns.size);
112
- return (_jsxs(StyledCell, Object.assign({ "data-id": id, component: "div", "data-testid": "VirtualTable_TableHeader_StyledCell", "data-column-id": column.id, "data-column-width": column.width, "data-column-width-used": column.width, "data-column-align": column.align, "data-column-order": column.order, "data-column-header": typeof column.header === 'string' ? column.header : 'component', "data-column-sortable": !!column.sortable, "data-column-filterable": !!column.filter, "data-column-pinned": isPinned, isFirst: isFirst, isLast: isLast, sx: Object.assign({ paddingInline: '0.6875rem', paddingLeft: isFirst ? '0' : '0.6875rem', paddingRight: isLast ? '0' : '0.6875rem', display: 'flex', gap: theme.spacing(0.5), alignItems: 'baseline', justifyContent: align === 'right' ? 'flex-end' : 'flex-start', width: column.width, textAlign: align, overflow: 'unset', position: isPinned ? 'sticky' : 'static', left: leftPosition, zIndex: isPinned ? 15 : 1, backgroundColor: isPinned ? theme.palette.background.paper : 'transparent', borderRight: isPinned ? `1px solid ${theme.palette.divider}` : 'none', boxShadow: isPinned ? theme.shadows[4] : 'none', '&::after': isPinned
113
- ? {
114
- content: '""',
115
- position: 'absolute',
116
- right: -1,
117
- top: 0,
118
- bottom: 0,
119
- width: '4px',
120
- background: `linear-gradient(90deg, rgba(0,0,0,0.1) 0%, transparent 100%)`,
121
- pointerEvents: 'none',
122
- }
123
- : {} }, headerStyle) }, { children: [typeof header === 'function' ? (header()) : (_jsx(Box, Object.assign({ "data-testid": "TableHeader_columns_header", sx: { maxWidth: '100%', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, { children: header && (_jsx("span", Object.assign({ style: { textOverflow: 'ellipsis', width: '80%', overflow: 'hidden' }, "data-testid": "VirtualTable_TableHeader_StyledCell_header_text" }, { children: header }))) }))), pinnable && (_jsx(Box, Object.assign({ component: "div", onClick: (e) => {
124
- e.stopPropagation();
125
- e.preventDefault();
126
- console.log('🔥 Pin wrapper clicked for column:', id, 'isPinned:', isPinned);
127
- handlePinToggle(id);
128
- }, sx: {
129
- cursor: 'pointer',
130
- display: 'flex',
131
- alignItems: 'center',
132
- justifyContent: 'center',
133
- padding: '2px',
134
- borderRadius: '2px',
135
- '&:hover': {
136
- backgroundColor: 'rgba(0,0,0,0.1)',
137
- },
138
- } }, { children: _jsx(PinIcon, { src: isPinned ? unpinIcon : pinIcon, alt: isPinned ? 'unpin-column' : 'pin-column', isPinned: isPinned, "data-testid": "VirtualTable_TableHeader_PinIcon", title: isPinned ? 'Unpin column' : 'Pin column', onError: (e) => {
139
- console.warn('Pin icon failed to load, using fallback');
140
- const target = e.target;
141
- target.src =
142
- 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIHZpZXdCb3g9IjAgMCAxMiAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjEyIiBoZWlnaHQ9IjEyIiBmaWxsPSIjNjY2IiByeD0iMiIvPgo8L3N2Zz4K';
143
- } }) }))), filter && _jsx(ColumnFilter, Object.assign({}, filter)), sortable && _jsx(ColumnIcon, { onClick: sortable ? handleClick : undefined, src: columnIcon, alt: "column-icon", "data-id": id })] }), `${id}-${colIndex}`));
64
+ return (_jsxs(StyledCell, Object.assign({ "data-id": id, component: "div", "data-testid": "VirtualTable_TableHeader_StyledCell", "data-column-id": column.id, "data-column-width": column.width, "data-column-width-used": column.width, "data-column-align": column.align, "data-column-order": column.order, "data-column-header": typeof column.header === 'string' ? column.header : 'component', "data-column-sortable": !!column.sortable, "data-column-filterable": !!column.filter, isFirst: isFirst, isLast: isLast, sx: Object.assign({ paddingInline: '0.6875rem', paddingLeft: isFirst ? '0' : '0.6875rem', paddingRight: isLast ? '0' : '0.6875rem', display: 'flex', gap: theme.spacing(0.5), alignItems: 'baseline', justifyContent: align === 'right' ? 'flex-end' : 'flex-start', width: column.width, textAlign: align, overflow: 'unset' }, headerStyle) }, { children: [typeof header === 'function' ? (header()) : (_jsx(Box, Object.assign({ "data-testid": "TableHeader_columns_header", sx: { maxWidth: '100%', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, { children: header && (_jsx("span", Object.assign({ style: { textOverflow: 'ellipsis', width: '80%', overflow: 'hidden' }, "data-testid": "VirtualTable_TableHeader_StyledCell_header_text" }, { children: header }))) }))), filter && _jsx(ColumnFilter, Object.assign({}, filter)), sortable && _jsx(ColumnIcon, { onClick: sortable ? handleClick : undefined, src: columnIcon, alt: "column-icon", "data-id": id })] }), `${id}-${colIndex}`));
144
65
  }) })), _jsx(Dropdown, { open: open, onClose: handleClose, anchorEl: anchorEl, menuItems: [
145
66
  {
146
67
  label: 'Sort A-Z',
@@ -5,13 +5,12 @@ interface ITableRowProps<R = any> {
5
5
  row: R;
6
6
  columns: Array<IColumnProps<R>>;
7
7
  index: number;
8
- pinnedColumns?: Set<string>;
9
8
  rowProps?: TableRowProps & {
10
9
  showShadowHighlight?: boolean;
11
10
  onRowClick?: (row: R) => void;
12
11
  showLoadedStyle?: boolean;
13
12
  };
14
13
  }
15
- declare function TableRow({ row, columns, index, pinnedColumns, rowProps }: Readonly<ITableRowProps>): import("react/jsx-runtime").JSX.Element;
14
+ declare function TableRow({ row, columns, index, rowProps }: Readonly<ITableRowProps>): import("react/jsx-runtime").JSX.Element;
16
15
  declare const _default: import("react").MemoExoticComponent<typeof TableRow>;
17
16
  export default _default;
@@ -1,22 +1,9 @@
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 { useTheme } from '@mui/material/styles';
5
4
  import { areEqual } from 'react-window';
6
5
  import { StyledCell, StyledTableRow } from '../style';
7
- function TableRow({ row, columns, index, pinnedColumns, rowProps }) {
8
- const theme = useTheme();
9
- const calculateLeftPosition = (columnIndex) => {
10
- let left = 0;
11
- for (let i = 0; i < columnIndex; i++) {
12
- const column = columns[i];
13
- if (pinnedColumns === null || pinnedColumns === void 0 ? void 0 : pinnedColumns.has(column.id)) {
14
- const width = typeof column.width === 'string' ? parseInt(column.width) : column.width || 200;
15
- left += width;
16
- }
17
- }
18
- return left;
19
- };
6
+ function TableRow({ row, columns, index, rowProps }) {
20
7
  const renderCell = (column) => {
21
8
  const { render, format, selector } = column;
22
9
  if (!(column === null || column === void 0 ? void 0 : column.id) || !row)
@@ -26,21 +13,8 @@ function TableRow({ row, columns, index, pinnedColumns, rowProps }) {
26
13
  return render ? render({ row, column, index, value: row[column === null || column === void 0 ? void 0 : column.id] }) : _jsx(_Fragment, { children: formattedValue });
27
14
  };
28
15
  const content = useMemo(() => (_jsx(_Fragment, { children: columns.map((column, colIndex) => {
29
- const isPinned = (pinnedColumns === null || pinnedColumns === void 0 ? void 0 : pinnedColumns.has(column.id)) || false;
30
- const leftPosition = isPinned ? calculateLeftPosition(colIndex) : undefined;
31
- 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, "data-column-pinned": isPinned, isFirst: column.id === columns[0].id, isLast: column.id === columns[columns.length - 1].id, sx: Object.assign({ width: column.width, minWidth: column.width, textAlign: column.align, justifyContent: column.align === 'right' ? 'flex-end' : 'flex-start', position: isPinned ? 'sticky' : 'static', left: leftPosition, zIndex: isPinned ? 14 : 1, backgroundColor: isPinned ? theme.palette.background.paper : 'transparent', borderRight: isPinned ? `1px solid ${theme.palette.divider}` : 'none', boxShadow: isPinned ? theme.shadows[3] : 'none', '&::after': isPinned
32
- ? {
33
- content: '""',
34
- position: 'absolute',
35
- right: -1,
36
- top: 0,
37
- bottom: 0,
38
- width: '4px',
39
- background: `linear-gradient(90deg, rgba(0,0,0,0.08) 0%, transparent 100%)`,
40
- pointerEvents: 'none',
41
- }
42
- : {} }, column.cellStyle) }, { children: renderCell(column) }), `${column.id}-${colIndex}`));
43
- }) })), [columns, row, pinnedColumns, theme]);
16
+ 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, sx: Object.assign({ width: column.width, minWidth: column.width, textAlign: column.align, justifyContent: column.align === 'right' ? 'flex-end' : 'flex-start' }, column.cellStyle) }, { children: renderCell(column) }), `${column.id}-${colIndex}`));
17
+ }) })), [columns, row]);
44
18
  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 }), content));
45
19
  }
46
20
  export default memo(TableRow, areEqual);
@@ -6,5 +6,5 @@ export declare const LastRowContent: React.MemoExoticComponent<({ isLoadingRow }
6
6
  export declare const StyledItemWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
7
7
  showShadowHighlight?: boolean | undefined;
8
8
  }, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
9
- declare function ListItemWrapper({ index, style, data: { renderedScrollTopRef, rows, rowProps, columns, isLoading, scrollToIndex, limit, totalCount, newLoadedRowsEndIndex, isError, areAllRowsLoaded, pinnedColumns, ...restData }, }: Readonly<ListChildComponentProps>): import("react/jsx-runtime").JSX.Element;
9
+ declare function ListItemWrapper({ index, style, data: { renderedScrollTopRef, rows, rowProps, columns, isLoading, scrollToIndex, limit, totalCount, newLoadedRowsEndIndex, isError, areAllRowsLoaded, ...restData }, }: Readonly<ListChildComponentProps>): import("react/jsx-runtime").JSX.Element;
10
10
  export default ListItemWrapper;
@@ -44,7 +44,7 @@ export const StyledItemWrapper = styled('div', {
44
44
  height: '100%',
45
45
  }));
46
46
  function ListItemWrapper(_a) {
47
- var { index, style } = _a, _b = _a.data, { renderedScrollTopRef, rows, rowProps, columns, isLoading, scrollToIndex, limit, totalCount, newLoadedRowsEndIndex, isError, areAllRowsLoaded, pinnedColumns } = _b, restData = __rest(_b, ["renderedScrollTopRef", "rows", "rowProps", "columns", "isLoading", "scrollToIndex", "limit", "totalCount", "newLoadedRowsEndIndex", "isError", "areAllRowsLoaded", "pinnedColumns"]);
47
+ var { index, style } = _a, _b = _a.data, { renderedScrollTopRef, rows, rowProps, columns, isLoading, scrollToIndex, limit, totalCount, newLoadedRowsEndIndex, isError, areAllRowsLoaded } = _b, restData = __rest(_b, ["renderedScrollTopRef", "rows", "rowProps", "columns", "isLoading", "scrollToIndex", "limit", "totalCount", "newLoadedRowsEndIndex", "isError", "areAllRowsLoaded"]);
48
48
  const lastItemIndex = rows.length - 1;
49
49
  const row = rows[index];
50
50
  const isLoadingRow = isLoading && index === lastItemIndex + 1;
@@ -69,8 +69,8 @@ function ListItemWrapper(_a) {
69
69
  height: '100%',
70
70
  } }, { children: isError ? _jsx(RowErrorState, {}) : lastRowContent })) })));
71
71
  }
72
- return _jsx(TableRow, { index: index, row: row, columns: columns, rowProps: memoizedRowProps, pinnedColumns: pinnedColumns }, `row-${index}`);
73
- }, [restData, index, row, columns, memoizedRowProps, pinnedColumns]);
72
+ return _jsx(TableRow, { index: index, row: row, columns: columns, rowProps: memoizedRowProps }, `row-${index}`);
73
+ }, [restData, index, row, columns, memoizedRowProps]);
74
74
  return (_jsx("div", Object.assign({ "data-testid": "ListItemWrapper", style: Object.assign(Object.assign({}, style), { top: Number(style.top) - renderedScrollTopRef.current, willChange: 'top' }) }, { children: _jsx(StyledItemWrapper, Object.assign({ "data-testid": "ListItemWrapper_StyledItemWrapper" }, { children: memoizedListItemComponent })) })));
75
75
  }
76
76
  export default ListItemWrapper;
@@ -1,7 +1,5 @@
1
1
  import VirtualTable from './VirtualTable';
2
- export { default as VirtualTable } from './VirtualTable';
3
2
  export { default as VirtualTableWithCard } from './VirtualTableWithCard';
4
- export { default as PinExample } from './PinExample';
5
3
  export * from './components';
6
4
  export { StyledCell } from './style';
7
5
  export default VirtualTable;
@@ -1,7 +1,5 @@
1
1
  import VirtualTable from './VirtualTable';
2
- export { default as VirtualTable } from './VirtualTable';
3
2
  export { default as VirtualTableWithCard } from './VirtualTableWithCard';
4
- export { default as PinExample } from './PinExample';
5
3
  export * from './components';
6
4
  export { StyledCell } from './style';
7
5
  export default VirtualTable;
@@ -1,7 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  interface TableWrapperProps {
3
3
  showNoDataView?: boolean;
4
- isSheetView?: boolean;
5
4
  }
6
5
  export declare const TableWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
7
6
  ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
@@ -6,8 +6,8 @@ import { motion } from 'framer-motion';
6
6
  import { TABLE_FOOTER_HEIGHT } from './components/TableFooter/style';
7
7
  import VirtualScrollList from './components/virtualScroll/VirtualScrollList';
8
8
  export const TableWrapper = styled(Box, {
9
- shouldForwardProp: (prop) => prop !== 'showNoDataView' && prop !== 'isSheetView',
10
- })(({ showNoDataView, isSheetView }) => ({
9
+ shouldForwardProp: (prop) => prop !== 'showNoDataView',
10
+ })(({ showNoDataView }) => ({
11
11
  display: 'flex',
12
12
  flexDirection: 'column',
13
13
  height: '100%',
@@ -15,8 +15,6 @@ export const TableWrapper = styled(Box, {
15
15
  minWidth: showNoDataView ? 'unset' : 'fit-content',
16
16
  overflow: 'hidden',
17
17
  overflowX: showNoDataView ? 'hidden' : 'scroll',
18
- margin: isSheetView ? '0 32px' : '0',
19
- border: isSheetView ? '1px solid #F2F2F2' : 'none',
20
18
  }));
21
19
  export const StyledBox = styled(Box, {
22
20
  shouldForwardProp: (prop) => prop !== 'hidePadding',
@@ -100,6 +98,8 @@ export const StyledTableBox = styled(Box, {
100
98
  paddingBottom: showBackgroundColor ? '52px' : '0',
101
99
  display: 'flex',
102
100
  flexDirection: 'column',
101
+ borderBottomLeftRadius: theme.spacing(1.5),
102
+ borderBottomRightRadius: theme.spacing(1.5),
103
103
  }));
104
104
  export const ActionIcon = styled(motion.img)(() => ({
105
105
  width: '24px',
@@ -15,8 +15,6 @@ export declare const flagIcon: string;
15
15
  export declare const disputeIcon: string;
16
16
  export declare const timezoneIcon: string;
17
17
  export declare const greyTimezoneIcon: string;
18
- export declare const pinIcon: string;
19
- export declare const unpinIcon: string;
20
18
  export declare const subscriptionIcon: string;
21
19
  export declare const savedCardIcon: string;
22
20
  export declare const egyptFlagIcon: string;
@@ -16,8 +16,6 @@ export const flagIcon = `${lightUrl}/flag.svg`;
16
16
  export const disputeIcon = `${lightUrl}/dispute.svg`;
17
17
  export const timezoneIcon = `${lightUrl}/timezone.svg`;
18
18
  export const greyTimezoneIcon = `${lightUrl}/greyTimezone.svg`;
19
- export const pinIcon = `${lightUrl}/pin.svg`;
20
- export const unpinIcon = `${lightUrl}/unpin.svg`;
21
19
  export const subscriptionIcon = `${lightUrl}/subscription.svg`;
22
20
  export const savedCardIcon = `${lightUrl}/savedCard.svg`;
23
21
  export const egyptFlagIcon = `${lightUrl}/egypt.svg`;
@@ -33,7 +33,6 @@ export interface IColumnProps<R = any> {
33
33
  cellStyle?: React.CSSProperties;
34
34
  headerStyle?: React.CSSProperties;
35
35
  filter?: IColumnFilter;
36
- pinnable?: boolean;
37
36
  }
38
37
  export interface TableFooterProps extends BoxProps {
39
38
  totalCount?: number;
@@ -108,8 +107,6 @@ export interface IVirtualTable<R = any> {
108
107
  error: Error | null;
109
108
  columnsSorting?: Record<keyof R, 'asc' | 'desc'>;
110
109
  onColumnSort?: (columnsSorting: Record<string, SortingOrder>) => void;
111
- pinnedColumns?: Set<string>;
112
- onColumnPin?: (columnId: string, isPinned: boolean) => void;
113
110
  loadMoreItems?: () => Promise<unknown>;
114
111
  triggerDataRefetch: () => Promise<unknown>;
115
112
  scrollToIndex?: number;
@@ -124,7 +121,6 @@ export interface IVirtualTable<R = any> {
124
121
  width: string | number;
125
122
  };
126
123
  dragControls?: DragControls;
127
- isSheetView?: boolean;
128
124
  }
129
125
  export type ColumnFilterValues = Record<string, string | string[] | {
130
126
  phone: string;
package/package.json CHANGED
@@ -1,129 +1,129 @@
1
- {
2
- "name": "@tap-payments/os-micro-frontend-shared",
3
- "description": "Shared components and utilities for Tap Payments micro frontends",
4
- "version": "0.0.69-sheetview-pin-v1",
5
- "type": "module",
6
- "main": "build/index.js",
7
- "module": "build/index.js",
8
- "types": "build/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "types": "./build/index.d.ts",
12
- "import": "./build/index.js",
13
- "require": "./build/index.js"
14
- },
15
- "./constants": {
16
- "types": "./build/constants/index.d.ts",
17
- "import": "./build/constants/index.js",
18
- "require": "./build/constants/index.js"
19
- },
20
- "./components": {
21
- "types": "./build/components/index.d.ts",
22
- "import": "./build/components/index.js",
23
- "require": "./build/components/index.js"
24
- },
25
- "./components/*": {
26
- "types": "./build/components/*/index.d.ts",
27
- "import": "./build/components/*/index.js",
28
- "require": "./build/components/*/index.js"
29
- },
30
- "./hooks": {
31
- "types": "./build/hooks/index.d.ts",
32
- "import": "./build/hooks/index.js",
33
- "require": "./build/hooks/index.js"
34
- },
35
- "./utils": {
36
- "types": "./build/utils/index.d.ts",
37
- "import": "./build/utils/index.js",
38
- "require": "./build/utils/index.js"
39
- },
40
- "./theme": {
41
- "types": "./build/theme/index.d.ts",
42
- "import": "./build/theme/index.js",
43
- "require": "./build/theme/index.js"
44
- },
45
- "./types": {
46
- "types": "./build/types/index.d.ts",
47
- "import": "./build/types/index.js",
48
- "require": "./build/types/index.js"
49
- }
50
- },
51
- "license": "MIT",
52
- "author": {
53
- "name": "Ahmed Sharkawy",
54
- "email": "a.elsharkawy@tap.company"
55
- },
56
- "files": [
57
- "build",
58
- "readme.md"
59
- ],
60
- "scripts": {
61
- "ts:build": "rm -rf build && tsc -p tsconfig.npm.json && tsc-alias -p tsconfig.npm.json",
62
- "push": "npm version patch --no-git-tag-version && npm run ts:build && npm publish --access public",
63
- "dev": "vite",
64
- "build": "tsc -b && vite build ",
65
- "prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\"",
66
- "prettier:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md,css,json}\"",
67
- "lint": "eslint . --color",
68
- "lint:fix": "eslint src --fix --color",
69
- "preview": "vite preview",
70
- "prepare": "husky"
71
- },
72
- "dependencies": {
73
- "@emotion/react": "^11.11.0",
74
- "@emotion/styled": "^11.11.0",
75
- "@hookform/resolvers": "^3.3.1",
76
- "@mui/material": "^5.12.3",
77
- "@uiw/react-json-view": "^2.0.0-alpha.16",
78
- "axios": "^1.4.0",
79
- "dayjs": "^1.11.8",
80
- "framer-motion": "10.11.0",
81
- "i18next": "^22.4.15",
82
- "memoize-one": "^6.0.0",
83
- "re-resizable": "^6.9.9",
84
- "react": "^18.2.0",
85
- "react-currency-input-field": "^3.6.11",
86
- "react-dom": "^18.2.0",
87
- "react-draggable": "^4.4.6",
88
- "react-dropzone": "^14.2.3",
89
- "react-hook-form": "^7.45.4",
90
- "react-hot-toast": "^2.4.1",
91
- "react-i18next": "^12.2.2",
92
- "react-multi-date-picker": "^4.1.2",
93
- "react-router-dom": "^6.14.2",
94
- "react-virtualized-auto-sizer": "^1.0.20",
95
- "react-window": "^1.8.9",
96
- "react-window-infinite-loader": "^1.0.9",
97
- "react18-input-otp": "^1.1.4",
98
- "recharts": "^2.15.1"
99
- },
100
- "devDependencies": {
101
- "@eslint/js": "^9.17.0",
102
- "@testing-library/jest-dom": "^5.16.5",
103
- "@types/lodash": "^4.17.15",
104
- "@types/react": "^18.2.6",
105
- "@types/react-dom": "^18.3.5",
106
- "@types/react-virtualized-auto-sizer": "^1.0.8",
107
- "@types/react-window": "^1.8.5",
108
- "@types/react-window-infinite-loader": "^1.0.6",
109
- "@vitejs/plugin-react": "^4.3.4",
110
- "eslint": "^9.17.0",
111
- "eslint-plugin-react-hooks": "^5.0.0",
112
- "eslint-plugin-react-refresh": "^0.4.16",
113
- "globals": "^15.14.0",
114
- "husky": "^8.0.3",
115
- "lint-staged": "^13.2.2",
116
- "prettier": "^2.8.8",
117
- "tsc-alias": "^1.8.16",
118
- "typescript": "5.0.2",
119
- "typescript-eslint": "^8.18.2",
120
- "vite": "6.0.5",
121
- "vite-tsconfig-paths": "^4.2.0"
122
- },
123
- "lint-staged": {
124
- "src/**/*.{ts,tsx,json,js,jsx}": [
125
- "yarn run prettier:fix",
126
- "yarn run lint"
127
- ]
128
- }
129
- }
1
+ {
2
+ "name": "@tap-payments/os-micro-frontend-shared",
3
+ "description": "Shared components and utilities for Tap Payments micro frontends",
4
+ "version": "0.0.69",
5
+ "type": "module",
6
+ "main": "build/index.js",
7
+ "module": "build/index.js",
8
+ "types": "build/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./build/index.d.ts",
12
+ "import": "./build/index.js",
13
+ "require": "./build/index.js"
14
+ },
15
+ "./constants": {
16
+ "types": "./build/constants/index.d.ts",
17
+ "import": "./build/constants/index.js",
18
+ "require": "./build/constants/index.js"
19
+ },
20
+ "./components": {
21
+ "types": "./build/components/index.d.ts",
22
+ "import": "./build/components/index.js",
23
+ "require": "./build/components/index.js"
24
+ },
25
+ "./components/*": {
26
+ "types": "./build/components/*/index.d.ts",
27
+ "import": "./build/components/*/index.js",
28
+ "require": "./build/components/*/index.js"
29
+ },
30
+ "./hooks": {
31
+ "types": "./build/hooks/index.d.ts",
32
+ "import": "./build/hooks/index.js",
33
+ "require": "./build/hooks/index.js"
34
+ },
35
+ "./utils": {
36
+ "types": "./build/utils/index.d.ts",
37
+ "import": "./build/utils/index.js",
38
+ "require": "./build/utils/index.js"
39
+ },
40
+ "./theme": {
41
+ "types": "./build/theme/index.d.ts",
42
+ "import": "./build/theme/index.js",
43
+ "require": "./build/theme/index.js"
44
+ },
45
+ "./types": {
46
+ "types": "./build/types/index.d.ts",
47
+ "import": "./build/types/index.js",
48
+ "require": "./build/types/index.js"
49
+ }
50
+ },
51
+ "license": "MIT",
52
+ "author": {
53
+ "name": "Ahmed Sharkawy",
54
+ "email": "a.elsharkawy@tap.company"
55
+ },
56
+ "files": [
57
+ "build",
58
+ "readme.md"
59
+ ],
60
+ "scripts": {
61
+ "ts:build": "rm -rf build && tsc -p tsconfig.npm.json && tsc-alias -p tsconfig.npm.json",
62
+ "push": "npm version patch --no-git-tag-version && npm run ts:build && npm publish --access public",
63
+ "dev": "vite",
64
+ "build": "tsc -b && vite build ",
65
+ "prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\"",
66
+ "prettier:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md,css,json}\"",
67
+ "lint": "eslint . --color",
68
+ "lint:fix": "eslint src --fix --color",
69
+ "preview": "vite preview",
70
+ "prepare": "husky"
71
+ },
72
+ "dependencies": {
73
+ "@emotion/react": "^11.11.0",
74
+ "@emotion/styled": "^11.11.0",
75
+ "@hookform/resolvers": "^3.3.1",
76
+ "@mui/material": "^5.12.3",
77
+ "@uiw/react-json-view": "^2.0.0-alpha.16",
78
+ "axios": "^1.4.0",
79
+ "dayjs": "^1.11.8",
80
+ "framer-motion": "10.11.0",
81
+ "i18next": "^22.4.15",
82
+ "memoize-one": "^6.0.0",
83
+ "re-resizable": "^6.9.9",
84
+ "react": "^18.2.0",
85
+ "react-currency-input-field": "^3.6.11",
86
+ "react-dom": "^18.2.0",
87
+ "react-draggable": "^4.4.6",
88
+ "react-dropzone": "^14.2.3",
89
+ "react-hook-form": "^7.45.4",
90
+ "react-hot-toast": "^2.4.1",
91
+ "react-i18next": "^12.2.2",
92
+ "react-multi-date-picker": "^4.1.2",
93
+ "react-router-dom": "^6.14.2",
94
+ "react-virtualized-auto-sizer": "^1.0.20",
95
+ "react-window": "^1.8.9",
96
+ "react-window-infinite-loader": "^1.0.9",
97
+ "react18-input-otp": "^1.1.4",
98
+ "recharts": "^2.15.1"
99
+ },
100
+ "devDependencies": {
101
+ "@eslint/js": "^9.17.0",
102
+ "@testing-library/jest-dom": "^5.16.5",
103
+ "@types/lodash": "^4.17.15",
104
+ "@types/react": "^18.2.6",
105
+ "@types/react-dom": "^18.3.5",
106
+ "@types/react-virtualized-auto-sizer": "^1.0.8",
107
+ "@types/react-window": "^1.8.5",
108
+ "@types/react-window-infinite-loader": "^1.0.6",
109
+ "@vitejs/plugin-react": "^4.3.4",
110
+ "eslint": "^9.17.0",
111
+ "eslint-plugin-react-hooks": "^5.0.0",
112
+ "eslint-plugin-react-refresh": "^0.4.16",
113
+ "globals": "^15.14.0",
114
+ "husky": "^8.0.3",
115
+ "lint-staged": "^13.2.2",
116
+ "prettier": "^2.8.8",
117
+ "tsc-alias": "^1.8.16",
118
+ "typescript": "5.0.2",
119
+ "typescript-eslint": "^8.18.2",
120
+ "vite": "6.0.5",
121
+ "vite-tsconfig-paths": "^4.2.0"
122
+ },
123
+ "lint-staged": {
124
+ "src/**/*.{ts,tsx,json,js,jsx}": [
125
+ "yarn run prettier:fix",
126
+ "yarn run lint"
127
+ ]
128
+ }
129
+ }
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- declare const PinExample: React.FC;
3
- export default PinExample;
@@ -1,87 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
- import { useState } from 'react';
12
- import { Box, Typography } from '@mui/material';
13
- import VirtualTable from './VirtualTable';
14
- const testData = Array.from({ length: 50 }, (_, index) => ({
15
- id: index + 1,
16
- name: `User ${index + 1}`,
17
- email: `user${index + 1}@example.com`,
18
- department: ['Engineering', 'Marketing', 'Sales', 'HR'][index % 4],
19
- salary: 50000 + index * 1000,
20
- status: ['Active', 'Inactive'][index % 2],
21
- location: ['New York', 'London', 'Tokyo', 'Sydney'][index % 4],
22
- }));
23
- const testColumns = [
24
- {
25
- id: 'id',
26
- header: 'ID',
27
- width: 80,
28
- pinnable: true,
29
- align: 'center',
30
- },
31
- {
32
- id: 'name',
33
- header: 'Name',
34
- width: 150,
35
- pinnable: true,
36
- },
37
- {
38
- id: 'email',
39
- header: 'Email',
40
- width: 200,
41
- pinnable: true,
42
- },
43
- {
44
- id: 'department',
45
- header: 'Department',
46
- width: 120,
47
- pinnable: true,
48
- },
49
- {
50
- id: 'salary',
51
- header: 'Salary',
52
- width: 100,
53
- pinnable: true,
54
- align: 'right',
55
- format: ({ value }) => `$${value === null || value === void 0 ? void 0 : value.toLocaleString()}`,
56
- },
57
- {
58
- id: 'status',
59
- header: 'Status',
60
- width: 100,
61
- pinnable: true,
62
- },
63
- {
64
- id: 'location',
65
- header: 'Location',
66
- width: 120,
67
- pinnable: true,
68
- },
69
- ];
70
- const PinExample = () => {
71
- const [pinnedColumns, setPinnedColumns] = useState(new Set(['id']));
72
- const handleColumnPin = (columnId, isPinned) => {
73
- console.log('%cPinExample.handleColumnPin TRIGGERED!', 'color: green; font-weight: bold;', { columnId, isPinned });
74
- setPinnedColumns((prev) => {
75
- const newSet = new Set(prev);
76
- if (isPinned) {
77
- newSet.add(columnId);
78
- }
79
- else {
80
- newSet.delete(columnId);
81
- }
82
- return newSet;
83
- });
84
- };
85
- return (_jsxs(Box, Object.assign({ sx: { padding: 2, border: '3px solid red', margin: 2, backgroundColor: '#fff5f5' } }, { children: [_jsx(Typography, Object.assign({ variant: "h5", gutterBottom: true, sx: { color: 'red', fontWeight: 'bold' } }, { children: "PINNING TEST COMPONENT" })), _jsx(Typography, Object.assign({ variant: "body1", sx: { mb: 2 } }, { children: "If you see this component, the `onColumnPin` callback should be working. Check the console for logs." })), _jsxs(Typography, Object.assign({ variant: "body2", color: "text.secondary", sx: { mb: 2 } }, { children: ["Currently Pinned: ", _jsx("strong", { children: Array.from(pinnedColumns).join(', ') || 'None' })] })), _jsx(Box, Object.assign({ sx: { height: 600, width: '100%' } }, { children: _jsx(VirtualTable, { columns: testColumns, rows: testData, pinnedColumns: pinnedColumns, onColumnPin: handleColumnPin, showHeader: true, error: null, triggerDataRefetch: () => __awaiter(void 0, void 0, void 0, function* () { }), showBackgroundColor: false }) }))] })));
86
- };
87
- export default PinExample;