@progressive-development/pd-contact 1.0.2 → 1.0.4
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 +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/pd-bg-image-form/PdBgImageForm.d.ts +65 -0
- package/dist/pd-bg-image-form/PdBgImageForm.d.ts.map +1 -0
- package/dist/pd-bg-image-form/PdBgImageForm.js +394 -0
- package/dist/pd-bg-image-form/pd-bg-image-form.d.ts +4 -0
- package/dist/pd-bg-image-form/pd-bg-image-form.d.ts.map +1 -0
- package/dist/pd-bg-image-form.d.ts +2 -0
- package/dist/pd-bg-image-form.js +8 -0
- package/dist/pd-bg-select-form/PdBgSelectForm.d.ts +73 -0
- package/dist/pd-bg-select-form/PdBgSelectForm.d.ts.map +1 -0
- package/dist/pd-bg-select-form/PdBgSelectForm.js +338 -0
- package/dist/pd-bg-select-form/pd-bg-select-form.d.ts +4 -0
- package/dist/pd-bg-select-form/pd-bg-select-form.d.ts.map +1 -0
- package/dist/pd-bg-select-form.d.ts +2 -0
- package/dist/pd-bg-select-form.js +8 -0
- package/dist/pd-contact/PdContact.d.ts +7 -0
- package/dist/pd-contact/PdContact.d.ts.map +1 -1
- package/dist/pd-contact/PdContact.js +45 -8
- package/dist/pd-gradient-form/PdGradientForm.d.ts +49 -0
- package/dist/pd-gradient-form/PdGradientForm.d.ts.map +1 -0
- package/dist/pd-gradient-form/PdGradientForm.js +259 -0
- package/dist/pd-gradient-form/pd-gradient-form.d.ts +4 -0
- package/dist/pd-gradient-form/pd-gradient-form.d.ts.map +1 -0
- package/dist/pd-gradient-form.d.ts +2 -0
- package/dist/pd-gradient-form.js +8 -0
- package/dist/types.js +3 -1
- package/package.json +6 -3
- package/dist/pd-contact/pd-contact-edit.stories.d.ts +0 -53
- package/dist/pd-contact/pd-contact-edit.stories.d.ts.map +0 -1
- package/dist/pd-contact/pd-contact-view.stories.d.ts +0 -55
- package/dist/pd-contact/pd-contact-view.stories.d.ts.map +0 -1
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { css, nothing, html } from 'lit';
|
|
2
|
+
import { property, state } from 'lit/decorators.js';
|
|
3
|
+
import { PdBaseUIInput } from '@progressive-development/pd-forms';
|
|
4
|
+
import '@progressive-development/pd-forms/pd-form-row';
|
|
5
|
+
import '@progressive-development/pd-forms/pd-radio-group';
|
|
6
|
+
import '@progressive-development/pd-forms/pd-checkbox';
|
|
7
|
+
import '@progressive-development/pd-forms/pd-color-picker';
|
|
8
|
+
import '../pd-gradient-form.js';
|
|
9
|
+
import '../pd-bg-image-form.js';
|
|
10
|
+
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
13
|
+
var result = void 0 ;
|
|
14
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
15
|
+
if (decorator = decorators[i])
|
|
16
|
+
result = (decorator(target, key, result) ) || result;
|
|
17
|
+
if (result) __defProp(target, key, result);
|
|
18
|
+
return result;
|
|
19
|
+
};
|
|
20
|
+
const DEFAULT_MODE = "color";
|
|
21
|
+
const DEFAULT_COLOR = "#333333";
|
|
22
|
+
const DEFAULT_GRADIENT_ANGLE = 135;
|
|
23
|
+
class PdBgSelectForm extends PdBaseUIInput {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments);
|
|
26
|
+
this.colorLabel = "Hintergrundfarbe";
|
|
27
|
+
this.defaultColor = DEFAULT_COLOR;
|
|
28
|
+
this.hidePreview = false;
|
|
29
|
+
this.showBgSize = false;
|
|
30
|
+
this.showBgRepeat = false;
|
|
31
|
+
this.hideTextShadow = false;
|
|
32
|
+
this._mode = DEFAULT_MODE;
|
|
33
|
+
/** Stable init value for radio — only changes on restore, not on user clicks. */
|
|
34
|
+
this._modeInit = DEFAULT_MODE;
|
|
35
|
+
this._color = DEFAULT_COLOR;
|
|
36
|
+
this._gradientColor1 = "";
|
|
37
|
+
this._gradientColor2 = "";
|
|
38
|
+
this._gradientAngle = DEFAULT_GRADIENT_ANGLE;
|
|
39
|
+
this._gradientStop1 = 0;
|
|
40
|
+
this._gradientStop2 = 100;
|
|
41
|
+
this._bgImage = "";
|
|
42
|
+
this._overlayColor = "#000000";
|
|
43
|
+
this._overlayOpacity = 0;
|
|
44
|
+
this._textShadow = false;
|
|
45
|
+
this._bgSize = "cover";
|
|
46
|
+
this._bgRepeat = "no-repeat";
|
|
47
|
+
}
|
|
48
|
+
static {
|
|
49
|
+
this.styles = [
|
|
50
|
+
PdBaseUIInput.styles,
|
|
51
|
+
css`
|
|
52
|
+
:host {
|
|
53
|
+
display: block;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.form-fields {
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
gap: var(--pd-form-container-row-gap, var(--pd-spacing-md));
|
|
60
|
+
}
|
|
61
|
+
`
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
// ── Lifecycle ──────────────────────────────────────────────────────────────
|
|
65
|
+
update(changedProps) {
|
|
66
|
+
if (changedProps.has("initValue") && this.initValue) {
|
|
67
|
+
this._applyInitValue(this.initValue);
|
|
68
|
+
if (this.handleChangeForInitVal) {
|
|
69
|
+
this._handleChangedValue(this.initValue, void 0, true);
|
|
70
|
+
} else {
|
|
71
|
+
this._value = this.initValue;
|
|
72
|
+
}
|
|
73
|
+
changedProps.delete("initValue");
|
|
74
|
+
}
|
|
75
|
+
super.update(changedProps);
|
|
76
|
+
}
|
|
77
|
+
// ── Rendering ──────────────────────────────────────────────────────────────
|
|
78
|
+
render() {
|
|
79
|
+
const inputId = `${this.id}BgSelectForm`;
|
|
80
|
+
const errorId = `${this.id}Error`;
|
|
81
|
+
return html`
|
|
82
|
+
${this._renderLabel(inputId)}
|
|
83
|
+
|
|
84
|
+
<div class="form-fields">
|
|
85
|
+
<pd-form-row>
|
|
86
|
+
<pd-radio-group
|
|
87
|
+
label="Hintergrund-Typ"
|
|
88
|
+
valueName="bgMode"
|
|
89
|
+
@pd-form-element-change="${this._onModeChange}"
|
|
90
|
+
@pd-form-element-register="${this._innerStop}"
|
|
91
|
+
@validate-form="${this._innerStop}"
|
|
92
|
+
@field-change="${this._innerStop}"
|
|
93
|
+
>
|
|
94
|
+
<pd-checkbox
|
|
95
|
+
checkType="RADIO"
|
|
96
|
+
valueName="color"
|
|
97
|
+
initValue="${this._modeInit === "color"}"
|
|
98
|
+
>Farbe</pd-checkbox
|
|
99
|
+
>
|
|
100
|
+
<pd-checkbox
|
|
101
|
+
checkType="RADIO"
|
|
102
|
+
valueName="gradient"
|
|
103
|
+
initValue="${this._modeInit === "gradient"}"
|
|
104
|
+
>Gradient</pd-checkbox
|
|
105
|
+
>
|
|
106
|
+
<pd-checkbox
|
|
107
|
+
checkType="RADIO"
|
|
108
|
+
valueName="image"
|
|
109
|
+
initValue="${this._modeInit === "image"}"
|
|
110
|
+
>Bild</pd-checkbox
|
|
111
|
+
>
|
|
112
|
+
</pd-radio-group>
|
|
113
|
+
</pd-form-row>
|
|
114
|
+
|
|
115
|
+
${this._mode === "color" ? html`
|
|
116
|
+
<pd-form-row>
|
|
117
|
+
<pd-color-picker
|
|
118
|
+
span="half"
|
|
119
|
+
label="${this.colorLabel}"
|
|
120
|
+
.initValue="${this._color}"
|
|
121
|
+
.handleChangeForInitVal="${true}"
|
|
122
|
+
?disabled="${this.disabled}"
|
|
123
|
+
@pd-form-element-change="${this._onColorChange}"
|
|
124
|
+
@pd-form-element-register="${this._innerStop}"
|
|
125
|
+
@validate-form="${this._innerStop}"
|
|
126
|
+
@field-change="${this._innerStop}"
|
|
127
|
+
></pd-color-picker>
|
|
128
|
+
</pd-form-row>
|
|
129
|
+
` : nothing}
|
|
130
|
+
${this._mode === "gradient" ? html`
|
|
131
|
+
<pd-gradient-form
|
|
132
|
+
?hide-preview="${this.hidePreview}"
|
|
133
|
+
label="Gradient"
|
|
134
|
+
valueName="gradient"
|
|
135
|
+
.initValue="${this._gradientInitValue}"
|
|
136
|
+
.handleChangeForInitVal="${true}"
|
|
137
|
+
?disabled="${this.disabled}"
|
|
138
|
+
@pd-form-element-change="${this._onGradientChange}"
|
|
139
|
+
@pd-form-element-register="${this._innerStop}"
|
|
140
|
+
@validate-form="${this._innerStop}"
|
|
141
|
+
@field-change="${this._innerStop}"
|
|
142
|
+
></pd-gradient-form>
|
|
143
|
+
` : nothing}
|
|
144
|
+
${this._mode === "image" ? html`
|
|
145
|
+
<pd-bg-image-form
|
|
146
|
+
?hide-preview="${this.hidePreview}"
|
|
147
|
+
?show-bg-size="${this.showBgSize}"
|
|
148
|
+
?show-bg-repeat="${this.showBgRepeat}"
|
|
149
|
+
?hide-text-shadow="${this.hideTextShadow}"
|
|
150
|
+
label="Hintergrundbild"
|
|
151
|
+
valueName="bgImage"
|
|
152
|
+
.initValue="${this._bgImageInitValue}"
|
|
153
|
+
.handleChangeForInitVal="${true}"
|
|
154
|
+
?disabled="${this.disabled}"
|
|
155
|
+
@pd-form-element-change="${this._onBgImageChange}"
|
|
156
|
+
@pd-form-element-register="${this._innerStop}"
|
|
157
|
+
@validate-form="${this._innerStop}"
|
|
158
|
+
@field-change="${this._innerStop}"
|
|
159
|
+
></pd-bg-image-form>
|
|
160
|
+
` : nothing}
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
${this._renderErrorMsg(errorId)}
|
|
164
|
+
`;
|
|
165
|
+
}
|
|
166
|
+
// ── Value Parsing ──────────────────────────────────────────────────────────
|
|
167
|
+
_applyInitValue(raw) {
|
|
168
|
+
try {
|
|
169
|
+
const parsed = JSON.parse(raw);
|
|
170
|
+
this._mode = parsed.mode || DEFAULT_MODE;
|
|
171
|
+
this._modeInit = this._mode;
|
|
172
|
+
this._color = parsed.color || this.defaultColor;
|
|
173
|
+
this._gradientColor1 = parsed.gradientColor1 ?? "";
|
|
174
|
+
this._gradientColor2 = parsed.gradientColor2 ?? "";
|
|
175
|
+
this._gradientAngle = parsed.gradientAngle ?? DEFAULT_GRADIENT_ANGLE;
|
|
176
|
+
this._gradientStop1 = parsed.gradientStop1 ?? 0;
|
|
177
|
+
this._gradientStop2 = parsed.gradientStop2 ?? 100;
|
|
178
|
+
this._bgImage = parsed.bgImage ?? "";
|
|
179
|
+
this._overlayColor = parsed.overlayColor ?? "#000000";
|
|
180
|
+
this._overlayOpacity = parsed.overlayOpacity ?? 0;
|
|
181
|
+
this._textShadow = parsed.textShadow ?? false;
|
|
182
|
+
this._bgSize = parsed.bgSize ?? "cover";
|
|
183
|
+
this._bgRepeat = parsed.bgRepeat ?? "no-repeat";
|
|
184
|
+
} catch {
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
get _gradientInitValue() {
|
|
188
|
+
return JSON.stringify({
|
|
189
|
+
color1: this._gradientColor1 || this._color || "#333",
|
|
190
|
+
color2: this._gradientColor2 || "#666",
|
|
191
|
+
angle: this._gradientAngle,
|
|
192
|
+
stop1: this._gradientStop1,
|
|
193
|
+
stop2: this._gradientStop2
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
get _bgImageInitValue() {
|
|
197
|
+
return JSON.stringify({
|
|
198
|
+
image: this._bgImage,
|
|
199
|
+
overlayColor: this._overlayColor,
|
|
200
|
+
overlayOpacity: this._overlayOpacity,
|
|
201
|
+
textShadow: this._textShadow,
|
|
202
|
+
bgSize: this._bgSize,
|
|
203
|
+
bgRepeat: this._bgRepeat
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
_getParsedValue() {
|
|
207
|
+
return this._buildValue();
|
|
208
|
+
}
|
|
209
|
+
_buildValue() {
|
|
210
|
+
const val = { mode: this._mode };
|
|
211
|
+
if (this._mode === "color") {
|
|
212
|
+
val.color = this._color;
|
|
213
|
+
}
|
|
214
|
+
if (this._mode === "gradient") {
|
|
215
|
+
val.gradientColor1 = this._gradientColor1;
|
|
216
|
+
val.gradientColor2 = this._gradientColor2;
|
|
217
|
+
val.gradientAngle = this._gradientAngle;
|
|
218
|
+
val.gradientStop1 = this._gradientStop1;
|
|
219
|
+
val.gradientStop2 = this._gradientStop2;
|
|
220
|
+
}
|
|
221
|
+
if (this._mode === "image") {
|
|
222
|
+
val.bgImage = this._bgImage;
|
|
223
|
+
val.overlayColor = this._overlayColor;
|
|
224
|
+
val.overlayOpacity = this._overlayOpacity;
|
|
225
|
+
val.textShadow = this._textShadow;
|
|
226
|
+
val.bgSize = this._bgSize;
|
|
227
|
+
val.bgRepeat = this._bgRepeat;
|
|
228
|
+
}
|
|
229
|
+
return val;
|
|
230
|
+
}
|
|
231
|
+
// ── Inner Element Events ───────────────────────────────────────────────────
|
|
232
|
+
_innerStop(e) {
|
|
233
|
+
e.stopPropagation();
|
|
234
|
+
}
|
|
235
|
+
_onModeChange(e) {
|
|
236
|
+
e.stopPropagation();
|
|
237
|
+
const v = e.detail?.value;
|
|
238
|
+
if (v === "color" || v === "gradient" || v === "image") {
|
|
239
|
+
this._mode = v;
|
|
240
|
+
this._emitValue();
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
_onColorChange(e) {
|
|
244
|
+
e.stopPropagation();
|
|
245
|
+
this._color = e.detail?.value ?? this._color;
|
|
246
|
+
this._emitValue();
|
|
247
|
+
}
|
|
248
|
+
_onGradientChange(e) {
|
|
249
|
+
e.stopPropagation();
|
|
250
|
+
try {
|
|
251
|
+
const val = JSON.parse(e.detail?.value ?? "{}");
|
|
252
|
+
this._gradientColor1 = val.color1 ?? "";
|
|
253
|
+
this._gradientColor2 = val.color2 ?? "";
|
|
254
|
+
this._gradientAngle = val.angle ?? DEFAULT_GRADIENT_ANGLE;
|
|
255
|
+
this._gradientStop1 = val.stop1 ?? 0;
|
|
256
|
+
this._gradientStop2 = val.stop2 ?? 100;
|
|
257
|
+
} catch {
|
|
258
|
+
}
|
|
259
|
+
this._emitValue();
|
|
260
|
+
}
|
|
261
|
+
_onBgImageChange(e) {
|
|
262
|
+
e.stopPropagation();
|
|
263
|
+
try {
|
|
264
|
+
const val = JSON.parse(e.detail?.value ?? "{}");
|
|
265
|
+
this._bgImage = val.image ?? "";
|
|
266
|
+
this._overlayColor = val.overlayColor ?? "#000000";
|
|
267
|
+
this._overlayOpacity = val.overlayOpacity ?? 0;
|
|
268
|
+
this._textShadow = val.textShadow ?? false;
|
|
269
|
+
this._bgSize = val.bgSize ?? "cover";
|
|
270
|
+
this._bgRepeat = val.bgRepeat ?? "no-repeat";
|
|
271
|
+
} catch {
|
|
272
|
+
}
|
|
273
|
+
this._emitValue();
|
|
274
|
+
}
|
|
275
|
+
_emitValue() {
|
|
276
|
+
const val = this._buildValue();
|
|
277
|
+
this._handleChangedValue(JSON.stringify(val), void 0, true);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
__decorateClass([
|
|
281
|
+
property({ type: String })
|
|
282
|
+
], PdBgSelectForm.prototype, "colorLabel");
|
|
283
|
+
__decorateClass([
|
|
284
|
+
property({ type: String })
|
|
285
|
+
], PdBgSelectForm.prototype, "defaultColor");
|
|
286
|
+
__decorateClass([
|
|
287
|
+
property({ type: Boolean, attribute: "hide-preview" })
|
|
288
|
+
], PdBgSelectForm.prototype, "hidePreview");
|
|
289
|
+
__decorateClass([
|
|
290
|
+
property({ type: Boolean, attribute: "show-bg-size" })
|
|
291
|
+
], PdBgSelectForm.prototype, "showBgSize");
|
|
292
|
+
__decorateClass([
|
|
293
|
+
property({ type: Boolean, attribute: "show-bg-repeat" })
|
|
294
|
+
], PdBgSelectForm.prototype, "showBgRepeat");
|
|
295
|
+
__decorateClass([
|
|
296
|
+
property({ type: Boolean, attribute: "hide-text-shadow" })
|
|
297
|
+
], PdBgSelectForm.prototype, "hideTextShadow");
|
|
298
|
+
__decorateClass([
|
|
299
|
+
state()
|
|
300
|
+
], PdBgSelectForm.prototype, "_mode");
|
|
301
|
+
__decorateClass([
|
|
302
|
+
state()
|
|
303
|
+
], PdBgSelectForm.prototype, "_color");
|
|
304
|
+
__decorateClass([
|
|
305
|
+
state()
|
|
306
|
+
], PdBgSelectForm.prototype, "_gradientColor1");
|
|
307
|
+
__decorateClass([
|
|
308
|
+
state()
|
|
309
|
+
], PdBgSelectForm.prototype, "_gradientColor2");
|
|
310
|
+
__decorateClass([
|
|
311
|
+
state()
|
|
312
|
+
], PdBgSelectForm.prototype, "_gradientAngle");
|
|
313
|
+
__decorateClass([
|
|
314
|
+
state()
|
|
315
|
+
], PdBgSelectForm.prototype, "_gradientStop1");
|
|
316
|
+
__decorateClass([
|
|
317
|
+
state()
|
|
318
|
+
], PdBgSelectForm.prototype, "_gradientStop2");
|
|
319
|
+
__decorateClass([
|
|
320
|
+
state()
|
|
321
|
+
], PdBgSelectForm.prototype, "_bgImage");
|
|
322
|
+
__decorateClass([
|
|
323
|
+
state()
|
|
324
|
+
], PdBgSelectForm.prototype, "_overlayColor");
|
|
325
|
+
__decorateClass([
|
|
326
|
+
state()
|
|
327
|
+
], PdBgSelectForm.prototype, "_overlayOpacity");
|
|
328
|
+
__decorateClass([
|
|
329
|
+
state()
|
|
330
|
+
], PdBgSelectForm.prototype, "_textShadow");
|
|
331
|
+
__decorateClass([
|
|
332
|
+
state()
|
|
333
|
+
], PdBgSelectForm.prototype, "_bgSize");
|
|
334
|
+
__decorateClass([
|
|
335
|
+
state()
|
|
336
|
+
], PdBgSelectForm.prototype, "_bgRepeat");
|
|
337
|
+
|
|
338
|
+
export { PdBgSelectForm };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pd-bg-select-form.d.ts","sourceRoot":"","sources":["../../src/pd-bg-select-form/pd-bg-select-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAOrD,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -38,6 +38,8 @@ export declare class PdContact extends LitElement {
|
|
|
38
38
|
requiredFields: string[];
|
|
39
39
|
/** List of fields to be rendered (empty = all fields). */
|
|
40
40
|
inputFields: string[];
|
|
41
|
+
/** Show 'required fields' info hint below the form. */
|
|
42
|
+
requiredFieldInfo: boolean;
|
|
41
43
|
/** Contact data object to show or edit. */
|
|
42
44
|
contact?: PdContactData;
|
|
43
45
|
/** Optional location match data for auto-fill. */
|
|
@@ -47,7 +49,11 @@ export declare class PdContact extends LitElement {
|
|
|
47
49
|
* @ignore */
|
|
48
50
|
private _business;
|
|
49
51
|
/** @ignore */
|
|
52
|
+
private _socialMediaItems;
|
|
53
|
+
/** @ignore */
|
|
50
54
|
private _contactForm;
|
|
55
|
+
/** @ignore */
|
|
56
|
+
private _socialMediaEl?;
|
|
51
57
|
static styles: CSSResultGroup;
|
|
52
58
|
willUpdate(changedProps: PropertyValues<this>): void;
|
|
53
59
|
render(): import('lit').TemplateResult<1>;
|
|
@@ -67,6 +73,7 @@ export declare class PdContact extends LitElement {
|
|
|
67
73
|
triggerValidate(): Promise<boolean>;
|
|
68
74
|
getValues(): PdContactData;
|
|
69
75
|
private _switchAddressType;
|
|
76
|
+
private _onSocialMediaChange;
|
|
70
77
|
private _isRequired;
|
|
71
78
|
private _showInput;
|
|
72
79
|
private _setFormData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PdContact.d.ts","sourceRoot":"","sources":["../../src/pd-contact/PdContact.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAK5E,OAAO,0CAA0C,CAAC;AAClD,OAAO,iDAAiD,CAAC;AAGzD,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,
|
|
1
|
+
{"version":3,"file":"PdContact.d.ts","sourceRoot":"","sources":["../../src/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CAAC,YAAY,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAOpD,MAAM;IAYf,OAAO,CAAC,kBAAkB;IAmQ1B,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,kBAAkB;IAgI1B,OAAO,CAAC,eAAe;IAoBvB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,gBAAgB;IAYxB,OAAO,CAAC,sBAAsB;IAoD9B,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,sBAAsB;IAS9B,OAAO,CAAC,mBAAmB;IAQ3B,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,qBAAqB;IAQ7B,IAAI,KAAK,YAER;IAEY,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IAIzC,SAAS,IAAI,aAAa;IAgCjC,OAAO,CAAC,kBAAkB;IAO1B,OAAO,CAAC,oBAAoB;IAK5B,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"}
|
|
@@ -9,7 +9,7 @@ import '@progressive-development/pd-forms/pd-form-row';
|
|
|
9
9
|
import '@progressive-development/pd-forms/pd-input';
|
|
10
10
|
import '@progressive-development/pd-forms/pd-select';
|
|
11
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';
|
|
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, C_WEBSITE, C_SOCIAL_MEDIA } from '../types.js';
|
|
13
13
|
|
|
14
14
|
var __defProp = Object.defineProperty;
|
|
15
15
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -65,7 +65,9 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
65
65
|
this.withPropertyDate = false;
|
|
66
66
|
this.requiredFields = [];
|
|
67
67
|
this.inputFields = [];
|
|
68
|
+
this.requiredFieldInfo = true;
|
|
68
69
|
this._business = false;
|
|
70
|
+
this._socialMediaItems = [];
|
|
69
71
|
}
|
|
70
72
|
static {
|
|
71
73
|
this.styles = [
|
|
@@ -464,6 +466,7 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
464
466
|
willUpdate(changedProps) {
|
|
465
467
|
if (changedProps.has("contact") && this.contact) {
|
|
466
468
|
this._business = this.contact.business ?? false;
|
|
469
|
+
this._socialMediaItems = this.contact.socialMedia ?? [];
|
|
467
470
|
}
|
|
468
471
|
}
|
|
469
472
|
render() {
|
|
@@ -475,7 +478,11 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
475
478
|
}
|
|
476
479
|
_renderEditContact() {
|
|
477
480
|
return html`
|
|
478
|
-
<pd-form-container
|
|
481
|
+
<pd-form-container
|
|
482
|
+
id="contactContainerId"
|
|
483
|
+
?requiredFieldInfo="${this.requiredFieldInfo}"
|
|
484
|
+
autoTrimm
|
|
485
|
+
>
|
|
479
486
|
${this.inputFields.length === 0 || this._showInput(C_TYPE) ? html`
|
|
480
487
|
<pd-form-row>
|
|
481
488
|
<pd-radio-group
|
|
@@ -673,6 +680,25 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
673
680
|
></pd-input>
|
|
674
681
|
</pd-form-row>
|
|
675
682
|
` : ""}
|
|
683
|
+
${this._showInput(C_WEBSITE) ? html`
|
|
684
|
+
<pd-form-row class="contact-form">
|
|
685
|
+
<pd-input
|
|
686
|
+
id="websiteId"
|
|
687
|
+
label="${msg("Website", { id: "pd.contact.label.website" })}"
|
|
688
|
+
fieldType="url"
|
|
689
|
+
valueName="website"
|
|
690
|
+
initValue="${this.contact?.website || ""}"
|
|
691
|
+
autoCompleteName="url"
|
|
692
|
+
?required="${this._isRequired(C_WEBSITE)}"
|
|
693
|
+
></pd-input>
|
|
694
|
+
</pd-form-row>
|
|
695
|
+
` : ""}
|
|
696
|
+
${this._showInput(C_SOCIAL_MEDIA) ? html`
|
|
697
|
+
<pd-socialmedia
|
|
698
|
+
.initItems="${this._socialMediaItems}"
|
|
699
|
+
@items-change="${this._onSocialMediaChange}"
|
|
700
|
+
></pd-socialmedia>
|
|
701
|
+
` : ""}
|
|
676
702
|
</pd-form-container>
|
|
677
703
|
`;
|
|
678
704
|
}
|
|
@@ -883,6 +909,7 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
883
909
|
}
|
|
884
910
|
getValues() {
|
|
885
911
|
const contactFormValues = this._contactForm?.getValues().origin;
|
|
912
|
+
const socialItems = this._socialMediaEl?.value ?? this._socialMediaItems;
|
|
886
913
|
const commonValues = {
|
|
887
914
|
business: this._business,
|
|
888
915
|
street: contactFormValues.street,
|
|
@@ -892,12 +919,9 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
892
919
|
additionalHint: contactFormValues.additionalHint,
|
|
893
920
|
propertyDate: contactFormValues.propertyDate,
|
|
894
921
|
phone1: contactFormValues.phone1,
|
|
895
|
-
email: contactFormValues.email
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
//btw?: string;
|
|
899
|
-
//kbc?: string;
|
|
900
|
-
//bank?: string;
|
|
922
|
+
email: contactFormValues.email,
|
|
923
|
+
...contactFormValues.website ? { website: contactFormValues.website } : {},
|
|
924
|
+
...socialItems.length ? { socialMedia: socialItems } : {}
|
|
901
925
|
};
|
|
902
926
|
return this._business ? {
|
|
903
927
|
...commonValues,
|
|
@@ -915,6 +939,10 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
915
939
|
}
|
|
916
940
|
e.stopPropagation();
|
|
917
941
|
}
|
|
942
|
+
_onSocialMediaChange(e) {
|
|
943
|
+
this._socialMediaItems = e.detail?.items ?? [];
|
|
944
|
+
e.stopPropagation();
|
|
945
|
+
}
|
|
918
946
|
_isRequired(field) {
|
|
919
947
|
return this.requiredFields.length > 0 ? this.requiredFields.includes(field) : false;
|
|
920
948
|
}
|
|
@@ -979,6 +1007,9 @@ __decorateClass([
|
|
|
979
1007
|
__decorateClass([
|
|
980
1008
|
property({ type: Array })
|
|
981
1009
|
], _PdContact.prototype, "inputFields");
|
|
1010
|
+
__decorateClass([
|
|
1011
|
+
property({ type: Boolean })
|
|
1012
|
+
], _PdContact.prototype, "requiredFieldInfo");
|
|
982
1013
|
__decorateClass([
|
|
983
1014
|
property({ type: Object })
|
|
984
1015
|
], _PdContact.prototype, "contact");
|
|
@@ -988,9 +1019,15 @@ __decorateClass([
|
|
|
988
1019
|
__decorateClass([
|
|
989
1020
|
state()
|
|
990
1021
|
], _PdContact.prototype, "_business");
|
|
1022
|
+
__decorateClass([
|
|
1023
|
+
state()
|
|
1024
|
+
], _PdContact.prototype, "_socialMediaItems");
|
|
991
1025
|
__decorateClass([
|
|
992
1026
|
query("#contactContainerId")
|
|
993
1027
|
], _PdContact.prototype, "_contactForm");
|
|
1028
|
+
__decorateClass([
|
|
1029
|
+
query("pd-socialmedia")
|
|
1030
|
+
], _PdContact.prototype, "_socialMediaEl");
|
|
994
1031
|
let PdContact = _PdContact;
|
|
995
1032
|
|
|
996
1033
|
export { PdContact };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { CSSResultGroup, PropertyValues } from 'lit';
|
|
2
|
+
import { PdBaseUIInput } from '@progressive-development/pd-forms';
|
|
3
|
+
export interface GradientValue {
|
|
4
|
+
color1: string;
|
|
5
|
+
color2: string;
|
|
6
|
+
angle: number;
|
|
7
|
+
stop1: number;
|
|
8
|
+
stop2: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Gradient configuration form combining two color pickers and an angle slider.
|
|
12
|
+
*
|
|
13
|
+
* Value format: JSON string `{"color1":"#hex","color2":"#hex","angle":135}`
|
|
14
|
+
*
|
|
15
|
+
* @tagname pd-gradient-form
|
|
16
|
+
* @summary Gradient form with two color pickers, angle slider, and live preview.
|
|
17
|
+
*
|
|
18
|
+
* @event pd-form-element-change - Fired when any gradient value changes. Detail: `{ value, name, parsedValue, state }`.
|
|
19
|
+
*/
|
|
20
|
+
export declare class PdGradientForm extends PdBaseUIInput {
|
|
21
|
+
/** Label for the first color picker. */
|
|
22
|
+
color1Label: string;
|
|
23
|
+
/** Label for the second color picker. */
|
|
24
|
+
color2Label: string;
|
|
25
|
+
/** Label for the angle slider. */
|
|
26
|
+
angleLabel: string;
|
|
27
|
+
/** Default angle when no value is set. */
|
|
28
|
+
defaultAngle: number;
|
|
29
|
+
/** Hide the live gradient preview strip. */
|
|
30
|
+
hidePreview: boolean;
|
|
31
|
+
private _color1;
|
|
32
|
+
private _color2;
|
|
33
|
+
private _angle;
|
|
34
|
+
private _stop1;
|
|
35
|
+
private _stop2;
|
|
36
|
+
static styles: CSSResultGroup;
|
|
37
|
+
update(changedProps: PropertyValues<this>): void;
|
|
38
|
+
render(): import('lit').TemplateResult<1>;
|
|
39
|
+
private _applyInitValue;
|
|
40
|
+
protected _getParsedValue(): GradientValue;
|
|
41
|
+
private _innerStop;
|
|
42
|
+
private _onColor1Change;
|
|
43
|
+
private _onColor2Change;
|
|
44
|
+
private _onStop1Change;
|
|
45
|
+
private _onStop2Change;
|
|
46
|
+
private _onAngleChange;
|
|
47
|
+
private _emitGradientValue;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=PdGradientForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PdGradientForm.d.ts","sourceRoot":"","sources":["../../src/pd-gradient-form/PdGradientForm.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAsB,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAI9E,OAAO,EAAE,aAAa,EAAE,MAA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