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>
- Added `disabled` method to OtpInput.
- Added `disabled` method to DatePicker.
- Added `disabled_matcher` method to CalendarState.
## Break Changes
- The `InputState` has been removed `disabled` and `set_disabled`
method, the disabled state should assign from TextInput element.
```diff
- let state = InputState::new("input1").disabled(true)
+ let state = InputState::new("input1");
+ TextInput::new(&state).disabled(true)
```
- Renamed `set_disabled` method to `set_disabled_matcher` from
`CalendarState`.
- Removed `set_disabled` method from `DatePickerState`, use
`disabled_matcher` method in `DatePicker` element.
---------
Co-authored-by: Jason Lee <huacnlee@gmail.com>
The `virtual_list` scroll range issue because recently GPUI changed the
`ScrollHandle` API, now we only get the `max_offset`.
So #1086 have fixed this to implementation a `content_size` method to
calculate `max_offset` and `bounds` of the `ScrollHandle`.
But I found that the `Interactivity` prepaint (This is used in
VirtualList) was not to update the `bounds` of the `ScrollHandle`.
Wait https://github.com/zed-industries/zed/pull/35013 to merge.
| Before | After |
| -- | --- |
| <img width="620" alt="image"
src="https://github.com/user-attachments/assets/6ffb8f30-93b4-42ec-a837-90f80ecb2bf5"
/> | <img width="620" alt="image"
src="https://github.com/user-attachments/assets/21466332-030c-495f-8c84-e3a2c6eeb403"
/> |
- Split `Scrollbale` and `VirtualList` story.
## Break Changes
- The `content_size` argument has been removed from `virtual_list`
callback.
Caused by PR #1078 incorrect changes, and GPUI was changed API
https://github.com/zed-industries/zed/pull/34832
The content size of the scrollable area should be its max scroll offset
plus the container size.
---------
Co-authored-by: Jason Lee <huacnlee@gmail.com>
This change to fix some incorrect style use, that will break in Taffy
0.5.2+
Ref https://github.com/zed-industries/zed/pull/34827
- Add `Tab::empty` to create a Tab without label.
- Fix form layout in Taffy new version.
- Update GPUI for scroll API changes.
## Break Changes
- The `ColFixed` has renamed to `ColumnFixed`.
- The `ColSort` has renamed to `ColumnSort`.
### TableDelegate
- Removed `col_name`, `col_resizable`, `col_selectable`, `col_width`,
`col_sort`, `col_fixed`, `col_paddings`, `col_movable` method, now use
`col` method to return a TableCol for describe of them.
- The `cols_count` method renamed to `columns_count`.
```diff
- fn cols_count(&self, _: &App) -> usize
+ fn columns_count(&self, _: &App) -> usize
```
- The `move_col` has renamed to `move_column`.
- The `visible_cols_changed` has renamed to `visible_columns_changed`.
### TableEvent
```diff
- TableEvent::SelectCol
+ TableEvent::SelectColumn
- TableEvent::MoveCol
+ TableEvent::MoveColumn
- TableEvent::ColWidthsChanged
+ TableEvent::ColumnWidthsChanged
```
- Added a lot of default fallbacks for theme colors based on `base`
colors.
- Added `hue`, `saturation`, `lightness` method to change Hsla color.
- Update stories to use theme colors, not a direct color.
- Improve `Badge`, `Avatar` to use theme colors.
- Added a new theme: `Fahrenheit`.