Jason Lee
d7e04ecdd0
scrollbar: Improve Scrollbar to get correct scroll size. ( #985 )
...
Continue #984
- Fixes there may Scrollbar size not match the content size. Close #979
- Improved Table scrollbar to only render at scrollable area when there
have fixed columns.
<img width="850" alt="image"
src="https://github.com/user-attachments/assets/84f54515-e61a-484f-b2b4-ea5abb98ddb8 "
/>
## Break Changes
- The `Scrollbar` has been removed `entity_id` and `scroll_size`
argument from new method, it will get that value from `scroll_handle`.
- There still have a `scroll_size` optional method, if you want to give
your own.
- Also changed the `scroll_state`, `scroll_handle` to receive a ref.
```diff
- Scrollbar::vertical(entity_id, scroll_state, scroll_handle, scroll_size);
+ Scrollbar::vertical(&scroll_state, &scroll_handle);
+ Scrollbar::vertical(&scroll_state, &scroll_handle).scroll_size(scroll_size);
```
2025-06-18 19:09:34 +08:00
Jason Lee
da0063cb57
list: Fix search input padding. ( #981 )
...
This change to fix #965 affected search input size.
<img width="513" alt="image"
src="https://github.com/user-attachments/assets/f8fce042-2f53-4dc3-a725-64a1b0ed6630 "
/>
<img width="550" alt="image"
src="https://github.com/user-attachments/assets/048e9ef8-da2d-4b9b-ad24-ccda55695c8b "
/>
<img width="517" alt="image"
src="https://github.com/user-attachments/assets/f06f7e9a-bf30-4e01-a0aa-0a1db6b2c6e1 "
/>
2025-06-18 14:07:21 +08:00
Jason Lee
61283a71f0
scrollbar: Refactor ScrollbarState to have Cell inside. ( #959 )
...
## Break Change
- Now we added `Rc<Cell<>>` inside the ScrollbarState.
```diff
- scroll_state: Rc<Cell<ScrollbarState>>,
+ scroll_state: ScrollbarState,
```
2025-06-16 15:11:52 +08:00
Floyd Wang
aaa855053f
list: Add a default style for empty data ( #955 )
...
<img width="890" alt="image"
src="https://github.com/user-attachments/assets/68339cab-023f-42bc-93cc-0cded1b690b0 "
/>
2025-06-13 15:44:00 +08:00
enpitsulin
1214798abd
chore: Update GPUI and fix uniform_list API changes. ( #945 )
...
close #943
I am not sure about title specification of PR. pls feel free to edit.
2025-06-11 17:48:04 +08:00
Ylin
01197769df
list: Improve the selection method to support more scenarios ( #925 )
2025-06-06 19:50:49 +08:00
Jason Lee
bc398adbf3
input: Refactor Input, Picker as stateless mode. ( #858 )
2025-05-16 23:41:26 +08:00
Jason Lee
413d156ef4
input: Update Input text method to return &SharedString type. ( #800 )
...
## Break Changes
- input: Now the `text` method `Input` changed return type from
`SharedString` to `&SharedString`.
- list: Remove `set_query` and `query` method from `List`, you can use
`query_input` to instead.
2025-04-17 19:52:14 +08:00
Jason Lee
034e465d28
list: Select first item on search. ( #798 )
2025-04-17 17:29:02 +08:00
Jason Lee
8d37716b88
list: Export query_input for support update the default Query Input. ( #794 )
...
## Break Change
- Updated `set_placeholder` and `set_pattern` method to add `window` and
`cx` argument.
```diff
- fn set_placeholder(&mut self, placeholder: impl Into<SharedString>)
+ fn set_placeholder(&mut self, placeholder: impl Into<SharedString>, _:
&Window, cx: &mut Context<Self>)
- fn set_pattern(&mut self, pattern: regex::Regex)
+ fn set_pattern(&mut self, pattern: regex::Regex, window: &mut Window,
cx: &mut Context<Self>)
```
2025-04-15 20:36:04 +08:00
Jason Lee
73be54a0f7
input: Improve clear button position in Input. ( #782 )
...
| Before | After |
| -- | -- |
| <img width="529" alt="image"
src="https://github.com/user-attachments/assets/02fdba71-7e83-43b9-ba4c-476eb21dcf28 "
/> | <img width="530" alt="image"
src="https://github.com/user-attachments/assets/ad7b6378-c9ff-4ea4-943a-87af53a2ac79 "
/> |
2025-04-11 19:13:17 +08:00
Jason Lee
a60acd7e4d
list: Add secondary confirm support to list. ( #769 )
2025-04-02 16:45:27 +08:00
Jason Lee
a89f971108
chore: Update GPUI 2025/03/20 and fix spawn method. ( #725 )
...
- Update `resvg`, `usvg` to 0.45.0
2025-03-20 21:23:50 +08:00
Floyd Wang
d95cbabcc3
dropdown: Do not reset the selected index when cancelling ( #618 )
...
## Before
https://github.com/user-attachments/assets/e33c2324-94f0-42b0-99cc-9e2dcdee3f3d
## After
https://github.com/user-attachments/assets/7c5c6fee-b0f6-4cd5-986e-ea8f6f0e7f9d
2025-02-11 18:54:52 +08:00
Jason Lee
dffb419145
chore: Fix subscriptions leak. ( #597 )
2025-02-04 15:43:26 +08:00
Jason Lee
6fa1888ee6
chore: Upgrade for GPUI API changes. ( #589 )
2025-01-29 16:49:17 +08:00
Jason Lee
327d40e0e0
chore: Upgrade GPUI 3 ( #587 )
...
The pervious version has keep on
[gpui2](https://github.com/longbridge/gpui-component/tree/gpui2 ) branch,
if there need to use.
Ref https://github.com/zed-industries/zed/pull/22632
## Prepare
### Generate index.scip
```bash
rust-analyzer scip ./ > index.scip
```
### Get [refactor](https://github.com/zed-industries/refactor )
```bash
https://github.com/zed-industries/refactor.git
```
## Refactor exist code
```bash
cd refactor
cargo run -- ~/work/gpui-component
```
Then will get result if successed:
```
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
Running `target/debug/refactor /Users/jason/work/gpui-component`
Loaded 115 SCIP documents
Processing files starting with focus path: ""
Changed 90 files
```
-------------
## Changes
```diff
- View<T>
- Model<T>
+ Entity<T>
- WeakView<T>
+ WeakEntity<T>
- FocusableView
+ Focusable
- cx.bounds()
+ window.bounds()
- cx.refresh()
+ window.refresh()
- cx.focused()
+ window.focused(cx)
- cx.with_optional_element_state
- window.with_optional_element_state
```
```diff
- &mut WindowContext
+ &mut Window, &mut App
- cx: &mut WindowContext
+ window: &mut Window, cx: &mut App
- &mut ViewContext<
+ &mut Window, &mut Context<
- cx: &mut ViewContext<
+ window: &mut Window, cx: &mut Context<
```
```diff
- cx.spawn(|_, mut cx| async move {
+ cx.spawn_in(window, |_, mut cx| async move {
- cx.dispatch_action(Box::new(...))
+ window.dispatch_action(Box::new(...), cx)
```
`cx.spawn`
```diff
- cx.spawn(|view, mut cx| async move {
+ cx.spawn_in(window, |view, mut window| async move {
+ _ = view.update_in(&mut window, move |view, window, cx| {
```
2025-01-27 03:58:48 +08:00
Jason Lee
78ce573a52
list, table: Refactor to control loading by use delegate. ( #562 )
...
- Add `loading` method to `ListDelegate` and `TableDelegate` to control
loading view display.
## Break Changes
- Remove `loading`, `set_loading` method from List and Table, use
`loading` method in delegate instead.
2025-01-21 20:33:37 +08:00
Jason Lee
9f2cd84b23
color: Add mix method and merge ColorExt to Colorize. ( #561 )
...
- Add `mix` method to mix two color.
- Export `ui::theme::*` to crate root, before `use
ui:theme::ActiveTheme` to `use ui::ActiveTheme`.
## Break Changes
- Moved `ui::theme::Colorize` to `ui::Colorize`.
- Merged `ColorExt` to `Colorize`.
- Renamed `to_hex_string` to `to_hex`, `parse_hex_string` to
`parse_hex`.
2025-01-21 18:31:01 +08:00
Jason Lee
4fa8b9d65c
list: Fix #552 broken move down to select first item. ( #553 )
2025-01-17 16:19:03 +08:00
Jason Lee
f41edfd318
list: Add ListEvent to List. ( #552 )
...
- Add `ListEvent` and emit event for List with `Select`, `Confirm`,
`Cancel` events.
## Break Changes
- Removed useless `ListDelegate::confirmed_index` method.
- Updated `ListDelegate::confirm` method, to change `ix: Option<usize>`
to `ix: usize`.
2025-01-17 16:00:28 +08:00
Jason Lee
04d720f3a7
chore: Improve Table, List load more threshold, and avoid duplicate request. ( #550 )
...
- Default `threshold` changed to 20.
2025-01-17 11:25:41 +08:00
Jason Lee
7848311046
list, table: Add default loading animation to List and Table. ( #546 )
...
<img width="485" alt="image"
src="https://github.com/user-attachments/assets/568cbf3a-6e32-4b21-8816-5e3cb26acc82 "
/>
<img width="755" alt="image"
src="https://github.com/user-attachments/assets/5e13d6b8-e6f4-4cc3-b1f6-9b378ff523a4 "
/>
2025-01-14 11:36:33 +08:00
ihavecoke
1d18edef12
list: Allow disabling List selection. ( #545 )
...
## Break changes
- Renamed list `enable_scrollbar` to `scrollbar_visible` to match with
the table API.
---------
Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-01-14 10:05:49 +08:00
Jason Lee
bf82e3db13
list, table: Add scroll_to_item to List, scroll_to_row to Table. ( #535 )
2025-01-09 14:23:46 +08:00
Jason Lee
3773337e04
list: Add load_more. ( #532 )
2025-01-08 15:05:40 +08:00
Jason Lee
d7cd0e54c2
list: Fix selected and confirmed list item detail. ( #520 )
...
Closes #519 to fix popup_menu attempt to subtract with overflow bug.
2024-12-27 18:41:27 +08:00
Jason Lee
d4819b34aa
chore: Update GPUI with AnchorCorner renamed to Corner. ( #497 )
...
Ref https://github.com/zed-industries/zed/pull/22119
2024-12-18 18:02:47 +08:00
Jason Lee
fa6abe5a9e
chore: Upgrade GPUI and fix API changes. ( #426 )
...
Refs:
- https://github.com/zed-industries/zed/pull/20349
- https://github.com/zed-industries/zed/pull/20371
- https://github.com/zed-industries/zed/pull/20686
2024-11-18 11:35:49 +08:00
Jason Lee
270493f3ce
list: Fix to set_selected_index when List up, down to select item. ( #398 )
2024-11-06 18:44:10 +08:00
Jason Lee
0b0fc61c2f
chore: Avoid cx.prevent_default when ListItem or other click ( #381 )
2024-10-29 16:54:08 +08:00
Jason Lee
a798bd81c6
chore: Fix typos. ( #364 )
2024-10-18 14:30:24 +08:00
Jason Lee
a4260c109f
table, list: Avoid use deferred to show selected row style. ( #363 )
...
<img width="956" alt="image"
src="https://github.com/user-attachments/assets/0f72b556-76bc-4808-bca8-c261411656d1 ">
2024-10-18 13:27:59 +08:00
Jason Lee
4bef681c9a
table, list: Add right clicked row style and improve selection style. ( #362 )
...
- table: Add `content_menu` to TableDelegate.
<img width="644" alt="image"
src="https://github.com/user-attachments/assets/4c21299f-00e8-4a61-964d-338ef7daa802 ">
2024-10-18 11:52:14 +08:00
Jason Lee
c02cb802cb
list: Add cx argument to ListDelegate. ( #361 )
...
Following #360 TableDelegate changes.
2024-10-18 10:17:59 +08:00
Jason Lee
41c64e2912
chore: Update controls detail. ( #352 )
...
- Better icon style in Input, Dropdown, DatePicker.
2024-10-16 17:51:39 +08:00
Jason Lee
185eca6c67
scrollbar: Update GPUI and fix scrollbar with new API. ( #307 )
...
The https://github.com/zed-industries/zed/pull/18513 has been changed
the `UniformListScrollHandle` API, it provided the scroll contents size,
so we not need calculate it again.
2024-10-04 10:23:11 +08:00
ihavecoke
2da13499e5
list: Add render_initial support to List. ( #258 )
...
Add a method to the List component to render the initial state. When
input is empty, you may need to render a special interface to the user.
This method can be called at this point
### Showcase
https://github.com/user-attachments/assets/39c61bfe-4451-43f9-b0d9-8f941ebd94dd
2024-09-21 01:53:32 +08:00
Jason Lee
0e16d742bb
list: Add set_size method to List and fix input size in small dropdown. ( #246 )
2024-09-16 19:57:49 +08:00
Jason Lee
7a00e8a68e
Add search to List example. ( #168 )
...
- Fix drawer, modal open to focus on first input.
2024-08-19 16:13:14 +08:00
Floyd Wang
a02a6ed6b8
Set default true for cleanable & trigger event when dropdown clean ( #152 )
2024-08-15 18:01:43 +08:00
Jason Lee
63f333d8ad
Add Drawer ( #137 )
...
- Update scrollable to accept EntityId.
https://github.com/user-attachments/assets/a6c02890-3a6e-4b82-b5c5-3f0a48f35368
2024-08-13 16:01:52 +08:00
Jason Lee
f3fdfae002
Fix list next to select first item, cancel to deselect item. ( #110 )
...
- Add confirmed to ListItem to show check style.
2024-08-06 11:31:35 +08:00
Jason Lee
8aaeb9383d
Fix dropdown click to lose focus. ( #80 )
2024-07-29 19:00:17 +08:00
Jason Lee
a3df086e79
theme: Fix list, table theme colors. ( #79 )
...
- Fix list, table theme colors.
- Fix table hover bg.
- Add avatar to table list.
- Update dropdown Size:Small style.
2024-07-29 13:52:45 +08:00
Floyd Wang
d278d85058
Imporve dropdown ( #73 )
...
* Remove min-height
* Provide `render_empty` for custom empty view
* Fix crash when delegate is empty
2024-07-26 14:31:47 +08:00
Jason Lee
d60a1122d4
Scroll to top when list have searched. ( #64 )
2024-07-24 10:09:12 +08:00
Jason Lee
b4862082f1
Improve list item ( #61 )
2024-07-23 22:08:21 +08:00
Jason Lee
652efd187c
Update list to save the task on the struct.
2024-07-23 10:51:11 +08:00
Jason Lee
80bdf20376
Export set_query and query method to List.
2024-07-23 10:15:38 +08:00