Skip to main content

euv_ui/component/virtual_list/view/
struct.rs

1use crate::*;
2
3/// Configuration for a virtual list instance.
4///
5/// Defines the total item count, item height, overscan buffer size,
6/// and a unique container id for a virtual list. This struct allows
7/// multiple virtual list instances with different configurations
8/// on the same page.
9#[derive(Clone, CustomDebug, Data, New)]
10pub struct EuvVirtualListConfig {
11    /// The unique identifier for this virtual list container.
12    /// Used to reference the scroll container element.
13    pub id: String,
14    /// The total number of items in the list.
15    #[get(type(copy))]
16    pub total_count: usize,
17    /// The fixed height of each item in pixels.
18    #[get(type(copy))]
19    pub item_height: i32,
20    /// The number of extra items to render above and below the visible viewport.
21    #[get(type(copy))]
22    pub overscan_count: usize,
23}
24
25/// Props for the `euv_virtual_list` component.
26///
27/// Encapsulates the configuration, item renderer callback, and optional
28/// event callbacks for the virtual list.
29#[derive(Clone, CustomDebug, Data, New)]
30pub struct EuvVirtualListProps {
31    pub config: EuvVirtualListConfig,
32    #[debug(skip)]
33    pub item_renderer: VirtualListItemRenderer,
34    #[debug(skip)]
35    pub on_scroll: Option<VirtualListScrollHandler>,
36    #[debug(skip)]
37    pub on_visible_range_change: Option<VirtualListRangeHandler>,
38}