@linzjs/step-ag-grid 1.1.1 → 1.2.0

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": "1.1.1",
5
+ "version": "1.2.0",
6
6
  "main": "dist/index.js",
7
7
  "typings": "dist/index.d.ts",
8
8
  "module": "dist/step-ag-grid.esm.js",
@@ -19,6 +19,7 @@ export interface GridBaseRow {
19
19
  }
20
20
 
21
21
  export interface GridProps {
22
+ selectable?: boolean;
22
23
  dataTestId?: string;
23
24
  quickFilter?: boolean;
24
25
  quickFilterPlaceholder?: string;
@@ -111,21 +112,24 @@ export const Grid = (params: GridProps): JSX.Element => {
111
112
  }, [synchroniseExternallySelectedItemsToGrid]);
112
113
 
113
114
  const columnDefs = useMemo(
114
- (): GridOptions["columnDefs"] => [
115
- {
116
- colId: "selection",
117
- editable: false,
118
- initialWidth: 35,
119
- minWidth: 35,
120
- maxWidth: 35,
121
- suppressSizeToFit: true,
122
- checkboxSelection: true,
123
- headerComponent: GridHeaderSelect,
124
- onCellClicked: clickSelectorCheckboxWhenContainingCellClicked,
125
- },
126
- ...(params.columnDefs as ColDef[]),
127
- ],
128
- [clickSelectorCheckboxWhenContainingCellClicked, params.columnDefs],
115
+ (): GridOptions["columnDefs"] =>
116
+ params.selectable
117
+ ? [
118
+ {
119
+ colId: "selection",
120
+ editable: false,
121
+ initialWidth: 35,
122
+ minWidth: 35,
123
+ maxWidth: 35,
124
+ suppressSizeToFit: true,
125
+ checkboxSelection: true,
126
+ headerComponent: GridHeaderSelect,
127
+ onCellClicked: clickSelectorCheckboxWhenContainingCellClicked,
128
+ },
129
+ ...(params.columnDefs as ColDef[]),
130
+ ]
131
+ : [...(params.columnDefs as ColDef[])],
132
+ [clickSelectorCheckboxWhenContainingCellClicked, params.columnDefs, params.selectable],
129
133
  );
130
134
 
131
135
  const onGridReady = useCallback(
@@ -89,6 +89,7 @@ const GridReadOnlyTemplate: ComponentStory<typeof Grid> = (props: GridProps) =>
89
89
  return (
90
90
  <Grid
91
91
  {...props}
92
+ selectable={true}
92
93
  externalSelectedItems={externalSelectedItems}
93
94
  setExternalSelectedItems={setExternalSelectedItems}
94
95
  columnDefs={columnDefs}
@@ -163,6 +163,7 @@ const GridEditDropDownTemplate: ComponentStory<typeof Grid> = (props: GridProps)
163
163
  return (
164
164
  <Grid
165
165
  {...props}
166
+ selectable={true}
166
167
  externalSelectedItems={externalSelectedItems}
167
168
  setExternalSelectedItems={setExternalSelectedItems}
168
169
  columnDefs={columnDefs}
@@ -65,6 +65,7 @@ const GridPopoutEditGenericTemplate: ComponentStory<typeof Grid> = (props: GridP
65
65
  return (
66
66
  <Grid
67
67
  {...props}
68
+ selectable={true}
68
69
  externalSelectedItems={externalSelectedItems}
69
70
  setExternalSelectedItems={setExternalSelectedItems}
70
71
  columnDefs={columnDefs}
@@ -95,6 +95,7 @@ const GridPopoutEditGenericTemplate: ComponentStory<typeof Grid> = (props: GridP
95
95
  return (
96
96
  <Grid
97
97
  {...props}
98
+ selectable={true}
98
99
  externalSelectedItems={externalSelectedItems}
99
100
  setExternalSelectedItems={setExternalSelectedItems}
100
101
  columnDefs={columnDefs}
@@ -100,6 +100,7 @@ const GridEditMultiSelectTemplate: ComponentStory<typeof Grid> = (props: GridPro
100
100
  return (
101
101
  <Grid
102
102
  {...props}
103
+ selectable={true}
103
104
  externalSelectedItems={externalSelectedItems}
104
105
  setExternalSelectedItems={setExternalSelectedItems}
105
106
  columnDefs={columnDefs}
@@ -138,6 +138,7 @@ const GridReadOnlyTemplate: ComponentStory<typeof Grid> = (props: GridProps) =>
138
138
  return (
139
139
  <Grid
140
140
  {...props}
141
+ selectable={false}
141
142
  externalSelectedItems={externalSelectedItems}
142
143
  setExternalSelectedItems={setExternalSelectedItems}
143
144
  columnDefs={columnDefs}