Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DataGridPremium] Make aggregation public #5592

Merged
merged 3 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions docs/data/data-grid/aggregation/AggregationColDefAggregable.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const COLUMNS = [
headerName: 'Title',
width: 200,
groupable: false,
private_aggregable: false,
aggregable: false,
},
{
field: 'gross',
Expand All @@ -34,7 +34,7 @@ const COLUMNS = [
field: 'year',
headerName: 'Year',
type: 'number',
private_aggregable: false,
aggregable: false,
},
];

Expand All @@ -47,16 +47,14 @@ export default function AggregationColDefAggregable() {
rows={data.rows}
columns={COLUMNS}
initialState={{
private_aggregation: {
aggregation: {
model: {
gross: 'sum',
year: 'sum',
},
},
}}
experimentalFeatures={{
private_aggregation: true,
}}
experimentalFeatures={{ aggregation: true }}
/>
</div>
);
Expand Down
10 changes: 4 additions & 6 deletions docs/data/data-grid/aggregation/AggregationColDefAggregable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const COLUMNS: GridColDef[] = [
headerName: 'Title',
width: 200,
groupable: false,
private_aggregable: false,
aggregable: false,
},
{
field: 'gross',
Expand All @@ -34,7 +34,7 @@ const COLUMNS: GridColDef[] = [
field: 'year',
headerName: 'Year',
type: 'number',
private_aggregable: false,
aggregable: false,
},
];

Expand All @@ -47,16 +47,14 @@ export default function AggregationColDefAggregable() {
rows={data.rows}
columns={COLUMNS}
initialState={{
private_aggregation: {
aggregation: {
model: {
gross: 'sum',
year: 'sum',
},
},
}}
experimentalFeatures={{
private_aggregation: true,
}}
experimentalFeatures={{ aggregation: true }}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
rows={data.rows}
columns={COLUMNS}
initialState={{
private_aggregation: {
aggregation: {
model: {
gross: 'sum',
year: 'sum',
},
},
}}
experimentalFeatures={{
private_aggregation: true,
}}
experimentalFeatures={{ aggregation: true }}
/>
10 changes: 3 additions & 7 deletions docs/data/data-grid/aggregation/AggregationControlled.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,9 @@ export default function AggregationControlled() {
<DataGridPremium
rows={data.rows}
columns={COLUMNS}
private_aggregationModel={aggregationModel}
private_onAggregationModelChange={(newModel) =>
setAggregationModel(newModel)
}
experimentalFeatures={{
private_aggregation: true,
}}
aggregationModel={aggregationModel}
onAggregationModelChange={(newModel) => setAggregationModel(newModel)}
experimentalFeatures={{ aggregation: true }}
/>
</div>
);
Expand Down
10 changes: 3 additions & 7 deletions docs/data/data-grid/aggregation/AggregationControlled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,9 @@ export default function AggregationControlled() {
<DataGridPremium
rows={data.rows}
columns={COLUMNS}
private_aggregationModel={aggregationModel}
private_onAggregationModelChange={(newModel) =>
setAggregationModel(newModel)
}
experimentalFeatures={{
private_aggregation: true,
}}
aggregationModel={aggregationModel}
onAggregationModelChange={(newModel) => setAggregationModel(newModel)}
experimentalFeatures={{ aggregation: true }}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<DataGridPremium
rows={data.rows}
columns={COLUMNS}
private_aggregationModel={aggregationModel}
private_onAggregationModelChange={(newModel) =>
setAggregationModel(newModel)
}
experimentalFeatures={{
private_aggregation: true,
}}
aggregationModel={aggregationModel}
onAggregationModelChange={(newModel) => setAggregationModel(newModel)}
experimentalFeatures={{ aggregation: true }}
/>
14 changes: 6 additions & 8 deletions docs/data/data-grid/aggregation/AggregationCustomFunction.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import {
DataGridPremium,
PRIVATE_GRID_AGGREGATION_FUNCTIONS,
GRID_AGGREGATION_FUNCTIONS,
} from '@mui/x-data-grid-premium';
import { useMovieData } from '@mui/x-data-grid-generator';

Expand All @@ -18,7 +18,7 @@ const COLUMNS = [
headerName: 'Title',
width: 200,
groupable: false,
private_aggregable: false,
aggregable: false,
},
{
field: 'director',
Expand Down Expand Up @@ -76,21 +76,19 @@ export default function AggregationCustomFunction() {
<DataGridPremium
rows={data.rows}
columns={COLUMNS}
private_aggregationFunctions={{
...PRIVATE_GRID_AGGREGATION_FUNCTIONS,
aggregationFunctions={{
...GRID_AGGREGATION_FUNCTIONS,
firstAlphabetical: firstAlphabeticalAggregation,
lastAlphabetical: lastAlphabeticalAggregation,
}}
initialState={{
private_aggregation: {
aggregation: {
model: {
director: 'firstAlphabetical',
},
},
}}
experimentalFeatures={{
private_aggregation: true,
}}
experimentalFeatures={{ aggregation: true }}
/>
</div>
);
Expand Down
14 changes: 6 additions & 8 deletions docs/data/data-grid/aggregation/AggregationCustomFunction.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import {
DataGridPremium,
PRIVATE_GRID_AGGREGATION_FUNCTIONS,
GRID_AGGREGATION_FUNCTIONS,
GridAggregationFunction,
GridColDef,
} from '@mui/x-data-grid-premium';
Expand All @@ -20,7 +20,7 @@ const COLUMNS: GridColDef[] = [
headerName: 'Title',
width: 200,
groupable: false,
private_aggregable: false,
aggregable: false,
},
{
field: 'director',
Expand Down Expand Up @@ -79,21 +79,19 @@ export default function AggregationCustomFunction() {
<DataGridPremium
rows={data.rows}
columns={COLUMNS}
private_aggregationFunctions={{
...PRIVATE_GRID_AGGREGATION_FUNCTIONS,
aggregationFunctions={{
...GRID_AGGREGATION_FUNCTIONS,
firstAlphabetical: firstAlphabeticalAggregation,
lastAlphabetical: lastAlphabeticalAggregation,
}}
initialState={{
private_aggregation: {
aggregation: {
model: {
director: 'firstAlphabetical',
},
},
}}
experimentalFeatures={{
private_aggregation: true,
}}
experimentalFeatures={{ aggregation: true }}
/>
</div>
);
Expand Down
8 changes: 3 additions & 5 deletions docs/data/data-grid/aggregation/AggregationDisabled.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ export default function AggregationDisabled() {
<div style={{ height: 400, width: '100%' }}>
<DataGridPremium
{...data}
private_disableAggregation
initialState={{ private_aggregation: { model: { gross: 'sum' } } }}
experimentalFeatures={{
private_aggregation: true,
}}
disableAggregation
initialState={{ aggregation: { model: { gross: 'sum' } } }}
experimentalFeatures={{ aggregation: true }}
/>
</div>
);
Expand Down
8 changes: 3 additions & 5 deletions docs/data/data-grid/aggregation/AggregationDisabled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ export default function AggregationDisabled() {
<div style={{ height: 400, width: '100%' }}>
<DataGridPremium
{...data}
private_disableAggregation
initialState={{ private_aggregation: { model: { gross: 'sum' } } }}
experimentalFeatures={{
private_aggregation: true,
}}
disableAggregation
initialState={{ aggregation: { model: { gross: 'sum' } } }}
experimentalFeatures={{ aggregation: true }}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<DataGridPremium
{...data}
private_disableAggregation
initialState={{ private_aggregation: { model: { gross: 'sum' } } }}
experimentalFeatures={{
private_aggregation: true,
}}
disableAggregation
initialState={{ aggregation: { model: { gross: 'sum' } } }}
experimentalFeatures={{ aggregation: true }}
/>
6 changes: 3 additions & 3 deletions docs/data/data-grid/aggregation/AggregationFiltering.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function AggregationFiltering() {
rows={data.rows}
columns={COLUMNS}
initialState={{
private_aggregation: {
aggregation: {
model: {
gross: 'max',
},
Expand All @@ -48,9 +48,9 @@ export default function AggregationFiltering() {
},
},
}}
private_aggregationRowsScope="all"
aggregationRowsScope="all"
experimentalFeatures={{
private_aggregation: true,
aggregation: true,
}}
/>
</div>
Expand Down
6 changes: 3 additions & 3 deletions docs/data/data-grid/aggregation/AggregationFiltering.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function AggregationFiltering() {
rows={data.rows}
columns={COLUMNS}
initialState={{
private_aggregation: {
aggregation: {
model: {
gross: 'max',
},
Expand All @@ -48,9 +48,9 @@ export default function AggregationFiltering() {
},
},
}}
private_aggregationRowsScope="all"
aggregationRowsScope="all"
experimentalFeatures={{
private_aggregation: true,
aggregation: true,
}}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function AggregationGetAggregationPosition() {
rowGrouping: {
model: ['company', 'director'],
},
private_aggregation: {
aggregation: {
model: {
gross: 'sum',
},
Expand All @@ -66,12 +66,8 @@ export default function AggregationGetAggregationPosition() {
columns={COLUMNS}
disableSelectionOnClick
initialState={initialState}
private_getAggregationPosition={(groupNode) =>
groupNode == null ? null : 'footer'
}
experimentalFeatures={{
private_aggregation: true,
}}
getAggregationPosition={(groupNode) => (groupNode == null ? null : 'footer')}
experimentalFeatures={{ aggregation: true }}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default function AggregationGetAggregationPosition() {
rowGrouping: {
model: ['company', 'director'],
},
private_aggregation: {
aggregation: {
model: {
gross: 'sum',
},
Expand All @@ -67,12 +67,8 @@ export default function AggregationGetAggregationPosition() {
columns={COLUMNS}
disableSelectionOnClick
initialState={initialState}
private_getAggregationPosition={(groupNode) =>
groupNode == null ? null : 'footer'
}
experimentalFeatures={{
private_aggregation: true,
}}
getAggregationPosition={(groupNode) => (groupNode == null ? null : 'footer')}
experimentalFeatures={{ aggregation: true }}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
columns={COLUMNS}
disableSelectionOnClick
initialState={initialState}
private_getAggregationPosition={(groupNode) =>
groupNode == null ? null : 'footer'
}
experimentalFeatures={{
private_aggregation: true,
}}
getAggregationPosition={(groupNode) => (groupNode == null ? null : 'footer')}
experimentalFeatures={{ aggregation: true }}
/>
6 changes: 2 additions & 4 deletions docs/data/data-grid/aggregation/AggregationInitialState.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,13 @@ export default function AggregationInitialState() {
rows={data.rows}
columns={COLUMNS}
initialState={{
private_aggregation: {
aggregation: {
model: {
gross: 'sum',
},
},
}}
experimentalFeatures={{
private_aggregation: true,
}}
experimentalFeatures={{ aggregation: true }}
/>
</div>
);
Expand Down
Loading