@postnord/pn-marketweb-components 2.4.24 → 2.4.26

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 (62) hide show
  1. package/cjs/index-4199ff85.js +16 -8
  2. package/cjs/loader.cjs.js +1 -1
  3. package/cjs/pn-market-web-components.cjs.js +1 -1
  4. package/cjs/pn-marketweb-sitefooter.cjs.entry.js +2 -2
  5. package/cjs/pn-multi-row-connected-dropdown-row.cjs.entry.js +372 -0
  6. package/cjs/pn-multi-row-connected-dropdown.cjs.entry.js +205 -0
  7. package/cjs/pn-site-footer_3.cjs.entry.js +1 -1
  8. package/collection/collection-manifest.json +2 -0
  9. package/collection/components/input/pn-multi-row-connected-dropdown/pn-multi-row-connected-dropdown-row.css +90 -0
  10. package/collection/components/input/pn-multi-row-connected-dropdown/pn-multi-row-connected-dropdown-row.js +836 -0
  11. package/collection/components/input/pn-multi-row-connected-dropdown/pn-multi-row-connected-dropdown.css +16 -0
  12. package/collection/components/input/pn-multi-row-connected-dropdown/pn-multi-row-connected-dropdown.js +631 -0
  13. package/collection/components/input/pn-multi-row-connected-dropdown/pn-multi-row-connected-dropdown.stories.js +62 -0
  14. package/collection/components/input/pn-multi-row-connected-dropdown/types.js +1 -0
  15. package/collection/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter.css +7 -1
  16. package/collection/components/layout-components/pn-marketweb-sitefooter/pn-marketweb-sitefooter.stories.js +14 -2
  17. package/collection/components/layout-components/pn-marketweb-sitefooter/socialMediaIcons.js +1 -1
  18. package/collection/components/navigation/pn-site-footer/pn-site-footer-col.css +2 -0
  19. package/components/index.d.ts +2 -0
  20. package/components/index.js +2 -0
  21. package/components/pn-filter-checkbox.js +1 -88
  22. package/components/pn-filter-checkbox2.js +90 -0
  23. package/components/pn-marketweb-sitefooter.js +2 -2
  24. package/components/pn-multi-row-connected-dropdown-row.d.ts +11 -0
  25. package/components/pn-multi-row-connected-dropdown-row.js +6 -0
  26. package/components/pn-multi-row-connected-dropdown-row2.js +434 -0
  27. package/components/pn-multi-row-connected-dropdown.d.ts +11 -0
  28. package/components/pn-multi-row-connected-dropdown.js +262 -0
  29. package/components/pn-site-footer-col2.js +1 -1
  30. package/esm/index-ee44c065.js +16 -8
  31. package/esm/loader.js +1 -1
  32. package/esm/pn-market-web-components.js +1 -1
  33. package/esm/pn-marketweb-sitefooter.entry.js +2 -2
  34. package/esm/pn-multi-row-connected-dropdown-row.entry.js +368 -0
  35. package/esm/pn-multi-row-connected-dropdown.entry.js +201 -0
  36. package/esm/pn-site-footer_3.entry.js +1 -1
  37. package/esm-es5/index-ee44c065.js +1 -1
  38. package/esm-es5/loader.js +1 -1
  39. package/esm-es5/pn-market-web-components.js +1 -1
  40. package/esm-es5/pn-marketweb-sitefooter.entry.js +1 -1
  41. package/esm-es5/pn-multi-row-connected-dropdown-row.entry.js +1 -0
  42. package/esm-es5/pn-multi-row-connected-dropdown.entry.js +1 -0
  43. package/esm-es5/pn-site-footer_3.entry.js +1 -1
  44. package/package.json +1 -1
  45. package/pn-market-web-components/p-1024c80b.entry.js +1 -0
  46. package/pn-market-web-components/p-31b84367.system.entry.js +1 -0
  47. package/pn-market-web-components/p-4b510969.entry.js +1 -0
  48. package/pn-market-web-components/p-5d2a19e3.entry.js +1 -0
  49. package/pn-market-web-components/p-743b1d06.system.entry.js +1 -0
  50. package/pn-market-web-components/p-7e81b501.system.entry.js +1 -0
  51. package/pn-market-web-components/p-83c85053.system.entry.js +1 -0
  52. package/pn-market-web-components/p-b4416838.entry.js +1 -0
  53. package/pn-market-web-components/p-fcdb7381.system.js +1 -1
  54. package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
  55. package/types/components/input/pn-multi-row-connected-dropdown/pn-multi-row-connected-dropdown-row.d.ts +93 -0
  56. package/types/components/input/pn-multi-row-connected-dropdown/pn-multi-row-connected-dropdown.d.ts +45 -0
  57. package/types/components/input/pn-multi-row-connected-dropdown/types.d.ts +32 -0
  58. package/types/components.d.ts +124 -0
  59. package/pn-market-web-components/p-4b0ccb02.system.entry.js +0 -1
  60. package/pn-market-web-components/p-7a4a7a83.system.entry.js +0 -1
  61. package/pn-market-web-components/p-f8a13e03.entry.js +0 -1
  62. package/pn-market-web-components/p-ffae5f6b.entry.js +0 -1
@@ -0,0 +1,434 @@
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-filter-checkbox2.js';
4
+ import { d as defineCustomElement$1 } from './pn-marketweb-input2.js';
5
+ import { v as v4 } from './v4.js';
6
+
7
+ const pnMultiRowConnectedDropdownRowCss = "pn-multi-row-connected-dropdown-row{gap:1rem}pn-multi-row-connected-dropdown-row .connected-dropdown-parent-element{margin-bottom:0.5rem}pn-multi-row-connected-dropdown-row pn-select{width:35%}pn-multi-row-connected-dropdown-row pn-marketweb-input{width:10%}pn-multi-row-connected-dropdown-row pn-marketweb-input input{height:4.3rem}pn-multi-row-connected-dropdown-row .connected-dropdown{padding:1rem;border-left:0.2rem solid #005D92}pn-multi-row-connected-dropdown-row .connected-dropdown:hover{background-color:#F9F8F8}pn-multi-row-connected-dropdown-row .connected-dropdown__toggle-date-button{width:20%;margin-bottom:0.5rem}pn-multi-row-connected-dropdown-row .connected-dropdown__row{display:-ms-flexbox;display:flex;-ms-flex-align:end;align-items:flex-end;gap:1rem;margin-bottom:1rem;-ms-flex-pack:justify;justify-content:space-between}pn-multi-row-connected-dropdown-row .connected-dropdown__row__no-margin{margin:0}pn-multi-row-connected-dropdown-row .connected-dropdown__multi-date-row{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:1rem;margin-bottom:1rem}pn-multi-row-connected-dropdown-row .connected-dropdown__button-container{display:-ms-flexbox;display:flex;-ms-flex-align:end;align-items:flex-end;gap:1rem}pn-multi-row-connected-dropdown-row .connected-dropdown__button{background-color:#ffffff;border:solid;border-width:0.1rem;border-radius:0.8rem;border-color:#005D92;padding:0.4rem 0.8rem;color:#005D92;font-size:1.4rem;text-align:center;text-decoration:none;cursor:pointer}pn-multi-row-connected-dropdown-row .connected-dropdown__button:hover,pn-multi-row-connected-dropdown-row .connected-dropdown__button.active{background-color:#0D234B;border-color:#0D234B;color:#ffffff}pn-multi-row-connected-dropdown-row .connected-dropdown__buttom-container-right{display:-ms-flexbox;display:flex}pn-multi-row-connected-dropdown-row .connected-dropdown__button-right{margin-left:auto}pn-multi-row-connected-dropdown-row .connected-dropdown__label-container{margin-bottom:0.4rem;color:#5E554A;font-size:0.875em;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:end;align-items:flex-end}pn-multi-row-connected-dropdown-row .connected-dropdown__checkbox{display:-ms-flexbox;display:flex;gap:0.5rem}pn-multi-row-connected-dropdown-row .connected-dropdown__date-slot{border:0.1rem solid #005D92;margin-bottom:1rem;padding:1rem}pn-multi-row-connected-dropdown-row .generated-date-row{border-bottom:0.1rem solid #005D92}";
8
+
9
+ const PnMultiRowConnectedDropdownRow = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
10
+ constructor() {
11
+ super();
12
+ this.__registerHost();
13
+ this.rowValueChange = createEvent(this, "rowValueChange", 7);
14
+ this.deleteRowEvent = createEvent(this, "deleteRowEvent", 7);
15
+ this.pnConnectedDropdown = null;
16
+ this.pnConnectedDropdownSlotElement = null;
17
+ this.pnAddFieldButton = null;
18
+ this.pnFirstDropdown = null;
19
+ this.pnSecondDropdown = null;
20
+ this.pnInputField = null;
21
+ this.pnSingleDatePicker = null;
22
+ this.pnStartDate = null;
23
+ this.pnEndDate = null;
24
+ this.pnShowDateRangeFiledButton = null;
25
+ this.pnDateRangeContainer = null;
26
+ this.pnGenerateDatesButton = null;
27
+ this.pnDaysRow = null;
28
+ this.pnGeneratedDatesSlot = null;
29
+ this.pnSaveGeneratedDatesButton = null;
30
+ this.pnDeleteRowButton = null;
31
+ this.dropdownData = null;
32
+ this.languageCode = null;
33
+ this.label = null;
34
+ this.firstDropdownLabel = null;
35
+ this.secondDropdownLabel = null;
36
+ this.dropdownPlaceholder = null;
37
+ this.addRowText = null;
38
+ this.inputFildLabel = null;
39
+ this.inputFildPlaceholder = null;
40
+ this.dateButtonText = null;
41
+ this.datePlaceholder = null;
42
+ this.dateDaysFromToday = 1;
43
+ this.allowMultipleDates = null;
44
+ this.startDateLabel = null;
45
+ this.endDateLabel = null;
46
+ this.multiDateHelperText = null;
47
+ this.generateDatesButtonText = null;
48
+ this.saveDateButtonText = null;
49
+ this.noDatesText = null;
50
+ this.index = null;
51
+ this.predefinedValue = null;
52
+ this.yearsToAddToEndDate = null;
53
+ this.buttonsArray = null;
54
+ this.firstDropdownArr = null;
55
+ this.secondDropdownArr = [];
56
+ this.firstDropdownClass = null;
57
+ this.secondDropdownClass = null;
58
+ this.firstValidDateString = '';
59
+ this.lastValidDateString = '';
60
+ this.firstDropdownPlaceholder = '-';
61
+ this.secondDropdownPlaceholder = '-';
62
+ this.starDateValue = '';
63
+ this.endDateValue = '';
64
+ this.generatedDatesArr = [];
65
+ this.selectedButtonValue = '';
66
+ this.inputFieldValue = '';
67
+ this.dateValue = '';
68
+ this.daysArr = null;
69
+ }
70
+ componentWillLoad() {
71
+ this.getPredefinedValues();
72
+ this.setDropDownData();
73
+ this.setFirstValidDate();
74
+ }
75
+ componentDidLoad() {
76
+ this.setInitialValues();
77
+ this.addEventHandlers();
78
+ this.emittRowValues();
79
+ }
80
+ setDropDownData() {
81
+ if (typeof this.dropdownData === 'string') {
82
+ this._dropdownData = JSON.parse(this.dropdownData);
83
+ }
84
+ else {
85
+ this._dropdownData = this.dropdownData;
86
+ }
87
+ }
88
+ getPredefinedValues() {
89
+ this._predefinedValue = JSON.parse(this.predefinedValue);
90
+ }
91
+ applyPredefinedValue() {
92
+ this.getPredefinedValues();
93
+ this.setInitialValues();
94
+ }
95
+ setInitialValues() {
96
+ this.setButtonsValue();
97
+ this.setFirstDropdownValues();
98
+ this.setSecondDropdownValues();
99
+ this.setInputField();
100
+ this.setDateValue();
101
+ this.setDateRangeDefaults();
102
+ this.firstDropdownClass = this.firstDropdownLabel.replace(' ', '_') + '-dropdown';
103
+ this.secondDropdownClass = this.secondDropdownLabel.replace(' ', '_') + '-dropdown';
104
+ }
105
+ setButtonsValue() {
106
+ var _a;
107
+ this.buttonsArray = [];
108
+ if ((_a = this._predefinedValue.buttons) === null || _a === void 0 ? void 0 : _a.length) {
109
+ this.buttonsArray = this._predefinedValue.buttons;
110
+ this.buttonsArray.forEach(item => {
111
+ if (item.selected) {
112
+ this.selectedButtonValue = item.value;
113
+ }
114
+ });
115
+ }
116
+ else {
117
+ this._dropdownData.forEach(item => {
118
+ const button = { selected: false, value: item.caption, caption: item.caption };
119
+ this.buttonsArray.push(button);
120
+ });
121
+ }
122
+ }
123
+ setFirstDropdownValues() {
124
+ var _a;
125
+ this.firstDropdownArr = [];
126
+ if ((_a = this._predefinedValue.firstDropdown) === null || _a === void 0 ? void 0 : _a.length) {
127
+ this.firstDropdownArr = [...this._predefinedValue.firstDropdown];
128
+ }
129
+ }
130
+ setSecondDropdownValues() {
131
+ var _a;
132
+ this.secondDropdownArr = [];
133
+ if ((_a = this._predefinedValue.secondDropdown) === null || _a === void 0 ? void 0 : _a.length) {
134
+ this.secondDropdownArr = [...this._predefinedValue.secondDropdown];
135
+ }
136
+ }
137
+ setInputField() {
138
+ var _a;
139
+ this.inputFieldValue = ((_a = this._predefinedValue.input) === null || _a === void 0 ? void 0 : _a.length) ? this._predefinedValue.input : '';
140
+ }
141
+ setDateValue() {
142
+ var _a, _b, _c;
143
+ if (this.allowMultipleDates) {
144
+ this.pnDateRangeContainer.style.display = ((_a = this._predefinedValue.dates) === null || _a === void 0 ? void 0 : _a.length) ? '' : 'none';
145
+ this.generatedDatesArr = ((_b = this._predefinedValue.dates) === null || _b === void 0 ? void 0 : _b.length) ? this._predefinedValue.dates.split(',') : [];
146
+ this.saveGeneratedDates();
147
+ }
148
+ else {
149
+ this.dateValue = ((_c = this._predefinedValue.dates) === null || _c === void 0 ? void 0 : _c.length) ? this._predefinedValue.dates : '';
150
+ }
151
+ }
152
+ setDateRangeDefaults() {
153
+ var _a, _b;
154
+ this.daysArr = this._predefinedValue.dateRange.days;
155
+ this.starDateValue = ((_a = this._predefinedValue.dateRange.startDate) === null || _a === void 0 ? void 0 : _a.length) ? this._predefinedValue.dateRange.startDate : '';
156
+ this.endDateValue = ((_b = this._predefinedValue.dateRange.endDate) === null || _b === void 0 ? void 0 : _b.length) ? this._predefinedValue.dateRange.endDate : '';
157
+ }
158
+ setFirstValidDate() {
159
+ var _a;
160
+ const yearsToadd = this.yearsToAddToEndDate ? this.yearsToAddToEndDate : 2;
161
+ const date = new Date();
162
+ date.setDate((_a = date.getDate() + this.dateDaysFromToday) !== null && _a !== void 0 ? _a : 0);
163
+ const year = date.getFullYear();
164
+ const month = (date.getMonth() + 1).toString().padStart(2, '0');
165
+ const day = date.getDate().toString().padStart(2, '0');
166
+ const endYear = year + yearsToadd;
167
+ this.firstValidDateString = `${year.toString()}-${month}-${day}`;
168
+ this.lastValidDateString = `${endYear.toString()}-${month}-${day}`;
169
+ }
170
+ addEventHandlers() {
171
+ const emmitValues = debounce_1.debounce(this.emittRowValues.bind(this), 500);
172
+ this.pnInputField.addEventListener('keyup', this.handleInput.bind(this));
173
+ this.pnInputField.addEventListener('change', this.handleInput.bind(this));
174
+ this.pnInputField.addEventListener('keyup', emmitValues);
175
+ this.pnInputField.addEventListener('change', emmitValues);
176
+ if (this.allowMultipleDates) {
177
+ this.pnShowDateRangeFiledButton.addEventListener('click', this.showDateRangeRow.bind(this));
178
+ this.pnStartDate.addEventListener('dateselection', this.HandleRangeDatePickers.bind(this));
179
+ this.pnEndDate.addEventListener('dateselection', this.HandleRangeDatePickers.bind(this));
180
+ this.pnGenerateDatesButton.addEventListener('click', this.generateDates.bind(this));
181
+ this.pnSaveGeneratedDatesButton.addEventListener('click', this.saveGeneratedDates.bind(this));
182
+ this.pnSaveGeneratedDatesButton.addEventListener('click', emmitValues);
183
+ }
184
+ else {
185
+ this.pnSingleDatePicker.addEventListener('dateselection', this.setSingleDateValue.bind(this));
186
+ this.pnSingleDatePicker.addEventListener('dateselection', emmitValues);
187
+ }
188
+ if (this.index > 0) {
189
+ this.pnDeleteRowButton.addEventListener('click', this.deleteRow.bind(this));
190
+ }
191
+ }
192
+ generateUniqueId() {
193
+ return v4();
194
+ }
195
+ updateSelectItemArr(arr, val) {
196
+ arr.forEach(item => {
197
+ if (item.value === val) {
198
+ item.selected = !item.selected;
199
+ }
200
+ else {
201
+ item.selected = false;
202
+ }
203
+ });
204
+ return arr;
205
+ }
206
+ handleOptionButtonClick(e) {
207
+ var _a;
208
+ e.preventDefault();
209
+ const elmValue = e.target.innerHTML;
210
+ this.buttonsArray = [...this.updateSelectItemArr(this.buttonsArray, elmValue)];
211
+ this.selectedButtonValue = this.buttonsArray.filter(e => e.selected === true).length > 0 ? elmValue : '';
212
+ if ((_a = this.selectedButtonValue) === null || _a === void 0 ? void 0 : _a.length) {
213
+ this.firstDropdownArr = [];
214
+ const selectionChildren = this._dropdownData.find(arr => arr.caption === elmValue);
215
+ selectionChildren.values.forEach(item => {
216
+ this.firstDropdownArr.push({ selected: false, value: item.caption, caption: item.caption });
217
+ });
218
+ this.firstDropdownArr = [...this.firstDropdownArr];
219
+ this.firstDropdownPlaceholder = this.dropdownPlaceholder;
220
+ const firstDropdownText = this.pnFirstDropdown.querySelector('.current-selection .pn-option-content');
221
+ firstDropdownText.innerHTML = this.dropdownPlaceholder;
222
+ this.secondDropdownArr = [];
223
+ this.secondDropdownPlaceholder = '-';
224
+ const secondDropdownText = this.pnSecondDropdown.querySelector('.current-selection .pn-option-content');
225
+ secondDropdownText.innerHTML = this.secondDropdownPlaceholder;
226
+ }
227
+ else {
228
+ this.firstDropdownArr = [];
229
+ this.firstDropdownPlaceholder = '-';
230
+ const firstDropdownText = this.pnFirstDropdown.querySelector('.current-selection .pn-option-content');
231
+ firstDropdownText.innerHTML = this.firstDropdownPlaceholder;
232
+ this.secondDropdownArr = [];
233
+ this.secondDropdownPlaceholder = '-';
234
+ const secondDropdownText = this.pnSecondDropdown.querySelector('.current-selection .pn-option-content');
235
+ secondDropdownText.innerHTML = this.secondDropdownPlaceholder;
236
+ }
237
+ this.emittRowValues();
238
+ }
239
+ handleFirstDropdownChange() {
240
+ const selected = this.pnFirstDropdown.querySelector('.current-selection .pn-option-content');
241
+ const selectedValue = selected === null || selected === void 0 ? void 0 : selected.textContent;
242
+ this.firstDropdownArr = [...this.updateSelectItemArr(this.firstDropdownArr, selectedValue)];
243
+ this.secondDropdownArr = [];
244
+ const selectedButton = this.buttonsArray.findIndex(item => item.selected === true);
245
+ const firstChildren = this._dropdownData.find(arr => arr.caption === this.buttonsArray[selectedButton].value);
246
+ const secondChildren = firstChildren.values.find(arr => arr.caption === selectedValue);
247
+ secondChildren.values.forEach(item => {
248
+ this.secondDropdownArr.push({ selected: false, value: item.caption, caption: item.caption });
249
+ });
250
+ this.secondDropdownPlaceholder = this.dropdownPlaceholder;
251
+ const secondDropdownText = this.pnSecondDropdown.querySelector('.current-selection .pn-option-content');
252
+ secondDropdownText.innerHTML = this.secondDropdownPlaceholder;
253
+ this.emittRowValues();
254
+ }
255
+ handleSecondDropdownChange() {
256
+ const selected = this.pnSecondDropdown.querySelector('.current-selection .pn-option-content');
257
+ const selectedValue = selected === null || selected === void 0 ? void 0 : selected.textContent;
258
+ this.secondDropdownArr = [...this.updateSelectItemArr(this.secondDropdownArr, selectedValue)];
259
+ this.emittRowValues();
260
+ }
261
+ handleInput(e) {
262
+ const elm = e.target;
263
+ if (elm.value !== '0') {
264
+ this.inputFieldValue = elm.value;
265
+ }
266
+ }
267
+ showDateRangeRow() {
268
+ if (this.pnDateRangeContainer.style.display === 'none') {
269
+ this.pnDateRangeContainer.style.display = '';
270
+ }
271
+ else {
272
+ this.pnDateRangeContainer.style.display = 'none';
273
+ }
274
+ }
275
+ HandleRangeDatePickers(e) {
276
+ const elm = e.target;
277
+ if (elm === this.pnStartDate) {
278
+ this.starDateValue = e.detail;
279
+ }
280
+ if (elm === this.pnEndDate) {
281
+ this.endDateValue = e.detail;
282
+ }
283
+ }
284
+ generateDates(e) {
285
+ var _a;
286
+ e.preventDefault();
287
+ const allCheckboxes = this.pnDaysRow.querySelectorAll('pn-filter-checkbox');
288
+ const selectedDays = [];
289
+ this.generatedDatesArr = [];
290
+ allCheckboxes.forEach(element => {
291
+ const input = element.querySelector('input');
292
+ if (input.value) {
293
+ selectedDays.push(input.value);
294
+ }
295
+ });
296
+ if (selectedDays.length && this.starDateValue && this.endDateValue) {
297
+ this.daysArr.forEach(item => {
298
+ if (selectedDays.some(x => x === item.value)) {
299
+ item.selected = true;
300
+ }
301
+ else {
302
+ item.selected = false;
303
+ }
304
+ });
305
+ const startDate = new Date(Date.parse(this.starDateValue));
306
+ const endDate = new Date(Date.parse(this.endDateValue));
307
+ for (var d = startDate; d <= endDate; d.setDate(d.getDate() + 1)) {
308
+ const i = this.daysArr.findIndex(item => parseInt(item.value) === d.getDay());
309
+ if ((_a = this.daysArr[i]) === null || _a === void 0 ? void 0 : _a.selected) {
310
+ const year = d.getFullYear();
311
+ const month = (d.getMonth() + 1).toString().padStart(2, '0');
312
+ const day = d.getDate().toString().padStart(2, '0');
313
+ this.generatedDatesArr.push(`${year}-${month}-${day}`);
314
+ }
315
+ }
316
+ }
317
+ }
318
+ deleteGeneratedDateRow(index) {
319
+ this.generatedDatesArr.splice(index, 1);
320
+ this.generatedDatesArr = [...this.generatedDatesArr];
321
+ }
322
+ saveGeneratedDates() {
323
+ var _a;
324
+ if ((_a = this.generatedDatesArr) === null || _a === void 0 ? void 0 : _a.length) {
325
+ this.dateValue = String(this.generatedDatesArr);
326
+ const dateCount = this.generatedDatesArr.length;
327
+ const buttonTextElm = this.pnShowDateRangeFiledButton.querySelector('.pn-button-content');
328
+ buttonTextElm.innerHTML = dateCount > 0 ? `${this.dateButtonText} (${dateCount})` : this.dateButtonText;
329
+ this.showDateRangeRow();
330
+ }
331
+ }
332
+ setSingleDateValue(e) {
333
+ const elm = e.target;
334
+ if (elm === this.pnSingleDatePicker) {
335
+ this.dateValue = e.detail;
336
+ }
337
+ }
338
+ emittRowValues() {
339
+ this.rowValueChange.emit({
340
+ id: this._predefinedValue.id,
341
+ buttons: this.buttonsArray,
342
+ firstDropdown: this.firstDropdownArr,
343
+ secondDropdown: this.secondDropdownArr,
344
+ input: this.inputFieldValue,
345
+ dates: this.dateValue,
346
+ dateRange: {
347
+ days: this.daysArr,
348
+ startDate: this.starDateValue,
349
+ endDate: this.endDateValue,
350
+ },
351
+ });
352
+ }
353
+ deleteRow() {
354
+ this.deleteRowEvent.emit(this._predefinedValue.id);
355
+ }
356
+ setActive(active) {
357
+ return active ? 'connected-dropdown__button active' : 'connected-dropdown__button';
358
+ }
359
+ render() {
360
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
361
+ return (h(Host, null, h("div", { ref: el => (this.pnConnectedDropdownSlotElement = el), class: "connected-dropdown-slot-element" }, h("div", { class: "connected-dropdown-parent-element connected-dropdown" }, h("div", { class: "connected-dropdown__row__no-margin" }, h("label", null, this.label)), h("div", { class: "connected-dropdown__row button-row" }, h("div", { class: "connected-dropdown__button-container option-buttons" }, (_a = this.buttonsArray) === null || _a === void 0 ? void 0 : _a.map(item => (h("button", { class: `${this.setActive(item.selected)}`, id: this.generateUniqueId(), onClick: this.handleOptionButtonClick.bind(this) }, item.value)))), h("div", { class: "connected-dropdown__button-container delete-button" }, this.index > 0 ? (h("pn-button", { ref: el => (this.pnDeleteRowButton = el), small: "true", "icon-only": "true", icon: "minus", appearance: "warning", index: this.index }, "Delete")) : null)), h("div", { class: "connected-dropdown__row input-row" }, h("pn-select", { ref: el => (this.pnFirstDropdown = el), class: "pn-row-select-dropdown dropDown1-dropdown", placeholder: this.firstDropdownPlaceholder, label: this.firstDropdownLabel }, (_b = this.firstDropdownArr) === null || _b === void 0 ? void 0 : _b.map((item, i) => (h("pn-option", { index: i, value: item.value, selected: item.selected, onClick: debounce_1.debounce(this.handleFirstDropdownChange.bind(this), 500) }, item.value)))), h("pn-select", { ref: el => (this.pnSecondDropdown = el), class: "pn-row-select-dropdown dropDown2-dropdown", placeholder: this.secondDropdownPlaceholder, label: this.secondDropdownLabel }, (_c = this.secondDropdownArr) === null || _c === void 0 ? void 0 : _c.map((item, i) => (h("pn-option", { index: i, value: item.value, selected: item.selected, onClick: debounce_1.debounce(this.handleSecondDropdownChange.bind(this), 500) }, item.value)))), h("pn-marketweb-input", { ref: el => (this.pnInputField = el), type: "number", placeholder: "0", label: this.inputFildLabel, value: this.inputFieldValue, min: "1" }), this.allowMultipleDates ? (h("pn-button", { ref: el => (this.pnShowDateRangeFiledButton = el), class: "connected-dropdown__toggle-date-button", small: "true", appearance: "light" }, this.dateButtonText)) : (h("div", { class: "connected-dropdown__date-container" }, h("div", { class: "connected-dropdown__label-container" }, h("label", null, this.dateButtonText)), h("pn-date-picker", { ref: el => (this.pnSingleDatePicker = el), range: "false", "disable-weekends": true, "min-date": this.firstValidDateString, language: this.languageCode, placeholder: this.datePlaceholder, class: "connected-dropdown__date-picker", start: ((_d = this.dateValue) === null || _d === void 0 ? void 0 : _d.length) ? this.dateValue : null })))), this.allowMultipleDates ? (h("div", { ref: el => (this.pnDateRangeContainer = el), class: "connected-dropdown__date-container", style: { display: 'none' } }, this.multiDateHelperText ? (h("div", { class: "connected-dropdown__row" }, h("p", null, this.multiDateHelperText))) : null, h("div", { class: "connected-dropdown__multi-date-row" }, h("div", { class: "connected-dropdown__date-container" }, h("div", { class: "connected-dropdown__label-container" }, h("label", null, this.startDateLabel)), h("pn-date-picker", { ref: el => (this.pnStartDate = el), range: "false", "disable-weekends": true, class: "connected-dropdown__date-picker", "min-date": this.firstValidDateString, "max-date": this.lastValidDateString, language: this.languageCode, placeholder: this.datePlaceholder, start: ((_e = this.starDateValue) === null || _e === void 0 ? void 0 : _e.length) ? this.starDateValue : null })), h("div", { class: "connected-dropdown__date-container" }, h("div", { class: "connected-dropdown__label-container" }, h("label", null, this.endDateLabel)), h("pn-date-picker", { ref: el => (this.pnEndDate = el), range: "false", "disable-weekends": true, class: "connected-dropdown__date-picker", "min-date": this.firstValidDateString, "max-date": this.lastValidDateString, language: this.languageCode, placeholder: this.datePlaceholder, start: ((_f = this.endDateValue) === null || _f === void 0 ? void 0 : _f.length) ? this.endDateValue : null }))), h("div", { ref: el => (this.pnDaysRow = el), class: "connected-dropdown__multi-date-row" }, (_g = this.daysArr) === null || _g === void 0 ? void 0 : _g.map((day) => (h("div", { class: "connected-dropdown__checkbox" }, h("pn-filter-checkbox", { checkboxid: 'day-' + day.value, name: '__' + day.caption, value: day.value, checked: day.selected }), h("label", { htmlFor: 'day-' + day.value }, day.caption))))), h("div", { class: "connected-dropdown__row" }, h("pn-button", { ref: el => (this.pnGenerateDatesButton = el), small: "true" }, this.generateDatesButtonText)), h("div", { ref: el => (this.pnGeneratedDatesSlot = el), class: "connected-dropdown__date-slot" }, (_h = this.generatedDatesArr) === null || _h === void 0 ? void 0 :
362
+ _h.map((date, i) => (h("div", { class: "connected-dropdown__row generated-date-row" }, h("p", null, date), h("pn-button", { index: i, small: "true", "icon-only": "true", icon: "minus", appearance: "warning", id: 'delete-date-' + i, onClick: this.deleteGeneratedDateRow.bind(this, i) }, date)))), !((_j = this.generatedDatesArr) === null || _j === void 0 ? void 0 : _j.length) ? h("p", null, this.noDatesText) : null), h("div", { class: "connected-dropdown__row" }, h("pn-button", { ref: el => (this.pnSaveGeneratedDatesButton = el), class: "connected-dropdown__button-right", small: "true" }, this.saveDateButtonText)))) : null))));
363
+ }
364
+ get hostElement() { return this; }
365
+ static get watchers() { return {
366
+ "predefinedValue": ["applyPredefinedValue"]
367
+ }; }
368
+ static get style() { return pnMultiRowConnectedDropdownRowCss; }
369
+ }, [0, "pn-multi-row-connected-dropdown-row", {
370
+ "dropdownData": [1, "dropdown-data"],
371
+ "languageCode": [1, "language-code"],
372
+ "label": [1],
373
+ "firstDropdownLabel": [1, "first-dropdown-label"],
374
+ "secondDropdownLabel": [1, "second-dropdown-label"],
375
+ "dropdownPlaceholder": [1, "dropdown-placeholder"],
376
+ "addRowText": [1, "add-row-text"],
377
+ "inputFildLabel": [1, "input-fild-label"],
378
+ "inputFildPlaceholder": [1, "input-fild-placeholder"],
379
+ "dateButtonText": [1, "date-button-text"],
380
+ "datePlaceholder": [1, "date-placeholder"],
381
+ "dateDaysFromToday": [2, "date-days-from-today"],
382
+ "allowMultipleDates": [4, "allow-multiple-dates"],
383
+ "startDateLabel": [1, "start-date-label"],
384
+ "endDateLabel": [1, "end-date-label"],
385
+ "multiDateHelperText": [1, "multi-date-helper-text"],
386
+ "generateDatesButtonText": [1, "generate-dates-button-text"],
387
+ "saveDateButtonText": [1, "save-date-button-text"],
388
+ "noDatesText": [1, "no-dates-text"],
389
+ "index": [2],
390
+ "predefinedValue": [1, "predefined-value"],
391
+ "yearsToAddToEndDate": [2, "years-to-add-to-end-date"],
392
+ "buttonsArray": [32],
393
+ "firstDropdownArr": [32],
394
+ "secondDropdownArr": [32],
395
+ "firstDropdownClass": [32],
396
+ "secondDropdownClass": [32],
397
+ "firstValidDateString": [32],
398
+ "lastValidDateString": [32],
399
+ "firstDropdownPlaceholder": [32],
400
+ "secondDropdownPlaceholder": [32],
401
+ "starDateValue": [32],
402
+ "endDateValue": [32],
403
+ "generatedDatesArr": [32],
404
+ "selectedButtonValue": [32],
405
+ "inputFieldValue": [32],
406
+ "dateValue": [32],
407
+ "daysArr": [32]
408
+ }]);
409
+ function defineCustomElement() {
410
+ if (typeof customElements === "undefined") {
411
+ return;
412
+ }
413
+ const components = ["pn-multi-row-connected-dropdown-row", "pn-filter-checkbox", "pn-marketweb-input"];
414
+ components.forEach(tagName => { switch (tagName) {
415
+ case "pn-multi-row-connected-dropdown-row":
416
+ if (!customElements.get(tagName)) {
417
+ customElements.define(tagName, PnMultiRowConnectedDropdownRow);
418
+ }
419
+ break;
420
+ case "pn-filter-checkbox":
421
+ if (!customElements.get(tagName)) {
422
+ defineCustomElement$2();
423
+ }
424
+ break;
425
+ case "pn-marketweb-input":
426
+ if (!customElements.get(tagName)) {
427
+ defineCustomElement$1();
428
+ }
429
+ break;
430
+ } });
431
+ }
432
+ defineCustomElement();
433
+
434
+ export { PnMultiRowConnectedDropdownRow as P, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface PnMultiRowConnectedDropdown extends Components.PnMultiRowConnectedDropdown, HTMLElement {}
4
+ export const PnMultiRowConnectedDropdown: {
5
+ prototype: PnMultiRowConnectedDropdown;
6
+ new (): PnMultiRowConnectedDropdown;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;