@linzjs/step-ag-grid 29.3.3 → 29.3.5

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.
@@ -2761,7 +2761,13 @@ ModuleRegistry.registerModules([AllCommunityModule]);
2761
2761
  * Wrapper for AgGrid to add commonly used functionality.
2762
2762
  */
2763
2763
  const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection = 'multiple', suppressColumnVirtualization = true, theme = 'ag-theme-step-default', sizeColumns = 'auto', selectColumnPinned = 'left', contextMenuSelectRow = false, singleClickEdit = false, rowData, rowHeight = theme === 'ag-theme-step-default' ? 40 : theme === 'ag-theme-step-compact' ? 36 : 40, selectable, onCellFocused: paramsOnCellFocused, maxInitialWidth, ...params }) => {
2764
- const { gridReady, gridRenderState, setApis, ensureRowVisible, getFirstRowId, selectRowsById, focusByRowById, ensureSelectedRowIsVisible, autoSizeColumns, sizeColumnsToFit, externallySelectedItemsAreInSync, setExternallySelectedItemsAreInSync, isExternalFilterPresent, doesExternalFilterPass, setOnBulkEditingComplete, getColDef, showNoRowsOverlay, prePopupOps, startCellEditing, } = useGridContext();
2764
+ const { gridReady, gridRenderState, setApis, ensureRowVisible, getFirstRowId, selectRowsById, focusByRowById, ensureSelectedRowIsVisible, autoSizeColumns, sizeColumnsToFit, externallySelectedItemsAreInSync, setExternallySelectedItemsAreInSync, isExternalFilterPresent, doesExternalFilterPass, setOnBulkEditingComplete, getColDef, showNoRowsOverlay, prePopupOps, startCellEditing: propStartCellEditing, } = useGridContext();
2765
+ // CellEditingStop event happens too much for one edit
2766
+ const startedEditRef = useRef(false);
2767
+ const startCellEditing = useCallback((props) => {
2768
+ startedEditRef.current = true;
2769
+ return propStartCellEditing(props);
2770
+ }, [propStartCellEditing]);
2765
2771
  const { updatedDep, anyUpdating, updatingCols } = useContext(GridUpdatingContext);
2766
2772
  const gridDivRef = useRef(null);
2767
2773
  const lastSelectedIds = useRef([]);
@@ -3041,6 +3047,10 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
3041
3047
  }
3042
3048
  }, [singleClickEdit, startCellEditing]);
3043
3049
  const onCellEditingStopped = useCallback((event) => {
3050
+ if (!startedEditRef.current) {
3051
+ return;
3052
+ }
3053
+ startedEditRef.current = false;
3044
3054
  const api = event.api;
3045
3055
  // We need to redraw on fit as the updated row heights aren't visible
3046
3056
  if (sizeColumns === 'fit') {