@sapui5/sap.ui.export 1.108.43 → 1.108.45

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.108.43",
3
+ "version": "1.108.45",
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-2022 SAP SE. All rights reserved.</copyright>
8
- <version>1.108.43</version>
8
+ <version>1.108.45</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.108.43
30
+ * @version 1.108.45
31
31
  *
32
32
  * @since 1.96
33
33
  * @name sap.ui.export.ExportBase
@@ -15,7 +15,7 @@ sap.ui.define(['./library', './ExportUtils', './ExportDialog', 'sap/m/MessageToa
15
15
  * @constructor 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.108.43
18
+ * @version 1.108.45
19
19
  *
20
20
  * @since 1.102
21
21
  * @name sap.ui.export.ExportHandler
@@ -132,7 +132,7 @@ sap.ui.define([
132
132
  * Utilities related to export to enable reuse in integration scenarios (e.g. tables).
133
133
  *
134
134
  * @author SAP SE
135
- * @version 1.108.43
135
+ * @version 1.108.45
136
136
  *
137
137
  * @since 1.59
138
138
  * @name sap.ui.export.ExportUtils
@@ -1141,7 +1141,7 @@ sap.ui.define([
1141
1141
  *
1142
1142
  * @param {object} oContext Context object
1143
1143
  * @param {string} [oContext.application] Name of the application (default: "SAP UI5")
1144
- * @param {string} [oContext.version] Application version (default: "1.108.43")
1144
+ * @param {string} [oContext.version] Application version (default: "1.108.45")
1145
1145
  * @param {string} [oContext.title] Title that will be written to the file (NOT the filename)
1146
1146
  * @param {string} [oContext.modifiedBy] Optional user context that will be written to the file
1147
1147
  * @param {string} [oContext.sheetName] Name of the data sheet - Maximum length of 31 characters
@@ -20,7 +20,7 @@ sap.ui.define([
20
20
  * @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.
21
21
  *
22
22
  * @author SAP SE
23
- * @version 1.108.43
23
+ * @version 1.108.45
24
24
  *
25
25
  * @since 1.96
26
26
  * @alias sap.ui.export.PortableDocument
@@ -85,7 +85,7 @@ sap.ui.define([
85
85
  * <li><code>workbook.context</code> - Context object that will be applied to the generated file. It may contain the following fields:</li>
86
86
  * <ul>
87
87
  * <li><code>application</code> (string) - The application that creates the XLSX document (default: "SAP UI5")</li>
88
- * <li><code>version</code> (string) - Application version that creates the XLSX document (default: "1.108.43")</li>
88
+ * <li><code>version</code> (string) - Application version that creates the XLSX document (default: "1.108.45")</li>
89
89
  * <li><code>title</code> (string) - Title of the XLSX document (NOT the filename)</li>
90
90
  * <li><code>modifiedBy</code> (string) - User context for the XLSX document</li>
91
91
  * <li><code>sheetName</code> (string) - The label of the data sheet</li>
@@ -168,7 +168,7 @@ sap.ui.define([
168
168
  * columns: aColumns,
169
169
  * context: {
170
170
  * application: 'Debug Test Application',
171
- * version: '1.108.43',
171
+ * version: '1.108.45',
172
172
  * title: 'Some random title',
173
173
  * modifiedBy: 'John Doe',
174
174
  * metaSheetName: 'Custom metadata',
@@ -280,7 +280,7 @@ sap.ui.define([
280
280
  * @constructor The <code>sap.ui.export.Spreadsheet</code> class allows you to export table data from a UI5 application to a spreadsheet file.
281
281
  *
282
282
  * @author SAP SE
283
- * @version 1.108.43
283
+ * @version 1.108.45
284
284
  *
285
285
  * @since 1.50
286
286
  * @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.108.43
25
+ * @version 1.108.45
26
26
  *
27
27
  * @private
28
28
  * @since 1.50.0
@@ -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,7 @@ 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
+ var oSpreadsheet, fnConvertData;
67
66
 
68
67
  function start(DataProvider, XLSXBuilder) {
69
68
  fnConvertData = DataProvider.getDataConverter(mParams);
@@ -122,77 +121,82 @@ sap.ui.define(['sap/base/Log', 'sap/ui/export/ExportUtils'], function(Log, Expor
122
121
  }
123
122
 
124
123
  function exportInWorker() {
125
- var spreadsheetWorker;
126
- var workerParams = {};
124
+ var oSpreadsheetWorker;
125
+ var mWorkerParams = {};
127
126
 
128
127
  var fnCancel = function() {
129
- spreadsheetWorker.postMessage({ cancel: true });
128
+ oSpreadsheetWorker.postMessage({ cancel: true });
130
129
  onFinish();
131
130
  };
132
131
 
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
- }
141
-
142
- worker.postMessage(mParams);
143
-
144
- return worker;
145
- }
146
-
147
- function isSameOrigin(url) {
148
- return url.indexOf(window.location.host) > 0
149
- || /^[^/]+\/[^/].*$|^\/[^/].*$/i.test(url); //check for relative address
132
+ function createWorker(sUrl) {
133
+ return new Promise(function(fnResolve, fnReject) {
134
+ var oWorker = new Worker(sUrl);
135
+ var errorHandler = function(oEvent) {
136
+ oWorker.terminate();
137
+ fnReject(oEvent);
138
+ };
139
+ var messageHandler = function(oEvent) {
140
+ if (oEvent.data.initialized) {
141
+ oWorker.removeEventListener("message", messageHandler);
142
+ oWorker.removeEventListener("error", errorHandler);
143
+
144
+ oWorker.addEventListener("message", postMessage);
145
+ oWorker.addEventListener("error", onError);
146
+ fnResolve(oWorker);
147
+ }
148
+ };
149
+
150
+ oWorker.addEventListener("message", messageHandler);
151
+ oWorker.addEventListener("error", errorHandler);
152
+ });
150
153
  }
151
154
 
152
- function blobWorker() {
155
+ function createBlobWorker() {
153
156
  var sBlobCode, oBlobURL;
154
157
 
155
158
  Log.warning('Direct worker is not allowed. Load the worker via blob.');
156
159
 
157
- sBlobCode = 'self.origin = "' + workerParams.base + '"; ' + 'importScripts("' + workerParams.src + '")';
160
+ sBlobCode = 'self.origin = "' + mWorkerParams.base + '"; ' + 'importScripts("' + mWorkerParams.src + '")';
158
161
  oBlobURL = window.URL.createObjectURL(new Blob([sBlobCode]));
159
162
 
160
163
  return createWorker(oBlobURL);
161
164
  }
162
165
 
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
+ function getWorker() {
174
+ return createWorker(mWorkerParams.src).catch(function(oError) {
175
+ return createBlobWorker();
176
+ });
177
+ }
178
+
163
179
  function noWorker() {
164
180
  Log.warning('Blob worker is not allowed. Use in-process export.');
165
181
  fnCancel = exportInProcess(mParams).cancel;
166
182
  }
167
183
 
168
184
  function start() {
169
- 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
- }
185
- }
185
+ getWorker().then(function(oWorker) {
186
+ oSpreadsheetWorker = oWorker;
187
+
188
+ oWorker.postMessage(mParams);
189
+ }).catch(noWorker);
186
190
  }
187
191
 
188
192
  // worker settings
189
- workerParams.base = ExportUtils.normalizeUrl(sap.ui.require.toUrl('sap/ui/export/js/'));
190
- workerParams.src = workerParams.base + 'SpreadsheetWorker.js';
193
+ mWorkerParams.base = ExportUtils.normalizeUrl(sap.ui.require.toUrl('sap/ui/export/js/'));
194
+ mWorkerParams.src = mWorkerParams.base + "SpreadsheetWorker.js";
191
195
 
192
196
  start();
193
197
 
194
198
  // fnCancel may be overwritten asynchronously after return, therefore it should be wrapped into a closure
195
- return {cancel: function() {fnCancel();}};
199
+ return {cancel: function() { fnCancel(); }};
196
200
  }
197
201
 
198
202
  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
 
@@ -17,7 +17,7 @@ sap.ui.define([
17
17
  * @namespace
18
18
  * @alias sap.ui.export
19
19
  * @author SAP SE
20
- * @version 1.108.43
20
+ * @version 1.108.45
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.108.43"
36
+ version: "1.108.45"
37
37
  });
38
38
 
39
39
 
@@ -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: Message text informing that the original error message is empty or no specific error provided
50
50
  PROGRESS_ERROR_DEFAULT=Error desconocido
@@ -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