@progressive-development/pd-forms 0.0.55 → 0.0.57
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 +1 -1
- package/src/PdBaseUi.js +5 -4
- package/src/PdFormContainer.js +10 -7
- package/src/PdFormRow.js +4 -2
- package/stories/01_index.stories.js +3 -3
- package/stories/form-container.stories.js +14 -3
- package/src/localization.js +0 -9
package/package.json
CHANGED
package/src/PdBaseUi.js
CHANGED
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { LitElement } from 'lit';
|
|
7
|
+
import { updateWhenLocaleChanges } from '@lit/localize';
|
|
7
8
|
|
|
8
9
|
export class PdBaseUI extends LitElement {
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
updateWhenLocaleChanges(this);
|
|
14
|
+
}
|
|
14
15
|
|
|
15
16
|
}
|
package/src/PdFormContainer.js
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
* Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {msg
|
|
6
|
+
import { html, css } from 'lit';
|
|
7
|
+
import { msg } from '@lit/localize';
|
|
8
8
|
|
|
9
|
+
import { PdBaseUI } from './PdBaseUi.js';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* An example element.
|
|
@@ -13,7 +14,7 @@ import {msg, updateWhenLocaleChanges} from '@lit/localize';
|
|
|
13
14
|
* @slot - This element has a slot
|
|
14
15
|
* @csspart button - The button
|
|
15
16
|
*/
|
|
16
|
-
export class PdFormContainer extends
|
|
17
|
+
export class PdFormContainer extends PdBaseUI {
|
|
17
18
|
|
|
18
19
|
static get styles() {
|
|
19
20
|
return css`
|
|
@@ -37,13 +38,15 @@ export class PdFormContainer extends LitElement {
|
|
|
37
38
|
|
|
38
39
|
static get properties() {
|
|
39
40
|
return {
|
|
40
|
-
requiredFieldInfo: { type: Boolean}
|
|
41
|
+
requiredFieldInfo: { type: Boolean},
|
|
42
|
+
locale: { type: String }
|
|
41
43
|
};
|
|
42
44
|
}
|
|
43
45
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
updated(changedProperties) {
|
|
47
|
+
if (changedProperties.has("locale") && this.locale) {
|
|
48
|
+
// setLocale(this.locale);
|
|
49
|
+
}
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
firstUpdated() {
|
package/src/PdFormRow.js
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { html, css } from 'lit';
|
|
7
|
+
|
|
8
|
+
import { PdBaseUI } from './PdBaseUi.js';
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* An example element.
|
|
@@ -11,7 +13,7 @@ import {LitElement, html, css} from 'lit';
|
|
|
11
13
|
* @slot - This element has a slot
|
|
12
14
|
* @csspart button - The button
|
|
13
15
|
*/
|
|
14
|
-
export class PdFormRow extends
|
|
16
|
+
export class PdFormRow extends PdBaseUI {
|
|
15
17
|
|
|
16
18
|
static get styles() {
|
|
17
19
|
return css`
|
|
@@ -82,7 +82,7 @@ return html`
|
|
|
82
82
|
<h3>Defaults Inputs with labels</h3>
|
|
83
83
|
<div
|
|
84
84
|
style="display: flex; justify-content: space-between; max-width: 800px"
|
|
85
|
-
>
|
|
85
|
+
>
|
|
86
86
|
<pd-select
|
|
87
87
|
id="testId1"
|
|
88
88
|
?gradient="${gradient}"
|
|
@@ -100,8 +100,8 @@ return html`
|
|
|
100
100
|
?gradient="${gradient}"
|
|
101
101
|
style="${style}"
|
|
102
102
|
label="Input Area Label"
|
|
103
|
-
></pd-input-area>
|
|
104
|
-
</div>
|
|
103
|
+
></pd-input-area>
|
|
104
|
+
</div>
|
|
105
105
|
|
|
106
106
|
<div
|
|
107
107
|
style="display: flex; justify-content: space-between; max-width: 800px"
|
|
@@ -12,10 +12,10 @@ export default {
|
|
|
12
12
|
function Template() {
|
|
13
13
|
return html`
|
|
14
14
|
<h3>Mit Forms</h3>
|
|
15
|
-
<pd-form-container>
|
|
15
|
+
<pd-form-container id="testFormContainerId" locale="be">
|
|
16
16
|
<pd-form-row>
|
|
17
|
-
<pd-input class="quarter2" id="test1Id" label="Label 1"></pd-input>
|
|
18
|
-
<pd-input class="quarter2" id="test2Id" label="Label 2"></pd-input>
|
|
17
|
+
<pd-input class="quarter2" id="test1Id" label="Label 1" required></pd-input>
|
|
18
|
+
<pd-input class="quarter2" id="test2Id" label="Label 2" required></pd-input>
|
|
19
19
|
</pd-form-row>
|
|
20
20
|
<pd-form-row>
|
|
21
21
|
<pd-input class="quarter4" id="test3Id" label="Label 3"></pd-input>
|
|
@@ -43,6 +43,17 @@ function Template() {
|
|
|
43
43
|
<pd-input class="quarter2" id="test15Id" label="Label 6"></pd-input>
|
|
44
44
|
</pd-form-row>
|
|
45
45
|
</pd-form-container>
|
|
46
|
+
|
|
47
|
+
<h2>Test Validation</h2>
|
|
48
|
+
<button
|
|
49
|
+
@click="${() => {
|
|
50
|
+
document.getElementById('testFormContainerId').dispatchEvent(
|
|
51
|
+
new CustomEvent("validate-form", {detail: {errorMap: new Map()}})
|
|
52
|
+
);
|
|
53
|
+
}}"
|
|
54
|
+
>
|
|
55
|
+
Test Validate
|
|
56
|
+
</button>
|
|
46
57
|
`;
|
|
47
58
|
}
|
|
48
59
|
|
package/src/localization.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
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(`/locale/${locale}.js`),
|
|
9
|
-
});
|