funix icon indicating copy to clipboard operation
funix copied to clipboard

Easy association from a new type to a parametric or non-parametric widget

Open forrestbao opened this issue 2 years ago • 0 comments

To-do: support usage like this below where the user can different types of strings, inherited from the str type and associated with different UI components.

import funix

@funix.new_funix_type(
    widget=[
        # "MUI-TextField", 
        "textarea",
        {"min":10, "max":20 ,"multiline":True} # props of TextField in MUI
    ]
) 
class long_str(str):
    pass

type="password"@funix.new_funix_type(
    widget=[
        # "MUI-TextField", 
        "input",
        {"type":"password"} # props of TextField in MUI
    ]
) # Coming soon! 
class password(str): # For this type of strings,  the content will be hidden unless revealed
    pass

@funix.funix()
def foo(x: long_str, y: password) -> str: 
    return f"{x} {y}"

forrestbao avatar Sep 04 '23 11:09 forrestbao