👽️ Aplica cambios de API asociados a componentes
This commit is contained in:
parent
9993b5975b
commit
297d1fc338
14 changed files with 63 additions and 63 deletions
|
|
@ -44,35 +44,35 @@ impl ComponentTrait for MegaMenuItem {
|
||||||
(self.renderable.check)(rcx)
|
(self.renderable.check)(rcx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, rcx: &mut RenderContext) -> Markup {
|
fn prepare_component(&self, rcx: &mut RenderContext) -> PrepareMarkup {
|
||||||
match self.item_type() {
|
match self.item_type() {
|
||||||
MegaMenuItemType::Void => html! {},
|
MegaMenuItemType::Void => PrepareMarkup::None,
|
||||||
|
|
||||||
MegaMenuItemType::Label(label) => html! {
|
MegaMenuItemType::Label(label) => PrepareMarkup::With(html! {
|
||||||
li class="label" { a href="#" { (label.prepare(rcx)) } }
|
li class="label" { a href="#" { (label.prepare(rcx)) } }
|
||||||
},
|
}),
|
||||||
MegaMenuItemType::Link(label, path) => html! {
|
MegaMenuItemType::Link(label, path) => PrepareMarkup::With(html! {
|
||||||
li class="link" { a href=(path) { (label.prepare(rcx)) } }
|
li class="link" { a href=(path) { (label.prepare(rcx)) } }
|
||||||
},
|
}),
|
||||||
MegaMenuItemType::LinkBlank(label, path) => html! {
|
MegaMenuItemType::LinkBlank(label, path) => PrepareMarkup::With(html! {
|
||||||
li class="link_blank" {
|
li class="link_blank" {
|
||||||
a href=(path) target="_blank" { (label.prepare(rcx)) }
|
a href=(path) target="_blank" { (label.prepare(rcx)) }
|
||||||
}
|
}
|
||||||
},
|
}),
|
||||||
MegaMenuItemType::Html(content) => html! {
|
MegaMenuItemType::Html(content) => PrepareMarkup::With(html! {
|
||||||
li class="html" { (content.prepare(rcx)) }
|
li class="html" { (content.prepare(rcx)) }
|
||||||
},
|
}),
|
||||||
MegaMenuItemType::Submenu(label, menu) => html! {
|
MegaMenuItemType::Submenu(label, menu) => PrepareMarkup::With(html! {
|
||||||
li class="submenu" {
|
li class="submenu" {
|
||||||
a href="#" { (label.prepare(rcx)) }
|
a href="#" { (label.prepare(rcx)) }
|
||||||
ul {
|
ul {
|
||||||
(menu.items().prepare(rcx))
|
(menu.items().prepare(rcx))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}),
|
||||||
MegaMenuItemType::Separator => html! {
|
MegaMenuItemType::Separator => PrepareMarkup::With(html! {
|
||||||
li class="separator" { }
|
li class="separator" { }
|
||||||
},
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -191,7 +191,7 @@ impl ComponentTrait for MegaMenu {
|
||||||
run_actions_before_prepare_component(self, rcx);
|
run_actions_before_prepare_component(self, rcx);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, rcx: &mut RenderContext) -> Markup {
|
fn prepare_component(&self, rcx: &mut RenderContext) -> PrepareMarkup {
|
||||||
rcx.alter(ContextOp::AddStyleSheet(
|
rcx.alter(ContextOp::AddStyleSheet(
|
||||||
StyleSheet::located("/megamenu/css/menu.css").with_version("1.1.1"),
|
StyleSheet::located("/megamenu/css/menu.css").with_version("1.1.1"),
|
||||||
))
|
))
|
||||||
|
|
@ -205,7 +205,7 @@ impl ComponentTrait for MegaMenu {
|
||||||
|
|
||||||
let id = rcx.required_id::<MegaMenu>(self.id());
|
let id = rcx.required_id::<MegaMenu>(self.id());
|
||||||
|
|
||||||
html! {
|
PrepareMarkup::With(html! {
|
||||||
ul id=(id) class=[self.classes().get()] {
|
ul id=(id) class=[self.classes().get()] {
|
||||||
(self.items().prepare(rcx))
|
(self.items().prepare(rcx))
|
||||||
}
|
}
|
||||||
|
|
@ -215,7 +215,7 @@ impl ComponentTrait for MegaMenu {
|
||||||
"showTimeout: 80,"
|
"showTimeout: 80,"
|
||||||
"});});"
|
"});});"
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_ref_any(&self) -> &dyn AnyComponent {
|
fn as_ref_any(&self) -> &dyn AnyComponent {
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ impl ComponentTrait for Anchor {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
fn prepare_component(&self, rcx: &mut RenderContext) -> Markup {
|
fn prepare_component(&self, rcx: &mut RenderContext) -> PrepareMarkup {
|
||||||
let target = match &self.target() {
|
let target = match &self.target() {
|
||||||
AnchorTarget::Blank => Some("_blank"),
|
AnchorTarget::Blank => Some("_blank"),
|
||||||
AnchorTarget::Parent => Some("_parent"),
|
AnchorTarget::Parent => Some("_parent"),
|
||||||
|
|
@ -71,7 +71,7 @@ impl ComponentTrait for Anchor {
|
||||||
AnchorTarget::Context(name) => Some(name.as_str()),
|
AnchorTarget::Context(name) => Some(name.as_str()),
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
html! {
|
PrepareMarkup::With(html! {
|
||||||
a
|
a
|
||||||
id=[self.id()]
|
id=[self.id()]
|
||||||
class=[self.classes().get()]
|
class=[self.classes().get()]
|
||||||
|
|
@ -82,7 +82,7 @@ impl ComponentTrait for Anchor {
|
||||||
(" ") span { (self.html().prepare(rcx)) } (" ")
|
(" ") span { (self.html().prepare(rcx)) } (" ")
|
||||||
(self.right_icon().prepare(rcx))
|
(self.right_icon().prepare(rcx))
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_ref_any(&self) -> &dyn AnyComponent {
|
fn as_ref_any(&self) -> &dyn AnyComponent {
|
||||||
|
|
|
||||||
|
|
@ -54,41 +54,41 @@ impl ComponentTrait for Container {
|
||||||
run_actions_before_prepare_component(self, rcx);
|
run_actions_before_prepare_component(self, rcx);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, rcx: &mut RenderContext) -> Markup {
|
fn prepare_component(&self, rcx: &mut RenderContext) -> PrepareMarkup {
|
||||||
match self.container_type() {
|
match self.container_type() {
|
||||||
ContainerType::Header => html! {
|
ContainerType::Header => PrepareMarkup::With(html! {
|
||||||
header id=[self.id()] class=[self.classes().get()] {
|
header id=[self.id()] class=[self.classes().get()] {
|
||||||
div class=[self.inner_classes().get()] {
|
div class=[self.inner_classes().get()] {
|
||||||
(self.components().prepare(rcx))
|
(self.components().prepare(rcx))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}),
|
||||||
ContainerType::Footer => html! {
|
ContainerType::Footer => PrepareMarkup::With(html! {
|
||||||
footer id=[self.id()] class=[self.classes().get()] {
|
footer id=[self.id()] class=[self.classes().get()] {
|
||||||
div class=[self.inner_classes().get()] {
|
div class=[self.inner_classes().get()] {
|
||||||
(self.components().prepare(rcx))
|
(self.components().prepare(rcx))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}),
|
||||||
ContainerType::Main => html! {
|
ContainerType::Main => PrepareMarkup::With(html! {
|
||||||
main id=[self.id()] class=[self.classes().get()] {
|
main id=[self.id()] class=[self.classes().get()] {
|
||||||
div class=[self.inner_classes().get()] {
|
div class=[self.inner_classes().get()] {
|
||||||
(self.components().prepare(rcx))
|
(self.components().prepare(rcx))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}),
|
||||||
ContainerType::Section => html! {
|
ContainerType::Section => PrepareMarkup::With(html! {
|
||||||
section id=[self.id()] class=[self.classes().get()] {
|
section id=[self.id()] class=[self.classes().get()] {
|
||||||
div class=[self.inner_classes().get()] {
|
div class=[self.inner_classes().get()] {
|
||||||
(self.components().prepare(rcx))
|
(self.components().prepare(rcx))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}),
|
||||||
_ => html! {
|
_ => PrepareMarkup::With(html! {
|
||||||
div id=[self.id()] class=[self.classes().get()] {
|
div id=[self.id()] class=[self.classes().get()] {
|
||||||
(self.components().prepare(rcx))
|
(self.components().prepare(rcx))
|
||||||
}
|
}
|
||||||
},
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ impl ComponentTrait for Button {
|
||||||
(self.renderable.check)(rcx)
|
(self.renderable.check)(rcx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, rcx: &mut RenderContext) -> Markup {
|
fn prepare_component(&self, rcx: &mut RenderContext) -> PrepareMarkup {
|
||||||
let button_type = match self.button_type() {
|
let button_type = match self.button_type() {
|
||||||
ButtonType::Button => "button",
|
ButtonType::Button => "button",
|
||||||
ButtonType::Submit => "submit",
|
ButtonType::Submit => "submit",
|
||||||
|
|
@ -53,7 +53,7 @@ impl ComponentTrait for Button {
|
||||||
};
|
};
|
||||||
let id = self.name().get().map(|name| concat_string!("edit-", name));
|
let id = self.name().get().map(|name| concat_string!("edit-", name));
|
||||||
let value = self.value().prepare(rcx);
|
let value = self.value().prepare(rcx);
|
||||||
html! {
|
PrepareMarkup::With(html! {
|
||||||
button
|
button
|
||||||
type=(button_type)
|
type=(button_type)
|
||||||
id=[id]
|
id=[id]
|
||||||
|
|
@ -65,7 +65,7 @@ impl ComponentTrait for Button {
|
||||||
{
|
{
|
||||||
(value)
|
(value)
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_ref_any(&self) -> &dyn AnyComponent {
|
fn as_ref_any(&self) -> &dyn AnyComponent {
|
||||||
|
|
|
||||||
|
|
@ -40,9 +40,9 @@ impl ComponentTrait for Date {
|
||||||
(self.renderable.check)(rcx)
|
(self.renderable.check)(rcx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, _: &mut RenderContext) -> Markup {
|
fn prepare_component(&self, _: &mut RenderContext) -> PrepareMarkup {
|
||||||
let id = self.name().get().map(|name| concat_string!("edit-", name));
|
let id = self.name().get().map(|name| concat_string!("edit-", name));
|
||||||
html! {
|
PrepareMarkup::With(html! {
|
||||||
div class=[self.classes().get()] {
|
div class=[self.classes().get()] {
|
||||||
@if let Some(label) = self.label().get() {
|
@if let Some(label) = self.label().get() {
|
||||||
label class="form-label" for=[&id] {
|
label class="form-label" for=[&id] {
|
||||||
|
|
@ -70,7 +70,7 @@ impl ComponentTrait for Date {
|
||||||
div class="form-text" { (help_text) }
|
div class="form-text" { (help_text) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_ref_any(&self) -> &dyn AnyComponent {
|
fn as_ref_any(&self) -> &dyn AnyComponent {
|
||||||
|
|
|
||||||
|
|
@ -52,12 +52,12 @@ impl ComponentTrait for Form {
|
||||||
run_actions_before_prepare_component(self, rcx);
|
run_actions_before_prepare_component(self, rcx);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, rcx: &mut RenderContext) -> Markup {
|
fn prepare_component(&self, rcx: &mut RenderContext) -> PrepareMarkup {
|
||||||
let method = match self.method() {
|
let method = match self.method() {
|
||||||
FormMethod::Post => Some("post".to_owned()),
|
FormMethod::Post => Some("post".to_owned()),
|
||||||
FormMethod::Get => None,
|
FormMethod::Get => None,
|
||||||
};
|
};
|
||||||
html! {
|
PrepareMarkup::With(html! {
|
||||||
form
|
form
|
||||||
id=[self.id()]
|
id=[self.id()]
|
||||||
class=[self.classes().get()]
|
class=[self.classes().get()]
|
||||||
|
|
@ -67,7 +67,7 @@ impl ComponentTrait for Form {
|
||||||
{
|
{
|
||||||
div { (self.elements().prepare(rcx)) }
|
div { (self.elements().prepare(rcx)) }
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_ref_any(&self) -> &dyn AnyComponent {
|
fn as_ref_any(&self) -> &dyn AnyComponent {
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,11 @@ impl ComponentTrait for Hidden {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, _: &mut RenderContext) -> Markup {
|
fn prepare_component(&self, _: &mut RenderContext) -> PrepareMarkup {
|
||||||
let id = self.name().get().map(|name| concat_string!("value-", name));
|
let id = self.name().get().map(|name| concat_string!("value-", name));
|
||||||
html! {
|
PrepareMarkup::With(html! {
|
||||||
input type="hidden" id=[id] name=[self.name().get()] value=[self.value().get()];
|
input type="hidden" id=[id] name=[self.name().get()] value=[self.value().get()];
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_ref_any(&self) -> &dyn AnyComponent {
|
fn as_ref_any(&self) -> &dyn AnyComponent {
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ impl ComponentTrait for Input {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
fn prepare_component(&self, rcx: &mut RenderContext) -> Markup {
|
fn prepare_component(&self, rcx: &mut RenderContext) -> PrepareMarkup {
|
||||||
let type_input = match self.input_type() {
|
let type_input = match self.input_type() {
|
||||||
InputType::Textfield => "text",
|
InputType::Textfield => "text",
|
||||||
InputType::Password => "password",
|
InputType::Password => "password",
|
||||||
|
|
@ -71,7 +71,7 @@ impl ComponentTrait for Input {
|
||||||
InputType::Url => "url",
|
InputType::Url => "url",
|
||||||
};
|
};
|
||||||
let id = self.name().get().map(|name| concat_string!("edit-", name));
|
let id = self.name().get().map(|name| concat_string!("edit-", name));
|
||||||
html! {
|
PrepareMarkup::With(html! {
|
||||||
div class=[self.classes().get()] {
|
div class=[self.classes().get()] {
|
||||||
@if let Some(label) = self.label().prepare_optional(rcx) {
|
@if let Some(label) = self.label().prepare_optional(rcx) {
|
||||||
label class="form-label" for=[&id] {
|
label class="form-label" for=[&id] {
|
||||||
|
|
@ -102,7 +102,7 @@ impl ComponentTrait for Input {
|
||||||
div class="form-text" { (description) }
|
div class="form-text" { (description) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_ref_any(&self) -> &dyn AnyComponent {
|
fn as_ref_any(&self) -> &dyn AnyComponent {
|
||||||
|
|
|
||||||
|
|
@ -73,12 +73,12 @@ impl ComponentTrait for Column {
|
||||||
run_actions_before_prepare_component(self, rcx);
|
run_actions_before_prepare_component(self, rcx);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, rcx: &mut RenderContext) -> Markup {
|
fn prepare_component(&self, rcx: &mut RenderContext) -> PrepareMarkup {
|
||||||
html! {
|
PrepareMarkup::With(html! {
|
||||||
div id=[self.id()] class=[self.classes().get()] {
|
div id=[self.id()] class=[self.classes().get()] {
|
||||||
(self.components().prepare(rcx))
|
(self.components().prepare(rcx))
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_ref_any(&self) -> &dyn AnyComponent {
|
fn as_ref_any(&self) -> &dyn AnyComponent {
|
||||||
|
|
|
||||||
|
|
@ -42,12 +42,12 @@ impl ComponentTrait for Row {
|
||||||
run_actions_before_prepare_component(self, rcx);
|
run_actions_before_prepare_component(self, rcx);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, rcx: &mut RenderContext) -> Markup {
|
fn prepare_component(&self, rcx: &mut RenderContext) -> PrepareMarkup {
|
||||||
html! {
|
PrepareMarkup::With(html! {
|
||||||
div id=[self.id()] class=[self.classes().get()] {
|
div id=[self.id()] class=[self.classes().get()] {
|
||||||
(self.columns().prepare(rcx))
|
(self.columns().prepare(rcx))
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_ref_any(&self) -> &dyn AnyComponent {
|
fn as_ref_any(&self) -> &dyn AnyComponent {
|
||||||
|
|
|
||||||
|
|
@ -61,17 +61,17 @@ impl ComponentTrait for Heading {
|
||||||
(self.renderable.check)(rcx)
|
(self.renderable.check)(rcx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, rcx: &mut RenderContext) -> Markup {
|
fn prepare_component(&self, rcx: &mut RenderContext) -> PrepareMarkup {
|
||||||
let id = self.id();
|
let id = self.id();
|
||||||
let classes = self.classes().get();
|
let classes = self.classes().get();
|
||||||
html! { @match &self.heading_type() {
|
PrepareMarkup::With(html! { @match &self.heading_type() {
|
||||||
HeadingType::H1 => h1 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
HeadingType::H1 => h1 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
||||||
HeadingType::H2 => h2 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
HeadingType::H2 => h2 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
||||||
HeadingType::H3 => h3 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
HeadingType::H3 => h3 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
||||||
HeadingType::H4 => h4 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
HeadingType::H4 => h4 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
||||||
HeadingType::H5 => h5 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
HeadingType::H5 => h5 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
||||||
HeadingType::H6 => h6 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
HeadingType::H6 => h6 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
||||||
}}
|
}})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_ref_any(&self) -> &dyn AnyComponent {
|
fn as_ref_any(&self) -> &dyn AnyComponent {
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@ impl ComponentTrait for Icon {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, _: &mut RenderContext) -> Markup {
|
fn prepare_component(&self, _: &mut RenderContext) -> PrepareMarkup {
|
||||||
html! { i class=[self.classes().get()] {}; }
|
PrepareMarkup::With(html! { i class=[self.classes().get()] {}; })
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_ref_any(&self) -> &dyn AnyComponent {
|
fn as_ref_any(&self) -> &dyn AnyComponent {
|
||||||
|
|
|
||||||
|
|
@ -34,13 +34,13 @@ impl ComponentTrait for Image {
|
||||||
(self.renderable.check)(rcx)
|
(self.renderable.check)(rcx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, _: &mut RenderContext) -> Markup {
|
fn prepare_component(&self, _: &mut RenderContext) -> PrepareMarkup {
|
||||||
html! {
|
PrepareMarkup::With(html! {
|
||||||
img
|
img
|
||||||
src=[self.source().get()]
|
src=[self.source().get()]
|
||||||
id=[self.id()]
|
id=[self.id()]
|
||||||
class=[self.classes().get()];
|
class=[self.classes().get()];
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_ref_any(&self) -> &dyn AnyComponent {
|
fn as_ref_any(&self) -> &dyn AnyComponent {
|
||||||
|
|
|
||||||
|
|
@ -46,15 +46,15 @@ impl ComponentTrait for Paragraph {
|
||||||
(self.renderable.check)(rcx)
|
(self.renderable.check)(rcx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, rcx: &mut RenderContext) -> Markup {
|
fn prepare_component(&self, rcx: &mut RenderContext) -> PrepareMarkup {
|
||||||
html! {
|
PrepareMarkup::With(html! {
|
||||||
p
|
p
|
||||||
id=[self.id()]
|
id=[self.id()]
|
||||||
class=[self.classes().get()]
|
class=[self.classes().get()]
|
||||||
{
|
{
|
||||||
(self.components().prepare(rcx))
|
(self.components().prepare(rcx))
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_ref_any(&self) -> &dyn AnyComponent {
|
fn as_ref_any(&self) -> &dyn AnyComponent {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue