@openui5/sap.ui.core 1.95.0 → 1.96.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/.eslintrc.json +12 -0
- package/.reuse/dep5 +10 -5
- package/THIRDPARTY.txt +17 -8
- package/package.json +1 -1
- package/src/jquery.sap.global.js +1 -1
- 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/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 +6 -5
- package/src/sap/ui/base/Event.js +1 -1
- package/src/sap/ui/base/EventProvider.js +1 -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 +2 -2
- 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/core/.library +2 -2
- package/src/sap/ui/core/BusyIndicator.js +1 -1
- package/src/sap/ui/core/Component.js +2 -3
- package/src/sap/ui/core/ComponentContainer.js +9 -3
- package/src/sap/ui/core/ComponentMetadata.js +1 -1
- package/src/sap/ui/core/ComponentSupport.js +1 -1
- package/src/sap/ui/core/Configuration.js +6 -1
- package/src/sap/ui/core/Control.js +1 -1
- package/src/sap/ui/core/Core.js +64 -6
- 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 +1 -1
- 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 +2 -2
- 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 +3 -4
- package/src/sap/ui/core/IconPool.js +11 -0
- package/src/sap/ui/core/IconRenderer.js +4 -4
- 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/ListItem.js +1 -1
- package/src/sap/ui/core/LocalBusyIndicator.js +1 -1
- package/src/sap/ui/core/Locale.js +1 -1
- package/src/sap/ui/core/LocaleData.js +1 -1
- package/src/sap/ui/core/Manifest.js +1 -1
- package/src/sap/ui/core/Message.js +1 -1
- package/src/sap/ui/core/Patcher.js +27 -3
- package/src/sap/ui/core/Placeholder.js +4 -4
- package/src/sap/ui/core/RenderManager.js +20 -4
- 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/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 +3 -4
- 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 +2 -2
- package/src/sap/ui/core/XMLCompositeMetadata.js +2 -2
- package/src/sap/ui/core/XMLTemplateProcessor.js +93 -37
- package/src/sap/ui/core/_IconRegistry.js +31 -98
- 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/NumberFormat.js +16 -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/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 +1 -1
- package/src/sap/ui/core/mvc/XMLView.js +1 -1
- package/src/sap/ui/core/mvc/XMLViewRenderer.js +17 -20
- package/src/sap/ui/core/plugin/DeclarativeSupport.js +1 -1
- package/src/sap/ui/core/plugin/LessSupport.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/Router.js +8 -1
- package/src/sap/ui/core/routing/async/Target.js +2 -4
- 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/plugins/ControlTree.js +37 -43
- 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/themes/base/Icon.less +9 -0
- package/src/sap/ui/core/themes/base/SAP-icons.css +2 -0
- package/src/sap/ui/core/themes/base/SAP-icons.less +10 -0
- package/src/sap/ui/core/themes/base/base.less +543 -390
- package/src/sap/ui/core/themes/base/fonts/SAP-icons.woff2 +0 -0
- package/src/sap/ui/core/themes/base/global.less +38 -0
- package/src/sap/ui/core/themes/base/library.source.less +1 -2
- package/src/sap/ui/core/themes/sap_hcb/global.less +34 -0
- 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/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/reflection/JsControlTreeModifier.js +7 -9
- package/src/sap/ui/core/util/reflection/XmlTreeModifier.js +6 -3
- 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/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/Highlighter.js +8 -2
- package/src/sap/ui/debug/PropertyList.js +1 -1
- package/src/sap/ui/model/Binding.js +174 -118
- package/src/sap/ui/model/ClientContextBinding.js +1 -1
- package/src/sap/ui/model/ClientListBinding.js +1 -3
- package/src/sap/ui/model/ClientModel.js +4 -4
- package/src/sap/ui/model/ClientPropertyBinding.js +1 -1
- package/src/sap/ui/model/ClientTreeBinding.js +1 -1
- package/src/sap/ui/model/ClientTreeBindingAdapter.js +28 -23
- package/src/sap/ui/model/CompositeBinding.js +98 -77
- package/src/sap/ui/model/CompositeDataState.js +2 -2
- package/src/sap/ui/model/CompositeType.js +2 -2
- package/src/sap/ui/model/Context.js +4 -2
- package/src/sap/ui/model/ContextBinding.js +6 -14
- package/src/sap/ui/model/DataState.js +2 -2
- package/src/sap/ui/model/Filter.js +255 -53
- package/src/sap/ui/model/FilterOperator.js +1 -1
- package/src/sap/ui/model/FilterProcessor.js +27 -17
- package/src/sap/ui/model/FilterType.js +1 -1
- package/src/sap/ui/model/ListBinding.js +180 -117
- package/src/sap/ui/model/MetaModel.js +4 -9
- package/src/sap/ui/model/Model.js +345 -294
- package/src/sap/ui/model/PropertyBinding.js +92 -58
- package/src/sap/ui/model/SelectionModel.js +2 -2
- package/src/sap/ui/model/SimpleType.js +2 -2
- package/src/sap/ui/model/Sorter.js +1 -1
- package/src/sap/ui/model/SorterProcessor.js +1 -1
- package/src/sap/ui/model/StaticBinding.js +1 -1
- package/src/sap/ui/model/TreeAutoExpandMode.js +2 -2
- package/src/sap/ui/model/TreeBinding.js +1 -1
- package/src/sap/ui/model/TreeBindingAdapter.js +251 -100
- package/src/sap/ui/model/TreeBindingCompatibilityAdapter.js +16 -9
- package/src/sap/ui/model/TreeBindingUtils.js +1 -0
- package/src/sap/ui/model/Type.js +1 -1
- package/src/sap/ui/model/analytics/AnalyticalBinding.js +2 -1
- package/src/sap/ui/model/analytics/AnalyticalTreeBindingAdapter.js +1 -1
- package/src/sap/ui/model/analytics/AnalyticalVersionInfo.js +1 -1
- package/src/sap/ui/model/analytics/BatchResponseCollector.js +1 -1
- package/src/sap/ui/model/analytics/ODataModelAdapter.js +1 -1
- package/src/sap/ui/model/analytics/odata4analytics.js +3 -2
- package/src/sap/ui/model/json/JSONListBinding.js +8 -5
- package/src/sap/ui/model/json/JSONModel.js +21 -14
- package/src/sap/ui/model/json/JSONPropertyBinding.js +4 -3
- package/src/sap/ui/model/json/JSONTreeBinding.js +1 -1
- package/src/sap/ui/model/message/MessageListBinding.js +6 -3
- package/src/sap/ui/model/message/MessageModel.js +20 -14
- package/src/sap/ui/model/message/MessagePropertyBinding.js +2 -2
- package/src/sap/ui/model/odata/AnnotationHelper.js +1 -1
- package/src/sap/ui/model/odata/AnnotationParser.js +1 -1
- package/src/sap/ui/model/odata/CountMode.js +1 -1
- package/src/sap/ui/model/odata/Filter.js +1 -1
- package/src/sap/ui/model/odata/ODataAnnotations.js +2 -2
- package/src/sap/ui/model/odata/ODataContextBinding.js +1 -1
- package/src/sap/ui/model/odata/ODataListBinding.js +1 -1
- package/src/sap/ui/model/odata/ODataMessageParser.js +2 -2
- package/src/sap/ui/model/odata/ODataMetaModel.js +2 -2
- package/src/sap/ui/model/odata/ODataMetadata.js +2 -2
- package/src/sap/ui/model/odata/ODataModel.js +2 -2
- package/src/sap/ui/model/odata/ODataPropertyBinding.js +1 -1
- package/src/sap/ui/model/odata/ODataTreeBinding.js +65 -33
- package/src/sap/ui/model/odata/ODataTreeBindingAdapter.js +1 -1
- package/src/sap/ui/model/odata/ODataTreeBindingFlat.js +2 -2
- package/src/sap/ui/model/odata/ODataUtils.js +1 -1
- package/src/sap/ui/model/odata/OperationMode.js +1 -1
- package/src/sap/ui/model/odata/_AnnotationHelperExpression.js +1 -1
- 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/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 +59 -9
- package/src/sap/ui/model/odata/v2/ODataAnnotations.js +2 -2
- package/src/sap/ui/model/odata/v2/ODataContextBinding.js +1 -1
- package/src/sap/ui/model/odata/v2/ODataListBinding.js +212 -45
- package/src/sap/ui/model/odata/v2/ODataModel.js +139 -59
- package/src/sap/ui/model/odata/v2/ODataTreeBinding.js +2 -2
- package/src/sap/ui/model/odata/v2/_CreatedContextsCache.js +129 -0
- package/src/sap/ui/model/odata/v4/Context.js +1 -1
- package/src/sap/ui/model/odata/v4/ODataBinding.js +2 -3
- package/src/sap/ui/model/odata/v4/ODataContextBinding.js +37 -26
- package/src/sap/ui/model/odata/v4/ODataListBinding.js +22 -12
- package/src/sap/ui/model/odata/v4/ODataMetaModel.js +30 -20
- package/src/sap/ui/model/odata/v4/ODataModel.js +4 -4
- package/src/sap/ui/model/odata/v4/ODataParentBinding.js +37 -28
- package/src/sap/ui/model/odata/v4/ODataPropertyBinding.js +1 -1
- package/src/sap/ui/model/odata/v4/lib/_Cache.js +3 -5
- package/src/sap/ui/model/odata/v4/lib/_Helper.js +2 -2
- package/src/sap/ui/model/resource/ResourceModel.js +2 -1
- package/src/sap/ui/model/resource/ResourcePropertyBinding.js +1 -1
- package/src/sap/ui/model/type/Boolean.js +2 -2
- package/src/sap/ui/model/type/Currency.js +2 -2
- package/src/sap/ui/model/type/Date.js +9 -3
- package/src/sap/ui/model/type/DateInterval.js +4 -2
- package/src/sap/ui/model/type/DateTime.js +2 -2
- package/src/sap/ui/model/type/DateTimeInterval.js +2 -2
- package/src/sap/ui/model/type/FileSize.js +4 -2
- package/src/sap/ui/model/type/Float.js +4 -2
- package/src/sap/ui/model/type/Integer.js +4 -2
- package/src/sap/ui/model/type/String.js +2 -2
- package/src/sap/ui/model/type/Time.js +2 -2
- package/src/sap/ui/model/type/TimeInterval.js +2 -2
- package/src/sap/ui/model/type/Unit.js +14 -7
- package/src/sap/ui/model/xml/XMLListBinding.js +15 -9
- package/src/sap/ui/model/xml/XMLModel.js +67 -40
- package/src/sap/ui/model/xml/XMLPropertyBinding.js +4 -4
- package/src/sap/ui/model/xml/XMLTreeBinding.js +5 -4
- package/src/sap/ui/performance/trace/Interaction.js +1 -1
- package/src/sap/ui/qunit/QUnitUtils.js +3 -2
- package/src/sap/ui/qunit/utils/ControlIterator.js +1 -1
- package/src/sap/ui/qunit/utils/MemoryLeakCheck.js +9 -11
- package/src/sap/ui/test/matchers/I18NText.js +2 -2
- package/src/sap/ui/test/opaQunit.js +1 -1
- package/src/sap/ui/thirdparty/IPv6.js +2 -2
- package/src/sap/ui/thirdparty/SecondLevelDomains.js +2 -2
- package/src/sap/ui/thirdparty/URI.js +14 -5
- package/src/sap/ui/thirdparty/URITemplate.js +2 -2
- package/src/sap/ui/thirdparty/jquery.js +9 -1
- package/src/sap/ui/thirdparty/qunit-2.js +1 -1
- package/src/sap/ui/thirdparty/qunit.js +1 -1
- package/src/sap/ui/util/Mobile.js +2 -20
- package/src/sap/ui/util/Storage.js +1 -1
- package/ui5.yaml +5 -2
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* (c) Copyright 2009-2021 SAP SE or an SAP affiliate company.
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
/*eslint-disable max-len */
|
|
7
7
|
/**
|
|
8
8
|
* OData-based DataBinding
|
|
9
9
|
*
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
//Provides class sap.ui.model.odata.v2.ODataModel
|
|
16
16
|
sap.ui.define([
|
|
17
|
+
"./_CreatedContextsCache",
|
|
17
18
|
"./Context",
|
|
18
19
|
"./ODataAnnotations",
|
|
19
20
|
"./ODataContextBinding",
|
|
@@ -31,6 +32,7 @@ sap.ui.define([
|
|
|
31
32
|
"sap/base/util/merge",
|
|
32
33
|
"sap/base/util/uid",
|
|
33
34
|
"sap/base/util/UriParameters",
|
|
35
|
+
"sap/ui/base/SyncPromise",
|
|
34
36
|
"sap/ui/core/library",
|
|
35
37
|
"sap/ui/core/message/Message",
|
|
36
38
|
"sap/ui/core/message/MessageParser",
|
|
@@ -50,12 +52,12 @@ sap.ui.define([
|
|
|
50
52
|
"sap/ui/thirdparty/datajs",
|
|
51
53
|
"sap/ui/thirdparty/URI",
|
|
52
54
|
"sap/ui/util/isCrossOriginURL"
|
|
53
|
-
], function(Context, ODataAnnotations, ODataContextBinding, ODataListBinding,
|
|
54
|
-
assert, Log, encodeURL, deepEqual, deepExtend, each, extend,
|
|
55
|
-
|
|
56
|
-
FilterProcessor, Model, CountMode, MessageScope,
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
], function(_CreatedContextsCache, Context, ODataAnnotations, ODataContextBinding, ODataListBinding,
|
|
56
|
+
ODataTreeBinding, assert, Log, encodeURL, deepEqual, deepExtend, each, extend,
|
|
57
|
+
isEmptyObject, isPlainObject, merge, uid, UriParameters, SyncPromise, coreLibrary, Message,
|
|
58
|
+
MessageParser, BindingMode, BaseContext, FilterProcessor, Model, CountMode, MessageScope,
|
|
59
|
+
ODataMetadata, ODataMetaModel, ODataMessageParser, ODataPropertyBinding, ODataUtils,
|
|
60
|
+
OperationMode, UpdateMethod, OData, URI, isCrossOriginURL
|
|
59
61
|
) {
|
|
60
62
|
|
|
61
63
|
"use strict";
|
|
@@ -199,7 +201,7 @@ sap.ui.define([
|
|
|
199
201
|
* This model is not prepared to be inherited from.
|
|
200
202
|
*
|
|
201
203
|
* @author SAP SE
|
|
202
|
-
* @version 1.
|
|
204
|
+
* @version 1.96.0
|
|
203
205
|
*
|
|
204
206
|
* @public
|
|
205
207
|
* @alias sap.ui.model.odata.v2.ODataModel
|
|
@@ -342,6 +344,7 @@ sap.ui.define([
|
|
|
342
344
|
this.mChangedEntities4checkUpdate = {};
|
|
343
345
|
this.bPersistTechnicalMessages = bPersistTechnicalMessages === undefined
|
|
344
346
|
? undefined : !!bPersistTechnicalMessages;
|
|
347
|
+
this.oCreatedContextsCache = new _CreatedContextsCache();
|
|
345
348
|
|
|
346
349
|
if (oMessageParser) {
|
|
347
350
|
oMessageParser.setProcessor(this);
|
|
@@ -1963,6 +1966,12 @@ sap.ui.define([
|
|
|
1963
1966
|
* @param {Object<string,string>} [mParameters.custom] Optional map of custom query parameters (name/value pairs); names of custom parameters must not start with <code>$</code>
|
|
1964
1967
|
* @param {sap.ui.model.odata.CountMode} [mParameters.countMode] Count mode for this binding;
|
|
1965
1968
|
* if not specified, the default count mode for this model is used
|
|
1969
|
+
* @param {string} [mParameters.createdEntitiesKey=""]
|
|
1970
|
+
* A key used in combination with the resolved path of the binding to identify the entities
|
|
1971
|
+
* created via the binding's {@link #create} method.
|
|
1972
|
+
*
|
|
1973
|
+
* <b>Note:</b> Different controls or control aggregation bindings to the same collection must
|
|
1974
|
+
* have different <code>createdEntitiesKey</code> values.
|
|
1966
1975
|
* @param {sap.ui.model.odata.OperationMode} [mParameters.operationMode] Operation mode for this binding;
|
|
1967
1976
|
* if not specified, the default operation mode of this model is used
|
|
1968
1977
|
* @param {boolean} [mParameters.faultTolerant] Turns on the fault tolerance mode, data is not reset if a backend request returns an error
|
|
@@ -4221,7 +4230,6 @@ sap.ui.define([
|
|
|
4221
4230
|
+ sKey.slice(sKey.indexOf("("));
|
|
4222
4231
|
}
|
|
4223
4232
|
this._updateContext(oContext, '/' + sKey, oRequest.deepPath);
|
|
4224
|
-
oContext.bCreated = false;
|
|
4225
4233
|
oContext.setUpdated(true);
|
|
4226
4234
|
// register function to reset updated flag call as callAfterUpdate
|
|
4227
4235
|
this.callAfterUpdate(function() {
|
|
@@ -4986,43 +4994,60 @@ sap.ui.define([
|
|
|
4986
4994
|
};
|
|
4987
4995
|
|
|
4988
4996
|
/**
|
|
4989
|
-
* Trigger a <code>DELETE</code> request to the OData service that was specified in the model
|
|
4997
|
+
* Trigger a <code>DELETE</code> request to the OData service that was specified in the model
|
|
4998
|
+
* constructor.
|
|
4990
4999
|
*
|
|
4991
|
-
* @param {string} sPath
|
|
4992
|
-
*
|
|
4993
|
-
*
|
|
4994
|
-
* @param {object} [mParameters
|
|
4995
|
-
*
|
|
4996
|
-
*
|
|
4997
|
-
*
|
|
4998
|
-
*
|
|
4999
|
-
*
|
|
5000
|
-
*
|
|
5001
|
-
* @param {
|
|
5002
|
-
*
|
|
5003
|
-
*
|
|
5004
|
-
* @param {string} [mParameters.
|
|
5005
|
-
*
|
|
5006
|
-
|
|
5000
|
+
* @param {string} sPath
|
|
5001
|
+
* A string containing the path to the data that should be removed. The path is concatenated
|
|
5002
|
+
* to the service URL which was specified in the model constructor.
|
|
5003
|
+
* @param {object} [mParameters]
|
|
5004
|
+
* Optional, can contain the following attributes:
|
|
5005
|
+
* @param {object} [mParameters.context]
|
|
5006
|
+
* If specified, <code>sPath</code> has to be relative to the path given with the context.
|
|
5007
|
+
* @param {function} [mParameters.success]
|
|
5008
|
+
* A callback function which is called when the data has been successfully retrieved. The
|
|
5009
|
+
* handler can have the following parameters: <code>oData</code> and <code>response</code>.
|
|
5010
|
+
* @param {function} [mParameters.error]
|
|
5011
|
+
* A callback function which is called when the request failed. The handler can have the
|
|
5012
|
+
* parameter: <code>oError</code> which contains additional error information.
|
|
5013
|
+
* @param {string} [mParameters.eTag]
|
|
5014
|
+
* If specified, the <code>If-Match</code> header will be set to this ETag.
|
|
5015
|
+
* @param {Object<string,string>} [mParameters.urlParameters]
|
|
5016
|
+
* A map containing the parameters that will be passed as query strings
|
|
5017
|
+
* @param {Object<string,string>} [mParameters.headers]
|
|
5018
|
+
* A map of headers for this request
|
|
5019
|
+
* @param {string} [mParameters.batchGroupId]
|
|
5020
|
+
* Deprecated - use <code>groupId</code> instead
|
|
5021
|
+
* @param {string} [mParameters.groupId]
|
|
5022
|
+
* ID of a request group; requests belonging to the same group will be bundled in one batch
|
|
5023
|
+
* request
|
|
5024
|
+
* @param {string} [mParameters.changeSetId]
|
|
5025
|
+
* ID of the <code>ChangeSet</code> that this request should belong to
|
|
5026
|
+
* @param {boolean} [mParameters.refreshAfterChange]
|
|
5027
|
+
* Since 1.46; defines whether to update all bindings after submitting this change operation,
|
|
5028
|
+
* see {@link #setRefreshAfterChange}. If given, this overrules the model-wide
|
|
5029
|
+
* <code>refreshAfterChange</code> flag for this operation only.
|
|
5007
5030
|
*
|
|
5008
|
-
* @return {object} An object which has an <code>abort</code> function to abort the current
|
|
5031
|
+
* @return {object} An object which has an <code>abort</code> function to abort the current
|
|
5032
|
+
* request.
|
|
5009
5033
|
*
|
|
5010
5034
|
* @public
|
|
5011
5035
|
*/
|
|
5012
5036
|
ODataModel.prototype.remove = function(sPath, mParameters) {
|
|
5013
|
-
var
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5037
|
+
var sChangeSetId, oContext, oContextToRemove, sDeepPath, bDeferred, fnError, sETag,
|
|
5038
|
+
sGroupId, mHeaders, sKey, sMethod, sNormalizedPath, bRefreshAfterChange, oRequest,
|
|
5039
|
+
mRequests, fnSuccess, sUrl, aUrlParams, mUrlParams,
|
|
5040
|
+
bCanonical = this.bCanonicalRequests,
|
|
5041
|
+
that = this;
|
|
5017
5042
|
|
|
5018
5043
|
if (mParameters) {
|
|
5019
5044
|
sGroupId = mParameters.groupId || mParameters.batchGroupId;
|
|
5020
5045
|
sChangeSetId = mParameters.changeSetId;
|
|
5021
|
-
oContext
|
|
5046
|
+
oContext = mParameters.context;
|
|
5022
5047
|
fnSuccess = mParameters.success;
|
|
5023
|
-
fnError
|
|
5024
|
-
sETag
|
|
5025
|
-
mHeaders
|
|
5048
|
+
fnError = mParameters.error;
|
|
5049
|
+
sETag = mParameters.eTag;
|
|
5050
|
+
mHeaders = mParameters.headers;
|
|
5026
5051
|
mUrlParams = mParameters.urlParameters;
|
|
5027
5052
|
bRefreshAfterChange = mParameters.refreshAfterChange;
|
|
5028
5053
|
bCanonical = mParameters.canonicalRequest;
|
|
@@ -5043,20 +5068,23 @@ sap.ui.define([
|
|
|
5043
5068
|
sDeepPath = this.resolveDeep(sPath, oContext);
|
|
5044
5069
|
|
|
5045
5070
|
function handleSuccess(oData, oResponse) {
|
|
5046
|
-
sKey = sUrl.substr(sUrl.lastIndexOf('/') + 1);
|
|
5047
|
-
//remove query params if any
|
|
5048
|
-
if (sKey.indexOf('?') !== -1) {
|
|
5049
|
-
sKey = sKey.substr(0, sKey.indexOf('?'));
|
|
5050
|
-
}
|
|
5051
5071
|
that._removeEntity(sKey);
|
|
5052
|
-
|
|
5072
|
+
if (oContextToRemove && oContextToRemove.isTransient() === false) {
|
|
5073
|
+
that.oCreatedContextsCache.findAndRemoveContext(oContextToRemove);
|
|
5074
|
+
}
|
|
5053
5075
|
if (fnSuccess) {
|
|
5054
5076
|
fnSuccess(oData, oResponse);
|
|
5055
5077
|
}
|
|
5056
5078
|
}
|
|
5057
5079
|
|
|
5058
5080
|
return this._processRequest(function(requestHandle) {
|
|
5059
|
-
sUrl = that._createRequestUrlWithNormalizedPath(sNormalizedPath, aUrlParams,
|
|
5081
|
+
sUrl = that._createRequestUrlWithNormalizedPath(sNormalizedPath, aUrlParams,
|
|
5082
|
+
that.bUseBatch);
|
|
5083
|
+
sKey = sUrl.substr(sUrl.lastIndexOf('/') + 1);
|
|
5084
|
+
//remove query params if any
|
|
5085
|
+
sKey = sKey.split("?")[0];
|
|
5086
|
+
oContextToRemove = that.mContexts["/" + sKey];
|
|
5087
|
+
|
|
5060
5088
|
oRequest = that._createRequest(sUrl, sDeepPath, sMethod, mHeaders, undefined, sETag,
|
|
5061
5089
|
undefined, true);
|
|
5062
5090
|
|
|
@@ -5065,7 +5093,8 @@ sap.ui.define([
|
|
|
5065
5093
|
mRequests = that.mDeferredRequests;
|
|
5066
5094
|
}
|
|
5067
5095
|
|
|
5068
|
-
that._pushToRequestQueue(mRequests, sGroupId, sChangeSetId, oRequest, handleSuccess,
|
|
5096
|
+
that._pushToRequestQueue(mRequests, sGroupId, sChangeSetId, oRequest, handleSuccess,
|
|
5097
|
+
fnError, requestHandle, bRefreshAfterChange);
|
|
5069
5098
|
|
|
5070
5099
|
return oRequest;
|
|
5071
5100
|
}, fnError, bDeferred);
|
|
@@ -5953,6 +5982,7 @@ sap.ui.define([
|
|
|
5953
5982
|
oEntityMetadata) {
|
|
5954
5983
|
var // created either via #createEntry or via #callFunction
|
|
5955
5984
|
oCreated = oEntityMetadata && oEntityMetadata.created,
|
|
5985
|
+
bExcludePersistent = true,
|
|
5956
5986
|
// determine group synchronously otherwise #_resolveGroup might return a different group
|
|
5957
5987
|
// if for example the entity has been deleted already
|
|
5958
5988
|
sGroupId = this._resolveGroup(sKey).groupId,
|
|
@@ -5964,10 +5994,15 @@ sap.ui.define([
|
|
|
5964
5994
|
});
|
|
5965
5995
|
if (bDeleteCreatedEntities && oCreated) {
|
|
5966
5996
|
this._removeEntity(sKey);
|
|
5997
|
+
if (oCreated.abort) {
|
|
5998
|
+
oCreated.abort(ODataModel._createAbortedError());
|
|
5999
|
+
}
|
|
6000
|
+
bExcludePersistent = false;
|
|
5967
6001
|
} else {
|
|
5968
6002
|
delete this.mChangedEntities[sKey];
|
|
5969
6003
|
}
|
|
5970
|
-
sap.ui.getCore().getMessageManager().removeMessages(this.getMessagesByEntity(sKey,
|
|
6004
|
+
sap.ui.getCore().getMessageManager().removeMessages(this.getMessagesByEntity(sKey,
|
|
6005
|
+
bExcludePersistent));
|
|
5971
6006
|
|
|
5972
6007
|
return pMetaDataLoaded;
|
|
5973
6008
|
};
|
|
@@ -6437,9 +6472,13 @@ sap.ui.define([
|
|
|
6437
6472
|
* against the newly created object.
|
|
6438
6473
|
*
|
|
6439
6474
|
* For each created entry a request is created and stored in a request queue.
|
|
6440
|
-
* The request queue can be submitted by calling {@link #submitChanges}.
|
|
6441
|
-
*
|
|
6442
|
-
*
|
|
6475
|
+
* The request queue can be submitted by calling {@link #submitChanges}. As long as the context
|
|
6476
|
+
* is transient (see {@link sap.ui.model.odata.v2.Context#isTransient}),
|
|
6477
|
+
* {@link sap.ui.model.odata.v2.ODataModel#resetChanges} with the
|
|
6478
|
+
* <code>bDeleteCreatedEntities</code> parameter set to <code>true</code> can be used to delete
|
|
6479
|
+
* the created entity again.
|
|
6480
|
+
*
|
|
6481
|
+
* If the creation of the entity on the server failed, it is repeated automatically.
|
|
6443
6482
|
*
|
|
6444
6483
|
* The optional parameter <code>mParameters.properties</code> can be used as follows:
|
|
6445
6484
|
* <ul>
|
|
@@ -6454,8 +6493,8 @@ sap.ui.define([
|
|
|
6454
6493
|
*
|
|
6455
6494
|
* If there are no values specified, the properties will have <code>undefined</code> values.
|
|
6456
6495
|
*
|
|
6457
|
-
*
|
|
6458
|
-
*
|
|
6496
|
+
* The <code>properties</code> can be modified via property bindings relative to the returned
|
|
6497
|
+
* context instance.
|
|
6459
6498
|
*
|
|
6460
6499
|
* The parameter <code>expand</code> is supported since 1.78.0. If this parameter is set, the
|
|
6461
6500
|
* given navigation properties are expanded automatically with the same $batch request in which
|
|
@@ -6482,6 +6521,14 @@ sap.ui.define([
|
|
|
6482
6521
|
* </li>
|
|
6483
6522
|
* </ul>
|
|
6484
6523
|
*
|
|
6524
|
+
* Note: If a server requires a property in the request, you must supply this property in the
|
|
6525
|
+
* initial data, for example if the server requires a unit for an amount. This also applies if
|
|
6526
|
+
* this property has a default value.
|
|
6527
|
+
*
|
|
6528
|
+
* Note: A deep create (including data defined by navigation properties) is not supported. The
|
|
6529
|
+
* dependent entity has to be created using a second list binding, after this entity has been
|
|
6530
|
+
* saved successfully in the back-end system.
|
|
6531
|
+
*
|
|
6485
6532
|
* @param {string} sPath
|
|
6486
6533
|
* The path to the EntitySet
|
|
6487
6534
|
* @param {object} mParameters
|
|
@@ -6536,10 +6583,11 @@ sap.ui.define([
|
|
|
6536
6583
|
* If the <code>expand</code> parameter is used but the batch mode is disabled
|
|
6537
6584
|
* @public
|
|
6538
6585
|
*/
|
|
6539
|
-
ODataModel.prototype.createEntry = function(sPath, mParameters) {
|
|
6540
|
-
var bCanonical, sChangeSetId, oContext, fnCreated,
|
|
6541
|
-
|
|
6542
|
-
mRequests, fnSuccess, sUrl, aUrlParams,
|
|
6586
|
+
ODataModel.prototype.createEntry = function (sPath, mParameters) {
|
|
6587
|
+
var bCanonical, sChangeSetId, oContext, fnCreated, pCreate, fnCreatedPromiseResolve,
|
|
6588
|
+
sDeepPath, fnError, sETag, sExpand, sGroupId, mHeaders, sKey, sNormalizedPath,
|
|
6589
|
+
vProperties, bRefreshAfterChange, oRequest, mRequests, fnSuccess, sUrl, aUrlParams,
|
|
6590
|
+
mUrlParams,
|
|
6543
6591
|
oEntity = {},
|
|
6544
6592
|
sMethod = "POST",
|
|
6545
6593
|
that = this;
|
|
@@ -6649,6 +6697,7 @@ sap.ui.define([
|
|
|
6649
6697
|
oData = Object.assign({}, oCreateData, oData);
|
|
6650
6698
|
fnSuccessFromParameters(oData, oCreateResponse);
|
|
6651
6699
|
}
|
|
6700
|
+
fnCreatedPromiseResolve();
|
|
6652
6701
|
};
|
|
6653
6702
|
fnError = function (oError) {
|
|
6654
6703
|
if (oCreateData) {
|
|
@@ -6661,6 +6710,8 @@ sap.ui.define([
|
|
|
6661
6710
|
if (fnSuccessFromParameters) {
|
|
6662
6711
|
fnSuccessFromParameters(oCreateData, oCreateResponse);
|
|
6663
6712
|
}
|
|
6713
|
+
fnCreatedPromiseResolve();
|
|
6714
|
+
|
|
6664
6715
|
return;
|
|
6665
6716
|
}
|
|
6666
6717
|
if (!bCreateFailed) {
|
|
@@ -6679,12 +6730,19 @@ sap.ui.define([
|
|
|
6679
6730
|
bCreateFailed = false;
|
|
6680
6731
|
}
|
|
6681
6732
|
};
|
|
6733
|
+
} else {
|
|
6734
|
+
fnSuccess = function (oData, oCreateResponse) {
|
|
6735
|
+
if (fnSuccessFromParameters) {
|
|
6736
|
+
fnSuccessFromParameters(oData, oCreateResponse);
|
|
6737
|
+
}
|
|
6738
|
+
fnCreatedPromiseResolve();
|
|
6739
|
+
};
|
|
6682
6740
|
}
|
|
6683
6741
|
oEntity.__metadata = {
|
|
6684
6742
|
type: "" + oEntityMetadata.entityType,
|
|
6685
6743
|
uri: that.sServiceUrl + '/' + sKey,
|
|
6686
|
-
created: {
|
|
6687
|
-
key: sNormalizedPath.substring(1),
|
|
6744
|
+
created: {
|
|
6745
|
+
key: sNormalizedPath.substring(1), //store path for later POST
|
|
6688
6746
|
success: fnSuccess,
|
|
6689
6747
|
error: fnError,
|
|
6690
6748
|
headers: mHeaders,
|
|
@@ -6695,6 +6753,13 @@ sap.ui.define([
|
|
|
6695
6753
|
},
|
|
6696
6754
|
deepPath: sDeepPath
|
|
6697
6755
|
};
|
|
6756
|
+
pCreate = new SyncPromise(function (resolve, reject) {
|
|
6757
|
+
fnCreatedPromiseResolve = resolve;
|
|
6758
|
+
oEntity.__metadata.created.abort = reject;
|
|
6759
|
+
});
|
|
6760
|
+
pCreate.catch(function () {
|
|
6761
|
+
// avoid uncaught in promise if the caller of #createEntry does not use the promise
|
|
6762
|
+
});
|
|
6698
6763
|
|
|
6699
6764
|
sKey = that._addEntity(merge({}, oEntity));
|
|
6700
6765
|
that.mChangedEntities[sKey] = oEntity;
|
|
@@ -6713,8 +6778,8 @@ sap.ui.define([
|
|
|
6713
6778
|
oEntity.__metadata.created.expandRequest = oExpandRequest;
|
|
6714
6779
|
oEntity.__metadata.created.contentID = sUID;
|
|
6715
6780
|
}
|
|
6716
|
-
|
|
6717
|
-
oCreatedContext
|
|
6781
|
+
|
|
6782
|
+
oCreatedContext = that.getContext("/" + sKey, sDeepPath, pCreate);
|
|
6718
6783
|
|
|
6719
6784
|
oRequest.key = sKey;
|
|
6720
6785
|
oRequest.created = true;
|
|
@@ -7636,15 +7701,17 @@ sap.ui.define([
|
|
|
7636
7701
|
* The absolute path
|
|
7637
7702
|
* @param {string} [sDeepPath]
|
|
7638
7703
|
* The absolute deep path representing the same data as the given <code>sPath</code>
|
|
7704
|
+
* @param {sap.ui.base.SyncPromise} [oCreatePromise]
|
|
7705
|
+
* A created promise as specified in the constructor of {@link sap.ui.model.odata.v2.Context}
|
|
7639
7706
|
* @returns {sap.ui.model.odata.v2.Context}
|
|
7640
7707
|
* The ODate V2 context for the given path
|
|
7641
7708
|
* @private
|
|
7642
7709
|
*/
|
|
7643
|
-
ODataModel.prototype.getContext = function (sPath, sDeepPath) {
|
|
7710
|
+
ODataModel.prototype.getContext = function (sPath, sDeepPath, oCreatePromise) {
|
|
7644
7711
|
var oContext = this.mContexts[sPath];
|
|
7645
7712
|
|
|
7646
7713
|
if (!oContext) {
|
|
7647
|
-
oContext = this.mContexts[sPath] = new Context(this, sPath, sDeepPath);
|
|
7714
|
+
oContext = this.mContexts[sPath] = new Context(this, sPath, sDeepPath, oCreatePromise);
|
|
7648
7715
|
} else {
|
|
7649
7716
|
oContext.setDeepPath(sDeepPath || oContext.getDeepPath() || sPath);
|
|
7650
7717
|
}
|
|
@@ -7909,6 +7976,7 @@ sap.ui.define([
|
|
|
7909
7976
|
*/
|
|
7910
7977
|
ODataModel._createAbortedError = function () {
|
|
7911
7978
|
return {
|
|
7979
|
+
aborted : true,
|
|
7912
7980
|
headers : {},
|
|
7913
7981
|
message : "Request aborted",
|
|
7914
7982
|
responseText : "",
|
|
@@ -7917,5 +7985,17 @@ sap.ui.define([
|
|
|
7917
7985
|
};
|
|
7918
7986
|
};
|
|
7919
7987
|
|
|
7988
|
+
/**
|
|
7989
|
+
* Gets the cache for contexts of entities created via
|
|
7990
|
+
* {@link sap.ui.model.odata.v2.ODataListBinding#create}.
|
|
7991
|
+
*
|
|
7992
|
+
* @returns {sap.ui.model.odata.v2._CreatedContextsCache} The created entities cache
|
|
7993
|
+
*
|
|
7994
|
+
* @private
|
|
7995
|
+
*/
|
|
7996
|
+
ODataModel.prototype._getCreatedContextsCache = function () {
|
|
7997
|
+
return this.oCreatedContextsCache;
|
|
7998
|
+
};
|
|
7999
|
+
|
|
7920
8000
|
return ODataModel;
|
|
7921
8001
|
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* (c) Copyright 2009-2021 SAP SE or an SAP affiliate company.
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
/*eslint-disable max-len */
|
|
7
7
|
// Provides the OData model implementation of a tree binding
|
|
8
8
|
sap.ui.define([
|
|
9
9
|
"sap/base/assert",
|
|
@@ -92,7 +92,7 @@ sap.ui.define([
|
|
|
92
92
|
* @extends sap.ui.model.TreeBinding
|
|
93
93
|
* @hideconstructor
|
|
94
94
|
* @public
|
|
95
|
-
* @version 1.
|
|
95
|
+
* @version 1.96.0
|
|
96
96
|
*/
|
|
97
97
|
var ODataTreeBinding = TreeBinding.extend("sap.ui.model.odata.v2.ODataTreeBinding", /** @lends sap.ui.model.odata.v2.ODataTreeBinding.prototype */ {
|
|
98
98
|
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* OpenUI5
|
|
3
|
+
* (c) Copyright 2009-2021 SAP SE or an SAP affiliate company.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
//Provides class sap.ui.model.odata.v2._CreatedContextsCache
|
|
8
|
+
sap.ui.define([
|
|
9
|
+
], function () {
|
|
10
|
+
"use strict";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Maps a binding path and a list ID, as given as <code>createdEntitiesKey</code> parameter to
|
|
14
|
+
* {@link sap.ui.model.odata.v2.ODataModel#bindList}, to a list of contexts for created
|
|
15
|
+
* entities, if the entities are created via
|
|
16
|
+
* {@link sap.ui.model.odata.v2.ODataListBinding#create}.
|
|
17
|
+
*
|
|
18
|
+
* @alias sap.ui.model.odata.v2._CreatedContextsCache
|
|
19
|
+
* @constructor
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
function _CreatedContextsCache() {
|
|
23
|
+
// binding path => { list ID => array of created OData V2 contexts }
|
|
24
|
+
this.mCache = {};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Adds a context to the list of contexts for created entities for the given path and list ID.
|
|
29
|
+
*
|
|
30
|
+
* @param {sap.ui.model.odata.v2.Context} oCreatedContext
|
|
31
|
+
* The context for a created entity
|
|
32
|
+
* @param {string} sPath
|
|
33
|
+
* The resolved binding path
|
|
34
|
+
* @param {string} sListID
|
|
35
|
+
* The identifier for the list showing the data
|
|
36
|
+
*
|
|
37
|
+
* @private
|
|
38
|
+
*/
|
|
39
|
+
_CreatedContextsCache.prototype.addContext = function (oCreatedContext, sPath, sListID) {
|
|
40
|
+
var aContexts, mListIDToContexts;
|
|
41
|
+
|
|
42
|
+
mListIDToContexts = this.mCache[sPath];
|
|
43
|
+
if (!mListIDToContexts) {
|
|
44
|
+
mListIDToContexts = this.mCache[sPath] = {};
|
|
45
|
+
}
|
|
46
|
+
aContexts = mListIDToContexts[sListID];
|
|
47
|
+
if (!aContexts) {
|
|
48
|
+
aContexts = mListIDToContexts[sListID] = [];
|
|
49
|
+
}
|
|
50
|
+
// currently we support only bAtEnd === false in ODataListBinding#create
|
|
51
|
+
aContexts.unshift(oCreatedContext);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Finds and removes a context from the list of contexts for created entities.
|
|
56
|
+
*
|
|
57
|
+
* @param {sap.ui.model.odata.v2.Context} oCreatedContext
|
|
58
|
+
* The context for a created entity to be removed
|
|
59
|
+
*
|
|
60
|
+
* @private
|
|
61
|
+
*/
|
|
62
|
+
_CreatedContextsCache.prototype.findAndRemoveContext = function (oCreatedContext) {
|
|
63
|
+
var that = this;
|
|
64
|
+
|
|
65
|
+
Object.keys(this.mCache).some(function (sCachePath) {
|
|
66
|
+
var mListIDToContexts = that.mCache[sCachePath];
|
|
67
|
+
|
|
68
|
+
return Object.keys(mListIDToContexts).some(function (sListID) {
|
|
69
|
+
var aContexts = that.mCache[sCachePath][sListID];
|
|
70
|
+
|
|
71
|
+
if (aContexts.includes(oCreatedContext)) {
|
|
72
|
+
that.removeContext(oCreatedContext, sCachePath, sListID);
|
|
73
|
+
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return false;
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Gets the contexts for created entities for the given path and list ID.
|
|
84
|
+
*
|
|
85
|
+
* @param {string} [sPath]
|
|
86
|
+
* The resolved binding path
|
|
87
|
+
* @param {string} sListID
|
|
88
|
+
* The identifier for the list showing the data
|
|
89
|
+
* @returns {sap.ui.model.odata.v2.Context[]}
|
|
90
|
+
* An array containing all contexts for created entities for the given path and list ID;
|
|
91
|
+
* returns an empty array if no path is given
|
|
92
|
+
*
|
|
93
|
+
* @private
|
|
94
|
+
*/
|
|
95
|
+
_CreatedContextsCache.prototype.getContexts = function (sPath, sListID) {
|
|
96
|
+
var mListIDToContexts = this.mCache[sPath],
|
|
97
|
+
aContexts = mListIDToContexts && mListIDToContexts[sListID];
|
|
98
|
+
|
|
99
|
+
return aContexts ? aContexts.slice() : [];
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Removes a context from the list of contexts for created entities for the given path and list
|
|
104
|
+
* ID.
|
|
105
|
+
*
|
|
106
|
+
* @param {sap.ui.model.odata.v2.Context} oCreatedContext
|
|
107
|
+
* The context for a created entity to be removed
|
|
108
|
+
* @param {sPath} sPath
|
|
109
|
+
* The resolved binding path
|
|
110
|
+
* @param {string} sListID
|
|
111
|
+
* The identifier for the list showing the data
|
|
112
|
+
*
|
|
113
|
+
* @private
|
|
114
|
+
*/
|
|
115
|
+
_CreatedContextsCache.prototype.removeContext = function (oCreatedContext, sPath, sListID) {
|
|
116
|
+
var mListIDToContexts = this.mCache[sPath],
|
|
117
|
+
aContexts = mListIDToContexts[sListID];
|
|
118
|
+
|
|
119
|
+
aContexts.splice(aContexts.indexOf(oCreatedContext), 1);
|
|
120
|
+
if (!aContexts.length) {
|
|
121
|
+
delete mListIDToContexts[sListID];
|
|
122
|
+
if (!Object.keys(mListIDToContexts).length) {
|
|
123
|
+
delete this.mCache[sPath];
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
return _CreatedContextsCache;
|
|
129
|
+
}, /* bExport= */ false);
|
|
@@ -98,7 +98,7 @@ sap.ui.define([
|
|
|
98
98
|
* @hideconstructor
|
|
99
99
|
* @public
|
|
100
100
|
* @since 1.39.0
|
|
101
|
-
* @version 1.
|
|
101
|
+
* @version 1.96.0
|
|
102
102
|
*/
|
|
103
103
|
var Context = BaseContext.extend("sap.ui.model.odata.v4.Context", {
|
|
104
104
|
constructor : function (oModel, oBinding, sPath, iIndex, oCreatePromise, iGeneration) {
|
|
@@ -155,9 +155,9 @@ sap.ui.define([
|
|
|
155
155
|
throw new Error("Unsupported binding parameter $$inheritExpandSelect: "
|
|
156
156
|
+ "binding is not an operation binding");
|
|
157
157
|
}
|
|
158
|
-
if (mParameters.$expand
|
|
158
|
+
if (mParameters.$expand) {
|
|
159
159
|
throw new Error("Must not set parameter $$inheritExpandSelect on a binding "
|
|
160
|
-
+ "which has a $expand
|
|
160
|
+
+ "which has a $expand binding parameter");
|
|
161
161
|
}
|
|
162
162
|
break;
|
|
163
163
|
case "$$operationMode":
|
|
@@ -291,7 +291,6 @@ sap.ui.define([
|
|
|
291
291
|
}
|
|
292
292
|
oCache.$deepResourcePath = sDeepResourcePath;
|
|
293
293
|
oCache.$generation = iGeneration;
|
|
294
|
-
oCache.$resourcePath = sResourcePath;
|
|
295
294
|
}
|
|
296
295
|
} else { // absolute binding
|
|
297
296
|
oCache = this.doCreateCache(sResourcePath, this.mCacheQueryOptions);
|