@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,4 +1,6 @@
|
|
|
1
|
+
import ResourceBundle from "sap/base/i18n/ResourceBundle";
|
|
1
2
|
import Log from "sap/base/Log";
|
|
3
|
+
import ActionRuntime from "sap/fe/core/ActionRuntime";
|
|
2
4
|
import CommonUtils from "sap/fe/core/CommonUtils";
|
|
3
5
|
import BusyLocker from "sap/fe/core/controllerextensions/BusyLocker";
|
|
4
6
|
import messageHandling from "sap/fe/core/controllerextensions/messageHandler/messageHandling";
|
|
@@ -8,6 +10,7 @@ import FELibrary from "sap/fe/core/library";
|
|
|
8
10
|
import Button from "sap/m/Button";
|
|
9
11
|
import Dialog from "sap/m/Dialog";
|
|
10
12
|
import MessageBox from "sap/m/MessageBox";
|
|
13
|
+
import type Control from "sap/ui/core/Control";
|
|
11
14
|
import Core from "sap/ui/core/Core";
|
|
12
15
|
import Fragment from "sap/ui/core/Fragment";
|
|
13
16
|
import XMLPreprocessor from "sap/ui/core/util/XMLPreprocessor";
|
|
@@ -25,22 +28,22 @@ const Action = (MessageBox as any).Action;
|
|
|
25
28
|
* @static
|
|
26
29
|
* @name sap.fe.core.actions.operations.callBoundAction
|
|
27
30
|
* @memberof sap.fe.core.actions.operations
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
32
|
-
* @param
|
|
33
|
-
* @param
|
|
34
|
-
* @param
|
|
35
|
-
* @param
|
|
36
|
-
* @param
|
|
37
|
-
* @param
|
|
38
|
-
* @param
|
|
39
|
-
* @param
|
|
40
|
-
* @param
|
|
41
|
-
* @param
|
|
42
|
-
* @param
|
|
43
|
-
* @returns
|
|
31
|
+
* @param sActionName The name of the action to be called
|
|
32
|
+
* @param contexts Either one context or an array with contexts for which the action is to be be called
|
|
33
|
+
* @param oModel OData Model
|
|
34
|
+
* @param oAppComponent The AppComponent
|
|
35
|
+
* @param [mParameters] Optional, can contain the following attributes:
|
|
36
|
+
* @param [mParameters.actionParameters] A map of parameters to be sent for every action call
|
|
37
|
+
* @param [mParameters.mBindingParameters] A map of binding parameters that would be part of $select and $expand coming from side effects for bound actions
|
|
38
|
+
* @param [mParameters.additionalSideEffect] Array of property paths to be requested in addition to actual target properties of the side effect
|
|
39
|
+
* @param [mParameters.showActionParameterDialog] If set and if parameters exist the user retrieves a dialog to fill in parameters, if actionParameters are passed they are shown to the user
|
|
40
|
+
* @param [mParameters.label] A human-readable label for the action
|
|
41
|
+
* @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, defaults to Isolated
|
|
42
|
+
* @param [mParameters.onSubmitted] Function which is called once the actions are submitted with an array of promises
|
|
43
|
+
* @param [mParameters.defaultParameters] Can contain default parameters from FLP user defaults
|
|
44
|
+
* @param [mParameters.parentControl] If specified the dialogs are added as dependent of the parent control
|
|
45
|
+
* @param [mParameters.bGetBoundContext] If specified the action promise returns the bound context
|
|
46
|
+
* @returns Promise resolves with an array of response objects (TODO: to be changed)
|
|
44
47
|
* @private
|
|
45
48
|
* @ui5-restricted
|
|
46
49
|
*/
|
|
@@ -57,8 +60,8 @@ function callBoundAction(sActionName: string, contexts: any, oModel: any, oAppCo
|
|
|
57
60
|
contexts = [contexts];
|
|
58
61
|
}
|
|
59
62
|
const oMetaModel = oModel.getMetaModel(),
|
|
60
|
-
sActionPath = oMetaModel.getMetaPath(contexts[0].getPath())
|
|
61
|
-
oBoundAction = oMetaModel.createBindingContext(sActionPath
|
|
63
|
+
sActionPath = `${oMetaModel.getMetaPath(contexts[0].getPath())}/${sActionName}`,
|
|
64
|
+
oBoundAction = oMetaModel.createBindingContext(`${sActionPath}/@$ui5.overload/0`);
|
|
62
65
|
mParameters.aContexts = contexts;
|
|
63
66
|
mParameters.isCriticalAction = getIsActionCritical(oMetaModel, sActionPath, contexts, oBoundAction);
|
|
64
67
|
return callAction(sActionName, oModel, oBoundAction, oAppComponent, mParameters);
|
|
@@ -70,16 +73,16 @@ function callBoundAction(sActionName: string, contexts: any, oModel: any, oAppCo
|
|
|
70
73
|
* @static
|
|
71
74
|
* @name sap.fe.core.actions.operations.callActionImport
|
|
72
75
|
* @memberof sap.fe.core.actions.operations
|
|
73
|
-
* @param
|
|
74
|
-
* @param
|
|
75
|
-
* @param
|
|
76
|
-
* @param
|
|
77
|
-
* @param
|
|
78
|
-
* @param
|
|
79
|
-
* @param
|
|
80
|
-
* @param
|
|
81
|
-
* @param
|
|
82
|
-
* @returns
|
|
76
|
+
* @param sActionName The name of the action import to be called
|
|
77
|
+
* @param oModel An instance of an OData v4 model
|
|
78
|
+
* @param oAppComponent The AppComponent
|
|
79
|
+
* @param [mParameters] Optional, can contain the following attributes:
|
|
80
|
+
* @param [mParameters.actionParameters] A map of parameters to be sent with the action import
|
|
81
|
+
* @param [mParameters.label] A human-readable label for the action
|
|
82
|
+
* @param [mParameters.showActionParameterDialog] If set and if parameters exist the user retrieves a dialog to fill in parameters, if actionParameters are passed they are shown to the user
|
|
83
|
+
* @param [mParameters.onSubmitted] Function which is called once the actions are submitted with an array of promises
|
|
84
|
+
* @param [mParameters.defaultParameters] Can contain default parameters from FLP user defaults
|
|
85
|
+
* @returns Promise resolves with an array of response objects (TODO: to be changed)
|
|
83
86
|
* @private
|
|
84
87
|
* @ui5-restricted
|
|
85
88
|
*/
|
|
@@ -88,9 +91,9 @@ function callActionImport(sActionName: string, oModel: any, oAppComponent: objec
|
|
|
88
91
|
return Promise.reject("Action expects a model/context for execution");
|
|
89
92
|
}
|
|
90
93
|
const oMetaModel = oModel.getMetaModel(),
|
|
91
|
-
sActionPath = oModel.bindContext(
|
|
92
|
-
oActionImport = oMetaModel.createBindingContext(
|
|
93
|
-
mParameters.isCriticalAction = getIsActionCritical(oMetaModel, sActionPath
|
|
94
|
+
sActionPath = oModel.bindContext(`/${sActionName}`).getPath(),
|
|
95
|
+
oActionImport = oMetaModel.createBindingContext(`/${oMetaModel.createBindingContext(sActionPath).getObject("$Action")}/0`);
|
|
96
|
+
mParameters.isCriticalAction = getIsActionCritical(oMetaModel, `${sActionPath}/@$ui5.overload`);
|
|
94
97
|
return callAction(sActionName, oModel, oActionImport, oAppComponent, mParameters);
|
|
95
98
|
}
|
|
96
99
|
function callBoundFunction(sFunctionName: string, context: any, oModel: any) {
|
|
@@ -98,7 +101,7 @@ function callBoundFunction(sFunctionName: string, context: any, oModel: any) {
|
|
|
98
101
|
return Promise.reject("Bound functions always requires a context");
|
|
99
102
|
}
|
|
100
103
|
const oMetaModel = oModel.getMetaModel(),
|
|
101
|
-
sFunctionPath = oMetaModel.getMetaPath(context.getPath())
|
|
104
|
+
sFunctionPath = `${oMetaModel.getMetaPath(context.getPath())}/${sFunctionName}`,
|
|
102
105
|
oBoundFunction = oMetaModel.createBindingContext(sFunctionPath);
|
|
103
106
|
return _executeFunction(sFunctionName, oModel, oBoundFunction, context);
|
|
104
107
|
}
|
|
@@ -109,9 +112,9 @@ function callBoundFunction(sFunctionName: string, context: any, oModel: any) {
|
|
|
109
112
|
* @static
|
|
110
113
|
* @name sap.fe.core.actions.operations.callFunctionImport
|
|
111
114
|
* @memberof sap.fe.core.actions.operations
|
|
112
|
-
* @param
|
|
113
|
-
* @param
|
|
114
|
-
* @returns
|
|
115
|
+
* @param sFunctionName The name of the function to be called
|
|
116
|
+
* @param oModel An instance of an OData v4 model
|
|
117
|
+
* @returns Promise resolves
|
|
115
118
|
* @private
|
|
116
119
|
*/
|
|
117
120
|
function callFunctionImport(sFunctionName: string, oModel: any) {
|
|
@@ -119,22 +122,20 @@ function callFunctionImport(sFunctionName: string, oModel: any) {
|
|
|
119
122
|
return Promise.resolve();
|
|
120
123
|
}
|
|
121
124
|
const oMetaModel = oModel.getMetaModel(),
|
|
122
|
-
sFunctionPath = oModel.bindContext(
|
|
123
|
-
oFunctionImport = oMetaModel.createBindingContext(
|
|
124
|
-
"/" + oMetaModel.createBindingContext(sFunctionPath).getObject("$Function") + "/0"
|
|
125
|
-
);
|
|
125
|
+
sFunctionPath = oModel.bindContext(`/${sFunctionName}`).getPath(),
|
|
126
|
+
oFunctionImport = oMetaModel.createBindingContext(`/${oMetaModel.createBindingContext(sFunctionPath).getObject("$Function")}/0`);
|
|
126
127
|
return _executeFunction(sFunctionName, oModel, oFunctionImport);
|
|
127
128
|
}
|
|
128
129
|
function _executeFunction(sFunctionName: any, oModel: any, oFunction: any, context?: any) {
|
|
129
130
|
let sGroupId;
|
|
130
131
|
if (!oFunction || !oFunction.getObject()) {
|
|
131
|
-
return Promise.reject(new Error(
|
|
132
|
+
return Promise.reject(new Error(`Function ${sFunctionName} not found`));
|
|
132
133
|
}
|
|
133
134
|
if (context) {
|
|
134
|
-
oFunction = oModel.bindContext(sFunctionName
|
|
135
|
+
oFunction = oModel.bindContext(`${sFunctionName}(...)`, context);
|
|
135
136
|
sGroupId = "functionGroup";
|
|
136
137
|
} else {
|
|
137
|
-
oFunction = oModel.bindContext(
|
|
138
|
+
oFunction = oModel.bindContext(`/${sFunctionName}(...)`);
|
|
138
139
|
sGroupId = "functionImport";
|
|
139
140
|
}
|
|
140
141
|
const oFunctionPromise = oFunction.execute(sGroupId);
|
|
@@ -162,14 +163,13 @@ function callAction(sActionName: any, oModel: any, oAction: any, oAppComponent:
|
|
|
162
163
|
let oReturnType;
|
|
163
164
|
const actionDefinition = oAction.getObject();
|
|
164
165
|
if (!oAction || !oAction.getObject()) {
|
|
165
|
-
return reject(new Error(
|
|
166
|
-
}
|
|
167
|
-
if (bShowActionParameterDialog || aActionParameters.length > 0) {
|
|
168
|
-
aActionParameters = prepareActionParameters(oAction, aActionParameters);
|
|
169
|
-
if (!aActionParameters || aActionParameters.length === 0) {
|
|
170
|
-
bShowActionParameterDialog = false;
|
|
171
|
-
}
|
|
166
|
+
return reject(new Error(`Action ${sActionName} not found`));
|
|
172
167
|
}
|
|
168
|
+
|
|
169
|
+
aActionParameters = getActionParameters(oAction);
|
|
170
|
+
|
|
171
|
+
bShowActionParameterDialog = _showActionParameterDialog(bShowActionParameterDialog, aActionParameters);
|
|
172
|
+
|
|
173
173
|
if (bShowActionParameterDialog) {
|
|
174
174
|
fnDialog = showActionParameterDialog;
|
|
175
175
|
} else if (bIsCriticalAction) {
|
|
@@ -183,13 +183,14 @@ function callAction(sActionName: any, oModel: any, oAction: any, oAppComponent:
|
|
|
183
183
|
aActionParameters: aActionParameters,
|
|
184
184
|
bGetBoundContext: mParameters.bGetBoundContext,
|
|
185
185
|
defaultValuesExtensionFunction: mParameters.defaultValuesExtensionFunction,
|
|
186
|
-
label: mParameters.label
|
|
186
|
+
label: mParameters.label,
|
|
187
|
+
selectedItems: mParameters.selectedItems
|
|
187
188
|
};
|
|
188
189
|
if (oAction.getObject("$IsBound")) {
|
|
189
190
|
if (mParameters.additionalSideEffect && mParameters.additionalSideEffect.pathExpressions) {
|
|
190
191
|
oMetaModel = oModel.getMetaModel();
|
|
191
192
|
sMetaPath = oMetaModel.getMetaPath(aContexts[0].getPath());
|
|
192
|
-
sMessagesPath = oMetaModel.getObject(sMetaPath
|
|
193
|
+
sMessagesPath = oMetaModel.getObject(`${sMetaPath}/@com.sap.vocabularies.Common.v1.Messages/$Path`);
|
|
193
194
|
|
|
194
195
|
if (sMessagesPath) {
|
|
195
196
|
iMessageSideEffect = mParameters.additionalSideEffect.pathExpressions.findIndex(function (exp: any) {
|
|
@@ -208,12 +209,12 @@ function callAction(sActionName: any, oModel: any, oAction: any, oAppComponent:
|
|
|
208
209
|
mParameters.mBindingParameters = mParameters.mBindingParameters || {};
|
|
209
210
|
|
|
210
211
|
if (
|
|
211
|
-
oAction.getObject(
|
|
212
|
+
oAction.getObject(`$ReturnType/$Type/${sMessagesPath}`) &&
|
|
212
213
|
(!mParameters.mBindingParameters.$select ||
|
|
213
214
|
mParameters.mBindingParameters.$select.split(",").indexOf(sMessagesPath) === -1)
|
|
214
215
|
) {
|
|
215
216
|
mParameters.mBindingParameters.$select = mParameters.mBindingParameters.$select
|
|
216
|
-
? mParameters.mBindingParameters.$select
|
|
217
|
+
? `${mParameters.mBindingParameters.$select},${sMessagesPath}`
|
|
217
218
|
: sMessagesPath;
|
|
218
219
|
// Add side effects at entity level because $select stops these being returned by the action
|
|
219
220
|
// Only if no other side effects were added for Messages
|
|
@@ -237,6 +238,7 @@ function callAction(sActionName: any, oModel: any, oAction: any, oAppComponent:
|
|
|
237
238
|
mActionExecutionParameters.bReturnAsArray = mParameters.bReturnAsArray;
|
|
238
239
|
mActionExecutionParameters.internalModelContext = mParameters.internalModelContext;
|
|
239
240
|
mActionExecutionParameters.operationAvailableMap = mParameters.operationAvailableMap;
|
|
241
|
+
mActionExecutionParameters.isCreateAction = bIsCreateAction;
|
|
240
242
|
mActionExecutionParameters.bObjectPage = mParameters.bObjectPage;
|
|
241
243
|
if (mParameters.controlId) {
|
|
242
244
|
mActionExecutionParameters.control = mParameters.parentControl.byId(mParameters.controlId);
|
|
@@ -260,7 +262,7 @@ function callAction(sActionName: any, oModel: any, oAction: any, oAppComponent:
|
|
|
260
262
|
mParameters.messageHandler
|
|
261
263
|
);
|
|
262
264
|
} else {
|
|
263
|
-
oActionPromise = _executeAction(oAppComponent, mActionExecutionParameters);
|
|
265
|
+
oActionPromise = _executeAction(oAppComponent, mActionExecutionParameters, mParameters.parentControl);
|
|
264
266
|
}
|
|
265
267
|
return oActionPromise
|
|
266
268
|
.then(function (oOperationResult: any) {
|
|
@@ -280,10 +282,11 @@ function callAction(sActionName: any, oModel: any, oAction: any, oAppComponent:
|
|
|
280
282
|
);
|
|
281
283
|
});
|
|
282
284
|
if (!isStatic) {
|
|
283
|
-
|
|
285
|
+
ActionRuntime.setActionEnablement(
|
|
284
286
|
mActionExecutionParameters.internalModelContext,
|
|
285
287
|
JSON.parse(mActionExecutionParameters.operationAvailableMap),
|
|
286
|
-
|
|
288
|
+
mParameters.selectedItems,
|
|
289
|
+
"table"
|
|
287
290
|
);
|
|
288
291
|
}
|
|
289
292
|
}
|
|
@@ -309,7 +312,7 @@ function confirmCriticalAction(
|
|
|
309
312
|
let boundActionName = sActionName ? sActionName : null;
|
|
310
313
|
boundActionName =
|
|
311
314
|
boundActionName.indexOf(".") >= 0 ? boundActionName.split(".")[boundActionName.split(".").length - 1] : boundActionName;
|
|
312
|
-
const suffixResourceKey = boundActionName && entitySetName ? entitySetName
|
|
315
|
+
const suffixResourceKey = boundActionName && entitySetName ? `${entitySetName}|${boundActionName}` : "";
|
|
313
316
|
const oResourceBundle = oParentControl.getController().oResourceBundle;
|
|
314
317
|
const sConfirmationText = CommonUtils.getTranslatedText(
|
|
315
318
|
"C_OPERATIONS_ACTION_CONFIRM_MESSAGE",
|
|
@@ -319,22 +322,19 @@ function confirmCriticalAction(
|
|
|
319
322
|
);
|
|
320
323
|
|
|
321
324
|
MessageBox.confirm(sConfirmationText, {
|
|
322
|
-
onClose: function (sAction: any) {
|
|
325
|
+
onClose: async function (sAction: any) {
|
|
323
326
|
if (sAction === Action.OK) {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
messageHandler
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
reject(oError);
|
|
336
|
-
});
|
|
337
|
-
});
|
|
327
|
+
try {
|
|
328
|
+
const oOperation = await _executeAction(oAppComponent, mParameters, oParentControl);
|
|
329
|
+
resolve(oOperation);
|
|
330
|
+
} catch (oError: any) {
|
|
331
|
+
try {
|
|
332
|
+
await messageHandler.showMessageDialog();
|
|
333
|
+
reject(oError);
|
|
334
|
+
} catch (e) {
|
|
335
|
+
reject(oError);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
338
|
} else {
|
|
339
339
|
resolve();
|
|
340
340
|
}
|
|
@@ -360,8 +360,9 @@ function showActionParameterDialog(
|
|
|
360
360
|
? oActionContext.getPath().split("/@$ui5.overload/0")[0]
|
|
361
361
|
: oActionContext.getPath().split("/0")[0],
|
|
362
362
|
actionNameContext = metaModel.createBindingContext(sActionNamePath),
|
|
363
|
+
bIsCreateAction = mParameters.isCreateAction,
|
|
363
364
|
sFragmentName = "sap/fe/core/controls/ActionParameterDialog";
|
|
364
|
-
return new Promise(function (resolve
|
|
365
|
+
return new Promise(async function (resolve, reject) {
|
|
365
366
|
const oFragment = XMLTemplateProcessor.loadTemplate(sFragmentName, "fragment");
|
|
366
367
|
const oParameterModel = new JSONModel({
|
|
367
368
|
$displayMode: {}
|
|
@@ -369,8 +370,8 @@ function showActionParameterDialog(
|
|
|
369
370
|
let aFieldInvalid: any[] = [];
|
|
370
371
|
let aFormElements: any[] = [];
|
|
371
372
|
const mFieldValueMap: any = {};
|
|
372
|
-
const validateRequiredProperties = function () {
|
|
373
|
-
|
|
373
|
+
const validateRequiredProperties = async function () {
|
|
374
|
+
const aResults = await Promise.all(
|
|
374
375
|
aFormElements
|
|
375
376
|
.filter(function (oFormElement: any) {
|
|
376
377
|
const oField = oFormElement.getFields()[0];
|
|
@@ -384,41 +385,38 @@ function showActionParameterDialog(
|
|
|
384
385
|
return oFormElement.getLabel().getText();
|
|
385
386
|
}
|
|
386
387
|
})
|
|
387
|
-
)
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
});
|
|
391
|
-
return aResults;
|
|
388
|
+
);
|
|
389
|
+
return aResults.filter(function (result: any) {
|
|
390
|
+
return result !== undefined;
|
|
392
391
|
});
|
|
393
392
|
};
|
|
394
|
-
const _validateMessages = function (
|
|
393
|
+
const _validateMessages = function (actionParameters: any, invalidFields: any, bClearTarget?: boolean) {
|
|
395
394
|
const oMessageManager = Core.getMessageManager();
|
|
396
395
|
const aMessages = oMessageManager.getMessageModel().getData();
|
|
397
396
|
|
|
398
|
-
|
|
397
|
+
invalidFields = invalidFields || [];
|
|
399
398
|
|
|
400
399
|
if (!aMessages.length) {
|
|
401
|
-
|
|
400
|
+
invalidFields = [];
|
|
402
401
|
}
|
|
403
|
-
|
|
402
|
+
actionParameters.forEach(function (oActionParameters: any) {
|
|
404
403
|
const sParameter = oActionParameters.$Name;
|
|
405
404
|
aMessages.forEach(function (oMessage: any) {
|
|
406
405
|
const sParam = sParameter.replace("-inner", "");
|
|
407
406
|
if (
|
|
408
407
|
oMessage.controlIds.length > 0 &&
|
|
409
|
-
(oMessage.getControlId().includes(
|
|
410
|
-
(oMessage.getControlId().includes(
|
|
411
|
-
aFieldInvalid.indexOf("APD_::" + sParam) < 0))
|
|
408
|
+
(oMessage.getControlId().includes(`APD_::${sParameter}`) ||
|
|
409
|
+
(oMessage.getControlId().includes(`APD_::${sParameter}inner`) && invalidFields.indexOf(`APD_::${sParam}`) < 0))
|
|
412
410
|
) {
|
|
413
411
|
if (bClearTarget) {
|
|
414
412
|
oMessageManager.removeMessages(oMessage);
|
|
415
413
|
} else {
|
|
416
|
-
|
|
414
|
+
invalidFields.push(`APD_::${sParam}`);
|
|
417
415
|
}
|
|
418
416
|
}
|
|
419
417
|
// Handle messages related to input with invalid token
|
|
420
|
-
if (oMessage.target.includes(
|
|
421
|
-
|
|
418
|
+
if (oMessage.target.includes(`APD_::${sParameter}`)) {
|
|
419
|
+
invalidFields.push(`APD_::${sParam}`);
|
|
422
420
|
oMessage.target = bClearTarget ? "" : oMessage.target;
|
|
423
421
|
if (bClearTarget) {
|
|
424
422
|
oMessageManager.removeMessages(oMessage);
|
|
@@ -426,7 +424,7 @@ function showActionParameterDialog(
|
|
|
426
424
|
}
|
|
427
425
|
});
|
|
428
426
|
});
|
|
429
|
-
return
|
|
427
|
+
return invalidFields;
|
|
430
428
|
};
|
|
431
429
|
const oController = {
|
|
432
430
|
handleChange: function (oEvent: any) {
|
|
@@ -443,8 +441,8 @@ function showActionParameterDialog(
|
|
|
443
441
|
}
|
|
444
442
|
};
|
|
445
443
|
|
|
446
|
-
|
|
447
|
-
XMLPreprocessor.process(
|
|
444
|
+
try {
|
|
445
|
+
const createdFragment = await XMLPreprocessor.process(
|
|
448
446
|
oFragment,
|
|
449
447
|
{ name: sFragmentName },
|
|
450
448
|
{
|
|
@@ -460,456 +458,435 @@ function showActionParameterDialog(
|
|
|
460
458
|
metaModel: entitySetContext.getModel()
|
|
461
459
|
}
|
|
462
460
|
}
|
|
463
|
-
)
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
return;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
aFieldInvalid = _validateMessages(aActionParameters, aFieldInvalid);
|
|
510
|
-
|
|
511
|
-
if (aFieldInvalid.length > 0) {
|
|
512
|
-
return messageHandling.showUnboundMessages();
|
|
513
|
-
}
|
|
514
|
-
BusyLocker.lock(oDialog);
|
|
515
|
-
return Promise.all(
|
|
516
|
-
Object.keys(mFieldValueMap).map(function (sKey: string) {
|
|
517
|
-
return mFieldValueMap[sKey];
|
|
518
|
-
})
|
|
519
|
-
)
|
|
520
|
-
.then(function () {
|
|
521
|
-
// TODO: due to using the search and value helps on the action dialog transient messages could appear
|
|
522
|
-
// we need an UX design for those to show them to the user - for now remove them before continuing
|
|
523
|
-
messageHandler.removeTransitionMessages();
|
|
524
|
-
// move parameter values from Dialog (SimpleForm) to mParameters.actionParameters so that they are available in the operation bindings for all contexts
|
|
525
|
-
let vParameterValue;
|
|
526
|
-
const oParameterContext = oOperationBinding && oOperationBinding.getParameterContext();
|
|
527
|
-
for (const i in aActionParameters) {
|
|
528
|
-
if (aActionParameters[i].$isCollection) {
|
|
529
|
-
const aMVFContent = oDialog
|
|
530
|
-
.getModel("mvfview")
|
|
531
|
-
.getProperty("/" + aActionParameters[i].$Name),
|
|
532
|
-
aKeyValues = [];
|
|
533
|
-
for (const j in aMVFContent) {
|
|
534
|
-
aKeyValues.push(aMVFContent[j].Key);
|
|
535
|
-
}
|
|
536
|
-
vParameterValue = aKeyValues;
|
|
537
|
-
} else {
|
|
538
|
-
vParameterValue = oParameterContext.getProperty(aActionParameters[i].$Name);
|
|
539
|
-
}
|
|
540
|
-
aActionParameters[i].value = vParameterValue;
|
|
541
|
-
vParameterValue = undefined;
|
|
542
|
-
}
|
|
543
|
-
mParameters.label = sActionLabel;
|
|
544
|
-
return _executeAction(oAppComponent, mParameters)
|
|
545
|
-
.then(function (oOperation: any) {
|
|
546
|
-
oDialog.close();
|
|
547
|
-
resolve(oOperation);
|
|
548
|
-
})
|
|
549
|
-
.catch(function (oError: any) {
|
|
550
|
-
let messages = messageHandling.getMessages();
|
|
551
|
-
messages = messages.concat(messageHandling.getMessages(true, true));
|
|
552
|
-
if (
|
|
553
|
-
!mParameters.bGrouped &&
|
|
554
|
-
!(!mParameters.control.isA("sap.ui.mdc.Table") && aContexts.length === 1) &&
|
|
555
|
-
messages.length
|
|
556
|
-
) {
|
|
557
|
-
oDialog.close();
|
|
558
|
-
}
|
|
559
|
-
throw oError;
|
|
560
|
-
});
|
|
561
|
-
})
|
|
562
|
-
.catch(function () {
|
|
563
|
-
const oMessageManager = Core.getMessageManager();
|
|
564
|
-
let messages = oMessageManager.getMessageModel().getData();
|
|
565
|
-
const subtitleColumn = CommonUtils.getMessageColumn(mParameters.control);
|
|
566
|
-
let errorContext = undefined;
|
|
567
|
-
let errorTargetsInAPM = false;
|
|
568
|
-
let bShowMessageBox = false;
|
|
569
|
-
messages.forEach(function (message: any) {
|
|
570
|
-
const messageTargets = message.getTargets();
|
|
571
|
-
if (messageTargets && messageTargets.length === 1 && messageTargets[0].length) {
|
|
572
|
-
errorContext = aContexts.find(function (oContext: any) {
|
|
573
|
-
return message.getTarget().indexOf(oContext.getPath()) !== -1;
|
|
574
|
-
});
|
|
575
|
-
message.additionalText = errorContext
|
|
576
|
-
? errorContext.getObject()[subtitleColumn]
|
|
577
|
-
: undefined;
|
|
578
|
-
}
|
|
461
|
+
);
|
|
462
|
+
// TODO: move the dialog into the fragment and move the handlers to the oController
|
|
463
|
+
const aContexts: any[] = mParameters.aContexts || [];
|
|
464
|
+
const aFunctionParams: any[] = [];
|
|
465
|
+
// eslint-disable-next-line prefer-const
|
|
466
|
+
let oOperationBinding: any;
|
|
467
|
+
await CommonUtils.setUserDefaults(oAppComponent, aActionParameters, oParameterModel, true);
|
|
468
|
+
const oDialogContent = (await Fragment.load({ definition: createdFragment, controller: oController })) as Control;
|
|
469
|
+
const oResourceBundle = oParentControl.getController().oResourceBundle;
|
|
470
|
+
const oDialog = new Dialog(undefined, {
|
|
471
|
+
title: sActionLabel || CommonUtils.getTranslatedText("C_OPERATIONS_ACTION_PARAMETER_DIALOG_TITLE", oResourceBundle),
|
|
472
|
+
content: [oDialogContent],
|
|
473
|
+
escapeHandler: function () {
|
|
474
|
+
oDialog.close();
|
|
475
|
+
messageHandler.removeTransitionMessages();
|
|
476
|
+
reject(Constants.CancelActionDialog);
|
|
477
|
+
},
|
|
478
|
+
beginButton: new Button(generate(["fe", "APD_", sActionName, "Action", "Ok"]), {
|
|
479
|
+
text: bIsCreateAction
|
|
480
|
+
? CommonUtils.getTranslatedText("C_TRANSACTION_HELPER_SAPFE_ACTION_CREATE_BUTTON", oResourceBundle)
|
|
481
|
+
: _getActionParameterActionName(oResourceBundle, sActionLabel, sActionName, entitySetName),
|
|
482
|
+
type: "Emphasized",
|
|
483
|
+
press: async function () {
|
|
484
|
+
try {
|
|
485
|
+
const aEmptyMandatoryFields = await validateRequiredProperties();
|
|
486
|
+
if (aEmptyMandatoryFields.length) {
|
|
487
|
+
const oMessages = [];
|
|
488
|
+
for (let i = 0; i < aEmptyMandatoryFields.length; i++) {
|
|
489
|
+
oMessages.push({
|
|
490
|
+
text: CommonUtils.getTranslatedText(
|
|
491
|
+
"C_OPERATIONS_ACTION_PARAMETER_DIALOG_MISSING_MANDATORY_MSG",
|
|
492
|
+
oResourceBundle,
|
|
493
|
+
aEmptyMandatoryFields[i]
|
|
494
|
+
),
|
|
495
|
+
code: 200,
|
|
496
|
+
type: "Error"
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
messageHandler.showMessageDialog({
|
|
500
|
+
customMessages: oMessages
|
|
501
|
+
});
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
579
504
|
|
|
580
|
-
|
|
581
|
-
message.getTarget().indexOf(mParameters.actionName) !== -1 &&
|
|
582
|
-
message.getTarget().indexOf(mParameters.aActionParameters[0].$Name) !== -1 &&
|
|
583
|
-
errorTargetsInAPM === false
|
|
584
|
-
) {
|
|
585
|
-
errorTargetsInAPM = true;
|
|
586
|
-
}
|
|
587
|
-
});
|
|
505
|
+
aFieldInvalid = _validateMessages(aActionParameters, aFieldInvalid);
|
|
588
506
|
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
bShowMessageBox = true;
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
const bHasEtagMessage = messageHandling.modifyETagMessagesOnly(
|
|
598
|
-
oMessageManager,
|
|
599
|
-
oResourceBundle,
|
|
600
|
-
undefined
|
|
601
|
-
);
|
|
507
|
+
if (aFieldInvalid.length > 0) {
|
|
508
|
+
await messageHandling.showUnboundMessages();
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
BusyLocker.lock(oDialog);
|
|
602
512
|
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
513
|
+
try {
|
|
514
|
+
await Promise.all(
|
|
515
|
+
Object.keys(mFieldValueMap).map(function (sKey: string) {
|
|
516
|
+
return mFieldValueMap[sKey];
|
|
517
|
+
})
|
|
518
|
+
);
|
|
519
|
+
// TODO: due to using the search and value helps on the action dialog transient messages could appear
|
|
520
|
+
// we need an UX design for those to show them to the user - for now remove them before continuing
|
|
521
|
+
messageHandler.removeTransitionMessages();
|
|
522
|
+
// move parameter values from Dialog (SimpleForm) to mParameters.actionParameters so that they are available in the operation bindings for all contexts
|
|
523
|
+
let vParameterValue;
|
|
524
|
+
const oParameterContext = oOperationBinding && oOperationBinding.getParameterContext();
|
|
525
|
+
for (const i in aActionParameters) {
|
|
526
|
+
if (aActionParameters[i].$isCollection) {
|
|
527
|
+
const aMVFContent = oDialog.getModel("mvfview").getProperty(`/${aActionParameters[i].$Name}`),
|
|
528
|
+
aKeyValues = [];
|
|
529
|
+
for (const j in aMVFContent) {
|
|
530
|
+
aKeyValues.push(aMVFContent[j].Key);
|
|
531
|
+
}
|
|
532
|
+
vParameterValue = aKeyValues;
|
|
533
|
+
} else {
|
|
534
|
+
vParameterValue = oParameterContext.getProperty(aActionParameters[i].$Name);
|
|
535
|
+
}
|
|
536
|
+
aActionParameters[i].value = vParameterValue;
|
|
537
|
+
vParameterValue = undefined;
|
|
624
538
|
}
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
press: function () {
|
|
629
|
-
_validateMessages(aActionParameters, aFieldInvalid, true);
|
|
539
|
+
mParameters.label = sActionLabel;
|
|
540
|
+
try {
|
|
541
|
+
const oOperation = await _executeAction(oAppComponent, mParameters, oParentControl);
|
|
630
542
|
oDialog.close();
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
543
|
+
resolve(oOperation);
|
|
544
|
+
} catch (oError: any) {
|
|
545
|
+
let messages = messageHandling.getMessages();
|
|
546
|
+
messages = messages.concat(messageHandling.getMessages(true, true));
|
|
547
|
+
if (
|
|
548
|
+
!mParameters.bGrouped &&
|
|
549
|
+
!(!mParameters.control.isA("sap.ui.mdc.Table") && aContexts.length === 1) &&
|
|
550
|
+
messages.length
|
|
551
|
+
) {
|
|
552
|
+
let errorTargetsInAPD = false;
|
|
638
553
|
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
return sDefaultValuesFunction;
|
|
647
|
-
};
|
|
648
|
-
const fnSetDefaultsAndOpenDialog = function (sBindingParameter?: any) {
|
|
649
|
-
const sBoundFunctionName = getDefaultValuesFunction();
|
|
650
|
-
const prefillParameter = function (sParamName: any, vParamDefaultValue: any) {
|
|
651
|
-
return new Promise((resolve) => {
|
|
652
|
-
// Case 1: There is a ParameterDefaultValue annotation
|
|
653
|
-
if (vParamDefaultValue !== undefined) {
|
|
654
|
-
if (aContexts.length > 0 && vParamDefaultValue.$Path) {
|
|
655
|
-
const oPromise = CommonUtils.requestSingletonProperty(
|
|
656
|
-
vParamDefaultValue.$Path,
|
|
657
|
-
oOperationBinding.getModel()
|
|
658
|
-
);
|
|
659
|
-
oPromise
|
|
660
|
-
.then(function (oValue: any) {
|
|
661
|
-
if (oValue === null) {
|
|
662
|
-
return oOperationBinding
|
|
663
|
-
.getParameterContext()
|
|
664
|
-
.requestProperty(vParamDefaultValue.$Path);
|
|
665
|
-
}
|
|
666
|
-
return oValue;
|
|
667
|
-
})
|
|
668
|
-
.then(function (vParamValue: any) {
|
|
669
|
-
if (aContexts.length > 1) {
|
|
670
|
-
// For multi select, need to loop over aContexts (as contexts cannot be retrieved via binding parameter of the operation binding)
|
|
671
|
-
let sPathForContext = vParamDefaultValue.$Path;
|
|
672
|
-
if (sPathForContext.indexOf(sBindingParameter + "/") === 0) {
|
|
673
|
-
sPathForContext = sPathForContext.replace(sBindingParameter + "/", "");
|
|
674
|
-
}
|
|
675
|
-
for (let i = 1; i < aContexts.length; i++) {
|
|
676
|
-
if (aContexts[i].getProperty(sPathForContext) !== vParamValue) {
|
|
677
|
-
// if the values from the contexts are not all the same, do not prefill
|
|
678
|
-
resolve({
|
|
679
|
-
paramName: sParamName,
|
|
680
|
-
value: undefined,
|
|
681
|
-
bNoPossibleValue: true
|
|
682
|
-
});
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
resolve({ paramName: sParamName, value: vParamValue });
|
|
687
|
-
})
|
|
688
|
-
.catch(function () {
|
|
689
|
-
// Simply clear parameter default if an error has occurred
|
|
690
|
-
Log.error(
|
|
691
|
-
"Error while reading default action parameter",
|
|
692
|
-
sParamName,
|
|
693
|
-
mParameters.actionName
|
|
694
|
-
);
|
|
695
|
-
resolve({
|
|
696
|
-
paramName: sParamName,
|
|
697
|
-
value: undefined,
|
|
698
|
-
bLatePropertyError: true
|
|
699
|
-
});
|
|
700
|
-
});
|
|
701
|
-
} else {
|
|
702
|
-
// Case 1.2: ParameterDefaultValue defines a fixed string value (i.e. vParamDefaultValue = 'someString')
|
|
703
|
-
resolve({ paramName: sParamName, value: vParamDefaultValue });
|
|
704
|
-
}
|
|
705
|
-
} else {
|
|
706
|
-
// Case 2: There is no ParameterDefaultValue annotation (=> look into the FLP User Defaults)
|
|
707
|
-
if (oParameterModel && (oParameterModel as any).oData[sParamName]) {
|
|
708
|
-
resolve({
|
|
709
|
-
paramName: sParamName,
|
|
710
|
-
value: (oParameterModel as any).oData[sParamName]
|
|
711
|
-
});
|
|
712
|
-
} else {
|
|
713
|
-
resolve({ paramName: sParamName, value: undefined });
|
|
714
|
-
}
|
|
554
|
+
messages.forEach(function (message: any) {
|
|
555
|
+
if (
|
|
556
|
+
message.getTarget().indexOf(mParameters.actionName) !== -1 &&
|
|
557
|
+
message.getTarget().indexOf(mParameters.aActionParameters[0].$Name) !== -1 &&
|
|
558
|
+
errorTargetsInAPD === false
|
|
559
|
+
) {
|
|
560
|
+
errorTargetsInAPD = true;
|
|
715
561
|
}
|
|
716
562
|
});
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
const oMetaModel = oDialog.getModel().getMetaModel(),
|
|
721
|
-
sActionPath = oActionContext.sPath && oActionContext.sPath.split("/@")[0],
|
|
722
|
-
sActionParameterAnnotationTarget = sActionPath + "/" + sParamName + "@",
|
|
723
|
-
oParameterAnnotations = oMetaModel.getObject(sActionParameterAnnotationTarget),
|
|
724
|
-
oParameterDefaultValue =
|
|
725
|
-
oParameterAnnotations &&
|
|
726
|
-
oParameterAnnotations["@com.sap.vocabularies.UI.v1.ParameterDefaultValue"]; // either { $Path: 'somePath' } or 'someString'
|
|
727
|
-
return oParameterDefaultValue;
|
|
728
|
-
};
|
|
729
|
-
|
|
730
|
-
const aCurrentParamDefaultValue = [];
|
|
731
|
-
let sParamName, vParameterDefaultValue;
|
|
732
|
-
for (const i in aActionParameters) {
|
|
733
|
-
sParamName = aActionParameters[i].$Name;
|
|
734
|
-
vParameterDefaultValue = getParameterDefaultValue(sParamName);
|
|
735
|
-
aCurrentParamDefaultValue.push(prefillParameter(sParamName, vParameterDefaultValue));
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
if (oActionContext.getObject("$IsBound") && aContexts.length > 0) {
|
|
739
|
-
if (sBoundFunctionName && sBoundFunctionName.length > 0 && typeof sBoundFunctionName === "string") {
|
|
740
|
-
for (const i in aContexts) {
|
|
741
|
-
aFunctionParams.push(
|
|
742
|
-
callBoundFunction(sBoundFunctionName, aContexts[i], mParameters.model)
|
|
743
|
-
);
|
|
744
|
-
}
|
|
563
|
+
if (!errorTargetsInAPD) {
|
|
564
|
+
oDialog.close();
|
|
565
|
+
oDialog.destroy();
|
|
745
566
|
}
|
|
746
567
|
}
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
mParameters.defaultValuesExtensionFunction.length
|
|
761
|
-
);
|
|
762
|
-
oExecFunctionFromManifestPromise = FPMHelper.actionWrapper(oCloneEvent, sModule, sFunctionName, {
|
|
763
|
-
"contexts": aContexts
|
|
568
|
+
throw oError;
|
|
569
|
+
}
|
|
570
|
+
} catch (oError: any) {
|
|
571
|
+
const oMessageManager = Core.getMessageManager();
|
|
572
|
+
const messages = oMessageManager.getMessageModel().getData();
|
|
573
|
+
const subtitleColumn = CommonUtils.getMessageColumn(mParameters.control);
|
|
574
|
+
let errorContext;
|
|
575
|
+
let errorTargetsInAPD = false;
|
|
576
|
+
messages.forEach(function (message: any) {
|
|
577
|
+
const messageTargets = message.getTargets();
|
|
578
|
+
if (messageTargets && messageTargets.length === 1 && messageTargets[0].length) {
|
|
579
|
+
errorContext = aContexts.find(function (oContext: any) {
|
|
580
|
+
return message.getTarget().indexOf(oContext.getPath()) !== -1;
|
|
764
581
|
});
|
|
582
|
+
message.additionalText = errorContext ? errorContext.getObject()[subtitleColumn] : undefined;
|
|
765
583
|
}
|
|
584
|
+
if (
|
|
585
|
+
message.getTarget().indexOf(mParameters.actionName) !== -1 &&
|
|
586
|
+
message.getTarget().indexOf(mParameters.aActionParameters[0].$Name) !== -1 &&
|
|
587
|
+
errorTargetsInAPD === false
|
|
588
|
+
) {
|
|
589
|
+
errorTargetsInAPD = true;
|
|
590
|
+
}
|
|
591
|
+
});
|
|
592
|
+
if (oDialog.isOpen()) {
|
|
593
|
+
if (!mParameters.bGrouped) {
|
|
594
|
+
//isolated
|
|
595
|
+
if (aContexts.length > 1 || !errorTargetsInAPD) {
|
|
596
|
+
// does not matter if error is in APD or not, if there are multiple contexts selected or if the error is not the APD, we close it.
|
|
597
|
+
oDialog.close();
|
|
598
|
+
oDialog.destroy();
|
|
599
|
+
}
|
|
600
|
+
} else if (mParameters.bGrouped && !errorTargetsInAPD) {
|
|
601
|
+
//changeset
|
|
602
|
+
oDialog.close();
|
|
603
|
+
oDialog.destroy();
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
const showErrorInAPD = oDialog.isOpen() && errorTargetsInAPD;
|
|
608
|
+
let bShowMessageBox = false;
|
|
609
|
+
if (messages.length === 1 && messages[0].getTarget() !== undefined && messages[0].getTarget() !== "") {
|
|
610
|
+
bShowMessageBox = true;
|
|
611
|
+
}
|
|
766
612
|
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
) {
|
|
803
|
-
j++;
|
|
804
|
-
} else {
|
|
805
|
-
break;
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
//param values are all the same:
|
|
809
|
-
if (j === aContexts.length - 1) {
|
|
810
|
-
oOperationBinding.setParameter(
|
|
811
|
-
aActionParameters[i].$Name,
|
|
812
|
-
aFunctionParams[j].getObject(sDialogParamName)
|
|
813
|
-
);
|
|
814
|
-
}
|
|
815
|
-
} else {
|
|
816
|
-
//Only one context, then the default param values are to be verified from the function:
|
|
613
|
+
const bHasEtagMessage = messageHandling.modifyETagMessagesOnly(oMessageManager, oResourceBundle, undefined);
|
|
614
|
+
|
|
615
|
+
messageHandler.showMessages({
|
|
616
|
+
bHasEtagMessage: bHasEtagMessage,
|
|
617
|
+
context: mParameters.aContexts[0],
|
|
618
|
+
isActionParameterDialogOpen: oDialog.isOpen(),
|
|
619
|
+
messagePageNavigationCallback: function () {
|
|
620
|
+
oDialog.close();
|
|
621
|
+
},
|
|
622
|
+
showErrorInAPD: showErrorInAPD,
|
|
623
|
+
bShowMessageBox: bShowMessageBox
|
|
624
|
+
});
|
|
625
|
+
if (oDialog && bHasEtagMessage && oDialog.isOpen()) {
|
|
626
|
+
oDialog.close(); //close the action parameter dialog after refresh of the context after etag mismatch
|
|
627
|
+
}
|
|
628
|
+
} finally {
|
|
629
|
+
BusyLocker.unlock(oDialog);
|
|
630
|
+
}
|
|
631
|
+
} catch (oError: any) {
|
|
632
|
+
messageHandler.showMessageDialog();
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}),
|
|
636
|
+
endButton: new Button(generate(["fe", "APD_", sActionName, "Action", "Cancel"]), {
|
|
637
|
+
text: CommonUtils.getTranslatedText("C_COMMON_ACTION_PARAMETER_DIALOG_CANCEL", oResourceBundle),
|
|
638
|
+
press: function () {
|
|
639
|
+
_validateMessages(aActionParameters, aFieldInvalid, true);
|
|
640
|
+
oDialog.close();
|
|
641
|
+
messageHandler.removeTransitionMessages();
|
|
642
|
+
reject(Constants.CancelActionDialog);
|
|
643
|
+
}
|
|
644
|
+
}),
|
|
645
|
+
beforeOpen: function (oEvent: any) {
|
|
646
|
+
// clone event for actionWrapper as oEvent.oSource gets lost during processing of beforeOpen event handler
|
|
647
|
+
const oCloneEvent = Object.assign({}, oEvent);
|
|
817
648
|
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
649
|
+
messageHandler.removeTransitionMessages();
|
|
650
|
+
const getDefaultValuesFunction = function () {
|
|
651
|
+
const oMetaModel = oDialog.getModel().getMetaModel(),
|
|
652
|
+
sActionPath = oActionContext.sPath && oActionContext.sPath.split("/@")[0],
|
|
653
|
+
sDefaultValuesFunction = oMetaModel.getObject(
|
|
654
|
+
`${sActionPath}@com.sap.vocabularies.Common.v1.DefaultValuesFunction`
|
|
655
|
+
);
|
|
656
|
+
return sDefaultValuesFunction;
|
|
657
|
+
};
|
|
658
|
+
const fnSetDefaultsAndOpenDialog = async function (sBindingParameter?: any) {
|
|
659
|
+
const sBoundFunctionName = getDefaultValuesFunction();
|
|
660
|
+
const prefillParameter = function (sParamName: any, vParamDefaultValue: any) {
|
|
661
|
+
// eslint-disable-next-line promise/param-names
|
|
662
|
+
return new Promise(async function (inResolve) {
|
|
663
|
+
// Case 1: There is a ParameterDefaultValue annotation
|
|
664
|
+
if (vParamDefaultValue !== undefined) {
|
|
665
|
+
if (aContexts.length > 0 && vParamDefaultValue.$Path) {
|
|
666
|
+
try {
|
|
667
|
+
let vParamValue = await CommonUtils.requestSingletonProperty(
|
|
668
|
+
vParamDefaultValue.$Path,
|
|
669
|
+
oOperationBinding.getModel()
|
|
670
|
+
);
|
|
671
|
+
if (vParamValue === null) {
|
|
672
|
+
vParamValue = await oOperationBinding
|
|
673
|
+
.getParameterContext()
|
|
674
|
+
.requestProperty(vParamDefaultValue.$Path);
|
|
675
|
+
}
|
|
676
|
+
if (aContexts.length > 1) {
|
|
677
|
+
// For multi select, need to loop over aContexts (as contexts cannot be retrieved via binding parameter of the operation binding)
|
|
678
|
+
let sPathForContext = vParamDefaultValue.$Path;
|
|
679
|
+
if (sPathForContext.indexOf(`${sBindingParameter}/`) === 0) {
|
|
680
|
+
sPathForContext = sPathForContext.replace(`${sBindingParameter}/`, "");
|
|
681
|
+
}
|
|
682
|
+
for (let i = 1; i < aContexts.length; i++) {
|
|
683
|
+
if (aContexts[i].getProperty(sPathForContext) !== vParamValue) {
|
|
684
|
+
// if the values from the contexts are not all the same, do not prefill
|
|
685
|
+
inResolve({
|
|
686
|
+
paramName: sParamName,
|
|
687
|
+
value: undefined,
|
|
688
|
+
bNoPossibleValue: true
|
|
689
|
+
});
|
|
824
690
|
}
|
|
825
691
|
}
|
|
826
692
|
}
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
693
|
+
inResolve({ paramName: sParamName, value: vParamValue });
|
|
694
|
+
} catch (oError) {
|
|
695
|
+
Log.error("Error while reading default action parameter", sParamName, mParameters.actionName);
|
|
696
|
+
inResolve({
|
|
697
|
+
paramName: sParamName,
|
|
698
|
+
value: undefined,
|
|
699
|
+
bLatePropertyError: true
|
|
831
700
|
});
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
}
|
|
840
|
-
})
|
|
841
|
-
.catch();
|
|
842
|
-
};
|
|
701
|
+
}
|
|
702
|
+
} else {
|
|
703
|
+
// Case 1.2: ParameterDefaultValue defines a fixed string value (i.e. vParamDefaultValue = 'someString')
|
|
704
|
+
inResolve({ paramName: sParamName, value: vParamDefaultValue });
|
|
705
|
+
}
|
|
706
|
+
} else if (oParameterModel && (oParameterModel as any).oData[sParamName]) {
|
|
707
|
+
// Case 2: There is no ParameterDefaultValue annotation (=> look into the FLP User Defaults)
|
|
843
708
|
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
.requestObject()
|
|
849
|
-
.then(function (oContextObject: any) {
|
|
850
|
-
if (oContextObject) {
|
|
851
|
-
oOperationBinding.setParameter(sBindingParameter, oContextObject);
|
|
852
|
-
}
|
|
853
|
-
fnSetDefaultsAndOpenDialog(sBindingParameter);
|
|
854
|
-
})
|
|
855
|
-
.catch(function (oError: any) {
|
|
856
|
-
Log.error("Error while retrieving the parameter", oError);
|
|
857
|
-
});
|
|
709
|
+
inResolve({
|
|
710
|
+
paramName: sParamName,
|
|
711
|
+
value: (oParameterModel as any).oData[sParamName]
|
|
712
|
+
});
|
|
858
713
|
} else {
|
|
859
|
-
|
|
714
|
+
inResolve({ paramName: sParamName, value: undefined });
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
};
|
|
718
|
+
|
|
719
|
+
const getParameterDefaultValue = function (sParamName: any) {
|
|
720
|
+
const oMetaModel = oDialog.getModel().getMetaModel(),
|
|
721
|
+
sActionParameterAnnotationPath = CommonUtils.getParameterPath(oActionContext.getPath(), sParamName) + "@",
|
|
722
|
+
oParameterAnnotations = oMetaModel.getObject(sActionParameterAnnotationPath),
|
|
723
|
+
oParameterDefaultValue =
|
|
724
|
+
oParameterAnnotations && oParameterAnnotations["@com.sap.vocabularies.UI.v1.ParameterDefaultValue"]; // either { $Path: 'somePath' } or 'someString'
|
|
725
|
+
return oParameterDefaultValue;
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
const aCurrentParamDefaultValue = [];
|
|
729
|
+
let sParamName, vParameterDefaultValue;
|
|
730
|
+
for (const i in aActionParameters) {
|
|
731
|
+
sParamName = aActionParameters[i].$Name;
|
|
732
|
+
vParameterDefaultValue = getParameterDefaultValue(sParamName);
|
|
733
|
+
aCurrentParamDefaultValue.push(prefillParameter(sParamName, vParameterDefaultValue));
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
if (oActionContext.getObject("$IsBound") && aContexts.length > 0) {
|
|
737
|
+
if (sBoundFunctionName && sBoundFunctionName.length > 0 && typeof sBoundFunctionName === "string") {
|
|
738
|
+
for (const i in aContexts) {
|
|
739
|
+
aFunctionParams.push(callBoundFunction(sBoundFunctionName, aContexts[i], mParameters.model));
|
|
860
740
|
}
|
|
861
|
-
},
|
|
862
|
-
afterClose: function () {
|
|
863
|
-
oDialog.destroy();
|
|
864
741
|
}
|
|
865
|
-
}
|
|
866
|
-
aFormElements = oDialogContent
|
|
867
|
-
.getAggregation("form")
|
|
868
|
-
.getAggregation("formContainers")[0]
|
|
869
|
-
.getAggregation("formElements");
|
|
870
|
-
oDialog.setModel(oActionContext.getModel().oModel);
|
|
871
|
-
oDialog.setModel(oParameterModel, "paramsModel");
|
|
872
|
-
oDialog.bindElement({
|
|
873
|
-
path: "/",
|
|
874
|
-
model: "paramsModel"
|
|
875
|
-
});
|
|
876
|
-
// empty model to add elements dynamically depending on number of MVF fields defined on the dialog
|
|
877
|
-
const oMVFModel = new JSONModel({});
|
|
878
|
-
oDialog.setModel(oMVFModel, "mvfview");
|
|
742
|
+
}
|
|
879
743
|
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
744
|
+
const aPrefillParamPromises = Promise.all(aCurrentParamDefaultValue);
|
|
745
|
+
let aExecFunctionPromises: Promise<any[]> = Promise.resolve([]);
|
|
746
|
+
let oExecFunctionFromManifestPromise;
|
|
747
|
+
if (aFunctionParams && aFunctionParams.length > 0) {
|
|
748
|
+
aExecFunctionPromises = Promise.all(aFunctionParams);
|
|
884
749
|
}
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
750
|
+
if (mParameters.defaultValuesExtensionFunction) {
|
|
751
|
+
const sModule = mParameters.defaultValuesExtensionFunction
|
|
752
|
+
.substring(0, mParameters.defaultValuesExtensionFunction.lastIndexOf(".") || -1)
|
|
753
|
+
.replace(/\./gi, "/"),
|
|
754
|
+
sFunctionName = mParameters.defaultValuesExtensionFunction.substring(
|
|
755
|
+
mParameters.defaultValuesExtensionFunction.lastIndexOf(".") + 1,
|
|
756
|
+
mParameters.defaultValuesExtensionFunction.length
|
|
757
|
+
);
|
|
758
|
+
oExecFunctionFromManifestPromise = FPMHelper.actionWrapper(oCloneEvent, sModule, sFunctionName, {
|
|
759
|
+
"contexts": aContexts
|
|
760
|
+
});
|
|
891
761
|
}
|
|
892
|
-
|
|
893
|
-
|
|
762
|
+
|
|
763
|
+
try {
|
|
764
|
+
const aPromises = await Promise.all([
|
|
765
|
+
aPrefillParamPromises,
|
|
766
|
+
aExecFunctionPromises,
|
|
767
|
+
oExecFunctionFromManifestPromise
|
|
768
|
+
]);
|
|
769
|
+
const currentParamDefaultValue: any = aPromises[0];
|
|
770
|
+
const functionParams = aPromises[1];
|
|
771
|
+
const oFunctionParamsFromManifest = aPromises[2];
|
|
772
|
+
let sDialogParamName;
|
|
773
|
+
for (const i in aActionParameters) {
|
|
774
|
+
sDialogParamName = aActionParameters[i].$Name;
|
|
775
|
+
if (oFunctionParamsFromManifest && oFunctionParamsFromManifest.hasOwnProperty(sDialogParamName)) {
|
|
776
|
+
oOperationBinding.setParameter(
|
|
777
|
+
aActionParameters[i].$Name,
|
|
778
|
+
oFunctionParamsFromManifest[sDialogParamName]
|
|
779
|
+
);
|
|
780
|
+
} else if (currentParamDefaultValue[i] && currentParamDefaultValue[i].value !== undefined) {
|
|
781
|
+
oOperationBinding.setParameter(aActionParameters[i].$Name, currentParamDefaultValue[i].value);
|
|
782
|
+
// if the default value had not been previously determined due to different contexts, we do nothing else
|
|
783
|
+
} else if (sBoundFunctionName && !currentParamDefaultValue[i].bNoPossibleValue) {
|
|
784
|
+
if (aContexts.length > 1) {
|
|
785
|
+
// we check if the function retrieves the same param value for all the contexts:
|
|
786
|
+
let j = 0;
|
|
787
|
+
while (j < aContexts.length - 1) {
|
|
788
|
+
if (
|
|
789
|
+
functionParams[j] &&
|
|
790
|
+
functionParams[j + 1] &&
|
|
791
|
+
functionParams[j].getObject(sDialogParamName) ===
|
|
792
|
+
functionParams[j + 1].getObject(sDialogParamName)
|
|
793
|
+
) {
|
|
794
|
+
j++;
|
|
795
|
+
} else {
|
|
796
|
+
break;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
//param values are all the same:
|
|
800
|
+
if (j === aContexts.length - 1) {
|
|
801
|
+
oOperationBinding.setParameter(
|
|
802
|
+
aActionParameters[i].$Name,
|
|
803
|
+
functionParams[j].getObject(sDialogParamName)
|
|
804
|
+
);
|
|
805
|
+
}
|
|
806
|
+
} else if (functionParams[0] && functionParams[0].getObject(sDialogParamName)) {
|
|
807
|
+
//Only one context, then the default param values are to be verified from the function:
|
|
808
|
+
|
|
809
|
+
oOperationBinding.setParameter(
|
|
810
|
+
aActionParameters[i].$Name,
|
|
811
|
+
functionParams[0].getObject(sDialogParamName)
|
|
812
|
+
);
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
const bErrorFound = currentParamDefaultValue.some(function (oValue: any) {
|
|
817
|
+
if (oValue.bLatePropertyError) {
|
|
818
|
+
return oValue.bLatePropertyError;
|
|
819
|
+
}
|
|
820
|
+
});
|
|
821
|
+
// If at least one Default Property is a Late Property and an eTag error was raised.
|
|
822
|
+
if (bErrorFound) {
|
|
823
|
+
const sText = CommonUtils.getTranslatedText("C_APP_COMPONENT_SAPFE_ETAG_LATE_PROPERTY", oResourceBundle);
|
|
824
|
+
MessageBox.warning(sText, { contentWidth: "25em" } as any);
|
|
825
|
+
}
|
|
826
|
+
} catch (oError: any) {
|
|
827
|
+
Log.error("Error while retrieving the parameter", oError);
|
|
894
828
|
}
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
.catch(reject);
|
|
901
|
-
});
|
|
902
|
-
}
|
|
903
|
-
function prepareActionParameters(oAction: any, aPredefinedParameters: any) {
|
|
904
|
-
// check if parameters exist at all
|
|
905
|
-
const aParameters = getActionParameters(oAction);
|
|
906
|
-
aPredefinedParameters = aPredefinedParameters || [];
|
|
829
|
+
};
|
|
830
|
+
const fnAsyncBeforeOpen = async function () {
|
|
831
|
+
if (oActionContext.getObject("$IsBound") && aContexts.length > 0) {
|
|
832
|
+
const aParameters = oActionContext.getObject("$Parameter");
|
|
833
|
+
const sBindingParameter = aParameters[0] && aParameters[0].$Name;
|
|
907
834
|
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
835
|
+
try {
|
|
836
|
+
const oContextObject = await aContexts[0].requestObject();
|
|
837
|
+
if (oContextObject) {
|
|
838
|
+
oOperationBinding.setParameter(sBindingParameter, oContextObject);
|
|
839
|
+
}
|
|
840
|
+
fnSetDefaultsAndOpenDialog(sBindingParameter);
|
|
841
|
+
} catch (oError: any) {
|
|
842
|
+
Log.error("Error while retrieving the parameter", oError);
|
|
843
|
+
}
|
|
844
|
+
} else {
|
|
845
|
+
fnSetDefaultsAndOpenDialog();
|
|
846
|
+
}
|
|
847
|
+
};
|
|
911
848
|
|
|
912
|
-
|
|
849
|
+
fnAsyncBeforeOpen();
|
|
850
|
+
},
|
|
851
|
+
afterClose: function () {
|
|
852
|
+
oDialog.destroy();
|
|
853
|
+
}
|
|
854
|
+
});
|
|
855
|
+
|
|
856
|
+
aFormElements = (oDialogContent as any)
|
|
857
|
+
.getAggregation("form")
|
|
858
|
+
.getAggregation("formContainers")[0]
|
|
859
|
+
.getAggregation("formElements");
|
|
860
|
+
oDialog.setModel(oActionContext.getModel().oModel);
|
|
861
|
+
oDialog.setModel(oParameterModel, "paramsModel");
|
|
862
|
+
oDialog.bindElement({
|
|
863
|
+
path: "/",
|
|
864
|
+
model: "paramsModel"
|
|
865
|
+
});
|
|
866
|
+
// empty model to add elements dynamically depending on number of MVF fields defined on the dialog
|
|
867
|
+
const oMVFModel = new JSONModel({});
|
|
868
|
+
oDialog.setModel(oMVFModel, "mvfview");
|
|
869
|
+
|
|
870
|
+
let sActionPath = `${sActionName}(...)`;
|
|
871
|
+
if (!aContexts.length) {
|
|
872
|
+
sActionPath = `/${sActionPath}`;
|
|
873
|
+
}
|
|
874
|
+
oDialog.bindElement({
|
|
875
|
+
path: sActionPath
|
|
876
|
+
});
|
|
877
|
+
if (oParentControl) {
|
|
878
|
+
// if there is a parent control specified add the dialog as dependent
|
|
879
|
+
oParentControl.addDependent(oDialog);
|
|
880
|
+
}
|
|
881
|
+
if (aContexts.length > 0) {
|
|
882
|
+
oDialog.setBindingContext(aContexts[0]); // use context of first selected line item
|
|
883
|
+
}
|
|
884
|
+
oOperationBinding = oDialog.getObjectBinding();
|
|
885
|
+
oDialog.open();
|
|
886
|
+
} catch (oError: any) {
|
|
887
|
+
reject(oError);
|
|
888
|
+
}
|
|
889
|
+
});
|
|
913
890
|
}
|
|
914
891
|
function getActionParameters(oAction: any) {
|
|
915
892
|
const aParameters = oAction.getObject("$Parameter") || [];
|
|
@@ -922,7 +899,7 @@ function getActionParameters(oAction: any) {
|
|
|
922
899
|
return aParameters;
|
|
923
900
|
}
|
|
924
901
|
function getIsActionCritical(oMetaModel: any, sPath: any, contexts?: any, oBoundAction?: any) {
|
|
925
|
-
const vActionCritical = oMetaModel.getObject(sPath
|
|
902
|
+
const vActionCritical = oMetaModel.getObject(`${sPath}@com.sap.vocabularies.Common.v1.IsActionCritical`);
|
|
926
903
|
let sCriticalPath = vActionCritical && vActionCritical.$Path;
|
|
927
904
|
if (!sCriticalPath) {
|
|
928
905
|
// the static value scenario for isActionCritical
|
|
@@ -948,7 +925,39 @@ function getIsActionCritical(oMetaModel: any, sPath: any, contexts?: any, oBound
|
|
|
948
925
|
}
|
|
949
926
|
}
|
|
950
927
|
|
|
951
|
-
function
|
|
928
|
+
function _getActionParameterActionName(oResourceBundle: ResourceBundle, sActionLabel: string, sActionName: string, sEntitySetName: string) {
|
|
929
|
+
let boundActionName: any = sActionName ? sActionName : null;
|
|
930
|
+
const aActionName = boundActionName.split(".");
|
|
931
|
+
boundActionName = boundActionName.indexOf(".") >= 0 ? aActionName[aActionName.length - 1] : boundActionName;
|
|
932
|
+
const suffixResourceKey = boundActionName && sEntitySetName ? `${sEntitySetName}|${boundActionName}` : "";
|
|
933
|
+
const sKey = "ACTION_PARAMETER_DIALOG_ACTION_NAME";
|
|
934
|
+
const bResourceKeyExists =
|
|
935
|
+
oResourceBundle && CommonUtils.checkIfResourceKeyExists((oResourceBundle as any).aCustomBundles, `${sKey}|${suffixResourceKey}`);
|
|
936
|
+
if (sActionLabel) {
|
|
937
|
+
if (bResourceKeyExists) {
|
|
938
|
+
return CommonUtils.getTranslatedText(sKey, oResourceBundle, null, suffixResourceKey);
|
|
939
|
+
} else if (
|
|
940
|
+
oResourceBundle &&
|
|
941
|
+
CommonUtils.checkIfResourceKeyExists((oResourceBundle as any).aCustomBundles, `${sKey}|${sEntitySetName}`)
|
|
942
|
+
) {
|
|
943
|
+
return CommonUtils.getTranslatedText(sKey, oResourceBundle, null, `${sEntitySetName}`);
|
|
944
|
+
} else if (oResourceBundle && CommonUtils.checkIfResourceKeyExists((oResourceBundle as any).aCustomBundles, `${sKey}`)) {
|
|
945
|
+
return CommonUtils.getTranslatedText(sKey, oResourceBundle);
|
|
946
|
+
} else {
|
|
947
|
+
return sActionLabel;
|
|
948
|
+
}
|
|
949
|
+
} else {
|
|
950
|
+
return CommonUtils.getTranslatedText("C_COMMON_DIALOG_OK", oResourceBundle);
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
function executeDependingOnSelectedContexts(
|
|
955
|
+
oAction: any,
|
|
956
|
+
mParameters: any,
|
|
957
|
+
bGetBoundContext: boolean,
|
|
958
|
+
sGroupId: string,
|
|
959
|
+
oResourceBundle: any
|
|
960
|
+
) {
|
|
952
961
|
let oActionPromise,
|
|
953
962
|
bEnableStrictHandling = true;
|
|
954
963
|
if (bGetBoundContext) {
|
|
@@ -976,7 +985,7 @@ function executeDependingOnSelectedContexts(oAction: any, mParameters: any, bGet
|
|
|
976
985
|
.execute(
|
|
977
986
|
sGroupId,
|
|
978
987
|
undefined,
|
|
979
|
-
CommonUtils.fnOnStrictHandlingFailed.bind(operations, sGroupId, mParameters
|
|
988
|
+
CommonUtils.fnOnStrictHandlingFailed.bind(operations, sGroupId, mParameters, oResourceBundle)
|
|
980
989
|
)
|
|
981
990
|
.then(function () {
|
|
982
991
|
return oAction.getBoundContext();
|
|
@@ -984,13 +993,13 @@ function executeDependingOnSelectedContexts(oAction: any, mParameters: any, bGet
|
|
|
984
993
|
: oAction.execute(
|
|
985
994
|
sGroupId,
|
|
986
995
|
undefined,
|
|
987
|
-
CommonUtils.fnOnStrictHandlingFailed.bind(operations, sGroupId, mParameters
|
|
996
|
+
CommonUtils.fnOnStrictHandlingFailed.bind(operations, sGroupId, mParameters, oResourceBundle)
|
|
988
997
|
);
|
|
989
998
|
}
|
|
990
999
|
|
|
991
1000
|
return oActionPromise;
|
|
992
1001
|
}
|
|
993
|
-
function _executeAction(oAppComponent: any, mParameters: any) {
|
|
1002
|
+
function _executeAction(oAppComponent: any, mParameters: any, oParentControl?: any) {
|
|
994
1003
|
const aContexts = mParameters.aContexts || [];
|
|
995
1004
|
const oModel = mParameters.model;
|
|
996
1005
|
const iExistingMessages = messageHandling.getMessages().length || 0;
|
|
@@ -999,6 +1008,7 @@ function _executeAction(oAppComponent: any, mParameters: any) {
|
|
|
999
1008
|
const fnOnSubmitted = mParameters.fnOnSubmitted;
|
|
1000
1009
|
const fnOnResponse = mParameters.fnOnResponse;
|
|
1001
1010
|
const bIsCreateAction = mParameters.bIsCreateAction;
|
|
1011
|
+
const oResourceBundle = oParentControl && oParentControl.isA("sap.ui.core.mvc.View") && oParentControl.getController().oResourceBundle;
|
|
1002
1012
|
let oAction: any;
|
|
1003
1013
|
// let contextIndex = 0;
|
|
1004
1014
|
// let aMessages: any[] = [];
|
|
@@ -1057,92 +1067,58 @@ function _executeAction(oAppComponent: any, mParameters: any) {
|
|
|
1057
1067
|
let oActionPromise;
|
|
1058
1068
|
let i;
|
|
1059
1069
|
let sGroupId: string;
|
|
1060
|
-
const fnExecuteAction = function (
|
|
1070
|
+
const fnExecuteAction = function (actionContext: any, index: any, oSideEffect: any) {
|
|
1061
1071
|
setActionParameterDefaultValue();
|
|
1062
1072
|
// For invocation grouping "isolated" need batch group per action call
|
|
1063
|
-
sGroupId = !bGrouped ?
|
|
1064
|
-
|
|
1073
|
+
sGroupId = !bGrouped ? `$auto.${index}` : actionContext.getUpdateGroupId();
|
|
1074
|
+
mParameters.requestSideEffects = fnRequestSideEffects.bind(operations, oAppComponent, oSideEffect, mParameters);
|
|
1075
|
+
oActionPromise = executeDependingOnSelectedContexts(
|
|
1076
|
+
actionContext,
|
|
1077
|
+
mParameters,
|
|
1078
|
+
bGetBoundContext,
|
|
1079
|
+
sGroupId,
|
|
1080
|
+
oResourceBundle
|
|
1081
|
+
);
|
|
1065
1082
|
aActionPromises.push(oActionPromise);
|
|
1066
|
-
|
|
1067
|
-
// trigger actions from side effects
|
|
1068
|
-
if (oSideEffect && oSideEffect.triggerActions && oSideEffect.triggerActions.length) {
|
|
1069
|
-
oSideEffect.triggerActions.forEach(function (sTriggerAction: any) {
|
|
1070
|
-
if (sTriggerAction) {
|
|
1071
|
-
oSideEffectsService.executeAction(sTriggerAction, oSideEffect.context, sGroupId);
|
|
1072
|
-
}
|
|
1073
|
-
});
|
|
1074
|
-
}
|
|
1075
|
-
// request side effects for this action
|
|
1076
|
-
// as we move the messages request to POST $select we need to be prepared for an empty array
|
|
1077
|
-
if (oSideEffect && oSideEffect.pathExpressions && oSideEffect.pathExpressions.length > 0) {
|
|
1078
|
-
oSideEffectsService
|
|
1079
|
-
.requestSideEffects(oSideEffect.pathExpressions, oSideEffect.context, sGroupId)
|
|
1080
|
-
.then(function () {
|
|
1081
|
-
if (mParameters.operationAvailableMap && mParameters.internalModelContext) {
|
|
1082
|
-
CommonUtils.setActionEnablement(
|
|
1083
|
-
mParameters.internalModelContext,
|
|
1084
|
-
JSON.parse(mParameters.operationAvailableMap),
|
|
1085
|
-
mParameters.aContexts
|
|
1086
|
-
);
|
|
1087
|
-
}
|
|
1088
|
-
})
|
|
1089
|
-
.catch(function (oError: any) {
|
|
1090
|
-
Log.error("Error while requesting side effects", oError);
|
|
1091
|
-
});
|
|
1092
|
-
}
|
|
1083
|
+
fnRequestSideEffects(oAppComponent, oSideEffect, mParameters, sGroupId);
|
|
1093
1084
|
};
|
|
1094
|
-
const fnExecuteSingleAction = function (
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
const aLocalPromise = [];
|
|
1085
|
+
const fnExecuteSingleAction = function (actionContext: any, index: any, oSideEffect: any) {
|
|
1086
|
+
// eslint-disable-next-line promise/param-names
|
|
1087
|
+
return new Promise<void>((actionResolve) => {
|
|
1088
|
+
const aLocalPromise: any = [];
|
|
1098
1089
|
setActionParameterDefaultValue();
|
|
1099
1090
|
// For invocation grouping "isolated" need batch group per action call
|
|
1100
|
-
sGroupId =
|
|
1101
|
-
|
|
1091
|
+
sGroupId = `apiMode${index}`;
|
|
1092
|
+
mParameters.requestSideEffects = fnRequestSideEffects.bind(
|
|
1093
|
+
operations,
|
|
1094
|
+
oAppComponent,
|
|
1095
|
+
oSideEffect,
|
|
1096
|
+
mParameters,
|
|
1097
|
+
sGroupId,
|
|
1098
|
+
aLocalPromise
|
|
1099
|
+
);
|
|
1100
|
+
oActionPromise = executeDependingOnSelectedContexts(
|
|
1101
|
+
actionContext,
|
|
1102
|
+
mParameters,
|
|
1103
|
+
bGetBoundContext,
|
|
1104
|
+
sGroupId,
|
|
1105
|
+
oResourceBundle
|
|
1106
|
+
);
|
|
1102
1107
|
aActionPromises.push(oActionPromise);
|
|
1103
1108
|
aLocalPromise.push(oActionPromise);
|
|
1104
|
-
|
|
1105
|
-
// trigger actions from side effects
|
|
1106
|
-
if (oSideEffect && oSideEffect.triggerActions && oSideEffect.triggerActions.length) {
|
|
1107
|
-
oSideEffect.triggerActions.forEach(function (sTriggerAction: any) {
|
|
1108
|
-
if (sTriggerAction) {
|
|
1109
|
-
oLocalPromise = oSideEffectsService.executeAction(sTriggerAction, oSideEffect.context, sGroupId);
|
|
1110
|
-
aLocalPromise.push(oLocalPromise);
|
|
1111
|
-
}
|
|
1112
|
-
});
|
|
1113
|
-
}
|
|
1114
|
-
// request side effects for this action
|
|
1115
|
-
// as we move the messages request to POST $select we need to be prepared for an empty array
|
|
1116
|
-
if (oSideEffect && oSideEffect.pathExpressions && oSideEffect.pathExpressions.length > 0) {
|
|
1117
|
-
oLocalPromise = oSideEffectsService.requestSideEffects(oSideEffect.pathExpressions, oSideEffect.context, sGroupId);
|
|
1118
|
-
aLocalPromise.push(oLocalPromise);
|
|
1119
|
-
oLocalPromise
|
|
1120
|
-
.then(function () {
|
|
1121
|
-
if (mParameters.operationAvailableMap && mParameters.internalModelContext) {
|
|
1122
|
-
CommonUtils.setActionEnablement(
|
|
1123
|
-
mParameters.internalModelContext,
|
|
1124
|
-
JSON.parse(mParameters.operationAvailableMap),
|
|
1125
|
-
mParameters.aContexts
|
|
1126
|
-
);
|
|
1127
|
-
}
|
|
1128
|
-
})
|
|
1129
|
-
.catch(function (oError: any) {
|
|
1130
|
-
Log.error("Error while requesting side effects", oError);
|
|
1131
|
-
});
|
|
1132
|
-
}
|
|
1109
|
+
fnRequestSideEffects(oAppComponent, oSideEffect, mParameters, sGroupId, aLocalPromise);
|
|
1133
1110
|
oModel.submitBatch(sGroupId);
|
|
1134
1111
|
Promise.all(aLocalPromise)
|
|
1135
1112
|
.then(function () {
|
|
1136
|
-
return
|
|
1113
|
+
return actionResolve();
|
|
1137
1114
|
})
|
|
1138
1115
|
.catch(function () {
|
|
1139
|
-
return
|
|
1116
|
+
return actionResolve();
|
|
1140
1117
|
});
|
|
1141
1118
|
});
|
|
1142
|
-
return oPromise;
|
|
1143
1119
|
};
|
|
1144
1120
|
|
|
1145
|
-
function fnExecuteSequentially(
|
|
1121
|
+
function fnExecuteSequentially(contextsToExecute: any) {
|
|
1146
1122
|
// One action and its side effects are completed before the next action is executed
|
|
1147
1123
|
(
|
|
1148
1124
|
fnOnSubmitted ||
|
|
@@ -1150,9 +1126,9 @@ function _executeAction(oAppComponent: any, mParameters: any) {
|
|
|
1150
1126
|
/**/
|
|
1151
1127
|
}
|
|
1152
1128
|
)(aActionPromises);
|
|
1153
|
-
function processOneAction(context: any,
|
|
1154
|
-
oAction = oModel.bindContext(sActionName
|
|
1155
|
-
return fnExecuteSingleAction(oAction,
|
|
1129
|
+
function processOneAction(context: any, actionIndex: any) {
|
|
1130
|
+
oAction = oModel.bindContext(`${sActionName}(...)`, context, mBindingParameters);
|
|
1131
|
+
return fnExecuteSingleAction(oAction, actionIndex, {
|
|
1156
1132
|
context: context,
|
|
1157
1133
|
pathExpressions: mParameters.additionalSideEffect && mParameters.additionalSideEffect.pathExpressions,
|
|
1158
1134
|
triggerActions: mParameters.additionalSideEffect && mParameters.additionalSideEffect.triggerActions
|
|
@@ -1161,7 +1137,7 @@ function _executeAction(oAppComponent: any, mParameters: any) {
|
|
|
1161
1137
|
|
|
1162
1138
|
let oActionAndSideEffectPromise = Promise.resolve();
|
|
1163
1139
|
let j = 0;
|
|
1164
|
-
|
|
1140
|
+
contextsToExecute.forEach(function (context: any) {
|
|
1165
1141
|
const id = ++j;
|
|
1166
1142
|
oActionAndSideEffectPromise = oActionAndSideEffectPromise.then(function () {
|
|
1167
1143
|
return processOneAction(context, id);
|
|
@@ -1171,7 +1147,9 @@ function _executeAction(oAppComponent: any, mParameters: any) {
|
|
|
1171
1147
|
.then(function () {
|
|
1172
1148
|
fnHandleResults();
|
|
1173
1149
|
})
|
|
1174
|
-
.catch()
|
|
1150
|
+
.catch(function (oError: any) {
|
|
1151
|
+
Log.error(oError);
|
|
1152
|
+
});
|
|
1175
1153
|
}
|
|
1176
1154
|
|
|
1177
1155
|
if (!bGrouped) {
|
|
@@ -1181,7 +1159,7 @@ function _executeAction(oAppComponent: any, mParameters: any) {
|
|
|
1181
1159
|
fnExecuteSequentially(aContexts);
|
|
1182
1160
|
} else {
|
|
1183
1161
|
for (i = 0; i < aContexts.length; i++) {
|
|
1184
|
-
oAction = oModel.bindContext(sActionName
|
|
1162
|
+
oAction = oModel.bindContext(`${sActionName}(...)`, aContexts[i], mBindingParameters);
|
|
1185
1163
|
fnExecuteAction(oAction, aContexts.length <= 1 ? null : i, {
|
|
1186
1164
|
context: aContexts[i],
|
|
1187
1165
|
pathExpressions: mParameters.additionalSideEffect && mParameters.additionalSideEffect.pathExpressions,
|
|
@@ -1246,13 +1224,13 @@ function _executeAction(oAppComponent: any, mParameters: any) {
|
|
|
1246
1224
|
)();
|
|
1247
1225
|
});
|
|
1248
1226
|
} else {
|
|
1249
|
-
oAction = oModel.bindContext(
|
|
1227
|
+
oAction = oModel.bindContext(`/${sActionName}(...)`);
|
|
1250
1228
|
setActionParameterDefaultValue();
|
|
1251
1229
|
const sGroupId = "actionImport";
|
|
1252
1230
|
const oActionPromise = oAction.execute(
|
|
1253
1231
|
sGroupId,
|
|
1254
1232
|
undefined,
|
|
1255
|
-
CommonUtils.fnOnStrictHandlingFailed.bind(operations, sGroupId, mParameters.label, oModel)
|
|
1233
|
+
CommonUtils.fnOnStrictHandlingFailed.bind(operations, sGroupId, { label: mParameters.label, model: oModel }, oResourceBundle)
|
|
1256
1234
|
);
|
|
1257
1235
|
oModel.submitBatch(sGroupId);
|
|
1258
1236
|
// trigger onSubmitted "event"
|
|
@@ -1275,7 +1253,59 @@ function _executeAction(oAppComponent: any, mParameters: any) {
|
|
|
1275
1253
|
function _getPath(oActionContext: any, sActionName: any) {
|
|
1276
1254
|
let sPath = oActionContext.getPath();
|
|
1277
1255
|
sPath = oActionContext.getObject("$IsBound") ? sPath.split("@$ui5.overload")[0] : sPath.split("/0")[0];
|
|
1278
|
-
return sPath.split(
|
|
1256
|
+
return sPath.split(`/${sActionName}`)[0];
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
function _showActionParameterDialog(showDialog: boolean, actionParameters: Record<string, any>[]): boolean {
|
|
1260
|
+
if (showDialog || actionParameters.length > 0) {
|
|
1261
|
+
if (
|
|
1262
|
+
!actionParameters ||
|
|
1263
|
+
actionParameters.length === 0 ||
|
|
1264
|
+
(actionParameters.length === 1 && actionParameters[0].$Name === "ResultIsActiveEntity")
|
|
1265
|
+
) {
|
|
1266
|
+
showDialog = false;
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
return showDialog;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
function fnRequestSideEffects(oAppComponent: any, oSideEffect: any, mParameters: any, sGroupId: any, aLocalPromise?: any) {
|
|
1274
|
+
const oSideEffectsService = oAppComponent.getSideEffectsService();
|
|
1275
|
+
let oLocalPromise;
|
|
1276
|
+
// trigger actions from side effects
|
|
1277
|
+
if (oSideEffect && oSideEffect.triggerActions && oSideEffect.triggerActions.length) {
|
|
1278
|
+
oSideEffect.triggerActions.forEach(function (sTriggerAction: any) {
|
|
1279
|
+
if (sTriggerAction) {
|
|
1280
|
+
oLocalPromise = oSideEffectsService.executeAction(sTriggerAction, oSideEffect.context, sGroupId);
|
|
1281
|
+
if (aLocalPromise) {
|
|
1282
|
+
aLocalPromise.push(oLocalPromise);
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
});
|
|
1286
|
+
}
|
|
1287
|
+
// request side effects for this action
|
|
1288
|
+
// as we move the messages request to POST $select we need to be prepared for an empty array
|
|
1289
|
+
if (oSideEffect && oSideEffect.pathExpressions && oSideEffect.pathExpressions.length > 0) {
|
|
1290
|
+
oLocalPromise = oSideEffectsService.requestSideEffects(oSideEffect.pathExpressions, oSideEffect.context, sGroupId);
|
|
1291
|
+
if (aLocalPromise) {
|
|
1292
|
+
aLocalPromise.push(oLocalPromise);
|
|
1293
|
+
}
|
|
1294
|
+
oLocalPromise
|
|
1295
|
+
.then(function () {
|
|
1296
|
+
if (mParameters.operationAvailableMap && mParameters.internalModelContext) {
|
|
1297
|
+
ActionRuntime.setActionEnablement(
|
|
1298
|
+
mParameters.internalModelContext,
|
|
1299
|
+
JSON.parse(mParameters.operationAvailableMap),
|
|
1300
|
+
mParameters.selectedItems,
|
|
1301
|
+
"table"
|
|
1302
|
+
);
|
|
1303
|
+
}
|
|
1304
|
+
})
|
|
1305
|
+
.catch(function (oError: any) {
|
|
1306
|
+
Log.error("Error while requesting side effects", oError);
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1279
1309
|
}
|
|
1280
1310
|
|
|
1281
1311
|
/**
|
|
@@ -1292,7 +1322,9 @@ const operations = {
|
|
|
1292
1322
|
callActionImport: callActionImport,
|
|
1293
1323
|
callBoundFunction: callBoundFunction,
|
|
1294
1324
|
callFunctionImport: callFunctionImport,
|
|
1295
|
-
executeDependingOnSelectedContexts: executeDependingOnSelectedContexts
|
|
1325
|
+
executeDependingOnSelectedContexts: executeDependingOnSelectedContexts,
|
|
1326
|
+
showActionParameterDialog: _showActionParameterDialog,
|
|
1327
|
+
getActionParameterActionName: _getActionParameterActionName
|
|
1296
1328
|
};
|
|
1297
1329
|
|
|
1298
1330
|
export default operations;
|