forked from 1b-agent/fieldcraft-upstream
ui: nonlinear load path as a table of fraction and factor
Kind::Points gains its columns, so a list of number rows other than [x, y, z] gets the same typed editor; the load path uses it (#449). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
1 parent
1c18a463e7
commit
61f0d42ec4
4 files changed
+50
-18
No files matched your search
@@ -4,7 +4,7 @@
|
||||
//! choices, so a definition is described by the same words as the form that edits it, never as
|
||||
//! its JSON.
|
||||
|
||||
use fieldcraft_engine::schema::{Field, Kind};
|
||||
use fieldcraft_engine::schema::{self, Field, Kind};
|
||||
use fieldcraft_model::{Model, UnitSystem};
|
||||
use serde_json::{Map, Value};
|
||||
|
||||
@@ -183,7 +183,9 @@ fn scalar(f: &Field, v: &Value, units: UnitSystem) -> String {
|
||||
Some(l) => crate::fields::format_labels(&l),
|
||||
None => crate::context::value_text(v),
|
||||
},
|
||||
Kind::Points { .. } => v.as_array().map_or_else(|| crate::context::value_text(v), |a| plural(a.len(), "point")),
|
||||
Kind::Points { columns, .. } => {
|
||||
v.as_array().map_or_else(|| crate::context::value_text(v), |a| plural(a.len(), if columns == schema::XYZ { "point" } else { "row" }))
|
||||
}
|
||||
Kind::Multi(options) => {
|
||||
list(v, |x| options.iter().find(|(o, _)| fieldcraft_engine::schema::multi_value(o) == *x).map(|(_, l)| (*l).to_string()))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user