@openui5/sap.ui.documentation 1.97.1 → 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 (98) hide show
  1. package/.reuse/dep5 +25 -30
  2. package/THIRDPARTY.txt +15 -22
  3. package/package.json +6 -6
  4. package/src/sap/ui/documentation/.library +1 -1
  5. package/src/sap/ui/documentation/TitleLink.js +1 -2
  6. package/src/sap/ui/documentation/library.js +4 -5
  7. package/src/sap/ui/documentation/messagebundle.properties +20 -8
  8. package/src/sap/ui/documentation/messagebundle_ar.properties +16 -5
  9. package/src/sap/ui/documentation/messagebundle_bg.properties +15 -4
  10. package/src/sap/ui/documentation/messagebundle_ca.properties +16 -5
  11. package/src/sap/ui/documentation/messagebundle_cs.properties +16 -5
  12. package/src/sap/ui/documentation/messagebundle_cy.properties +16 -5
  13. package/src/sap/ui/documentation/messagebundle_da.properties +16 -5
  14. package/src/sap/ui/documentation/messagebundle_de.properties +16 -5
  15. package/src/sap/ui/documentation/messagebundle_el.properties +15 -4
  16. package/src/sap/ui/documentation/messagebundle_en.properties +16 -5
  17. package/src/sap/ui/documentation/messagebundle_en_GB.properties +16 -5
  18. package/src/sap/ui/documentation/messagebundle_en_US_sappsd.properties +19 -8
  19. package/src/sap/ui/documentation/messagebundle_en_US_saprigi.properties +2 -2
  20. package/src/sap/ui/documentation/messagebundle_en_US_saptrc.properties +19 -8
  21. package/src/sap/ui/documentation/messagebundle_es.properties +16 -5
  22. package/src/sap/ui/documentation/messagebundle_es_MX.properties +16 -5
  23. package/src/sap/ui/documentation/messagebundle_et.properties +16 -5
  24. package/src/sap/ui/documentation/messagebundle_fi.properties +17 -6
  25. package/src/sap/ui/documentation/messagebundle_fr.properties +16 -5
  26. package/src/sap/ui/documentation/messagebundle_fr_CA.properties +16 -5
  27. package/src/sap/ui/documentation/messagebundle_hi.properties +16 -5
  28. package/src/sap/ui/documentation/messagebundle_hr.properties +16 -5
  29. package/src/sap/ui/documentation/messagebundle_hu.properties +15 -4
  30. package/src/sap/ui/documentation/messagebundle_id.properties +16 -5
  31. package/src/sap/ui/documentation/messagebundle_it.properties +16 -5
  32. package/src/sap/ui/documentation/messagebundle_iw.properties +16 -5
  33. package/src/sap/ui/documentation/messagebundle_ja.properties +16 -5
  34. package/src/sap/ui/documentation/messagebundle_kk.properties +16 -5
  35. package/src/sap/ui/documentation/messagebundle_ko.properties +16 -5
  36. package/src/sap/ui/documentation/messagebundle_lt.properties +16 -5
  37. package/src/sap/ui/documentation/messagebundle_lv.properties +15 -4
  38. package/src/sap/ui/documentation/messagebundle_ms.properties +16 -5
  39. package/src/sap/ui/documentation/messagebundle_nl.properties +16 -5
  40. package/src/sap/ui/documentation/messagebundle_no.properties +17 -6
  41. package/src/sap/ui/documentation/messagebundle_pl.properties +15 -4
  42. package/src/sap/ui/documentation/messagebundle_pt.properties +16 -5
  43. package/src/sap/ui/documentation/messagebundle_pt_PT.properties +16 -5
  44. package/src/sap/ui/documentation/messagebundle_ro.properties +16 -5
  45. package/src/sap/ui/documentation/messagebundle_ru.properties +16 -5
  46. package/src/sap/ui/documentation/messagebundle_sh.properties +17 -6
  47. package/src/sap/ui/documentation/messagebundle_sk.properties +16 -5
  48. package/src/sap/ui/documentation/messagebundle_sl.properties +16 -5
  49. package/src/sap/ui/documentation/messagebundle_sv.properties +16 -5
  50. package/src/sap/ui/documentation/messagebundle_th.properties +16 -5
  51. package/src/sap/ui/documentation/messagebundle_tr.properties +16 -5
  52. package/src/sap/ui/documentation/messagebundle_uk.properties +17 -6
  53. package/src/sap/ui/documentation/messagebundle_vi.properties +16 -5
  54. package/src/sap/ui/documentation/messagebundle_zh_CN.properties +16 -5
  55. package/src/sap/ui/documentation/messagebundle_zh_TW.properties +16 -5
  56. package/src/sap/ui/documentation/sdk/Component.js +1 -5
  57. package/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js +9 -15
  58. package/src/sap/ui/documentation/sdk/controller/ApiDetailIndexDeprecatedExperimental.controller.js +1 -3
  59. package/src/sap/ui/documentation/sdk/controller/ApiMaster.controller.js +0 -2
  60. package/src/sap/ui/documentation/sdk/controller/App.controller.js +1 -3
  61. package/src/sap/ui/documentation/sdk/controller/BaseController.js +1 -1
  62. package/src/sap/ui/documentation/sdk/controller/Code.controller.js +1 -2
  63. package/src/sap/ui/documentation/sdk/controller/ControlsMaster.controller.js +15 -18
  64. package/src/sap/ui/documentation/sdk/controller/Entity.controller.js +1 -2
  65. package/src/sap/ui/documentation/sdk/controller/LiveEditor.controller.js +1 -2
  66. package/src/sap/ui/documentation/sdk/controller/Sample.controller.js +252 -166
  67. package/src/sap/ui/documentation/sdk/controller/SampleBaseController.js +2 -3
  68. package/src/sap/ui/documentation/sdk/controller/SearchPage.controller.js +4 -5
  69. package/src/sap/ui/documentation/sdk/controller/SubApiDetail.controller.js +8 -9
  70. package/src/sap/ui/documentation/sdk/controller/TermsOfUse.controller.js +3 -2
  71. package/src/sap/ui/documentation/sdk/controller/TopicDetail.controller.js +24 -26
  72. package/src/sap/ui/documentation/sdk/controller/TopicDetailInitial.controller.js +2 -2
  73. package/src/sap/ui/documentation/sdk/controller/VersionNotFound.controller.js +2 -0
  74. package/src/sap/ui/documentation/sdk/controller/Welcome.controller.js +3 -3
  75. package/src/sap/ui/documentation/sdk/controller/config/sampleForwardingConfig.js +40 -0
  76. package/src/sap/ui/documentation/sdk/controller/util/ConfigUtil.js +3 -4
  77. package/src/sap/ui/documentation/sdk/controller/util/ControlsInfo.js +7 -6
  78. package/src/sap/ui/documentation/sdk/controller/util/DataTable.js +1 -1
  79. package/src/sap/ui/documentation/sdk/controller/util/DataTableHelper.js +1 -1
  80. package/src/sap/ui/documentation/sdk/controller/util/IndexWorker.js +1 -1
  81. package/src/sap/ui/documentation/sdk/controller/util/datatable/filters/DataTableFilterDropDown.js +0 -2
  82. package/src/sap/ui/documentation/sdk/controller/util/datatable/filters/DataTableFilterDropDownRenderer.js +7 -1
  83. package/src/sap/ui/documentation/sdk/controller/util/datatable/filters/DataTableFilterRange.js +2 -4
  84. package/src/sap/ui/documentation/sdk/controller/util/overlay/Overlay.js +1 -1
  85. package/src/sap/ui/documentation/sdk/cookieSettingsDialog/controller/CookieSettingsDialog.controller.js +1 -2
  86. package/src/sap/ui/documentation/sdk/css/style.css +11 -2
  87. package/src/sap/ui/documentation/sdk/index.html +133 -25
  88. package/src/sap/ui/documentation/sdk/model/formatter.js +1 -1
  89. package/src/sap/ui/documentation/sdk/model/libraryData.js +9 -4
  90. package/src/sap/ui/documentation/sdk/util/DocumentationRouter.js +11 -5
  91. package/src/sap/ui/documentation/sdk/util/Resources.js +5 -2
  92. package/src/sap/ui/documentation/sdk/view/NewsPopover.fragment.xml +2 -2
  93. package/src/sap/ui/documentation/sdk/view/Sample.view.xml +5 -1
  94. package/src/sap/ui/documentation/sdk/view/Welcome.view.xml +87 -39
  95. package/src/sap/ui/documentation/sdk/view/appSettingsDialog.fragment.xml +1 -0
  96. package/src/sap/ui/documentation/themes/sap_horizon_dark/library.source.less +9 -0
  97. package/src/sap/ui/documentation/themes/sap_horizon_hcb/library.source.less +9 -0
  98. package/src/sap/ui/documentation/themes/sap_horizon_hcw/library.source.less +9 -0
@@ -6,33 +6,41 @@
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",
21
+ "sap/base/util/UriParameters",
20
22
  "sap/ui/core/Fragment",
21
- "sap/ui/documentation/sdk/util/Resources"
23
+ "sap/ui/documentation/sdk/util/Resources",
24
+ "./config/sampleForwardingConfig",
25
+ "sap/base/strings/capitalize"
22
26
  ], function(
23
- jQuery,
24
27
  SampleBaseController,
25
28
  JSONModel,
29
+ ResourceModel,
26
30
  Component,
27
31
  ComponentContainer,
28
32
  ControlsInfo,
29
33
  ToggleFullScreenHandler,
34
+ BusyDialog,
30
35
  Text,
31
36
  HTML,
32
37
  mobileLibrary,
33
38
  Log,
39
+ UriParameters,
34
40
  Fragment,
35
- ResourcesUtil
41
+ ResourcesUtil,
42
+ sampleForwardingConfig,
43
+ capitalize
36
44
  ) {
37
45
  "use strict";
38
46
 
@@ -57,18 +65,15 @@ sap.ui.define([
57
65
 
58
66
  this._sId = null; // Used to hold sample ID
59
67
  this._sEntityId = null; // Used to hold entity ID for the sample currently shown
60
-
61
- // Load runtime authoring asynchronously
62
- Promise.all([
63
- sap.ui.getCore().loadLibrary("sap.ui.fl", {async: true}),
64
- sap.ui.getCore().loadLibrary("sap.ui.rta", {async: true})
65
- ]).then(this._loadRTA.bind(this));
68
+ this.router = this.getRouter();
66
69
 
67
70
  this.getView().setModel(this.oModel);
68
71
 
69
72
  this.bus = sap.ui.getCore().getEventBus();
70
73
  this.setDefaultSampleTheme();
71
74
  this.bus.subscribe("themeChanged", "onDemoKitThemeChanged", this.onDemoKitThemeChanged, this);
75
+
76
+ this.getOwnerComponent()._sSampleIframeOrigin = ResourcesUtil.getConfig() !== "." ? ResourcesUtil.getConfig() : window.origin;
72
77
  },
73
78
 
74
79
  /* =========================================================== */
@@ -85,6 +90,14 @@ sap.ui.define([
85
90
  this._sEntityId = event.getParameter("arguments").entityId;
86
91
 
87
92
  this.byId("page").setBusy(true);
93
+
94
+ if (sampleForwardingConfig[this._sId]) {
95
+ return this.router.navTo("sample", {
96
+ entityId: sampleForwardingConfig[this._sId].entityId,
97
+ sampleId: sampleForwardingConfig[this._sId].sampleId
98
+ }, true);
99
+ }
100
+
88
101
  this.getModel("appView").setProperty("/bHasMaster", false);
89
102
 
90
103
  ControlsInfo.loadData().then(this._loadSample.bind(this));
@@ -133,23 +146,17 @@ sap.ui.define([
133
146
 
134
147
  // set page title
135
148
  oModelData.title = "Sample: " + oSample.name;
136
-
137
- this._createComponent()
138
- .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) {
139
158
  // Store a reference to the currently opened sample on the application component
140
- this.getOwnerComponent()._oCurrentOpenedSample = oComponentContainer ? oComponentContainer : undefined;
141
-
142
- //get config
143
- var oComponent = Component.get(oComponentContainer.getComponent());
144
- var oConfig = (oComponent.getMetadata()) ? oComponent.getMetadata().getConfig() : null;
145
- var oSampleConfig = oConfig && oConfig.sample || {};
146
-
147
- // only have the option to run standalone if there is an iframe
148
- oModelData.showNewTab = !!oSampleConfig.iframe || ResourcesUtil.getHasProxy();
149
- oModelData.id = oSample.id;
150
- oModelData.name = oSample.name;
151
- oModelData.details = oSample.details;
152
- oModelData.description = oSample.description;
159
+ this.getOwnerComponent()._oCurrentOpenedSample = this._oHtmlControl;
153
160
 
154
161
  if (oSampleConfig) {
155
162
 
@@ -168,30 +175,10 @@ sap.ui.define([
168
175
  this._updateFileContent(sRef, sFile);
169
176
  }
170
177
  }
171
-
172
- if (oSampleConfig.iframe || ResourcesUtil.getHasProxy()) {
173
- oComponentContainer = this._createIframe(oComponentContainer, oSampleConfig.iframe);
174
- } else {
175
- this.sIFrameUrl = null;
176
- }
177
- }
178
-
179
- // Sets the current iframe URL or restores it to "undefined"
180
- oModelData.iframe = oSampleConfig.iframe || ResourcesUtil.getHasProxy();
181
-
182
- // handle stretch content
183
- var bStretch = !!oSampleConfig.stretch;
184
- var sHeight = bStretch ? "100%" : null;
185
- oPage.setEnableScrolling(!bStretch);
186
- if (oComponentContainer.setHeight) {
187
- oComponentContainer.setHeight(sHeight);
178
+ // Sets the current iframe URL or restores it to "undefined"
179
+ oModelData.iframe = oSampleConfig.iframe;
180
+ oPage.setProperty("enableScrolling", !!oSampleConfig.stretch, true);
188
181
  }
189
- // add content
190
- oPage.removeAllContent();
191
- oPage.addContent(oComponentContainer);
192
-
193
- // scroll to top of page
194
- oPage.scrollTo(0);
195
182
 
196
183
  this.getAPIReferenceCheckPromise(oSample.entityId).then(function (bHasAPIReference) {
197
184
  this.getView().byId("apiRefButton").setVisible(bHasAPIReference);
@@ -211,6 +198,125 @@ sap.ui.define([
211
198
  });
212
199
  },
213
200
 
201
+ /**
202
+ * Opens the View settings dialog
203
+ * @public
204
+ */
205
+ handleSettings: function () {
206
+
207
+ if (!this._oMessageBundle) {
208
+ this._oMessageBundle = new ResourceModel({
209
+ bundleName: "sap.ui.documentation.messagebundle"
210
+ });
211
+ }
212
+
213
+ if (!this._oSettingsDialog) {
214
+ this._oSettingsDialog = sap.ui.xmlfragment("sample", "sap.ui.documentation.sdk.view.appSettingsDialog", this);
215
+
216
+ // oView = sap.ui.getCore().byId("__xmlview0") || sap.ui.getCore().byId("__container0");
217
+ this._oSettingsDialog.setModel(this._oMessageBundle, "i18n");
218
+ // oView.addDependent(this._oSettingsDialog);
219
+ }
220
+
221
+ this.loadSampleSettings().then(function() {
222
+ this._oSettingsDialog.open();
223
+ }.bind(this)).catch(function(err) {
224
+ Log.error(err);
225
+ });
226
+ },
227
+
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);
235
+
236
+ window.addEventListener("message", loadSettings);
237
+
238
+ function loadSettings(eMessage) {
239
+ if (eMessage.data.type === "SETTINGS") {
240
+ var oThemeSelect = sap.ui.getCore().byId("sample--ThemeSelect");
241
+
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));
259
+ },
260
+
261
+ /**
262
+ * Closes the View settings dialog
263
+ * @public
264
+ */
265
+ handleCloseAppSettings: function () {
266
+ this._oSettingsDialog.close();
267
+ },
268
+
269
+ handleSaveAppSettings: function () {
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();
273
+
274
+ this._oSettingsDialog.close();
275
+
276
+ // Lazy loading of busy dialog
277
+ if (!this._oBusyDialog) {
278
+ this._oBusyDialog = new BusyDialog();
279
+ // oView.addDependent(this._oBusyDialog);
280
+ this._handleBusyDialog();
281
+ } else {
282
+ this._handleBusyDialog();
283
+ }
284
+
285
+ // handle settings change
286
+ this._applyAppConfiguration(sTheme, sDensityMode, bRTL);
287
+ },
288
+
289
+ /**
290
+ * Apply content configuration
291
+ * @param {string} sThemeActive name of the theme
292
+ * @param {string} sDensityMode content density mode
293
+ * @param {boolean} bRTL right to left mode
294
+ * @private
295
+ */
296
+ _applyAppConfiguration: function(sThemeActive, sDensityMode, bRTL){
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);
307
+ },
308
+
309
+ /**
310
+ * Handles View settings dialog
311
+ * @public
312
+ */
313
+ _handleBusyDialog : function () {
314
+ this._oBusyDialog.open();
315
+ setTimeout(function () {
316
+ this._oBusyDialog.close();
317
+ }.bind(this), 1000);
318
+ },
319
+
214
320
  _updateFileContent: function(sRef, sFile) {
215
321
  this.fetchSourceFile(sRef + "/" + sFile).then(function(vContent) {
216
322
  var aFiles = this.oModel.getProperty("/files");
@@ -267,7 +373,7 @@ sap.ui.define([
267
373
  /**
268
374
  * Extends the sSampleId with the relative path defined in sIframePath and returns the resulting path.
269
375
  * @param {string} sSampleId
270
- * @param {string} sIframe
376
+ * @param {string} sIframePath
271
377
  * @returns {string}
272
378
  * @private
273
379
  */
@@ -288,85 +394,92 @@ sap.ui.define([
288
394
  return sSampleId;
289
395
  },
290
396
 
291
- _createIframe : function (oIframeContent, vIframe) {
292
- var sSampleId = this._sId,
397
+ _createIframe : function () {
398
+ return new Promise(function (resolve, reject) {
399
+ var sSampleId = this._sId,
293
400
  sIframePath = "",
294
401
  rExtractFilename = /\/([^\/]*)$/,// extracts everything after the last slash (e.g. some/path/index.html -> index.html)
295
402
  rStripUI5Ending = /\..+$/,// removes everything after the first dot in the filename (e.g. someFile.qunit.html -> .qunit.html)
296
403
  aFileNameMatches,
297
404
  sFileName,
298
- sFileEnding;
299
-
300
- if (typeof vIframe === "string") {
301
- sIframePath = this._resolveIframePath(sSampleId, vIframe);
302
-
303
- // strip the file extension to be able to use jQuery.sap.getModulePath
304
- aFileNameMatches = rExtractFilename.exec(vIframe);
305
- sFileName = (aFileNameMatches && aFileNameMatches.length > 1 ? aFileNameMatches[1] : vIframe);
306
- sFileEnding = rStripUI5Ending.exec(sFileName)[0];
307
- var sIframeWithoutUI5Ending = sFileName.replace(rStripUI5Ending, "");
308
-
309
- // combine namespace with the file name again
310
- this.sIFrameUrl = sap.ui.require.toUrl((sIframePath + "/" + sIframeWithoutUI5Ending).replace(/\./g, "/")) + sFileEnding || ".html";
311
- } else if (ResourcesUtil.getHasProxy()) {
312
- var sSamplePath = ResourcesUtil.getResourceOriginPath(sap.ui.require.toUrl(this._sId.replace(/\./g, "/"))),
313
- 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) || "",
314
411
  sSampleVersion = ResourcesUtil.getResourcesVersion();
315
412
 
316
- this.sIFrameUrl =
317
- "resources/sap/ui/documentation/sdk/index.html" +
413
+ this.sIFrameUrl = ResourcesUtil.getResourceOrigin() +
414
+ "/resources/sap/ui/documentation/sdk/index.html" +
318
415
  "?sap-ui-xx-sample-id=" + sSampleId
319
- + "&&sap-ui-xx-sample-path=" + sSamplePath
320
- + "&&sap-ui-xx-sample-origin=" + sSampleOrigin
321
- + "&&sap-ui-xx-sample-version=" + sSampleVersion;
322
- } else {
323
- Log.error("no iframe source was provided");
324
- return;
325
- }
326
-
327
- if (!this._oHtmlControl) {
328
- this._oHtmlControl = new HTML({
329
- id : "sampleFrame",
330
- content : '<iframe src="' + this.sIFrameUrl + '" id="sampleFrame" frameBorder="0"></iframe>'
331
- }).addEventDelegate({
332
- onAfterRendering : function () {
333
-
334
- // Do not attach on "load" event on every onAfterRendering of the HTML control
335
- if (!this._oHtmlControl._jQueryHTMLControlLoadEventAttached) {
336
- this._oHtmlControl.$().on("load", function () {
337
- var oSampleFrame = this._oHtmlControl.$()[0].contentWindow,
338
- oSampleFrameCore = oSampleFrame.sap.ui.getCore();
339
-
340
- // Apply theme settings to iframe sample
341
- oSampleFrame.sap.ui.getCore().attachInit(function () {
342
- var bCompact = jQuery(document.body).hasClass("sapUiSizeCompact");
343
-
344
- oSampleFrameCore.applyTheme(ResourcesUtil.getHasProxy() ? this._sDefaultSampleTheme : this._oCore.getConfiguration().getTheme());
345
- oSampleFrameCore.getConfiguration().setRTL(this._oCore.getConfiguration().getRTL());
346
- oSampleFrame.jQuery('body')
347
- .toggleClass("sapUiSizeCompact", bCompact)
348
- .toggleClass("sapUiSizeCozy", !bCompact);
349
-
350
- // Notify Core for content density change
351
- oSampleFrameCore.notifyContentDensityChanged();
352
- }.bind(this));
353
- }.bind(this));
354
-
355
- this._oHtmlControl._jQueryHTMLControlLoadEventAttached = true;
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()
448
+ }
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);
356
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);
357
477
 
358
- }.bind(this)
359
- });
360
- } else {
361
- // If we already have the control just navigate to the new URL
362
- this._oHtmlControl.getDomRef().src = this.sIFrameUrl;
363
- }
364
-
365
- return this._oHtmlControl;
366
-
478
+ }.bind(this));
367
479
  },
368
480
 
369
481
  _createComponent : function () {
482
+
370
483
  // create component only once
371
484
  var sCompId = 'sampleComp-' + this._sId;
372
485
  var sCompName = this._sId;
@@ -395,10 +508,10 @@ sap.ui.define([
395
508
  },
396
509
 
397
510
  onDemoKitThemeChanged: function(sChannelId, sEventId, oData) {
398
- if (this._oHtmlControl) {
399
- 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;
400
514
  }
401
- this.setDefaultSampleTheme();
402
515
  },
403
516
 
404
517
  onNavBack : function (oEvt) {
@@ -437,28 +550,8 @@ sap.ui.define([
437
550
  },
438
551
 
439
552
  _loadRTA: function () {
440
- sap.ui.require([
441
- "sap/ui/fl/Utils",
442
- "sap/ui/fl/FakeLrepConnectorLocalStorage",
443
- "sap/ui/core/util/reflection/JsControlTreeModifier"
444
- ], function (
445
- Utils,
446
- FakeLrepConnectorLocalStorage,
447
- JsControlTreeModifier
448
- ) {
449
553
  var oModelData = this.oModel.getData();
450
554
 
451
- // fake stable IDs
452
- JsControlTreeModifier.checkControlId = function () {
453
- return true;
454
- };
455
- Utils.checkControlId = function() {
456
- return true;
457
- };
458
-
459
- FakeLrepConnectorLocalStorage.enableFakeConnector({
460
- "isProductiveSystem": true
461
- });
462
555
  oModelData.rtaLoaded = true;
463
556
 
464
557
  this.oModel.setData(oModelData);
@@ -469,27 +562,20 @@ sap.ui.define([
469
562
  this._oRTA = null;
470
563
  }
471
564
  }, this);
472
- }.bind(this));
473
565
  },
474
566
 
475
567
  onToggleAdaptationMode : function (oEvt) {
476
- sap.ui.require([
477
- "sap/ui/rta/api/startKeyUserAdaptation"
478
- ], function (
479
- startKeyUserAdaptation
480
- ) {
481
- if (!this._oRTA) {
482
- startKeyUserAdaptation({
483
- rootControl : this.byId("page").getContent()[0].getComponentInstance()
484
- }).then(function(oRta) {
485
- this._oRTA = oRta;
486
- this._oRTA.attachStop(function () {
487
- this._oRTA.destroy();
488
- delete this._oRTA;
489
- }.bind(this));
490
- }.bind(this));
568
+ if (!this._oHtmlControl || !this._oHtmlControl.getDomRef()) {
569
+ return false;
570
+ }
571
+
572
+ var oIframe = this._oHtmlControl.getDomRef();
573
+ oIframe.contentWindow.postMessage({
574
+ type: "RTA",
575
+ data: {
576
+ "msg": "Start the RTA"
491
577
  }
492
- }.bind(this));
578
+ }, this.getOwnerComponent()._sSampleIframeOrigin);
493
579
  },
494
580
 
495
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", {
@@ -7,10 +7,7 @@
7
7
  sap.ui.define([
8
8
  "sap/ui/thirdparty/jquery",
9
9
  "sap/ui/documentation/sdk/controller/BaseController",
10
- "sap/ui/model/json/JSONModel",
11
- "sap/ui/documentation/sdk/controller/util/ControlsInfo",
12
10
  "sap/ui/documentation/sdk/util/ToggleFullScreenHandler",
13
- "sap/ui/documentation/sdk/controller/util/APIInfo",
14
11
  "sap/ui/documentation/sdk/model/formatter",
15
12
  "sap/m/Image",
16
13
  "sap/m/Label",
@@ -23,9 +20,12 @@ sap.ui.define([
23
20
  "sap/m/library",
24
21
  "sap/ui/core/library",
25
22
  "sap/m/CustomListItem",
26
- "sap/m/List"
27
- ], function (jQuery, BaseController, JSONModel, ControlsInfo, ToggleFullScreenHandler, APIInfo,
28
- formatter, Image, Label, Link, Text, HBox, ObjectAttribute, ObjectStatus, Popover, library, coreLibrary, CustomListItem, List) {
23
+ "sap/m/List",
24
+ "sap/ui/dom/includeStylesheet",
25
+ "sap/ui/dom/includeScript"
26
+ ], function (jQuery, BaseController, ToggleFullScreenHandler,
27
+ formatter, Image, Label, Link, Text, HBox, ObjectAttribute, ObjectStatus, Popover,
28
+ library, coreLibrary, CustomListItem, List, includeStylesheet, includeScript) {
29
29
  "use strict";
30
30
 
31
31
  // shortcut for sap.m.FlexWrap
@@ -48,9 +48,8 @@ sap.ui.define([
48
48
 
49
49
  if ( !window.hljs ) {
50
50
  //solarized-light
51
- jQuery.sap.includeStyleSheet("resources/sap/ui/documentation/sdk/thirdparty/highlight.js/styles.css");
52
- jQuery.sap.includeScript({ url: "resources/sap/ui/documentation/sdk/thirdparty/highlight.js/highlight.js" });
53
-
51
+ includeStylesheet("resources/sap/ui/documentation/sdk/thirdparty/highlight.js/styles.css");
52
+ includeScript({ url: "resources/sap/ui/documentation/sdk/thirdparty/highlight.js/highlight.js" });
54
53
  }
55
54
  },
56
55
 
@@ -5,8 +5,9 @@
5
5
  */
6
6
 
7
7
  sap.ui.define([
8
- "sap/ui/documentation/sdk/controller/BaseController"
9
- ], function (BaseController) {
8
+ "sap/ui/documentation/sdk/controller/BaseController",
9
+ "sap/ui/thirdparty/jquery"
10
+ ], function (BaseController, jQuery) {
10
11
  "use strict";
11
12
 
12
13
  return BaseController.extend("sap.ui.documentation.sdk.controller.TermsOfUse", {