@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.
- package/cjs/index-4199ff85.js +16 -4
- package/cjs/loader.cjs.js +1 -1
- package/cjs/pn-dropdown-with-multi-input-rows-row.cjs.entry.js +183 -0
- package/cjs/pn-dropdown-with-multi-input-rows.cjs.entry.js +309 -0
- package/cjs/pn-market-web-components.cjs.js +1 -1
- package/cjs/pn-marketweb-siteheader.cjs.entry.js +1 -1
- package/cjs/pn-multiple-input.cjs.entry.js +105 -0
- package/collection/collection-manifest.json +3 -0
- package/collection/components/input/pn-dropdown-with-multi-input-rows/pn-dropdown-with-multi-input-rows-row.css +27 -0
- package/collection/components/input/pn-dropdown-with-multi-input-rows/pn-dropdown-with-multi-input-rows-row.js +673 -0
- package/collection/components/input/pn-dropdown-with-multi-input-rows/pn-dropdown-with-multi-input-rows.css +26 -0
- package/collection/components/input/pn-dropdown-with-multi-input-rows/pn-dropdown-with-multi-input-rows.js +970 -0
- package/collection/components/input/pn-dropdown-with-multi-input-rows/pn-dropdown-with-multi-input-rows.stories.js +86 -0
- package/collection/components/input/pn-dropdown-with-multi-input-rows/types.js +1 -0
- package/collection/components/input/pn-multiple-input/pn-multiple-input.css +16 -0
- package/collection/components/input/pn-multiple-input/pn-multiple-input.js +185 -0
- package/collection/components/input/pn-multiple-input/pn-multiple-input.stories.js +24 -0
- package/collection/components/input/pn-multiple-input/types.js +1 -0
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.js +4 -3
- package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.stories.js +1 -1
- package/components/index.d.ts +3 -0
- package/components/index.js +3 -0
- package/components/pn-dropdown-with-multi-input-rows-row.d.ts +11 -0
- package/components/pn-dropdown-with-multi-input-rows-row.js +6 -0
- package/components/pn-dropdown-with-multi-input-rows-row2.js +232 -0
- package/components/pn-dropdown-with-multi-input-rows.d.ts +11 -0
- package/components/pn-dropdown-with-multi-input-rows.js +379 -0
- package/components/pn-marketweb-siteheader.js +1 -1
- package/components/pn-multiple-input.d.ts +11 -0
- package/components/pn-multiple-input.js +130 -0
- package/esm/index-ee44c065.js +16 -4
- package/esm/loader.js +1 -1
- package/esm/pn-dropdown-with-multi-input-rows-row.entry.js +179 -0
- package/esm/pn-dropdown-with-multi-input-rows.entry.js +305 -0
- package/esm/pn-market-web-components.js +1 -1
- package/esm/pn-marketweb-siteheader.entry.js +1 -1
- package/esm/pn-multiple-input.entry.js +101 -0
- package/esm-es5/index-ee44c065.js +1 -1
- package/esm-es5/loader.js +1 -1
- package/esm-es5/pn-dropdown-with-multi-input-rows-row.entry.js +1 -0
- package/esm-es5/pn-dropdown-with-multi-input-rows.entry.js +1 -0
- package/esm-es5/pn-market-web-components.js +1 -1
- package/esm-es5/pn-marketweb-siteheader.entry.js +1 -1
- package/esm-es5/pn-multiple-input.entry.js +1 -0
- package/package.json +1 -1
- package/pn-market-web-components/{p-5d0e8295.system.entry.js → p-0ee378ea.system.entry.js} +1 -1
- package/pn-market-web-components/p-313658e7.entry.js +1 -0
- package/pn-market-web-components/p-47239bce.system.entry.js +1 -0
- package/pn-market-web-components/p-52e8d0ec.system.entry.js +1 -0
- package/pn-market-web-components/p-7787ca3b.entry.js +1 -0
- package/pn-market-web-components/p-a953d346.entry.js +1 -0
- package/pn-market-web-components/p-ad952e14.system.entry.js +1 -0
- package/pn-market-web-components/p-e05b6e0c.entry.js +1 -0
- package/pn-market-web-components/p-fcdb7381.system.js +1 -1
- package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
- package/types/components/input/pn-dropdown-with-multi-input-rows/pn-dropdown-with-multi-input-rows-row.d.ts +59 -0
- package/types/components/input/pn-dropdown-with-multi-input-rows/pn-dropdown-with-multi-input-rows.d.ts +77 -0
- package/types/components/input/pn-dropdown-with-multi-input-rows/types.d.ts +18 -0
- package/types/components/input/pn-multiple-input/pn-multiple-input.d.ts +22 -0
- package/types/components/input/pn-multiple-input/types.d.ts +11 -0
- package/types/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.d.ts +1 -1
- package/types/components.d.ts +181 -7
- package/umd/modules/@postnord/web-components/package.json +32 -62
- package/umd/modules/@webcomponents/custom-elements/package.json +23 -58
- package/pn-market-web-components/p-6789a592.entry.js +0 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import readme from './readme.md';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'input/Dropdown with Multi Input Rows',
|
|
5
|
+
parameters: {
|
|
6
|
+
notes: readme,
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const Template = ({ ...args }) => {
|
|
11
|
+
return `
|
|
12
|
+
<pn-dropdown-with-multi-input-rows
|
|
13
|
+
dropdown-data='${args.dropdownData}'
|
|
14
|
+
language-code='${args.languageCode}'
|
|
15
|
+
first-dropdown-label='${args.firstDropdownLabel}'
|
|
16
|
+
first-dropdown-helper-text='${args.firstDropdownHelperText}'
|
|
17
|
+
second-dropdown-label='${args.secondDropdownLabel}'
|
|
18
|
+
second-dropdown-helper-text='${args.secondDropdownHelperText}'
|
|
19
|
+
second-dropdown-max='${args.secondDropdownMax}'
|
|
20
|
+
delete-multiple-rows-warning-text='${args.deleteMultipleRowsWarningText}'
|
|
21
|
+
confirm-delete-button-text='${args.confirmDeleteButtonText}'
|
|
22
|
+
abort-delete-button-text='${args.abortDeleteButtonText}'
|
|
23
|
+
frist-input-label='${args.fristInputLabel}'
|
|
24
|
+
frist-input-placeholder='${args.fristInputPlaceholder}'
|
|
25
|
+
first-input-min='${args.firstInputMin}'
|
|
26
|
+
first-input-max='${args.firstInputMax}'
|
|
27
|
+
first-input-warning='${args.firstInputWarning}'
|
|
28
|
+
first-input-warning-text='${args.firstInputWarningText}'
|
|
29
|
+
first-input-low-error-text='${args.firstInputLowErrorText}'
|
|
30
|
+
first-input-high-error-text='${args.firstInputHighErrorText}'
|
|
31
|
+
second-input-label='${args.secondInputLabel}'
|
|
32
|
+
second-input-placeholder='${args.secondInputPlaceholder}'
|
|
33
|
+
second-input-min='${args.secondInputMin}'
|
|
34
|
+
second-input-max='${args.secondInputMax}'
|
|
35
|
+
second-input-warning='${args.secondInputWarning}'
|
|
36
|
+
second-input-warning-text='${args.secondInputWarningText}'
|
|
37
|
+
second-input-low-error-text='${args.secondInputLowErrorText}'
|
|
38
|
+
second-input-high-error-text='${args.secondInputHighErrorText}'
|
|
39
|
+
date-label='${args.dateLabel}'
|
|
40
|
+
date-placeholder='${args.datePlaceholder}'
|
|
41
|
+
date-days-from-today='${args.dateDaysFromToday}'
|
|
42
|
+
years-to-add-to-end-date='${args.yearsToAddToEndDate}'
|
|
43
|
+
sum-field-label='${args.sumFieldLabel}'
|
|
44
|
+
add-row-text='${args.addRowText}'
|
|
45
|
+
element-helper-text='${args.elementHelperText}'
|
|
46
|
+
>
|
|
47
|
+
</pn-dropdown-with-multi-input-rows>
|
|
48
|
+
`;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const Primary = Template.bind({});
|
|
52
|
+
Primary.args = {
|
|
53
|
+
dropdownData: '[{"caption": "Option1", "value": 4, "checked": false}, {"caption": "Option2", "value": 8, "checked": false}]',
|
|
54
|
+
languageCode: 'en',
|
|
55
|
+
firstDropdownLabel: 'dropdown1',
|
|
56
|
+
firstDropdownHelperText: 'dropdown1 help',
|
|
57
|
+
secondDropdownLabel: 'dropdown2',
|
|
58
|
+
secondDropdownHelperText: 'dropdown2 help',
|
|
59
|
+
secondDropdownMax: 53,
|
|
60
|
+
deleteMultipleRowsWarningText: 'Når du ændrer Antal Udgivelser til et lavere antal end først valgt, skal du være opmærksom på at allerede indtastede indleveringer slettes',
|
|
61
|
+
confirmDeleteButtonText: 'Slet',
|
|
62
|
+
abortDeleteButtonText: 'Fortryd',
|
|
63
|
+
fristInputLabel: 'first input',
|
|
64
|
+
fristInputPlaceholder: 'amount',
|
|
65
|
+
firstInputMin: 500,
|
|
66
|
+
firstInputMax: 2000000,
|
|
67
|
+
firstInputWarning: 1500,
|
|
68
|
+
firstInputWarningText: 'Antal er pr indlevering skal være på minimum 1500 stk. eller der skal betales op til minimum',
|
|
69
|
+
firstInputLowErrorText: 'Du kan ikke indlevere under 500 stk.',
|
|
70
|
+
firstInputHighErrorText: 'Du kan ikke indlevere over 2000000 stk.',
|
|
71
|
+
secondInputLabel: 'second input',
|
|
72
|
+
secondInputPlaceholder: 'amount',
|
|
73
|
+
secondInputMin: 0,
|
|
74
|
+
secondInputMax: 2000,
|
|
75
|
+
secondInputWarning: 60,
|
|
76
|
+
secondInputWarningText: 'Bemærk der betales for mindst 60 gram, uanset vægt',
|
|
77
|
+
secondInputLowErrorText: '',
|
|
78
|
+
secondInputHighErrorText: 'Forkert vægt max. 2000',
|
|
79
|
+
dateLabel: 'date',
|
|
80
|
+
datePlaceholder: 'YYYY-MM-DD',
|
|
81
|
+
dateDaysFromToday: 1,
|
|
82
|
+
yearsToAddToEndDate: 2,
|
|
83
|
+
sumFieldLabel: 'Sum',
|
|
84
|
+
addRowText: 'Add Row',
|
|
85
|
+
elementHelperText: 'Helpful text',
|
|
86
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
pn-multiple-input .multiple-input-generated-row,
|
|
2
|
+
pn-multiple-input .multiple-input-row {
|
|
3
|
+
display: flex;
|
|
4
|
+
gap: 1rem;
|
|
5
|
+
}
|
|
6
|
+
pn-multiple-input .multiple-input-generated-row pn-marketweb-input,
|
|
7
|
+
pn-multiple-input .multiple-input-row pn-marketweb-input {
|
|
8
|
+
width: 100%;
|
|
9
|
+
}
|
|
10
|
+
pn-multiple-input .multiple-input-slot {
|
|
11
|
+
display: flex;
|
|
12
|
+
gap: 1rem;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
margin-top: 1rem;
|
|
15
|
+
margin-bottom: 1rem;
|
|
16
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { h, Host } from '@stencil/core';
|
|
2
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
3
|
+
import { debounce } from 'debounce';
|
|
4
|
+
export class PnMultipleInput {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.pnSlotElement = null;
|
|
7
|
+
this._formValues = [];
|
|
8
|
+
this.label = null;
|
|
9
|
+
this.placeholder = null;
|
|
10
|
+
this.addRowButtonText = null;
|
|
11
|
+
this.rowData = [];
|
|
12
|
+
}
|
|
13
|
+
componentWillLoad() {
|
|
14
|
+
const elemtnId = this.generateUniqueId();
|
|
15
|
+
const newRow = { id: elemtnId, input: '' };
|
|
16
|
+
this.rowData = [...this.rowData, newRow];
|
|
17
|
+
}
|
|
18
|
+
componentDidLoad() {
|
|
19
|
+
this.addEventHandlers();
|
|
20
|
+
}
|
|
21
|
+
componentDidUpdate() {
|
|
22
|
+
this.addEventHandlers();
|
|
23
|
+
}
|
|
24
|
+
addEventHandlers() {
|
|
25
|
+
const rows = this.pnSlotElement.querySelectorAll('pn-marketweb-input');
|
|
26
|
+
rows.forEach(element => {
|
|
27
|
+
element.addEventListener('keyup', debounce(this.handleInput.bind(this), 500));
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
generateUniqueId() {
|
|
31
|
+
return uuidv4();
|
|
32
|
+
}
|
|
33
|
+
deleteRow(indexToRemove) {
|
|
34
|
+
if (indexToRemove < 0) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
this.rowData.splice(indexToRemove, 1);
|
|
38
|
+
this.rowData = [...this.rowData];
|
|
39
|
+
this.emitValues();
|
|
40
|
+
}
|
|
41
|
+
addRow() {
|
|
42
|
+
const newRow = { id: this.generateUniqueId(), input: '' };
|
|
43
|
+
this.rowData = [...this.rowData, newRow];
|
|
44
|
+
this.emitValues();
|
|
45
|
+
}
|
|
46
|
+
handleInput(e) {
|
|
47
|
+
const target = e.target;
|
|
48
|
+
const inputElm = target.closest('pn-marketweb-input');
|
|
49
|
+
if (!inputElm) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const inputElmId = inputElm.id;
|
|
53
|
+
const value = target.value;
|
|
54
|
+
const index = this.rowData.findIndex(item => item.id === inputElmId);
|
|
55
|
+
if (index < 0) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
this.rowData[index] = Object.assign(Object.assign({}, this.rowData[index]), { input: value });
|
|
59
|
+
this.emitValues();
|
|
60
|
+
}
|
|
61
|
+
emitValues() {
|
|
62
|
+
this._formValues = [];
|
|
63
|
+
const label = this.label ? this.label : 'InputField';
|
|
64
|
+
this.rowData.forEach(item => {
|
|
65
|
+
const rowValue = { row: [] };
|
|
66
|
+
if (item.input) {
|
|
67
|
+
const dropDownValue = { name: label, value: item.input };
|
|
68
|
+
rowValue.row.push(dropDownValue);
|
|
69
|
+
}
|
|
70
|
+
if (rowValue.row.length === 1) {
|
|
71
|
+
this._formValues.push(rowValue);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
if (this._formValues.length === this.rowData.length) {
|
|
75
|
+
const valueJsonString = JSON.stringify(this._formValues);
|
|
76
|
+
this.allFormValues.emit(valueJsonString);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
this.allFormValues.emit('');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
render() {
|
|
83
|
+
var _a;
|
|
84
|
+
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) => {
|
|
85
|
+
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: () => {
|
|
86
|
+
this.deleteRow(i);
|
|
87
|
+
}, index: i, id: data.id }, "Delete")) : null));
|
|
88
|
+
})), 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: () => {
|
|
89
|
+
this.addRow();
|
|
90
|
+
} }, this.addRowButtonText))));
|
|
91
|
+
}
|
|
92
|
+
static get is() { return "pn-multiple-input"; }
|
|
93
|
+
static get originalStyleUrls() {
|
|
94
|
+
return {
|
|
95
|
+
"$": ["pn-multiple-input.scss"]
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
static get styleUrls() {
|
|
99
|
+
return {
|
|
100
|
+
"$": ["pn-multiple-input.css"]
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
static get properties() {
|
|
104
|
+
return {
|
|
105
|
+
"label": {
|
|
106
|
+
"type": "string",
|
|
107
|
+
"mutable": false,
|
|
108
|
+
"complexType": {
|
|
109
|
+
"original": "string",
|
|
110
|
+
"resolved": "string",
|
|
111
|
+
"references": {}
|
|
112
|
+
},
|
|
113
|
+
"required": false,
|
|
114
|
+
"optional": false,
|
|
115
|
+
"docs": {
|
|
116
|
+
"tags": [],
|
|
117
|
+
"text": ""
|
|
118
|
+
},
|
|
119
|
+
"attribute": "label",
|
|
120
|
+
"reflect": false,
|
|
121
|
+
"defaultValue": "null"
|
|
122
|
+
},
|
|
123
|
+
"placeholder": {
|
|
124
|
+
"type": "string",
|
|
125
|
+
"mutable": false,
|
|
126
|
+
"complexType": {
|
|
127
|
+
"original": "string",
|
|
128
|
+
"resolved": "string",
|
|
129
|
+
"references": {}
|
|
130
|
+
},
|
|
131
|
+
"required": false,
|
|
132
|
+
"optional": false,
|
|
133
|
+
"docs": {
|
|
134
|
+
"tags": [],
|
|
135
|
+
"text": ""
|
|
136
|
+
},
|
|
137
|
+
"attribute": "placeholder",
|
|
138
|
+
"reflect": false,
|
|
139
|
+
"defaultValue": "null"
|
|
140
|
+
},
|
|
141
|
+
"addRowButtonText": {
|
|
142
|
+
"type": "string",
|
|
143
|
+
"mutable": false,
|
|
144
|
+
"complexType": {
|
|
145
|
+
"original": "string",
|
|
146
|
+
"resolved": "string",
|
|
147
|
+
"references": {}
|
|
148
|
+
},
|
|
149
|
+
"required": false,
|
|
150
|
+
"optional": false,
|
|
151
|
+
"docs": {
|
|
152
|
+
"tags": [],
|
|
153
|
+
"text": ""
|
|
154
|
+
},
|
|
155
|
+
"attribute": "add-row-button-text",
|
|
156
|
+
"reflect": false,
|
|
157
|
+
"defaultValue": "null"
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
static get states() {
|
|
162
|
+
return {
|
|
163
|
+
"rowData": {}
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
static get events() {
|
|
167
|
+
return [{
|
|
168
|
+
"method": "allFormValues",
|
|
169
|
+
"name": "allFormValues",
|
|
170
|
+
"bubbles": true,
|
|
171
|
+
"cancelable": true,
|
|
172
|
+
"composed": true,
|
|
173
|
+
"docs": {
|
|
174
|
+
"tags": [],
|
|
175
|
+
"text": ""
|
|
176
|
+
},
|
|
177
|
+
"complexType": {
|
|
178
|
+
"original": "string",
|
|
179
|
+
"resolved": "string",
|
|
180
|
+
"references": {}
|
|
181
|
+
}
|
|
182
|
+
}];
|
|
183
|
+
}
|
|
184
|
+
static get elementRef() { return "hostElement"; }
|
|
185
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import readme from './readme.md';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'input/Multiple Input',
|
|
5
|
+
parameters: {
|
|
6
|
+
notes: readme,
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const Template = ({ ...args }) => {
|
|
11
|
+
return `<pn-multiple-input
|
|
12
|
+
label='${args.label}'
|
|
13
|
+
placeholder='${args.placeholder}'
|
|
14
|
+
add-row-button-text='${args.addRowButtonText}'
|
|
15
|
+
>
|
|
16
|
+
</pn-multiple-input>`;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const Primary = Template.bind({});
|
|
20
|
+
Primary.args = {
|
|
21
|
+
label: 'label',
|
|
22
|
+
placeholder: 'placeholder',
|
|
23
|
+
addRowButtonText: 'add',
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/collection/components/layout-components/pn-marketweb-siteheader/pn-marketweb-siteheader.js
CHANGED
|
@@ -30,7 +30,7 @@ export class PnMarketwebSiteheader {
|
|
|
30
30
|
this.searchPlaceholder = '';
|
|
31
31
|
this.spaMode = false;
|
|
32
32
|
this.checkUserLoggedInStateInterval = 0;
|
|
33
|
-
this.pageId =
|
|
33
|
+
this.pageId = '';
|
|
34
34
|
this.i18n = {
|
|
35
35
|
searchlabel: '',
|
|
36
36
|
searchplaceholder: '',
|
|
@@ -737,13 +737,14 @@ export class PnMarketwebSiteheader {
|
|
|
737
737
|
"references": {}
|
|
738
738
|
},
|
|
739
739
|
"required": false,
|
|
740
|
-
"optional":
|
|
740
|
+
"optional": true,
|
|
741
741
|
"docs": {
|
|
742
742
|
"tags": [],
|
|
743
743
|
"text": ""
|
|
744
744
|
},
|
|
745
745
|
"attribute": "page-id",
|
|
746
|
-
"reflect": false
|
|
746
|
+
"reflect": false,
|
|
747
|
+
"defaultValue": "''"
|
|
747
748
|
}
|
|
748
749
|
};
|
|
749
750
|
}
|
|
@@ -468,7 +468,7 @@ const DotComSiteHeaderTemplate = ({ ...args }) => {
|
|
|
468
468
|
user-fullname="${args.name}"
|
|
469
469
|
user-loggedin="${args.loggedin}"
|
|
470
470
|
show-unified-login=${args.unified}
|
|
471
|
-
show-profile-selection=${args.showProfileSelection}
|
|
471
|
+
show-profile-selection=${args.showProfileSelection}
|
|
472
472
|
>
|
|
473
473
|
<pn-button slot="toprightend" href="http:www.google.se" small="true">Get started</pn-button>
|
|
474
474
|
<pn-button slot="menu-footer-cta" href="http:www.google.se" small="true">Get started</pn-button>
|
package/components/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export { PnCustomernumberSelector as PnCustomernumberSelector } from '../types/c
|
|
|
12
12
|
export { PnProfileSelectorOption as PnCustomernumberSelectorOption } from '../types/components/profile/pn-customernumber-selector/pn-customernumber-selector-option';
|
|
13
13
|
export { PnDateAndTime as PnDateAndTime } from '../types/components/input/pn-date-and-time/pn-date-and-time';
|
|
14
14
|
export { pnDropdownChoiceAddsRow as PnDropdownChoiceAddsRow } from '../types/components/input/pn-dropdown-choice-adds-row/pn-dropdown-choice-adds-row';
|
|
15
|
+
export { PnDropdownWithMultiInputRows as PnDropdownWithMultiInputRows } from '../types/components/input/pn-dropdown-with-multi-input-rows/pn-dropdown-with-multi-input-rows';
|
|
16
|
+
export { PnDropdownWithMultiInputRowsRow as PnDropdownWithMultiInputRowsRow } from '../types/components/input/pn-dropdown-with-multi-input-rows/pn-dropdown-with-multi-input-rows-row';
|
|
15
17
|
export { PnFilterCheckbox as PnFilterCheckbox } from '../types/components/input/pn-filter-checkbox/pn-filter-checkbox';
|
|
16
18
|
export { PnfindPrice as PnFindPrice } from '../types/components/widgets/pn-find-price/pn-find-price';
|
|
17
19
|
export { PnfindPriceResult as PnFindPriceResult } from '../types/components/widgets/pn-find-price/pn-find-price-result';
|
|
@@ -39,6 +41,7 @@ export { PnMarketwebSiteheaderUnifiedLogin as PnMarketwebSiteheaderUnifiedLogin
|
|
|
39
41
|
export { PnMultiFormField as PnMultiFormfield } from '../types/components/input/pn-multi-formfield/pn-multi-formfield';
|
|
40
42
|
export { PnMultiRowConnectedDropdown as PnMultiRowConnectedDropdown } from '../types/components/input/pn-multi-row-connected-dropdown/pn-multi-row-connected-dropdown';
|
|
41
43
|
export { PnMultiRowConnectedDropdownRow as PnMultiRowConnectedDropdownRow } from '../types/components/input/pn-multi-row-connected-dropdown/pn-multi-row-connected-dropdown-row';
|
|
44
|
+
export { PnMultipleInput as PnMultipleInput } from '../types/components/input/pn-multiple-input/pn-multiple-input';
|
|
42
45
|
export { PnSpotlight as PnParcelTracker } from '../types/components/cta/pn-parcel-tracker/pn-parcel-tracker';
|
|
43
46
|
export { PnPexPricefinder as PnPexPricefinder } from '../types/components/widgets/pn-pex-pricefinder/pn-pex-pricefinder';
|
|
44
47
|
export { PnPlayOnScroll as PnPlayOnScroll } from '../types/components/animation/pn-play-on-scroll/pn-play-on-scroll';
|
package/components/index.js
CHANGED
|
@@ -12,6 +12,8 @@ export { PnCustomernumberSelector, defineCustomElement as defineCustomElementPnC
|
|
|
12
12
|
export { PnCustomernumberSelectorOption, defineCustomElement as defineCustomElementPnCustomernumberSelectorOption } from './pn-customernumber-selector-option.js';
|
|
13
13
|
export { PnDateAndTime, defineCustomElement as defineCustomElementPnDateAndTime } from './pn-date-and-time.js';
|
|
14
14
|
export { PnDropdownChoiceAddsRow, defineCustomElement as defineCustomElementPnDropdownChoiceAddsRow } from './pn-dropdown-choice-adds-row.js';
|
|
15
|
+
export { PnDropdownWithMultiInputRows, defineCustomElement as defineCustomElementPnDropdownWithMultiInputRows } from './pn-dropdown-with-multi-input-rows.js';
|
|
16
|
+
export { PnDropdownWithMultiInputRowsRow, defineCustomElement as defineCustomElementPnDropdownWithMultiInputRowsRow } from './pn-dropdown-with-multi-input-rows-row.js';
|
|
15
17
|
export { PnFilterCheckbox, defineCustomElement as defineCustomElementPnFilterCheckbox } from './pn-filter-checkbox.js';
|
|
16
18
|
export { PnFindPrice, defineCustomElement as defineCustomElementPnFindPrice } from './pn-find-price.js';
|
|
17
19
|
export { PnFindPriceResult, defineCustomElement as defineCustomElementPnFindPriceResult } from './pn-find-price-result.js';
|
|
@@ -39,6 +41,7 @@ export { PnMarketwebSiteheaderUnifiedLogin, defineCustomElement as defineCustomE
|
|
|
39
41
|
export { PnMultiFormfield, defineCustomElement as defineCustomElementPnMultiFormfield } from './pn-multi-formfield.js';
|
|
40
42
|
export { PnMultiRowConnectedDropdown, defineCustomElement as defineCustomElementPnMultiRowConnectedDropdown } from './pn-multi-row-connected-dropdown.js';
|
|
41
43
|
export { PnMultiRowConnectedDropdownRow, defineCustomElement as defineCustomElementPnMultiRowConnectedDropdownRow } from './pn-multi-row-connected-dropdown-row.js';
|
|
44
|
+
export { PnMultipleInput, defineCustomElement as defineCustomElementPnMultipleInput } from './pn-multiple-input.js';
|
|
42
45
|
export { PnParcelTracker, defineCustomElement as defineCustomElementPnParcelTracker } from './pn-parcel-tracker.js';
|
|
43
46
|
export { PnPexPricefinder, defineCustomElement as defineCustomElementPnPexPricefinder } from './pn-pex-pricefinder.js';
|
|
44
47
|
export { PnPlayOnScroll, defineCustomElement as defineCustomElementPnPlayOnScroll } from './pn-play-on-scroll.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface PnDropdownWithMultiInputRowsRow extends Components.PnDropdownWithMultiInputRowsRow, HTMLElement {}
|
|
4
|
+
export const PnDropdownWithMultiInputRowsRow: {
|
|
5
|
+
prototype: PnDropdownWithMultiInputRowsRow;
|
|
6
|
+
new (): PnDropdownWithMultiInputRowsRow;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { P as PnDropdownWithMultiInputRowsRow$1, d as defineCustomElement$1 } from './pn-dropdown-with-multi-input-rows-row2.js';
|
|
2
|
+
|
|
3
|
+
const PnDropdownWithMultiInputRowsRow = PnDropdownWithMultiInputRowsRow$1;
|
|
4
|
+
const defineCustomElement = defineCustomElement$1;
|
|
5
|
+
|
|
6
|
+
export { PnDropdownWithMultiInputRowsRow, defineCustomElement };
|
|
@@ -0,0 +1,232 @@
|
|
|
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$1 } from './pn-marketweb-input2.js';
|
|
4
|
+
|
|
5
|
+
const pnDropdownWithMultiInputRowsRowCss = "pn-dropdown-with-multi-input-rows-row .input-element-row{display:-ms-flexbox;display:flex;gap:1rem;margin-bottom:1rem}pn-dropdown-with-multi-input-rows-row .input-element-row .input-container{width:30%}pn-dropdown-with-multi-input-rows-row .input-element-row .input-container pn-marketweb-input .input-container{width:100%}pn-dropdown-with-multi-input-rows-row .input-element-row .input-container pn-date-picker{width:100%}pn-dropdown-with-multi-input-rows-row .input-element-row .input-container .input-element-message-container{margin-top:0.3rem}pn-dropdown-with-multi-input-rows-row .input-element-row .input-container .input-element-message-container__error{color:red;line-height:1}pn-dropdown-with-multi-input-rows-row .input-element-row .input-container .input-element-message-container__warning{line-height:1}pn-dropdown-with-multi-input-rows-row .delete-button-contianer{margin-top:0.6rem}";
|
|
6
|
+
|
|
7
|
+
const PnDropdownWithMultiInputRowsRow = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this.__registerHost();
|
|
11
|
+
this.rowValueChange = createEvent(this, "rowValueChange", 7);
|
|
12
|
+
this.deleteRowEvent = createEvent(this, "deleteRowEvent", 7);
|
|
13
|
+
this.firstInputChange = createEvent(this, "firstInputChange", 7);
|
|
14
|
+
this.secondInputChange = createEvent(this, "secondInputChange", 7);
|
|
15
|
+
this.pnFirstInputField = null;
|
|
16
|
+
this.pnSecondInputField = null;
|
|
17
|
+
this.pnDatePicker = null;
|
|
18
|
+
this.pnDeleteRowButton = null;
|
|
19
|
+
this.languageCode = null;
|
|
20
|
+
this.fristInputPlaceholder = null;
|
|
21
|
+
this.firstInputMin = null;
|
|
22
|
+
this.firstInputMax = null;
|
|
23
|
+
this.firstInputWarning = null;
|
|
24
|
+
this.firstInputWarningText = null;
|
|
25
|
+
this.firstInputLowErrorText = null;
|
|
26
|
+
this.firstInputHighErrorText = null;
|
|
27
|
+
this.secondInputPlaceholder = null;
|
|
28
|
+
this.secondInputMin = null;
|
|
29
|
+
this.secondInputMax = null;
|
|
30
|
+
this.secondInputWarning = null;
|
|
31
|
+
this.secondInputWarningText = null;
|
|
32
|
+
this.secondInputLowErrorText = null;
|
|
33
|
+
this.secondInputHighErrorText = null;
|
|
34
|
+
this.dateLabel = null;
|
|
35
|
+
this.datePlaceholder = null;
|
|
36
|
+
this.firstValidDate = null;
|
|
37
|
+
this.lastValidDate = null;
|
|
38
|
+
this.predefinedValue = null;
|
|
39
|
+
this.rowIndex = null;
|
|
40
|
+
this.minRowCount = null;
|
|
41
|
+
this.showFirstInputWarning = false;
|
|
42
|
+
this.showFirstInputLowError = false;
|
|
43
|
+
this.showFirstInputHighError = false;
|
|
44
|
+
this.showSecondInputWarning = false;
|
|
45
|
+
this.showSecondInputLowError = false;
|
|
46
|
+
this.showSecondInputHighError = false;
|
|
47
|
+
this.firstInputValue = '';
|
|
48
|
+
this.secondInputValue = '';
|
|
49
|
+
this.dateValue = '';
|
|
50
|
+
}
|
|
51
|
+
componentWillLoad() {
|
|
52
|
+
this.getPredefinedValues();
|
|
53
|
+
this.setInitialValues();
|
|
54
|
+
}
|
|
55
|
+
componentDidLoad() {
|
|
56
|
+
this.addEventHandlers();
|
|
57
|
+
}
|
|
58
|
+
getPredefinedValues() {
|
|
59
|
+
this._predefinedValue = JSON.parse(this.predefinedValue);
|
|
60
|
+
}
|
|
61
|
+
applyPredefinedValue() {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
this.getPredefinedValues();
|
|
64
|
+
this.setInitialValues();
|
|
65
|
+
if ((_a = this.firstInputValue) === null || _a === void 0 ? void 0 : _a.length) {
|
|
66
|
+
this.validateFirstInput(parseInt(this.firstInputValue));
|
|
67
|
+
}
|
|
68
|
+
if ((_b = this.secondInputValue) === null || _b === void 0 ? void 0 : _b.length) {
|
|
69
|
+
this.validateSecondInput(parseInt(this.secondInputValue));
|
|
70
|
+
}
|
|
71
|
+
if (this.rowIndex >= this.minRowCount) {
|
|
72
|
+
this.pnDeleteRowButton.addEventListener('click', this.deleteRow.bind(this));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
setInitialValues() {
|
|
76
|
+
this.firstInputValue = this._predefinedValue.firstInput;
|
|
77
|
+
this.secondInputValue = this._predefinedValue.secondInput;
|
|
78
|
+
this.dateValue = this._predefinedValue.date;
|
|
79
|
+
}
|
|
80
|
+
addEventHandlers() {
|
|
81
|
+
const emmitValues = debounce_1.debounce(this.emitRowValues.bind(this), 500);
|
|
82
|
+
this.pnFirstInputField.addEventListener('keyup', debounce_1.debounce(this.handleFirstInput.bind(this), 500));
|
|
83
|
+
this.pnSecondInputField.addEventListener('keyup', debounce_1.debounce(this.handleSecondInput.bind(this), 500));
|
|
84
|
+
this.pnDatePicker.addEventListener('dateselection', this.handleDateChange.bind(this));
|
|
85
|
+
this.pnDatePicker.addEventListener('dateselection', emmitValues);
|
|
86
|
+
}
|
|
87
|
+
handleFirstInput(e) {
|
|
88
|
+
const elm = e.target;
|
|
89
|
+
const value = parseInt(elm.value);
|
|
90
|
+
if (value > 0) {
|
|
91
|
+
this.firstInputValue = elm.value;
|
|
92
|
+
this.firstInputChange.emit({
|
|
93
|
+
id: this._predefinedValue.id,
|
|
94
|
+
firstInput: this.firstInputValue,
|
|
95
|
+
secondInput: this.secondInputValue,
|
|
96
|
+
date: this.dateValue,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
this.validateFirstInput(value);
|
|
100
|
+
this.emitRowValues();
|
|
101
|
+
}
|
|
102
|
+
handleSecondInput(e) {
|
|
103
|
+
const elm = e.target;
|
|
104
|
+
const value = parseInt(elm.value);
|
|
105
|
+
if (value > 0) {
|
|
106
|
+
this.secondInputValue = elm.value;
|
|
107
|
+
this.secondInputChange.emit({
|
|
108
|
+
id: this._predefinedValue.id,
|
|
109
|
+
firstInput: this.firstInputValue,
|
|
110
|
+
secondInput: this.secondInputValue,
|
|
111
|
+
date: this.dateValue,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
this.validateSecondInput(value);
|
|
115
|
+
this.emitRowValues();
|
|
116
|
+
}
|
|
117
|
+
validateFirstInput(input) {
|
|
118
|
+
this.showFirstInputWarning = false;
|
|
119
|
+
this.showFirstInputLowError = false;
|
|
120
|
+
this.showFirstInputHighError = false;
|
|
121
|
+
if (input < this.firstInputWarning) {
|
|
122
|
+
this.showFirstInputWarning = true;
|
|
123
|
+
}
|
|
124
|
+
if (input < this.firstInputMin) {
|
|
125
|
+
this.showFirstInputWarning = false;
|
|
126
|
+
this.showFirstInputLowError = true;
|
|
127
|
+
}
|
|
128
|
+
if (input > this.firstInputMax) {
|
|
129
|
+
this.showFirstInputWarning = false;
|
|
130
|
+
this.showFirstInputLowError = false;
|
|
131
|
+
this.showFirstInputHighError = true;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
validateSecondInput(input) {
|
|
135
|
+
this.showSecondInputWarning = false;
|
|
136
|
+
this.showSecondInputLowError = false;
|
|
137
|
+
this.showSecondInputHighError = false;
|
|
138
|
+
if (input < this.secondInputWarning) {
|
|
139
|
+
this.showSecondInputWarning = true;
|
|
140
|
+
}
|
|
141
|
+
if (input < this.secondInputMin) {
|
|
142
|
+
this.showSecondInputWarning = false;
|
|
143
|
+
this.showSecondInputLowError = true;
|
|
144
|
+
}
|
|
145
|
+
if (input > this.secondInputMax) {
|
|
146
|
+
this.showSecondInputWarning = false;
|
|
147
|
+
this.showSecondInputLowError = false;
|
|
148
|
+
this.showSecondInputHighError = true;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
handleDateChange(e) {
|
|
152
|
+
const elm = e.target;
|
|
153
|
+
if (elm === this.pnDatePicker) {
|
|
154
|
+
this.dateValue = e.detail;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
emitRowValues() {
|
|
158
|
+
this.rowValueChange.emit({
|
|
159
|
+
id: this._predefinedValue.id,
|
|
160
|
+
firstInput: this.firstInputValue,
|
|
161
|
+
secondInput: this.secondInputValue,
|
|
162
|
+
date: this.dateValue,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
deleteRow() {
|
|
166
|
+
this.deleteRowEvent.emit(this._predefinedValue.id);
|
|
167
|
+
}
|
|
168
|
+
render() {
|
|
169
|
+
var _a;
|
|
170
|
+
return (h(Host, null, h("div", { class: "input-element-row" }, h("div", { class: "input-container" }, h("pn-marketweb-input", { ref: el => (this.pnFirstInputField = el), type: "number", placeholder: this.fristInputPlaceholder, value: this.firstInputValue, min: "1" }), this.showFirstInputLowError || this.showFirstInputHighError || this.showFirstInputWarning ? (h("div", { class: "input-element-message-container" }, this.showFirstInputLowError ? (h("div", { class: "input-element-message-container__error" }, h("small", null, this.firstInputLowErrorText))) : null, this.showFirstInputHighError ? (h("div", { class: "input-element-message-container__error" }, h("small", null, this.firstInputHighErrorText))) : null, this.showFirstInputWarning ? (h("div", { class: "input-element-message-container__warning" }, h("small", null, this.firstInputWarningText))) : null)) : null), h("div", { class: "input-container" }, h("pn-marketweb-input", { ref: el => (this.pnSecondInputField = el), type: "number", placeholder: this.secondInputPlaceholder, value: this.secondInputValue, min: "1" }), this.showSecondInputLowError || this.showSecondInputHighError || this.showSecondInputWarning ? (h("div", { class: "input-element-message-container" }, this.showSecondInputLowError ? (h("div", { class: "input-element-message-container__error" }, h("small", null, this.secondInputLowErrorText))) : null, this.showSecondInputHighError ? (h("div", { class: "input-element-message-container__error" }, h("small", null, this.secondInputHighErrorText))) : null, this.showSecondInputWarning ? (h("div", { class: "input-element-message-container__warning" }, h("small", null, this.secondInputWarningText))) : null)) : null), h("div", { class: "input-container" }, h("pn-date-picker", { ref: el => (this.pnDatePicker = el), range: "false", "disable-weekends": true, "min-date": this.firstValidDate, "max-date": this.lastValidDate, language: this.languageCode, placeholder: this.datePlaceholder, start: ((_a = this.dateValue) === null || _a === void 0 ? void 0 : _a.length) ? this.dateValue : null })), this.rowIndex >= this.minRowCount ? (h("div", { class: "delete-button-contianer" }, h("pn-button", { ref: el => (this.pnDeleteRowButton = el), small: "true", "icon-only": "true", icon: "minus", appearance: "warning", index: this.rowIndex, onClick: () => {
|
|
171
|
+
this.deleteRow();
|
|
172
|
+
} }, "Delete"))) : null)));
|
|
173
|
+
}
|
|
174
|
+
get hostElement() { return this; }
|
|
175
|
+
static get watchers() { return {
|
|
176
|
+
"predefinedValue": ["applyPredefinedValue"]
|
|
177
|
+
}; }
|
|
178
|
+
static get style() { return pnDropdownWithMultiInputRowsRowCss; }
|
|
179
|
+
}, [0, "pn-dropdown-with-multi-input-rows-row", {
|
|
180
|
+
"languageCode": [1, "language-code"],
|
|
181
|
+
"fristInputPlaceholder": [1, "frist-input-placeholder"],
|
|
182
|
+
"firstInputMin": [2, "first-input-min"],
|
|
183
|
+
"firstInputMax": [2, "first-input-max"],
|
|
184
|
+
"firstInputWarning": [2, "first-input-warning"],
|
|
185
|
+
"firstInputWarningText": [1, "first-input-warning-text"],
|
|
186
|
+
"firstInputLowErrorText": [1, "first-input-low-error-text"],
|
|
187
|
+
"firstInputHighErrorText": [1, "first-input-high-error-text"],
|
|
188
|
+
"secondInputPlaceholder": [1, "second-input-placeholder"],
|
|
189
|
+
"secondInputMin": [2, "second-input-min"],
|
|
190
|
+
"secondInputMax": [2, "second-input-max"],
|
|
191
|
+
"secondInputWarning": [2, "second-input-warning"],
|
|
192
|
+
"secondInputWarningText": [1, "second-input-warning-text"],
|
|
193
|
+
"secondInputLowErrorText": [1, "second-input-low-error-text"],
|
|
194
|
+
"secondInputHighErrorText": [1, "second-input-high-error-text"],
|
|
195
|
+
"dateLabel": [1, "date-label"],
|
|
196
|
+
"datePlaceholder": [1, "date-placeholder"],
|
|
197
|
+
"firstValidDate": [1, "first-valid-date"],
|
|
198
|
+
"lastValidDate": [1, "last-valid-date"],
|
|
199
|
+
"predefinedValue": [1, "predefined-value"],
|
|
200
|
+
"rowIndex": [2, "row-index"],
|
|
201
|
+
"minRowCount": [2, "min-row-count"],
|
|
202
|
+
"showFirstInputWarning": [32],
|
|
203
|
+
"showFirstInputLowError": [32],
|
|
204
|
+
"showFirstInputHighError": [32],
|
|
205
|
+
"showSecondInputWarning": [32],
|
|
206
|
+
"showSecondInputLowError": [32],
|
|
207
|
+
"showSecondInputHighError": [32],
|
|
208
|
+
"firstInputValue": [32],
|
|
209
|
+
"secondInputValue": [32],
|
|
210
|
+
"dateValue": [32]
|
|
211
|
+
}]);
|
|
212
|
+
function defineCustomElement() {
|
|
213
|
+
if (typeof customElements === "undefined") {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const components = ["pn-dropdown-with-multi-input-rows-row", "pn-marketweb-input"];
|
|
217
|
+
components.forEach(tagName => { switch (tagName) {
|
|
218
|
+
case "pn-dropdown-with-multi-input-rows-row":
|
|
219
|
+
if (!customElements.get(tagName)) {
|
|
220
|
+
customElements.define(tagName, PnDropdownWithMultiInputRowsRow);
|
|
221
|
+
}
|
|
222
|
+
break;
|
|
223
|
+
case "pn-marketweb-input":
|
|
224
|
+
if (!customElements.get(tagName)) {
|
|
225
|
+
defineCustomElement$1();
|
|
226
|
+
}
|
|
227
|
+
break;
|
|
228
|
+
} });
|
|
229
|
+
}
|
|
230
|
+
defineCustomElement();
|
|
231
|
+
|
|
232
|
+
export { PnDropdownWithMultiInputRowsRow as P, defineCustomElement as d };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface PnDropdownWithMultiInputRows extends Components.PnDropdownWithMultiInputRows, HTMLElement {}
|
|
4
|
+
export const PnDropdownWithMultiInputRows: {
|
|
5
|
+
prototype: PnDropdownWithMultiInputRows;
|
|
6
|
+
new (): PnDropdownWithMultiInputRows;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|