@eturnity/eturnity_reusable_components 1.2.19-EPDM-5262.4 → 1.2.19-EPDM-3412.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 +104 -61
- package/src/assets/icons/error_icon copy.png +0 -0
- package/src/assets/theme.js +26 -26
- package/src/components/errorMessage/index.vue +62 -0
- package/src/components/icon/index.vue +2 -1
- package/src/components/infoText/index.vue +52 -50
- package/src/components/inputs/checkbox/index.vue +44 -45
- package/src/components/inputs/inputNumber/index.vue +69 -75
- package/src/components/inputs/inputText/index.vue +11 -9
- package/src/components/inputs/textAreaInput/index.vue +6 -1
- package/src/components/modals/modal/index.vue +22 -6
- package/src/components/modals/modal/modal.stories.js +2 -1
- package/src/components/spinner/index.vue +20 -13
- package/src/helpers/numberConverter.js +13 -6
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -2,54 +2,87 @@
|
|
|
2
2
|
<ThemeProvider :theme="getTheme()" :style="{ height: '100%' }">
|
|
3
3
|
<page-container>
|
|
4
4
|
<br />
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
5
|
+
<modal backdrop="dark" :isLoading="false" :isOpen="true">
|
|
6
|
+
<main-table titleText="My Table">
|
|
7
|
+
<thead>
|
|
8
|
+
<tr>
|
|
9
|
+
<th>Column 1</th>
|
|
10
|
+
<th>Column 2</th>
|
|
11
|
+
<th>Column 3</th>
|
|
12
|
+
<div />
|
|
13
|
+
</tr>
|
|
14
|
+
</thead>
|
|
15
|
+
<tbody>
|
|
16
|
+
<tr>
|
|
17
|
+
<!-- <table-dropdown
|
|
18
|
+
:colSpan="3"
|
|
19
|
+
:tableItems="getDropdownValues()"
|
|
20
|
+
@toggle-dropdown-open="toggleDropdownOpen()"
|
|
21
|
+
@item-selected="onItemSelected({ item: $event, index })"
|
|
22
|
+
:isOpen="isDropdownOpen()"
|
|
23
|
+
:optionItems="itemOptions"
|
|
24
|
+
:optionsDisplay="['display_name', 'company_item_number', 'model']"
|
|
25
|
+
/> -->
|
|
26
|
+
<td>Test</td>
|
|
27
|
+
<div class="icons-container">
|
|
28
|
+
<three-dots :options="listOptions" :isLoading="false" />
|
|
29
|
+
</div>
|
|
30
|
+
</tr>
|
|
31
|
+
</tbody>
|
|
32
|
+
</main-table>
|
|
33
|
+
</modal>
|
|
26
34
|
<br />
|
|
35
|
+
<toggle
|
|
36
|
+
@on-toggle-change="onInputChange($event)"
|
|
37
|
+
:isChecked="inputValue"
|
|
38
|
+
label="My Label Text"
|
|
39
|
+
infoTextMessage="This is my test message"
|
|
40
|
+
infoTextAlign="right"
|
|
41
|
+
labelAlign="right"
|
|
42
|
+
:disabled="false"
|
|
43
|
+
/>
|
|
27
44
|
<br />
|
|
45
|
+
|
|
46
|
+
<p>InputText</p>
|
|
47
|
+
<input-text
|
|
48
|
+
placeholder="Company name"
|
|
49
|
+
:value="inputValue"
|
|
50
|
+
:isError="true"
|
|
51
|
+
errorMessage="This is my error message"
|
|
52
|
+
infoTextAlign="right"
|
|
53
|
+
infoTextMessage="My info message"
|
|
54
|
+
label="Question 5"
|
|
55
|
+
alignItems="vertical"
|
|
56
|
+
inputWidth="250px"
|
|
57
|
+
minWidth="100px"
|
|
58
|
+
/>
|
|
59
|
+
<br/>
|
|
28
60
|
<input-number
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
61
|
+
:value="num"
|
|
62
|
+
@input-change="num = $event"
|
|
63
|
+
unitName="t"
|
|
64
|
+
id="biebie"
|
|
65
|
+
test="koko"
|
|
66
|
+
@keydown="keydownHandler"
|
|
67
|
+
/>
|
|
36
68
|
</page-container>
|
|
37
69
|
</ThemeProvider>
|
|
38
70
|
</template>
|
|
39
71
|
|
|
40
72
|
<script>
|
|
41
|
-
import { ThemeProvider } from
|
|
42
|
-
import theme from
|
|
43
|
-
import styled from
|
|
44
|
-
|
|
45
|
-
import
|
|
46
|
-
import
|
|
73
|
+
import { ThemeProvider } from "vue-styled-components"
|
|
74
|
+
import theme from "./assets/theme"
|
|
75
|
+
import styled from "vue-styled-components"
|
|
76
|
+
import MainTable from "@/components/tables/mainTable"
|
|
77
|
+
import ThreeDots from "@/components/threeDots"
|
|
78
|
+
import Toggle from "@/components/inputs/toggle"
|
|
79
|
+
import InputNumber from "@/components/inputs/inputNumber"
|
|
80
|
+
import Checkbox from "@/components/inputs/checkbox"
|
|
81
|
+
import PageSubtitle from "@/components/pageSubtitle"
|
|
82
|
+
import Spinner from "@/components/spinner"
|
|
83
|
+
import ExternalButton from "@/components/buttons/externalButton"
|
|
84
|
+
import InputText from "@/components/inputs/inputText"
|
|
47
85
|
// import TableDropdown from "@/components/tableDropdown"
|
|
48
|
-
const InputAnnexContainer = styled.div`
|
|
49
|
-
display: grid;
|
|
50
|
-
grid-template-columns: auto auto;
|
|
51
|
-
grid-gap: 10px;
|
|
52
|
-
`
|
|
53
86
|
|
|
54
87
|
const PageContainer = styled.div`
|
|
55
88
|
padding: 40px;
|
|
@@ -60,20 +93,27 @@ export default {
|
|
|
60
93
|
components: {
|
|
61
94
|
ThemeProvider,
|
|
62
95
|
PageContainer,
|
|
96
|
+
MainTable,
|
|
97
|
+
ThreeDots,
|
|
98
|
+
Toggle,
|
|
63
99
|
InputNumber,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
100
|
+
PageSubtitle,
|
|
101
|
+
Spinner,
|
|
102
|
+
Checkbox,
|
|
103
|
+
InputText,
|
|
104
|
+
ExternalButton,
|
|
105
|
+
Modal,
|
|
67
106
|
},
|
|
68
107
|
data() {
|
|
69
108
|
return {
|
|
109
|
+
num: 42,
|
|
70
110
|
inputValue: null,
|
|
71
111
|
checkedOption: 'button_1',
|
|
72
112
|
question: {
|
|
73
113
|
number_format_precision: 4,
|
|
74
114
|
number_min_allowed: 0,
|
|
75
115
|
number_max_allowed: 10,
|
|
76
|
-
unit_short_name: 'cm'
|
|
116
|
+
unit_short_name: 'cm',
|
|
77
117
|
},
|
|
78
118
|
dropdownOpen: false,
|
|
79
119
|
isChecked: false,
|
|
@@ -81,50 +121,53 @@ export default {
|
|
|
81
121
|
{
|
|
82
122
|
name: 'Option 1',
|
|
83
123
|
value: 'option_1',
|
|
84
|
-
disabled: true
|
|
124
|
+
disabled: true,
|
|
85
125
|
},
|
|
86
126
|
{
|
|
87
127
|
name: 'Option 2',
|
|
88
|
-
value: 'option_2'
|
|
128
|
+
value: 'option_2',
|
|
89
129
|
},
|
|
90
130
|
{
|
|
91
131
|
name: 'Option 3',
|
|
92
|
-
value: 'option_3'
|
|
132
|
+
value: 'option_3',
|
|
93
133
|
},
|
|
94
134
|
{
|
|
95
135
|
name: 'Option 4',
|
|
96
|
-
value: 'option_4'
|
|
97
|
-
}
|
|
136
|
+
value: 'option_4',
|
|
137
|
+
},
|
|
98
138
|
],
|
|
99
139
|
itemOptions: [
|
|
100
140
|
{
|
|
101
141
|
display_name: 'Test 1',
|
|
102
142
|
company_item_number: '123',
|
|
103
143
|
model: 'BTB-2145 Long Text Long Text Long Text Long Text Long Text',
|
|
104
|
-
id: 1
|
|
144
|
+
id: 1,
|
|
105
145
|
},
|
|
106
146
|
{
|
|
107
147
|
display_name: 'Test 2',
|
|
108
148
|
company_item_number: '1234',
|
|
109
149
|
model: 'BTB-123',
|
|
110
|
-
id: 2
|
|
150
|
+
id: 2,
|
|
111
151
|
},
|
|
112
152
|
{
|
|
113
153
|
display_name: 'Test 3',
|
|
114
154
|
company_item_number: '12345',
|
|
115
155
|
model: 'BTB-543',
|
|
116
|
-
id: 3
|
|
156
|
+
id: 3,
|
|
117
157
|
},
|
|
118
158
|
{
|
|
119
159
|
display_name: 'Test 4',
|
|
120
160
|
company_item_number: '123456',
|
|
121
161
|
model: 'BTB-4930',
|
|
122
|
-
id: 4
|
|
123
|
-
}
|
|
124
|
-
]
|
|
162
|
+
id: 4,
|
|
163
|
+
},
|
|
164
|
+
],
|
|
125
165
|
}
|
|
126
166
|
},
|
|
127
167
|
methods: {
|
|
168
|
+
keydownHandler(e) {
|
|
169
|
+
console.log('test', e)
|
|
170
|
+
},
|
|
128
171
|
getTheme() {
|
|
129
172
|
return theme
|
|
130
173
|
},
|
|
@@ -146,21 +189,21 @@ export default {
|
|
|
146
189
|
{
|
|
147
190
|
value: this.getComponentInfo({
|
|
148
191
|
row: this.itemOptions[0],
|
|
149
|
-
value: 'display_name'
|
|
150
|
-
})
|
|
192
|
+
value: 'display_name',
|
|
193
|
+
}),
|
|
151
194
|
},
|
|
152
195
|
{
|
|
153
196
|
value: this.getComponentInfo({
|
|
154
197
|
row: this.itemOptions[0],
|
|
155
|
-
value: 'company_item_number'
|
|
156
|
-
})
|
|
198
|
+
value: 'company_item_number',
|
|
199
|
+
}),
|
|
157
200
|
},
|
|
158
201
|
{
|
|
159
202
|
value: this.getComponentInfo({
|
|
160
203
|
row: this.itemOptions[0],
|
|
161
|
-
value: 'model'
|
|
162
|
-
})
|
|
163
|
-
}
|
|
204
|
+
value: 'model',
|
|
205
|
+
}),
|
|
206
|
+
},
|
|
164
207
|
]
|
|
165
208
|
return items
|
|
166
209
|
},
|
|
Binary file
|
package/src/assets/theme.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
const theme = {
|
|
2
2
|
colors: {
|
|
3
|
-
primary:
|
|
4
|
-
secondary:
|
|
5
|
-
tertiary:
|
|
6
|
-
black:
|
|
7
|
-
yellow:
|
|
8
|
-
darkGray:
|
|
9
|
-
gray1:
|
|
10
|
-
mediumGray:
|
|
11
|
-
lightGray:
|
|
12
|
-
white:
|
|
13
|
-
blue:
|
|
14
|
-
red:
|
|
15
|
-
blue1:
|
|
16
|
-
grey1:
|
|
17
|
-
grey2:
|
|
18
|
-
grey3:
|
|
19
|
-
grey4:
|
|
20
|
-
grey5:
|
|
21
|
-
green:
|
|
22
|
-
disabled:
|
|
3
|
+
primary: '#48a2d0',
|
|
4
|
+
secondary: '#fdb813',
|
|
5
|
+
tertiary: '#d5d5d5',
|
|
6
|
+
black: '#353535',
|
|
7
|
+
yellow: '#fdb813',
|
|
8
|
+
darkGray: '#818181',
|
|
9
|
+
gray1: '#666',
|
|
10
|
+
mediumGray: '#d5d5d5',
|
|
11
|
+
lightGray: '#f2f2f2',
|
|
12
|
+
white: '#fff',
|
|
13
|
+
blue: '#48a2d0',
|
|
14
|
+
red: '#ff5656',
|
|
15
|
+
blue1: '#e4efff',
|
|
16
|
+
grey1: '#666',
|
|
17
|
+
grey2: '#c4c4c4',
|
|
18
|
+
grey3: '#b2b9c5',
|
|
19
|
+
grey4: '#dee2eb',
|
|
20
|
+
grey5: '#fafafa',
|
|
21
|
+
green: '#99db0c',
|
|
22
|
+
disabled: '#dfe1e1'
|
|
23
23
|
},
|
|
24
24
|
screen: {
|
|
25
|
-
mobileSmall:
|
|
26
|
-
mobile:
|
|
27
|
-
mobileLarge:
|
|
28
|
-
tablet:
|
|
29
|
-
tabletLarge:
|
|
25
|
+
mobileSmall: '345px',
|
|
26
|
+
mobile: '425px',
|
|
27
|
+
mobileLarge: '530px',
|
|
28
|
+
tablet: '768px',
|
|
29
|
+
tabletLarge: '950px'
|
|
30
30
|
},
|
|
31
|
-
borderRadius:
|
|
31
|
+
borderRadius: '4px'
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export default theme
|
|
@@ -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>
|
|
@@ -37,7 +37,8 @@ const IconImage = styled('div', IconImageProps)`
|
|
|
37
37
|
height: ${(props) => props.size};
|
|
38
38
|
}
|
|
39
39
|
svg > path {
|
|
40
|
-
${(props) =>
|
|
40
|
+
${(props) =>
|
|
41
|
+
props.color && `fill: ${props.theme.colors[props.color] || props.color};`}
|
|
41
42
|
}
|
|
42
43
|
&:hover > svg > path {
|
|
43
44
|
${(props) => props.hoveredColor && `fill: ${props.hoveredColor};`}
|
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<component-wrapper>
|
|
3
|
-
<icon-wrapper
|
|
3
|
+
<icon-wrapper>
|
|
4
4
|
<icon-img
|
|
5
5
|
:isActive="showInfo"
|
|
6
6
|
:size="size"
|
|
7
7
|
:borderColor="borderColor"
|
|
8
8
|
@click.prevent="toggleShowInfo()"
|
|
9
|
-
@mouseenter="
|
|
10
|
-
@mouseleave="
|
|
9
|
+
@mouseenter="toggleShowInfo()"
|
|
10
|
+
@mouseleave="toggleShowInfo()"
|
|
11
11
|
>
|
|
12
|
-
<
|
|
12
|
+
<svg
|
|
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>
|
|
13
26
|
</icon-img>
|
|
14
27
|
<text-overlay
|
|
15
28
|
v-if="showInfo"
|
|
16
29
|
:borderColor="borderColor"
|
|
17
30
|
:alignText="alignText"
|
|
18
|
-
:width="width"
|
|
19
31
|
>
|
|
20
32
|
{{ text }}
|
|
21
33
|
</text-overlay>
|
|
@@ -32,20 +44,22 @@
|
|
|
32
44
|
// size="20"
|
|
33
45
|
// alignText="right" // default is left
|
|
34
46
|
// />
|
|
35
|
-
import theme from '@/assets/theme.js'
|
|
36
|
-
import styled from 'vue-styled-components'
|
|
37
|
-
import icon from '../icon'
|
|
38
47
|
|
|
39
|
-
|
|
40
|
-
|
|
48
|
+
import styled from "vue-styled-components"
|
|
49
|
+
|
|
50
|
+
const IconWrapper = styled.div`
|
|
51
|
+
position: relative;
|
|
52
|
+
`
|
|
53
|
+
|
|
54
|
+
const textAttrs = { borderColor: String, alignText: String }
|
|
55
|
+
const TextOverlay = styled("div", textAttrs)`
|
|
41
56
|
position: absolute;
|
|
42
57
|
top: 26px;
|
|
43
|
-
right: ${(props) => (props.alignText ===
|
|
44
|
-
left: ${(props) => (props.alignText ===
|
|
45
|
-
text-align: ${(props) => props.alignText};
|
|
58
|
+
right: ${(props) => (props.alignText === "left" ? "-10px" : "inherit")};
|
|
59
|
+
left: ${(props) => (props.alignText === "left" ? "inherit" : "-10px")};
|
|
46
60
|
background: ${(props) => props.theme.colors.black};
|
|
47
61
|
padding: 10px;
|
|
48
|
-
width:
|
|
62
|
+
width: max-content;
|
|
49
63
|
max-width: 400px;
|
|
50
64
|
font-size: 13px;
|
|
51
65
|
font-weight: 400;
|
|
@@ -54,12 +68,12 @@ const TextOverlay = styled('div', textAttrs)`
|
|
|
54
68
|
color: ${(props) => props.theme.colors.white};
|
|
55
69
|
|
|
56
70
|
:before {
|
|
57
|
-
content:
|
|
71
|
+
content: "";
|
|
58
72
|
background-color: ${(props) => props.theme.colors.black};
|
|
59
73
|
position: absolute;
|
|
60
74
|
top: 2px;
|
|
61
|
-
right: ${(props) => (props.alignText ===
|
|
62
|
-
left: ${(props) => (props.alignText ===
|
|
75
|
+
right: ${(props) => (props.alignText === "left" ? "-12px" : "inherit")};
|
|
76
|
+
left: ${(props) => (props.alignText === "left" ? "inherit" : "40px")};
|
|
63
77
|
height: 8px;
|
|
64
78
|
width: 8px;
|
|
65
79
|
transform-origin: center center;
|
|
@@ -68,15 +82,18 @@ const TextOverlay = styled('div', textAttrs)`
|
|
|
68
82
|
`
|
|
69
83
|
|
|
70
84
|
const iconAttrs = { isActive: Boolean, size: String, borderColor: String }
|
|
71
|
-
|
|
72
|
-
const IconWrapper = styled('div', iconAttrs)`
|
|
73
|
-
position: relative;
|
|
74
|
-
top: 1px;
|
|
75
|
-
height: ${(props) => props.size}px;
|
|
76
|
-
`
|
|
77
|
-
const IconImg = styled('div', iconAttrs)`
|
|
85
|
+
const IconImg = styled("div", iconAttrs)`
|
|
78
86
|
cursor: pointer;
|
|
79
|
-
height: ${(props) => props.size}
|
|
87
|
+
height: ${(props) => props.size + "px"};
|
|
88
|
+
|
|
89
|
+
.img-icon {
|
|
90
|
+
fill: ${(props) =>
|
|
91
|
+
props.isActive
|
|
92
|
+
? props.borderColor
|
|
93
|
+
? props.borderColor
|
|
94
|
+
: props.theme.colors.secondary
|
|
95
|
+
: props.theme.colors.mediumGray};
|
|
96
|
+
}
|
|
80
97
|
`
|
|
81
98
|
|
|
82
99
|
const ComponentWrapper = styled.div`
|
|
@@ -84,44 +101,38 @@ const ComponentWrapper = styled.div`
|
|
|
84
101
|
`
|
|
85
102
|
|
|
86
103
|
export default {
|
|
87
|
-
name:
|
|
104
|
+
name: "info-text",
|
|
88
105
|
components: {
|
|
89
106
|
IconWrapper,
|
|
90
107
|
TextOverlay,
|
|
91
108
|
ComponentWrapper,
|
|
92
109
|
IconImg,
|
|
93
|
-
icon
|
|
94
110
|
},
|
|
95
111
|
props: {
|
|
96
112
|
text: {
|
|
97
|
-
required: true
|
|
113
|
+
required: true,
|
|
98
114
|
},
|
|
99
115
|
borderColor: {
|
|
100
116
|
required: false,
|
|
101
|
-
default: null
|
|
117
|
+
default: null,
|
|
102
118
|
},
|
|
103
119
|
size: {
|
|
104
120
|
required: false,
|
|
105
|
-
default:
|
|
121
|
+
default: "20",
|
|
106
122
|
},
|
|
107
123
|
alignText: {
|
|
108
124
|
required: false,
|
|
109
|
-
default:
|
|
125
|
+
default: "left", // "left" or "right"
|
|
110
126
|
},
|
|
111
|
-
openTrigger:{
|
|
112
|
-
required:false,
|
|
113
|
-
default: "onClick"
|
|
114
|
-
},
|
|
115
|
-
width:{required:false}
|
|
116
127
|
},
|
|
117
128
|
methods: {
|
|
118
129
|
toggleShowInfo() {
|
|
119
130
|
this.showInfo = !this.showInfo
|
|
120
131
|
|
|
121
132
|
if (this.showInfo) {
|
|
122
|
-
document.addEventListener(
|
|
133
|
+
document.addEventListener("click", this.clickOutside)
|
|
123
134
|
} else {
|
|
124
|
-
document.removeEventListener(
|
|
135
|
+
document.removeEventListener("click", this.clickOutside)
|
|
125
136
|
}
|
|
126
137
|
},
|
|
127
138
|
clickOutside(event) {
|
|
@@ -129,21 +140,12 @@ export default {
|
|
|
129
140
|
return
|
|
130
141
|
}
|
|
131
142
|
this.toggleShowInfo()
|
|
132
|
-
}
|
|
143
|
+
},
|
|
133
144
|
},
|
|
134
145
|
data() {
|
|
135
146
|
return {
|
|
136
|
-
showInfo: false
|
|
147
|
+
showInfo: false,
|
|
137
148
|
}
|
|
138
149
|
},
|
|
139
|
-
computed: {
|
|
140
|
-
iconColor() {
|
|
141
|
-
return this.isActive
|
|
142
|
-
? this.borderColor
|
|
143
|
-
? this.borderColor
|
|
144
|
-
: theme.colors.secondary
|
|
145
|
-
: theme.colors.mediumGray
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
150
|
}
|
|
149
|
-
</script>
|
|
151
|
+
</script>
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
// backgroundColor="red"
|
|
34
34
|
// :isDisabled="true"
|
|
35
35
|
// />
|
|
36
|
-
import styled from
|
|
36
|
+
import styled from 'vue-styled-components'
|
|
37
37
|
|
|
38
38
|
const ComponentWrapper = styled.div`
|
|
39
39
|
min-height: 18px;
|
|
@@ -45,34 +45,33 @@ const containerAttrs = {
|
|
|
45
45
|
hasLabel: Boolean,
|
|
46
46
|
backgroundColor: String,
|
|
47
47
|
isChecked: Boolean,
|
|
48
|
-
isDisabled: Boolean
|
|
48
|
+
isDisabled: Boolean
|
|
49
49
|
}
|
|
50
|
-
const Container = styled(
|
|
50
|
+
const Container = styled('label', containerAttrs)`
|
|
51
51
|
display: grid;
|
|
52
|
-
grid-template-columns: ${(props) => (props.hasLabel ?
|
|
52
|
+
grid-template-columns: ${(props) => (props.hasLabel ? '18px auto' : '18px')};
|
|
53
53
|
grid-gap: 16px;
|
|
54
54
|
align-content: center;
|
|
55
|
-
/* align-items: center; */
|
|
56
55
|
color: ${(props) => props.theme.colors.black};
|
|
57
56
|
position: relative;
|
|
58
|
-
cursor: ${(props) => (props.isDisabled ?
|
|
57
|
+
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
|
|
59
58
|
font-size: 16px;
|
|
60
59
|
user-select: none;
|
|
61
60
|
|
|
62
61
|
.checkmark {
|
|
63
62
|
position: absolute;
|
|
64
63
|
height: ${(props) =>
|
|
65
|
-
props.size ===
|
|
66
|
-
?
|
|
67
|
-
: props.size ===
|
|
68
|
-
?
|
|
69
|
-
:
|
|
64
|
+
props.size === 'medium'
|
|
65
|
+
? '25px'
|
|
66
|
+
: props.size === 'small'
|
|
67
|
+
? '16px'
|
|
68
|
+
: '25px'};
|
|
70
69
|
width: ${(props) =>
|
|
71
|
-
props.size ===
|
|
72
|
-
?
|
|
73
|
-
: props.size ===
|
|
74
|
-
?
|
|
75
|
-
:
|
|
70
|
+
props.size === 'medium'
|
|
71
|
+
? '25px'
|
|
72
|
+
: props.size === 'small'
|
|
73
|
+
? '16px'
|
|
74
|
+
: '25px'};
|
|
76
75
|
background-color: ${(props) =>
|
|
77
76
|
props.isChecked
|
|
78
77
|
? props.backgroundColor
|
|
@@ -80,7 +79,7 @@ const Container = styled("label", containerAttrs)`
|
|
|
80
79
|
: props.theme.colors.green
|
|
81
80
|
: props.isDisabled
|
|
82
81
|
? props.theme.colors.lightGray
|
|
83
|
-
:
|
|
82
|
+
: '#fff'};
|
|
84
83
|
border-radius: 4px;
|
|
85
84
|
border: 1px solid
|
|
86
85
|
${(props) =>
|
|
@@ -91,34 +90,34 @@ const Container = styled("label", containerAttrs)`
|
|
|
91
90
|
: props.theme.colors.mediumGray};
|
|
92
91
|
|
|
93
92
|
&:after {
|
|
94
|
-
content:
|
|
93
|
+
content: '';
|
|
95
94
|
position: absolute;
|
|
96
|
-
display: ${(props) => (props.isChecked ?
|
|
95
|
+
display: ${(props) => (props.isChecked ? 'block' : 'none')};
|
|
97
96
|
}
|
|
98
97
|
}
|
|
99
98
|
|
|
100
99
|
.checkmark:after {
|
|
101
100
|
left: ${(props) =>
|
|
102
|
-
props.size ===
|
|
101
|
+
props.size === 'medium' ? '9px' : props.size === 'small' ? '5px' : '9px'};
|
|
103
102
|
top: ${(props) =>
|
|
104
|
-
props.size ===
|
|
103
|
+
props.size === 'medium' ? '5px' : props.size === 'small' ? '2px' : '5px'};
|
|
105
104
|
width: ${(props) =>
|
|
106
|
-
props.size ===
|
|
105
|
+
props.size === 'medium' ? '5px' : props.size === 'small' ? '3px' : '5px'};
|
|
107
106
|
height: ${(props) =>
|
|
108
|
-
props.size ===
|
|
109
|
-
?
|
|
110
|
-
: props.size ===
|
|
111
|
-
?
|
|
112
|
-
:
|
|
107
|
+
props.size === 'medium'
|
|
108
|
+
? '10px'
|
|
109
|
+
: props.size === 'small'
|
|
110
|
+
? '6px'
|
|
111
|
+
: '10px'};
|
|
113
112
|
border: solid
|
|
114
113
|
${(props) =>
|
|
115
114
|
props.checkColor ? props.checkColor : props.theme.colors.white};
|
|
116
115
|
border-width: ${(props) =>
|
|
117
|
-
props.size ===
|
|
118
|
-
?
|
|
119
|
-
: props.size ===
|
|
120
|
-
?
|
|
121
|
-
:
|
|
116
|
+
props.size === 'medium'
|
|
117
|
+
? '0 3px 3px 0'
|
|
118
|
+
: props.size === 'small'
|
|
119
|
+
? '0 2px 2px 0'
|
|
120
|
+
: '0 3px 3px 0'};
|
|
122
121
|
transform: rotate(45deg);
|
|
123
122
|
}
|
|
124
123
|
`
|
|
@@ -135,49 +134,49 @@ const InputCheckbox = styled.input`
|
|
|
135
134
|
const LabelText = styled.div`
|
|
136
135
|
font-size: 13px;
|
|
137
136
|
display: grid;
|
|
138
|
-
align-items:
|
|
137
|
+
align-items: flex-start;
|
|
139
138
|
min-height: 18px;
|
|
140
139
|
`
|
|
141
140
|
|
|
142
141
|
export default {
|
|
143
|
-
name:
|
|
142
|
+
name: 'checkbox',
|
|
144
143
|
components: {
|
|
145
144
|
ComponentWrapper,
|
|
146
145
|
Container,
|
|
147
146
|
InputCheckbox,
|
|
148
|
-
LabelText
|
|
147
|
+
LabelText
|
|
149
148
|
},
|
|
150
149
|
props: {
|
|
151
150
|
label: {
|
|
152
151
|
required: false,
|
|
153
|
-
default:
|
|
152
|
+
default: ''
|
|
154
153
|
},
|
|
155
154
|
isChecked: {
|
|
156
155
|
required: true,
|
|
157
|
-
default: false
|
|
156
|
+
default: false
|
|
158
157
|
},
|
|
159
158
|
checkColor: {
|
|
160
|
-
required: false
|
|
159
|
+
required: false
|
|
161
160
|
},
|
|
162
161
|
size: {
|
|
163
162
|
required: false,
|
|
164
|
-
default:
|
|
163
|
+
default: 'medium' // small, medium
|
|
165
164
|
},
|
|
166
165
|
backgroundColor: {
|
|
167
|
-
required: false
|
|
166
|
+
required: false
|
|
168
167
|
},
|
|
169
168
|
isDisabled: {
|
|
170
169
|
required: false,
|
|
171
|
-
default: false
|
|
172
|
-
}
|
|
170
|
+
default: false
|
|
171
|
+
}
|
|
173
172
|
},
|
|
174
173
|
methods: {
|
|
175
174
|
onChangeHandler(value) {
|
|
176
175
|
if (this.isDisabled) {
|
|
177
176
|
return
|
|
178
177
|
}
|
|
179
|
-
this.$emit(
|
|
180
|
-
}
|
|
181
|
-
}
|
|
178
|
+
this.$emit('on-event-handler', value)
|
|
179
|
+
}
|
|
180
|
+
}
|
|
182
181
|
}
|
|
183
182
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<container
|
|
2
|
+
<container>
|
|
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="13"
|
|
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,19 +31,19 @@
|
|
|
30
31
|
:textAlign="textAlign"
|
|
31
32
|
:fontSize="fontSize"
|
|
32
33
|
:fontColor="fontColor"
|
|
33
|
-
|
|
34
|
-
:slotSize="slotSize"
|
|
34
|
+
v-on="$listeners"
|
|
35
35
|
/>
|
|
36
|
-
<slot-container v-if="hasSlot" :slotSize="slotSize" :isError="isError">
|
|
37
|
-
<slot></slot>
|
|
38
|
-
</slot-container>
|
|
39
|
-
|
|
40
36
|
<unit-container
|
|
41
|
-
v-if="unitName && showLinearUnitName
|
|
37
|
+
v-if="unitName && showLinearUnitName"
|
|
42
38
|
:hasLength="!!textInput.length"
|
|
43
39
|
:isError="isError"
|
|
44
40
|
>{{ unitName }}</unit-container
|
|
45
41
|
>
|
|
42
|
+
<icon
|
|
43
|
+
v-if="(isError || inputIcon) && !showLinearUnitName"
|
|
44
|
+
:class="inputIconImageClass"
|
|
45
|
+
:src="isError ? warningIcon : inputIconImage"
|
|
46
|
+
/>
|
|
46
47
|
</input-wrapper>
|
|
47
48
|
<error-message v-if="isError">{{ errorMessage }}</error-message>
|
|
48
49
|
</container>
|
|
@@ -80,6 +81,12 @@ import {
|
|
|
80
81
|
numberToString
|
|
81
82
|
} from '../../../helpers/numberConverter'
|
|
82
83
|
import InfoText from '../../infoText'
|
|
84
|
+
import ErrorMessage from '../../errorMessage'
|
|
85
|
+
import warningIcon from '../../../assets/icons/error_icon.png'
|
|
86
|
+
const Container = styled.div`
|
|
87
|
+
width: 100%;
|
|
88
|
+
position: relative;
|
|
89
|
+
`
|
|
83
90
|
|
|
84
91
|
const inputProps = {
|
|
85
92
|
isError: Boolean,
|
|
@@ -90,16 +97,8 @@ const inputProps = {
|
|
|
90
97
|
noBorder: Boolean,
|
|
91
98
|
textAlign: String,
|
|
92
99
|
fontSize: String,
|
|
93
|
-
fontColor: String
|
|
94
|
-
hasSlot: Boolean,
|
|
95
|
-
slotSize: String
|
|
100
|
+
fontColor: String
|
|
96
101
|
}
|
|
97
|
-
|
|
98
|
-
const Container = styled('div', inputProps)`
|
|
99
|
-
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
|
100
|
-
position: relative;
|
|
101
|
-
`
|
|
102
|
-
|
|
103
102
|
const InputContainer = styled('input', inputProps)`
|
|
104
103
|
border: ${(props) =>
|
|
105
104
|
props.isError
|
|
@@ -107,15 +106,8 @@ const InputContainer = styled('input', inputProps)`
|
|
|
107
106
|
: props.noBorder
|
|
108
107
|
? 'none'
|
|
109
108
|
: '1px solid ' + props.theme.colors.mediumGray};
|
|
110
|
-
padding
|
|
111
|
-
|
|
112
|
-
padding-left: 10px;
|
|
113
|
-
padding-right: ${(props) =>
|
|
114
|
-
props.slotSize
|
|
115
|
-
? 'calc(' + props.slotSize + ' + 10px)'
|
|
116
|
-
: props.hasUnit
|
|
117
|
-
? '40px'
|
|
118
|
-
: '5px'};
|
|
109
|
+
padding: ${(props) =>
|
|
110
|
+
props.hasUnit ? '11px 40px 11px 10px' : '11px 5px 11px 10px'};
|
|
119
111
|
border-radius: 4px;
|
|
120
112
|
text-align: ${(props) => props.textAlign};
|
|
121
113
|
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
|
|
@@ -141,6 +133,15 @@ const InputContainer = styled('input', inputProps)`
|
|
|
141
133
|
outline: none;
|
|
142
134
|
}
|
|
143
135
|
`
|
|
136
|
+
const IconProps = {
|
|
137
|
+
inputIconHeight: String
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const Icon = styled('img', IconProps)`
|
|
141
|
+
position: absolute;
|
|
142
|
+
right: 10px;
|
|
143
|
+
top: 2px;
|
|
144
|
+
`
|
|
144
145
|
|
|
145
146
|
const InputWrapper = styled.span`
|
|
146
147
|
position: relative;
|
|
@@ -158,7 +159,6 @@ const UnitContainer = styled('span', inputProps)`
|
|
|
158
159
|
right: 10px;
|
|
159
160
|
top: 0;
|
|
160
161
|
padding-left: 10px;
|
|
161
|
-
text-align: right;
|
|
162
162
|
color: ${(props) =>
|
|
163
163
|
props.isError
|
|
164
164
|
? props.theme.colors.red
|
|
@@ -167,34 +167,14 @@ const UnitContainer = styled('span', inputProps)`
|
|
|
167
167
|
: props.theme.colors.mediumGray};
|
|
168
168
|
`
|
|
169
169
|
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
: props.theme.colors.mediumGray};
|
|
179
|
-
position: absolute;
|
|
180
|
-
width: ${(props) =>
|
|
181
|
-
props.slotSize ? 'calc(' + props.slotSize + ' - 10px)' : 'fit-content'};
|
|
182
|
-
right: 10px;
|
|
183
|
-
top: 0;
|
|
184
|
-
padding-left: 10px;
|
|
185
|
-
color: ${(props) =>
|
|
186
|
-
props.isError
|
|
187
|
-
? props.theme.colors.red
|
|
188
|
-
: props.hasLength
|
|
189
|
-
? props.theme.colors.black
|
|
190
|
-
: props.theme.colors.mediumGray};
|
|
191
|
-
`
|
|
192
|
-
const ErrorMessage = styled.div`
|
|
193
|
-
font-size: 14px;
|
|
194
|
-
color: ${(props) => props.theme.colors.red};
|
|
195
|
-
position: absolute;
|
|
196
|
-
top: calc(100% + 1px);
|
|
197
|
-
`
|
|
170
|
+
// const ErrorMessage = styled.div`
|
|
171
|
+
// margin-top: 5px;
|
|
172
|
+
// line-height: 1;
|
|
173
|
+
// text-transform: none;
|
|
174
|
+
// font-size: 10px;
|
|
175
|
+
// color: ${(props) => props.theme.colors.red};
|
|
176
|
+
// position: absolute;
|
|
177
|
+
// `
|
|
198
178
|
|
|
199
179
|
const LabelWrapper = styled.div`
|
|
200
180
|
display: flex;
|
|
@@ -217,13 +197,21 @@ export default {
|
|
|
217
197
|
ErrorMessage,
|
|
218
198
|
LabelWrapper,
|
|
219
199
|
LabelText,
|
|
220
|
-
|
|
221
|
-
|
|
200
|
+
InfoText,
|
|
201
|
+
Icon
|
|
222
202
|
},
|
|
203
|
+
inheritAttrs: false,
|
|
223
204
|
data() {
|
|
224
205
|
return {
|
|
225
206
|
textInput: '',
|
|
226
|
-
isFocused: false
|
|
207
|
+
isFocused: false,
|
|
208
|
+
warningIcon: warningIcon
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
computed: {
|
|
212
|
+
displayedPlaceholder() {
|
|
213
|
+
if (this.placeholder) return this.placeholder
|
|
214
|
+
return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
|
|
227
215
|
}
|
|
228
216
|
},
|
|
229
217
|
props: {
|
|
@@ -307,22 +295,25 @@ export default {
|
|
|
307
295
|
required: false,
|
|
308
296
|
default: true
|
|
309
297
|
},
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
298
|
+
inputIcon: {
|
|
299
|
+
require: false,
|
|
300
|
+
type: Boolean,
|
|
301
|
+
default: false
|
|
302
|
+
},
|
|
303
|
+
inputIconImage: {
|
|
304
|
+
require: false,
|
|
305
|
+
type: String,
|
|
306
|
+
default: ''
|
|
318
307
|
},
|
|
319
|
-
|
|
320
|
-
|
|
308
|
+
inputIconImageClass: {
|
|
309
|
+
require: false,
|
|
310
|
+
type: Array,
|
|
311
|
+
default: () => []
|
|
321
312
|
}
|
|
322
313
|
},
|
|
323
314
|
methods: {
|
|
324
315
|
onChangeHandler(event) {
|
|
325
|
-
if (isNaN(event)) {
|
|
316
|
+
if (isNaN(event) || event=="") {
|
|
326
317
|
event = this.minNumber || this.minNumber === 0 ? this.minNumber : event
|
|
327
318
|
}
|
|
328
319
|
this.$emit('input-change', event)
|
|
@@ -352,10 +343,12 @@ export default {
|
|
|
352
343
|
}
|
|
353
344
|
})
|
|
354
345
|
let evaluated = eval(formatted.join(''))
|
|
355
|
-
evaluated
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
346
|
+
if (typeof evaluated === 'string') {
|
|
347
|
+
evaluated = stringToNumber({
|
|
348
|
+
value: evaluated,
|
|
349
|
+
numberPrecision: this.numberPrecision
|
|
350
|
+
})
|
|
351
|
+
}
|
|
359
352
|
return evaluated
|
|
360
353
|
},
|
|
361
354
|
onInputBlur(e) {
|
|
@@ -386,6 +379,7 @@ export default {
|
|
|
386
379
|
this.$nextTick(() => {
|
|
387
380
|
this.$refs.inputField1.$el.select()
|
|
388
381
|
})
|
|
382
|
+
this.$emit('input-focus')
|
|
389
383
|
},
|
|
390
384
|
formatWithCurrency(value) {
|
|
391
385
|
let adjustedMinValue =
|
|
@@ -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: {
|
|
@@ -3,15 +3,18 @@
|
|
|
3
3
|
:isOpen="isOpen"
|
|
4
4
|
:class="{ visible: isOpen, hidden: !isOpen }"
|
|
5
5
|
@click.native="onOutsideClose()"
|
|
6
|
+
:backdrop="backdrop"
|
|
6
7
|
>
|
|
7
8
|
<modal-container @click.stop>
|
|
8
|
-
<spinner v-if="isLoading" size="50px" :
|
|
9
|
+
<spinner v-if="isLoading" size="50px" :limitedToModal="true" />
|
|
10
|
+
<content-container :visible="!isLoading">
|
|
11
|
+
<slot />
|
|
12
|
+
</content-container>
|
|
9
13
|
<close-button
|
|
10
14
|
v-if="!hideClose"
|
|
11
15
|
@click.native="onCloseModal()"
|
|
12
16
|
class="close"
|
|
13
17
|
/>
|
|
14
|
-
<slot />
|
|
15
18
|
</modal-container>
|
|
16
19
|
</page-wrapper>
|
|
17
20
|
</template>
|
|
@@ -28,7 +31,12 @@ import styled from 'vue-styled-components'
|
|
|
28
31
|
import CloseButton from '../../buttons/closeButton'
|
|
29
32
|
import Spinner from '../../spinner'
|
|
30
33
|
|
|
31
|
-
const
|
|
34
|
+
const contentAttrs = { visible: Boolean }
|
|
35
|
+
const ContentContainer = styled('div', contentAttrs)`
|
|
36
|
+
visibility: ${(props) => (props.visible ? 'inherit' : 'hidden')};
|
|
37
|
+
`
|
|
38
|
+
|
|
39
|
+
const pageAttrs = { isOpen: Boolean, backdrop: String }
|
|
32
40
|
const PageWrapper = styled('div', pageAttrs)`
|
|
33
41
|
position: fixed;
|
|
34
42
|
display: grid;
|
|
@@ -36,7 +44,10 @@ const PageWrapper = styled('div', pageAttrs)`
|
|
|
36
44
|
left: 0;
|
|
37
45
|
width: 100%;
|
|
38
46
|
height: 100%;
|
|
39
|
-
background-color:
|
|
47
|
+
background-color: ${(props) =>
|
|
48
|
+
props.backdrop == 'dark'
|
|
49
|
+
? 'rgba(0, 0, 0, 0.4)'
|
|
50
|
+
: 'rgba(255, 255, 255, 0.9)'};
|
|
40
51
|
z-index: 99999;
|
|
41
52
|
overflow: auto;
|
|
42
53
|
|
|
@@ -98,7 +109,8 @@ export default {
|
|
|
98
109
|
PageWrapper,
|
|
99
110
|
ModalContainer,
|
|
100
111
|
CloseButton,
|
|
101
|
-
Spinner
|
|
112
|
+
Spinner,
|
|
113
|
+
ContentContainer
|
|
102
114
|
},
|
|
103
115
|
props: {
|
|
104
116
|
isOpen: {
|
|
@@ -116,6 +128,10 @@ export default {
|
|
|
116
128
|
hideClose: {
|
|
117
129
|
required: false,
|
|
118
130
|
default: false
|
|
131
|
+
},
|
|
132
|
+
backdrop: {
|
|
133
|
+
required: false,
|
|
134
|
+
default: 'white'
|
|
119
135
|
}
|
|
120
136
|
},
|
|
121
137
|
methods: {
|
|
@@ -135,4 +151,4 @@ export default {
|
|
|
135
151
|
}
|
|
136
152
|
}
|
|
137
153
|
}
|
|
138
|
-
</script>
|
|
154
|
+
</script>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
/>
|
|
8
8
|
</container>
|
|
9
9
|
</spinner-container>
|
|
10
|
-
<container v-else>
|
|
10
|
+
<container v-else :limitedToModal="limitedToModal">
|
|
11
11
|
<spinner-wrapper
|
|
12
12
|
:size="size"
|
|
13
13
|
:src="require('../../assets/icons/black_spinner.svg')"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<script>
|
|
19
19
|
// import Spinner from "@eturnity/eturnity_reusable_components/src/components/spinner"
|
|
20
20
|
// <spinner size="30px" />
|
|
21
|
-
import styled from
|
|
21
|
+
import styled from 'vue-styled-components'
|
|
22
22
|
|
|
23
23
|
const SpinnerContainer = styled.div`
|
|
24
24
|
position: fixed;
|
|
@@ -32,34 +32,41 @@ const SpinnerContainer = styled.div`
|
|
|
32
32
|
justify-items: center;
|
|
33
33
|
z-index: 100;
|
|
34
34
|
`
|
|
35
|
-
|
|
36
|
-
const Container = styled
|
|
35
|
+
const containerAttrs = { limitedToModal: Boolean }
|
|
36
|
+
const Container = styled('div', containerAttrs)`
|
|
37
37
|
display: grid;
|
|
38
38
|
align-items: center;
|
|
39
39
|
justify-items: center;
|
|
40
|
+
position: ${(props) => (props.limitedToModal ? 'absolute' : 'inherit')};
|
|
41
|
+
height: ${(props) => (props.limitedToModal ? '100%' : 'inherit')};
|
|
42
|
+
width: ${(props) => (props.limitedToModal ? '100%' : 'inherit')};
|
|
40
43
|
`
|
|
41
44
|
|
|
42
45
|
const spinnerAttrs = { size: String }
|
|
43
|
-
const SpinnerWrapper = styled(
|
|
44
|
-
width: ${(props) => (props.size ? props.size :
|
|
46
|
+
const SpinnerWrapper = styled('img', spinnerAttrs)`
|
|
47
|
+
width: ${(props) => (props.size ? props.size : '60px')};
|
|
45
48
|
`
|
|
46
49
|
|
|
47
50
|
export default {
|
|
48
|
-
name:
|
|
51
|
+
name: 'spinner',
|
|
49
52
|
components: {
|
|
50
53
|
Container,
|
|
51
54
|
SpinnerWrapper,
|
|
52
|
-
SpinnerContainer
|
|
55
|
+
SpinnerContainer
|
|
53
56
|
},
|
|
54
57
|
props: {
|
|
55
58
|
fullWidth: {
|
|
56
59
|
required: false,
|
|
57
|
-
default: false
|
|
60
|
+
default: false
|
|
58
61
|
},
|
|
59
|
-
|
|
62
|
+
limitedToModal: {
|
|
60
63
|
required: false,
|
|
61
|
-
default:
|
|
64
|
+
default: false
|
|
62
65
|
},
|
|
63
|
-
|
|
66
|
+
size: {
|
|
67
|
+
required: false,
|
|
68
|
+
default: null
|
|
69
|
+
}
|
|
70
|
+
}
|
|
64
71
|
}
|
|
65
|
-
</script>
|
|
72
|
+
</script>
|
|
@@ -4,20 +4,21 @@ 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
|
-
}
|
|
10
7
|
let newVal = value.toString()
|
|
11
8
|
const selectedLang = localStorage.getItem('lang')
|
|
12
9
|
// The first replace will replace not allowed characters with a blank
|
|
13
10
|
if (
|
|
14
11
|
selectedLang === 'de-DE' ||
|
|
12
|
+
selectedLang === 'de-de' ||
|
|
15
13
|
selectedLang === 'no-no' ||
|
|
16
14
|
selectedLang === 'da-dk' ||
|
|
17
15
|
selectedLang === 'de-lu' ||
|
|
18
16
|
selectedLang === 'de-be' ||
|
|
19
17
|
selectedLang === 'es-es' ||
|
|
20
|
-
selectedLang === 'de'
|
|
18
|
+
selectedLang === 'de' ||
|
|
19
|
+
selectedLang === 'it' ||
|
|
20
|
+
selectedLang === 'nl-nl' ||
|
|
21
|
+
selectedLang === 'nl-be'
|
|
21
22
|
) {
|
|
22
23
|
// replace dots with blank, and commas with a dot: 1.234,56 --> 1234.56
|
|
23
24
|
if (allowNegative) {
|
|
@@ -45,9 +46,15 @@ export const stringToNumber = ({
|
|
|
45
46
|
) {
|
|
46
47
|
// replace ' with blank: 1'234.56 --> 1234.56
|
|
47
48
|
if (allowNegative) {
|
|
48
|
-
newVal = newVal
|
|
49
|
+
newVal = newVal
|
|
50
|
+
.replace(/[^\d-.,']/g, '')
|
|
51
|
+
.replace(/[,\s]/, '')
|
|
52
|
+
.replace(/['\s]/g, '')
|
|
49
53
|
} else {
|
|
50
|
-
newVal = newVal
|
|
54
|
+
newVal = newVal
|
|
55
|
+
.replace(/[^\d.,']/g, '')
|
|
56
|
+
.replace(/[,\s]/, '')
|
|
57
|
+
.replace(/['\s]/g, '')
|
|
51
58
|
}
|
|
52
59
|
} else if (
|
|
53
60
|
selectedLang === 'fr-fr' ||
|