niris-public-community-components 0.0.6 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/form-niris.d.ts.map +1 -1
- package/dist/form-niris.js +24 -15
- package/dist/form-niris.js.map +1 -1
- package/dist/form-to-niris.js +15 -6
- package/package.json +1 -1
- package/src/form-niris.ts +39 -28
- package/src/textarea-to-niris.ts +1 -1
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.
|
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
@@ -57,8 +57,8 @@ export class FormNiris extends LitElement {
|
|
57
57
|
private _map!: Map;
|
58
58
|
private _markerIcon!: Icon;
|
59
59
|
|
60
|
-
@property({type: String}) defaultLat
|
61
|
-
@property({type: String}) defaultLon
|
60
|
+
@property({type: String}) defaultLat = '39.5701058'; // Palma de Mallorca
|
61
|
+
@property({type: String}) defaultLon = '2.6487098';
|
62
62
|
|
63
63
|
@property({type: String}) locale: 'es' | 'en' | 'ca' = 'es';
|
64
64
|
|
@@ -66,42 +66,42 @@ export class FormNiris extends LitElement {
|
|
66
66
|
private isCitizen: Boolean = true;
|
67
67
|
|
68
68
|
@state()
|
69
|
-
private activeMap
|
69
|
+
private activeMap = false;
|
70
70
|
|
71
71
|
@state()
|
72
72
|
private ubiDistricts: Object[] = [];
|
73
73
|
|
74
74
|
@state()
|
75
|
-
private submited
|
75
|
+
private submited = false;
|
76
76
|
|
77
77
|
@state()
|
78
|
-
private error
|
78
|
+
private error = false;
|
79
79
|
|
80
80
|
@state()
|
81
|
-
private incidenceId
|
81
|
+
private incidenceId = '';
|
82
82
|
|
83
83
|
@state()
|
84
|
-
private extensionFiles
|
84
|
+
private extensionFiles = '';
|
85
85
|
|
86
86
|
/* Map */
|
87
|
-
@property({type: String}) domain
|
87
|
+
@property({type: String}) domain =
|
88
88
|
'https://iris2-backend-demo-iris-community.labs.apsl.io/services/iris/api-public';
|
89
89
|
// TODO property for lat and lon
|
90
90
|
|
91
91
|
@state()
|
92
|
-
private street
|
92
|
+
private street = '';
|
93
93
|
|
94
94
|
@state()
|
95
|
-
private streetNumber
|
95
|
+
private streetNumber = '';
|
96
96
|
|
97
97
|
@state()
|
98
|
-
private latitude
|
98
|
+
private latitude = '';
|
99
99
|
|
100
100
|
@state()
|
101
|
-
private longitude
|
101
|
+
private longitude = '';
|
102
102
|
|
103
103
|
@state()
|
104
|
-
private loading
|
104
|
+
private loading = false;
|
105
105
|
|
106
106
|
constructor() {
|
107
107
|
super();
|
@@ -116,7 +116,7 @@ export class FormNiris extends LitElement {
|
|
116
116
|
this.characteristics = [];
|
117
117
|
|
118
118
|
this.locale = this.locale ? this.locale : 'es';
|
119
|
-
setLocale(this.locale);
|
119
|
+
// setLocale(this.locale);
|
120
120
|
|
121
121
|
// Map
|
122
122
|
L.Icon.Default.imagePath = `https://unpkg.com/leaflet@${L.version}/dist/images/`;
|
@@ -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="
|
660
|
-
<select id="
|
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>
|
@@ -704,7 +713,7 @@ export class FormNiris extends LitElement {
|
|
704
713
|
<div>
|
705
714
|
<button
|
706
715
|
type="button"
|
707
|
-
.disabled="${!
|
716
|
+
.disabled="${!this.street.length}"
|
708
717
|
@click="${this.searchAddress}"
|
709
718
|
>
|
710
719
|
${msg('Buscar')}
|
@@ -829,19 +838,21 @@ export class FormNiris extends LitElement {
|
|
829
838
|
});
|
830
839
|
|
831
840
|
if ('characteristics' in errors) {
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
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
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
850
|
+
input.setCustomValidity(value as string);
|
851
|
+
input.reportValidity();
|
852
|
+
|
853
|
+
});
|
854
|
+
});
|
855
|
+
|
845
856
|
}
|
846
857
|
}
|
847
858
|
|
package/src/textarea-to-niris.ts
CHANGED