22namespace morph::forms {
34 : _session{&
session}, _state{&
state}, _options{std::move(options)} {}
38 [[nodiscard]]
FieldSpec const&
spec() const noexcept {
return _state->spec(); }
55 std::shared_ptr<FormViewOptions const> _options;
72 _byField.insert_or_assign(std::move(path), std::move(render));
81 _byWidget.insert_or_assign(std::move(hint), std::move(render));
90 _byUnit.insert_or_assign(std::move(unit), std::move(render));
99 _byKind.insert_or_assign(kind, std::move(render));
107 if (
auto const found = _byField.find(spec.
path); found != _byField.end()) {
108 return &found->second;
110 if (!spec.
widget.empty()) {
111 if (
auto const found = _byWidget.find(spec.
widget); found != _byWidget.end()) {
112 return &found->second;
116 if (
auto const found = _byUnit.find(spec.
unitAscii); found != _byUnit.end()) {
117 return &found->second;
120 if (
auto const found = _byKind.find(spec.
kind); found != _byKind.end()) {
121 return &found->second;
127 std::map<std::string, Render, std::less<>> _byField;
128 std::map<std::string, Render, std::less<>> _byWidget;
129 std::map<std::string, Render, std::less<>> _byUnit;
130 std::map<FieldKind, Render> _byKind;
FormModel: the immutable runtime model of one action's form, read from the schema JSON schemaJson<A>(...
FieldKind
The control a field gets, which the JSON type alone does not say.
The toolkit-agnostic view tree: props, node kinds and their builders.
std::shared_ptr< NodeData const > Node
A view-tree node: immutable, shared data.