gpui-component/assets/icons
Jason Lee 9a040eaaac
list: Refactor List, Dropdown delegate API to support section. (#1107)
Ref UITableView API:

https://developer.apple.com/documentation/uikit/uitableviewdatasource

## Changes

- Added some section related API to `ListDelegeate` and
`DropdownDelegate` with default implement, so if you don't need section
that you can just keep the default.
- Added `sections_count` method to get the number of sections, default
is 1.
- Added `render_section_header` for special the section header by if
needed, default return None.
- Added `render_section_footer` for special the section footer by if
needed, default return None.

## Break Changes

- The `DropdownState` have change new method to use IndexPath type:

  ```diff
  - DropdownState::new(vec![], Some(1), window, cx);
  + DropdownState::new(vec![], Some(IndexPath::new(1)), window, cx);
  ```

- The `ListDelegeate`, `DropdownDelegate` has changed API:
  - The `ix` are change from `usize` to `IndexPath`.

  ```diff
- fn render_item(&self, ix: usize, window: &mut Window, cx: &mut
Context<List<Self>>) -> Option<Self::Item>
+ fn render_item(&self, ix: IndexPath, window: &mut Window, cx: &mut
Context<List<Self>>) -> Option<Self::Item>

- fn set_selected_index(&mut self, ix: Option<usize>, window: &mut
Window, cx: &mut Context<List<Self>>)
+ fn set_selected_index(&mut self, ix: Option<IndexPath>, window: &mut
Window, cx: &mut Context<List<Self>>)
  ```

- The `items_count` method have added `section` argument to support list
section.
  
  ```diff
  - fn items_count(&self, cx: &App) -> usize
  + fn items_count(&self, section: usize, cx: &App) -> usize
  ```

- The `can_load_more` method has renamed to `is_eof` in `ListDelegate`
and `TableDelegate`.

  ```diff
  - fn can_load_more(&self, cx: &App) -> bool
  + fn is_eof(&self, cx: &App) -> bool
  ```

- The `can_search` method has renamed to `searchable` in `ListDelegate`.

  ```diff
  - fn can_search(&self) -> bool
  + fn searchable(&self) -> bool
  ```

## Showcase

<img width="1196" height="925" alt="image"
src="https://github.com/user-attachments/assets/22750abe-cc3f-427e-903b-51758bd4e027"
/>

<img width="1214" height="934" alt="image"
src="https://github.com/user-attachments/assets/52d42546-e6e7-4448-9c0f-43cd659fb630"
/>

---------

Co-authored-by: Floyd Wang <gassnake999@gmail.com>
2025-08-05 19:23:32 +08:00
..
a-large-small.svg
arrow-down.svg
arrow-left.svg
arrow-right.svg
arrow-up.svg
asterisk.svg
bell.svg
book-open.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
bot.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
building-2.svg avatar: Add Avatar element. (#1028) 2025-07-02 18:58:06 +08:00
calendar.svg
chart-pie.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
check.svg
chevron-down.svg
chevron-left.svg
chevron-right.svg
chevron-up.svg
chevrons-up-down.svg
circle-check.svg
circle-user.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
circle-x.svg
close.svg
copy.svg
dash.svg
delete.svg
ellipsis-vertical.svg
ellipsis.svg
external-link.svg menu: Add external link icon to link menu item. (#734) 2025-03-24 22:30:29 +08:00
eye-off.svg
eye.svg
folder-closed.svg list: Refactor List, Dropdown delegate API to support section. (#1107) 2025-08-05 19:23:32 +08:00
folder-open.svg list: Refactor List, Dropdown delegate API to support section. (#1107) 2025-08-05 19:23:32 +08:00
folder.svg list: Refactor List, Dropdown delegate API to support section. (#1107) 2025-08-05 19:23:32 +08:00
frame.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
gallery-vertical-end.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
github.svg
globe.svg
heart-off.svg
heart.svg
inbox.svg
info.svg
inspector.svg inspector: Add Inspector. (#897) 2025-05-26 16:44:11 +08:00
layout-dashboard.svg
loader-circle.svg
loader.svg
map.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
maximize.svg
menu.svg
minimize.svg
minus.svg
moon.svg
palette.svg
panel-bottom-open.svg
panel-bottom.svg
panel-left-close.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
panel-left-open.svg
panel-left.svg
panel-right-close.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
panel-right-open.svg
panel-right.svg
plus.svg
resize-corner.svg tiles: Add Tiles (#435) 2024-12-16 20:33:14 +08:00
search.svg
settings-2.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
settings.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
sort-ascending.svg table: Improve sort icon color and fix stripe row display. (#578) 2025-01-26 16:25:34 +08:00
sort-descending.svg table: Improve sort icon color and fix stripe row display. (#578) 2025-01-26 16:25:34 +08:00
square-terminal.svg sidebar: Add Sidebar (#452) 2024-12-02 23:21:39 +08:00
star-off.svg
star.svg
sun.svg
thumbs-down.svg
thumbs-up.svg
triangle-alert.svg
user.svg avatar: Add Avatar element. (#1028) 2025-07-02 18:58:06 +08:00
window-close.svg
window-maximize.svg
window-minimize.svg
window-restore.svg