@eturnity/eturnity_reusable_components 8.19.8-EPDM-14690.1 → 8.19.8-EPDM-6306.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/components/barchart/BottomFields.vue +37 -125
- package/src/components/barchart/composables/useAxisCalculations.js +1 -1
- package/src/components/barchart/composables/useChartData.js +1 -1
- package/src/components/barchart/composables/useTooltip.js +3 -28
- package/src/components/barchart/index.vue +15 -53
- package/src/components/barchart/styles/bottomFields.js +4 -18
- package/src/components/barchart/styles/chart.js +0 -1
- package/src/components/errorMessage/index.vue +1 -1
- package/src/components/infoCard/index.vue +3 -15
- package/src/components/infoCard/infoCard.spec.js +3 -3
- package/src/components/infoText/index.vue +31 -36
- package/src/components/inputs/inputNumber/index.vue +73 -161
- package/src/components/pageTitle/index.vue +1 -0
- package/src/helpers/numberConverter.js +1 -1
- package/src/TestChart.vue +0 -229
@@ -15,40 +15,37 @@
|
|
15
15
|
:is-disabled="isDisabled"
|
16
16
|
:padding="padding"
|
17
17
|
>
|
18
|
-
<
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
</LabelWrapper>
|
47
|
-
</template>
|
48
|
-
<slot name="trigger"></slot>
|
18
|
+
<LabelWrapper
|
19
|
+
v-if="labelText && labelAlign === 'left'"
|
20
|
+
:color="iconColor || computedIconColor"
|
21
|
+
:size="labelSize"
|
22
|
+
>
|
23
|
+
{{ labelText }}
|
24
|
+
</LabelWrapper>
|
25
|
+
<Dot
|
26
|
+
v-if="type === 'dot'"
|
27
|
+
:color="dotColor"
|
28
|
+
data-test-id="infoText_dot"
|
29
|
+
/>
|
30
|
+
<IconComponent
|
31
|
+
v-else-if="!noIcon"
|
32
|
+
:color="iconColor || computedIconColor"
|
33
|
+
:cursor="isDisabled ? 'not-allowed' : 'pointer'"
|
34
|
+
:disabled="isDisabled"
|
35
|
+
:hovered-color="iconColor || computedIconColor"
|
36
|
+
:name="iconName"
|
37
|
+
:size="size"
|
38
|
+
/>
|
39
|
+
<LabelWrapper
|
40
|
+
v-if="labelText && labelAlign === 'right'"
|
41
|
+
:color="iconColor || computedIconColor"
|
42
|
+
:size="labelSize"
|
43
|
+
>
|
44
|
+
{{ labelText }}
|
45
|
+
</LabelWrapper>
|
49
46
|
</IconWrapper>
|
50
47
|
</div>
|
51
|
-
<Teleport v-if="isVisible
|
48
|
+
<Teleport v-if="isVisible" to="body">
|
52
49
|
<TextWrapper data-test-id="info_text_wrapper" :style="wrapperStyle">
|
53
50
|
<TextOverlay
|
54
51
|
ref="infoBox"
|
@@ -230,7 +227,7 @@
|
|
230
227
|
},
|
231
228
|
infoPosition: {
|
232
229
|
required: false,
|
233
|
-
default:
|
230
|
+
default: 'bottom',
|
234
231
|
type: String,
|
235
232
|
},
|
236
233
|
maxWidth: {
|
@@ -366,9 +363,7 @@
|
|
366
363
|
{ position: 'left', space: spaceLeft },
|
367
364
|
].sort((a, b) => b.space - a.space)
|
368
365
|
|
369
|
-
const bestPosition =
|
370
|
-
? props.infoPosition
|
371
|
-
: positions[0].position
|
366
|
+
const bestPosition = positions[0].position
|
372
367
|
|
373
368
|
let top, left, arrowPosition
|
374
369
|
|
@@ -30,61 +30,7 @@
|
|
30
30
|
/>
|
31
31
|
</LabelWrapper>
|
32
32
|
<InputWrapper>
|
33
|
-
<InfoText
|
34
|
-
v-if="!!inputInfoText"
|
35
|
-
info-position="bottom"
|
36
|
-
:text="inputInfoText"
|
37
|
-
>
|
38
|
-
<template #trigger>
|
39
|
-
<InputContainer
|
40
|
-
v-bind="$attrs"
|
41
|
-
ref="inputField1"
|
42
|
-
:align-items="alignItems"
|
43
|
-
:background-color="
|
44
|
-
colorMode === 'transparent' ? 'transparent' : backgroundColor
|
45
|
-
"
|
46
|
-
:border-color="
|
47
|
-
colorMode === 'transparent' && !borderColor
|
48
|
-
? 'white'
|
49
|
-
: borderColor
|
50
|
-
"
|
51
|
-
:color-mode="colorMode"
|
52
|
-
:data-id="inputDataId"
|
53
|
-
:data-qa-id="dataQaId"
|
54
|
-
:disabled="disabled"
|
55
|
-
:font-color="colorMode === 'transparent' ? 'white' : fontColor"
|
56
|
-
:font-size="fontSize"
|
57
|
-
:has-label-slot="hasLabelSlot"
|
58
|
-
:has-slot="hasSlot"
|
59
|
-
:has-unit="unitName && !!unitName.length"
|
60
|
-
:input-height="inputHeight"
|
61
|
-
:is-border-error-only="isBorderErrorOnly"
|
62
|
-
:is-disabled="disabled"
|
63
|
-
:is-error="isError"
|
64
|
-
:is-info-border="isInfoBorder"
|
65
|
-
:is-interactive="isInteractive"
|
66
|
-
:min-width="minWidth"
|
67
|
-
:no-border="noBorder"
|
68
|
-
:placeholder="displayedPlaceholder"
|
69
|
-
:read-only="isReadOnly"
|
70
|
-
:readonly="isReadOnly"
|
71
|
-
:show-arrow-controls="showArrowControls"
|
72
|
-
:show-linear-unit-name="showLinearUnitName"
|
73
|
-
:slot-size="slotSize"
|
74
|
-
:text-align="textAlign"
|
75
|
-
:value="formatWithCurrency(value)"
|
76
|
-
@blur="onInputBlur($event)"
|
77
|
-
@focus="focusInput()"
|
78
|
-
@input="onInput($event)"
|
79
|
-
@keydown.down="decrementValue"
|
80
|
-
@keydown.up="incrementValue"
|
81
|
-
@keyup.enter="onEnterPress"
|
82
|
-
/>
|
83
|
-
</template>
|
84
|
-
</InfoText>
|
85
|
-
|
86
33
|
<InputContainer
|
87
|
-
v-else
|
88
34
|
v-bind="$attrs"
|
89
35
|
ref="inputField1"
|
90
36
|
:align-items="alignItems"
|
@@ -104,21 +50,18 @@
|
|
104
50
|
:has-slot="hasSlot"
|
105
51
|
:has-unit="unitName && !!unitName.length"
|
106
52
|
:input-height="inputHeight"
|
107
|
-
:is-border-error-only="isBorderErrorOnly"
|
108
53
|
:is-disabled="disabled"
|
109
54
|
:is-error="isError"
|
110
|
-
:is-info-border="isInfoBorder"
|
111
55
|
:is-interactive="isInteractive"
|
112
56
|
:min-width="minWidth"
|
113
57
|
:no-border="noBorder"
|
114
58
|
:placeholder="displayedPlaceholder"
|
115
59
|
:read-only="isReadOnly"
|
116
|
-
:readonly="isReadOnly"
|
117
60
|
:show-arrow-controls="showArrowControls"
|
118
61
|
:show-linear-unit-name="showLinearUnitName"
|
119
62
|
:slot-size="slotSize"
|
120
63
|
:text-align="textAlign"
|
121
|
-
:value="
|
64
|
+
:value="formattedValue"
|
122
65
|
@blur="onInputBlur($event)"
|
123
66
|
@focus="focusInput()"
|
124
67
|
@input="onInput($event)"
|
@@ -126,19 +69,18 @@
|
|
126
69
|
@keydown.up="incrementValue"
|
127
70
|
@keyup.enter="onEnterPress"
|
128
71
|
/>
|
129
|
-
|
130
72
|
<SlotContainer v-if="hasSlot" :is-error="isError" :slot-size="slotSize">
|
131
73
|
<slot></slot>
|
132
74
|
</SlotContainer>
|
133
75
|
|
134
76
|
<UnitContainer
|
135
77
|
v-if="unitName && showLinearUnitName && !hasSlot"
|
136
|
-
:has-length="
|
78
|
+
:has-length="hasLength"
|
137
79
|
:is-error="isError"
|
138
80
|
>{{ unitName }}</UnitContainer
|
139
81
|
>
|
140
82
|
<IconWrapper
|
141
|
-
v-if="isError && !showLinearUnitName
|
83
|
+
v-if="isError && !showLinearUnitName"
|
142
84
|
:margin-right="showSelect ? selectWidth : 0"
|
143
85
|
size="16px"
|
144
86
|
>
|
@@ -150,7 +92,7 @@
|
|
150
92
|
:disabled="isSelectDisabled"
|
151
93
|
:select-width="`${selectWidth}px`"
|
152
94
|
:show-border="false"
|
153
|
-
@input-change="
|
95
|
+
@input-change="handleSelectChange"
|
154
96
|
>
|
155
97
|
<template #selector>
|
156
98
|
<SelectText>{{ getSelectValue }}</SelectText>
|
@@ -192,9 +134,7 @@
|
|
192
134
|
</ArrowButton>
|
193
135
|
</ArrowControls>
|
194
136
|
</InputWrapper>
|
195
|
-
<ErrorMessage v-if="isError
|
196
|
-
errorMessage
|
197
|
-
}}</ErrorMessage>
|
137
|
+
<ErrorMessage v-if="isError">{{ errorMessage }}</ErrorMessage>
|
198
138
|
</Container>
|
199
139
|
</template>
|
200
140
|
|
@@ -265,8 +205,6 @@
|
|
265
205
|
colorMode: String,
|
266
206
|
showArrowControls: Boolean,
|
267
207
|
readOnly: Boolean,
|
268
|
-
isBorderErrorOnly: Boolean,
|
269
|
-
isInfoBorder: Boolean,
|
270
208
|
}
|
271
209
|
|
272
210
|
const Container = styled('div', inputProps)`
|
@@ -279,9 +217,7 @@
|
|
279
217
|
|
280
218
|
const InputContainer = styled('input', inputProps)`
|
281
219
|
border: ${(props) =>
|
282
|
-
props.
|
283
|
-
? '1px solid ' + props.theme.semanticColors.blue[500]
|
284
|
-
: props.isError
|
220
|
+
props.isError
|
285
221
|
? '1px solid ' + props.theme.colors.red
|
286
222
|
: props.noBorder
|
287
223
|
? 'none'
|
@@ -300,17 +236,16 @@
|
|
300
236
|
showLinearUnitName,
|
301
237
|
colorMode,
|
302
238
|
showArrowControls,
|
303
|
-
isBorderErrorOnly,
|
304
239
|
}) =>
|
305
240
|
showArrowControls
|
306
241
|
? '40px'
|
307
242
|
: colorMode === 'transparent'
|
308
243
|
? '0'
|
309
244
|
: slotSize
|
310
|
-
? isError && !showLinearUnitName
|
245
|
+
? isError && !showLinearUnitName
|
311
246
|
? 'calc(' + slotSize + ' + 24px)'
|
312
247
|
: 'calc(' + slotSize + ' + 10px)'
|
313
|
-
: isError && !showLinearUnitName
|
248
|
+
: isError && !showLinearUnitName
|
314
249
|
? '24px'
|
315
250
|
: '5px'};
|
316
251
|
border-radius: ${(props) =>
|
@@ -522,8 +457,18 @@
|
|
522
457
|
background-color: ${({ theme }) => theme.colors.grey4};
|
523
458
|
`
|
524
459
|
|
460
|
+
const EVENT_TYPES = {
|
461
|
+
INPUT_FOCUS: 'input-focus',
|
462
|
+
INPUT_CHANGE: 'input-change',
|
463
|
+
INPUT_BLUR: 'input-blur',
|
464
|
+
PRESS_ENTER: 'on-enter-click',
|
465
|
+
INPUT_DRAG: 'on-input-drag',
|
466
|
+
SELECT_CHANGE: 'select-change',
|
467
|
+
}
|
468
|
+
|
525
469
|
export default {
|
526
470
|
name: 'InputNumber',
|
471
|
+
emits: [...Object.values(EVENT_TYPES)],
|
527
472
|
components: {
|
528
473
|
Container,
|
529
474
|
InputContainer,
|
@@ -764,24 +709,13 @@
|
|
764
709
|
type: Boolean,
|
765
710
|
default: false,
|
766
711
|
},
|
767
|
-
isBorderErrorOnly: {
|
768
|
-
type: Boolean,
|
769
|
-
default: false,
|
770
|
-
},
|
771
|
-
isInfoBorder: {
|
772
|
-
type: Boolean,
|
773
|
-
default: false,
|
774
|
-
},
|
775
|
-
inputInfoText: {
|
776
|
-
type: String,
|
777
|
-
default: '',
|
778
|
-
},
|
779
712
|
},
|
780
713
|
data() {
|
781
714
|
return {
|
782
|
-
textInput: '',
|
783
715
|
isFocused: false,
|
784
716
|
warningIcon: warningIcon,
|
717
|
+
inputValue: null,
|
718
|
+
enteredValue: null,
|
785
719
|
}
|
786
720
|
},
|
787
721
|
computed: {
|
@@ -804,6 +738,14 @@
|
|
804
738
|
|
805
739
|
return item ? item.label : '-'
|
806
740
|
},
|
741
|
+
formattedValue() {
|
742
|
+
return this.isFocused
|
743
|
+
? this.enteredValue
|
744
|
+
: this.formatWithCurrency(this.value)
|
745
|
+
},
|
746
|
+
hasLength() {
|
747
|
+
return this.formattedValue !== null && this.formattedValue.length > 0
|
748
|
+
},
|
807
749
|
},
|
808
750
|
watch: {
|
809
751
|
focus(value) {
|
@@ -814,30 +756,19 @@
|
|
814
756
|
clearInput: function (value) {
|
815
757
|
if (value) {
|
816
758
|
// If the value is typed, then we should clear the textInput on Continue
|
817
|
-
this.
|
759
|
+
this.inputValue = ''
|
760
|
+
this.enteredValue = ''
|
818
761
|
}
|
819
762
|
},
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
}
|
828
|
-
}
|
829
|
-
this.textInput = numberToString({
|
830
|
-
value: this.defaultNumber,
|
831
|
-
numberPrecision: this.numberPrecision,
|
832
|
-
minDecimals: this.minDecimals,
|
833
|
-
})
|
834
|
-
} else if (this.minNumber !== null) {
|
835
|
-
this.textInput = numberToString({
|
836
|
-
value: this.minNumber,
|
837
|
-
numberPrecision: this.numberPrecision,
|
838
|
-
minDecimals: this.minDecimals,
|
839
|
-
})
|
840
|
-
}
|
763
|
+
value: {
|
764
|
+
immediate: true,
|
765
|
+
handler(val) {
|
766
|
+
if (this.value !== this.inputValue && !Number.isNaN(this.value)) {
|
767
|
+
this.inputValue = this.value
|
768
|
+
this.enteredValue = Number(this.value.toFixed(this.numberPrecision))
|
769
|
+
}
|
770
|
+
},
|
771
|
+
},
|
841
772
|
},
|
842
773
|
mounted() {
|
843
774
|
if (this.focus) {
|
@@ -876,32 +807,31 @@
|
|
876
807
|
}
|
877
808
|
},
|
878
809
|
onEnterPress() {
|
879
|
-
this.$emit(
|
810
|
+
this.$emit(EVENT_TYPES.PRESS_ENTER)
|
880
811
|
this.$refs.inputField1.$el.blur()
|
881
812
|
},
|
882
|
-
onChangeHandler(
|
883
|
-
if (isNaN(
|
884
|
-
|
813
|
+
onChangeHandler(value) {
|
814
|
+
if (isNaN(value) || value === '') {
|
815
|
+
value = this.defaultNumber
|
885
816
|
? this.defaultNumber
|
886
817
|
: this.minNumber || this.minNumber === 0
|
887
818
|
? this.minNumber
|
888
|
-
:
|
819
|
+
: value
|
889
820
|
}
|
890
821
|
if (!this.allowNegative) {
|
891
|
-
|
822
|
+
value = Math.abs(value)
|
892
823
|
}
|
893
|
-
if (this.minNumber && this.minNumber >
|
894
|
-
|
824
|
+
if (this.minNumber && this.minNumber > value) {
|
825
|
+
value = this.minNumber
|
895
826
|
}
|
896
|
-
event = parseFloat(event)
|
897
827
|
// Need to return an integer rather than a string
|
898
|
-
|
828
|
+
value = parseFloat(value)
|
829
|
+
return value
|
899
830
|
},
|
900
|
-
onEvaluateCode(
|
831
|
+
onEvaluateCode(value) {
|
901
832
|
// function to perform math on the code
|
902
833
|
// filter the string in case of any malicious content
|
903
|
-
|
904
|
-
let filtered = val.replace('(auto)', '').replace(/[^-()\d/*+.,]/g, '')
|
834
|
+
let filtered = value.replace('(auto)', '').replace(/[^-()\d/*+.,]/g, '')
|
905
835
|
filtered = filtered.split(/([-+*/()])/)
|
906
836
|
let formatted = filtered.map((item) => {
|
907
837
|
if (
|
@@ -959,48 +889,32 @@
|
|
959
889
|
return array
|
960
890
|
},
|
961
891
|
onInput(event) {
|
962
|
-
|
892
|
+
console.log('onInput', event.target.value)
|
893
|
+
this.enteredValue = event.target.value
|
894
|
+
if (!this.isFocused || this.enteredValue === this.inputValue) {
|
963
895
|
return
|
964
896
|
}
|
965
|
-
if (event.target.value === '') {
|
966
|
-
this.$emit('on-input', '')
|
967
|
-
}
|
968
897
|
let evaluatedVal
|
969
898
|
try {
|
970
|
-
evaluatedVal = this.onEvaluateCode(
|
899
|
+
evaluatedVal = this.onEvaluateCode(String(this.enteredValue))
|
971
900
|
} finally {
|
972
|
-
|
973
|
-
|
901
|
+
this.inputValue = this.onChangeHandler(evaluatedVal)
|
902
|
+
|
903
|
+
if (this.isFocused && typeof this.enteredValue !== 'number') {
|
904
|
+
this.$emit(EVENT_TYPES.INPUT_CHANGE, this.inputValue)
|
974
905
|
}
|
975
906
|
}
|
976
907
|
this.textInput = evaluatedVal
|
977
908
|
},
|
978
909
|
onInputBlur(e) {
|
979
910
|
this.isFocused = false
|
980
|
-
|
981
|
-
|
982
|
-
this.onChangeHandler(evaluatedInput ? evaluatedInput : value)
|
983
|
-
if ((evaluatedInput && value.length) || this.minNumber !== null) {
|
984
|
-
this.textInput = numberToString({
|
985
|
-
value:
|
986
|
-
evaluatedInput && value.length
|
987
|
-
? evaluatedInput
|
988
|
-
: this.defaultNumber
|
989
|
-
? this.defaultNumber
|
990
|
-
: this.minNumber,
|
991
|
-
numberPrecision: this.numberPrecision,
|
992
|
-
minDecimals: this.minDecimals,
|
993
|
-
})
|
911
|
+
if (!Number.isNaN(this.inputValue)) {
|
912
|
+
this.enteredValue = this.inputValue
|
994
913
|
}
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
? this.defaultNumber
|
1000
|
-
: this.minNumber || this.minNumber === 0
|
1001
|
-
? this.minNumber
|
1002
|
-
: ''
|
1003
|
-
this.$emit('input-blur', adjustedMinValue)
|
914
|
+
this.$emit(
|
915
|
+
EVENT_TYPES.INPUT_BLUR,
|
916
|
+
Number(this.onEvaluateCode(String(this.inputValue)))
|
917
|
+
)
|
1004
918
|
},
|
1005
919
|
focusInput() {
|
1006
920
|
if (this.disabled) {
|
@@ -1010,7 +924,7 @@
|
|
1010
924
|
this.$nextTick(() => {
|
1011
925
|
this.$refs.inputField1.$el.select()
|
1012
926
|
})
|
1013
|
-
this.$emit(
|
927
|
+
this.$emit(EVENT_TYPES.INPUT_FOCUS, this.inputValue)
|
1014
928
|
},
|
1015
929
|
blurInput() {
|
1016
930
|
if (this.disabled) {
|
@@ -1030,7 +944,7 @@
|
|
1030
944
|
: this.minNumber || this.minNumber === 0
|
1031
945
|
? this.minNumber
|
1032
946
|
: ''
|
1033
|
-
if (
|
947
|
+
if (adjustedMinValue || adjustedMinValue === 0) {
|
1034
948
|
let input = this.numberToStringEnabled
|
1035
949
|
? numberToString({
|
1036
950
|
value: adjustedMinValue,
|
@@ -1043,6 +957,8 @@
|
|
1043
957
|
return input + ' ' + unit
|
1044
958
|
} else if (!adjustedMinValue && adjustedMinValue !== 0) {
|
1045
959
|
return ''
|
960
|
+
} else if (this.isFocused) {
|
961
|
+
return value
|
1046
962
|
} else {
|
1047
963
|
return this.numberToStringEnabled
|
1048
964
|
? numberToString({
|
@@ -1063,14 +979,7 @@
|
|
1063
979
|
e.preventDefault()
|
1064
980
|
let value = parseFloat(this.value || 0)
|
1065
981
|
value += parseFloat(this.interactionStep) * parseInt(e.movementX)
|
1066
|
-
this.$emit(
|
1067
|
-
|
1068
|
-
this.textInput = numberToString({
|
1069
|
-
value: value && value.length ? value : this.minNumber,
|
1070
|
-
numberPrecision: this.numberPrecision,
|
1071
|
-
minDecimals: this.minDecimals,
|
1072
|
-
})
|
1073
|
-
//this.value=value
|
982
|
+
this.$emit(EVENT_TYPES.INPUT_DRAG, this.onChangeHandler(value))
|
1074
983
|
},
|
1075
984
|
stopInteract(e) {
|
1076
985
|
e.preventDefault()
|
@@ -1078,6 +987,9 @@
|
|
1078
987
|
window.removeEventListener('mouseup', this.stopInteract, false)
|
1079
988
|
this.blurInput()
|
1080
989
|
},
|
990
|
+
handleSelectChange(value) {
|
991
|
+
this.$emit(EVENT_TYPES.SELECT_CHANGE, value)
|
992
|
+
},
|
1081
993
|
},
|
1082
994
|
}
|
1083
995
|
</script>
|
@@ -46,6 +46,7 @@
|
|
46
46
|
color: ${(props) => (props.color ? props.color : props.theme.colors.black)};
|
47
47
|
font-weight: 600;
|
48
48
|
font-size: ${(props) => (props.fontSize ? props.fontSize : '20px')};
|
49
|
+
text-transform: ${(props) => (props.uppercase ? 'uppercase' : 'none')};
|
49
50
|
`
|
50
51
|
|
51
52
|
export default {
|
@@ -94,7 +94,7 @@ export const stringToNumber = ({
|
|
94
94
|
|
95
95
|
export const numberToString = ({ value, numberPrecision, minDecimals }) => {
|
96
96
|
const minimumRounding = minDecimals ? minDecimals : 0
|
97
|
-
value = parseFloat(value)
|
97
|
+
value = !Number.isNaN(parseFloat(value)) ? parseFloat(value) : 0
|
98
98
|
return value.toLocaleString(langForLocaleString(), {
|
99
99
|
minimumFractionDigits: minimumRounding, // removing this for now. Why do we need this to be a minimum amount?
|
100
100
|
maximumFractionDigits:
|