@ui5/webcomponents-base 0.0.0-2647941ee → 0.0.0-274170508
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 +3 -0
- package/CHANGELOG.md +314 -0
- package/README.md +53 -7
- package/bundle.esm.js +20 -20
- package/dist/AssetRegistry.js +8 -9
- package/dist/Boot.js +59 -0
- package/dist/CSP.js +59 -0
- package/dist/CustomElementsRegistry.js +60 -4
- package/dist/CustomElementsScope.js +20 -98
- package/dist/CustomElementsScopeUtils.js +108 -0
- package/dist/DOMObserver.js +65 -0
- package/dist/Device.js +71 -773
- package/dist/EventProvider.js +30 -26
- package/dist/FeaturesRegistry.js +4 -1
- package/dist/FontFace.js +7 -95
- package/dist/InitialConfiguration.js +37 -21
- package/dist/Keys.js +98 -0
- package/dist/ManagedStyles.js +83 -0
- package/dist/MediaRange.js +109 -0
- package/dist/{util/parseProperties.js → PropertiesFileFormat.js} +6 -0
- package/dist/Render.js +175 -0
- package/dist/RenderScheduler.js +16 -138
- package/dist/Runtimes.js +107 -0
- package/dist/StaticArea.js +1 -29
- package/dist/StaticAreaItem.js +58 -65
- package/dist/SystemCSSVars.js +4 -25
- package/dist/UI5Element.js +322 -387
- package/dist/UI5ElementMetadata.js +132 -17
- package/dist/asset-registries/Icons.js +118 -15
- package/dist/asset-registries/Illustrations.js +30 -0
- package/dist/asset-registries/LocaleData.js +97 -68
- package/dist/asset-registries/Themes.js +29 -35
- package/dist/asset-registries/i18n.js +62 -49
- package/dist/assets/bundle.esm.3bc98648.js +43 -0
- package/dist/assets-meta/IconCollectionsAlias.js +18 -0
- package/dist/config/Icons.js +52 -0
- package/dist/config/Language.js +18 -20
- package/dist/config/Theme.js +25 -0
- package/dist/css/BusyIndicator.css +80 -0
- package/dist/css/FontFace.css +66 -0
- package/dist/css/OverrideFontFace.css +32 -0
- package/dist/css/SystemCSSVars.css +17 -0
- package/dist/delegate/ItemNavigation.js +238 -201
- package/dist/delegate/ResizeHandler.js +78 -37
- package/dist/delegate/ScrollEnablement.js +49 -20
- package/dist/features/F6Navigation.js +110 -0
- package/dist/features/OpenUI5Enablement.js +119 -0
- package/dist/features/OpenUI5Support.js +41 -6
- package/dist/generated/AssetParameters.js +1 -1
- package/dist/generated/VersionInfo.js +10 -0
- package/dist/generated/css/BusyIndicator.css.js +5 -0
- package/dist/generated/css/FontFace.css.js +5 -0
- package/dist/generated/css/OverrideFontFace.css.js +5 -0
- package/dist/generated/css/SystemCSSVars.css.js +5 -0
- package/dist/i18nBundle.js +39 -5
- package/dist/locale/applyDirection.js +6 -4
- package/dist/locale/directionChange.js +32 -0
- package/dist/locale/getEffectiveDir.js +28 -0
- package/dist/locale/languageChange.js +1 -1
- package/dist/renderer/LitRenderer.js +39 -18
- package/dist/renderer/directives/style-map.js +72 -0
- package/dist/renderer/executeTemplate.js +19 -2
- package/dist/sap/base/Log.js +241 -0
- package/dist/sap/base/assert.js +8 -0
- package/dist/sap/base/security/URLListValidator.js +148 -0
- package/dist/sap/base/security/encodeCSS.js +14 -0
- package/dist/sap/base/security/encodeXML.js +23 -0
- package/dist/sap/base/security/sanitizeHTML.js +16 -0
- package/dist/sap/base/strings/toHex.js +8 -0
- package/dist/sap/base/util/now.js +7 -0
- package/dist/sap/ui/thirdparty/caja-html-sanitizer.js +3585 -0
- package/dist/theming/CustomStyle.js +25 -5
- package/dist/theming/applyTheme.js +11 -16
- package/dist/theming/getConstructableStyle.js +7 -6
- package/dist/theming/getEffectiveLinksHrefs.js +27 -0
- package/dist/theming/getEffectiveStyle.js +24 -8
- package/dist/theming/getStylesString.js +4 -2
- package/dist/theming/getThemeDesignerTheme.js +25 -5
- package/dist/theming/preloadLinks.js +23 -0
- package/dist/types/CSSColor.js +9 -0
- package/dist/types/DOMReference.js +24 -0
- package/dist/types/DataType.js +12 -0
- package/dist/types/Float.js +4 -0
- package/dist/types/Integer.js +4 -0
- package/dist/types/InvisibleMessageMode.js +30 -0
- package/dist/types/ItemNavigationBehavior.js +2 -7
- package/dist/updateShadowRoot.js +29 -0
- package/dist/util/AriaLabelHelper.js +6 -8
- package/dist/util/Caret.js +32 -0
- package/dist/util/ColorConversion.js +398 -0
- package/dist/util/FocusableElements.js +13 -7
- package/dist/util/HTMLSanitizer.js +7 -0
- package/dist/util/InvisibleMessage.js +69 -0
- package/dist/util/PopupUtils.js +93 -0
- package/dist/util/SlotsHelper.js +43 -0
- package/dist/util/TabbableElements.js +5 -1
- package/dist/util/arraysAreEqual.js +15 -0
- package/dist/util/clamp.js +12 -0
- package/dist/util/createLinkInHead.js +19 -0
- package/dist/util/debounce.js +17 -0
- package/dist/util/escapeRegex.js +10 -0
- package/dist/util/generateHighlightedMarkup.js +42 -0
- package/dist/util/getActiveElement.js +11 -0
- package/dist/util/getClassCopy.js +10 -0
- package/dist/util/getEffectiveContentDensity.js +5 -0
- package/dist/util/getEffectiveScrollbarStyle.js +5 -0
- package/dist/util/getNormalizedTarget.js +16 -0
- package/dist/util/isDefaultSlotProvided.js +11 -0
- package/dist/util/isElementInView.js +15 -0
- package/dist/util/isNodeHidden.js +1 -1
- package/dist/util/isNodeTabbable.js +4 -4
- package/hash.txt +1 -0
- package/index.js +1 -1
- package/lib/generate-asset-parameters/index.js +8 -5
- package/lib/generate-styles/index.js +26 -0
- package/lib/generate-version-info/index.js +32 -0
- package/package-scripts.js +37 -28
- package/package.json +20 -13
- package/src/AssetRegistry.js +8 -9
- package/src/Boot.js +59 -0
- package/src/CSP.js +59 -0
- package/src/CustomElementsRegistry.js +60 -4
- package/src/CustomElementsScope.js +20 -98
- package/src/CustomElementsScopeUtils.js +108 -0
- package/src/DOMObserver.js +65 -0
- package/src/Device.js +71 -773
- package/src/EventProvider.js +30 -26
- package/src/FeaturesRegistry.js +4 -1
- package/src/FontFace.js +7 -95
- package/src/InitialConfiguration.js +37 -21
- package/src/Keys.js +98 -0
- package/src/ManagedStyles.js +83 -0
- package/src/MediaRange.js +109 -0
- package/src/{util/parseProperties.js → PropertiesFileFormat.js} +6 -0
- package/src/Render.js +175 -0
- package/src/RenderScheduler.js +16 -138
- package/src/Runtimes.js +107 -0
- package/src/StaticArea.js +1 -29
- package/src/StaticAreaItem.js +58 -65
- package/src/SystemCSSVars.js +4 -25
- package/src/UI5Element.js +322 -387
- package/src/UI5ElementMetadata.js +132 -17
- package/src/asset-registries/Icons.js +118 -15
- package/src/asset-registries/Illustrations.js +30 -0
- package/src/asset-registries/LocaleData.js +97 -68
- package/src/asset-registries/Themes.js +29 -35
- package/src/asset-registries/i18n.js +62 -49
- package/src/assets-meta/IconCollectionsAlias.js +18 -0
- package/src/config/Icons.js +52 -0
- package/src/config/Language.js +18 -20
- package/src/config/Theme.js +25 -0
- package/src/css/BusyIndicator.css +80 -0
- package/src/css/FontFace.css +66 -0
- package/src/css/OverrideFontFace.css +32 -0
- package/src/css/SystemCSSVars.css +17 -0
- package/src/delegate/ItemNavigation.js +238 -201
- package/src/delegate/ResizeHandler.js +78 -37
- package/src/delegate/ScrollEnablement.js +49 -20
- package/src/features/F6Navigation.js +110 -0
- package/src/features/OpenUI5Enablement.js +119 -0
- package/src/features/OpenUI5Support.js +41 -6
- package/src/i18nBundle.js +39 -5
- package/src/locale/applyDirection.js +6 -4
- package/src/locale/directionChange.js +32 -0
- package/src/locale/getEffectiveDir.js +28 -0
- package/src/locale/languageChange.js +1 -1
- package/src/renderer/LitRenderer.js +39 -18
- package/src/renderer/directives/style-map.js +72 -0
- package/src/renderer/executeTemplate.js +19 -2
- package/src/theming/CustomStyle.js +25 -5
- package/src/theming/applyTheme.js +11 -16
- package/src/theming/getConstructableStyle.js +7 -6
- package/src/theming/getEffectiveLinksHrefs.js +27 -0
- package/src/theming/getEffectiveStyle.js +24 -8
- package/src/theming/getStylesString.js +4 -2
- package/src/theming/getThemeDesignerTheme.js +25 -5
- package/src/theming/preloadLinks.js +23 -0
- package/src/types/CSSColor.js +9 -0
- package/src/types/DOMReference.js +24 -0
- package/src/types/DataType.js +12 -0
- package/src/types/Float.js +4 -0
- package/src/types/Integer.js +4 -0
- package/src/types/InvisibleMessageMode.js +30 -0
- package/src/types/ItemNavigationBehavior.js +2 -7
- package/src/updateShadowRoot.js +29 -0
- package/src/util/AriaLabelHelper.js +6 -8
- package/src/util/Caret.js +32 -0
- package/src/util/ColorConversion.js +398 -0
- package/src/util/FocusableElements.js +13 -7
- package/src/util/HTMLSanitizer.js +7 -0
- package/src/util/InvisibleMessage.js +69 -0
- package/src/util/PopupUtils.js +93 -0
- package/src/util/SlotsHelper.js +43 -0
- package/src/util/TabbableElements.js +5 -1
- package/src/util/arraysAreEqual.js +15 -0
- package/src/util/clamp.js +12 -0
- package/src/util/createLinkInHead.js +19 -0
- package/src/util/debounce.js +17 -0
- package/src/util/escapeRegex.js +10 -0
- package/src/util/generateHighlightedMarkup.js +42 -0
- package/src/util/getActiveElement.js +11 -0
- package/src/util/getClassCopy.js +10 -0
- package/src/util/getEffectiveContentDensity.js +5 -0
- package/src/util/getEffectiveScrollbarStyle.js +5 -0
- package/src/util/getNormalizedTarget.js +16 -0
- package/src/util/isDefaultSlotProvided.js +11 -0
- package/src/util/isElementInView.js +15 -0
- package/src/util/isNodeHidden.js +1 -1
- package/src/util/isNodeTabbable.js +4 -4
- package/used-modules.txt +10 -0
- package/bundle.es5.js +0 -28
- package/config/.eslintrc.js +0 -3
- package/config/rollup.config.js +0 -1
- package/dist/SVGIconRegistry.js +0 -73
- package/dist/boot.js +0 -34
- package/dist/compatibility/DOMObserver.js +0 -62
- package/dist/compatibility/patchNodeValue.js +0 -24
- package/dist/compatibility/whenPolyfillLoaded.js +0 -26
- package/dist/config/AssetsPath.js +0 -17
- package/dist/delegate/CustomResize.js +0 -78
- package/dist/delegate/NativeResize.js +0 -45
- package/dist/features/PropertiesFormatSupport.js +0 -8
- package/dist/features/browsersupport/Edge.js +0 -6
- package/dist/features/browsersupport/IE11.js +0 -42
- package/dist/features/browsersupport/IE11WithWebComponentsPolyfill.js +0 -5
- package/dist/renderer/ifDefined.js +0 -21
- package/dist/renderer/scopeHTML.js +0 -32
- package/dist/resources/bundle.es5.js +0 -212
- package/dist/resources/bundle.es5.js.map +0 -1
- package/dist/resources/bundle.esm.js +0 -129
- package/dist/resources/bundle.esm.js.map +0 -1
- package/dist/test-resources/assets/Themes.js +0 -17
- package/dist/test-resources/elements/Child.js +0 -35
- package/dist/test-resources/elements/Generic.js +0 -84
- package/dist/test-resources/elements/GenericExt.js +0 -26
- package/dist/test-resources/elements/NoShadowDOM.js +0 -13
- package/dist/test-resources/elements/Parent.js +0 -37
- package/dist/test-resources/elements/WithStaticArea.js +0 -76
- package/dist/test-resources/pages/AllTestElements.html +0 -42
- package/dist/test-resources/pages/Configuration.html +0 -20
- package/dist/test-resources/pages/ConfigurationScript.html +0 -36
- package/dist/test-resources/pages/assets/messagebundle_de.properties +0 -1
- package/dist/test-resources/pages/assets/messagebundle_en.properties +0 -1
- package/dist/test-resources/pages/assets/messagebundle_es.properties +0 -1
- package/dist/test-resources/pages/assets/messagebundle_fr.properties +0 -1
- package/dist/test-resources/pages/i18n.html +0 -40
- package/dist/test-resources/specs/ConfigurationChange.spec.js +0 -25
- package/dist/test-resources/specs/ConfigurationScript.spec.js +0 -61
- package/dist/test-resources/specs/ConfigurationURL.spec.js +0 -45
- package/dist/test-resources/specs/CustomTheme.spec.js +0 -25
- package/dist/test-resources/specs/StaticArea.spec.js +0 -34
- package/dist/test-resources/specs/Theming.spec.js +0 -31
- package/dist/test-resources/specs/UI5ElementInvalidation.js +0 -258
- package/dist/test-resources/specs/UI5ElementLifecycle.js +0 -96
- package/dist/test-resources/specs/UI5ElementListenForChildPropChanges.spec.js +0 -101
- package/dist/test-resources/specs/UI5ElementMetadataExt.js +0 -40
- package/dist/test-resources/specs/UI5ElementPropertyValidation.js +0 -12
- package/dist/test-resources/specs/UI5ElementPropsAndAttrs.spec.js +0 -65
- package/dist/test-resources/specs/UI5ElementShadowDOM.js +0 -22
- package/dist/test-resources/specs/UI5ElementSlots.js +0 -34
- package/dist/theming/CSSVarsPonyfill.js +0 -68
- package/dist/theming/adaptCSSForIE.js +0 -95
- package/dist/theming/createComponentStyleTag.js +0 -54
- package/dist/theming/createThemePropertiesStyleTag.js +0 -20
- package/dist/thirdparty/Array.from.js +0 -16
- package/dist/thirdparty/Array.prototype.fill.js +0 -44
- package/dist/thirdparty/Array.prototype.find.js +0 -46
- package/dist/thirdparty/Array.prototype.includes.js +0 -51
- package/dist/thirdparty/Element.prototype.closest.js +0 -11
- package/dist/thirdparty/Element.prototype.matches.js +0 -6
- package/dist/thirdparty/Map.prototype.keys.js +0 -9
- package/dist/thirdparty/Number.isInteger.js +0 -5
- package/dist/thirdparty/Number.isNaN.js +0 -1
- package/dist/thirdparty/Number.parseFloat.js +0 -1
- package/dist/thirdparty/Number.parseInt.js +0 -1
- package/dist/thirdparty/Object.assign.js +0 -31
- package/dist/thirdparty/Object.entries.js +0 -11
- package/dist/thirdparty/Symbol.js +0 -2
- package/dist/thirdparty/WeakSet.js +0 -27
- package/dist/thirdparty/es6-string-methods.js +0 -182
- package/dist/thirdparty/events-polyfills.js +0 -89
- package/dist/thirdparty/fetch.js +0 -1
- package/dist/thirdparty/template.js +0 -600
- package/dist/thirdparty/webcomponents-sd-ce-pf.js +0 -318
- package/dist/types/CalendarSelection.js +0 -17
- package/dist/util/EffectiveAssetPath.js +0 -27
- package/dist/util/encodeCSS.js +0 -24
- package/dist/util/findNodeOwner.js +0 -35
- package/dist/util/isSlot.js +0 -3
- package/dist/webcomponentsjs/LICENSE.md +0 -19
- package/dist/webcomponentsjs/README.md +0 -229
- package/dist/webcomponentsjs/bundles/webcomponents-ce.js +0 -63
- package/dist/webcomponentsjs/bundles/webcomponents-ce.js.map +0 -1
- package/dist/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js +0 -297
- package/dist/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js.map +0 -1
- package/dist/webcomponentsjs/bundles/webcomponents-sd-ce.js +0 -208
- package/dist/webcomponentsjs/bundles/webcomponents-sd-ce.js.map +0 -1
- package/dist/webcomponentsjs/bundles/webcomponents-sd.js +0 -166
- package/dist/webcomponentsjs/bundles/webcomponents-sd.js.map +0 -1
- package/dist/webcomponentsjs/custom-elements-es5-adapter.js +0 -15
- package/dist/webcomponentsjs/package.json +0 -46
- package/dist/webcomponentsjs/src/entrypoints/custom-elements-es5-adapter-index.js +0 -16
- package/dist/webcomponentsjs/src/entrypoints/webcomponents-bundle-index.js +0 -53
- package/dist/webcomponentsjs/src/entrypoints/webcomponents-ce-index.js +0 -17
- package/dist/webcomponentsjs/src/entrypoints/webcomponents-sd-ce-index.js +0 -19
- package/dist/webcomponentsjs/src/entrypoints/webcomponents-sd-ce-pf-index.js +0 -28
- package/dist/webcomponentsjs/src/entrypoints/webcomponents-sd-index.js +0 -18
- package/dist/webcomponentsjs/webcomponents-bundle.js +0 -298
- package/dist/webcomponentsjs/webcomponents-bundle.js.map +0 -1
- package/dist/webcomponentsjs/webcomponents-loader.js +0 -185
- package/src/SVGIconRegistry.js +0 -73
- package/src/boot.js +0 -34
- package/src/compatibility/DOMObserver.js +0 -62
- package/src/compatibility/patchNodeValue.js +0 -24
- package/src/compatibility/whenPolyfillLoaded.js +0 -26
- package/src/config/AssetsPath.js +0 -17
- package/src/delegate/CustomResize.js +0 -78
- package/src/delegate/NativeResize.js +0 -45
- package/src/features/PropertiesFormatSupport.js +0 -8
- package/src/features/browsersupport/Edge.js +0 -6
- package/src/features/browsersupport/IE11.js +0 -42
- package/src/features/browsersupport/IE11WithWebComponentsPolyfill.js +0 -5
- package/src/renderer/ifDefined.js +0 -21
- package/src/renderer/scopeHTML.js +0 -32
- package/src/theming/CSSVarsPonyfill.js +0 -68
- package/src/theming/adaptCSSForIE.js +0 -95
- package/src/theming/createComponentStyleTag.js +0 -54
- package/src/theming/createThemePropertiesStyleTag.js +0 -20
- package/src/thirdparty/Array.from.js +0 -16
- package/src/thirdparty/Array.prototype.fill.js +0 -44
- package/src/thirdparty/Array.prototype.find.js +0 -46
- package/src/thirdparty/Array.prototype.includes.js +0 -51
- package/src/thirdparty/Element.prototype.closest.js +0 -11
- package/src/thirdparty/Element.prototype.matches.js +0 -6
- package/src/thirdparty/Map.prototype.keys.js +0 -9
- package/src/thirdparty/Number.isInteger.js +0 -5
- package/src/thirdparty/Number.isNaN.js +0 -1
- package/src/thirdparty/Number.parseFloat.js +0 -1
- package/src/thirdparty/Number.parseInt.js +0 -1
- package/src/thirdparty/Object.assign.js +0 -31
- package/src/thirdparty/Object.entries.js +0 -11
- package/src/thirdparty/Symbol.js +0 -2
- package/src/thirdparty/WeakSet.js +0 -27
- package/src/thirdparty/es6-string-methods.js +0 -182
- package/src/thirdparty/events-polyfills.js +0 -89
- package/src/thirdparty/fetch.js +0 -1
- package/src/thirdparty/template.js +0 -600
- package/src/thirdparty/webcomponents-sd-ce-pf.js +0 -318
- package/src/types/CalendarSelection.js +0 -17
- package/src/util/EffectiveAssetPath.js +0 -27
- package/src/util/encodeCSS.js +0 -24
- package/src/util/findNodeOwner.js +0 -35
- package/src/util/isSlot.js +0 -3
package/dist/UI5Element.js
CHANGED
|
@@ -1,36 +1,52 @@
|
|
|
1
1
|
import merge from "./thirdparty/merge.js";
|
|
2
|
-
import boot from "./
|
|
2
|
+
import { boot } from "./Boot.js";
|
|
3
3
|
import UI5ElementMetadata from "./UI5ElementMetadata.js";
|
|
4
|
-
import
|
|
4
|
+
import EventProvider from "./EventProvider.js";
|
|
5
|
+
import getSingletonElementInstance from "./util/getSingletonElementInstance.js";
|
|
5
6
|
import StaticAreaItem from "./StaticAreaItem.js";
|
|
6
|
-
import
|
|
7
|
+
import updateShadowRoot from "./updateShadowRoot.js";
|
|
8
|
+
import { renderDeferred, renderImmediately, cancelRender } from "./Render.js";
|
|
7
9
|
import { registerTag, isTagRegistered, recordTagRegistrationFailure } from "./CustomElementsRegistry.js";
|
|
8
|
-
import
|
|
10
|
+
import { observeDOMNode, unobserveDOMNode } from "./DOMObserver.js";
|
|
9
11
|
import { skipOriginalEvent } from "./config/NoConflict.js";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import createComponentStyleTag from "./theming/createComponentStyleTag.js";
|
|
13
|
-
import getEffectiveStyle from "./theming/getEffectiveStyle.js";
|
|
14
|
-
import Integer from "./types/Integer.js";
|
|
15
|
-
import Float from "./types/Float.js";
|
|
12
|
+
import getEffectiveDir from "./locale/getEffectiveDir.js";
|
|
13
|
+
import DataType from "./types/DataType.js";
|
|
16
14
|
import { kebabToCamelCase, camelToKebabCase } from "./util/StringHelper.js";
|
|
17
15
|
import isValidPropertyName from "./util/isValidPropertyName.js";
|
|
18
|
-
import
|
|
16
|
+
import isDescendantOf from "./util/isDescendantOf.js";
|
|
17
|
+
import { isSlot, getSlotName, getSlottedElementsList } from "./util/SlotsHelper.js";
|
|
18
|
+
import arraysAreEqual from "./util/arraysAreEqual.js";
|
|
19
|
+
import getClassCopy from "./util/getClassCopy.js";
|
|
19
20
|
import { markAsRtlAware } from "./locale/RTLAwareRegistry.js";
|
|
20
|
-
|
|
21
|
-
const metadata = {
|
|
22
|
-
events: {
|
|
23
|
-
"_property-change": {},
|
|
24
|
-
},
|
|
25
|
-
};
|
|
21
|
+
import preloadLinks from "./theming/preloadLinks.js";
|
|
26
22
|
|
|
27
23
|
let autoId = 0;
|
|
28
24
|
|
|
29
25
|
const elementTimeouts = new Map();
|
|
30
26
|
const uniqueDependenciesCache = new Map();
|
|
31
27
|
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Triggers re-rendering of a UI5Element instance due to state change.
|
|
30
|
+
*
|
|
31
|
+
* @param changeInfo An object with information about the change that caused invalidation.
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
function _invalidate(changeInfo) {
|
|
35
|
+
// Invalidation should be suppressed: 1) before the component is rendered for the first time 2) and during the execution of onBeforeRendering
|
|
36
|
+
// This is necessary not only as an optimization, but also to avoid infinite loops on invalidation between children and parents (when invalidateOnChildChange is used)
|
|
37
|
+
if (this._suppressInvalidation) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Call the onInvalidation hook
|
|
42
|
+
this.onInvalidation(changeInfo);
|
|
43
|
+
|
|
44
|
+
this._changedState.push(changeInfo);
|
|
45
|
+
renderDeferred(this);
|
|
46
|
+
this._eventProvider.fireEvent("invalidate", { ...changeInfo, target: this });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
let metadata = {};
|
|
34
50
|
|
|
35
51
|
/**
|
|
36
52
|
* Base class for all UI5 Web Components
|
|
@@ -45,40 +61,27 @@ const GLOBAL_DIR_CSS_VAR = "--_ui5_dir";
|
|
|
45
61
|
class UI5Element extends HTMLElement {
|
|
46
62
|
constructor() {
|
|
47
63
|
super();
|
|
48
|
-
this._propertyChangeListeners = new Set();
|
|
49
|
-
this._initializeState();
|
|
50
|
-
this._upgradeAllProperties();
|
|
51
|
-
this._initializeContainers();
|
|
52
|
-
this._upToDate = false;
|
|
53
|
-
this._inDOM = false;
|
|
54
|
-
this._fullyConnected = false;
|
|
55
64
|
|
|
65
|
+
this._changedState = []; // Filled on each invalidation, cleared on re-render (used for debugging)
|
|
66
|
+
this._suppressInvalidation = true; // A flag telling whether all invalidations should be ignored. Initialized with "true" because a UI5Element can not be invalidated until it is rendered for the first time
|
|
67
|
+
this._inDOM = false; // A flag telling whether the UI5Element is currently in the DOM tree of the document or not
|
|
68
|
+
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)
|
|
69
|
+
this._childChangeListeners = new Map(); // used to store lazy listeners per slot for the child change event of every child inside that slot
|
|
70
|
+
this._slotChangeListeners = new Map(); // used to store lazy listeners per slot for the slotchange event of all slot children inside that slot
|
|
71
|
+
this._eventProvider = new EventProvider(); // used by parent components for listening to changes to child components
|
|
56
72
|
let deferredResolve;
|
|
57
73
|
this._domRefReadyPromise = new Promise(resolve => {
|
|
58
74
|
deferredResolve = resolve;
|
|
59
75
|
});
|
|
60
76
|
this._domRefReadyPromise._deferredResolve = deferredResolve;
|
|
77
|
+
this._doNotSyncAttributes = new Set(); // attributes that are excluded from attributeChangedCallback synchronization
|
|
61
78
|
|
|
62
|
-
this.
|
|
63
|
-
this.
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
addEventListener(type, listener, options) {
|
|
67
|
-
if (type === "_property-change") {
|
|
68
|
-
this._propertyChangeListeners.add(listener);
|
|
69
|
-
}
|
|
70
|
-
return super.addEventListener(type, listener, options);
|
|
71
|
-
}
|
|
79
|
+
this._initializeState();
|
|
80
|
+
this._upgradeAllProperties();
|
|
72
81
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
this._propertyChangeListeners.delete(listener);
|
|
82
|
+
if (this.constructor._needsShadowDOM()) {
|
|
83
|
+
this.attachShadow({ mode: "open" });
|
|
76
84
|
}
|
|
77
|
-
return super.removeEventListener(type, listener, options);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
_hasPropertyChangeListeners() {
|
|
81
|
-
return !!this._propertyChangeListeners.size;
|
|
82
85
|
}
|
|
83
86
|
|
|
84
87
|
/**
|
|
@@ -95,32 +98,16 @@ class UI5Element extends HTMLElement {
|
|
|
95
98
|
return this.__id;
|
|
96
99
|
}
|
|
97
100
|
|
|
98
|
-
/**
|
|
99
|
-
* @private
|
|
100
|
-
*/
|
|
101
|
-
_initializeContainers() {
|
|
102
|
-
const needsShadowDOM = this.constructor._needsShadowDOM();
|
|
103
|
-
const needsStaticArea = this.constructor._needsStaticArea();
|
|
104
|
-
|
|
105
|
-
// Init Shadow Root
|
|
106
|
-
if (needsShadowDOM) {
|
|
107
|
-
this.attachShadow({ mode: "open" });
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// Init StaticAreaItem only if needed
|
|
111
|
-
if (needsStaticArea) {
|
|
112
|
-
this.staticAreaItem = new StaticAreaItem(this);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
101
|
/**
|
|
117
102
|
* Do not call this method from derivatives of UI5Element, use "onEnterDOM" only
|
|
118
103
|
* @private
|
|
119
104
|
*/
|
|
120
105
|
async connectedCallback() {
|
|
121
106
|
this.setAttribute(this.constructor.getMetadata().getPureTag(), "");
|
|
107
|
+
if (this.constructor.getMetadata().supportsF6FastNavigation()) {
|
|
108
|
+
this.setAttribute("data-sap-ui-fastnavgroup", "true");
|
|
109
|
+
}
|
|
122
110
|
|
|
123
|
-
const needsShadowDOM = this.constructor._needsShadowDOM();
|
|
124
111
|
const slotsAreManaged = this.constructor.getMetadata().slotsAreManaged();
|
|
125
112
|
|
|
126
113
|
this._inDOM = true;
|
|
@@ -131,23 +118,15 @@ class UI5Element extends HTMLElement {
|
|
|
131
118
|
await this._processChildren();
|
|
132
119
|
}
|
|
133
120
|
|
|
134
|
-
//
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
await Promise.resolve();
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (!this._inDOM) { // Component removed from DOM while _processChildren was running
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
121
|
+
if (!this._inDOM) { // Component removed from DOM while _processChildren was running
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
143
124
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
this.onEnterDOM();
|
|
150
|
-
}
|
|
125
|
+
renderImmediately(this);
|
|
126
|
+
this._domRefReadyPromise._deferredResolve();
|
|
127
|
+
this._fullyConnected = true;
|
|
128
|
+
if (typeof this.onEnterDOM === "function") {
|
|
129
|
+
this.onEnterDOM();
|
|
151
130
|
}
|
|
152
131
|
}
|
|
153
132
|
|
|
@@ -156,8 +135,6 @@ class UI5Element extends HTMLElement {
|
|
|
156
135
|
* @private
|
|
157
136
|
*/
|
|
158
137
|
disconnectedCallback() {
|
|
159
|
-
const needsShadowDOM = this.constructor._needsShadowDOM();
|
|
160
|
-
const needsStaticArea = this.constructor._needsStaticArea();
|
|
161
138
|
const slotsAreManaged = this.constructor.getMetadata().slotsAreManaged();
|
|
162
139
|
|
|
163
140
|
this._inDOM = false;
|
|
@@ -166,21 +143,18 @@ class UI5Element extends HTMLElement {
|
|
|
166
143
|
this._stopObservingDOMChildren();
|
|
167
144
|
}
|
|
168
145
|
|
|
169
|
-
if (
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
if (typeof this.onExitDOM === "function") {
|
|
173
|
-
this.onExitDOM();
|
|
174
|
-
}
|
|
175
|
-
this._fullyConnected = false;
|
|
146
|
+
if (this._fullyConnected) {
|
|
147
|
+
if (typeof this.onExitDOM === "function") {
|
|
148
|
+
this.onExitDOM();
|
|
176
149
|
}
|
|
150
|
+
this._fullyConnected = false;
|
|
177
151
|
}
|
|
178
152
|
|
|
179
|
-
if (
|
|
180
|
-
this.staticAreaItem.
|
|
153
|
+
if (this.staticAreaItem && this.staticAreaItem.parentElement) {
|
|
154
|
+
this.staticAreaItem.parentElement.removeChild(this.staticAreaItem);
|
|
181
155
|
}
|
|
182
156
|
|
|
183
|
-
|
|
157
|
+
cancelRender(this);
|
|
184
158
|
}
|
|
185
159
|
|
|
186
160
|
/**
|
|
@@ -196,16 +170,16 @@ class UI5Element extends HTMLElement {
|
|
|
196
170
|
const mutationObserverOptions = {
|
|
197
171
|
childList: true,
|
|
198
172
|
subtree: canSlotText,
|
|
199
|
-
characterData:
|
|
173
|
+
characterData: canSlotText,
|
|
200
174
|
};
|
|
201
|
-
|
|
175
|
+
observeDOMNode(this, this._processChildren.bind(this), mutationObserverOptions);
|
|
202
176
|
}
|
|
203
177
|
|
|
204
178
|
/**
|
|
205
179
|
* @private
|
|
206
180
|
*/
|
|
207
181
|
_stopObservingDOMChildren() {
|
|
208
|
-
|
|
182
|
+
unobserveDOMNode(this);
|
|
209
183
|
}
|
|
210
184
|
|
|
211
185
|
/**
|
|
@@ -227,8 +201,14 @@ class UI5Element extends HTMLElement {
|
|
|
227
201
|
const canSlotText = this.constructor.getMetadata().canSlotText();
|
|
228
202
|
const domChildren = Array.from(canSlotText ? this.childNodes : this.children);
|
|
229
203
|
|
|
230
|
-
//
|
|
204
|
+
const slotsCachedContentMap = new Map(); // Store here the content of each slot before the mutation occurred
|
|
205
|
+
const propertyNameToSlotMap = new Map(); // Used for reverse lookup to determine to which slot the property name corresponds
|
|
206
|
+
|
|
207
|
+
// Init the _state object based on the supported slots and store the previous values
|
|
231
208
|
for (const [slotName, slotData] of Object.entries(slotsMap)) { // eslint-disable-line
|
|
209
|
+
const propertyName = slotData.propertyName || slotName;
|
|
210
|
+
propertyNameToSlotMap.set(propertyName, slotName);
|
|
211
|
+
slotsCachedContentMap.set(propertyName, [...this._state[propertyName]]);
|
|
232
212
|
this._clearSlot(slotName, slotData);
|
|
233
213
|
}
|
|
234
214
|
|
|
@@ -237,7 +217,7 @@ class UI5Element extends HTMLElement {
|
|
|
237
217
|
|
|
238
218
|
const allChildrenUpgraded = domChildren.map(async (child, idx) => {
|
|
239
219
|
// Determine the type of the child (mainly by the slot attribute)
|
|
240
|
-
const slotName =
|
|
220
|
+
const slotName = getSlotName(child);
|
|
241
221
|
const slotData = slotsMap[slotName];
|
|
242
222
|
|
|
243
223
|
// Check if the slotName is supported
|
|
@@ -275,16 +255,15 @@ class UI5Element extends HTMLElement {
|
|
|
275
255
|
|
|
276
256
|
child = this.constructor.getMetadata().constructor.validateSlotValue(child, slotData);
|
|
277
257
|
|
|
278
|
-
if (
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
if (child.isUI5Element && slotData.invalidateParent) {
|
|
283
|
-
child._shouldInvalidateParent = true;
|
|
258
|
+
// Listen for any invalidation on the child if invalidateOnChildChange is true or an object (ignore when false or not set)
|
|
259
|
+
if (child.isUI5Element && slotData.invalidateOnChildChange) {
|
|
260
|
+
const method = (child.attachInvalidate || child._attachChange).bind(child);
|
|
261
|
+
method(this._getChildChangeListener(slotName));
|
|
284
262
|
}
|
|
285
263
|
|
|
264
|
+
// Listen for the slotchange event if the child is a slot itself
|
|
286
265
|
if (isSlot(child)) {
|
|
287
|
-
this._attachSlotChange(child);
|
|
266
|
+
this._attachSlotChange(child, slotName);
|
|
288
267
|
}
|
|
289
268
|
|
|
290
269
|
const propertyName = slotData.propertyName || slotName;
|
|
@@ -300,10 +279,33 @@ class UI5Element extends HTMLElement {
|
|
|
300
279
|
|
|
301
280
|
// Distribute the child in the _state object, keeping the Light DOM order,
|
|
302
281
|
// not the order elements are defined.
|
|
303
|
-
slottedChildrenMap.forEach((children,
|
|
304
|
-
this._state[
|
|
282
|
+
slottedChildrenMap.forEach((children, propertyName) => {
|
|
283
|
+
this._state[propertyName] = children.sort((a, b) => a.idx - b.idx).map(_ => _.child);
|
|
305
284
|
});
|
|
306
|
-
|
|
285
|
+
|
|
286
|
+
// Compare the content of each slot with the cached values and invalidate for the ones that changed
|
|
287
|
+
let invalidated = false;
|
|
288
|
+
for (const [slotName, slotData] of Object.entries(slotsMap)) { // eslint-disable-line
|
|
289
|
+
const propertyName = slotData.propertyName || slotName;
|
|
290
|
+
if (!arraysAreEqual(slotsCachedContentMap.get(propertyName), this._state[propertyName])) {
|
|
291
|
+
_invalidate.call(this, {
|
|
292
|
+
type: "slot",
|
|
293
|
+
name: propertyNameToSlotMap.get(propertyName),
|
|
294
|
+
reason: "children",
|
|
295
|
+
});
|
|
296
|
+
invalidated = true;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// If none of the slots had an invalidation due to changes to immediate children,
|
|
301
|
+
// the change is considered to be text content of the default slot
|
|
302
|
+
if (!invalidated) {
|
|
303
|
+
_invalidate.call(this, {
|
|
304
|
+
type: "slot",
|
|
305
|
+
name: "default",
|
|
306
|
+
reason: "textcontent",
|
|
307
|
+
});
|
|
308
|
+
}
|
|
307
309
|
}
|
|
308
310
|
|
|
309
311
|
/**
|
|
@@ -312,25 +314,62 @@ class UI5Element extends HTMLElement {
|
|
|
312
314
|
*/
|
|
313
315
|
_clearSlot(slotName, slotData) {
|
|
314
316
|
const propertyName = slotData.propertyName || slotName;
|
|
315
|
-
|
|
316
|
-
let children = this._state[propertyName];
|
|
317
|
-
if (!Array.isArray(children)) {
|
|
318
|
-
children = [children];
|
|
319
|
-
}
|
|
317
|
+
const children = this._state[propertyName];
|
|
320
318
|
|
|
321
319
|
children.forEach(child => {
|
|
322
320
|
if (child && child.isUI5Element) {
|
|
323
|
-
|
|
324
|
-
|
|
321
|
+
const method = (child.detachInvalidate || child._detachChange).bind(child);
|
|
322
|
+
method(this._getChildChangeListener(slotName));
|
|
325
323
|
}
|
|
326
324
|
|
|
327
325
|
if (isSlot(child)) {
|
|
328
|
-
this._detachSlotChange(child);
|
|
326
|
+
this._detachSlotChange(child, slotName);
|
|
329
327
|
}
|
|
330
328
|
});
|
|
331
329
|
|
|
332
330
|
this._state[propertyName] = [];
|
|
333
|
-
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Attach a callback that will be executed whenever the component is invalidated
|
|
335
|
+
*
|
|
336
|
+
* @param callback
|
|
337
|
+
* @public
|
|
338
|
+
*/
|
|
339
|
+
attachInvalidate(callback) {
|
|
340
|
+
this._eventProvider.attachEvent("invalidate", callback);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Detach the callback that is executed whenever the component is invalidated
|
|
345
|
+
*
|
|
346
|
+
* @param callback
|
|
347
|
+
* @public
|
|
348
|
+
*/
|
|
349
|
+
detachInvalidate(callback) {
|
|
350
|
+
this._eventProvider.detachEvent("invalidate", callback);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Callback that is executed whenever a monitored child changes its state
|
|
355
|
+
*
|
|
356
|
+
* @param slotName the slot in which a child was invalidated
|
|
357
|
+
* @param childChangeInfo the changeInfo object for the child in the given slot
|
|
358
|
+
* @private
|
|
359
|
+
*/
|
|
360
|
+
_onChildChange(slotName, childChangeInfo) {
|
|
361
|
+
if (!this.constructor.getMetadata().shouldInvalidateOnChildChange(slotName, childChangeInfo.type, childChangeInfo.name)) {
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// The component should be invalidated as this type of change on the child is listened for
|
|
366
|
+
// However, no matter what changed on the child (property/slot), the invalidation is registered as "type=slot" for the component itself
|
|
367
|
+
_invalidate.call(this, {
|
|
368
|
+
type: "slot",
|
|
369
|
+
name: slotName,
|
|
370
|
+
reason: "childchange",
|
|
371
|
+
child: childChangeInfo.target,
|
|
372
|
+
});
|
|
334
373
|
}
|
|
335
374
|
|
|
336
375
|
/**
|
|
@@ -338,6 +377,10 @@ class UI5Element extends HTMLElement {
|
|
|
338
377
|
* @private
|
|
339
378
|
*/
|
|
340
379
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
380
|
+
if (this._doNotSyncAttributes.has(name)) { // This attribute is mutated internally, not by the user
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
|
|
341
384
|
const properties = this.constructor.getMetadata().getProperties();
|
|
342
385
|
const realName = name.replace(/^ui5-/, "");
|
|
343
386
|
const nameInCamelCase = kebabToCamelCase(realName);
|
|
@@ -345,12 +388,8 @@ class UI5Element extends HTMLElement {
|
|
|
345
388
|
const propertyTypeClass = properties[nameInCamelCase].type;
|
|
346
389
|
if (propertyTypeClass === Boolean) {
|
|
347
390
|
newValue = newValue !== null;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
newValue = parseInt(newValue);
|
|
351
|
-
}
|
|
352
|
-
if (propertyTypeClass === Float) {
|
|
353
|
-
newValue = parseFloat(newValue);
|
|
391
|
+
} else if (isDescendantOf(propertyTypeClass, DataType)) {
|
|
392
|
+
newValue = propertyTypeClass.attributeToProperty(newValue);
|
|
354
393
|
}
|
|
355
394
|
this[nameInCamelCase] = newValue;
|
|
356
395
|
}
|
|
@@ -363,22 +402,31 @@ class UI5Element extends HTMLElement {
|
|
|
363
402
|
if (!this.constructor.getMetadata().hasAttribute(name)) {
|
|
364
403
|
return;
|
|
365
404
|
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
return;
|
|
369
|
-
}
|
|
370
|
-
|
|
405
|
+
const properties = this.constructor.getMetadata().getProperties();
|
|
406
|
+
const propertyTypeClass = properties[name].type;
|
|
371
407
|
const attrName = camelToKebabCase(name);
|
|
372
408
|
const attrValue = this.getAttribute(attrName);
|
|
373
|
-
|
|
409
|
+
|
|
410
|
+
if (propertyTypeClass === Boolean) {
|
|
374
411
|
if (newValue === true && attrValue === null) {
|
|
375
412
|
this.setAttribute(attrName, "");
|
|
376
413
|
} else if (newValue === false && attrValue !== null) {
|
|
377
414
|
this.removeAttribute(attrName);
|
|
378
415
|
}
|
|
379
|
-
} else if (
|
|
380
|
-
|
|
381
|
-
|
|
416
|
+
} else if (isDescendantOf(propertyTypeClass, DataType)) {
|
|
417
|
+
const newAttrValue = propertyTypeClass.propertyToAttribute(newValue);
|
|
418
|
+
if (newAttrValue === null) { // null means there must be no attribute for the current value of the property
|
|
419
|
+
this._doNotSyncAttributes.add(attrName); // skip the attributeChangedCallback call for this attribute
|
|
420
|
+
this.removeAttribute(attrName); // remove the attribute safely (will not trigger synchronization to the property value due to the above line)
|
|
421
|
+
this._doNotSyncAttributes.delete(attrName); // enable synchronization again for this attribute
|
|
422
|
+
} else {
|
|
423
|
+
this.setAttribute(attrName, newAttrValue);
|
|
424
|
+
}
|
|
425
|
+
} else if (typeof newValue !== "object") {
|
|
426
|
+
if (attrValue !== newValue) {
|
|
427
|
+
this.setAttribute(attrName, newValue);
|
|
428
|
+
}
|
|
429
|
+
} // else { return; } // old object handling
|
|
382
430
|
}
|
|
383
431
|
|
|
384
432
|
/**
|
|
@@ -404,123 +452,96 @@ class UI5Element extends HTMLElement {
|
|
|
404
452
|
* @private
|
|
405
453
|
*/
|
|
406
454
|
_initializeState() {
|
|
407
|
-
|
|
408
|
-
this._state = Object.assign({}, defaultState);
|
|
455
|
+
this._state = { ...this.constructor.getMetadata().getInitialState() };
|
|
409
456
|
}
|
|
410
457
|
|
|
411
458
|
/**
|
|
459
|
+
* Returns a singleton event listener for the "change" event of a child in a given slot
|
|
460
|
+
*
|
|
461
|
+
* @param slotName the name of the slot, where the child is
|
|
462
|
+
* @returns {any}
|
|
412
463
|
* @private
|
|
413
464
|
*/
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
let observedProps = [],
|
|
418
|
-
notObservedProps = [];
|
|
419
|
-
|
|
420
|
-
if (Array.isArray(listenFor)) {
|
|
421
|
-
observedProps = listenFor;
|
|
422
|
-
} else {
|
|
423
|
-
observedProps = Array.isArray(listenFor.include) ? listenFor.include : [];
|
|
424
|
-
notObservedProps = Array.isArray(listenFor.exclude) ? listenFor.exclude : [];
|
|
465
|
+
_getChildChangeListener(slotName) {
|
|
466
|
+
if (!this._childChangeListeners.has(slotName)) {
|
|
467
|
+
this._childChangeListeners.set(slotName, this._onChildChange.bind(this, slotName));
|
|
425
468
|
}
|
|
426
|
-
|
|
427
|
-
if (!this._monitoredChildProps.has(slotName)) {
|
|
428
|
-
this._monitoredChildProps.set(slotName, { observedProps, notObservedProps });
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
child.addEventListener("_property-change", this._invalidateParentOnPropertyUpdate);
|
|
469
|
+
return this._childChangeListeners.get(slotName);
|
|
432
470
|
}
|
|
433
471
|
|
|
434
472
|
/**
|
|
473
|
+
* Returns a singleton slotchange event listener that invalidates the component due to changes in the given slot
|
|
474
|
+
*
|
|
475
|
+
* @param slotName the name of the slot, where the slot element (whose slotchange event we're listening to) is
|
|
476
|
+
* @returns {any}
|
|
435
477
|
* @private
|
|
436
478
|
*/
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
/**
|
|
442
|
-
* @private
|
|
443
|
-
*/
|
|
444
|
-
_propertyChange(name, value) {
|
|
445
|
-
this._updateAttribute(name, value);
|
|
446
|
-
|
|
447
|
-
if (this._hasPropertyChangeListeners()) {
|
|
448
|
-
this.dispatchEvent(new CustomEvent("_property-change", {
|
|
449
|
-
detail: { name, newValue: value },
|
|
450
|
-
composed: false,
|
|
451
|
-
bubbles: false,
|
|
452
|
-
}));
|
|
479
|
+
_getSlotChangeListener(slotName) {
|
|
480
|
+
if (!this._slotChangeListeners.has(slotName)) {
|
|
481
|
+
this._slotChangeListeners.set(slotName, this._onSlotChange.bind(this, slotName));
|
|
453
482
|
}
|
|
483
|
+
return this._slotChangeListeners.get(slotName);
|
|
454
484
|
}
|
|
455
485
|
|
|
456
486
|
/**
|
|
457
487
|
* @private
|
|
458
488
|
*/
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
const parentNode = this.parentNode;
|
|
462
|
-
if (!parentNode) {
|
|
463
|
-
return;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
const slotName = parentNode.constructor._getSlotName(this);
|
|
467
|
-
const propsMetadata = parentNode._monitoredChildProps.get(slotName);
|
|
468
|
-
|
|
469
|
-
if (!propsMetadata) {
|
|
470
|
-
return;
|
|
471
|
-
}
|
|
472
|
-
const { observedProps, notObservedProps } = propsMetadata;
|
|
473
|
-
|
|
474
|
-
const allPropertiesAreObserved = observedProps.length === 1 && observedProps[0] === "*";
|
|
475
|
-
const shouldObserve = allPropertiesAreObserved || observedProps.includes(prop.detail.name);
|
|
476
|
-
const shouldSkip = notObservedProps.includes(prop.detail.name);
|
|
477
|
-
if (shouldObserve && !shouldSkip) {
|
|
478
|
-
parentNode._invalidate("_parent_", this);
|
|
479
|
-
}
|
|
489
|
+
_attachSlotChange(child, slotName) {
|
|
490
|
+
child.addEventListener("slotchange", this._getSlotChangeListener(slotName));
|
|
480
491
|
}
|
|
481
492
|
|
|
482
493
|
/**
|
|
483
494
|
* @private
|
|
484
495
|
*/
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
this._invalidateOnSlotChange = () => {
|
|
488
|
-
this._invalidate("slotchange");
|
|
489
|
-
};
|
|
490
|
-
}
|
|
491
|
-
child.addEventListener("slotchange", this._invalidateOnSlotChange);
|
|
496
|
+
_detachSlotChange(child, slotName) {
|
|
497
|
+
child.removeEventListener("slotchange", this._getSlotChangeListener(slotName));
|
|
492
498
|
}
|
|
493
499
|
|
|
494
500
|
/**
|
|
501
|
+
* Whenever a slot element is slotted inside a UI5 Web Component, its slotchange event invalidates the component
|
|
502
|
+
*
|
|
503
|
+
* @param slotName the name of the slot, where the slot element (whose slotchange event we're listening to) is
|
|
495
504
|
* @private
|
|
496
505
|
*/
|
|
497
|
-
|
|
498
|
-
|
|
506
|
+
_onSlotChange(slotName) {
|
|
507
|
+
_invalidate.call(this, {
|
|
508
|
+
type: "slot",
|
|
509
|
+
name: slotName,
|
|
510
|
+
reason: "slotchange",
|
|
511
|
+
});
|
|
499
512
|
}
|
|
500
513
|
|
|
501
514
|
/**
|
|
502
|
-
*
|
|
503
|
-
*
|
|
515
|
+
* A callback that is executed each time an already rendered component is invalidated (scheduled for re-rendering)
|
|
516
|
+
*
|
|
517
|
+
* @param changeInfo An object with information about the change that caused invalidation.
|
|
518
|
+
* The object can have the following properties:
|
|
519
|
+
* - type: (property|slot) tells what caused the invalidation
|
|
520
|
+
* 1) property: a property value was changed either directly or as a result of changing the corresponding attribute
|
|
521
|
+
* 2) slot: a slotted node(nodes) changed in one of several ways (see "reason")
|
|
522
|
+
*
|
|
523
|
+
* - name: the name of the property or slot that caused the invalidation
|
|
524
|
+
*
|
|
525
|
+
* - reason: (children|textcontent|childchange|slotchange) relevant only for type="slot" only and tells exactly what changed in the slot
|
|
526
|
+
* 1) children: immediate children (HTML elements or text nodes) were added, removed or reordered in the slot
|
|
527
|
+
* 2) textcontent: text nodes in the slot changed value (or nested text nodes were added or changed value). Can only trigger for slots of "type: Node"
|
|
528
|
+
* 3) slotchange: a slot element, slotted inside that slot had its "slotchange" event listener called. This practically means that transitively slotted children changed.
|
|
529
|
+
* Can only trigger if the child of a slot is a slot element itself.
|
|
530
|
+
* 4) childchange: indicates that a UI5Element child in that slot was invalidated and in turn invalidated the component.
|
|
531
|
+
* Can only trigger for slots with "invalidateOnChildChange" metadata descriptor
|
|
532
|
+
*
|
|
533
|
+
* - newValue: the new value of the property (for type="property" only)
|
|
534
|
+
*
|
|
535
|
+
* - oldValue: the old value of the property (for type="property" only)
|
|
536
|
+
*
|
|
537
|
+
* - child the child that was changed (for type="slot" and reason="childchange" only)
|
|
538
|
+
*
|
|
539
|
+
* @public
|
|
504
540
|
*/
|
|
505
|
-
|
|
506
|
-
if (this._shouldInvalidateParent) {
|
|
507
|
-
this.parentNode._invalidate();
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
if (!this._upToDate) {
|
|
511
|
-
// console.log("already invalidated", this, ...arguments);
|
|
512
|
-
return;
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
if (this.getDomRef() && !this._suppressInvalidation) {
|
|
516
|
-
this._upToDate = false;
|
|
517
|
-
// console.log("INVAL", this, ...arguments);
|
|
518
|
-
RenderScheduler.renderDeferred(this);
|
|
519
|
-
}
|
|
520
|
-
}
|
|
541
|
+
onInvalidation(changeInfo) {}
|
|
521
542
|
|
|
522
543
|
/**
|
|
523
|
-
* Do not call this method directly, only intended to be called by
|
|
544
|
+
* Do not call this method directly, only intended to be called by js
|
|
524
545
|
* @protected
|
|
525
546
|
*/
|
|
526
547
|
_render() {
|
|
@@ -539,16 +560,37 @@ class UI5Element extends HTMLElement {
|
|
|
539
560
|
}
|
|
540
561
|
|
|
541
562
|
// resume normal invalidation handling
|
|
542
|
-
|
|
563
|
+
this._suppressInvalidation = false;
|
|
543
564
|
|
|
544
565
|
// Update the shadow root with the render result
|
|
545
|
-
|
|
546
|
-
this.
|
|
547
|
-
|
|
566
|
+
/*
|
|
567
|
+
if (this._changedState.length) {
|
|
568
|
+
let element = this.localName;
|
|
569
|
+
if (this.id) {
|
|
570
|
+
element = `${element}#${this.id}`;
|
|
571
|
+
}
|
|
572
|
+
console.log("Re-rendering:", element, this._changedState.map(x => { // eslint-disable-line
|
|
573
|
+
let res = `${x.type}`;
|
|
574
|
+
if (x.reason) {
|
|
575
|
+
res = `${res}(${x.reason})`;
|
|
576
|
+
}
|
|
577
|
+
res = `${res}: ${x.name}`;
|
|
578
|
+
if (x.type === "property") {
|
|
579
|
+
res = `${res} ${x.oldValue} => ${x.newValue}`;
|
|
580
|
+
}
|
|
548
581
|
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
582
|
+
return res;
|
|
583
|
+
}));
|
|
584
|
+
}
|
|
585
|
+
*/
|
|
586
|
+
this._changedState = [];
|
|
587
|
+
|
|
588
|
+
// Update shadow root and static area item
|
|
589
|
+
if (this.constructor._needsShadowDOM()) {
|
|
590
|
+
updateShadowRoot(this);
|
|
591
|
+
}
|
|
592
|
+
if (this.staticAreaItem) {
|
|
593
|
+
this.staticAreaItem.update();
|
|
552
594
|
}
|
|
553
595
|
|
|
554
596
|
// Safari requires that children get the slot attribute only after the slot tags have been rendered in the shadow DOM
|
|
@@ -562,35 +604,6 @@ class UI5Element extends HTMLElement {
|
|
|
562
604
|
}
|
|
563
605
|
}
|
|
564
606
|
|
|
565
|
-
/**
|
|
566
|
-
* @private
|
|
567
|
-
*/
|
|
568
|
-
_updateShadowRoot() {
|
|
569
|
-
if (!this.constructor._needsShadowDOM()) {
|
|
570
|
-
return;
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
let styleToPrepend;
|
|
574
|
-
const renderResult = executeTemplate(this.constructor.template, this);
|
|
575
|
-
|
|
576
|
-
// IE11, Edge
|
|
577
|
-
if (window.ShadyDOM) {
|
|
578
|
-
createComponentStyleTag(this.constructor);
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
// Chrome
|
|
582
|
-
if (document.adoptedStyleSheets) {
|
|
583
|
-
this.shadowRoot.adoptedStyleSheets = getConstructableStyle(this.constructor);
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
// FF, Safari
|
|
587
|
-
if (!document.adoptedStyleSheets && !window.ShadyDOM) {
|
|
588
|
-
styleToPrepend = getEffectiveStyle(this.constructor);
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
this.constructor.render(renderResult, this.shadowRoot, styleToPrepend, { eventContext: this });
|
|
592
|
-
}
|
|
593
|
-
|
|
594
607
|
/**
|
|
595
608
|
* @private
|
|
596
609
|
*/
|
|
@@ -613,16 +626,27 @@ class UI5Element extends HTMLElement {
|
|
|
613
626
|
|
|
614
627
|
/**
|
|
615
628
|
* Returns the DOM Element inside the Shadow Root that corresponds to the opening tag in the UI5 Web Component's template
|
|
629
|
+
* *Note:* For logical (abstract) elements (items, options, etc...), returns the part of the parent's DOM that represents this option
|
|
616
630
|
* Use this method instead of "this.shadowRoot" to read the Shadow DOM, if ever necessary
|
|
631
|
+
*
|
|
617
632
|
* @public
|
|
618
633
|
*/
|
|
619
634
|
getDomRef() {
|
|
635
|
+
// If a component set _getRealDomRef to its children, use the return value of this function
|
|
636
|
+
if (typeof this._getRealDomRef === "function") {
|
|
637
|
+
return this._getRealDomRef();
|
|
638
|
+
}
|
|
639
|
+
|
|
620
640
|
if (!this.shadowRoot || this.shadowRoot.children.length === 0) {
|
|
621
641
|
return;
|
|
622
642
|
}
|
|
623
643
|
|
|
624
|
-
|
|
625
|
-
|
|
644
|
+
const children = [...this.shadowRoot.children].filter(child => !["link", "style"].includes(child.localName));
|
|
645
|
+
if (children.length !== 1) {
|
|
646
|
+
console.warn(`The shadow DOM for ${this.constructor.getMetadata().getTag()} does not have a top level element, the getDomRef() method might not work as expected`); // eslint-disable-line
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
return children[0];
|
|
626
650
|
}
|
|
627
651
|
|
|
628
652
|
/**
|
|
@@ -648,19 +672,6 @@ class UI5Element extends HTMLElement {
|
|
|
648
672
|
return this.getFocusDomRef();
|
|
649
673
|
}
|
|
650
674
|
|
|
651
|
-
/**
|
|
652
|
-
* Use this method in order to get a reference to an element in the shadow root of the web component or the static area item of the component
|
|
653
|
-
* @public
|
|
654
|
-
* @method
|
|
655
|
-
* @param {String} refName Defines the name of the stable DOM ref
|
|
656
|
-
*/
|
|
657
|
-
getStableDomRef(refName) {
|
|
658
|
-
const staticAreaResult = this.staticAreaItemDomRef && this.staticAreaItemDomRef.querySelector(`[data-ui5-stable=${refName}]`);
|
|
659
|
-
|
|
660
|
-
return staticAreaResult
|
|
661
|
-
|| this.getDomRef().querySelector(`[data-ui5-stable=${refName}]`);
|
|
662
|
-
}
|
|
663
|
-
|
|
664
675
|
/**
|
|
665
676
|
* Set the focus to the element, returned by "getFocusDomRef()" (marked by "data-sap-focus-ref")
|
|
666
677
|
* @public
|
|
@@ -696,8 +707,6 @@ class UI5Element extends HTMLElement {
|
|
|
696
707
|
}
|
|
697
708
|
|
|
698
709
|
_fireEvent(name, data, cancelable = false, bubbles = true) {
|
|
699
|
-
let compatEventResult = true; // Initialized to true, because if the event is not fired at all, it should be considered "not-prevented"
|
|
700
|
-
|
|
701
710
|
const noConflictEvent = new CustomEvent(`ui5-${name}`, {
|
|
702
711
|
detail: data,
|
|
703
712
|
composed: false,
|
|
@@ -705,14 +714,14 @@ class UI5Element extends HTMLElement {
|
|
|
705
714
|
cancelable,
|
|
706
715
|
});
|
|
707
716
|
|
|
708
|
-
// This will be false if the
|
|
709
|
-
|
|
717
|
+
// This will be false if the no-conflict event is prevented
|
|
718
|
+
const noConflictEventResult = this.dispatchEvent(noConflictEvent);
|
|
710
719
|
|
|
711
720
|
if (skipOriginalEvent(name)) {
|
|
712
|
-
return
|
|
721
|
+
return noConflictEventResult;
|
|
713
722
|
}
|
|
714
723
|
|
|
715
|
-
const
|
|
724
|
+
const normalEvent = new CustomEvent(name, {
|
|
716
725
|
detail: data,
|
|
717
726
|
composed: false,
|
|
718
727
|
bubbles,
|
|
@@ -720,10 +729,10 @@ class UI5Element extends HTMLElement {
|
|
|
720
729
|
});
|
|
721
730
|
|
|
722
731
|
// This will be false if the normal event is prevented
|
|
723
|
-
const normalEventResult = this.dispatchEvent(
|
|
732
|
+
const normalEventResult = this.dispatchEvent(normalEvent);
|
|
724
733
|
|
|
725
734
|
// Return false if any of the two events was prevented (its result was false).
|
|
726
|
-
return normalEventResult &&
|
|
735
|
+
return normalEventResult && noConflictEventResult;
|
|
727
736
|
}
|
|
728
737
|
|
|
729
738
|
/**
|
|
@@ -732,18 +741,7 @@ class UI5Element extends HTMLElement {
|
|
|
732
741
|
* @public
|
|
733
742
|
*/
|
|
734
743
|
getSlottedNodes(slotName) {
|
|
735
|
-
|
|
736
|
-
if (!isSlot(curr)) {
|
|
737
|
-
return acc.concat([curr]);
|
|
738
|
-
}
|
|
739
|
-
return acc.concat(curr.assignedNodes({ flatten: true }).filter(item => item instanceof HTMLElement));
|
|
740
|
-
};
|
|
741
|
-
|
|
742
|
-
return this[slotName].reduce(reducer, []);
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
get isCompact() {
|
|
746
|
-
return getComputedStyle(this).getPropertyValue(GLOBAL_CONTENT_DENSITY_CSS_VAR) === "compact";
|
|
744
|
+
return getSlottedElementsList(this[slotName]);
|
|
747
745
|
}
|
|
748
746
|
|
|
749
747
|
/**
|
|
@@ -755,33 +753,7 @@ class UI5Element extends HTMLElement {
|
|
|
755
753
|
*/
|
|
756
754
|
get effectiveDir() {
|
|
757
755
|
markAsRtlAware(this.constructor); // if a UI5 Element calls this method, it's considered to be rtl-aware
|
|
758
|
-
|
|
759
|
-
const doc = window.document;
|
|
760
|
-
const dirValues = ["ltr", "rtl"]; // exclude "auto" and "" from all calculations
|
|
761
|
-
const locallyAppliedDir = getComputedStyle(this).getPropertyValue(GLOBAL_DIR_CSS_VAR);
|
|
762
|
-
|
|
763
|
-
// In that order, inspect the CSS Var (for modern browsers), the element itself, html and body (for IE fallback)
|
|
764
|
-
if (dirValues.includes(locallyAppliedDir)) {
|
|
765
|
-
return locallyAppliedDir;
|
|
766
|
-
}
|
|
767
|
-
if (dirValues.includes(this.dir)) {
|
|
768
|
-
return this.dir;
|
|
769
|
-
}
|
|
770
|
-
if (dirValues.includes(doc.documentElement.dir)) {
|
|
771
|
-
return doc.documentElement.dir;
|
|
772
|
-
}
|
|
773
|
-
if (dirValues.includes(doc.body.dir)) {
|
|
774
|
-
return doc.body.dir;
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
// Finally, check the configuration for explicitly set RTL or language-implied RTL
|
|
778
|
-
return getRTL() ? "rtl" : undefined;
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
updateStaticAreaItemContentDensity() {
|
|
782
|
-
if (this.staticAreaItem) {
|
|
783
|
-
this.staticAreaItem._updateContentDensity(this.isCompact);
|
|
784
|
-
}
|
|
756
|
+
return getEffectiveDir(this);
|
|
785
757
|
}
|
|
786
758
|
|
|
787
759
|
/**
|
|
@@ -801,26 +773,6 @@ class UI5Element extends HTMLElement {
|
|
|
801
773
|
return this.getMetadata().getAttributesList();
|
|
802
774
|
}
|
|
803
775
|
|
|
804
|
-
/**
|
|
805
|
-
* @private
|
|
806
|
-
*/
|
|
807
|
-
static _getSlotName(child) {
|
|
808
|
-
// Text nodes can only go to the default slot
|
|
809
|
-
if (!(child instanceof HTMLElement)) {
|
|
810
|
-
return "default";
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
// Discover the slot based on the real slot name (f.e. footer => footer, or content-32 => content)
|
|
814
|
-
const slot = child.getAttribute("slot");
|
|
815
|
-
if (slot) {
|
|
816
|
-
const match = slot.match(/^(.+?)-\d+$/);
|
|
817
|
-
return match ? match[1] : slot;
|
|
818
|
-
}
|
|
819
|
-
|
|
820
|
-
// Use default slot as a fallback
|
|
821
|
-
return "default";
|
|
822
|
-
}
|
|
823
|
-
|
|
824
776
|
/**
|
|
825
777
|
* @private
|
|
826
778
|
*/
|
|
@@ -828,70 +780,30 @@ class UI5Element extends HTMLElement {
|
|
|
828
780
|
return !!this.template;
|
|
829
781
|
}
|
|
830
782
|
|
|
831
|
-
_shouldUpdateFragment() {
|
|
832
|
-
return this.constructor._needsStaticArea() && this.staticAreaItem.isRendered();
|
|
833
|
-
}
|
|
834
|
-
|
|
835
783
|
/**
|
|
836
784
|
* @private
|
|
837
785
|
*/
|
|
838
786
|
static _needsStaticArea() {
|
|
839
|
-
return
|
|
787
|
+
return !!this.staticAreaTemplate;
|
|
840
788
|
}
|
|
841
789
|
|
|
842
790
|
/**
|
|
843
791
|
* @public
|
|
844
792
|
*/
|
|
845
793
|
getStaticAreaItemDomRef() {
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
/**
|
|
850
|
-
* @private
|
|
851
|
-
*/
|
|
852
|
-
static _getDefaultState() {
|
|
853
|
-
if (this._defaultState) {
|
|
854
|
-
return this._defaultState;
|
|
794
|
+
if (!this.constructor._needsStaticArea()) {
|
|
795
|
+
throw new Error("This component does not use the static area");
|
|
855
796
|
}
|
|
856
797
|
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
// Initialize properties
|
|
862
|
-
const props = MetadataClass.getProperties();
|
|
863
|
-
for (const propName in props) { // eslint-disable-line
|
|
864
|
-
const propType = props[propName].type;
|
|
865
|
-
const propDefaultValue = props[propName].defaultValue;
|
|
866
|
-
|
|
867
|
-
if (propType === Boolean) {
|
|
868
|
-
defaultState[propName] = false;
|
|
869
|
-
|
|
870
|
-
if (propDefaultValue !== undefined) {
|
|
871
|
-
console.warn("The 'defaultValue' metadata key is ignored for all booleans properties, they would be initialized with 'false' by default"); // eslint-disable-line
|
|
872
|
-
}
|
|
873
|
-
} else if (props[propName].multiple) {
|
|
874
|
-
defaultState[propName] = [];
|
|
875
|
-
} else if (propType === Object) {
|
|
876
|
-
defaultState[propName] = "defaultValue" in props[propName] ? props[propName].defaultValue : {};
|
|
877
|
-
} else if (propType === String) {
|
|
878
|
-
defaultState[propName] = "defaultValue" in props[propName] ? props[propName].defaultValue : "";
|
|
879
|
-
} else {
|
|
880
|
-
defaultState[propName] = propDefaultValue;
|
|
881
|
-
}
|
|
798
|
+
if (!this.staticAreaItem) {
|
|
799
|
+
this.staticAreaItem = StaticAreaItem.createInstance();
|
|
800
|
+
this.staticAreaItem.setOwnerElement(this);
|
|
882
801
|
}
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
if (slotsAreManaged) {
|
|
886
|
-
const slots = MetadataClass.getSlots();
|
|
887
|
-
for (const [slotName, slotData] of Object.entries(slots)) { // eslint-disable-line
|
|
888
|
-
const propertyName = slotData.propertyName || slotName;
|
|
889
|
-
defaultState[propertyName] = [];
|
|
890
|
-
}
|
|
802
|
+
if (!this.staticAreaItem.parentElement) {
|
|
803
|
+
getSingletonElementInstance("ui5-static-area").appendChild(this.staticAreaItem);
|
|
891
804
|
}
|
|
892
805
|
|
|
893
|
-
this.
|
|
894
|
-
return defaultState;
|
|
806
|
+
return this.staticAreaItem.getDomRef();
|
|
895
807
|
}
|
|
896
808
|
|
|
897
809
|
/**
|
|
@@ -943,14 +855,27 @@ class UI5Element extends HTMLElement {
|
|
|
943
855
|
}
|
|
944
856
|
},
|
|
945
857
|
set(value) {
|
|
858
|
+
let isDifferent;
|
|
946
859
|
value = this.constructor.getMetadata().constructor.validatePropertyValue(value, propData);
|
|
947
860
|
|
|
948
861
|
const oldState = this._state[prop];
|
|
862
|
+
if (propData.multiple && propData.compareValues) {
|
|
863
|
+
isDifferent = !arraysAreEqual(oldState, value);
|
|
864
|
+
} else if (isDescendantOf(propData.type, DataType)) {
|
|
865
|
+
isDifferent = !propData.type.valuesAreEqual(oldState, value);
|
|
866
|
+
} else {
|
|
867
|
+
isDifferent = oldState !== value;
|
|
868
|
+
}
|
|
949
869
|
|
|
950
|
-
if (
|
|
870
|
+
if (isDifferent) {
|
|
951
871
|
this._state[prop] = value;
|
|
952
|
-
|
|
953
|
-
|
|
872
|
+
_invalidate.call(this, {
|
|
873
|
+
type: "property",
|
|
874
|
+
name: prop,
|
|
875
|
+
newValue: value,
|
|
876
|
+
oldValue: oldState,
|
|
877
|
+
});
|
|
878
|
+
this._updateAttribute(prop, value);
|
|
954
879
|
}
|
|
955
880
|
},
|
|
956
881
|
});
|
|
@@ -973,7 +898,7 @@ class UI5Element extends HTMLElement {
|
|
|
973
898
|
return [];
|
|
974
899
|
},
|
|
975
900
|
set() {
|
|
976
|
-
throw new Error("Cannot set
|
|
901
|
+
throw new Error("Cannot set slot content directly, use the DOM APIs (appendChild, removeChild, etc...)");
|
|
977
902
|
},
|
|
978
903
|
});
|
|
979
904
|
}
|
|
@@ -988,6 +913,14 @@ class UI5Element extends HTMLElement {
|
|
|
988
913
|
return metadata;
|
|
989
914
|
}
|
|
990
915
|
|
|
916
|
+
/**
|
|
917
|
+
* Sets a new metadata object for this UI5 Web Component Class
|
|
918
|
+
* @protected
|
|
919
|
+
*/
|
|
920
|
+
static set metadata(newMetadata) {
|
|
921
|
+
metadata = newMetadata;
|
|
922
|
+
}
|
|
923
|
+
|
|
991
924
|
/**
|
|
992
925
|
* Returns the CSS for this UI5 Web Component Class
|
|
993
926
|
* @protected
|
|
@@ -1073,11 +1006,13 @@ class UI5Element extends HTMLElement {
|
|
|
1073
1006
|
this._generateAccessors();
|
|
1074
1007
|
registerTag(tag);
|
|
1075
1008
|
window.customElements.define(tag, this);
|
|
1009
|
+
preloadLinks(this);
|
|
1076
1010
|
|
|
1077
1011
|
if (altTag && !customElements.get(altTag)) {
|
|
1078
|
-
class oldClassName extends this {}
|
|
1079
1012
|
registerTag(altTag);
|
|
1080
|
-
window.customElements.define(altTag,
|
|
1013
|
+
window.customElements.define(altTag, getClassCopy(this, () => {
|
|
1014
|
+
console.log(`The ${altTag} tag is deprecated and will be removed in the next release, please use ${tag} instead.`); // eslint-disable-line
|
|
1015
|
+
}));
|
|
1081
1016
|
}
|
|
1082
1017
|
}
|
|
1083
1018
|
return this;
|