@eturnity/eturnity_reusable_components 1.2.0-beta.0 → 1.2.0-beta.3
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
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>
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<input-container
|
|
17
17
|
ref="inputField1"
|
|
18
18
|
:hasUnit="unitName && !!unitName.length"
|
|
19
|
-
:placeholder="
|
|
19
|
+
:placeholder="displayedPlaceholder"
|
|
20
20
|
:isError="isError"
|
|
21
21
|
:inputWidth="inputWidth"
|
|
22
22
|
:minWidth="minWidth"
|
|
@@ -68,12 +68,12 @@
|
|
|
68
68
|
// :minNumber="0"
|
|
69
69
|
// fontColor="blue"
|
|
70
70
|
// />
|
|
71
|
-
import styled from
|
|
71
|
+
import styled from 'vue-styled-components'
|
|
72
72
|
import {
|
|
73
73
|
stringToNumber,
|
|
74
74
|
numberToString,
|
|
75
|
-
} from
|
|
76
|
-
import InfoText from
|
|
75
|
+
} from '../../../helpers/numberConverter'
|
|
76
|
+
import InfoText from '../../infoText'
|
|
77
77
|
|
|
78
78
|
const Container = styled.div`
|
|
79
79
|
width: 100%;
|
|
@@ -91,29 +91,29 @@ const inputProps = {
|
|
|
91
91
|
fontSize: String,
|
|
92
92
|
fontColor: String,
|
|
93
93
|
}
|
|
94
|
-
const InputContainer = styled(
|
|
94
|
+
const InputContainer = styled('input', inputProps)`
|
|
95
95
|
border: ${(props) =>
|
|
96
96
|
props.isError
|
|
97
|
-
?
|
|
97
|
+
? '1px solid ' + props.theme.colors.red
|
|
98
98
|
: props.noBorder
|
|
99
99
|
? "none"
|
|
100
100
|
: "1px solid " + props.theme.colors.mediumGray};
|
|
101
101
|
padding: ${(props) =>
|
|
102
|
-
props.hasUnit ?
|
|
102
|
+
props.hasUnit ? '11px 40px 11px 10px' : '11px 5px 11px 10px'};
|
|
103
103
|
border-radius: 4px;
|
|
104
104
|
text-align: ${(props) => props.textAlign};
|
|
105
|
-
cursor: ${(props) => (props.isDisabled ?
|
|
106
|
-
font-size: ${(props) => (props.fontSize ? props.fontSize :
|
|
105
|
+
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
|
|
106
|
+
font-size: ${(props) => (props.fontSize ? props.fontSize : '13px')};
|
|
107
107
|
color: ${(props) =>
|
|
108
108
|
props.isError
|
|
109
109
|
? props.theme.colors.red
|
|
110
110
|
: props.fontColor
|
|
111
|
-
? props.fontColor +
|
|
111
|
+
? props.fontColor + ' !important'
|
|
112
112
|
: props.theme.colors.black};
|
|
113
|
-
width: ${(props) => (props.inputWidth ? props.inputWidth :
|
|
114
|
-
min-width: ${(props) => (props.minWidth ? props.minWidth :
|
|
113
|
+
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
|
114
|
+
min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
|
|
115
115
|
background-color: ${(props) =>
|
|
116
|
-
props.isDisabled ? props.theme.colors.grey5 :
|
|
116
|
+
props.isDisabled ? props.theme.colors.grey5 : '#fff'};
|
|
117
117
|
box-sizing: border-box;
|
|
118
118
|
|
|
119
119
|
&::placeholder {
|
|
@@ -130,7 +130,7 @@ const InputWrapper = styled.span`
|
|
|
130
130
|
position: relative;
|
|
131
131
|
`
|
|
132
132
|
|
|
133
|
-
const UnitContainer = styled(
|
|
133
|
+
const UnitContainer = styled('span', inputProps)`
|
|
134
134
|
border-left: 1px solid
|
|
135
135
|
${(props) =>
|
|
136
136
|
props.isError
|
|
@@ -169,7 +169,7 @@ const LabelText = styled.div`
|
|
|
169
169
|
`
|
|
170
170
|
|
|
171
171
|
export default {
|
|
172
|
-
name:
|
|
172
|
+
name: 'input-number',
|
|
173
173
|
components: {
|
|
174
174
|
Container,
|
|
175
175
|
InputContainer,
|
|
@@ -182,14 +182,20 @@ export default {
|
|
|
182
182
|
},
|
|
183
183
|
data() {
|
|
184
184
|
return {
|
|
185
|
-
textInput:
|
|
185
|
+
textInput: '',
|
|
186
186
|
isFocused: false,
|
|
187
187
|
}
|
|
188
188
|
},
|
|
189
|
+
computed: {
|
|
190
|
+
displayedPlaceholder() {
|
|
191
|
+
if (this.placeholder) return this.placeholder
|
|
192
|
+
return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
|
|
193
|
+
},
|
|
194
|
+
},
|
|
189
195
|
props: {
|
|
190
196
|
placeholder: {
|
|
191
197
|
required: false,
|
|
192
|
-
default:
|
|
198
|
+
default: '',
|
|
193
199
|
},
|
|
194
200
|
isError: {
|
|
195
201
|
required: false,
|
|
@@ -213,7 +219,7 @@ export default {
|
|
|
213
219
|
},
|
|
214
220
|
errorMessage: {
|
|
215
221
|
required: false,
|
|
216
|
-
default:
|
|
222
|
+
default: 'Please insert a correct number',
|
|
217
223
|
},
|
|
218
224
|
numberPrecision: {
|
|
219
225
|
required: false,
|
|
@@ -221,7 +227,7 @@ export default {
|
|
|
221
227
|
},
|
|
222
228
|
unitName: {
|
|
223
229
|
required: false,
|
|
224
|
-
default:
|
|
230
|
+
default: '',
|
|
225
231
|
},
|
|
226
232
|
showLinearUnitName: {
|
|
227
233
|
required: false,
|
|
@@ -237,11 +243,11 @@ export default {
|
|
|
237
243
|
},
|
|
238
244
|
textAlign: {
|
|
239
245
|
required: false,
|
|
240
|
-
default:
|
|
246
|
+
default: 'left',
|
|
241
247
|
},
|
|
242
248
|
fontSize: {
|
|
243
249
|
required: false,
|
|
244
|
-
default:
|
|
250
|
+
default: '13px',
|
|
245
251
|
},
|
|
246
252
|
labelText: {
|
|
247
253
|
required: false,
|
|
@@ -253,7 +259,7 @@ export default {
|
|
|
253
259
|
},
|
|
254
260
|
labelInfoAlign: {
|
|
255
261
|
required: false,
|
|
256
|
-
default:
|
|
262
|
+
default: 'right',
|
|
257
263
|
},
|
|
258
264
|
minNumber: {
|
|
259
265
|
required: false,
|
|
@@ -273,22 +279,22 @@ export default {
|
|
|
273
279
|
if (isNaN(event)) {
|
|
274
280
|
event = this.minNumber || this.minNumber === 0 ? this.minNumber : event
|
|
275
281
|
}
|
|
276
|
-
this.$emit(
|
|
282
|
+
this.$emit('input-change', event)
|
|
277
283
|
},
|
|
278
284
|
onEvaluateCode(val) {
|
|
279
285
|
// function to perform math on the code
|
|
280
286
|
// filter the string in case of any malicious content
|
|
281
|
-
let filtered = val.replace(/[^-()\d/*+.,]/g,
|
|
287
|
+
let filtered = val.replace(/[^-()\d/*+.,]/g, '')
|
|
282
288
|
filtered = filtered.split(/([-+*/()])/)
|
|
283
289
|
let formatted = filtered.map((item) => {
|
|
284
290
|
if (
|
|
285
|
-
item ===
|
|
286
|
-
item ===
|
|
287
|
-
item ===
|
|
288
|
-
item ===
|
|
289
|
-
item ===
|
|
290
|
-
item ===
|
|
291
|
-
item ===
|
|
291
|
+
item === '+' ||
|
|
292
|
+
item === '-' ||
|
|
293
|
+
item === '*' ||
|
|
294
|
+
item === '/' ||
|
|
295
|
+
item === '(' ||
|
|
296
|
+
item === ')' ||
|
|
297
|
+
item === ''
|
|
292
298
|
) {
|
|
293
299
|
return item
|
|
294
300
|
} else {
|
|
@@ -323,8 +329,8 @@ export default {
|
|
|
323
329
|
? value
|
|
324
330
|
: this.minNumber || this.minNumber === 0
|
|
325
331
|
? this.minNumber
|
|
326
|
-
:
|
|
327
|
-
this.$emit(
|
|
332
|
+
: ''
|
|
333
|
+
this.$emit('input-blur', adjustedMinValue)
|
|
328
334
|
},
|
|
329
335
|
focusInput() {
|
|
330
336
|
if (this.disabled) {
|
|
@@ -341,7 +347,7 @@ export default {
|
|
|
341
347
|
? value
|
|
342
348
|
: this.minNumber || this.minNumber === 0
|
|
343
349
|
? this.minNumber
|
|
344
|
-
:
|
|
350
|
+
: ''
|
|
345
351
|
if ((adjustedMinValue || adjustedMinValue === 0) && !this.isFocused) {
|
|
346
352
|
let input = this.numberToStringEnabled
|
|
347
353
|
? numberToString({
|
|
@@ -352,7 +358,7 @@ export default {
|
|
|
352
358
|
let unit = this.showLinearUnitName ? "" : this.unitName
|
|
353
359
|
return input + " " + unit
|
|
354
360
|
} else if (!adjustedMinValue && adjustedMinValue !== 0) {
|
|
355
|
-
return
|
|
361
|
+
return ''
|
|
356
362
|
} else {
|
|
357
363
|
return this.numberToStringEnabled
|
|
358
364
|
? numberToString({
|
|
@@ -380,9 +386,9 @@ export default {
|
|
|
380
386
|
clearInput: function (value) {
|
|
381
387
|
if (value) {
|
|
382
388
|
// If the value is typed, then we should clear the textInput on Continue
|
|
383
|
-
this.textInput =
|
|
389
|
+
this.textInput = ''
|
|
384
390
|
}
|
|
385
391
|
},
|
|
386
392
|
},
|
|
387
393
|
}
|
|
388
|
-
</script>
|
|
394
|
+
</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
8
|
<spinner v-if="isLoading" size="50px" :fullWidth="true" />
|
|
10
|
-
<content-container :visible="!isLoading">
|
|
11
|
-
<slot />
|
|
12
|
-
</content-container>
|
|
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 ? 'visible' : '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: {
|
|
@@ -127,12 +115,8 @@ export default {
|
|
|
127
115
|
},
|
|
128
116
|
hideClose: {
|
|
129
117
|
required: false,
|
|
130
|
-
default: false
|
|
131
|
-
}
|
|
132
|
-
backdrop: {
|
|
133
|
-
required: false,
|
|
134
|
-
default: 'white',
|
|
135
|
-
},
|
|
118
|
+
default: false
|
|
119
|
+
}
|
|
136
120
|
},
|
|
137
121
|
methods: {
|
|
138
122
|
onCloseModal() {
|