@linzjs/step-ag-grid 7.9.0 → 7.10.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": "7.9.0",
5
+ "version": "7.10.1",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -33,6 +33,7 @@ export interface GridProps {
33
33
  postSortRows?: GridOptions["postSortRows"];
34
34
  animateRows?: boolean;
35
35
  rowClassRules?: GridOptions["rowClassRules"];
36
+ rowSelection?: "single" | "multiple";
36
37
  }
37
38
 
38
39
  /**
@@ -218,7 +219,12 @@ export const Grid = (params: GridProps): JSX.Element => {
218
219
  const editAction = e.colDef?.cellRendererParams?.editAction;
219
220
  if (!editAction) return false;
220
221
  const editable = fnOrVar(e.colDef?.editable, e);
221
- editable && editAction([e.data, ...e.api.getSelectedRows().filter((row) => row.id !== e.data.id)]);
222
+ if (editable) {
223
+ if (!e.node.isSelected()) {
224
+ e.node.setSelected(true, true);
225
+ }
226
+ editAction([e.data, ...e.api.getSelectedRows().filter((row) => row.id !== e.data.id)]);
227
+ }
222
228
  return true;
223
229
  };
224
230
 
@@ -273,7 +279,7 @@ export const Grid = (params: GridProps): JSX.Element => {
273
279
  defaultColDef={params.defaultColDef}
274
280
  getRowId={(params) => `${params.data.id}`}
275
281
  suppressRowClickSelection={true}
276
- rowSelection={"multiple"}
282
+ rowSelection={params.rowSelection ?? "multiple"}
277
283
  suppressBrowserResizeObserver={true}
278
284
  colResizeDefault={"shift"}
279
285
  onFirstDataRendered={sizeColumnsToFit}
@@ -88,7 +88,7 @@ const GridReadOnlyTemplate: ComponentStory<typeof Grid> = (props: GridProps) =>
88
88
  { id: 1001, bearing: "0E-12", bearingCorrection: 240 },
89
89
  { id: 1002, bearing: null, bearingCorrection: 355.1 },
90
90
  { id: 1003, bearing: null, bearingCorrection: 0 },
91
- { id: 1004, bearing: 5.0, bearingCorrection: 50.0 },
91
+ { id: 1004, bearing: 5.0, bearingCorrection: "1.00500" },
92
92
  ] as ITestRow[]);
93
93
 
94
94
  return (
@@ -25,6 +25,7 @@ export default {
25
25
  quickFilterValue: "",
26
26
  quickFilterPlaceholder: "Quick filter...",
27
27
  selectable: false,
28
+ rowSelection: "single",
28
29
  },
29
30
  decorators: [
30
31
  (Story) => (
@@ -105,7 +106,7 @@ const GridReadOnlyTemplate: ComponentStory<typeof Grid> = (props: GridProps) =>
105
106
  <GridIcon icon={"ic_launch_modal"} title={"Title text"} className={"GridCell-editableIcon"} />
106
107
  ),
107
108
  editAction: (selectedRows) => {
108
- alert(`Custom edit ${selectedRows.length} row(s) selected`);
109
+ alert(`Custom edit ${selectedRows.map((r) => r.id)} rowId(s) selected`);
109
110
  },
110
111
  shortcutKeys: {
111
112
  e: () => {
@@ -126,7 +127,7 @@ const GridReadOnlyTemplate: ComponentStory<typeof Grid> = (props: GridProps) =>
126
127
  {
127
128
  label: "Single edit only",
128
129
  action: async (selectedRows) => {
129
- alert(`Single-edit: ${selectedRows.length} rows`);
130
+ alert(`Single-edit: ${selectedRows.map((r) => r.id)} rowId(s) selected`);
130
131
  await wait(1500);
131
132
  },
132
133
  disabled: selectedItems.length > 1,
@@ -134,7 +135,7 @@ const GridReadOnlyTemplate: ComponentStory<typeof Grid> = (props: GridProps) =>
134
135
  {
135
136
  label: "Multi-edit",
136
137
  action: async (selectedRows) => {
137
- alert(`Multi-edit: ${selectedRows.length} rows`);
138
+ alert(`Multi-edit: ${selectedRows.map((r) => r.id)} rowId(s) selected`);
138
139
  await wait(1500);
139
140
  },
140
141
  },
@@ -208,4 +209,4 @@ const GridReadOnlyTemplate: ComponentStory<typeof Grid> = (props: GridProps) =>
208
209
  );
209
210
  };
210
211
 
211
- export const ReadOnly = GridReadOnlyTemplate.bind({});
212
+ export const ReadOnlySingleSelection = GridReadOnlyTemplate.bind({});
@@ -14,7 +14,7 @@ export const bearingCorrectionValueFormatter = (params: ValueFormatterParams): s
14
14
  return "–";
15
15
  }
16
16
  if (typeof value === "string") {
17
- return convertDDToDMS(bearingNumberParser(value), true, true);
17
+ return convertDDToDMS(bearingNumberParser(value), true, false);
18
18
  }
19
19
  return convertDDToDMS(value, true, false);
20
20
  };