@sapui5/sap.ui.export 1.113.0 → 1.114.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 +1 -1
- package/src/sap/ui/export/.library +1 -1
- package/src/sap/ui/export/ExportBase.js +1 -1
- package/src/sap/ui/export/ExportHandler.js +1 -1
- package/src/sap/ui/export/ExportUtils.js +73 -48
- package/src/sap/ui/export/PortableDocument.js +63 -16
- package/src/sap/ui/export/Spreadsheet.js +4 -6
- package/src/sap/ui/export/SpreadsheetExport.js +1 -1
- package/src/sap/ui/export/js/XLSXBuilder.js +1 -1
- package/src/sap/ui/export/js/XLSXBuilder.js.map +1 -1
- package/src/sap/ui/export/library.js +2 -2
- package/src/sap/ui/export/messagebundle_ar.properties +3 -3
- package/src/sap/ui/export/messagebundle_bg.properties +3 -3
- package/src/sap/ui/export/messagebundle_ca.properties +3 -3
- package/src/sap/ui/export/messagebundle_cs.properties +3 -3
- package/src/sap/ui/export/messagebundle_cy.properties +3 -3
- package/src/sap/ui/export/messagebundle_da.properties +3 -3
- package/src/sap/ui/export/messagebundle_de.properties +3 -3
- package/src/sap/ui/export/messagebundle_el.properties +3 -3
- package/src/sap/ui/export/messagebundle_en.properties +2 -2
- package/src/sap/ui/export/messagebundle_en_GB.properties +2 -2
- package/src/sap/ui/export/messagebundle_es.properties +3 -3
- package/src/sap/ui/export/messagebundle_es_MX.properties +3 -3
- package/src/sap/ui/export/messagebundle_et.properties +3 -3
- package/src/sap/ui/export/messagebundle_fi.properties +3 -3
- package/src/sap/ui/export/messagebundle_fr.properties +3 -3
- package/src/sap/ui/export/messagebundle_fr_CA.properties +3 -3
- package/src/sap/ui/export/messagebundle_hi.properties +3 -3
- package/src/sap/ui/export/messagebundle_hr.properties +3 -3
- package/src/sap/ui/export/messagebundle_hu.properties +3 -3
- package/src/sap/ui/export/messagebundle_id.properties +3 -3
- package/src/sap/ui/export/messagebundle_it.properties +3 -3
- package/src/sap/ui/export/messagebundle_iw.properties +3 -3
- package/src/sap/ui/export/messagebundle_ja.properties +3 -3
- package/src/sap/ui/export/messagebundle_kk.properties +3 -3
- package/src/sap/ui/export/messagebundle_ko.properties +3 -3
- package/src/sap/ui/export/messagebundle_lt.properties +3 -3
- package/src/sap/ui/export/messagebundle_lv.properties +3 -3
- package/src/sap/ui/export/messagebundle_ms.properties +3 -3
- package/src/sap/ui/export/messagebundle_nl.properties +3 -3
- package/src/sap/ui/export/messagebundle_no.properties +3 -3
- package/src/sap/ui/export/messagebundle_pl.properties +3 -3
- package/src/sap/ui/export/messagebundle_pt.properties +3 -3
- package/src/sap/ui/export/messagebundle_pt_PT.properties +3 -3
- package/src/sap/ui/export/messagebundle_ro.properties +3 -3
- package/src/sap/ui/export/messagebundle_ru.properties +3 -3
- package/src/sap/ui/export/messagebundle_sh.properties +3 -3
- package/src/sap/ui/export/messagebundle_sk.properties +3 -3
- package/src/sap/ui/export/messagebundle_sl.properties +3 -3
- package/src/sap/ui/export/messagebundle_sv.properties +3 -3
- package/src/sap/ui/export/messagebundle_th.properties +3 -3
- package/src/sap/ui/export/messagebundle_tr.properties +3 -3
- package/src/sap/ui/export/messagebundle_uk.properties +3 -3
- package/src/sap/ui/export/messagebundle_vi.properties +3 -3
- package/src/sap/ui/export/messagebundle_zh_CN.properties +3 -3
- package/src/sap/ui/export/messagebundle_zh_TW.properties +3 -3
- package/src/sap/ui/export/provider/DataProviderBase.js +1 -1
- package/src/sap/ui/export/util/Filter.js +1 -1
package/package.json
CHANGED
|
@@ -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.
|
|
30
|
+
* @version 1.114.0
|
|
31
31
|
*
|
|
32
32
|
* @since 1.96
|
|
33
33
|
* @alias sap.ui.export.ExportBase
|
|
@@ -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.
|
|
18
|
+
* @version 1.114.0
|
|
19
19
|
*
|
|
20
20
|
* @since 1.102
|
|
21
21
|
* @alias sap.ui.export.ExportHandler
|
|
@@ -14,8 +14,9 @@ sap.ui.define([
|
|
|
14
14
|
'sap/ui/model/resource/ResourceModel',
|
|
15
15
|
'sap/ui/util/openWindow',
|
|
16
16
|
'sap/ui/VersionInfo',
|
|
17
|
-
'sap/ui/core/format/DateFormat'
|
|
18
|
-
|
|
17
|
+
'sap/ui/core/format/DateFormat',
|
|
18
|
+
"sap/ui/performance/trace/FESRHelper"
|
|
19
|
+
], function(library, Log, Core, Fragment, coreLibrary, syncStyleClass, Filter, JSONModel, ResourceModel, openWindow, VersionInfo, DateFormat, FESRHelper) {
|
|
19
20
|
'use strict';
|
|
20
21
|
|
|
21
22
|
// eslint-disable-next-line
|
|
@@ -134,7 +135,7 @@ sap.ui.define([
|
|
|
134
135
|
* @class Utilities related to export to enable reuse in integration scenarios (e.g. tables).
|
|
135
136
|
*
|
|
136
137
|
* @author SAP SE
|
|
137
|
-
* @version 1.
|
|
138
|
+
* @version 1.114.0
|
|
138
139
|
*
|
|
139
140
|
* @since 1.59
|
|
140
141
|
* @alias sap.ui.export.ExportUtils
|
|
@@ -368,6 +369,10 @@ sap.ui.define([
|
|
|
368
369
|
if (oOpener) {
|
|
369
370
|
syncStyleClass('sapUiSizeCompact', oOpener, oExportSettingsDialog);
|
|
370
371
|
}
|
|
372
|
+
|
|
373
|
+
FESRHelper.setSemanticStepname(oExportSettingsDialog.getBeginButton(), "press", "oi:exp:export");
|
|
374
|
+
FESRHelper.setSemanticStepname(oExportSettingsDialog.getEndButton(), "press", "oi:exp:cancel");
|
|
375
|
+
|
|
371
376
|
oExportSettingsDialog.open();
|
|
372
377
|
|
|
373
378
|
if (fnCallback) {
|
|
@@ -454,56 +459,76 @@ sap.ui.define([
|
|
|
454
459
|
_parseLogical: function(oLogicalFilter) {
|
|
455
460
|
var aFilters, sProperty;
|
|
456
461
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
value: oLogicalFilter.left.right.value
|
|
474
|
-
},
|
|
475
|
-
{
|
|
476
|
-
type: 'Literal',
|
|
477
|
-
value: oLogicalFilter.right.right.value
|
|
478
|
-
}
|
|
479
|
-
],
|
|
480
|
-
name: 'between',
|
|
481
|
-
type: 'Call'
|
|
482
|
-
});
|
|
483
|
-
}
|
|
462
|
+
try {
|
|
463
|
+
/*
|
|
464
|
+
* BCP 002075129400002076772023
|
|
465
|
+
* When too many filters are applied, the
|
|
466
|
+
* filter evaluation might fail due to an
|
|
467
|
+
* "Maximum call stack size exceeded" error.
|
|
468
|
+
* This will be prevented by try-catch and
|
|
469
|
+
* still allows to keep existing results.
|
|
470
|
+
* Once the error occurs, additional filters
|
|
471
|
+
* will be ignored. This only happens for
|
|
472
|
+
* Logical filters with OR operator because
|
|
473
|
+
* they can lead to an unbalanced filter tree.
|
|
474
|
+
* For the unlikely scenario that the failing
|
|
475
|
+
* filter is a between filter, this scenario
|
|
476
|
+
* is also contained in try-catch.
|
|
477
|
+
*/
|
|
484
478
|
|
|
485
|
-
|
|
479
|
+
/* Breakout behavior for between filter */
|
|
480
|
+
if (oLogicalFilter.op == '&&'
|
|
481
|
+
&& oLogicalFilter.left.type === 'Binary'
|
|
482
|
+
&& oLogicalFilter.right.type === 'Binary'
|
|
483
|
+
&& oLogicalFilter.left.op === '>='
|
|
484
|
+
&& oLogicalFilter.right.op === '<='
|
|
485
|
+
&& oLogicalFilter.left.left.path === oLogicalFilter.right.left.path) {
|
|
486
|
+
|
|
487
|
+
return Utils._parseCall({
|
|
488
|
+
args: [
|
|
489
|
+
{
|
|
490
|
+
path: oLogicalFilter.left.left.path,
|
|
491
|
+
type: 'Reference'
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
type: 'Literal',
|
|
495
|
+
value: oLogicalFilter.left.right.value
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
type: 'Literal',
|
|
499
|
+
value: oLogicalFilter.right.right.value
|
|
500
|
+
}
|
|
501
|
+
],
|
|
502
|
+
name: 'between',
|
|
503
|
+
type: 'Call'
|
|
504
|
+
});
|
|
505
|
+
}
|
|
486
506
|
|
|
487
|
-
|
|
488
|
-
if (oLogicalFilter.op === '||' && aFilters.length) {
|
|
489
|
-
sProperty = aFilters[0].key;
|
|
507
|
+
aFilters = Utils._parseFilter(oLogicalFilter.left).concat(Utils._parseFilter(oLogicalFilter.right));
|
|
490
508
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
key: sProperty,
|
|
495
|
-
value: aFilters.reduce(function(acc, item) {
|
|
496
|
-
if (Array.isArray(item.value)) {
|
|
497
|
-
return acc.concat(item.value);
|
|
498
|
-
}
|
|
509
|
+
/* Group logical OR filter on the same property */
|
|
510
|
+
if (oLogicalFilter.op === '||' && aFilters.length) {
|
|
511
|
+
sProperty = aFilters[0].key;
|
|
499
512
|
|
|
500
|
-
|
|
513
|
+
if (aFilters.every(function(item) { return item.key === sProperty; })) {
|
|
514
|
+
aFilters = [
|
|
515
|
+
{
|
|
516
|
+
key: sProperty,
|
|
517
|
+
value: aFilters.reduce(function(acc, item) {
|
|
518
|
+
if (Array.isArray(item.value)) {
|
|
519
|
+
return acc.concat(item.value);
|
|
520
|
+
}
|
|
501
521
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
522
|
+
acc.push(item.value);
|
|
523
|
+
|
|
524
|
+
return acc;
|
|
525
|
+
}, [])
|
|
526
|
+
}
|
|
527
|
+
];
|
|
528
|
+
}
|
|
506
529
|
}
|
|
530
|
+
} catch (oError) {
|
|
531
|
+
aFilters = [];
|
|
507
532
|
}
|
|
508
533
|
|
|
509
534
|
return aFilters;
|
|
@@ -1143,7 +1168,7 @@ sap.ui.define([
|
|
|
1143
1168
|
*
|
|
1144
1169
|
* @param {object} oContext Context object
|
|
1145
1170
|
* @param {string} [oContext.application] Name of the application (default: "SAP UI5")
|
|
1146
|
-
* @param {string} [oContext.version] Application version (default: "1.
|
|
1171
|
+
* @param {string} [oContext.version] Application version (default: "1.114.0")
|
|
1147
1172
|
* @param {string} [oContext.title] Title that will be written to the file (NOT the filename)
|
|
1148
1173
|
* @param {string} [oContext.modifiedBy] Optional user context that will be written to the file
|
|
1149
1174
|
* @param {string} [oContext.sheetName] Name of the data sheet - Maximum length of 31 characters
|
|
@@ -15,11 +15,13 @@ sap.ui.define([
|
|
|
15
15
|
], function(Log, Core, ExportBase, ExportUtils, Library, ODataModel, ExportDialog, BusyDialog) {
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
|
+
var FileType = Library.FileType;
|
|
19
|
+
|
|
18
20
|
/**
|
|
19
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.
|
|
20
22
|
*
|
|
21
23
|
* @author SAP SE
|
|
22
|
-
* @version 1.
|
|
24
|
+
* @version 1.114.0
|
|
23
25
|
*
|
|
24
26
|
* @since 1.96
|
|
25
27
|
* @alias sap.ui.export.PortableDocument
|
|
@@ -116,7 +118,8 @@ sap.ui.define([
|
|
|
116
118
|
version: bV4ODataModel ? 4 : 2,
|
|
117
119
|
dataUrl: oDataUrl.toString(),
|
|
118
120
|
serviceUrl: this._resolveServiceUrl(sServiceUrl),
|
|
119
|
-
headers: bV4ODataModel ? oModel.getHttpHeaders(true) : oModel.getHeaders()
|
|
121
|
+
headers: bV4ODataModel ? oModel.getHttpHeaders(true) : oModel.getHeaders(),
|
|
122
|
+
count: ExportUtils.getCountFromBinding(oBinding)
|
|
120
123
|
};
|
|
121
124
|
}
|
|
122
125
|
|
|
@@ -292,6 +295,61 @@ sap.ui.define([
|
|
|
292
295
|
}) : this._oModel;
|
|
293
296
|
};
|
|
294
297
|
|
|
298
|
+
/**
|
|
299
|
+
* Shows a warning dialog that the exported file might get cut off.
|
|
300
|
+
* If the count is less than the ResultSizeMaximum of the PDF capabilities,
|
|
301
|
+
* no dialog will be shown and the export will proceed automatically.
|
|
302
|
+
*
|
|
303
|
+
* @param {object} mSettings Export configuration object
|
|
304
|
+
* @returns {Promise} Promise that gets resolved if the requirements
|
|
305
|
+
* for the warning are not met or if the user decides to proceed.
|
|
306
|
+
* When the user cancels the export, the Promise will reject.
|
|
307
|
+
*
|
|
308
|
+
* @private
|
|
309
|
+
*/
|
|
310
|
+
PortableDocument.prototype._showWarning = function(mSettings) {
|
|
311
|
+
var mParams, oWarningPromise;
|
|
312
|
+
|
|
313
|
+
mParams = {
|
|
314
|
+
rows: mSettings.dataSource.count,
|
|
315
|
+
cutOff: this._mCapabilities.ResultSizeMax,
|
|
316
|
+
fileType: FileType.PDF
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
oWarningPromise = Promise.resolve();
|
|
320
|
+
|
|
321
|
+
if (mParams.rows > mParams.cutOff) {
|
|
322
|
+
oWarningPromise = ExportDialog.showWarningDialog(mParams);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
return oWarningPromise;
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Adds the ResultSizeMaximum from the com.sap.vocabularies.PDF.v1.Features
|
|
330
|
+
* annotation as $top to the data URL. If this property is not available on
|
|
331
|
+
* the annotation or its value is not a number, it will be ignored.
|
|
332
|
+
*
|
|
333
|
+
* @param {string} sUrl Data URL that is used to request the PDF document
|
|
334
|
+
* @returns {string} The modified data URL that contains $top. The value of $top is
|
|
335
|
+
* based on the ResultSizeMaximum of the com.sap.vocabularies.PDF.v1.Features
|
|
336
|
+
* annotation.
|
|
337
|
+
*/
|
|
338
|
+
PortableDocument.prototype._applyResultSize = function(sUrl) {
|
|
339
|
+
var iLimit, mDataUrl;
|
|
340
|
+
|
|
341
|
+
iLimit = parseInt(this._mCapabilities.ResultSizeMaximum);
|
|
342
|
+
|
|
343
|
+
if (!isNaN(iLimit) && iLimit > 0) {
|
|
344
|
+
|
|
345
|
+
mDataUrl = new URL(sUrl);
|
|
346
|
+
mDataUrl.search += '&$top=' + iLimit;
|
|
347
|
+
sUrl = mDataUrl.toString();
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
return sUrl;
|
|
351
|
+
};
|
|
352
|
+
|
|
295
353
|
/**
|
|
296
354
|
* Applies default settings to the export configuration.
|
|
297
355
|
*
|
|
@@ -404,20 +462,7 @@ sap.ui.define([
|
|
|
404
462
|
oDocumentDescription = that._createDocumentDescription(mSettings);
|
|
405
463
|
oBusyDialog.open();
|
|
406
464
|
|
|
407
|
-
|
|
408
|
-
var mParams = {
|
|
409
|
-
rows: mSettings.dataSource.count,
|
|
410
|
-
cutOff: this._mCapabilities.ResultSizeDefault,
|
|
411
|
-
fileType: Library.FileType.PDF
|
|
412
|
-
};
|
|
413
|
-
|
|
414
|
-
var oWarningPromise = Promise.resolve();
|
|
415
|
-
|
|
416
|
-
if (mParams.rows > mParams.cutOff) {
|
|
417
|
-
oWarningPromise = ExportDialog.showWarningDialog(mParams);
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
return oWarningPromise.then(function() {
|
|
465
|
+
return this._showWarning(mSettings).then(function() {
|
|
421
466
|
return that.postDocumentDescription(oDocumentDescription, mSettings.dataSource);
|
|
422
467
|
}).then(function(sDocumentDescriptionId) {
|
|
423
468
|
return oBusyDialog && that.sendRequest(mSettings.dataSource.dataUrl, sDocumentDescriptionId);
|
|
@@ -451,6 +496,8 @@ sap.ui.define([
|
|
|
451
496
|
* @private
|
|
452
497
|
*/
|
|
453
498
|
PortableDocument.prototype.sendRequest = function(sUrl, sDocumentDescriptionId) {
|
|
499
|
+
sUrl = this._applyResultSize(sUrl);
|
|
500
|
+
|
|
454
501
|
return new Promise(function(fnResolve, fnReject) {
|
|
455
502
|
var oXHR = this.request = new XMLHttpRequest();
|
|
456
503
|
|
|
@@ -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.
|
|
87
|
+
* <li><code>version</code> (string) - Application version that creates the XLSX document (default: "1.114.0")</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.
|
|
170
|
+
* version: '1.114.0',
|
|
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.
|
|
282
|
+
* @version 1.114.0
|
|
283
283
|
*
|
|
284
284
|
* @since 1.50
|
|
285
285
|
* @alias sap.ui.export.Spreadsheet
|
|
@@ -760,9 +760,7 @@ sap.ui.define([
|
|
|
760
760
|
// Show warning and execute
|
|
761
761
|
ExportDialog.showWarningDialog(oDialogSettings)
|
|
762
762
|
.then(startExport)
|
|
763
|
-
.catch(
|
|
764
|
-
fnReject('Export cancelled by the user.');
|
|
765
|
-
});
|
|
763
|
+
.catch(fnReject);
|
|
766
764
|
} else {
|
|
767
765
|
startExport();
|
|
768
766
|
}
|
|
@@ -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.
|
|
24
|
+
* @version 1.114.0
|
|
25
25
|
*
|
|
26
26
|
* @alias sap.ui.export.SpreadsheetExport
|
|
27
27
|
* @private
|