@postnord/pn-marketweb-components 2.4.17 → 2.4.19

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 (72) hide show
  1. package/cjs/index-4199ff85.js +12 -4
  2. package/cjs/index-e4882728.js +72 -0
  3. package/cjs/loader.cjs.js +1 -1
  4. package/cjs/pn-app-banner.cjs.entry.js +46 -0
  5. package/cjs/pn-date-and-time.cjs.entry.js +1 -1
  6. package/cjs/pn-dropdown-choice-adds-row.cjs.entry.js +254 -0
  7. package/cjs/pn-market-web-components.cjs.js +1 -1
  8. package/cjs/pn-multi-formfield.cjs.entry.js +2 -70
  9. package/collection/collection-manifest.json +2 -0
  10. package/collection/components/input/pn-date-and-time/pn-date-and-time.css +2 -1
  11. package/collection/components/input/pn-dropdown-choice-adds-row/pn-dropdown-choice-adds-row.css +58 -0
  12. package/collection/components/input/pn-dropdown-choice-adds-row/pn-dropdown-choice-adds-row.js +508 -0
  13. package/collection/components/input/pn-dropdown-choice-adds-row/pn-dropdown-choice-adds-row.stories.js +43 -0
  14. package/collection/components/input/pn-dropdown-choice-adds-row/types.js +1 -0
  15. package/collection/components/minor/pn-app-banner/pn-app-banner.css +35 -0
  16. package/collection/components/minor/pn-app-banner/pn-app-banner.js +141 -0
  17. package/collection/components/minor/pn-app-banner/pn-app-banner.stories.js +31 -0
  18. package/components/index.d.ts +2 -0
  19. package/components/index.js +2 -0
  20. package/components/index3.js +61 -178
  21. package/components/index4.js +187 -0
  22. package/components/pn-app-banner.d.ts +11 -0
  23. package/components/pn-app-banner.js +68 -0
  24. package/components/pn-date-and-time.js +1 -1
  25. package/components/pn-dropdown-choice-adds-row.d.ts +11 -0
  26. package/components/pn-dropdown-choice-adds-row.js +292 -0
  27. package/components/pn-find-price-result2.js +1 -1
  28. package/components/pn-find-service-and-price-result2.js +1 -1
  29. package/components/pn-mainnav-store.js +1 -1
  30. package/components/pn-marketweb-siteheader-login-linklist2.js +1 -1
  31. package/components/pn-marketweb-siteheader-search2.js +1 -1
  32. package/components/pn-multi-formfield.js +1 -69
  33. package/components/pn-product-pricelist-result.js +1 -1
  34. package/components/pn-profile-modal-store.js +1 -1
  35. package/components/pn-proxio-findprice.js +1 -1
  36. package/components/pn-sidenav-store.js +1 -1
  37. package/esm/index-8976f360.js +70 -0
  38. package/esm/index-ee44c065.js +12 -4
  39. package/esm/loader.js +1 -1
  40. package/esm/pn-app-banner.entry.js +42 -0
  41. package/esm/pn-date-and-time.entry.js +1 -1
  42. package/esm/pn-dropdown-choice-adds-row.entry.js +250 -0
  43. package/esm/pn-market-web-components.js +1 -1
  44. package/esm/pn-multi-formfield.entry.js +1 -69
  45. package/esm-es5/index-8976f360.js +1 -0
  46. package/esm-es5/index-ee44c065.js +1 -1
  47. package/esm-es5/loader.js +1 -1
  48. package/esm-es5/pn-app-banner.entry.js +1 -0
  49. package/esm-es5/pn-date-and-time.entry.js +1 -1
  50. package/esm-es5/pn-dropdown-choice-adds-row.entry.js +1 -0
  51. package/esm-es5/pn-market-web-components.js +1 -1
  52. package/esm-es5/pn-multi-formfield.entry.js +1 -1
  53. package/package.json +1 -1
  54. package/pn-market-web-components/p-07e0a50f.entry.js +1 -0
  55. package/pn-market-web-components/p-196b2316.system.entry.js +1 -0
  56. package/pn-market-web-components/p-296637c0.system.js +1 -0
  57. package/pn-market-web-components/p-3a897643.system.entry.js +1 -0
  58. package/pn-market-web-components/p-4e3d7a56.js +1 -0
  59. package/pn-market-web-components/p-4e7d4e69.entry.js +1 -0
  60. package/pn-market-web-components/p-6de99b6a.system.entry.js +1 -0
  61. package/pn-market-web-components/{p-8ac445d6.entry.js → p-76ce7256.entry.js} +1 -1
  62. package/pn-market-web-components/p-c0961278.system.entry.js +1 -0
  63. package/pn-market-web-components/p-e5d9f268.entry.js +1 -0
  64. package/pn-market-web-components/p-fcdb7381.system.js +1 -1
  65. package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
  66. package/types/components/input/pn-dropdown-choice-adds-row/pn-dropdown-choice-adds-row.d.ts +43 -0
  67. package/types/components/input/pn-dropdown-choice-adds-row/types.d.ts +18 -0
  68. package/types/components/minor/pn-app-banner/pn-app-banner.d.ts +14 -0
  69. package/types/components.d.ts +66 -0
  70. package/pn-market-web-components/p-14d13eaa.system.entry.js +0 -1
  71. package/pn-market-web-components/p-f7867310.entry.js +0 -1
  72. package/pn-market-web-components/p-fbae553c.system.entry.js +0 -1
@@ -0,0 +1,508 @@
1
+ import { h, Host } from '@stencil/core';
2
+ import { debounce } from 'debounce';
3
+ export class pnDropdownChoiceAddsRow {
4
+ constructor() {
5
+ this.pnRowSelectDropdown = null;
6
+ this.tableHead = null;
7
+ this.tableBody = null;
8
+ this.formRowEvent = e => {
9
+ var _a;
10
+ const debouncedAddValue = debounce(this.updateHiddenFieldValue.bind(this), 500);
11
+ if (e.target.matches('input')) {
12
+ ['change', 'keyup'].forEach(eventName => {
13
+ e.target.addEventListener(eventName, debouncedAddValue);
14
+ });
15
+ }
16
+ else {
17
+ const rowDropdown = (_a = e.target.closest('.generated-table-row')) === null || _a === void 0 ? void 0 : _a.querySelector('pn-select');
18
+ if (rowDropdown) {
19
+ rowDropdown.addEventListener('selectchange', debouncedAddValue);
20
+ }
21
+ }
22
+ };
23
+ this.dropdownData = null;
24
+ this.addRowDropdownName = '';
25
+ this.addRowDropdownPlaceholder = '';
26
+ this.addRowDropdownLabel = '';
27
+ this.rowNameLabel = '';
28
+ this.rowHasDropdown = true;
29
+ this.rowDropdownLabel = '';
30
+ this.rowDropdownPlaceholder = '';
31
+ this.rowInputLabel = '';
32
+ this.rowDeleteButtonText = '';
33
+ this.totalInputLimit = 0;
34
+ this.inputLimitWarning = null;
35
+ this.nextRowIndex = null;
36
+ this.rowSelectDropdownArr = null;
37
+ this.columnCount = null;
38
+ this.showWarning = false;
39
+ this.formValue = null;
40
+ }
41
+ dropdownDataWatcher() {
42
+ if (typeof this.dropdownData === 'string') {
43
+ this._dropdownData = JSON.parse(this.dropdownData);
44
+ }
45
+ else {
46
+ this._dropdownData = this.dropdownData;
47
+ }
48
+ }
49
+ componentWillLoad() {
50
+ this.dropdownDataWatcher();
51
+ }
52
+ componentDidLoad() {
53
+ this.setInitialValues();
54
+ this.addEventHandlers();
55
+ }
56
+ addEventHandlers() {
57
+ this.pnRowSelectDropdown.addEventListener('selectchange', this.addRowElement.bind(this));
58
+ }
59
+ setInitialValues() {
60
+ this.nextRowIndex = 0;
61
+ this.columnCount = this.rowHasDropdown ? 4 : 3;
62
+ this.setRowSelectDropdownArr();
63
+ }
64
+ setRowSelectDropdownArr() {
65
+ this.rowSelectDropdownArr = [];
66
+ this._dropdownData.forEach(element => {
67
+ this.rowSelectDropdownArr.push(element.caption);
68
+ });
69
+ }
70
+ updateHiddenFieldValue() {
71
+ const allRows = [...this.tableBody.querySelectorAll('tr')];
72
+ const columnValueCount = this.rowHasDropdown ? 3 : 2;
73
+ const formValues = [];
74
+ if (allRows.length) {
75
+ allRows.forEach(elm => {
76
+ var _a, _b, _c;
77
+ const row = { row: [] };
78
+ const nameElm = elm.querySelector('.tr-name');
79
+ const dropdownElm = elm.querySelector('.tr-dropdown');
80
+ const inputElm = elm.querySelector('.tr-input');
81
+ const nameValue = { name: this.rowNameLabel, value: nameElm === null || nameElm === void 0 ? void 0 : nameElm.innerHTML };
82
+ row.row.push(nameValue);
83
+ const dropdown = dropdownElm.querySelector('.current-selection');
84
+ if (dropdown) {
85
+ const dropdownSelection = (_a = dropdown.textContent) !== null && _a !== void 0 ? _a : '';
86
+ if (dropdownSelection.length) {
87
+ const dropdownValue = {
88
+ name: this.rowDropdownLabel,
89
+ value: dropdownSelection,
90
+ };
91
+ row.row.push(dropdownValue);
92
+ }
93
+ }
94
+ if (!dropdown && columnValueCount === 3) {
95
+ const dropdownValue = {
96
+ name: this.rowDropdownLabel,
97
+ value: '',
98
+ };
99
+ row.row.push(dropdownValue);
100
+ }
101
+ const inputValue = parseInt((_c = (_b = inputElm.querySelector('input')) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : '0');
102
+ if (inputValue > 0) {
103
+ const inputColumnValue = { name: this.rowInputLabel, value: inputValue.toString() };
104
+ row.row.push(inputColumnValue);
105
+ }
106
+ if (row.row.length === columnValueCount) {
107
+ formValues.push(row);
108
+ }
109
+ });
110
+ }
111
+ if (formValues.length && formValues.length === allRows.length) {
112
+ const valueJsonString = JSON.stringify(formValues);
113
+ this.formValue = `PN-JSON|${valueJsonString}`;
114
+ }
115
+ else {
116
+ this.formValue = '';
117
+ }
118
+ this.rowvalues.emit(this.formValue);
119
+ this.checkInputTotal();
120
+ }
121
+ addRowElement() {
122
+ const selected = this.pnRowSelectDropdown.querySelector('.current-selection .pn-option-content');
123
+ const selectedValue = selected === null || selected === void 0 ? void 0 : selected.textContent;
124
+ const slotElm = this.tableBody;
125
+ const newRow = document.createElement('tr');
126
+ newRow.setAttribute('index', `${this.nextRowIndex}`);
127
+ newRow.setAttribute('class', 'generated-table-row');
128
+ newRow.onclick = e => this.formRowEvent(e);
129
+ const rowNameColumn = document.createElement('td');
130
+ rowNameColumn.setAttribute('class', 'tr-name');
131
+ rowNameColumn.innerHTML = selectedValue;
132
+ newRow.appendChild(rowNameColumn);
133
+ if (this.rowHasDropdown) {
134
+ const rowDropdownColumn = this.createDropdownColumn(selectedValue);
135
+ newRow.appendChild(rowDropdownColumn);
136
+ }
137
+ const rowInputColumn = this.createInputColumn(selectedValue);
138
+ newRow.appendChild(rowInputColumn);
139
+ const deleteButton = this.createDeleteButtonColumn();
140
+ newRow.appendChild(deleteButton);
141
+ slotElm.appendChild(newRow);
142
+ this.updateRowSelectDropdown();
143
+ this.nextRowIndex++;
144
+ }
145
+ createDropdownColumn(selectedValue) {
146
+ const dropdownColumn = document.createElement('td');
147
+ dropdownColumn.setAttribute('class', 'tr-dropdown');
148
+ const selectedItem = this._dropdownData.find(arr => arr.caption === selectedValue);
149
+ if (Array.isArray(selectedItem.values) && selectedItem.values.length) {
150
+ const dropdown = document.createElement('pn-select');
151
+ dropdown.setAttribute('name', `${selectedValue}-dropdown`);
152
+ dropdown.setAttribute('placeholder', this.rowDropdownPlaceholder);
153
+ selectedItem.values.forEach(childItem => {
154
+ const childOption = document.createElement('pn-option');
155
+ childOption.innerHTML = childItem.caption;
156
+ dropdown.appendChild(childOption);
157
+ });
158
+ dropdownColumn.appendChild(dropdown);
159
+ }
160
+ return dropdownColumn;
161
+ }
162
+ createInputColumn(selectedValue) {
163
+ const inputColumn = document.createElement('td');
164
+ inputColumn.setAttribute('class', 'tr-input');
165
+ const inputElm = document.createElement('pn-marketweb-input');
166
+ inputElm.setAttribute('type', 'number');
167
+ inputElm.setAttribute('name', `${selectedValue}-input`);
168
+ inputElm.setAttribute('placeholder', '0');
169
+ inputColumn.appendChild(inputElm);
170
+ return inputColumn;
171
+ }
172
+ createDeleteButtonColumn() {
173
+ const buttonColumn = document.createElement('td');
174
+ buttonColumn.setAttribute('class', 'tr-delete');
175
+ const buttonElm = document.createElement('pn-button');
176
+ buttonElm.onclick = e => this.deleteRow(e);
177
+ buttonElm.setAttribute('appearance', 'warning');
178
+ buttonElm.setAttribute('small', 'true');
179
+ buttonElm.appendChild(document.createTextNode(this.rowDeleteButtonText));
180
+ buttonColumn.appendChild(buttonElm);
181
+ return buttonColumn;
182
+ }
183
+ updateRowSelectDropdown() {
184
+ const rowNames = [].map.call(this.tableBody.querySelectorAll('.tr-name'), el => {
185
+ return el.innerHTML;
186
+ });
187
+ if (rowNames.length) {
188
+ this.rowSelectDropdownArr = [];
189
+ this._dropdownData.forEach(element => {
190
+ if (!rowNames.includes(element.caption)) {
191
+ this.rowSelectDropdownArr.push(element.caption);
192
+ }
193
+ });
194
+ }
195
+ else {
196
+ this.setRowSelectDropdownArr();
197
+ }
198
+ const selectOptions = this.pnRowSelectDropdown.querySelectorAll('pn-option');
199
+ selectOptions.forEach(elm => {
200
+ elm.removeAttribute('selected');
201
+ });
202
+ const placeholder = this.pnRowSelectDropdown.querySelector('.pn-option-content');
203
+ placeholder.innerHTML = this.addRowDropdownPlaceholder;
204
+ this.updateHiddenFieldValue();
205
+ }
206
+ deleteRow(e) {
207
+ e.preventDefault();
208
+ this.nextRowIndex--;
209
+ const targetElm = e.currentTarget;
210
+ const targetRow = targetElm.closest('tr');
211
+ targetRow.remove();
212
+ const allRows = [...this.tableBody.querySelectorAll('tr')];
213
+ allRows.map((elm, index) => {
214
+ elm.setAttribute('index', `${index}`);
215
+ });
216
+ this.updateRowSelectDropdown();
217
+ }
218
+ checkInputTotal() {
219
+ const allRows = this.tableBody.querySelectorAll('tr');
220
+ if (this.totalInputLimit === 0 || allRows.length < 1) {
221
+ this.showWarning = false;
222
+ return;
223
+ }
224
+ let totalInput = 0;
225
+ allRows.forEach(element => {
226
+ var _a;
227
+ const inputField = element.querySelector('pn-marketweb-input');
228
+ if (inputField.value) {
229
+ totalInput += (_a = parseInt(inputField.value)) !== null && _a !== void 0 ? _a : 0;
230
+ }
231
+ });
232
+ this.showWarning = totalInput > this.totalInputLimit ? true : false;
233
+ }
234
+ render() {
235
+ var _a;
236
+ return (h(Host, null, h("div", { class: "dropdown-choice-form-row" }, h("pn-select", { ref: el => (this.pnRowSelectDropdown = el), name: this.addRowDropdownName, placeholder: this.addRowDropdownPlaceholder, label: this.addRowDropdownLabel, class: "pn-row-select-dropdown" }, (_a = this.rowSelectDropdownArr) === null || _a === void 0 ? void 0 : _a.map((value) => (h("pn-option", null, value))))), h("div", { class: "dropdown-choice-form-row" }, h("table", { class: "pn-dropdown-choice-table" }, h("thead", { ref: el => (this.tableHead = el) }, this.nextRowIndex === 0 ? null : (h("tr", null, h("th", { class: "table-header--name" }, h("label", null, this.rowNameLabel)), this.rowHasDropdown ? (h("th", { class: "table-header--dropdown" }, h("label", null, this.rowDropdownLabel))) : null, h("th", { class: "table-header--input" }, h("label", null, this.rowInputLabel)), h("th", { class: "table-header--delete" })))), h("tbody", { ref: el => (this.tableBody = el), class: "pn-dropdown-choice-table-slot" }, h("slot", null)), h("tfoot", null, this.showWarning ? (h("tr", null, h("td", { colSpan: this.columnCount }, h("pn-icon", { symbol: "alert-exclamation-circle", small: true, color: "warning" }), h("small", { class: "dropdown-choice-error-message" }, this.inputLimitWarning)))) : null)))));
237
+ }
238
+ static get is() { return "pn-dropdown-choice-adds-row"; }
239
+ static get originalStyleUrls() {
240
+ return {
241
+ "$": ["pn-dropdown-choice-adds-row.scss"]
242
+ };
243
+ }
244
+ static get styleUrls() {
245
+ return {
246
+ "$": ["pn-dropdown-choice-adds-row.css"]
247
+ };
248
+ }
249
+ static get properties() {
250
+ return {
251
+ "dropdownData": {
252
+ "type": "string",
253
+ "mutable": false,
254
+ "complexType": {
255
+ "original": "string | Root[]",
256
+ "resolved": "Root[] | string",
257
+ "references": {
258
+ "Root": {
259
+ "location": "import",
260
+ "path": "./types"
261
+ }
262
+ }
263
+ },
264
+ "required": false,
265
+ "optional": false,
266
+ "docs": {
267
+ "tags": [],
268
+ "text": ""
269
+ },
270
+ "attribute": "dropdown-data",
271
+ "reflect": false,
272
+ "defaultValue": "null"
273
+ },
274
+ "addRowDropdownName": {
275
+ "type": "string",
276
+ "mutable": false,
277
+ "complexType": {
278
+ "original": "string",
279
+ "resolved": "string",
280
+ "references": {}
281
+ },
282
+ "required": false,
283
+ "optional": false,
284
+ "docs": {
285
+ "tags": [],
286
+ "text": ""
287
+ },
288
+ "attribute": "add-row-dropdown-name",
289
+ "reflect": false,
290
+ "defaultValue": "''"
291
+ },
292
+ "addRowDropdownPlaceholder": {
293
+ "type": "string",
294
+ "mutable": false,
295
+ "complexType": {
296
+ "original": "string",
297
+ "resolved": "string",
298
+ "references": {}
299
+ },
300
+ "required": false,
301
+ "optional": false,
302
+ "docs": {
303
+ "tags": [],
304
+ "text": ""
305
+ },
306
+ "attribute": "add-row-dropdown-placeholder",
307
+ "reflect": false,
308
+ "defaultValue": "''"
309
+ },
310
+ "addRowDropdownLabel": {
311
+ "type": "string",
312
+ "mutable": false,
313
+ "complexType": {
314
+ "original": "string",
315
+ "resolved": "string",
316
+ "references": {}
317
+ },
318
+ "required": false,
319
+ "optional": false,
320
+ "docs": {
321
+ "tags": [],
322
+ "text": ""
323
+ },
324
+ "attribute": "add-row-dropdown-label",
325
+ "reflect": false,
326
+ "defaultValue": "''"
327
+ },
328
+ "rowNameLabel": {
329
+ "type": "string",
330
+ "mutable": false,
331
+ "complexType": {
332
+ "original": "string",
333
+ "resolved": "string",
334
+ "references": {}
335
+ },
336
+ "required": false,
337
+ "optional": false,
338
+ "docs": {
339
+ "tags": [],
340
+ "text": ""
341
+ },
342
+ "attribute": "row-name-label",
343
+ "reflect": false,
344
+ "defaultValue": "''"
345
+ },
346
+ "rowHasDropdown": {
347
+ "type": "boolean",
348
+ "mutable": false,
349
+ "complexType": {
350
+ "original": "boolean",
351
+ "resolved": "boolean",
352
+ "references": {}
353
+ },
354
+ "required": false,
355
+ "optional": false,
356
+ "docs": {
357
+ "tags": [],
358
+ "text": ""
359
+ },
360
+ "attribute": "row-has-dropdown",
361
+ "reflect": false,
362
+ "defaultValue": "true"
363
+ },
364
+ "rowDropdownLabel": {
365
+ "type": "string",
366
+ "mutable": false,
367
+ "complexType": {
368
+ "original": "string",
369
+ "resolved": "string",
370
+ "references": {}
371
+ },
372
+ "required": false,
373
+ "optional": false,
374
+ "docs": {
375
+ "tags": [],
376
+ "text": ""
377
+ },
378
+ "attribute": "row-dropdown-label",
379
+ "reflect": false,
380
+ "defaultValue": "''"
381
+ },
382
+ "rowDropdownPlaceholder": {
383
+ "type": "string",
384
+ "mutable": false,
385
+ "complexType": {
386
+ "original": "string",
387
+ "resolved": "string",
388
+ "references": {}
389
+ },
390
+ "required": false,
391
+ "optional": false,
392
+ "docs": {
393
+ "tags": [],
394
+ "text": ""
395
+ },
396
+ "attribute": "row-dropdown-placeholder",
397
+ "reflect": false,
398
+ "defaultValue": "''"
399
+ },
400
+ "rowInputLabel": {
401
+ "type": "string",
402
+ "mutable": false,
403
+ "complexType": {
404
+ "original": "string",
405
+ "resolved": "string",
406
+ "references": {}
407
+ },
408
+ "required": false,
409
+ "optional": false,
410
+ "docs": {
411
+ "tags": [],
412
+ "text": ""
413
+ },
414
+ "attribute": "row-input-label",
415
+ "reflect": false,
416
+ "defaultValue": "''"
417
+ },
418
+ "rowDeleteButtonText": {
419
+ "type": "string",
420
+ "mutable": false,
421
+ "complexType": {
422
+ "original": "string",
423
+ "resolved": "string",
424
+ "references": {}
425
+ },
426
+ "required": false,
427
+ "optional": false,
428
+ "docs": {
429
+ "tags": [],
430
+ "text": ""
431
+ },
432
+ "attribute": "row-delete-button-text",
433
+ "reflect": false,
434
+ "defaultValue": "''"
435
+ },
436
+ "totalInputLimit": {
437
+ "type": "number",
438
+ "mutable": false,
439
+ "complexType": {
440
+ "original": "number",
441
+ "resolved": "number",
442
+ "references": {}
443
+ },
444
+ "required": false,
445
+ "optional": false,
446
+ "docs": {
447
+ "tags": [],
448
+ "text": ""
449
+ },
450
+ "attribute": "total-input-limit",
451
+ "reflect": false,
452
+ "defaultValue": "0"
453
+ },
454
+ "inputLimitWarning": {
455
+ "type": "string",
456
+ "mutable": false,
457
+ "complexType": {
458
+ "original": "string",
459
+ "resolved": "string",
460
+ "references": {}
461
+ },
462
+ "required": false,
463
+ "optional": false,
464
+ "docs": {
465
+ "tags": [],
466
+ "text": ""
467
+ },
468
+ "attribute": "input-limit-warning",
469
+ "reflect": false,
470
+ "defaultValue": "null"
471
+ }
472
+ };
473
+ }
474
+ static get states() {
475
+ return {
476
+ "nextRowIndex": {},
477
+ "rowSelectDropdownArr": {},
478
+ "columnCount": {},
479
+ "showWarning": {},
480
+ "formValue": {}
481
+ };
482
+ }
483
+ static get events() {
484
+ return [{
485
+ "method": "rowvalues",
486
+ "name": "rowvalues",
487
+ "bubbles": true,
488
+ "cancelable": true,
489
+ "composed": true,
490
+ "docs": {
491
+ "tags": [],
492
+ "text": ""
493
+ },
494
+ "complexType": {
495
+ "original": "string",
496
+ "resolved": "string",
497
+ "references": {}
498
+ }
499
+ }];
500
+ }
501
+ static get elementRef() { return "hostElement"; }
502
+ static get watchers() {
503
+ return [{
504
+ "propName": "dropdownData",
505
+ "methodName": "dropdownDataWatcher"
506
+ }];
507
+ }
508
+ }
@@ -0,0 +1,43 @@
1
+ import readme from './readme.md';
2
+
3
+ export default {
4
+ title: 'input/Dropdownlist choice adds new row',
5
+ parameters: {
6
+ notes: readme,
7
+ },
8
+ };
9
+
10
+ const Template = ({ ...args }) => {
11
+ return `
12
+ <pn-dropdown-choice-adds-row
13
+ dropdown-data='${args.dropdownData}'
14
+ add-row-dropdown-label="${args.addRowDropdownLabel}"
15
+ add-row-dropdown-placeholder="${args.addRowDropdownPlaceholder}"
16
+ row-name-label="${args.rowNameLabel}"
17
+ row-has-dropdown="${args.rowHasDropdown}"
18
+ row-dropdown-label="${args.rowDropdownLabel}"
19
+ row-dropdown-placeholder="${args.rowDropdownPlaceholder}"
20
+ row-input-label="${args.rowInputLabel}"
21
+ row-delete-button-text="${args.rowDeleteButtonText}"
22
+ total-input-limit="${args.totalInputLimit}"
23
+ input-limit-warning="${args.inputLimitWarning}"
24
+ >
25
+ </pn-dropdown-choice-adds-row>`;
26
+ };
27
+
28
+ export const Primary = Template.bind({});
29
+ Primary.args = {
30
+ dropdownData:
31
+ '[{"caption":"First","value":"first","values":[{"caption":"First-child 1","value":"First-child 1"},{"caption":"First-child 2","value":"First-child 2"}]},{"caption":"Second","value":"second","values":[{"caption":"Second-child 1","value":"Second-child 1"},{"caption":"Second-child 2","value":"Second-child 2"}]},{"caption":"Third","value":"Third","values":[]}]',
32
+ addRowDropdownName: '__addrowdropdown',
33
+ addRowDropdownPlaceholder: '-- Vaelg her --',
34
+ addRowDropdownLabel: 'Produkter til afhentning:*',
35
+ rowNameLabel: 'Produkt',
36
+ rowHasDropdown: true,
37
+ rowDropdownLabel: 'Transportenhed',
38
+ rowDropdownPlaceholder: '-- Vaelg her --',
39
+ rowInputLabel: 'Antal',
40
+ rowDeleteButtonText: 'Slet',
41
+ totalInputLimit: 30,
42
+ inputLimitWarning: 'warning',
43
+ };
@@ -0,0 +1,35 @@
1
+ pn-app-banner .pn-app-banner__wrapper {
2
+ display: flex;
3
+ flex-direction: row;
4
+ justify-content: flex-start;
5
+ align-items: center;
6
+ gap: 1rem;
7
+ background-color: #F3F2F2;
8
+ padding: 1rem;
9
+ margin: 0 auto;
10
+ }
11
+ pn-app-banner .pn-app-banner__sticky {
12
+ position: relative;
13
+ top: 0;
14
+ width: 100%;
15
+ z-index: 999;
16
+ }
17
+ pn-app-banner .icon-close:hover {
18
+ cursor: pointer;
19
+ }
20
+ pn-app-banner .pn-app-banner__icon {
21
+ height: 3.2rem;
22
+ }
23
+ pn-app-banner .pn-app-banner__text {
24
+ font-size: 1.2rem;
25
+ line-height: 1;
26
+ }
27
+ pn-app-banner .pn-app-banner__text span {
28
+ font-weight: 600;
29
+ }
30
+ pn-app-banner .pn-app-banner__cta {
31
+ margin-left: auto;
32
+ }
33
+ pn-app-banner[data-is-closed=true] {
34
+ display: none;
35
+ }