@ui5/webcomponents-base 0.0.0-dcd8e5389 → 0.0.0-ddc5fe31b
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 +1 -1
- package/CHANGELOG.md +492 -0
- package/README.md +6 -1
- package/bundle.esm.js +4 -1
- 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.js +1 -1
- package/dist/Boot.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/EventProvider.js +1 -1
- package/dist/EventProvider.js.map +1 -1
- package/dist/FontFace.js +1 -1
- package/dist/FontFace.js.map +1 -1
- package/dist/IgnoreCustomElements.d.ts +27 -0
- package/dist/IgnoreCustomElements.js +39 -0
- package/dist/IgnoreCustomElements.js.map +1 -0
- package/dist/InitialConfiguration.d.ts +2 -1
- package/dist/InitialConfiguration.js +7 -2
- 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 +95 -15
- package/dist/ManagedStyles.js.map +1 -1
- package/dist/MediaRange.d.ts +0 -6
- package/dist/MediaRange.js +5 -15
- package/dist/MediaRange.js.map +1 -1
- package/dist/StaticAreaItem.d.ts +3 -4
- package/dist/StaticAreaItem.js +9 -8
- package/dist/StaticAreaItem.js.map +1 -1
- package/dist/UI5Element.d.ts +28 -25
- package/dist/UI5Element.js +48 -37
- package/dist/UI5Element.js.map +1 -1
- package/dist/UI5ElementMetadata.d.ts +4 -11
- package/dist/UI5ElementMetadata.js +3 -11
- 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 +1 -0
- package/dist/asset-registries/Illustrations.js +50 -20
- package/dist/asset-registries/Illustrations.js.map +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.js +2 -1
- 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/AnimationMode.d.ts +2 -2
- package/dist/config/AnimationMode.js +1 -1
- package/dist/config/AnimationMode.js.map +1 -1
- 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 +2 -17
- package/dist/config/Icons.js +1 -60
- package/dist/config/Icons.js.map +1 -1
- package/dist/config/ThemeRoot.d.ts +29 -0
- package/dist/config/ThemeRoot.js +59 -0
- package/dist/config/ThemeRoot.js.map +1 -0
- 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/custom-elements-internal.json +2765 -0
- package/dist/custom-elements.json +2528 -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/delegate/ItemNavigation.d.ts +1 -0
- package/dist/delegate/ItemNavigation.js +4 -5
- 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 +89 -33
- package/dist/features/OpenUI5Support.js.map +1 -1
- 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/templates/elements/WithComplexTemplateTemplate.lit.d.ts +3 -3
- package/dist/generated/templates/elements/WithComplexTemplateTemplate.lit.js.map +1 -1
- package/dist/getSharedResource.js +7 -1
- package/dist/getSharedResource.js.map +1 -1
- package/dist/i18nBundle.d.ts +2 -4
- package/dist/i18nBundle.js +3 -5
- package/dist/i18nBundle.js.map +1 -1
- package/dist/locale/RTLAwareRegistry.d.ts +1 -1
- package/dist/locale/RTLAwareRegistry.js.map +1 -1
- package/dist/renderer/LitRenderer.d.ts +2 -2
- 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 +8 -7
- 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 +0 -4
- package/dist/types/DOMReference.js +0 -4
- 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/NavigationMode.d.ts +0 -8
- package/dist/types/NavigationMode.js +0 -8
- package/dist/types/NavigationMode.js.map +1 -1
- 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/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/PopupUtils.js +1 -1
- package/dist/util/PopupUtils.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/getClassCopy.d.ts +52 -33
- 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/getSingletonElementInstance.d.ts +10 -1
- package/dist/util/getSingletonElementInstance.js +11 -2
- package/dist/util/getSingletonElementInstance.js.map +1 -1
- package/dist/util/isElementContainingBlock.d.ts +2 -0
- package/dist/util/isElementContainingBlock.js +11 -0
- package/dist/util/isElementContainingBlock.js.map +1 -0
- package/index.js +3 -3
- package/lib/generate-asset-parameters/index.js +2 -2
- package/lib/generate-version-info/index.js +2 -2
- package/package-scripts.cjs +12 -18
- package/package.json +14 -6
- package/src/css/FontFace.css +47 -17
- package/tsconfig.json +4 -0
- package/used-modules.txt +4 -0
- package/dist/api.json +0 -1
- package/dist/assets/Boot.34b7cea0.css +0 -1
- package/dist/assets/Boot.f21d1bf8.js +0 -9
- package/dist/assets/bundle.esm.fff719c1.js +0 -50
- package/dist/assets-meta/IconCollectionsAlias.js.map +0 -1
- package/dist/config/ThemeRoots.d.ts +0 -4
- package/dist/config/ThemeRoots.js +0 -28
- package/dist/config/ThemeRoots.js.map +0 -1
package/dist/UI5Element.d.ts
CHANGED
|
@@ -26,12 +26,9 @@ type InvalidationInfo = ChangeInfo & {
|
|
|
26
26
|
type ChildChangeListener = (param: InvalidationInfo) => void;
|
|
27
27
|
type SlotChangeListener = (this: HTMLSlotElement, ev: Event) => void;
|
|
28
28
|
/**
|
|
29
|
+
* @class
|
|
29
30
|
* Base class for all UI5 Web Components
|
|
30
31
|
*
|
|
31
|
-
* @class
|
|
32
|
-
* @constructor
|
|
33
|
-
* @author SAP SE
|
|
34
|
-
* @alias sap.ui.webc.base.UI5Element
|
|
35
32
|
* @extends HTMLElement
|
|
36
33
|
* @public
|
|
37
34
|
*/
|
|
@@ -39,7 +36,8 @@ declare abstract class UI5Element extends HTMLElement {
|
|
|
39
36
|
__id?: string;
|
|
40
37
|
_suppressInvalidation: boolean;
|
|
41
38
|
_changedState: Array<ChangeInfo>;
|
|
42
|
-
|
|
39
|
+
_invalidationEventProvider: EventProvider<InvalidationInfo, void>;
|
|
40
|
+
_componentStateFinalizedEventProvider: EventProvider<void, void>;
|
|
43
41
|
_inDOM: boolean;
|
|
44
42
|
_fullyConnected: boolean;
|
|
45
43
|
_childChangeListeners: Map<string, ChildChangeListener>;
|
|
@@ -49,7 +47,6 @@ declare abstract class UI5Element extends HTMLElement {
|
|
|
49
47
|
};
|
|
50
48
|
_doNotSyncAttributes: Set<string>;
|
|
51
49
|
_state: State;
|
|
52
|
-
_onComponentStateFinalized?: () => void;
|
|
53
50
|
_getRealDomRef?: () => HTMLElement;
|
|
54
51
|
staticAreaItem?: StaticAreaItem;
|
|
55
52
|
static template?: TemplateFunction;
|
|
@@ -125,22 +122,22 @@ declare abstract class UI5Element extends HTMLElement {
|
|
|
125
122
|
/**
|
|
126
123
|
* Attach a callback that will be executed whenever the component is invalidated
|
|
127
124
|
*
|
|
128
|
-
* @param
|
|
125
|
+
* @param callback
|
|
129
126
|
* @public
|
|
130
127
|
*/
|
|
131
128
|
attachInvalidate(callback: (param: InvalidationInfo) => void): void;
|
|
132
129
|
/**
|
|
133
130
|
* Detach the callback that is executed whenever the component is invalidated
|
|
134
131
|
*
|
|
135
|
-
* @param
|
|
132
|
+
* @param callback
|
|
136
133
|
* @public
|
|
137
134
|
*/
|
|
138
135
|
detachInvalidate(callback: (param: InvalidationInfo) => void): void;
|
|
139
136
|
/**
|
|
140
137
|
* Callback that is executed whenever a monitored child changes its state
|
|
141
138
|
*
|
|
142
|
-
* @param
|
|
143
|
-
* @param
|
|
139
|
+
* @param slotName the slot in which a child was invalidated
|
|
140
|
+
* @param childChangeInfo the changeInfo object for the child in the given slot
|
|
144
141
|
* @private
|
|
145
142
|
*/
|
|
146
143
|
_onChildChange(slotName: string, childChangeInfo: ChangeInfo): void;
|
|
@@ -165,15 +162,13 @@ declare abstract class UI5Element extends HTMLElement {
|
|
|
165
162
|
* Returns a singleton event listener for the "change" event of a child in a given slot
|
|
166
163
|
*
|
|
167
164
|
* @param slotName the name of the slot, where the child is
|
|
168
|
-
* @returns {ChildChangeListener}
|
|
169
165
|
* @private
|
|
170
166
|
*/
|
|
171
|
-
_getChildChangeListener(slotName: string): ChildChangeListener
|
|
167
|
+
_getChildChangeListener(slotName: string): ChildChangeListener;
|
|
172
168
|
/**
|
|
173
169
|
* Returns a singleton slotchange event listener that invalidates the component due to changes in the given slot
|
|
174
170
|
*
|
|
175
171
|
* @param slotName the name of the slot, where the slot element (whose slotchange event we're listening to) is
|
|
176
|
-
* @returns {SlotChangeListener}
|
|
177
172
|
* @private
|
|
178
173
|
*/
|
|
179
174
|
_getSlotChangeListener(slotName: string): SlotChangeListener;
|
|
@@ -257,7 +252,7 @@ declare abstract class UI5Element extends HTMLElement {
|
|
|
257
252
|
getFocusDomRefAsync(): Promise<HTMLElement | undefined>;
|
|
258
253
|
/**
|
|
259
254
|
* Set the focus to the element, returned by "getFocusDomRef()" (marked by "data-sap-focus-ref")
|
|
260
|
-
* @param
|
|
255
|
+
* @param focusOptions additional options for the focus
|
|
261
256
|
* @public
|
|
262
257
|
*/
|
|
263
258
|
focus(focusOptions?: FocusOptions): Promise<void>;
|
|
@@ -268,7 +263,7 @@ declare abstract class UI5Element extends HTMLElement {
|
|
|
268
263
|
* @param data - additional data for the event
|
|
269
264
|
* @param cancelable - true, if the user can call preventDefault on the event object
|
|
270
265
|
* @param bubbles - true, if the event bubbles
|
|
271
|
-
* @returns
|
|
266
|
+
* @returns false, if the event was cancelled (preventDefault called), true otherwise
|
|
272
267
|
*/
|
|
273
268
|
fireEvent<T>(name: string, data?: T, cancelable?: boolean, bubbles?: boolean): boolean;
|
|
274
269
|
_fireEvent<T>(name: string, data?: T, cancelable?: boolean, bubbles?: boolean): boolean;
|
|
@@ -277,19 +272,33 @@ declare abstract class UI5Element extends HTMLElement {
|
|
|
277
272
|
* Useful when there are transitive slots in nested component scenarios and you don't want to get a list of the slots, but rather of their content.
|
|
278
273
|
* @public
|
|
279
274
|
*/
|
|
280
|
-
getSlottedNodes<T = Node>(slotName: string): T
|
|
275
|
+
getSlottedNodes<T = Node>(slotName: string): Array<T>;
|
|
276
|
+
/**
|
|
277
|
+
* Attach a callback that will be executed whenever the component's state is finalized
|
|
278
|
+
*
|
|
279
|
+
* @param callback
|
|
280
|
+
* @public
|
|
281
|
+
*/
|
|
282
|
+
attachComponentStateFinalized(callback: () => void): void;
|
|
283
|
+
/**
|
|
284
|
+
* Detach the callback that is executed whenever the component's state is finalized
|
|
285
|
+
*
|
|
286
|
+
* @param callback
|
|
287
|
+
* @public
|
|
288
|
+
*/
|
|
289
|
+
detachComponentStateFinalized(callback: () => void): void;
|
|
281
290
|
/**
|
|
282
291
|
* Determines whether the component should be rendered in RTL mode or not.
|
|
283
292
|
* Returns: "rtl", "ltr" or undefined
|
|
284
293
|
*
|
|
285
294
|
* @public
|
|
286
|
-
* @
|
|
295
|
+
* @default undefined
|
|
287
296
|
*/
|
|
288
297
|
get effectiveDir(): string | undefined;
|
|
289
298
|
/**
|
|
290
299
|
* Used to duck-type UI5 elements without using instanceof
|
|
291
|
-
* @returns {boolean}
|
|
292
300
|
* @public
|
|
301
|
+
* @default true
|
|
293
302
|
*/
|
|
294
303
|
get isUI5Element(): boolean;
|
|
295
304
|
get classes(): ClassMap;
|
|
@@ -342,37 +351,31 @@ declare abstract class UI5Element extends HTMLElement {
|
|
|
342
351
|
*
|
|
343
352
|
* @public
|
|
344
353
|
*/
|
|
345
|
-
static getUniqueDependencies(this: typeof UI5Element):
|
|
354
|
+
static getUniqueDependencies(this: typeof UI5Element): Array<typeof UI5Element>;
|
|
346
355
|
/**
|
|
347
356
|
* Returns a promise that resolves whenever all dependencies for this UI5 Web Component have resolved
|
|
348
|
-
*
|
|
349
|
-
* @returns {Promise}
|
|
350
357
|
*/
|
|
351
358
|
static whenDependenciesDefined(): Promise<Array<typeof UI5Element>>;
|
|
352
359
|
/**
|
|
353
360
|
* Hook that will be called upon custom element definition
|
|
354
361
|
*
|
|
355
362
|
* @protected
|
|
356
|
-
* @returns {Promise<void>}
|
|
357
363
|
*/
|
|
358
364
|
static onDefine(): Promise<void>;
|
|
359
365
|
/**
|
|
360
366
|
* Registers a UI5 Web Component in the browser window object
|
|
361
367
|
* @public
|
|
362
|
-
* @returns {Promise<UI5Element>}
|
|
363
368
|
*/
|
|
364
369
|
static define(): Promise<typeof UI5Element>;
|
|
365
370
|
/**
|
|
366
371
|
* Returns an instance of UI5ElementMetadata.js representing this UI5 Web Component's full metadata (its and its parents')
|
|
367
372
|
* Note: not to be confused with the "get metadata()" method, which returns an object for this class's metadata only
|
|
368
373
|
* @public
|
|
369
|
-
* @returns {UI5ElementMetadata}
|
|
370
374
|
*/
|
|
371
375
|
static getMetadata(): UI5ElementMetadata;
|
|
372
376
|
}
|
|
373
377
|
/**
|
|
374
378
|
* Always use duck-typing to cover all runtimes on the page.
|
|
375
|
-
* @returns {boolean}
|
|
376
379
|
*/
|
|
377
380
|
declare const instanceOfUI5Element: (object: any) => object is UI5Element;
|
|
378
381
|
export default UI5Element;
|
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";
|
|
@@ -5,6 +7,7 @@ import EventProvider from "./EventProvider.js";
|
|
|
5
7
|
import getSingletonElementInstance from "./util/getSingletonElementInstance.js";
|
|
6
8
|
import StaticAreaItem from "./StaticAreaItem.js";
|
|
7
9
|
import updateShadowRoot from "./updateShadowRoot.js";
|
|
10
|
+
import { shouldIgnoreCustomElement } from "./IgnoreCustomElements.js";
|
|
8
11
|
import { renderDeferred, renderImmediately, cancelRender } from "./Render.js";
|
|
9
12
|
import { registerTag, isTagRegistered, recordTagRegistrationFailure } from "./CustomElementsRegistry.js";
|
|
10
13
|
import { observeDOMNode, unobserveDOMNode } from "./DOMObserver.js";
|
|
@@ -35,15 +38,12 @@ function _invalidate(changeInfo) {
|
|
|
35
38
|
this.onInvalidation(changeInfo);
|
|
36
39
|
this._changedState.push(changeInfo);
|
|
37
40
|
renderDeferred(this);
|
|
38
|
-
this.
|
|
41
|
+
this._invalidationEventProvider.fireEvent("invalidate", { ...changeInfo, target: this });
|
|
39
42
|
}
|
|
40
43
|
/**
|
|
44
|
+
* @class
|
|
41
45
|
* Base class for all UI5 Web Components
|
|
42
46
|
*
|
|
43
|
-
* @class
|
|
44
|
-
* @constructor
|
|
45
|
-
* @author SAP SE
|
|
46
|
-
* @alias sap.ui.webc.base.UI5Element
|
|
47
47
|
* @extends HTMLElement
|
|
48
48
|
* @public
|
|
49
49
|
*/
|
|
@@ -57,7 +57,8 @@ class UI5Element extends HTMLElement {
|
|
|
57
57
|
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)
|
|
58
58
|
this._childChangeListeners = new Map(); // used to store lazy listeners per slot for the child change event of every child inside that slot
|
|
59
59
|
this._slotChangeListeners = new Map(); // used to store lazy listeners per slot for the slotchange event of all slot children inside that slot
|
|
60
|
-
this.
|
|
60
|
+
this._invalidationEventProvider = new EventProvider(); // used by parent components for listening to changes to child components
|
|
61
|
+
this._componentStateFinalizedEventProvider = new EventProvider(); // used by friend classes for synchronization
|
|
61
62
|
let deferredResolve;
|
|
62
63
|
this._domRefReadyPromise = new Promise(resolve => {
|
|
63
64
|
deferredResolve = resolve;
|
|
@@ -160,14 +161,16 @@ class UI5Element extends HTMLElement {
|
|
|
160
161
|
*/
|
|
161
162
|
_startObservingDOMChildren() {
|
|
162
163
|
const ctor = this.constructor;
|
|
163
|
-
const
|
|
164
|
+
const metadata = ctor.getMetadata();
|
|
165
|
+
const shouldObserveChildren = metadata.hasSlots();
|
|
164
166
|
if (!shouldObserveChildren) {
|
|
165
167
|
return;
|
|
166
168
|
}
|
|
167
|
-
const canSlotText =
|
|
169
|
+
const canSlotText = metadata.canSlotText();
|
|
170
|
+
const hasClonedSlot = Object.keys(metadata.getSlots()).some(slotName => metadata.getSlots()[slotName].cloned);
|
|
168
171
|
const mutationObserverOptions = {
|
|
169
172
|
childList: true,
|
|
170
|
-
subtree: canSlotText,
|
|
173
|
+
subtree: canSlotText || hasClonedSlot,
|
|
171
174
|
characterData: canSlotText,
|
|
172
175
|
};
|
|
173
176
|
observeDOMNode(this, this._processChildren.bind(this), mutationObserverOptions);
|
|
@@ -228,11 +231,11 @@ class UI5Element extends HTMLElement {
|
|
|
228
231
|
// Await for not-yet-defined custom elements
|
|
229
232
|
if (child instanceof HTMLElement) {
|
|
230
233
|
const localName = child.localName;
|
|
231
|
-
const
|
|
232
|
-
if (
|
|
233
|
-
const isDefined =
|
|
234
|
+
const shouldWaitForCustomElement = localName.includes("-") && !shouldIgnoreCustomElement(localName);
|
|
235
|
+
if (shouldWaitForCustomElement) {
|
|
236
|
+
const isDefined = customElements.get(localName);
|
|
234
237
|
if (!isDefined) {
|
|
235
|
-
const whenDefinedPromise =
|
|
238
|
+
const whenDefinedPromise = customElements.whenDefined(localName); // Class registered, but instances not upgraded yet
|
|
236
239
|
let timeoutPromise = elementTimeouts.get(localName);
|
|
237
240
|
if (!timeoutPromise) {
|
|
238
241
|
timeoutPromise = new Promise(resolve => setTimeout(resolve, 1000));
|
|
@@ -240,7 +243,7 @@ class UI5Element extends HTMLElement {
|
|
|
240
243
|
}
|
|
241
244
|
await Promise.race([whenDefinedPromise, timeoutPromise]);
|
|
242
245
|
}
|
|
243
|
-
|
|
246
|
+
customElements.upgrade(child);
|
|
244
247
|
}
|
|
245
248
|
}
|
|
246
249
|
child = ctor.getMetadata().constructor.validateSlotValue(child, slotData);
|
|
@@ -315,26 +318,26 @@ class UI5Element extends HTMLElement {
|
|
|
315
318
|
/**
|
|
316
319
|
* Attach a callback that will be executed whenever the component is invalidated
|
|
317
320
|
*
|
|
318
|
-
* @param
|
|
321
|
+
* @param callback
|
|
319
322
|
* @public
|
|
320
323
|
*/
|
|
321
324
|
attachInvalidate(callback) {
|
|
322
|
-
this.
|
|
325
|
+
this._invalidationEventProvider.attachEvent("invalidate", callback);
|
|
323
326
|
}
|
|
324
327
|
/**
|
|
325
328
|
* Detach the callback that is executed whenever the component is invalidated
|
|
326
329
|
*
|
|
327
|
-
* @param
|
|
330
|
+
* @param callback
|
|
328
331
|
* @public
|
|
329
332
|
*/
|
|
330
333
|
detachInvalidate(callback) {
|
|
331
|
-
this.
|
|
334
|
+
this._invalidationEventProvider.detachEvent("invalidate", callback);
|
|
332
335
|
}
|
|
333
336
|
/**
|
|
334
337
|
* Callback that is executed whenever a monitored child changes its state
|
|
335
338
|
*
|
|
336
|
-
* @param
|
|
337
|
-
* @param
|
|
339
|
+
* @param slotName the slot in which a child was invalidated
|
|
340
|
+
* @param childChangeInfo the changeInfo object for the child in the given slot
|
|
338
341
|
* @private
|
|
339
342
|
*/
|
|
340
343
|
_onChildChange(slotName, childChangeInfo) {
|
|
@@ -444,7 +447,6 @@ class UI5Element extends HTMLElement {
|
|
|
444
447
|
* Returns a singleton event listener for the "change" event of a child in a given slot
|
|
445
448
|
*
|
|
446
449
|
* @param slotName the name of the slot, where the child is
|
|
447
|
-
* @returns {ChildChangeListener}
|
|
448
450
|
* @private
|
|
449
451
|
*/
|
|
450
452
|
_getChildChangeListener(slotName) {
|
|
@@ -457,7 +459,6 @@ class UI5Element extends HTMLElement {
|
|
|
457
459
|
* Returns a singleton slotchange event listener that invalidates the component due to changes in the given slot
|
|
458
460
|
*
|
|
459
461
|
* @param slotName the name of the slot, where the slot element (whose slotchange event we're listening to) is
|
|
460
|
-
* @returns {SlotChangeListener}
|
|
461
462
|
* @private
|
|
462
463
|
*/
|
|
463
464
|
_getSlotChangeListener(slotName) {
|
|
@@ -533,9 +534,7 @@ class UI5Element extends HTMLElement {
|
|
|
533
534
|
this._suppressInvalidation = true;
|
|
534
535
|
this.onBeforeRendering();
|
|
535
536
|
// Intended for framework usage only. Currently ItemNavigation updates tab indexes after the component has updated its state but before the template is rendered
|
|
536
|
-
|
|
537
|
-
this._onComponentStateFinalized();
|
|
538
|
-
}
|
|
537
|
+
this._componentStateFinalizedEventProvider.fireEvent("componentStateFinalized");
|
|
539
538
|
// resume normal invalidation handling
|
|
540
539
|
this._suppressInvalidation = false;
|
|
541
540
|
// Update the shadow root with the render result
|
|
@@ -635,7 +634,7 @@ class UI5Element extends HTMLElement {
|
|
|
635
634
|
}
|
|
636
635
|
/**
|
|
637
636
|
* Set the focus to the element, returned by "getFocusDomRef()" (marked by "data-sap-focus-ref")
|
|
638
|
-
* @param
|
|
637
|
+
* @param focusOptions additional options for the focus
|
|
639
638
|
* @public
|
|
640
639
|
*/
|
|
641
640
|
async focus(focusOptions) {
|
|
@@ -652,13 +651,13 @@ class UI5Element extends HTMLElement {
|
|
|
652
651
|
* @param data - additional data for the event
|
|
653
652
|
* @param cancelable - true, if the user can call preventDefault on the event object
|
|
654
653
|
* @param bubbles - true, if the event bubbles
|
|
655
|
-
* @returns
|
|
654
|
+
* @returns false, if the event was cancelled (preventDefault called), true otherwise
|
|
656
655
|
*/
|
|
657
656
|
fireEvent(name, data, cancelable = false, bubbles = true) {
|
|
658
657
|
const eventResult = this._fireEvent(name, data, cancelable, bubbles);
|
|
659
658
|
const camelCaseEventName = kebabToCamelCase(name);
|
|
660
659
|
if (camelCaseEventName !== name) {
|
|
661
|
-
return eventResult && this._fireEvent(camelCaseEventName, data, cancelable);
|
|
660
|
+
return eventResult && this._fireEvent(camelCaseEventName, data, cancelable, bubbles);
|
|
662
661
|
}
|
|
663
662
|
return eventResult;
|
|
664
663
|
}
|
|
@@ -693,12 +692,30 @@ class UI5Element extends HTMLElement {
|
|
|
693
692
|
getSlottedNodes(slotName) {
|
|
694
693
|
return getSlottedNodesList(this[slotName]);
|
|
695
694
|
}
|
|
695
|
+
/**
|
|
696
|
+
* Attach a callback that will be executed whenever the component's state is finalized
|
|
697
|
+
*
|
|
698
|
+
* @param callback
|
|
699
|
+
* @public
|
|
700
|
+
*/
|
|
701
|
+
attachComponentStateFinalized(callback) {
|
|
702
|
+
this._componentStateFinalizedEventProvider.attachEvent("componentStateFinalized", callback);
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* Detach the callback that is executed whenever the component's state is finalized
|
|
706
|
+
*
|
|
707
|
+
* @param callback
|
|
708
|
+
* @public
|
|
709
|
+
*/
|
|
710
|
+
detachComponentStateFinalized(callback) {
|
|
711
|
+
this._componentStateFinalizedEventProvider.detachEvent("componentStateFinalized", callback);
|
|
712
|
+
}
|
|
696
713
|
/**
|
|
697
714
|
* Determines whether the component should be rendered in RTL mode or not.
|
|
698
715
|
* Returns: "rtl", "ltr" or undefined
|
|
699
716
|
*
|
|
700
717
|
* @public
|
|
701
|
-
* @
|
|
718
|
+
* @default undefined
|
|
702
719
|
*/
|
|
703
720
|
get effectiveDir() {
|
|
704
721
|
markAsRtlAware(this.constructor); // if a UI5 Element calls this method, it's considered to be rtl-aware
|
|
@@ -706,8 +723,8 @@ class UI5Element extends HTMLElement {
|
|
|
706
723
|
}
|
|
707
724
|
/**
|
|
708
725
|
* Used to duck-type UI5 elements without using instanceof
|
|
709
|
-
* @returns {boolean}
|
|
710
726
|
* @public
|
|
727
|
+
* @default true
|
|
711
728
|
*/
|
|
712
729
|
get isUI5Element() {
|
|
713
730
|
return true;
|
|
@@ -886,8 +903,6 @@ class UI5Element extends HTMLElement {
|
|
|
886
903
|
}
|
|
887
904
|
/**
|
|
888
905
|
* Returns a promise that resolves whenever all dependencies for this UI5 Web Component have resolved
|
|
889
|
-
*
|
|
890
|
-
* @returns {Promise}
|
|
891
906
|
*/
|
|
892
907
|
static whenDependenciesDefined() {
|
|
893
908
|
return Promise.all(this.getUniqueDependencies().map(dep => dep.define()));
|
|
@@ -896,7 +911,6 @@ class UI5Element extends HTMLElement {
|
|
|
896
911
|
* Hook that will be called upon custom element definition
|
|
897
912
|
*
|
|
898
913
|
* @protected
|
|
899
|
-
* @returns {Promise<void>}
|
|
900
914
|
*/
|
|
901
915
|
static async onDefine() {
|
|
902
916
|
return Promise.resolve();
|
|
@@ -904,7 +918,6 @@ class UI5Element extends HTMLElement {
|
|
|
904
918
|
/**
|
|
905
919
|
* Registers a UI5 Web Component in the browser window object
|
|
906
920
|
* @public
|
|
907
|
-
* @returns {Promise<UI5Element>}
|
|
908
921
|
*/
|
|
909
922
|
static async define() {
|
|
910
923
|
await boot();
|
|
@@ -921,7 +934,7 @@ class UI5Element extends HTMLElement {
|
|
|
921
934
|
else if (!definedGlobally) {
|
|
922
935
|
this._generateAccessors();
|
|
923
936
|
registerTag(tag);
|
|
924
|
-
|
|
937
|
+
customElements.define(tag, this);
|
|
925
938
|
preloadLinks(this);
|
|
926
939
|
}
|
|
927
940
|
return this;
|
|
@@ -930,7 +943,6 @@ class UI5Element extends HTMLElement {
|
|
|
930
943
|
* Returns an instance of UI5ElementMetadata.js representing this UI5 Web Component's full metadata (its and its parents')
|
|
931
944
|
* Note: not to be confused with the "get metadata()" method, which returns an object for this class's metadata only
|
|
932
945
|
* @public
|
|
933
|
-
* @returns {UI5ElementMetadata}
|
|
934
946
|
*/
|
|
935
947
|
static getMetadata() {
|
|
936
948
|
if (this.hasOwnProperty("_metadata")) { // eslint-disable-line
|
|
@@ -954,7 +966,6 @@ class UI5Element extends HTMLElement {
|
|
|
954
966
|
UI5Element.metadata = {};
|
|
955
967
|
/**
|
|
956
968
|
* Always use duck-typing to cover all runtimes on the page.
|
|
957
|
-
* @returns {boolean}
|
|
958
969
|
*/
|
|
959
970
|
const instanceOfUI5Element = (object) => {
|
|
960
971
|
return "isUI5Element" in object;
|