@tap-payments/os-micro-frontend-shared 0.1.131 → 0.1.133-test.1
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/VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable.js +64 -32
- package/build/components/VirtualTables/SheetViewVirtualTable/components/LoadingMainTable.d.ts +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/components/LoadingMainTable.js +2 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/components/MainTable.d.ts +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/components/MainTable.js +2 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/components/NoDataView.d.ts +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/components/NoDataView.js +2 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/components/PinnedColumn.d.ts +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/components/PinnedColumn.js +2 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/components/VirtualTable.js +15 -12
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/index.d.ts +1 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/index.js +1 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/usePerformanceOptimizations.d.ts +11 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/usePerformanceOptimizations.js +38 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/usePinnedColumns.js +73 -35
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableState.js +1 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.d.ts +1 -23
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.js +32 -28
- package/build/components/VirtualTables/SheetViewVirtualTable/types.d.ts +14 -7
- package/build/components/VirtualTables/components/ColumnFilter/ColumnFilter.js +1 -1
- package/build/components/VirtualTables/components/TableRow.js +20 -18
- package/build/components/VirtualTables/components/virtualScroll/ListItemWrapper.js +1 -1
- package/build/constants/table/cell/terminalsTableCellWidth.d.ts +3 -3
- package/build/constants/table/cell/terminalsTableCellWidth.js +3 -3
- package/build/constants/table.d.ts +1 -1
- package/build/constants/table.js +1 -1
- package/build/types/entity.d.ts +0 -5
- package/build/utils/style.d.ts +2 -2
- package/build/utils/style.js +2 -2
- package/package.json +3 -3
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Tap Payments
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Tap Payments
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# os-micro-frontend-shared
|
|
2
|
-
|
|
3
|
-
## Publishing Workflow
|
|
4
|
-
|
|
5
|
-
1. Update version in package.json
|
|
6
|
-
2. Commit changes
|
|
7
|
-
3. Create and push a tag:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm version patch # or minor, major
|
|
11
|
-
git push origin main --tags
|
|
12
|
-
```
|
|
1
|
+
# os-micro-frontend-shared
|
|
2
|
+
|
|
3
|
+
## Publishing Workflow
|
|
4
|
+
|
|
5
|
+
1. Update version in package.json
|
|
6
|
+
2. Commit changes
|
|
7
|
+
3. Create and push a tag:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm version patch # or minor, major
|
|
11
|
+
git push origin main --tags
|
|
12
|
+
```
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { memo, useCallback } from 'react';
|
|
2
|
+
import { memo, useCallback, useMemo } from 'react';
|
|
3
3
|
import { SHEET_VIEW_TABLE_THRESHOLD } from '../../../constants/index.js';
|
|
4
4
|
import TableFooter from '../components/TableFooter/TableFooter';
|
|
5
5
|
import { SheetViewTableContainer } from '../components/style';
|
|
6
6
|
import { SheetViewVirtualTableWrapper } from './style';
|
|
7
|
-
import { usePinnedColumns, useSynchronizedScroll, useTableState, useTableData, useVirtualTableContainer, usePinnedColumnsWidths } from './hooks';
|
|
7
|
+
import { usePinnedColumns, useSynchronizedScroll, useTableState, useTableData, useVirtualTableContainer, usePinnedColumnsWidths, usePerformanceOptimizations, } from './hooks';
|
|
8
8
|
import { PinnedColumn, MainTable, LoadingMainTable, NoDataView, VirtualTable } from './components';
|
|
9
9
|
function SheetViewVirtualTable({ columns, rows, threshold = SHEET_VIEW_TABLE_THRESHOLD, showHeader, headerProps, rowProps, footerProps, rowHeight = 28, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded = false, tableBodyStyles, tableTitle, dragControls, onColumnPin, clearBackdropVisibilityTimeout = 100, isPinnable = false, tableMode, overscanCount, }) {
|
|
10
|
+
const { stableColumns } = usePerformanceOptimizations(columns);
|
|
10
11
|
const { selectedCell, selectedColumn, selectedRow, showBackDrop, setShowBackdrop, handleCellClick, handleColumnClick, handleChipClick, selectedChip, } = useTableState();
|
|
11
12
|
const { isError, tableLoading, tableError, tableEmpty, hasTimeoutError, showNoDataView, lastItemIndex, areTotalRowsNotFillingHeight, itemsCount, isDelayedFetchingNextPage, } = useTableData({
|
|
12
13
|
rows,
|
|
@@ -15,7 +16,7 @@ function SheetViewVirtualTable({ columns, rows, threshold = SHEET_VIEW_TABLE_THR
|
|
|
15
16
|
isFetchingNextPage,
|
|
16
17
|
areAllRowsLoaded,
|
|
17
18
|
});
|
|
18
|
-
const { pinnedStartColumns, pinnedEndColumns, handleColumnPin, pinnedStartColumnsData, pinnedEndColumnsData, unpinnedColumnsData, orderedColumns, lastColumnId, } = usePinnedColumns(
|
|
19
|
+
const { pinnedStartColumns, pinnedEndColumns, handleColumnPin, pinnedStartColumnsData, pinnedEndColumnsData, unpinnedColumnsData, orderedColumns, lastColumnId, } = usePinnedColumns(stableColumns, isPinnable, onColumnPin);
|
|
19
20
|
const { pinnedStartVirtualListRef, scrollableVirtualListRef, pinnedEndVirtualListRef, handleScroll } = useSynchronizedScroll();
|
|
20
21
|
const { pinnedStartColumnsWidth, pinnedEndColumnsWidth } = usePinnedColumnsWidths(pinnedStartColumnsData, pinnedEndColumnsData);
|
|
21
22
|
const { getItemSize, getItemDataForContainer } = useVirtualTableContainer({
|
|
@@ -37,31 +38,7 @@ function SheetViewVirtualTable({ columns, rows, threshold = SHEET_VIEW_TABLE_THR
|
|
|
37
38
|
const onPointerDown = (e) => {
|
|
38
39
|
dragControls === null || dragControls === void 0 ? void 0 : dragControls.start(e);
|
|
39
40
|
};
|
|
40
|
-
const
|
|
41
|
-
const listRef = containerKey === 'pinnedStart' ? pinnedStartVirtualListRef : containerKey === 'pinnedEnd' ? pinnedEndVirtualListRef : scrollableVirtualListRef;
|
|
42
|
-
const handleScrollCallback = (scrollProps) => {
|
|
43
|
-
const source = containerKey === 'pinnedStart' ? 'start' : containerKey === 'pinnedEnd' ? 'end' : 'scrollable';
|
|
44
|
-
handleScroll(scrollProps, source);
|
|
45
|
-
};
|
|
46
|
-
return (_jsx(VirtualTable, { columnsData: columnsData, itemCount: itemsCount, lastItemIndex: lastItemIndex, areAllRowsLoaded: areAllRowsLoaded, loadMoreItems: loadMoreItems, threshold: threshold, getItemSize: getItemSize, getItemData: getItemDataForContainer, isPinned: isPinned, fixedWidth: fixedWidth, scrollToIndex: scrollToIndex, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, clearBackdropVisibilityTimeout: clearBackdropVisibilityTimeout, onScroll: handleScrollCallback, setBackdropVisibility: setShowBackdrop, listRef: listRef, overscanCount: overscanCount }));
|
|
47
|
-
}, [
|
|
48
|
-
itemsCount,
|
|
49
|
-
lastItemIndex,
|
|
50
|
-
areAllRowsLoaded,
|
|
51
|
-
loadMoreItems,
|
|
52
|
-
threshold,
|
|
53
|
-
getItemSize,
|
|
54
|
-
getItemDataForContainer,
|
|
55
|
-
scrollToIndex,
|
|
56
|
-
areTotalRowsNotFillingHeight,
|
|
57
|
-
clearBackdropVisibilityTimeout,
|
|
58
|
-
handleScroll,
|
|
59
|
-
setShowBackdrop,
|
|
60
|
-
pinnedStartVirtualListRef,
|
|
61
|
-
pinnedEndVirtualListRef,
|
|
62
|
-
scrollableVirtualListRef,
|
|
63
|
-
]);
|
|
64
|
-
const baseCommonProps = {
|
|
41
|
+
const baseCommonProps = useMemo(() => ({
|
|
65
42
|
showHeader,
|
|
66
43
|
columnsSorting,
|
|
67
44
|
onColumnSort,
|
|
@@ -81,9 +58,64 @@ function SheetViewVirtualTable({ columns, rows, threshold = SHEET_VIEW_TABLE_THR
|
|
|
81
58
|
tableMode,
|
|
82
59
|
showNoDataView,
|
|
83
60
|
tableBodyStyles,
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
61
|
+
}), [
|
|
62
|
+
showHeader,
|
|
63
|
+
columnsSorting,
|
|
64
|
+
onColumnSort,
|
|
65
|
+
headerProps,
|
|
66
|
+
showBackDrop,
|
|
67
|
+
handleColumnPin,
|
|
68
|
+
isPinnable,
|
|
69
|
+
lastColumnId,
|
|
70
|
+
selectedColumn,
|
|
71
|
+
handleColumnClick,
|
|
72
|
+
tableTitle,
|
|
73
|
+
areAllRowsLoaded,
|
|
74
|
+
isFetchingNextPage,
|
|
75
|
+
scrollToIndex,
|
|
76
|
+
isLoading,
|
|
77
|
+
isError,
|
|
78
|
+
tableMode,
|
|
79
|
+
showNoDataView,
|
|
80
|
+
tableBodyStyles,
|
|
81
|
+
]);
|
|
82
|
+
const commonPropsWithTableStates = useMemo(() => (Object.assign(Object.assign({}, baseCommonProps), { hasTimeoutError,
|
|
83
|
+
tableLoading })), [baseCommonProps, hasTimeoutError, tableLoading]);
|
|
84
|
+
const virtualTableBaseProps = useMemo(() => ({
|
|
85
|
+
itemCount: itemsCount,
|
|
86
|
+
lastItemIndex,
|
|
87
|
+
areAllRowsLoaded,
|
|
88
|
+
loadMoreItems,
|
|
89
|
+
threshold,
|
|
90
|
+
getItemSize,
|
|
91
|
+
getItemData: getItemDataForContainer,
|
|
92
|
+
scrollToIndex,
|
|
93
|
+
areTotalRowsNotFillingHeight,
|
|
94
|
+
clearBackdropVisibilityTimeout,
|
|
95
|
+
setBackdropVisibility: setShowBackdrop,
|
|
96
|
+
overscanCount,
|
|
97
|
+
}), [
|
|
98
|
+
itemsCount,
|
|
99
|
+
lastItemIndex,
|
|
100
|
+
areAllRowsLoaded,
|
|
101
|
+
loadMoreItems,
|
|
102
|
+
threshold,
|
|
103
|
+
getItemSize,
|
|
104
|
+
getItemDataForContainer,
|
|
105
|
+
scrollToIndex,
|
|
106
|
+
areTotalRowsNotFillingHeight,
|
|
107
|
+
clearBackdropVisibilityTimeout,
|
|
108
|
+
setShowBackdrop,
|
|
109
|
+
overscanCount,
|
|
110
|
+
]);
|
|
111
|
+
const createVirtualTableContainer = useCallback((columnsData, containerKey, isPinned = false, fixedWidth) => {
|
|
112
|
+
const listRef = containerKey === 'pinnedStart' ? pinnedStartVirtualListRef : containerKey === 'pinnedEnd' ? pinnedEndVirtualListRef : scrollableVirtualListRef;
|
|
113
|
+
const handleScrollCallback = (scrollProps) => {
|
|
114
|
+
const source = containerKey === 'pinnedStart' ? 'start' : containerKey === 'pinnedEnd' ? 'end' : 'scrollable';
|
|
115
|
+
handleScroll(scrollProps, source);
|
|
116
|
+
};
|
|
117
|
+
return (_jsx(VirtualTable, Object.assign({}, virtualTableBaseProps, { columnsData: columnsData, isPinned: isPinned, fixedWidth: fixedWidth, onScroll: handleScrollCallback, listRef: listRef })));
|
|
118
|
+
}, [virtualTableBaseProps, handleScroll, pinnedStartVirtualListRef, pinnedEndVirtualListRef, scrollableVirtualListRef]);
|
|
119
|
+
return (_jsxs(_Fragment, { children: [_jsx(SheetViewTableContainer, { children: showNoDataView ? (tableLoading ? (_jsxs(SheetViewVirtualTableWrapper, { children: [pinnedStartColumnsData.length > 0 && (_jsx(PinnedColumn, { position: "start", columnsData: pinnedStartColumnsData, columnsWidth: pinnedStartColumnsWidth, pinnedColumnsList: pinnedStartColumns, hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0, createVirtualTableContainer: createVirtualTableContainer, commonProps: commonPropsWithTableStates })), _jsx(LoadingMainTable, { hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0, unpinnedColumnsData: unpinnedColumnsData, pinnedStartColumns: pinnedStartColumns, pinnedEndColumns: pinnedEndColumns, commonProps: commonPropsWithTableStates }), pinnedEndColumnsData.length > 0 && (_jsx(PinnedColumn, { position: "end", columnsData: pinnedEndColumnsData, columnsWidth: pinnedEndColumnsWidth, pinnedColumnsList: [...pinnedStartColumns, ...pinnedEndColumns], hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0, createVirtualTableContainer: createVirtualTableContainer, commonProps: commonPropsWithTableStates }))] })) : (_jsx(NoDataView, { tableLoading: tableLoading, tableError: tableError, tableEmpty: tableEmpty, hasTimeoutError: hasTimeoutError, orderedColumns: orderedColumns, error: error, triggerDataRefetch: triggerDataRefetch, footerProps: footerProps, commonProps: baseCommonProps }))) : (_jsxs(SheetViewVirtualTableWrapper, { children: [pinnedStartColumnsData.length > 0 && (_jsx(PinnedColumn, { position: "start", columnsData: pinnedStartColumnsData, columnsWidth: pinnedStartColumnsWidth, pinnedColumnsList: pinnedStartColumns, hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0, createVirtualTableContainer: createVirtualTableContainer, commonProps: commonPropsWithTableStates })), _jsx(MainTable, { hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0, unpinnedColumnsData: unpinnedColumnsData, pinnedStartColumns: pinnedStartColumns, pinnedEndColumns: pinnedEndColumns, createVirtualTableContainer: createVirtualTableContainer, commonProps: commonPropsWithTableStates }), pinnedEndColumnsData.length > 0 && (_jsx(PinnedColumn, { position: "end", columnsData: pinnedEndColumnsData, columnsWidth: pinnedEndColumnsWidth, pinnedColumnsList: [...pinnedStartColumns, ...pinnedEndColumns], hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0, createVirtualTableContainer: createVirtualTableContainer, commonProps: commonPropsWithTableStates }))] })) }), _jsx(TableFooter, Object.assign({ "data-testid": "SheetViewVirtualTable_TableFooter", showSeparator: true, showBackDrop: showBackDrop, onPointerDown: onPointerDown }, footerProps))] }));
|
|
88
120
|
}
|
|
89
121
|
export default memo(SheetViewVirtualTable);
|
package/build/components/VirtualTables/SheetViewVirtualTable/components/LoadingMainTable.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { LoadingMainTableProps } from '../types';
|
|
3
|
-
declare function LoadingMainTable({ hasPinnedStart, hasPinnedEnd, unpinnedColumnsData,
|
|
3
|
+
declare function LoadingMainTable({ hasPinnedStart, hasPinnedEnd, unpinnedColumnsData, pinnedStartColumns, pinnedEndColumns, commonProps, }: LoadingMainTableProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare const _default: import("react").MemoExoticComponent<typeof LoadingMainTable>;
|
|
5
5
|
export default _default;
|
|
@@ -5,8 +5,9 @@ import { StyledTableBox, TableWrapper, StyledBox } from '../../components/style'
|
|
|
5
5
|
import { MainTableWrapper, UnpinnedTableHeaderWrapper } from '../style';
|
|
6
6
|
import SheetViewTableHeader from './SheetViewTableHeader';
|
|
7
7
|
import SheetViewTableLoading from './SheetViewTableLoading';
|
|
8
|
-
function LoadingMainTable({ hasPinnedStart, hasPinnedEnd, unpinnedColumnsData,
|
|
8
|
+
function LoadingMainTable({ hasPinnedStart, hasPinnedEnd, unpinnedColumnsData, pinnedStartColumns, pinnedEndColumns, commonProps, }) {
|
|
9
9
|
const theme = useTheme();
|
|
10
|
+
const { showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, hasTimeoutError, tableMode, showNoDataView, tableBodyStyles, } = commonProps;
|
|
10
11
|
return (_jsx(MainTableWrapper, Object.assign({ hasPinnedStart: hasPinnedStart, hasPinnedEnd: hasPinnedEnd }, { children: _jsx(StyledTableBox, Object.assign({ as: "main", id: "sheet-table-box-container", "aria-labelledby": "sheet-table-box-container", "data-testid": "SheetViewVirtualTable_StyledTableBox_Loading", "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-table-mode": tableMode, height: "100%", dir: theme.direction, showNoDataView: showNoDataView, scrollable: true }, { children: _jsxs(TableWrapper, Object.assign({ "data-testid": "SheetViewVirtualTable_LoadingTableWrapper", showNoDataView: showNoDataView, sx: Object.assign(Object.assign({}, tableBodyStyles), { display: 'flex', flexDirection: 'column', height: '100%' }) }, { children: [showHeader && (_jsx(UnpinnedTableHeaderWrapper, { children: _jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_LoadingTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: unpinnedColumnsData, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: [...pinnedStartColumns, ...pinnedEndColumns], onColumnPin: onColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: onColumnClick, tablePosition: "scrollable", hasPinnedStart: hasPinnedStart, hasPinnedEnd: hasPinnedEnd }) })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_LoadingTableWrapper", sx: {
|
|
11
12
|
width: '100%',
|
|
12
13
|
minWidth: 'fit-content',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { MainTableProps } from '../types';
|
|
3
|
-
declare function MainTable({ hasPinnedStart, hasPinnedEnd, unpinnedColumnsData,
|
|
3
|
+
declare function MainTable({ hasPinnedStart, hasPinnedEnd, unpinnedColumnsData, pinnedStartColumns, pinnedEndColumns, createVirtualTableContainer, commonProps, }: MainTableProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare const _default: import("react").MemoExoticComponent<typeof MainTable>;
|
|
5
5
|
export default _default;
|
|
@@ -5,8 +5,9 @@ import { StyledTableBox, TableWrapper, StyledBox } from '../../components/style'
|
|
|
5
5
|
import { MainTableWrapper, UnpinnedTableHeaderWrapper } from '../style';
|
|
6
6
|
import SheetViewTableHeader from './SheetViewTableHeader';
|
|
7
7
|
import SheetViewTableLoading from './SheetViewTableLoading';
|
|
8
|
-
function MainTable({ hasPinnedStart, hasPinnedEnd, unpinnedColumnsData,
|
|
8
|
+
function MainTable({ hasPinnedStart, hasPinnedEnd, unpinnedColumnsData, pinnedStartColumns, pinnedEndColumns, createVirtualTableContainer, commonProps, }) {
|
|
9
9
|
const theme = useTheme();
|
|
10
|
+
const { showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, hasTimeoutError, tableMode, showNoDataView, tableBodyStyles, tableLoading, } = commonProps;
|
|
10
11
|
return (_jsx(MainTableWrapper, Object.assign({ hasPinnedStart: hasPinnedStart, hasPinnedEnd: hasPinnedEnd }, { 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-table-mode": tableMode, height: "100%", dir: theme.direction, showNoDataView: showNoDataView, scrollable: true }, { children: _jsxs(TableWrapper, Object.assign({ "data-testid": "SheetViewVirtualTable_TableWrapper", showNoDataView: showNoDataView, sx: Object.assign(Object.assign({}, tableBodyStyles), { display: 'flex', flexDirection: 'column', height: '100%' }) }, { children: [showHeader && (_jsx(UnpinnedTableHeaderWrapper, { children: _jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_UnpinnedTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: unpinnedColumnsData, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: [...pinnedStartColumns, ...pinnedEndColumns], onColumnPin: onColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: onColumnClick, tablePosition: "scrollable", hasPinnedStart: hasPinnedStart, hasPinnedEnd: hasPinnedEnd }) })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
|
11
12
|
width: '100%',
|
|
12
13
|
minWidth: 'fit-content',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { NoDataViewProps } from '../types';
|
|
3
|
-
declare function NoDataView({ tableLoading, tableError, tableEmpty, hasTimeoutError, orderedColumns,
|
|
3
|
+
declare function NoDataView({ tableLoading, tableError, tableEmpty, hasTimeoutError, orderedColumns, error, triggerDataRefetch, footerProps, commonProps, }: NoDataViewProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare const _default: import("react").MemoExoticComponent<typeof NoDataView>;
|
|
5
5
|
export default _default;
|
|
@@ -5,8 +5,9 @@ import { StyledTableBox, TableWrapper } from '../../components/style';
|
|
|
5
5
|
import { UnpinnedTableHeaderWrapper } from '../style';
|
|
6
6
|
import TableNoData from '../../components/TableNoData';
|
|
7
7
|
import SheetViewTableHeader from './SheetViewTableHeader';
|
|
8
|
-
function NoDataView({ tableLoading, tableError, tableEmpty, hasTimeoutError, orderedColumns,
|
|
8
|
+
function NoDataView({ tableLoading, tableError, tableEmpty, hasTimeoutError, orderedColumns, error, triggerDataRefetch, footerProps, commonProps, }) {
|
|
9
9
|
const theme = useTheme();
|
|
10
|
+
const { showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, onColumnPin, lastColumnId, selectedColumn, onColumnClick, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, tableMode, tableBodyStyles, } = commonProps;
|
|
10
11
|
const showNoDataView = tableLoading || tableError || tableEmpty || hasTimeoutError;
|
|
11
12
|
return (_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-table-mode": tableMode, height: "100%", dir: theme.direction, showNoDataView: showNoDataView }, { children: _jsxs(TableWrapper, Object.assign({ "data-testid": "SheetViewVirtualTable_TableWrapper", showNoDataView: showNoDataView, sx: tableBodyStyles }, { children: [showHeader && (_jsx(UnpinnedTableHeaderWrapper, { children: _jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_LoadingTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: orderedColumns, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: [], onColumnPin: onColumnPin, isPinnable: false, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: onColumnClick }) })), _jsx(TableNoData, { error: error || null, tableEmpty: tableEmpty, isTimeoutError: hasTimeoutError, tableError: tableError, tableLoading: tableLoading, orderedColumns: orderedColumns, triggerDataRefetch: triggerDataRefetch || (() => Promise.resolve()), footerProps: footerProps })] })) })));
|
|
12
13
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { PinnedColumnProps } from '../types';
|
|
3
|
-
declare function PinnedColumn({ position, columnsData, columnsWidth, pinnedColumnsList,
|
|
3
|
+
declare function PinnedColumn({ position, columnsData, columnsWidth, pinnedColumnsList, hasPinnedStart, hasPinnedEnd, createVirtualTableContainer, commonProps, }: PinnedColumnProps): import("react/jsx-runtime").JSX.Element | null;
|
|
4
4
|
declare const _default: import("react").MemoExoticComponent<typeof PinnedColumn>;
|
|
5
5
|
export default _default;
|
|
@@ -5,8 +5,9 @@ import { StyledTableBox, TableWrapper, StyledBox } from '../../components/style'
|
|
|
5
5
|
import { PinnedStartColumnWrapper, PinnedEndColumnWrapper } from '../style';
|
|
6
6
|
import SheetViewTableHeader from './SheetViewTableHeader';
|
|
7
7
|
import SheetViewTableLoading from './SheetViewTableLoading';
|
|
8
|
-
function PinnedColumn({ position, columnsData, columnsWidth, pinnedColumnsList,
|
|
8
|
+
function PinnedColumn({ position, columnsData, columnsWidth, pinnedColumnsList, hasPinnedStart, hasPinnedEnd, createVirtualTableContainer, commonProps, }) {
|
|
9
9
|
const theme = useTheme();
|
|
10
|
+
const { showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, hasTimeoutError, tableMode, showNoDataView, tableLoading, } = commonProps;
|
|
10
11
|
if (columnsData.length === 0)
|
|
11
12
|
return null;
|
|
12
13
|
const Wrapper = position === 'start' ? PinnedStartColumnWrapper : PinnedEndColumnWrapper;
|
|
@@ -8,26 +8,29 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
import { memo } from 'react';
|
|
11
|
+
import { memo, useCallback, useMemo } from 'react';
|
|
12
12
|
import InfiniteLoader from 'react-window-infinite-loader';
|
|
13
13
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
14
14
|
import { SHEET_VIEW_TABLE_LIST_OVER_SCAN } from '../../../../constants/index.js';
|
|
15
15
|
import ListItemWrapper from '../../components/virtualScroll/ListItemWrapper';
|
|
16
16
|
import { StyledVirtualList } from '../../components/style';
|
|
17
17
|
function VirtualTable({ columnsData, itemCount, lastItemIndex, areAllRowsLoaded, loadMoreItems, threshold, getItemSize, getItemData, isPinned, fixedWidth, scrollToIndex, areTotalRowsNotFillingHeight, clearBackdropVisibilityTimeout, onScroll, setBackdropVisibility, listRef, overscanCount = SHEET_VIEW_TABLE_LIST_OVER_SCAN, }) {
|
|
18
|
-
const handleOnLoadMoreItems = () => __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const handleOnLoadMoreItems = useCallback(() => __awaiter(this, void 0, void 0, function* () {
|
|
19
19
|
if (areAllRowsLoaded)
|
|
20
20
|
return;
|
|
21
21
|
yield (loadMoreItems === null || loadMoreItems === void 0 ? void 0 : loadMoreItems());
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} }, { children: ListItemWrapper })));
|
|
31
|
-
} }))) })));
|
|
22
|
+
}), [areAllRowsLoaded, loadMoreItems]);
|
|
23
|
+
const isItemLoaded = useCallback((index) => index !== lastItemIndex, [lastItemIndex]);
|
|
24
|
+
const listStyle = useMemo(() => ({
|
|
25
|
+
overflowX: isPinned ? 'hidden' : 'auto',
|
|
26
|
+
paddingBottom: isPinned ? '25px' : '13px',
|
|
27
|
+
backgroundColor: isPinned ? 'transparent' : '#F6F8FACC',
|
|
28
|
+
}), [isPinned]);
|
|
29
|
+
return (_jsx(InfiniteLoader, Object.assign({ isItemLoaded: isItemLoaded, itemCount: itemCount, loadMoreItems: handleOnLoadMoreItems, threshold: threshold }, { children: ({ onItemsRendered, ref }) => (_jsx(AutoSizer, Object.assign({ ref: ref }, { children: ({ height, width }) => (_jsx(MemoizedVirtualList, { listRef: listRef, height: height, width: fixedWidth || width, itemCount: itemCount, getItemSize: getItemSize, getItemData: getItemData, columnsData: columnsData, isPinned: isPinned, onItemsRendered: onItemsRendered, overscanCount: overscanCount, setBackdropVisibility: setBackdropVisibility, scrollToIndex: scrollToIndex, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, onScroll: onScroll, clearBackdropVisibilityTimeout: clearBackdropVisibilityTimeout, listStyle: listStyle })) }))) })));
|
|
32
30
|
}
|
|
31
|
+
const MemoizedVirtualList = memo(function MemoizedVirtualList({ listRef, height, width, itemCount, getItemSize, getItemData, columnsData, isPinned, onItemsRendered, overscanCount, setBackdropVisibility, scrollToIndex, areTotalRowsNotFillingHeight, onScroll, clearBackdropVisibilityTimeout, listStyle, }) {
|
|
32
|
+
const itemSize = useCallback((index) => getItemSize(index, height), [getItemSize, height]);
|
|
33
|
+
const itemData = useMemo(() => getItemData(columnsData, isPinned, height), [getItemData, columnsData, isPinned, height]);
|
|
34
|
+
return (_jsx(StyledVirtualList, Object.assign({ listRef: listRef, height: height, width: width, itemCount: itemCount, itemSize: itemSize, itemData: itemData, onItemsRendered: onItemsRendered, overscanCount: overscanCount, setBackdropVisibility: setBackdropVisibility, scrollToIndex: scrollToIndex, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, useIsScrolling: true, onScroll: onScroll, clearBackdropVisibilityTimeout: clearBackdropVisibilityTimeout, style: listStyle }, { children: ListItemWrapper })));
|
|
35
|
+
});
|
|
33
36
|
export default memo(VirtualTable);
|
|
@@ -4,3 +4,4 @@ export { useTableState } from './useTableState';
|
|
|
4
4
|
export { useTableData } from './useTableData';
|
|
5
5
|
export { useVirtualTableContainer } from './useVirtualTableContainer';
|
|
6
6
|
export { usePinnedColumnsWidths } from './usePinnedColumnsWidths';
|
|
7
|
+
export { usePerformanceOptimizations } from './usePerformanceOptimizations';
|
|
@@ -4,3 +4,4 @@ export { useTableState } from './useTableState';
|
|
|
4
4
|
export { useTableData } from './useTableData';
|
|
5
5
|
export { useVirtualTableContainer } from './useVirtualTableContainer';
|
|
6
6
|
export { usePinnedColumnsWidths } from './usePinnedColumnsWidths';
|
|
7
|
+
export { usePerformanceOptimizations } from './usePerformanceOptimizations';
|
package/build/components/VirtualTables/SheetViewVirtualTable/hooks/usePerformanceOptimizations.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IColumnProps } from '../../../../types/index.js';
|
|
2
|
+
export declare const usePerformanceOptimizations: (columns: readonly IColumnProps[]) => {
|
|
3
|
+
stableColumns: IColumnProps<any>[];
|
|
4
|
+
columnMetrics: {
|
|
5
|
+
visibleColumns: IColumnProps<any>[];
|
|
6
|
+
totalWidth: number;
|
|
7
|
+
columnCount: number;
|
|
8
|
+
firstColumnId: string | number | symbol;
|
|
9
|
+
lastColumnId: string | number | symbol;
|
|
10
|
+
};
|
|
11
|
+
};
|
package/build/components/VirtualTables/SheetViewVirtualTable/hooks/usePerformanceOptimizations.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useMemo, useRef } from 'react';
|
|
2
|
+
export const usePerformanceOptimizations = (columns) => {
|
|
3
|
+
const stableColumnsRef = useRef([]);
|
|
4
|
+
const stableColumns = useMemo(() => {
|
|
5
|
+
const hasChanged = columns.length !== stableColumnsRef.current.length ||
|
|
6
|
+
columns.some((col, index) => {
|
|
7
|
+
const prevCol = stableColumnsRef.current[index];
|
|
8
|
+
return (!prevCol ||
|
|
9
|
+
col.id !== prevCol.id ||
|
|
10
|
+
col.width !== prevCol.width ||
|
|
11
|
+
col.pinned !== prevCol.pinned ||
|
|
12
|
+
col.hidden !== prevCol.hidden ||
|
|
13
|
+
col.order !== prevCol.order ||
|
|
14
|
+
col.filter !== prevCol.filter);
|
|
15
|
+
});
|
|
16
|
+
if (hasChanged) {
|
|
17
|
+
stableColumnsRef.current = [...columns];
|
|
18
|
+
}
|
|
19
|
+
return stableColumnsRef.current;
|
|
20
|
+
}, [columns]);
|
|
21
|
+
const columnMetrics = useMemo(() => {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
const visibleColumns = stableColumns.filter((col) => !col.hidden);
|
|
24
|
+
const totalWidth = visibleColumns.reduce((sum, col) => sum + +((col === null || col === void 0 ? void 0 : col.width) || 100), 0);
|
|
25
|
+
const columnCount = visibleColumns.length;
|
|
26
|
+
return {
|
|
27
|
+
visibleColumns,
|
|
28
|
+
totalWidth,
|
|
29
|
+
columnCount,
|
|
30
|
+
firstColumnId: (_a = visibleColumns[0]) === null || _a === void 0 ? void 0 : _a.id,
|
|
31
|
+
lastColumnId: (_b = visibleColumns[columnCount - 1]) === null || _b === void 0 ? void 0 : _b.id,
|
|
32
|
+
};
|
|
33
|
+
}, [stableColumns]);
|
|
34
|
+
return {
|
|
35
|
+
stableColumns,
|
|
36
|
+
columnMetrics,
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -1,21 +1,41 @@
|
|
|
1
1
|
import { useState, useCallback, useMemo } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
const getInitialPinnedStartColumns = (columns, isPinnable) => {
|
|
3
|
+
if (!isPinnable && columns.length === 0)
|
|
4
|
+
return [];
|
|
5
|
+
const defaultPinned = [];
|
|
6
|
+
const userPinned = [];
|
|
7
|
+
for (const column of columns) {
|
|
8
|
+
const columnId = column.id;
|
|
9
|
+
if (column.isDefaultPinned) {
|
|
10
|
+
defaultPinned.push(columnId);
|
|
11
|
+
}
|
|
12
|
+
else if (isPinnable && column.pinned === 'start') {
|
|
13
|
+
userPinned.push(columnId);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return Array.from(new Set([...defaultPinned, ...userPinned]));
|
|
17
|
+
};
|
|
18
|
+
const getInitialPinnedEndColumns = (columns, isPinnable) => {
|
|
19
|
+
if (!isPinnable)
|
|
20
|
+
return [];
|
|
21
|
+
const userPinned = [];
|
|
22
|
+
let lastVisibleColumn = null;
|
|
23
|
+
for (const column of columns) {
|
|
24
|
+
if (column.pinned === 'end') {
|
|
25
|
+
userPinned.push(column.id);
|
|
16
26
|
}
|
|
17
|
-
|
|
18
|
-
|
|
27
|
+
if (!column.hidden) {
|
|
28
|
+
lastVisibleColumn = column;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (userPinned.length === 0 && lastVisibleColumn && !lastVisibleColumn.pinned && !lastVisibleColumn.isDefaultPinned) {
|
|
32
|
+
return [lastVisibleColumn.id];
|
|
33
|
+
}
|
|
34
|
+
return userPinned;
|
|
35
|
+
};
|
|
36
|
+
export const usePinnedColumns = (columns, isPinnable, onColumnPin) => {
|
|
37
|
+
const [pinnedStartColumns, setPinnedStartColumns] = useState(() => getInitialPinnedStartColumns(columns, isPinnable));
|
|
38
|
+
const [pinnedEndColumns, setPinnedEndColumns] = useState(() => getInitialPinnedEndColumns(columns, isPinnable));
|
|
19
39
|
const handleColumnPin = useCallback((columnId, position = 'start') => {
|
|
20
40
|
if (!isPinnable)
|
|
21
41
|
return;
|
|
@@ -38,33 +58,51 @@ export const usePinnedColumns = (columns, isPinnable, onColumnPin) => {
|
|
|
38
58
|
const isPinned = newPinnedStart.includes(columnId) || newPinnedEnd.includes(columnId);
|
|
39
59
|
onColumnPin === null || onColumnPin === void 0 ? void 0 : onColumnPin(columnId, isPinned);
|
|
40
60
|
}, [pinnedStartColumns, pinnedEndColumns, onColumnPin, isPinnable]);
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
61
|
+
const columnData = useMemo(() => {
|
|
62
|
+
const pinnedStartSet = new Set(pinnedStartColumns);
|
|
63
|
+
const pinnedEndSet = new Set(pinnedEndColumns);
|
|
64
|
+
const visibleColumns = [];
|
|
65
|
+
const startColumns = [];
|
|
66
|
+
const endColumns = [];
|
|
67
|
+
const unpinnedColumns = [];
|
|
68
|
+
for (const column of columns) {
|
|
69
|
+
if (column.hidden)
|
|
70
|
+
continue;
|
|
71
|
+
visibleColumns.push(column);
|
|
72
|
+
const columnId = column.id;
|
|
73
|
+
if (pinnedStartSet.has(columnId)) {
|
|
74
|
+
startColumns.push(column);
|
|
75
|
+
}
|
|
76
|
+
else if (pinnedEndSet.has(columnId)) {
|
|
77
|
+
endColumns.push(column);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
unpinnedColumns.push(column);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const sortByOrder = (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); };
|
|
84
|
+
const sortedStart = startColumns.sort(sortByOrder);
|
|
85
|
+
const sortedEnd = endColumns.sort(sortByOrder);
|
|
86
|
+
const sortedUnpinned = unpinnedColumns.sort(sortByOrder);
|
|
87
|
+
const orderedColumns = [...sortedStart, ...sortedUnpinned, ...sortedEnd];
|
|
88
|
+
const lastColumnId = orderedColumns.length > 0 ? orderedColumns[orderedColumns.length - 1].id : null;
|
|
49
89
|
return {
|
|
90
|
+
visibleColumns,
|
|
50
91
|
pinnedStartColumnsData: sortedStart,
|
|
51
92
|
pinnedEndColumnsData: sortedEnd,
|
|
52
93
|
unpinnedColumnsData: sortedUnpinned,
|
|
94
|
+
orderedColumns,
|
|
95
|
+
lastColumnId,
|
|
53
96
|
};
|
|
54
|
-
}, [
|
|
55
|
-
const orderedColumns = useMemo(() => [...pinnedStartColumnsData, ...unpinnedColumnsData, ...pinnedEndColumnsData], [pinnedStartColumnsData, unpinnedColumnsData, pinnedEndColumnsData]);
|
|
56
|
-
const lastColumnId = useMemo(() => {
|
|
57
|
-
const lastCol = orderedColumns[orderedColumns.length - 1];
|
|
58
|
-
return lastCol ? lastCol.id : null;
|
|
59
|
-
}, [orderedColumns]);
|
|
97
|
+
}, [columns, pinnedStartColumns, pinnedEndColumns]);
|
|
60
98
|
return {
|
|
61
99
|
pinnedStartColumns,
|
|
62
100
|
pinnedEndColumns,
|
|
63
101
|
handleColumnPin,
|
|
64
|
-
pinnedStartColumnsData,
|
|
65
|
-
pinnedEndColumnsData,
|
|
66
|
-
unpinnedColumnsData,
|
|
67
|
-
orderedColumns,
|
|
68
|
-
lastColumnId,
|
|
102
|
+
pinnedStartColumnsData: columnData.pinnedStartColumnsData,
|
|
103
|
+
pinnedEndColumnsData: columnData.pinnedEndColumnsData,
|
|
104
|
+
unpinnedColumnsData: columnData.unpinnedColumnsData,
|
|
105
|
+
orderedColumns: columnData.orderedColumns,
|
|
106
|
+
lastColumnId: columnData.lastColumnId,
|
|
69
107
|
};
|
|
70
108
|
};
|
|
@@ -17,6 +17,7 @@ export const useTableState = () => {
|
|
|
17
17
|
}
|
|
18
18
|
setSelectedChip(chipKey);
|
|
19
19
|
setSelectedCell(cellKey);
|
|
20
|
+
setSelectedColumn(null);
|
|
20
21
|
setSelectedRow(null);
|
|
21
22
|
}, [selectedChip, setSelectedChip, setSelectedCell, setSelectedRow]);
|
|
22
23
|
const handleCellClick = useCallback((rowIndex, columnIndex, event, pinnedType) => {
|
package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.d.ts
CHANGED
|
@@ -23,28 +23,6 @@ interface UseVirtualTableContainerProps<T = unknown> extends TableChipProps {
|
|
|
23
23
|
}
|
|
24
24
|
export declare const useVirtualTableContainer: <T = unknown>({ rowHeight, areAllRowsLoaded, rows, isDelayedFetchingNextPage, rowProps, scrollToIndex, footerProps, isError, selectedCell, selectedColumn, selectedRow, selectedChip, handleCellClick, handleChipClick, }: UseVirtualTableContainerProps<T>) => {
|
|
25
25
|
getItemSize: (index: number, height: number) => number;
|
|
26
|
-
getItemDataForContainer: (columnsData: IColumnProps[], isPinnedColumn: boolean, height: number) =>
|
|
27
|
-
columns: any;
|
|
28
|
-
isLoading: any;
|
|
29
|
-
rows: any;
|
|
30
|
-
rowProps: any;
|
|
31
|
-
scrollToIndex: any;
|
|
32
|
-
totalCount: any;
|
|
33
|
-
lastItemIndex: any;
|
|
34
|
-
isError: any;
|
|
35
|
-
areAllRowsLoaded: any;
|
|
36
|
-
limit: any;
|
|
37
|
-
newLoadedRowsEndIndex: any;
|
|
38
|
-
isSheetView: boolean;
|
|
39
|
-
isPinned: any;
|
|
40
|
-
selectedCell: any;
|
|
41
|
-
selectedColumn: any;
|
|
42
|
-
selectedRow: any;
|
|
43
|
-
selectedChip: any;
|
|
44
|
-
onCellClick: any;
|
|
45
|
-
onChipClick: any;
|
|
46
|
-
containerHeight: any;
|
|
47
|
-
rowHeight: any;
|
|
48
|
-
};
|
|
26
|
+
getItemDataForContainer: (columnsData: IColumnProps[], isPinnedColumn: boolean, height: number) => any;
|
|
49
27
|
};
|
|
50
28
|
export {};
|
package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.js
CHANGED
|
@@ -1,54 +1,58 @@
|
|
|
1
1
|
import { useCallback, useMemo } from 'react';
|
|
2
2
|
import memoize from 'memoize-one';
|
|
3
|
-
const
|
|
4
|
-
columns,
|
|
5
|
-
isLoading,
|
|
3
|
+
const createCoreItemData = memoize((columns, rows, rowProps, totalCount, lastItemIndex, isError, areAllRowsLoaded, isPinned, containerHeight, rowHeight) => ({
|
|
4
|
+
columns: columns || [],
|
|
6
5
|
rows,
|
|
7
6
|
rowProps,
|
|
8
|
-
scrollToIndex,
|
|
9
7
|
totalCount,
|
|
10
8
|
lastItemIndex,
|
|
11
9
|
isError,
|
|
12
10
|
areAllRowsLoaded,
|
|
13
|
-
limit: totalCount,
|
|
14
|
-
newLoadedRowsEndIndex: lastItemIndex,
|
|
15
|
-
isSheetView: true,
|
|
16
11
|
isPinned,
|
|
12
|
+
containerHeight,
|
|
13
|
+
rowHeight,
|
|
14
|
+
selectedCell: null,
|
|
15
|
+
selectedColumn: null,
|
|
16
|
+
selectedRow: null,
|
|
17
|
+
selectedChip: null,
|
|
18
|
+
onCellClick: () => { },
|
|
19
|
+
onChipClick: () => { },
|
|
20
|
+
scrollToIndex: undefined,
|
|
21
|
+
isLoading: false,
|
|
22
|
+
limit: 0,
|
|
23
|
+
newLoadedRowsEndIndex: 0,
|
|
24
|
+
isSheetView: true,
|
|
25
|
+
}));
|
|
26
|
+
const createInteractionData = memoize((selectedCell, selectedColumn, selectedRow, selectedChip, onCellClick, onChipClick) => ({
|
|
17
27
|
selectedCell,
|
|
18
28
|
selectedColumn,
|
|
19
29
|
selectedRow,
|
|
20
30
|
selectedChip,
|
|
21
31
|
onCellClick,
|
|
22
32
|
onChipClick,
|
|
23
|
-
containerHeight,
|
|
24
|
-
rowHeight,
|
|
25
33
|
}));
|
|
34
|
+
const createItemData = (coreData, interactionData, scrollToIndex, isLoading) => (Object.assign(Object.assign(Object.assign({}, coreData), interactionData), { scrollToIndex,
|
|
35
|
+
isLoading }));
|
|
26
36
|
export const useVirtualTableContainer = ({ rowHeight, areAllRowsLoaded, rows, isDelayedFetchingNextPage, rowProps, scrollToIndex, footerProps, isError, selectedCell, selectedColumn, selectedRow, selectedChip, handleCellClick, handleChipClick, }) => {
|
|
37
|
+
const rowsLength = rows.length;
|
|
38
|
+
const minimumLastRowHeight = rowHeight * 2;
|
|
27
39
|
const getItemSize = useCallback((index, height) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const usedHeight = rows.length * rowHeight;
|
|
40
|
+
if (areAllRowsLoaded && index === rowsLength) {
|
|
41
|
+
const usedHeight = rowsLength * rowHeight;
|
|
31
42
|
const remainingHeight = height - usedHeight;
|
|
32
|
-
const minimumLastRowHeight = rowHeight * 2;
|
|
33
43
|
return Math.max(remainingHeight, minimumLastRowHeight);
|
|
34
44
|
}
|
|
35
45
|
return rowHeight;
|
|
36
|
-
}, [areAllRowsLoaded,
|
|
37
|
-
const
|
|
46
|
+
}, [areAllRowsLoaded, rowsLength, rowHeight, minimumLastRowHeight]);
|
|
47
|
+
const coreItemData = useMemo(() => {
|
|
38
48
|
var _a;
|
|
39
|
-
return
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
isError,
|
|
47
|
-
areAllRowsLoaded,
|
|
48
|
-
];
|
|
49
|
-
}, [isDelayedFetchingNextPage, rows, rowProps, scrollToIndex, footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount, isError, areAllRowsLoaded]);
|
|
50
|
-
const commonItemDataSuffix = useMemo(() => [selectedCell, selectedColumn, selectedRow, selectedChip, handleCellClick, handleChipClick], [selectedCell, selectedColumn, selectedRow, selectedChip, handleCellClick, handleChipClick]);
|
|
51
|
-
const getItemDataForContainer = useCallback((columnsData, isPinnedColumn, height) => createItemData(columnsData, ...commonItemDataParams, isPinnedColumn, ...commonItemDataSuffix, height, rowHeight), [commonItemDataParams, commonItemDataSuffix, rowHeight]);
|
|
49
|
+
return createCoreItemData(null, rows, rowProps, (_a = footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount) !== null && _a !== void 0 ? _a : 0, rows.length - 1, isError, areAllRowsLoaded, false, 0, rowHeight);
|
|
50
|
+
}, [rows, rowProps, footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount, isError, areAllRowsLoaded, rowHeight]);
|
|
51
|
+
const interactionData = useMemo(() => createInteractionData(selectedCell, selectedColumn, selectedRow, selectedChip, handleCellClick, handleChipClick), [selectedCell, selectedColumn, selectedRow, selectedChip, handleCellClick, handleChipClick]);
|
|
52
|
+
const getItemDataForContainer = useCallback((columnsData, isPinnedColumn, height) => {
|
|
53
|
+
const coreWithOverrides = Object.assign(Object.assign({}, coreItemData), { columns: columnsData, isPinned: isPinnedColumn, containerHeight: height });
|
|
54
|
+
return createItemData(coreWithOverrides, interactionData, scrollToIndex, isDelayedFetchingNextPage);
|
|
55
|
+
}, [coreItemData, interactionData, scrollToIndex, isDelayedFetchingNextPage]);
|
|
52
56
|
return {
|
|
53
57
|
getItemSize,
|
|
54
58
|
getItemDataForContainer,
|
|
@@ -22,6 +22,7 @@ export interface SheetViewTableHeaderProps {
|
|
|
22
22
|
tablePosition?: TablePosition;
|
|
23
23
|
hasPinnedStart?: boolean;
|
|
24
24
|
hasPinnedEnd?: boolean;
|
|
25
|
+
isLoading?: boolean;
|
|
25
26
|
}
|
|
26
27
|
export interface VirtualTableContainerProps {
|
|
27
28
|
columnsData: IColumnProps[];
|
|
@@ -51,7 +52,12 @@ export interface CommonTableProps {
|
|
|
51
52
|
showNoDataView: boolean;
|
|
52
53
|
tableBodyStyles?: CSSProperties;
|
|
53
54
|
}
|
|
54
|
-
export interface
|
|
55
|
+
export interface BaseCommonProps extends Omit<CommonTableProps, 'hasTimeoutError' | 'tableLoading'> {
|
|
56
|
+
}
|
|
57
|
+
export interface CommonPropsWithTableStates extends CommonTableProps {
|
|
58
|
+
tableLoading: boolean;
|
|
59
|
+
}
|
|
60
|
+
export interface PinnedColumnProps {
|
|
55
61
|
position: 'start' | 'end';
|
|
56
62
|
columnsData: IColumnProps[];
|
|
57
63
|
columnsWidth: number;
|
|
@@ -59,18 +65,18 @@ export interface PinnedColumnProps extends CommonTableProps {
|
|
|
59
65
|
hasPinnedStart: boolean;
|
|
60
66
|
hasPinnedEnd: boolean;
|
|
61
67
|
createVirtualTableContainer: (columnsData: IColumnProps[], containerKey: 'pinnedStart' | 'pinnedEnd' | 'scrollable', isPinned?: boolean, fixedWidth?: number) => JSX.Element;
|
|
62
|
-
|
|
68
|
+
commonProps: CommonPropsWithTableStates;
|
|
63
69
|
}
|
|
64
|
-
export interface MainTableProps
|
|
70
|
+
export interface MainTableProps {
|
|
65
71
|
hasPinnedStart: boolean;
|
|
66
72
|
hasPinnedEnd: boolean;
|
|
67
73
|
unpinnedColumnsData: IColumnProps[];
|
|
68
74
|
pinnedStartColumns: string[];
|
|
69
75
|
pinnedEndColumns: string[];
|
|
70
76
|
createVirtualTableContainer: (columnsData: IColumnProps[], containerKey: 'pinnedStart' | 'pinnedEnd' | 'scrollable', isPinned?: boolean, fixedWidth?: number) => JSX.Element;
|
|
71
|
-
|
|
77
|
+
commonProps: CommonPropsWithTableStates;
|
|
72
78
|
}
|
|
73
|
-
export interface NoDataViewProps
|
|
79
|
+
export interface NoDataViewProps {
|
|
74
80
|
tableLoading: boolean;
|
|
75
81
|
tableError: boolean;
|
|
76
82
|
tableEmpty: boolean;
|
|
@@ -79,12 +85,13 @@ export interface NoDataViewProps extends CommonTableProps {
|
|
|
79
85
|
error?: Error | null;
|
|
80
86
|
triggerDataRefetch?: () => Promise<unknown>;
|
|
81
87
|
footerProps?: TableFooterProps;
|
|
88
|
+
commonProps: BaseCommonProps;
|
|
82
89
|
}
|
|
83
|
-
export interface LoadingMainTableProps
|
|
90
|
+
export interface LoadingMainTableProps {
|
|
84
91
|
hasPinnedStart: boolean;
|
|
85
92
|
hasPinnedEnd: boolean;
|
|
86
93
|
unpinnedColumnsData: IColumnProps[];
|
|
87
94
|
pinnedStartColumns: string[];
|
|
88
95
|
pinnedEndColumns: string[];
|
|
89
|
-
|
|
96
|
+
commonProps: CommonPropsWithTableStates;
|
|
90
97
|
}
|
|
@@ -25,7 +25,7 @@ function ColumnFilter(filter) {
|
|
|
25
25
|
if (typeof value === 'string' || Array.isArray(value))
|
|
26
26
|
return value.length > 0;
|
|
27
27
|
return Boolean(value);
|
|
28
|
-
}) || listFilterData.length > 0, [filterData, listFilterData]);
|
|
28
|
+
}) || listFilterData.length > 0, [filterData, listFilterData, filter]);
|
|
29
29
|
const open = Boolean(anchorEl);
|
|
30
30
|
const filterApiKeys = useMemo(() => {
|
|
31
31
|
var _a;
|
|
@@ -6,23 +6,25 @@ import { areEqual } from 'react-window';
|
|
|
6
6
|
import { StyledCell, StyledTableRow } from './style';
|
|
7
7
|
import { getSelectionStyles, getRowSelectionBorderStyles } from '../../../utils/index.js';
|
|
8
8
|
function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = null, selectedColumn = null, selectedRow = null, selectedChip = null, onCellClick, isLastRow = false, onChipClick, }) {
|
|
9
|
-
const renderCell = (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const renderCell = useMemo(() => {
|
|
10
|
+
return (column, rowIndex, colIndex) => {
|
|
11
|
+
const { render, format, selector } = column;
|
|
12
|
+
const handleChipClick = (event, chipIndex) => {
|
|
13
|
+
onChipClick === null || onChipClick === void 0 ? void 0 : onChipClick(rowIndex, colIndex, event, chipIndex, column.pinned);
|
|
14
|
+
};
|
|
15
|
+
if (!(column === null || column === void 0 ? void 0 : column.id) || !row)
|
|
16
|
+
return null;
|
|
17
|
+
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];
|
|
18
|
+
const formattedValue = format ? format({ value, row, index }) : value;
|
|
19
|
+
return render ? (render({
|
|
20
|
+
row,
|
|
21
|
+
column,
|
|
22
|
+
index,
|
|
23
|
+
value: row[column === null || column === void 0 ? void 0 : column.id],
|
|
24
|
+
selectionProps: { onClick: handleChipClick, rowIndex, colIndex, selectedId: selectedChip },
|
|
25
|
+
})) : (_jsx(_Fragment, { children: formattedValue }));
|
|
13
26
|
};
|
|
14
|
-
|
|
15
|
-
return null;
|
|
16
|
-
const value = selector ? selector({ row, index, value: row[column === null || column === void 0 ? void 0 : column.id] }) : row[column === null || column === void 0 ? void 0 : column.id];
|
|
17
|
-
const formattedValue = format ? format({ value, row, index }) : value;
|
|
18
|
-
return render ? (render({
|
|
19
|
-
row,
|
|
20
|
-
column,
|
|
21
|
-
index,
|
|
22
|
-
value: row[column === null || column === void 0 ? void 0 : column.id],
|
|
23
|
-
selectionProps: { onClick: handleChipClick, rowIndex, colIndex, selectedId: selectedChip },
|
|
24
|
-
})) : (_jsx(_Fragment, { children: formattedValue }));
|
|
25
|
-
};
|
|
27
|
+
}, [row, index, selectedChip, onChipClick]);
|
|
26
28
|
const content = useMemo(() => (_jsx(_Fragment, { children: columns.map((column, colIndex) => {
|
|
27
29
|
var _a, _b;
|
|
28
30
|
const cellKey = `${(_a = column.pinned) !== null && _a !== void 0 ? _a : 'default'}-${index}-${colIndex}`;
|
|
@@ -48,7 +50,7 @@ function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = n
|
|
|
48
50
|
}
|
|
49
51
|
const rowSelectionBorderStyles = isRowSelected
|
|
50
52
|
? getRowSelectionBorderStyles({
|
|
51
|
-
|
|
53
|
+
isFirstColumn,
|
|
52
54
|
isPinnedStart: column.pinned === 'start',
|
|
53
55
|
isPinnedEnd: column.pinned === 'end',
|
|
54
56
|
})
|
|
@@ -57,7 +59,7 @@ function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = n
|
|
|
57
59
|
return (_jsx(StyledCell, Object.assign({ component: "div", "data-testid": "TableRow_TableCell", "data-column-id": column.id, "data-column-width": column.width, "data-column-width-used": column.width, "data-column-align": column.align, "data-column-order": column.order, "data-column-header": typeof column.header === 'string' ? column.header : 'component', "data-column-sortable": !!column.sortable, "data-column-filterable": !!column.filter, isFirst: effectiveFirst, isLast: effectiveLast, onClick: (event) => {
|
|
58
60
|
onCellClick === null || onCellClick === void 0 ? void 0 : onCellClick(index, colIndex, event, column.pinned);
|
|
59
61
|
}, sx: Object.assign(Object.assign(Object.assign({ width: column.width, minWidth: column.width, textAlign: column.align, justifyContent: isIndexColumn ? 'center' : column.align === 'right' ? 'flex-end' : 'flex-start', cursor: onCellClick ? 'pointer' : 'default' }, selectionStyles), rowSelectionBorderStyles), column.cellStyle), isSheetView: isSheetView, isSelected: isCellSelected }, { children: isSheetView ? (_jsx(Box, Object.assign({ sx: { position: 'relative', zIndex: 1 } }, { children: renderCell(column, index, colIndex) }))) : (_jsx(_Fragment, { children: renderCell(column, index, colIndex) })) }), `${column.id}-${colIndex}`));
|
|
60
|
-
}) })), [columns,
|
|
62
|
+
}) })), [columns, index, selectedCell, selectedColumn, selectedRow, onCellClick, isLastRow, isSheetView, renderCell]);
|
|
61
63
|
return (_createElement(StyledTableRow, Object.assign({ "data-testid": "TableRow", onClick: rowProps === null || rowProps === void 0 ? void 0 : rowProps.onRowClick, showShadowHighlight: rowProps === null || rowProps === void 0 ? void 0 : rowProps.showShadowHighlight, showLoadedStyle: rowProps === null || rowProps === void 0 ? void 0 : rowProps.showLoadedStyle, component: "article" }, rowProps, { key: index, isSheetView: isSheetView }), content));
|
|
62
64
|
}
|
|
63
65
|
export default memo(TableRow, areEqual);
|
|
@@ -66,9 +66,9 @@ function ListItemWrapper(_a) {
|
|
|
66
66
|
width: '100%',
|
|
67
67
|
} }, { children: isError ? _jsx(RowErrorState, {}) : lastRowContent })));
|
|
68
68
|
}, [isError]);
|
|
69
|
+
const isLastRow = React.useMemo(() => isLoadingRow || (areAllRowsLoaded && index === lastItemIndex + 1), [isLoadingRow, areAllRowsLoaded, index, lastItemIndex]);
|
|
69
70
|
const memoizedListItemComponent = React.useMemo(() => {
|
|
70
71
|
const lastRowContent = _jsx(LastRowContent, { isSheetView: isSheetView, isLoadingRow: isLoadingRow, columns: columns, currentRowCount: rows.length });
|
|
71
|
-
const isLastRow = isLoadingRow || (areAllRowsLoaded && index === lastItemIndex + 1);
|
|
72
72
|
if (isPinned && isLastRow) {
|
|
73
73
|
if (isSheetView && isLoadingRow && columns && columns.length > 0) {
|
|
74
74
|
return renderSheetViewLoadingRow(lastRowContent);
|
|
@@ -20,9 +20,9 @@ export declare const terminalsTableCellWidth: {
|
|
|
20
20
|
readonly sheet: "80px";
|
|
21
21
|
};
|
|
22
22
|
readonly platform: {
|
|
23
|
-
readonly default: "
|
|
24
|
-
readonly text: "
|
|
25
|
-
readonly sheet: "
|
|
23
|
+
readonly default: "80px";
|
|
24
|
+
readonly text: "80px";
|
|
25
|
+
readonly sheet: "80px";
|
|
26
26
|
};
|
|
27
27
|
readonly branding: {
|
|
28
28
|
readonly default: "80px";
|
|
@@ -3,6 +3,6 @@ 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_LIST_OVER_SCAN =
|
|
6
|
+
export declare const SHEET_VIEW_TABLE_LIST_OVER_SCAN = 20;
|
|
7
7
|
export declare const SHEET_VIEW_TABLE_THRESHOLD = 20;
|
|
8
8
|
export declare const SHEET_VIEW_TABLE_ROW_HEIGHT = 28;
|
package/build/constants/table.js
CHANGED
|
@@ -3,6 +3,6 @@ export const TABLE_CONTENT_ROW_HEIGHT = 70;
|
|
|
3
3
|
export const TABLE_ROW_HEIGHT = 57;
|
|
4
4
|
export const TABLE_THRESHOLD = 200;
|
|
5
5
|
export const TABLE_LIST_OVER_SCAN = 5;
|
|
6
|
-
export const SHEET_VIEW_TABLE_LIST_OVER_SCAN =
|
|
6
|
+
export const SHEET_VIEW_TABLE_LIST_OVER_SCAN = 20;
|
|
7
7
|
export const SHEET_VIEW_TABLE_THRESHOLD = 20;
|
|
8
8
|
export const SHEET_VIEW_TABLE_ROW_HEIGHT = 28;
|
package/build/types/entity.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { Merchant } from './merchant';
|
|
2
2
|
import { TextAndLang } from './user';
|
|
3
|
-
export interface Branch {
|
|
4
|
-
id: string;
|
|
5
|
-
name: TextAndLang[];
|
|
6
|
-
}
|
|
7
3
|
export interface Entity {
|
|
8
4
|
id: string;
|
|
9
5
|
legal_name: TextAndLang[];
|
|
@@ -11,7 +7,6 @@ export interface Entity {
|
|
|
11
7
|
created: number;
|
|
12
8
|
country?: string;
|
|
13
9
|
merchants?: Merchant[];
|
|
14
|
-
branches?: Branch;
|
|
15
10
|
}
|
|
16
11
|
type DataStatus = 'editable' | 'noneditable';
|
|
17
12
|
export interface EntityDetails {
|
package/build/utils/style.d.ts
CHANGED
|
@@ -14,9 +14,9 @@ interface GetSelectionStylesParams {
|
|
|
14
14
|
type SelectionStyles = Record<string, string | Record<string, string>>;
|
|
15
15
|
export declare const getSelectionStyles: ({ isSelected, isCellSelected, isColumnSelected, isRowSelected, isLastRow, }: GetSelectionStylesParams) => SelectionStyles;
|
|
16
16
|
interface GetRowSelectionBorderStylesParams {
|
|
17
|
-
|
|
17
|
+
isFirstColumn: boolean;
|
|
18
18
|
isPinnedStart: boolean;
|
|
19
19
|
isPinnedEnd: boolean;
|
|
20
20
|
}
|
|
21
|
-
export declare const getRowSelectionBorderStyles: ({
|
|
21
|
+
export declare const getRowSelectionBorderStyles: ({ isFirstColumn, isPinnedStart, isPinnedEnd }: GetRowSelectionBorderStylesParams) => SelectionStyles;
|
|
22
22
|
export {};
|
package/build/utils/style.js
CHANGED
|
@@ -59,9 +59,9 @@ const getBorderWidthForColumn = () => {
|
|
|
59
59
|
const getBorderBottomForColumn = (isLastRow) => {
|
|
60
60
|
return isLastRow ? `${BORDER_STYLES.thick} solid ${SELECTION_COLORS.primary}` : `${BORDER_STYLES.thin} solid ${SELECTION_COLORS.border}`;
|
|
61
61
|
};
|
|
62
|
-
export const getRowSelectionBorderStyles = ({
|
|
62
|
+
export const getRowSelectionBorderStyles = ({ isFirstColumn, isPinnedStart, isPinnedEnd }) => ({
|
|
63
63
|
borderTop: `${BORDER_STYLES.thin} solid ${SELECTION_COLORS.primary}`,
|
|
64
64
|
borderBottom: `${BORDER_STYLES.thin} solid ${SELECTION_COLORS.primary}`,
|
|
65
65
|
borderRight: `${BORDER_STYLES.thin} solid ${isPinnedEnd ? SELECTION_COLORS.primary : 'none'}`,
|
|
66
|
-
borderLeft: `${BORDER_STYLES.thin} solid ${isPinnedStart &&
|
|
66
|
+
borderLeft: `${BORDER_STYLES.thin} solid ${isPinnedStart && isFirstColumn ? SELECTION_COLORS.primary : 'transparent'}`,
|
|
67
67
|
});
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/os-micro-frontend-shared",
|
|
3
3
|
"description": "Shared components and utilities for Tap Payments micro frontends",
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.133-test.1",
|
|
5
|
+
"testVersion": 1,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|
|
@@ -136,4 +136,4 @@
|
|
|
136
136
|
"publishConfig": {
|
|
137
137
|
"registry": "https://registry.npmjs.org/"
|
|
138
138
|
}
|
|
139
|
-
}
|
|
139
|
+
}
|