@odx/foundation 1.0.0-alpha.43 → 1.0.0-alpha.45
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/dist/components.js
CHANGED
|
@@ -2090,7 +2090,7 @@ var __decorateClass$N = (decorators, target, key, kind) => {
|
|
|
2090
2090
|
var __accessCheck$i = (obj, member, msg) => member.has(obj) || __typeError$i("Cannot " + msg);
|
|
2091
2091
|
var __privateGet$f = (obj, member, getter) => (__accessCheck$i(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
2092
2092
|
var __privateAdd$i = (obj, member, value) => member.has(obj) ? __typeError$i("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
2093
|
-
var _handleInput$1, _handleClear$1;
|
|
2093
|
+
var _handleInput$1, _handleKeyDown$2, _handleClear$1;
|
|
2094
2094
|
let OdxInput = class extends FormControl(CustomElement) {
|
|
2095
2095
|
constructor() {
|
|
2096
2096
|
super(...arguments);
|
|
@@ -2100,14 +2100,19 @@ let OdxInput = class extends FormControl(CustomElement) {
|
|
|
2100
2100
|
__privateAdd$i(this, _handleInput$1, (event) => {
|
|
2101
2101
|
this.value = event.target.value;
|
|
2102
2102
|
});
|
|
2103
|
-
__privateAdd$i(this,
|
|
2104
|
-
event
|
|
2103
|
+
__privateAdd$i(this, _handleKeyDown$2, (event) => {
|
|
2104
|
+
const { actions } = getKeyboardEventInfo(event);
|
|
2105
|
+
if (!actions.escape) return;
|
|
2106
|
+
event.preventDefault();
|
|
2107
|
+
__privateGet$f(this, _handleClear$1).call(this);
|
|
2108
|
+
});
|
|
2109
|
+
__privateAdd$i(this, _handleClear$1, () => {
|
|
2110
|
+
if (!this.clearable || this.emit("clear")) return;
|
|
2105
2111
|
this.clear();
|
|
2106
2112
|
});
|
|
2107
2113
|
}
|
|
2108
2114
|
clear() {
|
|
2109
2115
|
this.value = "";
|
|
2110
|
-
this.emit("clear");
|
|
2111
2116
|
}
|
|
2112
2117
|
render() {
|
|
2113
2118
|
const clearButton = when(
|
|
@@ -2124,9 +2129,10 @@ let OdxInput = class extends FormControl(CustomElement) {
|
|
|
2124
2129
|
?disabled=${this.disabled}
|
|
2125
2130
|
?readonly=${this.readonly}
|
|
2126
2131
|
.value=${this.value}
|
|
2127
|
-
@
|
|
2132
|
+
@keydown=${__privateGet$f(this, _handleKeyDown$2)}
|
|
2133
|
+
@change=${forwardEvent(this)}
|
|
2128
2134
|
@input=${__privateGet$f(this, _handleInput$1)}
|
|
2129
|
-
@search=${forwardEvent}
|
|
2135
|
+
@search=${forwardEvent(this)}
|
|
2130
2136
|
/>
|
|
2131
2137
|
${clearButton}
|
|
2132
2138
|
<slot name="suffix"></slot>
|
|
@@ -2135,6 +2141,7 @@ let OdxInput = class extends FormControl(CustomElement) {
|
|
|
2135
2141
|
}
|
|
2136
2142
|
};
|
|
2137
2143
|
_handleInput$1 = new WeakMap();
|
|
2144
|
+
_handleKeyDown$2 = new WeakMap();
|
|
2138
2145
|
_handleClear$1 = new WeakMap();
|
|
2139
2146
|
OdxInput.formAssociated = true;
|
|
2140
2147
|
__decorateClass$N([
|
|
@@ -2926,7 +2933,7 @@ let OdxModal = class extends CustomElement {
|
|
|
2926
2933
|
}
|
|
2927
2934
|
render() {
|
|
2928
2935
|
return html`
|
|
2929
|
-
<dialog class="base" @close=${forwardEvent} @keydown=${__privateGet$9(this, _handleKeyDown)}>
|
|
2936
|
+
<dialog class="base" @close=${forwardEvent(this)} @keydown=${__privateGet$9(this, _handleKeyDown)}>
|
|
2930
2937
|
<div class="inner">
|
|
2931
2938
|
${when(
|
|
2932
2939
|
this.dismissable,
|
|
@@ -3479,17 +3486,16 @@ let OdxSearchBar = class extends CustomElement {
|
|
|
3479
3486
|
this.placeholder = "";
|
|
3480
3487
|
__privateAdd$9(this, _handleSearch, (event) => {
|
|
3481
3488
|
event.preventDefault();
|
|
3482
|
-
event.stopPropagation();
|
|
3483
3489
|
this.search(__privateGet$7(this, _OdxSearchBar_instances, inputValue_get));
|
|
3484
3490
|
});
|
|
3485
3491
|
__privateAdd$9(this, _handleInput, (event) => {
|
|
3486
3492
|
if (this.behavior !== SearchBarBehavior.INSTANT) return;
|
|
3487
3493
|
event.preventDefault();
|
|
3488
|
-
event.stopPropagation();
|
|
3489
3494
|
__privateGet$7(this, _search).call(this, __privateGet$7(this, _OdxSearchBar_instances, inputValue_get));
|
|
3490
3495
|
});
|
|
3491
|
-
__privateAdd$9(this, _handleClear, (event) => {
|
|
3492
|
-
|
|
3496
|
+
__privateAdd$9(this, _handleClear, async (event) => {
|
|
3497
|
+
forwardEvent(this)(event);
|
|
3498
|
+
if (event.defaultPrevented) return;
|
|
3493
3499
|
this.search("");
|
|
3494
3500
|
});
|
|
3495
3501
|
}
|
|
@@ -3499,7 +3505,7 @@ let OdxSearchBar = class extends CustomElement {
|
|
|
3499
3505
|
search(value, options) {
|
|
3500
3506
|
if (__privateGet$7(this, _value) === value && options?.forceUpdate !== true) return;
|
|
3501
3507
|
__privateMethod$7(this, _OdxSearchBar_instances, updateValue_fn).call(this, value, options?.updateInput);
|
|
3502
|
-
if (options?.
|
|
3508
|
+
if (options?.emitEvent === false) return;
|
|
3503
3509
|
this.dispatchEvent(new SearchEvent(value, this.inputElement.value));
|
|
3504
3510
|
}
|
|
3505
3511
|
connectedCallback() {
|
package/dist/lib/utils/dom.d.ts
CHANGED
|
@@ -11,5 +11,5 @@ export declare function findClosestDocument(node: Node): ShadowRoot | Document |
|
|
|
11
11
|
export declare function toPx(value?: string | number | null): string | null;
|
|
12
12
|
export declare function getAssignedElements<T extends HTMLElement = HTMLElement>(host: HTMLElement, ...slots: string[]): T[];
|
|
13
13
|
export declare function waitForAnimations(element?: Element | null, subtree?: boolean): Promise<Animation[]>;
|
|
14
|
-
export declare function forwardEvent(
|
|
14
|
+
export declare function forwardEvent(target: HTMLElement, eventInit?: EventInit): EventListener;
|
|
15
15
|
//# sourceMappingURL=dom.d.ts.map
|
package/dist/main.js
CHANGED
|
@@ -48,9 +48,15 @@ async function waitForAnimations(element, subtree = false) {
|
|
|
48
48
|
}
|
|
49
49
|
return Promise.all(element.getAnimations({ subtree }).map((animation) => animation.finished)).catch(() => []);
|
|
50
50
|
}
|
|
51
|
-
function forwardEvent(
|
|
52
|
-
event
|
|
53
|
-
|
|
51
|
+
function forwardEvent(target, eventInit) {
|
|
52
|
+
return (event) => {
|
|
53
|
+
event.stopPropagation();
|
|
54
|
+
const shouldPreventDefault = target.dispatchEvent(
|
|
55
|
+
new CustomEvent(event.type, { bubbles: event.bubbles, composed: event.composed, cancelable: event.cancelable, ...eventInit })
|
|
56
|
+
);
|
|
57
|
+
if (shouldPreventDefault) return;
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
};
|
|
54
60
|
}
|
|
55
61
|
|
|
56
62
|
function createOptions(defaultOptions) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odx/foundation",
|
|
3
3
|
"description": "A library of Web Component building blocks for ODX",
|
|
4
|
-
"version": "1.0.0-alpha.
|
|
4
|
+
"version": "1.0.0-alpha.45",
|
|
5
5
|
"author": "Drägerwerk AG & Co.KGaA",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
7
7
|
"homepage": "https://odx.draeger.com",
|