haya-select 1.0.47 → 1.0.48

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haya-select",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -147,29 +147,25 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
147
147
  if ("values" in this.props && typeof this.props.values != "undefined") {
148
148
  if (Array.isArray(this.props.options) && this.props.values) {
149
149
  return this.p.values.map((value) => this.p.options.find((option) => option.value == value))
150
- } else if (this.s.loadedOptions || typeof this.props.options == "function" && this.props.values) {
151
- if (this.s.loadedOptions) {
152
- const result = this.p.values.map((value) => {
153
- let foundOption = this.s.loadedOptions.find((option) => option.value == value)
150
+ } else if (this.s.loadedOptions && this.props.values) {
151
+ return this.p.values.map((value) => {
152
+ let foundOption = this.s.loadedOptions.find((option) => option.value == value)
154
153
 
155
- if (!foundOption) {
156
- foundOption = this.s.currentOptions.find((option) => option.value == value)
154
+ if (!foundOption) {
155
+ foundOption = this.s.currentOptions.find((option) => option.value == value)
157
156
 
158
- if (!foundOption) {
159
- console.error(
160
- `Couldn't find option: ${value} in loadedOptions or state currentOptions`,
161
- {stateLoadedOptions: this.s.loadedOptions, stateCurrentOptions: this.s.currentOptions, propsOptions: this.props.options}
162
- )
163
- }
157
+ if (!foundOption) {
158
+ console.error(
159
+ `Couldn't find option: ${value} in loadedOptions or state currentOptions`,
160
+ {stateLoadedOptions: this.s.loadedOptions, stateCurrentOptions: this.s.currentOptions, propsOptions: this.props.options}
161
+ )
164
162
  }
163
+ }
165
164
 
166
- return foundOption
167
- })
168
-
169
- return result
170
- } else {
171
- this.setCurrentFromGivenValues()
172
- }
165
+ return foundOption
166
+ })
167
+ } else if (this.props.options == "function" && this.props.values) {
168
+ this.setCurrentFromGivenValues()
173
169
  } else if (this.props.values) {
174
170
  return this.p.values.map((value) => ({value}))
175
171
  }