@eturnity/eturnity_reusable_components 1.2.22-EPDM-5202.1 → 1.2.23-3d-master.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/babel.config.js +1 -1
- package/package.json +1 -1
- package/src/App.vue +71 -36
- package/src/assets/icons/error_icon copy.png +0 -0
- package/src/assets/svgIcons/base_layer.svg +3 -0
- package/src/assets/svgIcons/draggable_corner.svg +5 -0
- package/src/assets/svgIcons/magic_tool.svg +6 -0
- package/src/assets/svgIcons/map_icon.svg +4 -2
- package/src/assets/svgIcons/margin_tool.svg +6 -0
- package/src/assets/svgIcons/obstacle_tool.svg +7 -11
- 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/undo.svg +6 -0
- package/src/assets/svgIcons/vertical_tool.svg +3 -0
- package/src/assets/theme.js +2 -0
- package/src/components/errorMessage/index.vue +62 -0
- package/src/components/icon/index.vue +11 -10
- package/src/components/iconWrapper/index.vue +116 -0
- package/src/components/infoText/index.vue +68 -53
- package/src/components/inputs/inputNumber/index.vue +194 -27
- package/src/components/inputs/inputText/index.vue +13 -12
- package/src/components/inputs/radioButton/index.vue +1 -1
- package/src/components/inputs/textAreaInput/index.vue +7 -2
- package/src/components/inputs/toggle/index.vue +2 -2
- package/src/components/pageSubtitle/index.vue +1 -1
- package/src/helpers/numberConverter.js +5 -0
|
@@ -1,34 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<component-wrapper>
|
|
3
|
-
<icon-wrapper>
|
|
3
|
+
<icon-wrapper :size="size">
|
|
4
4
|
<icon-img
|
|
5
5
|
:isActive="showInfo"
|
|
6
6
|
:size="size"
|
|
7
7
|
:borderColor="borderColor"
|
|
8
8
|
@click.prevent="toggleShowInfo()"
|
|
9
|
-
@mouseenter="toggleShowInfo()"
|
|
10
|
-
@mouseleave="toggleShowInfo()"
|
|
9
|
+
@mouseenter="openTrigger == 'onHover' ? toggleShowInfo() : ''"
|
|
10
|
+
@mouseleave="openTrigger == 'onHover' ? toggleShowInfo() : ''"
|
|
11
11
|
>
|
|
12
|
-
<
|
|
13
|
-
class="img-icon"
|
|
14
|
-
:width="size"
|
|
15
|
-
:height="size"
|
|
16
|
-
viewBox="0 0 24 24"
|
|
17
|
-
fill="none"
|
|
18
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
19
|
-
>
|
|
20
|
-
<path
|
|
21
|
-
class="img-icon"
|
|
22
|
-
d="M20.4853 3.51469C18.2188 1.24823 15.2053 0 12 0C8.79469 0 5.78123 1.24823 3.51469 3.51469C1.24823 5.78123 0 8.79469 0 12C0 15.2053 1.24823 18.2188 3.51469 20.4853C5.78123 22.7518 8.79469 24 12 24C15.2053 24 18.2188 22.7518 20.4853 20.4853C22.7518 18.2188 24 15.2053 24 12C24 8.79469 22.7518 5.78123 20.4853 3.51469ZM12 3.28125C13.4216 3.28125 14.5781 4.4378 14.5781 5.85938C14.5781 7.28095 13.4216 8.4375 12 8.4375C10.5784 8.4375 9.42188 7.28095 9.42188 5.85938C9.42188 4.4378 10.5784 3.28125 12 3.28125ZM15.2812 19.6875H8.71875V18.2812H10.125V11.9167H8.71875V10.5104H13.875V18.2812H15.2812V19.6875Z"
|
|
23
|
-
fill="#D5D5D5"
|
|
24
|
-
/>
|
|
25
|
-
</svg>
|
|
12
|
+
<icon :size="size" name="info" :color="iconColor" />
|
|
26
13
|
</icon-img>
|
|
27
14
|
<text-overlay
|
|
28
15
|
v-if="showInfo"
|
|
29
16
|
:borderColor="borderColor"
|
|
30
17
|
:alignText="alignText"
|
|
31
|
-
|
|
18
|
+
:width="width"
|
|
19
|
+
:halfComputedTextInfoWidth="halfComputedTextInfoWidth"
|
|
20
|
+
:alignArrow="alignArrow"
|
|
21
|
+
:iconSize="size"
|
|
22
|
+
><slot />
|
|
32
23
|
{{ text }}
|
|
33
24
|
</text-overlay>
|
|
34
25
|
</icon-wrapper>
|
|
@@ -44,22 +35,23 @@
|
|
|
44
35
|
// size="20"
|
|
45
36
|
// alignText="right" // default is left
|
|
46
37
|
// />
|
|
38
|
+
import theme from '../../assets/theme.js'
|
|
39
|
+
import styled from 'vue-styled-components'
|
|
40
|
+
import icon from '../icon'
|
|
47
41
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const IconWrapper = styled.div`
|
|
51
|
-
position: relative;
|
|
52
|
-
`
|
|
53
|
-
|
|
54
|
-
const textAttrs = { borderColor: String, alignText: String }
|
|
55
|
-
const TextOverlay = styled("div", textAttrs)`
|
|
42
|
+
const textAttrs = { iconSize:String, borderColor: String, alignArrow:String, alignText: String, width:String,halfComputedTextInfoWidth:Number }
|
|
43
|
+
const TextOverlay = styled('div', textAttrs)`
|
|
56
44
|
position: absolute;
|
|
57
|
-
top:
|
|
58
|
-
|
|
59
|
-
|
|
45
|
+
top: ${(props) => 'calc('+props.iconSize+' + 15px)'};
|
|
46
|
+
${(props) => (props.alignArrow === 'left'
|
|
47
|
+
? 'left: calc('+props.iconSize+' /2 - 18px)'
|
|
48
|
+
: props.alignArrow === 'center'
|
|
49
|
+
? 'left: calc((-'+props.width+' + '+props.iconSize+') /2 + 2px)'
|
|
50
|
+
: 'right: calc('+props.iconSize+' /2 - 17px)')};
|
|
51
|
+
text-align: ${(props) => props.alignText};
|
|
60
52
|
background: ${(props) => props.theme.colors.black};
|
|
61
53
|
padding: 10px;
|
|
62
|
-
width:
|
|
54
|
+
width: ${(props) => props.width };
|
|
63
55
|
max-width: 400px;
|
|
64
56
|
font-size: 13px;
|
|
65
57
|
font-weight: 400;
|
|
@@ -68,12 +60,13 @@ const TextOverlay = styled("div", textAttrs)`
|
|
|
68
60
|
color: ${(props) => props.theme.colors.white};
|
|
69
61
|
|
|
70
62
|
:before {
|
|
71
|
-
content:
|
|
63
|
+
content: '';
|
|
72
64
|
background-color: ${(props) => props.theme.colors.black};
|
|
73
65
|
position: absolute;
|
|
74
66
|
top: 2px;
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
${(props) => (props.alignArrow === 'left' ? 'left:40px;' :
|
|
68
|
+
props.alignArrow=='center' ? 'left: calc(50% + 19px);' :
|
|
69
|
+
'right:-13px;')};
|
|
77
70
|
height: 8px;
|
|
78
71
|
width: 8px;
|
|
79
72
|
transform-origin: center center;
|
|
@@ -82,18 +75,15 @@ const TextOverlay = styled("div", textAttrs)`
|
|
|
82
75
|
`
|
|
83
76
|
|
|
84
77
|
const iconAttrs = { isActive: Boolean, size: String, borderColor: String }
|
|
85
|
-
const IconImg = styled("div", iconAttrs)`
|
|
86
|
-
cursor: pointer;
|
|
87
|
-
height: ${(props) => props.size + "px"};
|
|
88
78
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
79
|
+
const IconWrapper = styled('div', iconAttrs)`
|
|
80
|
+
position: relative;
|
|
81
|
+
top: 1px;
|
|
82
|
+
height: ${(props) => props.size};
|
|
83
|
+
`
|
|
84
|
+
const IconImg = styled('div', iconAttrs)`
|
|
85
|
+
cursor: pointer;
|
|
86
|
+
height: ${(props) => props.size};
|
|
97
87
|
`
|
|
98
88
|
|
|
99
89
|
const ComponentWrapper = styled.div`
|
|
@@ -101,38 +91,51 @@ const ComponentWrapper = styled.div`
|
|
|
101
91
|
`
|
|
102
92
|
|
|
103
93
|
export default {
|
|
104
|
-
name:
|
|
94
|
+
name: 'info-text',
|
|
105
95
|
components: {
|
|
106
96
|
IconWrapper,
|
|
107
97
|
TextOverlay,
|
|
108
98
|
ComponentWrapper,
|
|
109
99
|
IconImg,
|
|
100
|
+
icon
|
|
110
101
|
},
|
|
111
102
|
props: {
|
|
112
103
|
text: {
|
|
113
|
-
required:
|
|
104
|
+
required: false,
|
|
114
105
|
},
|
|
115
106
|
borderColor: {
|
|
116
107
|
required: false,
|
|
117
|
-
default: null
|
|
108
|
+
default: null
|
|
118
109
|
},
|
|
119
110
|
size: {
|
|
120
111
|
required: false,
|
|
121
|
-
default:
|
|
112
|
+
default: '14px'
|
|
122
113
|
},
|
|
123
114
|
alignText: {
|
|
124
115
|
required: false,
|
|
125
|
-
default:
|
|
116
|
+
default: 'left' // "left" or "right"
|
|
117
|
+
},
|
|
118
|
+
alignArrow:{
|
|
119
|
+
required:false,
|
|
120
|
+
default:'center'
|
|
121
|
+
},
|
|
122
|
+
openTrigger:{
|
|
123
|
+
required:false,
|
|
124
|
+
default: 'onClick'
|
|
126
125
|
},
|
|
126
|
+
width:{
|
|
127
|
+
required:false,
|
|
128
|
+
default:'165px'
|
|
129
|
+
}
|
|
127
130
|
},
|
|
128
131
|
methods: {
|
|
129
132
|
toggleShowInfo() {
|
|
130
133
|
this.showInfo = !this.showInfo
|
|
131
134
|
|
|
132
135
|
if (this.showInfo) {
|
|
133
|
-
document.addEventListener(
|
|
136
|
+
document.addEventListener('click', this.clickOutside)
|
|
134
137
|
} else {
|
|
135
|
-
document.removeEventListener(
|
|
138
|
+
document.removeEventListener('click', this.clickOutside)
|
|
136
139
|
}
|
|
137
140
|
},
|
|
138
141
|
clickOutside(event) {
|
|
@@ -140,12 +143,24 @@ export default {
|
|
|
140
143
|
return
|
|
141
144
|
}
|
|
142
145
|
this.toggleShowInfo()
|
|
143
|
-
}
|
|
146
|
+
}
|
|
144
147
|
},
|
|
145
148
|
data() {
|
|
146
149
|
return {
|
|
147
150
|
showInfo: false,
|
|
148
151
|
}
|
|
149
152
|
},
|
|
153
|
+
computed: {
|
|
154
|
+
iconColor() {
|
|
155
|
+
return this.isActive
|
|
156
|
+
? this.borderColor
|
|
157
|
+
? this.borderColor
|
|
158
|
+
: theme.colors.secondary
|
|
159
|
+
: theme.colors.mediumGray
|
|
160
|
+
},
|
|
161
|
+
halfComputedTextInfoWidth() {
|
|
162
|
+
return parseInt(this.width)/2;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
150
165
|
}
|
|
151
|
-
</script>
|
|
166
|
+
</script>
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<container>
|
|
2
|
+
<container :inputWidth="inputWidth" :alignItems="alignItems">
|
|
3
|
+
<label-slot-wrapper v-if="hasLabelSlot" :isInteractive="isInteractive" @mousedown="initInteraction">
|
|
4
|
+
|
|
5
|
+
<slot name="label"></slot>
|
|
6
|
+
</label-slot-wrapper>
|
|
7
|
+
|
|
3
8
|
<label-wrapper v-if="labelText">
|
|
4
9
|
<label-text>
|
|
5
10
|
{{ labelText }}
|
|
@@ -8,35 +13,51 @@
|
|
|
8
13
|
v-if="labelInfoText"
|
|
9
14
|
:text="labelInfoText"
|
|
10
15
|
borderColor="#ccc"
|
|
11
|
-
size="
|
|
16
|
+
size="14px"
|
|
12
17
|
:alignText="labelInfoAlign"
|
|
13
18
|
/>
|
|
14
19
|
</label-wrapper>
|
|
15
20
|
<input-wrapper>
|
|
16
21
|
<input-container
|
|
22
|
+
v-bind="$attrs"
|
|
17
23
|
ref="inputField1"
|
|
18
24
|
:hasUnit="unitName && !!unitName.length"
|
|
19
|
-
:placeholder="
|
|
25
|
+
:placeholder="displayedPlaceholder"
|
|
20
26
|
:isError="isError"
|
|
21
27
|
:inputWidth="inputWidth"
|
|
28
|
+
:inputHeight="inputHeight"
|
|
22
29
|
:minWidth="minWidth"
|
|
23
30
|
:value="formatWithCurrency(value)"
|
|
24
31
|
@blur="onInputBlur($event)"
|
|
25
32
|
@focus="focusInput()"
|
|
26
33
|
@keyup.enter="$emit('on-enter-click')"
|
|
34
|
+
@input="onInput($event)"
|
|
27
35
|
:disabled="disabled"
|
|
28
36
|
:isDisabled="disabled"
|
|
29
37
|
:noBorder="noBorder"
|
|
30
38
|
:textAlign="textAlign"
|
|
31
39
|
:fontSize="fontSize"
|
|
32
40
|
:fontColor="fontColor"
|
|
41
|
+
:backgroundColor="backgroundColor"
|
|
42
|
+
v-on="$listeners"
|
|
43
|
+
:hasSlot="hasSlot"
|
|
44
|
+
:slotSize="slotSize"
|
|
33
45
|
/>
|
|
46
|
+
<slot-container v-if="hasSlot" :slotSize="slotSize" :isError="isError">
|
|
47
|
+
<slot></slot>
|
|
48
|
+
</slot-container>
|
|
49
|
+
|
|
34
50
|
<unit-container
|
|
35
|
-
v-if="unitName && showLinearUnitName"
|
|
51
|
+
v-if="unitName && showLinearUnitName && !hasSlot"
|
|
36
52
|
:hasLength="!!textInput.length"
|
|
37
53
|
:isError="isError"
|
|
38
54
|
>{{ unitName }}</unit-container
|
|
39
55
|
>
|
|
56
|
+
<icon
|
|
57
|
+
v-if="(isError || inputIcon) && !showLinearUnitName"
|
|
58
|
+
:class="inputIconImageClass"
|
|
59
|
+
:src="isError ? warningIcon : inputIconImage"
|
|
60
|
+
/>
|
|
40
61
|
</input-wrapper>
|
|
41
62
|
<error-message v-if="isError">{{ errorMessage }}</error-message>
|
|
42
63
|
</container>
|
|
@@ -74,11 +95,8 @@ import {
|
|
|
74
95
|
numberToString
|
|
75
96
|
} from '../../../helpers/numberConverter'
|
|
76
97
|
import InfoText from '../../infoText'
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
width: 100%;
|
|
80
|
-
position: relative;
|
|
81
|
-
`
|
|
98
|
+
import ErrorMessage from '../../errorMessage'
|
|
99
|
+
import warningIcon from '../../../assets/icons/error_icon.png'
|
|
82
100
|
|
|
83
101
|
const inputProps = {
|
|
84
102
|
isError: Boolean,
|
|
@@ -89,8 +107,23 @@ const inputProps = {
|
|
|
89
107
|
noBorder: Boolean,
|
|
90
108
|
textAlign: String,
|
|
91
109
|
fontSize: String,
|
|
92
|
-
fontColor: String
|
|
110
|
+
fontColor: String,
|
|
111
|
+
backgroundColor:String,
|
|
112
|
+
hasSlot: Boolean,
|
|
113
|
+
slotSize: String,
|
|
114
|
+
inputHeight:String,
|
|
115
|
+
isInteractive:Boolean,
|
|
116
|
+
alignItems:String
|
|
93
117
|
}
|
|
118
|
+
|
|
119
|
+
const Container = styled('div', inputProps)`
|
|
120
|
+
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
|
121
|
+
position: relative;
|
|
122
|
+
display:grid;
|
|
123
|
+
grid-template-columns: ${(props) =>
|
|
124
|
+
props.alignItems === "vertical" ? "1fr" : "auto 1fr"};
|
|
125
|
+
`
|
|
126
|
+
|
|
94
127
|
const InputContainer = styled('input', inputProps)`
|
|
95
128
|
border: ${(props) =>
|
|
96
129
|
props.isError
|
|
@@ -98,8 +131,13 @@ const InputContainer = styled('input', inputProps)`
|
|
|
98
131
|
: props.noBorder
|
|
99
132
|
? 'none'
|
|
100
133
|
: '1px solid ' + props.theme.colors.mediumGray};
|
|
101
|
-
padding:
|
|
102
|
-
|
|
134
|
+
padding-top: 11px;
|
|
135
|
+
padding-bottom: 11px;
|
|
136
|
+
padding-left: 10px;
|
|
137
|
+
padding-right: ${(props) =>
|
|
138
|
+
props.slotSize
|
|
139
|
+
? 'calc(' + props.slotSize + ' + 10px)'
|
|
140
|
+
: '5px'};
|
|
103
141
|
border-radius: 4px;
|
|
104
142
|
text-align: ${(props) => props.textAlign};
|
|
105
143
|
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
|
|
@@ -110,12 +148,15 @@ const InputContainer = styled('input', inputProps)`
|
|
|
110
148
|
: props.fontColor
|
|
111
149
|
? props.fontColor + ' !important'
|
|
112
150
|
: props.theme.colors.black};
|
|
151
|
+
background-color:${(props) => props.backgroundColor
|
|
152
|
+
? props.backgroundColor+' !important'
|
|
153
|
+
: props.theme.colors.white};
|
|
113
154
|
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
|
114
155
|
min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
|
|
115
156
|
background-color: ${(props) =>
|
|
116
157
|
props.isDisabled ? props.theme.colors.grey5 : '#fff'};
|
|
117
158
|
box-sizing: border-box;
|
|
118
|
-
|
|
159
|
+
max-height: ${(props) => (props.inputHeight)};
|
|
119
160
|
&::placeholder {
|
|
120
161
|
color: ${(props) =>
|
|
121
162
|
props.isError ? props.theme.colors.red : props.theme.colors.darkGray};
|
|
@@ -125,6 +166,15 @@ const InputContainer = styled('input', inputProps)`
|
|
|
125
166
|
outline: none;
|
|
126
167
|
}
|
|
127
168
|
`
|
|
169
|
+
const IconProps = {
|
|
170
|
+
inputIconHeight: String
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const Icon = styled('img', IconProps)`
|
|
174
|
+
position: absolute;
|
|
175
|
+
right: 10px;
|
|
176
|
+
top: 2px;
|
|
177
|
+
`
|
|
128
178
|
|
|
129
179
|
const InputWrapper = styled.span`
|
|
130
180
|
position: relative;
|
|
@@ -142,6 +192,7 @@ const UnitContainer = styled('span', inputProps)`
|
|
|
142
192
|
right: 10px;
|
|
143
193
|
top: 0;
|
|
144
194
|
padding-left: 10px;
|
|
195
|
+
text-align: right;
|
|
145
196
|
color: ${(props) =>
|
|
146
197
|
props.isError
|
|
147
198
|
? props.theme.colors.red
|
|
@@ -150,17 +201,40 @@ const UnitContainer = styled('span', inputProps)`
|
|
|
150
201
|
: props.theme.colors.mediumGray};
|
|
151
202
|
`
|
|
152
203
|
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
204
|
+
const SlotContainer = styled('span', inputProps)`
|
|
205
|
+
text-align: right;
|
|
206
|
+
border-left: 1px solid
|
|
207
|
+
${(props) =>
|
|
208
|
+
props.isError
|
|
209
|
+
? props.theme.colors.red
|
|
210
|
+
: props.hasLength
|
|
211
|
+
? props.theme.colors.black
|
|
212
|
+
: props.theme.colors.mediumGray};
|
|
156
213
|
position: absolute;
|
|
157
|
-
|
|
214
|
+
width: ${(props) =>
|
|
215
|
+
props.slotSize ? 'calc(' + props.slotSize + ' - 10px)' : 'fit-content'};
|
|
216
|
+
right: 10px;
|
|
217
|
+
top: 0;
|
|
218
|
+
padding-left: 10px;
|
|
219
|
+
color: ${(props) =>
|
|
220
|
+
props.isError
|
|
221
|
+
? props.theme.colors.red
|
|
222
|
+
: props.hasLength
|
|
223
|
+
? props.theme.colors.black
|
|
224
|
+
: props.theme.colors.mediumGray};
|
|
158
225
|
`
|
|
159
226
|
|
|
160
|
-
const LabelWrapper = styled
|
|
227
|
+
const LabelWrapper = styled('div',inputProps)`
|
|
161
228
|
display: flex;
|
|
162
229
|
gap: 10px;
|
|
163
230
|
margin-bottom: 8px;
|
|
231
|
+
cursor: ${(props) => (props.isInteractive?'ew-resize':'auto')};
|
|
232
|
+
`
|
|
233
|
+
const LabelSlotWrapper = styled('div',inputProps)`
|
|
234
|
+
display: flex;
|
|
235
|
+
gap: 10px;
|
|
236
|
+
align-items:center;
|
|
237
|
+
cursor: ${(props) => (props.isInteractive?'ew-resize':'auto')};
|
|
164
238
|
`
|
|
165
239
|
|
|
166
240
|
const LabelText = styled.div`
|
|
@@ -177,13 +251,18 @@ export default {
|
|
|
177
251
|
UnitContainer,
|
|
178
252
|
ErrorMessage,
|
|
179
253
|
LabelWrapper,
|
|
254
|
+
LabelSlotWrapper,
|
|
180
255
|
LabelText,
|
|
181
|
-
InfoText
|
|
256
|
+
InfoText,
|
|
257
|
+
Icon,
|
|
258
|
+
SlotContainer,
|
|
182
259
|
},
|
|
260
|
+
inheritAttrs: false,
|
|
183
261
|
data() {
|
|
184
262
|
return {
|
|
185
263
|
textInput: '',
|
|
186
|
-
isFocused: false
|
|
264
|
+
isFocused: false,
|
|
265
|
+
warningIcon: warningIcon,
|
|
187
266
|
}
|
|
188
267
|
},
|
|
189
268
|
props: {
|
|
@@ -203,6 +282,10 @@ export default {
|
|
|
203
282
|
required: false,
|
|
204
283
|
default: null
|
|
205
284
|
},
|
|
285
|
+
inputHeight:{
|
|
286
|
+
required:false,
|
|
287
|
+
default:null
|
|
288
|
+
},
|
|
206
289
|
value: {
|
|
207
290
|
required: true,
|
|
208
291
|
default: null
|
|
@@ -211,6 +294,10 @@ export default {
|
|
|
211
294
|
required: false,
|
|
212
295
|
default: false
|
|
213
296
|
},
|
|
297
|
+
alignItems: {
|
|
298
|
+
required: false,
|
|
299
|
+
default: "vertical",
|
|
300
|
+
},
|
|
214
301
|
errorMessage: {
|
|
215
302
|
required: false,
|
|
216
303
|
default: 'Please insert a correct number'
|
|
@@ -243,6 +330,14 @@ export default {
|
|
|
243
330
|
required: false,
|
|
244
331
|
default: '13px'
|
|
245
332
|
},
|
|
333
|
+
isInteractive: {
|
|
334
|
+
required: false,
|
|
335
|
+
default: false
|
|
336
|
+
},
|
|
337
|
+
interactionStep:{
|
|
338
|
+
required:false,
|
|
339
|
+
default:1
|
|
340
|
+
},
|
|
246
341
|
labelText: {
|
|
247
342
|
required: false,
|
|
248
343
|
default: null
|
|
@@ -253,7 +348,7 @@ export default {
|
|
|
253
348
|
},
|
|
254
349
|
labelInfoAlign: {
|
|
255
350
|
required: false,
|
|
256
|
-
default: '
|
|
351
|
+
default: 'left'
|
|
257
352
|
},
|
|
258
353
|
minNumber: {
|
|
259
354
|
required: false,
|
|
@@ -263,14 +358,51 @@ export default {
|
|
|
263
358
|
required: false,
|
|
264
359
|
default: null
|
|
265
360
|
},
|
|
361
|
+
backgroundColor: {
|
|
362
|
+
required: false,
|
|
363
|
+
default: null
|
|
364
|
+
},
|
|
266
365
|
numberToStringEnabled: {
|
|
267
366
|
required: false,
|
|
268
367
|
default: true
|
|
368
|
+
},
|
|
369
|
+
inputIcon: {
|
|
370
|
+
require: false,
|
|
371
|
+
type: Boolean,
|
|
372
|
+
default: false
|
|
373
|
+
},
|
|
374
|
+
inputIconImage: {
|
|
375
|
+
require: false,
|
|
376
|
+
type: String,
|
|
377
|
+
default: ''
|
|
378
|
+
},
|
|
379
|
+
inputIconImageClass: {
|
|
380
|
+
require: false,
|
|
381
|
+
type: Array,
|
|
382
|
+
default: () => []
|
|
383
|
+
},
|
|
384
|
+
slotSize: {
|
|
385
|
+
required: false
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
computed: {
|
|
389
|
+
displayedPlaceholder() {
|
|
390
|
+
if (this.placeholder) return this.placeholder
|
|
391
|
+
return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
|
|
392
|
+
},
|
|
393
|
+
hasSlot() {
|
|
394
|
+
return !!this.$slots.default
|
|
395
|
+
},
|
|
396
|
+
hasLabelSlot(){
|
|
397
|
+
return !!this.$slots.label
|
|
398
|
+
},
|
|
399
|
+
computedSlotSize() {
|
|
400
|
+
return this.slotSize || this.$slots['default'][0].elm.clientWidth
|
|
269
401
|
}
|
|
270
402
|
},
|
|
271
403
|
methods: {
|
|
272
404
|
onChangeHandler(event) {
|
|
273
|
-
if (isNaN(event)) {
|
|
405
|
+
if (isNaN(event) || event=="") {
|
|
274
406
|
event = this.minNumber || this.minNumber === 0 ? this.minNumber : event
|
|
275
407
|
}
|
|
276
408
|
this.$emit('input-change', event)
|
|
@@ -305,9 +437,15 @@ export default {
|
|
|
305
437
|
value: evaluated,
|
|
306
438
|
numberPrecision: this.numberPrecision
|
|
307
439
|
})
|
|
440
|
+
}else if(typeof evaluated === 'number'){
|
|
441
|
+
evaluated=evaluated.toFixed(this.numberPrecision)
|
|
308
442
|
}
|
|
309
443
|
return evaluated
|
|
310
444
|
},
|
|
445
|
+
onInput(value){
|
|
446
|
+
let evaluatedInput = this.onEvaluateCode(value)
|
|
447
|
+
this.$emit('on-input',evaluatedInput)
|
|
448
|
+
},
|
|
311
449
|
onInputBlur(e) {
|
|
312
450
|
this.isFocused = false
|
|
313
451
|
let value = e.target.value
|
|
@@ -321,11 +459,11 @@ export default {
|
|
|
321
459
|
})
|
|
322
460
|
}
|
|
323
461
|
let adjustedMinValue =
|
|
324
|
-
|
|
325
|
-
?
|
|
462
|
+
evaluatedInput && evaluatedInput.length
|
|
463
|
+
? evaluatedInput
|
|
326
464
|
: this.minNumber || this.minNumber === 0
|
|
327
465
|
? this.minNumber
|
|
328
|
-
: ''
|
|
466
|
+
: ''
|
|
329
467
|
this.$emit('input-blur', adjustedMinValue)
|
|
330
468
|
},
|
|
331
469
|
focusInput() {
|
|
@@ -336,6 +474,7 @@ export default {
|
|
|
336
474
|
this.$nextTick(() => {
|
|
337
475
|
this.$refs.inputField1.$el.select()
|
|
338
476
|
})
|
|
477
|
+
this.$emit('input-focus')
|
|
339
478
|
},
|
|
340
479
|
formatWithCurrency(value) {
|
|
341
480
|
let adjustedMinValue =
|
|
@@ -352,6 +491,7 @@ export default {
|
|
|
352
491
|
})
|
|
353
492
|
: adjustedMinValue
|
|
354
493
|
let unit = this.showLinearUnitName ? '' : this.unitName
|
|
494
|
+
//return input + ' ' + unit
|
|
355
495
|
return input + ' ' + unit
|
|
356
496
|
} else if (!adjustedMinValue && adjustedMinValue !== 0) {
|
|
357
497
|
return ''
|
|
@@ -363,7 +503,34 @@ export default {
|
|
|
363
503
|
})
|
|
364
504
|
: adjustedMinValue
|
|
365
505
|
}
|
|
366
|
-
}
|
|
506
|
+
},
|
|
507
|
+
initInteraction(e) {
|
|
508
|
+
console.log('InitInteract')
|
|
509
|
+
window.addEventListener('mousemove', this.interact, false);
|
|
510
|
+
window.addEventListener('mouseup', this.stopInteract, false);
|
|
511
|
+
e.preventDefault()
|
|
512
|
+
},
|
|
513
|
+
interact(e) {
|
|
514
|
+
e.preventDefault()
|
|
515
|
+
|
|
516
|
+
let value=parseInt(this.value)
|
|
517
|
+
|
|
518
|
+
value+=this.interactionStep*e.movementX
|
|
519
|
+
this.$emit('on-input',value)
|
|
520
|
+
|
|
521
|
+
console.log('interact',this.value,value)
|
|
522
|
+
this.textInput=numberToString({
|
|
523
|
+
value:
|
|
524
|
+
value && value.length ? value : this.minNumber,
|
|
525
|
+
numberPrecision: this.numberPrecision
|
|
526
|
+
})
|
|
527
|
+
//this.value=value
|
|
528
|
+
},
|
|
529
|
+
stopInteract(e) {
|
|
530
|
+
e.preventDefault()
|
|
531
|
+
window.removeEventListener('mousemove', this.interact, false);
|
|
532
|
+
window.removeEventListener('mouseup', this.stopInteract, false);
|
|
533
|
+
},
|
|
367
534
|
},
|
|
368
535
|
created() {
|
|
369
536
|
if (this.value) {
|
|
@@ -387,4 +554,4 @@ export default {
|
|
|
387
554
|
}
|
|
388
555
|
}
|
|
389
556
|
}
|
|
390
|
-
</script>
|
|
557
|
+
</script>
|
|
@@ -10,10 +10,11 @@
|
|
|
10
10
|
v-if="infoTextMessage"
|
|
11
11
|
:text="infoTextMessage"
|
|
12
12
|
borderColor="#ccc"
|
|
13
|
-
:size="fontSize ? fontSize : '
|
|
13
|
+
:size="fontSize ? fontSize : '16px'"
|
|
14
14
|
:alignText="infoTextAlign"
|
|
15
15
|
/>
|
|
16
16
|
</label-wrapper>
|
|
17
|
+
<input-error-wrapper>
|
|
17
18
|
<input-container
|
|
18
19
|
:placeholder="placeholder"
|
|
19
20
|
:isError="isError"
|
|
@@ -26,20 +27,27 @@
|
|
|
26
27
|
:isDisabled="disabled"
|
|
27
28
|
:fontSize="fontSize"
|
|
28
29
|
/>
|
|
30
|
+
<error-message v-if="isError">{{ errorMessage }}</error-message>
|
|
31
|
+
</input-error-wrapper>
|
|
29
32
|
</input-wrapper>
|
|
30
|
-
<error-message v-if="isError">{{ errorMessage }}</error-message>
|
|
31
33
|
</container>
|
|
32
34
|
</template>
|
|
33
35
|
|
|
34
36
|
<script>
|
|
35
37
|
import styled from "vue-styled-components"
|
|
36
38
|
import InfoText from "../../infoText"
|
|
39
|
+
import ErrorMessage from '../../errorMessage'
|
|
37
40
|
|
|
38
41
|
const Container = styled.div`
|
|
39
42
|
width: 100%;
|
|
40
43
|
position: relative;
|
|
41
44
|
`
|
|
42
|
-
|
|
45
|
+
const InputErrorWrapper = styled.div`
|
|
46
|
+
display: inline-grid;
|
|
47
|
+
grid-template-row: auto auto;
|
|
48
|
+
grid-gap: 0px;
|
|
49
|
+
align-items: center;
|
|
50
|
+
`
|
|
43
51
|
const labelAttrs = { fontSize: String }
|
|
44
52
|
const InputLabel = styled("div", labelAttrs)`
|
|
45
53
|
font-weight: bold;
|
|
@@ -48,10 +56,9 @@ const InputLabel = styled("div", labelAttrs)`
|
|
|
48
56
|
|
|
49
57
|
const LabelWrapper = styled.div`
|
|
50
58
|
display: inline-grid;
|
|
51
|
-
grid-template-columns: auto
|
|
59
|
+
grid-template-columns: auto 1fr;
|
|
52
60
|
grid-gap: 12px;
|
|
53
61
|
align-items: center;
|
|
54
|
-
justify-content: start;
|
|
55
62
|
`
|
|
56
63
|
|
|
57
64
|
const inputProps = {
|
|
@@ -105,13 +112,6 @@ const InputWrapper = styled("div", inputAttrs)`
|
|
|
105
112
|
props.alignItems === "vertical" || !props.hasLabel ? "1fr" : "auto 1fr"};
|
|
106
113
|
`
|
|
107
114
|
|
|
108
|
-
const ErrorMessage = styled.div`
|
|
109
|
-
font-size: 14px;
|
|
110
|
-
color: ${(props) => props.theme.colors.red};
|
|
111
|
-
position: absolute;
|
|
112
|
-
top: calc(100% + 1px);
|
|
113
|
-
`
|
|
114
|
-
|
|
115
115
|
export default {
|
|
116
116
|
// import InputText from "@eturnity/eturnity_reusable_components/src/components/inputs/inputText"
|
|
117
117
|
// To use:
|
|
@@ -137,6 +137,7 @@ export default {
|
|
|
137
137
|
ErrorMessage,
|
|
138
138
|
InfoText,
|
|
139
139
|
InputLabel,
|
|
140
|
+
InputErrorWrapper,
|
|
140
141
|
LabelWrapper,
|
|
141
142
|
},
|
|
142
143
|
props: {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
/>
|
|
13
13
|
<span class="checkmark"></span>
|
|
14
14
|
<label-text :isDisabled="item.disabled">{{ item.label }}</label-text>
|
|
15
|
-
<info-text v-if="item.infoText" :text="item.infoText" size="
|
|
15
|
+
<info-text v-if="item.infoText" :text="item.infoText" size="16px" />
|
|
16
16
|
</label-container>
|
|
17
17
|
<image-container v-if="item.img">
|
|
18
18
|
<radio-image :src="item.img" />
|