@progressive-development/pd-contact 0.6.26 → 0.9.2
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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -10
- package/dist/locales/be.js +4 -4
- package/dist/locales/de.js +4 -4
- package/dist/locales/en.js +4 -4
- package/dist/pd-contact/PdContact.d.ts +63 -0
- package/dist/pd-contact/PdContact.d.ts.map +1 -0
- package/dist/pd-contact/PdContact.js +546 -0
- package/dist/{stories/contact-edit.stories.d.ts → pd-contact/pd-contact-edit.stories.d.ts} +2 -2
- package/dist/pd-contact/pd-contact-edit.stories.d.ts.map +1 -0
- package/dist/{stories/contact-view.stories.d.ts → pd-contact/pd-contact-view.stories.d.ts} +2 -2
- package/dist/pd-contact/pd-contact-view.stories.d.ts.map +1 -0
- package/dist/pd-contact/pd-contact.d.ts +3 -0
- package/dist/pd-contact/pd-contact.d.ts.map +1 -0
- package/dist/pd-contact.d.ts +2 -60
- package/dist/pd-contact.js +6 -558
- package/dist/types.js +2 -14
- package/package.json +27 -47
- package/dist/pd-contact.d.ts.map +0 -1
- package/dist/stories/contact-edit.stories.d.ts.map +0 -1
- package/dist/stories/contact-view.stories.d.ts.map +0 -1
package/dist/pd-contact.js
CHANGED
|
@@ -1,560 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { property, state, query, customElement } from "lit/decorators.js";
|
|
3
|
-
import { msg, str } from "@lit/localize";
|
|
4
|
-
import { PdFontStyles, PdColorStyles } from "@progressive-development/pd-shared-styles";
|
|
5
|
-
import "@progressive-development/pd-icon/pd-icon";
|
|
6
|
-
import "@progressive-development/pd-forms/pd-checkbox";
|
|
7
|
-
import "@progressive-development/pd-forms/pd-form-container";
|
|
8
|
-
import "@progressive-development/pd-forms/pd-form-row";
|
|
9
|
-
import "@progressive-development/pd-forms/pd-input";
|
|
10
|
-
import "@progressive-development/pd-forms/pd-select";
|
|
11
|
-
import "@progressive-development/pd-forms/pd-radio-group";
|
|
12
|
-
import { C_TYPE, C_COMPANY, C_BTWNR, C_FIRSTNAME, C_LASTNAME, C_STREET, C_CITY, C_ZIP, C_ADDITIONAL, C_PROPERTY_DATE, C_PHONE1, C_EMAIL } from "./types.js";
|
|
13
|
-
var __defProp = Object.defineProperty;
|
|
14
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
15
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
16
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
17
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
18
|
-
if (decorator = decorators[i])
|
|
19
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
20
|
-
if (kind && result) __defProp(target, key, result);
|
|
21
|
-
return result;
|
|
22
|
-
};
|
|
23
|
-
const countryPrefixes = {
|
|
24
|
-
de: "+49",
|
|
25
|
-
// Deutschland
|
|
26
|
-
be: "+32",
|
|
27
|
-
// Belgien
|
|
28
|
-
nl: "+31",
|
|
29
|
-
// Niederland
|
|
30
|
-
fr: "+33",
|
|
31
|
-
// Frankreich
|
|
32
|
-
es: "+34"
|
|
33
|
-
// Spanien
|
|
34
|
-
};
|
|
35
|
-
function transformPhone(phone, country) {
|
|
36
|
-
if (!phone || typeof phone !== "string") return "";
|
|
37
|
-
const countryPrefix = countryPrefixes[country];
|
|
38
|
-
if (!countryPrefix) throw new Error(`Unbekanntes Land: ${country}`);
|
|
39
|
-
const cleanedPhone = phone.replace(/\s+/g, "").replace(/[^0-9+]/g, "");
|
|
40
|
-
if (cleanedPhone.startsWith("+")) return cleanedPhone;
|
|
41
|
-
if (cleanedPhone.startsWith("0"))
|
|
42
|
-
return countryPrefix + cleanedPhone.slice(1);
|
|
43
|
-
return "";
|
|
44
|
-
}
|
|
45
|
-
const yearSelection = [
|
|
46
|
-
{
|
|
47
|
-
value: "UNDEF",
|
|
48
|
-
name: msg("Baujahr auswählen", {
|
|
49
|
-
id: "pd.contact.property.year.selection"
|
|
50
|
-
})
|
|
51
|
-
},
|
|
52
|
-
...Array.from({ length: 2025 - 2014 + 1 }, (_, i) => {
|
|
53
|
-
const year = (2014 + i).toString();
|
|
54
|
-
return { value: year, name: year };
|
|
55
|
-
})
|
|
56
|
-
];
|
|
57
|
-
let PdContact = class extends LitElement {
|
|
58
|
-
constructor() {
|
|
59
|
-
super(...arguments);
|
|
60
|
-
this.addressTitle = msg("Adresse", { id: "pd.contact.address.title" });
|
|
61
|
-
this.phoneMailLink = false;
|
|
62
|
-
this.summary = false;
|
|
63
|
-
this.withPropertyDate = false;
|
|
64
|
-
this.requiredFields = [];
|
|
65
|
-
this.inputFields = [];
|
|
66
|
-
this._business = false;
|
|
67
|
-
}
|
|
68
|
-
willUpdate(changedProps) {
|
|
69
|
-
if (changedProps.has("contact") && this.contact) {
|
|
70
|
-
this._business = this.contact.business ?? false;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
render() {
|
|
74
|
-
return html`
|
|
75
|
-
<div class="contact">
|
|
76
|
-
${this.summary ? this._renderViewContact() : this._renderEditContact()}
|
|
77
|
-
</div>
|
|
78
|
-
`;
|
|
79
|
-
}
|
|
80
|
-
_renderEditContact() {
|
|
81
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
82
|
-
return html`
|
|
83
|
-
<pd-form-container id="contactContainerId" requiredFieldInfo autoTrimm>
|
|
84
|
-
${this.inputFields.length === 0 || this._showInput(C_TYPE) ? html`
|
|
85
|
-
<pd-form-row>
|
|
86
|
-
<pd-radio-group
|
|
87
|
-
id="contactTypeRadioId"
|
|
88
|
-
class="quarter3"
|
|
89
|
-
label="${msg("Typ", { id: "pd.contact.label.type" })}"
|
|
90
|
-
required
|
|
91
|
-
initValue="${this._getRadioValue()}"
|
|
92
|
-
@pd-form-element-change="${this._switchAddressType}"
|
|
93
|
-
style="--group-gap: 20px;"
|
|
94
|
-
>
|
|
95
|
-
<pd-checkbox
|
|
96
|
-
checkType="RADIO"
|
|
97
|
-
initValue="${this.contact ? !this.contact.business : true}"
|
|
98
|
-
valueName="private"
|
|
99
|
-
>${msg("Privatperson", {
|
|
100
|
-
id: "pd.contact.check.private"
|
|
101
|
-
})}</pd-checkbox
|
|
102
|
-
>
|
|
103
|
-
<pd-checkbox
|
|
104
|
-
checkType="RADIO"
|
|
105
|
-
valueName="business"
|
|
106
|
-
initValue="${this.contact ? this.contact.business || false : false}"
|
|
107
|
-
>${msg("Unternehmen", {
|
|
108
|
-
id: "pd.contact.check.company"
|
|
109
|
-
})}</pd-checkbox
|
|
110
|
-
>
|
|
111
|
-
</pd-radio-group>
|
|
112
|
-
</pd-form-row>
|
|
113
|
-
` : ""}
|
|
114
|
-
${this._business ? html`
|
|
115
|
-
${this.inputFields.length === 0 || this._showInput(C_COMPANY) ? html`
|
|
116
|
-
<pd-form-row class="contact-form">
|
|
117
|
-
<pd-input
|
|
118
|
-
id="compNameId"
|
|
119
|
-
class="quarter3"
|
|
120
|
-
label="${msg("Name des Unternehmen", {
|
|
121
|
-
id: "pd.contact.label.company"
|
|
122
|
-
})}"
|
|
123
|
-
?required="${this._isRequired(C_COMPANY)}"
|
|
124
|
-
initValue="${((_a = this.contact) == null ? void 0 : _a.companyName) || ""}"
|
|
125
|
-
valueName="companyName"
|
|
126
|
-
autoCompleteName="organization"
|
|
127
|
-
></pd-input>
|
|
128
|
-
</pd-form-row>
|
|
129
|
-
` : ""}
|
|
130
|
-
${this.inputFields.length === 0 || this._showInput(C_BTWNR) ? html`
|
|
131
|
-
<pd-form-row class="contact-form">
|
|
132
|
-
<pd-input
|
|
133
|
-
id="vatId"
|
|
134
|
-
class="quarter3"
|
|
135
|
-
label="${msg("USt-IdNr.", {
|
|
136
|
-
id: "pd.contact.label.btw"
|
|
137
|
-
})}"
|
|
138
|
-
?required="${this._isRequired(C_BTWNR)}"
|
|
139
|
-
fieldType="vat"
|
|
140
|
-
valueName="vatNr"
|
|
141
|
-
initValue="${((_b = this.contact) == null ? void 0 : _b.vatNr) || ""}"
|
|
142
|
-
autoCompleteName="vat"
|
|
143
|
-
></pd-input>
|
|
144
|
-
</pd-form-row>
|
|
145
|
-
` : ""}
|
|
146
|
-
` : html`
|
|
147
|
-
${this.inputFields.length === 0 || this._showInput(C_FIRSTNAME) ? html`
|
|
148
|
-
<pd-form-row class="contact-form">
|
|
149
|
-
<pd-input
|
|
150
|
-
id="firstNameId"
|
|
151
|
-
class="quarter3"
|
|
152
|
-
label="${msg("Vorname", {
|
|
153
|
-
id: "pd.contact.label.firstName"
|
|
154
|
-
})}"
|
|
155
|
-
valueName="firstName"
|
|
156
|
-
initValue="${((_c = this.contact) == null ? void 0 : _c.firstName) || ""}"
|
|
157
|
-
autoCompleteName="given-name"
|
|
158
|
-
?required="${this._isRequired(C_FIRSTNAME)}"
|
|
159
|
-
></pd-input>
|
|
160
|
-
</pd-form-row>
|
|
161
|
-
` : ""}
|
|
162
|
-
${this.inputFields.length === 0 || this._showInput(C_LASTNAME) ? html`
|
|
163
|
-
<pd-form-row class="contact-form">
|
|
164
|
-
<pd-input
|
|
165
|
-
id="lastNameId"
|
|
166
|
-
class="quarter3"
|
|
167
|
-
label="${msg("Nachname", {
|
|
168
|
-
id: "pd.contact.label.lastName"
|
|
169
|
-
})}"
|
|
170
|
-
valueName="lastName"
|
|
171
|
-
initValue="${((_d = this.contact) == null ? void 0 : _d.lastName) || ""}"
|
|
172
|
-
autoCompleteName="family-name"
|
|
173
|
-
?required="${this._isRequired(C_LASTNAME)}"
|
|
174
|
-
></pd-input>
|
|
175
|
-
</pd-form-row>
|
|
176
|
-
` : ""}
|
|
177
|
-
`}
|
|
178
|
-
${this.inputFields.length === 0 || this._showInput(C_STREET) ? html`
|
|
179
|
-
<pd-form-row class="contact-form">
|
|
180
|
-
<pd-input
|
|
181
|
-
id="streetId"
|
|
182
|
-
class="quarter2"
|
|
183
|
-
label="${msg("Strasse", { id: "pd.contact.label.street" })}"
|
|
184
|
-
valueName="street"
|
|
185
|
-
initValue="${((_e = this.contact) == null ? void 0 : _e.street) || ""}"
|
|
186
|
-
autoCompleteName="street-address"
|
|
187
|
-
?required="${this._isRequired(C_STREET)}"
|
|
188
|
-
></pd-input>
|
|
189
|
-
<pd-input
|
|
190
|
-
id="streetNrId"
|
|
191
|
-
class="quarter1"
|
|
192
|
-
label="${msg("Nr.", { id: "pd.contact.label.streetNr" })}"
|
|
193
|
-
valueName="streetNr"
|
|
194
|
-
initValue="${((_f = this.contact) == null ? void 0 : _f.streetNr) || ""}"
|
|
195
|
-
?required="${this._isRequired(C_STREET)}"
|
|
196
|
-
></pd-input>
|
|
197
|
-
</pd-form-row>
|
|
198
|
-
` : ""}
|
|
199
|
-
${this.inputFields.length === 0 || this._showInput(C_CITY) ? html`
|
|
200
|
-
<pd-form-row class="contact-form">
|
|
201
|
-
${this.match && this.match.zip ? html`
|
|
202
|
-
<pd-input
|
|
203
|
-
readonly
|
|
204
|
-
id="zipId"
|
|
205
|
-
class="quarter1"
|
|
206
|
-
label="${msg("PLZ", { id: "pd.contact.label.zip" })}"
|
|
207
|
-
valueName="zip"
|
|
208
|
-
initValue="${this.match.zip}"
|
|
209
|
-
></pd-input>
|
|
210
|
-
` : html`
|
|
211
|
-
<pd-input
|
|
212
|
-
id="zipId"
|
|
213
|
-
class="quarter1"
|
|
214
|
-
label="${msg("PLZ", { id: "pd.contact.label.zip" })}"
|
|
215
|
-
fieldType="number"
|
|
216
|
-
valueName="zip"
|
|
217
|
-
initValue="${((_g = this.contact) == null ? void 0 : _g.zip) || ""}"
|
|
218
|
-
autoCompleteName="postal-code"
|
|
219
|
-
?required="${this._isRequired(C_ZIP)}"
|
|
220
|
-
></pd-input>
|
|
221
|
-
`}
|
|
222
|
-
<pd-input
|
|
223
|
-
id="cityId"
|
|
224
|
-
class="quarter2"
|
|
225
|
-
label="${msg("Ort", { id: "pd.contact.label.city" })}"
|
|
226
|
-
valueName="city"
|
|
227
|
-
initValue="${((_h = this.contact) == null ? void 0 : _h.city) || ""}"
|
|
228
|
-
autoCompleteName="locality"
|
|
229
|
-
?required="${this._isRequired(C_CITY)}"
|
|
230
|
-
></pd-input>
|
|
231
|
-
</pd-form-row>
|
|
232
|
-
` : ""}
|
|
233
|
-
${this.inputFields.length === 0 || this._showInput(C_ADDITIONAL) ? html`
|
|
234
|
-
<pd-form-row class="contact-form">
|
|
235
|
-
<pd-input
|
|
236
|
-
class="quarter3"
|
|
237
|
-
id="additionalHintId"
|
|
238
|
-
label="${msg("Addresszusatz", {
|
|
239
|
-
id: "pd.contact.label.additional"
|
|
240
|
-
})}"
|
|
241
|
-
initValue="${((_i = this.contact) == null ? void 0 : _i.additionalHint) || ""}"
|
|
242
|
-
valueName="additionalHint"
|
|
243
|
-
?required="${this._isRequired(C_ADDITIONAL)}"
|
|
244
|
-
></pd-input>
|
|
245
|
-
</pd-form-row>
|
|
246
|
-
` : ""}
|
|
247
|
-
${this.withPropertyDate ? html`
|
|
248
|
-
<pd-form-row class="contact-form">
|
|
249
|
-
<pd-select
|
|
250
|
-
class="quarter3"
|
|
251
|
-
id="propertyDateId"
|
|
252
|
-
label="${msg("Datum der Immobilie", {
|
|
253
|
-
id: "pd.contact.label.propertyDate"
|
|
254
|
-
})}"
|
|
255
|
-
initValue="${((_j = this.contact) == null ? void 0 : _j.propertyDate) || ""}"
|
|
256
|
-
.values="${yearSelection}"
|
|
257
|
-
?required="${this._isRequired(C_PROPERTY_DATE)}"
|
|
258
|
-
></pd-select>
|
|
259
|
-
</pd-form-row>
|
|
260
|
-
` : ""}
|
|
261
|
-
${this.inputFields.length === 0 || this._showInput(C_PHONE1) ? html`
|
|
262
|
-
<pd-form-row class="contact-form">
|
|
263
|
-
<pd-input
|
|
264
|
-
id="phoneId"
|
|
265
|
-
class="quarter3"
|
|
266
|
-
label="${msg("Telefon", { id: "pd.contact.label.phone" })}"
|
|
267
|
-
name="phone"
|
|
268
|
-
valueName="phone1"
|
|
269
|
-
initValue="${((_k = this.contact) == null ? void 0 : _k.phone1) || ""}"
|
|
270
|
-
fieldType="phone"
|
|
271
|
-
autoCompleteName="tel"
|
|
272
|
-
?required="${this._isRequired(C_PHONE1)}"
|
|
273
|
-
></pd-input>
|
|
274
|
-
</pd-form-row>
|
|
275
|
-
` : ""}
|
|
276
|
-
${this.inputFields.length === 0 || this._showInput(C_EMAIL) ? html`
|
|
277
|
-
<pd-form-row class="contact-form">
|
|
278
|
-
<pd-input
|
|
279
|
-
id="mailId"
|
|
280
|
-
class="quarter3"
|
|
281
|
-
label="${msg("E-mail", { id: "pd.contact.label.email" })}"
|
|
282
|
-
fieldType="mail"
|
|
283
|
-
valueName="email"
|
|
284
|
-
initValue="${((_l = this.contact) == null ? void 0 : _l.email) || ""}"
|
|
285
|
-
autoCompleteName="email"
|
|
286
|
-
?required="${this._isRequired(C_EMAIL)}"
|
|
287
|
-
></pd-input>
|
|
288
|
-
</pd-form-row>
|
|
289
|
-
` : ""}
|
|
290
|
-
</pd-form-container>
|
|
291
|
-
`;
|
|
292
|
-
}
|
|
293
|
-
_getRadioValue() {
|
|
294
|
-
if (this.contact) {
|
|
295
|
-
return this.contact.business ? "business" : "private";
|
|
296
|
-
}
|
|
297
|
-
return "private";
|
|
298
|
-
}
|
|
299
|
-
_renderViewContact() {
|
|
300
|
-
if (!this.contact) return html`<p>Contact undefined</p>`;
|
|
301
|
-
const trPhoneNr = transformPhone(
|
|
302
|
-
this.contact.phone1 || "",
|
|
303
|
-
this.contact.country || "be"
|
|
304
|
-
);
|
|
305
|
-
return html`
|
|
306
|
-
<address>
|
|
307
|
-
<dl>
|
|
308
|
-
<dt>${this.addressTitle}</dt>
|
|
309
|
-
<dd>${this.contact.companyName}</dd>
|
|
310
|
-
<dd>${this.contact.vatNr}</dd>
|
|
311
|
-
<dd>${this._getFullName()}</dd>
|
|
312
|
-
<dd>${this._getFullStreet()}</dd>
|
|
313
|
-
<dd>${this._getFullLocation()}</dd>
|
|
314
|
-
${this.contact.additionalHint ? html`<dd>${this.contact.additionalHint}</dd>` : ""}
|
|
315
|
-
${this.contact.propertyDate ? html`<dd>
|
|
316
|
-
${msg(str`Baujahr: ${this.contact.propertyDate}`, {
|
|
317
|
-
id: "pd.contact.label.summary.propertyDate"
|
|
318
|
-
})}
|
|
319
|
-
</dd>` : ""}
|
|
320
|
-
<dd>${this.contact.country}</dd>
|
|
321
|
-
|
|
322
|
-
${this.contact.phone1 ? html` <dd class="larger">
|
|
323
|
-
${this.phoneMailLink && trPhoneNr ? html` <a
|
|
324
|
-
href="tel:${trPhoneNr}"
|
|
325
|
-
aria-label="Phone call: ${this.contact.phone1}"
|
|
326
|
-
class="link-item"
|
|
327
|
-
>
|
|
328
|
-
<span style="margin-right: 8px;"
|
|
329
|
-
>${this.contact.phone1}</span
|
|
330
|
-
>
|
|
331
|
-
<pd-icon
|
|
332
|
-
activeIcon
|
|
333
|
-
icon="phoneIcon"
|
|
334
|
-
class="round link-icon"
|
|
335
|
-
></pd-icon>
|
|
336
|
-
</a>` : this.contact.phone1}
|
|
337
|
-
</dd>` : ""}
|
|
338
|
-
${this.contact.email ? html` <dd class="larger">
|
|
339
|
-
${this.phoneMailLink ? html` <a
|
|
340
|
-
href="mailto:${this.contact.email}"
|
|
341
|
-
aria-label="Send mail: ${this.contact.email}"
|
|
342
|
-
class="link-item"
|
|
343
|
-
>
|
|
344
|
-
<span style="margin-right: 8px;"
|
|
345
|
-
>${this.contact.email}</span
|
|
346
|
-
>
|
|
347
|
-
<pd-icon
|
|
348
|
-
activeIcon
|
|
349
|
-
icon="mailIcon"
|
|
350
|
-
class="round link-icon"
|
|
351
|
-
></pd-icon>
|
|
352
|
-
</a>` : this.contact.email}
|
|
353
|
-
</dd>` : ""}
|
|
354
|
-
${this.contact.btw ? html` <dt>BTW</dt>
|
|
355
|
-
<dd>${this.contact.btw}</dd>` : ""}
|
|
356
|
-
${this.contact.kbc ? html` <dt>Bankgegevens</dt>
|
|
357
|
-
<dd>${this.contact.kbc}</dd>
|
|
358
|
-
<dd>${this.contact.bank}</dd>` : ""}
|
|
359
|
-
</dl>
|
|
360
|
-
</address>
|
|
361
|
-
`;
|
|
362
|
-
}
|
|
363
|
-
get valid() {
|
|
364
|
-
var _a;
|
|
365
|
-
return ((_a = this._contactForm) == null ? void 0 : _a.valid) === true;
|
|
366
|
-
}
|
|
367
|
-
async triggerValidate() {
|
|
368
|
-
var _a;
|
|
369
|
-
return (_a = this._contactForm) == null ? void 0 : _a.triggerValidate();
|
|
370
|
-
}
|
|
371
|
-
getValues() {
|
|
372
|
-
var _a;
|
|
373
|
-
const contactFormValues = (_a = this._contactForm) == null ? void 0 : _a.getValues().origin;
|
|
374
|
-
console.log("VAlues:", contactFormValues);
|
|
375
|
-
const commonValues = {
|
|
376
|
-
business: this._business,
|
|
377
|
-
street: contactFormValues.street,
|
|
378
|
-
streetNr: contactFormValues.streetNr,
|
|
379
|
-
zip: contactFormValues.zip,
|
|
380
|
-
city: contactFormValues.city,
|
|
381
|
-
additionalHint: contactFormValues.additionalHint,
|
|
382
|
-
propertyDate: contactFormValues.propertyDate,
|
|
383
|
-
phone1: contactFormValues.phone1,
|
|
384
|
-
email: contactFormValues.email
|
|
385
|
-
// No input fields for following values
|
|
386
|
-
//country?: string;
|
|
387
|
-
//btw?: string;
|
|
388
|
-
//kbc?: string;
|
|
389
|
-
//bank?: string;
|
|
390
|
-
};
|
|
391
|
-
return this._business ? {
|
|
392
|
-
...commonValues,
|
|
393
|
-
companyName: contactFormValues.companyName,
|
|
394
|
-
vatNr: contactFormValues.vatNr
|
|
395
|
-
} : {
|
|
396
|
-
...commonValues,
|
|
397
|
-
firstName: contactFormValues.firstName,
|
|
398
|
-
lastName: contactFormValues.lastName
|
|
399
|
-
};
|
|
400
|
-
}
|
|
401
|
-
_switchAddressType(e) {
|
|
402
|
-
console.log("Do switch", e);
|
|
403
|
-
if (e.detail.name === "contactTypeRadioId") {
|
|
404
|
-
this._business = e.detail.value === "business";
|
|
405
|
-
}
|
|
406
|
-
e.stopPropagation();
|
|
407
|
-
}
|
|
408
|
-
_isRequired(field) {
|
|
409
|
-
return this.requiredFields.length > 0 ? this.requiredFields.includes(field) : false;
|
|
410
|
-
}
|
|
411
|
-
_showInput(field) {
|
|
412
|
-
return this.inputFields.length > 0 ? this.inputFields.includes(field) : true;
|
|
413
|
-
}
|
|
414
|
-
_setFormData() {
|
|
415
|
-
const getInput = (id) => {
|
|
416
|
-
var _a, _b;
|
|
417
|
-
return (_b = (_a = this.shadowRoot) == null ? void 0 : _a.getElementById(id)) == null ? void 0 : _b.value;
|
|
418
|
-
};
|
|
419
|
-
return {
|
|
420
|
-
business: this._business,
|
|
421
|
-
companyName: this._business ? getInput("compNameId") : void 0,
|
|
422
|
-
vatNr: this._business ? getInput("vatId") : void 0,
|
|
423
|
-
firstName: !this._business ? getInput("firstNameId") : void 0,
|
|
424
|
-
lastName: !this._business ? getInput("lastNameId") : void 0,
|
|
425
|
-
street: getInput("streetId"),
|
|
426
|
-
streetNr: getInput("streetNrId"),
|
|
427
|
-
additionalHint: getInput("additionalHintId"),
|
|
428
|
-
propertyDate: this.withPropertyDate ? getInput("propertyDateId") : void 0,
|
|
429
|
-
zip: getInput("zipId"),
|
|
430
|
-
city: getInput("cityId"),
|
|
431
|
-
phone1: getInput("phoneId"),
|
|
432
|
-
email: getInput("mailId")
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
_getFullName() {
|
|
436
|
-
var _a, _b;
|
|
437
|
-
return PdContact._getFullVal(
|
|
438
|
-
(_a = this.contact) == null ? void 0 : _a.firstName,
|
|
439
|
-
(_b = this.contact) == null ? void 0 : _b.lastName
|
|
440
|
-
);
|
|
441
|
-
}
|
|
442
|
-
_getFullStreet() {
|
|
443
|
-
var _a, _b;
|
|
444
|
-
return PdContact._getFullVal((_a = this.contact) == null ? void 0 : _a.street, (_b = this.contact) == null ? void 0 : _b.streetNr);
|
|
445
|
-
}
|
|
446
|
-
_getFullLocation() {
|
|
447
|
-
var _a, _b;
|
|
448
|
-
return PdContact._getFullVal((_a = this.contact) == null ? void 0 : _a.zip, (_b = this.contact) == null ? void 0 : _b.city);
|
|
449
|
-
}
|
|
450
|
-
static _getFullVal(val1, val2, fallback = "") {
|
|
451
|
-
return [val1, val2].filter(Boolean).join(" ") || fallback;
|
|
452
|
-
}
|
|
453
|
-
};
|
|
454
|
-
PdContact.styles = [
|
|
455
|
-
PdFontStyles,
|
|
456
|
-
PdColorStyles,
|
|
457
|
-
css`
|
|
458
|
-
:host {
|
|
459
|
-
display: block;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
.contact {
|
|
463
|
-
display: flex;
|
|
464
|
-
flex-direction: column;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
address {
|
|
468
|
-
color: var(
|
|
469
|
-
--pd-contact-address-col,
|
|
470
|
-
var(--pd-default-font-content-col)
|
|
471
|
-
);
|
|
472
|
-
line-height: 1.8;
|
|
473
|
-
font-style: normal;
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
dl {
|
|
477
|
-
margin: 0;
|
|
478
|
-
padding: 0;
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
dt {
|
|
482
|
-
font-weight: bold;
|
|
483
|
-
padding-top: 10px;
|
|
484
|
-
color: var(
|
|
485
|
-
--pd-contact-address-title-col,
|
|
486
|
-
var(--pd-default-font-title-col)
|
|
487
|
-
);
|
|
488
|
-
}
|
|
1
|
+
import { PdContact } from './pd-contact/PdContact.js';
|
|
489
2
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
padding: 0;
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
dd.larger {
|
|
498
|
-
padding-top: 3px;
|
|
499
|
-
padding-bottom: 5px;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
.contact-form {
|
|
503
|
-
--row-padding-top: 10px;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
.link-icon {
|
|
507
|
-
--pd-icon-bg-col-active: #859900;
|
|
508
|
-
--pd-icon-bg-col-hover: #859900;
|
|
509
|
-
--pd-icon-size: 14px;
|
|
510
|
-
--pd-icon-col-active: white;
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
.link-item {
|
|
514
|
-
display: flex;
|
|
515
|
-
align-items: center;
|
|
516
|
-
text-decoration: none;
|
|
517
|
-
color: var(--pd-default-font-link-col, inherit);
|
|
518
|
-
}
|
|
3
|
+
const tag = "pd-contact";
|
|
4
|
+
if (!customElements.get(tag)) {
|
|
5
|
+
customElements.define(tag, PdContact);
|
|
6
|
+
}
|
|
519
7
|
|
|
520
|
-
|
|
521
|
-
color: var(--pd-default-font-link-col-hover, #451a46);
|
|
522
|
-
}
|
|
523
|
-
`
|
|
524
|
-
];
|
|
525
|
-
__decorateClass([
|
|
526
|
-
property()
|
|
527
|
-
], PdContact.prototype, "addressTitle", 2);
|
|
528
|
-
__decorateClass([
|
|
529
|
-
property({ type: Boolean })
|
|
530
|
-
], PdContact.prototype, "phoneMailLink", 2);
|
|
531
|
-
__decorateClass([
|
|
532
|
-
property({ type: Boolean })
|
|
533
|
-
], PdContact.prototype, "summary", 2);
|
|
534
|
-
__decorateClass([
|
|
535
|
-
property({ type: Boolean })
|
|
536
|
-
], PdContact.prototype, "withPropertyDate", 2);
|
|
537
|
-
__decorateClass([
|
|
538
|
-
property({ type: Array })
|
|
539
|
-
], PdContact.prototype, "requiredFields", 2);
|
|
540
|
-
__decorateClass([
|
|
541
|
-
property({ type: Array })
|
|
542
|
-
], PdContact.prototype, "inputFields", 2);
|
|
543
|
-
__decorateClass([
|
|
544
|
-
property({ type: Object })
|
|
545
|
-
], PdContact.prototype, "contact", 2);
|
|
546
|
-
__decorateClass([
|
|
547
|
-
property({ type: Object })
|
|
548
|
-
], PdContact.prototype, "match", 2);
|
|
549
|
-
__decorateClass([
|
|
550
|
-
state()
|
|
551
|
-
], PdContact.prototype, "_business", 2);
|
|
552
|
-
__decorateClass([
|
|
553
|
-
query("#contactContainerId")
|
|
554
|
-
], PdContact.prototype, "_contactForm", 2);
|
|
555
|
-
PdContact = __decorateClass([
|
|
556
|
-
customElement("pd-contact")
|
|
557
|
-
], PdContact);
|
|
558
|
-
export {
|
|
559
|
-
PdContact
|
|
560
|
-
};
|
|
8
|
+
export { PdContact };
|
package/dist/types.js
CHANGED
|
@@ -10,17 +10,5 @@ const C_ADDITIONAL = "additionalHint";
|
|
|
10
10
|
const C_PROPERTY_DATE = "propertyDate";
|
|
11
11
|
const C_PHONE1 = "phone1";
|
|
12
12
|
const C_EMAIL = "email";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
C_BTWNR,
|
|
16
|
-
C_CITY,
|
|
17
|
-
C_COMPANY,
|
|
18
|
-
C_EMAIL,
|
|
19
|
-
C_FIRSTNAME,
|
|
20
|
-
C_LASTNAME,
|
|
21
|
-
C_PHONE1,
|
|
22
|
-
C_PROPERTY_DATE,
|
|
23
|
-
C_STREET,
|
|
24
|
-
C_TYPE,
|
|
25
|
-
C_ZIP
|
|
26
|
-
};
|
|
13
|
+
|
|
14
|
+
export { C_ADDITIONAL, C_BTWNR, C_CITY, C_COMPANY, C_EMAIL, C_FIRSTNAME, C_LASTNAME, C_PHONE1, C_PROPERTY_DATE, C_STREET, C_TYPE, C_ZIP };
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progressive-development/pd-contact",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Progressive Development Contact component",
|
|
5
5
|
"author": "PD Progressive Development",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"module": "./dist/index.js",
|
|
9
|
+
"type": "module",
|
|
9
10
|
"types": "./dist/index.d.ts",
|
|
10
11
|
"exports": {
|
|
11
12
|
".": "./dist/index.js",
|
|
@@ -20,52 +21,13 @@
|
|
|
20
21
|
"README.md",
|
|
21
22
|
"LICENSE"
|
|
22
23
|
],
|
|
23
|
-
"scripts": {
|
|
24
|
-
"analyze": "cem analyze --litelement --exclude dist,demo",
|
|
25
|
-
"start": "vite",
|
|
26
|
-
"build": "vite build",
|
|
27
|
-
"preview": "vite preview",
|
|
28
|
-
"clean": "rm -rf dist",
|
|
29
|
-
"lint": "eslint --ext .ts,.html src --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
|
|
30
|
-
"format": "eslint --ext .ts,.html src --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
|
|
31
|
-
"test": "vitest run --coverage",
|
|
32
|
-
"test:watch": "vitest --watch",
|
|
33
|
-
"check": "npm run lint && npm run build",
|
|
34
|
-
"prepublishOnly": "npm run clean && npm run check",
|
|
35
|
-
"localizeExtract": "lit-localize extract",
|
|
36
|
-
"localizeBuild": "lit-localize build",
|
|
37
|
-
"storybook": "storybook dev -p 6006",
|
|
38
|
-
"build-storybook": "storybook build"
|
|
39
|
-
},
|
|
40
24
|
"dependencies": {
|
|
25
|
+
"lit": "^3.3.1",
|
|
41
26
|
"@lit/localize": "^0.12.2",
|
|
42
|
-
"
|
|
43
|
-
"@progressive-development/pd-
|
|
44
|
-
"@progressive-development/pd-
|
|
45
|
-
"
|
|
46
|
-
},
|
|
47
|
-
"devDependencies": {
|
|
48
|
-
"@chromatic-com/storybook": "^1.9.0",
|
|
49
|
-
"@custom-elements-manifest/analyzer": "^0.4.17",
|
|
50
|
-
"@lit/localize-tools": "^0.6.10",
|
|
51
|
-
"@storybook/addon-essentials": "^8.6.14",
|
|
52
|
-
"@storybook/addon-links": "^8.6.14",
|
|
53
|
-
"@storybook/blocks": "^8.0.10",
|
|
54
|
-
"@storybook/test": "^8.6.14",
|
|
55
|
-
"@storybook/web-components": "^8.0.10",
|
|
56
|
-
"@storybook/web-components-vite": "^8.6.14",
|
|
57
|
-
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
|
58
|
-
"@typescript-eslint/parser": "^8.32.1",
|
|
59
|
-
"eslint": "^8.57.1",
|
|
60
|
-
"eslint-config-prettier": "^9.1.0",
|
|
61
|
-
"eslint-plugin-storybook": "^0.8.0",
|
|
62
|
-
"prettier": "^3.5.3",
|
|
63
|
-
"rollup-plugin-visualizer": "^5.14.0",
|
|
64
|
-
"storybook": "^8.6.14",
|
|
65
|
-
"typescript": "^5.8.3",
|
|
66
|
-
"vite": "^5.4.19",
|
|
67
|
-
"vite-plugin-dts": "^4.5.4",
|
|
68
|
-
"vitest": "^2.1.9"
|
|
27
|
+
"tslib": "^2.8.1",
|
|
28
|
+
"@progressive-development/pd-shared-styles": "0.3.0",
|
|
29
|
+
"@progressive-development/pd-icon": "0.9.2",
|
|
30
|
+
"@progressive-development/pd-forms": "0.9.2"
|
|
69
31
|
},
|
|
70
32
|
"customElements": "custom-elements.json",
|
|
71
33
|
"keywords": [
|
|
@@ -75,5 +37,23 @@
|
|
|
75
37
|
"contact",
|
|
76
38
|
"form",
|
|
77
39
|
"view"
|
|
78
|
-
]
|
|
79
|
-
|
|
40
|
+
],
|
|
41
|
+
"scripts": {
|
|
42
|
+
"analyze": "cem analyze --litelement --exclude dist,demo",
|
|
43
|
+
"start": "vite",
|
|
44
|
+
"build": "pnpm run analyze && vite build",
|
|
45
|
+
"preview": "vite preview",
|
|
46
|
+
"clean": "rm -rf dist",
|
|
47
|
+
"clean:all": "rm -rf dist node_modules pnpm-lock.yaml",
|
|
48
|
+
"lint": "eslint --ext .ts,.html src --ignore-path ../../../.eslintignore && prettier \"**/*.ts\" --check --ignore-path ../../../.eslintignore",
|
|
49
|
+
"lint:lit": "lit-analyzer",
|
|
50
|
+
"format": "eslint --ext .ts,.html src --fix --ignore-path ../../../.eslintignore && prettier \"**/*.ts\" --write --ignore-path ../../../.eslintignore",
|
|
51
|
+
"test": "vitest run --coverage",
|
|
52
|
+
"test:watch": "vitest --watch",
|
|
53
|
+
"check": "pnpm run lint && pnpm run lint:lit && pnpm run build",
|
|
54
|
+
"localizeExtract": "lit-localize extract",
|
|
55
|
+
"localizeBuild": "lit-localize build",
|
|
56
|
+
"storybook": "storybook dev -p 6006",
|
|
57
|
+
"build-storybook": "storybook build"
|
|
58
|
+
}
|
|
59
|
+
}
|
package/dist/pd-contact.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;AAS5E,OAAO,0CAA0C,CAAC;AAGlD,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,EAaL,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,SAAS,CAAC;AAmCjB,qBACa,SAAU,SAAQ,UAAU;IACvC;;OAEG;IAEH,YAAY,SAAsD;IAElE;;OAEG;IAEH,aAAa,UAAS;IAEtB;;OAEG;IAEH,OAAO,UAAS;IAEhB;;;OAGG;IAEH,gBAAgB,UAAS;IAEzB;;OAEG;IAEH,cAAc,EAAE,MAAM,EAAE,CAAM;IAE9B;;OAEG;IAEH,WAAW,EAAE,MAAM,EAAE,CAAM;IAE3B;;OAEG;IAEH,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB;;OAEG;IAEH,KAAK,CAAC,EAAE,cAAc,CAAC;IAEvB;;OAEG;IAEH,OAAO,CAAC,SAAS,CAAS;IAG1B,OAAO,CAAC,YAAY,CAAmB;IAEvC,OAAgB,MAAM,EAAE,cAAc,CAsEpC;IAEO,UAAU,CAAC,YAAY,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAMpD,MAAM;IAQf,OAAO,CAAC,kBAAkB;IAiP1B,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,kBAAkB;IAiF1B,IAAI,KAAK,YAER;IAEY,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IAIzC,SAAS,IAAI,aAAa;IAiCjC,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,YAAY;IAsBpB,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,MAAM,CAAC,WAAW;CAG3B"}
|