@eturnity/eturnity_reusable_components 1.2.34-EPDM-5477.2 → 1.2.35
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 +105 -202
- package/src/assets/svgIcons/align_panel.svg +1 -0
- package/src/assets/svgIcons/areas_tool.svg +14 -0
- package/src/assets/svgIcons/base_layer.svg +3 -0
- package/src/assets/svgIcons/bug.svg +6 -0
- package/src/assets/svgIcons/direction_arrow.svg +4 -0
- package/src/assets/svgIcons/distance_tool.svg +8 -0
- package/src/assets/svgIcons/distort_tool.svg +10 -0
- package/src/assets/svgIcons/distort_tool2.svg +16 -0
- package/src/assets/svgIcons/draggable_corner.svg +5 -0
- package/src/assets/svgIcons/draw_tool.svg +3 -0
- package/src/assets/svgIcons/flatten.svg +12 -0
- package/src/assets/svgIcons/layers_close.svg +4 -0
- package/src/assets/svgIcons/layers_open.svg +4 -0
- package/src/assets/svgIcons/magic_tool.svg +6 -0
- package/src/assets/svgIcons/map_icon.svg +4 -2
- package/src/assets/svgIcons/map_settings.svg +3 -0
- package/src/assets/svgIcons/margin_tool.svg +4 -0
- package/src/assets/svgIcons/obstacle_tool.svg +7 -11
- package/src/assets/svgIcons/obstacle_tool_origin.svg +3 -0
- package/src/assets/svgIcons/opacity.svg +1 -0
- package/src/assets/svgIcons/outline_tool.svg +11 -0
- package/src/assets/svgIcons/redo.svg +6 -0
- package/src/assets/svgIcons/resizer.svg +5 -0
- package/src/assets/svgIcons/roof_layer.svg +3 -0
- package/src/assets/svgIcons/rotate_tool.svg +3 -0
- package/src/assets/svgIcons/ruler_tool.svg +3 -0
- package/src/assets/svgIcons/trim_tool.svg +4 -0
- package/src/assets/svgIcons/undo.svg +6 -0
- package/src/assets/svgIcons/vertical_tool.svg +3 -0
- package/src/assets/theme.js +2 -0
- package/src/components/deleteIcon/index.vue +8 -2
- package/src/components/icon/index.vue +11 -10
- package/src/components/iconWrapper/index.vue +116 -0
- package/src/components/infoText/index.vue +6 -11
- package/src/components/inputs/inputNumber/index.vue +113 -15
- package/src/components/inputs/inputText/index.vue +49 -8
- package/src/components/inputs/select/index.vue +387 -0
- package/src/components/inputs/select/option/index.vue +60 -0
- package/src/components/inputs/select/select.stories.js +59 -0
- package/src/components/inputs/switchField/index.vue +244 -0
- package/src/components/modals/modal/index.vue +7 -2
- package/src/helpers/numberConverter.js +1 -0
@@ -0,0 +1,3 @@
|
|
1
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.96161 0L10.9232 3.96161L7.96713 3.96161V6.55264L12.3875 9.0786L14 10L12.3875 10.9214L7 14L1.61245 10.9214L0 10L1.61245 9.0786L5.99272 6.57559V3.96161L3 3.96161L6.96161 0ZM5.99272 8.41839L3.2249 10L7 12.1572L10.7751 10L7.96713 8.39545V9.78795H5.99272V8.41839Z" fill="white"/>
|
3
|
+
</svg>
|
package/src/assets/theme.js
CHANGED
@@ -6,6 +6,7 @@
|
|
6
6
|
>
|
7
7
|
<icon-image
|
8
8
|
v-if="isHovered && !isDisabled"
|
9
|
+
:hoverBg="hoverBg"
|
9
10
|
:src="require('../../assets/icons/delete_icon.svg')"
|
10
11
|
/>
|
11
12
|
<icon-image
|
@@ -27,9 +28,10 @@ const Wrapper = styled("div", wrapperAttrs)`
|
|
27
28
|
cursor: ${(props) => (props.isDisabled ? "not-allowed" : "pointer")};
|
28
29
|
`
|
29
30
|
|
30
|
-
const
|
31
|
+
const IconImageAttrs = { hoverBg: String }
|
32
|
+
const IconImage = styled('img', IconImageAttrs)`
|
31
33
|
&:hover {
|
32
|
-
background-color: ${(props) => props.theme.colors.grey5};
|
34
|
+
background-color: ${(props) => props.hoverBg ? props.hoverBg : props.theme.colors.grey5};
|
33
35
|
border-radius: 4px;
|
34
36
|
}
|
35
37
|
`
|
@@ -45,6 +47,10 @@ export default {
|
|
45
47
|
required: false,
|
46
48
|
default: false,
|
47
49
|
},
|
50
|
+
hoverBg: {
|
51
|
+
required: false,
|
52
|
+
default: '',
|
53
|
+
}
|
48
54
|
},
|
49
55
|
data() {
|
50
56
|
return {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
<template>
|
2
|
-
<
|
2
|
+
<Wrapper :isDisabled="disabled" :size="size" :cursor="cursor">
|
3
3
|
<icon-image
|
4
|
+
:disabled="disabled"
|
4
5
|
:size="size"
|
5
6
|
:color="color"
|
6
7
|
:hoveredColor="hoveredColor"
|
@@ -8,7 +9,7 @@
|
|
8
9
|
require(`!html-loader!./../../assets/svgIcons/${name.toLowerCase()}.svg`)
|
9
10
|
"
|
10
11
|
></icon-image>
|
11
|
-
</
|
12
|
+
</Wrapper>
|
12
13
|
</template>
|
13
14
|
|
14
15
|
<script>
|
@@ -35,14 +36,14 @@ const Wrapper = styled('div', wrapperAttrs)`
|
|
35
36
|
const IconImageProps = { color: String, hoveredColor: String, size: String }
|
36
37
|
const IconImage = styled('div', IconImageProps)`
|
37
38
|
svg {
|
38
|
-
width:
|
39
|
-
height:
|
39
|
+
width: 100%;
|
40
|
+
height: 100%;
|
40
41
|
}
|
41
|
-
svg
|
42
|
+
svg path {
|
42
43
|
${(props) =>
|
43
44
|
props.color && `fill: ${props.theme.colors[props.color] || props.color};`}
|
44
45
|
}
|
45
|
-
&:hover > svg
|
46
|
+
&:hover > svg path {
|
46
47
|
${(props) => props.hoveredColor && `fill: ${props.hoveredColor};`}
|
47
48
|
}
|
48
49
|
`
|
@@ -50,11 +51,11 @@ const IconImage = styled('div', IconImageProps)`
|
|
50
51
|
export default {
|
51
52
|
name: 'icon',
|
52
53
|
components: {
|
53
|
-
|
54
|
-
|
54
|
+
IconImage,
|
55
|
+
Wrapper
|
55
56
|
},
|
56
57
|
props: {
|
57
|
-
|
58
|
+
disabled: {
|
58
59
|
required: false,
|
59
60
|
default: false
|
60
61
|
},
|
@@ -73,7 +74,7 @@ export default {
|
|
73
74
|
},
|
74
75
|
cursor: {
|
75
76
|
required: false,
|
76
|
-
default:
|
77
|
+
default: null
|
77
78
|
}
|
78
79
|
},
|
79
80
|
data() {
|
@@ -0,0 +1,116 @@
|
|
1
|
+
<template>
|
2
|
+
<Wrapper
|
3
|
+
:disabled="disabled"
|
4
|
+
:size="size"
|
5
|
+
:backgroundColor="backgroundColor"
|
6
|
+
:borderRadius="borderRadius"
|
7
|
+
:hoveredBackgroundColor="hoveredBackgroundColor"
|
8
|
+
:isHovered="isHovered"
|
9
|
+
>
|
10
|
+
<icon :disabled="disabled"
|
11
|
+
:size="iconSize"
|
12
|
+
:name="name"
|
13
|
+
:color="iconColor"
|
14
|
+
:hoveredColor="hoveredIconColor" />
|
15
|
+
<caret v-if="hasCaret">
|
16
|
+
<iconWrapper :disabled="disabled"
|
17
|
+
size="10px"
|
18
|
+
name="arrow_down"
|
19
|
+
:iconColor="iconColor"
|
20
|
+
:hoveredBackgroundColor="hoveredIconColor"
|
21
|
+
borderRadius="1px"
|
22
|
+
/>
|
23
|
+
</caret>
|
24
|
+
</Wrapper>
|
25
|
+
</template>
|
26
|
+
|
27
|
+
<script>
|
28
|
+
// import Icon from "@eturnity/eturnity_reusable_components/src/components/icon"
|
29
|
+
// How to use:
|
30
|
+
//<icon
|
31
|
+
// name="House" //required. a svg file named [name].svg should be present in /assets/svgIcons
|
32
|
+
// color="red"
|
33
|
+
// hoveredColor="blue"
|
34
|
+
// size="60px" by default, this is 30px
|
35
|
+
// />
|
36
|
+
|
37
|
+
import styled from 'vue-styled-components'
|
38
|
+
import icon from '../icon'
|
39
|
+
const wrapperAttrs = { isHovered:Boolean,borderRadius:String,disabled: Boolean, size: String,backgroundColor:String,hoveredBackgroundColor:String }
|
40
|
+
const Wrapper = styled('div', wrapperAttrs)`
|
41
|
+
position:relative;
|
42
|
+
display: inline-flex;
|
43
|
+
width: ${(props) => props.size};
|
44
|
+
height: ${(props) => props.size};
|
45
|
+
justify-content:center;
|
46
|
+
align-items:center;
|
47
|
+
cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
|
48
|
+
background-color: ${(props)=>props.theme.colors[props.backgroundColor] || props.backgroundColor};
|
49
|
+
border-radius: ${(props) => props.borderRadius};
|
50
|
+
${(props)=>(props.isHovered ? 'background-color:'+props.theme.colors[props.hoveredBackgroundColor] || props.hoveredBackgroundColor : "")};
|
51
|
+
&:hover{
|
52
|
+
background-color:${(props)=>props.theme.colors[props.hoveredBackgroundColor] || props.hoveredBackgroundColor};
|
53
|
+
}
|
54
|
+
`
|
55
|
+
const caret=styled.div`
|
56
|
+
position:absolute;
|
57
|
+
bottom:3px;
|
58
|
+
right:2px;
|
59
|
+
height:10px;
|
60
|
+
`
|
61
|
+
|
62
|
+
export default {
|
63
|
+
name: 'iconWrapper',
|
64
|
+
components: {
|
65
|
+
Wrapper,
|
66
|
+
icon,
|
67
|
+
caret
|
68
|
+
},
|
69
|
+
props: {
|
70
|
+
disabled: {
|
71
|
+
required: false,
|
72
|
+
default: false
|
73
|
+
},
|
74
|
+
name: {
|
75
|
+
required: true
|
76
|
+
},
|
77
|
+
iconColor: {
|
78
|
+
required: false,
|
79
|
+
default: 'white'
|
80
|
+
},
|
81
|
+
hoveredIconColor: {
|
82
|
+
required: false
|
83
|
+
},
|
84
|
+
backgroundColor: {
|
85
|
+
required: false,
|
86
|
+
},
|
87
|
+
hoveredBackgroundColor: {
|
88
|
+
required: false,
|
89
|
+
default:"transparentWhite1"
|
90
|
+
},
|
91
|
+
size: {
|
92
|
+
required: false,
|
93
|
+
default: '32px'
|
94
|
+
},
|
95
|
+
iconSize:{
|
96
|
+
required: false,
|
97
|
+
default:'18px'
|
98
|
+
},
|
99
|
+
hasCaret:{
|
100
|
+
required: false,
|
101
|
+
default: false
|
102
|
+
},
|
103
|
+
borderRadius:{
|
104
|
+
required:false,
|
105
|
+
default:'6px'
|
106
|
+
},
|
107
|
+
isHovered:{
|
108
|
+
required:false,
|
109
|
+
default:false
|
110
|
+
}
|
111
|
+
},
|
112
|
+
data() {
|
113
|
+
return {}
|
114
|
+
}
|
115
|
+
}
|
116
|
+
</script>
|
@@ -2,14 +2,11 @@
|
|
2
2
|
<component-wrapper>
|
3
3
|
<icon-wrapper :size="size">
|
4
4
|
<icon-img
|
5
|
-
:isActive="showInfo"
|
6
|
-
:size="size"
|
7
|
-
:borderColor="borderColor"
|
8
5
|
@click.prevent="toggleShowInfo()"
|
9
6
|
@mouseenter="openTrigger == 'onHover' ? toggleShowInfo() : ''"
|
10
7
|
@mouseleave="openTrigger == 'onHover' ? toggleShowInfo() : ''"
|
11
8
|
>
|
12
|
-
<icon :size="size" name="info" :color="iconColor" />
|
9
|
+
<icon :size="size" name="info" :color="iconColor" cursor="pointer" />
|
13
10
|
</icon-img>
|
14
11
|
<text-overlay
|
15
12
|
v-if="showInfo"
|
@@ -54,7 +51,7 @@ const TextOverlay = styled('div', textAttrs)`
|
|
54
51
|
: props.alignArrow === 'center'
|
55
52
|
? 'left: calc((-' + props.width + ' + ' + props.iconSize + ') /2 + 2px)'
|
56
53
|
: 'right: calc(' + props.iconSize + ' /2 - 17px)'};
|
57
|
-
text-align:
|
54
|
+
text-align: left;
|
58
55
|
background: ${(props) => props.theme.colors.black};
|
59
56
|
padding: 10px;
|
60
57
|
width: ${(props) => props.width};
|
@@ -87,16 +84,14 @@ const TextOverlay = styled('div', textAttrs)`
|
|
87
84
|
}
|
88
85
|
`
|
89
86
|
|
90
|
-
const iconAttrs = {
|
91
|
-
|
87
|
+
const iconAttrs = { size: String }
|
92
88
|
const IconWrapper = styled('div', iconAttrs)`
|
93
89
|
position: relative;
|
94
|
-
top: 1px;
|
95
90
|
height: ${(props) => props.size};
|
96
91
|
`
|
97
|
-
|
98
|
-
|
99
|
-
height:
|
92
|
+
|
93
|
+
const IconImg = styled.div`
|
94
|
+
line-height: 0;
|
100
95
|
`
|
101
96
|
|
102
97
|
const ComponentWrapper = styled.div`
|
@@ -1,7 +1,11 @@
|
|
1
1
|
<template>
|
2
|
-
<container :inputWidth="inputWidth">
|
2
|
+
<container :inputWidth="inputWidth" :alignItems="alignItems">
|
3
|
+
<label-slot-wrapper v-if="hasLabelSlot" :isInteractive="isInteractive" @mousedown="initInteraction">
|
4
|
+
<slot name="label"></slot>
|
5
|
+
</label-slot-wrapper>
|
6
|
+
|
3
7
|
<label-wrapper v-if="labelText">
|
4
|
-
<label-text>
|
8
|
+
<label-text :labelFontColor="labelFontColor">
|
5
9
|
{{ labelText }}
|
6
10
|
</label-text>
|
7
11
|
<info-text
|
@@ -19,21 +23,24 @@
|
|
19
23
|
:hasUnit="unitName && !!unitName.length"
|
20
24
|
:placeholder="displayedPlaceholder"
|
21
25
|
:isError="isError"
|
22
|
-
:inputWidth="inputWidth"
|
23
26
|
:inputHeight="inputHeight"
|
24
27
|
:minWidth="minWidth"
|
25
28
|
:value="formatWithCurrency(value)"
|
26
29
|
@blur="onInputBlur($event)"
|
27
30
|
@focus="focusInput()"
|
28
31
|
@keyup.enter="$emit('on-enter-click')"
|
32
|
+
@input="onInput($event)"
|
29
33
|
:disabled="disabled"
|
30
34
|
:isDisabled="disabled"
|
31
35
|
:noBorder="noBorder"
|
36
|
+
:borderColor="borderColor"
|
32
37
|
:textAlign="textAlign"
|
33
38
|
:fontSize="fontSize"
|
34
39
|
:fontColor="fontColor"
|
40
|
+
:backgroundColor="backgroundColor"
|
35
41
|
v-on="$listeners"
|
36
42
|
:hasSlot="hasSlot"
|
43
|
+
:hasLabelSlot="hasLabelSlot"
|
37
44
|
:slotSize="slotSize"
|
38
45
|
/>
|
39
46
|
<slot-container v-if="hasSlot" :slotSize="slotSize" :isError="isError">
|
@@ -101,14 +108,23 @@ const inputProps = {
|
|
101
108
|
textAlign: String,
|
102
109
|
fontSize: String,
|
103
110
|
fontColor: String,
|
111
|
+
backgroundColor:String,
|
104
112
|
hasSlot: Boolean,
|
113
|
+
hasLabelSlot: Boolean,
|
105
114
|
slotSize: String,
|
106
|
-
inputHeight:
|
115
|
+
inputHeight:String,
|
116
|
+
isInteractive:Boolean,
|
117
|
+
alignItems:String,
|
118
|
+
labelFontColor:String,
|
119
|
+
borderColor:String
|
107
120
|
}
|
108
121
|
|
109
122
|
const Container = styled('div', inputProps)`
|
110
123
|
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
111
124
|
position: relative;
|
125
|
+
display:grid;
|
126
|
+
grid-template-columns: ${(props) =>
|
127
|
+
props.alignItems === "vertical" ? "1fr" : "auto 1fr"};
|
112
128
|
`
|
113
129
|
|
114
130
|
const InputContainer = styled('input', inputProps)`
|
@@ -117,6 +133,10 @@ const InputContainer = styled('input', inputProps)`
|
|
117
133
|
? '1px solid ' + props.theme.colors.red
|
118
134
|
: props.noBorder
|
119
135
|
? 'none'
|
136
|
+
: props.borderColor ?
|
137
|
+
props.theme.colors[props.borderColor]
|
138
|
+
? '1px solid ' + props.theme.colors[props.borderColor]
|
139
|
+
: '1px solid ' + props.borderColor
|
120
140
|
: '1px solid ' + props.theme.colors.grey4};
|
121
141
|
padding-top: 11px;
|
122
142
|
padding-bottom: 11px;
|
@@ -124,8 +144,6 @@ const InputContainer = styled('input', inputProps)`
|
|
124
144
|
padding-right: ${(props) =>
|
125
145
|
props.slotSize
|
126
146
|
? 'calc(' + props.slotSize + ' + 10px)'
|
127
|
-
: props.hasUnit
|
128
|
-
? '40px'
|
129
147
|
: '5px'};
|
130
148
|
border-radius: 4px;
|
131
149
|
text-align: ${(props) => props.textAlign};
|
@@ -139,7 +157,10 @@ const InputContainer = styled('input', inputProps)`
|
|
139
157
|
: props.fontColor
|
140
158
|
? props.fontColor + ' !important'
|
141
159
|
: props.theme.colors.black};
|
142
|
-
|
160
|
+
background-color:${(props) => props.backgroundColor
|
161
|
+
? props.backgroundColor+' !important'
|
162
|
+
: props.theme.colors.white};
|
163
|
+
width: ${(props) => (props.inputWidth && !props.hasLabelSlot ? props.inputWidth : '100%')};
|
143
164
|
min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
|
144
165
|
background-color: ${(props) =>
|
145
166
|
props.isDisabled ? props.theme.colors.grey5 : '#fff'};
|
@@ -211,15 +232,23 @@ const SlotContainer = styled('span', inputProps)`
|
|
211
232
|
: props.theme.colors.mediumGray};
|
212
233
|
`
|
213
234
|
|
214
|
-
const LabelWrapper = styled
|
235
|
+
const LabelWrapper = styled('div',inputProps)`
|
215
236
|
display: flex;
|
237
|
+
align-items: center;
|
216
238
|
gap: 10px;
|
217
239
|
margin-bottom: 8px;
|
240
|
+
cursor: ${(props) => (props.isInteractive?'ew-resize':'auto')};
|
241
|
+
`
|
242
|
+
const LabelSlotWrapper = styled('div',inputProps)`
|
243
|
+
display: flex;
|
244
|
+
gap: 10px;
|
245
|
+
align-items:center;
|
246
|
+
cursor: ${(props) => (props.isInteractive?'ew-resize':'auto')};
|
218
247
|
`
|
219
248
|
|
220
|
-
const LabelText = styled
|
249
|
+
const LabelText = styled('div',inputProps)`
|
221
250
|
font-size: 13px;
|
222
|
-
color: ${(props) => props.theme.colors.
|
251
|
+
color: ${(props) => props.theme.colors[props.labelFontColor]?props.theme.colors[props.labelFontColor]:props.labelFontColor};
|
223
252
|
font-weight: 700;
|
224
253
|
`
|
225
254
|
|
@@ -232,10 +261,11 @@ export default {
|
|
232
261
|
UnitContainer,
|
233
262
|
ErrorMessage,
|
234
263
|
LabelWrapper,
|
264
|
+
LabelSlotWrapper,
|
235
265
|
LabelText,
|
236
266
|
InfoText,
|
237
267
|
Icon,
|
238
|
-
SlotContainer
|
268
|
+
SlotContainer,
|
239
269
|
},
|
240
270
|
inheritAttrs: false,
|
241
271
|
data() {
|
@@ -274,6 +304,10 @@ export default {
|
|
274
304
|
required: false,
|
275
305
|
default: false
|
276
306
|
},
|
307
|
+
alignItems: {
|
308
|
+
required: false,
|
309
|
+
default: "vertical",
|
310
|
+
},
|
277
311
|
errorMessage: {
|
278
312
|
required: false,
|
279
313
|
default: 'Please insert a correct number'
|
@@ -298,6 +332,9 @@ export default {
|
|
298
332
|
required: false,
|
299
333
|
default: false
|
300
334
|
},
|
335
|
+
borderColor:{
|
336
|
+
required:false,
|
337
|
+
},
|
301
338
|
textAlign: {
|
302
339
|
required: false,
|
303
340
|
default: 'left'
|
@@ -306,6 +343,14 @@ export default {
|
|
306
343
|
required: false,
|
307
344
|
default: '13px'
|
308
345
|
},
|
346
|
+
isInteractive: {
|
347
|
+
required: false,
|
348
|
+
default: false
|
349
|
+
},
|
350
|
+
interactionStep:{
|
351
|
+
required:false,
|
352
|
+
default:1
|
353
|
+
},
|
309
354
|
labelText: {
|
310
355
|
required: false,
|
311
356
|
default: null
|
@@ -326,6 +371,10 @@ export default {
|
|
326
371
|
required: false,
|
327
372
|
default: null
|
328
373
|
},
|
374
|
+
backgroundColor: {
|
375
|
+
required: false,
|
376
|
+
default: null
|
377
|
+
},
|
329
378
|
numberToStringEnabled: {
|
330
379
|
required: false,
|
331
380
|
default: true
|
@@ -351,6 +400,10 @@ export default {
|
|
351
400
|
},
|
352
401
|
slotSize: {
|
353
402
|
required: false
|
403
|
+
},
|
404
|
+
labelFontColor:{
|
405
|
+
required:false,
|
406
|
+
default:'eturnityGrey'
|
354
407
|
}
|
355
408
|
},
|
356
409
|
computed: {
|
@@ -361,9 +414,9 @@ export default {
|
|
361
414
|
hasSlot() {
|
362
415
|
return !!this.$slots.default
|
363
416
|
},
|
364
|
-
|
365
|
-
return this
|
366
|
-
}
|
417
|
+
hasLabelSlot(){
|
418
|
+
return !!this.$slots.label
|
419
|
+
},
|
367
420
|
},
|
368
421
|
methods: {
|
369
422
|
onChangeHandler(event) {
|
@@ -412,6 +465,16 @@ export default {
|
|
412
465
|
}
|
413
466
|
return evaluated
|
414
467
|
},
|
468
|
+
onInput(value){
|
469
|
+
let evaluatedVal
|
470
|
+
try{
|
471
|
+
evaluatedVal=this.onEvaluateCode(value)
|
472
|
+
}finally {
|
473
|
+
if(evaluatedVal){
|
474
|
+
this.$emit('on-input',evaluatedVal)
|
475
|
+
}
|
476
|
+
}
|
477
|
+
},
|
415
478
|
onInputBlur(e) {
|
416
479
|
this.isFocused = false
|
417
480
|
let value = e.target.value
|
@@ -442,6 +505,15 @@ export default {
|
|
442
505
|
})
|
443
506
|
this.$emit('input-focus')
|
444
507
|
},
|
508
|
+
blurInput() {
|
509
|
+
if (this.disabled) {
|
510
|
+
return
|
511
|
+
}
|
512
|
+
this.isFocused = false
|
513
|
+
this.$nextTick(() => {
|
514
|
+
this.$refs.inputField1.$el.blur()
|
515
|
+
})
|
516
|
+
},
|
445
517
|
formatWithCurrency(value) {
|
446
518
|
let adjustedMinValue =
|
447
519
|
value || value === 0
|
@@ -469,7 +541,33 @@ export default {
|
|
469
541
|
})
|
470
542
|
: adjustedMinValue
|
471
543
|
}
|
472
|
-
}
|
544
|
+
},
|
545
|
+
initInteraction(e) {
|
546
|
+
window.addEventListener('mousemove', this.interact, false);
|
547
|
+
window.addEventListener('mouseup', this.stopInteract, false);
|
548
|
+
e.preventDefault()
|
549
|
+
this.focusInput()
|
550
|
+
},
|
551
|
+
interact(e) {
|
552
|
+
e.preventDefault()
|
553
|
+
let value=parseFloat(this.value || 0)
|
554
|
+
console.log("value",value)
|
555
|
+
value+=parseFloat(this.interactionStep)*parseInt(e.movementX)
|
556
|
+
this.$emit('on-input',value)
|
557
|
+
|
558
|
+
this.textInput=numberToString({
|
559
|
+
value:
|
560
|
+
value && value.length ? value : this.minNumber,
|
561
|
+
numberPrecision: this.numberPrecision
|
562
|
+
})
|
563
|
+
//this.value=value
|
564
|
+
},
|
565
|
+
stopInteract(e) {
|
566
|
+
e.preventDefault()
|
567
|
+
window.removeEventListener('mousemove', this.interact, false);
|
568
|
+
window.removeEventListener('mouseup', this.stopInteract, false);
|
569
|
+
this.blurInput()
|
570
|
+
},
|
473
571
|
},
|
474
572
|
created() {
|
475
573
|
if (this.value) {
|
@@ -5,7 +5,7 @@
|
|
5
5
|
:alignItems="alignItems"
|
6
6
|
>
|
7
7
|
<label-wrapper v-if="label">
|
8
|
-
<input-label :fontSize="fontSize">{{ label }}</input-label>
|
8
|
+
<input-label :labelFontColor="labelFontColor" :fontSize="fontSize">{{ label }}</input-label>
|
9
9
|
<info-text
|
10
10
|
v-if="infoTextMessage"
|
11
11
|
:text="infoTextMessage"
|
@@ -21,6 +21,7 @@
|
|
21
21
|
:isError="isError"
|
22
22
|
:inputWidth="inputWidth"
|
23
23
|
:minWidth="minWidth"
|
24
|
+
:inputHeight="inputHeight"
|
24
25
|
:value="value"
|
25
26
|
@input="onChangeHandler"
|
26
27
|
@blur="onInputBlur"
|
@@ -30,6 +31,8 @@
|
|
30
31
|
:fontSize="fontSize"
|
31
32
|
:inputType="inputType"
|
32
33
|
:type="inputTypeData"
|
34
|
+
:fontColor="fontColor"
|
35
|
+
:backgroundColor="backgroundColor"
|
33
36
|
/>
|
34
37
|
<icon-wrapper
|
35
38
|
v-if="inputType === 'password' && !isError"
|
@@ -61,9 +64,15 @@ const Container = styled.div`
|
|
61
64
|
position: relative;
|
62
65
|
`
|
63
66
|
|
64
|
-
const labelAttrs = { fontSize: String }
|
67
|
+
const labelAttrs = { fontSize: String,labelFontColor:String, }
|
65
68
|
const InputLabel = styled('div', labelAttrs)`
|
66
|
-
color: ${(props) => props.theme.colors.
|
69
|
+
color: ${(props) => props.theme.colors[props.labelFontColor]?
|
70
|
+
props.theme.colors[props.labelFontColor]:
|
71
|
+
props.labelFontColor?
|
72
|
+
props.labelFontColor:
|
73
|
+
props.theme.colors.eturnityGrey
|
74
|
+
};
|
75
|
+
|
67
76
|
font-size: ${(props) => (props.fontSize ? props.fontSize : '13px')};
|
68
77
|
font-weight: 700;
|
69
78
|
`
|
@@ -90,14 +99,22 @@ const inputProps = {
|
|
90
99
|
noBorder: Boolean,
|
91
100
|
isDisabled: Boolean,
|
92
101
|
fontSize: String,
|
93
|
-
inputType: String
|
102
|
+
inputType: String,
|
103
|
+
fontColor: String,
|
104
|
+
backgroundColor:String,
|
105
|
+
borderColor:String,
|
106
|
+
inputHeight:String,
|
94
107
|
}
|
95
108
|
const InputContainer = styled('input', inputProps)`
|
96
109
|
border: ${(props) =>
|
97
|
-
|
110
|
+
props.isError
|
98
111
|
? '1px solid ' + props.theme.colors.red
|
99
112
|
: props.noBorder
|
100
113
|
? 'none'
|
114
|
+
: props.borderColor ?
|
115
|
+
props.theme.colors[props.borderColor]
|
116
|
+
? '1px solid ' + props.theme.colors[props.borderColor]
|
117
|
+
: '1px solid ' + props.borderColor
|
101
118
|
: '1px solid ' + props.theme.colors.grey4};
|
102
119
|
padding: ${(props) =>
|
103
120
|
props.isError
|
@@ -113,15 +130,20 @@ const InputContainer = styled('input', inputProps)`
|
|
113
130
|
? props.theme.colors.grey6
|
114
131
|
: props.isDisabled
|
115
132
|
? props.theme.colors.grey2
|
133
|
+
: props.fontColor
|
134
|
+
? props.fontColor + ' !important'
|
116
135
|
: props.theme.colors.black};
|
136
|
+
|
117
137
|
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
118
138
|
min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
|
139
|
+
max-height: ${(props) => props.inputHeight};
|
119
140
|
box-sizing: border-box; // to allow width of 100% with padding
|
120
141
|
font-weight: 500;
|
121
142
|
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
|
122
143
|
background-color: ${(props) =>
|
123
|
-
props.isDisabled ? props.theme.colors.grey5 :
|
124
|
-
|
144
|
+
props.isDisabled ? props.theme.colors.grey5 :
|
145
|
+
props.backgroundColor ? props.backgroundColor+' !important' :
|
146
|
+
props.theme.colors.white};
|
125
147
|
&::placeholder {
|
126
148
|
color: ${(props) => props.theme.colors.grey2};
|
127
149
|
}
|
@@ -209,6 +231,10 @@ export default {
|
|
209
231
|
required: false,
|
210
232
|
default: null
|
211
233
|
},
|
234
|
+
inputHeight: {
|
235
|
+
required: false,
|
236
|
+
default: null
|
237
|
+
},
|
212
238
|
minWidth: {
|
213
239
|
required: false,
|
214
240
|
default: null
|
@@ -245,7 +271,22 @@ export default {
|
|
245
271
|
inputType: {
|
246
272
|
required: false,
|
247
273
|
default: 'text'
|
248
|
-
}
|
274
|
+
},
|
275
|
+
labelFontColor:{
|
276
|
+
required:false,
|
277
|
+
default:'black'
|
278
|
+
},
|
279
|
+
backgroundColor:{
|
280
|
+
required:false,
|
281
|
+
default:'white'
|
282
|
+
},
|
283
|
+
fontColor:{
|
284
|
+
required:false,
|
285
|
+
default:'black'
|
286
|
+
},
|
287
|
+
borderColor:{
|
288
|
+
required:false,
|
289
|
+
},
|
249
290
|
},
|
250
291
|
methods: {
|
251
292
|
onChangeHandler($event) {
|