@luftborn/custom-elements 1.1.43 → 1.4.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/dist/custom-form.js +5 -4
- package/dist/custom-form.js.map +1 -1
- package/dist/elements/CheckBoxElement/CheckBoxElement.js +2 -2
- package/dist/elements/CheckBoxElement/CheckBoxElement.js.map +1 -1
- package/dist/elements/DropDownList/DropDownListElement.js +2 -2
- package/dist/elements/DropDownList/DropDownListElement.js.map +1 -1
- package/dist/elements/FileField/FileFieldElement.d.ts +3 -0
- package/dist/elements/FileField/FileFieldElement.js +21 -1
- package/dist/elements/FileField/FileFieldElement.js.map +1 -1
- package/dist/elements/InternationaPhoneNumber/InternationaPhoneNumberElement.js +19 -13
- package/dist/elements/InternationaPhoneNumber/InternationaPhoneNumberElement.js.map +1 -1
- package/dist/elements/RadioButtonGroup/RadioButtonGroupElement.js +2 -2
- package/dist/elements/RadioButtonGroup/RadioButtonGroupElement.js.map +1 -1
- package/dist/framework/CustomInputElement.d.ts +1 -1
- package/dist/framework/CustomInputElement.js +4 -3
- package/dist/framework/CustomInputElement.js.map +1 -1
- package/dist/framework/Language/Languages/CzechDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/CzechDictionary.js +40 -0
- package/dist/framework/Language/Languages/CzechDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/DutchDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/DutchDictionary.js +40 -0
- package/dist/framework/Language/Languages/DutchDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/EstonianDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/EstonianDictionary.js +40 -0
- package/dist/framework/Language/Languages/EstonianDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/FinnishDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/FinnishDictionary.js +40 -0
- package/dist/framework/Language/Languages/FinnishDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/FrenchDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/FrenchDictionary.js +40 -0
- package/dist/framework/Language/Languages/FrenchDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/GermanDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/GermanDictionary.js +40 -0
- package/dist/framework/Language/Languages/GermanDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/GreekDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/GreekDictionary.js +40 -0
- package/dist/framework/Language/Languages/GreekDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/HungarianDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/HungarianDictionary.js +40 -0
- package/dist/framework/Language/Languages/HungarianDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/IcelandicDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/IcelandicDictionary.js +40 -0
- package/dist/framework/Language/Languages/IcelandicDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/ItalianDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/ItalianDictionary.js +40 -0
- package/dist/framework/Language/Languages/ItalianDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/LatvianDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/LatvianDictionary.js +40 -0
- package/dist/framework/Language/Languages/LatvianDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/LituanianDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/LituanianDictionary.js +40 -0
- package/dist/framework/Language/Languages/LituanianDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/NorwegianDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/NorwegianDictionary.js +40 -0
- package/dist/framework/Language/Languages/NorwegianDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/PolishDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/PolishDictionary.js +40 -0
- package/dist/framework/Language/Languages/PolishDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/PortugueseDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/PortugueseDictionary.js +40 -0
- package/dist/framework/Language/Languages/PortugueseDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/SpanishDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/SpanishDictionary.js +40 -0
- package/dist/framework/Language/Languages/SpanishDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/SwedishDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/SwedishDictionary.js +40 -0
- package/dist/framework/Language/Languages/SwedishDictionary.js.map +1 -0
- package/dist/framework/Language/Translator.d.ts +17 -0
- package/dist/framework/Language/Translator.js +86 -3
- package/dist/framework/Language/Translator.js.map +1 -1
- package/dist/framework/Utilities/ArrayUtil.d.ts +6 -0
- package/dist/framework/Utilities/ArrayUtil.js +37 -0
- package/dist/framework/Utilities/ArrayUtil.js.map +1 -0
- package/dist/framework/Utilities/DomUtil.d.ts +21 -0
- package/dist/framework/Utilities/DomUtil.js +102 -0
- package/dist/framework/Utilities/DomUtil.js.map +1 -0
- package/dist/framework/Utilities/MakeRequest.d.ts +8 -0
- package/dist/framework/Utilities/MakeRequest.js +49 -0
- package/dist/framework/Utilities/MakeRequest.js.map +1 -0
- package/dist/framework/Utilities/StringUtil.d.ts +4 -0
- package/dist/framework/Utilities/StringUtil.js +17 -0
- package/dist/framework/Utilities/StringUtil.js.map +1 -0
- package/dist/framework/Utilities/ViewportUtil.d.ts +8 -0
- package/dist/framework/Utilities/ViewportUtil.js +43 -0
- package/dist/framework/Utilities/ViewportUtil.js.map +1 -0
- package/node_modules/@webcomponents/webcomponentsjs/package.json +31 -62
- package/package.json +1 -2
- package/src/custom-form.ts +2 -1
- package/src/elements/CheckBoxElement/CheckBoxElement.ts +1 -1
- package/src/elements/DropDownList/DropDownListElement.ts +1 -1
- package/src/elements/FileField/FileFieldElement.ts +20 -0
- package/src/elements/InternationaPhoneNumber/InternationaPhoneNumberElement.ts +22 -17
- package/src/elements/RadioButtonGroup/RadioButtonGroupElement.ts +1 -1
- package/src/framework/CustomInputElement.ts +2 -1
- package/src/framework/Language/Languages/CzechDictionary.ts +18 -0
- package/src/framework/Language/Languages/DutchDictionary.ts +18 -0
- package/src/framework/Language/Languages/EstonianDictionary.ts +18 -0
- package/src/framework/Language/Languages/FinnishDictionary.ts +18 -0
- package/src/framework/Language/Languages/FrenchDictionary.ts +18 -0
- package/src/framework/Language/Languages/GermanDictionary.ts +18 -0
- package/src/framework/Language/Languages/GreekDictionary.ts +18 -0
- package/src/framework/Language/Languages/HungarianDictionary.ts +18 -0
- package/src/framework/Language/Languages/IcelandicDictionary.ts +18 -0
- package/src/framework/Language/Languages/ItalianDictionary.ts +18 -0
- package/src/framework/Language/Languages/LatvianDictionary.ts +18 -0
- package/src/framework/Language/Languages/LituanianDictionary.ts +18 -0
- package/src/framework/Language/Languages/NorwegianDictionary.ts +18 -0
- package/src/framework/Language/Languages/PolishDictionary.ts +18 -0
- package/src/framework/Language/Languages/PortugueseDictionary.ts +18 -0
- package/src/framework/Language/Languages/SpanishDictionary.ts +18 -0
- package/src/framework/Language/Languages/SwedishDictionary.ts +18 -0
- package/src/framework/Language/Translator.ts +87 -3
- package/src/framework/Utilities/ArrayUtil.ts +31 -0
- package/src/framework/Utilities/DomUtil.ts +117 -0
- package/src/framework/Utilities/MakeRequest.ts +47 -0
- package/src/framework/Utilities/StringUtil.ts +9 -0
- package/src/framework/Utilities/ViewportUtil.ts +46 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luftborn/custom-elements",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "custom HTML elements for the form builder application ",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
"@webcomponents/webcomponentsjs"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@luftborn/utilities": "^1.1.8",
|
|
18
17
|
"@types/googlemaps": "^3.39.6",
|
|
19
18
|
"@webcomponents/custom-elements": "^1.4.1",
|
|
20
19
|
"@webcomponents/webcomponentsjs": "^2.4.3",
|
package/src/custom-form.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CustomInputElement } from './framework/CustomInputElement';
|
|
2
2
|
import { FileFieldElement } from './elements/FileField/FileFieldElement';
|
|
3
|
-
import
|
|
3
|
+
import ArrayUtil from './framework/Utilities/ArrayUtil';
|
|
4
|
+
import MakeRequest from './framework/Utilities/MakeRequest';
|
|
4
5
|
|
|
5
6
|
export class CustomForm {
|
|
6
7
|
action: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import CustomElement from '../../framework/custom-element.decorator';
|
|
2
2
|
import { CustomInputElement } from '../../framework/CustomInputElement';
|
|
3
3
|
import { CustomElementEventArgs } from '../../framework/CustomEvents';
|
|
4
|
-
import { StringUtil } from '
|
|
4
|
+
import { StringUtil } from '../../framework/Utilities/StringUtil';
|
|
5
5
|
|
|
6
6
|
@CustomElement({
|
|
7
7
|
selector: 'checkbox-element',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import CustomElement from '../../framework/custom-element.decorator';
|
|
2
2
|
import { CustomInputElement } from '../../framework/CustomInputElement';
|
|
3
3
|
import { CustomElementEventArgs } from '../../framework/CustomEvents';
|
|
4
|
-
import { StringUtil } from '
|
|
4
|
+
import { StringUtil } from '../../framework/Utilities/StringUtil';
|
|
5
5
|
|
|
6
6
|
@CustomElement({
|
|
7
7
|
selector: 'drop-down-element',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import CustomElement from '../../framework/custom-element.decorator';
|
|
2
2
|
import { CustomInputElement } from '../../framework/CustomInputElement';
|
|
3
3
|
import { CustomElementEventArgs } from '../../framework/CustomEvents';
|
|
4
|
+
import getAttributeNamesPolyfill from '../../framework/Polyfills/getAttributeNamesPolyfill';
|
|
4
5
|
|
|
5
6
|
@CustomElement({
|
|
6
7
|
selector: 'file-element',
|
|
@@ -31,6 +32,7 @@ export class FileFieldElement extends CustomInputElement {
|
|
|
31
32
|
|
|
32
33
|
constructor() {
|
|
33
34
|
super();
|
|
35
|
+
getAttributeNamesPolyfill();
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
get value(): FileList {
|
|
@@ -50,6 +52,13 @@ export class FileFieldElement extends CustomInputElement {
|
|
|
50
52
|
super.connectedCallback();
|
|
51
53
|
}
|
|
52
54
|
|
|
55
|
+
componentDidMount() {
|
|
56
|
+
this.getAttributeNames().forEach(attributeName => {
|
|
57
|
+
let attributeValue = this.getAttribute(attributeName);
|
|
58
|
+
this.attributeChanged(attributeName, null, attributeValue);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
53
62
|
initChildInputs() {
|
|
54
63
|
this.file = super.getChildInput('#file-field');
|
|
55
64
|
this.file.addEventListener('change', this.change.bind(this));
|
|
@@ -73,4 +82,15 @@ export class FileFieldElement extends CustomInputElement {
|
|
|
73
82
|
new CustomElementEventArgs(this.value, 'validate'),
|
|
74
83
|
);
|
|
75
84
|
}
|
|
85
|
+
|
|
86
|
+
attributeChangedCallback(name: string, oldVal: string, newVal: string) {
|
|
87
|
+
this.attributeChanged(name, oldVal, newVal);
|
|
88
|
+
}
|
|
89
|
+
private attributeChanged(name: string, oldVal: string, newVal: string) {
|
|
90
|
+
switch (name) {
|
|
91
|
+
case 'accept':
|
|
92
|
+
this.file.accept = newVal;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
76
96
|
}
|
|
@@ -3,7 +3,7 @@ import { CustomInputElement } from '../../framework/CustomInputElement';
|
|
|
3
3
|
import { CustomElementEventArgs } from '../../framework/CustomEvents';
|
|
4
4
|
import * as intlTelInput from 'intl-tel-input';
|
|
5
5
|
import { Plugin } from 'intl-tel-input';
|
|
6
|
-
import
|
|
6
|
+
import MakeRequest from '../../framework/Utilities/MakeRequest';
|
|
7
7
|
|
|
8
8
|
@CustomElement({
|
|
9
9
|
selector: 'int-phone-element',
|
|
@@ -68,24 +68,29 @@ export class IntPhoneFieldElement extends CustomInputElement {
|
|
|
68
68
|
}
|
|
69
69
|
setIntlTelInput() {
|
|
70
70
|
this.phone = super.getChildInput('#phone-field');
|
|
71
|
+
const geoIpLookup = (success, failure) => {
|
|
72
|
+
return new MakeRequest(
|
|
73
|
+
'https://ipinfo.io/json?token=8226138217a68a',
|
|
74
|
+
'get',
|
|
75
|
+
{ 'content-type': 'application/json' },
|
|
76
|
+
)
|
|
77
|
+
.send()
|
|
78
|
+
.then((request: any) => {
|
|
79
|
+
const res = JSON.parse(request);
|
|
80
|
+
return success(res.country);
|
|
81
|
+
})
|
|
82
|
+
.catch(err => {
|
|
83
|
+
return success('DK');
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
const isIplookUpDisabled = this.getAttribute('data-disable-iplookup')?.toLowerCase() === "true";
|
|
87
|
+
const defaultCountry = isIplookUpDisabled ? 'dk' : 'auto';
|
|
88
|
+
const country = this.getAttribute('data-country')?.toLowerCase();
|
|
71
89
|
this.intlTelInput = intlTelInput(this.phone, {
|
|
72
|
-
geoIpLookup:
|
|
73
|
-
return new MakeRequest(
|
|
74
|
-
'https://ipinfo.io/json?token=8226138217a68a',
|
|
75
|
-
'get',
|
|
76
|
-
{ 'content-type': 'application/json' },
|
|
77
|
-
)
|
|
78
|
-
.send()
|
|
79
|
-
.then((request: any) => {
|
|
80
|
-
const res = JSON.parse(request);
|
|
81
|
-
return success(res.country);
|
|
82
|
-
})
|
|
83
|
-
.catch(err => {
|
|
84
|
-
return success('DK');
|
|
85
|
-
});
|
|
86
|
-
},
|
|
90
|
+
geoIpLookup: isIplookUpDisabled ? null : geoIpLookup,
|
|
87
91
|
hiddenInput: 'fullphone',
|
|
88
|
-
initialCountry:
|
|
92
|
+
initialCountry: country ?? defaultCountry,
|
|
93
|
+
preferredCountries: ["dk", "se", "gb"],
|
|
89
94
|
nationalMode: true,
|
|
90
95
|
utilsScript:
|
|
91
96
|
'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/15.0.1/js/utils.js',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import CustomElement from '../../framework/custom-element.decorator';
|
|
2
2
|
import { CustomInputElement } from '../../framework/CustomInputElement';
|
|
3
3
|
import { CustomElementEventArgs } from '../../framework/CustomEvents';
|
|
4
|
-
import { StringUtil } from '
|
|
4
|
+
import { StringUtil } from '../../framework/Utilities/StringUtil';
|
|
5
5
|
|
|
6
6
|
@CustomElement({
|
|
7
7
|
selector: 'radio-group-element',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CustomElementEvent, CustomElementEventArgs } from "./CustomEvents";
|
|
2
|
-
import { DomUtil, ArrayUtil } from "@luftborn/utilities";
|
|
3
2
|
import OptionWithDescription from "./Models/OptionWithDescription";
|
|
3
|
+
import ArrayUtil from "./Utilities/ArrayUtil";
|
|
4
|
+
import DomUtil from "./Utilities/DomUtil";
|
|
4
5
|
|
|
5
6
|
class IDictionary<TValue> {
|
|
6
7
|
[index: string]: TValue;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import BaseDictionary from "./Base/BaseDictionary";
|
|
2
|
+
|
|
3
|
+
export default class CzechDictionary extends BaseDictionary {
|
|
4
|
+
|
|
5
|
+
dictionary: any = {
|
|
6
|
+
AddressElement: {
|
|
7
|
+
Address: "adresa",
|
|
8
|
+
City: "město",
|
|
9
|
+
Country: "země",
|
|
10
|
+
Zip: "poštovní směrovací číslo"
|
|
11
|
+
},
|
|
12
|
+
BankElement: {
|
|
13
|
+
Account: "Účet",
|
|
14
|
+
RegistrationNumber: "Registrační číslo"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import BaseDictionary from "./Base/BaseDictionary";
|
|
2
|
+
|
|
3
|
+
export default class DutchDictionary extends BaseDictionary {
|
|
4
|
+
|
|
5
|
+
dictionary: any = {
|
|
6
|
+
AddressElement: {
|
|
7
|
+
Address: "adres",
|
|
8
|
+
City: "stad",
|
|
9
|
+
Country: "land",
|
|
10
|
+
Zip: "postcode"
|
|
11
|
+
},
|
|
12
|
+
BankElement: {
|
|
13
|
+
Account: "Bankrekening",
|
|
14
|
+
RegistrationNumber: "Bankrekening Registratienummer"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import BaseDictionary from "./Base/BaseDictionary";
|
|
2
|
+
|
|
3
|
+
export default class EstonianDictionary extends BaseDictionary {
|
|
4
|
+
|
|
5
|
+
dictionary: any = {
|
|
6
|
+
AddressElement: {
|
|
7
|
+
Address: "aadress",
|
|
8
|
+
City: "linn",
|
|
9
|
+
Country: "riik",
|
|
10
|
+
Zip: "postiindeks"
|
|
11
|
+
},
|
|
12
|
+
BankElement: {
|
|
13
|
+
Account: "Pangakonto",
|
|
14
|
+
RegistrationNumber: "Pangakonto registreerimisnumber"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import BaseDictionary from "./Base/BaseDictionary";
|
|
2
|
+
|
|
3
|
+
export default class FinnishDictionary extends BaseDictionary {
|
|
4
|
+
|
|
5
|
+
dictionary: any = {
|
|
6
|
+
AddressElement: {
|
|
7
|
+
Address: "osoite",
|
|
8
|
+
City: "kaupunki",
|
|
9
|
+
Country: "maa",
|
|
10
|
+
Zip: "postinumero"
|
|
11
|
+
},
|
|
12
|
+
BankElement: {
|
|
13
|
+
Account: "Pankkitili",
|
|
14
|
+
RegistrationNumber: "Pankkitilin rekisteröintinumero"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import BaseDictionary from "./Base/BaseDictionary";
|
|
2
|
+
|
|
3
|
+
export default class FrenchDictionary extends BaseDictionary {
|
|
4
|
+
|
|
5
|
+
dictionary: any = {
|
|
6
|
+
AddressElement: {
|
|
7
|
+
Address: "adresse",
|
|
8
|
+
City: "ville",
|
|
9
|
+
Country: "pays",
|
|
10
|
+
Zip: "code postal"
|
|
11
|
+
},
|
|
12
|
+
BankElement: {
|
|
13
|
+
Account: "Compte bancaire",
|
|
14
|
+
RegistrationNumber: "Numéro d'enregistrement du compte bancaire"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import BaseDictionary from "./Base/BaseDictionary";
|
|
2
|
+
|
|
3
|
+
export default class GermanDictionary extends BaseDictionary {
|
|
4
|
+
|
|
5
|
+
dictionary: any = {
|
|
6
|
+
AddressElement: {
|
|
7
|
+
Address: "Adresse",
|
|
8
|
+
City: "Stadt",
|
|
9
|
+
Country: "Land",
|
|
10
|
+
Zip: "Postleitzahl"
|
|
11
|
+
},
|
|
12
|
+
BankElement: {
|
|
13
|
+
Account: "Bankkonto",
|
|
14
|
+
RegistrationNumber: "Bankkontoregistrierungsnummer"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import BaseDictionary from "./Base/BaseDictionary";
|
|
2
|
+
|
|
3
|
+
export default class GreekDictionary extends BaseDictionary {
|
|
4
|
+
|
|
5
|
+
dictionary: any = {
|
|
6
|
+
AddressElement: {
|
|
7
|
+
Address: "διεύθυνση",
|
|
8
|
+
City: "πόλη",
|
|
9
|
+
Country: "χώρα",
|
|
10
|
+
Zip: "ταχυδρομικός κώδικας"
|
|
11
|
+
},
|
|
12
|
+
BankElement: {
|
|
13
|
+
Account: "Τραπεζικός λογαριασμός",
|
|
14
|
+
RegistrationNumber: "Αριθμός εγγραφής τραπεζικού λογαριασμού"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import BaseDictionary from "./Base/BaseDictionary";
|
|
2
|
+
|
|
3
|
+
export default class HungarianDictionary extends BaseDictionary {
|
|
4
|
+
|
|
5
|
+
dictionary: any = {
|
|
6
|
+
AddressElement: {
|
|
7
|
+
Address: "cím",
|
|
8
|
+
City: "város",
|
|
9
|
+
Country: "ország",
|
|
10
|
+
Zip: "irányítószám"
|
|
11
|
+
},
|
|
12
|
+
BankElement: {
|
|
13
|
+
Account: "Banki számla",
|
|
14
|
+
RegistrationNumber: "Banki számla regisztrációs száma"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import BaseDictionary from "./Base/BaseDictionary";
|
|
2
|
+
|
|
3
|
+
export default class IcelandicDictionary extends BaseDictionary {
|
|
4
|
+
|
|
5
|
+
dictionary: any = {
|
|
6
|
+
AddressElement: {
|
|
7
|
+
Address: "heimilisfang",
|
|
8
|
+
City: "borg",
|
|
9
|
+
Country: "land",
|
|
10
|
+
Zip: "póstnúmer"
|
|
11
|
+
},
|
|
12
|
+
BankElement: {
|
|
13
|
+
Account: "Bankareikningur",
|
|
14
|
+
RegistrationNumber: "Númer skráningar á bankareikningi"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import BaseDictionary from "./Base/BaseDictionary";
|
|
2
|
+
|
|
3
|
+
export default class ItalianDictionary extends BaseDictionary {
|
|
4
|
+
|
|
5
|
+
dictionary: any = {
|
|
6
|
+
AddressElement: {
|
|
7
|
+
Address: "indirizzo",
|
|
8
|
+
City: "città",
|
|
9
|
+
Country: "nazione",
|
|
10
|
+
Zip: "codice postale"
|
|
11
|
+
},
|
|
12
|
+
BankElement: {
|
|
13
|
+
Account: "conto bancario",
|
|
14
|
+
RegistrationNumber: "Numero di registrazione del conto bancario"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import BaseDictionary from "./Base/BaseDictionary";
|
|
2
|
+
|
|
3
|
+
export default class LatvianDictionary extends BaseDictionary {
|
|
4
|
+
|
|
5
|
+
dictionary: any = {
|
|
6
|
+
AddressElement: {
|
|
7
|
+
Address: "adrese",
|
|
8
|
+
City: "pilsēta",
|
|
9
|
+
Country: "valsts",
|
|
10
|
+
Zip: "pasta indekss"
|
|
11
|
+
},
|
|
12
|
+
BankElement: {
|
|
13
|
+
Account: "Bankas konts",
|
|
14
|
+
RegistrationNumber: "Bankas konta reģistrācijas numurs"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import BaseDictionary from "./Base/BaseDictionary";
|
|
2
|
+
|
|
3
|
+
export default class LituanianDictionary extends BaseDictionary {
|
|
4
|
+
|
|
5
|
+
dictionary: any = {
|
|
6
|
+
AddressElement: {
|
|
7
|
+
Address: "adresas",
|
|
8
|
+
City: "miestas",
|
|
9
|
+
Country: "šalis",
|
|
10
|
+
Zip: "pašto kodas"
|
|
11
|
+
},
|
|
12
|
+
BankElement: {
|
|
13
|
+
Account: "Banko sąskaita",
|
|
14
|
+
RegistrationNumber: "Banko sąskaitos registracijos numeris"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import BaseDictionary from "./Base/BaseDictionary";
|
|
2
|
+
|
|
3
|
+
export default class NorwegianDictionary extends BaseDictionary {
|
|
4
|
+
|
|
5
|
+
dictionary: any = {
|
|
6
|
+
AddressElement: {
|
|
7
|
+
Address: "adresse",
|
|
8
|
+
City: "by",
|
|
9
|
+
Country: "land",
|
|
10
|
+
Zip: "postnummer"
|
|
11
|
+
},
|
|
12
|
+
BankElement: {
|
|
13
|
+
Account: "Bankkonto",
|
|
14
|
+
RegistrationNumber: "Registreringsnummer for bankkonto"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import BaseDictionary from "./Base/BaseDictionary";
|
|
2
|
+
|
|
3
|
+
export default class PolishDictionary extends BaseDictionary {
|
|
4
|
+
|
|
5
|
+
dictionary: any = {
|
|
6
|
+
AddressElement: {
|
|
7
|
+
Address: "adres",
|
|
8
|
+
City: "miasto",
|
|
9
|
+
Country: "kraj",
|
|
10
|
+
Zip: "kod pocztowy"
|
|
11
|
+
},
|
|
12
|
+
BankElement: {
|
|
13
|
+
Account: "Konto bankowe",
|
|
14
|
+
RegistrationNumber: "Numer rejestracyjny konta bankowego"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import BaseDictionary from "./Base/BaseDictionary";
|
|
2
|
+
|
|
3
|
+
export default class PortugueseDictionary extends BaseDictionary {
|
|
4
|
+
|
|
5
|
+
dictionary: any = {
|
|
6
|
+
AddressElement: {
|
|
7
|
+
Address: "endereço",
|
|
8
|
+
City: "cidade",
|
|
9
|
+
Country: "país",
|
|
10
|
+
Zip: "código postal"
|
|
11
|
+
},
|
|
12
|
+
BankElement: {
|
|
13
|
+
Account: "Conta bancária",
|
|
14
|
+
RegistrationNumber: "Número de registro da conta bancária"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import BaseDictionary from "./Base/BaseDictionary";
|
|
2
|
+
|
|
3
|
+
export default class SpanishDictionary extends BaseDictionary {
|
|
4
|
+
|
|
5
|
+
dictionary: any = {
|
|
6
|
+
AddressElement: {
|
|
7
|
+
Address: "dirección",
|
|
8
|
+
City: "ciudad",
|
|
9
|
+
Country: "país",
|
|
10
|
+
Zip: "código postal"
|
|
11
|
+
},
|
|
12
|
+
BankElement: {
|
|
13
|
+
Account: "Cuenta bancaria",
|
|
14
|
+
RegistrationNumber: "Número de registro de cuenta bancaria"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import BaseDictionary from "./Base/BaseDictionary";
|
|
2
|
+
|
|
3
|
+
export default class SwedishDictionary extends BaseDictionary {
|
|
4
|
+
|
|
5
|
+
dictionary: any = {
|
|
6
|
+
AddressElement: {
|
|
7
|
+
Address: "adress",
|
|
8
|
+
City: "stad",
|
|
9
|
+
Country: "land",
|
|
10
|
+
Zip: "postnummer"
|
|
11
|
+
},
|
|
12
|
+
BankElement: {
|
|
13
|
+
Account: "Bankkonto",
|
|
14
|
+
RegistrationNumber: "Bankkontoregistreringsnummer"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -1,13 +1,65 @@
|
|
|
1
1
|
import DanishDictionary from "./Languages/DanishDictionary";
|
|
2
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";
|
|
3
20
|
|
|
4
21
|
export default class Translator {
|
|
5
22
|
private static langauges = [
|
|
6
23
|
'en',
|
|
7
|
-
'da'
|
|
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',
|
|
8
42
|
];
|
|
43
|
+
|
|
9
44
|
private static danishDictionary = new DanishDictionary();
|
|
10
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();
|
|
11
63
|
|
|
12
64
|
static Translate(key: string, language = 'da'): string {
|
|
13
65
|
language = language.toLowerCase();
|
|
@@ -18,10 +70,42 @@ export default class Translator {
|
|
|
18
70
|
switch (language) {
|
|
19
71
|
case 'da':
|
|
20
72
|
return this.danishDictionary.get(key);
|
|
21
|
-
break;
|
|
22
73
|
case 'en':
|
|
23
74
|
return this.englishDictionary.get(key);
|
|
24
|
-
|
|
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);
|
|
25
109
|
}
|
|
26
110
|
}
|
|
27
111
|
}
|
|
@@ -0,0 +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
|
+
}
|