@tap-payments/os-micro-frontend-shared 0.0.77 → 0.0.79
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/SearchButton/styles.d.ts +1 -1
- package/build/components/TableCells/CustomCells/ActionCell/style.d.ts +1 -1
- package/build/components/TableCells/CustomCells/ApplicationStatusCell/ApplicationStatusCell.d.ts +1 -1
- package/build/components/TableCells/CustomCells/ApplicationStatusCell/ApplicationStatusCell.js +2 -2
- package/build/components/TableCells/CustomCells/ApplicationStatusCell/type.d.ts +2 -0
- package/build/components/TableCells/CustomCells/SourceMergedCell/style.d.ts +1 -1
- package/build/components/TableCells/CustomCells/StatusCell/style.d.ts +1 -1
- package/build/components/VirtualTable/SheetView/SheetViewTableHeader.d.ts +17 -0
- package/build/components/VirtualTable/SheetView/SheetViewTableHeader.js +69 -0
- package/build/components/VirtualTable/SheetView/SheetViewVirtualTable.d.ts +10 -0
- package/build/components/VirtualTable/SheetView/SheetViewVirtualTable.js +121 -0
- package/build/components/VirtualTable/SheetView/hooks/usePinnedColumns.d.ts +11 -0
- package/build/components/VirtualTable/SheetView/hooks/usePinnedColumns.js +62 -0
- package/build/components/VirtualTable/SheetView/hooks/useSynchronizedScroll.d.ts +8 -0
- package/build/components/VirtualTable/SheetView/hooks/useSynchronizedScroll.js +30 -0
- package/build/components/VirtualTable/SheetView/index.d.ts +3 -0
- package/build/components/VirtualTable/SheetView/index.js +3 -0
- package/build/components/VirtualTable/SheetView/style.d.ts +31 -0
- package/build/components/VirtualTable/SheetView/style.js +86 -0
- package/build/components/VirtualTable/components/virtualScroll/ListItemWrapper.d.ts +1 -1
- package/build/components/VirtualTable/components/virtualScroll/ListItemWrapper.js +6 -2
- package/build/components/VirtualTable/components/virtualScroll/VirtualScrollList.d.ts +5 -5
- package/build/components/VirtualTable/components/virtualScroll/VirtualScrollList.js +9 -7
- package/build/components/VirtualTable/hooks/useScrollBackShadow.d.ts +2 -1
- package/build/components/VirtualTable/hooks/useScrollBackShadow.js +2 -2
- package/build/components/VirtualTable/index.d.ts +1 -0
- package/build/components/VirtualTable/index.js +1 -0
- package/build/components/VirtualTable/style.d.ts +3 -2
- package/build/components/VirtualTable/style.js +3 -0
- package/build/components/index.d.ts +1 -0
- package/build/components/index.js +1 -0
- package/build/constants/apps.d.ts +17 -0
- package/build/constants/apps.js +4 -0
- package/build/constants/assets.d.ts +2 -0
- package/build/constants/assets.js +2 -0
- package/build/constants/table.d.ts +1 -1
- package/build/constants/table.js +1 -1
- package/build/types/table.d.ts +3 -0
- package/package.json +129 -129
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
|
+
```
|
|
@@ -554,9 +554,9 @@ export declare const Icon: import("@emotion/styled").StyledComponent<{
|
|
|
554
554
|
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLImageElement> | undefined;
|
|
555
555
|
onTransitionEnd?: import("react").TransitionEventHandler<HTMLImageElement> | undefined;
|
|
556
556
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLImageElement> | undefined;
|
|
557
|
-
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
558
557
|
src?: string | undefined;
|
|
559
558
|
alt?: string | undefined;
|
|
559
|
+
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
560
560
|
crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
|
|
561
561
|
useMap?: string | undefined;
|
|
562
562
|
loading?: "eager" | "lazy" | undefined;
|
|
@@ -269,9 +269,9 @@ export declare const ActionIcon: import("@emotion/styled").StyledComponent<{
|
|
|
269
269
|
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLImageElement> | undefined;
|
|
270
270
|
onTransitionEnd?: import("react").TransitionEventHandler<HTMLImageElement> | undefined;
|
|
271
271
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLImageElement> | undefined;
|
|
272
|
-
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
273
272
|
src?: string | undefined;
|
|
274
273
|
alt?: string | undefined;
|
|
274
|
+
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
275
275
|
crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
|
|
276
276
|
useMap?: string | undefined;
|
|
277
277
|
loading?: "eager" | "lazy" | undefined;
|
package/build/components/TableCells/CustomCells/ApplicationStatusCell/ApplicationStatusCell.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ApplicationStatusCellProps } from './type';
|
|
2
|
-
export default function ApplicationStatusCell({ acceptance, payout, ...props }: ApplicationStatusCellProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function ApplicationStatusCell({ acceptance, payout, hideAcceptance, hidePayout, ...props }: ApplicationStatusCellProps): import("react/jsx-runtime").JSX.Element;
|
package/build/components/TableCells/CustomCells/ApplicationStatusCell/ApplicationStatusCell.js
CHANGED
|
@@ -15,8 +15,8 @@ import Tooltip from '../../../Tooltip';
|
|
|
15
15
|
import TableCell from '../../TableCell';
|
|
16
16
|
import { AppsWrapper, IconWrapper } from './style';
|
|
17
17
|
export default function ApplicationStatusCell(_a) {
|
|
18
|
-
var { acceptance, payout } = _a, props = __rest(_a, ["acceptance", "payout"]);
|
|
18
|
+
var { acceptance, payout, hideAcceptance, hidePayout } = _a, props = __rest(_a, ["acceptance", "payout", "hideAcceptance", "hidePayout"]);
|
|
19
19
|
const isAcceptanceEnabled = (acceptance === null || acceptance === void 0 ? void 0 : acceptance.toLowerCase()) === 'enabled';
|
|
20
20
|
const isPayoutEnabled = (payout === null || payout === void 0 ? void 0 : payout.toLowerCase()) === 'enabled';
|
|
21
|
-
return (_jsx(TableCell, Object.assign({}, props, { children: _jsxs(AppsWrapper, { children: [_jsx(Tooltip, Object.assign({ title: 'Acceptance' }, { children: _jsxs(IconWrapper, { children: [_jsx("img", { src: isAcceptanceEnabled ? acceptanceEnabledIcon : acceptanceDisabledRoundedIcon, alt: acceptance }), ' '] }) }), acceptance), _jsx(Tooltip, Object.assign({ title: 'Payouts' }, { children: _jsx(IconWrapper, { children: _jsx("img", { src: isPayoutEnabled ? payoutEnabledIcon : payoutDisabledRoundedIcon, alt: payout }) }) }), payout)] }) })));
|
|
21
|
+
return (_jsx(TableCell, Object.assign({}, props, { children: _jsxs(AppsWrapper, { children: [!hideAcceptance && (_jsx(Tooltip, Object.assign({ title: 'Acceptance' }, { children: _jsxs(IconWrapper, { children: [_jsx("img", { src: isAcceptanceEnabled ? acceptanceEnabledIcon : acceptanceDisabledRoundedIcon, alt: acceptance }), ' '] }) }), acceptance)), !hidePayout && (_jsx(Tooltip, Object.assign({ title: 'Payouts' }, { children: _jsx(IconWrapper, { children: _jsx("img", { src: isPayoutEnabled ? payoutEnabledIcon : payoutDisabledRoundedIcon, alt: payout }) }) }), payout))] }) })));
|
|
22
22
|
}
|
|
@@ -273,9 +273,9 @@ export declare const MultiRefundIcon: import("@emotion/styled").StyledComponent<
|
|
|
273
273
|
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLImageElement> | undefined;
|
|
274
274
|
onTransitionEnd?: import("react").TransitionEventHandler<HTMLImageElement> | undefined;
|
|
275
275
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLImageElement> | undefined;
|
|
276
|
-
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
277
276
|
src?: string | undefined;
|
|
278
277
|
alt?: string | undefined;
|
|
278
|
+
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
279
279
|
crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
|
|
280
280
|
useMap?: string | undefined;
|
|
281
281
|
loading?: "eager" | "lazy" | undefined;
|
|
@@ -262,9 +262,9 @@ export declare const MultiRefundIcon: import("@emotion/styled").StyledComponent<
|
|
|
262
262
|
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLImageElement> | undefined;
|
|
263
263
|
onTransitionEnd?: import("react").TransitionEventHandler<HTMLImageElement> | undefined;
|
|
264
264
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLImageElement> | undefined;
|
|
265
|
-
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
266
265
|
src?: string | undefined;
|
|
267
266
|
alt?: string | undefined;
|
|
267
|
+
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
268
268
|
crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
|
|
269
269
|
useMap?: string | undefined;
|
|
270
270
|
loading?: "eager" | "lazy" | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type TableHeadProps } from '@mui/material';
|
|
3
|
+
import type { IColumnProps, IVirtualTable } from '../../../types/index.js';
|
|
4
|
+
interface SheetViewTableHeaderProps {
|
|
5
|
+
columns: IColumnProps[];
|
|
6
|
+
headerProps?: TableHeadProps;
|
|
7
|
+
columnsSorting?: IVirtualTable['columnsSorting'];
|
|
8
|
+
onColumnSort?: IVirtualTable['onColumnSort'];
|
|
9
|
+
showBackDrop: boolean;
|
|
10
|
+
pinnedColumns?: string[];
|
|
11
|
+
onColumnPin?: (columnId: string, position: 'start' | 'end' | 'unpin') => void;
|
|
12
|
+
isPinnable?: boolean;
|
|
13
|
+
lastColumnId?: string | null;
|
|
14
|
+
}
|
|
15
|
+
declare function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns, onColumnPin, isPinnable, lastColumnId, }: SheetViewTableHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare const _default: import("react").MemoExoticComponent<typeof SheetViewTableHeader>;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useState } from 'react';
|
|
3
|
+
import { Box, useTheme } from '@mui/material';
|
|
4
|
+
import Dropdown from '../../DropdownMenu';
|
|
5
|
+
import { columnIcon, pinIcon, sortAzIcon, sortZaIcon, unpinIcon } from '../../../constants/index.js';
|
|
6
|
+
import ColumnFilter from '../components/ColumnFilter';
|
|
7
|
+
import { StyledCell } from '../style';
|
|
8
|
+
import { ActionIcon, ColumnIcon, PinIconContainer, StyledHeader, StyledMUITableRow } from './style';
|
|
9
|
+
function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns = [], onColumnPin, isPinnable = false, lastColumnId, }) {
|
|
10
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
11
|
+
const open = Boolean(anchorEl);
|
|
12
|
+
const theme = useTheme();
|
|
13
|
+
const handleClick = (event) => {
|
|
14
|
+
setAnchorEl(event.currentTarget);
|
|
15
|
+
};
|
|
16
|
+
const handleClose = () => {
|
|
17
|
+
setAnchorEl(null);
|
|
18
|
+
};
|
|
19
|
+
const handleSortingOption = (columnId, order) => {
|
|
20
|
+
if (columnId) {
|
|
21
|
+
onColumnSort === null || onColumnSort === void 0 ? void 0 : onColumnSort({
|
|
22
|
+
[columnId]: order,
|
|
23
|
+
});
|
|
24
|
+
handleClose();
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const handlePinClick = (columnId) => {
|
|
28
|
+
const isCurrentlyPinned = pinnedColumns.includes(columnId);
|
|
29
|
+
if (isCurrentlyPinned) {
|
|
30
|
+
onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId, 'unpin');
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
if (columnId === lastColumnId) {
|
|
34
|
+
onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId, 'end');
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId, 'start');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return (_jsxs(StyledHeader, Object.assign({ component: "nav", "data-testid": "SheetViewVirtualTable_TableHeader_StyledHeader", showBackDrop: showBackDrop }, headerProps, { sx: Object.assign({ width: '100%', minWidth: 'auto', overflowX: 'scroll' }, headerProps === null || headerProps === void 0 ? void 0 : headerProps.sx) }, { children: [_jsx(StyledMUITableRow, Object.assign({ component: "section", "data-testid": "SheetViewVirtualTable_TableHeader_StyledMUITableRow" }, { children: columns.map((column, colIndex) => {
|
|
42
|
+
const { header, id, align, headerStyle, sortable, filter, pinnable } = column;
|
|
43
|
+
const isFirst = id === columns[0].id;
|
|
44
|
+
const isLast = id === columns[columns.length - 1].id;
|
|
45
|
+
const isPinned = pinnedColumns.includes(id);
|
|
46
|
+
const isDefaultPinned = !!column.isDefaultPinned;
|
|
47
|
+
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, 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' }, 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: () => handlePinClick(id), title: isPinned ? 'Unpin column' : 'Pin column' }, { children: _jsx("img", { src: isPinned ? unpinIcon : pinIcon, alt: "pin-icon" }) })))] }), `${id}-${colIndex}`));
|
|
48
|
+
}) })), _jsx(Dropdown, { open: open, onClose: handleClose, anchorEl: anchorEl, menuItems: [
|
|
49
|
+
{
|
|
50
|
+
label: 'Sort A-Z',
|
|
51
|
+
name: 'asc',
|
|
52
|
+
icon: _jsx(ActionIcon, { src: sortAzIcon, alt: "sort-icon" }),
|
|
53
|
+
selected: (columnsSorting === null || columnsSorting === void 0 ? void 0 : columnsSorting[(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id) || '']) === 'asc',
|
|
54
|
+
onClick: () => {
|
|
55
|
+
handleSortingOption(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id, 'asc');
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: 'Sort Z-A',
|
|
60
|
+
name: 'desc',
|
|
61
|
+
icon: _jsx(ActionIcon, { src: sortZaIcon, alt: "sort-icon" }),
|
|
62
|
+
selected: (columnsSorting === null || columnsSorting === void 0 ? void 0 : columnsSorting[(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id) || '']) === 'desc',
|
|
63
|
+
onClick: () => {
|
|
64
|
+
handleSortingOption(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id, 'desc');
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
] })] })));
|
|
68
|
+
}
|
|
69
|
+
export default memo(SheetViewTableHeader);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { IVirtualTable } from '../../../types/index.js';
|
|
3
|
+
interface ISheetViewVirtualTable extends Omit<IVirtualTable, 'isSheetView'> {
|
|
4
|
+
onColumnPin?: (columnId: string, isPinned: boolean) => void;
|
|
5
|
+
isPinnable?: boolean;
|
|
6
|
+
clearBackdropVisibilityTimeout?: number;
|
|
7
|
+
}
|
|
8
|
+
declare function SheetViewVirtualTable({ columns, rows, threshold, showHeader, headerProps, rowProps, footerProps, rowHeight, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, showBackgroundColor, areAllRowsLoaded, tableBodyStyles, tableMode, tableTitle, dragControls, onColumnPin, clearBackdropVisibilityTimeout, isPinnable, }: Readonly<ISheetViewVirtualTable>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const _default: import("react").MemoExoticComponent<typeof SheetViewVirtualTable>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,121 @@
|
|
|
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, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
+
import { useMemo, memo, useState, useCallback } from 'react';
|
|
12
|
+
import { useTheme } from '@mui/material/styles';
|
|
13
|
+
import memoize from 'memoize-one';
|
|
14
|
+
import InfiniteLoader from 'react-window-infinite-loader';
|
|
15
|
+
import { TABLE_THRESHOLD, TABLE_LIST_OVER_SCAN, TABLE_ROW_HEIGHT } from '../../../constants/index.js';
|
|
16
|
+
import { useDelayToSetValue } from '../../../hooks/index.js';
|
|
17
|
+
import { isHeightNotFullyFilledByRows, isNotFoundError, isTimeoutError, hasError } from '../../../utils/index.js';
|
|
18
|
+
import TableFooter from '../components/TableFooter/TableFooter';
|
|
19
|
+
import TableLastItem from '../components/TableLastItem';
|
|
20
|
+
import TableNoData from '../components/TableNoData';
|
|
21
|
+
import ListItemWrapper from '../components/virtualScroll/ListItemWrapper';
|
|
22
|
+
import { StyledBox, StyledTableBox, StyledVirtualList, TableContainer, TableWrapper } from '../style';
|
|
23
|
+
import { SheetViewVirtualTableWrapper, PinnedStartColumnWrapper, PinnedEndColumnWrapper, MainTableWrapper, UnpinnedTableHeaderWrapper } from './style';
|
|
24
|
+
import SheetViewTableHeader from './SheetViewTableHeader';
|
|
25
|
+
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
26
|
+
import { usePinnedColumns } from './hooks/usePinnedColumns';
|
|
27
|
+
import { useSynchronizedScroll } from './hooks/useSynchronizedScroll';
|
|
28
|
+
const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToIndex, lastItemIndex, totalCount, isError, areAllRowsLoaded, isPinned) => ({
|
|
29
|
+
columns,
|
|
30
|
+
isLoading,
|
|
31
|
+
rows,
|
|
32
|
+
rowProps,
|
|
33
|
+
scrollToIndex,
|
|
34
|
+
totalCount,
|
|
35
|
+
lastItemIndex,
|
|
36
|
+
isError,
|
|
37
|
+
areAllRowsLoaded,
|
|
38
|
+
limit: totalCount,
|
|
39
|
+
newLoadedRowsEndIndex: lastItemIndex,
|
|
40
|
+
isSheetView: true,
|
|
41
|
+
isPinned,
|
|
42
|
+
}));
|
|
43
|
+
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, tableMode, tableTitle, dragControls, onColumnPin, clearBackdropVisibilityTimeout, isPinnable = false, }) {
|
|
44
|
+
var _a, _b, _c;
|
|
45
|
+
const theme = useTheme();
|
|
46
|
+
const { pinnedStartColumns, pinnedEndColumns, handleColumnPin, pinnedStartColumnsData, pinnedEndColumnsData, unpinnedColumnsData, orderedColumns, lastColumnId, } = usePinnedColumns(columns, isPinnable, onColumnPin);
|
|
47
|
+
const { pinnedStartVirtualListRef, scrollableVirtualListRef, pinnedEndVirtualListRef, handleScroll } = useSynchronizedScroll();
|
|
48
|
+
const onPointerDown = (e) => {
|
|
49
|
+
dragControls === null || dragControls === void 0 ? void 0 : dragControls.start(e);
|
|
50
|
+
};
|
|
51
|
+
const isDelayedFetchingNextPage = useDelayToSetValue({
|
|
52
|
+
value: isFetchingNextPage,
|
|
53
|
+
delay: 1000,
|
|
54
|
+
});
|
|
55
|
+
const [showBackDrop, setShowBackdrop] = useState(false);
|
|
56
|
+
const isError = hasError(error);
|
|
57
|
+
const tableLoading = isLoading !== null && isLoading !== void 0 ? isLoading : true;
|
|
58
|
+
const tableError = !isLoading && rows.length === 0 && isError && !isNotFoundError(error);
|
|
59
|
+
const tableEmpty = !isLoading && rows.length === 0;
|
|
60
|
+
const hasTimeoutError = isTimeoutError(error);
|
|
61
|
+
const lastItemIndex = rows.length - 1;
|
|
62
|
+
const shownColumns = useMemo(() => columns.filter((column) => !column.hidden), [columns]);
|
|
63
|
+
const areTotalRowsNotFillingHeight = isHeightNotFullyFilledByRows(rows.length) && !tableLoading;
|
|
64
|
+
const itemsCount = isDelayedFetchingNextPage || (areAllRowsLoaded && !areTotalRowsNotFillingHeight) ? rows.length + 1 : rows.length;
|
|
65
|
+
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);
|
|
66
|
+
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);
|
|
67
|
+
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);
|
|
68
|
+
const createVirtualTableContainer = useCallback((columnsToRender, containerKey, isPinned = false, fixedWidth) => {
|
|
69
|
+
const tableItemsCount = itemsCount;
|
|
70
|
+
const handleOnLoadMoreItems = () => __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
if (areAllRowsLoaded)
|
|
72
|
+
return;
|
|
73
|
+
yield (loadMoreItems === null || loadMoreItems === void 0 ? void 0 : loadMoreItems());
|
|
74
|
+
});
|
|
75
|
+
const currentItemData = containerKey === 'pinnedStart' ? pinnedStartItemData : containerKey === 'pinnedEnd' ? pinnedEndItemData : unpinnedItemData;
|
|
76
|
+
const listRef = containerKey === 'pinnedStart' ? pinnedStartVirtualListRef : containerKey === 'pinnedEnd' ? pinnedEndVirtualListRef : scrollableVirtualListRef;
|
|
77
|
+
const handleScrollCallback = (scrollProps) => {
|
|
78
|
+
const source = containerKey === 'pinnedStart' ? 'start' : containerKey === 'pinnedEnd' ? 'end' : 'scrollable';
|
|
79
|
+
handleScroll(scrollProps, source);
|
|
80
|
+
};
|
|
81
|
+
return (_jsx(InfiniteLoader, Object.assign({ isItemLoaded: (index) => index !== lastItemIndex, itemCount: tableItemsCount, loadMoreItems: handleOnLoadMoreItems, threshold: threshold }, { children: ({ onItemsRendered }) => (_jsx(AutoSizer, { children: ({ height, width }) => (_jsx(StyledVirtualList, Object.assign({ listRef: listRef, height: height, width: fixedWidth || width, itemCount: tableItemsCount, itemSize: () => rowHeight, itemData: currentItemData, onItemsRendered: onItemsRendered, overscanCount: TABLE_LIST_OVER_SCAN, setBackdropVisibility: setShowBackdrop, scrollToIndex: scrollToIndex, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, useIsScrolling: true, onScroll: handleScrollCallback, clearBackdropVisibilityTimeout: clearBackdropVisibilityTimeout, style: {
|
|
82
|
+
overflowX: isPinned ? 'hidden' : 'auto',
|
|
83
|
+
} }, { children: ListItemWrapper }))) })) })));
|
|
84
|
+
}, [
|
|
85
|
+
itemsCount,
|
|
86
|
+
areAllRowsLoaded,
|
|
87
|
+
loadMoreItems,
|
|
88
|
+
threshold,
|
|
89
|
+
rowHeight,
|
|
90
|
+
pinnedStartItemData,
|
|
91
|
+
pinnedEndItemData,
|
|
92
|
+
unpinnedItemData,
|
|
93
|
+
handleScroll,
|
|
94
|
+
scrollToIndex,
|
|
95
|
+
areTotalRowsNotFillingHeight,
|
|
96
|
+
]);
|
|
97
|
+
const showNoDataView = tableLoading || tableError || tableEmpty || hasTimeoutError;
|
|
98
|
+
const pinnedStartColumnsWidth = useMemo(() => pinnedStartColumnsData.reduce((acc, col) => {
|
|
99
|
+
const width = typeof col.width === 'string' ? parseInt(col.width) : col.width || 100;
|
|
100
|
+
return acc + width;
|
|
101
|
+
}, 0), [pinnedStartColumnsData]);
|
|
102
|
+
const pinnedEndColumnsWidth = useMemo(() => pinnedEndColumnsData.reduce((acc, col) => {
|
|
103
|
+
const width = typeof col.width === 'string' ? parseInt(col.width) : col.width || 100;
|
|
104
|
+
return acc + width;
|
|
105
|
+
}, 0), [pinnedEndColumnsData]);
|
|
106
|
+
const renderPinnedColumn = (position, columnsData, columnsWidth, pinnedColumnsList) => {
|
|
107
|
+
const Wrapper = position === 'start' ? PinnedStartColumnWrapper : PinnedEndColumnWrapper;
|
|
108
|
+
const containerKey = position === 'start' ? 'pinnedStart' : 'pinnedEnd';
|
|
109
|
+
if (columnsData.length === 0)
|
|
110
|
+
return null;
|
|
111
|
+
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: {
|
|
112
|
+
width: '100%',
|
|
113
|
+
minWidth: 'fit-content',
|
|
114
|
+
} }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_PinnedStyledBox", hidePadding: true, className: "list-wrapper" }, { children: createVirtualTableContainer(columnsData, containerKey, true, columnsWidth) })) }))] })) })));
|
|
115
|
+
};
|
|
116
|
+
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 }, { 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: {
|
|
117
|
+
width: '100%',
|
|
118
|
+
minWidth: 'fit-content',
|
|
119
|
+
} }, { 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))] }));
|
|
120
|
+
}
|
|
121
|
+
export default memo(SheetViewVirtualTable);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IColumnProps } from '../../../../types/index.js';
|
|
2
|
+
export declare const usePinnedColumns: (columns: readonly IColumnProps[], isPinnable: boolean, onColumnPin?: ((columnId: string, isPinned: boolean) => void) | undefined) => {
|
|
3
|
+
pinnedStartColumns: string[];
|
|
4
|
+
pinnedEndColumns: string[];
|
|
5
|
+
handleColumnPin: (columnId: string, position?: 'start' | 'end' | 'unpin') => void;
|
|
6
|
+
pinnedStartColumnsData: IColumnProps<any>[];
|
|
7
|
+
pinnedEndColumnsData: IColumnProps<any>[];
|
|
8
|
+
unpinnedColumnsData: IColumnProps<any>[];
|
|
9
|
+
orderedColumns: IColumnProps<any>[];
|
|
10
|
+
lastColumnId: string | null;
|
|
11
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { useState, useCallback, useMemo } from 'react';
|
|
2
|
+
export const usePinnedColumns = (columns, isPinnable, onColumnPin) => {
|
|
3
|
+
const [pinnedStartColumns, setPinnedStartColumns] = useState(() => {
|
|
4
|
+
const userPinned = isPinnable ? columns.filter((c) => c.pinned === 'start').map((c) => c.id) : [];
|
|
5
|
+
const defaultPinned = columns.filter((c) => c.isDefaultPinned).map((c) => c.id);
|
|
6
|
+
return Array.from(new Set([...defaultPinned, ...userPinned]));
|
|
7
|
+
});
|
|
8
|
+
const [pinnedEndColumns, setPinnedEndColumns] = useState(() => {
|
|
9
|
+
return isPinnable ? columns.filter((c) => c.pinned === 'end').map((c) => c.id) : [];
|
|
10
|
+
});
|
|
11
|
+
const handleColumnPin = useCallback((columnId, position = 'start') => {
|
|
12
|
+
if (!isPinnable)
|
|
13
|
+
return;
|
|
14
|
+
let newPinnedStart = [...pinnedStartColumns];
|
|
15
|
+
let newPinnedEnd = [...pinnedEndColumns];
|
|
16
|
+
if (position === 'unpin') {
|
|
17
|
+
newPinnedStart = newPinnedStart.filter((id) => id !== columnId);
|
|
18
|
+
newPinnedEnd = newPinnedEnd.filter((id) => id !== columnId);
|
|
19
|
+
}
|
|
20
|
+
else if (position === 'start') {
|
|
21
|
+
newPinnedStart = [...newPinnedStart.filter((id) => id !== columnId), columnId];
|
|
22
|
+
newPinnedEnd = newPinnedEnd.filter((id) => id !== columnId);
|
|
23
|
+
}
|
|
24
|
+
else if (position === 'end') {
|
|
25
|
+
newPinnedEnd = [...newPinnedEnd.filter((id) => id !== columnId), columnId];
|
|
26
|
+
newPinnedStart = newPinnedStart.filter((id) => id !== columnId);
|
|
27
|
+
}
|
|
28
|
+
setPinnedStartColumns(newPinnedStart);
|
|
29
|
+
setPinnedEndColumns(newPinnedEnd);
|
|
30
|
+
const isPinned = newPinnedStart.includes(columnId) || newPinnedEnd.includes(columnId);
|
|
31
|
+
onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId, isPinned);
|
|
32
|
+
}, [pinnedStartColumns, pinnedEndColumns, onColumnPin, isPinnable]);
|
|
33
|
+
const shownColumns = useMemo(() => columns.filter((column) => !column.hidden), [columns]);
|
|
34
|
+
const { pinnedStartColumnsData, pinnedEndColumnsData, unpinnedColumnsData } = useMemo(() => {
|
|
35
|
+
const start = shownColumns.filter((column) => pinnedStartColumns.includes(column.id));
|
|
36
|
+
const end = shownColumns.filter((column) => pinnedEndColumns.includes(column.id));
|
|
37
|
+
const unpinned = shownColumns.filter((column) => !pinnedStartColumns.includes(column.id) && !pinnedEndColumns.includes(column.id));
|
|
38
|
+
const sortedStart = start.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); });
|
|
39
|
+
const sortedEnd = end.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); });
|
|
40
|
+
const sortedUnpinned = unpinned.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); });
|
|
41
|
+
return {
|
|
42
|
+
pinnedStartColumnsData: sortedStart,
|
|
43
|
+
pinnedEndColumnsData: sortedEnd,
|
|
44
|
+
unpinnedColumnsData: sortedUnpinned,
|
|
45
|
+
};
|
|
46
|
+
}, [shownColumns, pinnedStartColumns, pinnedEndColumns]);
|
|
47
|
+
const orderedColumns = useMemo(() => [...pinnedStartColumnsData, ...unpinnedColumnsData, ...pinnedEndColumnsData], [pinnedStartColumnsData, unpinnedColumnsData, pinnedEndColumnsData]);
|
|
48
|
+
const lastColumnId = useMemo(() => {
|
|
49
|
+
const lastCol = orderedColumns[orderedColumns.length - 1];
|
|
50
|
+
return lastCol ? lastCol.id : null;
|
|
51
|
+
}, [orderedColumns]);
|
|
52
|
+
return {
|
|
53
|
+
pinnedStartColumns,
|
|
54
|
+
pinnedEndColumns,
|
|
55
|
+
handleColumnPin,
|
|
56
|
+
pinnedStartColumnsData,
|
|
57
|
+
pinnedEndColumnsData,
|
|
58
|
+
unpinnedColumnsData,
|
|
59
|
+
orderedColumns,
|
|
60
|
+
lastColumnId,
|
|
61
|
+
};
|
|
62
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { VariableSizeList, ListOnScrollProps } from 'react-window';
|
|
3
|
+
export declare const useSynchronizedScroll: () => {
|
|
4
|
+
pinnedStartVirtualListRef: import("react").RefObject<VariableSizeList<any>>;
|
|
5
|
+
scrollableVirtualListRef: import("react").RefObject<VariableSizeList<any>>;
|
|
6
|
+
pinnedEndVirtualListRef: import("react").RefObject<VariableSizeList<any>>;
|
|
7
|
+
handleScroll: ({ scrollOffset }: ListOnScrollProps, source: 'start' | 'end' | 'scrollable') => void;
|
|
8
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useRef, useCallback } from 'react';
|
|
2
|
+
export const useSynchronizedScroll = () => {
|
|
3
|
+
const pinnedStartVirtualListRef = useRef(null);
|
|
4
|
+
const scrollableVirtualListRef = useRef(null);
|
|
5
|
+
const pinnedEndVirtualListRef = useRef(null);
|
|
6
|
+
const isScrollingSyncRef = useRef(false);
|
|
7
|
+
const handleScroll = useCallback(({ scrollOffset }, source) => {
|
|
8
|
+
if (isScrollingSyncRef.current)
|
|
9
|
+
return;
|
|
10
|
+
isScrollingSyncRef.current = true;
|
|
11
|
+
if (source !== 'start' && pinnedStartVirtualListRef.current) {
|
|
12
|
+
pinnedStartVirtualListRef.current.scrollTo(scrollOffset);
|
|
13
|
+
}
|
|
14
|
+
if (source !== 'end' && pinnedEndVirtualListRef.current) {
|
|
15
|
+
pinnedEndVirtualListRef.current.scrollTo(scrollOffset);
|
|
16
|
+
}
|
|
17
|
+
if (source !== 'scrollable' && scrollableVirtualListRef.current) {
|
|
18
|
+
scrollableVirtualListRef.current.scrollTo(scrollOffset);
|
|
19
|
+
}
|
|
20
|
+
requestAnimationFrame(() => {
|
|
21
|
+
isScrollingSyncRef.current = false;
|
|
22
|
+
});
|
|
23
|
+
}, []);
|
|
24
|
+
return {
|
|
25
|
+
pinnedStartVirtualListRef,
|
|
26
|
+
scrollableVirtualListRef,
|
|
27
|
+
pinnedEndVirtualListRef,
|
|
28
|
+
handleScroll,
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const ActionIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
3
|
+
export declare const ColumnIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
4
|
+
export declare const PinIconContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
5
|
+
isPinned: boolean;
|
|
6
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
7
|
+
interface StyledHeaderProps {
|
|
8
|
+
showBackDrop: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const StyledHeader: import("@emotion/styled").StyledComponent<import("@mui/material").TableHeadOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & {
|
|
11
|
+
ref?: ((instance: HTMLTableSectionElement | null) => void) | import("react").RefObject<HTMLTableSectionElement> | null | undefined;
|
|
12
|
+
}, "className" | "style" | "classes" | "children" | "sx"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & StyledHeaderProps, {}, {}>;
|
|
13
|
+
interface StyledMUITableRowProps {
|
|
14
|
+
component: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const StyledMUITableRow: import("@emotion/styled").StyledComponent<import("@mui/material").TableRowOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, "ref"> & {
|
|
17
|
+
ref?: ((instance: HTMLTableRowElement | null) => void) | import("react").RefObject<HTMLTableRowElement> | null | undefined;
|
|
18
|
+
}, "className" | "style" | "classes" | "children" | "sx" | "hover" | "selected"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & StyledMUITableRowProps, {}, {}>;
|
|
19
|
+
export declare const SheetViewVirtualTableWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
20
|
+
export declare const PinnedStartColumnWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
21
|
+
width: number;
|
|
22
|
+
} & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, {}, {}>;
|
|
23
|
+
export declare const PinnedEndColumnWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
24
|
+
width: number;
|
|
25
|
+
} & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, {}, {}>;
|
|
26
|
+
export declare const MainTableWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
27
|
+
hasPinnedStart: boolean;
|
|
28
|
+
hasPinnedEnd: boolean;
|
|
29
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
30
|
+
export declare const UnpinnedTableHeaderWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { styled } from '@mui/material/styles';
|
|
2
|
+
import { TableHead } from '@mui/material';
|
|
3
|
+
import MUITableRow from '@mui/material/TableRow';
|
|
4
|
+
export const ActionIcon = styled('img')(() => ({
|
|
5
|
+
width: '13.3px',
|
|
6
|
+
height: '13.3px',
|
|
7
|
+
}));
|
|
8
|
+
export const ColumnIcon = styled('img')(() => ({
|
|
9
|
+
width: '8px',
|
|
10
|
+
height: '6.4px',
|
|
11
|
+
cursor: 'pointer',
|
|
12
|
+
}));
|
|
13
|
+
export const PinIconContainer = styled('div')(({ theme, isPinned }) => ({
|
|
14
|
+
width: '16px',
|
|
15
|
+
height: 'auto',
|
|
16
|
+
cursor: 'pointer',
|
|
17
|
+
display: 'flex',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
justifyContent: 'center',
|
|
20
|
+
borderRadius: '2px',
|
|
21
|
+
padding: '2px',
|
|
22
|
+
transition: 'all 0.2s ease',
|
|
23
|
+
}));
|
|
24
|
+
export const StyledHeader = styled(TableHead, {
|
|
25
|
+
shouldForwardProp: (prop) => prop !== 'showBackDrop',
|
|
26
|
+
})(({ showBackDrop, theme }) => ({
|
|
27
|
+
width: '100%',
|
|
28
|
+
minWidth: 'fit-content',
|
|
29
|
+
flex: '0 0 auto',
|
|
30
|
+
boxShadow: showBackDrop ? theme.shadows[23] : 'none',
|
|
31
|
+
backgroundColor: theme.palette.background.default,
|
|
32
|
+
zIndex: 1,
|
|
33
|
+
}));
|
|
34
|
+
export const StyledMUITableRow = styled(MUITableRow)(({ theme }) => ({
|
|
35
|
+
display: 'flex',
|
|
36
|
+
justifyContent: 'flex-start',
|
|
37
|
+
width: '100%',
|
|
38
|
+
minWidth: 'fit-content',
|
|
39
|
+
height: '28px',
|
|
40
|
+
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
41
|
+
backgroundColor: theme.palette.primary.light,
|
|
42
|
+
}));
|
|
43
|
+
export const SheetViewVirtualTableWrapper = styled('div')({
|
|
44
|
+
display: 'flex',
|
|
45
|
+
width: '100%',
|
|
46
|
+
height: '100%',
|
|
47
|
+
overflow: 'hidden',
|
|
48
|
+
});
|
|
49
|
+
const PinnedColumnBase = styled('div', {
|
|
50
|
+
shouldForwardProp: (prop) => prop !== 'width',
|
|
51
|
+
})(({ theme, width }) => ({
|
|
52
|
+
width: `${width}px`,
|
|
53
|
+
zIndex: 10,
|
|
54
|
+
flex: '0 0 auto',
|
|
55
|
+
minWidth: 0,
|
|
56
|
+
display: 'flex',
|
|
57
|
+
flexDirection: 'column',
|
|
58
|
+
position: 'relative',
|
|
59
|
+
backgroundColor: theme.palette.primary.light,
|
|
60
|
+
border: '1px solid #F2F2F2',
|
|
61
|
+
}));
|
|
62
|
+
export const PinnedStartColumnWrapper = styled(PinnedColumnBase)({
|
|
63
|
+
marginLeft: '32px',
|
|
64
|
+
boxShadow: '4px 0px 24px 0px #00000014',
|
|
65
|
+
});
|
|
66
|
+
export const PinnedEndColumnWrapper = styled(PinnedColumnBase)({
|
|
67
|
+
marginRight: '32px',
|
|
68
|
+
boxShadow: '-4px 0px 24px 0px #00000014',
|
|
69
|
+
});
|
|
70
|
+
export const MainTableWrapper = styled('div', {
|
|
71
|
+
shouldForwardProp: (prop) => prop !== 'hasPinnedStart' && prop !== 'hasPinnedEnd',
|
|
72
|
+
})(({ hasPinnedStart, hasPinnedEnd }) => ({
|
|
73
|
+
flex: '1 1 auto',
|
|
74
|
+
minWidth: 0,
|
|
75
|
+
display: 'flex',
|
|
76
|
+
flexDirection: 'column',
|
|
77
|
+
border: '1px solid #F2F2F2',
|
|
78
|
+
marginLeft: hasPinnedStart ? '0' : '32px',
|
|
79
|
+
marginRight: hasPinnedEnd ? '0' : '32px',
|
|
80
|
+
position: 'relative',
|
|
81
|
+
}));
|
|
82
|
+
export const UnpinnedTableHeaderWrapper = styled('div')({
|
|
83
|
+
flexShrink: 0,
|
|
84
|
+
borderBottom: '1px solid #E0E0E0',
|
|
85
|
+
height: 'auto',
|
|
86
|
+
});
|
|
@@ -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, isSheetView, ...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, isSheetView, isPinned, ...restData }, }: Readonly<ListChildComponentProps>): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export default ListItemWrapper;
|
|
@@ -44,7 +44,8 @@ export const StyledItemWrapper = styled('div', {
|
|
|
44
44
|
height: '100%',
|
|
45
45
|
}));
|
|
46
46
|
function ListItemWrapper(_a) {
|
|
47
|
-
var
|
|
47
|
+
var _b;
|
|
48
|
+
var { index, style } = _a, _c = _a.data, { renderedScrollTopRef, rows, rowProps, columns, isLoading, scrollToIndex, limit, totalCount, newLoadedRowsEndIndex, isError, areAllRowsLoaded, isSheetView, isPinned = false } = _c, restData = __rest(_c, ["renderedScrollTopRef", "rows", "rowProps", "columns", "isLoading", "scrollToIndex", "limit", "totalCount", "newLoadedRowsEndIndex", "isError", "areAllRowsLoaded", "isSheetView", "isPinned"]);
|
|
48
49
|
const lastItemIndex = rows.length - 1;
|
|
49
50
|
const row = rows[index];
|
|
50
51
|
const isLoadingRow = isLoading && index === lastItemIndex + 1;
|
|
@@ -54,6 +55,9 @@ function ListItemWrapper(_a) {
|
|
|
54
55
|
const memoizedListItemComponent = React.useMemo(() => {
|
|
55
56
|
const lastRowContent = _jsx(LastRowContent, { isLoadingRow: isLoadingRow });
|
|
56
57
|
const isLastRow = isLoadingRow || (areAllRowsLoaded && index === lastItemIndex + 1);
|
|
58
|
+
if (isPinned && isLastRow) {
|
|
59
|
+
return _jsx(Box, { sx: { height: isSheetView ? SHEET_VIEW_TABLE_ROW_HEIGHT : TABLE_ROW_HEIGHT, backgroundColor: '#F6F8FACC' } });
|
|
60
|
+
}
|
|
57
61
|
if (isLastRow) {
|
|
58
62
|
return (_jsx(Box, Object.assign({ sx: {
|
|
59
63
|
height: isSheetView ? SHEET_VIEW_TABLE_ROW_HEIGHT : TABLE_ROW_HEIGHT,
|
|
@@ -71,6 +75,6 @@ function ListItemWrapper(_a) {
|
|
|
71
75
|
}
|
|
72
76
|
return _jsx(TableRow, { index: index, row: row, columns: columns, rowProps: memoizedRowProps, isSheetView: isSheetView }, `row-${index}`);
|
|
73
77
|
}, [restData, index, row, columns, memoizedRowProps, isSheetView]);
|
|
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 })) })));
|
|
78
|
+
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 })) })));
|
|
75
79
|
}
|
|
76
80
|
export default ListItemWrapper;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { VariableSizeList, VariableSizeListProps } from 'react-window';
|
|
3
|
-
|
|
3
|
+
declare const VirtualScrollList: React.ForwardRefExoticComponent<VariableSizeListProps<any> & {
|
|
4
4
|
setBackdropVisibility: (isVisible: boolean) => void;
|
|
5
|
-
scrollToIndex?: number;
|
|
6
|
-
listRef?: React.RefObject<VariableSizeList
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
scrollToIndex?: number | undefined;
|
|
6
|
+
listRef?: React.RefObject<VariableSizeList<any>> | undefined;
|
|
7
|
+
clearBackdropVisibilityTimeout?: number | undefined;
|
|
8
|
+
} & React.RefAttributes<VariableSizeList<any>>>;
|
|
9
9
|
export default VirtualScrollList;
|
|
@@ -16,16 +16,17 @@ import VirtualScrollInner from './VirtualScrollInner';
|
|
|
16
16
|
import VirtualScrollOuter from './VirtualScrollOuter';
|
|
17
17
|
import useScrollBackShadow from '../../hooks/useScrollBackShadow';
|
|
18
18
|
import { VirtualScrollOuterProvider } from '../../context';
|
|
19
|
-
|
|
20
|
-
var { itemData, children, setBackdropVisibility, scrollToIndex, listRef: externalListRef } = _a, restProps = __rest(_a, ["itemData", "children", "setBackdropVisibility", "scrollToIndex", "listRef"]);
|
|
19
|
+
const VirtualScrollList = React.forwardRef((_a, ref) => {
|
|
20
|
+
var { itemData, children, setBackdropVisibility, scrollToIndex, listRef: externalListRef, onScroll, clearBackdropVisibilityTimeout } = _a, restProps = __rest(_a, ["itemData", "children", "setBackdropVisibility", "scrollToIndex", "listRef", "onScroll", "clearBackdropVisibilityTimeout"]);
|
|
21
21
|
const { handleBackDropVisibility, clearBackdropVisibility, clearTimer } = useScrollBackShadow({
|
|
22
22
|
setBackdropVisibility,
|
|
23
|
+
clearBackdropVisibilityTimeout,
|
|
23
24
|
});
|
|
24
25
|
const renderedScrollTopRef = useRef(0);
|
|
25
26
|
const scrollTopRef = useRef(undefined);
|
|
26
27
|
const scrollLocked = useRef(false);
|
|
27
28
|
const internalListRef = useRef(null);
|
|
28
|
-
const listRef = externalListRef || internalListRef;
|
|
29
|
+
const listRef = ref || externalListRef || internalListRef;
|
|
29
30
|
const scrollTo = useCallback(() => {
|
|
30
31
|
var _a, _b;
|
|
31
32
|
clearTimer();
|
|
@@ -54,9 +55,10 @@ function VirtualScrollList(_a) {
|
|
|
54
55
|
}
|
|
55
56
|
}, [scrollToIndex, listRef]);
|
|
56
57
|
const itemDataInternal = React.useMemo(() => (Object.assign(Object.assign({}, itemData), { renderedScrollTopRef })), [itemData]);
|
|
57
|
-
const handleOnScroll = React.useCallback(() => {
|
|
58
|
+
const handleOnScroll = React.useCallback((props) => {
|
|
59
|
+
onScroll === null || onScroll === void 0 ? void 0 : onScroll(props);
|
|
58
60
|
scrollLocked.current = scrollTo();
|
|
59
|
-
}, [scrollTo]);
|
|
60
|
-
return (_jsx(VirtualScrollOuterProvider, Object.assign({ value: handleScroll }, { children: _jsx(VariableSizeList, Object.assign({ ref: listRef, "data-testid": "VirtualScrollList", itemData: itemDataInternal, outerElementType: VirtualScrollOuter, innerElementType: VirtualScrollInner, onScroll: handleOnScroll },
|
|
61
|
-
}
|
|
61
|
+
}, [scrollTo, onScroll]);
|
|
62
|
+
return (_jsx(VirtualScrollOuterProvider, Object.assign({ value: handleScroll }, { children: _jsx(VariableSizeList, Object.assign({ ref: listRef, "data-testid": "VirtualScrollList", itemData: itemDataInternal, outerElementType: VirtualScrollOuter, innerElementType: VirtualScrollInner }, restProps, { onScroll: handleOnScroll }, { children: children })) })));
|
|
63
|
+
});
|
|
62
64
|
export default VirtualScrollList;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
interface ScrollShadowProps {
|
|
2
2
|
setBackdropVisibility: (isVisible: boolean) => void;
|
|
3
|
+
clearBackdropVisibilityTimeout?: number;
|
|
3
4
|
}
|
|
4
|
-
declare function useScrollBackShadow({ setBackdropVisibility }: ScrollShadowProps): {
|
|
5
|
+
declare function useScrollBackShadow({ setBackdropVisibility, clearBackdropVisibilityTimeout }: ScrollShadowProps): {
|
|
5
6
|
handleBackDropVisibility: () => void;
|
|
6
7
|
clearBackdropVisibility: () => void;
|
|
7
8
|
clearTimer: () => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useRef, useEffect } from 'react';
|
|
2
|
-
function useScrollBackShadow({ setBackdropVisibility }) {
|
|
2
|
+
function useScrollBackShadow({ setBackdropVisibility, clearBackdropVisibilityTimeout }) {
|
|
3
3
|
const timer = useRef(undefined);
|
|
4
4
|
useEffect(() => {
|
|
5
5
|
return () => {
|
|
@@ -12,7 +12,7 @@ function useScrollBackShadow({ setBackdropVisibility }) {
|
|
|
12
12
|
const clearBackdropVisibility = () => {
|
|
13
13
|
timer.current = setTimeout(() => {
|
|
14
14
|
setBackdropVisibility(false);
|
|
15
|
-
}, 2000);
|
|
15
|
+
}, clearBackdropVisibilityTimeout || 2000);
|
|
16
16
|
};
|
|
17
17
|
const clearTimer = () => {
|
|
18
18
|
clearTimeout(timer.current);
|
|
@@ -27,7 +27,8 @@ export declare const StyledVirtualList: import("@emotion/styled").StyledComponen
|
|
|
27
27
|
setBackdropVisibility: (isVisible: boolean) => void;
|
|
28
28
|
scrollToIndex?: number | undefined;
|
|
29
29
|
listRef?: import("react").RefObject<import("react-window").VariableSizeList<any>> | undefined;
|
|
30
|
-
|
|
30
|
+
clearBackdropVisibilityTimeout?: number | undefined;
|
|
31
|
+
} & import("react").RefAttributes<import("react-window").VariableSizeList<any>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & StyledVirtualListProps, {}, {}>;
|
|
31
32
|
export declare const StyledTableRow: import("@emotion/styled").StyledComponent<import("@mui/material").TableRowOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, "ref"> & {
|
|
32
33
|
ref?: ((instance: HTMLTableRowElement | null) => void) | import("react").RefObject<HTMLTableRowElement> | null | undefined;
|
|
33
34
|
}, "className" | "style" | "classes" | "children" | "sx" | "hover" | "selected"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
@@ -304,9 +305,9 @@ export declare const ActionIcon: import("@emotion/styled").StyledComponent<{
|
|
|
304
305
|
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLImageElement> | undefined;
|
|
305
306
|
onTransitionEnd?: import("react").TransitionEventHandler<HTMLImageElement> | undefined;
|
|
306
307
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLImageElement> | undefined;
|
|
307
|
-
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
308
308
|
src?: string | undefined;
|
|
309
309
|
alt?: string | undefined;
|
|
310
|
+
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
310
311
|
crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
|
|
311
312
|
useMap?: string | undefined;
|
|
312
313
|
loading?: "eager" | "lazy" | undefined;
|
|
@@ -32,6 +32,9 @@ export const StyledCell = styled(TableCell, {
|
|
|
32
32
|
shouldForwardProp: (prop) => !['isLast', 'isFirst', 'isSheetView'].includes(prop),
|
|
33
33
|
})(({ theme, isLast, isFirst, isSheetView }) => (Object.assign({ paddingBlock: '0', paddingInline: '0.3875rem !important', paddingLeft: isFirst ? '0 !important' : '0.3875rem !important', paddingRight: isLast ? '0 !important' : '0.3875rem !important', color: theme.palette.grey[700], fontSize: theme.typography.caption.fontSize, height: '100%', fontWeight: theme.typography.fontWeightRegular, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: 'flex', alignItems: 'center' }, (isSheetView && {
|
|
34
34
|
borderRight: isLast ? 'none' : `1px solid ${theme.palette.divider}`,
|
|
35
|
+
paddingInline: '0.375rem !important',
|
|
36
|
+
paddingLeft: '0.375rem !important',
|
|
37
|
+
paddingRight: '0.375rem !important',
|
|
35
38
|
}))));
|
|
36
39
|
export const StyledVirtualList = styled(VirtualScrollList, {
|
|
37
40
|
shouldForwardProp: (prop) => !['areTotalRowsNotFillingHeight', 'isSheetView'].includes(prop),
|
|
@@ -12,6 +12,7 @@ export { default as Dialog, DialogToolbar } from './Dialog';
|
|
|
12
12
|
export { default as Tooltip } from './Tooltip';
|
|
13
13
|
export * from './RFH';
|
|
14
14
|
export { default as VirtualTable, TableRowLoading, TableHeader, TableLastItem, TableLoading, TableLoadingWithCard, TableNoData, TableNoDataWithCard, LastRowContent, ListItemWrapperWithCard, RowErrorState, StyledItemWrapper, TableRow, TableRowLoadingWithCard, TableRowWithCard, VirtualScrollInner, VirtualScrollList, VirtualScrollOuter, VirtualTableWithCard, Inputs, List, ColumnFilter, StyledCell, } from './VirtualTable';
|
|
15
|
+
export { default as SheetViewVirtualTable } from './VirtualTable/SheetView/SheetViewVirtualTable';
|
|
15
16
|
export { default as Widget, ListItem, WidgetHeader, WidgetList } from './Widget';
|
|
16
17
|
export { default as TapLogo } from './TapLogo';
|
|
17
18
|
export { default as StatusButton, ChevronIcon, type ChevronIconProps, type StatusButtonIcon, type StatusButtonProps } from './StatusButton';
|
|
@@ -12,6 +12,7 @@ export { default as Dialog, DialogToolbar } from './Dialog';
|
|
|
12
12
|
export { default as Tooltip } from './Tooltip';
|
|
13
13
|
export * from './RFH';
|
|
14
14
|
export { default as VirtualTable, TableRowLoading, TableHeader, TableLastItem, TableLoading, TableLoadingWithCard, TableNoData, TableNoDataWithCard, LastRowContent, ListItemWrapperWithCard, RowErrorState, StyledItemWrapper, TableRow, TableRowLoadingWithCard, TableRowWithCard, VirtualScrollInner, VirtualScrollList, VirtualScrollOuter, VirtualTableWithCard, Inputs, List, ColumnFilter, StyledCell, } from './VirtualTable';
|
|
15
|
+
export { default as SheetViewVirtualTable } from './VirtualTable/SheetView/SheetViewVirtualTable';
|
|
15
16
|
export { default as Widget, ListItem, WidgetHeader, WidgetList } from './Widget';
|
|
16
17
|
export { default as TapLogo } from './TapLogo';
|
|
17
18
|
export { default as StatusButton, ChevronIcon } from './StatusButton';
|
|
@@ -98,6 +98,23 @@ export declare const APP_CODES: {
|
|
|
98
98
|
};
|
|
99
99
|
};
|
|
100
100
|
};
|
|
101
|
+
retailer: {
|
|
102
|
+
code: string;
|
|
103
|
+
functions: {
|
|
104
|
+
view: {
|
|
105
|
+
code: string;
|
|
106
|
+
};
|
|
107
|
+
sandbox: {
|
|
108
|
+
code: string;
|
|
109
|
+
};
|
|
110
|
+
jsonApi: {
|
|
111
|
+
code: string;
|
|
112
|
+
};
|
|
113
|
+
reports: {
|
|
114
|
+
code: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
};
|
|
101
118
|
};
|
|
102
119
|
};
|
|
103
120
|
acceptance: {
|
package/build/constants/apps.js
CHANGED
|
@@ -326,6 +326,8 @@ export declare const authenticationBiometricIcon: string;
|
|
|
326
326
|
export declare const authenticationDeviceIcon: string;
|
|
327
327
|
export declare const authenticationIssuerIcon: string;
|
|
328
328
|
export declare const authenticationSchemeIcon: string;
|
|
329
|
+
export declare const pinIcon: string;
|
|
330
|
+
export declare const unpinIcon: string;
|
|
329
331
|
export declare const switcherIcon: string;
|
|
330
332
|
export declare const tokenSavedStatusIcon: string;
|
|
331
333
|
export declare const tokenTransactedStatusIcon: string;
|
|
@@ -327,6 +327,8 @@ export const authenticationBiometricIcon = `${lightUrl}/status/authenticationBio
|
|
|
327
327
|
export const authenticationDeviceIcon = `${lightUrl}/status/authenticationDevice.svg`;
|
|
328
328
|
export const authenticationIssuerIcon = `${lightUrl}/status/authenticationIssuer.svg`;
|
|
329
329
|
export const authenticationSchemeIcon = `${lightUrl}/status/authenticationScheme.svg`;
|
|
330
|
+
export const pinIcon = `${lightUrl}/pin.svg`;
|
|
331
|
+
export const unpinIcon = `${lightUrl}/unpin.svg`;
|
|
330
332
|
export const switcherIcon = `${appBaseUrl}/switcher.svg`;
|
|
331
333
|
export const tokenSavedStatusIcon = `${lightUrl}/status/table/tokensSaved.svg`;
|
|
332
334
|
export const tokenTransactedStatusIcon = `${lightUrl}/status/table/tokensTransacted.svg`;
|
|
@@ -3,4 +3,4 @@ export declare const TABLE_CONTENT_ROW_HEIGHT = 70;
|
|
|
3
3
|
export declare const TABLE_ROW_HEIGHT = 57;
|
|
4
4
|
export declare const TABLE_THRESHOLD = 200;
|
|
5
5
|
export declare const TABLE_LIST_OVER_SCAN = 5;
|
|
6
|
-
export declare const SHEET_VIEW_TABLE_ROW_HEIGHT =
|
|
6
|
+
export declare const SHEET_VIEW_TABLE_ROW_HEIGHT = 28;
|
package/build/constants/table.js
CHANGED
package/build/types/table.d.ts
CHANGED
|
@@ -30,9 +30,12 @@ export interface IColumnProps<R = any> {
|
|
|
30
30
|
sortable?: boolean;
|
|
31
31
|
hidden?: boolean;
|
|
32
32
|
order?: number;
|
|
33
|
+
pinned?: 'start' | 'end';
|
|
34
|
+
pinnable?: boolean;
|
|
33
35
|
cellStyle?: React.CSSProperties;
|
|
34
36
|
headerStyle?: React.CSSProperties;
|
|
35
37
|
filter?: IColumnFilter;
|
|
38
|
+
isDefaultPinned?: boolean;
|
|
36
39
|
}
|
|
37
40
|
export interface TableFooterProps extends BoxProps {
|
|
38
41
|
totalCount?: number;
|
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.
|
|
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.79",
|
|
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
|
+
}
|