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