@linzjs/step-ag-grid 17.5.0 → 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.0",
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(
@@ -194,4 +194,23 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
194
194
  .ag-cell-wrapper {
195
195
  width: 100%;
196
196
  }
197
+
198
+ .ag-row-highlight-above::after, .ag-row-highlight-below::after {
199
+ content: '';
200
+ height: 2px;
201
+ background-color: transparent;
202
+ }
203
+
204
+ .ag-row-highlight-above::after {
205
+ top:-3px; // moves the top highlight to the position of the bottom highlight
206
+ border-top: 2px dashed lui.$andrea;
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
211
+ }
212
+
213
+ .ag-row-highlight-below::after {
214
+ border-bottom: 2px dashed lui.$andrea;
215
+ }
197
216
  }