small tweaks

This commit is contained in:
Mitchell Marino 2024-06-19 09:39:51 -05:00
parent 7c4e3b162d
commit c7c98f985f
2 changed files with 2 additions and 6 deletions

View File

@ -11,12 +11,9 @@ impl<FD: FormToolData> FormBuilder<FD> {
/// This creates a subsection of the form that controls can be added to /// This creates a subsection of the form that controls can be added to
/// like a normal form. /// like a normal form.
pub fn group(mut self, builder: impl Fn(FormBuilder<FD>) -> FormBuilder<FD>) -> Self { pub fn group(mut self, builder: impl Fn(FormBuilder<FD>) -> FormBuilder<FD>) -> Self {
let mut group_builder = FormBuilder::new_group(self.cx); let mut group_builder = FormBuilder::new_group(self.cx.clone());
group_builder = builder(group_builder); group_builder = builder(group_builder);
// Take context back
self.cx = group_builder.cx;
for validation in group_builder.validations { for validation in group_builder.validations {
self.validations.push(validation); self.validations.push(validation);
} }
@ -34,7 +31,6 @@ impl<FD: FormToolData> FormBuilder<FD> {
}); });
let view = fs.group(render_data.clone()); let view = fs.group(render_data.clone());
// TODO: add conditional rendering
let validation_cb = move || { let validation_cb = move || {
let mut success = true; let mut success = true;

View File

@ -25,7 +25,7 @@ pub struct FormBuilder<FD: FormToolData> {
pub(crate) validations: Vec<Rc<dyn ValidationFn<FD>>>, pub(crate) validations: Vec<Rc<dyn ValidationFn<FD>>>,
/// The list of functions that will render the form. /// The list of functions that will render the form.
pub(crate) render_fns: Vec<Box<dyn RenderFn<FD::Style, FD>>>, pub(crate) render_fns: Vec<Box<dyn RenderFn<FD::Style, FD>>>,
/// The list of styling attributes applied on the form level /// The list of styling attributes applied on the form level.
pub(crate) styles: Vec<<FD::Style as FormStyle>::StylingAttributes>, pub(crate) styles: Vec<<FD::Style as FormStyle>::StylingAttributes>,
} }