@linzjs/step-ag-grid 26.0.0 → 26.1.0
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/step-ag-grid.esm.js
CHANGED
|
@@ -3136,6 +3136,7 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
|
|
|
3136
3136
|
el.classList.remove('ag-row-highlight-below');
|
|
3137
3137
|
});
|
|
3138
3138
|
}, []);
|
|
3139
|
+
const gridElementRef = useRef();
|
|
3139
3140
|
const onRowDragMove = useCallback((event) => {
|
|
3140
3141
|
if (startDragYRef.current === null) {
|
|
3141
3142
|
startDragYRef.current = event.y;
|
|
@@ -3144,13 +3145,23 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
|
|
|
3144
3145
|
const data = event.overNode?.data;
|
|
3145
3146
|
if (data) {
|
|
3146
3147
|
clearHighlightRowClasses();
|
|
3147
|
-
|
|
3148
|
+
// Find the grid element, this can only be found on start drag.
|
|
3149
|
+
// Once dragging is no progress the event target is the drag element not the start drag column.
|
|
3150
|
+
const targetEl = event.event.target;
|
|
3151
|
+
if (targetEl) {
|
|
3152
|
+
const gridElement = targetEl.closest('.ag-body');
|
|
3153
|
+
if (gridElement) {
|
|
3154
|
+
gridElementRef.current = gridElement;
|
|
3155
|
+
}
|
|
3156
|
+
}
|
|
3157
|
+
gridElementRef.current?.querySelectorAll(`[row-id='${data.id}']`)?.forEach((el) => {
|
|
3148
3158
|
el.classList.add(yDiff < 0 ? 'ag-row-highlight-above' : 'ag-row-highlight-below');
|
|
3149
3159
|
});
|
|
3150
3160
|
}
|
|
3151
3161
|
}, [clearHighlightRowClasses]);
|
|
3152
3162
|
const onRowDragEnd = useCallback((event) => {
|
|
3153
3163
|
clearHighlightRowClasses();
|
|
3164
|
+
gridElementRef.current = undefined;
|
|
3154
3165
|
if (!params.onRowDragEnd || startDragYRef.current === null) {
|
|
3155
3166
|
return;
|
|
3156
3167
|
}
|
|
@@ -3167,6 +3178,7 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
|
|
|
3167
3178
|
}, [params, clearHighlightRowClasses]);
|
|
3168
3179
|
// This is setting a ref in the GridContext so won't be triggering an update loop
|
|
3169
3180
|
setOnCellEditingComplete(params.onCellEditingComplete);
|
|
3181
|
+
const selectWidth = params.hideSelectColumn ? 0 : selectable && params.onRowDragEnd ? 76 : 48;
|
|
3170
3182
|
const headerRowCount = columnDefs.some((c) => c.children) ? 2 : 1;
|
|
3171
3183
|
return (jsxs("div", { "data-testid": dataTestId, className: clsx('Grid-container', theme, 'theme-specific', staleGrid && 'Grid-sortIsStale', gridReady && rowData && autoSized && 'Grid-ready'), children: [gridContextMenu.component, jsx("div", { style: { flex: 1 }, ref: gridDivRef, children: jsx(AgGridReact, { theme: 'legacy', rowSelection: selectable
|
|
3172
3184
|
? {
|
|
@@ -3178,9 +3190,10 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
|
|
|
3178
3190
|
event.api.forEachNode(() => rowCount++);
|
|
3179
3191
|
return (jsx(GridNoRowsOverlay, { loading: !rowData || params.loading === true, rowCount: rowCount, headerRowHeight: headerRowCount * rowHeight, filteredRowCount: event.api.getDisplayedRowCount(), noRowsOverlayText: params.noRowsOverlayText, noRowsMatchingOverlayText: params.noRowsMatchingOverlayText }));
|
|
3180
3192
|
}, onModelUpdated: onModelUpdated, onGridReady: onGridReady, onSortChanged: ensureSelectedRowIsVisible, postSortRows: params.onRowDragEnd || !defaultPostSort ? undefined : postSortRows, onSelectionChanged: synchroniseExternalStateToGridSelection, onColumnMoved: params.onColumnMoved, alwaysShowVerticalScroll: params.alwaysShowVerticalScroll, isExternalFilterPresent: isExternalFilterPresent, doesExternalFilterPass: doesExternalFilterPass, maintainColumnOrder: true, preventDefaultOnContextMenu: true, onCellContextMenu: gridContextMenu.cellContextMenu, rowDragText: params.rowDragText, onRowDragCancel: clearHighlightRowClasses, onRowDragMove: onRowDragMove, onRowDragEnd: onRowDragEnd, suppressCellFocus: params.suppressCellFocus, pinnedTopRowData: params.pinnedTopRowData, pinnedBottomRowData: params.pinnedBottomRowData, selectionColumnDef: {
|
|
3193
|
+
suppressNavigable: params.hideSelectColumn,
|
|
3181
3194
|
rowDrag: !!params.onRowDragEnd,
|
|
3182
|
-
minWidth:
|
|
3183
|
-
maxWidth:
|
|
3195
|
+
minWidth: selectWidth,
|
|
3196
|
+
maxWidth: selectWidth,
|
|
3184
3197
|
pinned: selectColumnPinned,
|
|
3185
3198
|
headerComponentParams: {
|
|
3186
3199
|
exportable: false,
|