@openui5/sap.ui.documentation 1.118.0 → 1.119.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 (73) hide show
  1. package/THIRDPARTY.txt +2 -2
  2. package/package.json +7 -7
  3. package/src/sap/ui/documentation/.library +1 -1
  4. package/src/sap/ui/documentation/Search.js +32 -22
  5. package/src/sap/ui/documentation/library.js +2 -2
  6. package/src/sap/ui/documentation/messagebundle.properties +28 -5
  7. package/src/sap/ui/documentation/messagebundle_ar.properties +17 -5
  8. package/src/sap/ui/documentation/messagebundle_bg.properties +19 -7
  9. package/src/sap/ui/documentation/messagebundle_ca.properties +17 -5
  10. package/src/sap/ui/documentation/messagebundle_cs.properties +17 -5
  11. package/src/sap/ui/documentation/messagebundle_cy.properties +17 -5
  12. package/src/sap/ui/documentation/messagebundle_da.properties +17 -5
  13. package/src/sap/ui/documentation/messagebundle_de.properties +18 -6
  14. package/src/sap/ui/documentation/messagebundle_el.properties +17 -5
  15. package/src/sap/ui/documentation/messagebundle_en.properties +15 -3
  16. package/src/sap/ui/documentation/messagebundle_en_GB.properties +17 -5
  17. package/src/sap/ui/documentation/messagebundle_es.properties +17 -5
  18. package/src/sap/ui/documentation/messagebundle_es_MX.properties +17 -5
  19. package/src/sap/ui/documentation/messagebundle_et.properties +16 -4
  20. package/src/sap/ui/documentation/messagebundle_fi.properties +18 -6
  21. package/src/sap/ui/documentation/messagebundle_fr.properties +17 -5
  22. package/src/sap/ui/documentation/messagebundle_fr_CA.properties +17 -5
  23. package/src/sap/ui/documentation/messagebundle_hi.properties +19 -7
  24. package/src/sap/ui/documentation/messagebundle_hr.properties +17 -5
  25. package/src/sap/ui/documentation/messagebundle_hu.properties +17 -5
  26. package/src/sap/ui/documentation/messagebundle_id.properties +17 -5
  27. package/src/sap/ui/documentation/messagebundle_it.properties +18 -6
  28. package/src/sap/ui/documentation/messagebundle_iw.properties +18 -6
  29. package/src/sap/ui/documentation/messagebundle_ja.properties +20 -8
  30. package/src/sap/ui/documentation/messagebundle_kk.properties +17 -5
  31. package/src/sap/ui/documentation/messagebundle_ko.properties +18 -6
  32. package/src/sap/ui/documentation/messagebundle_lt.properties +17 -5
  33. package/src/sap/ui/documentation/messagebundle_lv.properties +17 -5
  34. package/src/sap/ui/documentation/messagebundle_ms.properties +17 -5
  35. package/src/sap/ui/documentation/messagebundle_nl.properties +17 -5
  36. package/src/sap/ui/documentation/messagebundle_no.properties +17 -5
  37. package/src/sap/ui/documentation/messagebundle_pl.properties +17 -5
  38. package/src/sap/ui/documentation/messagebundle_pt.properties +18 -6
  39. package/src/sap/ui/documentation/messagebundle_pt_PT.properties +17 -5
  40. package/src/sap/ui/documentation/messagebundle_ro.properties +17 -5
  41. package/src/sap/ui/documentation/messagebundle_ru.properties +18 -6
  42. package/src/sap/ui/documentation/messagebundle_sh.properties +17 -5
  43. package/src/sap/ui/documentation/messagebundle_sk.properties +19 -7
  44. package/src/sap/ui/documentation/messagebundle_sl.properties +17 -5
  45. package/src/sap/ui/documentation/messagebundle_sv.properties +17 -5
  46. package/src/sap/ui/documentation/messagebundle_th.properties +26 -14
  47. package/src/sap/ui/documentation/messagebundle_tr.properties +17 -5
  48. package/src/sap/ui/documentation/messagebundle_uk.properties +22 -10
  49. package/src/sap/ui/documentation/messagebundle_vi.properties +17 -5
  50. package/src/sap/ui/documentation/messagebundle_zh_CN.properties +17 -5
  51. package/src/sap/ui/documentation/messagebundle_zh_TW.properties +18 -6
  52. package/src/sap/ui/documentation/sdk/Component.js +0 -24
  53. package/src/sap/ui/documentation/sdk/controller/ApiDetail.controller.js +7 -0
  54. package/src/sap/ui/documentation/sdk/controller/App.controller.js +1534 -1658
  55. package/src/sap/ui/documentation/sdk/controller/SampleBaseController.js +1 -1
  56. package/src/sap/ui/documentation/sdk/controller/SearchPage.controller.js +31 -14
  57. package/src/sap/ui/documentation/sdk/controller/util/ConfigUtil.js +1 -2
  58. package/src/sap/ui/documentation/sdk/controller/util/IndexWorker.js +1 -1
  59. package/src/sap/ui/documentation/sdk/controller/util/ThemePicker.js +11 -3
  60. package/src/sap/ui/documentation/sdk/css/style.css +0 -4
  61. package/src/sap/ui/documentation/sdk/images/ui5-logo-dark.svg +22 -0
  62. package/src/sap/ui/documentation/sdk/images/ui5-logo-light.svg +22 -0
  63. package/src/sap/ui/documentation/sdk/manifest.json +6 -0
  64. package/src/sap/ui/documentation/sdk/model/theme-parameters.json +4 -0
  65. package/src/sap/ui/documentation/sdk/view/App.view.xml +312 -192
  66. package/src/sap/ui/documentation/sdk/view/Footer.fragment.xml +1 -1
  67. package/src/sap/ui/documentation/themes/base/Documentation.less +361 -0
  68. package/src/sap/ui/documentation/themes/base/Search.less +16 -12
  69. package/src/sap/ui/documentation/themes/sap_horizon/library.source.less +1 -2
  70. package/src/sap/ui/documentation/themes/sap_horizon_dark/library.source.less +1 -2
  71. package/src/sap/ui/documentation/sdk/view/FeedbackDialog.fragment.xml +0 -87
  72. package/src/sap/ui/documentation/themes/sap_horizon/Search.less +0 -3
  73. package/src/sap/ui/documentation/themes/sap_horizon_dark/Search.less +0 -3
@@ -5,7 +5,6 @@
5
5
  */
6
6
 
7
7
  sap.ui.define([
8
- "sap/ui/events/KeyCodes",
9
8
  "sap/ui/thirdparty/jquery",
10
9
  "sap/ui/documentation/sdk/controller/BaseController",
11
10
  "sap/ui/documentation/sdk/controller/util/NewsInfo",
@@ -18,12 +17,9 @@ sap.ui.define([
18
17
  "sap/ui/core/Fragment",
19
18
  "sap/base/util/UriParameters",
20
19
  "sap/ui/documentation/library",
21
- "sap/ui/core/IconPool",
22
- "sap/m/MessageBox",
23
20
  "sap/m/library",
24
21
  "sap/base/Log",
25
22
  "sap/base/util/Version",
26
- "sap/ui/core/syncStyleClass",
27
23
  "sap/ui/core/Core",
28
24
  "sap/ui/util/openWindow",
29
25
  "sap/ui/documentation/sdk/model/formatter",
@@ -34,8 +30,7 @@ sap.ui.define([
34
30
  "sap/ui/documentation/sdk/util/Resources",
35
31
  'sap/base/util/LoaderExtensions',
36
32
  "sap/ui/documentation/sdk/controller/util/ThemePicker"
37
- ], function(
38
- KeyCodes,
33
+ ], function (
39
34
  jQuery,
40
35
  BaseController,
41
36
  NewsInfo,
@@ -48,12 +43,9 @@ sap.ui.define([
48
43
  Fragment,
49
44
  UriParameters,
50
45
  library,
51
- IconPool,
52
- MessageBox,
53
46
  mobileLibrary,
54
47
  Log,
55
48
  Version,
56
- syncStyleClass,
57
49
  Core,
58
50
  openWindow,
59
51
  globalFormatter,
@@ -65,1849 +57,1733 @@ sap.ui.define([
65
57
  LoaderExtensions,
66
58
  ThemePicker
67
59
  ) {
68
- "use strict";
69
-
70
- // shortcut for sap.m.SplitAppMode
71
- var SplitAppMode = mobileLibrary.SplitAppMode;
72
-
73
- var MAIN_WEB_PAGE_TITLE = "Demo Kit - \uFFFD SDK",
74
- WEB_PAGE_TITLE = {
75
- topic: "Documentation - " + MAIN_WEB_PAGE_TITLE,
76
- api: "API Reference - " + MAIN_WEB_PAGE_TITLE,
77
- controls: "Samples - " + MAIN_WEB_PAGE_TITLE,
78
- demoapps: "Demo Apps - " + MAIN_WEB_PAGE_TITLE,
79
- tools: "Tools - " + MAIN_WEB_PAGE_TITLE,
80
- home: MAIN_WEB_PAGE_TITLE
81
- };
82
-
83
- function getResourcePath(sResource) {
84
-
85
- return ResourcesUtil.getResourcesVersion() && !self['sap-ui-documentation-config'] ?
86
- window.origin + sResource :
87
- ResourcesUtil.getResourceOriginPath(sResource);
88
-
89
- }
90
- // shortcut for sap.m.URLHelper
91
- var URLHelper = mobileLibrary.URLHelper,
92
- sNeoAppJsonPath = getResourcePath("/neo-app.json"), /* Load neo-app.json always from root URL */
93
- sVersionOverviewJsonPath = getResourcePath("/versionoverview.json"), /* Load versionoverview.json always from root URL */
94
- ABOUT_TEXT = "about",
95
- FEEDBACK_TEXT = "feedback",
96
- FEEDBACK_URL = "https://demokit-feedback-proxy.cfapps.eu12.hana.ondemand.com/issue",
97
- CHANGE_VERSION_TEXT = "change_version",
98
- CHANGE_SETTINGS_TEXT = "settings",
99
- CHANGE_COOKIE_PREFERENCES_TEXT = "cookie_preferences",
100
- DEMOKIT_DEFAULT_LANGUAGE = "en",
101
- DEMOKIT_CONFIGURATION_LANGUAGE = "language",
102
- DEMOKIT_CONFIGURATION_APPEARANCE = "appearance",
103
- SITEMAP = "sitemap";
104
-
105
- return BaseController.extend("sap.ui.documentation.sdk.controller.App", {
106
- formatter: globalFormatter,
107
-
108
- _arrToTreeConverter: function() {
109
- var aNodes,
110
- aOriginalArr = this._aNeoAppVersions.slice(),
111
- aResultArr = [],
112
- iCounter = 0,
113
- sCurrGroupTitle = "";
114
-
115
- for (var i = 0; i < aOriginalArr.length; i++) {
116
- sCurrGroupTitle = aOriginalArr[i].groupTitle;
117
- iCounter = 0;
118
- aNodes = [];
119
- while (aOriginalArr[i] && aOriginalArr[i].groupTitle && aOriginalArr[i].groupTitle === sCurrGroupTitle) {
120
- aNodes.push(aOriginalArr[i]);
121
- iCounter++;
122
- i++;
123
- }
124
- i--;
125
- aResultArr.push({
126
- "groupTitle": sCurrGroupTitle,
127
- "version": sCurrGroupTitle + " (" + iCounter + " versions)",
128
- "nodes": aNodes,
129
- "path": aNodes[0].path
130
- });
60
+ "use strict";
61
+
62
+ var getResourcePath = function (sResource) {
63
+ return ResourcesUtil.getResourcesVersion() && !self['sap-ui-documentation-config']
64
+ ? window.origin + sResource
65
+ : ResourcesUtil.getResourceOriginPath(sResource);
66
+ };
67
+
68
+ var MAIN_WEB_PAGE_TITLE = "Demo Kit - \uFFFD SDK",
69
+ WEB_PAGE_TITLE = {
70
+ topic: "Documentation - " + MAIN_WEB_PAGE_TITLE,
71
+ api: "API Reference - " + MAIN_WEB_PAGE_TITLE,
72
+ controls: "Samples - " + MAIN_WEB_PAGE_TITLE,
73
+ demoapps: "Demo Apps - " + MAIN_WEB_PAGE_TITLE,
74
+ tools: "Tools - " + MAIN_WEB_PAGE_TITLE,
75
+ home: MAIN_WEB_PAGE_TITLE
76
+ };
77
+
78
+ var URLHelper = mobileLibrary.URLHelper,
79
+ SplitAppMode = mobileLibrary.SplitAppMode,
80
+ sNeoAppJsonPath = getResourcePath("/neo-app.json"), /* Load neo-app.json always from root URL */
81
+ sVersionOverviewJsonPath = getResourcePath("/versionoverview.json"), /* Load versionoverview.json always from root URL */
82
+ ABOUT_TEXT = "about",
83
+ CHANGE_VERSION_TEXT = "change_version",
84
+ CHANGE_SETTINGS_TEXT = "settings",
85
+ CHANGE_COOKIE_PREFERENCES_TEXT = "cookie_preferences",
86
+ DEMOKIT_DEFAULT_LANGUAGE = "en",
87
+ DEMOKIT_CONFIGURATION_LANGUAGE = "language",
88
+ DEMOKIT_CONFIGURATION_APPEARANCE = "appearance",
89
+ SITEMAP = "sitemap";
90
+
91
+ return BaseController.extend("sap.ui.documentation.sdk.controller.App", {
92
+ formatter: globalFormatter,
93
+
94
+ _arrToTreeConverter: function () {
95
+ var aNodes,
96
+ aOriginalArr = this._aNeoAppVersions.slice(),
97
+ aResultArr = [],
98
+ iCounter = 0,
99
+ sCurrGroupTitle = "";
100
+
101
+ for (var i = 0; i < aOriginalArr.length; i++) {
102
+ sCurrGroupTitle = aOriginalArr[i].groupTitle;
103
+ iCounter = 0;
104
+ aNodes = [];
105
+ while (aOriginalArr[i] && aOriginalArr[i].groupTitle && aOriginalArr[i].groupTitle === sCurrGroupTitle) {
106
+ aNodes.push(aOriginalArr[i]);
107
+ iCounter++;
108
+ i++;
131
109
  }
110
+ i--;
111
+ aResultArr.push({
112
+ "groupTitle": sCurrGroupTitle,
113
+ "version": sCurrGroupTitle + " (" + iCounter + " versions)",
114
+ "nodes": aNodes,
115
+ "path": aNodes[0].path
116
+ });
117
+ }
132
118
 
133
- return aResultArr;
134
- },
135
-
136
- onInit : function () {
137
- BaseController.prototype.onInit.call(this);
138
-
139
- var oViewModel = new JSONModel({
140
- busy : false,
141
- delay : 0,
142
- bPhoneSize: false,
143
- bShowVersionSwitchInHeader: false,
144
- bShowVersionSwitchInMenu: false,
145
- bLandscape: Device.orientation.landscape,
146
- bHasMaster: false,
147
- bSearchMode: false,
148
- bHideTopicSection: !!window['sap-ui-documentation-hideTopicSection'],
149
- bHideApiSection: !!window['sap-ui-documentation-hideApiSection'],
150
- sAboutInfoSAPUI5: "Looking for the Demo Kit for a specific SAPUI5 version? " +
119
+ return aResultArr;
120
+ },
121
+
122
+ onInit: function () {
123
+ BaseController.prototype.onInit.call(this);
124
+
125
+ var oViewModel = new JSONModel({
126
+ busy: false,
127
+ delay: 0,
128
+ device: Device,
129
+ bPhoneSize: false,
130
+ bDesktopSize: false,
131
+ bShowVersionSwitchButton: false,
132
+ bDarkThemeActive: false,
133
+ bLandscape: Device.orientation.landscape,
134
+ bHasMaster: false,
135
+ bSearchMode: false,
136
+ bHideTopicSection: !!window['sap-ui-documentation-hideTopicSection'],
137
+ bHideApiSection: !!window['sap-ui-documentation-hideApiSection'],
138
+ sAboutInfoSAPUI5: "Looking for the Demo Kit for a specific SAPUI5 version? " +
151
139
  "Check at <a href = 'https://ui5.sap.com/versionoverview.html'>https://ui5.sap.com/versionoverview.html</a> " +
152
140
  "which versions are available. " +
153
141
  "You can view the version-specific Demo Kit by adding the version number to the URL, e.g. " +
154
142
  "<a href='https://ui5.sap.com/1.71.46/'>https://ui5.sap.com/1.71.46/</a>",
155
- sAboutInfoOpenUI5: "Looking for the Demo Kit for a specific OpenUI5 version? " +
143
+ sAboutInfoOpenUI5: "Looking for the Demo Kit for a specific OpenUI5 version? " +
156
144
  "Check at <a href = 'https://sdk.openui5.org/versionoverview.html'>https://sdk.openui5.org/versionoverview.html</a> " +
157
145
  "which versions are available. " +
158
146
  "You can view the version-specific Demo Kit by adding the version number to the URL, e.g. " +
159
147
  "<a href='https://sdk.openui5.org/1.71.46/'>https://sdk.openui5.org/1.71.46/</a>"
160
- });
161
-
162
- var oComponent = this.getOwnerComponent(),
163
- oController = this;
148
+ });
164
149
 
165
- ThemePicker.init(oController);
166
-
167
- this.MENU_LINKS_MAP = {
168
- "copyright": "https://www.sap.com/corporate/en/legal/copyright.html",
169
- "trademark": "https://www.sap.com/corporate/en/legal/trademark.html",
170
- "disclaimer": "https://help.sap.com/viewer/disclaimer",
171
- "sitemap": "sitemap"
172
- };
173
-
174
- jQuery.extend(this.MENU_LINKS_MAP, BaseController.LEGAL_LINKS);
175
-
176
- this.getOwnerComponent().loadVersionInfo().then(function () {
177
- var sProduct;
178
- if (this.getModel("versionData").getProperty("/isOpenUI5")) {
179
- sProduct = "OPENUI5";
180
- } else {
181
- sProduct = "SAPUI5";
182
- }
183
- MAIN_WEB_PAGE_TITLE = MAIN_WEB_PAGE_TITLE.replace("\uFFFD", sProduct);
184
- Object.keys(WEB_PAGE_TITLE).forEach(function(sKey) {
185
- WEB_PAGE_TITLE[sKey] = WEB_PAGE_TITLE[sKey].replace("\uFFFD", sProduct);
186
- });
187
-
188
- if (this._sKey) {
189
- this.appendPageTitle(null).appendPageTitle(WEB_PAGE_TITLE[this._sKey]);
190
- }
191
-
192
- }.bind(this));
150
+ var oComponent = this.getOwnerComponent(),
151
+ oController = this;
193
152
 
194
- this._oNewsModel = new JSONModel();
195
- this.setModel(this._oNewsModel, "news");
153
+ ThemePicker.init(oController);
196
154
 
197
- // Cache view reference
198
- this._oSupportedLangModel = new JSONModel();
199
-
200
- this.setModel(this._oSupportedLangModel, "supportedLanguages");
201
- this.setModel(new JSONModel(), "messagesData");
202
-
203
- this._oView = this.getView();
204
-
205
- this.setModel(oViewModel, "appView");
206
-
207
- this.oHeader = this._oView.byId("headerToolbar");
208
-
209
- this.oRouter = this.getRouter();
210
-
211
- this._aNeoAppVersions = [];
212
-
213
- this._selectHeader = this._oView.byId("selectHeader");
214
- this._tabHeader = this._oView.byId("tabHeader");
215
-
216
- this._oConfigUtil = this.getOwnerComponent().getConfigUtil();
217
- this._oCookieNames = this._oConfigUtil.COOKIE_NAMES;
218
- this._sLocalStorageNewsName = this._oConfigUtil.LOCAL_STORAGE_NAMES['OLD_NEWS_IDS'];
155
+ this.MENU_LINKS_MAP = {
156
+ "copyright": "https://www.sap.com/corporate/en/legal/copyright.html",
157
+ "trademark": "https://www.sap.com/corporate/en/legal/trademark.html",
158
+ "disclaimer": "https://help.sap.com/viewer/disclaimer",
159
+ "sitemap": "sitemap"
160
+ };
219
161
 
220
- NewsInfo.prepareNewsData(this._oConfigUtil);
162
+ jQuery.extend(this.MENU_LINKS_MAP, BaseController.LEGAL_LINKS);
221
163
 
222
- ResizeHandler.register(this.oHeader, this.onHeaderResize.bind(this));
223
- this.oRouter.attachRouteMatched(this.onRouteChange.bind(this));
224
- this.oRouter.attachBypassed(this.onRouteNotFound.bind(this));
164
+ this.getOwnerComponent().loadVersionInfo().then(function () {
165
+ var sProduct;
166
+ if (this.getModel("versionData").getProperty("/isOpenUI5")) {
167
+ sProduct = "OPENUI5";
168
+ } else {
169
+ sProduct = "SAPUI5";
170
+ }
171
+ MAIN_WEB_PAGE_TITLE = MAIN_WEB_PAGE_TITLE.replace("\uFFFD", sProduct);
172
+ Object.keys(WEB_PAGE_TITLE).forEach(function (sKey) {
173
+ WEB_PAGE_TITLE[sKey] = WEB_PAGE_TITLE[sKey].replace("\uFFFD", sProduct);
174
+ });
225
175
 
226
- // register Feedback rating icons
227
- this._registerFeedbackRatingIcons();
176
+ if (this._sKey) {
177
+ this.appendPageTitle(null).appendPageTitle(WEB_PAGE_TITLE[this._sKey]);
178
+ }
228
179
 
229
- this._requestVersionInfo();
180
+ }.bind(this));
230
181
 
231
- // attach to the afterMasterClose event of the splitApp to be able to toggle the hamburger button state on clicking anywhere
232
- this.byId("splitApp").attachEvent("afterMasterClose", function (oEvent) {
233
- oViewModel.setProperty("/bIsShownMaster", false);
234
- }, this);
182
+ // Config routes
183
+ this.oRouter = this.getRouter();
184
+ this.oRouter.attachRouteMatched(this.onRouteChange.bind(this));
185
+ this.oRouter.attachBypassed(this.onRouteNotFound.bind(this));
235
186
 
236
- this.bus = Core.getEventBus();
237
- this.bus.subscribe("newsChanged", "onDemoKitNewsChanged", this._syncNewsModelWithNewsInfo, this);
187
+ // Store product version information
188
+ this._aNeoAppVersions = [];
238
189
 
239
- this._createConfigurationBasedOnURIInput();
190
+ // Set app view models
191
+ this._oView = this.getView();
192
+ this.setModel(oViewModel, "appView");
240
193
 
241
- this.getOwnerComponent().loadMessagesInfo().then(function (data) {
242
- if (data) {
243
- this._updateMessagesModel(data);
244
- }
194
+ this._oNewsModel = new JSONModel();
195
+ this.setModel(this._oNewsModel, "news");
245
196
 
246
- }.bind(this));
197
+ this._oSupportedLangModel = new JSONModel();
198
+ this.setModel(this._oSupportedLangModel, "supportedLanguages");
247
199
 
248
- if (this._oConfigUtil.getCookieValue(this._oCookieNames.ALLOW_REQUIRED_COOKIES) === "1" && this._aConfiguration.length > 0) {
249
- this._applyCookiesConfiguration(this._aConfiguration);
250
- } else {
251
- this._applyDefaultConfiguration(this._aConfiguration);
252
- }
200
+ this.setModel(new JSONModel(), "messagesData");
253
201
 
254
- this.initSearch();
202
+ // Store references of the control tree
203
+ this._demoKitPage = this.byId("demoKitPage");
204
+ this._demoKitSubHeader = this.byId("demoKitSubHeader");
205
+ this._demoKitSideNavigation = this.byId("demoKitSideNavigation");
206
+ this._demoKitSplitApp = this.byId("splitApp");
255
207
 
256
- // open global search when ctrl + alt + F keys are pressed.
257
- document.addEventListener("keydown", function(event) {
258
- if (event.keyCode === KeyCodes.F && event.shiftKey && event.ctrlKey ) {
259
- this.byId("searchControl")._toggleOpen(true);
260
- }
261
- }.bind(this));
208
+ // Adjust focus handling for the detail nav container
209
+ // (the default behavior would be to focus the first focusable element)
210
+ // Which in our case is the footer links fragment which causes the page to scroll down on mobile devices
211
+ this._demoKitSplitApp._oDetailNav.setAutoFocus(false);
262
212
 
263
- oComponent.getCookiesManagement().then(function(oCookieMgmtComponent) {
264
- oCookieMgmtComponent.enable(oComponent.getRootControl());
265
- });
213
+ // attach to the afterMasterClose event of the splitApp to be able to toggle the button state on clicking anywhere
214
+ this._demoKitSplitApp.attachEvent("afterMasterClose", function (oEvent) {
215
+ oViewModel.setProperty("/bIsShownMaster", false);
216
+ }, this);
266
217
 
267
- this.setSurveyModelData();
268
- },
218
+ // Init version info
219
+ this._requestVersionInfo();
220
+ // Init search
221
+ this.initSearch();
222
+ // Since the searchfield is open by default on desktop devices, we need to load the search index
223
+ SearchUtil.init();
269
224
 
270
- _updateMessagesModel: function(oMessagesData) {
271
- var oMessageCookie = this._oConfigUtil.getCookieValue(this._oCookieNames["DEMOKIT_IMPORTANT_MESSAGES_READ"]),
272
- iVisibleMessagesCount = 0;
225
+ // Init survey
226
+ this.setSurveyModelData();
273
227
 
274
- oMessagesData.messages.length && oMessagesData.messages.forEach(function(message) {
275
- message.isMessageVisible = (new Date(message.expire).getTime() - new Date()) > 0 &&
276
- !oMessageCookie.includes(message.id);
277
- message.isMessageVisible && iVisibleMessagesCount++;
278
- });
228
+ // Subscribe to events
229
+ this.bus = Core.getEventBus();
230
+ this.bus.subscribe("newsChanged", "onDemoKitNewsChanged", this._syncNewsModelWithNewsInfo, this);
231
+ this.bus.subscribe("themeChanged", "onThemeChanged", this._onThemeChanged, this);
279
232
 
280
- oMessagesData.iVisibleMessagesCount = iVisibleMessagesCount;
233
+ // Init cookie settings
234
+ this._oConfigUtil = this.getOwnerComponent().getConfigUtil();
235
+ this._oCookieNames = this._oConfigUtil.COOKIE_NAMES;
236
+ this._sLocalStorageNewsName = this._oConfigUtil.LOCAL_STORAGE_NAMES['OLD_NEWS_IDS'];
281
237
 
282
- this.getModel("messagesData").setData(oMessagesData);
238
+ NewsInfo.prepareNewsData(this._oConfigUtil);
283
239
 
284
- },
240
+ this._createConfigurationBasedOnURIInput();
285
241
 
286
- onBeforeRendering: function() {
287
- Device.orientation.detachHandler(this._onOrientationChange, this);
288
- },
242
+ if (this._oConfigUtil.getCookieValue(this._oCookieNames.ALLOW_REQUIRED_COOKIES) === "1" && this._aConfiguration.length > 0) {
243
+ this._applyCookiesConfiguration(this._aConfiguration);
244
+ } else {
245
+ this._applyDefaultConfiguration(this._aConfiguration);
246
+ }
289
247
 
290
- onAfterRendering: function() {
291
- // apply content density mode to the body tag
292
- // in order to get the controls in the static area styled correctly,
293
- // such as Dialog and Popover.
294
- jQuery(document.body).addClass(this.getOwnerComponent().getContentDensityClass());
248
+ oComponent.getCookiesManagement().then(function (oCookieMgmtComponent) {
249
+ oCookieMgmtComponent.enable(oComponent.getRootControl());
250
+ });
295
251
 
296
- Device.orientation.attachHandler(this._onOrientationChange, this);
252
+ // Handle page resize
253
+ ResizeHandler.register(this._demoKitPage, this.onPageResize.bind(this));
254
+ },
297
255
 
298
- this._syncNewsModelWithNewsInfo();
299
- },
256
+ onBeforeRendering: function () {
257
+ Device.orientation.detachHandler(this._onOrientationChange, this);
258
+ },
300
259
 
301
- onExit: function() {
302
- Device.orientation.detachHandler(this._onOrientationChange, this);
303
- if (this.highlighter) {
304
- this.highlighter.destroy();
305
- }
306
- },
260
+ onAfterRendering: function () {
261
+ // apply content density mode to the body tag
262
+ // in order to get the controls in the static area styled correctly,
263
+ // such as Dialog and Popover.
264
+ jQuery(document.body).addClass(this.getOwnerComponent().getContentDensityClass());
307
265
 
308
- onRouteChange: function (oEvent) {
266
+ Device.orientation.attachHandler(this._onOrientationChange, this);
309
267
 
310
- if (!this.oRouter.getRoute(oEvent.getParameter("name"))._oConfig.target) {
311
- return;
312
- }
268
+ this._syncNewsModelWithNewsInfo();
313
269
 
314
- var sRouteName = oEvent.getParameter("name"),
315
- sTabId = this.oRouter.getRoute(sRouteName)._oConfig.target[0] + "Tab",
316
- oTabToSelect = this._oView.byId(sTabId),
317
- sKey = oTabToSelect ? oTabToSelect.getKey() : "home",
318
- oViewModel = this.getModel("appView"),
319
- bPhoneSize = oViewModel.getProperty("/bPhoneSize"),
320
- bSearchMode = oViewModel.getProperty("/bSearchMode"),
321
- bPhone = Device.system.phone,
322
- bHasMaster = this.getOwnerComponent().getConfigUtil().hasMasterView(sRouteName),
323
- oMasterView,
324
- sMasterViewId;
270
+ // Adds additional class in order to manipulate the version switch button content in the header
271
+ this._adjustVersionSwitchButton();
272
+ },
325
273
 
326
- this._setHeaderSelectedKey(sKey);
274
+ onExit: function () {
275
+ Device.orientation.detachHandler(this._onOrientationChange, this);
327
276
 
328
- oViewModel.setProperty("/bHasMaster", bHasMaster);
277
+ if (this.highlighter) {
278
+ this.highlighter.destroy();
279
+ }
280
+ },
329
281
 
330
- if (bPhoneSize && !bSearchMode) {
331
- this._selectHeader.setVisible(true);
332
- }
282
+ onRouteChange: function (oEvent) {
283
+ if (!this.oRouter.getRoute(oEvent.getParameter("name"))._oConfig.target) {
284
+ return;
285
+ }
333
286
 
334
- if (bPhone && bHasMaster) { // on phone we need the id of the master view (for navigation)
335
- oMasterView = this.getOwnerComponent().getConfigUtil().getMasterView(sRouteName);
336
- sMasterViewId = oMasterView && oMasterView.getId();
337
- oViewModel.setProperty("/sMasterViewId", sMasterViewId);
338
- }
287
+ var oMasterView,
288
+ sMasterViewId,
289
+ bPhone = Device.system.phone,
290
+ sRouteName = oEvent.getParameter("name"),
291
+ sTabId = this.oRouter.getRoute(sRouteName)._oConfig.target[0] + "Tab",
292
+ oTabToSelect = this._oView.byId(sTabId),
293
+ sKey = oTabToSelect ? oTabToSelect.getKey() : "home",
294
+ oViewModel = this.getModel("appView"),
295
+ bHasMaster = this.getOwnerComponent().getConfigUtil().hasMasterView(sRouteName);
339
296
 
340
- // hide master on route change
341
- this.byId("splitApp").hideMaster();
342
- oViewModel.setProperty("/bIsShownMaster", false);
343
- this.appendPageTitle(null).appendPageTitle(WEB_PAGE_TITLE[sKey]);
344
- },
345
-
346
- toggleMaster: function(oEvent) {
347
- var bPressed = oEvent.getParameter("pressed"),
348
- bPhone = Device.system.phone,
349
- oSplitApp = this.byId("splitApp"),
350
- isShowHideMode = oSplitApp.getMode() === SplitAppMode.ShowHideMode,
351
- isHideMode = oSplitApp.getMode() === SplitAppMode.HideMode,
352
- sMasterViewId = this.getModel("appView").getProperty("/sMasterViewId"),
353
- fnToggle;
354
-
355
- if (!bPhone && (isShowHideMode || isHideMode)) {
356
- fnToggle = (bPressed) ? oSplitApp.showMaster : oSplitApp.hideMaster;
357
- fnToggle.call(oSplitApp);
358
- return;
359
- }
297
+ this._setHeaderSelectedKey(sKey);
298
+ this._setSelectedSectionTitle(sKey);
360
299
 
361
- /* on phone there is no master-detail pair, but a single navContainer => so navigate within this navContainer: */
362
- if (bPhone) {
363
- if (bPressed) {
364
- oSplitApp.to(sMasterViewId);
365
- } else {
366
- oSplitApp.backDetail();
367
- }
368
- }
369
- },
300
+ oViewModel.setProperty("/bHasMaster", bHasMaster);
370
301
 
371
- navigateToSection : function (oEvent) {
372
- var sKey = oEvent.getParameter("key"),
373
- oItem;
302
+ if (bPhone && bHasMaster) { // on phone we need the id of the master view (for navigation)
303
+ oMasterView = this.getOwnerComponent().getConfigUtil().getMasterView(sRouteName);
304
+ sMasterViewId = oMasterView && oMasterView.getId();
305
+ oViewModel.setProperty("/sMasterViewId", sMasterViewId);
306
+ }
374
307
 
375
- if (!sKey) {
376
- oItem = oEvent.getParameter("selectedItem");
377
- oItem && (sKey = oItem.getKey());
378
- }
308
+ // hide master on route change
309
+ this._demoKitSplitApp.hideMaster();
310
+ oViewModel.setProperty("/bIsShownMaster", false);
311
+ this.appendPageTitle(null).appendPageTitle(WEB_PAGE_TITLE[sKey]);
312
+ },
313
+
314
+ toggleMaster: function (oEvent) {
315
+ var oViewModel = this.getModel("appView"),
316
+ sMasterViewId = oViewModel.getProperty("/sMasterViewId"),
317
+ isShowHideMode = this._demoKitSplitApp.getMode() === SplitAppMode.ShowHideMode,
318
+ isHideMode = this._demoKitSplitApp.getMode() === SplitAppMode.HideMode,
319
+ bPhone = Device.system.phone,
320
+ bPressed = oEvent.getParameter("pressed"),
321
+ fnToggle;
322
+
323
+ if (!bPhone && (isShowHideMode || isHideMode)) {
324
+ fnToggle = (bPressed) ? this._demoKitSplitApp.showMaster : this._demoKitSplitApp.hideMaster;
325
+ fnToggle.call(this._demoKitSplitApp);
326
+ return;
327
+ }
379
328
 
380
- oEvent.preventDefault();
381
- if (sKey && sKey !== "home") {
382
- this.getRouter().navTo(sKey, {});
329
+ // on phone there is no master-detail pair, but a single navContainer => so navigate within this navContainer
330
+ if (bPhone) {
331
+ if (bPressed) {
332
+ this._demoKitSplitApp.to(sMasterViewId);
383
333
  } else {
384
- this.getRouter().navTo("welcome", {});
385
-
386
- this._setHeaderSelectedKey("home");
334
+ this._demoKitSplitApp.backDetail();
387
335
  }
388
- },
336
+ }
337
+ },
338
+
339
+ /**
340
+ * This function handles the navigation logic for different sections,
341
+ * including handling special cases for specific keys and devices.
342
+ *
343
+ * @param {Object} oEvent - The event object.
344
+ * @returns {void}
345
+ */
346
+ navigateToSection: function (oEvent) {
347
+ var sKey = oEvent.getParameter("key") || oEvent.getParameter("item").getKey(),
348
+ bEventFiredFromSideNavigation = oEvent.getSource().isA("sap.tnt.SideNavigation");
349
+
350
+ if (this._getHeaderSubMenuItemKeys().includes(sKey)) {
351
+ this._headerItemSelectHandler(sKey);
352
+ return; // stay on the same page
353
+ }
354
+
355
+ // close the side navigation on phone devices
356
+ if (Device.system.phone && bEventFiredFromSideNavigation) {
357
+ this.onSideNavigationButtonPress();
358
+ }
389
359
 
390
- navigateToNews: function() {
391
- this.getRouter().navTo("news");
392
- },
360
+ if (sKey && sKey !== "home") {
361
+ this.getRouter().navTo(sKey, {});
362
+ } else {
363
+ this.getRouter().navTo("welcome", {});
364
+ this._setHeaderSelectedKey("home");
365
+ }
366
+ },
393
367
 
394
- handleNewsPress: function (oEvent) {
395
- var oButton = oEvent.getSource(),
396
- oView = this.getView();
368
+ navigateToNews: function () {
369
+ this.getRouter().navTo("news");
370
+ },
397
371
 
398
- if (this._oNewsModel.getProperty("/newsCount") === 0) {
399
- this.navigateToNews();
400
- } else if (!this._oNewsPopover) {
401
- Fragment.load({
402
- name: "sap.ui.documentation.sdk.view.NewsPopover",
403
- controller: this
404
- }).then(function(oPopover) {
405
- oView.addDependent(oPopover);
406
- this._oNewsPopover = oPopover;
407
- this._oNewsPopover.openBy(oButton);
408
- }.bind(this));
409
- } else {
410
- this._oNewsPopover.openBy(oButton);
411
- }
412
- },
372
+ onNewsButtonPress: function (oEvent) {
373
+ var oButton = oEvent.getSource(),
374
+ oView = this.getView();
413
375
 
414
- handleShowAllPress: function () {
415
- this._oNewsPopover.close();
376
+ if (this._oNewsModel.getProperty("/newsCount") === 0) {
416
377
  this.navigateToNews();
417
- },
378
+ } else if (!this._oNewsPopover) {
379
+ Fragment.load({
380
+ name: "sap.ui.documentation.sdk.view.NewsPopover",
381
+ controller: this
382
+ }).then(function (oPopover) {
383
+ oView.addDependent(oPopover);
384
+ this._oNewsPopover = oPopover;
385
+ this._oNewsPopover.openBy(oButton);
386
+ }.bind(this));
387
+ } else {
388
+ this._oNewsPopover.openBy(oButton);
389
+ }
390
+ },
391
+
392
+ handleShowAllPress: function () {
393
+ this._oNewsPopover.close();
394
+ this.navigateToNews();
395
+ },
396
+
397
+ handleDismissAllPress: function () {
398
+ NewsInfo.moveAllNewItemsToOld();
399
+ },
400
+
401
+ handleNewsItemClose: function (oEvent) {
402
+ var oItem = oEvent.getSource(),
403
+ iItemCustomId = oItem.getCustomData()[0].getValue(),
404
+ oItemInfoInItemsProperty = this._oNewsModel.getProperty("/items").find(function (oItem) {
405
+ return oItem.id === iItemCustomId;
406
+ });
418
407
 
419
- handleDismissAllPress: function () {
420
- NewsInfo.moveAllNewItemsToOld();
421
- },
408
+ NewsInfo.moveNewItemToOld(oItemInfoInItemsProperty);
409
+ },
422
410
 
423
- handleNewsItemClose: function (oEvent) {
424
- var oItem = oEvent.getSource(),
425
- iItemCustomId = oItem.getCustomData()[0].getValue(),
426
- oItemInfoInItemsProperty = this._oNewsModel.getProperty("/items").find(function(oItem){
427
- return oItem.id === iItemCustomId;
428
- });
411
+ handleVisitNewsLink: function (oEvent) {
412
+ var oItem = oEvent.getSource(),
413
+ sItemLink = oItem.getCustomData()[0].getValue();
429
414
 
430
- NewsInfo.moveNewItemToOld(oItemInfoInItemsProperty);
431
- },
415
+ URLHelper.redirect(sItemLink, true);
416
+ },
432
417
 
433
- handleVisitNewsLink: function(oEvent) {
434
- var oItem = oEvent.getSource(),
435
- sItemLink = oItem.getCustomData()[0].getValue();
418
+ _syncNewsModelWithNewsInfo: function () {
419
+ var aNewsInfoCopy,
420
+ sPreparationFailureMessage = NewsInfo.getPreparationFailureMessage();
436
421
 
437
- URLHelper.redirect(sItemLink, true);
438
- },
422
+ if (!sPreparationFailureMessage) {
423
+ aNewsInfoCopy = NewsInfo.getNewNewsArray().slice();
424
+ this._oNewsModel.setProperty("/items", aNewsInfoCopy);
425
+ this._oNewsModel.setProperty("/newsCount", aNewsInfoCopy.length);
426
+ }
439
427
 
440
- _syncNewsModelWithNewsInfo: function() {
441
- var aNewsInfoCopy,
442
- sPreparationFailureMessage = NewsInfo.getPreparationFailureMessage();
428
+ this._oNewsModel.setProperty("/newsPreparationFailureMessage", sPreparationFailureMessage);
429
+ },
443
430
 
444
- if (!sPreparationFailureMessage) {
445
- aNewsInfoCopy = NewsInfo.getNewNewsArray().slice();
446
- this._oNewsModel.setProperty("/items", aNewsInfoCopy);
447
- this._oNewsModel.setProperty("/newsCount", aNewsInfoCopy.length);
448
- }
431
+ onMenuButtonItemSelected: function (oEvent) {
432
+ var sTargetText = oEvent.getParameter("item").getKey(),
433
+ sTarget = this.MENU_LINKS_MAP[sTargetText];
449
434
 
450
- this._oNewsModel.setProperty("/newsPreparationFailureMessage", sPreparationFailureMessage);
451
- },
452
-
453
- handleMenuItemClick: function (oEvent) {
454
- var sTargetText = oEvent.getParameter("item").getKey(),
455
- sTarget = this.MENU_LINKS_MAP[sTargetText];
456
-
457
- if (sTargetText === ABOUT_TEXT) {
458
- this.aboutDialogOpen();
459
- } else if (sTargetText === FEEDBACK_TEXT) {
460
- this.feedbackDialogOpen();
461
- } else if (sTargetText === CHANGE_SETTINGS_TEXT) {
462
- this.settingsDialogOpen();
463
- } else if (sTargetText === CHANGE_COOKIE_PREFERENCES_TEXT) {
464
- this.getOwnerComponent().getCookiesManagement().then(function(oCookieMgmtComponent) {
465
- oCookieMgmtComponent.cookieSettingsDialogOpen({ showCookieDetails: true }, this.getView());
466
- }.bind(this));
467
- } else if (sTargetText === CHANGE_VERSION_TEXT) {
468
- this.onChangeVersionButtonPress();
469
- } else if (ThemePicker._getTheme()[sTargetText]) {
470
- this._updateAppearance(sTargetText);
471
- } else if (sTarget === SITEMAP) {
472
- this.onSiteMapPress();
473
- } else if (sTarget) {
474
- URLHelper.redirect(sTarget, true);
475
- }
476
- this.sTarget = sTarget;
477
- },
435
+ if (sTargetText === ABOUT_TEXT) {
436
+ this.aboutDialogOpen();
437
+ } else if (sTargetText === CHANGE_SETTINGS_TEXT) {
438
+ this.settingsDialogOpen();
439
+ } else if (sTargetText === CHANGE_COOKIE_PREFERENCES_TEXT) {
440
+ this.getOwnerComponent().getCookiesManagement().then(function (oCookieMgmtComponent) {
441
+ oCookieMgmtComponent.cookieSettingsDialogOpen({ showCookieDetails: true }, this.getView());
442
+ }.bind(this));
443
+ } else if (sTargetText === CHANGE_VERSION_TEXT) {
444
+ this.onChangeVersionButtonPress();
445
+ } else if (ThemePicker._getTheme()[sTargetText]) {
446
+ this._updateAppearance(sTargetText);
447
+ } else if (sTarget === SITEMAP) {
448
+ this.onSiteMapPress();
449
+ } else if (sTarget) {
450
+ URLHelper.redirect(sTarget, true);
451
+ }
452
+ this.sTarget = sTarget;
453
+ },
478
454
 
479
- createSearchPopover: function() {
480
- var PlacementType = mobileLibrary.PlacementType,
481
- searchInput = this.getView().byId("searchControl"),
482
- oPopover = new ResponsivePopover({
455
+ createSearchPopover: function () {
456
+ var PlacementType = mobileLibrary.PlacementType,
457
+ searchInput = this.getView().byId("searchControl"),
458
+ oPopover = new ResponsivePopover({
483
459
  showArrow: false,
484
460
  showHeader: false,
485
461
  contentWidth: "600px",
486
462
  placement: PlacementType.Vertical,
487
463
  horizontalScrolling: false,
488
464
  initialFocus: this.getView().byId("searchControl-searchField")
489
- })
490
- .addStyleClass("sapMSltPicker-CTX");
465
+ }).addStyleClass("sapMSltPicker-CTX");
491
466
 
492
- // implement the same <code>open</code> function as in the dialog
493
- // to allow the controller open the search picker regardless its type (popover or dialog)
494
- oPopover.open = function() {
495
- oPopover.openBy(searchInput);
496
- };
467
+ // implement the same <code>open</code> function as in the dialog
468
+ // to allow the controller open the search picker regardless its type (popover or dialog)
469
+ oPopover.open = function () {
470
+ oPopover.openBy(searchInput);
471
+ };
497
472
 
498
- this.getView().addDependent(oPopover);
473
+ this.getView().addDependent(oPopover);
474
+
475
+ return oPopover;
476
+ },
477
+
478
+ createSearchPicker: function () {
479
+ var oPicker = Device.system.phone ? this.createSearchDialog() : this.createSearchPopover();
480
+ this.createSearchPickerContent().then(function (oContent) {
481
+ oPicker.addContent(oContent);
482
+ });
483
+ return oPicker;
484
+ },
485
+
486
+ createSearchDialog: function () {
487
+ var dialog,
488
+ originalValue,
489
+ dialogSearchField,
490
+ customHeader,
491
+ okButton,
492
+ closeButton,
493
+ bSearchRequested;
494
+
495
+ var oInput = this.getView().byId("searchControl");
496
+
497
+ // Helper functions
498
+ function handleDialogButtonPress() {
499
+ var sCurrentSearchValue = oInput.getValue();
500
+
501
+ if (sCurrentSearchValue !== originalValue) {
502
+ oInput._updateValue(sCurrentSearchValue);
503
+ oInput.fireLiveChange({ newValue: sCurrentSearchValue });
504
+ } else {
505
+ oInput.fireLiveChange({ newValue: originalValue });
506
+ }
499
507
 
500
- return oPopover;
501
- },
508
+ dialog.close();
509
+ oInput._toggleOpen(false);
510
+ }
502
511
 
503
- createSearchPicker: function() {
504
- var oPicker = Device.system.phone ? this.createSearchDialog() : this.createSearchPopover();
505
- this.createSearchPickerContent().then(function(oContent) {
506
- oPicker.addContent(oContent);
507
- });
508
- return oPicker;
509
- },
510
-
511
- createSearchDialog: function () {
512
- var dialog,
513
- originalValue,
514
- dialogSearchField,
515
- customHeader,
516
- okButton,
517
- closeButton,
518
- bSearchRequested;
519
-
520
- var oInput = this.getView().byId("searchControl");
521
-
522
- // use sap.ui.require to avoid circular dependency between the SearchField and Suggest
523
- dialogSearchField = new (sap.ui.require('sap/m/SearchField'))({
524
- liveChange : function (oEvent) {
525
- var value = oEvent.getParameter("newValue");
526
- oInput._updateValue(value);
527
- oInput.fireLiveChange({newValue: value});
528
- },
529
- search : function (oEvent) {
530
- if (!oEvent.getParameter("clearButtonPressed")) {
531
- dialog.close();
532
- bSearchRequested = true;
533
- }
534
- }
535
- });
512
+ function moveCursorToEnd(el) {
513
+ if (typeof el.selectionStart == "number") {
514
+ el.selectionStart = el.selectionEnd = el.value.length;
515
+ } else if (typeof el.createTextRange != "undefined") {
516
+ el.focus();
517
+ var range = el.createTextRange();
518
+ range.collapse(false);
519
+ range.select();
520
+ }
521
+ }
536
522
 
537
- closeButton = new Button({
538
- icon : "sap-icon://decline",
539
- press : function() {
540
- dialog._oCloseTrigger = true;
523
+ // use sap.ui.require to avoid circular dependency between the SearchField and Suggest
524
+ dialogSearchField = new (sap.ui.require('sap/m/SearchField'))({
525
+ liveChange: function (oEvent) {
526
+ var value = oEvent.getParameter("newValue");
527
+ oInput._updateValue(value);
528
+ oInput.fireLiveChange({ newValue: value });
529
+ },
530
+ search: function (oEvent) {
531
+ if (!oEvent.getParameter("clearButtonPressed")) {
541
532
  dialog.close();
542
- oInput._updateValue(originalValue);
533
+ bSearchRequested = true;
543
534
  }
544
- });
535
+ }
536
+ });
545
537
 
546
- customHeader = new Toolbar({
547
- content: [dialogSearchField, closeButton]
548
- });
538
+ closeButton = new Button({
539
+ icon: "sap-icon://decline",
540
+ press: function () {
541
+ handleDialogButtonPress();
542
+ }
543
+ });
549
544
 
550
- okButton = new Button({
551
- text : Core.getLibraryResourceBundle("sap.m").getText("MSGBOX_OK"),
552
- press : function() {
553
- dialog.close();
554
- }
555
- });
545
+ customHeader = new Toolbar({
546
+ content: [dialogSearchField, closeButton]
547
+ });
556
548
 
557
- function moveCursorToEnd(el) {
558
- if (typeof el.selectionStart == "number") {
559
- el.selectionStart = el.selectionEnd = el.value.length;
560
- } else if (typeof el.createTextRange != "undefined") {
561
- el.focus();
562
- var range = el.createTextRange();
563
- range.collapse(false);
564
- range.select();
565
- }
549
+ okButton = new Button({
550
+ text: Core.getLibraryResourceBundle("sap.m").getText("MSGBOX_OK"),
551
+ press: function () {
552
+ handleDialogButtonPress();
566
553
  }
567
-
568
- dialog = new (sap.ui.require('sap/m/Dialog'))({
569
- stretch: true,
570
- customHeader: customHeader,
571
- beginButton : okButton,
572
- beforeClose: function () {
573
- oInput._bSuggestionSuppressed = true;
574
- },
575
- beforeOpen: function() {
576
- originalValue = oInput.getValue();
577
- dialogSearchField._updateValue(originalValue);
578
- bSearchRequested = false; // reset flag
579
- },
580
- afterOpen: function() {
581
- var $input = dialogSearchField.$().find('input');
582
- $input.trigger("focus");
583
- moveCursorToEnd($input.get(0));
584
- },
585
- afterClose: function(oEvent) {
586
- if (bSearchRequested) { // fire the search event if not cancelled
587
- oInput.fireSearch({
588
- query: oInput.getValue(),
589
- clearButtonPressed: false
590
- });
591
- }
554
+ });
555
+
556
+ dialog = new (sap.ui.require('sap/m/Dialog'))({
557
+ stretch: true,
558
+ customHeader: customHeader,
559
+ beginButton: okButton,
560
+ beforeClose: function () {
561
+ oInput._bSuggestionSuppressed = true;
562
+ },
563
+ beforeOpen: function () {
564
+ originalValue = oInput.getValue();
565
+ dialogSearchField._updateValue(originalValue);
566
+ bSearchRequested = false; // reset flag
567
+ },
568
+ afterOpen: function () {
569
+ var $input = dialogSearchField.$().find('input');
570
+ $input.trigger("focus");
571
+ moveCursorToEnd($input.get(0));
572
+ },
573
+ afterClose: function (oEvent) {
574
+ if (bSearchRequested) { // fire the search event if not cancelled
575
+ oInput.fireSearch({
576
+ query: oInput.getValue(),
577
+ clearButtonPressed: false
578
+ });
592
579
  }
593
- });
594
580
 
595
- this.getView().addDependent(dialog);
581
+ oInput._toggleOpen(false);
582
+ }
583
+ });
596
584
 
597
- return dialog;
598
- },
585
+ this.getView().addDependent(dialog);
599
586
 
600
- openSearchPicker: function() {
601
- if (!this.oPicker) {
602
- this.oPicker = this.createSearchPicker();
603
- }
587
+ return dialog;
588
+ },
604
589
 
605
- if (!this.oPicker.isOpen()) {
606
- this.oPicker.open();
607
- }
608
- },
590
+ openSearchPicker: function () {
591
+ if (!this.oPicker) {
592
+ this.oPicker = this.createSearchPicker();
593
+ }
609
594
 
610
- createSearchPickerContent: function() {
611
- return Fragment.load({
612
- name: "sap.ui.documentation.sdk.view.GlobalSearchPicker",
613
- controller: this
614
- }).then(function(oContent) {
615
-
616
- var oShortList = Core.byId("shortList"),
617
- oController = this,
618
- sSearchQuery;
619
-
620
- oShortList.addEventDelegate({
621
- onAfterRendering: function() {
622
- var oConfig = {
623
- useExternalStyles: false,
624
- shouldBeObserved: true,
625
- isCaseSensitive: false
626
- };
627
-
628
- oController.highlighter = new Highlighter(oShortList.getDomRef(), oConfig);
629
- sSearchQuery = oController.getModel("searchData").getProperty("/query");
630
- sSearchQuery && oController.highlighter.highlight(sSearchQuery);
631
- oShortList.removeEventDelegate(this);
632
- }
633
- });
595
+ if (!this.oPicker.isOpen()) {
596
+ this.oPicker.open();
597
+ }
598
+ },
599
+
600
+ createSearchPickerContent: function () {
601
+ return Fragment.load({
602
+ name: "sap.ui.documentation.sdk.view.GlobalSearchPicker",
603
+ controller: this
604
+ }).then(function (oContent) {
605
+
606
+ var oShortList = Core.byId("shortList"),
607
+ oController = this,
608
+ sSearchQuery;
609
+
610
+ oShortList.addEventDelegate({
611
+ onAfterRendering: function () {
612
+ var oConfig = {
613
+ useExternalStyles: false,
614
+ shouldBeObserved: true,
615
+ isCaseSensitive: false
616
+ };
617
+
618
+ oController.highlighter = new Highlighter(oShortList.getDomRef(), oConfig);
619
+ sSearchQuery = oController.getModel("searchData").getProperty("/query");
620
+ sSearchQuery && oController.highlighter.highlight(sSearchQuery);
621
+ oShortList.removeEventDelegate(this);
622
+ }
623
+ });
634
624
 
635
- return oContent;
636
- }.bind(this));
637
- },
625
+ return oContent;
626
+ }.bind(this));
627
+ },
638
628
 
639
- initSearch: function() {
640
- // set the search data to custom search`s suggestions
641
- var oModel = this.getModel("searchData"),
629
+ initSearch: function () {
630
+ // set the search data to custom search`s suggestions
631
+ var oModel = this.getModel("searchData"),
642
632
  oSectionToRoutesMap = {
643
633
  "topics": ["topic", "topicId", "subTopicId"],
644
634
  "entity": ["sample", "controlsMaster", "controls", "code", "entity"],
645
635
  "apiref": ["api", "apiSpecialRoute", "apiId"]
646
636
  };
647
637
 
648
- // update current section on navigate
649
- this.oRouter.attachRouteMatched(function() {
650
- oModel.setProperty("/preferencedCategory", null);
651
- });
652
- Object.keys(oSectionToRoutesMap).forEach(function(sSectionKey) {
653
- var aRoutes = oSectionToRoutesMap[sSectionKey];
654
- aRoutes.forEach(function(sRoute) {
655
- this.oRouter.getRoute(sRoute).attachPatternMatched(function() {
656
- oModel.setProperty("/preferencedCategory", sSectionKey);
657
- });
658
- }.bind(this));
638
+ // update current section on navigate
639
+ this.oRouter.attachRouteMatched(function () {
640
+ oModel.setProperty("/preferencedCategory", null);
641
+ });
642
+
643
+ Object.keys(oSectionToRoutesMap).forEach(function (sSectionKey) {
644
+ var aRoutes = oSectionToRoutesMap[sSectionKey];
645
+ aRoutes.forEach(function (sRoute) {
646
+ this.oRouter.getRoute(sRoute).attachPatternMatched(function () {
647
+ oModel.setProperty("/preferencedCategory", sSectionKey);
648
+ });
659
649
  }.bind(this));
660
- },
650
+ }.bind(this));
651
+ },
661
652
 
662
- getSearchPickerTitle: function(oContext) {
663
- var getMessageBundle = Core.getLibraryResourceBundle("sap.ui.documentation"),
653
+ getSearchPickerTitle: function (oContext) {
654
+ var getMessageBundle = Core.getLibraryResourceBundle("sap.ui.documentation"),
664
655
  sTitle;
665
656
 
666
- switch (this.getModel("searchData").getProperty("/preferencedCategory")) {
667
- case "topics":
668
- sTitle = getMessageBundle.getText("SEARCH_SUGGESTIONS_TITLE_DOCUMENTATION");
669
- break;
670
- case "apiref":
671
- sTitle = getMessageBundle.getText("SEARCH_SUGGESTIONS_TITLE_API_REFERENCE");
672
- break;
673
- case "entity":
674
- sTitle = getMessageBundle.getText("SEARCH_SUGGESTIONS_TITLE_SAMPLES");
675
- break;
676
- default:
677
- sTitle = getMessageBundle.getText("SEARCH_SUGGESTIONS_TITLE_ALL");
678
- }
657
+ switch (this.getModel("searchData").getProperty("/preferencedCategory")) {
658
+ case "topics":
659
+ sTitle = getMessageBundle.getText("SEARCH_SUGGESTIONS_TITLE_DOCUMENTATION");
660
+ break;
661
+ case "apiref":
662
+ sTitle = getMessageBundle.getText("SEARCH_SUGGESTIONS_TITLE_API_REFERENCE");
663
+ break;
664
+ case "entity":
665
+ sTitle = getMessageBundle.getText("SEARCH_SUGGESTIONS_TITLE_SAMPLES");
666
+ break;
667
+ default:
668
+ sTitle = getMessageBundle.getText("SEARCH_SUGGESTIONS_TITLE_ALL");
669
+ }
679
670
 
680
- return sTitle;
681
- },
671
+ return sTitle;
672
+ },
682
673
 
683
- formatSuggestionTitle: function(sTitle, sSummary) {
684
- var sFormatted = sTitle || "";
685
- if (sSummary) {
686
- sFormatted += ": " + sSummary;
687
- }
688
- return sFormatted;
689
- },
690
-
691
- onSearchResultsSummaryPress: function(oEvent) {
692
- var sCategory = oEvent.oSource.data("category");
693
- this.navToSearchResults(sCategory);
694
- },
695
-
696
- onSearchPickerItemPress: function(oEvent) {
697
- var contextPath = oEvent.oSource.getBindingContextPath(),
698
- oDataItem = this.getModel("searchData").getProperty(contextPath);
699
- if (oDataItem.external) {
700
- openWindow(new URL(oDataItem.path, document.baseURI).href);
701
- } else {
702
- this.getRouter().parsePath(oDataItem.path);
703
- }
704
- this.oPicker.close();
705
- },
706
-
707
- /**
708
- * Updates the appearance of the Demo Kit depending of the incoming appearance keyword.
709
- * If the keyword is "auto" the appearance will be updated to light or dark depending on the
710
- * user's OS settings.
711
- * @param {string} sKey the appearance keyword
712
- * @param {object} oComponent the component where the theme will be changed
713
- * @private
714
- */
715
- _updateAppearance: function(sKey) {
716
- var oComponent = this;
717
- ThemePicker._updateAppearance(sKey, oComponent);
718
- },
719
- /**
720
- * Creates configuration for the application regarding the URI input.
721
- * @private
722
- */
723
- _createConfigurationBasedOnURIInput: function () {
724
- var oUriParams = UriParameters.fromQuery(window.location.search);
725
- this._aConfiguration = [];
726
-
727
- if (!(oUriParams.has('sap-ui-language') || oUriParams.has('sap-language'))) {
728
- this._aConfiguration.push(DEMOKIT_CONFIGURATION_LANGUAGE);
729
- }
674
+ formatSuggestionTitle: function (sTitle, sSummary) {
675
+ var sFormatted = sTitle || "";
676
+ if (sSummary) {
677
+ sFormatted += ": " + sSummary;
678
+ }
679
+ return sFormatted;
680
+ },
681
+
682
+ onSearchResultsSummaryPress: function (oEvent) {
683
+ var sCategory = oEvent.oSource.data("category");
684
+ this.navToSearchResults(sCategory);
685
+ },
686
+
687
+ onSearchPickerItemPress: function (oEvent) {
688
+ var contextPath = oEvent.oSource.getBindingContextPath(),
689
+ oDataItem = this.getModel("searchData").getProperty(contextPath);
690
+ if (oDataItem.external) {
691
+ openWindow(new URL(oDataItem.path, document.baseURI).href);
692
+ } else {
693
+ this.getRouter().parsePath(oDataItem.path);
694
+ }
695
+ this.oPicker.close();
696
+ },
697
+
698
+ /**
699
+ * Updates the appearance of the Demo Kit depending of the incoming appearance keyword.
700
+ * If the keyword is "auto" the appearance will be updated to light or dark depending on the
701
+ * user's OS settings.
702
+ *
703
+ * @param {string} sKey the appearance keyword
704
+ * @param {object} oComponent the component where the theme will be changed
705
+ * @private
706
+ */
707
+ _updateAppearance: function (sKey) {
708
+ var oComponent = this;
709
+ ThemePicker._updateAppearance(sKey, oComponent);
710
+ },
711
+
712
+ /**
713
+ * Creates configuration for the application regarding the URI input.
714
+ *
715
+ * @private
716
+ */
717
+ _createConfigurationBasedOnURIInput: function () {
718
+ var oUriParams = UriParameters.fromQuery(window.location.search);
719
+ this._aConfiguration = [];
720
+
721
+ if (!(oUriParams.has('sap-ui-language') || oUriParams.has('sap-language'))) {
722
+ this._aConfiguration.push(DEMOKIT_CONFIGURATION_LANGUAGE);
723
+ }
730
724
 
731
- if (!(oUriParams.has('sap-ui-theme') || oUriParams.has('sap-theme'))) {
732
- this._aConfiguration.push(DEMOKIT_CONFIGURATION_APPEARANCE);
725
+ if (!(oUriParams.has('sap-ui-theme') || oUriParams.has('sap-theme'))) {
726
+ this._aConfiguration.push(DEMOKIT_CONFIGURATION_APPEARANCE);
727
+ }
728
+ },
729
+
730
+ /**
731
+ * Applies configuration for the application regarding the default values.
732
+ *
733
+ * @private
734
+ */
735
+ _applyDefaultConfiguration: function () {
736
+ this._aConfiguration.forEach(function (sConf) {
737
+ if (sConf === DEMOKIT_CONFIGURATION_LANGUAGE) {
738
+ Core.getConfiguration().setLanguage(DEMOKIT_DEFAULT_LANGUAGE);
739
+ } else if (sConf === DEMOKIT_CONFIGURATION_APPEARANCE) {
740
+ this._updateAppearance(ThemePicker._getTheme().auto);
733
741
  }
734
- },
735
-
736
- /**
737
- * Applies configuration for the application regarding the default values.
738
- * @private
739
- */
740
- _applyDefaultConfiguration: function () {
741
- this._aConfiguration.forEach(function(sConf){
742
+ }, this);
743
+
744
+ this._oSupportedLangModel.setProperty("/selectedLang", Core.getConfiguration().getLanguage());
745
+ },
746
+
747
+ /**
748
+ * Applies configuration for the application regarding the cookies.
749
+ *
750
+ * @private
751
+ */
752
+ _applyCookiesConfiguration: function () {
753
+ var sCookieValue, sConf, i;
754
+
755
+ for (i = 0; i < this._aConfiguration.length; i++) {
756
+ sConf = this._aConfiguration[i];
757
+ sCookieValue = this._oConfigUtil.getCookieValue(sConf);
758
+
759
+ if (sCookieValue !== "") {
742
760
  if (sConf === DEMOKIT_CONFIGURATION_LANGUAGE) {
743
- Core.getConfiguration().setLanguage(DEMOKIT_DEFAULT_LANGUAGE);
761
+ this._setSelectedLanguage(sCookieValue);
744
762
  } else if (sConf === DEMOKIT_CONFIGURATION_APPEARANCE) {
745
- this._updateAppearance(ThemePicker._getTheme().auto);
763
+ this._updateAppearance(sCookieValue);
746
764
  }
747
- }, this);
748
-
749
- this._oSupportedLangModel.setProperty("/selectedLang", Core.getConfiguration().getLanguage());
750
- },
751
-
752
- /**
753
- * Applies configuration for the application regarding the cookies.
754
- * @private
755
- */
756
- _applyCookiesConfiguration: function () {
757
- var sCookieValue, sConf, i;
758
-
759
- for (i = 0; i < this._aConfiguration.length; i++) {
760
- sConf = this._aConfiguration[i];
761
- sCookieValue = this._oConfigUtil.getCookieValue(sConf);
762
-
763
- if (sCookieValue !== "") {
764
- if (sConf === DEMOKIT_CONFIGURATION_LANGUAGE) {
765
- this._setSelectedLanguage(sCookieValue);
766
- } else if (sConf === DEMOKIT_CONFIGURATION_APPEARANCE) {
767
- this._updateAppearance(sCookieValue);
768
- }
769
765
 
770
- // If we have available value for the given cookie we remove it from the configuration array.
771
- this._aConfiguration.splice(i, 1);
772
- i--;
773
- }
766
+ // If we have available value for the given cookie we remove it from the configuration array.
767
+ this._aConfiguration.splice(i, 1);
768
+ i--;
774
769
  }
770
+ }
775
771
 
776
- // If we still have configurations which are not set by their cookie values, we apply their default values.
777
- if (this._aConfiguration.length > 0) {
778
- this._applyDefaultConfiguration();
779
- }
780
- },
781
-
782
- /*
783
- * Helper for function for preparing the data for the SupportedLangModel.
784
- * @private
785
- * @returns {Array[Object]} Array of objects containg the needed data for the SupportedLangModel
786
- */
787
- _prepareSupportedLangModelData: function () {
788
- return Core.getConfiguration().getLanguagesDeliveredWithCore().reduce(function(result, sLangAbbreviation) {
789
- var langName,
790
- sLang = sLangAbbreviation,
791
- sLangRegion = sLangAbbreviation;
792
-
793
- if (typeof sLangAbbreviation === "string" && sLangAbbreviation.length > 0) {
794
-
795
- switch (sLangAbbreviation) {
796
- case "sh": //Serbian
797
- sLang = "sr_Latn";
798
- break;
799
- case "no": //Norwegian
800
- sLang = "nb"; // Bokmål
801
- break;
802
- case "iw": // Israel
803
- // Hebrew
804
- sLang = "he";
805
- sLangRegion = "he";
806
- break;
807
- case "zh_TW": // Taiwan
808
- // Chinese Traditional
809
- sLangRegion = "zh_Hant";
810
- break;
811
- case "zh_CN": // People's Republic of China
812
- // Chinese Simplified
813
- sLangRegion = "zh_Hans";
814
- break;
815
- }
772
+ // If we still have configurations which are not set by their cookie values, we apply their default values.
773
+ if (this._aConfiguration.length > 0) {
774
+ this._applyDefaultConfiguration();
775
+ }
776
+ },
777
+
778
+ /**
779
+ * Helper for function for preparing the data for the SupportedLangModel.
780
+ *
781
+ * @private
782
+ * @returns {Object[]} Array of objects containg the needed data for the SupportedLangModel
783
+ */
784
+ _prepareSupportedLangModelData: function () {
785
+ return Core.getConfiguration().getLanguagesDeliveredWithCore().reduce(function (result, sLangAbbreviation) {
786
+ var langName,
787
+ sLang = sLangAbbreviation,
788
+ sLangRegion = sLangAbbreviation;
789
+
790
+ if (typeof sLangAbbreviation === "string" && sLangAbbreviation.length > 0) {
791
+
792
+ switch (sLangAbbreviation) {
793
+ case "sh": //Serbian
794
+ sLang = "sr_Latn";
795
+ break;
796
+ case "no": //Norwegian
797
+ sLang = "nb"; // Bokmål
798
+ break;
799
+ case "iw": // Israel
800
+ // Hebrew
801
+ sLang = "he";
802
+ sLangRegion = "he";
803
+ break;
804
+ case "zh_TW": // Taiwan
805
+ // Chinese Traditional
806
+ sLangRegion = "zh_Hant";
807
+ break;
808
+ case "zh_CN": // People's Republic of China
809
+ // Chinese Simplified
810
+ sLangRegion = "zh_Hans";
811
+ break;
812
+ }
816
813
 
817
- result.push(new Promise(function (resolve, reject) {
818
- LoaderExtensions.loadResource("sap/ui/core/cldr/" + sLang + ".json", {async: true})
819
- .then(function(locale) {
820
- langName = locale.languages[sLangRegion];
814
+ result.push(new Promise(function (resolve, reject) {
815
+ LoaderExtensions.loadResource("sap/ui/core/cldr/" + sLang + ".json", { async: true })
816
+ .then(function (locale) {
817
+ langName = locale.languages[sLangRegion];
821
818
 
822
- resolve({
823
- "text": typeof langName === 'string' ? langName.charAt(0).toUpperCase() + langName.substring(1) : "Unknown",
824
- "key": sLangAbbreviation
825
- });
819
+ resolve({
820
+ "text": typeof langName === 'string' ? langName.charAt(0).toUpperCase() + langName.substring(1) : "Unknown",
821
+ "key": sLangAbbreviation
826
822
  });
827
- }));
828
- }
829
-
830
- return result;
831
- }, []);
832
- },
833
-
834
- /**
835
- * Sets the selected language code abbreviation
836
- * @param {string} sLanguage language code abbreviation
837
- * @private
838
- */
839
- _setSelectedLanguage: function(sLanguage) {
840
- this._oSupportedLangModel.setProperty("/selectedLang", sLanguage);
841
- Core.getConfiguration().setLanguage(sLanguage);
842
- if (this._oConfigUtil.getCookieValue(this._oCookieNames.ALLOW_REQUIRED_COOKIES) === "1") {
843
- this._oConfigUtil.setCookie(DEMOKIT_CONFIGURATION_LANGUAGE, sLanguage);
823
+ });
824
+ }));
844
825
  }
845
- },
846
-
847
- /**
848
- * Gets the selected language code abbreviation
849
- * @private
850
- * @returns {string} sLanguage language code abbreviation
851
- */
852
- _getSelectedLanguage: function() {
853
- return this._oSupportedLangModel.getProperty("/selectedLang");
854
- },
855
-
856
- /**
857
- * Opens the settings dialog
858
- * @public
859
- */
860
- settingsDialogOpen: function () {
861
- var oModel;
862
-
863
- if (!this._oSettingsDialog) {
826
+
827
+ return result;
828
+ }, []);
829
+ },
830
+
831
+ /**
832
+ * Sets the selected language code abbreviation
833
+ *
834
+ * @param {string} sLanguage language code abbreviation
835
+ * @private
836
+ */
837
+ _setSelectedLanguage: function (sLanguage) {
838
+ this._oSupportedLangModel.setProperty("/selectedLang", sLanguage);
839
+ Core.getConfiguration().setLanguage(sLanguage);
840
+ if (this._oConfigUtil.getCookieValue(this._oCookieNames.ALLOW_REQUIRED_COOKIES) === "1") {
841
+ this._oConfigUtil.setCookie(DEMOKIT_CONFIGURATION_LANGUAGE, sLanguage);
842
+ }
843
+
844
+ if (this._sKey) {
845
+ this._setSelectedSectionTitle(this._sKey);
846
+ }
847
+ },
848
+
849
+ /**
850
+ * Gets the selected language code abbreviation
851
+ *
852
+ * @private
853
+ * @returns {string} sLanguage language code abbreviation
854
+ */
855
+ _getSelectedLanguage: function () {
856
+ return this._oSupportedLangModel.getProperty("/selectedLang");
857
+ },
858
+
859
+ /**
860
+ * Opens the settings dialog
861
+ *
862
+ * @public
863
+ */
864
+ settingsDialogOpen: function () {
865
+ var oModel;
866
+
867
+ if (!this._oSettingsDialog) {
868
+ Fragment.load({
869
+ name: "sap.ui.documentation.sdk.view.globalSettingsDialog",
870
+ controller: this
871
+ }).then(function (oDialog) {
872
+ // connect dialog to the root view of this component (models, lifecycle)
873
+ this._oView.addDependent(oDialog);
874
+ this._oSettingsDialog = oDialog;
875
+ Core.byId("LanguageSelect").setSelectedKey(this._getSelectedLanguage());
876
+ this._oSettingsDialog.open();
877
+ }.bind(this));
878
+ } else {
879
+ this._oSettingsDialog.open();
880
+ }
881
+
882
+ if (!this._oSupportedLangModel.getProperty("/langs")) {
883
+ oModel = this._oSupportedLangModel;
884
+ oModel.setProperty("/selectBusy", true);
885
+ Promise.all(this._prepareSupportedLangModelData()).then(function (result) {
886
+ oModel.setProperty("/selectBusy", false);
887
+ oModel.setProperty("/langs", result);
888
+ });
889
+ }
890
+ },
891
+
892
+ /**
893
+ * Closes the settings dialog
894
+ *
895
+ * @public
896
+ */
897
+ handleCloseAppSettings: function () {
898
+ this._oSettingsDialog.close();
899
+ },
900
+
901
+ /**
902
+ * Saves settings from the settings dialog
903
+ *
904
+ * @public
905
+ */
906
+ handleSaveAppSettings: function () {
907
+ var sLanguage = Core.byId('LanguageSelect').getSelectedKey();
908
+
909
+ this._oSettingsDialog.close();
910
+
911
+ // handle settings change
912
+ this._applyAppConfiguration(sLanguage);
913
+ },
914
+
915
+ /**
916
+ * Apply content configuration
917
+ *
918
+ * @param {string} sLanguage language code abbreviation
919
+ * @private
920
+ */
921
+ _applyAppConfiguration: function (sLanguage) {
922
+ this._setSelectedLanguage(sLanguage);
923
+ },
924
+
925
+ getAboutDialog: function () {
926
+ return new Promise(function (resolve, reject) {
927
+ if (!this._oAboutDialog) {
864
928
  Fragment.load({
865
- name: "sap.ui.documentation.sdk.view.globalSettingsDialog",
929
+ id: "aboutDialogFragment",
930
+ name: "sap.ui.documentation.sdk.view.AboutDialog",
866
931
  controller: this
867
932
  }).then(function (oDialog) {
868
- // connect dialog to the root view of this component (models, lifecycle)
869
- this._oView.addDependent(oDialog);
870
- this._oSettingsDialog = oDialog;
871
- Core.byId("LanguageSelect").setSelectedKey(this._getSelectedLanguage());
872
- this._oSettingsDialog.open();
933
+ this._oAboutDialog = oDialog;
934
+ this._oView.addDependent(this._oAboutDialog);
935
+ resolve(this._oAboutDialog);
873
936
  }.bind(this));
874
937
  } else {
875
- this._oSettingsDialog.open();
938
+ resolve(this._oAboutDialog);
876
939
  }
877
-
878
- if (!this._oSupportedLangModel.getProperty("/langs")) {
879
- oModel = this._oSupportedLangModel;
880
- oModel.setProperty("/selectBusy", true);
881
- Promise.all(this._prepareSupportedLangModelData()).then(function (result) {
882
- oModel.setProperty("/selectBusy", false);
883
- oModel.setProperty("/langs", result);
884
- });
940
+ }.bind(this));
941
+ },
942
+
943
+ aboutDialogOpen: function () {
944
+ this.getAboutDialog().then(function (oDialog) {
945
+ oDialog.getContent()[0].backToTop(); // reset the nav container to the first page
946
+ oDialog.open();
947
+ });
948
+ },
949
+
950
+ aboutDialogClose: function (oEvent) {
951
+ this.getAboutDialog().then(function (oDialog) {
952
+ oDialog.close();
953
+ });
954
+ },
955
+
956
+ onAboutVersionDetails: function (oEvent) {
957
+ var oViewModel = this.getModel("appView"),
958
+ oViewModelData = oViewModel.getData(),
959
+ that = this;
960
+
961
+ library._loadAllLibInfo("", "_getLibraryInfo", "", function (aLibs, oLibInfos) {
962
+ var data = {};
963
+ var oLibInfo = library._getLibraryInfoSingleton();
964
+
965
+ for (var i = 0, l = aLibs.length; i < l; i++) {
966
+ aLibs[i] = oLibInfos[aLibs[i]];
967
+ aLibs[i].libDefaultComponent = oLibInfo._getDefaultComponent(aLibs[i]);
885
968
  }
886
- },
887
-
888
- /**
889
- * Closes the settings dialog
890
- * @public
891
- */
892
- handleCloseAppSettings: function () {
893
- this._oSettingsDialog.close();
894
- },
895
-
896
- /**
897
- * Saves settings from the settings dialog
898
- * @public
899
- */
900
- handleSaveAppSettings: function () {
901
- var sLanguage = Core.byId('LanguageSelect').getSelectedKey();
902
-
903
- this._oSettingsDialog.close();
904
-
905
- // handle settings change
906
- this._applyAppConfiguration(sLanguage);
907
- },
908
-
909
- /**
910
- * Apply content configuration
911
- * @param {string} sLanguage language code abbreviation
912
- * @private
913
- */
914
- _applyAppConfiguration: function(sLanguage){
915
- this._setSelectedLanguage(sLanguage);
916
- },
917
-
918
- getAboutDialog: function () {
919
- return new Promise(function (resolve, reject) {
920
- if (!this._oAboutDialog) {
921
- Fragment.load({
922
- id: "aboutDialogFragment",
923
- name: "sap.ui.documentation.sdk.view.AboutDialog",
924
- controller: this
925
- }).then(function (oDialog) {
926
- this._oAboutDialog = oDialog;
927
- this._oView.addDependent(this._oAboutDialog);
928
- resolve(this._oAboutDialog);
929
- }.bind(this));
930
- } else {
931
- resolve(this._oAboutDialog);
932
- }
933
- }.bind(this));
934
- },
935
969
 
936
- aboutDialogOpen: function () {
937
- this.getAboutDialog().then(function (oDialog) {
938
- oDialog.getContent()[0].backToTop(); // reset the nav container to the first page
939
- oDialog.open();
940
- });
941
- },
942
-
943
- aboutDialogClose: function (oEvent) {
944
- this.getAboutDialog().then(function (oDialog) {
945
- oDialog.close();
946
- });
947
- },
970
+ data.libs = aLibs;
971
+ oViewModelData.oVersionInfo = data;
972
+ oViewModel.setData(oViewModelData);
973
+ that.setModel(oViewModel, "appView");
974
+ });
948
975
 
949
- onAboutVersionDetails: function (oEvent) {
950
- var oViewModel = this.getModel("appView"),
951
- oViewModelData = oViewModel.getData(),
952
- that = this;
976
+ var oNavCon = Fragment.byId("aboutDialogFragment", "aboutNavCon"),
977
+ oDetailPage = Fragment.byId("aboutDialogFragment", "aboutDetail");
978
+ oNavCon.to(oDetailPage);
979
+ },
953
980
 
954
- library._loadAllLibInfo("", "_getLibraryInfo","", function(aLibs, oLibInfos) {
955
- var data = {};
956
- var oLibInfo = library._getLibraryInfoSingleton();
981
+ onAboutThirdParty: function (oEvent) {
982
+ var oViewModel = this.getModel("appView"),
983
+ oViewModelData = oViewModel.getData(),
984
+ that = this;
957
985
 
958
- for (var i = 0, l = aLibs.length; i < l; i++) {
959
- aLibs[i] = oLibInfos[aLibs[i]];
960
- aLibs[i].libDefaultComponent = oLibInfo._getDefaultComponent(aLibs[i]);
986
+ library._loadAllLibInfo("", "_getThirdPartyInfo", function (aLibs, oLibInfos) {
987
+ if (!aLibs) {
988
+ return;
989
+ }
990
+ var data = {};
991
+ data.thirdparty = [];
992
+ for (var j = 0; j < aLibs.length; j++) {
993
+ var oData = oLibInfos[aLibs[j]];
994
+ for (var i = 0; i < oData.libs.length; i++) {
995
+ var oOpenSourceLib = oData.libs[i];
996
+ oOpenSourceLib._lib = aLibs[j];
997
+ data.thirdparty.push(oOpenSourceLib);
961
998
  }
999
+ }
962
1000
 
963
- data.libs = aLibs;
964
- oViewModelData.oVersionInfo = data;
965
- oViewModel.setData(oViewModelData);
966
- that.setModel(oViewModel, "appView");
967
- });
968
-
969
- var oNavCon = Fragment.byId("aboutDialogFragment", "aboutNavCon"),
970
- oDetailPage = Fragment.byId("aboutDialogFragment", "aboutDetail");
971
- oNavCon.to(oDetailPage);
972
- },
973
-
974
- onAboutThirdParty: function (oEvent) {
975
- var oViewModel = this.getModel("appView"),
976
- oViewModelData = oViewModel.getData(),
977
- that = this;
1001
+ data.thirdparty.sort(function (a, b) {
1002
+ var aName = (a.displayName || "").toUpperCase();
1003
+ var bName = (b.displayName || "").toUpperCase();
978
1004
 
979
- library._loadAllLibInfo("", "_getThirdPartyInfo", function(aLibs, oLibInfos){
980
- if (!aLibs){
981
- return;
982
- }
983
- var data = {};
984
- data.thirdparty = [];
985
- for (var j = 0; j < aLibs.length; j++) {
986
- var oData = oLibInfos[aLibs[j]];
987
- for (var i = 0; i < oData.libs.length; i++) {
988
- var oOpenSourceLib = oData.libs[i];
989
- oOpenSourceLib._lib = aLibs[j];
990
- data.thirdparty.push(oOpenSourceLib);
991
- }
1005
+ if (aName > bName) {
1006
+ return 1;
1007
+ } else if (aName < bName) {
1008
+ return -1;
1009
+ } else {
1010
+ return 0;
992
1011
  }
1012
+ });
993
1013
 
994
- data.thirdparty.sort(function(a,b){
995
- var aName = (a.displayName || "").toUpperCase();
996
- var bName = (b.displayName || "").toUpperCase();
997
-
998
- if (aName > bName){
999
- return 1;
1000
- } else if (aName < bName){
1001
- return -1;
1002
- } else {
1003
- return 0;
1004
- }
1005
- });
1014
+ oViewModelData.oThirdPartyInfo = data;
1015
+ oViewModel.setData(oViewModelData);
1016
+ that.setModel(oViewModel, "appView");
1017
+ });
1006
1018
 
1007
- oViewModelData.oThirdPartyInfo = data;
1008
- oViewModel.setData(oViewModelData);
1009
- that.setModel(oViewModel, "appView");
1010
- });
1019
+ var oNavCon = Fragment.byId("aboutDialogFragment", "aboutNavCon"),
1020
+ oDetailPage = Fragment.byId("aboutDialogFragment", "aboutThirdParty");
1021
+ oNavCon.to(oDetailPage);
1022
+ },
1011
1023
 
1012
- var oNavCon = Fragment.byId("aboutDialogFragment", "aboutNavCon"),
1013
- oDetailPage = Fragment.byId("aboutDialogFragment", "aboutThirdParty");
1014
- oNavCon.to(oDetailPage);
1015
- },
1016
-
1017
- _getReleaseDialog: function () {
1018
- return new Promise(function (resolve) {
1019
- if (!this._oReleaseDialog) {
1020
- Fragment.load({
1021
- id: "releaseDialogFragment",
1022
- name: "sap.ui.documentation.sdk.view.ReleaseDialog",
1023
- controller: this
1024
- }).then(function (oDialog) {
1025
- this._oReleaseDialog = oDialog;
1026
- this._oView.addDependent(this._oReleaseDialog);
1027
- resolve(this._oReleaseDialog);
1028
- }
1029
- .bind(this));
1030
- } else {
1024
+ _getReleaseDialog: function () {
1025
+ return new Promise(function (resolve) {
1026
+ if (!this._oReleaseDialog) {
1027
+ Fragment.load({
1028
+ id: "releaseDialogFragment",
1029
+ name: "sap.ui.documentation.sdk.view.ReleaseDialog",
1030
+ controller: this
1031
+ }).then(function (oDialog) {
1032
+ this._oReleaseDialog = oDialog;
1033
+ this._oView.addDependent(this._oReleaseDialog);
1031
1034
  resolve(this._oReleaseDialog);
1032
1035
  }
1033
- }.bind(this));
1034
- },
1035
-
1036
- _getNotesView: function () {
1037
- var oNotesModel;
1038
- return new Promise(function (resolve) {
1039
- if (!this._oNotesView) {
1040
- oNotesModel = new JSONModel();
1041
- Fragment.load({
1042
- id: "notesView",
1043
- name: "sap.ui.documentation.sdk.view.ReleaseNotesView",
1044
- controller: this
1045
- }).then(function (oView) {
1046
- this._oNotesView = oView;
1047
- this._oNotesView.setModel(oNotesModel);
1048
- resolve(this._oNotesView);
1049
- }.bind(this));
1050
- } else {
1036
+ .bind(this));
1037
+ } else {
1038
+ resolve(this._oReleaseDialog);
1039
+ }
1040
+ }.bind(this));
1041
+ },
1042
+
1043
+ _getNotesView: function () {
1044
+ var oNotesModel;
1045
+ return new Promise(function (resolve) {
1046
+ if (!this._oNotesView) {
1047
+ oNotesModel = new JSONModel();
1048
+ Fragment.load({
1049
+ id: "notesView",
1050
+ name: "sap.ui.documentation.sdk.view.ReleaseNotesView",
1051
+ controller: this
1052
+ }).then(function (oView) {
1053
+ this._oNotesView = oView;
1054
+ this._oNotesView.setModel(oNotesModel);
1051
1055
  resolve(this._oNotesView);
1052
- }
1053
- }.bind(this));
1054
- },
1055
-
1056
- onReleaseDialogOpen: function (oEvent) {
1057
- var oLibInfo = library._getLibraryInfoSingleton(),
1058
- sVersion = oEvent.getSource().data("version"),
1059
- sLibrary = oEvent.getSource().data("library"),
1060
- oDialogModel = new JSONModel();
1061
-
1062
- Promise.all([this._getReleaseDialog(), this._getNotesView()]).then(function (aResult) {
1063
- var oReleaseDialog = aResult[0],
1064
- oNotesView = aResult[1],
1065
- oNotesViewData = {};
1066
-
1067
- oLibInfo._getReleaseNotes(sLibrary, sVersion, function(oRelNotes, sVersion) {
1068
- var oDialogData = {};
1069
-
1070
- if (oRelNotes && oRelNotes[sVersion] && oRelNotes[sVersion].notes && oRelNotes[sVersion].notes.length > 0) {
1071
- oNotesViewData = oRelNotes[sVersion];
1072
- } else {
1073
- oDialogData.noData = true;
1074
- }
1075
- oNotesView.getModel().setData(oNotesViewData);
1076
- oDialogData.library = sLibrary;
1077
- oDialogModel.setData(oDialogData);
1078
- });
1079
-
1080
- oReleaseDialog.setModel(oDialogModel);
1081
- oReleaseDialog.addContent(oNotesView);
1082
- oReleaseDialog.open();
1083
- });
1084
-
1085
- },
1056
+ }.bind(this));
1057
+ } else {
1058
+ resolve(this._oNotesView);
1059
+ }
1060
+ }.bind(this));
1061
+ },
1086
1062
 
1087
- onReleaseDialogClose: function (oEvent) {
1088
- this._getReleaseDialog().then(function (oDialog) {
1089
- oDialog.close();
1090
- });
1091
- },
1063
+ onReleaseDialogOpen: function (oEvent) {
1064
+ var oLibInfo = library._getLibraryInfoSingleton(),
1065
+ sVersion = oEvent.getSource().data("version"),
1066
+ sLibrary = oEvent.getSource().data("library"),
1067
+ oDialogModel = new JSONModel();
1092
1068
 
1093
- onAboutNavBack: function (oEvent) {
1094
- var oNavCon = Fragment.byId("aboutDialogFragment", "aboutNavCon");
1095
- oNavCon.back();
1096
- },
1069
+ Promise.all([this._getReleaseDialog(), this._getNotesView()]).then(function (aResult) {
1070
+ var oReleaseDialog = aResult[0],
1071
+ oNotesView = aResult[1],
1072
+ oNotesViewData = {};
1097
1073
 
1098
- onChangeVersionButtonPress: function () {
1099
- this.getVersionSwitchDialog().then(function (oDialog) {
1100
- oDialog.open();
1101
- });
1102
- },
1074
+ oLibInfo._getReleaseNotes(sLibrary, sVersion, function (oRelNotes, sVersion) {
1075
+ var oDialogData = {};
1103
1076
 
1104
- onCloseVersionDialog: function () {
1105
- this.getVersionSwitchDialog().then(function (oDialog) {
1106
- oDialog.close();
1077
+ if (oRelNotes && oRelNotes[sVersion] && oRelNotes[sVersion].notes && oRelNotes[sVersion].notes.length > 0) {
1078
+ oNotesViewData = oRelNotes[sVersion];
1079
+ } else {
1080
+ oDialogData.noData = true;
1081
+ }
1082
+ oNotesView.getModel().setData(oNotesViewData);
1083
+ oDialogData.library = sLibrary;
1084
+ oDialogModel.setData(oDialogData);
1107
1085
  });
1108
- },
1109
-
1110
- onChangeVersionDialogSearch: function (oEvent) {
1111
- var sSearchedValue = oEvent.getParameter("newValue"),
1112
- oFilter = new Filter("version", FilterOperator.Contains, sSearchedValue),
1113
- oTree = Core.byId("versionList"),
1114
- oBinding = oTree.getBinding("items");
1115
1086
 
1116
- oBinding.filter([oFilter]);
1117
-
1118
- // If only one branch of the version info tree is currently left after filtering
1119
- if (oBinding.getChildCount() === 1) {
1120
- // expand the only branch of the version info tree
1121
- oBinding.expand(0);
1122
- } else {
1123
- // collapse all of the branches of the version info tree
1124
- oTree.collapseAll();
1125
- }
1126
- },
1087
+ oReleaseDialog.setModel(oDialogModel);
1088
+ oReleaseDialog.addContent(oNotesView);
1089
+ oReleaseDialog.open();
1090
+ });
1091
+
1092
+ },
1093
+
1094
+ onReleaseDialogClose: function (oEvent) {
1095
+ this._getReleaseDialog().then(function (oDialog) {
1096
+ oDialog.close();
1097
+ });
1098
+ },
1099
+
1100
+ onAboutNavBack: function (oEvent) {
1101
+ var oNavCon = Fragment.byId("aboutDialogFragment", "aboutNavCon");
1102
+ oNavCon.back();
1103
+ },
1104
+
1105
+ onChangeVersionButtonPress: function () {
1106
+ this.getVersionSwitchDialog().then(function (oDialog) {
1107
+ oDialog.open();
1108
+ });
1109
+ },
1110
+
1111
+ onCloseVersionDialog: function () {
1112
+ this.getVersionSwitchDialog().then(function (oDialog) {
1113
+ oDialog.close();
1114
+ });
1115
+ },
1116
+
1117
+ onChangeVersionDialogSearch: function (oEvent) {
1118
+ var sSearchedValue = oEvent.getParameter("newValue"),
1119
+ oFilter = new Filter("version", FilterOperator.Contains, sSearchedValue),
1120
+ oTree = Core.byId("versionList"),
1121
+ oBinding = oTree.getBinding("items");
1122
+
1123
+ oBinding.filter([oFilter]);
1124
+
1125
+ // If only one branch of the version info tree is currently left after filtering
1126
+ if (oBinding.getChildCount() === 1) {
1127
+ // expand the only branch of the version info tree
1128
+ oBinding.expand(0);
1129
+ } else {
1130
+ // collapse all of the branches of the version info tree
1131
+ oTree.collapseAll();
1132
+ }
1133
+ },
1134
+
1135
+ onHeaderLogoPress: function () {
1136
+ this._demoKitPage.setSideExpanded(false);
1137
+ this.oRouter.navTo("welcome", {});
1138
+ },
1139
+
1140
+ onSiteMapPress: function () {
1141
+ this.oRouter.navTo("sitemap", {});
1142
+ },
1143
+
1144
+ onLatestVersionItemPress: function () {
1145
+ if (ResourcesUtil.getResourcesVersion()) {
1146
+ window.sessionStorage.removeItem("versionPrefixPath");
1147
+ window.location.reload();
1148
+ } else {
1149
+ window.location.href = "/";
1150
+ }
1151
+ },
1127
1152
 
1128
- onLogoIconPress: function () {
1129
- this.oRouter.navTo("welcome", {});
1130
- },
1153
+ onVersionItemPress: function (oEvent) {
1154
+ var oSelectedItem = Core.byId("versionList").getSelectedItem(),
1155
+ oCustomData = oSelectedItem.getCustomData()[0];
1131
1156
 
1132
- onSiteMapPress: function () {
1133
- this.oRouter.navTo("sitemap", {});
1134
- },
1157
+ if (oCustomData && oCustomData.getKey() === "path") {
1135
1158
 
1136
- onLatestVersionItemPress: function() {
1137
- if (ResourcesUtil.getResourcesVersion()) {
1138
- window.sessionStorage.removeItem("versionPrefixPath");
1159
+ if (ResourcesUtil.getHasProxy()) {
1160
+ window.sessionStorage.setItem("versionPrefixPath", oCustomData.getValue());
1139
1161
  window.location.reload();
1140
1162
  } else {
1141
- window.location.href = "/";
1163
+ window.location.href = oCustomData.getValue(); // Domain relative redirect
1142
1164
  }
1143
- },
1144
-
1145
- onVersionItemPress: function (oEvent) {
1146
- var oSelectedItem = Core.byId("versionList").getSelectedItem(),
1147
- oCustomData = oSelectedItem.getCustomData()[0];
1148
-
1149
- if (oCustomData && oCustomData.getKey() === "path") {
1165
+ }
1166
+ },
1150
1167
 
1151
- if (ResourcesUtil.getHasProxy()) {
1152
- window.sessionStorage.setItem("versionPrefixPath", oCustomData.getValue());
1153
- window.location.reload();
1154
- } else {
1155
- window.location.href = oCustomData.getValue(); // Domain relative redirect
1156
- }
1157
- }
1158
- },
1159
-
1160
- getVersionSwitchDialog: function () {
1161
- return new Promise(function (resolve) {
1162
- if (!this._oChangeVersionDialog) {
1163
- Fragment.load({
1164
- name: "sap.ui.documentation.sdk.view.ChangeVersionDialog",
1165
- controller: this
1166
- }).then(function (oDialog) {
1167
- this._oChangeVersionDialog = oDialog;
1168
- this._oChangeVersionDialog.setModel(this._buildVersionDialogModel());
1169
- this._oView.addDependent(this._oChangeVersionDialog);
1170
- resolve(this._oChangeVersionDialog);
1171
- }.bind(this));
1172
- } else {
1168
+ getVersionSwitchDialog: function () {
1169
+ return new Promise(function (resolve) {
1170
+ if (!this._oChangeVersionDialog) {
1171
+ Fragment.load({
1172
+ name: "sap.ui.documentation.sdk.view.ChangeVersionDialog",
1173
+ controller: this
1174
+ }).then(function (oDialog) {
1175
+ this._oChangeVersionDialog = oDialog;
1176
+ this._oChangeVersionDialog.setModel(this._buildVersionDialogModel());
1177
+ this._oView.addDependent(this._oChangeVersionDialog);
1173
1178
  resolve(this._oChangeVersionDialog);
1174
- }
1175
- }.bind(this));
1176
- },
1177
-
1178
- /**
1179
- * Custom comparison function, which is used when sorting group titles by minor version in the change version dialog
1180
- *
1181
- * @param sGroupTitleA
1182
- * @param sGroupTitleB
1183
- * @returns {number}
1184
- */
1185
- versionSwitchCustomComparator: function (sGroupTitleA, sGroupTitleB) {
1186
- return Version(sGroupTitleA).compareTo(Version(sGroupTitleB));
1187
- },
1188
-
1189
- /**
1190
- * Determines whether or not to show the version change button.
1191
- *
1192
- * @private
1193
- */
1194
- _updateVersionSwitchVisibility: function() {
1195
- var oViewModel = this.getModel("appView"),
1196
- bPhoneSize = oViewModel.getProperty("/bPhoneSize");
1197
-
1198
- // Version switch should not be shown on phone sizes or when no versions are found
1199
- oViewModel.setProperty("/bShowVersionSwitchInHeader", !bPhoneSize && !!this._aNeoAppVersions.length);
1200
- oViewModel.setProperty("/bShowVersionSwitchInMenu", bPhoneSize && !!this._aNeoAppVersions.length);
1201
- },
1202
-
1203
-
1204
- _buildVersionDialogModel: function() {
1205
- var oChangeVersionDialogModel = new JSONModel();
1206
-
1207
- oChangeVersionDialogModel.setSizeLimit(1000);
1208
- oChangeVersionDialogModel.setData(this._aNeoAppVersions);
1209
-
1210
- oChangeVersionDialogModel.setData(this._arrToTreeConverter(this._aNeoAppVersions));
1211
-
1212
- return oChangeVersionDialogModel;
1213
- },
1214
-
1215
- getFeedbackDialog: function () {
1216
- return new Promise(function (resolve) {
1217
- if (!this._oFeedbackDialog) {
1218
- Fragment.load({
1219
- id: "feedbackDialogFragment",
1220
- name: "sap.ui.documentation.sdk.view.FeedbackDialog",
1221
- controller: this
1222
- })
1223
- .then(this.extendFeedbackDialog.bind(this))
1224
- .then(function (oDialog) {
1225
- this._oFeedbackDialog = oDialog;
1226
- this._oView.addDependent(this._oFeedbackDialog);
1227
- resolve(this._oFeedbackDialog);
1228
- }.bind(this));
1229
- } else {
1230
- resolve(this._oFeedbackDialog);
1231
- }
1232
- }.bind(this));
1233
- },
1234
-
1235
- extendFeedbackDialog: function (oFeedbackDialog) {
1236
- var that = this,
1237
- oResourceBundle = this.getModel("i18n").getResourceBundle();
1238
-
1239
- oFeedbackDialog.textInput = Fragment.byId("feedbackDialogFragment", "feedbackInput");
1240
- oFeedbackDialog.contextCheckBox = Fragment.byId("feedbackDialogFragment", "pageContext");
1241
- oFeedbackDialog.contextData = Fragment.byId("feedbackDialogFragment", "contextData");
1242
- oFeedbackDialog.ratingStatus = Fragment.byId("feedbackDialogFragment", "ratingStatus");
1243
- oFeedbackDialog.ratingStatus.value = 0;
1244
- oFeedbackDialog.sendButton = Fragment.byId("feedbackDialogFragment", "sendButton");
1245
- oFeedbackDialog.ratingBar = [
1246
- {
1247
- button : Fragment.byId("feedbackDialogFragment", "excellent"),
1248
- status : "Excellent",
1249
- displayStatus: oResourceBundle.getText("FEEDBACK_DIALOG_STATUS_EXCELLENT")
1250
- },
1251
- {
1252
- button : Fragment.byId("feedbackDialogFragment", "good"),
1253
- status : "Good",
1254
- displayStatus: oResourceBundle.getText("FEEDBACK_DIALOG_STATUS_GOOD")
1255
- },
1256
- {
1257
- button : Fragment.byId("feedbackDialogFragment", "average"),
1258
- status : "Average",
1259
- displayStatus: oResourceBundle.getText("FEEDBACK_DIALOG_STATUS_AVERAGE")
1260
- },
1261
- {
1262
- button : Fragment.byId("feedbackDialogFragment", "poor"),
1263
- status : "Poor",
1264
- displayStatus: oResourceBundle.getText("FEEDBACK_DIALOG_STATUS_POOR")
1265
- },
1266
- {
1267
- button : Fragment.byId("feedbackDialogFragment", "veryPoor"),
1268
- status : "Very Poor",
1269
- displayStatus: oResourceBundle.getText("FEEDBACK_DIALOG_STATUS_VERY_POOR")
1270
- }
1271
- ];
1272
- oFeedbackDialog.reset = function () {
1273
- this.sendButton.setEnabled(false);
1274
- this.textInput.setValue("");
1275
- this.contextCheckBox.setSelected(true);
1276
- this.ratingStatus.setText("");
1277
- this.ratingStatus.setState("None");
1278
- this.ratingStatus.value = 0;
1279
- this.contextData.setVisible(false);
1280
- this.ratingBar.forEach(function(oRatingBarElement){
1281
- if (oRatingBarElement.button.getPressed()) {
1282
- oRatingBarElement.button.setPressed(false);
1283
- }
1284
- });
1285
- };
1286
- oFeedbackDialog.updateContextData = function() {
1287
- var sVersion = that._getUI5Version(),
1288
- sUI5Distribution = that._getUI5Distribution();
1289
-
1290
- if (this.contextCheckBox.getSelected()) {
1291
- this.contextData.setValue("Location: " + that._getCurrentPageRelativeURL() + "\n" + sUI5Distribution + " Version: " + sVersion);
1292
- } else {
1293
- this.contextData.setValue(sUI5Distribution + " Version: " + sVersion);
1294
- }
1295
- };
1296
-
1297
- oFeedbackDialog.updateContextData();
1179
+ }.bind(this));
1180
+ } else {
1181
+ resolve(this._oChangeVersionDialog);
1182
+ }
1183
+ }.bind(this));
1184
+ },
1185
+
1186
+ /**
1187
+ * Custom comparison function, which is used when sorting group titles by minor version in the change version dialog
1188
+ *
1189
+ * @param sGroupTitleA
1190
+ * @param sGroupTitleB
1191
+ * @returns {number}
1192
+ */
1193
+ versionSwitchCustomComparator: function (sGroupTitleA, sGroupTitleB) {
1194
+ return Version(sGroupTitleA).compareTo(Version(sGroupTitleB));
1195
+ },
1196
+
1197
+ /**
1198
+ * Determines whether or not to show the version change button
1199
+ *
1200
+ * @private
1201
+ */
1202
+ _updateVersionSwitchVisibility: function () {
1203
+ this.getModel("appView").setProperty("/bShowVersionSwitchButton", !!this._aNeoAppVersions.length);
1204
+ },
1205
+
1206
+ _buildVersionDialogModel: function () {
1207
+ var oChangeVersionDialogModel = new JSONModel();
1208
+ oChangeVersionDialogModel.setSizeLimit(1000);
1209
+ oChangeVersionDialogModel.setData(this._aNeoAppVersions);
1210
+ oChangeVersionDialogModel.setData(this._arrToTreeConverter(this._aNeoAppVersions));
1211
+ return oChangeVersionDialogModel;
1212
+ },
1213
+
1214
+ /**
1215
+ * Opens the Qualtrics UX survey when the feedback button is pressed.
1216
+ * There are two available surveys - a short one (all year round), and quarterly survey.
1217
+ *
1218
+ * Depending on the number of available surveys:
1219
+ * - Directly opens the short survey in a new tab.
1220
+ * - If a long, quarterly survey is available, opens a popover with links for both.
1221
+ *
1222
+ * @param {sap.ui.base.Event} oEvent The feedback/menu button's press event
1223
+ * @param {boolean} bMenu Whether the pressed button is hidden in the 'About' menu
1224
+ */
1225
+ launchSurvey: function (oEvent, bMenu) {
1226
+ var oTarget = this.byId(!bMenu ? "surveyButton" : "aboutMenuButton"),
1227
+ oView = this.getView(),
1228
+ oViewModel = this.getModel("appView"),
1229
+ bShowLongSurvey = oViewModel.getProperty("/bShowLongSurvey");
1298
1230
 
1299
- return oFeedbackDialog;
1300
- },
1231
+ if (!bShowLongSurvey) {
1232
+ this.shortSurveyRedirect();
1233
+ } else if (!this._oSurveyPopover) {
1234
+ Fragment.load({
1235
+ name: "sap.ui.documentation.sdk.view.SurveyPopover",
1236
+ controller: this
1237
+ }).then(function (oPopover) {
1238
+ oView.addDependent(oPopover);
1239
+ this._oSurveyPopover = oPopover;
1301
1240
 
1302
- /**
1303
- * Opens a dialog to give feedback on the demo kit
1304
- */
1305
- feedbackDialogOpen: function () {
1306
- this.getFeedbackDialog().then(function (oFeedbackDialog) {
1307
- oFeedbackDialog.updateContextData();
1308
- if (!oFeedbackDialog.isOpen()) {
1309
- syncStyleClass("sapUiSizeCompact", this.getView(), oFeedbackDialog);
1310
- oFeedbackDialog.open();
1241
+ if (Device.system.phone) {
1242
+ this.addSurveyPopoverCloseBtn();
1311
1243
  }
1312
- }.bind(this));
1313
- },
1314
-
1315
- /**
1316
- * Opens the Qualtrics UX survey when the feedback button is pressed.
1317
- * There are two available surveys - a short one (all year round), and quarterly survey.
1318
- *
1319
- * Depending on the number of available surveys:
1320
- * - Directly opens the short survey in a new tab.
1321
- * - If a long, quarterly survey is available, opens a popover with links for both.
1322
- *
1323
- * @param {sap.ui.base.Event} oEvent The feedback/menu button's press event
1324
- * @param {boolean} bMenu Whether the pressed button is hidden in the 'About' menu
1325
- */
1326
- launchSurvey: function (oEvent, bMenu) {
1327
- var oTarget = this.byId(!bMenu ? "surveyButton" : "aboutMenuButton"),
1328
- oView = this.getView(),
1329
- oViewModel = this.getModel("appView"),
1330
- bShowLongSurvey = oViewModel.getProperty("/bShowLongSurvey");
1331
-
1332
- if (!bShowLongSurvey) {
1333
- this.shortSurveyRedirect();
1334
- } else if (!this._oSurveyPopover) {
1335
- Fragment.load({
1336
- name: "sap.ui.documentation.sdk.view.SurveyPopover",
1337
- controller: this
1338
- }).then(function (oPopover) {
1339
- oView.addDependent(oPopover);
1340
- this._oSurveyPopover = oPopover;
1341
-
1342
- if (Device.system.phone) {
1343
- this.addSurveyPopoverCloseBtn();
1344
- }
1345
1244
 
1346
- this._oSurveyPopover.openBy(oTarget);
1347
- }.bind(this));
1348
- } else {
1349
1245
  this._oSurveyPopover.openBy(oTarget);
1350
- }
1351
- },
1352
-
1353
- /**
1354
- * Closes the survey popover on mobile.
1355
- * @param {sap.ui.base.Event} oEvent The close button's press event
1356
- */
1357
- closeSurveyPopover: function (oEvent) {
1358
- this._oSurveyPopover.close();
1359
- },
1360
-
1361
- shortSurveyRedirect: function () {
1362
- var sQueryParams = "?Release_version=" + this._getUI5Version()
1363
- + "&Source=" + this._getUI5Distribution()
1364
- + "&Type=" + this._getUI5VersionType()
1365
- + "&product=SAPUI5%2FOpenUI5"
1246
+ }.bind(this));
1247
+ } else {
1248
+ this._oSurveyPopover.openBy(oTarget);
1249
+ }
1250
+ },
1251
+
1252
+ /**
1253
+ * Closes the survey popover on mobile.
1254
+ *
1255
+ * @param {sap.ui.base.Event} oEvent The close button's press event
1256
+ */
1257
+ closeSurveyPopover: function (oEvent) {
1258
+ this._oSurveyPopover.close();
1259
+ },
1260
+
1261
+ shortSurveyRedirect: function () {
1262
+ var sQueryParams = "?Release_version=" + this._getUI5Version()
1263
+ + "&Source=" + this._getUI5Distribution()
1264
+ + "&Type=" + this._getUI5VersionType()
1265
+ + "&product=SAPUI5%2FOpenUI5"
1266
+ + "&product_filter=UI5"
1267
+ + "&cluster=BTP"
1268
+ + "&page=" + encodeURIComponent(document.location.href);
1269
+
1270
+ var sProdURL = "https://sapinsights.eu.qualtrics.com/jfe/form/SV_byI4QeS7Ic2Psyi" + sQueryParams,
1271
+ sDevURL = "https://sapinsights.eu.qualtrics.com/jfe/form/SV_3Epqk1MLAUQVrwy" + sQueryParams,
1272
+ bProd = !this.getModel("versionData").getProperty("/isDevEnv");
1273
+
1274
+ // This survey could be displayed in a Qualtrics intercept
1275
+ // dialog in the future, instead of a new tab
1276
+ URLHelper.redirect(bProd ? sProdURL : sDevURL, true);
1277
+ },
1278
+
1279
+ longSurveyRedirect: function () {
1280
+ var sBaseUrl = "https://sapinsights.eu.qualtrics.com/jfe/form/SV_7X5P63Zg5zXC5zE",
1281
+ sQueryParams = "?product=SAPUI5%2FOpenUI5"
1366
1282
  + "&product_filter=UI5"
1367
1283
  + "&cluster=BTP"
1368
- + "&page=" + encodeURIComponent(document.location.href);
1369
-
1370
- var sProdURL = "https://sapinsights.eu.qualtrics.com/jfe/form/SV_byI4QeS7Ic2Psyi" + sQueryParams,
1371
- sDevURL = "https://sapinsights.eu.qualtrics.com/jfe/form/SV_3Epqk1MLAUQVrwy" + sQueryParams,
1372
- bProd = !this.getModel("versionData").getProperty("/isDevEnv");
1373
-
1374
- // This survey could be displayed in a Qualtrics intercept
1375
- // dialog in the future, instead of a new tab
1376
- URLHelper.redirect(bProd ? sProdURL : sDevURL, true);
1377
- },
1378
-
1379
- longSurveyRedirect: function () {
1380
- var sBaseURL = "https://sapinsights.eu.qualtrics.com/jfe/form/SV_7X5P63Zg5zXC5zE",
1381
- sBaseQueryParams = "?product=SAPUI5%2FOpenUI5&product_filter=UI5&cluster=BTP&page=" + encodeURIComponent(document.location.href),
1382
- sProdURL = sBaseURL + sBaseQueryParams,
1383
- sDevURL = sBaseURL + sBaseQueryParams + "&Q_CHL=preview&Q_SurveyVersionID=current",
1384
- bProd = !this.getModel("versionData").getProperty("/isDevEnv");
1385
-
1386
- URLHelper.redirect(bProd ? sProdURL : sDevURL, true);
1387
- },
1388
-
1389
- setSurveyModelData: function () {
1390
- var oViewModel = this.getModel("appView"),
1391
- dCurrentDate = new Date(),
1392
- iCurrentYear = dCurrentDate.getFullYear(),
1393
- aDateSpans = [
1394
- [new Date(iCurrentYear, 1, 1), new Date(iCurrentYear, 1, 21)], // Feb 1-21
1395
- [new Date(iCurrentYear, 4, 1), new Date(iCurrentYear, 4, 21)], // May 1-21
1396
- [new Date(iCurrentYear, 7, 1), new Date(iCurrentYear, 7, 21)], // Aug 1-21
1397
- [new Date(iCurrentYear, 10, 1), new Date(iCurrentYear, 10, 21)] // Nov 1-21
1398
- ],
1399
- bDateInSpan = false,
1400
- sLastAvailableDate;
1401
-
1402
- aDateSpans.forEach(function (aDateSpan) {
1403
- var dMinDate = aDateSpan[0],
1404
- dMaxDate = aDateSpan[1];
1405
-
1406
- if (dCurrentDate >= dMinDate && dCurrentDate <= dMaxDate) {
1407
- bDateInSpan = true;
1408
- sLastAvailableDate = dMaxDate.toLocaleDateString();
1409
- return;
1410
- }
1411
- });
1284
+ + "&page=" + encodeURIComponent(document.location.href),
1285
+ sProdURL = sBaseUrl + sQueryParams,
1286
+ sDevURL = sBaseUrl + sQueryParams + "&Q_CHL=preview&Q_SurveyVersionID=current",
1287
+ bProd = !this.getModel("versionData").getProperty("/isDevEnv");
1288
+
1289
+ URLHelper.redirect(bProd ? sProdURL : sDevURL, true);
1290
+ },
1291
+
1292
+ setSurveyModelData: function () {
1293
+ var oViewModel = this.getModel("appView"),
1294
+ dCurrentDate = new Date(),
1295
+ iCurrentYear = dCurrentDate.getFullYear(),
1296
+ aDateSpans = [
1297
+ [new Date(iCurrentYear, 1, 1), new Date(iCurrentYear, 1, 21)], // Feb 1-21
1298
+ [new Date(iCurrentYear, 4, 1), new Date(iCurrentYear, 4, 21)], // May 1-21
1299
+ [new Date(iCurrentYear, 7, 1), new Date(iCurrentYear, 7, 21)], // Aug 1-21
1300
+ [new Date(iCurrentYear, 10, 1), new Date(iCurrentYear, 10, 21)] // Nov 1-21
1301
+ ],
1302
+ bDateInSpan = false,
1303
+ sLastAvailableDate;
1304
+
1305
+ aDateSpans.forEach(function (aDateSpan) {
1306
+ var dMinDate = aDateSpan[0],
1307
+ dMaxDate = aDateSpan[1];
1308
+
1309
+ if (dCurrentDate >= dMinDate && dCurrentDate <= dMaxDate) {
1310
+ bDateInSpan = true;
1311
+ sLastAvailableDate = dMaxDate.toLocaleDateString();
1312
+ return;
1313
+ }
1314
+ });
1412
1315
 
1413
- oViewModel.setProperty("/bShowLongSurvey", bDateInSpan);
1316
+ oViewModel.setProperty("/bShowLongSurvey", bDateInSpan);
1414
1317
 
1415
- if (bDateInSpan) {
1416
- oViewModel.setProperty("/sLongSurveyLastDate", sLastAvailableDate);
1417
- }
1418
- },
1419
-
1420
- addSurveyPopoverCloseBtn: function () {
1421
- var oResourceBundle = this.getModel("i18n").getResourceBundle(),
1422
- fCloseBtnHandler = this.closeSurveyPopover.bind(this),
1423
- oCloseButton = new Button({
1424
- text: oResourceBundle.getText("SURVEY_POPOVER_CLOSE_BTN"),
1425
- press: fCloseBtnHandler
1426
- });
1427
-
1428
- this._oSurveyPopover.setEndButton(oCloseButton);
1429
- },
1430
-
1431
- /**
1432
- * Event handler for the send feedback button
1433
- */
1434
- onFeedbackDialogSendPress: function () {
1435
- this.getFeedbackDialog().then(this.onFeedbackDialogSend.bind(this));
1436
- },
1437
-
1438
- onFeedbackDialogSend: function(oFeedbackDialog) {
1439
- var sVersion = this._getFullVersion(),
1440
- oVersionInfo = Version(sVersion),
1441
- oResourceBundle = this.getModel("i18n").getResourceBundle(),
1442
- data = {
1443
- "text": oFeedbackDialog.textInput.getValue(),
1444
- "rating": oFeedbackDialog.ratingStatus.value,
1445
- "major": oVersionInfo.getMajor(),
1446
- "minor": oVersionInfo.getMinor(),
1447
- "patch": oVersionInfo.getPatch(),
1448
- "distribution": this._getUI5Distribution(),
1449
- "snapshot": oVersionInfo.getSuffix().indexOf("SNAPSHOT") > -1,
1450
- "url": this._getCurrentURL(),
1451
- "page": this._getCurrentPageRelativeURL(),
1452
- "pageContext": oFeedbackDialog.contextCheckBox.getSelected()
1453
- };
1454
-
1455
- // send feedback
1456
- oFeedbackDialog.setBusyIndicatorDelay(0);
1457
- oFeedbackDialog.setBusy(true);
1458
-
1459
- jQuery.ajax({
1460
- url: FEEDBACK_URL,
1461
- type: "POST",
1462
- contentType: "application/json",
1463
- data: JSON.stringify(data)
1464
- }).
1465
- done(
1466
- function () {
1467
- MessageBox.success(oResourceBundle.getText("FEEDBACK_DIALOG_TEXT_SUCCESS"), {
1468
- title: oResourceBundle.getText("FEEDBACK_DIALOG_TITLE_SUCCESS")
1469
- });
1470
- oFeedbackDialog.reset();
1471
- oFeedbackDialog.close();
1472
- oFeedbackDialog.setBusy(false);
1473
- }
1474
- ).
1475
- fail(
1476
- function (oRequest, sStatus, sError) {
1477
- var sErrorDetails = sError; // + "\n" + oRequest.responseText;
1478
- MessageBox.error(oResourceBundle.getText("FEEDBACK_DIALOG_TEXT_ERROR") + sErrorDetails, {
1479
- title: oResourceBundle.getText("FEEDBACK_DIALOG_TITLE_ERROR")
1480
- });
1481
- oFeedbackDialog.setBusy(false);
1482
- }
1483
- );
1484
- },
1485
-
1486
- /**
1487
- * Event handler for the cancel feedback button
1488
- */
1489
- onFeedbackDialogCancel: function () {
1490
- this.getFeedbackDialog().then(function(oFeedbackDialog) {
1491
- oFeedbackDialog.reset();
1492
- oFeedbackDialog.close();
1493
- });
1494
- },
1495
-
1496
- /**
1497
- * Event handler for the toggle context link
1498
- */
1499
- onShowHideContextData: function () {
1500
- this.getFeedbackDialog().then(function(oFeedbackDialog) {
1501
- oFeedbackDialog.contextData.setVisible(!oFeedbackDialog.contextData.getVisible());
1502
- });
1503
- },
1504
-
1505
- /**
1506
- * Event handler for the context selection checkbox
1507
- */
1508
- onContextSelect: function() {
1509
- this.getFeedbackDialog().then(function(oFeedbackDialog) {
1510
- oFeedbackDialog.updateContextData();
1511
- });
1512
- },
1513
-
1514
- /**
1515
- * Event handler for the rating to update the label and the data
1516
- * @param {sap.ui.base.Event} oEvent
1517
- */
1518
- onPressRatingButton: function(oEvent) {
1519
- var oPressedButton = oEvent.getSource();
1520
-
1521
- this.getFeedbackDialog().then(function(oFeedbackDialog) {
1522
- oFeedbackDialog.ratingBar.forEach(function(oRatingBarElement) {
1523
- if (oPressedButton !== oRatingBarElement.button) {
1524
- oRatingBarElement.button.setPressed(false);
1525
- } else {
1526
- if (!oRatingBarElement.button.getPressed()) {
1527
- setRatingStatus(oFeedbackDialog, "None", "", 0);
1528
- } else {
1529
- switch (oRatingBarElement.status) {
1530
- case "Excellent":
1531
- setRatingStatus(oFeedbackDialog, "Success", oRatingBarElement.displayStatus, 5);
1532
- break;
1533
- case "Good":
1534
- setRatingStatus(oFeedbackDialog, "Success", oRatingBarElement.displayStatus, 4);
1535
- break;
1536
- case "Average":
1537
- setRatingStatus(oFeedbackDialog, "None", oRatingBarElement.displayStatus, 3);
1538
- break;
1539
- case "Poor":
1540
- setRatingStatus(oFeedbackDialog, "Warning", oRatingBarElement.displayStatus, 2);
1541
- break;
1542
- case "Very Poor":
1543
- setRatingStatus(oFeedbackDialog, "Error", oRatingBarElement.displayStatus, 1);
1544
- }
1545
- }
1546
- }
1547
- });
1318
+ if (bDateInSpan) {
1319
+ oViewModel.setProperty("/sLongSurveyLastDate", sLastAvailableDate);
1320
+ }
1321
+ },
1322
+
1323
+ addSurveyPopoverCloseBtn: function () {
1324
+ var oResourceBundle = this.getModel("i18n").getResourceBundle(),
1325
+ fCloseBtnHandler = this.closeSurveyPopover.bind(this),
1326
+ oCloseButton = new Button({
1327
+ text: oResourceBundle.getText("SURVEY_POPOVER_CLOSE_BTN"),
1328
+ press: fCloseBtnHandler
1548
1329
  });
1549
1330
 
1550
- function setRatingStatus(oFeedbackDialog, sState, sText, iValue) {
1551
- oFeedbackDialog.ratingStatus.setState(sState);
1552
- oFeedbackDialog.ratingStatus.setText(sText);
1553
- oFeedbackDialog.ratingStatus.value = iValue;
1554
- if (iValue) {
1555
- oFeedbackDialog.sendButton.setEnabled(true);
1556
- } else {
1557
- oFeedbackDialog.sendButton.setEnabled(false);
1558
- }
1559
- }
1560
- },
1331
+ this._oSurveyPopover.setEndButton(oCloseButton);
1332
+ },
1561
1333
 
1562
- onSearch : function (oEvent) {
1563
- var sQuery = encodeURIComponent( oEvent.getParameter("query") );
1564
- if (!sQuery) {
1565
- return;
1566
- }
1567
- this.getRouter().navTo("search", {searchParam: sQuery}, false);
1568
- this.oPicker.close();
1569
- },
1334
+ onSearch: function (oEvent) {
1335
+ var sQuery = encodeURIComponent(oEvent.getParameter("query"));
1570
1336
 
1571
- navToSearchResults : function (sCategory) {
1572
- var sQuery = this.getModel("searchData").getProperty("/query"),
1573
- oRouterParams = {searchParam: sQuery};
1337
+ if (!sQuery) {
1338
+ return;
1339
+ }
1574
1340
 
1575
- if (!sQuery) {
1576
- return;
1577
- }
1341
+ this.getRouter().navTo("search", { searchParam: sQuery }, false);
1342
+ this.oPicker.close();
1343
+ },
1578
1344
 
1579
- if (sCategory) {
1580
- oRouterParams["?options"] = {
1581
- category: sCategory
1582
- };
1583
- }
1345
+ navToSearchResults: function (sCategory) {
1346
+ var sQuery = this.getModel("searchData").getProperty("/query"),
1347
+ oRouterParams = { searchParam: sQuery };
1584
1348
 
1585
- this.getRouter().navTo("search", oRouterParams, true);
1586
- this.oPicker.close();
1587
- },
1349
+ if (!sQuery) {
1350
+ return;
1351
+ }
1352
+
1353
+ if (sCategory) {
1354
+ oRouterParams["?options"] = {
1355
+ category: sCategory
1356
+ };
1357
+ }
1588
1358
 
1589
- onSearchLiveChange: function(oEvent) {
1590
- var oModel = this.getModel("searchData"),
1359
+ this.getRouter().navTo("search", oRouterParams, true);
1360
+ this.oPicker.close();
1361
+ },
1362
+
1363
+ /**
1364
+ * Handles the live change event of the search field.
1365
+ * Performs a search based on the entered query and updates the search results.
1366
+ * If the query is empty, hides the search picker.
1367
+ *
1368
+ * @param {Object} oEvent - The live change event object.
1369
+ * @returns {void}
1370
+ */
1371
+ onSearchLiveChange: function (oEvent) {
1372
+ var oModel = this.getModel("searchData"),
1591
1373
  sQuery = oEvent.getParameter("newValue"),
1592
1374
  sPreferencedCategory = oModel.getProperty("/preferencedCategory"),
1593
1375
  bIncludeDeprecated = oModel.getProperty("/includeDeprecated");
1594
1376
 
1595
- this.openSearchPicker();
1596
-
1597
- if (this.highlighter) {
1598
- this.highlighter.highlight(sQuery);
1377
+ // Handle the case when the user deletes the query and the search picker is open
1378
+ // Only on desktop, because on mobile we don't want to close the picker
1379
+ if (!sQuery && Device.system.desktop) {
1380
+ if (this.oPicker.isOpen()) {
1381
+ this.oPicker.close();
1599
1382
  }
1600
1383
 
1601
- oModel.setProperty("/query",sQuery);
1602
- SearchUtil.search(sQuery, {
1603
- preferencedCategory: sPreferencedCategory,
1604
- includeDeprecated: bIncludeDeprecated
1605
- }).then(function(result) {
1606
- oModel.setProperty("/matches", result.matches);
1607
- });
1608
- },
1609
-
1610
- onHeaderResize: function (oEvent) {
1611
- var iWidth = oEvent.size.width,
1612
- bPhoneSize = Device.system.phone || iWidth < Device.media._predefinedRangeSets[Device.media.RANGESETS.SAP_STANDARD_EXTENDED].points[0],
1613
- oViewModel = this.getModel("appView"),
1614
- bSearchMode = oViewModel.getProperty("/bSearchMode");
1615
-
1616
- // Check for a change in "bPhoneSize" property in order to
1617
- // reduce number of method calls
1618
- if (bPhoneSize !== oViewModel.getProperty("/bPhoneSize")) {
1619
- oViewModel.setProperty("/bPhoneSize", bPhoneSize);
1620
- this._updateVersionSwitchVisibility();
1621
- this._tabHeader.setVisible(!bPhoneSize);
1622
- this._selectHeader.setVisible(bPhoneSize);
1623
- }
1384
+ return;
1385
+ }
1624
1386
 
1625
- // The select should be first set to visible on phone size, and after that
1626
- // set to false if search is opened for correct calculation of the search width.
1627
- if (bSearchMode) {
1628
- this._selectHeader.setVisible(false);
1629
- }
1630
- },
1387
+ this.openSearchPicker();
1631
1388
 
1632
- _onOrientationChange: function() {
1633
- this.getModel("appView").setProperty("/bLandscape", Device.orientation.landscape);
1634
- },
1389
+ if (this.highlighter) {
1390
+ this.highlighter.highlight(sQuery);
1391
+ }
1635
1392
 
1636
- onToggleSearchMode : function(oEvent) {
1637
- var bSearchMode = oEvent.getParameter("isOpen"),
1638
- oViewModel = this.getModel("appView"),
1639
- bPhoneSize = oViewModel.getProperty("/bPhoneSize");
1640
- oViewModel.setProperty("/bSearchMode", bSearchMode);
1641
-
1642
- if (bSearchMode) {
1643
- // Init is called *before* the user entered a search term
1644
- // in order to start the download of the search index
1645
- // in the *earliest* point in time
1646
- SearchUtil.init();
1647
-
1648
- setTimeout(function () {
1649
- if (Device.system.desktop) {
1650
- this._oView.byId("searchControl").getAggregation("_searchField").getFocusDomRef().focus();
1651
- } else {
1652
- this.openSearchPicker();
1653
- }
1654
- }.bind(this), 0);
1393
+ oModel.setProperty("/query", sQuery);
1394
+ SearchUtil.search(sQuery, {
1395
+ preferencedCategory: sPreferencedCategory,
1396
+ includeDeprecated: bIncludeDeprecated
1397
+ }).then(function (result) {
1398
+ oModel.setProperty("/matches", result.matches);
1399
+ });
1400
+ },
1401
+
1402
+ /**
1403
+ * Handles the resize event of the page.
1404
+ *
1405
+ * This function adjusts the view model properties based on the page width,
1406
+ * and performs additional actions for a better user experience.
1407
+ *
1408
+ * @param {Object} oEvent - The resize event object.
1409
+ * @returns {void}
1410
+ */
1411
+ onPageResize: function (oEvent) {
1412
+ var iWidth = oEvent.size.width,
1413
+ bDesktopSize = iWidth >= Device.media._predefinedRangeSets[Device.media.RANGESETS.SAP_STANDARD_EXTENDED].points[1], // 1024px
1414
+ bPhoneSize = iWidth < Device.media._predefinedRangeSets[Device.media.RANGESETS.SAP_STANDARD_EXTENDED].points[0], // 600px
1415
+ oViewModel = this.getModel("appView");
1416
+
1417
+ if (bPhoneSize !== oViewModel.getProperty("/bPhoneSize")) {
1418
+ oViewModel.setProperty("/bPhoneSize", bPhoneSize);
1419
+
1420
+ // When page is resized from desktop to phone size, hide side navigation initially for better UX
1421
+ this._demoKitPage.setSideExpanded(false);
1422
+ }
1655
1423
 
1656
- if (bPhoneSize) {
1657
- this._selectHeader.setVisible(false);
1658
- }
1659
- } else if (bPhoneSize) {
1660
- this._selectHeader.setVisible(true);
1661
- }
1662
- },
1663
-
1664
- /**
1665
- * Register Feedback rating icons
1666
- * @private
1667
- */
1668
- _registerFeedbackRatingIcons: function () {
1669
- IconPool.addIcon("icon-face-very-bad", "FeedbackRatingFaces", {
1670
- fontFamily: "FeedbackRatingFaces",
1671
- content: "E086",
1672
- suppressMirroring: true
1673
- });
1674
- IconPool.addIcon("icon-face-bad", "FeedbackRatingFaces", {
1675
- fontFamily: "FeedbackRatingFaces",
1676
- content: "E087",
1677
- suppressMirroring: true
1678
- });
1679
- IconPool.addIcon("icon-face-neutral", "FeedbackRatingFaces", {
1680
- fontFamily: "FeedbackRatingFaces",
1681
- content: "E089",
1682
- suppressMirroring: true
1683
- });
1684
- IconPool.addIcon("icon-face-happy", "FeedbackRatingFaces", {
1685
- fontFamily: "FeedbackRatingFaces",
1686
- content: "E08B",
1687
- suppressMirroring: true
1688
- });
1689
- IconPool.addIcon("icon-face-very-happy", "FeedbackRatingFaces", {
1690
- fontFamily: "FeedbackRatingFaces",
1691
- content: "E08C",
1692
- suppressMirroring: true
1693
- });
1694
- },
1695
-
1696
- _getCurrentYear: function () {
1697
- return new Date().getFullYear();
1698
- },
1699
-
1700
- _getCurrentQuarter: function () {
1701
- var oDate = new Date(),
1702
- iMonth = oDate.getMonth(),
1703
- iQuarter = Math.floor(iMonth / 3) + 1;
1704
-
1705
- return iQuarter;
1706
- },
1707
-
1708
- /**
1709
- * Filters versions in the given JSON object that have passed their end of cloud maintenance date.
1710
- * @function
1711
- * @param {Object} oVersionOverviewJson - A JSON object containing version information.
1712
- * @returns {Array} An array of versions that have not passed their end of cloud maintenance date.
1713
- */
1714
- _filterVersionsPastEOCP: function (oVersionOverviewJson) {
1715
- var aVersions = oVersionOverviewJson.patches;
1716
-
1717
- return aVersions.filter(function (oVersion) {
1718
- var sVersionEOCP = oVersion.extended_eocp || oVersion.eocp || "";
1719
- // Handle the case when eocp is not defined and include it in the list
1720
- if (!sVersionEOCP) {
1721
- return true;
1722
- }
1723
- // Handle the case when eocp is not in the "quarter/year" format (e.g., "To Be Determined")
1724
- // Treat it as if it hasn't passed its end of cloud maintenance date and include it in the list
1725
- var isQuarterYearFormat = /^Q[1-4]\/\d{4}$/i.test(sVersionEOCP);
1726
- if (!isQuarterYearFormat) {
1727
- return true;
1728
- }
1729
- // Otherwise, check if the version has passed its end of cloud maintenance date
1730
- var iQuarter = Number(sVersionEOCP.substring(1, 2)),
1731
- iYear = Number(sVersionEOCP.substring(3));
1424
+ if (bDesktopSize !== oViewModel.getProperty("/bDesktopSize")) {
1425
+ oViewModel.setProperty("/bDesktopSize", bDesktopSize);
1732
1426
 
1733
- return iYear > this._getCurrentYear() ||
1734
- iYear === this._getCurrentYear() && iQuarter >= this._getCurrentQuarter();
1735
- }.bind(this));
1736
- },
1737
-
1738
- _processVersionOverview: function(oVersionOverviewJson) {
1739
- var aVersions = oVersionOverviewJson.versions,
1740
- aResult = [];
1741
-
1742
- if (Array.isArray(aVersions)) {
1743
- aVersions = aVersions.filter(function(oVersion) {
1744
- return !!oVersion.hidden;
1745
- }).forEach(function(oVersion) {
1746
- var aHiddenVersions = oVersion.hidden.split(",").map(function(sVersion) {
1747
- return sVersion.trim();
1748
- });
1427
+ setTimeout(function () {
1428
+ this._updateSearchFieldState();
1429
+ }.bind(this), 0);
1430
+ }
1431
+ },
1749
1432
 
1750
- aResult = aResult.concat(aHiddenVersions);
1751
- });
1752
- }
1433
+ onSideNavigationButtonPress: function () {
1434
+ this._demoKitPage.setSideExpanded(!this._demoKitPage.getSideExpanded());
1435
+ },
1753
1436
 
1754
- return aResult;
1755
- },
1437
+ _onOrientationChange: function () {
1438
+ this.getModel("appView").setProperty("/bLandscape", Device.orientation.landscape);
1439
+ },
1756
1440
 
1757
- _processNeoAppJSON: function(oNeoAppJson) {
1758
- var oVersionModel = this.getModel("versionData"),
1759
- bIsInternal = oVersionModel.getProperty("/isInternal"),
1760
- bIsSnapshotVersion = oVersionModel.getProperty("/isSnapshotVersion"),
1761
- aRoutes = [];
1441
+ onToggleSearchMode: function (oEvent) {
1442
+ var bSearchMode = oEvent.getParameter("isOpen"),
1443
+ oViewModel = this.getModel("appView");
1762
1444
 
1763
- if (!(oNeoAppJson && oNeoAppJson.routes)) {
1764
- Log.warning("No versions were found");
1765
- return;
1445
+ // This flag is used to hide action buttons when search is opened
1446
+ oViewModel.setProperty("/bSearchMode", bSearchMode);
1447
+
1448
+ if (bSearchMode) {
1449
+ setTimeout(function () {
1450
+ if (Device.system.desktop) {
1451
+ this._oView.byId("searchControl").getAggregation("_searchField").getFocusDomRef().focus();
1452
+ } else {
1453
+ this.openSearchPicker();
1454
+ }
1455
+ }.bind(this), 0);
1456
+ }
1457
+ },
1458
+
1459
+ _getCurrentYear: function () {
1460
+ return new Date().getFullYear();
1461
+ },
1462
+
1463
+ _getCurrentQuarter: function () {
1464
+ var oDate = new Date(),
1465
+ iMonth = oDate.getMonth(),
1466
+ iQuarter = Math.floor(iMonth / 3) + 1;
1467
+
1468
+ return iQuarter;
1469
+ },
1470
+
1471
+ /**
1472
+ * Filters versions in the given JSON object that have passed their end of cloud maintenance date.
1473
+ *
1474
+ * @param {Object} oVersionOverviewJson - A JSON object containing version information.
1475
+ * @returns {Array} An array of versions that have not passed their end of cloud maintenance date.
1476
+ */
1477
+ _filterVersionsPastEOCP: function (oVersionOverviewJson) {
1478
+ var aVersions = oVersionOverviewJson.patches;
1479
+
1480
+ return aVersions.filter(function (oVersion) {
1481
+ var sVersionEOCP = oVersion.extended_eocp || oVersion.eocp || "";
1482
+ // Handle the case when eocp is not defined and include it in the list
1483
+ if (!sVersionEOCP) {
1484
+ return true;
1485
+ }
1486
+ // Handle the case when eocp is not in the "quarter/year" format (e.g., "To Be Determined")
1487
+ // Treat it as if it hasn't passed its end of cloud maintenance date and include it in the list
1488
+ var isQuarterYearFormat = /^Q[1-4]\/\d{4}$/i.test(sVersionEOCP);
1489
+ if (!isQuarterYearFormat) {
1490
+ return true;
1766
1491
  }
1492
+ // Otherwise, check if the version has passed its end of cloud maintenance date
1493
+ var iQuarter = Number(sVersionEOCP.substring(1, 2)),
1494
+ iYear = Number(sVersionEOCP.substring(3));
1495
+
1496
+ return iYear > this._getCurrentYear() ||
1497
+ iYear === this._getCurrentYear() && iQuarter >= this._getCurrentQuarter();
1498
+ }.bind(this));
1499
+ },
1500
+
1501
+ _processVersionOverview: function (oVersionOverviewJson) {
1502
+ var aVersions = oVersionOverviewJson.versions,
1503
+ aResult = [];
1504
+
1505
+ if (Array.isArray(aVersions)) {
1506
+ aVersions = aVersions.filter(function (oVersion) {
1507
+ return !!oVersion.hidden;
1508
+ }).forEach(function (oVersion) {
1509
+ var aHiddenVersions = oVersion.hidden.split(",").map(function (sVersion) {
1510
+ return sVersion.trim();
1511
+ });
1767
1512
 
1768
- aRoutes = oNeoAppJson.routes;
1513
+ aResult = aResult.concat(aHiddenVersions);
1514
+ });
1515
+ }
1769
1516
 
1770
- // Current version would be displayed for a second time as the last element,
1771
- // therefore we should skip it to avoid duplicate items in the dialog.
1772
- aRoutes.pop();
1517
+ return aResult;
1518
+ },
1773
1519
 
1774
- // Store needed data
1775
- if (!bIsInternal && !bIsSnapshotVersion) {
1776
- aRoutes = aRoutes.filter(function(oRoute) {
1777
- return oRoute.target.version.indexOf("-beta") === -1;
1778
- });
1779
- }
1520
+ _processNeoAppJSON: function (oNeoAppJson) {
1521
+ var oVersionModel = this.getModel("versionData"),
1522
+ bIsInternal = oVersionModel.getProperty("/isInternal"),
1523
+ bIsSnapshotVersion = oVersionModel.getProperty("/isSnapshotVersion"),
1524
+ aRoutes = [];
1780
1525
 
1781
- aRoutes = aRoutes.map(function(oRoute) {
1782
- var oVersion = Version(oRoute.target.version),
1783
- oVersionSummary = {};
1526
+ if (!(oNeoAppJson && oNeoAppJson.routes)) {
1527
+ Log.warning("No versions were found");
1528
+ return;
1529
+ }
1784
1530
 
1785
- // Add the following properties, in order use them for grouping later
1786
- oVersionSummary.patchVersion = oVersion.getPatch(); // E.g: Extract 5 from "1.52.5"
1787
- oVersionSummary.groupTitle = oVersion.getMajor() + "." + oVersion.getMinor(); // E.g: Extract "1.52" from "1.52.5"
1788
- oVersionSummary.version = oVersion.toString();
1789
- oVersionSummary.path = oRoute.path;
1531
+ aRoutes = oNeoAppJson.routes;
1790
1532
 
1791
- return oVersionSummary;
1533
+ // Current version would be displayed for a second time as the last element,
1534
+ // therefore we should skip it to avoid duplicate items in the dialog.
1535
+ aRoutes.pop();
1536
+
1537
+ // Store needed data
1538
+ if (!bIsInternal && !bIsSnapshotVersion) {
1539
+ aRoutes = aRoutes.filter(function (oRoute) {
1540
+ return oRoute.target.version.indexOf("-beta") === -1;
1792
1541
  });
1542
+ }
1793
1543
 
1794
- return aRoutes;
1795
- },
1796
-
1797
- _requestVersionInfo: function () {
1798
- Promise.all([
1799
- jQuery.ajax(sNeoAppJsonPath),
1800
- jQuery.ajax(sVersionOverviewJsonPath)
1801
- ]).then(
1802
- // Success
1803
- function(oValues) {
1804
- var aNeoAppVersions = this._processNeoAppJSON(oValues[0]),
1805
- aHiddenValues = this._processVersionOverview(oValues[1]),
1806
- aFilteredVersionsEOCP = this._filterVersionsPastEOCP(oValues[1]);
1807
-
1808
- if (Array.isArray(aNeoAppVersions)) {
1809
- aNeoAppVersions = aNeoAppVersions.filter(function(oVersion) {
1810
- return aHiddenValues.indexOf(oVersion.version) === -1;
1811
- });
1544
+ aRoutes = aRoutes.map(function (oRoute) {
1545
+ var oVersion = Version(oRoute.target.version),
1546
+ oVersionSummary = {};
1547
+
1548
+ // Add the following properties, in order use them for grouping later
1549
+ oVersionSummary.patchVersion = oVersion.getPatch(); // E.g: Extract 5 from "1.52.5"
1550
+ oVersionSummary.groupTitle = oVersion.getMajor() + "." + oVersion.getMinor(); // E.g: Extract "1.52" from "1.52.5"
1551
+ oVersionSummary.version = oVersion.toString();
1552
+ oVersionSummary.path = oRoute.path;
1553
+
1554
+ return oVersionSummary;
1555
+ });
1556
+
1557
+ return aRoutes;
1558
+ },
1559
+
1560
+ _requestVersionInfo: function () {
1561
+ Promise.all([
1562
+ jQuery.ajax(sNeoAppJsonPath),
1563
+ jQuery.ajax(sVersionOverviewJsonPath)
1564
+ ]).then(
1565
+ // Success
1566
+ function (oValues) {
1567
+ var aNeoAppVersions = this._processNeoAppJSON(oValues[0]),
1568
+ aHiddenValues = this._processVersionOverview(oValues[1]),
1569
+ aFilteredVersionsEOCP = this._filterVersionsPastEOCP(oValues[1]);
1570
+
1571
+ if (Array.isArray(aNeoAppVersions)) {
1572
+ aNeoAppVersions = aNeoAppVersions.filter(function (oVersion) {
1573
+ return aHiddenValues.indexOf(oVersion.version) === -1;
1574
+ });
1812
1575
 
1813
- // Filters "aNeoAppVersions" array by removing elements
1814
- // that don't have a matching version in "aFilteredVersionsEOCP" array.
1815
- aNeoAppVersions = aNeoAppVersions.filter(function(oVersion) {
1816
- return aFilteredVersionsEOCP.find(function(oFilteredVersion) {
1817
- return oFilteredVersion.version === oVersion.version;
1818
- });
1576
+ // Filters "aNeoAppVersions" array by removing elements
1577
+ // that don't have a matching version in "aFilteredVersionsEOCP" array.
1578
+ aNeoAppVersions = aNeoAppVersions.filter(function (oVersion) {
1579
+ return aFilteredVersionsEOCP.find(function (oFilteredVersion) {
1580
+ return oFilteredVersion.version === oVersion.version;
1819
1581
  });
1582
+ });
1820
1583
 
1821
- this._aNeoAppVersions = aNeoAppVersions;
1822
- // Make version select visible
1823
- this._updateVersionSwitchVisibility();
1824
- this.getModel("versionData").setProperty("/latestVersion", this._aNeoAppVersions[0].version);
1825
- } else {
1826
- this._aNeoAppVersions = [];
1827
- Log.warning("No multi-version environment detected");
1828
- }
1829
- }.bind(this),
1830
- // Error
1831
- function() {
1832
- Log.warning("No neo-app.json or versionoverview.json was detected");
1584
+ this._aNeoAppVersions = aNeoAppVersions;
1585
+ // Make version select visible
1586
+ this._updateVersionSwitchVisibility();
1587
+ this.getModel("versionData").setProperty("/latestVersion", this._aNeoAppVersions[0].version);
1588
+ } else {
1589
+ this._aNeoAppVersions = [];
1590
+ Log.warning("No multi-version environment detected");
1833
1591
  }
1834
- );
1835
- },
1836
-
1837
- _getFullVersion: function () {
1838
- return this.getModel("versionData").getProperty("/fullVersion");
1839
- },
1840
-
1841
- _getUI5Version: function () {
1842
- return ResourcesUtil.getResourcesVersion() ?
1843
- window.sessionStorage.getItem("versionPrefixPath") : this.getModel("versionData").getProperty("/version");
1844
- },
1845
-
1846
- _getUI5VersionGav: function () {
1847
- return this.getModel("versionData").getProperty("/versionGav");
1848
- },
1849
-
1850
- _getUI5Distribution: function () {
1851
- var sVersionGav = this._getUI5VersionGav();
1852
- var sUI5Distribution = "SAPUI5";
1853
- if (sVersionGav && /openui5/i.test(sVersionGav)) {
1854
- sUI5Distribution = "OpenUI5";
1855
- }
1856
- return sUI5Distribution;
1857
- },
1858
-
1859
- _getUI5VersionType: function() {
1860
- var oVersionModel = this.getModel("versionData"),
1861
- bIsInternal = oVersionModel.getProperty("/isInternal"),
1862
- bIsSnapshotVersion = oVersionModel.getProperty("/isSnapshotVersion"),
1863
- sVersionType;
1864
-
1865
- switch (true) {
1866
- case bIsSnapshotVersion && bIsInternal:
1867
- sVersionType = "InternalSnapshot";
1868
- break;
1869
- case bIsInternal:
1870
- sVersionType = "Internal";
1871
- break;
1872
- case bIsSnapshotVersion:
1873
- sVersionType = "Snapshot";
1874
- break;
1875
- default:
1876
- sVersionType = "Release";
1592
+ }.bind(this),
1593
+ // Error
1594
+ function () {
1595
+ Log.warning("No neo-app.json or versionoverview.json was detected");
1877
1596
  }
1597
+ );
1598
+ },
1599
+
1600
+ _getFullVersion: function () {
1601
+ return this.getModel("versionData").getProperty("/fullVersion");
1602
+ },
1603
+
1604
+ _getUI5Version: function () {
1605
+ return ResourcesUtil.getResourcesVersion()
1606
+ ? window.sessionStorage.getItem("versionPrefixPath")
1607
+ : this.getModel("versionData").getProperty("/version");
1608
+ },
1609
+
1610
+ _getUI5VersionGav: function () {
1611
+ return this.getModel("versionData").getProperty("/versionGav");
1612
+ },
1613
+
1614
+ _getUI5Distribution: function () {
1615
+ var sVersionGav = this._getUI5VersionGav(),
1616
+ sUI5Distribution = "SAPUI5";
1617
+
1618
+ if (sVersionGav && /openui5/i.test(sVersionGav)) {
1619
+ sUI5Distribution = "OpenUI5";
1620
+ }
1621
+
1622
+ return sUI5Distribution;
1623
+ },
1624
+
1625
+ _getUI5VersionType: function () {
1626
+ var oVersionModel = this.getModel("versionData"),
1627
+ bIsInternal = oVersionModel.getProperty("/isInternal"),
1628
+ bIsSnapshotVersion = oVersionModel.getProperty("/isSnapshotVersion"),
1629
+ sVersionType;
1630
+
1631
+ switch (true) {
1632
+ case bIsSnapshotVersion && bIsInternal:
1633
+ sVersionType = "InternalSnapshot";
1634
+ break;
1635
+ case bIsInternal:
1636
+ sVersionType = "Internal";
1637
+ break;
1638
+ case bIsSnapshotVersion:
1639
+ sVersionType = "Snapshot";
1640
+ break;
1641
+ default:
1642
+ sVersionType = "Release";
1643
+ }
1644
+
1645
+ return sVersionType;
1646
+ },
1647
+
1648
+ _getCurrentPageRelativeURL: function () {
1649
+ var currentLocation = window.location;
1650
+ return currentLocation.pathname + currentLocation.hash + currentLocation.search;
1651
+ },
1652
+
1653
+ _getCurrentURL: function () {
1654
+ var currentLocation = window.location;
1655
+ return currentLocation.href;
1656
+ },
1657
+
1658
+ _setHeaderSelectedKey: function (sKey) {
1659
+ this._demoKitSubHeader.setSelectedKey(sKey);
1660
+ this._demoKitSideNavigation.setSelectedKey(sKey);
1661
+ this._sKey = sKey;
1662
+ },
1663
+
1664
+ /**
1665
+ * Handles the theme changed event.
1666
+ *
1667
+ * @param {string} sChannelId - The channel ID of the event.
1668
+ * @param {string} sEventId - The event ID.
1669
+ * @param {Object} oData - The data associated with the event.
1670
+ * @returns {void}
1671
+ */
1672
+ _onThemeChanged: function (sChannelId, sEventId, oData) {
1673
+ var oViewModel = this.getModel("appView"),
1674
+ sActiveTheme = oData.sThemeActive,
1675
+ bDarkThemeActive = sActiveTheme && (sActiveTheme.includes("dark") || sActiveTheme.includes("hcb"));
1676
+
1677
+ oViewModel.setProperty("/bDarkThemeActive", bDarkThemeActive);
1678
+ },
1679
+
1680
+ /**
1681
+ * Updates the state of the search field.
1682
+ * Expand/collapse the search field depending on the screen size.
1683
+ * Hide/show header button actions if the search field is expanded/collapsed.
1684
+ *
1685
+ * @returns {void}
1686
+ */
1687
+ _updateSearchFieldState: function () {
1688
+ var oViewModel = this.getModel("appView"),
1689
+ bDesktopSize = oViewModel.getProperty("/bDesktopSize"),
1690
+ oClosingButton = this.byId("searchControl").getAggregation("_closingButton");
1691
+
1692
+ if (bDesktopSize) {
1693
+ oViewModel.setProperty("/bSearchMode", false);
1694
+ oClosingButton.setVisible(false);
1695
+ } else {
1696
+ oClosingButton.setVisible(true);
1697
+ }
1698
+ },
1699
+
1700
+ /**
1701
+ * Retrieves the keys of sub-menu items from 'Tools' drop-down menu.
1702
+ *
1703
+ * @returns {Array} An array containing the keys of the sub-menu items.
1704
+ */
1705
+ _getHeaderSubMenuItemKeys: function () {
1706
+ var aSubHeaderSubmenuItemKeys = [];
1707
+
1708
+ this._demoKitSubHeader.getTabFilters()
1709
+ .find(function (oTab) {
1710
+ return oTab.getId().includes("toolsTab");
1711
+ })
1712
+ .getItems().forEach(function (oItem) {
1713
+ aSubHeaderSubmenuItemKeys.push(oItem.getKey());
1714
+ });
1878
1715
 
1879
- return sVersionType;
1880
- },
1881
-
1882
- _getCurrentPageRelativeURL: function () {
1883
- var currentLocation = window.location;
1884
- return currentLocation.pathname + currentLocation.hash + currentLocation.search;
1885
- },
1886
-
1887
- _getCurrentURL: function () {
1888
- var currentLocation = window.location;
1889
- return currentLocation.href;
1890
- },
1891
-
1892
- _setHeaderSelectedKey: function(sKey) {
1893
- this._selectHeader.setSelectedKey(sKey);
1894
- this._tabHeader.setSelectedKey(sKey);
1895
- this._sKey = sKey;
1896
- },
1897
-
1898
- onCloseImportantMessage: function (oEvent) {
1899
- var aMessageCookie = this._oConfigUtil.getCookieValue(this._oCookieNames["DEMOKIT_IMPORTANT_MESSAGES_READ"])
1900
- .split(",").filter(function(id) { return id !== ''; }),
1901
- oCustomData = oEvent.getSource().getCustomData().find(function(oCustomData) {
1902
- return oCustomData.getKey() === "messageID";
1903
- }),
1904
- oId = oCustomData.getValue();
1905
-
1906
- aMessageCookie.push(oId);
1907
- this._oConfigUtil.setCookie(this._oCookieNames["DEMOKIT_IMPORTANT_MESSAGES_READ"], aMessageCookie.join(","));
1908
-
1909
- this._updateMessagesModel(this.getModel("messagesData").getData());
1716
+ return aSubHeaderSubmenuItemKeys;
1717
+ },
1718
+
1719
+ /**
1720
+ * Event handler for selecting a sub-menu item from 'Tools' drop-down menu.
1721
+ * Opens a new tab with the corresponding URL.
1722
+ *
1723
+ * @param {string} sKey - The key of the selected item.
1724
+ * @returns {void}
1725
+ */
1726
+ _headerItemSelectHandler: function (sKey) {
1727
+ var items = [
1728
+ { key: "fioriTools", url: "https://help.sap.com/viewer/product/SAP_FIORI_tools/Latest/en-US" },
1729
+ { key: "iconExplorer", url: "test-resources/sap/m/demokit/iconExplorer/webapp/index.html" },
1730
+ { key: "ui5Inspector", url: "https://sap.github.io/ui5-inspector/" },
1731
+ { key: "ui5Tooling", url: "https://sap.github.io/ui5-tooling/stable/" }
1732
+ ];
1733
+
1734
+ var selectedItem = items.find(function (item) { return item.key === sKey; });
1735
+ if (selectedItem) {
1736
+ URLHelper.redirect(selectedItem.url, true);
1910
1737
  }
1911
- });
1912
- }
1913
- );
1738
+ },
1739
+
1740
+ /**
1741
+ * Sets the selected section title based on the provided key.
1742
+ *
1743
+ * @param {string} sKey - The key of the selected section.
1744
+ * @returns {void}
1745
+ */
1746
+ _setSelectedSectionTitle: function (sKey) {
1747
+ var oViewModel = this.getModel("appView"),
1748
+ oResourceBundle = this.getModel("i18n").getResourceBundle();
1749
+
1750
+ var items = [
1751
+ { key: "home", text: oResourceBundle.getText("APP_TABHEADER_ITEM_HOME") },
1752
+ { key: "topic", text: oResourceBundle.getText("APP_TABHEADER_ITEM_DOCUMENTATION") },
1753
+ { key: "api", text: oResourceBundle.getText("APP_TABHEADER_ITEM_API_REFERENCE") },
1754
+ { key: "controls", text: oResourceBundle.getText("APP_TABHEADER_ITEM_SAMPLES") },
1755
+ { key: "demoapps", text: oResourceBundle.getText("APP_TABHEADER_ITEM_DEMO_APPS") },
1756
+ { key: "tools", text: oResourceBundle.getText("APP_TABHEADER_ITEM_TOOLS") }
1757
+ ];
1758
+
1759
+ var selectedItem = items.find(function (item) { return item.key === sKey; });
1760
+ oViewModel.setProperty("/selectedSectionTitle", selectedItem.text);
1761
+ },
1762
+
1763
+ /**
1764
+ * Tweak the appearance of the version switch button.
1765
+ * This function adds a CSS class to the button's text content DOM element
1766
+ * to customize its styling after rendering.
1767
+ *
1768
+ * @returns {void} This function does not return a value.
1769
+ */
1770
+ _adjustVersionSwitchButton: function () {
1771
+ var oVersionSwitchButton = this.byId("versionSwitchButton");
1772
+
1773
+ if (oVersionSwitchButton) {
1774
+ oVersionSwitchButton.addEventDelegate({
1775
+ onAfterRendering: function () {
1776
+ var oVersionSwitchButtonDomRef = oVersionSwitchButton.getDomRef(),
1777
+ oVersionSwitchButtonTextContentDomRef = oVersionSwitchButtonDomRef.querySelector(".sapMBtnContent");
1778
+
1779
+ if (oVersionSwitchButtonTextContentDomRef) {
1780
+ if (!oVersionSwitchButtonTextContentDomRef.classList.contains("sapUiDemoKitHeaderActionsVersionSwitchTextContent")) {
1781
+ oVersionSwitchButtonTextContentDomRef.classList.add("sapUiDemoKitHeaderActionsVersionSwitchTextContent");
1782
+ }
1783
+ }
1784
+ }
1785
+ });
1786
+ }
1787
+ }
1788
+ });
1789
+ });