@eturnity/eturnity_reusable_components 7.12.6-EPDM-10310.2 → 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 +201 -71
- 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,28 +171,17 @@ 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
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
${(props) => props.selectWidth === '100%' ? 'width: 100%;' : `width: calc(${props.selectWidth} -
|
176
|
-
(
|
177
|
-
${CARET_WIDTH} +
|
178
|
-
${props.paddingLeft}
|
179
|
-
${props.showBorder ? `+ (${BORDER_WIDTH} * 2)` : ''}
|
180
|
-
)
|
181
|
-
);
|
182
|
-
white-space: nowrap;
|
183
|
-
text-overflow: ellipsis;
|
184
|
-
overflow: hidden;`
|
185
|
-
}
|
179
|
+
const Selector = styled('div', { selectWidth: String, paddingLeft: String })`
|
180
|
+
width: ${(props) =>
|
181
|
+
`calc(${props.selectWidth} - (${CARET_WIDTH} + ${props.paddingLeft} + (${BORDER_WIDTH} * 2)))`};
|
182
|
+
white-space: nowrap;
|
183
|
+
text-overflow: ellipsis;
|
184
|
+
overflow: hidden;
|
186
185
|
`
|
187
186
|
|
188
187
|
const labelAttrs = { fontSize: String, fontColor: String }
|
@@ -197,7 +196,10 @@ const InputLabel = styled('div', labelAttrs)`
|
|
197
196
|
const optionalLabel = styled.span`
|
198
197
|
font-weight: 300;
|
199
198
|
`
|
200
|
-
const inputProps = {
|
199
|
+
const inputProps = {
|
200
|
+
selectWidth: String,
|
201
|
+
optionWidth: String
|
202
|
+
}
|
201
203
|
const Container = styled('div', inputProps)`
|
202
204
|
width: ${(props) => props.selectWidth};
|
203
205
|
position: relative;
|
@@ -224,9 +226,10 @@ const selectButtonAttrs = {
|
|
224
226
|
hasError: Boolean,
|
225
227
|
disabled: Boolean,
|
226
228
|
selectHeight: String,
|
229
|
+
selectWidth: String,
|
227
230
|
height: String,
|
228
231
|
selectMinHeight: String,
|
229
|
-
|
232
|
+
hasNoPadding: Boolean,
|
230
233
|
showBorder: Boolean,
|
231
234
|
paddingLeft: String
|
232
235
|
}
|
@@ -234,8 +237,9 @@ const selectButton = styled('div', selectButtonAttrs)`
|
|
234
237
|
position: relative;
|
235
238
|
box-sizing: border-box;
|
236
239
|
border-radius: 4px;
|
240
|
+
max-width: ${(props) => (props.selectWidth ? props.selectWidth : '100%')};
|
237
241
|
${(props) =>
|
238
|
-
props.
|
242
|
+
props.hasNoPadding ? '' : `padding-left: ${props.paddingLeft}`};
|
239
243
|
text-align: left;
|
240
244
|
min-height: ${(props) =>
|
241
245
|
props.selectHeight
|
@@ -247,7 +251,7 @@ const selectButton = styled('div', selectButtonAttrs)`
|
|
247
251
|
: '36px'};
|
248
252
|
display: flex;
|
249
253
|
align-items: center;
|
250
|
-
|
254
|
+
height: ${(props) => props.selectHeight};
|
251
255
|
${({ showBorder, theme, hasError }) =>
|
252
256
|
showBorder &&
|
253
257
|
`
|
@@ -279,14 +283,17 @@ const selectDropdownAttrs = {
|
|
279
283
|
fontColor: String,
|
280
284
|
optionWidth: String,
|
281
285
|
hoveredIndex: Number,
|
286
|
+
fontSize: String,
|
287
|
+
dropdownPosition: Object,
|
282
288
|
hoveredValue: Number | String,
|
283
289
|
selectedValue: Number | String
|
284
290
|
}
|
285
291
|
const selectDropdown = styled('div', selectDropdownAttrs)`
|
286
292
|
box-sizing: border-box;
|
287
|
-
z-index: ${(props) => (props.isActive ? '2' : '
|
293
|
+
z-index: ${(props) => (props.isActive ? '2' : '99999')};
|
288
294
|
position: absolute;
|
289
|
-
top:
|
295
|
+
top: ${(props) => props.dropdownPosition?.top}px;
|
296
|
+
left: ${(props) => props.dropdownPosition?.left}px;
|
290
297
|
border: ${BORDER_WIDTH} solid ${(props) => props.theme.colors.grey4};
|
291
298
|
border-radius: 4px;
|
292
299
|
display: flex;
|
@@ -294,7 +301,7 @@ const selectDropdown = styled('div', selectDropdownAttrs)`
|
|
294
301
|
align-items: flex-start;
|
295
302
|
padding: 0px;
|
296
303
|
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
|
297
|
-
width: ${(props) =>
|
304
|
+
width: ${(props) => props.optionWidth};
|
298
305
|
background-color: ${(props) =>
|
299
306
|
props.theme.colors[props.bgColor]
|
300
307
|
? props.theme.colors[props.bgColor]
|
@@ -311,7 +318,9 @@ const selectDropdown = styled('div', selectDropdownAttrs)`
|
|
311
318
|
? props.theme.colors[props.hoveredBgColor]
|
312
319
|
: props.hoveredBgColor};
|
313
320
|
}
|
321
|
+
font-size: ${(props) => props.fontSize};
|
314
322
|
`
|
323
|
+
selectDropdown.emits = ['option-hovered', 'option-selected']
|
315
324
|
const DropdownWrapper = styled('div')`
|
316
325
|
position: relative;
|
317
326
|
`
|
@@ -324,6 +333,10 @@ const InputWrapper = styled('div', inputAttrs)`
|
|
324
333
|
grid-template-columns: ${(props) =>
|
325
334
|
props.alignItems === 'vertical' || !props.hasLabel ? '1fr' : 'auto 1fr'};
|
326
335
|
`
|
336
|
+
|
337
|
+
const DROPDOWN_HEIGHT_OFFSET = 4
|
338
|
+
const DROPDOWN_TOP_OFFSET = 21
|
339
|
+
|
327
340
|
export default {
|
328
341
|
name: 'RCselect',
|
329
342
|
|
@@ -435,6 +448,10 @@ export default {
|
|
435
448
|
type: String,
|
436
449
|
default: ''
|
437
450
|
},
|
451
|
+
hasSelectButtonPadding: {
|
452
|
+
type: Boolean,
|
453
|
+
default: true
|
454
|
+
},
|
438
455
|
isDraggable: {
|
439
456
|
type: Boolean,
|
440
457
|
default: false
|
@@ -456,6 +473,7 @@ export default {
|
|
456
473
|
Caret,
|
457
474
|
Selector,
|
458
475
|
inputText,
|
476
|
+
Teleport,
|
459
477
|
draggableInputHandle
|
460
478
|
},
|
461
479
|
|
@@ -467,23 +485,38 @@ export default {
|
|
467
485
|
isActive: false,
|
468
486
|
textSearch: '',
|
469
487
|
hoveredIndex: 0,
|
470
|
-
|
471
|
-
|
488
|
+
isClickOutsideActive: false,
|
489
|
+
dropdownPosition: {
|
490
|
+
left: null,
|
491
|
+
top: null
|
492
|
+
},
|
493
|
+
dropdownWidth: null,
|
494
|
+
hoveredValue: null
|
472
495
|
}
|
473
496
|
},
|
474
497
|
mounted() {
|
498
|
+
this.observeDropdownHeight()
|
499
|
+
this.observeSelectWidth()
|
500
|
+
window.addEventListener('resize', this.handleSetDropdownOffet)
|
501
|
+
},
|
502
|
+
beforeMount() {
|
475
503
|
this.selectedValue = this.value
|
476
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()
|
477
509
|
},
|
478
|
-
|
510
|
+
unmounted() {
|
479
511
|
document.removeEventListener('click', this.clickOutside)
|
480
512
|
},
|
481
513
|
methods: {
|
482
514
|
focus() {
|
483
515
|
this.isActive = true
|
484
516
|
},
|
485
|
-
blur() {
|
517
|
+
blur(e) {
|
486
518
|
this.isActive = false
|
519
|
+
this.$emit('blur', e)
|
487
520
|
},
|
488
521
|
toggleDropdown() {
|
489
522
|
this.isDropdownOpen = !this.isDropdownOpen
|
@@ -499,6 +532,9 @@ export default {
|
|
499
532
|
this.blur()
|
500
533
|
this.isDropdownOpen = false
|
501
534
|
},
|
535
|
+
clearSearch() {
|
536
|
+
this.textSearch = ''
|
537
|
+
},
|
502
538
|
optionSelected(e) {
|
503
539
|
this.selectedValue = e
|
504
540
|
this.closeDropdown()
|
@@ -527,15 +563,15 @@ export default {
|
|
527
563
|
searchChange(value) {
|
528
564
|
this.textSearch = value
|
529
565
|
this.$emit('search-change', value)
|
530
|
-
this.$refs.dropdown.$children
|
531
|
-
|
532
|
-
.
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
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
|
+
})
|
539
575
|
},
|
540
576
|
clickOutside(event) {
|
541
577
|
const dropdownRef = this.$refs.dropdown
|
@@ -545,6 +581,7 @@ export default {
|
|
545
581
|
if (
|
546
582
|
this.$refs.select.$el == event.target ||
|
547
583
|
this.$refs.select.$el.contains(event.target) ||
|
584
|
+
event.target.id === 'more-button' ||
|
548
585
|
event.target.parentNode === dropdownRef.$el
|
549
586
|
) {
|
550
587
|
return
|
@@ -558,13 +595,92 @@ export default {
|
|
558
595
|
} else if (e.key == 'ArrowUp') {
|
559
596
|
this.onArrowPress(-1)
|
560
597
|
} else if (e.key == 'Enter') {
|
561
|
-
const optionHoveredComponent =
|
562
|
-
this
|
563
|
-
|
564
|
-
]
|
598
|
+
const optionHoveredComponent = [...this.$refs.dropdown.$el.children][
|
599
|
+
(this.hoveredIndex - 1 + this.optionLength) % this.optionLength
|
600
|
+
]
|
565
601
|
this.optionSelected(optionHoveredComponent.$el.dataset.value)
|
566
602
|
}
|
567
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
|
+
},
|
568
684
|
onArrowPress(dir) {
|
569
685
|
let newHoveredElem
|
570
686
|
const currentHoveredElem = this.$refs.dropdown.$el.querySelector(
|
@@ -596,20 +712,34 @@ export default {
|
|
596
712
|
return 0
|
597
713
|
},
|
598
714
|
isSearchBarVisible() {
|
599
|
-
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
|
+
)
|
600
728
|
}
|
601
729
|
},
|
602
730
|
watch: {
|
603
731
|
value(val) {
|
604
732
|
this.selectedValue = val
|
605
733
|
},
|
606
|
-
isDropdownOpen(val) {
|
607
|
-
this.$emit('is-dropdown-open', val)
|
734
|
+
async isDropdownOpen(val) {
|
608
735
|
if (val) {
|
609
736
|
setTimeout(() => {
|
610
737
|
this.isClickOutsideActive = true
|
611
738
|
}, 10)
|
739
|
+
await this.$nextTick()
|
740
|
+
this.handleSetDropdownOffet()
|
612
741
|
} else {
|
742
|
+
this.dropdownPosition.left = null
|
613
743
|
setTimeout(() => {
|
614
744
|
this.isClickOutsideActive = false
|
615
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`
|