-
-
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.
[docs] Migrate Selection pages (#248)
- Loading branch information
1 parent
90b7900
commit f4066ac
Showing
24 changed files
with
288 additions
and
240 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
17 changes: 17 additions & 0 deletions
17
docs/src/pages/components/data-grid/selection/CheckboxSelectionGrid.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,17 @@ | ||
import * as React from 'react'; | ||
import { DataGrid } from '@material-ui/data-grid'; | ||
import { useDemoData } from '@material-ui/x-grid-data-generator'; | ||
|
||
export default function CheckboxSelectionGrid() { | ||
const { data } = useDemoData({ | ||
dataSet: 'Commodity', | ||
rowLength: 10, | ||
maxColumns: 6, | ||
}); | ||
|
||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<DataGrid checkboxSelection {...data} /> | ||
</div> | ||
); | ||
} |
17 changes: 17 additions & 0 deletions
17
docs/src/pages/components/data-grid/selection/CheckboxSelectionGrid.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,17 @@ | ||
import * as React from 'react'; | ||
import { DataGrid } from '@material-ui/data-grid'; | ||
import { useDemoData } from '@material-ui/x-grid-data-generator'; | ||
|
||
export default function CheckboxSelectionGrid() { | ||
const { data } = useDemoData({ | ||
dataSet: 'Commodity', | ||
rowLength: 10, | ||
maxColumns: 6, | ||
}); | ||
|
||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<DataGrid checkboxSelection {...data} /> | ||
</div> | ||
); | ||
} |
26 changes: 26 additions & 0 deletions
26
docs/src/pages/components/data-grid/selection/ControlledSelectionGrid.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,26 @@ | ||
import * as React from 'react'; | ||
import { DataGrid } from '@material-ui/data-grid'; | ||
import { useDemoData } from '@material-ui/x-grid-data-generator'; | ||
|
||
export default function ControlledSelectionGrid() { | ||
const { data } = useDemoData({ | ||
dataSet: 'Commodity', | ||
rowLength: 10, | ||
maxColumns: 6, | ||
}); | ||
|
||
// TODO: /~https://github.com/mui-org/material-ui-x/issues/246 | ||
const [, setSelection] = React.useState([]); | ||
|
||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<DataGrid | ||
checkboxSelection | ||
onSelectionChange={(newSelection) => { | ||
setSelection(newSelection.rows); | ||
}} | ||
{...data} | ||
/> | ||
</div> | ||
); | ||
} |
26 changes: 26 additions & 0 deletions
26
docs/src/pages/components/data-grid/selection/ControlledSelectionGrid.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,26 @@ | ||
import * as React from 'react'; | ||
import { DataGrid, RowData } from '@material-ui/data-grid'; | ||
import { useDemoData } from '@material-ui/x-grid-data-generator'; | ||
|
||
export default function ControlledSelectionGrid() { | ||
const { data } = useDemoData({ | ||
dataSet: 'Commodity', | ||
rowLength: 10, | ||
maxColumns: 6, | ||
}); | ||
|
||
// TODO: /~https://github.com/mui-org/material-ui-x/issues/246 | ||
const [, setSelection] = React.useState<RowData[]>([]); | ||
|
||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<DataGrid | ||
checkboxSelection | ||
onSelectionChange={(newSelection) => { | ||
setSelection(newSelection.rows); | ||
}} | ||
{...data} | ||
/> | ||
</div> | ||
); | ||
} |
24 changes: 24 additions & 0 deletions
24
docs/src/pages/components/data-grid/selection/DisableClickSelectionGrid.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,24 @@ | ||
import * as React from 'react'; | ||
import { DataGrid } from '@material-ui/data-grid'; | ||
import { useDemoData } from '@material-ui/x-grid-data-generator'; | ||
|
||
export default function DisableClickSelectionGrid() { | ||
const { data } = useDemoData({ | ||
dataSet: 'Commodity', | ||
rowLength: 10, | ||
maxColumns: 6, | ||
}); | ||
|
||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<DataGrid | ||
checkboxSelection | ||
{...data} | ||
columns={data.columns.map((column) => ({ | ||
...column, | ||
disableClickEventBubbling: true, | ||
}))} | ||
/> | ||
</div> | ||
); | ||
} |
24 changes: 24 additions & 0 deletions
24
docs/src/pages/components/data-grid/selection/DisableClickSelectionGrid.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,24 @@ | ||
import * as React from 'react'; | ||
import { DataGrid } from '@material-ui/data-grid'; | ||
import { useDemoData } from '@material-ui/x-grid-data-generator'; | ||
|
||
export default function DisableClickSelectionGrid() { | ||
const { data } = useDemoData({ | ||
dataSet: 'Commodity', | ||
rowLength: 10, | ||
maxColumns: 6, | ||
}); | ||
|
||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<DataGrid | ||
checkboxSelection | ||
{...data} | ||
columns={data.columns.map((column) => ({ | ||
...column, | ||
disableClickEventBubbling: true, | ||
}))} | ||
/> | ||
</div> | ||
); | ||
} |
17 changes: 17 additions & 0 deletions
17
docs/src/pages/components/data-grid/selection/MultipleRowSelectionGrid.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,17 @@ | ||
import * as React from 'react'; | ||
import { XGrid } from '@material-ui/x-grid'; | ||
import { useDemoData } from '@material-ui/x-grid-data-generator'; | ||
|
||
export default function MultipleRowSelectionGrid() { | ||
const { data } = useDemoData({ | ||
dataSet: 'Commodity', | ||
rowLength: 10, | ||
maxColumns: 6, | ||
}); | ||
|
||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<XGrid {...data} /> | ||
</div> | ||
); | ||
} |
17 changes: 17 additions & 0 deletions
17
docs/src/pages/components/data-grid/selection/MultipleRowSelectionGrid.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,17 @@ | ||
import * as React from 'react'; | ||
import { XGrid } from '@material-ui/x-grid'; | ||
import { useDemoData } from '@material-ui/x-grid-data-generator'; | ||
|
||
export default function MultipleRowSelectionGrid() { | ||
const { data } = useDemoData({ | ||
dataSet: 'Commodity', | ||
rowLength: 10, | ||
maxColumns: 6, | ||
}); | ||
|
||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<XGrid {...data} /> | ||
</div> | ||
); | ||
} |
17 changes: 17 additions & 0 deletions
17
docs/src/pages/components/data-grid/selection/SingleRowSelectionGrid.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,17 @@ | ||
import * as React from 'react'; | ||
import { DataGrid } from '@material-ui/data-grid'; | ||
import { useDemoData } from '@material-ui/x-grid-data-generator'; | ||
|
||
export default function SingleRowSelectionGrid() { | ||
const { data } = useDemoData({ | ||
dataSet: 'Commodity', | ||
rowLength: 10, | ||
maxColumns: 6, | ||
}); | ||
|
||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<DataGrid {...data} /> | ||
</div> | ||
); | ||
} |
17 changes: 17 additions & 0 deletions
17
docs/src/pages/components/data-grid/selection/SingleRowSelectionGrid.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,17 @@ | ||
import * as React from 'react'; | ||
import { DataGrid } from '@material-ui/data-grid'; | ||
import { useDemoData } from '@material-ui/x-grid-data-generator'; | ||
|
||
export default function SingleRowSelectionGrid() { | ||
const { data } = useDemoData({ | ||
dataSet: 'Commodity', | ||
rowLength: 10, | ||
maxColumns: 6, | ||
}); | ||
|
||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<DataGrid {...data} /> | ||
</div> | ||
); | ||
} |
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
Oops, something went wrong.