haya-select 1.0.44 → 1.0.45
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 +1 -1
- package/src/select/index.jsx +7 -5
package/package.json
CHANGED
package/src/select/index.jsx
CHANGED
|
@@ -126,7 +126,9 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
|
|
|
126
126
|
getValues = () => ("values" in this.props) ? this.p.values : this.s.currentOptions.map((currentOption) => currentOption.value)
|
|
127
127
|
getCurrentOptions = () => {
|
|
128
128
|
if ("values" in this.props && typeof this.props.values != "undefined") {
|
|
129
|
-
if (
|
|
129
|
+
if (Array.isArray(this.props.options)) {
|
|
130
|
+
return this.p.values.map((value) => this.p.options.find((option) => option.value == value))
|
|
131
|
+
} else if (this.s.loadedOptions || typeof this.props.options == "function" && this.props.values) {
|
|
130
132
|
if (this.s.loadedOptions) {
|
|
131
133
|
const result = this.p.values.map((value) => {
|
|
132
134
|
let foundOption = this.s.loadedOptions.find((option) => option.value == value)
|
|
@@ -135,7 +137,10 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
|
|
|
135
137
|
foundOption = this.s.currentOptions.find((option) => option.value == value)
|
|
136
138
|
|
|
137
139
|
if (!foundOption) {
|
|
138
|
-
|
|
140
|
+
console.error(
|
|
141
|
+
`Couldn't find option: ${value} in loadedOptions or state currentOptions`,
|
|
142
|
+
{stateLoadedOptions: this.s.loadedOptions, stateCurrentOptions: this.s.currentOptions, propsOptions: this.props.options}
|
|
143
|
+
)
|
|
139
144
|
}
|
|
140
145
|
}
|
|
141
146
|
|
|
@@ -146,8 +151,6 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
|
|
|
146
151
|
} else {
|
|
147
152
|
this.setCurrentFromGivenValues()
|
|
148
153
|
}
|
|
149
|
-
} else if (Array.isArray(this.props.options)) {
|
|
150
|
-
return this.p.values.map((value) => this.p.options.find((option) => option.value == value))
|
|
151
154
|
} else {
|
|
152
155
|
return this.p.values.map((value) => ({value}))
|
|
153
156
|
}
|
|
@@ -635,7 +638,6 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
|
|
|
635
638
|
|
|
636
639
|
if (toggleOptions) {
|
|
637
640
|
// Set fresh toggle
|
|
638
|
-
|
|
639
641
|
newToggled[loadedOption.value] = toggleOptions[0].value
|
|
640
642
|
newState.toggled = newToggled
|
|
641
643
|
}
|