🚧 Trabajando en las acciones

This commit is contained in:
Manuel Cillero 2024-12-05 08:24:26 +01:00
parent 8e0a1d5994
commit 8aef379973
7 changed files with 32 additions and 32 deletions

View file

@ -1,8 +1,8 @@
mod is_renderable; mod is_renderable;
pub use is_renderable::*; pub use is_renderable::*;
mod before_prepare_component; mod before_render_component;
pub use before_prepare_component::*; pub use before_render_component::*;
mod after_prepare_component; mod after_render_component;
pub use after_prepare_component::*; pub use after_render_component::*;

View file

@ -2,14 +2,14 @@ use crate::prelude::*;
use crate::base::action::FnActionWithComponent; use crate::base::action::FnActionWithComponent;
pub struct AfterPrepare<C: ComponentTrait> { pub struct AfterRender<C: ComponentTrait> {
f: FnActionWithComponent<C>, f: FnActionWithComponent<C>,
referer_type_id: Option<TypeId>, referer_type_id: Option<TypeId>,
referer_id: OptionId, referer_id: OptionId,
weight: Weight, weight: Weight,
} }
impl<C: ComponentTrait> ActionTrait for AfterPrepare<C> { impl<C: ComponentTrait> ActionTrait for AfterRender<C> {
fn referer_type_id(&self) -> Option<TypeId> { fn referer_type_id(&self) -> Option<TypeId> {
self.referer_type_id self.referer_type_id
} }
@ -23,9 +23,9 @@ impl<C: ComponentTrait> ActionTrait for AfterPrepare<C> {
} }
} }
impl<C: ComponentTrait> AfterPrepare<C> { impl<C: ComponentTrait> AfterRender<C> {
pub fn new(f: FnActionWithComponent<C>) -> Self { pub fn new(f: FnActionWithComponent<C>) -> Self {
AfterPrepare { AfterRender {
f, f,
referer_type_id: Some(TypeId::of::<C>()), referer_type_id: Some(TypeId::of::<C>()),
referer_id: OptionId::default(), referer_id: OptionId::default(),

View file

@ -2,14 +2,14 @@ use crate::prelude::*;
use crate::base::action::FnActionWithComponent; use crate::base::action::FnActionWithComponent;
pub struct BeforePrepare<C: ComponentTrait> { pub struct BeforeRender<C: ComponentTrait> {
f: FnActionWithComponent<C>, f: FnActionWithComponent<C>,
referer_type_id: Option<TypeId>, referer_type_id: Option<TypeId>,
referer_id: OptionId, referer_id: OptionId,
weight: Weight, weight: Weight,
} }
impl<C: ComponentTrait> ActionTrait for BeforePrepare<C> { impl<C: ComponentTrait> ActionTrait for BeforeRender<C> {
fn referer_type_id(&self) -> Option<TypeId> { fn referer_type_id(&self) -> Option<TypeId> {
self.referer_type_id self.referer_type_id
} }
@ -23,9 +23,9 @@ impl<C: ComponentTrait> ActionTrait for BeforePrepare<C> {
} }
} }
impl<C: ComponentTrait> BeforePrepare<C> { impl<C: ComponentTrait> BeforeRender<C> {
pub fn new(f: FnActionWithComponent<C>) -> Self { pub fn new(f: FnActionWithComponent<C>) -> Self {
BeforePrepare { BeforeRender {
f, f,
referer_type_id: Some(TypeId::of::<C>()), referer_type_id: Some(TypeId::of::<C>()),
referer_id: OptionId::default(), referer_id: OptionId::default(),

View file

@ -1,8 +1,8 @@
mod before_prepare_component; mod before_render_component;
pub use before_prepare_component::*; pub use before_render_component::*;
mod after_prepare_component; mod after_render_component;
pub use after_prepare_component::*; pub use after_render_component::*;
mod render_component; mod render_component;
pub use render_component::*; pub use render_component::*;

View file

@ -2,13 +2,13 @@ use crate::prelude::*;
use crate::base::action::FnActionWithComponent; use crate::base::action::FnActionWithComponent;
pub struct AfterPrepare<C: ComponentTrait> { pub struct AfterRender<C: ComponentTrait> {
f: FnActionWithComponent<C>, f: FnActionWithComponent<C>,
layout_type_id: Option<TypeId>, layout_type_id: Option<TypeId>,
referer_type_id: Option<TypeId>, referer_type_id: Option<TypeId>,
} }
impl<C: ComponentTrait> ActionTrait for AfterPrepare<C> { impl<C: ComponentTrait> ActionTrait for AfterRender<C> {
fn layout_type_id(&self) -> Option<TypeId> { fn layout_type_id(&self) -> Option<TypeId> {
self.layout_type_id self.layout_type_id
} }
@ -18,9 +18,9 @@ impl<C: ComponentTrait> ActionTrait for AfterPrepare<C> {
} }
} }
impl<C: ComponentTrait> AfterPrepare<C> { impl<C: ComponentTrait> AfterRender<C> {
pub fn new(layout: LayoutRef, f: FnActionWithComponent<C>) -> Self { pub fn new(layout: LayoutRef, f: FnActionWithComponent<C>) -> Self {
AfterPrepare { AfterRender {
f, f,
layout_type_id: Some(layout.type_id()), layout_type_id: Some(layout.type_id()),
referer_type_id: Some(TypeId::of::<C>()), referer_type_id: Some(TypeId::of::<C>()),

View file

@ -2,13 +2,13 @@ use crate::prelude::*;
use crate::base::action::FnActionWithComponent; use crate::base::action::FnActionWithComponent;
pub struct BeforePrepare<C: ComponentTrait> { pub struct BeforeRender<C: ComponentTrait> {
f: FnActionWithComponent<C>, f: FnActionWithComponent<C>,
layout_type_id: Option<TypeId>, layout_type_id: Option<TypeId>,
referer_type_id: Option<TypeId>, referer_type_id: Option<TypeId>,
} }
impl<C: ComponentTrait> ActionTrait for BeforePrepare<C> { impl<C: ComponentTrait> ActionTrait for BeforeRender<C> {
fn layout_type_id(&self) -> Option<TypeId> { fn layout_type_id(&self) -> Option<TypeId> {
self.layout_type_id self.layout_type_id
} }
@ -18,9 +18,9 @@ impl<C: ComponentTrait> ActionTrait for BeforePrepare<C> {
} }
} }
impl<C: ComponentTrait> BeforePrepare<C> { impl<C: ComponentTrait> BeforeRender<C> {
pub fn new(layout: LayoutRef, f: FnActionWithComponent<C>) -> Self { pub fn new(layout: LayoutRef, f: FnActionWithComponent<C>) -> Self {
BeforePrepare { BeforeRender {
f, f,
layout_type_id: Some(layout.type_id()), layout_type_id: Some(layout.type_id()),
referer_type_id: Some(TypeId::of::<C>()), referer_type_id: Some(TypeId::of::<C>()),

View file

@ -40,11 +40,11 @@ impl<C: ComponentTrait> ComponentBase for C {
// Comprueba el componente antes de prepararlo. // Comprueba el componente antes de prepararlo.
self.setup_before_prepare(cx); self.setup_before_prepare(cx);
// Acciones del diseño antes de preparar el componente. // Acciones del diseño antes de renderizar el componente.
action::layout::BeforePrepare::dispatch(self, cx); action::layout::BeforeRender::dispatch(self, cx);
// Acciones de los módulos antes de preparar el componente. // Acciones de los paquetes antes de renderizar el componente.
action::component::BeforePrepare::dispatch(self, cx); action::component::BeforeRender::dispatch(self, cx);
// Renderiza el componente. // Renderiza el componente.
let markup = match action::layout::RenderComponent::dispatch(self, cx) { let markup = match action::layout::RenderComponent::dispatch(self, cx) {
@ -52,11 +52,11 @@ impl<C: ComponentTrait> ComponentBase for C {
None => self.prepare_component(cx).render(), None => self.prepare_component(cx).render(),
}; };
// Acciones del diseño después de preparar el componente. // Acciones del diseño después de renderizar el componente.
action::layout::AfterPrepare::dispatch(self, cx); action::layout::AfterRender::dispatch(self, cx);
// Acciones de los módulos después de preparar el componente. // Acciones de los paquetes después de renderizar el componente.
action::component::AfterPrepare::dispatch(self, cx); action::component::AfterRender::dispatch(self, cx);
markup markup
} else { } else {