@ui5/webcomponents-base 2.0.0-rc.3 → 2.0.0-rc.4
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/CHANGELOG.md +24 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/Boot.js +1 -1
- package/dist/Boot.js.map +1 -1
- package/dist/Keys.d.ts +2 -1
- package/dist/Keys.js +2 -1
- package/dist/Keys.js.map +1 -1
- package/dist/UI5Element.d.ts +9 -1
- package/dist/UI5Element.js +73 -12
- package/dist/UI5Element.js.map +1 -1
- package/dist/UI5ElementMetadata.d.ts +5 -0
- package/dist/UI5ElementMetadata.js +6 -0
- package/dist/UI5ElementMetadata.js.map +1 -1
- package/dist/config/AnimationMode.js +2 -1
- package/dist/config/AnimationMode.js.map +1 -1
- package/dist/custom-elements-internal.json +6 -15
- package/dist/custom-elements.json +6 -15
- package/dist/decorators/customElement.d.ts +1 -0
- package/dist/decorators/customElement.js +5 -2
- package/dist/decorators/customElement.js.map +1 -1
- package/dist/features/InputElementsFormSupport.d.ts +18 -0
- package/dist/features/InputElementsFormSupport.js +40 -0
- package/dist/features/InputElementsFormSupport.js.map +1 -0
- package/dist/generated/VersionInfo.js +3 -3
- package/dist/generated/VersionInfo.js.map +1 -1
- package/dist/prod/AssetRegistry.js +2 -0
- package/dist/prod/AssetRegistry.js.map +7 -0
- package/dist/prod/Boot.js +2 -0
- package/dist/prod/Boot.js.map +7 -0
- package/dist/prod/CustomElementsRegistry.js +10 -0
- package/dist/prod/CustomElementsRegistry.js.map +7 -0
- package/dist/prod/CustomElementsScope.js +2 -0
- package/dist/prod/CustomElementsScope.js.map +7 -0
- package/dist/prod/CustomElementsScopeUtils.js +2 -0
- package/dist/prod/CustomElementsScopeUtils.js.map +7 -0
- package/dist/prod/DOMObserver.js +2 -0
- package/dist/prod/DOMObserver.js.map +7 -0
- package/dist/prod/Device.js +2 -0
- package/dist/prod/Device.js.map +7 -0
- package/dist/prod/EventProvider.js +2 -0
- package/dist/prod/EventProvider.js.map +7 -0
- package/dist/prod/FeaturesRegistry.js +2 -0
- package/dist/prod/FeaturesRegistry.js.map +7 -0
- package/dist/prod/FontFace.js +2 -0
- package/dist/prod/FontFace.js.map +7 -0
- package/dist/prod/IgnoreCustomElements.js +2 -0
- package/dist/prod/IgnoreCustomElements.js.map +7 -0
- package/dist/prod/InitialConfiguration.js +2 -0
- package/dist/prod/InitialConfiguration.js.map +7 -0
- package/dist/prod/Keys.js +2 -0
- package/dist/prod/Keys.js.map +7 -0
- package/dist/prod/ManagedStyles.js +2 -0
- package/dist/prod/ManagedStyles.js.map +7 -0
- package/dist/prod/MarkedEvents.js +2 -0
- package/dist/prod/MarkedEvents.js.map +7 -0
- package/dist/prod/MediaRange.js +2 -0
- package/dist/prod/MediaRange.js.map +7 -0
- package/dist/prod/PropertiesFileFormat.js +3 -0
- package/dist/prod/PropertiesFileFormat.js.map +7 -0
- package/dist/prod/Render.js +2 -0
- package/dist/prod/Render.js.map +7 -0
- package/dist/prod/RenderQueue.js +2 -0
- package/dist/prod/RenderQueue.js.map +7 -0
- package/dist/prod/Runtimes.js +2 -0
- package/dist/prod/Runtimes.js.map +7 -0
- package/dist/prod/SystemCSSVars.js +2 -0
- package/dist/prod/SystemCSSVars.js.map +7 -0
- package/dist/prod/Theming.js +2 -0
- package/dist/prod/Theming.js.map +7 -0
- package/dist/prod/UI5Element.js +2 -0
- package/dist/prod/UI5Element.js.map +7 -0
- package/dist/prod/UI5ElementMetadata.js +2 -0
- package/dist/prod/UI5ElementMetadata.js.map +7 -0
- package/dist/prod/animations/AnimationQueue.js +2 -0
- package/dist/prod/animations/AnimationQueue.js.map +7 -0
- package/dist/prod/animations/animate.js +2 -0
- package/dist/prod/animations/animate.js.map +7 -0
- package/dist/prod/animations/scroll.js +2 -0
- package/dist/prod/animations/scroll.js.map +7 -0
- package/dist/prod/animations/slideDown.js +2 -0
- package/dist/prod/animations/slideDown.js.map +7 -0
- package/dist/prod/animations/slideUp.js +2 -0
- package/dist/prod/animations/slideUp.js.map +7 -0
- package/dist/prod/asset-registries/Icons.js +2 -0
- package/dist/prod/asset-registries/Icons.js.map +7 -0
- package/dist/prod/asset-registries/Illustrations.js +2 -0
- package/dist/prod/asset-registries/Illustrations.js.map +7 -0
- package/dist/prod/asset-registries/LocaleData.js +2 -0
- package/dist/prod/asset-registries/LocaleData.js.map +7 -0
- package/dist/prod/asset-registries/Themes.js +2 -0
- package/dist/prod/asset-registries/Themes.js.map +7 -0
- package/dist/prod/asset-registries/i18n.js +2 -0
- package/dist/prod/asset-registries/i18n.js.map +7 -0
- package/dist/prod/asset-registries/util/IconCollectionsAlias.js +2 -0
- package/dist/prod/asset-registries/util/IconCollectionsAlias.js.map +7 -0
- package/dist/prod/asset-registries/util/IconCollectionsByTheme.js +2 -0
- package/dist/prod/asset-registries/util/IconCollectionsByTheme.js.map +7 -0
- package/dist/prod/asset-registries/util/getIconCollectionByTheme.js +2 -0
- package/dist/prod/asset-registries/util/getIconCollectionByTheme.js.map +7 -0
- package/dist/prod/config/AnimationMode.js +2 -0
- package/dist/prod/config/AnimationMode.js.map +7 -0
- package/dist/prod/config/CalendarType.js +2 -0
- package/dist/prod/config/CalendarType.js.map +7 -0
- package/dist/prod/config/FormatSettings.js +2 -0
- package/dist/prod/config/FormatSettings.js.map +7 -0
- package/dist/prod/config/Icons.js +2 -0
- package/dist/prod/config/Icons.js.map +7 -0
- package/dist/prod/config/Language.js +2 -0
- package/dist/prod/config/Language.js.map +7 -0
- package/dist/prod/config/NoConflict.js +2 -0
- package/dist/prod/config/NoConflict.js.map +7 -0
- package/dist/prod/config/Theme.js +2 -0
- package/dist/prod/config/Theme.js.map +7 -0
- package/dist/prod/config/ThemeRoot.js +2 -0
- package/dist/prod/config/ThemeRoot.js.map +7 -0
- package/dist/prod/config/Timezone.js +2 -0
- package/dist/prod/config/Timezone.js.map +7 -0
- package/dist/prod/connectToComponent.js +2 -0
- package/dist/prod/connectToComponent.js.map +7 -0
- package/dist/prod/decorators/customElement.js +2 -0
- package/dist/prod/decorators/customElement.js.map +7 -0
- package/dist/prod/decorators/event.js +2 -0
- package/dist/prod/decorators/event.js.map +7 -0
- package/dist/prod/decorators/property.js +2 -0
- package/dist/prod/decorators/property.js.map +7 -0
- package/dist/prod/decorators/slot.js +2 -0
- package/dist/prod/decorators/slot.js.map +7 -0
- package/dist/prod/decorators.js +2 -0
- package/dist/prod/decorators.js.map +7 -0
- package/dist/prod/delegate/ItemNavigation.js +2 -0
- package/dist/prod/delegate/ItemNavigation.js.map +7 -0
- package/dist/prod/delegate/ResizeHandler.js +2 -0
- package/dist/prod/delegate/ResizeHandler.js.map +7 -0
- package/dist/prod/delegate/ScrollEnablement.js +2 -0
- package/dist/prod/delegate/ScrollEnablement.js.map +7 -0
- package/dist/prod/features/F6Navigation.js +2 -0
- package/dist/prod/features/F6Navigation.js.map +7 -0
- package/dist/prod/features/InputElementsFormSupport.js +2 -0
- package/dist/prod/features/InputElementsFormSupport.js.map +7 -0
- package/dist/prod/features/LegacyDateFormats.js +2 -0
- package/dist/prod/features/LegacyDateFormats.js.map +7 -0
- package/dist/prod/features/OpenUI5Element.js +2 -0
- package/dist/prod/features/OpenUI5Element.js.map +7 -0
- package/dist/prod/features/OpenUI5Enablement.js +21 -0
- package/dist/prod/features/OpenUI5Enablement.js.map +7 -0
- package/dist/prod/features/OpenUI5Support.js +2 -0
- package/dist/prod/features/OpenUI5Support.js.map +7 -0
- package/dist/prod/features/patchPatcher.js +2 -0
- package/dist/prod/features/patchPatcher.js.map +7 -0
- package/dist/prod/features/patchPopup.js +2 -0
- package/dist/prod/features/patchPopup.js.map +7 -0
- package/dist/prod/generated/AssetParameters.js +2 -0
- package/dist/prod/generated/AssetParameters.js.map +7 -0
- package/dist/prod/generated/VersionInfo.js +2 -0
- package/dist/prod/generated/VersionInfo.js.map +7 -0
- package/dist/prod/generated/css/BusyIndicator.css.js +2 -0
- package/dist/prod/generated/css/BusyIndicator.css.js.map +7 -0
- package/dist/prod/generated/css/FontFace.css.js +2 -0
- package/dist/prod/generated/css/FontFace.css.js.map +7 -0
- package/dist/prod/generated/css/OverrideFontFace.css.js +2 -0
- package/dist/prod/generated/css/OverrideFontFace.css.js.map +7 -0
- package/dist/prod/generated/css/SystemCSSVars.css.js +2 -0
- package/dist/prod/generated/css/SystemCSSVars.css.js.map +7 -0
- package/dist/prod/generated/templates/elements/WithComplexTemplateTemplate.lit.js +2 -0
- package/dist/prod/generated/templates/elements/WithComplexTemplateTemplate.lit.js.map +7 -0
- package/dist/prod/getSharedResource.js +2 -0
- package/dist/prod/getSharedResource.js.map +7 -0
- package/dist/prod/global.d.js +2 -0
- package/dist/prod/global.d.js.map +7 -0
- package/dist/prod/i18nBundle.js +2 -0
- package/dist/prod/i18nBundle.js.map +7 -0
- package/dist/prod/locale/Locale.js +2 -0
- package/dist/prod/locale/Locale.js.map +7 -0
- package/dist/prod/locale/RTLAwareRegistry.js +2 -0
- package/dist/prod/locale/RTLAwareRegistry.js.map +7 -0
- package/dist/prod/locale/applyDirection.js +2 -0
- package/dist/prod/locale/applyDirection.js.map +7 -0
- package/dist/prod/locale/directionChange.js +2 -0
- package/dist/prod/locale/directionChange.js.map +7 -0
- package/dist/prod/locale/getEffectiveDir.js +2 -0
- package/dist/prod/locale/getEffectiveDir.js.map +7 -0
- package/dist/prod/locale/getLocale.js +2 -0
- package/dist/prod/locale/getLocale.js.map +7 -0
- package/dist/prod/locale/languageChange.js +2 -0
- package/dist/prod/locale/languageChange.js.map +7 -0
- package/dist/prod/locale/nextFallbackLocale.js +2 -0
- package/dist/prod/locale/nextFallbackLocale.js.map +7 -0
- package/dist/prod/locale/normalizeLocale.js +2 -0
- package/dist/prod/locale/normalizeLocale.js.map +7 -0
- package/dist/prod/renderer/LitRenderer.js +2 -0
- package/dist/prod/renderer/LitRenderer.js.map +7 -0
- package/dist/prod/renderer/directives/style-map.js +6 -0
- package/dist/prod/renderer/directives/style-map.js.map +7 -0
- package/dist/prod/renderer/executeTemplate.js +2 -0
- package/dist/prod/renderer/executeTemplate.js.map +7 -0
- package/dist/prod/sap/base/Log.js +750 -0
- package/dist/prod/sap/base/assert.js +34 -0
- package/dist/prod/sap/base/config/MemoryConfigurationProvider.js +20 -0
- package/dist/prod/sap/base/security/URLListValidator.js +406 -0
- package/dist/prod/sap/base/security/encodeCSS.js +40 -0
- package/dist/prod/sap/base/security/encodeXML.js +53 -0
- package/dist/prod/sap/base/security/sanitizeHTML.js +38 -0
- package/dist/prod/sap/base/strings/toHex.js +33 -0
- package/dist/prod/sap/base/util/now.js +28 -0
- package/dist/prod/sap/base/util/uid.js +27 -0
- package/dist/prod/sap/ui/thirdparty/caja-html-sanitizer.js +3600 -0
- package/dist/prod/ssr-dom-shim.js +2 -0
- package/dist/prod/ssr-dom-shim.js.map +7 -0
- package/dist/prod/ssr-dom.js +2 -0
- package/dist/prod/ssr-dom.js.map +7 -0
- package/dist/prod/theming/CustomStyle.js +2 -0
- package/dist/prod/theming/CustomStyle.js.map +7 -0
- package/dist/prod/theming/ThemeLoaded.js +2 -0
- package/dist/prod/theming/ThemeLoaded.js.map +7 -0
- package/dist/prod/theming/ThemeRegistered.js +2 -0
- package/dist/prod/theming/ThemeRegistered.js.map +7 -0
- package/dist/prod/theming/applyTheme.js +2 -0
- package/dist/prod/theming/applyTheme.js.map +7 -0
- package/dist/prod/theming/getConstructableStyle.js +2 -0
- package/dist/prod/theming/getConstructableStyle.js.map +7 -0
- package/dist/prod/theming/getEffectiveStyle.js +2 -0
- package/dist/prod/theming/getEffectiveStyle.js.map +7 -0
- package/dist/prod/theming/getStylesString.js +2 -0
- package/dist/prod/theming/getStylesString.js.map +7 -0
- package/dist/prod/theming/getThemeDesignerTheme.js +2 -0
- package/dist/prod/theming/getThemeDesignerTheme.js.map +7 -0
- package/dist/prod/thirdparty/_merge.js +2 -0
- package/dist/prod/thirdparty/_merge.js.map +7 -0
- package/dist/prod/thirdparty/isPlainObject.js +2 -0
- package/dist/prod/thirdparty/isPlainObject.js.map +7 -0
- package/dist/prod/thirdparty/merge.js +2 -0
- package/dist/prod/thirdparty/merge.js.map +7 -0
- package/dist/prod/types/AnimationMode.js +2 -0
- package/dist/prod/types/AnimationMode.js.map +7 -0
- package/dist/prod/types/AriaHasPopup.js +2 -0
- package/dist/prod/types/AriaHasPopup.js.map +7 -0
- package/dist/prod/types/AriaLandmarkRole.js +2 -0
- package/dist/prod/types/AriaLandmarkRole.js.map +7 -0
- package/dist/prod/types/AriaRole.js +2 -0
- package/dist/prod/types/AriaRole.js.map +7 -0
- package/dist/prod/types/CSSColor.js +2 -0
- package/dist/prod/types/CSSColor.js.map +7 -0
- package/dist/prod/types/CSSSize.js +2 -0
- package/dist/prod/types/CSSSize.js.map +7 -0
- package/dist/prod/types/CalendarType.js +2 -0
- package/dist/prod/types/CalendarType.js.map +7 -0
- package/dist/prod/types/DOMReference.js +2 -0
- package/dist/prod/types/DOMReference.js.map +7 -0
- package/dist/prod/types/DataType.js +2 -0
- package/dist/prod/types/DataType.js.map +7 -0
- package/dist/prod/types/Float.js +2 -0
- package/dist/prod/types/Float.js.map +7 -0
- package/dist/prod/types/Integer.js +2 -0
- package/dist/prod/types/Integer.js.map +7 -0
- package/dist/prod/types/InvisibleMessageMode.js +2 -0
- package/dist/prod/types/InvisibleMessageMode.js.map +7 -0
- package/dist/prod/types/ItemNavigationBehavior.js +2 -0
- package/dist/prod/types/ItemNavigationBehavior.js.map +7 -0
- package/dist/prod/types/MovePlacement.js +2 -0
- package/dist/prod/types/MovePlacement.js.map +7 -0
- package/dist/prod/types/NavigationMode.js +2 -0
- package/dist/prod/types/NavigationMode.js.map +7 -0
- package/dist/prod/types/Orientation.js +2 -0
- package/dist/prod/types/Orientation.js.map +7 -0
- package/dist/prod/types/ValueState.js +2 -0
- package/dist/prod/types/ValueState.js.map +7 -0
- package/dist/prod/types.js +2 -0
- package/dist/prod/types.js.map +7 -0
- package/dist/prod/updateShadowRoot.js +2 -0
- package/dist/prod/updateShadowRoot.js.map +7 -0
- package/dist/prod/util/AriaLabelHelper.js +2 -0
- package/dist/prod/util/AriaLabelHelper.js.map +7 -0
- package/dist/prod/util/Caret.js +2 -0
- package/dist/prod/util/Caret.js.map +7 -0
- package/dist/prod/util/ColorConversion.js +2 -0
- package/dist/prod/util/ColorConversion.js.map +7 -0
- package/dist/prod/util/FetchHelper.js +2 -0
- package/dist/prod/util/FetchHelper.js.map +7 -0
- package/dist/prod/util/FocusableElements.js +2 -0
- package/dist/prod/util/FocusableElements.js.map +7 -0
- package/dist/prod/util/HTMLSanitizer.js +2 -0
- package/dist/prod/util/HTMLSanitizer.js.map +7 -0
- package/dist/prod/util/InvisibleMessage.js +2 -0
- package/dist/prod/util/InvisibleMessage.js.map +7 -0
- package/dist/prod/util/PopupUtils.js +2 -0
- package/dist/prod/util/PopupUtils.js.map +7 -0
- package/dist/prod/util/SlotsHelper.js +2 -0
- package/dist/prod/util/SlotsHelper.js.map +7 -0
- package/dist/prod/util/StringHelper.js +2 -0
- package/dist/prod/util/StringHelper.js.map +7 -0
- package/dist/prod/util/TabbableElements.js +2 -0
- package/dist/prod/util/TabbableElements.js.map +7 -0
- package/dist/prod/util/arraysAreEqual.js +2 -0
- package/dist/prod/util/arraysAreEqual.js.map +7 -0
- package/dist/prod/util/clamp.js +2 -0
- package/dist/prod/util/clamp.js.map +7 -0
- package/dist/prod/util/createLinkInHead.js +2 -0
- package/dist/prod/util/createLinkInHead.js.map +7 -0
- package/dist/prod/util/debounce.js +2 -0
- package/dist/prod/util/debounce.js.map +7 -0
- package/dist/prod/util/detectNavigatorLanguage.js +2 -0
- package/dist/prod/util/detectNavigatorLanguage.js.map +7 -0
- package/dist/prod/util/dragAndDrop/DragRegistry.js +2 -0
- package/dist/prod/util/dragAndDrop/DragRegistry.js.map +7 -0
- package/dist/prod/util/dragAndDrop/findClosestPosition.js +2 -0
- package/dist/prod/util/dragAndDrop/findClosestPosition.js.map +7 -0
- package/dist/prod/util/dragAndDrop/longDragOverHandler.js +2 -0
- package/dist/prod/util/dragAndDrop/longDragOverHandler.js.map +7 -0
- package/dist/prod/util/escapeRegex.js +2 -0
- package/dist/prod/util/escapeRegex.js.map +7 -0
- package/dist/prod/util/formatMessage.js +2 -0
- package/dist/prod/util/formatMessage.js.map +7 -0
- package/dist/prod/util/generateHighlightedMarkup.js +2 -0
- package/dist/prod/util/generateHighlightedMarkup.js.map +7 -0
- package/dist/prod/util/getActiveElement.js +2 -0
- package/dist/prod/util/getActiveElement.js.map +7 -0
- package/dist/prod/util/getClassCopy.js +2 -0
- package/dist/prod/util/getClassCopy.js.map +7 -0
- package/dist/prod/util/getDesigntimePropertyAsArray.js +2 -0
- package/dist/prod/util/getDesigntimePropertyAsArray.js.map +7 -0
- package/dist/prod/util/getEffectiveContentDensity.js +2 -0
- package/dist/prod/util/getEffectiveContentDensity.js.map +7 -0
- package/dist/prod/util/getEffectiveScrollbarStyle.js +2 -0
- package/dist/prod/util/getEffectiveScrollbarStyle.js.map +7 -0
- package/dist/prod/util/getFastNavigationGroups.js +2 -0
- package/dist/prod/util/getFastNavigationGroups.js.map +7 -0
- package/dist/prod/util/getFileExtension.js +2 -0
- package/dist/prod/util/getFileExtension.js.map +7 -0
- package/dist/prod/util/getNormalizedTarget.js +2 -0
- package/dist/prod/util/getNormalizedTarget.js.map +7 -0
- package/dist/prod/util/getParentElement.js +2 -0
- package/dist/prod/util/getParentElement.js.map +7 -0
- package/dist/prod/util/getSingletonElementInstance.js +2 -0
- package/dist/prod/util/getSingletonElementInstance.js.map +7 -0
- package/dist/prod/util/isElementClickable.js +2 -0
- package/dist/prod/util/isElementClickable.js.map +7 -0
- package/dist/prod/util/isElementContainingBlock.js +2 -0
- package/dist/prod/util/isElementContainingBlock.js.map +7 -0
- package/dist/prod/util/isElementHidden.js +2 -0
- package/dist/prod/util/isElementHidden.js.map +7 -0
- package/dist/prod/util/isElementInView.js +2 -0
- package/dist/prod/util/isElementInView.js.map +7 -0
- package/dist/prod/util/isElementTabbable.js +2 -0
- package/dist/prod/util/isElementTabbable.js.map +7 -0
- package/dist/prod/util/isValidPropertyName.js +2 -0
- package/dist/prod/util/isValidPropertyName.js.map +7 -0
- package/dist/prod/util/whenDOMReady.js +2 -0
- package/dist/prod/util/whenDOMReady.js.map +7 -0
- package/dist/prod/util/willShowContent.js +2 -0
- package/dist/prod/util/willShowContent.js.map +7 -0
- package/dist/prod/validateThemeRoot.js +2 -0
- package/dist/prod/validateThemeRoot.js.map +7 -0
- package/dist/renderer/executeTemplate.d.ts +8 -0
- package/dist/renderer/executeTemplate.js +1 -0
- package/dist/renderer/executeTemplate.js.map +1 -1
- package/dist/util/InvisibleMessage.js +2 -2
- package/dist/util/InvisibleMessage.js.map +1 -1
- package/dist/util/getClassCopy.d.ts +9 -1
- package/package-scripts.cjs +5 -0
- package/package.json +11 -5
- package/dist/StaticArea.d.ts +0 -3
- package/dist/StaticArea.js +0 -7
- package/dist/StaticArea.js.map +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/asset-registries/Themes.ts"],
|
|
4
|
+
"sourcesContent": ["import { DEFAULT_THEME } from \"../generated/AssetParameters.js\";\nimport type { StyleData, StyleDataCSP } from \"../ManagedStyles.js\";\nimport { mergeStyles } from \"../ManagedStyles.js\";\nimport { fireThemeRegistered } from \"../theming/ThemeRegistered.js\";\n\ntype ThemeData = {_: StyleDataCSP } | StyleDataCSP | string;\ntype ThemeLoader = (themeName: string) => Promise<ThemeData>;\n\nconst themeStyles = new Map<string, StyleData>();\nconst loaders = new Map<string, ThemeLoader>();\nconst customLoaders = new Map<string, ThemeLoader>();\nconst registeredPackages = new Set<string>();\nconst registeredThemes = new Set<string>();\n\nconst registerThemePropertiesLoader = (packageName: string, themeName: string, loader: ThemeLoader) => {\n\tloaders.set(`${packageName}/${themeName}`, loader);\n\tregisteredPackages.add(packageName);\n\tregisteredThemes.add(themeName);\n\tfireThemeRegistered(themeName);\n};\n\nconst registerCustomThemePropertiesLoader = (packageName: string, themeName: string, loader: ThemeLoader) => {\n\tcustomLoaders.set(`${packageName}/${themeName}`, loader);\n};\n\nconst getThemeProperties = async (packageName: string, themeName: string, externalThemeName?: string) => {\n\tconst cacheKey = `${packageName}_${themeName}_${externalThemeName || \"\"}`;\n\tconst cachedStyleData = themeStyles.get(cacheKey);\n\tif (cachedStyleData !== undefined) { // it's valid for style to be an empty string\n\t\treturn cachedStyleData;\n\t}\n\n\tif (!registeredThemes.has(themeName)) {\n\t\tconst regThemesStr = [...registeredThemes.values()].join(\", \");\n\t\tconsole.warn(`You have requested a non-registered theme ${themeName} - falling back to ${DEFAULT_THEME}. Registered themes are: ${regThemesStr}`); /* eslint-disable-line */\n\t\treturn _getThemeProperties(packageName, DEFAULT_THEME);\n\t}\n\n\tconst [style, customStyle] = await Promise.all([\n\t\t_getThemeProperties(packageName, themeName),\n\t\texternalThemeName ? _getThemeProperties(packageName, externalThemeName, true) : undefined,\n\t]);\n\n\tconst styleData = mergeStyles(style, customStyle);\n\tif (styleData) {\n\t\tthemeStyles.set(cacheKey, styleData);\n\t}\n\n\treturn styleData;\n};\n\nconst _getThemeProperties = async (packageName: string, themeName: string, forCustomTheme = false) => {\n\tconst loadersMap = forCustomTheme ? customLoaders : loaders;\n\tconst loader = loadersMap.get(`${packageName}/${themeName}`);\n\tif (!loader) {\n\t\t// no themes for package\n\t\tif (!forCustomTheme) {\n\t\t\tconsole.error(`Theme [${themeName}] not registered for package [${packageName}]`); /* eslint-disable-line */\n\t\t}\n\t\treturn;\n\t}\n\tlet data;\n\ttry {\n\t\tdata = await loader(themeName);\n\t} catch (error: unknown) {\n\t\tconst e = error as Error;\n\t\tconsole.error(packageName, e.message); /* eslint-disable-line */\n\t\treturn;\n\t}\n\n\tconst themeProps = (data as {_: StyleDataCSP})._ || data; // Refactor: remove _ everywhere\n\treturn themeProps;\n};\n\nconst getRegisteredPackages = () => {\n\treturn registeredPackages;\n};\n\nconst isThemeRegistered = (theme: string) => {\n\treturn registeredThemes.has(theme);\n};\n\nexport {\n\tregisterThemePropertiesLoader,\n\tregisterCustomThemePropertiesLoader,\n\tgetThemeProperties,\n\tgetRegisteredPackages,\n\tisThemeRegistered,\n};\n\nexport type {\n\tThemeData,\n\tThemeLoader,\n};\n"],
|
|
5
|
+
"mappings": "aAAA,OAAS,iBAAAA,MAAqB,kCAE9B,OAAS,eAAAC,MAAmB,sBAC5B,OAAS,uBAAAC,MAA2B,gCAKpC,MAAMC,EAAc,IAAI,IAClBC,EAAU,IAAI,IACdC,EAAgB,IAAI,IACpBC,EAAqB,IAAI,IACzBC,EAAmB,IAAI,IAEvBC,EAAgC,CAACC,EAAqBC,EAAmBC,IAAwB,CACtGP,EAAQ,IAAI,GAAGK,CAAW,IAAIC,CAAS,GAAIC,CAAM,EACjDL,EAAmB,IAAIG,CAAW,EAClCF,EAAiB,IAAIG,CAAS,EAC9BR,EAAoBQ,CAAS,CAC9B,EAEME,EAAsC,CAACH,EAAqBC,EAAmBC,IAAwB,CAC5GN,EAAc,IAAI,GAAGI,CAAW,IAAIC,CAAS,GAAIC,CAAM,CACxD,EAEME,EAAqB,MAAOJ,EAAqBC,EAAmBI,IAA+B,CACxG,MAAMC,EAAW,GAAGN,CAAW,IAAIC,CAAS,IAAII,GAAqB,EAAE,GACjEE,EAAkBb,EAAY,IAAIY,CAAQ,EAChD,GAAIC,IAAoB,OACvB,OAAOA,EAGR,GAAI,CAACT,EAAiB,IAAIG,CAAS,EAAG,CACrC,MAAMO,EAAe,CAAC,GAAGV,EAAiB,OAAO,CAAC,EAAE,KAAK,IAAI,EAC7D,eAAQ,KAAK,6CAA6CG,CAAS,sBAAsBV,CAAa,4BAA4BiB,CAAY,EAAE,EACzIC,EAAoBT,EAAaT,CAAa,CACtD,CAEA,KAAM,CAACmB,EAAOC,CAAW,EAAI,MAAM,QAAQ,IAAI,CAC9CF,EAAoBT,EAAaC,CAAS,EAC1CI,EAAoBI,EAAoBT,EAAaK,EAAmB,EAAI,EAAI,MACjF,CAAC,EAEKO,EAAYpB,EAAYkB,EAAOC,CAAW,EAChD,OAAIC,GACHlB,EAAY,IAAIY,EAAUM,CAAS,EAG7BA,CACR,EAEMH,EAAsB,MAAOT,EAAqBC,EAAmBY,EAAiB,KAAU,CAErG,MAAMX,GADaW,EAAiBjB,EAAgBD,GAC1B,IAAI,GAAGK,CAAW,IAAIC,CAAS,EAAE,EAC3D,GAAI,CAACC,EAAQ,CAEPW,GACJ,QAAQ,MAAM,UAAUZ,CAAS,iCAAiCD,CAAW,GAAG,EAEjF,MACD,CACA,IAAIc,EACJ,GAAI,CACHA,EAAO,MAAMZ,EAAOD,CAAS,CAC9B,OAASc,EAAgB,CAExB,QAAQ,MAAMf,EADJe,EACmB,OAAO,EACpC,MACD,CAGA,OADoBD,EAA2B,GAAKA,CAErD,EAEME,EAAwB,IACtBnB,EAGFoB,EAAqBC,GACnBpB,EAAiB,IAAIoB,CAAK,EAGlC,OACCnB,KAAA,8BACAI,KAAA,oCACAC,KAAA,mBACAY,KAAA,sBACAC,KAAA",
|
|
6
|
+
"names": ["DEFAULT_THEME", "mergeStyles", "fireThemeRegistered", "themeStyles", "loaders", "customLoaders", "registeredPackages", "registeredThemes", "registerThemePropertiesLoader", "packageName", "themeName", "loader", "registerCustomThemePropertiesLoader", "getThemeProperties", "externalThemeName", "cacheKey", "cachedStyleData", "regThemesStr", "_getThemeProperties", "style", "customStyle", "styleData", "forCustomTheme", "data", "error", "getRegisteredPackages", "isThemeRegistered", "theme"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";import i from"../locale/getLocale.js";import{attachLanguageChange as b}from"../locale/languageChange.js";import y from"../locale/normalizeLocale.js";import D from"../locale/nextFallbackLocale.js";import{DEFAULT_LANGUAGE as c}from"../generated/AssetParameters.js";import{getFetchDefaultLanguage as p}from"../config/Language.js";const d=new Set,m=new Set,g=new Map,l=new Map,u=new Map,$=(n,t,e)=>{const r=`${n}/${t}`;u.set(r,e)},f=(n,t)=>{g.set(n,t)},A=n=>g.get(n),h=(n,t)=>{const e=`${n}/${t}`;return u.has(e)},B=(n,t)=>{const e=`${n}/${t}`,r=u.get(e);return r&&!l.get(e)&&l.set(e,r(t)),l.get(e)},M=n=>{d.has(n)||(console.warn(`[${n}]: Message bundle assets are not configured. Falling back to English texts.`,` Add \`import "${n}/dist/Assets.js"\` in your bundle and make sure your build tool supports dynamic imports and JSON imports. See section "Assets" in the documentation for more information.`),d.add(n))},L=(n,t)=>t!==c&&!h(n,t),w=async n=>{const t=i().getLanguage(),e=i().getRegion(),r=i().getVariant();let s=t+(e?`-${e}`:"")+(r?`-${r}`:"");if(L(n,s))for(s=y(s);L(n,s);)s=D(s);const I=p();if(s===c&&!I){f(n,null);return}if(!h(n,s)){M(n);return}try{const o=await B(n,s);f(n,o)}catch(o){const a=o;m.has(a.message)||(m.add(a.message),console.error(a.message))}};b(n=>{const t=[...g.keys()];return Promise.all(t.map(w))});export{$ as registerI18nLoader,w as fetchI18nBundle,A as getI18nBundleData};
|
|
2
|
+
//# sourceMappingURL=i18n.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/asset-registries/i18n.ts"],
|
|
4
|
+
"sourcesContent": ["import getLocale from \"../locale/getLocale.js\";\nimport { attachLanguageChange } from \"../locale/languageChange.js\";\nimport normalizeLocale from \"../locale/normalizeLocale.js\";\nimport nextFallbackLocale from \"../locale/nextFallbackLocale.js\";\nimport { DEFAULT_LANGUAGE } from \"../generated/AssetParameters.js\";\nimport { getFetchDefaultLanguage } from \"../config/Language.js\";\n\ntype I18nLoader = (localeId: string) => Promise<I18nData>;\ntype I18nData = Record<string, string>;\n\n// contains package names for which the warning has been shown\nconst warningShown = new Set();\nconst reportedErrors = new Set();\n\nconst bundleData = new Map<string, I18nData | null>();\nconst bundlePromises = new Map<string, Promise<I18nData>>();\nconst loaders = new Map<string, I18nLoader>();\n\n/**\n * Registers i18n loader function for given package and locale.\n *\n * @public\n * @param {string} packageName for which package this loader can fetch data\n * @param {string} localeId locale that this loader can handle\n * @param {function} loader async function that will be passed a localeId and should return a JSON object\n */\nconst registerI18nLoader = (packageName: string, localeId: string, loader: I18nLoader) => {\n\t// register loader by key\n\tconst bundleKey = `${packageName}/${localeId}`;\n\tloaders.set(bundleKey, loader);\n};\n\nconst _setI18nBundleData = (packageName: string, data: I18nData | null) => {\n\tbundleData.set(packageName, data);\n};\n\nconst getI18nBundleData = (packageName: string) => {\n\treturn bundleData.get(packageName);\n};\n\nconst _hasLoader = (packageName: string, localeId: string) => {\n\tconst bundleKey = `${packageName}/${localeId}`;\n\treturn loaders.has(bundleKey);\n};\n\n// load bundle over the network once\nconst _loadMessageBundleOnce = (packageName: string, localeId: string) => {\n\tconst bundleKey = `${packageName}/${localeId}`;\n\tconst loadMessageBundle = loaders.get(bundleKey);\n\n\tif (loadMessageBundle && !bundlePromises.get(bundleKey)) {\n\t\tbundlePromises.set(bundleKey, loadMessageBundle(localeId));\n\t}\n\n\treturn bundlePromises.get(bundleKey)!; // Investigate if i18n loader exists and this won't return undefined.\n};\n\nconst _showAssetsWarningOnce = (packageName: string) => {\n\tif (!warningShown.has(packageName)) {\n\t\tconsole.warn(`[${packageName}]: Message bundle assets are not configured. Falling back to English texts.`, /* eslint-disable-line */\n\t\t\t` Add \\`import \"${packageName}/dist/Assets.js\"\\` in your bundle and make sure your build tool supports dynamic imports and JSON imports. See section \"Assets\" in the documentation for more information.`); /* eslint-disable-line */\n\t\twarningShown.add(packageName);\n\t}\n};\n\nconst useFallbackBundle = (packageName: string, localeId: string) => {\n\treturn localeId !== DEFAULT_LANGUAGE && !_hasLoader(packageName, localeId);\n};\n\n/**\n * This method preforms the asynchronous task of fetching the actual text resources. It will fetch\n * each text resource over the network once (even for multiple calls to the same method).\n * It should be fully finished before the i18nBundle class is created in the webcomponents.\n * This method uses the bundle URLs that are populated by the `registerI18nBundle` method.\n * To simplify the usage, the synchronization of both methods happens internally for the same `bundleId`\n * @param {packageName} packageName the NPM package name\n * @public\n */\nconst fetchI18nBundle = async (packageName: string) => {\n\tconst language = getLocale().getLanguage();\n\tconst region = getLocale().getRegion();\n\tconst variant = getLocale().getVariant();\n\tlet localeId = language + (region ? `-${region}` : ``) + (variant ? `-${variant}` : ``);\n\n\tif (useFallbackBundle(packageName, localeId)) {\n\t\tlocaleId = normalizeLocale(localeId);\n\n\t\twhile (useFallbackBundle(packageName, localeId)) {\n\t\t\tlocaleId = nextFallbackLocale(localeId);\n\t\t}\n\t}\n\n\t// use default language unless configured to always fetch it from the network\n\tconst fetchDefaultLanguage = getFetchDefaultLanguage();\n\tif (localeId === DEFAULT_LANGUAGE && !fetchDefaultLanguage) {\n\t\t_setI18nBundleData(packageName, null); // reset for the default language (if data was set for a previous language)\n\t\treturn;\n\t}\n\n\tif (!_hasLoader(packageName, localeId)) {\n\t\t_showAssetsWarningOnce(packageName);\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst data = await _loadMessageBundleOnce(packageName, localeId);\n\t\t_setI18nBundleData(packageName, data);\n\t} catch (error: unknown) {\n\t\tconst e = error as Error;\n\t\tif (!reportedErrors.has(e.message)) {\n\t\t\treportedErrors.add(e.message);\n\t\t\tconsole.error(e.message); /* eslint-disable-line */\n\t\t}\n\t}\n};\n\n// When the language changes dynamically (the user calls setLanguage), re-fetch all previously fetched bundles\nattachLanguageChange((lang: string /* eslint-disable-line */) => {\n\tconst allPackages = [...bundleData.keys()];\n\treturn Promise.all(allPackages.map(fetchI18nBundle));\n});\n\nexport {\n\tregisterI18nLoader,\n\tfetchI18nBundle,\n\tgetI18nBundleData,\n};\n"],
|
|
5
|
+
"mappings": "aAAA,OAAOA,MAAe,yBACtB,OAAS,wBAAAC,MAA4B,8BACrC,OAAOC,MAAqB,+BAC5B,OAAOC,MAAwB,kCAC/B,OAAS,oBAAAC,MAAwB,kCACjC,OAAS,2BAAAC,MAA+B,wBAMxC,MA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A,EAAWX,EAAgBW,CAAQ,EAE5BU,EAAkBX,EAAaC,CAAQ,GAC7CA,EAAWV,EAAmBU,CAAQ,EAKxC,MAAMe,EAAuBvB,EAAwB,EACrD,GAAIQ,IAAaT,GAAoB,CAACwB,EAAsB,CAC3DZ,EAAmBJ,EAAa,IAAI,EACpC,MACD,CAEA,GAAI,CAACO,EAAWP,EAAaC,CAAQ,EAAG,CACvCS,EAAuBV,CAAW,EAClC,MACD,CAEA,GAAI,CACH,MAAMK,EAAO,MAAMG,EAAuBR,EAAaC,CAAQ,EAC/DG,EAAmBJ,EAAaK,CAAI,CACrC,OAASY,EAAgB,CACxB,MAAMC,EAAID,EACLtB,EAAe,IAAIuB,EAAE,OAAO,IAChCvB,EAAe,IAAIuB,EAAE,OAAO,EAC5B,QAAQ,MAAMA,EAAE,OAAO,EAEzB,CACD,EAGA7B,EAAsB8B,GAA2C,CAChE,MAAMC,EAAc,CAAC,GAAGxB,EAAW,KAAK,CAAC,EACzC,OAAO,QAAQ,IAAIwB,EAAY,IAAIR,CAAe,CAAC,CACpD,CAAC,EAED,OACCb,KAAA,mBACAa,KAAA,gBACAN,KAAA",
|
|
6
|
+
"names": ["getLocale", "attachLanguageChange", "normalizeLocale", "nextFallbackLocale", "DEFAULT_LANGUAGE", "getFetchDefaultLanguage", "warningShown", "reportedErrors", "bundleData", "bundlePromises", "loaders", "registerI18nLoader", "packageName", "localeId", "loader", "bundleKey", "_setI18nBundleData", "data", "getI18nBundleData", "_hasLoader", "_loadMessageBundleOnce", "loadMessageBundle", "_showAssetsWarningOnce", "useFallbackBundle", "fetchI18nBundle", "language", "region", "variant", "fetchDefaultLanguage", "error", "e", "lang", "allPackages"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var t=(s=>(s["SAP-icons"]="SAP-icons-v4",s.horizon="SAP-icons-v5",s["SAP-icons-TNT"]="tnt",s.BusinessSuiteInAppSymbols="business-suite",s))(t||{});const n=e=>t[e]?t[e]:e;export default t;export{n as getIconCollectionByAlias};
|
|
2
|
+
//# sourceMappingURL=IconCollectionsAlias.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/asset-registries/util/IconCollectionsAlias.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Supported icon collection aliases.\n *\n * Users might specify a collection, using both the key and the value in the following key-value pairs,\n * e.g the following pairs are completely exchangeable:\n *\n * - \"SAP-icons/accept\" and \"SAP-icons-v4/accept\"\n * - \"horizon/accept\" and \"SAP-icons-v5/accept\"\n * - \"SAP-icons-TNT/actor\" and \"tnt/actor\"\n * - \"BusinessSuiteInAppSymbols/3d\" and \"business-suite/3d\"\n */\nenum IconCollectionsAlias {\n\t\"SAP-icons\" = \"SAP-icons-v4\",\n\t\"horizon\" = \"SAP-icons-v5\",\n\t\"SAP-icons-TNT\" = \"tnt\",\n\t\"BusinessSuiteInAppSymbols\" = \"business-suite\",\n}\n\n/**\n * Returns the collection name for a given alias:\n *\n * - \"SAP-icons-TNT\"resolves to \"tnt\"\n * - \"BusinessSuiteInAppSymbols\" resolves to \"business-suite\"\n * - \"horizon\" resolves to \"SAP-icons-v5\"\n *\n * @param { string } collectionName\n * @return { string } the normalized collection name\n */\nconst getIconCollectionByAlias = (collectionName: string) => {\n\tif (IconCollectionsAlias[collectionName as keyof typeof IconCollectionsAlias]) {\n\t\treturn IconCollectionsAlias[collectionName as keyof typeof IconCollectionsAlias];\n\t}\n\n\treturn collectionName;\n};\n\nexport default IconCollectionsAlias;\nexport {\n\tgetIconCollectionByAlias,\n};\n"],
|
|
5
|
+
"mappings": "aAWA,IAAKA,OACJA,EAAA,aAAc,eACdA,EAAA,QAAY,eACZA,EAAA,iBAAkB,MAClBA,EAAA,0BAA8B,iBAJ1BA,OAAA,IAiBL,MAAMC,EAA4BC,GAC7BF,EAAqBE,CAAmD,EACpEF,EAAqBE,CAAmD,EAGzEA,EAGR,eAAeF,EACf,OACCC,KAAA",
|
|
6
|
+
"names": ["IconCollectionsAlias", "getIconCollectionByAlias", "collectionName"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";import{isLegacyThemeFamily as i}from"../../config/Theme.js";var t=(o=>(o.SAPIconsV4="SAP-icons-v4",o.SAPIconsV5="SAP-icons-v5",o.SAPIconsTNTV2="tnt-v2",o.SAPIconsTNTV3="tnt-v3",o.SAPBSIconsV1="business-suite-v1",o.SAPBSIconsV2="business-suite-v2",o))(t||{});const s=new Map;s.set("SAP-icons",{legacy:"SAP-icons-v4",sap_horizon:"SAP-icons-v5"}),s.set("tnt",{legacy:"tnt-v2",sap_horizon:"tnt-v3"}),s.set("business-suite",{legacy:"business-suite-v1",sap_horizon:"business-suite-v2"});const c=(n,e)=>{if(s.has(n)){s.set(n,{...e,...s.get(n)});return}s.set(n,e)},r=n=>{const e=i()?"legacy":"sap_horizon";return s.has(n)?s.get(n)[e]:n};export{c as registerIconCollectionForTheme,r as getIconCollectionForTheme,t as RegisteredIconCollection};
|
|
2
|
+
//# sourceMappingURL=IconCollectionsByTheme.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/asset-registries/util/IconCollectionsByTheme.ts"],
|
|
4
|
+
"sourcesContent": ["import { isLegacyThemeFamily } from \"../../config/Theme.js\";\n\nenum RegisteredIconCollection {\n\tSAPIconsV4 = \"SAP-icons-v4\",\n\tSAPIconsV5 = \"SAP-icons-v5\",\n\tSAPIconsTNTV2 = \"tnt-v2\",\n\tSAPIconsTNTV3 = \"tnt-v3\",\n\tSAPBSIconsV1 = \"business-suite-v1\",\n\tSAPBSIconsV2 = \"business-suite-v2\",\n}\n\ntype ThemeToCollectionMap = {[x: string]: string; };\n\nconst iconCollections = new Map<string, ThemeToCollectionMap>();\niconCollections.set(\"SAP-icons\", {\n\t\"legacy\": RegisteredIconCollection.SAPIconsV4,\n\t\"sap_horizon\": RegisteredIconCollection.SAPIconsV5,\n});\niconCollections.set(\"tnt\", {\n\t\"legacy\": RegisteredIconCollection.SAPIconsTNTV2,\n\t\"sap_horizon\": RegisteredIconCollection.SAPIconsTNTV3,\n});\niconCollections.set(\"business-suite\", {\n\t\"legacy\": RegisteredIconCollection.SAPBSIconsV1,\n\t\"sap_horizon\": RegisteredIconCollection.SAPBSIconsV2,\n});\n\n/**\n * Registers collection version per theme.\n * **For exmaple:** registerIconCollectionForTheme(\"my-custom-icons\", {\"sap_horizon\": \"my-custom-icons-v5\"})\n * @param { string } collectionName\n * @param { ThemeToCollectionMap } themeCollectionMap\n */\nconst registerIconCollectionForTheme = (collectionName: string, themeCollectionMap: ThemeToCollectionMap) => {\n\tif (iconCollections.has(collectionName)) {\n\t\ticonCollections.set(collectionName, { ...themeCollectionMap, ...iconCollections.get(collectionName) });\n\t\treturn;\n\t}\n\ticonCollections.set(collectionName, themeCollectionMap);\n};\n\nconst getIconCollectionForTheme = (collectionName: string) => {\n\tconst themeFamily = isLegacyThemeFamily() ? \"legacy\" : \"sap_horizon\";\n\treturn iconCollections.has(collectionName) ? iconCollections.get(collectionName)![themeFamily] : collectionName;\n};\n\nexport {\n\tregisterIconCollectionForTheme,\n\tgetIconCollectionForTheme,\n\tRegisteredIconCollection,\n};\n"],
|
|
5
|
+
"mappings": "aAAA,OAAS,uBAAAA,MAA2B,wBAEpC,IAAKC,OACJA,EAAA,WAAa,eACbA,EAAA,WAAa,eACbA,EAAA,cAAgB,SAChBA,EAAA,cAAgB,SAChBA,EAAA,aAAe,oBACfA,EAAA,aAAe,oBANXA,OAAA,IAWL,MAAMC,EAAkB,IAAI,IAC5BA,EAAgB,IAAI,YAAa,CAChC,OAAU,eACV,YAAe,cAChB,CAAC,EACDA,EAAgB,IAAI,MAAO,CAC1B,OAAU,SACV,YAAe,QAChB,CAAC,EACDA,EAAgB,IAAI,iBAAkB,CACrC,OAAU,oBACV,YAAe,mBAChB,CAAC,EAQD,MAAMC,EAAiC,CAACC,EAAwBC,IAA6C,CAC5G,GAAIH,EAAgB,IAAIE,CAAc,EAAG,CACxCF,EAAgB,IAAIE,EAAgB,CAAE,GAAGC,EAAoB,GAAGH,EAAgB,IAAIE,CAAc,CAAE,CAAC,EACrG,MACD,CACAF,EAAgB,IAAIE,EAAgBC,CAAkB,CACvD,EAEMC,EAA6BF,GAA2B,CAC7D,MAAMG,EAAcP,EAAoB,EAAI,SAAW,cACvD,OAAOE,EAAgB,IAAIE,CAAc,EAAIF,EAAgB,IAAIE,CAAc,EAAGG,CAAW,EAAIH,CAClG,EAEA,OACCD,KAAA,+BACAG,KAAA,0BACAL,KAAA",
|
|
6
|
+
"names": ["isLegacyThemeFamily", "RegisteredIconCollection", "iconCollections", "registerIconCollectionForTheme", "collectionName", "themeCollectionMap", "getIconCollectionForTheme", "themeFamily"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";import{getTheme as n}from"../../config/Theme.js";import{getDefaultIconCollection as c}from"../../config/Icons.js";import{getIconCollectionByAlias as r}from"./IconCollectionsAlias.js";import{getIconCollectionForTheme as e}from"./IconCollectionsByTheme.js";const i=o=>{const t=c(n());return!o&&t?r(t):o?e(o):e("SAP-icons")};export default i;
|
|
2
|
+
//# sourceMappingURL=getIconCollectionByTheme.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/asset-registries/util/getIconCollectionByTheme.ts"],
|
|
4
|
+
"sourcesContent": ["import { getTheme } from \"../../config/Theme.js\";\nimport type { IconCollection } from \"../../config/Icons.js\";\nimport { getDefaultIconCollection } from \"../../config/Icons.js\";\nimport { getIconCollectionByAlias } from \"./IconCollectionsAlias.js\";\nimport { getIconCollectionForTheme } from \"./IconCollectionsByTheme.js\";\n\n/**\n * Returns the effective theme dependant icon collection:\n *\n * - \"no collection\" resolves to \"SAP-icons-v4\" in \"Quartz\" and to \"SAP-icons-v5\" in \"Horizon\"\n * - \"tnt\" (and its alias \"SAP-icons-TNT\") resolves to \"tnt-v2\" in \"Quartz\" and resolves to \"tnt-v3\" in \"Horizon\"\n * - \"business-suite\" (and its alias \"BusinessSuiteInAppSymbols\") resolves to \"business-suite-v1\" in \"Quartz\" and resolves to \"business-suite-v2\" in \"Horizon\"\n *\n * @param { IconCollection } collectionName\n * @returns { IconCollection } the effective collection name\n */\nconst getEffectiveIconCollection = (collectionName?: IconCollection): IconCollection => {\n\tconst defaultIconCollection = getDefaultIconCollection(getTheme());\n\n\t// no collection + default collection, configured via setDefaultIconCollection - return the configured icon collection.\n\tif (!collectionName && defaultIconCollection) {\n\t\treturn getIconCollectionByAlias(defaultIconCollection);\n\t}\n\n\t// no collection - return \"SAP-icons-v4\" or \"SAP-icons-v5\".\n\tif (!collectionName) {\n\t\treturn getIconCollectionForTheme(\"SAP-icons\");\n\t}\n\n\t// has collection - return \"SAP-icons-v4\", \"SAP-icons-v5\", \"tnt-v1\", \"tnt-v2\", \"business-suite-v1\", \"business-suite-v2\", or custom ones.\n\treturn getIconCollectionForTheme(collectionName);\n};\n\nexport default getEffectiveIconCollection;\n"],
|
|
5
|
+
"mappings": "aAAA,OAAS,YAAAA,MAAgB,wBAEzB,OAAS,4BAAAC,MAAgC,wBACzC,OAAS,4BAAAC,MAAgC,4BACzC,OAAS,6BAAAC,MAAiC,8BAY1C,MAAMC,EAA8BC,GAAoD,CACvF,MAAMC,EAAwBL,EAAyBD,EAAS,CAAC,EAGjE,MAAI,CAACK,GAAkBC,EACfJ,EAAyBI,CAAqB,EAIjDD,EAKEF,EAA0BE,CAAc,EAJvCF,EAA0B,WAAW,CAK9C,EAEA,eAAeC",
|
|
6
|
+
"names": ["getTheme", "getDefaultIconCollection", "getIconCollectionByAlias", "getIconCollectionForTheme", "getEffectiveIconCollection", "collectionName", "defaultIconCollection"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";import{getAnimationMode as i}from"../InitialConfiguration.js";import t from"../types/AnimationMode.js";let o;const e=()=>(o===void 0&&(o=i()),o),d=n=>{Object.values(t).includes(n)&&(o=n)};export{e as getAnimationMode,d as setAnimationMode};
|
|
2
|
+
//# sourceMappingURL=AnimationMode.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/AnimationMode.ts"],
|
|
4
|
+
"sourcesContent": ["import { getAnimationMode as getConfiguredAnimationMode } from \"../InitialConfiguration.js\";\nimport AnimationMode from \"../types/AnimationMode.js\";\n\nlet curAnimationMode: `${AnimationMode}`;\n\n/**\n * Returns the animation mode - \"full\", \"basic\", \"minimal\" or \"none\".\n * @public\n * @returns { AnimationMode }\n */\nconst getAnimationMode = (): `${AnimationMode}` => {\n\tif (curAnimationMode === undefined) {\n\t\tcurAnimationMode = getConfiguredAnimationMode();\n\t}\n\n\treturn curAnimationMode;\n};\n\n/**\n * Sets the animation mode - \"full\", \"basic\", \"minimal\" or \"none\".\n * @public\n * @param { AnimationMode } animationMode\n */\nconst setAnimationMode = (animationMode: `${AnimationMode}`) => {\n\tconst options: string[] = Object.values(AnimationMode);\n\tif (options.includes(animationMode)) {\n\t\tcurAnimationMode = animationMode;\n\t}\n};\n\nexport {\n\tgetAnimationMode,\n\tsetAnimationMode,\n};\n"],
|
|
5
|
+
"mappings": "aAAA,OAAS,oBAAoBA,MAAkC,6BAC/D,OAAOC,MAAmB,4BAE1B,IAAIC,EAOJ,MAAMC,EAAmB,KACpBD,IAAqB,SACxBA,EAAmBF,EAA2B,GAGxCE,GAQFE,EAAoBC,GAAsC,CACrC,OAAO,OAAOJ,CAAa,EACzC,SAASI,CAAa,IACjCH,EAAmBG,EAErB,EAEA,OACCF,KAAA,iBACAC,KAAA",
|
|
6
|
+
"names": ["getConfiguredAnimationMode", "AnimationMode", "curAnimationMode", "getAnimationMode", "setAnimationMode", "animationMode"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";import r from"../types/CalendarType.js";import{getCalendarType as a,getSecondaryCalendarType as d}from"../InitialConfiguration.js";let n,e;const t=()=>(n===void 0&&(n=a()),n&&n in r?n:r.Gregorian),y=()=>(e===void 0&&(e=d()),e&&e in r,e);export{t as getCalendarType,y as getSecondaryCalendarType};
|
|
2
|
+
//# sourceMappingURL=CalendarType.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/CalendarType.ts"],
|
|
4
|
+
"sourcesContent": ["import CalendarType from \"../types/CalendarType.js\";\nimport {\n\tgetCalendarType as getConfiguredCalendarType,\n\tgetSecondaryCalendarType as getConfiguredSecondaryCalendarType,\n} from \"../InitialConfiguration.js\";\n\nlet calendarType: CalendarType | undefined;\nlet secondaryCalendarType: CalendarType | undefined;\n\n/**\n * Returns the configured or default calendar type.\n * @public\n * @returns { CalendarType } the effective calendar type\n */\nconst getCalendarType = (): CalendarType => {\n\tif (calendarType === undefined) {\n\t\tcalendarType = getConfiguredCalendarType();\n\t}\n\n\tif (calendarType && calendarType in CalendarType) {\n\t\treturn calendarType;\n\t}\n\n\treturn CalendarType.Gregorian;\n};\n\n/**\n * Returns the configured secondary calendar type.\n * @public\n * @returns { CalendarType | undefined } the effective calendar type\n * @since 1.18.0\n */\nconst getSecondaryCalendarType = (): CalendarType | undefined => {\n\tif (secondaryCalendarType === undefined) {\n\t\tsecondaryCalendarType = getConfiguredSecondaryCalendarType();\n\t}\n\n\tif (secondaryCalendarType && secondaryCalendarType in CalendarType) {\n\t\treturn secondaryCalendarType;\n\t}\n\n\treturn secondaryCalendarType;\n};\n\nexport {\n\tgetCalendarType,\n\tgetSecondaryCalendarType,\n};\n"],
|
|
5
|
+
"mappings": "aAAA,OAAOA,MAAkB,2BACzB,OACC,mBAAmBC,EACnB,4BAA4BC,MACtB,6BAEP,IAAIC,EACAC,EAOJ,MAAMC,EAAkB,KACnBF,IAAiB,SACpBA,EAAeF,EAA0B,GAGtCE,GAAgBA,KAAgBH,EAC5BG,EAGDH,EAAa,WASfM,EAA2B,KAC5BF,IAA0B,SAC7BA,EAAwBF,EAAmC,GAGxDE,GAAyBA,KAAyBJ,EAC9CI,GAMT,OACCC,KAAA,gBACAC,KAAA",
|
|
6
|
+
"names": ["CalendarType", "getConfiguredCalendarType", "getConfiguredSecondaryCalendarType", "calendarType", "secondaryCalendarType", "getCalendarType", "getSecondaryCalendarType"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";import e from"../features/LegacyDateFormats.js";import{getFormatSettings as a}from"../InitialConfiguration.js";import{getFeature as r}from"../FeaturesRegistry.js";let t;const o=()=>(t===void 0&&(t=a()),t.firstDayOfWeek),n=r("LegacyDateFormats"),g=n?e.getLegacyDateCalendarCustomizing:()=>[];export{o as getFirstDayOfWeek,g as getLegacyDateCalendarCustomizing};
|
|
2
|
+
//# sourceMappingURL=FormatSettings.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/FormatSettings.ts"],
|
|
4
|
+
"sourcesContent": ["import LegacyDateFormats from \"../features/LegacyDateFormats.js\";\nimport type { LegacyDateCalendarCustomizing } from \"../features/LegacyDateFormats.js\";\nimport { getFormatSettings } from \"../InitialConfiguration.js\";\nimport { getFeature } from \"../FeaturesRegistry.js\";\n\ntype FormatSettings = {\n\tfirstDayOfWeek?: number,\n\tlegacyDateCalendarCustomizing?: LegacyDateCalendarCustomizing,\n};\n\nlet formatSettings: FormatSettings;\n\n/**\n * Returns the first day of the week from the configured format settings or based on the current locale.\n * @public\n * @returns {Number} 0 (Sunday) through 6 (Saturday)\n */\nconst getFirstDayOfWeek = (): number | undefined => {\n\tif (formatSettings === undefined) {\n\t\tformatSettings = getFormatSettings();\n\t}\n\n\treturn formatSettings.firstDayOfWeek;\n};\n\nconst legacyDateFormats = getFeature<typeof LegacyDateFormats>(\"LegacyDateFormats\");\n\nconst getLegacyDateCalendarCustomizing = legacyDateFormats ? LegacyDateFormats.getLegacyDateCalendarCustomizing : () => { return []; };\n\nexport {\n\tgetFirstDayOfWeek,\n\tgetLegacyDateCalendarCustomizing,\n};\n\nexport type { FormatSettings };\n"],
|
|
5
|
+
"mappings": "aAAA,OAAOA,MAAuB,mCAE9B,OAAS,qBAAAC,MAAyB,6BAClC,OAAS,cAAAC,MAAkB,yBAO3B,IAAIC,EAOJ,MAAMC,EAAoB,KACrBD,IAAmB,SACtBA,EAAiBF,EAAkB,GAG7BE,EAAe,gBAGjBE,EAAoBH,EAAqC,mBAAmB,EAE5EI,EAAmCD,EAAoBL,EAAkB,iCAAmC,IAAe,CAAC,EAElI,OACCI,KAAA,kBACAE,KAAA",
|
|
6
|
+
"names": ["LegacyDateFormats", "getFormatSettings", "getFeature", "formatSettings", "getFirstDayOfWeek", "legacyDateFormats", "getLegacyDateCalendarCustomizing"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/Icons.ts"],
|
|
4
|
+
"sourcesContent": ["const IconCollectionConfiguration = new Map<string, string>();\n\n// All supported icon collections + unknown custom ones\ntype IconCollection = string;\n\n/**\n * Sets the default icon collection for a given theme.\n *\n * SAP Icons is the default icon collection (that resolves to SAP-icons version 5.x in Horizon theme family and SAP-icons version 4.x in all other themes)\n * and to display icons from other collections, you have to specify the icon collection in addition to the icon name, for example: \"tnt/actor\", \"business-suite/1x2-grid-layout\", etc.\n * This method allows setting another (built-in or custom) icon collection as default per theme.\n *\n * **Usage**\n * **For example**, to make \"SAP-icons version 5.x\" the default icon collection in \"sap_fiori_3\":\n *\n * ```\n * setDefaultIconCollection(\"sap_fiori_3\", \"SAP-icons-v5\");\n *\n * <ui5-icon name=\"home\"></ui5-icon>\n * ```\n *\n * **For example**, to make a custom icon collection (with name \"my-custom-collection\") the default icon collection in \"sap_fiori_3\":\n *\n * ```\n * setDefaultIconCollection(\"sap_fiori_3\", \"my-custom-collection\");\n *\n * <ui5-icon name=\"custom-icon-name\"></ui5-icon>\n * ```\n *\n * @public\n * @param { string } theme\n * @param { string } collectionName\n */\nconst setDefaultIconCollection = (theme: string, collectionName: IconCollection) => {\n\tIconCollectionConfiguration.set(theme, collectionName);\n};\n\n/**\n * Returns the configured default icon collection for a given theme.\n *\n * @param { string } theme\n * @public\n * @returns { string | undefined }\n */\nconst getDefaultIconCollection = (theme: string): string | undefined => {\n\treturn IconCollectionConfiguration.get(theme);\n};\n\nexport {\n\tsetDefaultIconCollection,\n\tgetDefaultIconCollection,\n};\n\nexport type {\n\tIconCollection,\n};\n"],
|
|
5
|
+
"mappings": "aAAA,MAAMA,EAA8B,IAAI,IAiClCC,EAA2B,CAACC,EAAeC,IAAmC,CACnFH,EAA4B,IAAIE,EAAOC,CAAc,CACtD,EASMC,EAA4BF,GAC1BF,EAA4B,IAAIE,CAAK,EAG7C,OACCD,KAAA,yBACAG,KAAA",
|
|
6
|
+
"names": ["IconCollectionConfiguration", "setDefaultIconCollection", "theme", "collectionName", "getDefaultIconCollection"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";import{getLanguage as g,getFetchDefaultLanguage as r}from"../InitialConfiguration.js";import{fireLanguageChange as u}from"../locale/languageChange.js";import{reRenderAllUI5Elements as o}from"../Render.js";import{DEFAULT_LANGUAGE as i}from"../generated/AssetParameters.js";import{isBooted as f}from"../Boot.js";let t,n;const s=()=>(t===void 0&&(t=g()),t),L=async e=>{t!==e&&(t=e,f()&&(await u(e),await o({languageAware:!0})))},d=()=>i,a=e=>{n=e},l=()=>(n===void 0&&a(r()),n);export{s as getLanguage,L as setLanguage,d as getDefaultLanguage,a as setFetchDefaultLanguage,l as getFetchDefaultLanguage};
|
|
2
|
+
//# sourceMappingURL=Language.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/Language.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n\tgetLanguage as getConfiguredLanguage,\n\tgetFetchDefaultLanguage as getConfiguredFetchDefaultLanguage,\n} from \"../InitialConfiguration.js\";\nimport { fireLanguageChange } from \"../locale/languageChange.js\";\nimport { reRenderAllUI5Elements } from \"../Render.js\";\nimport { DEFAULT_LANGUAGE } from \"../generated/AssetParameters.js\";\nimport { isBooted } from \"../Boot.js\";\n\nlet curLanguage: string | undefined;\nlet fetchDefaultLanguage: boolean;\n\n/**\n * Returns the currently configured language, or the browser language as a fallback.\n * @public\n * @returns {string}\n */\nconst getLanguage = (): string | undefined => {\n\tif (curLanguage === undefined) {\n\t\tcurLanguage = getConfiguredLanguage();\n\t}\n\treturn curLanguage;\n};\n\n/**\n * Changes the current language, re-fetches all message bundles, updates all language-aware components\n * and returns a promise that resolves when all rendering is done.\n *\n * @param {string} language\n * @public\n * @returns {Promise<void>}\n */\nconst setLanguage = async (language: string): Promise<void> => {\n\tif (curLanguage === language) {\n\t\treturn;\n\t}\n\n\tcurLanguage = language;\n\n\tif (isBooted()) {\n\t\tawait fireLanguageChange(language);\n\t\tawait reRenderAllUI5Elements({ languageAware: true });\n\t}\n};\n\n/**\n * Returns the default languague.\n *\n * Note: Default language might be different than the configurated one.\n *\n * @public\n * @returns {string}\n */\nconst getDefaultLanguage = (): string => {\n\treturn DEFAULT_LANGUAGE;\n};\n\n/**\n * Defines if the default language, that is inlined, should be\n * fetched over the network instead of using the inlined one.\n * **Note:** By default the language will not be fetched.\n *\n * @public\n * @param {boolean} fetchDefaultLang\n */\nconst setFetchDefaultLanguage = (fetchDefaultLang: boolean) => {\n\tfetchDefaultLanguage = fetchDefaultLang;\n};\n\n/**\n * Returns if the default language, that is inlined, should be fetched over the network.\n * @public\n * @returns {boolean}\n */\nconst getFetchDefaultLanguage = (): boolean => {\n\tif (fetchDefaultLanguage === undefined) {\n\t\tsetFetchDefaultLanguage(getConfiguredFetchDefaultLanguage());\n\t}\n\n\treturn fetchDefaultLanguage;\n};\n\nexport {\n\tgetLanguage,\n\tsetLanguage,\n\tgetDefaultLanguage,\n\tsetFetchDefaultLanguage,\n\tgetFetchDefaultLanguage,\n};\n"],
|
|
5
|
+
"mappings": "aAAA,OACC,eAAeA,EACf,2BAA2BC,MACrB,6BACP,OAAS,sBAAAC,MAA0B,8BACnC,OAAS,0BAAAC,MAA8B,eACvC,OAAS,oBAAAC,MAAwB,kCACjC,OAAS,YAAAC,MAAgB,aAEzB,IAAIC,EACAC,EAOJ,MAAMC,EAAc,KACfF,IAAgB,SACnBA,EAAcN,EAAsB,GAE9BM,GAWFG,EAAc,MAAOC,GAAoC,CAC1DJ,IAAgBI,IAIpBJ,EAAcI,EAEVL,EAAS,IACZ,MAAMH,EAAmBQ,CAAQ,EACjC,MAAMP,EAAuB,CAAE,cAAe,EAAK,CAAC,GAEtD,EAUMQ,EAAqB,IACnBP,EAWFQ,EAA2BC,GAA8B,CAC9DN,EAAuBM,CACxB,EAOMC,EAA0B,KAC3BP,IAAyB,QAC5BK,EAAwBX,EAAkC,CAAC,EAGrDM,GAGR,OACCC,KAAA,YACAC,KAAA,YACAE,KAAA,mBACAC,KAAA,wBACAE,KAAA",
|
|
6
|
+
"names": ["getConfiguredLanguage", "getConfiguredFetchDefaultLanguage", "fireLanguageChange", "reRenderAllUI5Elements", "DEFAULT_LANGUAGE", "isBooted", "curLanguage", "fetchDefaultLanguage", "getLanguage", "setLanguage", "language", "getDefaultLanguage", "setFetchDefaultLanguage", "fetchDefaultLang", "getFetchDefaultLanguage"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";import{getNoConflict as i}from"../InitialConfiguration.js";const r=["value-changed","click"];let e;const c=t=>r.includes(t),s=t=>{const n=o();return!(typeof n!="boolean"&&n.events&&n.events.includes&&n.events.includes(t))},o=()=>(e===void 0&&(e=i()),e),l=t=>{e=t},a=t=>{const n=o();return c(t)?!1:n===!0?!0:!s(t)};export{o as getNoConflict,l as setNoConflict,a as skipOriginalEvent};
|
|
2
|
+
//# sourceMappingURL=NoConflict.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/NoConflict.ts"],
|
|
4
|
+
"sourcesContent": ["import { getNoConflict as getConfiguredNoConflict } from \"../InitialConfiguration.js\";\n\n// Fire these events even with noConflict: true\nconst excludeList = [\n\t\"value-changed\",\n\t\"click\",\n];\n\ntype NoConflictData = boolean | { events: Array<string>};\n\nlet noConflict: NoConflictData;\n\nconst shouldFireOriginalEvent = (eventName: string) => {\n\treturn excludeList.includes(eventName);\n};\n\nconst shouldNotFireOriginalEvent = (eventName: string) => {\n\tconst nc = getNoConflict();\n\t// return !(nc.events && nc.events.includes && nc.events.includes(eventName));\n\treturn !(typeof nc !== \"boolean\" && nc.events && nc.events.includes && nc.events.includes(eventName));\n};\n\n/**\n * Returns if the \"noConflict\" configuration is set.\n * @public\n * @returns { NoConflictData }\n */\nconst getNoConflict = (): NoConflictData => {\n\tif (noConflict === undefined) {\n\t\tnoConflict = getConfiguredNoConflict();\n\t}\n\n\treturn noConflict;\n};\n\n/**\n * Sets the \"noConflict\" mode.\n * - When \"false\" (default value), all custom events are fired with and without the \"ui5-\" prefix.\n * - When \"true\", all custom events are fired with the \"ui5-\" prefix only.\n * - When an object is supplied, just the specified events will be fired with the \"ui5-\" prefix.\n * @public\n * @param { NoConflictData } noConflictData\n */\nconst setNoConflict = (noConflictData: NoConflictData) => {\n\tnoConflict = noConflictData;\n};\n\nconst skipOriginalEvent = (eventName: string) => {\n\tconst nc = getNoConflict();\n\n\t// Always fire these events\n\tif (shouldFireOriginalEvent(eventName)) {\n\t\treturn false;\n\t}\n\n\t// Read from the configuration\n\tif (nc === true) {\n\t\treturn true;\n\t}\n\n\treturn !shouldNotFireOriginalEvent(eventName);\n};\n\nexport {\n\tgetNoConflict,\n\tsetNoConflict,\n\tskipOriginalEvent,\n};\n"],
|
|
5
|
+
"mappings": "aAAA,OAAS,iBAAiBA,MAA+B,6BAGzD,MAAMC,EAAc,CACnB,gBACA,OACD,EAIA,IAAIC,EAEJ,MAAMC,EAA2BC,GACzBH,EAAY,SAASG,CAAS,EAGhCC,EAA8BD,GAAsB,CACzD,MAAME,EAAKC,EAAc,EAEzB,MAAO,EAAE,OAAOD,GAAO,WAAaA,EAAG,QAAUA,EAAG,OAAO,UAAYA,EAAG,OAAO,SAASF,CAAS,EACpG,EAOMG,EAAgB,KACjBL,IAAe,SAClBA,EAAaF,EAAwB,GAG/BE,GAWFM,EAAiBC,GAAmC,CACzDP,EAAaO,CACd,EAEMC,EAAqBN,GAAsB,CAChD,MAAME,EAAKC,EAAc,EAGzB,OAAIJ,EAAwBC,CAAS,EAC7B,GAIJE,IAAO,GACH,GAGD,CAACD,EAA2BD,CAAS,CAC7C,EAEA,OACCG,KAAA,cACAC,KAAA,cACAE,KAAA",
|
|
6
|
+
"names": ["getConfiguredNoConflict", "excludeList", "noConflict", "shouldFireOriginalEvent", "eventName", "shouldNotFireOriginalEvent", "nc", "getNoConflict", "setNoConflict", "noConflictData", "skipOriginalEvent"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";import{getTheme as s}from"../InitialConfiguration.js";import{reRenderAllUI5Elements as o}from"../Render.js";import m from"../theming/applyTheme.js";import a from"../theming/getThemeDesignerTheme.js";import{DEFAULT_THEME as T,SUPPORTED_THEMES as h}from"../generated/AssetParameters.js";import{boot as c,isBooted as g}from"../Boot.js";let t;const r=()=>(t===void 0&&(t=s()),t),u=async e=>{t!==e&&(t=e,g()&&(await m(t),await o({themeAware:!0})))},f=()=>T,p=e=>{const n=r();return n===e||n===`${e}_exp`},i=()=>{const e=r();return y(e)?!e.startsWith("sap_horizon"):!a()?.baseThemeName?.startsWith("sap_horizon")},l=async()=>(await c(),i()),y=e=>h.includes(e);export{r as getTheme,u as setTheme,p as isTheme,i as isLegacyThemeFamily,l as isLegacyThemeFamilyAsync,f as getDefaultTheme};
|
|
2
|
+
//# sourceMappingURL=Theme.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/Theme.ts"],
|
|
4
|
+
"sourcesContent": ["import { getTheme as getConfiguredTheme } from \"../InitialConfiguration.js\";\nimport { reRenderAllUI5Elements } from \"../Render.js\";\nimport applyTheme from \"../theming/applyTheme.js\";\nimport getThemeDesignerTheme from \"../theming/getThemeDesignerTheme.js\";\nimport { DEFAULT_THEME, SUPPORTED_THEMES } from \"../generated/AssetParameters.js\";\nimport { boot, isBooted } from \"../Boot.js\";\n\nlet curTheme: string;\n\n/**\n * Returns the current theme.\n * @public\n * @returns {string} the current theme name\n */\nconst getTheme = (): string => {\n\tif (curTheme === undefined) {\n\t\tcurTheme = getConfiguredTheme();\n\t}\n\n\treturn curTheme;\n};\n\n/**\n * Applies a new theme after fetching its assets from the network.\n * @public\n * @param {string} theme the name of the new theme\n * @returns {Promise<void>} a promise that is resolved when the new theme assets have been fetched and applied to the DOM\n */\nconst setTheme = async (theme: string): Promise<void> => {\n\tif (curTheme === theme) {\n\t\treturn;\n\t}\n\n\tcurTheme = theme;\n\n\tif (isBooted()) {\n\t\t// Update CSS Custom Properties\n\t\tawait applyTheme(curTheme);\n\t\tawait reRenderAllUI5Elements({ themeAware: true });\n\t}\n};\n\n/**\n * Returns the default theme.\n *\n * Note: Default theme might be different than the configurated one.\n *\n * @public\n * @returns {string}\n */\nconst getDefaultTheme = (): string => {\n\treturn DEFAULT_THEME;\n};\n\n/**\n * Returns if the given theme name is the one currently applied.\n * @private\n * @param {string} theme\n * @returns {boolean}\n */\nconst isTheme = (theme: string) => {\n\tconst currentTheme = getTheme();\n\treturn currentTheme === theme || currentTheme === `${theme}_exp`;\n};\n\n/**\n * Returns if the currently set theme is part of legacy theme families (\"sap_fiori_3\").\n * **Note**: in addition, the method checks the base theme of a custom theme, built via the ThemeDesigner.\n *\n * @private\n * @returns { boolean }\n */\nconst isLegacyThemeFamily = () => {\n\tconst currentTheme = getTheme();\n\n\tif (!isKnownTheme(currentTheme)) {\n\t\treturn !getThemeDesignerTheme()?.baseThemeName?.startsWith(\"sap_horizon\");\n\t}\n\n\treturn !currentTheme.startsWith(\"sap_horizon\");\n};\n\nconst isLegacyThemeFamilyAsync = async () => {\n\tawait boot();\n\treturn isLegacyThemeFamily();\n};\n\nconst isKnownTheme = (theme: string) => SUPPORTED_THEMES.includes(theme);\n\nexport {\n\tgetTheme,\n\tsetTheme,\n\tisTheme,\n\tisLegacyThemeFamily,\n\tisLegacyThemeFamilyAsync,\n\tgetDefaultTheme,\n};\n"],
|
|
5
|
+
"mappings": "aAAA,OAAS,YAAYA,MAA0B,6BAC/C,OAAS,0BAAAC,MAA8B,eACvC,OAAOC,MAAgB,2BACvB,OAAOC,MAA2B,sCAClC,OAAS,iBAAAC,EAAe,oBAAAC,MAAwB,kCAChD,OAAS,QAAAC,EAAM,YAAAC,MAAgB,aAE/B,IAAIC,EAOJ,MAAMC,EAAW,KACZD,IAAa,SAChBA,EAAWR,EAAmB,GAGxBQ,GASFE,EAAW,MAAOC,GAAiC,CACpDH,IAAaG,IAIjBH,EAAWG,EAEPJ,EAAS,IAEZ,MAAML,EAAWM,CAAQ,EACzB,MAAMP,EAAuB,CAAE,WAAY,EAAK,CAAC,GAEnD,EAUMW,EAAkB,IAChBR,EASFS,EAAWF,GAAkB,CAClC,MAAMG,EAAeL,EAAS,EAC9B,OAAOK,IAAiBH,GAASG,IAAiB,GAAGH,CAAK,MAC3D,EASMI,EAAsB,IAAM,CACjC,MAAMD,EAAeL,EAAS,EAE9B,OAAKO,EAAaF,CAAY,EAIvB,CAACA,EAAa,WAAW,aAAa,EAHrC,CAACX,EAAsB,GAAG,eAAe,WAAW,aAAa,CAI1E,EAEMc,EAA2B,UAChC,MAAMX,EAAK,EACJS,EAAoB,GAGtBC,EAAgBL,GAAkBN,EAAiB,SAASM,CAAK,EAEvE,OACCF,KAAA,SACAC,KAAA,SACAG,KAAA,QACAE,KAAA,oBACAE,KAAA,yBACAL,KAAA",
|
|
6
|
+
"names": ["getConfiguredTheme", "reRenderAllUI5Elements", "applyTheme", "getThemeDesignerTheme", "DEFAULT_THEME", "SUPPORTED_THEMES", "boot", "isBooted", "curTheme", "getTheme", "setTheme", "theme", "getDefaultTheme", "isTheme", "currentTheme", "isLegacyThemeFamily", "isKnownTheme", "isLegacyThemeFamilyAsync"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";import r from"../util/createLinkInHead.js";import s from"../validateThemeRoot.js";import{getThemeRoot as m}from"../InitialConfiguration.js";import{getTheme as a}from"./Theme.js";let t;const n=()=>(t===void 0&&(t=m()),t),d=e=>{if(t!==e){if(t=e,!s(e)){console.warn(`The ${e} is not valid. Check the allowed origins as suggested in the "setThemeRoot" description.`);return}return i(a())}},c=e=>`${n()}Base/baseLib/${e}/css_variables.css`,i=async e=>{const o=document.querySelector(`[sap-ui-webcomponents-theme="${e}"]`);o&&document.head.removeChild(o),await r(c(e),{"sap-ui-webcomponents-theme":e})};export{n as getThemeRoot,d as setThemeRoot,i as attachCustomThemeStylesToHead};
|
|
2
|
+
//# sourceMappingURL=ThemeRoot.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/ThemeRoot.ts"],
|
|
4
|
+
"sourcesContent": ["import createLinkInHead from \"../util/createLinkInHead.js\";\nimport validateThemeRoot from \"../validateThemeRoot.js\";\nimport { getThemeRoot as getConfiguredThemeRoot } from \"../InitialConfiguration.js\";\nimport { getTheme } from \"./Theme.js\";\n\nlet currThemeRoot: string | undefined;\n\n/**\n * Returns the current theme root.\n *\n * @public\n * @since 1.14.0\n * @returns { string } the current theme root\n */\nconst getThemeRoot = (): string | undefined => {\n\tif (currThemeRoot === undefined) {\n\t\tcurrThemeRoot = getConfiguredThemeRoot();\n\t}\n\n\treturn currThemeRoot;\n};\n\n/**\n * Sets theme root for the current theme.\n * When set, the framework will validate the theme root and fetch the theme styles (CSS variables) from this location.\n *\n * **Note:** The feature is specific to custom themes, created with the `UI Theme Designer`.\n * The provided theme root is used only as a base to construct the actual location of the theme styles: `{themeRoot}/.../css_variables.css`.\n *\n * **Note:** Certain security restrictions will apply before fetching the theme assets.\n * Absolute URLs to a different origin than the current page will result in using the current page as an origin.\n * To allow specific origins, use <meta name=\"sap-allowedThemeOrigins\" content=\"https://my-example-host.com/\"> tag inside the <head> of the page.\n *\n * @public\n * @since 1.14.0\n * @param { string } themeRoot the new theme root\n * @returns { Promise<void> }\n */\nconst setThemeRoot = (themeRoot: string): Promise<void> | undefined => {\n\tif (currThemeRoot === themeRoot) {\n\t\treturn;\n\t}\n\n\tcurrThemeRoot = themeRoot;\n\n\tif (!validateThemeRoot(themeRoot)) {\n\t\tconsole.warn(`The ${themeRoot} is not valid. Check the allowed origins as suggested in the \"setThemeRoot\" description.`); // eslint-disable-line\n\t\treturn;\n\t}\n\n\treturn attachCustomThemeStylesToHead(getTheme());\n};\n\nconst formatThemeLink = (theme: string) => {\n\treturn `${getThemeRoot()!}Base/baseLib/${theme}/css_variables.css`; // theme root is always set at this point.\n};\n\nconst attachCustomThemeStylesToHead = async (theme: string): Promise<void> => {\n\tconst link = document.querySelector(`[sap-ui-webcomponents-theme=\"${theme}\"]`);\n\n\tif (link) {\n\t\tdocument.head.removeChild(link);\n\t}\n\n\tawait createLinkInHead(formatThemeLink(theme), { \"sap-ui-webcomponents-theme\": theme });\n};\n\nexport {\n\tgetThemeRoot,\n\tsetThemeRoot,\n\tattachCustomThemeStylesToHead,\n};\n"],
|
|
5
|
+
"mappings": "aAAA,OAAOA,MAAsB,8BAC7B,OAAOC,MAAuB,0BAC9B,OAAS,gBAAgBC,MAA8B,6BACvD,OAAS,YAAAC,MAAgB,aAEzB,IAAIC,EASJ,MAAMC,EAAe,KAChBD,IAAkB,SACrBA,EAAgBF,EAAuB,GAGjCE,GAmBFE,EAAgBC,GAAiD,CACtE,GAAIH,IAAkBG,EAMtB,IAFAH,EAAgBG,EAEZ,CAACN,EAAkBM,CAAS,EAAG,CAClC,QAAQ,KAAK,OAAOA,CAAS,0FAA0F,EACvH,MACD,CAEA,OAAOC,EAA8BL,EAAS,CAAC,EAChD,EAEMM,EAAmBC,GACjB,GAAGL,EAAa,CAAE,gBAAgBK,CAAK,qBAGzCF,EAAgC,MAAOE,GAAiC,CAC7E,MAAMC,EAAO,SAAS,cAAc,gCAAgCD,CAAK,IAAI,EAEzEC,GACH,SAAS,KAAK,YAAYA,CAAI,EAG/B,MAAMX,EAAiBS,EAAgBC,CAAK,EAAG,CAAE,6BAA8BA,CAAM,CAAC,CACvF,EAEA,OACCL,KAAA,aACAC,KAAA,aACAE,KAAA",
|
|
6
|
+
"names": ["createLinkInHead", "validateThemeRoot", "getConfiguredThemeRoot", "getTheme", "currThemeRoot", "getThemeRoot", "setThemeRoot", "themeRoot", "attachCustomThemeStylesToHead", "formatThemeLink", "theme", "link"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/Timezone.ts"],
|
|
4
|
+
"sourcesContent": ["import { getTimezone as getConfiguredTimezone } from \"../InitialConfiguration.js\";\n\nlet currTimezone: string | undefined;\n\n/**\n * Returns the configured IANA timezone ID.\n *\n * @private\n * @returns {string}\n */\nconst getTimezone = (): string | undefined => {\n\tif (currTimezone === undefined) {\n\t\tcurrTimezone = getConfiguredTimezone();\n\t}\n\treturn currTimezone;\n};\n\n/**\n * Sets the IANA timezone ID.\n * **For example:** \"America/New_York\", \"Europe/London\", \"Australia/Sydney\", \"Asia/Bishkek\", etc.\n *>\n * @param {string} timezone\n * @private\n * @returns { Promise<void> }\n */\nconst setTimezone = (timezone: string) => {\n\tif (currTimezone === timezone) {\n\t\treturn;\n\t}\n\n\tcurrTimezone = timezone;\n};\n\nexport {\n\tgetTimezone,\n\tsetTimezone,\n};\n"],
|
|
5
|
+
"mappings": "aAAA,OAAS,eAAeA,MAA6B,6BAErD,IAAIC,EAQJ,MAAMC,EAAc,KACfD,IAAiB,SACpBA,EAAeD,EAAsB,GAE/BC,GAWFE,EAAeC,GAAqB,CACrCH,IAAiBG,IAIrBH,EAAeG,EAChB,EAEA,OACCF,KAAA,YACAC,KAAA",
|
|
6
|
+
"names": ["getConfiguredTimezone", "currTimezone", "getTimezone", "setTimezone", "timezone"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";import{renderDeferred as m}from"./Render.js";const a=500,i=new Map,c=new Map,E=n=>{const r=n.host,l=n.propName,t=r[l];let o;if(t===void 0||t==="")o=void 0;else if(t instanceof HTMLElement)o=t;else{const d=r.getRootNode();o=d.getElementById&&d.getElementById(t)||void 0}const e=`${r._id}-${l}`,s=i.get(e);if(!o){if(s&&(n.onDisconnect&&n.onDisconnect(s),i.delete(e)),typeof t=="string"&&t&&!c.has(e)){const d=setInterval(()=>{const f=r.getRootNode();f.getElementById&&f.getElementById(t)&&(clearInterval(c.get(e)),c.delete(e),m(r))},a);c.set(e,d)}return}return c.has(e)&&(clearInterval(c.get(e)),c.delete(e)),s!==o&&(s&&n.onDisconnect&&n.onDisconnect(s),n.onConnect&&n.onConnect(o),i.set(e,o)),i.get(e)};export default E;
|
|
2
|
+
//# sourceMappingURL=connectToComponent.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/connectToComponent.ts"],
|
|
4
|
+
"sourcesContent": ["import type UI5Element from \"./UI5Element.js\";\nimport { renderDeferred } from \"./Render.js\";\nimport { Interval } from \"./types.js\";\n\nconst MISSING_ELEMENT_POLL_TIMEOUT = 500; // how often to poll for not-yet-in-DOM friend elements\nconst connections = new Map<string, HTMLElement>();\nconst intervals = new Map<string, Interval>();\n\ntype ConnectOptions = {\n\thost: UI5Element;\n\tpropName: string;\n\tonConnect?: (friend: HTMLElement) => void;\n\tonDisconnect?: (friend: HTMLElement) => void;\n}\n\nconst connectToComponent = (options: ConnectOptions): HTMLElement | undefined => {\n\tconst host = options.host;\n\tconst propName = options.propName;\n\tconst friend = host[propName as keyof typeof host] as HTMLElement | string | undefined;\n\n\tlet connectedTo: HTMLElement | undefined;\n\tif (friend === undefined || friend === \"\") {\n\t\tconnectedTo = undefined; // do not return early even if a \"menu\" property is not set - it may have been set before and cleanup must run\n\t} else if (friend instanceof HTMLElement) {\n\t\tconnectedTo = friend;\n\t} else {\n\t\tconst rootNode = host.getRootNode() as Document;\n\t\tconnectedTo = (rootNode.getElementById && rootNode.getElementById(friend)) || undefined;\n\t}\n\n\tconst key = `${host._id}-${propName}`;\n\tconst prevConnectedTo = connections.get(key);\n\n\t// Not connected - return undefined\n\tif (!connectedTo) {\n\t\tif (prevConnectedTo) { // but first disconnect, if needed\n\t\t\toptions.onDisconnect && options.onDisconnect(prevConnectedTo);\n\t\t\tconnections.delete(key);\n\t\t}\n\n\t\t// if friend element not in DOM yet, start polling\n\t\tif (typeof friend === \"string\" && friend && !intervals.has(key)) {\n\t\t\tconst interval = setInterval(() => {\n\t\t\t\tconst rootNode = host.getRootNode() as Document;\n\t\t\t\tconst found = (rootNode.getElementById && rootNode.getElementById(friend));\n\n\t\t\t\tif (found) {\n\t\t\t\t\tclearInterval(intervals.get(key));\n\t\t\t\t\tintervals.delete(key);\n\t\t\t\t\trenderDeferred(host);\n\t\t\t\t}\n\t\t\t}, MISSING_ELEMENT_POLL_TIMEOUT);\n\t\t\tintervals.set(key, interval);\n\t\t}\n\n\t\treturn;\n\t}\n\n\t// If connected, but still polling, stop polling\n\tif (intervals.has(key)) {\n\t\tclearInterval(intervals.get(key));\n\t\tintervals.delete(key);\n\t}\n\n\t// Connected - either for the first time, or to something else\n\tif (prevConnectedTo !== connectedTo) {\n\t\tif (prevConnectedTo) {\n\t\t\toptions.onDisconnect && options.onDisconnect(prevConnectedTo);\n\t\t}\n\t\toptions.onConnect && options.onConnect(connectedTo);\n\t\tconnections.set(key, connectedTo);\n\t}\n\n\treturn connections.get(key);\n};\n\nexport default connectToComponent;\n"],
|
|
5
|
+
"mappings": "aACA,OAAS,kBAAAA,MAAsB,cAG/B,MAAMC,EAA+B,IAC/BC,EAAc,IAAI,IAClBC,EAAY,IAAI,IAShBC,EAAsBC,GAAqD,CAChF,MAAMC,EAAOD,EAAQ,KACfE,EAAWF,EAAQ,SACnBG,EAASF,EAAKC,CAA6B,EAEjD,IAAIE,EACJ,GAAID,IAAW,QAAaA,IAAW,GACtCC,EAAc,eACJD,aAAkB,YAC5BC,EAAcD,MACR,CACN,MAAME,EAAWJ,EAAK,YAAY,EAClCG,EAAeC,EAAS,gBAAkBA,EAAS,eAAeF,CAAM,GAAM,MAC/E,CAEA,MAAMG,EAAM,GAAGL,EAAK,GAAG,IAAIC,CAAQ,GAC7BK,EAAkBV,EAAY,IAAIS,CAAG,EAG3C,GAAI,CAACF,EAAa,CAOjB,GANIG,IACHP,EAAQ,cAAgBA,EAAQ,aAAaO,CAAe,EAC5DV,EAAY,OAAOS,CAAG,GAInB,OAAOH,GAAW,UAAYA,GAAU,CAACL,EAAU,IAAIQ,CAAG,EAAG,CAChE,MAAME,EAAW,YAAY,IAAM,CAClC,MAAMH,EAAWJ,EAAK,YAAY,EACnBI,EAAS,gBAAkBA,EAAS,eAAeF,CAAM,IAGvE,cAAcL,EAAU,IAAIQ,CAAG,CAAC,EAChCR,EAAU,OAAOQ,CAAG,EACpBX,EAAeM,CAAI,EAErB,EAAGL,CAA4B,EAC/BE,EAAU,IAAIQ,EAAKE,CAAQ,CAC5B,CAEA,MACD,CAGA,OAAIV,EAAU,IAAIQ,CAAG,IACpB,cAAcR,EAAU,IAAIQ,CAAG,CAAC,EAChCR,EAAU,OAAOQ,CAAG,GAIjBC,IAAoBH,IACnBG,GACHP,EAAQ,cAAgBA,EAAQ,aAAaO,CAAe,EAE7DP,EAAQ,WAAaA,EAAQ,UAAUI,CAAW,EAClDP,EAAY,IAAIS,EAAKF,CAAW,GAG1BP,EAAY,IAAIS,CAAG,CAC3B,EAEA,eAAeP",
|
|
6
|
+
"names": ["renderDeferred", "MISSING_ELEMENT_POLL_TIMEOUT", "connections", "intervals", "connectToComponent", "options", "host", "propName", "friend", "connectedTo", "rootNode", "key", "prevConnectedTo", "interval"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const m=(a={})=>e=>{if(Object.prototype.hasOwnProperty.call(e,"metadata")||(e.metadata={}),typeof a=="string"){e.metadata.tag=a;return}const{tag:i,languageAware:o,themeAware:s,fastNavigation:r,formAssociated:n,shadowRootOptions:l}=a;e.metadata.tag=i,o&&(e.metadata.languageAware=o),s&&(e.metadata.themeAware=s),r&&(e.metadata.fastNavigation=r),n&&(e.metadata.formAssociated=n),l&&(e.metadata.shadowRootOptions=l),["renderer","template","styles","dependencies"].forEach(t=>{a[t]&&Object.defineProperty(e,t,{get:()=>a[t]})})};export default m;
|
|
2
|
+
//# sourceMappingURL=customElement.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/decorators/customElement.ts"],
|
|
4
|
+
"sourcesContent": ["import type UI5Element from \"../UI5Element.js\";\nimport type { Renderer } from \"../UI5Element.js\";\nimport type { TemplateFunction as Template } from \"../renderer/executeTemplate.js\";\nimport type { ComponentStylesData as Styles } from \"../types.js\";\n\n/**\n * Returns a custom element class decorator.\n *\n * @param { string | object } tagNameOrComponentSettings\n * @returns { ClassDecorator }\n */\nconst customElement = (tagNameOrComponentSettings: string | {\n\ttag?: string,\n\trenderer?: Renderer,\n\tstyles?: Styles,\n\ttemplate?: Template,\n\tdependencies?: Array<typeof UI5Element>,\n\tlanguageAware?: boolean,\n\tthemeAware?: boolean,\n\tfastNavigation?: boolean,\n\tformAssociated?: boolean,\n\tshadowRootOptions?: Partial<ShadowRootInit>,\n} = {}): ClassDecorator => {\n\treturn (target: any) => {\n\t\tif (!Object.prototype.hasOwnProperty.call(target, \"metadata\")) {\n\t\t\ttarget.metadata = {};\n\t\t}\n\n\t\tif (typeof tagNameOrComponentSettings === \"string\") {\n\t\t\ttarget.metadata.tag = tagNameOrComponentSettings;\n\t\t\treturn;\n\t\t}\n\n\t\tconst {\n\t\t\ttag,\n\t\t\tlanguageAware,\n\t\t\tthemeAware,\n\t\t\tfastNavigation,\n\t\t\tformAssociated,\n\t\t\tshadowRootOptions,\n\t\t } = tagNameOrComponentSettings;\n\n\t\ttarget.metadata.tag = tag;\n\t\tif (languageAware) {\n\t\t\ttarget.metadata.languageAware = languageAware;\n\t\t}\n\t\tif (themeAware) {\n\t\t\ttarget.metadata.themeAware = themeAware;\n\t\t}\n\t\tif (fastNavigation) {\n\t\t\ttarget.metadata.fastNavigation = fastNavigation;\n\t\t}\n\t\tif (formAssociated) {\n\t\t\ttarget.metadata.formAssociated = formAssociated;\n\t\t}\n\n\t\tif (shadowRootOptions) {\n\t\t\ttarget.metadata.shadowRootOptions = shadowRootOptions;\n\t\t}\n\n\t\t[\"renderer\", \"template\", \"styles\", \"dependencies\"].forEach((customElementEntity: string) => {\n\t\t\tconst customElementEntityValue = tagNameOrComponentSettings[customElementEntity as keyof typeof tag];\n\n\t\t\tcustomElementEntityValue && Object.defineProperty(target, customElementEntity, {\n\t\t\t\tget: () => tagNameOrComponentSettings[customElementEntity as keyof typeof tag],\n\t\t\t});\n\t\t});\n\t};\n};\n\nexport default customElement;\n"],
|
|
5
|
+
"mappings": "aAWA,MAAMA,EAAgB,CAACC,EAWnB,CAAC,IACIC,GAAgB,CAKvB,GAJK,OAAO,UAAU,eAAe,KAAKA,EAAQ,UAAU,IAC3DA,EAAO,SAAW,CAAC,GAGhB,OAAOD,GAA+B,SAAU,CACnDC,EAAO,SAAS,IAAMD,EACtB,MACD,CAEA,KAAM,CACL,IAAAE,EACA,cAAAC,EACA,WAAAC,EACA,eAAAC,EACA,eAAAC,EACA,kBAAAC,CACA,EAAIP,EAELC,EAAO,SAAS,IAAMC,EAClBC,IACHF,EAAO,SAAS,cAAgBE,GAE7BC,IACHH,EAAO,SAAS,WAAaG,GAE1BC,IACHJ,EAAO,SAAS,eAAiBI,GAE9BC,IACHL,EAAO,SAAS,eAAiBK,GAG9BC,IACHN,EAAO,SAAS,kBAAoBM,GAGrC,CAAC,WAAY,WAAY,SAAU,cAAc,EAAE,QAASC,GAAgC,CAC1DR,EAA2BQ,CAAuC,GAEvE,OAAO,eAAeP,EAAQO,EAAqB,CAC9E,IAAK,IAAMR,EAA2BQ,CAAuC,CAC9E,CAAC,CACF,CAAC,CACF,EAGD,eAAeT",
|
|
6
|
+
"names": ["customElement", "tagNameOrComponentSettings", "target", "tag", "languageAware", "themeAware", "fastNavigation", "formAssociated", "shadowRootOptions", "customElementEntity"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/decorators/event.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Returns an event class decorator.\n *\n * @param { string } name the event name\n * @param { EventData } data the event data\n * @returns { ClassDecorator }\n */\nconst event = <EventDetail>(name: string, data: { detail?: Record<keyof EventDetail, { type: any }> } = {}): ClassDecorator => {\n\treturn (target: any) => {\n\t\tif (!Object.prototype.hasOwnProperty.call(target, \"metadata\")) {\n\t\t\ttarget.metadata = {};\n\t\t}\n\n\t\tconst metadata = target.metadata;\n\t\tif (!metadata.events) {\n\t\t\tmetadata.events = {};\n\t\t}\n\n\t\tconst eventsMetadata = metadata.events;\n\t\tif (!eventsMetadata[name]) {\n\t\t\teventsMetadata[name] = data;\n\t\t}\n\t};\n};\n\nexport default event;\n"],
|
|
5
|
+
"mappings": "aAOA,MAAMA,EAAQ,CAAcC,EAAcC,EAA8D,CAAC,IAChGC,GAAgB,CAClB,OAAO,UAAU,eAAe,KAAKA,EAAQ,UAAU,IAC3DA,EAAO,SAAW,CAAC,GAGpB,MAAMC,EAAWD,EAAO,SACnBC,EAAS,SACbA,EAAS,OAAS,CAAC,GAGpB,MAAMC,EAAiBD,EAAS,OAC3BC,EAAeJ,CAAI,IACvBI,EAAeJ,CAAI,EAAIC,EAEzB,EAGD,eAAeF",
|
|
6
|
+
"names": ["event", "name", "data", "target", "metadata", "eventsMetadata"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const s=a=>(p,e)=>{const t=p.constructor;Object.prototype.hasOwnProperty.call(t,"metadata")||(t.metadata={});const r=t.metadata;r.properties||(r.properties={});const o=r.properties;o[e]||(o[e]=a||{type:String})};export default s;
|
|
2
|
+
//# sourceMappingURL=property.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/decorators/property.ts"],
|
|
4
|
+
"sourcesContent": ["import type UI5Element from \"../UI5Element.js\";\nimport { Property } from \"../UI5ElementMetadata.js\";\n\n/**\n * Returns a property decorator.\n *\n * @param { Property } propData\n * @returns { PropertyDecorator }\n */\nconst property = (propData?: Property): PropertyDecorator => {\n\treturn (target: any, propertyKey: string | symbol) => {\n\t\tconst ctor = target.constructor as typeof UI5Element;\n\n\t\tif (!Object.prototype.hasOwnProperty.call(ctor, \"metadata\")) {\n\t\t\tctor.metadata = {};\n\t\t}\n\n\t\tconst metadata = ctor.metadata;\n\t\tif (!metadata.properties) {\n\t\t\tmetadata.properties = {};\n\t\t}\n\n\t\tconst propsMetadata = metadata.properties;\n\t\tif (!propsMetadata[propertyKey as string]) {\n\t\t\tpropsMetadata[propertyKey as string] = propData || { type: String };\n\t\t}\n\t};\n};\n\nexport default property;\n"],
|
|
5
|
+
"mappings": "aASA,MAAMA,EAAYC,GACV,CAACC,EAAaC,IAAiC,CACrD,MAAMC,EAAOF,EAAO,YAEf,OAAO,UAAU,eAAe,KAAKE,EAAM,UAAU,IACzDA,EAAK,SAAW,CAAC,GAGlB,MAAMC,EAAWD,EAAK,SACjBC,EAAS,aACbA,EAAS,WAAa,CAAC,GAGxB,MAAMC,EAAgBD,EAAS,WAC1BC,EAAcH,CAAqB,IACvCG,EAAcH,CAAqB,EAAIF,GAAY,CAAE,KAAM,MAAO,EAEpE,EAGD,eAAeD",
|
|
6
|
+
"names": ["property", "propData", "target", "propertyKey", "ctor", "metadata", "propsMetadata"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const f=e=>(l,n)=>{const r=l.constructor;Object.prototype.hasOwnProperty.call(r,"metadata")||(r.metadata={});const o=r.metadata;o.slots||(o.slots={});const t=o.slots;if(e&&e.default&&t.default)throw new Error("Only one slot can be the default slot.");const a=e&&e.default?"default":n;e=e||{type:HTMLElement},e.type||(e.type=HTMLElement),t[a]||(t[a]=e),e.default&&(delete t.default.default,t.default.propertyName=n),r.metadata.managedSlots=!0};export default f;
|
|
2
|
+
//# sourceMappingURL=slot.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/decorators/slot.ts"],
|
|
4
|
+
"sourcesContent": ["import type UI5Element from \"../UI5Element.js\";\nimport { Slot } from \"../UI5ElementMetadata.js\";\n\n/**\n * Returns a slot decorator.\n *\n * @param { Slot } slotData\n * @returns { PropertyDecorator }\n */\nconst slot = (slotData?: Slot): PropertyDecorator => {\n\treturn (target: any, slotKey: string | symbol) => {\n\t\tconst ctor = target.constructor as typeof UI5Element;\n\n\t\tif (!Object.prototype.hasOwnProperty.call(ctor, \"metadata\")) {\n\t\t\tctor.metadata = {};\n\t\t}\n\n\t\tconst metadata = ctor.metadata;\n\t\tif (!metadata.slots) {\n\t\t\tmetadata.slots = {};\n\t\t}\n\n\t\tconst slotMetadata = metadata.slots;\n\n\t\tif (slotData && slotData.default && slotMetadata.default) {\n\t\t\tthrow new Error(\"Only one slot can be the default slot.\");\n\t\t}\n\n\t\tconst key = slotData && slotData.default ? \"default\" : slotKey as string;\n\t\tslotData = slotData || { type: HTMLElement };\n\n\t\tif (!slotData.type) {\n\t\t\tslotData.type = HTMLElement;\n\t\t}\n\n\t\tif (!slotMetadata[key]) {\n\t\t\tslotMetadata[key] = slotData;\n\t\t}\n\n\t\tif (slotData.default) {\n\t\t\tdelete slotMetadata.default.default;\n\t\t\tslotMetadata.default.propertyName = slotKey as string;\n\t\t}\n\n\t\tctor.metadata.managedSlots = true;\n\t};\n};\n\nexport default slot;\n"],
|
|
5
|
+
"mappings": "aASA,MAAMA,EAAQC,GACN,CAACC,EAAaC,IAA6B,CACjD,MAAMC,EAAOF,EAAO,YAEf,OAAO,UAAU,eAAe,KAAKE,EAAM,UAAU,IACzDA,EAAK,SAAW,CAAC,GAGlB,MAAMC,EAAWD,EAAK,SACjBC,EAAS,QACbA,EAAS,MAAQ,CAAC,GAGnB,MAAMC,EAAeD,EAAS,MAE9B,GAAIJ,GAAYA,EAAS,SAAWK,EAAa,QAChD,MAAM,IAAI,MAAM,wCAAwC,EAGzD,MAAMC,EAAMN,GAAYA,EAAS,QAAU,UAAYE,EACvDF,EAAWA,GAAY,CAAE,KAAM,WAAY,EAEtCA,EAAS,OACbA,EAAS,KAAO,aAGZK,EAAaC,CAAG,IACpBD,EAAaC,CAAG,EAAIN,GAGjBA,EAAS,UACZ,OAAOK,EAAa,QAAQ,QAC5BA,EAAa,QAAQ,aAAeH,GAGrCC,EAAK,SAAS,aAAe,EAC9B,EAGD,eAAeJ",
|
|
6
|
+
"names": ["slot", "slotData", "target", "slotKey", "ctor", "metadata", "slotMetadata", "key"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/decorators.ts"],
|
|
4
|
+
"sourcesContent": ["import customElement from \"./decorators/customElement.js\";\nimport event from \"./decorators/event.js\";\nimport property from \"./decorators/property.js\";\nimport slot from \"./decorators/slot.js\";\n\nexport {\n\tcustomElement,\n\tevent,\n\tproperty,\n\tslot,\n};\n"],
|
|
5
|
+
"mappings": "aAAA,OAAOA,MAAmB,gCAC1B,OAAOC,MAAW,wBAClB,OAAOC,MAAc,2BACrB,OAAOC,MAAU,uBAEjB,OACCH,KAAA,cACAC,KAAA,MACAC,KAAA,SACAC,KAAA",
|
|
6
|
+
"names": ["customElement", "event", "property", "slot"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";import{isDown as _,isUp as d,isLeft as h,isRight as a,isHome as I,isEnd as c,isPageDown as m,isPageUp as l}from"../Keys.js";import u from"../util/getActiveElement.js";import n from"../types/NavigationMode.js";import r from"../types/ItemNavigationBehavior.js";import{instanceOfUI5Element as g}from"../UI5Element.js";class f{constructor(e,t){if(!e.isUI5Element)throw new Error("The root web component must be a UI5 Element instance");if(this.rootWebComponent=e,this.rootWebComponent.addEventListener("keydown",this._onkeydown.bind(this)),this._initBound=this._init.bind(this),this.rootWebComponent.attachComponentStateFinalized(this._initBound),typeof t.getItemsCallback!="function")throw new Error("getItemsCallback is required");this._getItems=t.getItemsCallback,this._currentIndex=t.currentIndex||0,this._rowSize=t.rowSize||1,this._behavior=t.behavior||r.Static,this._navigationMode=t.navigationMode||n.Auto,this._affectedPropertiesNames=t.affectedPropertiesNames||[],this._skipItemsSize=t.skipItemsSize||null}setCurrentItem(e){const t=this._getItems().indexOf(e);if(t===-1){console.warn("The provided item is not managed by ItemNavigation",e);return}this._currentIndex=t,this._applyTabIndex()}setRowSize(e){this._rowSize=e}_init(){this._getItems().forEach((e,t)=>{e.forcedTabIndex=t===this._currentIndex?"0":"-1"})}_onkeydown(e){if(!this._canNavigate())return;const t=this._navigationMode===n.Horizontal||this._navigationMode===n.Auto,i=this._navigationMode===n.Vertical||this._navigationMode===n.Auto,s=this.rootWebComponent.effectiveDir==="rtl";if(s&&h(e)&&t)this._handleRight();else if(s&&a(e)&&t)this._handleLeft();else if(h(e)&&t)this._handleLeft();else if(a(e)&&t)this._handleRight();else if(d(e)&&i)this._handleUp();else if(_(e)&&i)this._handleDown();else if(I(e))this._handleHome();else if(c(e))this._handleEnd();else if(l(e))this._handlePageUp();else if(m(e))this._handlePageDown();else return;e.preventDefault(),this._applyTabIndex(),this._focusCurrentItem()}_handleUp(){const e=this._getItems().length;if(this._currentIndex-this._rowSize>=0){this._currentIndex-=this._rowSize;return}if(this._behavior===r.Cyclic){const t=this._currentIndex%this._rowSize,i=t===0?this._rowSize-1:t-1,s=Math.ceil(e/this._rowSize);let o=i+(s-1)*this._rowSize;o>e-1&&(o-=this._rowSize),this._currentIndex=o}else this._currentIndex=0}_handleDown(){const e=this._getItems().length;if(this._currentIndex+this._rowSize<e){this._currentIndex+=this._rowSize;return}if(this._behavior===r.Cyclic){const i=(this._currentIndex%this._rowSize+1)%this._rowSize;this._currentIndex=i}else this._currentIndex=e-1}_handleLeft(){const e=this._getItems().length;if(this._currentIndex>0){this._currentIndex-=1;return}this._behavior===r.Cyclic&&(this._currentIndex=e-1)}_handleRight(){const e=this._getItems().length;if(this._currentIndex<e-1){this._currentIndex+=1;return}this._behavior===r.Cyclic&&(this._currentIndex=0)}_handleHome(){const e=this._rowSize>1?this._rowSize:this._getItems().length;this._currentIndex-=this._currentIndex%e}_handleEnd(){const e=this._rowSize>1?this._rowSize:this._getItems().length;this._currentIndex+=e-1-this._currentIndex%e}_handlePageUp(){this._rowSize>1||this._handlePageUpFlat()}_handlePageDown(){this._rowSize>1||this._handlePageDownFlat()}_handlePageUpFlat(){if(this._skipItemsSize===null){this._currentIndex-=this._currentIndex;return}this._currentIndex+1>this._skipItemsSize?this._currentIndex-=this._skipItemsSize:this._currentIndex-=this._currentIndex}_handlePageDownFlat(){if(this._skipItemsSize===null){this._currentIndex=this._getItems().length-1;return}this._getItems().length-this._currentIndex-1>this._skipItemsSize?this._currentIndex+=this._skipItemsSize:this._currentIndex=this._getItems().length-1}_applyTabIndex(){const e=this._getItems();for(let t=0;t<e.length;t++)e[t].forcedTabIndex=t===this._currentIndex?"0":"-1";this._affectedPropertiesNames.forEach(t=>{const i=this.rootWebComponent[t];this.rootWebComponent[t]=Array.isArray(i)?[...i]:{...i}})}_focusCurrentItem(){const e=this._getCurrentItem();e&&e.focus()}_canNavigate(){const e=this._getCurrentItem(),t=u();return e&&e===t}_getCurrentItem(){const e=this._getItems();if(!e.length)return;for(;this._currentIndex>=e.length;)this._currentIndex-=this._rowSize;this._currentIndex<0&&(this._currentIndex=0);const t=e[this._currentIndex];if(!t)return;if(g(t))return t.getFocusDomRef();const i=this.rootWebComponent.getDomRef();if(i&&t.id)return i.querySelector(`[id="${t.id}"]`)}}export default f;export{};
|
|
2
|
+
//# sourceMappingURL=ItemNavigation.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/delegate/ItemNavigation.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n\tisDown,\n\tisUp,\n\tisLeft,\n\tisRight,\n\tisHome,\n\tisEnd,\n\tisPageDown,\n\tisPageUp,\n} from \"../Keys.js\";\nimport getActiveElement from \"../util/getActiveElement.js\";\n\nimport NavigationMode from \"../types/NavigationMode.js\";\nimport ItemNavigationBehavior from \"../types/ItemNavigationBehavior.js\";\n\nimport type UI5Element from \"../UI5Element.js\";\nimport { instanceOfUI5Element } from \"../UI5Element.js\";\n\ninterface ITabbable {\n\tid: string,\n\tforcedTabIndex: string,\n}\n\ntype ItemNavigationOptions = {\n\tcurrentIndex?: number,\n\tnavigationMode?: NavigationMode,\n\trowSize?: number\n\tskipItemsSize?: number,\n\tbehavior?: ItemNavigationBehavior,\n\tgetItemsCallback: () => Array<ITabbable>,\n\taffectedPropertiesNames?: Array<string>,\n};\n\n/**\n * The ItemNavigation class manages the calculations to determine the correct \"tabindex\" for a group of related items inside a root component.\n * Important: ItemNavigation only does the calculations and does not change \"tabindex\" directly, this is a responsibility of the developer.\n *\n * The keys that trigger ItemNavigation are:\n * - Up/down\n * - Left/right\n * - Home/End\n *\n * Usage:\n * 1) Use the \"getItemsCallback\" constructor property to pass a callback to ItemNavigation, which, whenever called, will return the list of items to navigate among.\n *\n * Each item passed to ItemNavigation via \"getItemsCallback\" must be:\n * - A) either a UI5Element with a \"forcedTabIndex\" property\n * - B) or an Object with \"id\" and \"forcedTabIndex\" properties which represents a part of the root component's shadow DOM.\n * The \"id\" must be a valid ID within the shadow root of the component ItemNavigation operates on.\n * This object must not be a DOM object because, as said, ItemNavigation will not set \"tabindex\" on it. It must be a representation of a DOM object only\n * and the developer has the responsibility to update the \"tabindex\" in the component's DOM.\n * - C) a combination of the above\n *\n * Whenever the user navigates with the keyboard, ItemNavigation will modify the \"forcedTabIndex\" properties of the items.\n * It is the items' responsibilities to re-render themselves and apply the correct value of \"tabindex\" (i.e. to map the \"forcedTabIndex\" ItemNavigation set to them to the \"tabindex\" property).\n * If the items of the ItemNavigation are UI5Elements themselves, this can happen naturally since they will be invalidated by their \"forcedTabIndex\" property.\n * If the items are Objects with \"id\" and \"forcedTabIndex\" however, it is the developer's responsibility to apply these and the easiest way is to have the root component invalidated by ItemNavigation.\n * To do so, set the \"affectedPropertiesNames\" constructor property to point to one or more of the root component's properties that need refreshing when \"forcedTabIndex\" is changed deeply.\n *\n * 2) Call the \"setCurrentItem\" method of ItemNavigation whenever you want to change the current item.\n * This is most commonly required if the user for example clicks on an item and thus selects it directly.\n * Pass as the only argument to \"setCurrentItem\" the item that becomes current (must be one of the items, returned by \"getItemsCallback\").\n *\n * @class\n * @public\n */\nclass ItemNavigation {\n\trootWebComponent: UI5Element;\n\n\t_getItems: () => Array<ITabbable>;\n\n\t_currentIndex: number;\n\n\t_rowSize: number;\n\n\t_behavior: ItemNavigationBehavior;\n\n\t_navigationMode: NavigationMode;\n\n\t_affectedPropertiesNames: Array<string>;\n\n\t_skipItemsSize: number | null;\n\n\t_initBound: () => void;\n\n\t/**\n\t *\n\t * @param rootWebComponent the component to operate on (component that slots or contains within its shadow root the items the user navigates among)\n\t * @param {ItemNavigationOptions} options Object with configuration options:\n\t * - currentIndex: the index of the item that will be initially selected (from which navigation will begin)\n\t * - navigationMode (Auto|Horizontal|Vertical): whether the items are displayed horizontally (Horizontal), vertically (Vertical) or as a matrix (Auto) meaning the user can navigate in both directions (up/down and left/right)\n\t * - rowSize: tells how many items per row there are when the items are not rendered as a flat list but rather as a matrix. Relevant for navigationMode=Auto\n\t * \t- skipItemsSize: tells how many items upon PAGE_UP and PAGE_DOWN should be skipped to applying the focus on the next item\n\t * - behavior (Static|Cycling): tells what to do when trying to navigate beyond the first and last items\n\t * Static means that nothing happens if the user tries to navigate beyond the first/last item.\n\t * Cycling means that when the user navigates beyond the last item they go to the first and vice versa.\n\t * - getItemsCallback: function that, when called, returns an array with all items the user can navigate among\n\t * - affectedPropertiesNames: a list of metadata properties on the root component which, upon user navigation, will be reassigned by address thus causing the root component to invalidate\n\t */\n\tconstructor(rootWebComponent: UI5Element, options: ItemNavigationOptions) {\n\t\tif (!rootWebComponent.isUI5Element) {\n\t\t\tthrow new Error(\"The root web component must be a UI5 Element instance\");\n\t\t}\n\n\t\tthis.rootWebComponent = rootWebComponent;\n\t\tthis.rootWebComponent.addEventListener(\"keydown\", this._onkeydown.bind(this));\n\t\tthis._initBound = this._init.bind(this);\n\t\tthis.rootWebComponent.attachComponentStateFinalized(this._initBound);\n\n\t\tif (typeof options.getItemsCallback !== \"function\") {\n\t\t\tthrow new Error(\"getItemsCallback is required\");\n\t\t}\n\n\t\tthis._getItems = options.getItemsCallback;\n\t\tthis._currentIndex = options.currentIndex || 0;\n\t\tthis._rowSize = options.rowSize || 1;\n\t\tthis._behavior = options.behavior || ItemNavigationBehavior.Static;\n\t\tthis._navigationMode = options.navigationMode || NavigationMode.Auto;\n\t\tthis._affectedPropertiesNames = options.affectedPropertiesNames || [];\n\t\tthis._skipItemsSize = options.skipItemsSize || null;\n\t}\n\n\t/**\n\t * Call this method to set a new \"current\" (selected) item in the item navigation\n\t * Note: the item passed to this function must be one of the items, returned by the getItemsCallback function\n\t *\n\t * @public\n\t * @param current the new selected item\n\t */\n\tsetCurrentItem(current: ITabbable): void {\n\t\tconst currentItemIndex = this._getItems().indexOf(current);\n\n\t\tif (currentItemIndex === -1) {\n\t\t\tconsole.warn(`The provided item is not managed by ItemNavigation`, current); // eslint-disable-line\n\t\t\treturn;\n\t\t}\n\n\t\tthis._currentIndex = currentItemIndex;\n\t\tthis._applyTabIndex();\n\t}\n\n\t/**\n\t * Call this method to dynamically change the row size\n\t *\n\t * @public\n\t * @param newRowSize\n\t */\n\tsetRowSize(newRowSize: number): void {\n\t\tthis._rowSize = newRowSize;\n\t}\n\n\t_init() {\n\t\tthis._getItems().forEach((item, idx) => {\n\t\t\titem.forcedTabIndex = (idx === this._currentIndex) ? \"0\" : \"-1\";\n\t\t});\n\t}\n\n\t_onkeydown(event: KeyboardEvent) {\n\t\tif (!this._canNavigate()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst horizontalNavigationOn = this._navigationMode === NavigationMode.Horizontal || this._navigationMode === NavigationMode.Auto;\n\t\tconst verticalNavigationOn = this._navigationMode === NavigationMode.Vertical || this._navigationMode === NavigationMode.Auto;\n\t\tconst isRTL = this.rootWebComponent.effectiveDir === \"rtl\";\n\n\t\tif (isRTL && isLeft(event) && horizontalNavigationOn) {\n\t\t\tthis._handleRight();\n\t\t} else if (isRTL && isRight(event) && horizontalNavigationOn) {\n\t\t\tthis._handleLeft();\n\t\t} else if (isLeft(event) && horizontalNavigationOn) {\n\t\t\tthis._handleLeft();\n\t\t} else if (isRight(event) && horizontalNavigationOn) {\n\t\t\tthis._handleRight();\n\t\t} else if (isUp(event) && verticalNavigationOn) {\n\t\t\tthis._handleUp();\n\t\t} else if (isDown(event) && verticalNavigationOn) {\n\t\t\tthis._handleDown();\n\t\t} else if (isHome(event)) {\n\t\t\tthis._handleHome();\n\t\t} else if (isEnd(event)) {\n\t\t\tthis._handleEnd();\n\t\t} else if (isPageUp(event)) {\n\t\t\tthis._handlePageUp();\n\t\t} else if (isPageDown(event)) {\n\t\t\tthis._handlePageDown();\n\t\t} else {\n\t\t\treturn; // if none of the supported keys is pressed, we don't want to prevent the event or update the item navigation\n\t\t}\n\n\t\tevent.preventDefault();\n\t\tthis._applyTabIndex();\n\t\tthis._focusCurrentItem();\n\t}\n\n\t_handleUp() {\n\t\tconst itemsLength = this._getItems().length;\n\t\tif (this._currentIndex - this._rowSize >= 0) { // no border reached, just decrease the index by a row\n\t\t\tthis._currentIndex -= this._rowSize;\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._behavior === ItemNavigationBehavior.Cyclic) { // if cyclic, go to the **last** item in the **previous** column\n\t\t\tconst firstItemInThisColumnIndex = this._currentIndex % this._rowSize;\n\t\t\tconst firstItemInPreviousColumnIndex = firstItemInThisColumnIndex === 0 ? this._rowSize - 1 : firstItemInThisColumnIndex - 1; // find the first item in the previous column (if the current column is the first column -> move to the last column)\n\t\t\tconst rows = Math.ceil(itemsLength / this._rowSize); // how many rows there are (even if incomplete, f.e. for 14 items and _rowSize=4 -> 4 rows total, although only 2 items on the last row)\n\t\t\tlet lastItemInPreviousColumnIndex = firstItemInPreviousColumnIndex + (rows - 1) * this._rowSize; // multiply rows by columns, and add the column's first item's index\n\t\t\tif (lastItemInPreviousColumnIndex > itemsLength - 1) { // for incomplete rows, use the previous row's last item, as for them the last item is missing\n\t\t\t\tlastItemInPreviousColumnIndex -= this._rowSize;\n\t\t\t}\n\t\t\tthis._currentIndex = lastItemInPreviousColumnIndex;\n\t\t} else { // not cyclic, so just go to the first item\n\t\t\tthis._currentIndex = 0;\n\t\t}\n\t}\n\n\t_handleDown() {\n\t\tconst itemsLength = this._getItems().length;\n\t\tif (this._currentIndex + this._rowSize < itemsLength) { // no border reached, just increase the index by a row\n\t\t\tthis._currentIndex += this._rowSize;\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._behavior === ItemNavigationBehavior.Cyclic) { // if cyclic, go to the **first** item in the **next** column\n\t\t\tconst firstItemInThisColumnIndex = this._currentIndex % this._rowSize; // find the first item in the current column first\n\t\t\tconst firstItemInNextColumnIndex = (firstItemInThisColumnIndex + 1) % this._rowSize; // to get the first item in the next column, just increase the index by 1. The modulo by rows is for the case when we are at the last column\n\t\t\tthis._currentIndex = firstItemInNextColumnIndex;\n\t\t} else { // not cyclic, so just go to the last item\n\t\t\tthis._currentIndex = itemsLength - 1;\n\t\t}\n\t}\n\n\t_handleLeft() {\n\t\tconst itemsLength = this._getItems().length;\n\t\tif (this._currentIndex > 0) {\n\t\t\tthis._currentIndex -= 1;\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._behavior === ItemNavigationBehavior.Cyclic) { // go to the first item in the next column\n\t\t\tthis._currentIndex = itemsLength - 1;\n\t\t}\n\t}\n\n\t_handleRight() {\n\t\tconst itemsLength = this._getItems().length;\n\t\tif (this._currentIndex < itemsLength - 1) {\n\t\t\tthis._currentIndex += 1;\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._behavior === ItemNavigationBehavior.Cyclic) { // go to the first item in the next column\n\t\t\tthis._currentIndex = 0;\n\t\t}\n\t}\n\n\t_handleHome() {\n\t\tconst homeEndRange = this._rowSize > 1 ? this._rowSize : this._getItems().length;\n\t\tthis._currentIndex -= this._currentIndex % homeEndRange;\n\t}\n\n\t_handleEnd() {\n\t\tconst homeEndRange = this._rowSize > 1 ? this._rowSize : this._getItems().length;\n\t\tthis._currentIndex += (homeEndRange - 1 - this._currentIndex % homeEndRange); // eslint-disable-line\n\t}\n\n\t_handlePageUp() {\n\t\tif (this._rowSize > 1) {\n\t\t\t// eslint-disable-next-line\n\t\t\t// TODO: handle page up on matrix (grid) layout - ColorPalette, ProductSwitch.\n\t\t\treturn;\n\t\t}\n\t\tthis._handlePageUpFlat();\n\t}\n\n\t_handlePageDown() {\n\t\tif (this._rowSize > 1) {\n\t\t\t// eslint-disable-next-line\n\t\t\t// TODO: handle page up on matrix (grid) layout - ColorPalette, ProductSwitch.\n\t\t\treturn;\n\t\t}\n\t\tthis._handlePageDownFlat();\n\t}\n\n\t/**\n\t * Handles PAGE_UP in a flat list-like structure, both vertically and horizontally.\n\t */\n\t_handlePageUpFlat() {\n\t\tif (this._skipItemsSize === null) {\n\t\t\t// Move the focus to the very top (as Home).\n\t\t\tthis._currentIndex -= this._currentIndex;\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._currentIndex + 1 > this._skipItemsSize) {\n\t\t\t// When there are more than \"skipItemsSize\" number of items to the top,\n\t\t\t// move the focus up/left with the predefined number.\n\t\t\tthis._currentIndex -= this._skipItemsSize;\n\t\t} else {\n\t\t\t// Otherwise, move the focus to the very top (as Home).\n\t\t\tthis._currentIndex -= this._currentIndex;\n\t\t}\n\t}\n\n\t/**\n\t * Handles PAGE_DOWN in a flat list-like structure, both vertically and horizontally.\n\t */\n\t_handlePageDownFlat() {\n\t\tif (this._skipItemsSize === null) {\n\t\t\t// Move the focus to the very bottom (as End).\n\t\t\tthis._currentIndex = this._getItems().length - 1;\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentToEndRange = this._getItems().length - this._currentIndex - 1;\n\n\t\tif (currentToEndRange > this._skipItemsSize) {\n\t\t\t// When there are more than \"skipItemsSize\" number of items until the bottom,\n\t\t\t// move the focus down/right with the predefined number.\n\t\t\tthis._currentIndex += this._skipItemsSize;\n\t\t} else {\n\t\t\t// Otherwise, move the focus to the very bottom (as End).\n\t\t\tthis._currentIndex = this._getItems().length - 1;\n\t\t}\n\t}\n\n\t_applyTabIndex() {\n\t\tconst items = this._getItems();\n\t\tfor (let i = 0; i < items.length; i++) {\n\t\t\titems[i].forcedTabIndex = i === this._currentIndex ? \"0\" : \"-1\";\n\t\t}\n\n\t\tthis._affectedPropertiesNames.forEach(propName => {\n\t\t\tconst prop = (this.rootWebComponent as Record<string, any>)[propName];\n\t\t\t(this.rootWebComponent as Record<string, any>)[propName] = Array.isArray(prop) ? [...prop] : { ...prop };\n\t\t});\n\t}\n\n\t_focusCurrentItem() {\n\t\tconst currentItem = this._getCurrentItem();\n\t\tif (currentItem) {\n\t\t\tcurrentItem.focus();\n\t\t}\n\t}\n\n\t_canNavigate() {\n\t\tconst currentItem = this._getCurrentItem();\n\t\tconst activeElement = getActiveElement();\n\n\t\treturn currentItem && currentItem === activeElement;\n\t}\n\n\t_getCurrentItem() {\n\t\tconst items = this._getItems();\n\n\t\tif (!items.length) {\n\t\t\treturn;\n\t\t}\n\n\t\t// normalize the index\n\t\twhile (this._currentIndex >= items.length) {\n\t\t\tthis._currentIndex -= this._rowSize;\n\t\t}\n\n\t\tif (this._currentIndex < 0) {\n\t\t\tthis._currentIndex = 0;\n\t\t}\n\n\t\tconst currentItem = items[this._currentIndex];\n\n\t\tif (!currentItem) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (instanceOfUI5Element(currentItem)) {\n\t\t\treturn currentItem.getFocusDomRef();\n\t\t}\n\n\t\tconst currentItemDOMRef = this.rootWebComponent.getDomRef();\n\t\tif (!currentItemDOMRef) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (currentItem.id) {\n\t\t\treturn currentItemDOMRef.querySelector(`[id=\"${currentItem.id}\"]`) as HTMLElement;\n\t\t}\n\t}\n}\n\nexport default ItemNavigation;\n\nexport {\n\tITabbable,\n};\n"],
|
|
5
|
+
"mappings": "aAAA,OACC,UAAAA,EACA,QAAAC,EACA,UAAAC,EACA,WAAAC,EACA,UAAAC,EACA,SAAAC,EACA,cAAAC,EACA,YAAAC,MACM,aACP,OAAOC,MAAsB,8BAE7B,OAAOC,MAAoB,6BAC3B,OAAOC,MAA4B,qCAGnC,OAAS,wBAAAC,MAA4B,mBAkDrC,MAAMC,CAAe,CAiCpB,YAAYC,EAA8BC,EAAgC,CACzE,GAAI,CAACD,EAAiB,aACrB,MAAM,IAAI,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AQC,GAAY,CACjD,MAAMC,EAAQ,KAAK,iBAAyCD,CAAQ,EACnE,KAAK,iBAAyCA,CAAQ,EAAI,MAAM,QAAQC,CAAI,EAAI,CAAC,GAAGA,CAAI,EAAI,CAAE,GAAGA,CAAK,CACxG,CAAC,CACF,CAEA,mBAAoB,CACnB,MAAMC,EAAc,KAAK,gBAAgB,EACrCA,GACHA,EAAY,MAAM,CAEpB,CAEA,cAAe,CACd,MAAMA,EAAc,KAAK,gBAAgB,EACnCC,EAAgB5B,EAAiB,EAEvC,OAAO2B,GAAeA,IAAgBC,CACvC,CAEA,iBAAkB,CACjB,MAAML,EAAQ,KAAK,UAAU,EAE7B,GAAI,CAACA,EAAM,OACV,OAID,KAAO,KAAK,eAAiBA,EAAM,QAClC,KAAK,eAAiB,KAAK,SAGxB,KAAK,cAAgB,IACxB,KAAK,cAAgB,GAGtB,MAAMI,EAAcJ,EAAM,KAAK,aAAa,EAE5C,GAAI,CAACI,EACJ,OAGD,GAAIxB,EAAqBwB,CAAW,EACnC,OAAOA,EAAY,eAAe,EAGnC,MAAME,EAAoB,KAAK,iBAAiB,UAAU,EAC1D,GAAKA,GAIDF,EAAY,GACf,OAAOE,EAAkB,cAAc,QAAQF,EAAY,EAAE,IAAI,CAEnE,CACD,CAEA,eAAevB,EAEf",
|
|
6
|
+
"names": ["isDown", "isUp", "isLeft", "isRight", "isHome", "isEnd", "isPageDown", "isPageUp", "getActiveElement", "NavigationMode", "ItemNavigationBehavior", "instanceOfUI5Element", "ItemNavigation", "rootWebComponent", "options", "current", "currentItemIndex", "newRowSize", "item", "idx", "event", "horizontalNavigationOn", "verticalNavigationOn", "isRTL", "itemsLength", "firstItemInThisColumnIndex", "firstItemInPreviousColumnIndex", "rows", "lastItemInPreviousColumnIndex", "firstItemInNextColumnIndex", "homeEndRange", "items", "i", "propName", "prop", "currentItem", "activeElement", "currentItemDOMRef"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";import{instanceOfUI5Element as i}from"../UI5Element.js";let n;const l=new Map,a=()=>(n||(n=new window.ResizeObserver(r=>{window.requestAnimationFrame(()=>{r.forEach(t=>{const s=l.get(t.target);s&&Promise.all(s.map(e=>e()))})})})),n),c=(r,t)=>{const s=l.get(r)||[];s.length||a().observe(r),l.set(r,[...s,t])},b=(r,t)=>{const s=l.get(r)||[];if(s.length===0)return;const e=s.filter(o=>o!==t);e.length===0?(a().unobserve(r),l.delete(r)):l.set(r,e)};class f{static register(t,s){let e=t;i(e)&&(e=e.getDomRef()),e instanceof HTMLElement?c(e,s):console.warn("Cannot register ResizeHandler for element",t)}static deregister(t,s){let e=t;i(e)&&(e=e.getDomRef()),e instanceof HTMLElement?b(e,s):console.warn("Cannot deregister ResizeHandler for element",t)}}export default f;
|
|
2
|
+
//# sourceMappingURL=ResizeHandler.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/delegate/ResizeHandler.ts"],
|
|
4
|
+
"sourcesContent": ["import { instanceOfUI5Element } from \"../UI5Element.js\";\n\ntype ResizeObserverCallback = () => Promise<void> | void;\n\nlet resizeObserver: ResizeObserver;\nconst observedElements = new Map<HTMLElement, Array<ResizeObserverCallback>>();\n\nconst getResizeObserver = () => {\n\tif (!resizeObserver) {\n\t\tresizeObserver = new window.ResizeObserver(entries => {\n\t\t\twindow.requestAnimationFrame(() => {\n\t\t\t\tentries.forEach(entry => {\n\t\t\t\t\tconst callbacks = observedElements.get(entry.target as HTMLElement);\n\t\t\t\t\t// Callbacks could be async and we need to handle returned promises to comply with the eslint \"no-misused-promises\" rule.\n\t\t\t\t\t// Although Promise.all awaits all, we don't await the additional task after calling the callbacks and should not make any difference.\n\t\t\t\t\tcallbacks && Promise.all(callbacks.map((callback: ResizeObserverCallback) => callback()));\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t}\n\treturn resizeObserver;\n};\n\nconst observe = (element: HTMLElement, callback: ResizeObserverCallback) => {\n\tconst callbacks = observedElements.get(element) || [];\n\n\t// if no callbacks have been added for this element - start observing it\n\tif (!callbacks.length) {\n\t\tgetResizeObserver().observe(element);\n\t}\n\n\t// save the callbacks in an array\n\tobservedElements.set(element, [...callbacks, callback]);\n};\n\nconst unobserve = (element: HTMLElement, callback: ResizeObserverCallback) => {\n\tconst callbacks = observedElements.get(element) || [];\n\tif (callbacks.length === 0) {\n\t\treturn;\n\t}\n\n\tconst filteredCallbacks = callbacks.filter((fn: ResizeObserverCallback) => fn !== callback);\n\tif (filteredCallbacks.length === 0) {\n\t\tgetResizeObserver().unobserve(element);\n\t\tobservedElements.delete(element);\n\t} else {\n\t\tobservedElements.set(element, filteredCallbacks);\n\t}\n};\n\n/**\n * Allows to register/deregister resize observers for a DOM element\n *\n * @public\n * @class\n */\nclass ResizeHandler {\n\t/**\n\t * @public\n\t * @param element UI5 Web Component or DOM Element to be observed\n\t * @param callback Callback to be executed\n\t */\n\tstatic register(element: HTMLElement, callback: ResizeObserverCallback): void {\n\t\tlet effectiveElement: HTMLElement | undefined = element;\n\n\t\tif (instanceOfUI5Element(effectiveElement)) {\n\t\t\teffectiveElement = effectiveElement.getDomRef();\n\t\t}\n\n\t\tif (effectiveElement instanceof HTMLElement) {\n\t\t\tobserve(effectiveElement, callback);\n\t\t} else {\n\t\t\tconsole.warn(\"Cannot register ResizeHandler for element\", element); // eslint-disable-line\n\t\t}\n\t}\n\n\t/**\n\t * @public\n\t * @param element UI5 Web Component or DOM Element to be unobserved\n\t * @param callback Callback to be removed\n\t */\n\tstatic deregister(element: HTMLElement, callback: ResizeObserverCallback): void {\n\t\tlet effectiveElement: HTMLElement | undefined = element;\n\n\t\tif (instanceOfUI5Element(effectiveElement)) {\n\t\t\teffectiveElement = effectiveElement.getDomRef();\n\t\t}\n\n\t\tif (effectiveElement instanceof HTMLElement) {\n\t\t\tunobserve(effectiveElement, callback);\n\t\t} else {\n\t\t\tconsole.warn(\"Cannot deregister ResizeHandler for element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CL,EAE5CT,EAAqBc,CAAgB,IACxCA,EAAmBA,EAAiB,UAAU,GAG3CA,aAA4B,YAC/BJ,EAAUI,EAAkBP,CAAQ,EAEpC,QAAQ,KAAK,8CAA+CE,CAAO,CAErE,CACD,CAEA,eAAeI",
|
|
6
|
+
"names": ["instanceOfUI5Element", "resizeObserver", "observedElements", "getResizeObserver", "entries", "entry", "callbacks", "callback", "observe", "element", "unobserve", "filteredCallbacks", "fn", "ResizeHandler", "effectiveElement"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";import{supportsTouch as i}from"../Device.js";import a from"../EventProvider.js";import u from"../animations/scroll.js";const l="scroll",p=i()?"touchend":"mouseup";class v extends a{constructor(t){super();this.supportsTouch=i();this.containerComponent=t,this.mouseMove=this.ontouchmove.bind(this),this.mouseUp=this.ontouchend.bind(this),this.touchStart=this.ontouchstart.bind(this),this.supportsTouch=i(),this.cachedValue={dragX:0,dragY:0},this.startX=0,this.startY=0,this.supportsTouch?(t.addEventListener("touchstart",this.touchStart,{passive:!0}),t.addEventListener("touchmove",this.mouseMove,{passive:!0}),t.addEventListener("touchend",this.mouseUp,{passive:!0})):t.addEventListener("mousedown",this.touchStart,{passive:!0})}set scrollContainer(t){this._container=t}get scrollContainer(){return this._container}async scrollTo(t,e,s=0,o=0){let r=this.scrollContainer.clientHeight>0&&this.scrollContainer.clientWidth>0;for(;!r&&s>0;)await new Promise(n=>{setTimeout(()=>{r=this.scrollContainer.clientHeight>0&&this.scrollContainer.clientWidth>0,s--,n()},o)});this._container.scrollLeft=t,this._container.scrollTop=e}move(t,e,s){if(s){this._container.scrollLeft+=t,this._container.scrollTop+=e;return}if(this._container)return u(this._container,t,e)}getScrollLeft(){return this._container.scrollLeft}getScrollTop(){return this._container.scrollTop}_isTouchInside(t){let e=null;this.supportsTouch&&t instanceof TouchEvent&&(e=t.touches[0]);const s=this._container.getBoundingClientRect(),o=this.supportsTouch?e.clientX:t.x,r=this.supportsTouch?e.clientY:t.y;return o>=s.left&&o<=s.right&&r>=s.top&&r<=s.bottom}ontouchstart(t){let e=null;this.supportsTouch&&t instanceof TouchEvent&&(e=t.touches[0]),e?(this.startX=e.pageX,this.startY=e.pageY):(document.addEventListener("mouseup",this.mouseUp,{passive:!0}),document.addEventListener("mousemove",this.mouseMove,{passive:!0})),e&&(this._prevDragX=e.pageX,this._prevDragY=e.pageY),t instanceof MouseEvent&&(this._prevDragX=t.x,this._prevDragY=t.y),this._canScroll=this._isTouchInside(t)}ontouchmove(t){if(!this._canScroll)return;const e=this._container,s=this.supportsTouch?t.touches[0]:null,o=this.supportsTouch?s.pageX:t.x,r=this.supportsTouch?s.pageY:t.y;e.scrollLeft+=this._prevDragX-o,e.scrollTop+=this._prevDragY-r,this.fireEvent(l,{isLeft:o>this._prevDragX,isRight:o<this._prevDragX}),this.cachedValue.dragX=this._prevDragX,this.cachedValue.dragY=this._prevDragY,this._prevDragX=o,this._prevDragY=r}ontouchend(t){if(this.supportsTouch){const h=Math.abs(t.changedTouches[0].pageX-this.startX),c=Math.abs(t.changedTouches[0].pageY-this.startY);if(h<10&&c<10)return}if(!this._canScroll)return;const e=this._container,s=this.supportsTouch?t.changedTouches[0].pageX:t.x,o=this.supportsTouch?t.changedTouches[0].pageY:t.y;e.scrollLeft+=this._prevDragX-s,e.scrollTop+=this._prevDragY-o;const n=s===this._prevDragX?this.cachedValue.dragX:s;this.fireEvent(p,{isLeft:n<this._prevDragX,isRight:n>this._prevDragX}),this._prevDragX=s,this._prevDragY=o,this.supportsTouch||(document.removeEventListener("mousemove",this.mouseMove),document.removeEventListener("mouseup",this.mouseUp))}}export default v;
|
|
2
|
+
//# sourceMappingURL=ScrollEnablement.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/delegate/ScrollEnablement.ts"],
|
|
4
|
+
"sourcesContent": ["import { supportsTouch } from \"../Device.js\";\nimport EventProvider from \"../EventProvider.js\";\nimport scroll from \"../animations/scroll.js\";\nimport type UI5Element from \"../UI5Element.js\";\n\nconst scrollEventName = \"scroll\";\nconst touchEndEventName = supportsTouch() ? \"touchend\" : \"mouseup\";\n\ntype ScrollEnablementEventListenerParam = {\n\tisLeft: boolean;\n\tisRight: boolean\n}\ntype ScrollEnablementEventListenerReturn = void;\n\nclass ScrollEnablement extends EventProvider<ScrollEnablementEventListenerParam, ScrollEnablementEventListenerReturn> {\n\tcontainerComponent: UI5Element;\n\tmouseMove: (event: MouseEvent | TouchEvent) => void;\n\tmouseUp: (event: MouseEvent | TouchEvent) => void;\n\ttouchStart: (event: MouseEvent | TouchEvent) => void;\n\tcachedValue: { dragX: number, dragY: number };\n\tstartX: number;\n\tstartY: number;\n\t_container?: HTMLElement;\n\tsupportsTouch = supportsTouch();\n\t_canScroll?: boolean;\n\t_prevDragX?: number;\n\t_prevDragY?: number;\n\n\tconstructor(containerComponent: UI5Element) {\n\t\tsuper();\n\t\tthis.containerComponent = containerComponent;\n\t\tthis.mouseMove = this.ontouchmove.bind(this);\n\t\tthis.mouseUp = this.ontouchend.bind(this);\n\t\tthis.touchStart = this.ontouchstart.bind(this);\n\n\t\tthis.supportsTouch = supportsTouch();\n\n\t\t// On Android devices touchmove is thrown one more time than neccessary (together with touchend)\n\t\t// so we have to cache the previus coordinates in order to provide correct parameters in the\n\t\t// event for Android\n\t\tthis.cachedValue = { dragX: 0, dragY: 0 };\n\n\t\t// In components like Carousel you need to know if the user has clicked on something or swiped\n\t\t// in order to throw the needed event or not\n\t\tthis.startX = 0;\n\t\tthis.startY = 0;\n\n\t\tif (this.supportsTouch) {\n\t\t\tcontainerComponent.addEventListener(\"touchstart\", this.touchStart, { passive: true });\n\t\t\tcontainerComponent.addEventListener(\"touchmove\", this.mouseMove, { passive: true });\n\t\t\tcontainerComponent.addEventListener(\"touchend\", this.mouseUp, { passive: true });\n\t\t} else {\n\t\t\tcontainerComponent.addEventListener(\"mousedown\", this.touchStart, { passive: true });\n\t\t}\n\t}\n\n\tset scrollContainer(container: HTMLElement) {\n\t\tthis._container = container;\n\t}\n\n\tget scrollContainer() {\n\t\treturn this._container!;\n\t}\n\n\t/**\n\t * Scrolls the container to the left/top position, retrying retryCount times, if the container is not yet painted\n\t *\n\t * @param left\n\t * @param top\n\t * @param retryCount\n\t * @param retryInterval\n\t * @returns {Promise<void>} resolved when scrolled successfully\n\t */\n\tasync scrollTo(left: number, top: number, retryCount = 0, retryInterval = 0) {\n\t\tlet containerPainted = this.scrollContainer.clientHeight > 0 && this.scrollContainer.clientWidth > 0;\n\n\t\t/* eslint-disable no-loop-func, no-await-in-loop */\n\t\twhile (!containerPainted && retryCount > 0) {\n\t\t\tawait new Promise<void>(resolve => {\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tcontainerPainted = this.scrollContainer.clientHeight > 0 && this.scrollContainer.clientWidth > 0;\n\t\t\t\t\tretryCount--;\n\t\t\t\t\tresolve();\n\t\t\t\t}, retryInterval);\n\t\t\t});\n\t\t}\n\t\t/* eslint-disable no-loop-func, no-await-in-loop */\n\n\t\tthis._container!.scrollLeft = left;\n\t\tthis._container!.scrollTop = top;\n\t}\n\n\tmove(dx: number, dy: number, disableAnimation: boolean) {\n\t\tif (disableAnimation) {\n\t\t\tthis._container!.scrollLeft += dx;\n\t\t\tthis._container!.scrollTop += dy;\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._container) {\n\t\t\treturn scroll(this._container, dx, dy);\n\t\t}\n\t}\n\n\tgetScrollLeft() {\n\t\treturn this._container!.scrollLeft;\n\t}\n\n\tgetScrollTop() {\n\t\treturn this._container!.scrollTop;\n\t}\n\n\t_isTouchInside(event: TouchEvent | MouseEvent) {\n\t\tlet touch = null;\n\t\tif (this.supportsTouch && event instanceof TouchEvent) {\n\t\t\ttouch = event.touches[0];\n\t\t}\n\n\t\tconst rect = this._container!.getBoundingClientRect();\n\t\tconst x = this.supportsTouch ? (touch as TouchInit).clientX : (event as MouseEvent).x;\n\t\tconst y = this.supportsTouch ? (touch as TouchInit).clientY : (event as MouseEvent).y;\n\n\t\treturn x! >= rect.left && x! <= rect.right\n\t\t\t&& y! >= rect.top && y! <= rect.bottom;\n\t}\n\n\tontouchstart(event: TouchEvent | MouseEvent) {\n\t\tlet touch = null;\n\t\tif (this.supportsTouch && event instanceof TouchEvent) {\n\t\t\ttouch = event.touches[0];\n\t\t}\n\n\t\tif (!touch) {\n\t\t\tdocument.addEventListener(\"mouseup\", this.mouseUp, { passive: true });\n\t\t\tdocument.addEventListener(\"mousemove\", this.mouseMove, { passive: true });\n\t\t} else {\n\t\t\t// Needed only on mobile\n\t\t\tthis.startX = touch.pageX;\n\t\t\tthis.startY = touch.pageY;\n\t\t}\n\n\t\tif (touch) {\n\t\t\tthis._prevDragX = touch.pageX;\n\t\t\tthis._prevDragY = touch.pageY;\n\t\t}\n\n\t\tif (event instanceof MouseEvent) {\n\t\t\tthis._prevDragX = event.x;\n\t\t\tthis._prevDragY = event.y;\n\t\t}\n\n\t\tthis._canScroll = this._isTouchInside(event);\n\t}\n\n\tontouchmove(event: TouchEvent | MouseEvent) {\n\t\tif (!this._canScroll) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst container = this._container;\n\t\tconst touch = this.supportsTouch ? (event as TouchEvent).touches[0] : null;\n\n\t\tconst dragX = this.supportsTouch ? (touch as TouchInit).pageX : (event as MouseEvent).x;\n\t\tconst dragY = this.supportsTouch ? (touch as TouchInit).pageY : (event as MouseEvent).y;\n\n\t\tcontainer!.scrollLeft += this._prevDragX! - dragX!;\n\t\tcontainer!.scrollTop += this._prevDragY! - dragY!;\n\n\t\tthis.fireEvent(scrollEventName, {\n\t\t\tisLeft: dragX! > this._prevDragX!,\n\t\t\tisRight: dragX! < this._prevDragX!,\n\t\t});\n\n\t\tthis.cachedValue.dragX = this._prevDragX!;\n\t\tthis.cachedValue.dragY = this._prevDragY!;\n\n\t\tthis._prevDragX = dragX;\n\t\tthis._prevDragY = dragY;\n\t}\n\n\tontouchend(event: TouchEvent | MouseEvent) {\n\t\tif (this.supportsTouch) {\n\t\t\tconst deltaX = Math.abs((event as TouchEvent).changedTouches[0].pageX - this.startX);\n\t\t\tconst deltaY = Math.abs((event as TouchEvent).changedTouches[0].pageY - this.startY);\n\n\t\t\tif (deltaX < 10 && deltaY < 10) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif (!this._canScroll) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst container = this._container;\n\t\tconst dragX = this.supportsTouch ? (event as TouchEvent).changedTouches[0].pageX : (event as MouseEvent).x;\n\t\tconst dragY = this.supportsTouch ? (event as TouchEvent).changedTouches[0].pageY : (event as MouseEvent).y;\n\n\t\tcontainer!.scrollLeft += this._prevDragX! - dragX;\n\t\tcontainer!.scrollTop += this._prevDragY! - dragY;\n\n\t\tconst useCachedValues = dragX === this._prevDragX;\n\t\tconst _dragX = useCachedValues ? this.cachedValue.dragX : dragX;\n\t\t// const _dragY = useCachedValues ? this.cachedValue.dragY : dragY; add if needed\n\n\t\tthis.fireEvent(touchEndEventName, {\n\t\t\tisLeft: _dragX < this._prevDragX!,\n\t\t\tisRight: _dragX > this._prevDragX!,\n\t\t});\n\n\t\tthis._prevDragX = dragX;\n\t\tthis._prevDragY = dragY;\n\n\t\tif (!this.supportsTouch) {\n\t\t\tdocument.removeEventListener(\"mousemove\", this.mouseMove);\n\t\t\tdocument.removeEventListener(\"mouseup\", this.mouseUp);\n\t\t}\n\t}\n}\n\nexport default ScrollEnablement;\nexport type {\n\tScrollEnablementEventListenerParam,\n};\n"],
|
|
5
|
+
"mappings": "aAAA,OAAS,iBAAAA,MAAqB,eAC9B,OAAOC,MAAmB,sBAC1B,OAAOC,MAAY,0BAGnB,MAAMC,EAAkB,SAClBC,EAAoBJ,EAAc,EAAI,WAAa,UAQzD,MAAMK,UAAyBJ,CAAuF,CAcrH,YAAYK,EAAgC,CAC3C,MAAM,EANP,mBAAgBN,EAAc,EAO7B,KAAK,mBAAqBM,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ED,KAAK,YAAY,MAAQ,KAAK,WAC9B,KAAK,YAAY,MAAQ,KAAK,WAE9B,KAAK,WAAaA,EAClB,KAAK,WAAaC,CACnB,CAEA,WAAWN,EAAgC,CAC1C,GAAI,KAAK,cAAe,CACvB,MAAMO,EAAS,KAAK,IAAKP,EAAqB,eAAe,CAAC,EAAE,MAAQ,KAAK,MAAM,EAC7EQ,EAAS,KAAK,IAAKR,EAAqB,eAAe,CAAC,EAAE,MAAQ,KAAK,MAAM,EAEnF,GAAIO,EAAS,IAAMC,EAAS,GAC3B,MAEF,CAEA,GAAI,CAAC,KAAK,WACT,OAGD,MAAMlB,EAAY,KAAK,WACjBe,EAAQ,KAAK,cAAiBL,EAAqB,eAAe,CAAC,EAAE,MAASA,EAAqB,EACnGM,EAAQ,KAAK,cAAiBN,EAAqB,eAAe,CAAC,EAAE,MAASA,EAAqB,EAEzGV,EAAW,YAAc,KAAK,WAAce,EAC5Cf,EAAW,WAAa,KAAK,WAAcgB,EAG3C,MAAMG,EADkBJ,IAAU,KAAK,WACN,KAAK,YAAY,MAAQA,EAG1D,KAAK,UAAUlB,EAAmB,CACjC,OAAQsB,EAAS,KAAK,WACtB,QAASA,EAAS,KAAK,UACxB,CAAC,EAED,KAAK,WAAaJ,EAClB,KAAK,WAAaC,EAEb,KAAK,gBACT,SAAS,oBAAoB,YAAa,KAAK,SAAS,EACxD,SAAS,oBAAoB,UAAW,KAAK,OAAO,EAEtD,CACD,CAEA,eAAelB",
|
|
6
|
+
"names": ["supportsTouch", "EventProvider", "scroll", "scrollEventName", "touchEndEventName", "ScrollEnablement", "containerComponent", "container", "left", "top", "retryCount", "retryInterval", "containerPainted", "resolve", "dx", "dy", "disableAnimation", "event", "touch", "rect", "x", "y", "dragX", "dragY", "deltaX", "deltaY", "_dragX"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";import{registerFeature as a}from"../FeaturesRegistry.js";import{isF6Next as r,isF6Previous as l}from"../Keys.js";import{instanceOfUI5Element as u}from"../UI5Element.js";import{getFirstFocusableElement as h}from"../util/FocusableElements.js";import m from"../util/getFastNavigationGroups.js";import p from"../util/isElementClickable.js";class n{constructor(){this.selectedGroup=null;this.groups=[];this.keydownHandler=this._keydownHandler.bind(this),this.attachEventListeners()}attachEventListeners(){document.addEventListener("keydown",this.keydownHandler)}async groupElementToFocus(e){const s=u(e)?e.getDomRef():e;if(s){if(p(s))return s;const t=await h(s);if(t)return t}}async findNextFocusableGroupElement(e){let s;for(let t=0;t<this.groups.length;t++){let o;if(e>-1?e+1>=this.groups.length?(e=0,o=this.groups[e]):(e+=1,o=this.groups[e]):(e=0,o=this.groups[e]),s=await this.groupElementToFocus(o),s)break}return s}async findPreviousFocusableGroupElement(e){let s;for(let t=0;t<this.groups.length;t++){let o;if(e>0?(e=await this.groupElementToFocus(this.groups[e-1])===await this.groupElementToFocus(this.groups[e])?e-2:e-1,e<0&&(e=this.groups.length-1),o=this.groups[e]):(e=this.groups.length-1,o=this.groups[e]),s=await this.groupElementToFocus(o),s)break}return s}async _keydownHandler(e){const s=r(e),t=l(e);if(!(s||t)||(this.updateGroups(),this.groups.length<1))return;e.preventDefault();let o;if(this.groups.length===0)return o=await this.groupElementToFocus(this.groups[0]),o?.focus();let i=-1;this.selectedGroup&&(i=this.groups.indexOf(this.selectedGroup)),s&&(o=await this.findNextFocusableGroupElement(i)),t&&(o=await this.findPreviousFocusableGroupElement(i)),o?.focus()}removeEventListeners(){document.removeEventListener("keydown",this.keydownHandler)}updateGroups(){this.setSelectedGroup(),this.groups=m(document.body)}setSelectedGroup(e=window.document){const s=window.document.querySelector("html");let t=this.deepActive(e);for(;t&&t.getAttribute("data-sap-ui-fastnavgroup")!=="true"&&t!==s;)t=t.parentElement?t.parentNode:t.parentNode.host;this.selectedGroup=t}deepActive(e){return e.activeElement&&e.activeElement.shadowRoot?this.deepActive(e.activeElement.shadowRoot):e.activeElement}destroy(){this.removeEventListeners()}static init(){return this._instance||(this._instance=new n),this._instance}}a("F6Navigation",n);export default n;
|
|
2
|
+
//# sourceMappingURL=F6Navigation.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/features/F6Navigation.ts"],
|
|
4
|
+
"sourcesContent": ["import { registerFeature } from \"../FeaturesRegistry.js\";\nimport { isF6Next, isF6Previous } from \"../Keys.js\";\nimport { instanceOfUI5Element } from \"../UI5Element.js\";\nimport { getFirstFocusableElement } from \"../util/FocusableElements.js\";\nimport getFastNavigationGroups from \"../util/getFastNavigationGroups.js\";\nimport isElementClickable from \"../util/isElementClickable.js\";\n\nclass F6Navigation {\n\tstatic _instance: F6Navigation;\n\tkeydownHandler: (event: KeyboardEvent) => void;\n\tselectedGroup: HTMLElement | null = null;\n\tgroups: Array<HTMLElement> = [];\n\n\tconstructor() {\n\t\tthis.keydownHandler = this._keydownHandler.bind(this) as (event: KeyboardEvent) => void;\n\t\tthis.attachEventListeners();\n\t}\n\n\tattachEventListeners() {\n\t\tdocument.addEventListener(\"keydown\", this.keydownHandler);\n\t}\n\n\tasync groupElementToFocus(nextElement: HTMLElement) {\n\t\tconst nextElementDomRef = instanceOfUI5Element(nextElement) ? nextElement.getDomRef() : nextElement;\n\n\t\tif (nextElementDomRef) {\n\t\t\tif (isElementClickable(nextElementDomRef)) {\n\t\t\t\treturn nextElementDomRef;\n\t\t\t}\n\n\t\t\tconst elementToFocus = await getFirstFocusableElement(nextElementDomRef);\n\n\t\t\tif (elementToFocus) {\n\t\t\t\treturn elementToFocus;\n\t\t\t}\n\t\t}\n\t}\n\n\tasync findNextFocusableGroupElement(currentIndex: number) {\n\t\tlet elementToFocus;\n\n\t\t/* eslint-disable no-await-in-loop */\n\t\tfor (let index = 0; index < this.groups.length; index++) {\n\t\t\tlet nextElement;\n\n\t\t\tif (currentIndex > -1) {\n\t\t\t\tif (currentIndex + 1 >= this.groups.length) {\n\t\t\t\t\tcurrentIndex = 0;\n\t\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t\t} else {\n\t\t\t\t\tcurrentIndex += 1;\n\t\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcurrentIndex = 0;\n\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t}\n\n\t\t\telementToFocus = await this.groupElementToFocus(nextElement);\n\n\t\t\tif (elementToFocus) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t/* eslint-enable no-await-in-loop */\n\n\t\treturn elementToFocus;\n\t}\n\n\tasync findPreviousFocusableGroupElement(currentIndex: number) {\n\t\tlet elementToFocus;\n\n\t\t/* eslint-disable no-await-in-loop */\n\t\tfor (let index = 0; index < this.groups.length; index++) {\n\t\t\tlet nextElement;\n\n\t\t\tif (currentIndex > 0) {\n\t\t\t\t// Handle the situation where the first focusable element of two neighbor groups is the same\n\t\t\t\t// For example:\n\t\t\t\t// <ui5-flexible-column-layout>\n\t\t\t\t// <ui5-list>\n\t\t\t\t// <ui5-li>List Item</ui5-li>\n\t\t\t\t// </ui5-list>\n\t\t\t\t// </ui5-flexible-column-layout>\n\t\t\t\t// Here for both FCL & List the firstFoccusableElement is the same (the ui5-li)\n\t\t\t\tconst firstFocusable = await this.groupElementToFocus(this.groups[currentIndex - 1]);\n\t\t\t\tconst shouldSkipParent = firstFocusable === await this.groupElementToFocus(this.groups[currentIndex]);\n\n\t\t\t\tcurrentIndex = shouldSkipParent ? currentIndex - 2 : currentIndex - 1;\n\n\t\t\t\tif (currentIndex < 0) {\n\t\t\t\t\tcurrentIndex = this.groups.length - 1;\n\t\t\t\t}\n\n\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t} else {\n\t\t\t\tcurrentIndex = this.groups.length - 1;\n\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t}\n\n\t\t\telementToFocus = await this.groupElementToFocus(nextElement);\n\n\t\t\tif (elementToFocus) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t/* eslint-enable no-await-in-loop */\n\n\t\treturn elementToFocus;\n\t}\n\n\tasync _keydownHandler(event: KeyboardEvent) {\n\t\tconst forward = isF6Next(event);\n\t\tconst backward = isF6Previous(event);\n\t\tif (!(forward || backward)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.updateGroups();\n\n\t\tif (this.groups.length < 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tlet elementToFocus;\n\n\t\tif (this.groups.length === 0) {\n\t\t\telementToFocus = await this.groupElementToFocus(this.groups[0]);\n\n\t\t\treturn elementToFocus?.focus();\n\t\t}\n\n\t\tlet currentIndex = -1;\n\n\t\tif (this.selectedGroup) {\n\t\t\tcurrentIndex = this.groups.indexOf(this.selectedGroup);\n\t\t}\n\n\t\tif (forward) {\n\t\t\telementToFocus = await this.findNextFocusableGroupElement(currentIndex);\n\t\t}\n\n\t\tif (backward) {\n\t\t\telementToFocus = await this.findPreviousFocusableGroupElement(currentIndex);\n\t\t}\n\n\t\telementToFocus?.focus();\n\t}\n\n\tremoveEventListeners() {\n\t\tdocument.removeEventListener(\"keydown\", this.keydownHandler);\n\t}\n\n\tupdateGroups() {\n\t\tthis.setSelectedGroup();\n\t\tthis.groups = getFastNavigationGroups(document.body);\n\t}\n\n\tsetSelectedGroup(root: DocumentOrShadowRoot = window.document) {\n\t\tconst htmlElement = window.document.querySelector(\"html\");\n\t\tlet element: Element | null | ParentNode = this.deepActive(root);\n\n\t\twhile (element && (element as Element).getAttribute(\"data-sap-ui-fastnavgroup\") !== \"true\" && element !== htmlElement) {\n\t\t\telement = element.parentElement ? element.parentNode : (element.parentNode as ShadowRoot).host;\n\t\t}\n\n\t\tthis.selectedGroup = element as HTMLElement;\n\t}\n\n\tdeepActive(root: DocumentOrShadowRoot): Element | null {\n\t\tif (root.activeElement && root.activeElement.shadowRoot) {\n\t\t\treturn this.deepActive(root.activeElement.shadowRoot);\n\t\t}\n\n\t\treturn root.activeElement;\n\t}\n\n\tdestroy() {\n\t\tthis.removeEventListeners();\n\t}\n\n\tstatic init() {\n\t\tif (!this._instance) {\n\t\t\tthis._instance = new F6Navigation();\n\t\t}\n\n\t\treturn this._instance;\n\t}\n}\n\nregisterFeature(\"F6Navigation\", F6Navigation);\n\nexport default F6Navigation;\n"],
|
|
5
|
+
"mappings": "aAAA,OAAS,mBAAAA,MAAuB,yBAChC,OAAS,YAAAC,EAAU,gBAAAC,MAAoB,aACvC,OAAS,wBAAAC,MAA4B,mBACrC,OAAS,4BAAAC,MAAgC,+BACzC,OAAOC,MAA6B,qCACpC,OAAOC,MAAwB,gCAE/B,MAAMC,CAAa,CAMlB,aAAc,CAHd,mBAAoC,KACpC,YAA6B,CAAC,EAG7B,KAAK,eAAiB,KAAK,gBAAgB,KAAK,IAAI,EACpD,KAAK,qBAAqB,CAC3B,CAEA,sBAAuB,CACtB,SAAS,iBAAiB,UAAW,KAAK,cAAc,CACzD,CAEA,MAAM,oBAAoBC,EAA0B,CACnD,MAAMC,EAAoBN,EAAqBK,CAAW,EAAIA,EAAY,UAAU,EAAIA,EAExF,GAAIC,EAAmB,CACtB,GAAIH,EAAmBG,CAAiB,EACvC,OAAOA,EAGR,MAAMC,EAAiB,MAAMN,EAAyBK,CAAiB,EAEvE,GAAIC,EACH,OAAOA,CAET,CACD,CAEA,MAAM,8BAA8BC,EAAsB,CACzD,IAAID,EAGJ,QAASE,EAAQ,EAAGA,EAAQ,KAAK,OAAO,OAAQA,IAAS,CACxD,IAAIJ,EAiBJ,GAfIG,EAAe,GACdA,EAAe,GAAK,KAAK,OAAO,QACnCA,EAAe,EACfH,EAAc,KAAK,OAAOG,CAAY,IAEtCA,GAAgB,EAChBH,EAAc,KAAK,OAAOG,CAAY,IAGvCA,EAAe,EACfH,EAAc,KAAK,OAAOG,CAAY,GAGvCD,EAAiB,MAAM,KAAK,oBAAoBF,CAAW,EAEvDE,EACH,KAEF,CAGA,OAAOA,CACR,CAEA,MAAM,kCAAkCC,EAAs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,EAAuC,KAAK,WAAWF,CAAI,EAE/D,KAAOE,GAAYA,EAAoB,aAAa,0BAA0B,IAAM,QAAUA,IAAYD,GACzGC,EAAUA,EAAQ,cAAgBA,EAAQ,WAAcA,EAAQ,WAA0B,KAG3F,KAAK,cAAgBA,CACtB,CAEA,WAAWF,EAA4C,CACtD,OAAIA,EAAK,eAAiBA,EAAK,cAAc,WACrC,KAAK,WAAWA,EAAK,cAAc,UAAU,EAG9CA,EAAK,aACb,CAEA,SAAU,CACT,KAAK,qBAAqB,CAC3B,CAEA,OAAO,MAAO,CACb,OAAK,KAAK,YACT,KAAK,UAAY,IAAIT,GAGf,KAAK,SACb,CACD,CAEAP,EAAgB,eAAgBO,CAAY,EAE5C,eAAeA",
|
|
6
|
+
"names": ["registerFeature", "isF6Next", "isF6Previous", "instanceOfUI5Element", "getFirstFocusableElement", "getFastNavigationGroups", "isElementClickable", "F6Navigation", "nextElement", "nextElementDomRef", "elementToFocus", "currentIndex", "index", "event", "forward", "backward", "root", "htmlElement", "element"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const m=t=>{t._internals=t.attachInternals(),a(t)&&n(t)},n=t=>{if(t._internals?.form){if(e(t),!t.name){t._internals?.setFormValue(null);return}t._internals.setFormValue(t.formFormattedValue)}},e=async t=>{if(t._internals?.form)if(t.formValidity&&Object.keys(t.formValidity).some(r=>r)){const r=await t.formElementAnchor?.();t._internals.setValidity(t.formValidity,t.formValidityMessage,r)}else t._internals.setValidity({})},o=t=>{t._internals?.form?.requestSubmit()},i=t=>{t._internals?.form?.reset()},a=t=>"formFormattedValue"in t&&"name"in t;export{m as attachFormElementInternals,n as setFormValue,e as setFormValidity,o as submitForm,i as resetForm};
|
|
2
|
+
//# sourceMappingURL=InputElementsFormSupport.js.map
|