@eturnity/eturnity_reusable_components 7.18.0-EPDM-10335.2 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "7.18.0-EPDM-10335.2",
3
+ "version": "7.18.0-EPDM-10335.4",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -94,6 +94,7 @@
94
94
  :labelDataId="filter.dataId"
95
95
  alignItems="vertical"
96
96
  :disabled="!filter.choices.length"
97
+ :minOptionLength="1"
97
98
  >
98
99
  <template #selector>
99
100
  <option-title> {{ filter.selectedText }} </option-title>
@@ -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 = isDropdownNotCompletelyVisible
647
- ? dropdownWrapperRelativeHeight
648
- : dropdownWrapperRelativeHeight -
649
- dropdownHeight -
650
- selectButtonHeight -
651
- DROPDOWN_TOP_OFFSET
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 (!this.$refs.dropdown) {
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 this.isSearchable && this.optionLength >= 5 && this.isDropdownOpen
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
@@ -16,6 +16,7 @@
16
16
  :disabledTextColor="disabledTextColor"
17
17
  :backgroundColor="colorMode == 'dark' ? '#000000' : backgroundColor"
18
18
  :title="hoverText"
19
+ :padding="padding"
19
20
  >
20
21
  <slot></slot>
21
22
  </optionContainer>
@@ -31,7 +32,8 @@ const optionProps = {
31
32
  cursorType: String,
32
33
  backgroundColor: String,
33
34
  disabledBgColor: String,
34
- disabledTextColor: String
35
+ disabledTextColor: String,
36
+ padding: String
35
37
  }
36
38
  const optionContainer = styled('div', optionProps)`
37
39
  display: flex;
@@ -39,7 +41,7 @@ const optionContainer = styled('div', optionProps)`
39
41
  flex-direction: row;
40
42
  justify-content: space-between;
41
43
  align-items: center;
42
- padding: 12px 10px;
44
+ padding: ${(props) => props.padding};
43
45
  gap: 14px;
44
46
  width: 100%;
45
47
  background-color: ${(props) =>
@@ -111,6 +113,10 @@ export default {
111
113
  disabledTextColor: {
112
114
  required: false,
113
115
  default: null
116
+ },
117
+ padding: {
118
+ required: false,
119
+ default: '12px 10px'
114
120
  }
115
121
  },
116
122