@progressive-development/pd-contact 0.1.42 → 0.1.44

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/PdContact.js +22 -2
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.42",
6
+ "version": "0.1.44",
7
7
  "main": "index.js",
8
8
  "module": "index.js",
9
9
  "scripts": {
package/src/PdContact.js CHANGED
@@ -85,12 +85,23 @@
85
85
  this._errorMap = new Map();
86
86
  }
87
87
 
88
+ connectedCallback() {
89
+ super.connectedCallback();
90
+ // add validation event listener
91
+ this.addEventListener('validate-form', this._validateForm);
92
+ }
93
+
94
+ disconnectedCallback() {
95
+ super.connectedCallback();
96
+ // add validation event listener
97
+ this.removeEventListener('validate-form', this._validateForm);
98
+ }
99
+
88
100
  firstUpdated() {
89
101
  this.addEventListener('key-pressed', e => {
90
102
  this._errorMap.set(e.detail.name, '');
91
103
  super.requestUpdate();
92
104
  });
93
- this.addEventListener('validate-form', this._validateForm);
94
105
  }
95
106
 
96
107
  render() {
@@ -148,6 +159,7 @@
148
159
  class="quarter2"
149
160
  label="Voornaam"
150
161
  valueName="firstName"
162
+ value="${this.contact ? this.contact.firstName : ""}"
151
163
  autoCompleteName="given-name"
152
164
  required
153
165
  ></pd-input>
@@ -156,6 +168,7 @@
156
168
  class="quarter2"
157
169
  label="Naam"
158
170
  valueName="lastName"
171
+ value="${this.contact ? this.contact.lastName : ""}"
159
172
  autoCompleteName="family-name"
160
173
  required
161
174
  ></pd-input>
@@ -167,6 +180,7 @@
167
180
  class="quarter3"
168
181
  label="Straat"
169
182
  valueName="street"
183
+ value="${this.contact ? this.contact.street : ""}"
170
184
  autoCompleteName="street-address"
171
185
  required
172
186
  ></pd-input>
@@ -175,6 +189,7 @@
175
189
  class="quarter1"
176
190
  label="Nr"
177
191
  valueName="streetNr"
192
+ value="${this.contact ? this.contact.streetNr : ""}"
178
193
  required
179
194
  ></pd-input>
180
195
  </pd-form-row>
@@ -183,6 +198,7 @@
183
198
  class="quarter4"
184
199
  id="additionalHintId"
185
200
  label="Extra informatie"
201
+ value="${this.contact ? this.contact.additionalHint : ""}"
186
202
  ></pd-input>
187
203
  </pd-form-row>
188
204
  <pd-form-row class="contact-form">
@@ -205,6 +221,7 @@
205
221
  label="Postcode"
206
222
  field-type="number"
207
223
  valueName="zip"
224
+ value="${this.contact ? this.contact.zip : ""}"
208
225
  autoCompleteName="postal-code"
209
226
  required
210
227
  ></pd-input>
@@ -214,6 +231,7 @@
214
231
  class="quarter2"
215
232
  label="Plaats"
216
233
  valueName="city"
234
+ value="${this.contact ? this.contact.city : ""}"
217
235
  autoCompleteName="locality"
218
236
  required
219
237
  ></pd-input>
@@ -225,6 +243,7 @@
225
243
  label="Telefoon"
226
244
  name="phone"
227
245
  valueName="phone1"
246
+ value="${this.contact ? this.contact.phone1 : ""}"
228
247
  field-type="phone"
229
248
  autoCompleteName="tel"
230
249
  required
@@ -235,6 +254,7 @@
235
254
  label="E-mail"
236
255
  field-type="mail"
237
256
  valueName="email"
257
+ value="${this.contact ? this.contact.email : ""}"
238
258
  autoCompleteName="email"
239
259
  required
240
260
  ></pd-input>
@@ -397,7 +417,7 @@
397
417
  );
398
418
 
399
419
  // set prepared form, if no validation error occured
400
- if (e.detail.errorMap.size === 0) {
420
+ if (e.detail.errorMap.size === 0 && e.detail.formData) {
401
421
  e.detail.formData[this.id] = this._setFormData();
402
422
  }
403
423
  }