Revamp desktop usability and multiline fields
This commit is contained in:
1 parent
40b15a9713
commit
aeb18b488f
12 files changed
+1283
-545
No files matched your search
@@ -41,6 +41,14 @@ impl NavigationNode {
|
||||
children: node.children().iter().map(Self::from_storage).collect(),
|
||||
}
|
||||
}
|
||||
|
||||
fn entry_count(&self) -> usize {
|
||||
if self.id.is_directory() {
|
||||
self.children.iter().map(Self::entry_count).sum()
|
||||
} else {
|
||||
1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
@@ -51,6 +59,7 @@ pub struct NavigationRow {
|
||||
pub depth: usize,
|
||||
pub expanded: bool,
|
||||
pub has_children: bool,
|
||||
pub entry_count: usize,
|
||||
parent: Option<TreeNodeId>,
|
||||
}
|
||||
|
||||
@@ -263,6 +272,7 @@ fn flatten(
|
||||
depth,
|
||||
expanded: is_expanded,
|
||||
has_children: !node.children.is_empty(),
|
||||
entry_count: node.entry_count(),
|
||||
parent: parent.cloned(),
|
||||
});
|
||||
if node.id.is_directory() && is_expanded {
|
||||
@@ -387,7 +397,10 @@ mod tests {
|
||||
Some(Path::new("personal"))
|
||||
);
|
||||
assert_eq!(tree.navigate(NavigationKey::Expand), NavigationIntent::None);
|
||||
assert_eq!(tree.rows().len(), 4);
|
||||
let rows = tree.rows();
|
||||
assert_eq!(rows.len(), 4);
|
||||
assert_eq!(rows[0].entry_count, 2);
|
||||
assert_eq!(rows[1].entry_count, 1);
|
||||
assert_eq!(tree.navigate(NavigationKey::Expand), NavigationIntent::None);
|
||||
assert_eq!(
|
||||
tree.navigate(NavigationKey::Activate),
|
||||
|
||||
Reference in new issue
Block a user