@tap-payments/os-micro-frontend-shared 0.0.72 → 0.0.73-pin-icon-v1
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/SourceMergedCell/style.d.ts +1 -1
- package/build/components/TableCells/CustomCells/StatusCell/style.d.ts +1 -1
- package/build/components/VirtualTable/SheetViewVirtualTable/example.d.ts +3 -0
- package/build/components/VirtualTable/SheetViewVirtualTable/example.js +138 -0
- package/build/components/VirtualTable/SheetViewVirtualTable/index.d.ts +2 -0
- package/build/components/VirtualTable/SheetViewVirtualTable/index.js +2 -0
- package/build/components/VirtualTable/SheetViewVirtualTable.d.ts +10 -0
- package/build/components/VirtualTable/SheetViewVirtualTable.js +146 -0
- package/build/components/VirtualTable/VirtualTable.d.ts +1 -1
- package/build/components/VirtualTable/VirtualTable.js +13 -12
- package/build/components/VirtualTable/components/SheetViewTableHeader.d.ts +24 -0
- package/build/components/VirtualTable/components/SheetViewTableHeader.js +106 -0
- package/build/components/VirtualTable/components/TableRow.js +1 -1
- package/build/components/VirtualTable/components/virtualScroll/ListItemWrapper.d.ts +1 -1
- package/build/components/VirtualTable/components/virtualScroll/ListItemWrapper.js +6 -3
- package/build/components/VirtualTable/components/virtualScroll/VirtualScrollList.d.ts +6 -5
- package/build/components/VirtualTable/components/virtualScroll/VirtualScrollList.js +7 -6
- package/build/components/VirtualTable/style.d.ts +3 -2
- package/build/components/VirtualTable/style.js +4 -4
- package/build/components/index.d.ts +1 -0
- package/build/components/index.js +1 -0
- package/build/playground/VTDemo.d.ts +1 -0
- package/build/playground/VTDemo.js +58 -0
- package/build/playground/index.d.ts +1 -0
- package/build/playground/index.js +1 -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;
|
|
@@ -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,138 @@
|
|
|
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, useMemo } from 'react';
|
|
12
|
+
import { Box } from '@mui/material';
|
|
13
|
+
import SheetViewVirtualTable from './index';
|
|
14
|
+
const sampleData = Array.from({ length: 1000 }, (_, index) => ({
|
|
15
|
+
id: `${index + 1}`,
|
|
16
|
+
name: `User ${index + 1}`,
|
|
17
|
+
email: `user${index + 1}@example.com`,
|
|
18
|
+
status: ['active', 'inactive', 'pending'][index % 3],
|
|
19
|
+
amount: Math.floor(Math.random() * 10000) / 100,
|
|
20
|
+
date: new Date(Date.now() - Math.random() * 10000000000).toLocaleDateString(),
|
|
21
|
+
country: ['USA', 'Canada', 'UK', 'Germany', 'France'][index % 5],
|
|
22
|
+
category: ['Premium', 'Basic', 'Enterprise'][index % 3],
|
|
23
|
+
}));
|
|
24
|
+
const SheetViewVirtualTableExample = () => {
|
|
25
|
+
const [pinnedColumns, setPinnedColumns] = useState(['id', 'name']);
|
|
26
|
+
const [columnsSorting, setColumnsSorting] = useState({});
|
|
27
|
+
const columns = useMemo(() => [
|
|
28
|
+
{
|
|
29
|
+
id: 'id',
|
|
30
|
+
header: 'ID',
|
|
31
|
+
width: '80px',
|
|
32
|
+
align: 'left',
|
|
33
|
+
sortable: true,
|
|
34
|
+
order: 1,
|
|
35
|
+
render: ({ value }) => _jsx("strong", { children: value }),
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'name',
|
|
39
|
+
header: 'Name',
|
|
40
|
+
width: '200px',
|
|
41
|
+
align: 'left',
|
|
42
|
+
sortable: true,
|
|
43
|
+
order: 2,
|
|
44
|
+
render: ({ value }) => _jsx("span", Object.assign({ style: { color: '#1976d2' } }, { children: value })),
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: 'email',
|
|
48
|
+
header: 'Email',
|
|
49
|
+
width: '250px',
|
|
50
|
+
align: 'left',
|
|
51
|
+
sortable: true,
|
|
52
|
+
order: 3,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'status',
|
|
56
|
+
header: 'Status',
|
|
57
|
+
width: '120px',
|
|
58
|
+
align: 'center',
|
|
59
|
+
sortable: true,
|
|
60
|
+
order: 4,
|
|
61
|
+
render: ({ value }) => (_jsx(Box, Object.assign({ sx: {
|
|
62
|
+
px: 1,
|
|
63
|
+
py: 0.5,
|
|
64
|
+
borderRadius: 1,
|
|
65
|
+
fontSize: '0.75rem',
|
|
66
|
+
fontWeight: 'medium',
|
|
67
|
+
textTransform: 'uppercase',
|
|
68
|
+
backgroundColor: value === 'active' ? '#e8f5e8' : value === 'pending' ? '#fff3cd' : '#f8d7da',
|
|
69
|
+
color: value === 'active' ? '#2e7d32' : value === 'pending' ? '#856404' : '#721c24',
|
|
70
|
+
} }, { children: value }))),
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: 'amount',
|
|
74
|
+
header: 'Amount',
|
|
75
|
+
width: '120px',
|
|
76
|
+
align: 'right',
|
|
77
|
+
sortable: true,
|
|
78
|
+
order: 5,
|
|
79
|
+
format: ({ value }) => `$${value.toFixed(2)}`,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: 'date',
|
|
83
|
+
header: 'Date',
|
|
84
|
+
width: '150px',
|
|
85
|
+
align: 'left',
|
|
86
|
+
sortable: true,
|
|
87
|
+
order: 6,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: 'country',
|
|
91
|
+
header: 'Country',
|
|
92
|
+
width: '120px',
|
|
93
|
+
align: 'left',
|
|
94
|
+
sortable: true,
|
|
95
|
+
order: 7,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: 'category',
|
|
99
|
+
header: 'Category',
|
|
100
|
+
width: '150px',
|
|
101
|
+
align: 'left',
|
|
102
|
+
sortable: true,
|
|
103
|
+
order: 8,
|
|
104
|
+
render: ({ value }) => (_jsx(Box, Object.assign({ sx: {
|
|
105
|
+
px: 1,
|
|
106
|
+
py: 0.5,
|
|
107
|
+
borderRadius: 1,
|
|
108
|
+
fontSize: '0.75rem',
|
|
109
|
+
backgroundColor: '#f5f5f5',
|
|
110
|
+
color: '#666',
|
|
111
|
+
} }, { children: value }))),
|
|
112
|
+
},
|
|
113
|
+
], []);
|
|
114
|
+
const handleColumnPin = (columnId, isPinned) => {
|
|
115
|
+
console.log(`Column ${columnId} ${isPinned ? 'pinned' : 'unpinned'}`);
|
|
116
|
+
if (isPinned) {
|
|
117
|
+
setPinnedColumns((prev) => [...prev, columnId]);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
setPinnedColumns((prev) => prev.filter((id) => id !== columnId));
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
const handleColumnSort = (sorting) => {
|
|
124
|
+
setColumnsSorting(sorting);
|
|
125
|
+
console.log('Sorting changed:', sorting);
|
|
126
|
+
};
|
|
127
|
+
const handleRowClick = (row, index) => {
|
|
128
|
+
console.log('Row clicked:', { row, index });
|
|
129
|
+
};
|
|
130
|
+
return (_jsxs(Box, Object.assign({ sx: { height: '600px', width: '100%', p: 2 } }, { children: [_jsxs(Box, Object.assign({ sx: { mb: 2 } }, { children: [_jsx("h2", { children: "SheetViewVirtualTable Example" }), _jsx("p", { children: "This table demonstrates the pin functionality. Click the pin icon next to column headers to pin/unpin columns. Pinned columns will appear on the left side with a separator." }), _jsxs("p", { children: [_jsx("strong", { children: "Currently pinned columns:" }), " ", pinnedColumns.join(', ') || 'None'] })] })), _jsx(SheetViewVirtualTable, { columns: columns, rows: sampleData, showHeader: true, pinnable: true, pinnedColumns: pinnedColumns, onColumnPin: handleColumnPin, columnsSorting: columnsSorting, onColumnSort: handleColumnSort, rowProps: {
|
|
131
|
+
onRowClick: handleRowClick,
|
|
132
|
+
}, footerProps: {
|
|
133
|
+
totalCount: sampleData.length,
|
|
134
|
+
}, isLoading: false, error: null, triggerDataRefetch: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
135
|
+
console.log('Data refetch triggered');
|
|
136
|
+
}), showBackgroundColor: true, areAllRowsLoaded: true, tableMode: "sheet", tableTitle: "Example Sheet View Table" })] })));
|
|
137
|
+
};
|
|
138
|
+
export default SheetViewVirtualTableExample;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { IVirtualTable } from '../../types/index.js';
|
|
3
|
+
interface ISheetViewVirtualTable extends Omit<IVirtualTable, 'isSheetView'> {
|
|
4
|
+
pinnable?: boolean;
|
|
5
|
+
onColumnPin?: (columnId: string, isPinned: boolean) => void;
|
|
6
|
+
pinnedColumns?: string[];
|
|
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, pinnable, onColumnPin, pinnedColumns, }: Readonly<ISheetViewVirtualTable>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const _default: import("react").MemoExoticComponent<typeof SheetViewVirtualTable>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,146 @@
|
|
|
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, useRef } from 'react';
|
|
12
|
+
import { useTheme } from '@mui/material/styles';
|
|
13
|
+
import memoize from 'memoize-one';
|
|
14
|
+
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
15
|
+
import InfiniteLoader from 'react-window-infinite-loader';
|
|
16
|
+
import { VariableSizeList } from 'react-window';
|
|
17
|
+
import { TABLE_ROW_HEIGHT, TABLE_THRESHOLD, TABLE_LIST_OVER_SCAN } from '../../constants/index.js';
|
|
18
|
+
import { useDelayToSetValue } from '../../hooks/index.js';
|
|
19
|
+
import { isHeightNotFullyFilledByRows, isNotFoundError, isTimeoutError, hasError } from '../../utils/index.js';
|
|
20
|
+
import TableFooter from './components/TableFooter/TableFooter';
|
|
21
|
+
import TableLastItem from './components/TableLastItem';
|
|
22
|
+
import TableNoData from './components/TableNoData';
|
|
23
|
+
import ListItemWrapper from './components/virtualScroll/ListItemWrapper';
|
|
24
|
+
import { StyledBox, StyledTableBox, TableContainer, TableWrapper } from './style';
|
|
25
|
+
import SheetViewTableHeader from './components/SheetViewTableHeader';
|
|
26
|
+
const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToIndex, lastItemIndex, totalCount, isError, areAllRowsLoaded) => ({
|
|
27
|
+
columns,
|
|
28
|
+
isLoading,
|
|
29
|
+
rows,
|
|
30
|
+
rowProps,
|
|
31
|
+
scrollToIndex,
|
|
32
|
+
totalCount,
|
|
33
|
+
lastItemIndex,
|
|
34
|
+
isError,
|
|
35
|
+
areAllRowsLoaded,
|
|
36
|
+
limit: totalCount,
|
|
37
|
+
newLoadedRowsEndIndex: lastItemIndex,
|
|
38
|
+
isSheetView: true,
|
|
39
|
+
}));
|
|
40
|
+
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, pinnable = true, onColumnPin, pinnedColumns = [], }) {
|
|
41
|
+
const theme = useTheme();
|
|
42
|
+
const [internalPinnedColumns, setInternalPinnedColumns] = useState(pinnedColumns);
|
|
43
|
+
const pinnedVirtualListRef = useRef(null);
|
|
44
|
+
const scrollableVirtualListRef = useRef(null);
|
|
45
|
+
const onPointerDown = (e) => {
|
|
46
|
+
dragControls === null || dragControls === void 0 ? void 0 : dragControls.start(e);
|
|
47
|
+
};
|
|
48
|
+
const isDelayedFetchingNextPage = useDelayToSetValue({
|
|
49
|
+
value: isFetchingNextPage,
|
|
50
|
+
delay: 1000,
|
|
51
|
+
});
|
|
52
|
+
const [showBackDrop, setShowBackdrop] = useState(false);
|
|
53
|
+
const isError = hasError(error);
|
|
54
|
+
const tableLoading = isLoading !== null && isLoading !== void 0 ? isLoading : true;
|
|
55
|
+
const tableError = !isLoading && rows.length === 0 && isError && !isNotFoundError(error);
|
|
56
|
+
const tableEmpty = !isLoading && rows.length === 0;
|
|
57
|
+
const hasTimeoutError = isTimeoutError(error);
|
|
58
|
+
const lastItemIndex = rows.length - 1;
|
|
59
|
+
const shownColumns = useMemo(() => columns.filter((column) => !column.hidden), [columns]);
|
|
60
|
+
const { pinnedColumnsData, unpinnedColumnsData } = useMemo(() => {
|
|
61
|
+
const pinned = shownColumns.filter((column) => internalPinnedColumns.includes(column.id));
|
|
62
|
+
const unpinned = shownColumns.filter((column) => !internalPinnedColumns.includes(column.id));
|
|
63
|
+
const sortedPinned = pinned.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); });
|
|
64
|
+
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); });
|
|
65
|
+
return {
|
|
66
|
+
pinnedColumnsData: sortedPinned,
|
|
67
|
+
unpinnedColumnsData: sortedUnpinned,
|
|
68
|
+
};
|
|
69
|
+
}, [shownColumns, internalPinnedColumns]);
|
|
70
|
+
const orderedColumns = useMemo(() => [...pinnedColumnsData, ...unpinnedColumnsData], [pinnedColumnsData, unpinnedColumnsData]);
|
|
71
|
+
const areTotalRowsNotFillingHeight = isHeightNotFullyFilledByRows(rows.length) && !tableLoading;
|
|
72
|
+
const itemsCount = isDelayedFetchingNextPage || (areAllRowsLoaded && !areTotalRowsNotFillingHeight) ? rows.length + 1 : rows.length;
|
|
73
|
+
const handleColumnPin = useCallback((columnId) => {
|
|
74
|
+
const newPinnedColumns = internalPinnedColumns.includes(columnId)
|
|
75
|
+
? internalPinnedColumns.filter((id) => id !== columnId)
|
|
76
|
+
: [...internalPinnedColumns, columnId];
|
|
77
|
+
setInternalPinnedColumns(newPinnedColumns);
|
|
78
|
+
onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId, !internalPinnedColumns.includes(columnId));
|
|
79
|
+
}, [internalPinnedColumns, onColumnPin]);
|
|
80
|
+
const handleScrollableScroll = useCallback(({ scrollOffset, scrollUpdateWasRequested }) => {
|
|
81
|
+
if (pinnedVirtualListRef.current && !scrollUpdateWasRequested) {
|
|
82
|
+
pinnedVirtualListRef.current.scrollTo(scrollOffset);
|
|
83
|
+
}
|
|
84
|
+
}, [pinnedVirtualListRef]);
|
|
85
|
+
const handlePinnedScroll = useCallback(({ scrollOffset, scrollUpdateWasRequested }) => {
|
|
86
|
+
if (scrollableVirtualListRef.current && !scrollUpdateWasRequested) {
|
|
87
|
+
scrollableVirtualListRef.current.scrollTo(scrollOffset);
|
|
88
|
+
}
|
|
89
|
+
}, [scrollableVirtualListRef]);
|
|
90
|
+
const createVirtualTableContainer = (columnsToRender, containerKey, isPinned = false, fixedWidth) => {
|
|
91
|
+
var _a;
|
|
92
|
+
const itemData = createItemData(columnsToRender, isDelayedFetchingNextPage, rows, rowProps, scrollToIndex, lastItemIndex, (_a = footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount) !== null && _a !== void 0 ? _a : 0, isError, areAllRowsLoaded && !areTotalRowsNotFillingHeight);
|
|
93
|
+
const handleOnLoadMoreItems = () => __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
if (areAllRowsLoaded)
|
|
95
|
+
return;
|
|
96
|
+
yield (loadMoreItems === null || loadMoreItems === void 0 ? void 0 : loadMoreItems());
|
|
97
|
+
});
|
|
98
|
+
return (_jsx(InfiniteLoader, Object.assign({ isItemLoaded: (index) => index < rows.length, itemCount: itemsCount, loadMoreItems: handleOnLoadMoreItems, threshold: threshold }, { children: ({ onItemsRendered, ref: infiniteLoaderRef }) => (_jsx(AutoSizer, { children: ({ height, width }) => (_jsx(VariableSizeList, Object.assign({ ref: (list) => {
|
|
99
|
+
infiniteLoaderRef(list);
|
|
100
|
+
if (isPinned) {
|
|
101
|
+
pinnedVirtualListRef.current = list;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
scrollableVirtualListRef.current = list;
|
|
105
|
+
}
|
|
106
|
+
}, height: height, width: fixedWidth || width, itemCount: itemsCount, itemSize: () => rowHeight, itemData: itemData, onItemsRendered: onItemsRendered, overscanCount: TABLE_LIST_OVER_SCAN, onScroll: isPinned ? handlePinnedScroll : handleScrollableScroll, style: {
|
|
107
|
+
overflowX: isPinned ? 'hidden' : 'auto',
|
|
108
|
+
overflowY: 'auto',
|
|
109
|
+
} }, { children: ListItemWrapper }))) })) })));
|
|
110
|
+
};
|
|
111
|
+
const showNoDataView = tableLoading || tableError || tableEmpty || hasTimeoutError;
|
|
112
|
+
const pinnedColumnsWidth = pinnedColumnsData.reduce((acc, col) => {
|
|
113
|
+
const width = typeof col.width === 'string' ? parseInt(col.width) : col.width || 100;
|
|
114
|
+
return acc + width;
|
|
115
|
+
}, 0);
|
|
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("div", Object.assign({ style: {
|
|
117
|
+
display: 'flex',
|
|
118
|
+
width: '100%',
|
|
119
|
+
height: '100%',
|
|
120
|
+
overflow: 'hidden',
|
|
121
|
+
gap: '0px',
|
|
122
|
+
} }, { children: [pinnable && pinnedColumnsData.length > 0 && (_jsxs("div", Object.assign({ style: {
|
|
123
|
+
width: `${pinnedColumnsWidth}px`,
|
|
124
|
+
flexShrink: 0,
|
|
125
|
+
display: 'flex',
|
|
126
|
+
flexDirection: 'column',
|
|
127
|
+
zIndex: 10,
|
|
128
|
+
} }, { children: [showHeader && (_jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_PinnedTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: pinnedColumnsData, headerProps: headerProps, showBackDrop: showBackDrop, pinnable: pinnable, pinnedColumns: internalPinnedColumns, onColumnPin: handleColumnPin })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
|
129
|
+
width: '100%',
|
|
130
|
+
minWidth: 'fit-content',
|
|
131
|
+
} }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_PinnedStyledBox", hidePadding: true, className: "list-wrapper" }, { children: createVirtualTableContainer(pinnedColumnsData, 'pinned', true, pinnedColumnsWidth) })) }))] }))), _jsx("div", Object.assign({ style: {
|
|
132
|
+
flex: '1 1 auto',
|
|
133
|
+
minWidth: 0,
|
|
134
|
+
display: 'flex',
|
|
135
|
+
flexDirection: 'column',
|
|
136
|
+
position: 'relative',
|
|
137
|
+
} }, { 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({ isSheetView: true, "data-testid": "SheetViewVirtualTable_TableWrapper", showNoDataView: showNoDataView, sx: Object.assign(Object.assign({}, tableBodyStyles), { display: 'flex', flexDirection: 'column', height: '100%' }) }, { children: [showHeader && (_jsx("div", Object.assign({ style: {
|
|
138
|
+
flexShrink: 0,
|
|
139
|
+
borderBottom: '1px solid #E0E0E0',
|
|
140
|
+
height: 'auto',
|
|
141
|
+
} }, { children: _jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_UnpinnedTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: unpinnedColumnsData, headerProps: headerProps, showBackDrop: showBackDrop, pinnable: pinnable, pinnedColumns: internalPinnedColumns, onColumnPin: handleColumnPin }) }))), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
|
142
|
+
width: '100%',
|
|
143
|
+
minWidth: 'fit-content',
|
|
144
|
+
} }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_ScrollableStyledBox", hidePadding: true, className: "list-wrapper" }, { children: createVirtualTableContainer(unpinnedColumnsData, 'scrollable', false) })) }))] })) })) }))] }))), !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))] }));
|
|
145
|
+
}
|
|
146
|
+
export default memo(SheetViewVirtualTable);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { IVirtualTable } from '../../types/index.js';
|
|
3
|
-
declare function VirtualTable({ columns, rows, threshold, showHeader, headerProps, rowProps, footerProps,
|
|
3
|
+
declare function VirtualTable({ columns, rows, threshold, showHeader, headerProps, rowProps, footerProps, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, showBackgroundColor, areAllRowsLoaded, tableBodyStyles, tableMode, tableTitle, dragControls, isSheetView, }: Readonly<IVirtualTable>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare const _default: import("react").MemoExoticComponent<typeof VirtualTable>;
|
|
5
5
|
export default _default;
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
-
import { useMemo, memo, useState } from 'react';
|
|
11
|
+
import { useMemo, memo, useState, useRef, useEffect } from 'react';
|
|
12
12
|
import { useTheme } from '@mui/material/styles';
|
|
13
13
|
import memoize from 'memoize-one';
|
|
14
14
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
@@ -34,7 +34,7 @@ const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToInde
|
|
|
34
34
|
areAllRowsLoaded,
|
|
35
35
|
isSheetView,
|
|
36
36
|
}));
|
|
37
|
-
function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader, headerProps, rowProps, footerProps,
|
|
37
|
+
function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader, headerProps, rowProps, footerProps, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, showBackgroundColor, areAllRowsLoaded = false, tableBodyStyles, tableMode, tableTitle, dragControls, isSheetView = false, }) {
|
|
38
38
|
var _a;
|
|
39
39
|
const theme = useTheme();
|
|
40
40
|
const onPointerDown = (e) => {
|
|
@@ -57,6 +57,13 @@ function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader,
|
|
|
57
57
|
const itemsCount = isDelayedFetchingNextPage || (areAllRowsLoaded && !areTotalRowsNotFillingHeight) ? rows.length + 1 : rows.length;
|
|
58
58
|
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, isSheetView);
|
|
59
59
|
const tableRowHeight = isSheetView ? SHEET_VIEW_TABLE_ROW_HEIGHT : TABLE_ROW_HEIGHT;
|
|
60
|
+
const listRef = useRef(null);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (listRef.current && typeof listRef.current.resetAfterIndex === 'function') {
|
|
63
|
+
listRef.current.resetAfterIndex(0, true);
|
|
64
|
+
}
|
|
65
|
+
}, [isSheetView, tableRowHeight]);
|
|
66
|
+
console.log('itemData', itemData);
|
|
60
67
|
const renderTableContainer = useMemo(() => {
|
|
61
68
|
const setBackdropVisibility = (isVisible) => {
|
|
62
69
|
setShowBackdrop(isVisible);
|
|
@@ -66,24 +73,18 @@ function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader,
|
|
|
66
73
|
return;
|
|
67
74
|
yield (loadMoreItems === null || loadMoreItems === void 0 ? void 0 : loadMoreItems());
|
|
68
75
|
});
|
|
69
|
-
return (_jsx(InfiniteLoader, Object.assign({ "data-testid": "VirtualTable_InfiniteLoader", isItemLoaded: (index) => index !== lastItemIndex, itemCount: itemsCount, loadMoreItems: handleOnLoadMoreItems, threshold: threshold }, { children: ({ onItemsRendered, ref }) => (_jsx(AutoSizer, Object.assign({ ref: ref, "data-testid": "VirtualTable_AutoSizer" }, { children: ({ height, width }) => (_jsx(StyledVirtualList, Object.assign({ "data-testid": "VirtualTable_VirtualList", useIsScrolling: true, className: "list", itemData: itemData, height: height || 0, width: width || 0, itemCount: itemsCount, itemSize: () => tableRowHeight, onItemsRendered: onItemsRendered, setBackdropVisibility: setBackdropVisibility, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, scrollToIndex: scrollToIndex, overscanCount: TABLE_LIST_OVER_SCAN, isSheetView: isSheetView }, { children: ListItemWrapper }))) }))) })));
|
|
76
|
+
return (_jsx(InfiniteLoader, Object.assign({ "data-testid": "VirtualTable_InfiniteLoader", isItemLoaded: (index) => index !== lastItemIndex, itemCount: itemsCount, loadMoreItems: handleOnLoadMoreItems, threshold: threshold }, { children: ({ onItemsRendered, ref }) => (_jsx(AutoSizer, Object.assign({ ref: ref, "data-testid": "VirtualTable_AutoSizer" }, { children: ({ height, width }) => (_jsx(StyledVirtualList, Object.assign({ "data-testid": "VirtualTable_VirtualList", useIsScrolling: true, className: "list", itemData: itemData, height: height || 0, width: width || 0, itemCount: itemsCount, itemSize: () => tableRowHeight, onItemsRendered: onItemsRendered, setBackdropVisibility: setBackdropVisibility, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, scrollToIndex: scrollToIndex, overscanCount: TABLE_LIST_OVER_SCAN, isSheetView: isSheetView, listRef: listRef }, { children: ListItemWrapper }))) }))) })));
|
|
70
77
|
}, [
|
|
71
|
-
orderedColumns,
|
|
72
|
-
error,
|
|
73
|
-
isLoading,
|
|
74
78
|
lastItemIndex,
|
|
75
79
|
loadMoreItems,
|
|
76
|
-
rowHeight,
|
|
77
|
-
rows,
|
|
78
|
-
rowProps,
|
|
79
|
-
tableError,
|
|
80
|
-
tableLoading,
|
|
81
80
|
threshold,
|
|
82
|
-
isDelayedFetchingNextPage,
|
|
83
81
|
areAllRowsLoaded,
|
|
84
82
|
areTotalRowsNotFillingHeight,
|
|
85
83
|
itemsCount,
|
|
86
84
|
tableRowHeight,
|
|
85
|
+
isSheetView,
|
|
86
|
+
itemData,
|
|
87
|
+
scrollToIndex,
|
|
87
88
|
]);
|
|
88
89
|
const showNoDataView = tableLoading || tableError || tableEmpty || hasTimeoutError;
|
|
89
90
|
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, isSheetView: isSheetView })), 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: {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type TableHeadProps } from '@mui/material';
|
|
3
|
+
import type { IColumnProps, IVirtualTable } from '../../../types/index.js';
|
|
4
|
+
export declare const ActionIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
5
|
+
export declare const ColumnIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
6
|
+
interface StyledHeaderProps {
|
|
7
|
+
showBackDrop: boolean;
|
|
8
|
+
}
|
|
9
|
+
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"> & {
|
|
10
|
+
ref?: ((instance: HTMLTableSectionElement | null) => void) | import("react").RefObject<HTMLTableSectionElement> | null | undefined;
|
|
11
|
+
}, "className" | "style" | "classes" | "children" | "sx"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & StyledHeaderProps, {}, {}>;
|
|
12
|
+
interface SheetViewTableHeaderProps {
|
|
13
|
+
columns: IColumnProps[];
|
|
14
|
+
headerProps?: TableHeadProps;
|
|
15
|
+
columnsSorting?: IVirtualTable['columnsSorting'];
|
|
16
|
+
onColumnSort?: IVirtualTable['onColumnSort'];
|
|
17
|
+
showBackDrop: boolean;
|
|
18
|
+
pinnable?: boolean;
|
|
19
|
+
pinnedColumns?: string[];
|
|
20
|
+
onColumnPin?: (columnId: string) => void;
|
|
21
|
+
}
|
|
22
|
+
declare function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnable, pinnedColumns, onColumnPin, }: SheetViewTableHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
declare const _default: import("react").MemoExoticComponent<typeof SheetViewTableHeader>;
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useState } from 'react';
|
|
3
|
+
import { Box, styled, useTheme } from '@mui/material';
|
|
4
|
+
import TableHead from '@mui/material/TableHead';
|
|
5
|
+
import MUITableRow from '@mui/material/TableRow';
|
|
6
|
+
import Dropdown from '../../DropdownMenu';
|
|
7
|
+
import { columnIcon, sortAzIcon, sortZaIcon } from '../../../constants/index.js';
|
|
8
|
+
import ColumnFilter from './ColumnFilter';
|
|
9
|
+
import { StyledCell } from '../style';
|
|
10
|
+
export const ActionIcon = styled('img')(() => ({
|
|
11
|
+
width: '13.3px',
|
|
12
|
+
height: '13.3px',
|
|
13
|
+
}));
|
|
14
|
+
export const ColumnIcon = styled('img')(() => ({
|
|
15
|
+
width: '8px',
|
|
16
|
+
height: '6.4px',
|
|
17
|
+
cursor: 'pointer',
|
|
18
|
+
}));
|
|
19
|
+
const PinIcon = styled('div')(({ theme, isPinned }) => ({
|
|
20
|
+
width: '16px',
|
|
21
|
+
height: '16px',
|
|
22
|
+
cursor: 'pointer',
|
|
23
|
+
display: 'flex',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
justifyContent: 'center',
|
|
26
|
+
borderRadius: '2px',
|
|
27
|
+
padding: '2px',
|
|
28
|
+
transition: 'all 0.2s ease',
|
|
29
|
+
backgroundColor: isPinned ? theme.palette.primary.main : 'transparent',
|
|
30
|
+
'&:hover': {
|
|
31
|
+
backgroundColor: isPinned ? theme.palette.primary.dark : theme.palette.action.hover,
|
|
32
|
+
},
|
|
33
|
+
'& svg': {
|
|
34
|
+
fill: isPinned ? theme.palette.primary.contrastText : theme.palette.text.secondary,
|
|
35
|
+
transition: 'fill 0.2s ease',
|
|
36
|
+
},
|
|
37
|
+
}));
|
|
38
|
+
export const StyledHeader = styled(TableHead, {
|
|
39
|
+
shouldForwardProp: (prop) => prop !== 'showBackDrop',
|
|
40
|
+
})(({ showBackDrop, theme }) => ({
|
|
41
|
+
width: '100%',
|
|
42
|
+
minWidth: 'fit-content',
|
|
43
|
+
flex: '0 0 auto',
|
|
44
|
+
boxShadow: showBackDrop ? theme.shadows[23] : 'none',
|
|
45
|
+
backgroundColor: theme.palette.background.default,
|
|
46
|
+
zIndex: 1,
|
|
47
|
+
}));
|
|
48
|
+
const StyledMUITableRow = styled(MUITableRow)({
|
|
49
|
+
display: 'flex',
|
|
50
|
+
justifyContent: 'flex-start',
|
|
51
|
+
paddingInline: '32px',
|
|
52
|
+
paddingBlock: '16px',
|
|
53
|
+
width: '100%',
|
|
54
|
+
minWidth: 'fit-content',
|
|
55
|
+
});
|
|
56
|
+
function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnable = true, pinnedColumns = [], onColumnPin, }) {
|
|
57
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
58
|
+
const open = Boolean(anchorEl);
|
|
59
|
+
const theme = useTheme();
|
|
60
|
+
const handleClick = (event) => {
|
|
61
|
+
setAnchorEl(event.currentTarget);
|
|
62
|
+
};
|
|
63
|
+
const handleClose = () => {
|
|
64
|
+
setAnchorEl(null);
|
|
65
|
+
};
|
|
66
|
+
const handleSortingOption = (columnId, order) => {
|
|
67
|
+
if (columnId) {
|
|
68
|
+
onColumnSort === null || onColumnSort === void 0 ? void 0 : onColumnSort({
|
|
69
|
+
[columnId]: order,
|
|
70
|
+
});
|
|
71
|
+
handleClose();
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const handlePinClick = (columnId, event) => {
|
|
75
|
+
event.stopPropagation();
|
|
76
|
+
onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId);
|
|
77
|
+
};
|
|
78
|
+
const PinSVG = ({ isPinned }) => (_jsx("svg", Object.assign({ width: "12", height: "12", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, { children: _jsx("path", { d: "M16,12V4H17V2H7V4H8V12L6,14V16H11.2V22H12.8V16H18V14L16,12Z", fill: "currentColor" }) })));
|
|
79
|
+
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) => {
|
|
80
|
+
const { header, id, align, headerStyle, sortable, filter } = column;
|
|
81
|
+
const isFirst = id === columns[0].id;
|
|
82
|
+
const isLast = id === columns[columns.length - 1].id;
|
|
83
|
+
const isPinned = pinnedColumns.includes(id);
|
|
84
|
+
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, 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: [pinnable && (_jsx(PinIcon, Object.assign({ isPinned: isPinned, onClick: (event) => handlePinClick(id, event), title: isPinned ? 'Unpin column' : 'Pin column' }, { children: _jsx(PinSVG, { isPinned: isPinned }) }))), 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 })] }), `${id}-${colIndex}`));
|
|
85
|
+
}) })), _jsx(Dropdown, { open: open, onClose: handleClose, anchorEl: anchorEl, menuItems: [
|
|
86
|
+
{
|
|
87
|
+
label: 'Sort A-Z',
|
|
88
|
+
name: 'asc',
|
|
89
|
+
icon: _jsx(ActionIcon, { src: sortAzIcon, alt: "sort-icon" }),
|
|
90
|
+
selected: (columnsSorting === null || columnsSorting === void 0 ? void 0 : columnsSorting[(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id) || '']) === 'asc',
|
|
91
|
+
onClick: () => {
|
|
92
|
+
handleSortingOption(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id, 'asc');
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
label: 'Sort Z-A',
|
|
97
|
+
name: 'desc',
|
|
98
|
+
icon: _jsx(ActionIcon, { src: sortZaIcon, alt: "sort-icon" }),
|
|
99
|
+
selected: (columnsSorting === null || columnsSorting === void 0 ? void 0 : columnsSorting[(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id) || '']) === 'desc',
|
|
100
|
+
onClick: () => {
|
|
101
|
+
handleSortingOption(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.dataset.id, 'desc');
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
] })] })));
|
|
105
|
+
}
|
|
106
|
+
export default memo(SheetViewTableHeader);
|
|
@@ -10,7 +10,7 @@ function TableRow({ row, columns, index, rowProps, isSheetView }) {
|
|
|
10
10
|
return null;
|
|
11
11
|
const value = selector ? selector({ row, index, value: row[column === null || column === void 0 ? void 0 : column.id] }) : row[column === null || column === void 0 ? void 0 : column.id];
|
|
12
12
|
const formattedValue = format ? format({ value, row, index }) : value;
|
|
13
|
-
return render ? render({ row, column, index, value:
|
|
13
|
+
return render ? render({ row, column, index, value: formattedValue }) : _jsx(_Fragment, { children: formattedValue });
|
|
14
14
|
};
|
|
15
15
|
const content = useMemo(() => (_jsx(_Fragment, { children: columns.map((column, colIndex) => {
|
|
16
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), isSheetView: isSheetView }, { children: renderCell(column) }), `${column.id}-${colIndex}`));
|
|
@@ -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
|
|
9
|
+
declare function ListItemWrapper({ index, style, data }: Readonly<ListChildComponentProps>): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export default ListItemWrapper;
|
|
@@ -43,8 +43,11 @@ export const StyledItemWrapper = styled('div', {
|
|
|
43
43
|
backgroundColor: theme.palette.background.default,
|
|
44
44
|
height: '100%',
|
|
45
45
|
}));
|
|
46
|
-
function ListItemWrapper(
|
|
47
|
-
var
|
|
46
|
+
function ListItemWrapper({ index, style, data }) {
|
|
47
|
+
var _a;
|
|
48
|
+
console.log('ListItemWrapper, virtual table', { index, style, data });
|
|
49
|
+
const { renderedScrollTopRef, rows, rowProps, columns, isLoading, scrollToIndex, limit, totalCount, newLoadedRowsEndIndex, isError, areAllRowsLoaded, isSheetView } = data, restData = __rest(data, ["renderedScrollTopRef", "rows", "rowProps", "columns", "isLoading", "scrollToIndex", "limit", "totalCount", "newLoadedRowsEndIndex", "isError", "areAllRowsLoaded", "isSheetView"]);
|
|
50
|
+
console.log('ListItemWrapper', { index, style, data: restData });
|
|
48
51
|
const lastItemIndex = rows.length - 1;
|
|
49
52
|
const row = rows[index];
|
|
50
53
|
const isLoadingRow = isLoading && index === lastItemIndex + 1;
|
|
@@ -71,6 +74,6 @@ function ListItemWrapper(_a) {
|
|
|
71
74
|
}
|
|
72
75
|
return _jsx(TableRow, { index: index, row: row, columns: columns, rowProps: memoizedRowProps, isSheetView: isSheetView }, `row-${index}`);
|
|
73
76
|
}, [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 })) })));
|
|
77
|
+
return (_jsx("div", Object.assign({ "data-testid": "ListItemWrapper", style: Object.assign(Object.assign({}, style), { top: Number(style.top) - ((_a = renderedScrollTopRef === null || renderedScrollTopRef === void 0 ? void 0 : renderedScrollTopRef.current) !== null && _a !== void 0 ? _a : 0), willChange: 'top' }) }, { children: _jsx(StyledItemWrapper, Object.assign({ "data-testid": "ListItemWrapper_StyledItemWrapper" }, { children: memoizedListItemComponent })) })));
|
|
75
78
|
}
|
|
76
79
|
export default ListItemWrapper;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { VariableSizeList, VariableSizeListProps } from 'react-window';
|
|
3
|
+
declare const VirtualScrollList: React.ForwardRefExoticComponent<VariableSizeListProps<any> & {
|
|
3
4
|
setBackdropVisibility: (isVisible: boolean) => void;
|
|
4
|
-
scrollToIndex?: number;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
scrollToIndex?: number | undefined;
|
|
6
|
+
listRef?: React.RefObject<VariableSizeList<any>> | undefined;
|
|
7
|
+
} & React.RefAttributes<VariableSizeList<any>>>;
|
|
7
8
|
export default VirtualScrollList;
|
|
@@ -16,15 +16,16 @@ 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 } = _a, restProps = __rest(_a, ["itemData", "children", "setBackdropVisibility", "scrollToIndex"]);
|
|
19
|
+
const VirtualScrollList = React.forwardRef((_a, ref) => {
|
|
20
|
+
var { itemData, children, setBackdropVisibility, scrollToIndex, listRef: externalListRef } = _a, restProps = __rest(_a, ["itemData", "children", "setBackdropVisibility", "scrollToIndex", "listRef"]);
|
|
21
21
|
const { handleBackDropVisibility, clearBackdropVisibility, clearTimer } = useScrollBackShadow({
|
|
22
22
|
setBackdropVisibility,
|
|
23
23
|
});
|
|
24
24
|
const renderedScrollTopRef = useRef(0);
|
|
25
25
|
const scrollTopRef = useRef(undefined);
|
|
26
26
|
const scrollLocked = useRef(false);
|
|
27
|
-
const
|
|
27
|
+
const internalListRef = useRef(null);
|
|
28
|
+
const listRef = ref || externalListRef || internalListRef;
|
|
28
29
|
const scrollTo = useCallback(() => {
|
|
29
30
|
var _a, _b;
|
|
30
31
|
clearTimer();
|
|
@@ -38,7 +39,7 @@ function VirtualScrollList(_a) {
|
|
|
38
39
|
}
|
|
39
40
|
clearBackdropVisibility();
|
|
40
41
|
return false;
|
|
41
|
-
}, []);
|
|
42
|
+
}, [clearBackdropVisibility, clearTimer, handleBackDropVisibility, listRef]);
|
|
42
43
|
const handleScroll = React.useCallback((event) => {
|
|
43
44
|
scrollTopRef.current = event.currentTarget.scrollTop;
|
|
44
45
|
if (!scrollLocked.current) {
|
|
@@ -51,11 +52,11 @@ function VirtualScrollList(_a) {
|
|
|
51
52
|
if ((scrollToIndex || 0) >= 0 && !Number.isNaN(scrollToIndex) && scrollToIndex !== undefined && ((_a = listRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo)) {
|
|
52
53
|
(_b = listRef.current) === null || _b === void 0 ? void 0 : _b.scrollToItem(scrollToIndex, 'center');
|
|
53
54
|
}
|
|
54
|
-
}, [scrollToIndex]);
|
|
55
|
+
}, [scrollToIndex, listRef]);
|
|
55
56
|
const itemDataInternal = React.useMemo(() => (Object.assign(Object.assign({}, itemData), { renderedScrollTopRef })), [itemData]);
|
|
56
57
|
const handleOnScroll = React.useCallback(() => {
|
|
57
58
|
scrollLocked.current = scrollTo();
|
|
58
59
|
}, [scrollTo]);
|
|
59
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 }, restProps, { children: children })) })));
|
|
60
|
-
}
|
|
61
|
+
});
|
|
61
62
|
export default VirtualScrollList;
|
|
@@ -26,7 +26,8 @@ interface StyledVirtualListProps {
|
|
|
26
26
|
export declare const StyledVirtualList: import("@emotion/styled").StyledComponent<import("react-window").VariableSizeListProps<any> & {
|
|
27
27
|
setBackdropVisibility: (isVisible: boolean) => void;
|
|
28
28
|
scrollToIndex?: number | undefined;
|
|
29
|
-
|
|
29
|
+
listRef?: import("react").RefObject<import("react-window").VariableSizeList<any>> | undefined;
|
|
30
|
+
} & import("react").RefAttributes<import("react-window").VariableSizeList<any>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & StyledVirtualListProps, {}, {}>;
|
|
30
31
|
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"> & {
|
|
31
32
|
ref?: ((instance: HTMLTableRowElement | null) => void) | import("react").RefObject<HTMLTableRowElement> | null | undefined;
|
|
32
33
|
}, "className" | "style" | "classes" | "children" | "sx" | "hover" | "selected"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
@@ -303,9 +304,9 @@ export declare const ActionIcon: import("@emotion/styled").StyledComponent<{
|
|
|
303
304
|
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLImageElement> | undefined;
|
|
304
305
|
onTransitionEnd?: import("react").TransitionEventHandler<HTMLImageElement> | undefined;
|
|
305
306
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLImageElement> | undefined;
|
|
306
|
-
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
307
307
|
src?: string | undefined;
|
|
308
308
|
alt?: string | undefined;
|
|
309
|
+
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
|
309
310
|
crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
|
|
310
311
|
useMap?: string | undefined;
|
|
311
312
|
loading?: "eager" | "lazy" | undefined;
|
|
@@ -13,8 +13,8 @@ export const TableWrapper = styled(Box, {
|
|
|
13
13
|
height: '100%',
|
|
14
14
|
width: '100%',
|
|
15
15
|
minWidth: showNoDataView ? 'unset' : 'fit-content',
|
|
16
|
-
overflow: '
|
|
17
|
-
overflowX: showNoDataView ? 'hidden' : '
|
|
16
|
+
overflow: 'auto',
|
|
17
|
+
overflowX: showNoDataView ? 'hidden' : 'auto',
|
|
18
18
|
margin: isSheetView ? '0 32px' : '0',
|
|
19
19
|
border: isSheetView ? '1px solid #F2F2F2' : 'none',
|
|
20
20
|
}));
|
|
@@ -30,7 +30,7 @@ export const StyledSolidBackground = styled(Box)(({ theme }) => ({
|
|
|
30
30
|
}));
|
|
31
31
|
export const StyledCell = styled(TableCell, {
|
|
32
32
|
shouldForwardProp: (prop) => !['isLast', 'isFirst', 'isSheetView'].includes(prop),
|
|
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: '
|
|
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: 'normal', overflow: 'visible', textOverflow: 'ellipsis', display: 'flex', alignItems: 'center' }, (isSheetView && {
|
|
34
34
|
borderRight: isLast ? 'none' : `1px solid ${theme.palette.divider}`,
|
|
35
35
|
}))));
|
|
36
36
|
export const StyledVirtualList = styled(VirtualScrollList, {
|
|
@@ -40,7 +40,7 @@ export const StyledVirtualList = styled(VirtualScrollList, {
|
|
|
40
40
|
}))));
|
|
41
41
|
export const StyledTableRow = styled(MUITableRow, {
|
|
42
42
|
shouldForwardProp: (props) => !['showShadowHighlight', 'showLoadedStyle', 'isSheetView'].includes(props),
|
|
43
|
-
})(({ theme, showShadowHighlight, showLoadedStyle, isSheetView }) => (Object.assign({ display: 'flex', borderBottom: `1px solid ${theme === null || theme === void 0 ? void 0 : theme.palette.divider}`, position: 'relative',
|
|
43
|
+
})(({ theme, showShadowHighlight, showLoadedStyle, isSheetView }) => (Object.assign({ display: 'flex', borderBottom: `1px solid ${theme === null || theme === void 0 ? void 0 : theme.palette.divider}`, position: 'relative', minHeight: '48px', width: '100%' }, (!isSheetView && Object.assign(Object.assign({ paddingInline: '32px', '&:hover': {
|
|
44
44
|
boxShadow: theme.shadows[12],
|
|
45
45
|
zIndex: 1,
|
|
46
46
|
'.payment-sources-container': {
|
|
@@ -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/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/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';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VTDemo: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Button, VirtualTable } from '../components/index.js';
|
|
4
|
+
import { Box } from '@mui/material';
|
|
5
|
+
export const VTDemo = () => {
|
|
6
|
+
const [isSheetView, setIsSheetView] = useState(false);
|
|
7
|
+
const toggleView = () => {
|
|
8
|
+
setIsSheetView((prev) => !prev);
|
|
9
|
+
};
|
|
10
|
+
return (_jsx(Box, Object.assign({ sx: {
|
|
11
|
+
width: '100%',
|
|
12
|
+
height: '100vh',
|
|
13
|
+
overflow: 'auto',
|
|
14
|
+
flexDirection: 'row',
|
|
15
|
+
display: 'flex',
|
|
16
|
+
justifyContent: 'center',
|
|
17
|
+
p: 3,
|
|
18
|
+
backgroundColor: 'gray',
|
|
19
|
+
} }, { children: _jsxs(Box, Object.assign({ "data-testid": "ChargesList", sx: {
|
|
20
|
+
position: 'relative',
|
|
21
|
+
display: 'flex',
|
|
22
|
+
flexDirection: 'column',
|
|
23
|
+
width: '80%',
|
|
24
|
+
height: '100%',
|
|
25
|
+
} }, { children: [_jsx(Button, Object.assign({ onClick: toggleView }, { children: "Toggle" })), _jsx(VirtualTable, { showHeader: true, showFooter: true, footerProps: {
|
|
26
|
+
totalCount: 4,
|
|
27
|
+
sandboxMode: false,
|
|
28
|
+
maximized: false,
|
|
29
|
+
}, loadMoreItems: () => Promise.resolve(), isLoading: false, isFetchingNextPage: false, rows: [
|
|
30
|
+
{ index: '1', date: 'date', order: 'order' },
|
|
31
|
+
{ index: '2', date: 'date', order: 'order' },
|
|
32
|
+
{ index: '3', date: 'date', order: 'order' },
|
|
33
|
+
], areAllRowsLoaded: true, columnsSorting: { id: 'asc' }, onColumnSort: () => { }, columns: [
|
|
34
|
+
{ id: 'index', header: '', width: '28px' },
|
|
35
|
+
{
|
|
36
|
+
id: 'date',
|
|
37
|
+
header: 'Date',
|
|
38
|
+
width: '170px',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'order',
|
|
42
|
+
header: 'Order',
|
|
43
|
+
width: '170px',
|
|
44
|
+
filter: {
|
|
45
|
+
onConfirm: undefined,
|
|
46
|
+
onClear: () => { },
|
|
47
|
+
type: 'inputs',
|
|
48
|
+
options: [
|
|
49
|
+
{
|
|
50
|
+
placeholder: 'Order',
|
|
51
|
+
apiKey: 'orderID',
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
data: {},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
], error: null, triggerDataRefetch: () => Promise.resolve(), showBackgroundColor: false, tableTitle: "Acceptance-Charges", tableMode: 'sheet', dragControls: undefined, isSheetView: isSheetView })] })) })));
|
|
58
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { VTDemo } from './VTDemo';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { VTDemo } from './VTDemo';
|
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.73-pin-icon-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
|
+
}
|