react-data-grid
react-data-grid copied to clipboard
Add prop id to react-data-grid
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch [email protected] for the project I'm working on. I added an id prop.
Here is the diff that solved my problem:
diff --git a/node_modules/react-data-grid/lib/bundle.cjs b/node_modules/react-data-grid/lib/bundle.cjs
index 5ae3bcb..a64c97a 100644
--- a/node_modules/react-data-grid/lib/bundle.cjs
+++ b/node_modules/react-data-grid/lib/bundle.cjs
@@ -1927,7 +1927,8 @@ function DataGrid(props, ref) {
'aria-label': ariaLabel,
'aria-labelledby': ariaLabelledBy,
'aria-describedby': ariaDescribedBy,
- 'data-testid': testId
+ 'data-testid': testId,
+ id: id
} = props;
const defaultRenderers = useDefaultRenderers();
const rowHeight = rawRowHeight ?? 35;
@@ -2723,6 +2724,7 @@ function DataGrid(props, ref) {
onScroll: handleScroll,
onKeyDown: handleKeyDown,
"data-testid": testId,
+ id: id,
children: [hasGroups && /*#__PURE__*/jsxRuntime.jsx("div", {
ref: rowRef,
tabIndex: isGroupRowFocused ? 0 : -1,
diff --git a/node_modules/react-data-grid/lib/bundle.js b/node_modules/react-data-grid/lib/bundle.js
index 88540dd..1480bcd 100644
--- a/node_modules/react-data-grid/lib/bundle.js
+++ b/node_modules/react-data-grid/lib/bundle.js
@@ -1923,7 +1923,8 @@ function DataGrid(props, ref) {
'aria-label': ariaLabel,
'aria-labelledby': ariaLabelledBy,
'aria-describedby': ariaDescribedBy,
- 'data-testid': testId
+ 'data-testid': testId,
+ id: id,
} = props;
const defaultRenderers = useDefaultRenderers();
const rowHeight = rawRowHeight ?? 35;
@@ -2719,6 +2720,7 @@ function DataGrid(props, ref) {
onScroll: handleScroll,
onKeyDown: handleKeyDown,
"data-testid": testId,
+ id: id,
children: [hasGroups && /*#__PURE__*/jsx("div", {
ref: rowRef,
tabIndex: isGroupRowFocused ? 0 : -1,
diff --git a/node_modules/react-data-grid/lib/index.d.ts b/node_modules/react-data-grid/lib/index.d.ts
index d6ac112..2ca3db5 100644
--- a/node_modules/react-data-grid/lib/index.d.ts
+++ b/node_modules/react-data-grid/lib/index.d.ts
@@ -203,6 +203,7 @@ export declare interface DataGridProps<R, SR = unknown, K extends Key = Key> ext
/** @default 'ltr' */
direction?: Maybe<Direction>;
'data-testid'?: Maybe<string>;
+ id?: Maybe<string>;
}
declare const _default: <R, SR = unknown, K extends Key = Key>(props: DataGridProps<R, SR, K> & RefAttributes<DataGridHandle>) => JSX.Element;
This issue body was partially generated by patch-package.
Here is the diff that solved my problem:
Hi, you should describe your pb first before posting a patch, why do you need to add prop id ?
Closing due to inactivity