@openui5/sap.ui.documentation 1.103.1 → 1.106.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 (115) hide show
  1. package/.reuse/dep5 +35 -15
  2. package/LICENSES/LicenseRef-tzdata-PublicDomain.txt +5 -0
  3. package/THIRDPARTY.txt +64 -21
  4. package/package.json +6 -6
  5. package/src/sap/ui/documentation/.library +6 -6
  6. package/src/sap/ui/documentation/library.js +2 -2
  7. package/src/sap/ui/documentation/messagebundle.properties +23 -0
  8. package/src/sap/ui/documentation/messagebundle_ar.properties +12 -0
  9. package/src/sap/ui/documentation/messagebundle_bg.properties +12 -0
  10. package/src/sap/ui/documentation/messagebundle_ca.properties +12 -0
  11. package/src/sap/ui/documentation/messagebundle_cs.properties +12 -0
  12. package/src/sap/ui/documentation/messagebundle_cy.properties +12 -0
  13. package/src/sap/ui/documentation/messagebundle_da.properties +12 -0
  14. package/src/sap/ui/documentation/messagebundle_de.properties +12 -0
  15. package/src/sap/ui/documentation/messagebundle_el.properties +12 -0
  16. package/src/sap/ui/documentation/messagebundle_en.properties +12 -0
  17. package/src/sap/ui/documentation/messagebundle_en_GB.properties +12 -0
  18. package/src/sap/ui/documentation/messagebundle_en_US_sappsd.properties +12 -0
  19. package/src/sap/ui/documentation/messagebundle_en_US_saprigi.properties +12 -0
  20. package/src/sap/ui/documentation/messagebundle_en_US_saptrc.properties +12 -0
  21. package/src/sap/ui/documentation/messagebundle_es.properties +12 -0
  22. package/src/sap/ui/documentation/messagebundle_es_MX.properties +12 -0
  23. package/src/sap/ui/documentation/messagebundle_et.properties +12 -0
  24. package/src/sap/ui/documentation/messagebundle_fi.properties +12 -0
  25. package/src/sap/ui/documentation/messagebundle_fr.properties +12 -0
  26. package/src/sap/ui/documentation/messagebundle_fr_CA.properties +14 -2
  27. package/src/sap/ui/documentation/messagebundle_hi.properties +12 -0
  28. package/src/sap/ui/documentation/messagebundle_hr.properties +12 -0
  29. package/src/sap/ui/documentation/messagebundle_hu.properties +12 -0
  30. package/src/sap/ui/documentation/messagebundle_id.properties +12 -0
  31. package/src/sap/ui/documentation/messagebundle_it.properties +12 -0
  32. package/src/sap/ui/documentation/messagebundle_iw.properties +12 -0
  33. package/src/sap/ui/documentation/messagebundle_ja.properties +12 -0
  34. package/src/sap/ui/documentation/messagebundle_kk.properties +12 -0
  35. package/src/sap/ui/documentation/messagebundle_ko.properties +12 -0
  36. package/src/sap/ui/documentation/messagebundle_lt.properties +12 -0
  37. package/src/sap/ui/documentation/messagebundle_lv.properties +12 -0
  38. package/src/sap/ui/documentation/messagebundle_ms.properties +12 -0
  39. package/src/sap/ui/documentation/messagebundle_nl.properties +12 -0
  40. package/src/sap/ui/documentation/messagebundle_no.properties +12 -0
  41. package/src/sap/ui/documentation/messagebundle_pl.properties +12 -0
  42. package/src/sap/ui/documentation/messagebundle_pt.properties +12 -0
  43. package/src/sap/ui/documentation/messagebundle_pt_PT.properties +12 -0
  44. package/src/sap/ui/documentation/messagebundle_ro.properties +12 -0
  45. package/src/sap/ui/documentation/messagebundle_ru.properties +12 -0
  46. package/src/sap/ui/documentation/messagebundle_sh.properties +12 -0
  47. package/src/sap/ui/documentation/messagebundle_sk.properties +12 -0
  48. package/src/sap/ui/documentation/messagebundle_sl.properties +12 -0
  49. package/src/sap/ui/documentation/messagebundle_sv.properties +12 -0
  50. package/src/sap/ui/documentation/messagebundle_th.properties +12 -0
  51. package/src/sap/ui/documentation/messagebundle_tr.properties +12 -0
  52. package/src/sap/ui/documentation/messagebundle_uk.properties +12 -0
  53. package/src/sap/ui/documentation/messagebundle_vi.properties +12 -0
  54. package/src/sap/ui/documentation/messagebundle_zh_CN.properties +12 -0
  55. package/src/sap/ui/documentation/messagebundle_zh_TW.properties +12 -0
  56. package/src/sap/ui/documentation/sdk/Component.js +13 -11
  57. package/src/sap/ui/documentation/sdk/controller/App.controller.js +134 -11
  58. package/src/sap/ui/documentation/sdk/controller/BPSupport.controller.js +75 -0
  59. package/src/sap/ui/documentation/sdk/controller/Code.controller.js +1 -1
  60. package/src/sap/ui/documentation/sdk/controller/ControlsMaster.controller.js +2 -2
  61. package/src/sap/ui/documentation/sdk/controller/LiveEditor.controller.js +14 -3
  62. package/src/sap/ui/documentation/sdk/controller/Sample.controller.js +129 -73
  63. package/src/sap/ui/documentation/sdk/controller/SampleBaseController.js +1 -1
  64. package/src/sap/ui/documentation/sdk/controller/SubApiDetail.controller.js +20 -1
  65. package/src/sap/ui/documentation/sdk/controller/VersionNotFound.controller.js +19 -12
  66. package/src/sap/ui/documentation/sdk/controller/util/ConfigUtil.js +21 -2
  67. package/src/sap/ui/documentation/sdk/controller/util/ControlsInfo.js +1 -0
  68. package/src/sap/ui/documentation/sdk/controller/util/DataTable.js +9 -4
  69. package/src/sap/ui/documentation/sdk/controller/util/NewsInfo.js +1 -17
  70. package/src/sap/ui/documentation/sdk/controller/util/ToolsInfo.js +7 -3
  71. package/src/sap/ui/documentation/sdk/controller/util/URLUtil.js +121 -0
  72. package/src/sap/ui/documentation/sdk/css/style.css +93 -36
  73. package/src/sap/ui/documentation/sdk/images/tools/AccessibilityGuide.png +0 -0
  74. package/src/sap/ui/documentation/sdk/index.html +1 -245
  75. package/src/sap/ui/documentation/sdk/index.js +245 -0
  76. package/src/sap/ui/documentation/sdk/manifest.json +18 -0
  77. package/src/sap/ui/documentation/sdk/model/LiveEditorData.json +1 -1
  78. package/src/sap/ui/documentation/sdk/model/formatter.js +26 -1
  79. package/src/sap/ui/documentation/sdk/model/libraryData.js +13 -2
  80. package/src/sap/ui/documentation/sdk/thirdparty/highlight.js/styles.css +47 -1
  81. package/src/sap/ui/documentation/sdk/tmpl/index.html.tmpl +1 -1
  82. package/src/sap/ui/documentation/sdk/tmpl/indexevo.html.tmpl +1 -1
  83. package/src/sap/ui/documentation/sdk/util/DocumentationRouter.js +7 -0
  84. package/src/sap/ui/documentation/sdk/util/LiveEditorOutput.js +10 -1
  85. package/src/sap/ui/documentation/sdk/util/liveEditorOutput.html +1 -1
  86. package/src/sap/ui/documentation/sdk/view/ApiDetailInitial.view.xml +13 -13
  87. package/src/sap/ui/documentation/sdk/view/App.view.xml +12 -1
  88. package/src/sap/ui/documentation/sdk/view/BPSupport.view.xml +7 -0
  89. package/src/sap/ui/documentation/sdk/view/Controls.view.xml +19 -19
  90. package/src/sap/ui/documentation/sdk/view/Entity.view.xml +2 -2
  91. package/src/sap/ui/documentation/sdk/view/SubApiDetail.view.xml +30 -7
  92. package/src/sap/ui/documentation/sdk/view/SurveyPopover.fragment.xml +56 -0
  93. package/src/sap/ui/documentation/sdk/view/Tools.view.xml +16 -19
  94. package/src/sap/ui/documentation/sdk/view/TopicDetail.view.xml +1 -1
  95. package/src/sap/ui/documentation/sdk/view/TopicDetailInitial.view.xml +12 -12
  96. package/src/sap/ui/documentation/sdk/view/VisibilityInformation.fragment.xml +12 -0
  97. package/src/sap/ui/documentation/sdk/view/Welcome.view.xml +31 -31
  98. package/src/sap/ui/documentation/sdk/view/appSettingsDialog.fragment.xml +6 -4
  99. package/src/sap/ui/documentation/themes/base/DemokitTreeItem.less +5 -9
  100. package/src/sap/ui/documentation/themes/base/Documentation.less +5 -0
  101. package/src/sap/ui/documentation/themes/base/LightTable.less +49 -40
  102. package/src/sap/ui/documentation/themes/base/ObjectPageSubSection.less +16 -0
  103. package/src/sap/ui/documentation/themes/base/Search.less +1 -0
  104. package/src/sap/ui/documentation/themes/base/library.source.less +1 -0
  105. package/src/sap/ui/documentation/themes/sap_horizon/Link.less +3 -0
  106. package/src/sap/ui/documentation/themes/sap_horizon/Panel.less +3 -0
  107. package/src/sap/ui/documentation/themes/sap_horizon/Search.less +3 -0
  108. package/src/sap/ui/documentation/themes/sap_horizon/SplitButton.less +5 -0
  109. package/src/sap/ui/documentation/themes/sap_horizon/library.source.less +6 -1
  110. package/src/sap/ui/documentation/themes/sap_horizon_dark/Documentation.less +17 -0
  111. package/src/sap/ui/documentation/themes/sap_horizon_dark/Link.less +3 -0
  112. package/src/sap/ui/documentation/themes/sap_horizon_dark/Panel.less +3 -0
  113. package/src/sap/ui/documentation/themes/sap_horizon_dark/Search.less +3 -0
  114. package/src/sap/ui/documentation/themes/sap_horizon_dark/SplitButton.less +5 -0
  115. package/src/sap/ui/documentation/themes/sap_horizon_dark/library.source.less +7 -1
@@ -18,7 +18,6 @@ sap.ui.define([
18
18
  "sap/ui/core/HTML",
19
19
  "sap/m/library",
20
20
  "sap/base/Log",
21
- "sap/base/util/UriParameters",
22
21
  "sap/ui/core/Fragment",
23
22
  "sap/ui/documentation/sdk/util/Resources",
24
23
  "./config/sampleForwardingConfig",
@@ -36,7 +35,6 @@ sap.ui.define([
36
35
  HTML,
37
36
  mobileLibrary,
38
37
  Log,
39
- UriParameters,
40
38
  Fragment,
41
39
  ResourcesUtil,
42
40
  sampleForwardingConfig,
@@ -95,11 +93,18 @@ sap.ui.define([
95
93
  * @private
96
94
  */
97
95
  _onSampleMatched: function (event) {
96
+ var bShouldRedirect = new URLSearchParams(window.location.search).has("dk-sample-standalone");
97
+
98
98
  this._sId = event.getParameter("arguments").sampleId;
99
99
  this._sEntityId = event.getParameter("arguments").entityId;
100
100
 
101
101
  this.byId("page").setBusy(true);
102
102
 
103
+ // check whether to open sample standalone
104
+ if (bShouldRedirect) {
105
+ this._handleRedirect();
106
+ }
107
+
103
108
  if (sampleForwardingConfig[this._sId]) {
104
109
  return this.router.navTo("sample", {
105
110
  entityId: sampleForwardingConfig[this._sId].entityId,
@@ -128,6 +133,8 @@ sap.ui.define([
128
133
 
129
134
  // we need this property to navigate to API reference
130
135
  this.entityId = this._sEntityId ? this._sEntityId : oSample.entityId;
136
+ // we need the lib name in order to fetch dependencies for the sample
137
+ this._sLib = oSample.library;
131
138
 
132
139
  oModelData.sEntityId = this.entityId;
133
140
 
@@ -193,7 +200,7 @@ sap.ui.define([
193
200
  this.getView().byId("apiRefButton").setVisible(bHasAPIReference);
194
201
  }.bind(this));
195
202
 
196
- this.oModel.setData(oModelData);
203
+ this.oModel.setData(oModelData, true);
197
204
  this.appendPageTitle(this.getModel().getProperty("/name"));
198
205
  }.bind(this))
199
206
  .catch(function (oError) {
@@ -207,6 +214,43 @@ sap.ui.define([
207
214
  });
208
215
  },
209
216
 
217
+ /**
218
+ * Handles redirection from DemoKit to the sample page, rather than loading it as an iFrame.
219
+ * The 'dk-sample-standalone' query parameter must be in the URI to take effect.
220
+ * @private
221
+ */
222
+ _handleRedirect : function () {
223
+ this._initIframeURL();
224
+ this._applySearchParamValueToIframeURL('sap-ui-theme', this._sDefaultSampleTheme);
225
+ this.sIFrameUrl += "&dk-sample-standalone";
226
+ URLHelper.redirect(this.sIFrameUrl, false);
227
+ },
228
+
229
+ /**
230
+ * Initializes the URL of the sample itself, loaded either in an iFrame or standalone.
231
+ * @private
232
+ */
233
+ _initIframeURL : function () {
234
+ var sSampleOrigin = ResourcesUtil.getConfig(),
235
+ sSampleVersion = ResourcesUtil.getResourcesVersion(),
236
+ sSampleSearchParams = "";
237
+
238
+ // Assigning allowed query parameters from Demo Kit URL
239
+ ALLOWLIST_SAMPLES_SEARCH_PARAMS.forEach(function (oParam, index) {
240
+ if (new URL(document.location.href).searchParams.get(oParam)) {
241
+ sSampleSearchParams += (sSampleSearchParams === "" ? "?" : "&") + oParam + "=" + new URL(document.location.href).searchParams.get(oParam);
242
+ }
243
+ });
244
+
245
+ sSampleSearchParams = (sSampleSearchParams === "" ? "?" : sSampleSearchParams + "&") +
246
+ "sap-ui-xx-sample-id=" + this._sId
247
+ + "&sap-ui-xx-sample-lib=" + (this._sLib || "")
248
+ + "&sap-ui-xx-sample-origin=" + sSampleOrigin + sSampleVersion
249
+ + "&sap-ui-xx-dk-origin=" + window.location.origin;
250
+
251
+ this.sIFrameUrl = ResourcesUtil.getResourceOrigin() + "/resources/sap/ui/documentation/sdk/index.html" + sSampleSearchParams;
252
+ },
253
+
210
254
  /**
211
255
  * Opens the View settings dialog
212
256
  * @public
@@ -300,7 +344,7 @@ sap.ui.define([
300
344
 
301
345
  _saveLocalSettings: function(sTheme, sDensityMode, bRTL) {
302
346
  var sDensityMode = this._presetDensity(sDensityMode);
303
- this.getView().getModel().setData({
347
+ this.oModel.setData({
304
348
  theme: sTheme,
305
349
  rtl: bRTL,
306
350
  density: sDensityMode
@@ -361,15 +405,21 @@ sap.ui.define([
361
405
  this.getRouter().navTo("apiId", {id: this.entityId});
362
406
  },
363
407
 
364
- onNewTab : function () {
365
- // this._applySearchParamValueToIframeURL('sap-ui-theme', this._sDefaultSampleTheme);
408
+ onNewTab: function () {
409
+ if (this.oModel.getProperty("/iframe")) {
410
+ URLHelper.redirect(this.sIFrameUrl, true);
411
+ return;
412
+ }
413
+
366
414
  this.loadSampleSettings(function(eMessage){
367
415
  this._applySearchParamValueToIframeURL('sap-ui-theme', eMessage.data.data.theme);
368
416
  this._applySearchParamValueToIframeURL('sap-ui-rtl', eMessage.data.data.RTL);
369
417
  this._applySearchParamValueToIframeURL('sap-ui-density', eMessage.data.data.density);
370
418
  }.bind(this)).then(function(){
371
419
  URLHelper.redirect(this.sIFrameUrl, true);
372
- }.bind(this));
420
+ }.bind(this)).catch(function(err){
421
+ Log.error(err);
422
+ });
373
423
  },
374
424
 
375
425
  onPreviousSample: function (oEvent) {
@@ -429,88 +479,28 @@ sap.ui.define([
429
479
 
430
480
  _createIframe : function () {
431
481
  return new Promise(function (resolve, reject) {
432
- var sSampleId = this._sId,
433
- sIframePath = "",
434
- rExtractFilename = /\/([^\/]*)$/,// extracts everything after the last slash (e.g. some/path/index.html -> index.html)
435
- rStripUI5Ending = /\..+$/,// removes everything after the first dot in the filename (e.g. someFile.qunit.html -> .qunit.html)
436
- aFileNameMatches,
437
- sFileName,
438
- sFileEnding,
439
- vIframe;
440
482
 
441
483
  this.fResolve = resolve;
442
484
  this.fReject = reject;
443
- var sSampleOrigin = (window['sap-ui-documentation-config'] && window['sap-ui-documentation-config'].demoKitResourceOrigin) || "",
444
- sSampleVersion = ResourcesUtil.getResourcesVersion(),
445
- sSampleSearchParams = "";
446
-
447
- // Assigning allowed query parameters from Demo Kit URL
448
- ALLOWLIST_SAMPLES_SEARCH_PARAMS.forEach(function(oParam, index){
449
- if (new URL(document.location.href).searchParams.get(oParam)){
450
- sSampleSearchParams += (sSampleSearchParams === "" ? "?" : "&") + oParam + "=" + new URL(document.location.href).searchParams.get(oParam);
451
- }
452
- });
453
485
 
454
- sSampleSearchParams = (sSampleSearchParams === "" ? "?" : sSampleSearchParams + "&") +
455
- "sap-ui-xx-sample-id=" + sSampleId
456
- + "&sap-ui-xx-sample-origin=" + sSampleOrigin + sSampleVersion
457
- + "&sap-ui-xx-dk-origin=" + window.location.origin;
458
-
459
- this.sIFrameUrl = ResourcesUtil.getResourceOrigin() + "/resources/sap/ui/documentation/sdk/index.html" + sSampleSearchParams;
486
+ this._initIframeURL();
460
487
 
461
488
  if (this._oHtmlControl) {
462
489
  this._oHtmlControl.destroy();
463
490
  }
464
491
 
465
- var fnMessage = function (eMessage) {
466
- var oSettingsData = this.getView().getModel().getData();
467
- if (eMessage.data.type === "INIT") {
468
- if (eMessage.data.config && eMessage.data.config.sample && eMessage.data.config.sample.iframe) {
469
- sSampleId = this._sId;
470
- vIframe = eMessage.data.config.sample.iframe;
471
- sIframePath = this._resolveIframePath(sSampleId, vIframe);
472
-
473
- //vlaid only for samples that contains own index.html
474
- // strip the file extension to be able to use jQuery.sap.getModulePath
475
- aFileNameMatches = rExtractFilename.exec(vIframe);
476
- sFileName = (aFileNameMatches && aFileNameMatches.length > 1 ? aFileNameMatches[1] : vIframe);
477
- sFileEnding = rStripUI5Ending.exec(sFileName)[0];
478
- var sIframeWithoutUI5Ending = sFileName.replace(rStripUI5Ending, "");
479
-
480
- // combine namespace with the file name again
481
- this.sIFrameUrl = (sap.ui.require.toUrl((sIframePath + "/" + sIframeWithoutUI5Ending).replace(/\./g, "/")) + sFileEnding || ".html")
482
- + "?sap-ui-theme=" + sap.ui.getCore().getConfiguration().getTheme();
483
- this._oHtmlControl.getDomRef().src = this.sIFrameUrl;
484
- }
485
- this._oHtmlControl.getDomRef().contentWindow.postMessage({
486
- type: "SETTINGS",
487
- reason: "set",
488
- data: {
489
- "density": oSettingsData.density,
490
- "RTL": oSettingsData.rtl,
491
- "theme": oSettingsData.theme
492
- }
493
- }, this.getOwnerComponent()._sSampleIframeOrigin);
494
- this.fResolve(eMessage.data.config.sample);
495
- } else if (eMessage.data.type === "ERR") {
496
- this.fReject(eMessage.data.data.msg);
497
- } else if (eMessage.data.type === "RTA") {
498
- this._loadRTA.call(this);
499
- }
500
- }.bind(this);
501
-
502
492
  this._oHtmlControl = new HTML({
503
493
  id : "sampleFrame",
504
494
  content : '<iframe src="' + this.sIFrameUrl + '" id="sampleFrame" frameBorder="0"></iframe>'
505
495
  }).addEventDelegate({
506
496
  onBeforeRendering: function () {
507
- window.removeEventListener("message", fnMessage);
508
- }
497
+ window.removeEventListener("message", this.onMessage.bind(this));
498
+ }.bind(this)
509
499
  })
510
500
  .addEventDelegate({
511
501
  onAfterRendering: function () {
512
- window.addEventListener("message", fnMessage);
513
- }
502
+ window.addEventListener("message",this.onMessage.bind(this));
503
+ }.bind(this)
514
504
  });
515
505
 
516
506
  this.byId("page").removeAllContent();
@@ -519,6 +509,72 @@ sap.ui.define([
519
509
  }.bind(this));
520
510
  },
521
511
 
512
+ onMessage: function(eMessage) {
513
+ if (eMessage.origin !== this.getOwnerComponent()._sSampleIframeOrigin) {
514
+ return;
515
+ }
516
+ if (eMessage.source !== this._oHtmlControl.getDomRef().contentWindow) {
517
+ return;
518
+ }
519
+
520
+ if (eMessage.data.type === "INIT") {
521
+ this.fnMessageInit(eMessage);
522
+ } else if (eMessage.data.type === "ERR") {
523
+ this.fnMessageError(eMessage);
524
+ } else if (eMessage.data.type === "LOAD") {
525
+ this.fnMessageLoad(eMessage);
526
+ } else if (eMessage.data.type === "RTA") {
527
+ this._loadRTA.call(this);
528
+ }
529
+ },
530
+
531
+ fnMessageInit: function(eMessage) {
532
+ var sSampleId,
533
+ sIframePath = "",
534
+ rExtractFilename = /\/([^\/]*)$/,// extracts everything after the last slash (e.g. some/path/index.html -> index.html)
535
+ rStripUI5Ending = /\..+$/,// removes everything after the first dot in the filename (e.g. someFile.qunit.html -> .qunit.html)
536
+ aFileNameMatches,
537
+ sFileName,
538
+ sFileEnding,
539
+ vIframe,
540
+ oSettingsData = this.oModel.getData();
541
+
542
+ if (eMessage.data.config && eMessage.data.config.sample && eMessage.data.config.sample.iframe) {
543
+ sSampleId = this._sId;
544
+ vIframe = eMessage.data.config.sample.iframe;
545
+ sIframePath = this._resolveIframePath(sSampleId, vIframe);
546
+
547
+ //vlaid only for samples that contains own index.html
548
+ // strip the file extension to be able to use jQuery.sap.getModulePath
549
+ aFileNameMatches = rExtractFilename.exec(vIframe);
550
+ sFileName = (aFileNameMatches && aFileNameMatches.length > 1 ? aFileNameMatches[1] : vIframe);
551
+ sFileEnding = rStripUI5Ending.exec(sFileName)[0];
552
+ var sIframeWithoutUI5Ending = sFileName.replace(rStripUI5Ending, "");
553
+
554
+ // combine namespace with the file name again
555
+ this.sIFrameUrl = (sap.ui.require.toUrl((sIframePath + "/" + sIframeWithoutUI5Ending).replace(/\./g, "/")) + sFileEnding || ".html")
556
+ + "?sap-ui-theme=" + sap.ui.getCore().getConfiguration().getTheme();
557
+ this._oHtmlControl.getDomRef().src = this.sIFrameUrl;
558
+ }
559
+ this._oHtmlControl.getDomRef().contentWindow.postMessage({
560
+ type: "SETTINGS",
561
+ reason: "set",
562
+ data: {
563
+ "density": oSettingsData.density,
564
+ "RTL": oSettingsData.rtl,
565
+ "theme": oSettingsData.theme
566
+ }
567
+ }, this.getOwnerComponent()._sSampleIframeOrigin);
568
+ this.fResolve(eMessage.data.config.sample);
569
+ },
570
+ fnMessageLoad: function() {
571
+ Log.info("Sample Iframe for sample " + this._sId + " is loaded");
572
+ },
573
+
574
+ fnMessageError: function(eMessage) {
575
+ this.fReject(eMessage.data.data.msg);
576
+ },
577
+
522
578
  _createComponent : function () {
523
579
 
524
580
  // create component only once
@@ -595,7 +651,7 @@ sap.ui.define([
595
651
 
596
652
  oModelData.rtaLoaded = true;
597
653
 
598
- this.oModel.setData(oModelData);
654
+ this.oModel.setData(oModelData, true);
599
655
 
600
656
  this.getRouter().attachRouteMatched(function () {
601
657
  if (this._oRTA) {
@@ -238,7 +238,7 @@ sap.ui.define([
238
238
 
239
239
  _formatMockFile: function (sMockData) {
240
240
  var sWrongPath = "test-resources/sap/ui/documentation/sdk/images/",
241
- sCorrectPath = "https://openui5.hana.ondemand.com/test-resources/sap/ui/documentation/sdk/images/",
241
+ sCorrectPath = "https://sdk.openui5.org/test-resources/sap/ui/documentation/sdk/images/",
242
242
  oRegExp = new RegExp(sWrongPath, "g");
243
243
 
244
244
  return sMockData.replace(oRegExp, sCorrectPath);
@@ -6,6 +6,7 @@
6
6
 
7
7
  sap.ui.define([
8
8
  "sap/ui/thirdparty/jquery",
9
+ "sap/ui/core/Fragment",
9
10
  "sap/ui/documentation/sdk/controller/BaseController",
10
11
  "sap/ui/documentation/sdk/util/ToggleFullScreenHandler",
11
12
  "sap/ui/documentation/sdk/model/formatter",
@@ -23,7 +24,7 @@ sap.ui.define([
23
24
  "sap/m/List",
24
25
  "sap/ui/dom/includeStylesheet",
25
26
  "sap/ui/dom/includeScript"
26
- ], function (jQuery, BaseController, ToggleFullScreenHandler,
27
+ ], function (jQuery, Fragment, BaseController, ToggleFullScreenHandler,
27
28
  formatter, Image, Label, Link, Text, HBox, ObjectAttribute, ObjectStatus, Popover,
28
29
  library, coreLibrary, CustomListItem, List, includeStylesheet, includeScript) {
29
30
  "use strict";
@@ -253,6 +254,24 @@ sap.ui.define([
253
254
  }
254
255
  },
255
256
 
257
+ onVisibilityInformationClick: function (oEvent) {
258
+ var oIcon = oEvent.getSource(),
259
+ oView = this.getView();
260
+
261
+ if (!this._oPopover) {
262
+ this._oPopover = Fragment.load({
263
+ name: "sap.ui.documentation.sdk.view.VisibilityInformation",
264
+ controller: this
265
+ }).then(function(oPopover) {
266
+ oView.addDependent(oPopover);
267
+ return oPopover;
268
+ });
269
+ }
270
+ this._oPopover.then(function(oPopover) {
271
+ oPopover.openBy(oIcon);
272
+ });
273
+ },
274
+
256
275
  /* =========================================================== */
257
276
  /* begin: internal methods aa*/
258
277
  /* =========================================================== */
@@ -7,12 +7,12 @@
7
7
  sap.ui.define([
8
8
  "./BaseController",
9
9
  "sap/ui/thirdparty/jquery",
10
- "sap/ui/thirdparty/URI",
10
+ "sap/ui/documentation/sdk/controller/util/URLUtil",
11
11
  "sap/m/library"
12
12
  ], function (
13
13
  BaseController,
14
14
  jQuery,
15
- URI,
15
+ DemokitURLUtil,
16
16
  mLib
17
17
  ) {
18
18
  "use strict";
@@ -44,22 +44,29 @@ sap.ui.define([
44
44
  _onVersionInfo: function (oVersionInfo) {
45
45
  var oMessagePage = this.getView().byId("page"),
46
46
  oReadMoreBtn = this.getView().byId("readMoreButton"),
47
- reVersion = new RegExp("^([0-9]+)(?:\\.([0-9]+)(?:\\.([0-9]+))?)?(.+)?"),
48
- oURI = new URI(document.location.href),
49
- aSegments = oURI.segment(),
50
- sVersion,
47
+ sUrl = document.location.href,
48
+ sRedirectUrl,
49
+ sVersion = DemokitURLUtil.parseVersion(sUrl),
51
50
  isRemoved = false;
52
51
 
53
52
  oMessagePage.setBusy(false);
54
53
 
55
- for (var i = 0, l = aSegments.length; i < l; i++) {
56
- if (reVersion.test(aSegments[i])) {
57
- sVersion = aSegments[i];
58
- break;
59
- }
54
+ isRemoved = this._isVersionRemoved(oVersionInfo, sVersion);
55
+
56
+ if (isRemoved && DemokitURLUtil.requestsDemokitView(sUrl)) {
57
+ // redirect to the latest (version-less) URL
58
+ sRedirectUrl = DemokitURLUtil.removeVersion(sUrl);
59
+ mLib.URLHelper.redirect(sRedirectUrl);
60
+ return;
60
61
  }
61
62
 
62
- isRemoved = this._isVersionRemoved(oVersionInfo, sVersion);
63
+ if (DemokitURLUtil.hasSEOOptimizedFormat(sUrl)) {
64
+ // 404 may be due to server not supporting SEO-optimized urls =>
65
+ // redirect to the corresponding non-optimized URL
66
+ sRedirectUrl = DemokitURLUtil.convertToNonSEOFormat(sUrl);
67
+ mLib.URLHelper.redirect(sRedirectUrl);
68
+ return;
69
+ }
63
70
 
64
71
  if (isRemoved) {
65
72
  // show removed message
@@ -8,8 +8,10 @@
8
8
  sap.ui.define([
9
9
  "sap/ui/base/Object",
10
10
  "sap/base/strings/capitalize",
11
- "sap/base/util/merge"
12
- ], function (BaseObject, capitalize, merge) {
11
+ "sap/ui/thirdparty/jquery",
12
+ "sap/ui/documentation/sdk/util/Resources",
13
+ "sap/base/Log"
14
+ ], function (BaseObject, capitalize, jQuery, ResourcesUtil, Log) {
13
15
  "use strict";
14
16
 
15
17
  return BaseObject.extend("sap.ui.documentation.sdk.controller.util.ConfigUtil", {
@@ -109,6 +111,23 @@ sap.ui.define([
109
111
  destroy: function () {
110
112
  this._oComponent = null;
111
113
  return BaseObject.prototype.destroy.apply(this, arguments);
114
+ },
115
+
116
+ // Require the configuration file for static pages paths
117
+ _requireConfigJSON: function() {
118
+ return new Promise(function (resolve) {
119
+ jQuery.ajax(ResourcesUtil.getResourceOriginPath("/news-config.json"), {
120
+ type: "GET",
121
+ dataType: "JSON",
122
+ success : function(oResult) {
123
+ resolve(oResult);
124
+ },
125
+ error : function () {
126
+ Log.error("failed to load news-config.json");
127
+ resolve();
128
+ }
129
+ });
130
+ });
112
131
  }
113
132
  });
114
133
  });
@@ -140,6 +140,7 @@ sap.ui.define(["sap/ui/thirdparty/jquery", 'sap/ui/documentation/library', "sap/
140
140
  Log.error("explored: cannot register sample '" + oSample.id + "'. missing 'name'");
141
141
  } else {
142
142
  data.samples[oSample.id] = oSample;
143
+ oSample.library = oDoc.library;
143
144
  }
144
145
  });
145
146
 
@@ -373,14 +373,19 @@ sap.ui.define([
373
373
  oOption = null;
374
374
  }
375
375
 
376
- if (oOption && oOption.length > 0) {
376
+ if (oOption && oOption.is("p")) {
377
+ var sText = oOption.text();
378
+ if (aOptions.indexOf(sText) < 0) {
379
+ aOptions.push(sText);
380
+ }
381
+ } else if (oOption && oOption.length > 0) {
377
382
  oOption.find('li').each(function (i, sOption) {
378
383
  if (aOptions.indexOf(sOption.textContent) < 0) {
379
384
  aOptions.push(sOption.textContent);
380
385
  }
381
386
  });
382
387
  } else {
383
- aOptions.push(sOption);
388
+ sOption && aOptions.push(sOption);
384
389
  }
385
390
 
386
391
  });
@@ -398,7 +403,7 @@ sap.ui.define([
398
403
  that.API = this.api();
399
404
 
400
405
  // Create new table row to append filters
401
- var oTableHeader = $('#' + sId + ' thead'),
406
+ var oTableHeader = $('#' + sId + ' > thead'),
402
407
  oNewTableRow = $('<tr/>'),
403
408
  oFilterHeader,
404
409
  oHighlighter,
@@ -449,7 +454,7 @@ sap.ui.define([
449
454
  control: oFilter.control
450
455
  });
451
456
  });
452
- oFilter.control.placeAt(oFilterHeader);
457
+ oFilter.control.placeAt(oFilterHeader[0]);
453
458
  }
454
459
 
455
460
  oNewTableRow.append(oFilterHeader);
@@ -32,7 +32,7 @@ sap.ui.define([
32
32
  _oConfigUtilInstance = oConfigUtilInstance;
33
33
  _sLocalStorageNewsName = _oConfigUtilInstance.LOCAL_STORAGE_NAMES[_sOldNewsLocalStorageKey];
34
34
 
35
- return _requireConfigJSON()
35
+ return oConfigUtilInstance._requireConfigJSON()
36
36
  .then(_requireFeedXML)
37
37
  .then(_parseDateToLocaleString)
38
38
  .then(_splitNewAndOldItems)
@@ -128,22 +128,6 @@ sap.ui.define([
128
128
  Core.getEventBus().publish("newsChanged", "onDemoKitNewsChanged");
129
129
  }
130
130
 
131
- function _requireConfigJSON() {
132
- return new Promise(function (resolve) {
133
- jQuery.ajax(ResourcesUtil.getResourceOriginPath("/news-config.json"), {
134
- type: "GET",
135
- dataType: "JSON",
136
- success : function(oResult) {
137
- resolve(oResult);
138
- },
139
- error : function () {
140
- Log.error("failed to load news-config.json");
141
- resolve();
142
- }
143
- });
144
- });
145
- }
146
-
147
131
  function _requireFeedXML(oJSON) {
148
132
  return new Promise(function (resolve) {
149
133
  jQuery.ajax(ResourcesUtil.getResourceOriginPath(oJSON.feedPath), {
@@ -58,7 +58,8 @@ sap.ui.define([],
58
58
  {
59
59
  "id": "liveEditor",
60
60
  "text": "Live Editor",
61
- "href": "liveEditor"
61
+ "href": "liveEditor",
62
+ "hideOnPhone": true
62
63
  },
63
64
  {
64
65
  "id": "fioriTools",
@@ -68,12 +69,15 @@ sap.ui.define([],
68
69
  {
69
70
  "id": "flexibleProgrammingModelExplorer",
70
71
  "text": "Flexible Programming Model Explorer",
71
- "href": "https://sapui5.hana.ondemand.com/test-resources/sap/fe/core/fpmExplorer/index.html#/overview/introduction"
72
+ "href": "test-resources/sap/fe/core/fpmExplorer/index.html#/overview/introduction",
73
+ "isDistributionScope": true,
74
+ "hideOnPhone": true
72
75
  },
73
76
  {
74
77
  "id": "accessibilityGuide",
75
78
  "text": "Accessibility Guide",
76
- "href": "test-resources/sap/m/demokit/accessibilityGuide/webapp/index.html"
79
+ "href": "test-resources/sap/m/demokit/accessibilityGuide/webapp/index.html",
80
+ "hideOnPhone": true
77
81
  }
78
82
  ];
79
83
 
@@ -0,0 +1,121 @@
1
+ /*!
2
+ * OpenUI5
3
+ * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
4
+ * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
+ */
6
+
7
+ // Provides reuse functionality for parsing and manipulating demokit urls
8
+ sap.ui.define(["sap/ui/thirdparty/URI"], function(URI) {
9
+
10
+ "use strict";
11
+
12
+ var reVersion = new RegExp("^([0-9]+)(?:\\.([0-9]+)(?:\\.([0-9]+))?)?(.+)?"),
13
+ // compiling a single RegExp seems a less readable option
14
+ // so bellow are the patterns for individual Demokit sections
15
+ aDemokitPaths = [
16
+ /^\/controls/,
17
+ /^\/group/,
18
+ /^\/entity/,
19
+ /^\/sample/,
20
+ /^\/downloads/,
21
+ /^\/api/,
22
+ /^\/topic/,
23
+ /^\/liveEditor/,
24
+ /^\/sitemap\//,
25
+ /\/sitemap$/,
26
+ /^\/demoapps/,
27
+ /^\/tools/,
28
+ /^\/news\//,
29
+ /\/news$/,
30
+ /^\/search\//,
31
+ /^\/license[.]txt/,
32
+ /^\/docs\/guide/,
33
+ /^\/docs\/api\/symbols/
34
+ ];
35
+
36
+ function pathMatchesDemokitRoute (path) {
37
+ return aDemokitPaths.some(function(regexp) {
38
+ return regexp.test(path);
39
+ });
40
+ }
41
+
42
+ return {
43
+ parseVersion: function(sUrl) {
44
+ var oURI = new URI(sUrl),
45
+ aSegments = oURI.segment(),
46
+ sVersion;
47
+
48
+ if (pathMatchesDemokitRoute(oURI.path())) {
49
+ return; // no version in path
50
+ }
51
+
52
+ for (var i = 0, l = aSegments.length; i < l; i++) {
53
+ if (reVersion.test(aSegments[i])) {
54
+ sVersion = aSegments[i];
55
+ break;
56
+ }
57
+ if (pathMatchesDemokitRoute("/" + aSegments[i] + "/")) {
58
+ break; // version not found
59
+ }
60
+ }
61
+ return sVersion;
62
+ },
63
+
64
+ removeVersion: function(sUrl) {
65
+ var oURI = new URI(sUrl),
66
+ sPath = oURI.path(),
67
+ sVersion = this.parseVersion(sUrl);
68
+
69
+ // remove the version string from <code>sPath</code>
70
+ if (sVersion) {
71
+ sPath = sPath.substring(sPath.indexOf(sVersion) + sVersion.length);
72
+ oURI.path(sPath);
73
+ return oURI.href();
74
+ }
75
+ return sUrl;
76
+ },
77
+
78
+ requestsDemokitView: function(sUrl) {
79
+ if (this.hasSEOOptimizedFormat(sUrl)) {
80
+ return true;
81
+ }
82
+
83
+ return pathMatchesDemokitRoute(new URI(sUrl).fragment());
84
+ },
85
+
86
+ hasSEOOptimizedFormat: function(sUrl) {
87
+ var sPath = new URI(sUrl).path();
88
+
89
+ if (pathMatchesDemokitRoute(sPath)) {
90
+ return true;
91
+ }
92
+
93
+ sUrl = this.removeVersion(sUrl);
94
+ sPath = new URI(sUrl).path();
95
+ return pathMatchesDemokitRoute(sPath);
96
+ },
97
+
98
+ convertToNonSEOFormat: function(sUrl) {
99
+ var oURI = new URI(sUrl),
100
+ sViewPath = new URI(this.removeVersion(sUrl)).path(),
101
+ sFragment = oURI.fragment(),
102
+ sNewPath,
103
+ sNewFragment;
104
+
105
+ // move the <code>sViewPath</code> from the URL path into the URL fragment:
106
+ sNewPath = oURI.path().replace(sViewPath, "/");
107
+ sNewFragment = sViewPath;
108
+
109
+ if (sFragment) {
110
+ // preserve any existing fragment part by appending at the end
111
+ sNewFragment += encodeURIComponent("#") + sFragment;
112
+ }
113
+
114
+ oURI.path(sNewPath);
115
+ oURI.fragment(sNewFragment);
116
+
117
+ return oURI.href();
118
+ }
119
+ };
120
+
121
+ });