@sapui5/sap.suite.ui.commons 1.107.0 → 1.108.1
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.
- package/package.json +1 -1
- package/src/sap/suite/ui/commons/.library +1 -1
- package/src/sap/suite/ui/commons/AriaProperties.js +1 -1
- package/src/sap/suite/ui/commons/CalculationBuilder.js +1 -1
- package/src/sap/suite/ui/commons/CalculationBuilderExpression.js +1 -1
- package/src/sap/suite/ui/commons/CalculationBuilderFunction.js +1 -1
- package/src/sap/suite/ui/commons/CalculationBuilderGroup.js +1 -1
- package/src/sap/suite/ui/commons/CalculationBuilderItem.js +1 -1
- package/src/sap/suite/ui/commons/CalculationBuilderValidationResult.js +1 -1
- package/src/sap/suite/ui/commons/CalculationBuilderVariable.js +1 -1
- package/src/sap/suite/ui/commons/CloudFilePicker.js +65 -31
- package/src/sap/suite/ui/commons/MicroProcessFlow.js +1 -1
- package/src/sap/suite/ui/commons/MicroProcessFlowItem.js +1 -1
- package/src/sap/suite/ui/commons/TimelineItemRenderer.js +2 -2
- package/src/sap/suite/ui/commons/collaboration/BaseHelperService.js +68 -0
- package/src/sap/suite/ui/commons/collaboration/CollaborationHelper.js +263 -0
- package/src/sap/suite/ui/commons/collaboration/ServiceContainer.js +59 -0
- package/src/sap/suite/ui/commons/collaboration/TeamsHelperService.js +245 -0
- package/src/sap/suite/ui/commons/collaboration/flpplugins/msplugin/Component.js +62 -0
- package/src/sap/suite/ui/commons/flexibility/changeHandler/PropertyChangeMapper.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/CropCustomShapeHistoryItem.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/CropEllipseHistoryItem.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/CropRectangleHistoryItem.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/CustomSizeItem.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/FilterHistoryItem.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/FlipHistoryItem.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/HistoryItem.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/ImageEditor.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/ImageEditorContainer.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/ImageEditorResponsiveContainer.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/ResizeHistoryItem.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/RotateHistoryItem.js +1 -1
- package/src/sap/suite/ui/commons/library.js +1 -1
- package/src/sap/suite/ui/commons/messagebundle.properties +11 -0
- package/src/sap/suite/ui/commons/messagebundle_ar.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_bg.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_ca.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_cs.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_cy.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_da.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_de.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_el.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_en.properties +11 -2
- package/src/sap/suite/ui/commons/messagebundle_en_GB.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_en_US_sappsd.properties +6 -0
- package/src/sap/suite/ui/commons/messagebundle_en_US_saprigi.properties +6 -0
- package/src/sap/suite/ui/commons/messagebundle_en_US_saptrc.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_es.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_es_MX.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_et.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_fi.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_fr.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_fr_CA.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_hi.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_hr.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_hu.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_id.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_it.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_iw.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_ja.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_kk.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_ko.properties +10 -1
- package/src/sap/suite/ui/commons/messagebundle_lt.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_lv.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_ms.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_nl.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_no.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_pl.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_pt.properties +10 -1
- package/src/sap/suite/ui/commons/messagebundle_pt_PT.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_ro.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_ru.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_sh.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_sk.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_sl.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_sv.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_th.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_tr.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_uk.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_vi.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_zh_CN.properties +9 -0
- package/src/sap/suite/ui/commons/messagebundle_zh_TW.properties +9 -0
- package/src/sap/suite/ui/commons/statusindicator/Circle.js +1 -1
- package/src/sap/suite/ui/commons/statusindicator/CustomShape.js +1 -1
- package/src/sap/suite/ui/commons/statusindicator/DiscreteThreshold.js +1 -1
- package/src/sap/suite/ui/commons/statusindicator/FillingOption.js +1 -1
- package/src/sap/suite/ui/commons/statusindicator/LibraryShape.js +1 -1
- package/src/sap/suite/ui/commons/statusindicator/Path.js +1 -1
- package/src/sap/suite/ui/commons/statusindicator/PropertyThreshold.js +1 -1
- package/src/sap/suite/ui/commons/statusindicator/Rectangle.js +1 -1
- package/src/sap/suite/ui/commons/statusindicator/Shape.js +2 -2
- package/src/sap/suite/ui/commons/statusindicator/ShapeGroup.js +1 -1
- package/src/sap/suite/ui/commons/statusindicator/SimpleShape.js +1 -1
- package/src/sap/suite/ui/commons/statusindicator/StatusIndicator.js +1 -1
- package/src/sap/suite/ui/commons/taccount/TAccount.js +1 -1
- package/src/sap/suite/ui/commons/taccount/TAccountGroup.js +1 -1
- package/src/sap/suite/ui/commons/taccount/TAccountItem.js +1 -1
- package/src/sap/suite/ui/commons/taccount/TAccountItemProperty.js +1 -1
- package/src/sap/suite/ui/commons/taccount/TAccountPanel.js +1 -1
- package/src/sap/suite/ui/commons/collaborationhelper/CollaborationHelper.js +0 -133
- package/src/sap/suite/ui/commons/collaborationhelper/URLMinify.js +0 -135
package/package.json
CHANGED
|
@@ -46,7 +46,8 @@ sap.ui.define([
|
|
|
46
46
|
"sap/ui/core/SortOrder",
|
|
47
47
|
"sap/m/IllustratedMessage",
|
|
48
48
|
"sap/m/IllustratedMessageType",
|
|
49
|
-
"sap/m/IllustratedMessageSize"
|
|
49
|
+
"sap/m/IllustratedMessageSize",
|
|
50
|
+
"sap/ui/core/format/FileSizeFormat"
|
|
50
51
|
], function (
|
|
51
52
|
Button,
|
|
52
53
|
Dialog,
|
|
@@ -87,7 +88,8 @@ sap.ui.define([
|
|
|
87
88
|
SortOrder,
|
|
88
89
|
IllustratedMessage,
|
|
89
90
|
IllustratedMessageType,
|
|
90
|
-
IllustratedMessageSize
|
|
91
|
+
IllustratedMessageSize,
|
|
92
|
+
FileSizeFormat
|
|
91
93
|
) {
|
|
92
94
|
"use strict";
|
|
93
95
|
|
|
@@ -111,7 +113,7 @@ sap.ui.define([
|
|
|
111
113
|
* @class
|
|
112
114
|
* @public
|
|
113
115
|
* @internal
|
|
114
|
-
* @version 1.
|
|
116
|
+
* @version 1.108.1
|
|
115
117
|
*/
|
|
116
118
|
var CloudFilePicker = Dialog.extend("sap.suite.ui.commons.CloudFilePicker", {
|
|
117
119
|
metadata: {
|
|
@@ -125,6 +127,14 @@ sap.ui.define([
|
|
|
125
127
|
group: "Data",
|
|
126
128
|
defaultValue: ""
|
|
127
129
|
},
|
|
130
|
+
/**
|
|
131
|
+
* Model shared from export as dialog
|
|
132
|
+
*/
|
|
133
|
+
sharedModel: {
|
|
134
|
+
type: "object",
|
|
135
|
+
group: "Misc",
|
|
136
|
+
defaultValue: null
|
|
137
|
+
},
|
|
128
138
|
/**
|
|
129
139
|
* Overwrites the default text for the confirmation button.
|
|
130
140
|
*/
|
|
@@ -244,26 +254,32 @@ sap.ui.define([
|
|
|
244
254
|
});
|
|
245
255
|
|
|
246
256
|
CloudFilePicker.prototype._createDialogContent = function () {
|
|
247
|
-
var sServiceURL = this.getServiceUrl();
|
|
248
|
-
if (sServiceURL) {
|
|
249
|
-
|
|
257
|
+
var sServiceURL = this.getServiceUrl(), oModel = this.getSharedModel();
|
|
258
|
+
if (!sServiceURL && !oModel) {
|
|
259
|
+
Log.error("Invalid Configuration");
|
|
260
|
+
}
|
|
261
|
+
if (!oModel && sServiceURL) {
|
|
262
|
+
oModel = new ODataModel({
|
|
250
263
|
serviceUrl: sServiceURL,
|
|
251
264
|
synchronizationMode: "None",
|
|
252
265
|
earlyRequests: true
|
|
253
266
|
});
|
|
254
|
-
this.setModel(oModel);
|
|
255
|
-
// Adding Select for cloud spaces
|
|
256
|
-
var oSimpleForm = this._createCloudDropdownAndFileNameField();
|
|
257
|
-
// Adding list to show the files and folders
|
|
258
|
-
oBreadcrumbLinkControl = this._createBreadcrumbLinks();
|
|
259
|
-
// Adding list to show the files and folders
|
|
260
|
-
var oListContent = this._createTableContent();
|
|
261
|
-
var oFlexContainer = new FixFlex({
|
|
262
|
-
fixContent: [oSimpleForm, oBreadcrumbLinkControl],
|
|
263
|
-
flexContent: oListContent
|
|
264
|
-
});
|
|
265
|
-
this.addContent(oFlexContainer);
|
|
266
267
|
}
|
|
268
|
+
if (oModel) {
|
|
269
|
+
oModel.setSizeLimit(200);
|
|
270
|
+
}
|
|
271
|
+
this.setModel(oModel);
|
|
272
|
+
// Adding Select for cloud spaces
|
|
273
|
+
var oSimpleForm = this._createCloudDropdownAndFileNameField();
|
|
274
|
+
// Adding list to show the files and folders
|
|
275
|
+
oBreadcrumbLinkControl = this._createBreadcrumbLinks();
|
|
276
|
+
// Adding list to show the files and folders
|
|
277
|
+
var oListContent = this._createTableContent();
|
|
278
|
+
var oFlexContainer = new FixFlex({
|
|
279
|
+
fixContent: [oSimpleForm, oBreadcrumbLinkControl],
|
|
280
|
+
flexContent: oListContent
|
|
281
|
+
});
|
|
282
|
+
this.addContent(oFlexContainer);
|
|
267
283
|
};
|
|
268
284
|
|
|
269
285
|
CloudFilePicker.prototype._createCloudDropdownAndFileNameField = function () {
|
|
@@ -293,7 +309,7 @@ sap.ui.define([
|
|
|
293
309
|
events:{
|
|
294
310
|
dataReceived: function (oEvent) {
|
|
295
311
|
var mParameters = oEvent.getParameters();
|
|
296
|
-
if (mParameters.error) {
|
|
312
|
+
if (mParameters.error || (!Object.keys(mParameters.data).length && !oEvent.getSource().getCurrentContexts().length)) {
|
|
297
313
|
this.setBusy(false);
|
|
298
314
|
var oMessage = new IllustratedMessage({
|
|
299
315
|
illustrationType: IllustratedMessageType.ErrorScreen,
|
|
@@ -522,6 +538,7 @@ sap.ui.define([
|
|
|
522
538
|
],
|
|
523
539
|
events:{
|
|
524
540
|
dataReceived: function () {
|
|
541
|
+
oTableControl.setNoData(null);
|
|
525
542
|
oTableControl.setNoDataText(oResourceBundle.getText("CFP_NO_DATA_FILESHARE"));
|
|
526
543
|
this.setBusy(false);
|
|
527
544
|
}.bind(this)
|
|
@@ -551,7 +568,7 @@ sap.ui.define([
|
|
|
551
568
|
}).addStyleClass("sapUiTinyMarginEnd"),
|
|
552
569
|
new Text({text: "{FileShareItemName}"})]
|
|
553
570
|
}),
|
|
554
|
-
new Text({text: "{
|
|
571
|
+
new Text({text: "{FileShareItemHumanContentType}"}),
|
|
555
572
|
new Text({text: "{= ${FileShareItemKind} === 'folder' ? '' : ${CreatedByUser}}"}),
|
|
556
573
|
new Text({text:{
|
|
557
574
|
parts: ["FileShareItemKind", "LastChangeDateTime"],
|
|
@@ -565,7 +582,21 @@ sap.ui.define([
|
|
|
565
582
|
}
|
|
566
583
|
}
|
|
567
584
|
}),
|
|
568
|
-
new Text({text:
|
|
585
|
+
new Text({text:{
|
|
586
|
+
parts: ["FileShareItemKind", "FileShareItemContentSize"],
|
|
587
|
+
formatter: function (sFileShareItemKind, sFileShareItemContentSize) {
|
|
588
|
+
if (sFileShareItemKind !== "folder") {
|
|
589
|
+
var sFileSize = FileSizeFormat.getInstance({
|
|
590
|
+
binaryFilesize: false,
|
|
591
|
+
maxFractionDigits: 1,
|
|
592
|
+
maxIntegerDigits: 3
|
|
593
|
+
}).format(sFileShareItemContentSize.split(",").join(""));
|
|
594
|
+
return sFileSize;
|
|
595
|
+
} else {
|
|
596
|
+
return '';
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}})
|
|
569
600
|
],
|
|
570
601
|
type: "{= ${FileShareItemKind} === 'folder' ? 'Navigation' : 'Active'}"
|
|
571
602
|
})
|
|
@@ -619,17 +650,18 @@ sap.ui.define([
|
|
|
619
650
|
placeholder: "Enter Folder Name",
|
|
620
651
|
width: "100%",
|
|
621
652
|
visible: true,
|
|
622
|
-
|
|
623
|
-
if (this._checkForDuplicateInTable(oTableControl, oEvent.getParameter("value").toLowerCase())) {
|
|
624
|
-
oEvent.getSource().setValueState(ValueState.Error);
|
|
625
|
-
oEvent.getSource().setValueStateText(oResourceBundle.getText("CFP_FOLDER_EXIST"));
|
|
626
|
-
} else {
|
|
627
|
-
oEvent.getSource().setValueState(ValueState.None);
|
|
628
|
-
oEvent.getSource().setValueStateText("");
|
|
629
|
-
this._makeNewFolderEntry(oEvent.getParameter("value"));
|
|
630
|
-
}
|
|
631
|
-
}.bind(this)
|
|
653
|
+
value: oResourceBundle.getText("CFP_TITLE_NEWFOLDER")
|
|
632
654
|
});
|
|
655
|
+
oNewFolderInput.attachBrowserEvent("focusout", function(oEvent) {
|
|
656
|
+
if (this._checkForDuplicateInTable(oTableControl, oEvent.target.value.toLowerCase())) {
|
|
657
|
+
oNewFolderInput.setValueState(ValueState.Error);
|
|
658
|
+
oNewFolderInput.setValueStateText(oResourceBundle.getText("CFP_FOLDER_EXIST"));
|
|
659
|
+
} else {
|
|
660
|
+
oNewFolderInput.setValueState(ValueState.None);
|
|
661
|
+
oNewFolderInput.setValueStateText("");
|
|
662
|
+
this._makeNewFolderEntry(oEvent.target.value);
|
|
663
|
+
}
|
|
664
|
+
}.bind(this));
|
|
633
665
|
oNewFolderColumnListItem = new ColumnListItem({
|
|
634
666
|
cells: [
|
|
635
667
|
new HBox({
|
|
@@ -804,6 +836,7 @@ sap.ui.define([
|
|
|
804
836
|
oSelectedFolderInfo = oNavigationMap.get(
|
|
805
837
|
aVisibleLinks[aVisibleLinks.length - 1].fileShareItemId
|
|
806
838
|
);
|
|
839
|
+
oCurrentParentData = oSelectedFolderInfo;
|
|
807
840
|
for (var sKey in aRemovedLinks) {
|
|
808
841
|
oNavigationMap.delete(aRemovedLinks[sKey].fileShareItemId);
|
|
809
842
|
}
|
|
@@ -814,6 +847,7 @@ sap.ui.define([
|
|
|
814
847
|
oSelectedFolderInfo = oNavigationMap.get(
|
|
815
848
|
aVisibleLinks[aVisibleLinks.length - 1].fileShareItemId
|
|
816
849
|
);
|
|
850
|
+
oCurrentParentData = oSelectedFolderInfo;
|
|
817
851
|
this._setConfirmationButtonEnabled(null, oSelectedFolderInfo);
|
|
818
852
|
this._loadFileShareRootFolder(oSelectControl.getSelectedKey());
|
|
819
853
|
}
|
|
@@ -228,7 +228,7 @@ sap.ui.define([
|
|
|
228
228
|
eChild.addChild(eWrapper);
|
|
229
229
|
eTimelineItem.addChild(eLineWrapper);
|
|
230
230
|
|
|
231
|
-
eTimelineItem.setAttribute("
|
|
231
|
+
eTimelineItem.setAttribute("nodetype", "GroupHeader");
|
|
232
232
|
|
|
233
233
|
eBarWrapper.addClass("sapSuiteUiCommonsTimelineGroupHeaderSpanWrapper");
|
|
234
234
|
|
|
@@ -336,7 +336,7 @@ sap.ui.define([
|
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
if (sGroupId) {
|
|
339
|
-
eTimelineItem.setAttribute("
|
|
339
|
+
eTimelineItem.setAttribute("groupid", sGroupId);
|
|
340
340
|
eTimelineItem.setAttribute("aria-level", 2);
|
|
341
341
|
} else {
|
|
342
342
|
eTimelineItem.setAttribute("role", "presentation");
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
*
|
|
3
|
+
SAP UI development toolkit for HTML5 (SAPUI5)
|
|
4
|
+
(c) Copyright 2009-2015 SAP SE. All rights reserved
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
sap.ui.define([
|
|
8
|
+
"sap/ui/base/Object"
|
|
9
|
+
], function (BaseObject) {
|
|
10
|
+
"use strict";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Base class for the CollaborationHelpers
|
|
14
|
+
* @namespace
|
|
15
|
+
* @since 1.108
|
|
16
|
+
* @alias module:sap/suite/ui/commons/collaboration/BaseHelperService
|
|
17
|
+
* @private
|
|
18
|
+
* @ui5-restricted
|
|
19
|
+
* @experimental Since 1.108
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
var BaseHelperService = BaseObject.extend("sap.suite.ui.commons.collaboration.BaseHelperService", {
|
|
23
|
+
constructor: function (oProviderConfig) {
|
|
24
|
+
this._providerConfig = oProviderConfig;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Method returns the Provider configuration settings
|
|
30
|
+
* @returns {Object} Configuration settings
|
|
31
|
+
* @private
|
|
32
|
+
* @ui5-restricted
|
|
33
|
+
* @experimental Since 1.108
|
|
34
|
+
*/
|
|
35
|
+
BaseHelperService.prototype.getProviderConfig = function() {
|
|
36
|
+
return this._providerConfig;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Gives list of all Collaboration Options
|
|
41
|
+
* @param {object} oParams Optional argument in case consumer wants to influence the options, otherwise pass as undefined
|
|
42
|
+
* @param {boolean} oParams.isShareAsLinkEnabled Allow Share as Chat option in case MS Teams is the Collaboration provider
|
|
43
|
+
* @param {boolean} oParams.isShareAsTabEnabled Allow Share as Tab option in case MS Teams is the Collaboration provider
|
|
44
|
+
* @returns {array} Array of available options
|
|
45
|
+
* @private
|
|
46
|
+
* @ui5-restricted
|
|
47
|
+
* @experimental Since 1.108
|
|
48
|
+
*/
|
|
49
|
+
BaseHelperService.prototype.getOptions = function() {
|
|
50
|
+
return [];
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Method to be called to trigger the share operation
|
|
55
|
+
*
|
|
56
|
+
* @param {Object} oOption Option Object/SubObject which is clicked
|
|
57
|
+
* @param {Object} oParams Parameter object which contain the information to share
|
|
58
|
+
* @param {string} oParams.url Url of the application which needs to be shared
|
|
59
|
+
* @param {string} oParams.appTitle Title of the application which needs to be used while integration
|
|
60
|
+
* @returns {void}
|
|
61
|
+
* @private
|
|
62
|
+
* @ui5-restricted
|
|
63
|
+
* @experimental Since 1.108
|
|
64
|
+
*/
|
|
65
|
+
BaseHelperService.prototype.share = function(oOption, oParams) {
|
|
66
|
+
};
|
|
67
|
+
return BaseHelperService;
|
|
68
|
+
});
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
*
|
|
3
|
+
SAP UI development toolkit for HTML5 (SAPUI5)
|
|
4
|
+
(c) Copyright 2009-2015 SAP SE. All rights reserved
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
sap.ui.define(
|
|
8
|
+
["sap/base/Log", "sap/ui/core/routing/HashChanger", "sap/ui/base/Object"],
|
|
9
|
+
function (Log, HashChanger, BaseObject) {
|
|
10
|
+
"use strict";
|
|
11
|
+
var URL_KEY = "sap-url-hash";
|
|
12
|
+
var TRANSIENT_KEY = "transient";
|
|
13
|
+
var oLogger = Log.getLogger("sap.suite.ui.commons.collaboration.CollaborationHelper");
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* CollaborationHelper for collaboration related utility
|
|
17
|
+
* @namespace
|
|
18
|
+
* @since 1.108
|
|
19
|
+
* @alias module:sap/suite/ui/commons/collaboration/CollaborationHelper
|
|
20
|
+
* @private
|
|
21
|
+
* @ui5-restricted
|
|
22
|
+
* @experimental Since 1.108
|
|
23
|
+
*/
|
|
24
|
+
var CollaborationHelper = BaseObject.extend(
|
|
25
|
+
"sap.suite.ui.commons.collaboration.CollaborationHelper"
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* This function creates a shortened URL.
|
|
30
|
+
* @param {string} sUrl full URL
|
|
31
|
+
* @returns {string} This function returns a shortened url in the format
|
|
32
|
+
* `<protocol>/<hostname>#<semantic-object>&/sap-url-hash=<UUID>`
|
|
33
|
+
* @private
|
|
34
|
+
* @ui5-restricted sap.suite.suite-ui-commons
|
|
35
|
+
* @experimental since 1.108
|
|
36
|
+
*/
|
|
37
|
+
CollaborationHelper.compactHash = function (sUrl) {
|
|
38
|
+
var oShellContainer = sap.ushell && sap.ushell.Container;
|
|
39
|
+
if (!oShellContainer) {
|
|
40
|
+
//In case uShell Container is not present, minification is not needed.
|
|
41
|
+
return {
|
|
42
|
+
url: sUrl
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return oShellContainer.getServiceAsync("AppState").then(
|
|
46
|
+
function (oAppStateService) {
|
|
47
|
+
var oEmptyAppState = oAppStateService.createEmptyAppState(
|
|
48
|
+
undefined,
|
|
49
|
+
false
|
|
50
|
+
);
|
|
51
|
+
var sKey = this._getNextKey(oEmptyAppState);
|
|
52
|
+
if (!this._isEligibleForBackendPersistency(oAppStateService)) {
|
|
53
|
+
oLogger.warning("Transient flag is true. URL will not be shortened");
|
|
54
|
+
return {
|
|
55
|
+
url: sUrl
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
var sUrlBeforeHash = this._extractURLBeforeHash(sUrl);
|
|
59
|
+
var sSemanticObjectAndAction = this._extractSemanticObjectAndAction(sUrl);
|
|
60
|
+
if (!sSemanticObjectAndAction) {
|
|
61
|
+
// In case sSemanticObjectAndAction is undefined, let's not minify the url.
|
|
62
|
+
return {
|
|
63
|
+
url: sUrl
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return this._storeUrl(sUrl, oEmptyAppState)
|
|
67
|
+
.then(function () {
|
|
68
|
+
return {
|
|
69
|
+
url: sUrlBeforeHash + "#" + sSemanticObjectAndAction + "&/" + URL_KEY + "=" + sKey
|
|
70
|
+
};
|
|
71
|
+
})
|
|
72
|
+
.catch(function (error) {
|
|
73
|
+
oLogger.warning("URL is not shortened due to an error." + error.toString());
|
|
74
|
+
//In case if the wrapper promise is rejected then return the current url as shortened url.
|
|
75
|
+
return {
|
|
76
|
+
url: sUrl
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
}.bind(this)
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* function that returns a Promise that resolves to the current url
|
|
85
|
+
* @returns {Promise} promise with data as current Url
|
|
86
|
+
* @private
|
|
87
|
+
*/
|
|
88
|
+
CollaborationHelper._getCurrentUrl = function () {
|
|
89
|
+
var oUShellContainer = sap.ushell && sap.ushell.Container;
|
|
90
|
+
return oUShellContainer ? new Promise(function (fnResolve) {
|
|
91
|
+
oUShellContainer.getFLPUrlAsync(true).done(function (sFLPUrl) {
|
|
92
|
+
fnResolve(sFLPUrl);
|
|
93
|
+
});
|
|
94
|
+
}) : Promise.resolve(document.URL);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Method checks whether the application is running in Teams environment & if yes disables
|
|
99
|
+
* the Avatar icon on the shell, this is done in synchronously. Method returns a promise.
|
|
100
|
+
* Promise is resolved immediately if URL is not compact. In case of compact hash, then
|
|
101
|
+
* will retrieve the original/complete hash and replace it on the window & then resolve
|
|
102
|
+
* the promise.
|
|
103
|
+
* @return {Promise} return resolved promise when url redirection is done.
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
CollaborationHelper.processAndExpandHash = function () {
|
|
107
|
+
this._hideAvatarFromShellbar();
|
|
108
|
+
return this._getCurrentUrl().then(function (sCurrentUrl) {
|
|
109
|
+
//if the current url has url param, sap-url-hash, then we have to redirect to an actual url.
|
|
110
|
+
if (sCurrentUrl.indexOf(URL_KEY) > -1) {
|
|
111
|
+
var sHash = sCurrentUrl.split('#')[1].split('=')[1];
|
|
112
|
+
return this._retrieveURL(sHash).then(function (oAppState) {
|
|
113
|
+
window.location.replace(oAppState.getData());
|
|
114
|
+
return Promise.resolve();
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
return Promise.resolve();
|
|
118
|
+
}.bind(this));
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Hides avatar of user if app is running in the MS Teams application.
|
|
123
|
+
* @private
|
|
124
|
+
* @ui5-restricted sap.suite.suite-ui-commons
|
|
125
|
+
* @experimental since 1.108
|
|
126
|
+
*/
|
|
127
|
+
CollaborationHelper._hideAvatarFromShellbar = function () {
|
|
128
|
+
this.isTeamsModeActive().then(function (bIsActive) {
|
|
129
|
+
if (bIsActive) {
|
|
130
|
+
var oAvatar = sap.ui.getCore().byId('meAreaHeaderButton');
|
|
131
|
+
if (oAvatar) {
|
|
132
|
+
oAvatar.setVisible(false);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Determines whether application is running inside the MS Teams.
|
|
140
|
+
* In case url parameter "sap-collaboration-teams" is set to true & appState is set to lean
|
|
141
|
+
* method runs that application is running in Teams environment
|
|
142
|
+
* @returns {Promise} return resolved promise with data true in case conditions are met else false
|
|
143
|
+
* @public
|
|
144
|
+
*/
|
|
145
|
+
CollaborationHelper.isTeamsModeActive = function () {
|
|
146
|
+
var bAppRunningInTeams = false;
|
|
147
|
+
var oUshellContainer = sap.ushell && sap.ushell.Container;
|
|
148
|
+
var oURLParsing = oUshellContainer && oUshellContainer.getService("URLParsing");
|
|
149
|
+
return this._getCurrentUrl().then(function (sCurrentUrl) {
|
|
150
|
+
var sBeforeHashURL = sCurrentUrl.split("#")[0];
|
|
151
|
+
if (sBeforeHashURL.indexOf('?') !== -1) {
|
|
152
|
+
var oParsedUrl = oURLParsing && oURLParsing.parseParameters(sBeforeHashURL.substring(sBeforeHashURL.indexOf('?')));
|
|
153
|
+
if (oParsedUrl &&
|
|
154
|
+
oParsedUrl["sap-collaboration-teams"] &&
|
|
155
|
+
oParsedUrl["sap-collaboration-teams"][0] &&
|
|
156
|
+
oParsedUrl["sap-collaboration-teams"][0] === "true") {
|
|
157
|
+
bAppRunningInTeams = true;
|
|
158
|
+
}
|
|
159
|
+
var bAppStateLean = false;
|
|
160
|
+
if (oParsedUrl &&
|
|
161
|
+
oParsedUrl["appState"] &&
|
|
162
|
+
oParsedUrl["appState"][0] &&
|
|
163
|
+
oParsedUrl["appState"][0] === "lean") {
|
|
164
|
+
bAppStateLean = true;
|
|
165
|
+
}
|
|
166
|
+
return Promise.resolve(bAppRunningInTeams && bAppStateLean);
|
|
167
|
+
} else {
|
|
168
|
+
return Promise.resolve(false);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* This function retrieves the url stored against the hash in the K/V persistent store.
|
|
175
|
+
* @param {string} hash hash from the URL
|
|
176
|
+
* @returns {AppState} instance of AppState
|
|
177
|
+
* @private
|
|
178
|
+
*/
|
|
179
|
+
CollaborationHelper._retrieveURL = function (hash) {
|
|
180
|
+
if (sap.ushell && sap.ushell.Container) {
|
|
181
|
+
return sap.ushell.Container.getServiceAsync("AppState").then(function (oAppStateService) {
|
|
182
|
+
return oAppStateService.getAppState(hash);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* This function checks the transient flag in the _oConfig object.
|
|
189
|
+
* @param {AppState} appStateInstance instance of AppState
|
|
190
|
+
* @returns {boolean} true if transient flag is set to false
|
|
191
|
+
* @private
|
|
192
|
+
*/
|
|
193
|
+
CollaborationHelper._isEligibleForBackendPersistency = function (appStateInstance) {
|
|
194
|
+
return appStateInstance && appStateInstance._oConfig && TRANSIENT_KEY in appStateInstance._oConfig && !appStateInstance._oConfig[TRANSIENT_KEY];
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* This function generates an alphanumberic UUID string.
|
|
199
|
+
* @param {AppState} oAppStateService instance of AppState
|
|
200
|
+
* @returns {string} Returns a randomly generated UUID string.
|
|
201
|
+
* @private
|
|
202
|
+
*/
|
|
203
|
+
CollaborationHelper._getNextKey = function (oAppStateService) {
|
|
204
|
+
return oAppStateService.getKey();
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* This functions parses a url and extracts smenatic-object, action and context-raw if applicable.
|
|
209
|
+
* @param {string} sUrl full url
|
|
210
|
+
* @returns {string} Returns a string in the format <semantic-object>-<action>~<contextRaw>.
|
|
211
|
+
* @private
|
|
212
|
+
*/
|
|
213
|
+
CollaborationHelper._extractSemanticObjectAndAction = function (sUrl) {
|
|
214
|
+
var URLParser = sap.ushell && sap.ushell.services && new sap.ushell.services.URLParsing();
|
|
215
|
+
if (URLParser) {
|
|
216
|
+
var parsedShellHash = URLParser.parseShellHash(this._extractURLHash(sUrl));
|
|
217
|
+
if (parsedShellHash) {
|
|
218
|
+
return parsedShellHash.contextRaw ?
|
|
219
|
+
parsedShellHash.semanticObject + "-" +
|
|
220
|
+
parsedShellHash.action + "~" +
|
|
221
|
+
parsedShellHash.contextRaw :
|
|
222
|
+
parsedShellHash.semanticObject + "-" + parsedShellHash.action;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return undefined;
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Extracting URL present before the # character.
|
|
230
|
+
* @param {string} sUrl full url
|
|
231
|
+
* @returns {string} string before the # character in the URL.
|
|
232
|
+
* @private
|
|
233
|
+
*/
|
|
234
|
+
CollaborationHelper._extractURLBeforeHash = function (sUrl) {
|
|
235
|
+
var sUrlFragementBeforeHash = sUrl.split("#")[0];
|
|
236
|
+
return sUrlFragementBeforeHash;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Extracting hash from the URL
|
|
241
|
+
* @param {string} sUrl full url
|
|
242
|
+
* @returns {string} hash from the URL
|
|
243
|
+
* @private
|
|
244
|
+
*/
|
|
245
|
+
CollaborationHelper._extractURLHash = function (sUrl) {
|
|
246
|
+
var sUrlHash = sUrl.substring(sUrl.indexOf('#'));
|
|
247
|
+
return sUrlHash;
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* This function saves the hash and the long url in the K/V DB.
|
|
252
|
+
* @param {string} sUrl full URL
|
|
253
|
+
* @param {AppState} oAppStateService instance of AppState
|
|
254
|
+
* @returns {Promise} Promise which ultimately resolves once the value is stored successfully.
|
|
255
|
+
* @private
|
|
256
|
+
*/
|
|
257
|
+
CollaborationHelper._storeUrl = function (sUrl, oAppStateService) {
|
|
258
|
+
oAppStateService.setData(sUrl);
|
|
259
|
+
return oAppStateService.save();
|
|
260
|
+
};
|
|
261
|
+
return CollaborationHelper;
|
|
262
|
+
}
|
|
263
|
+
);
|