-
-
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.
- Loading branch information
Showing
92 changed files
with
2,751 additions
and
127 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
Large diffs are not rendered by default.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
docs/pages/api-docs/data-grid/grid-column-pinning-api.json
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,27 @@ | ||
{ | ||
"name": "GridColumnPinningApi", | ||
"description": "The column pinning API interface that is available in the grid apiRef.", | ||
"properties": [ | ||
{ | ||
"name": "getPinnedColumns", | ||
"description": "Returns which columns are pinned.", | ||
"type": "() => GridPinnedColumns" | ||
}, | ||
{ | ||
"name": "isColumnPinned", | ||
"description": "Returns which side a column is pinned to.", | ||
"type": "(field: string) => string | false" | ||
}, | ||
{ | ||
"name": "pinColumn", | ||
"description": "Pins a column to the left or right side of the grid.", | ||
"type": "(field: string, side: left | right) => void" | ||
}, | ||
{ | ||
"name": "setPinnedColumns", | ||
"description": "Changes the pinned columns.", | ||
"type": "(pinnedColumns: GridPinnedColumns) => void" | ||
}, | ||
{ "name": "unpinColumn", "description": "Unpins a column.", "type": "(field: string) => void" } | ||
] | ||
} |
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
134 changes: 134 additions & 0 deletions
134
docs/src/pages/components/data-grid/columns/BasicColumnPinning.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,134 @@ | ||
import * as React from 'react'; | ||
import DeleteIcon from '@mui/icons-material/Delete'; | ||
import EditIcon from '@mui/icons-material/Edit'; | ||
import { DataGridPro, GridActionsCellItem } from '@mui/x-data-grid-pro'; | ||
import { | ||
randomCreatedDate, | ||
randomTraderName, | ||
randomEmail, | ||
randomUpdatedDate, | ||
} from '@mui/x-data-grid-generator'; | ||
|
||
export default function BasicColumnPinning() { | ||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<DataGridPro | ||
rows={rows} | ||
columns={columns} | ||
initialState={{ pinnedColumns: { left: ['name'], right: ['actions'] } }} | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
const columns = [ | ||
{ field: 'name', headerName: 'Name', width: 160, editable: true }, | ||
{ field: 'email', headerName: 'Email', width: 200, editable: true }, | ||
{ field: 'age', headerName: 'Age', type: 'number', editable: true }, | ||
{ | ||
field: 'dateCreated', | ||
headerName: 'Date Created', | ||
type: 'date', | ||
width: 180, | ||
editable: true, | ||
}, | ||
{ | ||
field: 'lastLogin', | ||
headerName: 'Last Login', | ||
type: 'dateTime', | ||
width: 220, | ||
editable: true, | ||
}, | ||
{ | ||
field: 'actions', | ||
type: 'actions', | ||
width: 100, | ||
getActions: () => [ | ||
<GridActionsCellItem icon={<EditIcon />} label="Edit" />, | ||
<GridActionsCellItem icon={<DeleteIcon />} label="Delete" />, | ||
], | ||
}, | ||
]; | ||
|
||
const rows = [ | ||
{ | ||
id: 1, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 25, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 2, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 36, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 3, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 19, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 4, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 28, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 5, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 23, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 6, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 27, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 7, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 18, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 8, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 31, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 9, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 24, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 10, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 35, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
]; |
139 changes: 139 additions & 0 deletions
139
docs/src/pages/components/data-grid/columns/BasicColumnPinning.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,139 @@ | ||
import * as React from 'react'; | ||
import DeleteIcon from '@mui/icons-material/Delete'; | ||
import EditIcon from '@mui/icons-material/Edit'; | ||
import { | ||
DataGridPro, | ||
GridColumns, | ||
GridRowsProp, | ||
GridActionsCellItem, | ||
} from '@mui/x-data-grid-pro'; | ||
import { | ||
randomCreatedDate, | ||
randomTraderName, | ||
randomEmail, | ||
randomUpdatedDate, | ||
} from '@mui/x-data-grid-generator'; | ||
|
||
export default function BasicColumnPinning() { | ||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<DataGridPro | ||
rows={rows} | ||
columns={columns} | ||
initialState={{ pinnedColumns: { left: ['name'], right: ['actions'] } }} | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
const columns: GridColumns = [ | ||
{ field: 'name', headerName: 'Name', width: 160, editable: true }, | ||
{ field: 'email', headerName: 'Email', width: 200, editable: true }, | ||
{ field: 'age', headerName: 'Age', type: 'number', editable: true }, | ||
{ | ||
field: 'dateCreated', | ||
headerName: 'Date Created', | ||
type: 'date', | ||
width: 180, | ||
editable: true, | ||
}, | ||
{ | ||
field: 'lastLogin', | ||
headerName: 'Last Login', | ||
type: 'dateTime', | ||
width: 220, | ||
editable: true, | ||
}, | ||
{ | ||
field: 'actions', | ||
type: 'actions', | ||
width: 100, | ||
getActions: () => [ | ||
<GridActionsCellItem icon={<EditIcon />} label="Edit" />, | ||
<GridActionsCellItem icon={<DeleteIcon />} label="Delete" />, | ||
], | ||
}, | ||
]; | ||
|
||
const rows: GridRowsProp = [ | ||
{ | ||
id: 1, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 25, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 2, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 36, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 3, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 19, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 4, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 28, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 5, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 23, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 6, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 27, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 7, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 18, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 8, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 31, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 9, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 24, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
{ | ||
id: 10, | ||
name: randomTraderName(), | ||
email: randomEmail(), | ||
age: 35, | ||
dateCreated: randomCreatedDate(), | ||
lastLogin: randomUpdatedDate(), | ||
}, | ||
]; |
5 changes: 5 additions & 0 deletions
5
docs/src/pages/components/data-grid/columns/BasicColumnPinning.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,5 @@ | ||
<DataGridPro | ||
rows={rows} | ||
columns={columns} | ||
initialState={{ pinnedColumns: { left: ['name'], right: ['actions'] } }} | ||
/> |
7 changes: 7 additions & 0 deletions
7
docs/src/pages/components/data-grid/columns/ColumnPinningApiNoSnap.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,7 @@ | ||
import React from 'react'; | ||
import ApiDocs from 'docsx/src/modules/components/ApiDocs'; | ||
import api from 'docsx/pages/api-docs/data-grid/grid-column-pinning-api.json'; | ||
|
||
export default function ColumnPinningApiNoSnap() { | ||
return <ApiDocs api={api} />; | ||
} |
Oops, something went wrong.