@linzjs/step-ag-grid 14.4.0 → 14.5.1

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": "14.4.0",
5
+ "version": "14.5.1",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -97,8 +97,8 @@ export const Grid = ({
97
97
  setOnCellEditingComplete,
98
98
  getColDef,
99
99
  } = useContext(GridContext);
100
- const { updatedDep, updatingCols } = useContext(GridUpdatingContext);
101
- const gridContext = useContext(GridContext);
100
+ const { checkUpdating, updatedDep, updatingCols } = useContext(GridUpdatingContext);
101
+ const { prePopupOps } = useContext(GridContext);
102
102
 
103
103
  const gridDivRef = useRef<HTMLDivElement>(null);
104
104
 
@@ -387,13 +387,23 @@ export const Grid = ({
387
387
  */
388
388
  const startCellEditing = useCallback(
389
389
  (event: CellEvent) => {
390
- event.data.id &&
391
- gridContext.startCellEditing({
392
- rowId: event.data.id,
393
- colId: event.column.getColId(),
390
+ prePopupOps();
391
+ if (!event.node.isSelected()) {
392
+ event.node.setSelected(true, true);
393
+ }
394
+ // Cell already being edited, so don't re-edit until finished
395
+ if (checkUpdating([event.colDef.field ?? ""], event.data.id)) {
396
+ return;
397
+ }
398
+
399
+ if (event.rowIndex !== null) {
400
+ event.api.startEditingCell({
401
+ rowIndex: event.rowIndex,
402
+ colKey: event.column.getColId(),
394
403
  });
404
+ }
395
405
  },
396
- [gridContext],
406
+ [checkUpdating, prePopupOps],
397
407
  );
398
408
 
399
409
  /**
@@ -456,8 +466,9 @@ export const Grid = ({
456
466
  columnDefs.map((colDef) => ({
457
467
  ...colDef,
458
468
  suppressSizeToFit: (sizeColumns === "auto" || sizeColumns === "auto-skip-headers") && !colDef.flex,
469
+ sortable: colDef.sortable && params.defaultColDef?.sortable !== false,
459
470
  })),
460
- [columnDefs, sizeColumns],
471
+ [columnDefs, params.defaultColDef?.sortable, sizeColumns],
461
472
  );
462
473
 
463
474
  /**
@@ -384,19 +384,20 @@ export const GridContextProvider = <RowType extends GridBaseRow>(props: GridCont
384
384
  const colDef = gridApi.getColumnDef(colId);
385
385
  if (!colDef) return;
386
386
 
387
- // Cell already being edited, so don't re-edit until finished
388
- if (checkUpdating([colDef.field ?? ""], rowId)) {
389
- return;
390
- }
387
+ prePopupOps();
391
388
  const rowNode = gridApi.getRowNode(`${rowId}`);
392
389
  if (!rowNode) {
393
390
  return;
394
391
  }
395
392
 
396
393
  if (!rowNode.isSelected()) {
397
- rowNode.setSelected(true, true);
394
+ rowNode.setSelected(true, false);
395
+ }
396
+
397
+ // Cell already being edited, so don't re-edit until finished
398
+ if (checkUpdating([colDef.field ?? ""], rowId)) {
399
+ return;
398
400
  }
399
- prePopupOps();
400
401
 
401
402
  const rowIndex = rowNode.rowIndex;
402
403
  if (rowIndex != null) {