@eturnity/eturnity_reusable_components 7.6.1-EPDM-9777.6 → 7.6.1-EPDM-7951
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 +17 -22
- 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/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 +57 -55
- package/src/components/iconWrapper/index.vue +1 -4
- package/src/components/infoCard/index.vue +17 -16
- package/src/components/infoText/index.vue +2 -7
- package/src/components/inputs/checkbox/index.vue +21 -6
- package/src/components/inputs/inputNumber/index.vue +7 -7
- 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 +203 -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/modals/modal/index.vue +14 -9
- package/src/components/navigationTabs/index.vue +37 -30
- package/src/components/pageSubtitle/index.vue +1 -1
- package/src/components/pageTitle/index.vue +20 -19
- 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 +14 -19
- package/src/components/videoThumbnail/index.vue +95 -100
- package/src/main.js +4 -11
@@ -66,7 +66,7 @@
|
|
66
66
|
</template>
|
67
67
|
|
68
68
|
<script>
|
69
|
-
import styled from '
|
69
|
+
import styled from 'vue3-styled-components'
|
70
70
|
import InfoText from '../../infoText'
|
71
71
|
import Icon from '../../icon'
|
72
72
|
import ErrorMessage from '../../errorMessage'
|
@@ -328,8 +328,8 @@ export default {
|
|
328
328
|
}
|
329
329
|
},
|
330
330
|
methods: {
|
331
|
-
onChangeHandler(
|
332
|
-
this.$emit('input-change',
|
331
|
+
onChangeHandler(event) {
|
332
|
+
this.$emit('input-change', event.target.value)
|
333
333
|
},
|
334
334
|
onInputBlur($event) {
|
335
335
|
this.$emit('input-blur', $event.target.value)
|
@@ -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(() => {
|
@@ -30,7 +30,9 @@
|
|
30
30
|
<select-button-wrapper :disabled="disabled">
|
31
31
|
<selectButton
|
32
32
|
ref="select"
|
33
|
+
class="select-button"
|
33
34
|
@click="toggleDropdown"
|
35
|
+
:selectWidth="selectWidth"
|
34
36
|
:selectHeight="selectHeight"
|
35
37
|
:height="height"
|
36
38
|
:selectMinHeight="selectMinHeight"
|
@@ -41,9 +43,9 @@
|
|
41
43
|
buttonFontColor || colorMode == 'dark' ? 'white' : 'black'
|
42
44
|
"
|
43
45
|
:hasError="hasError"
|
44
|
-
:
|
46
|
+
:hasNoPadding="isSearchBarVisible || !hasSelectButtonPadding"
|
45
47
|
:disabled="disabled"
|
46
|
-
@keydown
|
48
|
+
@keydown="onKeyDown"
|
47
49
|
:showBorder="showBorder"
|
48
50
|
:data-id="dataId"
|
49
51
|
>
|
@@ -61,9 +63,9 @@
|
|
61
63
|
:value="textSearch"
|
62
64
|
@keydown.stop="onKeyDown"
|
63
65
|
@input-change="searchChange"
|
64
|
-
@click.
|
66
|
+
@click.stop
|
65
67
|
/>
|
66
|
-
<selector v-else>
|
68
|
+
<selector :selectWidth="selectWidth" v-else>
|
67
69
|
<slot name="selector" :selectedValue="selectedValue"></slot>
|
68
70
|
</selector>
|
69
71
|
<Caret @click.stop="toggleCaretDropdown">
|
@@ -89,26 +91,33 @@
|
|
89
91
|
/>
|
90
92
|
</Caret>
|
91
93
|
</selectButton>
|
92
|
-
<DropdownWrapper>
|
93
|
-
<
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
94
|
+
<DropdownWrapper ref="dropdownWrapperRef">
|
95
|
+
<Teleport to="#portal-target">
|
96
|
+
<selectDropdown
|
97
|
+
ref="dropdown"
|
98
|
+
v-show="isSelectDropdownShown"
|
99
|
+
:dropdownPosition="dropdownPosition"
|
100
|
+
:hoveredIndex="hoveredIndex"
|
101
|
+
:hoveredValue="hoveredValue"
|
102
|
+
:isActive="isActive"
|
103
|
+
:optionWidth="getOptionWidth"
|
104
|
+
:hoveredBgColor="
|
105
|
+
colorMode == 'dark' ? '#000000' : dropdownBgColor
|
106
|
+
"
|
107
|
+
:bgColor="
|
108
|
+
dropdownBgColor || colorMode == 'dark' ? 'black' : 'white'
|
109
|
+
"
|
110
|
+
:fontColor="
|
111
|
+
dropdownFontColor || colorMode == 'dark' ? 'white' : 'black'
|
112
|
+
"
|
113
|
+
:fontSize="fontSize"
|
114
|
+
:selectedValue="selectedValue"
|
115
|
+
@option-selected="optionSelected"
|
116
|
+
@option-hovered="optionHovered"
|
117
|
+
>
|
118
|
+
<slot name="dropdown"></slot>
|
119
|
+
</selectDropdown>
|
120
|
+
</Teleport>
|
112
121
|
</DropdownWrapper>
|
113
122
|
</select-button-wrapper>
|
114
123
|
</input-wrapper>
|
@@ -123,8 +132,9 @@
|
|
123
132
|
// optionWidth="50%"
|
124
133
|
// label="that is a label"
|
125
134
|
// alignItems="vertical"
|
126
|
-
// label-data-id="test-
|
135
|
+
// label-data-id="test-label-data-id"
|
127
136
|
// data-id="test-data-id"
|
137
|
+
// :hasSelectButtonPadding="false"
|
128
138
|
// >
|
129
139
|
// <template #selector="{selectedValue}">
|
130
140
|
// value selected: {{selectedValue}}
|
@@ -137,7 +147,8 @@
|
|
137
147
|
// </template>
|
138
148
|
// </Select>
|
139
149
|
|
140
|
-
import
|
150
|
+
import { Teleport } from 'vue'
|
151
|
+
import styled from 'vue3-styled-components'
|
141
152
|
import InfoText from '../../infoText'
|
142
153
|
import icon from '../../icon'
|
143
154
|
import inputText from '../inputText'
|
@@ -149,13 +160,18 @@ const Caret = styled.div`
|
|
149
160
|
width: 30px;
|
150
161
|
min-width: 30px;
|
151
162
|
height: 100%;
|
152
|
-
align-items: stretch
|
153
163
|
cursor: pointer;
|
154
164
|
margin-left: auto;
|
155
165
|
`
|
156
166
|
|
157
|
-
const Selector = styled
|
158
|
-
width:
|
167
|
+
const Selector = styled('div', { selectWidth: String })`
|
168
|
+
max-width: ${(props) =>
|
169
|
+
props.selectWidth
|
170
|
+
? props.selectWidth
|
171
|
+
: '100%'}; // set to same width as the select
|
172
|
+
white-space: nowrap;
|
173
|
+
text-overflow: ellipsis;
|
174
|
+
overflow: hidden;
|
159
175
|
`
|
160
176
|
|
161
177
|
const labelAttrs = { fontSize: String, fontColor: String }
|
@@ -164,13 +180,16 @@ const InputLabel = styled('div', labelAttrs)`
|
|
164
180
|
props.theme.colors[props.fontColor]
|
165
181
|
? props.theme.colors[props.fontColor]
|
166
182
|
: props.fontColor};
|
167
|
-
font-size: ${(props) =>
|
183
|
+
font-size: ${(props) => props.fontSize};
|
168
184
|
font-weight: 700;
|
169
185
|
`
|
170
186
|
const optionalLabel = styled.span`
|
171
187
|
font-weight: 300;
|
172
188
|
`
|
173
|
-
const inputProps = {
|
189
|
+
const inputProps = {
|
190
|
+
selectWidth: String,
|
191
|
+
optionWidth: String
|
192
|
+
}
|
174
193
|
const Container = styled('div', inputProps)`
|
175
194
|
width: ${(props) => (props.selectWidth ? props.selectWidth : '100%')};
|
176
195
|
position: relative;
|
@@ -197,18 +216,20 @@ const selectButtonAttrs = {
|
|
197
216
|
hasError: Boolean,
|
198
217
|
disabled: Boolean,
|
199
218
|
selectHeight: String,
|
219
|
+
selectWidth: String,
|
200
220
|
height: String,
|
201
221
|
selectMinHeight: String,
|
202
|
-
|
222
|
+
hasNoPadding: Boolean,
|
203
223
|
showBorder: Boolean
|
204
224
|
}
|
205
225
|
const selectButton = styled('div', selectButtonAttrs)`
|
206
226
|
position: relative;
|
207
227
|
box-sizing: border-box;
|
208
228
|
border-radius: 4px;
|
209
|
-
padding: ${(props) => (props.
|
229
|
+
padding: ${(props) => (props.hasNoPadding ? '0' : '0px 0px 0 15px')};
|
210
230
|
text-align: left;
|
211
231
|
border-radius: 4px;
|
232
|
+
max-width: ${(props) => (props.selectWidth ? props.selectWidth : '100%')};
|
212
233
|
min-height: ${(props) =>
|
213
234
|
props.selectHeight
|
214
235
|
? props.selectHeight
|
@@ -219,7 +240,7 @@ const selectButton = styled('div', selectButtonAttrs)`
|
|
219
240
|
: '36px'};
|
220
241
|
display: flex;
|
221
242
|
align-items: center;
|
222
|
-
|
243
|
+
height: ${(props) => props.selectHeight};
|
223
244
|
${({ showBorder, theme, hasError }) =>
|
224
245
|
showBorder &&
|
225
246
|
`
|
@@ -244,14 +265,17 @@ const selectDropdownAttrs = {
|
|
244
265
|
selectWidth: String,
|
245
266
|
optionWidth: String,
|
246
267
|
hoveredIndex: Number,
|
268
|
+
fontSize: String,
|
269
|
+
dropdownPosition: Object,
|
247
270
|
hoveredValue: Number | String,
|
248
271
|
selectedValue: Number | String
|
249
272
|
}
|
250
273
|
const selectDropdown = styled('div', selectDropdownAttrs)`
|
251
274
|
box-sizing: border-box;
|
252
|
-
z-index:${(props) => (props.isActive ? '2' : '
|
253
|
-
position:absolute;
|
254
|
-
top:
|
275
|
+
z-index:${(props) => (props.isActive ? '2' : '99999')};
|
276
|
+
position: absolute;
|
277
|
+
top: ${(props) => props.dropdownPosition?.top}px;
|
278
|
+
left: ${(props) => props.dropdownPosition?.left}px;
|
255
279
|
border:1px solid ${(props) => props.theme.colors.grey4}
|
256
280
|
border-radius:4px;
|
257
281
|
display: flex;
|
@@ -259,7 +283,7 @@ const selectDropdown = styled('div', selectDropdownAttrs)`
|
|
259
283
|
align-items: flex-start;
|
260
284
|
padding: 0px;
|
261
285
|
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
|
262
|
-
width: ${(props) =>
|
286
|
+
width: ${(props) => props.optionWidth};
|
263
287
|
background-color:${(props) =>
|
264
288
|
props.theme.colors[props.bgColor]
|
265
289
|
? props.theme.colors[props.bgColor]
|
@@ -276,7 +300,9 @@ const selectDropdown = styled('div', selectDropdownAttrs)`
|
|
276
300
|
? props.theme.colors[props.hoveredBgColor]
|
277
301
|
: props.hoveredBgColor};
|
278
302
|
}
|
303
|
+
font-size: ${(props) => props.fontSize}
|
279
304
|
`
|
305
|
+
selectDropdown.emits = ['option-hovered', 'option-selected']
|
280
306
|
const DropdownWrapper = styled('div')`
|
281
307
|
position: relative;
|
282
308
|
`
|
@@ -289,6 +315,10 @@ const InputWrapper = styled('div', inputAttrs)`
|
|
289
315
|
grid-template-columns: ${(props) =>
|
290
316
|
props.alignItems === 'vertical' || !props.hasLabel ? '1fr' : 'auto 1fr'};
|
291
317
|
`
|
318
|
+
|
319
|
+
const DROPDOWN_HEIGHT_OFFSET = 4
|
320
|
+
const DROPDOWN_TOP_OFFSET = 21
|
321
|
+
|
292
322
|
export default {
|
293
323
|
name: 'RCselect',
|
294
324
|
|
@@ -299,7 +329,7 @@ export default {
|
|
299
329
|
},
|
300
330
|
fontSize: {
|
301
331
|
required: false,
|
302
|
-
default:
|
332
|
+
default: '13px'
|
303
333
|
},
|
304
334
|
label: {
|
305
335
|
required: false
|
@@ -401,6 +431,10 @@ export default {
|
|
401
431
|
dataId: {
|
402
432
|
type: String,
|
403
433
|
default: ''
|
434
|
+
},
|
435
|
+
hasSelectButtonPadding: {
|
436
|
+
type: Boolean,
|
437
|
+
default: true
|
404
438
|
}
|
405
439
|
},
|
406
440
|
|
@@ -418,7 +452,8 @@ export default {
|
|
418
452
|
icon,
|
419
453
|
Caret,
|
420
454
|
Selector,
|
421
|
-
inputText
|
455
|
+
inputText,
|
456
|
+
Teleport
|
422
457
|
},
|
423
458
|
|
424
459
|
data() {
|
@@ -428,23 +463,38 @@ export default {
|
|
428
463
|
isActive: false,
|
429
464
|
textSearch: '',
|
430
465
|
hoveredIndex: 0,
|
431
|
-
|
432
|
-
|
466
|
+
isClickOutsideActive: false,
|
467
|
+
dropdownPosition: {
|
468
|
+
left: null,
|
469
|
+
top: null
|
470
|
+
},
|
471
|
+
dropdownWidth: null,
|
472
|
+
hoveredValue: null
|
433
473
|
}
|
434
474
|
},
|
435
475
|
mounted() {
|
476
|
+
this.observeDropdownHeight()
|
477
|
+
this.observeSelectWidth()
|
478
|
+
window.addEventListener('resize', this.handleSetDropdownOffet)
|
479
|
+
},
|
480
|
+
beforeMount() {
|
436
481
|
this.selectedValue = this.value
|
437
482
|
document.addEventListener('click', this.clickOutside)
|
483
|
+
this.getDropdownPosition()
|
484
|
+
window.removeEventListener('resize', this.handleSetDropdownOffet)
|
485
|
+
if (this.dropdownResizeObserver) this.dropdownResizeObserver.disconnect()
|
486
|
+
if (this.selectResizeObserver) this.selectResizeObserver.disconnect()
|
438
487
|
},
|
439
|
-
|
488
|
+
unmounted() {
|
440
489
|
document.removeEventListener('click', this.clickOutside)
|
441
490
|
},
|
442
491
|
methods: {
|
443
492
|
focus() {
|
444
493
|
this.isActive = true
|
445
494
|
},
|
446
|
-
blur() {
|
495
|
+
blur(e) {
|
447
496
|
this.isActive = false
|
497
|
+
this.$emit('blur', e)
|
448
498
|
},
|
449
499
|
toggleDropdown() {
|
450
500
|
this.isDropdownOpen = !this.isDropdownOpen
|
@@ -460,6 +510,9 @@ export default {
|
|
460
510
|
this.blur()
|
461
511
|
this.isDropdownOpen = false
|
462
512
|
},
|
513
|
+
clearSearch() {
|
514
|
+
this.textSearch = ''
|
515
|
+
},
|
463
516
|
optionSelected(e) {
|
464
517
|
this.selectedValue = e
|
465
518
|
this.closeDropdown()
|
@@ -488,15 +541,15 @@ export default {
|
|
488
541
|
searchChange(value) {
|
489
542
|
this.textSearch = value
|
490
543
|
this.$emit('search-change', value)
|
491
|
-
this.$refs.dropdown.$children
|
492
|
-
|
493
|
-
.
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
544
|
+
const dropdownChildren = [...this.$refs.dropdown.$el.children]
|
545
|
+
dropdownChildren.forEach((el) => {
|
546
|
+
if (!el.textContent.toLowerCase().includes(value.toLowerCase())) {
|
547
|
+
el.style.display = 'none'
|
548
|
+
|
549
|
+
return
|
550
|
+
}
|
551
|
+
el.style.display = 'inherit'
|
552
|
+
})
|
500
553
|
},
|
501
554
|
onSelectSlotClick() {
|
502
555
|
this.toggleDropdown()
|
@@ -509,6 +562,7 @@ export default {
|
|
509
562
|
if (
|
510
563
|
this.$refs.select.$el == event.target ||
|
511
564
|
this.$refs.select.$el.contains(event.target) ||
|
565
|
+
event.target.id === 'more-button' ||
|
512
566
|
event.target.parentNode === dropdownRef.$el
|
513
567
|
) {
|
514
568
|
return
|
@@ -522,13 +576,92 @@ export default {
|
|
522
576
|
} else if (e.key == 'ArrowUp') {
|
523
577
|
this.onArrowPress(-1)
|
524
578
|
} else if (e.key == 'Enter') {
|
525
|
-
const optionHoveredComponent =
|
526
|
-
this
|
527
|
-
|
528
|
-
]
|
579
|
+
const optionHoveredComponent = [...this.$refs.dropdown.$el.children][
|
580
|
+
(this.hoveredIndex - 1 + this.optionLength) % this.optionLength
|
581
|
+
]
|
529
582
|
this.optionSelected(optionHoveredComponent.$el.dataset.value)
|
530
583
|
}
|
531
584
|
},
|
585
|
+
// If some part of the dropdown menu is outside viewport of the bottom of the screen,
|
586
|
+
// we need to offset it and display it at the top of the select dropdown instead
|
587
|
+
async getDropdownPosition() {
|
588
|
+
if (
|
589
|
+
!this.$refs.dropdownWrapperRef ||
|
590
|
+
!this.$refs.select ||
|
591
|
+
!this.$refs.dropdown
|
592
|
+
) {
|
593
|
+
return
|
594
|
+
}
|
595
|
+
await this.$nextTick()
|
596
|
+
const isDisplayedAtBottom = await this.generateDropdownPosition()
|
597
|
+
await this.$nextTick()
|
598
|
+
// If the dropdown menu is going to be displayed at the bottom,
|
599
|
+
// we need reverify its position after a dom update (nextTick)
|
600
|
+
if (isDisplayedAtBottom) this.generateDropdownPosition()
|
601
|
+
},
|
602
|
+
async generateDropdownPosition() {
|
603
|
+
const isDropdownNotCompletelyVisible =
|
604
|
+
await this.isBottomOfDropdownOutOfViewport()
|
605
|
+
const dropdownWrapperEl = this.$refs.dropdownWrapperRef.$el
|
606
|
+
const selectButtonHeight = this.$refs.select.$el.clientHeight
|
607
|
+
const dropdownHeight = this.$refs.dropdown.$el.clientHeight
|
608
|
+
const dropdownWrapperRelativeHeight =
|
609
|
+
dropdownWrapperEl.getBoundingClientRect().top +
|
610
|
+
window.scrollY +
|
611
|
+
DROPDOWN_HEIGHT_OFFSET
|
612
|
+
|
613
|
+
const top = isDropdownNotCompletelyVisible
|
614
|
+
? dropdownWrapperRelativeHeight
|
615
|
+
: dropdownWrapperRelativeHeight -
|
616
|
+
dropdownHeight -
|
617
|
+
selectButtonHeight -
|
618
|
+
DROPDOWN_TOP_OFFSET
|
619
|
+
const left = this.dropdownPosition.left
|
620
|
+
? this.dropdownPosition.left
|
621
|
+
: dropdownWrapperEl.getBoundingClientRect().left + window.scrollX
|
622
|
+
|
623
|
+
this.dropdownPosition = { left: Math.floor(left), top: Math.floor(top) }
|
624
|
+
|
625
|
+
return isDropdownNotCompletelyVisible
|
626
|
+
},
|
627
|
+
async isBottomOfDropdownOutOfViewport() {
|
628
|
+
if (!this.$refs.dropdown) {
|
629
|
+
return false
|
630
|
+
}
|
631
|
+
await this.$nextTick()
|
632
|
+
const rect = this.$refs.dropdown.$el.getBoundingClientRect()
|
633
|
+
const windowHeight =
|
634
|
+
window.innerHeight || document.documentElement.clientHeight
|
635
|
+
|
636
|
+
// using Math.floor because the offsets may contain decimals we are not going to consider here
|
637
|
+
return Math.floor(rect.top) + Math.floor(rect.height) <= windowHeight
|
638
|
+
},
|
639
|
+
observeDropdownHeight() {
|
640
|
+
if (!this.$refs.dropdown) return
|
641
|
+
this.dropdownResizeObserver = new ResizeObserver(() => {
|
642
|
+
this.$nextTick(() => this.getDropdownPosition())
|
643
|
+
})
|
644
|
+
this.dropdownResizeObserver.observe(this.$refs.dropdown.$el)
|
645
|
+
},
|
646
|
+
handleSetDropdownOffet() {
|
647
|
+
if (!this.$refs.select) return
|
648
|
+
this.dropdownPosition.left = Math.floor(
|
649
|
+
this.$refs.select.$el.getBoundingClientRect().left
|
650
|
+
)
|
651
|
+
this.getDropdownWidth()
|
652
|
+
},
|
653
|
+
observeSelectWidth() {
|
654
|
+
if (!this.$refs.select) return
|
655
|
+
this.selectResizeObserver = new ResizeObserver(() =>
|
656
|
+
this.$nextTick(() => this.getDropdownWidth())
|
657
|
+
)
|
658
|
+
this.selectResizeObserver.observe(this.$refs.dropdown.$el)
|
659
|
+
},
|
660
|
+
async getDropdownWidth() {
|
661
|
+
if (!this.$refs.select) return
|
662
|
+
await this.$nextTick()
|
663
|
+
this.dropdownWidth = `${this.$refs.select.$el.clientWidth}px`
|
664
|
+
},
|
532
665
|
onArrowPress(dir) {
|
533
666
|
let newHoveredElem
|
534
667
|
const currentHoveredElem = this.$refs.dropdown.$el.querySelector(
|
@@ -551,34 +684,36 @@ export default {
|
|
551
684
|
computed: {
|
552
685
|
optionLength() {
|
553
686
|
if (this.isDropdownOpen) {
|
554
|
-
|
555
|
-
const filterRef =
|
556
|
-
this.$refs.dropdown.$children &&
|
557
|
-
this.$refs.dropdown.$children.length > 1
|
558
|
-
? this.$refs.dropdown.$children
|
559
|
-
: this.$refs.dropdown.$children[0].$children
|
560
|
-
? this.$refs.dropdown.$children[0].$children
|
561
|
-
: this.$refs.dropdown.$children
|
562
|
-
return filterRef.length
|
687
|
+
return this.$refs.dropdown.$el.childElementCount
|
563
688
|
} else {
|
564
689
|
return 0
|
565
690
|
}
|
566
691
|
},
|
567
692
|
isSearchBarVisible() {
|
568
693
|
return this.isSearchable && this.optionLength >= 5 && this.isDropdownOpen
|
694
|
+
},
|
695
|
+
getOptionWidth() {
|
696
|
+
if (this.optionWidth) return this.optionWidth
|
697
|
+
|
698
|
+
return this.dropdownWidth
|
699
|
+
},
|
700
|
+
isSelectDropdownShown() {
|
701
|
+
return this.isDropdownOpen && this.dropdownPosition.left !== null
|
569
702
|
}
|
570
703
|
},
|
571
704
|
watch: {
|
572
705
|
value(val) {
|
573
706
|
this.selectedValue = val
|
574
707
|
},
|
575
|
-
isDropdownOpen(val) {
|
576
|
-
this.$emit('is-dropdown-open', val)
|
708
|
+
async isDropdownOpen(val) {
|
577
709
|
if (val) {
|
578
710
|
setTimeout(() => {
|
579
711
|
this.isClickOutsideActive = true
|
580
712
|
}, 10)
|
713
|
+
await this.$nextTick()
|
714
|
+
this.handleSetDropdownOffet()
|
581
715
|
} else {
|
716
|
+
this.dropdownPosition.left = null
|
582
717
|
setTimeout(() => {
|
583
718
|
this.isClickOutsideActive = false
|
584
719
|
}, 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
|
|