@eturnity/eturnity_reusable_components 7.12.6-EPDM-10310.1 → 7.12.6-EPDM-7951.2
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/.storybook/preview.js +1 -1
- package/package.json +18 -23
- package/src/App.vue +2 -2
- package/src/components/addNewButton/index.vue +5 -3
- package/src/components/buttons/buttonIcon/index.vue +1 -1
- package/src/components/buttons/closeButton/index.vue +1 -1
- package/src/components/buttons/mainButton/index.vue +6 -1
- package/src/components/deleteIcon/DeleteIcon.stories.js +7 -7
- package/src/components/deleteIcon/index.vue +25 -21
- package/src/components/draggableInputHandle/index.vue +24 -25
- package/src/components/dropdown/index.vue +129 -110
- package/src/components/errorMessage/index.vue +1 -1
- package/src/components/filter/filterSettings.vue +55 -97
- package/src/components/filter/index.vue +3 -3
- package/src/components/filter/parentDropdown.vue +2 -2
- package/src/components/icon/iconCollection.vue +2 -2
- package/src/components/icon/index.vue +60 -54
- package/src/components/iconWrapper/index.vue +1 -4
- package/src/components/infoCard/index.vue +2 -3
- package/src/components/infoText/index.vue +1 -1
- package/src/components/inputs/checkbox/index.vue +21 -6
- package/src/components/inputs/inputNumber/index.vue +8 -11
- package/src/components/inputs/inputNumberQuestion/index.vue +1 -1
- package/src/components/inputs/inputText/index.vue +3 -3
- package/src/components/inputs/radioButton/index.vue +1 -1
- package/src/components/inputs/searchInput/index.vue +7 -8
- package/src/components/inputs/select/index.vue +197 -68
- package/src/components/inputs/select/option/index.vue +5 -5
- package/src/components/inputs/slider/index.vue +16 -16
- package/src/components/inputs/switchField/index.vue +2 -2
- package/src/components/inputs/textAreaInput/index.vue +1 -1
- package/src/components/inputs/toggle/index.vue +2 -2
- package/src/components/label/index.vue +27 -31
- package/src/components/modals/modal/index.vue +2 -6
- package/src/components/navigationTabs/index.vue +27 -20
- package/src/components/pageSubtitle/index.vue +1 -1
- package/src/components/pageTitle/index.vue +4 -4
- package/src/components/pagination/index.vue +1 -1
- package/src/components/progressBar/index.vue +1 -1
- package/src/components/projectMarker/index.vue +10 -7
- package/src/components/sideMenu/index.vue +1 -1
- package/src/components/spinner/index.vue +6 -11
- package/src/components/tableDropdown/index.vue +21 -26
- package/src/components/tables/mainTable/exampleNested.vue +1 -1
- package/src/components/tables/mainTable/index.vue +2 -1
- package/src/components/tables/viewTable/index.vue +2 -2
- package/src/components/threeDots/index.vue +1 -1
- package/src/components/videoThumbnail/index.vue +95 -100
- package/src/main.js +4 -11
@@ -13,10 +13,7 @@
|
|
13
13
|
:hasFocus="hasFocus"
|
14
14
|
:data-id="dataId"
|
15
15
|
/>
|
16
|
-
<
|
17
|
-
class="search-icn"
|
18
|
-
:src="require('../../../assets/icons/search_icon_black.svg')"
|
19
|
-
/>
|
16
|
+
<SearchIconSvg class="search-icn" />
|
20
17
|
</input-wrapper>
|
21
18
|
</container>
|
22
19
|
</template>
|
@@ -33,7 +30,8 @@
|
|
33
30
|
// :isFilter="true" // to set the height at 30px
|
34
31
|
// data-id="test-data-id"
|
35
32
|
// />
|
36
|
-
import styled from '
|
33
|
+
import styled from 'vue3-styled-components'
|
34
|
+
import SearchIconSvg from '../../../assets/icons/search_icon_black.svg'
|
37
35
|
|
38
36
|
const inputAttrs = {
|
39
37
|
isDisabled: Boolean,
|
@@ -68,7 +66,7 @@ const InputContainer = styled('input', inputAttrs)`
|
|
68
66
|
const InputWrapper = styled.span`
|
69
67
|
position: relative;
|
70
68
|
|
71
|
-
|
69
|
+
svg {
|
72
70
|
position: absolute;
|
73
71
|
right: 10px;
|
74
72
|
top: 50%;
|
@@ -81,7 +79,8 @@ export default {
|
|
81
79
|
components: {
|
82
80
|
InputContainer,
|
83
81
|
InputWrapper,
|
84
|
-
Container
|
82
|
+
Container,
|
83
|
+
SearchIconSvg
|
85
84
|
},
|
86
85
|
props: {
|
87
86
|
value: {
|
@@ -114,7 +113,7 @@ export default {
|
|
114
113
|
},
|
115
114
|
methods: {
|
116
115
|
onChangeHandler(event) {
|
117
|
-
this.$emit('on-change', event)
|
116
|
+
this.$emit('on-change', event.target.value)
|
118
117
|
},
|
119
118
|
focusInputElement() {
|
120
119
|
this.$nextTick(() => {
|
@@ -28,7 +28,9 @@
|
|
28
28
|
<select-button-wrapper :disabled="disabled">
|
29
29
|
<selectButton
|
30
30
|
ref="select"
|
31
|
+
class="select-button"
|
31
32
|
@click="toggleDropdown"
|
33
|
+
:selectWidth="selectWidth"
|
32
34
|
:selectHeight="selectHeight"
|
33
35
|
:height="height"
|
34
36
|
:selectMinHeight="selectMinHeight"
|
@@ -39,9 +41,9 @@
|
|
39
41
|
buttonFontColor || colorMode == 'dark' ? 'white' : 'black'
|
40
42
|
"
|
41
43
|
:hasError="hasError"
|
42
|
-
:
|
44
|
+
:hasNoPadding="isSearchBarVisible || !hasSelectButtonPadding"
|
43
45
|
:disabled="disabled"
|
44
|
-
@keydown
|
46
|
+
@keydown="onKeyDown"
|
45
47
|
:showBorder="showBorder"
|
46
48
|
:data-id="dataId"
|
47
49
|
:paddingLeft="paddingLeft"
|
@@ -64,11 +66,10 @@
|
|
64
66
|
:value="textSearch"
|
65
67
|
@keydown.stop="onKeyDown"
|
66
68
|
@input-change="searchChange"
|
67
|
-
@click.
|
69
|
+
@click.stop
|
68
70
|
/>
|
69
71
|
<selector
|
70
72
|
v-else
|
71
|
-
:showBorder="showBorder"
|
72
73
|
:selectWidth="selectWidth"
|
73
74
|
:paddingLeft="paddingLeft"
|
74
75
|
>
|
@@ -97,26 +98,33 @@
|
|
97
98
|
/>
|
98
99
|
</Caret>
|
99
100
|
</selectButton>
|
100
|
-
<DropdownWrapper>
|
101
|
-
<
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
101
|
+
<DropdownWrapper ref="dropdownWrapperRef">
|
102
|
+
<Teleport to="#portal-target">
|
103
|
+
<selectDropdown
|
104
|
+
ref="dropdown"
|
105
|
+
v-show="isSelectDropdownShown"
|
106
|
+
:dropdownPosition="dropdownPosition"
|
107
|
+
:hoveredIndex="hoveredIndex"
|
108
|
+
:hoveredValue="hoveredValue"
|
109
|
+
:isActive="isActive"
|
110
|
+
:optionWidth="getOptionWidth"
|
111
|
+
:hoveredBgColor="
|
112
|
+
colorMode == 'dark' ? '#000000' : dropdownBgColor
|
113
|
+
"
|
114
|
+
:bgColor="
|
115
|
+
dropdownBgColor || colorMode == 'dark' ? 'black' : 'white'
|
116
|
+
"
|
117
|
+
:fontColor="
|
118
|
+
dropdownFontColor || colorMode == 'dark' ? 'white' : 'black'
|
119
|
+
"
|
120
|
+
:fontSize="fontSize"
|
121
|
+
:selectedValue="selectedValue"
|
122
|
+
@option-selected="optionSelected"
|
123
|
+
@option-hovered="optionHovered"
|
124
|
+
>
|
125
|
+
<slot name="dropdown"></slot>
|
126
|
+
</selectDropdown>
|
127
|
+
</Teleport>
|
120
128
|
</DropdownWrapper>
|
121
129
|
</select-button-wrapper>
|
122
130
|
</input-wrapper>
|
@@ -131,8 +139,9 @@
|
|
131
139
|
// optionWidth="50%"
|
132
140
|
// label="that is a label"
|
133
141
|
// alignItems="vertical"
|
134
|
-
// label-data-id="test-
|
142
|
+
// label-data-id="test-label-data-id"
|
135
143
|
// data-id="test-data-id"
|
144
|
+
// :hasSelectButtonPadding="false"
|
136
145
|
// >
|
137
146
|
// <template #selector="{selectedValue}">
|
138
147
|
// value selected: {{selectedValue}}
|
@@ -145,7 +154,8 @@
|
|
145
154
|
// </template>
|
146
155
|
// </Select>
|
147
156
|
|
148
|
-
import
|
157
|
+
import { Teleport } from 'vue'
|
158
|
+
import styled from 'vue3-styled-components'
|
149
159
|
import InfoText from '../../infoText'
|
150
160
|
import icon from '../../icon'
|
151
161
|
import inputText from '../inputText'
|
@@ -161,26 +171,14 @@ const Caret = styled.div`
|
|
161
171
|
width: ${CARET_WIDTH};
|
162
172
|
min-width: ${CARET_WIDTH};
|
163
173
|
height: 100%;
|
164
|
-
align-items:
|
174
|
+
align-items: center;
|
165
175
|
cursor: pointer;
|
166
176
|
margin-left: auto;
|
167
177
|
`
|
168
178
|
|
169
|
-
const
|
170
|
-
selectWidth: String,
|
171
|
-
paddingLeft: String,
|
172
|
-
showBorder: Boolean
|
173
|
-
}
|
174
|
-
const Selector = styled('div', selectorProps)`
|
179
|
+
const Selector = styled('div', { selectWidth: String, paddingLeft: String })`
|
175
180
|
width: ${(props) =>
|
176
|
-
props.selectWidth
|
177
|
-
`calc(${props.selectWidth} -
|
178
|
-
(
|
179
|
-
${CARET_WIDTH} +
|
180
|
-
${props.paddingLeft}
|
181
|
-
${props.showBorder ? `+ (${BORDER_WIDTH} * 2)` : ''}
|
182
|
-
)
|
183
|
-
)`};
|
181
|
+
`calc(${props.selectWidth} - (${CARET_WIDTH} + ${props.paddingLeft} + (${BORDER_WIDTH} * 2)))`};
|
184
182
|
white-space: nowrap;
|
185
183
|
text-overflow: ellipsis;
|
186
184
|
overflow: hidden;
|
@@ -198,7 +196,10 @@ const InputLabel = styled('div', labelAttrs)`
|
|
198
196
|
const optionalLabel = styled.span`
|
199
197
|
font-weight: 300;
|
200
198
|
`
|
201
|
-
const inputProps = {
|
199
|
+
const inputProps = {
|
200
|
+
selectWidth: String,
|
201
|
+
optionWidth: String
|
202
|
+
}
|
202
203
|
const Container = styled('div', inputProps)`
|
203
204
|
width: ${(props) => props.selectWidth};
|
204
205
|
position: relative;
|
@@ -225,9 +226,10 @@ const selectButtonAttrs = {
|
|
225
226
|
hasError: Boolean,
|
226
227
|
disabled: Boolean,
|
227
228
|
selectHeight: String,
|
229
|
+
selectWidth: String,
|
228
230
|
height: String,
|
229
231
|
selectMinHeight: String,
|
230
|
-
|
232
|
+
hasNoPadding: Boolean,
|
231
233
|
showBorder: Boolean,
|
232
234
|
paddingLeft: String
|
233
235
|
}
|
@@ -235,8 +237,9 @@ const selectButton = styled('div', selectButtonAttrs)`
|
|
235
237
|
position: relative;
|
236
238
|
box-sizing: border-box;
|
237
239
|
border-radius: 4px;
|
240
|
+
max-width: ${(props) => (props.selectWidth ? props.selectWidth : '100%')};
|
238
241
|
${(props) =>
|
239
|
-
props.
|
242
|
+
props.hasNoPadding ? '' : `padding-left: ${props.paddingLeft}`};
|
240
243
|
text-align: left;
|
241
244
|
min-height: ${(props) =>
|
242
245
|
props.selectHeight
|
@@ -248,7 +251,7 @@ const selectButton = styled('div', selectButtonAttrs)`
|
|
248
251
|
: '36px'};
|
249
252
|
display: flex;
|
250
253
|
align-items: center;
|
251
|
-
|
254
|
+
height: ${(props) => props.selectHeight};
|
252
255
|
${({ showBorder, theme, hasError }) =>
|
253
256
|
showBorder &&
|
254
257
|
`
|
@@ -280,14 +283,17 @@ const selectDropdownAttrs = {
|
|
280
283
|
fontColor: String,
|
281
284
|
optionWidth: String,
|
282
285
|
hoveredIndex: Number,
|
286
|
+
fontSize: String,
|
287
|
+
dropdownPosition: Object,
|
283
288
|
hoveredValue: Number | String,
|
284
289
|
selectedValue: Number | String
|
285
290
|
}
|
286
291
|
const selectDropdown = styled('div', selectDropdownAttrs)`
|
287
292
|
box-sizing: border-box;
|
288
|
-
z-index: ${(props) => (props.isActive ? '2' : '
|
293
|
+
z-index: ${(props) => (props.isActive ? '2' : '99999')};
|
289
294
|
position: absolute;
|
290
|
-
top:
|
295
|
+
top: ${(props) => props.dropdownPosition?.top}px;
|
296
|
+
left: ${(props) => props.dropdownPosition?.left}px;
|
291
297
|
border: ${BORDER_WIDTH} solid ${(props) => props.theme.colors.grey4};
|
292
298
|
border-radius: 4px;
|
293
299
|
display: flex;
|
@@ -295,7 +301,7 @@ const selectDropdown = styled('div', selectDropdownAttrs)`
|
|
295
301
|
align-items: flex-start;
|
296
302
|
padding: 0px;
|
297
303
|
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
|
298
|
-
width: ${(props) =>
|
304
|
+
width: ${(props) => props.optionWidth};
|
299
305
|
background-color: ${(props) =>
|
300
306
|
props.theme.colors[props.bgColor]
|
301
307
|
? props.theme.colors[props.bgColor]
|
@@ -312,7 +318,9 @@ const selectDropdown = styled('div', selectDropdownAttrs)`
|
|
312
318
|
? props.theme.colors[props.hoveredBgColor]
|
313
319
|
: props.hoveredBgColor};
|
314
320
|
}
|
321
|
+
font-size: ${(props) => props.fontSize};
|
315
322
|
`
|
323
|
+
selectDropdown.emits = ['option-hovered', 'option-selected']
|
316
324
|
const DropdownWrapper = styled('div')`
|
317
325
|
position: relative;
|
318
326
|
`
|
@@ -325,6 +333,10 @@ const InputWrapper = styled('div', inputAttrs)`
|
|
325
333
|
grid-template-columns: ${(props) =>
|
326
334
|
props.alignItems === 'vertical' || !props.hasLabel ? '1fr' : 'auto 1fr'};
|
327
335
|
`
|
336
|
+
|
337
|
+
const DROPDOWN_HEIGHT_OFFSET = 4
|
338
|
+
const DROPDOWN_TOP_OFFSET = 21
|
339
|
+
|
328
340
|
export default {
|
329
341
|
name: 'RCselect',
|
330
342
|
|
@@ -436,6 +448,10 @@ export default {
|
|
436
448
|
type: String,
|
437
449
|
default: ''
|
438
450
|
},
|
451
|
+
hasSelectButtonPadding: {
|
452
|
+
type: Boolean,
|
453
|
+
default: true
|
454
|
+
},
|
439
455
|
isDraggable: {
|
440
456
|
type: Boolean,
|
441
457
|
default: false
|
@@ -457,6 +473,7 @@ export default {
|
|
457
473
|
Caret,
|
458
474
|
Selector,
|
459
475
|
inputText,
|
476
|
+
Teleport,
|
460
477
|
draggableInputHandle
|
461
478
|
},
|
462
479
|
|
@@ -468,23 +485,38 @@ export default {
|
|
468
485
|
isActive: false,
|
469
486
|
textSearch: '',
|
470
487
|
hoveredIndex: 0,
|
471
|
-
|
472
|
-
|
488
|
+
isClickOutsideActive: false,
|
489
|
+
dropdownPosition: {
|
490
|
+
left: null,
|
491
|
+
top: null
|
492
|
+
},
|
493
|
+
dropdownWidth: null,
|
494
|
+
hoveredValue: null
|
473
495
|
}
|
474
496
|
},
|
475
497
|
mounted() {
|
498
|
+
this.observeDropdownHeight()
|
499
|
+
this.observeSelectWidth()
|
500
|
+
window.addEventListener('resize', this.handleSetDropdownOffet)
|
501
|
+
},
|
502
|
+
beforeMount() {
|
476
503
|
this.selectedValue = this.value
|
477
504
|
document.addEventListener('click', this.clickOutside)
|
505
|
+
this.getDropdownPosition()
|
506
|
+
window.removeEventListener('resize', this.handleSetDropdownOffet)
|
507
|
+
if (this.dropdownResizeObserver) this.dropdownResizeObserver.disconnect()
|
508
|
+
if (this.selectResizeObserver) this.selectResizeObserver.disconnect()
|
478
509
|
},
|
479
|
-
|
510
|
+
unmounted() {
|
480
511
|
document.removeEventListener('click', this.clickOutside)
|
481
512
|
},
|
482
513
|
methods: {
|
483
514
|
focus() {
|
484
515
|
this.isActive = true
|
485
516
|
},
|
486
|
-
blur() {
|
517
|
+
blur(e) {
|
487
518
|
this.isActive = false
|
519
|
+
this.$emit('blur', e)
|
488
520
|
},
|
489
521
|
toggleDropdown() {
|
490
522
|
this.isDropdownOpen = !this.isDropdownOpen
|
@@ -500,6 +532,9 @@ export default {
|
|
500
532
|
this.blur()
|
501
533
|
this.isDropdownOpen = false
|
502
534
|
},
|
535
|
+
clearSearch() {
|
536
|
+
this.textSearch = ''
|
537
|
+
},
|
503
538
|
optionSelected(e) {
|
504
539
|
this.selectedValue = e
|
505
540
|
this.closeDropdown()
|
@@ -528,15 +563,15 @@ export default {
|
|
528
563
|
searchChange(value) {
|
529
564
|
this.textSearch = value
|
530
565
|
this.$emit('search-change', value)
|
531
|
-
this.$refs.dropdown.$children
|
532
|
-
|
533
|
-
.
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
566
|
+
const dropdownChildren = [...this.$refs.dropdown.$el.children]
|
567
|
+
dropdownChildren.forEach((el) => {
|
568
|
+
if (!el.textContent.toLowerCase().includes(value.toLowerCase())) {
|
569
|
+
el.style.display = 'none'
|
570
|
+
|
571
|
+
return
|
572
|
+
}
|
573
|
+
el.style.display = 'inherit'
|
574
|
+
})
|
540
575
|
},
|
541
576
|
clickOutside(event) {
|
542
577
|
const dropdownRef = this.$refs.dropdown
|
@@ -546,6 +581,7 @@ export default {
|
|
546
581
|
if (
|
547
582
|
this.$refs.select.$el == event.target ||
|
548
583
|
this.$refs.select.$el.contains(event.target) ||
|
584
|
+
event.target.id === 'more-button' ||
|
549
585
|
event.target.parentNode === dropdownRef.$el
|
550
586
|
) {
|
551
587
|
return
|
@@ -559,13 +595,92 @@ export default {
|
|
559
595
|
} else if (e.key == 'ArrowUp') {
|
560
596
|
this.onArrowPress(-1)
|
561
597
|
} else if (e.key == 'Enter') {
|
562
|
-
const optionHoveredComponent =
|
563
|
-
this
|
564
|
-
|
565
|
-
]
|
598
|
+
const optionHoveredComponent = [...this.$refs.dropdown.$el.children][
|
599
|
+
(this.hoveredIndex - 1 + this.optionLength) % this.optionLength
|
600
|
+
]
|
566
601
|
this.optionSelected(optionHoveredComponent.$el.dataset.value)
|
567
602
|
}
|
568
603
|
},
|
604
|
+
// If some part of the dropdown menu is outside viewport of the bottom of the screen,
|
605
|
+
// we need to offset it and display it at the top of the select dropdown instead
|
606
|
+
async getDropdownPosition() {
|
607
|
+
if (
|
608
|
+
!this.$refs.dropdownWrapperRef ||
|
609
|
+
!this.$refs.select ||
|
610
|
+
!this.$refs.dropdown
|
611
|
+
) {
|
612
|
+
return
|
613
|
+
}
|
614
|
+
await this.$nextTick()
|
615
|
+
const isDisplayedAtBottom = await this.generateDropdownPosition()
|
616
|
+
await this.$nextTick()
|
617
|
+
// If the dropdown menu is going to be displayed at the bottom,
|
618
|
+
// we need reverify its position after a dom update (nextTick)
|
619
|
+
if (isDisplayedAtBottom) this.generateDropdownPosition()
|
620
|
+
},
|
621
|
+
async generateDropdownPosition() {
|
622
|
+
const isDropdownNotCompletelyVisible =
|
623
|
+
await this.isBottomOfDropdownOutOfViewport()
|
624
|
+
const dropdownWrapperEl = this.$refs.dropdownWrapperRef.$el
|
625
|
+
const selectButtonHeight = this.$refs.select.$el.clientHeight
|
626
|
+
const dropdownHeight = this.$refs.dropdown.$el.clientHeight
|
627
|
+
const dropdownWrapperRelativeHeight =
|
628
|
+
dropdownWrapperEl.getBoundingClientRect().top +
|
629
|
+
window.scrollY +
|
630
|
+
DROPDOWN_HEIGHT_OFFSET
|
631
|
+
|
632
|
+
const top = isDropdownNotCompletelyVisible
|
633
|
+
? dropdownWrapperRelativeHeight
|
634
|
+
: dropdownWrapperRelativeHeight -
|
635
|
+
dropdownHeight -
|
636
|
+
selectButtonHeight -
|
637
|
+
DROPDOWN_TOP_OFFSET
|
638
|
+
const left = this.dropdownPosition.left
|
639
|
+
? this.dropdownPosition.left
|
640
|
+
: dropdownWrapperEl.getBoundingClientRect().left + window.scrollX
|
641
|
+
|
642
|
+
this.dropdownPosition = { left: Math.floor(left), top: Math.floor(top) }
|
643
|
+
|
644
|
+
return isDropdownNotCompletelyVisible
|
645
|
+
},
|
646
|
+
async isBottomOfDropdownOutOfViewport() {
|
647
|
+
if (!this.$refs.dropdown) {
|
648
|
+
return false
|
649
|
+
}
|
650
|
+
await this.$nextTick()
|
651
|
+
const rect = this.$refs.dropdown.$el.getBoundingClientRect()
|
652
|
+
const windowHeight =
|
653
|
+
window.innerHeight || document.documentElement.clientHeight
|
654
|
+
|
655
|
+
// using Math.floor because the offsets may contain decimals we are not going to consider here
|
656
|
+
return Math.floor(rect.top) + Math.floor(rect.height) <= windowHeight
|
657
|
+
},
|
658
|
+
observeDropdownHeight() {
|
659
|
+
if (!this.$refs.dropdown) return
|
660
|
+
this.dropdownResizeObserver = new ResizeObserver(() => {
|
661
|
+
this.$nextTick(() => this.getDropdownPosition())
|
662
|
+
})
|
663
|
+
this.dropdownResizeObserver.observe(this.$refs.dropdown.$el)
|
664
|
+
},
|
665
|
+
handleSetDropdownOffet() {
|
666
|
+
if (!this.$refs.select) return
|
667
|
+
this.dropdownPosition.left = Math.floor(
|
668
|
+
this.$refs.select.$el.getBoundingClientRect().left
|
669
|
+
)
|
670
|
+
this.getDropdownWidth()
|
671
|
+
},
|
672
|
+
observeSelectWidth() {
|
673
|
+
if (!this.$refs.select) return
|
674
|
+
this.selectResizeObserver = new ResizeObserver(() =>
|
675
|
+
this.$nextTick(() => this.getDropdownWidth())
|
676
|
+
)
|
677
|
+
this.selectResizeObserver.observe(this.$refs.dropdown.$el)
|
678
|
+
},
|
679
|
+
async getDropdownWidth() {
|
680
|
+
if (!this.$refs.select) return
|
681
|
+
await this.$nextTick()
|
682
|
+
this.dropdownWidth = `${this.$refs.select.$el.clientWidth}px`
|
683
|
+
},
|
569
684
|
onArrowPress(dir) {
|
570
685
|
let newHoveredElem
|
571
686
|
const currentHoveredElem = this.$refs.dropdown.$el.querySelector(
|
@@ -597,20 +712,34 @@ export default {
|
|
597
712
|
return 0
|
598
713
|
},
|
599
714
|
isSearchBarVisible() {
|
600
|
-
return this.isSearchable && this.isDropdownOpen
|
715
|
+
return this.isSearchable && this.optionLength >= 5 && this.isDropdownOpen
|
716
|
+
},
|
717
|
+
getOptionWidth() {
|
718
|
+
if (this.optionWidth) return this.optionWidth
|
719
|
+
|
720
|
+
return this.dropdownWidth
|
721
|
+
},
|
722
|
+
isSelectDropdownShown() {
|
723
|
+
return (
|
724
|
+
this.isSearchable &&
|
725
|
+
this.isDropdownOpen &&
|
726
|
+
this.dropdownPosition.left !== null
|
727
|
+
)
|
601
728
|
}
|
602
729
|
},
|
603
730
|
watch: {
|
604
731
|
value(val) {
|
605
732
|
this.selectedValue = val
|
606
733
|
},
|
607
|
-
isDropdownOpen(val) {
|
608
|
-
this.$emit('is-dropdown-open', val)
|
734
|
+
async isDropdownOpen(val) {
|
609
735
|
if (val) {
|
610
736
|
setTimeout(() => {
|
611
737
|
this.isClickOutsideActive = true
|
612
738
|
}, 10)
|
739
|
+
await this.$nextTick()
|
740
|
+
this.handleSetDropdownOffet()
|
613
741
|
} else {
|
742
|
+
this.dropdownPosition.left = null
|
614
743
|
setTimeout(() => {
|
615
744
|
this.isClickOutsideActive = false
|
616
745
|
}, 10)
|
@@ -22,7 +22,7 @@
|
|
22
22
|
<script>
|
23
23
|
// import selectButton from './selectButton'
|
24
24
|
// import selectDropdown from './selectDropDown'
|
25
|
-
import styled from '
|
25
|
+
import styled from 'vue3-styled-components'
|
26
26
|
const optionProps = {
|
27
27
|
isDisabled: Boolean,
|
28
28
|
hoveredBgColor: String,
|
@@ -59,7 +59,7 @@ const optionContainer = styled('div', optionProps)`
|
|
59
59
|
|
60
60
|
export default {
|
61
61
|
name: 'RCoption',
|
62
|
-
|
62
|
+
emits: ['option-hovered', 'option-selected'],
|
63
63
|
props: {
|
64
64
|
value: {
|
65
65
|
required: true
|
@@ -73,7 +73,7 @@ export default {
|
|
73
73
|
},
|
74
74
|
cursorType: {
|
75
75
|
required: false,
|
76
|
-
default: '
|
76
|
+
default: 'pointer'
|
77
77
|
},
|
78
78
|
backgroundColor: {
|
79
79
|
required: false,
|
@@ -94,12 +94,12 @@ export default {
|
|
94
94
|
return {}
|
95
95
|
},
|
96
96
|
methods: {
|
97
|
-
clickHandler() {
|
97
|
+
clickHandler(e) {
|
98
98
|
if (this.isDisabled) {
|
99
99
|
// prevent emitter if the option is disabled
|
100
100
|
return
|
101
101
|
} else {
|
102
|
-
this.$parent.$emit('option-selected', this.value)
|
102
|
+
this.$parent.$emit('option-selected', this.value, e)
|
103
103
|
}
|
104
104
|
},
|
105
105
|
hoverHandler() {
|
@@ -21,8 +21,8 @@
|
|
21
21
|
// :minValue="10" //default is 0 if not specified
|
22
22
|
// :maxValue="500" //default is 100 if not specified
|
23
23
|
// />
|
24
|
-
import Slider from
|
25
|
-
import styled from
|
24
|
+
import Slider from '@vueform/slider'
|
25
|
+
import styled from 'vue3-styled-components'
|
26
26
|
|
27
27
|
const Container = styled.div`
|
28
28
|
margin: 16px 0 16px 21px;
|
@@ -81,45 +81,45 @@ const NumberText = styled.div`
|
|
81
81
|
`
|
82
82
|
|
83
83
|
export default {
|
84
|
-
name:
|
84
|
+
name: 'slider',
|
85
85
|
components: {
|
86
86
|
Slider,
|
87
87
|
Container,
|
88
|
-
NumberText
|
88
|
+
NumberText
|
89
89
|
},
|
90
90
|
props: {
|
91
91
|
value: {
|
92
92
|
required: false,
|
93
|
-
default: 0
|
93
|
+
default: 0
|
94
94
|
},
|
95
95
|
unit: {
|
96
96
|
required: false,
|
97
|
-
default:
|
97
|
+
default: ''
|
98
98
|
},
|
99
99
|
minValue: {
|
100
100
|
required: false,
|
101
|
-
default: 0
|
101
|
+
default: 0
|
102
102
|
},
|
103
103
|
maxValue: {
|
104
104
|
required: false,
|
105
|
-
default: 100
|
106
|
-
}
|
105
|
+
default: 100
|
106
|
+
}
|
107
107
|
},
|
108
108
|
methods: {
|
109
109
|
onChange(value) {
|
110
|
-
this.$emit(
|
111
|
-
}
|
110
|
+
this.$emit('change', value)
|
111
|
+
}
|
112
112
|
},
|
113
113
|
mounted() {
|
114
114
|
// This is to add the 3 white lines to the slider button
|
115
|
-
let slider = document.querySelector(
|
116
|
-
let span1 = document.createElement(
|
117
|
-
let span2 = document.createElement(
|
118
|
-
let span3 = document.createElement(
|
115
|
+
let slider = document.querySelector('.slider-touch-area')
|
116
|
+
let span1 = document.createElement('span')
|
117
|
+
let span2 = document.createElement('span')
|
118
|
+
let span3 = document.createElement('span')
|
119
119
|
slider.appendChild(span1)
|
120
120
|
slider.appendChild(span2)
|
121
121
|
slider.appendChild(span3)
|
122
|
-
}
|
122
|
+
}
|
123
123
|
}
|
124
124
|
</script>
|
125
125
|
|
@@ -45,7 +45,7 @@
|
|
45
45
|
>
|
46
46
|
<label-text :size="size" :fontColor="fontColor">{{ label }}</label-text>
|
47
47
|
<info-text
|
48
|
-
@click.
|
48
|
+
@click.stop
|
49
49
|
v-if="infoTextMessage"
|
50
50
|
:text="infoTextMessage"
|
51
51
|
/>
|
@@ -70,7 +70,7 @@
|
|
70
70
|
// :disabled="false"
|
71
71
|
// />
|
72
72
|
|
73
|
-
import styled from '
|
73
|
+
import styled from 'vue3-styled-components'
|
74
74
|
import InfoText from '../../infoText'
|
75
75
|
import theme from '../../../assets/theme'
|
76
76
|
const Container = styled.div``
|
@@ -44,7 +44,7 @@
|
|
44
44
|
>
|
45
45
|
<label-text :size="size" :fontColor="fontColor">{{ label }}</label-text>
|
46
46
|
<info-text
|
47
|
-
@click.
|
47
|
+
@click.stop
|
48
48
|
v-if="infoTextMessage"
|
49
49
|
:text="infoTextMessage"
|
50
50
|
/>
|
@@ -70,7 +70,7 @@
|
|
70
70
|
// data-id="test_data_id"
|
71
71
|
// />
|
72
72
|
|
73
|
-
import styled from '
|
73
|
+
import styled from 'vue3-styled-components'
|
74
74
|
import InfoText from '../../infoText'
|
75
75
|
|
76
76
|
const Container = styled.div`
|