@postnord/pn-marketweb-components 2.4.26 → 2.4.28

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 (65) hide show
  1. package/cjs/index-4199ff85.js +16 -4
  2. package/cjs/loader.cjs.js +1 -1
  3. package/cjs/pn-dropdown-with-multi-input-rows-row.cjs.entry.js +183 -0
  4. package/cjs/pn-dropdown-with-multi-input-rows.cjs.entry.js +309 -0
  5. package/cjs/pn-market-web-components.cjs.js +1 -1
  6. package/cjs/pn-marketweb-siteheader.cjs.entry.js +1 -1
  7. package/cjs/pn-multiple-input.cjs.entry.js +105 -0
  8. package/collection/collection-manifest.json +3 -0
  9. package/collection/components/input/pn-dropdown-with-multi-input-rows/pn-dropdown-with-multi-input-rows-row.css +27 -0
  10. package/collection/components/input/pn-dropdown-with-multi-input-rows/pn-dropdown-with-multi-input-rows-row.js +673 -0
  11. package/collection/components/input/pn-dropdown-with-multi-input-rows/pn-dropdown-with-multi-input-rows.css +26 -0
  12. package/collection/components/input/pn-dropdown-with-multi-input-rows/pn-dropdown-with-multi-input-rows.js +970 -0
  13. package/collection/components/input/pn-dropdown-with-multi-input-rows/pn-dropdown-with-multi-input-rows.stories.js +86 -0
  14. package/collection/components/input/pn-dropdown-with-multi-input-rows/types.js +1 -0
  15. package/collection/components/input/pn-multiple-input/pn-multiple-input.css +16 -0
  16. package/collection/components/input/pn-multiple-input/pn-multiple-input.js +185 -0
  17. package/collection/components/input/pn-multiple-input/pn-multiple-input.stories.js +24 -0
  18. package/collection/components/input/pn-multiple-input/types.js +1 -0
  19. package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.js +4 -3
  20. package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.stories.js +1 -1
  21. package/components/index.d.ts +3 -0
  22. package/components/index.js +3 -0
  23. package/components/pn-dropdown-with-multi-input-rows-row.d.ts +11 -0
  24. package/components/pn-dropdown-with-multi-input-rows-row.js +6 -0
  25. package/components/pn-dropdown-with-multi-input-rows-row2.js +232 -0
  26. package/components/pn-dropdown-with-multi-input-rows.d.ts +11 -0
  27. package/components/pn-dropdown-with-multi-input-rows.js +379 -0
  28. package/components/pn-marketweb-siteheader.js +1 -1
  29. package/components/pn-multiple-input.d.ts +11 -0
  30. package/components/pn-multiple-input.js +130 -0
  31. package/esm/index-ee44c065.js +16 -4
  32. package/esm/loader.js +1 -1
  33. package/esm/pn-dropdown-with-multi-input-rows-row.entry.js +179 -0
  34. package/esm/pn-dropdown-with-multi-input-rows.entry.js +305 -0
  35. package/esm/pn-market-web-components.js +1 -1
  36. package/esm/pn-marketweb-siteheader.entry.js +1 -1
  37. package/esm/pn-multiple-input.entry.js +101 -0
  38. package/esm-es5/index-ee44c065.js +1 -1
  39. package/esm-es5/loader.js +1 -1
  40. package/esm-es5/pn-dropdown-with-multi-input-rows-row.entry.js +1 -0
  41. package/esm-es5/pn-dropdown-with-multi-input-rows.entry.js +1 -0
  42. package/esm-es5/pn-market-web-components.js +1 -1
  43. package/esm-es5/pn-marketweb-siteheader.entry.js +1 -1
  44. package/esm-es5/pn-multiple-input.entry.js +1 -0
  45. package/package.json +1 -1
  46. package/pn-market-web-components/{p-5d0e8295.system.entry.js → p-0ee378ea.system.entry.js} +1 -1
  47. package/pn-market-web-components/p-313658e7.entry.js +1 -0
  48. package/pn-market-web-components/p-47239bce.system.entry.js +1 -0
  49. package/pn-market-web-components/p-52e8d0ec.system.entry.js +1 -0
  50. package/pn-market-web-components/p-7787ca3b.entry.js +1 -0
  51. package/pn-market-web-components/p-a953d346.entry.js +1 -0
  52. package/pn-market-web-components/p-ad952e14.system.entry.js +1 -0
  53. package/pn-market-web-components/p-e05b6e0c.entry.js +1 -0
  54. package/pn-market-web-components/p-fcdb7381.system.js +1 -1
  55. package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
  56. package/types/components/input/pn-dropdown-with-multi-input-rows/pn-dropdown-with-multi-input-rows-row.d.ts +59 -0
  57. package/types/components/input/pn-dropdown-with-multi-input-rows/pn-dropdown-with-multi-input-rows.d.ts +77 -0
  58. package/types/components/input/pn-dropdown-with-multi-input-rows/types.d.ts +18 -0
  59. package/types/components/input/pn-multiple-input/pn-multiple-input.d.ts +22 -0
  60. package/types/components/input/pn-multiple-input/types.d.ts +11 -0
  61. package/types/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.d.ts +1 -1
  62. package/types/components.d.ts +181 -7
  63. package/umd/modules/@postnord/web-components/package.json +32 -62
  64. package/umd/modules/@webcomponents/custom-elements/package.json +23 -58
  65. package/pn-market-web-components/p-6789a592.entry.js +0 -1
@@ -0,0 +1,379 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import { d as debounce_1 } from './index2.js';
3
+ import { d as defineCustomElement$3 } from './pn-dropdown-with-multi-input-rows-row2.js';
4
+ import { d as defineCustomElement$2 } from './pn-marketweb-input2.js';
5
+ import { v as v4 } from './v4.js';
6
+
7
+ const pnDropdownWithMultiInputRowsCss = "pn-dropdown-with-multi-input-rows .dropdown-with-multi-input-elemet__row{margin-bottom:1rem}pn-dropdown-with-multi-input-rows .dropdown-with-multi-input-elemet__delete{display:-ms-flexbox;display:flex;gap:1rem;margin-bottom:1rem;padding:1rem;background-color:#F9F8F8}pn-dropdown-with-multi-input-rows .dropdown-with-multi-input-elemet__delete pn-button{margin-top:0.9rem}pn-dropdown-with-multi-input-rows .dropdown-with-multi-input-elemet__label-row{display:-ms-flexbox;display:flex;gap:1rem}pn-dropdown-with-multi-input-rows .dropdown-with-multi-input-elemet__label{width:30%;font-size:0.875em;color:#5e554a}pn-dropdown-with-multi-input-rows .sum-row{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}";
8
+
9
+ const PnDropdownWithMultiInputRows$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
10
+ constructor() {
11
+ super();
12
+ this.__registerHost();
13
+ this.allFormValues = createEvent(this, "allFormValues", 7);
14
+ this.pnFirstDropdown = null;
15
+ this.pnSecondDropdown = null;
16
+ this.pnSumField = null;
17
+ this.pnConfirmDeleteButton = null;
18
+ this.pnAbortDeleteButton = null;
19
+ this._firstDropdownSelection = null;
20
+ this._secondDropdownSelection = null;
21
+ this._defaultRow = {
22
+ id: this.generateUniqueId(),
23
+ firstInput: '',
24
+ secondInput: this.secondInputWarning.toString(),
25
+ date: '',
26
+ };
27
+ this.dropdownData = null;
28
+ this.languageCode = null;
29
+ this.firstDropdownLabel = null;
30
+ this.firstDropdownHelperText = null;
31
+ this.secondDropdownLabel = null;
32
+ this.secondDropdownHelperText = null;
33
+ this.secondDropdownMax = null;
34
+ this.deleteMultipleRowsWarningText = null;
35
+ this.confirmDeleteButtonText = null;
36
+ this.abortDeleteButtonText = null;
37
+ this.fristInputLabel = null;
38
+ this.fristInputPlaceholder = null;
39
+ this.firstInputMin = null;
40
+ this.firstInputMax = null;
41
+ this.firstInputWarning = null;
42
+ this.firstInputWarningText = null;
43
+ this.firstInputLowErrorText = null;
44
+ this.firstInputHighErrorText = null;
45
+ this.secondInputLabel = null;
46
+ this.secondInputPlaceholder = null;
47
+ this.secondInputMin = null;
48
+ this.secondInputMax = null;
49
+ this.secondInputWarning = null;
50
+ this.secondInputWarningText = null;
51
+ this.secondInputLowErrorText = null;
52
+ this.secondInputHighErrorText = null;
53
+ this.dateLabel = null;
54
+ this.datePlaceholder = null;
55
+ this.dateDaysFromToday = 1;
56
+ this.yearsToAddToEndDate = null;
57
+ this.sumFieldLabel = null;
58
+ this.addRowText = null;
59
+ this.elementHelperText = null;
60
+ this.dropdownDataRoot = null;
61
+ this.secondDropdownArr = [];
62
+ this.rowCount = null;
63
+ this.rowData = null;
64
+ this.formValues = null;
65
+ this.firstValidDateString = '';
66
+ this.lastValidDateString = '';
67
+ this.rowSum = null;
68
+ this.minRowCount = null;
69
+ this.showDelteConfirm = false;
70
+ }
71
+ componentWillLoad() {
72
+ this.formValues = [];
73
+ this.setDropDownData();
74
+ this.updateSecondDropdown();
75
+ this.setRowData();
76
+ this.setFirstValidDate();
77
+ }
78
+ componentDidLoad() {
79
+ this.updateSum();
80
+ }
81
+ setDropDownData() {
82
+ var _a;
83
+ if (typeof this.dropdownData === 'string') {
84
+ this.dropdownDataRoot = JSON.parse(this.dropdownData);
85
+ }
86
+ else {
87
+ this.dropdownDataRoot = this.dropdownData;
88
+ }
89
+ if ((_a = this.dropdownDataRoot) === null || _a === void 0 ? void 0 : _a.length) {
90
+ this.dropdownDataRoot.forEach(element => {
91
+ if (!element.value) {
92
+ element.value = 0;
93
+ }
94
+ });
95
+ }
96
+ if (this.dropdownDataRoot.length > 0) {
97
+ this.dropdownDataRoot[0].checked = true;
98
+ this._firstDropdownSelection = this.dropdownDataRoot[0].caption;
99
+ this._secondDropdownSelection = this.dropdownDataRoot[0].value;
100
+ this.minRowCount = this.dropdownDataRoot[0].value;
101
+ }
102
+ }
103
+ updateSecondDropdown() {
104
+ const selectedItem = this.dropdownDataRoot.find(arr => arr.checked === true);
105
+ this.secondDropdownArr = [];
106
+ for (let index = selectedItem.value; index <= this.secondDropdownMax; index++) {
107
+ this.secondDropdownArr.push(index);
108
+ }
109
+ }
110
+ updateSelectItemArr(arr, caption) {
111
+ arr.forEach(item => {
112
+ if (item.caption === caption) {
113
+ item.checked = !item.checked;
114
+ }
115
+ else {
116
+ item.checked = false;
117
+ }
118
+ });
119
+ return arr;
120
+ }
121
+ setRowData() {
122
+ this.rowData = [];
123
+ for (let index = 0; index < this._secondDropdownSelection; index++) {
124
+ const row = Object.assign({}, this._defaultRow);
125
+ row.id = this.generateUniqueId();
126
+ this.rowData = [...this.rowData, row];
127
+ }
128
+ this.rowCount = this.rowData.length;
129
+ }
130
+ generateUniqueId() {
131
+ return v4();
132
+ }
133
+ setFirstValidDate() {
134
+ var _a;
135
+ const yearsToadd = this.yearsToAddToEndDate ? this.yearsToAddToEndDate : 2;
136
+ const date = new Date();
137
+ date.setDate((_a = date.getDate() + this.dateDaysFromToday) !== null && _a !== void 0 ? _a : 0);
138
+ const year = date.getFullYear();
139
+ const month = (date.getMonth() + 1).toString().padStart(2, '0');
140
+ const day = date.getDate().toString().padStart(2, '0');
141
+ const endYear = year + yearsToadd;
142
+ this.firstValidDateString = `${year.toString()}-${month}-${day}`;
143
+ this.lastValidDateString = `${endYear.toString()}-${month}-${day}`;
144
+ }
145
+ addRow(newRowId) {
146
+ const newRow = Object.assign({}, this.rowData[0]);
147
+ newRow.id = newRowId ? newRowId : this.generateUniqueId();
148
+ newRow.date = '';
149
+ this.rowData = [...this.rowData, newRow];
150
+ this.rowCount = this.rowData.length;
151
+ this._secondDropdownSelection = this.rowCount;
152
+ this.secondDropdownArr = [...this.secondDropdownArr];
153
+ this.updateSum();
154
+ this.emitValuesIfValid();
155
+ }
156
+ handleFirstDropdown() {
157
+ const selected = this.pnFirstDropdown.querySelector('.current-selection .pn-option-content');
158
+ const selectedValue = selected === null || selected === void 0 ? void 0 : selected.textContent;
159
+ if (!(selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.length)) {
160
+ return;
161
+ }
162
+ this.dropdownDataRoot.forEach(element => {
163
+ element.checked = false;
164
+ });
165
+ const selectionRoot = this.dropdownDataRoot.find(x => x.caption === selectedValue);
166
+ selectionRoot.checked = true;
167
+ this._firstDropdownSelection = selectionRoot.caption;
168
+ this.minRowCount = selectionRoot.value;
169
+ if (selectionRoot.value > this._secondDropdownSelection) {
170
+ this.dropdownDataRoot = [...this.dropdownDataRoot];
171
+ for (let index = this.rowCount; index < selectionRoot.value; index++) {
172
+ this.addRow(this.generateUniqueId());
173
+ }
174
+ }
175
+ this.updateSecondDropdown();
176
+ this.updateSum();
177
+ this.emitValuesIfValid();
178
+ }
179
+ handleSecondDropdown() {
180
+ const selected = this.pnSecondDropdown.querySelector('.current-selection .pn-option-content');
181
+ const selectedValue = selected === null || selected === void 0 ? void 0 : selected.textContent;
182
+ if (!(selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.length)) {
183
+ return;
184
+ }
185
+ const value = parseInt(selectedValue);
186
+ if (value < this._secondDropdownSelection) {
187
+ this.showDelteConfirm = true;
188
+ }
189
+ else {
190
+ for (let index = this.rowCount; index < value; index++) {
191
+ this.addRow(this.generateUniqueId());
192
+ }
193
+ }
194
+ this.updateSum();
195
+ this.emitValuesIfValid();
196
+ }
197
+ predefinedValueChange(e) {
198
+ const indexToUpdate = this.rowData.findIndex(data => data.id === e.detail.id);
199
+ const val = e.detail;
200
+ this.rowData[indexToUpdate] = Object.assign(Object.assign({}, this.rowData[indexToUpdate]), { firstInput: val.firstInput, secondInput: val.secondInput, date: val.date });
201
+ if (e.type === 'firstInputChange' && indexToUpdate === 0) {
202
+ this.updateFirstInputOfRows(val.firstInput);
203
+ }
204
+ if (e.type === 'secondInputChange' && indexToUpdate === 0) {
205
+ this.updateSecondInputOfRows(val.secondInput);
206
+ }
207
+ this.rowData = [...this.rowData];
208
+ this.emitValuesIfValid();
209
+ this.updateSum();
210
+ }
211
+ updateFirstInputOfRows(value) {
212
+ for (let index = 1; index < this.rowCount; index++) {
213
+ this.rowData[index] = Object.assign(Object.assign({}, this.rowData[index]), { firstInput: value });
214
+ }
215
+ }
216
+ updateSecondInputOfRows(value) {
217
+ for (let index = 1; index < this.rowCount; index++) {
218
+ this.rowData[index] = Object.assign(Object.assign({}, this.rowData[index]), { secondInput: value });
219
+ }
220
+ }
221
+ deleteRowEvent(e) {
222
+ const indexToRemove = this.rowData.findIndex(data => data.id === e.detail);
223
+ if (indexToRemove < 0) {
224
+ return;
225
+ }
226
+ this.rowData.splice(indexToRemove, 1);
227
+ this.rowData = [...this.rowData];
228
+ this.rowCount = this.rowData.length;
229
+ this._secondDropdownSelection = this.rowCount;
230
+ this.secondDropdownArr = [...this.secondDropdownArr];
231
+ this.emitValuesIfValid();
232
+ this.updateSum();
233
+ }
234
+ updateSum() {
235
+ this.rowSum = '';
236
+ let sum = 0;
237
+ this.rowData.forEach(element => {
238
+ var _a;
239
+ if ((_a = element === null || element === void 0 ? void 0 : element.firstInput) === null || _a === void 0 ? void 0 : _a.length) {
240
+ sum += parseInt(element.firstInput);
241
+ }
242
+ });
243
+ this.rowSum = sum.toString();
244
+ }
245
+ deleteExcessRows() {
246
+ const selected = this.pnSecondDropdown.querySelector('.current-selection .pn-option-content');
247
+ const selectedValue = selected === null || selected === void 0 ? void 0 : selected.textContent;
248
+ if (!(selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.length)) {
249
+ return;
250
+ }
251
+ const rowsToDelete = this.rowCount - parseInt(selectedValue);
252
+ for (let index = 0; index < rowsToDelete; index++) {
253
+ this.rowData.pop();
254
+ }
255
+ this.rowData = [...this.rowData];
256
+ this.showDelteConfirm = false;
257
+ this.updateSum();
258
+ }
259
+ abortDeleteRows() {
260
+ this.showDelteConfirm = false;
261
+ }
262
+ emitValuesIfValid() {
263
+ this.formValues = [];
264
+ this.rowData.forEach(item => {
265
+ var _a, _b, _c, _d;
266
+ const rowValue = { row: [] };
267
+ if ((_a = this._firstDropdownSelection) === null || _a === void 0 ? void 0 : _a.length) {
268
+ const dropDownValue = { name: this.firstDropdownLabel, value: this._firstDropdownSelection };
269
+ rowValue.row.push(dropDownValue);
270
+ }
271
+ if ((_b = item.firstInput) === null || _b === void 0 ? void 0 : _b.length) {
272
+ const firstInputValue = { name: this.fristInputLabel, value: item.firstInput };
273
+ rowValue.row.push(firstInputValue);
274
+ }
275
+ if ((_c = item.secondInput) === null || _c === void 0 ? void 0 : _c.length) {
276
+ const secondInputValue = { name: this.secondInputLabel, value: item.secondInput };
277
+ rowValue.row.push(secondInputValue);
278
+ }
279
+ if ((_d = item.date) === null || _d === void 0 ? void 0 : _d.length) {
280
+ const dateValue = { name: this.dateLabel, value: item.date };
281
+ rowValue.row.push(dateValue);
282
+ }
283
+ if (rowValue.row.length === 4) {
284
+ this.formValues.push(rowValue);
285
+ }
286
+ });
287
+ if (this.formValues.length === this.rowData.length) {
288
+ const valueJsonString = JSON.stringify(this.formValues);
289
+ this.allFormValues.emit(valueJsonString);
290
+ }
291
+ else {
292
+ this.allFormValues.emit('');
293
+ }
294
+ }
295
+ render() {
296
+ var _a, _b, _c, _d, _e, _f;
297
+ return (h(Host, { class: "dropdown-with-multi-input-elemet" }, h("div", { class: "dropdown-with-multi-input-elemet__row" }, h("div", null, h("pn-select", { ref: el => (this.pnFirstDropdown = el), class: "pn-row-select-dropdown dropDown1-dropdown", label: this.firstDropdownLabel }, (_a = this.dropdownDataRoot) === null || _a === void 0 ? void 0 : _a.map((item, i) => (h("pn-option", { index: i, value: item.value, selected: item.checked, onClick: debounce_1.debounce(this.handleFirstDropdown.bind(this), 500) }, item.caption)))), ((_b = this.firstDropdownHelperText) === null || _b === void 0 ? void 0 : _b.length) ? h("small", null, this.firstDropdownHelperText) : null)), h("div", { class: "dropdown-with-multi-input-elemet__row" }, h("div", null, h("pn-select", { ref: el => (this.pnSecondDropdown = el), class: "pn-row-select-dropdown dropDown2-dropdown", label: this.secondDropdownLabel }, (_c = this.secondDropdownArr) === null || _c === void 0 ? void 0 : _c.map((item, i) => (h("pn-option", { index: i, value: item, selected: item === this._secondDropdownSelection, onClick: debounce_1.debounce(this.handleSecondDropdown.bind(this), 500) }, item)))), ((_d = this.secondDropdownHelperText) === null || _d === void 0 ? void 0 : _d.length) ? h("small", null, this.secondDropdownHelperText) : null)), this.showDelteConfirm ? (h("div", { class: "dropdown-with-multi-input-elemet__delete" }, h("p", null, this.deleteMultipleRowsWarningText), h("pn-button", { ref: el => (this.pnConfirmDeleteButton = el), small: "true", appearance: "warning", onClick: this.deleteExcessRows.bind(this) }, this.confirmDeleteButtonText), h("pn-button", { ref: el => (this.pnAbortDeleteButton = el), small: "true", appearance: "light", onClick: this.abortDeleteRows.bind(this) }, this.abortDeleteButtonText))) : null, h("div", { class: "dropdown-with-multi-input-elemet__label-row" }, h("div", { class: "dropdown-with-multi-input-elemet__label" }, h("label", null, this.fristInputLabel)), h("div", { class: "dropdown-with-multi-input-elemet__label" }, h("label", null, this.secondInputLabel)), h("div", { class: "dropdown-with-multi-input-elemet__label" }, h("label", null, this.dateLabel))), (_e = this.rowData) === null || _e === void 0 ? void 0 :
298
+ _e.map((data, i) => {
299
+ return (h("div", { class: 'dropdown-with-multi-input-elemet__row generated-row-' + i, id: 'generated-row-' + i }, h("pn-dropdown-with-multi-input-rows-row", { "language-code": this.languageCode, "frist-input-placeholder": this.fristInputPlaceholder, "first-input-min": this.firstInputMin, "first-input-max": this.firstInputMax, "first-input-warning": this.firstInputWarning, "first-input-warning-text": this.firstInputWarningText, "first-input-low-error-text": this.firstInputLowErrorText, "first-input-high-error-text": this.firstInputHighErrorText, "second-input-placeholder": this.secondInputPlaceholder, "second-input-min": this.secondInputMin, "second-input-max": this.secondInputMax, "second-input-warning": this.secondInputWarning, "second-input-warning-text": this.secondInputWarningText, "second-input-low-error-text": this.secondInputLowErrorText, "second-input-high-error-text": this.secondInputHighErrorText, datePlaceholder: this.datePlaceholder, firstValidDate: this.firstValidDateString, lastValidDate: this.lastValidDateString, "predefined-value": JSON.stringify(data), "min-row-count": this.minRowCount, "row-index": i })));
300
+ }), h("div", { class: "dropdown-with-multi-input-elemet__row sum-row" }, h("pn-marketweb-input", { disabled: true, ref: el => (this.pnSumField = el), type: "number", value: this.rowSum, label: this.sumFieldLabel }), h("pn-button", { "icon-only": this.addRowText ? false : true, "left-icon": "true", "aria-label": "Add", icon: "plus", appearance: "light", variant: "borderless", class: "connected-dropdown__button-right", onClick: () => {
301
+ this.addRow(this.generateUniqueId());
302
+ } }, this.addRowText)), ((_f = this.elementHelperText) === null || _f === void 0 ? void 0 : _f.length) ? h("div", { class: "dropdown-with-multi-input-elemet__row" }, this.elementHelperText) : null));
303
+ }
304
+ get hostElement() { return this; }
305
+ static get style() { return pnDropdownWithMultiInputRowsCss; }
306
+ }, [0, "pn-dropdown-with-multi-input-rows", {
307
+ "dropdownData": [1, "dropdown-data"],
308
+ "languageCode": [1, "language-code"],
309
+ "firstDropdownLabel": [1, "first-dropdown-label"],
310
+ "firstDropdownHelperText": [1, "first-dropdown-helper-text"],
311
+ "secondDropdownLabel": [1, "second-dropdown-label"],
312
+ "secondDropdownHelperText": [1, "second-dropdown-helper-text"],
313
+ "secondDropdownMax": [2, "second-dropdown-max"],
314
+ "deleteMultipleRowsWarningText": [1, "delete-multiple-rows-warning-text"],
315
+ "confirmDeleteButtonText": [1, "confirm-delete-button-text"],
316
+ "abortDeleteButtonText": [1, "abort-delete-button-text"],
317
+ "fristInputLabel": [1, "frist-input-label"],
318
+ "fristInputPlaceholder": [1, "frist-input-placeholder"],
319
+ "firstInputMin": [2, "first-input-min"],
320
+ "firstInputMax": [2, "first-input-max"],
321
+ "firstInputWarning": [2, "first-input-warning"],
322
+ "firstInputWarningText": [1, "first-input-warning-text"],
323
+ "firstInputLowErrorText": [1, "first-input-low-error-text"],
324
+ "firstInputHighErrorText": [1, "first-input-high-error-text"],
325
+ "secondInputLabel": [1, "second-input-label"],
326
+ "secondInputPlaceholder": [1, "second-input-placeholder"],
327
+ "secondInputMin": [2, "second-input-min"],
328
+ "secondInputMax": [2, "second-input-max"],
329
+ "secondInputWarning": [2, "second-input-warning"],
330
+ "secondInputWarningText": [1, "second-input-warning-text"],
331
+ "secondInputLowErrorText": [1, "second-input-low-error-text"],
332
+ "secondInputHighErrorText": [1, "second-input-high-error-text"],
333
+ "dateLabel": [1, "date-label"],
334
+ "datePlaceholder": [1, "date-placeholder"],
335
+ "dateDaysFromToday": [2, "date-days-from-today"],
336
+ "yearsToAddToEndDate": [2, "years-to-add-to-end-date"],
337
+ "sumFieldLabel": [1, "sum-field-label"],
338
+ "addRowText": [1, "add-row-text"],
339
+ "elementHelperText": [1, "element-helper-text"],
340
+ "dropdownDataRoot": [32],
341
+ "secondDropdownArr": [32],
342
+ "rowCount": [32],
343
+ "rowData": [32],
344
+ "formValues": [32],
345
+ "firstValidDateString": [32],
346
+ "lastValidDateString": [32],
347
+ "rowSum": [32],
348
+ "minRowCount": [32],
349
+ "showDelteConfirm": [32]
350
+ }, [[0, "rowValueChange", "predefinedValueChange"], [0, "firstInputChange", "predefinedValueChange"], [0, "secondInputChange", "predefinedValueChange"], [0, "deleteRowEvent", "deleteRowEvent"]]]);
351
+ function defineCustomElement$1() {
352
+ if (typeof customElements === "undefined") {
353
+ return;
354
+ }
355
+ const components = ["pn-dropdown-with-multi-input-rows", "pn-dropdown-with-multi-input-rows-row", "pn-marketweb-input"];
356
+ components.forEach(tagName => { switch (tagName) {
357
+ case "pn-dropdown-with-multi-input-rows":
358
+ if (!customElements.get(tagName)) {
359
+ customElements.define(tagName, PnDropdownWithMultiInputRows$1);
360
+ }
361
+ break;
362
+ case "pn-dropdown-with-multi-input-rows-row":
363
+ if (!customElements.get(tagName)) {
364
+ defineCustomElement$3();
365
+ }
366
+ break;
367
+ case "pn-marketweb-input":
368
+ if (!customElements.get(tagName)) {
369
+ defineCustomElement$2();
370
+ }
371
+ break;
372
+ } });
373
+ }
374
+ defineCustomElement$1();
375
+
376
+ const PnDropdownWithMultiInputRows = PnDropdownWithMultiInputRows$1;
377
+ const defineCustomElement = defineCustomElement$1;
378
+
379
+ export { PnDropdownWithMultiInputRows, defineCustomElement };
@@ -182,7 +182,7 @@ const PnMarketwebSiteheader$1 = /*@__PURE__*/ proxyCustomElement(class extends H
182
182
  this.searchPlaceholder = '';
183
183
  this.spaMode = false;
184
184
  this.checkUserLoggedInStateInterval = 0;
185
- this.pageId = undefined;
185
+ this.pageId = '';
186
186
  this.i18n = {
187
187
  searchlabel: '',
188
188
  searchplaceholder: '',
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface PnMultipleInput extends Components.PnMultipleInput, HTMLElement {}
4
+ export const PnMultipleInput: {
5
+ prototype: PnMultipleInput;
6
+ new (): PnMultipleInput;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,130 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import { d as debounce_1 } from './index2.js';
3
+ import { d as defineCustomElement$2 } from './pn-marketweb-input2.js';
4
+ import { v as v4 } from './v4.js';
5
+
6
+ const pnMultipleInputCss = "pn-multiple-input .multiple-input-generated-row,pn-multiple-input .multiple-input-row{display:-ms-flexbox;display:flex;gap:1rem}pn-multiple-input .multiple-input-generated-row pn-marketweb-input,pn-multiple-input .multiple-input-row pn-marketweb-input{width:100%}pn-multiple-input .multiple-input-slot{display:-ms-flexbox;display:flex;gap:1rem;-ms-flex-direction:column;flex-direction:column;margin-top:1rem;margin-bottom:1rem}";
7
+
8
+ const PnMultipleInput$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
9
+ constructor() {
10
+ super();
11
+ this.__registerHost();
12
+ this.allFormValues = createEvent(this, "allFormValues", 7);
13
+ this.pnSlotElement = null;
14
+ this._formValues = [];
15
+ this.label = null;
16
+ this.placeholder = null;
17
+ this.addRowButtonText = null;
18
+ this.rowData = [];
19
+ }
20
+ componentWillLoad() {
21
+ const elemtnId = this.generateUniqueId();
22
+ const newRow = { id: elemtnId, input: '' };
23
+ this.rowData = [...this.rowData, newRow];
24
+ }
25
+ componentDidLoad() {
26
+ this.addEventHandlers();
27
+ }
28
+ componentDidUpdate() {
29
+ this.addEventHandlers();
30
+ }
31
+ addEventHandlers() {
32
+ const rows = this.pnSlotElement.querySelectorAll('pn-marketweb-input');
33
+ rows.forEach(element => {
34
+ element.addEventListener('keyup', debounce_1.debounce(this.handleInput.bind(this), 500));
35
+ });
36
+ }
37
+ generateUniqueId() {
38
+ return v4();
39
+ }
40
+ deleteRow(indexToRemove) {
41
+ if (indexToRemove < 0) {
42
+ return;
43
+ }
44
+ this.rowData.splice(indexToRemove, 1);
45
+ this.rowData = [...this.rowData];
46
+ this.emitValues();
47
+ }
48
+ addRow() {
49
+ const newRow = { id: this.generateUniqueId(), input: '' };
50
+ this.rowData = [...this.rowData, newRow];
51
+ this.emitValues();
52
+ }
53
+ handleInput(e) {
54
+ const target = e.target;
55
+ const inputElm = target.closest('pn-marketweb-input');
56
+ if (!inputElm) {
57
+ return;
58
+ }
59
+ const inputElmId = inputElm.id;
60
+ const value = target.value;
61
+ const index = this.rowData.findIndex(item => item.id === inputElmId);
62
+ if (index < 0) {
63
+ return;
64
+ }
65
+ this.rowData[index] = Object.assign(Object.assign({}, this.rowData[index]), { input: value });
66
+ this.emitValues();
67
+ }
68
+ emitValues() {
69
+ this._formValues = [];
70
+ const label = this.label ? this.label : 'InputField';
71
+ this.rowData.forEach(item => {
72
+ const rowValue = { row: [] };
73
+ if (item.input) {
74
+ const dropDownValue = { name: label, value: item.input };
75
+ rowValue.row.push(dropDownValue);
76
+ }
77
+ if (rowValue.row.length === 1) {
78
+ this._formValues.push(rowValue);
79
+ }
80
+ });
81
+ if (this._formValues.length === this.rowData.length) {
82
+ const valueJsonString = JSON.stringify(this._formValues);
83
+ this.allFormValues.emit(valueJsonString);
84
+ }
85
+ else {
86
+ this.allFormValues.emit('');
87
+ }
88
+ }
89
+ render() {
90
+ var _a;
91
+ return (h(Host, null, h("div", { ref: el => (this.pnSlotElement = el), class: "multiple-input-slot" }, (_a = this.rowData) === null || _a === void 0 ? void 0 : _a.map((data, i) => {
92
+ return (h("div", { class: "multiple-input-generated-row" }, h("pn-marketweb-input", { label: this.label, type: "text", placeholder: this.placeholder, value: data.input, id: data.id }), i > 0 ? (h("pn-button", { "icon-only": true, "aria-label": "Delete", icon: "minus", appearance: "warning", onClick: () => {
93
+ this.deleteRow(i);
94
+ }, index: i, id: data.id }, "Delete")) : null));
95
+ })), h("dvi", { class: "multiple-input-row" }, h("pn-button", { "icon-only": this.addRowButtonText ? false : true, "left-icon": "true", "aria-label": "Add", icon: "plus", appearance: "light", variant: "borderless", class: "connected-dropdown__button-right", onClick: () => {
96
+ this.addRow();
97
+ } }, this.addRowButtonText))));
98
+ }
99
+ get hostElement() { return this; }
100
+ static get style() { return pnMultipleInputCss; }
101
+ }, [0, "pn-multiple-input", {
102
+ "label": [1],
103
+ "placeholder": [1],
104
+ "addRowButtonText": [1, "add-row-button-text"],
105
+ "rowData": [32]
106
+ }]);
107
+ function defineCustomElement$1() {
108
+ if (typeof customElements === "undefined") {
109
+ return;
110
+ }
111
+ const components = ["pn-multiple-input", "pn-marketweb-input"];
112
+ components.forEach(tagName => { switch (tagName) {
113
+ case "pn-multiple-input":
114
+ if (!customElements.get(tagName)) {
115
+ customElements.define(tagName, PnMultipleInput$1);
116
+ }
117
+ break;
118
+ case "pn-marketweb-input":
119
+ if (!customElements.get(tagName)) {
120
+ defineCustomElement$2();
121
+ }
122
+ break;
123
+ } });
124
+ }
125
+ defineCustomElement$1();
126
+
127
+ const PnMultipleInput = PnMultipleInput$1;
128
+ const defineCustomElement = defineCustomElement$1;
129
+
130
+ export { PnMultipleInput, defineCustomElement };
@@ -2149,6 +2149,10 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
2149
2149
  return import(
2150
2150
  /* webpackMode: "lazy" */
2151
2151
  './pn-dropdown-choice-adds-row.entry.js').then(processMod, consoleError);
2152
+ case 'pn-dropdown-with-multi-input-rows':
2153
+ return import(
2154
+ /* webpackMode: "lazy" */
2155
+ './pn-dropdown-with-multi-input-rows.entry.js').then(processMod, consoleError);
2152
2156
  case 'pn-find-price':
2153
2157
  return import(
2154
2158
  /* webpackMode: "lazy" */
@@ -2181,6 +2185,10 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
2181
2185
  return import(
2182
2186
  /* webpackMode: "lazy" */
2183
2187
  './pn-multi-row-connected-dropdown.entry.js').then(processMod, consoleError);
2188
+ case 'pn-multiple-input':
2189
+ return import(
2190
+ /* webpackMode: "lazy" */
2191
+ './pn-multiple-input.entry.js').then(processMod, consoleError);
2184
2192
  case 'pn-parcel-tracker':
2185
2193
  return import(
2186
2194
  /* webpackMode: "lazy" */
@@ -2277,6 +2285,10 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
2277
2285
  return import(
2278
2286
  /* webpackMode: "lazy" */
2279
2287
  './pn-teaser-card.entry.js').then(processMod, consoleError);
2288
+ case 'pn-dropdown-with-multi-input-rows-row':
2289
+ return import(
2290
+ /* webpackMode: "lazy" */
2291
+ './pn-dropdown-with-multi-input-rows-row.entry.js').then(processMod, consoleError);
2280
2292
  case 'pn-find-service-and-price-result':
2281
2293
  return import(
2282
2294
  /* webpackMode: "lazy" */
@@ -2345,14 +2357,14 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
2345
2357
  return import(
2346
2358
  /* webpackMode: "lazy" */
2347
2359
  './pn-product-card_3.entry.js').then(processMod, consoleError);
2348
- case 'pn-marketweb-input':
2349
- return import(
2350
- /* webpackMode: "lazy" */
2351
- './pn-marketweb-input.entry.js').then(processMod, consoleError);
2352
2360
  case 'pn-titletag':
2353
2361
  return import(
2354
2362
  /* webpackMode: "lazy" */
2355
2363
  './pn-titletag.entry.js').then(processMod, consoleError);
2364
+ case 'pn-marketweb-input':
2365
+ return import(
2366
+ /* webpackMode: "lazy" */
2367
+ './pn-marketweb-input.entry.js').then(processMod, consoleError);
2356
2368
  }
2357
2369
  }
2358
2370
  return import(