@xy-planning-network/trees 0.9.7 → 0.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -26,8 +26,17 @@ const {
|
|
|
26
26
|
} = useInputField(props)
|
|
27
27
|
|
|
28
28
|
const onChange = (e: Event) => {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
// NOTE(spk): The selectedIndex references the list of options in tree order
|
|
30
|
+
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-selectedindex
|
|
31
|
+
const selectedIndex = (e.target as HTMLSelectElement).selectedIndex
|
|
32
|
+
|
|
33
|
+
// NOTE(spk): we disable the 0 index option in the list, so there's
|
|
34
|
+
// no expectation it will trigger a change event. Likewise, dynamic updates to
|
|
35
|
+
// a modelValue prop in a parent do not trigger the change event.
|
|
36
|
+
if (selectedIndex > 0) {
|
|
37
|
+
modelState.value = props.options[selectedIndex - 1].value
|
|
38
|
+
validate(e)
|
|
39
|
+
}
|
|
31
40
|
}
|
|
32
41
|
</script>
|
|
33
42
|
|