@sapui5/sap.ui.export 1.120.16 → 1.120.17

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.120.16",
3
+ "version": "1.120.17",
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.120.16</version>
8
+ <version>1.120.17</version>
9
9
 
10
10
  <documentation>UI5 library: sap.ui.export</documentation>
11
11
 
@@ -27,7 +27,7 @@ sap.ui.define([
27
27
  * @class 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.120.16
30
+ * @version 1.120.17
31
31
  *
32
32
  * @since 1.96
33
33
  * @alias sap.ui.export.ExportBase
@@ -16,7 +16,7 @@ sap.ui.define(['./library', './ExportUtils', './ExportDialog', './util/PDFCapabi
16
16
  * @class The <code>sap.ui.export.ExportHandler</code> class allows you to export table data from an SAPUI5 application.
17
17
  *
18
18
  * @author SAP SE
19
- * @version 1.120.16
19
+ * @version 1.120.17
20
20
  *
21
21
  * @since 1.102
22
22
  * @alias sap.ui.export.ExportHandler
@@ -136,7 +136,7 @@ sap.ui.define([
136
136
  * @class Utilities related to export to enable reuse in integration scenarios (e.g. tables).
137
137
  *
138
138
  * @author SAP SE
139
- * @version 1.120.16
139
+ * @version 1.120.17
140
140
  *
141
141
  * @since 1.59
142
142
  * @alias sap.ui.export.ExportUtils
@@ -1219,7 +1219,7 @@ sap.ui.define([
1219
1219
  *
1220
1220
  * @param {object} oContext Context object
1221
1221
  * @param {string} [oContext.application] Name of the application (default: "SAP UI5")
1222
- * @param {string} [oContext.version] Application version (default: "1.120.16")
1222
+ * @param {string} [oContext.version] Application version (default: "1.120.17")
1223
1223
  * @param {string} [oContext.title] Title that will be written to the file (NOT the filename)
1224
1224
  * @param {string} [oContext.modifiedBy] Optional user context that will be written to the file
1225
1225
  * @param {string} [oContext.sheetName] Name of the data sheet - Maximum length of 31 characters
@@ -24,7 +24,7 @@ sap.ui.define([
24
24
  * @class 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.
25
25
  *
26
26
  * @author SAP SE
27
- * @version 1.120.16
27
+ * @version 1.120.17
28
28
  *
29
29
  * @since 1.96
30
30
  * @alias sap.ui.export.PortableDocument
@@ -203,11 +203,15 @@ sap.ui.define([
203
203
  if (oMetaInfo instanceof Array) {
204
204
  oMetaInfo.forEach(function(oGroup) {
205
205
  if (iODataVersion === 2) {
206
+ const truncateString = (sValue) => {
207
+ return sValue.length > 256 ? sValue.substring(0, 253) + '...' : sValue;
208
+ };
209
+
206
210
  oGroup.items.forEach(function(oItem) {
207
211
  const oCoverPageGroup = {
208
212
  "Title": oGroup.name,
209
213
  "Name": oItem.key,
210
- "Value": oItem.value
214
+ "Value": truncateString(oItem.value)
211
215
  };
212
216
  oDocumentDescription["CoverPage"].push(oCoverPageGroup);
213
217
  });
@@ -375,6 +379,33 @@ sap.ui.define([
375
379
  return oWarningPromise;
376
380
  };
377
381
 
382
+ /**
383
+ * Evaluates the error message from the given error parameter and shows it in a dialog.
384
+ *
385
+ * @param {string|object|Blob} vError Error object that is provided
386
+ * @returns {Promise} Shows the error message in a dialog and resolves automatically
387
+ */
388
+ PortableDocument.showErrorMessage = async (vError) => {
389
+ const oResourceBundle = await ExportUtils.getResourceBundle();
390
+
391
+ /* Handle ignore Promise rejection due to cancellation by the user */
392
+ if (!vError) {
393
+ return;
394
+ }
395
+
396
+ if (typeof vError.text === 'function') {
397
+ vError.text()
398
+ .then(function(sError) {
399
+ ExportDialog.showErrorMessage(sError);
400
+ })
401
+ .catch(function() {
402
+ ExportDialog.showErrorMessage(oResourceBundle.getText('PDF_GENERIC_ERROR'));
403
+ });
404
+ } else if (vError.message) {
405
+ ExportDialog.showErrorMessage(vError.message);
406
+ }
407
+ };
408
+
378
409
  /**
379
410
  * Adds the ResultSizeMaximum from the com.sap.vocabularies.PDF.v1.Features
380
411
  * annotation as $top to the data URL. If this property is not available on
@@ -489,19 +520,17 @@ sap.ui.define([
489
520
  *
490
521
  * @private
491
522
  */
492
- PortableDocument.prototype.createBuildPromise = function(mSettings) {
493
- var that = this;
494
- var oDocumentDescription;
495
- var oBusyDialog;
523
+ PortableDocument.prototype.createBuildPromise = async function(mSettings) {
496
524
  var oResourceBundle = Core.getLibraryResourceBundle('sap.ui.export');
525
+ const oDocumentDescription = this._createDocumentDescription(mSettings);
497
526
 
498
- oBusyDialog = new BusyDialog('PDFExportBusyDialog', {
527
+ let oBusyDialog = new BusyDialog('PDFExportBusyDialog', {
499
528
  title: oResourceBundle.getText('PROGRESS_TITLE'),
500
529
  text: oResourceBundle.getText('PDF_GENERATION_IN_PROGRESS'),
501
530
  showCancelButton: true,
502
- close: function(oEvent) {
531
+ close: (oEvent) => {
503
532
  if (oEvent.getParameter('cancelPressed')) {
504
- that.cancel();
533
+ this.cancel();
505
534
  }
506
535
 
507
536
  oBusyDialog.destroy();
@@ -509,31 +538,19 @@ sap.ui.define([
509
538
  }
510
539
  });
511
540
 
512
- oDocumentDescription = that._createDocumentDescription(mSettings);
513
541
  oBusyDialog.open();
514
542
 
515
- return this._showWarning(mSettings).then(function() {
516
- return that.postDocumentDescription(oDocumentDescription, mSettings.dataSource);
517
- }).then(function(sDocumentDescriptionId) {
518
- return oBusyDialog && that.sendRequest(mSettings.dataSource.dataUrl, sDocumentDescriptionId);
519
- }).then(function(response) {
543
+ try {
544
+ await this._showWarning(mSettings);
545
+ const sDocumentDescriptionId = await this.postDocumentDescription(oDocumentDescription, mSettings.dataSource);
546
+ const response = await this.sendRequest(mSettings.dataSource.dataUrl, sDocumentDescriptionId);
547
+
520
548
  ExportUtils.saveAsFile(response, mSettings.fileName);
521
- }).catch(function(oError) {
522
- /* Handle ignore Promise rejection due to cancellation by the user */
523
- if (!oError) {
524
- return;
525
- }
549
+ } catch (oError) {
550
+ PortableDocument.showErrorMessage(oError);
551
+ }
526
552
 
527
- oError.text()
528
- .then(function(sError) {
529
- ExportDialog.showErrorMessage(sError);
530
- })
531
- .catch(function() {
532
- ExportDialog.showErrorMessage(oResourceBundle.getText('PDF_GENERIC_ERROR'));
533
- });
534
- }).finally(function() {
535
- oBusyDialog && oBusyDialog.close();
536
- });
553
+ oBusyDialog?.destroy();
537
554
  };
538
555
 
539
556
  /**
@@ -84,7 +84,7 @@ sap.ui.define([
84
84
  * <li><code>workbook.context</code> - Context object that will be applied to the generated file. It may contain the following fields:</li>
85
85
  * <ul>
86
86
  * <li><code>application</code> (string) - The application that creates the XLSX document (default: "SAP UI5")</li>
87
- * <li><code>version</code> (string) - Application version that creates the XLSX document (default: "1.120.16")</li>
87
+ * <li><code>version</code> (string) - Application version that creates the XLSX document (default: "1.120.17")</li>
88
88
  * <li><code>title</code> (string) - Title of the XLSX document (NOT the filename)</li>
89
89
  * <li><code>modifiedBy</code> (string) - User context for the XLSX document</li>
90
90
  * <li><code>sheetName</code> (string) - The label of the data sheet</li>
@@ -167,7 +167,7 @@ sap.ui.define([
167
167
  * columns: aColumns,
168
168
  * context: {
169
169
  * application: 'Debug Test Application',
170
- * version: '1.120.16',
170
+ * version: '1.120.17',
171
171
  * title: 'Some random title',
172
172
  * modifiedBy: 'John Doe',
173
173
  * metaSheetName: 'Custom metadata',
@@ -279,7 +279,7 @@ sap.ui.define([
279
279
  * @class The <code>sap.ui.export.Spreadsheet</code> class allows you to export table data from a UI5 application to a spreadsheet file.
280
280
  *
281
281
  * @author SAP SE
282
- * @version 1.120.16
282
+ * @version 1.120.17
283
283
  *
284
284
  * @since 1.50
285
285
  * @alias sap.ui.export.Spreadsheet
@@ -21,7 +21,7 @@ sap.ui.define(['sap/base/Log', 'sap/ui/export/ExportUtils'], function(Log, Expor
21
21
  * Utility class to perform spreadsheet export.
22
22
  *
23
23
  * @author SAP SE
24
- * @version 1.120.16
24
+ * @version 1.120.17
25
25
  *
26
26
  * @alias sap.ui.export.SpreadsheetExport
27
27
  * @private
@@ -15,7 +15,7 @@ sap.ui.define(['sap/ui/core/library'], function(library1) {
15
15
  * @namespace
16
16
  * @alias sap.ui.export
17
17
  * @author SAP SE
18
- * @version 1.120.16
18
+ * @version 1.120.17
19
19
  * @public
20
20
  */
21
21
 
@@ -31,7 +31,7 @@ sap.ui.define(['sap/ui/core/library'], function(library1) {
31
31
  interfaces: [],
32
32
  controls: [],
33
33
  elements: [],
34
- version: "1.120.16"
34
+ version: "1.120.17"
35
35
  });
36
36
 
37
37
 
@@ -34,7 +34,7 @@
34
34
  * @param {object} mSettings Data service related part of the export configuration
35
35
  *
36
36
  * @author SAP SE
37
- * @version 1.120.16
37
+ * @version 1.120.17
38
38
  *
39
39
  * @constructor
40
40
  * @class DataProviderBase
@@ -20,7 +20,7 @@ sap.ui.define(['sap/ui/base/Object'], function(BaseObject) {
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.120.16
23
+ * @version 1.120.17
24
24
  *
25
25
  * @since 1.110
26
26
  * @alias sap.ui.export.util.Filter