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