@sapui5/sap.ui.export 1.114.0 → 1.114.2

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.114.0",
3
+ "version": "1.114.2",
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.114.0</version>
8
+ <version>1.114.2</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.114.0
30
+ * @version 1.114.2
31
31
  *
32
32
  * @since 1.96
33
33
  * @alias sap.ui.export.ExportBase
@@ -9,14 +9,15 @@
9
9
  */
10
10
  sap.ui.define([
11
11
  'sap/ui/core/library',
12
+ 'sap/ui/core/format/NumberFormat',
13
+ 'sap/ui/export/ExportUtils',
12
14
  'sap/m/library',
13
15
  'sap/m/Dialog',
14
16
  'sap/m/Button',
15
17
  'sap/m/ProgressIndicator',
16
18
  'sap/m/Text',
17
- 'sap/m/MessageBox',
18
- 'sap/ui/core/format/NumberFormat'
19
- ], function(coreLibrary, MLibrary, Dialog, Button, ProgressIndicator, Text, MessageBox, NumberFormat) {
19
+ 'sap/m/MessageBox'
20
+ ], function(coreLibrary, NumberFormat, ExportUtils, MLibrary, Dialog, Button, ProgressIndicator, Text, MessageBox) {
20
21
  'use strict';
21
22
 
22
23
  var ValueState = coreLibrary.ValueState;
@@ -24,9 +25,6 @@ sap.ui.define([
24
25
  var DialogType = MLibrary.DialogType;
25
26
  var ButtonType = MLibrary.ButtonType;
26
27
 
27
- /* Async call to resource bundle */
28
- var oResourceBundlePromise = sap.ui.getCore().getLibraryResourceBundle("sap.ui.export", true);
29
-
30
28
  /**
31
29
  * The method returns a new Promise that results in a new
32
30
  * progress dialog.
@@ -37,7 +35,7 @@ sap.ui.define([
37
35
  return new Promise(function(fnResolve, fnReject) {
38
36
  var dialog;
39
37
 
40
- oResourceBundlePromise.then(function(oResourceBundle) {
38
+ ExportUtils.getResourceBundle().then(function(oResourceBundle) {
41
39
  var cancelButton = new Button({
42
40
  text : oResourceBundle.getText("CANCEL_BUTTON"),
43
41
  press : function() {
@@ -117,49 +115,60 @@ sap.ui.define([
117
115
  * Shows a warning dialog that can show several warning messages, either alone or combined.
118
116
  *
119
117
  * @param {Object} mParams Configuration of the warning dialog
120
- * @param {number} mParams.rows Amount of rows that will be exported
121
- * @param {number} mParams.columns Amount of columns that will be exported
122
- * @param {boolean} mParams.sizeLimit Indicates whether the size limit warning needs to be shown
123
- * @param {boolean} mParams.cutOff Indicates whether the cut off message needs to be shown
118
+ * @param {number} mParams.rows Number of rows that will be exported
119
+ * @param {number} mParams.columns Number of columns that will be exported
120
+ * @param {boolean} mParams.cellLimit Number of cells that are suported
121
+ * @param {boolean} mParams.rowLimit Number of rows that are supported
124
122
  * @param {String} mParams.fileType File type of the exported document
125
123
  * @returns {Promise} Promise that gets resolved when the user wants to export, regardless of the warning
126
124
  */
127
125
  function showWarningDialog(mParams) {
128
126
  return new Promise(function(fnResolve, fnReject) {
129
127
 
130
- oResourceBundlePromise.then(function(oResourceBundle) {
131
- var bContinue, oWarningDialog, oWarningText, sWarningText, oNumberFormat, sRowsFormatted, sCellsFormatted, sCutOffFormatted, sFileTypeText;
128
+ ExportUtils.getResourceBundle().then(function(oResourceBundle) {
129
+ var aText, bContinue, oWarningDialog, oWarningText, oNumberFormat, sRowCount, sCellCount, sCellLimit, sLimit, sFileType;
132
130
 
133
- oNumberFormat = NumberFormat.getIntegerInstance({groupingEnabled: true});
131
+ aText = [];
134
132
  bContinue = false;
135
- sWarningText = '';
133
+ oNumberFormat = NumberFormat.getIntegerInstance({groupingEnabled: true});
134
+ sFileType = oResourceBundle.getText(mParams.fileType + "_FILETYPE");
135
+ sLimit = oNumberFormat.format(mParams.rowLimit);
136
136
 
137
- if (!mParams.rows) {
138
- sWarningText = oResourceBundle.getText("NO_COUNT_WARNING_MSG");
139
- } else {
140
- sRowsFormatted = oNumberFormat.format(mParams.rows);
137
+ if (mParams.rows) {
138
+ sRowCount = oNumberFormat.format(mParams.rows);
141
139
 
142
- if (mParams.sizeLimit) {
143
- sCellsFormatted = oNumberFormat.format(mParams.rows * mParams.columns);
144
- sWarningText = oResourceBundle.getText("SIZE_WARNING_MSG", [sRowsFormatted, mParams.columns, sCellsFormatted]);
140
+ if (mParams.columns) {
141
+ sCellCount = oNumberFormat.format(mParams.rows * mParams.columns);
142
+ aText.push(oResourceBundle.getText("MSG_WARNING_CELL_COUNT", [sRowCount, mParams.columns, sCellCount]));
143
+ } else {
144
+ aText.push(oResourceBundle.getText("MSG_WARNING_ROW_COUNT", [sRowCount]));
145
145
  }
146
146
 
147
- if (mParams.rows > mParams.cutOff) {
148
- sCutOffFormatted = oNumberFormat.format(mParams.cutOff);
149
- sWarningText += sWarningText === '' ? '' : '\n\n'; // Add line breaks if there is already a message
150
- sFileTypeText = oResourceBundle.getText(mParams.fileType + "_FILETYPE");
151
- sWarningText += oResourceBundle.getText("MSG_WARNING_CUT_OFF", [sRowsFormatted, sCutOffFormatted, sFileTypeText]);
147
+ if (mParams.rows > mParams.rowLimit) {
148
+ aText.push(oResourceBundle.getText("MSG_WARNING_ROW_LIMIT", [sLimit, sFileType]));
152
149
  }
150
+
151
+ if (mParams.rows * mParams.columns > mParams.cellLimit) {
152
+ sCellLimit = oNumberFormat.format(mParams.cellLimit);
153
+ aText.push(oResourceBundle.getText("MSG_WARNING_CELL_LIMIT", [sCellLimit]));
154
+ }
155
+ } else {
156
+ aText.push(oResourceBundle.getText("MSG_WARNING_COUNT_UNKNOWN"));
157
+ aText.push(oResourceBundle.getText("MSG_WARNING_ROW_LIMIT", [sLimit, sFileType]));
158
+ aText.push(oResourceBundle.getText("MSG_WARNING_ADVICE"));
153
159
  }
154
160
 
161
+ aText.push(oResourceBundle.getText("MSG_WARNING_EXPORT_ANYWAY"));
162
+
155
163
  oWarningText = new Text({
156
- text: sWarningText
164
+ text: aText.join('\n\n')
157
165
  });
158
166
  oWarningDialog = new Dialog({
159
167
  title: oResourceBundle.getText('WARNING_TITLE'),
160
168
  type: DialogType.Message,
161
169
  state: ValueState.Warning,
162
170
  content: oWarningText,
171
+ contentWidth: '550px', // UX recommendation
163
172
  ariaLabelledBy: oWarningText,
164
173
  endButton: new Button({
165
174
  type: ButtonType.Transparent,
@@ -201,7 +210,7 @@ sap.ui.define([
201
210
  sMessage = sMessage.message;
202
211
  }
203
212
 
204
- oResourceBundlePromise.then(function(oResourceBundle) {
213
+ ExportUtils.getResourceBundle().then(function(oResourceBundle) {
205
214
  var sErrorMessage = sMessage || oResourceBundle.getText('PROGRESS_ERROR_DEFAULT');
206
215
 
207
216
  // Replace technical error message in case of "out of memory"
@@ -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.114.0
18
+ * @version 1.114.2
19
19
  *
20
20
  * @since 1.102
21
21
  * @alias sap.ui.export.ExportHandler
@@ -33,7 +33,6 @@ sap.ui.define([
33
33
 
34
34
  /* Async call to resource bundle */
35
35
  var oResourceBundle;
36
- var oResourceBundlePromise = Core.getLibraryResourceBundle('sap.ui.export', true);
37
36
 
38
37
  var CLASS_NAME = 'sap.ui.export.ExportUtils';
39
38
 
@@ -135,7 +134,7 @@ sap.ui.define([
135
134
  * @class Utilities related to export to enable reuse in integration scenarios (e.g. tables).
136
135
  *
137
136
  * @author SAP SE
138
- * @version 1.114.0
137
+ * @version 1.114.2
139
138
  *
140
139
  * @since 1.59
141
140
  * @alias sap.ui.export.ExportUtils
@@ -250,7 +249,7 @@ sap.ui.define([
250
249
  oOpener = null;
251
250
  }
252
251
 
253
- oResourceBundlePromise.then(function (oResourceBundle) {
252
+ Utils.getResourceBundle().then(function (oResourceBundle) {
254
253
  var oExportConfigModel = new JSONModel();
255
254
 
256
255
  oExportConfigModel.setData(getDefaultSettings(mCustomConfig, oResourceBundle, oExportCapabilities, bRemoteDestination));
@@ -618,7 +617,7 @@ sap.ui.define([
618
617
  parseFilterConfiguration: function() {
619
618
  Log.error('Function is deprecated and must not be used anymore');
620
619
 
621
- return oResourceBundlePromise.then(function(oResourceBundle) {
620
+ return Utils.getResourceBundle().then(function(oResourceBundle) {
622
621
  return {
623
622
  name: oResourceBundle.getText('FILTER_HEADER'),
624
623
  items: []
@@ -1168,7 +1167,7 @@ sap.ui.define([
1168
1167
  *
1169
1168
  * @param {object} oContext Context object
1170
1169
  * @param {string} [oContext.application] Name of the application (default: "SAP UI5")
1171
- * @param {string} [oContext.version] Application version (default: "1.114.0")
1170
+ * @param {string} [oContext.version] Application version (default: "1.114.2")
1172
1171
  * @param {string} [oContext.title] Title that will be written to the file (NOT the filename)
1173
1172
  * @param {string} [oContext.modifiedBy] Optional user context that will be written to the file
1174
1173
  * @param {string} [oContext.sheetName] Name of the data sheet - Maximum length of 31 characters
@@ -21,7 +21,7 @@ sap.ui.define([
21
21
  * @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.
22
22
  *
23
23
  * @author SAP SE
24
- * @version 1.114.0
24
+ * @version 1.114.2
25
25
  *
26
26
  * @since 1.96
27
27
  * @alias sap.ui.export.PortableDocument
@@ -239,10 +239,14 @@ sap.ui.define([
239
239
  }
240
240
  }
241
241
 
242
- /* Eliminate duplicates before adding columns */
242
+ /* Eliminate duplicate or unknown columns before adding them to the DocumentDescription */
243
243
  oWorkbook.columns.filter(function(oColumn, iIndex, aArray) {
244
244
  var sProperty = Array.isArray(oColumn.property) ? oColumn.property[0] : oColumn.property;
245
245
 
246
+ if (!sProperty) {
247
+ return false;
248
+ }
249
+
246
250
  return aArray.findIndex(function(oOtherColumn) {
247
251
  var sOtherProperty = Array.isArray(oOtherColumn.property) ? oOtherColumn.property[0] : oOtherColumn.property;
248
252
 
@@ -312,13 +316,13 @@ sap.ui.define([
312
316
 
313
317
  mParams = {
314
318
  rows: mSettings.dataSource.count,
315
- cutOff: this._mCapabilities.ResultSizeMax,
319
+ rowLimit: this._mCapabilities.ResultSizeMaximum,
316
320
  fileType: FileType.PDF
317
321
  };
318
322
 
319
323
  oWarningPromise = Promise.resolve();
320
324
 
321
- if (mParams.rows > mParams.cutOff) {
325
+ if (isNaN(mParams.rows) || (mParams.rows > mParams.rowLimit)) {
322
326
  oWarningPromise = ExportDialog.showWarningDialog(mParams);
323
327
  }
324
328
 
@@ -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.114.0")</li>
87
+ * <li><code>version</code> (string) - Application version that creates the XLSX document (default: "1.114.2")</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.114.0',
170
+ * version: '1.114.2',
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.114.0
282
+ * @version 1.114.2
283
283
  *
284
284
  * @since 1.50
285
285
  * @alias sap.ui.export.Spreadsheet
@@ -752,8 +752,8 @@ sap.ui.define([
752
752
  var oDialogSettings = {
753
753
  rows: nRows,
754
754
  columns: nColumns,
755
- sizeLimit: nRows * nColumns > nSizeLimit,
756
- cutOff: MAX_ROWS,
755
+ cellLimit: nSizeLimit,
756
+ rowLimit: MAX_ROWS,
757
757
  fileType: Library.FileType.XLSX
758
758
  };
759
759
 
@@ -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.114.0
24
+ * @version 1.114.2
25
25
  *
26
26
  * @alias sap.ui.export.SpreadsheetExport
27
27
  * @private
@@ -15,7 +15,7 @@ sap.ui.define([], function() {
15
15
  * @namespace
16
16
  * @alias sap.ui.export
17
17
  * @author SAP SE
18
- * @version 1.114.0
18
+ * @version 1.114.2
19
19
  * @public
20
20
  */
21
21
 
@@ -31,7 +31,7 @@ sap.ui.define([], function() {
31
31
  interfaces: [],
32
32
  controls: [],
33
33
  elements: [],
34
- version: "1.114.0"
34
+ version: "1.114.2"
35
35
  });
36
36
 
37
37
 
@@ -23,10 +23,25 @@ PROGRESS_FETCHING_MSG=Fetching data from server...
23
23
  PROGRESS_ERROR_TITLE=Error
24
24
 
25
25
  #XMSG: Message text informing that the exported file is too big
26
- SIZE_WARNING_MSG=The document contains {0} rows and {1} column(s) ({2} cells).\n Documents with more than 2,000,000 cells might be too large to process.\n Export anyway?
26
+ MSG_WARNING_CELL_COUNT=The document contains {0} rows and {1} column(s) ({2} cells).
27
27
 
28
- #XMSG: Message text informing that the amount of items is too large to be exported in a single spreadsheet/PDF and the export is being cut off to maximum allowed amount depending on the file type.
29
- MSG_WARNING_CUT_OFF=The document contains {0} rows.\n Only {1} rows can be exported in a single {2} file.\n Export anyway?
28
+ #XMSG: Part of a message text that informs about the file specific cell limit for exporting
29
+ MSG_WARNING_CELL_LIMIT=Documents with more than {0} cells might be too large to process.
30
+
31
+ #XMSG: Part of a message text that informs about the number of rows which will be exported
32
+ MSG_WARNING_ROW_COUNT=The document contains {0} rows.
33
+
34
+ #XMSG: Part of a message text that contains information about the file specific export limit - Placeholder 1 references the limit and placeholder 2 references the file type
35
+ MSG_WARNING_ROW_LIMIT=Only {0} rows can be exported in a single {1} file.
36
+
37
+ #XMSG: Part of a message text that will be used when the number of rows is unknown
38
+ MSG_WARNING_COUNT_UNKNOWN=The document contains an unknown number of rows.
39
+
40
+ #XMSG: Part of a message text that gives advice on how to proceed
41
+ MSG_WARNING_ADVICE=Please do not proceed unless you are sure that the current filter settings do not result in a large amount of data, as the file might be too large to process.
42
+
43
+ #XMSG: Last sentence of a warning message to ask the user if he/she still wants to export
44
+ MSG_WARNING_EXPORT_ANYWAY=Export anyway?
30
45
 
31
46
  #XMSG: Textual representation of the technical error message which indicates that the export ran out of memory.
32
47
  MSG_ERROR_OUT_OF_MEMORY=The export process ran out of memory and was terminated.\n Please adjust your column or filter settings to select a smaller number of cells.
@@ -130,9 +145,6 @@ FILENAME_ERROR=You cannot use any of the following characters in a file name: \\
130
145
  #XMSG: Message text informing that exported file is being created
131
146
  PROGRESS_BUNDLE_MSG=Generating file...
132
147
 
133
- #XMSG: Message text informing that the exported file size cannot be predicted
134
- NO_COUNT_WARNING_MSG=There is no count provided in the export configuration. \nThe total number of exported rows cannot be predicted and might exceed the memory capacity of the application. \nPlease do not proceed unless you are sure that the current filter settings do not result in a large amount of data.
135
-
136
148
  #XTIT: Title of the XLSX document if no title is defined in SpreadSheet settings
137
149
  XLSX_DEFAULT_TITLE=SAPUI5 Export
138
150
 
@@ -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.114.0
37
+ * @version 1.114.2
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.114.0
23
+ * @version 1.114.2
24
24
  *
25
25
  * @since 1.110
26
26
  * @alias sap.ui.export.util.Filter