@sapui5/sap.fe.templates 1.100.0 → 1.101.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 (132) 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 +123 -112
  14. package/src/sap/fe/templates/ListReport/ExtensionAPI.ts +100 -0
  15. package/src/sap/fe/templates/ListReport/ListReport.view.xml +2 -1
  16. package/src/sap/fe/templates/ListReport/ListReportController.controller.js +1111 -1081
  17. package/src/sap/fe/templates/ListReport/ListReportController.controller.ts +1009 -0
  18. package/src/sap/fe/templates/ListReport/overrides/IntentBasedNavigation.js +54 -53
  19. package/src/sap/fe/templates/ListReport/overrides/IntentBasedNavigation.ts +55 -0
  20. package/src/sap/fe/templates/ListReport/overrides/Share.js +134 -137
  21. package/src/sap/fe/templates/ListReport/overrides/Share.ts +134 -0
  22. package/src/sap/fe/templates/ListReport/overrides/ViewState.js +443 -428
  23. package/src/sap/fe/templates/ListReport/overrides/ViewState.ts +413 -0
  24. package/src/sap/fe/templates/ListReport/view/fragments/CollectionVisualization.fragment.xml +25 -25
  25. package/src/sap/fe/templates/ListReport/view/fragments/MultipleMode.fragment.js +72 -0
  26. package/src/sap/fe/templates/ListReport/view/fragments/MultipleMode.fragment.ts +62 -0
  27. package/src/sap/fe/templates/ListReport/view/fragments/{MultipleMode.fragment.xml → MultipleModeOld.fragment.xml} +24 -23
  28. package/src/sap/fe/templates/ObjectPage/AnnotationHelper.js +478 -514
  29. package/src/sap/fe/templates/ObjectPage/AnnotationHelper.ts +511 -0
  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 +3 -9
  35. package/src/sap/fe/templates/ObjectPage/ObjectPageController.controller.js +1530 -1447
  36. package/src/sap/fe/templates/ObjectPage/ObjectPageController.controller.ts +1442 -0
  37. package/src/sap/fe/templates/ObjectPage/controls/StashableHBox.js +136 -101
  38. package/src/sap/fe/templates/ObjectPage/controls/StashableHBox.ts +84 -0
  39. package/src/sap/fe/templates/ObjectPage/controls/StashableVBox.js +24 -21
  40. package/src/sap/fe/templates/ObjectPage/controls/StashableVBox.ts +10 -0
  41. package/src/sap/fe/templates/ObjectPage/controls/SubSectionBlock.js +98 -53
  42. package/src/sap/fe/templates/ObjectPage/controls/SubSectionBlock.ts +50 -0
  43. package/src/sap/fe/templates/ObjectPage/designtime/FlexBox.designtime.js +20 -19
  44. package/src/sap/fe/templates/ObjectPage/designtime/FlexBox.designtime.ts +15 -0
  45. package/src/sap/fe/templates/ObjectPage/designtime/StashableHBox.designtime.js +50 -47
  46. package/src/sap/fe/templates/ObjectPage/designtime/StashableHBox.designtime.ts +47 -0
  47. package/src/sap/fe/templates/ObjectPage/designtime/StashableVBox.designtime.js +34 -34
  48. package/src/sap/fe/templates/ObjectPage/designtime/StashableVBox.designtime.ts +34 -0
  49. package/src/sap/fe/templates/ObjectPage/flexibility/StashableHBox.flexibility.js +15 -15
  50. package/src/sap/fe/templates/ObjectPage/flexibility/StashableHBox.flexibility.ts +13 -0
  51. package/src/sap/fe/templates/ObjectPage/flexibility/StashableVBox.flexibility.js +11 -11
  52. package/src/sap/fe/templates/ObjectPage/flexibility/StashableVBox.flexibility.ts +7 -0
  53. package/src/sap/fe/templates/ObjectPage/overrides/IntentBasedNavigation.js +55 -52
  54. package/src/sap/fe/templates/ObjectPage/overrides/IntentBasedNavigation.ts +57 -0
  55. package/src/sap/fe/templates/ObjectPage/overrides/InternalRouting.js +15 -17
  56. package/src/sap/fe/templates/ObjectPage/overrides/InternalRouting.ts +13 -0
  57. package/src/sap/fe/templates/ObjectPage/overrides/MessageHandler.js +13 -17
  58. package/src/sap/fe/templates/ObjectPage/overrides/MessageHandler.ts +14 -0
  59. package/src/sap/fe/templates/ObjectPage/overrides/Paginator.js +23 -21
  60. package/src/sap/fe/templates/ObjectPage/overrides/Paginator.ts +21 -0
  61. package/src/sap/fe/templates/ObjectPage/overrides/Share.js +310 -317
  62. package/src/sap/fe/templates/ObjectPage/overrides/Share.ts +316 -0
  63. package/src/sap/fe/templates/ObjectPage/overrides/ViewState.js +66 -57
  64. package/src/sap/fe/templates/ObjectPage/overrides/ViewState.ts +65 -0
  65. package/src/sap/fe/templates/ObjectPage/templating/ObjectPageTemplating.js +1 -1
  66. package/src/sap/fe/templates/ObjectPage/templating/ObjectPageTemplating.ts +1 -1
  67. package/src/sap/fe/templates/ObjectPage/view/fragments/Actions.fragment.xml +18 -24
  68. package/src/sap/fe/templates/ObjectPage/view/fragments/CollaborationDraft.fragment.xml +11 -9
  69. package/src/sap/fe/templates/ObjectPage/view/fragments/FooterContent.fragment.xml +4 -4
  70. package/src/sap/fe/templates/ObjectPage/view/fragments/SwitchDraftAndActiveObjectPopOver.fragment.xml +27 -0
  71. package/src/sap/fe/templates/RootContainer/controller/Fcl.controller.js +851 -817
  72. package/src/sap/fe/templates/RootContainer/controller/Fcl.controller.ts +795 -0
  73. package/src/sap/fe/templates/RootContainer/controller/NavContainer.controller.js +205 -189
  74. package/src/sap/fe/templates/RootContainer/controller/NavContainer.controller.ts +178 -0
  75. package/src/sap/fe/templates/RootContainer/controller/RootContainerBaseController.js +484 -459
  76. package/src/sap/fe/templates/RootContainer/controller/RootContainerBaseController.ts +438 -0
  77. package/src/sap/fe/templates/RootContainer/overrides/EditFlow.js +16 -14
  78. package/src/sap/fe/templates/RootContainer/overrides/EditFlow.ts +20 -0
  79. package/src/sap/fe/templates/TableScroller.js +45 -53
  80. package/src/sap/fe/templates/TableScroller.ts +48 -0
  81. package/src/sap/fe/templates/controls/Chart.fragment.xml +18 -17
  82. package/src/sap/fe/templates/controls/MacroChart.fragment.xml +22 -0
  83. package/src/sap/fe/templates/library.js +49 -63
  84. package/src/sap/fe/templates/library.ts +57 -0
  85. package/src/sap/fe/templates/messagebundle.properties +19 -7
  86. package/src/sap/fe/templates/messagebundle_ar.properties +6 -2
  87. package/src/sap/fe/templates/messagebundle_bg.properties +6 -2
  88. package/src/sap/fe/templates/messagebundle_ca.properties +6 -2
  89. package/src/sap/fe/templates/messagebundle_cs.properties +6 -2
  90. package/src/sap/fe/templates/messagebundle_cy.properties +6 -2
  91. package/src/sap/fe/templates/messagebundle_da.properties +6 -2
  92. package/src/sap/fe/templates/messagebundle_de.properties +6 -2
  93. package/src/sap/fe/templates/messagebundle_el.properties +6 -2
  94. package/src/sap/fe/templates/messagebundle_en.properties +6 -2
  95. package/src/sap/fe/templates/messagebundle_en_GB.properties +6 -2
  96. package/src/sap/fe/templates/messagebundle_en_US_saprigi.properties +6 -2
  97. package/src/sap/fe/templates/messagebundle_en_US_saptrc.properties +6 -2
  98. package/src/sap/fe/templates/messagebundle_es.properties +6 -2
  99. package/src/sap/fe/templates/messagebundle_es_MX.properties +6 -2
  100. package/src/sap/fe/templates/messagebundle_et.properties +6 -2
  101. package/src/sap/fe/templates/messagebundle_fi.properties +6 -2
  102. package/src/sap/fe/templates/messagebundle_fr.properties +6 -2
  103. package/src/sap/fe/templates/messagebundle_fr_CA.properties +6 -2
  104. package/src/sap/fe/templates/messagebundle_hi.properties +6 -2
  105. package/src/sap/fe/templates/messagebundle_hr.properties +6 -2
  106. package/src/sap/fe/templates/messagebundle_hu.properties +6 -2
  107. package/src/sap/fe/templates/messagebundle_id.properties +6 -2
  108. package/src/sap/fe/templates/messagebundle_it.properties +6 -2
  109. package/src/sap/fe/templates/messagebundle_iw.properties +6 -2
  110. package/src/sap/fe/templates/messagebundle_ja.properties +6 -2
  111. package/src/sap/fe/templates/messagebundle_kk.properties +6 -2
  112. package/src/sap/fe/templates/messagebundle_ko.properties +6 -2
  113. package/src/sap/fe/templates/messagebundle_lt.properties +6 -2
  114. package/src/sap/fe/templates/messagebundle_lv.properties +6 -2
  115. package/src/sap/fe/templates/messagebundle_ms.properties +6 -2
  116. package/src/sap/fe/templates/messagebundle_nl.properties +6 -2
  117. package/src/sap/fe/templates/messagebundle_no.properties +6 -2
  118. package/src/sap/fe/templates/messagebundle_pl.properties +6 -2
  119. package/src/sap/fe/templates/messagebundle_pt.properties +6 -2
  120. package/src/sap/fe/templates/messagebundle_pt_PT.properties +6 -2
  121. package/src/sap/fe/templates/messagebundle_ro.properties +6 -2
  122. package/src/sap/fe/templates/messagebundle_ru.properties +6 -2
  123. package/src/sap/fe/templates/messagebundle_sh.properties +6 -2
  124. package/src/sap/fe/templates/messagebundle_sk.properties +6 -2
  125. package/src/sap/fe/templates/messagebundle_sl.properties +6 -2
  126. package/src/sap/fe/templates/messagebundle_sv.properties +6 -2
  127. package/src/sap/fe/templates/messagebundle_th.properties +6 -2
  128. package/src/sap/fe/templates/messagebundle_tr.properties +6 -2
  129. package/src/sap/fe/templates/messagebundle_uk.properties +6 -2
  130. package/src/sap/fe/templates/messagebundle_vi.properties +6 -2
  131. package/src/sap/fe/templates/messagebundle_zh_CN.properties +6 -2
  132. package/src/sap/fe/templates/messagebundle_zh_TW.properties +6 -2
@@ -0,0 +1,1009 @@
1
+ import ResourceBundle from "sap/base/i18n/ResourceBundle";
2
+ import Log from "sap/base/Log";
3
+ import ObjectPath from "sap/base/util/ObjectPath";
4
+ import DynamicPage from "sap/f/DynamicPage";
5
+ import CommonUtils from "sap/fe/core/CommonUtils";
6
+ import EditFlow from "sap/fe/core/controllerextensions/EditFlow";
7
+ import IntentBasedNavigation from "sap/fe/core/controllerextensions/IntentBasedNavigation";
8
+ import InternalIntentBasedNavigation from "sap/fe/core/controllerextensions/InternalIntentBasedNavigation";
9
+ import InternalRouting from "sap/fe/core/controllerextensions/InternalRouting";
10
+ import KPIManagement from "sap/fe/core/controllerextensions/KPIManagement";
11
+ import MassEdit from "sap/fe/core/controllerextensions/MassEdit";
12
+ import Placeholder from "sap/fe/core/controllerextensions/Placeholder";
13
+ import Share from "sap/fe/core/controllerextensions/Share";
14
+ import SideEffects from "sap/fe/core/controllerextensions/SideEffects";
15
+ import ViewState from "sap/fe/core/controllerextensions/ViewState";
16
+ import FilterBar from "sap/fe/core/controls/FilterBar";
17
+ import {
18
+ defineUI5Class,
19
+ extensible,
20
+ finalExtension,
21
+ privateExtension,
22
+ publicExtension,
23
+ usingExtension
24
+ } from "sap/fe/core/helpers/ClassSupport";
25
+ import EditState from "sap/fe/core/helpers/EditState";
26
+ import { InternalModelContext } from "sap/fe/core/helpers/ModelHelper";
27
+ import CoreLibrary from "sap/fe/core/library";
28
+ import PageController from "sap/fe/core/PageController";
29
+ import ChartRuntime from "sap/fe/macros/chart/ChartRuntime";
30
+ import ChartUtils from "sap/fe/macros/chart/ChartUtils";
31
+ import CommonHelper from "sap/fe/macros/CommonHelper";
32
+ import DelegateUtil from "sap/fe/macros/DelegateUtil";
33
+ import FilterUtils from "sap/fe/macros/filter/FilterUtils";
34
+ import TableUtils from "sap/fe/macros/table/Utils";
35
+ import ExtensionAPI from "sap/fe/templates/ListReport/ExtensionAPI";
36
+ import EditFlowOverrides from "sap/fe/templates/RootContainer/overrides/EditFlow";
37
+ import TableScroller from "sap/fe/templates/TableScroller";
38
+ import IconTabBar from "sap/m/IconTabBar";
39
+ import SegmentedButton from "sap/m/SegmentedButton";
40
+ import Control from "sap/ui/core/Control";
41
+ import Core from "sap/ui/core/Core";
42
+ import OverrideExecution from "sap/ui/core/mvc/OverrideExecution";
43
+ import { system } from "sap/ui/Device";
44
+ import ControlPersonalizationWriteAPI from "sap/ui/fl/write/api/ControlPersonalizationWriteAPI";
45
+ import StateUtil from "sap/ui/mdc/p13n/StateUtil";
46
+ import Table from "sap/ui/mdc/Table";
47
+ import JSONModel from "sap/ui/model/json/JSONModel";
48
+ import ResourceModel from "sap/ui/model/resource/ResourceModel";
49
+ import hasher from "sap/ui/thirdparty/hasher";
50
+ import IntentBasedNavigationOverride from "./overrides/IntentBasedNavigation";
51
+ import ShareOverrides from "./overrides/Share";
52
+ import ViewStateOverrides from "./overrides/ViewState";
53
+
54
+ const TemplateContentView = CoreLibrary.TemplateContentView,
55
+ InitialLoadMode = CoreLibrary.InitialLoadMode;
56
+
57
+ @defineUI5Class("sap.fe.templates.ListReport.ListReportController")
58
+ class ListReportController extends PageController {
59
+ @usingExtension(
60
+ InternalRouting.override({
61
+ onAfterBinding: function (this: InternalRouting) {
62
+ (this.getView().getController() as ListReportController)._onAfterBinding();
63
+ }
64
+ })
65
+ )
66
+ _routing!: InternalRouting;
67
+ @usingExtension(
68
+ InternalIntentBasedNavigation.override({
69
+ getEntitySet: function (this: InternalIntentBasedNavigation) {
70
+ return (this.base as ListReportController).getCurrentEntitySet();
71
+ }
72
+ })
73
+ )
74
+ _intentBasedNavigation!: InternalIntentBasedNavigation;
75
+ @usingExtension(SideEffects)
76
+ sideEffects!: SideEffects;
77
+
78
+ @usingExtension(IntentBasedNavigation.override(IntentBasedNavigationOverride))
79
+ intentBasedNavigation!: IntentBasedNavigation;
80
+
81
+ @usingExtension(Share.override(ShareOverrides))
82
+ share!: Share;
83
+
84
+ @usingExtension(EditFlow.override(EditFlowOverrides))
85
+ editFlow!: EditFlow;
86
+
87
+ @usingExtension(ViewState.override(ViewStateOverrides))
88
+ viewState!: ViewState;
89
+
90
+ @usingExtension(KPIManagement)
91
+ kpiManagement!: KPIManagement;
92
+ @usingExtension(Placeholder)
93
+ placeholder!: Placeholder;
94
+ @usingExtension(MassEdit)
95
+ massEdit!: MassEdit;
96
+ private extensionAPI?: ExtensionAPI;
97
+ private _oListReportControl?: Control;
98
+ private filterBarConditions?: any;
99
+ private _bMultiMode?: boolean;
100
+ private sUpdateTimer?: any;
101
+ private oResourceBundle?: ResourceBundle;
102
+ private _sEntitySet?: string;
103
+ private hasPendingChartChanges?: boolean;
104
+ private hasPendingTableChanges?: boolean;
105
+
106
+ @publicExtension()
107
+ @finalExtension()
108
+ getExtensionAPI(): ExtensionAPI {
109
+ if (!this.extensionAPI) {
110
+ this.extensionAPI = new ExtensionAPI(this);
111
+ }
112
+ return this.extensionAPI;
113
+ }
114
+
115
+ onInit() {
116
+ PageController.prototype.onInit.apply(this);
117
+ const aControls = this._getControls();
118
+ const oInternalModelContext = this.getView().getBindingContext("internal") as InternalModelContext;
119
+ if (this._isMultiMode()) {
120
+ const oMultiModeTab = this._getMultiModeControl();
121
+ oInternalModelContext.setProperty("tabs", {
122
+ selected: oMultiModeTab.getSelectedKey() || (oMultiModeTab.getItems()[0] as any).getKey()
123
+ });
124
+ aControls.forEach((oControl: any) => {
125
+ const oUpdateCounts = () => {
126
+ this._updateCounts();
127
+ };
128
+ CommonUtils.addEventToBindingInfo(oControl, "dataRequested", oUpdateCounts);
129
+ });
130
+ }
131
+ //TODO: This is only a temporary approach and will be removed once app state behaviour is finalized.
132
+
133
+ oInternalModelContext.setProperty("hasPendingFilters", true);
134
+ oInternalModelContext.setProperty("appliedFilters", "");
135
+ oInternalModelContext.setProperty("hideDraftInfo", false);
136
+ oInternalModelContext.setProperty("uom", {});
137
+ oInternalModelContext.setProperty("scalefactor", {});
138
+ oInternalModelContext.setProperty("scalefactorNumber", {});
139
+ oInternalModelContext.setProperty("currency", {});
140
+
141
+ if (this._hasMultiVisualizations()) {
142
+ let alpContentView = this._getDefaultPath();
143
+ if (!system.desktop && alpContentView === TemplateContentView.Hybrid) {
144
+ alpContentView = TemplateContentView.Chart;
145
+ }
146
+ oInternalModelContext.setProperty("alpContentView", alpContentView);
147
+ }
148
+
149
+ // Store conditions from filter bar
150
+ // this is later used before navigation to get conditions applied on the filter bar
151
+ this.filterBarConditions = {};
152
+
153
+ // As AppStateHandler.applyAppState triggers a navigation we want to make sure it will
154
+ // happen after the routeMatch event has been processed (otherwise the router gets broken)
155
+ this.getAppComponent().getRouterProxy().waitForRouteMatchBeforeNavigation();
156
+
157
+ this._isMultiMode() && this._updateMultiControlHiddenStatus();
158
+ }
159
+
160
+ onExit() {
161
+ delete this.filterBarConditions;
162
+ delete this._oListReportControl;
163
+ this.extensionAPI && this.extensionAPI.destroy();
164
+ delete this.extensionAPI;
165
+ }
166
+
167
+ _onAfterBinding() {
168
+ const aTables = this._getControls("table");
169
+ if (EditState.isEditStateDirty()) {
170
+ const oTableBinding = this._getTableBinding();
171
+ if (oTableBinding) {
172
+ if (!this.sUpdateTimer) {
173
+ this.sUpdateTimer = setTimeout(() => {
174
+ oTableBinding.refresh();
175
+ if (this._isMultiMode()) {
176
+ this._setCountsOutDated();
177
+ this._updateCounts();
178
+ }
179
+ delete this.sUpdateTimer;
180
+ }, 0);
181
+ }
182
+
183
+ // Update action enablement and visibility upon table data update.
184
+ const fnUpdateTableActions = () => {
185
+ this._updateTableActions(aTables);
186
+ oTableBinding.detachDataReceived(fnUpdateTableActions);
187
+ };
188
+ oTableBinding.attachDataReceived(fnUpdateTableActions);
189
+ }
190
+ EditState.setEditStateProcessed();
191
+ }
192
+
193
+ if (!this.sUpdateTimer) {
194
+ this._updateTableActions(aTables);
195
+ }
196
+
197
+ this.pageReady.waitFor(this.getAppComponent().getAppStateHandler().applyAppState());
198
+ }
199
+
200
+ onBeforeRendering() {
201
+ PageController.prototype.onBeforeRendering.apply(this);
202
+ }
203
+
204
+ onAfterRendering() {
205
+ ((this.getView().getModel("sap.fe.i18n") as ResourceModel).getResourceBundle() as Promise<ResourceBundle>)
206
+ .then((response: any) => {
207
+ this.oResourceBundle = response;
208
+ const aControls = this._getControls();
209
+ const sEntitySet = (this.getView().getViewData() as any).entitySet;
210
+ const sText = CommonUtils.getTranslatedText(
211
+ "T_TABLE_AND_CHART_NO_DATA_TEXT",
212
+ this.oResourceBundle as ResourceBundle,
213
+ undefined,
214
+ sEntitySet
215
+ );
216
+ aControls.forEach(function (oControl: any) {
217
+ oControl.setNoDataText(sText);
218
+ });
219
+ })
220
+ .catch(function (oError: any) {
221
+ Log.error("Error while retrieving the resource bundle", oError);
222
+ });
223
+ }
224
+
225
+ @privateExtension()
226
+ @extensible(OverrideExecution.After)
227
+ onPageReady(mParameters: any) {
228
+ // Enabling mandatory filter fields message dialog and focusing on them
229
+ if (mParameters.forceFocus) {
230
+ const oFilterBar = this._getFilterBarControl();
231
+
232
+ if (oFilterBar && !oFilterBar.getShowMessages()) {
233
+ oFilterBar.setShowMessages(true);
234
+ (oFilterBar as any).setFocusOnFirstErroneousField();
235
+ }
236
+ }
237
+
238
+ // Remove the handler on back navigation that displays Draft confirmation
239
+ this.getAppComponent().getShellServices().setBackNavigation(undefined);
240
+ }
241
+
242
+ /**
243
+ * Method called when the content of a list report view needs to be refreshed.
244
+ * This happens either when there is a change on the FilterBar and the search is triggered,
245
+ * or when a tab with custom content is selected.
246
+ * This method can be overwritten by the controller extension in case of customization.
247
+ *
248
+ * @param {map} mParameters Map containing the filter conditions of the FilterBar, the currentTabID
249
+ * and the view refresh cause (tabChanged or search).
250
+ * The map looks like this:
251
+ * <code><pre>
252
+ * {
253
+ * filterConditions: {
254
+ * Country: [
255
+ * {
256
+ * operator: "EQ"
257
+ * validated: "NotValidated"
258
+ * values: ["Germany", ...]
259
+ * },
260
+ * ...
261
+ * ]
262
+ * ...
263
+ * },
264
+ * currentTabId: "fe::CustomTab::tab1",
265
+ * refreshCause: "tabChanged" | "search"
266
+ * }
267
+ * </pre></code>
268
+ *
269
+ * @public
270
+ */
271
+ @publicExtension()
272
+ @extensible(OverrideExecution.After)
273
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
274
+ onViewNeedsRefresh(mParameters: any) {
275
+ /* To be overriden */
276
+ }
277
+
278
+ /**
279
+ * Method called when a filter or search value has been changed in the FilterBar,
280
+ * but has not been validated yet by the end user (with the 'Go' or 'Search' button).
281
+ * Typically, the content of the current tab is greyed out until the filters are validated.
282
+ * This method can be overwritten by the controller extension in case of customization.
283
+ *
284
+ * @public
285
+ */
286
+ @publicExtension()
287
+ @extensible(OverrideExecution.After)
288
+ onPendingFilters() {
289
+ /* To be overriden */
290
+ }
291
+
292
+ getCurrentEntitySet() {
293
+ if (!this._sEntitySet) {
294
+ const oDisplayedControl = (this._isMultiMode() && this._getCurrentControl()) || this._getTable();
295
+ this._sEntitySet = oDisplayedControl?.data("targetCollectionPath").slice(1);
296
+ }
297
+ return this._sEntitySet;
298
+ }
299
+
300
+ /**
301
+ * This method initiates the update of the enabled state of the DataFieldForAction and the visible state of the DataFieldForIBN buttons.
302
+ * @param aTables Array of tables in the list report
303
+ * @private
304
+ */
305
+ _updateTableActions(aTables: any) {
306
+ let aIBNActions: any[] = [];
307
+ aTables.forEach(function (oTable: any) {
308
+ aIBNActions = CommonUtils.getIBNActions(oTable, aIBNActions);
309
+ // Update 'enabled' property of DataFieldForAction buttons on table toolbar
310
+ // The same is also performed on Table selectionChange event
311
+ const oInternalModelContext = oTable.getBindingContext("internal"),
312
+ oActionOperationAvailableMap = JSON.parse(
313
+ CommonHelper.parseCustomData(DelegateUtil.getCustomData(oTable, "operationAvailableMap")) as any
314
+ ),
315
+ aSelectedContexts = oTable.getSelectedContexts();
316
+
317
+ CommonUtils.setActionEnablement(oInternalModelContext, oActionOperationAvailableMap, aSelectedContexts);
318
+ });
319
+ CommonUtils.updateDataFieldForIBNButtonsVisibility(aIBNActions, this.getView());
320
+ }
321
+
322
+ /**
323
+ * This method scrolls to a specific row on all the available tables.
324
+ *
325
+ * @function
326
+ * @name sap.fe.templates.ListReport.ListReportController.controller#_scrollTablesToRow
327
+ * @param {string} sRowPath The path of the table row context to be scrolled to
328
+ */
329
+ _scrollTablesToRow(sRowPath: string) {
330
+ this._getControls("table").forEach(function (oTable: any) {
331
+ TableScroller.scrollTableToRow(oTable, sRowPath);
332
+ });
333
+ }
334
+
335
+ _getPageTitleInformation() {
336
+ const oTitleInfo = { title: "", subtitle: "", intent: "", icon: "" };
337
+ oTitleInfo.title = this.getView().getContent()[0].data().ListReportTitle;
338
+ oTitleInfo.subtitle = this.getView().getContent()[0].data().ListReportSubtitle;
339
+ return oTitleInfo;
340
+ }
341
+
342
+ _getFilterBarControl() {
343
+ return this.getView().byId(this._getFilterBarControlId()) as FilterBar;
344
+ }
345
+
346
+ _getSegmentedButton(sControl: any) {
347
+ return this.getView().byId(this._getSegmentedButtonId(sControl));
348
+ }
349
+
350
+ _getSegmentedButtonId(sControl: any) {
351
+ if (sControl === "Chart") {
352
+ return this._getChart().data("segmentedButtonId");
353
+ } else {
354
+ return this._getTable()?.data("segmentedButtonId");
355
+ }
356
+ }
357
+
358
+ _getFilterBarControlId() {
359
+ return this.getView().getContent()[0].data("filterBarId");
360
+ }
361
+
362
+ _getChartControlId() {
363
+ return this.getView().getContent()[0].data("singleChartId");
364
+ }
365
+
366
+ getChartControl() {
367
+ return this.getView().byId(this._getChartControlId());
368
+ }
369
+
370
+ _getVisualFilterBarControl() {
371
+ return this.getView().byId(this._getVisualFilterBarControlId());
372
+ }
373
+
374
+ _getVisualFilterBarControlId() {
375
+ return this.getView().getContent()[0].data("visualFilterBarId");
376
+ }
377
+
378
+ _getMultiModeControl() {
379
+ return this.getView().byId("fe::TabMultipleMode") as IconTabBar;
380
+ }
381
+
382
+ _getTableControlId() {
383
+ return this.getView().getContent()[0].data("singleTableId");
384
+ }
385
+
386
+ _getCurrentControl(): Control {
387
+ if (!this._oListReportControl) {
388
+ const oMultiModeTab = this._getMultiModeControl();
389
+ this._oListReportControl = this.getView().byId(
390
+ oMultiModeTab.getSelectedKey() || (oMultiModeTab.getItems()[0] as any).getKey()
391
+ ) as Control;
392
+ }
393
+ return this._oListReportControl as Control;
394
+ }
395
+
396
+ _getTable(): Table | undefined {
397
+ if (this._isMultiMode()) {
398
+ const oControl = this._getCurrentControl();
399
+ return oControl && oControl.isA("sap.ui.mdc.Table") ? (oControl as Table) : undefined;
400
+ }
401
+ return this.getView().byId(this._getTableControlId()) as Table;
402
+ }
403
+
404
+ _getChart() {
405
+ return this.getView().byId(this._getChartControlId());
406
+ }
407
+
408
+ _getTableBinding(sTableId?: any) {
409
+ const oTableControl = sTableId ? this.getView().byId(sTableId) : this._getTable();
410
+ const oBinding = oTableControl && (oTableControl as any)._getRowBinding();
411
+
412
+ return oBinding;
413
+ }
414
+
415
+ _getControls(sKey?: any) {
416
+ if (this._isMultiMode()) {
417
+ const aControls: any[] = [];
418
+ const oTabMultiMode = this._getMultiModeControl();
419
+ oTabMultiMode.getItems().forEach((oItem: any) => {
420
+ const oControl = this.getView().byId(oItem.getKey());
421
+ if (sKey) {
422
+ if (oItem.getKey().indexOf("fe::" + sKey) > -1) {
423
+ oControl && aControls.push(oControl);
424
+ }
425
+ } else {
426
+ oControl && aControls.push(oControl);
427
+ }
428
+ });
429
+ return aControls;
430
+ } else if (sKey === "Chart") {
431
+ const oChart = this._getChart();
432
+ return oChart ? [oChart] : [];
433
+ } else {
434
+ const oTable = this._getTable();
435
+ return oTable ? [oTable] : [];
436
+ }
437
+ }
438
+
439
+ _getDefaultPath() {
440
+ const defaultPath = this.getView().getContent()[0].data("defaultPath");
441
+ switch (defaultPath) {
442
+ case "primary":
443
+ return TemplateContentView.Chart;
444
+ case "secondary":
445
+ return TemplateContentView.Table;
446
+ case "both":
447
+ default:
448
+ return TemplateContentView.Hybrid;
449
+ }
450
+ }
451
+
452
+ /**
453
+ * Method to know if ListReport is configured with Multiple Table mode.
454
+ *
455
+ * @function
456
+ * @name _isMultiMode
457
+ * @returns {boolean} Is Multiple Table mode set?
458
+ */
459
+ _isMultiMode() {
460
+ if (!this._oListReportControl) {
461
+ this._bMultiMode = !!this._getMultiModeControl();
462
+ }
463
+ return this._bMultiMode;
464
+ }
465
+
466
+ /**
467
+ * Method to know if ListReport is configured with Multiple EntitySets.
468
+ *
469
+ * @function
470
+ * @name _isMultiEntitySets
471
+ * @returns {boolean} Is Multiple EntitySets configuration?
472
+ */
473
+ _isMultiEntitySets() {
474
+ return this.getView().getContent()[0].data("isMultiEntitySets") === "true";
475
+ }
476
+
477
+ _hasMultiVisualizations() {
478
+ return this.getView().getContent()[0].data("hasMultiVisualizations") === "true";
479
+ }
480
+
481
+ _setShareModel() {
482
+ // TODO: deactivated for now - currently there is no _templPriv anymore, to be discussed
483
+ // this method is currently not called anymore from the init method
484
+
485
+ const fnGetUser = ObjectPath.get("sap.ushell.Container.getUser");
486
+ //var oManifest = this.getOwnerComponent().getAppComponent().getMetadata().getManifestEntry("sap.ui");
487
+ //var sBookmarkIcon = (oManifest && oManifest.icons && oManifest.icons.icon) || "";
488
+
489
+ //shareModel: Holds all the sharing relevant information and info used in XML view
490
+ const oShareInfo = {
491
+ bookmarkTitle: document.title, //To name the bookmark according to the app title.
492
+ bookmarkCustomUrl: function () {
493
+ const sHash = hasher.getHash();
494
+ return sHash ? "#" + sHash : window.location.href;
495
+ },
496
+ /*
497
+ To be activated once the FLP shows the count - see comment above
498
+ bookmarkServiceUrl: function() {
499
+ //var oTable = oTable.getInnerTable(); oTable is already the sap.fe table (but not the inner one)
500
+ // we should use table.getListBindingInfo instead of the binding
501
+ var oBinding = oTable.getBinding("rows") || oTable.getBinding("items");
502
+ return oBinding ? fnGetDownloadUrl(oBinding) : "";
503
+ },*/
504
+ isShareInJamActive: !!fnGetUser && fnGetUser().isJamActive()
505
+ };
506
+
507
+ const oTemplatePrivateModel = this.getOwnerComponent().getModel("_templPriv") as JSONModel;
508
+ oTemplatePrivateModel.setProperty("/listReport/share", oShareInfo);
509
+ }
510
+
511
+ /**
512
+ * Hidden tables must be marked as hidden to avoid sending
513
+ * requests when FilterBar is changed or LR is initialized
514
+ * Best workflow would be to suspend table binding but
515
+ * if the user switch quickly between tabs the batch response of previous
516
+ * is received when previous tab is already disabled (binding is suspended) and
517
+ * generates error.
518
+ * A temporary solution (if we find better workflow) is to set a customData and don't trigger
519
+ * rebindTable if this customData is set to true.
520
+ */
521
+ _updateMultiControlHiddenStatus() {
522
+ const oDisplayedControl = this._getCurrentControl();
523
+ if (this._isMultiMode() && oDisplayedControl) {
524
+ const sDisplayControlId = oDisplayedControl.getId();
525
+ const aControls = this._getControls();
526
+ aControls.forEach(function (oControl: any) {
527
+ const sControlId = oControl.getId();
528
+ oControl.data("controlHidden", sControlId !== sDisplayControlId);
529
+ });
530
+ }
531
+ }
532
+
533
+ /**
534
+ * Method to update the local UI model of the page with the fields that are not applicable to the filter bar (this is specific to the multiple table scenario).
535
+ *
536
+ * @param {sap.ui.model.context} oInternalModelContext The internal model context
537
+ * @param {sap.ui.mdc.FilterBar} oFilterBar MDC filter bar
538
+ */
539
+ _updateMultiTabNotApplicableFields(oInternalModelContext: any, oFilterBar: any) {
540
+ const mCache: any = {};
541
+ const ignoredFields: any = {},
542
+ ignoredFieldsTitle: any = {},
543
+ aTables = this._getControls("table"),
544
+ aCharts = this._getControls("Chart");
545
+ aTables.forEach((oTable: any) => {
546
+ const sTableEntityPath = oTable.data("targetCollectionPath"),
547
+ sTableEntitySet = sTableEntityPath.slice(1),
548
+ sTabId = oTable.getParent().getParent().getKey(),
549
+ sTabTitle = oTable.getParent().getParent().getText(),
550
+ sCacheKey = sTableEntitySet + (oTable.data("enableAnalytics") === "true" ? "Analytical" : "Regular");
551
+ if (!mCache[sCacheKey]) {
552
+ mCache[sCacheKey] = FilterUtils.getNotApplicableFilters(oFilterBar, oTable);
553
+ }
554
+ ignoredFields[sTabId] = mCache[sCacheKey];
555
+ ignoredFieldsTitle[sTabId] = this.formatters.setTabMessageStrip.call(this, mCache[sCacheKey], sTabTitle, "false", {});
556
+ });
557
+ aCharts.forEach((oChart: any) => {
558
+ const sChartEntityPath = oChart.data("targetCollectionPath"),
559
+ sChartEntitySet = sChartEntityPath.slice(1),
560
+ sTabId = oChart.getParent().getParent().getKey(),
561
+ sTabTitle = oChart.getParent().getParent().getText(),
562
+ sCacheKey = sChartEntitySet + "Chart";
563
+ if (!mCache[sCacheKey]) {
564
+ mCache[sCacheKey] = FilterUtils.getNotApplicableFilters(oFilterBar, oChart);
565
+ }
566
+ ignoredFields[sTabId] = mCache[sCacheKey];
567
+ ignoredFieldsTitle[sTabId] = this.formatters.setTabMessageStrip.call(this, mCache[sCacheKey], sTabTitle, "false", {});
568
+ });
569
+ oInternalModelContext.setProperty("tabs/ignoredFields", ignoredFields);
570
+ oInternalModelContext.setProperty("tabs/ignoredFieldsTitle", ignoredFieldsTitle);
571
+ }
572
+
573
+ /**
574
+ * Method to update the local UI model of the page with the fields that are not applicable to the filter bar (this is specific to the ALP scenario).
575
+ *
576
+ * @param {sap.ui.model.context} oInternalModelContext The internal model context
577
+ * @param {sap.ui.mdc.FilterBar} oFilterBar MDC filter bar
578
+ */
579
+ _updateALPNotApplicableFields(oInternalModelContext: any, oFilterBar: any) {
580
+ const mCache: any = {};
581
+ const ignoredFields: any = {},
582
+ aTables = this._getControls("table"),
583
+ aCharts = this._getControls("Chart");
584
+
585
+ if (!aTables.length || !aCharts.length) {
586
+ // If there's not a table and a chart, we're not in the ALP case
587
+ return;
588
+ }
589
+
590
+ // For the moment, there's nothing for tables...
591
+ aCharts.forEach(function (oChart: any) {
592
+ const sChartEntityPath = oChart.data("targetCollectionPath"),
593
+ sChartEntitySet = sChartEntityPath.slice(1),
594
+ sCacheKey = sChartEntitySet + "Chart";
595
+ if (!mCache[sCacheKey]) {
596
+ mCache[sCacheKey] = FilterUtils.getNotApplicableFilters(oFilterBar, oChart);
597
+ }
598
+ ignoredFields[sCacheKey] = mCache[sCacheKey];
599
+ });
600
+ oInternalModelContext.setProperty("controls/ignoredFields", ignoredFields);
601
+ }
602
+
603
+ _updateMultiModeSelectedControl() {
604
+ this._sEntitySet = undefined;
605
+ this._oListReportControl = undefined;
606
+ this._getCurrentControl();
607
+ }
608
+
609
+ _updateCounts() {
610
+ this._updateMultiModeCounts();
611
+ }
612
+
613
+ /**
614
+ * Method to determine if a tab from the list report is a custom tab.
615
+ *
616
+ * @function
617
+ * @name _isCustomTab
618
+ * @returns {boolean} Determines if the tab is a custom tab.
619
+ */
620
+ _isCustomTab() {
621
+ const oMultiModeControl = this._getMultiModeControl();
622
+ return oMultiModeControl && oMultiModeControl.getSelectedKey().indexOf("::CustomTab::") > -1;
623
+ }
624
+
625
+ _setCountsOutDated() {
626
+ const oMultiModeControl = this._getMultiModeControl();
627
+ if (oMultiModeControl && oMultiModeControl.data("showCounts") === "true") {
628
+ const aItems = oMultiModeControl.getItems();
629
+ aItems.forEach(function (oItem: any) {
630
+ if (oItem.getKey().indexOf("fe::Chart") === -1) {
631
+ oItem.data("outdatedCounts", true);
632
+ }
633
+ });
634
+ }
635
+ }
636
+
637
+ _updateMultiModeCounts() {
638
+ let aBindingPromises = [];
639
+ const oMultiModeControl = this._getMultiModeControl();
640
+ if (oMultiModeControl && oMultiModeControl.data("showCounts") === "true" && !this._isCustomTab()) {
641
+ const oDisplayedControl = this._getCurrentControl();
642
+ const sDisplayedControlId = oDisplayedControl.getId();
643
+ const aCompliantTabs: any[] = [];
644
+ const aItems = oMultiModeControl.getItems();
645
+ aItems.forEach((oItem: any) => {
646
+ const oControl = this.getView().byId(oItem.getKey());
647
+ if (
648
+ oControl &&
649
+ !oControl.isA("sap.ui.mdc.Chart") &&
650
+ (oItem.data("outdatedCounts") || oControl.getId() === sDisplayedControlId)
651
+ ) {
652
+ aCompliantTabs.push({
653
+ control: oControl,
654
+ item: oItem
655
+ });
656
+ }
657
+ });
658
+
659
+ aBindingPromises = aCompliantTabs.map((mTab: any) => {
660
+ mTab.item.setCount("...");
661
+ const oControl = mTab.control;
662
+ const oFilterInfos = TableUtils.getFiltersInfoForSV(oControl, mTab.item.data("selectionVariant")) as any;
663
+ return TableUtils.getListBindingForCount(oControl, this.getView().getBindingContext(), {
664
+ batchGroupId: oControl.getId() === sDisplayedControlId ? oControl.data("batchGroupId") : "$auto",
665
+ additionalFilters: oFilterInfos.filters
666
+ });
667
+ });
668
+
669
+ Promise.all(aBindingPromises)
670
+ .then(function (aCounts: any[]) {
671
+ for (const k in aCounts) {
672
+ const oItem = aCompliantTabs[k].item;
673
+ oItem.setCount(TableUtils.getCountFormatted(aCounts[k]));
674
+ oItem.data("outdatedCounts", false);
675
+ }
676
+ })
677
+ .catch(function (oError: any) {
678
+ Log.error("Error while retrieving the values for the icon tab bar", oError);
679
+ });
680
+ }
681
+ }
682
+
683
+ _isFilterBarHidden() {
684
+ return (this.getView().getViewData() as any).hideFilterBar;
685
+ }
686
+
687
+ _shouldAutoTriggerSearch(oVM: any) {
688
+ if (
689
+ (this.getView().getViewData() as any).initialLoad === InitialLoadMode.Auto &&
690
+ (!oVM || oVM.getStandardVariantKey() === oVM.getCurrentVariantKey())
691
+ ) {
692
+ const oFilterBar = this._getFilterBarControl();
693
+ if (oFilterBar) {
694
+ const oConditions = oFilterBar.getConditions();
695
+ for (const sKey in oConditions) {
696
+ // ignore filters starting with $ (e.g. $search, $editState)
697
+ if (!sKey.startsWith("$") && Array.isArray(oConditions[sKey]) && oConditions[sKey].length) {
698
+ return true;
699
+ }
700
+ }
701
+ }
702
+ }
703
+
704
+ return false;
705
+ }
706
+
707
+ _updateTable(oTable: any) {
708
+ if (!oTable.isTableBound() || this.hasPendingChartChanges) {
709
+ oTable.rebind();
710
+ this.hasPendingChartChanges = false;
711
+ }
712
+ }
713
+
714
+ _updateChart(oChart: any) {
715
+ const oInnerChart = oChart.getControlDelegate()._getChart(oChart);
716
+ if (!(oInnerChart && oInnerChart.isBound("data")) || this.hasPendingTableChanges) {
717
+ oChart.getControlDelegate().rebind(oChart, oInnerChart.getBindingInfo("data"));
718
+ this.hasPendingTableChanges = false;
719
+ }
720
+ }
721
+
722
+ handlers = {
723
+ onTabMultiModeChange(this: ListReportController, oEvent: any) {
724
+ this._updateMultiModeSelectedControl();
725
+ this._updateMultiControlHiddenStatus();
726
+
727
+ const oFilterBar = this._getFilterBarControl();
728
+ const oInternalModelContext = this.getView().getBindingContext("internal") as InternalModelContext;
729
+ const oDisplayedControl = this._getCurrentControl() as any;
730
+ const oMultiModeControl = this._getMultiModeControl();
731
+ const sSelectedKey = oMultiModeControl.getSelectedKey();
732
+ const sPreviousSelectedKey = oEvent && oEvent.mParameters ? oEvent.mParameters.previousKey : undefined;
733
+
734
+ oInternalModelContext.setProperty("tabs/selected", sSelectedKey);
735
+ if (oInternalModelContext.getProperty("hasPendingFilters") !== true) {
736
+ // No pending filters into FilterBar
737
+ if (oFilterBar && this._isCustomTab()) {
738
+ const oFilterConditions = oFilterBar.getFilterConditions();
739
+ this.onViewNeedsRefresh({
740
+ filterConditions: oFilterConditions,
741
+ currentTabId: sSelectedKey,
742
+ refreshCause: "tabChanged"
743
+ });
744
+ } else if (
745
+ !oDisplayedControl.isA("sap.ui.mdc.Chart") &&
746
+ (!oDisplayedControl.getRowBinding() || // first time the tab/table is displayed
747
+ oDisplayedControl.data("outdatedRows") === true)
748
+ ) {
749
+ // Search has been triggered on a different tab {}
750
+ oDisplayedControl.rebind();
751
+ oDisplayedControl.data("outdatedRows", false);
752
+ } else if (
753
+ oDisplayedControl.isA("sap.ui.mdc.Chart") &&
754
+ (!oDisplayedControl.getControlDelegate()._getChart(oDisplayedControl).getBinding("data") || // first time the tab/chart is displayed
755
+ oDisplayedControl.data("outdatedRows") === true)
756
+ ) {
757
+ const oInnerChart = oDisplayedControl.getControlDelegate()._getChart(oDisplayedControl);
758
+ oDisplayedControl.getControlDelegate().rebind(oDisplayedControl, oInnerChart.getBindingInfo("data"));
759
+ oDisplayedControl.data("outdatedRows", false);
760
+ }
761
+ }
762
+
763
+ if (oEvent && oEvent.mParameters && sPreviousSelectedKey !== oEvent.mParameters.selectedKey) {
764
+ ControlPersonalizationWriteAPI.add({
765
+ changes: [
766
+ {
767
+ changeSpecificData: {
768
+ changeType: "selectIconTabBarFilter",
769
+ content: {
770
+ selectedKey: sSelectedKey,
771
+ previousSelectedKey: sPreviousSelectedKey
772
+ }
773
+ },
774
+ selectorElement: oMultiModeControl
775
+ }
776
+ ]
777
+ });
778
+ }
779
+ this.getExtensionAPI().updateAppState();
780
+ },
781
+ onFiltersChanged(this: ListReportController, oEvent: any) {
782
+ const oFilterBar = this._getFilterBarControl();
783
+ if (oFilterBar) {
784
+ const oInternalModelContext = this.getView().getBindingContext("internal") as InternalModelContext;
785
+ // Pending filters into FilterBar to be used for custom views
786
+ this.onPendingFilters();
787
+ oInternalModelContext.setProperty("appliedFilters", oFilterBar.getAssignedFiltersText().filtersText);
788
+ if (oEvent.getParameter("conditionsBased")) {
789
+ oInternalModelContext.setProperty("hasPendingFilters", true);
790
+ }
791
+ }
792
+ },
793
+ onVariantSelected(this: ListReportController, oEvent: any) {
794
+ const oVM = oEvent.getSource();
795
+ // setTimeout cause the variant needs to be applied before judging the auto search or updating the app state
796
+ setTimeout(() => {
797
+ if (this._isMultiMode()) {
798
+ (this.handlers as any).onTabMultiModeChange.apply(this, [oEvent]);
799
+ }
800
+ if (this._shouldAutoTriggerSearch(oVM)) {
801
+ // the app state will be updated via onSearch handler
802
+ return this._getFilterBarControl().triggerSearch();
803
+ } else {
804
+ this.getExtensionAPI().updateAppState();
805
+ }
806
+ }, 0);
807
+ },
808
+ onVariantSaved(this: ListReportController) {
809
+ //TODO: Should remove this setTimeOut once Variant Management provides an api to fetch the current variant key on save!!!
810
+ setTimeout(() => {
811
+ this.getExtensionAPI().updateAppState();
812
+ }, 1000);
813
+ },
814
+ onSearch(this: ListReportController) {
815
+ const oFilterBar = this._getFilterBarControl();
816
+ const oInternalModelContext = this.getView().getBindingContext("internal") as InternalModelContext;
817
+ const oMdcChart = this.getChartControl();
818
+ const bHideDraft = FilterUtils.getEditStateIsHideDraft(oFilterBar.getConditions());
819
+ oInternalModelContext.setProperty("hasPendingFilters", false);
820
+ oInternalModelContext.setProperty("hideDraftInfo", bHideDraft);
821
+ if (this._isMultiMode()) {
822
+ const aControls = this._getControls(),
823
+ oMultiModeControl = this._getMultiModeControl();
824
+ this._setCountsOutDated();
825
+ if (!this._isCustomTab()) {
826
+ const sDisplayedControlId = this._getCurrentControl().getId();
827
+ this._updateMultiTabNotApplicableFields(oInternalModelContext, oFilterBar);
828
+ // This should be done outside the search event handler of the filter bar.
829
+ // The same logic is required when filter bar is hidden and multiple tables exist on the LR.
830
+ // This is currently done in ListReport/overrides/ViewState.js#onAfterStateApplied()
831
+ aControls.forEach(function (oControl: any) {
832
+ oControl.data("outdatedRows", oControl.getId() !== sDisplayedControlId);
833
+ });
834
+ } else {
835
+ const oFilterConditions = oFilterBar.getFilterConditions();
836
+ this.onViewNeedsRefresh({
837
+ filterConditions: oFilterConditions,
838
+ currentTabId: oMultiModeControl.getSelectedKey(),
839
+ refreshCause: "search"
840
+ });
841
+ }
842
+ } else {
843
+ this._updateALPNotApplicableFields(oInternalModelContext, oFilterBar);
844
+ }
845
+ if (oMdcChart) {
846
+ // disable bound actions TODO: this clears everything for the chart?
847
+ (oMdcChart.getBindingContext("internal") as InternalModelContext).setProperty("", {});
848
+
849
+ const oPageInternalModelContext = oMdcChart.getBindingContext("pageInternal") as InternalModelContext;
850
+ const sTemplateContentView = oPageInternalModelContext.getProperty(oPageInternalModelContext.getPath() + "/alpContentView");
851
+ if (sTemplateContentView === TemplateContentView.Chart) {
852
+ this.hasPendingChartChanges = true;
853
+ }
854
+ if (sTemplateContentView === TemplateContentView.Table) {
855
+ this.hasPendingTableChanges = true;
856
+ }
857
+ }
858
+ // store filter bar conditions to use later while navigation
859
+ StateUtil.retrieveExternalState(oFilterBar)
860
+ .then((oExternalState: any) => {
861
+ this.filterBarConditions = oExternalState.filter;
862
+ })
863
+ .catch(function (oError: any) {
864
+ Log.error("Error while retrieving the external state", oError);
865
+ });
866
+ if ((this.getView().getViewData() as any).liveMode === false) {
867
+ this.getExtensionAPI().updateAppState();
868
+ }
869
+
870
+ if (system.phone) {
871
+ const oDynamicPage = this.getView().byId("fe::ListReport") as DynamicPage;
872
+ oDynamicPage.setHeaderExpanded(false);
873
+ }
874
+ },
875
+ /**
876
+ * Triggers an outbound navigation when a user chooses the chevron.
877
+ *
878
+ * @param {object} oController
879
+ * @param {string} sOutboundTarget Name of the outbound target (needs to be defined in the manifest)
880
+ * @param {sap.ui.model.odata.v4.Context} oContext The context that contains the data for the target app
881
+ * @param {string} sCreatePath Create path when the chevron is created.
882
+ * @returns {Promise} Promise which is resolved once the navigation is triggered
883
+ * @ui5-restricted
884
+ * @final
885
+ */
886
+ onChevronPressNavigateOutBound(oController: ListReportController, sOutboundTarget: string, oContext: any, sCreatePath: string) {
887
+ return oController._intentBasedNavigation.onChevronPressNavigateOutBound(oController, sOutboundTarget, oContext, sCreatePath);
888
+ },
889
+ onChartSelectionChanged(this: ListReportController, oEvent: any) {
890
+ const oMdcChart = oEvent.getSource().getContent(),
891
+ oTable = this._getTable(),
892
+ aData = oEvent.getParameter("data"),
893
+ oInternalModelContext = this.getView().getBindingContext("internal") as InternalModelContext;
894
+ if (aData) {
895
+ // update action buttons enablement / disablement
896
+ ChartRuntime.fnUpdateChart(oEvent);
897
+ // update selections on selection or deselection
898
+ ChartUtils.setChartFilters(oMdcChart);
899
+ }
900
+ const sTemplateContentView = oInternalModelContext.getProperty(oInternalModelContext.getPath() + "/alpContentView");
901
+ if (sTemplateContentView === TemplateContentView.Chart) {
902
+ this.hasPendingChartChanges = true;
903
+ } else {
904
+ oTable && (oTable as any).rebind();
905
+ this.hasPendingChartChanges = false;
906
+ }
907
+ },
908
+ onSegmentedButtonPressed(this: ListReportController, oEvent: any) {
909
+ const sSelectedKey = oEvent.mParameters.key ? oEvent.mParameters.key : null;
910
+ const oInternalModelContext = this.getView().getBindingContext("internal") as InternalModelContext;
911
+ oInternalModelContext.setProperty("alpContentView", sSelectedKey);
912
+ const oChart = this._getChart();
913
+ const oTable = this._getTable();
914
+ const oSegmentedButtonDelegate = {
915
+ onAfterRendering() {
916
+ const aItems = oSegmentedButton.getItems();
917
+ aItems.forEach(function (oItem: any) {
918
+ if (oItem.getKey() === sSelectedKey) {
919
+ oItem.focus();
920
+ }
921
+ });
922
+ oSegmentedButton.removeEventDelegate(oSegmentedButtonDelegate);
923
+ }
924
+ };
925
+ const oSegmentedButton = (
926
+ sSelectedKey === TemplateContentView.Table ? this._getSegmentedButton("Table") : this._getSegmentedButton("Chart")
927
+ ) as SegmentedButton;
928
+ if (oSegmentedButton !== oEvent.getSource()) {
929
+ oSegmentedButton.addEventDelegate(oSegmentedButtonDelegate);
930
+ }
931
+ switch (sSelectedKey) {
932
+ case TemplateContentView.Table:
933
+ this._updateTable(oTable);
934
+ break;
935
+ case TemplateContentView.Chart:
936
+ this._updateChart(oChart);
937
+ break;
938
+ case TemplateContentView.Hybrid:
939
+ this._updateTable(oTable);
940
+ this._updateChart(oChart);
941
+ break;
942
+ default:
943
+ break;
944
+ }
945
+ this.getExtensionAPI().updateAppState();
946
+ },
947
+ onFiltersSegmentedButtonPressed(this: ListReportController, oEvent: any) {
948
+ if (oEvent.getParameter("key") === "Compact") {
949
+ this._getFilterBarControl().setVisible(true);
950
+ (this.getView().byId(this.getView().getContent()[0].data("visualFilterBarId")) as Control).setVisible(false);
951
+ } else {
952
+ this._getFilterBarControl().setVisible(false);
953
+ (this.getView().byId(this.getView().getContent()[0].data("visualFilterBarId")) as Control).setVisible(true);
954
+ }
955
+ },
956
+ onStateChanged(this: ListReportController) {
957
+ this.getExtensionAPI().updateAppState();
958
+ }
959
+ };
960
+ formatters = {
961
+ /**
962
+ * Method to set the message text for the multiple entity sets when fields in the FilterBar need to be ignored.
963
+ *
964
+ * @param this
965
+ * @param {Array} aIgnoredFields Array of ignored fields in the FilterBar for the current tab (multiple entity sets)
966
+ * @param {string} sTabTitle Tab title
967
+ * @param {boolean} bIsChart Flag that indicates whether the control is a chart or not
968
+ * @param {object} oApplySupported ApplySupported for the control
969
+ * @returns {string} Message text
970
+ */
971
+ setTabMessageStrip(this: ListReportController, aIgnoredFields: any[], sTabTitle: string, bIsChart?: any, oApplySupported?: any) {
972
+ let sText = "";
973
+ bIsChart = bIsChart === "true" || bIsChart === true;
974
+ const oFilterBar = this._getFilterBarControl();
975
+ if (oFilterBar && Array.isArray(aIgnoredFields) && aIgnoredFields.length > 0 && (sTabTitle || bIsChart)) {
976
+ const sFilterBarEntityPath = oFilterBar.data("entityType"),
977
+ oMetaModel = this.getView().getModel().getMetaModel(),
978
+ oResourceBundle = Core.getLibraryResourceBundle("sap.fe.templates") as ResourceBundle,
979
+ aIgnoredLabels = aIgnoredFields.map(function (sProperty) {
980
+ const oMacroResourceBundle = Core.getLibraryResourceBundle("sap.fe.macros") as ResourceBundle;
981
+ if (sProperty === "$search") {
982
+ return oMacroResourceBundle ? oMacroResourceBundle.getText("M_FILTERBAR_SEARCH") : "";
983
+ }
984
+ if (sProperty === "$editState") {
985
+ return oMacroResourceBundle ? oMacroResourceBundle.getText("M_COMMON_FILTERBAR_EDITING_STATUS") : "";
986
+ }
987
+ const sLabel = oMetaModel.getObject(sFilterBarEntityPath + sProperty + "@com.sap.vocabularies.Common.v1.Label");
988
+ return DelegateUtil.getLocalizedText(sLabel, oFilterBar);
989
+ });
990
+ const bIsSearchIgnored = !oApplySupported.enableSearch;
991
+ if (oResourceBundle) {
992
+ sText = CommonUtils.getMessageStripText(
993
+ this.getView(),
994
+ aIgnoredLabels,
995
+ oFilterBar,
996
+ bIsChart,
997
+ bIsSearchIgnored,
998
+ sTabTitle,
999
+ oResourceBundle,
1000
+ DelegateUtil.getLocalizedText
1001
+ );
1002
+ }
1003
+ }
1004
+ return sText;
1005
+ }
1006
+ };
1007
+ }
1008
+
1009
+ export default ListReportController;