-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: show copy cursor in grid on key down and not just mouse move (#1735
) - Adds copy cell key handler to set cursor on key down. Grid was only showing copy cursor on mouse move, not just key down. Unfortunately we still require focus to get the key down, and I don't think it's worth hacking around that. - Moved cursor styles to linker and irisgrid css respectively, so that it is shared to DHE. AppMainContainer.css isn't used in DHE. - Moved cursors and logos in to asset folder (folders named "assets" are bundled by Vite - Tweaked copy icon svg (aliasing is improved) - default cursor to "copy" in iris grid so that it shows in embed widget and DHE BREAKING CHANGE: linker and iris grid custom cursor styling and assets are now provided by components directly. DHE css and svg files containing linker cursors should be removed/de-duplicated.
- Loading branch information
Showing
20 changed files
with
102 additions
and
57 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,7 @@ | |
"dist", | ||
"scss", | ||
"css", | ||
"logos" | ||
"assets" | ||
], | ||
"sideEffects": [ | ||
"*.css" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { KeyboardEvent } from 'react'; | ||
import { KeyHandler } from '@deephaven/grid'; | ||
import { ContextActionUtils } from '@deephaven/components'; | ||
import type { Grid } from '@deephaven/grid'; | ||
import { IrisGrid } from '../IrisGrid'; | ||
|
||
class CopyCellKeyHandler extends KeyHandler { | ||
private irisGrid: IrisGrid; | ||
|
||
constructor(irisGrid: IrisGrid) { | ||
super(); | ||
|
||
this.irisGrid = irisGrid; | ||
this.cursor = null; | ||
} | ||
|
||
onDown(event: KeyboardEvent, grid: Grid): boolean { | ||
if ( | ||
event.altKey && | ||
!ContextActionUtils.isModifierKeyDown(event) && | ||
!event.shiftKey | ||
) { | ||
const { mouseX, mouseY } = grid.state; | ||
if (mouseX == null || mouseY == null) { | ||
return false; | ||
} | ||
const gridPoint = grid.getGridPointFromXY(mouseX, mouseY); | ||
if (gridPoint.column != null && gridPoint.row != null) { | ||
this.cursor = this.irisGrid.props.copyCursor; | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
onUp(event: KeyboardEvent, grid: Grid): boolean { | ||
if (this.cursor === this.irisGrid.props.copyCursor) { | ||
this.cursor = null; | ||
return true; | ||
} | ||
return false; | ||
} | ||
} | ||
|
||
export default CopyCellKeyHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { default as CopyCellKeyHandler } from './CopyCellKeyHandler'; | ||
export { default as CopyKeyHandler } from './CopyKeyHandler'; | ||
export { default as ReverseKeyHandler } from './ReverseKeyHandler'; | ||
export { default as ClearFilterKeyHandler } from './ClearFilterKeyHandler'; |