From ab03165ec02848a5275562bdb07c500d2f3f352e Mon Sep 17 00:00:00 2001 From: Flavien DELANGLE Date: Thu, 10 Oct 2024 13:29:23 +0200 Subject: [PATCH] [data grid] Fix typo on the `rowSelectionPropagation` feature (#14907) --- docs/data/data-grid/row-grouping/row-grouping.md | 8 ++++---- .../data-grid-premium/data-grid-premium.json | 2 +- .../data-grid/data-grid-pro/data-grid-pro.json | 2 +- .../src/DataGridPremium/DataGridPremium.tsx | 10 +++++----- .../src/DataGridPro/DataGridPro.tsx | 10 +++++----- .../src/hooks/features/rowSelection/utils.ts | 14 +++++++------- .../x-data-grid/src/models/props/DataGridProps.ts | 10 +++++----- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/docs/data/data-grid/row-grouping/row-grouping.md b/docs/data/data-grid/row-grouping/row-grouping.md index e2b23b3f884a..b70899fb38b4 100644 --- a/docs/data/data-grid/row-grouping/row-grouping.md +++ b/docs/data/data-grid/row-grouping/row-grouping.md @@ -321,13 +321,13 @@ type GridRowSelectionPropagation = { When `rowSelectionPropagation.descendants` is set to `true`. -- Selecting a parent would auto-select all its filtered descendants. -- Deselecting a parent row would auto-deselect all its filtered descendants. +- Selecting a parent selects all its filtered descendants automatically. +- Deselecting a parent row deselects all its filtered descendants automatically. When `rowSelectionPropagation.parents` is set to `true`. -- Selecting all the filtered descendants of a parent would auto-select the parent. -- Deselecting a descendant of a selected parent would auto-deselect the parent. +- Selecting all the filtered descendants of a parent selects the parent automatically. +- Deselecting a descendant of a selected parent deselects the parent automatically. The example below demonstrates the usage of the `rowSelectionPropagation` prop. diff --git a/docs/translations/api-docs/data-grid/data-grid-premium/data-grid-premium.json b/docs/translations/api-docs/data-grid/data-grid-premium/data-grid-premium.json index 28635d8a0a7f..78865102281c 100644 --- a/docs/translations/api-docs/data-grid/data-grid-premium/data-grid-premium.json +++ b/docs/translations/api-docs/data-grid/data-grid-premium/data-grid-premium.json @@ -619,7 +619,7 @@ "rowSelection": { "description": "If false, the row selection mode is disabled." }, "rowSelectionModel": { "description": "Sets the row selection model of the Data Grid." }, "rowSelectionPropagation": { - "description": "When rowSelectionPropagation.descendants is set to true. - Selecting a parent will auto-select all its filtered descendants. - Deselecting a parent will auto-deselect all its filtered descendants.
When rowSelectionPropagation.parents=true - Selecting all descendants of a parent would auto-select it. - Deselecting a descendant of a selected parent would deselect the parent.
Works with tree data and row grouping on the client-side only." + "description": "When rowSelectionPropagation.descendants is set to true. - Selecting a parent selects all its filtered descendants automatically. - Deselecting a parent row deselects all its filtered descendants automatically.
When rowSelectionPropagation.parents is set to true - Selecting all the filtered descendants of a parent selects the parent automatically. - Deselecting a descendant of a selected parent deselects the parent automatically.
Works with tree data and row grouping on the client-side only." }, "rowsLoadingMode": { "description": "Loading rows can be processed on the server or client-side. Set it to 'client' if you would like enable infnite loading. Set it to 'server' if you would like to enable lazy loading. * @default "client"" diff --git a/docs/translations/api-docs/data-grid/data-grid-pro/data-grid-pro.json b/docs/translations/api-docs/data-grid/data-grid-pro/data-grid-pro.json index 6423bffb2f05..a0509f2e4549 100644 --- a/docs/translations/api-docs/data-grid/data-grid-pro/data-grid-pro.json +++ b/docs/translations/api-docs/data-grid/data-grid-pro/data-grid-pro.json @@ -561,7 +561,7 @@ "rowSelection": { "description": "If false, the row selection mode is disabled." }, "rowSelectionModel": { "description": "Sets the row selection model of the Data Grid." }, "rowSelectionPropagation": { - "description": "When rowSelectionPropagation.descendants is set to true. - Selecting a parent will auto-select all its filtered descendants. - Deselecting a parent will auto-deselect all its filtered descendants.
When rowSelectionPropagation.parents=true - Selecting all descendants of a parent would auto-select it. - Deselecting a descendant of a selected parent would deselect the parent.
Works with tree data and row grouping on the client-side only." + "description": "When rowSelectionPropagation.descendants is set to true. - Selecting a parent selects all its filtered descendants automatically. - Deselecting a parent row deselects all its filtered descendants automatically.
When rowSelectionPropagation.parents is set to true - Selecting all the filtered descendants of a parent selects the parent automatically. - Deselecting a descendant of a selected parent deselects the parent automatically.
Works with tree data and row grouping on the client-side only." }, "rowsLoadingMode": { "description": "Loading rows can be processed on the server or client-side. Set it to 'client' if you would like enable infnite loading. Set it to 'server' if you would like to enable lazy loading. * @default "client"" diff --git a/packages/x-data-grid-premium/src/DataGridPremium/DataGridPremium.tsx b/packages/x-data-grid-premium/src/DataGridPremium/DataGridPremium.tsx index fe7edf11922e..89e77912b74c 100644 --- a/packages/x-data-grid-premium/src/DataGridPremium/DataGridPremium.tsx +++ b/packages/x-data-grid-premium/src/DataGridPremium/DataGridPremium.tsx @@ -994,12 +994,12 @@ DataGridPremiumRaw.propTypes = { ]), /** * When `rowSelectionPropagation.descendants` is set to `true`. - * - Selecting a parent will auto-select all its filtered descendants. - * - Deselecting a parent will auto-deselect all its filtered descendants. + * - Selecting a parent selects all its filtered descendants automatically. + * - Deselecting a parent row deselects all its filtered descendants automatically. * - * When `rowSelectionPropagation.parents=true` - * - Selecting all descendants of a parent would auto-select it. - * - Deselecting a descendant of a selected parent would deselect the parent. + * When `rowSelectionPropagation.parents` is set to `true` + * - Selecting all the filtered descendants of a parent selects the parent automatically. + * - Deselecting a descendant of a selected parent deselects the parent automatically. * * Works with tree data and row grouping on the client-side only. * @default { parents: false, descendants: false } diff --git a/packages/x-data-grid-pro/src/DataGridPro/DataGridPro.tsx b/packages/x-data-grid-pro/src/DataGridPro/DataGridPro.tsx index 61d2eaf0dfd6..4590c79ccfdf 100644 --- a/packages/x-data-grid-pro/src/DataGridPro/DataGridPro.tsx +++ b/packages/x-data-grid-pro/src/DataGridPro/DataGridPro.tsx @@ -900,12 +900,12 @@ DataGridProRaw.propTypes = { ]), /** * When `rowSelectionPropagation.descendants` is set to `true`. - * - Selecting a parent will auto-select all its filtered descendants. - * - Deselecting a parent will auto-deselect all its filtered descendants. + * - Selecting a parent selects all its filtered descendants automatically. + * - Deselecting a parent row deselects all its filtered descendants automatically. * - * When `rowSelectionPropagation.parents=true` - * - Selecting all descendants of a parent would auto-select it. - * - Deselecting a descendant of a selected parent would deselect the parent. + * When `rowSelectionPropagation.parents` is set to `true` + * - Selecting all the filtered descendants of a parent selects the parent automatically. + * - Deselecting a descendant of a selected parent deselects the parent automatically. * * Works with tree data and row grouping on the client-side only. * @default { parents: false, descendants: false } diff --git a/packages/x-data-grid/src/hooks/features/rowSelection/utils.ts b/packages/x-data-grid/src/hooks/features/rowSelection/utils.ts index ba1ff85f77be..ce2aa20c4e3b 100644 --- a/packages/x-data-grid/src/hooks/features/rowSelection/utils.ts +++ b/packages/x-data-grid/src/hooks/features/rowSelection/utils.ts @@ -69,8 +69,8 @@ export function getCheckboxPropsSelector(groupId: GridRowId, autoSelectParents: }; } - let selectableDescendentsCount = 0; - let selectedDescendentsCount = 0; + let selectableDescendantsCount = 0; + let selectedDescendantsCount = 0; const startIndex = sortedRowIds.findIndex((id) => id === groupId) + 1; for ( let index = startIndex; @@ -79,19 +79,19 @@ export function getCheckboxPropsSelector(groupId: GridRowId, autoSelectParents: ) { const id = sortedRowIds[index]; if (filteredRowsLookup[id] !== false) { - selectableDescendentsCount += 1; + selectableDescendantsCount += 1; if (rowSelectionLookup[id] !== undefined) { - selectedDescendentsCount += 1; + selectedDescendantsCount += 1; } } } return { isIndeterminate: - (selectedDescendentsCount > 0 && selectedDescendentsCount < selectableDescendentsCount) || - (selectedDescendentsCount === selectableDescendentsCount && + (selectedDescendantsCount > 0 && selectedDescendantsCount < selectableDescendantsCount) || + (selectedDescendantsCount === selectableDescendantsCount && rowSelectionLookup[groupId] === undefined), isChecked: autoSelectParents - ? selectedDescendentsCount > 0 + ? selectedDescendantsCount > 0 : rowSelectionLookup[groupId] === groupId, }; }, diff --git a/packages/x-data-grid/src/models/props/DataGridProps.ts b/packages/x-data-grid/src/models/props/DataGridProps.ts index fb15191033ad..866b882977f6 100644 --- a/packages/x-data-grid/src/models/props/DataGridProps.ts +++ b/packages/x-data-grid/src/models/props/DataGridProps.ts @@ -842,12 +842,12 @@ export interface DataGridProSharedPropsWithDefaultValue { headerFilters: boolean; /** * When `rowSelectionPropagation.descendants` is set to `true`. - * - Selecting a parent will auto-select all its filtered descendants. - * - Deselecting a parent will auto-deselect all its filtered descendants. + * - Selecting a parent selects all its filtered descendants automatically. + * - Deselecting a parent row deselects all its filtered descendants automatically. * - * When `rowSelectionPropagation.parents=true` - * - Selecting all descendants of a parent would auto-select it. - * - Deselecting a descendant of a selected parent would deselect the parent. + * When `rowSelectionPropagation.parents` is set to `true` + * - Selecting all the filtered descendants of a parent selects the parent automatically. + * - Deselecting a descendant of a selected parent deselects the parent automatically. * * Works with tree data and row grouping on the client-side only. * @default { parents: false, descendants: false }