niris-public-community-components 0.0.7 → 0.0.9
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 +75 -59
- package/dev/form-niris.html +1 -1
- package/dist/form-niris.d.ts.map +1 -1
- package/dist/form-niris.js +25 -14
- package/dist/form-niris.js.map +1 -1
- package/dist/form-to-niris.js +14 -5
- package/dist/my-element.d.ts +37 -0
- package/dist/my-element.d.ts.map +1 -0
- package/dist/my-element.js +72 -0
- package/dist/my-element.js.map +1 -0
- package/dist/textarea-to-niris.bundled.js +261 -0
- package/dist/textarea-to-niris.d.ts +22 -0
- package/dist/textarea-to-niris.d.ts.map +1 -0
- package/dist/textarea-to-niris.js +60 -9
- package/dist/textarea-to-niris.js.map +1 -0
- package/package.json +1 -1
- package/src/form-niris.ts +29 -19
- package/src/textarea-to-niris.ts +1 -1
package/src/form-niris.ts
CHANGED
@@ -39,9 +39,6 @@ export const {getLocale, setLocale} = configureLocalization({
|
|
39
39
|
- Validaciones archivos extensiones.
|
40
40
|
*/
|
41
41
|
|
42
|
-
/**
|
43
|
-
* An example element.
|
44
|
-
*/
|
45
42
|
@localized()
|
46
43
|
export class FormNiris extends LitElement {
|
47
44
|
@property({type: Number}) detailID: Number | undefined;
|
@@ -116,7 +113,7 @@ export class FormNiris extends LitElement {
|
|
116
113
|
this.characteristics = [];
|
117
114
|
|
118
115
|
this.locale = this.locale ? this.locale : 'es';
|
119
|
-
// setLocale(this.locale);
|
116
|
+
// setLocale(this.locale); TODO: Fix problem when using setLocale
|
120
117
|
|
121
118
|
// Map
|
122
119
|
L.Icon.Default.imagePath = `https://unpkg.com/leaflet@${L.version}/dist/images/`;
|
@@ -332,7 +329,9 @@ export class FormNiris extends LitElement {
|
|
332
329
|
const stylesCharacteristics = {
|
333
330
|
display: this.characteristics.length == 0 ? 'none' : '',
|
334
331
|
};
|
335
|
-
|
332
|
+
// To fix map problem. When opening with collapse, it does not render correctly
|
333
|
+
setTimeout(() => window.dispatchEvent(new Event('resize')), 100)
|
334
|
+
|
336
335
|
return html`
|
337
336
|
<section class="record">
|
338
337
|
<h2 class="record__comment">${msg('Mensaje')}</h2>
|
@@ -521,12 +520,12 @@ export class FormNiris extends LitElement {
|
|
521
520
|
|
522
521
|
<div>
|
523
522
|
<label for="firstSurname">${msg('Primer apellido')}*:</label>
|
524
|
-
<input id="firstSurname" name="firstSurname" type="text" />
|
523
|
+
<input id="firstSurname" name="firstSurname" type="text" required />
|
525
524
|
</div>
|
526
525
|
|
527
526
|
<div>
|
528
527
|
<label for="secondSurname">${msg('Segundo apellido')}*:</label>
|
529
|
-
<input id="secondSurname" name="secondSurname" type="text"
|
528
|
+
<input id="secondSurname" name="secondSurname" type="text" />
|
530
529
|
</div>
|
531
530
|
|
532
531
|
<div>
|
@@ -609,6 +608,15 @@ export class FormNiris extends LitElement {
|
|
609
608
|
placeholder=${msg('Escribe tu teléfono')}
|
610
609
|
/>
|
611
610
|
</div>
|
611
|
+
|
612
|
+
<div>
|
613
|
+
<label for="language">${msg('Idioma de la respuesta')}*:</label>
|
614
|
+
<select id="language" name="language" required>
|
615
|
+
<option value="es" selected>${msg('Español')}</option>
|
616
|
+
<option value="ca">${msg('Catalán')}</option>
|
617
|
+
<option value="en">${msg('Inglés')}</option>
|
618
|
+
</select>
|
619
|
+
</div>
|
612
620
|
`;
|
613
621
|
}
|
614
622
|
|
@@ -656,8 +664,8 @@ export class FormNiris extends LitElement {
|
|
656
664
|
</div>
|
657
665
|
|
658
666
|
<div>
|
659
|
-
<label for="
|
660
|
-
<select id="
|
667
|
+
<label for="language">${msg('Idioma de la respuesta')}*:</label>
|
668
|
+
<select id="language" name="language" required>
|
661
669
|
<option value="es" selected>${msg('Español')}</option>
|
662
670
|
<option value="ca">${msg('Catalán')}</option>
|
663
671
|
<option value="en">${msg('Inglés')}</option>
|
@@ -829,19 +837,21 @@ export class FormNiris extends LitElement {
|
|
829
837
|
});
|
830
838
|
|
831
839
|
if ('characteristics' in errors) {
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
840
|
+
let characteristics = errors['characteristics'];
|
841
|
+
if (!Array.isArray(characteristics)) {
|
842
|
+
characteristics = Object.entries(characteristics);
|
843
|
+
}
|
844
|
+
characteristics.forEach((characteristic: any) => {
|
845
|
+
Object.entries(characteristic).forEach(([key, value]) => {
|
836
846
|
const input = this.shadowRoot?.getElementById(
|
837
847
|
`niris-${key}`
|
838
848
|
) as HTMLInputElement;
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
849
|
+
input.setCustomValidity(value as string);
|
850
|
+
input.reportValidity();
|
851
|
+
|
852
|
+
});
|
853
|
+
});
|
854
|
+
|
845
855
|
}
|
846
856
|
}
|
847
857
|
|
package/src/textarea-to-niris.ts
CHANGED
@@ -23,7 +23,7 @@ export class TextareaToNiris extends LitElement {
|
|
23
23
|
this.formAction = '';
|
24
24
|
this.keywords = '';
|
25
25
|
this.locale = 'es'
|
26
|
-
//setLocale(this.locale);
|
26
|
+
//setLocale(this.locale); TODO: Fix problem when using setLocale
|
27
27
|
}
|
28
28
|
|
29
29
|
updateShownValue(event: Event) {
|