niris-public-community-components 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "niris-public-community-components",
3
3
  "private": false,
4
- "version": "0.0.7",
4
+ "version": "0.0.8",
5
5
  "homepage": "https://iris.apsl.net",
6
6
  "description": "Web components for the NIRIS project developed with the Lit library",
7
7
  "main": "dist/index.js",
package/src/form-niris.ts CHANGED
@@ -521,7 +521,7 @@ export class FormNiris extends LitElement {
521
521
 
522
522
  <div>
523
523
  <label for="firstSurname">${msg('Primer apellido')}*:</label>
524
- <input id="firstSurname" name="firstSurname" type="text" />
524
+ <input id="firstSurname" name="firstSurname" type="text" required />
525
525
  </div>
526
526
 
527
527
  <div>
@@ -609,6 +609,15 @@ export class FormNiris extends LitElement {
609
609
  placeholder=${msg('Escribe tu teléfono')}
610
610
  />
611
611
  </div>
612
+
613
+ <div>
614
+ <label for="language">${msg('Idioma de la respuesta')}*:</label>
615
+ <select id="language" name="language" required>
616
+ <option value="es" selected>${msg('Español')}</option>
617
+ <option value="ca">${msg('Catalán')}</option>
618
+ <option value="en">${msg('Inglés')}</option>
619
+ </select>
620
+ </div>
612
621
  `;
613
622
  }
614
623
 
@@ -656,8 +665,8 @@ export class FormNiris extends LitElement {
656
665
  </div>
657
666
 
658
667
  <div>
659
- <label for="phone">${msg('Idioma de la respuesta')}*:</label>
660
- <select id="phone" name="language" required>
668
+ <label for="language">${msg('Idioma de la respuesta')}*:</label>
669
+ <select id="language" name="language" required>
661
670
  <option value="es" selected>${msg('Español')}</option>
662
671
  <option value="ca">${msg('Catalán')}</option>
663
672
  <option value="en">${msg('Inglés')}</option>
@@ -829,19 +838,21 @@ export class FormNiris extends LitElement {
829
838
  });
830
839
 
831
840
  if ('characteristics' in errors) {
832
- const characteristics = errors['characteristics'];
833
- for (const [key, errors] of characteristics.entries()) {
834
- if (Object.keys(errors).length !== 0) {
835
- debugger;
841
+ let characteristics = errors['characteristics'];
842
+ if (!Array.isArray(characteristics)) {
843
+ characteristics = Object.entries(characteristics);
844
+ }
845
+ characteristics.forEach((characteristic: any) => {
846
+ Object.entries(characteristic).forEach(([key, value]) => {
836
847
  const input = this.shadowRoot?.getElementById(
837
848
  `niris-${key}`
838
849
  ) as HTMLInputElement;
839
- errors.value.forEach((error: string) => {
840
- input.setCustomValidity(error);
841
- input.reportValidity();
842
- });
843
- }
844
- }
850
+ input.setCustomValidity(value as string);
851
+ input.reportValidity();
852
+
853
+ });
854
+ });
855
+
845
856
  }
846
857
  }
847
858