@openui5/sap.ui.documentation 1.99.1 → 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/.eslintrc.json +17 -0
- package/THIRDPARTY.txt +5 -5
- package/package.json +6 -6
- package/src/sap/ui/documentation/.library +1 -1
- package/src/sap/ui/documentation/TitleLink.js +1 -2
- package/src/sap/ui/documentation/library.js +14 -18
- package/src/sap/ui/documentation/messagebundle.properties +4 -2
- package/src/sap/ui/documentation/messagebundle_ar.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_bg.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_ca.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_cs.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_cy.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_da.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_de.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_el.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_en.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_en_GB.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_en_US_sappsd.properties +2 -1
- package/src/sap/ui/documentation/messagebundle_en_US_saprigi.properties +43 -10
- package/src/sap/ui/documentation/messagebundle_en_US_saptrc.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_es.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_es_MX.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_et.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_fi.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_fr.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_fr_CA.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_hi.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_hr.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_hu.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_id.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_it.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_iw.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_ja.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_kk.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_ko.properties +4 -2
- package/src/sap/ui/documentation/messagebundle_lt.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_lv.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_ms.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_nl.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_no.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_pl.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_pt.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_pt_PT.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_ro.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_ru.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_sh.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_sk.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_sl.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_sv.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_th.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_tr.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_uk.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_vi.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_zh_CN.properties +3 -1
- package/src/sap/ui/documentation/messagebundle_zh_TW.properties +16 -14
- package/src/sap/ui/documentation/sdk/Component.js +1 -5
- package/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js +7 -13
- package/src/sap/ui/documentation/sdk/controller/ApiDetailIndexDeprecatedExperimental.controller.js +1 -3
- package/src/sap/ui/documentation/sdk/controller/ApiMaster.controller.js +0 -2
- package/src/sap/ui/documentation/sdk/controller/App.controller.js +0 -2
- package/src/sap/ui/documentation/sdk/controller/BaseController.js +1 -1
- package/src/sap/ui/documentation/sdk/controller/Code.controller.js +11 -6
- package/src/sap/ui/documentation/sdk/controller/ControlsMaster.controller.js +11 -15
- package/src/sap/ui/documentation/sdk/controller/Entity.controller.js +1 -2
- package/src/sap/ui/documentation/sdk/controller/LiveEditor.controller.js +1 -2
- package/src/sap/ui/documentation/sdk/controller/Sample.controller.js +181 -303
- package/src/sap/ui/documentation/sdk/controller/SampleBaseController.js +3 -4
- package/src/sap/ui/documentation/sdk/controller/SearchPage.controller.js +4 -5
- package/src/sap/ui/documentation/sdk/controller/SubApiDetail.controller.js +8 -9
- package/src/sap/ui/documentation/sdk/controller/TermsOfUse.controller.js +3 -2
- package/src/sap/ui/documentation/sdk/controller/TopicDetail.controller.js +17 -19
- package/src/sap/ui/documentation/sdk/controller/TopicDetailInitial.controller.js +2 -2
- package/src/sap/ui/documentation/sdk/controller/VersionNotFound.controller.js +2 -0
- package/src/sap/ui/documentation/sdk/controller/Welcome.controller.js +3 -3
- package/src/sap/ui/documentation/sdk/controller/util/ConfigUtil.js +3 -4
- package/src/sap/ui/documentation/sdk/controller/util/ControlsInfo.js +7 -6
- package/src/sap/ui/documentation/sdk/controller/util/DataTable.js +1 -1
- package/src/sap/ui/documentation/sdk/controller/util/DataTableHelper.js +1 -1
- package/src/sap/ui/documentation/sdk/controller/util/IndexWorker.js +1 -1
- package/src/sap/ui/documentation/sdk/controller/util/ResourceDownloadUtil.js +1 -1
- package/src/sap/ui/documentation/sdk/controller/util/ToolsInfo.js +5 -0
- package/src/sap/ui/documentation/sdk/controller/util/datatable/filters/DataTableFilterDropDown.js +0 -2
- package/src/sap/ui/documentation/sdk/controller/util/datatable/filters/DataTableFilterRange.js +2 -4
- package/src/sap/ui/documentation/sdk/controller/util/overlay/Overlay.js +1 -1
- package/src/sap/ui/documentation/sdk/cookieSettingsDialog/controller/CookieSettingsDialog.controller.js +1 -2
- package/src/sap/ui/documentation/sdk/images/tools/AccessibilityGuide.png +0 -0
- package/src/sap/ui/documentation/sdk/index.html +196 -25
- package/src/sap/ui/documentation/sdk/model/formatter.js +1 -1
- package/src/sap/ui/documentation/sdk/model/libraryData.js +18 -4
- package/src/sap/ui/documentation/sdk/util/DocumentationRouter.js +8 -4
- package/src/sap/ui/documentation/sdk/util/Resources.js +5 -2
- package/src/sap/ui/documentation/sdk/view/Sample.view.xml +2 -2
- package/src/sap/ui/documentation/sdk/view/Tools.view.xml +19 -0
- package/src/sap/ui/documentation/themes/sap_horizon_dark/library.source.less +9 -0
- package/src/sap/ui/documentation/themes/sap_horizon_hcb/library.source.less +9 -0
- package/src/sap/ui/documentation/themes/sap_horizon_hcw/library.source.less +9 -0
|
@@ -6,29 +6,32 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
sap.ui.define([
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
"sap/ui/documentation/sdk/controller/SampleBaseController",
|
|
10
|
+
"sap/ui/model/json/JSONModel",
|
|
11
|
+
"sap/ui/model/resource/ResourceModel",
|
|
12
|
+
"sap/ui/core/Component",
|
|
13
|
+
"sap/ui/core/ComponentContainer",
|
|
14
|
+
"sap/ui/documentation/sdk/controller/util/ControlsInfo",
|
|
15
|
+
"sap/ui/documentation/sdk/util/ToggleFullScreenHandler",
|
|
16
|
+
"sap/m/BusyDialog",
|
|
17
|
+
"sap/m/Text",
|
|
18
|
+
"sap/ui/core/HTML",
|
|
19
|
+
"sap/m/library",
|
|
20
|
+
"sap/base/Log",
|
|
20
21
|
"sap/base/util/UriParameters",
|
|
21
22
|
"sap/ui/core/Fragment",
|
|
22
23
|
"sap/ui/documentation/sdk/util/Resources",
|
|
23
|
-
"./config/sampleForwardingConfig"
|
|
24
|
+
"./config/sampleForwardingConfig",
|
|
25
|
+
"sap/base/strings/capitalize"
|
|
24
26
|
], function(
|
|
25
|
-
jQuery,
|
|
26
27
|
SampleBaseController,
|
|
27
28
|
JSONModel,
|
|
29
|
+
ResourceModel,
|
|
28
30
|
Component,
|
|
29
31
|
ComponentContainer,
|
|
30
32
|
ControlsInfo,
|
|
31
33
|
ToggleFullScreenHandler,
|
|
34
|
+
BusyDialog,
|
|
32
35
|
Text,
|
|
33
36
|
HTML,
|
|
34
37
|
mobileLibrary,
|
|
@@ -36,16 +39,18 @@ sap.ui.define([
|
|
|
36
39
|
UriParameters,
|
|
37
40
|
Fragment,
|
|
38
41
|
ResourcesUtil,
|
|
39
|
-
sampleForwardingConfig
|
|
42
|
+
sampleForwardingConfig,
|
|
43
|
+
capitalize
|
|
40
44
|
) {
|
|
41
45
|
"use strict";
|
|
42
46
|
|
|
43
47
|
// shortcut for sap.m.URLHelper
|
|
44
48
|
var URLHelper = mobileLibrary.URLHelper;
|
|
45
49
|
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
var ALLOWLIST_SAMPLES_SEARCH_PARAMS = [
|
|
51
|
+
"sap-ui-rtl",
|
|
52
|
+
"sap-ui-language"
|
|
53
|
+
];
|
|
49
54
|
|
|
50
55
|
return SampleBaseController.extend("sap.ui.documentation.sdk.controller.Sample", {
|
|
51
56
|
/* =========================================================== */
|
|
@@ -62,35 +67,18 @@ sap.ui.define([
|
|
|
62
67
|
showNewTab: false,
|
|
63
68
|
rtaLoaded: false
|
|
64
69
|
});
|
|
65
|
-
this._oSampleIframeSettings = {
|
|
66
|
-
densityMode: COMPACT,
|
|
67
|
-
themeActive: "sap_fiori_3",
|
|
68
|
-
rtl: false
|
|
69
|
-
};
|
|
70
70
|
|
|
71
71
|
this._sId = null; // Used to hold sample ID
|
|
72
72
|
this._sEntityId = null; // Used to hold entity ID for the sample currently shown
|
|
73
73
|
this.router = this.getRouter();
|
|
74
74
|
|
|
75
|
-
// Load runtime authoring asynchronously
|
|
76
|
-
if (!ResourcesUtil.getHasProxy()) {
|
|
77
|
-
Promise.all([
|
|
78
|
-
sap.ui.getCore().loadLibrary("sap.ui.fl", {async: true}),
|
|
79
|
-
sap.ui.getCore().loadLibrary("sap.ui.rta", {async: true})
|
|
80
|
-
]).then(function () {
|
|
81
|
-
sap.ui.require([
|
|
82
|
-
"sap/ui/fl/Utils",
|
|
83
|
-
"sap/ui/fl/FakeLrepConnectorLocalStorage",
|
|
84
|
-
"sap/ui/core/util/reflection/JsControlTreeModifier"
|
|
85
|
-
], this._loadRTA.bind(this));
|
|
86
|
-
}.bind(this));
|
|
87
|
-
}
|
|
88
|
-
|
|
89
75
|
this.getView().setModel(this.oModel);
|
|
90
76
|
|
|
91
77
|
this.bus = sap.ui.getCore().getEventBus();
|
|
92
78
|
this.setDefaultSampleTheme();
|
|
93
79
|
this.bus.subscribe("themeChanged", "onDemoKitThemeChanged", this.onDemoKitThemeChanged, this);
|
|
80
|
+
|
|
81
|
+
this.getOwnerComponent()._sSampleIframeOrigin = ResourcesUtil.getConfig() !== "." ? ResourcesUtil.getConfig() : window.origin;
|
|
94
82
|
},
|
|
95
83
|
|
|
96
84
|
/* =========================================================== */
|
|
@@ -163,24 +151,17 @@ sap.ui.define([
|
|
|
163
151
|
|
|
164
152
|
// set page title
|
|
165
153
|
oModelData.title = "Sample: " + oSample.name;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
154
|
+
oModelData.showNewTab = true;
|
|
155
|
+
oModelData.id = oSample.id;
|
|
156
|
+
oModelData.name = oSample.name;
|
|
157
|
+
oModelData.details = oSample.details;
|
|
158
|
+
oModelData.description = oSample.description;
|
|
159
|
+
oModelData.showSettings = true;
|
|
160
|
+
|
|
161
|
+
this._createIframe()
|
|
162
|
+
.then(function (oSampleConfig) {
|
|
169
163
|
// Store a reference to the currently opened sample on the application component
|
|
170
|
-
this.getOwnerComponent()._oCurrentOpenedSample =
|
|
171
|
-
|
|
172
|
-
//get config
|
|
173
|
-
var oComponent = Component.get(oComponentContainer.getComponent());
|
|
174
|
-
var oConfig = (oComponent.getMetadata()) ? oComponent.getMetadata().getConfig() : null;
|
|
175
|
-
var oSampleConfig = oConfig && oConfig.sample || {};
|
|
176
|
-
|
|
177
|
-
// only have the option to run standalone if there is an iframe
|
|
178
|
-
oModelData.showNewTab = !!oSampleConfig.iframe || !!ResourcesUtil.getHasProxy();
|
|
179
|
-
oModelData.id = oSample.id;
|
|
180
|
-
oModelData.name = oSample.name;
|
|
181
|
-
oModelData.details = oSample.details;
|
|
182
|
-
oModelData.description = oSample.description;
|
|
183
|
-
oModelData.showSettings = !!ResourcesUtil.getHasProxy();
|
|
164
|
+
this.getOwnerComponent()._oCurrentOpenedSample = this._oHtmlControl;
|
|
184
165
|
|
|
185
166
|
if (oSampleConfig) {
|
|
186
167
|
|
|
@@ -199,31 +180,11 @@ sap.ui.define([
|
|
|
199
180
|
this._updateFileContent(sRef, sFile);
|
|
200
181
|
}
|
|
201
182
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
} else {
|
|
206
|
-
this.sIFrameUrl = null;
|
|
207
|
-
}
|
|
183
|
+
// Sets the current iframe URL or restores it to "undefined"
|
|
184
|
+
oModelData.iframe = oSampleConfig.iframe;
|
|
185
|
+
oPage.setProperty("enableScrolling", !!oSampleConfig.stretch, true);
|
|
208
186
|
}
|
|
209
187
|
|
|
210
|
-
// Sets the current iframe URL or restores it to "undefined"
|
|
211
|
-
oModelData.iframe = oSampleConfig.iframe || ResourcesUtil.getHasProxy();
|
|
212
|
-
|
|
213
|
-
// handle stretch content
|
|
214
|
-
var bStretch = !!oSampleConfig.stretch;
|
|
215
|
-
var sHeight = bStretch ? "100%" : null;
|
|
216
|
-
oPage.setEnableScrolling(!bStretch);
|
|
217
|
-
if (oComponentContainer.setHeight) {
|
|
218
|
-
oComponentContainer.setHeight(sHeight);
|
|
219
|
-
}
|
|
220
|
-
// add content
|
|
221
|
-
oPage.removeAllContent();
|
|
222
|
-
oPage.addContent(oComponentContainer);
|
|
223
|
-
|
|
224
|
-
// scroll to top of page
|
|
225
|
-
oPage.scrollTo(0);
|
|
226
|
-
|
|
227
188
|
this.getAPIReferenceCheckPromise(oSample.entityId).then(function (bHasAPIReference) {
|
|
228
189
|
this.getView().byId("apiRefButton").setVisible(bHasAPIReference);
|
|
229
190
|
}.bind(this));
|
|
@@ -247,41 +208,59 @@ sap.ui.define([
|
|
|
247
208
|
* @public
|
|
248
209
|
*/
|
|
249
210
|
handleSettings: function () {
|
|
250
|
-
var oSampleFrame = this._oHtmlControl.$()[0].contentWindow,
|
|
251
|
-
oSampleFrameCore = oSampleFrame.sap.ui.getCore(),
|
|
252
|
-
oView;
|
|
253
211
|
|
|
254
212
|
if (!this._oMessageBundle) {
|
|
255
|
-
this._oMessageBundle = new
|
|
213
|
+
this._oMessageBundle = new ResourceModel({
|
|
256
214
|
bundleName: "sap.ui.documentation.messagebundle"
|
|
257
215
|
});
|
|
258
216
|
}
|
|
259
217
|
|
|
260
218
|
if (!this._oSettingsDialog) {
|
|
261
|
-
this._oSettingsDialog =
|
|
219
|
+
this._oSettingsDialog = sap.ui.xmlfragment("sample", "sap.ui.documentation.sdk.view.appSettingsDialog", this);
|
|
262
220
|
|
|
263
|
-
oView =
|
|
264
|
-
|
|
265
|
-
oView.addDependent(this._oSettingsDialog);
|
|
221
|
+
// oView = sap.ui.getCore().byId("__xmlview0") || sap.ui.getCore().byId("__container0");
|
|
222
|
+
this._oSettingsDialog.setModel(this._oMessageBundle, "i18n");
|
|
223
|
+
// oView.addDependent(this._oSettingsDialog);
|
|
266
224
|
}
|
|
267
225
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
226
|
+
this.loadSampleSettings().then(function() {
|
|
227
|
+
this._oSettingsDialog.open();
|
|
228
|
+
}.bind(this)).catch(function(err) {
|
|
229
|
+
Log.error(err);
|
|
230
|
+
});
|
|
231
|
+
},
|
|
273
232
|
|
|
274
|
-
|
|
275
|
-
|
|
233
|
+
loadSampleSettings: function() {
|
|
234
|
+
return new Promise(function (resolve, reject) {
|
|
235
|
+
var oIframe = this._oHtmlControl.getDomRef();
|
|
236
|
+
oIframe.contentWindow.postMessage({
|
|
237
|
+
type: "SETTINGS",
|
|
238
|
+
reason: "get"
|
|
239
|
+
}, this.getOwnerComponent()._sSampleIframeOrigin);
|
|
276
240
|
|
|
277
|
-
|
|
278
|
-
oSampleFrameCore.byId("RTLSwitch").setState(oAppSettings.getRTL());
|
|
241
|
+
window.addEventListener("message", loadSettings);
|
|
279
242
|
|
|
280
|
-
|
|
281
|
-
|
|
243
|
+
function loadSettings(eMessage) {
|
|
244
|
+
if (eMessage.data.type === "SETTINGS") {
|
|
245
|
+
var oThemeSelect = sap.ui.getCore().byId("sample--ThemeSelect");
|
|
282
246
|
|
|
283
|
-
|
|
284
|
-
|
|
247
|
+
// Theme select
|
|
248
|
+
oThemeSelect.setSelectedKey(eMessage.data.data.theme);
|
|
249
|
+
|
|
250
|
+
// RTL
|
|
251
|
+
sap.ui.getCore().byId("sample--RTLSwitch").setState(eMessage.data.data.RTL);
|
|
252
|
+
|
|
253
|
+
// Density mode select
|
|
254
|
+
sap.ui.getCore().byId("sample--DensityModeSwitch").setSelectedKey(eMessage.data.data.density.slice(9).toLowerCase());
|
|
255
|
+
|
|
256
|
+
window.removeEventListener("message", loadSettings);
|
|
257
|
+
resolve();
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
setTimeout(function() {
|
|
261
|
+
reject("The sample iframe is not loading settings");
|
|
262
|
+
},3000);
|
|
263
|
+
}.bind(this));
|
|
285
264
|
},
|
|
286
265
|
|
|
287
266
|
/**
|
|
@@ -293,22 +272,17 @@ sap.ui.define([
|
|
|
293
272
|
},
|
|
294
273
|
|
|
295
274
|
handleSaveAppSettings: function () {
|
|
296
|
-
var
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
sTheme = oSampleFrameCore.byId("ThemeSelect").getSelectedKey(),
|
|
300
|
-
bRTL = oSampleFrameCore.byId("RTLSwitch").getState(),
|
|
301
|
-
oView = oSampleFrameCore.byId("__xmlview0");
|
|
275
|
+
var sDensityMode = sap.ui.getCore().byId("sample--DensityModeSwitch").getSelectedKey(),
|
|
276
|
+
sTheme = sap.ui.getCore().byId("sample--ThemeSelect").getSelectedKey(),
|
|
277
|
+
bRTL = sap.ui.getCore().byId("sample--RTLSwitch").getState();
|
|
302
278
|
|
|
303
279
|
this._oSettingsDialog.close();
|
|
304
280
|
|
|
305
281
|
// Lazy loading of busy dialog
|
|
306
282
|
if (!this._oBusyDialog) {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
this._handleBusyDialog();
|
|
311
|
-
}.bind(this));
|
|
283
|
+
this._oBusyDialog = new BusyDialog();
|
|
284
|
+
// oView.addDependent(this._oBusyDialog);
|
|
285
|
+
this._handleBusyDialog();
|
|
312
286
|
} else {
|
|
313
287
|
this._handleBusyDialog();
|
|
314
288
|
}
|
|
@@ -325,45 +299,16 @@ sap.ui.define([
|
|
|
325
299
|
* @private
|
|
326
300
|
*/
|
|
327
301
|
_applyAppConfiguration: function(sThemeActive, sDensityMode, bRTL){
|
|
328
|
-
var
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
this._oSampleIframeSettings.rtl = bRTL;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
if (oSampleFrameCore.getConfiguration().getTheme() !== sThemeActive) {
|
|
342
|
-
oSampleFrameCore.applyTheme(sThemeActive);
|
|
343
|
-
this._oSampleIframeSettings.themeActive = sThemeActive;
|
|
344
|
-
} else if (this._oSampleIframeSettings.densityMode !== sDensityMode) {
|
|
345
|
-
// Notify Core for content density change only if no theme change happened
|
|
346
|
-
oSampleFrameCore.notifyContentDensityChanged();
|
|
347
|
-
}
|
|
348
|
-
},
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* Toggles content density classes in the provided html body
|
|
352
|
-
* @param {object} oBody the html body to set the correct class on
|
|
353
|
-
* @param {string} sDensityMode content density mode
|
|
354
|
-
* @private
|
|
355
|
-
*/
|
|
356
|
-
_toggleContentDensityClasses: function(oBody, sDensityMode){
|
|
357
|
-
switch (sDensityMode) {
|
|
358
|
-
case COMPACT:
|
|
359
|
-
oBody.toggleClass("sapUiSizeCompact", true).toggleClass("sapUiSizeCozy", false).toggleClass("sapUiSizeCondensed", false);
|
|
360
|
-
break;
|
|
361
|
-
case CONDENSED:
|
|
362
|
-
oBody.toggleClass("sapUiSizeCondensed", true).toggleClass("sapUiSizeCozy", false).toggleClass("sapUiSizeCompact", true);
|
|
363
|
-
break;
|
|
364
|
-
default:
|
|
365
|
-
oBody.toggleClass("sapUiSizeCozy", true).toggleClass("sapUiSizeCondensed", false).toggleClass("sapUiSizeCompact", false);
|
|
366
|
-
}
|
|
302
|
+
var oIframe = this._oHtmlControl.getDomRef();
|
|
303
|
+
oIframe.contentWindow.postMessage({
|
|
304
|
+
type: "SETTINGS",
|
|
305
|
+
reason: "set",
|
|
306
|
+
data: {
|
|
307
|
+
"density": "sapUiSize" + capitalize(sDensityMode),
|
|
308
|
+
"RTL": bRTL,
|
|
309
|
+
"theme": sThemeActive
|
|
310
|
+
}
|
|
311
|
+
}, this.getOwnerComponent()._sSampleIframeOrigin);
|
|
367
312
|
},
|
|
368
313
|
|
|
369
314
|
/**
|
|
@@ -454,140 +399,100 @@ sap.ui.define([
|
|
|
454
399
|
return sSampleId;
|
|
455
400
|
},
|
|
456
401
|
|
|
457
|
-
_createIframe : function (
|
|
458
|
-
|
|
402
|
+
_createIframe : function () {
|
|
403
|
+
return new Promise(function (resolve, reject) {
|
|
404
|
+
var sSampleId = this._sId,
|
|
459
405
|
sIframePath = "",
|
|
460
406
|
rExtractFilename = /\/([^\/]*)$/,// extracts everything after the last slash (e.g. some/path/index.html -> index.html)
|
|
461
407
|
rStripUI5Ending = /\..+$/,// removes everything after the first dot in the filename (e.g. someFile.qunit.html -> .qunit.html)
|
|
462
408
|
aFileNameMatches,
|
|
463
409
|
sFileName,
|
|
464
|
-
sFileEnding
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
"?sap-ui-xx-sample-id=" + sSampleId
|
|
485
|
-
+ "&&sap-ui-xx-sample-path=" + sSamplePath
|
|
486
|
-
+ "&&sap-ui-xx-sample-origin=" + sSampleOrigin
|
|
487
|
-
+ "&&sap-ui-xx-sample-version=" + sSampleVersion;
|
|
488
|
-
} else {
|
|
489
|
-
Log.error("no iframe source was provided");
|
|
490
|
-
return;
|
|
491
|
-
}
|
|
410
|
+
sFileEnding,
|
|
411
|
+
vIframe;
|
|
412
|
+
|
|
413
|
+
this.fResolve = resolve;
|
|
414
|
+
this.fReject = reject;
|
|
415
|
+
var sSampleOrigin = (window['sap-ui-documentation-config'] && window['sap-ui-documentation-config'].demoKitResourceOrigin) || "",
|
|
416
|
+
sSampleVersion = ResourcesUtil.getResourcesVersion(),
|
|
417
|
+
sSampleSearchParams = "";
|
|
418
|
+
|
|
419
|
+
// Assigning allowed query parameters from Demo Kit URL
|
|
420
|
+
ALLOWLIST_SAMPLES_SEARCH_PARAMS.forEach(function(oParam, index){
|
|
421
|
+
if (new URL(document.location.href).searchParams.get(oParam)){
|
|
422
|
+
sSampleSearchParams += (sSampleSearchParams === "" ? "?" : "&") + oParam + "=" + new URL(document.location.href).searchParams.get(oParam);
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
sSampleSearchParams = (sSampleSearchParams === "" ? "?" : sSampleSearchParams + "&") +
|
|
427
|
+
"sap-ui-xx-sample-id=" + sSampleId
|
|
428
|
+
+ "&sap-ui-xx-sample-origin=" + sSampleOrigin + sSampleVersion
|
|
429
|
+
+ "&sap-ui-xx-dk-origin=" + window.location.origin;
|
|
492
430
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
switch (oComponent.getContentDensityClass()) {
|
|
498
|
-
case "sapUiSizeCompact":
|
|
499
|
-
this._oSampleIframeSettings.densityMode = COMPACT;
|
|
500
|
-
break;
|
|
501
|
-
case "sapUiSizeCondensed":
|
|
502
|
-
this._oSampleIframeSettings.densityMode = CONDENSED;
|
|
503
|
-
break;
|
|
504
|
-
default:
|
|
505
|
-
this._oSampleIframeSettings.densityMode = COZY;
|
|
431
|
+
this.sIFrameUrl = ResourcesUtil.getResourceOrigin() + "/resources/sap/ui/documentation/sdk/index.html" + sSampleSearchParams;
|
|
432
|
+
|
|
433
|
+
if (this._oHtmlControl) {
|
|
434
|
+
this._oHtmlControl.destroy();
|
|
506
435
|
}
|
|
507
436
|
|
|
437
|
+
var fnMessage = function (eMessage) {
|
|
438
|
+
if (eMessage.data.type === "INIT") {
|
|
439
|
+
var oConfiguration = sap.ui.getCore().getConfiguration();
|
|
440
|
+
if (eMessage.data.config && eMessage.data.config.sample && eMessage.data.config.sample.iframe) {
|
|
441
|
+
sSampleId = this._sId;
|
|
442
|
+
vIframe = eMessage.data.config.sample.iframe;
|
|
443
|
+
sIframePath = this._resolveIframePath(sSampleId, vIframe);
|
|
444
|
+
|
|
445
|
+
//vlaid only for samples that contains own index.html
|
|
446
|
+
// strip the file extension to be able to use jQuery.sap.getModulePath
|
|
447
|
+
aFileNameMatches = rExtractFilename.exec(vIframe);
|
|
448
|
+
sFileName = (aFileNameMatches && aFileNameMatches.length > 1 ? aFileNameMatches[1] : vIframe);
|
|
449
|
+
sFileEnding = rStripUI5Ending.exec(sFileName)[0];
|
|
450
|
+
var sIframeWithoutUI5Ending = sFileName.replace(rStripUI5Ending, "");
|
|
451
|
+
|
|
452
|
+
// combine namespace with the file name again
|
|
453
|
+
this.sIFrameUrl = (sap.ui.require.toUrl((sIframePath + "/" + sIframeWithoutUI5Ending).replace(/\./g, "/")) + sFileEnding || ".html")
|
|
454
|
+
+ "?sap-ui-theme=" + sap.ui.getCore().getConfiguration().getTheme();
|
|
455
|
+
this._oHtmlControl.getDomRef().src = this.sIFrameUrl;
|
|
456
|
+
}
|
|
457
|
+
this._oHtmlControl.getDomRef().contentWindow.postMessage({
|
|
458
|
+
type: "SETTINGS",
|
|
459
|
+
reason: "set",
|
|
460
|
+
data: {
|
|
461
|
+
"density": this.getOwnerComponent().getContentDensityClass(),
|
|
462
|
+
"RTL": oConfiguration.getRTL(),
|
|
463
|
+
"theme": oConfiguration.getTheme()
|
|
464
|
+
}
|
|
465
|
+
}, this.getOwnerComponent()._sSampleIframeOrigin);
|
|
466
|
+
this.fResolve(eMessage.data.config.sample);
|
|
467
|
+
} else if (eMessage.data.type === "ERR") {
|
|
468
|
+
this.fReject(eMessage.data.data.msg);
|
|
469
|
+
} else if (eMessage.data.type === "RTA") {
|
|
470
|
+
this._loadRTA.call(this);
|
|
471
|
+
}
|
|
472
|
+
}.bind(this);
|
|
473
|
+
|
|
508
474
|
this._oHtmlControl = new HTML({
|
|
509
475
|
id : "sampleFrame",
|
|
510
476
|
content : '<iframe src="' + this.sIFrameUrl + '" id="sampleFrame" frameBorder="0"></iframe>'
|
|
511
477
|
}).addEventDelegate({
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
this._oMessageBundle = null;
|
|
522
|
-
this._oSettingsDialog = null;
|
|
523
|
-
this._oBusyDialog = null;
|
|
524
|
-
|
|
525
|
-
if (this.oModel.getData().iframe) {
|
|
526
|
-
Promise.all([
|
|
527
|
-
oSampleFrameCore.loadLibrary("sap.ui.fl", {async: true}),
|
|
528
|
-
oSampleFrameCore.loadLibrary("sap.ui.rta", {async: true})
|
|
529
|
-
]).then(function () {
|
|
530
|
-
oSampleFrame.sap.ui.require([
|
|
531
|
-
"sap/ui/fl/Utils",
|
|
532
|
-
"sap/ui/fl/FakeLrepConnectorLocalStorage",
|
|
533
|
-
"sap/ui/core/util/reflection/JsControlTreeModifier"
|
|
534
|
-
], this._loadRTA.bind(this));
|
|
535
|
-
}.bind(this));
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
oFrame.onToggleAdaptationMode = function () {
|
|
539
|
-
oSampleFrame.sap.ui.require([
|
|
540
|
-
"sap/ui/rta/api/startKeyUserAdaptation"
|
|
541
|
-
], function (
|
|
542
|
-
startKeyUserAdaptation
|
|
543
|
-
) {
|
|
544
|
-
if (!this._oRTA) {
|
|
545
|
-
var oContainer = oSampleFrameCore.byId("__container0");
|
|
546
|
-
|
|
547
|
-
startKeyUserAdaptation({
|
|
548
|
-
rootControl : oContainer.getComponentInstance()
|
|
549
|
-
}).then(function(oRta) {
|
|
550
|
-
this._oRTA = oRta;
|
|
551
|
-
oContainer.$().css({"padding-top": "2.5rem", "box-sizing": "border-box"});
|
|
552
|
-
this._oRTA.attachStop(function () {
|
|
553
|
-
oContainer.$().css({"padding-top": "0", "box-sizing": "content-box"});
|
|
554
|
-
this._oRTA.destroy();
|
|
555
|
-
delete this._oRTA;
|
|
556
|
-
}.bind(this));
|
|
557
|
-
}.bind(this));
|
|
558
|
-
}
|
|
559
|
-
}.bind(this));
|
|
560
|
-
};
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
// Apply theme settings to iframe sample
|
|
564
|
-
oSampleFrame.sap.ui.getCore().attachInit(function () {
|
|
565
|
-
oSampleFrameCore.applyTheme(ResourcesUtil.getHasProxy() ?
|
|
566
|
-
this._oSampleIframeSettings.themeActive : this._oCore.getConfiguration().getTheme());
|
|
567
|
-
oSampleFrameCore.getConfiguration().setRTL(ResourcesUtil.getHasProxy() ?
|
|
568
|
-
this._oSampleIframeSettings.rtl : this._oCore.getConfiguration().getRTL());
|
|
569
|
-
this._toggleContentDensityClasses(oSampleFrame.jQuery('body'), this._oSampleIframeSettings.densityMode);
|
|
570
|
-
|
|
571
|
-
// Notify Core for content density change
|
|
572
|
-
oSampleFrameCore.notifyContentDensityChanged();
|
|
573
|
-
}.bind(this));
|
|
574
|
-
}.bind(this));
|
|
575
|
-
|
|
576
|
-
this._oHtmlControl._jQueryHTMLControlLoadEventAttached = true;
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
}.bind(this)
|
|
478
|
+
onBeforeRendering: function () {
|
|
479
|
+
window.removeEventListener("message", fnMessage);
|
|
480
|
+
}
|
|
481
|
+
})
|
|
482
|
+
.addEventDelegate({
|
|
483
|
+
onAfterRendering: function () {
|
|
484
|
+
window.addEventListener("message", fnMessage);
|
|
485
|
+
}
|
|
580
486
|
});
|
|
581
|
-
} else {
|
|
582
|
-
// If we already have the control just navigate to the new URL
|
|
583
|
-
this._oHtmlControl.getDomRef().src = this.sIFrameUrl;
|
|
584
|
-
}
|
|
585
487
|
|
|
586
|
-
|
|
488
|
+
this.byId("page").removeAllContent();
|
|
489
|
+
this.byId("page").addContent(this._oHtmlControl);
|
|
587
490
|
|
|
491
|
+
}.bind(this));
|
|
588
492
|
},
|
|
589
493
|
|
|
590
494
|
_createComponent : function () {
|
|
495
|
+
|
|
591
496
|
// create component only once
|
|
592
497
|
var sCompId = 'sampleComp-' + this._sId;
|
|
593
498
|
var sCompName = this._sId;
|
|
@@ -616,10 +521,10 @@ sap.ui.define([
|
|
|
616
521
|
},
|
|
617
522
|
|
|
618
523
|
onDemoKitThemeChanged: function(sChannelId, sEventId, oData) {
|
|
619
|
-
if (this._oHtmlControl &&
|
|
620
|
-
this.
|
|
524
|
+
if (this._oHtmlControl && this.getModel().getProperty("/iframe")) {
|
|
525
|
+
this._applySearchParamValueToIframeURL("sap-ui-theme", oData.sThemeActive);
|
|
526
|
+
this._oHtmlControl.getDomRef().src = this.sIFrameUrl;
|
|
621
527
|
}
|
|
622
|
-
this.setDefaultSampleTheme();
|
|
623
528
|
},
|
|
624
529
|
|
|
625
530
|
onNavBack : function (oEvt) {
|
|
@@ -657,24 +562,9 @@ sap.ui.define([
|
|
|
657
562
|
this.sIFrameUrl = this.sIFrameUrl + decodeURI(oIFrameURL.search);
|
|
658
563
|
},
|
|
659
564
|
|
|
660
|
-
_loadRTA: function (
|
|
661
|
-
Utils,
|
|
662
|
-
FakeLrepConnectorLocalStorage,
|
|
663
|
-
JsControlTreeModifier
|
|
664
|
-
) {
|
|
565
|
+
_loadRTA: function () {
|
|
665
566
|
var oModelData = this.oModel.getData();
|
|
666
567
|
|
|
667
|
-
// fake stable IDs
|
|
668
|
-
JsControlTreeModifier.checkControlId = function () {
|
|
669
|
-
return true;
|
|
670
|
-
};
|
|
671
|
-
Utils.checkControlId = function() {
|
|
672
|
-
return true;
|
|
673
|
-
};
|
|
674
|
-
|
|
675
|
-
FakeLrepConnectorLocalStorage.enableFakeConnector({
|
|
676
|
-
"isProductiveSystem": true
|
|
677
|
-
});
|
|
678
568
|
oModelData.rtaLoaded = true;
|
|
679
569
|
|
|
680
570
|
this.oModel.setData(oModelData);
|
|
@@ -688,29 +578,17 @@ sap.ui.define([
|
|
|
688
578
|
},
|
|
689
579
|
|
|
690
580
|
onToggleAdaptationMode : function (oEvt) {
|
|
691
|
-
if (this.
|
|
692
|
-
|
|
693
|
-
return;
|
|
581
|
+
if (!this._oHtmlControl || !this._oHtmlControl.getDomRef()) {
|
|
582
|
+
return false;
|
|
694
583
|
}
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
var oContainer = this.byId("page").getContent()[0];
|
|
702
|
-
|
|
703
|
-
startKeyUserAdaptation({
|
|
704
|
-
rootControl : oContainer.getComponentInstance()
|
|
705
|
-
}).then(function(oRta) {
|
|
706
|
-
this._oRTA = oRta;
|
|
707
|
-
this._oRTA.attachStop(function () {
|
|
708
|
-
this._oRTA.destroy();
|
|
709
|
-
delete this._oRTA;
|
|
710
|
-
}.bind(this));
|
|
711
|
-
}.bind(this));
|
|
584
|
+
|
|
585
|
+
var oIframe = this._oHtmlControl.getDomRef();
|
|
586
|
+
oIframe.contentWindow.postMessage({
|
|
587
|
+
type: "RTA",
|
|
588
|
+
data: {
|
|
589
|
+
"msg": "Start the RTA"
|
|
712
590
|
}
|
|
713
|
-
}.
|
|
591
|
+
}, this.getOwnerComponent()._sSampleIframeOrigin);
|
|
714
592
|
},
|
|
715
593
|
|
|
716
594
|
onRouteNotFound: function() {
|
|
@@ -19,7 +19,7 @@ sap.ui.define([
|
|
|
19
19
|
|
|
20
20
|
var OPENUI5_LIBS = ["sap.ui.core", "sap.ui.dt", "sap.m", "sap.ui.fl", "sap.ui.layout", "sap.ui.mdc", "sap.ui.unified",
|
|
21
21
|
"sap.f", "sap.ui.rta", "sap.ui.commons", "sap.ui.codeeditor", "sap.ui.table", "sap.uxap", "sap.ui.integration",
|
|
22
|
-
"sap.tnt", "sap.ui.ux3", "sap.ui.suite"];
|
|
22
|
+
"sap.tnt", "sap.ui.ux3", "sap.ui.suite", "sap.ui.webc.common", "sap.ui.webc.fiori", "sap.ui.webc.main" ];
|
|
23
23
|
var SAPUI5_LIBS = ["sap.ushell", "sap.fe", "sap.viz", "sap.suite.ui.microchart", "sap.chart", "sap.ui.comp", "sap.ui.generic.app",
|
|
24
24
|
"sap.fe.navigation", "sap.suite.ui.generic.template", "sap.ui.richtexteditor", "sap.suite.ui.commons", "sap.ui.export",
|
|
25
25
|
"sap.ndc", "sap.me", "sap.fe.core", "sap.fe.macros", "sap.collaboration", "sap.fe.templates", "sap.ui.generic.template",
|
|
@@ -38,9 +38,8 @@ sap.ui.define([
|
|
|
38
38
|
},
|
|
39
39
|
onDownload: function () {
|
|
40
40
|
sap.ui.require([
|
|
41
|
-
"sap/ui/thirdparty/jszip"
|
|
42
|
-
|
|
43
|
-
], function (JSZip, File) {
|
|
41
|
+
"sap/ui/thirdparty/jszip"
|
|
42
|
+
], function (JSZip) {
|
|
44
43
|
var oZipFile = new JSZip(),
|
|
45
44
|
sRef = ResourcesUtil.getResourceOriginPath(sap.ui.require.toUrl((this._sId).replace(/\./g, "/"))),
|
|
46
45
|
oData = this.oModel.getData(),
|