🚧 Normaliza el uso de los bundles de componentes

This commit is contained in:
Manuel Cillero 2023-06-11 18:58:49 +02:00
parent b2a7c71c1f
commit 7a6cb4dbfa
9 changed files with 26 additions and 42 deletions

View file

@ -158,14 +158,12 @@ impl Container {
self
}
#[fn_builder]
pub fn alter_component(&mut self, component: impl ComponentTrait) -> &mut Self {
self.components.add(component);
pub fn with_component(mut self, component: impl ComponentTrait) -> Self {
self.components.alter_bundle(BundleOp::Add, component);
self
}
#[fn_builder]
pub fn alter_bundle(&mut self, op: BundleOp, component: impl ComponentTrait) -> &mut Self {
pub fn alter_components(&mut self, op: BundleOp, component: impl ComponentTrait) -> &mut Self {
self.components.alter_bundle(op, component);
self
}

View file

@ -124,14 +124,12 @@ impl Form {
self
}
#[fn_builder]
pub fn alter_element(&mut self, element: impl ComponentTrait) -> &mut Self {
self.elements.add(element);
pub fn with_element(mut self, element: impl ComponentTrait) -> Self {
self.elements.alter_bundle(BundleOp::Add, element);
self
}
#[fn_builder]
pub fn alter_bundle(&mut self, op: BundleOp, element: impl ComponentTrait) -> &mut Self {
pub fn alter_elements(&mut self, op: BundleOp, element: impl ComponentTrait) -> &mut Self {
self.elements.alter_bundle(op, element);
self
}

View file

@ -139,14 +139,12 @@ impl Column {
self
}
#[fn_builder]
pub fn alter_component(&mut self, component: impl ComponentTrait) -> &mut Self {
self.components.add(component);
pub fn with_component(mut self, component: impl ComponentTrait) -> Self {
self.components.alter_bundle(BundleOp::Add, component);
self
}
#[fn_builder]
pub fn alter_bundle(&mut self, op: BundleOp, component: impl ComponentTrait) -> &mut Self {
pub fn alter_components(&mut self, op: BundleOp, component: impl ComponentTrait) -> &mut Self {
self.components.alter_bundle(op, component);
self
}

View file

@ -86,14 +86,12 @@ impl Row {
self
}
#[fn_builder]
pub fn alter_column(&mut self, column: grid::Column) -> &mut Self {
self.columns.add(column);
pub fn with_column(mut self, column: grid::Column) -> Self {
self.columns.alter_bundle(BundleOp::Add, column);
self
}
#[fn_builder]
pub fn alter_bundle(&mut self, op: BundleOp, column: grid::Column) -> &mut Self {
pub fn alter_columns(&mut self, op: BundleOp, column: grid::Column) -> &mut Self {
self.columns.alter_bundle(op, column);
self
}

View file

@ -97,14 +97,12 @@ impl Paragraph {
self
}
#[fn_builder]
pub fn alter_component(&mut self, component: impl ComponentTrait) -> &mut Self {
self.components.add(component);
pub fn with_component(mut self, component: impl ComponentTrait) -> Self {
self.components.alter_bundle(BundleOp::Add, component);
self
}
#[fn_builder]
pub fn alter_bundle(&mut self, op: BundleOp, component: impl ComponentTrait) -> &mut Self {
pub fn alter_components(&mut self, op: BundleOp, component: impl ComponentTrait) -> &mut Self {
self.components.alter_bundle(op, component);
self
}