@eturnity/eturnity_reusable_components 1.2.16 → 1.2.18-v.5.39.2
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 +61 -53
- package/src/assets/theme.js +26 -26
- package/src/components/inputs/inputNumber/index.vue +74 -72
- 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 -3
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<ThemeProvider :theme="getTheme()" :style="{ height: '100%' }">
|
|
3
3
|
<page-container>
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
<br />
|
|
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
|
|
16
18
|
:colSpan="3"
|
|
17
19
|
:tableItems="getDropdownValues()"
|
|
18
20
|
@toggle-dropdown-open="toggleDropdownOpen()"
|
|
@@ -21,14 +23,14 @@
|
|
|
21
23
|
:optionItems="itemOptions"
|
|
22
24
|
:optionsDisplay="['display_name', 'company_item_number', 'model']"
|
|
23
25
|
/> -->
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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>
|
|
32
34
|
<br />
|
|
33
35
|
<toggle
|
|
34
36
|
@on-toggle-change="onInputChange($event)"
|
|
@@ -47,11 +49,15 @@
|
|
|
47
49
|
@input-change="onInputChange($event)"
|
|
48
50
|
/>
|
|
49
51
|
<br />
|
|
50
|
-
|
|
51
|
-
<
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
<page-subtitle text="My Subtitle" infoText="My info Text" />
|
|
53
|
+
<spinner size="30px" />
|
|
54
|
+
<checkbox
|
|
55
|
+
label="Do you accept the Terms?"
|
|
56
|
+
:isChecked="true"
|
|
57
|
+
size="small"
|
|
58
|
+
:isDisabled="false"
|
|
59
|
+
/>
|
|
60
|
+
<external-button text="Click me!" minWidth="500px" />
|
|
55
61
|
</page-container>
|
|
56
62
|
</ThemeProvider>
|
|
57
63
|
</template>
|
|
@@ -60,14 +66,15 @@
|
|
|
60
66
|
import { ThemeProvider } from 'vue-styled-components'
|
|
61
67
|
import theme from './assets/theme'
|
|
62
68
|
import styled from 'vue-styled-components'
|
|
63
|
-
import
|
|
69
|
+
import MainTable from '@/components/tables/mainTable'
|
|
70
|
+
import ThreeDots from '@/components/threeDots'
|
|
71
|
+
import Toggle from '@/components/inputs/toggle'
|
|
64
72
|
import InputNumber from '@/components/inputs/inputNumber'
|
|
65
73
|
import Checkbox from '@/components/inputs/checkbox'
|
|
66
74
|
import PageSubtitle from '@/components/pageSubtitle'
|
|
67
75
|
import Spinner from '@/components/spinner'
|
|
68
76
|
import ExternalButton from '@/components/buttons/externalButton'
|
|
69
|
-
import
|
|
70
|
-
import collection from '@/components/icons/iconCollection'
|
|
77
|
+
import Modal from '@/components/modals/modal'
|
|
71
78
|
// import TableDropdown from "@/components/tableDropdown"
|
|
72
79
|
|
|
73
80
|
const PageContainer = styled.div`
|
|
@@ -83,10 +90,11 @@ export default {
|
|
|
83
90
|
ThreeDots,
|
|
84
91
|
Toggle,
|
|
85
92
|
InputNumber,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
93
|
+
PageSubtitle,
|
|
94
|
+
Spinner,
|
|
95
|
+
Checkbox,
|
|
96
|
+
ExternalButton,
|
|
97
|
+
Modal,
|
|
90
98
|
},
|
|
91
99
|
data() {
|
|
92
100
|
return {
|
|
@@ -96,7 +104,7 @@ export default {
|
|
|
96
104
|
number_format_precision: 4,
|
|
97
105
|
number_min_allowed: 0,
|
|
98
106
|
number_max_allowed: 10,
|
|
99
|
-
unit_short_name: 'cm'
|
|
107
|
+
unit_short_name: 'cm',
|
|
100
108
|
},
|
|
101
109
|
dropdownOpen: false,
|
|
102
110
|
isChecked: false,
|
|
@@ -104,47 +112,47 @@ export default {
|
|
|
104
112
|
{
|
|
105
113
|
name: 'Option 1',
|
|
106
114
|
value: 'option_1',
|
|
107
|
-
disabled: true
|
|
115
|
+
disabled: true,
|
|
108
116
|
},
|
|
109
117
|
{
|
|
110
118
|
name: 'Option 2',
|
|
111
|
-
value: 'option_2'
|
|
119
|
+
value: 'option_2',
|
|
112
120
|
},
|
|
113
121
|
{
|
|
114
122
|
name: 'Option 3',
|
|
115
|
-
value: 'option_3'
|
|
123
|
+
value: 'option_3',
|
|
116
124
|
},
|
|
117
125
|
{
|
|
118
126
|
name: 'Option 4',
|
|
119
|
-
value: 'option_4'
|
|
120
|
-
}
|
|
127
|
+
value: 'option_4',
|
|
128
|
+
},
|
|
121
129
|
],
|
|
122
130
|
itemOptions: [
|
|
123
131
|
{
|
|
124
132
|
display_name: 'Test 1',
|
|
125
133
|
company_item_number: '123',
|
|
126
134
|
model: 'BTB-2145 Long Text Long Text Long Text Long Text Long Text',
|
|
127
|
-
id: 1
|
|
135
|
+
id: 1,
|
|
128
136
|
},
|
|
129
137
|
{
|
|
130
138
|
display_name: 'Test 2',
|
|
131
139
|
company_item_number: '1234',
|
|
132
140
|
model: 'BTB-123',
|
|
133
|
-
id: 2
|
|
141
|
+
id: 2,
|
|
134
142
|
},
|
|
135
143
|
{
|
|
136
144
|
display_name: 'Test 3',
|
|
137
145
|
company_item_number: '12345',
|
|
138
146
|
model: 'BTB-543',
|
|
139
|
-
id: 3
|
|
147
|
+
id: 3,
|
|
140
148
|
},
|
|
141
149
|
{
|
|
142
150
|
display_name: 'Test 4',
|
|
143
151
|
company_item_number: '123456',
|
|
144
152
|
model: 'BTB-4930',
|
|
145
|
-
id: 4
|
|
146
|
-
}
|
|
147
|
-
]
|
|
153
|
+
id: 4,
|
|
154
|
+
},
|
|
155
|
+
],
|
|
148
156
|
}
|
|
149
157
|
},
|
|
150
158
|
methods: {
|
|
@@ -169,21 +177,21 @@ export default {
|
|
|
169
177
|
{
|
|
170
178
|
value: this.getComponentInfo({
|
|
171
179
|
row: this.itemOptions[0],
|
|
172
|
-
value: 'display_name'
|
|
173
|
-
})
|
|
180
|
+
value: 'display_name',
|
|
181
|
+
}),
|
|
174
182
|
},
|
|
175
183
|
{
|
|
176
184
|
value: this.getComponentInfo({
|
|
177
185
|
row: this.itemOptions[0],
|
|
178
|
-
value: 'company_item_number'
|
|
179
|
-
})
|
|
186
|
+
value: 'company_item_number',
|
|
187
|
+
}),
|
|
180
188
|
},
|
|
181
189
|
{
|
|
182
190
|
value: this.getComponentInfo({
|
|
183
191
|
row: this.itemOptions[0],
|
|
184
|
-
value: 'model'
|
|
185
|
-
})
|
|
186
|
-
}
|
|
192
|
+
value: 'model',
|
|
193
|
+
}),
|
|
194
|
+
},
|
|
187
195
|
]
|
|
188
196
|
return items
|
|
189
197
|
},
|
|
@@ -197,8 +205,8 @@ export default {
|
|
|
197
205
|
item = '-'
|
|
198
206
|
}
|
|
199
207
|
return item
|
|
200
|
-
}
|
|
201
|
-
}
|
|
208
|
+
},
|
|
209
|
+
},
|
|
202
210
|
}
|
|
203
211
|
</script>
|
|
204
212
|
|
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
|
|
@@ -68,12 +68,12 @@
|
|
|
68
68
|
// :minNumber="0"
|
|
69
69
|
// fontColor="blue"
|
|
70
70
|
// />
|
|
71
|
-
import styled from
|
|
71
|
+
import styled from 'vue-styled-components'
|
|
72
72
|
import {
|
|
73
73
|
stringToNumber,
|
|
74
|
-
numberToString
|
|
75
|
-
} from
|
|
76
|
-
import InfoText from
|
|
74
|
+
numberToString
|
|
75
|
+
} from '../../../helpers/numberConverter'
|
|
76
|
+
import InfoText from '../../infoText'
|
|
77
77
|
|
|
78
78
|
const Container = styled.div`
|
|
79
79
|
width: 100%;
|
|
@@ -89,31 +89,31 @@ const inputProps = {
|
|
|
89
89
|
noBorder: Boolean,
|
|
90
90
|
textAlign: String,
|
|
91
91
|
fontSize: String,
|
|
92
|
-
fontColor: String
|
|
92
|
+
fontColor: String
|
|
93
93
|
}
|
|
94
|
-
const InputContainer = styled(
|
|
94
|
+
const InputContainer = styled('input', inputProps)`
|
|
95
95
|
border: ${(props) =>
|
|
96
96
|
props.isError
|
|
97
|
-
?
|
|
97
|
+
? '1px solid ' + props.theme.colors.red
|
|
98
98
|
: props.noBorder
|
|
99
|
-
?
|
|
100
|
-
:
|
|
99
|
+
? 'none'
|
|
100
|
+
: '1px solid ' + props.theme.colors.mediumGray};
|
|
101
101
|
padding: ${(props) =>
|
|
102
|
-
props.hasUnit ?
|
|
102
|
+
props.hasUnit ? '11px 40px 11px 10px' : '11px 5px 11px 10px'};
|
|
103
103
|
border-radius: 4px;
|
|
104
104
|
text-align: ${(props) => props.textAlign};
|
|
105
|
-
cursor: ${(props) => (props.isDisabled ?
|
|
106
|
-
font-size: ${(props) => (props.fontSize ? props.fontSize :
|
|
105
|
+
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
|
|
106
|
+
font-size: ${(props) => (props.fontSize ? props.fontSize : '13px')};
|
|
107
107
|
color: ${(props) =>
|
|
108
108
|
props.isError
|
|
109
109
|
? props.theme.colors.red
|
|
110
110
|
: props.fontColor
|
|
111
|
-
? props.fontColor +
|
|
111
|
+
? props.fontColor + ' !important'
|
|
112
112
|
: props.theme.colors.black};
|
|
113
|
-
width: ${(props) => (props.inputWidth ? props.inputWidth :
|
|
114
|
-
min-width: ${(props) => (props.minWidth ? props.minWidth :
|
|
113
|
+
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
|
114
|
+
min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
|
|
115
115
|
background-color: ${(props) =>
|
|
116
|
-
props.isDisabled ? props.theme.colors.grey5 :
|
|
116
|
+
props.isDisabled ? props.theme.colors.grey5 : '#fff'};
|
|
117
117
|
box-sizing: border-box;
|
|
118
118
|
|
|
119
119
|
&::placeholder {
|
|
@@ -130,7 +130,7 @@ const InputWrapper = styled.span`
|
|
|
130
130
|
position: relative;
|
|
131
131
|
`
|
|
132
132
|
|
|
133
|
-
const UnitContainer = styled(
|
|
133
|
+
const UnitContainer = styled('span', inputProps)`
|
|
134
134
|
border-left: 1px solid
|
|
135
135
|
${(props) =>
|
|
136
136
|
props.isError
|
|
@@ -169,7 +169,7 @@ const LabelText = styled.div`
|
|
|
169
169
|
`
|
|
170
170
|
|
|
171
171
|
export default {
|
|
172
|
-
name:
|
|
172
|
+
name: 'input-number',
|
|
173
173
|
components: {
|
|
174
174
|
Container,
|
|
175
175
|
InputContainer,
|
|
@@ -178,132 +178,134 @@ export default {
|
|
|
178
178
|
ErrorMessage,
|
|
179
179
|
LabelWrapper,
|
|
180
180
|
LabelText,
|
|
181
|
-
InfoText
|
|
181
|
+
InfoText
|
|
182
182
|
},
|
|
183
183
|
data() {
|
|
184
184
|
return {
|
|
185
|
-
textInput:
|
|
186
|
-
isFocused: false
|
|
185
|
+
textInput: '',
|
|
186
|
+
isFocused: false
|
|
187
187
|
}
|
|
188
188
|
},
|
|
189
189
|
props: {
|
|
190
190
|
placeholder: {
|
|
191
191
|
required: false,
|
|
192
|
-
default:
|
|
192
|
+
default: ''
|
|
193
193
|
},
|
|
194
194
|
isError: {
|
|
195
195
|
required: false,
|
|
196
|
-
default: false
|
|
196
|
+
default: false
|
|
197
197
|
},
|
|
198
198
|
inputWidth: {
|
|
199
199
|
required: false,
|
|
200
|
-
default: null
|
|
200
|
+
default: null
|
|
201
201
|
},
|
|
202
202
|
minWidth: {
|
|
203
203
|
required: false,
|
|
204
|
-
default: null
|
|
204
|
+
default: null
|
|
205
205
|
},
|
|
206
206
|
value: {
|
|
207
207
|
required: true,
|
|
208
|
-
default: null
|
|
208
|
+
default: null
|
|
209
209
|
},
|
|
210
210
|
clearInput: {
|
|
211
211
|
required: false,
|
|
212
|
-
default: false
|
|
212
|
+
default: false
|
|
213
213
|
},
|
|
214
214
|
errorMessage: {
|
|
215
215
|
required: false,
|
|
216
|
-
default:
|
|
216
|
+
default: 'Please insert a correct number'
|
|
217
217
|
},
|
|
218
218
|
numberPrecision: {
|
|
219
219
|
required: false,
|
|
220
|
-
default: 0
|
|
220
|
+
default: 0
|
|
221
221
|
},
|
|
222
222
|
unitName: {
|
|
223
223
|
required: false,
|
|
224
|
-
default:
|
|
224
|
+
default: ''
|
|
225
225
|
},
|
|
226
226
|
showLinearUnitName: {
|
|
227
227
|
required: false,
|
|
228
|
-
default: false
|
|
228
|
+
default: false
|
|
229
229
|
},
|
|
230
230
|
disabled: {
|
|
231
231
|
required: false,
|
|
232
|
-
default: false
|
|
232
|
+
default: false
|
|
233
233
|
},
|
|
234
234
|
noBorder: {
|
|
235
235
|
required: false,
|
|
236
|
-
default: false
|
|
236
|
+
default: false
|
|
237
237
|
},
|
|
238
238
|
textAlign: {
|
|
239
239
|
required: false,
|
|
240
|
-
default:
|
|
240
|
+
default: 'left'
|
|
241
241
|
},
|
|
242
242
|
fontSize: {
|
|
243
243
|
required: false,
|
|
244
|
-
default:
|
|
244
|
+
default: '13px'
|
|
245
245
|
},
|
|
246
246
|
labelText: {
|
|
247
247
|
required: false,
|
|
248
|
-
default: null
|
|
248
|
+
default: null
|
|
249
249
|
},
|
|
250
250
|
labelInfoText: {
|
|
251
251
|
required: false,
|
|
252
|
-
default: null
|
|
252
|
+
default: null
|
|
253
253
|
},
|
|
254
254
|
labelInfoAlign: {
|
|
255
255
|
required: false,
|
|
256
|
-
default:
|
|
256
|
+
default: 'right'
|
|
257
257
|
},
|
|
258
258
|
minNumber: {
|
|
259
259
|
required: false,
|
|
260
|
-
default: null
|
|
260
|
+
default: null
|
|
261
261
|
},
|
|
262
262
|
fontColor: {
|
|
263
263
|
required: false,
|
|
264
|
-
default: null
|
|
264
|
+
default: null
|
|
265
265
|
},
|
|
266
266
|
numberToStringEnabled: {
|
|
267
267
|
required: false,
|
|
268
|
-
default: true
|
|
269
|
-
}
|
|
268
|
+
default: true
|
|
269
|
+
}
|
|
270
270
|
},
|
|
271
271
|
methods: {
|
|
272
272
|
onChangeHandler(event) {
|
|
273
273
|
if (isNaN(event)) {
|
|
274
274
|
event = this.minNumber || this.minNumber === 0 ? this.minNumber : event
|
|
275
275
|
}
|
|
276
|
-
this.$emit(
|
|
276
|
+
this.$emit('input-change', event)
|
|
277
277
|
},
|
|
278
278
|
onEvaluateCode(val) {
|
|
279
279
|
// function to perform math on the code
|
|
280
280
|
// filter the string in case of any malicious content
|
|
281
|
-
let filtered = val.replace(/[^-()\d/*+.,]/g,
|
|
281
|
+
let filtered = val.replace(/[^-()\d/*+.,]/g, '')
|
|
282
282
|
filtered = filtered.split(/([-+*/()])/)
|
|
283
283
|
let formatted = filtered.map((item) => {
|
|
284
284
|
if (
|
|
285
|
-
item ===
|
|
286
|
-
item ===
|
|
287
|
-
item ===
|
|
288
|
-
item ===
|
|
289
|
-
item ===
|
|
290
|
-
item ===
|
|
291
|
-
item ===
|
|
285
|
+
item === '+' ||
|
|
286
|
+
item === '-' ||
|
|
287
|
+
item === '*' ||
|
|
288
|
+
item === '/' ||
|
|
289
|
+
item === '(' ||
|
|
290
|
+
item === ')' ||
|
|
291
|
+
item === ''
|
|
292
292
|
) {
|
|
293
293
|
return item
|
|
294
294
|
} else {
|
|
295
295
|
let num = stringToNumber({
|
|
296
296
|
value: item,
|
|
297
|
-
numberPrecision: false
|
|
297
|
+
numberPrecision: false
|
|
298
298
|
})
|
|
299
299
|
return num
|
|
300
300
|
}
|
|
301
301
|
})
|
|
302
|
-
let evaluated = eval(formatted.join(
|
|
303
|
-
evaluated
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
302
|
+
let evaluated = eval(formatted.join(''))
|
|
303
|
+
if (typeof evaluated === 'string') {
|
|
304
|
+
evaluated = stringToNumber({
|
|
305
|
+
value: evaluated,
|
|
306
|
+
numberPrecision: this.numberPrecision
|
|
307
|
+
})
|
|
308
|
+
}
|
|
307
309
|
return evaluated
|
|
308
310
|
},
|
|
309
311
|
onInputBlur(e) {
|
|
@@ -315,7 +317,7 @@ export default {
|
|
|
315
317
|
this.textInput = numberToString({
|
|
316
318
|
value:
|
|
317
319
|
evaluatedInput && value.length ? evaluatedInput : this.minNumber,
|
|
318
|
-
numberPrecision: this.numberPrecision
|
|
320
|
+
numberPrecision: this.numberPrecision
|
|
319
321
|
})
|
|
320
322
|
}
|
|
321
323
|
let adjustedMinValue =
|
|
@@ -323,8 +325,8 @@ export default {
|
|
|
323
325
|
? value
|
|
324
326
|
: this.minNumber || this.minNumber === 0
|
|
325
327
|
? this.minNumber
|
|
326
|
-
:
|
|
327
|
-
this.$emit(
|
|
328
|
+
: ''
|
|
329
|
+
this.$emit('input-blur', adjustedMinValue)
|
|
328
330
|
},
|
|
329
331
|
focusInput() {
|
|
330
332
|
if (this.disabled) {
|
|
@@ -341,38 +343,38 @@ export default {
|
|
|
341
343
|
? value
|
|
342
344
|
: this.minNumber || this.minNumber === 0
|
|
343
345
|
? this.minNumber
|
|
344
|
-
:
|
|
346
|
+
: ''
|
|
345
347
|
if ((adjustedMinValue || adjustedMinValue === 0) && !this.isFocused) {
|
|
346
348
|
let input = this.numberToStringEnabled
|
|
347
349
|
? numberToString({
|
|
348
350
|
value: adjustedMinValue,
|
|
349
|
-
numberPrecision: this.numberPrecision
|
|
351
|
+
numberPrecision: this.numberPrecision
|
|
350
352
|
})
|
|
351
353
|
: adjustedMinValue
|
|
352
|
-
let unit = this.showLinearUnitName ?
|
|
353
|
-
return input +
|
|
354
|
+
let unit = this.showLinearUnitName ? '' : this.unitName
|
|
355
|
+
return input + ' ' + unit
|
|
354
356
|
} else if (!adjustedMinValue && adjustedMinValue !== 0) {
|
|
355
|
-
return
|
|
357
|
+
return ''
|
|
356
358
|
} else {
|
|
357
359
|
return this.numberToStringEnabled
|
|
358
360
|
? numberToString({
|
|
359
361
|
value: adjustedMinValue,
|
|
360
|
-
numberPrecision: this.numberPrecision
|
|
362
|
+
numberPrecision: this.numberPrecision
|
|
361
363
|
})
|
|
362
364
|
: adjustedMinValue
|
|
363
365
|
}
|
|
364
|
-
}
|
|
366
|
+
}
|
|
365
367
|
},
|
|
366
368
|
created() {
|
|
367
369
|
if (this.value) {
|
|
368
370
|
this.textInput = numberToString({
|
|
369
371
|
value: this.value,
|
|
370
|
-
numberPrecision: this.numberPrecision
|
|
372
|
+
numberPrecision: this.numberPrecision
|
|
371
373
|
})
|
|
372
374
|
} else if (this.minNumber !== null) {
|
|
373
375
|
this.textInput = numberToString({
|
|
374
376
|
value: this.minNumber,
|
|
375
|
-
numberPrecision: this.numberPrecision
|
|
377
|
+
numberPrecision: this.numberPrecision
|
|
376
378
|
})
|
|
377
379
|
}
|
|
378
380
|
},
|
|
@@ -380,9 +382,9 @@ export default {
|
|
|
380
382
|
clearInput: function (value) {
|
|
381
383
|
if (value) {
|
|
382
384
|
// If the value is typed, then we should clear the textInput on Continue
|
|
383
|
-
this.textInput =
|
|
385
|
+
this.textInput = ''
|
|
384
386
|
}
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
387
389
|
}
|
|
388
390
|
</script>
|
|
@@ -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>
|
|
@@ -9,12 +9,16 @@ export const stringToNumber = ({
|
|
|
9
9
|
// The first replace will replace not allowed characters with a blank
|
|
10
10
|
if (
|
|
11
11
|
selectedLang === 'de-DE' ||
|
|
12
|
+
selectedLang === 'de-de' ||
|
|
12
13
|
selectedLang === 'no-no' ||
|
|
13
14
|
selectedLang === 'da-dk' ||
|
|
14
15
|
selectedLang === 'de-lu' ||
|
|
15
16
|
selectedLang === 'de-be' ||
|
|
16
17
|
selectedLang === 'es-es' ||
|
|
17
|
-
selectedLang === 'de'
|
|
18
|
+
selectedLang === 'de' ||
|
|
19
|
+
selectedLang === 'it' ||
|
|
20
|
+
selectedLang === 'nl-nl' ||
|
|
21
|
+
selectedLang === 'nl-be'
|
|
18
22
|
) {
|
|
19
23
|
// replace dots with blank, and commas with a dot: 1.234,56 --> 1234.56
|
|
20
24
|
if (allowNegative) {
|
|
@@ -42,9 +46,15 @@ export const stringToNumber = ({
|
|
|
42
46
|
) {
|
|
43
47
|
// replace ' with blank: 1'234.56 --> 1234.56
|
|
44
48
|
if (allowNegative) {
|
|
45
|
-
newVal = newVal
|
|
49
|
+
newVal = newVal
|
|
50
|
+
.replace(/[^\d-.,']/g, '')
|
|
51
|
+
.replace(/[,\s]/, '')
|
|
52
|
+
.replace(/['\s]/g, '')
|
|
46
53
|
} else {
|
|
47
|
-
newVal = newVal
|
|
54
|
+
newVal = newVal
|
|
55
|
+
.replace(/[^\d.,']/g, '')
|
|
56
|
+
.replace(/[,\s]/, '')
|
|
57
|
+
.replace(/['\s]/g, '')
|
|
48
58
|
}
|
|
49
59
|
} else if (
|
|
50
60
|
selectedLang === 'fr-fr' ||
|