patternfly_yew/components/table/
render.rs

1use crate::prelude::{Cell, CellContext, MenuChildVariant, Span};
2
3/// Render table entries
4pub trait TableEntryRenderer<C>
5where
6    C: Clone + Eq + 'static,
7{
8    /// Render the cell for the requested column.
9    fn render_cell(&self, context: CellContext<'_, C>) -> Cell;
10
11    /// Control if the details section spans the full width.
12    fn is_full_width_details(&self) -> Option<bool> {
13        None
14    }
15
16    /// Render the details section.
17    ///
18    /// Used in combination with [`super::TableMode::Expandable`] or [`super::TableMode::CompactExpandable`].
19    ///
20    /// Defaults to not having details.
21    fn render_details(&self) -> Vec<Span> {
22        vec![]
23    }
24
25    /// Render the details section for a specific column.
26    ///
27    /// Used in combination with [`super::TableMode::Expandable`] or [`super::TableMode::CompactExpandable`] when one
28    /// or more headers is marked `expandable=true`.
29    ///
30    /// Defaults to not having details.
31    fn render_column_details(&self, #[allow(unused)] column: &C) -> Vec<Span> {
32        vec![]
33    }
34
35    /// Render the row actions.
36    ///
37    /// Defaults to no actions.
38    fn actions(&self) -> Vec<MenuChildVariant> {
39        vec![]
40    }
41}