Skip to content

Commit 7e7c1f0

Browse files
committed
Rename textEditor to renderTextEditor
1 parent 3f7b89b commit 7e7c1f0

File tree

9 files changed

+45
-36
lines changed

9 files changed

+45
-36
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
```
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/TextEditor.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$/);

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',

website/routes/AllFeatures.tsx

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@ 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';
7-
import type { CalculatedColumn, CellCopyArgs, CellPasteArgs, Column, FillEvent } from '../../src';
8-
import { textEditorClassname } from '../../src/editors/textEditor';
6+
import {
7+
DataGrid,
8+
renderTextEditor,
9+
SelectColumn,
10+
type CalculatedColumn,
11+
type CellCopyArgs,
12+
type CellPasteArgs,
13+
type Column,
14+
type FillEvent
15+
} from '../../src';
16+
import { textEditorClassname } from '../../src/editors/renderTextEditor';
917
import { useDirection } from '../directionContext';
1018

1119
export const Route = createFileRoute({
@@ -132,71 +140,71 @@ const columns: readonly Column<Row>[] = [
132140
width: 200,
133141
resizable: true,
134142
frozen: true,
135-
renderEditCell: textEditor
143+
renderEditCell: renderTextEditor
136144
},
137145
{
138146
key: 'lastName',
139147
name: 'Last Name',
140148
width: 200,
141149
resizable: true,
142150
frozen: true,
143-
renderEditCell: textEditor
151+
renderEditCell: renderTextEditor
144152
},
145153
{
146154
key: 'email',
147155
name: 'Email',
148156
width: 'max-content',
149157
resizable: true,
150-
renderEditCell: textEditor
158+
renderEditCell: renderTextEditor
151159
},
152160
{
153161
key: 'street',
154162
name: 'Street',
155163
width: 200,
156164
resizable: true,
157-
renderEditCell: textEditor
165+
renderEditCell: renderTextEditor
158166
},
159167
{
160168
key: 'zipCode',
161169
name: 'ZipCode',
162170
width: 200,
163171
resizable: true,
164-
renderEditCell: textEditor
172+
renderEditCell: renderTextEditor
165173
},
166174
{
167175
key: 'date',
168176
name: 'Date',
169177
width: 200,
170178
resizable: true,
171-
renderEditCell: textEditor
179+
renderEditCell: renderTextEditor
172180
},
173181
{
174182
key: 'bs',
175183
name: 'bs',
176184
width: 200,
177185
resizable: true,
178-
renderEditCell: textEditor
186+
renderEditCell: renderTextEditor
179187
},
180188
{
181189
key: 'catchPhrase',
182190
name: 'Catch Phrase',
183191
width: 'max-content',
184192
resizable: true,
185-
renderEditCell: textEditor
193+
renderEditCell: renderTextEditor
186194
},
187195
{
188196
key: 'companyName',
189197
name: 'Company Name',
190198
width: 200,
191199
resizable: true,
192-
renderEditCell: textEditor
200+
renderEditCell: renderTextEditor
193201
},
194202
{
195203
key: 'sentence',
196204
name: 'Sentence',
197205
width: 'max-content',
198206
resizable: true,
199-
renderEditCell: textEditor
207+
renderEditCell: renderTextEditor
200208
}
201209
];
202210

website/routes/CommonFeatures.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import { css } from '@linaria/core';
55

66
import {
77
DataGrid,
8+
renderTextEditor,
89
SelectCellFormatter,
910
SelectColumn,
10-
textEditor,
1111
type Column,
1212
type DataGridHandle,
13+
type Direction,
1314
type SortColumn
1415
} from '../../src';
15-
import { textEditorClassname } from '../../src/editors/textEditor';
16-
import type { Direction } from '../../src/types';
16+
import { textEditorClassname } from '../../src/editors/renderTextEditor';
1717
import { exportToCsv, exportToPdf } from '../utils';
1818
import { useDirection } from '../directionContext';
1919

@@ -96,7 +96,7 @@ function getColumns(
9696
key: 'title',
9797
name: 'Task',
9898
frozen: true,
99-
renderEditCell: textEditor,
99+
renderEditCell: renderTextEditor,
100100
renderSummaryCell({ row }) {
101101
return `${row.totalCount} records`;
102102
}
@@ -106,12 +106,12 @@ function getColumns(
106106
name: 'Client',
107107
width: 'max-content',
108108
draggable: true,
109-
renderEditCell: textEditor
109+
renderEditCell: renderTextEditor
110110
},
111111
{
112112
key: 'area',
113113
name: 'Area',
114-
renderEditCell: textEditor
114+
renderEditCell: renderTextEditor
115115
},
116116
{
117117
key: 'country',
@@ -132,12 +132,12 @@ function getColumns(
132132
{
133133
key: 'contact',
134134
name: 'Contact',
135-
renderEditCell: textEditor
135+
renderEditCell: renderTextEditor
136136
},
137137
{
138138
key: 'assignee',
139139
name: 'Assignee',
140-
renderEditCell: textEditor
140+
renderEditCell: renderTextEditor
141141
},
142142
{
143143
key: 'progress',
@@ -219,7 +219,7 @@ function getColumns(
219219
{
220220
key: 'version',
221221
name: 'Version',
222-
renderEditCell: textEditor
222+
renderEditCell: renderTextEditor
223223
},
224224
{
225225
key: 'available',

website/routes/CustomizableRenderers.tsx

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

4-
import { Row as BaseRow, Cell, DataGrid, SelectColumn, textEditor } from '../../src';
4+
import { Row as BaseRow, Cell, DataGrid, renderTextEditor, SelectColumn } from '../../src';
55
import type {
66
CellRendererProps,
77
Column,
@@ -69,7 +69,7 @@ const columns: readonly Column<Row>[] = [
6969
{
7070
key: 'task',
7171
name: 'Title',
72-
renderEditCell: textEditor,
72+
renderEditCell: renderTextEditor,
7373
sortable: true
7474
},
7575
{

website/routes/RowsReordering.tsx

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

3-
import { DataGrid, textEditor } from '../../src';
3+
import { DataGrid, renderTextEditor } from '../../src';
44
import type { CellRendererProps, Column } from '../../src';
55
import { DraggableCellRenderer } from '../components';
66
import { startViewTransition } from '../utils';
@@ -43,7 +43,7 @@ const columns: readonly Column<Row>[] = [
4343
{
4444
key: 'task',
4545
name: 'Title',
46-
renderEditCell: textEditor
46+
renderEditCell: renderTextEditor
4747
},
4848
{
4949
key: 'priority',

0 commit comments

Comments
 (0)