Keenmate. WebMultiselect. OptionHelpers
(Keenmate.WebMultiselect v1.0.0-rc.2)
Copy Markdown
View Source
Converts the Components.web_multiselect/1 assigns into a map of HTML attributes
shaped the way <web-multiselect> expects them.
Summary
Functions
Encodes an options list into the JSON shape <web-multiselect> reads from its
options attribute.
Builds the map of HTML attributes for the underlying <web-multiselect> element.
Functions
Encodes an options list into the JSON shape <web-multiselect> reads from its
options attribute.
Accepts:
[{value, label}, ...]tuple lists,[%{value: ..., label: ...}, ...]maps (extra keys preserved),- any list — passed through to
Jason.encode!/1as-is.
Builds the map of HTML attributes for the underlying <web-multiselect> element.
- Drops keys whose value is
nil. - Renames
snake_casekeys tokebab-case. - Renders booleans as explicit
"true"/"false"strings (the upstream component expectsmultiple="false", not a missing attribute). - Encodes
optionsandinitial_valuesas JSON.