@eturnity/eturnity_reusable_components 1.2.30 → 1.2.31-3d-master.1
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 +128 -53
- 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/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 +3 -3
- package/src/components/errorMessage/index.vue +4 -4
- package/src/components/icon/index.vue +11 -10
- package/src/components/iconWrapper/index.vue +116 -0
- package/src/components/infoText/index.vue +25 -40
- package/src/components/inputs/inputNumber/index.vue +95 -36
- package/src/components/inputs/inputText/index.vue +49 -52
- package/src/components/inputs/searchInput/index.vue +15 -16
- package/src/components/inputs/textAreaInput/index.vue +14 -8
- package/src/components/modals/modal/index.vue +7 -2
- package/src/helpers/numberConverter.js +1 -0
|
@@ -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>
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
:halfComputedTextInfoWidth="halfComputedTextInfoWidth"
|
|
20
20
|
:alignArrow="alignArrow"
|
|
21
21
|
:iconSize="size"
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
><slot />
|
|
23
|
+
{{ text }}
|
|
24
24
|
</text-overlay>
|
|
25
25
|
</icon-wrapper>
|
|
26
26
|
</component-wrapper>
|
|
@@ -39,27 +39,19 @@ import theme from '../../assets/theme.js'
|
|
|
39
39
|
import styled from 'vue-styled-components'
|
|
40
40
|
import icon from '../icon'
|
|
41
41
|
|
|
42
|
-
const textAttrs = {
|
|
43
|
-
iconSize: String,
|
|
44
|
-
borderColor: String,
|
|
45
|
-
alignArrow: String,
|
|
46
|
-
alignText: String,
|
|
47
|
-
width: String,
|
|
48
|
-
halfComputedTextInfoWidth: Number
|
|
49
|
-
}
|
|
42
|
+
const textAttrs = { iconSize:String, borderColor: String, alignArrow:String, alignText: String, width:String,halfComputedTextInfoWidth:Number }
|
|
50
43
|
const TextOverlay = styled('div', textAttrs)`
|
|
51
44
|
position: absolute;
|
|
52
|
-
top: ${(props) => 'calc('
|
|
53
|
-
${(props) =>
|
|
54
|
-
props.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
: 'right: calc(' + props.iconSize + ' /2 - 17px)'};
|
|
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)')};
|
|
59
51
|
text-align: ${(props) => props.alignText};
|
|
60
52
|
background: ${(props) => props.theme.colors.black};
|
|
61
53
|
padding: 10px;
|
|
62
|
-
width: ${(props) => props.width};
|
|
54
|
+
width: ${(props) => props.width };
|
|
63
55
|
max-width: 400px;
|
|
64
56
|
font-size: 13px;
|
|
65
57
|
font-weight: 400;
|
|
@@ -72,21 +64,14 @@ const TextOverlay = styled('div', textAttrs)`
|
|
|
72
64
|
background-color: ${(props) => props.theme.colors.black};
|
|
73
65
|
position: absolute;
|
|
74
66
|
top: 2px;
|
|
75
|
-
${(props) =>
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
: props.alignArrow == 'center'
|
|
79
|
-
? 'left: calc(50% + 19px);'
|
|
80
|
-
: 'right:-13px;'};
|
|
67
|
+
${(props) => (props.alignArrow === 'left' ? 'left:40px;' :
|
|
68
|
+
props.alignArrow=='center' ? 'left: calc(50% + 19px);' :
|
|
69
|
+
'right:-13px;')};
|
|
81
70
|
height: 8px;
|
|
82
71
|
width: 8px;
|
|
83
72
|
transform-origin: center center;
|
|
84
73
|
transform: translate(-2em, -0.5em) rotate(45deg);
|
|
85
74
|
}
|
|
86
|
-
|
|
87
|
-
span a {
|
|
88
|
-
color: #2cc0eb;
|
|
89
|
-
}
|
|
90
75
|
`
|
|
91
76
|
|
|
92
77
|
const iconAttrs = { isActive: Boolean, size: String, borderColor: String }
|
|
@@ -116,7 +101,7 @@ export default {
|
|
|
116
101
|
},
|
|
117
102
|
props: {
|
|
118
103
|
text: {
|
|
119
|
-
required: false
|
|
104
|
+
required: false,
|
|
120
105
|
},
|
|
121
106
|
borderColor: {
|
|
122
107
|
required: false,
|
|
@@ -130,17 +115,17 @@ export default {
|
|
|
130
115
|
required: false,
|
|
131
116
|
default: 'left' // "left" or "right"
|
|
132
117
|
},
|
|
133
|
-
alignArrow:
|
|
134
|
-
required:
|
|
135
|
-
default:
|
|
118
|
+
alignArrow:{
|
|
119
|
+
required:false,
|
|
120
|
+
default:'center'
|
|
136
121
|
},
|
|
137
|
-
openTrigger:
|
|
138
|
-
required:
|
|
122
|
+
openTrigger:{
|
|
123
|
+
required:false,
|
|
139
124
|
default: 'onClick'
|
|
140
125
|
},
|
|
141
|
-
width:
|
|
142
|
-
required:
|
|
143
|
-
default:
|
|
126
|
+
width:{
|
|
127
|
+
required:false,
|
|
128
|
+
default:'165px'
|
|
144
129
|
}
|
|
145
130
|
},
|
|
146
131
|
methods: {
|
|
@@ -162,7 +147,7 @@ export default {
|
|
|
162
147
|
},
|
|
163
148
|
data() {
|
|
164
149
|
return {
|
|
165
|
-
showInfo: false
|
|
150
|
+
showInfo: false,
|
|
166
151
|
}
|
|
167
152
|
},
|
|
168
153
|
computed: {
|
|
@@ -174,8 +159,8 @@ export default {
|
|
|
174
159
|
: theme.colors.mediumGray
|
|
175
160
|
},
|
|
176
161
|
halfComputedTextInfoWidth() {
|
|
177
|
-
return parseInt(this.width)
|
|
162
|
+
return parseInt(this.width)/2;
|
|
178
163
|
}
|
|
179
164
|
}
|
|
180
165
|
}
|
|
181
|
-
</script>
|
|
166
|
+
</script>
|
|
@@ -1,5 +1,10 @@
|
|
|
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
|
+
|
|
5
|
+
<slot name="label"></slot>
|
|
6
|
+
</label-slot-wrapper>
|
|
7
|
+
|
|
3
8
|
<label-wrapper v-if="labelText">
|
|
4
9
|
<label-text>
|
|
5
10
|
{{ labelText }}
|
|
@@ -19,21 +24,23 @@
|
|
|
19
24
|
:hasUnit="unitName && !!unitName.length"
|
|
20
25
|
:placeholder="displayedPlaceholder"
|
|
21
26
|
:isError="isError"
|
|
22
|
-
:inputWidth="inputWidth"
|
|
23
27
|
:inputHeight="inputHeight"
|
|
24
28
|
:minWidth="minWidth"
|
|
25
29
|
:value="formatWithCurrency(value)"
|
|
26
30
|
@blur="onInputBlur($event)"
|
|
27
31
|
@focus="focusInput()"
|
|
28
32
|
@keyup.enter="$emit('on-enter-click')"
|
|
33
|
+
@input="onInput($event)"
|
|
29
34
|
:disabled="disabled"
|
|
30
35
|
:isDisabled="disabled"
|
|
31
36
|
:noBorder="noBorder"
|
|
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,21 @@ 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
|
|
107
118
|
}
|
|
108
119
|
|
|
109
120
|
const Container = styled('div', inputProps)`
|
|
110
121
|
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
|
111
122
|
position: relative;
|
|
123
|
+
display:grid;
|
|
124
|
+
grid-template-columns: ${(props) =>
|
|
125
|
+
props.alignItems === "vertical" ? "1fr" : "auto 1fr"};
|
|
112
126
|
`
|
|
113
127
|
|
|
114
128
|
const InputContainer = styled('input', inputProps)`
|
|
@@ -117,15 +131,13 @@ const InputContainer = styled('input', inputProps)`
|
|
|
117
131
|
? '1px solid ' + props.theme.colors.red
|
|
118
132
|
: props.noBorder
|
|
119
133
|
? 'none'
|
|
120
|
-
: '1px solid ' + props.theme.colors.
|
|
134
|
+
: '1px solid ' + props.theme.colors.mediumGray};
|
|
121
135
|
padding-top: 11px;
|
|
122
136
|
padding-bottom: 11px;
|
|
123
137
|
padding-left: 10px;
|
|
124
138
|
padding-right: ${(props) =>
|
|
125
139
|
props.slotSize
|
|
126
140
|
? 'calc(' + props.slotSize + ' + 10px)'
|
|
127
|
-
: props.hasUnit
|
|
128
|
-
? '40px'
|
|
129
141
|
: '5px'};
|
|
130
142
|
border-radius: 4px;
|
|
131
143
|
text-align: ${(props) => props.textAlign};
|
|
@@ -133,20 +145,22 @@ const InputContainer = styled('input', inputProps)`
|
|
|
133
145
|
font-size: ${(props) => (props.fontSize ? props.fontSize : '13px')};
|
|
134
146
|
color: ${(props) =>
|
|
135
147
|
props.isError
|
|
136
|
-
? props.theme.colors.
|
|
137
|
-
: props.isDisabled
|
|
138
|
-
? props.theme.colors.grey2
|
|
148
|
+
? props.theme.colors.red
|
|
139
149
|
: props.fontColor
|
|
140
150
|
? props.fontColor + ' !important'
|
|
141
151
|
: props.theme.colors.black};
|
|
142
|
-
|
|
152
|
+
background-color:${(props) => props.backgroundColor
|
|
153
|
+
? props.backgroundColor+' !important'
|
|
154
|
+
: props.theme.colors.white};
|
|
155
|
+
width: ${(props) => (props.inputWidth && !props.hasLabelSlot ? props.inputWidth : '100%')};
|
|
143
156
|
min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
|
|
144
157
|
background-color: ${(props) =>
|
|
145
158
|
props.isDisabled ? props.theme.colors.grey5 : '#fff'};
|
|
146
159
|
box-sizing: border-box;
|
|
147
|
-
max-height: ${(props) => props.inputHeight};
|
|
160
|
+
max-height: ${(props) => (props.inputHeight)};
|
|
148
161
|
&::placeholder {
|
|
149
|
-
color: ${(props) =>
|
|
162
|
+
color: ${(props) =>
|
|
163
|
+
props.isError ? props.theme.colors.red : props.theme.colors.darkGray};
|
|
150
164
|
}
|
|
151
165
|
|
|
152
166
|
&:focus {
|
|
@@ -211,16 +225,22 @@ const SlotContainer = styled('span', inputProps)`
|
|
|
211
225
|
: props.theme.colors.mediumGray};
|
|
212
226
|
`
|
|
213
227
|
|
|
214
|
-
const LabelWrapper = styled
|
|
228
|
+
const LabelWrapper = styled('div',inputProps)`
|
|
215
229
|
display: flex;
|
|
216
230
|
gap: 10px;
|
|
217
231
|
margin-bottom: 8px;
|
|
232
|
+
cursor: ${(props) => (props.isInteractive?'ew-resize':'auto')};
|
|
233
|
+
`
|
|
234
|
+
const LabelSlotWrapper = styled('div',inputProps)`
|
|
235
|
+
display: flex;
|
|
236
|
+
gap: 10px;
|
|
237
|
+
align-items:center;
|
|
238
|
+
cursor: ${(props) => (props.isInteractive?'ew-resize':'auto')};
|
|
218
239
|
`
|
|
219
240
|
|
|
220
241
|
const LabelText = styled.div`
|
|
242
|
+
font-weight: bold;
|
|
221
243
|
font-size: 13px;
|
|
222
|
-
color: ${(props) => props.theme.colors.eturnityGrey};
|
|
223
|
-
font-weight: 700;
|
|
224
244
|
`
|
|
225
245
|
|
|
226
246
|
export default {
|
|
@@ -232,17 +252,18 @@ export default {
|
|
|
232
252
|
UnitContainer,
|
|
233
253
|
ErrorMessage,
|
|
234
254
|
LabelWrapper,
|
|
255
|
+
LabelSlotWrapper,
|
|
235
256
|
LabelText,
|
|
236
257
|
InfoText,
|
|
237
258
|
Icon,
|
|
238
|
-
SlotContainer
|
|
259
|
+
SlotContainer,
|
|
239
260
|
},
|
|
240
261
|
inheritAttrs: false,
|
|
241
262
|
data() {
|
|
242
263
|
return {
|
|
243
264
|
textInput: '',
|
|
244
265
|
isFocused: false,
|
|
245
|
-
warningIcon: warningIcon
|
|
266
|
+
warningIcon: warningIcon,
|
|
246
267
|
}
|
|
247
268
|
},
|
|
248
269
|
props: {
|
|
@@ -262,9 +283,9 @@ export default {
|
|
|
262
283
|
required: false,
|
|
263
284
|
default: null
|
|
264
285
|
},
|
|
265
|
-
inputHeight:
|
|
266
|
-
required:
|
|
267
|
-
default:
|
|
286
|
+
inputHeight:{
|
|
287
|
+
required:false,
|
|
288
|
+
default:null
|
|
268
289
|
},
|
|
269
290
|
value: {
|
|
270
291
|
required: true,
|
|
@@ -274,6 +295,10 @@ export default {
|
|
|
274
295
|
required: false,
|
|
275
296
|
default: false
|
|
276
297
|
},
|
|
298
|
+
alignItems: {
|
|
299
|
+
required: false,
|
|
300
|
+
default: "vertical",
|
|
301
|
+
},
|
|
277
302
|
errorMessage: {
|
|
278
303
|
required: false,
|
|
279
304
|
default: 'Please insert a correct number'
|
|
@@ -306,6 +331,14 @@ export default {
|
|
|
306
331
|
required: false,
|
|
307
332
|
default: '13px'
|
|
308
333
|
},
|
|
334
|
+
isInteractive: {
|
|
335
|
+
required: false,
|
|
336
|
+
default: false
|
|
337
|
+
},
|
|
338
|
+
interactionStep:{
|
|
339
|
+
required:false,
|
|
340
|
+
default:1
|
|
341
|
+
},
|
|
309
342
|
labelText: {
|
|
310
343
|
required: false,
|
|
311
344
|
default: null
|
|
@@ -326,6 +359,10 @@ export default {
|
|
|
326
359
|
required: false,
|
|
327
360
|
default: null
|
|
328
361
|
},
|
|
362
|
+
backgroundColor: {
|
|
363
|
+
required: false,
|
|
364
|
+
default: null
|
|
365
|
+
},
|
|
329
366
|
numberToStringEnabled: {
|
|
330
367
|
required: false,
|
|
331
368
|
default: true
|
|
@@ -340,10 +377,6 @@ export default {
|
|
|
340
377
|
type: String,
|
|
341
378
|
default: ''
|
|
342
379
|
},
|
|
343
|
-
allowNegative: {
|
|
344
|
-
required: false,
|
|
345
|
-
default: true
|
|
346
|
-
},
|
|
347
380
|
inputIconImageClass: {
|
|
348
381
|
require: false,
|
|
349
382
|
type: Array,
|
|
@@ -361,20 +394,18 @@ export default {
|
|
|
361
394
|
hasSlot() {
|
|
362
395
|
return !!this.$slots.default
|
|
363
396
|
},
|
|
397
|
+
hasLabelSlot(){
|
|
398
|
+
return !!this.$slots.label
|
|
399
|
+
},
|
|
364
400
|
computedSlotSize() {
|
|
365
401
|
return this.slotSize || this.$slots['default'][0].elm.clientWidth
|
|
366
402
|
}
|
|
367
403
|
},
|
|
368
404
|
methods: {
|
|
369
405
|
onChangeHandler(event) {
|
|
370
|
-
if (isNaN(event) || event
|
|
406
|
+
if (isNaN(event) || event=="") {
|
|
371
407
|
event = this.minNumber || this.minNumber === 0 ? this.minNumber : event
|
|
372
408
|
}
|
|
373
|
-
if (!this.allowNegative) {
|
|
374
|
-
event = Math.abs(event)
|
|
375
|
-
}
|
|
376
|
-
event = parseFloat(event)
|
|
377
|
-
// Need to return an integer rather than a string
|
|
378
409
|
this.$emit('input-change', event)
|
|
379
410
|
},
|
|
380
411
|
onEvaluateCode(val) {
|
|
@@ -407,11 +438,15 @@ export default {
|
|
|
407
438
|
value: evaluated,
|
|
408
439
|
numberPrecision: this.numberPrecision
|
|
409
440
|
})
|
|
410
|
-
}
|
|
411
|
-
evaluated
|
|
441
|
+
}else if(typeof evaluated === 'number'){
|
|
442
|
+
evaluated=evaluated.toFixed(this.numberPrecision)
|
|
412
443
|
}
|
|
413
444
|
return evaluated
|
|
414
445
|
},
|
|
446
|
+
onInput(value){
|
|
447
|
+
let evaluatedInput = this.onEvaluateCode(value)
|
|
448
|
+
this.$emit('on-input',evaluatedInput)
|
|
449
|
+
},
|
|
415
450
|
onInputBlur(e) {
|
|
416
451
|
this.isFocused = false
|
|
417
452
|
let value = e.target.value
|
|
@@ -425,11 +460,11 @@ export default {
|
|
|
425
460
|
})
|
|
426
461
|
}
|
|
427
462
|
let adjustedMinValue =
|
|
428
|
-
|
|
463
|
+
evaluatedInput && evaluatedInput.length
|
|
429
464
|
? evaluatedInput
|
|
430
465
|
: this.minNumber || this.minNumber === 0
|
|
431
466
|
? this.minNumber
|
|
432
|
-
: ''
|
|
467
|
+
: ''
|
|
433
468
|
this.$emit('input-blur', adjustedMinValue)
|
|
434
469
|
},
|
|
435
470
|
focusInput() {
|
|
@@ -469,7 +504,31 @@ export default {
|
|
|
469
504
|
})
|
|
470
505
|
: adjustedMinValue
|
|
471
506
|
}
|
|
472
|
-
}
|
|
507
|
+
},
|
|
508
|
+
initInteraction(e) {
|
|
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
|
+
let value=parseInt(this.value || 0)
|
|
516
|
+
|
|
517
|
+
value+=parseFloat(this.interactionStep)*parseInt(e.movementX)
|
|
518
|
+
this.$emit('on-input',value)
|
|
519
|
+
|
|
520
|
+
this.textInput=numberToString({
|
|
521
|
+
value:
|
|
522
|
+
value && value.length ? value : this.minNumber,
|
|
523
|
+
numberPrecision: this.numberPrecision
|
|
524
|
+
})
|
|
525
|
+
//this.value=value
|
|
526
|
+
},
|
|
527
|
+
stopInteract(e) {
|
|
528
|
+
e.preventDefault()
|
|
529
|
+
window.removeEventListener('mousemove', this.interact, false);
|
|
530
|
+
window.removeEventListener('mouseup', this.stopInteract, false);
|
|
531
|
+
},
|
|
473
532
|
},
|
|
474
533
|
created() {
|
|
475
534
|
if (this.value) {
|
|
@@ -493,4 +552,4 @@ export default {
|
|
|
493
552
|
}
|
|
494
553
|
}
|
|
495
554
|
}
|
|
496
|
-
</script>
|
|
555
|
+
</script>
|