Skip to content
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

Add Shiny Event classes for custom events #3815

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
01fd8fa
Remove `el` from ShinyEventCommon, value is `any`
gadenbuie Apr 26, 2023
90c0523
Allow any-typed arguments in exported functions
gadenbuie Apr 26, 2023
8d12ae7
Remove `value`, add `el` to ShinyEventInputChanged
gadenbuie Apr 26, 2023
0e2d040
Implement `EventCommon` and `EventInputChanged` classes
gadenbuie Apr 26, 2023
e2d19b9
Use `EventInputChanged()` to emit file upload input event
gadenbuie Apr 26, 2023
60f074d
Make the `EventCommon` class work more like an `Event`
gadenbuie Apr 26, 2023
54fa857
Use `EventInputChanged` in `InputEventDecorator`
gadenbuie Apr 26, 2023
63427a7
Go back to using `EvtFn()` to extend jquery event handler
gadenbuie Apr 26, 2023
651b768
Implement one lower-level event class `EventBase` and use `event` rat…
gadenbuie Apr 26, 2023
922d16d
Implement `EventUpdateInput` for `shiny:updateinput`
gadenbuie Apr 26, 2023
2740be1
Implement `EventValue` for `shiny:value`
gadenbuie Apr 26, 2023
b5c6561
Implement `EventError` for `shiny:error` events
gadenbuie Apr 26, 2023
a66ef6d
Implement `EventMessage` for `shiny:message`
gadenbuie Apr 26, 2023
08ced6b
Use `@babel/plugin-transform-typescript`
gadenbuie Apr 27, 2023
4f50796
import $ from jquery
gadenbuie Apr 27, 2023
ce4961f
`EventBase.triggerOn()` now accepts jquery html elements
gadenbuie Apr 27, 2023
0adeb4b
DRY properties and type definitions
gadenbuie Apr 27, 2023
4648423
Use more descriptive names for events, not `evt`
gadenbuie Apr 27, 2023
eddb0d9
Add more context in comments
gadenbuie Apr 27, 2023
064da3a
yarn build
gadenbuie Apr 27, 2023
10c2398
Add jsdoc strings to shinyEvents.ts
gadenbuie May 1, 2023
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
1 change: 1 addition & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ rules:
- off
"@typescript-eslint/explicit-module-boundary-types":
- error
- allowArgumentsExplicitlyTypedAsAny: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments below on this. I'd imagine we can unset this again. Might require some assertions but that's probably safer anyways.


default-case:
- error
Expand Down
10 changes: 9 additions & 1 deletion babel.config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
{
"plugins": [
[
"@babel/plugin-transform-typescript",
{
"allowDeclareFields": true
}
]
],
"presets": [
"@babel/preset-typescript",
[
Expand All @@ -9,7 +17,7 @@
}
]
],
"ignore":[
"ignore": [
"node_modules/core-js"
]
}
1,996 changes: 1,145 additions & 851 deletions inst/www/shared/shiny.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions inst/www/shared/shiny.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/www/shared/shiny.min.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions inst/www/shared/shiny.min.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"yarn": ">= 1.22"
},
"dependencies": {
"@babel/plugin-transform-typescript": "^7.21.3",
"@types/bootstrap": "3.4.0",
"@types/bootstrap-datepicker": "0.0.14",
"@types/datatables.net": "^1.10.19",
Expand Down
26 changes: 0 additions & 26 deletions srcts/src/events/inputChanged.ts

This file was deleted.

2 changes: 2 additions & 0 deletions srcts/src/events/jQueryEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,5 @@ declare global {
): this;
}
}

export type { EvtFn };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming this stands for "Event Function"? If so Is there a reason to keep it so abbreviated?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think mostly because it was reused often in this file and because evt is used as the convention for "jQuery event" elsewhere in the codebase.

Loading