@eturnity/eturnity_reusable_components 7.8.6-EPDM-9779.0 → 7.8.6-EPDM-7779.3
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
CHANGED
package/src/assets/theme.js
CHANGED
@@ -46,8 +46,7 @@
|
|
46
46
|
@keydown.native="onKeyDown"
|
47
47
|
:showBorder="showBorder"
|
48
48
|
:data-id="dataId"
|
49
|
-
|
50
|
-
>
|
49
|
+
>
|
51
50
|
<draggableInputHandle v-if="isDraggable && !isSearchBarVisible" :height="selectHeight" />
|
52
51
|
<inputText
|
53
52
|
v-if="isSearchBarVisible"
|
@@ -65,7 +64,7 @@
|
|
65
64
|
@input-change="searchChange"
|
66
65
|
@click.native.stop
|
67
66
|
/>
|
68
|
-
<selector v-else>
|
67
|
+
<selector :selectWidth="selectWidth" v-else>
|
69
68
|
<slot name="selector" :selectedValue="selectedValue"></slot>
|
70
69
|
</selector>
|
71
70
|
<Caret @click.stop="toggleCaretDropdown">
|
@@ -145,20 +144,27 @@ import icon from '../../icon'
|
|
145
144
|
import inputText from '../inputText'
|
146
145
|
import draggableInputHandle from '../../draggableInputHandle'
|
147
146
|
|
147
|
+
const CARET_WIDTH = '30px'
|
148
|
+
const PADDING = this.isDraggable ? '30px' : '15px'
|
149
|
+
const BORDER_WIDTH = '1px'
|
150
|
+
|
148
151
|
const Caret = styled.div`
|
149
152
|
display: flex;
|
150
153
|
align-items: center;
|
151
154
|
justify-content: center;
|
152
|
-
width:
|
153
|
-
min-width:
|
155
|
+
width: ${CARET_WIDTH};
|
156
|
+
min-width: ${CARET_WIDTH};
|
154
157
|
height: 100%;
|
155
|
-
align-items: stretch
|
158
|
+
align-items: stretch;
|
156
159
|
cursor: pointer;
|
157
160
|
margin-left: auto;
|
158
161
|
`
|
159
162
|
|
160
|
-
const Selector = styled
|
161
|
-
width:
|
163
|
+
const Selector = styled('div', { selectWidth: String })`
|
164
|
+
max-width: ${(props) => `calc(${props.selectWidth} - (${CARET_WIDTH} + ${PADDING} + (${BORDER_WIDTH} * 2)))`};
|
165
|
+
white-space: nowrap;
|
166
|
+
text-overflow: ellipsis;
|
167
|
+
overflow: hidden;
|
162
168
|
`
|
163
169
|
|
164
170
|
const labelAttrs = { fontSize: String, fontColor: String }
|
@@ -167,7 +173,7 @@ const InputLabel = styled('div', labelAttrs)`
|
|
167
173
|
props.theme.colors[props.fontColor]
|
168
174
|
? props.theme.colors[props.fontColor]
|
169
175
|
: props.fontColor};
|
170
|
-
font-size: ${(props) =>
|
176
|
+
font-size: ${(props) => props.fontSize};
|
171
177
|
font-weight: 700;
|
172
178
|
`
|
173
179
|
const optionalLabel = styled.span`
|
@@ -175,7 +181,7 @@ const optionalLabel = styled.span`
|
|
175
181
|
`
|
176
182
|
const inputProps = { selectWidth: String, optionWidth: String }
|
177
183
|
const Container = styled('div', inputProps)`
|
178
|
-
width: ${(props) =>
|
184
|
+
width: ${(props) => props.selectWidth};
|
179
185
|
position: relative;
|
180
186
|
display: inline-block;
|
181
187
|
`
|
@@ -203,16 +209,14 @@ const selectButtonAttrs = {
|
|
203
209
|
height: String,
|
204
210
|
selectMinHeight: String,
|
205
211
|
isSearchBarVisible: Boolean,
|
206
|
-
showBorder: Boolean
|
207
|
-
isDraggable: Boolean,
|
212
|
+
showBorder: Boolean
|
208
213
|
}
|
209
214
|
const selectButton = styled('div', selectButtonAttrs)`
|
210
215
|
position: relative;
|
211
216
|
box-sizing: border-box;
|
212
217
|
border-radius: 4px;
|
213
|
-
|
218
|
+
${(props) => (props.isSearchBarVisible ? '' : `padding-left: ${PADDING}` )};
|
214
219
|
text-align: left;
|
215
|
-
border-radius: 4px;
|
216
220
|
min-height: ${(props) =>
|
217
221
|
props.selectHeight
|
218
222
|
? props.selectHeight
|
@@ -227,7 +231,7 @@ const selectButton = styled('div', selectButtonAttrs)`
|
|
227
231
|
${({ showBorder, theme, hasError }) =>
|
228
232
|
showBorder &&
|
229
233
|
`
|
230
|
-
border:
|
234
|
+
border: ${BORDER_WIDTH} solid ${hasError ? theme.colors.red : theme.colors.grey4}
|
231
235
|
`}
|
232
236
|
background-color:${(props) =>
|
233
237
|
props.disabled
|
@@ -249,7 +253,6 @@ const selectDropdownAttrs = {
|
|
249
253
|
hoveredBgColor: String,
|
250
254
|
bgColor: String,
|
251
255
|
fontColor: String,
|
252
|
-
selectWidth: String,
|
253
256
|
optionWidth: String,
|
254
257
|
hoveredIndex: Number,
|
255
258
|
hoveredValue: Number | String,
|
@@ -260,7 +263,7 @@ const selectDropdown = styled('div', selectDropdownAttrs)`
|
|
260
263
|
z-index:${(props) => (props.isActive ? '2' : '1')};
|
261
264
|
position:absolute;
|
262
265
|
top:5px;
|
263
|
-
border:
|
266
|
+
border: ${BORDER_WIDTH} solid ${(props) => props.theme.colors.grey4};
|
264
267
|
border-radius:4px;
|
265
268
|
display: flex;
|
266
269
|
flex-direction: column;
|
@@ -307,7 +310,7 @@ export default {
|
|
307
310
|
},
|
308
311
|
fontSize: {
|
309
312
|
required: false,
|
310
|
-
default:
|
313
|
+
default: '13px'
|
311
314
|
},
|
312
315
|
label: {
|
313
316
|
required: false
|
@@ -327,8 +330,9 @@ export default {
|
|
327
330
|
required: false
|
328
331
|
},
|
329
332
|
selectWidth: {
|
333
|
+
type: String,
|
330
334
|
required: false,
|
331
|
-
default:
|
335
|
+
default: '100%'
|
332
336
|
},
|
333
337
|
selectHeight: {
|
334
338
|
type: String,
|
@@ -511,9 +515,6 @@ export default {
|
|
511
515
|
}
|
512
516
|
})
|
513
517
|
},
|
514
|
-
onSelectSlotClick() {
|
515
|
-
this.toggleDropdown()
|
516
|
-
},
|
517
518
|
clickOutside(event) {
|
518
519
|
const dropdownRef = this.$refs.dropdown
|
519
520
|
// we need to prevent closing on selecting an option, because in the case of
|
@@ -559,26 +560,21 @@ export default {
|
|
559
560
|
this.$refs.dropdown.$el.scrollTop = topPos
|
560
561
|
}
|
561
562
|
}
|
563
|
+
},
|
564
|
+
clearSearch() {
|
565
|
+
this.textSearch = ''
|
562
566
|
}
|
563
567
|
},
|
564
568
|
computed: {
|
565
569
|
optionLength() {
|
566
570
|
if (this.isDropdownOpen) {
|
567
|
-
|
568
|
-
const filterRef =
|
569
|
-
this.$refs.dropdown.$children &&
|
570
|
-
this.$refs.dropdown.$children.length > 1
|
571
|
-
? this.$refs.dropdown.$children
|
572
|
-
: this.$refs.dropdown.$children[0].$children
|
573
|
-
? this.$refs.dropdown.$children[0].$children
|
574
|
-
: this.$refs.dropdown.$children
|
575
|
-
return filterRef.length
|
576
|
-
} else {
|
577
|
-
return 0
|
571
|
+
return this.$refs.dropdown.$el.childElementCount
|
578
572
|
}
|
573
|
+
|
574
|
+
return 0
|
579
575
|
},
|
580
576
|
isSearchBarVisible() {
|
581
|
-
return this.isSearchable && this.
|
577
|
+
return this.isSearchable && this.isDropdownOpen
|
582
578
|
}
|
583
579
|
},
|
584
580
|
watch: {
|
@@ -5,7 +5,7 @@
|
|
5
5
|
:class="{ visible: isOpen, hidden: !isOpen }"
|
6
6
|
:backdrop="backdrop"
|
7
7
|
>
|
8
|
-
<modal-container @click
|
8
|
+
<modal-container @click="onClickModalContainer">
|
9
9
|
<spinner v-if="isLoading" size="50px" :limitedToModal="true" />
|
10
10
|
<content-container :visible="!isLoading">
|
11
11
|
<slot />
|
@@ -26,7 +26,7 @@
|
|
26
26
|
// import Modal from "@eturnity/eturnity_reusable_components/src/components/modals/modal"
|
27
27
|
// This is a more flexible modal box, where the parent can decide how the body of the modal looks
|
28
28
|
// To use:
|
29
|
-
// <modal :isOpen="isOpen" @on-close="$emit('on-close-summary')" :isLoading="true" :hideClose="true">
|
29
|
+
// <modal :isOpen="isOpen" @on-close="$emit('on-close-summary')" :isLoading="true" :hideClose="true" :stopPropagation="false">
|
30
30
|
// <div>Data....</div>
|
31
31
|
// </modal>
|
32
32
|
|
@@ -151,6 +151,10 @@ export default {
|
|
151
151
|
position: {
|
152
152
|
required: false,
|
153
153
|
default: 'fixed'
|
154
|
+
},
|
155
|
+
stopPropagation: {
|
156
|
+
type: Boolean,
|
157
|
+
default: true
|
154
158
|
}
|
155
159
|
},
|
156
160
|
beforeDestroy() {
|
@@ -164,6 +168,11 @@ export default {
|
|
164
168
|
if (key === 'Escape') {
|
165
169
|
this.onCloseModal()
|
166
170
|
}
|
171
|
+
},
|
172
|
+
onClickModalContainer(event) {
|
173
|
+
if (this.stopPropagation) {
|
174
|
+
event.stopPropagation()
|
175
|
+
}
|
167
176
|
}
|
168
177
|
},
|
169
178
|
watch: {
|