pub struct Form {
pub fields: Vec<Field>,
pub focus: usize,
pub kind: FormKind,
pub entity_id: Option<String>,
}Expand description
A generic multi-field input form.
Fields§
§fields: Vec<Field>§focus: usizeIndex of the currently focused field. Always < fields.len().
kind: FormKind§entity_id: Option<String>Entity id for tag forms; None for all other kinds.
Implementations§
Source§impl Form
impl Form
Sourcepub fn config_set(name: Editor, value: Editor) -> Self
pub fn config_set(name: Editor, value: Editor) -> Self
Two-field form for the config set command.
Sourcepub fn report_params(
from: Editor,
to: Editor,
chart: Editor,
kind: ReportKind,
) -> Self
pub fn report_params( from: Editor, to: Editor, chart: Editor, kind: ReportKind, ) -> Self
Three-field form for the reports activity/breakdown commands.
Sourcepub fn commodity_create(mode: EditMode) -> Self
pub fn commodity_create(mode: EditMode) -> Self
Two-field form for commodity create (symbol required, name required).
Sourcepub fn commodity_convert(mode: EditMode) -> Self
pub fn commodity_convert(mode: EditMode) -> Self
Three-field form for commodity conversion: amount, from-commodity, to-commodity.
The two Select fields are empty on construction; call
fetch_commodity_convert_form_options to populate them asynchronously.
Sourcepub fn account_create(mode: EditMode, parent_options: Vec<SelectOption>) -> Self
pub fn account_create(mode: EditMode, parent_options: Vec<SelectOption>) -> Self
Two-field form for account create (name required, parent Select optional).
parent_options seeds the parent Select; include a leading (none) entry
with empty id so “no parent” is the default.
Sourcepub fn transaction_create(mode: EditMode) -> Self
pub fn transaction_create(mode: EditMode) -> Self
Three-field form for transaction create: date, note, splits.
Sourcepub fn transaction_edit(mode: EditMode, et: &EditableTransaction) -> Self
pub fn transaction_edit(mode: EditMode, et: &EditableTransaction) -> Self
Three-field form for editing an existing transaction, pre-filled from et.
Each split row’s Selects start with a single-entry list holding the stored
uuid as both id and label; after the async fetch_transaction_form_options
reply arrives, set_account_options / set_commodity_options replace the
lists while set_options_preserving_id keeps the stored selection.
Sourcepub fn account_tag(mode: EditMode, account_id: String) -> Self
pub fn account_tag(mode: EditMode, account_id: String) -> Self
Two-field form for set-account-tag: tag name (required) and value.
The account_id is stored in entity_id and used at validation time.
Sourcepub fn transaction_tag(mode: EditMode, transaction_id: String) -> Self
pub fn transaction_tag(mode: EditMode, transaction_id: String) -> Self
Two-field form for set-transaction-tag: tag name (required) and value.
The transaction_id is stored in entity_id and used at validation time.
Sourcepub fn focused_field_mut(&mut self) -> Option<&mut Field>
pub fn focused_field_mut(&mut self) -> Option<&mut Field>
Mutable reference to the currently focused field, if any.
Sourcepub fn focused_editor_mut(&mut self) -> Option<&mut Editor>
pub fn focused_editor_mut(&mut self) -> Option<&mut Editor>
Mutable reference to the inner Editor of the focused field.
Returns None when the form is empty or the focused widget is not
Text, Amount, or Date (i.e. a Select or Splits).
Sourcepub fn focused_widget_kind(&self) -> Option<WidgetKind>
pub fn focused_widget_kind(&self) -> Option<WidgetKind>
Widget kind of the focused field, or None when the form is empty.
Sourcepub fn focused_splits_sub_kind(&self) -> Option<WidgetKind>
pub fn focused_splits_sub_kind(&self) -> Option<WidgetKind>
When the focused field is a Splits widget, returns the kind of its focused sub-widget (for nested widget-first key routing).
Sourcepub fn focused_splits_boundary(&self) -> Option<(bool, bool)>
pub fn focused_splits_boundary(&self) -> Option<(bool, bool)>
When the focused field is a Splits widget, returns (at_first_cell, at_last_cell) so the key layer can yield Tab/BackTab to the outer
field cycle at the editor’s boundaries.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Form
impl RefUnwindSafe for Form
impl Send for Form
impl Sync for Form
impl Unpin for Form
impl UnsafeUnpin for Form
impl UnwindSafe for Form
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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