@sapui5/sap.fe.core 1.103.0 → 1.106.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 +5 -5
- package/src/sap/fe/core/.library +1 -1
- package/src/sap/fe/core/ActionRuntime.js +121 -0
- package/src/sap/fe/core/ActionRuntime.ts +122 -0
- package/src/sap/fe/core/AppComponent.js +24 -11
- package/src/sap/fe/core/AppComponent.ts +17 -5
- package/src/sap/fe/core/AppStateHandler.js +74 -62
- package/src/sap/fe/core/AppStateHandler.ts +24 -29
- package/src/sap/fe/core/BaseController.js +2 -2
- package/src/sap/fe/core/CommonUtils.js +147 -180
- package/src/sap/fe/core/CommonUtils.ts +166 -193
- package/src/sap/fe/core/ExtensionAPI.js +2 -2
- package/src/sap/fe/core/PageController.js +2 -2
- package/src/sap/fe/core/TemplateComponent.js +21 -10
- package/src/sap/fe/core/TemplateComponent.ts +3 -0
- package/src/sap/fe/core/TemplateModel.js +2 -2
- package/src/sap/fe/core/buildingBlocks/AttributeModel.js +11 -3
- package/src/sap/fe/core/buildingBlocks/AttributeModel.ts +7 -1
- package/src/sap/fe/core/buildingBlocks/BuildingBlock.js +194 -43
- package/src/sap/fe/core/buildingBlocks/BuildingBlock.ts +162 -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 -227
- package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.ts +268 -119
- package/src/sap/fe/core/buildingBlocks/TraceInfo.js +111 -76
- package/src/sap/fe/core/buildingBlocks/TraceInfo.ts +96 -76
- package/src/sap/fe/core/controllerextensions/BusyLocker.js +1 -1
- package/src/sap/fe/core/controllerextensions/EditFlow.js +723 -637
- package/src/sap/fe/core/controllerextensions/EditFlow.ts +361 -398
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +2 -2
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +83 -55
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.ts +42 -44
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +29 -27
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.ts +35 -30
- package/src/sap/fe/core/controllerextensions/InternalRouting.js +171 -74
- package/src/sap/fe/core/controllerextensions/InternalRouting.ts +167 -76
- package/src/sap/fe/core/controllerextensions/KPIManagement.js +5 -21
- package/src/sap/fe/core/controllerextensions/KPIManagement.ts +2 -17
- package/src/sap/fe/core/controllerextensions/MassEdit.js +3 -3
- package/src/sap/fe/core/controllerextensions/MassEdit.ts +1 -1
- package/src/sap/fe/core/controllerextensions/MessageHandler.js +2 -2
- package/src/sap/fe/core/controllerextensions/PageReady.js +3 -3
- package/src/sap/fe/core/controllerextensions/PageReady.ts +5 -1
- package/src/sap/fe/core/controllerextensions/Paginator.js +13 -13
- package/src/sap/fe/core/controllerextensions/Paginator.ts +11 -11
- package/src/sap/fe/core/controllerextensions/Placeholder.js +2 -2
- package/src/sap/fe/core/controllerextensions/Routing.js +2 -2
- package/src/sap/fe/core/controllerextensions/RoutingListener.js +1 -1
- package/src/sap/fe/core/controllerextensions/Share.js +154 -123
- package/src/sap/fe/core/controllerextensions/Share.ts +93 -95
- package/src/sap/fe/core/controllerextensions/SideEffects.js +157 -97
- package/src/sap/fe/core/controllerextensions/SideEffects.ts +151 -95
- package/src/sap/fe/core/controllerextensions/ViewState.js +151 -80
- package/src/sap/fe/core/controllerextensions/ViewState.ts +95 -93
- package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.js +1 -1
- package/src/sap/fe/core/controllerextensions/collaboration/ActivitySync.js +9 -9
- package/src/sap/fe/core/controllerextensions/collaboration/ActivitySync.ts +6 -7
- package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon.js +26 -11
- package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon.ts +30 -11
- package/src/sap/fe/core/controllerextensions/collaboration/Manage.js +57 -40
- package/src/sap/fe/core/controllerextensions/collaboration/Manage.ts +55 -47
- package/src/sap/fe/core/controllerextensions/collaboration/ManageDialog.fragment.xml +31 -32
- package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.js +1376 -914
- package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.ts +654 -714
- package/src/sap/fe/core/controllerextensions/editFlow/draft.js +372 -326
- package/src/sap/fe/core/controllerextensions/editFlow/draft.ts +210 -276
- 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 +670 -521
- package/src/sap/fe/core/controllerextensions/editFlow/operations.ts +537 -535
- package/src/sap/fe/core/controllerextensions/editFlow/sticky.js +85 -65
- package/src/sap/fe/core/controllerextensions/editFlow/sticky.ts +16 -21
- package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.js +25 -13
- package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.ts +53 -43
- package/src/sap/fe/core/controllerextensions/routing/RouterProxy.js +18 -27
- package/src/sap/fe/core/controllerextensions/routing/RouterProxy.ts +9 -15
- package/src/sap/fe/core/controls/ActionParameterDialog.fragment.xml +19 -3
- package/src/sap/fe/core/controls/ActionParameterDialogFieldValueHelp.fragment.xml +35 -0
- package/src/sap/fe/core/controls/ActionParameterDialogValueHelp.fragment.xml +26 -16
- package/src/sap/fe/core/controls/Any.js +1 -1
- package/src/sap/fe/core/controls/CommandExecution.js +2 -2
- package/src/sap/fe/core/controls/ConditionalWrapper.js +2 -2
- package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.js +5 -5
- package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.ts +0 -3
- package/src/sap/fe/core/controls/CustomQuickViewPage.js +2 -2
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +1 -1
- package/src/sap/fe/core/controls/FieldWrapper.js +2 -2
- package/src/sap/fe/core/controls/FileWrapper.js +8 -3
- package/src/sap/fe/core/controls/FileWrapper.ts +5 -1
- package/src/sap/fe/core/controls/FilterBar.js +2 -2
- package/src/sap/fe/core/controls/FormElementWrapper.js +2 -2
- package/src/sap/fe/core/controls/MassEditSelect.js +1 -1
- package/src/sap/fe/core/controls/MultiValueParameterDelegate.js +1 -1
- package/src/sap/fe/core/controls/NonComputedVisibleKeyFieldsDialog.fragment.xml +48 -17
- package/src/sap/fe/core/controls/filterbar/FilterContainer.js +2 -2
- package/src/sap/fe/core/controls/filterbar/VisualFilter.js +2 -2
- package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +2 -2
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +3 -3
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.ts +2 -2
- package/src/sap/fe/core/controls/massEdit/MassEditField.fragment.xml +22 -35
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +2 -2
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.ts +1 -1
- package/src/sap/fe/core/converters/ConverterContext.js +23 -2
- package/src/sap/fe/core/converters/ConverterContext.ts +34 -9
- package/src/sap/fe/core/converters/ManifestSettings.js +19 -18
- package/src/sap/fe/core/converters/ManifestSettings.ts +53 -47
- package/src/sap/fe/core/converters/ManifestWrapper.js +1 -1
- package/src/sap/fe/core/converters/MetaModelConverter.js +32 -10
- package/src/sap/fe/core/converters/MetaModelConverter.ts +42 -19
- package/src/sap/fe/core/converters/TemplateConverter.js +1 -1
- package/src/sap/fe/core/converters/annotations/DataField.js +5 -2
- package/src/sap/fe/core/converters/annotations/DataField.ts +5 -1
- package/src/sap/fe/core/converters/common/AnnotationConverter.js +69 -23
- package/src/sap/fe/core/converters/controls/Common/Action.js +98 -51
- package/src/sap/fe/core/converters/controls/Common/Action.ts +121 -44
- package/src/sap/fe/core/converters/controls/Common/Chart.js +31 -34
- package/src/sap/fe/core/converters/controls/Common/Chart.ts +26 -34
- package/src/sap/fe/core/converters/controls/Common/Criticality.js +1 -1
- package/src/sap/fe/core/converters/controls/Common/DataVisualization.js +43 -7
- package/src/sap/fe/core/converters/controls/Common/DataVisualization.ts +60 -33
- package/src/sap/fe/core/converters/controls/Common/Form.js +8 -6
- package/src/sap/fe/core/converters/controls/Common/Form.ts +11 -14
- package/src/sap/fe/core/converters/controls/Common/KPI.js +1 -1
- package/src/sap/fe/core/converters/controls/Common/KPI.ts +16 -15
- package/src/sap/fe/core/converters/controls/Common/Table.js +188 -157
- package/src/sap/fe/core/converters/controls/Common/Table.ts +279 -230
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +1 -1
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +4 -4
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +57 -21
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +71 -18
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.js +30 -8
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.ts +24 -7
- package/src/sap/fe/core/converters/controls/ObjectPage/Avatar.js +1 -1
- package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.js +43 -34
- package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.ts +37 -25
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +85 -49
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +74 -50
- package/src/sap/fe/core/converters/helpers/Aggregation.js +54 -4
- package/src/sap/fe/core/converters/helpers/Aggregation.ts +56 -8
- package/src/sap/fe/core/converters/helpers/BindingHelper.js +1 -1
- package/src/sap/fe/core/converters/helpers/ConfigurableObject.js +6 -4
- package/src/sap/fe/core/converters/helpers/ConfigurableObject.ts +10 -2
- package/src/sap/fe/core/converters/helpers/DataFieldHelper.js +182 -0
- package/src/sap/fe/core/converters/helpers/DataFieldHelper.ts +167 -0
- package/src/sap/fe/core/converters/helpers/ID.js +3 -1
- package/src/sap/fe/core/converters/helpers/ID.ts +1 -0
- package/src/sap/fe/core/converters/helpers/IssueManager.js +1 -1
- package/src/sap/fe/core/converters/helpers/Key.js +1 -1
- package/src/sap/fe/core/converters/helpers/SelectionVariantHelper.js +1 -1
- package/src/sap/fe/core/converters/helpers/SelectionVariantHelper.ts +2 -3
- package/src/sap/fe/core/converters/objectPage/FormMenuActions.js +1 -1
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +8 -14
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +6 -9
- package/src/sap/fe/core/converters/templates/ListReportConverter.js +31 -31
- package/src/sap/fe/core/converters/templates/ListReportConverter.ts +54 -47
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +44 -15
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +64 -30
- package/src/sap/fe/core/designtime/AppComponent.designtime.js +1 -1
- package/src/sap/fe/core/formatters/CollaborationFormatter.js +1 -1
- package/src/sap/fe/core/formatters/FPMFormatter.js +1 -1
- package/src/sap/fe/core/formatters/KPIFormatter.js +1 -1
- package/src/sap/fe/core/formatters/StandardFormatter.js +13 -6
- package/src/sap/fe/core/formatters/StandardFormatter.ts +20 -14
- package/src/sap/fe/core/formatters/TableFormatter.js +1 -1
- package/src/sap/fe/core/formatters/TableFormatterTypes.js +1 -1
- package/src/sap/fe/core/formatters/ValueFormatter.js +1 -1
- 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 +5 -4
- package/src/sap/fe/core/helpers/AppStartupHelper.ts +4 -3
- package/src/sap/fe/core/helpers/BindingToolkit.js +56 -24
- package/src/sap/fe/core/helpers/BindingToolkit.ts +67 -21
- package/src/sap/fe/core/helpers/ClassSupport.js +31 -3
- package/src/sap/fe/core/helpers/ClassSupport.ts +24 -1
- package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.js +1 -1
- package/src/sap/fe/core/helpers/EditState.js +1 -1
- package/src/sap/fe/core/helpers/ExcelFormatHelper.js +1 -1
- package/src/sap/fe/core/helpers/FPMHelper.js +1 -1
- package/src/sap/fe/core/helpers/KeepAliveHelper.js +1 -1
- package/src/sap/fe/core/helpers/KeepAliveRefreshTypes.js +1 -1
- package/src/sap/fe/core/helpers/LoaderUtils.js +39 -0
- package/src/sap/fe/core/helpers/LoaderUtils.ts +14 -0
- package/src/sap/fe/core/helpers/MassEditHelper.js +475 -99
- package/src/sap/fe/core/helpers/MassEditHelper.ts +468 -155
- 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 +1 -1
- package/src/sap/fe/core/helpers/PasteHelper.js +1 -1
- package/src/sap/fe/core/helpers/SemanticDateOperators.js +82 -36
- package/src/sap/fe/core/helpers/SemanticDateOperators.ts +52 -36
- package/src/sap/fe/core/helpers/SemanticKeyHelper.js +1 -1
- package/src/sap/fe/core/helpers/SideEffectsHelper.js +146 -0
- package/src/sap/fe/core/helpers/SideEffectsHelper.ts +128 -0
- package/src/sap/fe/core/helpers/StableIdHelper.js +1 -1
- 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 +119 -0
- package/src/sap/fe/core/jsx-runtime/jsx-control.ts +98 -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 +2 -2
- package/src/sap/fe/core/library.support.js +1 -1
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +1 -1
- package/src/sap/fe/core/messagebundle.properties +4 -41
- package/src/sap/fe/core/messagebundle_ar.properties +22 -45
- package/src/sap/fe/core/messagebundle_bg.properties +22 -45
- package/src/sap/fe/core/messagebundle_ca.properties +22 -45
- package/src/sap/fe/core/messagebundle_cs.properties +22 -45
- package/src/sap/fe/core/messagebundle_cy.properties +21 -44
- package/src/sap/fe/core/messagebundle_da.properties +22 -45
- package/src/sap/fe/core/messagebundle_de.properties +22 -45
- package/src/sap/fe/core/messagebundle_el.properties +22 -45
- package/src/sap/fe/core/messagebundle_en.properties +21 -44
- package/src/sap/fe/core/messagebundle_en_GB.properties +21 -44
- package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +21 -42
- package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +20 -40
- package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +21 -42
- package/src/sap/fe/core/messagebundle_es.properties +22 -45
- package/src/sap/fe/core/messagebundle_es_MX.properties +22 -45
- package/src/sap/fe/core/messagebundle_et.properties +22 -45
- package/src/sap/fe/core/messagebundle_fi.properties +22 -45
- package/src/sap/fe/core/messagebundle_fr.properties +21 -44
- package/src/sap/fe/core/messagebundle_fr_CA.properties +20 -43
- package/src/sap/fe/core/messagebundle_hi.properties +22 -45
- package/src/sap/fe/core/messagebundle_hr.properties +22 -45
- package/src/sap/fe/core/messagebundle_hu.properties +22 -45
- package/src/sap/fe/core/messagebundle_id.properties +22 -45
- package/src/sap/fe/core/messagebundle_it.properties +22 -45
- package/src/sap/fe/core/messagebundle_iw.properties +22 -45
- package/src/sap/fe/core/messagebundle_ja.properties +22 -45
- package/src/sap/fe/core/messagebundle_kk.properties +22 -45
- package/src/sap/fe/core/messagebundle_ko.properties +27 -50
- package/src/sap/fe/core/messagebundle_lt.properties +22 -45
- package/src/sap/fe/core/messagebundle_lv.properties +22 -45
- package/src/sap/fe/core/messagebundle_ms.properties +22 -45
- package/src/sap/fe/core/messagebundle_nl.properties +24 -47
- package/src/sap/fe/core/messagebundle_no.properties +22 -45
- package/src/sap/fe/core/messagebundle_pl.properties +23 -46
- package/src/sap/fe/core/messagebundle_pt.properties +23 -46
- package/src/sap/fe/core/messagebundle_pt_PT.properties +22 -45
- package/src/sap/fe/core/messagebundle_ro.properties +22 -45
- package/src/sap/fe/core/messagebundle_ru.properties +22 -45
- package/src/sap/fe/core/messagebundle_sh.properties +22 -45
- package/src/sap/fe/core/messagebundle_sk.properties +22 -45
- package/src/sap/fe/core/messagebundle_sl.properties +22 -45
- package/src/sap/fe/core/messagebundle_sv.properties +22 -45
- package/src/sap/fe/core/messagebundle_th.properties +20 -43
- package/src/sap/fe/core/messagebundle_tr.properties +22 -45
- package/src/sap/fe/core/messagebundle_uk.properties +22 -45
- package/src/sap/fe/core/messagebundle_vi.properties +22 -45
- package/src/sap/fe/core/messagebundle_zh_CN.properties +22 -45
- package/src/sap/fe/core/messagebundle_zh_TW.properties +22 -45
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +2 -2
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +102 -74
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.ts +62 -63
- package/src/sap/fe/core/services/EnvironmentServiceFactory.js +2 -2
- package/src/sap/fe/core/services/NavigationServiceFactory.js +11 -8
- package/src/sap/fe/core/services/NavigationServiceFactory.ts +10 -7
- package/src/sap/fe/core/services/ResourceModelServiceFactory.js +2 -2
- package/src/sap/fe/core/services/RoutingServiceFactory.js +2 -2
- package/src/sap/fe/core/services/ShellServicesFactory.js +22 -2
- package/src/sap/fe/core/services/ShellServicesFactory.ts +19 -0
- package/src/sap/fe/core/services/SideEffectsServiceFactory.js +4 -4
- package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +2 -2
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +251 -200
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +160 -144
- 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 +1 -1
- package/src/sap/fe/core/support/Diagnostics.js +1 -1
- package/src/sap/fe/core/support/InvalidAnnotationColumnKey.support.js +1 -1
- package/src/sap/fe/core/templating/CommonFormatters.js +4 -3
- package/src/sap/fe/core/templating/CommonFormatters.ts +5 -1
- package/src/sap/fe/core/templating/CriticalityFormatters.js +1 -1
- package/src/sap/fe/core/templating/DataFieldFormatters.js +1 -1
- package/src/sap/fe/core/templating/DataModelPathHelper.js +8 -1
- package/src/sap/fe/core/templating/DataModelPathHelper.ts +5 -2
- package/src/sap/fe/core/templating/DisplayModeFormatter.js +1 -1
- package/src/sap/fe/core/templating/EntitySetHelper.js +4 -5
- package/src/sap/fe/core/templating/EntitySetHelper.ts +4 -3
- package/src/sap/fe/core/templating/FieldControlHelper.js +1 -1
- package/src/sap/fe/core/templating/FilterHelper.js +34 -15
- package/src/sap/fe/core/templating/FilterHelper.ts +28 -12
- package/src/sap/fe/core/templating/FilterTemplating.js +1 -1
- package/src/sap/fe/core/templating/PropertyFormatters.js +1 -1
- package/src/sap/fe/core/templating/PropertyHelper.js +1 -1
- package/src/sap/fe/core/templating/UIFormatters.js +5 -3
- package/src/sap/fe/core/templating/UIFormatters.ts +7 -5
- package/src/sap/fe/core/type/DateTimeWithTimezone.js +2 -2
- package/src/sap/fe/core/type/Email.js +2 -2
|
@@ -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,12 +10,12 @@ 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";
|
|
14
17
|
import XMLTemplateProcessor from "sap/ui/core/XMLTemplateProcessor";
|
|
15
18
|
import JSONModel from "sap/ui/model/json/JSONModel";
|
|
16
|
-
// import type Context from "sap/ui/model/odata/v4/Context";
|
|
17
19
|
|
|
18
20
|
const Constants = FELibrary.Constants,
|
|
19
21
|
InvocationGrouping = FELibrary.InvocationGrouping;
|
|
@@ -181,7 +183,8 @@ function callAction(sActionName: any, oModel: any, oAction: any, oAppComponent:
|
|
|
181
183
|
aActionParameters: aActionParameters,
|
|
182
184
|
bGetBoundContext: mParameters.bGetBoundContext,
|
|
183
185
|
defaultValuesExtensionFunction: mParameters.defaultValuesExtensionFunction,
|
|
184
|
-
label: mParameters.label
|
|
186
|
+
label: mParameters.label,
|
|
187
|
+
selectedItems: mParameters.selectedItems
|
|
185
188
|
};
|
|
186
189
|
if (oAction.getObject("$IsBound")) {
|
|
187
190
|
if (mParameters.additionalSideEffect && mParameters.additionalSideEffect.pathExpressions) {
|
|
@@ -235,6 +238,7 @@ function callAction(sActionName: any, oModel: any, oAction: any, oAppComponent:
|
|
|
235
238
|
mActionExecutionParameters.bReturnAsArray = mParameters.bReturnAsArray;
|
|
236
239
|
mActionExecutionParameters.internalModelContext = mParameters.internalModelContext;
|
|
237
240
|
mActionExecutionParameters.operationAvailableMap = mParameters.operationAvailableMap;
|
|
241
|
+
mActionExecutionParameters.isCreateAction = bIsCreateAction;
|
|
238
242
|
mActionExecutionParameters.bObjectPage = mParameters.bObjectPage;
|
|
239
243
|
if (mParameters.controlId) {
|
|
240
244
|
mActionExecutionParameters.control = mParameters.parentControl.byId(mParameters.controlId);
|
|
@@ -258,7 +262,7 @@ function callAction(sActionName: any, oModel: any, oAction: any, oAppComponent:
|
|
|
258
262
|
mParameters.messageHandler
|
|
259
263
|
);
|
|
260
264
|
} else {
|
|
261
|
-
oActionPromise = _executeAction(oAppComponent, mActionExecutionParameters);
|
|
265
|
+
oActionPromise = _executeAction(oAppComponent, mActionExecutionParameters, mParameters.parentControl);
|
|
262
266
|
}
|
|
263
267
|
return oActionPromise
|
|
264
268
|
.then(function (oOperationResult: any) {
|
|
@@ -278,10 +282,11 @@ function callAction(sActionName: any, oModel: any, oAction: any, oAppComponent:
|
|
|
278
282
|
);
|
|
279
283
|
});
|
|
280
284
|
if (!isStatic) {
|
|
281
|
-
|
|
285
|
+
ActionRuntime.setActionEnablement(
|
|
282
286
|
mActionExecutionParameters.internalModelContext,
|
|
283
287
|
JSON.parse(mActionExecutionParameters.operationAvailableMap),
|
|
284
|
-
|
|
288
|
+
mParameters.selectedItems,
|
|
289
|
+
"table"
|
|
285
290
|
);
|
|
286
291
|
}
|
|
287
292
|
}
|
|
@@ -317,22 +322,19 @@ function confirmCriticalAction(
|
|
|
317
322
|
);
|
|
318
323
|
|
|
319
324
|
MessageBox.confirm(sConfirmationText, {
|
|
320
|
-
onClose: function (sAction: any) {
|
|
325
|
+
onClose: async function (sAction: any) {
|
|
321
326
|
if (sAction === Action.OK) {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
messageHandler
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
reject(oError);
|
|
334
|
-
});
|
|
335
|
-
});
|
|
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
|
+
}
|
|
336
338
|
} else {
|
|
337
339
|
resolve();
|
|
338
340
|
}
|
|
@@ -358,8 +360,9 @@ function showActionParameterDialog(
|
|
|
358
360
|
? oActionContext.getPath().split("/@$ui5.overload/0")[0]
|
|
359
361
|
: oActionContext.getPath().split("/0")[0],
|
|
360
362
|
actionNameContext = metaModel.createBindingContext(sActionNamePath),
|
|
363
|
+
bIsCreateAction = mParameters.isCreateAction,
|
|
361
364
|
sFragmentName = "sap/fe/core/controls/ActionParameterDialog";
|
|
362
|
-
return new Promise(function (resolve
|
|
365
|
+
return new Promise(async function (resolve, reject) {
|
|
363
366
|
const oFragment = XMLTemplateProcessor.loadTemplate(sFragmentName, "fragment");
|
|
364
367
|
const oParameterModel = new JSONModel({
|
|
365
368
|
$displayMode: {}
|
|
@@ -367,8 +370,8 @@ function showActionParameterDialog(
|
|
|
367
370
|
let aFieldInvalid: any[] = [];
|
|
368
371
|
let aFormElements: any[] = [];
|
|
369
372
|
const mFieldValueMap: any = {};
|
|
370
|
-
const validateRequiredProperties = function () {
|
|
371
|
-
|
|
373
|
+
const validateRequiredProperties = async function () {
|
|
374
|
+
const aResults = await Promise.all(
|
|
372
375
|
aFormElements
|
|
373
376
|
.filter(function (oFormElement: any) {
|
|
374
377
|
const oField = oFormElement.getFields()[0];
|
|
@@ -382,11 +385,9 @@ function showActionParameterDialog(
|
|
|
382
385
|
return oFormElement.getLabel().getText();
|
|
383
386
|
}
|
|
384
387
|
})
|
|
385
|
-
)
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
});
|
|
389
|
-
return aResults;
|
|
388
|
+
);
|
|
389
|
+
return aResults.filter(function (result: any) {
|
|
390
|
+
return result !== undefined;
|
|
390
391
|
});
|
|
391
392
|
};
|
|
392
393
|
const _validateMessages = function (actionParameters: any, invalidFields: any, bClearTarget?: boolean) {
|
|
@@ -440,8 +441,8 @@ function showActionParameterDialog(
|
|
|
440
441
|
}
|
|
441
442
|
};
|
|
442
443
|
|
|
443
|
-
|
|
444
|
-
XMLPreprocessor.process(
|
|
444
|
+
try {
|
|
445
|
+
const createdFragment = await XMLPreprocessor.process(
|
|
445
446
|
oFragment,
|
|
446
447
|
{ name: sFragmentName },
|
|
447
448
|
{
|
|
@@ -457,471 +458,434 @@ function showActionParameterDialog(
|
|
|
457
458
|
metaModel: entitySetContext.getModel()
|
|
458
459
|
}
|
|
459
460
|
}
|
|
460
|
-
)
|
|
461
|
-
|
|
462
|
-
|
|
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
|
-
return;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
aFieldInvalid = _validateMessages(aActionParameters, aFieldInvalid);
|
|
507
|
-
|
|
508
|
-
if (aFieldInvalid.length > 0) {
|
|
509
|
-
return messageHandling.showUnboundMessages();
|
|
510
|
-
}
|
|
511
|
-
BusyLocker.lock(oDialog);
|
|
512
|
-
return Promise.all(
|
|
513
|
-
Object.keys(mFieldValueMap).map(function (sKey: string) {
|
|
514
|
-
return mFieldValueMap[sKey];
|
|
515
|
-
})
|
|
516
|
-
)
|
|
517
|
-
.then(function () {
|
|
518
|
-
// TODO: due to using the search and value helps on the action dialog transient messages could appear
|
|
519
|
-
// we need an UX design for those to show them to the user - for now remove them before continuing
|
|
520
|
-
messageHandler.removeTransitionMessages();
|
|
521
|
-
// move parameter values from Dialog (SimpleForm) to mParameters.actionParameters so that they are available in the operation bindings for all contexts
|
|
522
|
-
let vParameterValue;
|
|
523
|
-
const oParameterContext = oOperationBinding && oOperationBinding.getParameterContext();
|
|
524
|
-
for (const i in aActionParameters) {
|
|
525
|
-
if (aActionParameters[i].$isCollection) {
|
|
526
|
-
const aMVFContent = oDialog
|
|
527
|
-
.getModel("mvfview")
|
|
528
|
-
.getProperty(`/${aActionParameters[i].$Name}`),
|
|
529
|
-
aKeyValues = [];
|
|
530
|
-
for (const j in aMVFContent) {
|
|
531
|
-
aKeyValues.push(aMVFContent[j].Key);
|
|
532
|
-
}
|
|
533
|
-
vParameterValue = aKeyValues;
|
|
534
|
-
} else {
|
|
535
|
-
vParameterValue = oParameterContext.getProperty(aActionParameters[i].$Name);
|
|
536
|
-
}
|
|
537
|
-
aActionParameters[i].value = vParameterValue;
|
|
538
|
-
vParameterValue = undefined;
|
|
539
|
-
}
|
|
540
|
-
mParameters.label = sActionLabel;
|
|
541
|
-
return _executeAction(oAppComponent, mParameters)
|
|
542
|
-
.then(function (oOperation: any) {
|
|
543
|
-
oDialog.close();
|
|
544
|
-
resolve(oOperation);
|
|
545
|
-
})
|
|
546
|
-
.catch(function (oError: any) {
|
|
547
|
-
let messages = messageHandling.getMessages();
|
|
548
|
-
messages = messages.concat(messageHandling.getMessages(true, true));
|
|
549
|
-
if (
|
|
550
|
-
!mParameters.bGrouped &&
|
|
551
|
-
!(!mParameters.control.isA("sap.ui.mdc.Table") && aContexts.length === 1) &&
|
|
552
|
-
messages.length
|
|
553
|
-
) {
|
|
554
|
-
let errorTargetsInAPD = false;
|
|
555
|
-
|
|
556
|
-
messages.forEach(function (message: any) {
|
|
557
|
-
if (
|
|
558
|
-
message.getTarget().indexOf(mParameters.actionName) !== -1 &&
|
|
559
|
-
message
|
|
560
|
-
.getTarget()
|
|
561
|
-
.indexOf(mParameters.aActionParameters[0].$Name) !== -1 &&
|
|
562
|
-
errorTargetsInAPD === false
|
|
563
|
-
) {
|
|
564
|
-
errorTargetsInAPD = true;
|
|
565
|
-
}
|
|
566
|
-
});
|
|
567
|
-
if (!errorTargetsInAPD) {
|
|
568
|
-
oDialog.close();
|
|
569
|
-
oDialog.destroy();
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
throw oError;
|
|
573
|
-
});
|
|
574
|
-
})
|
|
575
|
-
.catch(function () {
|
|
576
|
-
const oMessageManager = Core.getMessageManager();
|
|
577
|
-
const messages = oMessageManager.getMessageModel().getData();
|
|
578
|
-
const subtitleColumn = CommonUtils.getMessageColumn(mParameters.control);
|
|
579
|
-
let errorContext;
|
|
580
|
-
let errorTargetsInAPD = false;
|
|
581
|
-
messages.forEach(function (message: any) {
|
|
582
|
-
const messageTargets = message.getTargets();
|
|
583
|
-
if (messageTargets && messageTargets.length === 1 && messageTargets[0].length) {
|
|
584
|
-
errorContext = aContexts.find(function (oContext: any) {
|
|
585
|
-
return message.getTarget().indexOf(oContext.getPath()) !== -1;
|
|
586
|
-
});
|
|
587
|
-
message.additionalText = errorContext
|
|
588
|
-
? errorContext.getObject()[subtitleColumn]
|
|
589
|
-
: undefined;
|
|
590
|
-
}
|
|
591
|
-
if (
|
|
592
|
-
message.getTarget().indexOf(mParameters.actionName) !== -1 &&
|
|
593
|
-
message.getTarget().indexOf(mParameters.aActionParameters[0].$Name) !== -1 &&
|
|
594
|
-
errorTargetsInAPD === false
|
|
595
|
-
) {
|
|
596
|
-
errorTargetsInAPD = true;
|
|
597
|
-
}
|
|
598
|
-
});
|
|
599
|
-
if (oDialog.isOpen()) {
|
|
600
|
-
if (!mParameters.bGrouped) {
|
|
601
|
-
//isolated
|
|
602
|
-
if (aContexts.length > 1 || !errorTargetsInAPD) {
|
|
603
|
-
// 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.
|
|
604
|
-
oDialog.close();
|
|
605
|
-
oDialog.destroy();
|
|
606
|
-
}
|
|
607
|
-
} else if (mParameters.bGrouped && !errorTargetsInAPD) {
|
|
608
|
-
//changeset
|
|
609
|
-
oDialog.close();
|
|
610
|
-
oDialog.destroy();
|
|
611
|
-
}
|
|
612
|
-
}
|
|
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
|
+
}
|
|
613
504
|
|
|
614
|
-
|
|
615
|
-
let bShowMessageBox = false;
|
|
616
|
-
if (
|
|
617
|
-
messages.length === 1 &&
|
|
618
|
-
messages[0].getTarget() !== undefined &&
|
|
619
|
-
messages[0].getTarget() !== ""
|
|
620
|
-
) {
|
|
621
|
-
bShowMessageBox = true;
|
|
622
|
-
}
|
|
505
|
+
aFieldInvalid = _validateMessages(aActionParameters, aFieldInvalid);
|
|
623
506
|
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
507
|
+
if (aFieldInvalid.length > 0) {
|
|
508
|
+
await messageHandling.showUnboundMessages();
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
BusyLocker.lock(oDialog);
|
|
629
512
|
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
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;
|
|
651
538
|
}
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
press: function () {
|
|
656
|
-
_validateMessages(aActionParameters, aFieldInvalid, true);
|
|
539
|
+
mParameters.label = sActionLabel;
|
|
540
|
+
try {
|
|
541
|
+
const oOperation = await _executeAction(oAppComponent, mParameters, oParentControl);
|
|
657
542
|
oDialog.close();
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
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;
|
|
665
553
|
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
return sDefaultValuesFunction;
|
|
674
|
-
};
|
|
675
|
-
const fnSetDefaultsAndOpenDialog = function (sBindingParameter?: any) {
|
|
676
|
-
const sBoundFunctionName = getDefaultValuesFunction();
|
|
677
|
-
const prefillParameter = function (sParamName: any, vParamDefaultValue: any) {
|
|
678
|
-
// eslint-disable-next-line promise/param-names
|
|
679
|
-
return new Promise((inResolve) => {
|
|
680
|
-
// Case 1: There is a ParameterDefaultValue annotation
|
|
681
|
-
if (vParamDefaultValue !== undefined) {
|
|
682
|
-
if (aContexts.length > 0 && vParamDefaultValue.$Path) {
|
|
683
|
-
const oPromise = CommonUtils.requestSingletonProperty(
|
|
684
|
-
vParamDefaultValue.$Path,
|
|
685
|
-
oOperationBinding.getModel()
|
|
686
|
-
);
|
|
687
|
-
oPromise
|
|
688
|
-
.then(function (oValue: any) {
|
|
689
|
-
if (oValue === null) {
|
|
690
|
-
return oOperationBinding
|
|
691
|
-
.getParameterContext()
|
|
692
|
-
.requestProperty(vParamDefaultValue.$Path);
|
|
693
|
-
}
|
|
694
|
-
return oValue;
|
|
695
|
-
})
|
|
696
|
-
.then(function (vParamValue: any) {
|
|
697
|
-
if (aContexts.length > 1) {
|
|
698
|
-
// For multi select, need to loop over aContexts (as contexts cannot be retrieved via binding parameter of the operation binding)
|
|
699
|
-
let sPathForContext = vParamDefaultValue.$Path;
|
|
700
|
-
if (sPathForContext.indexOf(`${sBindingParameter}/`) === 0) {
|
|
701
|
-
sPathForContext = sPathForContext.replace(`${sBindingParameter}/`, "");
|
|
702
|
-
}
|
|
703
|
-
for (let i = 1; i < aContexts.length; i++) {
|
|
704
|
-
if (aContexts[i].getProperty(sPathForContext) !== vParamValue) {
|
|
705
|
-
// if the values from the contexts are not all the same, do not prefill
|
|
706
|
-
inResolve({
|
|
707
|
-
paramName: sParamName,
|
|
708
|
-
value: undefined,
|
|
709
|
-
bNoPossibleValue: true
|
|
710
|
-
});
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
inResolve({ paramName: sParamName, value: vParamValue });
|
|
715
|
-
})
|
|
716
|
-
.catch(function () {
|
|
717
|
-
// Simply clear parameter default if an error has occurred
|
|
718
|
-
Log.error(
|
|
719
|
-
"Error while reading default action parameter",
|
|
720
|
-
sParamName,
|
|
721
|
-
mParameters.actionName
|
|
722
|
-
);
|
|
723
|
-
inResolve({
|
|
724
|
-
paramName: sParamName,
|
|
725
|
-
value: undefined,
|
|
726
|
-
bLatePropertyError: true
|
|
727
|
-
});
|
|
728
|
-
});
|
|
729
|
-
} else {
|
|
730
|
-
// Case 1.2: ParameterDefaultValue defines a fixed string value (i.e. vParamDefaultValue = 'someString')
|
|
731
|
-
inResolve({ paramName: sParamName, value: vParamDefaultValue });
|
|
732
|
-
}
|
|
733
|
-
} else if (oParameterModel && (oParameterModel as any).oData[sParamName]) {
|
|
734
|
-
// Case 2: There is no ParameterDefaultValue annotation (=> look into the FLP User Defaults)
|
|
735
|
-
|
|
736
|
-
inResolve({
|
|
737
|
-
paramName: sParamName,
|
|
738
|
-
value: (oParameterModel as any).oData[sParamName]
|
|
739
|
-
});
|
|
740
|
-
} else {
|
|
741
|
-
inResolve({ paramName: sParamName, value: undefined });
|
|
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;
|
|
742
561
|
}
|
|
743
562
|
});
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
const oMetaModel = oDialog.getModel().getMetaModel(),
|
|
748
|
-
sActionPath = oActionContext.sPath && oActionContext.sPath.split("/@")[0],
|
|
749
|
-
sActionParameterAnnotationTarget = `${sActionPath}/${sParamName}@`,
|
|
750
|
-
oParameterAnnotations = oMetaModel.getObject(sActionParameterAnnotationTarget),
|
|
751
|
-
oParameterDefaultValue =
|
|
752
|
-
oParameterAnnotations &&
|
|
753
|
-
oParameterAnnotations["@com.sap.vocabularies.UI.v1.ParameterDefaultValue"]; // either { $Path: 'somePath' } or 'someString'
|
|
754
|
-
return oParameterDefaultValue;
|
|
755
|
-
};
|
|
756
|
-
|
|
757
|
-
const aCurrentParamDefaultValue = [];
|
|
758
|
-
let sParamName, vParameterDefaultValue;
|
|
759
|
-
for (const i in aActionParameters) {
|
|
760
|
-
sParamName = aActionParameters[i].$Name;
|
|
761
|
-
vParameterDefaultValue = getParameterDefaultValue(sParamName);
|
|
762
|
-
aCurrentParamDefaultValue.push(prefillParameter(sParamName, vParameterDefaultValue));
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
if (oActionContext.getObject("$IsBound") && aContexts.length > 0) {
|
|
766
|
-
if (sBoundFunctionName && sBoundFunctionName.length > 0 && typeof sBoundFunctionName === "string") {
|
|
767
|
-
for (const i in aContexts) {
|
|
768
|
-
aFunctionParams.push(
|
|
769
|
-
callBoundFunction(sBoundFunctionName, aContexts[i], mParameters.model)
|
|
770
|
-
);
|
|
771
|
-
}
|
|
563
|
+
if (!errorTargetsInAPD) {
|
|
564
|
+
oDialog.close();
|
|
565
|
+
oDialog.destroy();
|
|
772
566
|
}
|
|
773
567
|
}
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
mParameters.defaultValuesExtensionFunction.length
|
|
788
|
-
);
|
|
789
|
-
oExecFunctionFromManifestPromise = FPMHelper.actionWrapper(oCloneEvent, sModule, sFunctionName, {
|
|
790
|
-
"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;
|
|
791
581
|
});
|
|
582
|
+
message.additionalText = errorContext ? errorContext.getObject()[subtitleColumn] : undefined;
|
|
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();
|
|
792
604
|
}
|
|
605
|
+
}
|
|
793
606
|
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
let sDialogParamName;
|
|
800
|
-
for (const i in aActionParameters) {
|
|
801
|
-
sDialogParamName = aActionParameters[i].$Name;
|
|
802
|
-
if (
|
|
803
|
-
oFunctionParamsFromManifest &&
|
|
804
|
-
oFunctionParamsFromManifest.hasOwnProperty(sDialogParamName)
|
|
805
|
-
) {
|
|
806
|
-
oOperationBinding.setParameter(
|
|
807
|
-
aActionParameters[i].$Name,
|
|
808
|
-
oFunctionParamsFromManifest[sDialogParamName]
|
|
809
|
-
);
|
|
810
|
-
} else if (currentParamDefaultValue[i] && currentParamDefaultValue[i].value !== undefined) {
|
|
811
|
-
oOperationBinding.setParameter(
|
|
812
|
-
aActionParameters[i].$Name,
|
|
813
|
-
currentParamDefaultValue[i].value
|
|
814
|
-
);
|
|
815
|
-
// if the default value had not been previously determined due to different contexts, we do nothing else
|
|
816
|
-
} else if (sBoundFunctionName && !currentParamDefaultValue[i].bNoPossibleValue) {
|
|
817
|
-
if (aContexts.length > 1) {
|
|
818
|
-
// we check if the function retrieves the same param value for all the contexts:
|
|
819
|
-
let j = 0;
|
|
820
|
-
while (j < aContexts.length - 1) {
|
|
821
|
-
if (
|
|
822
|
-
functionParams[j] &&
|
|
823
|
-
functionParams[j + 1] &&
|
|
824
|
-
functionParams[j].getObject(sDialogParamName) ===
|
|
825
|
-
functionParams[j + 1].getObject(sDialogParamName)
|
|
826
|
-
) {
|
|
827
|
-
j++;
|
|
828
|
-
} else {
|
|
829
|
-
break;
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
//param values are all the same:
|
|
833
|
-
if (j === aContexts.length - 1) {
|
|
834
|
-
oOperationBinding.setParameter(
|
|
835
|
-
aActionParameters[i].$Name,
|
|
836
|
-
functionParams[j].getObject(sDialogParamName)
|
|
837
|
-
);
|
|
838
|
-
}
|
|
839
|
-
} else if (functionParams[0] && functionParams[0].getObject(sDialogParamName)) {
|
|
840
|
-
//Only one context, then the default param values are to be verified from the function:
|
|
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
|
+
}
|
|
841
612
|
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
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);
|
|
648
|
+
|
|
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
|
+
});
|
|
846
690
|
}
|
|
847
691
|
}
|
|
848
692
|
}
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
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
|
|
853
700
|
});
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
}
|
|
862
|
-
})
|
|
863
|
-
.catch(function (oError: any) {
|
|
864
|
-
Log.error("Error while retrieving the parameter", oError);
|
|
865
|
-
});
|
|
866
|
-
};
|
|
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)
|
|
867
708
|
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
.requestObject()
|
|
873
|
-
.then(function (oContextObject: any) {
|
|
874
|
-
if (oContextObject) {
|
|
875
|
-
oOperationBinding.setParameter(sBindingParameter, oContextObject);
|
|
876
|
-
}
|
|
877
|
-
fnSetDefaultsAndOpenDialog(sBindingParameter);
|
|
878
|
-
})
|
|
879
|
-
.catch(function (oError: any) {
|
|
880
|
-
Log.error("Error while retrieving the parameter", oError);
|
|
881
|
-
});
|
|
709
|
+
inResolve({
|
|
710
|
+
paramName: sParamName,
|
|
711
|
+
value: (oParameterModel as any).oData[sParamName]
|
|
712
|
+
});
|
|
882
713
|
} else {
|
|
883
|
-
|
|
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));
|
|
884
740
|
}
|
|
885
|
-
},
|
|
886
|
-
afterClose: function () {
|
|
887
|
-
oDialog.destroy();
|
|
888
741
|
}
|
|
889
|
-
}
|
|
890
|
-
aFormElements = oDialogContent
|
|
891
|
-
.getAggregation("form")
|
|
892
|
-
.getAggregation("formContainers")[0]
|
|
893
|
-
.getAggregation("formElements");
|
|
894
|
-
oDialog.setModel(oActionContext.getModel().oModel);
|
|
895
|
-
oDialog.setModel(oParameterModel, "paramsModel");
|
|
896
|
-
oDialog.bindElement({
|
|
897
|
-
path: "/",
|
|
898
|
-
model: "paramsModel"
|
|
899
|
-
});
|
|
900
|
-
// empty model to add elements dynamically depending on number of MVF fields defined on the dialog
|
|
901
|
-
const oMVFModel = new JSONModel({});
|
|
902
|
-
oDialog.setModel(oMVFModel, "mvfview");
|
|
742
|
+
}
|
|
903
743
|
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
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);
|
|
908
749
|
}
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
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
|
+
});
|
|
915
761
|
}
|
|
916
|
-
|
|
917
|
-
|
|
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);
|
|
918
828
|
}
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
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;
|
|
834
|
+
|
|
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
|
+
};
|
|
848
|
+
|
|
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
|
+
}
|
|
925
889
|
});
|
|
926
890
|
}
|
|
927
891
|
function getActionParameters(oAction: any) {
|
|
@@ -961,7 +925,39 @@ function getIsActionCritical(oMetaModel: any, sPath: any, contexts?: any, oBound
|
|
|
961
925
|
}
|
|
962
926
|
}
|
|
963
927
|
|
|
964
|
-
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
|
+
) {
|
|
965
961
|
let oActionPromise,
|
|
966
962
|
bEnableStrictHandling = true;
|
|
967
963
|
if (bGetBoundContext) {
|
|
@@ -989,7 +985,7 @@ function executeDependingOnSelectedContexts(oAction: any, mParameters: any, bGet
|
|
|
989
985
|
.execute(
|
|
990
986
|
sGroupId,
|
|
991
987
|
undefined,
|
|
992
|
-
CommonUtils.fnOnStrictHandlingFailed.bind(operations, sGroupId, mParameters
|
|
988
|
+
CommonUtils.fnOnStrictHandlingFailed.bind(operations, sGroupId, mParameters, oResourceBundle)
|
|
993
989
|
)
|
|
994
990
|
.then(function () {
|
|
995
991
|
return oAction.getBoundContext();
|
|
@@ -997,13 +993,13 @@ function executeDependingOnSelectedContexts(oAction: any, mParameters: any, bGet
|
|
|
997
993
|
: oAction.execute(
|
|
998
994
|
sGroupId,
|
|
999
995
|
undefined,
|
|
1000
|
-
CommonUtils.fnOnStrictHandlingFailed.bind(operations, sGroupId, mParameters
|
|
996
|
+
CommonUtils.fnOnStrictHandlingFailed.bind(operations, sGroupId, mParameters, oResourceBundle)
|
|
1001
997
|
);
|
|
1002
998
|
}
|
|
1003
999
|
|
|
1004
1000
|
return oActionPromise;
|
|
1005
1001
|
}
|
|
1006
|
-
function _executeAction(oAppComponent: any, mParameters: any) {
|
|
1002
|
+
function _executeAction(oAppComponent: any, mParameters: any, oParentControl?: any) {
|
|
1007
1003
|
const aContexts = mParameters.aContexts || [];
|
|
1008
1004
|
const oModel = mParameters.model;
|
|
1009
1005
|
const iExistingMessages = messageHandling.getMessages().length || 0;
|
|
@@ -1012,6 +1008,7 @@ function _executeAction(oAppComponent: any, mParameters: any) {
|
|
|
1012
1008
|
const fnOnSubmitted = mParameters.fnOnSubmitted;
|
|
1013
1009
|
const fnOnResponse = mParameters.fnOnResponse;
|
|
1014
1010
|
const bIsCreateAction = mParameters.bIsCreateAction;
|
|
1011
|
+
const oResourceBundle = oParentControl && oParentControl.isA("sap.ui.core.mvc.View") && oParentControl.getController().oResourceBundle;
|
|
1015
1012
|
let oAction: any;
|
|
1016
1013
|
// let contextIndex = 0;
|
|
1017
1014
|
// let aMessages: any[] = [];
|
|
@@ -1074,76 +1071,42 @@ function _executeAction(oAppComponent: any, mParameters: any) {
|
|
|
1074
1071
|
setActionParameterDefaultValue();
|
|
1075
1072
|
// For invocation grouping "isolated" need batch group per action call
|
|
1076
1073
|
sGroupId = !bGrouped ? `$auto.${index}` : actionContext.getUpdateGroupId();
|
|
1077
|
-
|
|
1074
|
+
mParameters.requestSideEffects = fnRequestSideEffects.bind(operations, oAppComponent, oSideEffect, mParameters);
|
|
1075
|
+
oActionPromise = executeDependingOnSelectedContexts(
|
|
1076
|
+
actionContext,
|
|
1077
|
+
mParameters,
|
|
1078
|
+
bGetBoundContext,
|
|
1079
|
+
sGroupId,
|
|
1080
|
+
oResourceBundle
|
|
1081
|
+
);
|
|
1078
1082
|
aActionPromises.push(oActionPromise);
|
|
1079
|
-
|
|
1080
|
-
// trigger actions from side effects
|
|
1081
|
-
if (oSideEffect && oSideEffect.triggerActions && oSideEffect.triggerActions.length) {
|
|
1082
|
-
oSideEffect.triggerActions.forEach(function (sTriggerAction: any) {
|
|
1083
|
-
if (sTriggerAction) {
|
|
1084
|
-
oSideEffectsService.executeAction(sTriggerAction, oSideEffect.context, sGroupId);
|
|
1085
|
-
}
|
|
1086
|
-
});
|
|
1087
|
-
}
|
|
1088
|
-
// request side effects for this action
|
|
1089
|
-
// as we move the messages request to POST $select we need to be prepared for an empty array
|
|
1090
|
-
if (oSideEffect && oSideEffect.pathExpressions && oSideEffect.pathExpressions.length > 0) {
|
|
1091
|
-
oSideEffectsService
|
|
1092
|
-
.requestSideEffects(oSideEffect.pathExpressions, oSideEffect.context, sGroupId)
|
|
1093
|
-
.then(function () {
|
|
1094
|
-
if (mParameters.operationAvailableMap && mParameters.internalModelContext) {
|
|
1095
|
-
CommonUtils.setActionEnablement(
|
|
1096
|
-
mParameters.internalModelContext,
|
|
1097
|
-
JSON.parse(mParameters.operationAvailableMap),
|
|
1098
|
-
mParameters.aContexts
|
|
1099
|
-
);
|
|
1100
|
-
}
|
|
1101
|
-
})
|
|
1102
|
-
.catch(function (oError: any) {
|
|
1103
|
-
Log.error("Error while requesting side effects", oError);
|
|
1104
|
-
});
|
|
1105
|
-
}
|
|
1083
|
+
fnRequestSideEffects(oAppComponent, oSideEffect, mParameters, sGroupId);
|
|
1106
1084
|
};
|
|
1107
1085
|
const fnExecuteSingleAction = function (actionContext: any, index: any, oSideEffect: any) {
|
|
1108
1086
|
// eslint-disable-next-line promise/param-names
|
|
1109
1087
|
return new Promise<void>((actionResolve) => {
|
|
1110
|
-
|
|
1111
|
-
const aLocalPromise = [];
|
|
1088
|
+
const aLocalPromise: any = [];
|
|
1112
1089
|
setActionParameterDefaultValue();
|
|
1113
1090
|
// For invocation grouping "isolated" need batch group per action call
|
|
1114
1091
|
sGroupId = `apiMode${index}`;
|
|
1115
|
-
|
|
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
|
+
);
|
|
1116
1107
|
aActionPromises.push(oActionPromise);
|
|
1117
1108
|
aLocalPromise.push(oActionPromise);
|
|
1118
|
-
|
|
1119
|
-
// trigger actions from side effects
|
|
1120
|
-
if (oSideEffect && oSideEffect.triggerActions && oSideEffect.triggerActions.length) {
|
|
1121
|
-
oSideEffect.triggerActions.forEach(function (sTriggerAction: any) {
|
|
1122
|
-
if (sTriggerAction) {
|
|
1123
|
-
oLocalPromise = oSideEffectsService.executeAction(sTriggerAction, oSideEffect.context, sGroupId);
|
|
1124
|
-
aLocalPromise.push(oLocalPromise);
|
|
1125
|
-
}
|
|
1126
|
-
});
|
|
1127
|
-
}
|
|
1128
|
-
// request side effects for this action
|
|
1129
|
-
// as we move the messages request to POST $select we need to be prepared for an empty array
|
|
1130
|
-
if (oSideEffect && oSideEffect.pathExpressions && oSideEffect.pathExpressions.length > 0) {
|
|
1131
|
-
oLocalPromise = oSideEffectsService.requestSideEffects(oSideEffect.pathExpressions, oSideEffect.context, sGroupId);
|
|
1132
|
-
aLocalPromise.push(oLocalPromise);
|
|
1133
|
-
oLocalPromise
|
|
1134
|
-
.then(function () {
|
|
1135
|
-
if (mParameters.operationAvailableMap && mParameters.internalModelContext) {
|
|
1136
|
-
CommonUtils.setActionEnablement(
|
|
1137
|
-
mParameters.internalModelContext,
|
|
1138
|
-
JSON.parse(mParameters.operationAvailableMap),
|
|
1139
|
-
mParameters.aContexts
|
|
1140
|
-
);
|
|
1141
|
-
}
|
|
1142
|
-
})
|
|
1143
|
-
.catch(function (oError: any) {
|
|
1144
|
-
Log.error("Error while requesting side effects", oError);
|
|
1145
|
-
});
|
|
1146
|
-
}
|
|
1109
|
+
fnRequestSideEffects(oAppComponent, oSideEffect, mParameters, sGroupId, aLocalPromise);
|
|
1147
1110
|
oModel.submitBatch(sGroupId);
|
|
1148
1111
|
Promise.all(aLocalPromise)
|
|
1149
1112
|
.then(function () {
|
|
@@ -1267,7 +1230,7 @@ function _executeAction(oAppComponent: any, mParameters: any) {
|
|
|
1267
1230
|
const oActionPromise = oAction.execute(
|
|
1268
1231
|
sGroupId,
|
|
1269
1232
|
undefined,
|
|
1270
|
-
CommonUtils.fnOnStrictHandlingFailed.bind(operations, sGroupId, mParameters.label, oModel)
|
|
1233
|
+
CommonUtils.fnOnStrictHandlingFailed.bind(operations, sGroupId, { label: mParameters.label, model: oModel }, oResourceBundle)
|
|
1271
1234
|
);
|
|
1272
1235
|
oModel.submitBatch(sGroupId);
|
|
1273
1236
|
// trigger onSubmitted "event"
|
|
@@ -1307,6 +1270,44 @@ function _showActionParameterDialog(showDialog: boolean, actionParameters: Recor
|
|
|
1307
1270
|
return showDialog;
|
|
1308
1271
|
}
|
|
1309
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
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1310
1311
|
/**
|
|
1311
1312
|
* Static functions to call OData actions (bound/import) and functions (bound/import)
|
|
1312
1313
|
*
|
|
@@ -1322,7 +1323,8 @@ const operations = {
|
|
|
1322
1323
|
callBoundFunction: callBoundFunction,
|
|
1323
1324
|
callFunctionImport: callFunctionImport,
|
|
1324
1325
|
executeDependingOnSelectedContexts: executeDependingOnSelectedContexts,
|
|
1325
|
-
showActionParameterDialog: _showActionParameterDialog
|
|
1326
|
+
showActionParameterDialog: _showActionParameterDialog,
|
|
1327
|
+
getActionParameterActionName: _getActionParameterActionName
|
|
1326
1328
|
};
|
|
1327
1329
|
|
|
1328
1330
|
export default operations;
|