@eturnity/eturnity_reusable_components 1.2.19-EPDM-5448.0 → 1.2.19-dev03.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/package.json +1 -1
- package/src/App.vue +71 -17
- package/src/assets/icons/error_icon copy.png +0 -0
- package/src/components/errorMessage/index.vue +62 -0
- package/src/components/iconWrapper/index.vue +31 -4
- package/src/components/infoText/index.vue +67 -54
- package/src/components/inputs/inputNumber/index.vue +107 -21
- package/src/components/inputs/inputText/index.vue +11 -9
- package/src/components/inputs/textAreaInput/index.vue +6 -1
- package/src/helpers/numberConverter.js +3 -0
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
<ThemeProvider :theme="getTheme()" :style="{ height: '100%' }">
|
|
3
3
|
<page-container>
|
|
4
4
|
<br />
|
|
5
|
+
<<<<<<< HEAD
|
|
6
|
+
=======
|
|
5
7
|
<iconWrapper name="bell"/>
|
|
6
8
|
<modal backdrop="dark" :isLoading="false" :isOpen="true">
|
|
7
9
|
<main-table titleText="My Table">
|
|
@@ -43,27 +45,71 @@
|
|
|
43
45
|
:disabled="false"
|
|
44
46
|
/>
|
|
45
47
|
<br />
|
|
48
|
+
>>>>>>> EPDM-5448
|
|
46
49
|
<input-number
|
|
47
|
-
placeholder="Enter distance"
|
|
48
|
-
:numberPrecision="2"
|
|
49
50
|
:value="inputValue"
|
|
50
|
-
@input-change="
|
|
51
|
-
|
|
51
|
+
@input-change="inputValue = $event"
|
|
52
|
+
inputWidth="250px"
|
|
53
|
+
slotSize="50%"
|
|
54
|
+
><InputAnnexContainer>
|
|
55
|
+
<span>123m2</span>
|
|
56
|
+
<info-text size="10" alignArrow="right" text="infoText ceci est le text"></info-text>
|
|
57
|
+
</InputAnnexContainer>
|
|
58
|
+
</input-number>
|
|
59
|
+
<input-number
|
|
60
|
+
:value="inputValue"
|
|
61
|
+
@input-change="inputValue = $event"
|
|
62
|
+
inputWidth="250px"
|
|
63
|
+
slotSize="50%"
|
|
64
|
+
:isError="true"
|
|
65
|
+
><InputAnnexContainer>
|
|
66
|
+
<span>123m2</span>
|
|
67
|
+
<info-text :style="{'justify-self': 'end'}" size="12" alignArrow="center" text="infoText ceci est le text">This is the tooltip text</info-text>
|
|
68
|
+
</InputAnnexContainer>
|
|
69
|
+
</input-number>
|
|
52
70
|
<br />
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
71
|
+
|
|
72
|
+
<p>InputText</p>
|
|
73
|
+
<input-text
|
|
74
|
+
placeholder="Company name"
|
|
75
|
+
:value="inputValue"
|
|
76
|
+
:isError="true"
|
|
77
|
+
errorMessage="This is my error message"
|
|
78
|
+
infoTextAlign="right"
|
|
79
|
+
infoTextMessage="My info message"
|
|
80
|
+
label="Question 5"
|
|
81
|
+
alignItems="vertical"
|
|
82
|
+
inputWidth="250px"
|
|
83
|
+
minWidth="100px"
|
|
84
|
+
/>
|
|
85
|
+
<br/>
|
|
86
|
+
<input-number
|
|
87
|
+
:value="num"
|
|
88
|
+
@input-change="num = $event"
|
|
89
|
+
unitName="t"
|
|
90
|
+
id="biebie"
|
|
91
|
+
test="koko"
|
|
92
|
+
@keydown="keydownHandler"
|
|
60
93
|
/>
|
|
61
|
-
<external-button text="Click me!" minWidth="500px" />
|
|
62
94
|
</page-container>
|
|
63
95
|
</ThemeProvider>
|
|
64
96
|
</template>
|
|
65
97
|
|
|
66
98
|
<script>
|
|
99
|
+
<<<<<<< HEAD
|
|
100
|
+
import { ThemeProvider } from "vue-styled-components"
|
|
101
|
+
import theme from "./assets/theme"
|
|
102
|
+
import styled from "vue-styled-components"
|
|
103
|
+
import MainTable from "@/components/tables/mainTable"
|
|
104
|
+
import ThreeDots from "@/components/threeDots"
|
|
105
|
+
import Toggle from "@/components/inputs/toggle"
|
|
106
|
+
import InputNumber from "@/components/inputs/inputNumber"
|
|
107
|
+
import Checkbox from "@/components/inputs/checkbox"
|
|
108
|
+
import PageSubtitle from "@/components/pageSubtitle"
|
|
109
|
+
import Spinner from "@/components/spinner"
|
|
110
|
+
import ExternalButton from "@/components/buttons/externalButton"
|
|
111
|
+
import InputText from "@/components/inputs/inputText"
|
|
112
|
+
=======
|
|
67
113
|
import { ThemeProvider } from 'vue-styled-components'
|
|
68
114
|
import theme from './assets/theme'
|
|
69
115
|
import styled from 'vue-styled-components'
|
|
@@ -77,7 +123,13 @@ import PageSubtitle from '@/components/pageSubtitle'
|
|
|
77
123
|
import Spinner from '@/components/spinner'
|
|
78
124
|
import ExternalButton from '@/components/buttons/externalButton'
|
|
79
125
|
import Modal from '@/components/modals/modal'
|
|
126
|
+
>>>>>>> EPDM-5448
|
|
80
127
|
// import TableDropdown from "@/components/tableDropdown"
|
|
128
|
+
const InputAnnexContainer = styled.div`
|
|
129
|
+
display: grid;
|
|
130
|
+
grid-template-columns: auto auto;
|
|
131
|
+
grid-gap: 10px;
|
|
132
|
+
`
|
|
81
133
|
|
|
82
134
|
const PageContainer = styled.div`
|
|
83
135
|
padding: 40px;
|
|
@@ -88,19 +140,18 @@ export default {
|
|
|
88
140
|
components: {
|
|
89
141
|
ThemeProvider,
|
|
90
142
|
PageContainer,
|
|
91
|
-
MainTable,
|
|
92
|
-
ThreeDots,
|
|
93
|
-
Toggle,
|
|
94
143
|
InputNumber,
|
|
95
144
|
PageSubtitle,
|
|
96
145
|
Spinner,
|
|
97
146
|
Checkbox,
|
|
147
|
+
InputText,
|
|
98
148
|
ExternalButton,
|
|
99
149
|
iconWrapper,
|
|
100
150
|
Modal,
|
|
101
151
|
},
|
|
102
152
|
data() {
|
|
103
153
|
return {
|
|
154
|
+
num: 42,
|
|
104
155
|
inputValue: null,
|
|
105
156
|
checkedOption: 'button_1',
|
|
106
157
|
question: {
|
|
@@ -159,6 +210,9 @@ export default {
|
|
|
159
210
|
}
|
|
160
211
|
},
|
|
161
212
|
methods: {
|
|
213
|
+
keydownHandler(e) {
|
|
214
|
+
console.log('test', e)
|
|
215
|
+
},
|
|
162
216
|
getTheme() {
|
|
163
217
|
return theme
|
|
164
218
|
},
|
|
@@ -208,8 +262,8 @@ export default {
|
|
|
208
262
|
item = '-'
|
|
209
263
|
}
|
|
210
264
|
return item
|
|
211
|
-
}
|
|
212
|
-
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
213
267
|
}
|
|
214
268
|
</script>
|
|
215
269
|
|
|
Binary file
|
|
@@ -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: 99;
|
|
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>
|
|
@@ -3,12 +3,23 @@
|
|
|
3
3
|
:disabled="disabled"
|
|
4
4
|
:size="size"
|
|
5
5
|
:backgroundColor="backgroundColor"
|
|
6
|
+
:borderRadius="borderRadius"
|
|
6
7
|
:hoveredBackgroundColor="hoveredBackgroundColor">
|
|
7
8
|
<icon :disabled="disabled"
|
|
8
9
|
:size="iconSize"
|
|
9
10
|
:name="name"
|
|
10
11
|
:color="iconColor"
|
|
11
12
|
:hoveredColor="hoveredIconColor" />
|
|
13
|
+
<caret v-if="hasCaret">
|
|
14
|
+
<iconWrapper :disabled="disabled"
|
|
15
|
+
size="8px"
|
|
16
|
+
name="arrow_down"
|
|
17
|
+
:iconColor="iconColor"
|
|
18
|
+
:hoveredBackgroundColor="hoveredIconColor"
|
|
19
|
+
borderRadius="1px"
|
|
20
|
+
/>
|
|
21
|
+
|
|
22
|
+
</caret>
|
|
12
23
|
</Wrapper>
|
|
13
24
|
</template>
|
|
14
25
|
|
|
@@ -24,8 +35,9 @@
|
|
|
24
35
|
|
|
25
36
|
import styled from 'vue-styled-components'
|
|
26
37
|
import icon from '../icon'
|
|
27
|
-
const wrapperAttrs = { disabled: Boolean, size: String,backgroundColor:String,hoveredBackgroundColor:String }
|
|
38
|
+
const wrapperAttrs = { borderRadius:String,disabled: Boolean, size: String,backgroundColor:String,hoveredBackgroundColor:String }
|
|
28
39
|
const Wrapper = styled('div', wrapperAttrs)`
|
|
40
|
+
position:relative;
|
|
29
41
|
display: inline-flex;
|
|
30
42
|
width: ${(props) => props.size};
|
|
31
43
|
height: ${(props) => props.size};
|
|
@@ -33,18 +45,25 @@
|
|
|
33
45
|
align-items:center;
|
|
34
46
|
cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
|
|
35
47
|
background-color: ${(props)=>props.theme.colors[props.backgroundColor] || props.backgroundColor};
|
|
36
|
-
border-radius:
|
|
48
|
+
border-radius: ${(props) => props.borderRadius};
|
|
37
49
|
|
|
38
50
|
&:hover{
|
|
39
51
|
background-color:${(props)=>props.theme.colors[props.hoveredBackgroundColor] || props.hoveredBackgroundColor};
|
|
40
52
|
}
|
|
41
53
|
`
|
|
42
|
-
|
|
54
|
+
const caret=styled.div`
|
|
55
|
+
position:absolute;
|
|
56
|
+
bottom:3px;
|
|
57
|
+
right:2px;
|
|
58
|
+
height:10px;
|
|
59
|
+
`
|
|
60
|
+
|
|
43
61
|
export default {
|
|
44
62
|
name: 'iconWrapper',
|
|
45
63
|
components: {
|
|
46
64
|
Wrapper,
|
|
47
|
-
icon
|
|
65
|
+
icon,
|
|
66
|
+
caret
|
|
48
67
|
},
|
|
49
68
|
props: {
|
|
50
69
|
disabled: {
|
|
@@ -75,6 +94,14 @@
|
|
|
75
94
|
iconSize:{
|
|
76
95
|
required: false,
|
|
77
96
|
default:'18px'
|
|
97
|
+
},
|
|
98
|
+
hasCaret:{
|
|
99
|
+
required: false,
|
|
100
|
+
default: false
|
|
101
|
+
},
|
|
102
|
+
borderRadius:{
|
|
103
|
+
required:false,
|
|
104
|
+
default:'6px'
|
|
78
105
|
}
|
|
79
106
|
},
|
|
80
107
|
data() {
|
|
@@ -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 + 'px'" 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,21 @@
|
|
|
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:Number, 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) => (parseInt(props.iconSize) + 15)}px;
|
|
46
|
+
${(props) => (props.alignArrow === 'left' ? 'left: '+((props.iconSize/2)-18)+'px;' :
|
|
47
|
+
props.alignArrow === 'center' ? 'left: calc((-'+props.width+' + '+props.iconSize+'px)/2 - 7px);':
|
|
48
|
+
'right: '+((props.iconSize/2)-17)+'px;')};
|
|
49
|
+
text-align: ${(props) => props.alignText};
|
|
60
50
|
background: ${(props) => props.theme.colors.black};
|
|
61
51
|
padding: 10px;
|
|
62
|
-
width:
|
|
52
|
+
width: ${(props) => props.width };
|
|
63
53
|
max-width: 400px;
|
|
64
54
|
font-size: 13px;
|
|
65
55
|
font-weight: 400;
|
|
@@ -68,12 +58,13 @@ const TextOverlay = styled("div", textAttrs)`
|
|
|
68
58
|
color: ${(props) => props.theme.colors.white};
|
|
69
59
|
|
|
70
60
|
:before {
|
|
71
|
-
content:
|
|
61
|
+
content: '';
|
|
72
62
|
background-color: ${(props) => props.theme.colors.black};
|
|
73
63
|
position: absolute;
|
|
74
64
|
top: 2px;
|
|
75
|
-
|
|
76
|
-
|
|
65
|
+
${(props) => (props.alignArrow === 'left' ? 'left:40px;' :
|
|
66
|
+
props.alignArrow=='center' ? 'left: calc(50% + 19px);' :
|
|
67
|
+
'right:-13px;')};
|
|
77
68
|
height: 8px;
|
|
78
69
|
width: 8px;
|
|
79
70
|
transform-origin: center center;
|
|
@@ -81,19 +72,16 @@ const TextOverlay = styled("div", textAttrs)`
|
|
|
81
72
|
}
|
|
82
73
|
`
|
|
83
74
|
|
|
84
|
-
const iconAttrs = { isActive: Boolean, size:
|
|
85
|
-
const IconImg = styled("div", iconAttrs)`
|
|
86
|
-
cursor: pointer;
|
|
87
|
-
height: ${(props) => props.size + "px"};
|
|
75
|
+
const iconAttrs = { isActive: Boolean, size: Number, borderColor: String }
|
|
88
76
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
77
|
+
const IconWrapper = styled('div', iconAttrs)`
|
|
78
|
+
position: relative;
|
|
79
|
+
top: 1px;
|
|
80
|
+
height: ${(props) => props.size}px;
|
|
81
|
+
`
|
|
82
|
+
const IconImg = styled('div', iconAttrs)`
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
height: ${(props) => props.size}px;
|
|
97
85
|
`
|
|
98
86
|
|
|
99
87
|
const ComponentWrapper = styled.div`
|
|
@@ -101,38 +89,51 @@ const ComponentWrapper = styled.div`
|
|
|
101
89
|
`
|
|
102
90
|
|
|
103
91
|
export default {
|
|
104
|
-
name:
|
|
92
|
+
name: 'info-text',
|
|
105
93
|
components: {
|
|
106
94
|
IconWrapper,
|
|
107
95
|
TextOverlay,
|
|
108
96
|
ComponentWrapper,
|
|
109
97
|
IconImg,
|
|
98
|
+
icon
|
|
110
99
|
},
|
|
111
100
|
props: {
|
|
112
101
|
text: {
|
|
113
|
-
required:
|
|
102
|
+
required: false,
|
|
114
103
|
},
|
|
115
104
|
borderColor: {
|
|
116
105
|
required: false,
|
|
117
|
-
default: null
|
|
106
|
+
default: null
|
|
118
107
|
},
|
|
119
108
|
size: {
|
|
120
109
|
required: false,
|
|
121
|
-
default:
|
|
110
|
+
default: '14'
|
|
122
111
|
},
|
|
123
112
|
alignText: {
|
|
124
113
|
required: false,
|
|
125
|
-
default:
|
|
114
|
+
default: 'left' // "left" or "right"
|
|
115
|
+
},
|
|
116
|
+
alignArrow:{
|
|
117
|
+
required:false,
|
|
118
|
+
default:'center'
|
|
119
|
+
},
|
|
120
|
+
openTrigger:{
|
|
121
|
+
required:false,
|
|
122
|
+
default: 'onClick'
|
|
126
123
|
},
|
|
124
|
+
width:{
|
|
125
|
+
required:false,
|
|
126
|
+
default:'165px'
|
|
127
|
+
}
|
|
127
128
|
},
|
|
128
129
|
methods: {
|
|
129
130
|
toggleShowInfo() {
|
|
130
131
|
this.showInfo = !this.showInfo
|
|
131
132
|
|
|
132
133
|
if (this.showInfo) {
|
|
133
|
-
document.addEventListener(
|
|
134
|
+
document.addEventListener('click', this.clickOutside)
|
|
134
135
|
} else {
|
|
135
|
-
document.removeEventListener(
|
|
136
|
+
document.removeEventListener('click', this.clickOutside)
|
|
136
137
|
}
|
|
137
138
|
},
|
|
138
139
|
clickOutside(event) {
|
|
@@ -140,12 +141,24 @@ export default {
|
|
|
140
141
|
return
|
|
141
142
|
}
|
|
142
143
|
this.toggleShowInfo()
|
|
143
|
-
}
|
|
144
|
+
}
|
|
144
145
|
},
|
|
145
146
|
data() {
|
|
146
147
|
return {
|
|
147
148
|
showInfo: false,
|
|
148
149
|
}
|
|
149
150
|
},
|
|
151
|
+
computed: {
|
|
152
|
+
iconColor() {
|
|
153
|
+
return this.isActive
|
|
154
|
+
? this.borderColor
|
|
155
|
+
? this.borderColor
|
|
156
|
+
: theme.colors.secondary
|
|
157
|
+
: theme.colors.mediumGray
|
|
158
|
+
},
|
|
159
|
+
halfComputedTextInfoWidth() {
|
|
160
|
+
return parseInt(this.width)/2;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
150
163
|
}
|
|
151
|
-
</script>
|
|
164
|
+
</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,15 +8,16 @@
|
|
|
8
8
|
v-if="labelInfoText"
|
|
9
9
|
:text="labelInfoText"
|
|
10
10
|
borderColor="#ccc"
|
|
11
|
-
size="
|
|
11
|
+
:size="14"
|
|
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"
|
|
22
23
|
:minWidth="minWidth"
|
|
@@ -30,13 +31,25 @@
|
|
|
30
31
|
:textAlign="textAlign"
|
|
31
32
|
:fontSize="fontSize"
|
|
32
33
|
:fontColor="fontColor"
|
|
34
|
+
v-on="$listeners"
|
|
35
|
+
:hasSlot="hasSlot"
|
|
36
|
+
:slotSize="slotSize"
|
|
33
37
|
/>
|
|
38
|
+
<slot-container v-if="hasSlot" :slotSize="slotSize" :isError="isError">
|
|
39
|
+
<slot></slot>
|
|
40
|
+
</slot-container>
|
|
41
|
+
|
|
34
42
|
<unit-container
|
|
35
|
-
v-if="unitName && showLinearUnitName"
|
|
43
|
+
v-if="unitName && showLinearUnitName && !hasSlot"
|
|
36
44
|
:hasLength="!!textInput.length"
|
|
37
45
|
:isError="isError"
|
|
38
46
|
>{{ unitName }}</unit-container
|
|
39
47
|
>
|
|
48
|
+
<icon
|
|
49
|
+
v-if="(isError || inputIcon) && !showLinearUnitName"
|
|
50
|
+
:class="inputIconImageClass"
|
|
51
|
+
:src="isError ? warningIcon : inputIconImage"
|
|
52
|
+
/>
|
|
40
53
|
</input-wrapper>
|
|
41
54
|
<error-message v-if="isError">{{ errorMessage }}</error-message>
|
|
42
55
|
</container>
|
|
@@ -74,11 +87,8 @@ import {
|
|
|
74
87
|
numberToString
|
|
75
88
|
} from '../../../helpers/numberConverter'
|
|
76
89
|
import InfoText from '../../infoText'
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
width: 100%;
|
|
80
|
-
position: relative;
|
|
81
|
-
`
|
|
90
|
+
import ErrorMessage from '../../errorMessage'
|
|
91
|
+
import warningIcon from '../../../assets/icons/error_icon.png'
|
|
82
92
|
|
|
83
93
|
const inputProps = {
|
|
84
94
|
isError: Boolean,
|
|
@@ -89,8 +99,16 @@ const inputProps = {
|
|
|
89
99
|
noBorder: Boolean,
|
|
90
100
|
textAlign: String,
|
|
91
101
|
fontSize: String,
|
|
92
|
-
fontColor: String
|
|
102
|
+
fontColor: String,
|
|
103
|
+
hasSlot: Boolean,
|
|
104
|
+
slotSize: String
|
|
93
105
|
}
|
|
106
|
+
|
|
107
|
+
const Container = styled('div', inputProps)`
|
|
108
|
+
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
|
109
|
+
position: relative;
|
|
110
|
+
`
|
|
111
|
+
|
|
94
112
|
const InputContainer = styled('input', inputProps)`
|
|
95
113
|
border: ${(props) =>
|
|
96
114
|
props.isError
|
|
@@ -98,8 +116,15 @@ const InputContainer = styled('input', inputProps)`
|
|
|
98
116
|
: props.noBorder
|
|
99
117
|
? 'none'
|
|
100
118
|
: '1px solid ' + props.theme.colors.mediumGray};
|
|
101
|
-
padding:
|
|
102
|
-
|
|
119
|
+
padding-top: 11px;
|
|
120
|
+
padding-bottom: 11px;
|
|
121
|
+
padding-left: 10px;
|
|
122
|
+
padding-right: ${(props) =>
|
|
123
|
+
props.slotSize
|
|
124
|
+
? 'calc(' + props.slotSize + ' + 10px)'
|
|
125
|
+
: props.hasUnit
|
|
126
|
+
? '40px'
|
|
127
|
+
: '5px'};
|
|
103
128
|
border-radius: 4px;
|
|
104
129
|
text-align: ${(props) => props.textAlign};
|
|
105
130
|
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
|
|
@@ -125,6 +150,15 @@ const InputContainer = styled('input', inputProps)`
|
|
|
125
150
|
outline: none;
|
|
126
151
|
}
|
|
127
152
|
`
|
|
153
|
+
const IconProps = {
|
|
154
|
+
inputIconHeight: String
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const Icon = styled('img', IconProps)`
|
|
158
|
+
position: absolute;
|
|
159
|
+
right: 10px;
|
|
160
|
+
top: 2px;
|
|
161
|
+
`
|
|
128
162
|
|
|
129
163
|
const InputWrapper = styled.span`
|
|
130
164
|
position: relative;
|
|
@@ -142,6 +176,7 @@ const UnitContainer = styled('span', inputProps)`
|
|
|
142
176
|
right: 10px;
|
|
143
177
|
top: 0;
|
|
144
178
|
padding-left: 10px;
|
|
179
|
+
text-align: right;
|
|
145
180
|
color: ${(props) =>
|
|
146
181
|
props.isError
|
|
147
182
|
? props.theme.colors.red
|
|
@@ -150,11 +185,27 @@ const UnitContainer = styled('span', inputProps)`
|
|
|
150
185
|
: props.theme.colors.mediumGray};
|
|
151
186
|
`
|
|
152
187
|
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
188
|
+
const SlotContainer = styled('span', inputProps)`
|
|
189
|
+
text-align: right;
|
|
190
|
+
border-left: 1px solid
|
|
191
|
+
${(props) =>
|
|
192
|
+
props.isError
|
|
193
|
+
? props.theme.colors.red
|
|
194
|
+
: props.hasLength
|
|
195
|
+
? props.theme.colors.black
|
|
196
|
+
: props.theme.colors.mediumGray};
|
|
156
197
|
position: absolute;
|
|
157
|
-
|
|
198
|
+
width: ${(props) =>
|
|
199
|
+
props.slotSize ? 'calc(' + props.slotSize + ' - 10px)' : 'fit-content'};
|
|
200
|
+
right: 10px;
|
|
201
|
+
top: 0;
|
|
202
|
+
padding-left: 10px;
|
|
203
|
+
color: ${(props) =>
|
|
204
|
+
props.isError
|
|
205
|
+
? props.theme.colors.red
|
|
206
|
+
: props.hasLength
|
|
207
|
+
? props.theme.colors.black
|
|
208
|
+
: props.theme.colors.mediumGray};
|
|
158
209
|
`
|
|
159
210
|
|
|
160
211
|
const LabelWrapper = styled.div`
|
|
@@ -178,12 +229,16 @@ export default {
|
|
|
178
229
|
ErrorMessage,
|
|
179
230
|
LabelWrapper,
|
|
180
231
|
LabelText,
|
|
181
|
-
InfoText
|
|
232
|
+
InfoText,
|
|
233
|
+
Icon,
|
|
234
|
+
SlotContainer
|
|
182
235
|
},
|
|
236
|
+
inheritAttrs: false,
|
|
183
237
|
data() {
|
|
184
238
|
return {
|
|
185
239
|
textInput: '',
|
|
186
|
-
isFocused: false
|
|
240
|
+
isFocused: false,
|
|
241
|
+
warningIcon: warningIcon,
|
|
187
242
|
}
|
|
188
243
|
},
|
|
189
244
|
props: {
|
|
@@ -253,7 +308,7 @@ export default {
|
|
|
253
308
|
},
|
|
254
309
|
labelInfoAlign: {
|
|
255
310
|
required: false,
|
|
256
|
-
default: '
|
|
311
|
+
default: 'left'
|
|
257
312
|
},
|
|
258
313
|
minNumber: {
|
|
259
314
|
required: false,
|
|
@@ -266,11 +321,41 @@ export default {
|
|
|
266
321
|
numberToStringEnabled: {
|
|
267
322
|
required: false,
|
|
268
323
|
default: true
|
|
324
|
+
},
|
|
325
|
+
inputIcon: {
|
|
326
|
+
require: false,
|
|
327
|
+
type: Boolean,
|
|
328
|
+
default: false
|
|
329
|
+
},
|
|
330
|
+
inputIconImage: {
|
|
331
|
+
require: false,
|
|
332
|
+
type: String,
|
|
333
|
+
default: ''
|
|
334
|
+
},
|
|
335
|
+
inputIconImageClass: {
|
|
336
|
+
require: false,
|
|
337
|
+
type: Array,
|
|
338
|
+
default: () => []
|
|
339
|
+
},
|
|
340
|
+
slotSize: {
|
|
341
|
+
required: false
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
computed: {
|
|
345
|
+
displayedPlaceholder() {
|
|
346
|
+
if (this.placeholder) return this.placeholder
|
|
347
|
+
return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
|
|
348
|
+
},
|
|
349
|
+
hasSlot() {
|
|
350
|
+
return !!this.$slots.default
|
|
351
|
+
},
|
|
352
|
+
computedSlotSize() {
|
|
353
|
+
return this.slotSize || this.$slots['default'][0].elm.clientWidth
|
|
269
354
|
}
|
|
270
355
|
},
|
|
271
356
|
methods: {
|
|
272
357
|
onChangeHandler(event) {
|
|
273
|
-
if (isNaN(event)) {
|
|
358
|
+
if (isNaN(event) || event=="") {
|
|
274
359
|
event = this.minNumber || this.minNumber === 0 ? this.minNumber : event
|
|
275
360
|
}
|
|
276
361
|
this.$emit('input-change', event)
|
|
@@ -336,6 +421,7 @@ export default {
|
|
|
336
421
|
this.$nextTick(() => {
|
|
337
422
|
this.$refs.inputField1.$el.select()
|
|
338
423
|
})
|
|
424
|
+
this.$emit('input-focus')
|
|
339
425
|
},
|
|
340
426
|
formatWithCurrency(value) {
|
|
341
427
|
let adjustedMinValue =
|
|
@@ -387,4 +473,4 @@ export default {
|
|
|
387
473
|
}
|
|
388
474
|
}
|
|
389
475
|
}
|
|
390
|
-
</script>
|
|
476
|
+
</script>
|
|
@@ -14,6 +14,7 @@
|
|
|
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: {
|
|
@@ -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: {
|
|
@@ -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
|