@openui5/sap.ui.documentation 1.99.0 → 1.100.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/THIRDPARTY.txt +2 -2
  2. package/package.json +6 -6
  3. package/src/sap/ui/documentation/.library +1 -1
  4. package/src/sap/ui/documentation/TitleLink.js +1 -2
  5. package/src/sap/ui/documentation/library.js +4 -5
  6. package/src/sap/ui/documentation/sdk/Component.js +1 -5
  7. package/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js +7 -13
  8. package/src/sap/ui/documentation/sdk/controller/ApiDetailIndexDeprecatedExperimental.controller.js +1 -3
  9. package/src/sap/ui/documentation/sdk/controller/ApiMaster.controller.js +0 -2
  10. package/src/sap/ui/documentation/sdk/controller/App.controller.js +0 -2
  11. package/src/sap/ui/documentation/sdk/controller/Code.controller.js +1 -2
  12. package/src/sap/ui/documentation/sdk/controller/ControlsMaster.controller.js +11 -15
  13. package/src/sap/ui/documentation/sdk/controller/Entity.controller.js +1 -2
  14. package/src/sap/ui/documentation/sdk/controller/LiveEditor.controller.js +1 -2
  15. package/src/sap/ui/documentation/sdk/controller/Sample.controller.js +173 -308
  16. package/src/sap/ui/documentation/sdk/controller/SampleBaseController.js +2 -3
  17. package/src/sap/ui/documentation/sdk/controller/SearchPage.controller.js +4 -5
  18. package/src/sap/ui/documentation/sdk/controller/SubApiDetail.controller.js +8 -9
  19. package/src/sap/ui/documentation/sdk/controller/TermsOfUse.controller.js +3 -2
  20. package/src/sap/ui/documentation/sdk/controller/TopicDetail.controller.js +17 -19
  21. package/src/sap/ui/documentation/sdk/controller/TopicDetailInitial.controller.js +2 -2
  22. package/src/sap/ui/documentation/sdk/controller/VersionNotFound.controller.js +2 -0
  23. package/src/sap/ui/documentation/sdk/controller/Welcome.controller.js +3 -3
  24. package/src/sap/ui/documentation/sdk/controller/util/ConfigUtil.js +3 -4
  25. package/src/sap/ui/documentation/sdk/controller/util/ControlsInfo.js +7 -6
  26. package/src/sap/ui/documentation/sdk/controller/util/DataTable.js +1 -1
  27. package/src/sap/ui/documentation/sdk/controller/util/DataTableHelper.js +1 -1
  28. package/src/sap/ui/documentation/sdk/controller/util/IndexWorker.js +1 -1
  29. package/src/sap/ui/documentation/sdk/controller/util/datatable/filters/DataTableFilterDropDown.js +0 -2
  30. package/src/sap/ui/documentation/sdk/controller/util/datatable/filters/DataTableFilterRange.js +2 -4
  31. package/src/sap/ui/documentation/sdk/controller/util/overlay/Overlay.js +1 -1
  32. package/src/sap/ui/documentation/sdk/cookieSettingsDialog/controller/CookieSettingsDialog.controller.js +1 -2
  33. package/src/sap/ui/documentation/sdk/index.html +133 -25
  34. package/src/sap/ui/documentation/sdk/model/formatter.js +1 -1
  35. package/src/sap/ui/documentation/sdk/model/libraryData.js +9 -4
  36. package/src/sap/ui/documentation/sdk/util/DocumentationRouter.js +8 -4
  37. package/src/sap/ui/documentation/sdk/util/Resources.js +5 -2
  38. package/src/sap/ui/documentation/sdk/view/Sample.view.xml +2 -2
  39. package/src/sap/ui/documentation/themes/sap_horizon_dark/library.source.less +9 -0
  40. package/src/sap/ui/documentation/themes/sap_horizon_hcb/library.source.less +9 -0
  41. 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
- "sap/ui/thirdparty/jquery",
10
- "sap/ui/documentation/sdk/controller/SampleBaseController",
11
- "sap/ui/model/json/JSONModel",
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/Text",
17
- "sap/ui/core/HTML",
18
- "sap/m/library",
19
- "sap/base/Log",
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,17 +39,14 @@ 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 COZY = "cozy",
47
- COMPACT = "compact",
48
- CONDENSED = "condensed";
49
-
50
50
  return SampleBaseController.extend("sap.ui.documentation.sdk.controller.Sample", {
51
51
  /* =========================================================== */
52
52
  /* lifecycle methods */
@@ -62,35 +62,18 @@ sap.ui.define([
62
62
  showNewTab: false,
63
63
  rtaLoaded: false
64
64
  });
65
- this._oSampleIframeSettings = {
66
- densityMode: COMPACT,
67
- themeActive: "sap_fiori_3",
68
- rtl: false
69
- };
70
65
 
71
66
  this._sId = null; // Used to hold sample ID
72
67
  this._sEntityId = null; // Used to hold entity ID for the sample currently shown
73
68
  this.router = this.getRouter();
74
69
 
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
70
  this.getView().setModel(this.oModel);
90
71
 
91
72
  this.bus = sap.ui.getCore().getEventBus();
92
73
  this.setDefaultSampleTheme();
93
74
  this.bus.subscribe("themeChanged", "onDemoKitThemeChanged", this.onDemoKitThemeChanged, this);
75
+
76
+ this.getOwnerComponent()._sSampleIframeOrigin = ResourcesUtil.getConfig() !== "." ? ResourcesUtil.getConfig() : window.origin;
94
77
  },
95
78
 
96
79
  /* =========================================================== */
@@ -163,24 +146,17 @@ sap.ui.define([
163
146
 
164
147
  // set page title
165
148
  oModelData.title = "Sample: " + oSample.name;
166
-
167
- this._createComponent()
168
- .then(function (oComponentContainer) {
149
+ oModelData.showNewTab = true;
150
+ oModelData.id = oSample.id;
151
+ oModelData.name = oSample.name;
152
+ oModelData.details = oSample.details;
153
+ oModelData.description = oSample.description;
154
+ oModelData.showSettings = true;
155
+
156
+ this._createIframe()
157
+ .then(function (oSampleConfig) {
169
158
  // Store a reference to the currently opened sample on the application component
170
- this.getOwnerComponent()._oCurrentOpenedSample = oComponentContainer ? oComponentContainer : undefined;
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();
159
+ this.getOwnerComponent()._oCurrentOpenedSample = this._oHtmlControl;
184
160
 
185
161
  if (oSampleConfig) {
186
162
 
@@ -199,31 +175,11 @@ sap.ui.define([
199
175
  this._updateFileContent(sRef, sFile);
200
176
  }
201
177
  }
202
-
203
- if (oSampleConfig.iframe || ResourcesUtil.getHasProxy()) {
204
- oComponentContainer = this._createIframe(oComponentContainer, oSampleConfig.iframe);
205
- } else {
206
- this.sIFrameUrl = null;
207
- }
178
+ // Sets the current iframe URL or restores it to "undefined"
179
+ oModelData.iframe = oSampleConfig.iframe;
180
+ oPage.setProperty("enableScrolling", !!oSampleConfig.stretch, true);
208
181
  }
209
182
 
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
183
  this.getAPIReferenceCheckPromise(oSample.entityId).then(function (bHasAPIReference) {
228
184
  this.getView().byId("apiRefButton").setVisible(bHasAPIReference);
229
185
  }.bind(this));
@@ -247,41 +203,59 @@ sap.ui.define([
247
203
  * @public
248
204
  */
249
205
  handleSettings: function () {
250
- var oSampleFrame = this._oHtmlControl.$()[0].contentWindow,
251
- oSampleFrameCore = oSampleFrame.sap.ui.getCore(),
252
- oView;
253
206
 
254
207
  if (!this._oMessageBundle) {
255
- this._oMessageBundle = new oSampleFrame.sap.ui.model.resource.ResourceModel({
208
+ this._oMessageBundle = new ResourceModel({
256
209
  bundleName: "sap.ui.documentation.messagebundle"
257
210
  });
258
211
  }
259
212
 
260
213
  if (!this._oSettingsDialog) {
261
- this._oSettingsDialog = new oSampleFrame.sap.ui.xmlfragment("sap.ui.documentation.sdk.view.appSettingsDialog", this);
214
+ this._oSettingsDialog = sap.ui.xmlfragment("sample", "sap.ui.documentation.sdk.view.appSettingsDialog", this);
262
215
 
263
- oView = oSampleFrameCore.byId("__xmlview0");
264
- oView.setModel(this._oMessageBundle, "i18n");
265
- oView.addDependent(this._oSettingsDialog);
216
+ // oView = sap.ui.getCore().byId("__xmlview0") || sap.ui.getCore().byId("__container0");
217
+ this._oSettingsDialog.setModel(this._oMessageBundle, "i18n");
218
+ // oView.addDependent(this._oSettingsDialog);
266
219
  }
267
220
 
268
- setTimeout(function () {
269
- var oAppSettings = oSampleFrameCore.getConfiguration(),
270
- oThemeSelect = oSampleFrameCore.byId("ThemeSelect"),
271
- sUriParamTheme = UriParameters.fromQuery(window.location.search).get("sap-theme"),
272
- bDensityMode = this._oSampleIframeSettings.densityMode;
221
+ this.loadSampleSettings().then(function() {
222
+ this._oSettingsDialog.open();
223
+ }.bind(this)).catch(function(err) {
224
+ Log.error(err);
225
+ });
226
+ },
273
227
 
274
- // Theme select
275
- oThemeSelect.setSelectedKey(sUriParamTheme ? sUriParamTheme : oAppSettings.getTheme());
228
+ loadSampleSettings: function() {
229
+ return new Promise(function (resolve, reject) {
230
+ var oIframe = this._oHtmlControl.getDomRef();
231
+ oIframe.contentWindow.postMessage({
232
+ type: "SETTINGS",
233
+ reason: "get"
234
+ }, this.getOwnerComponent()._sSampleIframeOrigin);
276
235
 
277
- // RTL
278
- oSampleFrameCore.byId("RTLSwitch").setState(oAppSettings.getRTL());
236
+ window.addEventListener("message", loadSettings);
279
237
 
280
- // Density mode select
281
- oSampleFrameCore.byId("DensityModeSwitch").setSelectedKey(bDensityMode);
238
+ function loadSettings(eMessage) {
239
+ if (eMessage.data.type === "SETTINGS") {
240
+ var oThemeSelect = sap.ui.getCore().byId("sample--ThemeSelect");
282
241
 
283
- this._oSettingsDialog.open();
284
- }.bind(this), 0);
242
+ // Theme select
243
+ oThemeSelect.setSelectedKey(eMessage.data.data.theme);
244
+
245
+ // RTL
246
+ sap.ui.getCore().byId("sample--RTLSwitch").setState(eMessage.data.data.RTL);
247
+
248
+ // Density mode select
249
+ sap.ui.getCore().byId("sample--DensityModeSwitch").setSelectedKey(eMessage.data.data.density.slice(9).toLowerCase());
250
+
251
+ window.removeEventListener("message", loadSettings);
252
+ resolve();
253
+ }
254
+ }
255
+ setTimeout(function() {
256
+ reject("The sample iframe is not loading settings");
257
+ },3000);
258
+ }.bind(this));
285
259
  },
286
260
 
287
261
  /**
@@ -293,22 +267,17 @@ sap.ui.define([
293
267
  },
294
268
 
295
269
  handleSaveAppSettings: function () {
296
- var oSampleFrame = this._oHtmlControl.$()[0].contentWindow,
297
- oSampleFrameCore = oSampleFrame.sap.ui.getCore(),
298
- sDensityMode = oSampleFrameCore.byId("DensityModeSwitch").getSelectedKey(),
299
- sTheme = oSampleFrameCore.byId("ThemeSelect").getSelectedKey(),
300
- bRTL = oSampleFrameCore.byId("RTLSwitch").getState(),
301
- oView = oSampleFrameCore.byId("__xmlview0");
270
+ var sDensityMode = sap.ui.getCore().byId("sample--DensityModeSwitch").getSelectedKey(),
271
+ sTheme = sap.ui.getCore().byId("sample--ThemeSelect").getSelectedKey(),
272
+ bRTL = sap.ui.getCore().byId("sample--RTLSwitch").getState();
302
273
 
303
274
  this._oSettingsDialog.close();
304
275
 
305
276
  // Lazy loading of busy dialog
306
277
  if (!this._oBusyDialog) {
307
- oSampleFrame.sap.ui.require(["sap/m/BusyDialog"], function () {
308
- this._oBusyDialog = new oSampleFrame.sap.m.BusyDialog();
309
- oView.addDependent(this._oBusyDialog);
310
- this._handleBusyDialog();
311
- }.bind(this));
278
+ this._oBusyDialog = new BusyDialog();
279
+ // oView.addDependent(this._oBusyDialog);
280
+ this._handleBusyDialog();
312
281
  } else {
313
282
  this._handleBusyDialog();
314
283
  }
@@ -325,45 +294,16 @@ sap.ui.define([
325
294
  * @private
326
295
  */
327
296
  _applyAppConfiguration: function(sThemeActive, sDensityMode, bRTL){
328
- var oSampleFrame = this._oHtmlControl.$()[0].contentWindow,
329
- oSampleFrameCore = oSampleFrame.sap.ui.getCore();
330
-
331
- if (this._oSampleIframeSettings.densityMode !== sDensityMode) {
332
- this._oSampleIframeSettings.densityMode = sDensityMode;
333
- this._toggleContentDensityClasses(oSampleFrame.jQuery("body"), sDensityMode);
334
- }
335
-
336
- if (this._oSampleIframeSettings.rtl !== bRTL) {
337
- oSampleFrameCore.getConfiguration().setRTL(bRTL);
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
- }
297
+ var oIframe = this._oHtmlControl.getDomRef();
298
+ oIframe.contentWindow.postMessage({
299
+ type: "SETTINGS",
300
+ reason: "set",
301
+ data: {
302
+ "density": "sapUiSize" + capitalize(sDensityMode),
303
+ "RTL": bRTL,
304
+ "theme": sThemeActive
305
+ }
306
+ }, this.getOwnerComponent()._sSampleIframeOrigin);
367
307
  },
368
308
 
369
309
  /**
@@ -454,140 +394,92 @@ sap.ui.define([
454
394
  return sSampleId;
455
395
  },
456
396
 
457
- _createIframe : function (oIframeContent, vIframe) {
458
- var sSampleId = this._sId,
397
+ _createIframe : function () {
398
+ return new Promise(function (resolve, reject) {
399
+ var sSampleId = this._sId,
459
400
  sIframePath = "",
460
401
  rExtractFilename = /\/([^\/]*)$/,// extracts everything after the last slash (e.g. some/path/index.html -> index.html)
461
402
  rStripUI5Ending = /\..+$/,// removes everything after the first dot in the filename (e.g. someFile.qunit.html -> .qunit.html)
462
403
  aFileNameMatches,
463
404
  sFileName,
464
- sFileEnding;
465
-
466
- if (typeof vIframe === "string") {
467
- sIframePath = this._resolveIframePath(sSampleId, vIframe);
468
-
469
- // strip the file extension to be able to use jQuery.sap.getModulePath
470
- aFileNameMatches = rExtractFilename.exec(vIframe);
471
- sFileName = (aFileNameMatches && aFileNameMatches.length > 1 ? aFileNameMatches[1] : vIframe);
472
- sFileEnding = rStripUI5Ending.exec(sFileName)[0];
473
- var sIframeWithoutUI5Ending = sFileName.replace(rStripUI5Ending, "");
474
-
475
- // combine namespace with the file name again
476
- this.sIFrameUrl = sap.ui.require.toUrl((sIframePath + "/" + sIframeWithoutUI5Ending).replace(/\./g, "/")) + sFileEnding || ".html";
477
- } else if (ResourcesUtil.getHasProxy()) {
478
- var sSamplePath = ResourcesUtil.getResourceOriginPath(sap.ui.require.toUrl(this._sId.replace(/\./g, "/"))),
479
- sSampleOrigin = (window['sap-ui-documentation-config'] && window['sap-ui-documentation-config'].demoKitResourceOrigin) || "",
405
+ sFileEnding,
406
+ vIframe;
407
+
408
+ this.fResolve = resolve;
409
+ this.fReject = reject;
410
+ var sSampleOrigin = (window['sap-ui-documentation-config'] && window['sap-ui-documentation-config'].demoKitResourceOrigin) || "",
480
411
  sSampleVersion = ResourcesUtil.getResourcesVersion();
481
412
 
482
- this.sIFrameUrl =
483
- "resources/sap/ui/documentation/sdk/index.html" +
413
+ this.sIFrameUrl = ResourcesUtil.getResourceOrigin() +
414
+ "/resources/sap/ui/documentation/sdk/index.html" +
484
415
  "?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
- }
492
-
493
- if (!this._oHtmlControl) {
494
- var oComponent = this.getOwnerComponent();
495
-
496
- // Guarantees the sample initially to have the same content density, as the whole Demo Kit
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;
506
- }
507
-
508
- this._oHtmlControl = new HTML({
509
- id : "sampleFrame",
510
- content : '<iframe src="' + this.sIFrameUrl + '" id="sampleFrame" frameBorder="0"></iframe>'
511
- }).addEventDelegate({
512
- onAfterRendering : function () {
513
-
514
- // Do not attach on "load" event on every onAfterRendering of the HTML control
515
- if (!this._oHtmlControl._jQueryHTMLControlLoadEventAttached) {
516
- this._oHtmlControl.$().on("load", function () {
517
- var oSampleFrame = this._oHtmlControl.$()[0].contentWindow,
518
- oSampleFrameCore = oSampleFrame.sap.ui.getCore(),
519
- oFrame = document.getElementById("sampleFrame");
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
- };
416
+ + "&sap-ui-xx-sample-origin=" + sSampleOrigin + sSampleVersion
417
+ + "&sap-ui-xx-dk-origin=" + window.location.origin;
418
+
419
+ if (!this._oHtmlControl) {
420
+
421
+ var fnMessage = function (eMessage) {
422
+ if (eMessage.data.type === "INIT") {
423
+ var oConfiguration = sap.ui.getCore().getConfiguration();
424
+ if (eMessage.data.config && eMessage.data.config.sample && eMessage.data.config.sample.iframe) {
425
+ sSampleId = this._sId;
426
+ vIframe = eMessage.data.config.sample.iframe;
427
+ sIframePath = this._resolveIframePath(sSampleId, vIframe);
428
+
429
+ //vlaid only for samples that contains own index.html
430
+ // strip the file extension to be able to use jQuery.sap.getModulePath
431
+ aFileNameMatches = rExtractFilename.exec(vIframe);
432
+ sFileName = (aFileNameMatches && aFileNameMatches.length > 1 ? aFileNameMatches[1] : vIframe);
433
+ sFileEnding = rStripUI5Ending.exec(sFileName)[0];
434
+ var sIframeWithoutUI5Ending = sFileName.replace(rStripUI5Ending, "");
435
+
436
+ // combine namespace with the file name again
437
+ this.sIFrameUrl = (sap.ui.require.toUrl((sIframePath + "/" + sIframeWithoutUI5Ending).replace(/\./g, "/")) + sFileEnding || ".html")
438
+ + "?sap-ui-theme=" + sap.ui.getCore().getConfiguration().getTheme();
439
+ this._oHtmlControl.getDomRef().src = this.sIFrameUrl;
440
+ }
441
+ this._oHtmlControl.getDomRef().contentWindow.postMessage({
442
+ type: "SETTINGS",
443
+ reason: "set",
444
+ data: {
445
+ "density": this.getOwnerComponent().getContentDensityClass(),
446
+ "RTL": oConfiguration.getRTL(),
447
+ "theme": oConfiguration.getTheme()
561
448
  }
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;
449
+ }, this.getOwnerComponent()._sSampleIframeOrigin);
450
+ this.fResolve(eMessage.data.config.sample);
451
+ } else if (eMessage.data.type === "ERR") {
452
+ this.fReject(eMessage.data.data.msg);
453
+ } else if (eMessage.data.type === "RTA") {
454
+ this._loadRTA.call(this);
577
455
  }
456
+ }.bind(this);
457
+
458
+ this._oHtmlControl = new HTML({
459
+ id : "sampleFrame",
460
+ content : '<iframe src="' + this.sIFrameUrl + '" id="sampleFrame" frameBorder="0"></iframe>'
461
+ }).addEventDelegate({
462
+ onBeforeRendering: function () {
463
+ window.removeEventListener("message", fnMessage);
464
+ }
465
+ })
466
+ .addEventDelegate({
467
+ onAfterRendering: function () {
468
+ window.addEventListener("message", fnMessage);
469
+ }
470
+ });
471
+ } else {
472
+ // If we already have the control just navigate to the new URL
473
+ this._oHtmlControl.getDomRef().src = this.sIFrameUrl;
474
+ }
475
+ this.byId("page").removeAllContent();
476
+ this.byId("page").addContent(this._oHtmlControl);
578
477
 
579
- }.bind(this)
580
- });
581
- } else {
582
- // If we already have the control just navigate to the new URL
583
- this._oHtmlControl.getDomRef().src = this.sIFrameUrl;
584
- }
585
-
586
- return this._oHtmlControl;
587
-
478
+ }.bind(this));
588
479
  },
589
480
 
590
481
  _createComponent : function () {
482
+
591
483
  // create component only once
592
484
  var sCompId = 'sampleComp-' + this._sId;
593
485
  var sCompName = this._sId;
@@ -616,10 +508,10 @@ sap.ui.define([
616
508
  },
617
509
 
618
510
  onDemoKitThemeChanged: function(sChannelId, sEventId, oData) {
619
- if (this._oHtmlControl && !ResourcesUtil.getHasProxy()) {
620
- this._oHtmlControl.$()[0].contentWindow.sap.ui.getCore().applyTheme(oData.sThemeActive);
511
+ if (this._oHtmlControl && this.getModel().getProperty("/iframe")) {
512
+ this._applySearchParamValueToIframeURL("sap-ui-theme", oData.sThemeActive);
513
+ this._oHtmlControl.getDomRef().src = this.sIFrameUrl;
621
514
  }
622
- this.setDefaultSampleTheme();
623
515
  },
624
516
 
625
517
  onNavBack : function (oEvt) {
@@ -657,24 +549,9 @@ sap.ui.define([
657
549
  this.sIFrameUrl = this.sIFrameUrl + decodeURI(oIFrameURL.search);
658
550
  },
659
551
 
660
- _loadRTA: function (
661
- Utils,
662
- FakeLrepConnectorLocalStorage,
663
- JsControlTreeModifier
664
- ) {
552
+ _loadRTA: function () {
665
553
  var oModelData = this.oModel.getData();
666
554
 
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
555
  oModelData.rtaLoaded = true;
679
556
 
680
557
  this.oModel.setData(oModelData);
@@ -688,29 +565,17 @@ sap.ui.define([
688
565
  },
689
566
 
690
567
  onToggleAdaptationMode : function (oEvt) {
691
- if (this.oModel.getData().iframe) {
692
- window.document.getElementsByTagName("iframe")[0].onToggleAdaptationMode();
693
- return;
568
+ if (!this._oHtmlControl || !this._oHtmlControl.getDomRef()) {
569
+ return false;
694
570
  }
695
- sap.ui.require([
696
- "sap/ui/rta/api/startKeyUserAdaptation"
697
- ], function (
698
- startKeyUserAdaptation
699
- ) {
700
- if (!this._oRTA) {
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));
571
+
572
+ var oIframe = this._oHtmlControl.getDomRef();
573
+ oIframe.contentWindow.postMessage({
574
+ type: "RTA",
575
+ data: {
576
+ "msg": "Start the RTA"
712
577
  }
713
- }.bind(this));
578
+ }, this.getOwnerComponent()._sSampleIframeOrigin);
714
579
  },
715
580
 
716
581
  onRouteNotFound: function() {
@@ -38,9 +38,8 @@ sap.ui.define([
38
38
  },
39
39
  onDownload: function () {
40
40
  sap.ui.require([
41
- "sap/ui/thirdparty/jszip",
42
- "sap/ui/core/util/File"
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(),
@@ -5,14 +5,13 @@
5
5
  */
6
6
 
7
7
  sap.ui.define([
8
- "sap/ui/thirdparty/jquery",
9
- "sap/ui/documentation/sdk/controller/BaseController",
8
+ "sap/ui/documentation/sdk/controller/BaseController",
10
9
  "sap/ui/documentation/sdk/controller/util/SearchUtil",
11
10
  "sap/ui/documentation/sdk/controller/util/Highlighter",
12
11
  "sap/ui/model/json/JSONModel",
13
- "sap/m/GroupHeaderListItem",
14
- "sap/base/Log"
15
- ], function(jQuery, BaseController, SearchUtil, Highlighter, JSONModel, GroupHeaderListItem, Log) {
12
+ "sap/m/GroupHeaderListItem",
13
+ "sap/base/Log"
14
+ ], function(BaseController, SearchUtil, Highlighter, JSONModel, GroupHeaderListItem, Log) {
16
15
  "use strict";
17
16
 
18
17
  return BaseController.extend("sap.ui.documentation.sdk.controller.SearchPage", {