Skip to content

Commit

Permalink
ISelectedRegionTransform now also accepts keyboard events
Browse files Browse the repository at this point in the history
  • Loading branch information
ntamas committed Oct 3, 2018
1 parent 8b8db72 commit 6a35c0a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/table/src/interactions/selectable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ import { IRegion, Regions } from "../regions";
import { DragEvents } from "./dragEvents";
import { Draggable, ICoordinateData, IDraggableProps } from "./draggable";

export type ISelectedRegionTransform = (region: IRegion, event: MouseEvent, coords?: ICoordinateData) => IRegion;
export type ISelectedRegionTransform = (
region: IRegion,
event: MouseEvent | KeyboardEvent,
coords?: ICoordinateData,
) => IRegion;

export interface ISelectableProps {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/table/src/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1829,7 +1829,7 @@ export class Table extends AbstractComponent<ITableProps, ITableState> {
const { selectedRegionTransform } = this.props;
const transformedSelectionRegions =
selectedRegionTransform != null
? newSelectionRegions.map(region => selectedRegionTransform(region, undefined))
? newSelectionRegions.map(region => selectedRegionTransform(region, e))
: newSelectionRegions;
this.handleSelection(transformedSelectionRegions);
this.handleFocus(newFocusedCell);
Expand Down

0 comments on commit 6a35c0a

Please sign in to comment.