@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.
|
@@ -13,6 +13,7 @@ export interface GridProps<TData extends GridBaseRow = GridBaseRow> {
|
|
|
13
13
|
readOnly?: boolean;
|
|
14
14
|
defaultPostSort?: boolean;
|
|
15
15
|
selectable?: boolean;
|
|
16
|
+
hideSelectColumn?: boolean;
|
|
16
17
|
theme?: string;
|
|
17
18
|
['data-testid']?: string;
|
|
18
19
|
domLayout?: GridOptions['domLayout'];
|
package/dist/step-ag-grid.cjs
CHANGED
|
@@ -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
|
-
|
|
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
|
}
|
|
@@ -3169,6 +3180,7 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
|
|
|
3169
3180
|
}, [params, clearHighlightRowClasses]);
|
|
3170
3181
|
// This is setting a ref in the GridContext so won't be triggering an update loop
|
|
3171
3182
|
setOnCellEditingComplete(params.onCellEditingComplete);
|
|
3183
|
+
const selectWidth = params.hideSelectColumn ? 0 : selectable && params.onRowDragEnd ? 76 : 48;
|
|
3172
3184
|
const headerRowCount = columnDefs.some((c) => c.children) ? 2 : 1;
|
|
3173
3185
|
return (jsxRuntime.jsxs("div", { "data-testid": dataTestId, className: clsx('Grid-container', theme, 'theme-specific', staleGrid && 'Grid-sortIsStale', gridReady && rowData && autoSized && 'Grid-ready'), children: [gridContextMenu.component, jsxRuntime.jsx("div", { style: { flex: 1 }, ref: gridDivRef, children: jsxRuntime.jsx(agGridReact.AgGridReact, { theme: 'legacy', rowSelection: selectable
|
|
3174
3186
|
? {
|
|
@@ -3180,9 +3192,10 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
|
|
|
3180
3192
|
event.api.forEachNode(() => rowCount++);
|
|
3181
3193
|
return (jsxRuntime.jsx(GridNoRowsOverlay, { loading: !rowData || params.loading === true, rowCount: rowCount, headerRowHeight: headerRowCount * rowHeight, filteredRowCount: event.api.getDisplayedRowCount(), noRowsOverlayText: params.noRowsOverlayText, noRowsMatchingOverlayText: params.noRowsMatchingOverlayText }));
|
|
3182
3194
|
}, 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: {
|
|
3195
|
+
suppressNavigable: params.hideSelectColumn,
|
|
3183
3196
|
rowDrag: !!params.onRowDragEnd,
|
|
3184
|
-
minWidth:
|
|
3185
|
-
maxWidth:
|
|
3197
|
+
minWidth: selectWidth,
|
|
3198
|
+
maxWidth: selectWidth,
|
|
3186
3199
|
pinned: selectColumnPinned,
|
|
3187
3200
|
headerComponentParams: {
|
|
3188
3201
|
exportable: false,
|