@openui5/sap.ui.core 1.139.0 → 1.141.0
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/THIRDPARTY.txt +2 -2
- package/package.json +1 -1
- package/src/jquery.sap.global.js +1 -1
- package/src/jquery.sap.mobile.js +0 -8
- package/src/jquery.sap.properties.js +1 -1
- package/src/jquery.sap.resources.js +1 -1
- package/src/jquery.sap.script.js +1 -1
- package/src/jquery.sap.storage.js +3 -3
- package/src/sap/base/Event.js +1 -1
- package/src/sap/base/Eventing.js +1 -1
- package/src/sap/base/config.js +1 -1
- package/src/sap/base/i18n/Formatting.js +1 -1
- package/src/sap/base/i18n/LanguageTag.js +9 -9
- package/src/sap/base/i18n/Localization.js +2 -2
- package/src/sap/base/i18n/date/TimezoneUtils.js +1 -1
- package/src/sap/base/security/URLListValidator.js +7 -3
- package/src/sap/base/security/encodeURL.js +1 -1
- package/src/sap/base/util/resolveReference.js +3 -1
- package/src/sap/base/util/restricted/_CancelablePromise.js +1 -1
- package/src/sap/base/util/restricted/_castArray.js +1 -1
- package/src/sap/base/util/restricted/_compact.js +1 -1
- package/src/sap/base/util/restricted/_curry.js +1 -1
- package/src/sap/base/util/restricted/_debounce.js +1 -1
- package/src/sap/base/util/restricted/_difference.js +1 -1
- package/src/sap/base/util/restricted/_differenceBy.js +1 -1
- package/src/sap/base/util/restricted/_differenceWith.js +1 -1
- package/src/sap/base/util/restricted/_flatMap.js +1 -1
- package/src/sap/base/util/restricted/_flatMapDeep.js +1 -1
- package/src/sap/base/util/restricted/_flatMapDepth.js +1 -1
- package/src/sap/base/util/restricted/_flatten.js +1 -1
- package/src/sap/base/util/restricted/_flattenDeep.js +1 -1
- package/src/sap/base/util/restricted/_flattenDepth.js +1 -1
- package/src/sap/base/util/restricted/_intersection.js +1 -1
- package/src/sap/base/util/restricted/_intersectionBy.js +1 -1
- package/src/sap/base/util/restricted/_intersectionWith.js +1 -1
- package/src/sap/base/util/restricted/_isEqual.js +1 -1
- package/src/sap/base/util/restricted/_isEqualWith.js +1 -1
- package/src/sap/base/util/restricted/_isNil.js +1 -1
- package/src/sap/base/util/restricted/_max.js +1 -1
- package/src/sap/base/util/restricted/_merge.js +1 -1
- package/src/sap/base/util/restricted/_mergeWith.js +1 -1
- package/src/sap/base/util/restricted/_min.js +1 -1
- package/src/sap/base/util/restricted/_omit.js +1 -1
- package/src/sap/base/util/restricted/_pick.js +1 -1
- package/src/sap/base/util/restricted/_pickBy.js +1 -1
- package/src/sap/base/util/restricted/_throttle.js +1 -1
- package/src/sap/base/util/restricted/_toArray.js +1 -1
- package/src/sap/base/util/restricted/_union.js +1 -1
- package/src/sap/base/util/restricted/_unionBy.js +1 -1
- package/src/sap/base/util/restricted/_unionWith.js +1 -1
- package/src/sap/base/util/restricted/_uniq.js +1 -1
- package/src/sap/base/util/restricted/_uniqBy.js +1 -1
- package/src/sap/base/util/restricted/_uniqWith.js +1 -1
- package/src/sap/base/util/restricted/_without.js +1 -1
- package/src/sap/base/util/restricted/_xor.js +1 -1
- package/src/sap/base/util/restricted/_xorBy.js +1 -1
- package/src/sap/base/util/restricted/_xorWith.js +1 -1
- package/src/sap/base/util/restricted/_zipObject.js +1 -1
- package/src/sap/base/util/restricted/_zipObjectDeep.js +1 -1
- package/src/sap/ui/Device.js +3 -3
- package/src/sap/ui/Global.js +3 -3
- package/src/sap/ui/base/BindingParser.js +22 -5
- package/src/sap/ui/base/DataType.js +1 -1
- package/src/sap/ui/base/Event.js +1 -1
- package/src/sap/ui/base/EventProvider.js +1 -1
- package/src/sap/ui/base/ExpressionParser.js +5 -1
- package/src/sap/ui/base/Interface.js +1 -1
- package/src/sap/ui/base/ManagedObject.js +1 -1
- package/src/sap/ui/base/ManagedObjectMetadata.js +3 -3
- package/src/sap/ui/base/Metadata.js +1 -1
- package/src/sap/ui/base/Object.js +1 -1
- package/src/sap/ui/base/ObjectPool.js +1 -1
- package/src/sap/ui/base/SyncPromise.js +3 -2
- package/src/sap/ui/core/.library +3 -3
- package/src/sap/ui/core/BusyIndicator.js +1 -1
- package/src/sap/ui/core/Component.js +1 -1
- package/src/sap/ui/core/ComponentContainer.js +2 -2
- package/src/sap/ui/core/ComponentMetadata.js +1 -1
- package/src/sap/ui/core/ComponentSupport.js +3 -3
- package/src/sap/ui/core/Configuration.js +4 -4
- package/src/sap/ui/core/Control.js +1 -1
- package/src/sap/ui/core/Core.js +2 -11
- package/src/sap/ui/core/CustomData.js +1 -1
- package/src/sap/ui/core/DeclarativeSupport.js +1 -1
- package/src/sap/ui/core/Element.js +3 -3
- package/src/sap/ui/core/ElementMetadata.js +1 -1
- package/src/sap/ui/core/EnabledPropagator.js +1 -1
- package/src/sap/ui/core/EventBus.js +1 -1
- package/src/sap/ui/core/Fragment.js +1 -1
- package/src/sap/ui/core/HTML.js +1 -1
- package/src/sap/ui/core/History.js +1 -1
- package/src/sap/ui/core/Icon.js +1 -1
- package/src/sap/ui/core/IndicationColorSupport.js +1 -1
- package/src/sap/ui/core/IntervalTrigger.js +1 -1
- package/src/sap/ui/core/InvisibleMessage.js +1 -1
- package/src/sap/ui/core/InvisibleRenderer.js +1 -1
- package/src/sap/ui/core/InvisibleText.js +1 -1
- package/src/sap/ui/core/Item.js +1 -1
- package/src/sap/ui/core/LabelEnablement.js +1 -1
- package/src/sap/ui/core/LayoutData.js +1 -1
- package/src/sap/ui/core/Lib.js +50 -140
- package/src/sap/ui/core/ListItem.js +1 -1
- package/src/sap/ui/core/LocalBusyIndicator.js +1 -1
- package/src/sap/ui/core/Locale.js +7 -7
- package/src/sap/ui/core/LocaleData.js +7 -4
- package/src/sap/ui/core/Manifest.js +1 -1
- package/src/sap/ui/core/Message.js +1 -1
- package/src/sap/ui/core/RenderManager.js +1 -1
- package/src/sap/ui/core/Renderer.js +1 -1
- package/src/sap/ui/core/ResizeHandler.js +1 -1
- package/src/sap/ui/core/ScrollBar.js +1 -1
- package/src/sap/ui/core/SeparatorItem.js +1 -1
- package/src/sap/ui/core/Theming.js +145 -76
- package/src/sap/ui/core/Title.js +1 -1
- package/src/sap/ui/core/TooltipBase.js +1 -1
- package/src/sap/ui/core/UIArea.js +1 -1
- package/src/sap/ui/core/UIComponent.js +16 -7
- package/src/sap/ui/core/UIComponentMetadata.js +1 -1
- package/src/sap/ui/core/ValueStateSupport.js +1 -1
- package/src/sap/ui/core/VariantLayoutData.js +1 -1
- package/src/sap/ui/core/XMLComposite.js +1 -1
- package/src/sap/ui/core/XMLCompositeMetadata.js +1 -1
- package/src/sap/ui/core/XMLTemplateProcessor.js +1 -1
- package/src/sap/ui/core/_IconRegistry.js +19 -39
- package/src/sap/ui/core/date/UI5Date.js +1 -1
- package/src/sap/ui/core/delegate/ItemNavigation.js +1 -1
- package/src/sap/ui/core/delegate/ScrollEnablement.js +1 -1
- package/src/sap/ui/core/dnd/DragDropBase.js +1 -1
- package/src/sap/ui/core/dnd/DragDropInfo.js +1 -1
- package/src/sap/ui/core/dnd/DragInfo.js +1 -1
- package/src/sap/ui/core/dnd/DropInfo.js +1 -1
- package/src/sap/ui/core/format/FormatUtils.js +1 -1
- package/src/sap/ui/core/format/NumberFormat.js +2 -2
- package/src/sap/ui/core/format/TimezoneUtil.js +1 -1
- package/src/sap/ui/core/getCompatibilityVersion.js +1 -1
- package/src/sap/ui/core/hyphenation/Hyphenation.js +1 -1
- package/src/sap/ui/core/library.js +3 -3
- package/src/sap/ui/core/message/ControlMessageProcessor.js +1 -1
- package/src/sap/ui/core/message/Message.js +1 -1
- package/src/sap/ui/core/message/MessageManager.js +1 -1
- package/src/sap/ui/core/message/MessageParser.js +1 -1
- package/src/sap/ui/core/message/MessageProcessor.js +1 -1
- package/src/sap/ui/core/messagebundle_ar.properties +26 -11
- package/src/sap/ui/core/messagebundle_bg.properties +21 -6
- package/src/sap/ui/core/messagebundle_ca.properties +24 -9
- package/src/sap/ui/core/messagebundle_cnr.properties +23 -8
- package/src/sap/ui/core/messagebundle_cs.properties +24 -9
- package/src/sap/ui/core/messagebundle_cy.properties +24 -9
- package/src/sap/ui/core/messagebundle_da.properties +21 -6
- package/src/sap/ui/core/messagebundle_de.properties +16 -1
- package/src/sap/ui/core/messagebundle_el.properties +26 -11
- package/src/sap/ui/core/messagebundle_en.properties +24 -9
- package/src/sap/ui/core/messagebundle_en_GB.properties +24 -9
- package/src/sap/ui/core/messagebundle_en_US_saprigi.properties +24 -9
- package/src/sap/ui/core/messagebundle_es.properties +21 -6
- package/src/sap/ui/core/messagebundle_es_MX.properties +24 -9
- package/src/sap/ui/core/messagebundle_et.properties +31 -16
- package/src/sap/ui/core/messagebundle_fi.properties +20 -5
- package/src/sap/ui/core/messagebundle_fr.properties +22 -7
- package/src/sap/ui/core/messagebundle_fr_CA.properties +20 -5
- package/src/sap/ui/core/messagebundle_hi.properties +24 -9
- package/src/sap/ui/core/messagebundle_hr.properties +20 -5
- package/src/sap/ui/core/messagebundle_hu.properties +23 -8
- package/src/sap/ui/core/messagebundle_id.properties +20 -5
- package/src/sap/ui/core/messagebundle_it.properties +23 -8
- package/src/sap/ui/core/messagebundle_iw.properties +21 -6
- package/src/sap/ui/core/messagebundle_ja.properties +19 -4
- package/src/sap/ui/core/messagebundle_kk.properties +22 -7
- package/src/sap/ui/core/messagebundle_ko.properties +20 -5
- package/src/sap/ui/core/messagebundle_lt.properties +20 -5
- package/src/sap/ui/core/messagebundle_lv.properties +20 -5
- package/src/sap/ui/core/messagebundle_mk.properties +25 -10
- package/src/sap/ui/core/messagebundle_ms.properties +24 -9
- package/src/sap/ui/core/messagebundle_nl.properties +22 -7
- package/src/sap/ui/core/messagebundle_no.properties +22 -7
- package/src/sap/ui/core/messagebundle_pl.properties +19 -4
- package/src/sap/ui/core/messagebundle_pt.properties +20 -5
- package/src/sap/ui/core/messagebundle_pt_PT.properties +18 -3
- package/src/sap/ui/core/messagebundle_ro.properties +22 -7
- package/src/sap/ui/core/messagebundle_ru.properties +19 -4
- package/src/sap/ui/core/messagebundle_sh.properties +23 -8
- package/src/sap/ui/core/messagebundle_sk.properties +23 -8
- package/src/sap/ui/core/messagebundle_sl.properties +20 -5
- package/src/sap/ui/core/messagebundle_sr.properties +23 -8
- package/src/sap/ui/core/messagebundle_sv.properties +23 -8
- package/src/sap/ui/core/messagebundle_th.properties +20 -5
- package/src/sap/ui/core/messagebundle_tr.properties +20 -5
- package/src/sap/ui/core/messagebundle_uk.properties +22 -7
- package/src/sap/ui/core/messagebundle_vi.properties +18 -3
- package/src/sap/ui/core/messagebundle_zh_CN.properties +24 -9
- package/src/sap/ui/core/messagebundle_zh_TW.properties +20 -5
- package/src/sap/ui/core/mvc/HTMLView.js +1 -1
- package/src/sap/ui/core/mvc/JSONView.js +1 -1
- package/src/sap/ui/core/mvc/JSView.js +1 -1
- package/src/sap/ui/core/mvc/TemplateView.js +1 -1
- package/src/sap/ui/core/mvc/View.js +2 -2
- package/src/sap/ui/core/mvc/XMLView.js +1 -1
- package/src/sap/ui/core/plugin/DeclarativeSupport.js +1 -1
- package/src/sap/ui/core/plugin/TemplatingSupport.js +1 -1
- package/src/sap/ui/core/postmessage/Bus.js +1 -1
- package/src/sap/ui/core/postmessage/confirmationDialog.js +1 -1
- package/src/sap/ui/core/routing/History.js +14 -5
- package/src/sap/ui/core/routing/Route.js +1 -1
- package/src/sap/ui/core/routing/Router.js +19 -1
- package/src/sap/ui/core/search/OpenSearchProvider.js +1 -1
- package/src/sap/ui/core/search/SearchProvider.js +1 -1
- package/src/sap/ui/core/service/Service.js +1 -1
- package/src/sap/ui/core/service/ServiceFactory.js +1 -1
- package/src/sap/ui/core/service/ServiceFactoryRegistry.js +1 -1
- package/src/sap/ui/core/support/Plugin.js +1 -1
- package/src/sap/ui/core/support/Support.js +1 -1
- package/src/sap/ui/core/support/ViewInfo.css +12 -12
- package/src/sap/ui/core/support/plugins/ControlTree.js +1 -1
- package/src/sap/ui/core/support/plugins/Interaction.js +1 -1
- package/src/sap/ui/core/support/plugins/LocalStorage.js +1 -1
- package/src/sap/ui/core/support/plugins/Performance.js +1 -1
- package/src/sap/ui/core/support/plugins/Selector.js +1 -1
- package/src/sap/ui/core/support/plugins/TechInfo.js +1 -1
- package/src/sap/ui/core/support/plugins/Trace.js +1 -1
- package/src/sap/ui/core/support/plugins/ViewInfo.js +1 -1
- package/src/sap/ui/core/support/techinfo/TechnicalInfo.js +1 -3
- package/src/sap/ui/core/support/trace/E2eTraceLib.js +13 -7
- package/src/sap/ui/core/themes/base/BrowserScrollbar.less +0 -28
- package/src/sap/ui/core/themes/base/ScrollBar.less +4 -0
- package/src/sap/ui/core/themes/base/base.less +80 -31
- package/src/sap/ui/core/themes/base/global.less +5 -0
- package/src/sap/ui/core/themes/base/shared.less +4 -1
- package/src/sap/ui/core/themes/base/skeleton.less +7 -3
- package/src/sap/ui/core/themes/sap_hcb/LocalBusyIndicator.less +4 -0
- package/src/sap/ui/core/themes/sap_hcb/base_LocalBusyIndicator.less +4 -0
- package/src/sap/ui/core/themes/sap_hcb/base_ScrollBar.less +4 -0
- package/src/sap/ui/core/theming/Parameters.js +729 -754
- package/src/sap/ui/core/theming/ThemeHelper.js +0 -77
- package/src/sap/ui/core/theming/ThemeManager.js +536 -526
- package/src/sap/ui/core/tmpl/DOMAttribute.js +1 -1
- package/src/sap/ui/core/tmpl/DOMElement.js +1 -1
- package/src/sap/ui/core/tmpl/HandlebarsTemplate.js +1 -1
- package/src/sap/ui/core/tmpl/Template.js +1 -1
- package/src/sap/ui/core/tmpl/TemplateControl.js +1 -1
- package/src/sap/ui/core/util/AsyncHintsHelper.js +1 -1
- package/src/sap/ui/core/util/DraftEnabledMockServer.js +47 -43
- package/src/sap/ui/core/util/Export.js +1 -1
- package/src/sap/ui/core/util/ExportCell.js +1 -1
- package/src/sap/ui/core/util/ExportColumn.js +1 -1
- package/src/sap/ui/core/util/ExportRow.js +1 -1
- package/src/sap/ui/core/util/ExportType.js +1 -1
- package/src/sap/ui/core/util/ExportTypeCSV.js +1 -1
- package/src/sap/ui/core/util/File.js +1 -1
- package/src/sap/ui/core/util/LibraryInfo.js +1 -1
- package/src/sap/ui/core/util/MockServer.js +1 -1
- package/src/sap/ui/core/util/PasteHelper.js +1 -1
- package/src/sap/ui/core/util/serializer/HTMLViewSerializer.js +1 -1
- package/src/sap/ui/core/util/serializer/Serializer.js +1 -1
- package/src/sap/ui/core/util/serializer/ViewSerializer.js +1 -1
- package/src/sap/ui/core/util/serializer/XMLViewSerializer.js +1 -1
- package/src/sap/ui/core/util/serializer/delegate/Delegate.js +1 -1
- package/src/sap/ui/core/util/serializer/delegate/HTML.js +1 -1
- package/src/sap/ui/core/util/serializer/delegate/XML.js +1 -1
- package/src/sap/ui/core/webc/WebComponent.js +93 -45
- package/src/sap/ui/core/webc/WebComponentMetadata.js +40 -6
- package/src/sap/ui/core/ws/ReadyState.js +1 -1
- package/src/sap/ui/core/ws/SapPcpWebSocket.js +1 -1
- package/src/sap/ui/core/ws/WebSocket.js +1 -1
- package/src/sap/ui/debug/ControlTree.js +1 -1
- package/src/sap/ui/debug/DebugEnv.js +1 -1
- package/src/sap/ui/debug/PropertyList.js +1 -1
- package/src/sap/ui/dom/includeStylesheet.js +4 -1
- package/src/sap/ui/events/F6Navigation.js +11 -3
- package/src/sap/ui/model/ClientModel.js +1 -1
- package/src/sap/ui/model/CompositeDataState.js +1 -1
- package/src/sap/ui/model/CompositeType.js +1 -1
- package/src/sap/ui/model/DataState.js +1 -1
- package/src/sap/ui/model/MetaModel.js +1 -1
- package/src/sap/ui/model/Model.js +7 -7
- package/src/sap/ui/model/SelectionModel.js +1 -1
- package/src/sap/ui/model/SimpleType.js +1 -1
- package/src/sap/ui/model/TreeAutoExpandMode.js +1 -1
- package/src/sap/ui/model/Type.js +1 -1
- package/src/sap/ui/model/json/JSONModel.js +1 -1
- package/src/sap/ui/model/json/TypedJSONContext.js +16 -0
- package/src/sap/ui/model/json/TypedJSONModel.js +16 -0
- package/src/sap/ui/model/message/MessageModel.js +1 -1
- package/src/sap/ui/model/odata/AnnotationHelper.js +1 -1
- package/src/sap/ui/model/odata/ODataAnnotations.js +1 -1
- package/src/sap/ui/model/odata/ODataMessageParser.js +1 -1
- package/src/sap/ui/model/odata/ODataMetaModel.js +1 -1
- package/src/sap/ui/model/odata/ODataMetadata.js +4 -4
- package/src/sap/ui/model/odata/ODataModel.js +1 -1
- package/src/sap/ui/model/odata/ODataTreeBindingFlat.js +33 -80
- package/src/sap/ui/model/odata/_AnnotationHelperExpression.js +2 -2
- package/src/sap/ui/model/odata/type/Boolean.js +1 -1
- package/src/sap/ui/model/odata/type/Byte.js +1 -1
- package/src/sap/ui/model/odata/type/Currency.js +1 -1
- package/src/sap/ui/model/odata/type/Date.js +1 -1
- package/src/sap/ui/model/odata/type/DateTime.js +1 -1
- package/src/sap/ui/model/odata/type/DateTimeBase.js +1 -1
- package/src/sap/ui/model/odata/type/DateTimeOffset.js +1 -1
- package/src/sap/ui/model/odata/type/DateTimeWithTimezone.js +1 -1
- package/src/sap/ui/model/odata/type/Decimal.js +1 -1
- package/src/sap/ui/model/odata/type/Double.js +1 -1
- package/src/sap/ui/model/odata/type/Guid.js +1 -1
- package/src/sap/ui/model/odata/type/Int.js +1 -1
- package/src/sap/ui/model/odata/type/Int16.js +1 -1
- package/src/sap/ui/model/odata/type/Int32.js +1 -1
- package/src/sap/ui/model/odata/type/Int64.js +1 -1
- package/src/sap/ui/model/odata/type/ODataType.js +1 -1
- package/src/sap/ui/model/odata/type/Raw.js +1 -1
- package/src/sap/ui/model/odata/type/SByte.js +1 -1
- package/src/sap/ui/model/odata/type/Single.js +1 -1
- package/src/sap/ui/model/odata/type/Stream.js +1 -1
- package/src/sap/ui/model/odata/type/String.js +1 -1
- package/src/sap/ui/model/odata/type/Time.js +1 -1
- package/src/sap/ui/model/odata/type/TimeOfDay.js +1 -1
- package/src/sap/ui/model/odata/type/Unit.js +1 -1
- package/src/sap/ui/model/odata/v2/Context.js +1 -1
- package/src/sap/ui/model/odata/v2/ODataAnnotations.js +1 -1
- package/src/sap/ui/model/odata/v2/ODataContextBinding.js +2 -2
- package/src/sap/ui/model/odata/v2/ODataListBinding.js +2 -2
- package/src/sap/ui/model/odata/v2/ODataModel.js +63 -67
- package/src/sap/ui/model/odata/v2/ODataTreeBinding.js +84 -70
- package/src/sap/ui/model/odata/v4/AnnotationHelper.js +11 -7
- package/src/sap/ui/model/odata/v4/Context.js +27 -27
- package/src/sap/ui/model/odata/v4/ODataBinding.js +44 -28
- package/src/sap/ui/model/odata/v4/ODataContextBinding.js +16 -15
- package/src/sap/ui/model/odata/v4/ODataListBinding.js +35 -23
- package/src/sap/ui/model/odata/v4/ODataMetaModel.js +81 -53
- package/src/sap/ui/model/odata/v4/ODataModel.js +40 -24
- package/src/sap/ui/model/odata/v4/ODataParentBinding.js +50 -19
- package/src/sap/ui/model/odata/v4/ODataPropertyBinding.js +3 -3
- package/src/sap/ui/model/odata/v4/_AnnotationHelperExpression.js +14 -14
- package/src/sap/ui/model/odata/v4/lib/_AggregationCache.js +68 -18
- package/src/sap/ui/model/odata/v4/lib/_Batch.js +10 -7
- package/src/sap/ui/model/odata/v4/lib/_Cache.js +64 -74
- package/src/sap/ui/model/odata/v4/lib/_GroupLock.js +1 -1
- package/src/sap/ui/model/odata/v4/lib/_Helper.js +15 -15
- package/src/sap/ui/model/odata/v4/lib/_MetadataConverter.js +35 -4
- package/src/sap/ui/model/odata/v4/lib/_Requestor.js +29 -16
- package/src/sap/ui/model/odata/v4/lib/_V2Requestor.js +2 -2
- package/src/sap/ui/model/resource/ResourceModel.js +1 -1
- package/src/sap/ui/model/type/Boolean.js +1 -1
- package/src/sap/ui/model/type/Currency.js +1 -1
- package/src/sap/ui/model/type/Date.js +1 -1
- package/src/sap/ui/model/type/DateInterval.js +1 -1
- package/src/sap/ui/model/type/DateTime.js +1 -1
- package/src/sap/ui/model/type/DateTimeInterval.js +1 -1
- package/src/sap/ui/model/type/FileSize.js +1 -1
- package/src/sap/ui/model/type/Float.js +1 -1
- package/src/sap/ui/model/type/Integer.js +1 -1
- package/src/sap/ui/model/type/String.js +1 -1
- package/src/sap/ui/model/type/Time.js +1 -1
- package/src/sap/ui/model/type/TimeInterval.js +1 -1
- package/src/sap/ui/model/type/Unit.js +19 -5
- package/src/sap/ui/model/xml/XMLModel.js +1 -1
- package/src/sap/ui/performance/XHRInterceptor.js +14 -9
- package/src/sap/ui/performance/trace/FESR.js +4 -11
- package/src/sap/ui/performance/trace/Passport.js +3 -10
- package/src/sap/ui/performance/trace/_InteractionImpl.js +4 -10
- package/src/sap/ui/qunit/utils/ControlIterator.js +1 -2
- package/src/sap/ui/qunit/utils/MemoryLeakCheck.js +1 -1
- package/src/sap/ui/test/TestUtils.js +27 -15
- package/src/sap/ui/test/generic/TestBase.js +1 -1
- package/src/sap/ui/test/generic/Utils.js +6 -6
- package/src/sap/ui/test/gherkin/dataTableUtils.js +2 -2
- package/src/sap/ui/test/opaQunit.js +3 -0
- package/src/sap/ui/thirdparty/caja-html-sanitizer.js +8 -2
- package/src/sap/ui/thirdparty/qunit-2.js +4 -1
- package/src/sap/ui/util/Mobile.js +0 -9
- package/src/sap/ui/util/Storage.js +1 -1
- package/src/sap/ui/util/isCrossOriginURL.js +1 -1
- package/src/ui5loader.js +1 -1
- package/ui5.yaml +0 -1
- package/src/sap/ui/core/plugin/LessSupport.js +0 -542
|
@@ -4,874 +4,849 @@
|
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
5
|
*/
|
|
6
6
|
sap.ui.define([
|
|
7
|
-
'sap/ui/core/Lib',
|
|
8
7
|
'sap/ui/core/Theming',
|
|
9
|
-
'sap/ui/thirdparty/URI',
|
|
10
8
|
'../Element',
|
|
11
9
|
'sap/base/future',
|
|
12
10
|
'sap/base/Log',
|
|
13
|
-
'sap/base/util/extend',
|
|
14
11
|
'sap/base/util/syncFetch',
|
|
15
|
-
'sap/ui/
|
|
16
|
-
'./
|
|
17
|
-
],
|
|
18
|
-
|
|
12
|
+
'sap/ui/base/OwnStatics',
|
|
13
|
+
'./ThemeManager'
|
|
14
|
+
], function(
|
|
15
|
+
Theming,
|
|
16
|
+
Element,
|
|
17
|
+
future,
|
|
18
|
+
Log,
|
|
19
|
+
syncFetch,
|
|
20
|
+
OwnStatics,
|
|
21
|
+
ThemeManager
|
|
22
|
+
) {
|
|
19
23
|
"use strict";
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
if (oUri.is("relative")) {
|
|
69
|
-
// Rewrite relative URLs based on the theme base url
|
|
70
|
-
// Otherwise they would be relative to the HTML page which is incorrect
|
|
71
|
-
var sNormalizedUrl = oUri.absoluteTo(sThemeBaseUrl).normalize().toString();
|
|
72
|
-
sUrl = "url('" + sNormalizedUrl + "')";
|
|
73
|
-
}
|
|
25
|
+
const syncCallBehavior = sap.ui.loader._.getSyncCallBehavior();
|
|
26
|
+
const { attachChange } = OwnStatics.get(Theming);
|
|
27
|
+
const { getAllLibraryInfoObjects } = OwnStatics.get(ThemeManager);
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* A helper used for (read-only) access to CSS parameters at runtime.
|
|
31
|
+
*
|
|
32
|
+
* @author SAP SE
|
|
33
|
+
* @namespace
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
36
|
+
* @alias sap.ui.core.theming.Parameters
|
|
37
|
+
*/
|
|
38
|
+
var Parameters = {};
|
|
39
|
+
|
|
40
|
+
var mParameters = null;
|
|
41
|
+
var sTheme = null;
|
|
42
|
+
|
|
43
|
+
var aParametersToLoad = [...getAllLibraryInfoObjects().keys()];
|
|
44
|
+
|
|
45
|
+
var aCallbackRegistry = [];
|
|
46
|
+
|
|
47
|
+
var sBootstrapOrigin = new URL(sap.ui.require.toUrl(""), document.baseURI).origin;
|
|
48
|
+
var mOriginsNeedingCredentials = {};
|
|
49
|
+
|
|
50
|
+
// match a CSS url
|
|
51
|
+
var rCssUrl = /url[\s]*\('?"?([^\'")]*)'?"?\)/;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Resolves relative URLs in parameter values.
|
|
55
|
+
* Only for inline-parameters.
|
|
56
|
+
*
|
|
57
|
+
* Parameters containing CSS URLs will automatically be resolved to the theme-specific location they originate from.
|
|
58
|
+
*
|
|
59
|
+
* Example:
|
|
60
|
+
* A parameter for the "sap_horizon" theme will be resolved to a libraries "[library path...]/themes/sap_horizon" folder.
|
|
61
|
+
* Relative URLs can resolve backwards, too, so given the sample above, a parameter value of <code>url('../my_logo.jpeg')</code>
|
|
62
|
+
* will resolve to the "[library path...]/themes" folder.
|
|
63
|
+
*
|
|
64
|
+
* @param {string} sUrl the relative URL to resolve
|
|
65
|
+
* @param {string} sThemeBaseUrl the theme base URL, pointing to the library that contains the parameter
|
|
66
|
+
* @returns {string} the resolved URL in CSS URL notation
|
|
67
|
+
*/
|
|
68
|
+
function checkAndResolveRelativeUrl(sUrl, sThemeBaseUrl) {
|
|
69
|
+
function isRelativeUrl(sUrl) {
|
|
70
|
+
if (sUrl.startsWith('//') || /^[a-z][a-z0-9+.-]*:/i.test(sUrl)) {
|
|
71
|
+
return false; // URL definitiv absolut
|
|
74
72
|
}
|
|
75
73
|
|
|
76
|
-
return
|
|
74
|
+
return true; // URL is relative
|
|
77
75
|
}
|
|
78
76
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
const aMatch = rCssUrl.exec(sUrl);
|
|
78
|
+
if (aMatch) {
|
|
79
|
+
const oUrl = new URL(aMatch[1], sThemeBaseUrl);
|
|
80
|
+
if (isRelativeUrl(aMatch[1])) {
|
|
81
|
+
// Rewrite relative URLs based on the theme base url
|
|
82
|
+
const sNormalizedUrl = oUrl.href;
|
|
83
|
+
sUrl = "url('" + sNormalizedUrl + "')";
|
|
84
84
|
}
|
|
85
|
-
return mCurrent;
|
|
86
85
|
}
|
|
87
86
|
|
|
88
|
-
|
|
87
|
+
return sUrl;
|
|
88
|
+
}
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (typeof
|
|
93
|
-
|
|
94
|
-
"default": mNewParameters,
|
|
95
|
-
"scopes": {}
|
|
96
|
-
};
|
|
90
|
+
function mergeParameterSet(mCurrent, mNew, sThemeBaseUrl) {
|
|
91
|
+
for (var sParam in mNew) {
|
|
92
|
+
if (typeof mCurrent[sParam] === "undefined") {
|
|
93
|
+
mCurrent[sParam] = checkAndResolveRelativeUrl(mNew[sParam], sThemeBaseUrl);
|
|
97
94
|
}
|
|
95
|
+
}
|
|
96
|
+
return mCurrent;
|
|
97
|
+
}
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
99
|
+
function mergeParameters(mNewParameters, sThemeBaseUrl) {
|
|
100
|
+
|
|
101
|
+
// normalize parameter maps
|
|
102
|
+
// scoped themes like sap_belize already provide nested objects:
|
|
103
|
+
if (typeof mNewParameters["default"] !== "object") {
|
|
104
|
+
mNewParameters = {
|
|
105
|
+
"default": mNewParameters,
|
|
106
|
+
"scopes": {}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// ensure parameters objects
|
|
111
|
+
mParameters = mParameters || {};
|
|
112
|
+
mParameters["default"] = mParameters["default"] || {};
|
|
113
|
+
mParameters["scopes"] = mParameters["scopes"] || {};
|
|
114
|
+
|
|
115
|
+
// merge default parameters
|
|
116
|
+
mergeParameterSet(mParameters["default"], mNewParameters["default"], sThemeBaseUrl);
|
|
117
|
+
|
|
118
|
+
// merge scopes
|
|
119
|
+
if (typeof mNewParameters["scopes"] === "object") {
|
|
120
|
+
for (var sScopeName in mNewParameters["scopes"]) {
|
|
121
|
+
// ensure scope object
|
|
122
|
+
mParameters["scopes"][sScopeName] = mParameters["scopes"][sScopeName] || {};
|
|
123
|
+
// merge scope set
|
|
124
|
+
mergeParameterSet(mParameters["scopes"][sScopeName], mNewParameters["scopes"][sScopeName], sThemeBaseUrl);
|
|
115
125
|
}
|
|
116
126
|
}
|
|
127
|
+
}
|
|
117
128
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
});
|
|
129
|
+
function forEachStyleSheet(fnCallback) {
|
|
130
|
+
for (const [libId, libInfo] of getAllLibraryInfoObjects()) {
|
|
131
|
+
fnCallback(libId, libInfo);
|
|
122
132
|
}
|
|
133
|
+
}
|
|
123
134
|
|
|
124
|
-
|
|
125
|
-
|
|
135
|
+
function parseParameters(libInfo, bAsync) {
|
|
136
|
+
var oUrl = getThemeBaseUrlForId(libInfo);
|
|
126
137
|
|
|
127
|
-
|
|
138
|
+
var bThemeApplied = libInfo.finishedLoading;
|
|
128
139
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
140
|
+
if (!bThemeApplied && !bAsync) {
|
|
141
|
+
Log.warning("Parameters have been requested but theme is not applied, yet.", "sap.ui.core.theming.Parameters");
|
|
142
|
+
}
|
|
132
143
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
try {
|
|
144
|
-
sParams = decodeURIComponent(sParams);
|
|
145
|
-
} catch (ex) {
|
|
146
|
-
future.warningThrows("Could not decode theme parameters URI from " + oUrl.styleSheetUrl, { cause: ex });
|
|
147
|
-
}
|
|
148
|
-
}
|
|
144
|
+
// In some browsers (e.g. Safari) it might happen that after switching the theme or adopting the <link>'s href,
|
|
145
|
+
// the parameters from the previous stylesheet are taken. This can be prevented by checking whether the theme is applied.
|
|
146
|
+
if (bThemeApplied) {
|
|
147
|
+
var oLink = document.getElementById(libInfo.linkId);
|
|
148
|
+
var sDataUri = window.getComputedStyle(oLink).getPropertyValue("background-image");
|
|
149
|
+
var aParams = /\(["']?data:text\/plain;utf-8,(.*?)['"]?\)$/i.exec(sDataUri);
|
|
150
|
+
if (aParams && aParams.length >= 2) {
|
|
151
|
+
var sParams = aParams[1];
|
|
152
|
+
// decode only if necessary
|
|
153
|
+
if (sParams.charAt(0) !== "{" && sParams.charAt(sParams.length - 1) !== "}") {
|
|
149
154
|
try {
|
|
150
|
-
|
|
151
|
-
mergeParameters(oParams, oUrl.themeBaseUrl);
|
|
152
|
-
return true; // parameters successfully parsed
|
|
155
|
+
sParams = decodeURIComponent(sParams);
|
|
153
156
|
} catch (ex) {
|
|
154
|
-
future.warningThrows("Could not
|
|
157
|
+
future.warningThrows("Could not decode theme parameters URI from " + oUrl.styleSheetUrl, { cause: ex });
|
|
155
158
|
}
|
|
156
159
|
}
|
|
160
|
+
try {
|
|
161
|
+
var oParams = JSON.parse(sParams);
|
|
162
|
+
mergeParameters(oParams, oUrl.themeBaseUrl);
|
|
163
|
+
return true; // parameters successfully parsed
|
|
164
|
+
} catch (ex) {
|
|
165
|
+
future.warningThrows("Could not parse theme parameters from " + oUrl.styleSheetUrl + ".", { cause: ex , suffix: "Loading library-parameters.json as fallback solution." });
|
|
166
|
+
}
|
|
157
167
|
}
|
|
158
|
-
// sync: return false if parameter could not be parsed OR theme is not applied OR library has no parameters
|
|
159
|
-
// For sync path this triggers a sync library-parameters.json request as fallback
|
|
160
|
-
// async: always return bThemeApplied. Issues during parsing are not relevant for further processing because
|
|
161
|
-
// there is no fallback as in the sync case
|
|
162
|
-
return bAsync ? bThemeApplied : false;
|
|
163
168
|
}
|
|
169
|
+
// sync: return false if parameter could not be parsed OR theme is not applied OR library has no parameters
|
|
170
|
+
// For sync path this triggers a sync library-parameters.json request as fallback
|
|
171
|
+
// async: always return bThemeApplied. Issues during parsing are not relevant for further processing because
|
|
172
|
+
// there is no fallback as in the sync case
|
|
173
|
+
return bAsync ? bThemeApplied : false;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Load parameters for a library/theme combination as identified by the URL of the library.css
|
|
178
|
+
* @param {object} libInfo Library info object from ThemeManager
|
|
179
|
+
*/
|
|
180
|
+
function loadParameters(libInfo) {
|
|
181
|
+
var oUrl = getThemeBaseUrlForId(libInfo);
|
|
182
|
+
|
|
183
|
+
// try to parse the inline-parameters for the given library
|
|
184
|
+
// this may fail for a number of reasons, see below
|
|
185
|
+
if (!parseParameters(libInfo)) {
|
|
186
|
+
// derive parameter file URL from CSS file URL
|
|
187
|
+
// $1: name of library (incl. variants)
|
|
188
|
+
// $2: additional parameters, e.g. for sap-ui-merged, version/sap-ui-dist-version
|
|
189
|
+
var sUrl = oUrl.styleSheetUrl.replace(/\/(?:css_variables|library)([^\/.]*)\.(?:css|less)($|[?#])/, function($0, $1, $2) {
|
|
190
|
+
return "/library-parameters.json" + ($2 ? $2 : "");
|
|
191
|
+
});
|
|
164
192
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
// try to parse the inline-parameters for the given library
|
|
173
|
-
// this may fail for a number of reasons, see below
|
|
174
|
-
if (!parseParameters(sId)) {
|
|
175
|
-
// derive parameter file URL from CSS file URL
|
|
176
|
-
// $1: name of library (incl. variants)
|
|
177
|
-
// $2: additional parameters, e.g. for sap-ui-merged, version/sap-ui-dist-version
|
|
178
|
-
var sUrl = oUrl.styleSheetUrl.replace(/\/(?:css_variables|library)([^\/.]*)\.(?:css|less)($|[?#])/, function($0, $1, $2) {
|
|
179
|
-
return "/library-parameters.json" + ($2 ? $2 : "");
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
if (syncCallBehavior === 2) {
|
|
183
|
-
Log.error("[nosync] Loading library-parameters.json ignored", sUrl, "sap.ui.core.theming.Parameters");
|
|
184
|
-
return;
|
|
185
|
-
} else if (syncCallBehavior === 1) {
|
|
186
|
-
Log.error("[nosync] Loading library-parameters.json with sync XHR", sUrl, "sap.ui.core.theming.Parameters");
|
|
187
|
-
}
|
|
193
|
+
if (syncCallBehavior === 2) {
|
|
194
|
+
Log.error("[nosync] Loading library-parameters.json ignored", sUrl, "sap.ui.core.theming.Parameters");
|
|
195
|
+
return;
|
|
196
|
+
} else if (syncCallBehavior === 1) {
|
|
197
|
+
Log.error("[nosync] Loading library-parameters.json with sync XHR", sUrl, "sap.ui.core.theming.Parameters");
|
|
198
|
+
}
|
|
188
199
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
200
|
+
// check if we need to send credentials
|
|
201
|
+
// Note: sThemeBaseUrl must always be absolute, as it's derived from libInfo.getUrl().baseUrl which returns absolute URLs.
|
|
202
|
+
// If this fails, there's an error in the URL construction logic upstream.
|
|
203
|
+
const sThemeOrigin = new URL(oUrl.themeBaseUrl).origin;
|
|
204
|
+
var bWithCredentials = mOriginsNeedingCredentials[sThemeOrigin];
|
|
205
|
+
var aWithCredentials = [];
|
|
206
|
+
|
|
207
|
+
// initially we don't have any information if the target origin needs credentials or not ...
|
|
208
|
+
if (bWithCredentials === undefined) {
|
|
209
|
+
// ... so we assume that for all cross-origins except the UI5 bootstrap we need credentials.
|
|
210
|
+
// Setting the XHR's "withCredentials" flag does not do anything for same origin requests.
|
|
211
|
+
if (sUrl.startsWith(sBootstrapOrigin)) {
|
|
212
|
+
aWithCredentials = [false, true];
|
|
203
213
|
} else {
|
|
204
|
-
aWithCredentials = [
|
|
214
|
+
aWithCredentials = [true, false];
|
|
205
215
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
loadParametersJSON(sUrl, oUrl.themeBaseUrl, aWithCredentials);
|
|
216
|
+
} else {
|
|
217
|
+
aWithCredentials = [bWithCredentials];
|
|
209
218
|
}
|
|
219
|
+
|
|
220
|
+
// trigger a sync. loading of the parameters.json file
|
|
221
|
+
loadParametersJSON(sUrl, oUrl.themeBaseUrl, aWithCredentials);
|
|
210
222
|
}
|
|
223
|
+
}
|
|
211
224
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
225
|
+
function getThemeBaseUrlForId (libInfo) {
|
|
226
|
+
if (!libInfo.getUrl().url && !libInfo.cssLinkElement) {
|
|
227
|
+
future.warningThrows(`sap.ui.core.theming.Parameters: Could not find stylesheet element with ID "${libInfo.id}"`);
|
|
228
|
+
return undefined;
|
|
229
|
+
}
|
|
216
230
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
231
|
+
var sStyleSheetUrl = libInfo.getUrl().url || libInfo.cssLinkElement?.getAttribute("href");
|
|
232
|
+
// The baseUrl from libInfo.getUrl() returns an absolute URL without query parameters or fragments.
|
|
233
|
+
// To derive the theme base directory, we only need to remove the filename portion after the last "/"
|
|
234
|
+
// (e.g., "https://example.com/resources/sap/ui/core/themes/base/library.css" → "https://example.com/resources/sap/ui/core/themes/base/")
|
|
235
|
+
const sThemeBaseUrl = libInfo.getUrl().baseUrl.replace(/\/[^\/]*$/, '/');
|
|
221
236
|
|
|
222
|
-
|
|
237
|
+
// Remove CSS file name and query to create theme base url (to resolve relative urls)
|
|
238
|
+
return {
|
|
239
|
+
themeBaseUrl: sThemeBaseUrl,
|
|
240
|
+
styleSheetUrl : sStyleSheetUrl
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Loads a parameters.json file from given URL.
|
|
246
|
+
* @param {string} sUrl URL
|
|
247
|
+
* @param {string} sThemeBaseUrl Base URL
|
|
248
|
+
* @param {boolean[]} aWithCredentials probing values for requesting with or without credentials
|
|
249
|
+
*/
|
|
250
|
+
function loadParametersJSON(sUrl, sThemeBaseUrl, aWithCredentials) {
|
|
251
|
+
var oHeaders = {
|
|
252
|
+
Accept: syncFetch.ContentTypes.JSON
|
|
253
|
+
};
|
|
223
254
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
255
|
+
var bCurrentWithCredentials = aWithCredentials.shift();
|
|
256
|
+
if (bCurrentWithCredentials) {
|
|
257
|
+
// the X-Requested-With Header is essential for the Theming-Service to determine if a GET request will be handled
|
|
258
|
+
// This forces a preflight request which should give us valid Allow headers:
|
|
259
|
+
// Access-Control-Allow-Origin: ... fully qualified requestor origin ...
|
|
260
|
+
// Access-Control-Allow-Credentials: true
|
|
261
|
+
oHeaders["X-Requested-With"] = "XMLHttpRequest";
|
|
229
262
|
}
|
|
230
263
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
// Access-Control-Allow-Credentials: true
|
|
248
|
-
oHeaders["X-Requested-With"] = "XMLHttpRequest";
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
function fnErrorCallback(error) {
|
|
252
|
-
// ignore failure at least temporarily as long as there are libraries built using outdated tools which produce no json file
|
|
253
|
-
future.errorThrows("Could not load theme parameters from: " + sUrl, { cause: error }); // could be an error as well, but let's avoid more CSN messages...
|
|
254
|
-
|
|
255
|
-
if (aWithCredentials.length > 0) {
|
|
256
|
-
// In a CORS scenario, IF we have sent credentials on the first try AND the request failed,
|
|
257
|
-
// we expect that a service could have answered with the following Allow header:
|
|
258
|
-
// Access-Control-Allow-Origin: *
|
|
259
|
-
// In this case we must not send credentials, otherwise the service would have answered with:
|
|
260
|
-
// Access-Control-Allow-Origin: https://...
|
|
261
|
-
// Access-Control-Allow-Credentials: true
|
|
262
|
-
// Due to security constraints, the browser does not hand out any more information in a CORS scenario,
|
|
263
|
-
// so now we try again without credentials.
|
|
264
|
-
Log.warning("Initial library-parameters.json request failed ('withCredentials=" + bCurrentWithCredentials + "'; sUrl: '" + sUrl + "').\n" +
|
|
265
|
-
"Retrying with 'withCredentials=" + !bCurrentWithCredentials + "'.", "sap.ui.core.theming.Parameters");
|
|
266
|
-
loadParametersJSON(sUrl, sThemeBaseUrl, aWithCredentials);
|
|
267
|
-
}
|
|
264
|
+
function fnErrorCallback(error) {
|
|
265
|
+
// ignore failure at least temporarily as long as there are libraries built using outdated tools which produce no json file
|
|
266
|
+
future.errorThrows("Could not load theme parameters from: " + sUrl, { cause: error }); // could be an error as well, but let's avoid more CSN messages...
|
|
267
|
+
|
|
268
|
+
if (aWithCredentials.length > 0) {
|
|
269
|
+
// In a CORS scenario, IF we have sent credentials on the first try AND the request failed,
|
|
270
|
+
// we expect that a service could have answered with the following Allow header:
|
|
271
|
+
// Access-Control-Allow-Origin: *
|
|
272
|
+
// In this case we must not send credentials, otherwise the service would have answered with:
|
|
273
|
+
// Access-Control-Allow-Origin: https://...
|
|
274
|
+
// Access-Control-Allow-Credentials: true
|
|
275
|
+
// Due to security constraints, the browser does not hand out any more information in a CORS scenario,
|
|
276
|
+
// so now we try again without credentials.
|
|
277
|
+
Log.warning("Initial library-parameters.json request failed ('withCredentials=" + bCurrentWithCredentials + "'; sUrl: '" + sUrl + "').\n" +
|
|
278
|
+
"Retrying with 'withCredentials=" + !bCurrentWithCredentials + "'.", "sap.ui.core.theming.Parameters");
|
|
279
|
+
loadParametersJSON(sUrl, sThemeBaseUrl, aWithCredentials);
|
|
268
280
|
}
|
|
281
|
+
}
|
|
269
282
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
mergeParameters(data, sThemeBaseUrl);
|
|
283
|
+
// load and evaluate parameter file
|
|
284
|
+
try {
|
|
285
|
+
var response = syncFetch(sUrl, {
|
|
286
|
+
credentials: bCurrentWithCredentials ? "include" : "omit",
|
|
287
|
+
headers: oHeaders
|
|
288
|
+
});
|
|
289
|
+
if (response.ok) {
|
|
290
|
+
var data = response.json();
|
|
291
|
+
// Note: sThemeBaseUrl must always be absolute, as it's derived from libInfo.getUrl().baseUrl which returns absolute URLs.
|
|
292
|
+
// If this fails, there's an error in the URL construction logic upstream.
|
|
293
|
+
const sThemeOrigin = new URL(sThemeBaseUrl).origin;
|
|
294
|
+
// Once we have a successful request we track the credentials setting for this origin
|
|
295
|
+
mOriginsNeedingCredentials[sThemeOrigin] = bCurrentWithCredentials;
|
|
296
|
+
|
|
297
|
+
if (Array.isArray(data)) {
|
|
298
|
+
// in the sap-ui-merged use case, multiple JSON files are merged into and transferred as a single JSON array
|
|
299
|
+
for (var j = 0; j < data.length; j++) {
|
|
300
|
+
var oParams = data[j];
|
|
301
|
+
mergeParameters(oParams, sThemeBaseUrl);
|
|
290
302
|
}
|
|
291
303
|
} else {
|
|
292
|
-
|
|
304
|
+
mergeParameters(data, sThemeBaseUrl);
|
|
293
305
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
fnErrorCallback(error);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Retrieves a map containing all inline-parameters.
|
|
302
|
-
*
|
|
303
|
-
* @param {boolean} bAsync=undefined whether to load and parse the parameters asynchronously, default sync
|
|
304
|
-
* @returns {object} a map of all parameters
|
|
305
|
-
*/
|
|
306
|
-
function getParameters(bAsync) {
|
|
307
|
-
// Initial loading
|
|
308
|
-
if (!mParameters) {
|
|
309
|
-
// Merge an empty parameter set to initialize the internal object
|
|
310
|
-
mergeParameters({}, "");
|
|
311
|
-
|
|
312
|
-
forEachStyleSheet(function (sId) {
|
|
313
|
-
if (bAsync) {
|
|
314
|
-
if (!parseParameters(sId, bAsync)) {
|
|
315
|
-
aParametersToLoad.push(sId);
|
|
316
|
-
}
|
|
317
|
-
} else {
|
|
318
|
-
loadParameters(sId);
|
|
319
|
-
}
|
|
320
|
-
});
|
|
306
|
+
} else {
|
|
307
|
+
throw new Error(response.statusText || response.status);
|
|
321
308
|
}
|
|
322
309
|
|
|
323
|
-
|
|
310
|
+
} catch (error) {
|
|
311
|
+
fnErrorCallback(error);
|
|
324
312
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Retrieves a map containing all inline-parameters.
|
|
317
|
+
*
|
|
318
|
+
* @param {boolean} bAsync=undefined whether to load and parse the parameters asynchronously, default sync
|
|
319
|
+
* @returns {object} a map of all parameters
|
|
320
|
+
*/
|
|
321
|
+
function getParameters(bAsync) {
|
|
322
|
+
// Initial loading
|
|
323
|
+
if (!mParameters) {
|
|
324
|
+
// Merge an empty parameter set to initialize the internal object
|
|
325
|
+
mergeParameters({}, "");
|
|
326
|
+
|
|
327
|
+
forEachStyleSheet(function (libId, libInfo) {
|
|
328
|
+
if (bAsync) {
|
|
329
|
+
if (!parseParameters(libInfo, bAsync)) {
|
|
330
|
+
aParametersToLoad.push(libId);
|
|
331
|
+
}
|
|
332
|
+
} else {
|
|
333
|
+
loadParameters(libInfo);
|
|
333
334
|
}
|
|
334
335
|
});
|
|
335
|
-
|
|
336
|
-
// Keep theme IDs which are not ready for later
|
|
337
|
-
aParametersToLoad = aPendingThemes;
|
|
338
336
|
}
|
|
339
337
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
*/
|
|
343
|
-
function loadPendingLibraryParameters() {
|
|
344
|
-
// lazy loading of further library parameters
|
|
345
|
-
aParametersToLoad.forEach(loadParameters);
|
|
346
|
-
|
|
347
|
-
// clear queue
|
|
348
|
-
aParametersToLoad = [];
|
|
349
|
-
}
|
|
338
|
+
return mParameters;
|
|
339
|
+
}
|
|
350
340
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
* Must be called AFTER a link-tag (with id: "sap-ui-theme" + sLibName) for the theme has been created.
|
|
354
|
-
* @param {string} sLibId id of theme link-tag
|
|
355
|
-
* @private
|
|
356
|
-
*/
|
|
357
|
-
Parameters._addLibraryTheme = function(sLibId) {
|
|
358
|
-
// only queue new libraries if some have been loaded already
|
|
359
|
-
// otherwise they will be loaded when the first one requests a parameter
|
|
360
|
-
// see "Parameters.get" for lazy loading of queued library parameters
|
|
361
|
-
if (mParameters) {
|
|
362
|
-
aParametersToLoad.push("sap-ui-theme-" + sLibId);
|
|
363
|
-
}
|
|
364
|
-
};
|
|
341
|
+
function parsePendingLibraryParameters() {
|
|
342
|
+
var aPendingThemes = [];
|
|
365
343
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
* @param {string} mOptions.parameterName Parameter name / key
|
|
371
|
-
* @param {string} mOptions.scopeName Scope name
|
|
372
|
-
* @param {boolean} mOptions.loadPendingParameters If set to "true" and no parameter value is found,
|
|
373
|
-
* all pending parameters will be loaded (see Parameters._addLibraryTheme)
|
|
374
|
-
* @param {boolean} mOptions.async whether the parameter value should be retrieved asynchronous
|
|
375
|
-
* @returns {string|undefined} parameter value or undefined
|
|
376
|
-
* @private
|
|
377
|
-
*/
|
|
378
|
-
function getParam(mOptions) {
|
|
379
|
-
var bAsync = mOptions.async, oParams = getParameters(bAsync);
|
|
380
|
-
if (mOptions.scopeName) {
|
|
381
|
-
oParams = oParams["scopes"][mOptions.scopeName];
|
|
382
|
-
} else {
|
|
383
|
-
oParams = oParams["default"];
|
|
344
|
+
aParametersToLoad.forEach(function (sId) {
|
|
345
|
+
// Try to parse parameters (in case theme is already applied). Else keep parameter ID for later
|
|
346
|
+
if (!parseParameters(getAllLibraryInfoObjects(sId), /*bAsync=*/true)) {
|
|
347
|
+
aPendingThemes.push(sId);
|
|
384
348
|
}
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
// Keep theme IDs which are not ready for later
|
|
352
|
+
aParametersToLoad = aPendingThemes;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Loads library-parameters.json files if some libraries are missing.
|
|
357
|
+
*/
|
|
358
|
+
function loadPendingLibraryParameters() {
|
|
359
|
+
// lazy loading of further library parameters
|
|
360
|
+
aParametersToLoad.map((id) => getAllLibraryInfoObjects(id)).forEach(loadParameters);
|
|
361
|
+
|
|
362
|
+
// clear queue
|
|
363
|
+
aParametersToLoad = [];
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Called by the Core when a new library and its stylesheet have been loaded.
|
|
368
|
+
* Must be called AFTER a link-tag (with id: "sap-ui-theme" + sLibName) for the theme has been created.
|
|
369
|
+
* @param {string} sLibId id of theme link-tag
|
|
370
|
+
* @private
|
|
371
|
+
*/
|
|
372
|
+
Parameters._addLibraryTheme = function(sLibId) {
|
|
373
|
+
aParametersToLoad.push(sLibId);
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Returns parameter value from given map and handles legacy parameter names
|
|
378
|
+
*
|
|
379
|
+
* @param {object} mOptions options map
|
|
380
|
+
* @param {string} mOptions.parameterName Parameter name / key
|
|
381
|
+
* @param {string} mOptions.scopeName Scope name
|
|
382
|
+
* @param {boolean} mOptions.loadPendingParameters If set to "true" and no parameter value is found,
|
|
383
|
+
* all pending parameters will be loaded (see Parameters._addLibraryTheme)
|
|
384
|
+
* @param {boolean} mOptions.async whether the parameter value should be retrieved asynchronous
|
|
385
|
+
* @returns {string|undefined} parameter value or undefined
|
|
386
|
+
* @private
|
|
387
|
+
*/
|
|
388
|
+
function getParam(mOptions) {
|
|
389
|
+
var bAsync = mOptions.async, oParams = getParameters(bAsync);
|
|
390
|
+
if (mOptions.scopeName) {
|
|
391
|
+
oParams = oParams["scopes"][mOptions.scopeName];
|
|
392
|
+
} else {
|
|
393
|
+
oParams = oParams["default"];
|
|
394
|
+
}
|
|
385
395
|
|
|
386
|
-
|
|
396
|
+
var sParamValue = oParams[mOptions.parameterName];
|
|
387
397
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
}
|
|
398
|
+
// [Compatibility]: if a parameter contains a prefix, we cut off the ":" and try again
|
|
399
|
+
// e.g. "my.lib:paramName"
|
|
400
|
+
if (!sParamValue) {
|
|
401
|
+
var iIndex = mOptions.parameterName.indexOf(":");
|
|
402
|
+
if (iIndex != -1) {
|
|
403
|
+
var sParamNameWithoutColon = mOptions.parameterName.substr(iIndex + 1);
|
|
404
|
+
sParamValue = oParams[sParamNameWithoutColon];
|
|
396
405
|
}
|
|
406
|
+
}
|
|
397
407
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
// is added asynchronous after initLibrary has been executed
|
|
402
|
-
var aAllLibrariesRequireCss = Library.getAllInstancesRequiringCss();
|
|
403
|
-
aAllLibrariesRequireCss.forEach(function (oLibThemingInfo) {
|
|
404
|
-
ThemeManager._includeLibraryThemeAndEnsureThemeRoot(oLibThemingInfo);
|
|
405
|
-
});
|
|
406
|
-
|
|
407
|
-
loadPendingLibraryParameters();
|
|
408
|
-
sParamValue = getParam({
|
|
409
|
-
parameterName: mOptions.parameterName,
|
|
410
|
-
scopeName: mOptions.scopeName,
|
|
411
|
-
loadPendingParameters: false // prevent recursion
|
|
412
|
-
});
|
|
413
|
-
}
|
|
408
|
+
// Sync: Fallback path for when parameter could not be found so far, library.css MIGHT be not loaded
|
|
409
|
+
if (mOptions.loadPendingParameters && typeof sParamValue === "undefined" && !bAsync) {
|
|
410
|
+
loadPendingLibraryParameters();
|
|
414
411
|
|
|
415
|
-
|
|
412
|
+
sParamValue = getParam({
|
|
413
|
+
parameterName: mOptions.parameterName,
|
|
414
|
+
scopeName: mOptions.scopeName,
|
|
415
|
+
loadPendingParameters: false // prevent recursion
|
|
416
|
+
});
|
|
416
417
|
}
|
|
417
418
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
var aScopeChain = Parameters.getActiveScopesFor(oElement, bAsync);
|
|
419
|
+
return sParamValue;
|
|
420
|
+
}
|
|
421
421
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
}
|
|
426
|
-
return aResult;
|
|
427
|
-
}, []);
|
|
422
|
+
function getParamForActiveScope(sParamName, oElement, bAsync) {
|
|
423
|
+
// check for scopes and try to find the classes in Control Tree
|
|
424
|
+
var aScopeChain = Parameters.getActiveScopesFor(oElement, bAsync);
|
|
428
425
|
|
|
429
|
-
|
|
430
|
-
|
|
426
|
+
var aFilteredScopeChain = aScopeChain.flat().reduce(function (aResult, sScope) {
|
|
427
|
+
if (aResult.indexOf(sScope) === -1) {
|
|
428
|
+
aResult.push(sScope);
|
|
429
|
+
}
|
|
430
|
+
return aResult;
|
|
431
|
+
}, []);
|
|
431
432
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
scopeName: sScopeName,
|
|
435
|
-
async: bAsync
|
|
436
|
-
});
|
|
433
|
+
for (var i = 0; i < aFilteredScopeChain.length; i++) {
|
|
434
|
+
var sScopeName = aFilteredScopeChain[i];
|
|
437
435
|
|
|
438
|
-
|
|
439
|
-
return sParamValue;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
// if no matching scope was found return the default parameter
|
|
443
|
-
return getParam({
|
|
436
|
+
var sParamValue = getParam({
|
|
444
437
|
parameterName: sParamName,
|
|
438
|
+
scopeName: sScopeName,
|
|
445
439
|
async: bAsync
|
|
446
440
|
});
|
|
447
|
-
}
|
|
448
441
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
442
|
+
if (sParamValue) {
|
|
443
|
+
return sParamValue;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
// if no matching scope was found return the default parameter
|
|
447
|
+
return getParam({
|
|
448
|
+
parameterName: sParamName,
|
|
449
|
+
async: bAsync
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Returns the scopes from current theming parameters.
|
|
455
|
+
*
|
|
456
|
+
* @private
|
|
457
|
+
* @ui5-restricted sap.ui.core
|
|
458
|
+
* @param {boolean} [bAvoidLoading] Whether loading of parameters should be avoided
|
|
459
|
+
* @param {boolean} [bAsync] Whether loading of parameters should be asynchronous
|
|
460
|
+
* @return {string[]|undefined} Scope names
|
|
461
|
+
*/
|
|
462
|
+
Parameters._getScopes = function(bAvoidLoading, bAsync) {
|
|
463
|
+
if ( bAvoidLoading && !mParameters ) {
|
|
464
|
+
return undefined;
|
|
465
|
+
}
|
|
466
|
+
var oParams = getParameters(bAsync);
|
|
467
|
+
var aScopes = Object.keys(oParams["scopes"]);
|
|
468
|
+
return aScopes;
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Returns the active scope(s) for a given control by looking up the hierarchy.
|
|
473
|
+
*
|
|
474
|
+
* The lookup navigates the DOM hierarchy if it's available. Otherwise if controls aren't rendered yet,
|
|
475
|
+
* it navigates the control hierarchy. By navigating the control hierarchy, inner-html elements
|
|
476
|
+
* with the respective scope classes can't get recognized as the Custom Style Class API does only for
|
|
477
|
+
* root elements.
|
|
478
|
+
*
|
|
479
|
+
* @private
|
|
480
|
+
* @ui5-restricted sap.viz
|
|
481
|
+
* @param {object} oElement element/control instance
|
|
482
|
+
* @param {boolean} bAsync Whether the scope should be retrieved asynchronous
|
|
483
|
+
* @return {Array.<Array.<string>>} Two dimensional array with scopes in bottom up order
|
|
484
|
+
*/
|
|
485
|
+
Parameters.getActiveScopesFor = function(oElement, bAsync) {
|
|
486
|
+
var aScopeChain = [];
|
|
487
|
+
|
|
488
|
+
if (oElement instanceof Element) {
|
|
489
|
+
var domRef = oElement.getDomRef();
|
|
490
|
+
|
|
491
|
+
// make sure to first load all pending parameters
|
|
492
|
+
// doing it later (lazy) might change the behavior in case a scope is initially not defined
|
|
493
|
+
if (bAsync) {
|
|
494
|
+
parsePendingLibraryParameters();
|
|
495
|
+
} else {
|
|
496
|
+
loadPendingLibraryParameters();
|
|
461
497
|
}
|
|
462
|
-
var oParams = getParameters(bAsync);
|
|
463
|
-
var aScopes = Object.keys(oParams["scopes"]);
|
|
464
|
-
return aScopes;
|
|
465
|
-
};
|
|
466
|
-
|
|
467
|
-
/**
|
|
468
|
-
* Returns the active scope(s) for a given control by looking up the hierarchy.
|
|
469
|
-
*
|
|
470
|
-
* The lookup navigates the DOM hierarchy if it's available. Otherwise if controls aren't rendered yet,
|
|
471
|
-
* it navigates the control hierarchy. By navigating the control hierarchy, inner-html elements
|
|
472
|
-
* with the respective scope classes can't get recognized as the Custom Style Class API does only for
|
|
473
|
-
* root elements.
|
|
474
|
-
*
|
|
475
|
-
* @private
|
|
476
|
-
* @ui5-restricted sap.viz
|
|
477
|
-
* @param {object} oElement element/control instance
|
|
478
|
-
* @param {boolean} bAsync Whether the scope should be retrieved asynchronous
|
|
479
|
-
* @return {Array.<Array.<string>>} Two dimensional array with scopes in bottom up order
|
|
480
|
-
*/
|
|
481
|
-
Parameters.getActiveScopesFor = function(oElement, bAsync) {
|
|
482
|
-
var aScopeChain = [];
|
|
483
498
|
|
|
484
|
-
|
|
485
|
-
|
|
499
|
+
// check for scopes and try to find the classes in parent chain
|
|
500
|
+
var aScopes = this._getScopes(undefined, bAsync);
|
|
486
501
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
}
|
|
502
|
+
if (aScopes.length) {
|
|
503
|
+
if (domRef) {
|
|
504
|
+
var fnNodeHasStyleClass = function(sScopeName) {
|
|
505
|
+
var scopeList = domRef.classList;
|
|
506
|
+
return scopeList && scopeList.contains(sScopeName);
|
|
507
|
+
};
|
|
494
508
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
if (domRef) {
|
|
500
|
-
var fnNodeHasStyleClass = function(sScopeName) {
|
|
501
|
-
var scopeList = domRef.classList;
|
|
502
|
-
return scopeList && scopeList.contains(sScopeName);
|
|
503
|
-
};
|
|
504
|
-
|
|
505
|
-
while (domRef) {
|
|
506
|
-
var aFoundScopeClasses = aScopes.filter(fnNodeHasStyleClass);
|
|
507
|
-
if (aFoundScopeClasses.length > 0) {
|
|
508
|
-
aScopeChain.push(aFoundScopeClasses);
|
|
509
|
-
}
|
|
510
|
-
domRef = domRef.parentNode;
|
|
509
|
+
while (domRef) {
|
|
510
|
+
const aFoundScopeClasses = aScopes.filter(fnNodeHasStyleClass);
|
|
511
|
+
if (aFoundScopeClasses.length > 0) {
|
|
512
|
+
aScopeChain.push(aFoundScopeClasses);
|
|
511
513
|
}
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
514
|
+
domRef = domRef.parentNode;
|
|
515
|
+
}
|
|
516
|
+
} else {
|
|
517
|
+
var fnControlHasStyleClass = function(sScopeName) {
|
|
518
|
+
return typeof oElement.hasStyleClass === "function" && oElement.hasStyleClass(sScopeName);
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
while (oElement) {
|
|
522
|
+
const aFoundScopeClasses = aScopes.filter(fnControlHasStyleClass);
|
|
523
|
+
if (aFoundScopeClasses.length > 0) {
|
|
524
|
+
aScopeChain.push(aFoundScopeClasses);
|
|
523
525
|
}
|
|
526
|
+
oElement = typeof oElement.getParent === "function" && oElement.getParent();
|
|
524
527
|
}
|
|
525
528
|
}
|
|
526
529
|
}
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
530
|
+
}
|
|
531
|
+
return aScopeChain;
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
*
|
|
536
|
+
* Theming Parameter Value
|
|
537
|
+
*
|
|
538
|
+
* @typedef {(string|Object<string,string>|undefined)} sap.ui.core.theming.Parameters.Value
|
|
539
|
+
* @public
|
|
540
|
+
*/
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* <p>
|
|
544
|
+
* Returns the current value for one or more theming parameters, depending on the given arguments.
|
|
545
|
+
* The synchronous usage of this API has been deprecated and only the asynchronous usage should still be used
|
|
546
|
+
* (see the 4th bullet point and the code examples below).
|
|
547
|
+
* </p>
|
|
548
|
+
*
|
|
549
|
+
* <p>
|
|
550
|
+
* The theming parameters are immutable and cannot be changed at runtime.
|
|
551
|
+
* Multiple <code>Parameters.get()</code> API calls for the same parameter name will always result in the same parameter value.
|
|
552
|
+
* </p>
|
|
553
|
+
*
|
|
554
|
+
* <p>
|
|
555
|
+
* The following API variants are available (see also the below examples):
|
|
556
|
+
* <ul>
|
|
557
|
+
* <li> <b>(deprecated since 1.92)</b> If no parameter is given a key-value map containing all parameters is returned</li>
|
|
558
|
+
* <li> <b>(deprecated since 1.94)</b> If a <code>string</code> is given as first parameter the value is returned as a <code>string</code></li>
|
|
559
|
+
* <li> <b>(deprecated since 1.94)</b> If an <code>array</code> is given as first parameter a key-value map containing all parameters from the <code>array</code> is returned</li>
|
|
560
|
+
* <li>If an <code>object</code> is given as first parameter the result is returned immediately in case all parameters are loaded and available or within the callback in case not all CSS files are already loaded.
|
|
561
|
+
* This is the <b>only asynchronous</b> API variant. This variant is the preferred way to retrieve theming parameters.
|
|
562
|
+
* The structure of the return value is the same as listed above depending on the type of the name property within the <code>object</code>.</li>
|
|
563
|
+
* </ul>
|
|
564
|
+
* </p>
|
|
565
|
+
*
|
|
566
|
+
* <p>The returned key-value maps are a copy so changing values in the map does not have any effect</p>
|
|
567
|
+
*
|
|
568
|
+
* <p>
|
|
569
|
+
* Please see the examples below for a detailed guide on how to use the <b>asynchronous variant</b> of the API.
|
|
570
|
+
* </p>
|
|
571
|
+
*
|
|
572
|
+
* @example <caption>Scenario 1: Parameters are already available</caption>
|
|
573
|
+
* // "sapUiParam1", "sapUiParam2", "sapUiParam3" are already available
|
|
574
|
+
* Parameters.get({
|
|
575
|
+
* name: ["sapUiParam1", "sapUiParam2", "sapUiParam3"],
|
|
576
|
+
* callback: function(mParams) {
|
|
577
|
+
* // callback is not called, since all Parameters are available synchronously
|
|
578
|
+
* }
|
|
579
|
+
* });
|
|
580
|
+
* // As described above, returns a map with key-value pairs corresponding to the parameters:
|
|
581
|
+
* // mParams = {sapUiParam1: '...value...', sapUiParam2: '...value...', sapUiParam3: '...value...'}
|
|
582
|
+
*
|
|
583
|
+
* @example <caption>Scenario 2: Some Parameters are missing </caption>
|
|
584
|
+
* // "sapUiParam1", "sapUiParam2" are already available
|
|
585
|
+
* // "sapUiParam3" is not yet available
|
|
586
|
+
* Parameters.get({
|
|
587
|
+
* name: ["sapUiParam1", "sapUiParam2", "sapUiParam3"],
|
|
588
|
+
* callback: function(mParams) {
|
|
589
|
+
* // Parameters.get() callback gets the same map with key-value pairs as in "Scenario 1".
|
|
590
|
+
* // mParams = {sapUiParam1: '...value...', sapUiParam2: '...value...', sapUiParam3: '...value...'}
|
|
591
|
+
* }
|
|
592
|
+
* });
|
|
593
|
+
* // return-value is undefined, since not all Parameters are yet available synchronously
|
|
594
|
+
*
|
|
595
|
+
* @example <caption>Scenario 3: Default values</caption>
|
|
596
|
+
* // Scenario 1 (all parameters are available): the returned parameter map can be used to merge with a map of default values.
|
|
597
|
+
* // Scenario 2 (one or more parameters are missing): the returned undefined value does not change the default parameters
|
|
598
|
+
* // This allows you to always retrieve a consistent set of parameters, either synchronously via the return-value or asynchronously via the provided callback.
|
|
599
|
+
* var mMyParams = Object.assign({
|
|
600
|
+
* sapUiParam1: "1rem",
|
|
601
|
+
* sapUiParam2: "#FF0000",
|
|
602
|
+
* sapUiParam3: "16px"
|
|
603
|
+
* }, Parameters.get({
|
|
604
|
+
* name: ["sapUiParam1", "sapUiParam2", "sapUiParam3"],
|
|
605
|
+
* callback: function(mParams) {
|
|
606
|
+
* // merge the current parameters with the actual parameters in case they are retrieved asynchronously
|
|
607
|
+
* Object.assign(mMyParams, mParams);
|
|
608
|
+
* }
|
|
609
|
+
* }));
|
|
610
|
+
*
|
|
611
|
+
* @param {string | string[] | object} vName the (array with) CSS parameter name(s) or an object containing the (array with) CSS parameter name(s),
|
|
612
|
+
* the scopeElement and a callback for async retrieval of parameters.
|
|
613
|
+
* @param {string | string[]} vName.name the (array with) CSS parameter name(s)
|
|
614
|
+
* @param {sap.ui.core.Element} [vName.scopeElement]
|
|
615
|
+
* Element / control instance to take into account when looking for a parameter value.
|
|
616
|
+
* This can make a difference when a parameter value is overridden in a theme scope set via a CSS class.
|
|
617
|
+
* @param {function(sap.ui.core.theming.Parameters.Value)} [vName.callback] If given, the callback is only executed in case there are still parameters pending and one or more of the requested parameters is missing.
|
|
618
|
+
* @param {sap.ui.core.Element} [oElement]
|
|
619
|
+
* Element / control instance to take into account when looking for a parameter value.
|
|
620
|
+
* This can make a difference when a parameter value is overridden in a theme scope set via a CSS class.
|
|
621
|
+
* @returns {sap.ui.core.theming.Parameters.Value} the CSS parameter value(s) or <code>undefined</code> if the parameters could not be retrieved.
|
|
622
|
+
*
|
|
623
|
+
* @public
|
|
624
|
+
*/
|
|
625
|
+
Parameters.get = function(vName, oElement) {
|
|
626
|
+
let sParamName, fnAsyncCallback, bAsync, aNames, iIndex;
|
|
627
|
+
|
|
628
|
+
// Whether parameters containing CSS URLs should be parsed into regular URL strings,
|
|
629
|
+
// e.g. a parameter value of url('https://myapp.sample/image.jpeg') will be returned as "https://myapp.sample/image.jpeg".
|
|
630
|
+
// Empty strings as well as the special CSS value 'none' will be parsed to null.
|
|
631
|
+
let bParseUrls;
|
|
632
|
+
|
|
633
|
+
var findRegisteredCallback = function (oCallbackInfo) { return oCallbackInfo.callback === fnAsyncCallback; };
|
|
634
|
+
|
|
635
|
+
if (!sTheme) {
|
|
636
|
+
sTheme = Theming.getTheme();
|
|
637
|
+
}
|
|
537
638
|
|
|
538
639
|
/**
|
|
539
|
-
*
|
|
540
|
-
*
|
|
541
|
-
*
|
|
542
|
-
* (see the 4th bullet point and the code examples below).
|
|
543
|
-
* </p>
|
|
544
|
-
*
|
|
545
|
-
* <p>
|
|
546
|
-
* The theming parameters are immutable and cannot be changed at runtime.
|
|
547
|
-
* Multiple <code>Parameters.get()</code> API calls for the same parameter name will always result in the same parameter value.
|
|
548
|
-
* </p>
|
|
549
|
-
*
|
|
550
|
-
* <p>
|
|
551
|
-
* The following API variants are available (see also the below examples):
|
|
552
|
-
* <ul>
|
|
553
|
-
* <li> <b>(deprecated since 1.92)</b> If no parameter is given a key-value map containing all parameters is returned</li>
|
|
554
|
-
* <li> <b>(deprecated since 1.94)</b> If a <code>string</code> is given as first parameter the value is returned as a <code>string</code></li>
|
|
555
|
-
* <li> <b>(deprecated since 1.94)</b> If an <code>array</code> is given as first parameter a key-value map containing all parameters from the <code>array</code> is returned</li>
|
|
556
|
-
* <li>If an <code>object</code> is given as first parameter the result is returned immediately in case all parameters are loaded and available or within the callback in case not all CSS files are already loaded.
|
|
557
|
-
* This is the <b>only asynchronous</b> API variant. This variant is the preferred way to retrieve theming parameters.
|
|
558
|
-
* The structure of the return value is the same as listed above depending on the type of the name property within the <code>object</code>.</li>
|
|
559
|
-
* </ul>
|
|
560
|
-
* </p>
|
|
561
|
-
*
|
|
562
|
-
* <p>The returned key-value maps are a copy so changing values in the map does not have any effect</p>
|
|
563
|
-
*
|
|
564
|
-
* <p>
|
|
565
|
-
* Please see the examples below for a detailed guide on how to use the <b>asynchronous variant</b> of the API.
|
|
566
|
-
* </p>
|
|
567
|
-
*
|
|
568
|
-
* @example <caption>Scenario 1: Parameters are already available</caption>
|
|
569
|
-
* // "sapUiParam1", "sapUiParam2", "sapUiParam3" are already available
|
|
570
|
-
* Parameters.get({
|
|
571
|
-
* name: ["sapUiParam1", "sapUiParam2", "sapUiParam3"],
|
|
572
|
-
* callback: function(mParams) {
|
|
573
|
-
* // callback is not called, since all Parameters are available synchronously
|
|
574
|
-
* }
|
|
575
|
-
* });
|
|
576
|
-
* // As described above, returns a map with key-value pairs corresponding to the parameters:
|
|
577
|
-
* // mParams = {sapUiParam1: '...value...', sapUiParam2: '...value...', sapUiParam3: '...value...'}
|
|
578
|
-
*
|
|
579
|
-
* @example <caption>Scenario 2: Some Parameters are missing </caption>
|
|
580
|
-
* // "sapUiParam1", "sapUiParam2" are already available
|
|
581
|
-
* // "sapUiParam3" is not yet available
|
|
582
|
-
* Parameters.get({
|
|
583
|
-
* name: ["sapUiParam1", "sapUiParam2", "sapUiParam3"],
|
|
584
|
-
* callback: function(mParams) {
|
|
585
|
-
* // Parameters.get() callback gets the same map with key-value pairs as in "Scenario 1".
|
|
586
|
-
* // mParams = {sapUiParam1: '...value...', sapUiParam2: '...value...', sapUiParam3: '...value...'}
|
|
587
|
-
* }
|
|
588
|
-
* });
|
|
589
|
-
* // return-value is undefined, since not all Parameters are yet available synchronously
|
|
590
|
-
*
|
|
591
|
-
* @example <caption>Scenario 3: Default values</caption>
|
|
592
|
-
* // Scenario 1 (all parameters are available): the returned parameter map can be used to merge with a map of default values.
|
|
593
|
-
* // Scenario 2 (one or more parameters are missing): the returned undefined value does not change the default parameters
|
|
594
|
-
* // This allows you to always retrieve a consistent set of parameters, either synchronously via the return-value or asynchronously via the provided callback.
|
|
595
|
-
* var mMyParams = Object.assign({
|
|
596
|
-
* sapUiParam1: "1rem",
|
|
597
|
-
* sapUiParam2: "#FF0000",
|
|
598
|
-
* sapUiParam3: "16px"
|
|
599
|
-
* }, Parameters.get({
|
|
600
|
-
* name: ["sapUiParam1", "sapUiParam2", "sapUiParam3"],
|
|
601
|
-
* callback: function(mParams) {
|
|
602
|
-
* // merge the current parameters with the actual parameters in case they are retrieved asynchronously
|
|
603
|
-
* Object.assign(mMyParams, mParams);
|
|
604
|
-
* }
|
|
605
|
-
* }));
|
|
606
|
-
*
|
|
607
|
-
* @param {string | string[] | object} vName the (array with) CSS parameter name(s) or an object containing the (array with) CSS parameter name(s),
|
|
608
|
-
* the scopeElement and a callback for async retrieval of parameters.
|
|
609
|
-
* @param {string | string[]} vName.name the (array with) CSS parameter name(s)
|
|
610
|
-
* @param {sap.ui.core.Element} [vName.scopeElement]
|
|
611
|
-
* Element / control instance to take into account when looking for a parameter value.
|
|
612
|
-
* This can make a difference when a parameter value is overridden in a theme scope set via a CSS class.
|
|
613
|
-
* @param {function(sap.ui.core.theming.Parameters.Value)} [vName.callback] If given, the callback is only executed in case there are still parameters pending and one or more of the requested parameters is missing.
|
|
614
|
-
* @param {sap.ui.core.Element} [oElement]
|
|
615
|
-
* Element / control instance to take into account when looking for a parameter value.
|
|
616
|
-
* This can make a difference when a parameter value is overridden in a theme scope set via a CSS class.
|
|
617
|
-
* @returns {sap.ui.core.theming.Parameters.Value} the CSS parameter value(s) or <code>undefined</code> if the parameters could not be retrieved.
|
|
618
|
-
*
|
|
619
|
-
* @public
|
|
640
|
+
* Parameters.get() without arguments returns
|
|
641
|
+
* copy of complete default parameter set
|
|
642
|
+
* @deprecated As of Version 1.120
|
|
620
643
|
*/
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
644
|
+
if (arguments.length === 0) {
|
|
645
|
+
Log.warning(
|
|
646
|
+
"[FUTURE FATAL] Legacy variant usage of sap.ui.core.theming.Parameters.get API detected. Do not use the Parameters.get() API to retrieve ALL theming parameters, " +
|
|
647
|
+
"as this will lead to unwanted synchronous requests. " +
|
|
648
|
+
"Use the asynchronous API variant instead and retrieve a fixed set of parameters.",
|
|
649
|
+
"LegacyParametersGet",
|
|
650
|
+
"sap.ui.support",
|
|
651
|
+
function() { return { type: "LegacyParametersGet" }; }
|
|
652
|
+
);
|
|
653
|
+
|
|
654
|
+
// retrieve parameters
|
|
655
|
+
// optionally might also trigger a sync JSON request, if a library was loaded but not parsed yet
|
|
656
|
+
var oParams = getParameters();
|
|
657
|
+
return Object.assign({}, oParams["default"]);
|
|
658
|
+
}
|
|
628
659
|
|
|
629
|
-
|
|
660
|
+
if (!vName) {
|
|
661
|
+
return undefined;
|
|
662
|
+
}
|
|
630
663
|
|
|
631
|
-
|
|
632
|
-
|
|
664
|
+
if (vName instanceof Object && !Array.isArray(vName)) {
|
|
665
|
+
// async variant of Parameters.get
|
|
666
|
+
if (!vName.name) {
|
|
667
|
+
future.warningThrows("sap.ui.core.theming.Parameters: Get was called with an object argument without one or more parameter names.");
|
|
668
|
+
return undefined;
|
|
633
669
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
"LegacyParametersGet",
|
|
646
|
-
"sap.ui.support",
|
|
647
|
-
function() { return { type: "LegacyParametersGet" }; }
|
|
648
|
-
);
|
|
649
|
-
|
|
650
|
-
// first try to load all pending parameters
|
|
651
|
-
loadPendingLibraryParameters();
|
|
652
|
-
|
|
653
|
-
// retrieve parameters
|
|
654
|
-
// optionally might also trigger a sync JSON request, if a library was loaded but not parsed yet
|
|
655
|
-
var oParams = getParameters();
|
|
656
|
-
return Object.assign({}, oParams["default"]);
|
|
670
|
+
oElement = vName.scopeElement;
|
|
671
|
+
fnAsyncCallback = vName.callback;
|
|
672
|
+
bParseUrls = vName._restrictedParseUrls || false;
|
|
673
|
+
aNames = typeof vName.name === "string" ? [vName.name] : vName.name;
|
|
674
|
+
bAsync = true;
|
|
675
|
+
} else {
|
|
676
|
+
// legacy variant
|
|
677
|
+
if (typeof vName === "string") {
|
|
678
|
+
aNames = [vName];
|
|
679
|
+
} else { // vName is Array
|
|
680
|
+
aNames = vName;
|
|
657
681
|
}
|
|
658
682
|
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
683
|
+
Log.warning(
|
|
684
|
+
"[FUTURE FATAL] Legacy variant usage of sap.ui.core.theming.Parameters.get API detected for parameter(s): '" + aNames.join(", ") +
|
|
685
|
+
"'. This could lead to bad performance and additional synchronous XHRs, as parameters might not be available yet. Use asynchronous variant instead.",
|
|
686
|
+
"LegacyParametersGet",
|
|
687
|
+
"sap.ui.support",
|
|
688
|
+
function() { return { type: "LegacyParametersGet" }; }
|
|
689
|
+
);
|
|
690
|
+
}
|
|
662
691
|
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
return undefined;
|
|
668
|
-
}
|
|
669
|
-
oElement = vName.scopeElement;
|
|
670
|
-
fnAsyncCallback = vName.callback;
|
|
671
|
-
bParseUrls = vName._restrictedParseUrls || false;
|
|
672
|
-
aNames = typeof vName.name === "string" ? [vName.name] : vName.name;
|
|
673
|
-
bAsync = true;
|
|
692
|
+
var resolveWithParameter;
|
|
693
|
+
var lookForParameter = function (sName) {
|
|
694
|
+
if (oElement instanceof Element) {
|
|
695
|
+
return getParamForActiveScope(sName, oElement, bAsync);
|
|
674
696
|
} else {
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
aNames = [vName];
|
|
678
|
-
} else { // vName is Array
|
|
679
|
-
aNames = vName;
|
|
697
|
+
if (bAsync) {
|
|
698
|
+
parsePendingLibraryParameters();
|
|
680
699
|
}
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
"sap.ui.support",
|
|
687
|
-
function() { return { type: "LegacyParametersGet" }; }
|
|
688
|
-
);
|
|
700
|
+
return getParam({
|
|
701
|
+
parameterName: sName,
|
|
702
|
+
loadPendingParameters: !bAsync,
|
|
703
|
+
async: bAsync
|
|
704
|
+
});
|
|
689
705
|
}
|
|
706
|
+
};
|
|
690
707
|
|
|
691
|
-
|
|
692
|
-
var lookForParameter = function (sName) {
|
|
693
|
-
if (oElement instanceof Element) {
|
|
694
|
-
return getParamForActiveScope(sName, oElement, bAsync);
|
|
695
|
-
} else {
|
|
696
|
-
if (bAsync) {
|
|
697
|
-
parsePendingLibraryParameters();
|
|
698
|
-
}
|
|
699
|
-
return getParam({
|
|
700
|
-
parameterName: sName,
|
|
701
|
-
loadPendingParameters: !bAsync,
|
|
702
|
-
async: bAsync
|
|
703
|
-
});
|
|
704
|
-
}
|
|
705
|
-
};
|
|
706
|
-
|
|
707
|
-
const mResult = {};
|
|
708
|
+
const mResult = {};
|
|
708
709
|
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
}
|
|
710
|
+
for (var i = 0; i < aNames.length; i++) {
|
|
711
|
+
sParamName = aNames[i];
|
|
712
|
+
var sParamValue = lookForParameter(sParamName);
|
|
713
|
+
if (!bAsync || sParamValue) {
|
|
714
|
+
mResult[sParamName] = sParamValue;
|
|
715
715
|
}
|
|
716
|
+
}
|
|
716
717
|
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
if (!vParams || (typeof vParams === "object" && (Object.keys(vParams).length !== aNames.length))) {
|
|
726
|
-
Log.error(`sap.ui.core.theming.Parameters: The following parameters could not be found: "${aNames.length === 1 ? aNames[0] : aNames.filter((n) => vParams && !Object.hasOwn(vParams, n))}"`);
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
fnAsyncCallback(vParams);
|
|
730
|
-
aCallbackRegistry.splice(aCallbackRegistry.findIndex(findRegisteredCallback), 1);
|
|
731
|
-
}.bind(this);
|
|
718
|
+
if (bAsync && fnAsyncCallback && Object.keys(mResult).length !== aNames.length) {
|
|
719
|
+
resolveWithParameter = function () {
|
|
720
|
+
Theming.detachApplied(resolveWithParameter);
|
|
721
|
+
var vParams = this.get({ // Don't pass callback again
|
|
722
|
+
name: vName.name,
|
|
723
|
+
scopeElement: vName.scopeElement
|
|
724
|
+
});
|
|
732
725
|
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
if (iIndex >= 0) {
|
|
736
|
-
Theming.detachApplied(aCallbackRegistry[iIndex].eventHandler);
|
|
737
|
-
aCallbackRegistry[iIndex].eventHandler = resolveWithParameter;
|
|
738
|
-
} else {
|
|
739
|
-
aCallbackRegistry.push({ callback: fnAsyncCallback, eventHandler: resolveWithParameter });
|
|
726
|
+
if (!vParams || (typeof vParams === "object" && (Object.keys(vParams).length !== aNames.length))) {
|
|
727
|
+
Log.error(`sap.ui.core.theming.Parameters: The following parameters could not be found: "${aNames.length === 1 ? aNames[0] : aNames.filter((n) => vParams && !Object.hasOwn(vParams, n))}"`);
|
|
740
728
|
}
|
|
741
|
-
Theming.attachApplied(resolveWithParameter);
|
|
742
|
-
return undefined; // Don't return partial result in case we expect applied event.
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
// parse CSS URL strings
|
|
746
|
-
// The URLs itself have been resolved at this point
|
|
747
|
-
if (bParseUrls) {
|
|
748
|
-
parseUrls(mResult);
|
|
749
|
-
}
|
|
750
729
|
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
730
|
+
fnAsyncCallback(vParams);
|
|
731
|
+
aCallbackRegistry.splice(aCallbackRegistry.findIndex(findRegisteredCallback), 1);
|
|
732
|
+
}.bind(this);
|
|
754
733
|
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
* As with any other <code>Parameters.get()</code> call, a non-existent parameter will result in <code>undefined</code>.
|
|
763
|
-
*
|
|
764
|
-
* Usage in controls:
|
|
765
|
-
*
|
|
766
|
-
* @example <caption>Scenario 4: Parsing CSS URLs</caption>
|
|
767
|
-
* const sUrl = Parameters.get({
|
|
768
|
-
* name: ["sapUiUrlParam"],
|
|
769
|
-
* _restrictedParseUrls: true
|
|
770
|
-
* }) ?? "https://my.bootstrap.url/resource/my/lib/images/fallback.jpeg"; // fallback via nullish coalescing operator
|
|
771
|
-
*
|
|
772
|
-
* @param {object<string,string|undefined>} mParams a set of parameters that should be parsed for CSS URLs
|
|
773
|
-
*/
|
|
774
|
-
function parseUrls(mParams) {
|
|
775
|
-
for (const sKey in mParams) {
|
|
776
|
-
if (Object.hasOwn(mParams, sKey)) {
|
|
777
|
-
let sValue = mParams[sKey];
|
|
778
|
-
const match = rCssUrl.exec(sValue);
|
|
779
|
-
if (match) {
|
|
780
|
-
sValue = match[1];
|
|
781
|
-
} else if (sValue === "''" || sValue === "none") {
|
|
782
|
-
sValue = null;
|
|
783
|
-
}
|
|
784
|
-
mParams[sKey] = sValue;
|
|
785
|
-
}
|
|
734
|
+
// Check if identical callback is already registered and reregister with current parameters
|
|
735
|
+
iIndex = aCallbackRegistry.findIndex(findRegisteredCallback);
|
|
736
|
+
if (iIndex >= 0) {
|
|
737
|
+
Theming.detachApplied(aCallbackRegistry[iIndex].eventHandler);
|
|
738
|
+
aCallbackRegistry[iIndex].eventHandler = resolveWithParameter;
|
|
739
|
+
} else {
|
|
740
|
+
aCallbackRegistry.push({ callback: fnAsyncCallback, eventHandler: resolveWithParameter });
|
|
786
741
|
}
|
|
742
|
+
Theming.attachApplied(resolveWithParameter);
|
|
743
|
+
return undefined; // Don't return partial result in case we expect applied event.
|
|
787
744
|
}
|
|
788
745
|
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
* @param {Object} mLibraryParameters
|
|
795
|
-
* @private
|
|
796
|
-
*/
|
|
797
|
-
Parameters._setOrLoadParameters = function(mLibraryParameters) {
|
|
746
|
+
// parse CSS URL strings
|
|
747
|
+
// The URLs itself have been resolved at this point
|
|
748
|
+
if (bParseUrls) {
|
|
749
|
+
parseUrls(mResult);
|
|
750
|
+
}
|
|
798
751
|
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
752
|
+
// if only 1 parameter is requests we unwrap the results array
|
|
753
|
+
return aNames.length === 1 ? mResult[aNames[0]] : mResult;
|
|
754
|
+
};
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* Checks the given map of parameters for CSS URLs and parses them to a regular string.
|
|
758
|
+
* Modifies the mParams argument in place.
|
|
759
|
+
*
|
|
760
|
+
* In order to only retrieve resolved URL strings and not the CSS URL strings, we expose a restricted Parameters.get() option <code>_restrictedParseUrls</code>.
|
|
761
|
+
*
|
|
762
|
+
* A URL parameter value of '' (empty string) or "none" (standard CSS value) will result in <code>null</code>.
|
|
763
|
+
* As with any other <code>Parameters.get()</code> call, a non-existent parameter will result in <code>undefined</code>.
|
|
764
|
+
*
|
|
765
|
+
* Usage in controls:
|
|
766
|
+
*
|
|
767
|
+
* @example <caption>Scenario 4: Parsing CSS URLs</caption>
|
|
768
|
+
* const sUrl = Parameters.get({
|
|
769
|
+
* name: ["sapUiUrlParam"],
|
|
770
|
+
* _restrictedParseUrls: true
|
|
771
|
+
* }) ?? "https://my.bootstrap.url/resource/my/lib/images/fallback.jpeg"; // fallback via nullish coalescing operator
|
|
772
|
+
*
|
|
773
|
+
* @param {object<string,string|undefined>} mParams a set of parameters that should be parsed for CSS URLs
|
|
774
|
+
*/
|
|
775
|
+
function parseUrls(mParams) {
|
|
776
|
+
for (const sKey in mParams) {
|
|
777
|
+
if (Object.hasOwn(mParams, sKey)) {
|
|
778
|
+
let sValue = mParams[sKey];
|
|
779
|
+
const match = rCssUrl.exec(sValue);
|
|
780
|
+
if (match) {
|
|
781
|
+
sValue = match[1];
|
|
782
|
+
} else if (sValue === "''" || sValue === "none") {
|
|
783
|
+
sValue = null;
|
|
813
784
|
}
|
|
814
|
-
|
|
815
|
-
};
|
|
816
|
-
|
|
817
|
-
/**
|
|
818
|
-
* Resets the CSS parameters which finally will reload the parameters
|
|
819
|
-
* the next time they are queried via the method <code>get</code>.
|
|
820
|
-
*
|
|
821
|
-
* @public
|
|
822
|
-
* @deprecated As of version 1.92 without a replacement. Application code should
|
|
823
|
-
* not be able to interfere with the automated determination of theme parameters.
|
|
824
|
-
* Resetting the parameters unnecessarily could impact performance. Please use
|
|
825
|
-
* the (potentially async) API to get parameter values and rely on the framework
|
|
826
|
-
* to update parameter values when the theme changes.
|
|
827
|
-
*/
|
|
828
|
-
Parameters.reset = function() {
|
|
829
|
-
this._reset.apply(this, arguments);
|
|
830
|
-
};
|
|
831
|
-
|
|
832
|
-
/**
|
|
833
|
-
* Resets the CSS parameters which finally will reload the parameters
|
|
834
|
-
* the next time they are queried via the method <code>get</code>.
|
|
835
|
-
*
|
|
836
|
-
* @private
|
|
837
|
-
* @ui5-restricted sap.ui.core.theming
|
|
838
|
-
*/
|
|
839
|
-
Parameters._reset = function() {
|
|
840
|
-
// hidden parameter {boolean} bOnlyWhenNecessary
|
|
841
|
-
var bOnlyWhenNecessary = arguments[0] === true;
|
|
842
|
-
if ( !bOnlyWhenNecessary || Theming.getTheme() !== sTheme ) {
|
|
843
|
-
sTheme = Theming.getTheme();
|
|
844
|
-
aParametersToLoad = [];
|
|
845
|
-
mParameters = null;
|
|
785
|
+
mParams[sKey] = sValue;
|
|
846
786
|
}
|
|
847
|
-
}
|
|
848
|
-
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
/**
|
|
791
|
+
* Resets the CSS parameters which finally will reload the parameters
|
|
792
|
+
* the next time they are queried via the method <code>get</code>.
|
|
793
|
+
*
|
|
794
|
+
* @public
|
|
795
|
+
* @deprecated As of version 1.92 without a replacement. Application code should
|
|
796
|
+
* not be able to interfere with the automated determination of theme parameters.
|
|
797
|
+
* Resetting the parameters unnecessarily could impact performance. Please use
|
|
798
|
+
* the (potentially async) API to get parameter values and rely on the framework
|
|
799
|
+
* to update parameter values when the theme changes.
|
|
800
|
+
*/
|
|
801
|
+
Parameters.reset = function() {
|
|
802
|
+
reset(true);
|
|
803
|
+
};
|
|
804
|
+
|
|
805
|
+
/**
|
|
806
|
+
* Resets the CSS parameters which finally will reload the parameters
|
|
807
|
+
* the next time they are queried via the method <code>get</code>.
|
|
808
|
+
*/
|
|
809
|
+
function reset() {
|
|
849
810
|
/**
|
|
850
|
-
*
|
|
851
|
-
*
|
|
852
|
-
* @private
|
|
853
|
-
* @param {string} sParamName the theme parameter which contains the logo definition. If nothing is defined the parameter 'sapUiGlobalLogo' is used.
|
|
854
|
-
* @param {boolean} bForce whether a valid URL should be returned even if there is no logo defined.
|
|
811
|
+
* hidden parameter {boolean} bForce
|
|
855
812
|
* @deprecated
|
|
856
813
|
*/
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
814
|
+
const bForce = arguments[0] === true;
|
|
815
|
+
if ( bForce || Theming.getTheme() !== sTheme ) {
|
|
816
|
+
sTheme = Theming.getTheme();
|
|
817
|
+
aParametersToLoad = [...getAllLibraryInfoObjects().keys()];
|
|
818
|
+
mParameters = null;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
/**
|
|
823
|
+
* Helper function to get an image URL based on a given theme parameter.
|
|
824
|
+
*
|
|
825
|
+
* @private
|
|
826
|
+
* @param {string} sParamName the theme parameter which contains the logo definition. If nothing is defined the parameter 'sapUiGlobalLogo' is used.
|
|
827
|
+
* @param {boolean} bForce whether a valid URL should be returned even if there is no logo defined.
|
|
828
|
+
* @deprecated
|
|
829
|
+
*/
|
|
830
|
+
Parameters._getThemeImage = function(sParamName, bForce) {
|
|
831
|
+
sParamName = sParamName || "sapUiGlobalLogo";
|
|
832
|
+
var logo = Parameters.get(sParamName);
|
|
833
|
+
if (logo) {
|
|
834
|
+
var match = rCssUrl.exec(logo);
|
|
835
|
+
if (match) {
|
|
836
|
+
logo = match[1];
|
|
837
|
+
} else if (logo === "''" || logo === "none") {
|
|
838
|
+
logo = null;
|
|
867
839
|
}
|
|
840
|
+
}
|
|
868
841
|
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
842
|
+
if (bForce && !logo) {
|
|
843
|
+
return sap.ui.require.toUrl('sap/ui/core/themes/base/img/1x1.gif');
|
|
844
|
+
}
|
|
872
845
|
|
|
873
|
-
|
|
874
|
-
|
|
846
|
+
return logo;
|
|
847
|
+
};
|
|
848
|
+
|
|
849
|
+
attachChange(reset);
|
|
875
850
|
|
|
876
851
|
return Parameters;
|
|
877
852
|
|