From 30a1f9fb8aa442c1c1b7fb44fe090339c71e8236 Mon Sep 17 00:00:00 2001 From: dgodinez-dh <77981300+dgodinez-dh@users.noreply.github.com> Date: Fri, 20 Dec 2024 10:30:17 -0700 Subject: [PATCH] docs: Render Lists (#1061) https://deephaven.atlassian.net/browse/DOC-232 --------- Co-authored-by: Mike Bender <mikebender@deephaven.io> Co-authored-by: margaretkennedy <82049573+margaretkennedy@users.noreply.github.com> --- plugins/ui/docs/_assets/render_lists1.png | Bin 0 -> 10568 bytes plugins/ui/docs/_assets/render_lists2.png | Bin 0 -> 6687 bytes plugins/ui/docs/describing/render_lists.md | 159 +++++++++++++++++++++ plugins/ui/docs/sidebar.json | 4 + 4 files changed, 163 insertions(+) create mode 100644 plugins/ui/docs/_assets/render_lists1.png create mode 100644 plugins/ui/docs/_assets/render_lists2.png create mode 100644 plugins/ui/docs/describing/render_lists.md diff --git a/plugins/ui/docs/_assets/render_lists1.png b/plugins/ui/docs/_assets/render_lists1.png new file mode 100644 index 0000000000000000000000000000000000000000..eca88bb265446b7a704bbaee1d86ead5bf077df3 GIT binary patch literal 10568 zcmdUVXIN9;w<Z=O^e76pfDsTWO78?DD7{FLUIkQoO+Z={f~X)J0i`I_P(lYO0YL>p z1nJU6lt2PRN+^MlIpO!8XJ+oqe3`lT&NCnKoaB_f*IwD{eb;)|d3M`Si=E{>3j+fK zyN>ov69$H3PzHu07eFU~Gv5+pPXdP{0VY~-25jHOCE&;L`|1Yj3=CBXtou%kz;9+> zZL0tVhEsv`&yksXe8CJ1SEqGus+$GduT1xQT+nO7ukDJTxX#8Y?K^ksixs;x?QzSi z%+TzZDa9ZT%L}Y0j>d=@U1B<V*|Gh|wMh08(T?JAaq1`duiaIbu>N8F1LS$`a&0AJ zC#cL`VMlGp@J>*j*|j=Ps{zc9_0Y9n&q_+0OZQY_DeogTQ9CiT9nPbGSqxY(oPJQa z1v&y8ex8ON2M&)+(O~*n!xwB&afkh*ahpc89is!9(ZR;-0V{Cf?<F)?9}N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100644 index 0000000000000000000000000000000000000000..3b876c3b5f53f6421cbb69a833a988eabfdc792d GIT binary patch literal 6687 zcmeI0X<U-)xA$qc8%)#PcFb{??Ompcnu#e%*<h1WIc5%_4NA@vI6-Zv)Rf&na~88w z98w%|1jPw02eged3W<>;BI1m|!S?g&d3FBJbI#{;UYr-ebzj`~#afHC*7tW^@wcoj z4jxcG0000EUb}kf4gjzlDjw7K?-jqZ7EEE{k6nRxEX)CA6xCVr#m|o~SY7}CDln4U zusz~y3BRj%0|9_vgLYoK=#Mmz0Knmo*DhVKLAtOfpifji|NII=C&oORpwnkFW{XCP zV<sN1tGtJrnwG-hHQ|yU5`zuoG<}~P-1GL$&wEVdjFfDYHt#=>GEkbmFL@v@DnBZz zIkn}ejNPAye$tjP*xJkKP(d4LTE85+m+G9FKfQEbOZf0oUEY+%C8GZ#Nth;502q%7 zzcU2AS4pA?^iKfP?&(Y+MhO6TdVwhc0Q~k0`4a$e^*5~8`d^<P7f=8EW4fgtKGIl_ z@nt$Ua+jun%MqrFIPcA(H35L^E6jNJL*lq(%m0@RW{*8dio219kN(Vsk0H|;BN7v7 zGHokMl^XG4^S-{{)DQ{KO|J^P2jg+C7Wl8r!^>suNcaNF*!;CDzy8QyAH}5!uC~hp z0LLw*@<fQuW&BYrojlOik7`s)4R2X)>WN7j4u?&JP>F}6$y9s_Qb)8d+CH<r>M9yD z1}5;B29~^ko|lJO@-m;}5W(a34||$<sS_o#5SibT{Kg}%IYBzUkRo}$lO+(*d|s%( zV>W0F=pOg|vN&W<UwyySN!{jwV2EI&@i3ySbme*D5r%XLb-Jy+_c#mz;hSdF@R7PV z+gUuxEf8#Kddmp4zl7jxju1F{kDZW(g#>E{b+grpbm@7}@r2OQB0tWo6`H<i=g@eY z(oKH)*^SxZ<-kel4ytVpsKNUSSK#%cbN41)N*roeC(K78Y^@j!N%jJgH>G7eeShss zNWD)@Pn3qaHig9dkZt#Q4c0(fyn2xPiZiu%os)xeBdvwe=#iVp#<RATOFRF5pYR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cbtCrkdv}XuxgJ~WQ37d)hL;T$P z|9<%YKOGeOCxylTuKn+x!2Ayktm<syl4zH?IZ)qVMCq1TBm%Bowz^bie*e$^06&qK ANdN!< literal 0 HcmV?d00001 diff --git a/plugins/ui/docs/describing/render_lists.md b/plugins/ui/docs/describing/render_lists.md new file mode 100644 index 000000000..61f309c34 --- /dev/null +++ b/plugins/ui/docs/describing/render_lists.md @@ -0,0 +1,159 @@ +# Render Lists + +You will often want to display multiple similar components from a collection of data. You can use the Python [`filter`](https://docs.python.org/3/library/functions.html#filter) function and [`list comprehensions`](https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions) with `deephaven.ui` to filter and transform your list of data into a list of components. + +## Render data from lists + +Here is an example list of content: + +```python +from deephaven import ui + + +@ui.component +def content_list(): + return ui.flex( + ui.text("apple: fruit"), + ui.text("broccoli: vegetable"), + ui.text("banana: fruit"), + ui.text("yogurt: dairy"), + ui.text("carrot: vegetable"), + direction="column", + ) + + +my_content_list = content_list() +``` + +![my_content_list](../_assets/render_lists1.png) + +The only difference among those list items is their contents (their data). You will often need to show several instances of the same component using different data when building interfaces. Here is a short example of how to generate a list of items from a list of data: + +1. Move the data into a list +2. Use list comprehension to map the list of data to a list of components +3. Use the list of components in your component + +```python +from deephaven import ui + +food = [ + "apple: fruit", + "broccoli: vegetable", + "banana: fruit", + "yogurt: dairy", + "carrot: vegetable", +] + + +@ui.component +def content_list(data): + # map the text items to components + components = [ui.text(item) for item in data] + return ui.flex(components, direction="column") + + +my_content_list = content_list(food) +``` + +## Filter lists of items + +If you want a way to only show items of type vegetable, you can use the Python `filter` function to return just those items. + +```python +from deephaven import ui + +food = [ + "apple: fruit", + "broccoli: vegetable", + "banana: fruit", + "yogurt: dairy", + "carrot: vegetable", +] + + +@ui.component +def content_list(data, data_type): + # filter for items that end with the desired data type + filtered = list(filter(lambda item: item.endswith(data_type), data)) + # map the text items to components + components = [ui.text(item) for item in filtered] + return ui.flex(components, direction="column") + + +my_content_list = content_list(food, "vegetable") +``` + +![my_content_list2](../_assets/render_lists2.png) + +## Keep list items in order with keys + +Keys tell `deephaven.ui` which list item each component corresponds to so that it can match them up later. This becomes important if your list items can move (e.g., due to sorting), get inserted, or get deleted. A well-chosen key helps `deephaven.ui` infer exactly what happened and make the correct updates. + +Rather than generating keys on the fly, you should include them in your data. + +### Where to get your key + +Different sources of data provide different sources of keys: + +- Data from a database: If your data is coming from a database, you can use the database keys/IDs, which are unique by nature. +- Locally generated data: If your data is generated and persisted locally, use an incrementing counter or a package like `uuid` when creating items. + +### Rules of keys + +- Keys must be unique among siblings. However, it is okay to use the same keys for items in different lists. +- Keys must not change. Do not generate them while rendering. + +In this example, the `ui_cells` component can add cell which can be deleted. The line `key=str(i)` is commented out, so the cell components do not have keys. If the user tries to delete a cell in the middle of the component, the last cell will be deleted instead. Comment in the line that sets the key. Now the correct cell will be deleted. + +```python +from deephaven import ui +import itertools + + +@ui.component +def ui_cell(label="Cell"): + text, set_text = ui.use_state("") + return ui.text_field(label=label, value=text, on_change=set_text) + + +@ui.component +def ui_deletable_cell(i, delete_cell): + return ui.flex( + ui_cell(label=f"Cell {i}"), + ui.action_button( + ui.icon("vsTrash"), + aria_label="Delete cell", + on_press=lambda: delete_cell(i), + ), + align_items="end", + ) + + +@ui.component +def ui_cells(): + id_iter, set_id_iter = ui.use_state(lambda: itertools.count()) + cells, set_cells = ui.use_state(lambda: [next(id_iter)]) + + def add_cell(): + set_cells(lambda old_cells: old_cells + [next(id_iter)]) + + def delete_cell(delete_id: int): + set_cells(lambda old_cells: [c for c in old_cells if c != delete_id]) + + return ui.view( + [ + ui_deletable_cell( + i, + delete_cell, + # uncomment this line to fix + # key=str(i) + ) + for i in cells + ], + ui.action_button(ui.icon("vsAdd"), "Add cell", on_press=add_cell), + overflow="auto", + ) + + +cells = ui_cells() +``` diff --git a/plugins/ui/docs/sidebar.json b/plugins/ui/docs/sidebar.json index 25fe4e356..d0f924735 100644 --- a/plugins/ui/docs/sidebar.json +++ b/plugins/ui/docs/sidebar.json @@ -49,6 +49,10 @@ "label": "Conditional Rendering", "path": "describing/conditional_rendering.md" }, + { + "label": "Render Lists", + "path": "describing/render_lists.md" + }, { "label": "Pure Components", "path": "describing/pure_components.md"