gpui_kit/data/mod.rs
1//! Large-data surfaces: a virtualized list, two tables, and a tree.
2//!
3//! [`Table`] lays out every row it is given as [`Table::rows`], because the
4//! caller built those elements already; handed a count and a closure through
5//! [`Table::rows_from`], it lays out only the ones its viewport holds.
6//! [`DataGrid`] takes a render closure and lays out only the rows its viewport
7//! holds, which is what buys it column resizing and reordering, a pinned
8//! group, selection over an incompletely loaded set, opened rows, and cell
9//! editing. `docs/components.md` has the guidance on which to reach for.
10//!
11//! None of these owns the data. Rows, order, expansion, and selection are all
12//! caller-owned; each surface reports what was operated and renders exactly
13//! what the caller says is true, so a host that refuses a change keeps showing
14//! the state that still holds.
15//!
16//! The rule that separates these from the rest of the library: **only rendered
17//! rows publish semantics.** A virtualized surface holds a viewport, not a
18//! data set, so a test can assert only what is on screen. The container node
19//! carries the total in `value`, which is how a snapshot stays honest about
20//! the difference between a thousand items and the twelve that are drawn. A
21//! [`Tree`] counts the rows it disclosed, so a node under a shut branch, a
22//! disclosed node that scrolled past the edge, and a node that is not in the
23//! data at all remain three different things.
24//!
25//! Virtualization needs a bounded viewport. Every surface here takes a
26//! `visible_rows` bound, and without one it sizes itself to its content and
27//! lays every row out — which is the right answer for a settings summary and
28//! the wrong one for a hundred thousand log lines.
29
30pub mod diagnostics_list;
31pub mod grid;
32pub mod list;
33pub mod table;
34pub mod tree;
35pub mod tree_grid;
36pub mod viewport;
37
38pub use diagnostics_list::{
39 Diagnostic, DiagnosticAction, DiagnosticFilter, DiagnosticLocation, DiagnosticSeverity,
40 DiagnosticsList,
41};
42pub use grid::{
43 BulkBar, DataGrid, EditIntent, EditOutcome, EditingCell, Expanded, GridColumn, GridLines,
44 GridRow, SelectionChange, SelectionMode,
45};
46pub use list::{List, ListItem};
47pub use table::{Align, Cell, Column, ColumnWidth, Row, SortDirection, Table};
48pub use tree::{Tree, TreeNode};
49pub use tree_grid::{TreeGrid, TreeGridRow};
50pub use viewport::{reveal_row, scroll_to_row};