@luftborn/custom-elements 1.4.0 → 1.4.1
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,99 +1,99 @@
|
|
|
1
|
-
import CustomElement from '../../framework/custom-element.decorator';
|
|
2
|
-
import { CustomInputElement } from '../../framework/CustomInputElement';
|
|
3
|
-
import { CustomElementEventArgs } from '../../framework/CustomEvents';
|
|
4
|
-
import { StringUtil } from '../../framework/Utilities/StringUtil';
|
|
5
|
-
|
|
6
|
-
@CustomElement({
|
|
7
|
-
selector: 'checkbox-element',
|
|
8
|
-
template: `
|
|
9
|
-
<div class="wrapper">
|
|
10
|
-
</div>`,
|
|
11
|
-
style: `
|
|
12
|
-
:host{
|
|
13
|
-
width:100%;
|
|
14
|
-
}
|
|
15
|
-
.checkbox {
|
|
16
|
-
width: auto;
|
|
17
|
-
margin: auto 3px;
|
|
18
|
-
color: rgba(72, 72, 72, 0.75);
|
|
19
|
-
font-size: 13px;
|
|
20
|
-
}
|
|
21
|
-
input[type='checkbox']{
|
|
22
|
-
box-sizing: border-box;
|
|
23
|
-
width: auto !important;
|
|
24
|
-
border: none;
|
|
25
|
-
background-color: #f1f4ff;
|
|
26
|
-
margin: 2px;
|
|
27
|
-
resize: none;
|
|
28
|
-
}
|
|
29
|
-
`,
|
|
30
|
-
useShadow: true,
|
|
31
|
-
})
|
|
32
|
-
export class CheckBoxElement extends CustomInputElement {
|
|
33
|
-
checkbox: HTMLInputElement[];
|
|
34
|
-
checkboxTemplate = `
|
|
35
|
-
<div class='checkbox'>
|
|
36
|
-
<input type='checkbox' name='{0}' value="{1}" id="{2}"/>
|
|
37
|
-
<label for="{2}">{1}</label>
|
|
38
|
-
</div>`;
|
|
39
|
-
|
|
40
|
-
constructor() {
|
|
41
|
-
super();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
get value(): string[] {
|
|
45
|
-
return this.checkbox.filter(c => c.checked).map(c => c.value);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
set value(values: string[]) {
|
|
49
|
-
// this.checkbox.value = value;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
get valid(): boolean {
|
|
53
|
-
if (this.required) {
|
|
54
|
-
return this.value.length > 0;
|
|
55
|
-
} else {
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
connectedCallback(): void {
|
|
61
|
-
super.connectedCallback();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
initChildInputs() {
|
|
65
|
-
this.addCheckBoxes();
|
|
66
|
-
this.checkbox = super.getChildInputs(`[name='${this.name}']`);
|
|
67
|
-
this.checkbox.forEach(c =>
|
|
68
|
-
c.addEventListener('change', this.change.bind(this)),
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
private addCheckBoxes() {
|
|
73
|
-
const wrapper = super.getChildElement('.wrapper');
|
|
74
|
-
wrapper.innerHTML = "";
|
|
75
|
-
this.options.forEach((element, index) => {
|
|
76
|
-
wrapper.insertAdjacentHTML(
|
|
77
|
-
'beforeend',
|
|
78
|
-
StringUtil.StringFormat(
|
|
79
|
-
this.checkboxTemplate,
|
|
80
|
-
this.name,
|
|
81
|
-
element,
|
|
82
|
-
`${this.name}-${index}`,
|
|
83
|
-
),
|
|
84
|
-
);
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
// events
|
|
88
|
-
public change($event): void {
|
|
89
|
-
this.touched = true;
|
|
90
|
-
this.onChange.emit(new CustomElementEventArgs(this.value, 'change'));
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
public validate(): void {
|
|
94
|
-
this.valid;
|
|
95
|
-
this.onValidate.emit(
|
|
96
|
-
new CustomElementEventArgs(this.value, 'validate'),
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
1
|
+
import CustomElement from '../../framework/custom-element.decorator';
|
|
2
|
+
import { CustomInputElement } from '../../framework/CustomInputElement';
|
|
3
|
+
import { CustomElementEventArgs } from '../../framework/CustomEvents';
|
|
4
|
+
import { StringUtil } from '../../framework/Utilities/StringUtil';
|
|
5
|
+
|
|
6
|
+
@CustomElement({
|
|
7
|
+
selector: 'checkbox-element',
|
|
8
|
+
template: `
|
|
9
|
+
<div class="wrapper">
|
|
10
|
+
</div>`,
|
|
11
|
+
style: `
|
|
12
|
+
:host{
|
|
13
|
+
width:100%;
|
|
14
|
+
}
|
|
15
|
+
.checkbox {
|
|
16
|
+
width: auto;
|
|
17
|
+
margin: auto 3px;
|
|
18
|
+
color: rgba(72, 72, 72, 0.75);
|
|
19
|
+
font-size: 13px;
|
|
20
|
+
}
|
|
21
|
+
input[type='checkbox']{
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
width: auto !important;
|
|
24
|
+
border: none;
|
|
25
|
+
background-color: #f1f4ff;
|
|
26
|
+
margin: 2px;
|
|
27
|
+
resize: none;
|
|
28
|
+
}
|
|
29
|
+
`,
|
|
30
|
+
useShadow: true,
|
|
31
|
+
})
|
|
32
|
+
export class CheckBoxElement extends CustomInputElement {
|
|
33
|
+
checkbox: HTMLInputElement[];
|
|
34
|
+
checkboxTemplate = `
|
|
35
|
+
<div class='checkbox'>
|
|
36
|
+
<input type='checkbox' name='{0}' value="{1}" id="{2}"/>
|
|
37
|
+
<label for="{2}">{1}</label>
|
|
38
|
+
</div>`;
|
|
39
|
+
|
|
40
|
+
constructor() {
|
|
41
|
+
super();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
get value(): string[] {
|
|
45
|
+
return this.checkbox.filter(c => c.checked).map(c => c.value);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
set value(values: string[]) {
|
|
49
|
+
// this.checkbox.value = value;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
get valid(): boolean {
|
|
53
|
+
if (this.required) {
|
|
54
|
+
return this.value.length > 0;
|
|
55
|
+
} else {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
connectedCallback(): void {
|
|
61
|
+
super.connectedCallback();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
initChildInputs() {
|
|
65
|
+
this.addCheckBoxes();
|
|
66
|
+
this.checkbox = super.getChildInputs(`[name='${this.name}']`);
|
|
67
|
+
this.checkbox.forEach(c =>
|
|
68
|
+
c.addEventListener('change', this.change.bind(this)),
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private addCheckBoxes() {
|
|
73
|
+
const wrapper = super.getChildElement('.wrapper');
|
|
74
|
+
wrapper.innerHTML = "";
|
|
75
|
+
this.options.forEach((element, index) => {
|
|
76
|
+
wrapper.insertAdjacentHTML(
|
|
77
|
+
'beforeend',
|
|
78
|
+
StringUtil.StringFormat(
|
|
79
|
+
this.checkboxTemplate,
|
|
80
|
+
this.name,
|
|
81
|
+
element,
|
|
82
|
+
`${this.name}-${index}`,
|
|
83
|
+
),
|
|
84
|
+
);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
// events
|
|
88
|
+
public change($event): void {
|
|
89
|
+
this.touched = true;
|
|
90
|
+
this.onChange.emit(new CustomElementEventArgs(this.value, 'change'));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public validate(): void {
|
|
94
|
+
this.valid;
|
|
95
|
+
this.onValidate.emit(
|
|
96
|
+
new CustomElementEventArgs(this.value, 'validate'),
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -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
|
-
|
|
5
|
-
@CustomElement({
|
|
6
|
-
selector: 'regex-element',
|
|
7
|
-
template: `
|
|
8
|
-
<div class="wrapper">
|
|
9
|
-
<input type="text" id='regex-field'/>
|
|
10
|
-
</div>`,
|
|
11
|
-
style: `
|
|
12
|
-
:host{
|
|
13
|
-
width:100%;
|
|
14
|
-
}
|
|
15
|
-
.wrapper{
|
|
16
|
-
display:flex;
|
|
17
|
-
}
|
|
18
|
-
input{
|
|
19
|
-
box-sizing: border-box;
|
|
20
|
-
width: 100% !important;
|
|
21
|
-
border: none;
|
|
22
|
-
background-color: #f1f4ff;
|
|
23
|
-
margin: 2px;
|
|
24
|
-
resize: none;
|
|
25
|
-
}
|
|
26
|
-
`,
|
|
27
|
-
useShadow: true,
|
|
28
|
-
})
|
|
29
|
-
export class CustomRegularExpressionElement extends CustomInputElement {
|
|
30
|
-
text: HTMLInputElement;
|
|
31
|
-
|
|
32
|
-
constructor() {
|
|
33
|
-
super();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
get value(): string {
|
|
37
|
-
return `${this.text.value}`;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
set value(value: string) {
|
|
41
|
-
this.text.value = value;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
get valid(): boolean {
|
|
45
|
-
return this.text.validity.valid;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
connectedCallback(): void {
|
|
49
|
-
super.connectedCallback();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
initChildInputs() {
|
|
53
|
-
this.text = super.getChildInput('#regex-field');
|
|
54
|
-
this.text.addEventListener('change', this.change.bind(this));
|
|
55
|
-
if (this.required) {
|
|
56
|
-
this.text.setAttribute('required', '');
|
|
57
|
-
}
|
|
58
|
-
if (this.customValue) {
|
|
59
|
-
this.text.setAttribute('pattern', this.customValue);
|
|
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
|
+
|
|
5
|
+
@CustomElement({
|
|
6
|
+
selector: 'regex-element',
|
|
7
|
+
template: `
|
|
8
|
+
<div class="wrapper">
|
|
9
|
+
<input type="text" id='regex-field'/>
|
|
10
|
+
</div>`,
|
|
11
|
+
style: `
|
|
12
|
+
:host{
|
|
13
|
+
width:100%;
|
|
14
|
+
}
|
|
15
|
+
.wrapper{
|
|
16
|
+
display:flex;
|
|
17
|
+
}
|
|
18
|
+
input{
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
width: 100% !important;
|
|
21
|
+
border: none;
|
|
22
|
+
background-color: #f1f4ff;
|
|
23
|
+
margin: 2px;
|
|
24
|
+
resize: none;
|
|
25
|
+
}
|
|
26
|
+
`,
|
|
27
|
+
useShadow: true,
|
|
28
|
+
})
|
|
29
|
+
export class CustomRegularExpressionElement extends CustomInputElement {
|
|
30
|
+
text: HTMLInputElement;
|
|
31
|
+
|
|
32
|
+
constructor() {
|
|
33
|
+
super();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
get value(): string {
|
|
37
|
+
return `${this.text.value}`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
set value(value: string) {
|
|
41
|
+
this.text.value = value;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
get valid(): boolean {
|
|
45
|
+
return this.text.validity.valid;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
connectedCallback(): void {
|
|
49
|
+
super.connectedCallback();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
initChildInputs() {
|
|
53
|
+
this.text = super.getChildInput('#regex-field');
|
|
54
|
+
this.text.addEventListener('change', this.change.bind(this));
|
|
55
|
+
if (this.required) {
|
|
56
|
+
this.text.setAttribute('required', '');
|
|
57
|
+
}
|
|
58
|
+
if (this.customValue) {
|
|
59
|
+
this.text.setAttribute('pattern', this.customValue);
|
|
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,78 +1,78 @@
|
|
|
1
|
-
import CustomElement from '../../framework/custom-element.decorator';
|
|
2
|
-
import { CustomInputElement } from '../../framework/CustomInputElement';
|
|
3
|
-
import { CustomElementEventArgs } from '../../framework/CustomEvents';
|
|
4
|
-
|
|
5
|
-
@CustomElement({
|
|
6
|
-
selector: 'date-element',
|
|
7
|
-
template: `
|
|
8
|
-
<div class="wrapper">
|
|
9
|
-
<input type="date" id='date-field'/>
|
|
10
|
-
</div>`,
|
|
11
|
-
style: `
|
|
12
|
-
:host{
|
|
13
|
-
width:100%;
|
|
14
|
-
}
|
|
15
|
-
.wrapper{
|
|
16
|
-
display:flex;
|
|
17
|
-
}
|
|
18
|
-
input{
|
|
19
|
-
box-sizing: border-box;
|
|
20
|
-
width: 100% !important;
|
|
21
|
-
border: none;
|
|
22
|
-
background-color: #f1f4ff;
|
|
23
|
-
margin: 2px;
|
|
24
|
-
resize: none;
|
|
25
|
-
}
|
|
26
|
-
`,
|
|
27
|
-
useShadow: true,
|
|
28
|
-
})
|
|
29
|
-
export class DateFieldElement extends CustomInputElement {
|
|
30
|
-
date: HTMLInputElement;
|
|
31
|
-
|
|
32
|
-
constructor() {
|
|
33
|
-
super();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
get value(): string {
|
|
37
|
-
return this.date.value;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
set value(value: string) {
|
|
41
|
-
this.date.value = value;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
get valid(): boolean {
|
|
45
|
-
return this.date.validity.valid;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
connectedCallback(): void {
|
|
49
|
-
super.connectedCallback();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
initChildInputs() {
|
|
53
|
-
this.date = super.getChildInput('#date-field');
|
|
54
|
-
this.date.addEventListener('change', this.change.bind(this));
|
|
55
|
-
if (this.required) {
|
|
56
|
-
this.date.setAttribute('required', '');
|
|
57
|
-
}
|
|
58
|
-
if (this.max) {
|
|
59
|
-
this.date.setAttribute('max', this.max);
|
|
60
|
-
}
|
|
61
|
-
if (this.min) {
|
|
62
|
-
this.date.setAttribute('min', this.min);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// events
|
|
67
|
-
public change($event): void {
|
|
68
|
-
this.touched = true;
|
|
69
|
-
this.onChange.emit(new CustomElementEventArgs(this.value, 'change'));
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
public validate(): void {
|
|
73
|
-
this.valid;
|
|
74
|
-
this.onValidate.emit(
|
|
75
|
-
new CustomElementEventArgs(this.value, 'validate'),
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
1
|
+
import CustomElement from '../../framework/custom-element.decorator';
|
|
2
|
+
import { CustomInputElement } from '../../framework/CustomInputElement';
|
|
3
|
+
import { CustomElementEventArgs } from '../../framework/CustomEvents';
|
|
4
|
+
|
|
5
|
+
@CustomElement({
|
|
6
|
+
selector: 'date-element',
|
|
7
|
+
template: `
|
|
8
|
+
<div class="wrapper">
|
|
9
|
+
<input type="date" id='date-field'/>
|
|
10
|
+
</div>`,
|
|
11
|
+
style: `
|
|
12
|
+
:host{
|
|
13
|
+
width:100%;
|
|
14
|
+
}
|
|
15
|
+
.wrapper{
|
|
16
|
+
display:flex;
|
|
17
|
+
}
|
|
18
|
+
input{
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
width: 100% !important;
|
|
21
|
+
border: none;
|
|
22
|
+
background-color: #f1f4ff;
|
|
23
|
+
margin: 2px;
|
|
24
|
+
resize: none;
|
|
25
|
+
}
|
|
26
|
+
`,
|
|
27
|
+
useShadow: true,
|
|
28
|
+
})
|
|
29
|
+
export class DateFieldElement extends CustomInputElement {
|
|
30
|
+
date: HTMLInputElement;
|
|
31
|
+
|
|
32
|
+
constructor() {
|
|
33
|
+
super();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
get value(): string {
|
|
37
|
+
return this.date.value;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
set value(value: string) {
|
|
41
|
+
this.date.value = value;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
get valid(): boolean {
|
|
45
|
+
return this.date.validity.valid;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
connectedCallback(): void {
|
|
49
|
+
super.connectedCallback();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
initChildInputs() {
|
|
53
|
+
this.date = super.getChildInput('#date-field');
|
|
54
|
+
this.date.addEventListener('change', this.change.bind(this));
|
|
55
|
+
if (this.required) {
|
|
56
|
+
this.date.setAttribute('required', '');
|
|
57
|
+
}
|
|
58
|
+
if (this.max) {
|
|
59
|
+
this.date.setAttribute('max', this.max);
|
|
60
|
+
}
|
|
61
|
+
if (this.min) {
|
|
62
|
+
this.date.setAttribute('min', this.min);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// events
|
|
67
|
+
public change($event): void {
|
|
68
|
+
this.touched = true;
|
|
69
|
+
this.onChange.emit(new CustomElementEventArgs(this.value, 'change'));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
public validate(): void {
|
|
73
|
+
this.valid;
|
|
74
|
+
this.onValidate.emit(
|
|
75
|
+
new CustomElementEventArgs(this.value, 'validate'),
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
}
|