Make the Data panel show type-driven widgets for attributes (#4062)

This commit is contained in:
Keavon Chambers
2026-04-28 03:52:04 -07:00
committed by GitHub
parent afc2c9178e
commit 881784ba66
4 changed files with 253 additions and 86 deletions

View File

@@ -447,6 +447,11 @@ impl AttributeColumns {
})
}
/// Returns a type-erased reference to the cell value at the given index in the column for the given key.
fn get_any_cell(&self, key: &str, index: usize) -> Option<&dyn std::any::Any> {
self.columns.iter().find_map(|(k, column)| if k == key { column.get_any(index) } else { None })
}
/// Returns an iterator over the keys of all stored attribute columns, in insertion order.
fn keys(&self) -> impl Iterator<Item = &str> {
self.columns.iter().map(|(key, _)| key.as_str())
@@ -664,6 +669,11 @@ impl<T> Table<T> {
self.attributes.display_cell_value(key, index, overrides)
}
/// Returns a type-erased reference to the attribute value at the given row index and key, or `None` if absent.
pub fn attribute_any(&self, key: &str, index: usize) -> Option<&dyn std::any::Any> {
self.attributes.get_any_cell(key, index)
}
// =====================
// Split borrow helpers
// =====================