@eturnity/eturnity_reusable_components 1.2.21 → 1.2.22-3d-master.5
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/map_icon.svg +1 -1
- package/src/assets/svgIcons/margin_tool.svg +6 -0
- package/src/assets/svgIcons/obstacle_tool.svg +7 -11
- package/src/assets/svgIcons/redo.svg +6 -0
- package/src/assets/svgIcons/roof_layer.svg +3 -0
- package/src/assets/svgIcons/undo.svg +6 -0
- package/src/assets/theme.js +2 -0
- package/src/components/errorMessage/index.vue +62 -0
- package/src/components/icon/index.vue +9 -7
- package/src/components/iconWrapper/index.vue +116 -0
- package/src/components/infoText/index.vue +68 -53
- package/src/components/inputs/inputNumber/index.vue +120 -25
- package/src/components/inputs/inputText/index.vue +12 -10
- 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
package/babel.config.js
CHANGED
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
<ThemeProvider :theme="getTheme()" :style="{ height: '100%' }">
|
|
3
3
|
<page-container>
|
|
4
4
|
<br />
|
|
5
|
+
|
|
6
|
+
<iconWrapper name="bell"/>
|
|
7
|
+
<modal backdrop="dark" :isLoading="false" :isOpen="true">
|
|
8
|
+
|
|
5
9
|
<modal backdrop="dark" :isLoading="false" :isOpen="false">
|
|
10
|
+
|
|
6
11
|
<main-table titleText="My Table">
|
|
7
12
|
<thead>
|
|
8
13
|
<tr>
|
|
@@ -59,42 +64,75 @@
|
|
|
59
64
|
:disabled="false"
|
|
60
65
|
/>
|
|
61
66
|
<br />
|
|
67
|
+
>>>>>>> EPDM-5448
|
|
62
68
|
<input-number
|
|
63
|
-
placeholder="Enter distance"
|
|
64
|
-
:numberPrecision="2"
|
|
65
69
|
:value="inputValue"
|
|
66
|
-
@input-change="
|
|
67
|
-
|
|
70
|
+
@input-change="inputValue = $event"
|
|
71
|
+
inputWidth="250px"
|
|
72
|
+
slotSize="50%"
|
|
73
|
+
><InputAnnexContainer>
|
|
74
|
+
<span>123m2</span>
|
|
75
|
+
<info-text size="10px" alignArrow="right" text="infoText ceci est le text"></info-text>
|
|
76
|
+
</InputAnnexContainer>
|
|
77
|
+
</input-number>
|
|
78
|
+
<input-number
|
|
79
|
+
:value="inputValue"
|
|
80
|
+
@input-change="inputValue = $event"
|
|
81
|
+
inputWidth="250px"
|
|
82
|
+
slotSize="50%"
|
|
83
|
+
:isError="true"
|
|
84
|
+
><InputAnnexContainer>
|
|
85
|
+
<span>123m2</span>
|
|
86
|
+
<info-text :style="{'justify-self': 'end'}" size="12px" alignArrow="center" text="infoText ceci est le text">This is the tooltip text</info-text>
|
|
87
|
+
</InputAnnexContainer>
|
|
88
|
+
</input-number>
|
|
68
89
|
<br />
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
90
|
+
|
|
91
|
+
<p>InputText</p>
|
|
92
|
+
<input-text
|
|
93
|
+
placeholder="Company name"
|
|
94
|
+
:value="inputValue"
|
|
95
|
+
:isError="true"
|
|
96
|
+
errorMessage="This is my error message"
|
|
97
|
+
infoTextAlign="right"
|
|
98
|
+
infoTextMessage="My info message"
|
|
99
|
+
label="Question 5"
|
|
100
|
+
alignItems="vertical"
|
|
101
|
+
inputWidth="250px"
|
|
102
|
+
minWidth="100px"
|
|
103
|
+
/>
|
|
104
|
+
<br/>
|
|
105
|
+
<input-number
|
|
106
|
+
:value="num"
|
|
107
|
+
@input-change="num = $event"
|
|
108
|
+
unitName="t"
|
|
109
|
+
id="biebie"
|
|
110
|
+
test="koko"
|
|
111
|
+
@keydown="keydownHandler"
|
|
76
112
|
/>
|
|
77
|
-
<external-button text="Click me!" minWidth="500px" />
|
|
78
113
|
</page-container>
|
|
79
114
|
</ThemeProvider>
|
|
80
115
|
</template>
|
|
81
116
|
|
|
82
117
|
<script>
|
|
83
|
-
import { ThemeProvider } from
|
|
84
|
-
import theme from
|
|
85
|
-
import styled from
|
|
86
|
-
import MainTable from
|
|
87
|
-
import ThreeDots from
|
|
88
|
-
import Toggle from
|
|
89
|
-
import InputNumber from
|
|
90
|
-
import Checkbox from
|
|
91
|
-
import PageSubtitle from
|
|
92
|
-
import Spinner from
|
|
93
|
-
import ExternalButton from
|
|
94
|
-
import
|
|
95
|
-
import iconCollection from '@/components/icon/iconCollection'
|
|
96
|
-
import Modal from '@/components/modals/modal'
|
|
118
|
+
import { ThemeProvider } from "vue-styled-components"
|
|
119
|
+
import theme from "./assets/theme"
|
|
120
|
+
import styled from "vue-styled-components"
|
|
121
|
+
import MainTable from "@/components/tables/mainTable"
|
|
122
|
+
import ThreeDots from "@/components/threeDots"
|
|
123
|
+
import Toggle from "@/components/inputs/toggle"
|
|
124
|
+
import InputNumber from "@/components/inputs/inputNumber"
|
|
125
|
+
import Checkbox from "@/components/inputs/checkbox"
|
|
126
|
+
import PageSubtitle from "@/components/pageSubtitle"
|
|
127
|
+
import Spinner from "@/components/spinner"
|
|
128
|
+
import ExternalButton from "@/components/buttons/externalButton"
|
|
129
|
+
import InputText from "@/components/inputs/inputText"
|
|
97
130
|
// import TableDropdown from "@/components/tableDropdown"
|
|
131
|
+
const InputAnnexContainer = styled.div`
|
|
132
|
+
display: grid;
|
|
133
|
+
grid-template-columns: auto auto;
|
|
134
|
+
grid-gap: 10px;
|
|
135
|
+
`
|
|
98
136
|
|
|
99
137
|
const PageContainer = styled.div`
|
|
100
138
|
padding: 40px;
|
|
@@ -111,14 +149,13 @@ export default {
|
|
|
111
149
|
components: {
|
|
112
150
|
ThemeProvider,
|
|
113
151
|
PageContainer,
|
|
114
|
-
MainTable,
|
|
115
|
-
ThreeDots,
|
|
116
|
-
Toggle,
|
|
117
152
|
InputNumber,
|
|
118
153
|
PageSubtitle,
|
|
119
154
|
Spinner,
|
|
120
155
|
Checkbox,
|
|
156
|
+
InputText,
|
|
121
157
|
ExternalButton,
|
|
158
|
+
iconWrapper,
|
|
122
159
|
Modal,
|
|
123
160
|
ProjectMarker,
|
|
124
161
|
iconCollection,
|
|
@@ -126,6 +163,7 @@ export default {
|
|
|
126
163
|
},
|
|
127
164
|
data() {
|
|
128
165
|
return {
|
|
166
|
+
num: 42,
|
|
129
167
|
inputValue: null,
|
|
130
168
|
checkedOption: 'button_1',
|
|
131
169
|
question: {
|
|
@@ -185,11 +223,8 @@ export default {
|
|
|
185
223
|
}
|
|
186
224
|
},
|
|
187
225
|
methods: {
|
|
188
|
-
|
|
189
|
-
console.log(
|
|
190
|
-
},
|
|
191
|
-
gettext(string) {
|
|
192
|
-
return string.toUpperCase()
|
|
226
|
+
keydownHandler(e) {
|
|
227
|
+
console.log('test', e)
|
|
193
228
|
},
|
|
194
229
|
getTheme() {
|
|
195
230
|
return theme
|
|
@@ -240,8 +275,8 @@ export default {
|
|
|
240
275
|
item = '-'
|
|
241
276
|
}
|
|
242
277
|
return item
|
|
243
|
-
}
|
|
244
|
-
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
245
280
|
}
|
|
246
281
|
</script>
|
|
247
282
|
|
|
Binary file
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
<svg fill="none" height="14" viewbox="13 13 14 14" width="14" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M21.3333 15V24H22.1281L21.9394 24.0809L17.6667 25.912L14 24.3406V14.5165L17.2727 15.9191L17.4614 16H16.6667V25H18.6667V16H17.8719L18.0606 15.9191L22.3333 14.088L26 15.6594V25.4835L22.7273 24.0809L22.5386 24H23.3333V15H21.3333Z" stroke="#B2B9C5" stroke-width="
|
|
2
|
+
<path d="M21.3333 15V24H22.1281L21.9394 24.0809L17.6667 25.912L14 24.3406V14.5165L17.2727 15.9191L17.4614 16H16.6667V25H18.6667V16H17.8719L18.0606 15.9191L22.3333 14.088L26 15.6594V25.4835L22.7273 24.0809L22.5386 24H23.3333V15H21.3333Z" stroke="#B2B9C5" stroke-width="1"></path>
|
|
3
3
|
</svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<!-- <rect x="0.75" y="0.75" width="12.5" height="12.5" stroke="white" stroke-width="1.5"/>
|
|
3
|
+
<rect x="4.5" y="4.5" width="5" height="5" stroke="white" stroke-width="1.5"/> -->
|
|
4
|
+
<path d="M0 0 h 14 v 14 h -14 v-12.5 h 1.5 v11 h11 v-11 h-12.5 Z" fill="red"></path>
|
|
5
|
+
<path d="M3 3 h 8 v 8 h -8 v-7.5 h1.5 v6 h5 v-5 h-6.5Z" fill="red"></path>
|
|
6
|
+
</svg>
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
<svg fill="none" height="
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<rect
|
|
8
|
-
<rect fill="#FF5656" height="1.55556" transform="rotate(-45 11.1777 26.0269)" width="21" x="11.1777" y="26.0269"></rect>
|
|
9
|
-
<rect fill="#FF5656" height="1.55556" transform="rotate(-45 13.3774 28.2266)" width="21" x="13.3774" y="28.2266"></rect>
|
|
10
|
-
<rect fill="#FF5656" height="1.55556" transform="rotate(-45 15.5771 30.4265)" width="21" x="15.5771" y="30.4265"></rect>
|
|
11
|
-
<rect fill="#FF5656" height="1.55556" transform="rotate(-45 17.7773 32.6262)" width="21" x="17.7773" y="32.6262"></rect>
|
|
1
|
+
<svg fill="none" height="16" viewbox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<defs>
|
|
3
|
+
<pattern id="pattern_Z6wSY" patternUnits="userSpaceOnUse" width="4" height="4" patternTransform="rotate(-45)">
|
|
4
|
+
<path d="M0 0 L 16 0 L 16 2 L 0 2 Z" fill="red" stroke-width="0"></path>
|
|
5
|
+
</pattern>
|
|
6
|
+
</defs>
|
|
7
|
+
<rect width="16" height="16" fill="url(#pattern_Z6wSY)" :opacity="1" />
|
|
12
8
|
</g>
|
|
13
9
|
</svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg width="14" height="10" viewBox="0 0 14 10" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M4.51904 2H10.519V4H4.51904V2Z" fill="#555D61"/>
|
|
3
|
+
<path d="M4.51904 8H8.51904V10H4.51904V8Z" fill="#555D61"/>
|
|
4
|
+
<path d="M10.519 5.92321L13.4807 2.96161L10.519 0L10.519 5.92321Z" fill="#555D61"/>
|
|
5
|
+
<path d="M7.98391 8C7.29229 9.1956 5.99961 10 4.51904 10C2.3099 10 0.519043 8.20914 0.519043 6C0.519043 3.79086 2.3099 2 4.51904 2C5.99961 2 7.2923 2.8044 7.98391 4H4.51904C3.41447 4 2.51904 4.89543 2.51904 6C2.51904 7.10457 3.41447 8 4.51904 8H7.98391Z" fill="#555D61"/>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg width="14" height="10" viewBox="0 0 14 10" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M9.48096 2H3.48096V4H9.48096V2Z" fill="white"/>
|
|
3
|
+
<path d="M9.48096 8H5.48096V10H9.48096V8Z" fill="white"/>
|
|
4
|
+
<path d="M3.48096 5.92321L0.519349 2.96161L3.48096 0L3.48096 5.92321Z" fill="white"/>
|
|
5
|
+
<path d="M6.01609 8C6.70771 9.1956 8.00039 10 9.48096 10C11.6901 10 13.481 8.20914 13.481 6C13.481 3.79086 11.6901 2 9.48096 2C8.00039 2 6.7077 2.8044 6.01609 4H9.48096C10.5855 4 11.481 4.89543 11.481 6C11.481 7.10457 10.5855 8 9.48096 8H6.01609Z" fill="white"/>
|
|
6
|
+
</svg>
|
package/src/assets/theme.js
CHANGED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component-wrapper>
|
|
3
|
+
<text-overlay>
|
|
4
|
+
<slot></slot>
|
|
5
|
+
</text-overlay>
|
|
6
|
+
</component-wrapper>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
// import InfoText from "@eturnity/eturnity_reusable_components/src/components/infoText"
|
|
11
|
+
//To use:
|
|
12
|
+
// <error-message
|
|
13
|
+
// alignText="right" // default is left
|
|
14
|
+
// />
|
|
15
|
+
|
|
16
|
+
import styled from 'vue-styled-components'
|
|
17
|
+
|
|
18
|
+
const TextOverlay = styled.div`
|
|
19
|
+
position: absolute;
|
|
20
|
+
top: calc(100% + 13px);
|
|
21
|
+
background: ${(props) => props.theme.colors.red};
|
|
22
|
+
padding: 10px;
|
|
23
|
+
width: max-content;
|
|
24
|
+
max-width: 100%;
|
|
25
|
+
min-width: 200px;
|
|
26
|
+
font-size: 11px;
|
|
27
|
+
font-weight: 400;
|
|
28
|
+
border-radius: 4px;
|
|
29
|
+
font-family: 'Lato-Bold', Arial;
|
|
30
|
+
z-index: 10;
|
|
31
|
+
color: ${(props) => props.theme.colors.white};
|
|
32
|
+
|
|
33
|
+
:before {
|
|
34
|
+
content: '';
|
|
35
|
+
background-color: ${(props) => props.theme.colors.red};
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: 2px;
|
|
38
|
+
left: 40px;
|
|
39
|
+
height: 11px;
|
|
40
|
+
width: 11px;
|
|
41
|
+
transform-origin: center center;
|
|
42
|
+
transform: translate(-2em, -0.5em) rotate(45deg);
|
|
43
|
+
}
|
|
44
|
+
`
|
|
45
|
+
|
|
46
|
+
const ComponentWrapper = styled.div`
|
|
47
|
+
display: block;
|
|
48
|
+
`
|
|
49
|
+
|
|
50
|
+
export default {
|
|
51
|
+
name: 'info-text',
|
|
52
|
+
components: {
|
|
53
|
+
TextOverlay,
|
|
54
|
+
ComponentWrapper
|
|
55
|
+
},
|
|
56
|
+
props: {},
|
|
57
|
+
methods: {},
|
|
58
|
+
data() {
|
|
59
|
+
return {}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
</script>
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
+
<<<<<<< HEAD
|
|
3
|
+
=======
|
|
2
4
|
<wrapper :isDisabled="isDisabled" :size="size" :cursor="cursor">
|
|
5
|
+
>>>>>>> master
|
|
3
6
|
<icon-image
|
|
7
|
+
:disabled="disabled"
|
|
4
8
|
:size="size"
|
|
5
9
|
:color="color"
|
|
6
10
|
:hoveredColor="hoveredColor"
|
|
@@ -8,7 +12,6 @@
|
|
|
8
12
|
require(`!html-loader!./../../assets/svgIcons/${name.toLowerCase()}.svg`)
|
|
9
13
|
"
|
|
10
14
|
></icon-image>
|
|
11
|
-
</wrapper>
|
|
12
15
|
</template>
|
|
13
16
|
|
|
14
17
|
<script>
|
|
@@ -34,14 +37,14 @@ const Wrapper = styled('div', wrapperAttrs)`
|
|
|
34
37
|
const IconImageProps = { color: String, hoveredColor: String, size: String }
|
|
35
38
|
const IconImage = styled('div', IconImageProps)`
|
|
36
39
|
svg {
|
|
37
|
-
width:
|
|
38
|
-
height:
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 100%;
|
|
39
42
|
}
|
|
40
|
-
svg
|
|
43
|
+
svg path {
|
|
41
44
|
${(props) =>
|
|
42
45
|
props.color && `fill: ${props.theme.colors[props.color] || props.color};`}
|
|
43
46
|
}
|
|
44
|
-
&:hover > svg
|
|
47
|
+
&:hover > svg path {
|
|
45
48
|
${(props) => props.hoveredColor && `fill: ${props.hoveredColor};`}
|
|
46
49
|
}
|
|
47
50
|
`
|
|
@@ -49,11 +52,10 @@ const IconImage = styled('div', IconImageProps)`
|
|
|
49
52
|
export default {
|
|
50
53
|
name: 'icon',
|
|
51
54
|
components: {
|
|
52
|
-
Wrapper,
|
|
53
55
|
IconImage
|
|
54
56
|
},
|
|
55
57
|
props: {
|
|
56
|
-
|
|
58
|
+
disabled: {
|
|
57
59
|
required: false,
|
|
58
60
|
default: false
|
|
59
61
|
},
|
|
@@ -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>
|
|
@@ -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,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<container>
|
|
2
|
+
<container :inputWidth="inputWidth">
|
|
3
3
|
<label-wrapper v-if="labelText">
|
|
4
4
|
<label-text>
|
|
5
5
|
{{ labelText }}
|
|
@@ -8,17 +8,19 @@
|
|
|
8
8
|
v-if="labelInfoText"
|
|
9
9
|
:text="labelInfoText"
|
|
10
10
|
borderColor="#ccc"
|
|
11
|
-
size="
|
|
11
|
+
size="14px"
|
|
12
12
|
:alignText="labelInfoAlign"
|
|
13
13
|
/>
|
|
14
14
|
</label-wrapper>
|
|
15
15
|
<input-wrapper>
|
|
16
16
|
<input-container
|
|
17
|
+
v-bind="$attrs"
|
|
17
18
|
ref="inputField1"
|
|
18
19
|
:hasUnit="unitName && !!unitName.length"
|
|
19
|
-
:placeholder="
|
|
20
|
+
:placeholder="displayedPlaceholder"
|
|
20
21
|
:isError="isError"
|
|
21
22
|
:inputWidth="inputWidth"
|
|
23
|
+
:inputHeight="inputHeight"
|
|
22
24
|
:minWidth="minWidth"
|
|
23
25
|
:value="formatWithCurrency(value)"
|
|
24
26
|
@blur="onInputBlur($event)"
|
|
@@ -30,13 +32,25 @@
|
|
|
30
32
|
:textAlign="textAlign"
|
|
31
33
|
:fontSize="fontSize"
|
|
32
34
|
:fontColor="fontColor"
|
|
35
|
+
v-on="$listeners"
|
|
36
|
+
:hasSlot="hasSlot"
|
|
37
|
+
:slotSize="slotSize"
|
|
33
38
|
/>
|
|
39
|
+
<slot-container v-if="hasSlot" :slotSize="slotSize" :isError="isError">
|
|
40
|
+
<slot></slot>
|
|
41
|
+
</slot-container>
|
|
42
|
+
|
|
34
43
|
<unit-container
|
|
35
|
-
v-if="unitName && showLinearUnitName"
|
|
44
|
+
v-if="unitName && showLinearUnitName && !hasSlot"
|
|
36
45
|
:hasLength="!!textInput.length"
|
|
37
46
|
:isError="isError"
|
|
38
47
|
>{{ unitName }}</unit-container
|
|
39
48
|
>
|
|
49
|
+
<icon
|
|
50
|
+
v-if="(isError || inputIcon) && !showLinearUnitName"
|
|
51
|
+
:class="inputIconImageClass"
|
|
52
|
+
:src="isError ? warningIcon : inputIconImage"
|
|
53
|
+
/>
|
|
40
54
|
</input-wrapper>
|
|
41
55
|
<error-message v-if="isError">{{ errorMessage }}</error-message>
|
|
42
56
|
</container>
|
|
@@ -74,11 +88,8 @@ import {
|
|
|
74
88
|
numberToString
|
|
75
89
|
} from '../../../helpers/numberConverter'
|
|
76
90
|
import InfoText from '../../infoText'
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
width: 100%;
|
|
80
|
-
position: relative;
|
|
81
|
-
`
|
|
91
|
+
import ErrorMessage from '../../errorMessage'
|
|
92
|
+
import warningIcon from '../../../assets/icons/error_icon.png'
|
|
82
93
|
|
|
83
94
|
const inputProps = {
|
|
84
95
|
isError: Boolean,
|
|
@@ -89,8 +100,17 @@ const inputProps = {
|
|
|
89
100
|
noBorder: Boolean,
|
|
90
101
|
textAlign: String,
|
|
91
102
|
fontSize: String,
|
|
92
|
-
fontColor: String
|
|
103
|
+
fontColor: String,
|
|
104
|
+
hasSlot: Boolean,
|
|
105
|
+
slotSize: String,
|
|
106
|
+
inputHeight:String
|
|
93
107
|
}
|
|
108
|
+
|
|
109
|
+
const Container = styled('div', inputProps)`
|
|
110
|
+
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
|
111
|
+
position: relative;
|
|
112
|
+
`
|
|
113
|
+
|
|
94
114
|
const InputContainer = styled('input', inputProps)`
|
|
95
115
|
border: ${(props) =>
|
|
96
116
|
props.isError
|
|
@@ -98,8 +118,15 @@ const InputContainer = styled('input', inputProps)`
|
|
|
98
118
|
: props.noBorder
|
|
99
119
|
? 'none'
|
|
100
120
|
: '1px solid ' + props.theme.colors.mediumGray};
|
|
101
|
-
padding:
|
|
102
|
-
|
|
121
|
+
padding-top: 11px;
|
|
122
|
+
padding-bottom: 11px;
|
|
123
|
+
padding-left: 10px;
|
|
124
|
+
padding-right: ${(props) =>
|
|
125
|
+
props.slotSize
|
|
126
|
+
? 'calc(' + props.slotSize + ' + 10px)'
|
|
127
|
+
: props.hasUnit
|
|
128
|
+
? '40px'
|
|
129
|
+
: '5px'};
|
|
103
130
|
border-radius: 4px;
|
|
104
131
|
text-align: ${(props) => props.textAlign};
|
|
105
132
|
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
|
|
@@ -115,7 +142,7 @@ const InputContainer = styled('input', inputProps)`
|
|
|
115
142
|
background-color: ${(props) =>
|
|
116
143
|
props.isDisabled ? props.theme.colors.grey5 : '#fff'};
|
|
117
144
|
box-sizing: border-box;
|
|
118
|
-
|
|
145
|
+
max-height: ${(props) => (props.inputHeight)};
|
|
119
146
|
&::placeholder {
|
|
120
147
|
color: ${(props) =>
|
|
121
148
|
props.isError ? props.theme.colors.red : props.theme.colors.darkGray};
|
|
@@ -125,6 +152,15 @@ const InputContainer = styled('input', inputProps)`
|
|
|
125
152
|
outline: none;
|
|
126
153
|
}
|
|
127
154
|
`
|
|
155
|
+
const IconProps = {
|
|
156
|
+
inputIconHeight: String
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const Icon = styled('img', IconProps)`
|
|
160
|
+
position: absolute;
|
|
161
|
+
right: 10px;
|
|
162
|
+
top: 2px;
|
|
163
|
+
`
|
|
128
164
|
|
|
129
165
|
const InputWrapper = styled.span`
|
|
130
166
|
position: relative;
|
|
@@ -142,6 +178,7 @@ const UnitContainer = styled('span', inputProps)`
|
|
|
142
178
|
right: 10px;
|
|
143
179
|
top: 0;
|
|
144
180
|
padding-left: 10px;
|
|
181
|
+
text-align: right;
|
|
145
182
|
color: ${(props) =>
|
|
146
183
|
props.isError
|
|
147
184
|
? props.theme.colors.red
|
|
@@ -150,11 +187,27 @@ const UnitContainer = styled('span', inputProps)`
|
|
|
150
187
|
: props.theme.colors.mediumGray};
|
|
151
188
|
`
|
|
152
189
|
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
190
|
+
const SlotContainer = styled('span', inputProps)`
|
|
191
|
+
text-align: right;
|
|
192
|
+
border-left: 1px solid
|
|
193
|
+
${(props) =>
|
|
194
|
+
props.isError
|
|
195
|
+
? props.theme.colors.red
|
|
196
|
+
: props.hasLength
|
|
197
|
+
? props.theme.colors.black
|
|
198
|
+
: props.theme.colors.mediumGray};
|
|
156
199
|
position: absolute;
|
|
157
|
-
|
|
200
|
+
width: ${(props) =>
|
|
201
|
+
props.slotSize ? 'calc(' + props.slotSize + ' - 10px)' : 'fit-content'};
|
|
202
|
+
right: 10px;
|
|
203
|
+
top: 0;
|
|
204
|
+
padding-left: 10px;
|
|
205
|
+
color: ${(props) =>
|
|
206
|
+
props.isError
|
|
207
|
+
? props.theme.colors.red
|
|
208
|
+
: props.hasLength
|
|
209
|
+
? props.theme.colors.black
|
|
210
|
+
: props.theme.colors.mediumGray};
|
|
158
211
|
`
|
|
159
212
|
|
|
160
213
|
const LabelWrapper = styled.div`
|
|
@@ -178,12 +231,16 @@ export default {
|
|
|
178
231
|
ErrorMessage,
|
|
179
232
|
LabelWrapper,
|
|
180
233
|
LabelText,
|
|
181
|
-
InfoText
|
|
234
|
+
InfoText,
|
|
235
|
+
Icon,
|
|
236
|
+
SlotContainer
|
|
182
237
|
},
|
|
238
|
+
inheritAttrs: false,
|
|
183
239
|
data() {
|
|
184
240
|
return {
|
|
185
241
|
textInput: '',
|
|
186
|
-
isFocused: false
|
|
242
|
+
isFocused: false,
|
|
243
|
+
warningIcon: warningIcon,
|
|
187
244
|
}
|
|
188
245
|
},
|
|
189
246
|
props: {
|
|
@@ -203,6 +260,10 @@ export default {
|
|
|
203
260
|
required: false,
|
|
204
261
|
default: null
|
|
205
262
|
},
|
|
263
|
+
inputHeight:{
|
|
264
|
+
required:false,
|
|
265
|
+
default:null
|
|
266
|
+
},
|
|
206
267
|
value: {
|
|
207
268
|
required: true,
|
|
208
269
|
default: null
|
|
@@ -253,7 +314,7 @@ export default {
|
|
|
253
314
|
},
|
|
254
315
|
labelInfoAlign: {
|
|
255
316
|
required: false,
|
|
256
|
-
default: '
|
|
317
|
+
default: 'left'
|
|
257
318
|
},
|
|
258
319
|
minNumber: {
|
|
259
320
|
required: false,
|
|
@@ -266,11 +327,41 @@ export default {
|
|
|
266
327
|
numberToStringEnabled: {
|
|
267
328
|
required: false,
|
|
268
329
|
default: true
|
|
330
|
+
},
|
|
331
|
+
inputIcon: {
|
|
332
|
+
require: false,
|
|
333
|
+
type: Boolean,
|
|
334
|
+
default: false
|
|
335
|
+
},
|
|
336
|
+
inputIconImage: {
|
|
337
|
+
require: false,
|
|
338
|
+
type: String,
|
|
339
|
+
default: ''
|
|
340
|
+
},
|
|
341
|
+
inputIconImageClass: {
|
|
342
|
+
require: false,
|
|
343
|
+
type: Array,
|
|
344
|
+
default: () => []
|
|
345
|
+
},
|
|
346
|
+
slotSize: {
|
|
347
|
+
required: false
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
computed: {
|
|
351
|
+
displayedPlaceholder() {
|
|
352
|
+
if (this.placeholder) return this.placeholder
|
|
353
|
+
return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
|
|
354
|
+
},
|
|
355
|
+
hasSlot() {
|
|
356
|
+
return !!this.$slots.default
|
|
357
|
+
},
|
|
358
|
+
computedSlotSize() {
|
|
359
|
+
return this.slotSize || this.$slots['default'][0].elm.clientWidth
|
|
269
360
|
}
|
|
270
361
|
},
|
|
271
362
|
methods: {
|
|
272
363
|
onChangeHandler(event) {
|
|
273
|
-
if (isNaN(event)) {
|
|
364
|
+
if (isNaN(event) || event=="") {
|
|
274
365
|
event = this.minNumber || this.minNumber === 0 ? this.minNumber : event
|
|
275
366
|
}
|
|
276
367
|
this.$emit('input-change', event)
|
|
@@ -305,6 +396,8 @@ export default {
|
|
|
305
396
|
value: evaluated,
|
|
306
397
|
numberPrecision: this.numberPrecision
|
|
307
398
|
})
|
|
399
|
+
}else if(typeof evaluated === 'number'){
|
|
400
|
+
evaluated=evaluated.toFixed(this.numberPrecision)
|
|
308
401
|
}
|
|
309
402
|
return evaluated
|
|
310
403
|
},
|
|
@@ -321,11 +414,11 @@ export default {
|
|
|
321
414
|
})
|
|
322
415
|
}
|
|
323
416
|
let adjustedMinValue =
|
|
324
|
-
|
|
325
|
-
?
|
|
417
|
+
evaluatedInput && evaluatedInput.length
|
|
418
|
+
? evaluatedInput
|
|
326
419
|
: this.minNumber || this.minNumber === 0
|
|
327
420
|
? this.minNumber
|
|
328
|
-
: ''
|
|
421
|
+
: ''
|
|
329
422
|
this.$emit('input-blur', adjustedMinValue)
|
|
330
423
|
},
|
|
331
424
|
focusInput() {
|
|
@@ -336,6 +429,7 @@ export default {
|
|
|
336
429
|
this.$nextTick(() => {
|
|
337
430
|
this.$refs.inputField1.$el.select()
|
|
338
431
|
})
|
|
432
|
+
this.$emit('input-focus')
|
|
339
433
|
},
|
|
340
434
|
formatWithCurrency(value) {
|
|
341
435
|
let adjustedMinValue =
|
|
@@ -352,6 +446,7 @@ export default {
|
|
|
352
446
|
})
|
|
353
447
|
: adjustedMinValue
|
|
354
448
|
let unit = this.showLinearUnitName ? '' : this.unitName
|
|
449
|
+
//return input + ' ' + unit
|
|
355
450
|
return input + ' ' + unit
|
|
356
451
|
} else if (!adjustedMinValue && adjustedMinValue !== 0) {
|
|
357
452
|
return ''
|
|
@@ -387,4 +482,4 @@ export default {
|
|
|
387
482
|
}
|
|
388
483
|
}
|
|
389
484
|
}
|
|
390
|
-
</script>
|
|
485
|
+
</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;
|
|
@@ -104,13 +112,6 @@ const InputWrapper = styled("div", inputAttrs)`
|
|
|
104
112
|
props.alignItems === "vertical" || !props.hasLabel ? "1fr" : "auto 1fr"};
|
|
105
113
|
`
|
|
106
114
|
|
|
107
|
-
const ErrorMessage = styled.div`
|
|
108
|
-
font-size: 14px;
|
|
109
|
-
color: ${(props) => props.theme.colors.red};
|
|
110
|
-
position: absolute;
|
|
111
|
-
top: calc(100% + 1px);
|
|
112
|
-
`
|
|
113
|
-
|
|
114
115
|
export default {
|
|
115
116
|
// import InputText from "@eturnity/eturnity_reusable_components/src/components/inputs/inputText"
|
|
116
117
|
// To use:
|
|
@@ -136,6 +137,7 @@ export default {
|
|
|
136
137
|
ErrorMessage,
|
|
137
138
|
InfoText,
|
|
138
139
|
InputLabel,
|
|
140
|
+
InputErrorWrapper,
|
|
139
141
|
LabelWrapper,
|
|
140
142
|
},
|
|
141
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" />
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
v-if="infoTextMessage"
|
|
11
11
|
:text="infoTextMessage"
|
|
12
12
|
borderColor="#ccc"
|
|
13
|
-
size="
|
|
13
|
+
size="16px"
|
|
14
14
|
:alignText="infoTextAlign"
|
|
15
15
|
/>
|
|
16
16
|
</label-wrapper>
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
:disabled="isDisabled"
|
|
24
24
|
:fontSize="fontSize"
|
|
25
25
|
@input="onChangeHandler"
|
|
26
|
+
:resize="resize"
|
|
26
27
|
/>
|
|
27
28
|
</input-wrapper>
|
|
28
29
|
<error-message v-if="isError && errorText">{{ errorText }}</error-message>
|
|
@@ -174,7 +175,11 @@ export default {
|
|
|
174
175
|
},
|
|
175
176
|
inputWidth: {
|
|
176
177
|
required: false,
|
|
177
|
-
default: null
|
|
178
|
+
default: null,
|
|
179
|
+
},
|
|
180
|
+
resize:{
|
|
181
|
+
required:false,
|
|
182
|
+
default: "none"
|
|
178
183
|
}
|
|
179
184
|
},
|
|
180
185
|
methods: {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
v-if="infoTextMessage"
|
|
11
11
|
:text="infoTextMessage"
|
|
12
12
|
borderColor="#ccc"
|
|
13
|
-
size="
|
|
13
|
+
size="14px"
|
|
14
14
|
:alignText="infoTextAlign"
|
|
15
15
|
/>
|
|
16
16
|
</label-container>
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
v-if="infoTextMessage"
|
|
47
47
|
:text="infoTextMessage"
|
|
48
48
|
borderColor="#ccc"
|
|
49
|
-
size="
|
|
49
|
+
size="14px"
|
|
50
50
|
:alignText="infoTextAlign"
|
|
51
51
|
/>
|
|
52
52
|
</label-container>
|
|
@@ -4,6 +4,9 @@ export const stringToNumber = ({
|
|
|
4
4
|
allowNegative
|
|
5
5
|
}) => {
|
|
6
6
|
// This is for saving. It converts our input string to a readable number
|
|
7
|
+
if (value === undefined) {
|
|
8
|
+
value = ''
|
|
9
|
+
}
|
|
7
10
|
let newVal = value.toString()
|
|
8
11
|
const selectedLang = localStorage.getItem('lang')
|
|
9
12
|
// The first replace will replace not allowed characters with a blank
|
|
@@ -91,6 +94,8 @@ export const numberToString = ({ value, numberPrecision }) => {
|
|
|
91
94
|
? 'fr-fr'
|
|
92
95
|
: localStorage.getItem('lang')
|
|
93
96
|
: 'en-US'
|
|
97
|
+
if(selectedLang=="null"){selectedLang='en-US'}
|
|
98
|
+
value=parseFloat(value)
|
|
94
99
|
return value.toLocaleString(selectedLang, {
|
|
95
100
|
minimumFractionDigits: numberPrecision,
|
|
96
101
|
maximumFractionDigits: numberPrecision
|