fix pyi
This commit is contained in:
parent
fcdee97aa0
commit
ea471aaa6e
@ -38,6 +38,7 @@ from reflex.constants import (
|
|||||||
)
|
)
|
||||||
from reflex.constants.compiler import SpecialAttributes
|
from reflex.constants.compiler import SpecialAttributes
|
||||||
from reflex.event import (
|
from reflex.event import (
|
||||||
|
EventCallback,
|
||||||
EventChain,
|
EventChain,
|
||||||
EventChainVar,
|
EventChainVar,
|
||||||
EventHandler,
|
EventHandler,
|
||||||
@ -1126,6 +1127,8 @@ class Component(BaseComponent, ABC):
|
|||||||
for trigger in self.event_triggers.values():
|
for trigger in self.event_triggers.values():
|
||||||
if isinstance(trigger, EventChain):
|
if isinstance(trigger, EventChain):
|
||||||
for event in trigger.events:
|
for event in trigger.events:
|
||||||
|
if isinstance(event, EventCallback):
|
||||||
|
continue
|
||||||
if isinstance(event, EventSpec):
|
if isinstance(event, EventSpec):
|
||||||
if event.handler.state_full_name:
|
if event.handler.state_full_name:
|
||||||
return True
|
return True
|
||||||
|
@ -16,6 +16,7 @@ from typing import (
|
|||||||
Generic,
|
Generic,
|
||||||
List,
|
List,
|
||||||
Optional,
|
Optional,
|
||||||
|
Sequence,
|
||||||
Tuple,
|
Tuple,
|
||||||
Type,
|
Type,
|
||||||
TypeVar,
|
TypeVar,
|
||||||
@ -389,7 +390,9 @@ class CallableEventSpec(EventSpec):
|
|||||||
class EventChain(EventActionsMixin):
|
class EventChain(EventActionsMixin):
|
||||||
"""Container for a chain of events that will be executed in order."""
|
"""Container for a chain of events that will be executed in order."""
|
||||||
|
|
||||||
events: List[Union[EventSpec, EventVar]] = dataclasses.field(default_factory=list)
|
events: Sequence[Union[EventSpec, EventVar, EventCallback]] = dataclasses.field(
|
||||||
|
default_factory=list
|
||||||
|
)
|
||||||
|
|
||||||
args_spec: Optional[Callable] = dataclasses.field(default=None)
|
args_spec: Optional[Callable] = dataclasses.field(default=None)
|
||||||
|
|
||||||
@ -1468,6 +1471,24 @@ if sys.version_info >= (3, 10):
|
|||||||
"""
|
"""
|
||||||
self.func = func
|
self.func = func
|
||||||
|
|
||||||
|
@property
|
||||||
|
def prevent_default(self):
|
||||||
|
"""Prevent default behavior.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
The event callback with prevent default behavior.
|
||||||
|
"""
|
||||||
|
return self
|
||||||
|
|
||||||
|
@property
|
||||||
|
def stop_propagation(self):
|
||||||
|
"""Stop event propagation.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
The event callback with stop propagation behavior.
|
||||||
|
"""
|
||||||
|
return self
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def __call__(
|
def __call__(
|
||||||
self: EventCallback[Concatenate[V, Q], T], value: V | Var[V]
|
self: EventCallback[Concatenate[V, Q], T], value: V | Var[V]
|
||||||
|
Loading…
Reference in New Issue
Block a user