@sapui5/sap.fe.core 1.100.0 → 1.101.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/package.json +4 -4
- package/src/sap/fe/core/.library +2 -3
- package/src/sap/fe/core/AnnotationHelper.js +43 -24
- package/src/sap/fe/core/AnnotationHelper.ts +43 -37
- package/src/sap/fe/core/AppComponent.js +20 -27
- package/src/sap/fe/core/AppComponent.ts +19 -25
- package/src/sap/fe/core/AppStateHandler.js +5 -5
- package/src/sap/fe/core/AppStateHandler.ts +2 -2
- package/src/sap/fe/core/BaseController.js +9 -9
- package/src/sap/fe/core/BaseController.ts +3 -4
- package/src/sap/fe/core/CommonUtils.js +74 -17
- package/src/sap/fe/core/CommonUtils.ts +181 -110
- package/src/sap/fe/core/ExtensionAPI.js +11 -10
- package/src/sap/fe/core/ExtensionAPI.ts +22 -30
- package/src/sap/fe/core/PageController.js +12 -11
- package/src/sap/fe/core/PageController.ts +34 -34
- package/src/sap/fe/core/RouterProxy.js +36 -24
- package/src/sap/fe/core/RouterProxy.ts +36 -22
- package/src/sap/fe/core/TemplateComponent.js +193 -118
- package/src/sap/fe/core/TemplateComponent.ts +105 -117
- package/src/sap/fe/core/TemplateModel.js +6 -8
- package/src/sap/fe/core/TemplateModel.ts +2 -2
- package/src/sap/fe/core/TransactionHelper.js +33 -18
- package/src/sap/fe/core/TransactionHelper.ts +172 -153
- package/src/sap/fe/core/actions/collaboration/ActivitySync.js +31 -17
- package/src/sap/fe/core/actions/collaboration/ActivitySync.ts +52 -45
- package/src/sap/fe/core/actions/collaboration/CollaborationCommon.js +16 -6
- package/src/sap/fe/core/actions/collaboration/CollaborationCommon.ts +13 -3
- package/src/sap/fe/core/actions/collaboration/Manage.js +9 -7
- package/src/sap/fe/core/actions/collaboration/Manage.ts +33 -31
- package/src/sap/fe/core/actions/collaboration/ManageDialog.fragment.xml +53 -56
- package/src/sap/fe/core/actions/draft.js +308 -166
- package/src/sap/fe/core/actions/draft.ts +177 -74
- package/src/sap/fe/core/actions/messageHandling.js +25 -13
- package/src/sap/fe/core/actions/messageHandling.ts +49 -39
- package/src/sap/fe/core/actions/operations.js +4 -4
- package/src/sap/fe/core/actions/operations.ts +3 -2
- 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 +506 -245
- package/src/sap/fe/core/controllerextensions/EditFlow.ts +395 -275
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +11 -11
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.ts +6 -7
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +15 -17
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.ts +98 -96
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +15 -15
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.ts +60 -53
- package/src/sap/fe/core/controllerextensions/InternalRouting.js +94 -42
- package/src/sap/fe/core/controllerextensions/InternalRouting.ts +114 -91
- package/src/sap/fe/core/controllerextensions/KPIManagement.js +14 -14
- package/src/sap/fe/core/controllerextensions/KPIManagement.ts +12 -11
- package/src/sap/fe/core/controllerextensions/MassEdit.js +12 -12
- package/src/sap/fe/core/controllerextensions/MassEdit.ts +8 -9
- package/src/sap/fe/core/controllerextensions/MessageHandler.js +13 -25
- package/src/sap/fe/core/controllerextensions/MessageHandler.ts +18 -28
- package/src/sap/fe/core/controllerextensions/PageReady.js +25 -23
- package/src/sap/fe/core/controllerextensions/PageReady.ts +49 -47
- package/src/sap/fe/core/controllerextensions/Paginator.js +13 -13
- package/src/sap/fe/core/controllerextensions/Paginator.ts +24 -18
- package/src/sap/fe/core/controllerextensions/Placeholder.js +10 -10
- package/src/sap/fe/core/controllerextensions/Placeholder.ts +12 -14
- package/src/sap/fe/core/controllerextensions/Routing.js +11 -11
- package/src/sap/fe/core/controllerextensions/Routing.ts +12 -13
- package/src/sap/fe/core/controllerextensions/Share.js +16 -16
- package/src/sap/fe/core/controllerextensions/Share.ts +32 -32
- package/src/sap/fe/core/controllerextensions/SideEffects.js +14 -14
- package/src/sap/fe/core/controllerextensions/SideEffects.ts +62 -63
- package/src/sap/fe/core/controllerextensions/ViewState.js +17 -31
- package/src/sap/fe/core/controllerextensions/ViewState.ts +93 -102
- 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 +38 -15
- package/src/sap/fe/core/controls/CommandExecution.ts +20 -20
- package/src/sap/fe/core/controls/ConditionalWrapper.js +136 -65
- package/src/sap/fe/core/controls/ConditionalWrapper.ts +49 -58
- 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 +73 -36
- package/src/sap/fe/core/controls/CustomQuickViewPage.ts +22 -32
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossDraft.fragment.xml +44 -5
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +116 -66
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.ts +121 -67
- package/src/sap/fe/core/controls/FieldWrapper.js +171 -87
- package/src/sap/fe/core/controls/FieldWrapper.ts +69 -80
- 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 +154 -119
- package/src/sap/fe/core/controls/FilterBar.ts +128 -123
- package/src/sap/fe/core/controls/FormElementWrapper.js +92 -37
- package/src/sap/fe/core/controls/FormElementWrapper.ts +32 -35
- package/src/sap/fe/core/controls/filterbar/FilterContainer.js +111 -89
- package/src/sap/fe/core/controls/filterbar/FilterContainer.ts +86 -82
- package/src/sap/fe/core/controls/filterbar/VisualFilter.js +242 -193
- package/src/sap/fe/core/controls/filterbar/VisualFilter.ts +211 -204
- package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +152 -116
- package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.ts +105 -105
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +1 -1
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.ts +2 -2
- package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +37 -42
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +7 -6
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.ts +15 -14
- package/src/sap/fe/core/converters/ManifestSettings.js +2 -1
- package/src/sap/fe/core/converters/ManifestSettings.ts +5 -1
- package/src/sap/fe/core/converters/annotations/DataField.js +1 -2
- package/src/sap/fe/core/converters/annotations/DataField.ts +3 -4
- 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 +5 -5
- package/src/sap/fe/core/converters/controls/Common/Form.ts +3 -1
- package/src/sap/fe/core/converters/controls/Common/KPI.js +1 -1
- package/src/sap/fe/core/converters/controls/Common/KPI.ts +2 -3
- package/src/sap/fe/core/converters/controls/Common/Table.js +245 -112
- package/src/sap/fe/core/converters/controls/Common/Table.ts +305 -193
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +5 -5
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +4 -7
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +72 -43
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +134 -100
- 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/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 +27 -24
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +49 -40
- package/src/sap/fe/core/converters/templates/ListReportConverter.js +33 -22
- package/src/sap/fe/core/converters/templates/ListReportConverter.ts +77 -62
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +5 -5
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +3 -7
- 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 +2 -2
- package/src/sap/fe/core/formatters/TableFormatter.ts +1 -1
- 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 +46 -17
- package/src/sap/fe/core/fpm/Component.ts +11 -16
- package/src/sap/fe/core/helpers/AppStartupHelper.js +4 -4
- package/src/sap/fe/core/helpers/AppStartupHelper.ts +3 -3
- package/src/sap/fe/core/helpers/ClassSupport.js +273 -256
- package/src/sap/fe/core/helpers/ClassSupport.ts +314 -237
- package/src/sap/fe/core/helpers/MassEditHelper.js +173 -39
- package/src/sap/fe/core/helpers/MassEditHelper.ts +236 -132
- package/src/sap/fe/core/helpers/ModelHelper.js +29 -1
- package/src/sap/fe/core/helpers/ModelHelper.ts +23 -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 +3 -3
- package/src/sap/fe/core/helpers/SemanticDateOperators.ts +3 -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 +4 -5
- package/src/sap/fe/core/library.ts +17 -17
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +1 -1
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +0 -3
- package/src/sap/fe/core/messagebundle.properties +23 -8
- package/src/sap/fe/core/messagebundle_ar.properties +2 -0
- package/src/sap/fe/core/messagebundle_bg.properties +2 -0
- package/src/sap/fe/core/messagebundle_ca.properties +2 -0
- package/src/sap/fe/core/messagebundle_cs.properties +2 -0
- package/src/sap/fe/core/messagebundle_cy.properties +5 -3
- package/src/sap/fe/core/messagebundle_da.properties +2 -0
- package/src/sap/fe/core/messagebundle_de.properties +2 -0
- package/src/sap/fe/core/messagebundle_el.properties +2 -0
- package/src/sap/fe/core/messagebundle_en.properties +2 -0
- package/src/sap/fe/core/messagebundle_en_GB.properties +2 -0
- package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +2 -0
- package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +2 -0
- package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +2 -0
- package/src/sap/fe/core/messagebundle_es.properties +2 -0
- package/src/sap/fe/core/messagebundle_es_MX.properties +2 -0
- package/src/sap/fe/core/messagebundle_et.properties +2 -0
- package/src/sap/fe/core/messagebundle_fi.properties +2 -0
- package/src/sap/fe/core/messagebundle_fr.properties +4 -2
- package/src/sap/fe/core/messagebundle_fr_CA.properties +5 -3
- package/src/sap/fe/core/messagebundle_hi.properties +2 -0
- package/src/sap/fe/core/messagebundle_hr.properties +5 -3
- package/src/sap/fe/core/messagebundle_hu.properties +2 -0
- package/src/sap/fe/core/messagebundle_id.properties +2 -0
- package/src/sap/fe/core/messagebundle_it.properties +2 -0
- package/src/sap/fe/core/messagebundle_iw.properties +2 -0
- package/src/sap/fe/core/messagebundle_ja.properties +2 -0
- package/src/sap/fe/core/messagebundle_kk.properties +2 -0
- package/src/sap/fe/core/messagebundle_ko.properties +2 -0
- package/src/sap/fe/core/messagebundle_lt.properties +2 -0
- package/src/sap/fe/core/messagebundle_lv.properties +5 -3
- package/src/sap/fe/core/messagebundle_ms.properties +2 -0
- package/src/sap/fe/core/messagebundle_nl.properties +2 -0
- package/src/sap/fe/core/messagebundle_no.properties +2 -0
- package/src/sap/fe/core/messagebundle_pl.properties +5 -3
- package/src/sap/fe/core/messagebundle_pt.properties +2 -0
- package/src/sap/fe/core/messagebundle_pt_PT.properties +2 -0
- package/src/sap/fe/core/messagebundle_ro.properties +5 -3
- package/src/sap/fe/core/messagebundle_ru.properties +5 -3
- package/src/sap/fe/core/messagebundle_sh.properties +2 -0
- package/src/sap/fe/core/messagebundle_sk.properties +2 -0
- package/src/sap/fe/core/messagebundle_sl.properties +2 -0
- package/src/sap/fe/core/messagebundle_sv.properties +3 -1
- package/src/sap/fe/core/messagebundle_th.properties +2 -0
- package/src/sap/fe/core/messagebundle_tr.properties +2 -0
- package/src/sap/fe/core/messagebundle_uk.properties +2 -0
- package/src/sap/fe/core/messagebundle_vi.properties +2 -0
- package/src/sap/fe/core/messagebundle_zh_CN.properties +5 -3
- package/src/sap/fe/core/messagebundle_zh_TW.properties +5 -3
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +4 -4
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.ts +1 -1
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +5 -5
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.ts +1 -2
- package/src/sap/fe/core/services/EnvironmentServiceFactory.js +7 -7
- package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +6 -5
- package/src/sap/fe/core/services/NavigationServiceFactory.js +4 -4
- package/src/sap/fe/core/services/NavigationServiceFactory.ts +1 -1
- package/src/sap/fe/core/services/ResourceModelServiceFactory.js +4 -4
- package/src/sap/fe/core/services/ResourceModelServiceFactory.ts +1 -1
- package/src/sap/fe/core/services/RoutingServiceFactory.js +98 -62
- package/src/sap/fe/core/services/RoutingServiceFactory.ts +51 -42
- package/src/sap/fe/core/services/ShellServicesFactory.js +69 -29
- package/src/sap/fe/core/services/ShellServicesFactory.ts +26 -29
- package/src/sap/fe/core/services/SideEffectsServiceFactory.js +4 -4
- package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +1 -1
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +8 -8
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +6 -17
- package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.js +43 -5
- package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.ts +6 -3
- package/src/sap/fe/core/support/CommonHelper.js +1 -1
- package/src/sap/fe/core/support/CommonHelper.ts +0 -3
- package/src/sap/fe/core/templating/DataModelPathHelper.js +2 -9
- package/src/sap/fe/core/templating/DataModelPathHelper.ts +32 -38
- 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/PropertyHelper.js +15 -1
- package/src/sap/fe/core/templating/PropertyHelper.ts +30 -23
- package/src/sap/fe/core/templating/UIFormatters.js +121 -21
- package/src/sap/fe/core/templating/UIFormatters.ts +134 -49
- 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 -78
- package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.ts +0 -65
|
@@ -1,17 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Button from "sap/m/Button";
|
|
3
|
-
import Text from "sap/m/Text";
|
|
4
|
-
import MessageBox from "sap/m/MessageBox";
|
|
5
|
-
import messageHandling from "sap/fe/core/actions/messageHandling";
|
|
6
|
-
import CommonUtils from "sap/fe/core/CommonUtils";
|
|
1
|
+
import ResourceBundle from "sap/base/i18n/ResourceBundle";
|
|
7
2
|
import Log from "sap/base/Log";
|
|
3
|
+
import ActivitySync from "sap/fe/core/actions/collaboration/ActivitySync";
|
|
4
|
+
import messageHandling from "sap/fe/core/actions/messageHandling";
|
|
8
5
|
import AppComponent from "sap/fe/core/AppComponent";
|
|
6
|
+
import CommonUtils from "sap/fe/core/CommonUtils";
|
|
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,11 +141,11 @@ 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 localI18nRef =
|
|
144
|
+
const localI18nRef = (Core as CoreEx).getLibraryResourceBundle("sap.fe.core");
|
|
139
145
|
const sActionName = localI18nRef.getText("C_COMMON_OBJECT_PAGE_EDIT");
|
|
140
146
|
const oEditPromise = oOperation
|
|
141
147
|
.execute(sGroupId, undefined, CommonUtils.fnOnStrictHandlingFailed.bind(draft, sGroupId, sActionName, oContext.getModel()))
|
|
142
|
-
.then(function(oDraftDocumentContext: any) {
|
|
148
|
+
.then(function (oDraftDocumentContext: any) {
|
|
143
149
|
return oDraftDocumentContext;
|
|
144
150
|
});
|
|
145
151
|
oOperation.getModel().submitBatch(sGroupId);
|
|
@@ -169,7 +175,7 @@ function executeDraftActivationAction(oContext: any, oAppComponent: AppComponent
|
|
|
169
175
|
|
|
170
176
|
if (!oContext.getProperty("IsActiveEntity")) {
|
|
171
177
|
const oOperation = createOperation(oContext, draftOperations.ACTIVATION, { $$inheritExpandSelect: true });
|
|
172
|
-
const localI18nRef =
|
|
178
|
+
const localI18nRef = (Core as CoreEx).getLibraryResourceBundle("sap.fe.core");
|
|
173
179
|
const sActionName = localI18nRef.getText("C_OP_OBJECT_PAGE_SAVE");
|
|
174
180
|
return oOperation
|
|
175
181
|
.execute(
|
|
@@ -177,23 +183,23 @@ function executeDraftActivationAction(oContext: any, oAppComponent: AppComponent
|
|
|
177
183
|
bIgnoreEtag,
|
|
178
184
|
sGroupId ? CommonUtils.fnOnStrictHandlingFailed.bind(draft, sGroupId, sActionName, oContext.getModel()) : undefined
|
|
179
185
|
) //3rd parameter<------
|
|
180
|
-
.then(function(oActiveDocumentContext: any) {
|
|
186
|
+
.then(function (oActiveDocumentContext: any) {
|
|
181
187
|
return oActiveDocumentContext;
|
|
182
188
|
})
|
|
183
189
|
.catch(
|
|
184
190
|
//if ACTIVATE action fails then we request either the sideEffects against PREPARE action (if annotated) or the messages as fallback:
|
|
185
|
-
function() {
|
|
191
|
+
function () {
|
|
186
192
|
if (bHasPrepareAction) {
|
|
187
193
|
const sActionName = getActionName(oContext, draftOperations.PREPARE),
|
|
188
194
|
oSideEffectsService = oAppComponent.getSideEffectsService(),
|
|
189
195
|
oBindingParameters = oSideEffectsService.getODataActionSideEffects(sActionName, oContext),
|
|
190
196
|
aTargetPaths = oBindingParameters && oBindingParameters.pathExpressions;
|
|
191
197
|
if (aTargetPaths && aTargetPaths.length > 0) {
|
|
192
|
-
oSideEffectsService.requestSideEffects(aTargetPaths, oContext).catch(function(oError: any) {
|
|
198
|
+
oSideEffectsService.requestSideEffects(aTargetPaths, oContext).catch(function (oError: any) {
|
|
193
199
|
Log.error("Error while requesting side effects", oError);
|
|
194
200
|
});
|
|
195
201
|
} else {
|
|
196
|
-
requestMessages(oContext, oSideEffectsService).catch(function(oError: any) {
|
|
202
|
+
requestMessages(oContext, oSideEffectsService).catch(function (oError: any) {
|
|
197
203
|
Log.error("Error while requesting messages", oError);
|
|
198
204
|
});
|
|
199
205
|
}
|
|
@@ -225,10 +231,10 @@ function executeDraftPreparationAction(oContext: Context, groupId?: string) {
|
|
|
225
231
|
const sGroupId = groupId || oOperation.getGroupId();
|
|
226
232
|
return oOperation
|
|
227
233
|
.execute(sGroupId)
|
|
228
|
-
.then(function() {
|
|
234
|
+
.then(function () {
|
|
229
235
|
return oOperation;
|
|
230
236
|
})
|
|
231
|
-
.catch(function(oError: any) {
|
|
237
|
+
.catch(function (oError: any) {
|
|
232
238
|
Log.error("Error while executing the operation", oError);
|
|
233
239
|
});
|
|
234
240
|
} else {
|
|
@@ -279,7 +285,7 @@ function requestMessages(oContext: any, oSideEffectsService: SideEffectsService)
|
|
|
279
285
|
function executeDraftDiscardAction(oContext: any): Promise<boolean> {
|
|
280
286
|
if (!oContext.getProperty("IsActiveEntity")) {
|
|
281
287
|
const oDiscardOperation = createOperation(oContext, draftOperations.DISCARD);
|
|
282
|
-
const localI18nRef =
|
|
288
|
+
const localI18nRef = (Core as CoreEx).getLibraryResourceBundle("sap.fe.core");
|
|
283
289
|
const sGroupId = "direct";
|
|
284
290
|
const sActionName = localI18nRef.getText("C_TRANSACTION_HELPER_DRAFT_DISCARD_BUTTON");
|
|
285
291
|
const oDiscardPromise = oDiscardOperation.execute(
|
|
@@ -293,6 +299,84 @@ function executeDraftDiscardAction(oContext: any): Promise<boolean> {
|
|
|
293
299
|
throw new Error("The discard action cannot be executed on an active document");
|
|
294
300
|
}
|
|
295
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
|
+
|
|
296
380
|
/**
|
|
297
381
|
* Creates a draft document from an existing document.
|
|
298
382
|
*
|
|
@@ -314,7 +398,7 @@ function executeDraftDiscardAction(oContext: any): Promise<boolean> {
|
|
|
314
398
|
* @private
|
|
315
399
|
* @ui5-restricted
|
|
316
400
|
*/
|
|
317
|
-
function createDraftFromActiveDocument(
|
|
401
|
+
async function createDraftFromActiveDocument(
|
|
318
402
|
oContext: any,
|
|
319
403
|
oAppComponent: AppComponent,
|
|
320
404
|
mParameters: {
|
|
@@ -326,7 +410,7 @@ function createDraftFromActiveDocument(
|
|
|
326
410
|
}
|
|
327
411
|
) {
|
|
328
412
|
const mParam = mParameters || {},
|
|
329
|
-
localI18nRef =
|
|
413
|
+
localI18nRef = (Core as CoreEx).getLibraryResourceBundle("sap.fe.core"),
|
|
330
414
|
bRunPreserveChangesFlow =
|
|
331
415
|
typeof mParam.bPreserveChanges === "undefined" || (typeof mParam.bPreserveChanges === "boolean" && mParam.bPreserveChanges); //default true
|
|
332
416
|
|
|
@@ -344,11 +428,11 @@ function createDraftFromActiveDocument(
|
|
|
344
428
|
let oResourceBundle: ResourceBundle;
|
|
345
429
|
|
|
346
430
|
return ((mParameters.oView.getModel("sap.fe.i18n") as ResourceModel).getResourceBundle() as Promise<ResourceBundle>)
|
|
347
|
-
.then(function(_oResourceBundle: any) {
|
|
431
|
+
.then(function (_oResourceBundle: any) {
|
|
348
432
|
oResourceBundle = _oResourceBundle;
|
|
349
433
|
return draftDataContext.requestObject();
|
|
350
434
|
})
|
|
351
|
-
.then(function(draftAdminData: any) {
|
|
435
|
+
.then(function (draftAdminData: any) {
|
|
352
436
|
if (draftAdminData) {
|
|
353
437
|
// remove all unbound transition messages as we show a special dialog
|
|
354
438
|
messageHandling.removeUnboundTransitionMessages();
|
|
@@ -371,7 +455,7 @@ function createDraftFromActiveDocument(
|
|
|
371
455
|
sInfo,
|
|
372
456
|
sEntitySet
|
|
373
457
|
);
|
|
374
|
-
return showMessageBox(sUnsavedChangesMsg).then(function() {
|
|
458
|
+
return showMessageBox(sUnsavedChangesMsg).then(function () {
|
|
375
459
|
return executeDraftEditAction(oContext, false);
|
|
376
460
|
});
|
|
377
461
|
}
|
|
@@ -382,7 +466,7 @@ function createDraftFromActiveDocument(
|
|
|
382
466
|
}
|
|
383
467
|
|
|
384
468
|
function showMessageBox(sUnsavedChangesMsg: any) {
|
|
385
|
-
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) {
|
|
386
470
|
const oDialog = new Dialog({
|
|
387
471
|
title: localI18nRef.getText("C_DRAFT_OBJECT_PAGE_WARNING"),
|
|
388
472
|
state: "Warning",
|
|
@@ -392,19 +476,19 @@ function createDraftFromActiveDocument(
|
|
|
392
476
|
beginButton: new Button({
|
|
393
477
|
text: localI18nRef.getText("C_COMMON_OBJECT_PAGE_EDIT"),
|
|
394
478
|
type: "Emphasized",
|
|
395
|
-
press: function() {
|
|
479
|
+
press: function () {
|
|
396
480
|
oDialog.close();
|
|
397
481
|
resolve(true);
|
|
398
482
|
}
|
|
399
483
|
}),
|
|
400
484
|
endButton: new Button({
|
|
401
485
|
text: localI18nRef.getText("C_COMMON_OBJECT_PAGE_CANCEL"),
|
|
402
|
-
press: function() {
|
|
486
|
+
press: function () {
|
|
403
487
|
oDialog.close();
|
|
404
488
|
reject("Draft creation aborted for document: " + oContext.getPath());
|
|
405
489
|
}
|
|
406
490
|
}),
|
|
407
|
-
afterClose: function() {
|
|
491
|
+
afterClose: function () {
|
|
408
492
|
oDialog.destroy();
|
|
409
493
|
}
|
|
410
494
|
});
|
|
@@ -417,50 +501,62 @@ function createDraftFromActiveDocument(
|
|
|
417
501
|
return Promise.reject(new Error("Binding context to active document is required"));
|
|
418
502
|
}
|
|
419
503
|
|
|
420
|
-
|
|
421
|
-
mParam.fnBeforeCreateDraftFromActiveDocument
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
)
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
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;
|
|
435
528
|
} else {
|
|
436
|
-
|
|
529
|
+
oDraftContext = await overwriteOnDemand(
|
|
530
|
+
mParam.fnWhenDecisionToOverwriteDocumentIsRequired ? mParam.fnWhenDecisionToOverwriteDocumentIsRequired() : true
|
|
531
|
+
);
|
|
437
532
|
}
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
533
|
+
} else {
|
|
534
|
+
throw new Error(oResponse);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
if (openingSiblingContext) {
|
|
538
|
+
return oDraftContext;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
oDraftContext =
|
|
542
|
+
oDraftContext && mParam.fnAfterCreateDraftFromActiveDocument
|
|
543
|
+
? mParam.fnAfterCreateDraftFromActiveDocument(oContext, oDraftContext)
|
|
544
|
+
: oDraftContext;
|
|
545
|
+
|
|
546
|
+
if (oDraftContext) {
|
|
448
547
|
const sEditActionName = getActionName(oDraftContext, draftOperations.EDIT);
|
|
449
548
|
const oSideEffects = oAppComponent.getSideEffectsService().getODataActionSideEffects(sEditActionName, oDraftContext);
|
|
450
549
|
if (oSideEffects?.triggerActions?.length) {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
.then(() => {
|
|
455
|
-
return oDraftContext;
|
|
456
|
-
});
|
|
550
|
+
await oAppComponent.getSideEffectsService().requestSideEffectsForODataAction(oSideEffects, oDraftContext);
|
|
551
|
+
|
|
552
|
+
return oDraftContext;
|
|
457
553
|
} else {
|
|
458
554
|
return oDraftContext;
|
|
459
555
|
}
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
556
|
+
}
|
|
557
|
+
} catch (exc: any) {
|
|
558
|
+
return Promise.reject(exc);
|
|
559
|
+
}
|
|
464
560
|
}
|
|
465
561
|
/**
|
|
466
562
|
* Creates an active document from a draft document.
|
|
@@ -491,7 +587,7 @@ function activateDocument(
|
|
|
491
587
|
return Promise.reject(new Error("Binding context to draft document is required"));
|
|
492
588
|
}
|
|
493
589
|
return Promise.resolve(mParam.fnBeforeActivateDocument ? mParam.fnBeforeActivateDocument(oContext) : true)
|
|
494
|
-
.then(function(bExecute: any) {
|
|
590
|
+
.then(function (bExecute: any) {
|
|
495
591
|
if (!bExecute) {
|
|
496
592
|
return Promise.reject(new Error("Activation of the document was aborted by extension for document: " + oContext.getPath()));
|
|
497
593
|
}
|
|
@@ -509,19 +605,19 @@ function activateDocument(
|
|
|
509
605
|
const oActivatePromise = executeDraftActivationAction(oContext, oAppComponent, sBatchGroup);
|
|
510
606
|
|
|
511
607
|
return Promise.all([oPreparePromise, oActivatePromise])
|
|
512
|
-
.then(function(values: [any, any]) {
|
|
608
|
+
.then(function (values: [any, any]) {
|
|
513
609
|
return values[1];
|
|
514
610
|
})
|
|
515
|
-
.catch(function(exc: any) {
|
|
611
|
+
.catch(function (exc: any) {
|
|
516
612
|
return Promise.reject(exc);
|
|
517
613
|
});
|
|
518
614
|
})
|
|
519
|
-
.then(function(oActiveDocumentContext: any) {
|
|
615
|
+
.then(function (oActiveDocumentContext: any) {
|
|
520
616
|
return Promise.resolve(
|
|
521
617
|
mParam.fnAfterActivateDocument ? mParam.fnAfterActivateDocument(oContext, oActiveDocumentContext) : oActiveDocumentContext
|
|
522
618
|
);
|
|
523
619
|
})
|
|
524
|
-
.catch(function(exc: any) {
|
|
620
|
+
.catch(function (exc: any) {
|
|
525
621
|
return Promise.reject(exc);
|
|
526
622
|
});
|
|
527
623
|
}
|
|
@@ -548,10 +644,10 @@ function deleteDraft(oContext: any): Promise<boolean> {
|
|
|
548
644
|
return oContext
|
|
549
645
|
.getBinding()
|
|
550
646
|
.resetChanges()
|
|
551
|
-
.then(function() {
|
|
647
|
+
.then(function () {
|
|
552
648
|
return oContext.delete();
|
|
553
649
|
})
|
|
554
|
-
.catch(function(error: any) {
|
|
650
|
+
.catch(function (error: any) {
|
|
555
651
|
return Promise.reject(error);
|
|
556
652
|
});
|
|
557
653
|
} else {
|
|
@@ -562,5 +658,12 @@ function deleteDraft(oContext: any): Promise<boolean> {
|
|
|
562
658
|
return executeDraftDiscardAction(oContext);
|
|
563
659
|
}
|
|
564
660
|
}
|
|
661
|
+
const draft = {
|
|
662
|
+
createDraftFromActiveDocument: createDraftFromActiveDocument,
|
|
663
|
+
activateDocument: activateDocument,
|
|
664
|
+
deleteDraft: deleteDraft,
|
|
665
|
+
executeDraftEditAction: executeDraftEditAction,
|
|
666
|
+
computeSiblingInformation: computeSiblingInformation
|
|
667
|
+
};
|
|
565
668
|
|
|
566
669
|
export default draft;
|