Jason Lee
38d9c24af5
chore: Update getter method to return reference to view components. ( #827 )
2025-04-30 17:18:44 +08:00
Jason Lee
b0ff230588
table: Disable auto scroll when resize column out of the table right bounds. ( #811 )
...
https://github.com/user-attachments/assets/f1569eb5-e6e6-43f9-9425-0de5e2235163
Do same behavior like the macOS table.
2025-04-23 22:18:40 +08:00
Jason Lee
3cff72cc37
table: Fix render_tr to ensure apply with h_flex. ( #810 )
...
- Reduce last empty column to 12px.
2025-04-23 22:09:14 +08:00
Ylin
affd29dc85
table: Ensure to select row when prev or next. ( #805 )
2025-04-22 18:46:41 +08:00
Jason Lee
a60acd7e4d
list: Add secondary confirm support to list. ( #769 )
2025-04-02 16:45:27 +08:00
Jason Lee
ebe93210af
Use normal cursor for buttons. ( #760 )
...
This change to follow native UI to use normal cursor for all buttons,
items.
Only use `pointer` for link item.
2025-04-01 17:59: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
Jason Lee
6e2bb3fb58
scrollbar: Update scrollbar hitbox to it bounds, not fill the full of parent view. ( #624 )
...
And revert some #621 wrong changes for hover to show scrollbar.
2025-02-14 13:54:02 +08:00
Jason Lee
437f1b2098
theme: Add to support always show scrollbar mode and default to match with system style. ( #621 )
...
Close #573
- Fix theme settings to keeping when switch theme mode.
2025-02-12 15:15:33 +08:00
Jason Lee
2e3f3dd669
scrollbar: Add max_fps to limit drag scroll update rate for reduce CPU usage. ( #604 )
...
And set Table to use 60 FPS.
2025-02-07 10:07:47 +08:00
Jason Lee
bc579c0b93
table: Fix Table subtract with overflow error. ( #602 )
...
```
thread 'main' panicked at gpui-component-f2cfc37a601d48ab/dffb419/crates/ui/src/[table.rs:1562](http://table.rs:1562/ ):45:
attempt to subtract with overflow
stack backtrace:
```
2025-02-05 19:26:19 +08:00
Jason Lee
3ffbbb0688
theme: Ensure all elements to use radius. ( #596 )
...
- Fix menu dispatch action.
2025-02-03 19:03:16 +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
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
Jason Lee
1689f4208f
table: Add measure to table. ( #577 )
...
- Improve to not calc extra rows if `stripe` not enable.
- Improve to not change offset, when scrollbar drag changed less than
1px.
- Improve render cells to use `Vec::with_capacity` to prepare enough
space.
```bash
ZED_MEASUREMENTS=1 MTL_HUD_ENABLED=1 cargo run --release --example table
```
2025-01-24 18:59:01 +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
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
Jason Lee
1218ceb7dc
table: Add scrollbar_visible to Table for control the scrollbar visibility. ( #544 )
...
Ref #513 #542
Add this to ability to render some custom view on top of the table, but
below of the scrollbar.
## Break changes
- table: Renamed `scrollbar_state` to `vertical_scrollbar_state`.
- table: Removed `scroll_handle` and `horizontal_scroll_handle` method,
there have a pub `vertical_scroll_handle` and `horizontal_scroll_handle`
prop.
2025-01-13 14:59:03 +08:00
Ylin
eb10186463
table: Add visible_rows_changed, visible_cols_changed method to table delegate. ( #543 )
...
Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-01-13 13:51:20 +08:00
Jason Lee
205a499bc9
table: Revert deferred render scrollbr for table. ( #542 )
...
This will make scrollbar always stay on top, even there have other
element cover it.
2025-01-12 22:32:43 +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
Floyd Wang
d48a6d4b43
table: Support clear selection ( #533 )
2025-01-08 16:18:49 +08:00
Jason Lee
3773337e04
list: Add load_more. ( #532 )
2025-01-08 15:05:40 +08:00
Jason Lee
99e51288e0
table: Binding popup menu on the table not on row for avoid render it on each rows. ( #528 )
...
- Add `TableEvent::DoubleClickedRow` to emit double clicked row event to
table.
2025-01-03 18:10:07 +08:00
Jason Lee
3601cb399b
table: Use deferred to render scrollbar to avoid some element overflow it. ( #513 )
2024-12-24 11:40:50 +08:00
Jason Lee
d051ac6a8c
table: Update last empty column to 20px width. ( #511 )
2024-12-23 19:36:58 +08:00
Jason Lee
11dbdb125a
chore: Removed ScrollableAxis use Axis instead. ( #509 )
2024-12-23 15:30:36 +08:00
Jason Lee
4f7ca4bb9a
virtual_list: Add VirtualList ( #495 )
...
Vistual List for render a large number of differently sized
rows/columns.
> NOTE: This must ensure each column width or row height.
Unlike the `uniform_list`, the each item can have different size. This
is useful for more complex layout, for example, a table with different
row height.
2024-12-18 16:38:58 +08:00
Jason Lee
28c072d9c6
table: Fix incorrect column offset when have fixed columns. ( #490 )
2024-12-12 17:40:25 +08:00
Jason Lee
8558da4a7b
table: Improve Table to only render visible range columns for performance up to stable on 120 FPS ( #489 )
...
This change to make Table to only render visible range columns.
With the example table story case:
- 32 columns
## Before
- Normally fast scroll: 80~90 FPS
- Drag fast scroll: 60 FPS
## After
- Normally fast scroll: 120 FPS
- Drag fast scroll: 90~100 FPS

2024-12-12 17:09:26 +08:00
ihavecoke
39ec84b989
table: Add a theme color to fixed the drag column in dark mode text style ( #476 )
2024-12-09 20:00:48 +08:00
ihavecoke
bf0e3a22de
table: Emit MoveCol when moved column. ( #473 )
2024-12-09 15:21:37 +08:00
Ylin
ee38970d68
table: Make selected_{row,col} public ( #456 )
2024-12-03 16:21:36 +08:00
Ylin
dd1b767b8a
table: Make set_selected_row, set_selected_col public ( #455 )
...
Co-authored-by: Jason Lee <huacnlee@gmail.com>
2024-12-03 12:00:15 +08:00
Ylin
09455df61c
table: Fix disabled sort field change to default ( #451 )
...
Co-authored-by: linxin <xin.lin@longbridge-inc.com>
2024-12-02 11:28:16 +08:00
Jason Lee
e6012fcc8f
table: Improve table render performance. ( #421 )
...
Before: ~85 - 100FPS
After: ~110 - 115FPS
2024-11-18 14:43:22 +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
Ylin
d4ee273bf5
table: Add render_last_empty_col to table delegate ( #399 )
...
Co-authored-by: linxin <xin.lin@longbridge-inc.com>
2024-11-07 17:53:21 +08:00
Floyd Wang
852c38f42c
table: Remove the unnecessary left margin from the icon
2024-11-05 11:08:21 +08:00
Floyd Wang
1c5d63edb1
table: Remove unnecessary actions that stop bubbling to ensure focused ( #392 )
2024-11-04 17:22:01 +08:00
Jason Lee
fe6566ce2f
table: Export scroll handles. ( #371 )
2024-10-30 14:25:38 +08:00
Floyd Wang
db041fea88
table: Add default option to perform_sort ( #379 )
2024-10-24 18:15:12 +08:00
Jason Lee
274b9edc32
table: Fix selected row top, bottom border detail.
2024-10-18 14:13:15 +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
julien-leclercq
536bb60900
table: Add cx argument to TableDelegate methods. ( #360 )
...
As discussed in #359 adds a `AppContext` argument to the
`table::TableDelegate::rows_count` method
---------
Co-authored-by: Julien Leclercq <julien-leclercq@users.noreply.github.com>
Co-authored-by: Jason Lee <huacnlee@gmail.com>
2024-10-18 10:03:32 +08:00
Floyd Wang
9b8240c6bc
table: Improve render_tr to bind the context_menu ( #347 )
...
<img width="559" alt="image"
src="https://github.com/user-attachments/assets/2aecfa35-5ee1-45cb-a3f3-2409bd09efd7 ">
2024-10-15 21:35:17 +08:00