-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into docs-slots
- Loading branch information
Showing
90 changed files
with
2,847 additions
and
62 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import * as React from 'react'; | ||
import { LineChart } from '@mui/x-charts/LineChart'; | ||
|
||
export default function AreaBaseline() { | ||
return ( | ||
<LineChart | ||
xAxis={[{ data: [1, 2, 3, 5, 8, 10] }]} | ||
series={[ | ||
{ | ||
data: [2, -5.5, 2, -7.5, 1.5, 6], | ||
area: true, | ||
baseline: 'min', | ||
}, | ||
]} | ||
width={500} | ||
height={300} | ||
/> | ||
); | ||
} |
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,19 @@ | ||
import * as React from 'react'; | ||
import { LineChart } from '@mui/x-charts/LineChart'; | ||
|
||
export default function AreaBaseline() { | ||
return ( | ||
<LineChart | ||
xAxis={[{ data: [1, 2, 3, 5, 8, 10] }]} | ||
series={[ | ||
{ | ||
data: [2, -5.5, 2, -7.5, 1.5, 6], | ||
area: true, | ||
baseline: 'min', | ||
}, | ||
]} | ||
width={500} | ||
height={300} | ||
/> | ||
); | ||
} |
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,12 @@ | ||
<LineChart | ||
xAxis={[{ data: [1, 2, 3, 5, 8, 10] }]} | ||
series={[ | ||
{ | ||
data: [2, -5.5, 2, -7.5, 1.5, 6], | ||
area: true, | ||
baseline: 'min', | ||
}, | ||
]} | ||
width={500} | ||
height={300} | ||
/> |
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
35 changes: 35 additions & 0 deletions
35
docs/data/tree-view/rich-tree-view/editing/ApiMethodUpdateItemLabel.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,35 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/material/Box'; | ||
import Stack from '@mui/material/Stack'; | ||
import Button from '@mui/material/Button'; | ||
import { RichTreeView } from '@mui/x-tree-view/RichTreeView'; | ||
import { useTreeViewApiRef } from '@mui/x-tree-view/hooks'; | ||
import { MUI_X_PRODUCTS } from './products'; | ||
|
||
export default function ApiMethodUpdateItemLabel() { | ||
const [isLabelUpdated, setIsLabelUpdated] = React.useState(false); | ||
const apiRef = useTreeViewApiRef(); | ||
|
||
const handleUpdateLabel = () => { | ||
if (isLabelUpdated) { | ||
apiRef.current.updateItemLabel('grid', 'Data Grid'); | ||
setIsLabelUpdated(false); | ||
} else { | ||
apiRef.current.updateItemLabel('grid', 'New Label'); | ||
setIsLabelUpdated(true); | ||
} | ||
}; | ||
|
||
return ( | ||
<Stack spacing={2}> | ||
<Stack spacing={2} direction="row"> | ||
<Button onClick={handleUpdateLabel}> | ||
{isLabelUpdated ? 'Reset Data Grid label' : 'Change Data Grid label'} | ||
</Button> | ||
</Stack> | ||
<Box sx={{ minHeight: 352, minWidth: 260 }}> | ||
<RichTreeView items={MUI_X_PRODUCTS} apiRef={apiRef} /> | ||
</Box> | ||
</Stack> | ||
); | ||
} |
35 changes: 35 additions & 0 deletions
35
docs/data/tree-view/rich-tree-view/editing/ApiMethodUpdateItemLabel.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,35 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/material/Box'; | ||
import Stack from '@mui/material/Stack'; | ||
import Button from '@mui/material/Button'; | ||
import { RichTreeView } from '@mui/x-tree-view/RichTreeView'; | ||
import { useTreeViewApiRef } from '@mui/x-tree-view/hooks'; | ||
import { MUI_X_PRODUCTS } from './products'; | ||
|
||
export default function ApiMethodUpdateItemLabel() { | ||
const [isLabelUpdated, setIsLabelUpdated] = React.useState(false); | ||
const apiRef = useTreeViewApiRef(); | ||
|
||
const handleUpdateLabel = () => { | ||
if (isLabelUpdated) { | ||
apiRef.current!.updateItemLabel('grid', 'Data Grid'); | ||
setIsLabelUpdated(false); | ||
} else { | ||
apiRef.current!.updateItemLabel('grid', 'New Label'); | ||
setIsLabelUpdated(true); | ||
} | ||
}; | ||
|
||
return ( | ||
<Stack spacing={2}> | ||
<Stack spacing={2} direction="row"> | ||
<Button onClick={handleUpdateLabel}> | ||
{isLabelUpdated ? 'Reset Data Grid label' : 'Change Data Grid label'} | ||
</Button> | ||
</Stack> | ||
<Box sx={{ minHeight: 352, minWidth: 260 }}> | ||
<RichTreeView items={MUI_X_PRODUCTS} apiRef={apiRef} /> | ||
</Box> | ||
</Stack> | ||
); | ||
} |
8 changes: 8 additions & 0 deletions
8
docs/data/tree-view/rich-tree-view/editing/ApiMethodUpdateItemLabel.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,8 @@ | ||
<Stack spacing={2} direction="row"> | ||
<Button onClick={handleUpdateLabel}> | ||
{isLabelUpdated ? 'Reset Data Grid label' : 'Change Data Grid label'} | ||
</Button> | ||
</Stack> | ||
<Box sx={{ minHeight: 352, minWidth: 260 }}> | ||
<RichTreeView items={MUI_X_PRODUCTS} apiRef={apiRef} /> | ||
</Box> |
44 changes: 44 additions & 0 deletions
44
docs/data/tree-view/rich-tree-view/editing/CustomBehavior.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,44 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/material/Box'; | ||
import { RichTreeView } from '@mui/x-tree-view/RichTreeView'; | ||
import { useTreeItem2Utils } from '@mui/x-tree-view/hooks'; | ||
import { TreeItem2 } from '@mui/x-tree-view/TreeItem2'; | ||
|
||
import { MUI_X_PRODUCTS } from './products'; | ||
|
||
const CustomTreeItem2 = React.forwardRef(function CustomTreeItem2(props, ref) { | ||
const { interactions } = useTreeItem2Utils({ | ||
itemId: props.itemId, | ||
children: props.children, | ||
}); | ||
|
||
const handleInputBlur = (event) => { | ||
interactions.handleCancelItemLabelEditing(event); | ||
}; | ||
|
||
return ( | ||
<TreeItem2 | ||
{...props} | ||
ref={ref} | ||
slotProps={{ | ||
labelInput: { | ||
onBlur: handleInputBlur, | ||
}, | ||
}} | ||
/> | ||
); | ||
}); | ||
|
||
export default function CustomBehavior() { | ||
return ( | ||
<Box sx={{ minHeight: 352, minWidth: 260 }}> | ||
<RichTreeView | ||
items={MUI_X_PRODUCTS} | ||
slots={{ item: CustomTreeItem2 }} | ||
experimentalFeatures={{ labelEditing: true }} | ||
isItemEditable | ||
defaultExpandedItems={['grid', 'pickers']} | ||
/> | ||
</Box> | ||
); | ||
} |
47 changes: 47 additions & 0 deletions
47
docs/data/tree-view/rich-tree-view/editing/CustomBehavior.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,47 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/material/Box'; | ||
import { RichTreeView } from '@mui/x-tree-view/RichTreeView'; | ||
import { useTreeItem2Utils } from '@mui/x-tree-view/hooks'; | ||
import { TreeItem2, TreeItem2Props } from '@mui/x-tree-view/TreeItem2'; | ||
import { UseTreeItem2LabelInputSlotOwnProps } from '@mui/x-tree-view/useTreeItem2'; | ||
import { MUI_X_PRODUCTS } from './products'; | ||
|
||
const CustomTreeItem2 = React.forwardRef(function CustomTreeItem2( | ||
props: TreeItem2Props, | ||
ref: React.Ref<HTMLLIElement>, | ||
) { | ||
const { interactions } = useTreeItem2Utils({ | ||
itemId: props.itemId, | ||
children: props.children, | ||
}); | ||
|
||
const handleInputBlur: UseTreeItem2LabelInputSlotOwnProps['onBlur'] = (event) => { | ||
interactions.handleCancelItemLabelEditing(event); | ||
}; | ||
|
||
return ( | ||
<TreeItem2 | ||
{...props} | ||
ref={ref} | ||
slotProps={{ | ||
labelInput: { | ||
onBlur: handleInputBlur, | ||
}, | ||
}} | ||
/> | ||
); | ||
}); | ||
|
||
export default function CustomBehavior() { | ||
return ( | ||
<Box sx={{ minHeight: 352, minWidth: 260 }}> | ||
<RichTreeView | ||
items={MUI_X_PRODUCTS} | ||
slots={{ item: CustomTreeItem2 }} | ||
experimentalFeatures={{ labelEditing: true }} | ||
isItemEditable | ||
defaultExpandedItems={['grid', 'pickers']} | ||
/> | ||
</Box> | ||
); | ||
} |
7 changes: 7 additions & 0 deletions
7
docs/data/tree-view/rich-tree-view/editing/CustomBehavior.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,7 @@ | ||
<RichTreeView | ||
items={MUI_X_PRODUCTS} | ||
slots={{ item: CustomTreeItem2 }} | ||
experimentalFeatures={{ labelEditing: true }} | ||
isItemEditable | ||
defaultExpandedItems={['grid', 'pickers']} | ||
/> |
Oops, something went wrong.