Description
This issue will look at crafting a useValue
Lumina controller that will handle getting and setting value
properties for Calcite form components. There are many form components that are duplicating a lot of the same logic for managing the currently stored value, the previously emitted value, and managing whether or not the value changed as the result of a user interaction via keyboard or mouse vs. direct value changes that happen via javascript (setting the .value
property directly, usually on initial mount or as part of something like a form reset).
This new useValue
controller will handle all of this for any form component, and will be able to be tested in isolation so that all form components can consistently handle value change event emitting in the proper way.
List of components that can potentially benefit from a useValue
controller:
-
autocomplete
-
checkbox
-
combobox
-
input
-
input-date-picker
-
input-number
-
input-text
-
input-time-picker
-
input-time-zone
-
meter
-
radio-button
-
rating
-
segmented-control
-
select
-
slider
-
switch
-
text-area
-
time-picker
Putting a note in here to remind us to look at this. The idea is that we can create a Controller to handle
value
setting functionality, such as ensuring that change events only fire when a) the user interacts with the form component resulting in b) the value actually changing from the prior emitted value. This controller would be able to differentiate between direct value changes made from code, such as onhostConnected
or as the result of another property changing that affects the value.
Originally posted by @eriklharper in #11305