Skip to content

Commit 6fc6b9b

Browse files
authored
Rename textEditor to renderTextEditor (#3908)
* Rename `textEditor` to `renderTextEditor` * Cleanup types * Revret 1 change * Tweak import * rename test file * Combine import * Combine import statements
1 parent 3f7b89b commit 6fc6b9b

24 files changed

+51
-67
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -743,20 +743,20 @@ const columns: readonly Column<Row>[] = [
743743
];
744744
```
745745

746-
#### `textEditor<TRow, TSummaryRow>(props: RenderEditCellProps<TRow, TSummaryRow>)`
746+
#### `renderTextEditor<TRow, TSummaryRow>(props: RenderEditCellProps<TRow, TSummaryRow>)`
747747

748748
A basic text editor provided for convenience.
749749

750750
**Example:**
751751

752752
```tsx
753-
import { textEditor, type Column } from 'react-data-grid';
753+
import { renderTextEditor, type Column } from 'react-data-grid';
754754

755755
const columns: readonly Column<Row>[] = [
756756
{
757757
key: 'title',
758758
name: 'Title',
759-
renderEditCell: textEditor
759+
renderEditCell: renderTextEditor
760760
}
761761
];
762762
```

src/editors/textEditor.tsx renamed to src/editors/renderTextEditor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function autoFocusAndSelect(input: HTMLInputElement | null) {
3838
input?.select();
3939
}
4040

41-
export default function textEditor<TRow, TSummaryRow>({
41+
export default function textTextEditor<TRow, TSummaryRow>({
4242
row,
4343
column,
4444
onRowChange,

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export { default as Row } from './Row';
1212
export { default as Cell } from './Cell';
1313
export * from './Columns';
1414
export * from './cellRenderers';
15-
export { default as textEditor } from './editors/textEditor';
15+
export { default as renderTextEditor } from './editors/renderTextEditor';
1616
export { default as renderHeaderCell } from './renderHeaderCell';
1717
export { renderSortIcon, renderSortPriority } from './sortStatus';
1818
export { useRowSelection, useHeaderRowSelection } from './hooks';
@@ -34,6 +34,7 @@ export type {
3434
ColumnOrColumnGroup,
3535
ColumnWidth,
3636
ColumnWidths,
37+
Direction,
3738
FillEvent,
3839
RenderCellProps,
3940
RenderCheckboxProps,

test/browser/TreeDataGrid.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useState } from 'react';
22
import { page, userEvent } from 'vitest/browser';
33

44
import type { Column } from '../../src';
5-
import { SelectColumn, textEditor, TreeDataGrid } from '../../src';
5+
import { renderTextEditor, SelectColumn, TreeDataGrid } from '../../src';
66
import { focusSinkClassname } from '../../src/style/core';
77
import { rowSelected } from '../../src/style/row';
88
import {
@@ -40,7 +40,7 @@ const columns: readonly Column<Row, SummaryRow>[] = [
4040
{
4141
key: 'country',
4242
name: 'Country',
43-
renderEditCell: textEditor
43+
renderEditCell: renderTextEditor
4444
},
4545
{
4646
key: 'year',

test/browser/TextEditor.test.tsx renamed to test/browser/renderTextEditor.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useState } from 'react';
22
import { page, userEvent } from 'vitest/browser';
33

4-
import { DataGrid, textEditor } from '../../src';
4+
import { DataGrid, renderTextEditor } from '../../src';
55
import type { Column } from '../../src';
66

77
interface Row {
@@ -12,7 +12,7 @@ const columns: readonly Column<Row>[] = [
1212
{
1313
key: 'name',
1414
name: 'Name',
15-
renderEditCell: textEditor,
15+
renderEditCell: renderTextEditor,
1616
editorOptions: {
1717
commitOnOutsideClick: false
1818
}
@@ -26,7 +26,7 @@ function Test() {
2626
return <DataGrid columns={columns} rows={rows} onRowsChange={setRows} />;
2727
}
2828

29-
test('TextEditor', async () => {
29+
test('renderTextEditor', async () => {
3030
await page.render(<Test />);
3131
const cell = page.getByRole('gridcell');
3232
await expect.element(cell).toHaveTextContent(/^Tacitus Kilgore$/);

website/routes/AllFeatures.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { faker } from '@faker-js/faker';
33
import { css } from '@linaria/core';
44
import clsx from 'clsx';
55

6-
import { DataGrid, SelectColumn, textEditor } from '../../src';
6+
import { DataGrid, renderTextEditor, SelectColumn } from '../../src';
77
import type { CalculatedColumn, CellCopyArgs, CellPasteArgs, Column, FillEvent } from '../../src';
8-
import { textEditorClassname } from '../../src/editors/textEditor';
8+
import { textEditorClassname } from '../../src/editors/renderTextEditor';
99
import { useDirection } from '../directionContext';
1010

1111
export const Route = createFileRoute({
@@ -132,71 +132,71 @@ const columns: readonly Column<Row>[] = [
132132
width: 200,
133133
resizable: true,
134134
frozen: true,
135-
renderEditCell: textEditor
135+
renderEditCell: renderTextEditor
136136
},
137137
{
138138
key: 'lastName',
139139
name: 'Last Name',
140140
width: 200,
141141
resizable: true,
142142
frozen: true,
143-
renderEditCell: textEditor
143+
renderEditCell: renderTextEditor
144144
},
145145
{
146146
key: 'email',
147147
name: 'Email',
148148
width: 'max-content',
149149
resizable: true,
150-
renderEditCell: textEditor
150+
renderEditCell: renderTextEditor
151151
},
152152
{
153153
key: 'street',
154154
name: 'Street',
155155
width: 200,
156156
resizable: true,
157-
renderEditCell: textEditor
157+
renderEditCell: renderTextEditor
158158
},
159159
{
160160
key: 'zipCode',
161161
name: 'ZipCode',
162162
width: 200,
163163
resizable: true,
164-
renderEditCell: textEditor
164+
renderEditCell: renderTextEditor
165165
},
166166
{
167167
key: 'date',
168168
name: 'Date',
169169
width: 200,
170170
resizable: true,
171-
renderEditCell: textEditor
171+
renderEditCell: renderTextEditor
172172
},
173173
{
174174
key: 'bs',
175175
name: 'bs',
176176
width: 200,
177177
resizable: true,
178-
renderEditCell: textEditor
178+
renderEditCell: renderTextEditor
179179
},
180180
{
181181
key: 'catchPhrase',
182182
name: 'Catch Phrase',
183183
width: 'max-content',
184184
resizable: true,
185-
renderEditCell: textEditor
185+
renderEditCell: renderTextEditor
186186
},
187187
{
188188
key: 'companyName',
189189
name: 'Company Name',
190190
width: 200,
191191
resizable: true,
192-
renderEditCell: textEditor
192+
renderEditCell: renderTextEditor
193193
},
194194
{
195195
key: 'sentence',
196196
name: 'Sentence',
197197
width: 'max-content',
198198
resizable: true,
199-
renderEditCell: textEditor
199+
renderEditCell: renderTextEditor
200200
}
201201
];
202202

website/routes/Animation.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { useState } from 'react';
22
import { css } from '@linaria/core';
33

4-
import { DataGrid } from '../../src';
5-
import type { Column } from '../../src';
4+
import { DataGrid, type Column } from '../../src';
65
import { useDirection } from '../directionContext';
76

87
export const Route = createFileRoute({

website/routes/ColumnGrouping.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { DataGrid } from '../../src';
2-
import type { ColumnOrColumnGroup } from '../../src';
1+
import { DataGrid, type ColumnOrColumnGroup } from '../../src';
32
import { renderCoordinates } from '../renderers';
43
import { useDirection } from '../directionContext';
54

website/routes/ColumnSpanning.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { css } from '@linaria/core';
22

3-
import { DataGrid } from '../../src';
4-
import type { Column } from '../../src';
3+
import { DataGrid, type Column } from '../../src';
54
import { renderCoordinates } from '../renderers';
65
import { useDirection } from '../directionContext';
76

website/routes/ColumnsReordering.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { useCallback, useMemo, useState } from 'react';
22

3-
import { DataGrid } from '../../src';
4-
import type { Column, ColumnWidths, SortColumn } from '../../src';
3+
import { DataGrid, type Column, type ColumnWidths, type SortColumn } from '../../src';
54
import { startViewTransition } from '../utils';
65
import { useDirection } from '../directionContext';
76

0 commit comments

Comments
 (0)