@sapui5/sap.fe.templates 1.103.0 → 1.106.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/package.json +5 -6
  2. package/src/sap/fe/templates/.library +1 -1
  3. package/src/sap/fe/templates/AnalyticalListPage/Component.js +2 -2
  4. package/src/sap/fe/templates/AnalyticalListPage/chart/FEChartDelegate.js +2 -2
  5. package/src/sap/fe/templates/AnalyticalListPage/chart/FEChartDelegate.ts +1 -1
  6. package/src/sap/fe/templates/Feedback.js +1 -1
  7. package/src/sap/fe/templates/Feedback.ts +0 -3
  8. package/src/sap/fe/templates/ListComponent.js +2 -2
  9. package/src/sap/fe/templates/ListReport/Component.js +2 -2
  10. package/src/sap/fe/templates/ListReport/ExtensionAPI.js +5 -3
  11. package/src/sap/fe/templates/ListReport/ExtensionAPI.ts +2 -1
  12. package/src/sap/fe/templates/ListReport/ListReport.view.xml +12 -86
  13. package/src/sap/fe/templates/ListReport/ListReportController.controller.js +90 -429
  14. package/src/sap/fe/templates/ListReport/ListReportController.controller.ts +81 -392
  15. package/src/sap/fe/templates/ListReport/ListReportTemplating.js +1 -1
  16. package/src/sap/fe/templates/ListReport/controls/MultipleModeControl.js +459 -0
  17. package/src/sap/fe/templates/ListReport/controls/MultipleModeControl.ts +338 -0
  18. package/src/sap/fe/templates/ListReport/overrides/IntentBasedNavigation.js +16 -9
  19. package/src/sap/fe/templates/ListReport/overrides/IntentBasedNavigation.ts +15 -9
  20. package/src/sap/fe/templates/ListReport/overrides/Share.js +4 -12
  21. package/src/sap/fe/templates/ListReport/overrides/Share.ts +4 -12
  22. package/src/sap/fe/templates/ListReport/overrides/ViewState.js +23 -31
  23. package/src/sap/fe/templates/ListReport/overrides/ViewState.ts +27 -31
  24. package/src/sap/fe/templates/ListReport/view/fragments/Chart.fragment.xml +3 -0
  25. package/src/sap/fe/templates/ListReport/view/fragments/CollectionVisualization.fragment.xml +16 -5
  26. package/src/sap/fe/templates/{controls → ListReport/view/fragments}/MacroChart.fragment.xml +3 -2
  27. package/src/sap/fe/templates/ListReport/view/fragments/MultipleMode.fragment.js +20 -4
  28. package/src/sap/fe/templates/ListReport/view/fragments/MultipleMode.fragment.ts +80 -48
  29. package/src/sap/fe/templates/{controls → ListReport/view/fragments}/Table.fragment.xml +6 -6
  30. package/src/sap/fe/templates/ListReport/view/fragments/VariantManagement.fragment.xml +31 -0
  31. package/src/sap/fe/templates/ObjectPage/Component.js +9 -9
  32. package/src/sap/fe/templates/ObjectPage/Component.ts +10 -6
  33. package/src/sap/fe/templates/ObjectPage/ExtensionAPI.js +25 -12
  34. package/src/sap/fe/templates/ObjectPage/ExtensionAPI.ts +18 -5
  35. package/src/sap/fe/templates/ObjectPage/ObjectPage.view.xml +60 -151
  36. package/src/sap/fe/templates/ObjectPage/ObjectPageController.controller.js +195 -140
  37. package/src/sap/fe/templates/ObjectPage/ObjectPageController.controller.ts +103 -93
  38. package/src/sap/fe/templates/ObjectPage/ObjectPageTemplating.js +52 -22
  39. package/src/sap/fe/templates/ObjectPage/ObjectPageTemplating.ts +46 -25
  40. package/src/sap/fe/templates/ObjectPage/components/DraftHandlerButton.js +178 -0
  41. package/src/sap/fe/templates/ObjectPage/components/DraftHandlerButton.tsx +132 -0
  42. package/src/sap/fe/templates/ObjectPage/controls/StashableHBox.js +2 -2
  43. package/src/sap/fe/templates/ObjectPage/controls/StashableVBox.js +2 -2
  44. package/src/sap/fe/templates/ObjectPage/controls/SubSectionBlock.js +2 -2
  45. package/src/sap/fe/templates/ObjectPage/designtime/FlexBox.designtime.js +1 -1
  46. package/src/sap/fe/templates/ObjectPage/designtime/StashableHBox.designtime.js +1 -1
  47. package/src/sap/fe/templates/ObjectPage/designtime/StashableVBox.designtime.js +1 -1
  48. package/src/sap/fe/templates/ObjectPage/flexibility/StashableHBox.flexibility.js +1 -1
  49. package/src/sap/fe/templates/ObjectPage/flexibility/StashableVBox.flexibility.js +1 -1
  50. package/src/sap/fe/templates/ObjectPage/overrides/IntentBasedNavigation.js +1 -1
  51. package/src/sap/fe/templates/ObjectPage/overrides/IntentBasedNavigation.ts +1 -1
  52. package/src/sap/fe/templates/ObjectPage/overrides/InternalRouting.js +1 -1
  53. package/src/sap/fe/templates/ObjectPage/overrides/MessageHandler.js +1 -1
  54. package/src/sap/fe/templates/ObjectPage/overrides/Paginator.js +1 -1
  55. package/src/sap/fe/templates/ObjectPage/overrides/Share.js +55 -29
  56. package/src/sap/fe/templates/ObjectPage/overrides/Share.ts +28 -29
  57. package/src/sap/fe/templates/ObjectPage/overrides/ViewState.js +1 -1
  58. package/src/sap/fe/templates/ObjectPage/view/fragments/Actions.fragment.xml +62 -62
  59. package/src/sap/fe/templates/ObjectPage/view/fragments/Chart.fragment.xml +13 -0
  60. package/src/sap/fe/templates/ObjectPage/view/fragments/EditableHeaderFacet.fragment.xml +10 -8
  61. package/src/sap/fe/templates/ObjectPage/view/fragments/FooterContent.fragment.xml +1 -1
  62. package/src/sap/fe/templates/ObjectPage/view/fragments/FormActionButtons.fragment.xml +5 -1
  63. package/src/sap/fe/templates/ObjectPage/view/fragments/HeaderDataPoint.fragment.xml +1 -1
  64. package/src/sap/fe/templates/ObjectPage/view/fragments/Heading.fragment.xml +2 -2
  65. package/src/sap/fe/templates/ObjectPage/view/fragments/HeadingTitle.fragment.xml +11 -6
  66. package/src/sap/fe/templates/ObjectPage/view/fragments/MacroChart.fragment.xml +22 -0
  67. package/src/sap/fe/templates/ObjectPage/view/fragments/ObjectPageHeaderForm.fragment.xml +7 -2
  68. package/src/sap/fe/templates/ObjectPage/view/fragments/Section.fragment.xml +8 -49
  69. package/src/sap/fe/templates/ObjectPage/view/fragments/SectionPresentationVisualization.fragment.xml +1 -1
  70. package/src/sap/fe/templates/ObjectPage/view/fragments/Table.fragment.xml +23 -0
  71. package/src/sap/fe/templates/RootContainer/controller/Fcl.controller.js +2 -2
  72. package/src/sap/fe/templates/RootContainer/controller/NavContainer.controller.js +2 -2
  73. package/src/sap/fe/templates/RootContainer/controller/RootContainerBaseController.js +5 -5
  74. package/src/sap/fe/templates/RootContainer/controller/RootContainerBaseController.ts +3 -3
  75. package/src/sap/fe/templates/RootContainer/overrides/EditFlow.js +1 -1
  76. package/src/sap/fe/templates/TableScroller.js +1 -1
  77. package/src/sap/fe/templates/library.js +4 -3
  78. package/src/sap/fe/templates/library.ts +2 -0
  79. package/src/sap/fe/templates/messagebundle.properties +2 -5
  80. package/src/sap/fe/templates/messagebundle_ar.properties +3 -12
  81. package/src/sap/fe/templates/messagebundle_bg.properties +2 -11
  82. package/src/sap/fe/templates/messagebundle_ca.properties +2 -11
  83. package/src/sap/fe/templates/messagebundle_cs.properties +3 -12
  84. package/src/sap/fe/templates/messagebundle_cy.properties +2 -11
  85. package/src/sap/fe/templates/messagebundle_da.properties +3 -12
  86. package/src/sap/fe/templates/messagebundle_de.properties +2 -11
  87. package/src/sap/fe/templates/messagebundle_el.properties +2 -11
  88. package/src/sap/fe/templates/messagebundle_en.properties +2 -11
  89. package/src/sap/fe/templates/messagebundle_en_GB.properties +2 -11
  90. package/src/sap/fe/templates/messagebundle_en_US_sappsd.properties +2 -11
  91. package/src/sap/fe/templates/messagebundle_en_US_saprigi.properties +2 -11
  92. package/src/sap/fe/templates/messagebundle_en_US_saptrc.properties +2 -11
  93. package/src/sap/fe/templates/messagebundle_es.properties +0 -9
  94. package/src/sap/fe/templates/messagebundle_es_MX.properties +2 -11
  95. package/src/sap/fe/templates/messagebundle_et.properties +0 -9
  96. package/src/sap/fe/templates/messagebundle_fi.properties +2 -11
  97. package/src/sap/fe/templates/messagebundle_fr.properties +3 -12
  98. package/src/sap/fe/templates/messagebundle_fr_CA.properties +2 -11
  99. package/src/sap/fe/templates/messagebundle_hi.properties +2 -11
  100. package/src/sap/fe/templates/messagebundle_hr.properties +2 -11
  101. package/src/sap/fe/templates/messagebundle_hu.properties +2 -11
  102. package/src/sap/fe/templates/messagebundle_id.properties +2 -11
  103. package/src/sap/fe/templates/messagebundle_it.properties +2 -11
  104. package/src/sap/fe/templates/messagebundle_iw.properties +2 -11
  105. package/src/sap/fe/templates/messagebundle_ja.properties +2 -11
  106. package/src/sap/fe/templates/messagebundle_kk.properties +2 -11
  107. package/src/sap/fe/templates/messagebundle_ko.properties +2 -11
  108. package/src/sap/fe/templates/messagebundle_lt.properties +2 -11
  109. package/src/sap/fe/templates/messagebundle_lv.properties +2 -11
  110. package/src/sap/fe/templates/messagebundle_ms.properties +2 -11
  111. package/src/sap/fe/templates/messagebundle_nl.properties +2 -11
  112. package/src/sap/fe/templates/messagebundle_no.properties +0 -9
  113. package/src/sap/fe/templates/messagebundle_pl.properties +0 -9
  114. package/src/sap/fe/templates/messagebundle_pt.properties +2 -11
  115. package/src/sap/fe/templates/messagebundle_pt_PT.properties +2 -11
  116. package/src/sap/fe/templates/messagebundle_ro.properties +0 -9
  117. package/src/sap/fe/templates/messagebundle_ru.properties +2 -11
  118. package/src/sap/fe/templates/messagebundle_sh.properties +2 -11
  119. package/src/sap/fe/templates/messagebundle_sk.properties +2 -11
  120. package/src/sap/fe/templates/messagebundle_sl.properties +2 -11
  121. package/src/sap/fe/templates/messagebundle_sv.properties +2 -11
  122. package/src/sap/fe/templates/messagebundle_th.properties +1 -10
  123. package/src/sap/fe/templates/messagebundle_tr.properties +2 -11
  124. package/src/sap/fe/templates/messagebundle_uk.properties +2 -11
  125. package/src/sap/fe/templates/messagebundle_vi.properties +0 -9
  126. package/src/sap/fe/templates/messagebundle_zh_CN.properties +0 -9
  127. package/src/sap/fe/templates/messagebundle_zh_TW.properties +2 -11
  128. package/src/sap/fe/templates/ListReport/view/fragments/MultipleModeOld.fragment.xml +0 -50
  129. package/src/sap/fe/templates/ObjectPage/handler/DraftHandler.js +0 -103
  130. package/src/sap/fe/templates/ObjectPage/handler/DraftHandler.ts +0 -97
  131. package/src/sap/fe/templates/ObjectPage/view/fragments/SwitchDraftAndActiveObjectPopOver.fragment.xml +0 -27
  132. package/src/sap/fe/templates/controls/Chart.fragment.xml +0 -25
@@ -2,6 +2,7 @@ import type ResourceBundle from "sap/base/i18n/ResourceBundle";
2
2
  import Log from "sap/base/Log";
3
3
  import ObjectPath from "sap/base/util/ObjectPath";
4
4
  import type DynamicPage from "sap/f/DynamicPage";
5
+ import ActionRuntime from "sap/fe/core/ActionRuntime";
5
6
  import CommonUtils from "sap/fe/core/CommonUtils";
6
7
  import EditFlow from "sap/fe/core/controllerextensions/EditFlow";
7
8
  import IntentBasedNavigation from "sap/fe/core/controllerextensions/IntentBasedNavigation";
@@ -23,7 +24,9 @@ import {
23
24
  usingExtension
24
25
  } from "sap/fe/core/helpers/ClassSupport";
25
26
  import EditState from "sap/fe/core/helpers/EditState";
26
- import type { InternalModelContext } from "sap/fe/core/helpers/ModelHelper";
27
+ import MessageStrip from "sap/fe/core/helpers/MessageStrip";
28
+ import { InternalModelContext } from "sap/fe/core/helpers/ModelHelper";
29
+ import * as StableIdHelper from "sap/fe/core/helpers/StableIdHelper";
27
30
  import CoreLibrary from "sap/fe/core/library";
28
31
  import PageController from "sap/fe/core/PageController";
29
32
  import ChartRuntime from "sap/fe/macros/chart/ChartRuntime";
@@ -31,23 +34,22 @@ import ChartUtils from "sap/fe/macros/chart/ChartUtils";
31
34
  import CommonHelper from "sap/fe/macros/CommonHelper";
32
35
  import DelegateUtil from "sap/fe/macros/DelegateUtil";
33
36
  import FilterUtils from "sap/fe/macros/filter/FilterUtils";
34
- import TableUtils from "sap/fe/macros/table/Utils";
37
+ import MultipleModeControl from "sap/fe/templates/ListReport/controls/MultipleModeControl";
35
38
  import ExtensionAPI from "sap/fe/templates/ListReport/ExtensionAPI";
36
39
  import EditFlowOverrides from "sap/fe/templates/RootContainer/overrides/EditFlow";
37
40
  import TableScroller from "sap/fe/templates/TableScroller";
38
- import type IconTabBar from "sap/m/IconTabBar";
39
41
  import type SegmentedButton from "sap/m/SegmentedButton";
42
+ import Component from "sap/ui/core/Component";
40
43
  import type Control from "sap/ui/core/Control";
41
- import Core from "sap/ui/core/Core";
42
44
  import OverrideExecution from "sap/ui/core/mvc/OverrideExecution";
43
45
  import { system } from "sap/ui/Device";
44
- import ControlPersonalizationWriteAPI from "sap/ui/fl/write/api/ControlPersonalizationWriteAPI";
45
46
  import StateUtil from "sap/ui/mdc/p13n/StateUtil";
46
47
  import type Table from "sap/ui/mdc/Table";
47
48
  import type JSONModel from "sap/ui/model/json/JSONModel";
48
49
  import type ResourceModel from "sap/ui/model/resource/ResourceModel";
49
50
  import hasher from "sap/ui/thirdparty/hasher";
50
51
  import type { V4Context } from "types/extension_types";
52
+ import * as ListReportTemplating from "./ListReportTemplating";
51
53
  import IntentBasedNavigationOverride from "./overrides/IntentBasedNavigation";
52
54
  import ShareOverrides from "./overrides/Share";
53
55
  import ViewStateOverrides from "./overrides/ViewState";
@@ -95,12 +97,9 @@ class ListReportController extends PageController {
95
97
  @usingExtension(MassEdit)
96
98
  massEdit!: MassEdit;
97
99
  private extensionAPI?: ExtensionAPI;
98
- private _oListReportControl?: Control;
99
100
  private filterBarConditions?: any;
100
- private _bMultiMode?: boolean;
101
101
  private sUpdateTimer?: any;
102
102
  private oResourceBundle?: ResourceBundle;
103
- private _sEntitySet?: string;
104
103
  private hasPendingChartChanges?: boolean;
105
104
  private hasPendingTableChanges?: boolean;
106
105
 
@@ -115,21 +114,7 @@ class ListReportController extends PageController {
115
114
 
116
115
  onInit() {
117
116
  PageController.prototype.onInit.apply(this);
118
- const aControls = this._getControls();
119
117
  const oInternalModelContext = this.getView().getBindingContext("internal") as InternalModelContext;
120
- if (this._isMultiMode()) {
121
- const oMultiModeTab = this._getMultiModeControl();
122
- oInternalModelContext.setProperty("tabs", {
123
- selected: oMultiModeTab.getSelectedKey() || (oMultiModeTab.getItems()[0] as any).getKey()
124
- });
125
- aControls.forEach((oControl: any) => {
126
- const oUpdateCounts = () => {
127
- this._updateCounts();
128
- };
129
- CommonUtils.addEventToBindingInfo(oControl, "dataRequested", oUpdateCounts);
130
- });
131
- }
132
- //TODO: This is only a temporary approach and will be removed once app state behaviour is finalized.
133
118
 
134
119
  oInternalModelContext.setProperty("hasPendingFilters", true);
135
120
  oInternalModelContext.setProperty("appliedFilters", "");
@@ -155,17 +140,12 @@ class ListReportController extends PageController {
155
140
  // happen after the routeMatch event has been processed (otherwise the router gets broken)
156
141
  this.getAppComponent().getRouterProxy().waitForRouteMatchBeforeNavigation();
157
142
 
158
- if (this._isMultiMode()) {
159
- this._updateMultiControlHiddenStatus();
160
- }
161
-
162
143
  // Configure the initial load settings
163
144
  this._setInitLoad();
164
145
  }
165
146
 
166
147
  onExit() {
167
148
  delete this.filterBarConditions;
168
- delete this._oListReportControl;
169
149
  if (this.extensionAPI) {
170
150
  this.extensionAPI.destroy();
171
151
  }
@@ -175,7 +155,8 @@ class ListReportController extends PageController {
175
155
  _onAfterBinding() {
176
156
  const aTables = this._getControls("table");
177
157
  if (EditState.isEditStateDirty()) {
178
- const oTableBinding = this._getTableBinding();
158
+ this._getMultiModeControl()?.invalidateContent();
159
+ const oTableBinding = this._getTable()?.getRowBinding();
179
160
  if (oTableBinding) {
180
161
  if (CommonUtils.getAppComponent(this.getView())._isFclEnabled()) {
181
162
  // there is an issue if we use a timeout with a kept alive context used on another page
@@ -184,11 +165,6 @@ class ListReportController extends PageController {
184
165
  if (!this.sUpdateTimer) {
185
166
  this.sUpdateTimer = setTimeout(() => {
186
167
  oTableBinding.refresh();
187
- if (this._isMultiMode()) {
188
- this._invalidateMultipleModeContent();
189
- this._setCountsOutDated();
190
- this._updateCounts();
191
- }
192
168
  delete this.sUpdateTimer;
193
169
  }, 0);
194
170
  }
@@ -303,11 +279,7 @@ class ListReportController extends PageController {
303
279
  }
304
280
 
305
281
  getCurrentEntitySet() {
306
- if (!this._sEntitySet) {
307
- const oDisplayedControl = (this._isMultiMode() && this._getCurrentControl()) || this._getTable();
308
- this._sEntitySet = oDisplayedControl?.data("targetCollectionPath").slice(1);
309
- }
310
- return this._sEntitySet;
282
+ return this._getTable()?.data("targetCollectionPath").slice(1);
311
283
  }
312
284
 
313
285
  /**
@@ -328,7 +300,7 @@ class ListReportController extends PageController {
328
300
  ),
329
301
  aSelectedContexts = oTable.getSelectedContexts();
330
302
 
331
- CommonUtils.setActionEnablement(oInternalModelContext, oActionOperationAvailableMap, aSelectedContexts);
303
+ ActionRuntime.setActionEnablement(oInternalModelContext, oActionOperationAvailableMap, aSelectedContexts, "table");
332
304
  });
333
305
  CommonUtils.updateDataFieldForIBNButtonsVisibility(aIBNActions, this.getView());
334
306
  }
@@ -347,16 +319,13 @@ class ListReportController extends PageController {
347
319
  }
348
320
 
349
321
  _getPageTitleInformation() {
350
- const oTitleInfo = { title: "", subtitle: "", intent: "", icon: "" };
351
- oTitleInfo.title = this.getView().getContent()[0].data().ListReportTitle;
352
- oTitleInfo.subtitle = this.getView().getContent()[0].data().ListReportSubtitle;
353
- return oTitleInfo;
354
- }
355
-
356
- _getPageOrFilterBarVariantManagement() {
357
- return (
358
- this.getView().byId("fe::PageVariantManagement") || this.getView().byId(`${this._getFilterBarControlId()}::VariantManagement`)
359
- );
322
+ const oManifestEntry = this.getAppComponent().getManifestEntry("sap.app");
323
+ return {
324
+ title: oManifestEntry.title,
325
+ subtitle: oManifestEntry.appSubTitle || "",
326
+ intent: "",
327
+ icon: ""
328
+ };
360
329
  }
361
330
 
362
331
  _getFilterBarControl() {
@@ -371,76 +340,52 @@ class ListReportController extends PageController {
371
340
  }
372
341
 
373
342
  _getSegmentedButton(sControl: any) {
374
- return this.getView().byId(this._getSegmentedButtonId(sControl));
343
+ const sSegmentedButtonId = (sControl === "Chart" ? this.getChartControl() : this._getTable())?.data("segmentedButtonId");
344
+ return this.getView().byId(sSegmentedButtonId);
375
345
  }
376
346
 
377
- _getSegmentedButtonId(sControl: any) {
378
- if (sControl === "Chart") {
379
- return this._getChart().data("segmentedButtonId");
380
- } else {
381
- return this._getTable()?.data("segmentedButtonId");
382
- }
347
+ _getControlFromPageModelProperty(sPath: string) {
348
+ const controlId = this._getPageModel()?.getProperty(sPath);
349
+ return controlId && this.getView().byId(controlId);
383
350
  }
384
351
 
385
- _getFilterBarControlId() {
386
- return this.getView().getContent()[0].data("filterBarId");
352
+ _getPageModel(): JSONModel | undefined {
353
+ const pageComponent = Component.getOwnerComponentFor(this.getView()) as any;
354
+ return pageComponent.getModel("_pageModel");
387
355
  }
388
356
 
389
- _getChartControlId() {
390
- return this.getView().getContent()[0].data("singleChartId");
357
+ _getFilterBarControlId(): string {
358
+ return this._getPageModel()?.getProperty("/filterBarId") || "";
391
359
  }
392
360
 
393
361
  getChartControl() {
394
- return this.getView().byId(this._getChartControlId());
362
+ return this._getControlFromPageModelProperty("/singleChartId");
395
363
  }
396
364
 
397
365
  _getVisualFilterBarControl() {
398
- return this.getView().byId(this._getVisualFilterBarControlId());
366
+ const sVisualFilterBarId = StableIdHelper.generate(["visualFilter", this._getFilterBarControlId()]);
367
+ return sVisualFilterBarId && this.getView().byId(sVisualFilterBarId);
399
368
  }
400
-
401
- _getVisualFilterBarControlId() {
402
- return this.getView().getContent()[0].data("visualFilterBarId");
369
+ _getFilterBarVariantControl() {
370
+ return this._getControlFromPageModelProperty("/variantManagement/id");
403
371
  }
404
372
 
405
373
  _getMultiModeControl() {
406
- return this.getView().byId("fe::TabMultipleMode") as IconTabBar;
407
- }
408
-
409
- _getTableControlId() {
410
- return this.getView().getContent()[0].data("singleTableId");
411
- }
412
-
413
- _getCurrentControl(): Control {
414
- if (!this._oListReportControl) {
415
- const oMultiModeTab = this._getMultiModeControl();
416
- this._oListReportControl = this.getView().byId(
417
- oMultiModeTab.getSelectedKey() || (oMultiModeTab.getItems()[0] as any).getKey()
418
- ) as Control;
419
- }
420
- return this._oListReportControl;
374
+ return this.getView().byId("fe::TabMultipleMode::Control") as MultipleModeControl;
421
375
  }
422
376
 
423
377
  _getTable(): Table | undefined {
424
378
  if (this._isMultiMode()) {
425
- const oControl = this._getCurrentControl();
426
- return oControl && oControl.isA("sap.ui.mdc.Table") ? (oControl as Table) : undefined;
379
+ const oControl = this._getMultiModeControl()?.getSelectedInnerControl()?.content;
380
+ return oControl?.isA("sap.ui.mdc.Table") ? (oControl as Table) : undefined;
381
+ } else {
382
+ return this._getControlFromPageModelProperty("/singleTableId") as Table;
427
383
  }
428
- return this.getView().byId(this._getTableControlId()) as Table;
429
- }
430
-
431
- _getChart() {
432
- return this.getView().byId(this._getChartControlId());
433
- }
434
-
435
- _getTableBinding(sTableId?: any) {
436
- const oTableControl = sTableId ? this.getView().byId(sTableId) : this._getTable();
437
- return oTableControl && (oTableControl as any)._getRowBinding();
438
384
  }
439
-
440
385
  _getControls(sKey?: any) {
441
386
  if (this._isMultiMode()) {
442
387
  const aControls: any[] = [];
443
- const oTabMultiMode = this._getMultiModeControl();
388
+ const oTabMultiMode = this._getMultiModeControl().content;
444
389
  oTabMultiMode.getItems().forEach((oItem: any) => {
445
390
  const oControl = this.getView().byId(oItem.getKey());
446
391
  if (oControl && sKey) {
@@ -453,7 +398,7 @@ class ListReportController extends PageController {
453
398
  });
454
399
  return aControls;
455
400
  } else if (sKey === "Chart") {
456
- const oChart = this._getChart();
401
+ const oChart = this.getChartControl();
457
402
  return oChart ? [oChart] : [];
458
403
  } else {
459
404
  const oTable = this._getTable();
@@ -462,7 +407,7 @@ class ListReportController extends PageController {
462
407
  }
463
408
 
464
409
  _getDefaultPath() {
465
- const defaultPath = this.getView().getContent()[0].data("defaultPath");
410
+ const defaultPath = ListReportTemplating.getDefaultPath(this._getPageModel()?.getProperty("/views") || []);
466
411
  switch (defaultPath) {
467
412
  case "primary":
468
413
  return TemplateContentView.Chart;
@@ -481,11 +426,8 @@ class ListReportController extends PageController {
481
426
  * @name _isMultiMode
482
427
  * @returns Is Multiple Table mode set?
483
428
  */
484
- _isMultiMode() {
485
- if (!this._oListReportControl) {
486
- this._bMultiMode = !!this._getMultiModeControl();
487
- }
488
- return this._bMultiMode;
429
+ _isMultiMode(): boolean {
430
+ return !!this._getPageModel()?.getProperty("/multiViewsControl");
489
431
  }
490
432
 
491
433
  /**
@@ -495,24 +437,13 @@ class ListReportController extends PageController {
495
437
  * @name _isInitLoadDisabled
496
438
  * @returns Is InitLoad enabled?
497
439
  */
498
- _isInitLoadEnabled() {
440
+ _isInitLoadEnabled(): boolean {
499
441
  const initLoadMode = (this.getView().getViewData() as any).initialLoad;
500
442
  return initLoadMode === InitialLoadMode.Enabled;
501
443
  }
502
444
 
503
- /**
504
- * Method to know if ListReport is configured with Multiple EntitySets.
505
- *
506
- * @function
507
- * @name _isMultiEntitySets
508
- * @returns Is Multiple EntitySets configuration?
509
- */
510
- _isMultiEntitySets() {
511
- return this.getView().getContent()[0].data("isMultiEntitySets") === "true";
512
- }
513
-
514
- _hasMultiVisualizations() {
515
- return this.getView().getContent()[0].data("hasMultiVisualizations") === "true";
445
+ _hasMultiVisualizations(): boolean {
446
+ return this._getPageModel()?.getProperty("/hasMultiVisualizations");
516
447
  }
517
448
 
518
449
  /**
@@ -552,7 +483,8 @@ class ListReportController extends PageController {
552
483
  }
553
484
  // set hook for flex for when standard variant is set (at start or by user at runtime)
554
485
  // required to override the user setting 'apply automatically' behaviour if there are no filters
555
- const variantManagement: any = this._getPageOrFilterBarVariantManagement();
486
+ const variantManagementId: any = ListReportTemplating.getVariantBackReference(this.getView().getViewData(), this._getPageModel());
487
+ const variantManagement = variantManagementId && this.getView().byId(variantManagementId);
556
488
  if (variantManagement) {
557
489
  variantManagement.registerApplyAutomaticallyOnStandardVariant(this._applyAutomaticallyOnStandardVariant.bind(this));
558
490
  }
@@ -588,68 +520,6 @@ class ListReportController extends PageController {
588
520
  oTemplatePrivateModel.setProperty("/listReport/share", oShareInfo);
589
521
  }
590
522
 
591
- /**
592
- * Hidden tables must be marked as hidden to avoid sending
593
- * requests when FilterBar is changed or LR is initialized
594
- * Best workflow would be to suspend table binding but
595
- * if the user switch quickly between tabs the batch response of previous
596
- * is received when previous tab is already disabled (binding is suspended) and
597
- * generates error.
598
- * A temporary solution (if we find better workflow) is to set a customData and don't trigger
599
- * rebindTable if this customData is set to true.
600
- */
601
- _updateMultiControlHiddenStatus() {
602
- const oDisplayedControl = this._getCurrentControl();
603
- if (this._isMultiMode() && oDisplayedControl) {
604
- const sDisplayControlId = oDisplayedControl.getId();
605
- const aControls = this._getControls();
606
- aControls.forEach(function (oControl: any) {
607
- const sControlId = oControl.getId();
608
- oControl.data("controlHidden", sControlId !== sDisplayControlId);
609
- });
610
- }
611
- }
612
-
613
- /**
614
- * 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).
615
- *
616
- * @param oInternalModelContext The internal model context
617
- * @param oFilterBar MDC filter bar
618
- */
619
- _updateMultiTabNotApplicableFields(oInternalModelContext: InternalModelContext, oFilterBar: FilterBar) {
620
- const mCache: any = {};
621
- const ignoredFields: any = {},
622
- ignoredFieldsTitle: any = {},
623
- aTables = this._getControls("table"),
624
- aCharts = this._getControls("Chart");
625
- aTables.forEach((oTable: any) => {
626
- const sTableEntityPath = oTable.data("targetCollectionPath"),
627
- sTableEntitySet = sTableEntityPath.slice(1),
628
- sTabId = oTable.getParent().getParent().getKey(),
629
- sTabTitle = oTable.getParent().getParent().getText(),
630
- sCacheKey = sTableEntitySet + (oTable.data("enableAnalytics") === "true" ? "Analytical" : "Regular");
631
- if (!mCache[sCacheKey]) {
632
- mCache[sCacheKey] = FilterUtils.getNotApplicableFilters(oFilterBar, oTable);
633
- }
634
- ignoredFields[sTabId] = mCache[sCacheKey];
635
- ignoredFieldsTitle[sTabId] = this.formatters.setTabMessageStrip.call(this, mCache[sCacheKey], sTabTitle, "false", {});
636
- });
637
- aCharts.forEach((oChart: any) => {
638
- const sChartEntityPath = oChart.data("targetCollectionPath"),
639
- sChartEntitySet = sChartEntityPath.slice(1),
640
- sTabId = oChart.getParent().getParent().getKey(),
641
- sTabTitle = oChart.getParent().getParent().getText(),
642
- sCacheKey = `${sChartEntitySet}Chart`;
643
- if (!mCache[sCacheKey]) {
644
- mCache[sCacheKey] = FilterUtils.getNotApplicableFilters(oFilterBar, oChart);
645
- }
646
- ignoredFields[sTabId] = mCache[sCacheKey];
647
- ignoredFieldsTitle[sTabId] = this.formatters.setTabMessageStrip.call(this, mCache[sCacheKey], sTabTitle, "false", {});
648
- });
649
- oInternalModelContext.setProperty("tabs/ignoredFields", ignoredFields);
650
- oInternalModelContext.setProperty("tabs/ignoredFieldsTitle", ignoredFieldsTitle);
651
- }
652
-
653
523
  /**
654
524
  * 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).
655
525
  *
@@ -680,97 +550,19 @@ class ListReportController extends PageController {
680
550
  oInternalModelContext.setProperty("controls/ignoredFields", ignoredFields);
681
551
  }
682
552
 
683
- _updateMultiModeSelectedControl() {
684
- this._sEntitySet = undefined;
685
- this._oListReportControl = undefined;
686
- this._getCurrentControl();
687
- }
688
-
689
- _updateCounts() {
690
- this._updateMultiModeCounts();
691
- }
692
-
693
- /**
694
- * Method to determine if a tab from the list report is a custom tab.
695
- *
696
- * @function
697
- * @name _isCustomTab
698
- * @returns Determines if the tab is a custom tab.
699
- */
700
- _isCustomTab() {
701
- const oMultiModeControl = this._getMultiModeControl();
702
- return oMultiModeControl && oMultiModeControl.getSelectedKey().indexOf("::CustomTab::") > -1;
553
+ _isFilterBarHidden() {
554
+ return (this.getView().getViewData() as any).hideFilterBar;
703
555
  }
704
556
 
705
- _setCountsOutDated() {
706
- const oMultiModeControl = this._getMultiModeControl();
707
- if (oMultiModeControl && oMultiModeControl.data("showCounts") === "true") {
708
- const aItems = oMultiModeControl.getItems();
709
- aItems.forEach(function (oItem: any) {
710
- if (oItem.getKey().indexOf("fe::Chart") === -1) {
711
- oItem.data("outdatedCounts", true);
712
- }
713
- });
557
+ _getApplyAutomaticallyOnVariant(VariantManagement: any, key: string): Boolean {
558
+ if (!VariantManagement || !key) {
559
+ return false;
714
560
  }
715
- }
716
- _invalidateMultipleModeContent() {
717
- const aControls = this._getControls();
718
- const sDisplayedControlId = this._getCurrentControl().getId();
719
- aControls.forEach(function (oControl: any) {
720
- oControl.data("outdatedRows", oControl.getId() !== sDisplayedControlId);
561
+ const variants = VariantManagement.getVariants();
562
+ const currentVariant = variants.find(function (variant: any) {
563
+ return variant && variant.key === key;
721
564
  });
722
- }
723
-
724
- _updateMultiModeCounts() {
725
- let aBindingPromises = [];
726
- const oMultiModeControl = this._getMultiModeControl();
727
- if (oMultiModeControl && oMultiModeControl.data("showCounts") === "true" && !this._isCustomTab()) {
728
- const oDisplayedControl = this._getCurrentControl();
729
- const sDisplayedControlId = oDisplayedControl.getId();
730
- const aCompliantTabs: any[] = [];
731
- const aItems = oMultiModeControl.getItems();
732
- aItems.forEach((oItem: any) => {
733
- if (oItem.getProperty("visible")) {
734
- const oControl = this.getView().byId(oItem.getKey());
735
- if (
736
- oControl &&
737
- !oControl.isA("sap.ui.mdc.Chart") &&
738
- (oItem.data("outdatedCounts") || oControl.getId() === sDisplayedControlId)
739
- ) {
740
- aCompliantTabs.push({
741
- control: oControl,
742
- item: oItem
743
- });
744
- }
745
- }
746
- });
747
-
748
- aBindingPromises = aCompliantTabs.map((mTab: any) => {
749
- mTab.item.setCount("...");
750
- const oControl = mTab.control;
751
- const oFilterInfos = TableUtils.getFiltersInfoForSV(oControl, mTab.item.data("selectionVariant")) as any;
752
- return TableUtils.getListBindingForCount(oControl, this.getView().getBindingContext(), {
753
- batchGroupId: oControl.getId() === sDisplayedControlId ? oControl.data("batchGroupId") : "$auto",
754
- additionalFilters: oFilterInfos.filters
755
- });
756
- });
757
-
758
- Promise.all(aBindingPromises)
759
- .then(function (aCounts: any[]) {
760
- for (const k in aCounts) {
761
- const oItem = aCompliantTabs[k].item;
762
- oItem.setCount(TableUtils.getCountFormatted(aCounts[k]));
763
- oItem.data("outdatedCounts", false);
764
- }
765
- })
766
- .catch(function (oError: any) {
767
- Log.error("Error while retrieving the values for the icon tab bar", oError);
768
- });
769
- }
770
- }
771
-
772
- _isFilterBarHidden() {
773
- return (this.getView().getViewData() as any).hideFilterBar;
565
+ return (currentVariant && currentVariant.executeOnSelect) || false;
774
566
  }
775
567
 
776
568
  _shouldAutoTriggerSearch(oVM: any) {
@@ -812,64 +604,6 @@ class ListReportController extends PageController {
812
604
  }
813
605
 
814
606
  handlers = {
815
- onTabMultiModeChange(this: ListReportController, oEvent: any) {
816
- this._updateMultiModeSelectedControl();
817
- this._updateMultiControlHiddenStatus();
818
-
819
- const oFilterBar = this._getFilterBarControl();
820
- const oInternalModelContext = this.getView().getBindingContext("internal") as InternalModelContext;
821
- const oDisplayedControl = this._getCurrentControl() as any;
822
- const oMultiModeControl = this._getMultiModeControl();
823
- const sSelectedKey = oMultiModeControl.getSelectedKey();
824
- const sPreviousSelectedKey = oEvent && oEvent.mParameters ? oEvent.mParameters.previousKey : undefined;
825
-
826
- oInternalModelContext.setProperty("tabs/selected", sSelectedKey);
827
- if (oInternalModelContext.getProperty("hasPendingFilters") !== true) {
828
- // No pending filters into FilterBar
829
- if (oFilterBar && this._isCustomTab()) {
830
- const oFilterConditions = oFilterBar.getFilterConditions();
831
- this.onViewNeedsRefresh({
832
- filterConditions: oFilterConditions,
833
- currentTabId: sSelectedKey,
834
- refreshCause: "tabChanged"
835
- });
836
- } else if (
837
- !oDisplayedControl.isA("sap.ui.mdc.Chart") &&
838
- (!oDisplayedControl.getRowBinding() || // first time the tab/table is displayed
839
- oDisplayedControl.data("outdatedRows") === true)
840
- ) {
841
- // Search has been triggered on a different tab {}
842
- oDisplayedControl.rebind();
843
- oDisplayedControl.data("outdatedRows", false);
844
- } else if (
845
- oDisplayedControl.isA("sap.ui.mdc.Chart") &&
846
- (!oDisplayedControl.getControlDelegate()._getChart(oDisplayedControl).getBinding("data") || // first time the tab/chart is displayed
847
- oDisplayedControl.data("outdatedRows") === true)
848
- ) {
849
- const oInnerChart = oDisplayedControl.getControlDelegate()._getChart(oDisplayedControl);
850
- oDisplayedControl.getControlDelegate().rebind(oDisplayedControl, oInnerChart.getBindingInfo("data"));
851
- oDisplayedControl.data("outdatedRows", false);
852
- }
853
- }
854
-
855
- if (oEvent && oEvent.mParameters && sPreviousSelectedKey !== oEvent.mParameters.selectedKey) {
856
- ControlPersonalizationWriteAPI.add({
857
- changes: [
858
- {
859
- changeSpecificData: {
860
- changeType: "selectIconTabBarFilter",
861
- content: {
862
- selectedKey: sSelectedKey,
863
- previousSelectedKey: sPreviousSelectedKey
864
- }
865
- },
866
- selectorElement: oMultiModeControl
867
- }
868
- ]
869
- });
870
- }
871
- this.getExtensionAPI().updateAppState();
872
- },
873
607
  onFiltersChanged(this: ListReportController, oEvent: any) {
874
608
  const oFilterBar = this._getFilterBarControl();
875
609
  if (oFilterBar) {
@@ -884,15 +618,17 @@ class ListReportController extends PageController {
884
618
  },
885
619
  onVariantSelected(this: ListReportController, oEvent: any) {
886
620
  const oVM = oEvent.getSource();
621
+ const currentVariantKey = oEvent.getParameter("key");
622
+ const oMultiModeControl = this._getMultiModeControl();
623
+
624
+ oMultiModeControl?.invalidateContent();
625
+ oMultiModeControl?.setFreezeContent(true);
887
626
  // setTimeout cause the variant needs to be applied before judging the auto search or updating the app state
888
627
  setTimeout(() => {
889
- if (this._isMultiMode()) {
890
- (this.handlers as any).onTabMultiModeChange.apply(this, [oEvent]);
891
- }
892
628
  if (this._shouldAutoTriggerSearch(oVM)) {
893
629
  // the app state will be updated via onSearch handler
894
630
  return this._getFilterBarControl().triggerSearch();
895
- } else {
631
+ } else if (!this._getApplyAutomaticallyOnVariant(oVM, currentVariantKey)) {
896
632
  this.getExtensionAPI().updateAppState();
897
633
  }
898
634
  }, 0);
@@ -910,24 +646,8 @@ class ListReportController extends PageController {
910
646
  const bHideDraft = FilterUtils.getEditStateIsHideDraft(oFilterBar.getConditions());
911
647
  oInternalModelContext.setProperty("hasPendingFilters", false);
912
648
  oInternalModelContext.setProperty("hideDraftInfo", bHideDraft);
913
- if (this._isMultiMode()) {
914
- const oMultiModeControl = this._getMultiModeControl();
915
- this._setCountsOutDated();
916
- if (!this._isCustomTab()) {
917
- this._updateMultiTabNotApplicableFields(oInternalModelContext, oFilterBar);
918
- // This should be done outside the search event handler of the filter bar.
919
- // The same logic is required when filter bar is hidden and multiple tables exist on the LR.
920
- // This is currently done in ListReport/overrides/ViewState.js#onAfterStateApplied()
921
- this._invalidateMultipleModeContent();
922
- } else {
923
- const oFilterConditions = oFilterBar.getFilterConditions();
924
- this.onViewNeedsRefresh({
925
- filterConditions: oFilterConditions,
926
- currentTabId: oMultiModeControl.getSelectedKey(),
927
- refreshCause: "search"
928
- });
929
- }
930
- } else {
649
+
650
+ if (!this._getMultiModeControl()) {
931
651
  this._updateALPNotApplicableFields(oInternalModelContext, oFilterBar);
932
652
  }
933
653
  if (oMdcChart) {
@@ -1002,7 +722,7 @@ class ListReportController extends PageController {
1002
722
  const sSelectedKey = oEvent.mParameters.key ? oEvent.mParameters.key : null;
1003
723
  const oInternalModelContext = this.getView().getBindingContext("internal") as InternalModelContext;
1004
724
  oInternalModelContext.setProperty("alpContentView", sSelectedKey);
1005
- const oChart = this._getChart();
725
+ const oChart = this.getChartControl();
1006
726
  const oTable = this._getTable();
1007
727
  const oSegmentedButtonDelegate = {
1008
728
  onAfterRendering() {
@@ -1038,13 +758,9 @@ class ListReportController extends PageController {
1038
758
  this.getExtensionAPI().updateAppState();
1039
759
  },
1040
760
  onFiltersSegmentedButtonPressed(this: ListReportController, oEvent: any) {
1041
- if (oEvent.getParameter("key") === "Compact") {
1042
- this._getFilterBarControl().setVisible(true);
1043
- (this.getView().byId(this.getView().getContent()[0].data("visualFilterBarId")) as Control).setVisible(false);
1044
- } else {
1045
- this._getFilterBarControl().setVisible(false);
1046
- (this.getView().byId(this.getView().getContent()[0].data("visualFilterBarId")) as Control).setVisible(true);
1047
- }
761
+ const isCompact = oEvent.getParameter("key") === "Compact";
762
+ this._getFilterBarControl().setVisible(isCompact);
763
+ (this._getVisualFilterBarControl() as Control).setVisible(!isCompact);
1048
764
  },
1049
765
  onStateChange(this: ListReportController) {
1050
766
  this.getExtensionAPI().updateAppState();
@@ -1061,50 +777,23 @@ class ListReportController extends PageController {
1061
777
  }
1062
778
  };
1063
779
  formatters = {
1064
- /**
1065
- * Method to set the message text for the multiple entity sets when fields in the FilterBar need to be ignored.
1066
- *
1067
- * @param this
1068
- * @param aIgnoredFields Array of ignored fields in the FilterBar for the current tab (multiple entity sets)
1069
- * @param sTabTitle Tab title
1070
- * @param bIsChart Flag that indicates whether the control is a chart or not
1071
- * @param oApplySupported ApplySupported for the control
1072
- * @returns Message text
1073
- */
1074
- setTabMessageStrip(this: ListReportController, aIgnoredFields: any[], sTabTitle: string, bIsChart?: any, oApplySupported?: any) {
780
+ setALPControlMessageStrip(this: ListReportController, aIgnoredFields: any[], bIsChart: any, oApplySupported?: any) {
1075
781
  let sText = "";
1076
782
  bIsChart = bIsChart === "true" || bIsChart === true;
1077
783
  const oFilterBar = this._getFilterBarControl();
1078
- if (oFilterBar && Array.isArray(aIgnoredFields) && aIgnoredFields.length > 0 && (sTabTitle || bIsChart)) {
1079
- const sFilterBarEntityPath = oFilterBar.data("entityType"),
1080
- oMetaModel = this.getView().getModel().getMetaModel(),
1081
- oResourceBundle = Core.getLibraryResourceBundle("sap.fe.templates") as ResourceBundle,
1082
- aIgnoredLabels = aIgnoredFields.map(function (sProperty) {
1083
- const oMacroResourceBundle = Core.getLibraryResourceBundle("sap.fe.macros") as ResourceBundle;
1084
- if (sProperty === "$search") {
1085
- return oMacroResourceBundle ? oMacroResourceBundle.getText("M_FILTERBAR_SEARCH") : "";
1086
- }
1087
- if (sProperty === "$editState") {
1088
- return oMacroResourceBundle ? oMacroResourceBundle.getText("M_COMMON_FILTERBAR_EDITING_STATUS") : "";
1089
- }
1090
- const sLabel = oMetaModel.getObject(`${sFilterBarEntityPath + sProperty}@com.sap.vocabularies.Common.v1.Label`);
1091
- return DelegateUtil.getLocalizedText(sLabel, oFilterBar);
1092
- });
784
+ if (oFilterBar && Array.isArray(aIgnoredFields) && aIgnoredFields.length > 0 && bIsChart) {
785
+ const aIgnoredLabels = MessageStrip.getLabels(
786
+ aIgnoredFields,
787
+ oFilterBar.data("entityType"),
788
+ oFilterBar,
789
+ this.oResourceBundle as ResourceBundle
790
+ );
1093
791
  const bIsSearchIgnored = !oApplySupported.enableSearch;
1094
- if (oResourceBundle) {
1095
- sText = CommonUtils.getMessageStripText(
1096
- this.getView(),
1097
- aIgnoredLabels,
1098
- oFilterBar,
1099
- bIsChart,
1100
- bIsSearchIgnored,
1101
- sTabTitle,
1102
- oResourceBundle,
1103
- DelegateUtil.getLocalizedText
1104
- );
1105
- }
792
+ sText = bIsChart
793
+ ? MessageStrip.getALPText(aIgnoredLabels, oFilterBar, bIsSearchIgnored)
794
+ : MessageStrip.getText(aIgnoredLabels, oFilterBar, "", DelegateUtil.getLocalizedText);
795
+ return sText;
1106
796
  }
1107
- return sText;
1108
797
  }
1109
798
  };
1110
799
  }