@sapui5/sap.fe.templates 1.100.0 → 1.102.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.
Files changed (150) hide show
  1. package/package.json +4 -5
  2. package/src/sap/fe/templates/.library +1 -2
  3. package/src/sap/fe/templates/AnalyticalListPage/Component.js +24 -12
  4. package/src/sap/fe/templates/AnalyticalListPage/Component.ts +6 -0
  5. package/src/sap/fe/templates/AnalyticalListPage/chart/FEChartDelegate.js +30 -32
  6. package/src/sap/fe/templates/AnalyticalListPage/chart/FEChartDelegate.ts +25 -0
  7. package/src/sap/fe/templates/Feedback.js +80 -0
  8. package/src/sap/fe/templates/Feedback.ts +67 -0
  9. package/src/sap/fe/templates/ListComponent.js +156 -118
  10. package/src/sap/fe/templates/ListComponent.ts +105 -0
  11. package/src/sap/fe/templates/ListReport/Component.js +82 -53
  12. package/src/sap/fe/templates/ListReport/Component.ts +39 -0
  13. package/src/sap/fe/templates/ListReport/ExtensionAPI.js +126 -112
  14. package/src/sap/fe/templates/ListReport/ExtensionAPI.ts +106 -0
  15. package/src/sap/fe/templates/ListReport/ListReport.view.xml +106 -58
  16. package/src/sap/fe/templates/ListReport/ListReportController.controller.js +1196 -1081
  17. package/src/sap/fe/templates/ListReport/ListReportController.controller.ts +1088 -0
  18. package/src/sap/fe/templates/ListReport/ListReportTemplating.js +45 -0
  19. package/src/sap/fe/templates/ListReport/ListReportTemplating.ts +30 -0
  20. package/src/sap/fe/templates/ListReport/overrides/IntentBasedNavigation.js +54 -53
  21. package/src/sap/fe/templates/ListReport/overrides/IntentBasedNavigation.ts +55 -0
  22. package/src/sap/fe/templates/ListReport/overrides/Share.js +137 -137
  23. package/src/sap/fe/templates/ListReport/overrides/Share.ts +135 -0
  24. package/src/sap/fe/templates/ListReport/overrides/ViewState.js +451 -428
  25. package/src/sap/fe/templates/ListReport/overrides/ViewState.ts +419 -0
  26. package/src/sap/fe/templates/ListReport/view/fragments/CollectionVisualization.fragment.xml +25 -25
  27. package/src/sap/fe/templates/ListReport/view/fragments/MultipleMode.fragment.js +72 -0
  28. package/src/sap/fe/templates/ListReport/view/fragments/MultipleMode.fragment.ts +62 -0
  29. package/src/sap/fe/templates/ListReport/view/fragments/{MultipleMode.fragment.xml → MultipleModeOld.fragment.xml} +24 -23
  30. package/src/sap/fe/templates/ObjectPage/Component.js +169 -138
  31. package/src/sap/fe/templates/ObjectPage/Component.ts +131 -0
  32. package/src/sap/fe/templates/ObjectPage/ExtensionAPI.js +140 -142
  33. package/src/sap/fe/templates/ObjectPage/ExtensionAPI.ts +116 -0
  34. package/src/sap/fe/templates/ObjectPage/ObjectPage.view.xml +162 -22
  35. package/src/sap/fe/templates/ObjectPage/ObjectPageController.controller.js +1534 -1447
  36. package/src/sap/fe/templates/ObjectPage/ObjectPageController.controller.ts +1454 -0
  37. package/src/sap/fe/templates/ObjectPage/ObjectPageTemplating.js +872 -0
  38. package/src/sap/fe/templates/ObjectPage/ObjectPageTemplating.ts +837 -0
  39. package/src/sap/fe/templates/ObjectPage/controls/StashableHBox.js +136 -101
  40. package/src/sap/fe/templates/ObjectPage/controls/StashableHBox.ts +84 -0
  41. package/src/sap/fe/templates/ObjectPage/controls/StashableVBox.js +24 -21
  42. package/src/sap/fe/templates/ObjectPage/controls/StashableVBox.ts +10 -0
  43. package/src/sap/fe/templates/ObjectPage/controls/SubSectionBlock.js +98 -53
  44. package/src/sap/fe/templates/ObjectPage/controls/SubSectionBlock.ts +50 -0
  45. package/src/sap/fe/templates/ObjectPage/designtime/FlexBox.designtime.js +20 -19
  46. package/src/sap/fe/templates/ObjectPage/designtime/FlexBox.designtime.ts +15 -0
  47. package/src/sap/fe/templates/ObjectPage/designtime/StashableHBox.designtime.js +50 -47
  48. package/src/sap/fe/templates/ObjectPage/designtime/StashableHBox.designtime.ts +47 -0
  49. package/src/sap/fe/templates/ObjectPage/designtime/StashableVBox.designtime.js +34 -34
  50. package/src/sap/fe/templates/ObjectPage/designtime/StashableVBox.designtime.ts +34 -0
  51. package/src/sap/fe/templates/ObjectPage/flexibility/StashableHBox.flexibility.js +15 -15
  52. package/src/sap/fe/templates/ObjectPage/flexibility/StashableHBox.flexibility.ts +13 -0
  53. package/src/sap/fe/templates/ObjectPage/flexibility/StashableVBox.flexibility.js +11 -11
  54. package/src/sap/fe/templates/ObjectPage/flexibility/StashableVBox.flexibility.ts +7 -0
  55. package/src/sap/fe/templates/ObjectPage/overrides/IntentBasedNavigation.js +55 -52
  56. package/src/sap/fe/templates/ObjectPage/overrides/IntentBasedNavigation.ts +57 -0
  57. package/src/sap/fe/templates/ObjectPage/overrides/InternalRouting.js +15 -17
  58. package/src/sap/fe/templates/ObjectPage/overrides/InternalRouting.ts +13 -0
  59. package/src/sap/fe/templates/ObjectPage/overrides/MessageHandler.js +13 -17
  60. package/src/sap/fe/templates/ObjectPage/overrides/MessageHandler.ts +14 -0
  61. package/src/sap/fe/templates/ObjectPage/overrides/Paginator.js +23 -21
  62. package/src/sap/fe/templates/ObjectPage/overrides/Paginator.ts +21 -0
  63. package/src/sap/fe/templates/ObjectPage/overrides/Share.js +310 -317
  64. package/src/sap/fe/templates/ObjectPage/overrides/Share.ts +316 -0
  65. package/src/sap/fe/templates/ObjectPage/overrides/ViewState.js +66 -57
  66. package/src/sap/fe/templates/ObjectPage/overrides/ViewState.ts +65 -0
  67. package/src/sap/fe/templates/ObjectPage/view/fragments/Actions.fragment.xml +26 -33
  68. package/src/sap/fe/templates/ObjectPage/view/fragments/CollaborationDraft.fragment.xml +11 -10
  69. package/src/sap/fe/templates/ObjectPage/view/fragments/EditableHeaderFacet.fragment.xml +15 -15
  70. package/src/sap/fe/templates/ObjectPage/view/fragments/FooterContent.fragment.xml +31 -27
  71. package/src/sap/fe/templates/ObjectPage/view/fragments/FormActionButtons.fragment.xml +15 -16
  72. package/src/sap/fe/templates/ObjectPage/view/fragments/FormActions.fragment.xml +1 -5
  73. package/src/sap/fe/templates/ObjectPage/view/fragments/HeaderDataPoint.fragment.xml +1 -2
  74. package/src/sap/fe/templates/ObjectPage/view/fragments/HeaderDataPointTitle.fragment.xml +1 -3
  75. package/src/sap/fe/templates/ObjectPage/view/fragments/HeaderFacet.fragment.xml +3 -4
  76. package/src/sap/fe/templates/ObjectPage/view/fragments/Heading.fragment.xml +16 -17
  77. package/src/sap/fe/templates/ObjectPage/view/fragments/HeadingTitle.fragment.xml +3 -3
  78. package/src/sap/fe/templates/ObjectPage/view/fragments/ObjectPageHeaderForm.fragment.xml +3 -3
  79. package/src/sap/fe/templates/ObjectPage/view/fragments/RelatedApps.fragment.xml +7 -4
  80. package/src/sap/fe/templates/ObjectPage/view/fragments/Section.fragment.xml +71 -6
  81. package/src/sap/fe/templates/ObjectPage/view/fragments/SectionContent.fragment.xml +114 -94
  82. package/src/sap/fe/templates/ObjectPage/view/fragments/SectionContentLazyLoader.fragment.xml +127 -107
  83. package/src/sap/fe/templates/ObjectPage/view/fragments/SwitchDraftAndActiveObjectPopOver.fragment.xml +27 -0
  84. package/src/sap/fe/templates/RootContainer/controller/Fcl.controller.js +899 -817
  85. package/src/sap/fe/templates/RootContainer/controller/Fcl.controller.ts +833 -0
  86. package/src/sap/fe/templates/RootContainer/controller/NavContainer.controller.js +205 -189
  87. package/src/sap/fe/templates/RootContainer/controller/NavContainer.controller.ts +178 -0
  88. package/src/sap/fe/templates/RootContainer/controller/RootContainerBaseController.js +484 -459
  89. package/src/sap/fe/templates/RootContainer/controller/RootContainerBaseController.ts +438 -0
  90. package/src/sap/fe/templates/RootContainer/overrides/EditFlow.js +16 -14
  91. package/src/sap/fe/templates/RootContainer/overrides/EditFlow.ts +20 -0
  92. package/src/sap/fe/templates/TableScroller.js +45 -53
  93. package/src/sap/fe/templates/TableScroller.ts +48 -0
  94. package/src/sap/fe/templates/controls/Chart.fragment.xml +18 -17
  95. package/src/sap/fe/templates/controls/MacroChart.fragment.xml +23 -0
  96. package/src/sap/fe/templates/controls/Table.fragment.xml +3 -4
  97. package/src/sap/fe/templates/library.js +49 -63
  98. package/src/sap/fe/templates/library.ts +57 -0
  99. package/src/sap/fe/templates/messagebundle.properties +19 -7
  100. package/src/sap/fe/templates/messagebundle_ar.properties +12 -4
  101. package/src/sap/fe/templates/messagebundle_bg.properties +12 -4
  102. package/src/sap/fe/templates/messagebundle_ca.properties +12 -4
  103. package/src/sap/fe/templates/messagebundle_cs.properties +12 -4
  104. package/src/sap/fe/templates/messagebundle_cy.properties +12 -4
  105. package/src/sap/fe/templates/messagebundle_da.properties +12 -4
  106. package/src/sap/fe/templates/messagebundle_de.properties +12 -4
  107. package/src/sap/fe/templates/messagebundle_el.properties +12 -4
  108. package/src/sap/fe/templates/messagebundle_en.properties +12 -4
  109. package/src/sap/fe/templates/messagebundle_en_GB.properties +12 -4
  110. package/src/sap/fe/templates/messagebundle_en_US_sappsd.properties +13 -5
  111. package/src/sap/fe/templates/messagebundle_en_US_saprigi.properties +13 -5
  112. package/src/sap/fe/templates/messagebundle_en_US_saptrc.properties +13 -5
  113. package/src/sap/fe/templates/messagebundle_es.properties +12 -4
  114. package/src/sap/fe/templates/messagebundle_es_MX.properties +12 -4
  115. package/src/sap/fe/templates/messagebundle_et.properties +12 -4
  116. package/src/sap/fe/templates/messagebundle_fi.properties +12 -4
  117. package/src/sap/fe/templates/messagebundle_fr.properties +12 -4
  118. package/src/sap/fe/templates/messagebundle_fr_CA.properties +12 -4
  119. package/src/sap/fe/templates/messagebundle_hi.properties +12 -4
  120. package/src/sap/fe/templates/messagebundle_hr.properties +12 -4
  121. package/src/sap/fe/templates/messagebundle_hu.properties +12 -4
  122. package/src/sap/fe/templates/messagebundle_id.properties +12 -4
  123. package/src/sap/fe/templates/messagebundle_it.properties +12 -4
  124. package/src/sap/fe/templates/messagebundle_iw.properties +12 -4
  125. package/src/sap/fe/templates/messagebundle_ja.properties +12 -4
  126. package/src/sap/fe/templates/messagebundle_kk.properties +12 -4
  127. package/src/sap/fe/templates/messagebundle_ko.properties +12 -4
  128. package/src/sap/fe/templates/messagebundle_lt.properties +12 -4
  129. package/src/sap/fe/templates/messagebundle_lv.properties +12 -4
  130. package/src/sap/fe/templates/messagebundle_ms.properties +12 -4
  131. package/src/sap/fe/templates/messagebundle_nl.properties +12 -4
  132. package/src/sap/fe/templates/messagebundle_no.properties +12 -4
  133. package/src/sap/fe/templates/messagebundle_pl.properties +12 -4
  134. package/src/sap/fe/templates/messagebundle_pt.properties +13 -5
  135. package/src/sap/fe/templates/messagebundle_pt_PT.properties +12 -4
  136. package/src/sap/fe/templates/messagebundle_ro.properties +12 -4
  137. package/src/sap/fe/templates/messagebundle_ru.properties +12 -4
  138. package/src/sap/fe/templates/messagebundle_sh.properties +12 -4
  139. package/src/sap/fe/templates/messagebundle_sk.properties +12 -4
  140. package/src/sap/fe/templates/messagebundle_sl.properties +12 -4
  141. package/src/sap/fe/templates/messagebundle_sv.properties +12 -4
  142. package/src/sap/fe/templates/messagebundle_th.properties +12 -4
  143. package/src/sap/fe/templates/messagebundle_tr.properties +12 -4
  144. package/src/sap/fe/templates/messagebundle_uk.properties +12 -4
  145. package/src/sap/fe/templates/messagebundle_vi.properties +12 -4
  146. package/src/sap/fe/templates/messagebundle_zh_CN.properties +12 -4
  147. package/src/sap/fe/templates/messagebundle_zh_TW.properties +12 -4
  148. package/src/sap/fe/templates/ObjectPage/AnnotationHelper.js +0 -518
  149. package/src/sap/fe/templates/ObjectPage/templating/ObjectPageTemplating.js +0 -120
  150. package/src/sap/fe/templates/ObjectPage/templating/ObjectPageTemplating.ts +0 -138
@@ -0,0 +1,833 @@
1
+ import Log from "sap/base/Log";
2
+ import FlexibleColumnLayout from "sap/f/FlexibleColumnLayout";
3
+ import FlexibleColumnLayoutSemanticHelper from "sap/f/FlexibleColumnLayoutSemanticHelper";
4
+ import fLibrary from "sap/f/library";
5
+ import AppComponent from "sap/fe/core/AppComponent";
6
+ import RouterProxy from "sap/fe/core/controllerextensions/routing/RouterProxy";
7
+ import ViewState from "sap/fe/core/controllerextensions/ViewState";
8
+ import { defineUI5Class, usingExtension } from "sap/fe/core/helpers/ClassSupport";
9
+ import KeepAliveHelper from "sap/fe/core/helpers/KeepAliveHelper";
10
+ import Link from "sap/m/Link";
11
+ import MessageBox, { Action, Icon } from "sap/m/MessageBox";
12
+ import MessagePage from "sap/m/MessagePage";
13
+ import Control from "sap/ui/core/Control";
14
+ import JSONModel from "sap/ui/model/json/JSONModel";
15
+ import Context from "sap/ui/model/odata/v4/Context";
16
+ import BaseController from "./RootContainerBaseController";
17
+
18
+ const LayoutType = fLibrary.LayoutType;
19
+
20
+ const CONSTANTS = {
21
+ page: {
22
+ names: ["BeginColumn", "MidColumn", "EndColumn"],
23
+ currentGetter: {
24
+ prefix: "getCurrent",
25
+ suffix: "Page"
26
+ },
27
+ getter: {
28
+ prefix: "get",
29
+ suffix: "Pages"
30
+ }
31
+ }
32
+ };
33
+ const _getViewFromContainer = function (oContainer: any) {
34
+ if (oContainer.isA("sap.ui.core.ComponentContainer")) {
35
+ return oContainer.getComponentInstance().getRootControl();
36
+ } else {
37
+ return oContainer;
38
+ }
39
+ };
40
+
41
+ @defineUI5Class("sap.fe.templates.RootContainer.controller.Fcl")
42
+ class FclController extends BaseController {
43
+ @usingExtension(
44
+ ViewState.override({
45
+ applyInitialStateOnly: function () {
46
+ return false;
47
+ },
48
+ adaptBindingRefreshControls: function (this: ViewState, aControls: any) {
49
+ (this.getView().getController() as FclController)._getAllVisibleViews().forEach(function (oChildView: any) {
50
+ const pChildView = new Promise(function (resolve: (value: any) => void) {
51
+ resolve(oChildView);
52
+ });
53
+ aControls.push(pChildView);
54
+ });
55
+ },
56
+ adaptStateControls: function (this: ViewState, aStateControls: any) {
57
+ (this.getView().getController() as FclController)._getAllVisibleViews().forEach(function (oChildView: any) {
58
+ const pChildView = new Promise(function (resolve: (value: any) => void) {
59
+ resolve(oChildView);
60
+ });
61
+ aStateControls.push(pChildView);
62
+ });
63
+ },
64
+ onRestore: function (this: ViewState) {
65
+ const oView = this.getView(),
66
+ oNavContainer = oView.byId("appContent");
67
+ const oFCLController = this.getView().getController();
68
+ const oInternalModel = oNavContainer.getModel("internal") as JSONModel;
69
+ const oPages = oInternalModel.getProperty("/pages");
70
+
71
+ for (const sComponentId in oPages) {
72
+ oInternalModel.setProperty("/pages/" + sComponentId + "/restoreStatus", "pending");
73
+ }
74
+ (oFCLController as FclController).onContainerReady();
75
+ },
76
+ onSuspend: function (this: ViewState) {
77
+ const oFCLController = this.getView().getController() as FclController;
78
+ const oFCLControl = oFCLController.getFclControl();
79
+ const aBeginColumnPages: Control[] = oFCLControl.getBeginColumnPages() || [];
80
+ const aMidColumnPages: Control[] = oFCLControl.getMidColumnPages() || [];
81
+ const aEndColumnPages: Control[] = oFCLControl.getEndColumnPages() || [];
82
+ const aPages = ([] as Control[]).concat(aBeginColumnPages, aMidColumnPages, aEndColumnPages);
83
+
84
+ aPages.forEach(function (oPage: any) {
85
+ const oTargetView = _getViewFromContainer(oPage);
86
+
87
+ const oController = oTargetView && oTargetView.getController();
88
+ if (oController && oController.viewState && oController.viewState.onSuspend) {
89
+ return oController.viewState.onSuspend();
90
+ }
91
+ });
92
+ }
93
+ })
94
+ )
95
+ viewState!: ViewState;
96
+
97
+ private _oRouterProxy!: RouterProxy;
98
+ private sCurrentRouteName!: string;
99
+ private sCurrentArguments?: any;
100
+ private sPreviousLayout!: string;
101
+ private SQUERYKEYNAME!: string;
102
+ private _oFCLConfig: any;
103
+ private oAdditionalViewForNavRowsComputation: any;
104
+ private _oTargetsAggregation: any;
105
+ private _oTargetsFromRoutePattern: any;
106
+ private aMessagePages?: any[];
107
+ /**
108
+ * @private
109
+ * @name sap.fe.templates.RootContainer.controller.Fcl.getMetadata
110
+ * @function
111
+ */
112
+
113
+ onInit() {
114
+ super.onInit();
115
+
116
+ this._internalInit();
117
+ }
118
+
119
+ attachRouteMatchers() {
120
+ this.getRouter().attachBeforeRouteMatched(this._getViewForNavigatedRowsComputation, this);
121
+ super.attachRouteMatchers();
122
+ this._internalInit();
123
+
124
+ this.getRouter().attachBeforeRouteMatched(this.onBeforeRouteMatched, this);
125
+ this.getRouter().attachRouteMatched(this.onRouteMatched, this);
126
+ this.getFclControl().attachStateChange(this._saveLayout, this);
127
+ }
128
+
129
+ _internalInit() {
130
+ if (this._oRouterProxy) {
131
+ return; // Already initialized
132
+ }
133
+
134
+ this.sCurrentRouteName = "";
135
+ this.sCurrentArguments = {};
136
+ this.SQUERYKEYNAME = "?query";
137
+
138
+ const oAppComponent = this.getAppComponent();
139
+
140
+ this._oRouterProxy = oAppComponent.getRouterProxy();
141
+
142
+ // Get FCL configuration in the manifest
143
+ this._oFCLConfig = { maxColumnsCount: 3 };
144
+ const oRoutingConfig = (oAppComponent.getManifest() as any)["sap.ui5"].routing;
145
+ if (oRoutingConfig && oRoutingConfig.config) {
146
+ if (oRoutingConfig.config.flexibleColumnLayout) {
147
+ const oFCLManifestConfig = oRoutingConfig.config.flexibleColumnLayout;
148
+
149
+ // Default layout for 2 columns
150
+ if (oFCLManifestConfig.defaultTwoColumnLayoutType) {
151
+ this._oFCLConfig.defaultTwoColumnLayoutType = oFCLManifestConfig.defaultTwoColumnLayoutType;
152
+ }
153
+
154
+ // Default layout for 3 columns
155
+ if (oFCLManifestConfig.defaultThreeColumnLayoutType) {
156
+ this._oFCLConfig.defaultThreeColumnLayoutType = oFCLManifestConfig.defaultThreeColumnLayoutType;
157
+ }
158
+
159
+ // Limit FCL to 2 columns ?
160
+ if (oFCLManifestConfig.limitFCLToTwoColumns === true) {
161
+ this._oFCLConfig.maxColumnsCount = 2;
162
+ }
163
+ }
164
+ if (oRoutingConfig.config.controlAggregation) {
165
+ this._oFCLConfig.defaultControlAggregation = oRoutingConfig.config.controlAggregation;
166
+ }
167
+ }
168
+
169
+ this._initializeTargetAggregation(oAppComponent);
170
+ this._initializeRoutesInformation(oAppComponent);
171
+ }
172
+
173
+ getFclControl() {
174
+ return this.getView().getContent()[0] as FlexibleColumnLayout;
175
+ }
176
+
177
+ _saveLayout(oEvent: any) {
178
+ this.sPreviousLayout = oEvent.getParameters().layout;
179
+ }
180
+
181
+ /**
182
+ * Get the additionnal view (on top of the visible views), to be able to compute the latest table navigated rows of the most right visible view after a nav back or column fullscreen.
183
+ *
184
+ * @function
185
+ * @name sap.fe.templates.RootContainer.controller.Fcl.controller#_getRightMostViewBeforeRouteMatched
186
+ * @memberof sap.fe.templates.RootContainer.controller.Fcl.controller
187
+ *
188
+ */
189
+
190
+ _getViewForNavigatedRowsComputation() {
191
+ const aAllVisibleViewsBeforeRouteMatched = this._getAllVisibleViews(this.sPreviousLayout);
192
+ const oRightMostViewBeforeRouteMatched = aAllVisibleViewsBeforeRouteMatched[aAllVisibleViewsBeforeRouteMatched.length - 1];
193
+ let oRightMostView;
194
+ this.getRouter().attachEventOnce("routeMatched", (oEvent: any) => {
195
+ oRightMostView = _getViewFromContainer(oEvent.getParameter("views")[oEvent.getParameter("views").length - 1]);
196
+ if (oRightMostViewBeforeRouteMatched) {
197
+ // Navigation forward from L2 to view level L3 (FullScreenLayout):
198
+ if (oRightMostView.getViewData() && oRightMostView.getViewData().viewLevel === this._oFCLConfig.maxColumnsCount) {
199
+ this.oAdditionalViewForNavRowsComputation = oRightMostView;
200
+ }
201
+ // Navigations backward from L3 down to L2, L1, L0 (ThreeColumn layout):
202
+ if (
203
+ oRightMostView.getViewData() &&
204
+ oRightMostViewBeforeRouteMatched.getViewData() &&
205
+ oRightMostViewBeforeRouteMatched.getViewData().viewLevel < this._oFCLConfig.maxColumnsCount &&
206
+ oRightMostViewBeforeRouteMatched.getViewData() &&
207
+ oRightMostViewBeforeRouteMatched.getViewData().viewLevel > oRightMostView.getViewData().viewLevel &&
208
+ oRightMostView !== oRightMostViewBeforeRouteMatched
209
+ ) {
210
+ this.oAdditionalViewForNavRowsComputation = oRightMostViewBeforeRouteMatched;
211
+ }
212
+ }
213
+ });
214
+ }
215
+
216
+ getViewForNavigatedRowsComputation() {
217
+ return this.oAdditionalViewForNavRowsComputation;
218
+ }
219
+
220
+ onExit() {
221
+ this.getRouter().detachRouteMatched(this.onRouteMatched, this);
222
+ this.getRouter().detachBeforeRouteMatched(this.onBeforeRouteMatched, this);
223
+ this.getFclControl().detachStateChange(this.onStateChanged, this);
224
+ this.getFclControl().detachAfterEndColumnNavigate(this.onStateChanged, this);
225
+ this._oTargetsAggregation = null;
226
+ this._oTargetsFromRoutePattern = null;
227
+
228
+ BaseController.prototype.onExit.bind(this)();
229
+ }
230
+
231
+ /**
232
+ * Check if the FCL component is enabled.
233
+ *
234
+ * @function
235
+ * @name sap.fe.templates.RootContainer.controller.Fcl.controller#isFclEnabled
236
+ * @memberof sap.fe.templates.RootContainer.controller.Fcl.controller
237
+ * @returns {boolean} `true` since we are in FCL scenario
238
+ *
239
+ * @ui5-restricted
240
+ * @final
241
+ */
242
+ isFclEnabled() {
243
+ return true;
244
+ }
245
+
246
+ displayMessagePage(sErrorMessage: any, mParameters: any): Promise<boolean> {
247
+ const oFCLControl = this.getFclControl();
248
+
249
+ if (this._oFCLConfig && mParameters.FCLLevel >= this._oFCLConfig.maxColumnsCount) {
250
+ mParameters.FCLLevel = this._oFCLConfig.maxColumnsCount - 1;
251
+ }
252
+
253
+ if (!this.aMessagePages) {
254
+ this.aMessagePages = [null, null, null];
255
+ }
256
+ let oMessagePage = this.aMessagePages[mParameters.FCLLevel];
257
+ if (!oMessagePage) {
258
+ oMessagePage = new MessagePage({
259
+ showHeader: false,
260
+ icon: "sap-icon://message-error"
261
+ });
262
+ this.aMessagePages[mParameters.FCLLevel] = oMessagePage;
263
+
264
+ switch (mParameters.FCLLevel) {
265
+ case 0:
266
+ oFCLControl.addBeginColumnPage(oMessagePage);
267
+ break;
268
+
269
+ case 1:
270
+ oFCLControl.addMidColumnPage(oMessagePage);
271
+ break;
272
+
273
+ default:
274
+ oFCLControl.addEndColumnPage(oMessagePage);
275
+ }
276
+ }
277
+
278
+ oMessagePage.setText(sErrorMessage);
279
+
280
+ if (mParameters.technicalMessage) {
281
+ oMessagePage.setCustomDescription(
282
+ new Link({
283
+ text: mParameters.description || mParameters.technicalMessage,
284
+ press: function () {
285
+ MessageBox.show(mParameters.technicalMessage, {
286
+ icon: Icon.ERROR,
287
+ title: mParameters.title,
288
+ actions: [Action.OK],
289
+ defaultAction: Action.OK,
290
+ details: mParameters.technicalDetails || "",
291
+ contentWidth: "60%"
292
+ } as any);
293
+ }
294
+ })
295
+ );
296
+ } else {
297
+ oMessagePage.setDescription(mParameters.description || "");
298
+ }
299
+
300
+ (oFCLControl as any).to(oMessagePage.getId());
301
+ return Promise.resolve(true);
302
+ }
303
+
304
+ /**
305
+ * Initialize the object _oTargetsAggregation that defines for each route the relevant aggregation and pattern.
306
+ *
307
+ * @name sap.fe.templates.RootContainer.controller.Fcl.controller#_initializeTargetAggregation
308
+ * @memberof sap.fe.templates.RootContainer.controller.Fcl.controller
309
+ * @function
310
+ * @param {object} [oAppComponent] Reference to the AppComponent
311
+ */
312
+ _initializeTargetAggregation(oAppComponent: AppComponent) {
313
+ const oManifest = oAppComponent.getManifest() as any,
314
+ oTargets = oManifest["sap.ui5"].routing ? oManifest["sap.ui5"].routing.targets : null;
315
+
316
+ this._oTargetsAggregation = {};
317
+
318
+ if (oTargets) {
319
+ Object.keys(oTargets).forEach((sTargetName: string) => {
320
+ const oTarget = oTargets[sTargetName];
321
+ if (oTarget.controlAggregation) {
322
+ this._oTargetsAggregation[sTargetName] = {
323
+ aggregation: oTarget.controlAggregation,
324
+ pattern: oTarget.contextPattern
325
+ };
326
+ } else {
327
+ this._oTargetsAggregation[sTargetName] = {
328
+ aggregation: "page",
329
+ pattern: null
330
+ };
331
+ }
332
+ });
333
+ }
334
+ }
335
+
336
+ /**
337
+ * Initializes the mapping between a route (identifed as its pattern) and the corresponding targets
338
+ *
339
+ * @name sap.fe.templates.RootContainer.controller.Fcl.controller#_initializeRoutesInformation
340
+ * @memberof sap.fe.templates.RootContainer.controller.Fcl.controller
341
+ * @function
342
+ * @param oAppComponent ref to the AppComponent
343
+ */
344
+
345
+ _initializeRoutesInformation(oAppComponent: AppComponent) {
346
+ const oManifest = oAppComponent.getManifest() as any,
347
+ aRoutes = oManifest["sap.ui5"].routing ? oManifest["sap.ui5"].routing.routes : null;
348
+
349
+ this._oTargetsFromRoutePattern = {};
350
+
351
+ if (aRoutes) {
352
+ aRoutes.forEach((route: any) => {
353
+ this._oTargetsFromRoutePattern[route.pattern] = route.target;
354
+ });
355
+ }
356
+ }
357
+
358
+ getCurrentArgument() {
359
+ return this.sCurrentArguments;
360
+ }
361
+
362
+ getCurrentRouteName() {
363
+ return this.sCurrentRouteName;
364
+ }
365
+
366
+ /**
367
+ * Get FE FCL constant.
368
+ *
369
+ * @memberof sap.fe.templates.RootContainer.controller.Fcl.controller
370
+ * @returns {object}
371
+ */
372
+ getConstants() {
373
+ return CONSTANTS;
374
+ }
375
+
376
+ /**
377
+ * Getter for oTargetsAggregation array.
378
+ *
379
+ * @name sap.fe.templates.RootContainer.controller.Fcl.controller#getTargetAggregation
380
+ * @memberof sap.fe.templates.RootContainer.controller.Fcl.controller
381
+ * @function
382
+ * @returns {Array} The _oTargetsAggregation array
383
+ *
384
+ * @ui5-restricted
385
+ */
386
+ getTargetAggregation() {
387
+ return this._oTargetsAggregation;
388
+ }
389
+
390
+ /**
391
+ * Function triggered by the router RouteMatched event.
392
+ *
393
+ * @name sap.fe.templates.RootContainer.controller.Fcl.controller#onRouteMatched
394
+ * @memberof sap.fe.templates.RootContainer.controller.Fcl.controller
395
+ * @param {*} oEvent
396
+ */
397
+ onRouteMatched(oEvent: any) {
398
+ const sRouteName = oEvent.getParameter("name");
399
+
400
+ // Save the current/previous routes and arguments
401
+ this.sCurrentRouteName = sRouteName;
402
+ this.sCurrentArguments = oEvent.getParameter("arguments");
403
+ }
404
+
405
+ /**
406
+ * This function is triggering the table scroll to the navigated row after each layout change.
407
+ *
408
+ * @name sap.fe.templates.RootContainer.controller.Fcl.controller#scrollToLastSelectedItem
409
+ * @memberof sap.fe.templates.RootContainer.controller.Fcl.controller
410
+ */
411
+
412
+ _scrollTablesToLastNavigatedItems() {
413
+ const aViews = this._getAllVisibleViews();
414
+ //The scrolls are triggered only if the layout is with several columns or when switching the mostRight column in full screen
415
+ if (aViews.length > 1 || aViews[0].getViewData().viewLevel < this._oFCLConfig.maxColumnsCount) {
416
+ let sCurrentViewPath;
417
+ const oAdditionalView = this.getViewForNavigatedRowsComputation();
418
+ if (oAdditionalView && aViews.indexOf(oAdditionalView) === -1) {
419
+ aViews.push(oAdditionalView);
420
+ }
421
+ for (let index = aViews.length - 1; index > 0; index--) {
422
+ const oView = aViews[index],
423
+ oPreviousView = aViews[index - 1];
424
+ if (oView.getBindingContext()) {
425
+ sCurrentViewPath = oView.getBindingContext().getPath();
426
+ oPreviousView.getController()._scrollTablesToRow(sCurrentViewPath);
427
+ }
428
+ }
429
+ }
430
+ }
431
+
432
+ /**
433
+ * Function triggered by the FCL StateChanged event.
434
+ *
435
+ * @name sap.fe.templates.RootContainer.controller.Fcl.controller#onStateChanged
436
+ * @memberof sap.fe.templates.RootContainer.controller.Fcl.controller
437
+ * @param {*} oEvent
438
+ */
439
+ onStateChanged(oEvent: any) {
440
+ const bIsNavigationArrow = oEvent.getParameter("isNavigationArrow");
441
+ if (this.sCurrentArguments !== undefined) {
442
+ if (!this.sCurrentArguments[this.SQUERYKEYNAME]) {
443
+ this.sCurrentArguments[this.SQUERYKEYNAME] = {};
444
+ }
445
+ this.sCurrentArguments[this.SQUERYKEYNAME].layout = oEvent.getParameter("layout");
446
+ }
447
+ this._forceModelContextChangeOnBreadCrumbs(oEvent);
448
+
449
+ // Replace the URL with the new layout if a navigation arrow was used
450
+ if (bIsNavigationArrow) {
451
+ this._oRouterProxy.navTo(this.sCurrentRouteName, this.sCurrentArguments);
452
+ }
453
+ }
454
+
455
+ /**
456
+ * Function to fire ModelContextChange event on all breadcrumbs ( on each ObjectPages).
457
+ *
458
+ * @name sap.fe.templates.RootContainer.controller.Fcl.controller#_forceModelContextChangeOnBreadCrumbs
459
+ * @memberof sap.fe.templates.RootContainer.controller.Fcl.controller
460
+ * @param {*} oEvent
461
+ */
462
+ _forceModelContextChangeOnBreadCrumbs(oEvent: any) {
463
+ //force modelcontextchange on ObjectPages to refresh the breadcrumbs link hrefs
464
+ const oFcl = oEvent.getSource();
465
+ let oPages: any[] = [];
466
+ oPages = oPages.concat(oFcl.getBeginColumnPages()).concat(oFcl.getMidColumnPages()).concat(oFcl.getEndColumnPages());
467
+ oPages.forEach(function (oPage: any) {
468
+ const oView = _getViewFromContainer(oPage);
469
+ const oBreadCrumbs = oView.byId && oView.byId("breadcrumbs");
470
+ if (oBreadCrumbs) {
471
+ oBreadCrumbs.fireModelContextChange();
472
+ }
473
+ });
474
+ }
475
+
476
+ /**
477
+ * Function triggered to update the Share button Visibility.
478
+ *
479
+ * @memberof sap.fe.templates.RootContainer.controller.Fcl.controller
480
+ * @param {string} viewColumn Name of the current column ("beginColumn", "midColumn", "endColumn")
481
+ * @param {string} sLayout The current layout used by the FCL
482
+ * @returns {boolean}
483
+ */
484
+ _updateShareButtonVisibility(viewColumn: string, sLayout: string) {
485
+ let bShowShareIcon;
486
+ switch (sLayout) {
487
+ case "OneColumn":
488
+ bShowShareIcon = viewColumn === "beginColumn";
489
+ break;
490
+ case "MidColumnFullScreen":
491
+ case "ThreeColumnsBeginExpandedEndHidden":
492
+ case "ThreeColumnsMidExpandedEndHidden":
493
+ case "TwoColumnsBeginExpanded":
494
+ case "TwoColumnsMidExpanded":
495
+ bShowShareIcon = viewColumn === "midColumn";
496
+ break;
497
+ case "EndColumnFullScreen":
498
+ case "ThreeColumnsEndExpanded":
499
+ case "ThreeColumnsMidExpanded":
500
+ bShowShareIcon = viewColumn === "endColumn";
501
+ break;
502
+ default:
503
+ bShowShareIcon = false;
504
+ }
505
+ return bShowShareIcon;
506
+ }
507
+
508
+ updateUIStateForView(oView: any, FCLLevel: any) {
509
+ const oUIState = this.getHelper().getCurrentUIState() as any,
510
+ oFclColName = ["beginColumn", "midColumn", "endColumn"],
511
+ sLayout = this.getFclControl().getLayout();
512
+ let viewColumn;
513
+
514
+ if (!oView.getModel("fclhelper")) {
515
+ oView.setModel(this._createHelperModel(), "fclhelper");
516
+ }
517
+ if (FCLLevel >= this._oFCLConfig.maxColumnsCount) {
518
+ // The view is on a level > max number of columns. It's always fullscreen without close/exit buttons
519
+ viewColumn = oFclColName[this._oFCLConfig.maxColumnsCount - 1];
520
+ oUIState.actionButtonsInfo.midColumn.fullScreen = null;
521
+ oUIState.actionButtonsInfo.midColumn.exitFullScreen = null;
522
+ oUIState.actionButtonsInfo.midColumn.closeColumn = null;
523
+ oUIState.actionButtonsInfo.endColumn.exitFullScreen = null;
524
+ oUIState.actionButtonsInfo.endColumn.fullScreen = null;
525
+ oUIState.actionButtonsInfo.endColumn.closeColumn = null;
526
+ } else {
527
+ viewColumn = oFclColName[FCLLevel];
528
+ }
529
+
530
+ if (
531
+ FCLLevel >= this._oFCLConfig.maxColumnsCount ||
532
+ sLayout === "EndColumnFullScreen" ||
533
+ sLayout === "MidColumnFullScreen" ||
534
+ sLayout === "OneColumn"
535
+ ) {
536
+ oView.getModel("fclhelper").setProperty("/breadCrumbIsVisible", true);
537
+ } else {
538
+ oView.getModel("fclhelper").setProperty("/breadCrumbIsVisible", false);
539
+ }
540
+ // Unfortunately, the FCLHelper doesn't provide actionButton values for the first column
541
+ // so we have to add this info manually
542
+ oUIState.actionButtonsInfo.beginColumn = { fullScreen: null, exitFullScreen: null, closeColumn: null };
543
+
544
+ const oActionButtonInfos = Object.assign({}, oUIState.actionButtonsInfo[viewColumn]);
545
+ oActionButtonInfos.switchVisible = oActionButtonInfos.fullScreen !== null || oActionButtonInfos.exitFullScreen !== null;
546
+ oActionButtonInfos.switchIcon = oActionButtonInfos.fullScreen !== null ? "sap-icon://full-screen" : "sap-icon://exit-full-screen";
547
+ oActionButtonInfos.isFullScreen = oActionButtonInfos.fullScreen === null;
548
+
549
+ oView.getModel("fclhelper").setProperty("/actionButtonsInfo", oActionButtonInfos);
550
+
551
+ oView.getModel("fclhelper").setProperty("/showShareIcon", this._updateShareButtonVisibility(viewColumn, sLayout));
552
+ }
553
+
554
+ /**
555
+ * Function triggered by the router BeforeRouteMatched event.
556
+ *
557
+ * @name sap.fe.templates.RootContainer.controller.Fcl.controller#onBeforeRouteMatched
558
+ * @memberof sap.fe.templates.RootContainer.controller.Fcl.controller
559
+ * @param {*} oEvent
560
+ */
561
+ onBeforeRouteMatched(oEvent: any) {
562
+ if (oEvent) {
563
+ const oQueryParams = oEvent.getParameters().arguments[this.SQUERYKEYNAME];
564
+ let sLayout = oQueryParams ? oQueryParams.layout : null;
565
+
566
+ // If there is no layout parameter, query for the default level 0 layout (normally OneColumn)
567
+ if (!sLayout) {
568
+ const oNextUIState = this.getHelper().getNextUIState(0);
569
+ sLayout = oNextUIState.layout;
570
+ }
571
+
572
+ // Check if the layout if compatible with the number of targets
573
+ // This should always be the case for normal navigation, just needed in case
574
+ // the URL has been manually modified
575
+ const aTargets = oEvent.getParameter("config").target;
576
+ sLayout = this._correctLayoutForTargets(sLayout, aTargets);
577
+
578
+ // Update the layout of the FlexibleColumnLayout
579
+ if (sLayout) {
580
+ this.getFclControl().setLayout(sLayout);
581
+ }
582
+ }
583
+ }
584
+
585
+ /**
586
+ * Helper for the FCL Component.
587
+ *
588
+ * @name sap.fe.templates.RootContainer.controller.Fcl.controller#getHelper
589
+ * @memberof sap.fe.templates.RootContainer.controller.Fcl.controller
590
+ * @returns {object} Instance of a semantic helper
591
+ */
592
+ getHelper() {
593
+ return FlexibleColumnLayoutSemanticHelper.getInstanceFor(this.getFclControl(), this._oFCLConfig);
594
+ }
595
+
596
+ /**
597
+ * Calculates the FCL layout for a given FCL level and a target hash.
598
+ *
599
+ * @param iNextFCLLevel FCL level to be navigated to
600
+ * @param sHash The hash to be navigated to
601
+ * @param sProposedLayout The proposed layout
602
+ * @param keepCurrentLayout True if we want to keep the current layout if possible
603
+ * @returns {object}
604
+ */
605
+ calculateLayout(iNextFCLLevel: number, sHash: string, sProposedLayout: string | undefined, keepCurrentLayout: boolean | undefined) {
606
+ // First, ask the FCL helper to calculate the layout if nothing is proposed
607
+ if (!sProposedLayout) {
608
+ sProposedLayout = keepCurrentLayout ? this.getFclControl().getLayout() : this.getHelper().getNextUIState(iNextFCLLevel).layout;
609
+ }
610
+
611
+ // Then change this value if necessary, based on the number of targets
612
+ const oRoute = (this.getRouter() as any).getRouteByHash(sHash + "?layout=" + sProposedLayout);
613
+ const aTargets = this._oTargetsFromRoutePattern[oRoute.getPattern()];
614
+
615
+ return this._correctLayoutForTargets(sProposedLayout, aTargets);
616
+ }
617
+
618
+ /**
619
+ * Checks whether a given FCL layout is compatible with an array of targets.
620
+ *
621
+ * @param {*} sProposedLayout Proposed value for the FCL layout
622
+ * @param {*} aTargets Array of target names used for checking
623
+ * @returns {string} The corrected layout
624
+ */
625
+ _correctLayoutForTargets(sProposedLayout: any, aTargets: any) {
626
+ const allAllowedLayouts: any = {
627
+ "2": ["TwoColumnsMidExpanded", "TwoColumnsBeginExpanded", "MidColumnFullScreen"],
628
+ "3": [
629
+ "ThreeColumnsMidExpanded",
630
+ "ThreeColumnsEndExpanded",
631
+ "ThreeColumnsMidExpandedEndHidden",
632
+ "ThreeColumnsBeginExpandedEndHidden",
633
+ "MidColumnFullScreen",
634
+ "EndColumnFullScreen"
635
+ ]
636
+ };
637
+
638
+ if (aTargets && !Array.isArray(aTargets)) {
639
+ // To support single target as a string in the manifest
640
+ aTargets = [aTargets];
641
+ }
642
+
643
+ if (!aTargets) {
644
+ // Defensive, just in case...
645
+ return sProposedLayout;
646
+ } else if (aTargets.length > 1) {
647
+ // More than 1 target: just simply check from the allowed values
648
+ const aLayouts = allAllowedLayouts[aTargets.length];
649
+ if (aLayouts.indexOf(sProposedLayout) < 0) {
650
+ // The proposed layout isn't compatible with the number of columns
651
+ // --> Ask the helper for the default layout for the number of columns
652
+ sProposedLayout = aLayouts[0]; //this.getHelper().getNextUIState(aTargets.length - 1).layout;
653
+ }
654
+ } else {
655
+ // Only one target
656
+ const sTargetAggregation = this.getTargetAggregation()[aTargets[0]].aggregation || this._oFCLConfig.defaultControlAggregation;
657
+ switch (sTargetAggregation) {
658
+ case "beginColumnPages":
659
+ sProposedLayout = "OneColumn";
660
+ break;
661
+ case "midColumnPages":
662
+ sProposedLayout = "MidColumnFullScreen";
663
+ break;
664
+ case "endColumnPages":
665
+ sProposedLayout = "EndColumnFullScreen";
666
+ break;
667
+ }
668
+ }
669
+
670
+ return sProposedLayout;
671
+ }
672
+
673
+ /**
674
+ * get all visible views in the FCL component.
675
+ * sLayout optional parameter is very specific as part of the calculation of the latest navigated row
676
+ *
677
+ * @param {*} sLayout Layout that was applied just before the current navigation
678
+ * @returns {Array} return views
679
+ */
680
+
681
+ _getAllVisibleViews(sLayout?: any) {
682
+ const aViews = [];
683
+ sLayout = !!sLayout ? sLayout : this.getFclControl().getLayout();
684
+ switch (sLayout) {
685
+ case LayoutType.EndColumnFullScreen:
686
+ if (this.getFclControl().getCurrentEndColumnPage()) {
687
+ aViews.push(_getViewFromContainer(this.getFclControl().getCurrentEndColumnPage()));
688
+ }
689
+ break;
690
+
691
+ case LayoutType.MidColumnFullScreen:
692
+ if (this.getFclControl().getCurrentMidColumnPage()) {
693
+ aViews.push(_getViewFromContainer(this.getFclControl().getCurrentMidColumnPage()));
694
+ }
695
+ break;
696
+
697
+ case LayoutType.OneColumn:
698
+ if (this.getFclControl().getCurrentBeginColumnPage()) {
699
+ aViews.push(_getViewFromContainer(this.getFclControl().getCurrentBeginColumnPage()));
700
+ }
701
+ break;
702
+
703
+ case LayoutType.ThreeColumnsEndExpanded:
704
+ case LayoutType.ThreeColumnsMidExpanded:
705
+ if (this.getFclControl().getCurrentBeginColumnPage()) {
706
+ aViews.push(_getViewFromContainer(this.getFclControl().getCurrentBeginColumnPage()));
707
+ }
708
+ if (this.getFclControl().getCurrentMidColumnPage()) {
709
+ aViews.push(_getViewFromContainer(this.getFclControl().getCurrentMidColumnPage()));
710
+ }
711
+ if (this.getFclControl().getCurrentEndColumnPage()) {
712
+ aViews.push(_getViewFromContainer(this.getFclControl().getCurrentEndColumnPage()));
713
+ }
714
+ break;
715
+
716
+ case LayoutType.TwoColumnsBeginExpanded:
717
+ case LayoutType.TwoColumnsMidExpanded:
718
+ case LayoutType.ThreeColumnsMidExpandedEndHidden:
719
+ case LayoutType.ThreeColumnsBeginExpandedEndHidden:
720
+ if (this.getFclControl().getCurrentBeginColumnPage()) {
721
+ aViews.push(_getViewFromContainer(this.getFclControl().getCurrentBeginColumnPage()));
722
+ }
723
+ if (this.getFclControl().getCurrentMidColumnPage()) {
724
+ aViews.push(_getViewFromContainer(this.getFclControl().getCurrentMidColumnPage()));
725
+ }
726
+ break;
727
+
728
+ default:
729
+ Log.error("Unhandled switch case for " + this.getFclControl().getLayout());
730
+ }
731
+
732
+ return aViews;
733
+ }
734
+ _getAllViews(sLayout?: any) {
735
+ const aViews = [];
736
+ sLayout = sLayout ? sLayout : this.getFclControl().getLayout();
737
+ switch (sLayout) {
738
+ case LayoutType.OneColumn:
739
+ if (this.getFclControl().getCurrentBeginColumnPage()) {
740
+ aViews.push(_getViewFromContainer(this.getFclControl().getCurrentBeginColumnPage()));
741
+ }
742
+ break;
743
+ case LayoutType.ThreeColumnsEndExpanded:
744
+ case LayoutType.ThreeColumnsMidExpanded:
745
+ case LayoutType.ThreeColumnsMidExpandedEndHidden:
746
+ case LayoutType.ThreeColumnsBeginExpandedEndHidden:
747
+ case LayoutType.EndColumnFullScreen:
748
+ if (this.getFclControl().getCurrentBeginColumnPage()) {
749
+ aViews.push(_getViewFromContainer(this.getFclControl().getCurrentBeginColumnPage()));
750
+ }
751
+ if (this.getFclControl().getCurrentMidColumnPage()) {
752
+ aViews.push(_getViewFromContainer(this.getFclControl().getCurrentMidColumnPage()));
753
+ }
754
+ if (this.getFclControl().getCurrentEndColumnPage()) {
755
+ aViews.push(_getViewFromContainer(this.getFclControl().getCurrentEndColumnPage()));
756
+ }
757
+ break;
758
+
759
+ case LayoutType.TwoColumnsBeginExpanded:
760
+ case LayoutType.TwoColumnsMidExpanded:
761
+ if (this.getFclControl().getCurrentBeginColumnPage()) {
762
+ aViews.push(_getViewFromContainer(this.getFclControl().getCurrentBeginColumnPage()));
763
+ }
764
+ if (this.getFclControl().getCurrentMidColumnPage()) {
765
+ aViews.push(_getViewFromContainer(this.getFclControl().getCurrentMidColumnPage()));
766
+ }
767
+ break;
768
+
769
+ case LayoutType.MidColumnFullScreen:
770
+ // In this case we need to determine if this mid column fullscreen comes from a 2 or a 3 column layout
771
+ const sLayoutWhenExitFullScreen = (this.getHelper().getCurrentUIState() as any).actionButtonsInfo.midColumn.exitFullScreen;
772
+ if (this.getFclControl().getCurrentBeginColumnPage()) {
773
+ aViews.push(_getViewFromContainer(this.getFclControl().getCurrentBeginColumnPage()));
774
+ }
775
+ if (this.getFclControl().getCurrentMidColumnPage()) {
776
+ aViews.push(_getViewFromContainer(this.getFclControl().getCurrentMidColumnPage()));
777
+ }
778
+ if (sLayoutWhenExitFullScreen.indexOf("ThreeColumn") >= 0) {
779
+ // We come from a 3 column layout
780
+ if (this.getFclControl().getCurrentEndColumnPage()) {
781
+ aViews.push(_getViewFromContainer(this.getFclControl().getCurrentEndColumnPage()));
782
+ }
783
+ }
784
+ break;
785
+
786
+ default:
787
+ Log.error("Unhandled switch case for " + this.getFclControl().getLayout());
788
+ }
789
+ return aViews;
790
+ }
791
+
792
+ onContainerReady() {
793
+ // Restore views if neccessary.
794
+ const aViews = this._getAllVisibleViews();
795
+ const aRestorePromises: any[] = [];
796
+ aViews.reduce(function (aPromises: any, oTargetView: any) {
797
+ aPromises.push(KeepAliveHelper.restoreView(oTargetView));
798
+ return aPromises;
799
+ }, aRestorePromises);
800
+ return Promise.all(aRestorePromises);
801
+ }
802
+
803
+ getRightmostContext(): Context | undefined {
804
+ const oView = this.getRightmostView();
805
+ return oView && oView.getBindingContext();
806
+ }
807
+
808
+ getRightmostView() {
809
+ return this._getAllViews().pop();
810
+ }
811
+
812
+ isContextUsedInPages(oContext: Context): boolean {
813
+ if (!this.getFclControl()) {
814
+ return false;
815
+ }
816
+ const aAllVisibleViews = this._getAllViews();
817
+
818
+ for (let i = 0; i < aAllVisibleViews.length; i++) {
819
+ const oView = aAllVisibleViews[i];
820
+ if (!oView) {
821
+ // A view has been destroyed --> app is currently being destroyed
822
+ return false;
823
+ }
824
+ if (oView.getBindingContext() === oContext) {
825
+ return true;
826
+ }
827
+ }
828
+
829
+ return false;
830
+ }
831
+ }
832
+
833
+ export default FclController;