@luftborn/custom-elements 1.4.0 → 2.0.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/README.md +2 -2
- package/assets/style.css +277 -277
- package/azure-pipeline.yml +54 -0
- package/demo/index.html +585 -585
- package/demo/index.js +6109 -0
- package/demo/index.min.js +6110 -0
- package/demo/index.min.js.map +1 -0
- package/demo/index.ts +11 -11
- package/demo/old/index.html +586 -586
- package/demo/old/index.js +10849 -10849
- package/demo/old/index.min.js +10850 -10850
- package/demo/old/index.ts +10 -10
- package/dist/custom-form.d.ts +20 -20
- package/dist/custom-form.js +147 -147
- package/dist/elements/Address/AddressElement.d.ts +28 -28
- package/dist/elements/Address/AddressElement.js +206 -206
- package/dist/elements/BankField/BankFieldElement.d.ts +22 -22
- package/dist/elements/BankField/BankFieldElement.js +127 -127
- package/dist/elements/CPRElement/CPRElement.d.ts +14 -14
- package/dist/elements/CPRElement/CPRElement.js +82 -82
- package/dist/elements/CVRElement/CVRElement.d.ts +14 -14
- package/dist/elements/CVRElement/CVRElement.js +82 -82
- package/dist/elements/CheckBoxElement/CheckBoxElement.d.ts +14 -14
- package/dist/elements/CheckBoxElement/CheckBoxElement.js +96 -96
- package/dist/elements/CustomRegularExpression/CustomRegularExpressionElement.d.ts +12 -12
- package/dist/elements/CustomRegularExpression/CustomRegularExpressionElement.js +82 -82
- package/dist/elements/DateField/DateFieldElement.d.ts +12 -12
- package/dist/elements/DateField/DateFieldElement.js +85 -85
- package/dist/elements/DropDownList/DropDownListElement.d.ts +14 -14
- package/dist/elements/DropDownList/DropDownListElement.js +93 -93
- package/dist/elements/Elements.d.ts +18 -18
- package/dist/elements/Elements.js +37 -37
- package/dist/elements/EmailField/EmailFieldElement.d.ts +13 -13
- package/dist/elements/EmailField/EmailFieldElement.js +83 -83
- package/dist/elements/FileField/FileFieldElement.d.ts +15 -15
- package/dist/elements/FileField/FileFieldElement.js +103 -103
- package/dist/elements/IdentificationElement/IdentificationElement.d.ts +18 -18
- package/dist/elements/IdentificationElement/IdentificationElement.js +94 -94
- package/dist/elements/InternationaPhoneNumber/InternationaPhoneNumberElement.d.ts +16 -16
- package/dist/elements/InternationaPhoneNumber/InternationaPhoneNumberElement.js +114 -114
- package/dist/elements/NumericField/NumericFieldElement.d.ts +12 -12
- package/dist/elements/NumericField/NumericFieldElement.js +91 -91
- package/dist/elements/RadioButtonGroup/RadioButtonGroupElement.d.ts +14 -14
- package/dist/elements/RadioButtonGroup/RadioButtonGroupElement.js +99 -99
- package/dist/elements/TextAreaElement/TextAreaElement.d.ts +12 -12
- package/dist/elements/TextAreaElement/TextAreaElement.js +79 -79
- package/dist/elements/TextField/TextFieldElement.d.ts +12 -12
- package/dist/elements/TextField/TextFieldElement.js +79 -79
- package/dist/elements/TypeAhead/TypeAheadElement.d.ts +24 -24
- package/dist/elements/TypeAhead/TypeAheadElement.js +209 -209
- package/dist/framework/CustomEvents.d.ts +21 -21
- package/dist/framework/CustomEvents.js +47 -47
- package/dist/framework/CustomInputElement.d.ts +50 -50
- package/dist/framework/CustomInputElement.js +258 -258
- package/dist/framework/Language/Languages/Base/BaseDictionary.d.ts +4 -4
- package/dist/framework/Language/Languages/Base/BaseDictionary.js +20 -20
- package/dist/framework/Language/Languages/CzechDictionary.d.ts +4 -4
- package/dist/framework/Language/Languages/CzechDictionary.js +39 -39
- package/dist/framework/Language/Languages/DanishDictionary.d.ts +4 -4
- package/dist/framework/Language/Languages/DanishDictionary.js +39 -39
- package/dist/framework/Language/Languages/DutchDictionary.d.ts +4 -4
- package/dist/framework/Language/Languages/DutchDictionary.js +39 -39
- package/dist/framework/Language/Languages/EnglishDictionary.d.ts +4 -4
- package/dist/framework/Language/Languages/EnglishDictionary.js +39 -39
- package/dist/framework/Language/Languages/EstonianDictionary.d.ts +4 -4
- package/dist/framework/Language/Languages/EstonianDictionary.js +39 -39
- package/dist/framework/Language/Languages/FinnishDictionary.d.ts +4 -4
- package/dist/framework/Language/Languages/FinnishDictionary.js +39 -39
- package/dist/framework/Language/Languages/FrenchDictionary.d.ts +4 -4
- package/dist/framework/Language/Languages/FrenchDictionary.js +39 -39
- package/dist/framework/Language/Languages/GermanDictionary.d.ts +4 -4
- package/dist/framework/Language/Languages/GermanDictionary.js +39 -39
- package/dist/framework/Language/Languages/GreekDictionary.d.ts +4 -4
- package/dist/framework/Language/Languages/GreekDictionary.js +39 -39
- package/dist/framework/Language/Languages/HungarianDictionary.d.ts +4 -4
- package/dist/framework/Language/Languages/HungarianDictionary.js +39 -39
- package/dist/framework/Language/Languages/IcelandicDictionary.d.ts +4 -4
- package/dist/framework/Language/Languages/IcelandicDictionary.js +39 -39
- package/dist/framework/Language/Languages/ItalianDictionary.d.ts +4 -4
- package/dist/framework/Language/Languages/ItalianDictionary.js +39 -39
- package/dist/framework/Language/Languages/LatvianDictionary.d.ts +4 -4
- package/dist/framework/Language/Languages/LatvianDictionary.js +39 -39
- package/dist/framework/Language/Languages/LituanianDictionary.d.ts +4 -4
- package/dist/framework/Language/Languages/LituanianDictionary.js +39 -39
- package/dist/framework/Language/Languages/NorwegianDictionary.d.ts +4 -4
- package/dist/framework/Language/Languages/NorwegianDictionary.js +39 -39
- package/dist/framework/Language/Languages/PolishDictionary.d.ts +4 -4
- package/dist/framework/Language/Languages/PolishDictionary.js +39 -39
- package/dist/framework/Language/Languages/PortugueseDictionary.d.ts +4 -4
- package/dist/framework/Language/Languages/PortugueseDictionary.js +39 -39
- package/dist/framework/Language/Languages/SpanishDictionary.d.ts +4 -4
- package/dist/framework/Language/Languages/SpanishDictionary.js +39 -39
- package/dist/framework/Language/Languages/SwedishDictionary.d.ts +4 -4
- package/dist/framework/Language/Languages/SwedishDictionary.js +39 -39
- package/dist/framework/Language/Translator.d.ts +23 -23
- package/dist/framework/Language/Translator.js +115 -115
- package/dist/framework/Models/OptionWithDescription.d.ts +6 -6
- package/dist/framework/Models/OptionWithDescription.js +9 -9
- package/dist/framework/Polyfills/getAttributeNamesPolyfill.d.ts +1 -1
- package/dist/framework/Polyfills/getAttributeNamesPolyfill.js +17 -17
- package/dist/framework/Translations/CaseConverter.d.ts +5 -5
- package/dist/framework/Translations/CaseConverter.js +50 -50
- package/dist/framework/Utilities/ArrayUtil.d.ts +6 -6
- package/dist/framework/Utilities/ArrayUtil.js +36 -36
- package/dist/framework/Utilities/DomUtil.d.ts +21 -21
- package/dist/framework/Utilities/DomUtil.js +101 -101
- package/dist/framework/Utilities/DomUtility.d.ts +3 -3
- package/dist/framework/Utilities/DomUtility.js +12 -12
- package/dist/framework/Utilities/MakeRequest.d.ts +8 -8
- package/dist/framework/Utilities/MakeRequest.js +48 -48
- package/dist/framework/Utilities/StringUtil.d.ts +4 -4
- package/dist/framework/Utilities/StringUtil.js +16 -16
- package/dist/framework/Utilities/ViewportUtil.d.ts +8 -8
- package/dist/framework/Utilities/ViewportUtil.js +42 -42
- package/dist/framework/Utilities/debouncer.d.ts +8 -8
- package/dist/framework/Utilities/debouncer.js +51 -51
- package/dist/framework/Validation/IValidator.interface.d.ts +3 -3
- package/dist/framework/Validation/IValidator.interface.js +2 -2
- package/dist/framework/Validation/Validators/BankAccount.d.ts +4 -4
- package/dist/framework/Validation/Validators/BankAccount.js +12 -12
- package/dist/framework/Validation/Validators/BankAccountRegistrationNumber.d.ts +4 -4
- package/dist/framework/Validation/Validators/BankAccountRegistrationNumber.js +12 -12
- package/dist/framework/Validation/Validators/BankIdNorway.d.ts +5 -5
- package/dist/framework/Validation/Validators/BankIdNorway.js +21 -21
- package/dist/framework/Validation/Validators/BankIdSweden.d.ts +5 -5
- package/dist/framework/Validation/Validators/BankIdSweden.js +21 -21
- package/dist/framework/Validation/Validators/CPR.d.ts +9 -9
- package/dist/framework/Validation/Validators/CPR.js +75 -75
- package/dist/framework/Validation/Validators/CVR.d.ts +5 -5
- package/dist/framework/Validation/Validators/CVR.js +30 -30
- package/dist/framework/custom-element.decorator.d.ts +9 -9
- package/dist/framework/custom-element.decorator.js +51 -51
- package/dist/index.d.ts +7 -7
- package/dist/index.js +14 -14
- package/package.json +38 -38
- package/src/custom-form.ts +140 -140
- package/src/elements/Address/AddressElement.ts +216 -216
- package/src/elements/BankField/BankFieldElement.ts +127 -127
- package/src/elements/CPRElement/CPRElement.ts +74 -74
- package/src/elements/CVRElement/CVRElement.ts +75 -75
- package/src/elements/CheckBoxElement/CheckBoxElement.ts +99 -99
- package/src/elements/CustomRegularExpression/CustomRegularExpressionElement.ts +75 -75
- package/src/elements/DateField/DateFieldElement.ts +78 -78
- package/src/elements/DropDownList/DropDownListElement.ts +100 -100
- package/src/elements/Elements.ts +37 -37
- package/src/elements/EmailField/EmailFieldElement.ts +78 -78
- package/src/elements/FileField/FileFieldElement.ts +96 -96
- package/src/elements/IdentificationElement/IdentificationElement.ts +104 -104
- package/src/elements/InternationaPhoneNumber/InternationaPhoneNumberElement.ts +116 -116
- package/src/elements/NumericField/NumericFieldElement.ts +84 -84
- package/src/elements/RadioButtonGroup/RadioButtonGroupElement.ts +103 -103
- package/src/elements/TextAreaElement/TextAreaElement.ts +72 -72
- package/src/elements/TextField/TextFieldElement.ts +72 -72
- package/src/elements/TypeAhead/TypeAheadElement.ts +248 -248
- package/src/framework/CustomEvents.ts +47 -47
- package/src/framework/CustomInputElement.ts +277 -277
- package/src/framework/Language/Languages/Base/BaseDictionary.ts +15 -15
- package/src/framework/Language/Languages/CzechDictionary.ts +18 -18
- package/src/framework/Language/Languages/DanishDictionary.ts +17 -17
- package/src/framework/Language/Languages/DutchDictionary.ts +17 -17
- package/src/framework/Language/Languages/EnglishDictionary.ts +18 -18
- package/src/framework/Language/Languages/EstonianDictionary.ts +17 -17
- package/src/framework/Language/Languages/FinnishDictionary.ts +17 -17
- package/src/framework/Language/Languages/FrenchDictionary.ts +17 -17
- package/src/framework/Language/Languages/GermanDictionary.ts +17 -17
- package/src/framework/Language/Languages/GreekDictionary.ts +17 -17
- package/src/framework/Language/Languages/HungarianDictionary.ts +17 -17
- package/src/framework/Language/Languages/IcelandicDictionary.ts +17 -17
- package/src/framework/Language/Languages/ItalianDictionary.ts +17 -17
- package/src/framework/Language/Languages/LatvianDictionary.ts +17 -17
- package/src/framework/Language/Languages/LituanianDictionary.ts +17 -17
- package/src/framework/Language/Languages/NorwegianDictionary.ts +17 -17
- package/src/framework/Language/Languages/PolishDictionary.ts +17 -17
- package/src/framework/Language/Languages/PortugueseDictionary.ts +17 -17
- package/src/framework/Language/Languages/SpanishDictionary.ts +17 -17
- package/src/framework/Language/Languages/SwedishDictionary.ts +17 -17
- package/src/framework/Language/Translator.ts +110 -110
- package/src/framework/Models/OptionWithDescription.ts +8 -8
- package/src/framework/Polyfills/getAttributeNamesPolyfill.ts +13 -13
- package/src/framework/Translations/CaseConverter.ts +43 -43
- package/src/framework/Utilities/ArrayUtil.ts +31 -31
- package/src/framework/Utilities/DomUtil.ts +117 -117
- package/src/framework/Utilities/DomUtility.ts +6 -6
- package/src/framework/Utilities/MakeRequest.ts +47 -47
- package/src/framework/Utilities/StringUtil.ts +8 -8
- package/src/framework/Utilities/ViewportUtil.ts +46 -46
- package/src/framework/Utilities/debouncer.ts +66 -66
- package/src/framework/Validation/IValidator.interface.ts +3 -3
- package/src/framework/Validation/Validators/BankAccount.ts +7 -7
- package/src/framework/Validation/Validators/BankAccountRegistrationNumber.ts +8 -8
- package/src/framework/Validation/Validators/BankIdNorway.ts +21 -21
- package/src/framework/Validation/Validators/BankIdSweden.ts +21 -21
- package/src/framework/Validation/Validators/CPR.ts +82 -82
- package/src/framework/Validation/Validators/CVR.ts +27 -27
- package/src/framework/custom-element.decorator.ts +57 -57
- package/src/index.ts +12 -12
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
import DanishDictionary from "./Languages/DanishDictionary";
|
|
2
|
-
import EnglishDictionary from "./Languages/EnglishDictionary";
|
|
3
|
-
import CzechDictionary from "./Languages/CzechDictionary";
|
|
4
|
-
import GermanDictionary from "./Languages/GermanDictionary";
|
|
5
|
-
import GreekDictionary from "./Languages/GreekDictionary";
|
|
6
|
-
import SpanishDictionary from "./Languages/SpanishDictionary";
|
|
7
|
-
import EstonianDictionary from "./Languages/EstonianDictionary";
|
|
8
|
-
import FinnishDictionary from "./Languages/FinnishDictionary";
|
|
9
|
-
import FrenchDictionary from "./Languages/FrenchDictionary";
|
|
10
|
-
import HungarianDictionary from "./Languages/HungarianDictionary";
|
|
11
|
-
import IcelandicDictionary from "./Languages/IcelandicDictionary";
|
|
12
|
-
import ItalianDictionary from "./Languages/ItalianDictionary";
|
|
13
|
-
import LatvianDictionary from "./Languages/LatvianDictionary";
|
|
14
|
-
import LituanianDictionary from "./Languages/LituanianDictionary";
|
|
15
|
-
import DutchDictionary from "./Languages/DutchDictionary";
|
|
16
|
-
import NorwegianDictionary from "./Languages/NorwegianDictionary";
|
|
17
|
-
import PolishDictionary from "./Languages/PolishDictionary";
|
|
18
|
-
import PortugueseDictionary from "./Languages/PortugueseDictionary";
|
|
19
|
-
import SwedishDictionary from "./Languages/SwedishDictionary";
|
|
20
|
-
|
|
21
|
-
export default class Translator {
|
|
22
|
-
private static langauges = [
|
|
23
|
-
'en',
|
|
24
|
-
'da',
|
|
25
|
-
'cs',
|
|
26
|
-
'de',
|
|
27
|
-
'el',
|
|
28
|
-
'es',
|
|
29
|
-
'et',
|
|
30
|
-
'fi',
|
|
31
|
-
'fr',
|
|
32
|
-
'hu',
|
|
33
|
-
'is',
|
|
34
|
-
'it',
|
|
35
|
-
'lt',
|
|
36
|
-
'lv',
|
|
37
|
-
'nl',
|
|
38
|
-
'no',
|
|
39
|
-
'pl',
|
|
40
|
-
'pt',
|
|
41
|
-
'sv',
|
|
42
|
-
];
|
|
43
|
-
|
|
44
|
-
private static danishDictionary = new DanishDictionary();
|
|
45
|
-
private static englishDictionary = new EnglishDictionary();
|
|
46
|
-
private static czechDictionary = new CzechDictionary();
|
|
47
|
-
private static germanDictionary = new GermanDictionary();
|
|
48
|
-
private static greekDictionary = new GreekDictionary();
|
|
49
|
-
private static spanishDictionary = new SpanishDictionary();
|
|
50
|
-
private static estonianDictionary = new EstonianDictionary();
|
|
51
|
-
private static finnishDictionary = new FinnishDictionary();
|
|
52
|
-
private static frenchDictionary = new FrenchDictionary();
|
|
53
|
-
private static hungarianDictionary = new HungarianDictionary();
|
|
54
|
-
private static icelandicDictionary = new IcelandicDictionary();
|
|
55
|
-
private static italianDictionary = new ItalianDictionary();
|
|
56
|
-
private static latvianDictionary = new LatvianDictionary();
|
|
57
|
-
private static lituanianDictionary = new LituanianDictionary();
|
|
58
|
-
private static dutchDictionary = new DutchDictionary();
|
|
59
|
-
private static norwegianDictionary = new NorwegianDictionary();
|
|
60
|
-
private static polishDictionary = new PolishDictionary();
|
|
61
|
-
private static portugueseDictionary = new PortugueseDictionary();
|
|
62
|
-
private static swedishDictionary = new SwedishDictionary();
|
|
63
|
-
|
|
64
|
-
static Translate(key: string, language = 'da'): string {
|
|
65
|
-
language = language.toLowerCase();
|
|
66
|
-
const isSupportedLanguage = Translator.langauges.indexOf(language) != -1;
|
|
67
|
-
if (!isSupportedLanguage) {
|
|
68
|
-
language = 'da'
|
|
69
|
-
}
|
|
70
|
-
switch (language) {
|
|
71
|
-
case 'da':
|
|
72
|
-
return this.danishDictionary.get(key);
|
|
73
|
-
case 'en':
|
|
74
|
-
return this.englishDictionary.get(key);
|
|
75
|
-
case 'cs':
|
|
76
|
-
return this.czechDictionary.get(key);
|
|
77
|
-
case 'de':
|
|
78
|
-
return this.germanDictionary.get(key);
|
|
79
|
-
case 'el':
|
|
80
|
-
return this.greekDictionary.get(key);
|
|
81
|
-
case 'es':
|
|
82
|
-
return this.spanishDictionary.get(key);
|
|
83
|
-
case 'et':
|
|
84
|
-
return this.estonianDictionary.get(key);
|
|
85
|
-
case 'fi':
|
|
86
|
-
return this.finnishDictionary.get(key);
|
|
87
|
-
case 'fr':
|
|
88
|
-
return this.frenchDictionary.get(key);
|
|
89
|
-
case 'hu':
|
|
90
|
-
return this.hungarianDictionary.get(key);
|
|
91
|
-
case 'is':
|
|
92
|
-
return this.icelandicDictionary.get(key);
|
|
93
|
-
case 'it':
|
|
94
|
-
return this.italianDictionary.get(key);
|
|
95
|
-
case 'lt':
|
|
96
|
-
return this.latvianDictionary.get(key);
|
|
97
|
-
case 'lv':
|
|
98
|
-
return this.lituanianDictionary.get(key);
|
|
99
|
-
case 'nl':
|
|
100
|
-
return this.dutchDictionary.get(key);
|
|
101
|
-
case 'no':
|
|
102
|
-
return this.norwegianDictionary.get(key);
|
|
103
|
-
case 'pl':
|
|
104
|
-
return this.polishDictionary.get(key);
|
|
105
|
-
case 'pt':
|
|
106
|
-
return this.portugueseDictionary.get(key);
|
|
107
|
-
case 'sv':
|
|
108
|
-
return this.swedishDictionary.get(key);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
1
|
+
import DanishDictionary from "./Languages/DanishDictionary";
|
|
2
|
+
import EnglishDictionary from "./Languages/EnglishDictionary";
|
|
3
|
+
import CzechDictionary from "./Languages/CzechDictionary";
|
|
4
|
+
import GermanDictionary from "./Languages/GermanDictionary";
|
|
5
|
+
import GreekDictionary from "./Languages/GreekDictionary";
|
|
6
|
+
import SpanishDictionary from "./Languages/SpanishDictionary";
|
|
7
|
+
import EstonianDictionary from "./Languages/EstonianDictionary";
|
|
8
|
+
import FinnishDictionary from "./Languages/FinnishDictionary";
|
|
9
|
+
import FrenchDictionary from "./Languages/FrenchDictionary";
|
|
10
|
+
import HungarianDictionary from "./Languages/HungarianDictionary";
|
|
11
|
+
import IcelandicDictionary from "./Languages/IcelandicDictionary";
|
|
12
|
+
import ItalianDictionary from "./Languages/ItalianDictionary";
|
|
13
|
+
import LatvianDictionary from "./Languages/LatvianDictionary";
|
|
14
|
+
import LituanianDictionary from "./Languages/LituanianDictionary";
|
|
15
|
+
import DutchDictionary from "./Languages/DutchDictionary";
|
|
16
|
+
import NorwegianDictionary from "./Languages/NorwegianDictionary";
|
|
17
|
+
import PolishDictionary from "./Languages/PolishDictionary";
|
|
18
|
+
import PortugueseDictionary from "./Languages/PortugueseDictionary";
|
|
19
|
+
import SwedishDictionary from "./Languages/SwedishDictionary";
|
|
20
|
+
|
|
21
|
+
export default class Translator {
|
|
22
|
+
private static langauges = [
|
|
23
|
+
'en',
|
|
24
|
+
'da',
|
|
25
|
+
'cs',
|
|
26
|
+
'de',
|
|
27
|
+
'el',
|
|
28
|
+
'es',
|
|
29
|
+
'et',
|
|
30
|
+
'fi',
|
|
31
|
+
'fr',
|
|
32
|
+
'hu',
|
|
33
|
+
'is',
|
|
34
|
+
'it',
|
|
35
|
+
'lt',
|
|
36
|
+
'lv',
|
|
37
|
+
'nl',
|
|
38
|
+
'no',
|
|
39
|
+
'pl',
|
|
40
|
+
'pt',
|
|
41
|
+
'sv',
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
private static danishDictionary = new DanishDictionary();
|
|
45
|
+
private static englishDictionary = new EnglishDictionary();
|
|
46
|
+
private static czechDictionary = new CzechDictionary();
|
|
47
|
+
private static germanDictionary = new GermanDictionary();
|
|
48
|
+
private static greekDictionary = new GreekDictionary();
|
|
49
|
+
private static spanishDictionary = new SpanishDictionary();
|
|
50
|
+
private static estonianDictionary = new EstonianDictionary();
|
|
51
|
+
private static finnishDictionary = new FinnishDictionary();
|
|
52
|
+
private static frenchDictionary = new FrenchDictionary();
|
|
53
|
+
private static hungarianDictionary = new HungarianDictionary();
|
|
54
|
+
private static icelandicDictionary = new IcelandicDictionary();
|
|
55
|
+
private static italianDictionary = new ItalianDictionary();
|
|
56
|
+
private static latvianDictionary = new LatvianDictionary();
|
|
57
|
+
private static lituanianDictionary = new LituanianDictionary();
|
|
58
|
+
private static dutchDictionary = new DutchDictionary();
|
|
59
|
+
private static norwegianDictionary = new NorwegianDictionary();
|
|
60
|
+
private static polishDictionary = new PolishDictionary();
|
|
61
|
+
private static portugueseDictionary = new PortugueseDictionary();
|
|
62
|
+
private static swedishDictionary = new SwedishDictionary();
|
|
63
|
+
|
|
64
|
+
static Translate(key: string, language = 'da'): string {
|
|
65
|
+
language = language.toLowerCase();
|
|
66
|
+
const isSupportedLanguage = Translator.langauges.indexOf(language) != -1;
|
|
67
|
+
if (!isSupportedLanguage) {
|
|
68
|
+
language = 'da'
|
|
69
|
+
}
|
|
70
|
+
switch (language) {
|
|
71
|
+
case 'da':
|
|
72
|
+
return this.danishDictionary.get(key);
|
|
73
|
+
case 'en':
|
|
74
|
+
return this.englishDictionary.get(key);
|
|
75
|
+
case 'cs':
|
|
76
|
+
return this.czechDictionary.get(key);
|
|
77
|
+
case 'de':
|
|
78
|
+
return this.germanDictionary.get(key);
|
|
79
|
+
case 'el':
|
|
80
|
+
return this.greekDictionary.get(key);
|
|
81
|
+
case 'es':
|
|
82
|
+
return this.spanishDictionary.get(key);
|
|
83
|
+
case 'et':
|
|
84
|
+
return this.estonianDictionary.get(key);
|
|
85
|
+
case 'fi':
|
|
86
|
+
return this.finnishDictionary.get(key);
|
|
87
|
+
case 'fr':
|
|
88
|
+
return this.frenchDictionary.get(key);
|
|
89
|
+
case 'hu':
|
|
90
|
+
return this.hungarianDictionary.get(key);
|
|
91
|
+
case 'is':
|
|
92
|
+
return this.icelandicDictionary.get(key);
|
|
93
|
+
case 'it':
|
|
94
|
+
return this.italianDictionary.get(key);
|
|
95
|
+
case 'lt':
|
|
96
|
+
return this.latvianDictionary.get(key);
|
|
97
|
+
case 'lv':
|
|
98
|
+
return this.lituanianDictionary.get(key);
|
|
99
|
+
case 'nl':
|
|
100
|
+
return this.dutchDictionary.get(key);
|
|
101
|
+
case 'no':
|
|
102
|
+
return this.norwegianDictionary.get(key);
|
|
103
|
+
case 'pl':
|
|
104
|
+
return this.polishDictionary.get(key);
|
|
105
|
+
case 'pt':
|
|
106
|
+
return this.portugueseDictionary.get(key);
|
|
107
|
+
case 'sv':
|
|
108
|
+
return this.swedishDictionary.get(key);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
111
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export default class OptionWithDescription {
|
|
2
|
-
title: string;
|
|
3
|
-
value: string;
|
|
4
|
-
description: string;
|
|
5
|
-
|
|
6
|
-
constructor(option: Partial<OptionWithDescription>) {
|
|
7
|
-
Object.assign(this, option);
|
|
8
|
-
}
|
|
1
|
+
export default class OptionWithDescription {
|
|
2
|
+
title: string;
|
|
3
|
+
value: string;
|
|
4
|
+
description: string;
|
|
5
|
+
|
|
6
|
+
constructor(option: Partial<OptionWithDescription>) {
|
|
7
|
+
Object.assign(this, option);
|
|
8
|
+
}
|
|
9
9
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export default function getAttributeNamesPolyfill() {
|
|
2
|
-
if (Element.prototype.getAttributeNames == undefined) {
|
|
3
|
-
Element.prototype.getAttributeNames = function () {
|
|
4
|
-
var attributes = this.attributes;
|
|
5
|
-
var length = attributes.length;
|
|
6
|
-
var result = new Array(length);
|
|
7
|
-
for (var i = 0; i < length; i++) {
|
|
8
|
-
result[i] = attributes[i].name;
|
|
9
|
-
}
|
|
10
|
-
return result;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
};
|
|
1
|
+
export default function getAttributeNamesPolyfill() {
|
|
2
|
+
if (Element.prototype.getAttributeNames == undefined) {
|
|
3
|
+
Element.prototype.getAttributeNames = function () {
|
|
4
|
+
var attributes = this.attributes;
|
|
5
|
+
var length = attributes.length;
|
|
6
|
+
var result = new Array(length);
|
|
7
|
+
for (var i = 0; i < length; i++) {
|
|
8
|
+
result[i] = attributes[i].name;
|
|
9
|
+
}
|
|
10
|
+
return result;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
};
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
export default class CaseConverter {
|
|
2
|
-
data: any;
|
|
3
|
-
constructor(data) {
|
|
4
|
-
this.data = data;
|
|
5
|
-
}
|
|
6
|
-
camel() {
|
|
7
|
-
for (let prop in this.data) {
|
|
8
|
-
if (this.data.hasOwnProperty(prop)) {
|
|
9
|
-
const camelcaseProperty = prop.substring(0, 1).toLowerCase() + prop.substring(1);
|
|
10
|
-
const arrayConverter = (array) => {
|
|
11
|
-
const tempArray = [];
|
|
12
|
-
for (let index = 0; index < array.length; index++) {
|
|
13
|
-
if (array[index] === null || array[index] === undefined) {
|
|
14
|
-
continue;
|
|
15
|
-
}
|
|
16
|
-
const elementType = typeof array[index];
|
|
17
|
-
if (elementType === 'string' || elementType === 'number') {
|
|
18
|
-
tempArray.push(array[index]);
|
|
19
|
-
continue;
|
|
20
|
-
}
|
|
21
|
-
if (Array.isArray(array[index])) {
|
|
22
|
-
tempArray.push(arrayConverter(array[index]));
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
if (typeof array[index] === 'object') {
|
|
26
|
-
tempArray.push(new CaseConverter(array[index]).camel());
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return tempArray;
|
|
31
|
-
};
|
|
32
|
-
if (Array.isArray(this.data[prop])) {
|
|
33
|
-
this.data[camelcaseProperty] = arrayConverter(this.data[prop]);
|
|
34
|
-
delete this.data[prop];
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
this.data[camelcaseProperty] = this.data[prop];
|
|
38
|
-
delete this.data[prop];
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return this.data;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
1
|
+
export default class CaseConverter {
|
|
2
|
+
data: any;
|
|
3
|
+
constructor(data) {
|
|
4
|
+
this.data = data;
|
|
5
|
+
}
|
|
6
|
+
camel() {
|
|
7
|
+
for (let prop in this.data) {
|
|
8
|
+
if (this.data.hasOwnProperty(prop)) {
|
|
9
|
+
const camelcaseProperty = prop.substring(0, 1).toLowerCase() + prop.substring(1);
|
|
10
|
+
const arrayConverter = (array) => {
|
|
11
|
+
const tempArray = [];
|
|
12
|
+
for (let index = 0; index < array.length; index++) {
|
|
13
|
+
if (array[index] === null || array[index] === undefined) {
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
const elementType = typeof array[index];
|
|
17
|
+
if (elementType === 'string' || elementType === 'number') {
|
|
18
|
+
tempArray.push(array[index]);
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
if (Array.isArray(array[index])) {
|
|
22
|
+
tempArray.push(arrayConverter(array[index]));
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (typeof array[index] === 'object') {
|
|
26
|
+
tempArray.push(new CaseConverter(array[index]).camel());
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return tempArray;
|
|
31
|
+
};
|
|
32
|
+
if (Array.isArray(this.data[prop])) {
|
|
33
|
+
this.data[camelcaseProperty] = arrayConverter(this.data[prop]);
|
|
34
|
+
delete this.data[prop];
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
this.data[camelcaseProperty] = this.data[prop];
|
|
38
|
+
delete this.data[prop];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return this.data;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
export default class ArrayUtil {
|
|
2
|
-
public static FromNodeList<T extends Node>(list: NodeListOf<T>): T[] {
|
|
3
|
-
return Array.prototype.concat.apply([], list as any);
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
private static addToCurrent<T>(chunks: T[][], item: T) {
|
|
7
|
-
if (!chunks.length) {
|
|
8
|
-
chunks[0] = [];
|
|
9
|
-
}
|
|
10
|
-
chunks[chunks.length - 1].push(item);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
private static addToNew<T>(chunks: T[][], item: T) {
|
|
14
|
-
chunks[chunks.length] = [];
|
|
15
|
-
chunks[chunks.length - 1].push(item);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public static divideAccordingProperty<T>(array: T[], selector: (item: T) => any): T[][] {
|
|
19
|
-
const chunks = [];
|
|
20
|
-
chunks[0] = [array[0]];
|
|
21
|
-
array.reduce((a, b) => {
|
|
22
|
-
if (selector(a) === selector(b)) {
|
|
23
|
-
this.addToCurrent(chunks, b);
|
|
24
|
-
} else {
|
|
25
|
-
this.addToNew(chunks, b);
|
|
26
|
-
}
|
|
27
|
-
return b;
|
|
28
|
-
});
|
|
29
|
-
return chunks;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
1
|
+
export default class ArrayUtil {
|
|
2
|
+
public static FromNodeList<T extends Node>(list: NodeListOf<T>): T[] {
|
|
3
|
+
return Array.prototype.concat.apply([], list as any);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
private static addToCurrent<T>(chunks: T[][], item: T) {
|
|
7
|
+
if (!chunks.length) {
|
|
8
|
+
chunks[0] = [];
|
|
9
|
+
}
|
|
10
|
+
chunks[chunks.length - 1].push(item);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
private static addToNew<T>(chunks: T[][], item: T) {
|
|
14
|
+
chunks[chunks.length] = [];
|
|
15
|
+
chunks[chunks.length - 1].push(item);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public static divideAccordingProperty<T>(array: T[], selector: (item: T) => any): T[][] {
|
|
19
|
+
const chunks = [];
|
|
20
|
+
chunks[0] = [array[0]];
|
|
21
|
+
array.reduce((a, b) => {
|
|
22
|
+
if (selector(a) === selector(b)) {
|
|
23
|
+
this.addToCurrent(chunks, b);
|
|
24
|
+
} else {
|
|
25
|
+
this.addToNew(chunks, b);
|
|
26
|
+
}
|
|
27
|
+
return b;
|
|
28
|
+
});
|
|
29
|
+
return chunks;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -1,117 +1,117 @@
|
|
|
1
|
-
import { ViewportUtil } from './ViewportUtil';
|
|
2
|
-
|
|
3
|
-
export default class DomUtil {
|
|
4
|
-
private viewPortUtil: ViewportUtil;
|
|
5
|
-
public element: Element;
|
|
6
|
-
constructor(element: Element) {
|
|
7
|
-
this.element = element;
|
|
8
|
-
this.viewPortUtil = new ViewportUtil(this.element as HTMLElement);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
public getDataAttr(attr: string, defaultvalue?: string): any {
|
|
12
|
-
if (!this.element) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
const value = this.element.getAttribute(`data-${attr}`);
|
|
16
|
-
|
|
17
|
-
return value !== undefined ? value : defaultvalue;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public setDataAttr(attr: string, value: string): any {
|
|
21
|
-
if (!this.element) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
return this.element.setAttribute(`data-${attr}`, value);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public getAttr(attr: string, defaultvalue?: string): any {
|
|
28
|
-
if (!this.element) {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
const value = this.element.getAttribute(attr);
|
|
32
|
-
return value !== undefined ? value : defaultvalue;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
public setAttr(attr: string, value: string): void {
|
|
36
|
-
if (!this.element) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
this.element.setAttribute(attr, value);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
public removeAttr(attr: string): void {
|
|
43
|
-
if (!this.element) {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
this.element.removeAttribute(attr);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
public removeDataAttr(attr: string): void {
|
|
50
|
-
if (!this.element) {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
this.element.removeAttribute(`data-${attr}`);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
public hasAttr(attr: string): boolean {
|
|
57
|
-
if (!this.element) {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
return this.element.hasAttribute(attr);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public shake(): void {
|
|
64
|
-
this.appendClass('shake');
|
|
65
|
-
setTimeout(() => {
|
|
66
|
-
this.removeClass('shake');
|
|
67
|
-
(this.element as HTMLInputElement).readOnly = false;
|
|
68
|
-
}, 600);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
public error(): void {
|
|
72
|
-
this.appendClass('error');
|
|
73
|
-
setTimeout(() => {
|
|
74
|
-
this.removeClass('error');
|
|
75
|
-
(this.element as HTMLInputElement).readOnly = false;
|
|
76
|
-
}, 5000);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
public focus(): void {
|
|
80
|
-
if (!this.viewPortUtil.IsVisible()) {
|
|
81
|
-
this.element.scrollIntoView();
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
public removeClass(classname): void {
|
|
86
|
-
this.element.classList.remove(classname);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
public appendClass(classname): void {
|
|
90
|
-
this.element.classList.add(classname);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
public deleteElement(): void {
|
|
94
|
-
if (!this.element) {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
this.element.remove();
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
public setChildElementByAttrName(name: string, value: string): void {
|
|
101
|
-
const firstLetter = name.replace(/^\w/, c => c.toUpperCase());
|
|
102
|
-
const SubElement = this.element.querySelector(
|
|
103
|
-
`[name="${firstLetter}"]`,
|
|
104
|
-
) as HTMLInputElement;
|
|
105
|
-
if (SubElement) {
|
|
106
|
-
SubElement.value = value;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
public hasClass(className: string): boolean {
|
|
111
|
-
return this.element.classList.contains(className);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
public getStyle(ruleName: string) {
|
|
115
|
-
return getComputedStyle(this.element)[ruleName];
|
|
116
|
-
}
|
|
117
|
-
}
|
|
1
|
+
import { ViewportUtil } from './ViewportUtil';
|
|
2
|
+
|
|
3
|
+
export default class DomUtil {
|
|
4
|
+
private viewPortUtil: ViewportUtil;
|
|
5
|
+
public element: Element;
|
|
6
|
+
constructor(element: Element) {
|
|
7
|
+
this.element = element;
|
|
8
|
+
this.viewPortUtil = new ViewportUtil(this.element as HTMLElement);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
public getDataAttr(attr: string, defaultvalue?: string): any {
|
|
12
|
+
if (!this.element) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const value = this.element.getAttribute(`data-${attr}`);
|
|
16
|
+
|
|
17
|
+
return value !== undefined ? value : defaultvalue;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public setDataAttr(attr: string, value: string): any {
|
|
21
|
+
if (!this.element) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return this.element.setAttribute(`data-${attr}`, value);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public getAttr(attr: string, defaultvalue?: string): any {
|
|
28
|
+
if (!this.element) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const value = this.element.getAttribute(attr);
|
|
32
|
+
return value !== undefined ? value : defaultvalue;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public setAttr(attr: string, value: string): void {
|
|
36
|
+
if (!this.element) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
this.element.setAttribute(attr, value);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public removeAttr(attr: string): void {
|
|
43
|
+
if (!this.element) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
this.element.removeAttribute(attr);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public removeDataAttr(attr: string): void {
|
|
50
|
+
if (!this.element) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
this.element.removeAttribute(`data-${attr}`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public hasAttr(attr: string): boolean {
|
|
57
|
+
if (!this.element) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
return this.element.hasAttribute(attr);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public shake(): void {
|
|
64
|
+
this.appendClass('shake');
|
|
65
|
+
setTimeout(() => {
|
|
66
|
+
this.removeClass('shake');
|
|
67
|
+
(this.element as HTMLInputElement).readOnly = false;
|
|
68
|
+
}, 600);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public error(): void {
|
|
72
|
+
this.appendClass('error');
|
|
73
|
+
setTimeout(() => {
|
|
74
|
+
this.removeClass('error');
|
|
75
|
+
(this.element as HTMLInputElement).readOnly = false;
|
|
76
|
+
}, 5000);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public focus(): void {
|
|
80
|
+
if (!this.viewPortUtil.IsVisible()) {
|
|
81
|
+
this.element.scrollIntoView();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
public removeClass(classname): void {
|
|
86
|
+
this.element.classList.remove(classname);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public appendClass(classname): void {
|
|
90
|
+
this.element.classList.add(classname);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public deleteElement(): void {
|
|
94
|
+
if (!this.element) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
this.element.remove();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
public setChildElementByAttrName(name: string, value: string): void {
|
|
101
|
+
const firstLetter = name.replace(/^\w/, c => c.toUpperCase());
|
|
102
|
+
const SubElement = this.element.querySelector(
|
|
103
|
+
`[name="${firstLetter}"]`,
|
|
104
|
+
) as HTMLInputElement;
|
|
105
|
+
if (SubElement) {
|
|
106
|
+
SubElement.value = value;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
public hasClass(className: string): boolean {
|
|
111
|
+
return this.element.classList.contains(className);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
public getStyle(ruleName: string) {
|
|
115
|
+
return getComputedStyle(this.element)[ruleName];
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export default class DomUtility {
|
|
2
|
-
|
|
3
|
-
// https://stackoverflow.com/questions/1230445/javascript-regex-how-to-bold-specific-words-with-regex
|
|
4
|
-
static boldenText(inputText: string, matchindTextToBolden: string) {
|
|
5
|
-
return inputText.replace(new RegExp('(^|)(' + matchindTextToBolden + ')(|$)', 'ig'), '$1<b>$2</b>$3');
|
|
6
|
-
}
|
|
1
|
+
export default class DomUtility {
|
|
2
|
+
|
|
3
|
+
// https://stackoverflow.com/questions/1230445/javascript-regex-how-to-bold-specific-words-with-regex
|
|
4
|
+
static boldenText(inputText: string, matchindTextToBolden: string) {
|
|
5
|
+
return inputText.replace(new RegExp('(^|)(' + matchindTextToBolden + ')(|$)', 'ig'), '$1<b>$2</b>$3');
|
|
6
|
+
}
|
|
7
7
|
}
|