Expand description
CSV/TSV import/export wizard: form state + pure spec-building for the GUI
panel (rendered by ImprovApp::csv_import_ui/csv_export_ui in app.rs).
Mirrors the CLI’s import-csv/export-csv semantics (delimiter
auto-detected from the .tsv extension unless overridden; item_id_base
set high enough to avoid colliding with hand-assigned ids — see
crates/cli/src/main.rs::cmd_import_csv/cmd_export_csv) so the wizard
behaves exactly like improv import-csv/export-csv.
Kept free of any egui::Ui parameter so build_import_spec/
build_export_args/detect_delimiter are unit-tested without a window;
the actual widgets live in app.rs, which owns ImprovApp’s state.
Structs§
- DimRow
- One dimension-mapping row in the import form: a CSV/TSV column, and the
category it becomes (id + name). All three fields are free text, parsed on
submit by
build_import_spec. - Export
Form - The export wizard’s form state.
- Import
Form - The import wizard’s editable form state. Mirrors the CLI’s
import-csvarguments (seecrates/cli/src/main.rs::cmd_import_csv).
Constants§
- ITEM_
ID_ 🔒BASE - Base id for minting item ids on import — high enough to avoid colliding
with hand-assigned ids (matches the CLI’s
cmd_import_csv).
Functions§
- build_
export_ args - Resolve the export form into
(measure, path, delimiter). Pure: no egui, no I/O;improv_storage_csv::export_measure_csvdoes the real work. - build_
import_ spec - Build an
ImportSpecfrom the wizard’s form fields. Validates as the CLI does: a non-empty path, a numeric measure id, a non-empty measure name and value column, and at least one fully-filled dimension row (a blank spacer row — all three fields empty — is skipped, not an error). Pure: no egui, no I/O;improv_storage_csv::import_csvdoes the real work. - column_
ref 🔒 - A column reference: a 0-based index when there’s no header row, else a
header name (mirrors the CLI’s
col_refclosure). - detect_
delimiter - The delimiter for
path: TSV iftsv_checkedor the path ends in.tsv, else CSV. Matches the CLI’s--tsv/extension convention exactly.