@eturnity/eturnity_reusable_components 7.8.1-EPDM-9696.1 → 7.8.2-EPDM-7779.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/package.json +1 -1
- package/src/App.vue +2 -1
- package/src/components/inputs/select/index.vue +15 -22
- package/src/components/modals/modal/index.vue +11 -2
- package/src/components/threeDots/index.vue +13 -9
- package/.eslintrc +0 -18
- package/src/components/draggableInputHandle/index.vue +0 -47
- package/src/components/label/index.vue +0 -104
package/package.json
CHANGED
package/src/App.vue
CHANGED
@@ -46,9 +46,7 @@
|
|
46
46
|
@keydown.native="onKeyDown"
|
47
47
|
:showBorder="showBorder"
|
48
48
|
:data-id="dataId"
|
49
|
-
|
50
|
-
>
|
51
|
-
<draggableInputHandle v-if="isDraggable && !isSearchBarVisible" :height="selectHeight" />
|
49
|
+
>
|
52
50
|
<inputText
|
53
51
|
v-if="isSearchBarVisible"
|
54
52
|
ref="searchInput"
|
@@ -65,7 +63,7 @@
|
|
65
63
|
@input-change="searchChange"
|
66
64
|
@click.native.stop
|
67
65
|
/>
|
68
|
-
<selector v-else>
|
66
|
+
<selector :selectWidth="selectWidth" v-else>
|
69
67
|
<slot name="selector" :selectedValue="selectedValue"></slot>
|
70
68
|
</selector>
|
71
69
|
<Caret @click.stop="toggleCaretDropdown">
|
@@ -143,7 +141,6 @@ import styled from 'vue-styled-components'
|
|
143
141
|
import InfoText from '../../infoText'
|
144
142
|
import icon from '../../icon'
|
145
143
|
import inputText from '../inputText'
|
146
|
-
import draggableInputHandle from '../../draggableInputHandle'
|
147
144
|
|
148
145
|
const Caret = styled.div`
|
149
146
|
display: flex;
|
@@ -157,8 +154,14 @@ const Caret = styled.div`
|
|
157
154
|
margin-left: auto;
|
158
155
|
`
|
159
156
|
|
160
|
-
const Selector = styled
|
161
|
-
width:
|
157
|
+
const Selector = styled('div', { selectWidth: String })`
|
158
|
+
max-width: ${(props) =>
|
159
|
+
props.selectWidth
|
160
|
+
? props.selectWidth
|
161
|
+
: '100%'}; // set to same width as the select
|
162
|
+
white-space: nowrap;
|
163
|
+
text-overflow: ellipsis;
|
164
|
+
overflow: hidden;
|
162
165
|
`
|
163
166
|
|
164
167
|
const labelAttrs = { fontSize: String, fontColor: String }
|
@@ -167,7 +170,7 @@ const InputLabel = styled('div', labelAttrs)`
|
|
167
170
|
props.theme.colors[props.fontColor]
|
168
171
|
? props.theme.colors[props.fontColor]
|
169
172
|
: props.fontColor};
|
170
|
-
font-size: ${(props) =>
|
173
|
+
font-size: ${(props) => props.fontSize};
|
171
174
|
font-weight: 700;
|
172
175
|
`
|
173
176
|
const optionalLabel = styled.span`
|
@@ -203,14 +206,13 @@ const selectButtonAttrs = {
|
|
203
206
|
height: String,
|
204
207
|
selectMinHeight: String,
|
205
208
|
isSearchBarVisible: Boolean,
|
206
|
-
showBorder: Boolean
|
207
|
-
isDraggable: Boolean,
|
209
|
+
showBorder: Boolean
|
208
210
|
}
|
209
211
|
const selectButton = styled('div', selectButtonAttrs)`
|
210
212
|
position: relative;
|
211
213
|
box-sizing: border-box;
|
212
214
|
border-radius: 4px;
|
213
|
-
padding
|
215
|
+
padding: ${(props) => (props.isSearchBarVisible ? '0' : '0px 0px 0 15px')};
|
214
216
|
text-align: left;
|
215
217
|
border-radius: 4px;
|
216
218
|
min-height: ${(props) =>
|
@@ -240,10 +242,6 @@ const selectButton = styled('div', selectButtonAttrs)`
|
|
240
242
|
? props.theme.colors[props.fontColor]
|
241
243
|
: props.fontColor};
|
242
244
|
${(props) => (props.disabled ? 'pointer-events: none' : '')};
|
243
|
-
overflow: hidden;
|
244
|
-
& >.handle{
|
245
|
-
border-right:${(props) =>props.hasError ? props.theme.colors.red : props.theme.colors.grey4} 1px solid;
|
246
|
-
}
|
247
245
|
`
|
248
246
|
const selectDropdownAttrs = {
|
249
247
|
hoveredBgColor: String,
|
@@ -307,7 +305,7 @@ export default {
|
|
307
305
|
},
|
308
306
|
fontSize: {
|
309
307
|
required: false,
|
310
|
-
default:
|
308
|
+
default: '13px'
|
311
309
|
},
|
312
310
|
label: {
|
313
311
|
required: false
|
@@ -409,10 +407,6 @@ export default {
|
|
409
407
|
dataId: {
|
410
408
|
type: String,
|
411
409
|
default: ''
|
412
|
-
},
|
413
|
-
isDraggable: {
|
414
|
-
type: Boolean,
|
415
|
-
default: false
|
416
410
|
}
|
417
411
|
},
|
418
412
|
|
@@ -430,8 +424,7 @@ export default {
|
|
430
424
|
icon,
|
431
425
|
Caret,
|
432
426
|
Selector,
|
433
|
-
inputText
|
434
|
-
draggableInputHandle
|
427
|
+
inputText
|
435
428
|
},
|
436
429
|
|
437
430
|
data() {
|
@@ -6,7 +6,7 @@
|
|
6
6
|
@click.native="onOutsideClose()"
|
7
7
|
:backdrop="backdrop"
|
8
8
|
>
|
9
|
-
<modal-container @click
|
9
|
+
<modal-container @click="onClickModalContainer">
|
10
10
|
<spinner v-if="isLoading" size="50px" :limitedToModal="true" />
|
11
11
|
<content-container :visible="!isLoading">
|
12
12
|
<slot />
|
@@ -27,7 +27,7 @@
|
|
27
27
|
// import Modal from "@eturnity/eturnity_reusable_components/src/components/modals/modal"
|
28
28
|
// This is a more flexible modal box, where the parent can decide how the body of the modal looks
|
29
29
|
// To use:
|
30
|
-
// <modal :isOpen="isOpen" @on-close="$emit('on-close-summary')" :preventOutsideClose="true" :isLoading="true" :hideClose="true">
|
30
|
+
// <modal :isOpen="isOpen" @on-close="$emit('on-close-summary')" :preventOutsideClose="true" :isLoading="true" :hideClose="true" :stopPropagation="false">
|
31
31
|
// <div>Data....</div>
|
32
32
|
// </modal>
|
33
33
|
|
@@ -156,6 +156,10 @@ export default {
|
|
156
156
|
position: {
|
157
157
|
required: false,
|
158
158
|
default: 'fixed'
|
159
|
+
},
|
160
|
+
stopPropagation: {
|
161
|
+
type: Boolean,
|
162
|
+
default: true
|
159
163
|
}
|
160
164
|
},
|
161
165
|
methods: {
|
@@ -167,6 +171,11 @@ export default {
|
|
167
171
|
if (!this.preventOutsideClose) {
|
168
172
|
this.$emit('on-close')
|
169
173
|
}
|
174
|
+
},
|
175
|
+
onClickModalContainer(event) {
|
176
|
+
if (this.stopPropagation) {
|
177
|
+
event.stopPropagation()
|
178
|
+
}
|
170
179
|
}
|
171
180
|
},
|
172
181
|
watch: {
|
@@ -38,11 +38,12 @@
|
|
38
38
|
{{ child.name }}
|
39
39
|
</option-child>
|
40
40
|
</children-container>
|
41
|
-
<options-container v-if="!isLoading">
|
41
|
+
<options-container v-if="!isLoading" :textWrap="textWrap">
|
42
42
|
<option-item
|
43
43
|
v-for="(item, index) in options"
|
44
44
|
:key="item.value"
|
45
45
|
tabindex="0"
|
46
|
+
:textWrap="textWrap"
|
46
47
|
@click.stop="onSelect({ item: item, hasChildren: hasChildren(item) })"
|
47
48
|
@keyup.enter="
|
48
49
|
onSelect({ item: item, hasChildren: hasChildren(item) })
|
@@ -56,8 +57,8 @@
|
|
56
57
|
v-if="hasChildren(item)"
|
57
58
|
/>
|
58
59
|
<span>
|
59
|
-
|
60
|
-
|
60
|
+
{{ item.name }}
|
61
|
+
</span>
|
61
62
|
</option-item>
|
62
63
|
</options-container>
|
63
64
|
</template>
|
@@ -184,22 +185,20 @@ const LoadingContainer = styled.div`
|
|
184
185
|
background: #fff;
|
185
186
|
`
|
186
187
|
|
187
|
-
const
|
188
|
+
const OptionsContainerAttrs = { textWrap: Boolean }
|
189
|
+
const OptionsContainer = styled('div', OptionsContainerAttrs)`
|
188
190
|
border: 1px solid ${(props) => props.theme.colors.grey3};
|
189
191
|
display: grid;
|
190
192
|
grid-template-columns: 1fr;
|
191
|
-
|
192
|
-
max-width: 220px;
|
193
|
-
width: max-content;
|
193
|
+
${(props) => props.textWrap ? 'width: 220px' : 'width: max-content' };
|
194
194
|
border-radius: 4px;
|
195
195
|
background-color: #fff;
|
196
196
|
max-height: 220px;
|
197
197
|
overflow: auto;
|
198
198
|
height: max-content;
|
199
|
-
white-space: normal;
|
200
199
|
`
|
201
200
|
|
202
|
-
const optionAttrs = { isDisabled: Boolean }
|
201
|
+
const optionAttrs = { isDisabled: Boolean, textWrap: Boolean }
|
203
202
|
const OptionItem = styled('div', optionAttrs)`
|
204
203
|
padding: 12px;
|
205
204
|
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
|
@@ -207,6 +206,7 @@ const OptionItem = styled('div', optionAttrs)`
|
|
207
206
|
position: relative;
|
208
207
|
${(props) => (props.isDisabled ? `background-color: ${ props.theme.colors.grey5 }!important` : '')};
|
209
208
|
${(props) => (props.isDisabled ? `color: ${ props.theme.colors.grey2 }` : '')};
|
209
|
+
${(props) => props.textWrap ? '' : 'white-space: nowrap'};
|
210
210
|
|
211
211
|
&:hover {
|
212
212
|
background-color: #ebeef4;
|
@@ -288,6 +288,10 @@ export default {
|
|
288
288
|
isLoading: {
|
289
289
|
required: false,
|
290
290
|
default: false
|
291
|
+
},
|
292
|
+
textWrap: {
|
293
|
+
required: false,
|
294
|
+
default: true
|
291
295
|
}
|
292
296
|
},
|
293
297
|
data() {
|
package/.eslintrc
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"extends": ["plugin:prettier/recommended", "plugin:vue/essential"],
|
3
|
-
|
4
|
-
"plugins": ["prettier"],
|
5
|
-
|
6
|
-
"rules": {
|
7
|
-
"prettier/prettier": "error",
|
8
|
-
"vue/no-parsing-error": "off",
|
9
|
-
"vue/no-side-effects-in-computed-properties": "off",
|
10
|
-
"vue/invalid-first-character-of-tag-name": "off"
|
11
|
-
},
|
12
|
-
|
13
|
-
"parserOptions": {
|
14
|
-
"ecmaVersion": 6,
|
15
|
-
"parser": "babel-eslint",
|
16
|
-
"sourceType": "module"
|
17
|
-
}
|
18
|
-
}
|
@@ -1,47 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<Handle :height = "height" class="handle">
|
3
|
-
<Dot></Dot>
|
4
|
-
<Dot></Dot>
|
5
|
-
<Dot></Dot>
|
6
|
-
</Handle>
|
7
|
-
</template>
|
8
|
-
|
9
|
-
<script>
|
10
|
-
|
11
|
-
import styled from 'vue-styled-components'
|
12
|
-
|
13
|
-
const Handle = styled('div',{ height : String })`
|
14
|
-
position:absolute;
|
15
|
-
left:0;
|
16
|
-
margin-right:10px;
|
17
|
-
display: flex;
|
18
|
-
align-items: stretch;
|
19
|
-
flex-direction: column;
|
20
|
-
justify-content: center;
|
21
|
-
width: 14px;
|
22
|
-
height:${props=> props.height};
|
23
|
-
padding: 0 5px;
|
24
|
-
background-color: #f3f3f7;
|
25
|
-
cursor: pointer;
|
26
|
-
align-items: center;
|
27
|
-
`
|
28
|
-
const Dot = styled.div`
|
29
|
-
display: inline-block;
|
30
|
-
width: 4px;
|
31
|
-
height: 4px;
|
32
|
-
margin:2px;
|
33
|
-
background-color: #0068de;
|
34
|
-
`
|
35
|
-
|
36
|
-
export default {
|
37
|
-
name: 'draggableInputHandle',
|
38
|
-
props:['height'],
|
39
|
-
components: {
|
40
|
-
Handle,
|
41
|
-
Dot
|
42
|
-
},
|
43
|
-
data() {
|
44
|
-
return {}
|
45
|
-
}
|
46
|
-
}
|
47
|
-
</script>
|
@@ -1,104 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<label-wrapper
|
3
|
-
:labelAlign="labelAlign">
|
4
|
-
<input-label
|
5
|
-
:labelFontColor="labelFontColor"
|
6
|
-
:fontSize="fontSize"
|
7
|
-
>
|
8
|
-
<slot></slot>
|
9
|
-
<optionalLabel v-if="labelOptional"
|
10
|
-
>({{ $gettext('Optional') }})</optionalLabel
|
11
|
-
></input-label
|
12
|
-
>
|
13
|
-
<info-text
|
14
|
-
v-if="infoTextMessage"
|
15
|
-
:text="infoTextMessage"
|
16
|
-
borderColor="#ccc"
|
17
|
-
:size="fontSize ? fontSize : '16px'"
|
18
|
-
:alignArrow="infoTextAlign"
|
19
|
-
/>
|
20
|
-
</label-wrapper>
|
21
|
-
</template>
|
22
|
-
|
23
|
-
<script>
|
24
|
-
import styled from 'vue-styled-components'
|
25
|
-
import InfoText from '../infoText'
|
26
|
-
|
27
|
-
|
28
|
-
const labelAttrs = { fontSize: String, labelFontColor: String }
|
29
|
-
const InputLabel = styled('div', labelAttrs)`
|
30
|
-
color: ${(props) =>
|
31
|
-
props.theme.colors[props.labelFontColor]
|
32
|
-
? props.theme.colors[props.labelFontColor]
|
33
|
-
: props.labelFontColor
|
34
|
-
? props.labelFontColor
|
35
|
-
: props.theme.colors.eturnityGrey};
|
36
|
-
|
37
|
-
font-size: ${(props) => (props.fontSize ? props.fontSize : '13px')};
|
38
|
-
font-weight: 700;
|
39
|
-
`
|
40
|
-
const optionalLabel = styled.span`
|
41
|
-
font-weight: 300;
|
42
|
-
`
|
43
|
-
|
44
|
-
const LabelWrapper = styled('div',{labelAlign:String})`
|
45
|
-
${props=>props.labelAlign=='horizontal'?
|
46
|
-
'display: inline-grid;':
|
47
|
-
'display: grid;'
|
48
|
-
}
|
49
|
-
${props=>props.labelAlign=='horizontal'?
|
50
|
-
'margin-right: 10px;':
|
51
|
-
'margin-bottom: 8px;'
|
52
|
-
}
|
53
|
-
vertical-align: center;
|
54
|
-
grid-template-columns: auto auto;
|
55
|
-
grid-gap: 12px;
|
56
|
-
align-items: center;
|
57
|
-
justify-content: start;
|
58
|
-
`
|
59
|
-
export default {
|
60
|
-
// import labelText from "@eturnity/eturnity_reusable_components/src/components/label"
|
61
|
-
// To use:
|
62
|
-
// <label-text
|
63
|
-
// infoTextAlign="right" // left by default
|
64
|
-
// infoTextMessage="My info message"
|
65
|
-
// label="Question 5"
|
66
|
-
// />
|
67
|
-
name: 'input-text',
|
68
|
-
components: {
|
69
|
-
InfoText,
|
70
|
-
InputLabel,
|
71
|
-
LabelWrapper,
|
72
|
-
optionalLabel
|
73
|
-
},
|
74
|
-
data() {
|
75
|
-
return {
|
76
|
-
inputTypeData: 'text'
|
77
|
-
}
|
78
|
-
},
|
79
|
-
props: {
|
80
|
-
infoTextMessage: {
|
81
|
-
required: false
|
82
|
-
},
|
83
|
-
infoTextAlign: {
|
84
|
-
required: false
|
85
|
-
},
|
86
|
-
labelOptional: {
|
87
|
-
required: false,
|
88
|
-
default: false
|
89
|
-
},
|
90
|
-
fontSize: {
|
91
|
-
required: false,
|
92
|
-
default: null
|
93
|
-
},
|
94
|
-
labelFontColor: {
|
95
|
-
required: false,
|
96
|
-
default: 'black'
|
97
|
-
},
|
98
|
-
labelAlign: {
|
99
|
-
required: false,
|
100
|
-
default: 'vertical'
|
101
|
-
},
|
102
|
-
},
|
103
|
-
}
|
104
|
-
</script>
|