@linzjs/step-ag-grid 27.2.3 → 27.3.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": "27.2.3",
5
+ "version": "27.3.1",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -50,6 +50,8 @@ export interface GridProps<TData extends GridBaseRow = GridBaseRow> {
50
50
  readOnly?: boolean; // set all editables to false when read only, make all styles black, otherwise style is gray for not editable
51
51
  defaultPostSort?: boolean; // Retain sort order after edit, Defaults to true.
52
52
  selectable?: boolean;
53
+ enableClickSelection?: boolean;
54
+ enableSelectionWithoutKeys?: boolean;
53
55
  hideSelectColumn?: boolean;
54
56
  theme?: string; // should have prefix ag-theme-
55
57
  ['data-testid']?: string;
@@ -668,7 +670,8 @@ export const Grid = <TData extends GridBaseRow = GridBaseRow>({
668
670
  rowSelection={
669
671
  selectable
670
672
  ? {
671
- enableClickSelection: false,
673
+ enableSelectionWithoutKeys: params.enableSelectionWithoutKeys ?? false,
674
+ enableClickSelection: params.enableClickSelection ?? false,
672
675
  mode: rowSelection == 'single' ? 'singleRow' : 'multiRow',
673
676
  }
674
677
  : undefined
@@ -747,7 +750,10 @@ export const Grid = <TData extends GridBaseRow = GridBaseRow>({
747
750
  }
748
751
  return false;
749
752
  },
750
- onCellClicked: clickInputWhenContainingCellClicked,
753
+ onCellClicked:
754
+ params.enableSelectionWithoutKeys || params.enableClickSelection
755
+ ? undefined
756
+ : clickInputWhenContainingCellClicked,
751
757
  }}
752
758
  />
753
759
  </div>
@@ -28,9 +28,11 @@ export const clickInputWhenContainingCellClicked = (params: CellClickedEvent) =>
28
28
  if (!cell) return;
29
29
 
30
30
  const input = cell.querySelector('input, button');
31
- if (!input) return;
31
+ if (!input) {
32
+ return;
33
+ }
32
34
 
33
- input?.dispatchEvent(event);
35
+ input.dispatchEvent(event);
34
36
  };
35
37
 
36
38
  setTimeout(clickInput, 20);
@@ -244,6 +244,8 @@ const GridReadOnlyTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
244
244
  data-testid={'readonly'}
245
245
  {...props}
246
246
  selectable={true}
247
+ enableClickSelection={true}
248
+ enableSelectionWithoutKeys={true}
247
249
  autoSelectFirstRow={true}
248
250
  externalSelectedItems={externalSelectedItems}
249
251
  setExternalSelectedItems={setExternalSelectedItems}