@eturnity/eturnity_reusable_components 1.2.16 → 1.2.17

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "1.2.16",
3
+ "version": "1.2.17",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -62,13 +62,6 @@ import theme from './assets/theme'
62
62
  import styled from 'vue-styled-components'
63
63
  import icon from '@/components/icon'
64
64
  import InputNumber from '@/components/inputs/inputNumber'
65
- import Checkbox from '@/components/inputs/checkbox'
66
- import PageSubtitle from '@/components/pageSubtitle'
67
- import Spinner from '@/components/spinner'
68
- import ExternalButton from '@/components/buttons/externalButton'
69
- import icon from '@/components/icon'
70
- import collection from '@/components/icons/iconCollection'
71
- // import TableDropdown from "@/components/tableDropdown"
72
65
 
73
66
  const PageContainer = styled.div`
74
67
  padding: 40px;
@@ -79,14 +72,8 @@ export default {
79
72
  components: {
80
73
  ThemeProvider,
81
74
  PageContainer,
82
- MainTable,
83
- ThreeDots,
84
- Toggle,
85
75
  InputNumber,
86
- icon,
87
- infoText,
88
- InputAnnexContainer
89
- // TableDropdown,
76
+ icon
90
77
  },
91
78
  data() {
92
79
  return {
@@ -208,4 +195,4 @@ body {
208
195
  height: 100%;
209
196
  margin: 0;
210
197
  }
211
- </style>
198
+ </style>
@@ -68,12 +68,12 @@
68
68
  // :minNumber="0"
69
69
  // fontColor="blue"
70
70
  // />
71
- import styled from "vue-styled-components"
71
+ import styled from 'vue-styled-components'
72
72
  import {
73
73
  stringToNumber,
74
- numberToString,
75
- } from "../../../helpers/numberConverter"
76
- import InfoText from "../../infoText"
74
+ numberToString
75
+ } from '../../../helpers/numberConverter'
76
+ import InfoText from '../../infoText'
77
77
 
78
78
  const Container = styled.div`
79
79
  width: 100%;
@@ -89,31 +89,31 @@ const inputProps = {
89
89
  noBorder: Boolean,
90
90
  textAlign: String,
91
91
  fontSize: String,
92
- fontColor: String,
92
+ fontColor: String
93
93
  }
94
- const InputContainer = styled("input", inputProps)`
94
+ const InputContainer = styled('input', inputProps)`
95
95
  border: ${(props) =>
96
96
  props.isError
97
- ? "1px solid " + props.theme.colors.red
97
+ ? '1px solid ' + props.theme.colors.red
98
98
  : props.noBorder
99
- ? "none"
100
- : "1px solid " + props.theme.colors.mediumGray};
99
+ ? 'none'
100
+ : '1px solid ' + props.theme.colors.mediumGray};
101
101
  padding: ${(props) =>
102
- props.hasUnit ? "11px 40px 11px 10px" : "11px 5px 11px 10px"};
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 ? "not-allowed" : "auto")};
106
- font-size: ${(props) => (props.fontSize ? props.fontSize : "13px")};
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 + " !important"
111
+ ? props.fontColor + ' !important'
112
112
  : props.theme.colors.black};
113
- width: ${(props) => (props.inputWidth ? props.inputWidth : "100%")};
114
- min-width: ${(props) => (props.minWidth ? props.minWidth : "unset")};
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 : "#fff"};
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("span", inputProps)`
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: "input-number",
172
+ name: 'input-number',
173
173
  components: {
174
174
  Container,
175
175
  InputContainer,
@@ -178,132 +178,134 @@ export default {
178
178
  ErrorMessage,
179
179
  LabelWrapper,
180
180
  LabelText,
181
- InfoText,
181
+ InfoText
182
182
  },
183
183
  data() {
184
184
  return {
185
- textInput: "",
186
- isFocused: false,
185
+ textInput: '',
186
+ isFocused: false
187
187
  }
188
188
  },
189
189
  props: {
190
190
  placeholder: {
191
191
  required: false,
192
- default: "",
192
+ default: ''
193
193
  },
194
194
  isError: {
195
195
  required: false,
196
- default: false,
196
+ default: false
197
197
  },
198
198
  inputWidth: {
199
199
  required: false,
200
- default: null,
200
+ default: null
201
201
  },
202
202
  minWidth: {
203
203
  required: false,
204
- default: null,
204
+ default: null
205
205
  },
206
206
  value: {
207
207
  required: true,
208
- default: null,
208
+ default: null
209
209
  },
210
210
  clearInput: {
211
211
  required: false,
212
- default: false,
212
+ default: false
213
213
  },
214
214
  errorMessage: {
215
215
  required: false,
216
- default: "Please insert a correct number",
216
+ default: 'Please insert a correct number'
217
217
  },
218
218
  numberPrecision: {
219
219
  required: false,
220
- default: 0,
220
+ default: 0
221
221
  },
222
222
  unitName: {
223
223
  required: false,
224
- default: "",
224
+ default: ''
225
225
  },
226
226
  showLinearUnitName: {
227
227
  required: false,
228
- default: false,
228
+ default: false
229
229
  },
230
230
  disabled: {
231
231
  required: false,
232
- default: false,
232
+ default: false
233
233
  },
234
234
  noBorder: {
235
235
  required: false,
236
- default: false,
236
+ default: false
237
237
  },
238
238
  textAlign: {
239
239
  required: false,
240
- default: "left",
240
+ default: 'left'
241
241
  },
242
242
  fontSize: {
243
243
  required: false,
244
- default: "13px",
244
+ default: '13px'
245
245
  },
246
246
  labelText: {
247
247
  required: false,
248
- default: null,
248
+ default: null
249
249
  },
250
250
  labelInfoText: {
251
251
  required: false,
252
- default: null,
252
+ default: null
253
253
  },
254
254
  labelInfoAlign: {
255
255
  required: false,
256
- default: "right",
256
+ default: 'right'
257
257
  },
258
258
  minNumber: {
259
259
  required: false,
260
- default: null,
260
+ default: null
261
261
  },
262
262
  fontColor: {
263
263
  required: false,
264
- default: null,
264
+ default: null
265
265
  },
266
266
  numberToStringEnabled: {
267
267
  required: false,
268
- default: true,
269
- },
268
+ default: true
269
+ }
270
270
  },
271
271
  methods: {
272
272
  onChangeHandler(event) {
273
273
  if (isNaN(event)) {
274
274
  event = this.minNumber || this.minNumber === 0 ? this.minNumber : event
275
275
  }
276
- this.$emit("input-change", event)
276
+ this.$emit('input-change', event)
277
277
  },
278
278
  onEvaluateCode(val) {
279
279
  // function to perform math on the code
280
280
  // filter the string in case of any malicious content
281
- let filtered = val.replace(/[^-()\d/*+.,]/g, "")
281
+ let filtered = val.replace(/[^-()\d/*+.,]/g, '')
282
282
  filtered = filtered.split(/([-+*/()])/)
283
283
  let formatted = filtered.map((item) => {
284
284
  if (
285
- item === "+" ||
286
- item === "-" ||
287
- item === "*" ||
288
- item === "/" ||
289
- item === "(" ||
290
- item === ")" ||
291
- item === ""
285
+ item === '+' ||
286
+ item === '-' ||
287
+ item === '*' ||
288
+ item === '/' ||
289
+ item === '(' ||
290
+ item === ')' ||
291
+ item === ''
292
292
  ) {
293
293
  return item
294
294
  } else {
295
295
  let num = stringToNumber({
296
296
  value: item,
297
- numberPrecision: false,
297
+ numberPrecision: false
298
298
  })
299
299
  return num
300
300
  }
301
301
  })
302
- let evaluated = eval(formatted.join(""))
303
- evaluated = stringToNumber({
304
- value: evaluated,
305
- numberPrecision: this.numberPrecision,
306
- })
302
+ let evaluated = eval(formatted.join(''))
303
+ if (typeof evaluated === 'string') {
304
+ evaluated = stringToNumber({
305
+ value: evaluated,
306
+ numberPrecision: this.numberPrecision
307
+ })
308
+ }
307
309
  return evaluated
308
310
  },
309
311
  onInputBlur(e) {
@@ -315,7 +317,7 @@ export default {
315
317
  this.textInput = numberToString({
316
318
  value:
317
319
  evaluatedInput && value.length ? evaluatedInput : this.minNumber,
318
- numberPrecision: this.numberPrecision,
320
+ numberPrecision: this.numberPrecision
319
321
  })
320
322
  }
321
323
  let adjustedMinValue =
@@ -323,8 +325,8 @@ export default {
323
325
  ? value
324
326
  : this.minNumber || this.minNumber === 0
325
327
  ? this.minNumber
326
- : ""
327
- this.$emit("input-blur", adjustedMinValue)
328
+ : ''
329
+ this.$emit('input-blur', adjustedMinValue)
328
330
  },
329
331
  focusInput() {
330
332
  if (this.disabled) {
@@ -341,38 +343,38 @@ export default {
341
343
  ? value
342
344
  : this.minNumber || this.minNumber === 0
343
345
  ? this.minNumber
344
- : ""
346
+ : ''
345
347
  if ((adjustedMinValue || adjustedMinValue === 0) && !this.isFocused) {
346
348
  let input = this.numberToStringEnabled
347
349
  ? numberToString({
348
350
  value: adjustedMinValue,
349
- numberPrecision: this.numberPrecision,
351
+ numberPrecision: this.numberPrecision
350
352
  })
351
353
  : adjustedMinValue
352
- let unit = this.showLinearUnitName ? "" : this.unitName
353
- return input + " " + unit
354
+ let unit = this.showLinearUnitName ? '' : this.unitName
355
+ return input + ' ' + unit
354
356
  } else if (!adjustedMinValue && adjustedMinValue !== 0) {
355
- return ""
357
+ return ''
356
358
  } else {
357
359
  return this.numberToStringEnabled
358
360
  ? numberToString({
359
361
  value: adjustedMinValue,
360
- numberPrecision: this.numberPrecision,
362
+ numberPrecision: this.numberPrecision
361
363
  })
362
364
  : adjustedMinValue
363
365
  }
364
- },
366
+ }
365
367
  },
366
368
  created() {
367
369
  if (this.value) {
368
370
  this.textInput = numberToString({
369
371
  value: this.value,
370
- numberPrecision: this.numberPrecision,
372
+ numberPrecision: this.numberPrecision
371
373
  })
372
374
  } else if (this.minNumber !== null) {
373
375
  this.textInput = numberToString({
374
376
  value: this.minNumber,
375
- numberPrecision: this.numberPrecision,
377
+ numberPrecision: this.numberPrecision
376
378
  })
377
379
  }
378
380
  },
@@ -380,9 +382,9 @@ export default {
380
382
  clearInput: function (value) {
381
383
  if (value) {
382
384
  // If the value is typed, then we should clear the textInput on Continue
383
- this.textInput = ""
385
+ this.textInput = ''
384
386
  }
385
- },
386
- },
387
+ }
388
+ }
387
389
  }
388
390
  </script>
@@ -9,12 +9,16 @@ export const stringToNumber = ({
9
9
  // The first replace will replace not allowed characters with a blank
10
10
  if (
11
11
  selectedLang === 'de-DE' ||
12
+ selectedLang === 'de-de' ||
12
13
  selectedLang === 'no-no' ||
13
14
  selectedLang === 'da-dk' ||
14
15
  selectedLang === 'de-lu' ||
15
16
  selectedLang === 'de-be' ||
16
17
  selectedLang === 'es-es' ||
17
- selectedLang === 'de'
18
+ selectedLang === 'de' ||
19
+ selectedLang === 'it' ||
20
+ selectedLang === 'nl-nl' ||
21
+ selectedLang === 'nl-be'
18
22
  ) {
19
23
  // replace dots with blank, and commas with a dot: 1.234,56 --> 1234.56
20
24
  if (allowNegative) {
@@ -42,9 +46,15 @@ export const stringToNumber = ({
42
46
  ) {
43
47
  // replace ' with blank: 1'234.56 --> 1234.56
44
48
  if (allowNegative) {
45
- newVal = newVal.replace(/[^\d-.,']/g, '').replace(/['\s]/g, '')
49
+ newVal = newVal
50
+ .replace(/[^\d-.,']/g, '')
51
+ .replace(/[,\s]/, '')
52
+ .replace(/['\s]/g, '')
46
53
  } else {
47
- newVal = newVal.replace(/[^\d.,']/g, '').replace(/['\s]/g, '')
54
+ newVal = newVal
55
+ .replace(/[^\d.,']/g, '')
56
+ .replace(/[,\s]/, '')
57
+ .replace(/['\s]/g, '')
48
58
  }
49
59
  } else if (
50
60
  selectedLang === 'fr-fr' ||