Skip to content

Commit

Permalink
[data grid] Fix typo on the rowSelectionPropagation feature (#14907)
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviendelangle authored Oct 10, 2024
1 parent f57e81b commit ab03165
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 28 deletions.
8 changes: 4 additions & 4 deletions docs/data/data-grid/row-grouping/row-grouping.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@
"rowSelection": { "description": "If <code>false</code>, the row selection mode is disabled." },
"rowSelectionModel": { "description": "Sets the row selection model of the Data Grid." },
"rowSelectionPropagation": {
"description": "When <code>rowSelectionPropagation.descendants</code> is set to <code>true</code>. - Selecting a parent will auto-select all its filtered descendants. - Deselecting a parent will auto-deselect all its filtered descendants.<br>When <code>rowSelectionPropagation.parents=true</code> - Selecting all descendants of a parent would auto-select it. - Deselecting a descendant of a selected parent would deselect the parent.<br>Works with tree data and row grouping on the client-side only."
"description": "When <code>rowSelectionPropagation.descendants</code> is set to <code>true</code>. - Selecting a parent selects all its filtered descendants automatically. - Deselecting a parent row deselects all its filtered descendants automatically.<br>When <code>rowSelectionPropagation.parents</code> is set to <code>true</code> - Selecting all the filtered descendants of a parent selects the parent automatically. - Deselecting a descendant of a selected parent deselects the parent automatically.<br>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 &#39;client&#39; if you would like enable infnite loading. Set it to &#39;server&#39; if you would like to enable lazy loading. * @default &quot;client&quot;"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@
"rowSelection": { "description": "If <code>false</code>, the row selection mode is disabled." },
"rowSelectionModel": { "description": "Sets the row selection model of the Data Grid." },
"rowSelectionPropagation": {
"description": "When <code>rowSelectionPropagation.descendants</code> is set to <code>true</code>. - Selecting a parent will auto-select all its filtered descendants. - Deselecting a parent will auto-deselect all its filtered descendants.<br>When <code>rowSelectionPropagation.parents=true</code> - Selecting all descendants of a parent would auto-select it. - Deselecting a descendant of a selected parent would deselect the parent.<br>Works with tree data and row grouping on the client-side only."
"description": "When <code>rowSelectionPropagation.descendants</code> is set to <code>true</code>. - Selecting a parent selects all its filtered descendants automatically. - Deselecting a parent row deselects all its filtered descendants automatically.<br>When <code>rowSelectionPropagation.parents</code> is set to <code>true</code> - Selecting all the filtered descendants of a parent selects the parent automatically. - Deselecting a descendant of a selected parent deselects the parent automatically.<br>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 &#39;client&#39; if you would like enable infnite loading. Set it to &#39;server&#39; if you would like to enable lazy loading. * @default &quot;client&quot;"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
10 changes: 5 additions & 5 deletions packages/x-data-grid-pro/src/DataGridPro/DataGridPro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
14 changes: 7 additions & 7 deletions packages/x-data-grid/src/hooks/features/rowSelection/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
};
},
Expand Down
10 changes: 5 additions & 5 deletions packages/x-data-grid/src/models/props/DataGridProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down

0 comments on commit ab03165

Please sign in to comment.