@eturnity/eturnity_reusable_components 7.8.2-EPDM-7779.0 → 7.8.2-EPDM-7779.1

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.8.2-EPDM-7779.0",
3
+ "version": "7.8.2-EPDM-7779.1",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -63,7 +63,7 @@
63
63
  @input-change="searchChange"
64
64
  @click.native.stop
65
65
  />
66
- <selector :selectWidth="selectWidth" v-else>
66
+ <selector :selectWidth="selectorWidth" v-else>
67
67
  <slot name="selector" :selectedValue="selectedValue"></slot>
68
68
  </selector>
69
69
  <Caret @click.stop="toggleCaretDropdown">
@@ -142,12 +142,15 @@ import InfoText from '../../infoText'
142
142
  import icon from '../../icon'
143
143
  import inputText from '../inputText'
144
144
 
145
+ const CARET_WIDTH = 30
146
+ const ELLIPSIS_WIDTH = 16
147
+
145
148
  const Caret = styled.div`
146
149
  display: flex;
147
150
  align-items: center;
148
151
  justify-content: center;
149
- width: 30px;
150
- min-width: 30px;
152
+ width: ${CARET_WIDTH}px;
153
+ min-width: ${CARET_WIDTH}px;
151
154
  height: 100%;
152
155
  align-items: stretch
153
156
  cursor: pointer;
@@ -155,10 +158,7 @@ const Caret = styled.div`
155
158
  `
156
159
 
157
160
  const Selector = styled('div', { selectWidth: String })`
158
- max-width: ${(props) =>
159
- props.selectWidth
160
- ? props.selectWidth
161
- : '100%'}; // set to same width as the select
161
+ max-width: ${(props) => props.selectWidth};
162
162
  white-space: nowrap;
163
163
  text-overflow: ellipsis;
164
164
  overflow: hidden;
@@ -552,26 +552,27 @@ export default {
552
552
  this.$refs.dropdown.$el.scrollTop = topPos
553
553
  }
554
554
  }
555
+ },
556
+ clearSearch() {
557
+ this.textSearch = ''
555
558
  }
556
559
  },
557
560
  computed: {
558
561
  optionLength() {
559
562
  if (this.isDropdownOpen) {
560
- // this filterRef is needed to check for the # of children on Filter dropdowns
561
- const filterRef =
562
- this.$refs.dropdown.$children &&
563
- this.$refs.dropdown.$children.length > 1
564
- ? this.$refs.dropdown.$children
565
- : this.$refs.dropdown.$children[0].$children
566
- ? this.$refs.dropdown.$children[0].$children
567
- : this.$refs.dropdown.$children
568
- return filterRef.length
569
- } else {
570
- return 0
563
+ return this.$refs.dropdown.$el.childElementCount
571
564
  }
565
+
566
+ return 0
572
567
  },
573
568
  isSearchBarVisible() {
574
- return this.isSearchable && this.optionLength >= 5 && this.isDropdownOpen
569
+ // Removed the optionLength condition, because if there were no result/options when we searched, we still need to show the search input
570
+ return this.isSearchable && this.isDropdownOpen
571
+ },
572
+ selectorWidth() {
573
+ const currentWidth = this.selectWidth ? this.selectWidth : '100%'
574
+
575
+ return `calc(${currentWidth} - ${CARET_WIDTH + ELLIPSIS_WIDTH}px)`
575
576
  }
576
577
  },
577
578
  watch: {