@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.
Files changed (96) hide show
  1. package/.eslintrc.json +17 -0
  2. package/THIRDPARTY.txt +5 -5
  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 +14 -18
  7. package/src/sap/ui/documentation/messagebundle.properties +4 -2
  8. package/src/sap/ui/documentation/messagebundle_ar.properties +3 -1
  9. package/src/sap/ui/documentation/messagebundle_bg.properties +3 -1
  10. package/src/sap/ui/documentation/messagebundle_ca.properties +3 -1
  11. package/src/sap/ui/documentation/messagebundle_cs.properties +3 -1
  12. package/src/sap/ui/documentation/messagebundle_cy.properties +3 -1
  13. package/src/sap/ui/documentation/messagebundle_da.properties +3 -1
  14. package/src/sap/ui/documentation/messagebundle_de.properties +3 -1
  15. package/src/sap/ui/documentation/messagebundle_el.properties +3 -1
  16. package/src/sap/ui/documentation/messagebundle_en.properties +3 -1
  17. package/src/sap/ui/documentation/messagebundle_en_GB.properties +3 -1
  18. package/src/sap/ui/documentation/messagebundle_en_US_sappsd.properties +2 -1
  19. package/src/sap/ui/documentation/messagebundle_en_US_saprigi.properties +43 -10
  20. package/src/sap/ui/documentation/messagebundle_en_US_saptrc.properties +3 -1
  21. package/src/sap/ui/documentation/messagebundle_es.properties +3 -1
  22. package/src/sap/ui/documentation/messagebundle_es_MX.properties +3 -1
  23. package/src/sap/ui/documentation/messagebundle_et.properties +3 -1
  24. package/src/sap/ui/documentation/messagebundle_fi.properties +3 -1
  25. package/src/sap/ui/documentation/messagebundle_fr.properties +3 -1
  26. package/src/sap/ui/documentation/messagebundle_fr_CA.properties +3 -1
  27. package/src/sap/ui/documentation/messagebundle_hi.properties +3 -1
  28. package/src/sap/ui/documentation/messagebundle_hr.properties +3 -1
  29. package/src/sap/ui/documentation/messagebundle_hu.properties +3 -1
  30. package/src/sap/ui/documentation/messagebundle_id.properties +3 -1
  31. package/src/sap/ui/documentation/messagebundle_it.properties +3 -1
  32. package/src/sap/ui/documentation/messagebundle_iw.properties +3 -1
  33. package/src/sap/ui/documentation/messagebundle_ja.properties +3 -1
  34. package/src/sap/ui/documentation/messagebundle_kk.properties +3 -1
  35. package/src/sap/ui/documentation/messagebundle_ko.properties +4 -2
  36. package/src/sap/ui/documentation/messagebundle_lt.properties +3 -1
  37. package/src/sap/ui/documentation/messagebundle_lv.properties +3 -1
  38. package/src/sap/ui/documentation/messagebundle_ms.properties +3 -1
  39. package/src/sap/ui/documentation/messagebundle_nl.properties +3 -1
  40. package/src/sap/ui/documentation/messagebundle_no.properties +3 -1
  41. package/src/sap/ui/documentation/messagebundle_pl.properties +3 -1
  42. package/src/sap/ui/documentation/messagebundle_pt.properties +3 -1
  43. package/src/sap/ui/documentation/messagebundle_pt_PT.properties +3 -1
  44. package/src/sap/ui/documentation/messagebundle_ro.properties +3 -1
  45. package/src/sap/ui/documentation/messagebundle_ru.properties +3 -1
  46. package/src/sap/ui/documentation/messagebundle_sh.properties +3 -1
  47. package/src/sap/ui/documentation/messagebundle_sk.properties +3 -1
  48. package/src/sap/ui/documentation/messagebundle_sl.properties +3 -1
  49. package/src/sap/ui/documentation/messagebundle_sv.properties +3 -1
  50. package/src/sap/ui/documentation/messagebundle_th.properties +3 -1
  51. package/src/sap/ui/documentation/messagebundle_tr.properties +3 -1
  52. package/src/sap/ui/documentation/messagebundle_uk.properties +3 -1
  53. package/src/sap/ui/documentation/messagebundle_vi.properties +3 -1
  54. package/src/sap/ui/documentation/messagebundle_zh_CN.properties +3 -1
  55. package/src/sap/ui/documentation/messagebundle_zh_TW.properties +16 -14
  56. package/src/sap/ui/documentation/sdk/Component.js +1 -5
  57. package/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js +7 -13
  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 +0 -2
  61. package/src/sap/ui/documentation/sdk/controller/BaseController.js +1 -1
  62. package/src/sap/ui/documentation/sdk/controller/Code.controller.js +11 -6
  63. package/src/sap/ui/documentation/sdk/controller/ControlsMaster.controller.js +11 -15
  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 +181 -303
  67. package/src/sap/ui/documentation/sdk/controller/SampleBaseController.js +3 -4
  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 +17 -19
  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/util/ConfigUtil.js +3 -4
  76. package/src/sap/ui/documentation/sdk/controller/util/ControlsInfo.js +7 -6
  77. package/src/sap/ui/documentation/sdk/controller/util/DataTable.js +1 -1
  78. package/src/sap/ui/documentation/sdk/controller/util/DataTableHelper.js +1 -1
  79. package/src/sap/ui/documentation/sdk/controller/util/IndexWorker.js +1 -1
  80. package/src/sap/ui/documentation/sdk/controller/util/ResourceDownloadUtil.js +1 -1
  81. package/src/sap/ui/documentation/sdk/controller/util/ToolsInfo.js +5 -0
  82. package/src/sap/ui/documentation/sdk/controller/util/datatable/filters/DataTableFilterDropDown.js +0 -2
  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/images/tools/AccessibilityGuide.png +0 -0
  87. package/src/sap/ui/documentation/sdk/index.html +196 -25
  88. package/src/sap/ui/documentation/sdk/model/formatter.js +1 -1
  89. package/src/sap/ui/documentation/sdk/model/libraryData.js +18 -4
  90. package/src/sap/ui/documentation/sdk/util/DocumentationRouter.js +8 -4
  91. package/src/sap/ui/documentation/sdk/util/Resources.js +5 -2
  92. package/src/sap/ui/documentation/sdk/view/Sample.view.xml +2 -2
  93. package/src/sap/ui/documentation/sdk/view/Tools.view.xml +19 -0
  94. package/src/sap/ui/documentation/themes/sap_horizon_dark/library.source.less +9 -0
  95. package/src/sap/ui/documentation/themes/sap_horizon_hcb/library.source.less +9 -0
  96. 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,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 COZY = "cozy",
47
- COMPACT = "compact",
48
- CONDENSED = "condensed";
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
- this._createComponent()
168
- .then(function (oComponentContainer) {
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 = 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();
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
- if (oSampleConfig.iframe || ResourcesUtil.getHasProxy()) {
204
- oComponentContainer = this._createIframe(oComponentContainer, oSampleConfig.iframe);
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 oSampleFrame.sap.ui.model.resource.ResourceModel({
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 = new oSampleFrame.sap.ui.xmlfragment("sap.ui.documentation.sdk.view.appSettingsDialog", this);
219
+ this._oSettingsDialog = sap.ui.xmlfragment("sample", "sap.ui.documentation.sdk.view.appSettingsDialog", this);
262
220
 
263
- oView = oSampleFrameCore.byId("__xmlview0");
264
- oView.setModel(this._oMessageBundle, "i18n");
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
- 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;
226
+ this.loadSampleSettings().then(function() {
227
+ this._oSettingsDialog.open();
228
+ }.bind(this)).catch(function(err) {
229
+ Log.error(err);
230
+ });
231
+ },
273
232
 
274
- // Theme select
275
- oThemeSelect.setSelectedKey(sUriParamTheme ? sUriParamTheme : oAppSettings.getTheme());
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
- // RTL
278
- oSampleFrameCore.byId("RTLSwitch").setState(oAppSettings.getRTL());
241
+ window.addEventListener("message", loadSettings);
279
242
 
280
- // Density mode select
281
- oSampleFrameCore.byId("DensityModeSwitch").setSelectedKey(bDensityMode);
243
+ function loadSettings(eMessage) {
244
+ if (eMessage.data.type === "SETTINGS") {
245
+ var oThemeSelect = sap.ui.getCore().byId("sample--ThemeSelect");
282
246
 
283
- this._oSettingsDialog.open();
284
- }.bind(this), 0);
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 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");
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
- 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));
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 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
- }
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 (oIframeContent, vIframe) {
458
- var sSampleId = this._sId,
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
- 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) || "",
480
- sSampleVersion = ResourcesUtil.getResourcesVersion();
481
-
482
- this.sIFrameUrl =
483
- "resources/sap/ui/documentation/sdk/index.html" +
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
- 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;
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
- 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
- };
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
- return this._oHtmlControl;
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 && !ResourcesUtil.getHasProxy()) {
620
- this._oHtmlControl.$()[0].contentWindow.sap.ui.getCore().applyTheme(oData.sThemeActive);
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.oModel.getData().iframe) {
692
- window.document.getElementsByTagName("iframe")[0].onToggleAdaptationMode();
693
- return;
581
+ if (!this._oHtmlControl || !this._oHtmlControl.getDomRef()) {
582
+ return false;
694
583
  }
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));
584
+
585
+ var oIframe = this._oHtmlControl.getDomRef();
586
+ oIframe.contentWindow.postMessage({
587
+ type: "RTA",
588
+ data: {
589
+ "msg": "Start the RTA"
712
590
  }
713
- }.bind(this));
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
- "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(),