@sapui5/sap.fe.core 1.97.0 → 1.100.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 +7 -4
- package/src/sap/fe/core/.library +1 -1
- package/src/sap/fe/core/AnnotationHelper.js +309 -405
- package/src/sap/fe/core/AnnotationHelper.ts +315 -0
- package/src/sap/fe/core/AppComponent.js +389 -397
- package/src/sap/fe/core/AppComponent.ts +403 -0
- package/src/sap/fe/core/AppStateHandler.js +198 -181
- package/src/sap/fe/core/AppStateHandler.ts +171 -0
- package/src/sap/fe/core/BaseController.js +83 -58
- package/src/sap/fe/core/BaseController.ts +68 -0
- package/src/sap/fe/core/BusyLocker.js +105 -121
- package/src/sap/fe/core/BusyLocker.ts +98 -0
- package/src/sap/fe/core/CommonUtils.js +2164 -2379
- package/src/sap/fe/core/CommonUtils.ts +2177 -0
- package/src/sap/fe/core/ExtensionAPI.js +279 -266
- package/src/sap/fe/core/ExtensionAPI.ts +250 -0
- package/src/sap/fe/core/PageController.js +218 -125
- package/src/sap/fe/core/PageController.ts +129 -0
- package/src/sap/fe/core/RouterProxy.js +924 -807
- package/src/sap/fe/core/RouterProxy.ts +840 -0
- package/src/sap/fe/core/Synchronization.js +41 -35
- package/src/sap/fe/core/Synchronization.ts +29 -0
- package/src/sap/fe/core/TemplateComponent.js +173 -155
- package/src/sap/fe/core/TemplateComponent.ts +173 -0
- package/src/sap/fe/core/TemplateModel.js +79 -54
- package/src/sap/fe/core/TemplateModel.ts +63 -0
- package/src/sap/fe/core/TransactionHelper.js +1560 -1579
- package/src/sap/fe/core/TransactionHelper.ts +1717 -0
- package/src/sap/fe/core/actions/collaboration/ActivitySync.js +392 -0
- package/src/sap/fe/core/actions/collaboration/ActivitySync.ts +355 -0
- package/src/sap/fe/core/actions/collaboration/CollaborationCommon.js +136 -0
- package/src/sap/fe/core/actions/collaboration/CollaborationCommon.ts +119 -0
- package/src/sap/fe/core/actions/collaboration/Manage.js +262 -0
- package/src/sap/fe/core/actions/collaboration/Manage.ts +244 -0
- package/src/sap/fe/core/actions/collaboration/ManageDialog.fragment.xml +103 -0
- package/src/sap/fe/core/actions/collaboration/UserDetails.fragment.xml +13 -0
- package/src/sap/fe/core/actions/draft.js +521 -581
- package/src/sap/fe/core/actions/draft.ts +566 -0
- package/src/sap/fe/core/actions/messageHandling.js +564 -511
- package/src/sap/fe/core/actions/messageHandling.ts +552 -0
- package/src/sap/fe/core/actions/nonDraft.js +17 -19
- package/src/sap/fe/core/actions/nonDraft.ts +12 -0
- package/src/sap/fe/core/actions/operations.js +1093 -1211
- package/src/sap/fe/core/actions/operations.ts +1192 -0
- package/src/sap/fe/core/actions/sticky.js +114 -104
- package/src/sap/fe/core/actions/sticky.ts +119 -0
- package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.js +70 -66
- package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.ts +65 -0
- package/src/sap/fe/core/controllerextensions/EditFlow.js +1594 -1701
- package/src/sap/fe/core/controllerextensions/EditFlow.ts +1672 -0
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +80 -54
- package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.ts +61 -0
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +719 -505
- package/src/sap/fe/core/controllerextensions/InternalEditFlow.ts +783 -0
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +797 -813
- package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.ts +803 -0
- package/src/sap/fe/core/controllerextensions/InternalRouting.js +1005 -973
- package/src/sap/fe/core/controllerextensions/InternalRouting.ts +978 -0
- package/src/sap/fe/core/controllerextensions/KPIManagement.js +530 -476
- package/src/sap/fe/core/controllerextensions/KPIManagement.ts +137 -46
- package/src/sap/fe/core/controllerextensions/MassEdit.js +144 -0
- package/src/sap/fe/core/controllerextensions/MassEdit.ts +156 -0
- package/src/sap/fe/core/controllerextensions/MessageHandler.js +234 -232
- package/src/sap/fe/core/controllerextensions/MessageHandler.ts +225 -0
- package/src/sap/fe/core/controllerextensions/PageReady.js +302 -337
- package/src/sap/fe/core/controllerextensions/PageReady.ts +23 -17
- package/src/sap/fe/core/controllerextensions/Paginator.js +189 -148
- package/src/sap/fe/core/controllerextensions/Paginator.ts +163 -0
- package/src/sap/fe/core/controllerextensions/Placeholder.js +158 -146
- package/src/sap/fe/core/controllerextensions/Placeholder.ts +151 -0
- package/src/sap/fe/core/controllerextensions/Routing.js +145 -106
- package/src/sap/fe/core/controllerextensions/Routing.ts +132 -0
- package/src/sap/fe/core/controllerextensions/RoutingListener.js +8 -6
- package/src/sap/fe/core/controllerextensions/RoutingListener.ts +3 -0
- package/src/sap/fe/core/controllerextensions/Share.js +220 -244
- package/src/sap/fe/core/controllerextensions/Share.ts +231 -0
- package/src/sap/fe/core/controllerextensions/SideEffects.js +593 -634
- package/src/sap/fe/core/controllerextensions/SideEffects.ts +29 -27
- package/src/sap/fe/core/controllerextensions/ViewState.js +789 -806
- package/src/sap/fe/core/controllerextensions/ViewState.ts +805 -0
- package/src/sap/fe/core/controls/ActionParameterDialog.fragment.xml +4 -3
- package/src/sap/fe/core/controls/ActionPartial.fragment.xml +2 -2
- package/src/sap/fe/core/controls/CommandExecution.js +68 -66
- package/src/sap/fe/core/controls/CommandExecution.ts +72 -0
- package/src/sap/fe/core/controls/ConditionalWrapper.js +91 -75
- package/src/sap/fe/core/controls/ConditionalWrapper.ts +83 -0
- package/src/sap/fe/core/controls/CustomQuickViewPage.js +131 -125
- package/src/sap/fe/core/controls/CustomQuickViewPage.ts +126 -0
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +105 -110
- package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.ts +101 -0
- package/src/sap/fe/core/controls/FieldWrapper.js +122 -140
- package/src/sap/fe/core/controls/FieldWrapper.ts +115 -0
- package/src/sap/fe/core/controls/FilterBar.js +163 -159
- package/src/sap/fe/core/controls/FilterBar.ts +143 -0
- package/src/sap/fe/core/controls/FormElementWrapper.js +46 -44
- package/src/sap/fe/core/controls/FormElementWrapper.ts +40 -0
- package/src/sap/fe/core/controls/MultiValueParameterDelegate.js +38 -42
- package/src/sap/fe/core/controls/MultiValueParameterDelegate.ts +31 -0
- package/src/sap/fe/core/controls/NonComputedVisibleKeyFieldsDialog.fragment.xml +2 -1
- package/src/sap/fe/core/controls/filterbar/FilterContainer.js +127 -116
- package/src/sap/fe/core/controls/filterbar/FilterContainer.ts +98 -0
- package/src/sap/fe/core/controls/filterbar/VisualFilter.js +242 -255
- package/src/sap/fe/core/controls/filterbar/VisualFilter.ts +245 -0
- package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +151 -141
- package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.ts +125 -0
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +336 -322
- package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.ts +337 -0
- package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +106 -0
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +79 -0
- package/src/sap/fe/core/controls/massEdit/MassEditHandlers.ts +70 -0
- package/src/sap/fe/core/converters/ConverterContext.js +348 -367
- package/src/sap/fe/core/converters/ConverterContext.ts +33 -19
- package/src/sap/fe/core/converters/ManifestSettings.js +12 -1
- package/src/sap/fe/core/converters/ManifestSettings.ts +16 -1
- package/src/sap/fe/core/converters/ManifestWrapper.js +354 -354
- package/src/sap/fe/core/converters/ManifestWrapper.ts +34 -6
- package/src/sap/fe/core/converters/MetaModelConverter.js +72 -9
- package/src/sap/fe/core/converters/MetaModelConverter.ts +75 -16
- package/src/sap/fe/core/converters/TemplateConverter.js +1 -1
- package/src/sap/fe/core/converters/TemplateConverter.ts +4 -3
- package/src/sap/fe/core/converters/annotations/DataField.js +28 -14
- package/src/sap/fe/core/converters/annotations/DataField.ts +38 -14
- package/src/sap/fe/core/converters/common/AnnotationConverter.js +33 -21
- package/src/sap/fe/core/converters/controls/Common/Action.js +11 -2
- package/src/sap/fe/core/converters/controls/Common/Action.ts +8 -2
- package/src/sap/fe/core/converters/controls/Common/Chart.js +5 -3
- package/src/sap/fe/core/converters/controls/Common/Chart.ts +11 -3
- package/src/sap/fe/core/converters/controls/Common/DataVisualization.js +3 -3
- package/src/sap/fe/core/converters/controls/Common/DataVisualization.ts +2 -2
- package/src/sap/fe/core/converters/controls/Common/Form.js +21 -11
- package/src/sap/fe/core/converters/controls/Common/Form.ts +28 -6
- package/src/sap/fe/core/converters/controls/Common/KPI.js +69 -4
- package/src/sap/fe/core/converters/controls/Common/KPI.ts +75 -2
- package/src/sap/fe/core/converters/controls/Common/Table.js +507 -408
- package/src/sap/fe/core/converters/controls/Common/Table.ts +618 -500
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +592 -0
- package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +718 -0
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +465 -59
- package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +462 -72
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.js +2 -2
- package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.ts +1 -1
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +17 -9
- package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +24 -9
- package/src/sap/fe/core/converters/helpers/Aggregation.js +118 -121
- package/src/sap/fe/core/converters/helpers/Aggregation.ts +28 -5
- package/src/sap/fe/core/converters/helpers/BindingHelper.js +20 -6
- package/src/sap/fe/core/converters/helpers/BindingHelper.ts +16 -4
- package/src/sap/fe/core/converters/helpers/ConfigurableObject.js +12 -1
- package/src/sap/fe/core/converters/helpers/ConfigurableObject.ts +11 -0
- package/src/sap/fe/core/converters/helpers/IssueManager.js +7 -1
- package/src/sap/fe/core/converters/helpers/IssueManager.ts +6 -0
- package/src/sap/fe/core/converters/helpers/Key.js +42 -57
- package/src/sap/fe/core/converters/helpers/Key.ts +1 -1
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +28 -7
- package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +23 -6
- package/src/sap/fe/core/converters/templates/ListReportConverter.js +20 -7
- package/src/sap/fe/core/converters/templates/ListReportConverter.ts +36 -14
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +7 -5
- package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +5 -1
- package/src/sap/fe/core/designtime/AppComponent.designtime.js +93 -90
- package/src/sap/fe/core/designtime/AppComponent.designtime.ts +91 -0
- package/src/sap/fe/core/formatters/CollaborationFormatter.js +104 -0
- package/src/sap/fe/core/formatters/CollaborationFormatter.ts +60 -0
- package/src/sap/fe/core/formatters/CriticalityFormatter.js +1 -1
- package/src/sap/fe/core/formatters/CriticalityFormatter.ts +1 -1
- package/src/sap/fe/core/formatters/FPMFormatter.js +1 -1
- package/src/sap/fe/core/formatters/FPMFormatter.ts +4 -10
- package/src/sap/fe/core/formatters/KPIFormatter.js +1 -1
- package/src/sap/fe/core/formatters/KPIFormatter.ts +3 -1
- package/src/sap/fe/core/formatters/TableFormatter.js +91 -29
- package/src/sap/fe/core/formatters/TableFormatter.ts +94 -28
- package/src/sap/fe/core/formatters/ValueFormatter.js +30 -5
- package/src/sap/fe/core/formatters/ValueFormatter.ts +30 -7
- package/src/sap/fe/core/fpm/Component.js +51 -54
- package/src/sap/fe/core/fpm/Component.ts +48 -0
- package/src/sap/fe/core/helpers/AppStartupHelper.js +373 -0
- package/src/sap/fe/core/helpers/AppStartupHelper.ts +417 -0
- package/src/sap/fe/core/helpers/BindingExpression.js +489 -442
- package/src/sap/fe/core/helpers/BindingExpression.ts +486 -469
- package/src/sap/fe/core/helpers/ClassSupport.js +212 -76
- package/src/sap/fe/core/helpers/ClassSupport.ts +198 -71
- package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.js +64 -59
- package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.ts +52 -0
- package/src/sap/fe/core/helpers/EditState.js +81 -84
- package/src/sap/fe/core/helpers/EditState.ts +81 -0
- package/src/sap/fe/core/helpers/ExcelFormatHelper.js +62 -48
- package/src/sap/fe/core/helpers/ExcelFormatHelper.ts +49 -0
- package/src/sap/fe/core/helpers/FPMHelper.js +52 -56
- package/src/sap/fe/core/helpers/FPMHelper.ts +62 -0
- package/src/sap/fe/core/helpers/KeepAliveHelper.js +4 -5
- package/src/sap/fe/core/helpers/KeepAliveHelper.ts +10 -10
- package/src/sap/fe/core/helpers/MassEditHelper.js +604 -0
- package/src/sap/fe/core/helpers/MassEditHelper.ts +699 -0
- package/src/sap/fe/core/helpers/ModelHelper.js +253 -225
- package/src/sap/fe/core/helpers/ModelHelper.ts +250 -0
- package/src/sap/fe/core/helpers/PasteHelper.js +210 -132
- package/src/sap/fe/core/helpers/PasteHelper.ts +196 -0
- package/src/sap/fe/core/helpers/SemanticDateOperators.js +336 -313
- package/src/sap/fe/core/helpers/SemanticDateOperators.ts +334 -0
- package/src/sap/fe/core/helpers/SemanticKeyHelper.js +66 -67
- package/src/sap/fe/core/helpers/SemanticKeyHelper.ts +73 -0
- package/src/sap/fe/core/helpers/StableIdHelper.js +4 -7
- package/src/sap/fe/core/helpers/StableIdHelper.ts +2 -6
- package/src/sap/fe/core/jsx-runtime/jsx.js +1 -1
- package/src/sap/fe/core/jsx-runtime/jsx.ts +1 -1
- package/src/sap/fe/core/library.js +427 -425
- package/src/sap/fe/core/library.support.js +23 -27
- package/src/sap/fe/core/library.support.ts +23 -0
- package/src/sap/fe/core/library.ts +420 -0
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +64 -0
- package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +69 -0
- package/src/sap/fe/core/messagebundle.properties +78 -13
- package/src/sap/fe/core/messagebundle_ar.properties +58 -7
- package/src/sap/fe/core/messagebundle_bg.properties +58 -7
- package/src/sap/fe/core/messagebundle_ca.properties +58 -7
- package/src/sap/fe/core/messagebundle_cs.properties +59 -8
- package/src/sap/fe/core/messagebundle_cy.properties +58 -7
- package/src/sap/fe/core/messagebundle_da.properties +58 -7
- package/src/sap/fe/core/messagebundle_de.properties +58 -7
- package/src/sap/fe/core/messagebundle_el.properties +58 -7
- package/src/sap/fe/core/messagebundle_en.properties +57 -6
- package/src/sap/fe/core/messagebundle_en_GB.properties +57 -6
- package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +61 -6
- package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +58 -7
- package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +58 -7
- package/src/sap/fe/core/messagebundle_es.properties +58 -7
- package/src/sap/fe/core/messagebundle_es_MX.properties +58 -7
- package/src/sap/fe/core/messagebundle_et.properties +58 -7
- package/src/sap/fe/core/messagebundle_fi.properties +60 -9
- package/src/sap/fe/core/messagebundle_fr.properties +64 -13
- package/src/sap/fe/core/messagebundle_fr_CA.properties +59 -8
- package/src/sap/fe/core/messagebundle_hi.properties +58 -7
- package/src/sap/fe/core/messagebundle_hr.properties +58 -7
- package/src/sap/fe/core/messagebundle_hu.properties +59 -8
- package/src/sap/fe/core/messagebundle_id.properties +61 -10
- package/src/sap/fe/core/messagebundle_it.properties +58 -7
- package/src/sap/fe/core/messagebundle_iw.properties +58 -7
- package/src/sap/fe/core/messagebundle_ja.properties +58 -7
- package/src/sap/fe/core/messagebundle_kk.properties +58 -7
- package/src/sap/fe/core/messagebundle_ko.properties +58 -7
- package/src/sap/fe/core/messagebundle_lt.properties +58 -7
- package/src/sap/fe/core/messagebundle_lv.properties +59 -8
- package/src/sap/fe/core/messagebundle_ms.properties +58 -7
- package/src/sap/fe/core/messagebundle_nl.properties +58 -7
- package/src/sap/fe/core/messagebundle_no.properties +58 -7
- package/src/sap/fe/core/messagebundle_pl.properties +58 -7
- package/src/sap/fe/core/messagebundle_pt.properties +59 -8
- package/src/sap/fe/core/messagebundle_pt_PT.properties +58 -7
- package/src/sap/fe/core/messagebundle_ro.properties +58 -7
- package/src/sap/fe/core/messagebundle_ru.properties +58 -7
- package/src/sap/fe/core/messagebundle_sh.properties +58 -7
- package/src/sap/fe/core/messagebundle_sk.properties +58 -7
- package/src/sap/fe/core/messagebundle_sl.properties +58 -7
- package/src/sap/fe/core/messagebundle_sv.properties +59 -8
- package/src/sap/fe/core/messagebundle_th.properties +58 -7
- package/src/sap/fe/core/messagebundle_tr.properties +60 -9
- package/src/sap/fe/core/messagebundle_uk.properties +58 -7
- package/src/sap/fe/core/messagebundle_vi.properties +58 -7
- package/src/sap/fe/core/messagebundle_zh_CN.properties +58 -7
- package/src/sap/fe/core/messagebundle_zh_TW.properties +58 -7
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +45 -71
- package/src/sap/fe/core/services/AsyncComponentServiceFactory.ts +3 -1
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +231 -202
- package/src/sap/fe/core/services/CacheHandlerServiceFactory.ts +212 -0
- package/src/sap/fe/core/services/EnvironmentServiceFactory.js +67 -92
- package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +10 -6
- package/src/sap/fe/core/services/NavigationServiceFactory.js +351 -300
- package/src/sap/fe/core/services/NavigationServiceFactory.ts +313 -0
- package/src/sap/fe/core/services/ResourceModelServiceFactory.js +114 -81
- package/src/sap/fe/core/services/ResourceModelServiceFactory.ts +83 -0
- package/src/sap/fe/core/services/RoutingServiceFactory.js +927 -1152
- package/src/sap/fe/core/services/RoutingServiceFactory.ts +898 -0
- package/src/sap/fe/core/services/ShellServicesFactory.js +649 -707
- package/src/sap/fe/core/services/ShellServicesFactory.ts +52 -15
- package/src/sap/fe/core/services/SideEffectsServiceFactory.js +569 -637
- package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +78 -102
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +429 -478
- package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +460 -0
- package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.js +10 -8
- package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.ts +8 -0
- package/src/sap/fe/core/support/AnnotationIssue.support.js +15 -3
- package/src/sap/fe/core/support/AnnotationIssue.support.ts +16 -2
- package/src/sap/fe/core/support/CollectionFacetUnsupportedLevel.support.js +2 -2
- package/src/sap/fe/core/support/CollectionFacetUnsupportedLevel.support.ts +1 -1
- package/src/sap/fe/core/support/CommonHelper.js +1 -1
- package/src/sap/fe/core/support/CommonHelper.ts +1 -1
- package/src/sap/fe/core/support/Diagnostics.js +36 -48
- package/src/sap/fe/core/support/InvalidAnnotationColumnKey.support.js +38 -0
- package/src/sap/fe/core/support/InvalidAnnotationColumnKey.support.ts +18 -0
- package/src/sap/fe/core/templating/DataModelPathHelper.js +97 -127
- package/src/sap/fe/core/templating/DataModelPathHelper.ts +112 -135
- package/src/sap/fe/core/templating/DisplayModeFormatter.js +114 -0
- package/src/sap/fe/core/templating/DisplayModeFormatter.ts +86 -0
- package/src/sap/fe/core/templating/FieldControlHelper.js +8 -8
- package/src/sap/fe/core/templating/FieldControlHelper.ts +25 -7
- package/src/sap/fe/core/templating/FilterHelper.js +140 -78
- package/src/sap/fe/core/templating/FilterHelper.ts +149 -78
- package/src/sap/fe/core/templating/PropertyHelper.js +3 -3
- package/src/sap/fe/core/templating/PropertyHelper.ts +2 -2
- package/src/sap/fe/core/templating/UIFormatters.js +76 -135
- package/src/sap/fe/core/templating/UIFormatters.ts +76 -99
- package/src/sap/fe/core/type/Email.js +1 -1
- package/src/sap/fe/core/type/Email.ts +4 -6
- package/ui5.yaml +0 -3
- package/src/sap/fe/core/controls/filterbar.d.js +0 -8
- package/src/sap/fe/core/controls/filterbar.d.ts +0 -0
|
@@ -0,0 +1,783 @@
|
|
|
1
|
+
import ControllerExtension from "sap/ui/core/mvc/ControllerExtension";
|
|
2
|
+
import OverrideExecution from "sap/ui/core/mvc/OverrideExecution";
|
|
3
|
+
import TransactionHelper from "sap/fe/core/TransactionHelper";
|
|
4
|
+
import Log from "sap/base/Log";
|
|
5
|
+
import CommonUtils from "sap/fe/core/CommonUtils";
|
|
6
|
+
import BusyLocker from "sap/fe/core/BusyLocker";
|
|
7
|
+
import FELibrary from "sap/fe/core/library";
|
|
8
|
+
import EditState from "sap/fe/core/helpers/EditState";
|
|
9
|
+
import { Extensible, Final, Override, Private, Public, UI5Class } from "sap/fe/core/helpers/ClassSupport";
|
|
10
|
+
import ControllerExtensionMetadata from "sap/fe/core/controllerextensions/ControllerExtensionMetadata";
|
|
11
|
+
import AppComponent from "sap/fe/core/AppComponent";
|
|
12
|
+
import PageController from "sap/fe/core/PageController";
|
|
13
|
+
import JSONModel from "sap/ui/model/json/JSONModel";
|
|
14
|
+
import Table from "sap/ui/mdc/Table";
|
|
15
|
+
import Dialog from "sap/m/Dialog";
|
|
16
|
+
import Button from "sap/m/Button";
|
|
17
|
+
import Text from "sap/m/Text";
|
|
18
|
+
import Model from "sap/ui/model/Model";
|
|
19
|
+
import sticky from "sap/fe/core/actions/sticky";
|
|
20
|
+
import View from "sap/ui/core/mvc/View";
|
|
21
|
+
import { send } from "sap/fe/core/actions/collaboration/ActivitySync";
|
|
22
|
+
import { Activity } from "sap/fe/core/actions/collaboration/CollaborationCommon";
|
|
23
|
+
import Context from "sap/ui/model/odata/v4/Context";
|
|
24
|
+
|
|
25
|
+
const ProgrammingModel = FELibrary.ProgrammingModel,
|
|
26
|
+
DraftStatus = FELibrary.DraftStatus,
|
|
27
|
+
EditMode = FELibrary.EditMode,
|
|
28
|
+
CreationMode = FELibrary.CreationMode;
|
|
29
|
+
|
|
30
|
+
@UI5Class("sap.fe.core.controllerextensions.InternalEditFlow", ControllerExtensionMetadata)
|
|
31
|
+
class InternalEditFlow extends ControllerExtension {
|
|
32
|
+
private base!: PageController;
|
|
33
|
+
private _oAppComponent!: AppComponent;
|
|
34
|
+
private _pTasks: any;
|
|
35
|
+
private oActionPromise?: Promise<any>;
|
|
36
|
+
private _oTransactionHelper?: TransactionHelper;
|
|
37
|
+
private fnDirtyStateProvider?: Function;
|
|
38
|
+
private fnHandleSessionTimeout?: Function;
|
|
39
|
+
private fnStickyDiscardAfterNavigation?: Function;
|
|
40
|
+
@Override()
|
|
41
|
+
onInit() {
|
|
42
|
+
this._oAppComponent = this.base.getAppComponent();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Override to set the creation mode.
|
|
47
|
+
*
|
|
48
|
+
* @param bCreationMode
|
|
49
|
+
* @memberof sap.fe.core.controllerextensions.InternalEditFlow
|
|
50
|
+
* @alias sap.fe.core.controllerextensions.InternalEditFlow#setCreationMode
|
|
51
|
+
* @since 1.90.0
|
|
52
|
+
*/
|
|
53
|
+
@Private
|
|
54
|
+
@Extensible(OverrideExecution.After)
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
56
|
+
setCreationMode(bCreationMode: boolean) {
|
|
57
|
+
// to be overridden
|
|
58
|
+
}
|
|
59
|
+
@Public
|
|
60
|
+
@Final
|
|
61
|
+
createMultipleDocuments(oListBinding: any, aData: any, bCreateAtEnd: any, bFromCopyPaste: any, beforeCreateCallBack: any) {
|
|
62
|
+
const transactionHelper = this.getTransactionHelper(),
|
|
63
|
+
oLockObject = this.getGlobalUIModel(),
|
|
64
|
+
oResourceBundle = (this.getView().getController() as any).oResourceBundle;
|
|
65
|
+
|
|
66
|
+
BusyLocker.lock(oLockObject);
|
|
67
|
+
return this.syncTask()
|
|
68
|
+
.then(function() {
|
|
69
|
+
const onBeforeCreatePromise = beforeCreateCallBack
|
|
70
|
+
? beforeCreateCallBack({ contextPath: oListBinding && oListBinding.getPath() })
|
|
71
|
+
: Promise.resolve();
|
|
72
|
+
return onBeforeCreatePromise;
|
|
73
|
+
})
|
|
74
|
+
.then(() => {
|
|
75
|
+
const oModel = oListBinding.getModel(),
|
|
76
|
+
oMetaModel = oModel.getMetaModel();
|
|
77
|
+
let sMetaPath: string;
|
|
78
|
+
|
|
79
|
+
if (oListBinding.getContext()) {
|
|
80
|
+
sMetaPath = oMetaModel.getMetaPath(oListBinding.getContext().getPath() + "/" + oListBinding.getPath());
|
|
81
|
+
} else {
|
|
82
|
+
sMetaPath = oMetaModel.getMetaPath(oListBinding.getPath());
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
this.handleCreateEvents(oListBinding);
|
|
86
|
+
|
|
87
|
+
// Iterate on all items and store the corresponding creation promise
|
|
88
|
+
const aCreationPromises = aData.map((mPropertyValues: any) => {
|
|
89
|
+
const mParameters: any = { data: {} };
|
|
90
|
+
|
|
91
|
+
mParameters.keepTransientContextOnFailed = false; // currently not fully supported
|
|
92
|
+
mParameters.busyMode = "None";
|
|
93
|
+
mParameters.creationMode = CreationMode.CreationRow;
|
|
94
|
+
mParameters.parentControl = this.getView();
|
|
95
|
+
mParameters.createAtEnd = bCreateAtEnd;
|
|
96
|
+
|
|
97
|
+
// Remove navigation properties as we don't support deep create
|
|
98
|
+
for (const sPropertyPath in mPropertyValues) {
|
|
99
|
+
const oProperty = oMetaModel.getObject(sMetaPath + "/" + sPropertyPath);
|
|
100
|
+
if (oProperty && oProperty.$kind !== "NavigationProperty" && mPropertyValues[sPropertyPath]) {
|
|
101
|
+
mParameters.data[sPropertyPath] = mPropertyValues[sPropertyPath];
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return transactionHelper.createDocument(
|
|
106
|
+
oListBinding,
|
|
107
|
+
mParameters,
|
|
108
|
+
oResourceBundle,
|
|
109
|
+
this.getMessageHandler(),
|
|
110
|
+
bFromCopyPaste,
|
|
111
|
+
this.getView()
|
|
112
|
+
);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
return Promise.all(aCreationPromises);
|
|
116
|
+
})
|
|
117
|
+
.then(function(aContexts: any) {
|
|
118
|
+
// transient contexts are reliably removed once oNewContext.created() is resolved
|
|
119
|
+
return Promise.all(
|
|
120
|
+
aContexts.map(function(oNewContext: any) {
|
|
121
|
+
return oNewContext.created();
|
|
122
|
+
})
|
|
123
|
+
);
|
|
124
|
+
})
|
|
125
|
+
.then(() => {
|
|
126
|
+
const oBindingContext = this.getView().getBindingContext();
|
|
127
|
+
|
|
128
|
+
// if there are transient contexts, we must avoid requesting side effects
|
|
129
|
+
// this is avoid a potential list refresh, there could be a side effect that refreshes the list binding
|
|
130
|
+
// if list binding is refreshed, transient contexts might be lost
|
|
131
|
+
if (!CommonUtils.hasTransientContext(oListBinding)) {
|
|
132
|
+
this._oAppComponent
|
|
133
|
+
.getSideEffectsService()
|
|
134
|
+
.requestSideEffectsForNavigationProperty(oListBinding.getPath(), oBindingContext as Context);
|
|
135
|
+
}
|
|
136
|
+
})
|
|
137
|
+
.catch(function(err: any) {
|
|
138
|
+
Log.error("Error while creating multiple documents.");
|
|
139
|
+
return Promise.reject(err);
|
|
140
|
+
})
|
|
141
|
+
.finally(function() {
|
|
142
|
+
BusyLocker.unlock(oLockObject);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
@Public
|
|
146
|
+
@Final
|
|
147
|
+
deleteMultipleDocuments(aContexts: any, mParameters: any) {
|
|
148
|
+
const oRoutingListener = this.getRoutingListener(),
|
|
149
|
+
oLockObject = this.getGlobalUIModel();
|
|
150
|
+
const oTable = this.getView().byId(mParameters.controlId) as Table;
|
|
151
|
+
if (!oTable || !oTable.isA("sap.ui.mdc.Table")) {
|
|
152
|
+
throw new Error("parameter controlId missing or incorrect");
|
|
153
|
+
}
|
|
154
|
+
const oListBinding = oTable.getRowBinding() as any;
|
|
155
|
+
mParameters.bFindActiveContexts = true;
|
|
156
|
+
BusyLocker.lock(oLockObject);
|
|
157
|
+
return this.deleteDocumentTransaction(aContexts, mParameters)
|
|
158
|
+
.then(() => {
|
|
159
|
+
let oResult;
|
|
160
|
+
|
|
161
|
+
// Multiple object deletion is triggered from a list
|
|
162
|
+
// First clear the selection in the table as it's not valid any more
|
|
163
|
+
(oTable as any).clearSelection();
|
|
164
|
+
|
|
165
|
+
// Then refresh the list-binding (LR), or require side-effects (OP)
|
|
166
|
+
const oBindingContext = this.getView().getBindingContext();
|
|
167
|
+
if (oListBinding.isRoot()) {
|
|
168
|
+
// keep promise chain pending until refresh of listbinding is completed
|
|
169
|
+
oResult = new Promise<void>(resolve => {
|
|
170
|
+
oListBinding.attachEventOnce("dataReceived", function() {
|
|
171
|
+
resolve();
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
oListBinding.refresh();
|
|
175
|
+
} else if (oBindingContext) {
|
|
176
|
+
// if there are transient contexts, we must avoid requesting side effects
|
|
177
|
+
// this is avoid a potential list refresh, there could be a side effect that refreshes the list binding
|
|
178
|
+
// if list binding is refreshed, transient contexts might be lost
|
|
179
|
+
if (!CommonUtils.hasTransientContext(oListBinding)) {
|
|
180
|
+
this._oAppComponent
|
|
181
|
+
.getSideEffectsService()
|
|
182
|
+
.requestSideEffectsForNavigationProperty(oListBinding.getPath(), oBindingContext as Context);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// deleting at least one object should also set the UI to dirty
|
|
187
|
+
EditState.setEditStateDirty();
|
|
188
|
+
|
|
189
|
+
send(this.getView(), Activity.Delete, aContexts);
|
|
190
|
+
|
|
191
|
+
// Finally, check if the current state can be impacted by the deletion, i.e. if there's
|
|
192
|
+
// an OP displaying a deleted object. If yes navigate back to dismiss the OP
|
|
193
|
+
for (let index = 0; index < aContexts.length; index++) {
|
|
194
|
+
if (oRoutingListener.isCurrentStateImpactedBy(aContexts[index])) {
|
|
195
|
+
oRoutingListener.navigateBackFromContext(aContexts[index]);
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return oResult;
|
|
201
|
+
})
|
|
202
|
+
.catch(function(oError: any) {
|
|
203
|
+
Log.error("Error while deleting the document(s)", oError);
|
|
204
|
+
})
|
|
205
|
+
.finally(function() {
|
|
206
|
+
BusyLocker.unlock(oLockObject);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Decides if a document is to be shown in display or edit mode.
|
|
212
|
+
*
|
|
213
|
+
* @function
|
|
214
|
+
* @name _computeEditMode
|
|
215
|
+
* @memberof sap.fe.core.controllerextensions.InternalEditFlow
|
|
216
|
+
* @param {sap.ui.model.odata.v4.Context} oContext The context to be displayed or edited
|
|
217
|
+
* @returns {Promise} Promise resolves once the edit mode is computed
|
|
218
|
+
*/
|
|
219
|
+
|
|
220
|
+
@Public
|
|
221
|
+
@Final
|
|
222
|
+
computeEditMode(oContext: any) {
|
|
223
|
+
const sCustomAction = this.getInternalModel().getProperty("/sCustomAction");
|
|
224
|
+
return Promise.resolve(
|
|
225
|
+
(() => {
|
|
226
|
+
const sProgrammingModel = this.getProgrammingModel(oContext);
|
|
227
|
+
|
|
228
|
+
if (sProgrammingModel === ProgrammingModel.Draft) {
|
|
229
|
+
this.setDraftStatus(DraftStatus.Clear);
|
|
230
|
+
|
|
231
|
+
return oContext
|
|
232
|
+
.requestObject("IsActiveEntity")
|
|
233
|
+
.then((bIsActiveEntity: any) => {
|
|
234
|
+
if (bIsActiveEntity === false) {
|
|
235
|
+
// in case the document is draft set it in edit mode
|
|
236
|
+
this.setEditMode(EditMode.Editable);
|
|
237
|
+
return oContext.requestObject("HasActiveEntity").then((bHasActiveEntity: any) => {
|
|
238
|
+
this.setEditMode(undefined, !bHasActiveEntity);
|
|
239
|
+
});
|
|
240
|
+
} else {
|
|
241
|
+
// active document, stay on display mode
|
|
242
|
+
this.setEditMode(EditMode.Display, false);
|
|
243
|
+
}
|
|
244
|
+
})
|
|
245
|
+
.catch(function(oError: any) {
|
|
246
|
+
Log.error("Error while determining the editMode for draft", oError);
|
|
247
|
+
throw oError;
|
|
248
|
+
});
|
|
249
|
+
} else if (sProgrammingModel === ProgrammingModel.Sticky) {
|
|
250
|
+
if (sCustomAction && sCustomAction !== "" && this._hasNewActionForSticky(oContext, this.getView(), sCustomAction)) {
|
|
251
|
+
this.getTransactionHelper()._bCreateMode = true;
|
|
252
|
+
this.getTransactionHelper().handleDocumentModifications();
|
|
253
|
+
this.setEditMode(EditMode.Editable, true);
|
|
254
|
+
EditState.setEditStateDirty();
|
|
255
|
+
this.handleStickyOn(oContext);
|
|
256
|
+
this.getInternalModel().setProperty("/sCustomAction", "");
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
})()
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Sets the edit mode.
|
|
265
|
+
*
|
|
266
|
+
* @param {string} sEditMode
|
|
267
|
+
* @param {boolean} bCreationMode CreateMode flag to identify the creation mode
|
|
268
|
+
*/
|
|
269
|
+
@Public
|
|
270
|
+
@Final
|
|
271
|
+
setEditMode(sEditMode?: string, bCreationMode: boolean = false) {
|
|
272
|
+
// at this point of time it's not meant to release the edit flow for freestyle usage therefore we can
|
|
273
|
+
// rely on the global UI model to exist
|
|
274
|
+
const oGlobalModel = this.getGlobalUIModel();
|
|
275
|
+
|
|
276
|
+
if (sEditMode) {
|
|
277
|
+
oGlobalModel.setProperty("/editMode", sEditMode, undefined, true);
|
|
278
|
+
oGlobalModel.setProperty("/isEditable", sEditMode === "Editable", undefined, true);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (bCreationMode !== undefined) {
|
|
282
|
+
// Since setCreationMode is public in EditFlow and can be overriden, make sure to call it via the controller
|
|
283
|
+
// to ensure any overrides are taken into account
|
|
284
|
+
this.setCreationMode(bCreationMode);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
@Public
|
|
289
|
+
@Final
|
|
290
|
+
setDraftStatus(sDraftState: any) {
|
|
291
|
+
// at this point of time it's not meant to release the edit flow for freestyle usage therefore we can
|
|
292
|
+
// rely on the global UI model to exist
|
|
293
|
+
(this.base.getView().getModel("ui") as JSONModel).setProperty("/draftStatus", sDraftState, undefined, true);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
@Public
|
|
297
|
+
@Final
|
|
298
|
+
getRoutingListener() {
|
|
299
|
+
// at this point of time it's not meant to release the edit flow for FPM custom pages and the routing
|
|
300
|
+
// listener is not yet public therefore keep the logic here for now
|
|
301
|
+
|
|
302
|
+
if (this.base._routing) {
|
|
303
|
+
return this.base._routing;
|
|
304
|
+
} else {
|
|
305
|
+
throw new Error("Edit Flow works only with a given routing listener");
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
@Public
|
|
310
|
+
@Final
|
|
311
|
+
getGlobalUIModel(): JSONModel {
|
|
312
|
+
// at this point of time it's not meant to release the edit flow for freestyle usage therefore we can
|
|
313
|
+
// rely on the global UI model to exist
|
|
314
|
+
return this.base.getView().getModel("ui") as JSONModel;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Performs a task in sync with other tasks created via this function.
|
|
319
|
+
* Returns the promise chain of the task.
|
|
320
|
+
*
|
|
321
|
+
* @function
|
|
322
|
+
* @name sap.fe.core.controllerextensions.EditFlow#syncTask
|
|
323
|
+
* @memberof sap.fe.core.controllerextensions.EditFlow
|
|
324
|
+
* @static
|
|
325
|
+
* @param {Promise|Function} [vTask] Optional, a promise or function to be executed synchronously
|
|
326
|
+
* @returns {Promise} Promise resolves once the task is completed
|
|
327
|
+
*
|
|
328
|
+
* @ui5-restricted
|
|
329
|
+
* @final
|
|
330
|
+
*/
|
|
331
|
+
@Public
|
|
332
|
+
@Final
|
|
333
|
+
syncTask(vTask?: Function | Promise<any>) {
|
|
334
|
+
let fnNewTask;
|
|
335
|
+
if (vTask instanceof Promise) {
|
|
336
|
+
fnNewTask = function() {
|
|
337
|
+
return vTask;
|
|
338
|
+
};
|
|
339
|
+
} else if (typeof vTask === "function") {
|
|
340
|
+
fnNewTask = vTask;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
this._pTasks = this._pTasks || Promise.resolve();
|
|
344
|
+
if (!!fnNewTask) {
|
|
345
|
+
this._pTasks = this._pTasks.then(fnNewTask).catch(function() {
|
|
346
|
+
return Promise.resolve();
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
return this._pTasks;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
@Public
|
|
354
|
+
@Final
|
|
355
|
+
getProgrammingModel(oContext: any): typeof ProgrammingModel {
|
|
356
|
+
return this.getTransactionHelper().getProgrammingModel(oContext);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
@Public
|
|
360
|
+
@Final
|
|
361
|
+
deleteDocumentTransaction(oContext: any, mParameters: any) {
|
|
362
|
+
const oResourceBundle = (this.getView().getController() as any).oResourceBundle,
|
|
363
|
+
transactionHelper = this.getTransactionHelper();
|
|
364
|
+
|
|
365
|
+
mParameters = mParameters || {};
|
|
366
|
+
|
|
367
|
+
// TODO: this setting and removing of contexts shouldn't be in the transaction helper at all
|
|
368
|
+
// for the time being I kept it and provide the internal model context to not break something
|
|
369
|
+
mParameters.internalModelContext = mParameters.controlId
|
|
370
|
+
? sap.ui
|
|
371
|
+
.getCore()
|
|
372
|
+
.byId(mParameters.controlId)
|
|
373
|
+
?.getBindingContext("internal")
|
|
374
|
+
: null;
|
|
375
|
+
|
|
376
|
+
return this.syncTask()
|
|
377
|
+
.then(
|
|
378
|
+
transactionHelper.deleteDocument.bind(transactionHelper, oContext, mParameters, oResourceBundle, this.getMessageHandler())
|
|
379
|
+
)
|
|
380
|
+
.then(() => {
|
|
381
|
+
this.getInternalModel().setProperty("/sessionOn", false);
|
|
382
|
+
})
|
|
383
|
+
.catch(function(oError: any) {
|
|
384
|
+
return Promise.reject(oError);
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Handles the create event: shows messages and in case of a draft, updates the draft indicator.
|
|
390
|
+
*
|
|
391
|
+
* @memberof sap.fe.core.controllerextensions.EditFlow
|
|
392
|
+
* @param {object} oBinding OData list binding object
|
|
393
|
+
*/
|
|
394
|
+
@Public
|
|
395
|
+
@Final
|
|
396
|
+
handleCreateEvents(oBinding: any) {
|
|
397
|
+
const transactionHelper = this.getTransactionHelper();
|
|
398
|
+
|
|
399
|
+
this.setDraftStatus(DraftStatus.Clear);
|
|
400
|
+
|
|
401
|
+
oBinding = (oBinding.getBinding && oBinding.getBinding()) || oBinding;
|
|
402
|
+
const sProgrammingModel = this.getProgrammingModel(oBinding);
|
|
403
|
+
|
|
404
|
+
oBinding.attachEvent("createSent", () => {
|
|
405
|
+
transactionHelper.handleDocumentModifications();
|
|
406
|
+
if (sProgrammingModel === ProgrammingModel.Draft) {
|
|
407
|
+
this.setDraftStatus(DraftStatus.Saving);
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
oBinding.attachEvent("createCompleted", (oEvent: any) => {
|
|
411
|
+
const bSuccess = oEvent.getParameter("success");
|
|
412
|
+
if (sProgrammingModel === ProgrammingModel.Draft) {
|
|
413
|
+
this.setDraftStatus(bSuccess ? DraftStatus.Saved : DraftStatus.Clear);
|
|
414
|
+
}
|
|
415
|
+
this.getMessageHandler().showMessageDialog();
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
@Public
|
|
420
|
+
@Final
|
|
421
|
+
getTransactionHelper() {
|
|
422
|
+
if (!this._oTransactionHelper) {
|
|
423
|
+
// currently also the transaction helper is locking therefore passing lock object
|
|
424
|
+
this._oTransactionHelper = new TransactionHelper(this._oAppComponent, this.getGlobalUIModel());
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
return this._oTransactionHelper;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
@Public
|
|
431
|
+
@Final
|
|
432
|
+
getInternalModel(): JSONModel {
|
|
433
|
+
return this.base.getView().getModel("internal") as JSONModel;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Creates a new promise to wait for an action to be executed
|
|
438
|
+
* @function
|
|
439
|
+
* @name _createActionPromise
|
|
440
|
+
* @memberof sap.fe.core.controllerextensions.EditFlow
|
|
441
|
+
*
|
|
442
|
+
* @returns {Function} The resolver function which can be used to externally resolve the promise
|
|
443
|
+
*/
|
|
444
|
+
|
|
445
|
+
@Public
|
|
446
|
+
@Final
|
|
447
|
+
createActionPromise(sActionName: any, sControlId: any) {
|
|
448
|
+
let fResolver, fRejector;
|
|
449
|
+
this.oActionPromise = new Promise((resolve, reject) => {
|
|
450
|
+
fResolver = resolve;
|
|
451
|
+
fRejector = reject;
|
|
452
|
+
}).then((oResponse: any) => {
|
|
453
|
+
return Object.assign({ controlId: sControlId }, this.getActionResponseDataAndKeys(sActionName, oResponse));
|
|
454
|
+
});
|
|
455
|
+
return { fResolver: fResolver, fRejector: fRejector };
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Gets the getCurrentActionPromise object.
|
|
460
|
+
*
|
|
461
|
+
* @function
|
|
462
|
+
* @name _getCurrentActionPromise
|
|
463
|
+
* @memberof sap.fe.core.controllerextensions.EditFlow
|
|
464
|
+
*
|
|
465
|
+
* @returns {Promise} Returns the promise
|
|
466
|
+
*/
|
|
467
|
+
@Public
|
|
468
|
+
@Final
|
|
469
|
+
getCurrentActionPromise() {
|
|
470
|
+
return this.oActionPromise;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
@Public
|
|
474
|
+
@Final
|
|
475
|
+
deleteCurrentActionPromise() {
|
|
476
|
+
this.oActionPromise = undefined;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* @function
|
|
481
|
+
* @name getActionResponseDataAndKeys
|
|
482
|
+
* @memberof sap.fe.core.controllerextensions.EditFlow
|
|
483
|
+
* @param {string} sActionName The name of the action that is executed
|
|
484
|
+
* @param {object} oResponse The bound action's response data or response context
|
|
485
|
+
* @returns {object} Object with data and names of the key fields of the response
|
|
486
|
+
*/
|
|
487
|
+
@Public
|
|
488
|
+
@Final
|
|
489
|
+
getActionResponseDataAndKeys(sActionName: string, oResponse: any) {
|
|
490
|
+
if (Array.isArray(oResponse)) {
|
|
491
|
+
if (oResponse.length === 1) {
|
|
492
|
+
oResponse = oResponse[0];
|
|
493
|
+
} else {
|
|
494
|
+
return null;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
if (!oResponse) {
|
|
498
|
+
return null;
|
|
499
|
+
}
|
|
500
|
+
const oView = this.getView(),
|
|
501
|
+
oMetaModel = (oView.getModel().getMetaModel() as any).getData(),
|
|
502
|
+
sActionReturnType =
|
|
503
|
+
oMetaModel && oMetaModel[sActionName] && oMetaModel[sActionName][0] && oMetaModel[sActionName][0].$ReturnType
|
|
504
|
+
? oMetaModel[sActionName][0].$ReturnType.$Type
|
|
505
|
+
: null,
|
|
506
|
+
aKey = sActionReturnType && oMetaModel[sActionReturnType] ? oMetaModel[sActionReturnType].$Key : null;
|
|
507
|
+
|
|
508
|
+
return {
|
|
509
|
+
oData: oResponse.getObject(),
|
|
510
|
+
keys: aKey
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
@Public
|
|
515
|
+
@Final
|
|
516
|
+
getMessageHandler() {
|
|
517
|
+
// at this point of time it's not meant to release the edit flow for FPM custom pages therefore keep
|
|
518
|
+
// the logic here for now
|
|
519
|
+
|
|
520
|
+
if (this.base.messageHandler) {
|
|
521
|
+
return this.base.messageHandler;
|
|
522
|
+
} else {
|
|
523
|
+
throw new Error("Edit Flow works only with a given message handler");
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
@Public
|
|
528
|
+
@Final
|
|
529
|
+
handleStickyOn(oContext: any) {
|
|
530
|
+
const oAppComponent = CommonUtils.getAppComponent(this.getView());
|
|
531
|
+
|
|
532
|
+
try {
|
|
533
|
+
if (oAppComponent === undefined || oContext === undefined) {
|
|
534
|
+
throw new Error("undefined AppComponent or Context for function handleStickyOn");
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
if (!oAppComponent.getRouterProxy().hasNavigationGuard()) {
|
|
538
|
+
const sHashTracker = oAppComponent.getRouterProxy().getHash(),
|
|
539
|
+
oInternalModel = this.getInternalModel();
|
|
540
|
+
|
|
541
|
+
// Set a guard in the RouterProxy
|
|
542
|
+
// A timeout is necessary, as with deferred creation the hashChanger is not updated yet with
|
|
543
|
+
// the new hash, and the guard cannot be found in the managed history of the router proxy
|
|
544
|
+
setTimeout(function() {
|
|
545
|
+
oAppComponent.getRouterProxy().setNavigationGuard();
|
|
546
|
+
}, 0);
|
|
547
|
+
|
|
548
|
+
// Setting back navigation on shell service, to get the dicard message box in case of sticky
|
|
549
|
+
oAppComponent.getShellServices().setBackNavigation(this.onBackNavigationInSession.bind(this));
|
|
550
|
+
|
|
551
|
+
this.fnDirtyStateProvider = this._registerDirtyStateProvider(oAppComponent, oInternalModel, sHashTracker);
|
|
552
|
+
oAppComponent.getShellServices().registerDirtyStateProvider(this.fnDirtyStateProvider);
|
|
553
|
+
|
|
554
|
+
// handle session timeout
|
|
555
|
+
const i18nModel = this.getView().getModel("sap.fe.i18n");
|
|
556
|
+
this.fnHandleSessionTimeout = this._attachSessionTimeout(this, i18nModel);
|
|
557
|
+
(this.getView().getModel() as any).attachSessionTimeout(this.fnHandleSessionTimeout);
|
|
558
|
+
|
|
559
|
+
this.fnStickyDiscardAfterNavigation = this._attachRouteMatched(this, oContext, oAppComponent);
|
|
560
|
+
oAppComponent.getRoutingService().attachRouteMatched(this.fnStickyDiscardAfterNavigation);
|
|
561
|
+
}
|
|
562
|
+
} catch (error) {
|
|
563
|
+
Log.info(error);
|
|
564
|
+
return undefined;
|
|
565
|
+
}
|
|
566
|
+
return true;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
@Public
|
|
570
|
+
@Final
|
|
571
|
+
handleStickyOff() {
|
|
572
|
+
const oAppComponent = CommonUtils.getAppComponent(this.getView());
|
|
573
|
+
try {
|
|
574
|
+
if (oAppComponent === undefined) {
|
|
575
|
+
throw new Error("undefined AppComponent for function handleStickyOff");
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
if (oAppComponent && oAppComponent.getRouterProxy) {
|
|
579
|
+
// If we have exited from the app, CommonUtils.getAppComponent doesn't return a
|
|
580
|
+
// sap.fe.core.AppComponent, hence the 'if' above
|
|
581
|
+
oAppComponent.getRouterProxy().discardNavigationGuard();
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
if (this.fnDirtyStateProvider) {
|
|
585
|
+
oAppComponent.getShellServices().deregisterDirtyStateProvider(this.fnDirtyStateProvider);
|
|
586
|
+
this.fnDirtyStateProvider = undefined;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
if (this.getView().getModel() && this.fnHandleSessionTimeout) {
|
|
590
|
+
(this.getView().getModel() as any).detachSessionTimeout(this.fnHandleSessionTimeout);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
oAppComponent.getRoutingService().detachRouteMatched(this.fnStickyDiscardAfterNavigation);
|
|
594
|
+
this.fnStickyDiscardAfterNavigation = undefined;
|
|
595
|
+
|
|
596
|
+
this.getTransactionHelper()._bCreateMode = false;
|
|
597
|
+
this.setEditMode(EditMode.Display, false);
|
|
598
|
+
|
|
599
|
+
if (oAppComponent) {
|
|
600
|
+
// If we have exited from the app, CommonUtils.getAppComponent doesn't return a
|
|
601
|
+
// sap.fe.core.AppComponent, hence the 'if' above
|
|
602
|
+
oAppComponent.getShellServices().setBackNavigation();
|
|
603
|
+
}
|
|
604
|
+
} catch (error) {
|
|
605
|
+
Log.info(error);
|
|
606
|
+
return undefined;
|
|
607
|
+
}
|
|
608
|
+
return true;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* @description Method to display a 'discard' popover when exiting a sticky session.
|
|
613
|
+
*
|
|
614
|
+
* @function
|
|
615
|
+
* @name onBackNavigationInSession
|
|
616
|
+
* @memberof sap.fe.core.controllerextensions.InternalEditFlow
|
|
617
|
+
*/
|
|
618
|
+
@Public
|
|
619
|
+
@Final
|
|
620
|
+
onBackNavigationInSession() {
|
|
621
|
+
const oView = this.getView(),
|
|
622
|
+
oAppComponent = CommonUtils.getAppComponent(oView),
|
|
623
|
+
oRouterProxy = oAppComponent.getRouterProxy();
|
|
624
|
+
|
|
625
|
+
if (oRouterProxy.checkIfBackIsOutOfGuard()) {
|
|
626
|
+
const oBindingContext = oView && oView.getBindingContext();
|
|
627
|
+
|
|
628
|
+
CommonUtils.processDataLossConfirmation(
|
|
629
|
+
() => {
|
|
630
|
+
this.discardStickySession(oBindingContext);
|
|
631
|
+
history.back();
|
|
632
|
+
},
|
|
633
|
+
oView,
|
|
634
|
+
this.getProgrammingModel(oBindingContext)
|
|
635
|
+
);
|
|
636
|
+
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
639
|
+
history.back();
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
@Public
|
|
643
|
+
@Final
|
|
644
|
+
discardStickySession(oContext: any) {
|
|
645
|
+
sticky.discardDocument(oContext);
|
|
646
|
+
this.handleStickyOff();
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
_hasNewActionForSticky(oContext: any, oView: View, sCustomAction: string) {
|
|
650
|
+
try {
|
|
651
|
+
if (oContext === undefined || oView === undefined) {
|
|
652
|
+
throw new Error("Invalid input parameters for function _hasNewActionForSticky");
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
const oMetaModel = oView.getModel().getMetaModel(),
|
|
656
|
+
sMetaPath = oContext.getPath().substring(0, oContext.getPath().indexOf("(")),
|
|
657
|
+
oStickySession = oMetaModel.getObject(sMetaPath + "@com.sap.vocabularies.Session.v1.StickySessionSupported");
|
|
658
|
+
|
|
659
|
+
if (oStickySession && oStickySession.NewAction && oStickySession.NewAction === sCustomAction) {
|
|
660
|
+
return true;
|
|
661
|
+
} else if (oStickySession && oStickySession.AdditionalNewActions) {
|
|
662
|
+
return sCustomAction ===
|
|
663
|
+
oStickySession.AdditionalNewActions.find(function(sAdditionalAction: string) {
|
|
664
|
+
return sAdditionalAction === sCustomAction;
|
|
665
|
+
})
|
|
666
|
+
? true
|
|
667
|
+
: false;
|
|
668
|
+
} else {
|
|
669
|
+
return false;
|
|
670
|
+
}
|
|
671
|
+
} catch (error) {
|
|
672
|
+
Log.info(error);
|
|
673
|
+
return undefined;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
_registerDirtyStateProvider(oAppComponent: AppComponent, oInternalModel: JSONModel, sHashTracker: string) {
|
|
678
|
+
return function fnDirtyStateProvider(oNavigationContext: any) {
|
|
679
|
+
try {
|
|
680
|
+
if (oNavigationContext === undefined) {
|
|
681
|
+
throw new Error("Invalid input parameters for function fnDirtyStateProvider");
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
const sTargetHash = oNavigationContext.innerAppRoute,
|
|
685
|
+
oRouterProxy = oAppComponent.getRouterProxy();
|
|
686
|
+
let sLclHashTracker = "";
|
|
687
|
+
let bDirty: boolean;
|
|
688
|
+
const bSessionON = oInternalModel.getProperty("/sessionOn");
|
|
689
|
+
|
|
690
|
+
if (!bSessionON) {
|
|
691
|
+
// If the sticky session was terminated before hand.
|
|
692
|
+
// Eexample in case of navigating away from application using IBN.
|
|
693
|
+
return undefined;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
if (!oRouterProxy.isNavigationFinalized()) {
|
|
697
|
+
// If navigation is currently happening in RouterProxy, it's a transient state
|
|
698
|
+
// (not dirty)
|
|
699
|
+
bDirty = false;
|
|
700
|
+
sLclHashTracker = sTargetHash;
|
|
701
|
+
} else if (sHashTracker === sTargetHash) {
|
|
702
|
+
// the hash didn't change so either the user attempts to refresh or to leave the app
|
|
703
|
+
bDirty = true;
|
|
704
|
+
} else if (oRouterProxy.checkHashWithGuard(sTargetHash) || oRouterProxy.isGuardCrossAllowedByUser()) {
|
|
705
|
+
// the user attempts to navigate within the root object
|
|
706
|
+
// or crossing the guard has already been allowed by the RouterProxy
|
|
707
|
+
sLclHashTracker = sTargetHash;
|
|
708
|
+
bDirty = false;
|
|
709
|
+
} else {
|
|
710
|
+
// the user attempts to navigate within the app, for example back to the list report
|
|
711
|
+
bDirty = true;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
if (bDirty) {
|
|
715
|
+
// the FLP doesn't call the dirty state provider anymore once it's dirty, as they can't
|
|
716
|
+
// change this due to compatibility reasons we set it back to not-dirty
|
|
717
|
+
setTimeout(function() {
|
|
718
|
+
oAppComponent.getShellServices().setDirtyFlag(false);
|
|
719
|
+
}, 0);
|
|
720
|
+
} else {
|
|
721
|
+
sHashTracker = sLclHashTracker;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
return bDirty;
|
|
725
|
+
} catch (error) {
|
|
726
|
+
Log.info(error);
|
|
727
|
+
return undefined;
|
|
728
|
+
}
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
_attachSessionTimeout(oContext: any, i18nModel: Model) {
|
|
733
|
+
const that = oContext;
|
|
734
|
+
|
|
735
|
+
return function fnHandleSessionTimeout() {
|
|
736
|
+
try {
|
|
737
|
+
if (oContext === undefined) {
|
|
738
|
+
throw new Error("Context missing for function fnHandleSessionTimeout");
|
|
739
|
+
}
|
|
740
|
+
// remove transient messages since we will showing our own message
|
|
741
|
+
that.getMessageHandler().removeTransitionMessages();
|
|
742
|
+
|
|
743
|
+
const oDialog = new Dialog({
|
|
744
|
+
title: "{sap.fe.i18n>C_EDITFLOW_OBJECT_PAGE_SESSION_EXPIRED_DIALOG_TITLE}",
|
|
745
|
+
state: "Warning",
|
|
746
|
+
content: new Text({ text: "{sap.fe.i18n>C_EDITFLOW_OBJECT_PAGE_SESSION_EXPIRED_DIALOG_MESSAGE}" }),
|
|
747
|
+
beginButton: new Button({
|
|
748
|
+
text: "{sap.fe.i18n>C_COMMON_DIALOG_OK}",
|
|
749
|
+
type: "Emphasized",
|
|
750
|
+
press: function() {
|
|
751
|
+
// remove sticky handling after navigation since session has already been terminated
|
|
752
|
+
that.handleStickyOff();
|
|
753
|
+
that.getRoutingListener().navigateBackFromContext(oContext);
|
|
754
|
+
}
|
|
755
|
+
}),
|
|
756
|
+
afterClose: function() {
|
|
757
|
+
oDialog.destroy();
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
oDialog.addStyleClass("sapUiContentPadding");
|
|
761
|
+
oDialog.setModel(i18nModel, "sap.fe.i18n");
|
|
762
|
+
that.getView().addDependent(oDialog);
|
|
763
|
+
oDialog.open();
|
|
764
|
+
} catch (error) {
|
|
765
|
+
Log.info(error);
|
|
766
|
+
return undefined;
|
|
767
|
+
}
|
|
768
|
+
return true;
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
_attachRouteMatched(oFnContext: any, oContext: any, oAppComponent: AppComponent) {
|
|
773
|
+
return function fnStickyDiscardAfterNavigation() {
|
|
774
|
+
const sCurrentHash = oAppComponent.getRouterProxy().getHash();
|
|
775
|
+
// either current hash is empty so the user left the app or he navigated away from the object
|
|
776
|
+
if (!sCurrentHash || !oAppComponent.getRouterProxy().checkHashWithGuard(sCurrentHash)) {
|
|
777
|
+
oFnContext.discardStickySession(oContext);
|
|
778
|
+
}
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
export default InternalEditFlow;
|