@progressive-development/pd-contact 0.6.3 → 0.6.5

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.
@@ -54,14 +54,13 @@ export declare class PdContact extends LitElement {
54
54
  */
55
55
  private _errorMap;
56
56
  static styles: CSSResultGroup;
57
- connectedCallback(): void;
58
- disconnectedCallback(): void;
59
57
  willUpdate(changedProps: PropertyValues<this>): void;
60
- firstUpdated(): void;
61
58
  render(): import('lit-html').TemplateResult<1>;
62
59
  private _renderEditContact;
63
60
  private _getRadioValue;
64
61
  private _renderViewContact;
62
+ get valid(): any;
63
+ triggerValidate(): Promise<boolean>;
65
64
  private _switchAddressType;
66
65
  private _isRequired;
67
66
  private _showInput;
@@ -1 +1 @@
1
- {"version":3,"file":"pd-contact.d.ts","sourceRoot":"","sources":["../src/pd-contact.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAM5E,OAAO,0CAA0C,CAAC;AAElD,OAAO,+CAA+C,CAAC;AACvD,OAAO,qDAAqD,CAAC;AAC7D,OAAO,+CAA+C,CAAC;AACvD,OAAO,4CAA4C,CAAC;AACpD,OAAO,6CAA6C,CAAC;AACrD,OAAO,kDAAkD,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAqB7D,eAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,eAAO,MAAM,SAAS,gBAAgB,CAAC;AACvC,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,WAAW,cAAc,CAAC;AACvC,eAAO,MAAM,UAAU,aAAa,CAAC;AACrC,eAAO,MAAM,QAAQ,WAAW,CAAC;AACjC,eAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,eAAO,MAAM,YAAY,mBAAmB,CAAC;AAC7C,eAAO,MAAM,eAAe,iBAAiB,CAAC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I;IAMpD,MAAM;IAQf,OAAO,CAAC,kBAAkB;IA+O1B,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,kBAAkB;IAiF1B,IAAW,KAAK,QAEf;IAEY,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IAMhD,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,aAAa;IAcrB,OAAO,CAAC,YAAY;IAsBpB,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,MAAM,CAAC,WAAW;CAG3B"}
@@ -1,7 +1,7 @@
1
1
  import { css, LitElement, html } from "lit";
2
2
  import { property, state, customElement } from "lit/decorators.js";
3
3
  import { msg, str } from "@lit/localize";
4
- import { PdFontStyles } from "@progressive-development/pd-shared-styles";
4
+ import { PdFontStyles, PdColorStyles } from "@progressive-development/pd-shared-styles";
5
5
  import "@progressive-development/pd-icon/pd-icon";
6
6
  import "@progressive-development/pd-forms/pd-checkbox";
7
7
  import "@progressive-development/pd-forms/pd-form-container";
@@ -76,31 +76,11 @@ let PdContact = class extends LitElement {
76
76
  this._business = false;
77
77
  this._errorMap = /* @__PURE__ */ new Map();
78
78
  }
79
- connectedCallback() {
80
- super.connectedCallback();
81
- this.addEventListener("validate-form", this._validateForm);
82
- }
83
- disconnectedCallback() {
84
- super.disconnectedCallback();
85
- this.removeEventListener("validate-form", this._validateForm);
86
- }
87
79
  willUpdate(changedProps) {
88
80
  if (changedProps.has("contact") && this.contact) {
89
81
  this._business = this.contact.business ?? false;
90
82
  }
91
83
  }
92
- firstUpdated() {
93
- var _a, _b;
94
- this.addEventListener("key-pressed", (e) => {
95
- const detail = e.detail;
96
- this._errorMap.set(detail.name, "");
97
- this.requestUpdate();
98
- });
99
- if (this.contact) {
100
- const detail = { errorMap: /* @__PURE__ */ new Map() };
101
- (_b = (_a = this.shadowRoot) == null ? void 0 : _a.getElementById("contactContainerId")) == null ? void 0 : _b.dispatchEvent(new CustomEvent("validate-form", { detail }));
102
- }
103
- }
104
84
  render() {
105
85
  return html`
106
86
  <div class="contact">
@@ -109,29 +89,32 @@ let PdContact = class extends LitElement {
109
89
  `;
110
90
  }
111
91
  _renderEditContact() {
112
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
92
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
113
93
  return html`
114
94
  <pd-form-container id="contactContainerId" requiredFieldInfo>
115
95
  ${this.inputFields.length === 0 || this._showInput(C_TYPE) ? html`
116
- <pd-form-row id="testFormId">
96
+ <pd-form-row>
117
97
  <pd-radio-group
98
+ id="contactTypeRadioId"
118
99
  class="quarter3"
119
100
  label="${msg("Typ", { id: "pd.contact.label.type" })}"
120
101
  required
121
- value="${this._getRadioValue()}"
122
- @field-change="${this._switchAddressType}"
102
+ initValue="${this._getRadioValue()}"
103
+ @pd-form-element-change="${this._switchAddressType}"
123
104
  style="--group-gap: 20px;"
124
105
  >
125
106
  <pd-checkbox
126
- value="${!((_a = this.contact) == null ? void 0 : _a.business) || true}"
107
+ checkType="RADIO"
108
+ initValue="${this.contact ? !this.contact.business : true}"
127
109
  valueName="private"
128
110
  >${msg("Privatperson", {
129
111
  id: "pd.contact.check.private"
130
112
  })}</pd-checkbox
131
113
  >
132
114
  <pd-checkbox
115
+ checkType="RADIO"
133
116
  valueName="business"
134
- value="${((_b = this.contact) == null ? void 0 : _b.business) || false}"
117
+ initValue="${this.contact ? this.contact.business || false : false}"
135
118
  >${msg("Unternehmen", {
136
119
  id: "pd.contact.check.company"
137
120
  })}</pd-checkbox
@@ -149,7 +132,7 @@ let PdContact = class extends LitElement {
149
132
  id: "pd.contact.label.company"
150
133
  })}"
151
134
  ?required="${this._isRequired(C_COMPANY)}"
152
- value="${((_c = this.contact) == null ? void 0 : _c.companyName) || ""}"
135
+ initValue="${((_a = this.contact) == null ? void 0 : _a.companyName) || ""}"
153
136
  valueName="companyName"
154
137
  autoCompleteName="organization"
155
138
  ></pd-input>
@@ -164,9 +147,9 @@ let PdContact = class extends LitElement {
164
147
  id: "pd.contact.label.btw"
165
148
  })}"
166
149
  ?required="${this._isRequired(C_BTWNR)}"
167
- field-type="vat"
150
+ fieldType="vat"
168
151
  valueName="vatNr"
169
- value="${((_d = this.contact) == null ? void 0 : _d.vatNr) || ""}"
152
+ initValue="${((_b = this.contact) == null ? void 0 : _b.vatNr) || ""}"
170
153
  autoCompleteName="vat"
171
154
  ></pd-input>
172
155
  </pd-form-row>
@@ -181,7 +164,7 @@ let PdContact = class extends LitElement {
181
164
  id: "pd.contact.label.firstName"
182
165
  })}"
183
166
  valueName="firstName"
184
- value="${((_e = this.contact) == null ? void 0 : _e.firstName) || ""}"
167
+ initValue="${((_c = this.contact) == null ? void 0 : _c.firstName) || ""}"
185
168
  autoCompleteName="given-name"
186
169
  ?required="${this._isRequired(C_FIRSTNAME)}"
187
170
  ></pd-input>
@@ -196,7 +179,7 @@ let PdContact = class extends LitElement {
196
179
  id: "pd.contact.label.lastName"
197
180
  })}"
198
181
  valueName="lastName"
199
- value="${((_f = this.contact) == null ? void 0 : _f.lastName) || ""}"
182
+ initValue="${((_d = this.contact) == null ? void 0 : _d.lastName) || ""}"
200
183
  autoCompleteName="family-name"
201
184
  ?required="${this._isRequired(C_LASTNAME)}"
202
185
  ></pd-input>
@@ -210,7 +193,7 @@ let PdContact = class extends LitElement {
210
193
  class="quarter2"
211
194
  label="${msg("Strasse", { id: "pd.contact.label.street" })}"
212
195
  valueName="street"
213
- value="${((_g = this.contact) == null ? void 0 : _g.street) || ""}"
196
+ initValue="${((_e = this.contact) == null ? void 0 : _e.street) || ""}"
214
197
  autoCompleteName="street-address"
215
198
  ?required="${this._isRequired(C_STREET)}"
216
199
  ></pd-input>
@@ -219,7 +202,7 @@ let PdContact = class extends LitElement {
219
202
  class="quarter1"
220
203
  label="${msg("Nr.", { id: "pd.contact.label.streetNr" })}"
221
204
  valueName="streetNr"
222
- value="${((_h = this.contact) == null ? void 0 : _h.streetNr) || ""}"
205
+ initValue="${((_f = this.contact) == null ? void 0 : _f.streetNr) || ""}"
223
206
  ?required="${this._isRequired("streetNr")}"
224
207
  ></pd-input>
225
208
  </pd-form-row>
@@ -233,16 +216,16 @@ let PdContact = class extends LitElement {
233
216
  class="quarter1"
234
217
  label="${msg("PLZ", { id: "pd.contact.label.zip" })}"
235
218
  valueName="zip"
236
- value="${this.match.zip}"
219
+ initValue="${this.match.zip}"
237
220
  ></pd-input>
238
221
  ` : html`
239
222
  <pd-input
240
223
  id="zipId"
241
224
  class="quarter1"
242
225
  label="${msg("PLZ", { id: "pd.contact.label.zip" })}"
243
- field-type="number"
226
+ fieldType="number"
244
227
  valueName="zip"
245
- value="${((_i = this.contact) == null ? void 0 : _i.zip) || ""}"
228
+ initValue="${((_g = this.contact) == null ? void 0 : _g.zip) || ""}"
246
229
  autoCompleteName="postal-code"
247
230
  ?required="${this._isRequired("zip")}"
248
231
  ></pd-input>
@@ -252,7 +235,7 @@ let PdContact = class extends LitElement {
252
235
  class="quarter2"
253
236
  label="${msg("Ort", { id: "pd.contact.label.city" })}"
254
237
  valueName="city"
255
- value="${((_j = this.contact) == null ? void 0 : _j.city) || ""}"
238
+ initValue="${((_h = this.contact) == null ? void 0 : _h.city) || ""}"
256
239
  autoCompleteName="locality"
257
240
  ?required="${this._isRequired(C_CITY)}"
258
241
  ></pd-input>
@@ -266,7 +249,7 @@ let PdContact = class extends LitElement {
266
249
  label="${msg("Addresszusatz", {
267
250
  id: "pd.contact.label.additional"
268
251
  })}"
269
- value="${((_k = this.contact) == null ? void 0 : _k.additionalHint) || ""}"
252
+ initValue="${((_i = this.contact) == null ? void 0 : _i.additionalHint) || ""}"
270
253
  ></pd-input>
271
254
  </pd-form-row>
272
255
  ` : ""}
@@ -278,7 +261,7 @@ let PdContact = class extends LitElement {
278
261
  label="${msg("Datum der Immobilie", {
279
262
  id: "pd.contact.label.propertyDate"
280
263
  })}"
281
- value="${((_l = this.contact) == null ? void 0 : _l.propertyDate) || ""}"
264
+ initValue="${((_j = this.contact) == null ? void 0 : _j.propertyDate) || ""}"
282
265
  .values="${yearSelection}"
283
266
  ?required="${this._isRequired(C_PROPERTY_DATE)}"
284
267
  ></pd-select>
@@ -292,8 +275,8 @@ let PdContact = class extends LitElement {
292
275
  label="${msg("Telefon", { id: "pd.contact.label.phone" })}"
293
276
  name="phone"
294
277
  valueName="phone1"
295
- value="${((_m = this.contact) == null ? void 0 : _m.phone1) || ""}"
296
- field-type="phone"
278
+ initValue="${((_k = this.contact) == null ? void 0 : _k.phone1) || ""}"
279
+ fieldType="phone"
297
280
  autoCompleteName="tel"
298
281
  ?required="${this._isRequired(C_PHONE1)}"
299
282
  ></pd-input>
@@ -305,9 +288,9 @@ let PdContact = class extends LitElement {
305
288
  id="mailId"
306
289
  class="quarter3"
307
290
  label="${msg("E-mail", { id: "pd.contact.label.email" })}"
308
- field-type="mail"
291
+ fieldType="mail"
309
292
  valueName="email"
310
- value="${((_n = this.contact) == null ? void 0 : _n.email) || ""}"
293
+ initValue="${((_l = this.contact) == null ? void 0 : _l.email) || ""}"
311
294
  autoCompleteName="email"
312
295
  ?required="${this._isRequired(C_EMAIL)}"
313
296
  ></pd-input>
@@ -386,8 +369,20 @@ let PdContact = class extends LitElement {
386
369
  </address>
387
370
  `;
388
371
  }
372
+ get valid() {
373
+ var _a;
374
+ return ((_a = this.shadowRoot) == null ? void 0 : _a.getElementById("contactContainerId")).valid;
375
+ }
376
+ async triggerValidate() {
377
+ var _a;
378
+ return ((_a = this.shadowRoot) == null ? void 0 : _a.getElementById("contactContainerId")).triggerValidate();
379
+ }
389
380
  _switchAddressType(e) {
390
- this._business = e.detail.name === "business";
381
+ console.log("Do switch", e);
382
+ if (e.detail.name === "contactTypeRadioId") {
383
+ this._business = e.detail.value === "business";
384
+ }
385
+ e.stopPropagation();
391
386
  }
392
387
  _isRequired(field) {
393
388
  return this.requiredFields.length > 0 ? this.requiredFields.includes(field) : false;
@@ -447,7 +442,7 @@ let PdContact = class extends LitElement {
447
442
  };
448
443
  PdContact.styles = [
449
444
  PdFontStyles,
450
- // Check: Es fehlt wahrschein der andere color import, um die Komonente out-of the box zu machen?
445
+ PdColorStyles,
451
446
  css`
452
447
  :host {
453
448
  display: block;
@@ -1 +1 @@
1
- {"version":3,"file":"contact-edit.stories.d.ts","sourceRoot":"","sources":["../../src/stories/contact-edit.stories.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAYhE,OAAO,kBAAkB,CAAC;AAG1B,QAAA,MAAM,IAAI;;;;CAWM,CAAC;AAEjB,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC;AA2BtB,eAAO,MAAM,WAAW,EAAE,KAEzB,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,KAIrC,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,KAIzC,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,KAIzC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAIjC,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,KAIxC,CAAC;AAEF,eAAO,MAAM,+BAA+B,EAAE,KAQ7C,CAAC"}
1
+ {"version":3,"file":"contact-edit.stories.d.ts","sourceRoot":"","sources":["../../src/stories/contact-edit.stories.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAYhE,OAAO,kBAAkB,CAAC;AAG1B,QAAA,MAAM,IAAI;;;;CAuBM,CAAC;AAEjB,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC;AA2BtB,eAAO,MAAM,WAAW,EAAE,KAEzB,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,KAIrC,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,KAIzC,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,KAIzC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAIjC,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,KAIxC,CAAC;AAEF,eAAO,MAAM,+BAA+B,EAAE,KAQ7C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progressive-development/pd-contact",
3
- "version": "0.6.3",
3
+ "version": "0.6.5",
4
4
  "description": "Progressive Development Contact component",
5
5
  "author": "PD Progressive Development",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -39,9 +39,9 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@lit/localize": "^0.12.2",
42
- "@progressive-development/pd-forms": "^0.6.4",
43
- "@progressive-development/pd-icon": "^0.6.1",
44
- "@progressive-development/pd-shared-styles": "^0.2.1",
42
+ "@progressive-development/pd-forms": "^0.6.13",
43
+ "@progressive-development/pd-icon": "^0.7.2",
44
+ "@progressive-development/pd-shared-styles": "^0.2.4",
45
45
  "lit": "^3.3.0"
46
46
  },
47
47
  "devDependencies": {