@progressive-development/pd-forms 0.0.49 → 0.0.51
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/lit-localize.json +18 -0
- package/package.json +13 -9
- package/src/PdFormContainer.js +15 -9
- 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/xliff/be.xlf +37 -0
- package/xliff/en.xlf +31 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/lit/lit/main/packages/localize-tools/config.schema.json",
|
|
3
|
+
"sourceLocale": "de",
|
|
4
|
+
"targetLocales": ["en", "be"],
|
|
5
|
+
"inputFiles": [
|
|
6
|
+
"src/**/*.js"
|
|
7
|
+
],
|
|
8
|
+
"output": {
|
|
9
|
+
"mode": "runtime",
|
|
10
|
+
"localeCodesModule": "src/generated/locale-codes.js",
|
|
11
|
+
"outputDir": "src/generated/locale"
|
|
12
|
+
|
|
13
|
+
},
|
|
14
|
+
"interchange": {
|
|
15
|
+
"format": "xliff",
|
|
16
|
+
"xliffDir": "./xliff/"
|
|
17
|
+
}
|
|
18
|
+
}
|
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.51",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"module": "index.js",
|
|
9
9
|
"scripts": {
|
|
@@ -14,25 +14,29 @@
|
|
|
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
|
-
"@lit-labs/motion": "^1.0.
|
|
22
|
+
"@lit-labs/motion": "^1.0.2",
|
|
23
|
+
"@lit/localize": "^0.11.2",
|
|
21
24
|
"@progressive-development/pd-icon": "^0.0.9",
|
|
22
|
-
"lit": "^2.0
|
|
25
|
+
"lit": "^2.2.0"
|
|
23
26
|
},
|
|
24
27
|
"devDependencies": {
|
|
25
28
|
"@custom-elements-manifest/analyzer": "^0.4.17",
|
|
29
|
+
"@lit/localize-tools": "^0.6.1",
|
|
26
30
|
"@open-wc/eslint-config": "^4.3.0",
|
|
27
|
-
"@open-wc/testing": "^3.0.
|
|
28
|
-
"@web/dev-server": "^0.1.
|
|
31
|
+
"@open-wc/testing": "^3.0.4",
|
|
32
|
+
"@web/dev-server": "^0.1.29",
|
|
29
33
|
"@web/dev-server-storybook": "next",
|
|
30
|
-
"@web/test-runner": "^0.13.
|
|
34
|
+
"@web/test-runner": "^0.13.27",
|
|
31
35
|
"eslint": "^7.32.0",
|
|
32
|
-
"eslint-config-prettier": "^8.
|
|
36
|
+
"eslint-config-prettier": "^8.4.0",
|
|
33
37
|
"husky": "^4.3.8",
|
|
34
38
|
"lint-staged": "^10.5.4",
|
|
35
|
-
"prettier": "^2.
|
|
39
|
+
"prettier": "^2.5.1"
|
|
36
40
|
},
|
|
37
41
|
"customElements": "custom-elements.json",
|
|
38
42
|
"eslintConfig": {
|
package/src/PdFormContainer.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {LitElement, html, css} from 'lit';
|
|
6
|
+
import { LitElement, html, css } from 'lit';
|
|
7
|
+
import { msg } from '@lit/localize';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* An example element.
|
|
@@ -50,7 +51,7 @@ export class PdFormContainer extends LitElement {
|
|
|
50
51
|
<slot></slot>
|
|
51
52
|
${this.requiredFieldInfo ? html`
|
|
52
53
|
<p class="hinweis">
|
|
53
|
-
*
|
|
54
|
+
${msg('* Pflichtfeld',{desc: '#pd.form.required.info#'})}
|
|
54
55
|
</p>` : ''}
|
|
55
56
|
<br />
|
|
56
57
|
</form>
|
|
@@ -66,7 +67,8 @@ export class PdFormContainer extends LitElement {
|
|
|
66
67
|
reqEl.forEach(el => {
|
|
67
68
|
const tmpEl = el;
|
|
68
69
|
if (!el.value || el.value === "") {
|
|
69
|
-
tmpEl.errorMsg = el.requiredMsg ||
|
|
70
|
+
tmpEl.errorMsg = el.requiredMsg ||
|
|
71
|
+
msg('Eingabe erforderlich',{desc: '#pd.form.field.required#'});
|
|
70
72
|
e.detail.errorMap.set(el.id, tmpEl.errorMsg);
|
|
71
73
|
} else {
|
|
72
74
|
tmpEl.errorMsg = "";
|
|
@@ -74,7 +76,7 @@ export class PdFormContainer extends LitElement {
|
|
|
74
76
|
})
|
|
75
77
|
|
|
76
78
|
// general validate method
|
|
77
|
-
const validateByType = (fieldType, validFunc,
|
|
79
|
+
const validateByType = (fieldType, validFunc, invalidMsgTxt) => {
|
|
78
80
|
|
|
79
81
|
if (e.detail.singleElement &&
|
|
80
82
|
e.detail.singleElement.getAttribute("field-type") !== fieldType) {
|
|
@@ -91,7 +93,7 @@ export class PdFormContainer extends LitElement {
|
|
|
91
93
|
if (validFunc(el.value)) {
|
|
92
94
|
tmpEl.errorMsg = "";
|
|
93
95
|
} else {
|
|
94
|
-
tmpEl.errorMsg = `
|
|
96
|
+
tmpEl.errorMsg = invalidMsgTxt || `Invalid format for ${fieldType}`;
|
|
95
97
|
e.detail.errorMap.set(el.id, tmpEl.errorMsg);
|
|
96
98
|
}
|
|
97
99
|
}
|
|
@@ -99,10 +101,14 @@ export class PdFormContainer extends LitElement {
|
|
|
99
101
|
};
|
|
100
102
|
|
|
101
103
|
// validate mail and phone inputs
|
|
102
|
-
validateByType("mail", PdFormContainer._mailIsValid,
|
|
103
|
-
|
|
104
|
-
validateByType("
|
|
105
|
-
|
|
104
|
+
validateByType("mail", PdFormContainer._mailIsValid,
|
|
105
|
+
msg('Format mail@test.de verwenden',{desc: '#pd.form.field.invalid.mail#'}));
|
|
106
|
+
validateByType("phone", PdFormContainer._phoneIsValid,
|
|
107
|
+
msg("Format +49123 123456 verwenden",{desc: '#pd.form.field.invalid.phone#'}));
|
|
108
|
+
validateByType("vat", PdFormContainer._vatIsValid,
|
|
109
|
+
msg("Format DE0123456789 verwenden",{desc: '#pd.form.field.invalid.vat#'}));
|
|
110
|
+
validateByType("number", (val) => !Number.isNaN(val),
|
|
111
|
+
msg("Nur Zahlen erlaubt",{desc: '#pd.form.field.invalid.number#'}));
|
|
106
112
|
|
|
107
113
|
if (e.detail.singleElement) {
|
|
108
114
|
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
|
+
];
|
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>
|