@tap-payments/os-micro-frontend-shared 0.1.215 → 0.1.217
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/build/components/InputBase/SelectBase/SelectBase.js +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/hooks/useColumnResize.js +5 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/styles.js +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/utils/resize.d.ts +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/utils/resize.js +16 -3
- package/build/constants/assets.d.ts +1 -0
- package/build/constants/assets.js +1 -0
- package/package.json +1 -1
|
@@ -32,7 +32,7 @@ function SelectBase(_a, ref) {
|
|
|
32
32
|
(options === null || options === void 0 ? void 0 : options.map((option, idx) => {
|
|
33
33
|
var _a;
|
|
34
34
|
const isSelected = isOptionEqualToValue ? isOptionEqualToValue(option, value) : (option === null || option === void 0 ? void 0 : option.id) === (value === null || value === void 0 ? void 0 : value.id);
|
|
35
|
-
return (_jsx(MenuItem, Object.assign({ value: (_a = (getOptionValue ? getOptionValue(option) : option === null || option === void 0 ? void 0 : option.id)) !== null && _a !== void 0 ? _a : '', onClick: () => {
|
|
35
|
+
return (_jsx(MenuItem, Object.assign({ disabled: !!option.disabled, value: (_a = (getOptionValue ? getOptionValue(option) : option === null || option === void 0 ? void 0 : option.id)) !== null && _a !== void 0 ? _a : '', onClick: () => {
|
|
36
36
|
handleChange(option);
|
|
37
37
|
}, sx: {
|
|
38
38
|
fontSize: '12px',
|
|
@@ -36,6 +36,8 @@ export const useColumnResize = ({ columns, onColumnResize, handleColumnClick, wi
|
|
|
36
36
|
const isResizingRef = useRef(false);
|
|
37
37
|
const initialCursorYRef = useRef(0);
|
|
38
38
|
const clampedXRef = useRef(0);
|
|
39
|
+
const startXRef = useRef(0);
|
|
40
|
+
const startWidthRef = useRef(0);
|
|
39
41
|
const mouseMoveRef = useRef();
|
|
40
42
|
const mouseUpRef = useRef();
|
|
41
43
|
useEffect(() => {
|
|
@@ -64,7 +66,7 @@ export const useColumnResize = ({ columns, onColumnResize, handleColumnClick, wi
|
|
|
64
66
|
return createResizeEndHandler(windowId, serviceCode, onColumnResize, setResizeState, cleanupEventListeners, isResizingRef, clampedXRef)(columnId, currentWidth, startX);
|
|
65
67
|
}, [windowId, serviceCode, onColumnResize, cleanupEventListeners]);
|
|
66
68
|
const createMouseMoveHandlerCallback = useCallback((columnIndex, columnPinned) => {
|
|
67
|
-
return createMouseMoveHandler(setResizeState, setCursorPosition, initialCursorYRef, tableContainerRef, columnIndex, columnPinned, clampedXRef);
|
|
69
|
+
return createMouseMoveHandler(setResizeState, setCursorPosition, initialCursorYRef, tableContainerRef, columnIndex, columnPinned, clampedXRef, startXRef, startWidthRef);
|
|
68
70
|
}, [tableContainerRef]);
|
|
69
71
|
const startResize = useCallback((e, columnId) => {
|
|
70
72
|
e.preventDefault();
|
|
@@ -89,6 +91,8 @@ export const useColumnResize = ({ columns, onColumnResize, handleColumnClick, wi
|
|
|
89
91
|
setResizeState((prev) => (Object.assign(Object.assign({}, prev), { isResizing: true, resizingColumn: columnId, startX, startWidth: currentWidth, resizeIndicatorX: startX, resizingColumnIndex: columnIndex, resizingColumnPinned: columnPinned })));
|
|
90
92
|
initialCursorYRef.current = iconY;
|
|
91
93
|
clampedXRef.current = startX;
|
|
94
|
+
startXRef.current = startX;
|
|
95
|
+
startWidthRef.current = currentWidth;
|
|
92
96
|
setCursorPosition({ x: startX, y: iconY });
|
|
93
97
|
isResizingRef.current = true;
|
|
94
98
|
// Create and store event handlers
|
package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/utils/resize.d.ts
CHANGED
|
@@ -13,6 +13,6 @@ export declare const createMouseUpHandler: (columnId: string, currentWidth: numb
|
|
|
13
13
|
export declare const createMouseMoveHandler: (setResizeState: React.Dispatch<React.SetStateAction<ColumnResizeState>>, setCursorPosition: React.Dispatch<React.SetStateAction<{
|
|
14
14
|
x: number;
|
|
15
15
|
y: number;
|
|
16
|
-
}>>, initialCursorYRef: React.MutableRefObject<number>, tableContainerRef?: React.RefObject<HTMLDivElement>, resizingColumnIndex?: number, resizingColumnPinned?: 'start' | 'end', clampedXRef?: React.MutableRefObject<number>) => (mouseEvent: MouseEvent) => void;
|
|
16
|
+
}>>, initialCursorYRef: React.MutableRefObject<number>, tableContainerRef?: React.RefObject<HTMLDivElement>, resizingColumnIndex?: number, resizingColumnPinned?: 'start' | 'end', clampedXRef?: React.MutableRefObject<number>, startXRef?: React.MutableRefObject<number>, startWidthRef?: React.MutableRefObject<number>) => (mouseEvent: MouseEvent) => void;
|
|
17
17
|
export declare const getColumnWidthFromState: (columnWidths: Record<string, number>, columnId: string) => number;
|
|
18
18
|
export declare const createResizeEndHandler: (windowId: string | undefined, serviceCode: string | undefined, onColumnResize: ((columnId: string, width: number) => void) | undefined, setResizeState: React.Dispatch<React.SetStateAction<ColumnResizeState>>, cleanupFn: () => void, isResizingRef: React.MutableRefObject<boolean>, clampedXRef: React.MutableRefObject<number>) => (columnId: string, currentWidth: number, startX: number) => (event: MouseEvent) => void;
|
package/build/components/VirtualTables/SheetViewVirtualTable/features/resize/utils/resize.js
CHANGED
|
@@ -66,7 +66,7 @@ export const createMouseUpHandler = (columnId, currentWidth, startX, windowId, s
|
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
};
|
|
69
|
-
export const createMouseMoveHandler = (setResizeState, setCursorPosition, initialCursorYRef, tableContainerRef, resizingColumnIndex, resizingColumnPinned, clampedXRef) => {
|
|
69
|
+
export const createMouseMoveHandler = (setResizeState, setCursorPosition, initialCursorYRef, tableContainerRef, resizingColumnIndex, resizingColumnPinned, clampedXRef, startXRef, startWidthRef) => {
|
|
70
70
|
return (mouseEvent) => {
|
|
71
71
|
try {
|
|
72
72
|
let clampedX = mouseEvent.clientX;
|
|
@@ -85,9 +85,22 @@ export const createMouseMoveHandler = (setResizeState, setCursorPosition, initia
|
|
|
85
85
|
if (clampedXRef) {
|
|
86
86
|
clampedXRef.current = clampedX;
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
// Calculate the indicator position capped at minimum column width
|
|
89
|
+
let indicatorX = clampedX;
|
|
90
|
+
if (startXRef && startWidthRef) {
|
|
91
|
+
// Calculate the minimum position: start position minus how much we can shrink
|
|
92
|
+
// The left edge of the column is at (startX - startWidth)
|
|
93
|
+
// The minimum right edge position is at (leftEdge + MIN_WIDTH)
|
|
94
|
+
const minPositionX = startXRef.current - startWidthRef.current + COLUMN_WIDTH_CONSTRAINTS.MIN_WIDTH;
|
|
95
|
+
// Cap the indicator at the minimum position when dragging left past minimum
|
|
96
|
+
// This ensures smooth behavior: indicator only moves when cursor is to the right of minimum position
|
|
97
|
+
if (clampedX < minPositionX) {
|
|
98
|
+
indicatorX = minPositionX;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
setResizeState((prev) => (Object.assign(Object.assign({}, prev), { resizeIndicatorX: indicatorX })));
|
|
89
102
|
setCursorPosition({
|
|
90
|
-
x:
|
|
103
|
+
x: indicatorX,
|
|
91
104
|
y: initialCursorYRef.current,
|
|
92
105
|
});
|
|
93
106
|
}
|
|
@@ -562,3 +562,4 @@ export const exclamationOutlinedOrangeCircle = `${lightUrl}/exclamationOutlinedO
|
|
|
562
562
|
export const activeGreenIcon = `${lightUrl}/activeGreenIcon.svg`;
|
|
563
563
|
export const inActiveGreyIcon = `${lightUrl}/inActiveGreyIcon.svg`;
|
|
564
564
|
export const terminalLinkVideo = `${videosUrl}/terminal_link.mp4`;
|
|
565
|
+
export const bluePlusIcon = `${lightUrl}/bluePlusIcon.svg`;
|
package/package.json
CHANGED