Commit Graph

35 Commits

Author SHA1 Message Date
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
Jason Lee
66a9b3e9df avatar: Add Avatar element. (#1028)
<img width="1384" alt="image"
src="https://github.com/user-attachments/assets/1e66aa8c-0c87-4d8d-abb7-38e5f616fe3e"
/>
<img width="1384" alt="image"
src="https://github.com/user-attachments/assets/bd32b6e0-aa0f-4d01-af9f-4bfaea1a3718"
/>
2025-07-02 18:58:06 +08:00
Jason Lee
1c11b5fb55 inspector: Add Inspector. (#897)
<img width="1434" alt="image"
src="https://github.com/user-attachments/assets/f6ec2e1d-ff1c-4798-90fe-d29bef20fa9d"
/>
2025-05-26 16:44:11 +08:00
Jason Lee
f650491605 menu: Add external link icon to link menu item. (#734)
<img width="403" alt="image"
src="https://github.com/user-attachments/assets/ad6682b6-2114-4f55-be84-d06c02ae401e"
/>
2025-03-24 22:30:29 +08:00
Jason Lee
e658aeee96 table: Improve sort icon color and fix stripe row display. (#578)
- Improve sort icon color:

<img width="139" alt="image"
src="https://github.com/user-attachments/assets/6374c26a-4555-4735-953b-dbd961fe5b31"
/>

- Avoid duplicate border when enabled fixed column.

<img width="587" alt="image"
src="https://github.com/user-attachments/assets/6e186d29-5d8a-404e-b160-20c2af6a16fa"
/>


TODO

- [x] The extra rows not show when `stripe` is true.
2025-01-26 16:25:34 +08:00
xda
5874c6974f tiles: Add Tiles (#435)
## Break Changes

- Renamed `DockItemState` to `PanelState`.
- Renamed `DockItemInfo` to `PanelInfo`.
- Update `cx` type from `WindowContext` to `AppContext` for Panel trait
`panel_name` method.

## TODO

- [ ] Support merge panels into TabPanel.
- [ ] Support split panels into Tile.

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
2024-12-16 20:33:14 +08:00
Jason Lee
23d273eaf9 sidebar: Add Sidebar (#452)
Close #430

<img width="1150" alt="image"
src="https://github.com/user-attachments/assets/2564bcfa-7aff-41d3-a7be-496ef2365e30">

<img width="1150" alt="image"
src="https://github.com/user-attachments/assets/18c6718a-7641-4e8f-ad0f-bc18bd91fc42">
2024-12-02 23:21:39 +08:00
Jason Lee
142d092867 dock: Add add_panel method to add panel to DockArea. (#440)
Ref #438 

https://github.com/user-attachments/assets/93b40aed-39f3-4d16-a442-13aa7a931895
2024-11-27 11:27:04 +08:00
Jason Lee
e478d5606f chore: Add base ui attributes to Root and add change font size to story to test font adjust. (#409) 2024-11-12 11:17:16 +08:00
Jason Lee
fdca75d5a7 title_bar: Add a new TitleBar, remove the old version. (#348)
- Removed old workspace crate, moved out to
[gpui-workspace](https://github.com/huacnlee/gpui-workspace)

<img width="491" alt="image"
src="https://github.com/user-attachments/assets/5048491c-9b98-4af5-9f0f-9a0f20c2308f">

Icons for Windows and Linux use by SVG icon, it based on:

-
https://learn.microsoft.com/en-us/windows/apps/design/style/segoe-fluent-icons-font
- Download Font: [Segoe Fluent
Icons](https://learn.microsoft.com/en-us/windows/apps/design/downloads/#fonts)
2024-10-16 16:22:17 +08:00
xda
219d5a4293 icon: Fix broken assets delete.svg (#340) 2024-10-14 22:07:18 +08:00
Jason Lee
6f1be83b6e dock: Add left, bottom, right fixed dock and support toggle. (#291)
- Improve TabPanel to support control closable.

## Demo 


https://github.com/user-attachments/assets/dcf8cde3-61ee-42f6-be93-76f10fc8cf34
2024-10-02 17:42:52 +08:00
Jason Lee
1f0e52da50 Add ColorPicker (#199)
<img width="262" alt="image"
src="https://github.com/user-attachments/assets/ad96859f-e6cb-47a6-bedb-fef02122b711">
2024-09-02 00:21:01 +08:00
Jason Lee
981d1391e6 Update Root API (#150) 2024-08-15 17:27:34 +08:00
Jason Lee
c9763224c2 Add Notification (#149)
https://github.com/user-attachments/assets/8a10bff7-f669-471e-8516-2a64ae95ae0a
2024-08-15 16:50:33 +08:00
Jason Lee
ebdcf244e2 Add Calendar and DatePicker. (#117)
https://github.com/user-attachments/assets/dda87fa7-f080-418a-8dd7-ab8581eb3beb
2024-08-07 20:25:11 +08:00
Jason Lee
340c5fef3d Improve OtpInput to add more size, use Icon to render mask. (#116)
- Add `default_value`, `set_value`, `masked` method.
- Add `set_value`, `value` method to set/get from OptInput.
 
<img width="390" alt="image"
src="https://github.com/user-attachments/assets/ef5368e9-132d-4de6-8506-aeecc47a9189">
2024-08-07 11:39:02 +08:00
Floyd Wang
12b5d1b501 Add clipboard (#105) 2024-08-05 11:35:02 +08:00
Jason Lee
e9d409a4b1 Add Link style Button (#97)
<img width="1305" alt="image"
src="https://github.com/user-attachments/assets/ee42d86f-e237-4544-aa2d-1414dabfb55e">

- Update `primary`, `danger`, `outline`, `ghost`, `link` methods to as a
builder method to just change style.
- Add `compact` used to reduce padding.

<img width="1279" alt="image"
src="https://github.com/user-attachments/assets/ccbd71c0-9157-4ef8-b164-b99ade24cf92">
2024-08-01 19:54:35 +08:00
Jason Lee
0e3736e312 Update Dropdown title to use SharedString (#95) 2024-08-01 11:00:18 +08:00
Jason Lee
6465969c5a Improve svg_img to use cached assets. (#87) 2024-07-30 19:54:27 +08:00
Jason Lee
f496c241d7 button: Fix Button click prevent_default. (#84)
- Use icon in title_bar for switch theme, and add GitHub icon.
2024-07-30 00:28:18 +08:00
Jason Lee
15e9804f08 table: Add sort button to table column. (#77)
https://github.com/user-attachments/assets/d6a3dc9b-758f-4108-8d1d-d8a3d2dc0dc2
2024-07-28 23:24:55 +08:00
Jason Lee
30f34dc780 Fix button icon color support (#57) 2024-07-23 13:45:34 +08:00
Jason Lee
5034152f21 Improved Input prefix, suffix with a builder to support Element. (#54)
- Add loading to List query input and changed perform_search now return
a Task.
2024-07-22 15:30:07 +08:00