@progressive-development/pd-forms 0.0.50 → 0.0.53
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/package.json +4 -2
- package/src/PdFormContainer.js +13 -7
- package/src/generated/locale/be.js +19 -0
- package/src/generated/locale/en.js +19 -0
- package/src/generated/locale-codes.js +25 -0
- package/src/localization.js +9 -0
- package/xliff/be.xlf +37 -0
- package/xliff/en.xlf +31 -0
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Webcomponent pd-forms following open-wc recommendations",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"author": "PD Progressive Development",
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.53",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"module": "index.js",
|
|
9
9
|
"scripts": {
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
"test": "web-test-runner --coverage",
|
|
15
15
|
"test:watch": "web-test-runner --watch",
|
|
16
16
|
"storybook": "npm run analyze -- --exclude dist && web-dev-server -c .storybook/server.mjs",
|
|
17
|
-
"storybook:build": "npm run analyze -- --exclude dist && build-storybook"
|
|
17
|
+
"storybook:build": "npm run analyze -- --exclude dist && build-storybook",
|
|
18
|
+
"localizeExtract": "lit-localize extract",
|
|
19
|
+
"localizeBuild": "lit-localize build"
|
|
18
20
|
},
|
|
19
21
|
"dependencies": {
|
|
20
22
|
"@lit-labs/motion": "^1.0.2",
|
package/src/PdFormContainer.js
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { LitElement, html, css } from 'lit';
|
|
7
|
-
import {
|
|
7
|
+
import {msg, updateWhenLocaleChanges} from '@lit/localize';
|
|
8
|
+
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* An example element.
|
|
@@ -40,6 +41,11 @@ export class PdFormContainer extends LitElement {
|
|
|
40
41
|
};
|
|
41
42
|
}
|
|
42
43
|
|
|
44
|
+
constructor() {
|
|
45
|
+
super();
|
|
46
|
+
updateWhenLocaleChanges(this);
|
|
47
|
+
}
|
|
48
|
+
|
|
43
49
|
firstUpdated() {
|
|
44
50
|
// add validation event listener
|
|
45
51
|
this.addEventListener('validate-form', this._validateForm);
|
|
@@ -51,7 +57,7 @@ export class PdFormContainer extends LitElement {
|
|
|
51
57
|
<slot></slot>
|
|
52
58
|
${this.requiredFieldInfo ? html`
|
|
53
59
|
<p class="hinweis">
|
|
54
|
-
${msg('*
|
|
60
|
+
${msg('* Pflichtfeld',{desc: '#pd.form.required.info#'})}
|
|
55
61
|
</p>` : ''}
|
|
56
62
|
<br />
|
|
57
63
|
</form>
|
|
@@ -68,7 +74,7 @@ export class PdFormContainer extends LitElement {
|
|
|
68
74
|
const tmpEl = el;
|
|
69
75
|
if (!el.value || el.value === "") {
|
|
70
76
|
tmpEl.errorMsg = el.requiredMsg ||
|
|
71
|
-
msg('
|
|
77
|
+
msg('Eingabe erforderlich',{desc: '#pd.form.field.required#'});
|
|
72
78
|
e.detail.errorMap.set(el.id, tmpEl.errorMsg);
|
|
73
79
|
} else {
|
|
74
80
|
tmpEl.errorMsg = "";
|
|
@@ -102,13 +108,13 @@ export class PdFormContainer extends LitElement {
|
|
|
102
108
|
|
|
103
109
|
// validate mail and phone inputs
|
|
104
110
|
validateByType("mail", PdFormContainer._mailIsValid,
|
|
105
|
-
msg('mail@
|
|
111
|
+
msg('Format mail@test.de verwenden',{desc: '#pd.form.field.invalid.mail#'}));
|
|
106
112
|
validateByType("phone", PdFormContainer._phoneIsValid,
|
|
107
|
-
msg("+
|
|
113
|
+
msg("Format +49123 123456 verwenden",{desc: '#pd.form.field.invalid.phone#'}));
|
|
108
114
|
validateByType("vat", PdFormContainer._vatIsValid,
|
|
109
|
-
msg("
|
|
115
|
+
msg("Format DE0123456789 verwenden",{desc: '#pd.form.field.invalid.vat#'}));
|
|
110
116
|
validateByType("number", (val) => !Number.isNaN(val),
|
|
111
|
-
msg("
|
|
117
|
+
msg("Nur Zahlen erlaubt",{desc: '#pd.form.field.invalid.number#'}));
|
|
112
118
|
|
|
113
119
|
if (e.detail.singleElement) {
|
|
114
120
|
e.stopPropagation();
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
// Do not modify this file by hand!
|
|
3
|
+
// Re-generate this file by running lit-localize
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
/* eslint-disable no-irregular-whitespace */
|
|
9
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
10
|
+
|
|
11
|
+
export const templates = {
|
|
12
|
+
's369cb9ac30f626a2': `* Verplichte in te vullen`,
|
|
13
|
+
's441bc7f34cdb5af3': `Vul dit veld in`,
|
|
14
|
+
's570d46ddb2a278ce': `Ongeldig VAT, gebruik BE0123456789`,
|
|
15
|
+
's5b7e33463603827f': `Ongeldig telefoonnummer, gebruik +32 494 667085`,
|
|
16
|
+
's82000595de0f83d0': `Ongeldig e-mailadres, gebruik mail@test.be`,
|
|
17
|
+
's8716290d3f8456dd': `Alleen nummers toegestaan`,
|
|
18
|
+
};
|
|
19
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
// Do not modify this file by hand!
|
|
3
|
+
// Re-generate this file by running lit-localize
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
/* eslint-disable no-irregular-whitespace */
|
|
9
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
10
|
+
|
|
11
|
+
export const templates = {
|
|
12
|
+
's369cb9ac30f626a2': `* Pflichtfeld`,
|
|
13
|
+
's441bc7f34cdb5af3': `Eingabe erforderlich`,
|
|
14
|
+
's82000595de0f83d0': `Format mail@test.de verwenden`,
|
|
15
|
+
's5b7e33463603827f': `Format +49123 123456 verwenden`,
|
|
16
|
+
's570d46ddb2a278ce': `Format DE0123456789 verwenden`,
|
|
17
|
+
's8716290d3f8456dd': `Nur Zahlen erlaubt`,
|
|
18
|
+
};
|
|
19
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Do not modify this file by hand!
|
|
2
|
+
// Re-generate this file by running lit-localize.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The locale code that templates in this source code are written in.
|
|
6
|
+
*/
|
|
7
|
+
export const sourceLocale = `de`;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The other locale codes that this application is localized into. Sorted
|
|
11
|
+
* lexicographically.
|
|
12
|
+
*/
|
|
13
|
+
export const targetLocales = [
|
|
14
|
+
`be`,
|
|
15
|
+
`en`,
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* All valid project locale codes. Sorted lexicographically.
|
|
20
|
+
*/
|
|
21
|
+
export const allLocales = [
|
|
22
|
+
`be`,
|
|
23
|
+
`de`,
|
|
24
|
+
`en`,
|
|
25
|
+
];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {configureLocalization} from '@lit/localize';
|
|
2
|
+
// Generated via output.localeCodesModule
|
|
3
|
+
import {sourceLocale, targetLocales} from './generated/locale-codes.js';
|
|
4
|
+
|
|
5
|
+
export const {getLocale, setLocale} = configureLocalization({
|
|
6
|
+
sourceLocale,
|
|
7
|
+
targetLocales,
|
|
8
|
+
loadLocale: (locale) => import(`/locales/${locale}.js`),
|
|
9
|
+
});
|
package/xliff/be.xlf
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
|
|
3
|
+
<file target-language="be" source-language="de" original="lit-localize-inputs" datatype="plaintext">
|
|
4
|
+
<body>
|
|
5
|
+
<trans-unit id="s82000595de0f83d0">
|
|
6
|
+
<source>Format mail@test.de verwenden</source>
|
|
7
|
+
<target>Ongeldig e-mailadres, gebruik mail@test.be</target>
|
|
8
|
+
<note>#pd.form.field.invalid.mail#</note>
|
|
9
|
+
</trans-unit>
|
|
10
|
+
<trans-unit id="s8716290d3f8456dd">
|
|
11
|
+
<source>Nur Zahlen erlaubt</source>
|
|
12
|
+
<target>Alleen nummers toegestaan</target>
|
|
13
|
+
<note>#pd.form.field.invalid.number#</note>
|
|
14
|
+
</trans-unit>
|
|
15
|
+
<trans-unit id="s5b7e33463603827f">
|
|
16
|
+
<source>Format +49123 123456 verwenden</source>
|
|
17
|
+
<target>Ongeldig telefoonnummer, gebruik +32 494 667085</target>
|
|
18
|
+
<note>#pd.form.field.invalid.phone#</note>
|
|
19
|
+
</trans-unit>
|
|
20
|
+
<trans-unit id="s570d46ddb2a278ce">
|
|
21
|
+
<source>Format DE0123456789 verwenden</source>
|
|
22
|
+
<target>Ongeldig VAT, gebruik BE0123456789</target>
|
|
23
|
+
<note>#pd.form.field.invalid.vat#</note>
|
|
24
|
+
</trans-unit>
|
|
25
|
+
<trans-unit id="s441bc7f34cdb5af3">
|
|
26
|
+
<source>Eingabe erforderlich</source>
|
|
27
|
+
<target>Vul dit veld in</target>
|
|
28
|
+
<note>#pd.form.field.required#</note>
|
|
29
|
+
</trans-unit>
|
|
30
|
+
<trans-unit id="s369cb9ac30f626a2">
|
|
31
|
+
<source>* Pflichtfeld</source>
|
|
32
|
+
<target>* Verplichte in te vullen</target>
|
|
33
|
+
<note>#pd.form.required.info#</note>
|
|
34
|
+
</trans-unit>
|
|
35
|
+
</body>
|
|
36
|
+
</file>
|
|
37
|
+
</xliff>
|
package/xliff/en.xlf
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
|
|
3
|
+
<file target-language="en" source-language="de" original="lit-localize-inputs" datatype="plaintext">
|
|
4
|
+
<body>
|
|
5
|
+
<trans-unit id="s82000595de0f83d0">
|
|
6
|
+
<source>Format mail@test.de verwenden</source>
|
|
7
|
+
<note>#pd.form.field.invalid.mail#</note>
|
|
8
|
+
</trans-unit>
|
|
9
|
+
<trans-unit id="s8716290d3f8456dd">
|
|
10
|
+
<source>Nur Zahlen erlaubt</source>
|
|
11
|
+
<note>#pd.form.field.invalid.number#</note>
|
|
12
|
+
</trans-unit>
|
|
13
|
+
<trans-unit id="s5b7e33463603827f">
|
|
14
|
+
<source>Format +49123 123456 verwenden</source>
|
|
15
|
+
<note>#pd.form.field.invalid.phone#</note>
|
|
16
|
+
</trans-unit>
|
|
17
|
+
<trans-unit id="s570d46ddb2a278ce">
|
|
18
|
+
<source>Format DE0123456789 verwenden</source>
|
|
19
|
+
<note>#pd.form.field.invalid.vat#</note>
|
|
20
|
+
</trans-unit>
|
|
21
|
+
<trans-unit id="s441bc7f34cdb5af3">
|
|
22
|
+
<source>Eingabe erforderlich</source>
|
|
23
|
+
<note>#pd.form.field.required#</note>
|
|
24
|
+
</trans-unit>
|
|
25
|
+
<trans-unit id="s369cb9ac30f626a2">
|
|
26
|
+
<source>* Pflichtfeld</source>
|
|
27
|
+
<note>#pd.form.required.info#</note>
|
|
28
|
+
</trans-unit>
|
|
29
|
+
</body>
|
|
30
|
+
</file>
|
|
31
|
+
</xliff>
|