@linzjs/step-ag-grid 22.2.0 → 22.2.2
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/src/components/clickInputWhenContainingCellClicked.d.ts +1 -1
- package/dist/step-ag-grid.cjs.js +8 -14
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +8 -14
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/clickInputWhenContainingCellClicked.tsx +12 -15
|
@@ -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: (
|
|
6
|
+
export declare const clickInputWhenContainingCellClicked: (params: CellClickedEvent) => void;
|
package/dist/step-ag-grid.cjs.js
CHANGED
|
@@ -2339,38 +2339,32 @@ 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 = (
|
|
2342
|
+
const clickInputWhenContainingCellClicked = (params) => {
|
|
2343
|
+
const { data, event, colDef } = params;
|
|
2343
2344
|
if (!data || !event)
|
|
2344
2345
|
return;
|
|
2345
2346
|
const element = event.target;
|
|
2346
2347
|
// Already handled
|
|
2347
|
-
if (
|
|
2348
|
+
if (element.closest(".GridCell-readonly") ||
|
|
2349
|
+
(["BUTTON", "INPUT"].includes(element?.tagName) && element.closest(".ag-cell-inline-editing"))) {
|
|
2348
2350
|
return;
|
|
2351
|
+
}
|
|
2349
2352
|
const row = element.closest("[row-id]");
|
|
2350
2353
|
if (!row)
|
|
2351
2354
|
return;
|
|
2352
2355
|
const colId = colDef.colId;
|
|
2353
2356
|
if (!colId)
|
|
2354
2357
|
return;
|
|
2355
|
-
const clickInput = (
|
|
2358
|
+
const clickInput = () => {
|
|
2356
2359
|
const cell = row.querySelector(`[col-id='${colId}']`);
|
|
2357
2360
|
if (!cell)
|
|
2358
2361
|
return;
|
|
2359
2362
|
const input = cell.querySelector("input, button");
|
|
2360
|
-
if (!input)
|
|
2363
|
+
if (!input)
|
|
2361
2364
|
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
|
-
}
|
|
2369
|
-
return;
|
|
2370
|
-
}
|
|
2371
2365
|
input?.dispatchEvent(event);
|
|
2372
2366
|
};
|
|
2373
|
-
setTimeout(
|
|
2367
|
+
setTimeout(clickInput, 20);
|
|
2374
2368
|
};
|
|
2375
2369
|
|
|
2376
2370
|
/**
|