Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviendelangle committed Jul 27, 2021
2 parents 9a16f4c + 6e06fc8 commit d326f6d
Show file tree
Hide file tree
Showing 64 changed files with 1,244 additions and 865 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ jobs:
test_browser:
<<: *defaults
docker:
- image: mcr.microsoft.com/playwright@sha256:bca4179f0a1a0d39efc206917b1d6b0670e93b0d74873c02ee25662a84d11fc0
- image: mcr.microsoft.com/playwright@sha256:1700531ce01a3d974cc440bb8efcf43d31d58ee5f1d354fc21563ea5fe4291e6
environment:
NODE_ENV: development # Needed if playwright is in `devDependencies`
steps:
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/api-docs/data-grid/data-grid.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ import { DataGrid } from '@material-ui/data-grid';
| <span class="prop-name">onCellEditCommit</span> | <span class="prop-type">(params: GridEditCellPropsParams, event: React.SyntheticEvent) => void</span> | | Callback fired when the cell changes are going to be committed. |
| <span class="prop-name">onEditRowModelChange</span> | <span class="prop-type">(params: GridEditRowModelParams) => void</span> | | Callback fired when the EditRowModel changed. |
| <span class="prop-name">onFilterModelChange</span> | <span class="prop-type">(model: GridFilterModel) => void</span> | | Callback fired when the Filter model changes before the filters are applied. |
| <span class="prop-name">onPageChange</span> | <span class="prop-type">(param: GridPageChangeParams) => void</span> | | Callback fired when the current page has changed. |
| <span class="prop-name">onPageSizeChange</span> | <span class="prop-type">(param: GridPageChangeParams) => void</span> | | Callback fired when the page size has changed. |
| <span class="prop-name">onPageChange</span> | <span class="prop-type">(page: number) => void</span> | | Callback fired when the current page has changed. |
| <span class="prop-name">onPageSizeChange</span> | <span class="prop-type">(pageSize: number) => void</span> | | Callback fired when the page size has changed. |
| <span class="prop-name">onResize</span> | <span class="prop-type">(param: GridResizeParams) => void</span> | | Callback fired when the grid is being resized. |
| <span class="prop-name">onRowClick</span> | <span class="prop-type">(param: GridRowParams, event: React.MouseEvent) => void</span> | | Callback fired when a click event comes from a row container element. |
| <span class="prop-name">onRowDoubleClick</span> | <span class="prop-type">(param: GridRowParams, event: React.MouseEvent) => void</span> | | Callback fired when a double click event comes from a row container element. |
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/api-docs/data-grid/grid-col-def.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ import { GridColDef } from '@material-ui/data-grid';
| <span class="prop-name optional">type<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">string</span> | <span class="prop-default">'string'<br /></span> | Type allows to merge this object with a default definition [GridColDef](/api/data-grid/grid-col-def/). |
| <span class="prop-name optional">valueFormatter<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">(params: GridValueFormatterParams) =&gt; GridCellValue</span> | | Function that allows to apply a formatter before rendering its value. |
| <span class="prop-name optional">valueGetter<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">(params: GridValueGetterParams) =&gt; GridCellValue</span> | | Function that allows to get a specific data instead of field to render in the cell. |
| <span class="prop-name optional">valueOptions<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">(string \| { label: string; value: any })[]</span> | | To be used in combination with `type: 'singleSelect'`. This is an array of the possible cell values and labels. |
| <span class="prop-name optional">valueOptions<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">(string \| number \| { label: string; value: any })[]</span> | | To be used in combination with `type: 'singleSelect'`. This is an array of the possible cell values and labels. |
| <span class="prop-name optional">valueParser<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">(value: GridCellValue, params?: GridCellParams) =&gt; GridCellValue</span> | | Function that takes the user-entered value and converts it to a value used internally. |
| <span class="prop-name optional">width<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">number</span> | <span class="prop-default">100<br /></span> | Set the width of the column. |
16 changes: 16 additions & 0 deletions docs/pages/api-docs/data-grid/grid-csv-export-api.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "GridCsvExportApi",
"description": "The CSV export API interface that is available in the grid apiRef.",
"properties": [
{
"name": "exportDataAsCsv",
"description": "Downloads and exports a CSV of the grid&#39;s data.",
"type": "(options?: GridExportCsvOptions) => void"
},
{
"name": "getDataAsCsv",
"description": "Returns the grid data as a CSV string.\nThis method is used internally by <code>exportDataAsCsv</code>.",
"type": "(options?: GridExportCsvOptions) => string"
}
]
}
15 changes: 15 additions & 0 deletions docs/pages/api-docs/data-grid/grid-export-csv-options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import { prepareMarkdown } from 'docs/src/modules/utils/parseMarkdown';

const pageFilename = 'api/grid-export-csv-options';
const requireRaw = require.context('!raw-loader!./', false, /\/grid-export-csv-options\.md$/);

export default function Page({ docs }) {
return <MarkdownDocs docs={docs} />;
}

Page.getInitialProps = () => {
const { demos, docs } = prepareMarkdown({ pageFilename, requireRaw });
return { demos, docs };
};
21 changes: 21 additions & 0 deletions docs/pages/api-docs/data-grid/grid-export-csv-options.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# GridExportCsvOptions Interface

<p class="description">The options to apply on the CSV export.</p>

## Import

```js
import { GridExportCsvOptions } from '@material-ui/x-grid';
// or
import { GridExportCsvOptions } from '@material-ui/data-grid';
```

## Properties

| Name | Type | Default | Description |
| :-------------------------------------------------------------------------------------------- | :-------------------------------------- | :------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------- |
| <span class="prop-name optional">allColumns<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">boolean</span> | <span class="prop-default">false<br /></span> | If `true`, the hidden columns will also be exported. |
| <span class="prop-name optional">delimiter<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">string</span> | <span class="prop-default">','<br /></span> | The character used to separate fields. |
| <span class="prop-name optional">fields<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">string[]</span> | | The columns exported in the CSV.<br />This should only be used if you want to restrict the columns exports. |
| <span class="prop-name optional">fileName<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">string</span> | <span class="prop-default">`document.title`<br /></span> | The string used as the file name. |
| <span class="prop-name optional">utf8WithBom<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">boolean</span> | <span class="prop-default">false<br /></span> | If `true`, the UTF-8 Byte Order Mark (BOM) prefixes the exported file.<br />This can allow Excel to automatically detect file encoding as UTF-8. |
1 change: 1 addition & 0 deletions docs/pages/api-docs/data-grid/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- [GridCellParams](/api/data-grid/grid-cell-params/)
- [GridColDef](/api/data-grid/grid-col-def/)
- [GridRowParams](/api/data-grid/grid-row-params/)
- [GridExportCsvOptions](/api/data-grid/grid-export-csv-options/)

## Events

Expand Down
4 changes: 2 additions & 2 deletions docs/pages/api-docs/data-grid/x-grid.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ import { XGrid } from '@material-ui/x-grid';
| <span class="prop-name">onCellEditCommit</span> | <span class="prop-type">(params: GridEditCellPropsParams, event: React.SyntheticEvent) => void</span> | | Callback fired when the cell changes are going to be committed. |
| <span class="prop-name">onEditRowModelChange</span> | <span class="prop-type">(params: GridEditRowModelParams) => void</span> | | Callback fired when the EditRowModel changed. |
| <span class="prop-name">onFilterModelChange</span> | <span class="prop-type">(model: GridFilterModel) => void</span> | | Callback fired when the Filter model changes before the filters are applied. |
| <span class="prop-name">onPageChange</span> | <span class="prop-type">(param: GridPageChangeParams) => void</span> | | Callback fired when the current page has changed. |
| <span class="prop-name">onPageSizeChange</span> | <span class="prop-type">(param: GridPageChangeParams) => void</span> | | Callback fired when the page size has changed. |
| <span class="prop-name">onPageChange</span> | <span class="prop-type">(page: number) => void</span> | | Callback fired when the current page has changed. |
| <span class="prop-name">onPageSizeChange</span> | <span class="prop-type">(pageSize: number) => void</span> | | Callback fired when the page size has changed. |
| <span class="prop-name">onResize</span> | <span class="prop-type">(param: GridResizeParams) => void</span> | | Callback fired when the grid is being resized. |
| <span class="prop-name">onRowClick</span> | <span class="prop-type">(param: GridRowParams, event: React.MouseEvent) => void</span> | | Callback fired when a click event comes from a row container element. |
| <span class="prop-name">onRowDoubleClick</span> | <span class="prop-type">(param: GridRowParams, event: React.MouseEvent) => void</span> | | Callback fired when a double click event comes from a row container element. |
Expand Down
3 changes: 3 additions & 0 deletions docs/scripts/buildApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ function run(argv: { outputDirectory?: string }) {
'GridRowParams',
'GridSelectionApi',
'GridFilterApi',
'GridCsvExportApi',
'GridExportCsvOptions',
];

apisToGenerate.forEach((apiName) => {
Expand All @@ -243,6 +245,7 @@ function run(argv: { outputDirectory?: string }) {
description: reflection.comment?.shortText,
properties: findProperties(reflection),
};

const slug = kebabCase(reflection!.name);
const markdown = generateMarkdown(api, apisToGenerate);

Expand Down
93 changes: 42 additions & 51 deletions docs/src/pages.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pages from '@material-ui/monorepo/docs/src/pages';

const components = pages[1];
const componentsAPI = pages[2];

if (components.pathname !== '/components') {
throw new Error('Integration not compatible.');
Expand All @@ -12,60 +13,50 @@ if (lab.subheader !== '/components/lab') {
throw new Error('Integration not compatible.');
}

const datagrid = lab.children[3];
const dataGridComponent = lab.children[3];

if (datagrid.subheader !== '/components/data-grid') {
if (dataGridComponent.subheader !== '/components/data-grid') {
throw new Error('Integration not compatible.');
}

datagrid.children =
process.env.PULL_REQUEST === 'false'
? [
{
pathname: '/components/data-grid',
title: 'Overview',
},
{ pathname: '/components/data-grid/demo' },
{ pathname: '/components/data-grid/getting-started' },
{ pathname: '/components/data-grid/layout' },
{ pathname: '/components/data-grid/columns' },
{ pathname: '/components/data-grid/rows' },
{ pathname: '/components/data-grid/editing' },
{ pathname: '/components/data-grid/sorting' },
{ pathname: '/components/data-grid/filtering' },
{ pathname: '/components/data-grid/pagination' },
{ pathname: '/components/data-grid/selection' },
{ pathname: '/components/data-grid/export' },
{ pathname: '/components/data-grid/components' },
{ pathname: '/components/data-grid/style' },
{ pathname: '/components/data-grid/virtualization' },
{ pathname: '/components/data-grid/localization' },
{ pathname: '/components/data-grid/accessibility' },
{ pathname: '/components/data-grid/group-pivot', title: '🚧 Group & Pivot' },
]
: [
{
pathname: '/components/data-grid',
title: 'Overview',
},
{ pathname: '/components/data-grid/demo' },
{ pathname: '/components/data-grid/getting-started' },
{ pathname: '/components/data-grid/layout' },
{ pathname: '/components/data-grid/columns' },
{ pathname: '/components/data-grid/rows' },
{ pathname: '/components/data-grid/editing' },
{ pathname: '/components/data-grid/sorting' },
{ pathname: '/components/data-grid/filtering' },
{ pathname: '/components/data-grid/pagination' },
{ pathname: '/components/data-grid/selection' },
{ pathname: '/components/data-grid/events' },
{ pathname: '/components/data-grid/export' },
{ pathname: '/components/data-grid/components' },
{ pathname: '/components/data-grid/style' },
{ pathname: '/components/data-grid/localization' },
{ pathname: '/components/data-grid/virtualization' },
{ pathname: '/components/data-grid/accessibility' },
{ pathname: '/components/data-grid/group-pivot', title: '🚧 Group & Pivot' },
];
const dataGridComponentAPI = componentsAPI.children.find(
(page) => page.pathname === '/api-docs/data-grid',
);

dataGridComponent.children = [
{
pathname: '/components/data-grid',
title: 'Overview',
},
{ pathname: '/components/data-grid/demo' },
{ pathname: '/components/data-grid/getting-started' },
{ pathname: '/components/data-grid/layout' },
{ pathname: '/components/data-grid/columns' },
{ pathname: '/components/data-grid/rows' },
{ pathname: '/components/data-grid/editing' },
{ pathname: '/components/data-grid/sorting' },
{ pathname: '/components/data-grid/filtering' },
{ pathname: '/components/data-grid/pagination' },
{ pathname: '/components/data-grid/selection' },
{ pathname: '/components/data-grid/events' },
{ pathname: '/components/data-grid/export' },
{ pathname: '/components/data-grid/components' },
{ pathname: '/components/data-grid/style' },
{ pathname: '/components/data-grid/localization' },
{ pathname: '/components/data-grid/virtualization' },
{ pathname: '/components/data-grid/accessibility' },
{ pathname: '/components/data-grid/group-pivot', title: '🚧 Group & Pivot' },
];

dataGridComponentAPI.children = [
{ pathname: '/api-docs/data-grid', title: 'API Reference' },
{ pathname: '/api-docs/data-grid/data-grid', title: 'DataGrid' },
{ pathname: '/api-docs/data-grid/x-grid', title: 'XGrid' },
{ pathname: '/api-docs/data-grid/grid-api', title: 'GridApi' },
{ pathname: '/api-docs/data-grid/grid-col-def', title: 'GridColDef' },
{ pathname: '/api-docs/data-grid/grid-cell-params', title: 'GridCellParams' },
{ pathname: '/api-docs/data-grid/grid-row-params', title: 'GridRowParams' },
{ pathname: '/api-docs/data-grid/grid-export-csv-options', title: 'GridExportCSVOptions' },
];

export default pages;
2 changes: 2 additions & 0 deletions docs/src/pages/components/data-grid/columns/columns.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ const columns: GridColDef[] = [

{{"demo": "pages/components/data-grid/columns/RenderCellGrid.js", "bg": "inline"}}

**Note**: It is recommended to also set a `valueFormatter` providing a representation for the value to be used when [exporting](/components/data-grid/export/#export-custom-rendered-cells) the data.

#### Render edit cell

The `renderCell` render function allows customizing the rendered in "view mode" only.
Expand Down
10 changes: 2 additions & 8 deletions docs/src/pages/components/data-grid/events/events.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,8 @@
"name": "selectionChange",
"description": "Fired when the selection state of one or multiple rows changes.\nCalled with a GridSelectionModelChangeParams object."
},
{
"name": "pageChange",
"description": "Fired when the current page change. Called with a GridPageChangeParams object."
},
{
"name": "pageSizeChange",
"description": "Fired when the page size change. Called with a GridPageChangeParams object."
},
{ "name": "pageChange", "description": "Fired when the page changes." },
{ "name": "pageSizeChange", "description": "Fired when the page size changes." },
{
"name": "rowsScroll",
"description": "Fired during the scroll of the grid viewport. Called with a GridScrollParams object."
Expand Down
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 '../../../../../pages/api-docs/data-grid/grid-csv-export-api.json';

export default function CsvExportApiNoSnap() {
return <ApiDocs api={api} />;
}
Loading

0 comments on commit d326f6d

Please sign in to comment.