@openui5/sap.ui.documentation 1.113.0 → 1.115.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 (93) hide show
  1. package/.reuse/dep5 +0 -5
  2. package/THIRDPARTY.txt +1 -7
  3. package/package.json +7 -7
  4. package/src/sap/ui/documentation/.library +1 -1
  5. package/src/sap/ui/documentation/library.js +11 -11
  6. package/src/sap/ui/documentation/messagebundle.properties +9 -3
  7. package/src/sap/ui/documentation/messagebundle_ar.properties +6 -3
  8. package/src/sap/ui/documentation/messagebundle_bg.properties +6 -3
  9. package/src/sap/ui/documentation/messagebundle_ca.properties +6 -3
  10. package/src/sap/ui/documentation/messagebundle_cs.properties +6 -3
  11. package/src/sap/ui/documentation/messagebundle_cy.properties +6 -3
  12. package/src/sap/ui/documentation/messagebundle_da.properties +6 -3
  13. package/src/sap/ui/documentation/messagebundle_de.properties +7 -4
  14. package/src/sap/ui/documentation/messagebundle_el.properties +6 -3
  15. package/src/sap/ui/documentation/messagebundle_en.properties +6 -3
  16. package/src/sap/ui/documentation/messagebundle_en_GB.properties +6 -3
  17. package/src/sap/ui/documentation/messagebundle_en_US_sappsd.properties +6 -3
  18. package/src/sap/ui/documentation/messagebundle_en_US_saprigi.properties +6 -3
  19. package/src/sap/ui/documentation/messagebundle_en_US_saptrc.properties +6 -3
  20. package/src/sap/ui/documentation/messagebundle_es.properties +6 -3
  21. package/src/sap/ui/documentation/messagebundle_es_MX.properties +6 -3
  22. package/src/sap/ui/documentation/messagebundle_et.properties +6 -3
  23. package/src/sap/ui/documentation/messagebundle_fi.properties +6 -3
  24. package/src/sap/ui/documentation/messagebundle_fr.properties +6 -3
  25. package/src/sap/ui/documentation/messagebundle_fr_CA.properties +6 -3
  26. package/src/sap/ui/documentation/messagebundle_hi.properties +6 -3
  27. package/src/sap/ui/documentation/messagebundle_hr.properties +6 -3
  28. package/src/sap/ui/documentation/messagebundle_hu.properties +6 -3
  29. package/src/sap/ui/documentation/messagebundle_id.properties +6 -3
  30. package/src/sap/ui/documentation/messagebundle_it.properties +6 -3
  31. package/src/sap/ui/documentation/messagebundle_iw.properties +6 -3
  32. package/src/sap/ui/documentation/messagebundle_ja.properties +6 -3
  33. package/src/sap/ui/documentation/messagebundle_kk.properties +6 -3
  34. package/src/sap/ui/documentation/messagebundle_ko.properties +6 -3
  35. package/src/sap/ui/documentation/messagebundle_lt.properties +6 -3
  36. package/src/sap/ui/documentation/messagebundle_lv.properties +6 -3
  37. package/src/sap/ui/documentation/messagebundle_ms.properties +6 -3
  38. package/src/sap/ui/documentation/messagebundle_nl.properties +6 -3
  39. package/src/sap/ui/documentation/messagebundle_no.properties +6 -3
  40. package/src/sap/ui/documentation/messagebundle_pl.properties +6 -3
  41. package/src/sap/ui/documentation/messagebundle_pt.properties +6 -3
  42. package/src/sap/ui/documentation/messagebundle_pt_PT.properties +6 -3
  43. package/src/sap/ui/documentation/messagebundle_ro.properties +6 -3
  44. package/src/sap/ui/documentation/messagebundle_ru.properties +6 -3
  45. package/src/sap/ui/documentation/messagebundle_sh.properties +6 -3
  46. package/src/sap/ui/documentation/messagebundle_sk.properties +6 -3
  47. package/src/sap/ui/documentation/messagebundle_sl.properties +6 -3
  48. package/src/sap/ui/documentation/messagebundle_sv.properties +6 -3
  49. package/src/sap/ui/documentation/messagebundle_th.properties +10 -7
  50. package/src/sap/ui/documentation/messagebundle_tr.properties +6 -3
  51. package/src/sap/ui/documentation/messagebundle_uk.properties +6 -3
  52. package/src/sap/ui/documentation/messagebundle_vi.properties +6 -3
  53. package/src/sap/ui/documentation/messagebundle_zh_CN.properties +6 -3
  54. package/src/sap/ui/documentation/messagebundle_zh_TW.properties +6 -3
  55. package/src/sap/ui/documentation/sdk/Component.js +1 -1
  56. package/src/sap/ui/documentation/sdk/controller/App.controller.js +316 -178
  57. package/src/sap/ui/documentation/sdk/controller/BaseController.js +28 -3
  58. package/src/sap/ui/documentation/sdk/controller/ControlsMaster.controller.js +30 -17
  59. package/src/sap/ui/documentation/sdk/controller/DemoApps.controller.js +147 -28
  60. package/src/sap/ui/documentation/sdk/controller/Sample.controller.js +38 -18
  61. package/src/sap/ui/documentation/sdk/controller/SampleBaseController.js +27 -2
  62. package/src/sap/ui/documentation/sdk/controller/SearchPage.controller.js +14 -2
  63. package/src/sap/ui/documentation/sdk/controller/Tools.controller.js +2 -2
  64. package/src/sap/ui/documentation/sdk/controller/VersionNotFound.controller.js +15 -15
  65. package/src/sap/ui/documentation/sdk/controller/util/Highlighter.js +1 -1
  66. package/src/sap/ui/documentation/sdk/controller/util/IndexWorker.js +4 -3
  67. package/src/sap/ui/documentation/sdk/controller/util/ToolsInfo.js +6 -0
  68. package/src/sap/ui/documentation/sdk/css/style.css +22 -16
  69. package/src/sap/ui/documentation/sdk/images/tools/UI5TestRecorder.png +0 -0
  70. package/src/sap/ui/documentation/sdk/index.js +9 -9
  71. package/src/sap/ui/documentation/sdk/model/libraryData.js +18 -12
  72. package/src/sap/ui/documentation/sdk/tmpl/index.js.tmpl +4 -3
  73. package/src/sap/ui/documentation/sdk/tmpl/package.json.tmpl +1 -1
  74. package/src/sap/ui/documentation/sdk/tmpl/ui5.yaml.tmpl +1 -1
  75. package/src/sap/ui/documentation/sdk/view/ApiDetailInitial.view.xml +1 -4
  76. package/src/sap/ui/documentation/sdk/view/ApiMaster.view.xml +23 -14
  77. package/src/sap/ui/documentation/sdk/view/Controls.view.xml +2 -5
  78. package/src/sap/ui/documentation/sdk/view/ControlsMaster.view.xml +40 -31
  79. package/src/sap/ui/documentation/sdk/view/DemoApps.view.xml +4 -8
  80. package/src/sap/ui/documentation/sdk/view/FeedbackDialog.fragment.xml +1 -1
  81. package/src/sap/ui/documentation/sdk/view/Footer.fragment.xml +5 -8
  82. package/src/sap/ui/documentation/sdk/view/FooterMaster.fragment.xml +11 -0
  83. package/src/sap/ui/documentation/sdk/view/GlobalSearchPicker.fragment.xml +8 -1
  84. package/src/sap/ui/documentation/sdk/view/ReleaseNotesView.fragment.xml +7 -0
  85. package/src/sap/ui/documentation/sdk/view/SearchPage.view.xml +8 -4
  86. package/src/sap/ui/documentation/sdk/view/Tools.view.xml +27 -5
  87. package/src/sap/ui/documentation/sdk/view/TopicDetailInitial.view.xml +1 -5
  88. package/src/sap/ui/documentation/sdk/view/TopicMaster.view.xml +21 -14
  89. package/src/sap/ui/documentation/sdk/view/VersionNotFound.view.xml +1 -1
  90. package/src/sap/ui/documentation/sdk/view/Welcome.view.xml +1 -5
  91. package/src/sap/ui/documentation/themes/base/Documentation.less +13 -1
  92. package/src/sap/ui/documentation/themes/sap_horizon_dark/Documentation.less +17 -12
  93. package/src/sap/ui/documentation/sdk/view/ReleaseNotesView.view.tmpl +0 -11
@@ -7,6 +7,7 @@
7
7
  /*global history */
8
8
  sap.ui.define([
9
9
  "sap/ui/documentation/library",
10
+ "sap/ui/core/Core",
10
11
  "sap/ui/core/Fragment",
11
12
  "sap/ui/core/mvc/Controller",
12
13
  "sap/ui/core/routing/History",
@@ -16,21 +17,23 @@ sap.ui.define([
16
17
  "sap/ui/documentation/sdk/controller/util/APIInfo",
17
18
  "sap/base/strings/formatMessage",
18
19
  "sap/ui/documentation/WebPageTitleUtil"
19
- ], function (library, Fragment, Controller, History, ResourceModel, Device, mobileLibrary, APIInfo,
20
+ ], function (library, Core, Fragment, Controller, History, ResourceModel, Device, mobileLibrary, APIInfo,
20
21
  formatMessage, WebPageTitleUtil) {
21
22
  "use strict";
22
23
 
23
24
  // shortcut for sap.m.SplitAppMode
24
25
  var SplitAppMode = mobileLibrary.SplitAppMode;
25
26
 
27
+ var URLHelper = mobileLibrary.URLHelper;
28
+
26
29
  var _oWebPageTitleUtil = new WebPageTitleUtil();
27
30
 
28
31
  var _oPageTitle = [];
29
32
 
30
- return Controller.extend("sap.ui.documentation.sdk.controller.BaseController", {
33
+ var BaseController = Controller.extend("sap.ui.documentation.sdk.controller.BaseController", {
31
34
 
32
35
  // Prerequisites
33
- _oCore: sap.ui.getCore(),
36
+ _oCore: Core,
34
37
 
35
38
  formatMessage: formatMessage,
36
39
 
@@ -233,6 +236,16 @@ sap.ui.define([
233
236
  handleLandingImageLoad: function () {
234
237
  this.getView().byId("landingImageHeadline").setVisible(true);
235
238
  },
239
+ /**
240
+ * Handles the click on an item of the Footer Master (the footer placed
241
+ * at the bottom of any MasterPage (left side of the SplitApp)).
242
+ * @param {object} oEvent the Event object from which we are going to get the correct item key.
243
+ */
244
+ handleFooterMasterItemPress: function(oEvent) {
245
+ var sTargetText = oEvent.getParameter("item").getKey(),
246
+ sTarget = BaseController.LEGAL_LINKS[sTargetText];
247
+ URLHelper.redirect(sTarget, true);
248
+ },
236
249
  /**
237
250
  * Checks if a control has API Reference
238
251
  * @param {string} sControlName
@@ -261,5 +274,17 @@ sap.ui.define([
261
274
  return;
262
275
  }
263
276
  });
277
+
278
+ /**
279
+ * STATIC MEMBERS
280
+ */
281
+ BaseController.LEGAL_LINKS = {
282
+ "legal": "https://www.sap.com/corporate/en/legal/impressum.html",
283
+ "privacy": "https://www.sap.com/corporate/en/legal/privacy.html",
284
+ "terms_of_use": "https://www.sap.com/corporate/en/legal/terms-of-use.html",
285
+ "license": "LICENSE.txt"
286
+ };
287
+
288
+ return BaseController;
264
289
  }
265
290
  );
@@ -14,10 +14,10 @@ sap.ui.define([
14
14
  "sap/ui/model/Filter",
15
15
  "sap/ui/model/FilterOperator",
16
16
  "sap/ui/model/Sorter",
17
- "sap/base/util/Version",
18
17
  "sap/ui/util/Storage",
19
18
  "sap/ui/core/Core",
20
- "sap/ui/documentation/sdk/controller/util/Highlighter"
19
+ "sap/ui/documentation/sdk/controller/util/Highlighter",
20
+ "sap/ui/core/Fragment"
21
21
  ], function(
22
22
  jQuery,
23
23
  Device,
@@ -28,10 +28,10 @@ sap.ui.define([
28
28
  Filter,
29
29
  FilterOperator,
30
30
  Sorter,
31
- Version,
32
31
  Storage,
33
32
  Core,
34
- Highlighter
33
+ Highlighter,
34
+ Fragment
35
35
  ) {
36
36
  "use strict";
37
37
 
@@ -57,7 +57,7 @@ sap.ui.define([
57
57
  filter: {},
58
58
  groupProperty: "category",
59
59
  groupDescending: false,
60
- version: Version(sap.ui.version).getMajor() + "." + Version(sap.ui.version).getMinor()
60
+ version: ''
61
61
  },
62
62
  _mGroupFunctions: {
63
63
  "name": function (oContext) {
@@ -454,20 +454,33 @@ sap.ui.define([
454
454
  this._updateView();
455
455
  },
456
456
 
457
- handleListSettings: function () {
458
- // create dialog on demand
459
- if (!this._oVSDialog) {
460
- this._oVSDialog = sap.ui.xmlfragment(this.getView().getId(), "sap.ui.documentation.sdk.view.viewSettingsDialog", this);
461
- this.getView().addDependent(this._oVSDialog);
462
- }
463
-
464
- this._oVSDialog.setSelectedFilterCompoundKeys(this._oListSettings.filter);
465
- this._oVSDialog.setSelectedGroupItem(this._oListSettings.groupProperty);
466
- this._oVSDialog.setGroupDescending(this._oListSettings.groupDescending);
457
+ getViewSettingsDialog: function () {
458
+ return new Promise(function (fnResolve) {
459
+ if (!this._oVSDialog) {
460
+ Fragment.load({
461
+ id: this.getView().getId(),
462
+ name: "sap.ui.documentation.sdk.view.viewSettingsDialog",
463
+ controller: this
464
+ }).then(function (oDialog) {
465
+ this._oVSDialog = oDialog;
466
+ this.getView().addDependent(this._oVSDialog);
467
+ fnResolve(this._oVSDialog);
468
+ }.bind(this));
469
+ } else {
470
+ fnResolve(this._oVSDialog);
471
+ }
472
+ }.bind(this));
473
+ },
467
474
 
468
- // open
469
- this._oVSDialog.open();
475
+ handleListSettings: function () {
476
+ this.getViewSettingsDialog().then(function (oDialog) {
477
+ oDialog.setSelectedFilterCompoundKeys(this._oListSettings.filter);
478
+ oDialog.setSelectedGroupItem(this._oListSettings.groupProperty);
479
+ oDialog.setGroupDescending(this._oListSettings.groupDescending);
470
480
 
481
+ // open
482
+ oDialog.open();
483
+ });
471
484
  },
472
485
 
473
486
  handleListFilter: function (oEvent) {
@@ -18,9 +18,10 @@ sap.ui.define([
18
18
  "sap/ui/model/FilterOperator",
19
19
  "sap/ui/model/json/JSONModel",
20
20
  "sap/ui/model/resource/ResourceModel",
21
- "sap/ui/thirdparty/jquery"
21
+ "sap/ui/thirdparty/jquery",
22
+ "sap/ui/core/Fragment"
22
23
  ], function(Log, MessageBox, MessageToast, Device, VersionInfo, BaseController, ResourceDownloadUtil,
23
- formatter, libraryData, Filter, FilterOperator, JSONModel, ResourceModel, jQuery) {
24
+ formatter, libraryData, Filter, FilterOperator, JSONModel, ResourceModel, jQuery, Fragment) {
24
25
  "use strict";
25
26
 
26
27
  return BaseController.extend("sap.ui.documentation.sdk.controller.DemoApps", {
@@ -39,9 +40,16 @@ sap.ui.define([
39
40
 
40
41
 
41
42
  // load demo app metadata from docuindex of all available libraries
42
- libraryData.fillJSONModel(oModel);
43
- this.setModel(oModel);
44
- this.getView().setModel(oMessageBundle, "i18n");
43
+ libraryData.fillJSONModel(oModel)
44
+ .then(function () {
45
+ return this.loadDemoAppsCellFragments(oModel);
46
+ }.bind(this))
47
+ .then(function (oFragments) {
48
+ this._cellFragments = oFragments;
49
+ this.setModel(oModel);
50
+ }.bind(this));
51
+
52
+ this.getView().setModel(oMessageBundle, "i18n");
45
53
 
46
54
  this.setModel(new JSONModel({
47
55
  demoAppsHomeLink: "topic/a3ab54ecf7ac493b91904beb2095d208"
@@ -283,40 +291,151 @@ sap.ui.define([
283
291
  /* lifecycle methods */
284
292
  /* =========================================================== */
285
293
 
294
+ loadDemoAppsCellFragments: function(oModel) {
295
+ var aResult = {},
296
+ createDemoAppCell = this.createDemoAppCell.bind(this),
297
+ demoApps = oModel.getProperty("/demoAppsByCategory");
298
+
299
+ function handleCategory(category) {
300
+ return Promise.all(category.rows.map(handleRow));
301
+ }
302
+
303
+ function handleRow(row) {
304
+ return Promise.all(row.map(function (cell) {
305
+ return createDemoAppCell(cell).then(function (oCell) {
306
+ aResult[cell.id] = oCell;
307
+ });
308
+ }));
309
+ }
310
+
311
+ return new Promise(function (resolve, reject) {
312
+ Promise.all(demoApps.map(handleCategory))
313
+ .then(function () {
314
+ resolve(aResult);
315
+ })
316
+ .catch(function (error) {
317
+ reject(error);
318
+ });
319
+ });
320
+ },
321
+
286
322
  /**
287
323
  * Factory function for creating the demo app cells
288
324
  *
289
- * @param {string} sId the id for the current cell
325
+ * @param {string} _ the id of the cell in the dom
290
326
  * @param {sap.ui.model.Context} oBindingContext the context for the current cell
291
327
  * @return {sap.ui.layout.BlockLayoutCell} either a teaser cell or a demo app cell based on the metadata in the model
292
328
  * @public
293
329
  */
294
- createDemoAppCell: function (sId, oBindingContext) {
295
- var oBlockLayoutCell;
296
- if (oBindingContext.getObject().teaser) { // teaser cell (loads fragment from demo app)
297
- try {
298
- sap.ui.loader.config({paths:{"test-resources":"test-resources"}});
299
- var sRelativePath = sap.ui.require.toUrl(oBindingContext.getObject().teaser);
300
- var oTeaser = sap.ui.xmlfragment(sId, sRelativePath);
301
- oBlockLayoutCell = sap.ui.xmlfragment(sId, "sap.ui.documentation.sdk.view.BlockLayoutTeaserCell", this);
302
- oBlockLayoutCell.getContent()[0].addContent(oTeaser);
303
- sap.ui.loader.config({paths:{"test-resources":null}});
304
- //sets the teaser to aria-hidden => gets ignored by screen reader
305
- oTeaser.addEventDelegate({"onAfterRendering": function() {
306
- this.getParent().getDomRef().childNodes[1].setAttribute("aria-hidden", "true");
307
- }.bind(oTeaser)});
308
- } catch (oException) {
309
- Log.warning("Teaser for demo app \"" + oBindingContext.getObject().name + "\" could not be loaded: " + oException);
310
- oBlockLayoutCell = sap.ui.xmlfragment(sId, "sap.ui.documentation.sdk.view.BlockLayoutCell", this);
311
- }
312
- } else { // normal cell
313
- oBlockLayoutCell = sap.ui.xmlfragment(sId, "sap.ui.documentation.sdk.view.BlockLayoutCell", this);
314
- }
315
- oBlockLayoutCell.setBindingContext(oBindingContext);
330
+ createDemoAppCellFactory: function (_, oBindingContext) {
331
+ var id = oBindingContext.getObject().id;
332
+ return this._cellFragments[id];
333
+ },
334
+
335
+ /**
336
+ * Handler for the demo app cell creation
337
+ *
338
+ * @param {sap.ui.model.Context} oBindingContext the context for the current cell
339
+ * @param {sap.ui.core.Control[]} aFragments the fragments for the current cell [teaser, default cell]
340
+ * @return {sap.ui.layout.BlockLayoutCell} the demo app cell
341
+ * @private
342
+ **/
343
+ onDemoAppCellCreated: function (oBindingContext, aFragments) {
344
+ var oTeaser = aFragments[0],
345
+ oBlockLayoutCell = aFragments[1];
346
+
347
+ oBlockLayoutCell.getContent()[0].addContent(oTeaser);
348
+ sap.ui.loader.config({paths:{"test-resources":null}});
349
+ //sets the teaser to aria-hidden => gets ignored by screen reader
350
+ oTeaser.addEventDelegate({"onAfterRendering": function() {
351
+ this.getParent().getDomRef().childNodes[1].setAttribute("aria-hidden", "true");
352
+ }.bind(oTeaser)});
316
353
 
354
+ oBlockLayoutCell.setBindingContext(oBindingContext);
317
355
  return oBlockLayoutCell;
318
356
  },
319
357
 
358
+ /**
359
+ * Handler for the demo app cell creation error
360
+ * Creates and returns a normal demo app cell instead as promise
361
+ *
362
+ * @param {sap.ui.model.Context} oBindingContext the context for the current cell
363
+ * @param {Error} oException the exception that occurred during the cell creation
364
+ * @return {Promise<sap.ui.layout.BlockLayoutCell>} the demo app cell as promise
365
+ * @private
366
+ **/
367
+ onDemoAppCellFailed: function (oBindingContext, oException) {
368
+ Log.warning("Teaser for demo app \"" + oBindingContext.name + "\" could not be loaded: " + oException);
369
+ return this.createNormalDemoAppCell(oBindingContext);
370
+ },
371
+
372
+ /**
373
+ * Creates a normal demo app cell
374
+ * @param {sap.ui.model.Context} oBindingContext the context for the current cell
375
+ * @return {Promise<sap.ui.layout.BlockLayoutCell>} the demo app cell as promise
376
+ * @private
377
+ **/
378
+ createNormalDemoAppCell: function (oBindingContext) {
379
+ return new Promise(function (resolve) {
380
+ Fragment.load({
381
+ id: oBindingContext.id,
382
+ name: "sap.ui.documentation.sdk.view.BlockLayoutCell",
383
+ controller: this
384
+ }).then(function (oBlockLayoutCell) {
385
+ oBlockLayoutCell.setBindingContext(oBindingContext);
386
+ resolve(oBlockLayoutCell);
387
+ });
388
+ }.bind(this));
389
+ },
390
+
391
+ /**
392
+ * Creates a demo app cell with a teaser
393
+ *
394
+ * @param {sap.ui.model.Context} oBindingContext the context for the current cell
395
+ * @return {Promise<sap.ui.layout.BlockLayoutCell>} the demo app cell as promise
396
+ * @private
397
+ **/
398
+ createDemoAppCellFromTeaser: function (oBindingContext) {
399
+ sap.ui.loader.config({paths:{"test-resources":"test-resources"}});
400
+ var sRelativePath = sap.ui.require.toUrl(oBindingContext.teaser),
401
+ oPromiseTeaser = Fragment.load({
402
+ id: oBindingContext.id,
403
+ name: sRelativePath,
404
+ controller: this
405
+ }),
406
+ oPromiseCell = Fragment.load({
407
+ id: oBindingContext.id,
408
+ name: "sap.ui.documentation.sdk.view.BlockLayoutTeaserCell",
409
+ controller: this
410
+ }),
411
+ onCreated = this.onDemoAppCellCreated.bind(this, oBindingContext),
412
+ onFailed = this.onDemoAppCellFailed.bind(this, oBindingContext);
413
+
414
+ return Promise.all([oPromiseTeaser, oPromiseCell])
415
+ .then(function (aFragments) {
416
+ return onCreated(aFragments);
417
+ })
418
+ .catch(function (oException) {
419
+ return onFailed(oException);
420
+ });
421
+ },
422
+
423
+ /**
424
+ * Creates a demo app cell or a normal considering the teaser information
425
+ * @param {sap.ui.model.Context} oBindingContext the context for the current cell
426
+ * @return {Promise<sap.ui.layout.BlockLayoutCell>} the demo app cell as promise
427
+ * @private
428
+ **/
429
+ createDemoAppCell: function (oBindingContext) {
430
+ if (oBindingContext.teaser) {
431
+ // teaser cell (loads fragment from demo app)
432
+ return this.createDemoAppCellFromTeaser(oBindingContext);
433
+ } else {
434
+ // normal cell
435
+ return this.createNormalDemoAppCell(oBindingContext);
436
+ }
437
+ },
438
+
320
439
  /* =========================================================== */
321
440
  /* helper methods */
322
441
  /* =========================================================== */
@@ -18,6 +18,7 @@ sap.ui.define([
18
18
  "sap/ui/core/HTML",
19
19
  "sap/m/library",
20
20
  "sap/base/Log",
21
+ "sap/ui/core/Core",
21
22
  "sap/ui/core/Fragment",
22
23
  "sap/ui/documentation/sdk/util/Resources",
23
24
  "./config/sampleForwardingConfig",
@@ -36,6 +37,7 @@ sap.ui.define([
36
37
  HTML,
37
38
  mobileLibrary,
38
39
  Log,
40
+ Core,
39
41
  Fragment,
40
42
  ResourcesUtil,
41
43
  sampleForwardingConfig,
@@ -78,7 +80,7 @@ sap.ui.define([
78
80
 
79
81
  this.getView().setModel(this.oModel);
80
82
 
81
- this.bus = sap.ui.getCore().getEventBus();
83
+ this.bus = Core.getEventBus();
82
84
  this.setDefaultSampleTheme();
83
85
  this.bus.subscribe("themeChanged", "onDemoKitThemeChanged", this.onDemoKitThemeChanged, this);
84
86
 
@@ -254,6 +256,24 @@ sap.ui.define([
254
256
  this.sIFrameUrl = ResourcesUtil.getResourceOrigin() + "/resources/sap/ui/documentation/sdk/index.html" + sSampleSearchParams;
255
257
  },
256
258
 
259
+ getSettingsDialog: function () {
260
+ return new Promise(function (resolve, reject) {
261
+ if (!this._oSettingsDialog) {
262
+ Fragment.load({
263
+ id: "sample",
264
+ name: "sap.ui.documentation.sdk.view.appSettingsDialog",
265
+ controller: this
266
+ }).then(function (oSettingsDialog) {
267
+ this._oSettingsDialog = oSettingsDialog;
268
+ this._oSettingsDialog.setModel(this._oMessageBundle, "i18n");
269
+ resolve(this._oSettingsDialog);
270
+ }.bind(this));
271
+ } else {
272
+ resolve(this._oSettingsDialog);
273
+ }
274
+ }.bind(this));
275
+ },
276
+
257
277
  /**
258
278
  * Opens the View settings dialog
259
279
  * @public
@@ -266,31 +286,31 @@ sap.ui.define([
266
286
  });
267
287
  }
268
288
 
269
- if (!this._oSettingsDialog) {
270
- this._oSettingsDialog = sap.ui.xmlfragment("sample", "sap.ui.documentation.sdk.view.appSettingsDialog", this);
271
-
272
- this._oSettingsDialog.setModel(this._oMessageBundle, "i18n");
273
- }
274
-
275
- this.loadSampleSettings(this.applySampleSettings.bind(this)).then(function() {
276
- this._oSettingsDialog.open();
277
- }.bind(this)).catch(function(err) {
278
- Log.error(err);
279
- });
289
+ this.getSettingsDialog()
290
+ .then(function (oSettingsDialog) {
291
+ this.loadSampleSettings(this.applySampleSettings.bind(this));
292
+ return oSettingsDialog;
293
+ }.bind(this))
294
+ .then(function(oSettingsDialog) {
295
+ oSettingsDialog.open();
296
+ })
297
+ .catch(function(err) {
298
+ Log.error(err);
299
+ });
280
300
  },
281
301
 
282
302
  applySampleSettings: function(eMessage) {
283
303
  if (eMessage.data.type === "SETTINGS") {
284
- var oThemeSelect = sap.ui.getCore().byId("sample--ThemeSelect");
304
+ var oThemeSelect = Core.byId("sample--ThemeSelect");
285
305
 
286
306
  // Theme select
287
307
  oThemeSelect.setSelectedKey(eMessage.data.data.theme);
288
308
 
289
309
  // RTL
290
- sap.ui.getCore().byId("sample--RTLSwitch").setState(eMessage.data.data.RTL);
310
+ Core.byId("sample--RTLSwitch").setState(eMessage.data.data.RTL);
291
311
 
292
312
  // Density mode select
293
- sap.ui.getCore().byId("sample--DensityModeSwitch").setSelectedKey(this._presetDensity(eMessage.data.data.density, true));
313
+ Core.byId("sample--DensityModeSwitch").setSelectedKey(this._presetDensity(eMessage.data.data.density, true));
294
314
 
295
315
  }
296
316
  },
@@ -325,9 +345,9 @@ sap.ui.define([
325
345
  },
326
346
 
327
347
  handleSaveAppSettings: function () {
328
- var sDensityMode = sap.ui.getCore().byId("sample--DensityModeSwitch").getSelectedKey(),
329
- sTheme = sap.ui.getCore().byId("sample--ThemeSelect").getSelectedKey(),
330
- bRTL = sap.ui.getCore().byId("sample--RTLSwitch").getState();
348
+ var sDensityMode = Core.byId("sample--DensityModeSwitch").getSelectedKey(),
349
+ sTheme = Core.byId("sample--ThemeSelect").getSelectedKey(),
350
+ bRTL = Core.byId("sample--RTLSwitch").getState();
331
351
 
332
352
  this._oSettingsDialog.close();
333
353
 
@@ -196,9 +196,34 @@ sap.ui.define([
196
196
  });
197
197
  },
198
198
 
199
+ /**
200
+ * Formats the name in NPM style string:
201
+ *
202
+ * A package.json file must contain "name" and "version" fields.
203
+ * The "name" field contains your package's name, and must be lowercase and one word,
204
+ * and may contain hyphens and underscores.
205
+ *
206
+ * @param {string} name The name to format
207
+ * @returns {string} Formatted name
208
+ */
209
+ _formatNameToNpmSpec: function (name) {
210
+ var result;
211
+ var testValidChars = /[^\w_\-\.]+/gi; // Only "words", "-", "_" and "."
212
+
213
+ name = name
214
+ .replace(testValidChars, "") // Cleanup invalid characters
215
+ .replaceAll(".", "-"); // Replace the dots with dashes
216
+
217
+ result = name.split(/(?=[A-Z])/); // Split on Capital letters
218
+
219
+ return result
220
+ .map(function (chunk) { return chunk.toLowerCase(); })
221
+ .join("-");
222
+ },
223
+
199
224
  _formatPackageJson: function (sPackageFile, sManifestFile, oData) {
200
225
  var sFormattedPackageFile = sPackageFile.replace(/{{TITLE}}/g, oData.title)
201
- .replace(/{{SAMPLE_ID}}/g, oData.id),
226
+ .replace(/{{SAMPLE_ID}}/g, this._formatNameToNpmSpec(oData.id)),
202
227
  oPackageFile = JSON.parse(sFormattedPackageFile),
203
228
  oPackageDependencies = oPackageFile.dependencies,
204
229
  oManifestFile,
@@ -226,7 +251,7 @@ sap.ui.define([
226
251
  },
227
252
 
228
253
  _formatYamlFile: function(sFile, oData) {
229
- return sFile.replace(/{{SAMPLE_ID}}/g, oData.id);
254
+ return sFile.replace(/{{SAMPLE_ID}}/g, this._formatNameToNpmSpec(oData.id));
230
255
  },
231
256
 
232
257
  _formatManifestJsFile: function (sRawManifestFileJs) {
@@ -131,14 +131,26 @@ sap.ui.define([
131
131
  oView.byId("samplesList").getItems()
132
132
  ),
133
133
  iLen = aItems.length,
134
- oItem;
134
+ oItem,
135
+ oLink,
136
+ sHref,
137
+ sTarget = "_self",
138
+ bExternal;
135
139
 
136
140
  while (iLen--) {
137
141
  oItem = aItems[iLen];
138
142
  // Access control lazy loading method if available
139
143
  if (oItem._getLinkSender) {
140
144
  // Set link href to allow open in new window functionality
141
- oItem._getLinkSender().setHref(oItem.getCustomData()[0].getValue());
145
+ oLink = oItem._getLinkSender();
146
+ sHref = oItem.getCustomData()[0].getValue();
147
+ bExternal = oItem.getCustomData()[1].getValue();
148
+ if (bExternal) {
149
+ sHref = new URL(sHref, document.baseURI).href;
150
+ sTarget = "_blank";
151
+ }
152
+ oLink.setHref(sHref);
153
+ oLink.setTarget(sTarget);
142
154
  }
143
155
  }
144
156
  },
@@ -60,8 +60,8 @@ sap.ui.define([
60
60
  this.setModel(new JSONModel({
61
61
  inspectorHomeLink: "topic/b24e72443eb34d0fb7bf6940f2d697eb",
62
62
  supportAssistantHomeLink: oData.supportAssistant.href,
63
- iconExplorerHomeLink: "topic/21ea0ea94614480d9a910b2e93431291"
64
- // etc
63
+ iconExplorerHomeLink: "topic/21ea0ea94614480d9a910b2e93431291",
64
+ ui5TestRecorderHomeLink: oData.ui5TestRecorder.href
65
65
  }), "newWindowLinks");
66
66
  },
67
67
 
@@ -7,11 +7,13 @@
7
7
  sap.ui.define([
8
8
  "./BaseController",
9
9
  "sap/ui/thirdparty/jquery",
10
+ "sap/ui/core/Core",
10
11
  "sap/ui/documentation/sdk/controller/util/URLUtil",
11
12
  "sap/m/library"
12
13
  ], function (
13
14
  BaseController,
14
15
  jQuery,
16
+ Core,
15
17
  DemokitURLUtil,
16
18
  mLib
17
19
  ) {
@@ -47,13 +49,13 @@ sap.ui.define([
47
49
  sUrl = document.location.href,
48
50
  sRedirectUrl,
49
51
  sVersion = DemokitURLUtil.parseVersion(sUrl),
50
- isRemoved = false;
52
+ oPatchInfo = this._getPatchInfo(oVersionInfo, sVersion),
53
+ isRemoved = oPatchInfo && oPatchInfo.removed,
54
+ isRuntimeOnly = oPatchInfo && oPatchInfo.runtimeOnly;
51
55
 
52
56
  oMessagePage.setBusy(false);
53
57
 
54
- isRemoved = this._isVersionRemoved(oVersionInfo, sVersion);
55
-
56
- if (isRemoved && DemokitURLUtil.requestsDemokitView(sUrl)) {
58
+ if ((isRemoved || isRuntimeOnly) && DemokitURLUtil.requestsDemokitView(sUrl)) {
57
59
  // redirect to the latest (version-less) URL
58
60
  sRedirectUrl = DemokitURLUtil.removeVersion(sUrl);
59
61
  mLib.URLHelper.redirect(sRedirectUrl);
@@ -72,6 +74,10 @@ sap.ui.define([
72
74
  // show removed message
73
75
  oMessagePage.setText(this._getLibraryResourceBundle().getText("NOT_FOUND_REMOVED_TEXT"));
74
76
  oReadMoreBtn.setVisible(true);
77
+ } else if (isRuntimeOnly) {
78
+ // show removed message
79
+ oMessagePage.setText(this._getLibraryResourceBundle().getText("NOT_FOUND_DK_REMOVED_TEXT"));
80
+ oReadMoreBtn.setVisible(true);
75
81
  } else {
76
82
  // show unavailable message
77
83
  oReadMoreBtn.setVisible(false);
@@ -79,21 +85,15 @@ sap.ui.define([
79
85
  }
80
86
  },
81
87
 
82
- _isVersionRemoved: function (oVersionInfo, sVersion) {
83
- var aPatches = oVersionInfo.patches,
84
- iVersionIndex,
85
- reVersion;
86
-
87
- iVersionIndex = aPatches.findIndex(function (oData) {
88
- reVersion = new RegExp(oData.version);
89
- return oData.removed && reVersion.test(sVersion);
88
+ _getPatchInfo: function (oVersionInfo, sVersion) {
89
+ var aPatches = oVersionInfo.patches;
90
+ return aPatches.find(function (oData) {
91
+ return sVersion === oData.version;
90
92
  });
91
-
92
- return iVersionIndex > -1;
93
93
  },
94
94
 
95
95
  _getLibraryResourceBundle: function () {
96
- return sap.ui.getCore().getLibraryResourceBundle("sap.ui.documentation");
96
+ return Core.getLibraryResourceBundle("sap.ui.documentation");
97
97
  },
98
98
 
99
99
  _loadVersionInfo: function () {
@@ -230,7 +230,7 @@ function() {
230
230
  Highlighter.prototype._createHighlightedNode = function (oTokensToHighlight, sText) {
231
231
  var oRootNode = document.createElement("span"),
232
232
  aAllTokens = [],
233
- fnSort = function(a, b) {return a > b;},
233
+ fnSort = function(a, b) {return parseInt(a) > parseInt(b);},
234
234
  aIndices = Object.keys(oTokensToHighlight).sort(fnSort),
235
235
  iIndex,
236
236
  iStartIndex = 0;
@@ -563,7 +563,6 @@
563
563
  oObject,
564
564
  sDeprecatedMarker;
565
565
  if (oDoc.category === DOC_CATEGORY.documentation) {
566
- sNavURL = sNavURL.substring(0, sNavURL.lastIndexOf(".html"));
567
566
  bShouldAddToSearchResults = true;
568
567
  sCategory = "Documentation";
569
568
  oObject = {
@@ -572,7 +571,8 @@
572
571
  summary: sSummary || "",
573
572
  score: oDoc.score,
574
573
  modified: sModified,
575
- category: sCategory
574
+ category: sCategory,
575
+ external: oDoc.external
576
576
  };
577
577
  aDataDoc.push(oObject);
578
578
  iDocLength++;
@@ -589,7 +589,8 @@
589
589
  summary: sSummary || "",
590
590
  score: oDoc.score,
591
591
  modified: sModified,
592
- category: sCategory
592
+ category: sCategory,
593
+ external: oDoc.external
593
594
  };
594
595
  aDataExplored.push(oObject);
595
596
  iExploredLength++;
@@ -78,6 +78,12 @@ sap.ui.define([],
78
78
  "text": "Accessibility Guide",
79
79
  "href": "test-resources/sap/m/demokit/accessibilityGuide/webapp/index.html",
80
80
  "hideOnPhone": true
81
+ },
82
+ {
83
+ "id": "ui5TestRecorder",
84
+ "text": "UI5 Test Recorder",
85
+ "href": "topic/2535ef9272064cb6bd6b44e5402d531d",
86
+ "hideOnPhone": true
81
87
  }
82
88
  ];
83
89