1-dimensional repeater web component
npm install ib-idhtml
- Head Item
- ...
- Footer Item
id=li-gen
list='["hello", "world"]',
transform='{"li": "."}'
>
`
Generates:
`html
- Head Item
- hello
- world
- Footer
id=li-gen
list='["hello", "world"]',
transform='{"li": "."}'
>
`
Syntax Example II -- Updatable, template free
`html
- Head Item
- ...
- Footer Item
id=li-gen
list='["hello", "world"]'
transform='{"li": ["."]}'
updatable>
`
Generates:
`html
- Head Item
- hello
- world
- Footer
`
So the only difference is the presence of the updatable attribute. The presence of that attribute helps to provide master / detail binding, and also is required for nested ibid's.
Syntax Example III -- multiple elements per iteration. Use of template
`html
- Definition
- Meaning of the word
list='[{"term": "nah", "def": "not so"}, {"term":"goo", "def": "a viscid or sticky substance"}]'
updatable
transform='
{
"dtElements": ["term"],
"ddElements": ["def"]
}
'
>
`
generates
`html
- Definition
- Meaning of the word
- nah
- not so
- goo
- a viscid or sticky substance
`
Syntax Example IV -- Nested ibid's. Use of relative locator
`html
-
-
updatable
list='[
{"description": "first item", "innerList": [{"name": "a"}, {"name": "b"}]},
{"description": "second item", "innerList": [{"name": "c"}, {"name": "b"}]}
]
'
transform='{".description": "description"}'
from-previous=ul
search-for=template
>
`
In examples I and II, we demonstrated that wrapping the content that needs to repeat in a template is optional. Example III showed use of the template wrapper.
However, if nested ibid's are required, then wrapping outer ibid's in templates becomes required. The outer ibid's also have to have updatable set.
Note also our use of from-previous, search-for attributes. These allow for an alternative to specifying the id's.
Syntax Example V -- tag-list
`html
`
Generates
`html
hello 1
hello 2
`
Syntax Example VI -- Enumerated template options [TODO]
`html
templ-match-on=type
transform='
"searchbox":{
},
"grid":{
}
'
updatable>
`
generates
`html
``