@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,127 +1,127 @@
|
|
|
1
|
-
import CustomElement from '../../framework/custom-element.decorator';
|
|
2
|
-
import { CustomInputElement } from '../../framework/CustomInputElement';
|
|
3
|
-
import { CustomElementEventArgs } from '../../framework/CustomEvents';
|
|
4
|
-
import BankAccountValidator from '../../framework/Validation/Validators/BankAccount';
|
|
5
|
-
import BankAccountRegistrationNumberValidator from '../../framework/Validation/Validators/BankAccountRegistrationNumber';
|
|
6
|
-
import Translator from '../../framework/Language/Translator';
|
|
7
|
-
|
|
8
|
-
@CustomElement({
|
|
9
|
-
selector: 'bank-element',
|
|
10
|
-
template: `
|
|
11
|
-
<div class="wrapper">
|
|
12
|
-
<input type="text" id='reg-number-field' placeholder='Bank Account Registration Number'/>
|
|
13
|
-
<input type="text" id='account-field' placeholder='Bank Account'/>
|
|
14
|
-
</div>`,
|
|
15
|
-
style: `
|
|
16
|
-
:host{
|
|
17
|
-
width:100%;
|
|
18
|
-
}
|
|
19
|
-
.wrapper{
|
|
20
|
-
display:flex;
|
|
21
|
-
}
|
|
22
|
-
input{
|
|
23
|
-
box-sizing: border-box;
|
|
24
|
-
width: 100% !important;
|
|
25
|
-
border: none;
|
|
26
|
-
background-color: #f1f4ff;
|
|
27
|
-
margin: 2px;
|
|
28
|
-
resize: none;
|
|
29
|
-
}
|
|
30
|
-
`,
|
|
31
|
-
useShadow: true,
|
|
32
|
-
})
|
|
33
|
-
export class BankFieldElement extends CustomInputElement {
|
|
34
|
-
account: HTMLInputElement;
|
|
35
|
-
regNumber: HTMLInputElement;
|
|
36
|
-
bankAccountValidator: BankAccountValidator = new BankAccountValidator();
|
|
37
|
-
regNumberValidator: BankAccountRegistrationNumberValidator = new BankAccountRegistrationNumberValidator();
|
|
38
|
-
|
|
39
|
-
constructor() {
|
|
40
|
-
super();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
get value(): string {
|
|
44
|
-
let account = this.account.value || '';
|
|
45
|
-
let regNumber = this.regNumber.value ? `,${this.regNumber.value}` : '';
|
|
46
|
-
return `${account}${regNumber}`;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
set value(value: string) {
|
|
50
|
-
const values = value.split(',');
|
|
51
|
-
this.account.value = values[0];
|
|
52
|
-
this.regNumber.value = values[1];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
get valid(): boolean {
|
|
56
|
-
return (
|
|
57
|
-
this.bankAccountValidator.isSatisfiedBy(
|
|
58
|
-
this.account.value,
|
|
59
|
-
!this.required,
|
|
60
|
-
) &&
|
|
61
|
-
this.regNumberValidator.isSatisfiedBy(
|
|
62
|
-
this.regNumber.value,
|
|
63
|
-
!this.required,
|
|
64
|
-
) &&
|
|
65
|
-
this.account.validity.valid &&
|
|
66
|
-
this.regNumber.validity.valid
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
connectedCallback(): void {
|
|
71
|
-
super.connectedCallback();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
componentDidMount() {
|
|
75
|
-
this.initChildInputs();
|
|
76
|
-
this.getAttributeNames().forEach(attributeName => {
|
|
77
|
-
let attributeValue = this.getAttribute(attributeName);
|
|
78
|
-
this.attributeChanged(attributeName, null, attributeValue);
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
changeLanguage(language: string) {
|
|
83
|
-
if (!this.account || !this.regNumber) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
this.account.placeholder = Translator.Translate('BankElement.Account', language);
|
|
87
|
-
this.regNumber.placeholder = Translator.Translate('BankElement.RegistrationNumber', language);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
initChildInputs() {
|
|
91
|
-
this.account = super.getChildInput('#account-field');
|
|
92
|
-
this.regNumber = super.getChildInput('#reg-number-field');
|
|
93
|
-
this.account.addEventListener('change', this.change.bind(this));
|
|
94
|
-
this.regNumber.addEventListener('change', this.change.bind(this));
|
|
95
|
-
if (this.required) {
|
|
96
|
-
this.account.setAttribute('required', '');
|
|
97
|
-
this.regNumber.setAttribute('required', '');
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// events
|
|
102
|
-
public change($event): void {
|
|
103
|
-
this.touched = true;
|
|
104
|
-
this.onChange.emit(new CustomElementEventArgs(this.value, 'change'));
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
public validate(): void {
|
|
108
|
-
this.valid;
|
|
109
|
-
this.onValidate.emit(
|
|
110
|
-
new CustomElementEventArgs(this.value, 'validate'),
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
static get observedAttributes() {
|
|
115
|
-
return ['language'];
|
|
116
|
-
}
|
|
117
|
-
attributeChangedCallback(name: string, oldVal: string, newVal: string) {
|
|
118
|
-
this.attributeChanged(name, oldVal, newVal);
|
|
119
|
-
}
|
|
120
|
-
private attributeChanged(name: string, oldVal: string, newVal: string) {
|
|
121
|
-
switch (name) {
|
|
122
|
-
case 'language':
|
|
123
|
-
this.changeLanguage(newVal)
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
1
|
+
import CustomElement from '../../framework/custom-element.decorator';
|
|
2
|
+
import { CustomInputElement } from '../../framework/CustomInputElement';
|
|
3
|
+
import { CustomElementEventArgs } from '../../framework/CustomEvents';
|
|
4
|
+
import BankAccountValidator from '../../framework/Validation/Validators/BankAccount';
|
|
5
|
+
import BankAccountRegistrationNumberValidator from '../../framework/Validation/Validators/BankAccountRegistrationNumber';
|
|
6
|
+
import Translator from '../../framework/Language/Translator';
|
|
7
|
+
|
|
8
|
+
@CustomElement({
|
|
9
|
+
selector: 'bank-element',
|
|
10
|
+
template: `
|
|
11
|
+
<div class="wrapper">
|
|
12
|
+
<input type="text" id='reg-number-field' placeholder='Bank Account Registration Number'/>
|
|
13
|
+
<input type="text" id='account-field' placeholder='Bank Account'/>
|
|
14
|
+
</div>`,
|
|
15
|
+
style: `
|
|
16
|
+
:host{
|
|
17
|
+
width:100%;
|
|
18
|
+
}
|
|
19
|
+
.wrapper{
|
|
20
|
+
display:flex;
|
|
21
|
+
}
|
|
22
|
+
input{
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
width: 100% !important;
|
|
25
|
+
border: none;
|
|
26
|
+
background-color: #f1f4ff;
|
|
27
|
+
margin: 2px;
|
|
28
|
+
resize: none;
|
|
29
|
+
}
|
|
30
|
+
`,
|
|
31
|
+
useShadow: true,
|
|
32
|
+
})
|
|
33
|
+
export class BankFieldElement extends CustomInputElement {
|
|
34
|
+
account: HTMLInputElement;
|
|
35
|
+
regNumber: HTMLInputElement;
|
|
36
|
+
bankAccountValidator: BankAccountValidator = new BankAccountValidator();
|
|
37
|
+
regNumberValidator: BankAccountRegistrationNumberValidator = new BankAccountRegistrationNumberValidator();
|
|
38
|
+
|
|
39
|
+
constructor() {
|
|
40
|
+
super();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
get value(): string {
|
|
44
|
+
let account = this.account.value || '';
|
|
45
|
+
let regNumber = this.regNumber.value ? `,${this.regNumber.value}` : '';
|
|
46
|
+
return `${account}${regNumber}`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
set value(value: string) {
|
|
50
|
+
const values = value.split(',');
|
|
51
|
+
this.account.value = values[0];
|
|
52
|
+
this.regNumber.value = values[1];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
get valid(): boolean {
|
|
56
|
+
return (
|
|
57
|
+
this.bankAccountValidator.isSatisfiedBy(
|
|
58
|
+
this.account.value,
|
|
59
|
+
!this.required,
|
|
60
|
+
) &&
|
|
61
|
+
this.regNumberValidator.isSatisfiedBy(
|
|
62
|
+
this.regNumber.value,
|
|
63
|
+
!this.required,
|
|
64
|
+
) &&
|
|
65
|
+
this.account.validity.valid &&
|
|
66
|
+
this.regNumber.validity.valid
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
connectedCallback(): void {
|
|
71
|
+
super.connectedCallback();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
componentDidMount() {
|
|
75
|
+
this.initChildInputs();
|
|
76
|
+
this.getAttributeNames().forEach(attributeName => {
|
|
77
|
+
let attributeValue = this.getAttribute(attributeName);
|
|
78
|
+
this.attributeChanged(attributeName, null, attributeValue);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
changeLanguage(language: string) {
|
|
83
|
+
if (!this.account || !this.regNumber) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
this.account.placeholder = Translator.Translate('BankElement.Account', language);
|
|
87
|
+
this.regNumber.placeholder = Translator.Translate('BankElement.RegistrationNumber', language);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
initChildInputs() {
|
|
91
|
+
this.account = super.getChildInput('#account-field');
|
|
92
|
+
this.regNumber = super.getChildInput('#reg-number-field');
|
|
93
|
+
this.account.addEventListener('change', this.change.bind(this));
|
|
94
|
+
this.regNumber.addEventListener('change', this.change.bind(this));
|
|
95
|
+
if (this.required) {
|
|
96
|
+
this.account.setAttribute('required', '');
|
|
97
|
+
this.regNumber.setAttribute('required', '');
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// events
|
|
102
|
+
public change($event): void {
|
|
103
|
+
this.touched = true;
|
|
104
|
+
this.onChange.emit(new CustomElementEventArgs(this.value, 'change'));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
public validate(): void {
|
|
108
|
+
this.valid;
|
|
109
|
+
this.onValidate.emit(
|
|
110
|
+
new CustomElementEventArgs(this.value, 'validate'),
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
static get observedAttributes() {
|
|
115
|
+
return ['language'];
|
|
116
|
+
}
|
|
117
|
+
attributeChangedCallback(name: string, oldVal: string, newVal: string) {
|
|
118
|
+
this.attributeChanged(name, oldVal, newVal);
|
|
119
|
+
}
|
|
120
|
+
private attributeChanged(name: string, oldVal: string, newVal: string) {
|
|
121
|
+
switch (name) {
|
|
122
|
+
case 'language':
|
|
123
|
+
this.changeLanguage(newVal)
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
import CustomElement from '../../framework/custom-element.decorator';
|
|
2
|
-
import { CustomInputElement } from '../../framework/CustomInputElement';
|
|
3
|
-
import { CustomElementEventArgs } from '../../framework/CustomEvents';
|
|
4
|
-
import CprValidator from '../../framework/Validation/Validators/CPR';
|
|
5
|
-
|
|
6
|
-
@CustomElement({
|
|
7
|
-
selector: 'cpr-element',
|
|
8
|
-
template: `
|
|
9
|
-
<div class="wrapper">
|
|
10
|
-
<input type="text" id='cpr-field' placeholder='DDMMYY-SSSS'/>
|
|
11
|
-
</div>`,
|
|
12
|
-
style: `
|
|
13
|
-
:host{
|
|
14
|
-
width:100%;
|
|
15
|
-
}
|
|
16
|
-
.wrapper{
|
|
17
|
-
display:flex;
|
|
18
|
-
}
|
|
19
|
-
input{
|
|
20
|
-
box-sizing: border-box;
|
|
21
|
-
width: 100% !important;
|
|
22
|
-
border: none;
|
|
23
|
-
background-color: #f1f4ff;
|
|
24
|
-
margin: 2px;
|
|
25
|
-
resize: none;
|
|
26
|
-
}
|
|
27
|
-
`,
|
|
28
|
-
useShadow: true,
|
|
29
|
-
})
|
|
30
|
-
export class CPRElement extends CustomInputElement {
|
|
31
|
-
text: HTMLInputElement;
|
|
32
|
-
validator: CprValidator = new CprValidator();
|
|
33
|
-
|
|
34
|
-
constructor() {
|
|
35
|
-
super();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
get value(): string {
|
|
39
|
-
return `${this.text.value}`;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
set value(value: string) {
|
|
43
|
-
this.text.value = value;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
get valid(): boolean {
|
|
47
|
-
return this.validator.isSatisfiedBy(this.value, !this.required);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
connectedCallback(): void {
|
|
51
|
-
super.connectedCallback();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
initChildInputs() {
|
|
55
|
-
this.text = super.getChildInput('#cpr-field');
|
|
56
|
-
this.text.addEventListener('change', this.change.bind(this));
|
|
57
|
-
if (this.required) {
|
|
58
|
-
this.text.setAttribute('required', '');
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// events
|
|
63
|
-
public change($event): void {
|
|
64
|
-
this.touched = true;
|
|
65
|
-
this.onChange.emit(new CustomElementEventArgs(this.value, 'change'));
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
public validate(): void {
|
|
69
|
-
this.valid;
|
|
70
|
-
this.onValidate.emit(
|
|
71
|
-
new CustomElementEventArgs(this.value, 'validate'),
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
1
|
+
import CustomElement from '../../framework/custom-element.decorator';
|
|
2
|
+
import { CustomInputElement } from '../../framework/CustomInputElement';
|
|
3
|
+
import { CustomElementEventArgs } from '../../framework/CustomEvents';
|
|
4
|
+
import CprValidator from '../../framework/Validation/Validators/CPR';
|
|
5
|
+
|
|
6
|
+
@CustomElement({
|
|
7
|
+
selector: 'cpr-element',
|
|
8
|
+
template: `
|
|
9
|
+
<div class="wrapper">
|
|
10
|
+
<input type="text" id='cpr-field' placeholder='DDMMYY-SSSS'/>
|
|
11
|
+
</div>`,
|
|
12
|
+
style: `
|
|
13
|
+
:host{
|
|
14
|
+
width:100%;
|
|
15
|
+
}
|
|
16
|
+
.wrapper{
|
|
17
|
+
display:flex;
|
|
18
|
+
}
|
|
19
|
+
input{
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
width: 100% !important;
|
|
22
|
+
border: none;
|
|
23
|
+
background-color: #f1f4ff;
|
|
24
|
+
margin: 2px;
|
|
25
|
+
resize: none;
|
|
26
|
+
}
|
|
27
|
+
`,
|
|
28
|
+
useShadow: true,
|
|
29
|
+
})
|
|
30
|
+
export class CPRElement extends CustomInputElement {
|
|
31
|
+
text: HTMLInputElement;
|
|
32
|
+
validator: CprValidator = new CprValidator();
|
|
33
|
+
|
|
34
|
+
constructor() {
|
|
35
|
+
super();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
get value(): string {
|
|
39
|
+
return `${this.text.value}`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
set value(value: string) {
|
|
43
|
+
this.text.value = value;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
get valid(): boolean {
|
|
47
|
+
return this.validator.isSatisfiedBy(this.value, !this.required);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
connectedCallback(): void {
|
|
51
|
+
super.connectedCallback();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
initChildInputs() {
|
|
55
|
+
this.text = super.getChildInput('#cpr-field');
|
|
56
|
+
this.text.addEventListener('change', this.change.bind(this));
|
|
57
|
+
if (this.required) {
|
|
58
|
+
this.text.setAttribute('required', '');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// events
|
|
63
|
+
public change($event): void {
|
|
64
|
+
this.touched = true;
|
|
65
|
+
this.onChange.emit(new CustomElementEventArgs(this.value, 'change'));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public validate(): void {
|
|
69
|
+
this.valid;
|
|
70
|
+
this.onValidate.emit(
|
|
71
|
+
new CustomElementEventArgs(this.value, 'validate'),
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
import CustomElement from '../../framework/custom-element.decorator';
|
|
2
|
-
import { CustomInputElement } from '../../framework/CustomInputElement';
|
|
3
|
-
import { CustomElementEventArgs } from '../../framework/CustomEvents';
|
|
4
|
-
import CprValidator from '../../framework/Validation/Validators/CPR';
|
|
5
|
-
import CvrValidator from '../../framework/Validation/Validators/CVR';
|
|
6
|
-
|
|
7
|
-
@CustomElement({
|
|
8
|
-
selector: 'cvr-element',
|
|
9
|
-
template: `
|
|
10
|
-
<div class="wrapper">
|
|
11
|
-
<input type="text" id='cvr-field' placeholder='SSSSSSSS'/>
|
|
12
|
-
</div>`,
|
|
13
|
-
style: `
|
|
14
|
-
:host{
|
|
15
|
-
width:100%;
|
|
16
|
-
}
|
|
17
|
-
.wrapper{
|
|
18
|
-
display:flex;
|
|
19
|
-
}
|
|
20
|
-
input{
|
|
21
|
-
box-sizing: border-box;
|
|
22
|
-
width: 100% !important;
|
|
23
|
-
border: none;
|
|
24
|
-
background-color: #f1f4ff;
|
|
25
|
-
margin: 2px;
|
|
26
|
-
resize: none;
|
|
27
|
-
}
|
|
28
|
-
`,
|
|
29
|
-
useShadow: true,
|
|
30
|
-
})
|
|
31
|
-
export class CVRElement extends CustomInputElement {
|
|
32
|
-
text: HTMLInputElement;
|
|
33
|
-
validator: CvrValidator = new CvrValidator();
|
|
34
|
-
|
|
35
|
-
constructor() {
|
|
36
|
-
super();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
get value(): string {
|
|
40
|
-
return `${this.text.value}`;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
set value(value: string) {
|
|
44
|
-
this.text.value = value;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
get valid(): boolean {
|
|
48
|
-
return this.validator.isSatisfiedBy(this.value, !this.required);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
connectedCallback(): void {
|
|
52
|
-
super.connectedCallback();
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
initChildInputs() {
|
|
56
|
-
this.text = super.getChildInput('#cvr-field');
|
|
57
|
-
this.text.addEventListener('change', this.change.bind(this));
|
|
58
|
-
if (this.required) {
|
|
59
|
-
this.text.setAttribute('required', '');
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// events
|
|
64
|
-
public change($event): void {
|
|
65
|
-
this.touched = true;
|
|
66
|
-
this.onChange.emit(new CustomElementEventArgs(this.value, 'change'));
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
public validate(): void {
|
|
70
|
-
this.valid;
|
|
71
|
-
this.onValidate.emit(
|
|
72
|
-
new CustomElementEventArgs(this.value, 'validate'),
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
1
|
+
import CustomElement from '../../framework/custom-element.decorator';
|
|
2
|
+
import { CustomInputElement } from '../../framework/CustomInputElement';
|
|
3
|
+
import { CustomElementEventArgs } from '../../framework/CustomEvents';
|
|
4
|
+
import CprValidator from '../../framework/Validation/Validators/CPR';
|
|
5
|
+
import CvrValidator from '../../framework/Validation/Validators/CVR';
|
|
6
|
+
|
|
7
|
+
@CustomElement({
|
|
8
|
+
selector: 'cvr-element',
|
|
9
|
+
template: `
|
|
10
|
+
<div class="wrapper">
|
|
11
|
+
<input type="text" id='cvr-field' placeholder='SSSSSSSS'/>
|
|
12
|
+
</div>`,
|
|
13
|
+
style: `
|
|
14
|
+
:host{
|
|
15
|
+
width:100%;
|
|
16
|
+
}
|
|
17
|
+
.wrapper{
|
|
18
|
+
display:flex;
|
|
19
|
+
}
|
|
20
|
+
input{
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
width: 100% !important;
|
|
23
|
+
border: none;
|
|
24
|
+
background-color: #f1f4ff;
|
|
25
|
+
margin: 2px;
|
|
26
|
+
resize: none;
|
|
27
|
+
}
|
|
28
|
+
`,
|
|
29
|
+
useShadow: true,
|
|
30
|
+
})
|
|
31
|
+
export class CVRElement extends CustomInputElement {
|
|
32
|
+
text: HTMLInputElement;
|
|
33
|
+
validator: CvrValidator = new CvrValidator();
|
|
34
|
+
|
|
35
|
+
constructor() {
|
|
36
|
+
super();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
get value(): string {
|
|
40
|
+
return `${this.text.value}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
set value(value: string) {
|
|
44
|
+
this.text.value = value;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
get valid(): boolean {
|
|
48
|
+
return this.validator.isSatisfiedBy(this.value, !this.required);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
connectedCallback(): void {
|
|
52
|
+
super.connectedCallback();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
initChildInputs() {
|
|
56
|
+
this.text = super.getChildInput('#cvr-field');
|
|
57
|
+
this.text.addEventListener('change', this.change.bind(this));
|
|
58
|
+
if (this.required) {
|
|
59
|
+
this.text.setAttribute('required', '');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// events
|
|
64
|
+
public change($event): void {
|
|
65
|
+
this.touched = true;
|
|
66
|
+
this.onChange.emit(new CustomElementEventArgs(this.value, 'change'));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public validate(): void {
|
|
70
|
+
this.valid;
|
|
71
|
+
this.onValidate.emit(
|
|
72
|
+
new CustomElementEventArgs(this.value, 'validate'),
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
}
|