-
-
Notifications
You must be signed in to change notification settings - Fork 609
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
Enhance ElementFilter #3735
base: main
Are you sure you want to change the base?
Enhance ElementFilter #3735
Conversation
…orage.user` and `app.storage.browser`.
For ElementFilter's `__init__\within\not_within\exclude` method: `marker` parameter supports string list and string with whitespace in string list now.
parameters `kind` and `content` in method `__init__\within\not_within\exclude` support list now.
Now ElementFilter's method supports constructing in one step. from nicegui import ui,ElementFilter
with ui.row():
with ui.card():
ui.button('button A')
ui.label('label A_A')
ui.label('label A_B')
with ui.card():
ui.button('button B')
ui.label('label B_B')
ui.label('label B_A')
with ui.column():
with ui.list():
ui.button('button A')
ui.label('label A_A')
ui.label('label A_B')
ElementFilter(kind=[ui.button,ui.label]).within(kind=[ui.card,ui.row]).classes('bg-red')
ElementFilter(kind=[ui.button,ui.label]).not_within(kind=[ui.card,ui.row]).classes('text-2xl')
ElementFilter(kind=[ui.button,ui.label]).exclude(kind=[ui.label]).classes('text-green')
ui.run() |
I make a tab for beginner to learn ElementFilter's method, but I don't know how to insert it in document correctly, can anyone help me? Thank you so much! Match type for parameters in ElementFilter's method:
| ElementFilter's method | `__init__` | `within` | `not_within` | `exclude` |
| ---------------------- | ---------- | -------- | ------------ | --------- |
| parameter `kind` | any/or | all/and | any/or | any/or |
| parameter `content` | all/and | ---- | ---- | any/or |
| parameter `instance` | ---- | all/and | any/or | ---- |
| parameter `marker` | all/and | all/and | any/or | any/or | |
Thanks @python-and-fiction. The review and commenting would be much easier if this would be two separate pull requests. About the whitespace in list elements: About the list of kinds (and the table): |
@rodja Hi,I am writing a chinese guide of nicegui for beginner. When I learn element's mark methond, I found that mark method supports |
For ElementFilter's
__init__\within\not_within\exclude
method:marker
parameter supports string list and string with whitespace in string list now.We can do it in ElementFilter like element's
mark
method.