@eturnity/eturnity_reusable_components 1.2.2-EPDM-5155.2 → 1.2.2-EPDM-4371.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 +50 -46
- package/src/assets/icons/error_icon copy.png +0 -0
- package/src/components/errorMessage/index.vue +93 -0
- package/src/components/inputs/inputNumber/index.vue +108 -74
- package/src/components/modals/modal/index.vue +6 -22
- package/src/components/modals/modal/modal.stories.js +1 -2
- package/src/components/spinner/index.vue +13 -20
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
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
|
-
|
|
16
|
-
<tr>
|
|
17
|
-
<!-- <table-dropdown
|
|
4
|
+
<main-table titleText="My Table">
|
|
5
|
+
<thead>
|
|
6
|
+
<tr>
|
|
7
|
+
<th>Column 1</th>
|
|
8
|
+
<th>Column 2</th>
|
|
9
|
+
<th>Column 3</th>
|
|
10
|
+
<div />
|
|
11
|
+
</tr>
|
|
12
|
+
</thead>
|
|
13
|
+
<tbody>
|
|
14
|
+
<tr>
|
|
15
|
+
<!-- <table-dropdown
|
|
18
16
|
:colSpan="3"
|
|
19
17
|
:tableItems="getDropdownValues()"
|
|
20
18
|
@toggle-dropdown-open="toggleDropdownOpen()"
|
|
@@ -23,14 +21,21 @@
|
|
|
23
21
|
:optionItems="itemOptions"
|
|
24
22
|
:optionsDisplay="['display_name', 'company_item_number', 'model']"
|
|
25
23
|
/> -->
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
<td>Test</td>
|
|
25
|
+
<div class="icons-container">
|
|
26
|
+
<three-dots :options="listOptions" :isLoading="false" />
|
|
27
|
+
</div>
|
|
28
|
+
</tr>
|
|
29
|
+
</tbody>
|
|
30
|
+
</main-table>
|
|
31
|
+
<br />
|
|
32
|
+
<input-number :isError="false" errorMessage="Test " />
|
|
33
|
+
<input-number :isError="false" errorMessage="Test " />
|
|
34
|
+
<input-number :isError="false" errorMessage="Test " />
|
|
35
|
+
<input-number :isError="false" errorMessage="Test " />
|
|
36
|
+
<input-number :isError="true" errorMessage="Test " />
|
|
37
|
+
<input-number :isError="true" errorMessage="Test " />
|
|
38
|
+
<input-number :isError="true" errorMessage="Test " />
|
|
34
39
|
<br />
|
|
35
40
|
<toggle
|
|
36
41
|
@on-toggle-change="onInputChange($event)"
|
|
@@ -74,7 +79,6 @@ import Checkbox from '@/components/inputs/checkbox'
|
|
|
74
79
|
import PageSubtitle from '@/components/pageSubtitle'
|
|
75
80
|
import Spinner from '@/components/spinner'
|
|
76
81
|
import ExternalButton from '@/components/buttons/externalButton'
|
|
77
|
-
import Modal from '@/components/modals/modal'
|
|
78
82
|
// import TableDropdown from "@/components/tableDropdown"
|
|
79
83
|
|
|
80
84
|
const PageContainer = styled.div`
|
|
@@ -93,8 +97,8 @@ export default {
|
|
|
93
97
|
PageSubtitle,
|
|
94
98
|
Spinner,
|
|
95
99
|
Checkbox,
|
|
96
|
-
ExternalButton
|
|
97
|
-
|
|
100
|
+
ExternalButton
|
|
101
|
+
// TableDropdown,
|
|
98
102
|
},
|
|
99
103
|
data() {
|
|
100
104
|
return {
|
|
@@ -104,7 +108,7 @@ export default {
|
|
|
104
108
|
number_format_precision: 4,
|
|
105
109
|
number_min_allowed: 0,
|
|
106
110
|
number_max_allowed: 10,
|
|
107
|
-
unit_short_name: 'cm'
|
|
111
|
+
unit_short_name: 'cm'
|
|
108
112
|
},
|
|
109
113
|
dropdownOpen: false,
|
|
110
114
|
isChecked: false,
|
|
@@ -112,47 +116,47 @@ export default {
|
|
|
112
116
|
{
|
|
113
117
|
name: 'Option 1',
|
|
114
118
|
value: 'option_1',
|
|
115
|
-
disabled: true
|
|
119
|
+
disabled: true
|
|
116
120
|
},
|
|
117
121
|
{
|
|
118
122
|
name: 'Option 2',
|
|
119
|
-
value: 'option_2'
|
|
123
|
+
value: 'option_2'
|
|
120
124
|
},
|
|
121
125
|
{
|
|
122
126
|
name: 'Option 3',
|
|
123
|
-
value: 'option_3'
|
|
127
|
+
value: 'option_3'
|
|
124
128
|
},
|
|
125
129
|
{
|
|
126
130
|
name: 'Option 4',
|
|
127
|
-
value: 'option_4'
|
|
128
|
-
}
|
|
131
|
+
value: 'option_4'
|
|
132
|
+
}
|
|
129
133
|
],
|
|
130
134
|
itemOptions: [
|
|
131
135
|
{
|
|
132
136
|
display_name: 'Test 1',
|
|
133
137
|
company_item_number: '123',
|
|
134
138
|
model: 'BTB-2145 Long Text Long Text Long Text Long Text Long Text',
|
|
135
|
-
id: 1
|
|
139
|
+
id: 1
|
|
136
140
|
},
|
|
137
141
|
{
|
|
138
142
|
display_name: 'Test 2',
|
|
139
143
|
company_item_number: '1234',
|
|
140
144
|
model: 'BTB-123',
|
|
141
|
-
id: 2
|
|
145
|
+
id: 2
|
|
142
146
|
},
|
|
143
147
|
{
|
|
144
148
|
display_name: 'Test 3',
|
|
145
149
|
company_item_number: '12345',
|
|
146
150
|
model: 'BTB-543',
|
|
147
|
-
id: 3
|
|
151
|
+
id: 3
|
|
148
152
|
},
|
|
149
153
|
{
|
|
150
154
|
display_name: 'Test 4',
|
|
151
155
|
company_item_number: '123456',
|
|
152
156
|
model: 'BTB-4930',
|
|
153
|
-
id: 4
|
|
154
|
-
}
|
|
155
|
-
]
|
|
157
|
+
id: 4
|
|
158
|
+
}
|
|
159
|
+
]
|
|
156
160
|
}
|
|
157
161
|
},
|
|
158
162
|
methods: {
|
|
@@ -177,21 +181,21 @@ export default {
|
|
|
177
181
|
{
|
|
178
182
|
value: this.getComponentInfo({
|
|
179
183
|
row: this.itemOptions[0],
|
|
180
|
-
value: 'display_name'
|
|
181
|
-
})
|
|
184
|
+
value: 'display_name'
|
|
185
|
+
})
|
|
182
186
|
},
|
|
183
187
|
{
|
|
184
188
|
value: this.getComponentInfo({
|
|
185
189
|
row: this.itemOptions[0],
|
|
186
|
-
value: 'company_item_number'
|
|
187
|
-
})
|
|
190
|
+
value: 'company_item_number'
|
|
191
|
+
})
|
|
188
192
|
},
|
|
189
193
|
{
|
|
190
194
|
value: this.getComponentInfo({
|
|
191
195
|
row: this.itemOptions[0],
|
|
192
|
-
value: 'model'
|
|
193
|
-
})
|
|
194
|
-
}
|
|
196
|
+
value: 'model'
|
|
197
|
+
})
|
|
198
|
+
}
|
|
195
199
|
]
|
|
196
200
|
return items
|
|
197
201
|
},
|
|
@@ -205,8 +209,8 @@ export default {
|
|
|
205
209
|
item = '-'
|
|
206
210
|
}
|
|
207
211
|
return item
|
|
208
|
-
}
|
|
209
|
-
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
210
214
|
}
|
|
211
215
|
</script>
|
|
212
216
|
|
|
Binary file
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component-wrapper>
|
|
3
|
+
<text-overlay v-if="showInfo" :alignText="alignText">
|
|
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 textAttrs = { alignText: String }
|
|
19
|
+
const TextOverlay = styled('div', textAttrs)`
|
|
20
|
+
position: absolute;
|
|
21
|
+
top: calc(100% + 13px);
|
|
22
|
+
background: ${(props) => props.theme.colors.red};
|
|
23
|
+
padding: 10px;
|
|
24
|
+
width: max-content;
|
|
25
|
+
max-width: 100%;
|
|
26
|
+
min-width: 200px;
|
|
27
|
+
font-size: 11px;
|
|
28
|
+
font-weight: 400;
|
|
29
|
+
border-radius: 4px;
|
|
30
|
+
font-family: 'Lato-Bold', Arial;
|
|
31
|
+
z-index: 99;
|
|
32
|
+
color: ${(props) => props.theme.colors.white};
|
|
33
|
+
|
|
34
|
+
:before {
|
|
35
|
+
content: '';
|
|
36
|
+
background-color: ${(props) => props.theme.colors.red};
|
|
37
|
+
position: absolute;
|
|
38
|
+
top: 2px;
|
|
39
|
+
left: 40px;
|
|
40
|
+
height: 11px;
|
|
41
|
+
width: 11px;
|
|
42
|
+
transform-origin: center center;
|
|
43
|
+
transform: translate(-2em, -0.5em) rotate(45deg);
|
|
44
|
+
}
|
|
45
|
+
`
|
|
46
|
+
|
|
47
|
+
const ComponentWrapper = styled.div`
|
|
48
|
+
display: block;
|
|
49
|
+
`
|
|
50
|
+
|
|
51
|
+
export default {
|
|
52
|
+
name: 'info-text',
|
|
53
|
+
components: {
|
|
54
|
+
TextOverlay,
|
|
55
|
+
ComponentWrapper
|
|
56
|
+
},
|
|
57
|
+
props: {
|
|
58
|
+
text: {
|
|
59
|
+
required: true
|
|
60
|
+
},
|
|
61
|
+
size: {
|
|
62
|
+
required: false,
|
|
63
|
+
default: '20'
|
|
64
|
+
},
|
|
65
|
+
alignText: {
|
|
66
|
+
required: false,
|
|
67
|
+
default: 'left' // "left" or "right"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
methods: {
|
|
71
|
+
toggleShowInfo() {
|
|
72
|
+
this.showInfo = !this.showInfo
|
|
73
|
+
|
|
74
|
+
if (this.showInfo) {
|
|
75
|
+
document.addEventListener('click', this.clickOutside)
|
|
76
|
+
} else {
|
|
77
|
+
document.removeEventListener('click', this.clickOutside)
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
clickOutside(event) {
|
|
81
|
+
if (this.$el.contains(event.target)) {
|
|
82
|
+
return
|
|
83
|
+
}
|
|
84
|
+
this.toggleShowInfo()
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
data() {
|
|
88
|
+
return {
|
|
89
|
+
showInfo: true
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
</script>
|
|
@@ -37,6 +37,11 @@
|
|
|
37
37
|
:isError="isError"
|
|
38
38
|
>{{ unitName }}</unit-container
|
|
39
39
|
>
|
|
40
|
+
<icon
|
|
41
|
+
v-if="(isError || inputIcon) && !showLinearUnitName"
|
|
42
|
+
:class="inputIconImageClass"
|
|
43
|
+
:src="isError ? warningIcon : inputIconImage"
|
|
44
|
+
/>
|
|
40
45
|
</input-wrapper>
|
|
41
46
|
<error-message v-if="isError">{{ errorMessage }}</error-message>
|
|
42
47
|
</container>
|
|
@@ -68,13 +73,14 @@
|
|
|
68
73
|
// :minNumber="0"
|
|
69
74
|
// fontColor="blue"
|
|
70
75
|
// />
|
|
71
|
-
import styled from
|
|
76
|
+
import styled from 'vue-styled-components'
|
|
72
77
|
import {
|
|
73
78
|
stringToNumber,
|
|
74
|
-
numberToString
|
|
75
|
-
} from
|
|
76
|
-
import InfoText from
|
|
77
|
-
|
|
79
|
+
numberToString
|
|
80
|
+
} from '../../../helpers/numberConverter'
|
|
81
|
+
import InfoText from '../../infoText'
|
|
82
|
+
import ErrorMessage from '../../errorMessage'
|
|
83
|
+
import warningIcon from '../../../assets/icons/error_icon.png'
|
|
78
84
|
const Container = styled.div`
|
|
79
85
|
width: 100%;
|
|
80
86
|
position: relative;
|
|
@@ -89,31 +95,31 @@ const inputProps = {
|
|
|
89
95
|
noBorder: Boolean,
|
|
90
96
|
textAlign: String,
|
|
91
97
|
fontSize: String,
|
|
92
|
-
fontColor: String
|
|
98
|
+
fontColor: String
|
|
93
99
|
}
|
|
94
|
-
const InputContainer = styled(
|
|
100
|
+
const InputContainer = styled('input', inputProps)`
|
|
95
101
|
border: ${(props) =>
|
|
96
102
|
props.isError
|
|
97
|
-
?
|
|
103
|
+
? '1px solid ' + props.theme.colors.red
|
|
98
104
|
: props.noBorder
|
|
99
|
-
?
|
|
100
|
-
:
|
|
105
|
+
? 'none'
|
|
106
|
+
: '1px solid ' + props.theme.colors.mediumGray};
|
|
101
107
|
padding: ${(props) =>
|
|
102
|
-
props.hasUnit ?
|
|
108
|
+
props.hasUnit ? '11px 40px 11px 10px' : '11px 5px 11px 10px'};
|
|
103
109
|
border-radius: 4px;
|
|
104
110
|
text-align: ${(props) => props.textAlign};
|
|
105
|
-
cursor: ${(props) => (props.isDisabled ?
|
|
106
|
-
font-size: ${(props) => (props.fontSize ? props.fontSize :
|
|
111
|
+
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
|
|
112
|
+
font-size: ${(props) => (props.fontSize ? props.fontSize : '13px')};
|
|
107
113
|
color: ${(props) =>
|
|
108
114
|
props.isError
|
|
109
115
|
? props.theme.colors.red
|
|
110
116
|
: props.fontColor
|
|
111
|
-
? props.fontColor +
|
|
117
|
+
? props.fontColor + ' !important'
|
|
112
118
|
: props.theme.colors.black};
|
|
113
|
-
width: ${(props) => (props.inputWidth ? props.inputWidth :
|
|
114
|
-
min-width: ${(props) => (props.minWidth ? props.minWidth :
|
|
119
|
+
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
|
120
|
+
min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
|
|
115
121
|
background-color: ${(props) =>
|
|
116
|
-
props.isDisabled ? props.theme.colors.grey5 :
|
|
122
|
+
props.isDisabled ? props.theme.colors.grey5 : '#fff'};
|
|
117
123
|
box-sizing: border-box;
|
|
118
124
|
|
|
119
125
|
&::placeholder {
|
|
@@ -125,12 +131,21 @@ const InputContainer = styled("input", inputProps)`
|
|
|
125
131
|
outline: none;
|
|
126
132
|
}
|
|
127
133
|
`
|
|
134
|
+
const IconProps = {
|
|
135
|
+
inputIconHeight: String
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const Icon = styled('img', IconProps)`
|
|
139
|
+
position: absolute;
|
|
140
|
+
right: 10px;
|
|
141
|
+
top: 2px;
|
|
142
|
+
`
|
|
128
143
|
|
|
129
144
|
const InputWrapper = styled.span`
|
|
130
145
|
position: relative;
|
|
131
146
|
`
|
|
132
147
|
|
|
133
|
-
const UnitContainer = styled(
|
|
148
|
+
const UnitContainer = styled('span', inputProps)`
|
|
134
149
|
border-left: 1px solid
|
|
135
150
|
${(props) =>
|
|
136
151
|
props.isError
|
|
@@ -150,12 +165,14 @@ const UnitContainer = styled("span", inputProps)`
|
|
|
150
165
|
: props.theme.colors.mediumGray};
|
|
151
166
|
`
|
|
152
167
|
|
|
153
|
-
const ErrorMessage = styled.div`
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
168
|
+
// const ErrorMessage = styled.div`
|
|
169
|
+
// margin-top: 5px;
|
|
170
|
+
// line-height: 1;
|
|
171
|
+
// text-transform: none;
|
|
172
|
+
// font-size: 10px;
|
|
173
|
+
// color: ${(props) => props.theme.colors.red};
|
|
174
|
+
// position: absolute;
|
|
175
|
+
// `
|
|
159
176
|
|
|
160
177
|
const LabelWrapper = styled.div`
|
|
161
178
|
display: flex;
|
|
@@ -169,7 +186,7 @@ const LabelText = styled.div`
|
|
|
169
186
|
`
|
|
170
187
|
|
|
171
188
|
export default {
|
|
172
|
-
name:
|
|
189
|
+
name: 'input-number',
|
|
173
190
|
components: {
|
|
174
191
|
Container,
|
|
175
192
|
InputContainer,
|
|
@@ -179,130 +196,147 @@ export default {
|
|
|
179
196
|
LabelWrapper,
|
|
180
197
|
LabelText,
|
|
181
198
|
InfoText,
|
|
199
|
+
Icon
|
|
182
200
|
},
|
|
183
201
|
data() {
|
|
184
202
|
return {
|
|
185
|
-
textInput:
|
|
203
|
+
textInput: '',
|
|
186
204
|
isFocused: false,
|
|
205
|
+
warningIcon: warningIcon
|
|
187
206
|
}
|
|
188
207
|
},
|
|
189
208
|
props: {
|
|
190
209
|
placeholder: {
|
|
191
210
|
required: false,
|
|
192
|
-
default:
|
|
211
|
+
default: ''
|
|
193
212
|
},
|
|
194
213
|
isError: {
|
|
195
214
|
required: false,
|
|
196
|
-
default: false
|
|
215
|
+
default: false
|
|
197
216
|
},
|
|
198
217
|
inputWidth: {
|
|
199
218
|
required: false,
|
|
200
|
-
default: null
|
|
219
|
+
default: null
|
|
201
220
|
},
|
|
202
221
|
minWidth: {
|
|
203
222
|
required: false,
|
|
204
|
-
default: null
|
|
223
|
+
default: null
|
|
205
224
|
},
|
|
206
225
|
value: {
|
|
207
226
|
required: true,
|
|
208
|
-
default: null
|
|
227
|
+
default: null
|
|
209
228
|
},
|
|
210
229
|
clearInput: {
|
|
211
230
|
required: false,
|
|
212
|
-
default: false
|
|
231
|
+
default: false
|
|
213
232
|
},
|
|
214
233
|
errorMessage: {
|
|
215
234
|
required: false,
|
|
216
|
-
default:
|
|
235
|
+
default: 'Please insert a correct number'
|
|
217
236
|
},
|
|
218
237
|
numberPrecision: {
|
|
219
238
|
required: false,
|
|
220
|
-
default: 0
|
|
239
|
+
default: 0
|
|
221
240
|
},
|
|
222
241
|
unitName: {
|
|
223
242
|
required: false,
|
|
224
|
-
default:
|
|
243
|
+
default: ''
|
|
225
244
|
},
|
|
226
245
|
showLinearUnitName: {
|
|
227
246
|
required: false,
|
|
228
|
-
default: false
|
|
247
|
+
default: false
|
|
229
248
|
},
|
|
230
249
|
disabled: {
|
|
231
250
|
required: false,
|
|
232
|
-
default: false
|
|
251
|
+
default: false
|
|
233
252
|
},
|
|
234
253
|
noBorder: {
|
|
235
254
|
required: false,
|
|
236
|
-
default: false
|
|
255
|
+
default: false
|
|
237
256
|
},
|
|
238
257
|
textAlign: {
|
|
239
258
|
required: false,
|
|
240
|
-
default:
|
|
259
|
+
default: 'left'
|
|
241
260
|
},
|
|
242
261
|
fontSize: {
|
|
243
262
|
required: false,
|
|
244
|
-
default:
|
|
263
|
+
default: '13px'
|
|
245
264
|
},
|
|
246
265
|
labelText: {
|
|
247
266
|
required: false,
|
|
248
|
-
default: null
|
|
267
|
+
default: null
|
|
249
268
|
},
|
|
250
269
|
labelInfoText: {
|
|
251
270
|
required: false,
|
|
252
|
-
default: null
|
|
271
|
+
default: null
|
|
253
272
|
},
|
|
254
273
|
labelInfoAlign: {
|
|
255
274
|
required: false,
|
|
256
|
-
default:
|
|
275
|
+
default: 'right'
|
|
257
276
|
},
|
|
258
277
|
minNumber: {
|
|
259
278
|
required: false,
|
|
260
|
-
default: null
|
|
279
|
+
default: null
|
|
261
280
|
},
|
|
262
281
|
fontColor: {
|
|
263
282
|
required: false,
|
|
264
|
-
default: null
|
|
283
|
+
default: null
|
|
265
284
|
},
|
|
266
285
|
numberToStringEnabled: {
|
|
267
286
|
required: false,
|
|
268
|
-
default: true
|
|
287
|
+
default: true
|
|
269
288
|
},
|
|
289
|
+
inputIcon: {
|
|
290
|
+
require: false,
|
|
291
|
+
type: Boolean,
|
|
292
|
+
default: false
|
|
293
|
+
},
|
|
294
|
+
inputIconImage: {
|
|
295
|
+
require: false,
|
|
296
|
+
type: String,
|
|
297
|
+
default: ''
|
|
298
|
+
},
|
|
299
|
+
inputIconImageClass: {
|
|
300
|
+
require: false,
|
|
301
|
+
type: Array,
|
|
302
|
+
default: () => []
|
|
303
|
+
}
|
|
270
304
|
},
|
|
271
305
|
methods: {
|
|
272
306
|
onChangeHandler(event) {
|
|
273
307
|
if (isNaN(event)) {
|
|
274
308
|
event = this.minNumber || this.minNumber === 0 ? this.minNumber : event
|
|
275
309
|
}
|
|
276
|
-
this.$emit(
|
|
310
|
+
this.$emit('input-change', event)
|
|
277
311
|
},
|
|
278
312
|
onEvaluateCode(val) {
|
|
279
313
|
// function to perform math on the code
|
|
280
314
|
// filter the string in case of any malicious content
|
|
281
|
-
let filtered = val.replace(/[^-()\d/*+.,]/g,
|
|
315
|
+
let filtered = val.replace(/[^-()\d/*+.,]/g, '')
|
|
282
316
|
filtered = filtered.split(/([-+*/()])/)
|
|
283
317
|
let formatted = filtered.map((item) => {
|
|
284
318
|
if (
|
|
285
|
-
item ===
|
|
286
|
-
item ===
|
|
287
|
-
item ===
|
|
288
|
-
item ===
|
|
289
|
-
item ===
|
|
290
|
-
item ===
|
|
291
|
-
item ===
|
|
319
|
+
item === '+' ||
|
|
320
|
+
item === '-' ||
|
|
321
|
+
item === '*' ||
|
|
322
|
+
item === '/' ||
|
|
323
|
+
item === '(' ||
|
|
324
|
+
item === ')' ||
|
|
325
|
+
item === ''
|
|
292
326
|
) {
|
|
293
327
|
return item
|
|
294
328
|
} else {
|
|
295
329
|
let num = stringToNumber({
|
|
296
330
|
value: item,
|
|
297
|
-
numberPrecision: false
|
|
331
|
+
numberPrecision: false
|
|
298
332
|
})
|
|
299
333
|
return num
|
|
300
334
|
}
|
|
301
335
|
})
|
|
302
|
-
let evaluated = eval(formatted.join(
|
|
336
|
+
let evaluated = eval(formatted.join(''))
|
|
303
337
|
evaluated = stringToNumber({
|
|
304
338
|
value: evaluated,
|
|
305
|
-
numberPrecision: this.numberPrecision
|
|
339
|
+
numberPrecision: this.numberPrecision
|
|
306
340
|
})
|
|
307
341
|
return evaluated
|
|
308
342
|
},
|
|
@@ -315,7 +349,7 @@ export default {
|
|
|
315
349
|
this.textInput = numberToString({
|
|
316
350
|
value:
|
|
317
351
|
evaluatedInput && value.length ? evaluatedInput : this.minNumber,
|
|
318
|
-
numberPrecision: this.numberPrecision
|
|
352
|
+
numberPrecision: this.numberPrecision
|
|
319
353
|
})
|
|
320
354
|
}
|
|
321
355
|
let adjustedMinValue =
|
|
@@ -323,8 +357,8 @@ export default {
|
|
|
323
357
|
? value
|
|
324
358
|
: this.minNumber || this.minNumber === 0
|
|
325
359
|
? this.minNumber
|
|
326
|
-
:
|
|
327
|
-
this.$emit(
|
|
360
|
+
: ''
|
|
361
|
+
this.$emit('input-blur', adjustedMinValue)
|
|
328
362
|
},
|
|
329
363
|
focusInput() {
|
|
330
364
|
if (this.disabled) {
|
|
@@ -341,38 +375,38 @@ export default {
|
|
|
341
375
|
? value
|
|
342
376
|
: this.minNumber || this.minNumber === 0
|
|
343
377
|
? this.minNumber
|
|
344
|
-
:
|
|
378
|
+
: ''
|
|
345
379
|
if ((adjustedMinValue || adjustedMinValue === 0) && !this.isFocused) {
|
|
346
380
|
let input = this.numberToStringEnabled
|
|
347
381
|
? numberToString({
|
|
348
382
|
value: adjustedMinValue,
|
|
349
|
-
numberPrecision: this.numberPrecision
|
|
383
|
+
numberPrecision: this.numberPrecision
|
|
350
384
|
})
|
|
351
385
|
: adjustedMinValue
|
|
352
|
-
let unit = this.showLinearUnitName ?
|
|
353
|
-
return input +
|
|
386
|
+
let unit = this.showLinearUnitName ? '' : this.unitName
|
|
387
|
+
return input + ' ' + unit
|
|
354
388
|
} else if (!adjustedMinValue && adjustedMinValue !== 0) {
|
|
355
|
-
return
|
|
389
|
+
return ''
|
|
356
390
|
} else {
|
|
357
391
|
return this.numberToStringEnabled
|
|
358
392
|
? numberToString({
|
|
359
393
|
value: adjustedMinValue,
|
|
360
|
-
numberPrecision: this.numberPrecision
|
|
394
|
+
numberPrecision: this.numberPrecision
|
|
361
395
|
})
|
|
362
396
|
: adjustedMinValue
|
|
363
397
|
}
|
|
364
|
-
}
|
|
398
|
+
}
|
|
365
399
|
},
|
|
366
400
|
created() {
|
|
367
401
|
if (this.value) {
|
|
368
402
|
this.textInput = numberToString({
|
|
369
403
|
value: this.value,
|
|
370
|
-
numberPrecision: this.numberPrecision
|
|
404
|
+
numberPrecision: this.numberPrecision
|
|
371
405
|
})
|
|
372
406
|
} else if (this.minNumber !== null) {
|
|
373
407
|
this.textInput = numberToString({
|
|
374
408
|
value: this.minNumber,
|
|
375
|
-
numberPrecision: this.numberPrecision
|
|
409
|
+
numberPrecision: this.numberPrecision
|
|
376
410
|
})
|
|
377
411
|
}
|
|
378
412
|
},
|
|
@@ -380,9 +414,9 @@ export default {
|
|
|
380
414
|
clearInput: function (value) {
|
|
381
415
|
if (value) {
|
|
382
416
|
// If the value is typed, then we should clear the textInput on Continue
|
|
383
|
-
this.textInput =
|
|
417
|
+
this.textInput = ''
|
|
384
418
|
}
|
|
385
|
-
}
|
|
386
|
-
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
387
421
|
}
|
|
388
|
-
</script>
|
|
422
|
+
</script>
|
|
@@ -3,18 +3,15 @@
|
|
|
3
3
|
:isOpen="isOpen"
|
|
4
4
|
:class="{ visible: isOpen, hidden: !isOpen }"
|
|
5
5
|
@click.native="onOutsideClose()"
|
|
6
|
-
:backdrop="backdrop"
|
|
7
6
|
>
|
|
8
7
|
<modal-container @click.stop>
|
|
9
|
-
<spinner v-if="isLoading" size="50px" :
|
|
10
|
-
<content-container :visible="!isLoading">
|
|
11
|
-
<slot />
|
|
12
|
-
</content-container>
|
|
8
|
+
<spinner v-if="isLoading" size="50px" :fullWidth="true" />
|
|
13
9
|
<close-button
|
|
14
10
|
v-if="!hideClose"
|
|
15
11
|
@click.native="onCloseModal()"
|
|
16
12
|
class="close"
|
|
17
13
|
/>
|
|
14
|
+
<slot />
|
|
18
15
|
</modal-container>
|
|
19
16
|
</page-wrapper>
|
|
20
17
|
</template>
|
|
@@ -31,12 +28,7 @@ import styled from 'vue-styled-components'
|
|
|
31
28
|
import CloseButton from '../../buttons/closeButton'
|
|
32
29
|
import Spinner from '../../spinner'
|
|
33
30
|
|
|
34
|
-
const
|
|
35
|
-
const ContentContainer = styled('div', contentAttrs)`
|
|
36
|
-
visibility: ${(props) => (props.visible ? 'inherit' : 'hidden')};
|
|
37
|
-
`
|
|
38
|
-
|
|
39
|
-
const pageAttrs = { isOpen: Boolean, backdrop: String }
|
|
31
|
+
const pageAttrs = { isOpen: Boolean }
|
|
40
32
|
const PageWrapper = styled('div', pageAttrs)`
|
|
41
33
|
position: fixed;
|
|
42
34
|
display: grid;
|
|
@@ -44,10 +36,7 @@ const PageWrapper = styled('div', pageAttrs)`
|
|
|
44
36
|
left: 0;
|
|
45
37
|
width: 100%;
|
|
46
38
|
height: 100%;
|
|
47
|
-
background-color:
|
|
48
|
-
props.backdrop == 'dark'
|
|
49
|
-
? 'rgba(0, 0, 0, 0.4)'
|
|
50
|
-
: 'rgba(255, 255, 255, 0.9)'};
|
|
39
|
+
background-color: rgba(255, 255, 255, 0.9);
|
|
51
40
|
z-index: 99999;
|
|
52
41
|
overflow: auto;
|
|
53
42
|
|
|
@@ -109,8 +98,7 @@ export default {
|
|
|
109
98
|
PageWrapper,
|
|
110
99
|
ModalContainer,
|
|
111
100
|
CloseButton,
|
|
112
|
-
Spinner
|
|
113
|
-
ContentContainer
|
|
101
|
+
Spinner
|
|
114
102
|
},
|
|
115
103
|
props: {
|
|
116
104
|
isOpen: {
|
|
@@ -128,10 +116,6 @@ export default {
|
|
|
128
116
|
hideClose: {
|
|
129
117
|
required: false,
|
|
130
118
|
default: false
|
|
131
|
-
},
|
|
132
|
-
backdrop: {
|
|
133
|
-
required: false,
|
|
134
|
-
default: 'white'
|
|
135
119
|
}
|
|
136
120
|
},
|
|
137
121
|
methods: {
|
|
@@ -151,4 +135,4 @@ export default {
|
|
|
151
135
|
}
|
|
152
136
|
}
|
|
153
137
|
}
|
|
154
|
-
</script>
|
|
138
|
+
</script>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
/>
|
|
8
8
|
</container>
|
|
9
9
|
</spinner-container>
|
|
10
|
-
<container v-else
|
|
10
|
+
<container v-else>
|
|
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,41 +32,34 @@ const SpinnerContainer = styled.div`
|
|
|
32
32
|
justify-items: center;
|
|
33
33
|
z-index: 100;
|
|
34
34
|
`
|
|
35
|
-
|
|
36
|
-
const Container = styled
|
|
35
|
+
|
|
36
|
+
const Container = styled.div`
|
|
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')};
|
|
43
40
|
`
|
|
44
41
|
|
|
45
42
|
const spinnerAttrs = { size: String }
|
|
46
|
-
const SpinnerWrapper = styled(
|
|
47
|
-
width: ${(props) => (props.size ? props.size :
|
|
43
|
+
const SpinnerWrapper = styled("img", spinnerAttrs)`
|
|
44
|
+
width: ${(props) => (props.size ? props.size : "60px")};
|
|
48
45
|
`
|
|
49
46
|
|
|
50
47
|
export default {
|
|
51
|
-
name:
|
|
48
|
+
name: "spinner",
|
|
52
49
|
components: {
|
|
53
50
|
Container,
|
|
54
51
|
SpinnerWrapper,
|
|
55
|
-
SpinnerContainer
|
|
52
|
+
SpinnerContainer,
|
|
56
53
|
},
|
|
57
54
|
props: {
|
|
58
55
|
fullWidth: {
|
|
59
56
|
required: false,
|
|
60
|
-
default: false
|
|
61
|
-
},
|
|
62
|
-
limitedToModal: {
|
|
63
|
-
required: false,
|
|
64
|
-
default: false
|
|
57
|
+
default: false,
|
|
65
58
|
},
|
|
66
59
|
size: {
|
|
67
60
|
required: false,
|
|
68
|
-
default: null
|
|
69
|
-
}
|
|
70
|
-
}
|
|
61
|
+
default: null,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
71
64
|
}
|
|
72
|
-
</script>
|
|
65
|
+
</script>
|