@linzjs/step-ag-grid 17.5.1 → 17.5.2

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
@@ -2,7 +2,7 @@
2
2
  "name": "@linzjs/step-ag-grid",
3
3
  "repository": "github:linz/step-ag-grid.git",
4
4
  "license": "MIT",
5
- "version": "17.5.1",
5
+ "version": "17.5.2",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -611,8 +611,19 @@ export const Grid = ({
611
611
  }, []);
612
612
 
613
613
  const onRowDragMove = useCallback((event: RowDragMoveEvent) => {
614
- const clientSideRowModel = event.api.getModel() as IClientSideRowModel;
615
- clientSideRowModel.highlightRowAtPixel(event.node as RowNode<any>, event.y);
614
+ if (event.overNode && event.node.rowIndex != null) {
615
+ const clientSideRowModel = event.api.getModel() as IClientSideRowModel;
616
+
617
+ //position 0 means highlight above, 1 means below
618
+ const position = clientSideRowModel.getHighlightPosition(event.y, event.overNode as RowNode<any>);
619
+
620
+ //we don't want to show the row highlight if it wouldn't result in the row moving
621
+ const targetIndex = event.overIndex + position - (event.node.rowIndex < event.overIndex ? 1 : 0);
622
+ //console.log(targetIndex)
623
+ if (event.node.rowIndex != targetIndex) {
624
+ clientSideRowModel.highlightRowAtPixel(event.node as RowNode<any>, event.y);
625
+ }
626
+ }
616
627
  }, []);
617
628
 
618
629
  const onRowDragEnd = useCallback(
@@ -201,9 +201,13 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
201
201
  background-color: transparent;
202
202
  }
203
203
 
204
- .ag-row-highlight-above::after{
204
+ .ag-row-highlight-above::after {
205
+ top:-3px; // moves the top highlight to the position of the bottom highlight
205
206
  border-top: 2px dashed lui.$andrea;
206
-
207
+ }
208
+
209
+ .ag-row-highlight-above:first-of-type::after {
210
+ top:0px; // the first row highlight needs to in the normal position otherwise it is cut off by the top of the table
207
211
  }
208
212
 
209
213
  .ag-row-highlight-below::after {