DataSection

Struct DataSection 

Source
pub struct DataSection {
    pub label: String,
    pub fields: Vec<DataField>,
    pub error: Option<String>,
    pub render: Option<Rc<dyn Fn(Vec<DataField>) -> DomElement>>,
    pub fieldset_style: FieldsetStyle,
    pub fieldset_css: Option<Css>,
    pub new_group: bool,
}
Expand description

A section of form with label and a field (or field set).

Fields§

§label: String§fields: Vec<DataField>§error: Option<String>§render: Option<Rc<dyn Fn(Vec<DataField>) -> DomElement>>§fieldset_style: FieldsetStyle§fieldset_css: Option<Css>§new_group: bool

Implementations§

Source§

impl DataSection

Source

pub fn new(label: impl Into<String>) -> Self

Create a new form section without fields.

Source

pub fn with_string_field( label: impl Into<String>, key: impl Into<String>, original_value: impl Into<String>, ) -> Self

Create a new form section with single string field.

Source

pub fn with_opt_string_field( label: impl Into<String>, key: impl Into<String>, original_value: &Option<String>, ) -> Self

Create a new form section with single optional string field.

Source

pub fn add_field(self, key: impl Into<String>, value: DataFieldValue) -> Self

Source

pub fn add_string_field( self, key: impl Into<String>, original_value: impl Into<String>, ) -> Self

Add another string field to form section (text input).

Source

pub fn add_opt_string_field( self, key: impl Into<String>, original_value: &Option<String>, ) -> Self

Add another optional string field to form section (text input).

Source

pub fn add_list_field( self, key: impl Into<String>, original_value: Option<impl Into<String>>, options: Vec<String>, ) -> Self

Add another list field to form section (dropdown with options).

Source

pub fn add_static_dict_field( self, key: impl Into<String>, original_value: Option<i64>, options: Vec<(i64, String)>, ) -> Self

Add another dict field to form section based on static (non-reactive) dictionary Renders dropdown with options, value are stored as integer.

Source

pub fn add_dict_field( self, key: impl Into<String>, original_value: Option<i64>, options: Computed<Vec<(i64, String)>>, ) -> Self

Add another dict field to form section based on reactive dictionary Renders dropdown with options, value are stored as integer.

Source

pub fn add_multiselect_field( self, key: impl Into<String>, original_value: Vec<i64>, options: Computed<HashMap<i64, String>>, add_label: impl Into<String>, ) -> Self

Add multiselect field to form section (multiple search inputs, value stored as integer).

Source

pub fn add_bool_field( self, key: impl Into<String>, original_value: Option<impl Into<bool>>, ) -> Self

Add another bool field to form section (checkbox input).

Source

pub fn add_image_field( self, key: impl Into<String>, original_value: Option<impl Into<String>>, ) -> Self

Add another image field to form section.

Source

pub fn set_fieldset_style(self, fieldset_style: FieldsetStyle) -> Self

Set FieldsetStyle for this section.

Source

pub fn set_fieldset_css(self, fieldset_css: Css) -> Self

Set Css for fields container for this section.

Source

pub fn starts_new_group(self) -> Self

This section starts a new section group (Form adds a horizontal rule)

Trait Implementations§

Source§

impl Default for DataSection

Source§

fn default() -> DataSection

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.