@sapui5/sap.suite.ui.commons 1.151.0 → 1.152.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 (61) hide show
  1. package/package.json +1 -1
  2. package/src/sap/suite/ui/commons/.library +1 -1
  3. package/src/sap/suite/ui/commons/AriaProperties.js +1 -1
  4. package/src/sap/suite/ui/commons/CalculationBuilder.js +1 -1
  5. package/src/sap/suite/ui/commons/CalculationBuilderExpression.js +1 -1
  6. package/src/sap/suite/ui/commons/CalculationBuilderFunction.js +1 -1
  7. package/src/sap/suite/ui/commons/CalculationBuilderGroup.js +1 -1
  8. package/src/sap/suite/ui/commons/CalculationBuilderItem.js +1 -1
  9. package/src/sap/suite/ui/commons/CalculationBuilderValidationResult.js +1 -1
  10. package/src/sap/suite/ui/commons/CalculationBuilderVariable.js +1 -1
  11. package/src/sap/suite/ui/commons/CloudFilePicker.js +1 -1
  12. package/src/sap/suite/ui/commons/MicroProcessFlow.js +1 -1
  13. package/src/sap/suite/ui/commons/MicroProcessFlowItem.js +1 -1
  14. package/src/sap/suite/ui/commons/TimelineNavigator.js +12 -9
  15. package/src/sap/suite/ui/commons/collaboration/UniversalCollaborationBar.js +475 -361
  16. package/src/sap/suite/ui/commons/flexibility/changeHandler/PropertyChangeMapper.js +1 -1
  17. package/src/sap/suite/ui/commons/imageeditor/CropCustomShapeHistoryItem.js +1 -1
  18. package/src/sap/suite/ui/commons/imageeditor/CropEllipseHistoryItem.js +1 -1
  19. package/src/sap/suite/ui/commons/imageeditor/CropRectangleHistoryItem.js +1 -1
  20. package/src/sap/suite/ui/commons/imageeditor/CustomSizeItem.js +1 -1
  21. package/src/sap/suite/ui/commons/imageeditor/FilterHistoryItem.js +1 -1
  22. package/src/sap/suite/ui/commons/imageeditor/FlipHistoryItem.js +1 -1
  23. package/src/sap/suite/ui/commons/imageeditor/HistoryItem.js +1 -1
  24. package/src/sap/suite/ui/commons/imageeditor/ImageEditor.js +1 -1
  25. package/src/sap/suite/ui/commons/imageeditor/ImageEditorContainer.js +1 -1
  26. package/src/sap/suite/ui/commons/imageeditor/ImageEditorResponsiveContainer.js +1 -1
  27. package/src/sap/suite/ui/commons/imageeditor/ResizeHistoryItem.js +1 -1
  28. package/src/sap/suite/ui/commons/imageeditor/RotateHistoryItem.js +1 -1
  29. package/src/sap/suite/ui/commons/library.js +1 -1
  30. package/src/sap/suite/ui/commons/messagebundle_mk.properties +1 -1
  31. package/src/sap/suite/ui/commons/networkgraph/ElementBase.js +7 -2
  32. package/src/sap/suite/ui/commons/networkgraph/Graph.js +9 -4
  33. package/src/sap/suite/ui/commons/networkgraph/Group.js +1 -1
  34. package/src/sap/suite/ui/commons/networkgraph/Line.js +11 -0
  35. package/src/sap/suite/ui/commons/networkgraph/Node.js +1 -1
  36. package/src/sap/suite/ui/commons/networkgraph/Tooltip.js +3 -1
  37. package/src/sap/suite/ui/commons/networkgraph/util/ConnectionPathUtils.js +14 -66
  38. package/src/sap/suite/ui/commons/statusindicator/Circle.js +1 -1
  39. package/src/sap/suite/ui/commons/statusindicator/CustomShape.js +1 -1
  40. package/src/sap/suite/ui/commons/statusindicator/DiscreteThreshold.js +1 -1
  41. package/src/sap/suite/ui/commons/statusindicator/FillingOption.js +1 -1
  42. package/src/sap/suite/ui/commons/statusindicator/LibraryShape.js +1 -1
  43. package/src/sap/suite/ui/commons/statusindicator/Path.js +1 -1
  44. package/src/sap/suite/ui/commons/statusindicator/PropertyThreshold.js +1 -1
  45. package/src/sap/suite/ui/commons/statusindicator/Rectangle.js +1 -1
  46. package/src/sap/suite/ui/commons/statusindicator/Shape.js +1 -1
  47. package/src/sap/suite/ui/commons/statusindicator/ShapeGroup.js +1 -1
  48. package/src/sap/suite/ui/commons/statusindicator/SimpleShape.js +1 -1
  49. package/src/sap/suite/ui/commons/statusindicator/StatusIndicator.js +1 -1
  50. package/src/sap/suite/ui/commons/taccount/TAccount.js +1 -1
  51. package/src/sap/suite/ui/commons/taccount/TAccountGroup.js +1 -1
  52. package/src/sap/suite/ui/commons/taccount/TAccountItem.js +1 -1
  53. package/src/sap/suite/ui/commons/taccount/TAccountItemProperty.js +1 -1
  54. package/src/sap/suite/ui/commons/taccount/TAccountPanel.js +1 -1
  55. package/src/sap/suite/ui/commons/themes/base/NetworkGraph.less +23 -6
  56. package/src/sap/suite/ui/commons/themes/base/Timeline.less +2 -2
  57. package/src/sap/suite/ui/commons/themes/sap_belize_base/NetworkGraph.less +23 -6
  58. package/src/sap/suite/ui/commons/themes/sap_belize_base/Timeline.less +2 -2
  59. package/src/sap/suite/ui/commons/themes/sap_belize_hcb/NetworkGraph.less +23 -2
  60. package/src/sap/suite/ui/commons/themes/sap_belize_hcw/NetworkGraph.less +23 -2
  61. package/src/sap/suite/ui/commons/themes/sap_hcb/base_NetworkGraph.less +23 -6
@@ -4,364 +4,478 @@
4
4
  (c) Copyright 2009-2015 SAP SE. All rights reserved
5
5
 
6
6
  */
7
- sap.ui.define([
8
- "sap/base/Log",
9
- "sap/ui/Device",
10
- "sap/ui/core/Lib",
11
- "sap/m/Menu",
12
- "sap/m/MenuItem",
13
- "sap/ui/performance/trace/FESRHelper"
14
- ], function (Log, Device, Library, Menu, MenuItem, FESRHelper) {
15
- "use strict";
16
-
17
- const COLLABORATION_MAIL = "COLLABORATION_POPOVER_MAIL";
18
- const COLLABORATION_SHARE = "COLLABORATION_MSTEAMS_SHARE";
19
- const COLLABORATION_CHAT = "COLLABORATION_POPOVER_CHAT";
20
- const COLLABORATION_TAB = "COLLABORATION_POPOVER_TAB";
21
- const COLLABORATION_MANAGER = "COLLABORATION_POPOVER_MANAGER";
22
- const COLLABORATION_COPYURL = "COLLABORATION_POPOVER_COPYURL_BUTTON";
23
-
24
- var UniversalCollaborationBar = Menu.extend("sap.suite.ui.commons.collaboration.UniversalCollaborationBar", {
25
- metadata: {
26
- properties: {
27
- shareToEmailEnabled: { type: "boolean", defaultValue: true },
28
- shareAsChatEnabled: { type: "boolean", defaultValue: false },
29
- shareAsTabEnabled: { type: "boolean", defaultValue: false },
30
- shareToCollaborationManagerEnabled: { type: "boolean", defaultValue: false },
31
- copyLinkEnabled: { type: "boolean", defaultValue: true }
32
- },
33
- events: {
34
- "shareToChatSelected": {},
35
- "shareToTabSelected": {},
36
- "copyLinkSelected": {},
37
- "shareToEmailSelected": {},
38
- "shareToCollaborationManagerSelected": {}
39
- }
40
- },
41
- renderer: null, // no renderer
42
-
43
- init: function() {
44
- Menu.prototype.init.apply(this, arguments);
45
- this._mActionHandlers = {
46
- [COLLABORATION_MAIL]: (...args) => {
47
- if (this.hasListeners("shareToEmailSelected")) {
48
- this.fireShareToEmailSelected({ args });
49
- } else {
50
- this._shareToEmail(...args);
51
- }
52
- },
53
- [COLLABORATION_CHAT]: () => this.fireShareToChatSelected(),
54
- [COLLABORATION_TAB]: () => this.fireShareToTabSelected(),
55
- [COLLABORATION_MANAGER]: () => this.fireShareToCollaborationManagerSelected(),
56
- [COLLABORATION_COPYURL]: (...args) => {
57
- if (this.hasListeners("copyLinkSelected")) {
58
- this.fireCopyLinkSelected({ args });
59
- } else {
60
- this._toCopyUrl(...args);
61
- }
62
- }
63
- };
64
-
65
- this._oLogger = Log.getLogger("sap.suite.ui.commons.collaboration.UniversalCollaborationBar");
66
- this._oResourceBundle = Library.getResourceBundleFor("sap.suite.ui.commons");
67
- this.addStyleClass("sapSuiteCollaborationBarMenu");
68
- },
69
-
70
- /**
71
- * Opens the menu.
72
- * @returns {sap.m.Menu} The menu instance.
73
- */
74
- openBy: function() {
75
- if (!this.getItems().length) {
76
- this._renderMenuItems();
77
- }
78
- return Menu.prototype.openBy.apply(this, arguments);
79
- },
80
-
81
- /**
82
- * Renders the menu items for the collaboration popover.
83
- * @private
84
- */
85
- _renderMenuItems: async function() {
86
- const aMenuItemOptions = await this._getCollaborationPopoverOptions();
87
- const aMenuItems = this._getMenuItems(aMenuItemOptions);
88
- aMenuItems.forEach((oItem) => this.addItem(oItem));
89
- },
90
-
91
- /**
92
- * Gets the TeamsHelperService instance.
93
- * @returns {Promise} A promise that resolves with the TeamsHelperService instance.
94
- * @private
95
- */
96
- _getTeamsHelperService: async function() {
97
- if (!this._oTeamsHelperService) {
98
- const ServiceContainer = sap.ui.require("sap/suite/ui/commons/collaboration/ServiceContainer");
99
- this._oTeamsHelperService = await ServiceContainer.getServiceAsync();
100
- }
101
- return this._oTeamsHelperService;
102
- },
103
-
104
- /**
105
- * Gets the menu items based on the provided options.
106
- * @param {Array} aOptions - The array of option objects.
107
- * @returns {Array} The array of created menu items.
108
- * @private
109
- */
110
- _getMenuItems: function (aOptions) {
111
- const aMenuItems = [];
112
- aOptions.forEach((oOption) => {
113
- const oMenuItem = this._createMenuItem(oOption.icon, oOption.text, oOption.key, oOption.fesrStepName, oOption.styleClass);
114
- (oOption.subOptions || []).forEach((oSubOption) => {
115
- const subMenuItem = this._createMenuItem(oSubOption.icon, oSubOption.text, oSubOption.key, oSubOption.fesrStepName, oSubOption.styleClass);
116
- oMenuItem.addItem(subMenuItem);
117
- });
118
- aMenuItems.push(oMenuItem);
119
- });
120
- return aMenuItems;
121
- },
122
-
123
- /**
124
- * Creates a menu item based on the provided parameters.
125
- *
126
- * @param {string} sIcon - The icon for the menu item.
127
- * @param {string} sText - The text for the menu item.
128
- * @param {string} sKey - The key for the menu item.
129
- * @param {string} [sFesrStepName] - The FESR step name for the menu item (optional).
130
- * @param {string} [sStyleClass] - Additional style class for the menu item (optional).
131
- * @returns {sap.m.MenuItem} The created sap.m.MenuItem object.
132
- * @private
133
- */
134
- _createMenuItem: function(sIcon, sText, sKey, sFesrStepName, sStyleClass) {
135
- const oConfig = {
136
- icon: sIcon,
137
- text: sText,
138
- key: sKey
139
- };
140
- const oMenuItem = new MenuItem(oConfig);
141
-
142
- oMenuItem.attachPress(() => {
143
- const fnHandler = this._mActionHandlers[sKey];
144
- if (fnHandler) {
145
- fnHandler();
146
- }
147
- });
148
-
149
- if (sFesrStepName) {
150
- FESRHelper.setSemanticStepname(oMenuItem, "press", sFesrStepName);
151
- }
152
-
153
- oMenuItem.addEventDelegate({
154
- onAfterRendering: () => {
155
- const oDomRef = oMenuItem.getDomRef();
156
- if (oDomRef && sStyleClass) {
157
- oDomRef.classList.add(sStyleClass);
158
- }
159
- }
160
- });
161
-
162
- return oMenuItem;
163
- },
164
-
165
- /**
166
- * Creates a standardized option object for the collaboration popover menu.
167
- *
168
- * @param {string} i18nKey - The i18n key used to fetch the localized text and as the option key.
169
- * @param {string} iconUri - The SAP icon URI for the option (e.g., "sap-icon://email").
170
- * @param {string} cssClass - CSS class applied to the option for styling.
171
- * @param {Object} [options] - Additional optional properties.
172
- * @param {string} [options.fesrStepName] - The FESR step name for tracking user interactions.
173
- * @param {Array} [options.subOptions] - Array of sub-options for nested menu items.
174
- *
175
- * @returns {Object} The constructed option object to be used in the collaboration popover menu.
176
- *
177
- * @private
178
- */
179
- _createOption: function(i18nKey, iconUri, cssClass, { fesrStepName = "", subOptions = [] } = {}) {
180
- const oOption = {
181
- text: this._oResourceBundle.getText(i18nKey),
182
- icon: iconUri,
183
- key: i18nKey,
184
- styleClass: cssClass
185
- };
186
-
187
- if (fesrStepName) {
188
- oOption.fesrStepName = fesrStepName;
189
- }
190
-
191
- if (subOptions.length > 0) {
192
- oOption.subOptions = subOptions;
193
- }
194
-
195
- return oOption;
196
- },
197
-
198
- /**
199
- * Build collaboration popover options based on consumer settings,
200
- * tenant configuration and current device type.
201
- *
202
- * @returns {Array} Array of option objects used to render the collaboration popover menu.
203
- * @private
204
- */
205
- _getCollaborationPopoverOptions: async function() {
206
- const oAppCollaborationParams = {
207
- isShareAsChatEnabled: this.getShareAsChatEnabled(),
208
- isShareAsTabEnabled: this.getShareAsTabEnabled(),
209
- isCopyLinkEnabled: this.getCopyLinkEnabled(),
210
- isShareToEmailEnabled: this.getShareToEmailEnabled(),
211
- isShareToCMEnabled: this.getShareToCollaborationManagerEnabled()
212
- };
213
-
214
- let oProviderConfig = {};
215
- try {
216
- const oTeamHelperServ = await this._getTeamsHelperService();
217
- oProviderConfig = oTeamHelperServ._providerConfig;
218
- } catch (error) {
219
- this._oLogger.error("Error fetching TeamsHelperService:", error);
220
- }
221
-
222
- const aOptions = [];
223
- let aMSTeamsOptions = [];
224
-
225
- // configuration array
226
- const aConfig = [
227
- {
228
- key: COLLABORATION_MAIL,
229
- icon: "sap-icon://email",
230
- styleClass: "sapSuiteUiCommonsCollaborationMail",
231
- consumerEnabled: oAppCollaborationParams.isShareToEmailEnabled,
232
- providerEnabled: true,
233
- fesrStep: "UCB:SendEmail",
234
- featureName: "Email",
235
- group: "menu"
236
- },
237
- {
238
- key: COLLABORATION_CHAT,
239
- icon: "sap-icon://discussion",
240
- styleClass: "sapSuiteUiCommonsCollaborationChat",
241
- consumerEnabled: oAppCollaborationParams.isShareAsChatEnabled,
242
- providerEnabled: oProviderConfig.isShareAsLinkEnabled === "X",
243
- fesrStep: "UCB:CopyLink",
244
- featureName: "Share as Chat",
245
- desktopOnly: true,
246
- group: "subMenu"
247
- },
248
- {
249
- key: COLLABORATION_TAB,
250
- icon: "sap-icon://image-viewer",
251
- styleClass: "sapSuiteUiCommonsCollaborationTab",
252
- consumerEnabled: oAppCollaborationParams.isShareAsTabEnabled,
253
- providerEnabled: oProviderConfig.isShareAsTabEnabled === "X",
254
- fesrStep: "MST:ShareAsTab",
255
- featureName: "Share as Tab",
256
- desktopOnly: true,
257
- group: "subMenu"
258
- },
259
- {
260
- key: COLLABORATION_SHARE,
261
- icon: "sap-icon://citizen-connect",
262
- styleClass: "sapSuiteUiCommonsCollaborationMSTeamsShare",
263
- consumerEnabled: true,
264
- providerEnabled: true,
265
- isParentOfGroup: "subMenu",
266
- group: "menu"
267
- },
268
- {
269
- key: COLLABORATION_MANAGER,
270
- icon: "sap-icon://collaborate",
271
- styleClass: "sapSuiteUiCommonsCollaborationManager",
272
- consumerEnabled: oAppCollaborationParams.isShareToCMEnabled,
273
- providerEnabled: true,
274
- fesrStep: "",
275
- featureName: "Collaboration Manager",
276
- group: "menu"
277
- },
278
- {
279
- key: COLLABORATION_COPYURL,
280
- icon: "sap-icon://chain-link",
281
- styleClass: "sapSuiteUiCommonsCollaborationLink",
282
- consumerEnabled: oAppCollaborationParams.isCopyLinkEnabled,
283
- providerEnabled: true,
284
- fesrStep: "",
285
- featureName: "Copy link",
286
- desktopOnly: true,
287
- group: "menu"
288
- }
289
- ];
290
-
291
- aConfig.forEach((conf) => {
292
- if (conf.group === "subMenu") {
293
- const option = this._createOptionIfEnabled(conf);
294
- if (option) {
295
- aMSTeamsOptions.push(option);
296
- }
297
- return;
298
- }
299
-
300
- if (conf.isParentOfGroup === "subMenu") {
301
- if (aMSTeamsOptions.length > 0) {
302
- conf.subOptions = aMSTeamsOptions;
303
- aMSTeamsOptions = [];
304
- }
305
- }
306
-
307
- const option = this._createOptionIfEnabled(conf);
308
- if (option) {
309
- aOptions.push(option);
310
- }
311
- });
312
-
313
- return aOptions;
314
- },
315
-
316
- /**
317
- * Create an option if it is enabled based on the configuration.
318
- * @param {Object} conf - The configuration object for the option.
319
- * @returns {Object|null} The created option or null if not enabled.
320
- * @private
321
- */
322
- _createOptionIfEnabled: function(conf) {
323
- if (conf.desktopOnly && !Device.system.desktop) {
324
- this._oLogger.info(`${conf.featureName} option is not supported in Phone and Tablet`);
325
- return null;
326
- }
327
-
328
- if (!conf.consumerEnabled) {
329
- this._oLogger.info(`Consumer disabled ${conf.featureName} option`);
330
- return null;
331
- }
332
-
333
- if (!conf.providerEnabled) {
334
- this._oLogger.info(`${conf.featureName} option is not enabled in the tenant`);
335
- return null;
336
- }
337
-
338
- return this._createOption(
339
- conf.key,
340
- conf.icon,
341
- conf.styleClass,
342
- { fesrStepName: conf.fesrStep, subOptions: conf.subOptions }
343
- );
344
- },
345
-
346
- /**
347
- * Share content via email.
348
- * @private
349
- */
350
- _shareToEmail: async function() {
351
- const oTeamsHelperService = await this._getTeamsHelperService();
352
- oTeamsHelperService._shareToEmail();
353
- },
354
-
355
-
356
- /**
357
- * Copy the current URL to the clipboard.
358
- * @private
359
- */
360
- _toCopyUrl: async function() {
361
- const oTeamsHelperService = await this._getTeamsHelperService();
362
- oTeamsHelperService._copyLink();
363
- }
364
- });
365
-
366
- return UniversalCollaborationBar;
367
- });
7
+ sap.ui.define(
8
+ [
9
+ "sap/base/Log",
10
+ "sap/ui/Device",
11
+ "sap/ui/core/Lib",
12
+ "sap/m/Menu",
13
+ "sap/m/MenuItem",
14
+ "sap/ui/performance/trace/FESRHelper",
15
+ ],
16
+ function (Log, Device, Library, Menu, MenuItem, FESRHelper) {
17
+ "use strict";
18
+
19
+ const COLLABORATION_MAIL = "COLLABORATION_POPOVER_MAIL";
20
+ const COLLABORATION_SHARE = "COLLABORATION_MSTEAMS_SHARE";
21
+ const COLLABORATION_CHAT = "COLLABORATION_POPOVER_CHAT";
22
+ const COLLABORATION_TAB = "COLLABORATION_POPOVER_TAB";
23
+ const COLLABORATION_CARD = "COLLABORATION_MSTEAMS_CARD";
24
+ const COLLABORATION_MANAGER = "COLLABORATION_POPOVER_MANAGER";
25
+ const COLLABORATION_COPYURL = "COLLABORATION_POPOVER_COPYURL_BUTTON";
26
+
27
+ /**
28
+ * A universal collaboration bar that provides sharing options through Microsoft Teams, email, link and SAP Collaboration Manager.
29
+ *
30
+ * @class
31
+ * @extends sap.m.Menu
32
+ * @alias sap.suite.ui.commons.collaboration.UniversalCollaborationBar
33
+ * @public
34
+ * @since 1.152
35
+ *
36
+ * @param {object} [mSettings] Initial settings for the new control
37
+ */
38
+ var UniversalCollaborationBar = Menu.extend(
39
+ "sap.suite.ui.commons.collaboration.UniversalCollaborationBar",
40
+ {
41
+ metadata: {
42
+ properties: {
43
+ /**
44
+ * Enables or disables the share to email option.
45
+ */
46
+ shareToEmailEnabled: { type: "boolean", defaultValue: true },
47
+ /**
48
+ * Enables or disables the share as chat option for Microsoft Teams.
49
+ */
50
+ shareAsChatEnabled: { type: "boolean", defaultValue: false },
51
+ /**
52
+ * Enables or disables the share as tab option for Microsoft Teams.
53
+ */
54
+ shareAsTabEnabled: { type: "boolean", defaultValue: false },
55
+ /**
56
+ * Enables or disables the share as adaptive card option for Microsoft Teams.
57
+ */
58
+ shareAsCardEnabled: { type: "boolean", defaultValue: false },
59
+ /**
60
+ * Enables or disables the SAP Collaboration Manager option.
61
+ */
62
+ shareToCollaborationManagerEnabled: {
63
+ type: "boolean",
64
+ defaultValue: false,
65
+ },
66
+ /**
67
+ * Enables or disables the copy link option.
68
+ */
69
+ copyLinkEnabled: { type: "boolean", defaultValue: true },
70
+ },
71
+ events: {
72
+ /**
73
+ * Fired when the user selects the share as chat option.
74
+ */
75
+ shareToChatSelected: {},
76
+ /**
77
+ * Fired when the user selects the share as tab option.
78
+ */
79
+ shareToTabSelected: {},
80
+ /**
81
+ * Fired when the user selects the share as adaptive card option.
82
+ */
83
+ shareAsCardSelected: {},
84
+ /**
85
+ * Fired when the user selects the copy link option.
86
+ */
87
+ copyLinkSelected: {},
88
+ /**
89
+ * Fired when the user selects the share to email option.
90
+ */
91
+ shareToEmailSelected: {},
92
+ /**
93
+ * Fired when the user selects the collaboration manager option.
94
+ */
95
+ shareToCollaborationManagerSelected: {},
96
+ },
97
+ },
98
+ renderer: null, // no renderer
99
+
100
+ init: function () {
101
+ Menu.prototype.init.apply(this, arguments);
102
+ this._mActionHandlers = {
103
+ [COLLABORATION_MAIL]: (...args) => {
104
+ if (this.hasListeners("shareToEmailSelected")) {
105
+ this.fireShareToEmailSelected({ args });
106
+ } else {
107
+ this._shareToEmail(...args);
108
+ }
109
+ },
110
+ [COLLABORATION_CHAT]: () => this.fireShareToChatSelected(),
111
+ [COLLABORATION_TAB]: () => this.fireShareToTabSelected(),
112
+ [COLLABORATION_CARD]: () => this.fireShareAsCardSelected(),
113
+ [COLLABORATION_MANAGER]: () =>
114
+ this.fireShareToCollaborationManagerSelected(),
115
+ [COLLABORATION_COPYURL]: (...args) => {
116
+ if (this.hasListeners("copyLinkSelected")) {
117
+ this.fireCopyLinkSelected({ args });
118
+ } else {
119
+ this._toCopyUrl(...args);
120
+ }
121
+ },
122
+ };
123
+
124
+ this._oLogger = Log.getLogger(
125
+ "sap.suite.ui.commons.collaboration.UniversalCollaborationBar",
126
+ );
127
+ this._oResourceBundle = Library.getResourceBundleFor(
128
+ "sap.suite.ui.commons",
129
+ );
130
+ this.addStyleClass("sapSuiteCollaborationBarMenu");
131
+ this.addStyleClass("sapUiSizeCompact");
132
+ },
133
+
134
+ /**
135
+ * Opens the menu.
136
+ * @param {sap.ui.core.Control} oControl The control that opens the menu.
137
+ * @returns {this} The menu instance.
138
+ * @public
139
+ */
140
+ openBy: function (oControl) {
141
+ if (!this.getItems().length) {
142
+ this._renderMenuItems();
143
+ }
144
+ return Menu.prototype.openBy.apply(this, arguments);
145
+ },
146
+
147
+ /**
148
+ * Renders the menu items for the collaboration popover.
149
+ * @private
150
+ */
151
+ _renderMenuItems: async function () {
152
+ const aMenuItemOptions = await this._getCollaborationPopoverOptions();
153
+ const aMenuItems = this._getMenuItems(aMenuItemOptions);
154
+ aMenuItems.forEach((oItem) => this.addItem(oItem));
155
+ },
156
+
157
+ /**
158
+ * Gets the TeamsHelperService instance.
159
+ * @returns {Promise} A promise that resolves with the TeamsHelperService instance.
160
+ * @private
161
+ */
162
+ _getTeamsHelperService: async function () {
163
+ if (!this._oTeamsHelperService) {
164
+ const ServiceContainer = sap.ui.require(
165
+ "sap/suite/ui/commons/collaboration/ServiceContainer",
166
+ );
167
+ this._oTeamsHelperService =
168
+ await ServiceContainer.getServiceAsync();
169
+ }
170
+ return this._oTeamsHelperService;
171
+ },
172
+
173
+ /**
174
+ * Gets the menu items based on the provided options.
175
+ * @param {Array} aOptions The array of option objects.
176
+ * @returns {Array} The array of created menu items.
177
+ * @private
178
+ */
179
+ _getMenuItems: function (aOptions) {
180
+ const aMenuItems = [];
181
+ aOptions.forEach((oOption) => {
182
+ const oMenuItem = this._createMenuItem(
183
+ oOption.icon,
184
+ oOption.text,
185
+ oOption.key,
186
+ oOption.fesrStepName,
187
+ oOption.styleClass,
188
+ );
189
+ (oOption.subOptions || []).forEach((oSubOption) => {
190
+ const subMenuItem = this._createMenuItem(
191
+ oSubOption.icon,
192
+ oSubOption.text,
193
+ oSubOption.key,
194
+ oSubOption.fesrStepName,
195
+ oSubOption.styleClass,
196
+ );
197
+ oMenuItem.addItem(subMenuItem);
198
+ });
199
+ aMenuItems.push(oMenuItem);
200
+ });
201
+ return aMenuItems;
202
+ },
203
+
204
+ /**
205
+ * Creates a menu item based on the provided parameters.
206
+ *
207
+ * @param {string} sIcon The icon for the menu item.
208
+ * @param {string} sText The text for the menu item.
209
+ * @param {string} sKey The key for the menu item.
210
+ * @param {string} [sFesrStepName] The FESR step name for the menu item.
211
+ * @param {string} [sStyleClass] Additional style class for the menu item.
212
+ * @returns {sap.m.MenuItem} The created sap.m.MenuItem object.
213
+ * @private
214
+ */
215
+ _createMenuItem: function (
216
+ sIcon,
217
+ sText,
218
+ sKey,
219
+ sFesrStepName,
220
+ sStyleClass,
221
+ ) {
222
+ const oConfig = {
223
+ icon: sIcon,
224
+ text: sText,
225
+ key: sKey,
226
+ };
227
+ const oMenuItem = new MenuItem(oConfig);
228
+
229
+ oMenuItem.attachPress(() => {
230
+ const fnHandler = this._mActionHandlers[sKey];
231
+ if (fnHandler) {
232
+ fnHandler();
233
+ }
234
+ });
235
+
236
+ if (sFesrStepName) {
237
+ FESRHelper.setSemanticStepname(oMenuItem, "press", sFesrStepName);
238
+ }
239
+
240
+ oMenuItem.addEventDelegate({
241
+ onAfterRendering: () => {
242
+ const oDomRef = oMenuItem.getDomRef();
243
+ if (oDomRef && sStyleClass) {
244
+ oDomRef.classList.add(sStyleClass);
245
+ }
246
+ },
247
+ });
248
+
249
+ return oMenuItem;
250
+ },
251
+
252
+ /**
253
+ * Creates a standardized option object for the collaboration popover menu.
254
+ *
255
+ * @param {string} i18nKey The i18n key used to fetch the localized text and as the option key.
256
+ * @param {string} iconUri The SAP icon URI for the option (for example, "sap-icon://email").
257
+ * @param {string} cssClass CSS class applied to the option for styling.
258
+ * @param {Object} [options] Additional optional properties.
259
+ * @param {string} [options.fesrStepName] The FESR step name for tracking user interactions.
260
+ * @param {Array} [options.subOptions] Array of sub-options for nested menu items.
261
+ *
262
+ * @returns {Object} The constructed option object to be used in the collaboration popover menu.
263
+ *
264
+ * @private
265
+ */
266
+ _createOption: function (
267
+ i18nKey,
268
+ iconUri,
269
+ cssClass,
270
+ { fesrStepName = "", subOptions = [] } = {},
271
+ ) {
272
+ const oOption = {
273
+ text: this._oResourceBundle.getText(i18nKey),
274
+ icon: iconUri,
275
+ key: i18nKey,
276
+ styleClass: cssClass,
277
+ };
278
+
279
+ if (fesrStepName) {
280
+ oOption.fesrStepName = fesrStepName;
281
+ }
282
+
283
+ if (subOptions.length > 0) {
284
+ oOption.subOptions = subOptions;
285
+ }
286
+
287
+ return oOption;
288
+ },
289
+
290
+ /**
291
+ * Build collaboration popover options based on consumer settings,
292
+ * tenant configuration and current device type.
293
+ *
294
+ * @returns {Array} Array of option objects used to render the collaboration popover menu.
295
+ * @private
296
+ */
297
+ _getCollaborationPopoverOptions: async function () {
298
+ const oAppCollaborationParams = {
299
+ isShareAsChatEnabled: this.getShareAsChatEnabled(),
300
+ isShareAsTabEnabled: this.getShareAsTabEnabled(),
301
+ isShareAsCardEnabled: this.getShareAsCardEnabled(),
302
+ isCopyLinkEnabled: this.getCopyLinkEnabled(),
303
+ isShareToEmailEnabled: this.getShareToEmailEnabled(),
304
+ isShareToCMEnabled: this.getShareToCollaborationManagerEnabled(),
305
+ };
306
+
307
+ let oProviderConfig = {};
308
+ try {
309
+ const oTeamHelperServ = await this._getTeamsHelperService();
310
+ oProviderConfig = oTeamHelperServ._providerConfig;
311
+ } catch (error) {
312
+ this._oLogger.error("Error fetching TeamsHelperService:", error);
313
+ }
314
+
315
+ const aOptions = [];
316
+ let aMSTeamsOptions = [];
317
+
318
+ // configuration array
319
+ const aConfig = [
320
+ {
321
+ key: COLLABORATION_MAIL,
322
+ icon: "sap-icon://email",
323
+ styleClass: "sapSuiteUiCommonsCollaborationMail",
324
+ consumerEnabled: oAppCollaborationParams.isShareToEmailEnabled,
325
+ providerEnabled: true,
326
+ fesrStep: "UCB:SendEmail",
327
+ featureName: "Email",
328
+ group: "menu",
329
+ },
330
+ {
331
+ key: COLLABORATION_CHAT,
332
+ icon: "sap-icon://discussion",
333
+ styleClass: "sapSuiteUiCommonsCollaborationChat",
334
+ consumerEnabled: oAppCollaborationParams.isShareAsChatEnabled,
335
+ providerEnabled: oProviderConfig.isShareAsLinkEnabled === "X",
336
+ fesrStep: "UCB:CopyLink",
337
+ featureName: "Share as Chat",
338
+ desktopOnly: true,
339
+ group: "subMenu",
340
+ },
341
+ {
342
+ key: COLLABORATION_TAB,
343
+ icon: "sap-icon://image-viewer",
344
+ styleClass: "sapSuiteUiCommonsCollaborationTab",
345
+ consumerEnabled: oAppCollaborationParams.isShareAsTabEnabled,
346
+ providerEnabled: oProviderConfig.isShareAsTabEnabled === "X",
347
+ fesrStep: "MST:ShareAsTab",
348
+ featureName: "Share as Tab",
349
+ desktopOnly: true,
350
+ group: "subMenu",
351
+ },
352
+ {
353
+ key: COLLABORATION_CARD,
354
+ icon: "sap-icon://card",
355
+ styleClass: "sapSuiteUiCommonsCollaborationCard",
356
+ consumerEnabled: oAppCollaborationParams.isShareAsCardEnabled,
357
+ providerEnabled:
358
+ oProviderConfig.isShareAsCardEnabled === "AUTHENABLE",
359
+ fesrStep: "MST:ShareAsCard",
360
+ featureName: "Share as Card",
361
+ desktopOnly: true,
362
+ group: "subMenu",
363
+ },
364
+ {
365
+ key: COLLABORATION_SHARE,
366
+ icon: "sap-icon://citizen-connect",
367
+ styleClass: "sapSuiteUiCommonsCollaborationMSTeamsShare",
368
+ consumerEnabled: true,
369
+ providerEnabled: true,
370
+ isParentOfGroup: "subMenu",
371
+ group: "menu",
372
+ },
373
+ {
374
+ key: COLLABORATION_MANAGER,
375
+ icon: "sap-icon://collaborate",
376
+ styleClass: "sapSuiteUiCommonsCollaborationManager",
377
+ consumerEnabled: oAppCollaborationParams.isShareToCMEnabled,
378
+ providerEnabled: true,
379
+ fesrStep: "",
380
+ featureName: "Collaboration Manager",
381
+ group: "menu",
382
+ },
383
+ {
384
+ key: COLLABORATION_COPYURL,
385
+ icon: "sap-icon://chain-link",
386
+ styleClass: "sapSuiteUiCommonsCollaborationLink",
387
+ consumerEnabled: oAppCollaborationParams.isCopyLinkEnabled,
388
+ providerEnabled: true,
389
+ fesrStep: "",
390
+ featureName: "Copy link",
391
+ desktopOnly: true,
392
+ group: "menu",
393
+ },
394
+ ];
395
+
396
+ aConfig.forEach((conf) => {
397
+ if (conf.group === "subMenu") {
398
+ const option = this._createOptionIfEnabled(conf);
399
+ if (option) {
400
+ aMSTeamsOptions.push(option);
401
+ }
402
+ return;
403
+ }
404
+
405
+ if (conf.isParentOfGroup === "subMenu") {
406
+ if (aMSTeamsOptions.length === 1) {
407
+ this._mActionHandlers[COLLABORATION_SHARE] =
408
+ this._mActionHandlers[aMSTeamsOptions[0].key];
409
+ aMSTeamsOptions = [];
410
+ } else if (aMSTeamsOptions.length > 1) {
411
+ conf.subOptions = aMSTeamsOptions;
412
+ aMSTeamsOptions = [];
413
+ } else {
414
+ return;
415
+ }
416
+ }
417
+
418
+ const option = this._createOptionIfEnabled(conf);
419
+ if (option) {
420
+ aOptions.push(option);
421
+ }
422
+ });
423
+
424
+ return aOptions;
425
+ },
426
+
427
+ /**
428
+ * Create an option if it is enabled based on the configuration.
429
+ * @param {Object} conf The configuration object for the option.
430
+ * @returns {Object|null} The created option or null if not enabled.
431
+ * @private
432
+ */
433
+ _createOptionIfEnabled: function (conf) {
434
+ if (conf.desktopOnly && !Device.system.desktop) {
435
+ this._oLogger.info(
436
+ `${conf.featureName} option is not supported in Phone and Tablet`,
437
+ );
438
+ return null;
439
+ }
440
+
441
+ if (!conf.consumerEnabled) {
442
+ this._oLogger.info(`Consumer disabled ${conf.featureName} option`);
443
+ return null;
444
+ }
445
+
446
+ if (!conf.providerEnabled) {
447
+ this._oLogger.info(
448
+ `${conf.featureName} option is not enabled in the tenant`,
449
+ );
450
+ return null;
451
+ }
452
+
453
+ return this._createOption(conf.key, conf.icon, conf.styleClass, {
454
+ fesrStepName: conf.fesrStep,
455
+ subOptions: conf.subOptions,
456
+ });
457
+ },
458
+
459
+ /**
460
+ * Share content via email.
461
+ * @private
462
+ */
463
+ _shareToEmail: async function () {
464
+ const oTeamsHelperService = await this._getTeamsHelperService();
465
+ oTeamsHelperService._shareToEmail();
466
+ },
467
+
468
+ /**
469
+ * Copy the current URL to the clipboard.
470
+ * @private
471
+ */
472
+ _toCopyUrl: async function () {
473
+ const oTeamsHelperService = await this._getTeamsHelperService();
474
+ oTeamsHelperService._copyLink();
475
+ },
476
+ },
477
+ );
478
+
479
+ return UniversalCollaborationBar;
480
+ },
481
+ );