@sapui5/sap.ui.export 1.112.2 → 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 +2 -1
- package/src/sap/ui/export/ExportDialog.js +9 -5
- package/src/sap/ui/export/ExportHandler.js +1 -1
- package/src/sap/ui/export/ExportUtils.js +110 -53
- package/src/sap/ui/export/PortableDocument.js +98 -32
- package/src/sap/ui/export/Spreadsheet.js +9 -9
- package/src/sap/ui/export/SpreadsheetExport.js +1 -1
- package/src/sap/ui/export/fragments/SettingsDialog.fragment.xml +2 -0
- 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 +3 -5
- package/src/sap/ui/export/messagebundle.properties +12 -6
- package/src/sap/ui/export/messagebundle_ar.properties +8 -4
- package/src/sap/ui/export/messagebundle_bg.properties +8 -4
- package/src/sap/ui/export/messagebundle_ca.properties +8 -4
- package/src/sap/ui/export/messagebundle_cs.properties +8 -4
- package/src/sap/ui/export/messagebundle_cy.properties +8 -4
- package/src/sap/ui/export/messagebundle_da.properties +8 -4
- package/src/sap/ui/export/messagebundle_de.properties +8 -4
- package/src/sap/ui/export/messagebundle_el.properties +8 -4
- package/src/sap/ui/export/messagebundle_en.properties +8 -4
- package/src/sap/ui/export/messagebundle_en_GB.properties +8 -4
- package/src/sap/ui/export/messagebundle_en_US_sappsd.properties +8 -4
- package/src/sap/ui/export/messagebundle_en_US_saprigi.properties +4 -4
- package/src/sap/ui/export/messagebundle_en_US_saptrc.properties +8 -4
- package/src/sap/ui/export/messagebundle_es.properties +8 -4
- package/src/sap/ui/export/messagebundle_es_MX.properties +8 -4
- package/src/sap/ui/export/messagebundle_et.properties +8 -4
- package/src/sap/ui/export/messagebundle_fi.properties +8 -4
- package/src/sap/ui/export/messagebundle_fr.properties +8 -4
- package/src/sap/ui/export/messagebundle_fr_CA.properties +8 -4
- package/src/sap/ui/export/messagebundle_hi.properties +8 -4
- package/src/sap/ui/export/messagebundle_hr.properties +8 -4
- package/src/sap/ui/export/messagebundle_hu.properties +8 -4
- package/src/sap/ui/export/messagebundle_id.properties +8 -4
- package/src/sap/ui/export/messagebundle_it.properties +8 -4
- package/src/sap/ui/export/messagebundle_iw.properties +8 -4
- package/src/sap/ui/export/messagebundle_ja.properties +8 -4
- package/src/sap/ui/export/messagebundle_kk.properties +8 -4
- package/src/sap/ui/export/messagebundle_ko.properties +8 -4
- package/src/sap/ui/export/messagebundle_lt.properties +8 -4
- package/src/sap/ui/export/messagebundle_lv.properties +8 -4
- package/src/sap/ui/export/messagebundle_ms.properties +8 -4
- package/src/sap/ui/export/messagebundle_nl.properties +8 -4
- package/src/sap/ui/export/messagebundle_no.properties +8 -4
- package/src/sap/ui/export/messagebundle_pl.properties +8 -4
- package/src/sap/ui/export/messagebundle_pt.properties +8 -4
- package/src/sap/ui/export/messagebundle_pt_PT.properties +8 -4
- package/src/sap/ui/export/messagebundle_ro.properties +8 -4
- package/src/sap/ui/export/messagebundle_ru.properties +8 -4
- package/src/sap/ui/export/messagebundle_sh.properties +8 -4
- package/src/sap/ui/export/messagebundle_sk.properties +8 -4
- package/src/sap/ui/export/messagebundle_sl.properties +8 -4
- package/src/sap/ui/export/messagebundle_sv.properties +8 -4
- package/src/sap/ui/export/messagebundle_th.properties +10 -6
- package/src/sap/ui/export/messagebundle_tr.properties +8 -4
- package/src/sap/ui/export/messagebundle_uk.properties +8 -4
- package/src/sap/ui/export/messagebundle_vi.properties +8 -4
- package/src/sap/ui/export/messagebundle_zh_CN.properties +8 -4
- package/src/sap/ui/export/messagebundle_zh_TW.properties +10 -6
- package/src/sap/ui/export/provider/DataProviderBase.js +18 -8
- 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
|
|
@@ -57,6 +57,7 @@ sap.ui.define([
|
|
|
57
57
|
/* Pre-process dataSource related settings */
|
|
58
58
|
if (this._mSettings.workbook) {
|
|
59
59
|
this._mSettings.workbook.hierarchyLevel = ExportUtils.getHierarchyLevelProperty(mSettings.dataSource);
|
|
60
|
+
this._mSettings.workbook.drillState = ExportUtils.getHierarchyDrillStateProperty(mSettings.dataSource);
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
});
|
|
@@ -121,13 +121,14 @@ sap.ui.define([
|
|
|
121
121
|
* @param {number} mParams.columns Amount of columns that will be exported
|
|
122
122
|
* @param {boolean} mParams.sizeLimit Indicates whether the size limit warning needs to be shown
|
|
123
123
|
* @param {boolean} mParams.cutOff Indicates whether the cut off message needs to be shown
|
|
124
|
+
* @param {String} mParams.fileType File type of the exported document
|
|
124
125
|
* @returns {Promise} Promise that gets resolved when the user wants to export, regardless of the warning
|
|
125
126
|
*/
|
|
126
127
|
function showWarningDialog(mParams) {
|
|
127
128
|
return new Promise(function(fnResolve, fnReject) {
|
|
128
129
|
|
|
129
130
|
oResourceBundlePromise.then(function(oResourceBundle) {
|
|
130
|
-
var bContinue, oWarningDialog, oWarningText, sWarningText, oNumberFormat, sRowsFormatted;
|
|
131
|
+
var bContinue, oWarningDialog, oWarningText, sWarningText, oNumberFormat, sRowsFormatted, sCellsFormatted, sCutOffFormatted, sFileTypeText;
|
|
131
132
|
|
|
132
133
|
oNumberFormat = NumberFormat.getIntegerInstance({groupingEnabled: true});
|
|
133
134
|
bContinue = false;
|
|
@@ -139,12 +140,15 @@ sap.ui.define([
|
|
|
139
140
|
sRowsFormatted = oNumberFormat.format(mParams.rows);
|
|
140
141
|
|
|
141
142
|
if (mParams.sizeLimit) {
|
|
142
|
-
|
|
143
|
+
sCellsFormatted = oNumberFormat.format(mParams.rows * mParams.columns);
|
|
144
|
+
sWarningText = oResourceBundle.getText("SIZE_WARNING_MSG", [sRowsFormatted, mParams.columns, sCellsFormatted]);
|
|
143
145
|
}
|
|
144
146
|
|
|
145
|
-
if (mParams.cutOff) {
|
|
147
|
+
if (mParams.rows > mParams.cutOff) {
|
|
148
|
+
sCutOffFormatted = oNumberFormat.format(mParams.cutOff);
|
|
146
149
|
sWarningText += sWarningText === '' ? '' : '\n\n'; // Add line breaks if there is already a message
|
|
147
|
-
|
|
150
|
+
sFileTypeText = oResourceBundle.getText(mParams.fileType + "_FILETYPE");
|
|
151
|
+
sWarningText += oResourceBundle.getText("MSG_WARNING_CUT_OFF", [sRowsFormatted, sCutOffFormatted, sFileTypeText]);
|
|
148
152
|
}
|
|
149
153
|
}
|
|
150
154
|
|
|
@@ -152,7 +156,7 @@ sap.ui.define([
|
|
|
152
156
|
text: sWarningText
|
|
153
157
|
});
|
|
154
158
|
oWarningDialog = new Dialog({
|
|
155
|
-
title: oResourceBundle.getText('
|
|
159
|
+
title: oResourceBundle.getText('WARNING_TITLE'),
|
|
156
160
|
type: DialogType.Message,
|
|
157
161
|
state: ValueState.Warning,
|
|
158
162
|
content: oWarningText,
|
|
@@ -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
|
|
@@ -85,7 +86,8 @@ sap.ui.define([
|
|
|
85
86
|
],
|
|
86
87
|
fontSize: 10,
|
|
87
88
|
signature: false,
|
|
88
|
-
signatureReason: ''
|
|
89
|
+
signatureReason: '',
|
|
90
|
+
showPageNumber: true
|
|
89
91
|
};
|
|
90
92
|
|
|
91
93
|
aSupportedFormats.forEach(function(sFormat) {
|
|
@@ -122,7 +124,7 @@ sap.ui.define([
|
|
|
122
124
|
function processExportSettings(oSettings) {
|
|
123
125
|
var oFinalSettings = {};
|
|
124
126
|
|
|
125
|
-
['fileName', 'fileType', 'paperSize', 'orientation', 'splitCells', 'includeFilterSettings', 'addDateTime', 'doEnableAccessibility', 'fitToPage', 'fontSize', 'signature', 'signatureReason', 'pdfArchive', 'destination'].forEach(function(sProperty) {
|
|
127
|
+
['fileName', 'fileType', 'paperSize', 'orientation', 'splitCells', 'includeFilterSettings', 'addDateTime', 'doEnableAccessibility', 'fitToPage', 'fontSize', 'signature', 'signatureReason', 'pdfArchive', 'destination', 'showPageNumber'].forEach(function(sProperty) {
|
|
126
128
|
oFinalSettings[sProperty] = oSettings[sProperty];
|
|
127
129
|
});
|
|
128
130
|
|
|
@@ -133,7 +135,7 @@ sap.ui.define([
|
|
|
133
135
|
* @class Utilities related to export to enable reuse in integration scenarios (e.g. tables).
|
|
134
136
|
*
|
|
135
137
|
* @author SAP SE
|
|
136
|
-
* @version 1.
|
|
138
|
+
* @version 1.114.0
|
|
137
139
|
*
|
|
138
140
|
* @since 1.59
|
|
139
141
|
* @alias sap.ui.export.ExportUtils
|
|
@@ -355,6 +357,10 @@ sap.ui.define([
|
|
|
355
357
|
}).then(function(oDialog) {
|
|
356
358
|
oExportSettingsDialog = oDialog;
|
|
357
359
|
|
|
360
|
+
if (oExportCapabilities.PDF && !oExportCapabilities.PDF["HeaderFooter"]) {
|
|
361
|
+
oExportConfigModel.oData.showPageNumber = false;
|
|
362
|
+
}
|
|
363
|
+
|
|
358
364
|
oExportSettingsDialog.setModel(oExportConfigModel);
|
|
359
365
|
oExportSettingsDialog.setModel(new ResourceModel({
|
|
360
366
|
bundle: oResourceBundle
|
|
@@ -363,6 +369,10 @@ sap.ui.define([
|
|
|
363
369
|
if (oOpener) {
|
|
364
370
|
syncStyleClass('sapUiSizeCompact', oOpener, oExportSettingsDialog);
|
|
365
371
|
}
|
|
372
|
+
|
|
373
|
+
FESRHelper.setSemanticStepname(oExportSettingsDialog.getBeginButton(), "press", "oi:exp:export");
|
|
374
|
+
FESRHelper.setSemanticStepname(oExportSettingsDialog.getEndButton(), "press", "oi:exp:cancel");
|
|
375
|
+
|
|
366
376
|
oExportSettingsDialog.open();
|
|
367
377
|
|
|
368
378
|
if (fnCallback) {
|
|
@@ -449,56 +459,76 @@ sap.ui.define([
|
|
|
449
459
|
_parseLogical: function(oLogicalFilter) {
|
|
450
460
|
var aFilters, sProperty;
|
|
451
461
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
value: oLogicalFilter.left.right.value
|
|
469
|
-
},
|
|
470
|
-
{
|
|
471
|
-
type: 'Literal',
|
|
472
|
-
value: oLogicalFilter.right.right.value
|
|
473
|
-
}
|
|
474
|
-
],
|
|
475
|
-
name: 'between',
|
|
476
|
-
type: 'Call'
|
|
477
|
-
});
|
|
478
|
-
}
|
|
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
|
+
*/
|
|
479
478
|
|
|
480
|
-
|
|
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
|
+
}
|
|
481
506
|
|
|
482
|
-
|
|
483
|
-
if (oLogicalFilter.op === '||' && aFilters.length) {
|
|
484
|
-
sProperty = aFilters[0].key;
|
|
507
|
+
aFilters = Utils._parseFilter(oLogicalFilter.left).concat(Utils._parseFilter(oLogicalFilter.right));
|
|
485
508
|
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
key: sProperty,
|
|
490
|
-
value: aFilters.reduce(function(acc, item) {
|
|
491
|
-
if (Array.isArray(item.value)) {
|
|
492
|
-
return acc.concat(item.value);
|
|
493
|
-
}
|
|
509
|
+
/* Group logical OR filter on the same property */
|
|
510
|
+
if (oLogicalFilter.op === '||' && aFilters.length) {
|
|
511
|
+
sProperty = aFilters[0].key;
|
|
494
512
|
|
|
495
|
-
|
|
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
|
+
}
|
|
496
521
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
522
|
+
acc.push(item.value);
|
|
523
|
+
|
|
524
|
+
return acc;
|
|
525
|
+
}, [])
|
|
526
|
+
}
|
|
527
|
+
];
|
|
528
|
+
}
|
|
501
529
|
}
|
|
530
|
+
} catch (oError) {
|
|
531
|
+
aFilters = [];
|
|
502
532
|
}
|
|
503
533
|
|
|
504
534
|
return aFilters;
|
|
@@ -1138,7 +1168,7 @@ sap.ui.define([
|
|
|
1138
1168
|
*
|
|
1139
1169
|
* @param {object} oContext Context object
|
|
1140
1170
|
* @param {string} [oContext.application] Name of the application (default: "SAP UI5")
|
|
1141
|
-
* @param {string} [oContext.version] Application version (default: "1.
|
|
1171
|
+
* @param {string} [oContext.version] Application version (default: "1.114.0")
|
|
1142
1172
|
* @param {string} [oContext.title] Title that will be written to the file (NOT the filename)
|
|
1143
1173
|
* @param {string} [oContext.modifiedBy] Optional user context that will be written to the file
|
|
1144
1174
|
* @param {string} [oContext.sheetName] Name of the data sheet - Maximum length of 31 characters
|
|
@@ -1344,10 +1374,10 @@ sap.ui.define([
|
|
|
1344
1374
|
},
|
|
1345
1375
|
|
|
1346
1376
|
/**
|
|
1347
|
-
* Returns the "hierarchy-level-for" annotated property of the bound entity.
|
|
1377
|
+
* Returns the "hierarchy-level-for" / "DistanceFromRootProperty" annotated property of the bound entity.
|
|
1348
1378
|
*
|
|
1349
1379
|
* @param {sap.ui.model.odata.v2.ODataTreeBinding|sap.ui.model.odata.v4.ODataListBinding} oBinding Binding that is used to evaluate the property name
|
|
1350
|
-
* @returns {string|undefined} Name of the property which is annotated with "hierarchy-level-for"
|
|
1380
|
+
* @returns {string|undefined} Name of the property which is annotated with "hierarchy-level-for" or "DistanceFromRootProperty"
|
|
1351
1381
|
*
|
|
1352
1382
|
* @static
|
|
1353
1383
|
* @private
|
|
@@ -1365,7 +1395,34 @@ sap.ui.define([
|
|
|
1365
1395
|
|
|
1366
1396
|
if (oBinding.isA('sap.ui.model.odata.v4.ODataListBinding')) {
|
|
1367
1397
|
var oAggregationInfo = oBinding.getAggregation(/*bVerbose*/true);
|
|
1368
|
-
return oAggregationInfo
|
|
1398
|
+
return oAggregationInfo && oAggregationInfo.$DistanceFromRootProperty;
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
return undefined;
|
|
1402
|
+
},
|
|
1403
|
+
|
|
1404
|
+
/**
|
|
1405
|
+
* Returns the "hierarchy-drill-state-for" / "DrillStateProperty" annotated property of the bound entity.
|
|
1406
|
+
*
|
|
1407
|
+
* @param {sap.ui.model.odata.v2.ODataTreeBinding|sap.ui.model.odata.v4.ODataListBinding} oBinding Binding that is used to evaluate the property name
|
|
1408
|
+
* @returns {string|undefined} Name of the property which is annotated with "hierarchy-drill-state-for" or "DrillStateProperty"
|
|
1409
|
+
*
|
|
1410
|
+
* @static
|
|
1411
|
+
* @private
|
|
1412
|
+
*/
|
|
1413
|
+
getHierarchyDrillStateProperty: function(oBinding) {
|
|
1414
|
+
if (!oBinding || typeof oBinding.isA !== 'function') {
|
|
1415
|
+
return undefined;
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
/* Check for ODataTreeBinding#getTreeAnnotation since this is not a public function */
|
|
1419
|
+
if (oBinding.isA('sap.ui.model.odata.v2.ODataTreeBinding') && typeof oBinding.getTreeAnnotation === 'function') {
|
|
1420
|
+
return oBinding.getTreeAnnotation('hierarchy-drill-state-for');
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
if (oBinding.isA('sap.ui.model.odata.v4.ODataListBinding')) {
|
|
1424
|
+
var oAggregationInfo = oBinding.getAggregation(/*bVerbose*/true);
|
|
1425
|
+
return oAggregationInfo && oAggregationInfo.$DrillStateProperty;
|
|
1369
1426
|
}
|
|
1370
1427
|
|
|
1371
1428
|
return undefined;
|
|
@@ -8,16 +8,20 @@ sap.ui.define([
|
|
|
8
8
|
'sap/ui/core/Core',
|
|
9
9
|
'sap/ui/export/ExportBase',
|
|
10
10
|
'sap/ui/export/ExportUtils',
|
|
11
|
+
'sap/ui/export/library',
|
|
11
12
|
'sap/ui/model/odata/v4/ODataModel',
|
|
12
|
-
'./ExportDialog'
|
|
13
|
-
|
|
13
|
+
'./ExportDialog',
|
|
14
|
+
'sap/m/BusyDialog'
|
|
15
|
+
], function(Log, Core, ExportBase, ExportUtils, Library, ODataModel, ExportDialog, BusyDialog) {
|
|
14
16
|
'use strict';
|
|
15
17
|
|
|
18
|
+
var FileType = Library.FileType;
|
|
19
|
+
|
|
16
20
|
/**
|
|
17
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.
|
|
18
22
|
*
|
|
19
23
|
* @author SAP SE
|
|
20
|
-
* @version 1.
|
|
24
|
+
* @version 1.114.0
|
|
21
25
|
*
|
|
22
26
|
* @since 1.96
|
|
23
27
|
* @alias sap.ui.export.PortableDocument
|
|
@@ -30,7 +34,7 @@ sap.ui.define([
|
|
|
30
34
|
ExportBase.call(this, mSettings, mCapabilities);
|
|
31
35
|
|
|
32
36
|
/* Only apply supported properties */
|
|
33
|
-
['paperSize', 'orientation', 'font', 'fontSize', 'doEnableAccessibility', 'fitToPage', 'signature', 'signatureReason', 'pdfArchive'].forEach(function(sProperty) {
|
|
37
|
+
['paperSize', 'orientation', 'font', 'fontSize', 'doEnableAccessibility', 'fitToPage', 'signature', 'signatureReason', 'pdfArchive', 'showPageNumber'].forEach(function(sProperty) {
|
|
34
38
|
if (typeof mSettings[sProperty] !== 'undefined') {
|
|
35
39
|
this._mSettings[sProperty] = mSettings[sProperty];
|
|
36
40
|
}
|
|
@@ -114,7 +118,8 @@ sap.ui.define([
|
|
|
114
118
|
version: bV4ODataModel ? 4 : 2,
|
|
115
119
|
dataUrl: oDataUrl.toString(),
|
|
116
120
|
serviceUrl: this._resolveServiceUrl(sServiceUrl),
|
|
117
|
-
headers: bV4ODataModel ? oModel.getHttpHeaders(true) : oModel.getHeaders()
|
|
121
|
+
headers: bV4ODataModel ? oModel.getHttpHeaders(true) : oModel.getHeaders(),
|
|
122
|
+
count: ExportUtils.getCountFromBinding(oBinding)
|
|
118
123
|
};
|
|
119
124
|
}
|
|
120
125
|
|
|
@@ -186,13 +191,21 @@ sap.ui.define([
|
|
|
186
191
|
"TableColumns": []
|
|
187
192
|
};
|
|
188
193
|
|
|
189
|
-
if (oWorkbook.hierarchyLevel && oWorkbook.drillState
|
|
194
|
+
if (oWorkbook.hierarchyLevel && oWorkbook.drillState) {
|
|
190
195
|
oDocumentDescription.Hierarchy = {
|
|
191
196
|
"DistanceFromRootElement": oWorkbook.hierarchyLevel,
|
|
192
197
|
"DrillStateElement": oWorkbook.drillState
|
|
193
198
|
};
|
|
194
199
|
}
|
|
195
200
|
|
|
201
|
+
if (mSettings.showPageNumber) {
|
|
202
|
+
oDocumentDescription["Footer"] = {
|
|
203
|
+
"Center": {
|
|
204
|
+
"Type": "PAGENUM"
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
|
|
196
209
|
oMetaInfo = oWorkbook.context.metainfo;
|
|
197
210
|
|
|
198
211
|
/* Add metaInfo to CoverPage */
|
|
@@ -282,6 +295,61 @@ sap.ui.define([
|
|
|
282
295
|
}) : this._oModel;
|
|
283
296
|
};
|
|
284
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
|
+
|
|
285
353
|
/**
|
|
286
354
|
* Applies default settings to the export configuration.
|
|
287
355
|
*
|
|
@@ -377,7 +445,7 @@ sap.ui.define([
|
|
|
377
445
|
var oBusyDialog;
|
|
378
446
|
var oResourceBundle = Core.getLibraryResourceBundle('sap.ui.export');
|
|
379
447
|
|
|
380
|
-
oBusyDialog = new
|
|
448
|
+
oBusyDialog = new BusyDialog('PDFExportBusyDialog', {
|
|
381
449
|
title: oResourceBundle.getText('PROGRESS_TITLE'),
|
|
382
450
|
text: oResourceBundle.getText('PDF_GENERATION_IN_PROGRESS'),
|
|
383
451
|
showCancelButton: true,
|
|
@@ -394,31 +462,27 @@ sap.ui.define([
|
|
|
394
462
|
oDocumentDescription = that._createDocumentDescription(mSettings);
|
|
395
463
|
oBusyDialog.open();
|
|
396
464
|
|
|
397
|
-
return
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
if (oError === null) {
|
|
409
|
-
return;
|
|
410
|
-
}
|
|
465
|
+
return this._showWarning(mSettings).then(function() {
|
|
466
|
+
return that.postDocumentDescription(oDocumentDescription, mSettings.dataSource);
|
|
467
|
+
}).then(function(sDocumentDescriptionId) {
|
|
468
|
+
return oBusyDialog && that.sendRequest(mSettings.dataSource.dataUrl, sDocumentDescriptionId);
|
|
469
|
+
}).then(function(response) {
|
|
470
|
+
ExportUtils.saveAsFile(response, mSettings.fileName);
|
|
471
|
+
}).catch(function(oError) {
|
|
472
|
+
/* Handle ignore Promise rejection due to cancellation by the user */
|
|
473
|
+
if (!oError) {
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
411
476
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
});
|
|
477
|
+
oError.text()
|
|
478
|
+
.then(function(sError) {
|
|
479
|
+
ExportDialog.showErrorMessage(sError);
|
|
480
|
+
})
|
|
481
|
+
.catch(function() {
|
|
482
|
+
ExportDialog.showErrorMessage(oResourceBundle.getText('PDF_GENERIC_ERROR'));
|
|
483
|
+
});
|
|
484
|
+
}).finally(function() {
|
|
485
|
+
oBusyDialog && oBusyDialog.close();
|
|
422
486
|
});
|
|
423
487
|
};
|
|
424
488
|
|
|
@@ -432,6 +496,8 @@ sap.ui.define([
|
|
|
432
496
|
* @private
|
|
433
497
|
*/
|
|
434
498
|
PortableDocument.prototype.sendRequest = function(sUrl, sDocumentDescriptionId) {
|
|
499
|
+
sUrl = this._applyResultSize(sUrl);
|
|
500
|
+
|
|
435
501
|
return new Promise(function(fnResolve, fnReject) {
|
|
436
502
|
var oXHR = this.request = new XMLHttpRequest();
|
|
437
503
|
|
|
@@ -505,4 +571,4 @@ sap.ui.define([
|
|
|
505
571
|
};
|
|
506
572
|
|
|
507
573
|
return PortableDocument;
|
|
508
|
-
});
|
|
574
|
+
});
|
|
@@ -10,9 +10,10 @@ sap.ui.define([
|
|
|
10
10
|
'sap/ui/Device',
|
|
11
11
|
'sap/ui/export/SpreadsheetExport',
|
|
12
12
|
'sap/base/Log',
|
|
13
|
-
'sap/ui/export/ExportUtils'
|
|
13
|
+
'sap/ui/export/ExportUtils',
|
|
14
|
+
'sap/ui/export/library'
|
|
14
15
|
],
|
|
15
|
-
function(Core, ExportDialog, ExportBase, Device, SpreadsheetExport, Log, ExportUtils) {
|
|
16
|
+
function(Core, ExportDialog, ExportBase, Device, SpreadsheetExport, Log, ExportUtils, Library) {
|
|
16
17
|
'use strict';
|
|
17
18
|
|
|
18
19
|
// eslint-disable-next-line
|
|
@@ -83,7 +84,7 @@ sap.ui.define([
|
|
|
83
84
|
* <li><code>workbook.context</code> - Context object that will be applied to the generated file. It may contain the following fields:</li>
|
|
84
85
|
* <ul>
|
|
85
86
|
* <li><code>application</code> (string) - The application that creates the XLSX document (default: "SAP UI5")</li>
|
|
86
|
-
* <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>
|
|
87
88
|
* <li><code>title</code> (string) - Title of the XLSX document (NOT the filename)</li>
|
|
88
89
|
* <li><code>modifiedBy</code> (string) - User context for the XLSX document</li>
|
|
89
90
|
* <li><code>sheetName</code> (string) - The label of the data sheet</li>
|
|
@@ -166,7 +167,7 @@ sap.ui.define([
|
|
|
166
167
|
* columns: aColumns,
|
|
167
168
|
* context: {
|
|
168
169
|
* application: 'Debug Test Application',
|
|
169
|
-
* version: '1.
|
|
170
|
+
* version: '1.114.0',
|
|
170
171
|
* title: 'Some random title',
|
|
171
172
|
* modifiedBy: 'John Doe',
|
|
172
173
|
* metaSheetName: 'Custom metadata',
|
|
@@ -278,7 +279,7 @@ sap.ui.define([
|
|
|
278
279
|
* @class The <code>sap.ui.export.Spreadsheet</code> class allows you to export table data from a UI5 application to a spreadsheet file.
|
|
279
280
|
*
|
|
280
281
|
* @author SAP SE
|
|
281
|
-
* @version 1.
|
|
282
|
+
* @version 1.114.0
|
|
282
283
|
*
|
|
283
284
|
* @since 1.50
|
|
284
285
|
* @alias sap.ui.export.Spreadsheet
|
|
@@ -752,15 +753,14 @@ sap.ui.define([
|
|
|
752
753
|
rows: nRows,
|
|
753
754
|
columns: nColumns,
|
|
754
755
|
sizeLimit: nRows * nColumns > nSizeLimit,
|
|
755
|
-
cutOff:
|
|
756
|
+
cutOff: MAX_ROWS,
|
|
757
|
+
fileType: Library.FileType.XLSX
|
|
756
758
|
};
|
|
757
759
|
|
|
758
760
|
// Show warning and execute
|
|
759
761
|
ExportDialog.showWarningDialog(oDialogSettings)
|
|
760
762
|
.then(startExport)
|
|
761
|
-
.catch(
|
|
762
|
-
fnReject('Export cancelled by the user.');
|
|
763
|
-
});
|
|
763
|
+
.catch(fnReject);
|
|
764
764
|
} else {
|
|
765
765
|
startExport();
|
|
766
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
|
|
@@ -48,6 +48,8 @@
|
|
|
48
48
|
|
|
49
49
|
<Label id="exportSettingsDialog-signatureReasonLabel" text="{i18n>SIGNATURE_REASON}" labelFor="exportSettingsDialog-signatureReason" visible="{/signature}"/>
|
|
50
50
|
<Input id="exportSettingsDialog-signatureReason" value="{/signatureReason}" class="sapUiTinyMarginBottom" visible="{/signature}"/>
|
|
51
|
+
|
|
52
|
+
<CheckBox id="exportSettingsDialog-showPageNumber" enabled="{/capabilities/PDF/HeaderFooter}" selected="{/showPageNumber}" text="{i18n>SHOW_PAGENUM}" tooltip="{i18n>TOOLTIP_PDF_PAGENUMBER}" visible="{path:'/fileType', formatter: '.isPDF'}"/>
|
|
51
53
|
</VBox>
|
|
52
54
|
</content>
|
|
53
55
|
<beginButton>
|