@eturnity/eturnity_reusable_components 8.22.16 → 8.22.18

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.
@@ -1002,12 +1002,23 @@
1002
1002
  this.textInput = evaluatedVal
1003
1003
  },
1004
1004
  onInputBlur(e) {
1005
+ const defaultNumber =
1006
+ this.defaultNumber || this.defaultNumber === 0
1007
+ ? this.defaultNumber
1008
+ : this.minNumber || this.minNumber === 0
1009
+ ? this.minNumber
1010
+ : null
1005
1011
  this.isFocused = false
1006
- const value = this.onEvaluateCode(this.enteredValue)
1007
- if (Number.isNaN(value) || value === undefined) {
1008
- this.$emit(EVENT_TYPES.INPUT_BLUR, this.inputValue)
1009
- } else {
1010
- this.$emit(EVENT_TYPES.INPUT_BLUR, value)
1012
+ let evaluatedVal
1013
+ try {
1014
+ evaluatedVal = this.onEvaluateCode(this.enteredValue)
1015
+ } finally {
1016
+ this.inputValue = this.onChangeHandler(evaluatedVal)
1017
+ if (isNaN(this.inputValue) && this.enteredval === undefined) {
1018
+ this.$emit(EVENT_TYPES.INPUT_BLUR, defaultNumber)
1019
+ } else if (!isNaN(this.inputValue)) {
1020
+ this.$emit(EVENT_TYPES.INPUT_BLUR, this.inputValue)
1021
+ }
1011
1022
  }
1012
1023
  },
1013
1024
  focusInput() {
@@ -1016,8 +1027,15 @@
1016
1027
  }
1017
1028
  this.isFocused = true
1018
1029
  this.textInput = this.formatWithCurrency(this.value)
1019
- this.inputValue = this.value
1020
- this.enteredValue = this.value
1030
+
1031
+ this.enteredValue = stringToNumber({
1032
+ value: this.textInput,
1033
+ numberPrecision: this.numberPrecision,
1034
+ minDecimals: this.minDecimals,
1035
+ })
1036
+ if (isNaN(this.enteredValue)) {
1037
+ this.enteredValue = ''
1038
+ }
1021
1039
  this.$nextTick(() => {
1022
1040
  this.$refs.inputField1.$el.select()
1023
1041
  })
@@ -1051,7 +1069,10 @@
1051
1069
  : adjustedMinValue
1052
1070
  let unit = this.showLinearUnitName ? '' : this.unitName
1053
1071
  //return input + ' ' + unit
1054
- return input + ' ' + unit
1072
+ if (unit) {
1073
+ return input + ' ' + unit
1074
+ }
1075
+ return input
1055
1076
  } else if (!adjustedMinValue && adjustedMinValue !== 0) {
1056
1077
  return ''
1057
1078
  } else if (this.isFocused) {