niris-public-community-components 0.0.1 → 0.0.3
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 +59 -8
- package/dev/form-niris.html +29 -0
- package/dev/text-area-niris.html +8 -5
- package/dist/form-niris.d.ts +70 -0
- package/dist/form-niris.d.ts.map +1 -0
- package/dist/form-niris.js +1127 -0
- package/dist/form-niris.js.map +1 -0
- package/dist/form-to-niris.js +847 -0
- package/dist/generated/locale-codes.d.ts +14 -0
- package/dist/generated/locale-codes.d.ts.map +1 -0
- package/dist/generated/locale-codes.js +23 -0
- package/dist/generated/locale-codes.js.map +1 -0
- package/dist/generated/locales/ca.d.ts +61 -0
- package/dist/generated/locales/ca.d.ts.map +1 -0
- package/dist/generated/locales/ca.js +65 -0
- package/dist/generated/locales/ca.js.map +1 -0
- package/dist/generated/locales/en.d.ts +61 -0
- package/dist/generated/locales/en.d.ts.map +1 -0
- package/dist/generated/locales/en.js +65 -0
- package/dist/generated/locales/en.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/locale-codes-c2f86156.js +72 -0
- package/dist/map-niris.d.ts +25 -0
- package/dist/map-niris.d.ts.map +1 -0
- package/dist/map-niris.js +200 -0
- package/dist/map-niris.js.map +1 -0
- package/dist/styles/globalStyles.d.ts +2 -0
- package/dist/styles/globalStyles.d.ts.map +1 -0
- package/dist/styles/globalStyles.js +170 -0
- package/dist/styles/globalStyles.js.map +1 -0
- package/dist/test/my-element_test.d.ts +7 -0
- package/dist/test/my-element_test.d.ts.map +1 -0
- package/dist/test/my-element_test.js +47 -0
- package/dist/test/my-element_test.js.map +1 -0
- package/dist/types.d.ts +85 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/index.html +5 -3
- package/package.json +27 -5
- package/rollup.config.js +6 -2
- package/src/form-niris.ts +1203 -0
- package/src/generated/locale-codes.ts +25 -0
- package/src/generated/locales/ca.ts +71 -0
- package/src/generated/locales/en.ts +71 -0
- package/src/lit-localize.json +15 -0
- package/src/map-niris.ts +215 -0
- package/src/styles/globalStyles.ts +170 -0
- package/src/textarea-to-niris.ts +33 -12
- package/src/types.ts +90 -0
- package/src/xliff/ca.xlf +239 -0
- package/src/xliff/en.xlf +239 -0
- package/tsconfig.json +1 -1
- package/my-element.js +0 -79
package/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
<!-- [](https://badge.fury.io/js/angular2-expandable-list)
|
2
2
|
-->
|
3
|
+
|
3
4
|
[](https://github.com/prettier/prettier)
|
4
5
|
|
5
6
|
# Niris web components
|
@@ -28,8 +29,6 @@ This library contains two web components:
|
|
28
29
|
- [Authors](#authors)
|
29
30
|
- [License](#license)
|
30
31
|
|
31
|
-
## How to use
|
32
|
-
|
33
32
|
### Installation
|
34
33
|
|
35
34
|
- Install with **npm**
|
@@ -38,6 +37,64 @@ This library contains two web components:
|
|
38
37
|
$ npm install public-community-components
|
39
38
|
```
|
40
39
|
|
40
|
+
https://lit.dev/docs/v1/tools/use/
|
41
|
+
module node em6 (?)
|
42
|
+
|
43
|
+
```js
|
44
|
+
<script type="module">
|
45
|
+
import { TextareaToNiris } from 'niris-public-community-components';
|
46
|
+
</script>
|
47
|
+
|
48
|
+
<template>
|
49
|
+
<textarea-to-niris></textarea-to-niris>
|
50
|
+
</template>
|
51
|
+
```
|
52
|
+
|
53
|
+
js vainiilla
|
54
|
+
|
55
|
+
```html
|
56
|
+
<!DOCTYPE html>
|
57
|
+
<html lang="en">
|
58
|
+
<head>
|
59
|
+
...
|
60
|
+
<script src="../node_modules/niris-public-community-components/dist/textarea-to-niris.js"></script>
|
61
|
+
</head>
|
62
|
+
|
63
|
+
<body>
|
64
|
+
<textarea-to-niris />
|
65
|
+
</body>
|
66
|
+
</html>
|
67
|
+
```
|
68
|
+
|
69
|
+
Vue
|
70
|
+
npm install niris-public-community-components
|
71
|
+
|
72
|
+
vite.config.js:
|
73
|
+
|
74
|
+
```js
|
75
|
+
<script setup>
|
76
|
+
import {TextareaToNiris} from "niris-public-community-components/";
|
77
|
+
</script>
|
78
|
+
```
|
79
|
+
|
80
|
+
```js
|
81
|
+
import {defineConfig} from 'vite';
|
82
|
+
import vue from '@vitejs/plugin-vue';
|
83
|
+
|
84
|
+
// https://vite.dev/config/
|
85
|
+
export default defineConfig({
|
86
|
+
plugins: [
|
87
|
+
vue({
|
88
|
+
template: {
|
89
|
+
compilerOptions: {
|
90
|
+
isCustomElement: (tag) => ['textarea-to-niris'].includes(tag),
|
91
|
+
},
|
92
|
+
},
|
93
|
+
}),
|
94
|
+
],
|
95
|
+
});
|
96
|
+
```
|
97
|
+
|
41
98
|
### CDN
|
42
99
|
|
43
100
|
npm CDNs like unpkg.com can directly serve files that have been published to npm. This works great for standard JavaScript modules that the browser can load natively.
|
@@ -50,12 +107,6 @@ For this element to work from unpkg.com specifically, you need to include the ?m
|
|
50
107
|
<script type="module" src="https://unpkg.com/my-element?module"></script>
|
51
108
|
```
|
52
109
|
|
53
|
-
#### Javascript
|
54
|
-
|
55
|
-
```
|
56
|
-
import {MyElement} from 'https://unpkg.com/my-element?module';
|
57
|
-
```
|
58
|
-
|
59
110
|
### Initialization
|
60
111
|
|
61
112
|
- HTML way
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="utf-8" />
|
6
|
+
<title><form-niris > Demo</title>
|
7
|
+
<script src="../node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
|
8
|
+
<script src="../node_modules/lit/polyfill-support.js"></script>
|
9
|
+
<script type="module" src="../dist/form-niris.js"></script>
|
10
|
+
<script type="module" src="../dist/generated/locales/en.js"></script>
|
11
|
+
<script type="module" src="../dist/generated/locales/ca.js"></script>
|
12
|
+
<style>
|
13
|
+
/* example override variables */
|
14
|
+
form-niris {
|
15
|
+
--primary-color: #0aa99d;
|
16
|
+
--border-radius: 0rem;
|
17
|
+
}
|
18
|
+
</style>
|
19
|
+
</head>
|
20
|
+
<body>
|
21
|
+
<form-niris
|
22
|
+
detailId="10"
|
23
|
+
default_locale="en"
|
24
|
+
defaultLat="39.8409929"
|
25
|
+
defaultLon="3.1173402"
|
26
|
+
apiUrl="https://iris2-backend-demos-iris-community.labs.apsl.io/services/iris/api-public"
|
27
|
+
/>
|
28
|
+
</body>
|
29
|
+
</html>
|
package/dev/text-area-niris.html
CHANGED
@@ -6,8 +6,11 @@
|
|
6
6
|
<title><textarea-to-iris > Demo</title>
|
7
7
|
<script src="../node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
|
8
8
|
<script src="../node_modules/lit/polyfill-support.js"></script>
|
9
|
-
<script type="module" src="../textarea-to-niris.js"></script>
|
9
|
+
<script type="module" src="../dist/textarea-to-niris.js"></script>
|
10
|
+
<script type="module" src="../dist/generated/locales/en.js"></script>
|
11
|
+
<script type="module" src="../dist/generated/locales/ca.js"></script>
|
10
12
|
<style>
|
13
|
+
|
11
14
|
article {
|
12
15
|
display: flex;
|
13
16
|
flex-direction: column;
|
@@ -16,15 +19,15 @@
|
|
16
19
|
}
|
17
20
|
/* example override variables */
|
18
21
|
textarea-to-niris {
|
19
|
-
--primary-color: #
|
20
|
-
--border-radius:
|
22
|
+
--primary-color: #0aa99d;
|
23
|
+
--border-radius: 0.3rem;
|
21
24
|
}
|
22
25
|
</style>
|
23
26
|
</head>
|
24
27
|
<body>
|
25
28
|
<article>
|
26
|
-
<h1><textarea-to-
|
27
|
-
<textarea-to-niris formaction="
|
29
|
+
<h1><textarea-to-niris></h1>
|
30
|
+
<textarea-to-niris locale="en" formaction="https://iris-public-community-iris-community.labs.apsl.io/buscador-tematicas?from_request=true&keywords" />
|
28
31
|
</article>
|
29
32
|
</body>
|
30
33
|
</html>
|
@@ -0,0 +1,70 @@
|
|
1
|
+
import { LitElement } from 'lit';
|
2
|
+
import { LeafletMouseEvent } from 'leaflet';
|
3
|
+
import { Characteristic } from './types';
|
4
|
+
export declare const getLocale: (() => string) & {
|
5
|
+
_LIT_LOCALIZE_GET_LOCALE_?: undefined;
|
6
|
+
}, setLocale: ((newLocale: string) => Promise<void>) & {
|
7
|
+
_LIT_LOCALIZE_SET_LOCALE_?: undefined;
|
8
|
+
};
|
9
|
+
/**
|
10
|
+
* An example element.
|
11
|
+
*/
|
12
|
+
export declare class FormNiris extends LitElement {
|
13
|
+
detailID: Number | undefined;
|
14
|
+
actionUrl: string;
|
15
|
+
apiUrl: string;
|
16
|
+
area: string;
|
17
|
+
element: string;
|
18
|
+
detail: string;
|
19
|
+
characteristics: Characteristic[];
|
20
|
+
private _marker;
|
21
|
+
private _map;
|
22
|
+
private _markerIcon;
|
23
|
+
defaultLat: string;
|
24
|
+
defaultLon: string;
|
25
|
+
locale: 'es' | 'en' | 'ca';
|
26
|
+
private isCitizen;
|
27
|
+
private activeMap;
|
28
|
+
private ubiDistricts;
|
29
|
+
private submited;
|
30
|
+
private error;
|
31
|
+
private incidenceId;
|
32
|
+
private extensionFiles;
|
33
|
+
domain: string;
|
34
|
+
private street;
|
35
|
+
private streetNumber;
|
36
|
+
private latitude;
|
37
|
+
private longitude;
|
38
|
+
private loading;
|
39
|
+
constructor();
|
40
|
+
getApiUrl(): string;
|
41
|
+
_loadMap(): void;
|
42
|
+
firstUpdated(): void;
|
43
|
+
addOnChangEventToInputs(): void;
|
44
|
+
connectedCallback(): void;
|
45
|
+
private _fetchDistricts;
|
46
|
+
private _fetchFields;
|
47
|
+
updated(): void;
|
48
|
+
private changeTab;
|
49
|
+
render(): import("lit-html").TemplateResult<1>;
|
50
|
+
renderError(): import("lit-html").TemplateResult<1>;
|
51
|
+
renderSuccess(): import("lit-html").TemplateResult<1>;
|
52
|
+
renderHeader(): import("lit-html").TemplateResult<1>;
|
53
|
+
renderForm(): import("lit-html").TemplateResult<1>;
|
54
|
+
renderCitizenForm(): import("lit-html").TemplateResult<1>;
|
55
|
+
renderCompanyForm(): import("lit-html").TemplateResult<1>;
|
56
|
+
renderMap(): import("lit-html").TemplateResult<1>;
|
57
|
+
onSubmit(event: SubmitEvent): Promise<void>;
|
58
|
+
handlerError(data: any): void;
|
59
|
+
confirmEmail(event: FocusEvent): void;
|
60
|
+
years(): number[];
|
61
|
+
onMapClick(e: LeafletMouseEvent): Promise<void>;
|
62
|
+
searchAddress(): Promise<void>;
|
63
|
+
static styles: import("lit").CSSResult[];
|
64
|
+
}
|
65
|
+
declare global {
|
66
|
+
interface HTMLElementTagNameMap {
|
67
|
+
'form-niris': FormNiris;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
//# sourceMappingURL=form-niris.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"form-niris.d.ts","sourceRoot":"","sources":["../src/form-niris.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAqB,MAAM,KAAK,CAAC;AAQnD,OAAO,EAAO,iBAAiB,EAAc,MAAM,SAAS,CAAC;AAE7D,OAAO,EACL,cAAc,EAKf,MAAM,SAAS,CAAC;AAajB,eAAO,MAAO,SAAS;;GAAE,SAAS;;CAIhC,CAAC;AAQH;;GAEG;AACH,qBACa,SAAU,SAAQ,UAAU;IACb,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IAEf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,cAAc,EAAE,CAAC;IAE3D,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,IAAI,CAAO;IACnB,OAAO,CAAC,WAAW,CAAQ;IAED,UAAU,EAAE,MAAM,CAAgB;IAClC,UAAU,EAAE,MAAM,CAAe;IAEjC,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAQ;IAG5D,OAAO,CAAC,SAAS,CAAiB;IAGlC,OAAO,CAAC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