Skip to content

Commit c666767

Browse files
author
Marius Conjeaud
committed
Migrate DataGrid to 7.x #850 ; Initial changes
1 parent 08dc5b6 commit c666767

File tree

3 files changed

+76
-22
lines changed

3 files changed

+76
-22
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"@dnd-kit/sortable": "^7.0.2",
4242
"@mui/material": "^5.12.3",
4343
"@mui/styles": "^5.12.3",
44-
"@mui/x-data-grid": "5.17.26",
44+
"@mui/x-data-grid": "7.4.0",
4545
"@mui/x-date-pickers": "^5.0.17",
4646
"@neo4j-cypher/react-codemirror": "^1.0.3",
4747
"@neo4j-ndl/base": "1.10.3",

src/chart/table/TableChart.tsx

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ export const NeoTableChart = (props: ChartProps) => {
9292
const useStyles = generateClassDefinitionsBasedOnRules(styleRules);
9393
const classes = useStyles();
9494
const tableRowHeight = compact ? TABLE_ROW_HEIGHT / 2 : TABLE_ROW_HEIGHT;
95-
const pageSizeReducer = compact ? 3 : 1;
9695

9796
const columnWidthsType =
9897
props.settings && props.settings.columnWidthsType ? props.settings.columnWidthsType : 'Relative (%)';
@@ -209,15 +208,10 @@ export const NeoTableChart = (props: ChartProps) => {
209208
);
210209
});
211210

212-
const availableRowHeight = (props.dimensions.height - TABLE_HEADER_HEIGHT - TABLE_FOOTER_HEIGHT) / tableRowHeight;
213-
const tablePageSize = compact
214-
? Math.round(availableRowHeight) - pageSizeReducer
215-
: Math.floor(availableRowHeight) - pageSizeReducer;
216-
217211
const pageNames = getPageNumbersAndNamesList();
218212
const commonGridProps = {
219213
key: 'tableKey',
220-
headerHeight: 32,
214+
columnHeaderHeight: 32,
221215
density: compact ? 'compact' : 'standard',
222216
rows: rows,
223217
columns: columns,
@@ -234,11 +228,10 @@ export const NeoTableChart = (props: ChartProps) => {
234228
}
235229
},
236230
checkboxSelection: hasCheckboxes(actionsRules),
237-
selectionModel: getCheckboxes(actionsRules, rows, props.getGlobalParameter),
238-
onSelectionModelChange: (selection) => updateCheckBoxes(actionsRules, rows, selection, props.setGlobalParameter),
239-
pageSize: tablePageSize > 0 ? tablePageSize : 5,
240-
rowsPerPageOptions: rows.length < 5 ? [rows.length, 5] : [5],
241-
disableSelectionOnClick: true,
231+
rowSelectionModel: getCheckboxes(actionsRules, rows, props.getGlobalParameter),
232+
onRowSelectionModelChange: (selection) => updateCheckBoxes(actionsRules, rows, selection, props.setGlobalParameter),
233+
autoPageSize: true,
234+
disableRowSelectionOnClick: true,
242235
components: {
243236
ColumnSortedDescendingIcon: () => <></>,
244237
ColumnSortedAscendingIcon: () => <></>,

yarn.lock

Lines changed: 70 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,13 @@
13131313
dependencies:
13141314
regenerator-runtime "^0.14.0"
13151315

1316+
"@babel/runtime@^7.24.0":
1317+
version "7.24.5"
1318+
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.24.5.tgz#230946857c053a36ccc66e1dd03b17dd0c4ed02c"
1319+
integrity sha512-Nms86NXrsaeU9vbBJKni6gXiEXZ4CVpYVzEjDH9Sb8vmZ3UljyA1GSOJl/6LGPO8EHLuSF9H+IxNXHPX8QHJ4g==
1320+
dependencies:
1321+
regenerator-runtime "^0.14.0"
1322+
13161323
"@babel/template@^7.18.10", "@babel/template@^7.20.7":
13171324
version "7.20.7"
13181325
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.20.7.tgz#a15090c2839a83b02aa996c0b4994005841fd5a8"
@@ -2444,6 +2451,15 @@
24442451
"@mui/utils" "^5.15.11"
24452452
prop-types "^15.8.1"
24462453

2454+
"@mui/private-theming@^5.15.14":
2455+
version "5.15.14"
2456+
resolved "https://registry.yarnpkg.com/@mui/private-theming/-/private-theming-5.15.14.tgz#edd9a82948ed01586a01c842eb89f0e3f68970ee"
2457+
integrity sha512-UH0EiZckOWcxiXLX3Jbb0K7rC8mxTr9L9l6QhOZxYc4r8FHUkefltV9VDGLrzCaWh30SQiJvAEd7djX3XXY6Xw==
2458+
dependencies:
2459+
"@babel/runtime" "^7.23.9"
2460+
"@mui/utils" "^5.15.14"
2461+
prop-types "^15.8.1"
2462+
24472463
"@mui/styled-engine@^5.15.11":
24482464
version "5.15.11"
24492465
resolved "https://registry.yarnpkg.com/@mui/styled-engine/-/styled-engine-5.15.11.tgz#040181f31910e0f66d43a5c44fe89da06b34212b"
@@ -2454,6 +2470,16 @@
24542470
csstype "^3.1.3"
24552471
prop-types "^15.8.1"
24562472

2473+
"@mui/styled-engine@^5.15.14":
2474+
version "5.15.14"
2475+
resolved "https://registry.yarnpkg.com/@mui/styled-engine/-/styled-engine-5.15.14.tgz#168b154c4327fa4ccc1933a498331d53f61c0de2"
2476+
integrity sha512-RILkuVD8gY6PvjZjqnWhz8fu68dVkqhM5+jYWfB5yhlSQKg+2rHkmEwm75XIeAqI3qwOndK6zELK5H6Zxn4NHw==
2477+
dependencies:
2478+
"@babel/runtime" "^7.23.9"
2479+
"@emotion/cache" "^11.11.0"
2480+
csstype "^3.1.3"
2481+
prop-types "^15.8.1"
2482+
24572483
"@mui/styles@^5.12.3":
24582484
version "5.15.11"
24592485
resolved "https://registry.yarnpkg.com/@mui/styles/-/styles-5.15.11.tgz#2fc57a42eff47542924e1ba90fb188b733d295aa"
@@ -2491,11 +2517,30 @@
24912517
csstype "^3.1.3"
24922518
prop-types "^15.8.1"
24932519

2520+
"@mui/system@^5.15.14":
2521+
version "5.15.15"
2522+
resolved "https://registry.yarnpkg.com/@mui/system/-/system-5.15.15.tgz#658771b200ce3c4a0f28e58169f02e5e718d1c53"
2523+
integrity sha512-aulox6N1dnu5PABsfxVGOZffDVmlxPOVgj56HrUnJE8MCSh8lOvvkd47cebIVQQYAjpwieXQXiDPj5pwM40jTQ==
2524+
dependencies:
2525+
"@babel/runtime" "^7.23.9"
2526+
"@mui/private-theming" "^5.15.14"
2527+
"@mui/styled-engine" "^5.15.14"
2528+
"@mui/types" "^7.2.14"
2529+
"@mui/utils" "^5.15.14"
2530+
clsx "^2.1.0"
2531+
csstype "^3.1.3"
2532+
prop-types "^15.8.1"
2533+
24942534
"@mui/types@^7.2.13":
24952535
version "7.2.13"
24962536
resolved "https://registry.yarnpkg.com/@mui/types/-/types-7.2.13.tgz#d1584912942f9dc042441ecc2d1452be39c666b8"
24972537
integrity sha512-qP9OgacN62s+l8rdDhSFRe05HWtLLJ5TGclC9I1+tQngbssu0m2dmFZs+Px53AcOs9fD7TbYd4gc9AXzVqO/+g==
24982538

2539+
"@mui/types@^7.2.14":
2540+
version "7.2.14"
2541+
resolved "https://registry.yarnpkg.com/@mui/types/-/types-7.2.14.tgz#8a02ac129b70f3d82f2f9b76ded2c8d48e3fc8c9"
2542+
integrity sha512-MZsBZ4q4HfzBsywtXgM1Ksj6HDThtiwmOKUXH1pKYISI9gAVXCNHNpo7TlGoGrBaYWZTdNoirIN7JsQcQUjmQQ==
2543+
24992544
"@mui/utils@^5.10.3":
25002545
version "5.11.9"
25012546
resolved "https://registry.yarnpkg.com/@mui/utils/-/utils-5.11.9.tgz#8fab9cf773c63ad916597921860d2344b5d4b706"
@@ -2517,16 +2562,27 @@
25172562
prop-types "^15.8.1"
25182563
react-is "^18.2.0"
25192564

2520-
2521-
version "5.17.26"
2522-
resolved "https://registry.yarnpkg.com/@mui/x-data-grid/-/x-data-grid-5.17.26.tgz#1f7fa73dd3986cf052e2fd2cb56eb4678a7bd913"
2523-
integrity sha512-eGJq9J0g9cDGLFfMmugOadZx0mJeOd/yQpHwEa5gUXyONS6qF0OhXSWyDOhDdA3l2TOoQzotMN5dY/T4Wl1KYA==
2565+
"@mui/utils@^5.15.14":
2566+
version "5.15.14"
2567+
resolved "https://registry.yarnpkg.com/@mui/utils/-/utils-5.15.14.tgz#e414d7efd5db00bfdc875273a40c0a89112ade3a"
2568+
integrity sha512-0lF/7Hh/ezDv5X7Pry6enMsbYyGKjADzvHyo3Qrc/SSlTsQ1VkbDMbH0m2t3OR5iIVLwMoxwM7yGd+6FCMtTFA==
25242569
dependencies:
2525-
"@babel/runtime" "^7.18.9"
2526-
"@mui/utils" "^5.10.3"
2527-
clsx "^1.2.1"
2570+
"@babel/runtime" "^7.23.9"
2571+
"@types/prop-types" "^15.7.11"
25282572
prop-types "^15.8.1"
2529-
reselect "^4.1.6"
2573+
react-is "^18.2.0"
2574+
2575+
2576+
version "7.4.0"
2577+
resolved "https://registry.yarnpkg.com/@mui/x-data-grid/-/x-data-grid-7.4.0.tgz#1901f2908aca760146ccae74b064fc15462bcf63"
2578+
integrity sha512-ILu0AVqqHQf4wN/nblsJ/k7PkvlB115vQ/FEiYk7neZlc/kOJOUyst3MWMVClAecZ8+JEs476q40xd4r1CtMfw==
2579+
dependencies:
2580+
"@babel/runtime" "^7.24.0"
2581+
"@mui/system" "^5.15.14"
2582+
"@mui/utils" "^5.15.14"
2583+
clsx "^2.1.1"
2584+
prop-types "^15.8.1"
2585+
reselect "^4.1.8"
25302586

25312587
"@mui/x-date-pickers@^5.0.17":
25322588
version "5.0.19"
@@ -5974,6 +6030,11 @@ clsx@^2.1.0:
59746030
resolved "https://registry.yarnpkg.com/clsx/-/clsx-2.1.0.tgz#e851283bcb5c80ee7608db18487433f7b23f77cb"
59756031
integrity sha512-m3iNNWpd9rl3jvvcBnu70ylMdrXt8Vlq4HYadnU5fwcOtvkSQWPmj7amUcDT2qYI7risszBjI5AUIUox9D16pg==
59766032

6033+
clsx@^2.1.1:
6034+
version "2.1.1"
6035+
resolved "https://registry.yarnpkg.com/clsx/-/clsx-2.1.1.tgz#eed397c9fd8bd882bfb18deab7102049a2f32999"
6036+
integrity sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==
6037+
59776038
color-convert@^1.9.0:
59786039
version "1.9.3"
59796040
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
@@ -12160,7 +12221,7 @@ requires-port@^1.0.0:
1216012221
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
1216112222
integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==
1216212223

12163-
reselect@^4.1.6, reselect@^4.1.8:
12224+
reselect@^4.1.8:
1216412225
version "4.1.8"
1216512226
resolved "https://registry.yarnpkg.com/reselect/-/reselect-4.1.8.tgz#3f5dc671ea168dccdeb3e141236f69f02eaec524"
1216612227
integrity sha512-ab9EmR80F/zQTMNeneUr4cv+jSwPJgIlvEmVwLerwrWVbpLlBuls9XHzIeTFy4cegU2NHBp3va0LKOzU5qFEYQ==

0 commit comments

Comments
 (0)