Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
"source.fixAll": "explicit",
"source.organizeImports": "explicit",
// prevent removal of unreachable code
"source.fixAll.ts": "never"
},
"editor.defaultFormatter": "oxc.oxc-vscode",
"editor.formatOnSave": true,
Expand Down
2 changes: 1 addition & 1 deletion src/DataGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useCallback, useImperativeHandle, useLayoutEffect, useMemo, useState } from 'react';
import type { Key, KeyboardEvent } from 'react';
import { useCallback, useImperativeHandle, useLayoutEffect, useMemo, useState } from 'react';
import { flushSync } from 'react-dom';

import {
Expand Down
4 changes: 2 additions & 2 deletions src/TreeDataGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useCallback, useMemo } from 'react';
import type { Key } from 'react';
import { useCallback, useMemo } from 'react';

import { useLatestFunc } from './hooks';
import { assertIsValidKeyGetter, getLeftRightKey } from './utils';
Expand All @@ -19,8 +19,8 @@ import type {
} from './types';
import { renderToggleGroup } from './cellRenderers';
import { SELECT_COLUMN_KEY } from './Columns';
import { DataGrid } from './DataGrid';
import type { DataGridProps } from './DataGrid';
import { DataGrid } from './DataGrid';
import { useDefaultRenderers } from './DataGridDefaultRenderersContext';
import GroupedRow from './GroupRow';
import { defaultRenderRow } from './Row';
Expand Down
14 changes: 7 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import './style/layers.css';

export { default as Cell } from './Cell';
export * from './cellRenderers';
export * from './Columns';
export {
DataGrid,
type DataGridProps,
type DataGridHandle,
type DataGridProps,
type DefaultColumnOptions
} from './DataGrid';
export { TreeDataGrid, type TreeDataGridProps } from './TreeDataGrid';
export { DataGridDefaultRenderersContext } from './DataGridDefaultRenderersContext';
export { default as Row } from './Row';
export { default as Cell } from './Cell';
export * from './Columns';
export * from './cellRenderers';
export { renderTextEditor } from './editors/renderTextEditor';
export { useHeaderRowSelection, useRowSelection } from './hooks';
export { default as renderHeaderCell } from './renderHeaderCell';
export { default as Row } from './Row';
export { renderSortIcon, renderSortPriority } from './sortStatus';
export { useRowSelection, useHeaderRowSelection } from './hooks';
export { TreeDataGrid, type TreeDataGridProps } from './TreeDataGrid';
export type {
CalculatedColumn,
CalculatedColumnOrColumnGroup,
Expand Down
2 changes: 1 addition & 1 deletion test/browser/column/renderCell.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useState } from 'react';
import { page, userEvent } from 'vitest/browser';

import { DataGrid } from '../../../src';
import type { Column } from '../../../src';
import { DataGrid } from '../../../src';
import defaultRenderHeaderCell from '../../../src/renderHeaderCell';
import { getCellsAtRowIndex, setup } from '../utils';

Expand Down
2 changes: 1 addition & 1 deletion test/browser/column/renderEditCell.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { useMemo, useState } from 'react';
import { createPortal } from 'react-dom';
import { page, userEvent } from 'vitest/browser';

import { DataGrid } from '../../../src';
import type { Column, DataGridProps } from '../../../src';
import { DataGrid } from '../../../src';
import { getCellsAtRowIndex, getRowWithCell, scrollGrid, testCount } from '../utils';

const grid = page.getGrid();
Expand Down
2 changes: 1 addition & 1 deletion test/browser/columnOrder.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { page } from 'vitest/browser';

import { DataGrid, SelectColumn, TreeDataGrid } from '../../src';
import type { Column } from '../../src';
import { DataGrid, SelectColumn, TreeDataGrid } from '../../src';
import { testCount } from './utils';

const headerCells = page.getHeaderCell();
Expand Down
2 changes: 1 addition & 1 deletion test/browser/copyPaste.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useState } from 'react';
import { page, userEvent } from 'vitest/browser';

import { DataGrid } from '../../src';
import type { CellPasteArgs, Column } from '../../src';
import { DataGrid } from '../../src';
import { getCellsAtRowIndex } from './utils';

interface Row {
Expand Down
2 changes: 1 addition & 1 deletion test/browser/dragFill.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useState } from 'react';
import { commands, page, userEvent } from 'vitest/browser';

import { DataGrid } from '../../src';
import type { Column, FillEvent } from '../../src';
import { DataGrid } from '../../src';
import { getCellsAtRowIndex } from './utils';

const dragHandle = page.getDragHandle();
Expand Down
2 changes: 1 addition & 1 deletion test/browser/events.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { page, userEvent } from 'vitest/browser';

import { DataGrid } from '../../src';
import type { Column, DataGridProps } from '../../src';
import { DataGrid } from '../../src';

interface Row {
col1: number;
Expand Down
2 changes: 1 addition & 1 deletion test/browser/keyboardNavigation.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { page, userEvent } from 'vitest/browser';

import { DataGrid, SelectColumn } from '../../src';
import type { Column } from '../../src';
import { DataGrid, SelectColumn } from '../../src';
import {
getRowWithCell,
scrollGrid,
Expand Down
2 changes: 1 addition & 1 deletion test/browser/renderTextEditor.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useState } from 'react';
import { page, userEvent } from 'vitest/browser';

import { DataGrid, renderTextEditor } from '../../src';
import type { Column } from '../../src';
import { DataGrid, renderTextEditor } from '../../src';

interface Row {
readonly name: string;
Expand Down
16 changes: 8 additions & 8 deletions test/browser/renderers.test.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
import { useState } from 'react';
import { page, userEvent } from 'vitest/browser';

import {
Cell,
DataGrid,
DataGridDefaultRenderersContext,
Row as DefaultRow,
renderSortIcon,
SelectColumn
} from '../../src';
import type {
CellRendererProps,
Column,
Expand All @@ -17,6 +9,14 @@ import type {
RenderSortStatusProps,
SortColumn
} from '../../src';
import {
Cell,
DataGrid,
DataGridDefaultRenderersContext,
Row as DefaultRow,
renderSortIcon,
SelectColumn
} from '../../src';
import { getRowWithCell, setup, testCount, testRowCount } from './utils';

interface Row {
Expand Down
2 changes: 1 addition & 1 deletion test/browser/rowSelection.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useState } from 'react';
import { page, userEvent } from 'vitest/browser';

import { DataGrid, SelectColumn } from '../../src';
import type { Column } from '../../src';
import { DataGrid, SelectColumn } from '../../src';

const rows = page.getRow();
const headerCheckbox = page.getSelectAllCheckbox();
Expand Down
2 changes: 1 addition & 1 deletion test/browser/utils.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { page, userEvent, type Locator } from 'vitest/browser';
import { css } from 'ecij';

import { DataGrid } from '../../src';
import type { DataGridProps } from '../../src';
import { DataGrid } from '../../src';

export function setup<R, SR, K extends React.Key = React.Key>(
props: DataGridProps<R, SR, K>,
Expand Down
2 changes: 1 addition & 1 deletion test/node/ssr.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { renderToString } from 'react-dom/server';

import { DataGrid } from '../../src';
import type { Column } from '../../src';
import { DataGrid } from '../../src';

interface Row {
id: number;
Expand Down
2 changes: 1 addition & 1 deletion website/routes/AllFeatures.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { faker } from '@faker-js/faker';
import { css } from 'ecij';
import clsx from 'clsx';

import { DataGrid, renderTextEditor, SelectColumn } from '../../src';
import type { CalculatedColumn, CellCopyArgs, CellPasteArgs, Column, FillEvent } from '../../src';
import { DataGrid, renderTextEditor, SelectColumn } from '../../src';
import { textEditorClassname } from '../../src/editors/renderTextEditor';
import { useDirection } from '../directionContext';

Expand Down
2 changes: 1 addition & 1 deletion website/routes/CellNavigation.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useId, useState } from 'react';

import { DataGrid } from '../../src';
import type { CellKeyboardEvent, CellKeyDownArgs, Column } from '../../src';
import { DataGrid } from '../../src';
import { useDirection } from '../directionContext';

export const Route = createFileRoute({
Expand Down
2 changes: 1 addition & 1 deletion website/routes/CustomizableRenderers.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useMemo, useState } from 'react';
import { css } from 'ecij';

import { Row as BaseRow, Cell, DataGrid, renderTextEditor, SelectColumn } from '../../src';
import type {
CellRendererProps,
Column,
Expand All @@ -10,6 +9,7 @@ import type {
RenderSortStatusProps,
SortColumn
} from '../../src';
import { Row as BaseRow, Cell, DataGrid, renderTextEditor, SelectColumn } from '../../src';
import { useDirection } from '../directionContext';

export const Route = createFileRoute({
Expand Down