@sapui5/sap.ui.export 1.113.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 +1 -1
- package/src/sap/ui/export/.library +1 -1
- package/src/sap/ui/export/ExportBase.js +1 -1
- package/src/sap/ui/export/ExportDialog.js +38 -29
- package/src/sap/ui/export/ExportHandler.js +1 -1
- package/src/sap/ui/export/ExportUtils.js +75 -51
- package/src/sap/ui/export/PortableDocument.js +68 -17
- package/src/sap/ui/export/Spreadsheet.js +6 -8
- 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.properties +18 -6
- 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.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
|
-
|
|
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
|
-
|
|
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
|
|
121
|
-
* @param {number} mParams.columns
|
|
122
|
-
* @param {boolean} mParams.
|
|
123
|
-
* @param {boolean} mParams.
|
|
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
|
-
|
|
131
|
-
var bContinue, oWarningDialog, oWarningText,
|
|
128
|
+
ExportUtils.getResourceBundle().then(function(oResourceBundle) {
|
|
129
|
+
var aText, bContinue, oWarningDialog, oWarningText, oNumberFormat, sRowCount, sCellCount, sCellLimit, sLimit, sFileType;
|
|
132
130
|
|
|
133
|
-
|
|
131
|
+
aText = [];
|
|
134
132
|
bContinue = false;
|
|
135
|
-
|
|
133
|
+
oNumberFormat = NumberFormat.getIntegerInstance({groupingEnabled: true});
|
|
134
|
+
sFileType = oResourceBundle.getText(mParams.fileType + "_FILETYPE");
|
|
135
|
+
sLimit = oNumberFormat.format(mParams.rowLimit);
|
|
136
136
|
|
|
137
|
-
if (
|
|
138
|
-
|
|
139
|
-
} else {
|
|
140
|
-
sRowsFormatted = oNumberFormat.format(mParams.rows);
|
|
137
|
+
if (mParams.rows) {
|
|
138
|
+
sRowCount = oNumberFormat.format(mParams.rows);
|
|
141
139
|
|
|
142
|
-
if (mParams.
|
|
143
|
-
|
|
144
|
-
|
|
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.
|
|
148
|
-
|
|
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:
|
|
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
|
-
|
|
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.
|
|
18
|
+
* @version 1.114.2
|
|
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
|
|
@@ -32,7 +33,6 @@ sap.ui.define([
|
|
|
32
33
|
|
|
33
34
|
/* Async call to resource bundle */
|
|
34
35
|
var oResourceBundle;
|
|
35
|
-
var oResourceBundlePromise = Core.getLibraryResourceBundle('sap.ui.export', true);
|
|
36
36
|
|
|
37
37
|
var CLASS_NAME = 'sap.ui.export.ExportUtils';
|
|
38
38
|
|
|
@@ -134,7 +134,7 @@ sap.ui.define([
|
|
|
134
134
|
* @class Utilities related to export to enable reuse in integration scenarios (e.g. tables).
|
|
135
135
|
*
|
|
136
136
|
* @author SAP SE
|
|
137
|
-
* @version 1.
|
|
137
|
+
* @version 1.114.2
|
|
138
138
|
*
|
|
139
139
|
* @since 1.59
|
|
140
140
|
* @alias sap.ui.export.ExportUtils
|
|
@@ -249,7 +249,7 @@ sap.ui.define([
|
|
|
249
249
|
oOpener = null;
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
|
|
252
|
+
Utils.getResourceBundle().then(function (oResourceBundle) {
|
|
253
253
|
var oExportConfigModel = new JSONModel();
|
|
254
254
|
|
|
255
255
|
oExportConfigModel.setData(getDefaultSettings(mCustomConfig, oResourceBundle, oExportCapabilities, bRemoteDestination));
|
|
@@ -368,6 +368,10 @@ sap.ui.define([
|
|
|
368
368
|
if (oOpener) {
|
|
369
369
|
syncStyleClass('sapUiSizeCompact', oOpener, oExportSettingsDialog);
|
|
370
370
|
}
|
|
371
|
+
|
|
372
|
+
FESRHelper.setSemanticStepname(oExportSettingsDialog.getBeginButton(), "press", "oi:exp:export");
|
|
373
|
+
FESRHelper.setSemanticStepname(oExportSettingsDialog.getEndButton(), "press", "oi:exp:cancel");
|
|
374
|
+
|
|
371
375
|
oExportSettingsDialog.open();
|
|
372
376
|
|
|
373
377
|
if (fnCallback) {
|
|
@@ -454,56 +458,76 @@ sap.ui.define([
|
|
|
454
458
|
_parseLogical: function(oLogicalFilter) {
|
|
455
459
|
var aFilters, sProperty;
|
|
456
460
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
461
|
+
try {
|
|
462
|
+
/*
|
|
463
|
+
* BCP 002075129400002076772023
|
|
464
|
+
* When too many filters are applied, the
|
|
465
|
+
* filter evaluation might fail due to an
|
|
466
|
+
* "Maximum call stack size exceeded" error.
|
|
467
|
+
* This will be prevented by try-catch and
|
|
468
|
+
* still allows to keep existing results.
|
|
469
|
+
* Once the error occurs, additional filters
|
|
470
|
+
* will be ignored. This only happens for
|
|
471
|
+
* Logical filters with OR operator because
|
|
472
|
+
* they can lead to an unbalanced filter tree.
|
|
473
|
+
* For the unlikely scenario that the failing
|
|
474
|
+
* filter is a between filter, this scenario
|
|
475
|
+
* is also contained in try-catch.
|
|
476
|
+
*/
|
|
477
|
+
|
|
478
|
+
/* Breakout behavior for between filter */
|
|
479
|
+
if (oLogicalFilter.op == '&&'
|
|
480
|
+
&& oLogicalFilter.left.type === 'Binary'
|
|
481
|
+
&& oLogicalFilter.right.type === 'Binary'
|
|
482
|
+
&& oLogicalFilter.left.op === '>='
|
|
483
|
+
&& oLogicalFilter.right.op === '<='
|
|
484
|
+
&& oLogicalFilter.left.left.path === oLogicalFilter.right.left.path) {
|
|
485
|
+
|
|
486
|
+
return Utils._parseCall({
|
|
487
|
+
args: [
|
|
488
|
+
{
|
|
489
|
+
path: oLogicalFilter.left.left.path,
|
|
490
|
+
type: 'Reference'
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
type: 'Literal',
|
|
494
|
+
value: oLogicalFilter.left.right.value
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
type: 'Literal',
|
|
498
|
+
value: oLogicalFilter.right.right.value
|
|
499
|
+
}
|
|
500
|
+
],
|
|
501
|
+
name: 'between',
|
|
502
|
+
type: 'Call'
|
|
503
|
+
});
|
|
504
|
+
}
|
|
484
505
|
|
|
485
|
-
|
|
506
|
+
aFilters = Utils._parseFilter(oLogicalFilter.left).concat(Utils._parseFilter(oLogicalFilter.right));
|
|
486
507
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
508
|
+
/* Group logical OR filter on the same property */
|
|
509
|
+
if (oLogicalFilter.op === '||' && aFilters.length) {
|
|
510
|
+
sProperty = aFilters[0].key;
|
|
490
511
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
512
|
+
if (aFilters.every(function(item) { return item.key === sProperty; })) {
|
|
513
|
+
aFilters = [
|
|
514
|
+
{
|
|
515
|
+
key: sProperty,
|
|
516
|
+
value: aFilters.reduce(function(acc, item) {
|
|
517
|
+
if (Array.isArray(item.value)) {
|
|
518
|
+
return acc.concat(item.value);
|
|
519
|
+
}
|
|
499
520
|
|
|
500
|
-
|
|
521
|
+
acc.push(item.value);
|
|
501
522
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
523
|
+
return acc;
|
|
524
|
+
}, [])
|
|
525
|
+
}
|
|
526
|
+
];
|
|
527
|
+
}
|
|
506
528
|
}
|
|
529
|
+
} catch (oError) {
|
|
530
|
+
aFilters = [];
|
|
507
531
|
}
|
|
508
532
|
|
|
509
533
|
return aFilters;
|
|
@@ -593,7 +617,7 @@ sap.ui.define([
|
|
|
593
617
|
parseFilterConfiguration: function() {
|
|
594
618
|
Log.error('Function is deprecated and must not be used anymore');
|
|
595
619
|
|
|
596
|
-
return
|
|
620
|
+
return Utils.getResourceBundle().then(function(oResourceBundle) {
|
|
597
621
|
return {
|
|
598
622
|
name: oResourceBundle.getText('FILTER_HEADER'),
|
|
599
623
|
items: []
|
|
@@ -1143,7 +1167,7 @@ sap.ui.define([
|
|
|
1143
1167
|
*
|
|
1144
1168
|
* @param {object} oContext Context object
|
|
1145
1169
|
* @param {string} [oContext.application] Name of the application (default: "SAP UI5")
|
|
1146
|
-
* @param {string} [oContext.version] Application version (default: "1.
|
|
1170
|
+
* @param {string} [oContext.version] Application version (default: "1.114.2")
|
|
1147
1171
|
* @param {string} [oContext.title] Title that will be written to the file (NOT the filename)
|
|
1148
1172
|
* @param {string} [oContext.modifiedBy] Optional user context that will be written to the file
|
|
1149
1173
|
* @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.2
|
|
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
|
|
|
@@ -236,10 +239,14 @@ sap.ui.define([
|
|
|
236
239
|
}
|
|
237
240
|
}
|
|
238
241
|
|
|
239
|
-
/* Eliminate
|
|
242
|
+
/* Eliminate duplicate or unknown columns before adding them to the DocumentDescription */
|
|
240
243
|
oWorkbook.columns.filter(function(oColumn, iIndex, aArray) {
|
|
241
244
|
var sProperty = Array.isArray(oColumn.property) ? oColumn.property[0] : oColumn.property;
|
|
242
245
|
|
|
246
|
+
if (!sProperty) {
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
|
|
243
250
|
return aArray.findIndex(function(oOtherColumn) {
|
|
244
251
|
var sOtherProperty = Array.isArray(oOtherColumn.property) ? oOtherColumn.property[0] : oOtherColumn.property;
|
|
245
252
|
|
|
@@ -292,6 +299,61 @@ sap.ui.define([
|
|
|
292
299
|
}) : this._oModel;
|
|
293
300
|
};
|
|
294
301
|
|
|
302
|
+
/**
|
|
303
|
+
* Shows a warning dialog that the exported file might get cut off.
|
|
304
|
+
* If the count is less than the ResultSizeMaximum of the PDF capabilities,
|
|
305
|
+
* no dialog will be shown and the export will proceed automatically.
|
|
306
|
+
*
|
|
307
|
+
* @param {object} mSettings Export configuration object
|
|
308
|
+
* @returns {Promise} Promise that gets resolved if the requirements
|
|
309
|
+
* for the warning are not met or if the user decides to proceed.
|
|
310
|
+
* When the user cancels the export, the Promise will reject.
|
|
311
|
+
*
|
|
312
|
+
* @private
|
|
313
|
+
*/
|
|
314
|
+
PortableDocument.prototype._showWarning = function(mSettings) {
|
|
315
|
+
var mParams, oWarningPromise;
|
|
316
|
+
|
|
317
|
+
mParams = {
|
|
318
|
+
rows: mSettings.dataSource.count,
|
|
319
|
+
rowLimit: this._mCapabilities.ResultSizeMaximum,
|
|
320
|
+
fileType: FileType.PDF
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
oWarningPromise = Promise.resolve();
|
|
324
|
+
|
|
325
|
+
if (isNaN(mParams.rows) || (mParams.rows > mParams.rowLimit)) {
|
|
326
|
+
oWarningPromise = ExportDialog.showWarningDialog(mParams);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
return oWarningPromise;
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Adds the ResultSizeMaximum from the com.sap.vocabularies.PDF.v1.Features
|
|
334
|
+
* annotation as $top to the data URL. If this property is not available on
|
|
335
|
+
* the annotation or its value is not a number, it will be ignored.
|
|
336
|
+
*
|
|
337
|
+
* @param {string} sUrl Data URL that is used to request the PDF document
|
|
338
|
+
* @returns {string} The modified data URL that contains $top. The value of $top is
|
|
339
|
+
* based on the ResultSizeMaximum of the com.sap.vocabularies.PDF.v1.Features
|
|
340
|
+
* annotation.
|
|
341
|
+
*/
|
|
342
|
+
PortableDocument.prototype._applyResultSize = function(sUrl) {
|
|
343
|
+
var iLimit, mDataUrl;
|
|
344
|
+
|
|
345
|
+
iLimit = parseInt(this._mCapabilities.ResultSizeMaximum);
|
|
346
|
+
|
|
347
|
+
if (!isNaN(iLimit) && iLimit > 0) {
|
|
348
|
+
|
|
349
|
+
mDataUrl = new URL(sUrl);
|
|
350
|
+
mDataUrl.search += '&$top=' + iLimit;
|
|
351
|
+
sUrl = mDataUrl.toString();
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
return sUrl;
|
|
355
|
+
};
|
|
356
|
+
|
|
295
357
|
/**
|
|
296
358
|
* Applies default settings to the export configuration.
|
|
297
359
|
*
|
|
@@ -404,20 +466,7 @@ sap.ui.define([
|
|
|
404
466
|
oDocumentDescription = that._createDocumentDescription(mSettings);
|
|
405
467
|
oBusyDialog.open();
|
|
406
468
|
|
|
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() {
|
|
469
|
+
return this._showWarning(mSettings).then(function() {
|
|
421
470
|
return that.postDocumentDescription(oDocumentDescription, mSettings.dataSource);
|
|
422
471
|
}).then(function(sDocumentDescriptionId) {
|
|
423
472
|
return oBusyDialog && that.sendRequest(mSettings.dataSource.dataUrl, sDocumentDescriptionId);
|
|
@@ -451,6 +500,8 @@ sap.ui.define([
|
|
|
451
500
|
* @private
|
|
452
501
|
*/
|
|
453
502
|
PortableDocument.prototype.sendRequest = function(sUrl, sDocumentDescriptionId) {
|
|
503
|
+
sUrl = this._applyResultSize(sUrl);
|
|
504
|
+
|
|
454
505
|
return new Promise(function(fnResolve, fnReject) {
|
|
455
506
|
var oXHR = this.request = new XMLHttpRequest();
|
|
456
507
|
|
|
@@ -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.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.
|
|
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.
|
|
282
|
+
* @version 1.114.2
|
|
283
283
|
*
|
|
284
284
|
* @since 1.50
|
|
285
285
|
* @alias sap.ui.export.Spreadsheet
|
|
@@ -752,17 +752,15 @@ sap.ui.define([
|
|
|
752
752
|
var oDialogSettings = {
|
|
753
753
|
rows: nRows,
|
|
754
754
|
columns: nColumns,
|
|
755
|
-
|
|
756
|
-
|
|
755
|
+
cellLimit: nSizeLimit,
|
|
756
|
+
rowLimit: MAX_ROWS,
|
|
757
757
|
fileType: Library.FileType.XLSX
|
|
758
758
|
};
|
|
759
759
|
|
|
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.2
|
|
25
25
|
*
|
|
26
26
|
* @alias sap.ui.export.SpreadsheetExport
|
|
27
27
|
* @private
|