@sapui5/sap.suite.ui.generic.template 1.129.1 → 1.130.1
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 -3
- package/src/sap/suite/ui/generic/template/.library +5 -1
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/Component.js +1 -1
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/controller/VisualFilterDialogController.js +1 -1
- package/src/sap/suite/ui/generic/template/AnalyticalListPage/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/Canvas/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/ListReport/Component.js +1 -1
- package/src/sap/suite/ui/generic/template/ListReport/controller/ControllerImplementation.js +22 -11
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_bg.properties +3 -3
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_hu.properties +1 -1
- package/src/sap/suite/ui/generic/template/ListReport/i18n/i18n_th.properties +1 -1
- package/src/sap/suite/ui/generic/template/ListReport/manifest.json +5 -2
- package/src/sap/suite/ui/generic/template/ListReport/view/fragments/DefaultVariant.fragment.xml +7 -8
- package/src/sap/suite/ui/generic/template/ListReport/view/fragments/MultipleViewsSingleTableMode.fragment.xml +4 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/Component.js +1 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/ObjectPage/templateSpecificPreparationHelper.js +90 -42
- package/src/sap/suite/ui/generic/template/ObjectPage/view/fragments/MultipleViewsSingleTableMode.fragment.xml +3 -0
- package/src/sap/suite/ui/generic/template/QuickCreate/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/QuickView/manifest.json +1 -1
- package/src/sap/suite/ui/generic/template/designtime/controls/SmartTable.designtime.js +379 -0
- package/src/sap/suite/ui/generic/template/designtime/{AnalyticalListPage.designtime.js → floorplans/AnalyticalListPage.designtime.js} +3 -3
- package/src/sap/suite/ui/generic/template/designtime/{ListReport.designtime.js → floorplans/ListReport.designtime.js} +3 -3
- package/src/sap/suite/ui/generic/template/designtime/{ObjectPage.designtime.js → floorplans/ObjectPage.designtime.js} +4 -5
- package/src/sap/suite/ui/generic/template/designtime/utils/designtimeHelper.js +119 -96
- package/src/sap/suite/ui/generic/template/designtime/utils/designtimeUtils.js +395 -0
- package/src/sap/suite/ui/generic/template/fragments/EasyFilter.fragment.xml +12 -17
- package/src/sap/suite/ui/generic/template/fragments/MessagePage.controller.js +16 -0
- package/src/sap/suite/ui/generic/template/fragments/MessagePopover.fragment.xml +16 -2
- package/src/sap/suite/ui/generic/template/fragments/SmartFormDataField.fragment.xml +2 -0
- package/src/sap/suite/ui/generic/template/genericUtilities/Link.js +9 -2
- package/src/sap/suite/ui/generic/template/js/AnnotationHelper.js +8 -4
- package/src/sap/suite/ui/generic/template/lib/AppComponent.js +10 -3
- package/src/sap/suite/ui/generic/template/lib/CommonEventHandlers.js +0 -42
- package/src/sap/suite/ui/generic/template/lib/CommonUtils.js +6 -1
- package/src/sap/suite/ui/generic/template/lib/MessageButtonHelper.js +11 -7
- package/src/sap/suite/ui/generic/template/lib/RetryAfterHandler.js +249 -0
- package/src/sap/suite/ui/generic/template/lib/ShareUtils.js +1 -1
- package/src/sap/suite/ui/generic/template/lib/SideEffectUtil.js +64 -3
- package/src/sap/suite/ui/generic/template/lib/StableIdDefinition.js +7 -0
- package/src/sap/suite/ui/generic/template/lib/ai/EasyFilterBarHandler.js +210 -74
- package/src/sap/suite/ui/generic/template/lib/ai/ErrorExplanationHelper.js +47 -0
- package/src/sap/suite/ui/generic/template/lib/ai/FioriAIHandler.js +10 -3
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n.properties +31 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ar.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_bg.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ca.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cnr.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cs.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_cy.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_da.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_de.properties +3 -1
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_el.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_en.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_en_GB.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_en_US_saprigi.properties +1 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_es.properties +4 -2
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_es_MX.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_et.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fi.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fr.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_fr_CA.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hi.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hr.properties +3 -1
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_hu.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_id.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_it.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_iw.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ja.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_kk.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ko.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_lt.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_lv.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_mk.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ms.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_nl.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_no.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pl.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pt.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_pt_PT.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ro.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_ru.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sh.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sk.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sl.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sr.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_sv.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_th.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_tr.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_uk.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_vi.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_zh_CN.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/i18n/i18n_zh_TW.properties +2 -0
- package/src/sap/suite/ui/generic/template/lib/navigation/NavigationController.js +5 -3
- package/src/sap/suite/ui/generic/template/library.js +3 -1
- package/src/sap/suite/ui/generic/template/listTemplates/fragments/MultipleViewsSingleTableMode.fragment.xml +6 -2
- package/src/sap/suite/ui/generic/template/manifestMerger/ChangePageConfiguration.js +28 -23
- package/src/sap/suite/ui/generic/template/manifestMerger/MergerUtil.js +6 -6
- package/src/sap/suite/ui/generic/template/themes/base/base.less +0 -4
- package/ui5.yaml +1 -0
|
@@ -1,42 +1,44 @@
|
|
|
1
|
-
sap.ui.define(["sap/base/util/extend", "sap/base/util/deepExtend", "sap/base/util/merge", "sap/suite/ui/generic/template/genericUtilities/FeLogger"
|
|
1
|
+
sap.ui.define(["sap/base/util/extend", "sap/base/util/deepExtend", "sap/base/util/merge", "sap/suite/ui/generic/template/genericUtilities/FeLogger",
|
|
2
|
+
"sap/suite/ui/generic/template/designtime/controls/SmartTable.designtime"
|
|
3
|
+
], function (extend, deepExtend, merge, FeLogger,SmartTableDesigntimeHelper) {
|
|
2
4
|
"use strict";
|
|
3
5
|
|
|
4
6
|
/*
|
|
5
7
|
* The main task of this class is to translate the allowList (defined in internal format) into a designtime that ensures, that only the changes according to the allow list are possible (with tool
|
|
6
8
|
* support - manually, it's always possible to create arbitrary change files).
|
|
7
|
-
*
|
|
8
|
-
* To achieve this, it's necessary to read the designtime for all affected controls and check the changes that would be allowed without our intervention. This is caused by the fact, that the UI
|
|
9
|
-
* adaptation tooling combines designtime provided from different sources (control itself, inherited, propagated, or set in view) in a disjunktive way (any change defined in one of the sources is
|
|
10
|
-
* allowed), which contradicts the need to only allow changes that actually can work correctly with the framework code. However, with propagation one can either disallow e.g. all actions for one
|
|
11
|
-
* control (this doesn't help, is control provides several actions, but we can only allow some of them), or to explicitly disallow a single action. To use this latter possibility, the name of
|
|
12
|
-
* that action needs to be known. As controls can add new actions with upcoming releases without our interaction, we read all actions from base designtimes, and disallow everything not mentioned
|
|
9
|
+
*
|
|
10
|
+
* To achieve this, it's necessary to read the designtime for all affected controls and check the changes that would be allowed without our intervention. This is caused by the fact, that the UI
|
|
11
|
+
* adaptation tooling combines designtime provided from different sources (control itself, inherited, propagated, or set in view) in a disjunktive way (any change defined in one of the sources is
|
|
12
|
+
* allowed), which contradicts the need to only allow changes that actually can work correctly with the framework code. However, with propagation one can either disallow e.g. all actions for one
|
|
13
|
+
* control (this doesn't help, is control provides several actions, but we can only allow some of them), or to explicitly disallow a single action. To use this latter possibility, the name of
|
|
14
|
+
* that action needs to be known. As controls can add new actions with upcoming releases without our interaction, we read all actions from base designtimes, and disallow everything not mentioned
|
|
13
15
|
* in our internal allow list. To ensure that the designtime we provide is not overridden again, we only provide designtime for the top level, and propagate it from there to all controls.
|
|
14
|
-
*
|
|
16
|
+
*
|
|
15
17
|
* (If a FE app is run inside some surrounding application (like e.g. unified inbox), they still could use the same technique, ropagate different metadata and thus allow additional changes. But if
|
|
16
|
-
* that would break anything, it would also be in the responsibility of that surrounding application.)
|
|
17
|
-
*
|
|
18
|
+
* that would break anything, it would also be in the responsibility of that surrounding application.)
|
|
19
|
+
*
|
|
18
20
|
* Reading the base designtime is only possible asynchronously, but the propagateMetadata callback needs to provide the designtime data synchronously. The designtime (of the view) itself however
|
|
19
21
|
* can be provided asynchronously (i.e. returning a promise resolving to the designtime). Thus we need to read the base designtime for all controls already when the view designtime is requested,
|
|
20
22
|
* and only resolve the promise after we got all the base designtime data.
|
|
21
23
|
*
|
|
22
24
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
|
|
26
|
+
|
|
25
27
|
/*
|
|
26
28
|
* Todos / problems:
|
|
27
|
-
* - multiple propagation (a propagates metadata to b that contain a propagation method propagating to c)
|
|
29
|
+
* - multiple propagation (a propagates metadata to b that contain a propagation method propagating to c)
|
|
28
30
|
* - hierarchy via getParent is not identical to via getAggregation (check, whether this creates a problem)
|
|
29
31
|
* - [solved] generic getter (getAggregation) on control instance is not reliable - use generic getter on metadata instead (oControl.getMetadata().getAggregation(sAggregation).get(oControl))
|
|
30
32
|
* Example: ObjectPage.getAggregation("headerContent")
|
|
31
33
|
* - private/hidden Aggregation not provided in getMetadata().getAllAggregations, but used for propagation
|
|
32
34
|
* Example: ObjectPage.getAggregation("_anchorBar")
|
|
33
|
-
* Solution idea: build designTime top-down (like sap/ui/dt/DesignTime does) instead of bottm-up (current logic here)
|
|
34
|
-
* Problems:
|
|
35
|
+
* Solution idea: build designTime top-down (like sap/ui/dt/DesignTime does) instead of bottm-up (current logic here)
|
|
36
|
+
* Problems:
|
|
35
37
|
* - How to know which descendants to propagate to?
|
|
36
38
|
* - ensure correct order of propagation
|
|
37
|
-
* - when to call getAggregation on instance directly (needed if aggregation is not defined) and when to use metadata method
|
|
39
|
+
* - when to call getAggregation on instance directly (needed if aggregation is not defined) and when to use metadata method
|
|
38
40
|
*/
|
|
39
|
-
|
|
41
|
+
|
|
40
42
|
var mControlInfo = {};
|
|
41
43
|
var aViews = [];
|
|
42
44
|
var oLogger = new FeLogger("designtime.utils.designTimeHelper").getLogger();
|
|
@@ -48,12 +50,12 @@ sap.ui.define(["sap/base/util/extend", "sap/base/util/deepExtend", "sap/base/uti
|
|
|
48
50
|
*/
|
|
49
51
|
function loadBaseDesigntime(){
|
|
50
52
|
var aPromises = [];
|
|
51
|
-
|
|
53
|
+
|
|
52
54
|
function addToControlInfo(oControl){
|
|
53
55
|
if (mControlInfo[oControl.getId()]){
|
|
54
56
|
return;
|
|
55
57
|
}
|
|
56
|
-
|
|
58
|
+
|
|
57
59
|
var oControlInfo = {};
|
|
58
60
|
mControlInfo[oControl.getId()] = oControlInfo;
|
|
59
61
|
oControlInfo.designTimePromise = oControl.getMetadata().loadDesignTime(oControl);
|
|
@@ -62,12 +64,12 @@ sap.ui.define(["sap/base/util/extend", "sap/base/util/deepExtend", "sap/base/uti
|
|
|
62
64
|
oControlInfo.designTime = oDesignTime;
|
|
63
65
|
});
|
|
64
66
|
}
|
|
65
|
-
|
|
67
|
+
|
|
66
68
|
function findPreceedingKnownNode(oNode){
|
|
67
69
|
// ignore empty node or id. If node is not known and has no parent, we cannot find control it belongs to (can hopefully not be relevant)
|
|
68
|
-
return !oNode || !oNode.id || mControlInfo[oNode.id] ? oNode : oNode.parentNode && findPreceedingKnownNode(oNode.parentNode)
|
|
70
|
+
return !oNode || !oNode.id || mControlInfo[oNode.id] ? oNode : oNode.parentNode && findPreceedingKnownNode(oNode.parentNode);
|
|
69
71
|
}
|
|
70
|
-
|
|
72
|
+
|
|
71
73
|
// Assumption: Enough to start with template views and find all aggregated objects
|
|
72
74
|
// for later added controls: enough to add listener on those views, react if related Node is a known control, and recheck all aggregated objects of that control
|
|
73
75
|
document.querySelectorAll(".sapUiXMLView").forEach(function(oTopNode){
|
|
@@ -76,12 +78,12 @@ sap.ui.define(["sap/base/util/extend", "sap/base/util/deepExtend", "sap/base/uti
|
|
|
76
78
|
// deeper layers
|
|
77
79
|
// first two conditions should actually not occur, but if so, evaluating the third would break
|
|
78
80
|
if (!oView || !(oView instanceof sap.ui.core.mvc.XMLView) || !(oView.getController() instanceof sap.suite.ui.generic.template.lib.TemplateViewController)){return;}
|
|
79
|
-
|
|
81
|
+
|
|
80
82
|
aViews.push(oView);
|
|
81
|
-
|
|
83
|
+
|
|
82
84
|
oView.findAggregatedObjects(true).forEach(addToControlInfo);
|
|
83
|
-
|
|
84
|
-
// if anything is added later (e.g. for dynamic multi edit dialog, fields are added in js code), we need to retrieve the corresponding designtime
|
|
85
|
+
|
|
86
|
+
// if anything is added later (e.g. for dynamic multi edit dialog, fields are added in js code), we need to retrieve the corresponding designtime
|
|
85
87
|
// Create a MutationObserver instance to observe mutations
|
|
86
88
|
var fnMutationCallback = function (mutationsList) {
|
|
87
89
|
mutationsList.forEach(function (mutation) {
|
|
@@ -104,8 +106,8 @@ sap.ui.define(["sap/base/util/extend", "sap/base/util/deepExtend", "sap/base/uti
|
|
|
104
106
|
oMutationObserver.observe(oTopNode, oMutationObserverConfig);
|
|
105
107
|
}
|
|
106
108
|
});
|
|
107
|
-
|
|
108
|
-
|
|
109
|
+
|
|
110
|
+
|
|
109
111
|
return Promise.all(aPromises);
|
|
110
112
|
}
|
|
111
113
|
function fnStopMutationObserver() {
|
|
@@ -125,17 +127,17 @@ sap.ui.define(["sap/base/util/extend", "sap/base/util/deepExtend", "sap/base/uti
|
|
|
125
127
|
}
|
|
126
128
|
var oUrlParserPromise = UShellContainer.getServiceAsync("URLParsing"),
|
|
127
129
|
oFLPUrlPromise = UShellContainer.getFLPUrlAsync(true);
|
|
128
|
-
|
|
130
|
+
|
|
129
131
|
Promise.allSettled([oUrlParserPromise, oFLPUrlPromise]).then(function (aResult){
|
|
130
132
|
var oUrlParser = aResult[0].value,
|
|
131
133
|
sFLPUrl = aResult[1].value;
|
|
132
|
-
|
|
134
|
+
|
|
133
135
|
if (!oUrlParser) {
|
|
134
136
|
oLogger.error("Problem while getting URLParsing service", aResult[0].reason);
|
|
135
137
|
fnResolve(false);
|
|
136
138
|
return;
|
|
137
139
|
}
|
|
138
|
-
|
|
140
|
+
|
|
139
141
|
if (!sFLPUrl) {
|
|
140
142
|
oLogger.error("Problem while getting FLP URL", aResult[1].reason);
|
|
141
143
|
fnResolve(false);
|
|
@@ -143,21 +145,20 @@ sap.ui.define(["sap/base/util/extend", "sap/base/util/deepExtend", "sap/base/uti
|
|
|
143
145
|
}
|
|
144
146
|
|
|
145
147
|
var oUrlParams = oUrlParser.parseParameters(sFLPUrl),
|
|
146
|
-
sRtaModeValue = oUrlParams[RTA_MODE_URL_PARAM_KEY] && oUrlParams[RTA_MODE_URL_PARAM_KEY][0]
|
|
147
|
-
|
|
148
|
-
fnResolve(bRtaModeValue);
|
|
148
|
+
sRtaModeValue = oUrlParams[RTA_MODE_URL_PARAM_KEY] && oUrlParams[RTA_MODE_URL_PARAM_KEY][0];
|
|
149
|
+
fnResolve(sRtaModeValue);
|
|
149
150
|
});
|
|
150
151
|
});
|
|
151
152
|
}
|
|
152
153
|
|
|
153
154
|
/*
|
|
154
|
-
* Returns the branch of the control tree as an array ordered from bottom to top, if the control is relevant (i.e. direct part of a template view). I.e. the first entry of the array is the
|
|
155
|
+
* Returns the branch of the control tree as an array ordered from bottom to top, if the control is relevant (i.e. direct part of a template view). I.e. the first entry of the array is the
|
|
155
156
|
* control itself, the last one is an XMLView (with a controller of type TemplateViewController). "direct" means, no other XMLViews are in between.
|
|
156
|
-
* If control is not relevant (i.e. not part of a view, or part of a different view), returns undefined.
|
|
157
|
+
* If control is not relevant (i.e. not part of a view, or part of a different view), returns undefined.
|
|
157
158
|
*/
|
|
158
159
|
function getAncestors(oControl){
|
|
159
160
|
var aAncestors = [oControl];
|
|
160
|
-
|
|
161
|
+
|
|
161
162
|
while (!(oControl instanceof sap.ui.core.mvc.XMLView)){
|
|
162
163
|
oControl = oControl.getParent();
|
|
163
164
|
if (!oControl){
|
|
@@ -166,15 +167,15 @@ sap.ui.define(["sap/base/util/extend", "sap/base/util/deepExtend", "sap/base/uti
|
|
|
166
167
|
}
|
|
167
168
|
aAncestors.push(oControl);
|
|
168
169
|
}
|
|
169
|
-
|
|
170
|
+
|
|
170
171
|
if (!(oControl.getController() instanceof sap.suite.ui.generic.template.lib.TemplateViewController)){
|
|
171
172
|
// next view up the hierarchy not a template component (could e.g. be an extension) => no need to propagate designtime
|
|
172
173
|
return;
|
|
173
174
|
}
|
|
174
175
|
return aAncestors;
|
|
175
|
-
|
|
176
|
+
|
|
176
177
|
}
|
|
177
|
-
|
|
178
|
+
|
|
178
179
|
/*
|
|
179
180
|
* check, whether oDescendant is contained in the subtree starting with oAncestor (including oAncestor)
|
|
180
181
|
*/
|
|
@@ -182,21 +183,21 @@ sap.ui.define(["sap/base/util/extend", "sap/base/util/deepExtend", "sap/base/uti
|
|
|
182
183
|
// in some cases (e.g. table with no data), oAncestor is not a control (but simply a string) - in that case, it cannot be the one we are searching for
|
|
183
184
|
return oAncestor === oDescendant || (oAncestor.findAggregatedObjects && oAncestor.findAggregatedObjects(true).includes(oDescendant));
|
|
184
185
|
}
|
|
185
|
-
|
|
186
|
+
|
|
186
187
|
/*
|
|
187
188
|
* Determine name of aggregation of oAncestor to which (the subtree containing) oDescendant belongs
|
|
188
189
|
*/
|
|
189
190
|
function getAncestorAggregationName(oAncestorInfo, oDescendant){
|
|
190
|
-
/*
|
|
191
|
+
/*
|
|
191
192
|
* Metadata propagation can be done directly from any ancestor to any descendant (skipping any levels in between - like we also do directly from view down to the controls). Thus, to build the
|
|
192
193
|
* base designtime (the resulting designtime if we would not interfere), we need to analyze propagation from any layer in between. Propagation is bound to an aggregation, so we need to find the
|
|
193
194
|
* aggregation of the ancestor control to which the descendant control belongs (directly or indirectly)
|
|
194
195
|
*/
|
|
195
|
-
|
|
196
|
+
|
|
196
197
|
// some controls use aggregations not defined in their metadata (but provide designtime propagation for them). Example: ObjectPage: _anchorBar
|
|
197
198
|
// aggregations not mentioned in designtime are anyway not used for propagation
|
|
198
199
|
var aAllAggregations = Object.keys(mControlInfo[oAncestorInfo.sAncestorId].designTime.aggregations);
|
|
199
|
-
|
|
200
|
+
|
|
200
201
|
return aAllAggregations.find(function(sAggregation){
|
|
201
202
|
// Remark: generic getter getAggregation on control instance is not reliable - but generic getter on metadata (passing control instance) is!
|
|
202
203
|
// howver, generic getter is not available, if aggregation is not declared in metadata => in that case, fall back to getAggregation on control instance
|
|
@@ -209,47 +210,47 @@ sap.ui.define(["sap/base/util/extend", "sap/base/util/deepExtend", "sap/base/uti
|
|
|
209
210
|
}
|
|
210
211
|
});
|
|
211
212
|
}
|
|
212
|
-
|
|
213
|
-
|
|
213
|
+
|
|
214
|
+
|
|
214
215
|
function getBaseDesignTime(oControl){
|
|
215
216
|
if (oControl instanceof sap.ui.core.mvc.XMLView){
|
|
216
217
|
/*
|
|
217
218
|
* There's no (relevant) designtime for views:
|
|
218
219
|
* - For a view of a template component, we are defining the designtime directly, so no need to propagate to it (and actually waiting for a base designtime would cause infinite waiting)
|
|
219
|
-
* - Other views could be created for reuse components or extensions - in these cases, the owners are responsible for providing corresponding designtime (a change on any control within the
|
|
220
|
+
* - Other views could be created for reuse components or extensions - in these cases, the owners are responsible for providing corresponding designtime (a change on any control within the
|
|
220
221
|
* reuse component or extension would not directly break any of our logic, as we don't know these controls. It still could indirectly break sth. - but then reuse component or extension
|
|
221
222
|
* would be in charge)
|
|
222
223
|
*/
|
|
223
224
|
return;
|
|
224
225
|
}
|
|
225
|
-
|
|
226
|
+
|
|
226
227
|
var oControlInfo = mControlInfo[oControl.getId()];
|
|
227
|
-
|
|
228
|
+
|
|
228
229
|
if (!oControlInfo || (oControlInfo.designTimePromise && !oControlInfo.designTime)){
|
|
229
230
|
// either the control is not known at all to us (i.e. not even added to the DOM) or we are still waiting to retrieve its designtime. Assumption: This can only happen, if
|
|
230
|
-
// the control is just added by UI adaptation. In this case, we don't need to interfere - thus we should just return an empty designtime. This can be achieved by
|
|
231
|
-
// returning faulthy here - an empty object in contrast would an empty base designTime, which would be matched with an empty allow list - thus not allowing anything.
|
|
231
|
+
// the control is just added by UI adaptation. In this case, we don't need to interfere - thus we should just return an empty designtime. This can be achieved by
|
|
232
|
+
// returning faulthy here - an empty object in contrast would an empty base designTime, which would be matched with an empty allow list - thus not allowing anything.
|
|
232
233
|
return;
|
|
233
234
|
}
|
|
234
|
-
|
|
235
|
-
|
|
235
|
+
|
|
236
|
+
|
|
236
237
|
var oBaseDesignTime = deepExtend({}, oControlInfo.designTime);
|
|
237
238
|
// not only designTime of control itself relevant, but also everything that is propagated from ancestors
|
|
238
239
|
// => determine all ancestors
|
|
239
|
-
|
|
240
|
+
|
|
240
241
|
var aAncestors = getAncestors(oControl);
|
|
241
|
-
|
|
242
|
+
|
|
242
243
|
/* If no ancestors found, control is not relevant for FE, thus we must not change the designtime. This can be achieved by taking empty designtime as base. Don't take empty array instead - this
|
|
243
244
|
* would only ignore everything propagated to the control, but still take designtime defined on control itself as base, thus disallow everything defined directly.
|
|
244
245
|
*/
|
|
245
246
|
if (!aAncestors) {return;}
|
|
246
|
-
|
|
247
|
+
|
|
247
248
|
// We need only those ancestors propagting metadata to the aggregation containing the given control.
|
|
248
249
|
// The control itself obviously cannot propagate
|
|
249
250
|
aAncestors.shift();
|
|
250
251
|
// The view (of a template component) does propagate metadata, here we are actually inside this propagation, thus executing it here would create an endless loop
|
|
251
252
|
aAncestors.pop();
|
|
252
|
-
|
|
253
|
+
|
|
253
254
|
// build map with information about ancestors - as a 1. step only id is added
|
|
254
255
|
var aAncestorInfo = aAncestors.map(function(oAncestor){
|
|
255
256
|
return {
|
|
@@ -262,7 +263,7 @@ sap.ui.define(["sap/base/util/extend", "sap/base/util/deepExtend", "sap/base/uti
|
|
|
262
263
|
aAncestorInfo = aAncestorInfo.filter(function(oAncestorInfo){
|
|
263
264
|
return mControlInfo[oAncestorInfo.sAncestorId] && mControlInfo[oAncestorInfo.sAncestorId].designTime && mControlInfo[oAncestorInfo.sAncestorId].designTime.aggregations;
|
|
264
265
|
});
|
|
265
|
-
|
|
266
|
+
|
|
266
267
|
// determine corresponding aggregation name
|
|
267
268
|
aAncestorInfo.forEach(function(oAncestorInfo){
|
|
268
269
|
oAncestorInfo.sAggregation = getAncestorAggregationName(oAncestorInfo, oControl);
|
|
@@ -270,74 +271,74 @@ sap.ui.define(["sap/base/util/extend", "sap/base/util/deepExtend", "sap/base/uti
|
|
|
270
271
|
|
|
271
272
|
// filter for those ancestors actually propagating metadata to the corresponding aggregation
|
|
272
273
|
oControlInfo.pedigree = aAncestorInfo.filter(function(oAncestorInfo){
|
|
273
|
-
return mControlInfo[oAncestorInfo.sAncestorId] && mControlInfo[oAncestorInfo.sAncestorId].designTime.aggregations && mControlInfo[oAncestorInfo.sAncestorId].designTime.aggregations[oAncestorInfo.sAggregation]
|
|
274
|
+
return mControlInfo[oAncestorInfo.sAncestorId] && mControlInfo[oAncestorInfo.sAncestorId].designTime.aggregations && mControlInfo[oAncestorInfo.sAncestorId].designTime.aggregations[oAncestorInfo.sAggregation]
|
|
274
275
|
&& mControlInfo[oAncestorInfo.sAncestorId].designTime.aggregations[oAncestorInfo.sAggregation].propagateMetadata;
|
|
275
276
|
});
|
|
276
|
-
|
|
277
|
-
//
|
|
277
|
+
|
|
278
|
+
//
|
|
278
279
|
oBaseDesignTime = oControlInfo.pedigree.reduce(function(oDesignTime, oAncestorInfo){
|
|
279
|
-
/* Todo: Theoretically, also indirect propagation coudl be possible, i.e. A could propgate metadata to B, including propagation to C. In general, this seems to be superfluous (A could
|
|
280
|
-
* directly propagate the same to C, as propagation is deep), and not used. If it would be used however, to be on the save side, we should not use the designtime directly defined on the
|
|
281
|
-
* ancestor (i.e. from mControlInfo), but rather the resulting designtime after propagation from above.
|
|
282
|
-
* One possibility could be to call getBaseDesigntime (i.e. this method) recursively. This recursion would end, as we removed the control itself from the ancestors - but we would do the same
|
|
280
|
+
/* Todo: Theoretically, also indirect propagation coudl be possible, i.e. A could propgate metadata to B, including propagation to C. In general, this seems to be superfluous (A could
|
|
281
|
+
* directly propagate the same to C, as propagation is deep), and not used. If it would be used however, to be on the save side, we should not use the designtime directly defined on the
|
|
282
|
+
* ancestor (i.e. from mControlInfo), but rather the resulting designtime after propagation from above.
|
|
283
|
+
* One possibility could be to call getBaseDesigntime (i.e. this method) recursively. This recursion would end, as we removed the control itself from the ancestors - but we would do the same
|
|
283
284
|
* analysis (determining ancestors) over and again within a quadratic function. (In the example, we would first determine A and B as ancestors of C, then (again) A being ancestor of B to).
|
|
284
|
-
* Another idea would be to reverse the ancestor tree, to call the propagation top down. However, this would also need to be quadratic - in a hierarchy A -> B -> C -> D, A could also
|
|
285
|
+
* Another idea would be to reverse the ancestor tree, to call the propagation top down. However, this would also need to be quadratic - in a hierarchy A -> B -> C -> D, A could also
|
|
285
286
|
* propagate metadata to C containing a propagation method relevant for D.
|
|
286
|
-
* Third (probably best) idea would be store any calculated baseDesignTime additionally in mControlInfo and use propagation method from there (if existing - otherwise determine
|
|
287
|
+
* Third (probably best) idea would be store any calculated baseDesignTime additionally in mControlInfo and use propagation method from there (if existing - otherwise determine
|
|
287
288
|
* baseDesigntime first). As we are asked for propagation also in a top-down order, baseDesigntime should already be available for all ancestors, thus reducing our effort to be linear (while
|
|
288
|
-
* overall, it would still be quadratic over depth of control tree - but at least not cubic!). Open: Should we already trigger calculating besaDesigntime in that case for all controls as
|
|
289
|
+
* overall, it would still be quadratic over depth of control tree - but at least not cubic!). Open: Should we already trigger calculating besaDesigntime in that case for all controls as
|
|
289
290
|
* soon as all directly defined designtimes are retrieved, or wait for propagation to be called?)
|
|
290
291
|
*/
|
|
291
292
|
return merge(oDesignTime, mControlInfo[oAncestorInfo.sAncestorId].designTime.aggregations[oAncestorInfo.sAggregation].propagateMetadata(oControl, oAncestorInfo.oAncestor));
|
|
292
|
-
}, oBaseDesignTime);
|
|
293
|
-
|
|
293
|
+
}, oBaseDesignTime);
|
|
294
|
+
|
|
294
295
|
return oBaseDesignTime;
|
|
295
|
-
}
|
|
296
|
-
|
|
296
|
+
}
|
|
297
|
+
|
|
297
298
|
function getReducedDesignTime(oControl, oAllow){
|
|
298
299
|
var oBaseDesignTime = getBaseDesignTime(oControl);
|
|
299
300
|
/*
|
|
300
301
|
* If no base designTime at all, control is not relevant for FE (part of extension/reuse component (or not added to the view at all)): In this case, we must not reduce any possibilities, thus
|
|
301
|
-
* not returning a desginTime at all (not even for properties)
|
|
302
|
+
* not returning a desginTime at all (not even for properties)
|
|
302
303
|
*/
|
|
303
304
|
if (!oBaseDesignTime) {return;}
|
|
304
|
-
|
|
305
|
+
|
|
305
306
|
var oResult = Object.create(null);
|
|
306
|
-
|
|
307
|
+
|
|
307
308
|
if (oBaseDesignTime.actions && typeof oBaseDesignTime.actions === "object"){ // typeof null is object, but we need to treat it like no object
|
|
308
|
-
oResult.actions = Object.create(null);
|
|
309
|
+
oResult.actions = Object.create(null);
|
|
309
310
|
// if "real" object, we can take over all actions according to our allow list. Setting all others to "not-adaptable" (although this might not be an expected string at this place)
|
|
310
311
|
for (var sAction in oBaseDesignTime.actions){
|
|
311
312
|
oResult.actions[sAction] = oAllow && oAllow.actions && oAllow.actions.includes(sAction) ? oBaseDesignTime.actions[sAction] : null;
|
|
312
313
|
}
|
|
313
314
|
} else {
|
|
314
315
|
/* If base designtime actions is not an object, take over from base.
|
|
315
|
-
* Note: null and "not-adaptable" (which are the two typcial non-object values) are interpreted differently: While null as expected only affects actions (but is treated differently then
|
|
316
|
+
* Note: null and "not-adaptable" (which are the two typcial non-object values) are interpreted differently: While null as expected only affects actions (but is treated differently then
|
|
316
317
|
* deleting this property (maybe also then undefined), "not-adaptable" also invalidates everything else in the designtime! (I.e. just because designtime says actions are not adaptable (which
|
|
317
|
-
* should ideally be relevant only in key user scenario), also no property changes are possible (which is relevant in design time adaption))
|
|
318
|
+
* should ideally be relevant only in key user scenario), also no property changes are possible (which is relevant in design time adaption))
|
|
318
319
|
*/
|
|
319
320
|
oResult.actions = oBaseDesignTime.actions;
|
|
320
321
|
}
|
|
321
322
|
|
|
322
|
-
oResult.aggregations = Object.create(null);
|
|
323
|
+
oResult.aggregations = Object.create(null);
|
|
323
324
|
for (var sAggregation in oBaseDesignTime.aggregations){
|
|
324
325
|
oResult.aggregations[sAggregation] = {
|
|
325
326
|
actions: Object.create(null)
|
|
326
327
|
};
|
|
327
328
|
for (var sAction in oBaseDesignTime.aggregations[sAggregation].actions){
|
|
328
|
-
oResult.aggregations[sAggregation].actions[sAction] = oAllow
|
|
329
|
-
&& oAllow.aggregations
|
|
330
|
-
&& oAllow.aggregations[sAggregation]
|
|
331
|
-
&& oAllow.aggregations[sAggregation].actions
|
|
329
|
+
oResult.aggregations[sAggregation].actions[sAction] = oAllow
|
|
330
|
+
&& oAllow.aggregations
|
|
331
|
+
&& oAllow.aggregations[sAggregation]
|
|
332
|
+
&& oAllow.aggregations[sAggregation].actions
|
|
332
333
|
&& oAllow.aggregations[sAggregation].actions.includes(sAction) ? oBaseDesignTime.aggregations[sAggregation].actions[sAction] : null;
|
|
333
334
|
}
|
|
334
335
|
}
|
|
335
|
-
|
|
336
|
+
|
|
336
337
|
/*
|
|
337
|
-
* Unlike actions, properties (only relevant for dsign time adaptation / level 0) are allowed in general (i.e. if not specified as to be ignored) - thus we need to specify all properties, not
|
|
338
|
+
* Unlike actions, properties (only relevant for dsign time adaptation / level 0) are allowed in general (i.e. if not specified as to be ignored) - thus we need to specify all properties, not
|
|
338
339
|
* only what is mentioned in original designtime. However, if a property is already ignored from original designtime, we should not override this.
|
|
339
340
|
*/
|
|
340
|
-
oResult.properties = Object.create(null);
|
|
341
|
+
oResult.properties = Object.create(null);
|
|
341
342
|
for (var sProperty in oControl.getMetadata().getAllProperties()){
|
|
342
343
|
oResult.properties[sProperty] = {
|
|
343
344
|
ignore: !oAllow || !oAllow.properties || !oAllow.properties.includes(sProperty) || (oBaseDesignTime.properties && oBaseDesignTime.properties[sProperty] && oBaseDesignTime.properties[sProperty].ignore)
|
|
@@ -346,10 +347,10 @@ sap.ui.define(["sap/base/util/extend", "sap/base/util/deepExtend", "sap/base/uti
|
|
|
346
347
|
|
|
347
348
|
return oResult;
|
|
348
349
|
}
|
|
349
|
-
|
|
350
|
-
function getViewDesignTime(mAllow){
|
|
350
|
+
|
|
351
|
+
function getViewDesignTime(mAllow, sFioriToolsRtaMode){
|
|
351
352
|
return loadBaseDesigntime().then(function(){
|
|
352
|
-
|
|
353
|
+
|
|
353
354
|
// provide propagation function for all controls contained allowing only what we want to allow
|
|
354
355
|
var oDesignTime = {
|
|
355
356
|
aggregations: {
|
|
@@ -357,22 +358,39 @@ sap.ui.define(["sap/base/util/extend", "sap/base/util/deepExtend", "sap/base/uti
|
|
|
357
358
|
propagateMetadata: function (oElement) {
|
|
358
359
|
// propagateMetadata is also called for (reuse) components - but they don't have a method getElementName. Anyway, no need to provide (modified) designtime in this case, so just
|
|
359
360
|
// ignore.
|
|
360
|
-
|
|
361
|
+
var oReducedDesigntime = oElement.getMetadata().getElementName && getReducedDesignTime(oElement, mAllow[oElement.getMetadata().getElementName()]);
|
|
362
|
+
|
|
363
|
+
var oCustomDesigntime = {};
|
|
364
|
+
if (sFioriToolsRtaMode === FioriToolsRtaMode.ForAdaptation) {
|
|
365
|
+
switch (oElement.getMetadata().getElementName()) {
|
|
366
|
+
case "sap.ui.comp.smarttable.SmartTable":
|
|
367
|
+
case "sap.ui.table.Table":
|
|
368
|
+
case "sap.m.Table":
|
|
369
|
+
case "sap.ui.table.AnalyticalTable":
|
|
370
|
+
oCustomDesigntime = SmartTableDesigntimeHelper.getDesigntime(
|
|
371
|
+
oElement
|
|
372
|
+
);
|
|
373
|
+
break;
|
|
374
|
+
default:
|
|
375
|
+
break;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
return merge(oReducedDesigntime, oCustomDesigntime);
|
|
361
379
|
}
|
|
362
380
|
}
|
|
363
381
|
}
|
|
364
382
|
};
|
|
365
|
-
|
|
383
|
+
|
|
366
384
|
// For View itself, we cannot wait for base designtime to load (and there is nothing to wait for - we're the ones defining it)
|
|
367
385
|
// Nevertheless, we need to ensure only allowed properties to be changeable.
|
|
368
|
-
|
|
386
|
+
|
|
369
387
|
// There might be several views. Different properties could exist (if inheritance is used) - to be sure, all properties of all views should not be alowed to change
|
|
370
388
|
return aViews.reduce(function(oDesignTime, oView){
|
|
371
389
|
return merge(getReducedDesignTime(oView, mAllow[oView.getMetadata().getElementName()]), oDesignTime);
|
|
372
390
|
}, oDesignTime);
|
|
373
391
|
});
|
|
374
392
|
}
|
|
375
|
-
|
|
393
|
+
|
|
376
394
|
// merge objects concatenating any contained arrays
|
|
377
395
|
// open: if same property is array in one source, but not in the other one - currently resulting property will be "true" (which will probably never be expected)
|
|
378
396
|
function deepMergeWithArray(aSource){
|
|
@@ -401,11 +419,16 @@ sap.ui.define(["sap/base/util/extend", "sap/base/util/deepExtend", "sap/base/uti
|
|
|
401
419
|
}
|
|
402
420
|
});
|
|
403
421
|
}
|
|
404
|
-
|
|
422
|
+
const FioriToolsRtaMode = {
|
|
423
|
+
True: "true",
|
|
424
|
+
ForAdaptation: "forAdaptation"
|
|
425
|
+
};
|
|
426
|
+
|
|
405
427
|
return {
|
|
406
|
-
getMergedAllowList: deepMergeWithArray,
|
|
428
|
+
getMergedAllowList: deepMergeWithArray,
|
|
407
429
|
getViewDesignTime: getViewDesignTime,
|
|
408
430
|
getRtaModeValue: getRtaModeValue,
|
|
409
|
-
stopMutationObserver: fnStopMutationObserver
|
|
431
|
+
stopMutationObserver: fnStopMutationObserver,
|
|
432
|
+
FioriToolsRtaMode
|
|
410
433
|
};
|
|
411
434
|
});
|