Skip to content

Commit 08d7e29

Browse files
amanmahajan7royue
authored andcommitted
Rename textEditor to renderTextEditor (Comcast#3908)
* Rename `textEditor` to `renderTextEditor` * Cleanup types * Revret 1 change * Tweak import * rename test file * Combine import * Combine import statements
1 parent 591f43f commit 08d7e29

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
```
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, useLatestFunc, useRovingTabIndex} from './hooks';
@@ -37,6 +37,7 @@ export type {
3737
ColumnOrColumnGroup,
3838
ColumnWidth,
3939
ColumnWidths,
40+
Direction,
4041
FillEvent,
4142
RenderCellProps,
4243
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',
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
@@ -4,9 +4,9 @@ import { css } from '@linaria/core';
44
import clsx from 'clsx';
55
import AntStyleTreeGrid from "./Tree"
66

7-
import { DataGrid, SelectColumn, textEditor } from '../../src';
7+
import { DataGrid, renderTextEditor, SelectColumn } from '../../src';
88
import type { CalculatedColumn, CellCopyArgs, CellPasteArgs, Column, FillEvent } from '../../src';
9-
import { textEditorClassname } from '../../src/editors/textEditor';
9+
import { textEditorClassname } from '../../src/editors/renderTextEditor';
1010
import { useDirection } from '../directionContext';
1111

1212
export const Route = createFileRoute({
@@ -133,71 +133,71 @@ const columns: readonly Column<Row>[] = [
133133
width: 200,
134134
resizable: true,
135135
frozen: true,
136-
renderEditCell: textEditor
136+
renderEditCell: renderTextEditor
137137
},
138138
{
139139
key: 'lastName',
140140
name: 'Last Name',
141141
width: 200,
142142
resizable: true,
143143
frozen: true,
144-
renderEditCell: textEditor
144+
renderEditCell: renderTextEditor
145145
},
146146
{
147147
key: 'email',
148148
name: 'Email',
149149
width: 'max-content',
150150
resizable: true,
151-
renderEditCell: textEditor
151+
renderEditCell: renderTextEditor
152152
},
153153
{
154154
key: 'street',
155155
name: 'Street',
156156
width: 200,
157157
resizable: true,
158-
renderEditCell: textEditor
158+
renderEditCell: renderTextEditor
159159
},
160160
{
161161
key: 'zipCode',
162162
name: 'ZipCode',
163163
width: 200,
164164
resizable: true,
165-
renderEditCell: textEditor
165+
renderEditCell: renderTextEditor
166166
},
167167
{
168168
key: 'date',
169169
name: 'Date',
170170
width: 200,
171171
resizable: true,
172-
renderEditCell: textEditor
172+
renderEditCell: renderTextEditor
173173
},
174174
{
175175
key: 'bs',
176176
name: 'bs',
177177
width: 200,
178178
resizable: true,
179-
renderEditCell: textEditor
179+
renderEditCell: renderTextEditor
180180
},
181181
{
182182
key: 'catchPhrase',
183183
name: 'Catch Phrase',
184184
width: 'max-content',
185185
resizable: true,
186-
renderEditCell: textEditor
186+
renderEditCell: renderTextEditor
187187
},
188188
{
189189
key: 'companyName',
190190
name: 'Company Name',
191191
width: 200,
192192
resizable: true,
193-
renderEditCell: textEditor
193+
renderEditCell: renderTextEditor
194194
},
195195
{
196196
key: 'sentence',
197197
name: 'Sentence',
198198
width: 'max-content',
199199
resizable: true,
200-
renderEditCell: textEditor
200+
renderEditCell: renderTextEditor
201201
}
202202
];
203203

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)