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