@linzjs/step-ag-grid 26.0.0 → 26.0.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/dist/step-ag-grid.esm.js
CHANGED
|
@@ -3136,6 +3136,7 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
|
|
|
3136
3136
|
el.classList.remove('ag-row-highlight-below');
|
|
3137
3137
|
});
|
|
3138
3138
|
}, []);
|
|
3139
|
+
const gridElementRef = useRef();
|
|
3139
3140
|
const onRowDragMove = useCallback((event) => {
|
|
3140
3141
|
if (startDragYRef.current === null) {
|
|
3141
3142
|
startDragYRef.current = event.y;
|
|
@@ -3144,13 +3145,23 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
|
|
|
3144
3145
|
const data = event.overNode?.data;
|
|
3145
3146
|
if (data) {
|
|
3146
3147
|
clearHighlightRowClasses();
|
|
3147
|
-
|
|
3148
|
+
// Find the grid element, this can only be found on start drag.
|
|
3149
|
+
// Once dragging is no progress the event target is the drag element not the start drag column.
|
|
3150
|
+
const targetEl = event.event.target;
|
|
3151
|
+
if (targetEl) {
|
|
3152
|
+
const gridElement = targetEl.closest('.ag-body');
|
|
3153
|
+
if (gridElement) {
|
|
3154
|
+
gridElementRef.current = gridElement;
|
|
3155
|
+
}
|
|
3156
|
+
}
|
|
3157
|
+
gridElementRef.current?.querySelectorAll(`[row-id='${data.id}']`)?.forEach((el) => {
|
|
3148
3158
|
el.classList.add(yDiff < 0 ? 'ag-row-highlight-above' : 'ag-row-highlight-below');
|
|
3149
3159
|
});
|
|
3150
3160
|
}
|
|
3151
3161
|
}, [clearHighlightRowClasses]);
|
|
3152
3162
|
const onRowDragEnd = useCallback((event) => {
|
|
3153
3163
|
clearHighlightRowClasses();
|
|
3164
|
+
gridElementRef.current = undefined;
|
|
3154
3165
|
if (!params.onRowDragEnd || startDragYRef.current === null) {
|
|
3155
3166
|
return;
|
|
3156
3167
|
}
|