♻️ (form): Añade #[builder_fn] a Item y Group
Uniforma el criterio con el resto de elementos de componente (`Row`/ `Cell`/`Column`/`SortLink` en table, `Crumb` en breadcrumb) generando su `alter_...` equivalente para poder mutarse con `&mut self`.
This commit is contained in:
parent
aa8c4100b0
commit
17a9f0c9e0
3 changed files with 8 additions and 0 deletions
|
|
@ -42,12 +42,14 @@ impl Item {
|
||||||
// **< Item BUILDER >***************************************************************************
|
// **< Item BUILDER >***************************************************************************
|
||||||
|
|
||||||
/// Establece si la casilla debe aparecer marcada por defecto.
|
/// Establece si la casilla debe aparecer marcada por defecto.
|
||||||
|
#[builder_fn]
|
||||||
pub fn with_checked(mut self, checked: bool) -> Self {
|
pub fn with_checked(mut self, checked: bool) -> Self {
|
||||||
self.checked = checked;
|
self.checked = checked;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Establece si la casilla está deshabilitada.
|
/// Establece si la casilla está deshabilitada.
|
||||||
|
#[builder_fn]
|
||||||
pub fn with_disabled(mut self, disabled: bool) -> Self {
|
pub fn with_disabled(mut self, disabled: bool) -> Self {
|
||||||
self.disabled = disabled;
|
self.disabled = disabled;
|
||||||
self
|
self
|
||||||
|
|
|
||||||
|
|
@ -46,12 +46,14 @@ impl Item {
|
||||||
///
|
///
|
||||||
/// Si varias opciones del grupo tienen `checked` activo, sólo la primera se renderizará como
|
/// Si varias opciones del grupo tienen `checked` activo, sólo la primera se renderizará como
|
||||||
/// seleccionada; las demás se ignorarán.
|
/// seleccionada; las demás se ignorarán.
|
||||||
|
#[builder_fn]
|
||||||
pub fn with_checked(mut self, checked: bool) -> Self {
|
pub fn with_checked(mut self, checked: bool) -> Self {
|
||||||
self.checked = checked;
|
self.checked = checked;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Establece si la opción está inicialmente deshabilitada.
|
/// Establece si la opción está inicialmente deshabilitada.
|
||||||
|
#[builder_fn]
|
||||||
pub fn with_disabled(mut self, disabled: bool) -> Self {
|
pub fn with_disabled(mut self, disabled: bool) -> Self {
|
||||||
self.disabled = disabled;
|
self.disabled = disabled;
|
||||||
self
|
self
|
||||||
|
|
|
||||||
|
|
@ -50,12 +50,14 @@ impl Item {
|
||||||
/// En una lista de selección única, el navegador aplica la selección al último elemento marcado
|
/// En una lista de selección única, el navegador aplica la selección al último elemento marcado
|
||||||
/// si hay más de uno; mientras que en una lista múltiple se respetan todos los elementos
|
/// si hay más de uno; mientras que en una lista múltiple se respetan todos los elementos
|
||||||
/// marcados.
|
/// marcados.
|
||||||
|
#[builder_fn]
|
||||||
pub fn with_selected(mut self, selected: bool) -> Self {
|
pub fn with_selected(mut self, selected: bool) -> Self {
|
||||||
self.selected = selected;
|
self.selected = selected;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Establece si el elemento está deshabilitado.
|
/// Establece si el elemento está deshabilitado.
|
||||||
|
#[builder_fn]
|
||||||
pub fn with_disabled(mut self, disabled: bool) -> Self {
|
pub fn with_disabled(mut self, disabled: bool) -> Self {
|
||||||
self.disabled = disabled;
|
self.disabled = disabled;
|
||||||
self
|
self
|
||||||
|
|
@ -100,12 +102,14 @@ impl Group {
|
||||||
// **< Group BUILDER >**************************************************************************
|
// **< Group BUILDER >**************************************************************************
|
||||||
|
|
||||||
/// Añade un elemento al grupo. Los elementos se muestran en el orden en que se añaden.
|
/// Añade un elemento al grupo. Los elementos se muestran en el orden en que se añaden.
|
||||||
|
#[builder_fn]
|
||||||
pub fn with_item(mut self, item: Item) -> Self {
|
pub fn with_item(mut self, item: Item) -> Self {
|
||||||
self.items.push(item);
|
self.items.push(item);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Establece si el grupo de elementos está deshabilitado en bloque.
|
/// Establece si el grupo de elementos está deshabilitado en bloque.
|
||||||
|
#[builder_fn]
|
||||||
pub fn with_disabled(mut self, disabled: bool) -> Self {
|
pub fn with_disabled(mut self, disabled: bool) -> Self {
|
||||||
self.disabled = disabled;
|
self.disabled = disabled;
|
||||||
self
|
self
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue