Commit Graph

31 Commits

Author SHA1 Message Date
Masen Furer
bc6f0f70cb
Support replacing route on redirect (#3072)
* Support replacing route on redirect

Support next/router `.replace` interface to change page without creating a
history entry.

* test_event: include test cases for new "replace" kwarg
2024-05-16 13:21:40 -07:00
Masen Furer
c636c91c9c
[REF-2273] Implement .setvar special EventHandler (#3163)
* Allow EventHandler args to be partially applied

When an EventHandler is called with an incomplete set of args it creates a
partial EventSpec. This change allows Component._create_event_chain to apply
remaining args from an args_spec to an existing EventSpec to make it
functional.

Instead of requiring the use of `lambda` functions to pass arguments to an
EventHandler, they can now be passed directly and any remaining args defined in
the event trigger will be applied after those.

* [REF-2273] Implement `.setvar` special EventHandler

All State subclasses will now have a special `setvar` EventHandler which
appears in the autocomplete drop down, passes static analysis, and canbe used
to set State Vars in response to event triggers.

Before:
    rx.input(value=State.a, on_change=State.set_a)

After:
    rx.input(value=State.a, on_change=State.setvar("a"))

This reduces the "magic" because `setvar` is statically defined on all State
subclasses.

* Catch invalid Var names and types at compile time

* Add test cases for State.setvar

* Use a proper redis-compatible token
2024-05-01 17:13:55 -07:00
Masen Furer
3564df7620
Implement throttle and debounce as event actions (#3091) 2024-04-26 17:28:51 -07:00
Elijah Ahianyo
e3ee98098a
RED-1052/rx.State as Base State (#2146) 2023-11-29 09:43:33 -08:00
Masen Furer
527437cf23
[REF-144] Add context in each component to prevent rerenders (#2198) 2023-11-27 16:05:59 -08:00
Masen Furer
56476d0a86
Expose DOM event actions on EventHandler, EventSpec, and EventChain (stopPropagation) (#1891)
* Expose preventDefault and stopPropagation for DOM events

All EventHandler, EventSpec, and EventChain can now carry these extra
"event_actions" that will be applied inside the frontend code when an event is
triggered from the DOM.

Fix #1621
Fix REF-675

* Test cases (and fixes) for "event_actions"

* form: from __future__ import annotations

for py38, py39 compat

* Revert overzealous merge conflict resolution
2023-10-31 11:42:42 -07:00
Elijah Ahianyo
06bdf9ed8a
Remove 0.3.0 deprecated features (#1947) 2023-10-19 09:44:32 -07:00
Masen Furer
d1d5812602
format: event arg values use backticks (#1926) 2023-10-17 10:42:35 -07:00
Thomas Brandého
7df3f2f621
allow external link for redirect (#1902) 2023-10-02 09:37:46 -07:00
Thomas Brandého
211dc15995
New API to define triggers (#1820) 2023-09-21 09:47:22 -07:00
Masen Furer
71811a600c
Var: __bool__ and __iter__ always raise a TypeError (#1750) 2023-09-05 13:44:22 -07:00
Masen Furer
cc89f2b6e7
Proper serialization for chained Event payloads (#1725) 2023-08-31 09:50:15 -07:00
Elijah Ahianyo
3b3fc4f965
Local storage clear and remove (#1222) 2023-06-28 11:59:27 -07:00
Elijah Ahianyo
be48e13c71
Remove cookies (#1223) 2023-06-27 18:04:29 -07:00
Nikhil Rao
139ce38df1
Rename pynecone to reflex (#1236) 2023-06-25 16:56:55 -07:00
Thomas Brandého
8947c26c7e
add server_side event for cookie and local storage (#1206) 2023-06-16 13:40:25 -07:00
Curtis Turner
d4b5c78406
add set_focus (#1092) 2023-05-30 13:04:09 -07:00
Elijah Ahianyo
0c33ad19f6
bugfix for upload event (#1042) 2023-05-17 10:08:11 -07:00
Nikhil Rao
948ec90fc4
Add pc.form component (#929) 2023-05-14 22:34:10 -07:00
Elijah Ahianyo
139e4cf05b
Update upload event to use queue (#1005) 2023-05-12 16:44:16 -07:00
iron3oxide
32f3a387ae
Rename var module to vars (#983) 2023-05-09 23:01:25 -07:00
Nikhil Rao
34d77db541
Fix event handler string args (#928) 2023-05-01 17:06:42 -07:00
Nikhil Rao
1a254aca8e
Add pc.set_value (#835) 2023-04-29 19:01:37 -07:00
iron3oxide
7067baf176
Refactor utils module (#666) 2023-03-16 14:59:27 -07:00
Xiaojing Chen
ae5b6426aa
Clean up json dumps (#642) 2023-03-07 14:37:34 -08:00
Xiaojing Chen
b4c3cb5eb3
[Tests] add unit test for event (#614) 2023-02-27 19:13:49 -08:00
Nikhil Rao
6c8ce67b8b
Call special events from event triggers (#601) 2023-02-24 15:17:03 -08:00
叶子
1529a23c1b
Switch linter to ruff (#450) 2023-02-09 11:33:18 -08:00
Nikhil Rao
c4b1f2c669
Create Github Action for pytest (#12) 2022-11-21 18:50:59 -08:00
Nikhil Rao
29e37350e5
Add basic unit tests (#7)
* Unit tests for components, state, and utils
2022-11-20 14:34:25 -08:00
Nikhil Rao
e8e8eaa010 Initial commit. 2022-11-18 12:44:06 -08:00