From 56a6900875aad353bde38ce50340eb7e0f0201df Mon Sep 17 00:00:00 2001 From: Rom Grk Date: Thu, 18 Jul 2024 05:09:31 -0400 Subject: [PATCH] [DataGrid] Expose `gridEditRowsStateSelector` (#13877) --- docs/pages/x/api/data-grid/selectors.json | 6 ++++++ .../src/hooks/features/editing/gridEditingSelectors.ts | 4 +++- packages/x-data-grid/src/hooks/features/editing/index.ts | 1 + packages/x-data-grid/src/hooks/features/index.ts | 1 + scripts/x-data-grid-premium.exports.json | 1 + scripts/x-data-grid-pro.exports.json | 1 + scripts/x-data-grid.exports.json | 1 + 7 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 packages/x-data-grid/src/hooks/features/editing/index.ts diff --git a/docs/pages/x/api/data-grid/selectors.json b/docs/pages/x/api/data-grid/selectors.json index ad0e4aefd23db..092a70faf2623 100644 --- a/docs/pages/x/api/data-grid/selectors.json +++ b/docs/pages/x/api/data-grid/selectors.json @@ -152,6 +152,12 @@ "description": "", "supportsApiRef": false }, + { + "name": "gridEditRowsStateSelector", + "returnType": "GridEditingState", + "description": "Select the row editing state.", + "supportsApiRef": false + }, { "name": "gridExpandedRowCountSelector", "returnType": "number", diff --git a/packages/x-data-grid/src/hooks/features/editing/gridEditingSelectors.ts b/packages/x-data-grid/src/hooks/features/editing/gridEditingSelectors.ts index eb19fe6543730..5ee7bfac20574 100644 --- a/packages/x-data-grid/src/hooks/features/editing/gridEditingSelectors.ts +++ b/packages/x-data-grid/src/hooks/features/editing/gridEditingSelectors.ts @@ -1,4 +1,6 @@ import { GridStateCommunity } from '../../../models/gridStateCommunity'; -// TODO v6: rename to gridEditingStateSelector +/** + * Select the row editing state. + */ export const gridEditRowsStateSelector = (state: GridStateCommunity) => state.editRows; diff --git a/packages/x-data-grid/src/hooks/features/editing/index.ts b/packages/x-data-grid/src/hooks/features/editing/index.ts new file mode 100644 index 0000000000000..5d2d677850c1d --- /dev/null +++ b/packages/x-data-grid/src/hooks/features/editing/index.ts @@ -0,0 +1 @@ +export * from './gridEditingSelectors'; diff --git a/packages/x-data-grid/src/hooks/features/index.ts b/packages/x-data-grid/src/hooks/features/index.ts index 88459db607a09..4bebafde94ae8 100644 --- a/packages/x-data-grid/src/hooks/features/index.ts +++ b/packages/x-data-grid/src/hooks/features/index.ts @@ -4,6 +4,7 @@ export * from './columns'; export * from './columnGrouping'; export * from './columnResize'; export * from './density'; +export * from './editing'; export * from './filter'; export * from './focus'; export * from './pagination'; diff --git a/scripts/x-data-grid-premium.exports.json b/scripts/x-data-grid-premium.exports.json index 095b9e762608d..97afc72b42626 100644 --- a/scripts/x-data-grid-premium.exports.json +++ b/scripts/x-data-grid-premium.exports.json @@ -291,6 +291,7 @@ { "name": "GridEditModes", "kind": "Enum" }, { "name": "GridEditRowApi", "kind": "TypeAlias" }, { "name": "GridEditRowProps", "kind": "TypeAlias" }, + { "name": "gridEditRowsStateSelector", "kind": "Variable" }, { "name": "GridEditSingleSelectCell", "kind": "Function" }, { "name": "GridEditSingleSelectCellProps", "kind": "Interface" }, { "name": "GridEventListener", "kind": "TypeAlias" }, diff --git a/scripts/x-data-grid-pro.exports.json b/scripts/x-data-grid-pro.exports.json index 1f61374d2036a..4ba16d5067781 100644 --- a/scripts/x-data-grid-pro.exports.json +++ b/scripts/x-data-grid-pro.exports.json @@ -265,6 +265,7 @@ { "name": "GridEditModes", "kind": "Enum" }, { "name": "GridEditRowApi", "kind": "TypeAlias" }, { "name": "GridEditRowProps", "kind": "TypeAlias" }, + { "name": "gridEditRowsStateSelector", "kind": "Variable" }, { "name": "GridEditSingleSelectCell", "kind": "Function" }, { "name": "GridEditSingleSelectCellProps", "kind": "Interface" }, { "name": "GridEventListener", "kind": "TypeAlias" }, diff --git a/scripts/x-data-grid.exports.json b/scripts/x-data-grid.exports.json index d6ba9efe3d019..ada1c4cbd3512 100644 --- a/scripts/x-data-grid.exports.json +++ b/scripts/x-data-grid.exports.json @@ -236,6 +236,7 @@ { "name": "GridEditModes", "kind": "Enum" }, { "name": "GridEditRowApi", "kind": "TypeAlias" }, { "name": "GridEditRowProps", "kind": "TypeAlias" }, + { "name": "gridEditRowsStateSelector", "kind": "Variable" }, { "name": "GridEditSingleSelectCell", "kind": "Function" }, { "name": "GridEditSingleSelectCellProps", "kind": "Interface" }, { "name": "GridEventListener", "kind": "TypeAlias" },