@sapui5/sap.fe.templates 1.100.0 → 1.102.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -5
- package/src/sap/fe/templates/.library +1 -2
- package/src/sap/fe/templates/AnalyticalListPage/Component.js +24 -12
- package/src/sap/fe/templates/AnalyticalListPage/Component.ts +6 -0
- package/src/sap/fe/templates/AnalyticalListPage/chart/FEChartDelegate.js +30 -32
- package/src/sap/fe/templates/AnalyticalListPage/chart/FEChartDelegate.ts +25 -0
- package/src/sap/fe/templates/Feedback.js +80 -0
- package/src/sap/fe/templates/Feedback.ts +67 -0
- package/src/sap/fe/templates/ListComponent.js +156 -118
- package/src/sap/fe/templates/ListComponent.ts +105 -0
- package/src/sap/fe/templates/ListReport/Component.js +82 -53
- package/src/sap/fe/templates/ListReport/Component.ts +39 -0
- package/src/sap/fe/templates/ListReport/ExtensionAPI.js +126 -112
- package/src/sap/fe/templates/ListReport/ExtensionAPI.ts +106 -0
- package/src/sap/fe/templates/ListReport/ListReport.view.xml +106 -58
- package/src/sap/fe/templates/ListReport/ListReportController.controller.js +1196 -1081
- package/src/sap/fe/templates/ListReport/ListReportController.controller.ts +1088 -0
- package/src/sap/fe/templates/ListReport/ListReportTemplating.js +45 -0
- package/src/sap/fe/templates/ListReport/ListReportTemplating.ts +30 -0
- package/src/sap/fe/templates/ListReport/overrides/IntentBasedNavigation.js +54 -53
- package/src/sap/fe/templates/ListReport/overrides/IntentBasedNavigation.ts +55 -0
- package/src/sap/fe/templates/ListReport/overrides/Share.js +137 -137
- package/src/sap/fe/templates/ListReport/overrides/Share.ts +135 -0
- package/src/sap/fe/templates/ListReport/overrides/ViewState.js +451 -428
- package/src/sap/fe/templates/ListReport/overrides/ViewState.ts +419 -0
- package/src/sap/fe/templates/ListReport/view/fragments/CollectionVisualization.fragment.xml +25 -25
- package/src/sap/fe/templates/ListReport/view/fragments/MultipleMode.fragment.js +72 -0
- package/src/sap/fe/templates/ListReport/view/fragments/MultipleMode.fragment.ts +62 -0
- package/src/sap/fe/templates/ListReport/view/fragments/{MultipleMode.fragment.xml → MultipleModeOld.fragment.xml} +24 -23
- package/src/sap/fe/templates/ObjectPage/Component.js +169 -138
- package/src/sap/fe/templates/ObjectPage/Component.ts +131 -0
- package/src/sap/fe/templates/ObjectPage/ExtensionAPI.js +140 -142
- package/src/sap/fe/templates/ObjectPage/ExtensionAPI.ts +116 -0
- package/src/sap/fe/templates/ObjectPage/ObjectPage.view.xml +162 -22
- package/src/sap/fe/templates/ObjectPage/ObjectPageController.controller.js +1534 -1447
- package/src/sap/fe/templates/ObjectPage/ObjectPageController.controller.ts +1454 -0
- package/src/sap/fe/templates/ObjectPage/ObjectPageTemplating.js +872 -0
- package/src/sap/fe/templates/ObjectPage/ObjectPageTemplating.ts +837 -0
- package/src/sap/fe/templates/ObjectPage/controls/StashableHBox.js +136 -101
- package/src/sap/fe/templates/ObjectPage/controls/StashableHBox.ts +84 -0
- package/src/sap/fe/templates/ObjectPage/controls/StashableVBox.js +24 -21
- package/src/sap/fe/templates/ObjectPage/controls/StashableVBox.ts +10 -0
- package/src/sap/fe/templates/ObjectPage/controls/SubSectionBlock.js +98 -53
- package/src/sap/fe/templates/ObjectPage/controls/SubSectionBlock.ts +50 -0
- package/src/sap/fe/templates/ObjectPage/designtime/FlexBox.designtime.js +20 -19
- package/src/sap/fe/templates/ObjectPage/designtime/FlexBox.designtime.ts +15 -0
- package/src/sap/fe/templates/ObjectPage/designtime/StashableHBox.designtime.js +50 -47
- package/src/sap/fe/templates/ObjectPage/designtime/StashableHBox.designtime.ts +47 -0
- package/src/sap/fe/templates/ObjectPage/designtime/StashableVBox.designtime.js +34 -34
- package/src/sap/fe/templates/ObjectPage/designtime/StashableVBox.designtime.ts +34 -0
- package/src/sap/fe/templates/ObjectPage/flexibility/StashableHBox.flexibility.js +15 -15
- package/src/sap/fe/templates/ObjectPage/flexibility/StashableHBox.flexibility.ts +13 -0
- package/src/sap/fe/templates/ObjectPage/flexibility/StashableVBox.flexibility.js +11 -11
- package/src/sap/fe/templates/ObjectPage/flexibility/StashableVBox.flexibility.ts +7 -0
- package/src/sap/fe/templates/ObjectPage/overrides/IntentBasedNavigation.js +55 -52
- package/src/sap/fe/templates/ObjectPage/overrides/IntentBasedNavigation.ts +57 -0
- package/src/sap/fe/templates/ObjectPage/overrides/InternalRouting.js +15 -17
- package/src/sap/fe/templates/ObjectPage/overrides/InternalRouting.ts +13 -0
- package/src/sap/fe/templates/ObjectPage/overrides/MessageHandler.js +13 -17
- package/src/sap/fe/templates/ObjectPage/overrides/MessageHandler.ts +14 -0
- package/src/sap/fe/templates/ObjectPage/overrides/Paginator.js +23 -21
- package/src/sap/fe/templates/ObjectPage/overrides/Paginator.ts +21 -0
- package/src/sap/fe/templates/ObjectPage/overrides/Share.js +310 -317
- package/src/sap/fe/templates/ObjectPage/overrides/Share.ts +316 -0
- package/src/sap/fe/templates/ObjectPage/overrides/ViewState.js +66 -57
- package/src/sap/fe/templates/ObjectPage/overrides/ViewState.ts +65 -0
- package/src/sap/fe/templates/ObjectPage/view/fragments/Actions.fragment.xml +26 -33
- package/src/sap/fe/templates/ObjectPage/view/fragments/CollaborationDraft.fragment.xml +11 -10
- package/src/sap/fe/templates/ObjectPage/view/fragments/EditableHeaderFacet.fragment.xml +15 -15
- package/src/sap/fe/templates/ObjectPage/view/fragments/FooterContent.fragment.xml +31 -27
- package/src/sap/fe/templates/ObjectPage/view/fragments/FormActionButtons.fragment.xml +15 -16
- package/src/sap/fe/templates/ObjectPage/view/fragments/FormActions.fragment.xml +1 -5
- package/src/sap/fe/templates/ObjectPage/view/fragments/HeaderDataPoint.fragment.xml +1 -2
- package/src/sap/fe/templates/ObjectPage/view/fragments/HeaderDataPointTitle.fragment.xml +1 -3
- package/src/sap/fe/templates/ObjectPage/view/fragments/HeaderFacet.fragment.xml +3 -4
- package/src/sap/fe/templates/ObjectPage/view/fragments/Heading.fragment.xml +16 -17
- package/src/sap/fe/templates/ObjectPage/view/fragments/HeadingTitle.fragment.xml +3 -3
- package/src/sap/fe/templates/ObjectPage/view/fragments/ObjectPageHeaderForm.fragment.xml +3 -3
- package/src/sap/fe/templates/ObjectPage/view/fragments/RelatedApps.fragment.xml +7 -4
- package/src/sap/fe/templates/ObjectPage/view/fragments/Section.fragment.xml +71 -6
- package/src/sap/fe/templates/ObjectPage/view/fragments/SectionContent.fragment.xml +114 -94
- package/src/sap/fe/templates/ObjectPage/view/fragments/SectionContentLazyLoader.fragment.xml +127 -107
- package/src/sap/fe/templates/ObjectPage/view/fragments/SwitchDraftAndActiveObjectPopOver.fragment.xml +27 -0
- package/src/sap/fe/templates/RootContainer/controller/Fcl.controller.js +899 -817
- package/src/sap/fe/templates/RootContainer/controller/Fcl.controller.ts +833 -0
- package/src/sap/fe/templates/RootContainer/controller/NavContainer.controller.js +205 -189
- package/src/sap/fe/templates/RootContainer/controller/NavContainer.controller.ts +178 -0
- package/src/sap/fe/templates/RootContainer/controller/RootContainerBaseController.js +484 -459
- package/src/sap/fe/templates/RootContainer/controller/RootContainerBaseController.ts +438 -0
- package/src/sap/fe/templates/RootContainer/overrides/EditFlow.js +16 -14
- package/src/sap/fe/templates/RootContainer/overrides/EditFlow.ts +20 -0
- package/src/sap/fe/templates/TableScroller.js +45 -53
- package/src/sap/fe/templates/TableScroller.ts +48 -0
- package/src/sap/fe/templates/controls/Chart.fragment.xml +18 -17
- package/src/sap/fe/templates/controls/MacroChart.fragment.xml +23 -0
- package/src/sap/fe/templates/controls/Table.fragment.xml +3 -4
- package/src/sap/fe/templates/library.js +49 -63
- package/src/sap/fe/templates/library.ts +57 -0
- package/src/sap/fe/templates/messagebundle.properties +19 -7
- package/src/sap/fe/templates/messagebundle_ar.properties +12 -4
- package/src/sap/fe/templates/messagebundle_bg.properties +12 -4
- package/src/sap/fe/templates/messagebundle_ca.properties +12 -4
- package/src/sap/fe/templates/messagebundle_cs.properties +12 -4
- package/src/sap/fe/templates/messagebundle_cy.properties +12 -4
- package/src/sap/fe/templates/messagebundle_da.properties +12 -4
- package/src/sap/fe/templates/messagebundle_de.properties +12 -4
- package/src/sap/fe/templates/messagebundle_el.properties +12 -4
- package/src/sap/fe/templates/messagebundle_en.properties +12 -4
- package/src/sap/fe/templates/messagebundle_en_GB.properties +12 -4
- package/src/sap/fe/templates/messagebundle_en_US_sappsd.properties +13 -5
- package/src/sap/fe/templates/messagebundle_en_US_saprigi.properties +13 -5
- package/src/sap/fe/templates/messagebundle_en_US_saptrc.properties +13 -5
- package/src/sap/fe/templates/messagebundle_es.properties +12 -4
- package/src/sap/fe/templates/messagebundle_es_MX.properties +12 -4
- package/src/sap/fe/templates/messagebundle_et.properties +12 -4
- package/src/sap/fe/templates/messagebundle_fi.properties +12 -4
- package/src/sap/fe/templates/messagebundle_fr.properties +12 -4
- package/src/sap/fe/templates/messagebundle_fr_CA.properties +12 -4
- package/src/sap/fe/templates/messagebundle_hi.properties +12 -4
- package/src/sap/fe/templates/messagebundle_hr.properties +12 -4
- package/src/sap/fe/templates/messagebundle_hu.properties +12 -4
- package/src/sap/fe/templates/messagebundle_id.properties +12 -4
- package/src/sap/fe/templates/messagebundle_it.properties +12 -4
- package/src/sap/fe/templates/messagebundle_iw.properties +12 -4
- package/src/sap/fe/templates/messagebundle_ja.properties +12 -4
- package/src/sap/fe/templates/messagebundle_kk.properties +12 -4
- package/src/sap/fe/templates/messagebundle_ko.properties +12 -4
- package/src/sap/fe/templates/messagebundle_lt.properties +12 -4
- package/src/sap/fe/templates/messagebundle_lv.properties +12 -4
- package/src/sap/fe/templates/messagebundle_ms.properties +12 -4
- package/src/sap/fe/templates/messagebundle_nl.properties +12 -4
- package/src/sap/fe/templates/messagebundle_no.properties +12 -4
- package/src/sap/fe/templates/messagebundle_pl.properties +12 -4
- package/src/sap/fe/templates/messagebundle_pt.properties +13 -5
- package/src/sap/fe/templates/messagebundle_pt_PT.properties +12 -4
- package/src/sap/fe/templates/messagebundle_ro.properties +12 -4
- package/src/sap/fe/templates/messagebundle_ru.properties +12 -4
- package/src/sap/fe/templates/messagebundle_sh.properties +12 -4
- package/src/sap/fe/templates/messagebundle_sk.properties +12 -4
- package/src/sap/fe/templates/messagebundle_sl.properties +12 -4
- package/src/sap/fe/templates/messagebundle_sv.properties +12 -4
- package/src/sap/fe/templates/messagebundle_th.properties +12 -4
- package/src/sap/fe/templates/messagebundle_tr.properties +12 -4
- package/src/sap/fe/templates/messagebundle_uk.properties +12 -4
- package/src/sap/fe/templates/messagebundle_vi.properties +12 -4
- package/src/sap/fe/templates/messagebundle_zh_CN.properties +12 -4
- package/src/sap/fe/templates/messagebundle_zh_TW.properties +12 -4
- package/src/sap/fe/templates/ObjectPage/AnnotationHelper.js +0 -518
- package/src/sap/fe/templates/ObjectPage/templating/ObjectPageTemplating.js +0 -120
- package/src/sap/fe/templates/ObjectPage/templating/ObjectPageTemplating.ts +0 -138
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
import Log from "sap/base/Log";
|
|
2
|
+
import BaseController from "sap/fe/core/BaseController";
|
|
3
|
+
import Placeholder from "sap/fe/core/controllerextensions/Placeholder";
|
|
4
|
+
import { defineUI5Class, usingExtension } from "sap/fe/core/helpers/ClassSupport";
|
|
5
|
+
import SizeHelper from "sap/fe/macros/SizeHelper";
|
|
6
|
+
import BindingParser from "sap/ui/base/BindingParser";
|
|
7
|
+
import HashChanger from "sap/ui/core/routing/HashChanger";
|
|
8
|
+
import Router from "sap/ui/core/routing/Router";
|
|
9
|
+
import Context from "sap/ui/model/Context";
|
|
10
|
+
import JSONModel from "sap/ui/model/json/JSONModel";
|
|
11
|
+
import AnnotationHelper from "sap/ui/model/odata/v4/AnnotationHelper";
|
|
12
|
+
import ResourceModel from "sap/ui/model/resource/ResourceModel";
|
|
13
|
+
|
|
14
|
+
@defineUI5Class("sap.fe.templates.RootContainer.controller.RootContainerBaseController")
|
|
15
|
+
class RootContainerBaseController extends BaseController {
|
|
16
|
+
@usingExtension(Placeholder)
|
|
17
|
+
oPlaceholder!: Placeholder;
|
|
18
|
+
private _aHelperModels!: any[];
|
|
19
|
+
private oRouter?: Router;
|
|
20
|
+
private _oRouteMatchedPromise: any;
|
|
21
|
+
private oTitleHierarchyCache: any;
|
|
22
|
+
private bIsComputingTitleHierachy: boolean = false;
|
|
23
|
+
|
|
24
|
+
onInit() {
|
|
25
|
+
SizeHelper.init();
|
|
26
|
+
|
|
27
|
+
this._aHelperModels = [];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
getPlaceholder() {
|
|
31
|
+
return this.oPlaceholder;
|
|
32
|
+
}
|
|
33
|
+
attachRouteMatchers() {
|
|
34
|
+
this.oPlaceholder.attachRouteMatchers();
|
|
35
|
+
this.getAppComponent().getRoutingService().attachAfterRouteMatched(this._onAfterRouteMatched, this);
|
|
36
|
+
}
|
|
37
|
+
onExit() {
|
|
38
|
+
this.getAppComponent().getRoutingService().detachAfterRouteMatched(this._onAfterRouteMatched, this);
|
|
39
|
+
this.oRouter = undefined;
|
|
40
|
+
|
|
41
|
+
SizeHelper.exit();
|
|
42
|
+
|
|
43
|
+
// Destroy all JSON models created dynamically for the views
|
|
44
|
+
this._aHelperModels.forEach(function (oModel: any) {
|
|
45
|
+
oModel.destroy();
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Convenience method for getting the resource bundle.
|
|
50
|
+
*
|
|
51
|
+
* @public
|
|
52
|
+
* @returns {sap.ui.model.resource.ResourceModel} The resourceModel of the component
|
|
53
|
+
*/
|
|
54
|
+
getResourceBundle() {
|
|
55
|
+
return (this.getOwnerComponent().getModel("i18n") as ResourceModel).getResourceBundle();
|
|
56
|
+
}
|
|
57
|
+
getRouter() {
|
|
58
|
+
if (!this.oRouter) {
|
|
59
|
+
this.oRouter = this.getAppComponent().getRouter();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return this.oRouter;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
_createHelperModel() {
|
|
66
|
+
// We keep a reference on the models created dynamically, as they don't get destroyed
|
|
67
|
+
// automatically when the view is destroyed.
|
|
68
|
+
// This is done during onExit
|
|
69
|
+
const oModel = new JSONModel();
|
|
70
|
+
this._aHelperModels.push(oModel);
|
|
71
|
+
|
|
72
|
+
return oModel;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Function waiting for the Right most view to be ready.
|
|
77
|
+
*
|
|
78
|
+
* @memberof sap.fe.templates.RootContainer.controller.BaseController
|
|
79
|
+
* @param {*} oEvent Reference an Event parameter coming from routeMatched event
|
|
80
|
+
* @returns {Promise}
|
|
81
|
+
*/
|
|
82
|
+
waitForRightMostViewReady(oEvent: any) {
|
|
83
|
+
return new Promise(function (resolve: (value: any) => void) {
|
|
84
|
+
const aContainers = oEvent.getParameter("views"),
|
|
85
|
+
// There can also be reuse components in the view, remove them before processing.
|
|
86
|
+
aFEContainers: any[] = [];
|
|
87
|
+
aContainers.forEach(function (oContainer: any) {
|
|
88
|
+
let oView = oContainer;
|
|
89
|
+
if (oContainer && oContainer.getComponentInstance) {
|
|
90
|
+
const oComponentInstance = oContainer.getComponentInstance();
|
|
91
|
+
oView = oComponentInstance.getRootControl();
|
|
92
|
+
}
|
|
93
|
+
if (oView && oView.getController() && oView.getController().pageReady) {
|
|
94
|
+
aFEContainers.push(oView);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
const oRightMostFEView = aFEContainers[aFEContainers.length - 1];
|
|
98
|
+
if (oRightMostFEView && oRightMostFEView.getController().pageReady.isPageReady()) {
|
|
99
|
+
resolve(oRightMostFEView);
|
|
100
|
+
} else {
|
|
101
|
+
oRightMostFEView &&
|
|
102
|
+
oRightMostFEView.getController().pageReady.attachEventOnce("pageReady", function () {
|
|
103
|
+
resolve(oRightMostFEView);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Callback when the navigation is done.
|
|
111
|
+
* - update the shell title.
|
|
112
|
+
* - update table scroll.
|
|
113
|
+
* - call onPageReady on the rightMostView.
|
|
114
|
+
*
|
|
115
|
+
* @param oEvent
|
|
116
|
+
* @name sap.fe.templates.RootContainer.controller.BaseController#_onAfterRouteMatched
|
|
117
|
+
* @memberof sap.fe.templates.RootContainer.controller.BaseController
|
|
118
|
+
*/
|
|
119
|
+
_onAfterRouteMatched(oEvent: any) {
|
|
120
|
+
if (!this._oRouteMatchedPromise) {
|
|
121
|
+
this._oRouteMatchedPromise = this.waitForRightMostViewReady(oEvent)
|
|
122
|
+
.then((oView: any) => {
|
|
123
|
+
// The autoFocus is initially disabled on the navContainer or the FCL, so that the focus stays on the Shell menu
|
|
124
|
+
// even if the app takes a long time to launch
|
|
125
|
+
// The first time the view is displayed, we need to enable the autofocus so that it's managed properly during navigation
|
|
126
|
+
const oRootControl = this.getView().getContent()[0] as any;
|
|
127
|
+
if (oRootControl && oRootControl.getAutoFocus && !oRootControl.getAutoFocus()) {
|
|
128
|
+
oRootControl.setProperty("autoFocus", true, true); // Do not mark the container as invalid, otherwise it's re-rendered
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const oAppComponent = this.getAppComponent();
|
|
132
|
+
this._scrollTablesToLastNavigatedItems();
|
|
133
|
+
if (oAppComponent.getEnvironmentCapabilities().getCapabilities().UShell) {
|
|
134
|
+
this._computeTitleHierarchy(oView);
|
|
135
|
+
}
|
|
136
|
+
const bForceFocus = oAppComponent.getRouterProxy().isFocusForced();
|
|
137
|
+
oAppComponent.getRouterProxy().setFocusForced(false); // reset
|
|
138
|
+
if (oView.getController() && oView.getController().onPageReady && oView.getParent().onPageReady) {
|
|
139
|
+
oView.getParent().onPageReady({ forceFocus: bForceFocus });
|
|
140
|
+
}
|
|
141
|
+
if (this.onContainerReady) {
|
|
142
|
+
this.onContainerReady();
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
.catch(function (oError: any) {
|
|
146
|
+
Log.error("An error occurs while computing the title hierarchy and calling focus method", oError);
|
|
147
|
+
})
|
|
148
|
+
.finally(() => {
|
|
149
|
+
this._oRouteMatchedPromise = null;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* This function returns the TitleHierarchy cache ( or initializes it if undefined).
|
|
156
|
+
*
|
|
157
|
+
* @name sap.fe.templates.RootContainer.controller.BaseController#_getTitleHierarchyCache
|
|
158
|
+
* @memberof sap.fe.templates.RootContainer.controller.BaseController
|
|
159
|
+
*
|
|
160
|
+
* @returns {object} The TitleHierarchy cache
|
|
161
|
+
*/
|
|
162
|
+
_getTitleHierarchyCache() {
|
|
163
|
+
if (!this.oTitleHierarchyCache) {
|
|
164
|
+
this.oTitleHierarchyCache = {};
|
|
165
|
+
}
|
|
166
|
+
return this.oTitleHierarchyCache;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* This function returns a titleInfo object.
|
|
171
|
+
*
|
|
172
|
+
* @memberof sap.fe.templates.RootContainer.controller.BaseController
|
|
173
|
+
* @param {*} title
|
|
174
|
+
* @param {*} subtitle
|
|
175
|
+
* @param {*} sIntent The intent path to be redirected to
|
|
176
|
+
* @returns {object} The title information
|
|
177
|
+
*/
|
|
178
|
+
_computeTitleInfo(title: any, subtitle: any, sIntent: any) {
|
|
179
|
+
const aParts = sIntent.split("/");
|
|
180
|
+
if (aParts[aParts.length - 1].indexOf("?") === -1) {
|
|
181
|
+
sIntent += "?restoreHistory=true";
|
|
182
|
+
} else {
|
|
183
|
+
sIntent += "&restoreHistory=true";
|
|
184
|
+
}
|
|
185
|
+
return {
|
|
186
|
+
title: title,
|
|
187
|
+
subtitle: subtitle,
|
|
188
|
+
intent: sIntent,
|
|
189
|
+
icon: ""
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Fetches the value of the HeaderInfo title for a given path.
|
|
195
|
+
*
|
|
196
|
+
* @param {string} sPath The path to the entity
|
|
197
|
+
* @returns {Promise} A promise containing the value of the title, or an empty string if no HeaderInfo title annotation is available
|
|
198
|
+
*/
|
|
199
|
+
_fetchTitleValue(sPath: string) {
|
|
200
|
+
const oAppComponent = this.getAppComponent(),
|
|
201
|
+
oModel = this.getView().getModel(),
|
|
202
|
+
oMetaModel = oAppComponent.getMetaModel(),
|
|
203
|
+
sMetaPath = oMetaModel.getMetaPath(sPath);
|
|
204
|
+
|
|
205
|
+
const sTitleExpression = AnnotationHelper.format(
|
|
206
|
+
oMetaModel.getObject(sMetaPath + "/@com.sap.vocabularies.UI.v1.HeaderInfo/Title/Value"),
|
|
207
|
+
{ context: oMetaModel.createBindingContext("/") as Context }
|
|
208
|
+
);
|
|
209
|
+
const oTitleExpression = BindingParser.complexParser(sTitleExpression);
|
|
210
|
+
|
|
211
|
+
if (oTitleExpression) {
|
|
212
|
+
const sTitlePath = oTitleExpression.parts ? oTitleExpression.parts[0].path : oTitleExpression.path;
|
|
213
|
+
const fnTitleFormatter = oTitleExpression.formatter;
|
|
214
|
+
const oBindingViewContext = oModel.createBindingContext(sPath);
|
|
215
|
+
const oPropertyBinding = oModel.bindProperty(sTitlePath, oBindingViewContext);
|
|
216
|
+
|
|
217
|
+
oPropertyBinding.initialize();
|
|
218
|
+
|
|
219
|
+
return new Promise(function (resolve: (value: any) => void) {
|
|
220
|
+
const fnChange = function (oEvent: any) {
|
|
221
|
+
const sTargetValue = fnTitleFormatter ? fnTitleFormatter(oEvent.getSource().getValue()) : oEvent.getSource().getValue();
|
|
222
|
+
|
|
223
|
+
oPropertyBinding.detachChange(fnChange);
|
|
224
|
+
resolve(sTargetValue);
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
oPropertyBinding.attachChange(fnChange);
|
|
228
|
+
});
|
|
229
|
+
} else {
|
|
230
|
+
return Promise.resolve("");
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
_getAppSpecificHash() {
|
|
235
|
+
// HashChanged isShellNavigationHashChanger
|
|
236
|
+
return (HashChanger.getInstance() as any).hrefForAppSpecificHash
|
|
237
|
+
? (HashChanger.getInstance() as any).hrefForAppSpecificHash("")
|
|
238
|
+
: "";
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
_getHash() {
|
|
242
|
+
return HashChanger.getInstance().getHash();
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* This function returns titleInformation from a path.
|
|
247
|
+
* It updates the cache to store Title Information if necessary
|
|
248
|
+
*
|
|
249
|
+
* @name sap.fe.templates.RootContainer.controller.BaseController#getTitleInfoFromPath
|
|
250
|
+
* @memberof sap.fe.templates.RootContainer.controller.BaseController
|
|
251
|
+
* @param {*} sPath path of the context to retrieve title information from MetaModel
|
|
252
|
+
*
|
|
253
|
+
* @returns {promise} oTitleinformation returned as promise
|
|
254
|
+
*/
|
|
255
|
+
|
|
256
|
+
getTitleInfoFromPath(sPath: any) {
|
|
257
|
+
const oTitleHierarchyCache = this._getTitleHierarchyCache();
|
|
258
|
+
|
|
259
|
+
if (oTitleHierarchyCache[sPath]) {
|
|
260
|
+
// The title info is already stored in the cache
|
|
261
|
+
return Promise.resolve(oTitleHierarchyCache[sPath]);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const oMetaModel = this.getAppComponent().getMetaModel();
|
|
265
|
+
const sEntityPath = oMetaModel.getMetaPath(sPath);
|
|
266
|
+
const sTypeName = oMetaModel.getObject(sEntityPath + "/@com.sap.vocabularies.UI.v1.HeaderInfo/TypeName");
|
|
267
|
+
const sAppSpecificHash = this._getAppSpecificHash();
|
|
268
|
+
const sIntent = sAppSpecificHash + sPath.slice(1);
|
|
269
|
+
|
|
270
|
+
return this._fetchTitleValue(sPath).then((sTitle: any) => {
|
|
271
|
+
const oTitleInfo = this._computeTitleInfo(sTypeName, sTitle, sIntent);
|
|
272
|
+
oTitleHierarchyCache[sPath] = oTitleInfo;
|
|
273
|
+
return oTitleInfo;
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Ensure that the ushell service receives all elements
|
|
278
|
+
* (title, subtitle, intent, icon) as strings.
|
|
279
|
+
*
|
|
280
|
+
* Annotation HeaderInfo allows for binding of title and description
|
|
281
|
+
* (which are used here as title and subtitle) to any element in the entity
|
|
282
|
+
* (being possibly types like boolean, timestamp, double, etc.)
|
|
283
|
+
*
|
|
284
|
+
* Creates a new hierarchy and converts non-string types to string.
|
|
285
|
+
*
|
|
286
|
+
* @param {*} aHierarchy Shell title hierarchy
|
|
287
|
+
* @returns {*} Copy of shell title hierarchy containing all elements as strings
|
|
288
|
+
*/
|
|
289
|
+
_ensureHierarchyElementsAreStrings(aHierarchy: any) {
|
|
290
|
+
const aHierarchyShell = [];
|
|
291
|
+
for (const level in aHierarchy) {
|
|
292
|
+
const oHierarchy = aHierarchy[level];
|
|
293
|
+
const oShellHierarchy: any = {};
|
|
294
|
+
for (const key in oHierarchy) {
|
|
295
|
+
oShellHierarchy[key] = typeof oHierarchy[key] !== "string" ? String(oHierarchy[key]) : oHierarchy[key];
|
|
296
|
+
}
|
|
297
|
+
aHierarchyShell.push(oShellHierarchy);
|
|
298
|
+
}
|
|
299
|
+
return aHierarchyShell;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
_getTargetTypeFromHash(sHash: any) {
|
|
303
|
+
const oAppComponent = this.getAppComponent();
|
|
304
|
+
let sTargetType = "";
|
|
305
|
+
|
|
306
|
+
const aRoutes = oAppComponent.getManifestEntry("/sap.ui5/routing/routes");
|
|
307
|
+
for (let j = 0; j < aRoutes.length; j++) {
|
|
308
|
+
const oRoute = oAppComponent.getRouter().getRoute(aRoutes[j].name);
|
|
309
|
+
if (oRoute.match(sHash)) {
|
|
310
|
+
const sTarget = Array.isArray(aRoutes[j].target) ? aRoutes[j].target[0] : aRoutes[j].target;
|
|
311
|
+
sTargetType = (oAppComponent.getRouter().getTarget(sTarget) as any)._oOptions.name;
|
|
312
|
+
break;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return sTargetType;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* This function is updating the shell title after each navigation.
|
|
321
|
+
*
|
|
322
|
+
* @memberof sap.fe.templates.RootContainer.controller.BaseController
|
|
323
|
+
* @param {*} oView The current view
|
|
324
|
+
* @returns {*} A Promise that is resolved when the menu is filled properly
|
|
325
|
+
*/
|
|
326
|
+
_computeTitleHierarchy(oView: any) {
|
|
327
|
+
const oAppComponent = this.getAppComponent(),
|
|
328
|
+
oContext = oView.getBindingContext(),
|
|
329
|
+
oCurrentPage = oView.getParent(),
|
|
330
|
+
aTitleInformationPromises = [],
|
|
331
|
+
sAppSpecificHash = this._getAppSpecificHash(),
|
|
332
|
+
sAppTitle = oAppComponent.getMetadata().getManifestEntry("sap.app").title || "",
|
|
333
|
+
sAppSubTitle = oAppComponent.getMetadata().getManifestEntry("sap.app").appSubTitle || "";
|
|
334
|
+
let oPageTitleInformation: any, sNewPath;
|
|
335
|
+
|
|
336
|
+
if (oCurrentPage && oCurrentPage._getPageTitleInformation) {
|
|
337
|
+
if (oContext) {
|
|
338
|
+
// If the first page of the application is a LR, use the title and subtitle from the manifest
|
|
339
|
+
if (this._getTargetTypeFromHash("") === "sap.fe.templates.ListReport") {
|
|
340
|
+
aTitleInformationPromises.push(Promise.resolve(this._computeTitleInfo(sAppTitle, sAppSubTitle, sAppSpecificHash)));
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// Then manage other pages
|
|
344
|
+
sNewPath = oContext.getPath();
|
|
345
|
+
const aPathParts = sNewPath.split("/");
|
|
346
|
+
let sPath = "";
|
|
347
|
+
|
|
348
|
+
aPathParts.shift(); // Remove the first segment (empty string) as it has been managed above
|
|
349
|
+
aPathParts.pop(); // Remove the last segment as it corresponds to the current page and shouldn't appear in the menu
|
|
350
|
+
|
|
351
|
+
aPathParts.forEach((sPathPart: any) => {
|
|
352
|
+
sPath += "/" + sPathPart;
|
|
353
|
+
const oMetaModel = oAppComponent.getMetaModel(),
|
|
354
|
+
sParameterPath = oMetaModel.getMetaPath(sPath),
|
|
355
|
+
bIsParameterized = oMetaModel.getObject(sParameterPath + "/@com.sap.vocabularies.Common.v1.ResultContext");
|
|
356
|
+
if (!bIsParameterized) {
|
|
357
|
+
aTitleInformationPromises.push(this.getTitleInfoFromPath(sPath));
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// Current page
|
|
363
|
+
oPageTitleInformation = oCurrentPage._getPageTitleInformation();
|
|
364
|
+
oPageTitleInformation = this._computeTitleInfo(
|
|
365
|
+
oPageTitleInformation.title,
|
|
366
|
+
oPageTitleInformation.subtitle,
|
|
367
|
+
sAppSpecificHash + this._getHash()
|
|
368
|
+
);
|
|
369
|
+
|
|
370
|
+
if (oContext) {
|
|
371
|
+
this._getTitleHierarchyCache()[sNewPath] = oPageTitleInformation;
|
|
372
|
+
} else {
|
|
373
|
+
this._getTitleHierarchyCache()[sAppSpecificHash] = oPageTitleInformation;
|
|
374
|
+
}
|
|
375
|
+
} else {
|
|
376
|
+
aTitleInformationPromises.push(Promise.reject("Title information missing in HeaderInfo"));
|
|
377
|
+
}
|
|
378
|
+
return Promise.all(aTitleInformationPromises)
|
|
379
|
+
.then((aTitleInfoHierarchy: any[]) => {
|
|
380
|
+
// workaround for shell which is expecting all elements being of type string
|
|
381
|
+
const aTitleInfoHierarchyShell = this._ensureHierarchyElementsAreStrings(aTitleInfoHierarchy),
|
|
382
|
+
sTitle = oPageTitleInformation.title;
|
|
383
|
+
oAppComponent.getShellServices().setHierarchy(aTitleInfoHierarchyShell.reverse());
|
|
384
|
+
oAppComponent.getShellServices().setTitle(sTitle);
|
|
385
|
+
})
|
|
386
|
+
.catch(function (sErrorMessage: any) {
|
|
387
|
+
Log.error(sErrorMessage);
|
|
388
|
+
})
|
|
389
|
+
.finally(() => {
|
|
390
|
+
this.bIsComputingTitleHierachy = false;
|
|
391
|
+
})
|
|
392
|
+
.catch(function (sErrorMessage: any) {
|
|
393
|
+
Log.error(sErrorMessage);
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
398
|
+
calculateLayout(iNextFCLLevel: number, sHash: string, sProposedLayout: string | undefined, keepCurrentLayout: boolean | undefined) {
|
|
399
|
+
return null;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Callback after a view has been bound to a context.
|
|
404
|
+
*
|
|
405
|
+
* @param {sap.ui.model.odata.v4.Context} oContext The context that has been bound to a view
|
|
406
|
+
*/
|
|
407
|
+
onContextBoundToView(oContext: any) {
|
|
408
|
+
if (oContext) {
|
|
409
|
+
const sDeepestPath = this.getView().getModel("internal").getProperty("/deepestPath"),
|
|
410
|
+
sViewContextPath = oContext.getPath();
|
|
411
|
+
|
|
412
|
+
if (!sDeepestPath || sDeepestPath.indexOf(sViewContextPath) !== 0) {
|
|
413
|
+
// There was no previous value for the deepest reached path, or the path
|
|
414
|
+
// for the view isn't a subpath of the previous deepest path --> update
|
|
415
|
+
(this.getView().getModel("internal") as JSONModel).setProperty("/deepestPath", sViewContextPath, undefined, true);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
421
|
+
displayMessagePage(sErrorMessage: any, mParameters: any): Promise<boolean> {
|
|
422
|
+
// To be overridden
|
|
423
|
+
return Promise.resolve(true);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
427
|
+
updateUIStateForView(oView: any, FCLLevel: any) {
|
|
428
|
+
// To be overriden
|
|
429
|
+
}
|
|
430
|
+
_scrollTablesToLastNavigatedItems(): void {
|
|
431
|
+
// To be overriden
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
interface RootContainerBaseController {
|
|
435
|
+
onContainerReady?(): void;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
export default RootContainerBaseController;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* SAP UI development toolkit for HTML5 (SAPUI5)
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
* (c) Copyright 2009-2021 SAP SE. All rights reserved
|
|
5
4
|
*/
|
|
6
|
-
sap.ui.define([], function() {
|
|
7
|
-
|
|
5
|
+
sap.ui.define([], function () {
|
|
6
|
+
"use strict";
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
8
|
+
var EditFLowExtensionOverride = {
|
|
9
|
+
setCreationMode: function (bCreationMode) {
|
|
10
|
+
var oUIModelContext = this.base.getView().getBindingContext("ui");
|
|
11
|
+
oUIModelContext.getModel().setProperty("createMode", bCreationMode, oUIModelContext, true);
|
|
12
|
+
|
|
13
|
+
if (this.getProgrammingModel() === "Sticky") {
|
|
14
|
+
oUIModelContext.getModel().setProperty("createModeSticky", this.getTransactionHelper()._bCreateMode, oUIModelContext, true);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
return EditFLowExtensionOverride;
|
|
19
|
+
}, false);
|
|
20
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkVkaXRGbG93LnRzIl0sIm5hbWVzIjpbIkVkaXRGTG93RXh0ZW5zaW9uT3ZlcnJpZGUiLCJzZXRDcmVhdGlvbk1vZGUiLCJiQ3JlYXRpb25Nb2RlIiwib1VJTW9kZWxDb250ZXh0IiwiYmFzZSIsImdldFZpZXciLCJnZXRCaW5kaW5nQ29udGV4dCIsImdldE1vZGVsIiwic2V0UHJvc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XRDcmVhdGlvbk1vZGU6IGZ1bmN0aW9uICh0aGlzOiBJbnRlcm5hbEVkaXRGbG93LCBiQ3JlYXRpb25Nb2RlOiBhbnkpIHtcblx0XHRjb25zdCBvVUlNb2RlbENvbnRleHQgPSB0aGlzLmJhc2UuZ2V0VmlldygpLmdldEJpbmRpbmdDb250ZXh0KFwidWlcIikgYXMgQ29udGV4dDtcblx0XHQob1VJTW9kZWxDb250ZXh0LmdldE1vZGVsKCkgYXMgSlNPTk1vZGVsKS5zZXRQcm9wZXJ0eShcImNyZWF0ZU1vZGVcIiwgYkNyZWF0aW9uTW9kZSwgb1VJTW9kZWxDb250ZXh0LCB0cnVlKTtcblx0XHRpZiAodGhpcy5nZXRQcm9ncmFtbWluZ01vZGVsKCkgPT09IFwiU3RpY2t5XCIpIHtcblx0XHRcdChvVUlNb2RlbENvbnRleHQuZ2V0TW9kZWwoKSBhcyBKU09OTW9kZWwpLnNldFByb3BlcnR5KFxuXHRcdFx0XHRcImNyZWF0ZU1vZGVTdGlja3lcIixcblx0XHRcdFx0dGhpcy5nZXRUcmFuc2FjdGlvbkhlbHBlcigpLl9iQ3JlYXRlTW9kZSxcblx0XHRcdFx0b1VJTW9kZWxDb250ZXh0LFxuXHRcdFx0XHR0cnVlXG5cdFx0XHQpO1xuXHRcdH1cblx0fVxufTtcblxuZXhwb3J0IGRlZmF1bHQgRWRpdEZMb3dFeHRlbnNpb25PdmVycmlkZTtcbiJdfQ==
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import InternalEditFlow from "sap/fe/core/controllerextensions/InternalEditFlow";
|
|
2
|
+
import Context from "sap/ui/model/Context";
|
|
3
|
+
import JSONModel from "sap/ui/model/json/JSONModel";
|
|
4
|
+
|
|
5
|
+
const EditFLowExtensionOverride = {
|
|
6
|
+
setCreationMode: function (this: InternalEditFlow, bCreationMode: any) {
|
|
7
|
+
const oUIModelContext = this.base.getView().getBindingContext("ui") as Context;
|
|
8
|
+
(oUIModelContext.getModel() as JSONModel).setProperty("createMode", bCreationMode, oUIModelContext, true);
|
|
9
|
+
if (this.getProgrammingModel() === "Sticky") {
|
|
10
|
+
(oUIModelContext.getModel() as JSONModel).setProperty(
|
|
11
|
+
"createModeSticky",
|
|
12
|
+
this.getTransactionHelper()._bCreateMode,
|
|
13
|
+
oUIModelContext,
|
|
14
|
+
true
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default EditFLowExtensionOverride;
|
|
@@ -1,62 +1,54 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* SAP UI development toolkit for HTML5 (SAPUI5)
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
* (c) Copyright 2009-2021 SAP SE. All rights reserved
|
|
5
4
|
*/
|
|
6
|
-
sap.ui.define(
|
|
7
|
-
|
|
8
|
-
function() {
|
|
9
|
-
"use strict";
|
|
5
|
+
sap.ui.define([], function () {
|
|
6
|
+
"use strict";
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
var TableScroller = {
|
|
9
|
+
/**
|
|
10
|
+
* Scrolls an MDC table to a given row, identified by its context path.
|
|
11
|
+
* If the row with the path can't be found, the table stays unchanged.
|
|
12
|
+
*
|
|
13
|
+
* @param {sap.ui.mdc.Table} oTable The table to be scrolled
|
|
14
|
+
* @param {string} sRowPath The path identifying the row to scroll to
|
|
15
|
+
*/
|
|
16
|
+
scrollTableToRow: function (oTable, sRowPath) {
|
|
17
|
+
var oTableRowBinding = oTable.getRowBinding();
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
var getTableContexts = function () {
|
|
20
|
+
if (oTable.data().tableType === "GridTable") {
|
|
21
|
+
return oTableRowBinding.getContexts(0);
|
|
22
|
+
} else {
|
|
23
|
+
return oTableRowBinding.getCurrentContexts();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
29
26
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (oTableRow) {
|
|
35
|
-
oTable.scrollToIndex(oTableRow.getIndex());
|
|
36
|
-
}
|
|
37
|
-
};
|
|
27
|
+
var findAndScroll = function () {
|
|
28
|
+
var oTableRow = getTableContexts().find(function (item) {
|
|
29
|
+
return item && item.getPath() === sRowPath;
|
|
30
|
+
});
|
|
38
31
|
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
if (oTableRow) {
|
|
33
|
+
oTable.scrollToIndex(oTableRow.getIndex());
|
|
34
|
+
}
|
|
35
|
+
};
|
|
41
36
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
oTableRowBindingContexts.some(function(context) {
|
|
45
|
-
return context === undefined;
|
|
46
|
-
})
|
|
47
|
-
) {
|
|
48
|
-
// The contexts are not loaded yet --> wait for a change event before scrolling
|
|
49
|
-
oTableRowBinding.attachEventOnce("dataReceived", findAndScroll);
|
|
50
|
-
} else {
|
|
51
|
-
// Contexts are already loaded --> we can try to scroll immediately
|
|
52
|
-
findAndScroll();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
};
|
|
37
|
+
if (oTableRowBinding) {
|
|
38
|
+
var oTableRowBindingContexts = getTableContexts();
|
|
57
39
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
);
|
|
40
|
+
if (oTableRowBindingContexts.length === 0 && oTableRowBinding.getLength() > 0 || oTableRowBindingContexts.some(function (context) {
|
|
41
|
+
return context === undefined;
|
|
42
|
+
})) {
|
|
43
|
+
// The contexts are not loaded yet --> wait for a change event before scrolling
|
|
44
|
+
oTableRowBinding.attachEventOnce("dataReceived", findAndScroll);
|
|
45
|
+
} else {
|
|
46
|
+
// Contexts are already loaded --> we can try to scroll immediately
|
|
47
|
+
findAndScroll();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
return TableScroller;
|
|
53
|
+
}, false);
|
|
54
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlRhYmxlU2Nyb2xsZXIudHMiXSwibmFtZXMiOlsiVGFibGVTY3JvbGxlciIsInNjcm9sbFRhYmxlVG9Sb3ciLCJvVGFibGUiLCJzUm93UGF0aCIsIm9UYWJsZVJvd0JpbmRpbmciLCJnZXRSb3dCaW5kaW5nIiwiZ2V0VGFibGVDb250ZXh0cyIsImRhdGEiLCJ0YWJsZVR5cGUiLCJnZXRDb250ZXh0cyIsImdldEN1cnJlbnRDb250ZXh0cyIsImZpbmRBbmRTY3JvbGwiLCJvVGFibGVSb3ciLCJmaW5kIiwiaXRlbSIsImdldFBhdGgiLCJzY3JvbGxUb0luZGV4IiwiZ2V0SW5kZXgiLCJvVGFibGVSb3dCaW5kaW5nQ29udGV4dHMiLCJsZW5ndGgiLCJnZXRMZW5ndGgiLCJzb21lIiwiY29udGV4dCIsInVuZGVmaW5lZCIsImF0dGFjaEV2ZW50T25jZSJdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTs7OztBQUZBLE1BQU1BLGFBQWEsR0FBRztBQUNyQjtBQUNEO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNDQyxJQUFBQSxnQkFBZ0IsRUFBRSxVQUFVQyxNQUFWLEVBQXVCQyxRQUF2QixFQUF5QztBQUMxRCxVQUFNQyxnQkFBZ0IsR0FBR0YsTUFBTSxDQUFDRyxhQUFQLEVBQXpCOztBQUVBLFVBQU1DLGdCQUFnQixHQUFHLFlBQVk7QUFDcEMsWUFBSUosTUFBTSxDQUFDSyxJQUFQLEdBQWNDLFNBQWQsS0FBNEIsV0FBaEMsRUFBNkM7QUFDNUM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gVGFibGVTY3JvbGxlcjtcbiJdfQ==
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const TableScroller = {
|
|
2
|
+
/**
|
|
3
|
+
* Scrolls an MDC table to a given row, identified by its context path.
|
|
4
|
+
* If the row with the path can't be found, the table stays unchanged.
|
|
5
|
+
*
|
|
6
|
+
* @param {sap.ui.mdc.Table} oTable The table to be scrolled
|
|
7
|
+
* @param {string} sRowPath The path identifying the row to scroll to
|
|
8
|
+
*/
|
|
9
|
+
scrollTableToRow: function (oTable: any, sRowPath: string) {
|
|
10
|
+
const oTableRowBinding = oTable.getRowBinding();
|
|
11
|
+
|
|
12
|
+
const getTableContexts = function () {
|
|
13
|
+
if (oTable.data().tableType === "GridTable") {
|
|
14
|
+
return oTableRowBinding.getContexts(0);
|
|
15
|
+
} else {
|
|
16
|
+
return oTableRowBinding.getCurrentContexts();
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const findAndScroll = function () {
|
|
21
|
+
const oTableRow = getTableContexts().find(function (item: any) {
|
|
22
|
+
return item && item.getPath() === sRowPath;
|
|
23
|
+
});
|
|
24
|
+
if (oTableRow) {
|
|
25
|
+
oTable.scrollToIndex(oTableRow.getIndex());
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
if (oTableRowBinding) {
|
|
30
|
+
const oTableRowBindingContexts = getTableContexts();
|
|
31
|
+
|
|
32
|
+
if (
|
|
33
|
+
(oTableRowBindingContexts.length === 0 && oTableRowBinding.getLength() > 0) ||
|
|
34
|
+
oTableRowBindingContexts.some(function (context: any) {
|
|
35
|
+
return context === undefined;
|
|
36
|
+
})
|
|
37
|
+
) {
|
|
38
|
+
// The contexts are not loaded yet --> wait for a change event before scrolling
|
|
39
|
+
oTableRowBinding.attachEventOnce("dataReceived", findAndScroll);
|
|
40
|
+
} else {
|
|
41
|
+
// Contexts are already loaded --> we can try to scroll immediately
|
|
42
|
+
findAndScroll();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default TableScroller;
|