@eturnity/eturnity_reusable_components 7.24.3-EPDM-11250.0 → 7.24.3-EPDM-11320.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/.eslintrc.js +125 -0
- package/package.json +6 -20
- package/src/App.vue +75 -70
- package/src/components/addNewButton/index.vue +24 -27
- package/src/components/banner/actionBanner/index.vue +32 -30
- package/src/components/banner/banner/index.vue +88 -80
- package/src/components/banner/infoBanner/index.vue +36 -44
- package/src/components/buttons/buttonIcon/index.vue +83 -78
- package/src/components/buttons/closeButton/index.vue +26 -26
- package/src/components/buttons/mainButton/index.vue +80 -76
- package/src/components/card/index.vue +56 -52
- package/src/components/collapsableInfoText/index.vue +81 -76
- package/src/components/deleteIcon/index.vue +31 -28
- package/src/components/draggableInputHandle/index.vue +20 -17
- package/src/components/dropdown/Dropdown.stories.js +8 -8
- package/src/components/dropdown/index.vue +75 -72
- package/src/components/errorMessage/index.vue +23 -23
- package/src/components/filter/filterSettings.vue +349 -329
- package/src/components/filter/index.vue +130 -130
- package/src/components/filter/parentDropdown.vue +43 -40
- package/src/components/icon/Icons.stories.js +4 -4
- package/src/components/icon/iconCache.js +1 -1
- package/src/components/icon/iconCollection.vue +40 -37
- package/src/components/icon/index.vue +72 -65
- package/src/components/iconWrapper/index.vue +122 -118
- package/src/components/infoCard/index.vue +20 -17
- package/src/components/infoText/index.vue +88 -82
- package/src/components/inputs/checkbox/index.vue +91 -94
- package/src/components/inputs/inputNumber/index.vue +508 -488
- package/src/components/inputs/inputNumberQuestion/index.vue +127 -124
- package/src/components/inputs/inputText/index.vue +265 -252
- package/src/components/inputs/radioButton/index.vue +135 -120
- package/src/components/inputs/searchInput/index.vue +84 -81
- package/src/components/inputs/select/index.vue +644 -631
- package/src/components/inputs/select/option/index.vue +91 -91
- package/src/components/inputs/select/select.stories.js +7 -7
- package/src/components/inputs/slider/index.vue +46 -46
- package/src/components/inputs/switchField/index.vue +159 -152
- package/src/components/inputs/textAreaInput/index.vue +120 -113
- package/src/components/inputs/toggle/index.vue +137 -127
- package/src/components/label/index.vue +64 -61
- package/src/components/markerItem/index.vue +40 -40
- package/src/components/modals/actionModal/index.vue +32 -29
- package/src/components/modals/infoModal/index.vue +34 -27
- package/src/components/modals/modal/index.vue +88 -80
- package/src/components/navigationTabs/index.vue +50 -47
- package/src/components/pageSubtitle/index.vue +33 -29
- package/src/components/pageTitle/index.vue +47 -39
- package/src/components/pagination/index.vue +64 -62
- package/src/components/progressBar/index.vue +70 -67
- package/src/components/projectMarker/index.vue +172 -163
- package/src/components/rangeSlider/Slider.vue +449 -449
- package/src/components/rangeSlider/index.vue +282 -270
- package/src/components/rangeSlider/utils/dom.js +3 -3
- package/src/components/selectedOptions/index.vue +51 -51
- package/src/components/sideMenu/index.vue +117 -109
- package/src/components/spinner/index.vue +37 -34
- package/src/components/tableDropdown/index.vue +343 -326
- package/src/components/tables/mainTable/index.vue +109 -106
- package/src/components/tables/viewTable/index.vue +105 -92
- package/src/components/threeDots/index.vue +174 -171
- package/src/components/videoThumbnail/index.vue +67 -59
- package/src/components/videoThumbnail/videoThumbnail.stories.js +6 -6
- package/src/helpers/numberConverter.js +1 -3
- package/src/helpers/translateLang.js +10 -13
- package/.prettierrc +0 -7
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -17
@@ -1,74 +1,94 @@
|
|
1
1
|
<template>
|
2
|
-
<
|
3
|
-
|
2
|
+
<Container
|
3
|
+
:align-items="alignItems"
|
4
|
+
:input-width="inputWidth"
|
5
|
+
>
|
6
|
+
<LabelSlotWrapper
|
4
7
|
v-if="hasLabelSlot"
|
5
|
-
:
|
6
|
-
:
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
8
|
+
:align-items="alignItems"
|
9
|
+
:border-color="borderColor"
|
10
|
+
:is-error="isError"
|
11
|
+
:is-interactive="isInteractive"
|
12
|
+
:no-border="noBorder"
|
10
13
|
@mousedown="initInteraction"
|
11
14
|
>
|
12
15
|
<slot name="label"></slot>
|
13
|
-
</
|
16
|
+
</LabelSlotWrapper>
|
14
17
|
|
15
|
-
<
|
16
|
-
<
|
18
|
+
<LabelWrapper v-if="labelText">
|
19
|
+
<LabelText
|
20
|
+
:data-id="labelDataId"
|
21
|
+
:label-font-color="labelFontColor"
|
22
|
+
>
|
17
23
|
{{ labelText }}
|
18
|
-
</
|
24
|
+
</LabelText>
|
19
25
|
|
20
|
-
<
|
26
|
+
<InfoText
|
21
27
|
v-if="labelInfoText"
|
28
|
+
:align-arrow="labelInfoAlign"
|
22
29
|
:text="labelInfoText"
|
23
|
-
:alignArrow="labelInfoAlign"
|
24
30
|
/>
|
25
|
-
</
|
26
|
-
<
|
27
|
-
<
|
31
|
+
</LabelWrapper>
|
32
|
+
<InputWrapper>
|
33
|
+
<InputContainer
|
28
34
|
v-bind="$attrs"
|
29
|
-
ref="inputField1"
|
30
|
-
:
|
35
|
+
ref="inputField1"
|
36
|
+
:align-items="alignItems"
|
37
|
+
:background-color="backgroundColor"
|
38
|
+
:border-color="borderColor"
|
39
|
+
:data-id="inputDataId"
|
40
|
+
:disabled="disabled"
|
41
|
+
:font-color="fontColor"
|
42
|
+
:font-size="fontSize"
|
43
|
+
:has-label-slot="hasLabelSlot"
|
44
|
+
:has-slot="hasSlot"
|
45
|
+
:has-unit="unitName && !!unitName.length"
|
46
|
+
:input-height="inputHeight"
|
47
|
+
:is-disabled="disabled"
|
48
|
+
:is-error="isError"
|
49
|
+
:is-interactive="isInteractive"
|
50
|
+
:min-width="minWidth"
|
51
|
+
:no-border="noBorder"
|
31
52
|
:placeholder="displayedPlaceholder"
|
32
|
-
:
|
33
|
-
:
|
34
|
-
:
|
35
|
-
:isInteractive="isInteractive"
|
53
|
+
:show-linear-unit-name="showLinearUnitName"
|
54
|
+
:slot-size="slotSize"
|
55
|
+
:text-align="textAlign"
|
36
56
|
:value="formatWithCurrency(value)"
|
37
57
|
@blur="onInputBlur($event)"
|
38
58
|
@focus="focusInput()"
|
39
|
-
@keyup.enter="onEnterPress"
|
40
59
|
@input="onInput($event)"
|
41
|
-
|
42
|
-
:isDisabled="disabled"
|
43
|
-
:alignItems="alignItems"
|
44
|
-
:noBorder="noBorder"
|
45
|
-
:borderColor="borderColor"
|
46
|
-
:textAlign="textAlign"
|
47
|
-
:fontSize="fontSize"
|
48
|
-
:fontColor="fontColor"
|
49
|
-
:backgroundColor="backgroundColor"
|
50
|
-
:hasSlot="hasSlot"
|
51
|
-
:hasLabelSlot="hasLabelSlot"
|
52
|
-
:slotSize="slotSize"
|
53
|
-
:showLinearUnitName="showLinearUnitName"
|
54
|
-
:data-id="inputDataId"
|
60
|
+
@keyup.enter="onEnterPress"
|
55
61
|
/>
|
56
|
-
<
|
62
|
+
<SlotContainer
|
63
|
+
v-if="hasSlot"
|
64
|
+
:is-error="isError"
|
65
|
+
:slot-size="slotSize"
|
66
|
+
>
|
57
67
|
<slot></slot>
|
58
|
-
</
|
68
|
+
</SlotContainer>
|
59
69
|
|
60
|
-
<
|
70
|
+
<UnitContainer
|
61
71
|
v-if="unitName && showLinearUnitName && !hasSlot"
|
62
|
-
:
|
63
|
-
:
|
64
|
-
>{{ unitName }}</unit-container
|
72
|
+
:has-length="!!textInput.length"
|
73
|
+
:is-error="isError"
|
65
74
|
>
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
75
|
+
{{ unitName }}
|
76
|
+
</UnitContainer>
|
77
|
+
<IconWrapper
|
78
|
+
v-if="isError && !showLinearUnitName"
|
79
|
+
size="16px"
|
80
|
+
>
|
81
|
+
<Icon
|
82
|
+
cursor="default"
|
83
|
+
name="warning"
|
84
|
+
size="16px"
|
85
|
+
/>
|
86
|
+
</IconWrapper>
|
87
|
+
</InputWrapper>
|
88
|
+
<ErrorMessage v-if="isError">
|
89
|
+
{{ errorMessage }}
|
90
|
+
</ErrorMessage>
|
91
|
+
</Container>
|
72
92
|
</template>
|
73
93
|
|
74
94
|
<script>
|
@@ -100,47 +120,47 @@
|
|
100
120
|
// >
|
101
121
|
//<template name=label><img>....</template>
|
102
122
|
//</inputNumber>
|
103
|
-
import styled from 'vue3-styled-components'
|
104
|
-
import {
|
105
|
-
|
106
|
-
|
107
|
-
} from '../../../helpers/numberConverter'
|
108
|
-
import InfoText from '../../infoText'
|
109
|
-
import ErrorMessage from '../../errorMessage'
|
110
|
-
import warningIcon from '../../../assets/icons/error_icon.png'
|
111
|
-
import Icon from '../../icon'
|
123
|
+
import styled from 'vue3-styled-components'
|
124
|
+
import {
|
125
|
+
stringToNumber,
|
126
|
+
numberToString
|
127
|
+
} from '../../../helpers/numberConverter'
|
128
|
+
import InfoText from '../../infoText'
|
129
|
+
import ErrorMessage from '../../errorMessage'
|
130
|
+
import warningIcon from '../../../assets/icons/error_icon.png'
|
131
|
+
import Icon from '../../icon'
|
112
132
|
|
113
|
-
const inputProps = {
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
}
|
133
|
+
const inputProps = {
|
134
|
+
isError: Boolean,
|
135
|
+
hasUnit: Boolean,
|
136
|
+
inputWidth: String,
|
137
|
+
minWidth: String,
|
138
|
+
isDisabled: Boolean,
|
139
|
+
noBorder: Boolean,
|
140
|
+
textAlign: String,
|
141
|
+
fontSize: String,
|
142
|
+
fontColor: String,
|
143
|
+
backgroundColor: String,
|
144
|
+
hasSlot: Boolean,
|
145
|
+
hasLabelSlot: Boolean,
|
146
|
+
slotSize: String,
|
147
|
+
inputHeight: String,
|
148
|
+
isInteractive: Boolean,
|
149
|
+
alignItems: String,
|
150
|
+
labelFontColor: String,
|
151
|
+
borderColor: String,
|
152
|
+
showLinearUnitName: Boolean
|
153
|
+
}
|
134
154
|
|
135
|
-
const Container = styled('div', inputProps)`
|
155
|
+
const Container = styled('div', inputProps)`
|
136
156
|
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
137
157
|
position: relative;
|
138
158
|
display: grid;
|
139
159
|
grid-template-columns: ${(props) =>
|
140
|
-
|
160
|
+
props.alignItems === 'vertical' ? '1fr' : 'auto 1fr'};
|
141
161
|
`
|
142
162
|
|
143
|
-
const InputContainer = styled('input', inputProps)`
|
163
|
+
const InputContainer = styled('input', inputProps)`
|
144
164
|
border: ${(props) =>
|
145
165
|
props.isError
|
146
166
|
? '1px solid ' + props.theme.colors.red
|
@@ -150,7 +170,7 @@ const InputContainer = styled('input', inputProps)`
|
|
150
170
|
? props.theme.colors[props.borderColor]
|
151
171
|
? '1px solid ' + props.theme.colors[props.borderColor]
|
152
172
|
: '1px solid ' + props.borderColor
|
153
|
-
|
173
|
+
: '1px solid ' + props.theme.colors.grey4};
|
154
174
|
height: ${(props) => props.inputHeight};
|
155
175
|
max-height: ${(props) => props.inputHeight};
|
156
176
|
padding: 0 10px;
|
@@ -161,11 +181,11 @@ const InputContainer = styled('input', inputProps)`
|
|
161
181
|
: 'calc(' + slotSize + ' + 10px)'
|
162
182
|
: isError && !showLinearUnitName
|
163
183
|
? '24px'
|
164
|
-
|
184
|
+
: '5px'};
|
165
185
|
border-radius: ${(props) =>
|
166
186
|
props.isInteractive && props.alignItems != 'vertical'
|
167
187
|
? '0 4px 4px 0'
|
168
|
-
|
188
|
+
: '4px'};
|
169
189
|
text-align: ${(props) => props.textAlign};
|
170
190
|
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
|
171
191
|
font-size: ${(props) => (props.fontSize ? props.fontSize : '13px')};
|
@@ -176,16 +196,16 @@ const InputContainer = styled('input', inputProps)`
|
|
176
196
|
? props.theme.colors.grey2
|
177
197
|
: props.fontColor
|
178
198
|
? props.fontColor + ' !important'
|
179
|
-
|
199
|
+
: props.theme.colors.black};
|
180
200
|
background-color: ${(props) =>
|
181
201
|
props.backgroundColor
|
182
202
|
? props.backgroundColor + ' !important'
|
183
|
-
|
203
|
+
: props.theme.colors.white};
|
184
204
|
width: ${(props) =>
|
185
|
-
|
205
|
+
props.inputWidth && !props.hasLabelSlot ? props.inputWidth : '100%'};
|
186
206
|
min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
|
187
207
|
background-color: ${(props) =>
|
188
|
-
|
208
|
+
props.isDisabled ? props.theme.colors.grey5 : '#fff'};
|
189
209
|
box-sizing: border-box;
|
190
210
|
|
191
211
|
&::placeholder {
|
@@ -197,18 +217,18 @@ const InputContainer = styled('input', inputProps)`
|
|
197
217
|
}
|
198
218
|
`
|
199
219
|
|
200
|
-
const InputWrapper = styled.span`
|
220
|
+
const InputWrapper = styled.span`
|
201
221
|
position: relative;
|
202
222
|
`
|
203
223
|
|
204
|
-
const UnitContainer = styled('span', inputProps)`
|
224
|
+
const UnitContainer = styled('span', inputProps)`
|
205
225
|
border-left: 1px solid
|
206
226
|
${(props) =>
|
207
227
|
props.isError
|
208
228
|
? props.theme.colors.red
|
209
229
|
: props.hasLength
|
210
230
|
? props.theme.colors.black
|
211
|
-
|
231
|
+
: props.theme.colors.mediumGray};
|
212
232
|
position: absolute;
|
213
233
|
right: 10px;
|
214
234
|
top: 10px;
|
@@ -219,10 +239,10 @@ const UnitContainer = styled('span', inputProps)`
|
|
219
239
|
? props.theme.colors.red
|
220
240
|
: props.hasLength
|
221
241
|
? props.theme.colors.black
|
222
|
-
|
242
|
+
: props.theme.colors.mediumGray};
|
223
243
|
`
|
224
244
|
|
225
|
-
const SlotContainer = styled('span', inputProps)`
|
245
|
+
const SlotContainer = styled('span', inputProps)`
|
226
246
|
text-align: right;
|
227
247
|
border-left: 1px solid
|
228
248
|
${(props) =>
|
@@ -230,10 +250,10 @@ const SlotContainer = styled('span', inputProps)`
|
|
230
250
|
? props.theme.colors.red
|
231
251
|
: props.hasLength
|
232
252
|
? props.theme.colors.black
|
233
|
-
|
253
|
+
: props.theme.colors.mediumGray};
|
234
254
|
position: absolute;
|
235
255
|
width: ${(props) =>
|
236
|
-
|
256
|
+
props.slotSize ? 'calc(' + props.slotSize + ' - 10px)' : 'fit-content'};
|
237
257
|
right: 10px;
|
238
258
|
top: 10px;
|
239
259
|
padding-left: 10px;
|
@@ -242,17 +262,17 @@ const SlotContainer = styled('span', inputProps)`
|
|
242
262
|
? props.theme.colors.red
|
243
263
|
: props.hasLength
|
244
264
|
? props.theme.colors.black
|
245
|
-
|
265
|
+
: props.theme.colors.mediumGray};
|
246
266
|
`
|
247
267
|
|
248
|
-
const LabelWrapper = styled('div', inputProps)`
|
268
|
+
const LabelWrapper = styled('div', inputProps)`
|
249
269
|
display: flex;
|
250
270
|
align-items: center;
|
251
271
|
gap: 10px;
|
252
272
|
margin-bottom: 8px;
|
253
273
|
cursor: ${(props) => (props.isInteractive ? 'ew-resize' : 'auto')};
|
254
274
|
`
|
255
|
-
const LabelSlotWrapper = styled('div', inputProps)`
|
275
|
+
const LabelSlotWrapper = styled('div', inputProps)`
|
256
276
|
display: flex;
|
257
277
|
gap: 10px;
|
258
278
|
align-items: center;
|
@@ -268,22 +288,22 @@ const LabelSlotWrapper = styled('div', inputProps)`
|
|
268
288
|
? props.theme.colors[props.borderColor]
|
269
289
|
? '1px solid ' + props.theme.colors[props.borderColor]
|
270
290
|
: '1px solid ' + props.borderColor
|
271
|
-
|
291
|
+
: '1px solid ' + props.theme.colors.grey4};
|
272
292
|
border-radius: 4px 0 0 4px;
|
273
293
|
border-right: none;
|
274
294
|
`
|
275
295
|
|
276
|
-
const LabelText = styled('div', inputProps)`
|
296
|
+
const LabelText = styled('div', inputProps)`
|
277
297
|
font-size: 13px;
|
278
298
|
color: ${(props) =>
|
279
299
|
props.theme.colors[props.labelFontColor]
|
280
300
|
? props.theme.colors[props.labelFontColor]
|
281
|
-
|
301
|
+
: props.labelFontColor};
|
282
302
|
font-weight: 700;
|
283
303
|
`
|
284
304
|
|
285
|
-
const IconAttrs = { size: String }
|
286
|
-
const IconWrapper = styled('div', IconAttrs)`
|
305
|
+
const IconAttrs = { size: String }
|
306
|
+
const IconWrapper = styled('div', IconAttrs)`
|
287
307
|
position: absolute;
|
288
308
|
top: 0;
|
289
309
|
bottom: 0;
|
@@ -292,419 +312,419 @@ const IconWrapper = styled('div', IconAttrs)`
|
|
292
312
|
height: ${(props) => (props.size ? props.size : 'auto')};
|
293
313
|
`
|
294
314
|
|
295
|
-
export default {
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
labelDataId: {
|
447
|
-
required: false,
|
448
|
-
default: ''
|
449
|
-
},
|
450
|
-
inputDataId: {
|
451
|
-
required: false,
|
452
|
-
default: ''
|
453
|
-
}
|
454
|
-
},
|
455
|
-
computed: {
|
456
|
-
displayedPlaceholder() {
|
457
|
-
if (this.placeholder) return this.placeholder
|
458
|
-
if (this.defaultNumber)
|
459
|
-
return `${this.defaultNumber} ${this.unitName ? this.unitName : ''}`
|
460
|
-
return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
|
461
|
-
},
|
462
|
-
hasSlot() {
|
463
|
-
return !!this.$slots.default
|
464
|
-
},
|
465
|
-
hasLabelSlot() {
|
466
|
-
return !!this.$slots.label
|
467
|
-
}
|
468
|
-
},
|
469
|
-
methods: {
|
470
|
-
onEnterPress() {
|
471
|
-
this.$emit('on-enter-click')
|
472
|
-
this.$refs.inputField1.$el.blur()
|
473
|
-
},
|
474
|
-
onChangeHandler(event) {
|
475
|
-
if (isNaN(event) || event === '') {
|
476
|
-
event = this.defaultNumber
|
477
|
-
? this.defaultNumber
|
478
|
-
: this.minNumber || this.minNumber === 0
|
479
|
-
? this.minNumber
|
480
|
-
: event
|
315
|
+
export default {
|
316
|
+
name: 'InputNumber',
|
317
|
+
components: {
|
318
|
+
Container,
|
319
|
+
InputContainer,
|
320
|
+
InputWrapper,
|
321
|
+
UnitContainer,
|
322
|
+
ErrorMessage,
|
323
|
+
LabelWrapper,
|
324
|
+
LabelSlotWrapper,
|
325
|
+
LabelText,
|
326
|
+
InfoText,
|
327
|
+
Icon,
|
328
|
+
SlotContainer,
|
329
|
+
IconWrapper
|
330
|
+
},
|
331
|
+
inheritAttrs: false,
|
332
|
+
props: {
|
333
|
+
placeholder: {
|
334
|
+
required: false,
|
335
|
+
default: ''
|
336
|
+
},
|
337
|
+
isError: {
|
338
|
+
required: false,
|
339
|
+
default: false
|
340
|
+
},
|
341
|
+
inputWidth: {
|
342
|
+
required: false,
|
343
|
+
default: null
|
344
|
+
},
|
345
|
+
minWidth: {
|
346
|
+
required: false,
|
347
|
+
default: null
|
348
|
+
},
|
349
|
+
inputHeight: {
|
350
|
+
required: false,
|
351
|
+
default: '40px'
|
352
|
+
},
|
353
|
+
value: {
|
354
|
+
required: true,
|
355
|
+
default: null
|
356
|
+
},
|
357
|
+
clearInput: {
|
358
|
+
required: false,
|
359
|
+
default: false
|
360
|
+
},
|
361
|
+
alignItems: {
|
362
|
+
required: false,
|
363
|
+
default: 'vertical'
|
364
|
+
},
|
365
|
+
errorMessage: {
|
366
|
+
required: false,
|
367
|
+
default: 'Please insert a correct number'
|
368
|
+
},
|
369
|
+
numberPrecision: {
|
370
|
+
required: false,
|
371
|
+
default: 0
|
372
|
+
},
|
373
|
+
minDecimals: {
|
374
|
+
required: false,
|
375
|
+
default: 0
|
376
|
+
},
|
377
|
+
unitName: {
|
378
|
+
required: false,
|
379
|
+
default: ''
|
380
|
+
},
|
381
|
+
showLinearUnitName: {
|
382
|
+
required: false,
|
383
|
+
default: false
|
384
|
+
},
|
385
|
+
disabled: {
|
386
|
+
required: false,
|
387
|
+
default: false
|
388
|
+
},
|
389
|
+
noBorder: {
|
390
|
+
required: false,
|
391
|
+
default: false
|
392
|
+
},
|
393
|
+
borderColor: {
|
394
|
+
required: false
|
395
|
+
},
|
396
|
+
textAlign: {
|
397
|
+
required: false,
|
398
|
+
default: 'left'
|
399
|
+
},
|
400
|
+
fontSize: {
|
401
|
+
required: false,
|
402
|
+
default: '13px'
|
403
|
+
},
|
404
|
+
isInteractive: {
|
405
|
+
required: false,
|
406
|
+
default: false
|
407
|
+
},
|
408
|
+
interactionStep: {
|
409
|
+
required: false,
|
410
|
+
default: 1
|
411
|
+
},
|
412
|
+
labelText: {
|
413
|
+
required: false,
|
414
|
+
default: null
|
415
|
+
},
|
416
|
+
labelInfoText: {
|
417
|
+
required: false,
|
418
|
+
default: null
|
419
|
+
},
|
420
|
+
labelInfoAlign: {
|
421
|
+
required: false,
|
422
|
+
default: 'left'
|
423
|
+
},
|
424
|
+
defaultNumber: {
|
425
|
+
required: false,
|
426
|
+
default: null
|
427
|
+
},
|
428
|
+
minNumber: {
|
429
|
+
required: false,
|
430
|
+
default: null
|
431
|
+
},
|
432
|
+
fontColor: {
|
433
|
+
required: false,
|
434
|
+
default: null
|
435
|
+
},
|
436
|
+
backgroundColor: {
|
437
|
+
required: false,
|
438
|
+
default: null
|
439
|
+
},
|
440
|
+
numberToStringEnabled: {
|
441
|
+
required: false,
|
442
|
+
default: true
|
443
|
+
},
|
444
|
+
allowNegative: {
|
445
|
+
required: false,
|
446
|
+
default: true
|
447
|
+
},
|
448
|
+
slotSize: {
|
449
|
+
required: false
|
450
|
+
},
|
451
|
+
labelFontColor: {
|
452
|
+
required: false,
|
453
|
+
default: 'eturnityGrey'
|
454
|
+
},
|
455
|
+
focus: {
|
456
|
+
required: false,
|
457
|
+
default: false
|
458
|
+
},
|
459
|
+
labelDataId: {
|
460
|
+
required: false,
|
461
|
+
default: ''
|
462
|
+
},
|
463
|
+
inputDataId: {
|
464
|
+
required: false,
|
465
|
+
default: ''
|
481
466
|
}
|
482
|
-
if (!this.allowNegative) {
|
483
|
-
event = Math.abs(event)
|
484
|
-
}
|
485
|
-
event = parseFloat(event)
|
486
|
-
// Need to return an integer rather than a string
|
487
|
-
this.$emit('input-change', event)
|
488
467
|
},
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
filtered = filtered.split(/([-+*/()])/)
|
495
|
-
let formatted = filtered.map((item) => {
|
496
|
-
if (
|
497
|
-
item === '+' ||
|
498
|
-
item === '-' ||
|
499
|
-
item === '*' ||
|
500
|
-
item === '/' ||
|
501
|
-
item === '(' ||
|
502
|
-
item === ')' ||
|
503
|
-
item === ''
|
504
|
-
) {
|
505
|
-
return item
|
506
|
-
} else {
|
507
|
-
let num = stringToNumber({
|
508
|
-
value: item,
|
509
|
-
numberPrecision: false,
|
510
|
-
minDecimals: this.minDecimals
|
511
|
-
})
|
512
|
-
return num
|
513
|
-
}
|
514
|
-
})
|
515
|
-
let evaluated
|
516
|
-
formatted = this.removeStringItemsAfterLastNumber(formatted)
|
517
|
-
evaluated = eval(formatted.join(' '))
|
518
|
-
if (typeof evaluated === 'string') {
|
519
|
-
evaluated = stringToNumber({
|
520
|
-
value: evaluated,
|
521
|
-
numberPrecision: this.numberPrecision,
|
522
|
-
minDecimals: this.minDecimals
|
523
|
-
})
|
524
|
-
} else if (typeof evaluated === 'number') {
|
525
|
-
evaluated = evaluated.toFixed(this.numberPrecision)
|
468
|
+
data() {
|
469
|
+
return {
|
470
|
+
textInput: '',
|
471
|
+
isFocused: false,
|
472
|
+
warningIcon: warningIcon
|
526
473
|
}
|
527
|
-
return evaluated
|
528
474
|
},
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
}
|
539
|
-
|
540
|
-
|
541
|
-
return []
|
475
|
+
computed: {
|
476
|
+
displayedPlaceholder() {
|
477
|
+
if (this.placeholder) return this.placeholder
|
478
|
+
if (this.defaultNumber)
|
479
|
+
return `${this.defaultNumber} ${this.unitName ? this.unitName : ''}`
|
480
|
+
return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
|
481
|
+
},
|
482
|
+
hasSlot() {
|
483
|
+
return !!this.$slots.default
|
484
|
+
},
|
485
|
+
hasLabelSlot() {
|
486
|
+
return !!this.$slots.label
|
542
487
|
}
|
543
|
-
// Remove non-numeric items after the last number
|
544
|
-
if (lastNumberIndex !== -1) {
|
545
|
-
const newArray = array.slice(0, lastNumberIndex + 1)
|
546
|
-
return newArray
|
547
|
-
}
|
548
|
-
return array
|
549
488
|
},
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
} finally {
|
561
|
-
if (evaluatedVal && this.value != evaluatedVal) {
|
562
|
-
this.$emit('on-input', evaluatedVal)
|
489
|
+
watch: {
|
490
|
+
focus(value) {
|
491
|
+
if (value) {
|
492
|
+
this.focusInput()
|
493
|
+
}
|
494
|
+
},
|
495
|
+
clearInput: function(value) {
|
496
|
+
if (value) {
|
497
|
+
// If the value is typed, then we should clear the textInput on Continue
|
498
|
+
this.textInput = ''
|
563
499
|
}
|
564
500
|
}
|
565
501
|
},
|
566
|
-
|
567
|
-
this.
|
568
|
-
let value = e.target.value
|
569
|
-
let evaluatedInput = this.onEvaluateCode(e)
|
570
|
-
this.onChangeHandler(evaluatedInput ? evaluatedInput : value)
|
571
|
-
if ((evaluatedInput && value.length) || this.minNumber !== null) {
|
502
|
+
created() {
|
503
|
+
if (this.value) {
|
572
504
|
this.textInput = numberToString({
|
573
|
-
value:
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
505
|
+
value: this.value,
|
506
|
+
numberPrecision: this.numberPrecision,
|
507
|
+
minDecimals: this.minDecimals
|
508
|
+
})
|
509
|
+
} else if (this.defaultNumber !== null) {
|
510
|
+
this.textInput = numberToString({
|
511
|
+
value: this.defaultNumber,
|
512
|
+
numberPrecision: this.numberPrecision,
|
513
|
+
minDecimals: this.minDecimals
|
514
|
+
})
|
515
|
+
} else if (this.minNumber !== null) {
|
516
|
+
this.textInput = numberToString({
|
517
|
+
value: this.minNumber,
|
579
518
|
numberPrecision: this.numberPrecision,
|
580
519
|
minDecimals: this.minDecimals
|
581
520
|
})
|
582
521
|
}
|
583
|
-
let adjustedMinValue =
|
584
|
-
evaluatedInput && evaluatedInput.length
|
585
|
-
? evaluatedInput
|
586
|
-
: this.defaultNumber
|
587
|
-
? this.defaultNumber
|
588
|
-
: this.minNumber || this.minNumber === 0
|
589
|
-
? this.minNumber
|
590
|
-
: ''
|
591
|
-
this.$emit('input-blur', adjustedMinValue)
|
592
522
|
},
|
593
|
-
|
594
|
-
if (this.
|
595
|
-
|
523
|
+
mounted() {
|
524
|
+
if (this.focus) {
|
525
|
+
this.focusInput()
|
596
526
|
}
|
597
|
-
this.isFocused = true
|
598
|
-
this.$nextTick(() => {
|
599
|
-
this.$refs.inputField1.$el.select()
|
600
|
-
})
|
601
|
-
this.$emit('input-focus')
|
602
527
|
},
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
}
|
607
|
-
this.isFocused = false
|
608
|
-
this.$nextTick(() => {
|
528
|
+
methods: {
|
529
|
+
onEnterPress() {
|
530
|
+
this.$emit('on-enter-click')
|
609
531
|
this.$refs.inputField1.$el.blur()
|
610
|
-
}
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
532
|
+
},
|
533
|
+
onChangeHandler(event) {
|
534
|
+
if (isNaN(event) || event === '') {
|
535
|
+
event = this.defaultNumber
|
536
|
+
? this.defaultNumber
|
537
|
+
: this.minNumber || this.minNumber === 0
|
538
|
+
? this.minNumber
|
539
|
+
: event
|
540
|
+
}
|
541
|
+
if (!this.allowNegative) {
|
542
|
+
event = Math.abs(event)
|
543
|
+
}
|
544
|
+
event = parseFloat(event)
|
545
|
+
// Need to return an integer rather than a string
|
546
|
+
this.$emit('input-change', event)
|
547
|
+
},
|
548
|
+
onEvaluateCode(event) {
|
549
|
+
// function to perform math on the code
|
550
|
+
// filter the string in case of any malicious content
|
551
|
+
const val = event.target.value
|
552
|
+
let filtered = val.replace('(auto)', '').replace(/[^-()\d/*+.,]/g, '')
|
553
|
+
filtered = filtered.split(/([-+*/()])/)
|
554
|
+
let formatted = filtered.map((item) => {
|
555
|
+
if (
|
556
|
+
item === '+' ||
|
557
|
+
item === '-' ||
|
558
|
+
item === '*' ||
|
559
|
+
item === '/' ||
|
560
|
+
item === '(' ||
|
561
|
+
item === ')' ||
|
562
|
+
item === ''
|
563
|
+
) {
|
564
|
+
return item
|
565
|
+
} else {
|
566
|
+
let num = stringToNumber({
|
567
|
+
value: item,
|
568
|
+
numberPrecision: false,
|
569
|
+
minDecimals: this.minDecimals
|
570
|
+
})
|
571
|
+
return num
|
572
|
+
}
|
573
|
+
})
|
574
|
+
let evaluated
|
575
|
+
formatted = this.removeStringItemsAfterLastNumber(formatted)
|
576
|
+
evaluated = eval(formatted.join(' '))
|
577
|
+
if (typeof evaluated === 'string') {
|
578
|
+
evaluated = stringToNumber({
|
579
|
+
value: evaluated,
|
580
|
+
numberPrecision: this.numberPrecision,
|
581
|
+
minDecimals: this.minDecimals
|
582
|
+
})
|
583
|
+
} else if (typeof evaluated === 'number') {
|
584
|
+
evaluated = evaluated.toFixed(this.numberPrecision)
|
585
|
+
}
|
586
|
+
return evaluated
|
587
|
+
},
|
588
|
+
removeStringItemsAfterLastNumber(array) {
|
589
|
+
// fixed in EPDM-6487, in order to prevent 'Unexpected end of input'
|
590
|
+
let lastNumberIndex = -1
|
591
|
+
// Find the index of the last number in the array
|
592
|
+
for (let i = array.length - 1; i >= 0; i--) {
|
593
|
+
if (typeof array[i] === 'number') {
|
594
|
+
lastNumberIndex = i
|
595
|
+
break
|
596
|
+
}
|
597
|
+
}
|
598
|
+
// if there are no numbers, return an empty array
|
599
|
+
if (lastNumberIndex === -1) {
|
600
|
+
return []
|
601
|
+
}
|
602
|
+
// Remove non-numeric items after the last number
|
603
|
+
if (lastNumberIndex !== -1) {
|
604
|
+
const newArray = array.slice(0, lastNumberIndex + 1)
|
605
|
+
return newArray
|
606
|
+
}
|
607
|
+
return array
|
608
|
+
},
|
609
|
+
onInput(event) {
|
610
|
+
if (!this.isFocused) {
|
611
|
+
return
|
612
|
+
}
|
613
|
+
if (event.target.value === '') {
|
614
|
+
this.$emit('on-input', '')
|
615
|
+
}
|
616
|
+
let evaluatedVal
|
617
|
+
try {
|
618
|
+
evaluatedVal = this.onEvaluateCode(event)
|
619
|
+
} finally {
|
620
|
+
if (evaluatedVal && this.value != evaluatedVal) {
|
621
|
+
this.$emit('on-input', evaluatedVal)
|
622
|
+
}
|
623
|
+
}
|
624
|
+
},
|
625
|
+
onInputBlur(e) {
|
626
|
+
this.isFocused = false
|
627
|
+
let value = e.target.value
|
628
|
+
let evaluatedInput = this.onEvaluateCode(e)
|
629
|
+
this.onChangeHandler(evaluatedInput ? evaluatedInput : value)
|
630
|
+
if ((evaluatedInput && value.length) || this.minNumber !== null) {
|
631
|
+
this.textInput = numberToString({
|
632
|
+
value:
|
633
|
+
evaluatedInput && value.length
|
634
|
+
? evaluatedInput
|
635
|
+
: this.defaultNumber
|
636
|
+
? this.defaultNumber
|
637
|
+
: this.minNumber,
|
638
|
+
numberPrecision: this.numberPrecision,
|
639
|
+
minDecimals: this.minDecimals
|
640
|
+
})
|
641
|
+
}
|
642
|
+
let adjustedMinValue =
|
643
|
+
evaluatedInput && evaluatedInput.length
|
644
|
+
? evaluatedInput
|
645
|
+
: this.defaultNumber
|
646
|
+
? this.defaultNumber
|
647
|
+
: this.minNumber || this.minNumber === 0
|
648
|
+
? this.minNumber
|
649
|
+
: ''
|
650
|
+
this.$emit('input-blur', adjustedMinValue)
|
651
|
+
},
|
652
|
+
focusInput() {
|
653
|
+
if (this.disabled) {
|
654
|
+
return
|
655
|
+
}
|
656
|
+
this.isFocused = true
|
657
|
+
this.$nextTick(() => {
|
658
|
+
this.$refs.inputField1.$el.select()
|
659
|
+
})
|
660
|
+
this.$emit('input-focus')
|
661
|
+
},
|
662
|
+
blurInput() {
|
663
|
+
if (this.disabled) {
|
664
|
+
return
|
665
|
+
}
|
666
|
+
this.isFocused = false
|
667
|
+
this.$nextTick(() => {
|
668
|
+
this.$refs.inputField1.$el.blur()
|
669
|
+
})
|
670
|
+
},
|
671
|
+
formatWithCurrency(value) {
|
672
|
+
let adjustedMinValue =
|
673
|
+
value || value === 0
|
674
|
+
? value
|
675
|
+
: this.defaultNumber
|
676
|
+
? this.defaultNumber
|
677
|
+
: this.minNumber || this.minNumber === 0
|
678
|
+
? this.minNumber
|
679
|
+
: ''
|
680
|
+
if ((adjustedMinValue || adjustedMinValue === 0) && !this.isFocused) {
|
681
|
+
let input = this.numberToStringEnabled
|
682
|
+
? numberToString({
|
624
683
|
value: adjustedMinValue,
|
625
684
|
numberPrecision: this.numberPrecision,
|
626
685
|
minDecimals: this.minDecimals
|
627
686
|
})
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
687
|
+
: adjustedMinValue
|
688
|
+
let unit = this.showLinearUnitName ? '' : this.unitName
|
689
|
+
//return input + ' ' + unit
|
690
|
+
return input + ' ' + unit
|
691
|
+
} else if (!adjustedMinValue && adjustedMinValue !== 0) {
|
692
|
+
return ''
|
693
|
+
} else {
|
694
|
+
return this.numberToStringEnabled
|
695
|
+
? numberToString({
|
637
696
|
value: adjustedMinValue,
|
638
697
|
numberPrecision: this.numberPrecision,
|
639
698
|
minDecimals: this.minDecimals
|
640
699
|
})
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
700
|
+
: adjustedMinValue
|
701
|
+
}
|
702
|
+
},
|
703
|
+
initInteraction(e) {
|
704
|
+
this.focusInput()
|
705
|
+
e.preventDefault()
|
706
|
+
window.addEventListener('mousemove', this.interact, false)
|
707
|
+
window.addEventListener('mouseup', this.stopInteract, false)
|
708
|
+
},
|
709
|
+
interact(e) {
|
710
|
+
e.preventDefault()
|
711
|
+
let value = parseFloat(this.value || 0)
|
712
|
+
value += parseFloat(this.interactionStep) * parseInt(e.movementX)
|
713
|
+
this.$emit('on-input-drag', value)
|
655
714
|
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
715
|
+
this.textInput = numberToString({
|
716
|
+
value: value && value.length ? value : this.minNumber,
|
717
|
+
numberPrecision: this.numberPrecision,
|
718
|
+
minDecimals: this.minDecimals
|
719
|
+
})
|
661
720
|
//this.value=value
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
}
|
669
|
-
},
|
670
|
-
created() {
|
671
|
-
if (this.value) {
|
672
|
-
this.textInput = numberToString({
|
673
|
-
value: this.value,
|
674
|
-
numberPrecision: this.numberPrecision,
|
675
|
-
minDecimals: this.minDecimals
|
676
|
-
})
|
677
|
-
} else if (this.defaultNumber !== null) {
|
678
|
-
this.textInput = numberToString({
|
679
|
-
value: this.defaultNumber,
|
680
|
-
numberPrecision: this.numberPrecision,
|
681
|
-
minDecimals: this.minDecimals
|
682
|
-
})
|
683
|
-
} else if (this.minNumber !== null) {
|
684
|
-
this.textInput = numberToString({
|
685
|
-
value: this.minNumber,
|
686
|
-
numberPrecision: this.numberPrecision,
|
687
|
-
minDecimals: this.minDecimals
|
688
|
-
})
|
689
|
-
}
|
690
|
-
},
|
691
|
-
mounted() {
|
692
|
-
if (this.focus) {
|
693
|
-
this.focusInput()
|
694
|
-
}
|
695
|
-
},
|
696
|
-
watch: {
|
697
|
-
focus(value) {
|
698
|
-
if (value) {
|
699
|
-
this.focusInput()
|
700
|
-
}
|
701
|
-
},
|
702
|
-
clearInput: function (value) {
|
703
|
-
if (value) {
|
704
|
-
// If the value is typed, then we should clear the textInput on Continue
|
705
|
-
this.textInput = ''
|
721
|
+
},
|
722
|
+
stopInteract(e) {
|
723
|
+
e.preventDefault()
|
724
|
+
window.removeEventListener('mousemove', this.interact, false)
|
725
|
+
window.removeEventListener('mouseup', this.stopInteract, false)
|
726
|
+
this.blurInput()
|
706
727
|
}
|
707
728
|
}
|
708
729
|
}
|
709
|
-
}
|
710
730
|
</script>
|