@eturnity/eturnity_reusable_components 7.12.6-EPDM-7951.1 → 7.12.6-EPDM-10310.1
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 +23 -18
- package/src/App.vue +2 -2
- package/src/components/addNewButton/index.vue +3 -5
- 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 +1 -6
- package/src/components/deleteIcon/DeleteIcon.stories.js +7 -7
- package/src/components/deleteIcon/index.vue +21 -25
- package/src/components/draggableInputHandle/index.vue +25 -24
- package/src/components/dropdown/index.vue +110 -129
- package/src/components/errorMessage/index.vue +1 -1
- package/src/components/filter/filterSettings.vue +97 -55
- 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 +54 -60
- package/src/components/iconWrapper/index.vue +4 -1
- package/src/components/infoCard/index.vue +3 -2
- package/src/components/infoText/index.vue +1 -1
- package/src/components/inputs/checkbox/index.vue +6 -21
- package/src/components/inputs/inputNumber/index.vue +11 -8
- 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 +8 -7
- package/src/components/inputs/select/index.vue +106 -220
- 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 +31 -27
- package/src/components/modals/modal/index.vue +6 -2
- package/src/components/navigationTabs/index.vue +20 -27
- 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 +7 -10
- package/src/components/sideMenu/index.vue +1 -1
- package/src/components/spinner/index.vue +11 -6
- package/src/components/tableDropdown/index.vue +26 -21
- package/src/components/tables/mainTable/exampleNested.vue +1 -1
- package/src/components/tables/mainTable/index.vue +1 -2
- package/src/components/tables/viewTable/index.vue +2 -2
- package/src/components/threeDots/index.vue +1 -1
- package/src/components/videoThumbnail/index.vue +100 -95
- package/src/main.js +11 -4
@@ -13,7 +13,10 @@
|
|
13
13
|
:hasFocus="hasFocus"
|
14
14
|
:data-id="dataId"
|
15
15
|
/>
|
16
|
-
<
|
16
|
+
<img
|
17
|
+
class="search-icn"
|
18
|
+
:src="require('../../../assets/icons/search_icon_black.svg')"
|
19
|
+
/>
|
17
20
|
</input-wrapper>
|
18
21
|
</container>
|
19
22
|
</template>
|
@@ -30,8 +33,7 @@
|
|
30
33
|
// :isFilter="true" // to set the height at 30px
|
31
34
|
// data-id="test-data-id"
|
32
35
|
// />
|
33
|
-
import styled from '
|
34
|
-
import SearchIconSvg from '../../../assets/icons/search_icon_black.svg'
|
36
|
+
import styled from 'vue-styled-components'
|
35
37
|
|
36
38
|
const inputAttrs = {
|
37
39
|
isDisabled: Boolean,
|
@@ -66,7 +68,7 @@ const InputContainer = styled('input', inputAttrs)`
|
|
66
68
|
const InputWrapper = styled.span`
|
67
69
|
position: relative;
|
68
70
|
|
69
|
-
|
71
|
+
img {
|
70
72
|
position: absolute;
|
71
73
|
right: 10px;
|
72
74
|
top: 50%;
|
@@ -79,8 +81,7 @@ export default {
|
|
79
81
|
components: {
|
80
82
|
InputContainer,
|
81
83
|
InputWrapper,
|
82
|
-
Container
|
83
|
-
SearchIconSvg
|
84
|
+
Container
|
84
85
|
},
|
85
86
|
props: {
|
86
87
|
value: {
|
@@ -113,7 +114,7 @@ export default {
|
|
113
114
|
},
|
114
115
|
methods: {
|
115
116
|
onChangeHandler(event) {
|
116
|
-
this.$emit('on-change', event
|
117
|
+
this.$emit('on-change', event)
|
117
118
|
},
|
118
119
|
focusInputElement() {
|
119
120
|
this.$nextTick(() => {
|
@@ -28,9 +28,7 @@
|
|
28
28
|
<select-button-wrapper :disabled="disabled">
|
29
29
|
<selectButton
|
30
30
|
ref="select"
|
31
|
-
class="select-button"
|
32
31
|
@click="toggleDropdown"
|
33
|
-
:selectWidth="selectWidth"
|
34
32
|
:selectHeight="selectHeight"
|
35
33
|
:height="height"
|
36
34
|
:selectMinHeight="selectMinHeight"
|
@@ -41,14 +39,17 @@
|
|
41
39
|
buttonFontColor || colorMode == 'dark' ? 'white' : 'black'
|
42
40
|
"
|
43
41
|
:hasError="hasError"
|
44
|
-
:
|
42
|
+
:isSearchBarVisible="isSearchBarVisible"
|
45
43
|
:disabled="disabled"
|
46
|
-
@keydown="onKeyDown"
|
44
|
+
@keydown.native="onKeyDown"
|
47
45
|
:showBorder="showBorder"
|
48
46
|
:data-id="dataId"
|
49
47
|
:paddingLeft="paddingLeft"
|
50
48
|
>
|
51
|
-
<draggableInputHandle
|
49
|
+
<draggableInputHandle
|
50
|
+
v-if="isDraggable && !isSearchBarVisible"
|
51
|
+
:height="selectHeight"
|
52
|
+
/>
|
52
53
|
<inputText
|
53
54
|
v-if="isSearchBarVisible"
|
54
55
|
ref="searchInput"
|
@@ -63,9 +64,14 @@
|
|
63
64
|
:value="textSearch"
|
64
65
|
@keydown.stop="onKeyDown"
|
65
66
|
@input-change="searchChange"
|
66
|
-
@click.stop
|
67
|
+
@click.native.stop
|
67
68
|
/>
|
68
|
-
<selector
|
69
|
+
<selector
|
70
|
+
v-else
|
71
|
+
:showBorder="showBorder"
|
72
|
+
:selectWidth="selectWidth"
|
73
|
+
:paddingLeft="paddingLeft"
|
74
|
+
>
|
69
75
|
<slot name="selector" :selectedValue="selectedValue"></slot>
|
70
76
|
</selector>
|
71
77
|
<Caret @click.stop="toggleCaretDropdown">
|
@@ -91,33 +97,26 @@
|
|
91
97
|
/>
|
92
98
|
</Caret>
|
93
99
|
</selectButton>
|
94
|
-
<DropdownWrapper
|
95
|
-
<
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
:selectedValue="selectedValue"
|
115
|
-
@option-selected="optionSelected"
|
116
|
-
@option-hovered="optionHovered"
|
117
|
-
>
|
118
|
-
<slot name="dropdown"></slot>
|
119
|
-
</selectDropdown>
|
120
|
-
</Teleport>
|
100
|
+
<DropdownWrapper>
|
101
|
+
<selectDropdown
|
102
|
+
ref="dropdown"
|
103
|
+
v-show="isDropdownOpen"
|
104
|
+
:hoveredIndex="hoveredIndex"
|
105
|
+
:hoveredValue="hoveredValue"
|
106
|
+
:isActive="isActive"
|
107
|
+
:optionWidth="optionWidth"
|
108
|
+
:hoveredBgColor="colorMode == 'dark' ? '#000000' : dropdownBgColor"
|
109
|
+
:bgColor="colorMode == 'dark' ? 'black' : dropdownBgColor"
|
110
|
+
:fontColor="
|
111
|
+
dropdownFontColor || colorMode == 'dark' ? 'white' : 'black'
|
112
|
+
"
|
113
|
+
:selectedValue="selectedValue"
|
114
|
+
@option-selected="optionSelected"
|
115
|
+
@option-hovered="optionHovered"
|
116
|
+
@mouseleave="optionLeave"
|
117
|
+
>
|
118
|
+
<slot name="dropdown"></slot>
|
119
|
+
</selectDropdown>
|
121
120
|
</DropdownWrapper>
|
122
121
|
</select-button-wrapper>
|
123
122
|
</input-wrapper>
|
@@ -132,9 +131,8 @@
|
|
132
131
|
// optionWidth="50%"
|
133
132
|
// label="that is a label"
|
134
133
|
// alignItems="vertical"
|
135
|
-
// label-data-id="test-
|
134
|
+
// label-data-id="test-label0data-id"
|
136
135
|
// data-id="test-data-id"
|
137
|
-
// :hasSelectButtonPadding="false"
|
138
136
|
// >
|
139
137
|
// <template #selector="{selectedValue}">
|
140
138
|
// value selected: {{selectedValue}}
|
@@ -147,8 +145,7 @@
|
|
147
145
|
// </template>
|
148
146
|
// </Select>
|
149
147
|
|
150
|
-
import
|
151
|
-
import styled from 'vue3-styled-components'
|
148
|
+
import styled from 'vue-styled-components'
|
152
149
|
import InfoText from '../../infoText'
|
153
150
|
import icon from '../../icon'
|
154
151
|
import inputText from '../inputText'
|
@@ -169,8 +166,21 @@ const Caret = styled.div`
|
|
169
166
|
margin-left: auto;
|
170
167
|
`
|
171
168
|
|
172
|
-
const
|
173
|
-
|
169
|
+
const selectorProps = {
|
170
|
+
selectWidth: String,
|
171
|
+
paddingLeft: String,
|
172
|
+
showBorder: Boolean
|
173
|
+
}
|
174
|
+
const Selector = styled('div', selectorProps)`
|
175
|
+
width: ${(props) =>
|
176
|
+
props.selectWidth === '100%' ? props.selectWidth :
|
177
|
+
`calc(${props.selectWidth} -
|
178
|
+
(
|
179
|
+
${CARET_WIDTH} +
|
180
|
+
${props.paddingLeft}
|
181
|
+
${props.showBorder ? `+ (${BORDER_WIDTH} * 2)` : ''}
|
182
|
+
)
|
183
|
+
)`};
|
174
184
|
white-space: nowrap;
|
175
185
|
text-overflow: ellipsis;
|
176
186
|
overflow: hidden;
|
@@ -188,10 +198,7 @@ const InputLabel = styled('div', labelAttrs)`
|
|
188
198
|
const optionalLabel = styled.span`
|
189
199
|
font-weight: 300;
|
190
200
|
`
|
191
|
-
const inputProps = {
|
192
|
-
selectWidth: String,
|
193
|
-
optionWidth: String
|
194
|
-
}
|
201
|
+
const inputProps = { selectWidth: String, optionWidth: String }
|
195
202
|
const Container = styled('div', inputProps)`
|
196
203
|
width: ${(props) => props.selectWidth};
|
197
204
|
position: relative;
|
@@ -218,10 +225,9 @@ const selectButtonAttrs = {
|
|
218
225
|
hasError: Boolean,
|
219
226
|
disabled: Boolean,
|
220
227
|
selectHeight: String,
|
221
|
-
selectWidth: String,
|
222
228
|
height: String,
|
223
229
|
selectMinHeight: String,
|
224
|
-
|
230
|
+
isSearchBarVisible: Boolean,
|
225
231
|
showBorder: Boolean,
|
226
232
|
paddingLeft: String
|
227
233
|
}
|
@@ -229,8 +235,8 @@ const selectButton = styled('div', selectButtonAttrs)`
|
|
229
235
|
position: relative;
|
230
236
|
box-sizing: border-box;
|
231
237
|
border-radius: 4px;
|
232
|
-
|
233
|
-
|
238
|
+
${(props) =>
|
239
|
+
props.isSearchBarVisible ? '' : `padding-left: ${props.paddingLeft}`};
|
234
240
|
text-align: left;
|
235
241
|
min-height: ${(props) =>
|
236
242
|
props.selectHeight
|
@@ -242,11 +248,13 @@ const selectButton = styled('div', selectButtonAttrs)`
|
|
242
248
|
: '36px'};
|
243
249
|
display: flex;
|
244
250
|
align-items: center;
|
245
|
-
height: ${(props) => props.selectHeight};
|
251
|
+
max-height: ${(props) => props.selectHeight};
|
246
252
|
${({ showBorder, theme, hasError }) =>
|
247
253
|
showBorder &&
|
248
254
|
`
|
249
|
-
border: ${BORDER_WIDTH} solid ${
|
255
|
+
border: ${BORDER_WIDTH} solid ${
|
256
|
+
hasError ? theme.colors.red : theme.colors.grey4
|
257
|
+
}
|
250
258
|
`}
|
251
259
|
background-color:${(props) =>
|
252
260
|
props.disabled
|
@@ -272,44 +280,39 @@ const selectDropdownAttrs = {
|
|
272
280
|
fontColor: String,
|
273
281
|
optionWidth: String,
|
274
282
|
hoveredIndex: Number,
|
275
|
-
fontSize: String,
|
276
|
-
dropdownPosition: Object,
|
277
283
|
hoveredValue: Number | String,
|
278
284
|
selectedValue: Number | String
|
279
285
|
}
|
280
286
|
const selectDropdown = styled('div', selectDropdownAttrs)`
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
props.theme.colors[props.bgColor]
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
props.theme.colors[props.fontColor]
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
}
|
310
|
-
font-size: ${(props) => props.fontSize}
|
287
|
+
box-sizing: border-box;
|
288
|
+
z-index: ${(props) => (props.isActive ? '2' : '1')};
|
289
|
+
position: absolute;
|
290
|
+
top: 5px;
|
291
|
+
border: ${BORDER_WIDTH} solid ${(props) => props.theme.colors.grey4};
|
292
|
+
border-radius: 4px;
|
293
|
+
display: flex;
|
294
|
+
flex-direction: column;
|
295
|
+
align-items: flex-start;
|
296
|
+
padding: 0px;
|
297
|
+
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
|
298
|
+
width: ${(props) => (props.optionWidth ? props.optionWidth : '100%')};
|
299
|
+
background-color: ${(props) =>
|
300
|
+
props.theme.colors[props.bgColor]
|
301
|
+
? props.theme.colors[props.bgColor]
|
302
|
+
: props.bgColor};
|
303
|
+
color: ${(props) =>
|
304
|
+
props.theme.colors[props.fontColor]
|
305
|
+
? props.theme.colors[props.fontColor]
|
306
|
+
: props.fontColor};
|
307
|
+
max-height: 300px;
|
308
|
+
overflow-y: auto;
|
309
|
+
& > div[data-value='${(props) => props.hoveredValue}'] {
|
310
|
+
background-color: ${(props) =>
|
311
|
+
props.theme.colors[props.hoveredBgColor]
|
312
|
+
? props.theme.colors[props.hoveredBgColor]
|
313
|
+
: props.hoveredBgColor};
|
314
|
+
}
|
311
315
|
`
|
312
|
-
selectDropdown.emits = ['option-hovered', 'option-selected']
|
313
316
|
const DropdownWrapper = styled('div')`
|
314
317
|
position: relative;
|
315
318
|
`
|
@@ -322,10 +325,6 @@ const InputWrapper = styled('div', inputAttrs)`
|
|
322
325
|
grid-template-columns: ${(props) =>
|
323
326
|
props.alignItems === 'vertical' || !props.hasLabel ? '1fr' : 'auto 1fr'};
|
324
327
|
`
|
325
|
-
|
326
|
-
const DROPDOWN_HEIGHT_OFFSET = 4
|
327
|
-
const DROPDOWN_TOP_OFFSET = 21
|
328
|
-
|
329
328
|
export default {
|
330
329
|
name: 'RCselect',
|
331
330
|
|
@@ -437,10 +436,6 @@ export default {
|
|
437
436
|
type: String,
|
438
437
|
default: ''
|
439
438
|
},
|
440
|
-
hasSelectButtonPadding: {
|
441
|
-
type: Boolean,
|
442
|
-
default: true
|
443
|
-
},
|
444
439
|
isDraggable: {
|
445
440
|
type: Boolean,
|
446
441
|
default: false
|
@@ -462,7 +457,6 @@ export default {
|
|
462
457
|
Caret,
|
463
458
|
Selector,
|
464
459
|
inputText,
|
465
|
-
Teleport,
|
466
460
|
draggableInputHandle
|
467
461
|
},
|
468
462
|
|
@@ -474,38 +468,23 @@ export default {
|
|
474
468
|
isActive: false,
|
475
469
|
textSearch: '',
|
476
470
|
hoveredIndex: 0,
|
477
|
-
|
478
|
-
|
479
|
-
left: null,
|
480
|
-
top: null
|
481
|
-
},
|
482
|
-
dropdownWidth: null,
|
483
|
-
hoveredValue: null
|
471
|
+
hoveredValue: null,
|
472
|
+
isClickOutsideActive: false
|
484
473
|
}
|
485
474
|
},
|
486
475
|
mounted() {
|
487
|
-
this.observeDropdownHeight()
|
488
|
-
this.observeSelectWidth()
|
489
|
-
window.addEventListener('resize', this.handleSetDropdownOffet)
|
490
|
-
},
|
491
|
-
beforeMount() {
|
492
476
|
this.selectedValue = this.value
|
493
477
|
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()
|
498
478
|
},
|
499
|
-
|
479
|
+
beforeDestroy() {
|
500
480
|
document.removeEventListener('click', this.clickOutside)
|
501
481
|
},
|
502
482
|
methods: {
|
503
483
|
focus() {
|
504
484
|
this.isActive = true
|
505
485
|
},
|
506
|
-
blur(
|
486
|
+
blur() {
|
507
487
|
this.isActive = false
|
508
|
-
this.$emit('blur', e)
|
509
488
|
},
|
510
489
|
toggleDropdown() {
|
511
490
|
this.isDropdownOpen = !this.isDropdownOpen
|
@@ -521,9 +500,6 @@ export default {
|
|
521
500
|
this.blur()
|
522
501
|
this.isDropdownOpen = false
|
523
502
|
},
|
524
|
-
clearSearch() {
|
525
|
-
this.textSearch = ''
|
526
|
-
},
|
527
503
|
optionSelected(e) {
|
528
504
|
this.selectedValue = e
|
529
505
|
this.closeDropdown()
|
@@ -552,15 +528,15 @@ export default {
|
|
552
528
|
searchChange(value) {
|
553
529
|
this.textSearch = value
|
554
530
|
this.$emit('search-change', value)
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
el.
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
531
|
+
this.$refs.dropdown.$children
|
532
|
+
.map((component) => component.$el)
|
533
|
+
.forEach((el) => {
|
534
|
+
if (!el.textContent.toLowerCase().includes(value.toLowerCase())) {
|
535
|
+
el.style.display = 'none'
|
536
|
+
} else {
|
537
|
+
el.style.display = 'inherit'
|
538
|
+
}
|
539
|
+
})
|
564
540
|
},
|
565
541
|
clickOutside(event) {
|
566
542
|
const dropdownRef = this.$refs.dropdown
|
@@ -570,7 +546,6 @@ export default {
|
|
570
546
|
if (
|
571
547
|
this.$refs.select.$el == event.target ||
|
572
548
|
this.$refs.select.$el.contains(event.target) ||
|
573
|
-
event.target.id === 'more-button' ||
|
574
549
|
event.target.parentNode === dropdownRef.$el
|
575
550
|
) {
|
576
551
|
return
|
@@ -584,92 +559,13 @@ export default {
|
|
584
559
|
} else if (e.key == 'ArrowUp') {
|
585
560
|
this.onArrowPress(-1)
|
586
561
|
} else if (e.key == 'Enter') {
|
587
|
-
const optionHoveredComponent =
|
588
|
-
|
589
|
-
|
562
|
+
const optionHoveredComponent =
|
563
|
+
this.$refs.dropdown.$children[
|
564
|
+
(this.hoveredIndex - 1 + this.optionLength) % this.optionLength
|
565
|
+
]
|
590
566
|
this.optionSelected(optionHoveredComponent.$el.dataset.value)
|
591
567
|
}
|
592
568
|
},
|
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
|
-
},
|
673
569
|
onArrowPress(dir) {
|
674
570
|
let newHoveredElem
|
675
571
|
const currentHoveredElem = this.$refs.dropdown.$el.querySelector(
|
@@ -701,30 +597,20 @@ export default {
|
|
701
597
|
return 0
|
702
598
|
},
|
703
599
|
isSearchBarVisible() {
|
704
|
-
return this.isSearchable && this.
|
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
|
600
|
+
return this.isSearchable && this.isDropdownOpen
|
713
601
|
}
|
714
602
|
},
|
715
603
|
watch: {
|
716
604
|
value(val) {
|
717
605
|
this.selectedValue = val
|
718
606
|
},
|
719
|
-
|
607
|
+
isDropdownOpen(val) {
|
608
|
+
this.$emit('is-dropdown-open', val)
|
720
609
|
if (val) {
|
721
610
|
setTimeout(() => {
|
722
611
|
this.isClickOutsideActive = true
|
723
612
|
}, 10)
|
724
|
-
await this.$nextTick()
|
725
|
-
this.handleSetDropdownOffet()
|
726
613
|
} else {
|
727
|
-
this.dropdownPosition.left = null
|
728
614
|
setTimeout(() => {
|
729
615
|
this.isClickOutsideActive = false
|
730
616
|
}, 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 'vue-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
|
+
|
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: 'cursor'
|
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() {
|
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)
|
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/dist/slider.vue2.js"
|
25
|
+
import styled from "vue-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
|
|