@eturnity/eturnity_reusable_components 6.37.0-EPDM-8148.3 → 6.37.0-EPDM-8148.5
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/package.json +6 -3
- package/postcss.config.js +6 -0
- package/src/App.vue +101 -99
- package/src/assets/svgIcons/update.svg +3 -0
- package/src/assets/theme.js +3 -3
- package/src/components/filter/filterSettings.vue +645 -0
- package/src/components/filter/index.vue +132 -0
- package/src/components/filter/parentDropdown.vue +91 -0
- package/src/components/iconWrapper/index.vue +11 -12
- package/src/components/inputs/inputNumber/index.vue +14 -0
- package/src/components/inputs/searchInput/index.vue +20 -10
- package/src/components/inputs/select/index.vue +43 -29
- package/src/components/inputs/select/option/index.vue +5 -1
- package/src/components/tableDropdown/index.vue +9 -18
- package/src/components/tables/mainTable/index.vue +69 -6
- package/src/components/threeDots/index.vue +7 -13
- package/src/helpers/numberConverter.js +5 -14
- package/src/helpers/translateLang.js +14 -0
@@ -0,0 +1,132 @@
|
|
1
|
+
<template>
|
2
|
+
<page-wrapper ref="dropdown">
|
3
|
+
<parent-dropdown
|
4
|
+
@on-toggle="onToggleDropdown()"
|
5
|
+
:isOpen="isDropdownOpen"
|
6
|
+
:dropdownText="dropdownText ? dropdownText : 'Default view'"
|
7
|
+
/>
|
8
|
+
<filter-settings
|
9
|
+
v-if="isDropdownOpen"
|
10
|
+
:filterData="filterData"
|
11
|
+
:filterViews="filterViews"
|
12
|
+
:buttonText="buttonText"
|
13
|
+
@on-view-select="onViewSelect($event)"
|
14
|
+
@on-view-delete="onViewDelete($event)"
|
15
|
+
@on-save-new-view="$emit('on-save-new-view')"
|
16
|
+
@on-filter-change="onFilterChange($event)"
|
17
|
+
@on-cancel-view="onCancelSettings()"
|
18
|
+
@on-drag-change="$emit('on-drag-change', $event)"
|
19
|
+
@on-apply-current-view="onApplyCurrentView()"
|
20
|
+
@on-prevent-close="onPreventClose($event)"
|
21
|
+
@on-reset-filters="onResetFilters()"
|
22
|
+
:hasActiveView="hasActiveView"
|
23
|
+
:activeView="activeView"
|
24
|
+
:activeLanguage="activeLanguage"
|
25
|
+
:settingsTranslations="settingsTranslations"
|
26
|
+
/>
|
27
|
+
</page-wrapper>
|
28
|
+
</template>
|
29
|
+
|
30
|
+
<script>
|
31
|
+
import styled from 'vue-styled-components'
|
32
|
+
import parentDropdown from './parentDropdown'
|
33
|
+
import filterSettings from './filterSettings'
|
34
|
+
|
35
|
+
const PageWrapper = styled.div`
|
36
|
+
position: relative;
|
37
|
+
`
|
38
|
+
|
39
|
+
export default {
|
40
|
+
name: 'filter-component',
|
41
|
+
components: {
|
42
|
+
parentDropdown,
|
43
|
+
PageWrapper,
|
44
|
+
filterSettings
|
45
|
+
},
|
46
|
+
props: {
|
47
|
+
filterData: {
|
48
|
+
required: true
|
49
|
+
},
|
50
|
+
dropdownText: {
|
51
|
+
required: false
|
52
|
+
},
|
53
|
+
filterViews: {
|
54
|
+
required: true
|
55
|
+
},
|
56
|
+
activeView: {
|
57
|
+
required: false,
|
58
|
+
default: null
|
59
|
+
},
|
60
|
+
buttonText: {
|
61
|
+
required: false
|
62
|
+
},
|
63
|
+
hasActiveView: {
|
64
|
+
required: false
|
65
|
+
},
|
66
|
+
activeLanguage: {
|
67
|
+
required: false,
|
68
|
+
default: 'en-us'
|
69
|
+
},
|
70
|
+
settingsTranslations: {
|
71
|
+
required: false
|
72
|
+
}
|
73
|
+
},
|
74
|
+
data() {
|
75
|
+
return {
|
76
|
+
isDropdownOpen: false,
|
77
|
+
activeFilter: null,
|
78
|
+
preventOutsideClick: false
|
79
|
+
}
|
80
|
+
},
|
81
|
+
methods: {
|
82
|
+
onToggleDropdown() {
|
83
|
+
this.isDropdownOpen = !this.isDropdownOpen
|
84
|
+
},
|
85
|
+
clickOutside(event) {
|
86
|
+
if (
|
87
|
+
!this.$refs.dropdown.$el.contains(event.target) &&
|
88
|
+
!this.preventOutsideClick
|
89
|
+
) {
|
90
|
+
this.isDropdownOpen = false
|
91
|
+
}
|
92
|
+
},
|
93
|
+
onPreventClose(value) {
|
94
|
+
setTimeout(() => {
|
95
|
+
this.preventOutsideClick = value
|
96
|
+
}, 100)
|
97
|
+
},
|
98
|
+
onFilterChange(data) {
|
99
|
+
// this.preventOutsideClick = true is needed for when the user clicks on the calendar icon on the date range
|
100
|
+
// because clicking the calendar does not trigger the @focus
|
101
|
+
this.preventOutsideClick = true
|
102
|
+
this.$emit('on-filter-settings-change', data)
|
103
|
+
this.onPreventClose(false)
|
104
|
+
},
|
105
|
+
onCancelSettings() {
|
106
|
+
this.onToggleDropdown()
|
107
|
+
this.$emit('on-cancel-view')
|
108
|
+
},
|
109
|
+
onViewSelect(item) {
|
110
|
+
this.onToggleDropdown()
|
111
|
+
this.$emit('on-filter-view-select', item)
|
112
|
+
},
|
113
|
+
onViewDelete(item) {
|
114
|
+
this.$emit('on-filter-view-delete', item)
|
115
|
+
},
|
116
|
+
onApplyCurrentView() {
|
117
|
+
this.onToggleDropdown()
|
118
|
+
this.$emit('on-apply-current-view')
|
119
|
+
},
|
120
|
+
onResetFilters() {
|
121
|
+
this.onToggleDropdown()
|
122
|
+
this.$emit('on-reset-filters')
|
123
|
+
}
|
124
|
+
},
|
125
|
+
mounted() {
|
126
|
+
document.addEventListener('click', this.clickOutside)
|
127
|
+
},
|
128
|
+
beforeDestroy() {
|
129
|
+
document.removeEventListener('click', this.clickOutside)
|
130
|
+
}
|
131
|
+
}
|
132
|
+
</script>
|
@@ -0,0 +1,91 @@
|
|
1
|
+
<template>
|
2
|
+
<page-wrapper @click="$emit('on-toggle')">
|
3
|
+
<icon-wrapper>
|
4
|
+
<icon name="settings" size="18px" />
|
5
|
+
</icon-wrapper>
|
6
|
+
<title-wrapper :isOpen="isOpen">
|
7
|
+
<title-text>
|
8
|
+
{{ dropdownText }}
|
9
|
+
</title-text>
|
10
|
+
<arrow-wrapper>
|
11
|
+
<icon
|
12
|
+
@click.native.stop="$emit('on-toggle')"
|
13
|
+
:name="isOpen ? 'arrow_up' : 'arrow_down'"
|
14
|
+
size="12px"
|
15
|
+
/>
|
16
|
+
</arrow-wrapper>
|
17
|
+
</title-wrapper>
|
18
|
+
</page-wrapper>
|
19
|
+
</template>
|
20
|
+
|
21
|
+
<script>
|
22
|
+
import styled from 'vue-styled-components'
|
23
|
+
import Icon from '../icon'
|
24
|
+
|
25
|
+
const PageWrapper = styled.div`
|
26
|
+
display: grid;
|
27
|
+
grid-template-columns: auto auto;
|
28
|
+
cursor: pointer;
|
29
|
+
`
|
30
|
+
|
31
|
+
const IconWrapper = styled.div`
|
32
|
+
display: grid;
|
33
|
+
align-items: center;
|
34
|
+
justify-items: center;
|
35
|
+
border: 1px solid ${(props) => props.theme.colors.grey4};
|
36
|
+
border-radius: 4px 0px 0px 4px;
|
37
|
+
padding: 6px;
|
38
|
+
`
|
39
|
+
|
40
|
+
const TitleAttrs = { isOpen: Boolean }
|
41
|
+
const TitleWrapper = styled('div', TitleAttrs)`
|
42
|
+
display: grid;
|
43
|
+
grid-template-columns: auto auto;
|
44
|
+
align-items: center;
|
45
|
+
justify-items: center;
|
46
|
+
grid-gap: 10px;
|
47
|
+
border: 1px solid ${(props) => props.theme.colors.grey4};
|
48
|
+
background-color: ${(props) =>
|
49
|
+
props.isOpen ? props.theme.colors.grey5 : props.theme.colors.white};
|
50
|
+
border-left: none;
|
51
|
+
border-radius: 0px 4px 4px 0px;
|
52
|
+
padding: 6px 14px;
|
53
|
+
user-select: none;
|
54
|
+
`
|
55
|
+
|
56
|
+
const TitleText = styled.div`
|
57
|
+
font-size: 13px;
|
58
|
+
`
|
59
|
+
|
60
|
+
const ArrowWrapper = styled.div`
|
61
|
+
display: grid;
|
62
|
+
align-items: center;
|
63
|
+
|
64
|
+
div {
|
65
|
+
height: auto !important;
|
66
|
+
min-height: unset;
|
67
|
+
}
|
68
|
+
`
|
69
|
+
|
70
|
+
export default {
|
71
|
+
name: 'parent-dropdown',
|
72
|
+
components: {
|
73
|
+
PageWrapper,
|
74
|
+
Icon,
|
75
|
+
IconWrapper,
|
76
|
+
TitleWrapper,
|
77
|
+
TitleText,
|
78
|
+
ArrowWrapper
|
79
|
+
},
|
80
|
+
props: {
|
81
|
+
isOpen: {
|
82
|
+
required: true,
|
83
|
+
default: false
|
84
|
+
},
|
85
|
+
dropdownText: {
|
86
|
+
required: true,
|
87
|
+
default: 'View'
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
</script>
|
@@ -110,11 +110,10 @@ export default {
|
|
110
110
|
required: false
|
111
111
|
},
|
112
112
|
backgroundColor: {
|
113
|
-
required: false
|
114
|
-
},
|
115
|
-
hasBorder: {
|
116
113
|
required: false,
|
117
|
-
|
114
|
+
},
|
115
|
+
hasBorder: {
|
116
|
+
required: false,
|
118
117
|
},
|
119
118
|
hoveredBackgroundColor: {
|
120
119
|
required: false,
|
@@ -134,15 +133,15 @@ export default {
|
|
134
133
|
},
|
135
134
|
borderRadius: {
|
136
135
|
required: false,
|
137
|
-
default: '
|
138
|
-
},
|
139
|
-
isHovered: {
|
140
|
-
required: false,
|
141
|
-
default: false
|
136
|
+
default: '6px'
|
142
137
|
},
|
143
|
-
|
144
|
-
required:
|
145
|
-
default:
|
138
|
+
isHovered:{
|
139
|
+
required:false,
|
140
|
+
default:false
|
141
|
+
},
|
142
|
+
isStriked:{
|
143
|
+
required:false,
|
144
|
+
default:false
|
146
145
|
}
|
147
146
|
},
|
148
147
|
data() {
|
@@ -433,6 +433,10 @@ export default {
|
|
433
433
|
labelFontColor: {
|
434
434
|
required: false,
|
435
435
|
default: 'eturnityGrey'
|
436
|
+
},
|
437
|
+
focus: {
|
438
|
+
required: false,
|
439
|
+
default: false
|
436
440
|
}
|
437
441
|
},
|
438
442
|
computed: {
|
@@ -660,7 +664,17 @@ export default {
|
|
660
664
|
})
|
661
665
|
}
|
662
666
|
},
|
667
|
+
mounted() {
|
668
|
+
if (this.focus) {
|
669
|
+
this.focusInput()
|
670
|
+
}
|
671
|
+
},
|
663
672
|
watch: {
|
673
|
+
focus(value) {
|
674
|
+
if (value) {
|
675
|
+
this.focusInput()
|
676
|
+
}
|
677
|
+
},
|
664
678
|
clearInput: function (value) {
|
665
679
|
if (value) {
|
666
680
|
// If the value is typed, then we should clear the textInput on Continue
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<template>
|
2
|
-
<container>
|
2
|
+
<container :inputWidth="inputWidth">
|
3
3
|
<input-wrapper>
|
4
4
|
<input-container
|
5
5
|
ref="inputElement"
|
@@ -9,6 +9,7 @@
|
|
9
9
|
:disabled="disabled"
|
10
10
|
:isDisabled="disabled"
|
11
11
|
:inputWidth="inputWidth"
|
12
|
+
:isFilter="isFilter"
|
12
13
|
:hasFocus="hasFocus"
|
13
14
|
/>
|
14
15
|
<img
|
@@ -28,18 +29,24 @@
|
|
28
29
|
// :disabled="true"
|
29
30
|
// inputWidth="250px"
|
30
31
|
// @on-change="function($event)"
|
32
|
+
// :isFilter="true" // to set the height at 30px
|
31
33
|
// />
|
32
34
|
import styled from 'vue-styled-components'
|
33
35
|
|
34
|
-
const
|
35
|
-
|
36
|
+
const inputAttrs = {
|
37
|
+
isDisabled: Boolean,
|
38
|
+
inputWidth: String,
|
39
|
+
isFilter: Boolean
|
40
|
+
}
|
41
|
+
const Container = styled('div', inputAttrs)`
|
42
|
+
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
36
43
|
position: relative;
|
37
44
|
`
|
38
45
|
|
39
|
-
const inputAttrs = { isDisabled: Boolean, inputWidth: String }
|
40
46
|
const InputContainer = styled('input', inputAttrs)`
|
41
|
-
border: 1px solid ${(props) => props.theme.colors.
|
42
|
-
padding:
|
47
|
+
border: 1px solid ${(props) => props.theme.colors.grey4};
|
48
|
+
padding: ${(props) =>
|
49
|
+
props.isFilter ? '7px 30px 7px 10px' : '11px 30px 11px 10px'};
|
43
50
|
border-radius: 4px;
|
44
51
|
font-size: 13px;
|
45
52
|
color: ${(props) => props.theme.colors.black};
|
@@ -90,6 +97,10 @@ export default {
|
|
90
97
|
required: false,
|
91
98
|
default: null
|
92
99
|
},
|
100
|
+
isFilter: {
|
101
|
+
required: false,
|
102
|
+
default: false
|
103
|
+
},
|
93
104
|
hasFocus: {
|
94
105
|
required: false,
|
95
106
|
default: false
|
@@ -99,10 +110,10 @@ export default {
|
|
99
110
|
onChangeHandler(event) {
|
100
111
|
this.$emit('on-change', event)
|
101
112
|
},
|
102
|
-
focusInputElement(){
|
113
|
+
focusInputElement() {
|
103
114
|
this.$nextTick(() => {
|
104
|
-
this.$refs.inputElement.$el.focus()
|
105
|
-
})
|
115
|
+
this.$refs.inputElement.$el.focus()
|
116
|
+
})
|
106
117
|
}
|
107
118
|
},
|
108
119
|
watch: {
|
@@ -112,6 +123,5 @@ export default {
|
|
112
123
|
}
|
113
124
|
}
|
114
125
|
}
|
115
|
-
|
116
126
|
}
|
117
127
|
</script>
|
@@ -32,6 +32,7 @@
|
|
32
32
|
ref="select"
|
33
33
|
@click="toggleDropdown"
|
34
34
|
:selectHeight="selectHeight"
|
35
|
+
:height="height"
|
35
36
|
:selectMinHeight="selectMinHeight"
|
36
37
|
:bgColor="
|
37
38
|
buttonBgColor || colorMode == 'dark' ? 'transparentBlack1' : 'white'
|
@@ -92,11 +93,11 @@
|
|
92
93
|
ref="dropdown"
|
93
94
|
v-show="isDropdownOpen"
|
94
95
|
:hoveredIndex="hoveredIndex"
|
96
|
+
:hoveredValue="hoveredValue"
|
95
97
|
:isActive="isActive"
|
96
98
|
:optionWidth="optionWidth"
|
97
|
-
:
|
98
|
-
|
99
|
-
"
|
99
|
+
:hoveredBgColor="colorMode == 'dark' ? '#000000' : dropdownBgColor"
|
100
|
+
:bgColor="colorMode == 'dark' ? 'black' : dropdownBgColor"
|
100
101
|
:fontColor="
|
101
102
|
dropdownFontColor || colorMode == 'dark' ? 'white' : 'black'
|
102
103
|
"
|
@@ -145,7 +146,6 @@ const Caret = styled.div`
|
|
145
146
|
min-width: 30px;
|
146
147
|
height: 100%;
|
147
148
|
align-items: stretch
|
148
|
-
padding-top: 5px;
|
149
149
|
cursor: pointer;
|
150
150
|
margin-left: auto;
|
151
151
|
`
|
@@ -154,7 +154,7 @@ const Selector = styled.div`
|
|
154
154
|
width: 100%;
|
155
155
|
`
|
156
156
|
|
157
|
-
const labelAttrs = { fontSize: String }
|
157
|
+
const labelAttrs = { fontSize: String, fontColor: String }
|
158
158
|
const InputLabel = styled('div', labelAttrs)`
|
159
159
|
color: ${(props) =>
|
160
160
|
props.theme.colors[props.fontColor]
|
@@ -193,6 +193,7 @@ const selectButtonAttrs = {
|
|
193
193
|
hasError: Boolean,
|
194
194
|
disabled: Boolean,
|
195
195
|
selectHeight: String,
|
196
|
+
height: String,
|
196
197
|
selectMinHeight: String,
|
197
198
|
isSearchBarVisible: Boolean,
|
198
199
|
showBorder: Boolean
|
@@ -204,7 +205,14 @@ const selectButton = styled('div', selectButtonAttrs)`
|
|
204
205
|
padding: ${(props) => (props.isSearchBarVisible ? '0' : '0px 0px 0 15px')};
|
205
206
|
text-align: left;
|
206
207
|
border-radius: 4px;
|
207
|
-
min-height: ${(props) =>
|
208
|
+
min-height: ${(props) =>
|
209
|
+
props.selectHeight
|
210
|
+
? props.selectHeight
|
211
|
+
: props.selectMinHeight
|
212
|
+
? props.selectMinHeight
|
213
|
+
: props.height
|
214
|
+
? props.height
|
215
|
+
: '36px'};
|
208
216
|
display: flex;
|
209
217
|
align-items: center;
|
210
218
|
max-height: ${(props) => props.selectHeight};
|
@@ -226,11 +234,13 @@ const selectButton = styled('div', selectButtonAttrs)`
|
|
226
234
|
${(props) => (props.disabled ? 'pointer-events: none' : '')};
|
227
235
|
`
|
228
236
|
const selectDropdownAttrs = {
|
237
|
+
hoveredBgColor: String,
|
229
238
|
bgColor: String,
|
230
239
|
fontColor: String,
|
231
240
|
selectWidth: String,
|
232
241
|
optionWidth: String,
|
233
242
|
hoveredIndex: Number,
|
243
|
+
hoveredValue: Number | String,
|
234
244
|
selectedValue: Number | String
|
235
245
|
}
|
236
246
|
const selectDropdown = styled('div', selectDropdownAttrs)`
|
@@ -256,11 +266,11 @@ const selectDropdown = styled('div', selectDropdownAttrs)`
|
|
256
266
|
: props.fontColor};
|
257
267
|
max-height:300px;
|
258
268
|
overflow-y:auto;
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
269
|
+
&>div[data-value="${(props) => props.hoveredValue}"]{
|
270
|
+
background-color:${(props) =>
|
271
|
+
props.theme.colors[props.hoveredBgColor]
|
272
|
+
? props.theme.colors[props.hoveredBgColor]
|
273
|
+
: props.hoveredBgColor};
|
264
274
|
}
|
265
275
|
`
|
266
276
|
const DropdownWrapper = styled('div')`
|
@@ -309,6 +319,10 @@ export default {
|
|
309
319
|
required: false,
|
310
320
|
default: null
|
311
321
|
},
|
322
|
+
height: {
|
323
|
+
required: false,
|
324
|
+
default: null
|
325
|
+
},
|
312
326
|
selectMinHeight: {
|
313
327
|
required: false,
|
314
328
|
default: '36px'
|
@@ -332,7 +346,8 @@ export default {
|
|
332
346
|
required: false
|
333
347
|
},
|
334
348
|
dropdownBgColor: {
|
335
|
-
required: false
|
349
|
+
required: false,
|
350
|
+
default: 'grey5'
|
336
351
|
},
|
337
352
|
dropdownFontColor: {
|
338
353
|
required: false
|
@@ -393,6 +408,7 @@ export default {
|
|
393
408
|
isActive: false,
|
394
409
|
textSearch: '',
|
395
410
|
hoveredIndex: 0,
|
411
|
+
hoveredValue:null,
|
396
412
|
isClickOutsideActive: false
|
397
413
|
}
|
398
414
|
},
|
@@ -431,13 +447,7 @@ export default {
|
|
431
447
|
this.$emit('input-change', e)
|
432
448
|
},
|
433
449
|
optionHovered(e) {
|
434
|
-
|
435
|
-
if (this.$refs.dropdown) {
|
436
|
-
this.hoveredIndex =
|
437
|
-
this.$refs.dropdown.$children
|
438
|
-
.map((component) => component.$el)
|
439
|
-
.indexOf(optionElement) + 1
|
440
|
-
}
|
450
|
+
this.hoveredValue=e
|
441
451
|
},
|
442
452
|
mouseEnterHandler() {
|
443
453
|
if (this.hoverDropdown) {
|
@@ -491,16 +501,20 @@ export default {
|
|
491
501
|
}
|
492
502
|
},
|
493
503
|
onArrowPress(dir) {
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
+
let newHoveredElem
|
505
|
+
const currentHoveredElem=this.$refs.dropdown.$el.querySelector(`[data-value="${this.hoveredValue}"]`);
|
506
|
+
if(currentHoveredElem){
|
507
|
+
if(dir>0){
|
508
|
+
newHoveredElem=currentHoveredElem.nextElementSibling
|
509
|
+
}else{
|
510
|
+
newHoveredElem=currentHoveredElem.previousElementSibling
|
511
|
+
}
|
512
|
+
if(newHoveredElem){
|
513
|
+
this.hoveredValue = newHoveredElem.getAttribute('data-value')
|
514
|
+
const topPos = newHoveredElem.offsetTop
|
515
|
+
this.$refs.dropdown.$el.scrollTop = topPos
|
516
|
+
}
|
517
|
+
}
|
504
518
|
}
|
505
519
|
},
|
506
520
|
computed: {
|
@@ -36,6 +36,10 @@ const optionContainer = styled('div', optionProps)`
|
|
36
36
|
padding: 12px 10px;
|
37
37
|
gap: 14px;
|
38
38
|
width: 100%;
|
39
|
+
background-color: ${(props) =>
|
40
|
+
props.theme.colors[props.backgroundColor]
|
41
|
+
? props.theme.colors[props.backgroundColor]
|
42
|
+
: props.backgroundColor};
|
39
43
|
box-sizing: inherit;
|
40
44
|
background-color: ${(props) =>
|
41
45
|
props.theme.colors[props.backgroundColor]
|
@@ -45,7 +49,7 @@ const optionContainer = styled('div', optionProps)`
|
|
45
49
|
background-color: ${(props) =>
|
46
50
|
props.theme.colors[props.hoveredBgColor]
|
47
51
|
? props.theme.colors[props.hoveredBgColor]
|
48
|
-
: props.hoveredBgColor};
|
52
|
+
: props.hoveredBgColor} !important;
|
49
53
|
}
|
50
54
|
`
|
51
55
|
|
@@ -104,12 +104,7 @@
|
|
104
104
|
:src="require('../../assets/icons/collapse_arrow_icon.svg')"
|
105
105
|
/>
|
106
106
|
</arrow-wrapper>
|
107
|
-
<options-container
|
108
|
-
v-if="isOpen"
|
109
|
-
:top="getItemLocation('top')"
|
110
|
-
:left="getItemLocation('left')"
|
111
|
-
ref="optionsContainer"
|
112
|
-
>
|
107
|
+
<options-container v-if="isOpen" ref="optionsContainer">
|
113
108
|
<options-wrapper @click.prevent.stop>
|
114
109
|
<search-container @click.prevent.stop>
|
115
110
|
<search-input
|
@@ -290,8 +285,7 @@ const OptionsContainer = styled('div', optionsAttrs)`
|
|
290
285
|
position: absolute;
|
291
286
|
display: grid;
|
292
287
|
grid-template-rows: 1fr auto;
|
293
|
-
|
294
|
-
left: ${(props) => props.left + 'px'};
|
288
|
+
left: 20px;
|
295
289
|
width: auto;
|
296
290
|
max-height: 360px;
|
297
291
|
min-height: 200px;
|
@@ -512,8 +506,13 @@ export default {
|
|
512
506
|
}
|
513
507
|
},
|
514
508
|
methods: {
|
515
|
-
toggleOpen() {
|
516
|
-
if (
|
509
|
+
toggleOpen(event) {
|
510
|
+
if (
|
511
|
+
this.disabled ||
|
512
|
+
(event &&
|
513
|
+
!(event.target === this.$el) &&
|
514
|
+
!this.$el.contains(event.target))
|
515
|
+
) {
|
517
516
|
return
|
518
517
|
}
|
519
518
|
this.wasClicked = false
|
@@ -560,14 +559,6 @@ export default {
|
|
560
559
|
this.inputText = value
|
561
560
|
this.$emit('dropdown-search', value)
|
562
561
|
},
|
563
|
-
getItemLocation(value) {
|
564
|
-
let ref = this.$refs.dropdownItem[0]
|
565
|
-
let location = ref.$el.getBoundingClientRect()[value]
|
566
|
-
if (value === 'top') {
|
567
|
-
location = location + window.scrollY + 40
|
568
|
-
}
|
569
|
-
return location
|
570
|
-
},
|
571
562
|
clickOutside(event) {
|
572
563
|
if (event.target === this.$el || this.$el.contains(event.target)) {
|
573
564
|
return
|