@sapui5/sap.fe.core 1.102.3 → 1.105.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 +6 -6
- package/src/sap/fe/core/.library +1 -1
- package/src/sap/fe/core/ActionRuntime.js +120 -0
- package/src/sap/fe/core/ActionRuntime.ts +108 -0
- package/src/sap/fe/core/AppComponent.js +81 -35
- package/src/sap/fe/core/AppComponent.ts +68 -44
- package/src/sap/fe/core/AppStateHandler.js +82 -70
- package/src/sap/fe/core/AppStateHandler.ts +32 -37
- package/src/sap/fe/core/BaseController.js +12 -10
- package/src/sap/fe/core/BaseController.ts +15 -13
- package/src/sap/fe/core/CommonUtils.js +291 -218
- package/src/sap/fe/core/CommonUtils.ts +315 -251
- package/src/sap/fe/core/ExtensionAPI.js +25 -28
- package/src/sap/fe/core/ExtensionAPI.ts +36 -38
- package/src/sap/fe/core/PageController.js +5 -5
- package/src/sap/fe/core/PageController.ts +4 -5
- package/src/sap/fe/core/TemplateComponent.js +21 -10
- package/src/sap/fe/core/TemplateComponent.ts +9 -6
- package/src/sap/fe/core/TemplateModel.js +2 -2
- package/src/sap/fe/core/TemplateModel.ts +1 -1
- package/src/sap/fe/core/buildingBlocks/AttributeModel.js +11 -3
- package/src/sap/fe/core/buildingBlocks/AttributeModel.ts +8 -2
- package/src/sap/fe/core/buildingBlocks/BuildingBlock.js +197 -43
- package/src/sap/fe/core/buildingBlocks/BuildingBlock.ts +164 -24
- package/src/sap/fe/core/buildingBlocks/BuildingBlockFormatter.js +14 -0
- package/src/sap/fe/core/buildingBlocks/BuildingBlockFormatter.ts +5 -0
- package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.js +609 -230
- package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.ts +275 -128
- package/src/sap/fe/core/buildingBlocks/TraceInfo.js +30 -30
- package/src/sap/fe/core/buildingBlocks/TraceInfo.ts +32 -29
- package/src/sap/fe/core/controllerextensions/BusyLocker.js +1 -1
- package/src/sap/fe/core/controllerextensions/EditFlow.js +761 -700
- package/src/sap/fe/core/controllerextensions/EditFlow.ts +478 -514
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +10 -10
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.ts +10 -10
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +104 -75
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.ts +71 -79
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +68 -68
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.ts +76 -76
- package/src/sap/fe/core/controllerextensions/InternalRouting.js +162 -102
- package/src/sap/fe/core/controllerextensions/InternalRouting.ts +177 -121
- package/src/sap/fe/core/controllerextensions/KPIManagement.js +67 -69
- package/src/sap/fe/core/controllerextensions/KPIManagement.ts +106 -123
- package/src/sap/fe/core/controllerextensions/MassEdit.js +10 -10
- package/src/sap/fe/core/controllerextensions/MassEdit.ts +20 -27
- package/src/sap/fe/core/controllerextensions/MessageHandler.js +21 -13
- package/src/sap/fe/core/controllerextensions/MessageHandler.ts +21 -14
- package/src/sap/fe/core/controllerextensions/PageReady.js +98 -26
- package/src/sap/fe/core/controllerextensions/PageReady.ts +98 -34
- package/src/sap/fe/core/controllerextensions/Paginator.js +31 -32
- package/src/sap/fe/core/controllerextensions/Paginator.ts +33 -34
- package/src/sap/fe/core/controllerextensions/Placeholder.js +5 -7
- package/src/sap/fe/core/controllerextensions/Placeholder.ts +12 -14
- package/src/sap/fe/core/controllerextensions/Routing.js +11 -12
- package/src/sap/fe/core/controllerextensions/Routing.ts +12 -13
- package/src/sap/fe/core/controllerextensions/RoutingListener.js +1 -1
- package/src/sap/fe/core/controllerextensions/Share.js +171 -140
- package/src/sap/fe/core/controllerextensions/Share.ts +117 -118
- package/src/sap/fe/core/controllerextensions/SideEffects.js +47 -51
- package/src/sap/fe/core/controllerextensions/SideEffects.ts +56 -60
- package/src/sap/fe/core/controllerextensions/ViewState.js +201 -132
- package/src/sap/fe/core/controllerextensions/ViewState.ts +141 -148
- package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.js +5 -5
- package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.ts +8 -7
- package/src/sap/fe/core/controllerextensions/collaboration/ActivitySync.js +13 -12
- package/src/sap/fe/core/controllerextensions/collaboration/ActivitySync.ts +17 -20
- package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon.js +13 -12
- package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon.ts +15 -15
- package/src/sap/fe/core/controllerextensions/collaboration/Manage.js +57 -18
- package/src/sap/fe/core/controllerextensions/collaboration/Manage.ts +60 -28
- package/src/sap/fe/core/controllerextensions/collaboration/ManageDialog.fragment.xml +29 -21
- package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.js +1424 -940
- package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.ts +799 -836
- package/src/sap/fe/core/controllerextensions/editFlow/draft.js +410 -377
- package/src/sap/fe/core/controllerextensions/editFlow/draft.ts +275 -358
- package/src/sap/fe/core/controllerextensions/editFlow/draftDataLossPopup.js +309 -0
- package/src/sap/fe/core/controllerextensions/editFlow/draftDataLossPopup.ts +320 -0
- package/src/sap/fe/core/controllerextensions/editFlow/operations.js +752 -579
- package/src/sap/fe/core/controllerextensions/editFlow/operations.ts +631 -599
- package/src/sap/fe/core/controllerextensions/editFlow/sticky.js +92 -74
- package/src/sap/fe/core/controllerextensions/editFlow/sticky.ts +49 -52
- package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.js +78 -41
- package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.ts +110 -84
- package/src/sap/fe/core/controllerextensions/routing/RouterProxy.js +69 -81
- package/src/sap/fe/core/controllerextensions/routing/RouterProxy.ts +64 -73
- package/src/sap/fe/core/controls/ActionParameterDialog.fragment.xml +18 -2
- package/src/sap/fe/core/controls/ActionParameterDialogFieldValueHelp.fragment.xml +35 -0
- package/src/sap/fe/core/controls/ActionParameterDialogValueHelp.fragment.xml +25 -24
- package/src/sap/fe/core/controls/Any.js +9 -5
- package/src/sap/fe/core/controls/Any.ts +10 -4
- package/src/sap/fe/core/controls/CommandExecution.js +12 -26
- package/src/sap/fe/core/controls/CommandExecution.ts +11 -25
- package/src/sap/fe/core/controls/ConditionalWrapper.js +3 -3
- package/src/sap/fe/core/controls/ConditionalWrapper.ts +3 -3
- package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.js +26 -26
- package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.ts +25 -24
- package/src/sap/fe/core/controls/CustomQuickViewPage.js +3 -3
- package/src/sap/fe/core/controls/CustomQuickViewPage.ts +2 -2
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +3 -3
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.ts +5 -5
- package/src/sap/fe/core/controls/FieldWrapper.js +3 -3
- package/src/sap/fe/core/controls/FieldWrapper.ts +3 -3
- package/src/sap/fe/core/controls/FileWrapper.js +9 -4
- package/src/sap/fe/core/controls/FileWrapper.ts +16 -12
- package/src/sap/fe/core/controls/FilterBar.js +7 -3
- package/src/sap/fe/core/controls/FilterBar.ts +13 -9
- package/src/sap/fe/core/controls/FormElementWrapper.js +2 -2
- package/src/sap/fe/core/controls/FormElementWrapper.ts +2 -2
- package/src/sap/fe/core/controls/MassEditSelect.js +1 -1
- package/src/sap/fe/core/controls/MassEditSelect.ts +0 -4
- package/src/sap/fe/core/controls/MultiValueParameterDelegate.js +1 -1
- package/src/sap/fe/core/controls/NonComputedVisibleKeyFieldsDialog.fragment.xml +44 -19
- package/src/sap/fe/core/controls/filterbar/FilterContainer.js +2 -2
- package/src/sap/fe/core/controls/filterbar/VisualFilter.js +17 -13
- package/src/sap/fe/core/controls/filterbar/VisualFilter.ts +20 -22
- package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +4 -4
- package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.ts +8 -8
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +49 -49
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.ts +54 -54
- package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +8 -2
- package/src/sap/fe/core/controls/massEdit/MassEditField.fragment.xml +22 -35
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +89 -88
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.ts +107 -106
- package/src/sap/fe/core/converters/ConverterContext.js +48 -34
- package/src/sap/fe/core/converters/ConverterContext.ts +81 -67
- package/src/sap/fe/core/converters/ManifestSettings.js +1 -1
- package/src/sap/fe/core/converters/ManifestSettings.ts +18 -15
- package/src/sap/fe/core/converters/ManifestWrapper.js +59 -45
- package/src/sap/fe/core/converters/ManifestWrapper.ts +55 -45
- package/src/sap/fe/core/converters/MetaModelConverter.js +74 -40
- package/src/sap/fe/core/converters/MetaModelConverter.ts +176 -140
- package/src/sap/fe/core/converters/TemplateConverter.js +21 -20
- package/src/sap/fe/core/converters/TemplateConverter.ts +27 -24
- package/src/sap/fe/core/converters/annotations/DataField.js +58 -35
- package/src/sap/fe/core/converters/annotations/DataField.ts +102 -76
- package/src/sap/fe/core/converters/common/AnnotationConverter.js +1956 -1494
- package/src/sap/fe/core/converters/controls/Common/Action.js +78 -51
- package/src/sap/fe/core/converters/controls/Common/Action.ts +87 -52
- package/src/sap/fe/core/converters/controls/Common/Chart.js +22 -16
- package/src/sap/fe/core/converters/controls/Common/Chart.ts +42 -43
- package/src/sap/fe/core/converters/controls/Common/Criticality.js +3 -3
- package/src/sap/fe/core/converters/controls/Common/Criticality.ts +4 -4
- package/src/sap/fe/core/converters/controls/Common/DataVisualization.js +65 -29
- package/src/sap/fe/core/converters/controls/Common/DataVisualization.ts +93 -62
- package/src/sap/fe/core/converters/controls/Common/Form.js +31 -31
- package/src/sap/fe/core/converters/controls/Common/Form.ts +46 -57
- package/src/sap/fe/core/converters/controls/Common/KPI.js +11 -11
- package/src/sap/fe/core/converters/controls/Common/KPI.ts +49 -52
- package/src/sap/fe/core/converters/controls/Common/Table.js +251 -264
- package/src/sap/fe/core/converters/controls/Common/Table.ts +344 -370
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +119 -119
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +147 -144
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +89 -59
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +118 -71
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.js +28 -26
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.ts +46 -43
- package/src/sap/fe/core/converters/controls/ObjectPage/Avatar.js +9 -9
- package/src/sap/fe/core/converters/controls/ObjectPage/Avatar.ts +14 -13
- package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.js +131 -95
- package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.ts +123 -87
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +98 -87
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +121 -117
- package/src/sap/fe/core/converters/helpers/Aggregation.js +2 -4
- package/src/sap/fe/core/converters/helpers/Aggregation.ts +12 -15
- package/src/sap/fe/core/converters/helpers/BindingHelper.js +31 -31
- package/src/sap/fe/core/converters/helpers/BindingHelper.ts +30 -29
- package/src/sap/fe/core/converters/helpers/ConfigurableObject.js +8 -6
- package/src/sap/fe/core/converters/helpers/ConfigurableObject.ts +18 -10
- package/src/sap/fe/core/converters/helpers/DataFieldHelper.js +136 -0
- package/src/sap/fe/core/converters/helpers/DataFieldHelper.ts +139 -0
- package/src/sap/fe/core/converters/helpers/ID.js +48 -46
- package/src/sap/fe/core/converters/helpers/ID.ts +26 -25
- package/src/sap/fe/core/converters/helpers/IssueManager.js +1 -1
- package/src/sap/fe/core/converters/helpers/Key.js +7 -7
- package/src/sap/fe/core/converters/helpers/Key.ts +7 -7
- package/src/sap/fe/core/converters/helpers/SelectionVariantHelper.js +1 -1
- package/src/sap/fe/core/converters/helpers/SelectionVariantHelper.ts +4 -5
- package/src/sap/fe/core/converters/objectPage/FormMenuActions.js +6 -6
- package/src/sap/fe/core/converters/objectPage/FormMenuActions.ts +10 -10
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +53 -75
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +59 -90
- package/src/sap/fe/core/converters/templates/ListReportConverter.js +58 -57
- package/src/sap/fe/core/converters/templates/ListReportConverter.ts +93 -86
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +58 -44
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +87 -80
- package/src/sap/fe/core/designtime/AppComponent.designtime.js +4 -4
- package/src/sap/fe/core/designtime/AppComponent.designtime.ts +4 -4
- package/src/sap/fe/core/formatters/CollaborationFormatter.js +2 -2
- package/src/sap/fe/core/formatters/CollaborationFormatter.ts +3 -3
- package/src/sap/fe/core/formatters/FPMFormatter.js +5 -5
- package/src/sap/fe/core/formatters/FPMFormatter.ts +10 -10
- package/src/sap/fe/core/formatters/KPIFormatter.js +7 -7
- package/src/sap/fe/core/formatters/KPIFormatter.ts +10 -10
- package/src/sap/fe/core/formatters/StandardFormatter.js +96 -0
- package/src/sap/fe/core/formatters/StandardFormatter.ts +70 -0
- package/src/sap/fe/core/formatters/TableFormatter.js +11 -11
- package/src/sap/fe/core/formatters/TableFormatter.ts +12 -12
- package/src/sap/fe/core/formatters/TableFormatterTypes.js +1 -1
- package/src/sap/fe/core/formatters/ValueFormatter.js +8 -8
- package/src/sap/fe/core/formatters/ValueFormatter.ts +9 -9
- package/src/sap/fe/core/fpm/Component.js +33 -7
- package/src/sap/fe/core/fpm/Component.ts +14 -0
- package/src/sap/fe/core/helpers/AnnotationEnum.js +1 -1
- package/src/sap/fe/core/helpers/AppStartupHelper.js +19 -18
- package/src/sap/fe/core/helpers/AppStartupHelper.ts +41 -43
- package/src/sap/fe/core/helpers/BindingToolkit.js +1836 -0
- package/src/sap/fe/core/helpers/{BindingExpression.ts → BindingToolkit.ts} +397 -270
- package/src/sap/fe/core/helpers/ClassSupport.js +49 -12
- package/src/sap/fe/core/helpers/ClassSupport.ts +37 -10
- package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.js +2 -2
- package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.ts +1 -1
- package/src/sap/fe/core/helpers/EditState.js +1 -6
- package/src/sap/fe/core/helpers/EditState.ts +5 -10
- package/src/sap/fe/core/helpers/ExcelFormatHelper.js +2 -2
- package/src/sap/fe/core/helpers/ExcelFormatHelper.ts +4 -4
- package/src/sap/fe/core/helpers/FPMHelper.js +1 -1
- package/src/sap/fe/core/helpers/FPMHelper.ts +2 -2
- package/src/sap/fe/core/helpers/KeepAliveHelper.js +31 -31
- package/src/sap/fe/core/helpers/KeepAliveHelper.ts +52 -56
- package/src/sap/fe/core/helpers/KeepAliveRefreshTypes.js +1 -1
- package/src/sap/fe/core/helpers/MassEditHelper.js +306 -280
- package/src/sap/fe/core/helpers/MassEditHelper.ts +380 -360
- package/src/sap/fe/core/helpers/MessageStrip.js +81 -0
- package/src/sap/fe/core/helpers/MessageStrip.ts +79 -0
- package/src/sap/fe/core/helpers/ModelHelper.js +25 -25
- package/src/sap/fe/core/helpers/ModelHelper.ts +34 -32
- package/src/sap/fe/core/helpers/PasteHelper.js +3 -10
- package/src/sap/fe/core/helpers/PasteHelper.ts +20 -25
- package/src/sap/fe/core/helpers/SemanticDateOperators.js +1 -1
- package/src/sap/fe/core/helpers/SemanticDateOperators.ts +11 -11
- package/src/sap/fe/core/helpers/SemanticKeyHelper.js +3 -3
- package/src/sap/fe/core/helpers/SemanticKeyHelper.ts +8 -8
- package/src/sap/fe/core/helpers/StableIdHelper.js +12 -12
- package/src/sap/fe/core/helpers/StableIdHelper.ts +12 -12
- package/src/sap/fe/core/helpers/Synchronization.js +1 -1
- package/src/sap/fe/core/helpers/ToES6Promise.js +32 -0
- package/src/sap/fe/core/helpers/ToES6Promise.ts +19 -0
- package/src/sap/fe/core/jsx-runtime/Fragment.js +16 -0
- package/src/sap/fe/core/jsx-runtime/Fragment.ts +3 -0
- package/src/sap/fe/core/jsx-runtime/ViewLoader.js +109 -0
- package/src/sap/fe/core/jsx-runtime/ViewLoader.tsx +47 -0
- package/src/sap/fe/core/jsx-runtime/jsx-control.js +110 -0
- package/src/sap/fe/core/jsx-runtime/jsx-control.ts +92 -0
- package/src/sap/fe/core/jsx-runtime/jsx-xml.js +105 -0
- package/src/sap/fe/core/jsx-runtime/jsx-xml.ts +89 -0
- package/src/sap/fe/core/jsx-runtime/jsx.js +12 -90
- package/src/sap/fe/core/jsx-runtime/jsx.ts +24 -85
- package/src/sap/fe/core/jsx-runtime/jsxs.js +1 -1
- package/src/sap/fe/core/jsx-runtime/useMDXComponents.js +179 -0
- package/src/sap/fe/core/jsx-runtime/useMDXComponents.tsx +150 -0
- package/src/sap/fe/core/library.js +42 -3
- package/src/sap/fe/core/library.support.js +1 -1
- package/src/sap/fe/core/library.ts +38 -0
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +3 -3
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +2 -2
- package/src/sap/fe/core/messagebundle.properties +39 -67
- package/src/sap/fe/core/messagebundle_ar.properties +27 -44
- package/src/sap/fe/core/messagebundle_bg.properties +27 -44
- package/src/sap/fe/core/messagebundle_ca.properties +27 -44
- package/src/sap/fe/core/messagebundle_cs.properties +27 -44
- package/src/sap/fe/core/messagebundle_cy.properties +26 -43
- package/src/sap/fe/core/messagebundle_da.properties +27 -44
- package/src/sap/fe/core/messagebundle_de.properties +25 -42
- package/src/sap/fe/core/messagebundle_el.properties +28 -45
- package/src/sap/fe/core/messagebundle_en.properties +27 -44
- package/src/sap/fe/core/messagebundle_en_GB.properties +27 -44
- package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +25 -42
- package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +26 -40
- package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +25 -42
- package/src/sap/fe/core/messagebundle_es.properties +27 -44
- package/src/sap/fe/core/messagebundle_es_MX.properties +27 -44
- package/src/sap/fe/core/messagebundle_et.properties +27 -44
- package/src/sap/fe/core/messagebundle_fi.properties +27 -44
- package/src/sap/fe/core/messagebundle_fr.properties +26 -43
- package/src/sap/fe/core/messagebundle_fr_CA.properties +25 -42
- package/src/sap/fe/core/messagebundle_hi.properties +27 -44
- package/src/sap/fe/core/messagebundle_hr.properties +27 -44
- package/src/sap/fe/core/messagebundle_hu.properties +27 -44
- package/src/sap/fe/core/messagebundle_id.properties +27 -44
- package/src/sap/fe/core/messagebundle_it.properties +43 -60
- package/src/sap/fe/core/messagebundle_iw.properties +27 -44
- package/src/sap/fe/core/messagebundle_ja.properties +27 -44
- package/src/sap/fe/core/messagebundle_kk.properties +27 -44
- package/src/sap/fe/core/messagebundle_ko.properties +30 -47
- package/src/sap/fe/core/messagebundle_lt.properties +27 -44
- package/src/sap/fe/core/messagebundle_lv.properties +27 -44
- package/src/sap/fe/core/messagebundle_ms.properties +27 -44
- package/src/sap/fe/core/messagebundle_nl.properties +29 -46
- package/src/sap/fe/core/messagebundle_no.properties +27 -44
- package/src/sap/fe/core/messagebundle_pl.properties +28 -45
- package/src/sap/fe/core/messagebundle_pt.properties +28 -45
- package/src/sap/fe/core/messagebundle_pt_PT.properties +27 -44
- package/src/sap/fe/core/messagebundle_ro.properties +27 -44
- package/src/sap/fe/core/messagebundle_ru.properties +27 -44
- package/src/sap/fe/core/messagebundle_sh.properties +27 -44
- package/src/sap/fe/core/messagebundle_sk.properties +27 -44
- package/src/sap/fe/core/messagebundle_sl.properties +27 -44
- package/src/sap/fe/core/messagebundle_sv.properties +27 -44
- package/src/sap/fe/core/messagebundle_th.properties +25 -42
- package/src/sap/fe/core/messagebundle_tr.properties +27 -44
- package/src/sap/fe/core/messagebundle_uk.properties +27 -44
- package/src/sap/fe/core/messagebundle_vi.properties +27 -44
- package/src/sap/fe/core/messagebundle_zh_CN.properties +27 -44
- package/src/sap/fe/core/messagebundle_zh_TW.properties +27 -44
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +3 -3
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.ts +5 -5
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +103 -75
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.ts +72 -73
- package/src/sap/fe/core/services/EnvironmentServiceFactory.js +2 -2
- package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +3 -2
- package/src/sap/fe/core/services/NavigationServiceFactory.js +62 -50
- package/src/sap/fe/core/services/NavigationServiceFactory.ts +63 -52
- package/src/sap/fe/core/services/ResourceModelServiceFactory.js +3 -3
- package/src/sap/fe/core/services/ResourceModelServiceFactory.ts +4 -4
- package/src/sap/fe/core/services/RoutingServiceFactory.js +56 -56
- package/src/sap/fe/core/services/RoutingServiceFactory.ts +67 -65
- package/src/sap/fe/core/services/ShellServicesFactory.js +93 -77
- package/src/sap/fe/core/services/ShellServicesFactory.ts +95 -82
- package/src/sap/fe/core/services/SideEffectsServiceFactory.js +64 -64
- package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +102 -92
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +232 -200
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +145 -142
- package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.js +2 -2
- package/src/sap/fe/core/support/AnnotationIssue.support.js +1 -1
- package/src/sap/fe/core/support/CollectionFacetMissingID.support.js +1 -1
- package/src/sap/fe/core/support/CollectionFacetUnsupportedLevel.support.js +1 -1
- package/src/sap/fe/core/support/CommonHelper.js +3 -2
- package/src/sap/fe/core/support/CommonHelper.ts +9 -13
- package/src/sap/fe/core/support/Diagnostics.js +1 -1
- package/src/sap/fe/core/support/Diagnostics.ts +5 -5
- package/src/sap/fe/core/support/InvalidAnnotationColumnKey.support.js +1 -1
- package/src/sap/fe/core/templating/CommonFormatters.js +85 -0
- package/src/sap/fe/core/templating/CommonFormatters.ts +90 -0
- package/src/sap/fe/core/templating/CriticalityFormatters.js +31 -31
- package/src/sap/fe/core/templating/CriticalityFormatters.ts +42 -40
- package/src/sap/fe/core/templating/DataFieldFormatters.js +8 -8
- package/src/sap/fe/core/templating/DataFieldFormatters.ts +13 -10
- package/src/sap/fe/core/templating/DataModelPathHelper.js +23 -15
- package/src/sap/fe/core/templating/DataModelPathHelper.ts +47 -34
- package/src/sap/fe/core/templating/DisplayModeFormatter.js +1 -1
- package/src/sap/fe/core/templating/DisplayModeFormatter.ts +2 -3
- package/src/sap/fe/core/templating/EntitySetHelper.js +7 -7
- package/src/sap/fe/core/templating/EntitySetHelper.ts +6 -8
- package/src/sap/fe/core/templating/FieldControlHelper.js +35 -34
- package/src/sap/fe/core/templating/FieldControlHelper.ts +29 -46
- package/src/sap/fe/core/templating/FilterHelper.js +18 -17
- package/src/sap/fe/core/templating/FilterHelper.ts +18 -18
- package/src/sap/fe/core/templating/FilterTemplating.js +1 -1
- package/src/sap/fe/core/templating/FilterTemplating.ts +3 -3
- package/src/sap/fe/core/templating/PropertyFormatters.js +7 -7
- package/src/sap/fe/core/templating/PropertyFormatters.ts +21 -19
- package/src/sap/fe/core/templating/PropertyHelper.js +25 -25
- package/src/sap/fe/core/templating/PropertyHelper.ts +25 -26
- package/src/sap/fe/core/templating/UIFormatters.js +152 -95
- package/src/sap/fe/core/templating/UIFormatters.ts +202 -128
- package/src/sap/fe/core/type/DateTimeWithTimezone.js +2 -2
- package/src/sap/fe/core/type/Email.js +3 -3
- package/src/sap/fe/core/type/Email.ts +2 -2
- package/src/sap/fe/core/helpers/BindingExpression.js +0 -1732
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import ResourceBundle from "sap/base/i18n/ResourceBundle";
|
|
1
|
+
import type ResourceBundle from "sap/base/i18n/ResourceBundle";
|
|
2
2
|
import Log from "sap/base/Log";
|
|
3
|
-
import
|
|
4
|
-
import AppComponent from "sap/fe/core/AppComponent";
|
|
3
|
+
import type AppComponent from "sap/fe/core/AppComponent";
|
|
5
4
|
import CommonUtils from "sap/fe/core/CommonUtils";
|
|
6
5
|
import BusyLocker from "sap/fe/core/controllerextensions/BusyLocker";
|
|
7
6
|
import draft from "sap/fe/core/controllerextensions/editFlow/draft";
|
|
@@ -9,7 +8,8 @@ import operations from "sap/fe/core/controllerextensions/editFlow/operations";
|
|
|
9
8
|
import sticky from "sap/fe/core/controllerextensions/editFlow/sticky";
|
|
10
9
|
import messageHandling from "sap/fe/core/controllerextensions/messageHandler/messageHandling";
|
|
11
10
|
import FPMHelper from "sap/fe/core/helpers/FPMHelper";
|
|
12
|
-
import
|
|
11
|
+
import type { InternalModelContext } from "sap/fe/core/helpers/ModelHelper";
|
|
12
|
+
import ModelHelper from "sap/fe/core/helpers/ModelHelper";
|
|
13
13
|
import FELibrary from "sap/fe/core/library";
|
|
14
14
|
import Button from "sap/m/Button";
|
|
15
15
|
import CheckBox from "sap/m/CheckBox";
|
|
@@ -22,13 +22,16 @@ import VBox from "sap/m/VBox";
|
|
|
22
22
|
import Core from "sap/ui/core/Core";
|
|
23
23
|
import Fragment from "sap/ui/core/Fragment";
|
|
24
24
|
import coreLibrary from "sap/ui/core/library";
|
|
25
|
-
import View from "sap/ui/core/mvc/View";
|
|
25
|
+
import type View from "sap/ui/core/mvc/View";
|
|
26
26
|
import XMLPreprocessor from "sap/ui/core/util/XMLPreprocessor";
|
|
27
27
|
import XMLTemplateProcessor from "sap/ui/core/XMLTemplateProcessor";
|
|
28
|
-
import Context from "sap/ui/model/Context";
|
|
28
|
+
import type Context from "sap/ui/model/Context";
|
|
29
29
|
import JSONModel from "sap/ui/model/json/JSONModel";
|
|
30
|
-
import
|
|
31
|
-
import
|
|
30
|
+
import type ODataV4Context from "sap/ui/model/odata/v4/Context";
|
|
31
|
+
import type ODataMetaModel from "sap/ui/model/odata/v4/ODataMetaModel";
|
|
32
|
+
import type ODataModel from "sap/ui/model/odata/v4/ODataModel";
|
|
33
|
+
import type { CoreEx, ODataListBinding, V4Context } from "types/extension_types";
|
|
34
|
+
import toES6Promise from "../../helpers/ToES6Promise";
|
|
32
35
|
|
|
33
36
|
const CreationMode = FELibrary.CreationMode;
|
|
34
37
|
const ProgrammingModel = FELibrary.ProgrammingModel;
|
|
@@ -71,7 +74,7 @@ class TransactionHelper {
|
|
|
71
74
|
return ProgrammingModel.NonDraft;
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
|
-
return this.sProgrammingModel
|
|
77
|
+
return this.sProgrammingModel;
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
/**
|
|
@@ -79,16 +82,16 @@ class TransactionHelper {
|
|
|
79
82
|
*
|
|
80
83
|
* @memberof sap.fe.core.TransactionHelper
|
|
81
84
|
* @static
|
|
82
|
-
* @param
|
|
83
|
-
* @param
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* @param
|
|
87
|
-
* @returns
|
|
85
|
+
* @param oContext Context of the document to be validated
|
|
86
|
+
* @param [mParameters] Can contain the following attributes:
|
|
87
|
+
* @param [mParameters.data] A map of data that should be validated
|
|
88
|
+
* @param [mParameters.customValidationFunction] A string representing the path to the validation function
|
|
89
|
+
* @param oView Contains the object of the current view
|
|
90
|
+
* @returns Promise resolves with result of the custom validation function
|
|
88
91
|
* @ui5-restricted
|
|
89
92
|
* @final
|
|
90
93
|
*/
|
|
91
|
-
validateDocument(oContext:
|
|
94
|
+
validateDocument(oContext: V4Context, mParameters: any, oView: View): Promise<any> {
|
|
92
95
|
const sCustomValidationFunction = mParameters && mParameters.customValidationFunction;
|
|
93
96
|
if (sCustomValidationFunction) {
|
|
94
97
|
const sModule = sCustomValidationFunction.substring(0, sCustomValidationFunction.lastIndexOf(".") || -1).replace(/\./gi, "/"),
|
|
@@ -108,31 +111,30 @@ class TransactionHelper {
|
|
|
108
111
|
*
|
|
109
112
|
* @memberof sap.fe.core.TransactionHelper
|
|
110
113
|
* @static
|
|
111
|
-
* @param
|
|
112
|
-
* @param
|
|
113
|
-
* @param
|
|
114
|
-
* @param
|
|
115
|
-
* @param
|
|
116
|
-
* @param
|
|
114
|
+
* @param oMainListBinding OData V4 ListBinding object
|
|
115
|
+
* @param [mInParameters] Optional, can contain the following attributes:
|
|
116
|
+
* @param [mInParameters.data] A map of data that should be sent within the POST
|
|
117
|
+
* @param [mInParameters.busyMode] Global (default), Local, None TODO: to be refactored
|
|
118
|
+
* @param [mInParameters.keepTransientContextOnFailed] If set, the context stays in the list if the POST failed and POST will be repeated with the next change
|
|
119
|
+
* @param [mInParameters.inactive] If set, the context is set as inactive for empty rows
|
|
117
120
|
* @param oResourceBundle
|
|
118
121
|
* @param messageHandler
|
|
119
122
|
* @param bFromCopyPaste
|
|
120
123
|
* @param oView The current view
|
|
121
|
-
* @returns
|
|
124
|
+
* @returns Promise resolves with new binding context
|
|
122
125
|
* @ui5-restricted
|
|
123
126
|
* @final
|
|
124
127
|
*/
|
|
125
|
-
createDocument(
|
|
126
|
-
oMainListBinding:
|
|
128
|
+
async createDocument(
|
|
129
|
+
oMainListBinding: ODataListBinding,
|
|
127
130
|
mInParameters: { data?: any; busyMode?: string | undefined; keepTransientContextOnFailed?: any; inactive?: boolean } | undefined,
|
|
128
131
|
oResourceBundle: any,
|
|
129
132
|
messageHandler: any,
|
|
130
133
|
bFromCopyPaste: boolean = false,
|
|
131
134
|
oView: any
|
|
132
|
-
) {
|
|
135
|
+
): Promise<ODataV4Context> {
|
|
133
136
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
134
|
-
const
|
|
135
|
-
oModel = oMainListBinding.getModel(),
|
|
137
|
+
const oModel = oMainListBinding.getModel(),
|
|
136
138
|
oMetaModel = oModel.getMetaModel(),
|
|
137
139
|
sMetaPath = oMetaModel.getMetaPath(oMainListBinding.getHeaderContext().getPath()),
|
|
138
140
|
sCreateHash = this._getAppComponent().getRouterProxy().getHash(),
|
|
@@ -141,20 +143,19 @@ class TransactionHelper {
|
|
|
141
143
|
sNewAction = !oMainListBinding.isRelative()
|
|
142
144
|
? this._getNewAction(oStartupParameters, sCreateHash, oMetaModel, sMetaPath)
|
|
143
145
|
: undefined;
|
|
144
|
-
let oCreationPromise;
|
|
145
146
|
const mBindingParameters: any = { "$$patchWithoutSideEffects": true };
|
|
146
|
-
const sMessagesPath = oMetaModel.getObject(sMetaPath
|
|
147
|
+
const sMessagesPath = oMetaModel.getObject(`${sMetaPath}/@com.sap.vocabularies.Common.v1.Messages/$Path`);
|
|
147
148
|
let sBusyPath = "/busy";
|
|
148
149
|
let sFunctionName =
|
|
149
|
-
oMetaModel.getObject(sMetaPath
|
|
150
|
+
oMetaModel.getObject(`${sMetaPath}@com.sap.vocabularies.Common.v1.DefaultValuesFunction`) ||
|
|
150
151
|
oMetaModel.getObject(
|
|
151
|
-
ModelHelper.getTargetEntitySet(oMetaModel.getContext(sMetaPath))
|
|
152
|
+
`${ModelHelper.getTargetEntitySet(oMetaModel.getContext(sMetaPath))}@com.sap.vocabularies.Common.v1.DefaultValuesFunction`
|
|
152
153
|
);
|
|
153
154
|
let bFunctionOnNavProp;
|
|
154
|
-
let oNewDocumentContext:
|
|
155
|
+
let oNewDocumentContext: ODataV4Context | undefined;
|
|
155
156
|
if (sFunctionName) {
|
|
156
157
|
if (
|
|
157
|
-
oMetaModel.getObject(sMetaPath
|
|
158
|
+
oMetaModel.getObject(`${sMetaPath}@com.sap.vocabularies.Common.v1.DefaultValuesFunction`) &&
|
|
158
159
|
ModelHelper.getTargetEntitySet(oMetaModel.getContext(sMetaPath)) !== sMetaPath
|
|
159
160
|
) {
|
|
160
161
|
bFunctionOnNavProp = true;
|
|
@@ -167,176 +168,158 @@ class TransactionHelper {
|
|
|
167
168
|
}
|
|
168
169
|
const mParameters = getParameters(mInParameters);
|
|
169
170
|
if (!oMainListBinding) {
|
|
170
|
-
|
|
171
|
+
throw new Error("Binding required for new document creation");
|
|
171
172
|
}
|
|
172
173
|
const sProgrammingModel = this.getProgrammingModel(oMainListBinding);
|
|
173
174
|
if (sProgrammingModel !== ProgrammingModel.Draft && sProgrammingModel !== ProgrammingModel.Sticky) {
|
|
174
|
-
|
|
175
|
+
throw new Error("Create document only allowed for draft or sticky session supported services");
|
|
175
176
|
}
|
|
176
177
|
if (mParameters.busyMode === "Local") {
|
|
177
178
|
// in case of local busy mode we use the list binding name
|
|
178
179
|
// there's no APY yet so we have to use the .sId TODO provide a public method?
|
|
179
|
-
sBusyPath =
|
|
180
|
+
sBusyPath = `/busyLocal/${oMainListBinding.sId}`;
|
|
180
181
|
}
|
|
181
182
|
mParameters.beforeCreateCallBack = bFromCopyPaste ? null : mParameters.beforeCreateCallBack;
|
|
182
183
|
BusyLocker.lock(this.oLockObject, sBusyPath);
|
|
183
184
|
const oResourceBundleCore = (Core as CoreEx).getLibraryResourceBundle("sap.fe.core");
|
|
184
|
-
|
|
185
|
-
oCreationPromise = this.callAction(
|
|
186
|
-
sNewAction,
|
|
187
|
-
{
|
|
188
|
-
contexts: oMainListBinding.getHeaderContext(),
|
|
189
|
-
showActionParameterDialog: true,
|
|
190
|
-
label: this._getSpecificCreateActionDialogLabel(
|
|
191
|
-
oMetaModel,
|
|
192
|
-
sMetaPath,
|
|
193
|
-
sNewAction,
|
|
194
|
-
oResourceBundleCore as ResourceBundle
|
|
195
|
-
),
|
|
196
|
-
bindingParameters: mBindingParameters,
|
|
197
|
-
parentControl: mParameters.parentControl,
|
|
198
|
-
bIsCreateAction: true
|
|
199
|
-
},
|
|
200
|
-
null,
|
|
201
|
-
messageHandler
|
|
202
|
-
);
|
|
203
|
-
} else {
|
|
204
|
-
const bIsNewPageCreation =
|
|
205
|
-
mParameters.creationMode !== CreationMode.CreationRow && mParameters.creationMode !== CreationMode.Inline;
|
|
206
|
-
const aNonComputedVisibleKeyFields = bIsNewPageCreation
|
|
207
|
-
? CommonUtils.getNonComputedVisibleFields(oMetaModel, sMetaPath, oView)
|
|
208
|
-
: [];
|
|
209
|
-
sFunctionName = bFromCopyPaste ? null : sFunctionName;
|
|
210
|
-
let sFunctionPath, oFunctionContext;
|
|
211
|
-
if (sFunctionName) {
|
|
212
|
-
//bound to the source entity:
|
|
213
|
-
if (bFunctionOnNavProp) {
|
|
214
|
-
sFunctionPath =
|
|
215
|
-
oMainListBinding.getContext() &&
|
|
216
|
-
oMetaModel.getMetaPath(oMainListBinding.getContext().getPath()) + "/" + sFunctionName;
|
|
217
|
-
oFunctionContext = oMainListBinding.getContext();
|
|
218
|
-
} else {
|
|
219
|
-
sFunctionPath =
|
|
220
|
-
oMainListBinding.getHeaderContext() &&
|
|
221
|
-
oMetaModel.getMetaPath(oMainListBinding.getHeaderContext().getPath()) + "/" + sFunctionName;
|
|
222
|
-
oFunctionContext = oMainListBinding.getHeaderContext();
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
const oFunction = sFunctionPath && oMetaModel.createBindingContext(sFunctionPath);
|
|
226
|
-
if (oFunction && oFunction.getObject() && oFunction.getObject()[0].$IsBound) {
|
|
227
|
-
oCreationPromise = operations.callBoundFunction(sFunctionName, oFunctionContext, oModel);
|
|
228
|
-
} else {
|
|
229
|
-
oCreationPromise = operations.callFunctionImport(sFunctionName, oModel);
|
|
230
|
-
}
|
|
185
|
+
let oResult: any;
|
|
231
186
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
187
|
+
try {
|
|
188
|
+
if (sNewAction) {
|
|
189
|
+
oResult = await this.callAction(
|
|
190
|
+
sNewAction,
|
|
191
|
+
{
|
|
192
|
+
contexts: oMainListBinding.getHeaderContext(),
|
|
193
|
+
showActionParameterDialog: true,
|
|
194
|
+
label: this._getSpecificCreateActionDialogLabel(oMetaModel, sMetaPath, sNewAction, oResourceBundleCore),
|
|
195
|
+
bindingParameters: mBindingParameters,
|
|
196
|
+
parentControl: mParameters.parentControl,
|
|
197
|
+
bIsCreateAction: true
|
|
198
|
+
},
|
|
199
|
+
null,
|
|
200
|
+
messageHandler
|
|
201
|
+
);
|
|
202
|
+
} else {
|
|
203
|
+
const bIsNewPageCreation =
|
|
204
|
+
mParameters.creationMode !== CreationMode.CreationRow && mParameters.creationMode !== CreationMode.Inline;
|
|
205
|
+
const aNonComputedVisibleKeyFields = bIsNewPageCreation
|
|
206
|
+
? CommonUtils.getNonComputedVisibleFields(oMetaModel, sMetaPath, oView)
|
|
207
|
+
: [];
|
|
208
|
+
sFunctionName = bFromCopyPaste ? null : sFunctionName;
|
|
209
|
+
let sFunctionPath, oFunctionContext;
|
|
210
|
+
if (sFunctionName) {
|
|
211
|
+
//bound to the source entity:
|
|
212
|
+
if (bFunctionOnNavProp) {
|
|
213
|
+
sFunctionPath =
|
|
214
|
+
oMainListBinding.getContext() &&
|
|
215
|
+
`${oMetaModel.getMetaPath(oMainListBinding.getContext().getPath())}/${sFunctionName}`;
|
|
216
|
+
oFunctionContext = oMainListBinding.getContext();
|
|
236
217
|
} else {
|
|
237
|
-
|
|
218
|
+
sFunctionPath =
|
|
219
|
+
oMainListBinding.getHeaderContext() &&
|
|
220
|
+
`${oMetaModel.getMetaPath(oMainListBinding.getHeaderContext().getPath())}/${sFunctionName}`;
|
|
221
|
+
oFunctionContext = oMainListBinding.getHeaderContext();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
const oFunction = sFunctionPath && (oMetaModel.createBindingContext(sFunctionPath) as any);
|
|
225
|
+
|
|
226
|
+
try {
|
|
227
|
+
let oData: any;
|
|
228
|
+
try {
|
|
229
|
+
const oContext =
|
|
230
|
+
oFunction && oFunction.getObject() && oFunction.getObject()[0].$IsBound
|
|
231
|
+
? await operations.callBoundFunction(sFunctionName, oFunctionContext, oModel)
|
|
232
|
+
: await operations.callFunctionImport(sFunctionName, oModel);
|
|
233
|
+
if (oContext) {
|
|
234
|
+
oData = oContext.getObject();
|
|
235
|
+
}
|
|
236
|
+
} catch (oError: any) {
|
|
237
|
+
Log.error(`Error while executing the function ${sFunctionName}`, oError);
|
|
238
|
+
throw oError;
|
|
238
239
|
}
|
|
239
|
-
})
|
|
240
|
-
.catch(function (oError: any) {
|
|
241
|
-
Log.error("Error while executing the function " + sFunctionName, oError);
|
|
242
|
-
throw oError;
|
|
243
|
-
})
|
|
244
|
-
.then(function (oData: any) {
|
|
245
240
|
mParameters.data = oData ? Object.assign({}, oData, mParameters.data) : mParameters.data;
|
|
246
241
|
if (mParameters.data) {
|
|
247
242
|
delete mParameters.data["@odata.context"];
|
|
248
243
|
}
|
|
249
244
|
if (aNonComputedVisibleKeyFields.length > 0) {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
245
|
+
oResult = await this._launchDialogWithKeyFields(
|
|
246
|
+
oMainListBinding,
|
|
247
|
+
aNonComputedVisibleKeyFields,
|
|
248
|
+
oModel,
|
|
249
|
+
mParameters,
|
|
250
|
+
messageHandler
|
|
251
|
+
);
|
|
252
|
+
oNewDocumentContext = oResult.newContext;
|
|
256
253
|
} else {
|
|
257
|
-
let onBeforeCreatePromise;
|
|
258
254
|
if (mParameters.beforeCreateCallBack) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
onBeforeCreatePromise = Promise.resolve();
|
|
264
|
-
}
|
|
265
|
-
return onBeforeCreatePromise.then(function () {
|
|
266
|
-
oNewDocumentContext = oMainListBinding.create(
|
|
267
|
-
mParameters.data,
|
|
268
|
-
true,
|
|
269
|
-
mParameters.createAtEnd,
|
|
270
|
-
mParameters.inactive
|
|
255
|
+
await toES6Promise(
|
|
256
|
+
mParameters.beforeCreateCallBack({
|
|
257
|
+
contextPath: oMainListBinding && oMainListBinding.getPath()
|
|
258
|
+
})
|
|
271
259
|
);
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
oNewDocumentContext = oMainListBinding.create(
|
|
263
|
+
mParameters.data,
|
|
264
|
+
true,
|
|
265
|
+
mParameters.createAtEnd,
|
|
266
|
+
mParameters.inactive
|
|
267
|
+
);
|
|
268
|
+
if (!mParameters.inactive) {
|
|
269
|
+
oResult = await this.onAfterCreateCompletion(oMainListBinding, oNewDocumentContext, mParameters);
|
|
270
|
+
}
|
|
276
271
|
}
|
|
277
|
-
})
|
|
278
|
-
.catch(function (oError: any) {
|
|
272
|
+
} catch (oError: any) {
|
|
279
273
|
Log.error("Error while creating the new document", oError);
|
|
280
274
|
throw oError;
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
return oCreationPromise
|
|
284
|
-
.then(function (oResult: any) {
|
|
285
|
-
if (!oMainListBinding.isRelative()) {
|
|
286
|
-
// the create mode shall currently only be set on creating a root document
|
|
287
|
-
that._bCreateMode = true;
|
|
288
|
-
}
|
|
289
|
-
oNewDocumentContext = oNewDocumentContext || (oResult && oResult.response);
|
|
290
|
-
// TODO: where does this one coming from???
|
|
291
|
-
if (oResult && oResult.bConsiderDocumentModified) {
|
|
292
|
-
that.handleDocumentModifications();
|
|
293
275
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
if (!oMainListBinding.isRelative()) {
|
|
279
|
+
// the create mode shall currently only be set on creating a root document
|
|
280
|
+
this._bCreateMode = true;
|
|
281
|
+
}
|
|
282
|
+
oNewDocumentContext = oNewDocumentContext || (oResult && oResult.response);
|
|
283
|
+
// TODO: where does this one coming from???
|
|
284
|
+
if (oResult && oResult.bConsiderDocumentModified) {
|
|
285
|
+
this.handleDocumentModifications();
|
|
286
|
+
}
|
|
287
|
+
await messageHandler.showMessageDialog();
|
|
288
|
+
return oNewDocumentContext!;
|
|
289
|
+
} catch (oError: any) {
|
|
290
|
+
await messageHandler.showMessageDialog();
|
|
291
|
+
if (oError && oError.bDeleteTransientContext && oNewDocumentContext?.isTransient()) {
|
|
292
|
+
// This is a workaround suggested by model as Context.delete results in an error
|
|
293
|
+
// TODO: remove the $direct once model resolves this issue
|
|
294
|
+
// this line shows the expected console error Uncaught (in promise) Error: Request canceled: POST Travel; group: submitLater
|
|
295
|
+
oNewDocumentContext.delete("$direct");
|
|
296
|
+
}
|
|
297
|
+
throw oError;
|
|
298
|
+
} finally {
|
|
299
|
+
BusyLocker.unlock(this.oLockObject, sBusyPath);
|
|
300
|
+
}
|
|
315
301
|
}
|
|
316
302
|
/**
|
|
317
303
|
* Find the active contexts of the documents, only for the draft roots.
|
|
318
304
|
*
|
|
319
305
|
* @memberof sap.fe.core.TransactionHelper
|
|
320
306
|
* @static
|
|
321
|
-
* @param
|
|
307
|
+
* @param aContexts Contexts Either one context or an array with contexts to be deleted
|
|
322
308
|
* @param bFindActiveContexts
|
|
323
|
-
* @returns
|
|
309
|
+
* @returns Array of the active contexts
|
|
324
310
|
*/
|
|
325
|
-
findActiveDraftRootContexts(aContexts:
|
|
311
|
+
findActiveDraftRootContexts(aContexts: V4Context[], bFindActiveContexts: any) {
|
|
326
312
|
if (!bFindActiveContexts) {
|
|
327
313
|
return Promise.resolve();
|
|
328
314
|
}
|
|
329
315
|
const activeContexts = aContexts.reduce(function (aResult: any, oContext: any) {
|
|
330
316
|
const oMetaModel = oContext.getModel().getMetaModel();
|
|
331
317
|
const sMetaPath = oMetaModel.getMetaPath(oContext.getPath());
|
|
332
|
-
if (oMetaModel.getObject(sMetaPath
|
|
318
|
+
if (oMetaModel.getObject(`${sMetaPath}@com.sap.vocabularies.Common.v1.DraftRoot`)) {
|
|
333
319
|
const bIsActiveEntity = oContext.getObject().IsActiveEntity,
|
|
334
320
|
bHasActiveEntity = oContext.getObject().HasActiveEntity;
|
|
335
321
|
if (!bIsActiveEntity && bHasActiveEntity) {
|
|
336
|
-
const oActiveContext = oContext
|
|
337
|
-
.getModel()
|
|
338
|
-
.bindContext(oContext.getPath() + "/SiblingEntity")
|
|
339
|
-
.getBoundContext();
|
|
322
|
+
const oActiveContext = oContext.getModel().bindContext(`${oContext.getPath()}/SiblingEntity`).getBoundContext();
|
|
340
323
|
aResult.push(oActiveContext);
|
|
341
324
|
}
|
|
342
325
|
}
|
|
@@ -344,14 +327,9 @@ class TransactionHelper {
|
|
|
344
327
|
}, []);
|
|
345
328
|
return Promise.all(
|
|
346
329
|
activeContexts.map(function (oContext: any) {
|
|
347
|
-
return oContext.requestCanonicalPath().then(
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
},
|
|
351
|
-
function () {
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
);
|
|
330
|
+
return oContext.requestCanonicalPath().then(function () {
|
|
331
|
+
return oContext;
|
|
332
|
+
});
|
|
355
333
|
})
|
|
356
334
|
);
|
|
357
335
|
}
|
|
@@ -378,7 +356,7 @@ class TransactionHelper {
|
|
|
378
356
|
if (aContexts.length === 1) {
|
|
379
357
|
MessageToast.show(
|
|
380
358
|
CommonUtils.getTranslatedText(
|
|
381
|
-
"
|
|
359
|
+
"C_TRANSACTION_HELPER_DELETE_TOAST_SINGULAR",
|
|
382
360
|
oResourceBundle,
|
|
383
361
|
null,
|
|
384
362
|
mParameters.entitySetName
|
|
@@ -386,12 +364,7 @@ class TransactionHelper {
|
|
|
386
364
|
);
|
|
387
365
|
} else {
|
|
388
366
|
MessageToast.show(
|
|
389
|
-
CommonUtils.getTranslatedText(
|
|
390
|
-
"C_TRANSACTION_HELPER_OBJECT_PAGE_DELETE_TOAST_PLURAL",
|
|
391
|
-
oResourceBundle,
|
|
392
|
-
null,
|
|
393
|
-
mParameters.entitySetName
|
|
394
|
-
)
|
|
367
|
+
CommonUtils.getTranslatedText("C_TRANSACTION_HELPER_DELETE_TOAST_PLURAL", oResourceBundle, null, mParameters.entitySetName)
|
|
395
368
|
);
|
|
396
369
|
}
|
|
397
370
|
}
|
|
@@ -400,20 +373,18 @@ class TransactionHelper {
|
|
|
400
373
|
*
|
|
401
374
|
* @memberof sap.fe.core.TransactionHelper
|
|
402
375
|
* @static
|
|
403
|
-
* @param
|
|
404
|
-
* @param
|
|
405
|
-
* @param
|
|
406
|
-
* @param
|
|
407
|
-
* @param
|
|
408
|
-
* @param
|
|
376
|
+
* @param vInContexts Contexts Either one context or an array with contexts to be deleted
|
|
377
|
+
* @param mParameters Optional, can contain the following attributes:
|
|
378
|
+
* @param mParameters.title Title of the object to be deleted
|
|
379
|
+
* @param mParameters.description Description of the object to be deleted
|
|
380
|
+
* @param mParameters.numberOfSelectedContexts Number of objects selected
|
|
381
|
+
* @param mParameters.noDialog To disable the confirmation dialog
|
|
409
382
|
* @param oResourceBundle
|
|
410
383
|
* @param messageHandler
|
|
411
|
-
* @returns
|
|
384
|
+
* @returns A Promise resolved once the document are deleted
|
|
412
385
|
*/
|
|
413
|
-
deleteDocument(
|
|
414
|
-
let
|
|
415
|
-
fnResolve: Function,
|
|
416
|
-
aDeletableContexts: any[] = [],
|
|
386
|
+
deleteDocument(vInContexts: V4Context, mParameters: any, oResourceBundle: any, messageHandler: any) {
|
|
387
|
+
let aDeletableContexts: any[] = [],
|
|
417
388
|
isCheckBoxVisible = false,
|
|
418
389
|
isLockedTextVisible = false,
|
|
419
390
|
cannotBeDeletedTextVisible = false,
|
|
@@ -421,18 +392,23 @@ class TransactionHelper {
|
|
|
421
392
|
bDialogConfirmed = false;
|
|
422
393
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
423
394
|
const that = this,
|
|
424
|
-
oResourceBundleCore = (Core as CoreEx).getLibraryResourceBundle("sap.fe.core")
|
|
395
|
+
oResourceBundleCore = (Core as CoreEx).getLibraryResourceBundle("sap.fe.core");
|
|
425
396
|
let aParams;
|
|
426
397
|
let oDeleteMessage: any = {
|
|
427
|
-
title: oResourceBundleCore.getText("
|
|
398
|
+
title: oResourceBundleCore.getText("C_COMMON_DELETE")
|
|
428
399
|
};
|
|
429
400
|
messageHandling.removeBoundTransitionMessages();
|
|
430
401
|
BusyLocker.lock(this.oLockObject);
|
|
431
|
-
|
|
432
|
-
|
|
402
|
+
let vContexts: V4Context[];
|
|
403
|
+
if (Array.isArray(vInContexts)) {
|
|
404
|
+
vContexts = vInContexts;
|
|
405
|
+
} else {
|
|
406
|
+
vContexts = [vInContexts];
|
|
433
407
|
}
|
|
434
|
-
|
|
435
|
-
|
|
408
|
+
|
|
409
|
+
return new Promise<void>((resolve, reject) => {
|
|
410
|
+
try {
|
|
411
|
+
const sProgrammingModel = this.getProgrammingModel(vContexts[0]);
|
|
436
412
|
if (mParameters) {
|
|
437
413
|
if (!mParameters.numberOfSelectedContexts) {
|
|
438
414
|
if (sProgrammingModel === ProgrammingModel.Draft) {
|
|
@@ -445,14 +421,21 @@ class TransactionHelper {
|
|
|
445
421
|
oContextData.DraftAdministrativeData.InProcessByUser &&
|
|
446
422
|
!oContextData.DraftAdministrativeData.DraftIsCreatedByMe
|
|
447
423
|
) {
|
|
424
|
+
let sLockedUser = "";
|
|
425
|
+
const draftAdminData = oContextData && oContextData.DraftAdministrativeData;
|
|
426
|
+
if (draftAdminData) {
|
|
427
|
+
sLockedUser = draftAdminData["InProcessByUser"];
|
|
428
|
+
}
|
|
429
|
+
aParams = [sLockedUser];
|
|
448
430
|
MessageBox.show(
|
|
449
431
|
CommonUtils.getTranslatedText(
|
|
450
|
-
"
|
|
451
|
-
oResourceBundle
|
|
432
|
+
"C_TRANSACTION_HELPER_CONFIRM_DELETE_WITH_SINGLE_OBJECT_LOCKED",
|
|
433
|
+
oResourceBundle,
|
|
434
|
+
aParams
|
|
452
435
|
),
|
|
453
436
|
{
|
|
454
|
-
title: oResourceBundleCore.getText("
|
|
455
|
-
onClose:
|
|
437
|
+
title: oResourceBundleCore.getText("C_COMMON_DELETE"),
|
|
438
|
+
onClose: reject
|
|
456
439
|
}
|
|
457
440
|
);
|
|
458
441
|
return;
|
|
@@ -462,35 +445,72 @@ class TransactionHelper {
|
|
|
462
445
|
mParameters = getParameters(mParameters);
|
|
463
446
|
if (mParameters.title) {
|
|
464
447
|
if (mParameters.description) {
|
|
465
|
-
aParams = [mParameters.title, mParameters.description];
|
|
448
|
+
aParams = [mParameters.title + " ", mParameters.description];
|
|
466
449
|
} else {
|
|
467
450
|
aParams = [mParameters.title, ""];
|
|
468
451
|
}
|
|
469
452
|
oDeleteMessage.text = CommonUtils.getTranslatedText(
|
|
470
|
-
"
|
|
453
|
+
"C_TRANSACTION_HELPER_CONFIRM_DELETE_WITH_OBJECTINFO",
|
|
471
454
|
oResourceBundle,
|
|
472
455
|
aParams,
|
|
473
456
|
mParameters.entitySetName
|
|
474
457
|
);
|
|
475
458
|
} else {
|
|
476
459
|
oDeleteMessage.text = CommonUtils.getTranslatedText(
|
|
477
|
-
"
|
|
460
|
+
"C_TRANSACTION_HELPER_CONFIRM_DELETE_WITH_OBJECTTITLE_SINGULAR",
|
|
478
461
|
oResourceBundle
|
|
479
462
|
);
|
|
480
463
|
}
|
|
481
464
|
aDeletableContexts = vContexts;
|
|
482
465
|
} else {
|
|
483
466
|
oDeleteMessage = {
|
|
484
|
-
title: oResourceBundleCore.getText("
|
|
467
|
+
title: oResourceBundleCore.getText("C_COMMON_DELETE")
|
|
485
468
|
};
|
|
486
469
|
if (mParameters.numberOfSelectedContexts === 1 && mParameters.numberOfSelectedContexts === vContexts.length) {
|
|
487
470
|
aDeletableContexts = vContexts;
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
471
|
+
const oLineContextData = vContexts[0].getObject();
|
|
472
|
+
const oTable = mParameters.parentControl;
|
|
473
|
+
const sKey = oTable && oTable.getParent().getIdentifierColumn();
|
|
474
|
+
if (sKey) {
|
|
475
|
+
const sKeyValue = sKey ? oLineContextData[sKey] : undefined;
|
|
476
|
+
const sDescription =
|
|
477
|
+
mParameters.description && mParameters.description.path
|
|
478
|
+
? oLineContextData[mParameters.description.path]
|
|
479
|
+
: undefined;
|
|
480
|
+
if (sKeyValue) {
|
|
481
|
+
if (sDescription) {
|
|
482
|
+
aParams = [sKeyValue + " ", sDescription];
|
|
483
|
+
} else {
|
|
484
|
+
aParams = [sKeyValue, ""];
|
|
485
|
+
}
|
|
486
|
+
oDeleteMessage.text = CommonUtils.getTranslatedText(
|
|
487
|
+
"C_TRANSACTION_HELPER_CONFIRM_DELETE_WITH_OBJECTINFO",
|
|
488
|
+
oResourceBundle,
|
|
489
|
+
aParams,
|
|
490
|
+
mParameters.entitySetName
|
|
491
|
+
);
|
|
492
|
+
} else if (sKeyValue) {
|
|
493
|
+
aParams = [sKeyValue, ""];
|
|
494
|
+
oDeleteMessage.text = CommonUtils.getTranslatedText(
|
|
495
|
+
"C_TRANSACTION_HELPER_CONFIRM_DELETE_WITH_OBJECTINFO",
|
|
496
|
+
oResourceBundle,
|
|
497
|
+
aParams,
|
|
498
|
+
mParameters.entitySetName
|
|
499
|
+
);
|
|
500
|
+
} else {
|
|
501
|
+
oDeleteMessage.text = CommonUtils.getTranslatedText(
|
|
502
|
+
"C_TRANSACTION_HELPER_CONFIRM_DELETE_WITH_OBJECTTITLE_SINGULAR",
|
|
503
|
+
oResourceBundle
|
|
504
|
+
);
|
|
505
|
+
}
|
|
506
|
+
} else {
|
|
507
|
+
oDeleteMessage.text = CommonUtils.getTranslatedText(
|
|
508
|
+
"C_TRANSACTION_HELPER_CONFIRM_DELETE_WITH_OBJECTTITLE_SINGULAR",
|
|
509
|
+
oResourceBundle,
|
|
510
|
+
null,
|
|
511
|
+
mParameters.entitySetName
|
|
512
|
+
);
|
|
513
|
+
}
|
|
494
514
|
} else if (mParameters.numberOfSelectedContexts === 1 && mParameters.unSavedContexts.length === 1) {
|
|
495
515
|
//only one unsaved object
|
|
496
516
|
aDeletableContexts = mParameters.unSavedContexts;
|
|
@@ -502,7 +522,7 @@ class TransactionHelper {
|
|
|
502
522
|
}
|
|
503
523
|
aParams = [sLastChangedByUser];
|
|
504
524
|
oDeleteMessage.text = CommonUtils.getTranslatedText(
|
|
505
|
-
"
|
|
525
|
+
"C_TRANSACTION_HELPER_CONFIRM_DELETE_WITH_UNSAVED_CHANGES",
|
|
506
526
|
oResourceBundle,
|
|
507
527
|
aParams
|
|
508
528
|
);
|
|
@@ -510,7 +530,7 @@ class TransactionHelper {
|
|
|
510
530
|
//only multiple unsaved objects
|
|
511
531
|
aDeletableContexts = mParameters.unSavedContexts;
|
|
512
532
|
oDeleteMessage.text = CommonUtils.getTranslatedText(
|
|
513
|
-
"
|
|
533
|
+
"C_TRANSACTION_HELPER_CONFIRM_DELETE_WITH_UNSAVED_CHANGES_MULTIPLE_OBJECTS",
|
|
514
534
|
oResourceBundle
|
|
515
535
|
);
|
|
516
536
|
} else if (
|
|
@@ -522,13 +542,13 @@ class TransactionHelper {
|
|
|
522
542
|
oDeleteMessage.text =
|
|
523
543
|
aDeletableContexts.length === 1
|
|
524
544
|
? CommonUtils.getTranslatedText(
|
|
525
|
-
"
|
|
545
|
+
"C_TRANSACTION_HELPER_CONFIRM_DELETE_WITH_OBJECTTITLE_SINGULAR",
|
|
526
546
|
oResourceBundle,
|
|
527
547
|
null,
|
|
528
548
|
mParameters.entitySetName
|
|
529
549
|
)
|
|
530
550
|
: CommonUtils.getTranslatedText(
|
|
531
|
-
"
|
|
551
|
+
"C_TRANSACTION_HELPER_CONFIRM_DELETE_WITH_OBJECTTITLE_PLURAL",
|
|
532
552
|
oResourceBundle,
|
|
533
553
|
null,
|
|
534
554
|
mParameters.entitySetName
|
|
@@ -540,31 +560,24 @@ class TransactionHelper {
|
|
|
540
560
|
oDeleteMessage.text =
|
|
541
561
|
aDeletableContexts.length === 1
|
|
542
562
|
? CommonUtils.getTranslatedText(
|
|
543
|
-
"
|
|
563
|
+
"C_TRANSACTION_HELPER_CONFIRM_DELETE_WITH_OBJECTTITLE_SINGULAR_NON_DELETABLE",
|
|
544
564
|
oResourceBundle,
|
|
545
565
|
null,
|
|
546
566
|
mParameters.entitySetName
|
|
547
567
|
)
|
|
548
568
|
: CommonUtils.getTranslatedText(
|
|
549
|
-
"
|
|
569
|
+
"C_TRANSACTION_HELPER_CONFIRM_DELETE_WITH_OBJECTTITLE_PLURAL_NON_DELETABLE",
|
|
550
570
|
oResourceBundle,
|
|
551
|
-
|
|
571
|
+
[aDeletableContexts.length],
|
|
552
572
|
mParameters.entitySetName
|
|
553
573
|
);
|
|
554
|
-
oDeleteMessage.nonDeletableText =
|
|
555
|
-
"C_TRANSACTION_HELPER_OBJECT_PAGE_CONFIRM_DELETE_WITH_OBJECTINFO_AND_FEW_OBJECTS_NON_DELETABLE",
|
|
556
|
-
oResourceBundle,
|
|
557
|
-
[
|
|
558
|
-
mParameters.numberOfSelectedContexts - vContexts.concat(mParameters.unSavedContexts).length,
|
|
559
|
-
mParameters.numberOfSelectedContexts
|
|
560
|
-
]
|
|
561
|
-
);
|
|
574
|
+
oDeleteMessage.nonDeletableText = that._getNonDeletableText(mParameters, vContexts, oResourceBundle);
|
|
562
575
|
}
|
|
563
576
|
if (mParameters.lockedContexts.length == 1) {
|
|
564
577
|
//setting the locked text if locked objects exist
|
|
565
578
|
isLockedTextVisible = true;
|
|
566
579
|
oDeleteMessage.nonDeletableText = CommonUtils.getTranslatedText(
|
|
567
|
-
"
|
|
580
|
+
"C_TRANSACTION_HELPER_CONFIRM_DELETE_WITH_OBJECTINFO_AND_ONE_OBJECT_LOCKED",
|
|
568
581
|
oResourceBundle,
|
|
569
582
|
[mParameters.numberOfSelectedContexts]
|
|
570
583
|
);
|
|
@@ -573,7 +586,7 @@ class TransactionHelper {
|
|
|
573
586
|
//setting the locked text if locked objects exist
|
|
574
587
|
isLockedTextVisible = true;
|
|
575
588
|
oDeleteMessage.nonDeletableText = CommonUtils.getTranslatedText(
|
|
576
|
-
"
|
|
589
|
+
"C_TRANSACTION_HELPER_CONFIRM_DELETE_WITH_OBJECTINFO_AND_FEW_OBJECTS_LOCKED",
|
|
577
590
|
oResourceBundle,
|
|
578
591
|
[mParameters.lockedContexts.length, mParameters.numberOfSelectedContexts]
|
|
579
592
|
);
|
|
@@ -591,24 +604,24 @@ class TransactionHelper {
|
|
|
591
604
|
aDeletableContexts = mParameters.unSavedContexts;
|
|
592
605
|
if (mParameters.unSavedContexts.length === 1) {
|
|
593
606
|
oDeleteMessage.text = CommonUtils.getTranslatedText(
|
|
594
|
-
"
|
|
607
|
+
"C_TRANSACTION_HELPER_CONFIRM_DELETE_WITH_UNSAVED_AND_FEW_OBJECTS_LOCKED_SINGULAR",
|
|
595
608
|
oResourceBundle
|
|
596
609
|
);
|
|
597
610
|
} else {
|
|
598
611
|
oDeleteMessage.text = CommonUtils.getTranslatedText(
|
|
599
|
-
"
|
|
612
|
+
"C_TRANSACTION_HELPER_CONFIRM_DELETE_WITH_UNSAVED_AND_FEW_OBJECTS_LOCKED_PLURAL",
|
|
600
613
|
oResourceBundle
|
|
601
614
|
);
|
|
602
615
|
}
|
|
603
616
|
} else {
|
|
604
617
|
if (mParameters.unSavedContexts.length === 1) {
|
|
605
618
|
oDeleteMessage.checkBoxText = CommonUtils.getTranslatedText(
|
|
606
|
-
"
|
|
619
|
+
"C_TRANSACTION_HELPER_CONFIRM_DELETE_WITH_OBJECTINFO_AND_FEW_OBJECTS_UNSAVED_SINGULAR",
|
|
607
620
|
oResourceBundle
|
|
608
621
|
);
|
|
609
622
|
} else {
|
|
610
623
|
oDeleteMessage.checkBoxText = CommonUtils.getTranslatedText(
|
|
611
|
-
"
|
|
624
|
+
"C_TRANSACTION_HELPER_CONFIRM_DELETE_WITH_OBJECTINFO_AND_FEW_OBJECTS_UNSAVED_PLURAL",
|
|
612
625
|
oResourceBundle
|
|
613
626
|
);
|
|
614
627
|
}
|
|
@@ -616,31 +629,28 @@ class TransactionHelper {
|
|
|
616
629
|
}
|
|
617
630
|
}
|
|
618
631
|
if (cannotBeDeletedTextVisible && isLockedTextVisible) {
|
|
632
|
+
//if non-deletable objects exist along with deletable objects
|
|
633
|
+
const sNonDeletableContextText = that._getNonDeletableText(mParameters, vContexts, oResourceBundle);
|
|
619
634
|
//if both locked and non-deletable objects exist along with deletable objects
|
|
620
635
|
if (mParameters.unSavedContexts.length > 1) {
|
|
621
|
-
oDeleteMessage.nonDeletableText =
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
mParameters.numberOfSelectedContexts
|
|
630
|
-
]
|
|
631
|
-
);
|
|
636
|
+
oDeleteMessage.nonDeletableText =
|
|
637
|
+
sNonDeletableContextText +
|
|
638
|
+
" " +
|
|
639
|
+
CommonUtils.getTranslatedText(
|
|
640
|
+
"C_TRANSACTION_HELPER_CONFIRM_DELETE_WITH_OBJECTINFO_AND_FEW_OBJECTS_LOCKED",
|
|
641
|
+
oResourceBundle,
|
|
642
|
+
[mParameters.lockedContexts.length, mParameters.numberOfSelectedContexts]
|
|
643
|
+
);
|
|
632
644
|
}
|
|
633
645
|
if (mParameters.unSavedContexts.length == 1) {
|
|
634
|
-
oDeleteMessage.nonDeletableText =
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
]
|
|
643
|
-
);
|
|
646
|
+
oDeleteMessage.nonDeletableText =
|
|
647
|
+
sNonDeletableContextText +
|
|
648
|
+
" " +
|
|
649
|
+
CommonUtils.getTranslatedText(
|
|
650
|
+
"C_TRANSACTION_HELPER_CONFIRM_DELETE_WITH_OBJECTINFO_AND_ONE_OBJECT_LOCKED",
|
|
651
|
+
oResourceBundle,
|
|
652
|
+
[mParameters.numberOfSelectedContexts]
|
|
653
|
+
);
|
|
644
654
|
}
|
|
645
655
|
}
|
|
646
656
|
}
|
|
@@ -672,60 +682,55 @@ class TransactionHelper {
|
|
|
672
682
|
})
|
|
673
683
|
]
|
|
674
684
|
});
|
|
675
|
-
const sTitle = oResourceBundleCore.getText("
|
|
676
|
-
const fnConfirm = function () {
|
|
685
|
+
const sTitle = oResourceBundleCore.getText("C_COMMON_DELETE");
|
|
686
|
+
const fnConfirm = async function () {
|
|
677
687
|
bDialogConfirmed = true;
|
|
678
688
|
BusyLocker.lock(that.oLockObject);
|
|
679
689
|
const aContexts = aDeletableContexts;
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
//make sure to fetch the active contexts before deleting the drafts
|
|
690
|
-
return Promise.all(
|
|
690
|
+
|
|
691
|
+
try {
|
|
692
|
+
if (mParameters.beforeDeleteCallBack) {
|
|
693
|
+
await mParameters.beforeDeleteCallBack({ contexts: aContexts });
|
|
694
|
+
}
|
|
695
|
+
const activeContexts = await that.findActiveDraftRootContexts(aContexts, mParameters.bFindActiveContexts);
|
|
696
|
+
|
|
697
|
+
try {
|
|
698
|
+
await Promise.all(
|
|
691
699
|
aContexts.map(function (oContext: any) {
|
|
692
700
|
//delete the draft
|
|
693
701
|
const bEnableStrictHandling = aContexts.length === 1 ? true : false;
|
|
694
|
-
return draft.deleteDraft(oContext, bEnableStrictHandling);
|
|
702
|
+
return draft.deleteDraft(oContext, that._oAppComponent, bEnableStrictHandling);
|
|
695
703
|
})
|
|
696
|
-
)
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
704
|
+
);
|
|
705
|
+
} catch (oError: any) {
|
|
706
|
+
await messageHandler.showMessages();
|
|
707
|
+
// re-throw error to enforce rejecting the general promise
|
|
708
|
+
throw oError;
|
|
709
|
+
}
|
|
710
|
+
const checkBox = {
|
|
711
|
+
"isCheckBoxVisible": isCheckBoxVisible,
|
|
712
|
+
"isCheckBoxSelected": isCheckBoxSelected
|
|
713
|
+
};
|
|
714
|
+
if (activeContexts && activeContexts.length) {
|
|
715
|
+
await Promise.all(
|
|
716
|
+
activeContexts.map(function (oContext: any) {
|
|
717
|
+
return oContext.delete();
|
|
702
718
|
})
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
that.afterDeleteProcess(mParameters, checkBox, aContexts, oResourceBundle);
|
|
719
|
-
return messageHandler.showMessageDialog().then(fnResolve);
|
|
720
|
-
}
|
|
721
|
-
});
|
|
722
|
-
})
|
|
723
|
-
.catch(function () {
|
|
724
|
-
fnReject();
|
|
725
|
-
})
|
|
726
|
-
.finally(function () {
|
|
727
|
-
BusyLocker.unlock(that.oLockObject);
|
|
728
|
-
});
|
|
719
|
+
);
|
|
720
|
+
|
|
721
|
+
that.afterDeleteProcess(mParameters, checkBox, aContexts, oResourceBundle);
|
|
722
|
+
await messageHandler.showMessageDialog();
|
|
723
|
+
resolve();
|
|
724
|
+
} else {
|
|
725
|
+
that.afterDeleteProcess(mParameters, checkBox, aContexts, oResourceBundle);
|
|
726
|
+
await messageHandler.showMessageDialog();
|
|
727
|
+
resolve();
|
|
728
|
+
}
|
|
729
|
+
} catch (oError: any) {
|
|
730
|
+
reject();
|
|
731
|
+
} finally {
|
|
732
|
+
BusyLocker.unlock(that.oLockObject);
|
|
733
|
+
}
|
|
729
734
|
};
|
|
730
735
|
const oDialog = new Dialog({
|
|
731
736
|
title: sTitle,
|
|
@@ -735,11 +740,11 @@ class TransactionHelper {
|
|
|
735
740
|
? [oNonDeletableMessageTextControl, oDeleteMessageTextControl]
|
|
736
741
|
: oDeleteMessageTextControl,
|
|
737
742
|
beginButton: new Button({
|
|
738
|
-
text: oResourceBundleCore.getText("
|
|
743
|
+
text: oResourceBundleCore.getText("C_COMMON_DELETE"),
|
|
739
744
|
type: "Emphasized",
|
|
740
745
|
press: function () {
|
|
741
746
|
oDialog.close();
|
|
742
|
-
|
|
747
|
+
fnConfirm();
|
|
743
748
|
}
|
|
744
749
|
}),
|
|
745
750
|
endButton: new Button({
|
|
@@ -752,27 +757,19 @@ class TransactionHelper {
|
|
|
752
757
|
oDialog.destroy();
|
|
753
758
|
// if dialog is closed unconfirmed (e.g. via "Cancel" or Escape button), ensure to reject promise
|
|
754
759
|
if (!bDialogConfirmed) {
|
|
755
|
-
|
|
760
|
+
reject();
|
|
756
761
|
}
|
|
757
762
|
}
|
|
758
763
|
} as any);
|
|
759
764
|
if (mParameters.noDialog) {
|
|
760
|
-
|
|
765
|
+
fnConfirm();
|
|
761
766
|
} else {
|
|
762
767
|
oDialog.addStyleClass("sapUiContentPadding");
|
|
763
768
|
oDialog.open();
|
|
764
769
|
}
|
|
765
|
-
}
|
|
766
|
-
.finally(function () {
|
|
770
|
+
} finally {
|
|
767
771
|
BusyLocker.unlock(that.oLockObject);
|
|
768
|
-
}
|
|
769
|
-
.catch(function () {
|
|
770
|
-
Log.warning("Couldn't get Programming model");
|
|
771
|
-
fnReject();
|
|
772
|
-
});
|
|
773
|
-
return new Promise(function (resolve: (value: any) => void, reject: (reason?: any) => void) {
|
|
774
|
-
fnReject = reject;
|
|
775
|
-
fnResolve = resolve;
|
|
772
|
+
}
|
|
776
773
|
});
|
|
777
774
|
}
|
|
778
775
|
/**
|
|
@@ -780,260 +777,210 @@ class TransactionHelper {
|
|
|
780
777
|
*
|
|
781
778
|
* @memberof sap.fe.core.TransactionHelper
|
|
782
779
|
* @static
|
|
783
|
-
* @param
|
|
784
|
-
* @param
|
|
780
|
+
* @param oContext Context of the active document
|
|
781
|
+
* @param oView Current view
|
|
785
782
|
* @param messageHandler
|
|
786
|
-
* @returns
|
|
783
|
+
* @returns Promise resolves with the new draft context in case of draft programming model
|
|
787
784
|
* @ui5-restricted
|
|
788
785
|
* @final
|
|
789
786
|
*/
|
|
790
|
-
editDocument(oContext:
|
|
787
|
+
async editDocument(oContext: V4Context, oView: View, messageHandler: any): Promise<V4Context> {
|
|
791
788
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
792
789
|
const that = this;
|
|
793
790
|
const sProgrammingModel = this.getProgrammingModel(oContext);
|
|
794
|
-
let oEditPromise;
|
|
795
791
|
if (!oContext) {
|
|
796
|
-
|
|
792
|
+
throw new Error("Binding context to active document is required");
|
|
793
|
+
}
|
|
794
|
+
if (sProgrammingModel !== ProgrammingModel.Draft && sProgrammingModel !== ProgrammingModel.Sticky) {
|
|
795
|
+
throw new Error("Edit is only allowed for draft or sticky session supported services");
|
|
797
796
|
}
|
|
798
797
|
this._bIsModified = false;
|
|
799
798
|
BusyLocker.lock(that.oLockObject);
|
|
800
799
|
// before triggering the edit action we'll have to remove all bound transition messages
|
|
801
800
|
messageHandler.removeTransitionMessages();
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
801
|
+
|
|
802
|
+
try {
|
|
803
|
+
const oNewContext: V4Context =
|
|
804
|
+
sProgrammingModel === ProgrammingModel.Draft
|
|
805
|
+
? await draft.createDraftFromActiveDocument(oContext, this._getAppComponent(), {
|
|
806
|
+
bPreserveChanges: true,
|
|
807
|
+
oView: oView
|
|
808
|
+
} as any)
|
|
809
|
+
: await sticky.editDocumentInStickySession(oContext, this._getAppComponent());
|
|
810
|
+
|
|
811
|
+
this._bCreateMode = false;
|
|
812
|
+
await messageHandler.showMessageDialog();
|
|
813
|
+
return oNewContext;
|
|
814
|
+
} catch (err: any) {
|
|
815
|
+
await messageHandler.showMessages({ concurrentEditFlag: true });
|
|
816
|
+
throw err;
|
|
817
|
+
} finally {
|
|
810
818
|
BusyLocker.unlock(that.oLockObject);
|
|
811
|
-
return Promise.reject(new Error("Edit is only allowed for draft or sticky session supported services"));
|
|
812
819
|
}
|
|
813
|
-
return oEditPromise
|
|
814
|
-
.then(function (oNewContext: any) {
|
|
815
|
-
that._bCreateMode = false;
|
|
816
|
-
return messageHandler.showMessageDialog().then(function () {
|
|
817
|
-
return oNewContext;
|
|
818
|
-
});
|
|
819
|
-
})
|
|
820
|
-
.catch(function (err: any) {
|
|
821
|
-
return messageHandler.showMessages({ concurrentEditFlag: true }).then(function () {
|
|
822
|
-
return Promise.reject(err);
|
|
823
|
-
});
|
|
824
|
-
})
|
|
825
|
-
.finally(function () {
|
|
826
|
-
BusyLocker.unlock(that.oLockObject);
|
|
827
|
-
});
|
|
828
820
|
}
|
|
829
821
|
/**
|
|
830
822
|
* Cancel 'edit' mode of a document.
|
|
831
823
|
*
|
|
832
824
|
* @memberof sap.fe.core.TransactionHelper
|
|
833
825
|
* @static
|
|
834
|
-
* @param
|
|
835
|
-
* @param
|
|
836
|
-
* @param
|
|
837
|
-
* @param
|
|
826
|
+
* @param oContext Context of the document to be canceled or deleted
|
|
827
|
+
* @param [mInParameters] Optional, can contain the following attributes:
|
|
828
|
+
* @param mInParameters.cancelButton Cancel Button of the discard popover (mandatory for now)
|
|
829
|
+
* @param mInParameters.skipDiscardPopover Optional, supresses the discard popover incase of draft applications while navigating out of OP
|
|
838
830
|
* @param oResourceBundle
|
|
839
831
|
* @param messageHandler
|
|
840
|
-
* @returns
|
|
832
|
+
* @returns Promise resolves with ???
|
|
841
833
|
* @ui5-restricted
|
|
842
834
|
* @final
|
|
843
835
|
*/
|
|
844
|
-
cancelDocument(
|
|
845
|
-
oContext:
|
|
836
|
+
async cancelDocument(
|
|
837
|
+
oContext: V4Context,
|
|
846
838
|
mInParameters: { cancelButton: any; skipDiscardPopover: boolean } | undefined,
|
|
847
839
|
oResourceBundle: any,
|
|
848
840
|
messageHandler: any
|
|
849
|
-
) {
|
|
850
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
851
|
-
const that = this;
|
|
852
|
-
let sProgrammingModel: typeof ProgrammingModel;
|
|
841
|
+
): Promise<V4Context | boolean> {
|
|
853
842
|
//context must always be passed - mandatory parameter
|
|
854
843
|
if (!oContext) {
|
|
855
|
-
|
|
844
|
+
throw new Error("No context exists. Pass a meaningful context");
|
|
856
845
|
}
|
|
857
|
-
BusyLocker.lock(
|
|
846
|
+
BusyLocker.lock(this.oLockObject);
|
|
858
847
|
const mParameters = getParameters(mInParameters);
|
|
859
|
-
const
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
that._bIsModified = !(draftAdminData.CreationDateTime === draftAdminData.LastChangeDateTime);
|
|
872
|
-
}
|
|
873
|
-
});
|
|
848
|
+
const oModel = oContext.getModel();
|
|
849
|
+
const sProgrammingModel = this.getProgrammingModel(oContext);
|
|
850
|
+
|
|
851
|
+
try {
|
|
852
|
+
let returnedValue: V4Context | boolean = false;
|
|
853
|
+
|
|
854
|
+
if (sProgrammingModel === ProgrammingModel.Draft) {
|
|
855
|
+
const draftDataContext = oModel.bindContext(`${oContext.getPath()}/DraftAdministrativeData`).getBoundContext();
|
|
856
|
+
if (!this._bIsModified) {
|
|
857
|
+
const draftAdminData = await draftDataContext.requestObject();
|
|
858
|
+
if (draftAdminData) {
|
|
859
|
+
this._bIsModified = !(draftAdminData.CreationDateTime === draftAdminData.LastChangeDateTime);
|
|
874
860
|
}
|
|
875
861
|
}
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
let oDeletePromise;
|
|
898
|
-
if (!bHasActiveEntity) {
|
|
899
|
-
if (oParamsContext && oParamsContext.hasPendingChanges()) {
|
|
900
|
-
oParamsContext.getBinding().resetChanges();
|
|
901
|
-
}
|
|
902
|
-
oDeletePromise = draft.deleteDraft(oParamsContext);
|
|
903
|
-
return oDeletePromise;
|
|
904
|
-
} else {
|
|
905
|
-
let oActiveContext = oModel.bindContext(oParamsContext.getPath() + "/SiblingEntity").getBoundContext();
|
|
906
|
-
return oActiveContext
|
|
907
|
-
.requestCanonicalPath()
|
|
908
|
-
.then(
|
|
909
|
-
function (sPath: any) {
|
|
910
|
-
sCanonicalPath = sPath;
|
|
911
|
-
if (oParamsContext && oParamsContext.hasPendingChanges()) {
|
|
912
|
-
oParamsContext.getBinding().resetChanges();
|
|
913
|
-
}
|
|
914
|
-
oDeletePromise = draft.deleteDraft(oParamsContext);
|
|
915
|
-
return oDeletePromise;
|
|
916
|
-
},
|
|
917
|
-
function () {
|
|
918
|
-
draft.deleteDraft(oParamsContext);
|
|
919
|
-
return;
|
|
920
|
-
}
|
|
921
|
-
)
|
|
922
|
-
.then(function () {
|
|
923
|
-
//oParamsContext.delete() in the previous promise doesnt return anything upon success.
|
|
924
|
-
if (!sCanonicalPath) {
|
|
925
|
-
return;
|
|
926
|
-
}
|
|
927
|
-
if (oActiveContext.getPath() !== sCanonicalPath) {
|
|
928
|
-
// the active context is using the sibling entity - this path is not accessible anymore as we deleted the draft
|
|
929
|
-
// document - therefore we need to create a new context with the canonical path
|
|
930
|
-
oActiveContext = oModel.bindContext(sCanonicalPath).getBoundContext();
|
|
931
|
-
}
|
|
932
|
-
return oActiveContext;
|
|
933
|
-
});
|
|
934
|
-
}
|
|
935
|
-
});
|
|
936
|
-
case ProgrammingModel.Sticky:
|
|
937
|
-
return sticky.discardDocument(oContext).then(function (oContext: any) {
|
|
938
|
-
if (oContext) {
|
|
939
|
-
if (oContext.hasPendingChanges()) {
|
|
940
|
-
oContext.getBinding().resetChanges();
|
|
941
|
-
}
|
|
942
|
-
if (!that._bCreateMode) {
|
|
943
|
-
oContext.refresh();
|
|
944
|
-
return oContext;
|
|
945
|
-
}
|
|
862
|
+
}
|
|
863
|
+
if (!mParameters.skipDiscardPopover) {
|
|
864
|
+
await this._showDiscardPopover(mParameters.cancelButton, this._bIsModified, oResourceBundle);
|
|
865
|
+
}
|
|
866
|
+
if (mParameters.beforeCancelCallBack) {
|
|
867
|
+
await mParameters.beforeCancelCallBack({ context: oContext });
|
|
868
|
+
}
|
|
869
|
+
switch (sProgrammingModel) {
|
|
870
|
+
case ProgrammingModel.Draft:
|
|
871
|
+
const bHasActiveEntity = await oContext.requestObject("HasActiveEntity");
|
|
872
|
+
if (!bHasActiveEntity) {
|
|
873
|
+
if (oContext && oContext.hasPendingChanges()) {
|
|
874
|
+
oContext.getBinding().resetChanges();
|
|
875
|
+
}
|
|
876
|
+
returnedValue = await draft.deleteDraft(oContext, this._oAppComponent);
|
|
877
|
+
} else {
|
|
878
|
+
const oSiblingContext = oModel.bindContext(`${oContext.getPath()}/SiblingEntity`).getBoundContext();
|
|
879
|
+
try {
|
|
880
|
+
const sCanonicalPath = await oSiblingContext.requestCanonicalPath();
|
|
881
|
+
if (oContext && oContext.hasPendingChanges()) {
|
|
882
|
+
oContext.getBinding().resetChanges();
|
|
946
883
|
}
|
|
947
|
-
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
}
|
|
884
|
+
returnedValue = oModel.bindContext(sCanonicalPath).getBoundContext();
|
|
885
|
+
} finally {
|
|
886
|
+
await draft.deleteDraft(oContext, this._oAppComponent);
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
break;
|
|
890
|
+
|
|
891
|
+
case ProgrammingModel.Sticky:
|
|
892
|
+
const discardedContext = await sticky.discardDocument(oContext);
|
|
893
|
+
if (discardedContext) {
|
|
894
|
+
if (discardedContext.hasPendingChanges()) {
|
|
895
|
+
discardedContext.getBinding().resetChanges();
|
|
896
|
+
}
|
|
897
|
+
if (!this._bCreateMode) {
|
|
898
|
+
discardedContext.refresh();
|
|
899
|
+
returnedValue = discardedContext;
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
break;
|
|
903
|
+
|
|
904
|
+
default:
|
|
905
|
+
throw new Error("Cancel document only allowed for draft or sticky session supported services");
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
this._bIsModified = false;
|
|
909
|
+
// remove existing bound transition messages
|
|
910
|
+
messageHandler.removeTransitionMessages();
|
|
911
|
+
// show unbound messages
|
|
912
|
+
await messageHandler.showMessages();
|
|
913
|
+
return returnedValue;
|
|
914
|
+
} catch (err: any) {
|
|
915
|
+
await messageHandler.showMessages();
|
|
916
|
+
throw err;
|
|
917
|
+
} finally {
|
|
918
|
+
BusyLocker.unlock(this.oLockObject);
|
|
919
|
+
}
|
|
970
920
|
}
|
|
921
|
+
|
|
971
922
|
/**
|
|
972
923
|
* Saves the document.
|
|
973
924
|
*
|
|
974
925
|
* @memberof sap.fe.core.TransactionHelper
|
|
975
926
|
* @static
|
|
976
|
-
* @param
|
|
927
|
+
* @param oContext Context of the document to be saved
|
|
977
928
|
* @param oResourceBundle
|
|
978
929
|
* @param bExecuteSideEffectsOnError
|
|
979
930
|
* @param aBindings
|
|
980
931
|
* @param messageHandler
|
|
981
|
-
* @returns
|
|
932
|
+
* @returns Promise resolves with ???
|
|
982
933
|
* @ui5-restricted
|
|
983
934
|
* @final
|
|
984
935
|
*/
|
|
985
|
-
saveDocument(
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
936
|
+
async saveDocument(
|
|
937
|
+
oContext: V4Context,
|
|
938
|
+
oResourceBundle: any,
|
|
939
|
+
bExecuteSideEffectsOnError: any,
|
|
940
|
+
aBindings: any,
|
|
941
|
+
messageHandler: any
|
|
942
|
+
): Promise<V4Context> {
|
|
990
943
|
if (!oContext) {
|
|
991
944
|
return Promise.reject(new Error("Binding context to draft document is required"));
|
|
992
945
|
}
|
|
946
|
+
const sProgrammingModel = this.getProgrammingModel(oContext);
|
|
947
|
+
if (sProgrammingModel !== ProgrammingModel.Sticky && sProgrammingModel !== ProgrammingModel.Draft) {
|
|
948
|
+
throw new Error("Save is only allowed for draft or sticky session supported services");
|
|
949
|
+
}
|
|
993
950
|
// in case of saving / activating the bound transition messages shall be removed before the PATCH/POST
|
|
994
951
|
// is sent to the backend
|
|
995
952
|
messageHandler.removeTransitionMessages();
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
.catch(function (err: any) {
|
|
1021
|
-
if (aBindings && aBindings.length > 0) {
|
|
1022
|
-
/* The sideEffects are executed only for table items in transient state */
|
|
1023
|
-
aBindings.forEach(function (oListBinding: any) {
|
|
1024
|
-
if (!CommonUtils.hasTransientContext(oListBinding) && bExecuteSideEffectsOnError) {
|
|
1025
|
-
const oAppComponent = that._getAppComponent();
|
|
1026
|
-
oAppComponent.getSideEffectsService().requestSideEffectsForNavigationProperty(oListBinding.getPath(), oContext);
|
|
1027
|
-
}
|
|
1028
|
-
});
|
|
1029
|
-
}
|
|
1030
|
-
return messageHandler.showMessages().then(function () {
|
|
1031
|
-
return Promise.reject(err);
|
|
953
|
+
|
|
954
|
+
try {
|
|
955
|
+
BusyLocker.lock(this.oLockObject);
|
|
956
|
+
const oActiveDocument =
|
|
957
|
+
sProgrammingModel === ProgrammingModel.Draft
|
|
958
|
+
? await draft.activateDocument(oContext, this._getAppComponent(), {}, messageHandler)
|
|
959
|
+
: await sticky.activateDocument(oContext, this._getAppComponent());
|
|
960
|
+
|
|
961
|
+
const bNewObject = sProgrammingModel === ProgrammingModel.Sticky ? this._bCreateMode : !oContext.getObject().HasActiveEntity;
|
|
962
|
+
MessageToast.show(
|
|
963
|
+
bNewObject
|
|
964
|
+
? CommonUtils.getTranslatedText("C_TRANSACTION_HELPER_OBJECT_CREATED", oResourceBundle)
|
|
965
|
+
: CommonUtils.getTranslatedText("C_TRANSACTION_HELPER_OBJECT_SAVED", oResourceBundle)
|
|
966
|
+
);
|
|
967
|
+
this._bIsModified = false;
|
|
968
|
+
return oActiveDocument;
|
|
969
|
+
} catch (err: any) {
|
|
970
|
+
if (aBindings && aBindings.length > 0) {
|
|
971
|
+
/* The sideEffects are executed only for table items in transient state */
|
|
972
|
+
aBindings.forEach((oListBinding: any) => {
|
|
973
|
+
if (!CommonUtils.hasTransientContext(oListBinding) && bExecuteSideEffectsOnError) {
|
|
974
|
+
const oAppComponent = this._getAppComponent();
|
|
975
|
+
oAppComponent.getSideEffectsService().requestSideEffectsForNavigationProperty(oListBinding.getPath(), oContext);
|
|
976
|
+
}
|
|
1032
977
|
});
|
|
1033
|
-
}
|
|
1034
|
-
.
|
|
1035
|
-
|
|
1036
|
-
|
|
978
|
+
}
|
|
979
|
+
await messageHandler.showMessages();
|
|
980
|
+
throw err;
|
|
981
|
+
} finally {
|
|
982
|
+
BusyLocker.unlock(this.oLockObject);
|
|
983
|
+
}
|
|
1037
984
|
}
|
|
1038
985
|
/**
|
|
1039
986
|
* Calls a bound or unbound action.
|
|
@@ -1042,27 +989,27 @@ class TransactionHelper {
|
|
|
1042
989
|
* @static
|
|
1043
990
|
* @name sap.fe.core.TransactionHelper.callAction
|
|
1044
991
|
* @memberof sap.fe.core.TransactionHelper
|
|
1045
|
-
* @param
|
|
1046
|
-
* @param
|
|
1047
|
-
* @param
|
|
1048
|
-
* @param
|
|
1049
|
-
* @param
|
|
1050
|
-
* @param
|
|
1051
|
-
* @param
|
|
1052
|
-
* @param
|
|
992
|
+
* @param sActionName The name of the action to be called
|
|
993
|
+
* @param [mParameters] Contains the following attributes:
|
|
994
|
+
* @param [mParameters.contexts] Mandatory for a bound action: Either one context or an array with contexts for which the action is to be called
|
|
995
|
+
* @param [mParameters.model] Mandatory for an unbound action: An instance of an OData V4 model
|
|
996
|
+
* @param [mParameters.invocationGrouping] Mode how actions are to be called: 'ChangeSet' to put all action calls into one changeset, 'Isolated' to put them into separate changesets
|
|
997
|
+
* @param [mParameters.label] A human-readable label for the action
|
|
998
|
+
* @param [mParameters.bGetBoundContext] If specified, the action promise returns the bound context
|
|
999
|
+
* @param oView Contains the object of the current view
|
|
1053
1000
|
* @param messageHandler
|
|
1054
|
-
* @returns
|
|
1001
|
+
* @returns Promise resolves with an array of response objects (TODO: to be changed)
|
|
1055
1002
|
* @ui5-restricted
|
|
1056
1003
|
* @final
|
|
1057
|
-
|
|
1058
|
-
callAction(sActionName: string, mParameters: any, oView: View | null, messageHandler: any) {
|
|
1004
|
+
*/
|
|
1005
|
+
async callAction(sActionName: string, mParameters: any, oView: View | null, messageHandler: any): Promise<any> {
|
|
1059
1006
|
mParameters = getParameters(mParameters);
|
|
1060
1007
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
1061
1008
|
const that = this;
|
|
1062
|
-
let oContext, oModel: any
|
|
1009
|
+
let oContext, oModel: any;
|
|
1063
1010
|
const mBindingParameters = mParameters.bindingParameters;
|
|
1064
1011
|
if (!sActionName) {
|
|
1065
|
-
|
|
1012
|
+
throw new Error("Provide name of action to be executed");
|
|
1066
1013
|
}
|
|
1067
1014
|
// action imports are not directly obtained from the metaModel by it is present inside the entityContainer
|
|
1068
1015
|
// and the acions it refers to present outside the entitycontainer, hence to obtain kind of the action
|
|
@@ -1079,28 +1026,20 @@ class TransactionHelper {
|
|
|
1079
1026
|
oModel = mParameters.model;
|
|
1080
1027
|
}
|
|
1081
1028
|
if (!oModel) {
|
|
1082
|
-
|
|
1029
|
+
throw new Error("Pass a context for a bound action or pass the model for an unbound action");
|
|
1083
1030
|
}
|
|
1084
1031
|
// get the binding parameters $select and $expand for the side effect on this action
|
|
1085
1032
|
// also gather additional property paths to be requested such as text associations
|
|
1086
1033
|
const oAppComponent = that._getAppComponent();
|
|
1087
1034
|
const mSideEffectsParameters = oAppComponent.getSideEffectsService().getODataActionSideEffects(sActionName, oContext) || {};
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
},
|
|
1097
|
-
onContinue: function () {
|
|
1098
|
-
// Users continues the action with the bound contexts
|
|
1099
|
-
oApplicableContextDialog.close();
|
|
1100
|
-
resolve(mParameters.applicableContext);
|
|
1101
|
-
}
|
|
1102
|
-
};
|
|
1103
|
-
const fnOpenAndFillDialog = function () {
|
|
1035
|
+
|
|
1036
|
+
const displayUnapplicableContextsDialog = (): Promise<V4Context[] | void> => {
|
|
1037
|
+
if (!mParameters.notApplicableContext || mParameters.notApplicableContext.length === 0) {
|
|
1038
|
+
return Promise.resolve(mParameters.contexts);
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
return new Promise(async (resolve, reject) => {
|
|
1042
|
+
const fnOpenAndFillDialog = function (oDlg: Dialog) {
|
|
1104
1043
|
let oDialogContent;
|
|
1105
1044
|
const nNotApplicable = mParameters.notApplicableContext.length,
|
|
1106
1045
|
aNotApplicableItems = [];
|
|
@@ -1110,52 +1049,76 @@ class TransactionHelper {
|
|
|
1110
1049
|
}
|
|
1111
1050
|
const oNotApplicableItemsModel = new JSONModel(aNotApplicableItems);
|
|
1112
1051
|
const oTotals = new JSONModel({ total: nNotApplicable, label: mParameters.label });
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1052
|
+
oDlg.setModel(oNotApplicableItemsModel, "notApplicable");
|
|
1053
|
+
oDlg.setModel(oTotals, "totals");
|
|
1054
|
+
oDlg.open();
|
|
1116
1055
|
};
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
}
|
|
1056
|
+
// Show the contexts that are not applicable and will not therefore be processed
|
|
1057
|
+
const sFragmentName = "sap.fe.core.controls.ActionPartial";
|
|
1058
|
+
const oDialogFragment = XMLTemplateProcessor.loadTemplate(sFragmentName, "fragment");
|
|
1059
|
+
const oMetaModel = oModel.getMetaModel();
|
|
1060
|
+
const sCanonicalPath = mParameters.contexts[0].getCanonicalPath();
|
|
1061
|
+
const sEntitySet = `${sCanonicalPath.substr(0, sCanonicalPath.indexOf("("))}/`;
|
|
1062
|
+
const oDialogLabelModel = new JSONModel({
|
|
1063
|
+
title: mParameters.label
|
|
1064
|
+
});
|
|
1065
|
+
|
|
1066
|
+
try {
|
|
1067
|
+
const oFragment = await XMLPreprocessor.process(
|
|
1068
|
+
oDialogFragment,
|
|
1069
|
+
{ name: sFragmentName },
|
|
1070
|
+
{
|
|
1071
|
+
bindingContexts: {
|
|
1072
|
+
entityType: oMetaModel.createBindingContext(sEntitySet),
|
|
1073
|
+
label: oDialogLabelModel.createBindingContext("/")
|
|
1074
|
+
},
|
|
1075
|
+
models: {
|
|
1076
|
+
entityType: oMetaModel,
|
|
1077
|
+
metaModel: oMetaModel,
|
|
1078
|
+
label: oDialogLabelModel
|
|
1141
1079
|
}
|
|
1142
|
-
|
|
1143
|
-
)
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
}
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1080
|
+
}
|
|
1081
|
+
);
|
|
1082
|
+
// eslint-disable-next-line prefer-const
|
|
1083
|
+
let oDialog: Dialog;
|
|
1084
|
+
const oController = {
|
|
1085
|
+
onClose: function () {
|
|
1086
|
+
// User cancels action
|
|
1087
|
+
oDialog.close();
|
|
1088
|
+
resolve();
|
|
1089
|
+
},
|
|
1090
|
+
onContinue: function () {
|
|
1091
|
+
// Users continues the action with the bound contexts
|
|
1092
|
+
oDialog.close();
|
|
1093
|
+
resolve(mParameters.applicableContext);
|
|
1094
|
+
}
|
|
1095
|
+
};
|
|
1096
|
+
oDialog = (await Fragment.load({ definition: oFragment, controller: oController })) as Dialog;
|
|
1097
|
+
oController.onClose = function () {
|
|
1098
|
+
// User cancels action
|
|
1099
|
+
oDialog.close();
|
|
1100
|
+
resolve();
|
|
1101
|
+
};
|
|
1102
|
+
oController.onContinue = function () {
|
|
1103
|
+
// Users continues the action with the bound contexts
|
|
1104
|
+
oDialog.close();
|
|
1105
|
+
resolve(mParameters.applicableContext);
|
|
1106
|
+
};
|
|
1107
|
+
|
|
1108
|
+
mParameters.parentControl.addDependent(oDialog);
|
|
1109
|
+
fnOpenAndFillDialog(oDialog);
|
|
1110
|
+
} catch (oError) {
|
|
1111
|
+
reject(oError);
|
|
1155
1112
|
}
|
|
1156
|
-
})
|
|
1113
|
+
});
|
|
1114
|
+
};
|
|
1115
|
+
|
|
1116
|
+
try {
|
|
1117
|
+
let oResult: any;
|
|
1118
|
+
if (oContext && oModel) {
|
|
1119
|
+
const contextToProcess = await displayUnapplicableContextsDialog();
|
|
1157
1120
|
if (contextToProcess) {
|
|
1158
|
-
|
|
1121
|
+
oResult = await operations.callBoundAction(sActionName, contextToProcess, oModel, oAppComponent, {
|
|
1159
1122
|
invocationGrouping: mParameters.invocationGrouping,
|
|
1160
1123
|
label: mParameters.label,
|
|
1161
1124
|
showActionParameterDialog: true,
|
|
@@ -1177,44 +1140,38 @@ class TransactionHelper {
|
|
|
1177
1140
|
bGetBoundContext: mParameters.bGetBoundContext,
|
|
1178
1141
|
bObjectPage: mParameters.bObjectPage,
|
|
1179
1142
|
messageHandler: messageHandler,
|
|
1180
|
-
defaultValuesExtensionFunction: mParameters.defaultValuesExtensionFunction
|
|
1143
|
+
defaultValuesExtensionFunction: mParameters.defaultValuesExtensionFunction,
|
|
1144
|
+
selectedItems: mParameters.contexts
|
|
1181
1145
|
});
|
|
1182
1146
|
} else {
|
|
1183
|
-
|
|
1147
|
+
oResult = null;
|
|
1184
1148
|
}
|
|
1185
|
-
}
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
messageHandler: messageHandler,
|
|
1203
|
-
bObjectPage: mParameters.bObjectPage
|
|
1204
|
-
});
|
|
1205
|
-
}
|
|
1206
|
-
return oPromise
|
|
1207
|
-
.then(function (oResult: any) {
|
|
1208
|
-
// Succeeded
|
|
1209
|
-
return that._handleActionResponse(messageHandler, mParameters, sActionName).then(function () {
|
|
1210
|
-
return oResult;
|
|
1211
|
-
});
|
|
1212
|
-
})
|
|
1213
|
-
.catch(function (err: any) {
|
|
1214
|
-
return that._handleActionResponse(messageHandler, mParameters, sActionName).then(function () {
|
|
1215
|
-
return Promise.reject(err);
|
|
1149
|
+
} else {
|
|
1150
|
+
oResult = await operations.callActionImport(sActionName, oModel, oAppComponent, {
|
|
1151
|
+
label: mParameters.label,
|
|
1152
|
+
showActionParameterDialog: true,
|
|
1153
|
+
bindingParameters: mBindingParameters,
|
|
1154
|
+
entitySetName: mParameters.entitySetName,
|
|
1155
|
+
onSubmitted: function () {
|
|
1156
|
+
BusyLocker.lock(that.oLockObject);
|
|
1157
|
+
},
|
|
1158
|
+
onResponse: function () {
|
|
1159
|
+
BusyLocker.unlock(that.oLockObject);
|
|
1160
|
+
},
|
|
1161
|
+
parentControl: mParameters.parentControl,
|
|
1162
|
+
internalModelContext: mParameters.internalModelContext,
|
|
1163
|
+
operationAvailableMap: mParameters.operationAvailableMap,
|
|
1164
|
+
messageHandler: messageHandler,
|
|
1165
|
+
bObjectPage: mParameters.bObjectPage
|
|
1216
1166
|
});
|
|
1217
|
-
}
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
await this._handleActionResponse(messageHandler, mParameters, sActionName);
|
|
1170
|
+
return oResult;
|
|
1171
|
+
} catch (err: any) {
|
|
1172
|
+
await this._handleActionResponse(messageHandler, mParameters, sActionName);
|
|
1173
|
+
throw err;
|
|
1174
|
+
}
|
|
1218
1175
|
}
|
|
1219
1176
|
/**
|
|
1220
1177
|
* Handles messages for action call.
|
|
@@ -1223,9 +1180,9 @@ class TransactionHelper {
|
|
|
1223
1180
|
* @name sap.fe.core.TransactionHelper#_handleActionResponse
|
|
1224
1181
|
* @memberof sap.fe.core.TransactionHelper
|
|
1225
1182
|
* @param messageHandler
|
|
1226
|
-
* @param
|
|
1227
|
-
* @param
|
|
1228
|
-
* @returns
|
|
1183
|
+
* @param mParameters Parameters to be considered for the action.
|
|
1184
|
+
* @param sActionName The name of the action to be called
|
|
1185
|
+
* @returns Promise after message dialog is opened if required.
|
|
1229
1186
|
* @ui5-restricted
|
|
1230
1187
|
* @final
|
|
1231
1188
|
*/
|
|
@@ -1263,13 +1220,14 @@ class TransactionHelper {
|
|
|
1263
1220
|
* Shows a popover if it needs to be shown.
|
|
1264
1221
|
* TODO: Popover is shown if user has modified any data.
|
|
1265
1222
|
* TODO: Popover is shown if there's a difference from draft admin data.
|
|
1223
|
+
*
|
|
1266
1224
|
* @static
|
|
1267
1225
|
* @name sap.fe.core.TransactionHelper._showDiscardPopover
|
|
1268
1226
|
* @memberof sap.fe.core.TransactionHelper
|
|
1269
|
-
* @param
|
|
1227
|
+
* @param oCancelButton The control which will open the popover
|
|
1270
1228
|
* @param bIsModified
|
|
1271
1229
|
* @param oResourceBundle
|
|
1272
|
-
* @returns
|
|
1230
|
+
* @returns Promise resolves if user confirms discard, rejects if otherwise, rejects if no control passed to open popover
|
|
1273
1231
|
* @ui5-restricted
|
|
1274
1232
|
* @final
|
|
1275
1233
|
*/
|
|
@@ -1355,10 +1313,10 @@ class TransactionHelper {
|
|
|
1355
1313
|
* @private
|
|
1356
1314
|
* @name sap.fe.core.TransactionHelper._getOwnerComponent
|
|
1357
1315
|
* @memberof sap.fe.core.TransactionHelper
|
|
1358
|
-
* @returns
|
|
1316
|
+
* @returns The app component
|
|
1359
1317
|
* @ui5-restricted
|
|
1360
1318
|
* @final
|
|
1361
|
-
|
|
1319
|
+
*/
|
|
1362
1320
|
_getAppComponent() {
|
|
1363
1321
|
return this._oAppComponent;
|
|
1364
1322
|
}
|
|
@@ -1373,6 +1331,7 @@ class TransactionHelper {
|
|
|
1373
1331
|
// Setting value of field as '' in case of value help and validating other fields
|
|
1374
1332
|
oField.setValue(value);
|
|
1375
1333
|
fnValidateRequiredProperties();
|
|
1334
|
+
|
|
1376
1335
|
return oField.getValue();
|
|
1377
1336
|
})
|
|
1378
1337
|
.catch(function (value: any) {
|
|
@@ -1387,245 +1346,249 @@ class TransactionHelper {
|
|
|
1387
1346
|
});
|
|
1388
1347
|
}
|
|
1389
1348
|
}
|
|
1349
|
+
_getNonDeletableText(mParameters: any, vContexts: any, oResourceBundle: any) {
|
|
1350
|
+
const aNonDeletableContexts = mParameters.numberOfSelectedContexts - vContexts.concat(mParameters.unSavedContexts).length;
|
|
1351
|
+
return aNonDeletableContexts === 1
|
|
1352
|
+
? CommonUtils.getTranslatedText(
|
|
1353
|
+
"C_TRANSACTION_HELPER_CONFIRM_DELETE_WITH_OBJECTINFO_AND_ONE_OBJECT_NON_DELETABLE",
|
|
1354
|
+
oResourceBundle,
|
|
1355
|
+
[mParameters.numberOfSelectedContexts]
|
|
1356
|
+
)
|
|
1357
|
+
: CommonUtils.getTranslatedText(
|
|
1358
|
+
"C_TRANSACTION_HELPER_CONFIRM_DELETE_WITH_OBJECTINFO_AND_FEW_OBJECTS_NON_DELETABLE",
|
|
1359
|
+
oResourceBundle,
|
|
1360
|
+
[
|
|
1361
|
+
mParameters.numberOfSelectedContexts - vContexts.concat(mParameters.unSavedContexts).length,
|
|
1362
|
+
mParameters.numberOfSelectedContexts
|
|
1363
|
+
]
|
|
1364
|
+
);
|
|
1365
|
+
}
|
|
1390
1366
|
|
|
1391
|
-
_launchDialogWithKeyFields(oListBinding:
|
|
1392
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
1393
|
-
const that = this;
|
|
1367
|
+
_launchDialogWithKeyFields(oListBinding: ODataListBinding, mFields: any, oModel: ODataModel, mParameters: any, messageHandler: any) {
|
|
1394
1368
|
let oDialog: Dialog;
|
|
1395
1369
|
const oParentControl = mParameters.parentControl,
|
|
1396
1370
|
bSuccess = false;
|
|
1397
1371
|
|
|
1398
|
-
//
|
|
1372
|
+
// Crate a fake (transient) listBinding and context, just for the binding context of the dialog
|
|
1399
1373
|
const oTransientListBinding = oModel.bindList(oListBinding.getPath(), oListBinding.getContext(), [], [], {
|
|
1400
1374
|
$$updateGroupId: "submitLater"
|
|
1401
|
-
});
|
|
1375
|
+
}) as ODataListBinding;
|
|
1402
1376
|
oTransientListBinding.refreshInternal = function () {
|
|
1403
1377
|
/* */
|
|
1404
1378
|
};
|
|
1405
1379
|
const oTransientContext = oTransientListBinding.create(mParameters.data, true);
|
|
1406
1380
|
|
|
1407
|
-
return new Promise(
|
|
1381
|
+
return new Promise(async (resolve, reject) => {
|
|
1408
1382
|
const sFragmentName = "sap/fe/core/controls/NonComputedVisibleKeyFieldsDialog";
|
|
1409
1383
|
const oFragment = XMLTemplateProcessor.loadTemplate(sFragmentName, "fragment"),
|
|
1410
1384
|
oResourceBundle = oParentControl.getController().oResourceBundle,
|
|
1411
1385
|
oMetaModel = oModel.getMetaModel(),
|
|
1412
1386
|
aImmutableFields: any[] = [],
|
|
1413
|
-
oAppComponent =
|
|
1414
|
-
sPath = oListBinding.isRelative() ? oListBinding.getResolvedPath() : oListBinding.getPath(),
|
|
1415
|
-
oEntitySetContext = oMetaModel.createBindingContext(sPath),
|
|
1387
|
+
oAppComponent = this._getAppComponent(),
|
|
1388
|
+
sPath = (oListBinding.isRelative() ? oListBinding.getResolvedPath() : oListBinding.getPath()) as string,
|
|
1389
|
+
oEntitySetContext = oMetaModel.createBindingContext(sPath) as Context,
|
|
1416
1390
|
sMetaPath = oMetaModel.getMetaPath(sPath);
|
|
1417
1391
|
for (const i in mFields) {
|
|
1418
|
-
aImmutableFields.push(oMetaModel.createBindingContext(sMetaPath
|
|
1392
|
+
aImmutableFields.push(oMetaModel.createBindingContext(`${sMetaPath}/${mFields[i]}`));
|
|
1419
1393
|
}
|
|
1420
1394
|
const oImmutableCtxModel = new JSONModel(aImmutableFields);
|
|
1421
1395
|
const oImmutableCtx = oImmutableCtxModel.createBindingContext("/") as Context;
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1396
|
+
const aRequiredProperties = CommonUtils.getRequiredPropertiesFromInsertRestrictions(sMetaPath, oMetaModel);
|
|
1397
|
+
const oRequiredPropertyPathsCtxModel = new JSONModel(aRequiredProperties);
|
|
1398
|
+
const oRequiredPropertyPathsCtx = oRequiredPropertyPathsCtxModel.createBindingContext("/") as Context;
|
|
1399
|
+
const oNewFragment = await XMLPreprocessor.process(
|
|
1400
|
+
oFragment,
|
|
1401
|
+
{ name: sFragmentName },
|
|
1402
|
+
{
|
|
1403
|
+
bindingContexts: {
|
|
1404
|
+
entitySet: oEntitySetContext,
|
|
1405
|
+
fields: oImmutableCtx,
|
|
1406
|
+
requiredProperties: oRequiredPropertyPathsCtx
|
|
1407
|
+
},
|
|
1408
|
+
models: {
|
|
1409
|
+
entitySet: oEntitySetContext.getModel(),
|
|
1410
|
+
fields: oImmutableCtx.getModel(),
|
|
1411
|
+
metaModel: oMetaModel,
|
|
1412
|
+
requiredProperties: oRequiredPropertyPathsCtxModel
|
|
1436
1413
|
}
|
|
1437
|
-
|
|
1438
|
-
)
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1414
|
+
}
|
|
1415
|
+
);
|
|
1416
|
+
|
|
1417
|
+
let aFormElements: any[] = [];
|
|
1418
|
+
const mFieldValueMap: any = {};
|
|
1419
|
+
// eslint-disable-next-line prefer-const
|
|
1420
|
+
let oCreateButton: Button;
|
|
1421
|
+
|
|
1422
|
+
const validateRequiredProperties = async function () {
|
|
1423
|
+
let bEnabled = false;
|
|
1424
|
+
try {
|
|
1425
|
+
const aResults = await Promise.all(
|
|
1444
1426
|
aFormElements
|
|
1445
1427
|
.map(function (oFormElement: any) {
|
|
1446
1428
|
return oFormElement.getFields()[0];
|
|
1447
1429
|
})
|
|
1448
1430
|
.filter(function (oField: any) {
|
|
1449
|
-
// The continue button should remain disabled in case of
|
|
1450
|
-
return oField.getRequired() ||
|
|
1431
|
+
// The continue button should remain disabled in case of empty required fields.
|
|
1432
|
+
return oField.getRequired() || oField.getValueState() === ValueState.Error;
|
|
1451
1433
|
})
|
|
1452
|
-
.map(function (oField: any) {
|
|
1434
|
+
.map(async function (oField: any) {
|
|
1453
1435
|
const sFieldId = oField.getId();
|
|
1454
1436
|
if (sFieldId in mFieldValueMap) {
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
});
|
|
1437
|
+
try {
|
|
1438
|
+
const vValue = await mFieldValueMap[sFieldId];
|
|
1439
|
+
return oField.getValue() === "" ? undefined : vValue;
|
|
1440
|
+
} catch (err) {
|
|
1441
|
+
return undefined;
|
|
1442
|
+
}
|
|
1462
1443
|
}
|
|
1463
|
-
return oField.
|
|
1444
|
+
return oField.getValue() === "" ? undefined : oField.getValue();
|
|
1464
1445
|
})
|
|
1465
|
-
)
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
};
|
|
1501
|
-
return Fragment.load({
|
|
1502
|
-
definition: oFragment,
|
|
1503
|
-
controller: oController
|
|
1504
|
-
}).then(function (oDialogContent: any) {
|
|
1505
|
-
oDialog = new Dialog({
|
|
1506
|
-
title: CommonUtils.getTranslatedText("C_TRANSACTION_HELPER_SAPFE_ACTION_CREATE", oResourceBundle),
|
|
1507
|
-
content: [oDialogContent],
|
|
1508
|
-
beginButton: {
|
|
1509
|
-
text: CommonUtils.getTranslatedText("C_TRANSACTION_HELPER_SAPFE_ACTION_CREATE_BUTTON", oResourceBundle),
|
|
1510
|
-
type: "Emphasized",
|
|
1511
|
-
press: function (oEvent: any) {
|
|
1512
|
-
const oCreateButton = oEvent.getSource();
|
|
1513
|
-
let oNewDocumentContext: any;
|
|
1514
|
-
oCreateButton.setEnabled(false);
|
|
1515
|
-
BusyLocker.lock(oDialog);
|
|
1516
|
-
mParameters.bIsCreateDialog = true;
|
|
1517
|
-
return Promise.all(
|
|
1518
|
-
Object.keys(mFieldValueMap).map(function (sKey: string) {
|
|
1519
|
-
return mFieldValueMap[sKey].then(function (oValue: any) {
|
|
1520
|
-
const oDialogValue: any = {};
|
|
1521
|
-
oDialogValue[sKey] = oValue;
|
|
1522
|
-
return oDialogValue;
|
|
1523
|
-
});
|
|
1524
|
-
})
|
|
1525
|
-
)
|
|
1526
|
-
.then(function (aValues: any[]) {
|
|
1527
|
-
let onBeforeCreatePromise;
|
|
1528
|
-
if (mParameters.beforeCreateCallBack) {
|
|
1529
|
-
onBeforeCreatePromise = mParameters.beforeCreateCallBack({
|
|
1530
|
-
contextPath: oListBinding && oListBinding.getPath(),
|
|
1531
|
-
createParameters: aValues
|
|
1532
|
-
});
|
|
1533
|
-
} else {
|
|
1534
|
-
onBeforeCreatePromise = Promise.resolve();
|
|
1535
|
-
}
|
|
1536
|
-
return onBeforeCreatePromise;
|
|
1537
|
-
})
|
|
1538
|
-
.then(function () {
|
|
1539
|
-
const transientData = oTransientContext.getObject();
|
|
1540
|
-
const createData: any = {};
|
|
1541
|
-
Object.keys(transientData).forEach(function (sPropertyPath: string) {
|
|
1542
|
-
const oProperty = oMetaModel.getObject(`${sMetaPath}/${sPropertyPath}`);
|
|
1543
|
-
// ensure navigation properties are not part of the payload, deep create not supported
|
|
1544
|
-
if (oProperty && oProperty.$kind === "NavigationProperty") {
|
|
1545
|
-
return;
|
|
1546
|
-
}
|
|
1547
|
-
createData[sPropertyPath] = transientData[sPropertyPath];
|
|
1548
|
-
});
|
|
1549
|
-
oNewDocumentContext = oListBinding.create(
|
|
1550
|
-
createData,
|
|
1551
|
-
true,
|
|
1552
|
-
mParameters.createAtEnd,
|
|
1553
|
-
mParameters.inactive
|
|
1554
|
-
);
|
|
1555
|
-
|
|
1556
|
-
const oPromise = that.onAfterCreateCompletion(oListBinding, oNewDocumentContext, mParameters);
|
|
1446
|
+
);
|
|
1447
|
+
bEnabled = aResults.every(function (vValue: any) {
|
|
1448
|
+
if (Array.isArray(vValue)) {
|
|
1449
|
+
vValue = vValue[0];
|
|
1450
|
+
}
|
|
1451
|
+
return vValue !== undefined && vValue !== null && vValue !== "";
|
|
1452
|
+
});
|
|
1453
|
+
} catch (err) {
|
|
1454
|
+
bEnabled = false;
|
|
1455
|
+
}
|
|
1456
|
+
oCreateButton.setEnabled(bEnabled);
|
|
1457
|
+
};
|
|
1458
|
+
const oController = {
|
|
1459
|
+
/*
|
|
1460
|
+
fired on focus out from field or on selecting a value from the valuehelp.
|
|
1461
|
+
the create button is enabled when a value is added.
|
|
1462
|
+
liveChange is not fired when value is added from valuehelp.
|
|
1463
|
+
value validation is not done for create button enablement.
|
|
1464
|
+
*/
|
|
1465
|
+
handleChange: (oEvent: any) => {
|
|
1466
|
+
const sFieldId = oEvent.getParameter("id");
|
|
1467
|
+
mFieldValueMap[sFieldId] = this._onFieldChange(oEvent, oCreateButton, messageHandler, validateRequiredProperties);
|
|
1468
|
+
},
|
|
1469
|
+
/*
|
|
1470
|
+
fired on key press. the create button is enabled when a value is added.
|
|
1471
|
+
liveChange is not fired when value is added from valuehelp.
|
|
1472
|
+
value validation is not done for create button enablement.
|
|
1473
|
+
*/
|
|
1474
|
+
handleLiveChange: (oEvent: any) => {
|
|
1475
|
+
const sFieldId = oEvent.getParameter("id");
|
|
1476
|
+
const vValue = oEvent.getParameter("value");
|
|
1477
|
+
mFieldValueMap[sFieldId] = vValue;
|
|
1478
|
+
validateRequiredProperties();
|
|
1479
|
+
}
|
|
1480
|
+
};
|
|
1557
1481
|
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1482
|
+
const oDialogContent: any = await Fragment.load({
|
|
1483
|
+
definition: oNewFragment,
|
|
1484
|
+
controller: oController
|
|
1485
|
+
});
|
|
1486
|
+
oDialog = new Dialog({
|
|
1487
|
+
title: CommonUtils.getTranslatedText("C_TRANSACTION_HELPER_SAPFE_ACTION_CREATE", oResourceBundle),
|
|
1488
|
+
content: [oDialogContent],
|
|
1489
|
+
beginButton: {
|
|
1490
|
+
text: CommonUtils.getTranslatedText("C_TRANSACTION_HELPER_SAPFE_ACTION_CREATE_BUTTON", oResourceBundle),
|
|
1491
|
+
type: "Emphasized",
|
|
1492
|
+
press: async (oEvent: any) => {
|
|
1493
|
+
const createButton = oEvent.getSource();
|
|
1494
|
+
createButton.setEnabled(false);
|
|
1495
|
+
BusyLocker.lock(oDialog);
|
|
1496
|
+
mParameters.bIsCreateDialog = true;
|
|
1497
|
+
try {
|
|
1498
|
+
const aValues = await Promise.all(
|
|
1499
|
+
Object.keys(mFieldValueMap).map(async function (sKey: string) {
|
|
1500
|
+
const oValue = await mFieldValueMap[sKey];
|
|
1501
|
+
const oDialogValue: any = {};
|
|
1502
|
+
oDialogValue[sKey] = oValue;
|
|
1503
|
+
return oDialogValue;
|
|
1504
|
+
})
|
|
1505
|
+
);
|
|
1506
|
+
if (mParameters.beforeCreateCallBack) {
|
|
1507
|
+
await toES6Promise(
|
|
1508
|
+
mParameters.beforeCreateCallBack({
|
|
1509
|
+
contextPath: oListBinding && oListBinding.getPath(),
|
|
1510
|
+
createParameters: aValues
|
|
1571
1511
|
})
|
|
1572
|
-
|
|
1573
|
-
BusyLocker.unlock(oDialog);
|
|
1574
|
-
oCreateButton.setEnabled(true);
|
|
1575
|
-
return messageHandler.showMessages();
|
|
1576
|
-
});
|
|
1512
|
+
);
|
|
1577
1513
|
}
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1514
|
+
const transientData = oTransientContext.getObject();
|
|
1515
|
+
const createData: any = {};
|
|
1516
|
+
Object.keys(transientData).forEach(function (sPropertyPath: string) {
|
|
1517
|
+
const oProperty = oMetaModel.getObject(`${sMetaPath}/${sPropertyPath}`);
|
|
1518
|
+
// ensure navigation properties are not part of the payload, deep create not supported
|
|
1519
|
+
if (oProperty && oProperty.$kind === "NavigationProperty") {
|
|
1520
|
+
return;
|
|
1521
|
+
}
|
|
1522
|
+
createData[sPropertyPath] = transientData[sPropertyPath];
|
|
1523
|
+
});
|
|
1524
|
+
const oNewDocumentContext = oListBinding.create(
|
|
1525
|
+
createData,
|
|
1526
|
+
true,
|
|
1527
|
+
mParameters.createAtEnd,
|
|
1528
|
+
mParameters.inactive
|
|
1529
|
+
);
|
|
1530
|
+
|
|
1531
|
+
const oPromise = this.onAfterCreateCompletion(oListBinding, oNewDocumentContext, mParameters);
|
|
1532
|
+
let oResponse: any = await oPromise;
|
|
1533
|
+
if (!oResponse || (oResponse && oResponse.bKeepDialogOpen !== true)) {
|
|
1534
|
+
oResponse = oResponse ?? {};
|
|
1535
|
+
oDialog.setBindingContext(null as any);
|
|
1582
1536
|
oDialog.close();
|
|
1537
|
+
oResponse.newContext = oNewDocumentContext;
|
|
1538
|
+
resolve(oResponse);
|
|
1583
1539
|
}
|
|
1584
|
-
}
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
(oDialog
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
if (!bSuccess) {
|
|
1591
|
-
reject({
|
|
1592
|
-
bDeleteTransientContext: true,
|
|
1593
|
-
navigateBackFromTransientState: true
|
|
1594
|
-
});
|
|
1595
|
-
}
|
|
1540
|
+
} catch (oError: any) {
|
|
1541
|
+
reject(oError);
|
|
1542
|
+
} finally {
|
|
1543
|
+
BusyLocker.unlock(oDialog);
|
|
1544
|
+
createButton.setEnabled(true);
|
|
1545
|
+
messageHandler.showMessages();
|
|
1596
1546
|
}
|
|
1597
|
-
} as any);
|
|
1598
|
-
aFormElements = oDialogContent
|
|
1599
|
-
.getAggregation("form")
|
|
1600
|
-
.getAggregation("formContainers")[0]
|
|
1601
|
-
.getAggregation("formElements");
|
|
1602
|
-
if (oParentControl && oParentControl.addDependent) {
|
|
1603
|
-
// if there is a parent control specified add the dialog as dependent
|
|
1604
|
-
oParentControl.addDependent(oDialog);
|
|
1605
1547
|
}
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
)
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
.catch(function (oError: any) {
|
|
1623
|
-
return messageHandler.showMessages().then(function () {
|
|
1624
|
-
return Promise.reject(oError);
|
|
1625
|
-
});
|
|
1548
|
+
},
|
|
1549
|
+
endButton: {
|
|
1550
|
+
text: CommonUtils.getTranslatedText("C_COMMON_ACTION_PARAMETER_DIALOG_CANCEL", oResourceBundle),
|
|
1551
|
+
press: function () {
|
|
1552
|
+
oDialog.close();
|
|
1553
|
+
}
|
|
1554
|
+
},
|
|
1555
|
+
afterClose: function () {
|
|
1556
|
+
// show footer as per UX guidelines when dialog is not open
|
|
1557
|
+
(oDialog.getBindingContext("internal") as InternalModelContext)?.setProperty("isCreateDialogOpen", false);
|
|
1558
|
+
oDialog.destroy();
|
|
1559
|
+
oTransientListBinding.destroy();
|
|
1560
|
+
if (!bSuccess) {
|
|
1561
|
+
reject({
|
|
1562
|
+
bDeleteTransientContext: true,
|
|
1563
|
+
navigateBackFromTransientState: true
|
|
1626
1564
|
});
|
|
1627
|
-
|
|
1628
|
-
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
} as any);
|
|
1568
|
+
aFormElements = oDialogContent?.getAggregation("form").getAggregation("formContainers")[0].getAggregation("formElements");
|
|
1569
|
+
if (oParentControl && oParentControl.addDependent) {
|
|
1570
|
+
// if there is a parent control specified add the dialog as dependent
|
|
1571
|
+
oParentControl.addDependent(oDialog);
|
|
1572
|
+
}
|
|
1573
|
+
oCreateButton = oDialog.getBeginButton();
|
|
1574
|
+
oDialog.setBindingContext(oTransientContext);
|
|
1575
|
+
try {
|
|
1576
|
+
await CommonUtils.setUserDefaults(
|
|
1577
|
+
oAppComponent,
|
|
1578
|
+
aImmutableFields,
|
|
1579
|
+
oTransientContext,
|
|
1580
|
+
false,
|
|
1581
|
+
mParameters.createAction,
|
|
1582
|
+
mParameters.data
|
|
1583
|
+
);
|
|
1584
|
+
validateRequiredProperties();
|
|
1585
|
+
// footer must not be visible when the dialog is open as per UX guidelines
|
|
1586
|
+
(oDialog.getBindingContext("internal") as InternalModelContext).setProperty("isCreateDialogOpen", true);
|
|
1587
|
+
oDialog.open();
|
|
1588
|
+
} catch (oError: any) {
|
|
1589
|
+
await messageHandler.showMessages();
|
|
1590
|
+
throw oError;
|
|
1591
|
+
}
|
|
1629
1592
|
});
|
|
1630
1593
|
}
|
|
1631
1594
|
onAfterCreateCompletion(oListBinding: any, oNewDocumentContext: any, mParameters: any) {
|
|
@@ -1685,14 +1648,14 @@ class TransactionHelper {
|
|
|
1685
1648
|
* @private
|
|
1686
1649
|
* @name sap.fe.core.TransactionHelper._getNewAction
|
|
1687
1650
|
* @memberof sap.fe.core.TransactionHelper
|
|
1688
|
-
* @param
|
|
1689
|
-
* @param
|
|
1690
|
-
* @param
|
|
1691
|
-
* @param
|
|
1692
|
-
* @returns
|
|
1651
|
+
* @param oStartupParameters Startup parameters of the application
|
|
1652
|
+
* @param sCreateHash Hash to be checked for action type
|
|
1653
|
+
* @param oMetaModel The MetaModel used to check for NewAction parameter
|
|
1654
|
+
* @param sMetaPath The MetaPath
|
|
1655
|
+
* @returns The name of the action
|
|
1693
1656
|
* @ui5-restricted
|
|
1694
1657
|
* @final
|
|
1695
|
-
|
|
1658
|
+
*/
|
|
1696
1659
|
_getNewAction(oStartupParameters: any, sCreateHash: string, oMetaModel: ODataMetaModel, sMetaPath: string) {
|
|
1697
1660
|
let sNewAction;
|
|
1698
1661
|
|
|
@@ -1703,8 +1666,8 @@ class TransactionHelper {
|
|
|
1703
1666
|
} else {
|
|
1704
1667
|
sNewAction =
|
|
1705
1668
|
oMetaModel && oMetaModel.getObject !== undefined
|
|
1706
|
-
? oMetaModel.getObject(sMetaPath
|
|
1707
|
-
oMetaModel.getObject(sMetaPath
|
|
1669
|
+
? oMetaModel.getObject(`${sMetaPath}@com.sap.vocabularies.Session.v1.StickySessionSupported/NewAction`) ||
|
|
1670
|
+
oMetaModel.getObject(`${sMetaPath}@com.sap.vocabularies.Common.v1.DraftRoot/NewAction`)
|
|
1708
1671
|
: undefined;
|
|
1709
1672
|
}
|
|
1710
1673
|
return sNewAction;
|
|
@@ -1722,14 +1685,14 @@ class TransactionHelper {
|
|
|
1722
1685
|
* @private
|
|
1723
1686
|
* @name sap.fe.core.TransactionHelper._getSpecificCreateActionDialogLabel
|
|
1724
1687
|
* @memberof sap.fe.core.TransactionHelper
|
|
1725
|
-
* @param
|
|
1726
|
-
* @param
|
|
1727
|
-
* @param
|
|
1728
|
-
* @param
|
|
1729
|
-
* @returns
|
|
1688
|
+
* @param oMetaModel The MetaModel used to check for the NewAction parameter
|
|
1689
|
+
* @param sMetaPath The MetaPath
|
|
1690
|
+
* @param sNewAction Contains the name of the action to be executed
|
|
1691
|
+
* @param oResourceBundleCore ResourceBundle to access the default Create label
|
|
1692
|
+
* @returns The label for the Create Action Dialog
|
|
1730
1693
|
* @ui5-restricted
|
|
1731
1694
|
* @final
|
|
1732
|
-
|
|
1695
|
+
*/
|
|
1733
1696
|
_getSpecificCreateActionDialogLabel(
|
|
1734
1697
|
oMetaModel: ODataMetaModel,
|
|
1735
1698
|
sMetaPath: string,
|
|
@@ -1737,15 +1700,15 @@ class TransactionHelper {
|
|
|
1737
1700
|
oResourceBundleCore: ResourceBundle
|
|
1738
1701
|
) {
|
|
1739
1702
|
const fnGetLabelFromLineItemAnnotation = function () {
|
|
1740
|
-
if (oMetaModel && oMetaModel.getObject(sMetaPath
|
|
1703
|
+
if (oMetaModel && oMetaModel.getObject(`${sMetaPath}/@com.sap.vocabularies.UI.v1.LineItem`)) {
|
|
1741
1704
|
const iLineItemIndex = oMetaModel
|
|
1742
|
-
.getObject(sMetaPath
|
|
1705
|
+
.getObject(`${sMetaPath}/@com.sap.vocabularies.UI.v1.LineItem`)
|
|
1743
1706
|
.findIndex(function (oLineItem: any) {
|
|
1744
1707
|
const aLineItemAction = oLineItem.Action ? oLineItem.Action.split("(") : undefined;
|
|
1745
1708
|
return aLineItemAction ? aLineItemAction[0] === sNewAction : false;
|
|
1746
1709
|
});
|
|
1747
1710
|
return iLineItemIndex > -1
|
|
1748
|
-
? oMetaModel.getObject(sMetaPath
|
|
1711
|
+
? oMetaModel.getObject(`${sMetaPath}/@com.sap.vocabularies.UI.v1.LineItem`)[iLineItemIndex].Label
|
|
1749
1712
|
: undefined;
|
|
1750
1713
|
} else {
|
|
1751
1714
|
return undefined;
|
|
@@ -1754,7 +1717,7 @@ class TransactionHelper {
|
|
|
1754
1717
|
|
|
1755
1718
|
return (
|
|
1756
1719
|
fnGetLabelFromLineItemAnnotation() ||
|
|
1757
|
-
(oMetaModel && oMetaModel.getObject(sMetaPath
|
|
1720
|
+
(oMetaModel && oMetaModel.getObject(`${sMetaPath}/${sNewAction}@com.sap.vocabularies.Common.v1.Label`)) ||
|
|
1758
1721
|
(oResourceBundleCore && oResourceBundleCore.getText("C_TRANSACTION_HELPER_SAPFE_ACTION_CREATE"))
|
|
1759
1722
|
);
|
|
1760
1723
|
}
|