@gridsuite/commons-ui 0.78.0 → 0.79.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.
@@ -15,7 +15,7 @@ const onColumnResized = (params) => {
15
15
  if (column && colDefinedMinWidth && finished) {
16
16
  const newWidth = column == null ? void 0 : column.getActualWidth();
17
17
  if (newWidth < colDefinedMinWidth) {
18
- column == null ? void 0 : column.setActualWidth(colDefinedMinWidth, params.source);
18
+ params.api.setColumnWidths([{ key: column, newWidth: colDefinedMinWidth }], finished, params.source);
19
19
  }
20
20
  }
21
21
  };
@@ -48,9 +48,9 @@ const CustomAGGrid = React.forwardRef((props, ref) => {
48
48
  {
49
49
  ref,
50
50
  getLocaleText,
51
- suppressPropertyNamesCheck: true,
52
51
  onColumnResized,
53
52
  enableCellTextSelection: true,
53
+ theme: "legacy",
54
54
  ...agGridReactProps
55
55
  }
56
56
  )
@@ -6,7 +6,7 @@ import { Box } from "@mui/material";
6
6
  import { v4 } from "uuid";
7
7
  import { FieldConstants } from "../../../utils/constants/fieldConstants.js";
8
8
  import "../../../utils/yupConfig.js";
9
- import { ROW_DRAGGING_SELECTION_COLUMN_DEF, CustomAgGridTable } from "../../inputs/reactHookForm/agGridTable/CustomAgGridTable.js";
9
+ import { CustomAgGridTable } from "../../inputs/reactHookForm/agGridTable/CustomAgGridTable.js";
10
10
  import { SelectInput } from "../../inputs/reactHookForm/selectInputs/SelectInput.js";
11
11
  import { Generator, Load } from "../../../utils/types/equipmentTypes.js";
12
12
  import { NumericEditor } from "../../inputs/reactHookForm/agGridTable/cellEditors/numericEditor.js";
@@ -86,11 +86,11 @@ function ExplicitNamingFilterForm({ sourceFilterForExplicitNamingConversion }) {
86
86
  }, [sourceFilterForExplicitNamingConversion, setValue]);
87
87
  const columnDefs = useMemo(() => {
88
88
  const newColumnDefs = [
89
- ...ROW_DRAGGING_SELECTION_COLUMN_DEF,
90
89
  {
91
90
  headerName: intl.formatMessage({
92
91
  id: FieldConstants.EQUIPMENT_ID
93
92
  }),
93
+ rowDrag: true,
94
94
  field: FieldConstants.EQUIPMENT_ID,
95
95
  editable: true,
96
96
  singleClickEdit: true,
@@ -200,7 +200,12 @@ function ExplicitNamingFilterForm({ sourceFilterForExplicitNamingConversion }) {
200
200
  makeDefaultRowData,
201
201
  pagination: true,
202
202
  paginationPageSize: 100,
203
- suppressRowClickSelection: true,
203
+ rowSelection: {
204
+ mode: "multiRow",
205
+ enableClickSelection: false,
206
+ checkboxes: true,
207
+ headerCheckbox: true
208
+ },
204
209
  alwaysShowVerticalScroll: true,
205
210
  stopEditingWhenCellsLoseFocus: true,
206
211
  csvProps: {
@@ -42,7 +42,7 @@ import { SelectClearable } from "./inputs/SelectClearable.js";
42
42
  import { DirectoryItemsInput, NAME } from "./inputs/reactHookForm/DirectoryItemsInput.js";
43
43
  import { RawReadOnlyInput } from "./inputs/reactHookForm/RawReadOnlyInput.js";
44
44
  import { BottomRightButtons } from "./inputs/reactHookForm/agGridTable/BottomRightButtons.js";
45
- import { CustomAgGridTable, ROW_DRAGGING_SELECTION_COLUMN_DEF } from "./inputs/reactHookForm/agGridTable/CustomAgGridTable.js";
45
+ import { CustomAgGridTable } from "./inputs/reactHookForm/agGridTable/CustomAgGridTable.js";
46
46
  import { NumericEditor } from "./inputs/reactHookForm/agGridTable/cellEditors/numericEditor.js";
47
47
  import { CsvUploader } from "./inputs/reactHookForm/agGridTable/csvUploader/CsvUploader.js";
48
48
  import { AutocompleteInput } from "./inputs/reactHookForm/autocompleteInputs/AutocompleteInput.js";
@@ -189,7 +189,6 @@ export {
189
189
  PropertyValueEditor,
190
190
  RATIO_REGULATION_MODE_OPTIONS,
191
191
  REGULATION_TYPE_OPTIONS,
192
- ROW_DRAGGING_SELECTION_COLUMN_DEF,
193
192
  RULES,
194
193
  RadioInput,
195
194
  RangeInput,
@@ -2,7 +2,7 @@ import { SelectClearable } from "./SelectClearable.js";
2
2
  import { DirectoryItemsInput, NAME } from "./reactHookForm/DirectoryItemsInput.js";
3
3
  import { RawReadOnlyInput } from "./reactHookForm/RawReadOnlyInput.js";
4
4
  import { BottomRightButtons } from "./reactHookForm/agGridTable/BottomRightButtons.js";
5
- import { CustomAgGridTable, ROW_DRAGGING_SELECTION_COLUMN_DEF } from "./reactHookForm/agGridTable/CustomAgGridTable.js";
5
+ import { CustomAgGridTable } from "./reactHookForm/agGridTable/CustomAgGridTable.js";
6
6
  import { NumericEditor } from "./reactHookForm/agGridTable/cellEditors/numericEditor.js";
7
7
  import { CsvUploader } from "./reactHookForm/agGridTable/csvUploader/CsvUploader.js";
8
8
  import { AutocompleteInput } from "./reactHookForm/autocompleteInputs/AutocompleteInput.js";
@@ -84,7 +84,6 @@ export {
84
84
  NAME,
85
85
  NumericEditor,
86
86
  PropertyValueEditor,
87
- ROW_DRAGGING_SELECTION_COLUMN_DEF,
88
87
  RadioInput,
89
88
  RangeInput,
90
89
  RangeType,
@@ -1,10 +1,5 @@
1
+ import { AgGridReactProps } from 'ag-grid-react';
1
2
 
2
- export declare const ROW_DRAGGING_SELECTION_COLUMN_DEF: {
3
- rowDrag: boolean;
4
- headerCheckboxSelection: boolean;
5
- checkboxSelection: boolean;
6
- maxWidth: number;
7
- }[];
8
3
  export interface CustomAgGridTableProps {
9
4
  name: string;
10
5
  columnDefs: any;
@@ -14,8 +9,8 @@ export interface CustomAgGridTableProps {
14
9
  defaultColDef: unknown;
15
10
  pagination: boolean;
16
11
  paginationPageSize: number;
17
- suppressRowClickSelection: boolean;
12
+ rowSelection?: AgGridReactProps['rowSelection'];
18
13
  alwaysShowVerticalScroll: boolean;
19
14
  stopEditingWhenCellsLoseFocus: boolean;
20
15
  }
21
- export declare function CustomAgGridTable({ name, columnDefs, makeDefaultRowData, csvProps, cssProps, defaultColDef, pagination, paginationPageSize, suppressRowClickSelection, alwaysShowVerticalScroll, stopEditingWhenCellsLoseFocus, ...props }: CustomAgGridTableProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function CustomAgGridTable({ name, columnDefs, makeDefaultRowData, csvProps, cssProps, defaultColDef, pagination, paginationPageSize, rowSelection, alwaysShowVerticalScroll, stopEditingWhenCellsLoseFocus, ...props }: Readonly<CustomAgGridTableProps>): import("react/jsx-runtime").JSX.Element;
@@ -8,14 +8,6 @@ import { useTheme, Box } from "@mui/material";
8
8
  import { useIntl } from "react-intl";
9
9
  import { BottomRightButtons } from "./BottomRightButtons.js";
10
10
  import { FieldConstants } from "../../../../utils/constants/fieldConstants.js";
11
- const ROW_DRAGGING_SELECTION_COLUMN_DEF = [
12
- {
13
- rowDrag: true,
14
- headerCheckboxSelection: true,
15
- checkboxSelection: true,
16
- maxWidth: 50
17
- }
18
- ];
19
11
  const style = (customProps) => ({
20
12
  grid: (theme) => ({
21
13
  width: "auto",
@@ -80,7 +72,7 @@ function CustomAgGridTable({
80
72
  defaultColDef,
81
73
  pagination,
82
74
  paginationPageSize,
83
- suppressRowClickSelection,
75
+ rowSelection,
84
76
  alwaysShowVerticalScroll,
85
77
  stopEditingWhenCellsLoseFocus,
86
78
  ...props
@@ -190,11 +182,10 @@ function CustomAgGridTable({
190
182
  onGridReady,
191
183
  getLocaleText,
192
184
  cacheOverflowSize: 10,
193
- rowSelection: "multiple",
185
+ rowSelection: rowSelection ?? "multiple",
194
186
  rowDragEntireRow: true,
195
187
  rowDragManaged: true,
196
188
  onRowDragEnd: (e) => move(getIndex(e.node.data), e.overIndex),
197
- suppressBrowserResizeObserver: true,
198
189
  columnDefs,
199
190
  detailRowAutoHeight: true,
200
191
  onSelectionChanged: () => {
@@ -206,9 +197,9 @@ function CustomAgGridTable({
206
197
  getRowId: (row) => row.data[FieldConstants.AG_GRID_ROW_UUID],
207
198
  pagination,
208
199
  paginationPageSize,
209
- suppressRowClickSelection,
210
200
  alwaysShowVerticalScroll,
211
201
  stopEditingWhenCellsLoseFocus,
202
+ theme: "legacy",
212
203
  ...props
213
204
  }
214
205
  ) }),
@@ -230,6 +221,5 @@ function CustomAgGridTable({
230
221
  ] });
231
222
  }
232
223
  export {
233
- CustomAgGridTable,
234
- ROW_DRAGGING_SELECTION_COLUMN_DEF
224
+ CustomAgGridTable
235
225
  };
@@ -1,11 +1,10 @@
1
1
  import { BottomRightButtons } from "./BottomRightButtons.js";
2
- import { CustomAgGridTable, ROW_DRAGGING_SELECTION_COLUMN_DEF } from "./CustomAgGridTable.js";
2
+ import { CustomAgGridTable } from "./CustomAgGridTable.js";
3
3
  import { NumericEditor } from "./cellEditors/numericEditor.js";
4
4
  import { CsvUploader } from "./csvUploader/CsvUploader.js";
5
5
  export {
6
6
  BottomRightButtons,
7
7
  CsvUploader,
8
8
  CustomAgGridTable,
9
- NumericEditor,
10
- ROW_DRAGGING_SELECTION_COLUMN_DEF
9
+ NumericEditor
11
10
  };
@@ -1,7 +1,7 @@
1
1
  import { DirectoryItemsInput, NAME } from "./DirectoryItemsInput.js";
2
2
  import { RawReadOnlyInput } from "./RawReadOnlyInput.js";
3
3
  import { BottomRightButtons } from "./agGridTable/BottomRightButtons.js";
4
- import { CustomAgGridTable, ROW_DRAGGING_SELECTION_COLUMN_DEF } from "./agGridTable/CustomAgGridTable.js";
4
+ import { CustomAgGridTable } from "./agGridTable/CustomAgGridTable.js";
5
5
  import { NumericEditor } from "./agGridTable/cellEditors/numericEditor.js";
6
6
  import { CsvUploader } from "./agGridTable/csvUploader/CsvUploader.js";
7
7
  import { AutocompleteInput } from "./autocompleteInputs/AutocompleteInput.js";
@@ -59,7 +59,6 @@ export {
59
59
  MultipleAutocompleteInput,
60
60
  NAME,
61
61
  NumericEditor,
62
- ROW_DRAGGING_SELECTION_COLUMN_DEF,
63
62
  RadioInput,
64
63
  RangeInput,
65
64
  RangeType,
package/dist/index.js CHANGED
@@ -43,7 +43,7 @@ import { SelectClearable } from "./components/inputs/SelectClearable.js";
43
43
  import { DirectoryItemsInput, NAME } from "./components/inputs/reactHookForm/DirectoryItemsInput.js";
44
44
  import { RawReadOnlyInput } from "./components/inputs/reactHookForm/RawReadOnlyInput.js";
45
45
  import { BottomRightButtons } from "./components/inputs/reactHookForm/agGridTable/BottomRightButtons.js";
46
- import { CustomAgGridTable, ROW_DRAGGING_SELECTION_COLUMN_DEF } from "./components/inputs/reactHookForm/agGridTable/CustomAgGridTable.js";
46
+ import { CustomAgGridTable } from "./components/inputs/reactHookForm/agGridTable/CustomAgGridTable.js";
47
47
  import { NumericEditor } from "./components/inputs/reactHookForm/agGridTable/cellEditors/numericEditor.js";
48
48
  import { CsvUploader } from "./components/inputs/reactHookForm/agGridTable/csvUploader/CsvUploader.js";
49
49
  import { AutocompleteInput } from "./components/inputs/reactHookForm/autocompleteInputs/AutocompleteInput.js";
@@ -305,7 +305,6 @@ export {
305
305
  RATIO_REGULATION_MODE_OPTIONS,
306
306
  REGULATION_TYPE_OPTIONS,
307
307
  RESET_AUTHENTICATION_ROUTER_ERROR,
308
- ROW_DRAGGING_SELECTION_COLUMN_DEF,
309
308
  RULES,
310
309
  RadioInput,
311
310
  RangeInput,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridsuite/commons-ui",
3
- "version": "0.78.0",
3
+ "version": "0.79.0",
4
4
  "description": "common react components for gridsuite applications",
5
5
  "engines": {
6
6
  "npm": ">=9",
@@ -54,8 +54,8 @@
54
54
  "@mui/material": "^5.15.14",
55
55
  "@mui/system": "^5.15.15",
56
56
  "@mui/x-tree-view": "^6.17.0",
57
- "ag-grid-community": "^31.0.0",
58
- "ag-grid-react": "^31.2.0",
57
+ "ag-grid-community": "^33.0.3",
58
+ "ag-grid-react": "^33.0.3",
59
59
  "notistack": "^3.0.1",
60
60
  "papaparse": "^5.4.1",
61
61
  "react": "^18.2.0",
@@ -101,8 +101,8 @@
101
101
  "@typescript-eslint/eslint-plugin": "^7.0.0",
102
102
  "@typescript-eslint/parser": "^7.0.0",
103
103
  "@vitejs/plugin-react": "^4.2.1",
104
- "ag-grid-community": "^31.0.0",
105
- "ag-grid-react": "^31.2.0",
104
+ "ag-grid-community": "^33.0.3",
105
+ "ag-grid-react": "^33.0.3",
106
106
  "babel-eslint": "^10.1.0",
107
107
  "babel-preset-airbnb": "^5.0.0",
108
108
  "babel-preset-vite": "^1.1.3",