⏪ Revierte última confirmación de cambios
This commit is contained in:
parent
3839d1c51c
commit
a28269796a
16 changed files with 72 additions and 92 deletions
|
|
@ -38,17 +38,15 @@ pub struct Anchor {
|
||||||
template : String,
|
template : String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ModuleTrait for Anchor {
|
|
||||||
fn handle(&self) -> Handle {
|
|
||||||
COMPONENT_ANCHOR
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ComponentTrait for Anchor {
|
impl ComponentTrait for Anchor {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
Anchor::default()
|
Anchor::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle(&self) -> Handle {
|
||||||
|
COMPONENT_ANCHOR
|
||||||
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> isize {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,17 +16,15 @@ pub struct Block {
|
||||||
template : String,
|
template : String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ModuleTrait for Block {
|
|
||||||
fn handle(&self) -> Handle {
|
|
||||||
COMPONENT_BLOCK
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ComponentTrait for Block {
|
impl ComponentTrait for Block {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
Block::default().with_classes(ClassesOp::SetDefault, "block")
|
Block::default().with_classes(ClassesOp::SetDefault, "block")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle(&self) -> Handle {
|
||||||
|
COMPONENT_BLOCK
|
||||||
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> isize {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,6 @@ pub struct Container {
|
||||||
template : String,
|
template : String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ModuleTrait for Container {
|
|
||||||
fn handle(&self) -> Handle {
|
|
||||||
COMPONENT_CONTAINER
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ComponentTrait for Container {
|
impl ComponentTrait for Container {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
Container::default()
|
Container::default()
|
||||||
|
|
@ -40,6 +34,10 @@ impl ComponentTrait for Container {
|
||||||
.with_inner_classes(ClassesOp::SetDefault, "container")
|
.with_inner_classes(ClassesOp::SetDefault, "container")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle(&self) -> Handle {
|
||||||
|
COMPONENT_CONTAINER
|
||||||
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> isize {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,6 @@ pub struct Button {
|
||||||
template : String,
|
template : String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ModuleTrait for Button {
|
|
||||||
fn handle(&self) -> Handle {
|
|
||||||
COMPONENT_BUTTON
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ComponentTrait for Button {
|
impl ComponentTrait for Button {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
Button::default()
|
Button::default()
|
||||||
|
|
@ -37,6 +31,10 @@ impl ComponentTrait for Button {
|
||||||
.with_classes(ClassesOp::AddFirst, "form-button")
|
.with_classes(ClassesOp::AddFirst, "form-button")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle(&self) -> Handle {
|
||||||
|
COMPONENT_BUTTON
|
||||||
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> isize {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,6 @@ pub struct Date {
|
||||||
template : String,
|
template : String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ModuleTrait for Date {
|
|
||||||
fn handle(&self) -> Handle {
|
|
||||||
COMPONENT_DATE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ComponentTrait for Date {
|
impl ComponentTrait for Date {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
Date::default()
|
Date::default()
|
||||||
|
|
@ -34,6 +28,10 @@ impl ComponentTrait for Date {
|
||||||
.with_classes(ClassesOp::AddFirst, "form-type-date")
|
.with_classes(ClassesOp::AddFirst, "form-type-date")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle(&self) -> Handle {
|
||||||
|
COMPONENT_DATE
|
||||||
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> isize {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,6 @@ pub struct Form {
|
||||||
template : String,
|
template : String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ModuleTrait for Form {
|
|
||||||
fn handle(&self) -> Handle {
|
|
||||||
COMPONENT_FORM
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ComponentTrait for Form {
|
impl ComponentTrait for Form {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
Form::default()
|
Form::default()
|
||||||
|
|
@ -38,6 +32,10 @@ impl ComponentTrait for Form {
|
||||||
.with_charset("UTF-8")
|
.with_charset("UTF-8")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle(&self) -> Handle {
|
||||||
|
COMPONENT_FORM
|
||||||
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> isize {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,17 +10,15 @@ pub struct Hidden {
|
||||||
value : AttributeValue,
|
value : AttributeValue,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ModuleTrait for Hidden {
|
|
||||||
fn handle(&self) -> Handle {
|
|
||||||
COMPONENT_HIDDEN
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ComponentTrait for Hidden {
|
impl ComponentTrait for Hidden {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
Hidden::default()
|
Hidden::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle(&self) -> Handle {
|
||||||
|
COMPONENT_HIDDEN
|
||||||
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> isize {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,12 +36,6 @@ pub struct Input {
|
||||||
template : String,
|
template : String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ModuleTrait for Input {
|
|
||||||
fn handle(&self) -> Handle {
|
|
||||||
COMPONENT_INPUT
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ComponentTrait for Input {
|
impl ComponentTrait for Input {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
Input::default()
|
Input::default()
|
||||||
|
|
@ -51,6 +45,10 @@ impl ComponentTrait for Input {
|
||||||
.with_maxlength(Some(128))
|
.with_maxlength(Some(128))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle(&self) -> Handle {
|
||||||
|
COMPONENT_INPUT
|
||||||
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> isize {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,17 +48,15 @@ pub struct Column {
|
||||||
template : String,
|
template : String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ModuleTrait for Column {
|
|
||||||
fn handle(&self) -> Handle {
|
|
||||||
COMPONENT_COLUMN
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ComponentTrait for Column {
|
impl ComponentTrait for Column {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
Column::default().with_classes(ClassesOp::SetDefault, SIZE__DEFAULT)
|
Column::default().with_classes(ClassesOp::SetDefault, SIZE__DEFAULT)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle(&self) -> Handle {
|
||||||
|
COMPONENT_COLUMN
|
||||||
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> isize {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,17 +15,15 @@ pub struct Row {
|
||||||
template : String,
|
template : String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ModuleTrait for Row {
|
|
||||||
fn handle(&self) -> Handle {
|
|
||||||
COMPONENT_ROW
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ComponentTrait for Row {
|
impl ComponentTrait for Row {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
Row::default().with_classes(ClassesOp::SetDefault, "row")
|
Row::default().with_classes(ClassesOp::SetDefault, "row")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle(&self) -> Handle {
|
||||||
|
COMPONENT_ROW
|
||||||
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> isize {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,17 +38,15 @@ pub struct Heading {
|
||||||
template : String,
|
template : String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ModuleTrait for Heading {
|
|
||||||
fn handle(&self) -> Handle {
|
|
||||||
COMPONENT_HEADING
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ComponentTrait for Heading {
|
impl ComponentTrait for Heading {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
Heading::default()
|
Heading::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle(&self) -> Handle {
|
||||||
|
COMPONENT_HEADING
|
||||||
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> isize {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,17 +11,15 @@ pub struct Html {
|
||||||
template : String,
|
template : String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ModuleTrait for Html {
|
|
||||||
fn handle(&self) -> Handle {
|
|
||||||
COMPONENT_HTML
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ComponentTrait for Html {
|
impl ComponentTrait for Html {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
Html::default()
|
Html::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle(&self) -> Handle {
|
||||||
|
COMPONENT_HTML
|
||||||
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> isize {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,17 +11,15 @@ pub struct Icon {
|
||||||
classes : Classes,
|
classes : Classes,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ModuleTrait for Icon {
|
|
||||||
fn handle(&self) -> Handle {
|
|
||||||
COMPONENT_ICON
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ComponentTrait for Icon {
|
impl ComponentTrait for Icon {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
Icon::default().with_classes(ClassesOp::SetDefault, "bi-question-circle-fill")
|
Icon::default().with_classes(ClassesOp::SetDefault, "bi-question-circle-fill")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle(&self) -> Handle {
|
||||||
|
COMPONENT_ICON
|
||||||
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> isize {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,17 +13,15 @@ pub struct Image {
|
||||||
template : String,
|
template : String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ModuleTrait for Image {
|
|
||||||
fn handle(&self) -> Handle {
|
|
||||||
COMPONENT_IMAGE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ComponentTrait for Image {
|
impl ComponentTrait for Image {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
Image::default().with_classes(ClassesOp::SetDefault, "img-fluid")
|
Image::default().with_classes(ClassesOp::SetDefault, "img-fluid")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle(&self) -> Handle {
|
||||||
|
COMPONENT_IMAGE
|
||||||
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> isize {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,17 +25,15 @@ pub struct Paragraph {
|
||||||
template : String,
|
template : String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ModuleTrait for Paragraph {
|
|
||||||
fn handle(&self) -> Handle {
|
|
||||||
COMPONENT_PARAGRAPH
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ComponentTrait for Paragraph {
|
impl ComponentTrait for Paragraph {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
Paragraph::default()
|
Paragraph::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle(&self) -> Handle {
|
||||||
|
COMPONENT_PARAGRAPH
|
||||||
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> isize {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use super::RenderContext;
|
use super::RenderContext;
|
||||||
|
|
||||||
use crate::core::module::ModuleTrait;
|
|
||||||
use crate::html::{html, Markup};
|
use crate::html::{html, Markup};
|
||||||
|
use crate::util::{single_type_name, Handle};
|
||||||
|
|
||||||
pub use std::any::Any as AnyComponent;
|
pub use std::any::Any as AnyComponent;
|
||||||
|
|
||||||
|
|
@ -9,11 +9,21 @@ pub trait BaseComponent {
|
||||||
fn render(&mut self, rcx: &mut RenderContext) -> Markup;
|
fn render(&mut self, rcx: &mut RenderContext) -> Markup;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ComponentTrait: AnyComponent + BaseComponent + ModuleTrait + Send + Sync {
|
pub trait ComponentTrait: AnyComponent + BaseComponent + Send + Sync {
|
||||||
fn new() -> Self
|
fn new() -> Self
|
||||||
where
|
where
|
||||||
Self: Sized;
|
Self: Sized;
|
||||||
|
|
||||||
|
fn handle(&self) -> Handle;
|
||||||
|
|
||||||
|
fn name(&self) -> String {
|
||||||
|
single_type_name::<Self>().to_owned()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn description(&self) -> Option<String> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
fn weight(&self) -> isize {
|
fn weight(&self) -> isize {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue