haya-select 1.0.56 → 1.0.57
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 +6 -4
package/package.json
CHANGED
package/src/select/index.jsx
CHANGED
|
@@ -145,9 +145,9 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
|
|
|
145
145
|
getValues = () => ("values" in this.props) ? this.p.values : this.s.currentOptions.map((currentOption) => currentOption.value)
|
|
146
146
|
getCurrentOptions = () => {
|
|
147
147
|
if ("values" in this.props && typeof this.props.values != "undefined") {
|
|
148
|
-
if (Array.isArray(this.props.options)) {
|
|
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) {
|
|
150
|
+
} else if (this.s.loadedOptions && this.props.values) {
|
|
151
151
|
return this.p.values.map((value) => {
|
|
152
152
|
let foundOption = this.s.loadedOptions.find((option) => option.value == value)
|
|
153
153
|
|
|
@@ -164,9 +164,9 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
|
|
|
164
164
|
|
|
165
165
|
return foundOption
|
|
166
166
|
})
|
|
167
|
-
} else if (typeof this.props.options == "function") {
|
|
167
|
+
} else if (typeof this.props.options == "function" && this.props.values) {
|
|
168
168
|
this.setCurrentFromGivenValues()
|
|
169
|
-
} else {
|
|
169
|
+
} else if (this.props.values) {
|
|
170
170
|
return this.p.values.map((value) => ({value}))
|
|
171
171
|
}
|
|
172
172
|
}
|
|
@@ -795,6 +795,8 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
|
|
|
795
795
|
const currentValues = currentOptions?.map((currentOption) => currentOption.value)
|
|
796
796
|
const stateValues = this.s.currentOptions?.map((currentOption) => currentOption.value)
|
|
797
797
|
|
|
798
|
+
console.log("setCurrentFromGivenValues", {stateValues})
|
|
799
|
+
|
|
798
800
|
if (anythingDifferent(currentValues, stateValues)) {
|
|
799
801
|
this.setState({currentOptions})
|
|
800
802
|
}
|