sdxmessaging / ui-widgets

Build powerful form inputs/outputs with mithril and streams.
MIT License
4 stars 1 forks source link

`CheckList` -> Number/Boolean Option Values #146

Closed MichaelPastuch closed 1 year ago

MichaelPastuch commented 1 year ago

If a CheckList option value is not a string, the component does not properly reflect a single selection in its "placeholder" area. The internal options Set is intended to store string values only, and there are several places where values are converted to strings while the option values are TProp.

Can we support number/boolean types for option values within the CheckList internal properties and methods? Should we convert the option values to string when attempting to find a single match?

MichaelPastuch commented 1 year ago

Option values were being compared against string values stored in an internal Set and from the stream, which is a joined string of all selected options. To keep things simple, the option values are also converted to strings for comparison purposes.

I've added a note to the ui-widgets example page warning against mixing string/number/boolean option values. Undefined behaviour could happen with different values that would produce the same strings.