@progressive-development/pd-contact 0.1.44 → 0.1.45
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/PdContact.js +20 -2
- package/stories/index.stories.js +11 -5
package/package.json
CHANGED
package/src/PdContact.js
CHANGED
|
@@ -102,6 +102,16 @@
|
|
|
102
102
|
this._errorMap.set(e.detail.name, '');
|
|
103
103
|
super.requestUpdate();
|
|
104
104
|
});
|
|
105
|
+
|
|
106
|
+
// first validation if form is already filled (edit)
|
|
107
|
+
if (this.contact) {
|
|
108
|
+
const detail = {
|
|
109
|
+
errorMap: new Map()
|
|
110
|
+
}
|
|
111
|
+
this.shadowRoot?.getElementById("contactContainerId")?.dispatchEvent(
|
|
112
|
+
new CustomEvent("validate-form", {detail})
|
|
113
|
+
);
|
|
114
|
+
}
|
|
105
115
|
}
|
|
106
116
|
|
|
107
117
|
render() {
|
|
@@ -120,13 +130,14 @@
|
|
|
120
130
|
class="quarter4"
|
|
121
131
|
label="Type"
|
|
122
132
|
required
|
|
133
|
+
value="${this._getRadioValue()}"
|
|
123
134
|
@field-change="${this._switchAddressType}"
|
|
124
135
|
style="--group-gap: 20px;"
|
|
125
136
|
>
|
|
126
|
-
<pd-checkbox value="true" valueName="private"
|
|
137
|
+
<pd-checkbox value="${this.contact ? !this.contact.business : true}" valueName="private"
|
|
127
138
|
>Particulier</pd-checkbox
|
|
128
139
|
>
|
|
129
|
-
<pd-checkbox valueName="business">Onderneming</pd-checkbox>
|
|
140
|
+
<pd-checkbox valueName="business" value="${this.contact ? this.contact.business : false}">Onderneming</pd-checkbox>
|
|
130
141
|
</pd-radio-group>
|
|
131
142
|
</pd-form-row>
|
|
132
143
|
|
|
@@ -263,6 +274,13 @@
|
|
|
263
274
|
`;
|
|
264
275
|
}
|
|
265
276
|
|
|
277
|
+
_getRadioValue() {
|
|
278
|
+
if (this.contact) {
|
|
279
|
+
return this.contact.business ? "business" : "private";
|
|
280
|
+
}
|
|
281
|
+
return "private";
|
|
282
|
+
}
|
|
283
|
+
|
|
266
284
|
_renderViewContact() {
|
|
267
285
|
return html`
|
|
268
286
|
<address>
|
package/stories/index.stories.js
CHANGED
|
@@ -4,8 +4,7 @@ import '../pd-contact.js';
|
|
|
4
4
|
export default {
|
|
5
5
|
title: 'PdContact/Contact',
|
|
6
6
|
component: 'pd-contact',
|
|
7
|
-
argTypes: {
|
|
8
|
-
|
|
7
|
+
argTypes: {
|
|
9
8
|
},
|
|
10
9
|
};
|
|
11
10
|
|
|
@@ -16,17 +15,18 @@ function Template() {
|
|
|
16
15
|
`;
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
function TemplateView() {
|
|
18
|
+
function TemplateView({summary}) {
|
|
19
|
+
console.log(summary);
|
|
20
20
|
return html`
|
|
21
21
|
<h3>View Contact</h3>
|
|
22
|
-
<pd-contact summary .contact="${{
|
|
22
|
+
<pd-contact ?summary="${summary}" .contact="${{
|
|
23
23
|
firstName: 'Peter',
|
|
24
24
|
lastName: 'Musterman',
|
|
25
25
|
street: 'Musterstrasse',
|
|
26
26
|
streetNr: '23b',
|
|
27
27
|
zip: '9040',
|
|
28
28
|
city: 'Gent',
|
|
29
|
-
|
|
29
|
+
phone1: '0221 992344234',
|
|
30
30
|
mobil: '0175/9923443',
|
|
31
31
|
email: 'peter@muster.be'
|
|
32
32
|
}}"></pd-contact>`;
|
|
@@ -38,4 +38,10 @@ ContactForm.args = {
|
|
|
38
38
|
|
|
39
39
|
export const ContactView = TemplateView.bind({});
|
|
40
40
|
ContactView.args = {
|
|
41
|
+
summary: "true"
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const ContactPreparedForm = TemplateView.bind({});
|
|
45
|
+
ContactView.args = {
|
|
46
|
+
summary: "false"
|
|
41
47
|
};
|