@eturnity/eturnity_reusable_components 1.2.2-EPDM-5155.2 → 1.2.2-EPDM-4371.1
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 -64
- package/src/assets/icons/error_icon copy.png +0 -0
- package/src/components/errorMessage/index.vue +62 -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,14 @@
|
|
|
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 />
|
|
34
32
|
<br />
|
|
35
33
|
<toggle
|
|
36
34
|
@on-toggle-change="onInputChange($event)"
|
|
@@ -63,18 +61,17 @@
|
|
|
63
61
|
</template>
|
|
64
62
|
|
|
65
63
|
<script>
|
|
66
|
-
import { ThemeProvider } from
|
|
67
|
-
import theme from
|
|
68
|
-
import styled from
|
|
69
|
-
import MainTable from
|
|
70
|
-
import ThreeDots from
|
|
71
|
-
import Toggle from
|
|
72
|
-
import InputNumber from
|
|
73
|
-
import Checkbox from
|
|
74
|
-
import PageSubtitle from
|
|
75
|
-
import Spinner from
|
|
76
|
-
import ExternalButton from
|
|
77
|
-
import Modal from '@/components/modals/modal'
|
|
64
|
+
import { ThemeProvider } from "vue-styled-components"
|
|
65
|
+
import theme from "./assets/theme"
|
|
66
|
+
import styled from "vue-styled-components"
|
|
67
|
+
import MainTable from "@/components/tables/mainTable"
|
|
68
|
+
import ThreeDots from "@/components/threeDots"
|
|
69
|
+
import Toggle from "@/components/inputs/toggle"
|
|
70
|
+
import InputNumber from "@/components/inputs/inputNumber"
|
|
71
|
+
import Checkbox from "@/components/inputs/checkbox"
|
|
72
|
+
import PageSubtitle from "@/components/pageSubtitle"
|
|
73
|
+
import Spinner from "@/components/spinner"
|
|
74
|
+
import ExternalButton from "@/components/buttons/externalButton"
|
|
78
75
|
// import TableDropdown from "@/components/tableDropdown"
|
|
79
76
|
|
|
80
77
|
const PageContainer = styled.div`
|
|
@@ -82,7 +79,7 @@ const PageContainer = styled.div`
|
|
|
82
79
|
`
|
|
83
80
|
|
|
84
81
|
export default {
|
|
85
|
-
name:
|
|
82
|
+
name: "App",
|
|
86
83
|
components: {
|
|
87
84
|
ThemeProvider,
|
|
88
85
|
PageContainer,
|
|
@@ -94,62 +91,62 @@ export default {
|
|
|
94
91
|
Spinner,
|
|
95
92
|
Checkbox,
|
|
96
93
|
ExternalButton,
|
|
97
|
-
|
|
94
|
+
// TableDropdown,
|
|
98
95
|
},
|
|
99
96
|
data() {
|
|
100
97
|
return {
|
|
101
98
|
inputValue: null,
|
|
102
|
-
checkedOption:
|
|
99
|
+
checkedOption: "button_1",
|
|
103
100
|
question: {
|
|
104
101
|
number_format_precision: 4,
|
|
105
102
|
number_min_allowed: 0,
|
|
106
103
|
number_max_allowed: 10,
|
|
107
|
-
unit_short_name:
|
|
104
|
+
unit_short_name: "cm",
|
|
108
105
|
},
|
|
109
106
|
dropdownOpen: false,
|
|
110
107
|
isChecked: false,
|
|
111
108
|
listOptions: [
|
|
112
109
|
{
|
|
113
|
-
name:
|
|
114
|
-
value:
|
|
110
|
+
name: "Option 1",
|
|
111
|
+
value: "option_1",
|
|
115
112
|
disabled: true,
|
|
116
113
|
},
|
|
117
114
|
{
|
|
118
|
-
name:
|
|
119
|
-
value:
|
|
115
|
+
name: "Option 2",
|
|
116
|
+
value: "option_2",
|
|
120
117
|
},
|
|
121
118
|
{
|
|
122
|
-
name:
|
|
123
|
-
value:
|
|
119
|
+
name: "Option 3",
|
|
120
|
+
value: "option_3",
|
|
124
121
|
},
|
|
125
122
|
{
|
|
126
|
-
name:
|
|
127
|
-
value:
|
|
123
|
+
name: "Option 4",
|
|
124
|
+
value: "option_4",
|
|
128
125
|
},
|
|
129
126
|
],
|
|
130
127
|
itemOptions: [
|
|
131
128
|
{
|
|
132
|
-
display_name:
|
|
133
|
-
company_item_number:
|
|
134
|
-
model:
|
|
129
|
+
display_name: "Test 1",
|
|
130
|
+
company_item_number: "123",
|
|
131
|
+
model: "BTB-2145 Long Text Long Text Long Text Long Text Long Text",
|
|
135
132
|
id: 1,
|
|
136
133
|
},
|
|
137
134
|
{
|
|
138
|
-
display_name:
|
|
139
|
-
company_item_number:
|
|
140
|
-
model:
|
|
135
|
+
display_name: "Test 2",
|
|
136
|
+
company_item_number: "1234",
|
|
137
|
+
model: "BTB-123",
|
|
141
138
|
id: 2,
|
|
142
139
|
},
|
|
143
140
|
{
|
|
144
|
-
display_name:
|
|
145
|
-
company_item_number:
|
|
146
|
-
model:
|
|
141
|
+
display_name: "Test 3",
|
|
142
|
+
company_item_number: "12345",
|
|
143
|
+
model: "BTB-543",
|
|
147
144
|
id: 3,
|
|
148
145
|
},
|
|
149
146
|
{
|
|
150
|
-
display_name:
|
|
151
|
-
company_item_number:
|
|
152
|
-
model:
|
|
147
|
+
display_name: "Test 4",
|
|
148
|
+
company_item_number: "123456",
|
|
149
|
+
model: "BTB-4930",
|
|
153
150
|
id: 4,
|
|
154
151
|
},
|
|
155
152
|
],
|
|
@@ -166,7 +163,7 @@ export default {
|
|
|
166
163
|
return this.dropdownOpen
|
|
167
164
|
},
|
|
168
165
|
onClickButton() {
|
|
169
|
-
console.log(
|
|
166
|
+
console.log("Test")
|
|
170
167
|
},
|
|
171
168
|
toggleDropdownOpen() {
|
|
172
169
|
this.dropdownOpen = !this.dropdownOpen
|
|
@@ -177,19 +174,19 @@ export default {
|
|
|
177
174
|
{
|
|
178
175
|
value: this.getComponentInfo({
|
|
179
176
|
row: this.itemOptions[0],
|
|
180
|
-
value:
|
|
177
|
+
value: "display_name",
|
|
181
178
|
}),
|
|
182
179
|
},
|
|
183
180
|
{
|
|
184
181
|
value: this.getComponentInfo({
|
|
185
182
|
row: this.itemOptions[0],
|
|
186
|
-
value:
|
|
183
|
+
value: "company_item_number",
|
|
187
184
|
}),
|
|
188
185
|
},
|
|
189
186
|
{
|
|
190
187
|
value: this.getComponentInfo({
|
|
191
188
|
row: this.itemOptions[0],
|
|
192
|
-
value:
|
|
189
|
+
value: "model",
|
|
193
190
|
}),
|
|
194
191
|
},
|
|
195
192
|
]
|
|
@@ -202,7 +199,7 @@ export default {
|
|
|
202
199
|
} else if (row[value]) {
|
|
203
200
|
item = row[value]
|
|
204
201
|
} else {
|
|
205
|
-
item =
|
|
202
|
+
item = "-"
|
|
206
203
|
}
|
|
207
204
|
return item
|
|
208
205
|
},
|
|
@@ -216,4 +213,4 @@ body {
|
|
|
216
213
|
height: 100%;
|
|
217
214
|
margin: 0;
|
|
218
215
|
}
|
|
219
|
-
</style>
|
|
216
|
+
</style>
|
|
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>
|
|
@@ -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>
|