niris-public-community-components 0.0.5 → 0.0.7
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 +3 -3
- package/dist/form-niris.js.map +1 -1
- package/dist/form-to-niris.js +3 -3
- package/dist/index.js +2 -2
- package/dist/textarea-to-niris.js +9 -60
- package/package.json +1 -1
- package/src/form-niris.ts +16 -16
- package/src/textarea-to-niris.ts +1 -1
package/dist/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export
|
2
|
-
export
|
1
|
+
export * from './form-to-niris.js';
|
2
|
+
export * from './textarea-to-niris.js';
|
@@ -1,50 +1,17 @@
|
|
1
|
-
var
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
-
};
|
7
|
-
import { LitElement, html, css } from 'lit';
|
8
|
-
import { property } from 'lit/decorators.js';
|
9
|
-
import { msg, localized } from '@lit/localize';
|
10
|
-
import { configureLocalization } from '@lit/localize';
|
11
|
-
// Generated via output.localeCodesModule
|
12
|
-
import { sourceLocale, targetLocales } from './generated/locale-codes.js';
|
13
|
-
export const { getLocale, setLocale } = configureLocalization({
|
14
|
-
sourceLocale,
|
15
|
-
targetLocales,
|
16
|
-
loadLocale: (locale) => import(`./generated/locales/${locale}.js`),
|
17
|
-
});
|
18
|
-
let TextareaToNiris = class TextareaToNiris extends LitElement {
|
19
|
-
constructor() {
|
20
|
-
super();
|
21
|
-
this.formAction = '';
|
22
|
-
this.keywords = '';
|
23
|
-
this.locale = 'es';
|
24
|
-
// setLocale(this.locale);
|
25
|
-
}
|
26
|
-
updateShownValue(event) {
|
27
|
-
this.keywords = event.target?.value;
|
28
|
-
}
|
29
|
-
closePopover(event) {
|
30
|
-
event.preventDefault();
|
31
|
-
(this.shadowRoot?.getElementById('popover')).hidePopover();
|
32
|
-
}
|
33
|
-
render() {
|
34
|
-
return html `
|
1
|
+
import{c as r,i as o,n as e,l as t,s as i,t as a,a as n,x as s,m as d}from"./locale-codes-c2f86156.js";var l=function(r,o,e,t){for(var i,a=arguments.length,n=a<3?o:null===t?t=Object.getOwnPropertyDescriptor(o,e):t,s=r.length-1;s>=0;s--)(i=r[s])&&(n=(a<3?i(n):a>3?i(o,e,n):i(o,e))||n);return a>3&&n&&Object.defineProperty(o,e,n),n};const{getLocale:c,setLocale:p}=r({sourceLocale:i,targetLocales:a,loadLocale:r=>import(`./generated/locales/${r}.js`)});let f=class extends n{constructor(){super(),this.formAction="",this.keywords="",this.locale="es"}updateShownValue(r){this.keywords=r.target?.value}closePopover(r){r.preventDefault(),(this.shadowRoot?.getElementById("popover")).hidePopover()}render(){return s`
|
35
2
|
<div id="popover-container">
|
36
3
|
<button id="button-popover" popovertarget="popover">
|
37
|
-
${
|
4
|
+
${d("Atención en línea")}
|
38
5
|
</button>
|
39
6
|
|
40
7
|
<div popover id="popover">
|
41
8
|
<header>
|
42
|
-
<h2>${
|
9
|
+
<h2>${d("Atención en línea Niris")}</h2>
|
43
10
|
</header>
|
44
11
|
<main>
|
45
12
|
<form action="${this.formAction}&keywords=${this.keywords}" method="get">
|
46
13
|
<label for="niris-input">
|
47
|
-
${
|
14
|
+
${d("Información, Consultas, Quejas y Sugerencias:")}
|
48
15
|
</label>
|
49
16
|
<textarea
|
50
17
|
id="niris-input"
|
@@ -52,20 +19,17 @@ let TextareaToNiris = class TextareaToNiris extends LitElement {
|
|
52
19
|
name="keywords"
|
53
20
|
required
|
54
21
|
minlength="4"
|
55
|
-
placeholder="${
|
22
|
+
placeholder="${d("Escribe tu consulta aquí")}"
|
56
23
|
></textarea>
|
57
|
-
<button type="submit">${
|
24
|
+
<button type="submit">${d("Enviar")}</button>
|
58
25
|
<button type="button" @click="${this.closePopover}">
|
59
|
-
${
|
26
|
+
${d("Cerrar")}
|
60
27
|
</button>
|
61
28
|
</form>
|
62
29
|
</main>
|
63
30
|
</div>
|
64
31
|
</div>
|
65
|
-
|
66
|
-
}
|
67
|
-
};
|
68
|
-
TextareaToNiris.styles = css `
|
32
|
+
`}};f.styles=o`
|
69
33
|
:host {
|
70
34
|
--primary-color: #03599d;
|
71
35
|
--background-color: #d4d4d4;
|
@@ -222,19 +186,4 @@ TextareaToNiris.styles = css `
|
|
222
186
|
width: 60%;
|
223
187
|
}
|
224
188
|
}
|
225
|
-
|
226
|
-
__decorate([
|
227
|
-
property({ type: String })
|
228
|
-
], TextareaToNiris.prototype, "formAction", void 0);
|
229
|
-
__decorate([
|
230
|
-
property({ type: String })
|
231
|
-
], TextareaToNiris.prototype, "keywords", void 0);
|
232
|
-
__decorate([
|
233
|
-
property({ type: String })
|
234
|
-
], TextareaToNiris.prototype, "locale", void 0);
|
235
|
-
TextareaToNiris = __decorate([
|
236
|
-
localized()
|
237
|
-
], TextareaToNiris);
|
238
|
-
export { TextareaToNiris };
|
239
|
-
customElements.define('textarea-to-niris', TextareaToNiris);
|
240
|
-
//# sourceMappingURL=textarea-to-niris.js.map
|
189
|
+
`,l([e({type:String})],f.prototype,"formAction",void 0),l([e({type:String})],f.prototype,"keywords",void 0),l([e({type:String})],f.prototype,"locale",void 0),f=l([t()],f),customElements.define("textarea-to-niris",f);export{f as TextareaToNiris,c as getLocale,p as setLocale};
|
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.7",
|
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/`;
|
@@ -704,7 +704,7 @@ export class FormNiris extends LitElement {
|
|
704
704
|
<div>
|
705
705
|
<button
|
706
706
|
type="button"
|
707
|
-
.disabled="${!
|
707
|
+
.disabled="${!this.street.length}"
|
708
708
|
@click="${this.searchAddress}"
|
709
709
|
>
|
710
710
|
${msg('Buscar')}
|
@@ -830,7 +830,7 @@ export class FormNiris extends LitElement {
|
|
830
830
|
|
831
831
|
if ('characteristics' in errors) {
|
832
832
|
const characteristics = errors['characteristics'];
|
833
|
-
for (
|
833
|
+
for (const [key, errors] of characteristics.entries()) {
|
834
834
|
if (Object.keys(errors).length !== 0) {
|
835
835
|
debugger;
|
836
836
|
const input = this.shadowRoot?.getElementById(
|
package/src/textarea-to-niris.ts
CHANGED