@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/package.json
CHANGED
package/src/components/Grid.tsx
CHANGED
|
@@ -591,6 +591,7 @@ export const Grid = <TData extends GridBaseRow = GridBaseRow>({
|
|
|
591
591
|
});
|
|
592
592
|
}, []);
|
|
593
593
|
|
|
594
|
+
const gridElementRef = useRef<Element>();
|
|
594
595
|
const onRowDragMove = useCallback(
|
|
595
596
|
(event: RowDragMoveEvent) => {
|
|
596
597
|
if (startDragYRef.current === null) {
|
|
@@ -601,7 +602,16 @@ export const Grid = <TData extends GridBaseRow = GridBaseRow>({
|
|
|
601
602
|
const data = event.overNode?.data;
|
|
602
603
|
if (data) {
|
|
603
604
|
clearHighlightRowClasses();
|
|
604
|
-
|
|
605
|
+
// Find the grid element, this can only be found on start drag.
|
|
606
|
+
// Once dragging is no progress the event target is the drag element not the start drag column.
|
|
607
|
+
const targetEl = event.event.target as Element | undefined;
|
|
608
|
+
if (targetEl) {
|
|
609
|
+
const gridElement = targetEl.closest('.ag-body');
|
|
610
|
+
if (gridElement) {
|
|
611
|
+
gridElementRef.current = gridElement;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
gridElementRef.current?.querySelectorAll(`[row-id='${data.id}']`)?.forEach((el) => {
|
|
605
615
|
el.classList.add(yDiff < 0 ? 'ag-row-highlight-above' : 'ag-row-highlight-below');
|
|
606
616
|
});
|
|
607
617
|
}
|
|
@@ -612,6 +622,7 @@ export const Grid = <TData extends GridBaseRow = GridBaseRow>({
|
|
|
612
622
|
const onRowDragEnd = useCallback(
|
|
613
623
|
(event: RowDragEndEvent<TData>) => {
|
|
614
624
|
clearHighlightRowClasses();
|
|
625
|
+
gridElementRef.current = undefined;
|
|
615
626
|
if (!params.onRowDragEnd || startDragYRef.current === null) {
|
|
616
627
|
return;
|
|
617
628
|
}
|