@eturnity/eturnity_reusable_components 1.1.79 → 1.1.82
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,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<container>
|
|
2
|
+
<container :inputWidth="inputWidth">
|
|
3
3
|
<input-wrapper :alignItems="alignItems" :hasLabel="label && label.length">
|
|
4
4
|
<label-wrapper v-if="label">
|
|
5
5
|
<input-label>{{ label }}</input-label>
|
|
@@ -45,8 +45,9 @@
|
|
|
45
45
|
import styled from "vue-styled-components"
|
|
46
46
|
import InfoText from "../../infoText"
|
|
47
47
|
|
|
48
|
-
const
|
|
49
|
-
|
|
48
|
+
const containerProps = { inputWidth: String }
|
|
49
|
+
const Container = styled("div", containerProps)`
|
|
50
|
+
width: ${(props) => (props.inputWidth ? props.inputWidth : "100%")};
|
|
50
51
|
position: relative;
|
|
51
52
|
margin-bottom: 20px;
|
|
52
53
|
`
|
|
@@ -8,9 +8,12 @@ export const stringToNumber = ({ value, numberPrecision, allowNegative }) => {
|
|
|
8
8
|
selectedLang === "it-CH" ||
|
|
9
9
|
selectedLang === "no-no" ||
|
|
10
10
|
selectedLang === "da-dk" ||
|
|
11
|
+
selectedLang === "de-lu" ||
|
|
12
|
+
selectedLang === "fr-lu" ||
|
|
13
|
+
selectedLang === "es-es" ||
|
|
11
14
|
selectedLang === "de"
|
|
12
15
|
) {
|
|
13
|
-
// replace commas with a dot,
|
|
16
|
+
// replace dots with blank, and commas with a dot: 1.234,56 --> 1234.56
|
|
14
17
|
if (allowNegative) {
|
|
15
18
|
newVal = newVal
|
|
16
19
|
.replace(/[^\d-.,']/g, "")
|
|
@@ -23,7 +26,7 @@ export const stringToNumber = ({ value, numberPrecision, allowNegative }) => {
|
|
|
23
26
|
.replace(/[,\s]/, ".")
|
|
24
27
|
}
|
|
25
28
|
} else if (selectedLang === "en-us") {
|
|
26
|
-
// replace commas with blank
|
|
29
|
+
// replace commas with blank: 1,234.56 --> 1234.56
|
|
27
30
|
if (allowNegative) {
|
|
28
31
|
newVal = newVal.replace(/[^\d-.,']/g, "").replace(/[,\s]/g, "")
|
|
29
32
|
} else {
|
|
@@ -34,7 +37,7 @@ export const stringToNumber = ({ value, numberPrecision, allowNegative }) => {
|
|
|
34
37
|
selectedLang === "fr-ch" ||
|
|
35
38
|
selectedLang === "it-ch"
|
|
36
39
|
) {
|
|
37
|
-
// replace ' with blank
|
|
40
|
+
// replace ' with blank: 1'234.56 --> 1234.56
|
|
38
41
|
if (allowNegative) {
|
|
39
42
|
newVal = newVal.replace(/[^\d-.,']/g, "").replace(/['\s]/g, "")
|
|
40
43
|
} else {
|
|
@@ -42,17 +45,19 @@ export const stringToNumber = ({ value, numberPrecision, allowNegative }) => {
|
|
|
42
45
|
}
|
|
43
46
|
} else if (
|
|
44
47
|
selectedLang === "fr-fr" ||
|
|
45
|
-
selectedLang === "fr" ||
|
|
46
|
-
selectedLang === "sv-se"
|
|
48
|
+
selectedLang === "fr-be" ||
|
|
49
|
+
selectedLang === "sv-se" ||
|
|
50
|
+
selectedLang === "pt-pt" ||
|
|
51
|
+
selectedLang === "fr"
|
|
47
52
|
) {
|
|
48
|
-
// replace space with blank, and commas with dot
|
|
53
|
+
// replace space with blank, and commas with dot: 1 234,56 --> 1234.56
|
|
49
54
|
if (allowNegative) {
|
|
50
55
|
newVal = newVal.replace(/[^\d-.,']/g, "").replace(/[,\s]/g, ".")
|
|
51
56
|
} else {
|
|
52
57
|
newVal = newVal.replace(/[^\d.,']/g, "").replace(/[,\s]/g, ".")
|
|
53
58
|
}
|
|
54
59
|
} else {
|
|
55
|
-
// en-US as default
|
|
60
|
+
// en-US as default: 1,234.56 --> 1234.56
|
|
56
61
|
if (allowNegative) {
|
|
57
62
|
newVal = newVal.replace(/[^\d-.,']/g, "").replace(/[,\s]/g, "")
|
|
58
63
|
} else {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export const translateLang = (lang) => {
|
|
2
|
+
// this is needed so that we use the correct keys for Phrase
|
|
3
|
+
if (lang === 'en') {
|
|
4
|
+
return 'english'
|
|
5
|
+
} else if (lang === 'en-us') {
|
|
6
|
+
return 'english_us'
|
|
7
|
+
} else if (lang === 'en-gb') {
|
|
8
|
+
return 'english_uk'
|
|
9
|
+
} else if (lang === 'de' || lang === 'de-de') {
|
|
10
|
+
return 'german'
|
|
11
|
+
} else if (lang === 'de-ch') {
|
|
12
|
+
return 'german_ch'
|
|
13
|
+
} else if (lang === 'de-lu') {
|
|
14
|
+
return 'german_lu'
|
|
15
|
+
} else if (lang === 'fr' || lang === 'fr-fr') {
|
|
16
|
+
return 'french'
|
|
17
|
+
} else if (lang === 'fr-be') {
|
|
18
|
+
return 'french_be'
|
|
19
|
+
} else if (lang === 'fr-lu') {
|
|
20
|
+
return 'french_lu'
|
|
21
|
+
} else if (lang === 'fr-ch') {
|
|
22
|
+
return 'french_ch'
|
|
23
|
+
} else if (lang === 'it' || lang === 'it-it') {
|
|
24
|
+
return 'italian'
|
|
25
|
+
} else if (lang === 'it-ch') {
|
|
26
|
+
return 'italian_ch'
|
|
27
|
+
} else if (lang === 'da-dk') {
|
|
28
|
+
return 'danish'
|
|
29
|
+
} else if (lang === 'pl-pl') {
|
|
30
|
+
return 'polish'
|
|
31
|
+
} else if (lang === 'sv-se') {
|
|
32
|
+
return 'swedish'
|
|
33
|
+
} else if (lang === 'no-no') {
|
|
34
|
+
return 'norwegian'
|
|
35
|
+
} else if (lang === 'nl-nl' || lang === 'nl') {
|
|
36
|
+
return 'nl-nl'
|
|
37
|
+
} else if (lang === 'cs') {
|
|
38
|
+
return 'czech'
|
|
39
|
+
} else if (lang === 'fi-fi') {
|
|
40
|
+
return 'finnish'
|
|
41
|
+
} else if (lang === 'pt-pt') {
|
|
42
|
+
return 'portuguese'
|
|
43
|
+
} else if (lang === 'es-es') {
|
|
44
|
+
return 'spanish'
|
|
45
|
+
} else {
|
|
46
|
+
return lang
|
|
47
|
+
}
|
|
48
|
+
}
|