@tap-payments/os-micro-frontend-shared 0.1.196-test.12 → 0.1.196-test.5-test.6
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/RadioGroup/RadioGroup.d.ts +1 -1
- package/build/components/RadioGroup/RadioGroup.js +6 -6
- package/build/components/RadioGroup/type.d.ts +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable.d.ts +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable.js +55 -9
- package/build/components/VirtualTables/SheetViewVirtualTable/components/MainTable.d.ts +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/components/MainTable.js +2 -2
- package/build/components/VirtualTables/SheetViewVirtualTable/components/PinnedColumn.d.ts +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/components/PinnedColumn.js +2 -2
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader.d.ts +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader.js +2 -2
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeaderCell.d.ts +4 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeaderCell.js +9 -8
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/components/ColumnResize.d.ts +5 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/components/ColumnResize.js +41 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/components/FloatingResizeIcon.d.ts +5 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/components/FloatingResizeIcon.js +9 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/components/ResizeIndicator.d.ts +5 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/components/ResizeIndicator.js +9 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/components/index.d.ts +3 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/components/index.js +3 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/hooks/index.d.ts +2 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/hooks/index.js +2 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/hooks/useColumnResize.d.ts +19 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/hooks/useColumnResize.js +212 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/hooks/useColumnResizeWithPinned.d.ts +65 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/hooks/useColumnResizeWithPinned.js +24 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/index.d.ts +3 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/index.js +3 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/styles.d.ts +21 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/styles.js +69 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/types/index.d.ts +34 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/types/index.js +1 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/types.d.ts +8 -0
- package/build/constants/assets.d.ts +1 -0
- package/build/constants/assets.js +1 -0
- package/build/utils/columnResizeStorage.d.ts +65 -0
- package/build/utils/columnResizeStorage.js +213 -0
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.js +1 -0
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Tap Payments
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Tap Payments
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# os-micro-frontend-shared
|
|
2
|
-
|
|
3
|
-
## Publishing Workflow
|
|
4
|
-
|
|
5
|
-
1. Update version in package.json
|
|
6
|
-
2. Commit changes
|
|
7
|
-
3. Create and push a tag:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm version patch # or minor, major
|
|
11
|
-
git push origin main --tags
|
|
12
|
-
```
|
|
1
|
+
# os-micro-frontend-shared
|
|
2
|
+
|
|
3
|
+
## Publishing Workflow
|
|
4
|
+
|
|
5
|
+
1. Update version in package.json
|
|
6
|
+
2. Commit changes
|
|
7
|
+
3. Create and push a tag:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm version patch # or minor, major
|
|
11
|
+
git push origin main --tags
|
|
12
|
+
```
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CustomRadioGroupProps } from './type';
|
|
3
|
-
declare function RadioGroup({ options, onOptionChange, size, customLabelRenderer, layout, spacing, labelPosition, showHoverEffects, customRadioProps, labelSx, onChange, sx,
|
|
3
|
+
declare function RadioGroup({ options, onOptionChange, size, customLabelRenderer, layout, spacing, labelPosition, showHoverEffects, customRadioProps, labelSx, onChange, sx, ...props }: CustomRadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare const _default: import("react").MemoExoticComponent<typeof RadioGroup>;
|
|
5
5
|
export default _default;
|
|
@@ -17,15 +17,15 @@ import { RadioButton } from '../RadioButton';
|
|
|
17
17
|
function RadioItem(_a) {
|
|
18
18
|
var { option, size = 'small', customLabelRenderer, labelPosition = 'end', showHoverEffects = true, customRadioProps, labelSx } = _a, props = __rest(_a, ["option", "size", "customLabelRenderer", "labelPosition", "showHoverEffects", "customRadioProps", "labelSx"]);
|
|
19
19
|
const label = customLabelRenderer ? customLabelRenderer(option) : option.label;
|
|
20
|
-
return (_jsx(StyledFormControlLabel, Object.assign({ control: _jsx(RadioButton, Object.assign({ size: size }, customRadioProps, option.customProps)), label: label, disabled: option.disabled, size: size, labelPlacement: labelPosition, showHoverEffects: showHoverEffects, labelSx: labelSx }, props)
|
|
20
|
+
return (_jsx(StyledFormControlLabel, Object.assign({ value: option.value, control: _jsx(RadioButton, Object.assign({ size: size }, customRadioProps, option.customProps)), label: label, disabled: option.disabled, size: size, labelPlacement: labelPosition, showHoverEffects: showHoverEffects, labelSx: labelSx }, props)));
|
|
21
21
|
}
|
|
22
22
|
function RadioGroup(_a) {
|
|
23
|
-
var { options, onOptionChange, size = 'small', customLabelRenderer, layout = 'vertical', spacing = 0, labelPosition = 'end', showHoverEffects = true, customRadioProps, labelSx, onChange, sx
|
|
23
|
+
var { options, onOptionChange, size = 'small', customLabelRenderer, layout = 'vertical', spacing = 0, labelPosition = 'end', showHoverEffects = true, customRadioProps, labelSx, onChange, sx } = _a, props = __rest(_a, ["options", "onOptionChange", "size", "customLabelRenderer", "layout", "spacing", "labelPosition", "showHoverEffects", "customRadioProps", "labelSx", "onChange", "sx"]);
|
|
24
24
|
const handleChange = (event) => {
|
|
25
|
-
const
|
|
26
|
-
onOptionChange === null || onOptionChange === void 0 ? void 0 : onOptionChange(
|
|
27
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(event,
|
|
25
|
+
const value = event.target.value;
|
|
26
|
+
onOptionChange === null || onOptionChange === void 0 ? void 0 : onOptionChange(value);
|
|
27
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event, value);
|
|
28
28
|
};
|
|
29
|
-
return (_jsx(MuiRadioGroup, Object.assign({ onChange: handleChange, sx: Object.assign({ display: 'flex', flexDirection: layout === 'horizontal' ? 'row' : 'column', gap: spacing }, sx)
|
|
29
|
+
return (_jsx(MuiRadioGroup, Object.assign({ onChange: handleChange, sx: Object.assign({ display: 'flex', flexDirection: layout === 'horizontal' ? 'row' : 'column', gap: spacing }, sx) }, props, { children: options.map((option) => (_jsx(RadioItem, { option: option, size: size, customLabelRenderer: customLabelRenderer, labelPosition: labelPosition, showHoverEffects: showHoverEffects, customRadioProps: customRadioProps, labelSx: labelSx }, option.value))) })));
|
|
30
30
|
}
|
|
31
31
|
export default memo(RadioGroup);
|
|
@@ -3,7 +3,7 @@ import { RadioGroupProps } from '@mui/material/RadioGroup';
|
|
|
3
3
|
import { FormControlLabelProps } from '@mui/material/FormControlLabel';
|
|
4
4
|
import { RadioButtonProps } from '../RadioButton/type';
|
|
5
5
|
export interface RadioOption {
|
|
6
|
-
value: string
|
|
6
|
+
value: string;
|
|
7
7
|
label: string;
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
description?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ISheetViewVirtualTable } from './types';
|
|
3
|
-
declare function SheetViewVirtualTable({ columns, rows, threshold, showHeader, headerProps, rowProps, footerProps, rowHeight, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded, tableBodyStyles, tableTitle, onStartDrag, onColumnPin, clearBackdropVisibilityTimeout, isPinnable, tableMode, overscanCount, }: Readonly<ISheetViewVirtualTable>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function SheetViewVirtualTable({ columns, rows, threshold, showHeader, headerProps, rowProps, footerProps, rowHeight, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded, tableBodyStyles, tableTitle, onStartDrag, onColumnPin, clearBackdropVisibilityTimeout, isPinnable, tableMode, overscanCount, windowId, serviceCode, }: Readonly<ISheetViewVirtualTable>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare const _default: import("react").MemoExoticComponent<typeof SheetViewVirtualTable>;
|
|
5
5
|
export default _default;
|
|
@@ -1,14 +1,19 @@
|
|
|
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, useRef, useState, useEffect } 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
|
|
7
|
+
import { usePinnedColumns, useSynchronizedScroll, useTableState, useTableData, useVirtualTableContainer } from './hooks';
|
|
8
|
+
import { useColumnResize, useColumnResizeWithPinned, applyColumnWidths } from './features/resize';
|
|
9
|
+
import { ResizeIndicator, FloatingResizeIcon } from './features/resize/components';
|
|
8
10
|
import { PinnedColumn, MainTable, LoadingMainTable, NoDataView, VirtualTable } from './components';
|
|
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, onStartDrag, onColumnPin, clearBackdropVisibilityTimeout = 100, isPinnable = false, tableMode, overscanCount, }) {
|
|
11
|
+
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, onStartDrag, onColumnPin, clearBackdropVisibilityTimeout = 100, isPinnable = false, tableMode, overscanCount, windowId, serviceCode, }) {
|
|
10
12
|
// Custom hooks for state management
|
|
11
13
|
const { selectedCell, selectedColumn, selectedRow, showBackDrop, setShowBackdrop, handleCellClick, handleColumnClick, handleChipClick, selectedChip, } = useTableState();
|
|
14
|
+
// Refs and state for resize indicator positioning
|
|
15
|
+
const tableContainerRef = useRef(null);
|
|
16
|
+
const [tableDimensions, setTableDimensions] = useState({ top: 0, height: 0 });
|
|
12
17
|
// Table data processing
|
|
13
18
|
const { isError, tableLoading, tableError, tableEmpty, hasTimeoutError, showNoDataView, lastItemIndex, areTotalRowsNotFillingHeight, itemsCount, isDelayedFetchingNextPage, } = useTableData({
|
|
14
19
|
rows,
|
|
@@ -21,8 +26,24 @@ function SheetViewVirtualTable({ columns, rows, threshold = SHEET_VIEW_TABLE_THR
|
|
|
21
26
|
const { pinnedStartColumns, pinnedEndColumns, handleColumnPin, pinnedStartColumnsData, pinnedEndColumnsData, unpinnedColumnsData, orderedColumns, lastColumnId, } = usePinnedColumns(columns, isPinnable, onColumnPin);
|
|
22
27
|
// Scroll synchronization
|
|
23
28
|
const { pinnedStartVirtualListRef, scrollableVirtualListRef, pinnedEndVirtualListRef, handleScroll } = useSynchronizedScroll();
|
|
24
|
-
// Column
|
|
25
|
-
const {
|
|
29
|
+
// Column resize functionality
|
|
30
|
+
const { columnWidths, isResizing, resizingColumn, resizeIndicatorX, cursorPosition, startResize, handleColumnClick: handleColumnClickWithResize, } = useColumnResize({
|
|
31
|
+
columns,
|
|
32
|
+
onColumnResize: (columnId, newWidth) => {
|
|
33
|
+
console.log(`Column ${columnId} resized to ${newWidth}px`);
|
|
34
|
+
},
|
|
35
|
+
handleColumnClick,
|
|
36
|
+
windowId,
|
|
37
|
+
serviceCode,
|
|
38
|
+
});
|
|
39
|
+
// Column width calculations with dynamic resize support
|
|
40
|
+
const { pinnedStartColumnsWidth, pinnedEndColumnsWidth, pinnedStartColumnsDataWithWidths, pinnedEndColumnsDataWithWidths } = useColumnResizeWithPinned({
|
|
41
|
+
pinnedStartColumnsData,
|
|
42
|
+
pinnedEndColumnsData,
|
|
43
|
+
columnWidths,
|
|
44
|
+
});
|
|
45
|
+
// Apply dynamic widths to unpinned columns
|
|
46
|
+
const unpinnedColumnsDataWithWidths = useMemo(() => applyColumnWidths(unpinnedColumnsData, columnWidths), [unpinnedColumnsData, columnWidths]);
|
|
26
47
|
// Virtual table container logic
|
|
27
48
|
const { getItemSize, getItemDataForContainer } = useVirtualTableContainer({
|
|
28
49
|
rowHeight,
|
|
@@ -66,6 +87,7 @@ function SheetViewVirtualTable({ columns, rows, threshold = SHEET_VIEW_TABLE_THR
|
|
|
66
87
|
pinnedStartVirtualListRef,
|
|
67
88
|
pinnedEndVirtualListRef,
|
|
68
89
|
scrollableVirtualListRef,
|
|
90
|
+
overscanCount,
|
|
69
91
|
]);
|
|
70
92
|
const baseCommonProps = {
|
|
71
93
|
showHeader,
|
|
@@ -77,7 +99,7 @@ function SheetViewVirtualTable({ columns, rows, threshold = SHEET_VIEW_TABLE_THR
|
|
|
77
99
|
isPinnable,
|
|
78
100
|
lastColumnId,
|
|
79
101
|
selectedColumn,
|
|
80
|
-
onColumnClick:
|
|
102
|
+
onColumnClick: handleColumnClickWithResize,
|
|
81
103
|
tableTitle,
|
|
82
104
|
areAllRowsLoaded,
|
|
83
105
|
isFetchingNextPage,
|
|
@@ -87,13 +109,37 @@ function SheetViewVirtualTable({ columns, rows, threshold = SHEET_VIEW_TABLE_THR
|
|
|
87
109
|
tableMode,
|
|
88
110
|
showNoDataView,
|
|
89
111
|
tableBodyStyles,
|
|
112
|
+
onStartResize: startResize,
|
|
113
|
+
isResizing,
|
|
114
|
+
resizingColumn,
|
|
90
115
|
};
|
|
91
116
|
const commonPropsWithTableStates = Object.assign(Object.assign({}, baseCommonProps), { hasTimeoutError,
|
|
92
117
|
tableLoading });
|
|
93
|
-
|
|
118
|
+
// Calculate table dimensions for resize indicator positioning
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
const updateTableDimensions = () => {
|
|
121
|
+
if (tableContainerRef.current) {
|
|
122
|
+
const rect = tableContainerRef.current.getBoundingClientRect();
|
|
123
|
+
const headerHeight = showHeader ? 28 : 0; // Header height is 28px
|
|
124
|
+
setTableDimensions({
|
|
125
|
+
top: rect.top + headerHeight,
|
|
126
|
+
height: rect.height - headerHeight,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
// Update dimensions on mount and when resizing starts
|
|
131
|
+
updateTableDimensions();
|
|
132
|
+
if (isResizing) {
|
|
133
|
+
// Update dimensions during resize to handle window resizing
|
|
134
|
+
const handleResize = () => updateTableDimensions();
|
|
135
|
+
window.addEventListener('resize', handleResize);
|
|
136
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
137
|
+
}
|
|
138
|
+
}, [isResizing, showHeader]);
|
|
139
|
+
return (_jsxs(_Fragment, { children: [_jsx(SheetViewTableContainer, Object.assign({ ref: tableContainerRef }, { children: showNoDataView ? (tableLoading ? (
|
|
94
140
|
// Show same table structure with pinned columns during loading, but with skeleton rows
|
|
95
|
-
_jsxs(SheetViewVirtualTableWrapper, { children: [
|
|
141
|
+
_jsxs(SheetViewVirtualTableWrapper, { children: [pinnedStartColumnsDataWithWidths.length > 0 && (_jsx(PinnedColumn, Object.assign({ position: "start", columnsData: pinnedStartColumnsDataWithWidths, columnsWidth: pinnedStartColumnsWidth, pinnedColumnsList: pinnedStartColumns, hasPinnedStart: pinnedStartColumnsDataWithWidths.length > 0, hasPinnedEnd: pinnedEndColumnsDataWithWidths.length > 0, createVirtualTableContainer: createVirtualTableContainer }, commonPropsWithTableStates))), _jsx(LoadingMainTable, Object.assign({ hasPinnedStart: pinnedStartColumnsDataWithWidths.length > 0, hasPinnedEnd: pinnedEndColumnsDataWithWidths.length > 0, unpinnedColumnsData: unpinnedColumnsDataWithWidths, pinnedStartColumns: pinnedStartColumns, pinnedEndColumns: pinnedEndColumns }, commonPropsWithTableStates)), pinnedEndColumnsDataWithWidths.length > 0 && (_jsx(PinnedColumn, Object.assign({ position: "end", columnsData: pinnedEndColumnsDataWithWidths, columnsWidth: pinnedEndColumnsWidth, pinnedColumnsList: [...pinnedStartColumns, ...pinnedEndColumns], hasPinnedStart: pinnedStartColumnsDataWithWidths.length > 0, hasPinnedEnd: pinnedEndColumnsDataWithWidths.length > 0, createVirtualTableContainer: createVirtualTableContainer }, commonPropsWithTableStates)))] })) : (
|
|
96
142
|
// Non-loading error states
|
|
97
|
-
_jsx(NoDataView, Object.assign({ tableLoading: tableLoading, tableError: tableError, tableEmpty: tableEmpty, hasTimeoutError: hasTimeoutError, orderedColumns: orderedColumns, error: error, triggerDataRefetch: triggerDataRefetch, footerProps: footerProps }, baseCommonProps)))) : (_jsxs(SheetViewVirtualTableWrapper, { children: [
|
|
143
|
+
_jsx(NoDataView, Object.assign({ tableLoading: tableLoading, tableError: tableError, tableEmpty: tableEmpty, hasTimeoutError: hasTimeoutError, orderedColumns: orderedColumns, error: error, triggerDataRefetch: triggerDataRefetch, footerProps: footerProps }, baseCommonProps)))) : (_jsxs(SheetViewVirtualTableWrapper, { children: [pinnedStartColumnsDataWithWidths.length > 0 && (_jsx(PinnedColumn, Object.assign({ position: "start", columnsData: pinnedStartColumnsDataWithWidths, columnsWidth: pinnedStartColumnsWidth, pinnedColumnsList: pinnedStartColumns, hasPinnedStart: pinnedStartColumnsDataWithWidths.length > 0, hasPinnedEnd: pinnedEndColumnsDataWithWidths.length > 0, createVirtualTableContainer: createVirtualTableContainer }, commonPropsWithTableStates))), _jsx(MainTable, Object.assign({ hasPinnedStart: pinnedStartColumnsDataWithWidths.length > 0, hasPinnedEnd: pinnedEndColumnsDataWithWidths.length > 0, unpinnedColumnsData: unpinnedColumnsDataWithWidths, pinnedStartColumns: pinnedStartColumns, pinnedEndColumns: pinnedEndColumns, createVirtualTableContainer: createVirtualTableContainer }, commonPropsWithTableStates)), pinnedEndColumnsDataWithWidths.length > 0 && (_jsx(PinnedColumn, Object.assign({ position: "end", columnsData: pinnedEndColumnsDataWithWidths, columnsWidth: pinnedEndColumnsWidth, pinnedColumnsList: [...pinnedStartColumns, ...pinnedEndColumns], hasPinnedStart: pinnedStartColumnsDataWithWidths.length > 0, hasPinnedEnd: pinnedEndColumnsDataWithWidths.length > 0, createVirtualTableContainer: createVirtualTableContainer }, commonPropsWithTableStates)))] })) })), _jsx(TableFooter, Object.assign({ "data-testid": "SheetViewVirtualTable_TableFooter", showSeparator: true, showBackDrop: showBackDrop, onPointerDown: onPointerDown }, footerProps)), _jsx(ResizeIndicator, { isVisible: isResizing, x: resizeIndicatorX, height: tableDimensions.height, top: tableDimensions.top }), _jsx(FloatingResizeIcon, { isVisible: isResizing, x: cursorPosition.x, y: cursorPosition.y })] }));
|
|
98
144
|
}
|
|
99
145
|
export default memo(SheetViewVirtualTable);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { MainTableProps } from '../types';
|
|
3
|
-
declare function MainTable({ hasPinnedStart, hasPinnedEnd, unpinnedColumnsData, showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, pinnedStartColumns, pinnedEndColumns, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, hasTimeoutError, tableMode, showNoDataView, tableBodyStyles, tableLoading, createVirtualTableContainer, }: MainTableProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function MainTable({ hasPinnedStart, hasPinnedEnd, unpinnedColumnsData, showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, pinnedStartColumns, pinnedEndColumns, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, hasTimeoutError, tableMode, showNoDataView, tableBodyStyles, tableLoading, createVirtualTableContainer, onStartResize, isResizing, resizingColumn, }: MainTableProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare const _default: import("react").MemoExoticComponent<typeof MainTable>;
|
|
5
5
|
export default _default;
|
|
@@ -5,9 +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, showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, pinnedStartColumns, pinnedEndColumns, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, hasTimeoutError, tableMode, showNoDataView, tableBodyStyles, tableLoading, createVirtualTableContainer, }) {
|
|
8
|
+
function MainTable({ hasPinnedStart, hasPinnedEnd, unpinnedColumnsData, showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, pinnedStartColumns, pinnedEndColumns, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, hasTimeoutError, tableMode, showNoDataView, tableBodyStyles, tableLoading, createVirtualTableContainer, onStartResize, isResizing, resizingColumn, }) {
|
|
9
9
|
const theme = useTheme();
|
|
10
|
-
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: {
|
|
10
|
+
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, onStartResize: onStartResize, isResizing: isResizing, resizingColumn: resizingColumn }) })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
|
11
11
|
width: '100%',
|
|
12
12
|
minWidth: 'fit-content',
|
|
13
13
|
} }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_ScrollableStyledBox", hidePadding: true, className: "list-wrapper", sx: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { PinnedColumnProps } from '../types';
|
|
3
|
-
declare function PinnedColumn({ position, columnsData, columnsWidth, pinnedColumnsList, showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, hasPinnedStart, hasPinnedEnd, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, hasTimeoutError, tableMode, showNoDataView, tableLoading, createVirtualTableContainer, }: PinnedColumnProps): import("react/jsx-runtime").JSX.Element | null;
|
|
3
|
+
declare function PinnedColumn({ position, columnsData, columnsWidth, pinnedColumnsList, showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, hasPinnedStart, hasPinnedEnd, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, hasTimeoutError, tableMode, showNoDataView, tableLoading, createVirtualTableContainer, onStartResize, isResizing, resizingColumn, }: PinnedColumnProps): import("react/jsx-runtime").JSX.Element | null;
|
|
4
4
|
declare const _default: import("react").MemoExoticComponent<typeof PinnedColumn>;
|
|
5
5
|
export default _default;
|
|
@@ -5,13 +5,13 @@ 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, showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, hasPinnedStart, hasPinnedEnd, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, hasTimeoutError, tableMode, showNoDataView, tableLoading, createVirtualTableContainer, }) {
|
|
8
|
+
function PinnedColumn({ position, columnsData, columnsWidth, pinnedColumnsList, showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, hasPinnedStart, hasPinnedEnd, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, hasTimeoutError, tableMode, showNoDataView, tableLoading, createVirtualTableContainer, onStartResize, isResizing, resizingColumn, }) {
|
|
9
9
|
const theme = useTheme();
|
|
10
10
|
if (columnsData.length === 0)
|
|
11
11
|
return null;
|
|
12
12
|
const Wrapper = position === 'start' ? PinnedStartColumnWrapper : PinnedEndColumnWrapper;
|
|
13
13
|
const containerKey = position === 'start' ? 'pinnedStart' : 'pinnedEnd';
|
|
14
|
-
return (_jsx(Wrapper, { children: _jsxs(StyledTableBox, Object.assign({ as: "main", id: "sheet-table-box-container", "aria-labelledby": "sheet-table-box-container", "data-testid": "SheetViewVirtualTable_StyledTableBox", "data-title": tableTitle, "data-direction": theme.direction, "data-are-all-rows-loaded": !!areAllRowsLoaded, "data-is-fetching-next-page": !!isFetchingNextPage, "data-scroll-to-index": scrollToIndex, "data-is-loading": !!isLoading, "data-is-error": !!isError, "data-is-error-timeout": !!hasTimeoutError, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showNoDataView: showNoDataView }, { children: [showHeader && (_jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_PinnedTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: columnsData, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: pinnedColumnsList, onColumnPin: onColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: onColumnClick, tablePosition: position === 'start' ? 'pinnedStart' : 'pinnedEnd', hasPinnedStart: hasPinnedStart, hasPinnedEnd: hasPinnedEnd })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
|
14
|
+
return (_jsx(Wrapper, { children: _jsxs(StyledTableBox, Object.assign({ as: "main", id: "sheet-table-box-container", "aria-labelledby": "sheet-table-box-container", "data-testid": "SheetViewVirtualTable_StyledTableBox", "data-title": tableTitle, "data-direction": theme.direction, "data-are-all-rows-loaded": !!areAllRowsLoaded, "data-is-fetching-next-page": !!isFetchingNextPage, "data-scroll-to-index": scrollToIndex, "data-is-loading": !!isLoading, "data-is-error": !!isError, "data-is-error-timeout": !!hasTimeoutError, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showNoDataView: showNoDataView }, { children: [showHeader && (_jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_PinnedTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: columnsData, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: pinnedColumnsList, onColumnPin: onColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: onColumnClick, tablePosition: position === 'start' ? 'pinnedStart' : 'pinnedEnd', hasPinnedStart: hasPinnedStart, hasPinnedEnd: hasPinnedEnd, onStartResize: onStartResize, isResizing: isResizing, resizingColumn: resizingColumn })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
|
15
15
|
width: '100%',
|
|
16
16
|
minWidth: 'fit-content',
|
|
17
17
|
overflowX: 'hidden',
|
package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SheetViewTableHeaderProps } from '../types';
|
|
3
|
-
declare function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, }: SheetViewTableHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, onStartResize, isResizing, resizingColumn, }: SheetViewTableHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare const _default: import("react").MemoExoticComponent<typeof SheetViewTableHeader>;
|
|
5
5
|
export default _default;
|
package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader.js
CHANGED
|
@@ -2,11 +2,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { memo } from 'react';
|
|
3
3
|
import { StyledHeader, StyledMUITableRow } from '../style';
|
|
4
4
|
import SheetViewTableHeaderCell from './SheetViewTableHeaderCell';
|
|
5
|
-
function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns = [], onColumnPin, isPinnable = false, lastColumnId, selectedColumn = null, onColumnClick, }) {
|
|
5
|
+
function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns = [], onColumnPin, isPinnable = false, lastColumnId, selectedColumn = null, onColumnClick, onStartResize, isResizing = false, resizingColumn = null, }) {
|
|
6
6
|
return (_jsx(StyledHeader, Object.assign({ component: "nav", "data-testid": "SheetViewVirtualTable_TableHeader_StyledHeader", showBackDrop: showBackDrop }, headerProps, { children: _jsx(StyledMUITableRow, Object.assign({ component: "section", "data-testid": "SheetViewVirtualTable_TableHeader_StyledMUITableRow" }, { children: columns.map((column, colIndex) => {
|
|
7
7
|
var _a;
|
|
8
8
|
const columnKey = `${(_a = column.pinned) !== null && _a !== void 0 ? _a : 'default'}-${colIndex}`;
|
|
9
|
-
return (_jsx(SheetViewTableHeaderCell, { column: column, colIndex: colIndex, isFirst: column.id === columns[0].id, isLast: column.id === columns[columns.length - 1].id, isDefaultPinned: !!column.isDefaultPinned, isSelected: selectedColumn === columnKey, onColumnSort: onColumnSort, columnsSorting: columnsSorting, pinnedColumns: pinnedColumns, onColumnPin: onColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, onColumnClick: onColumnClick }, `${column.id}-${colIndex}`));
|
|
9
|
+
return (_jsx(SheetViewTableHeaderCell, { column: column, colIndex: colIndex, isFirst: column.id === columns[0].id, isLast: column.id === columns[columns.length - 1].id, isDefaultPinned: !!column.isDefaultPinned, isSelected: selectedColumn === columnKey, onColumnSort: onColumnSort, columnsSorting: columnsSorting, pinnedColumns: pinnedColumns, onColumnPin: onColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, onColumnClick: onColumnClick, onStartResize: onStartResize, isResizing: isResizing, resizingColumn: resizingColumn }, `${column.id}-${colIndex}`));
|
|
10
10
|
}) })) })));
|
|
11
11
|
}
|
|
12
12
|
export default memo(SheetViewTableHeader);
|
|
@@ -8,7 +8,10 @@ interface SheetViewTableHeaderCellProps extends Pick<SheetViewTableHeaderProps,
|
|
|
8
8
|
isLast: boolean;
|
|
9
9
|
isSelected: boolean;
|
|
10
10
|
isDefaultPinned: boolean;
|
|
11
|
+
onStartResize?: (e: React.MouseEvent, columnId: string) => void;
|
|
12
|
+
isResizing?: boolean;
|
|
13
|
+
resizingColumn?: string | null;
|
|
11
14
|
}
|
|
12
|
-
declare function SheetViewTableHeaderCell({ column: { header, id, align, headerStyle, sortable, filter, pinnable, width, order, pinned }, colIndex, isFirst, isLast, isSelected, isDefaultPinned, onColumnSort, columnsSorting, onColumnPin, isPinnable, lastColumnId, onColumnClick, pinnedColumns, }: SheetViewTableHeaderCellProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
declare function SheetViewTableHeaderCell({ column: { header, id, align, headerStyle, sortable, filter, pinnable, width, order, pinned }, colIndex, isFirst, isLast, isSelected, isDefaultPinned, onColumnSort, columnsSorting, onColumnPin, isPinnable, lastColumnId, onColumnClick, pinnedColumns, onStartResize, isResizing, resizingColumn, }: SheetViewTableHeaderCellProps): import("react/jsx-runtime").JSX.Element;
|
|
13
16
|
declare const _default: import("react").MemoExoticComponent<typeof SheetViewTableHeaderCell>;
|
|
14
17
|
export default _default;
|
package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeaderCell.js
CHANGED
|
@@ -6,7 +6,8 @@ import ColumnFilter from '../../components/ColumnFilter';
|
|
|
6
6
|
import { StyledCell, TableHeaderInner } from '../../components/style';
|
|
7
7
|
import { PinIconContainer, HeaderText } from '../style';
|
|
8
8
|
import ColumnSort from '../../components/ColumnSort';
|
|
9
|
-
|
|
9
|
+
import { ColumnResize } from '../features/resize';
|
|
10
|
+
function SheetViewTableHeaderCell({ column: { header, id, align, headerStyle, sortable, filter, pinnable, width, order, pinned }, colIndex, isFirst, isLast, isSelected, isDefaultPinned, onColumnSort, columnsSorting, onColumnPin, isPinnable, lastColumnId, onColumnClick, pinnedColumns, onStartResize, isResizing = false, resizingColumn = null, }) {
|
|
10
11
|
const [columnFilterEl, setColumnFilterEl] = useState(null);
|
|
11
12
|
const cellRef = useRef(null);
|
|
12
13
|
const checkIsPanned = useCallback((columnId) => pinnedColumns === null || pinnedColumns === void 0 ? void 0 : pinnedColumns.includes(columnId), [pinnedColumns]);
|
|
@@ -38,7 +39,7 @@ function SheetViewTableHeaderCell({ column: { header, id, align, headerStyle, so
|
|
|
38
39
|
event.stopPropagation();
|
|
39
40
|
onOpenFilterDropdown();
|
|
40
41
|
};
|
|
41
|
-
return (
|
|
42
|
+
return (_jsxs(StyledCell, Object.assign({ "data-id": id, component: "div", "data-testid": "SheetViewVirtualTable_TableHeader_StyledCell", "data-column-id": id, "data-column-width": width, "data-column-width-used": width, "data-column-align": align, "data-column-order": order, "data-column-header": typeof header === 'string' ? header : 'component', "data-column-sortable": !!sortable, "data-column-filterable": !!filter, "data-column-pinned": isPinned, isFirst: isFirst, isLast: isLast, isSheetView: true, ref: cellRef, onClick: handleCellClick, sx: (theme) => (Object.assign({ display: 'flex', gap: theme.spacing(0.5), alignItems: 'center', justifyContent: align === 'right' ? 'flex-end' : 'flex-start', width, textAlign: align, overflow: 'unset', cursor: 'pointer', boxSizing: 'border-box', border: '0.5px solid transparent', borderColor: isSelected ? '#1F88D0' : '#F2F2F2', borderBottom: isSelected ? '0.5px solid transparent' : '0.5px solid #F2F2F2', backgroundColor: isSelected ? '#F2F2F2' : '#FCFCFC', minHeight: '28px', position: 'relative', '&:before': {
|
|
42
43
|
content: '""',
|
|
43
44
|
borderBottom: 'none',
|
|
44
45
|
position: 'absolute',
|
|
@@ -46,11 +47,11 @@ function SheetViewTableHeaderCell({ column: { header, id, align, headerStyle, so
|
|
|
46
47
|
right: 0,
|
|
47
48
|
left: 0,
|
|
48
49
|
bottom: 0,
|
|
49
|
-
} }, headerStyle)) }, { children: _jsxs(TableHeaderInner, Object.assign({ onClick: handleHeaderInnerClick }, { children: [typeof header === 'function' ? (header()) : (_jsx(Box, Object.assign({ "data-testid": "SheetViewTableHeader_columns_header", sx: { maxWidth: '100%', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, { children: header && _jsx(HeaderText, Object.assign({ "data-testid": "SheetViewVirtualTable_TableHeader_StyledCell_header_text" }, { children: header })) }))), filter && _jsx(ColumnFilter, Object.assign({}, filter, { anchorEl: columnFilterEl, setAnchorEl: setColumnFilterEl })), sortable && (_jsx(ColumnSort, { columnId: id, onColumnSort: onColumnSort, columnsSorting: columnsSorting, onClick: (e) => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
} }, headerStyle)) }, { children: [_jsxs(TableHeaderInner, Object.assign({ onClick: handleHeaderInnerClick }, { children: [typeof header === 'function' ? (header()) : (_jsx(Box, Object.assign({ "data-testid": "SheetViewTableHeader_columns_header", sx: { maxWidth: '100%', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, { children: header && _jsx(HeaderText, Object.assign({ "data-testid": "SheetViewVirtualTable_TableHeader_StyledCell_header_text" }, { children: header })) }))), filter && _jsx(ColumnFilter, Object.assign({}, filter, { anchorEl: columnFilterEl, setAnchorEl: setColumnFilterEl })), sortable && (_jsx(ColumnSort, { columnId: id, onColumnSort: onColumnSort, columnsSorting: columnsSorting, onClick: (e) => {
|
|
51
|
+
onColumnClick === null || onColumnClick === void 0 ? void 0 : onColumnClick(colIndex, e, pinned);
|
|
52
|
+
} })), isPinnable && pinnable && !isDefaultPinned && !isLast && (_jsx(PinIconContainer, Object.assign({ onClick: (event) => {
|
|
53
|
+
event.stopPropagation();
|
|
54
|
+
handlePinClick(id);
|
|
55
|
+
}, title: isPinned ? 'Unpin column' : 'Pin column' }, { children: _jsx("img", { src: isPinned ? unpinIcon : pinIcon, alt: "pin-icon" }) })))] })), onStartResize && pinned !== 'end' && (_jsx(ColumnResize, { columnId: id, onStartResize: onStartResize, isResizing: isResizing && resizingColumn === id, isLast: isLast }))] })));
|
|
55
56
|
}
|
|
56
57
|
export default memo(SheetViewTableHeaderCell);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ColumnResizeProps } from '../types';
|
|
3
|
+
declare function ColumnResize({ columnId, onStartResize, isResizing, isLast }: ColumnResizeProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare const _default: import("react").MemoExoticComponent<typeof ColumnResize>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useState, useCallback, useRef } from 'react';
|
|
3
|
+
import { StyledResizeIcon, HoverResizeIcon } from '../styles';
|
|
4
|
+
function ColumnResize({ columnId, onStartResize, isResizing, isLast = false }) {
|
|
5
|
+
const [isHovering, setIsHovering] = useState(false);
|
|
6
|
+
const [hoverPosition, setHoverPosition] = useState({ x: 0, y: 0 });
|
|
7
|
+
const resizeHandleRef = useRef(null);
|
|
8
|
+
const updateHoverPosition = useCallback((e) => {
|
|
9
|
+
var _a;
|
|
10
|
+
const rect = (_a = resizeHandleRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
11
|
+
if (rect) {
|
|
12
|
+
// Position icon at the center of the resize handle
|
|
13
|
+
setHoverPosition({
|
|
14
|
+
x: rect.right + 2,
|
|
15
|
+
y: rect.top + rect.height / 2,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}, []);
|
|
19
|
+
const handleMouseEnter = useCallback((e) => {
|
|
20
|
+
if (!isResizing) {
|
|
21
|
+
setIsHovering(true);
|
|
22
|
+
updateHoverPosition(e);
|
|
23
|
+
}
|
|
24
|
+
}, [isResizing, updateHoverPosition]);
|
|
25
|
+
const handleMouseMove = useCallback((e) => {
|
|
26
|
+
if (!isResizing && isHovering) {
|
|
27
|
+
updateHoverPosition(e);
|
|
28
|
+
}
|
|
29
|
+
}, [isResizing, isHovering, updateHoverPosition]);
|
|
30
|
+
const handleMouseLeave = useCallback(() => {
|
|
31
|
+
setIsHovering(false);
|
|
32
|
+
}, []);
|
|
33
|
+
const handleMouseDown = (e) => {
|
|
34
|
+
e.stopPropagation();
|
|
35
|
+
e.preventDefault();
|
|
36
|
+
setIsHovering(false); // Hide hover icon when starting resize
|
|
37
|
+
onStartResize(e, columnId);
|
|
38
|
+
};
|
|
39
|
+
return (_jsxs(_Fragment, { children: [_jsx(StyledResizeIcon, { ref: resizeHandleRef, isResizing: isResizing, isLast: isLast, onMouseDown: handleMouseDown, onMouseEnter: handleMouseEnter, onMouseMove: handleMouseMove, onMouseLeave: handleMouseLeave, "data-testid": `column-resize-handle-${columnId}` }), _jsx(HoverResizeIcon, { isVisible: isHovering && !isResizing, x: hoverPosition.x, y: hoverPosition.y })] }));
|
|
40
|
+
}
|
|
41
|
+
export default memo(ColumnResize);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { FloatingResizeIconProps } from '../types';
|
|
3
|
+
declare function FloatingResizeIconComponent({ isVisible, x, y }: FloatingResizeIconProps): import("react/jsx-runtime").JSX.Element | null;
|
|
4
|
+
declare const _default: import("react").MemoExoticComponent<typeof FloatingResizeIconComponent>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { FloatingResizeIcon } from '../styles';
|
|
4
|
+
function FloatingResizeIconComponent({ isVisible, x, y }) {
|
|
5
|
+
if (!isVisible)
|
|
6
|
+
return null;
|
|
7
|
+
return _jsx(FloatingResizeIcon, { isVisible: isVisible, x: x, y: y, "data-testid": "floating-resize-icon" });
|
|
8
|
+
}
|
|
9
|
+
export default memo(FloatingResizeIconComponent);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ResizeIndicatorProps } from '../types';
|
|
3
|
+
declare function ResizeIndicator({ isVisible, x, height, top }: ResizeIndicatorProps): import("react/jsx-runtime").JSX.Element | null;
|
|
4
|
+
declare const _default: import("react").MemoExoticComponent<typeof ResizeIndicator>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { IndicatorLine } from '../styles';
|
|
4
|
+
function ResizeIndicator({ isVisible, x, height, top = 0 }) {
|
|
5
|
+
if (!isVisible)
|
|
6
|
+
return null;
|
|
7
|
+
return _jsx(IndicatorLine, { isVisible: isVisible, x: x, height: height, top: top, "data-testid": "column-resize-indicator" });
|
|
8
|
+
}
|
|
9
|
+
export default memo(ResizeIndicator);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { UseColumnResizeProps } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Enhanced column resize hook with robust error handling and performance optimizations
|
|
4
|
+
*/
|
|
5
|
+
export declare const useColumnResize: ({ columns, onColumnResize, handleColumnClick, windowId, serviceCode }: UseColumnResizeProps) => {
|
|
6
|
+
columnWidths: Record<string, number>;
|
|
7
|
+
isResizing: boolean;
|
|
8
|
+
resizingColumn: string | null;
|
|
9
|
+
resizeIndicatorX: number;
|
|
10
|
+
cursorPosition: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
};
|
|
14
|
+
getColumnWidth: (columnId: string) => number;
|
|
15
|
+
startResize: (e: React.MouseEvent, columnId: string) => void;
|
|
16
|
+
stopResize: () => void;
|
|
17
|
+
isCurrentlyResizing: () => boolean;
|
|
18
|
+
handleColumnClick: (columnIndex: number, event: React.MouseEvent, pinnedType?: 'start' | 'end') => void;
|
|
19
|
+
};
|