pub struct CategoryFormState {
pub name_input: TextInput,
pub selected_group_index: usize,
pub groups: Vec<(CategoryGroupId, String)>,
pub focused_field: CategoryField,
pub error_message: Option<String>,
pub editing_id: Option<CategoryId>,
}Expand description
State for the category form dialog
Fields§
§name_input: TextInputName input
selected_group_index: usizeSelected group index
groups: Vec<(CategoryGroupId, String)>Available groups (cached)
focused_field: CategoryFieldCurrently focused field
error_message: Option<String>Error message to display
editing_id: Option<CategoryId>Category ID being edited (None for new category)
Implementations§
Source§impl CategoryFormState
impl CategoryFormState
Sourcepub fn init_with_groups(&mut self, groups: Vec<(CategoryGroupId, String)>)
pub fn init_with_groups(&mut self, groups: Vec<(CategoryGroupId, String)>)
Initialize the form with available groups
Sourcepub fn init_for_edit(
&mut self,
category: &Category,
groups: Vec<(CategoryGroupId, String)>,
)
pub fn init_for_edit( &mut self, category: &Category, groups: Vec<(CategoryGroupId, String)>, )
Initialize the form for editing an existing category
Sourcepub fn set_focus(&mut self, field: CategoryField)
pub fn set_focus(&mut self, field: CategoryField)
Set the focused field
Sourcepub fn next_field(&mut self)
pub fn next_field(&mut self)
Move to next field
Sourcepub fn prev_field(&mut self)
pub fn prev_field(&mut self)
Move to previous field
Sourcepub fn next_group(&mut self)
pub fn next_group(&mut self)
Select next group
Sourcepub fn prev_group(&mut self)
pub fn prev_group(&mut self)
Select previous group
Sourcepub fn selected_group_id(&self) -> Option<CategoryGroupId>
pub fn selected_group_id(&self) -> Option<CategoryGroupId>
Get selected group ID
Sourcepub fn selected_group_name(&self) -> Option<&str>
pub fn selected_group_name(&self) -> Option<&str>
Get selected group name
Sourcepub fn build_category(&self) -> Result<Category, String>
pub fn build_category(&self) -> Result<Category, String>
Build a Category from the form state
Sourcepub fn clear_error(&mut self)
pub fn clear_error(&mut self)
Clear any error message
Trait Implementations§
Source§impl Clone for CategoryFormState
impl Clone for CategoryFormState
Source§fn clone(&self) -> CategoryFormState
fn clone(&self) -> CategoryFormState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CategoryFormState
impl Debug for CategoryFormState
Auto Trait Implementations§
impl Freeze for CategoryFormState
impl RefUnwindSafe for CategoryFormState
impl Send for CategoryFormState
impl Sync for CategoryFormState
impl Unpin for CategoryFormState
impl UnwindSafe for CategoryFormState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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