♻️ Rename types for Mixed and Typed components
This commit is contained in:
parent
57e71a9399
commit
c65ac74a6f
20 changed files with 151 additions and 154 deletions
|
|
@ -2,8 +2,8 @@ use crate::prelude::*;
|
|||
|
||||
use super::Submenu;
|
||||
|
||||
type Content = TypedComponent<Html>;
|
||||
type SubmenuItems = TypedComponent<Submenu>;
|
||||
type Content = OneComponent<Html>;
|
||||
type SubmenuItems = OneComponent<Submenu>;
|
||||
|
||||
#[derive(AutoDefault)]
|
||||
pub enum ElementType {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ pub struct Group {
|
|||
id : OptionId,
|
||||
weight : Weight,
|
||||
renderable: Renderable,
|
||||
elements : VectorComponents<Element>,
|
||||
elements : TypedComponents<Element>,
|
||||
}
|
||||
|
||||
impl ComponentTrait for Group {
|
||||
|
|
@ -60,7 +60,7 @@ impl Group {
|
|||
|
||||
#[rustfmt::skip]
|
||||
pub fn add_element(mut self, element: Element) -> Self {
|
||||
self.elements.alter_value(TypedOp::Add(TypedComponent::with(element)));
|
||||
self.elements.alter_value(TypedOp::Add(OneComponent::with(element)));
|
||||
self
|
||||
}
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ impl Group {
|
|||
|
||||
// Group GETTERS.
|
||||
|
||||
pub fn elements(&self) -> &VectorComponents<Element> {
|
||||
pub fn elements(&self) -> &TypedComponents<Element> {
|
||||
&self.elements
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ use crate::prelude::*;
|
|||
use super::{Megamenu, Submenu};
|
||||
|
||||
type Label = L10n;
|
||||
type Content = TypedComponent<Html>;
|
||||
type SubmenuItems = TypedComponent<Submenu>;
|
||||
type MegamenuGroups = TypedComponent<Megamenu>;
|
||||
type Content = OneComponent<Html>;
|
||||
type SubmenuItems = OneComponent<Submenu>;
|
||||
type MegamenuGroups = OneComponent<Megamenu>;
|
||||
|
||||
#[derive(AutoDefault)]
|
||||
pub enum ItemType {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ pub struct Megamenu {
|
|||
id : OptionId,
|
||||
weight : Weight,
|
||||
renderable: Renderable,
|
||||
groups : VectorComponents<Group>,
|
||||
groups : TypedComponents<Group>,
|
||||
}
|
||||
|
||||
impl ComponentTrait for Megamenu {
|
||||
|
|
@ -60,7 +60,7 @@ impl Megamenu {
|
|||
|
||||
#[rustfmt::skip]
|
||||
pub fn add_group(mut self, group: Group) -> Self {
|
||||
self.groups.alter_value(TypedOp::Add(TypedComponent::with(group)));
|
||||
self.groups.alter_value(TypedOp::Add(OneComponent::with(group)));
|
||||
self
|
||||
}
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ impl Megamenu {
|
|||
|
||||
// Megamenu GETTERS.
|
||||
|
||||
pub fn groups(&self) -> &VectorComponents<Group> {
|
||||
pub fn groups(&self) -> &TypedComponents<Group> {
|
||||
&self.groups
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ pub struct Menu {
|
|||
id : OptionId,
|
||||
weight : Weight,
|
||||
renderable: Renderable,
|
||||
items : VectorComponents<Item>,
|
||||
items : TypedComponents<Item>,
|
||||
}
|
||||
|
||||
impl ComponentTrait for Menu {
|
||||
|
|
@ -88,7 +88,7 @@ impl Menu {
|
|||
|
||||
#[rustfmt::skip]
|
||||
pub fn add_item(mut self, item: Item) -> Self {
|
||||
self.items.alter_value(TypedOp::Add(TypedComponent::with(item)));
|
||||
self.items.alter_value(TypedOp::Add(OneComponent::with(item)));
|
||||
self
|
||||
}
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ impl Menu {
|
|||
|
||||
// Menu GETTERS.
|
||||
|
||||
pub fn items(&self) -> &VectorComponents<Item> {
|
||||
pub fn items(&self) -> &TypedComponents<Item> {
|
||||
&self.items
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ pub struct Submenu {
|
|||
weight : Weight,
|
||||
renderable: Renderable,
|
||||
title : OptionTranslated,
|
||||
items : VectorComponents<Item>,
|
||||
items : TypedComponents<Item>,
|
||||
}
|
||||
|
||||
impl ComponentTrait for Submenu {
|
||||
|
|
@ -72,7 +72,7 @@ impl Submenu {
|
|||
|
||||
#[rustfmt::skip]
|
||||
pub fn add_item(mut self, item: Item) -> Self {
|
||||
self.items.alter_value(TypedOp::Add(TypedComponent::with(item)));
|
||||
self.items.alter_value(TypedOp::Add(OneComponent::with(item)));
|
||||
self
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ impl Submenu {
|
|||
&self.title
|
||||
}
|
||||
|
||||
pub fn items(&self) -> &VectorComponents<Item> {
|
||||
pub fn items(&self) -> &TypedComponents<Item> {
|
||||
&self.items
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue