@postnord/pn-marketweb-components 2.4.17 → 2.4.18
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 +8 -4
- package/cjs/index-e4882728.js +72 -0
- package/cjs/loader.cjs.js +1 -1
- package/cjs/pn-date-and-time.cjs.entry.js +1 -1
- package/cjs/pn-dropdown-choice-adds-row.cjs.entry.js +254 -0
- package/cjs/pn-market-web-components.cjs.js +1 -1
- package/cjs/pn-multi-formfield.cjs.entry.js +2 -70
- package/collection/collection-manifest.json +1 -0
- package/collection/components/input/pn-date-and-time/pn-date-and-time.css +2 -1
- package/collection/components/input/pn-dropdown-choice-adds-row/pn-dropdown-choice-adds-row.css +58 -0
- package/collection/components/input/pn-dropdown-choice-adds-row/pn-dropdown-choice-adds-row.js +508 -0
- package/collection/components/input/pn-dropdown-choice-adds-row/pn-dropdown-choice-adds-row.stories.js +43 -0
- package/collection/components/input/pn-dropdown-choice-adds-row/types.js +1 -0
- package/components/index.d.ts +1 -0
- package/components/index.js +1 -0
- package/components/index3.js +61 -178
- package/components/index4.js +187 -0
- package/components/pn-date-and-time.js +1 -1
- package/components/pn-dropdown-choice-adds-row.d.ts +11 -0
- package/components/pn-dropdown-choice-adds-row.js +292 -0
- package/components/pn-find-price-result2.js +1 -1
- package/components/pn-find-service-and-price-result2.js +1 -1
- package/components/pn-mainnav-store.js +1 -1
- package/components/pn-marketweb-siteheader-login-linklist2.js +1 -1
- package/components/pn-marketweb-siteheader-search2.js +1 -1
- package/components/pn-multi-formfield.js +1 -69
- package/components/pn-product-pricelist-result.js +1 -1
- package/components/pn-profile-modal-store.js +1 -1
- package/components/pn-proxio-findprice.js +1 -1
- package/components/pn-sidenav-store.js +1 -1
- package/esm/index-8976f360.js +70 -0
- package/esm/index-ee44c065.js +8 -4
- package/esm/loader.js +1 -1
- package/esm/pn-date-and-time.entry.js +1 -1
- package/esm/pn-dropdown-choice-adds-row.entry.js +250 -0
- package/esm/pn-market-web-components.js +1 -1
- package/esm/pn-multi-formfield.entry.js +1 -69
- package/esm-es5/index-8976f360.js +1 -0
- package/esm-es5/index-ee44c065.js +1 -1
- package/esm-es5/loader.js +1 -1
- package/esm-es5/pn-date-and-time.entry.js +1 -1
- package/esm-es5/pn-dropdown-choice-adds-row.entry.js +1 -0
- package/esm-es5/pn-market-web-components.js +1 -1
- package/esm-es5/pn-multi-formfield.entry.js +1 -1
- package/package.json +1 -1
- package/pn-market-web-components/p-196b2316.system.entry.js +1 -0
- package/pn-market-web-components/p-296637c0.system.js +1 -0
- package/pn-market-web-components/p-3a897643.system.entry.js +1 -0
- package/pn-market-web-components/p-4e3d7a56.js +1 -0
- package/pn-market-web-components/p-4e7d4e69.entry.js +1 -0
- package/pn-market-web-components/{p-8ac445d6.entry.js → p-76ce7256.entry.js} +1 -1
- package/pn-market-web-components/p-c0961278.system.entry.js +1 -0
- package/pn-market-web-components/p-e5d9f268.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-choice-adds-row/pn-dropdown-choice-adds-row.d.ts +43 -0
- package/types/components/input/pn-dropdown-choice-adds-row/types.d.ts +18 -0
- package/types/components.d.ts +43 -0
- package/pn-market-web-components/p-14d13eaa.system.entry.js +0 -1
- package/pn-market-web-components/p-f7867310.entry.js +0 -1
- package/pn-market-web-components/p-fbae553c.system.entry.js +0 -1
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
package/components/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { PnChoiceButton as PnChoiceButton } from '../types/components/input/pn-c
|
|
|
9
9
|
export { PnCustomernumberSelector as PnCustomernumberSelector } from '../types/components/profile/pn-customernumber-selector/pn-customernumber-selector';
|
|
10
10
|
export { PnProfileSelectorOption as PnCustomernumberSelectorOption } from '../types/components/profile/pn-customernumber-selector/pn-customernumber-selector-option';
|
|
11
11
|
export { PnDateAndTime as PnDateAndTime } from '../types/components/input/pn-date-and-time/pn-date-and-time';
|
|
12
|
+
export { pnDropdownChoiceAddsRow as PnDropdownChoiceAddsRow } from '../types/components/input/pn-dropdown-choice-adds-row/pn-dropdown-choice-adds-row';
|
|
12
13
|
export { PnFilterCheckbox as PnFilterCheckbox } from '../types/components/input/pn-filter-checkbox/pn-filter-checkbox';
|
|
13
14
|
export { PnfindPrice as PnFindPrice } from '../types/components/widgets/pn-find-price/pn-find-price';
|
|
14
15
|
export { PnfindPriceResult as PnFindPriceResult } from '../types/components/widgets/pn-find-price/pn-find-price-result';
|
package/components/index.js
CHANGED
|
@@ -9,6 +9,7 @@ export { PnChoiceButton, defineCustomElement as defineCustomElementPnChoiceButto
|
|
|
9
9
|
export { PnCustomernumberSelector, defineCustomElement as defineCustomElementPnCustomernumberSelector } from './pn-customernumber-selector.js';
|
|
10
10
|
export { PnCustomernumberSelectorOption, defineCustomElement as defineCustomElementPnCustomernumberSelectorOption } from './pn-customernumber-selector-option.js';
|
|
11
11
|
export { PnDateAndTime, defineCustomElement as defineCustomElementPnDateAndTime } from './pn-date-and-time.js';
|
|
12
|
+
export { PnDropdownChoiceAddsRow, defineCustomElement as defineCustomElementPnDropdownChoiceAddsRow } from './pn-dropdown-choice-adds-row.js';
|
|
12
13
|
export { PnFilterCheckbox, defineCustomElement as defineCustomElementPnFilterCheckbox } from './pn-filter-checkbox.js';
|
|
13
14
|
export { PnFindPrice, defineCustomElement as defineCustomElementPnFindPrice } from './pn-find-price.js';
|
|
14
15
|
export { PnFindPriceResult, defineCustomElement as defineCustomElementPnFindPriceResult } from './pn-find-price-result.js';
|
package/components/index3.js
CHANGED
|
@@ -1,187 +1,70 @@
|
|
|
1
|
-
import { getRenderingRef, forceUpdate } from '@stencil/core/internal/client';
|
|
2
|
-
|
|
3
|
-
const appendToMap = (map, propName, value) => {
|
|
4
|
-
const items = map.get(propName);
|
|
5
|
-
if (!items) {
|
|
6
|
-
map.set(propName, [value]);
|
|
7
|
-
}
|
|
8
|
-
else if (!items.includes(value)) {
|
|
9
|
-
items.push(value);
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
const debounce = (fn, ms) => {
|
|
13
|
-
let timeoutId;
|
|
14
|
-
return (...args) => {
|
|
15
|
-
if (timeoutId) {
|
|
16
|
-
clearTimeout(timeoutId);
|
|
17
|
-
}
|
|
18
|
-
timeoutId = setTimeout(() => {
|
|
19
|
-
timeoutId = 0;
|
|
20
|
-
fn(...args);
|
|
21
|
-
}, ms);
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
|
|
25
1
|
/**
|
|
26
|
-
*
|
|
27
|
-
* The
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
2
|
+
* Returns a function, that, as long as it continues to be invoked, will not
|
|
3
|
+
* be triggered. The function will be called after it stops being called for
|
|
4
|
+
* N milliseconds. If `immediate` is passed, trigger the function on the
|
|
5
|
+
* leading edge, instead of the trailing. The function also has a property 'clear'
|
|
6
|
+
* that is a function which will clear the timer to prevent previously scheduled executions.
|
|
31
7
|
*
|
|
32
|
-
*
|
|
8
|
+
* @source underscore.js
|
|
9
|
+
* @see http://unscriptable.com/2009/03/20/debouncing-javascript-methods/
|
|
10
|
+
* @param {Function} function to wrap
|
|
11
|
+
* @param {Number} timeout in ms (`100`)
|
|
12
|
+
* @param {Boolean} whether to execute at the beginning (`false`)
|
|
13
|
+
* @api public
|
|
33
14
|
*/
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
15
|
+
function debounce(func, wait, immediate){
|
|
16
|
+
var timeout, args, context, timestamp, result;
|
|
17
|
+
if (null == wait) wait = 100;
|
|
18
|
+
|
|
19
|
+
function later() {
|
|
20
|
+
var last = Date.now() - timestamp;
|
|
21
|
+
|
|
22
|
+
if (last < wait && last >= 0) {
|
|
23
|
+
timeout = setTimeout(later, wait - last);
|
|
24
|
+
} else {
|
|
25
|
+
timeout = null;
|
|
26
|
+
if (!immediate) {
|
|
27
|
+
result = func.apply(context, args);
|
|
28
|
+
context = args = null;
|
|
29
|
+
}
|
|
38
30
|
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
31
|
+
}
|
|
32
|
+
var debounced = function(){
|
|
33
|
+
context = this;
|
|
34
|
+
args = arguments;
|
|
35
|
+
timestamp = Date.now();
|
|
36
|
+
var callNow = immediate && !timeout;
|
|
37
|
+
if (!timeout) timeout = setTimeout(later, wait);
|
|
38
|
+
if (callNow) {
|
|
39
|
+
result = func.apply(context, args);
|
|
40
|
+
context = args = null;
|
|
45
41
|
}
|
|
46
|
-
const elmsToUpdate = new Map();
|
|
47
|
-
return {
|
|
48
|
-
dispose: () => elmsToUpdate.clear(),
|
|
49
|
-
get: (propName) => {
|
|
50
|
-
const elm = getRenderingRef();
|
|
51
|
-
if (elm) {
|
|
52
|
-
appendToMap(elmsToUpdate, propName, elm);
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
set: (propName) => {
|
|
56
|
-
const elements = elmsToUpdate.get(propName);
|
|
57
|
-
if (elements) {
|
|
58
|
-
elmsToUpdate.set(propName, elements.filter(forceUpdate));
|
|
59
|
-
}
|
|
60
|
-
cleanupElements(elmsToUpdate);
|
|
61
|
-
},
|
|
62
|
-
reset: () => {
|
|
63
|
-
elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
|
|
64
|
-
cleanupElements(elmsToUpdate);
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
42
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
};
|
|
77
|
-
const reset = () => {
|
|
78
|
-
states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
|
|
79
|
-
handlers.reset.forEach((cb) => cb());
|
|
80
|
-
};
|
|
81
|
-
const dispose = () => {
|
|
82
|
-
// Call first dispose as resetting the state would
|
|
83
|
-
// cause less updates ;)
|
|
84
|
-
handlers.dispose.forEach((cb) => cb());
|
|
85
|
-
reset();
|
|
86
|
-
};
|
|
87
|
-
const get = (propName) => {
|
|
88
|
-
handlers.get.forEach((cb) => cb(propName));
|
|
89
|
-
return states.get(propName);
|
|
90
|
-
};
|
|
91
|
-
const set = (propName, value) => {
|
|
92
|
-
const oldValue = states.get(propName);
|
|
93
|
-
if (shouldUpdate(value, oldValue, propName)) {
|
|
94
|
-
states.set(propName, value);
|
|
95
|
-
handlers.set.forEach((cb) => cb(propName, value, oldValue));
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
const state = (typeof Proxy === 'undefined'
|
|
99
|
-
? {}
|
|
100
|
-
: new Proxy(defaultState, {
|
|
101
|
-
get(_, propName) {
|
|
102
|
-
return get(propName);
|
|
103
|
-
},
|
|
104
|
-
ownKeys(_) {
|
|
105
|
-
return Array.from(states.keys());
|
|
106
|
-
},
|
|
107
|
-
getOwnPropertyDescriptor() {
|
|
108
|
-
return {
|
|
109
|
-
enumerable: true,
|
|
110
|
-
configurable: true,
|
|
111
|
-
};
|
|
112
|
-
},
|
|
113
|
-
has(_, propName) {
|
|
114
|
-
return states.has(propName);
|
|
115
|
-
},
|
|
116
|
-
set(_, propName, value) {
|
|
117
|
-
set(propName, value);
|
|
118
|
-
return true;
|
|
119
|
-
},
|
|
120
|
-
}));
|
|
121
|
-
const on = (eventName, callback) => {
|
|
122
|
-
handlers[eventName].push(callback);
|
|
123
|
-
return () => {
|
|
124
|
-
removeFromArray(handlers[eventName], callback);
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
const onChange = (propName, cb) => {
|
|
128
|
-
const unSet = on('set', (key, newValue) => {
|
|
129
|
-
if (key === propName) {
|
|
130
|
-
cb(newValue);
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
const unReset = on('reset', () => cb(defaultState[propName]));
|
|
134
|
-
return () => {
|
|
135
|
-
unSet();
|
|
136
|
-
unReset();
|
|
137
|
-
};
|
|
138
|
-
};
|
|
139
|
-
const use = (...subscriptions) => {
|
|
140
|
-
const unsubs = subscriptions.reduce((unsubs, subscription) => {
|
|
141
|
-
if (subscription.set) {
|
|
142
|
-
unsubs.push(on('set', subscription.set));
|
|
143
|
-
}
|
|
144
|
-
if (subscription.get) {
|
|
145
|
-
unsubs.push(on('get', subscription.get));
|
|
146
|
-
}
|
|
147
|
-
if (subscription.reset) {
|
|
148
|
-
unsubs.push(on('reset', subscription.reset));
|
|
149
|
-
}
|
|
150
|
-
if (subscription.dispose) {
|
|
151
|
-
unsubs.push(on('dispose', subscription.dispose));
|
|
152
|
-
}
|
|
153
|
-
return unsubs;
|
|
154
|
-
}, []);
|
|
155
|
-
return () => unsubs.forEach((unsub) => unsub());
|
|
156
|
-
};
|
|
157
|
-
const forceUpdate = (key) => {
|
|
158
|
-
const oldValue = states.get(key);
|
|
159
|
-
handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
|
|
160
|
-
};
|
|
161
|
-
return {
|
|
162
|
-
state,
|
|
163
|
-
get,
|
|
164
|
-
set,
|
|
165
|
-
on,
|
|
166
|
-
onChange,
|
|
167
|
-
use,
|
|
168
|
-
dispose,
|
|
169
|
-
reset,
|
|
170
|
-
forceUpdate,
|
|
171
|
-
};
|
|
172
|
-
};
|
|
173
|
-
const removeFromArray = (array, item) => {
|
|
174
|
-
const index = array.indexOf(item);
|
|
175
|
-
if (index >= 0) {
|
|
176
|
-
array[index] = array[array.length - 1];
|
|
177
|
-
array.length--;
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
debounced.clear = function() {
|
|
47
|
+
if (timeout) {
|
|
48
|
+
clearTimeout(timeout);
|
|
49
|
+
timeout = null;
|
|
178
50
|
}
|
|
179
|
-
};
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
debounced.flush = function() {
|
|
54
|
+
if (timeout) {
|
|
55
|
+
result = func.apply(context, args);
|
|
56
|
+
context = args = null;
|
|
57
|
+
|
|
58
|
+
clearTimeout(timeout);
|
|
59
|
+
timeout = null;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
return debounced;
|
|
64
|
+
}
|
|
65
|
+
// Adds compatibility for ES modules
|
|
66
|
+
debounce.debounce = debounce;
|
|
180
67
|
|
|
181
|
-
|
|
182
|
-
const map = createObservableMap(defaultState, shouldUpdate);
|
|
183
|
-
map.use(stencilSubscription());
|
|
184
|
-
return map;
|
|
185
|
-
};
|
|
68
|
+
var debounce_1 = debounce;
|
|
186
69
|
|
|
187
|
-
export {
|
|
70
|
+
export { debounce_1 as d };
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { getRenderingRef, forceUpdate } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
const appendToMap = (map, propName, value) => {
|
|
4
|
+
const items = map.get(propName);
|
|
5
|
+
if (!items) {
|
|
6
|
+
map.set(propName, [value]);
|
|
7
|
+
}
|
|
8
|
+
else if (!items.includes(value)) {
|
|
9
|
+
items.push(value);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const debounce = (fn, ms) => {
|
|
13
|
+
let timeoutId;
|
|
14
|
+
return (...args) => {
|
|
15
|
+
if (timeoutId) {
|
|
16
|
+
clearTimeout(timeoutId);
|
|
17
|
+
}
|
|
18
|
+
timeoutId = setTimeout(() => {
|
|
19
|
+
timeoutId = 0;
|
|
20
|
+
fn(...args);
|
|
21
|
+
}, ms);
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Check if a possible element isConnected.
|
|
27
|
+
* The property might not be there, so we check for it.
|
|
28
|
+
*
|
|
29
|
+
* We want it to return true if isConnected is not a property,
|
|
30
|
+
* otherwise we would remove these elements and would not update.
|
|
31
|
+
*
|
|
32
|
+
* Better leak in Edge than to be useless.
|
|
33
|
+
*/
|
|
34
|
+
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
35
|
+
const cleanupElements = debounce((map) => {
|
|
36
|
+
for (let key of map.keys()) {
|
|
37
|
+
map.set(key, map.get(key).filter(isConnected));
|
|
38
|
+
}
|
|
39
|
+
}, 2000);
|
|
40
|
+
const stencilSubscription = () => {
|
|
41
|
+
if (typeof getRenderingRef !== 'function') {
|
|
42
|
+
// If we are not in a stencil project, we do nothing.
|
|
43
|
+
// This function is not really exported by @stencil/core.
|
|
44
|
+
return {};
|
|
45
|
+
}
|
|
46
|
+
const elmsToUpdate = new Map();
|
|
47
|
+
return {
|
|
48
|
+
dispose: () => elmsToUpdate.clear(),
|
|
49
|
+
get: (propName) => {
|
|
50
|
+
const elm = getRenderingRef();
|
|
51
|
+
if (elm) {
|
|
52
|
+
appendToMap(elmsToUpdate, propName, elm);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
set: (propName) => {
|
|
56
|
+
const elements = elmsToUpdate.get(propName);
|
|
57
|
+
if (elements) {
|
|
58
|
+
elmsToUpdate.set(propName, elements.filter(forceUpdate));
|
|
59
|
+
}
|
|
60
|
+
cleanupElements(elmsToUpdate);
|
|
61
|
+
},
|
|
62
|
+
reset: () => {
|
|
63
|
+
elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
|
|
64
|
+
cleanupElements(elmsToUpdate);
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
70
|
+
let states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
|
|
71
|
+
const handlers = {
|
|
72
|
+
dispose: [],
|
|
73
|
+
get: [],
|
|
74
|
+
set: [],
|
|
75
|
+
reset: [],
|
|
76
|
+
};
|
|
77
|
+
const reset = () => {
|
|
78
|
+
states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
|
|
79
|
+
handlers.reset.forEach((cb) => cb());
|
|
80
|
+
};
|
|
81
|
+
const dispose = () => {
|
|
82
|
+
// Call first dispose as resetting the state would
|
|
83
|
+
// cause less updates ;)
|
|
84
|
+
handlers.dispose.forEach((cb) => cb());
|
|
85
|
+
reset();
|
|
86
|
+
};
|
|
87
|
+
const get = (propName) => {
|
|
88
|
+
handlers.get.forEach((cb) => cb(propName));
|
|
89
|
+
return states.get(propName);
|
|
90
|
+
};
|
|
91
|
+
const set = (propName, value) => {
|
|
92
|
+
const oldValue = states.get(propName);
|
|
93
|
+
if (shouldUpdate(value, oldValue, propName)) {
|
|
94
|
+
states.set(propName, value);
|
|
95
|
+
handlers.set.forEach((cb) => cb(propName, value, oldValue));
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const state = (typeof Proxy === 'undefined'
|
|
99
|
+
? {}
|
|
100
|
+
: new Proxy(defaultState, {
|
|
101
|
+
get(_, propName) {
|
|
102
|
+
return get(propName);
|
|
103
|
+
},
|
|
104
|
+
ownKeys(_) {
|
|
105
|
+
return Array.from(states.keys());
|
|
106
|
+
},
|
|
107
|
+
getOwnPropertyDescriptor() {
|
|
108
|
+
return {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
configurable: true,
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
has(_, propName) {
|
|
114
|
+
return states.has(propName);
|
|
115
|
+
},
|
|
116
|
+
set(_, propName, value) {
|
|
117
|
+
set(propName, value);
|
|
118
|
+
return true;
|
|
119
|
+
},
|
|
120
|
+
}));
|
|
121
|
+
const on = (eventName, callback) => {
|
|
122
|
+
handlers[eventName].push(callback);
|
|
123
|
+
return () => {
|
|
124
|
+
removeFromArray(handlers[eventName], callback);
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
const onChange = (propName, cb) => {
|
|
128
|
+
const unSet = on('set', (key, newValue) => {
|
|
129
|
+
if (key === propName) {
|
|
130
|
+
cb(newValue);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
const unReset = on('reset', () => cb(defaultState[propName]));
|
|
134
|
+
return () => {
|
|
135
|
+
unSet();
|
|
136
|
+
unReset();
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
const use = (...subscriptions) => {
|
|
140
|
+
const unsubs = subscriptions.reduce((unsubs, subscription) => {
|
|
141
|
+
if (subscription.set) {
|
|
142
|
+
unsubs.push(on('set', subscription.set));
|
|
143
|
+
}
|
|
144
|
+
if (subscription.get) {
|
|
145
|
+
unsubs.push(on('get', subscription.get));
|
|
146
|
+
}
|
|
147
|
+
if (subscription.reset) {
|
|
148
|
+
unsubs.push(on('reset', subscription.reset));
|
|
149
|
+
}
|
|
150
|
+
if (subscription.dispose) {
|
|
151
|
+
unsubs.push(on('dispose', subscription.dispose));
|
|
152
|
+
}
|
|
153
|
+
return unsubs;
|
|
154
|
+
}, []);
|
|
155
|
+
return () => unsubs.forEach((unsub) => unsub());
|
|
156
|
+
};
|
|
157
|
+
const forceUpdate = (key) => {
|
|
158
|
+
const oldValue = states.get(key);
|
|
159
|
+
handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
|
|
160
|
+
};
|
|
161
|
+
return {
|
|
162
|
+
state,
|
|
163
|
+
get,
|
|
164
|
+
set,
|
|
165
|
+
on,
|
|
166
|
+
onChange,
|
|
167
|
+
use,
|
|
168
|
+
dispose,
|
|
169
|
+
reset,
|
|
170
|
+
forceUpdate,
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
const removeFromArray = (array, item) => {
|
|
174
|
+
const index = array.indexOf(item);
|
|
175
|
+
if (index >= 0) {
|
|
176
|
+
array[index] = array[array.length - 1];
|
|
177
|
+
array.length--;
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const createStore = (defaultState, shouldUpdate) => {
|
|
182
|
+
const map = createObservableMap(defaultState, shouldUpdate);
|
|
183
|
+
map.use(stencilSubscription());
|
|
184
|
+
return map;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export { createStore as c };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
|
|
3
|
-
const pnDateAndTimeCss = "pn-date-and-time label{color:#5E554A;font-size:1.4rem}pn-date-and-time .time-separator{margin:auto}pn-date-and-time .date-and-time-group{margin-bottom:1rem}pn-date-and-time .date-and-time-row{display:-ms-flexbox;display:flex;gap:1rem}pn-date-and-time .helper-text{margin-top:0.2rem;color:#5E554A;display:block}pn-date-and-time .error-message{color:#a70707}";
|
|
3
|
+
const pnDateAndTimeCss = "pn-date-and-time label{color:#5E554A;font-size:1.4rem}pn-date-and-time .time-separator{margin-top:auto;margin-bottom:auto}pn-date-and-time .date-and-time-group{margin-bottom:1rem}pn-date-and-time .date-and-time-row{display:-ms-flexbox;display:flex;gap:1rem}pn-date-and-time .helper-text{margin-top:0.2rem;color:#5E554A;display:block}pn-date-and-time .error-message{color:#a70707}";
|
|
4
4
|
|
|
5
5
|
const PnDateAndTime$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
6
|
constructor() {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface PnDropdownChoiceAddsRow extends Components.PnDropdownChoiceAddsRow, HTMLElement {}
|
|
4
|
+
export const PnDropdownChoiceAddsRow: {
|
|
5
|
+
prototype: PnDropdownChoiceAddsRow;
|
|
6
|
+
new (): PnDropdownChoiceAddsRow;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|