Añade referencias a todos los métodos

El proyecto compila, pendiente de una solución para los contenedores.
This commit is contained in:
Manuel Cillero 2022-04-04 20:32:37 +02:00
parent 53dd1f24c7
commit 4dd57eab43
12 changed files with 115 additions and 102 deletions

View file

@ -32,7 +32,7 @@ impl ModuleTrait for UserModule {
}
fn form_login() -> ArcComponent {
Form::new()
Form::new()/*
.with_id("user-login")
.add(form::Input::textfield()
.with_name("name")
@ -49,7 +49,7 @@ fn form_login() -> ArcComponent {
.with_help_text(l("password_help").as_str())
.arc()
)
.add(form::Button::submit(l("login").as_str()).arc())
.add(form::Button::submit(l("login").as_str()).arc())*/
.arc()
}
@ -57,11 +57,11 @@ async fn login() -> app::Result<Markup> {
Page::new()
.with_title(
"Identificación del usuario"
)
)/*
.add_to("content", Container::new()
.with_id("welcome")
.add(form_login())
.arc()
)
)*/
.render()
}

View file

@ -51,47 +51,49 @@ impl PageComponent for Block {
impl Block {
pub fn with(html: Markup) -> Self {
Block::new().add(html)
let mut block = Block::new();
block.add(html);
block
}
// Block BUILDER.
pub fn with_renderable(mut self, renderable: fn() -> bool) -> Self {
pub fn with_renderable(&mut self, renderable: fn() -> bool) -> &Self {
self.renderable = renderable;
self
}
pub fn with_weight(mut self, weight: i8) -> Self {
pub fn with_weight(&mut self, weight: i8) -> &Self {
self.weight = weight;
self
}
pub fn with_title(mut self, title: &str) -> Self {
pub fn with_title(&mut self, title: &str) -> &Self {
self.title.with_value(title);
self
}
pub fn add(mut self, html: Markup) -> Self {
pub fn add(&mut self, html: Markup) -> &Self {
self.html.push(html);
self
}
pub fn with_id(mut self, id: &str) -> Self {
pub fn with_id(&mut self, id: &str) -> &Self {
self.id.with_value(id);
self
}
pub fn set_classes(mut self, classes: &str) -> Self {
pub fn set_classes(&mut self, classes: &str) -> &Self {
self.classes.set_classes(classes);
self
}
pub fn add_classes(mut self, classes: &str) -> Self {
pub fn add_classes(&mut self, classes: &str) -> &Self {
self.classes.add_classes(classes);
self
}
pub fn using_template(mut self, template: &str) -> Self {
pub fn using_template(&mut self, template: &str) -> &Self {
self.template = template.to_owned();
self
}

View file

@ -36,27 +36,29 @@ impl PageComponent for Chunck {
impl Chunck {
pub fn with(html: Markup) -> Self {
Chunck::new().add(html)
let mut chunck = Chunck::new();
chunck.add(html);
chunck
}
// Chunck BUILDER.
pub fn with_renderable(mut self, renderable: fn() -> bool) -> Self {
pub fn with_renderable(&mut self, renderable: fn() -> bool) -> &Self {
self.renderable = renderable;
self
}
pub fn with_weight(mut self, weight: i8) -> Self {
pub fn with_weight(&mut self, weight: i8) -> &Self {
self.weight = weight;
self
}
pub fn add(mut self, html: Markup) -> Self {
pub fn add(&mut self, html: Markup) -> &Self {
self.html.push(html);
self
}
pub fn using_template(mut self, template: &str) -> Self {
pub fn using_template(&mut self, template: &str) -> &Self {
self.template = template.to_owned();
self
}

View file

@ -99,12 +99,12 @@ impl Container {
// Container BUILDER.
pub fn with_renderable(mut self, renderable: fn() -> bool) -> Self {
pub fn with_renderable(&mut self, renderable: fn() -> bool) -> &Self {
self.renderable = renderable;
self
}
pub fn with_weight(mut self, weight: i8) -> Self {
pub fn with_weight(&mut self, weight: i8) -> &Self {
self.weight = weight;
self
}
@ -114,22 +114,22 @@ impl Container {
self
}
pub fn with_id(mut self, id: &str) -> Self {
pub fn with_id(&mut self, id: &str) -> &Self {
self.id.with_value(id);
self
}
pub fn set_classes(mut self, classes: &str) -> Self {
pub fn set_classes(&mut self, classes: &str) -> &Self {
self.classes.set_classes(classes);
self
}
pub fn add_classes(mut self, classes: &str) -> Self {
pub fn add_classes(&mut self, classes: &str) -> &Self {
self.classes.add_classes(classes);
self
}
pub fn using_template(mut self, template: &str) -> Self {
pub fn using_template(&mut self, template: &str) -> &Self {
self.template = template.to_owned();
self
}

View file

@ -68,44 +68,48 @@ impl PageComponent for Button {
impl Button {
pub fn button(value: &str) -> Self {
Button::new().with_value(value)
let mut button = Button::new();
button.with_value(value);
button
}
pub fn reset(value: &str) -> Self {
let mut button = Button::new().with_value(value);
let mut button = Button::new();
button.with_value(value);
button.button_type = ButtonType::Reset;
button
}
pub fn submit(value: &str) -> Self {
let mut button = Button::new().with_value(value);
let mut button = Button::new();
button.with_value(value);
button.button_type = ButtonType::Submit;
button
}
// Button BUILDER.
pub fn with_renderable(mut self, renderable: fn() -> bool) -> Self {
pub fn with_renderable(&mut self, renderable: fn() -> bool) -> &Self {
self.renderable = renderable;
self
}
pub fn with_weight(mut self, weight: i8) -> Self {
pub fn with_weight(&mut self, weight: i8) -> &Self {
self.weight = weight;
self
}
pub fn with_name(mut self, name: &str) -> Self {
pub fn with_name(&mut self, name: &str) -> &Self {
self.name.with_value(name);
self
}
pub fn with_value(mut self, value: &str) -> Self {
pub fn with_value(&mut self, value: &str) -> &Self {
self.value.with_value(value);
self
}
pub fn with_autofocus(mut self, toggle: bool) -> Self {
pub fn with_autofocus(&mut self, toggle: bool) -> &Self {
self.autofocus.with_value(match toggle {
true => "autofocus",
false => "",
@ -113,7 +117,7 @@ impl Button {
self
}
pub fn with_disabled(mut self, toggle: bool) -> Self {
pub fn with_disabled(&mut self, toggle: bool) -> &Self {
self.disabled.with_value(match toggle {
true => "disabled",
false => "",
@ -121,17 +125,17 @@ impl Button {
self
}
pub fn set_classes(mut self, classes: &str) -> Self {
pub fn set_classes(&mut self, classes: &str) -> &Self {
self.classes.set_classes(classes);
self
}
pub fn add_classes(mut self, classes: &str) -> Self {
pub fn add_classes(&mut self, classes: &str) -> &Self {
self.classes.add_classes(classes);
self
}
pub fn using_template(mut self, template: &str) -> Self {
pub fn using_template(&mut self, template: &str) -> &Self {
self.template = template.to_owned();
self
}

View file

@ -95,37 +95,37 @@ impl Date {
// Date BUILDER.
pub fn with_renderable(mut self, renderable: fn() -> bool) -> Self {
pub fn with_renderable(&mut self, renderable: fn() -> bool) -> &Self {
self.renderable = renderable;
self
}
pub fn with_weight(mut self, weight: i8) -> Self {
pub fn with_weight(&mut self, weight: i8) -> &Self {
self.weight = weight;
self
}
pub fn with_name(mut self, name: &str) -> Self {
pub fn with_name(&mut self, name: &str) -> &Self {
self.name.with_value(name);
self
}
pub fn with_value(mut self, value: &str) -> Self {
pub fn with_value(&mut self, value: &str) -> &Self {
self.value.with_value(value);
self
}
pub fn with_label(mut self, label: &str) -> Self {
pub fn with_label(&mut self, label: &str) -> &Self {
self.label.with_value(label);
self
}
pub fn with_placeholder(mut self, placeholder: &str) -> Self {
pub fn with_placeholder(&mut self, placeholder: &str) -> &Self {
self.placeholder.with_value(placeholder);
self
}
pub fn with_autofocus(mut self, toggle: bool) -> Self {
pub fn with_autofocus(&mut self, toggle: bool) -> &Self {
self.autofocus.with_value(match toggle {
true => "autofocus",
false => "",
@ -133,7 +133,7 @@ impl Date {
self
}
pub fn with_autocomplete(mut self, toggle: bool) -> Self {
pub fn with_autocomplete(&mut self, toggle: bool) -> &Self {
self.autocomplete.with_value(match toggle {
true => "",
false => "off",
@ -141,7 +141,7 @@ impl Date {
self
}
pub fn with_disabled(mut self, toggle: bool) -> Self {
pub fn with_disabled(&mut self, toggle: bool) -> &Self {
self.disabled.with_value(match toggle {
true => "disabled",
false => "",
@ -149,7 +149,7 @@ impl Date {
self
}
pub fn with_readonly(mut self, toggle: bool) -> Self {
pub fn with_readonly(&mut self, toggle: bool) -> &Self {
self.readonly.with_value(match toggle {
true => "readonly",
false => "",
@ -157,7 +157,7 @@ impl Date {
self
}
pub fn with_required(mut self, toggle: bool) -> Self {
pub fn with_required(&mut self, toggle: bool) -> &Self {
self.required.with_value(match toggle {
true => "required",
false => "",
@ -165,22 +165,22 @@ impl Date {
self
}
pub fn with_help_text(mut self, help_text: &str) -> Self {
pub fn with_help_text(&mut self, help_text: &str) -> &Self {
self.help_text.with_value(help_text);
self
}
pub fn set_classes(mut self, classes: &str) -> Self {
pub fn set_classes(&mut self, classes: &str) -> &Self {
self.classes.set_classes(classes);
self
}
pub fn add_classes(mut self, classes: &str) -> Self {
pub fn add_classes(&mut self, classes: &str) -> &Self {
self.classes.add_classes(classes);
self
}
pub fn using_template(mut self, template: &str) -> Self {
pub fn using_template(&mut self, template: &str) -> &Self {
self.template = template.to_owned();
self
}

View file

@ -60,27 +60,27 @@ impl Form {
// Form BUILDER.
pub fn with_renderable(mut self, renderable: fn() -> bool) -> Self {
pub fn with_renderable(&mut self, renderable: fn() -> bool) -> &Self {
self.renderable = renderable;
self
}
pub fn with_weight(mut self, weight: i8) -> Self {
pub fn with_weight(&mut self, weight: i8) -> &Self {
self.weight = weight;
self
}
pub fn with_action(mut self, action: &str) -> Self {
pub fn with_action(&mut self, action: &str) -> &Self {
self.action.with_value(action);
self
}
pub fn with_charset(mut self, charset: &str) -> Self {
pub fn with_charset(&mut self, charset: &str) -> &Self {
self.charset.with_value(charset);
self
}
pub fn with_method(mut self, method: FormMethod) -> Self {
pub fn with_method(&mut self, method: FormMethod) -> &Self {
self.method = method;
self
}
@ -90,22 +90,22 @@ impl Form {
self
}
pub fn with_id(mut self, id: &str) -> Self {
pub fn with_id(&mut self, id: &str) -> &Self {
self.id.with_value(id);
self
}
pub fn set_classes(mut self, classes: &str) -> Self {
pub fn set_classes(&mut self, classes: &str) -> &Self {
self.classes.set_classes(classes);
self
}
pub fn add_classes(mut self, classes: &str) -> Self {
pub fn add_classes(&mut self, classes: &str) -> &Self {
self.classes.add_classes(classes);
self
}
pub fn using_template(mut self, template: &str) -> Self {
pub fn using_template(&mut self, template: &str) -> &Self {
self.template = template.to_owned();
self
}

View file

@ -32,22 +32,25 @@ impl PageComponent for Hidden {
impl Hidden {
pub fn set(name: &str, value: &str) -> Self {
Hidden::new().with_name(name).with_value(value)
let mut hidden = Hidden::new();
hidden.with_name(name);
hidden.with_value(value);
hidden
}
// Hidden BUILDER.
pub fn with_weight(mut self, weight: i8) -> Self {
pub fn with_weight(&mut self, weight: i8) -> &Self {
self.weight = weight;
self
}
pub fn with_name(mut self, name: &str) -> Self {
pub fn with_name(&mut self, name: &str) -> &Self {
self.name.with_value(name);
self
}
pub fn with_value(mut self, value: &str) -> Self {
pub fn with_value(&mut self, value: &str) -> &Self {
self.value.with_value(value);
self
}

View file

@ -149,52 +149,52 @@ impl Input {
// Input BUILDER.
pub fn with_renderable(mut self, renderable: fn() -> bool) -> Self {
pub fn with_renderable(&mut self, renderable: fn() -> bool) -> &Self {
self.renderable = renderable;
self
}
pub fn with_weight(mut self, weight: i8) -> Self {
pub fn with_weight(&mut self, weight: i8) -> &Self {
self.weight = weight;
self
}
pub fn with_name(mut self, name: &str) -> Self {
pub fn with_name(&mut self, name: &str) -> &Self {
self.name.with_value(name);
self
}
pub fn with_value(mut self, value: &str) -> Self {
pub fn with_value(&mut self, value: &str) -> &Self {
self.value.with_value(value);
self
}
pub fn with_label(mut self, label: &str) -> Self {
pub fn with_label(&mut self, label: &str) -> &Self {
self.label.with_value(label);
self
}
pub fn with_size(mut self, size: Option<u16>) -> Self {
pub fn with_size(&mut self, size: Option<u16>) -> &Self {
self.size = size;
self
}
pub fn with_minlength(mut self, minlength: Option<u16>) -> Self {
pub fn with_minlength(&mut self, minlength: Option<u16>) -> &Self {
self.minlength = minlength;
self
}
pub fn with_maxlength(mut self, maxlength: Option<u16>) -> Self {
pub fn with_maxlength(&mut self, maxlength: Option<u16>) -> &Self {
self.maxlength = maxlength;
self
}
pub fn with_placeholder(mut self, placeholder: &str) -> Self {
pub fn with_placeholder(&mut self, placeholder: &str) -> &Self {
self.placeholder.with_value(placeholder);
self
}
pub fn with_autofocus(mut self, toggle: bool) -> Self {
pub fn with_autofocus(&mut self, toggle: bool) -> &Self {
self.autofocus.with_value(match toggle {
true => "autofocus",
false => "",
@ -202,7 +202,7 @@ impl Input {
self
}
pub fn with_autocomplete(mut self, toggle: bool) -> Self {
pub fn with_autocomplete(&mut self, toggle: bool) -> &Self {
self.autocomplete.with_value(match toggle {
true => "",
false => "off",
@ -210,7 +210,7 @@ impl Input {
self
}
pub fn with_disabled(mut self, toggle: bool) -> Self {
pub fn with_disabled(&mut self, toggle: bool) -> &Self {
self.disabled.with_value(match toggle {
true => "disabled",
false => "",
@ -218,7 +218,7 @@ impl Input {
self
}
pub fn with_readonly(mut self, toggle: bool) -> Self {
pub fn with_readonly(&mut self, toggle: bool) -> &Self {
self.readonly.with_value(match toggle {
true => "readonly",
false => "",
@ -226,7 +226,7 @@ impl Input {
self
}
pub fn with_required(mut self, toggle: bool) -> Self {
pub fn with_required(&mut self, toggle: bool) -> &Self {
self.required.with_value(match toggle {
true => "required",
false => "",
@ -234,22 +234,22 @@ impl Input {
self
}
pub fn with_help_text(mut self, help_text: &str) -> Self {
pub fn with_help_text(&mut self, help_text: &str) -> &Self {
self.help_text.with_value(help_text);
self
}
pub fn set_classes(mut self, classes: &str) -> Self {
pub fn set_classes(&mut self, classes: &str) -> &Self {
self.classes.set_classes(classes);
self
}
pub fn add_classes(mut self, classes: &str) -> Self {
pub fn add_classes(&mut self, classes: &str) -> &Self {
self.classes.add_classes(classes);
self
}
pub fn using_template(mut self, template: &str) -> Self {
pub fn using_template(&mut self, template: &str) -> &Self {
self.template = template.to_owned();
self
}

View file

@ -46,12 +46,12 @@ impl Column {
// Column BUILDER.
pub fn with_renderable(mut self, renderable: fn() -> bool) -> Self {
pub fn with_renderable(&mut self, renderable: fn() -> bool) -> &Self {
self.renderable = renderable;
self
}
pub fn with_weight(mut self, weight: i8) -> Self {
pub fn with_weight(&mut self, weight: i8) -> &Self {
self.weight = weight;
self
}
@ -61,22 +61,22 @@ impl Column {
self
}
pub fn with_id(mut self, id: &str) -> Self {
pub fn with_id(&mut self, id: &str) -> &Self {
self.id.with_value(id);
self
}
pub fn set_classes(mut self, classes: &str) -> Self {
pub fn set_classes(&mut self, classes: &str) -> &Self {
self.classes.set_classes(classes);
self
}
pub fn add_classes(mut self, classes: &str) -> Self {
pub fn add_classes(&mut self, classes: &str) -> &Self {
self.classes.add_classes(classes);
self
}
pub fn using_template(mut self, template: &str) -> Self {
pub fn using_template(&mut self, template: &str) -> &Self {
self.template = template.to_owned();
self
}

View file

@ -46,12 +46,12 @@ impl Row {
// Row BUILDER.
pub fn with_renderable(mut self, renderable: fn() -> bool) -> Self {
pub fn with_renderable(&mut self, renderable: fn() -> bool) -> &Self {
self.renderable = renderable;
self
}
pub fn with_weight(mut self, weight: i8) -> Self {
pub fn with_weight(&mut self, weight: i8) -> &Self {
self.weight = weight;
self
}
@ -61,22 +61,22 @@ impl Row {
self
}
pub fn with_id(mut self, id: &str) -> Self {
pub fn with_id(&mut self, id: &str) -> &Self {
self.id.with_value(id);
self
}
pub fn set_classes(mut self, classes: &str) -> Self {
pub fn set_classes(&mut self, classes: &str) -> &Self {
self.classes.set_classes(classes);
self
}
pub fn add_classes(mut self, classes: &str) -> Self {
pub fn add_classes(&mut self, classes: &str) -> &Self {
self.classes.add_classes(classes);
self
}
pub fn using_template(mut self, template: &str) -> Self {
pub fn using_template(&mut self, template: &str) -> &Self {
self.template = template.to_owned();
self
}

View file

@ -41,42 +41,44 @@ impl PageComponent for Image {
impl Image {
pub fn image(source: &str) -> Self {
Image::new().with_source(source)
let mut image = Image::new();
image.with_source(source);
image
}
// Image BUILDER.
pub fn with_renderable(mut self, renderable: fn() -> bool) -> Self {
pub fn with_renderable(&mut self, renderable: fn() -> bool) -> &Self {
self.renderable = renderable;
self
}
pub fn with_weight(mut self, weight: i8) -> Self {
pub fn with_weight(&mut self, weight: i8) -> &Self {
self.weight = weight;
self
}
pub fn with_source(mut self, source: &str) -> Self {
pub fn with_source(&mut self, source: &str) -> &Self {
self.source.with_value(source);
self
}
pub fn with_id(mut self, id: &str) -> Self {
pub fn with_id(&mut self, id: &str) -> &Self {
self.id.with_value(id);
self
}
pub fn set_classes(mut self, classes: &str) -> Self {
pub fn set_classes(&mut self, classes: &str) -> &Self {
self.classes.set_classes(classes);
self
}
pub fn add_classes(mut self, classes: &str) -> Self {
pub fn add_classes(&mut self, classes: &str) -> &Self {
self.classes.add_classes(classes);
self
}
pub fn using_template(mut self, template: &str) -> Self {
pub fn using_template(&mut self, template: &str) -> &Self {
self.template = template.to_owned();
self
}