Skip to content

Commit

Permalink
Remove enableCellAutoFocus (#2073)
Browse files Browse the repository at this point in the history
  • Loading branch information
amanmahajan7 committed Jul 7, 2020
1 parent 7296464 commit 12c74f9
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<!-- TODO: fill link to storybook -->
- Check the [Context Menu]() example
- ⚠️ `enableCellSelect`
- ⚠️ `enableCellAutoFocus`
- ⚠️ `getValidFilterValues`
- ⚠️ `onCellCopyPaste`
- ⚠️ `onSelectedCellRangeChange`
Expand Down
4 changes: 0 additions & 4 deletions src/DataGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ export interface DataGridProps<R, K extends keyof R, SR = unknown> {
*/
/** Toggles whether filters row is displayed or not */
enableFilters?: boolean;
/** Toggles whether cells should be autofocused */
enableCellAutoFocus?: boolean;
enableCellCopyPaste?: boolean;
enableCellDragAndDrop?: boolean;
cellNavigationMode?: CellNavigationMode;
Expand Down Expand Up @@ -184,7 +182,6 @@ function DataGrid<R, K extends keyof R, SR>({
onCheckCellIsEditable,
// Toggles and modes
enableFilters = false,
enableCellAutoFocus = true,
enableCellCopyPaste = false,
enableCellDragAndDrop = false,
cellNavigationMode = CellNavigationMode.NONE,
Expand Down Expand Up @@ -446,7 +443,6 @@ function DataGrid<R, K extends keyof R, SR>({
rows={rows}
rowHeight={rowHeight}
columns={columns}
enableCellAutoFocus={enableCellAutoFocus}
enableCellCopyPaste={enableCellCopyPaste}
enableCellDragAndDrop={enableCellDragAndDrop}
cellNavigationMode={cellNavigationMode}
Expand Down
1 change: 0 additions & 1 deletion src/masks/InteractionMasks.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ describe('InteractionMasks', () => {
scrollToCell: jest.fn(),
onSelectedCellChange,
onRowsUpdate: jest.fn(),
enableCellAutoFocus: false,
enableCellCopyPaste: true,
enableCellDragAndDrop: true,
cellNavigationMode: CellNavigationMode.NONE,
Expand Down
9 changes: 1 addition & 8 deletions src/masks/InteractionMasks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ type SharedCanvasProps<R, SR> = Pick<DataGridProps<R, never, SR>,
| 'onSelectedCellChange'
> & Pick<Required<DataGridProps<R, never, SR>>,
| 'rowHeight'
| 'enableCellAutoFocus'
| 'enableCellCopyPaste'
| 'enableCellDragAndDrop'
| 'cellNavigationMode'
Expand Down Expand Up @@ -60,7 +59,6 @@ export default function InteractionMasks<R, SR>({
rows,
rowHeight,
eventBus,
enableCellAutoFocus,
enableCellCopyPaste,
enableCellDragAndDrop,
editorPortalTarget,
Expand All @@ -74,12 +72,7 @@ export default function InteractionMasks<R, SR>({
onRowsUpdate,
scrollToCell
}: InteractionMasksProps<R, SR>) {
const [selectedPosition, setSelectedPosition] = useState<SelectCellState | EditCellState>(() => {
if (enableCellAutoFocus && document.activeElement === document.body && columns.length > 0 && rows.length > 0) {
return { idx: 0, rowIdx: 0, status: 'SELECT' };
}
return { idx: -1, rowIdx: -1, status: 'SELECT' };
});
const [selectedPosition, setSelectedPosition] = useState<SelectCellState | EditCellState>({ idx: -1, rowIdx: -1, status: 'SELECT' });
const [copiedPosition, setCopiedPosition] = useState<Position & { value: unknown } | null>(null);
const [draggedPosition, setDraggedPosition] = useState<DraggedPosition | null>(null);
const selectionMaskRef = useRef<HTMLDivElement>(null);
Expand Down
1 change: 0 additions & 1 deletion stories/demos/example21-cell-selection-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export default class extends React.Component {
rowsCount={this._rows.length}
minHeight={500}
enableCellSelect
enableCellAutoFocus={false}
onSelectedCellChange={this.onSelectedCellChange}
/>
</Wrapper>
Expand Down

0 comments on commit 12c74f9

Please sign in to comment.