Skip to content

Commit eb51324

Browse files
authored
onColumnProposeMove should prevent drag (#963)
* onColumnProposeMove should prevent drag * fix lint * fix react 18 test
1 parent 71b62ac commit eb51324

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
"@storybook/react": "^7.6.12",
5151
"@storybook/react-vite": "^7.6.12",
5252
"@storybook/react-webpack5": "^7.6.12",
53-
"@testing-library/react": "^12.1.2",
53+
"@testing-library/dom": "^10.1.0",
54+
"@testing-library/react": "^16.0.0",
5455
"@testing-library/react-hooks": "^8.0.1",
5556
"@testing-library/user-event": "^14.5.1",
5657
"@types/cheerio": "^0.22.30",
@@ -85,11 +86,12 @@
8586
"marked": "^4.0.10",
8687
"mini-css-extract-plugin": "^2.6.1",
8788
"prettier": "^3.0.2",
88-
"react": "^16.12.0 || 17.x",
89-
"react-dom": "^16.12.0 || 17.x",
89+
"react": "^18.3.1",
90+
"react-dom": "^18.3.1",
9091
"react-laag": "^2.0.3",
9192
"react-responsive-carousel": "^3.2.7",
9293
"react-syntax-highlighter": "^15.4.5",
94+
"react-test-renderer": "^18.3.1",
9395
"resolve-typescript-plugin": "^2.0.1",
9496
"storybook": "^7.6.12",
9597
"tsc-esm-fix": "^2.7.8",

packages/core/src/internal/data-grid-dnd/data-grid-dnd.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ const DataGridDnd: React.FunctionComponent<DataGridDndProps> = p => {
252252
}
253253

254254
clearAll();
255-
if (dragCol !== undefined && dropCol !== undefined) {
255+
if (dragCol !== undefined && dropCol !== undefined && onColumnProposeMove?.(dragCol, dropCol) !== false) {
256256
onColumnMoved?.(dragCol, dropCol);
257257
}
258258
if (dragRow !== undefined && dropRow !== undefined) {
@@ -277,6 +277,7 @@ const DataGridDnd: React.FunctionComponent<DataGridDndProps> = p => {
277277
onColumnMoved,
278278
onRowMoved,
279279
clearAll,
280+
onColumnProposeMove,
280281
]
281282
);
282283

0 commit comments

Comments
 (0)