@linzjs/step-ag-grid 17.4.1 → 17.4.3
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/GridTheme.scss +1 -5
- package/dist/src/components/Grid.d.ts +1 -1
- package/dist/step-ag-grid.cjs.js +30 -9
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +30 -9
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Grid.tsx +45 -13
- package/src/stories/grid/GridDragRow.stories.tsx +2 -1
- package/src/styles/GridTheme.scss +1 -5
package/dist/GridTheme.scss
CHANGED
|
@@ -50,11 +50,6 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
|
|
|
50
50
|
|
|
51
51
|
.ag-cell[col-id="selection"] {
|
|
52
52
|
display: flex;// Fix that when you click below checkbox it doesn't process a click
|
|
53
|
-
justify-content: end; // fix alignment of cell content when grabber is present
|
|
54
|
-
|
|
55
|
-
.ag-selection-checkbox {
|
|
56
|
-
margin-right:0;
|
|
57
|
-
}
|
|
58
53
|
}
|
|
59
54
|
|
|
60
55
|
// fix alignment of cell content when grabber is present
|
|
@@ -92,6 +87,7 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
|
|
|
92
87
|
|
|
93
88
|
.ag-header .ag-header-cell[aria-colindex="1"] {
|
|
94
89
|
padding-left: 17px;
|
|
90
|
+
padding-right: 15px;
|
|
95
91
|
}
|
|
96
92
|
|
|
97
93
|
.ag-cell[role="gridcell"] {
|
|
@@ -28,7 +28,7 @@ export interface GridProps {
|
|
|
28
28
|
autoSelectFirstRow?: boolean;
|
|
29
29
|
onColumnMoved?: GridOptions["onColumnMoved"];
|
|
30
30
|
rowDragText?: GridOptions["rowDragText"];
|
|
31
|
-
onRowDragEnd?: (movedRow: any, targetRow: any, targetIndex: number) => void
|
|
31
|
+
onRowDragEnd?: (movedRow: any, targetRow: any, targetIndex: number) => Promise<void>;
|
|
32
32
|
alwaysShowVerticalScroll?: boolean;
|
|
33
33
|
suppressColumnVirtualization?: GridOptions["suppressColumnVirtualisation"];
|
|
34
34
|
/**
|
package/dist/step-ag-grid.cjs.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var lui = require('@linzjs/lui');
|
|
5
|
+
var agGridCommunity = require('ag-grid-community');
|
|
5
6
|
var agGridReact = require('ag-grid-react');
|
|
6
7
|
var lodashEs = require('lodash-es');
|
|
7
8
|
var React = require('react');
|
|
@@ -2544,7 +2545,6 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
|
|
|
2544
2545
|
},
|
|
2545
2546
|
checkboxSelection: params.selectable,
|
|
2546
2547
|
headerComponent: rowSelection === "multiple" ? GridHeaderSelect : null,
|
|
2547
|
-
//headerCheckboxSelection:true,
|
|
2548
2548
|
suppressHeaderKeyboardEvent: (e) => {
|
|
2549
2549
|
if (!params.selectable)
|
|
2550
2550
|
return false;
|
|
@@ -2760,13 +2760,34 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
|
|
|
2760
2760
|
}
|
|
2761
2761
|
}, []);
|
|
2762
2762
|
const gridContextMenu = useGridContextMenu({ contextMenu: params.contextMenu, contextMenuSelectRow });
|
|
2763
|
-
const
|
|
2764
|
-
const
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2763
|
+
const onRowDragLeave = React.useCallback((event) => {
|
|
2764
|
+
const clientSideRowModel = event.api.getModel();
|
|
2765
|
+
clientSideRowModel.highlightRowAtPixel(null);
|
|
2766
|
+
}, []);
|
|
2767
|
+
const onRowDragMove = React.useCallback((event) => {
|
|
2768
|
+
const clientSideRowModel = event.api.getModel();
|
|
2769
|
+
clientSideRowModel.highlightRowAtPixel(event.node, event.y);
|
|
2770
|
+
}, []);
|
|
2771
|
+
const onRowDragEnd = React.useCallback(async (event) => {
|
|
2772
|
+
const clientSideRowModel = event.api.getModel();
|
|
2773
|
+
if (event.node.rowIndex) {
|
|
2774
|
+
const lastHighlightedRowNode = clientSideRowModel.getLastHighlightedRowNode();
|
|
2775
|
+
const isBelow = lastHighlightedRowNode && lastHighlightedRowNode.highlighted === agGridCommunity.RowHighlightPosition.Below;
|
|
2776
|
+
let targetIndex = event.overIndex;
|
|
2777
|
+
if (event.node.rowIndex > event.overIndex) {
|
|
2778
|
+
targetIndex += isBelow ? 1 : 0;
|
|
2779
|
+
}
|
|
2780
|
+
else {
|
|
2781
|
+
targetIndex += isBelow ? 0 : -1;
|
|
2782
|
+
}
|
|
2783
|
+
const moved = event.node.data;
|
|
2784
|
+
const target = event.overNode?.data;
|
|
2785
|
+
moved.id != target.id && //moved over a different row
|
|
2786
|
+
moved.rowIndex != targetIndex && //moved to a different index
|
|
2787
|
+
params.onRowDragEnd &&
|
|
2788
|
+
(await params.onRowDragEnd(moved, target, targetIndex));
|
|
2789
|
+
}
|
|
2790
|
+
clientSideRowModel.highlightRowAtPixel(null);
|
|
2770
2791
|
}, [params]);
|
|
2771
2792
|
// This is setting a ref in the GridContext so won't be triggering an update loop
|
|
2772
2793
|
setOnCellEditingComplete(params.onCellEditingComplete);
|
|
@@ -2776,7 +2797,7 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
|
|
|
2776
2797
|
let rowCount = 0;
|
|
2777
2798
|
event.api.forEachNode(() => rowCount++);
|
|
2778
2799
|
return (jsxRuntime.jsx(GridNoRowsOverlay, { rowCount: rowCount, filteredRowCount: event.api.getDisplayedRowCount(), noRowsOverlayText: params.noRowsOverlayText }));
|
|
2779
|
-
}, onModelUpdated: onModelUpdated, onGridReady: onGridReady, onSortChanged: ensureSelectedRowIsVisible, postSortRows: params.onRowDragEnd ? undefined : postSortRows, onSelectionChanged: synchroniseExternalStateToGridSelection, onColumnMoved: params.onColumnMoved, alwaysShowVerticalScroll: params.alwaysShowVerticalScroll, isExternalFilterPresent: isExternalFilterPresent, doesExternalFilterPass: doesExternalFilterPass, maintainColumnOrder: true, preventDefaultOnContextMenu: true, onCellContextMenu: gridContextMenu.cellContextMenu, rowDragText: params.rowDragText,
|
|
2800
|
+
}, onModelUpdated: onModelUpdated, onGridReady: onGridReady, onSortChanged: ensureSelectedRowIsVisible, postSortRows: params.onRowDragEnd ? undefined : postSortRows, onSelectionChanged: synchroniseExternalStateToGridSelection, onColumnMoved: params.onColumnMoved, alwaysShowVerticalScroll: params.alwaysShowVerticalScroll, isExternalFilterPresent: isExternalFilterPresent, doesExternalFilterPass: doesExternalFilterPass, maintainColumnOrder: true, preventDefaultOnContextMenu: true, onCellContextMenu: gridContextMenu.cellContextMenu, rowDragText: params.rowDragText, onRowDragMove: onRowDragMove, onRowDragEnd: onRowDragEnd, onRowDragLeave: onRowDragLeave }) })] }));
|
|
2780
2801
|
};
|
|
2781
2802
|
|
|
2782
2803
|
const GridPopoverContext = React.createContext({
|