generated from mitchell/rust_template
add context and non-context version of the controls
This commit is contained in:
parent
89375a5b0c
commit
18a99ec181
@ -1,4 +1,4 @@
|
||||
use super::{BuilderFn, ControlRenderData, ShowWhenFn};
|
||||
use super::{BuilderCxFn, BuilderFn, ControlRenderData, ShowWhenFn};
|
||||
use crate::{form::FormToolData, form_builder::FormBuilder, styles::FormStyle};
|
||||
use leptos::view;
|
||||
use leptos::RwSignal;
|
||||
@ -31,10 +31,19 @@ impl<FD: FormToolData> Clone for ButtonData<FD> {
|
||||
}
|
||||
|
||||
impl<FD: FormToolData> FormBuilder<FD> {
|
||||
pub fn button(mut self, builder: impl BuilderFn<ButtonBuilder<FD>, FD::Context>) -> Self {
|
||||
pub fn button(self, builder: impl BuilderFn<ButtonBuilder<FD>>) -> Self {
|
||||
let button_builder = ButtonBuilder::new();
|
||||
let control = builder(button_builder);
|
||||
self.button_helper(control)
|
||||
}
|
||||
|
||||
pub fn button_cx(self, builder: impl BuilderCxFn<ButtonBuilder<FD>, FD::Context>) -> Self {
|
||||
let button_builder = ButtonBuilder::new();
|
||||
let control = builder(button_builder, self.cx.clone());
|
||||
self.button_helper(control)
|
||||
}
|
||||
|
||||
fn button_helper(mut self, control: ButtonBuilder<FD>) -> Self {
|
||||
let render_data = ControlRenderData {
|
||||
data: control.data,
|
||||
styles: control.styles,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
use super::{BuilderFn, ControlBuilder, ControlData, ControlRenderData};
|
||||
use super::{BuilderCxFn, BuilderFn, ControlBuilder, ControlData, ControlRenderData};
|
||||
use crate::{form::FormToolData, form_builder::FormBuilder, styles::FormStyle};
|
||||
use leptos::{Signal, View};
|
||||
use std::rc::Rc;
|
||||
@ -26,10 +26,17 @@ impl ControlData for CheckboxData {
|
||||
impl<FD: FormToolData> FormBuilder<FD> {
|
||||
pub fn checkbox<FDT: Clone + PartialEq + 'static>(
|
||||
self,
|
||||
builder: impl BuilderFn<ControlBuilder<FD, CheckboxData, FDT>, FD::Context>,
|
||||
builder: impl BuilderFn<ControlBuilder<FD, CheckboxData, FDT>>,
|
||||
) -> Self {
|
||||
self.new_control(builder)
|
||||
}
|
||||
|
||||
pub fn checkbox_cx<FDT: Clone + PartialEq + 'static>(
|
||||
self,
|
||||
builder: impl BuilderCxFn<ControlBuilder<FD, CheckboxData, FDT>, FD::Context>,
|
||||
) -> Self {
|
||||
self.new_control_cx(builder)
|
||||
}
|
||||
}
|
||||
|
||||
impl<FD: FormToolData, FDT> ControlBuilder<FD, CheckboxData, FDT> {
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
use super::{BuilderFn, ControlBuilder, ControlData};
|
||||
use super::{BuilderCxFn, BuilderFn, ControlBuilder, ControlData};
|
||||
use crate::{FormBuilder, FormToolData};
|
||||
|
||||
impl<FD: FormToolData> FormBuilder<FD> {
|
||||
pub fn custom<CC: ControlData, FDT: Clone + PartialEq + 'static>(
|
||||
mut self,
|
||||
control_data: CC,
|
||||
builder: impl Fn(ControlBuilder<FD, CC, FDT>) -> ControlBuilder<FD, CC, FDT>,
|
||||
builder: impl BuilderFn<ControlBuilder<FD, CC, FDT>>,
|
||||
) -> Self {
|
||||
let control_builder = ControlBuilder::new(control_data);
|
||||
let control = builder(control_builder);
|
||||
@ -13,10 +13,28 @@ impl<FD: FormToolData> FormBuilder<FD> {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn custom_cx<CC: ControlData, FDT: Clone + PartialEq + 'static>(
|
||||
mut self,
|
||||
control_data: CC,
|
||||
builder: impl BuilderCxFn<ControlBuilder<FD, CC, FDT>, FD::Context>,
|
||||
) -> Self {
|
||||
let control_builder = ControlBuilder::new(control_data);
|
||||
let control = builder(control_builder, self.cx.clone());
|
||||
self.add_control(control);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn custom_default<CC: Default + ControlData, FDT: Clone + PartialEq + 'static>(
|
||||
self,
|
||||
builder: impl BuilderFn<ControlBuilder<FD, CC, FDT>, FD::Context>,
|
||||
builder: impl BuilderFn<ControlBuilder<FD, CC, FDT>>,
|
||||
) -> Self {
|
||||
self.new_control(builder)
|
||||
}
|
||||
|
||||
pub fn custom_default_cx<CC: Default + ControlData, FDT: Clone + PartialEq + 'static>(
|
||||
self,
|
||||
builder: impl BuilderCxFn<ControlBuilder<FD, CC, FDT>, FD::Context>,
|
||||
) -> Self {
|
||||
self.new_control_cx(builder)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
use super::{BuilderFn, ControlRenderData, VanityControlBuilder, VanityControlData};
|
||||
use super::{BuilderCxFn, BuilderFn, ControlRenderData, VanityControlBuilder, VanityControlData};
|
||||
use crate::{form::FormToolData, form_builder::FormBuilder, styles::FormStyle};
|
||||
use leptos::View;
|
||||
use std::rc::Rc;
|
||||
@ -19,12 +19,16 @@ impl VanityControlData for HeadingData {
|
||||
}
|
||||
|
||||
impl<FD: FormToolData> FormBuilder<FD> {
|
||||
pub fn heading(
|
||||
self,
|
||||
builder: impl BuilderFn<VanityControlBuilder<FD, HeadingData>, FD::Context>,
|
||||
) -> Self {
|
||||
pub fn heading(self, builder: impl BuilderFn<VanityControlBuilder<FD, HeadingData>>) -> Self {
|
||||
self.new_vanity(builder)
|
||||
}
|
||||
|
||||
pub fn heading_cx(
|
||||
self,
|
||||
builder: impl BuilderCxFn<VanityControlBuilder<FD, HeadingData>, FD::Context>,
|
||||
) -> Self {
|
||||
self.new_vanity_cx(builder)
|
||||
}
|
||||
}
|
||||
|
||||
impl<FD: FormToolData> VanityControlBuilder<FD, HeadingData> {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
use super::{
|
||||
BuilderFn, ControlRenderData, GetterVanityControlData, VanityControlBuilder, VanityControlData,
|
||||
BuilderCxFn, BuilderFn, ControlRenderData, GetterVanityControlData, VanityControlBuilder,
|
||||
VanityControlData,
|
||||
};
|
||||
use crate::{form::FormToolData, form_builder::FormBuilder, styles::FormStyle};
|
||||
use leptos::{Signal, View};
|
||||
@ -22,12 +23,16 @@ impl VanityControlData for HiddenData {
|
||||
impl GetterVanityControlData for HiddenData {}
|
||||
|
||||
impl<FD: FormToolData> FormBuilder<FD> {
|
||||
pub fn hidden(
|
||||
self,
|
||||
builder: impl BuilderFn<VanityControlBuilder<FD, HiddenData>, FD::Context>,
|
||||
) -> Self {
|
||||
pub fn hidden(self, builder: impl BuilderFn<VanityControlBuilder<FD, HiddenData>>) -> Self {
|
||||
self.new_vanity(builder)
|
||||
}
|
||||
|
||||
pub fn hidden_cx(
|
||||
self,
|
||||
builder: impl BuilderCxFn<VanityControlBuilder<FD, HiddenData>, FD::Context>,
|
||||
) -> Self {
|
||||
self.new_vanity_cx(builder)
|
||||
}
|
||||
}
|
||||
|
||||
impl<FD: FormToolData> VanityControlBuilder<FD, HiddenData> {
|
||||
|
||||
@ -18,7 +18,8 @@ pub mod submit;
|
||||
pub mod text_area;
|
||||
pub mod text_input;
|
||||
|
||||
pub trait BuilderFn<B, CX>: Fn(B, Rc<CX>) -> B {}
|
||||
pub trait BuilderFn<B>: Fn(B) -> B {}
|
||||
pub trait BuilderCxFn<B, CX>: Fn(B, Rc<CX>) -> B {}
|
||||
pub trait ValidationFn<FD: ?Sized>: Fn(&FD) -> Result<(), String> + 'static {}
|
||||
pub trait ValidationCb: Fn() -> bool + 'static {}
|
||||
pub trait ParseFn<CR, FDT>: Fn(CR) -> Result<FDT, String> + 'static {}
|
||||
@ -32,7 +33,8 @@ pub trait RenderFn<FS, FD: 'static>:
|
||||
}
|
||||
|
||||
// implement the traits for all valid types
|
||||
impl<B, CX, T> BuilderFn<B, CX> for T where T: Fn(B, Rc<CX>) -> B {}
|
||||
impl<B, T> BuilderFn<B> for T where T: Fn(B) -> B {}
|
||||
impl<B, CX, T> BuilderCxFn<B, CX> for T where T: Fn(B, Rc<CX>) -> B {}
|
||||
impl<FDT, T> ValidationFn<FDT> for T where T: Fn(&FDT) -> Result<(), String> + 'static {}
|
||||
impl<T> ValidationCb for T where T: Fn() -> bool + 'static {}
|
||||
impl<CR, FDT, F> ParseFn<CR, FDT> for F where F: Fn(CR) -> Result<FDT, String> + 'static {}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
use super::{
|
||||
BuilderFn, ControlRenderData, GetterVanityControlData, VanityControlBuilder, VanityControlData,
|
||||
BuilderCxFn, BuilderFn, ControlRenderData, GetterVanityControlData, VanityControlBuilder,
|
||||
VanityControlData,
|
||||
};
|
||||
use crate::{form::FormToolData, form_builder::FormBuilder, styles::FormStyle};
|
||||
use leptos::{Signal, View};
|
||||
@ -20,10 +21,14 @@ impl VanityControlData for OutputData {
|
||||
impl GetterVanityControlData for OutputData {}
|
||||
|
||||
impl<FD: FormToolData> FormBuilder<FD> {
|
||||
pub fn output(
|
||||
self,
|
||||
builder: impl BuilderFn<VanityControlBuilder<FD, OutputData>, FD::Context>,
|
||||
) -> Self {
|
||||
pub fn output(self, builder: impl BuilderFn<VanityControlBuilder<FD, OutputData>>) -> Self {
|
||||
self.new_vanity(builder)
|
||||
}
|
||||
|
||||
pub fn output_cx(
|
||||
self,
|
||||
builder: impl BuilderCxFn<VanityControlBuilder<FD, OutputData>, FD::Context>,
|
||||
) -> Self {
|
||||
self.new_vanity_cx(builder)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
use super::{BuilderFn, ControlBuilder, ControlData, ControlRenderData, ValidatedControlData};
|
||||
use super::{
|
||||
BuilderCxFn, BuilderFn, ControlBuilder, ControlData, ControlRenderData, ValidatedControlData,
|
||||
};
|
||||
use crate::{form::FormToolData, form_builder::FormBuilder, styles::FormStyle};
|
||||
use leptos::{Signal, View};
|
||||
use std::rc::Rc;
|
||||
@ -28,10 +30,17 @@ impl ValidatedControlData for RadioButtonsData {}
|
||||
impl<FD: FormToolData> FormBuilder<FD> {
|
||||
pub fn radio_buttons<FDT: Clone + PartialEq + 'static>(
|
||||
self,
|
||||
builder: impl BuilderFn<ControlBuilder<FD, RadioButtonsData, FDT>, FD::Context>,
|
||||
builder: impl BuilderFn<ControlBuilder<FD, RadioButtonsData, FDT>>,
|
||||
) -> Self {
|
||||
self.new_control(builder)
|
||||
}
|
||||
|
||||
pub fn radio_buttons_cx<FDT: Clone + PartialEq + 'static>(
|
||||
self,
|
||||
builder: impl BuilderCxFn<ControlBuilder<FD, RadioButtonsData, FDT>, FD::Context>,
|
||||
) -> Self {
|
||||
self.new_control_cx(builder)
|
||||
}
|
||||
}
|
||||
|
||||
impl<FD: FormToolData, FDT> ControlBuilder<FD, RadioButtonsData, FDT> {
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
use super::{BuilderFn, ControlBuilder, ControlData, ControlRenderData, ValidatedControlData};
|
||||
use super::{
|
||||
BuilderCxFn, BuilderFn, ControlBuilder, ControlData, ControlRenderData, ValidatedControlData,
|
||||
};
|
||||
use crate::{form::FormToolData, form_builder::FormBuilder, styles::FormStyle};
|
||||
use leptos::{Signal, View};
|
||||
use std::rc::Rc;
|
||||
@ -31,10 +33,16 @@ impl ValidatedControlData for SelectData {}
|
||||
impl<FD: FormToolData> FormBuilder<FD> {
|
||||
pub fn select<FDT: Clone + PartialEq + 'static>(
|
||||
self,
|
||||
builder: impl BuilderFn<ControlBuilder<FD, SelectData, FDT>, FD::Context>,
|
||||
builder: impl BuilderFn<ControlBuilder<FD, SelectData, FDT>>,
|
||||
) -> Self {
|
||||
self.new_control(builder)
|
||||
}
|
||||
pub fn select_cx<FDT: Clone + PartialEq + 'static>(
|
||||
self,
|
||||
builder: impl BuilderCxFn<ControlBuilder<FD, SelectData, FDT>, FD::Context>,
|
||||
) -> Self {
|
||||
self.new_control_cx(builder)
|
||||
}
|
||||
}
|
||||
|
||||
impl<FD: FormToolData, FDT> ControlBuilder<FD, SelectData, FDT> {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
use super::{BuilderFn, ControlBuilder, ControlData, ControlRenderData};
|
||||
use super::{BuilderCxFn, BuilderFn, ControlBuilder, ControlData, ControlRenderData};
|
||||
use crate::{form::FormToolData, form_builder::FormBuilder, styles::FormStyle};
|
||||
use leptos::{Signal, View};
|
||||
use std::{ops::RangeInclusive, rc::Rc};
|
||||
@ -39,10 +39,17 @@ impl ControlData for SliderData {
|
||||
impl<FD: FormToolData> FormBuilder<FD> {
|
||||
pub fn slider<FDT: Clone + PartialEq + 'static>(
|
||||
self,
|
||||
builder: impl BuilderFn<ControlBuilder<FD, SliderData, FDT>, FD::Context>,
|
||||
builder: impl BuilderFn<ControlBuilder<FD, SliderData, FDT>>,
|
||||
) -> Self {
|
||||
self.new_control(builder)
|
||||
}
|
||||
|
||||
pub fn slider_cx<FDT: Clone + PartialEq + 'static>(
|
||||
self,
|
||||
builder: impl BuilderCxFn<ControlBuilder<FD, SliderData, FDT>, FD::Context>,
|
||||
) -> Self {
|
||||
self.new_control_cx(builder)
|
||||
}
|
||||
}
|
||||
|
||||
impl<FD: FormToolData, FDT> ControlBuilder<FD, SliderData, FDT> {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
use super::{BuilderFn, ControlRenderData, VanityControlBuilder, VanityControlData};
|
||||
use super::{BuilderCxFn, BuilderFn, ControlRenderData, VanityControlBuilder, VanityControlData};
|
||||
use crate::{form::FormToolData, form_builder::FormBuilder, styles::FormStyle};
|
||||
use leptos::{prelude::Signal, View};
|
||||
use std::rc::Rc;
|
||||
@ -19,12 +19,16 @@ impl VanityControlData for SpacerData {
|
||||
}
|
||||
|
||||
impl<FD: FormToolData> FormBuilder<FD> {
|
||||
pub fn spacer(
|
||||
self,
|
||||
builder: impl BuilderFn<VanityControlBuilder<FD, SpacerData>, FD::Context>,
|
||||
) -> Self {
|
||||
pub fn spacer(self, builder: impl BuilderFn<VanityControlBuilder<FD, SpacerData>>) -> Self {
|
||||
self.new_vanity(builder)
|
||||
}
|
||||
|
||||
pub fn spacer_cx(
|
||||
self,
|
||||
builder: impl BuilderCxFn<VanityControlBuilder<FD, SpacerData>, FD::Context>,
|
||||
) -> Self {
|
||||
self.new_vanity_cx(builder)
|
||||
}
|
||||
}
|
||||
|
||||
impl<FD: FormToolData> VanityControlBuilder<FD, SpacerData> {
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
use super::{BuilderFn, ControlBuilder, ControlData, ControlRenderData, ValidatedControlData};
|
||||
use super::{
|
||||
BuilderCxFn, BuilderFn, ControlBuilder, ControlData, ControlRenderData, ValidatedControlData,
|
||||
};
|
||||
use crate::{form::FormToolData, form_builder::FormBuilder, styles::FormStyle};
|
||||
use leptos::{Signal, View};
|
||||
use std::{ops::RangeInclusive, rc::Rc};
|
||||
@ -30,10 +32,17 @@ impl ValidatedControlData for StepperData {}
|
||||
impl<FD: FormToolData> FormBuilder<FD> {
|
||||
pub fn stepper<FDT: Clone + PartialEq + 'static>(
|
||||
self,
|
||||
builder: impl BuilderFn<ControlBuilder<FD, StepperData, FDT>, FD::Context>,
|
||||
builder: impl BuilderFn<ControlBuilder<FD, StepperData, FDT>>,
|
||||
) -> Self {
|
||||
self.new_control(builder)
|
||||
}
|
||||
|
||||
pub fn stepper_cx<FDT: Clone + PartialEq + 'static>(
|
||||
self,
|
||||
builder: impl BuilderCxFn<ControlBuilder<FD, StepperData, FDT>, FD::Context>,
|
||||
) -> Self {
|
||||
self.new_control_cx(builder)
|
||||
}
|
||||
}
|
||||
|
||||
impl<FD: FormToolData, FDT> ControlBuilder<FD, StepperData, FDT> {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
use super::{BuilderFn, ControlRenderData, VanityControlBuilder, VanityControlData};
|
||||
use super::{BuilderCxFn, BuilderFn, ControlRenderData, VanityControlBuilder, VanityControlData};
|
||||
use crate::{form::FormToolData, form_builder::FormBuilder, styles::FormStyle};
|
||||
use leptos::{prelude::Signal, View};
|
||||
use std::rc::Rc;
|
||||
@ -19,12 +19,16 @@ impl VanityControlData for SubmitData {
|
||||
}
|
||||
|
||||
impl<FD: FormToolData> FormBuilder<FD> {
|
||||
pub fn submit(
|
||||
self,
|
||||
builder: impl BuilderFn<VanityControlBuilder<FD, SubmitData>, FD::Context>,
|
||||
) -> Self {
|
||||
pub fn submit(self, builder: impl BuilderFn<VanityControlBuilder<FD, SubmitData>>) -> Self {
|
||||
self.new_vanity(builder)
|
||||
}
|
||||
|
||||
pub fn submit_cx(
|
||||
self,
|
||||
builder: impl BuilderCxFn<VanityControlBuilder<FD, SubmitData>, FD::Context>,
|
||||
) -> Self {
|
||||
self.new_vanity_cx(builder)
|
||||
}
|
||||
}
|
||||
|
||||
impl<FD: FormToolData> VanityControlBuilder<FD, SubmitData> {
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
use super::{BuilderFn, ControlBuilder, ControlData, ControlRenderData, ValidatedControlData};
|
||||
use super::{
|
||||
BuilderCxFn, BuilderFn, ControlBuilder, ControlData, ControlRenderData, ValidatedControlData,
|
||||
};
|
||||
use crate::{form::FormToolData, form_builder::FormBuilder, styles::FormStyle};
|
||||
use leptos::{Signal, View};
|
||||
use std::rc::Rc;
|
||||
@ -27,10 +29,17 @@ impl ValidatedControlData for TextAreaData {}
|
||||
impl<FD: FormToolData> FormBuilder<FD> {
|
||||
pub fn text_area<FDT: Clone + PartialEq + 'static>(
|
||||
self,
|
||||
builder: impl BuilderFn<ControlBuilder<FD, TextAreaData, FDT>, FD::Context>,
|
||||
builder: impl BuilderFn<ControlBuilder<FD, TextAreaData, FDT>>,
|
||||
) -> Self {
|
||||
self.new_control(builder)
|
||||
}
|
||||
|
||||
pub fn text_area_cx<FDT: Clone + PartialEq + 'static>(
|
||||
self,
|
||||
builder: impl BuilderCxFn<ControlBuilder<FD, TextAreaData, FDT>, FD::Context>,
|
||||
) -> Self {
|
||||
self.new_control_cx(builder)
|
||||
}
|
||||
}
|
||||
|
||||
impl<FD: FormToolData, FDT> ControlBuilder<FD, TextAreaData, FDT> {
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
use std::rc::Rc;
|
||||
|
||||
use super::{BuilderFn, ControlBuilder, ControlData, ControlRenderData, ValidatedControlData};
|
||||
use super::{
|
||||
BuilderCxFn, BuilderFn, ControlBuilder, ControlData, ControlRenderData, ValidatedControlData,
|
||||
};
|
||||
use crate::{form::FormToolData, form_builder::FormBuilder, styles::FormStyle};
|
||||
use leptos::{Signal, View};
|
||||
use std::rc::Rc;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct TextInputData {
|
||||
@ -43,10 +44,17 @@ impl ValidatedControlData for TextInputData {}
|
||||
impl<FD: FormToolData> FormBuilder<FD> {
|
||||
pub fn text_input<FDT: Clone + PartialEq + 'static>(
|
||||
self,
|
||||
builder: impl BuilderFn<ControlBuilder<FD, TextInputData, FDT>, FD::Context>,
|
||||
builder: impl BuilderFn<ControlBuilder<FD, TextInputData, FDT>>,
|
||||
) -> Self {
|
||||
self.new_control(builder)
|
||||
}
|
||||
|
||||
pub fn text_input_cx<FDT: Clone + PartialEq + 'static>(
|
||||
self,
|
||||
builder: impl BuilderCxFn<ControlBuilder<FD, TextInputData, FDT>, FD::Context>,
|
||||
) -> Self {
|
||||
self.new_control_cx(builder)
|
||||
}
|
||||
}
|
||||
|
||||
impl<FD: FormToolData, FDT> ControlBuilder<FD, TextInputData, FDT> {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
controls::{
|
||||
BuilderFn, BuiltControlData, BuiltVanityControlData, ControlBuilder, ControlData,
|
||||
ControlRenderData, FieldSetter, ParseFn, RenderFn, ValidationCb, ValidationFn,
|
||||
BuilderCxFn, BuilderFn, BuiltControlData, BuiltVanityControlData, ControlBuilder,
|
||||
ControlData, ControlRenderData, FieldSetter, ParseFn, RenderFn, ValidationCb, ValidationFn,
|
||||
VanityControlBuilder, VanityControlData,
|
||||
},
|
||||
form::{Form, FormToolData, FormValidator},
|
||||
@ -63,7 +63,17 @@ impl<FD: FormToolData> FormBuilder<FD> {
|
||||
|
||||
pub(crate) fn new_vanity<C: VanityControlData + Default>(
|
||||
mut self,
|
||||
builder: impl BuilderFn<VanityControlBuilder<FD, C>, FD::Context>,
|
||||
builder: impl BuilderFn<VanityControlBuilder<FD, C>>,
|
||||
) -> Self {
|
||||
let vanity_builder = VanityControlBuilder::new(C::default());
|
||||
let control = builder(vanity_builder);
|
||||
self.add_vanity(control);
|
||||
self
|
||||
}
|
||||
|
||||
pub(crate) fn new_vanity_cx<C: VanityControlData + Default>(
|
||||
mut self,
|
||||
builder: impl BuilderCxFn<VanityControlBuilder<FD, C>, FD::Context>,
|
||||
) -> Self {
|
||||
let vanity_builder = VanityControlBuilder::new(C::default());
|
||||
let control = builder(vanity_builder, self.cx.clone());
|
||||
@ -73,7 +83,17 @@ impl<FD: FormToolData> FormBuilder<FD> {
|
||||
|
||||
pub(crate) fn new_control<C: ControlData + Default, FDT: Clone + PartialEq + 'static>(
|
||||
mut self,
|
||||
builder: impl BuilderFn<ControlBuilder<FD, C, FDT>, FD::Context>,
|
||||
builder: impl BuilderFn<ControlBuilder<FD, C, FDT>>,
|
||||
) -> Self {
|
||||
let control_builder = ControlBuilder::new(C::default());
|
||||
let control = builder(control_builder);
|
||||
self.add_control(control);
|
||||
self
|
||||
}
|
||||
|
||||
pub(crate) fn new_control_cx<C: ControlData + Default, FDT: Clone + PartialEq + 'static>(
|
||||
mut self,
|
||||
builder: impl BuilderCxFn<ControlBuilder<FD, C, FDT>, FD::Context>,
|
||||
) -> Self {
|
||||
let control_builder = ControlBuilder::new(C::default());
|
||||
let control = builder(control_builder, self.cx.clone());
|
||||
|
||||
Reference in New Issue
Block a user