@eturnity/eturnity_reusable_components 7.12.5 → 7.12.6-EPDM-7951.0
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 +6 -9
- 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 +195 -55
- 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"
|
@@ -61,7 +63,7 @@
|
|
61
63
|
:value="textSearch"
|
62
64
|
@keydown.stop="onKeyDown"
|
63
65
|
@input-change="searchChange"
|
64
|
-
@click.
|
66
|
+
@click.stop
|
65
67
|
/>
|
66
68
|
<selector v-else :selectWidth="selectWidth" :paddingLeft="paddingLeft">
|
67
69
|
<slot name="selector" :selectedValue="selectedValue"></slot>
|
@@ -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'
|
@@ -159,7 +170,7 @@ const Caret = styled.div`
|
|
159
170
|
`
|
160
171
|
|
161
172
|
const Selector = styled('div', { selectWidth: String, paddingLeft: String })`
|
162
|
-
|
173
|
+
width: ${(props) => `calc(${props.selectWidth} - (${CARET_WIDTH} + ${props.paddingLeft} + (${BORDER_WIDTH} * 2)))`};
|
163
174
|
white-space: nowrap;
|
164
175
|
text-overflow: ellipsis;
|
165
176
|
overflow: hidden;
|
@@ -177,7 +188,10 @@ const InputLabel = styled('div', labelAttrs)`
|
|
177
188
|
const optionalLabel = styled.span`
|
178
189
|
font-weight: 300;
|
179
190
|
`
|
180
|
-
const inputProps = {
|
191
|
+
const inputProps = {
|
192
|
+
selectWidth: String,
|
193
|
+
optionWidth: String
|
194
|
+
}
|
181
195
|
const Container = styled('div', inputProps)`
|
182
196
|
width: ${(props) => props.selectWidth};
|
183
197
|
position: relative;
|
@@ -204,9 +218,10 @@ const selectButtonAttrs = {
|
|
204
218
|
hasError: Boolean,
|
205
219
|
disabled: Boolean,
|
206
220
|
selectHeight: String,
|
221
|
+
selectWidth: String,
|
207
222
|
height: String,
|
208
223
|
selectMinHeight: String,
|
209
|
-
|
224
|
+
hasNoPadding: Boolean,
|
210
225
|
showBorder: Boolean,
|
211
226
|
paddingLeft: String
|
212
227
|
}
|
@@ -214,7 +229,8 @@ const selectButton = styled('div', selectButtonAttrs)`
|
|
214
229
|
position: relative;
|
215
230
|
box-sizing: border-box;
|
216
231
|
border-radius: 4px;
|
217
|
-
${(props) => (props.
|
232
|
+
max-width: ${(props) => (props.selectWidth ? props.selectWidth : '100%')};
|
233
|
+
${(props) => (props.hasNoPadding ? '' : `padding-left: ${props.paddingLeft}` )};
|
218
234
|
text-align: left;
|
219
235
|
min-height: ${(props) =>
|
220
236
|
props.selectHeight
|
@@ -226,7 +242,7 @@ const selectButton = styled('div', selectButtonAttrs)`
|
|
226
242
|
: '36px'};
|
227
243
|
display: flex;
|
228
244
|
align-items: center;
|
229
|
-
|
245
|
+
height: ${(props) => props.selectHeight};
|
230
246
|
${({ showBorder, theme, hasError }) =>
|
231
247
|
showBorder &&
|
232
248
|
`
|
@@ -244,8 +260,10 @@ const selectButton = styled('div', selectButtonAttrs)`
|
|
244
260
|
: props.fontColor};
|
245
261
|
${(props) => (props.disabled ? 'pointer-events: none' : '')};
|
246
262
|
overflow: hidden;
|
247
|
-
&
|
248
|
-
border-right
|
263
|
+
& > .handle {
|
264
|
+
border-right: ${(props) =>
|
265
|
+
props.hasError ? props.theme.colors.red : props.theme.colors.grey4}
|
266
|
+
1px solid;
|
249
267
|
}
|
250
268
|
`
|
251
269
|
const selectDropdownAttrs = {
|
@@ -254,14 +272,17 @@ const selectDropdownAttrs = {
|
|
254
272
|
fontColor: String,
|
255
273
|
optionWidth: String,
|
256
274
|
hoveredIndex: Number,
|
275
|
+
fontSize: String,
|
276
|
+
dropdownPosition: Object,
|
257
277
|
hoveredValue: Number | String,
|
258
278
|
selectedValue: Number | String
|
259
279
|
}
|
260
280
|
const selectDropdown = styled('div', selectDropdownAttrs)`
|
261
281
|
box-sizing: border-box;
|
262
|
-
z-index:${(props) => (props.isActive ? '2' : '
|
282
|
+
z-index:${(props) => (props.isActive ? '2' : '99999')};
|
263
283
|
position:absolute;
|
264
|
-
top:
|
284
|
+
top: ${(props) => props.dropdownPosition?.top}px;
|
285
|
+
left: ${(props) => props.dropdownPosition?.left}px;
|
265
286
|
border: ${BORDER_WIDTH} solid ${(props) => props.theme.colors.grey4};
|
266
287
|
border-radius:4px;
|
267
288
|
display: flex;
|
@@ -269,7 +290,7 @@ const selectDropdown = styled('div', selectDropdownAttrs)`
|
|
269
290
|
align-items: flex-start;
|
270
291
|
padding: 0px;
|
271
292
|
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
|
272
|
-
width: ${(props) =>
|
293
|
+
width: ${(props) => props.optionWidth};
|
273
294
|
background-color:${(props) =>
|
274
295
|
props.theme.colors[props.bgColor]
|
275
296
|
? props.theme.colors[props.bgColor]
|
@@ -286,7 +307,9 @@ const selectDropdown = styled('div', selectDropdownAttrs)`
|
|
286
307
|
? props.theme.colors[props.hoveredBgColor]
|
287
308
|
: props.hoveredBgColor};
|
288
309
|
}
|
310
|
+
font-size: ${(props) => props.fontSize}
|
289
311
|
`
|
312
|
+
selectDropdown.emits = ['option-hovered', 'option-selected']
|
290
313
|
const DropdownWrapper = styled('div')`
|
291
314
|
position: relative;
|
292
315
|
`
|
@@ -299,6 +322,10 @@ const InputWrapper = styled('div', inputAttrs)`
|
|
299
322
|
grid-template-columns: ${(props) =>
|
300
323
|
props.alignItems === 'vertical' || !props.hasLabel ? '1fr' : 'auto 1fr'};
|
301
324
|
`
|
325
|
+
|
326
|
+
const DROPDOWN_HEIGHT_OFFSET = 4
|
327
|
+
const DROPDOWN_TOP_OFFSET = 21
|
328
|
+
|
302
329
|
export default {
|
303
330
|
name: 'RCselect',
|
304
331
|
|
@@ -410,6 +437,10 @@ export default {
|
|
410
437
|
type: String,
|
411
438
|
default: ''
|
412
439
|
},
|
440
|
+
hasSelectButtonPadding: {
|
441
|
+
type: Boolean,
|
442
|
+
default: true
|
443
|
+
},
|
413
444
|
isDraggable: {
|
414
445
|
type: Boolean,
|
415
446
|
default: false
|
@@ -431,6 +462,7 @@ export default {
|
|
431
462
|
Caret,
|
432
463
|
Selector,
|
433
464
|
inputText,
|
465
|
+
Teleport,
|
434
466
|
draggableInputHandle
|
435
467
|
},
|
436
468
|
|
@@ -442,23 +474,38 @@ export default {
|
|
442
474
|
isActive: false,
|
443
475
|
textSearch: '',
|
444
476
|
hoveredIndex: 0,
|
445
|
-
|
446
|
-
|
477
|
+
isClickOutsideActive: false,
|
478
|
+
dropdownPosition: {
|
479
|
+
left: null,
|
480
|
+
top: null
|
481
|
+
},
|
482
|
+
dropdownWidth: null,
|
483
|
+
hoveredValue: null
|
447
484
|
}
|
448
485
|
},
|
449
486
|
mounted() {
|
487
|
+
this.observeDropdownHeight()
|
488
|
+
this.observeSelectWidth()
|
489
|
+
window.addEventListener('resize', this.handleSetDropdownOffet)
|
490
|
+
},
|
491
|
+
beforeMount() {
|
450
492
|
this.selectedValue = this.value
|
451
493
|
document.addEventListener('click', this.clickOutside)
|
494
|
+
this.getDropdownPosition()
|
495
|
+
window.removeEventListener('resize', this.handleSetDropdownOffet)
|
496
|
+
if (this.dropdownResizeObserver) this.dropdownResizeObserver.disconnect()
|
497
|
+
if (this.selectResizeObserver) this.selectResizeObserver.disconnect()
|
452
498
|
},
|
453
|
-
|
499
|
+
unmounted() {
|
454
500
|
document.removeEventListener('click', this.clickOutside)
|
455
501
|
},
|
456
502
|
methods: {
|
457
503
|
focus() {
|
458
504
|
this.isActive = true
|
459
505
|
},
|
460
|
-
blur() {
|
506
|
+
blur(e) {
|
461
507
|
this.isActive = false
|
508
|
+
this.$emit('blur', e)
|
462
509
|
},
|
463
510
|
toggleDropdown() {
|
464
511
|
this.isDropdownOpen = !this.isDropdownOpen
|
@@ -474,6 +521,9 @@ export default {
|
|
474
521
|
this.blur()
|
475
522
|
this.isDropdownOpen = false
|
476
523
|
},
|
524
|
+
clearSearch() {
|
525
|
+
this.textSearch = ''
|
526
|
+
},
|
477
527
|
optionSelected(e) {
|
478
528
|
this.selectedValue = e
|
479
529
|
this.closeDropdown()
|
@@ -502,15 +552,15 @@ export default {
|
|
502
552
|
searchChange(value) {
|
503
553
|
this.textSearch = value
|
504
554
|
this.$emit('search-change', value)
|
505
|
-
this.$refs.dropdown.$children
|
506
|
-
|
507
|
-
.
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
555
|
+
const dropdownChildren = [...this.$refs.dropdown.$el.children]
|
556
|
+
dropdownChildren.forEach((el) => {
|
557
|
+
if (!el.textContent.toLowerCase().includes(value.toLowerCase())) {
|
558
|
+
el.style.display = 'none'
|
559
|
+
|
560
|
+
return
|
561
|
+
}
|
562
|
+
el.style.display = 'inherit'
|
563
|
+
})
|
514
564
|
},
|
515
565
|
clickOutside(event) {
|
516
566
|
const dropdownRef = this.$refs.dropdown
|
@@ -520,6 +570,7 @@ export default {
|
|
520
570
|
if (
|
521
571
|
this.$refs.select.$el == event.target ||
|
522
572
|
this.$refs.select.$el.contains(event.target) ||
|
573
|
+
event.target.id === 'more-button' ||
|
523
574
|
event.target.parentNode === dropdownRef.$el
|
524
575
|
) {
|
525
576
|
return
|
@@ -533,13 +584,92 @@ export default {
|
|
533
584
|
} else if (e.key == 'ArrowUp') {
|
534
585
|
this.onArrowPress(-1)
|
535
586
|
} else if (e.key == 'Enter') {
|
536
|
-
const optionHoveredComponent =
|
537
|
-
this
|
538
|
-
|
539
|
-
]
|
587
|
+
const optionHoveredComponent = [...this.$refs.dropdown.$el.children][
|
588
|
+
(this.hoveredIndex - 1 + this.optionLength) % this.optionLength
|
589
|
+
]
|
540
590
|
this.optionSelected(optionHoveredComponent.$el.dataset.value)
|
541
591
|
}
|
542
592
|
},
|
593
|
+
// If some part of the dropdown menu is outside viewport of the bottom of the screen,
|
594
|
+
// we need to offset it and display it at the top of the select dropdown instead
|
595
|
+
async getDropdownPosition() {
|
596
|
+
if (
|
597
|
+
!this.$refs.dropdownWrapperRef ||
|
598
|
+
!this.$refs.select ||
|
599
|
+
!this.$refs.dropdown
|
600
|
+
) {
|
601
|
+
return
|
602
|
+
}
|
603
|
+
await this.$nextTick()
|
604
|
+
const isDisplayedAtBottom = await this.generateDropdownPosition()
|
605
|
+
await this.$nextTick()
|
606
|
+
// If the dropdown menu is going to be displayed at the bottom,
|
607
|
+
// we need reverify its position after a dom update (nextTick)
|
608
|
+
if (isDisplayedAtBottom) this.generateDropdownPosition()
|
609
|
+
},
|
610
|
+
async generateDropdownPosition() {
|
611
|
+
const isDropdownNotCompletelyVisible =
|
612
|
+
await this.isBottomOfDropdownOutOfViewport()
|
613
|
+
const dropdownWrapperEl = this.$refs.dropdownWrapperRef.$el
|
614
|
+
const selectButtonHeight = this.$refs.select.$el.clientHeight
|
615
|
+
const dropdownHeight = this.$refs.dropdown.$el.clientHeight
|
616
|
+
const dropdownWrapperRelativeHeight =
|
617
|
+
dropdownWrapperEl.getBoundingClientRect().top +
|
618
|
+
window.scrollY +
|
619
|
+
DROPDOWN_HEIGHT_OFFSET
|
620
|
+
|
621
|
+
const top = isDropdownNotCompletelyVisible
|
622
|
+
? dropdownWrapperRelativeHeight
|
623
|
+
: dropdownWrapperRelativeHeight -
|
624
|
+
dropdownHeight -
|
625
|
+
selectButtonHeight -
|
626
|
+
DROPDOWN_TOP_OFFSET
|
627
|
+
const left = this.dropdownPosition.left
|
628
|
+
? this.dropdownPosition.left
|
629
|
+
: dropdownWrapperEl.getBoundingClientRect().left + window.scrollX
|
630
|
+
|
631
|
+
this.dropdownPosition = { left: Math.floor(left), top: Math.floor(top) }
|
632
|
+
|
633
|
+
return isDropdownNotCompletelyVisible
|
634
|
+
},
|
635
|
+
async isBottomOfDropdownOutOfViewport() {
|
636
|
+
if (!this.$refs.dropdown) {
|
637
|
+
return false
|
638
|
+
}
|
639
|
+
await this.$nextTick()
|
640
|
+
const rect = this.$refs.dropdown.$el.getBoundingClientRect()
|
641
|
+
const windowHeight =
|
642
|
+
window.innerHeight || document.documentElement.clientHeight
|
643
|
+
|
644
|
+
// using Math.floor because the offsets may contain decimals we are not going to consider here
|
645
|
+
return Math.floor(rect.top) + Math.floor(rect.height) <= windowHeight
|
646
|
+
},
|
647
|
+
observeDropdownHeight() {
|
648
|
+
if (!this.$refs.dropdown) return
|
649
|
+
this.dropdownResizeObserver = new ResizeObserver(() => {
|
650
|
+
this.$nextTick(() => this.getDropdownPosition())
|
651
|
+
})
|
652
|
+
this.dropdownResizeObserver.observe(this.$refs.dropdown.$el)
|
653
|
+
},
|
654
|
+
handleSetDropdownOffet() {
|
655
|
+
if (!this.$refs.select) return
|
656
|
+
this.dropdownPosition.left = Math.floor(
|
657
|
+
this.$refs.select.$el.getBoundingClientRect().left
|
658
|
+
)
|
659
|
+
this.getDropdownWidth()
|
660
|
+
},
|
661
|
+
observeSelectWidth() {
|
662
|
+
if (!this.$refs.select) return
|
663
|
+
this.selectResizeObserver = new ResizeObserver(() =>
|
664
|
+
this.$nextTick(() => this.getDropdownWidth())
|
665
|
+
)
|
666
|
+
this.selectResizeObserver.observe(this.$refs.dropdown.$el)
|
667
|
+
},
|
668
|
+
async getDropdownWidth() {
|
669
|
+
if (!this.$refs.select) return
|
670
|
+
await this.$nextTick()
|
671
|
+
this.dropdownWidth = `${this.$refs.select.$el.clientWidth}px`
|
672
|
+
},
|
543
673
|
onArrowPress(dir) {
|
544
674
|
let newHoveredElem
|
545
675
|
const currentHoveredElem = this.$refs.dropdown.$el.querySelector(
|
@@ -571,20 +701,30 @@ export default {
|
|
571
701
|
return 0
|
572
702
|
},
|
573
703
|
isSearchBarVisible() {
|
574
|
-
return this.isSearchable && this.isDropdownOpen
|
704
|
+
return this.isSearchable && this.optionLength >= 5 && this.isDropdownOpen
|
705
|
+
},
|
706
|
+
getOptionWidth() {
|
707
|
+
if (this.optionWidth) return this.optionWidth
|
708
|
+
|
709
|
+
return this.dropdownWidth
|
710
|
+
},
|
711
|
+
isSelectDropdownShown() {
|
712
|
+
return this.isSearchable && this.isDropdownOpen && this.dropdownPosition.left !== null
|
575
713
|
}
|
576
714
|
},
|
577
715
|
watch: {
|
578
716
|
value(val) {
|
579
717
|
this.selectedValue = val
|
580
718
|
},
|
581
|
-
isDropdownOpen(val) {
|
582
|
-
this.$emit('is-dropdown-open', val)
|
719
|
+
async isDropdownOpen(val) {
|
583
720
|
if (val) {
|
584
721
|
setTimeout(() => {
|
585
722
|
this.isClickOutsideActive = true
|
586
723
|
}, 10)
|
724
|
+
await this.$nextTick()
|
725
|
+
this.handleSetDropdownOffet()
|
587
726
|
} else {
|
727
|
+
this.dropdownPosition.left = null
|
588
728
|
setTimeout(() => {
|
589
729
|
this.isClickOutsideActive = false
|
590
730
|
}, 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`
|