add capitalize and title var operations (#4840)
This commit is contained in:
parent
3129ddab47
commit
18990df41f
@ -3,7 +3,7 @@
|
|||||||
# ------------------- DO NOT EDIT ----------------------
|
# ------------------- DO NOT EDIT ----------------------
|
||||||
# This file was generated by `reflex/utils/pyi_generator.py`!
|
# This file was generated by `reflex/utils/pyi_generator.py`!
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
from typing import Any, Dict, Optional, Union, overload
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
||||||
|
|
||||||
from reflex.components.el.elements.typography import Div
|
from reflex.components.el.elements.typography import Div
|
||||||
from reflex.event import EventType
|
from reflex.event import EventType
|
||||||
@ -17,30 +17,211 @@ class AutoScroll(Div):
|
|||||||
def create( # type: ignore
|
def create( # type: ignore
|
||||||
cls,
|
cls,
|
||||||
*children,
|
*children,
|
||||||
access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
access_key: Optional[Union[Var[str], str]] = None,
|
||||||
auto_capitalize: Optional[
|
auto_capitalize: Optional[
|
||||||
Union[Var[Union[bool, int, str]], bool, int, str]
|
Union[
|
||||||
|
Literal["characters", "none", "off", "on", "sentences", "words"],
|
||||||
|
Var[Literal["characters", "none", "off", "on", "sentences", "words"]],
|
||||||
|
]
|
||||||
] = None,
|
] = None,
|
||||||
content_editable: Optional[
|
content_editable: Optional[
|
||||||
Union[Var[Union[bool, int, str]], bool, int, str]
|
Union[
|
||||||
|
Literal["inherit", "plaintext-only", False, True],
|
||||||
|
Var[Literal["inherit", "plaintext-only", False, True]],
|
||||||
|
]
|
||||||
] = None,
|
] = None,
|
||||||
context_menu: Optional[
|
context_menu: Optional[Union[Var[str], str]] = None,
|
||||||
Union[Var[Union[bool, int, str]], bool, int, str]
|
dir: Optional[Union[Var[str], str]] = None,
|
||||||
] = None,
|
draggable: Optional[Union[Var[bool], bool]] = None,
|
||||||
dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
|
||||||
draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
|
||||||
enter_key_hint: Optional[
|
enter_key_hint: Optional[
|
||||||
Union[Var[Union[bool, int, str]], bool, int, str]
|
Union[
|
||||||
|
Literal["done", "enter", "go", "next", "previous", "search", "send"],
|
||||||
|
Var[
|
||||||
|
Literal["done", "enter", "go", "next", "previous", "search", "send"]
|
||||||
|
],
|
||||||
|
]
|
||||||
] = None,
|
] = None,
|
||||||
hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
hidden: Optional[Union[Var[bool], bool]] = None,
|
||||||
input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
input_mode: Optional[
|
||||||
item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
Union[
|
||||||
lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
Literal[
|
||||||
role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
"decimal",
|
||||||
slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
"email",
|
||||||
spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
"none",
|
||||||
tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
"numeric",
|
||||||
title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
"search",
|
||||||
|
"tel",
|
||||||
|
"text",
|
||||||
|
"url",
|
||||||
|
],
|
||||||
|
Var[
|
||||||
|
Literal[
|
||||||
|
"decimal",
|
||||||
|
"email",
|
||||||
|
"none",
|
||||||
|
"numeric",
|
||||||
|
"search",
|
||||||
|
"tel",
|
||||||
|
"text",
|
||||||
|
"url",
|
||||||
|
]
|
||||||
|
],
|
||||||
|
]
|
||||||
|
] = None,
|
||||||
|
item_prop: Optional[Union[Var[str], str]] = None,
|
||||||
|
lang: Optional[Union[Var[str], str]] = None,
|
||||||
|
role: Optional[
|
||||||
|
Union[
|
||||||
|
Literal[
|
||||||
|
"alert",
|
||||||
|
"alertdialog",
|
||||||
|
"application",
|
||||||
|
"article",
|
||||||
|
"banner",
|
||||||
|
"button",
|
||||||
|
"cell",
|
||||||
|
"checkbox",
|
||||||
|
"columnheader",
|
||||||
|
"combobox",
|
||||||
|
"complementary",
|
||||||
|
"contentinfo",
|
||||||
|
"definition",
|
||||||
|
"dialog",
|
||||||
|
"directory",
|
||||||
|
"document",
|
||||||
|
"feed",
|
||||||
|
"figure",
|
||||||
|
"form",
|
||||||
|
"grid",
|
||||||
|
"gridcell",
|
||||||
|
"group",
|
||||||
|
"heading",
|
||||||
|
"img",
|
||||||
|
"link",
|
||||||
|
"list",
|
||||||
|
"listbox",
|
||||||
|
"listitem",
|
||||||
|
"log",
|
||||||
|
"main",
|
||||||
|
"marquee",
|
||||||
|
"math",
|
||||||
|
"menu",
|
||||||
|
"menubar",
|
||||||
|
"menuitem",
|
||||||
|
"menuitemcheckbox",
|
||||||
|
"menuitemradio",
|
||||||
|
"navigation",
|
||||||
|
"none",
|
||||||
|
"note",
|
||||||
|
"option",
|
||||||
|
"presentation",
|
||||||
|
"progressbar",
|
||||||
|
"radio",
|
||||||
|
"radiogroup",
|
||||||
|
"region",
|
||||||
|
"row",
|
||||||
|
"rowgroup",
|
||||||
|
"rowheader",
|
||||||
|
"scrollbar",
|
||||||
|
"search",
|
||||||
|
"searchbox",
|
||||||
|
"separator",
|
||||||
|
"slider",
|
||||||
|
"spinbutton",
|
||||||
|
"status",
|
||||||
|
"switch",
|
||||||
|
"tab",
|
||||||
|
"table",
|
||||||
|
"tablist",
|
||||||
|
"tabpanel",
|
||||||
|
"term",
|
||||||
|
"textbox",
|
||||||
|
"timer",
|
||||||
|
"toolbar",
|
||||||
|
"tooltip",
|
||||||
|
"tree",
|
||||||
|
"treegrid",
|
||||||
|
"treeitem",
|
||||||
|
],
|
||||||
|
Var[
|
||||||
|
Literal[
|
||||||
|
"alert",
|
||||||
|
"alertdialog",
|
||||||
|
"application",
|
||||||
|
"article",
|
||||||
|
"banner",
|
||||||
|
"button",
|
||||||
|
"cell",
|
||||||
|
"checkbox",
|
||||||
|
"columnheader",
|
||||||
|
"combobox",
|
||||||
|
"complementary",
|
||||||
|
"contentinfo",
|
||||||
|
"definition",
|
||||||
|
"dialog",
|
||||||
|
"directory",
|
||||||
|
"document",
|
||||||
|
"feed",
|
||||||
|
"figure",
|
||||||
|
"form",
|
||||||
|
"grid",
|
||||||
|
"gridcell",
|
||||||
|
"group",
|
||||||
|
"heading",
|
||||||
|
"img",
|
||||||
|
"link",
|
||||||
|
"list",
|
||||||
|
"listbox",
|
||||||
|
"listitem",
|
||||||
|
"log",
|
||||||
|
"main",
|
||||||
|
"marquee",
|
||||||
|
"math",
|
||||||
|
"menu",
|
||||||
|
"menubar",
|
||||||
|
"menuitem",
|
||||||
|
"menuitemcheckbox",
|
||||||
|
"menuitemradio",
|
||||||
|
"navigation",
|
||||||
|
"none",
|
||||||
|
"note",
|
||||||
|
"option",
|
||||||
|
"presentation",
|
||||||
|
"progressbar",
|
||||||
|
"radio",
|
||||||
|
"radiogroup",
|
||||||
|
"region",
|
||||||
|
"row",
|
||||||
|
"rowgroup",
|
||||||
|
"rowheader",
|
||||||
|
"scrollbar",
|
||||||
|
"search",
|
||||||
|
"searchbox",
|
||||||
|
"separator",
|
||||||
|
"slider",
|
||||||
|
"spinbutton",
|
||||||
|
"status",
|
||||||
|
"switch",
|
||||||
|
"tab",
|
||||||
|
"table",
|
||||||
|
"tablist",
|
||||||
|
"tabpanel",
|
||||||
|
"term",
|
||||||
|
"textbox",
|
||||||
|
"timer",
|
||||||
|
"toolbar",
|
||||||
|
"tooltip",
|
||||||
|
"tree",
|
||||||
|
"treegrid",
|
||||||
|
"treeitem",
|
||||||
|
]
|
||||||
|
],
|
||||||
|
]
|
||||||
|
] = None,
|
||||||
|
slot: Optional[Union[Var[str], str]] = None,
|
||||||
|
spell_check: Optional[Union[Var[bool], bool]] = None,
|
||||||
|
tab_index: Optional[Union[Var[int], int]] = None,
|
||||||
|
title: Optional[Union[Var[str], str]] = None,
|
||||||
style: Optional[Style] = None,
|
style: Optional[Style] = None,
|
||||||
key: Optional[Any] = None,
|
key: Optional[Any] = None,
|
||||||
id: Optional[Any] = None,
|
id: Optional[Any] = None,
|
||||||
|
@ -191,6 +191,22 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|||||||
"""
|
"""
|
||||||
return string_upper_operation(self)
|
return string_upper_operation(self)
|
||||||
|
|
||||||
|
def title(self) -> StringVar:
|
||||||
|
"""Convert the string to title case.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
The string title operation.
|
||||||
|
"""
|
||||||
|
return string_title_operation(self)
|
||||||
|
|
||||||
|
def capitalize(self) -> StringVar:
|
||||||
|
"""Capitalize the string.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
The string capitalize operation.
|
||||||
|
"""
|
||||||
|
return string_capitalize_operation(self)
|
||||||
|
|
||||||
def strip(self) -> StringVar:
|
def strip(self) -> StringVar:
|
||||||
"""Strip the string.
|
"""Strip the string.
|
||||||
|
|
||||||
@ -482,6 +498,38 @@ def string_upper_operation(string: StringVar[Any]):
|
|||||||
return var_operation_return(js_expression=f"{string}.toUpperCase()", var_type=str)
|
return var_operation_return(js_expression=f"{string}.toUpperCase()", var_type=str)
|
||||||
|
|
||||||
|
|
||||||
|
@var_operation
|
||||||
|
def string_title_operation(string: StringVar[Any]):
|
||||||
|
"""Convert a string to title case.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
string: The string to convert.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
The title case string.
|
||||||
|
"""
|
||||||
|
return var_operation_return(
|
||||||
|
js_expression=f"{string}.split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(' ')",
|
||||||
|
var_type=str,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@var_operation
|
||||||
|
def string_capitalize_operation(string: StringVar[Any]):
|
||||||
|
"""Capitalize a string.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
string: The string to capitalize.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
The capitalized string.
|
||||||
|
"""
|
||||||
|
return var_operation_return(
|
||||||
|
js_expression=f"(((s) => s.charAt(0).toUpperCase() + s.slice(1).toLowerCase())({string}))",
|
||||||
|
var_type=str,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@var_operation
|
@var_operation
|
||||||
def string_strip_operation(string: StringVar[Any]):
|
def string_strip_operation(string: StringVar[Any]):
|
||||||
"""Strip a string.
|
"""Strip a string.
|
||||||
|
Loading…
Reference in New Issue
Block a user