gcanti / tcomb-form

Forms library for react
https://gcanti.github.io/tcomb-form
MIT License
1.16k stars 136 forks source link

templating: display nested children together with a parent element #425

Open compojoom opened 5 years ago

compojoom commented 5 years ago

I've been using tcomb-form quite a while and for the most part I love it. However I haven't been able to figure the following out. If I have the following model:

t.struct({
name: t.String,
views: {
item1: t.Boolean
},
acl: {
item1: {
read: t.Boolean,
write: t.Boolen
}
}
})

I would like to group views.item1 and act.item1 together in my template? Ideally I would have a structure like this

name
<div>
<h2>Settigns for item1</h2>
<label>can view</label
locals.views.item1

<label>ACL</label>
locals.input.acl.item1
</div>

Unfortunately this doesn't work. I can't access locals.views.item1 -> I have only access to locals.view from the parent template function. Is there a way to achieve the above or should I give up on this?