-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TreeView] Support item reordering using drag and drop (#12213)
- Loading branch information
1 parent
ca2fb5c
commit 995fccc
Showing
71 changed files
with
3,144 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
docs/data/tree-view/rich-tree-view/ordering/DragAndDrop.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/material/Box'; | ||
|
||
import { RichTreeViewPro } from '@mui/x-tree-view-pro/RichTreeViewPro'; | ||
|
||
const ITEMS = [ | ||
{ | ||
id: 'grid', | ||
label: 'Data Grid', | ||
children: [ | ||
{ id: 'grid-community', label: '@mui/x-data-grid' }, | ||
{ id: 'grid-pro', label: '@mui/x-data-grid-pro' }, | ||
{ id: 'grid-premium', label: '@mui/x-data-grid-premium' }, | ||
], | ||
}, | ||
{ | ||
id: 'pickers', | ||
label: 'Date and Time Pickers', | ||
children: [ | ||
{ id: 'pickers-community', label: '@mui/x-date-pickers' }, | ||
{ id: 'pickers-pro', label: '@mui/x-date-pickers-pro' }, | ||
], | ||
}, | ||
{ | ||
id: 'charts', | ||
label: 'Charts', | ||
children: [{ id: 'charts-community', label: '@mui/x-charts' }], | ||
}, | ||
{ | ||
id: 'tree-view', | ||
label: 'Tree View', | ||
children: [{ id: 'tree-view-community', label: '@mui/x-tree-view' }], | ||
}, | ||
]; | ||
|
||
export default function DragAndDrop() { | ||
return ( | ||
<Box sx={{ minHeight: 352, minWidth: 300 }}> | ||
<RichTreeViewPro | ||
items={ITEMS} | ||
itemsReordering | ||
defaultExpandedItems={['grid', 'pickers']} | ||
experimentalFeatures={{ | ||
indentationAtItemLevel: true, | ||
itemsReordering: true, | ||
}} | ||
/> | ||
</Box> | ||
); | ||
} |
50 changes: 50 additions & 0 deletions
50
docs/data/tree-view/rich-tree-view/ordering/DragAndDrop.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/material/Box'; | ||
import { TreeViewBaseItem } from '@mui/x-tree-view/models'; | ||
import { RichTreeViewPro } from '@mui/x-tree-view-pro/RichTreeViewPro'; | ||
|
||
const ITEMS: TreeViewBaseItem[] = [ | ||
{ | ||
id: 'grid', | ||
label: 'Data Grid', | ||
children: [ | ||
{ id: 'grid-community', label: '@mui/x-data-grid' }, | ||
{ id: 'grid-pro', label: '@mui/x-data-grid-pro' }, | ||
{ id: 'grid-premium', label: '@mui/x-data-grid-premium' }, | ||
], | ||
}, | ||
{ | ||
id: 'pickers', | ||
label: 'Date and Time Pickers', | ||
children: [ | ||
{ id: 'pickers-community', label: '@mui/x-date-pickers' }, | ||
{ id: 'pickers-pro', label: '@mui/x-date-pickers-pro' }, | ||
], | ||
}, | ||
{ | ||
id: 'charts', | ||
label: 'Charts', | ||
children: [{ id: 'charts-community', label: '@mui/x-charts' }], | ||
}, | ||
{ | ||
id: 'tree-view', | ||
label: 'Tree View', | ||
children: [{ id: 'tree-view-community', label: '@mui/x-tree-view' }], | ||
}, | ||
]; | ||
|
||
export default function DragAndDrop() { | ||
return ( | ||
<Box sx={{ minHeight: 352, minWidth: 300 }}> | ||
<RichTreeViewPro | ||
items={ITEMS} | ||
itemsReordering | ||
defaultExpandedItems={['grid', 'pickers']} | ||
experimentalFeatures={{ | ||
indentationAtItemLevel: true, | ||
itemsReordering: true, | ||
}} | ||
/> | ||
</Box> | ||
); | ||
} |
9 changes: 9 additions & 0 deletions
9
docs/data/tree-view/rich-tree-view/ordering/DragAndDrop.tsx.preview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<RichTreeViewPro | ||
items={ITEMS} | ||
itemsReordering | ||
defaultExpandedItems={['grid', 'pickers']} | ||
experimentalFeatures={{ | ||
indentationAtItemLevel: true, | ||
itemsReordering: true, | ||
}} | ||
/> |
Oops, something went wrong.