From 45fb8311e0c531c2e287aab5cb96cb7920b999de Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Sat, 6 Jan 2024 11:55:00 +0100 Subject: [PATCH] [data grid][docs] Improve Server-side data docs (#11589) --- docs/data/charts/funnel/funnel.md | 2 +- docs/data/charts/gantt/gantt.md | 2 +- docs/data/charts/gauge/gauge.md | 2 +- docs/data/charts/heat-map/heat-map.md | 2 +- docs/data/charts/radar/radar.md | 2 +- docs/data/charts/sankey/sankey.md | 2 +- docs/data/charts/tree-map/tree-map.md | 2 +- .../data-grid/server-side-data/aggregation.md | 2 +- docs/data/data-grid/server-side-data/index.md | 10 +++--- .../server-side-data/infinite-loading.md | 2 +- .../server-side-data/lazy-loading.md | 2 +- .../server-side-data/row-grouping.md | 2 +- .../data-grid/server-side-data/tree-data.md | 2 +- docs/data/pages.ts | 30 ++++++++++------ .../x-data-grid-pro/src/models/dataSource.ts | 36 +++++++++---------- 15 files changed, 54 insertions(+), 46 deletions(-) diff --git a/docs/data/charts/funnel/funnel.md b/docs/data/charts/funnel/funnel.md index 1f17fccca5af..5f1ddf96dc61 100644 --- a/docs/data/charts/funnel/funnel.md +++ b/docs/data/charts/funnel/funnel.md @@ -2,7 +2,7 @@ title: React Funnel chart --- -# Charts - Funnel [](/x/introduction/licensing/#pro-plan 'Pro plan') +# Charts - Funnel [](/x/introduction/licensing/#pro-plan 'Pro plan')🚧

Funnel charts allows to express quantity evolution along a process, such as audience engagement.

diff --git a/docs/data/charts/gantt/gantt.md b/docs/data/charts/gantt/gantt.md index e3c9df5bc52e..41985fa001fe 100644 --- a/docs/data/charts/gantt/gantt.md +++ b/docs/data/charts/gantt/gantt.md @@ -2,7 +2,7 @@ title: React Gantt chart --- -# Charts - Gantt [](/x/introduction/licensing/#pro-plan 'Pro plan') +# Charts - Gantt [](/x/introduction/licensing/#pro-plan 'Pro plan')🚧

Gantt charts can illustrate a schedule and the relationships between its various activities.

diff --git a/docs/data/charts/gauge/gauge.md b/docs/data/charts/gauge/gauge.md index 76f9d4418d41..cd0d255fa377 100644 --- a/docs/data/charts/gauge/gauge.md +++ b/docs/data/charts/gauge/gauge.md @@ -2,7 +2,7 @@ title: React Gauge chart --- -# Charts - Gauge +# Charts - Gauge 🚧

Gauge chart allows to evaluate a metric.

diff --git a/docs/data/charts/heat-map/heat-map.md b/docs/data/charts/heat-map/heat-map.md index 39e8cd66b8c3..ba54c9298f26 100644 --- a/docs/data/charts/heat-map/heat-map.md +++ b/docs/data/charts/heat-map/heat-map.md @@ -2,7 +2,7 @@ title: React Heat map chart --- -# Charts - Heat map +# Charts - Heat map 🚧

Heat map charts allows to highlight correlation between categories.

diff --git a/docs/data/charts/radar/radar.md b/docs/data/charts/radar/radar.md index 620aff31d2f1..26b7fae5115e 100644 --- a/docs/data/charts/radar/radar.md +++ b/docs/data/charts/radar/radar.md @@ -2,7 +2,7 @@ title: React Radar chart --- -# Charts - Radar +# Charts - Radar 🚧

Radar allows to compare multivariate data in a 2D chart.

diff --git a/docs/data/charts/sankey/sankey.md b/docs/data/charts/sankey/sankey.md index 4f27296cf1cc..f828c78cb3e0 100644 --- a/docs/data/charts/sankey/sankey.md +++ b/docs/data/charts/sankey/sankey.md @@ -2,7 +2,7 @@ title: React Sankey chart --- -# Charts - Sankey [](/x/introduction/licensing/#pro-plan 'Pro plan') +# Charts - Sankey [](/x/introduction/licensing/#pro-plan 'Pro plan')🚧

Sankey charts are great for visualizing flows between different elements.

diff --git a/docs/data/charts/tree-map/tree-map.md b/docs/data/charts/tree-map/tree-map.md index d8a116c9584b..d340add7da12 100644 --- a/docs/data/charts/tree-map/tree-map.md +++ b/docs/data/charts/tree-map/tree-map.md @@ -2,7 +2,7 @@ title: React Tree map chart --- -# Charts - Treemap +# Charts - Treemap 🚧

Treemap allows to display data with a hierarchical structure.

diff --git a/docs/data/data-grid/server-side-data/aggregation.md b/docs/data/data-grid/server-side-data/aggregation.md index 3836a25e9ed5..fdbaf839ca6f 100644 --- a/docs/data/data-grid/server-side-data/aggregation.md +++ b/docs/data/data-grid/server-side-data/aggregation.md @@ -2,7 +2,7 @@ title: React Server-side row grouping --- -# Data Grid - Server-side aggregation 🚧 +# Data Grid - Server-side aggregation [](/x/introduction/licensing/#premium-plan 'Premium plan')🚧

Aggregation with server side data source.

diff --git a/docs/data/data-grid/server-side-data/index.md b/docs/data/data-grid/server-side-data/index.md index f235a0558183..13ee31d9b005 100644 --- a/docs/data/data-grid/server-side-data/index.md +++ b/docs/data/data-grid/server-side-data/index.md @@ -2,9 +2,9 @@ title: React Data Grid - Server-side data --- -# Data Grid - Server-side data +# Data Grid - Server-side data 🚧 -

The data grid server-side data

+

The data grid server-side data.

## Overview @@ -26,9 +26,7 @@ const [paginationModel, setPaginationModel] = React.useState({ page: 0, pageSize: 10, }); -const [filterModel, setFilterModel] = React.useState({ - items: [], -}); +const [filterModel, setFilterModel] = React.useState({ items: [] }); const [sortModel, setSortModel] = React.useState([]); React.useEffect(() => { @@ -98,7 +96,7 @@ interface DataSource { Fetcher Functions: - `getRows` is required - `updateRow` is optional - + `getRows` will be used by the grid to fetch data for the current page or children for the current parent group It may return a `rowCount` to update the total count of rows in the grid */ diff --git a/docs/data/data-grid/server-side-data/infinite-loading.md b/docs/data/data-grid/server-side-data/infinite-loading.md index 6c2533f51fad..c317a2bb4fd2 100644 --- a/docs/data/data-grid/server-side-data/infinite-loading.md +++ b/docs/data/data-grid/server-side-data/infinite-loading.md @@ -2,7 +2,7 @@ title: React Server-side infinite loading --- -# Data Grid - Server-side infinite loading 🚧 +# Data Grid - Server-side infinite loading [](/x/introduction/licensing/#pro-plan 'Pro plan')🚧

Row infinite loading with server side data source.

diff --git a/docs/data/data-grid/server-side-data/lazy-loading.md b/docs/data/data-grid/server-side-data/lazy-loading.md index a8430737d67d..849d0c9ba721 100644 --- a/docs/data/data-grid/server-side-data/lazy-loading.md +++ b/docs/data/data-grid/server-side-data/lazy-loading.md @@ -2,7 +2,7 @@ title: React Server-side lazy loading --- -# Data Grid - Server-side lazy loading 🚧 +# Data Grid - Server-side lazy loading [](/x/introduction/licensing/#pro-plan 'Pro plan')🚧

Row lazy-loading with server side data source.

diff --git a/docs/data/data-grid/server-side-data/row-grouping.md b/docs/data/data-grid/server-side-data/row-grouping.md index 72fd21756bc2..3dd487f34f27 100644 --- a/docs/data/data-grid/server-side-data/row-grouping.md +++ b/docs/data/data-grid/server-side-data/row-grouping.md @@ -2,7 +2,7 @@ title: React Server-side row grouping --- -# Data Grid - Server-side row grouping 🚧 +# Data Grid - Server-side row grouping [](/x/introduction/licensing/#pro-plan 'Pro plan')🚧

Lazy-loaded row grouping with server side data source.

diff --git a/docs/data/data-grid/server-side-data/tree-data.md b/docs/data/data-grid/server-side-data/tree-data.md index ed69e9ac25d3..7ce5524f9c16 100644 --- a/docs/data/data-grid/server-side-data/tree-data.md +++ b/docs/data/data-grid/server-side-data/tree-data.md @@ -2,7 +2,7 @@ title: React Server-side tree data --- -# Data Grid - Server-side tree data 🚧 +# Data Grid - Server-side tree data [](/x/introduction/licensing/#pro-plan 'Pro plan')🚧

Tree data lazy-loading with server side data source.

diff --git a/docs/data/pages.ts b/docs/data/pages.ts index f5ecee2f422c..c73604df9ecd 100644 --- a/docs/data/pages.ts +++ b/docs/data/pages.ts @@ -51,7 +51,7 @@ const pages: MuiPage[] = [ { pathname: '/x/react-data-grid/row-definition' }, { pathname: '/x/react-data-grid/row-updates' }, { pathname: '/x/react-data-grid/row-height' }, - { pathname: '/x/react-data-grid/row-spanning', title: 'Row spanning 🚧' }, + { pathname: '/x/react-data-grid/row-spanning', title: 'Row spanning', planned: true }, { pathname: '/x/react-data-grid/master-detail', plan: 'pro' }, { pathname: '/x/react-data-grid/row-ordering', plan: 'pro' }, { pathname: '/x/react-data-grid/row-pinning', plan: 'pro' }, @@ -109,39 +109,49 @@ const pages: MuiPage[] = [ { pathname: '/x/react-data-grid/tree-data', plan: 'pro' }, { pathname: '/x/react-data-grid/row-grouping', plan: 'premium' }, { pathname: '/x/react-data-grid/aggregation', title: 'Aggregation', plan: 'premium' }, - { pathname: '/x/react-data-grid/pivoting', title: 'Pivoting 🚧', plan: 'premium' }, + { + pathname: '/x/react-data-grid/pivoting', + title: 'Pivoting', + plan: 'premium', + planned: true, + }, ], }, { pathname: '/x/react-data-grid/server-side-data-group', - title: 'Server-side data 🚧', - plan: 'pro', + title: 'Server-side data', + planned: true, children: [ - { pathname: '/x/react-data-grid/server-side-data', title: 'Overview' }, + { pathname: '/x/react-data-grid/server-side-data', title: 'Overview', planned: true }, { pathname: '/x/react-data-grid/server-side-data/lazy-loading', - title: 'Lazy loading 🚧', + title: 'Lazy loading', plan: 'pro', + planned: true, }, { pathname: '/x/react-data-grid/server-side-data/infinite-loading', - title: 'Infinite loading 🚧', + title: 'Infinite loading', plan: 'pro', + planned: true, }, { pathname: '/x/react-data-grid/server-side-data/tree-data', - title: 'Tree data 🚧', + title: 'Tree data', plan: 'pro', + planned: true, }, { pathname: '/x/react-data-grid/server-side-data/row-grouping', - title: 'Row grouping 🚧', + title: 'Row grouping', plan: 'pro', + planned: true, }, { pathname: '/x/react-data-grid/server-side-data/aggregation', - title: 'Aggregation 🚧', + title: 'Aggregation', plan: 'premium', + planned: true, }, ], }, diff --git a/packages/grid/x-data-grid-pro/src/models/dataSource.ts b/packages/grid/x-data-grid-pro/src/models/dataSource.ts index e6dc9236529e..3818c77a7201 100644 --- a/packages/grid/x-data-grid-pro/src/models/dataSource.ts +++ b/packages/grid/x-data-grid-pro/src/models/dataSource.ts @@ -10,38 +10,38 @@ interface GetRowsParams { sortModel: GridSortModel; filterModel: GridFilterModel; /** - * Alternate to `start` and `end`, maps to `GridPaginationModel` interface + * Alternate to `start` and `end`, maps to `GridPaginationModel` interface. */ paginationModel: GridPaginationModel; /** - * First row index to fetch (number) or cursor information (number | string) + * First row index to fetch (number) or cursor information (number | string). */ - start: number | string; // first row index to fetch or cursor information + start: number | string; /** - * Last row index to fetch + * Last row index to fetch. */ end: number; // last row index to fetch /** * Array of keys returned by `getGroupKey` of all the parent rows until the row for which the data is requested - * `getGroupKey` prop must be implemented to use this - * Useful for `treeData` and `rowGrouping` only + * `getGroupKey` prop must be implemented to use this. + * Useful for `treeData` and `rowGrouping` only. */ groupKeys: string[]; /** - * List of grouped columns (only applicable with `rowGrouping`) + * List of grouped columns (only applicable with `rowGrouping`). */ - groupFields: GridColDef['field'][]; // list of grouped columns (`rowGrouping`) + groupFields: GridColDef['field'][]; } interface GetRowsResponse { rows: GridRowModel[]; /** - * To reflect updates in total `rowCount` (optional) - * Useful when the `rowCount` is inaccurate (e.g. when filtering) or not available upfront + * To reflect updates in total `rowCount` (optional). + * Useful when the `rowCount` is inaccurate (e.g. when filtering) or not available upfront. */ rowCount?: number; /** - * Additional `pageInfo` to help the grid determine if there are more rows to fetch (corner-cases) + * Additional `pageInfo` to help the grid determine if there are more rows to fetch (corner-cases). * `hasNextPage`: When row count is unknown/inaccurate, if `truncated` is set or rowCount is not known, data will keep loading until `hasNextPage` is `false` * `truncated`: To reflect `rowCount` is inaccurate (will trigger `x-y of many` in pagination after the count of rows fetched is greater than provided `rowCount`) * It could be useful with: @@ -60,13 +60,13 @@ interface GetRowsResponse { export interface DataSource { /** - Fetcher Functions: - - `getRows` is required - - `updateRow` is optional - - `getRows` will be used by the grid to fetch data for the current page or children for the current parent group - It may return a `rowCount` to update the total count of rows in the grid along with the optional `pageInfo` - */ + * Fetcher Functions: + * - `getRows` is required + * - `updateRow` is optional + * + * `getRows` will be used by the grid to fetch data for the current page or children for the current parent group. + * It may return a `rowCount` to update the total count of rows in the grid along with the optional `pageInfo`. + */ getRows(params: GetRowsParams): Promise; updateRow?(rows: GridRowModel): Promise; }