@sapui5/sap.fe.core 1.99.0 → 1.101.1
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/package.json +6 -4
- package/src/sap/fe/core/.library +2 -3
- package/src/sap/fe/core/AnnotationHelper.js +43 -92
- package/src/sap/fe/core/AnnotationHelper.ts +43 -107
- package/src/sap/fe/core/AppComponent.js +381 -399
- package/src/sap/fe/core/AppComponent.ts +397 -0
- package/src/sap/fe/core/AppStateHandler.js +131 -162
- package/src/sap/fe/core/AppStateHandler.ts +2 -2
- package/src/sap/fe/core/BaseController.js +82 -58
- package/src/sap/fe/core/BaseController.ts +67 -0
- package/src/sap/fe/core/CommonUtils.js +179 -31
- package/src/sap/fe/core/CommonUtils.ts +295 -125
- package/src/sap/fe/core/ExtensionAPI.js +279 -274
- package/src/sap/fe/core/ExtensionAPI.ts +242 -0
- package/src/sap/fe/core/PageController.js +158 -29
- package/src/sap/fe/core/PageController.ts +65 -37
- package/src/sap/fe/core/RouterProxy.js +700 -750
- package/src/sap/fe/core/RouterProxy.ts +47 -31
- package/src/sap/fe/core/Synchronization.js +21 -31
- package/src/sap/fe/core/TemplateComponent.js +193 -118
- package/src/sap/fe/core/TemplateComponent.ts +104 -109
- package/src/sap/fe/core/TemplateModel.js +24 -44
- package/src/sap/fe/core/TemplateModel.ts +3 -3
- package/src/sap/fe/core/TransactionHelper.js +1368 -1369
- package/src/sap/fe/core/TransactionHelper.ts +201 -171
- package/src/sap/fe/core/actions/collaboration/ActivitySync.js +406 -0
- package/src/sap/fe/core/actions/collaboration/ActivitySync.ts +362 -0
- package/src/sap/fe/core/actions/collaboration/CollaborationCommon.js +146 -0
- package/src/sap/fe/core/actions/collaboration/CollaborationCommon.ts +129 -0
- package/src/sap/fe/core/actions/collaboration/Manage.js +264 -0
- package/src/sap/fe/core/actions/collaboration/Manage.ts +246 -0
- package/src/sap/fe/core/actions/collaboration/ManageDialog.fragment.xml +100 -0
- package/src/sap/fe/core/actions/collaboration/UserDetails.fragment.xml +13 -0
- package/src/sap/fe/core/actions/draft.js +324 -220
- package/src/sap/fe/core/actions/draft.ts +209 -133
- package/src/sap/fe/core/actions/messageHandling.js +79 -48
- package/src/sap/fe/core/actions/messageHandling.ts +113 -83
- package/src/sap/fe/core/actions/operations.js +37 -18
- package/src/sap/fe/core/actions/operations.ts +51 -20
- package/src/sap/fe/core/actions/sticky.js +17 -4
- package/src/sap/fe/core/actions/sticky.ts +21 -4
- package/src/sap/fe/core/buildingBlocks/AttributeModel.js +60 -0
- package/src/sap/fe/core/buildingBlocks/AttributeModel.ts +37 -0
- package/src/sap/fe/core/buildingBlocks/BuildingBlock.js +165 -0
- package/src/sap/fe/core/buildingBlocks/BuildingBlock.ts +178 -0
- package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.js +707 -0
- package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.ts +628 -0
- package/src/sap/fe/core/buildingBlocks/TraceInfo.js +436 -0
- package/src/sap/fe/core/buildingBlocks/TraceInfo.ts +431 -0
- package/src/sap/fe/core/controllerextensions/EditFlow.js +1854 -1669
- package/src/sap/fe/core/controllerextensions/EditFlow.ts +1792 -0
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +79 -54
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.ts +60 -0
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +716 -779
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.ts +785 -0
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +796 -816
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.ts +810 -0
- package/src/sap/fe/core/controllerextensions/InternalRouting.js +1056 -1005
- package/src/sap/fe/core/controllerextensions/InternalRouting.ts +1001 -0
- package/src/sap/fe/core/controllerextensions/KPIManagement.js +498 -532
- package/src/sap/fe/core/controllerextensions/KPIManagement.ts +13 -12
- package/src/sap/fe/core/controllerextensions/MassEdit.js +141 -169
- package/src/sap/fe/core/controllerextensions/MassEdit.ts +155 -0
- package/src/sap/fe/core/controllerextensions/MessageHandler.js +221 -244
- package/src/sap/fe/core/controllerextensions/MessageHandler.ts +215 -0
- package/src/sap/fe/core/controllerextensions/PageReady.js +312 -345
- package/src/sap/fe/core/controllerextensions/PageReady.ts +57 -53
- package/src/sap/fe/core/controllerextensions/Paginator.js +188 -175
- package/src/sap/fe/core/controllerextensions/Paginator.ts +169 -0
- package/src/sap/fe/core/controllerextensions/Placeholder.js +157 -149
- package/src/sap/fe/core/controllerextensions/Placeholder.ts +149 -0
- package/src/sap/fe/core/controllerextensions/Routing.js +144 -125
- package/src/sap/fe/core/controllerextensions/Routing.ts +131 -0
- package/src/sap/fe/core/controllerextensions/RoutingListener.js +7 -6
- package/src/sap/fe/core/controllerextensions/RoutingListener.ts +3 -0
- package/src/sap/fe/core/controllerextensions/Share.js +230 -268
- package/src/sap/fe/core/controllerextensions/Share.ts +231 -0
- package/src/sap/fe/core/controllerextensions/SideEffects.js +603 -644
- package/src/sap/fe/core/controllerextensions/SideEffects.ts +68 -68
- package/src/sap/fe/core/controllerextensions/ViewState.js +774 -806
- package/src/sap/fe/core/controllerextensions/ViewState.ts +796 -0
- package/src/sap/fe/core/controls/ActionParameterDialog.fragment.xml +2 -2
- package/src/sap/fe/core/controls/ActionPartial.fragment.xml +2 -2
- package/src/sap/fe/core/controls/Any.js +28 -0
- package/src/sap/fe/core/controls/Any.ts +30 -0
- package/src/sap/fe/core/controls/CommandExecution.js +92 -68
- package/src/sap/fe/core/controls/CommandExecution.ts +72 -0
- package/src/sap/fe/core/controls/ConditionalWrapper.js +165 -79
- package/src/sap/fe/core/controls/ConditionalWrapper.ts +74 -0
- package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.js +366 -0
- package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.ts +278 -0
- package/src/sap/fe/core/controls/CustomQuickViewPage.js +167 -125
- package/src/sap/fe/core/controls/CustomQuickViewPage.ts +116 -0
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossDraft.fragment.xml +44 -5
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +163 -122
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.ts +155 -0
- package/src/sap/fe/core/controls/FieldWrapper.js +212 -141
- package/src/sap/fe/core/controls/FieldWrapper.ts +104 -0
- package/src/sap/fe/core/controls/FileWrapper.js +313 -0
- package/src/sap/fe/core/controls/FileWrapper.ts +169 -0
- package/src/sap/fe/core/controls/FilterBar.js +197 -159
- package/src/sap/fe/core/controls/FilterBar.ts +148 -0
- package/src/sap/fe/core/controls/FormElementWrapper.js +100 -39
- package/src/sap/fe/core/controls/FormElementWrapper.ts +37 -0
- package/src/sap/fe/core/controls/MultiValueParameterDelegate.js +37 -42
- package/src/sap/fe/core/controls/MultiValueParameterDelegate.ts +31 -0
- package/src/sap/fe/core/controls/filterbar/FilterContainer.js +147 -115
- package/src/sap/fe/core/controls/filterbar/FilterContainer.ts +102 -0
- package/src/sap/fe/core/controls/filterbar/VisualFilter.js +300 -265
- package/src/sap/fe/core/controls/filterbar/VisualFilter.ts +252 -0
- package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +185 -140
- package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.ts +125 -0
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +335 -322
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.ts +337 -0
- package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +37 -42
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +75 -74
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.ts +71 -0
- package/src/sap/fe/core/converters/ConverterContext.js +348 -379
- package/src/sap/fe/core/converters/ConverterContext.ts +19 -16
- package/src/sap/fe/core/converters/ManifestSettings.js +13 -1
- package/src/sap/fe/core/converters/ManifestSettings.ts +17 -2
- package/src/sap/fe/core/converters/ManifestWrapper.js +354 -378
- package/src/sap/fe/core/converters/ManifestWrapper.ts +10 -0
- package/src/sap/fe/core/converters/MetaModelConverter.js +6 -4
- package/src/sap/fe/core/converters/MetaModelConverter.ts +5 -2
- package/src/sap/fe/core/converters/TemplateConverter.js +1 -1
- package/src/sap/fe/core/converters/TemplateConverter.ts +2 -1
- package/src/sap/fe/core/converters/annotations/DataField.js +26 -13
- package/src/sap/fe/core/converters/annotations/DataField.ts +40 -17
- package/src/sap/fe/core/converters/controls/Common/Action.js +10 -10
- package/src/sap/fe/core/converters/controls/Common/Action.ts +20 -19
- package/src/sap/fe/core/converters/controls/Common/Chart.js +8 -8
- package/src/sap/fe/core/converters/controls/Common/Chart.ts +12 -11
- package/src/sap/fe/core/converters/controls/Common/Form.js +6 -6
- package/src/sap/fe/core/converters/controls/Common/Form.ts +7 -3
- package/src/sap/fe/core/converters/controls/Common/KPI.js +1 -1
- package/src/sap/fe/core/converters/controls/Common/KPI.ts +2 -2
- package/src/sap/fe/core/converters/controls/Common/Table.js +326 -86
- package/src/sap/fe/core/converters/controls/Common/Table.ts +384 -167
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +120 -55
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +158 -98
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +206 -223
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +263 -287
- package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.js +6 -6
- package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.ts +20 -18
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +5 -2
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +4 -1
- package/src/sap/fe/core/converters/helpers/Aggregation.js +115 -133
- package/src/sap/fe/core/converters/helpers/BindingHelper.js +20 -6
- package/src/sap/fe/core/converters/helpers/BindingHelper.ts +16 -4
- package/src/sap/fe/core/converters/helpers/ConfigurableObject.js +12 -1
- package/src/sap/fe/core/converters/helpers/ConfigurableObject.ts +11 -0
- package/src/sap/fe/core/converters/helpers/Key.js +42 -57
- package/src/sap/fe/core/converters/helpers/Key.ts +1 -1
- package/src/sap/fe/core/converters/objectPage/FormMenuActions.js +1 -1
- package/src/sap/fe/core/converters/objectPage/FormMenuActions.ts +0 -4
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +51 -27
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +69 -43
- package/src/sap/fe/core/converters/templates/ListReportConverter.js +42 -25
- package/src/sap/fe/core/converters/templates/ListReportConverter.ts +91 -65
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +11 -9
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +8 -8
- package/src/sap/fe/core/designtime/AppComponent.designtime.js +92 -98
- package/src/sap/fe/core/designtime/AppComponent.designtime.ts +91 -0
- package/src/sap/fe/core/formatters/CollaborationFormatter.js +104 -0
- package/src/sap/fe/core/formatters/CollaborationFormatter.ts +60 -0
- package/src/sap/fe/core/formatters/KPIFormatter.js +3 -12
- package/src/sap/fe/core/formatters/KPIFormatter.ts +3 -2
- package/src/sap/fe/core/formatters/TableFormatter.js +53 -2
- package/src/sap/fe/core/formatters/TableFormatter.ts +51 -0
- package/src/sap/fe/core/formatters/ValueFormatter.js +4 -4
- package/src/sap/fe/core/formatters/ValueFormatter.ts +4 -7
- package/src/sap/fe/core/fpm/Component.js +80 -55
- package/src/sap/fe/core/fpm/Component.ts +43 -0
- package/src/sap/fe/core/helpers/AppStartupHelper.js +323 -309
- package/src/sap/fe/core/helpers/AppStartupHelper.ts +363 -337
- package/src/sap/fe/core/helpers/BindingExpression.js +7 -7
- package/src/sap/fe/core/helpers/BindingExpression.ts +7 -7
- package/src/sap/fe/core/helpers/ClassSupport.js +307 -166
- package/src/sap/fe/core/helpers/ClassSupport.ts +348 -155
- package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.js +5 -4
- package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.ts +1 -5
- package/src/sap/fe/core/helpers/FPMHelper.js +1 -1
- package/src/sap/fe/core/helpers/FPMHelper.ts +1 -1
- package/src/sap/fe/core/helpers/MassEditHelper.js +735 -684
- package/src/sap/fe/core/helpers/MassEditHelper.ts +803 -0
- package/src/sap/fe/core/helpers/ModelHelper.js +53 -1
- package/src/sap/fe/core/helpers/ModelHelper.ts +46 -0
- package/src/sap/fe/core/helpers/PasteHelper.js +4 -4
- package/src/sap/fe/core/helpers/PasteHelper.ts +4 -3
- package/src/sap/fe/core/helpers/SemanticDateOperators.js +7 -3
- package/src/sap/fe/core/helpers/SemanticDateOperators.ts +7 -1
- package/src/sap/fe/core/helpers/SemanticKeyHelper.js +1 -1
- package/src/sap/fe/core/helpers/SemanticKeyHelper.ts +1 -1
- package/src/sap/fe/core/helpers/StableIdHelper.js +1 -7
- package/src/sap/fe/core/helpers/StableIdHelper.ts +0 -4
- package/src/sap/fe/core/jsx-runtime/jsx.js +35 -5
- package/src/sap/fe/core/jsx-runtime/jsx.ts +22 -8
- package/src/sap/fe/core/library.js +425 -451
- package/src/sap/fe/core/library.support.js +22 -33
- package/src/sap/fe/core/library.support.ts +23 -0
- package/src/sap/fe/core/library.ts +420 -0
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +5 -3
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +4 -4
- package/src/sap/fe/core/messagebundle.properties +45 -13
- package/src/sap/fe/core/messagebundle_ar.properties +29 -7
- package/src/sap/fe/core/messagebundle_bg.properties +29 -7
- package/src/sap/fe/core/messagebundle_ca.properties +29 -7
- package/src/sap/fe/core/messagebundle_cs.properties +29 -7
- package/src/sap/fe/core/messagebundle_cy.properties +29 -7
- package/src/sap/fe/core/messagebundle_da.properties +29 -7
- package/src/sap/fe/core/messagebundle_de.properties +29 -7
- package/src/sap/fe/core/messagebundle_el.properties +29 -7
- package/src/sap/fe/core/messagebundle_en.properties +29 -7
- package/src/sap/fe/core/messagebundle_en_GB.properties +29 -7
- package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +29 -7
- package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +29 -7
- package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +29 -7
- package/src/sap/fe/core/messagebundle_es.properties +29 -7
- package/src/sap/fe/core/messagebundle_es_MX.properties +29 -7
- package/src/sap/fe/core/messagebundle_et.properties +29 -7
- package/src/sap/fe/core/messagebundle_fi.properties +30 -8
- package/src/sap/fe/core/messagebundle_fr.properties +31 -9
- package/src/sap/fe/core/messagebundle_fr_CA.properties +31 -9
- package/src/sap/fe/core/messagebundle_hi.properties +29 -7
- package/src/sap/fe/core/messagebundle_hr.properties +29 -7
- package/src/sap/fe/core/messagebundle_hu.properties +29 -7
- package/src/sap/fe/core/messagebundle_id.properties +29 -7
- package/src/sap/fe/core/messagebundle_it.properties +29 -7
- package/src/sap/fe/core/messagebundle_iw.properties +29 -7
- package/src/sap/fe/core/messagebundle_ja.properties +28 -6
- package/src/sap/fe/core/messagebundle_kk.properties +29 -7
- package/src/sap/fe/core/messagebundle_ko.properties +29 -7
- package/src/sap/fe/core/messagebundle_lt.properties +29 -7
- package/src/sap/fe/core/messagebundle_lv.properties +30 -8
- package/src/sap/fe/core/messagebundle_ms.properties +29 -7
- package/src/sap/fe/core/messagebundle_nl.properties +29 -7
- package/src/sap/fe/core/messagebundle_no.properties +29 -7
- package/src/sap/fe/core/messagebundle_pl.properties +29 -7
- package/src/sap/fe/core/messagebundle_pt.properties +30 -8
- package/src/sap/fe/core/messagebundle_pt_PT.properties +29 -7
- package/src/sap/fe/core/messagebundle_ro.properties +29 -7
- package/src/sap/fe/core/messagebundle_ru.properties +29 -7
- package/src/sap/fe/core/messagebundle_sh.properties +29 -7
- package/src/sap/fe/core/messagebundle_sk.properties +29 -7
- package/src/sap/fe/core/messagebundle_sl.properties +29 -7
- package/src/sap/fe/core/messagebundle_sv.properties +30 -8
- package/src/sap/fe/core/messagebundle_th.properties +28 -6
- package/src/sap/fe/core/messagebundle_tr.properties +32 -10
- package/src/sap/fe/core/messagebundle_uk.properties +29 -7
- package/src/sap/fe/core/messagebundle_vi.properties +29 -7
- package/src/sap/fe/core/messagebundle_zh_CN.properties +29 -7
- package/src/sap/fe/core/messagebundle_zh_TW.properties +29 -7
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +47 -73
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.ts +1 -1
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +158 -196
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.ts +5 -6
- package/src/sap/fe/core/services/EnvironmentServiceFactory.js +70 -96
- package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +7 -6
- package/src/sap/fe/core/services/NavigationServiceFactory.js +287 -342
- package/src/sap/fe/core/services/NavigationServiceFactory.ts +11 -14
- package/src/sap/fe/core/services/ResourceModelServiceFactory.js +70 -105
- package/src/sap/fe/core/services/ResourceModelServiceFactory.ts +6 -3
- package/src/sap/fe/core/services/RoutingServiceFactory.js +796 -820
- package/src/sap/fe/core/services/RoutingServiceFactory.ts +62 -53
- package/src/sap/fe/core/services/ShellServicesFactory.js +694 -741
- package/src/sap/fe/core/services/ShellServicesFactory.ts +33 -33
- package/src/sap/fe/core/services/SideEffectsServiceFactory.js +570 -595
- package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +23 -4
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +357 -389
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +25 -29
- package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.js +43 -5
- package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.ts +7 -4
- package/src/sap/fe/core/support/CommonHelper.js +1 -1
- package/src/sap/fe/core/support/CommonHelper.ts +1 -4
- package/src/sap/fe/core/support/Diagnostics.js +36 -48
- package/src/sap/fe/core/templating/DataModelPathHelper.js +91 -90
- package/src/sap/fe/core/templating/DataModelPathHelper.ts +126 -123
- package/src/sap/fe/core/templating/DisplayModeFormatter.js +23 -3
- package/src/sap/fe/core/templating/DisplayModeFormatter.ts +26 -5
- package/src/sap/fe/core/templating/FilterHelper.js +25 -32
- package/src/sap/fe/core/templating/FilterHelper.ts +36 -35
- package/src/sap/fe/core/templating/PropertyHelper.js +16 -2
- package/src/sap/fe/core/templating/PropertyHelper.ts +31 -24
- package/src/sap/fe/core/templating/UIFormatters.js +150 -44
- package/src/sap/fe/core/templating/UIFormatters.ts +165 -67
- package/src/sap/fe/core/type/Email.js +26 -8
- package/src/sap/fe/core/type/Email.ts +8 -7
- package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.js +0 -75
|
@@ -1,17 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import MessageBox from "sap/m/MessageBox";
|
|
1
|
+
import ResourceBundle from "sap/base/i18n/ResourceBundle";
|
|
2
|
+
import Log from "sap/base/Log";
|
|
3
|
+
import ActivitySync from "sap/fe/core/actions/collaboration/ActivitySync";
|
|
5
4
|
import messageHandling from "sap/fe/core/actions/messageHandling";
|
|
5
|
+
import AppComponent from "sap/fe/core/AppComponent";
|
|
6
6
|
import CommonUtils from "sap/fe/core/CommonUtils";
|
|
7
|
-
import
|
|
8
|
-
import { AppComponent } from "sap/fe/core";
|
|
7
|
+
import FELibrary from "sap/fe/core/library";
|
|
9
8
|
import { SideEffectsService } from "sap/fe/core/services/SideEffectsServiceFactory";
|
|
10
|
-
import
|
|
9
|
+
import Button from "sap/m/Button";
|
|
10
|
+
import Dialog from "sap/m/Dialog";
|
|
11
|
+
import MessageBox from "sap/m/MessageBox";
|
|
12
|
+
import Text from "sap/m/Text";
|
|
13
|
+
import Core from "sap/ui/core/Core";
|
|
11
14
|
import View from "sap/ui/core/mvc/View";
|
|
12
15
|
import Context from "sap/ui/model/odata/v4/Context";
|
|
13
16
|
import ODataMetaModel from "sap/ui/model/odata/v4/ODataMetaModel";
|
|
14
17
|
import ResourceModel from "sap/ui/model/resource/ResourceModel";
|
|
18
|
+
import { CoreEx } from "types/extension_types";
|
|
19
|
+
|
|
20
|
+
const ProgrammingModel = FELibrary.ProgrammingModel;
|
|
21
|
+
export type SiblingInformation = {
|
|
22
|
+
targetContext: Context;
|
|
23
|
+
pathMapping: { oldPath: string; newPath: string }[];
|
|
24
|
+
};
|
|
15
25
|
|
|
16
26
|
/**
|
|
17
27
|
* Interface for callbacks used in the functions
|
|
@@ -78,11 +88,7 @@ const draftOperations = {
|
|
|
78
88
|
* @experimental This module is only for experimental use! <br/><b>This is only a POC and maybe deleted</b>
|
|
79
89
|
* @since 1.54.0
|
|
80
90
|
*/
|
|
81
|
-
|
|
82
|
-
createDraftFromActiveDocument: createDraftFromActiveDocument,
|
|
83
|
-
activateDocument: activateDocument,
|
|
84
|
-
deleteDraft: deleteDraft
|
|
85
|
-
};
|
|
91
|
+
|
|
86
92
|
/**
|
|
87
93
|
* Determines action name for a draft operation.
|
|
88
94
|
*
|
|
@@ -135,37 +141,20 @@ function executeDraftEditAction(oContext: any, bPreserveChanges: boolean) {
|
|
|
135
141
|
const oOperation = createOperation(oContext, draftOperations.EDIT, oOptions);
|
|
136
142
|
oOperation.setParameter("PreserveChanges", bPreserveChanges);
|
|
137
143
|
const sGroupId = "direct";
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
144
|
+
const localI18nRef = (Core as CoreEx).getLibraryResourceBundle("sap.fe.core");
|
|
145
|
+
const sActionName = localI18nRef.getText("C_COMMON_OBJECT_PAGE_EDIT");
|
|
146
|
+
const oEditPromise = oOperation
|
|
147
|
+
.execute(sGroupId, undefined, CommonUtils.fnOnStrictHandlingFailed.bind(draft, sGroupId, sActionName, oContext.getModel()))
|
|
148
|
+
.then(function (oDraftDocumentContext: any) {
|
|
149
|
+
return oDraftDocumentContext;
|
|
150
|
+
});
|
|
141
151
|
oOperation.getModel().submitBatch(sGroupId);
|
|
142
152
|
return oEditPromise;
|
|
143
153
|
} else {
|
|
144
154
|
throw new Error("You cannot edit this draft document");
|
|
145
155
|
}
|
|
146
156
|
}
|
|
147
|
-
|
|
148
|
-
if (aMessages.length === 1) {
|
|
149
|
-
const sMessage = aMessages[0].message,
|
|
150
|
-
dialogPromise = new Promise(function(resolve: (value: any) => void) {
|
|
151
|
-
sap.ui.require(["sap/m/MessageBox"], function(MessageBox: any) {
|
|
152
|
-
MessageBox.warning(sMessage, {
|
|
153
|
-
title: "Warning",
|
|
154
|
-
actions: [MessageBox.Action.OK, MessageBox.Action.CANCEL],
|
|
155
|
-
onClose: function(sAction: any) {
|
|
156
|
-
if (sAction === MessageBox.Action.OK) {
|
|
157
|
-
resolve(true);
|
|
158
|
-
oContext.getModel().submitBatch(sGroupId);
|
|
159
|
-
} else {
|
|
160
|
-
resolve(false);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
return dialogPromise;
|
|
167
|
-
}
|
|
168
|
-
}*/
|
|
157
|
+
|
|
169
158
|
/**
|
|
170
159
|
* Activates a draft document. The draft will replace the sibling entity and will be deleted by the back end.
|
|
171
160
|
*
|
|
@@ -186,25 +175,31 @@ function executeDraftActivationAction(oContext: any, oAppComponent: AppComponent
|
|
|
186
175
|
|
|
187
176
|
if (!oContext.getProperty("IsActiveEntity")) {
|
|
188
177
|
const oOperation = createOperation(oContext, draftOperations.ACTIVATION, { $$inheritExpandSelect: true });
|
|
178
|
+
const localI18nRef = (Core as CoreEx).getLibraryResourceBundle("sap.fe.core");
|
|
179
|
+
const sActionName = localI18nRef.getText("C_OP_OBJECT_PAGE_SAVE");
|
|
189
180
|
return oOperation
|
|
190
|
-
.execute(
|
|
191
|
-
|
|
181
|
+
.execute(
|
|
182
|
+
sGroupId,
|
|
183
|
+
bIgnoreEtag,
|
|
184
|
+
sGroupId ? CommonUtils.fnOnStrictHandlingFailed.bind(draft, sGroupId, sActionName, oContext.getModel()) : undefined
|
|
185
|
+
) //3rd parameter<------
|
|
186
|
+
.then(function (oActiveDocumentContext: any) {
|
|
192
187
|
return oActiveDocumentContext;
|
|
193
188
|
})
|
|
194
189
|
.catch(
|
|
195
190
|
//if ACTIVATE action fails then we request either the sideEffects against PREPARE action (if annotated) or the messages as fallback:
|
|
196
|
-
function() {
|
|
191
|
+
function () {
|
|
197
192
|
if (bHasPrepareAction) {
|
|
198
193
|
const sActionName = getActionName(oContext, draftOperations.PREPARE),
|
|
199
194
|
oSideEffectsService = oAppComponent.getSideEffectsService(),
|
|
200
195
|
oBindingParameters = oSideEffectsService.getODataActionSideEffects(sActionName, oContext),
|
|
201
196
|
aTargetPaths = oBindingParameters && oBindingParameters.pathExpressions;
|
|
202
197
|
if (aTargetPaths && aTargetPaths.length > 0) {
|
|
203
|
-
oSideEffectsService.requestSideEffects(aTargetPaths, oContext).catch(function(oError: any) {
|
|
198
|
+
oSideEffectsService.requestSideEffects(aTargetPaths, oContext).catch(function (oError: any) {
|
|
204
199
|
Log.error("Error while requesting side effects", oError);
|
|
205
200
|
});
|
|
206
201
|
} else {
|
|
207
|
-
requestMessages(oContext, oSideEffectsService).catch(function(oError: any) {
|
|
202
|
+
requestMessages(oContext, oSideEffectsService).catch(function (oError: any) {
|
|
208
203
|
Log.error("Error while requesting messages", oError);
|
|
209
204
|
});
|
|
210
205
|
}
|
|
@@ -221,51 +216,27 @@ function executeDraftActivationAction(oContext: any, oAppComponent: AppComponent
|
|
|
221
216
|
*
|
|
222
217
|
* @function
|
|
223
218
|
* @param {sap.ui.model.odata.v4.Context} oContext Context for which the action should be performed
|
|
224
|
-
* @param {
|
|
225
|
-
* @param {object} mParameters The parameters
|
|
226
|
-
* @param {boolean} [mParameters.groupId] The optional batch group where we want to execute the operation in
|
|
227
|
-
* @param {boolean} [mParameters.bPrepareForEdit] Shall the messages be requested if supported by service
|
|
219
|
+
* @param {string} groupId The optional batch group in which we want to execute the operation
|
|
228
220
|
* @returns {Promise.<sap.ui.model.odata.v4.Context>} Resolve function returns the context of the operation
|
|
229
221
|
* @private
|
|
230
222
|
* @ui5-restricted
|
|
231
223
|
*/
|
|
232
|
-
function executeDraftPreparationAction(
|
|
233
|
-
oContext: any,
|
|
234
|
-
oAppComponent: AppComponent,
|
|
235
|
-
mParameters: { groupId?: string; bPrepareForEdit?: boolean }
|
|
236
|
-
) {
|
|
237
|
-
const mParams = mParameters || {};
|
|
224
|
+
function executeDraftPreparationAction(oContext: Context, groupId?: string) {
|
|
238
225
|
if (!oContext.getProperty("IsActiveEntity")) {
|
|
239
226
|
const oOperation = createOperation(oContext, draftOperations.PREPARE);
|
|
240
227
|
|
|
241
228
|
// TODO: side effects qualifier shall be even deprecated to be checked
|
|
242
229
|
oOperation.setParameter("SideEffectsQualifier", "");
|
|
243
230
|
|
|
244
|
-
const sGroupId =
|
|
245
|
-
|
|
231
|
+
const sGroupId = groupId || oOperation.getGroupId();
|
|
232
|
+
return oOperation
|
|
246
233
|
.execute(sGroupId)
|
|
247
|
-
.then(function() {
|
|
248
|
-
if (mParams.bPrepareForEdit) {
|
|
249
|
-
// if PREPARE action is triggered after Edit then either the sideEffects (if annotated against PREPARE) are executed or the messages are requested as fallback if no sideEffects:
|
|
250
|
-
const sActionName = getActionName(oContext, draftOperations.PREPARE),
|
|
251
|
-
oSideEffectsService = oAppComponent.getSideEffectsService(),
|
|
252
|
-
oBindingParameters = oSideEffectsService.getODataActionSideEffects(sActionName, oContext),
|
|
253
|
-
aTargetPaths = oBindingParameters && oBindingParameters.pathExpressions;
|
|
254
|
-
if (aTargetPaths && aTargetPaths.length > 0) {
|
|
255
|
-
oSideEffectsService.requestSideEffects(aTargetPaths, oContext, sGroupId).catch(function(oError: any) {
|
|
256
|
-
Log.error("Error while requesting side effects", oError);
|
|
257
|
-
});
|
|
258
|
-
} else {
|
|
259
|
-
requestMessages(oContext, oSideEffectsService);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
234
|
+
.then(function () {
|
|
262
235
|
return oOperation;
|
|
263
236
|
})
|
|
264
|
-
.catch(function(oError: any) {
|
|
237
|
+
.catch(function (oError: any) {
|
|
265
238
|
Log.error("Error while executing the operation", oError);
|
|
266
239
|
});
|
|
267
|
-
|
|
268
|
-
return oPreparationPromise;
|
|
269
240
|
} else {
|
|
270
241
|
throw new Error("The preparation action cannot be executed on an active document");
|
|
271
242
|
}
|
|
@@ -314,13 +285,98 @@ function requestMessages(oContext: any, oSideEffectsService: SideEffectsService)
|
|
|
314
285
|
function executeDraftDiscardAction(oContext: any): Promise<boolean> {
|
|
315
286
|
if (!oContext.getProperty("IsActiveEntity")) {
|
|
316
287
|
const oDiscardOperation = createOperation(oContext, draftOperations.DISCARD);
|
|
317
|
-
const
|
|
318
|
-
|
|
288
|
+
const localI18nRef = (Core as CoreEx).getLibraryResourceBundle("sap.fe.core");
|
|
289
|
+
const sGroupId = "direct";
|
|
290
|
+
const sActionName = localI18nRef.getText("C_TRANSACTION_HELPER_DRAFT_DISCARD_BUTTON");
|
|
291
|
+
const oDiscardPromise = oDiscardOperation.execute(
|
|
292
|
+
sGroupId,
|
|
293
|
+
undefined,
|
|
294
|
+
CommonUtils.fnOnStrictHandlingFailed.bind(draft, sGroupId, sActionName, oContext.getModel())
|
|
295
|
+
);
|
|
296
|
+
oContext.getModel().submitBatch(sGroupId);
|
|
319
297
|
return oDiscardPromise;
|
|
320
298
|
} else {
|
|
321
299
|
throw new Error("The discard action cannot be executed on an active document");
|
|
322
300
|
}
|
|
323
301
|
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* This methods creates a sibling context for a sub-object page, and calculates a sibling path for
|
|
305
|
+
* all intermediates paths between the OP and the sub-OP.
|
|
306
|
+
*
|
|
307
|
+
* @param {object} rootCurrentContext The context for the root of the draft
|
|
308
|
+
* @param {object} rightmostCurrentContext The context of the sub-object
|
|
309
|
+
* @returns {Promise} returns the siblingInformation object
|
|
310
|
+
*/
|
|
311
|
+
async function computeSiblingInformation(
|
|
312
|
+
rootCurrentContext: Context,
|
|
313
|
+
rightmostCurrentContext: Context
|
|
314
|
+
): Promise<SiblingInformation | undefined> {
|
|
315
|
+
if (!rightmostCurrentContext.getPath().startsWith(rootCurrentContext.getPath())) {
|
|
316
|
+
// Wrong usage !!
|
|
317
|
+
Log.error("Cannot compute rightmost sibling context");
|
|
318
|
+
throw new Error("Cannot compute rightmost sibling context");
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
const model = rootCurrentContext.getModel();
|
|
322
|
+
try {
|
|
323
|
+
// //////////////////////////////////////////////////////////////////
|
|
324
|
+
// 1. Find all segments between the root object and the sub-object
|
|
325
|
+
// Example: for root = /Param(aa)/Entity(bb) and rightMost = /Param(aa)/Entity(bb)/_Nav(cc)/_SubNav(dd)
|
|
326
|
+
// ---> ["Param(aa)/Entity(bb)", "_Nav(cc)", "_SubNav(dd)"]
|
|
327
|
+
|
|
328
|
+
// Find all segments in the rightmost path
|
|
329
|
+
const additionalPath = rightmostCurrentContext.getPath().replace(rootCurrentContext.getPath(), "");
|
|
330
|
+
const segments = additionalPath ? additionalPath.substring(1).split("/") : [];
|
|
331
|
+
// First segment is always the full path of the root object, which can contain '/' in case of a parametrized entity
|
|
332
|
+
segments.unshift(rootCurrentContext.getPath().substring(1));
|
|
333
|
+
|
|
334
|
+
// //////////////////////////////////////////////////////////////////
|
|
335
|
+
// 2. Request canonical paths of the sibling entity for eah segment
|
|
336
|
+
// Example: for ["Param(aa)/Entity(bb)", "_Nav(cc)", "_SubNav(dd)"]
|
|
337
|
+
// --> request canonical paths for "Param(aa)/Entity(bb)/SiblingEntity", "Param(aa)/Entity(bb)/_Nav(cc)/SiblingEntity", "Param(aa)/Entity(bb)/_Nav(cc)/_SubNav(dd)/SiblingEntity"
|
|
338
|
+
const oldPaths: string[] = [];
|
|
339
|
+
const newPaths: string[] = [];
|
|
340
|
+
let currentPath = "";
|
|
341
|
+
const canonicalPathPromises = segments.map((segment) => {
|
|
342
|
+
currentPath += `/${segment}`;
|
|
343
|
+
oldPaths.unshift(currentPath);
|
|
344
|
+
const siblingContext = model.bindContext(currentPath + "/SiblingEntity").getBoundContext() as Context;
|
|
345
|
+
return siblingContext.requestCanonicalPath();
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
// //////////////////////////////////////////////////////////////////
|
|
349
|
+
// 3. Reconstruct the full paths from canonical paths (for path mapping)
|
|
350
|
+
// Example: for canonical paths "/Param(aa)/Entity(bb-sibling)", "/Entity2(cc-sibling)", "/Entity3(dd-sibling)"
|
|
351
|
+
// --> ["Param(aa)/Entity(bb-sibling)", "Param(aa)/Entity(bb-sibling)/_Nav(cc-sibling)", "Param(aa)/Entity(bb-sibling)/_Nav(cc-sibling)/_SubNav(dd-sibling)"]
|
|
352
|
+
const canonicalPaths = (await Promise.all(canonicalPathPromises)) as string[];
|
|
353
|
+
let siblingPath = "";
|
|
354
|
+
canonicalPaths.forEach((canonicalPath, index) => {
|
|
355
|
+
if (index !== 0) {
|
|
356
|
+
const navigation = segments[index].replace(/\(.*$/, ""); // Keep only navigation name from the segment, i.e. aaa(xxx) --> aaa
|
|
357
|
+
const keys = canonicalPath.replace(/.*\(/, "("); // Keep only the keys fmro the canonical path, i.e. aaa(xxx) --> (xxx)
|
|
358
|
+
siblingPath += `/${navigation}${keys}`;
|
|
359
|
+
} else {
|
|
360
|
+
siblingPath = canonicalPath; // To manage parametrized entities
|
|
361
|
+
}
|
|
362
|
+
newPaths.unshift(siblingPath);
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
return {
|
|
366
|
+
targetContext: model.bindContext(siblingPath).getBoundContext() as Context, // Create the rightmost sibling context from its path
|
|
367
|
+
pathMapping: oldPaths.map((oldPath, index) => {
|
|
368
|
+
return {
|
|
369
|
+
oldPath,
|
|
370
|
+
newPath: newPaths[index]
|
|
371
|
+
};
|
|
372
|
+
})
|
|
373
|
+
};
|
|
374
|
+
} catch (error) {
|
|
375
|
+
// A canonical path couldn't be resolved (because a sibling doesn't exist)
|
|
376
|
+
return undefined;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
324
380
|
/**
|
|
325
381
|
* Creates a draft document from an existing document.
|
|
326
382
|
*
|
|
@@ -331,11 +387,10 @@ function executeDraftDiscardAction(oContext: any): Promise<boolean> {
|
|
|
331
387
|
* @memberof sap.fe.core.actions.draft
|
|
332
388
|
* @static
|
|
333
389
|
* @param {sap.ui.model.odata.v4.Context} oContext Context of the active document for the new draft
|
|
334
|
-
* @param {
|
|
390
|
+
* @param {AppComponent} oAppComponent The AppComponent
|
|
335
391
|
* @param {object} mParameters The parameters
|
|
336
392
|
* @param {boolean} [mParameters.oView] The view
|
|
337
393
|
* @param {boolean} [mParameters.bPreserveChanges] Preserve changes of an existing draft of another user
|
|
338
|
-
* @param {boolean} [mParameters.bPrepareOnEdit] Also call prepare when calling draft creation
|
|
339
394
|
* @param {sap.fe.core.actions.draft.ICallback.beforeCreateDraftFromActiveDocument} [mParameters.fnBeforeCreateDraftFromActiveDocument] Callback that allows veto before create request is executed
|
|
340
395
|
* @param {sap.fe.core.actions.draft.ICallback.afterCreateDraftFromActiveDocument} [mParameters.fnAfterCreateDraftFromActiveDocument] Callback for postprocessiong after draft document was created
|
|
341
396
|
* @param {sap.fe.core.actions.draft.ICallback.whenDecisionToOverwriteDocumentIsRequired} [mParameters.fnWhenDecisionToOverwriteDocumentIsRequired] Callback for deciding on overwriting an unsaved change by another user
|
|
@@ -343,20 +398,19 @@ function executeDraftDiscardAction(oContext: any): Promise<boolean> {
|
|
|
343
398
|
* @private
|
|
344
399
|
* @ui5-restricted
|
|
345
400
|
*/
|
|
346
|
-
function createDraftFromActiveDocument(
|
|
401
|
+
async function createDraftFromActiveDocument(
|
|
347
402
|
oContext: any,
|
|
348
|
-
oAppComponent:
|
|
403
|
+
oAppComponent: AppComponent,
|
|
349
404
|
mParameters: {
|
|
350
405
|
oView: View;
|
|
351
406
|
bPreserveChanges?: boolean | undefined;
|
|
352
|
-
bPrepareOnEdit?: boolean | undefined;
|
|
353
407
|
fnBeforeCreateDraftFromActiveDocument?: any;
|
|
354
408
|
fnAfterCreateDraftFromActiveDocument?: any;
|
|
355
409
|
fnWhenDecisionToOverwriteDocumentIsRequired?: any;
|
|
356
410
|
}
|
|
357
411
|
) {
|
|
358
412
|
const mParam = mParameters || {},
|
|
359
|
-
localI18nRef =
|
|
413
|
+
localI18nRef = (Core as CoreEx).getLibraryResourceBundle("sap.fe.core"),
|
|
360
414
|
bRunPreserveChangesFlow =
|
|
361
415
|
typeof mParam.bPreserveChanges === "undefined" || (typeof mParam.bPreserveChanges === "boolean" && mParam.bPreserveChanges); //default true
|
|
362
416
|
|
|
@@ -374,11 +428,11 @@ function createDraftFromActiveDocument(
|
|
|
374
428
|
let oResourceBundle: ResourceBundle;
|
|
375
429
|
|
|
376
430
|
return ((mParameters.oView.getModel("sap.fe.i18n") as ResourceModel).getResourceBundle() as Promise<ResourceBundle>)
|
|
377
|
-
.then(function(_oResourceBundle: any) {
|
|
431
|
+
.then(function (_oResourceBundle: any) {
|
|
378
432
|
oResourceBundle = _oResourceBundle;
|
|
379
433
|
return draftDataContext.requestObject();
|
|
380
434
|
})
|
|
381
|
-
.then(function(draftAdminData: any) {
|
|
435
|
+
.then(function (draftAdminData: any) {
|
|
382
436
|
if (draftAdminData) {
|
|
383
437
|
// remove all unbound transition messages as we show a special dialog
|
|
384
438
|
messageHandling.removeUnboundTransitionMessages();
|
|
@@ -401,7 +455,7 @@ function createDraftFromActiveDocument(
|
|
|
401
455
|
sInfo,
|
|
402
456
|
sEntitySet
|
|
403
457
|
);
|
|
404
|
-
return showMessageBox(sUnsavedChangesMsg).then(function() {
|
|
458
|
+
return showMessageBox(sUnsavedChangesMsg).then(function () {
|
|
405
459
|
return executeDraftEditAction(oContext, false);
|
|
406
460
|
});
|
|
407
461
|
}
|
|
@@ -412,7 +466,7 @@ function createDraftFromActiveDocument(
|
|
|
412
466
|
}
|
|
413
467
|
|
|
414
468
|
function showMessageBox(sUnsavedChangesMsg: any) {
|
|
415
|
-
return new Promise(function(resolve: (value: any) => void, reject: (reason?: any) => void) {
|
|
469
|
+
return new Promise(function (resolve: (value: any) => void, reject: (reason?: any) => void) {
|
|
416
470
|
const oDialog = new Dialog({
|
|
417
471
|
title: localI18nRef.getText("C_DRAFT_OBJECT_PAGE_WARNING"),
|
|
418
472
|
state: "Warning",
|
|
@@ -422,19 +476,19 @@ function createDraftFromActiveDocument(
|
|
|
422
476
|
beginButton: new Button({
|
|
423
477
|
text: localI18nRef.getText("C_COMMON_OBJECT_PAGE_EDIT"),
|
|
424
478
|
type: "Emphasized",
|
|
425
|
-
press: function() {
|
|
479
|
+
press: function () {
|
|
426
480
|
oDialog.close();
|
|
427
481
|
resolve(true);
|
|
428
482
|
}
|
|
429
483
|
}),
|
|
430
484
|
endButton: new Button({
|
|
431
485
|
text: localI18nRef.getText("C_COMMON_OBJECT_PAGE_CANCEL"),
|
|
432
|
-
press: function() {
|
|
486
|
+
press: function () {
|
|
433
487
|
oDialog.close();
|
|
434
488
|
reject("Draft creation aborted for document: " + oContext.getPath());
|
|
435
489
|
}
|
|
436
490
|
}),
|
|
437
|
-
afterClose: function() {
|
|
491
|
+
afterClose: function () {
|
|
438
492
|
oDialog.destroy();
|
|
439
493
|
}
|
|
440
494
|
});
|
|
@@ -447,44 +501,62 @@ function createDraftFromActiveDocument(
|
|
|
447
501
|
return Promise.reject(new Error("Binding context to active document is required"));
|
|
448
502
|
}
|
|
449
503
|
|
|
450
|
-
|
|
451
|
-
mParam.fnBeforeCreateDraftFromActiveDocument
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
)
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
504
|
+
const bExecute = mParam.fnBeforeCreateDraftFromActiveDocument
|
|
505
|
+
? mParam.fnBeforeCreateDraftFromActiveDocument(oContext, bRunPreserveChangesFlow)
|
|
506
|
+
: true;
|
|
507
|
+
|
|
508
|
+
if (!bExecute) {
|
|
509
|
+
throw new Error("Draft creation was aborted by extension for document: " + oContext.getPath());
|
|
510
|
+
}
|
|
511
|
+
let openingSiblingContext = false;
|
|
512
|
+
try {
|
|
513
|
+
let oDraftContext: Context | null = null;
|
|
514
|
+
try {
|
|
515
|
+
oDraftContext = await draft.executeDraftEditAction(oContext, bRunPreserveChangesFlow);
|
|
516
|
+
} catch (oResponse: any) {
|
|
517
|
+
//Only call back if error 409
|
|
518
|
+
if (bRunPreserveChangesFlow && oResponse.status === 409) {
|
|
519
|
+
if (ActivitySync.isCollaborationEnabled(mParameters.oView)) {
|
|
520
|
+
messageHandling.removeUnboundTransitionMessages();
|
|
521
|
+
const siblingInfo = await draft.computeSiblingInformation(oContext, oContext);
|
|
522
|
+
const siblingContext = (mParameters.oView.getController() as any)._routing._createBindingContext(
|
|
523
|
+
siblingInfo?.targetContext.getPath(),
|
|
524
|
+
oContext.getModel()
|
|
525
|
+
);
|
|
526
|
+
openingSiblingContext = true;
|
|
527
|
+
return siblingContext;
|
|
465
528
|
} else {
|
|
466
|
-
|
|
529
|
+
oDraftContext = await overwriteOnDemand(
|
|
530
|
+
mParam.fnWhenDecisionToOverwriteDocumentIsRequired ? mParam.fnWhenDecisionToOverwriteDocumentIsRequired() : true
|
|
531
|
+
);
|
|
467
532
|
}
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
.then(function(oDraftContext: any) {
|
|
471
|
-
return Promise.resolve(
|
|
472
|
-
mParam.fnAfterCreateDraftFromActiveDocument
|
|
473
|
-
? mParam.fnAfterCreateDraftFromActiveDocument(oContext, oDraftContext)
|
|
474
|
-
: oDraftContext
|
|
475
|
-
);
|
|
476
|
-
})
|
|
477
|
-
.then(function(oDraftContext: any) {
|
|
478
|
-
if (mParam.bPrepareOnEdit && hasPrepareAction(oDraftContext)) {
|
|
479
|
-
return executeDraftPreparationAction(oDraftContext, oAppComponent, { bPrepareForEdit: true }).then(function() {
|
|
480
|
-
return oDraftContext;
|
|
481
|
-
});
|
|
533
|
+
} else {
|
|
534
|
+
throw new Error(oResponse);
|
|
482
535
|
}
|
|
536
|
+
}
|
|
537
|
+
if (openingSiblingContext) {
|
|
483
538
|
return oDraftContext;
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
oDraftContext =
|
|
542
|
+
oDraftContext && mParam.fnAfterCreateDraftFromActiveDocument
|
|
543
|
+
? mParam.fnAfterCreateDraftFromActiveDocument(oContext, oDraftContext)
|
|
544
|
+
: oDraftContext;
|
|
545
|
+
|
|
546
|
+
if (oDraftContext) {
|
|
547
|
+
const sEditActionName = getActionName(oDraftContext, draftOperations.EDIT);
|
|
548
|
+
const oSideEffects = oAppComponent.getSideEffectsService().getODataActionSideEffects(sEditActionName, oDraftContext);
|
|
549
|
+
if (oSideEffects?.triggerActions?.length) {
|
|
550
|
+
await oAppComponent.getSideEffectsService().requestSideEffectsForODataAction(oSideEffects, oDraftContext);
|
|
551
|
+
|
|
552
|
+
return oDraftContext;
|
|
553
|
+
} else {
|
|
554
|
+
return oDraftContext;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
} catch (exc: any) {
|
|
558
|
+
return Promise.reject(exc);
|
|
559
|
+
}
|
|
488
560
|
}
|
|
489
561
|
/**
|
|
490
562
|
* Creates an active document from a draft document.
|
|
@@ -506,7 +578,7 @@ function createDraftFromActiveDocument(
|
|
|
506
578
|
*/
|
|
507
579
|
function activateDocument(
|
|
508
580
|
oContext: any,
|
|
509
|
-
oAppComponent:
|
|
581
|
+
oAppComponent: AppComponent,
|
|
510
582
|
mParameters: { fnBeforeActivateDocument?: any; fnAfterActivateDocument?: any }
|
|
511
583
|
) {
|
|
512
584
|
const mParam = mParameters || {};
|
|
@@ -515,7 +587,7 @@ function activateDocument(
|
|
|
515
587
|
return Promise.reject(new Error("Binding context to draft document is required"));
|
|
516
588
|
}
|
|
517
589
|
return Promise.resolve(mParam.fnBeforeActivateDocument ? mParam.fnBeforeActivateDocument(oContext) : true)
|
|
518
|
-
.then(function(bExecute: any) {
|
|
590
|
+
.then(function (bExecute: any) {
|
|
519
591
|
if (!bExecute) {
|
|
520
592
|
return Promise.reject(new Error("Activation of the document was aborted by extension for document: " + oContext.getPath()));
|
|
521
593
|
}
|
|
@@ -527,28 +599,25 @@ function activateDocument(
|
|
|
527
599
|
/* activation requires preparation */
|
|
528
600
|
const sBatchGroup = "draft";
|
|
529
601
|
// we use the same batchGroup to force prepare and activate in a same batch but with different changeset
|
|
530
|
-
const oPreparePromise = executeDraftPreparationAction(oContext,
|
|
531
|
-
groupId: sBatchGroup,
|
|
532
|
-
bPrepareForEdit: false
|
|
533
|
-
});
|
|
602
|
+
const oPreparePromise = executeDraftPreparationAction(oContext, sBatchGroup);
|
|
534
603
|
oContext.getModel().submitBatch(sBatchGroup);
|
|
535
604
|
|
|
536
605
|
const oActivatePromise = executeDraftActivationAction(oContext, oAppComponent, sBatchGroup);
|
|
537
606
|
|
|
538
607
|
return Promise.all([oPreparePromise, oActivatePromise])
|
|
539
|
-
.then(function(values: [any, any]) {
|
|
608
|
+
.then(function (values: [any, any]) {
|
|
540
609
|
return values[1];
|
|
541
610
|
})
|
|
542
|
-
.catch(function(exc: any) {
|
|
611
|
+
.catch(function (exc: any) {
|
|
543
612
|
return Promise.reject(exc);
|
|
544
613
|
});
|
|
545
614
|
})
|
|
546
|
-
.then(function(oActiveDocumentContext: any) {
|
|
615
|
+
.then(function (oActiveDocumentContext: any) {
|
|
547
616
|
return Promise.resolve(
|
|
548
617
|
mParam.fnAfterActivateDocument ? mParam.fnAfterActivateDocument(oContext, oActiveDocumentContext) : oActiveDocumentContext
|
|
549
618
|
);
|
|
550
619
|
})
|
|
551
|
-
.catch(function(exc: any) {
|
|
620
|
+
.catch(function (exc: any) {
|
|
552
621
|
return Promise.reject(exc);
|
|
553
622
|
});
|
|
554
623
|
}
|
|
@@ -575,10 +644,10 @@ function deleteDraft(oContext: any): Promise<boolean> {
|
|
|
575
644
|
return oContext
|
|
576
645
|
.getBinding()
|
|
577
646
|
.resetChanges()
|
|
578
|
-
.then(function() {
|
|
647
|
+
.then(function () {
|
|
579
648
|
return oContext.delete();
|
|
580
649
|
})
|
|
581
|
-
.catch(function(error: any) {
|
|
650
|
+
.catch(function (error: any) {
|
|
582
651
|
return Promise.reject(error);
|
|
583
652
|
});
|
|
584
653
|
} else {
|
|
@@ -589,5 +658,12 @@ function deleteDraft(oContext: any): Promise<boolean> {
|
|
|
589
658
|
return executeDraftDiscardAction(oContext);
|
|
590
659
|
}
|
|
591
660
|
}
|
|
661
|
+
const draft = {
|
|
662
|
+
createDraftFromActiveDocument: createDraftFromActiveDocument,
|
|
663
|
+
activateDocument: activateDocument,
|
|
664
|
+
deleteDraft: deleteDraft,
|
|
665
|
+
executeDraftEditAction: executeDraftEditAction,
|
|
666
|
+
computeSiblingInformation: computeSiblingInformation
|
|
667
|
+
};
|
|
592
668
|
|
|
593
669
|
export default draft;
|