@unicef-polymer/etools-form-builder 3.2.4 → 3.2.5
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.
|
@@ -14,36 +14,36 @@ let RepeatableChoiceField = class RepeatableChoiceField extends RepeatableBaseFi
|
|
|
14
14
|
this.values = [];
|
|
15
15
|
}
|
|
16
16
|
controlTemplate(value, index) {
|
|
17
|
-
return html `
|
|
18
|
-
<div class="container">
|
|
19
|
-
<div class="checkbox-group">
|
|
17
|
+
return html `
|
|
18
|
+
<div class="container">
|
|
19
|
+
<div class="checkbox-group">
|
|
20
20
|
${repeat(this.options, (option) => {
|
|
21
21
|
const val = this.getValue(option);
|
|
22
22
|
const checked = Array.isArray(value) && value.includes(val);
|
|
23
|
-
return html `
|
|
24
|
-
<etools-checkbox
|
|
25
|
-
class="checkbox"
|
|
26
|
-
value="${val}"
|
|
27
|
-
?checked="${checked}"
|
|
28
|
-
?disabled="${this.isReadonly}"
|
|
29
|
-
@sl-change="${(e) => this.onToggle(val, e.target.checked, index)}"
|
|
30
|
-
>
|
|
31
|
-
${this.getLabel(option)}
|
|
32
|
-
</etools-checkbox>
|
|
23
|
+
return html `
|
|
24
|
+
<etools-checkbox
|
|
25
|
+
class="checkbox"
|
|
26
|
+
value="${val}"
|
|
27
|
+
?checked="${checked}"
|
|
28
|
+
?disabled="${this.isReadonly}"
|
|
29
|
+
@sl-change="${(e) => this.onToggle(val, e.target.checked, index)}"
|
|
30
|
+
>
|
|
31
|
+
${this.getLabel(option)}
|
|
32
|
+
</etools-checkbox>
|
|
33
33
|
`;
|
|
34
|
-
})}
|
|
35
|
-
</div>
|
|
36
|
-
|
|
37
|
-
<etools-button
|
|
38
|
-
class="neutral clear-button"
|
|
39
|
-
variant="text"
|
|
40
|
-
?hidden="${this.isReadonly}"
|
|
41
|
-
@click="${() => this.valueChanged([], index)}"
|
|
42
|
-
>
|
|
43
|
-
<etools-icon name="clear" slot="prefix"></etools-icon>
|
|
44
|
-
${getTranslation(this.language, 'CLEAR')}
|
|
45
|
-
</etools-button>
|
|
46
|
-
</div>
|
|
34
|
+
})}
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<etools-button
|
|
38
|
+
class="neutral clear-button"
|
|
39
|
+
variant="text"
|
|
40
|
+
?hidden="${this.isReadonly}"
|
|
41
|
+
@click="${() => this.valueChanged([], index)}"
|
|
42
|
+
>
|
|
43
|
+
<etools-icon name="clear" slot="prefix"></etools-icon>
|
|
44
|
+
${getTranslation(this.language, 'CLEAR')}
|
|
45
|
+
</etools-button>
|
|
46
|
+
</div>
|
|
47
47
|
`;
|
|
48
48
|
}
|
|
49
49
|
onToggle(itemValue, checked, index) {
|
|
@@ -70,43 +70,43 @@ let RepeatableChoiceField = class RepeatableChoiceField extends RepeatableBaseFi
|
|
|
70
70
|
static get styles() {
|
|
71
71
|
return [
|
|
72
72
|
...AbstractFieldBaseClass.styles,
|
|
73
|
-
css `
|
|
74
|
-
.container {
|
|
75
|
-
position: relative;
|
|
76
|
-
min-height: 48px;
|
|
77
|
-
display: flex;
|
|
78
|
-
align-items: center;
|
|
79
|
-
flex-direction: row;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.checkbox-group {
|
|
83
|
-
display: flex;
|
|
84
|
-
flex-direction: row;
|
|
85
|
-
flex-wrap: wrap;
|
|
86
|
-
gap: 0.5rem;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
:host([is-readonly]) .checkbox-group {
|
|
90
|
-
pointer-events: none;
|
|
91
|
-
opacity: 0.55;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
@media (max-width: 1080px) {
|
|
95
|
-
.container {
|
|
96
|
-
flex-direction: column;
|
|
97
|
-
align-items: flex-start;
|
|
98
|
-
}
|
|
99
|
-
.checkbox-group {
|
|
100
|
-
flex-direction: column;
|
|
101
|
-
}
|
|
102
|
-
.checkbox {
|
|
103
|
-
padding-left: 3px;
|
|
104
|
-
}
|
|
105
|
-
.clear-button {
|
|
106
|
-
margin: 0;
|
|
107
|
-
padding-left: 0;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
73
|
+
css `
|
|
74
|
+
.container {
|
|
75
|
+
position: relative;
|
|
76
|
+
min-height: 48px;
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
flex-direction: row;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.checkbox-group {
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-direction: row;
|
|
85
|
+
flex-wrap: wrap;
|
|
86
|
+
gap: 0.5rem;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
:host([is-readonly]) .checkbox-group {
|
|
90
|
+
pointer-events: none;
|
|
91
|
+
opacity: 0.55;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@media (max-width: 1080px) {
|
|
95
|
+
.container {
|
|
96
|
+
flex-direction: column;
|
|
97
|
+
align-items: flex-start;
|
|
98
|
+
}
|
|
99
|
+
.checkbox-group {
|
|
100
|
+
flex-direction: column;
|
|
101
|
+
}
|
|
102
|
+
.checkbox {
|
|
103
|
+
padding-left: 3px;
|
|
104
|
+
}
|
|
105
|
+
.clear-button {
|
|
106
|
+
margin: 0;
|
|
107
|
+
padding-left: 0;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
110
|
`
|
|
111
111
|
];
|
|
112
112
|
}
|