pub struct ColumnBadges { /* private fields */ }Expand description
The list columns that show their value as a coloured badge, by column key, as Filament’s
TextColumn::make($key)->badge()->color(fn (string $state) => ...). A column that is not
listed shows its value as plain text.
A badge can also show inside another column’s cell, after its text, instead of in a column
of its own (badge_inside), such as a post’s status beside its
title; and only on some tabs of the list (badge_on_tabs). The
panel decides both when it renders the page, so the page needs no script for them.
Implementations§
Source§impl ColumnBadges
impl ColumnBadges
Sourcepub fn badge(self, column: impl Into<String>) -> Self
pub fn badge(self, column: impl Into<String>) -> Self
Shows the column column as a badge in the primary colour, as Filament’s ->badge()
with no color().
Sourcepub fn badge_color(
self,
column: impl Into<String>,
color: impl Fn(&str) -> BadgeColor + Send + Sync + 'static,
) -> Self
pub fn badge_color( self, column: impl Into<String>, color: impl Fn(&str) -> BadgeColor + Send + Sync + 'static, ) -> Self
Shows the column column as a badge whose colour color picks from the cell’s state,
as Filament’s ->badge()->color(fn (string $state): string => match ($state) { ... }).
The state is the stored value as text, such as "draft", before a select’s or a
lookup’s label replaces it for display.
Sourcepub fn badge_inside(
self,
column: impl Into<String>,
target: impl Into<String>,
) -> Self
pub fn badge_inside( self, column: impl Into<String>, target: impl Into<String>, ) -> Self
Shows the badge of the column column inside the cell of the column target, after
its text, and not as a column of its own: the list has no column for column, even
when the resource lists it. column need not be a list column: its value is read from
the row. It is a badge in the primary colour unless badge_color
gives it a colour.
Sourcepub fn badge_on_tabs<S: Into<String>>(
self,
column: impl Into<String>,
tabs: impl IntoIterator<Item = S>,
) -> Self
pub fn badge_on_tabs<S: Into<String>>( self, column: impl Into<String>, tabs: impl IntoIterator<Item = S>, ) -> Self
Shows the badge of the column column only on the list’s tabs tabs, by key, as a
Filament column’s visible() that reads the active tab. On another tab, or on a list
with no tab active, the badge is not rendered: a badge column is left out of the table,
heading and all, and a badge inside another cell is left out of the cell.
Sourcepub fn color(&self, column: &str, state: &str) -> Option<BadgeColor>
pub fn color(&self, column: &str, state: &str) -> Option<BadgeColor>
The colour of the badge of the column column for state, or None when the column
is not a badge.
Sourcepub fn inside_of(&self, column: &str) -> Option<&str>
pub fn inside_of(&self, column: &str) -> Option<&str>
The column whose cell shows the badge of column, if it shows inside another cell.
Trait Implementations§
Source§impl Clone for ColumnBadges
impl Clone for ColumnBadges
Source§impl Debug for ColumnBadges
impl Debug for ColumnBadges
Auto Trait Implementations§
impl !RefUnwindSafe for ColumnBadges
impl !UnwindSafe for ColumnBadges
impl Forget for ColumnBadges
impl Freeze for ColumnBadges
impl Move for ColumnBadges
impl Send for ColumnBadges
impl Sync for ColumnBadges
impl Unpin for ColumnBadges
impl UnsafeUnpin for ColumnBadges
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more