@eturnity/eturnity_reusable_components 7.4.4-EPDM-7260.21 → 7.4.4-EPDM-7260.22
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
@@ -79,7 +79,12 @@
|
|
79
79
|
:selectWidth="selectWidth"
|
80
80
|
:paddingLeft="paddingLeft"
|
81
81
|
>
|
82
|
-
<slot
|
82
|
+
<slot
|
83
|
+
v-if="!simpleDropdown"
|
84
|
+
name="selector"
|
85
|
+
:selectedValue="selectedValue"
|
86
|
+
></slot>
|
87
|
+
<select-text v-else>{{ selectedValue[OptionKey] }}</select-text>
|
83
88
|
</selector>
|
84
89
|
<Caret @click.stop="toggleCaretDropdown" v-if="dropDownArrowVisible">
|
85
90
|
<icon
|
@@ -128,7 +133,19 @@
|
|
128
133
|
@option-selected="optionSelected"
|
129
134
|
@option-hovered="optionHovered"
|
130
135
|
>
|
131
|
-
<slot name="dropdown"></slot>
|
136
|
+
<slot v-if="!simpleDropdown" name="dropdown"></slot>
|
137
|
+
<template v-else>
|
138
|
+
<Option
|
139
|
+
v-for="item of dropdownOptions"
|
140
|
+
:key="item.id"
|
141
|
+
:value="item"
|
142
|
+
:data-id="`dropdown_option_${dataId}_${value.id}`"
|
143
|
+
>
|
144
|
+
<SelectText>
|
145
|
+
{{ item[OptionKey] }}
|
146
|
+
</SelectText>
|
147
|
+
</Option>
|
148
|
+
</template>
|
132
149
|
</selectDropdown>
|
133
150
|
</Teleport>
|
134
151
|
</DropdownWrapper>
|
@@ -166,6 +183,7 @@ import styled from 'vue3-styled-components'
|
|
166
183
|
import InfoText from '../../infoText'
|
167
184
|
import icon from '../../icon'
|
168
185
|
import inputText from '../inputText'
|
186
|
+
import Option from './option'
|
169
187
|
import draggableInputHandle from '../../draggableInputHandle'
|
170
188
|
|
171
189
|
const CARET_WIDTH = '30px'
|
@@ -183,6 +201,10 @@ const Caret = styled.div`
|
|
183
201
|
margin-left: auto;
|
184
202
|
`
|
185
203
|
|
204
|
+
const SelectText = styled.span`
|
205
|
+
font-size: 13px;
|
206
|
+
`
|
207
|
+
|
186
208
|
const selectorProps = {
|
187
209
|
selectWidth: String,
|
188
210
|
paddingLeft: String,
|
@@ -335,7 +357,7 @@ const selectDropdown = styled('div', selectDropdownAttrs)`
|
|
335
357
|
: props.fontColor};
|
336
358
|
max-height: 300px;
|
337
359
|
overflow-y: auto;
|
338
|
-
& > div[data-value='${(props) => props.hoveredValue}'] {
|
360
|
+
& > div[data-value='${(props) => JSON.stringify(props.hoveredValue)}'] {
|
339
361
|
background-color: ${(props) =>
|
340
362
|
props.theme.colors[props.hoveredBgColor]
|
341
363
|
? props.theme.colors[props.hoveredBgColor]
|
@@ -508,6 +530,20 @@ export default {
|
|
508
530
|
dropdownMenuPosition: {
|
509
531
|
type: String,
|
510
532
|
default: DROPDOWN_MENU_POSITIONS.Automatic // options: ['automatic', bottom]
|
533
|
+
},
|
534
|
+
|
535
|
+
// This prop is used to enable the simple dropdown mode, we needed a key inorder to display desired properties
|
536
|
+
simpleDropdown: {
|
537
|
+
type: Boolean,
|
538
|
+
default: false
|
539
|
+
},
|
540
|
+
Options: {
|
541
|
+
type: Array,
|
542
|
+
default: () => []
|
543
|
+
},
|
544
|
+
OptionKey: {
|
545
|
+
type: String,
|
546
|
+
default: 'value'
|
511
547
|
}
|
512
548
|
},
|
513
549
|
|
@@ -520,6 +556,8 @@ export default {
|
|
520
556
|
LabelWrapper,
|
521
557
|
optionalLabel,
|
522
558
|
InfoText,
|
559
|
+
Option,
|
560
|
+
SelectText,
|
523
561
|
InputWrapper,
|
524
562
|
DropdownWrapper,
|
525
563
|
icon,
|
@@ -547,11 +585,15 @@ export default {
|
|
547
585
|
left: null,
|
548
586
|
top: null
|
549
587
|
},
|
588
|
+
dropdownOptions: [],
|
550
589
|
dropdownWidth: null,
|
551
590
|
hoveredValue: null
|
552
591
|
}
|
553
592
|
},
|
554
593
|
mounted() {
|
594
|
+
if (this.Options.length > 0) {
|
595
|
+
this.dropdownOptions = this.Options
|
596
|
+
}
|
555
597
|
this.observeDropdownHeight()
|
556
598
|
this.observeSelectWidth()
|
557
599
|
window.addEventListener('resize', this.handleSetDropdownOffet)
|
@@ -597,6 +639,7 @@ export default {
|
|
597
639
|
this.$emit('input-change', e)
|
598
640
|
},
|
599
641
|
optionHovered(e) {
|
642
|
+
console.log(e)
|
600
643
|
this.hoveredValue = e
|
601
644
|
},
|
602
645
|
mouseEnterHandler() {
|
@@ -618,16 +661,23 @@ export default {
|
|
618
661
|
searchChange(value) {
|
619
662
|
this.textSearch = value
|
620
663
|
this.$emit('search-change', value)
|
621
|
-
const dropdownChildren = [...this.$refs.dropdown.$el.children]
|
622
|
-
dropdownChildren.forEach((el) => {
|
623
|
-
if (!el.textContent.toLowerCase().includes(value.toLowerCase())) {
|
624
|
-
el.style.display = 'none'
|
625
664
|
|
626
|
-
|
627
|
-
|
665
|
+
if (this.simpleDropdown) {
|
666
|
+
this.dropdownOptions = this.Options.filter((option) =>
|
667
|
+
option[this.OptionKey].toLowerCase().includes(value.toLowerCase())
|
668
|
+
)
|
669
|
+
} else {
|
670
|
+
const dropdownChildren = [...this.$refs.dropdown.$el.children]
|
671
|
+
dropdownChildren.forEach((el) => {
|
672
|
+
if (!el.textContent.toLowerCase().includes(value.toLowerCase())) {
|
673
|
+
el.style.display = 'none'
|
628
674
|
|
629
|
-
|
630
|
-
|
675
|
+
return
|
676
|
+
}
|
677
|
+
|
678
|
+
el.style.display = 'inherit'
|
679
|
+
})
|
680
|
+
}
|
631
681
|
},
|
632
682
|
clickOutside(event) {
|
633
683
|
const dropdownRef = this.$refs.dropdown
|
@@ -508,6 +508,8 @@ export default {
|
|
508
508
|
},
|
509
509
|
watch: {
|
510
510
|
labels(newVal, oldVal) {
|
511
|
+
const overlapContainer = []
|
512
|
+
|
511
513
|
//check items for overlap
|
512
514
|
if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) {
|
513
515
|
const labels = newVal.find((label) => label.placement === 'left')
|
@@ -515,9 +517,14 @@ export default {
|
|
515
517
|
if (labels) {
|
516
518
|
labels.value.forEach((label) => {
|
517
519
|
label.selectedTariffs.forEach((tariff) => {
|
518
|
-
|
520
|
+
const hasOverlap = this.checkOverlap(
|
521
|
+
tariff,
|
522
|
+
label.selectedTariffs
|
523
|
+
)
|
524
|
+
|
525
|
+
overlapContainer.push(hasOverlap)
|
519
526
|
|
520
|
-
if (
|
527
|
+
if (hasOverlap) {
|
521
528
|
const existing = this.OverlapId.find((id) => id === label.id)
|
522
529
|
|
523
530
|
if (!existing) this.OverlapId.push(label.id)
|
@@ -530,7 +537,8 @@ export default {
|
|
530
537
|
})
|
531
538
|
}
|
532
539
|
|
533
|
-
this
|
540
|
+
this.hasOverlap = overlapContainer.includes(true)
|
541
|
+
this.$emit('has-overlap', overlapContainer.includes(true))
|
534
542
|
}
|
535
543
|
}
|
536
544
|
}
|