🚧 Revamp ComponentRef to ComponentArc
This commit is contained in:
parent
df0b2eeb71
commit
68b54fbce5
10 changed files with 105 additions and 79 deletions
|
|
@ -12,7 +12,7 @@ pub struct Block {
|
|||
id : IdentifierValue,
|
||||
classes : Classes,
|
||||
title : AttributeValue,
|
||||
content : PackComponents,
|
||||
stuff : PackComponents,
|
||||
template : String,
|
||||
}
|
||||
|
||||
|
|
@ -94,12 +94,17 @@ impl Block {
|
|||
}
|
||||
|
||||
pub fn with_component(mut self, component: impl ComponentTrait) -> Self {
|
||||
self.content.alter(PackOp::Add, ComponentRef::to(component));
|
||||
self.stuff.alter(PackOp::Add, ComponentArc::new(component));
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_component_arc(mut self, arc: ComponentArc) -> Self {
|
||||
self.stuff.alter(PackOp::Add, arc);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn alter_components(&mut self, op: PackOp, component: impl ComponentTrait) -> &mut Self {
|
||||
self.content.alter(op, ComponentRef::to(component));
|
||||
self.stuff.alter(op, ComponentArc::new(component));
|
||||
self
|
||||
}
|
||||
|
||||
|
|
@ -120,7 +125,7 @@ impl Block {
|
|||
}
|
||||
|
||||
pub fn components(&self) -> &PackComponents {
|
||||
&self.content
|
||||
&self.stuff
|
||||
}
|
||||
|
||||
pub fn template(&self) -> &str {
|
||||
|
|
|
|||
|
|
@ -121,12 +121,17 @@ impl Form {
|
|||
}
|
||||
|
||||
pub fn with_element(mut self, element: impl ComponentTrait) -> Self {
|
||||
self.elements.alter(PackOp::Add, ComponentRef::to(element));
|
||||
self.elements.alter(PackOp::Add, ComponentArc::new(element));
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_element_arc(mut self, arc: ComponentArc) -> Self {
|
||||
self.elements.alter(PackOp::Add, arc);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn alter_elements(&mut self, op: PackOp, element: impl ComponentTrait) -> &mut Self {
|
||||
self.elements.alter(op, ComponentRef::to(element));
|
||||
self.elements.alter(op, ComponentArc::new(element));
|
||||
self
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ pub struct Column {
|
|||
id : IdentifierValue,
|
||||
classes : Classes,
|
||||
size : ColumnSize,
|
||||
content : PackComponents,
|
||||
stuff : PackComponents,
|
||||
template : String,
|
||||
}
|
||||
|
||||
|
|
@ -136,12 +136,17 @@ impl Column {
|
|||
}
|
||||
|
||||
pub fn with_component(mut self, component: impl ComponentTrait) -> Self {
|
||||
self.content.alter(PackOp::Add, ComponentRef::to(component));
|
||||
self.stuff.alter(PackOp::Add, ComponentArc::new(component));
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_component_arc(mut self, arc: ComponentArc) -> Self {
|
||||
self.stuff.alter(PackOp::Add, arc);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn alter_components(&mut self, op: PackOp, component: impl ComponentTrait) -> &mut Self {
|
||||
self.content.alter(op, ComponentRef::to(component));
|
||||
self.stuff.alter(op, ComponentArc::new(component));
|
||||
self
|
||||
}
|
||||
|
||||
|
|
@ -162,7 +167,7 @@ impl Column {
|
|||
}
|
||||
|
||||
pub fn components(&self) -> &PackComponents {
|
||||
&self.content
|
||||
&self.stuff
|
||||
}
|
||||
|
||||
pub fn template(&self) -> &str {
|
||||
|
|
|
|||
|
|
@ -83,12 +83,12 @@ impl Row {
|
|||
}
|
||||
|
||||
pub fn with_column(mut self, column: grid::Column) -> Self {
|
||||
self.columns.alter(PackOp::Add, ComponentRef::to(column));
|
||||
self.columns.alter(PackOp::Add, ComponentArc::new(column));
|
||||
self
|
||||
}
|
||||
|
||||
pub fn alter_columns(&mut self, op: PackOp, column: grid::Column) -> &mut Self {
|
||||
self.columns.alter(op, ComponentRef::to(column));
|
||||
self.columns.alter(op, ComponentArc::new(column));
|
||||
self
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ pub struct Paragraph {
|
|||
renderable: Renderable,
|
||||
id : IdentifierValue,
|
||||
classes : Classes,
|
||||
content : PackComponents,
|
||||
stuff : PackComponents,
|
||||
display : ParagraphDisplay,
|
||||
template : String,
|
||||
}
|
||||
|
|
@ -90,12 +90,17 @@ impl Paragraph {
|
|||
}
|
||||
|
||||
pub fn with_component(mut self, component: impl ComponentTrait) -> Self {
|
||||
self.content.alter(PackOp::Add, ComponentRef::to(component));
|
||||
self.stuff.alter(PackOp::Add, ComponentArc::new(component));
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_component_arc(mut self, arc: ComponentArc) -> Self {
|
||||
self.stuff.alter(PackOp::Add, arc);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn alter_components(&mut self, op: PackOp, component: impl ComponentTrait) -> &mut Self {
|
||||
self.content.alter(op, ComponentRef::to(component));
|
||||
self.stuff.alter(op, ComponentArc::new(component));
|
||||
self
|
||||
}
|
||||
|
||||
|
|
@ -130,7 +135,7 @@ impl Paragraph {
|
|||
}
|
||||
|
||||
pub fn components(&self) -> &PackComponents {
|
||||
&self.content
|
||||
&self.stuff
|
||||
}
|
||||
|
||||
pub fn display(&self) -> &ParagraphDisplay {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue