@progressive-development/pd-contact 0.1.60 → 0.1.62
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 +2 -2
- package/src/PdContact.js +19 -19
- package/stories/index.stories.js +23 -0
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Progressive Development Contact component",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"author": "PD Progressive Development",
|
|
6
|
-
"version": "0.1.
|
|
6
|
+
"version": "0.1.62",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"module": "index.js",
|
|
9
9
|
"scripts": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"storybook:build": "npm run analyze -- --exclude dist && build-storybook"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@progressive-development/pd-forms": "^0.2.
|
|
20
|
+
"@progressive-development/pd-forms": "^0.2.13",
|
|
21
21
|
"@progressive-development/pd-shared-styles": "^0.1.1",
|
|
22
22
|
"lit": "^2.2.0"
|
|
23
23
|
},
|
package/src/PdContact.js
CHANGED
|
@@ -62,11 +62,7 @@
|
|
|
62
62
|
return {
|
|
63
63
|
|
|
64
64
|
addressTitle: { type: String },
|
|
65
|
-
addressRef: { type: String },
|
|
66
|
-
/**
|
|
67
|
-
* address type, business (true) or private (false), refactor, ist state internal? => _business, state:true
|
|
68
|
-
*/
|
|
69
|
-
business: { type: Boolean },
|
|
65
|
+
addressRef: { type: String },
|
|
70
66
|
/**
|
|
71
67
|
* summary (true) or view (false) contact data
|
|
72
68
|
*/
|
|
@@ -77,6 +73,10 @@
|
|
|
77
73
|
requiredFields: { type: Array },
|
|
78
74
|
contact: { type: Object },
|
|
79
75
|
match: { type: Object },
|
|
76
|
+
/**
|
|
77
|
+
* address type, business (true) or private (false), refactor, ist state internal? => _business, state:true
|
|
78
|
+
*/
|
|
79
|
+
_business: { type: Boolean, state: true },
|
|
80
80
|
_errorMap: { type: Object },
|
|
81
81
|
};
|
|
82
82
|
}
|
|
@@ -85,15 +85,15 @@
|
|
|
85
85
|
super();
|
|
86
86
|
this.addressTitle = 'Adres';
|
|
87
87
|
this.requiredFields = [];
|
|
88
|
-
this.summary = false;
|
|
89
|
-
this.business = false;
|
|
88
|
+
this.summary = false;
|
|
90
89
|
this.match = {};
|
|
90
|
+
this._business = false;
|
|
91
91
|
this._errorMap = new Map();
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
update(changedProperties) {
|
|
95
95
|
if (changedProperties.has("contact") && this.contact) {
|
|
96
|
-
this.
|
|
96
|
+
this._business = this.contact.business;
|
|
97
97
|
}
|
|
98
98
|
super.update(changedProperties);
|
|
99
99
|
}
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
</pd-radio-group>
|
|
155
155
|
</pd-form-row>
|
|
156
156
|
|
|
157
|
-
${this.
|
|
157
|
+
${this._business
|
|
158
158
|
? html`
|
|
159
159
|
<pd-form-row class="contact-form">
|
|
160
160
|
<pd-input
|
|
@@ -162,6 +162,7 @@
|
|
|
162
162
|
class="quarter2"
|
|
163
163
|
label="Naam onderneming"
|
|
164
164
|
?required="${this._isRequired("companyName")}"
|
|
165
|
+
value="${this.contact ? this.contact.companyName : ""}"
|
|
165
166
|
valueName="companyName"
|
|
166
167
|
autoCompleteName="organization"
|
|
167
168
|
></pd-input>
|
|
@@ -172,6 +173,7 @@
|
|
|
172
173
|
?required="${this._isRequired("vatNr")}"
|
|
173
174
|
field-type="vat"
|
|
174
175
|
valueName="vatNr"
|
|
176
|
+
value="${this.contact ? this.contact.vatNr : ""}"
|
|
175
177
|
autoCompleteName="vat"
|
|
176
178
|
></pd-input>
|
|
177
179
|
</pd-form-row>
|
|
@@ -326,7 +328,7 @@
|
|
|
326
328
|
}
|
|
327
329
|
|
|
328
330
|
_switchAddressType(e) {
|
|
329
|
-
this.
|
|
331
|
+
this._business = e.detail.name === 'business';
|
|
330
332
|
}
|
|
331
333
|
|
|
332
334
|
_isRequired(field) {
|
|
@@ -459,16 +461,16 @@
|
|
|
459
461
|
}
|
|
460
462
|
|
|
461
463
|
_setFormData() {
|
|
462
|
-
const companyName = this.
|
|
464
|
+
const companyName = this._business
|
|
463
465
|
? this.shadowRoot.getElementById('compNameId').value
|
|
464
466
|
: undefined;
|
|
465
|
-
const vatNr = this.
|
|
467
|
+
const vatNr = this._business
|
|
466
468
|
? this.shadowRoot.getElementById('vatId').value
|
|
467
469
|
: undefined;
|
|
468
|
-
const firstName = this.
|
|
470
|
+
const firstName = this._business
|
|
469
471
|
? undefined
|
|
470
472
|
: this.shadowRoot.getElementById('firstNameId').value;
|
|
471
|
-
const lastName = this.
|
|
473
|
+
const lastName = this._business
|
|
472
474
|
? undefined
|
|
473
475
|
: this.shadowRoot.getElementById('lastNameId').value;
|
|
474
476
|
const street = this.shadowRoot.getElementById('streetId').value;
|
|
@@ -478,10 +480,10 @@
|
|
|
478
480
|
const zip = this.shadowRoot.getElementById('zipId').value;
|
|
479
481
|
const city = this.shadowRoot.getElementById('cityId').value;
|
|
480
482
|
const phone1 = this.shadowRoot.getElementById('phoneId').value;
|
|
481
|
-
const email = this.shadowRoot.getElementById('mailId').value;
|
|
483
|
+
const email = this.shadowRoot.getElementById('mailId').value;
|
|
482
484
|
|
|
483
|
-
|
|
484
|
-
business: this.
|
|
485
|
+
return {
|
|
486
|
+
business: this._business,
|
|
485
487
|
companyName,
|
|
486
488
|
vatNr,
|
|
487
489
|
firstName,
|
|
@@ -494,8 +496,6 @@
|
|
|
494
496
|
phone1,
|
|
495
497
|
email,
|
|
496
498
|
};
|
|
497
|
-
|
|
498
|
-
return {...this.contact};
|
|
499
499
|
}
|
|
500
500
|
|
|
501
501
|
_getFullName() {
|
package/stories/index.stories.js
CHANGED
|
@@ -32,6 +32,24 @@ function TemplateView({summary}) {
|
|
|
32
32
|
}}"></pd-contact>`;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
function TemplateViewBusiness({summary}) {
|
|
36
|
+
console.log(summary);
|
|
37
|
+
return html`
|
|
38
|
+
<h3>View Contact</h3>
|
|
39
|
+
<pd-contact ?summary="${summary}" .contact="${{
|
|
40
|
+
business: true,
|
|
41
|
+
companyName: 'PD Progressive Develpoment',
|
|
42
|
+
vatNr: "DE0123456789",
|
|
43
|
+
street: 'Musterstrasse',
|
|
44
|
+
streetNr: '23b',
|
|
45
|
+
zip: '9040',
|
|
46
|
+
city: 'Gent',
|
|
47
|
+
phone1: '0221 992344234',
|
|
48
|
+
mobil: '0175/9923443',
|
|
49
|
+
email: 'peter@muster.be'
|
|
50
|
+
}}"></pd-contact>`;
|
|
51
|
+
}
|
|
52
|
+
|
|
35
53
|
export const ContactForm = Template.bind({});
|
|
36
54
|
ContactForm.args = {
|
|
37
55
|
};
|
|
@@ -45,3 +63,8 @@ export const ContactPreparedForm = TemplateView.bind({});
|
|
|
45
63
|
ContactView.args = {
|
|
46
64
|
summary: "false"
|
|
47
65
|
};
|
|
66
|
+
|
|
67
|
+
export const ContactPreparedFormCompany = TemplateViewBusiness.bind({});
|
|
68
|
+
ContactView.args = {
|
|
69
|
+
summary: "false"
|
|
70
|
+
};
|