@sapui5/sap.ui.export 1.136.6 → 1.136.7

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.136.6",
3
+ "version": "1.136.7",
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 2025 SAP SE. All rights reserved.</copyright>
8
- <version>1.136.6</version>
8
+ <version>1.136.7</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.136.6
30
+ * @version 1.136.7
31
31
  *
32
32
  * @since 1.96
33
33
  * @alias sap.ui.export.ExportBase
@@ -28,7 +28,7 @@ sap.ui.define([
28
28
  * @class The <code>sap.ui.export.ExportHandler</code> class allows you to export table data from an SAPUI5 application.
29
29
  *
30
30
  * @author SAP SE
31
- * @version 1.136.6
31
+ * @version 1.136.7
32
32
  *
33
33
  * @since 1.102
34
34
  * @alias sap.ui.export.ExportHandler
@@ -144,7 +144,7 @@ sap.ui.define([
144
144
  * @class Utilities related to export to enable reuse in integration scenarios (e.g. tables).
145
145
  *
146
146
  * @author SAP SE
147
- * @version 1.136.6
147
+ * @version 1.136.7
148
148
  *
149
149
  * @since 1.59
150
150
  * @alias sap.ui.export.ExportUtils
@@ -1208,7 +1208,7 @@ sap.ui.define([
1208
1208
  *
1209
1209
  * @param {object} oContext Context object
1210
1210
  * @param {string} [oContext.application] Name of the application (default: "SAP UI5")
1211
- * @param {string} [oContext.version] Application version (default: "1.136.6")
1211
+ * @param {string} [oContext.version] Application version (default: "1.136.7")
1212
1212
  * @param {string} [oContext.title] Title that will be written to the file (NOT the filename)
1213
1213
  * @param {string} [oContext.modifiedBy] Optional user context that will be written to the file
1214
1214
  * @param {string} [oContext.sheetName] Name of the data sheet - Maximum length of 31 characters
@@ -28,7 +28,7 @@ sap.ui.define([
28
28
  * @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.
29
29
  *
30
30
  * @author SAP SE
31
- * @version 1.136.6
31
+ * @version 1.136.7
32
32
  *
33
33
  * @since 1.96
34
34
  * @alias sap.ui.export.PortableDocument
@@ -90,7 +90,7 @@ sap.ui.define([
90
90
  * <li><code>workbook.context</code> - Context object that will be applied to the generated file. It may contain the following fields:</li>
91
91
  * <ul>
92
92
  * <li><code>application</code> (string) - The application that creates the XLSX document (default: "SAP UI5")</li>
93
- * <li><code>version</code> (string) - Application version that creates the XLSX document (default: "1.136.6")</li>
93
+ * <li><code>version</code> (string) - Application version that creates the XLSX document (default: "1.136.7")</li>
94
94
  * <li><code>title</code> (string) - Title of the XLSX document (NOT the filename)</li>
95
95
  * <li><code>modifiedBy</code> (string) - User context for the XLSX document</li>
96
96
  * <li><code>sheetName</code> (string) - The label of the data sheet</li>
@@ -174,7 +174,7 @@ sap.ui.define([
174
174
  * columns: aColumns,
175
175
  * context: {
176
176
  * application: 'Debug Test Application',
177
- * version: '1.136.6',
177
+ * version: '1.136.7',
178
178
  * title: 'Some random title',
179
179
  * modifiedBy: 'John Doe',
180
180
  * metaSheetName: 'Custom metadata',
@@ -286,7 +286,7 @@ sap.ui.define([
286
286
  * @class The <code>sap.ui.export.Spreadsheet</code> class allows you to export table data from a UI5 application to a spreadsheet file.
287
287
  *
288
288
  * @author SAP SE
289
- * @version 1.136.6
289
+ * @version 1.136.7
290
290
  *
291
291
  * @since 1.50
292
292
  * @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.136.6
24
+ * @version 1.136.7
25
25
  *
26
26
  * @alias sap.ui.export.SpreadsheetExport
27
27
  * @private
@@ -51,8 +51,8 @@ sap.ui.define(['sap/base/Log', 'sap/ui/export/ExportUtils'], function(Log, Expor
51
51
  });
52
52
  }
53
53
 
54
- function onError(error) {
55
- postMessage({ error: error.message || error });
54
+ function onError(oError) {
55
+ postMessage({ error: oError.message || oError });
56
56
  }
57
57
 
58
58
  function onFinish(oArrayBuffer) {
@@ -62,8 +62,8 @@ sap.ui.define(['sap/base/Log', 'sap/ui/export/ExportUtils'], function(Log, Expor
62
62
  // Export directly from an array in memory.
63
63
  // TBD: convert dates as in exportUtils
64
64
  function exportArray() {
65
- var oSpreadsheet;
66
- var fnConvertData;
65
+ let oSpreadsheet;
66
+ let fnConvertData;
67
67
 
68
68
  function start(DataProvider, XLSXBuilder) {
69
69
  fnConvertData = DataProvider.getDataConverter(mParams);
@@ -85,7 +85,7 @@ sap.ui.define(['sap/base/Log', 'sap/ui/export/ExportUtils'], function(Log, Expor
85
85
  }
86
86
 
87
87
  function exportInProcess() {
88
- var oSpreadsheet, oRequest;
88
+ let oSpreadsheet, oRequest;
89
89
 
90
90
  function start(DataProvider, XLSXBuilder) {
91
91
  var provider = new DataProvider(mParams);
@@ -122,42 +122,64 @@ sap.ui.define(['sap/base/Log', 'sap/ui/export/ExportUtils'], function(Log, Expor
122
122
  }
123
123
 
124
124
  function exportInWorker() {
125
- var spreadsheetWorker;
126
- var workerParams = {};
125
+ let oSpreadsheetWorker;
126
+ const mWorkerParams = {};
127
127
 
128
128
  var fnCancel = function() {
129
- spreadsheetWorker.postMessage({ cancel: true });
129
+ oSpreadsheetWorker.postMessage({ cancel: true });
130
130
  onFinish();
131
131
  };
132
132
 
133
- function createWorker(url) {
134
- var worker = new Worker(url);
135
- worker.onmessage = postMessage;
136
-
137
- // Skips error handling if fired in Firefox with cross origin
138
- if (navigator.userAgent.indexOf("Firefox") === -1 || isSameOrigin(url)) {
139
- worker.onerror = onError;
140
- }
133
+ function createWorker(sUrl) {
134
+ const {promise: oPromise, resolve: fnResolve, reject: fnReject} = Promise.withResolvers();
135
+ const oWorker = new Worker(sUrl);
136
+ const errorHandler = (oEvent) => {
137
+ oWorker.terminate();
138
+ fnReject(oEvent);
139
+ };
140
+ const messageHandler = (oEvent) => {
141
+ if (oEvent.data.initialized) {
142
+ oWorker.removeEventListener("message", messageHandler);
143
+ oWorker.removeEventListener("error", errorHandler);
144
+
145
+ oWorker.addEventListener("message", postMessage);
146
+ oWorker.addEventListener("error", onError);
147
+ fnResolve(oWorker);
148
+ }
149
+ };
141
150
 
142
- worker.postMessage(mParams);
151
+ oWorker.addEventListener("message", messageHandler);
152
+ oWorker.addEventListener("error", errorHandler);
143
153
 
144
- return worker;
154
+ return oPromise;
145
155
  }
146
156
 
147
- function isSameOrigin(url) {
148
- return url.indexOf(window.location.host) > 0
149
- || /^[^/]+\/[^/].*$|^\/[^/].*$/i.test(url); //check for relative address
150
- }
157
+ function createBlobWorker() {
158
+ Log.warning('Direct worker is not allowed. Load the worker via Blob.');
151
159
 
152
- function blobWorker() {
153
- var sBlobCode, oBlobURL;
160
+ const sBlobCode = `self.origin = "${mWorkerParams.base}"; importScripts("${mWorkerParams.src}");`;
161
+ const oBlobURL = window.URL.createObjectURL(new Blob([sBlobCode]));
154
162
 
155
- Log.warning('Direct worker is not allowed. Load the worker via blob.');
163
+ return createWorker(oBlobURL);
164
+ }
156
165
 
157
- sBlobCode = 'self.origin = "' + workerParams.base + '"; ' + 'importScripts("' + workerParams.src + '")';
158
- oBlobURL = window.URL.createObjectURL(new Blob([sBlobCode]));
166
+ /**
167
+ * Returns a worker instance. First tries to create a direct worker, if this fails, e.g. due to
168
+ * cross-origin or CSP restrictions, a blob worker is created. When no worker can be created, the
169
+ * Promise is rejected.
170
+ *
171
+ * @returns {Promise<Worker>} Worker instance
172
+ */
173
+ async function getWorker() {
174
+ let oWorker;
159
175
 
160
- return createWorker(oBlobURL);
176
+ try {
177
+ oWorker = await createWorker(mWorkerParams.src);
178
+ } catch (oError) {
179
+ oWorker = await createBlobWorker();
180
+ }
181
+
182
+ return oWorker;
161
183
  }
162
184
 
163
185
  function noWorker() {
@@ -165,34 +187,23 @@ sap.ui.define(['sap/base/Log', 'sap/ui/export/ExportUtils'], function(Log, Expor
165
187
  fnCancel = exportInProcess(mParams).cancel;
166
188
  }
167
189
 
168
- function start() {
190
+ async function start() {
169
191
  try {
170
- spreadsheetWorker = createWorker(workerParams.src);
171
- spreadsheetWorker.addEventListener('error', function (e) { // Firefox fires an error event instead of a security exception
172
- spreadsheetWorker = blobWorker();
173
- spreadsheetWorker.addEventListener('error', function (e) {
174
- noWorker();
175
- e.preventDefault();
176
- });
177
- e.preventDefault();
178
- });
179
- } catch (err1) {
180
- try {
181
- spreadsheetWorker = blobWorker();
182
- } catch (err2) {
183
- noWorker();
184
- }
192
+ oSpreadsheetWorker = await getWorker();
193
+ oSpreadsheetWorker.postMessage(mParams);
194
+ } catch (oError) {
195
+ noWorker();
185
196
  }
186
197
  }
187
198
 
188
199
  // worker settings
189
- workerParams.base = ExportUtils.normalizeUrl(sap.ui.require.toUrl('sap/ui/export/js/'));
190
- workerParams.src = workerParams.base + 'SpreadsheetWorker.js';
200
+ mWorkerParams.base = ExportUtils.normalizeUrl(sap.ui.require.toUrl('sap/ui/export/js/'));
201
+ mWorkerParams.src = `${mWorkerParams.base}SpreadsheetWorker.js`;
191
202
 
192
203
  start();
193
204
 
194
205
  // fnCancel may be overwritten asynchronously after return, therefore it should be wrapped into a closure
195
- return {cancel: function() {fnCancel();}};
206
+ return {cancel: () => { fnCancel(); }};
196
207
  }
197
208
 
198
209
  if (mParams.dataSource.type === 'array') {
@@ -12,6 +12,10 @@ importScripts(origin + 'XLSXBuilder.js');
12
12
  importScripts(origin + '../provider/DataProviderBase.js');
13
13
  importScripts(origin + 'libs/JSZip3.js');
14
14
 
15
+ postMessage({
16
+ initialized: true
17
+ });
18
+
15
19
  self.onmessage = function(oMessage) {
16
20
  'use strict';
17
21
 
@@ -15,7 +15,7 @@ sap.ui.define(["sap/ui/core/Lib"], function(Library) {
15
15
  * @namespace
16
16
  * @alias sap.ui.export
17
17
  * @author SAP SE
18
- * @version 1.136.6
18
+ * @version 1.136.7
19
19
  * @public
20
20
  */
21
21
 
@@ -34,7 +34,7 @@ sap.ui.define(["sap/ui/core/Lib"], function(Library) {
34
34
  interfaces: [],
35
35
  controls: [],
36
36
  elements: [],
37
- version: "1.136.6"
37
+ version: "1.136.7"
38
38
  });
39
39
 
40
40
  /**
@@ -44,7 +44,7 @@ MSG_WARNING_ADVICE=No contin\u00FAe a menos que est\u00E9 seguro de que la confi
44
44
  MSG_WARNING_EXPORT_ANYWAY=\u00BFQuiere exportar de todos modos?
45
45
 
46
46
  #XMSG: Textual representation of the technical error message which indicates that the export ran out of memory.
47
- MSG_ERROR_OUT_OF_MEMORY=El proces de exportaci\u00F3n se ha quedado sin memoria y se ha finalizado.\nAjuste las opciones de columna o filtro para seleccionar una cantidad inferior de celdas.
47
+ MSG_ERROR_OUT_OF_MEMORY=El proceso de exportaci\u00F3n se qued\u00F3 sin memoria y finaliz\u00F3.\nAjuste las opciones de columna o filtro para seleccionar un n\u00FAmero inferior de celdas.
48
48
 
49
49
  #XMSG: Screenreader announcement that the export process has been finished.
50
50
  MSG_INFO_EXPORT_FINISHED=La exportaci\u00F3n finaliz\u00F3 y el archivo se descarg\u00F3.
@@ -2,7 +2,7 @@
2
2
  #
3
3
 
4
4
  #XBUT: Cancel button in the dialog
5
- CANCEL_BUTTON=\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C\\
5
+ CANCEL_BUTTON=\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C
6
6
 
7
7
  #XBUT: Close button in the dialog
8
8
  CLOSE_BUTTON=\u0417\u0430\u043A\u0440\u044B\u0442\u044C
@@ -24,7 +24,7 @@
24
24
  * @param {object} mSettings Data service related part of the export configuration
25
25
  *
26
26
  * @author SAP SE
27
- * @version 1.136.6
27
+ * @version 1.136.7
28
28
  *
29
29
  * @constructor
30
30
  * @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.136.6
23
+ * @version 1.136.7
24
24
  *
25
25
  * @since 1.110
26
26
  * @alias sap.ui.export.util.Filter