@everymatrix/general-input 1.10.2 → 1.15.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/cjs/checkbox-group-input_10.cjs.entry.js +35539 -0
- package/dist/cjs/general-input.cjs.entry.js +34 -13
- package/dist/cjs/general-input.cjs.js +2 -2
- package/dist/cjs/{index-64a5cb7f.js → index-132a0774.js} +119 -6
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/locale.utils-7665b010.js +71 -0
- package/dist/cjs/toggle-checkbox-input.cjs.entry.js +85 -0
- package/dist/cjs/tooltipIcon-092a795f.js +5 -0
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/checkbox-group-input/checkbox-group-input.css +62 -0
- package/dist/collection/components/checkbox-group-input/checkbox-group-input.js +366 -0
- package/dist/collection/components/checkbox-input/checkbox-input.css +47 -1
- package/dist/collection/components/checkbox-input/checkbox-input.js +143 -16
- package/dist/collection/components/date-input/date-input.css +64 -30
- package/dist/collection/components/date-input/date-input.js +194 -13
- package/dist/collection/components/email-input/email-input.css +63 -28
- package/dist/collection/components/email-input/email-input.js +197 -21
- package/dist/collection/components/general-input/general-input.js +163 -21
- package/dist/collection/components/number-input/number-input.css +65 -30
- package/dist/collection/components/number-input/number-input.js +174 -19
- package/dist/collection/components/password-input/password-input.css +120 -29
- package/dist/collection/components/password-input/password-input.js +341 -25
- package/dist/collection/components/radio-input/radio-input.css +22 -1
- package/dist/collection/components/radio-input/radio-input.js +89 -10
- package/dist/collection/components/select-input/select-input.css +75 -22
- package/dist/collection/components/select-input/select-input.js +180 -37
- package/dist/collection/components/tel-input/tel-input.css +91 -33
- package/dist/collection/components/tel-input/tel-input.js +202 -24
- package/dist/collection/components/text-input/text-input.css +63 -28
- package/dist/collection/components/text-input/text-input.js +208 -39
- package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.css +76 -0
- package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.js +324 -0
- package/dist/collection/utils/locale.utils.js +52 -13
- package/dist/collection/utils/tooltipIcon.svg +5 -0
- package/dist/components/active-mixin.js +975 -0
- package/dist/components/checkbox-group-input.d.ts +11 -0
- package/dist/components/checkbox-group-input.js +6 -0
- package/dist/components/checkbox-group-input2.js +1125 -0
- package/dist/components/checkbox-input2.js +62 -12
- package/dist/components/date-input2.js +10247 -15
- package/dist/components/email-input2.js +98 -21
- package/dist/components/field-mixin.js +12712 -0
- package/dist/components/general-input.js +1 -118
- package/dist/components/general-input2.js +331 -0
- package/dist/components/input-field-shared-styles.js +1114 -0
- package/dist/components/number-input2.js +92 -16
- package/dist/components/password-input2.js +924 -24
- package/dist/components/pattern-mixin.js +85 -0
- package/dist/components/radio-input2.js +45 -11
- package/dist/components/select-input2.js +87 -27
- package/dist/components/tel-input2.js +122 -22
- package/dist/components/text-input2.js +120 -34
- package/dist/components/toggle-checkbox-input.d.ts +11 -0
- package/dist/components/toggle-checkbox-input.js +6 -0
- package/dist/components/tooltipIcon.js +70 -0
- package/dist/components/vaadin-button.js +461 -0
- package/dist/components/vaadin-combo-box.js +4329 -0
- package/dist/components/virtual-keyboard-controller.js +2658 -0
- package/dist/esm/checkbox-group-input_10.entry.js +35526 -0
- package/dist/esm/general-input.entry.js +34 -13
- package/dist/esm/general-input.js +2 -2
- package/dist/esm/{index-df80f936.js → index-db76d5b5.js} +118 -7
- package/dist/esm/loader.js +2 -2
- package/dist/esm/locale.utils-95ea2605.js +68 -0
- package/dist/esm/toggle-checkbox-input.entry.js +81 -0
- package/dist/esm/tooltipIcon-99c1c7b7.js +3 -0
- package/dist/general-input/general-input.esm.js +1 -1
- package/dist/general-input/p-0966f523.entry.js +3581 -0
- package/dist/general-input/p-916a1319.entry.js +1 -0
- package/dist/general-input/p-b408093e.js +1 -0
- package/dist/general-input/p-c2d4d6ac.entry.js +1 -0
- package/dist/general-input/p-f4f4ccda.js +1 -0
- package/dist/general-input/p-f6132f1d.js +1 -0
- package/dist/types/components/checkbox-group-input/checkbox-group-input.d.ts +74 -0
- package/dist/types/components/checkbox-input/checkbox-input.d.ts +28 -2
- package/dist/types/components/date-input/date-input.d.ts +43 -1
- package/dist/types/components/email-input/email-input.d.ts +37 -3
- package/dist/types/components/general-input/general-input.d.ts +30 -0
- package/dist/types/components/number-input/number-input.d.ts +34 -3
- package/dist/types/components/password-input/password-input.d.ts +56 -7
- package/dist/types/components/radio-input/radio-input.d.ts +17 -1
- package/dist/types/components/select-input/select-input.d.ts +36 -3
- package/dist/types/components/tel-input/tel-input.d.ts +40 -5
- package/dist/types/components/text-input/text-input.d.ts +84 -0
- package/dist/types/components/toggle-checkbox-input/toggle-checkbox-input.d.ts +67 -0
- package/dist/types/components.d.ts +568 -9
- package/dist/types/utils/locale.utils.d.ts +9 -0
- package/dist/types/utils/types.d.ts +41 -9
- package/package.json +8 -1
- package/dist/cjs/checkbox-input_9.cjs.entry.js +0 -623
- package/dist/components/locale.utils.js +0 -29
- package/dist/esm/checkbox-input_9.entry.js +0 -611
- package/dist/general-input/p-1703fce3.entry.js +0 -1
- package/dist/general-input/p-d9f7fa2e.js +0 -1
- package/dist/general-input/p-dea0a4ac.entry.js +0 -1
- /package/dist/types/Users/{user/workspace/everymatrix → adrian.pripon/Documents/Work}/widgets-stencil/packages/general-input/.stencil/packages/general-input/stencil.config.d.ts +0 -0
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
import { Component, h, Prop, State, Watch, Event } from '@stencil/core';
|
|
1
|
+
import { Component, h, Prop, State, Watch, Event, Listen } from '@stencil/core';
|
|
2
2
|
import { translate } from '../../utils/locale.utils';
|
|
3
|
+
import tooltipIcon from '../../utils/tooltipIcon.svg';
|
|
3
4
|
export class RadioInput {
|
|
5
|
+
constructor() {
|
|
6
|
+
/**
|
|
7
|
+
* Client custom styling via inline style
|
|
8
|
+
*/
|
|
9
|
+
this.clientStyling = '';
|
|
10
|
+
this.limitStylingAppends = false;
|
|
11
|
+
this.showTooltip = false;
|
|
12
|
+
this.setClientStyling = () => {
|
|
13
|
+
let sheet = document.createElement('style');
|
|
14
|
+
sheet.innerHTML = this.clientStyling;
|
|
15
|
+
this.stylingContainer.prepend(sheet);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
4
18
|
validityChanged() {
|
|
5
19
|
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
6
20
|
if (this.emitValue == true) {
|
|
@@ -18,13 +32,25 @@ export class RadioInput {
|
|
|
18
32
|
validityStateHandler(inputStateEvent) {
|
|
19
33
|
this.sendValidityState.emit(inputStateEvent);
|
|
20
34
|
}
|
|
21
|
-
|
|
35
|
+
handleClickOutside(event) {
|
|
36
|
+
if (event.composedPath()[0] === this.tooltipIconReference)
|
|
37
|
+
return;
|
|
38
|
+
if (event.composedPath()[0] !== this.tooltipReference)
|
|
39
|
+
this.showTooltip = false;
|
|
40
|
+
}
|
|
41
|
+
componentDidRender() {
|
|
42
|
+
// start custom styling area
|
|
43
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
44
|
+
if (this.clientStyling)
|
|
45
|
+
this.setClientStyling();
|
|
46
|
+
this.limitStylingAppends = true;
|
|
47
|
+
}
|
|
48
|
+
// end custom styling area
|
|
22
49
|
}
|
|
23
50
|
handleClick(event) {
|
|
24
51
|
this.value = event.target.value;
|
|
25
52
|
this.isValid = this.setValidity();
|
|
26
53
|
this.errorMessage = this.setErrorMessage();
|
|
27
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
28
54
|
this.emitValueHandler(true);
|
|
29
55
|
}
|
|
30
56
|
setValidity() {
|
|
@@ -35,15 +61,24 @@ export class RadioInput {
|
|
|
35
61
|
return translate('requiredError', this.language);
|
|
36
62
|
}
|
|
37
63
|
}
|
|
64
|
+
renderTooltip() {
|
|
65
|
+
if (this.showTooltip) {
|
|
66
|
+
return (h("div", { class: `radio__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
38
70
|
render() {
|
|
39
|
-
return h("fieldset", { class:
|
|
71
|
+
return h("fieldset", { class: `radio__fieldset ${this.name}__input`, ref: el => this.stylingContainer = el },
|
|
40
72
|
h("legend", { class: 'radio__legend' },
|
|
41
73
|
this.displayName,
|
|
42
74
|
":"),
|
|
43
75
|
this.optionsGroup.map(option => h("div", { class: 'radio__wrapper' },
|
|
44
76
|
h("input", { type: "radio", class: 'radio__input', id: `${option.label}__input`, ref: (el) => this.inputReference = el, value: option.value, name: this.name, required: this.validation.mandatory, onClick: (e) => this.handleClick(e) }),
|
|
45
77
|
h("label", { htmlFor: `${option.label}__input` }, option.label))),
|
|
46
|
-
h("small", { class: 'radio__error-message' }, this.errorMessage)
|
|
78
|
+
h("small", { class: 'radio__error-message' }, this.errorMessage),
|
|
79
|
+
this.tooltip &&
|
|
80
|
+
h("img", { class: 'radio__tooltip-icon', src: tooltipIcon, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }),
|
|
81
|
+
this.renderTooltip());
|
|
47
82
|
}
|
|
48
83
|
static get is() { return "radio-input"; }
|
|
49
84
|
static get encapsulation() { return "shadow"; }
|
|
@@ -69,7 +104,7 @@ export class RadioInput {
|
|
|
69
104
|
"text": "Name of the input."
|
|
70
105
|
},
|
|
71
106
|
"attribute": "name",
|
|
72
|
-
"reflect":
|
|
107
|
+
"reflect": true
|
|
73
108
|
},
|
|
74
109
|
"displayName": {
|
|
75
110
|
"type": "string",
|
|
@@ -86,7 +121,7 @@ export class RadioInput {
|
|
|
86
121
|
"text": "Name of input to be shown to the user."
|
|
87
122
|
},
|
|
88
123
|
"attribute": "display-name",
|
|
89
|
-
"reflect":
|
|
124
|
+
"reflect": true
|
|
90
125
|
},
|
|
91
126
|
"optionsGroup": {
|
|
92
127
|
"type": "unknown",
|
|
@@ -128,6 +163,23 @@ export class RadioInput {
|
|
|
128
163
|
"text": "Object of validation rules for the input."
|
|
129
164
|
}
|
|
130
165
|
},
|
|
166
|
+
"tooltip": {
|
|
167
|
+
"type": "string",
|
|
168
|
+
"mutable": false,
|
|
169
|
+
"complexType": {
|
|
170
|
+
"original": "string",
|
|
171
|
+
"resolved": "string",
|
|
172
|
+
"references": {}
|
|
173
|
+
},
|
|
174
|
+
"required": false,
|
|
175
|
+
"optional": false,
|
|
176
|
+
"docs": {
|
|
177
|
+
"tags": [],
|
|
178
|
+
"text": "Tooltip text."
|
|
179
|
+
},
|
|
180
|
+
"attribute": "tooltip",
|
|
181
|
+
"reflect": true
|
|
182
|
+
},
|
|
131
183
|
"language": {
|
|
132
184
|
"type": "string",
|
|
133
185
|
"mutable": false,
|
|
@@ -143,7 +195,7 @@ export class RadioInput {
|
|
|
143
195
|
"text": "Currently selected language."
|
|
144
196
|
},
|
|
145
197
|
"attribute": "language",
|
|
146
|
-
"reflect":
|
|
198
|
+
"reflect": true
|
|
147
199
|
},
|
|
148
200
|
"emitValue": {
|
|
149
201
|
"type": "boolean",
|
|
@@ -160,12 +212,32 @@ export class RadioInput {
|
|
|
160
212
|
"text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
|
|
161
213
|
},
|
|
162
214
|
"attribute": "emit-value",
|
|
163
|
-
"reflect":
|
|
215
|
+
"reflect": true
|
|
216
|
+
},
|
|
217
|
+
"clientStyling": {
|
|
218
|
+
"type": "string",
|
|
219
|
+
"mutable": false,
|
|
220
|
+
"complexType": {
|
|
221
|
+
"original": "string",
|
|
222
|
+
"resolved": "string",
|
|
223
|
+
"references": {}
|
|
224
|
+
},
|
|
225
|
+
"required": false,
|
|
226
|
+
"optional": false,
|
|
227
|
+
"docs": {
|
|
228
|
+
"tags": [],
|
|
229
|
+
"text": "Client custom styling via inline style"
|
|
230
|
+
},
|
|
231
|
+
"attribute": "client-styling",
|
|
232
|
+
"reflect": true,
|
|
233
|
+
"defaultValue": "''"
|
|
164
234
|
}
|
|
165
235
|
}; }
|
|
166
236
|
static get states() { return {
|
|
167
237
|
"errorMessage": {},
|
|
168
|
-
"isValid": {}
|
|
238
|
+
"isValid": {},
|
|
239
|
+
"limitStylingAppends": {},
|
|
240
|
+
"showTooltip": {}
|
|
169
241
|
}; }
|
|
170
242
|
static get events() { return [{
|
|
171
243
|
"method": "sendInputValue",
|
|
@@ -215,4 +287,11 @@ export class RadioInput {
|
|
|
215
287
|
"propName": "emitValue",
|
|
216
288
|
"methodName": "emitValueHandler"
|
|
217
289
|
}]; }
|
|
290
|
+
static get listeners() { return [{
|
|
291
|
+
"name": "click",
|
|
292
|
+
"method": "handleClickOutside",
|
|
293
|
+
"target": "document",
|
|
294
|
+
"capture": false,
|
|
295
|
+
"passive": false
|
|
296
|
+
}]; }
|
|
218
297
|
}
|
|
@@ -6,44 +6,97 @@
|
|
|
6
6
|
box-sizing: border-box;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
.select {
|
|
10
|
+
font-family: "Roboto";
|
|
11
|
+
font-style: normal;
|
|
12
|
+
}
|
|
9
13
|
.select__wrapper {
|
|
10
14
|
position: relative;
|
|
11
|
-
display: flex;
|
|
12
|
-
padding-top: 10px;
|
|
13
15
|
width: 100%;
|
|
14
16
|
}
|
|
17
|
+
.select__wrapper--autofilled {
|
|
18
|
+
pointer-events: none;
|
|
19
|
+
}
|
|
20
|
+
.select__wrapper--autofilled .select__label {
|
|
21
|
+
color: #979797;
|
|
22
|
+
}
|
|
23
|
+
.select__wrapper--autofilled .select__input::part(input-field) {
|
|
24
|
+
color: #979797;
|
|
25
|
+
}
|
|
26
|
+
.select__wrapper--flex {
|
|
27
|
+
display: flex;
|
|
28
|
+
gap: 5px;
|
|
29
|
+
}
|
|
30
|
+
.select__wrapper--relative {
|
|
31
|
+
position: relative;
|
|
32
|
+
}
|
|
15
33
|
.select__label {
|
|
16
|
-
|
|
34
|
+
font-family: inherit;
|
|
35
|
+
font-style: normal;
|
|
36
|
+
font-weight: 500;
|
|
17
37
|
font-size: 16px;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
left: 5px;
|
|
21
|
-
transform: translateY(-25px);
|
|
22
|
-
transition: all 0.3s cubic-bezier(0.5, 0, 0.5, 1);
|
|
38
|
+
line-height: 20px;
|
|
39
|
+
color: #2A3841;
|
|
23
40
|
}
|
|
24
|
-
.select__label--
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
41
|
+
.select__label--required::after {
|
|
42
|
+
content: "*";
|
|
43
|
+
font-family: inherit;
|
|
44
|
+
color: #2A3841;
|
|
45
|
+
margin-left: 2px;
|
|
28
46
|
}
|
|
29
47
|
.select__input {
|
|
48
|
+
border: none;
|
|
30
49
|
width: inherit;
|
|
31
|
-
padding: 15px 6px;
|
|
32
50
|
position: relative;
|
|
33
|
-
|
|
34
|
-
|
|
51
|
+
}
|
|
52
|
+
.select__input[focused]::part(input-field) {
|
|
53
|
+
border-color: #3E3E3E;
|
|
54
|
+
}
|
|
55
|
+
.select__input[invalid]::part(input-field) {
|
|
56
|
+
border-color: #cc0000b3;
|
|
57
|
+
}
|
|
58
|
+
.select__input vaadin-date-picker-overlay-content > vaadin-button {
|
|
59
|
+
color: #1F1F1F;
|
|
60
|
+
}
|
|
61
|
+
.select__input vaadin-month-calendar::part(selected date) {
|
|
62
|
+
background-color: red;
|
|
63
|
+
}
|
|
64
|
+
.select__input::part(input-field) {
|
|
65
|
+
border-radius: 4px;
|
|
66
|
+
background-color: #FFFFFF;
|
|
67
|
+
border: 2px solid #DEE1EE;
|
|
68
|
+
color: #2A2E3F;
|
|
69
|
+
border-radius: 4px;
|
|
35
70
|
background-color: transparent;
|
|
36
|
-
color: #666666;
|
|
37
|
-
font-size: 16px;
|
|
38
71
|
font-family: inherit;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
72
|
+
font-style: normal;
|
|
73
|
+
font-weight: 300;
|
|
74
|
+
font-size: 16px;
|
|
75
|
+
line-height: 19px;
|
|
43
76
|
}
|
|
44
77
|
.select__error-message {
|
|
45
78
|
position: absolute;
|
|
46
79
|
top: calc(100% + 5px);
|
|
47
80
|
left: 0;
|
|
48
|
-
color: #
|
|
81
|
+
color: #cc0000b3;
|
|
82
|
+
}
|
|
83
|
+
.select__tooltip-icon {
|
|
84
|
+
width: 16px;
|
|
85
|
+
height: auto;
|
|
86
|
+
}
|
|
87
|
+
.select__tooltip {
|
|
88
|
+
position: absolute;
|
|
89
|
+
top: 0;
|
|
90
|
+
left: 20px;
|
|
91
|
+
background-color: #FFFFFF;
|
|
92
|
+
border: 1px solid #B0B0B0;
|
|
93
|
+
color: #2B2D3F;
|
|
94
|
+
padding: 10px;
|
|
95
|
+
border-radius: 5px;
|
|
96
|
+
opacity: 0;
|
|
97
|
+
transition: opacity 0.3s ease-in-out;
|
|
98
|
+
z-index: 10;
|
|
99
|
+
}
|
|
100
|
+
.select__tooltip.visible {
|
|
101
|
+
opacity: 1;
|
|
49
102
|
}
|
|
@@ -1,11 +1,36 @@
|
|
|
1
|
-
import { Component, h, Prop, State, Watch, Event } from '@stencil/core';
|
|
1
|
+
import { Component, h, Prop, State, Watch, Event, Element, Listen } from '@stencil/core';
|
|
2
2
|
import { translate } from '../../utils/locale.utils';
|
|
3
|
+
import '@vaadin/combo-box';
|
|
4
|
+
import tooltipIcon from '../../utils/tooltipIcon.svg';
|
|
3
5
|
export class SelectInput {
|
|
4
6
|
constructor() {
|
|
7
|
+
/**
|
|
8
|
+
* Default value for the input.
|
|
9
|
+
*/
|
|
10
|
+
this.defaultValue = '';
|
|
5
11
|
/**
|
|
6
12
|
* Options of the input.
|
|
7
13
|
*/
|
|
8
14
|
this.options = [];
|
|
15
|
+
/**
|
|
16
|
+
* Client custom styling via inline style
|
|
17
|
+
*/
|
|
18
|
+
this.clientStyling = '';
|
|
19
|
+
this.limitStylingAppends = false;
|
|
20
|
+
this.showTooltip = false;
|
|
21
|
+
this.touched = false;
|
|
22
|
+
this.handleChange = (event) => {
|
|
23
|
+
this.touched = true;
|
|
24
|
+
this.value = event.target.value;
|
|
25
|
+
this.isValid = this.setValidity();
|
|
26
|
+
this.errorMessage = this.setErrorMessage();
|
|
27
|
+
this.emitValueHandler(true);
|
|
28
|
+
};
|
|
29
|
+
this.setClientStyling = () => {
|
|
30
|
+
let sheet = document.createElement('style');
|
|
31
|
+
sheet.innerHTML = this.clientStyling;
|
|
32
|
+
this.stylingContainer.prepend(sheet);
|
|
33
|
+
};
|
|
9
34
|
}
|
|
10
35
|
validityChanged() {
|
|
11
36
|
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
@@ -24,23 +49,50 @@ export class SelectInput {
|
|
|
24
49
|
valueHandler(inputValueEvent) {
|
|
25
50
|
this.sendInputValue.emit(inputValueEvent);
|
|
26
51
|
}
|
|
52
|
+
handleClickOutside(event) {
|
|
53
|
+
if (event.composedPath()[0] === this.tooltipIconReference)
|
|
54
|
+
return;
|
|
55
|
+
if (event.composedPath()[0] !== this.tooltipReference)
|
|
56
|
+
this.showTooltip = false;
|
|
57
|
+
}
|
|
27
58
|
connectedCallback() {
|
|
28
|
-
this.displayedOptions = this.options
|
|
59
|
+
this.displayedOptions = this.options.map(option => ({
|
|
60
|
+
label: option.label,
|
|
61
|
+
value: option.value.toUpperCase()
|
|
62
|
+
}));
|
|
29
63
|
}
|
|
30
64
|
componentWillLoad() {
|
|
31
65
|
if (this.action && !this.options.length) {
|
|
32
66
|
if (this.action.split(" ")[0] == 'GET') {
|
|
33
|
-
|
|
34
|
-
|
|
67
|
+
const endpoint = this.action.split(" ")[1];
|
|
68
|
+
return this.getOptions(endpoint).then((options) => {
|
|
69
|
+
const firstKey = Object.keys(options)[0];
|
|
70
|
+
this.displayedOptions = options[firstKey].map(option => {
|
|
35
71
|
return { label: option.Name, value: option.Alpha2Code };
|
|
36
72
|
});
|
|
37
73
|
});
|
|
38
74
|
}
|
|
39
75
|
}
|
|
40
76
|
}
|
|
41
|
-
|
|
42
|
-
//
|
|
43
|
-
|
|
77
|
+
componentDidRender() {
|
|
78
|
+
// start custom styling area
|
|
79
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
80
|
+
if (this.clientStyling)
|
|
81
|
+
this.setClientStyling();
|
|
82
|
+
this.limitStylingAppends = true;
|
|
83
|
+
}
|
|
84
|
+
// end custom styling area
|
|
85
|
+
}
|
|
86
|
+
componentDidLoad() {
|
|
87
|
+
this.inputReference = this.element.shadowRoot.querySelector('input');
|
|
88
|
+
this.isValid = this.setValidity();
|
|
89
|
+
if (this.defaultValue) {
|
|
90
|
+
this.value = this.defaultValue.toUpperCase();
|
|
91
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
getOptions(endpoint) {
|
|
95
|
+
const url = new URL(endpoint);
|
|
44
96
|
return new Promise((resolve, reject) => {
|
|
45
97
|
fetch(url.href)
|
|
46
98
|
.then((res) => res.json())
|
|
@@ -52,14 +104,6 @@ export class SelectInput {
|
|
|
52
104
|
});
|
|
53
105
|
});
|
|
54
106
|
}
|
|
55
|
-
handleChange(event) {
|
|
56
|
-
this.value = event.target.value;
|
|
57
|
-
this.errorMessage = this.setErrorMessage();
|
|
58
|
-
this.isValid = this.setValidity();
|
|
59
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
60
|
-
this.emitValueHandler(true);
|
|
61
|
-
this.inputReference.previousElementSibling.classList.remove('select__label--hidden');
|
|
62
|
-
}
|
|
63
107
|
setValidity() {
|
|
64
108
|
return this.inputReference.validity.valid;
|
|
65
109
|
}
|
|
@@ -68,23 +112,25 @@ export class SelectInput {
|
|
|
68
112
|
return translate('requiredError', this.language);
|
|
69
113
|
}
|
|
70
114
|
}
|
|
115
|
+
renderTooltip() {
|
|
116
|
+
if (this.showTooltip) {
|
|
117
|
+
return (h("div", { class: `select__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
71
121
|
render() {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
h("
|
|
78
|
-
h("
|
|
79
|
-
|
|
80
|
-
this.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
" ",
|
|
85
|
-
option.label,
|
|
86
|
-
" ");
|
|
87
|
-
})),
|
|
122
|
+
let invalidClass = '';
|
|
123
|
+
if (this.touched) {
|
|
124
|
+
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
125
|
+
}
|
|
126
|
+
return h("div", { class: `select__wrapper ${this.autofilled ? 'select__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el },
|
|
127
|
+
h("div", { class: 'select__wrapper--flex' },
|
|
128
|
+
h("label", { class: 'select__label', htmlFor: `${this.name}__input` }, `${this.displayName} ${this.validation.mandatory ? '*' : ''}`),
|
|
129
|
+
h("div", { class: 'select__wrapper--relative' },
|
|
130
|
+
this.tooltip &&
|
|
131
|
+
h("img", { class: 'select__tooltip-icon', src: tooltipIcon, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }),
|
|
132
|
+
this.renderTooltip())),
|
|
133
|
+
h("vaadin-combo-box", { name: this.name, id: `${this.name}__input`, class: `select__input ${invalidClass} ${this.autofilled ? 'select__input--autofilled' : ''}`, "item-label-path": "label", "item-value-path": "value", readOnly: this.autofilled, required: this.validation.mandatory, value: this.defaultValue, placeholder: `${this.placeholder}`, items: this.displayedOptions, onChange: this.handleChange }),
|
|
88
134
|
h("small", { class: 'select__error-message' }, this.errorMessage));
|
|
89
135
|
}
|
|
90
136
|
static get is() { return "select-input"; }
|
|
@@ -111,7 +157,7 @@ export class SelectInput {
|
|
|
111
157
|
"text": "Name of the input."
|
|
112
158
|
},
|
|
113
159
|
"attribute": "name",
|
|
114
|
-
"reflect":
|
|
160
|
+
"reflect": true
|
|
115
161
|
},
|
|
116
162
|
"displayName": {
|
|
117
163
|
"type": "string",
|
|
@@ -128,7 +174,24 @@ export class SelectInput {
|
|
|
128
174
|
"text": "Name of input to be shown to the user."
|
|
129
175
|
},
|
|
130
176
|
"attribute": "display-name",
|
|
131
|
-
"reflect":
|
|
177
|
+
"reflect": true
|
|
178
|
+
},
|
|
179
|
+
"placeholder": {
|
|
180
|
+
"type": "string",
|
|
181
|
+
"mutable": false,
|
|
182
|
+
"complexType": {
|
|
183
|
+
"original": "string",
|
|
184
|
+
"resolved": "string",
|
|
185
|
+
"references": {}
|
|
186
|
+
},
|
|
187
|
+
"required": false,
|
|
188
|
+
"optional": false,
|
|
189
|
+
"docs": {
|
|
190
|
+
"tags": [],
|
|
191
|
+
"text": "Placeholder text to be shown."
|
|
192
|
+
},
|
|
193
|
+
"attribute": "placeholder",
|
|
194
|
+
"reflect": true
|
|
132
195
|
},
|
|
133
196
|
"action": {
|
|
134
197
|
"type": "string",
|
|
@@ -145,7 +208,59 @@ export class SelectInput {
|
|
|
145
208
|
"text": "Special behaviour an input should have. Can be fetching for data."
|
|
146
209
|
},
|
|
147
210
|
"attribute": "action",
|
|
148
|
-
"reflect":
|
|
211
|
+
"reflect": true
|
|
212
|
+
},
|
|
213
|
+
"defaultValue": {
|
|
214
|
+
"type": "string",
|
|
215
|
+
"mutable": false,
|
|
216
|
+
"complexType": {
|
|
217
|
+
"original": "string",
|
|
218
|
+
"resolved": "string",
|
|
219
|
+
"references": {}
|
|
220
|
+
},
|
|
221
|
+
"required": false,
|
|
222
|
+
"optional": false,
|
|
223
|
+
"docs": {
|
|
224
|
+
"tags": [],
|
|
225
|
+
"text": "Default value for the input."
|
|
226
|
+
},
|
|
227
|
+
"attribute": "default-value",
|
|
228
|
+
"reflect": true,
|
|
229
|
+
"defaultValue": "''"
|
|
230
|
+
},
|
|
231
|
+
"autofilled": {
|
|
232
|
+
"type": "boolean",
|
|
233
|
+
"mutable": false,
|
|
234
|
+
"complexType": {
|
|
235
|
+
"original": "boolean",
|
|
236
|
+
"resolved": "boolean",
|
|
237
|
+
"references": {}
|
|
238
|
+
},
|
|
239
|
+
"required": false,
|
|
240
|
+
"optional": false,
|
|
241
|
+
"docs": {
|
|
242
|
+
"tags": [],
|
|
243
|
+
"text": "Boolean. Determines if input should be readonly."
|
|
244
|
+
},
|
|
245
|
+
"attribute": "autofilled",
|
|
246
|
+
"reflect": true
|
|
247
|
+
},
|
|
248
|
+
"tooltip": {
|
|
249
|
+
"type": "string",
|
|
250
|
+
"mutable": false,
|
|
251
|
+
"complexType": {
|
|
252
|
+
"original": "string",
|
|
253
|
+
"resolved": "string",
|
|
254
|
+
"references": {}
|
|
255
|
+
},
|
|
256
|
+
"required": false,
|
|
257
|
+
"optional": false,
|
|
258
|
+
"docs": {
|
|
259
|
+
"tags": [],
|
|
260
|
+
"text": "Tooltip text."
|
|
261
|
+
},
|
|
262
|
+
"attribute": "tooltip",
|
|
263
|
+
"reflect": true
|
|
149
264
|
},
|
|
150
265
|
"options": {
|
|
151
266
|
"type": "unknown",
|
|
@@ -203,7 +318,7 @@ export class SelectInput {
|
|
|
203
318
|
"text": "Currently selected language."
|
|
204
319
|
},
|
|
205
320
|
"attribute": "language",
|
|
206
|
-
"reflect":
|
|
321
|
+
"reflect": true
|
|
207
322
|
},
|
|
208
323
|
"emitValue": {
|
|
209
324
|
"type": "boolean",
|
|
@@ -220,12 +335,32 @@ export class SelectInput {
|
|
|
220
335
|
"text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
|
|
221
336
|
},
|
|
222
337
|
"attribute": "emit-value",
|
|
223
|
-
"reflect":
|
|
338
|
+
"reflect": true
|
|
339
|
+
},
|
|
340
|
+
"clientStyling": {
|
|
341
|
+
"type": "string",
|
|
342
|
+
"mutable": false,
|
|
343
|
+
"complexType": {
|
|
344
|
+
"original": "string",
|
|
345
|
+
"resolved": "string",
|
|
346
|
+
"references": {}
|
|
347
|
+
},
|
|
348
|
+
"required": false,
|
|
349
|
+
"optional": false,
|
|
350
|
+
"docs": {
|
|
351
|
+
"tags": [],
|
|
352
|
+
"text": "Client custom styling via inline style"
|
|
353
|
+
},
|
|
354
|
+
"attribute": "client-styling",
|
|
355
|
+
"reflect": true,
|
|
356
|
+
"defaultValue": "''"
|
|
224
357
|
}
|
|
225
358
|
}; }
|
|
226
359
|
static get states() { return {
|
|
227
360
|
"errorMessage": {},
|
|
228
|
-
"isValid": {}
|
|
361
|
+
"isValid": {},
|
|
362
|
+
"limitStylingAppends": {},
|
|
363
|
+
"showTooltip": {}
|
|
229
364
|
}; }
|
|
230
365
|
static get events() { return [{
|
|
231
366
|
"method": "sendValidityState",
|
|
@@ -268,6 +403,7 @@ export class SelectInput {
|
|
|
268
403
|
}
|
|
269
404
|
}
|
|
270
405
|
}]; }
|
|
406
|
+
static get elementRef() { return "element"; }
|
|
271
407
|
static get watchers() { return [{
|
|
272
408
|
"propName": "isValid",
|
|
273
409
|
"methodName": "validityChanged"
|
|
@@ -275,4 +411,11 @@ export class SelectInput {
|
|
|
275
411
|
"propName": "emitValue",
|
|
276
412
|
"methodName": "emitValueHandler"
|
|
277
413
|
}]; }
|
|
414
|
+
static get listeners() { return [{
|
|
415
|
+
"name": "click",
|
|
416
|
+
"method": "handleClickOutside",
|
|
417
|
+
"target": "document",
|
|
418
|
+
"capture": false,
|
|
419
|
+
"passive": false
|
|
420
|
+
}]; }
|
|
278
421
|
}
|