-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add support to pass in mouseHandlers into IrisGrid #1857
Conversation
- Move the doubleClick behaviour from IrisGridDataSelectMouseHandler into GridSelectionMouseHandler, so it's baked into Grid itself (double-clicking a grid in the styleguide was exhibiting erroneous behaviour) - Allow passing in mouseHandlers to IrisGrid. Will be necessary to support deephaven/deephaven-plugins#320 - Tested using my branch for on_row_press support on deephaven.ui - Verified Linker still worked as expected
- Depends on my web PR: deephaven/web-client-ui#1857 - Passes through the on_*_press events to IrisGrid - Tested with the snippet from the examples, ensured all events were being printed with the correct information: ```python import deephaven.ui as ui import deephaven.plot.express as dx te = ( ui.table(dx.data.stocks()) .on_row_press(lambda row, data: print(f"Row Press: {row}, {data}")) .on_row_double_press(lambda row, data: print(f"Row Double Press: {row}, {data}")) .on_cell_press( lambda cell_index, data: print(f"Cell Press: {cell_index}, {data}") ) .on_cell_double_press( lambda cell_index, data: print(f"Cell Double Press: {cell_index}, {data}") ) .on_column_press(lambda column: print(f"Column Press: {column}")) .on_column_double_press( lambda column: print(f"Column Double Press: {column}") ) ) ```
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1857 +/- ##
==========================================
- Coverage 46.12% 46.11% -0.02%
==========================================
Files 635 636 +1
Lines 38025 38070 +45
Branches 9612 9627 +15
==========================================
+ Hits 17540 17556 +16
- Misses 20432 20461 +29
Partials 53 53
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
getCachedMouseHandlers = memoize( | ||
( | ||
mouseHandlers: readonly GridMouseHandler[] | ||
): readonly GridMouseHandler[] => [...mouseHandlers, ...this.mouseHandlers] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this.mouseHandlers
gets set by initial props and then any updates to the props get combined with the initial. Am I understanding this correctly, and if so, is that what we want, or should the initial props be dropped if props change? Same question for getCachedKeyHandlers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.mouseHandlers
and this.keyHandlers
are not getting by initial props, that's a local value that is initialized in the constructor.
Then the getCachedMouseHandlers
combines the default/code IrisGrid mouseHandlers with the custom provided mouseHandlers
provided from the props.
We use a similar pattern in Grid.tsx
as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, misread. Looks good then
packages/iris-grid/src/mousehandlers/IrisGridDataSelectMouseHandler.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a question about event handlers. Also looks like a kerning e2e test failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
on_row_press
) deephaven-plugins#320on_row_press
support on deephaven.ui: feat: Add ui.table press event listener support deephaven-plugins#346