haya-select 1.0.54 → 1.0.56
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 +12 -10
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)) {
|
|
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) {
|
|
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 (this.props.options == "function"
|
|
167
|
+
} else if (typeof this.props.options == "function") {
|
|
168
168
|
this.setCurrentFromGivenValues()
|
|
169
|
-
} else
|
|
169
|
+
} else {
|
|
170
170
|
return this.p.values.map((value) => ({value}))
|
|
171
171
|
}
|
|
172
172
|
}
|
|
@@ -575,7 +575,7 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
|
|
|
575
575
|
const {selectContainerLayout, loadedOptions, endOfSelectLayout, optionsContainerLayout, optionsPlacement, optionsVisibility} = this.s
|
|
576
576
|
let left, top
|
|
577
577
|
|
|
578
|
-
|
|
578
|
+
let style = {
|
|
579
579
|
position: "absolute",
|
|
580
580
|
zIndex: 99999,
|
|
581
581
|
elevation: 99999,
|
|
@@ -585,7 +585,7 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
|
|
|
585
585
|
border: "1px solid #999",
|
|
586
586
|
maxHeight: 300,
|
|
587
587
|
overflowY: "auto"
|
|
588
|
-
}
|
|
588
|
+
}
|
|
589
589
|
|
|
590
590
|
if (!optionsAbsolute) {
|
|
591
591
|
style.left = 0
|
|
@@ -593,10 +593,10 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
|
|
|
593
593
|
} else if (optionsPlacement == "below") {
|
|
594
594
|
if (Platform.OS == "web") {
|
|
595
595
|
// onLayout top value is sometimes negative so use browser JS to get it instead
|
|
596
|
-
top = digg(this.tt.endOfSelectRef.current.getBoundingClientRect(), "top") + document.documentElement.scrollTop +
|
|
596
|
+
top = digg(this.tt.endOfSelectRef.current.getBoundingClientRect(), "top") + document.documentElement.scrollTop + 1
|
|
597
597
|
|
|
598
598
|
// onLayout left values doesn't always update when changed
|
|
599
|
-
left = digg(this.tt.endOfSelectRef.current.getBoundingClientRect(), "left") + document.documentElement.scrollLeft
|
|
599
|
+
left = digg(this.tt.endOfSelectRef.current.getBoundingClientRect(), "left") + document.documentElement.scrollLeft
|
|
600
600
|
} else {
|
|
601
601
|
left = this.s.endOfSelectLayout.left
|
|
602
602
|
top = selectContainerLayout.top
|
|
@@ -607,10 +607,10 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
|
|
|
607
607
|
} else if (optionsPlacement == "above") {
|
|
608
608
|
if (Platform.OS == "web") {
|
|
609
609
|
// onLayout top value is sometimes negative so use browser JS to get it instead
|
|
610
|
-
top = digg(this.tt.selectContainerRef.current.getBoundingClientRect(), "top") + document.documentElement.scrollTop
|
|
610
|
+
top = digg(this.tt.selectContainerRef.current.getBoundingClientRect(), "top") + document.documentElement.scrollTop
|
|
611
611
|
|
|
612
612
|
// onLayout left values doesn't always update when changed
|
|
613
|
-
left = digg(this.tt.selectContainerRef.current.getBoundingClientRect(), "left") + document.documentElement.scrollLeft
|
|
613
|
+
left = digg(this.tt.selectContainerRef.current.getBoundingClientRect(), "left") + document.documentElement.scrollLeft
|
|
614
614
|
} else {
|
|
615
615
|
left = endOfSelectLayout.left
|
|
616
616
|
top = selectContainerLayout.top
|
|
@@ -622,6 +622,8 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
|
|
|
622
622
|
throw new Error(`Unkonwn options placement: ${optionsPlacement}`)
|
|
623
623
|
}
|
|
624
624
|
|
|
625
|
+
style = this.stylingFor("optionsContainer", style)
|
|
626
|
+
|
|
625
627
|
return (
|
|
626
628
|
<View
|
|
627
629
|
dataSet={{class: "options-container", id: idForComponent(this)}}
|