@linzjs/step-ag-grid 22.2.0 → 22.2.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.
@@ -3,4 +3,4 @@ import { CellClickedEvent } from "ag-grid-community";
3
3
  * AgGrid checkbox select does not pass clicks within cell but not on the checkbox to checkbox.
4
4
  * This passes the event to the checkbox when you click anywhere in the cell.
5
5
  */
6
- export declare const clickInputWhenContainingCellClicked: ({ data, event, colDef }: CellClickedEvent) => void;
6
+ export declare const clickInputWhenContainingCellClicked: (params: CellClickedEvent) => void;
@@ -2339,9 +2339,13 @@ const useGridContextMenu = ({ contextMenuSelectRow, contextMenu: ContextMenu, })
2339
2339
  * AgGrid checkbox select does not pass clicks within cell but not on the checkbox to checkbox.
2340
2340
  * This passes the event to the checkbox when you click anywhere in the cell.
2341
2341
  */
2342
- const clickInputWhenContainingCellClicked = ({ data, event, colDef }) => {
2342
+ const clickInputWhenContainingCellClicked = (params) => {
2343
+ const { data, event, colDef } = params;
2343
2344
  if (!data || !event)
2344
2345
  return;
2346
+ if (fnOrVar(colDef.editable, params) === false) {
2347
+ return;
2348
+ }
2345
2349
  const element = event.target;
2346
2350
  // Already handled
2347
2351
  if (["BUTTON", "INPUT"].includes(element?.tagName) && element.closest(".ag-cell-inline-editing"))
@@ -2352,25 +2356,16 @@ const clickInputWhenContainingCellClicked = ({ data, event, colDef }) => {
2352
2356
  const colId = colDef.colId;
2353
2357
  if (!colId)
2354
2358
  return;
2355
- const clickInput = (cnt) => {
2359
+ const clickInput = () => {
2356
2360
  const cell = row.querySelector(`[col-id='${colId}']`);
2357
2361
  if (!cell)
2358
2362
  return;
2359
2363
  const input = cell.querySelector("input, button");
2360
- if (!input) {
2361
- return;
2362
- }
2363
- // When clicking on a cell that is not editing, the cell changes to editing and the input/button ref becomes invalid
2364
- // So wait until the cell is in edit mode before sending the click
2365
- if (!input.ownerDocument.contains(input)) {
2366
- if (cnt !== 0) {
2367
- setTimeout(() => clickInput(cnt - 1));
2368
- }
2364
+ if (!input)
2369
2365
  return;
2370
- }
2371
2366
  input?.dispatchEvent(event);
2372
2367
  };
2373
- setTimeout(() => clickInput(20), 10);
2368
+ setTimeout(clickInput, 20);
2374
2369
  };
2375
2370
 
2376
2371
  /**