@ui5/webcomponents-base 0.0.0-c41f1b293 → 0.0.0-c48b38fdc
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/.eslintignore +2 -0
- package/CHANGELOG.md +647 -0
- package/README.md +2 -1
- package/bundle.esm.js +1 -2
- package/dist/.tsbuildinfo +1 -0
- package/dist/AssetRegistry.d.ts +2 -2
- package/dist/AssetRegistry.js +2 -2
- package/dist/AssetRegistry.js.map +1 -1
- package/dist/Boot.d.ts +3 -2
- package/dist/Boot.js +7 -4
- package/dist/Boot.js.map +1 -1
- package/dist/CSP.d.ts +9 -6
- package/dist/CSP.js +9 -6
- package/dist/CSP.js.map +1 -1
- package/dist/CustomElementsScope.d.ts +4 -4
- package/dist/CustomElementsScope.js +2 -2
- package/dist/CustomElementsScope.js.map +1 -1
- package/dist/CustomElementsScopeUtils.d.ts +8 -1
- package/dist/CustomElementsScopeUtils.js +13 -1
- package/dist/CustomElementsScopeUtils.js.map +1 -1
- package/dist/Device.d.ts +2 -1
- package/dist/Device.js +10 -1
- package/dist/Device.js.map +1 -1
- package/dist/FontFace.js +1 -1
- package/dist/FontFace.js.map +1 -1
- package/dist/IgnoreCustomElements.d.ts +3 -5
- package/dist/IgnoreCustomElements.js +3 -5
- package/dist/IgnoreCustomElements.js.map +1 -1
- package/dist/InitialConfiguration.d.ts +2 -2
- package/dist/InitialConfiguration.js +7 -6
- package/dist/InitialConfiguration.js.map +1 -1
- package/dist/Keys.d.ts +5 -1
- package/dist/Keys.js +109 -106
- package/dist/Keys.js.map +1 -1
- package/dist/ManagedStyles.d.ts +5 -4
- package/dist/ManagedStyles.js +96 -23
- package/dist/ManagedStyles.js.map +1 -1
- package/dist/MediaRange.d.ts +6 -12
- package/dist/MediaRange.js +21 -31
- package/dist/MediaRange.js.map +1 -1
- package/dist/StaticAreaItem.d.ts +3 -4
- package/dist/StaticAreaItem.js +10 -12
- package/dist/StaticAreaItem.js.map +1 -1
- package/dist/UI5Element.d.ts +36 -27
- package/dist/UI5Element.js +98 -47
- package/dist/UI5Element.js.map +1 -1
- package/dist/UI5ElementMetadata.d.ts +6 -13
- package/dist/UI5ElementMetadata.js +17 -15
- package/dist/UI5ElementMetadata.js.map +1 -1
- package/dist/asset-registries/Icons.d.ts +4 -3
- package/dist/asset-registries/Icons.js +28 -17
- package/dist/asset-registries/Icons.js.map +1 -1
- package/dist/asset-registries/Illustrations.d.ts +2 -0
- package/dist/asset-registries/Illustrations.js +51 -20
- package/dist/asset-registries/Illustrations.js.map +1 -1
- package/dist/asset-registries/LocaleData.js +1 -1
- package/dist/asset-registries/LocaleData.js.map +1 -1
- package/dist/asset-registries/Themes.d.ts +4 -3
- package/dist/asset-registries/Themes.js +26 -10
- package/dist/asset-registries/Themes.js.map +1 -1
- package/dist/asset-registries/i18n.d.ts +2 -2
- package/dist/asset-registries/i18n.js +4 -3
- package/dist/asset-registries/i18n.js.map +1 -1
- package/dist/{assets-meta → asset-registries/util}/IconCollectionsAlias.d.ts +1 -2
- package/dist/{assets-meta → asset-registries/util}/IconCollectionsAlias.js +1 -2
- package/dist/asset-registries/util/IconCollectionsAlias.js.map +1 -0
- package/dist/asset-registries/util/IconCollectionsByTheme.d.ts +20 -0
- package/dist/asset-registries/util/IconCollectionsByTheme.js +42 -0
- package/dist/asset-registries/util/IconCollectionsByTheme.js.map +1 -0
- package/dist/asset-registries/util/getIconCollectionByTheme.d.ts +13 -0
- package/dist/asset-registries/util/getIconCollectionByTheme.js +29 -0
- package/dist/asset-registries/util/getIconCollectionByTheme.js.map +1 -0
- package/dist/config/CalendarType.d.ts +8 -1
- package/dist/config/CalendarType.js +18 -2
- package/dist/config/CalendarType.js.map +1 -1
- package/dist/config/Icons.d.ts +9 -24
- package/dist/config/Icons.js +8 -67
- package/dist/config/Icons.js.map +1 -1
- package/dist/config/Language.d.ts +1 -1
- package/dist/config/Language.js +6 -3
- package/dist/config/Language.js.map +1 -1
- package/dist/config/Theme.d.ts +1 -1
- package/dist/config/Theme.js +7 -4
- package/dist/config/Theme.js.map +1 -1
- package/dist/config/ThemeRoot.d.ts +2 -4
- package/dist/config/ThemeRoot.js +2 -4
- package/dist/config/ThemeRoot.js.map +1 -1
- package/dist/config/Timezone.d.ts +1 -1
- package/dist/config/Timezone.js +1 -1
- package/dist/config/Timezone.js.map +1 -1
- package/dist/connectToComponent.d.ts +9 -0
- package/dist/connectToComponent.js +59 -0
- package/dist/connectToComponent.js.map +1 -0
- package/dist/css/FontFace.css +47 -17
- package/dist/css/SystemCSSVars.css +0 -8
- package/dist/custom-elements-internal.json +2863 -0
- package/dist/custom-elements.json +2593 -0
- package/dist/decorators/customElement.d.ts +1 -1
- package/dist/decorators/customElement.js +1 -1
- package/dist/decorators/customElement.js.map +1 -1
- package/dist/decorators/event.d.ts +5 -2
- package/dist/decorators/event.js.map +1 -1
- package/dist/decorators.d.ts +5 -0
- package/dist/decorators.js +6 -0
- package/dist/decorators.js.map +1 -0
- package/dist/delegate/ItemNavigation.d.ts +9 -8
- package/dist/delegate/ItemNavigation.js +13 -14
- package/dist/delegate/ItemNavigation.js.map +1 -1
- package/dist/delegate/ResizeHandler.d.ts +4 -6
- package/dist/delegate/ResizeHandler.js +4 -6
- package/dist/delegate/ResizeHandler.js.map +1 -1
- package/dist/delegate/ScrollEnablement.js +2 -2
- package/dist/delegate/ScrollEnablement.js.map +1 -1
- package/dist/features/OpenUI5Enablement.d.ts +1 -1
- package/dist/features/OpenUI5Support.d.ts +13 -3
- package/dist/features/OpenUI5Support.js +94 -33
- package/dist/features/OpenUI5Support.js.map +1 -1
- package/dist/features/patchPopup.d.ts +10 -0
- package/dist/features/patchPopup.js +15 -0
- package/dist/features/patchPopup.js.map +1 -0
- package/dist/generated/AssetParameters.d.ts +6 -0
- package/dist/generated/AssetParameters.js +3 -10
- package/dist/generated/AssetParameters.js.map +1 -0
- package/dist/generated/VersionInfo.d.ts +10 -0
- package/dist/generated/VersionInfo.js +9 -8
- package/dist/generated/VersionInfo.js.map +1 -0
- package/dist/generated/css/FontFace.css.js +1 -1
- package/dist/generated/css/FontFace.css.js.map +1 -1
- package/dist/generated/css/SystemCSSVars.css.js +1 -1
- package/dist/generated/css/SystemCSSVars.css.js.map +1 -1
- package/dist/generated/templates/elements/WithComplexTemplateTemplate.lit.d.ts +1 -1
- package/dist/i18nBundle.d.ts +2 -4
- package/dist/i18nBundle.js +1 -4
- package/dist/i18nBundle.js.map +1 -1
- package/dist/locale/applyDirection.d.ts +3 -2
- package/dist/locale/applyDirection.js +3 -2
- package/dist/locale/applyDirection.js.map +1 -1
- package/dist/locale/getEffectiveDir.d.ts +1 -1
- package/dist/locale/getEffectiveDir.js +3 -19
- package/dist/locale/getEffectiveDir.js.map +1 -1
- package/dist/renderer/LitRenderer.d.ts +2 -2
- package/dist/renderer/directives/style-map.d.ts +13 -0
- package/dist/renderer/directives/style-map.js +59 -59
- package/dist/renderer/directives/style-map.js.map +1 -0
- package/dist/sap/base/Log.js +698 -188
- package/dist/sap/base/assert.js +28 -1
- package/dist/sap/base/config/MemoryConfigurationProvider.js +20 -0
- package/dist/sap/base/security/URLListValidator.js +253 -6
- package/dist/sap/base/security/encodeCSS.js +34 -8
- package/dist/sap/base/security/encodeXML.js +47 -17
- package/dist/sap/base/security/sanitizeHTML.js +35 -13
- package/dist/sap/base/strings/toHex.js +27 -2
- package/dist/sap/base/util/now.js +24 -3
- package/dist/sap/base/util/uid.js +27 -0
- package/dist/sap/ui/thirdparty/caja-html-sanitizer.js +112 -97
- package/dist/ssr-dom-shim.d.ts +1 -0
- package/dist/ssr-dom-shim.js +12 -0
- package/dist/ssr-dom-shim.js.map +1 -0
- package/dist/ssr-dom.d.ts +0 -0
- package/dist/ssr-dom.js +3 -0
- package/dist/ssr-dom.js.map +1 -0
- package/dist/theming/applyTheme.js +5 -5
- package/dist/theming/applyTheme.js.map +1 -1
- package/dist/types/AnimationMode.d.ts +0 -8
- package/dist/types/AnimationMode.js +0 -8
- package/dist/types/AnimationMode.js.map +1 -1
- package/dist/types/CSSColor.d.ts +0 -4
- package/dist/types/CSSColor.js +0 -4
- package/dist/types/CSSColor.js.map +1 -1
- package/dist/types/CSSSize.d.ts +11 -0
- package/dist/types/CSSSize.js +14 -0
- package/dist/types/CSSSize.js.map +1 -0
- package/dist/types/CalendarType.d.ts +0 -9
- package/dist/types/CalendarType.js +0 -9
- package/dist/types/CalendarType.js.map +1 -1
- package/dist/types/DOMReference.d.ts +1 -5
- package/dist/types/DOMReference.js +1 -5
- package/dist/types/DOMReference.js.map +1 -1
- package/dist/types/DataType.d.ts +1 -6
- package/dist/types/DataType.js +1 -6
- package/dist/types/DataType.js.map +1 -1
- package/dist/types/Float.d.ts +0 -3
- package/dist/types/Float.js +0 -3
- package/dist/types/Float.js.map +1 -1
- package/dist/types/Integer.d.ts +0 -3
- package/dist/types/Integer.js +0 -3
- package/dist/types/Integer.js.map +1 -1
- package/dist/types/InvisibleMessageMode.d.ts +5 -10
- package/dist/types/InvisibleMessageMode.js +4 -11
- package/dist/types/InvisibleMessageMode.js.map +1 -1
- package/dist/types/ItemNavigationBehavior.d.ts +0 -6
- package/dist/types/ItemNavigationBehavior.js +0 -6
- package/dist/types/ItemNavigationBehavior.js.map +1 -1
- package/dist/types/MovePlacement.d.ts +20 -0
- package/dist/types/MovePlacement.js +22 -0
- package/dist/types/MovePlacement.js.map +1 -0
- package/dist/types/NavigationMode.d.ts +0 -8
- package/dist/types/NavigationMode.js +0 -8
- package/dist/types/NavigationMode.js.map +1 -1
- package/dist/types/Orientation.d.ts +16 -0
- package/dist/types/Orientation.js +18 -0
- package/dist/types/Orientation.js.map +1 -0
- package/dist/types/ValueState.d.ts +0 -14
- package/dist/types/ValueState.js +0 -14
- package/dist/types/ValueState.js.map +1 -1
- package/dist/types.d.ts +11 -1
- package/dist/types.js.map +1 -1
- package/dist/updateShadowRoot.js +2 -1
- package/dist/updateShadowRoot.js.map +1 -1
- package/dist/util/ColorConversion.js +200 -195
- package/dist/util/ColorConversion.js.map +1 -1
- package/dist/util/InvisibleMessage.d.ts +1 -1
- package/dist/util/InvisibleMessage.js.map +1 -1
- package/dist/util/PopupUtils.js +1 -1
- package/dist/util/PopupUtils.js.map +1 -1
- package/dist/util/clamp.js +2 -1
- package/dist/util/clamp.js.map +1 -1
- package/dist/util/createLinkInHead.d.ts +1 -1
- package/dist/util/createLinkInHead.js +1 -1
- package/dist/util/createLinkInHead.js.map +1 -1
- package/dist/util/createStyleInHead.d.ts +1 -1
- package/dist/util/createStyleInHead.js +1 -1
- package/dist/util/createStyleInHead.js.map +1 -1
- package/dist/util/detectNavigatorLanguage.d.ts +2 -2
- package/dist/util/detectNavigatorLanguage.js +6 -1
- package/dist/util/detectNavigatorLanguage.js.map +1 -1
- package/dist/util/dragAndDrop/DragRegistry.d.ts +12 -0
- package/dist/util/dragAndDrop/DragRegistry.js +66 -0
- package/dist/util/dragAndDrop/DragRegistry.js.map +1 -0
- package/dist/util/dragAndDrop/findClosestPosition.d.ts +7 -0
- package/dist/util/dragAndDrop/findClosestPosition.js +59 -0
- package/dist/util/dragAndDrop/findClosestPosition.js.map +1 -0
- package/dist/util/dragAndDrop/longDragOverHandler.d.ts +2 -0
- package/dist/util/dragAndDrop/longDragOverHandler.js +25 -0
- package/dist/util/dragAndDrop/longDragOverHandler.js.map +1 -0
- package/dist/util/getClassCopy.d.ts +54 -34
- package/dist/util/getDesigntimePropertyAsArray.d.ts +2 -2
- package/dist/util/getDesigntimePropertyAsArray.js +2 -1
- package/dist/util/getDesigntimePropertyAsArray.js.map +1 -1
- package/dist/util/getParentElement.d.ts +2 -0
- package/dist/util/getParentElement.js +5 -0
- package/dist/util/getParentElement.js.map +1 -0
- package/dist/util/isElementContainingBlock.d.ts +2 -0
- package/dist/util/isElementContainingBlock.js +11 -0
- package/dist/util/isElementContainingBlock.js.map +1 -0
- package/dist/vscode.html-custom-data.json +22 -0
- package/index.js +3 -5
- package/lib/generate-asset-parameters/index.js +2 -2
- package/lib/generate-version-info/index.js +2 -2
- package/package-scripts.cjs +14 -18
- package/package.json +14 -6
- package/src/css/FontFace.css +47 -17
- package/src/css/SystemCSSVars.css +0 -8
- package/tsconfig.json +6 -0
- package/used-modules.txt +4 -0
- package/dist/api.json +0 -1
- package/dist/assets/Boot.18e749cb.js +0 -9
- package/dist/assets/Boot.34b7cea0.css +0 -1
- package/dist/assets/bundle.esm.179dce7c.js +0 -50
- package/dist/assets-meta/IconCollectionsAlias.js.map +0 -1
- package/dist/config/RTL.d.ts +0 -7
- package/dist/config/RTL.js +0 -37
- package/dist/config/RTL.js.map +0 -1
- package/src/renderer/directives/style-map.js +0 -72
package/dist/UI5Element.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
|
+
import "@ui5/webcomponents-base/dist/ssr-dom.js";
|
|
1
3
|
import merge from "./thirdparty/merge.js";
|
|
2
4
|
import { boot } from "./Boot.js";
|
|
3
5
|
import UI5ElementMetadata from "./UI5ElementMetadata.js";
|
|
@@ -18,7 +20,6 @@ import arraysAreEqual from "./util/arraysAreEqual.js";
|
|
|
18
20
|
import { markAsRtlAware } from "./locale/RTLAwareRegistry.js";
|
|
19
21
|
import preloadLinks from "./theming/preloadLinks.js";
|
|
20
22
|
import executeTemplate from "./renderer/executeTemplate.js";
|
|
21
|
-
import { getCurrentRuntimeIndex } from "./Runtimes.js";
|
|
22
23
|
let autoId = 0;
|
|
23
24
|
const elementTimeouts = new Map();
|
|
24
25
|
const uniqueDependenciesCache = new Map();
|
|
@@ -37,15 +38,28 @@ function _invalidate(changeInfo) {
|
|
|
37
38
|
this.onInvalidation(changeInfo);
|
|
38
39
|
this._changedState.push(changeInfo);
|
|
39
40
|
renderDeferred(this);
|
|
40
|
-
this.
|
|
41
|
+
this._invalidationEventProvider.fireEvent("invalidate", { ...changeInfo, target: this });
|
|
41
42
|
}
|
|
42
43
|
/**
|
|
44
|
+
* looks up a property descsriptor including in the prototype chain
|
|
45
|
+
* @param proto the starting prototype
|
|
46
|
+
* @param name the property to look for
|
|
47
|
+
* @returns the property descriptor if found directly or in the prototype chaing, undefined if not found
|
|
48
|
+
*/
|
|
49
|
+
function getPropertyDescriptor(proto, name) {
|
|
50
|
+
do {
|
|
51
|
+
const descriptor = Object.getOwnPropertyDescriptor(proto, name);
|
|
52
|
+
if (descriptor) {
|
|
53
|
+
return descriptor;
|
|
54
|
+
}
|
|
55
|
+
// go up the prototype chain
|
|
56
|
+
proto = Object.getPrototypeOf(proto);
|
|
57
|
+
} while (proto && proto !== HTMLElement.prototype);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* @class
|
|
43
61
|
* Base class for all UI5 Web Components
|
|
44
62
|
*
|
|
45
|
-
* @class
|
|
46
|
-
* @constructor
|
|
47
|
-
* @author SAP SE
|
|
48
|
-
* @alias sap.ui.webc.base.UI5Element
|
|
49
63
|
* @extends HTMLElement
|
|
50
64
|
* @public
|
|
51
65
|
*/
|
|
@@ -59,7 +73,8 @@ class UI5Element extends HTMLElement {
|
|
|
59
73
|
this._fullyConnected = false; // A flag telling whether the UI5Element's onEnterDOM hook was called (since it's possible to have the element removed from DOM before that)
|
|
60
74
|
this._childChangeListeners = new Map(); // used to store lazy listeners per slot for the child change event of every child inside that slot
|
|
61
75
|
this._slotChangeListeners = new Map(); // used to store lazy listeners per slot for the slotchange event of all slot children inside that slot
|
|
62
|
-
this.
|
|
76
|
+
this._invalidationEventProvider = new EventProvider(); // used by parent components for listening to changes to child components
|
|
77
|
+
this._componentStateFinalizedEventProvider = new EventProvider(); // used by friend classes for synchronization
|
|
63
78
|
let deferredResolve;
|
|
64
79
|
this._domRefReadyPromise = new Promise(resolve => {
|
|
65
80
|
deferredResolve = resolve;
|
|
@@ -98,8 +113,6 @@ class UI5Element extends HTMLElement {
|
|
|
98
113
|
*/
|
|
99
114
|
async connectedCallback() {
|
|
100
115
|
const ctor = this.constructor;
|
|
101
|
-
this.setAttribute(`_ui5rt${getCurrentRuntimeIndex()}`, "");
|
|
102
|
-
this.setAttribute("_ui5host", "");
|
|
103
116
|
this.setAttribute(ctor.getMetadata().getPureTag(), "");
|
|
104
117
|
if (ctor.getMetadata().supportsF6FastNavigation()) {
|
|
105
118
|
this.setAttribute("data-sap-ui-fastnavgroup", "true");
|
|
@@ -164,14 +177,16 @@ class UI5Element extends HTMLElement {
|
|
|
164
177
|
*/
|
|
165
178
|
_startObservingDOMChildren() {
|
|
166
179
|
const ctor = this.constructor;
|
|
167
|
-
const
|
|
180
|
+
const metadata = ctor.getMetadata();
|
|
181
|
+
const shouldObserveChildren = metadata.hasSlots();
|
|
168
182
|
if (!shouldObserveChildren) {
|
|
169
183
|
return;
|
|
170
184
|
}
|
|
171
|
-
const canSlotText =
|
|
185
|
+
const canSlotText = metadata.canSlotText();
|
|
186
|
+
const hasClonedSlot = Object.keys(metadata.getSlots()).some(slotName => metadata.getSlots()[slotName].cloned);
|
|
172
187
|
const mutationObserverOptions = {
|
|
173
188
|
childList: true,
|
|
174
|
-
subtree: canSlotText,
|
|
189
|
+
subtree: canSlotText || hasClonedSlot,
|
|
175
190
|
characterData: canSlotText,
|
|
176
191
|
};
|
|
177
192
|
observeDOMNode(this, this._processChildren.bind(this), mutationObserverOptions);
|
|
@@ -234,9 +249,9 @@ class UI5Element extends HTMLElement {
|
|
|
234
249
|
const localName = child.localName;
|
|
235
250
|
const shouldWaitForCustomElement = localName.includes("-") && !shouldIgnoreCustomElement(localName);
|
|
236
251
|
if (shouldWaitForCustomElement) {
|
|
237
|
-
const isDefined =
|
|
252
|
+
const isDefined = customElements.get(localName);
|
|
238
253
|
if (!isDefined) {
|
|
239
|
-
const whenDefinedPromise =
|
|
254
|
+
const whenDefinedPromise = customElements.whenDefined(localName); // Class registered, but instances not upgraded yet
|
|
240
255
|
let timeoutPromise = elementTimeouts.get(localName);
|
|
241
256
|
if (!timeoutPromise) {
|
|
242
257
|
timeoutPromise = new Promise(resolve => setTimeout(resolve, 1000));
|
|
@@ -244,7 +259,7 @@ class UI5Element extends HTMLElement {
|
|
|
244
259
|
}
|
|
245
260
|
await Promise.race([whenDefinedPromise, timeoutPromise]);
|
|
246
261
|
}
|
|
247
|
-
|
|
262
|
+
customElements.upgrade(child);
|
|
248
263
|
}
|
|
249
264
|
}
|
|
250
265
|
child = ctor.getMetadata().constructor.validateSlotValue(child, slotData);
|
|
@@ -319,26 +334,26 @@ class UI5Element extends HTMLElement {
|
|
|
319
334
|
/**
|
|
320
335
|
* Attach a callback that will be executed whenever the component is invalidated
|
|
321
336
|
*
|
|
322
|
-
* @param
|
|
337
|
+
* @param callback
|
|
323
338
|
* @public
|
|
324
339
|
*/
|
|
325
340
|
attachInvalidate(callback) {
|
|
326
|
-
this.
|
|
341
|
+
this._invalidationEventProvider.attachEvent("invalidate", callback);
|
|
327
342
|
}
|
|
328
343
|
/**
|
|
329
344
|
* Detach the callback that is executed whenever the component is invalidated
|
|
330
345
|
*
|
|
331
|
-
* @param
|
|
346
|
+
* @param callback
|
|
332
347
|
* @public
|
|
333
348
|
*/
|
|
334
349
|
detachInvalidate(callback) {
|
|
335
|
-
this.
|
|
350
|
+
this._invalidationEventProvider.detachEvent("invalidate", callback);
|
|
336
351
|
}
|
|
337
352
|
/**
|
|
338
353
|
* Callback that is executed whenever a monitored child changes its state
|
|
339
354
|
*
|
|
340
|
-
* @param
|
|
341
|
-
* @param
|
|
355
|
+
* @param slotName the slot in which a child was invalidated
|
|
356
|
+
* @param childChangeInfo the changeInfo object for the child in the given slot
|
|
342
357
|
* @private
|
|
343
358
|
*/
|
|
344
359
|
_onChildChange(slotName, childChangeInfo) {
|
|
@@ -448,7 +463,6 @@ class UI5Element extends HTMLElement {
|
|
|
448
463
|
* Returns a singleton event listener for the "change" event of a child in a given slot
|
|
449
464
|
*
|
|
450
465
|
* @param slotName the name of the slot, where the child is
|
|
451
|
-
* @returns {ChildChangeListener}
|
|
452
466
|
* @private
|
|
453
467
|
*/
|
|
454
468
|
_getChildChangeListener(slotName) {
|
|
@@ -461,7 +475,6 @@ class UI5Element extends HTMLElement {
|
|
|
461
475
|
* Returns a singleton slotchange event listener that invalidates the component due to changes in the given slot
|
|
462
476
|
*
|
|
463
477
|
* @param slotName the name of the slot, where the slot element (whose slotchange event we're listening to) is
|
|
464
|
-
* @returns {SlotChangeListener}
|
|
465
478
|
* @private
|
|
466
479
|
*/
|
|
467
480
|
_getSlotChangeListener(slotName) {
|
|
@@ -537,9 +550,7 @@ class UI5Element extends HTMLElement {
|
|
|
537
550
|
this._suppressInvalidation = true;
|
|
538
551
|
this.onBeforeRendering();
|
|
539
552
|
// Intended for framework usage only. Currently ItemNavigation updates tab indexes after the component has updated its state but before the template is rendered
|
|
540
|
-
|
|
541
|
-
this._onComponentStateFinalized();
|
|
542
|
-
}
|
|
553
|
+
this._componentStateFinalizedEventProvider.fireEvent("componentStateFinalized");
|
|
543
554
|
// resume normal invalidation handling
|
|
544
555
|
this._suppressInvalidation = false;
|
|
545
556
|
// Update the shadow root with the render result
|
|
@@ -639,7 +650,7 @@ class UI5Element extends HTMLElement {
|
|
|
639
650
|
}
|
|
640
651
|
/**
|
|
641
652
|
* Set the focus to the element, returned by "getFocusDomRef()" (marked by "data-sap-focus-ref")
|
|
642
|
-
* @param
|
|
653
|
+
* @param focusOptions additional options for the focus
|
|
643
654
|
* @public
|
|
644
655
|
*/
|
|
645
656
|
async focus(focusOptions) {
|
|
@@ -656,13 +667,13 @@ class UI5Element extends HTMLElement {
|
|
|
656
667
|
* @param data - additional data for the event
|
|
657
668
|
* @param cancelable - true, if the user can call preventDefault on the event object
|
|
658
669
|
* @param bubbles - true, if the event bubbles
|
|
659
|
-
* @returns
|
|
670
|
+
* @returns false, if the event was cancelled (preventDefault called), true otherwise
|
|
660
671
|
*/
|
|
661
672
|
fireEvent(name, data, cancelable = false, bubbles = true) {
|
|
662
673
|
const eventResult = this._fireEvent(name, data, cancelable, bubbles);
|
|
663
674
|
const camelCaseEventName = kebabToCamelCase(name);
|
|
664
675
|
if (camelCaseEventName !== name) {
|
|
665
|
-
return eventResult && this._fireEvent(camelCaseEventName, data, cancelable);
|
|
676
|
+
return eventResult && this._fireEvent(camelCaseEventName, data, cancelable, bubbles);
|
|
666
677
|
}
|
|
667
678
|
return eventResult;
|
|
668
679
|
}
|
|
@@ -697,12 +708,30 @@ class UI5Element extends HTMLElement {
|
|
|
697
708
|
getSlottedNodes(slotName) {
|
|
698
709
|
return getSlottedNodesList(this[slotName]);
|
|
699
710
|
}
|
|
711
|
+
/**
|
|
712
|
+
* Attach a callback that will be executed whenever the component's state is finalized
|
|
713
|
+
*
|
|
714
|
+
* @param callback
|
|
715
|
+
* @public
|
|
716
|
+
*/
|
|
717
|
+
attachComponentStateFinalized(callback) {
|
|
718
|
+
this._componentStateFinalizedEventProvider.attachEvent("componentStateFinalized", callback);
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Detach the callback that is executed whenever the component's state is finalized
|
|
722
|
+
*
|
|
723
|
+
* @param callback
|
|
724
|
+
* @public
|
|
725
|
+
*/
|
|
726
|
+
detachComponentStateFinalized(callback) {
|
|
727
|
+
this._componentStateFinalizedEventProvider.detachEvent("componentStateFinalized", callback);
|
|
728
|
+
}
|
|
700
729
|
/**
|
|
701
730
|
* Determines whether the component should be rendered in RTL mode or not.
|
|
702
731
|
* Returns: "rtl", "ltr" or undefined
|
|
703
732
|
*
|
|
704
733
|
* @public
|
|
705
|
-
* @
|
|
734
|
+
* @default undefined
|
|
706
735
|
*/
|
|
707
736
|
get effectiveDir() {
|
|
708
737
|
markAsRtlAware(this.constructor); // if a UI5 Element calls this method, it's considered to be rtl-aware
|
|
@@ -710,8 +739,8 @@ class UI5Element extends HTMLElement {
|
|
|
710
739
|
}
|
|
711
740
|
/**
|
|
712
741
|
* Used to duck-type UI5 elements without using instanceof
|
|
713
|
-
* @returns {boolean}
|
|
714
742
|
* @public
|
|
743
|
+
* @default true
|
|
715
744
|
*/
|
|
716
745
|
get isUI5Element() {
|
|
717
746
|
return true;
|
|
@@ -719,6 +748,13 @@ class UI5Element extends HTMLElement {
|
|
|
719
748
|
get classes() {
|
|
720
749
|
return {};
|
|
721
750
|
}
|
|
751
|
+
/**
|
|
752
|
+
* Returns the component accessibility info.
|
|
753
|
+
* @private
|
|
754
|
+
*/
|
|
755
|
+
get accessibilityInfo() {
|
|
756
|
+
return {};
|
|
757
|
+
}
|
|
722
758
|
/**
|
|
723
759
|
* Do not override this method in derivatives of UI5Element, use metadata properties instead
|
|
724
760
|
* @private
|
|
@@ -778,8 +814,25 @@ class UI5Element extends HTMLElement {
|
|
|
778
814
|
if (propData.multiple && propData.defaultValue) {
|
|
779
815
|
throw new Error(`Cannot set a default value for property "${prop}". All multiple properties are empty arrays by default.`);
|
|
780
816
|
}
|
|
817
|
+
const descriptor = getPropertyDescriptor(proto, prop);
|
|
818
|
+
// if the decorator is on a setter, proxy the new setter to it
|
|
819
|
+
let origSet;
|
|
820
|
+
if (descriptor?.set) {
|
|
821
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
822
|
+
origSet = descriptor.set;
|
|
823
|
+
}
|
|
824
|
+
// if the decorator is on a setter, there will be a corresponding getter - proxy the new getter to it
|
|
825
|
+
let origGet;
|
|
826
|
+
if (descriptor?.get) {
|
|
827
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
828
|
+
origGet = descriptor.get;
|
|
829
|
+
}
|
|
781
830
|
Object.defineProperty(proto, prop, {
|
|
782
831
|
get() {
|
|
832
|
+
// proxy the getter to the original accessor if there was one
|
|
833
|
+
if (origGet) {
|
|
834
|
+
return origGet.call(this);
|
|
835
|
+
}
|
|
783
836
|
if (this._state[prop] !== undefined) {
|
|
784
837
|
return this._state[prop];
|
|
785
838
|
}
|
|
@@ -804,7 +857,7 @@ class UI5Element extends HTMLElement {
|
|
|
804
857
|
value = metadataCtor.validatePropertyValue(value, propData);
|
|
805
858
|
const propertyType = propData.type;
|
|
806
859
|
let propertyValidator = propData.validator;
|
|
807
|
-
const oldState = this._state[prop];
|
|
860
|
+
const oldState = origGet ? origGet.call(this) : this._state[prop];
|
|
808
861
|
if (propertyType && propertyType.isDataTypeClass) {
|
|
809
862
|
propertyValidator = propertyType;
|
|
810
863
|
}
|
|
@@ -818,7 +871,13 @@ class UI5Element extends HTMLElement {
|
|
|
818
871
|
isDifferent = oldState !== value;
|
|
819
872
|
}
|
|
820
873
|
if (isDifferent) {
|
|
821
|
-
|
|
874
|
+
// if the decorator is on a setter, use it for storage
|
|
875
|
+
if (origSet) {
|
|
876
|
+
origSet.call(this, value);
|
|
877
|
+
}
|
|
878
|
+
else {
|
|
879
|
+
this._state[prop] = value;
|
|
880
|
+
}
|
|
822
881
|
_invalidate.call(this, {
|
|
823
882
|
type: "property",
|
|
824
883
|
name: prop,
|
|
@@ -852,13 +911,6 @@ class UI5Element extends HTMLElement {
|
|
|
852
911
|
}
|
|
853
912
|
}
|
|
854
913
|
}
|
|
855
|
-
/**
|
|
856
|
-
* Returns the CSS for this UI5 Web Component Class
|
|
857
|
-
* @protected
|
|
858
|
-
*/
|
|
859
|
-
static get styles() {
|
|
860
|
-
return "";
|
|
861
|
-
}
|
|
862
914
|
/**
|
|
863
915
|
* Returns the Static Area CSS for this UI5 Web Component Class
|
|
864
916
|
* @protected
|
|
@@ -890,8 +942,6 @@ class UI5Element extends HTMLElement {
|
|
|
890
942
|
}
|
|
891
943
|
/**
|
|
892
944
|
* Returns a promise that resolves whenever all dependencies for this UI5 Web Component have resolved
|
|
893
|
-
*
|
|
894
|
-
* @returns {Promise}
|
|
895
945
|
*/
|
|
896
946
|
static whenDependenciesDefined() {
|
|
897
947
|
return Promise.all(this.getUniqueDependencies().map(dep => dep.define()));
|
|
@@ -900,7 +950,6 @@ class UI5Element extends HTMLElement {
|
|
|
900
950
|
* Hook that will be called upon custom element definition
|
|
901
951
|
*
|
|
902
952
|
* @protected
|
|
903
|
-
* @returns {Promise<void>}
|
|
904
953
|
*/
|
|
905
954
|
static async onDefine() {
|
|
906
955
|
return Promise.resolve();
|
|
@@ -908,7 +957,6 @@ class UI5Element extends HTMLElement {
|
|
|
908
957
|
/**
|
|
909
958
|
* Registers a UI5 Web Component in the browser window object
|
|
910
959
|
* @public
|
|
911
|
-
* @returns {Promise<UI5Element>}
|
|
912
960
|
*/
|
|
913
961
|
static async define() {
|
|
914
962
|
await boot();
|
|
@@ -925,7 +973,7 @@ class UI5Element extends HTMLElement {
|
|
|
925
973
|
else if (!definedGlobally) {
|
|
926
974
|
this._generateAccessors();
|
|
927
975
|
registerTag(tag);
|
|
928
|
-
|
|
976
|
+
customElements.define(tag, this);
|
|
929
977
|
preloadLinks(this);
|
|
930
978
|
}
|
|
931
979
|
return this;
|
|
@@ -934,7 +982,6 @@ class UI5Element extends HTMLElement {
|
|
|
934
982
|
* Returns an instance of UI5ElementMetadata.js representing this UI5 Web Component's full metadata (its and its parents')
|
|
935
983
|
* Note: not to be confused with the "get metadata()" method, which returns an object for this class's metadata only
|
|
936
984
|
* @public
|
|
937
|
-
* @returns {UI5ElementMetadata}
|
|
938
985
|
*/
|
|
939
986
|
static getMetadata() {
|
|
940
987
|
if (this.hasOwnProperty("_metadata")) { // eslint-disable-line
|
|
@@ -956,9 +1003,13 @@ class UI5Element extends HTMLElement {
|
|
|
956
1003
|
* @protected
|
|
957
1004
|
*/
|
|
958
1005
|
UI5Element.metadata = {};
|
|
1006
|
+
/**
|
|
1007
|
+
* Returns the CSS for this UI5 Web Component Class
|
|
1008
|
+
* @protected
|
|
1009
|
+
*/
|
|
1010
|
+
UI5Element.styles = "";
|
|
959
1011
|
/**
|
|
960
1012
|
* Always use duck-typing to cover all runtimes on the page.
|
|
961
|
-
* @returns {boolean}
|
|
962
1013
|
*/
|
|
963
1014
|
const instanceOfUI5Element = (object) => {
|
|
964
1015
|
return "isUI5Element" in object;
|