Skip to content

Commit 884073c

Browse files
committed
Merge branch 'main' into pr/Luisgustavom1/3520
2 parents 2551615 + 80e9943 commit 884073c

102 files changed

Lines changed: 1960 additions & 2042 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
---
22
name: Bug report
33
about: Create a bug report
4-
labels: Bug
4+
title: ''
5+
labels: 'Status: Unconfirmed'
6+
assignees: ''
57
---
68

79
## Describe the bug <!-- A clear and concise description of what the bug is. -->
@@ -11,10 +13,12 @@ labels: Bug
1113
1.
1214
2.
1315

14-
Link to code example:
15-
1616
## Expected behavior <!-- A clear and concise description of what you expected to happen. -->
1717

18+
## Link to Minimal Reproducible Example
19+
20+
<!-- Link to a playground, StackBlitz, or GitHub repo with a minimal reproduction of the problem. A minimal reproduction is required. -->
21+
1822
## Environment
1923

2024
- `react-data-grid` version:

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
---
22
name: Feature request
33
about: Request a new feature or enhancement
4+
title: ''
45
labels: Feature Request
6+
assignees: ''
57
---
68

79
## Use case <!-- Please describe what it is you would like to achieve. -->

.github/workflows/ci.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,12 @@ on:
88
jobs:
99
test:
1010
runs-on: ubuntu-latest
11-
strategy:
12-
matrix:
13-
react: [18, 19]
14-
fail-fast: false
1511
steps:
1612
- uses: actions/checkout@v4
1713
- uses: actions/setup-node@v4
1814
with:
1915
node-version: 23
2016
check-latest: true
21-
- name: set up react 19
22-
if: matrix.react == 19
23-
run: |
24-
node ./.github/workflows/patch-react19.js
25-
cat package.json
2617
- name: npm install
2718
run: npm i
2819
- name: Biome
@@ -45,12 +36,11 @@ jobs:
4536
run: node --run test
4637
timeout-minutes: 4
4738
- name: Upload coverage
48-
if: matrix.react == 18
4939
uses: codecov/codecov-action@v5
5040
with:
5141
token: ${{ secrets.CODECOV_TOKEN }}
5242
- name: Deploy gh-pages
53-
if: matrix.react == 18 && github.event_name == 'push' && github.ref == 'refs/heads/main'
43+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
5444
run: |
5545
git config --global user.email 'action@github.com'
5646
git config --global user.name 'GitHub Action'

.github/workflows/patch-react19.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ __screenshots__
88

99
npm-debug.log
1010
**.orig
11+
.idea

README.md

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
## Features
2020

21-
- [React 18.0+](package.json) support
21+
- [React 19.0+](package.json) support
2222
- [Evergreen browsers and server-side rendering](browserslist) support
2323
- Tree-shaking support and only [one npm dependency](package.json) to keep your bundles slim
2424
- Great performance thanks to virtualization: columns and rows outside the viewport are not rendered
@@ -42,7 +42,7 @@
4242
- [Cell copy / pasting](https://adazzle.github.io/react-data-grid/#/AllFeatures)
4343
- [Cell value dragging / filling](https://adazzle.github.io/react-data-grid/#/AllFeatures)
4444
- [Customizable Renderers](https://adazzle.github.io/react-data-grid/#/CustomizableRenderers)
45-
- Right-to-left (RTL) support. We recommend using Firefox as Chrome has a [bug](https://bugs.chromium.org/p/chromium/issues/detail?id=1140374) with frozen columns.
45+
- Right-to-left (RTL) support. We recommend using Firefox as Chrome has a [bug](https://issues.chromium.org/issues/40653832) with frozen columns.
4646

4747
## Links
4848

@@ -57,14 +57,14 @@
5757
npm install react-data-grid
5858
```
5959

60-
`react-data-grid` is published as ECMAScript modules for evergreen browsers / bundlers, and CommonJS for server-side rendering / Jest.
60+
`react-data-grid` is published as ECMAScript modules for evergreen browsers, bundlers, and server-side rendering.
6161

6262
## Quick start
6363

6464
```jsx
6565
import 'react-data-grid/lib/styles.css';
6666

67-
import DataGrid from 'react-data-grid';
67+
import { DataGrid } from 'react-data-grid';
6868

6969
const columns = [
7070
{ key: 'id', name: 'ID' },
@@ -114,7 +114,7 @@ An optional array of summary rows, usually used to display total values for exam
114114
A function returning a unique key/identifier per row. `rowKeyGetter` is required for row selection to work.
115115

116116
```tsx
117-
import DataGrid from 'react-data-grid';
117+
import { DataGrid } from 'react-data-grid';
118118

119119
interface Row {
120120
id: number;
@@ -140,7 +140,7 @@ The second parameter is an object with an `indexes` array highlighting which row
140140

141141
```tsx
142142
import { useState } from 'react';
143-
import DataGrid from 'react-data-grid';
143+
import { DataGrid } from 'react-data-grid';
144144

145145
function MyGrid() {
146146
const [rows, setRows] = useState(initialRows);
@@ -181,7 +181,7 @@ A function called when row selection is changed.
181181

182182
```tsx
183183
import { useState } from 'react';
184-
import DataGrid, { SelectColumn } from 'react-data-grid';
184+
import { DataGrid, SelectColumn } from 'react-data-grid';
185185

186186
const rows: readonly Rows[] = [...];
187187

@@ -224,7 +224,7 @@ A function called when sorting is changed
224224

225225
```tsx
226226
import { useState } from 'react';
227-
import DataGrid, { SelectColumn } from 'react-data-grid';
227+
import { DataGrid, SelectColumn } from 'react-data-grid';
228228

229229
const rows: readonly Rows[] = [...];
230230

@@ -282,10 +282,6 @@ function MyGrid() {
282282

283283
###### `onFill?: Maybe<(event: FillEvent<R>) => R>`
284284

285-
###### `onCopy?: Maybe<(event: CopyEvent<R>) => void>`
286-
287-
###### `onPaste?: Maybe<(event: PasteEvent<R>) => R>`
288-
289285
###### `onCellClick?: Maybe<(args: CellClickArgs<R, SR>, event: CellMouseEvent) => void>`
290286

291287
Triggered when a cell is clicked. The default behavior is to select the cell. Call `preventGridDefault` to prevent the default behavior
@@ -379,7 +375,15 @@ function onCellKeyDown(args: CellKeyDownArgs<R, SR>, event: CellKeyboardEvent) {
379375
}
380376
```
381377

382-
Check [more examples](website/routes/CellNavigation.lazy.tsx)
378+
Check [more examples](website/routes/CellNavigation.tsx)
379+
380+
###### `onCellCopy?: Maybe<(args: CellCopyEvent<NoInfer<R>, NoInfer<SR>>, event: CellClipboardEvent) => void>`
381+
382+
A function called when copy event is triggered on a cell
383+
384+
###### `onCellPaste?: Maybe<(args: CellPasteEvent<NoInfer<R>, NoInfer<SR>>, event: CellClipboardEvent) => void>`
385+
386+
A function called when paste event is triggered on a cell
383387

384388
###### `onSelectedCellChange?: Maybe<(args: CellSelectArgs<R, SR>) => void>;`
385389

@@ -419,16 +423,16 @@ interface Renderers<TRow, TSummaryRow> {
419423
}
420424
```
421425

422-
For example, the default `<Row />` component can be wrapped via the `renderRow` prop to add context providers or tweak props
426+
For example, the default `<Row />` component can be wrapped via the `renderRow` prop to add contexts or tweak props
423427

424428
```tsx
425-
import DataGrid, { RenderRowProps, Row } from 'react-data-grid';
429+
import { DataGrid, RenderRowProps, Row } from 'react-data-grid';
426430

427431
function myRowRenderer(key: React.Key, props: RenderRowProps<Row>) {
428432
return (
429-
<MyContext.Provider key={key} value={123}>
433+
<MyContext key={key} value={123}>
430434
<Row {...props} />
431-
</MyContext.Provider>
435+
</MyContext>
432436
);
433437
}
434438

@@ -444,7 +448,7 @@ function MyGrid() {
444448
A function to add a class on the row
445449

446450
```tsx
447-
import DataGrid from 'react-data-grid';
451+
import { DataGrid } from 'react-data-grid';
448452

449453
function MyGrid() {
450454
return <DataGrid columns={columns} rows={rows} rowClass={rowClass} />;
@@ -455,6 +459,8 @@ function rowClass(row: Row, rowIdx: number) {
455459
}
456460
```
457461

462+
###### `headerRowClass?: Maybe<string>>`
463+
458464
###### `direction?: Maybe<'ltr' | 'rtl'>`
459465

460466
This property sets the text direction of the grid, it defaults to `'ltr'` (left-to-right). Setting `direction` to `'rtl'` has the following effects:

babel.config.json

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
11
{
2-
"presets": [
3-
[
4-
"@babel/env",
5-
{
6-
"loose": true,
7-
"bugfixes": true,
8-
"shippedProposals": true
9-
}
10-
],
11-
["@babel/react", { "runtime": "automatic" }],
12-
"@babel/typescript"
13-
],
14-
"plugins": [
15-
"@babel/transform-runtime",
16-
["optimize-clsx", { "functionNames": ["getCellClassname"] }]
17-
]
2+
"presets": ["@babel/typescript"]
183
}

eslint.config.js

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { fixupPluginRules } from '@eslint/compat';
21
import typescriptEslint from '@typescript-eslint/eslint-plugin';
32
import tsParser from '@typescript-eslint/parser';
43
import vitest from '@vitest/eslint-plugin';
4+
import { defineConfig, globalIgnores } from 'eslint/config';
55
import jestDom from 'eslint-plugin-jest-dom';
66
import react from 'eslint-plugin-react';
77
import reactCompiler from 'eslint-plugin-react-compiler';
@@ -11,18 +11,23 @@ import sonarjs from 'eslint-plugin-sonarjs';
1111
import testingLibrary from 'eslint-plugin-testing-library';
1212
import markdown from '@eslint/markdown';
1313

14-
export default [
14+
export default defineConfig([
15+
globalIgnores(['.cache', 'coverage', 'dist', 'lib']),
16+
1517
{
16-
ignores: ['.cache', 'coverage', 'dist', 'lib']
18+
linterOptions: {
19+
reportUnusedInlineConfigs: 'warn'
20+
}
1721
},
22+
1823
{
1924
name: 'common',
2025
files: ['**/*.{js,ts,tsx}'],
2126

2227
plugins: {
2328
react,
2429
'react-compiler': reactCompiler,
25-
'react-hooks': fixupPluginRules(reactHooks),
30+
'react-hooks': reactHooks,
2631
'react-hooks-extra': reactHooksExtra,
2732
sonarjs,
2833
'@typescript-eslint': typescriptEslint
@@ -387,9 +392,9 @@ export default [
387392

388393
// React Hooks Extra
389394
// https://eslint-react.xyz/
390-
'react-hooks-extra/no-redundant-custom-hook': 1,
391395
'react-hooks-extra/no-unnecessary-use-callback': 1,
392396
'react-hooks-extra/no-unnecessary-use-memo': 1,
397+
'react-hooks-extra/no-useless-custom-hooks': 1,
393398
'react-hooks-extra/prefer-use-state-lazy-initialization': 1,
394399

395400
// SonarJS rules
@@ -472,6 +477,7 @@ export default [
472477
'@typescript-eslint/no-meaningless-void-operator': 0,
473478
'@typescript-eslint/no-misused-new': 1,
474479
'@typescript-eslint/no-misused-promises': 0,
480+
'@typescript-eslint/no-misused-spread': 1,
475481
'@typescript-eslint/no-mixed-enums': 1,
476482
'@typescript-eslint/no-namespace': 1,
477483
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 1,
@@ -563,19 +569,10 @@ export default [
563569
importNames: ['default'],
564570
message: 'Use named imports instead.'
565571
},
566-
{
567-
name: 'react',
568-
importNames: ['useLayoutEffect'],
569-
message: 'Use the override from src/hooks instead.'
570-
},
571572
{
572573
name: 'react-dom',
573574
importNames: ['default'],
574575
message: 'Use named imports instead.'
575-
},
576-
{
577-
name: '@testing-library/dom',
578-
message: 'Import @testing-library/react instead.'
579576
}
580577
],
581578
'@typescript-eslint/no-shadow': 0,
@@ -628,15 +625,7 @@ export default [
628625
'vitest/no-interpolation-in-snapshots': 0,
629626
'vitest/no-large-snapshots': 0,
630627
'vitest/no-mocks-import': 1,
631-
'vitest/no-restricted-matchers': [
632-
1,
633-
{
634-
toBeTruthy: 'Use toBe(true) instead.',
635-
'not.toBeTruthy': null,
636-
toBeFalsy: 'Use toBe(false) instead.',
637-
'not.toBeFalsy': null
638-
}
639-
],
628+
'vitest/no-restricted-matchers': 0,
640629
'vitest/no-restricted-vi-methods': 0,
641630
'vitest/no-standalone-expect': 1,
642631
'vitest/no-test-prefixes': 0,
@@ -653,6 +642,7 @@ export default [
653642
'vitest/prefer-mock-promise-shorthand': 1,
654643
'vitest/prefer-snapshot-hint': 0,
655644
'vitest/prefer-spy-on': 1,
645+
'vitest/prefer-strict-boolean-matchers': 1,
656646
'vitest/prefer-strict-equal': 1,
657647
'vitest/prefer-to-be': 1,
658648
'vitest/prefer-to-be-falsy': 0,
@@ -664,6 +654,7 @@ export default [
664654
'vitest/prefer-vi-mocked': 1,
665655
'vitest/require-hook': 0,
666656
'vitest/require-local-test-context-for-concurrent-snapshots': 0,
657+
'vitest/require-mock-type-parameters': 0,
667658
'vitest/require-to-throw-message': 0,
668659
'vitest/require-top-level-describe': 0,
669660
'vitest/valid-describe-callback': 1,
@@ -707,7 +698,7 @@ export default [
707698
'testing-library/prefer-explicit-assert': 1,
708699
'testing-library/prefer-find-by': 1,
709700
'testing-library/prefer-implicit-assert': 0,
710-
'testing-library/prefer-presence-queries': 1,
701+
'testing-library/prefer-presence-queries': 0,
711702
'testing-library/prefer-query-by-disappearance': 1,
712703
'testing-library/prefer-query-matchers': 0,
713704
'testing-library/prefer-screen-queries': 0,
@@ -748,4 +739,4 @@ export default [
748739
'markdown/no-missing-label-refs': 1
749740
}
750741
}
751-
];
742+
]);

0 commit comments

Comments
 (0)