pub struct ColorColumn<M, T> { /* private fields */ }Expand description
A column of a String field holding a CSS color, rendered as a swatch beside the value.
tablo_core::ColorColumn::new(tablo_core::lens!(Team.color));A hex color (#3b82f6) or a color function (rgb(…), hsl(…), oklch(…), …) shows its
swatch; any other value shows as text alone, since it reaches a style attribute.
Implementations§
Source§impl<M, T> ColorColumn<M, T>where
M: Model,
impl<M, T> ColorColumn<M, T>where
M: Model,
Sourcepub fn new(lens: Lens<M, T>) -> Self
pub fn new(lens: Lens<M, T>) -> Self
Bind the column to the String or Option<String> field lens reads.
Sourcepub fn label(self, label: impl Into<Text>) -> Self
pub fn label(self, label: impl Into<Text>) -> Self
Replace the label the field’s name gives it.
Sourcepub fn width(self, width: ColumnWidth) -> Self
pub fn width(self, width: ColumnWidth) -> Self
Declare this column’s width.
Sourcepub fn toggleable(self) -> Self
pub fn toggleable(self) -> Self
Let each reader hide this column from their list; it starts shown.
Let each reader show this column in their list; it starts hidden.
Trait Implementations§
Source§impl<M, T> Clone for ColorColumn<M, T>
impl<M, T> Clone for ColorColumn<M, T>
Source§impl<M, T> Column<M> for ColorColumn<M, T>
impl<M, T> Column<M> for ColorColumn<M, T>
Source§fn column_width(&self) -> ColumnWidth
fn column_width(&self) -> ColumnWidth
The width the column claims.
Source§fn toggle(&self) -> ColumnToggle
fn toggle(&self) -> ColumnToggle
Whether each reader may hide or show the column in their list, and how it starts. A
detail page shows every column.
Source§fn is_searchable(&self) -> bool
fn is_searchable(&self) -> bool
Whether the column joins the table’s search.
Source§fn search_expr(&self, _term: &str) -> Option<Expr<bool>>
fn search_expr(&self, _term: &str) -> Option<Expr<bool>>
The predicate a search for
term adds.Source§fn is_sortable(&self) -> bool
fn is_sortable(&self) -> bool
Whether the header links to a sort on this column.
Source§impl<M, T> Debug for ColorColumn<M, T>
impl<M, T> Debug for ColorColumn<M, T>
impl<M, T> IntoColumns<M> for ColorColumn<M, T>where
Self: Column<M> + 'static,
Source§impl<M, T> IntoDetail<M> for ColorColumn<M, T>where
Self: Column<M> + 'static,
impl<M, T> IntoDetail<M> for ColorColumn<M, T>where
Self: Column<M> + 'static,
fn into_detail(self) -> Detail<M>
Auto Trait Implementations§
impl<M, T> Freeze for ColorColumn<M, T>
impl<M, T> RefUnwindSafe for ColorColumn<M, T>where
Lens<M, T>: RefUnwindSafe,
impl<M, T> Send for ColorColumn<M, T>
impl<M, T> Sync for ColorColumn<M, T>
impl<M, T> Unpin for ColorColumn<M, T>
impl<M, T> UnsafeUnpin for ColorColumn<M, T>where
Lens<M, T>: UnsafeUnpin,
impl<M, T> UnwindSafe for ColorColumn<M, T>where
Lens<M, T>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more