Skip to content

Commit

Permalink
public component
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Nov 24, 2020
1 parent bfdaa7b commit dc64394
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const ColumnsPanel: React.FC<{}> = () => {

return (
<React.Fragment>
<div className="MuiDataGrid-panelHeader">
<div className="MuiDataGridPreferences-header">
<TextField
label="Find column"
placeholder="Column Title"
Expand All @@ -97,7 +97,7 @@ export const ColumnsPanel: React.FC<{}> = () => {
fullWidth
/>
</div>
<div className="MuiDataGrid-panelMainContainer">
<div className="MuiDataGridPreferences-container">
<div className={classes.columnsListContainer}>
{currentColumns.map((column) => (
<div key={column.field} className={classes.column}>
Expand All @@ -123,7 +123,7 @@ export const ColumnsPanel: React.FC<{}> = () => {
))}
</div>
</div>
<div className="MuiDataGrid-panelFooter">
<div className="MuiDataGridPreferences-footer">
<Button onClick={hideAllColumns} color="primary">
Hide All
</Button>
Expand Down
4 changes: 2 additions & 2 deletions packages/grid/_modules_/grid/components/tools/FilterPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const FilterPanel: React.FC<{}> = () => {

return (
<React.Fragment>
<div className="MuiDataGrid-panelMainContainer">
<div className="MuiDataGridPreferences-container">
{gridState.filter.items.map((item, index) => (
<FilterForm
key={item.id}
Expand All @@ -76,7 +76,7 @@ export const FilterPanel: React.FC<{}> = () => {
))}
</div>
{!disableMultipleColumnsFiltering && (
<div className="MuiDataGrid-panelFooter">
<div className="MuiDataGridPreferences-footer">
<Button onClick={addNewFilter} startIcon={<AddIcon />} color="primary">
Add Filter
</Button>
Expand Down
59 changes: 31 additions & 28 deletions packages/grid/_modules_/grid/components/tools/Preferences.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,42 @@ import { ApiContext } from '../api-context';
import { ColumnsPanel } from './ColumnsPanel';
import { FilterPanel } from './FilterPanel';

const useStyles = makeStyles((theme: Theme) => ({
paper: {
backgroundColor: theme.palette.background.paper,
minWidth: 300,
display: 'flex',
flexDirection: 'column',
},
tabsRoot: {
flexShrink: 0,
},
tab: {
minWidth: 50,
},
panel: {
display: 'flex',
flexDirection: 'column',
overflow: 'hidden',
flex: 1,
'& .MuiDataGrid-panelMainContainer': {
const useStyles = makeStyles(
(theme: Theme) => ({
paper: {
backgroundColor: theme.palette.background.paper,
minWidth: 300,
display: 'flex',
flexDirection: 'column',
overflow: 'auto',
flex: '1 1',
},
'& .MuiDataGrid-panelFooter, .MuiDataGrid-panelHeader': {
padding: 8,
display: 'inline-flex',
justifyContent: 'space-between',
tabsRoot: {
flexShrink: 0,
},
},
}));
tab: {
minWidth: 50,
},
panel: {
display: 'flex',
flexDirection: 'column',
overflow: 'hidden',
flex: 1,
'& .MuiDataGridPreferences-container': {
display: 'flex',
flexDirection: 'column',
overflow: 'auto',
flex: '1 1',
},
'& .MuiDataGridPreferences-footer, .MuiDataGridPreferences-header': {
padding: 8,
display: 'inline-flex',
justifyContent: 'space-between',
},
},
}),
{ name: 'MuiDataGridPreference' },
);

export const PreferencesPanel = () => {
export function Preferences() {
const classes = useStyles();
const apiRef = React.useContext(ApiContext);
const columns = useGridSelector(apiRef, allColumnsSelector);
Expand Down
2 changes: 1 addition & 1 deletion packages/grid/_modules_/grid/models/api/columnApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export interface ColumnApi {
/**
* Allows to toggle a column.
* @param field
* @param forceHide optional value, if not provided the column will toggle
* @param forceHide Optional value, if not provided the column will toggle.
*/
toggleColumn: (field: string, forceHide?: boolean) => void;
}
8 changes: 4 additions & 4 deletions packages/grid/_modules_/grid/models/gridOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ export interface GridOptions {
*/
disableMultipleSelection?: boolean;
/**
* If `true`, sorting with multiple columns is disabled.
* If `true`, filtering with multiple columns is disabled.
* @default false
*/
disableMultipleColumnsSorting?: boolean;
disableMultipleColumnsFiltering?: boolean;
/**
* If `true`, filtering with multiple columns is disabled.
* If `true`, sorting with multiple columns is disabled.
* @default false
*/
disableMultipleColumnsFiltering?: boolean;
disableMultipleColumnsSorting?: boolean;
/**
* If `true`, resizing columns is disabled.
* @default false
Expand Down

0 comments on commit dc64394

Please sign in to comment.