@eturnity/eturnity_reusable_components 7.18.0-EPDM-10335.3 → 7.18.0-EPDM-10335.4
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
@@ -350,6 +350,12 @@ const InputWrapper = styled('div', inputAttrs)`
|
|
350
350
|
|
351
351
|
const DROPDOWN_HEIGHT_OFFSET = 4
|
352
352
|
const DROPDOWN_TOP_OFFSET = 21
|
353
|
+
const MIN_OPTION_LENGTH = 5
|
354
|
+
|
355
|
+
const DROPDOWN_MENU_POSITIONS = {
|
356
|
+
Automatic: 'automatic',
|
357
|
+
Bottom: 'bottom'
|
358
|
+
}
|
353
359
|
|
354
360
|
export default {
|
355
361
|
name: 'RCselect',
|
@@ -469,6 +475,14 @@ export default {
|
|
469
475
|
isDraggable: {
|
470
476
|
type: Boolean,
|
471
477
|
default: false
|
478
|
+
},
|
479
|
+
minOptionLength: {
|
480
|
+
type: Number,
|
481
|
+
default: MIN_OPTION_LENGTH
|
482
|
+
},
|
483
|
+
dropdownMenuPosition: {
|
484
|
+
type: String,
|
485
|
+
default: DROPDOWN_MENU_POSITIONS.Automatic // options: ['automatic', bottom]
|
472
486
|
}
|
473
487
|
},
|
474
488
|
|
@@ -643,12 +657,15 @@ export default {
|
|
643
657
|
window.scrollY +
|
644
658
|
DROPDOWN_HEIGHT_OFFSET
|
645
659
|
|
646
|
-
const top =
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
660
|
+
const top =
|
661
|
+
isDropdownNotCompletelyVisible ||
|
662
|
+
(!isDropdownNotCompletelyVisible &&
|
663
|
+
this.dropdownMenuPosition === DROPDOWN_MENU_POSITIONS.Bottom)
|
664
|
+
? dropdownWrapperRelativeHeight
|
665
|
+
: dropdownWrapperRelativeHeight -
|
666
|
+
dropdownHeight -
|
667
|
+
selectButtonHeight -
|
668
|
+
DROPDOWN_TOP_OFFSET
|
652
669
|
const left = this.dropdownPosition.left
|
653
670
|
? this.dropdownPosition.left
|
654
671
|
: dropdownWrapperEl.getBoundingClientRect().left + window.scrollX
|
@@ -658,9 +675,13 @@ export default {
|
|
658
675
|
return isDropdownNotCompletelyVisible
|
659
676
|
},
|
660
677
|
async isBottomOfDropdownOutOfViewport() {
|
661
|
-
if (
|
678
|
+
if (
|
679
|
+
!this.$refs.dropdown ||
|
680
|
+
this.dropdownMenuPosition === DROPDOWN_MENU_POSITIONS.Bottom
|
681
|
+
) {
|
662
682
|
return false
|
663
683
|
}
|
684
|
+
|
664
685
|
await this.$nextTick()
|
665
686
|
const rect = this.$refs.dropdown.$el.getBoundingClientRect()
|
666
687
|
const windowHeight =
|
@@ -730,7 +751,11 @@ export default {
|
|
730
751
|
return 0
|
731
752
|
},
|
732
753
|
isSearchBarVisible() {
|
733
|
-
return
|
754
|
+
return (
|
755
|
+
this.isSearchable &&
|
756
|
+
this.optionLength >= this.minOptionLength &&
|
757
|
+
this.isDropdownOpen
|
758
|
+
)
|
734
759
|
},
|
735
760
|
getOptionWidth() {
|
736
761
|
if (this.optionWidth) return this.optionWidth
|