@sapui5/sap.ui.export 1.110.0 → 1.111.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapui5/sap.ui.export",
3
- "version": "1.110.0",
3
+ "version": "1.111.0",
4
4
  "description": "SAPUI5 Library sap.ui.export",
5
5
  "homepage": "https://sap.github.io/ui5-tooling/pages/SAPUI5/",
6
6
  "author": "SAP SE (https://www.sap.com)",
@@ -5,7 +5,7 @@
5
5
  <vendor>SAP SE</vendor>
6
6
  <copyright>SAPUI5
7
7
  * (c) Copyright 2009-2023 SAP SE. All rights reserved.</copyright>
8
- <version>1.110.0</version>
8
+ <version>1.111.0</version>
9
9
 
10
10
  <documentation>UI5 library: sap.ui.export</documentation>
11
11
 
@@ -27,7 +27,7 @@ sap.ui.define([
27
27
  * @constructor The <code>sap.ui.export.ExportBase</code> class allows you to export table data from a UI5 application to certain formats. This class is an abstract class that requires specific implementations for each file format.
28
28
  *
29
29
  * @author SAP SE
30
- * @version 1.110.0
30
+ * @version 1.111.0
31
31
  *
32
32
  * @since 1.96
33
33
  * @name sap.ui.export.ExportBase
@@ -36,9 +36,11 @@ sap.ui.define([
36
36
  */
37
37
  var ExportBase = EventProvider.extend('sap.ui.export.ExportBase', {
38
38
 
39
- constructor: function(mSettings) {
39
+ constructor: function(mSettings, mCapabilities) {
40
40
  EventProvider.call(this, mSettings);
41
41
 
42
+ this._mCapabilities = mCapabilities || {};
43
+
42
44
  /* Default settings */
43
45
  this._mSettings = {
44
46
  fileName: 'Export'
@@ -121,6 +123,8 @@ sap.ui.define([
121
123
  EventProvider.prototype.destroy.apply(this, arguments);
122
124
 
123
125
  this.cancel();
126
+ this._mSettings = null;
127
+ this._mCapabilities = null;
124
128
  this.bIsDestroyed = true;
125
129
  };
126
130
 
@@ -15,7 +15,7 @@ sap.ui.define(['./library', './ExportUtils', './ExportDialog', 'sap/m/MessageToa
15
15
  * @class The <code>sap.ui.export.ExportHandler</code> class allows you to export table data from a UI5 application.
16
16
  *
17
17
  * @author SAP SE
18
- * @version 1.110.0
18
+ * @version 1.111.0
19
19
  *
20
20
  * @since 1.102
21
21
  * @alias sap.ui.export.ExportHandler
@@ -56,9 +56,9 @@ sap.ui.define(['./library', './ExportUtils', './ExportDialog', 'sap/m/MessageToa
56
56
  * @param {sap.ui.base.Event} oEvent
57
57
  * @param {sap.ui.base.EventProvider} oEvent.getSource
58
58
  * @param {object} oEvent.getParameters
59
- * @param {object} oEvent.getParameter.exportSettings Contains export-related configuration
60
- * @param {object} oEvent.getParameter.userExportSettings User specific settings from the "Export As" dialog
61
- * @param {sap.ui.export.util.Filter[]} oEvent.getParameter.filterSettings Array of filter settings for the exported data
59
+ * @param {object} oEvent.getParameters.exportSettings Contains export-related configuration
60
+ * @param {object} oEvent.getParameters.userExportSettings User specific settings from the "Export As" dialog
61
+ * @param {sap.ui.export.util.Filter[]} oEvent.getParameters.filterSettings Array of filter settings for the exported data
62
62
  *
63
63
  * @since 1.102
64
64
  * @public
@@ -244,7 +244,7 @@ sap.ui.define(['./library', './ExportUtils', './ExportDialog', 'sap/m/MessageToa
244
244
 
245
245
  return Promise.all([
246
246
  ExportUtils.getResourceBundle(),
247
- ExportUtils.getExportInstance(mExportSettings)
247
+ ExportUtils.getExportInstance(mExportSettings, this._mCapabilities)
248
248
  ]).then(function(aResolve) {
249
249
  var oResourceBundle = aResolve[0];
250
250
  var oExportInstance = aResolve[1];
@@ -133,7 +133,7 @@ sap.ui.define([
133
133
  * Utilities related to export to enable reuse in integration scenarios (e.g. tables).
134
134
  *
135
135
  * @author SAP SE
136
- * @version 1.110.0
136
+ * @version 1.111.0
137
137
  *
138
138
  * @since 1.59
139
139
  * @name sap.ui.export.ExportUtils
@@ -236,10 +236,13 @@ sap.ui.define([
236
236
  if (typeof bRemoteDestination === 'object') {
237
237
  fnCallback = oOpener;
238
238
  oOpener = bRemoteDestination;
239
+ bRemoteDestination = undefined;
239
240
  } else if (typeof bRemoteDestination === 'function') {
240
241
  fnCallback = bRemoteDestination;
242
+ bRemoteDestination = undefined;
241
243
  } else if (typeof oOpener === 'function') {
242
244
  fnCallback = oOpener;
245
+ oOpener = null;
243
246
  }
244
247
 
245
248
  oResourceBundlePromise.then(function (oResourceBundle) {
@@ -593,7 +596,7 @@ sap.ui.define([
593
596
 
594
597
  aFilters = [];
595
598
 
596
- if (!oBinding || !(oBinding.isA('sap.ui.model.ListBinding') || !oBinding.isA('sap.ui.model.TreeBinding'))) {
599
+ if (!oBinding || !oBinding.isA(['sap.ui.model.ListBinding', 'sap.ui.model.TreeBinding'])) {
597
600
  Log.error('A ListBinding or TreeBinding is required for parsing the filter settings');
598
601
  return aFilters;
599
602
  }
@@ -985,14 +988,14 @@ sap.ui.define([
985
988
  if (oColumn.type === EdmType.DateTime) {
986
989
 
987
990
  /*
988
- * Apply local time or UTC as fixed timezone
989
- * in case no timezone is defined. This also
991
+ * Apply user timezone or UTC as fixed timezone
992
+ * in case no timezone was provided. This also
990
993
  * serves as a fallback if timezoneProperty
991
994
  * is defined but the Line Item has no value
992
995
  * for the referenced property name.
993
996
  */
994
997
  if (!oColumn.timezone) {
995
- oColumn.timezone = oColumn.utc === false ? new Intl.DateTimeFormat().resolvedOptions().timeZone : 'UTC';
998
+ oColumn.timezone = oColumn.utc === false ? Core.getConfiguration().getTimezone() : 'UTC';
996
999
  }
997
1000
 
998
1001
  /* Remove obviously incorrect timezoneProperty settings */
@@ -1030,6 +1033,7 @@ sap.ui.define([
1030
1033
 
1031
1034
  Utils._validateWorkbookContext(mWorkbook.context);
1032
1035
  Utils._validateString(mWorkbook, 'hierarchyLevel');
1036
+ Utils._validateString(mWorkbook, 'drillState');
1033
1037
  },
1034
1038
 
1035
1039
  /**
@@ -1102,7 +1106,7 @@ sap.ui.define([
1102
1106
  *
1103
1107
  * @param {object} oContext Context object
1104
1108
  * @param {string} [oContext.application] Name of the application (default: "SAP UI5")
1105
- * @param {string} [oContext.version] Application version (default: "1.110.0")
1109
+ * @param {string} [oContext.version] Application version (default: "1.111.0")
1106
1110
  * @param {string} [oContext.title] Title that will be written to the file (NOT the filename)
1107
1111
  * @param {string} [oContext.modifiedBy] Optional user context that will be written to the file
1108
1112
  * @param {string} [oContext.sheetName] Name of the data sheet - Maximum length of 31 characters
@@ -1248,11 +1252,13 @@ sap.ui.define([
1248
1252
  * no specific FileType is defined in the export settings.
1249
1253
  *
1250
1254
  * @param {object} mSettings Export configuration with optional FileType
1251
- * @returns {Promise} A Promise that gets resolved with the requested instance
1255
+ * @param {object} [mCapabilities] Export Capabilities for all supported types
1256
+ * @returns {Promise<sap.ui.export.ExportBase>} A Promise that gets resolved with the requested instance
1252
1257
  */
1253
- getExportInstance: function(mSettings) {
1258
+ getExportInstance: function(mSettings, mCapabilities) {
1254
1259
  var sClassName, sFileType;
1255
1260
 
1261
+ mCapabilities = mCapabilities ? mCapabilities : {};
1256
1262
  sFileType = typeof mSettings.fileType === 'string' ? mSettings.fileType.toUpperCase() : mSettings.fileType;
1257
1263
 
1258
1264
  switch (sFileType) {
@@ -1265,7 +1271,7 @@ sap.ui.define([
1265
1271
 
1266
1272
  return new Promise(function(fnResolve) {
1267
1273
  sap.ui.require([sClassName], function(ExportClass) {
1268
- fnResolve(new ExportClass(mSettings));
1274
+ fnResolve(new ExportClass(mSettings, mCapabilities[sFileType]));
1269
1275
  });
1270
1276
  });
1271
1277
  },
@@ -17,7 +17,7 @@ sap.ui.define([
17
17
  * @constructor The <code>sap.ui.export.PortableDocument</code> class allows you to export table data from a UI5 application to a Portable Document Format (*.PDF) file.
18
18
  *
19
19
  * @author SAP SE
20
- * @version 1.110.0
20
+ * @version 1.111.0
21
21
  *
22
22
  * @since 1.96
23
23
  * @alias sap.ui.export.PortableDocument
@@ -26,9 +26,8 @@ sap.ui.define([
26
26
  */
27
27
  var PortableDocument = ExportBase.extend('sap.ui.export.PortableDocument', {
28
28
 
29
- constructor: function(mSettings) {
30
- ExportBase.call(this, mSettings);
31
-
29
+ constructor: function(mSettings, mCapabilities) {
30
+ ExportBase.call(this, mSettings, mCapabilities);
32
31
 
33
32
  /* Only apply supported properties */
34
33
  ['paperSize', 'orientation', 'font', 'fontSize', 'doEnableAccessibility', 'fitToPage', 'signature', 'signatureReason', 'pdfArchive'].forEach(function(sProperty) {
@@ -82,21 +81,9 @@ sap.ui.define([
82
81
  * @returns {object} - Valid data source configuration built upon the ListBinding
83
82
  */
84
83
  PortableDocument.prototype.createDataSourceFromBinding = function(oBinding) {
85
-
86
- /**
87
- * Use empty array as default in case of <code>ListBinding</code> is not of type
88
- * ClientListBinding and does not provide a getDownloadUrl function
89
- */
90
84
  var oDataSource = null;
91
85
 
92
- /**
93
- * If <code>ClientListBinding</code>, we use the binding path to receive the data from the underlying model
94
- */
95
- if (oBinding.isA('sap.ui.model.ClientListBinding')) {
96
- Log.error('Unable to create dataSource configuration due to not supported Binding: ' + oBinding.getMetadata().getName());
97
- }
98
-
99
- if (oBinding.isA('sap.ui.model.ClientTreeBinding')) {
86
+ if (oBinding.isA(['sap.ui.model.ClientListBinding', 'sap.ui.model.ClientTreeBinding'])) {
100
87
  Log.error('Unable to create dataSource configuration due to not supported Binding: ' + oBinding.getMetadata().getName());
101
88
  }
102
89
 
@@ -124,7 +111,7 @@ sap.ui.define([
124
111
  type: 'odata',
125
112
  version: bV4ODataModel ? 4 : 2,
126
113
  dataUrl: oDataUrl.toString(),
127
- serviceUrl: sServiceUrl.split('/').slice(0, -5).join('/') + '/default/iwbep/common/0001/', // Requires the serviceUrl to end with a /
114
+ serviceUrl: this._resolveServiceUrl(sServiceUrl),
128
115
  headers: bV4ODataModel ? oModel.getHttpHeaders(true) : oModel.getHeaders()
129
116
  };
130
117
  }
@@ -132,6 +119,33 @@ sap.ui.define([
132
119
  return oDataSource;
133
120
  };
134
121
 
122
+ /**
123
+ * Resolves the service URL that contains the DocumentDescription
124
+ * relative to the current service URL. The returned service URL
125
+ * always ends with an forward slash.
126
+ *
127
+ * @param {string} sCurrentServiceUrl URL of the data service
128
+ * @returns {string} Converted service url
129
+ */
130
+ PortableDocument.prototype._resolveServiceUrl = function(sCurrentServiceUrl) {
131
+ var isRelative, sReference;
132
+
133
+ sCurrentServiceUrl += sCurrentServiceUrl.endsWith('/') ? '' : '/';
134
+ isRelative = /^[\./]/.test(sCurrentServiceUrl);
135
+ sReference = this._mCapabilities.DocumentDescriptionReference;
136
+
137
+ if (typeof sReference !== 'string') {
138
+ return sCurrentServiceUrl.split('/').slice(0, -5).join('/') + '/default/iwbep/common/0001/';
139
+ }
140
+
141
+ sReference = sReference.endsWith('/') ? sReference : sReference.split('/').slice(0, -1).join('/') + '/';
142
+ var oUrl = new URL(sCurrentServiceUrl, document.baseURI);
143
+
144
+ oUrl = new URL(sReference, oUrl.href);
145
+
146
+ return isRelative ? oUrl.pathname : oUrl.href;
147
+ };
148
+
135
149
  /**
136
150
  * Creates the DocumentDescription based on the given export
137
151
  * settings and assigns a unique Id to it.
@@ -167,6 +181,13 @@ sap.ui.define([
167
181
  "TableColumns": []
168
182
  };
169
183
 
184
+ if (oWorkbook.hierarchyLevel && oWorkbook.drillState && window.location.href.includes('sap-ui-xx-enable-tree-export')) {
185
+ oDocumentDescription.Hierarchy = {
186
+ "DistanceFromRootElement": oWorkbook.hierarchyLevel,
187
+ "DrillStateElement": oWorkbook.drillState
188
+ };
189
+ }
190
+
170
191
  oMetaInfo = oWorkbook.context.metainfo;
171
192
 
172
193
  /* Add metaInfo to CoverPage */
@@ -226,9 +247,15 @@ sap.ui.define([
226
247
  * @returns {string} Name of the EntitySet according to the OData version
227
248
  */
228
249
  PortableDocument.prototype._getEntitySetName = function(mDataSource) {
229
- var version = mDataSource && mDataSource.version || 2; // Use OData V2 by default
250
+ var sCollectionName, iVersion;
251
+
252
+ iVersion = mDataSource && mDataSource.version || 2; // Use OData V2 by default
253
+
254
+ if (this._mCapabilities && typeof this._mCapabilities.DocumentDescriptionCollection === 'string') {
255
+ sCollectionName = this._mCapabilities.DocumentDescriptionCollection;
256
+ }
230
257
 
231
- return version == 4 ? 'MyDocumentDescriptions' : 'SAP__MyDocumentDescriptions';
258
+ return sCollectionName || (iVersion == 4 ? 'MyDocumentDescriptions' : 'SAP__MyDocumentDescriptions');
232
259
  };
233
260
 
234
261
  /**
@@ -238,9 +265,9 @@ sap.ui.define([
238
265
  * @returns {ODataModel} ODataModel, either V2 or V4.
239
266
  */
240
267
  PortableDocument.prototype._getModel = function(oDataSource) {
241
- var version = oDataSource.version || 2;
268
+ var iVersion = oDataSource.version || 2;
242
269
 
243
- return version === 4 ? new ODataModel({
270
+ return iVersion === 4 ? new ODataModel({
244
271
  serviceUrl: oDataSource.serviceUrl,
245
272
  synchronizationMode: 'None'
246
273
  }) : this._oModel;
@@ -83,7 +83,7 @@ sap.ui.define([
83
83
  * <li><code>workbook.context</code> - Context object that will be applied to the generated file. It may contain the following fields:</li>
84
84
  * <ul>
85
85
  * <li><code>application</code> (string) - The application that creates the XLSX document (default: "SAP UI5")</li>
86
- * <li><code>version</code> (string) - Application version that creates the XLSX document (default: "1.110.0")</li>
86
+ * <li><code>version</code> (string) - Application version that creates the XLSX document (default: "1.111.0")</li>
87
87
  * <li><code>title</code> (string) - Title of the XLSX document (NOT the filename)</li>
88
88
  * <li><code>modifiedBy</code> (string) - User context for the XLSX document</li>
89
89
  * <li><code>sheetName</code> (string) - The label of the data sheet</li>
@@ -166,7 +166,7 @@ sap.ui.define([
166
166
  * columns: aColumns,
167
167
  * context: {
168
168
  * application: 'Debug Test Application',
169
- * version: '1.110.0',
169
+ * version: '1.111.0',
170
170
  * title: 'Some random title',
171
171
  * modifiedBy: 'John Doe',
172
172
  * metaSheetName: 'Custom metadata',
@@ -278,7 +278,7 @@ sap.ui.define([
278
278
  * @constructor The <code>sap.ui.export.Spreadsheet</code> class allows you to export table data from a UI5 application to a spreadsheet file.
279
279
  *
280
280
  * @author SAP SE
281
- * @version 1.110.0
281
+ * @version 1.111.0
282
282
  *
283
283
  * @since 1.50
284
284
  * @name sap.ui.export.Spreadsheet
@@ -22,7 +22,7 @@ sap.ui.define(['sap/base/Log', 'sap/ui/export/ExportUtils'], function(Log, Expor
22
22
  *
23
23
  * @namespace
24
24
  * @author SAP SE
25
- * @version 1.110.0
25
+ * @version 1.111.0
26
26
  *
27
27
  * @private
28
28
  * @since 1.50.0
@@ -5,14 +5,14 @@
5
5
  <Input id="exportSettingsDialog-fileName" value="{/fileName}" liveChange=".onFileNameChange" class="sapUiTinyMarginBottom"/>
6
6
 
7
7
  <Label text="{i18n>SELECT_FORMAT}" labelFor="exportSettingsDialog-fileType"/>
8
- <Select id="exportSettingsDialog-fileType" selectedKey="{/fileType}" items="{path: '/fileTypeCollection'}" change=".onFileTypeChange" width="100%" class="sapUiTinyMarginBottom">
8
+ <Select id="exportSettingsDialog-fileType" selectedKey="{/fileType}" items="{/fileTypeCollection}" change=".onFileTypeChange" width="100%" class="sapUiTinyMarginBottom">
9
9
  <items>
10
10
  <core:Item key="{key}" text="{text}"/>
11
11
  </items>
12
12
  </Select>
13
13
 
14
14
  <Label text="{i18n>SELECT_DESTINATION}" labelFor="exportSettingsDialog-destination" visible="{path: '/destinationCollection', formatter: '.hasDestinations'}"/>
15
- <Select id="exportSettingsDialog-destination" selectedKey="{/destination}" items="{path: '/destinationCollection'}" visible="{path: '/destinationCollection', formatter: '.hasDestinations'}" enabled="{path: '/fileType', formatter: '.isDestinationEnabled'}" width="100%" class="sapUiTinyMarginBottom">
15
+ <Select id="exportSettingsDialog-destination" selectedKey="{/destination}" items="{/destinationCollection}" visible="{path: '/destinationCollection', formatter: '.hasDestinations'}" enabled="{path: '/fileType', formatter: '.isDestinationEnabled'}" width="100%" class="sapUiTinyMarginBottom">
16
16
  <items>
17
17
  <core:Item key="{key}" text="{text}"/>
18
18
  </items>
@@ -26,14 +26,14 @@
26
26
 
27
27
  <!-- PDF Specific settings -->
28
28
  <Label text="{i18n>PAPER_SIZE}" labelFor="exportSettingsDialog-papersize" visible="{path:'/fileType', formatter: '.isPDF'}"/>
29
- <Select id="exportSettingsDialog-papersize" selectedKey="{/paperSize}" items="{path: '/paperSizeCollection'}" width="100%" visible="{path:'/fileType', formatter: '.isPDF'}" class="sapUiTinyMarginBottom">
29
+ <Select id="exportSettingsDialog-papersize" selectedKey="{/paperSize}" items="{/paperSizeCollection}" width="100%" visible="{path:'/fileType', formatter: '.isPDF'}" class="sapUiTinyMarginBottom">
30
30
  <items>
31
31
  <core:Item key="{key}" text="{text}"/>
32
32
  </items>
33
33
  </Select>
34
34
 
35
35
  <Label text="{i18n>ORIENTATION}" labelFor="exportSettingsDialog-orientation" visible="{path:'/fileType', formatter: '.isPDF'}"/>
36
- <Select id="exportSettingsDialog-orientation" selectedKey="{/orientation}" items="{path: '/orientationCollection'}" width="100%" visible="{path:'/fileType', formatter: '.isPDF'}" class="sapUiTinyMarginBottom">
36
+ <Select id="exportSettingsDialog-orientation" selectedKey="{/orientation}" items="{/orientationCollection}" width="100%" visible="{path:'/fileType', formatter: '.isPDF'}" class="sapUiTinyMarginBottom">
37
37
  <items>
38
38
  <core:Item key="{key}" text="{text}"/>
39
39
  </items>
@@ -17,7 +17,7 @@ sap.ui.define([
17
17
  * @namespace
18
18
  * @alias sap.ui.export
19
19
  * @author SAP SE
20
- * @version 1.110.0
20
+ * @version 1.111.0
21
21
  * @public
22
22
  */
23
23
 
@@ -33,7 +33,7 @@ sap.ui.define([
33
33
  interfaces: [],
34
34
  controls: [],
35
35
  elements: [],
36
- version: "1.110.0"
36
+ version: "1.111.0"
37
37
  });
38
38
 
39
39
 
@@ -15,16 +15,17 @@ sap.ui.define(['sap/ui/base/Object'], function(BaseObject) {
15
15
  * @param {boolean} [vRawFilter.exclude] Defines whether it is an exclude filter
16
16
  * @param {string} [sLabel] Optional label for the filter property
17
17
  *
18
- * @constructor The <code>sap.ui.export.util.Filter</code> class represents filter settings that are used for the export.
18
+ * @class The <code>sap.ui.export.util.Filter</code> class represents filter settings that are used for the export.
19
19
  * It provides the capability to have a visual representation of the filters in the exported document and offers
20
20
  * convenience functions like <code>sap.ui.export.util.Filter#setType</code> to improve the result.
21
21
  *
22
22
  * @author SAP SE
23
- * @version 1.110.0
23
+ * @version 1.111.0
24
24
  *
25
25
  * @since 1.110
26
26
  * @name sap.ui.export.util.Filter
27
27
  * @extends sap.ui.base.Object
28
+ * @constructor
28
29
  * @public
29
30
  */
30
31
  var Filter = BaseObject.extend('sap.ui.export.util.Filter', {