@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,805 @@
|
|
|
1
|
+
import ControllerExtension from "sap/ui/core/mvc/ControllerExtension";
|
|
2
|
+
import OverrideExecution from "sap/ui/core/mvc/OverrideExecution";
|
|
3
|
+
import Log from "sap/base/Log";
|
|
4
|
+
import mergeObjects from "sap/base/util/merge";
|
|
5
|
+
import ControlVariantApplyAPI from "sap/ui/fl/apply/api/ControlVariantApplyAPI";
|
|
6
|
+
import StateUtil from "sap/ui/mdc/p13n/StateUtil";
|
|
7
|
+
import NavLibrary from "sap/fe/navigation/library";
|
|
8
|
+
import CommonUtils from "sap/fe/core/CommonUtils";
|
|
9
|
+
import KeepAliveHelper from "sap/fe/core/helpers/KeepAliveHelper";
|
|
10
|
+
import ModelHelper from "sap/fe/core/helpers/ModelHelper";
|
|
11
|
+
import { Extensible, Final, Private, Public, UI5Class } from "sap/fe/core/helpers/ClassSupport";
|
|
12
|
+
import ControllerExtensionMetadata from "sap/fe/core/controllerextensions/ControllerExtensionMetadata";
|
|
13
|
+
import PageController from "sap/fe/core/PageController";
|
|
14
|
+
import ManagedObject from "sap/ui/base/ManagedObject";
|
|
15
|
+
// additionalStates are stored next to control IDs, so name clash avoidance needed. Fortunately IDs have restrictions:
|
|
16
|
+
// "Allowed is a sequence of characters (capital/lowercase), digits, underscores, dashes, points and/or colons."
|
|
17
|
+
// Therefore adding a symbol like # or @
|
|
18
|
+
const ADDITIONAL_STATES_KEY = "#additionalStates",
|
|
19
|
+
NavType = NavLibrary.NavType;
|
|
20
|
+
///////////////////////////////////////////////////////////////////
|
|
21
|
+
// methods to retrieve & apply states for the different controls //
|
|
22
|
+
///////////////////////////////////////////////////////////////////
|
|
23
|
+
const _mControlStateHandlerMap: Record<string, any> = {
|
|
24
|
+
"sap.ui.fl.variants.VariantManagement": {
|
|
25
|
+
retrieve: function(oVM: any) {
|
|
26
|
+
return {
|
|
27
|
+
"variantId": oVM.getCurrentVariantKey()
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
apply: function(oVM: any, oControlState: any) {
|
|
31
|
+
if (oControlState && oControlState.variantId !== undefined && oControlState.variantId !== oVM.getCurrentVariantKey()) {
|
|
32
|
+
const sVariantReference = this._checkIfVariantIdIsAvailable(oVM, oControlState.variantId)
|
|
33
|
+
? oControlState.variantId
|
|
34
|
+
: oVM.getStandardVariantKey();
|
|
35
|
+
return ControlVariantApplyAPI.activateVariant({
|
|
36
|
+
element: oVM,
|
|
37
|
+
variantReference: sVariantReference
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"sap.m.IconTabBar": {
|
|
43
|
+
retrieve: function(oTabBar: any) {
|
|
44
|
+
return {
|
|
45
|
+
selectedKey: oTabBar.getSelectedKey()
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
apply: function(oTabBar: any, oControlState: any) {
|
|
49
|
+
if (oControlState && oControlState.selectedKey) {
|
|
50
|
+
const oSelectedItem = oTabBar.getItems().find(function(oItem: any) {
|
|
51
|
+
return oItem.getKey() === oControlState.selectedKey;
|
|
52
|
+
});
|
|
53
|
+
if (oSelectedItem) {
|
|
54
|
+
oTabBar.setSelectedItem(oSelectedItem);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"sap.ui.mdc.FilterBar": {
|
|
60
|
+
retrieve: function(oFilterBar: any) {
|
|
61
|
+
return StateUtil.retrieveExternalState(oFilterBar).then(function(mFilterBarState: any) {
|
|
62
|
+
// remove sensitive or view state irrelevant fields
|
|
63
|
+
const aPropertiesInfo = oFilterBar.getPropertyInfoSet(),
|
|
64
|
+
mFilter = mFilterBarState.filter || {};
|
|
65
|
+
aPropertiesInfo
|
|
66
|
+
.filter(function(oPropertyInfo: any) {
|
|
67
|
+
return (
|
|
68
|
+
mFilter[oPropertyInfo.path] && (oPropertyInfo.removeFromAppState || mFilter[oPropertyInfo.path].length === 0)
|
|
69
|
+
);
|
|
70
|
+
})
|
|
71
|
+
.forEach(function(oPropertyInfo: any) {
|
|
72
|
+
delete mFilter[oPropertyInfo.path];
|
|
73
|
+
});
|
|
74
|
+
return mFilterBarState;
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
apply: function(oFilterBar: any, oControlState: any) {
|
|
78
|
+
if (oControlState) {
|
|
79
|
+
return StateUtil.applyExternalState(oFilterBar, oControlState);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"sap.ui.mdc.Table": {
|
|
84
|
+
retrieve: function(oTable: any) {
|
|
85
|
+
return StateUtil.retrieveExternalState(oTable);
|
|
86
|
+
},
|
|
87
|
+
apply: function(oTable: any, oControlState: any) {
|
|
88
|
+
if (oControlState) {
|
|
89
|
+
return StateUtil.applyExternalState(oTable, oControlState);
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
refreshBinding: function(oTable: any) {
|
|
93
|
+
const oTableBinding = oTable.getRowBinding();
|
|
94
|
+
if (oTableBinding) {
|
|
95
|
+
const oRootBinding = oTableBinding.getRootBinding();
|
|
96
|
+
if (oRootBinding === oTableBinding) {
|
|
97
|
+
// absolute binding
|
|
98
|
+
oTableBinding.refresh();
|
|
99
|
+
} else {
|
|
100
|
+
// relative binding
|
|
101
|
+
const oHeaderContext = oTableBinding.getHeaderContext();
|
|
102
|
+
const sGroupId = oTableBinding.getGroupId();
|
|
103
|
+
|
|
104
|
+
if (oHeaderContext) {
|
|
105
|
+
oHeaderContext.requestSideEffects([{ $NavigationPropertyPath: "" }], sGroupId);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
Log.info("Table: " + oTable.getId() + " was not refreshed. No binding found!");
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"sap.uxap.ObjectPageLayout": {
|
|
114
|
+
retrieve: function(oOPLayout: any) {
|
|
115
|
+
return {
|
|
116
|
+
selectedSection: oOPLayout.getSelectedSection()
|
|
117
|
+
};
|
|
118
|
+
},
|
|
119
|
+
apply: function(oOPLayout: any, oControlState: any) {
|
|
120
|
+
oControlState && oOPLayout.setSelectedSection(oControlState.selectedSection);
|
|
121
|
+
},
|
|
122
|
+
refreshBinding: function(oOPLayout: any) {
|
|
123
|
+
const oBindingContext = oOPLayout.getBindingContext();
|
|
124
|
+
const oBinding = oBindingContext && oBindingContext.getBinding();
|
|
125
|
+
if (oBinding) {
|
|
126
|
+
const sMetaPath = ModelHelper.getMetaPathForContext(oBindingContext);
|
|
127
|
+
const sStrategy = KeepAliveHelper.getControlRefreshStrategyForContextPath(oOPLayout, sMetaPath);
|
|
128
|
+
if (sStrategy === "self") {
|
|
129
|
+
// Refresh main context and 1-1 navigation properties or OP
|
|
130
|
+
const oModel = oBindingContext.getModel(),
|
|
131
|
+
oMetaModel = oModel.getMetaModel(),
|
|
132
|
+
oNavigationProperties =
|
|
133
|
+
CommonUtils.getContextPathProperties(oMetaModel, sMetaPath, {
|
|
134
|
+
$kind: "NavigationProperty"
|
|
135
|
+
}) || {},
|
|
136
|
+
aNavPropertiesToRequest = Object.keys(oNavigationProperties).reduce(function(aPrev: any[], sNavProp: string) {
|
|
137
|
+
if (oNavigationProperties[sNavProp].$isCollection !== true) {
|
|
138
|
+
aPrev.push({ $NavigationPropertyPath: sNavProp });
|
|
139
|
+
}
|
|
140
|
+
return aPrev;
|
|
141
|
+
}, []),
|
|
142
|
+
aProperties = [{ $PropertyPath: "*" }],
|
|
143
|
+
sGroupId = oBinding.getGroupId();
|
|
144
|
+
|
|
145
|
+
oBindingContext.requestSideEffects(aProperties.concat(aNavPropertiesToRequest), sGroupId);
|
|
146
|
+
} else if (sStrategy === "includingDependents") {
|
|
147
|
+
// Complete refresh
|
|
148
|
+
oBinding.refresh();
|
|
149
|
+
}
|
|
150
|
+
} else {
|
|
151
|
+
Log.info("ObjectPage: " + oOPLayout.getId() + " was not refreshed. No binding found!");
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"sap.fe.macros.table.QuickFilterContainer": {
|
|
156
|
+
retrieve: function(oQuickFilter: any) {
|
|
157
|
+
return {
|
|
158
|
+
selectedKey: oQuickFilter.getSelectorKey()
|
|
159
|
+
};
|
|
160
|
+
},
|
|
161
|
+
apply: function(oQuickFilter: any, oControlState: any) {
|
|
162
|
+
oControlState && oQuickFilter.setSelectorKey(oControlState.selectedKey);
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
"sap.m.SegmentedButton": {
|
|
166
|
+
retrieve: function(oSegmentedButton: any) {
|
|
167
|
+
return {
|
|
168
|
+
selectedKey: oSegmentedButton.getSelectedKey()
|
|
169
|
+
};
|
|
170
|
+
},
|
|
171
|
+
apply: function(oSegmentedButton: any, oControlState: any) {
|
|
172
|
+
oControlState && oSegmentedButton.setSelectedKey(oControlState.selectedKey);
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
"sap.m.Select": {
|
|
176
|
+
retrieve: function(oSelect: any) {
|
|
177
|
+
return {
|
|
178
|
+
selectedKey: oSelect.getSelectedKey()
|
|
179
|
+
};
|
|
180
|
+
},
|
|
181
|
+
apply: function(oSelect: any, oControlState: any) {
|
|
182
|
+
oControlState && oSelect.setSelectedKey(oControlState.selectedKey);
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
"sap.f.DynamicPage": {
|
|
186
|
+
retrieve: function(oDynamicPage: any) {
|
|
187
|
+
return {
|
|
188
|
+
headerExpanded: oDynamicPage.getHeaderExpanded()
|
|
189
|
+
};
|
|
190
|
+
},
|
|
191
|
+
apply: function(oDynamicPage: any, oControlState: any) {
|
|
192
|
+
oControlState && oDynamicPage.setHeaderExpanded(oControlState.headerExpanded);
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"sap.ui.core.mvc.View": {
|
|
196
|
+
retrieve: function(oView: any) {
|
|
197
|
+
const oController = oView.getController();
|
|
198
|
+
if (oController && oController.viewState) {
|
|
199
|
+
return oController.viewState.retrieveViewState(oController.viewState);
|
|
200
|
+
}
|
|
201
|
+
return {};
|
|
202
|
+
},
|
|
203
|
+
apply: function(oView: any, oControlState: any, oNavParameters: any) {
|
|
204
|
+
const oController = oView.getController();
|
|
205
|
+
if (oController && oController.viewState) {
|
|
206
|
+
return oController.viewState.applyViewState(oControlState, oNavParameters);
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
refreshBinding: function(oView: any) {
|
|
210
|
+
const oController = oView.getController();
|
|
211
|
+
if (oController && oController.viewState) {
|
|
212
|
+
return oController.viewState.refreshViewBindings();
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
"sap.ui.core.ComponentContainer": {
|
|
217
|
+
retrieve: function(oComponentContainer: any) {
|
|
218
|
+
const oComponent = oComponentContainer.getComponentInstance();
|
|
219
|
+
if (oComponent) {
|
|
220
|
+
return this.retrieveControlState(oComponent.getRootControl());
|
|
221
|
+
}
|
|
222
|
+
return {};
|
|
223
|
+
},
|
|
224
|
+
apply: function(oComponentContainer: any, oControlState: any, oNavParameters: any) {
|
|
225
|
+
const oComponent = oComponentContainer.getComponentInstance();
|
|
226
|
+
if (oComponent) {
|
|
227
|
+
return this.applyControlState(oComponent.getRootControl(), oControlState, oNavParameters);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* A controller extension offering hooks for state handling
|
|
234
|
+
*
|
|
235
|
+
* If you need to maintain a specific state for your application, you can use the controller extension.
|
|
236
|
+
*
|
|
237
|
+
* @hideconstructor
|
|
238
|
+
* @public
|
|
239
|
+
* @since 1.85.0
|
|
240
|
+
*/
|
|
241
|
+
@UI5Class("sap.fe.core.controllerextensions.ViewState", ControllerExtensionMetadata)
|
|
242
|
+
class ViewState extends ControllerExtension {
|
|
243
|
+
private _iRetrievingStateCounter: number;
|
|
244
|
+
private _pInitialStateApplied: Promise<unknown>;
|
|
245
|
+
private _pInitialStateAppliedResolve?: Function;
|
|
246
|
+
private base!: PageController;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Constructor.
|
|
250
|
+
*/
|
|
251
|
+
constructor() {
|
|
252
|
+
super();
|
|
253
|
+
this._iRetrievingStateCounter = 0;
|
|
254
|
+
this._pInitialStateApplied = new Promise(resolve => {
|
|
255
|
+
this._pInitialStateAppliedResolve = resolve;
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* @private
|
|
261
|
+
* @name sap.fe.core.controllerextensions.ViewState.getMetadata
|
|
262
|
+
* @function
|
|
263
|
+
*/
|
|
264
|
+
/**
|
|
265
|
+
* @private
|
|
266
|
+
* @name sap.fe.core.controllerextensions.ViewState.extend
|
|
267
|
+
* @function
|
|
268
|
+
*/
|
|
269
|
+
|
|
270
|
+
@Public
|
|
271
|
+
@Final
|
|
272
|
+
refreshViewBindings() {
|
|
273
|
+
return this.collectResults(this.base.viewState.adaptBindingRefreshControls).then((aControls: any) => {
|
|
274
|
+
let oPromiseChain = Promise.resolve();
|
|
275
|
+
aControls
|
|
276
|
+
.filter((oControl: any) => {
|
|
277
|
+
return oControl && oControl.isA && oControl.isA("sap.ui.base.ManagedObject");
|
|
278
|
+
})
|
|
279
|
+
.forEach((oControl: any) => {
|
|
280
|
+
oPromiseChain = oPromiseChain.then(this.refreshControlBinding.bind(this, oControl));
|
|
281
|
+
});
|
|
282
|
+
return oPromiseChain;
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* This function should add all controls relevant for refreshing to the provided control array.
|
|
287
|
+
*
|
|
288
|
+
* This function is meant to be individually overridden by consuming controllers, but not to be called directly.
|
|
289
|
+
* The override execution is: {@link sap.ui.core.mvc.OverrideExecution.After}.
|
|
290
|
+
* @param {Array<sap.ui.base.ManagedObject>} aCollectedControls The collected controls
|
|
291
|
+
* @alias sap.fe.core.controllerextensions.ViewState#adaptBindingRefreshControls
|
|
292
|
+
* @protected
|
|
293
|
+
*/
|
|
294
|
+
@Public
|
|
295
|
+
@Extensible(OverrideExecution.After)
|
|
296
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
297
|
+
adaptBindingRefreshControls(aCollectedControls: ManagedObject[]) {
|
|
298
|
+
// to be overriden
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
@Private
|
|
302
|
+
@Final
|
|
303
|
+
refreshControlBinding(oControl: any) {
|
|
304
|
+
const oControlRefreshBindingHandler = this.getControlRefreshBindingHandler(oControl);
|
|
305
|
+
let oPromiseChain = Promise.resolve();
|
|
306
|
+
if (typeof oControlRefreshBindingHandler.refreshBinding !== "function") {
|
|
307
|
+
Log.info("refreshBinding handler for control: " + oControl.getMetadata().getName() + " is not provided");
|
|
308
|
+
} else {
|
|
309
|
+
oPromiseChain = oPromiseChain.then(oControlRefreshBindingHandler.refreshBinding.bind(this, oControl));
|
|
310
|
+
}
|
|
311
|
+
return oPromiseChain;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Returns a map of <code>refreshBinding</code> function for a certain control.
|
|
316
|
+
*
|
|
317
|
+
* @param {sap.ui.base.ManagedObject} oControl The control to get state handler for
|
|
318
|
+
* @returns {object} A plain object with one function: <code>refreshBinding</code>
|
|
319
|
+
*/
|
|
320
|
+
|
|
321
|
+
@Private
|
|
322
|
+
@Final
|
|
323
|
+
getControlRefreshBindingHandler(oControl: any): any {
|
|
324
|
+
const oRefreshBindingHandler: any = {};
|
|
325
|
+
if (oControl) {
|
|
326
|
+
for (const sType in _mControlStateHandlerMap) {
|
|
327
|
+
if (oControl.isA(sType)) {
|
|
328
|
+
// pass only the refreshBinding handler in an object so that :
|
|
329
|
+
// 1. Application has access only to refreshBinding and not apply and reterive at this stage
|
|
330
|
+
// 2. Application modifications to the object will be reflected here (as we pass by reference)
|
|
331
|
+
oRefreshBindingHandler["refreshBinding"] = _mControlStateHandlerMap[sType].refreshBinding || {};
|
|
332
|
+
break;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
this.base.viewState.adaptBindingRefreshHandler(oControl, oRefreshBindingHandler);
|
|
337
|
+
return oRefreshBindingHandler;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Customize the <code>refreshBinding</code> function for a certain control.
|
|
341
|
+
*
|
|
342
|
+
* This function is meant to be individually overridden by consuming controllers, but not to be called directly.
|
|
343
|
+
* The override execution is: {@link sap.ui.core.mvc.OverrideExecution.After}.
|
|
344
|
+
*
|
|
345
|
+
* @param {sap.ui.base.ManagedObject} oControl The control for which the refresh handler is adapted.
|
|
346
|
+
* @param {Array<object>} oControlHandler A plain object which can have one function: <code>refreshBinding</code>
|
|
347
|
+
*
|
|
348
|
+
* @alias sap.fe.core.controllerextensions.ViewState#adaptBindingRefreshHandler
|
|
349
|
+
* @protected
|
|
350
|
+
*/
|
|
351
|
+
@Public
|
|
352
|
+
@Extensible(OverrideExecution.After)
|
|
353
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
354
|
+
adaptBindingRefreshHandler(oControl: ManagedObject, oControlHandler: any[]) {
|
|
355
|
+
// to be overriden
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Called when the application is suspended due to keep-alive mode.
|
|
360
|
+
*
|
|
361
|
+
* @alias sap.fe.core.controllerextensions.ViewState#onSuspend
|
|
362
|
+
* @public
|
|
363
|
+
*/
|
|
364
|
+
@Public
|
|
365
|
+
@Extensible(OverrideExecution.After)
|
|
366
|
+
onSuspend() {
|
|
367
|
+
// to be overriden
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Called when the application is restored due to keep-alive mode.
|
|
372
|
+
*
|
|
373
|
+
* @alias sap.fe.core.controllerextensions.ViewState#onRestore
|
|
374
|
+
* @public
|
|
375
|
+
*/
|
|
376
|
+
@Public
|
|
377
|
+
@Extensible(OverrideExecution.After)
|
|
378
|
+
onRestore() {
|
|
379
|
+
// to be overriden
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Destructor method for objects.
|
|
384
|
+
*/
|
|
385
|
+
destroy() {
|
|
386
|
+
delete this._pInitialStateAppliedResolve;
|
|
387
|
+
super.destroy();
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Helper function to enable multi override. It is adding an additional parameter (array) to the provided
|
|
392
|
+
* function (and its parameters), that will be evaluated via <code>Promise.all</code>.
|
|
393
|
+
*
|
|
394
|
+
* @param {Function} fnCall The function to be called
|
|
395
|
+
* @param args
|
|
396
|
+
* @returns {Promise} A promise to be resolved with the result of all overrides
|
|
397
|
+
*/
|
|
398
|
+
@Private
|
|
399
|
+
@Final
|
|
400
|
+
collectResults(fnCall: Function, ...args: any[]) {
|
|
401
|
+
const aResults: any[] = [];
|
|
402
|
+
args.push(aResults);
|
|
403
|
+
fnCall.apply(this, args);
|
|
404
|
+
return Promise.all(aResults);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Customize the <code>retrieve</code> and <code>apply</code> functions for a certain control.
|
|
409
|
+
*
|
|
410
|
+
* This function is meant to be individually overridden by consuming controllers, but not to be called directly.
|
|
411
|
+
* The override execution is: {@link sap.ui.core.mvc.OverrideExecution.After}.
|
|
412
|
+
*
|
|
413
|
+
* @param {sap.ui.base.ManagedObject} oControl The control to get state handler for
|
|
414
|
+
* @param {Array<object>} aControlHandler A list of plain objects with two functions: <code>retrieve</code> and <code>apply</code>
|
|
415
|
+
*
|
|
416
|
+
* @alias sap.fe.core.controllerextensions.ViewState#adaptControlStateHandler
|
|
417
|
+
* @protected
|
|
418
|
+
*/
|
|
419
|
+
@Public
|
|
420
|
+
@Extensible(OverrideExecution.After)
|
|
421
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
422
|
+
adaptControlStateHandler(oControl: ManagedObject, aControlHandler: object[]) {
|
|
423
|
+
// to be overridden if needed
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Returns a map of <code>retrieve</code> and <code>apply</code> functions for a certain control.
|
|
428
|
+
*
|
|
429
|
+
* @param {sap.ui.base.ManagedObject} oControl The control to get state handler for
|
|
430
|
+
* @returns {object} A plain object with two functions: <code>retrieve</code> and <code>apply</code>
|
|
431
|
+
*/
|
|
432
|
+
@Private
|
|
433
|
+
@Final
|
|
434
|
+
getControlStateHandler(oControl: any) {
|
|
435
|
+
const aInternalControlStateHandler = [],
|
|
436
|
+
aCustomControlStateHandler: any[] = [];
|
|
437
|
+
if (oControl) {
|
|
438
|
+
for (const sType in _mControlStateHandlerMap) {
|
|
439
|
+
if (oControl.isA(sType)) {
|
|
440
|
+
// avoid direct manipulation of internal _mControlStateHandlerMap
|
|
441
|
+
aInternalControlStateHandler.push(Object.assign({}, _mControlStateHandlerMap[sType]));
|
|
442
|
+
break;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
this.base.viewState.adaptControlStateHandler(oControl, aCustomControlStateHandler);
|
|
447
|
+
return aInternalControlStateHandler.concat(aCustomControlStateHandler);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* This function should add all controls for given view that should be considered for the state handling to the provided control array.
|
|
452
|
+
*
|
|
453
|
+
* This function is meant to be individually overridden by consuming controllers, but not to be called directly.
|
|
454
|
+
* The override execution is: {@link sap.ui.core.mvc.OverrideExecution.After}.
|
|
455
|
+
* @param {Array<sap.ui.base.ManagedObject>} aCollectedControls The collected controls
|
|
456
|
+
* @alias sap.fe.core.controllerextensions.ViewState#adaptStateControls
|
|
457
|
+
* @protected
|
|
458
|
+
*/
|
|
459
|
+
@Public
|
|
460
|
+
@Extensible(OverrideExecution.After)
|
|
461
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
462
|
+
adaptStateControls(aCollectedControls: ManagedObject[]) {
|
|
463
|
+
// to be overridden if needed
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Returns the key to be used for given control.
|
|
468
|
+
*
|
|
469
|
+
* @param {sap.ui.base.ManagedObject} oControl The control to get state key for
|
|
470
|
+
* @returns {string} The key to be used for storing the controls state
|
|
471
|
+
*/
|
|
472
|
+
@Public
|
|
473
|
+
@Final
|
|
474
|
+
getStateKey(oControl: any) {
|
|
475
|
+
return this.getView().getLocalId(oControl.getId()) || oControl.getId();
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Retrieve the view state of this extensions view.
|
|
480
|
+
* When this function is called more than once before finishing, all but the final response will resolve to <code>undefined</code>.
|
|
481
|
+
*
|
|
482
|
+
* @returns {Promise} A promise resolving the view state
|
|
483
|
+
*
|
|
484
|
+
* @alias sap.fe.core.controllerextensions.ViewState#retrieveViewState
|
|
485
|
+
* @public
|
|
486
|
+
*/
|
|
487
|
+
@Public
|
|
488
|
+
@Final
|
|
489
|
+
retrieveViewState() {
|
|
490
|
+
++this._iRetrievingStateCounter;
|
|
491
|
+
return this._pInitialStateApplied
|
|
492
|
+
.then(() => {
|
|
493
|
+
return this.collectResults(this.base.viewState.adaptStateControls);
|
|
494
|
+
})
|
|
495
|
+
.then((aControls: any) => {
|
|
496
|
+
return Promise.all(
|
|
497
|
+
aControls
|
|
498
|
+
.filter(function(oControl: any) {
|
|
499
|
+
return oControl && oControl.isA && oControl.isA("sap.ui.base.ManagedObject");
|
|
500
|
+
})
|
|
501
|
+
.map((oControl: any) => {
|
|
502
|
+
return this.retrieveControlState(oControl).then((vResult: any) => {
|
|
503
|
+
return {
|
|
504
|
+
key: this.getStateKey(oControl),
|
|
505
|
+
value: vResult
|
|
506
|
+
};
|
|
507
|
+
});
|
|
508
|
+
})
|
|
509
|
+
);
|
|
510
|
+
})
|
|
511
|
+
.then(function(aResolvedStates: any) {
|
|
512
|
+
return aResolvedStates.reduce(function(oStates: any, mState: any) {
|
|
513
|
+
const oCurrentState: any = {};
|
|
514
|
+
oCurrentState[mState.key] = mState.value;
|
|
515
|
+
return mergeObjects(oStates, oCurrentState);
|
|
516
|
+
}, {});
|
|
517
|
+
})
|
|
518
|
+
.then((oViewState: any) => {
|
|
519
|
+
return Promise.resolve(this._retrieveAdditionalStates()).then(function(mAdditionalStates: any) {
|
|
520
|
+
if (mAdditionalStates && Object.keys(mAdditionalStates).length) {
|
|
521
|
+
oViewState[ADDITIONAL_STATES_KEY] = mAdditionalStates;
|
|
522
|
+
}
|
|
523
|
+
return oViewState;
|
|
524
|
+
});
|
|
525
|
+
})
|
|
526
|
+
.finally(() => {
|
|
527
|
+
--this._iRetrievingStateCounter;
|
|
528
|
+
})
|
|
529
|
+
.then((oViewState: any) => {
|
|
530
|
+
return this._iRetrievingStateCounter === 0 ? oViewState : undefined;
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* Extend the map of additional states (not control bound) to be added to the current view state of the given view.
|
|
536
|
+
*
|
|
537
|
+
* This function is meant to be individually overridden by consuming controllers, but not to be called directly.
|
|
538
|
+
* The override execution is: {@link sap.ui.core.mvc.OverrideExecution.After}.
|
|
539
|
+
*
|
|
540
|
+
* @param {object} mAdditionalStates The additional state
|
|
541
|
+
*
|
|
542
|
+
* @alias sap.fe.core.controllerextensions.ViewState#retrieveAdditionalStates
|
|
543
|
+
* @protected
|
|
544
|
+
*/
|
|
545
|
+
@Public
|
|
546
|
+
@Extensible(OverrideExecution.After)
|
|
547
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
548
|
+
retrieveAdditionalStates(mAdditionalStates: object) {
|
|
549
|
+
// to be overridden if needed
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Returns a map of additional states (not control bound) to be added to the current view state of the given view.
|
|
554
|
+
*
|
|
555
|
+
* @returns {object | Promise<object>} Additional view states
|
|
556
|
+
*/
|
|
557
|
+
_retrieveAdditionalStates() {
|
|
558
|
+
const mAdditionalStates = {};
|
|
559
|
+
this.base.viewState.retrieveAdditionalStates(mAdditionalStates);
|
|
560
|
+
return mAdditionalStates;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Returns the current state for the given control.
|
|
565
|
+
*
|
|
566
|
+
* @param {sap.ui.base.ManagedObject} oControl The object to get the state for
|
|
567
|
+
* @returns {Promise<object>} The state for the given control
|
|
568
|
+
*/
|
|
569
|
+
@Private
|
|
570
|
+
@Final
|
|
571
|
+
retrieveControlState(oControl: any) {
|
|
572
|
+
const aControlStateHandlers = this.getControlStateHandler(oControl);
|
|
573
|
+
return Promise.all(
|
|
574
|
+
aControlStateHandlers.map((mControlStateHandler: any) => {
|
|
575
|
+
if (typeof mControlStateHandler.retrieve !== "function") {
|
|
576
|
+
throw new Error("controlStateHandler.retrieve is not a function for control: " + oControl.getMetadata().getName());
|
|
577
|
+
}
|
|
578
|
+
return mControlStateHandler.retrieve.call(this, oControl);
|
|
579
|
+
})
|
|
580
|
+
).then((aStates: any[]) => {
|
|
581
|
+
return aStates.reduce(function(oFinalState: any, oCurrentState: any) {
|
|
582
|
+
return mergeObjects(oFinalState, oCurrentState);
|
|
583
|
+
}, {});
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Defines whether the view state should only be applied once initially.
|
|
589
|
+
*
|
|
590
|
+
* This function is meant to be individually overridden by consuming controllers, but not to be called directly.
|
|
591
|
+
* The override execution is: {@link sap.ui.core.mvc.OverrideExecution.Instead}.
|
|
592
|
+
*
|
|
593
|
+
* Important:
|
|
594
|
+
* You should only override this method for custom pages and not for the standard ListReportPage and ObjectPage!
|
|
595
|
+
*
|
|
596
|
+
* @returns {boolean} If <code>true</code>, only the initial view state is applied once,
|
|
597
|
+
* else any new view state is also applied on follow-up calls (default)
|
|
598
|
+
*
|
|
599
|
+
* @alias sap.fe.core.controllerextensions.ViewState#applyInitialStateOnly
|
|
600
|
+
* @protected
|
|
601
|
+
*/
|
|
602
|
+
@Public
|
|
603
|
+
@Extensible(OverrideExecution.Instead)
|
|
604
|
+
applyInitialStateOnly() {
|
|
605
|
+
return true;
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Applies the given view state to this extensions view.
|
|
609
|
+
*
|
|
610
|
+
* @param {object} oViewState The view state to apply (can be undefined)
|
|
611
|
+
* @param {object} oNavParameter The current navigation parameter
|
|
612
|
+
* @param {sap.fe.navigation.NavType} oNavParameter.navigationType The actual navigation type
|
|
613
|
+
* @param {object} oNavParameter.selectionVariant The selectionVariant from the navigation
|
|
614
|
+
* @param {object} oNavParameter.selectionVariantDefaults The selectionVariant defaults from the navigation
|
|
615
|
+
* @param {boolean} oNavParameter.requiresStandardVariant Defines whether standard variant must be used in VM
|
|
616
|
+
*
|
|
617
|
+
* @returns {Promise} Promise for async state handling
|
|
618
|
+
*
|
|
619
|
+
* @alias sap.fe.core.controllerextensions.ViewState#applyViewState
|
|
620
|
+
* @public
|
|
621
|
+
*/
|
|
622
|
+
@Public
|
|
623
|
+
@Final
|
|
624
|
+
applyViewState(
|
|
625
|
+
oViewState: any,
|
|
626
|
+
oNavParameter: {
|
|
627
|
+
navigationType: any;
|
|
628
|
+
selectionVariant?: object;
|
|
629
|
+
selectionVariantDefaults?: object;
|
|
630
|
+
requiresStandardVariant?: boolean;
|
|
631
|
+
}
|
|
632
|
+
): Promise<any> {
|
|
633
|
+
if (this.base.viewState.applyInitialStateOnly() && this._getInitialStateApplied()) {
|
|
634
|
+
return Promise.resolve();
|
|
635
|
+
}
|
|
636
|
+
return this.collectResults(this.base.viewState.onBeforeStateApplied)
|
|
637
|
+
.then(() => {
|
|
638
|
+
return this.collectResults(this.base.viewState.adaptStateControls);
|
|
639
|
+
})
|
|
640
|
+
.then((aControls: any) => {
|
|
641
|
+
let oPromiseChain = Promise.resolve();
|
|
642
|
+
aControls
|
|
643
|
+
.filter(function(oControl: any) {
|
|
644
|
+
return oControl && oControl.isA && oControl.isA("sap.ui.base.ManagedObject");
|
|
645
|
+
})
|
|
646
|
+
.forEach((oControl: any) => {
|
|
647
|
+
const sKey = this.getStateKey(oControl);
|
|
648
|
+
oPromiseChain = oPromiseChain.then(
|
|
649
|
+
this.applyControlState.bind(this, oControl, oViewState ? oViewState[sKey] : undefined, oNavParameter)
|
|
650
|
+
);
|
|
651
|
+
});
|
|
652
|
+
return oPromiseChain;
|
|
653
|
+
})
|
|
654
|
+
.then(() => {
|
|
655
|
+
if (oNavParameter.navigationType === NavType.iAppState) {
|
|
656
|
+
return this.collectResults(
|
|
657
|
+
this.base.viewState.applyAdditionalStates,
|
|
658
|
+
oViewState ? oViewState[ADDITIONAL_STATES_KEY] : undefined
|
|
659
|
+
);
|
|
660
|
+
} else {
|
|
661
|
+
return this.collectResults(this.base.viewState.applyNavigationParameters, oNavParameter);
|
|
662
|
+
}
|
|
663
|
+
})
|
|
664
|
+
.finally(() => {
|
|
665
|
+
return this.collectResults(this.base.viewState.onAfterStateApplied).then(this._setInitialStateApplied.bind(this));
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
@Private
|
|
670
|
+
_checkIfVariantIdIsAvailable(oVM: any, sVariantId: any) {
|
|
671
|
+
const aVariants = oVM.getVariants();
|
|
672
|
+
let bIsControlStateVariantAvailable = false;
|
|
673
|
+
aVariants.forEach(function(oVariant: any) {
|
|
674
|
+
if (oVariant.key === sVariantId) {
|
|
675
|
+
bIsControlStateVariantAvailable = true;
|
|
676
|
+
}
|
|
677
|
+
});
|
|
678
|
+
return bIsControlStateVariantAvailable;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
_setInitialStateApplied() {
|
|
682
|
+
if (this._pInitialStateAppliedResolve) {
|
|
683
|
+
const pInitialStateAppliedResolve = this._pInitialStateAppliedResolve;
|
|
684
|
+
delete this._pInitialStateAppliedResolve;
|
|
685
|
+
pInitialStateAppliedResolve();
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
_getInitialStateApplied() {
|
|
689
|
+
return !this._pInitialStateAppliedResolve;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* Hook to react before a state for given view is applied.
|
|
694
|
+
*
|
|
695
|
+
* This function is meant to be individually overridden by consuming controllers, but not to be called directly.
|
|
696
|
+
* The override execution is: {@link sap.ui.core.mvc.OverrideExecution.After}.
|
|
697
|
+
*
|
|
698
|
+
* @param {Promise} aPromises Extensible array of promises to be resolved before continuing
|
|
699
|
+
*
|
|
700
|
+
* @alias sap.fe.core.controllerextensions.ViewState#onBeforeStateApplied
|
|
701
|
+
* @protected
|
|
702
|
+
*/
|
|
703
|
+
@Public
|
|
704
|
+
@Extensible(OverrideExecution.After)
|
|
705
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
706
|
+
onBeforeStateApplied(aPromises: Promise<any>) {
|
|
707
|
+
// to be overriden
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* Hook to react when state for given view was applied.
|
|
712
|
+
*
|
|
713
|
+
* This function is meant to be individually overridden by consuming controllers, but not to be called directly.
|
|
714
|
+
* The override execution is: {@link sap.ui.core.mvc.OverrideExecution.After}.
|
|
715
|
+
*
|
|
716
|
+
* @param {Promise} aPromises Extensible array of promises to be resolved before continuing
|
|
717
|
+
*
|
|
718
|
+
* @alias sap.fe.core.controllerextensions.ViewState#onAfterStateApplied
|
|
719
|
+
* @protected
|
|
720
|
+
*/
|
|
721
|
+
@Public
|
|
722
|
+
@Extensible(OverrideExecution.After)
|
|
723
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
724
|
+
onAfterStateApplied(aPromises: Promise<any>) {
|
|
725
|
+
// to be overriden
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Applying additional, not control related, states - is called only if navigation type is iAppState.
|
|
730
|
+
*
|
|
731
|
+
* This function is meant to be individually overridden by consuming controllers, but not to be called directly.
|
|
732
|
+
* The override execution is: {@link sap.ui.core.mvc.OverrideExecution.After}.
|
|
733
|
+
*
|
|
734
|
+
* @param {object} oViewState The current view state
|
|
735
|
+
* @param {Promise} aPromises Extensible array of promises to be resolved before continuing
|
|
736
|
+
*
|
|
737
|
+
* @alias sap.fe.core.controllerextensions.ViewState#applyAdditionalStates
|
|
738
|
+
* @protected
|
|
739
|
+
*/
|
|
740
|
+
@Public
|
|
741
|
+
@Extensible(OverrideExecution.After)
|
|
742
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
743
|
+
applyAdditionalStates(oViewState: object, aPromises: Promise<any>) {
|
|
744
|
+
// to be overridden if needed
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* Apply navigation parameters - is called only if navigation type is not iAppState.
|
|
749
|
+
*
|
|
750
|
+
* This function is meant to be individually overridden by consuming controllers, but not to be called directly.
|
|
751
|
+
* The override execution is: {@link sap.ui.core.mvc.OverrideExecution.After}.
|
|
752
|
+
*
|
|
753
|
+
* @param {object} oNavParameter The current navigation parameter
|
|
754
|
+
* @param {sap.fe.navigation.NavType} oNavParameter.navigationType The actual navigation type
|
|
755
|
+
* @param {object} [oNavParameter.selectionVariant] The selectionVariant from the navigation
|
|
756
|
+
* @param {object} [oNavParameter.selectionVariantDefaults] The selectionVariant defaults from the navigation
|
|
757
|
+
* @param {boolean} [oNavParameter.requiresStandardVariant] Defines whether standard variant must be used in VM
|
|
758
|
+
* @param {Promise} aPromises Extensible array of promises to be resolved before continuing
|
|
759
|
+
*
|
|
760
|
+
* @alias sap.fe.core.controllerextensions.ViewState#applyNavigationParameters
|
|
761
|
+
* @protected
|
|
762
|
+
*/
|
|
763
|
+
@Public
|
|
764
|
+
@Extensible(OverrideExecution.After)
|
|
765
|
+
applyNavigationParameters(
|
|
766
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
767
|
+
oNavParameter: {
|
|
768
|
+
navigationType: any;
|
|
769
|
+
selectionVariant?: object | undefined;
|
|
770
|
+
selectionVariantDefaults?: object | undefined;
|
|
771
|
+
requiresStandardVariant?: boolean | undefined;
|
|
772
|
+
},
|
|
773
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
774
|
+
aPromises: Promise<any>
|
|
775
|
+
) {
|
|
776
|
+
// to be overridden if needed
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* Applying the given state to the given control.
|
|
781
|
+
*
|
|
782
|
+
* @param {sap.ui.base.ManagedObject} oControl The object to apply the given state
|
|
783
|
+
* @param {object} oControlState The state for the given control
|
|
784
|
+
* @param {object} [oNavParameters] The current navigation parameters
|
|
785
|
+
* @returns {any} Return a promise for async state handling
|
|
786
|
+
*/
|
|
787
|
+
@Private
|
|
788
|
+
@Final
|
|
789
|
+
applyControlState(oControl: any, oControlState: object, oNavParameters?: object) {
|
|
790
|
+
const aControlStateHandlers = this.getControlStateHandler(oControl);
|
|
791
|
+
let oPromiseChain = Promise.resolve();
|
|
792
|
+
aControlStateHandlers.forEach((mControlStateHandler: any) => {
|
|
793
|
+
if (typeof mControlStateHandler.apply !== "function") {
|
|
794
|
+
throw new Error("controlStateHandler.apply is not a function for control: " + oControl.getMetadata().getName());
|
|
795
|
+
}
|
|
796
|
+
oPromiseChain = oPromiseChain.then(mControlStateHandler.apply.bind(this, oControl, oControlState, oNavParameters));
|
|
797
|
+
});
|
|
798
|
+
return oPromiseChain;
|
|
799
|
+
}
|
|
800
|
+
getInterface() {
|
|
801
|
+
return this;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
export default ViewState;
|