@sapui5/sap.ui.export 1.108.2 → 1.110.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 +2 -2
- package/src/sap/ui/export/ExportBase.js +2 -2
- package/src/sap/ui/export/ExportDialog.js +1 -1
- package/src/sap/ui/export/ExportHandler.js +55 -40
- package/src/sap/ui/export/ExportUtils.js +75 -94
- package/src/sap/ui/export/PortableDocument.js +12 -6
- package/src/sap/ui/export/Spreadsheet.js +10 -6
- package/src/sap/ui/export/SpreadsheetExport.js +2 -2
- package/src/sap/ui/export/library.js +3 -3
- package/src/sap/ui/export/messagebundle.properties +6 -0
- package/src/sap/ui/export/messagebundle_ar.properties +4 -0
- package/src/sap/ui/export/messagebundle_bg.properties +4 -0
- package/src/sap/ui/export/messagebundle_ca.properties +4 -0
- package/src/sap/ui/export/messagebundle_cs.properties +4 -0
- package/src/sap/ui/export/messagebundle_cy.properties +4 -0
- package/src/sap/ui/export/messagebundle_da.properties +4 -0
- package/src/sap/ui/export/messagebundle_de.properties +4 -0
- package/src/sap/ui/export/messagebundle_el.properties +4 -0
- package/src/sap/ui/export/messagebundle_en.properties +4 -0
- package/src/sap/ui/export/messagebundle_en_GB.properties +4 -0
- package/src/sap/ui/export/messagebundle_en_US_sappsd.properties +5 -1
- package/src/sap/ui/export/messagebundle_en_US_saprigi.properties +4 -0
- package/src/sap/ui/export/messagebundle_en_US_saptrc.properties +5 -1
- package/src/sap/ui/export/messagebundle_es.properties +4 -0
- package/src/sap/ui/export/messagebundle_es_MX.properties +4 -0
- package/src/sap/ui/export/messagebundle_et.properties +4 -0
- package/src/sap/ui/export/messagebundle_fi.properties +4 -0
- package/src/sap/ui/export/messagebundle_fr.properties +4 -0
- package/src/sap/ui/export/messagebundle_fr_CA.properties +4 -0
- package/src/sap/ui/export/messagebundle_hi.properties +4 -0
- package/src/sap/ui/export/messagebundle_hr.properties +4 -0
- package/src/sap/ui/export/messagebundle_hu.properties +4 -0
- package/src/sap/ui/export/messagebundle_id.properties +4 -0
- package/src/sap/ui/export/messagebundle_it.properties +4 -0
- package/src/sap/ui/export/messagebundle_iw.properties +4 -0
- package/src/sap/ui/export/messagebundle_ja.properties +4 -0
- package/src/sap/ui/export/messagebundle_kk.properties +4 -0
- package/src/sap/ui/export/messagebundle_ko.properties +4 -0
- package/src/sap/ui/export/messagebundle_lt.properties +4 -0
- package/src/sap/ui/export/messagebundle_lv.properties +4 -0
- package/src/sap/ui/export/messagebundle_ms.properties +4 -0
- package/src/sap/ui/export/messagebundle_nl.properties +4 -0
- package/src/sap/ui/export/messagebundle_no.properties +4 -0
- package/src/sap/ui/export/messagebundle_pl.properties +4 -0
- package/src/sap/ui/export/messagebundle_pt.properties +4 -0
- package/src/sap/ui/export/messagebundle_pt_PT.properties +4 -0
- package/src/sap/ui/export/messagebundle_ro.properties +4 -0
- package/src/sap/ui/export/messagebundle_ru.properties +4 -0
- package/src/sap/ui/export/messagebundle_sh.properties +4 -0
- package/src/sap/ui/export/messagebundle_sk.properties +4 -0
- package/src/sap/ui/export/messagebundle_sl.properties +4 -0
- package/src/sap/ui/export/messagebundle_sv.properties +4 -0
- package/src/sap/ui/export/messagebundle_th.properties +4 -0
- package/src/sap/ui/export/messagebundle_tr.properties +4 -0
- package/src/sap/ui/export/messagebundle_uk.properties +4 -0
- package/src/sap/ui/export/messagebundle_vi.properties +4 -0
- package/src/sap/ui/export/messagebundle_zh_CN.properties +4 -0
- package/src/sap/ui/export/messagebundle_zh_TW.properties +4 -0
- package/src/sap/ui/export/provider/DataProviderBase.js +1 -1
- package/src/sap/ui/export/themes/base/ExportUtils.less +1 -1
- package/src/sap/ui/export/themes/base/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_belize/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_belize_hcb/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_belize_hcw/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_belize_plus/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_bluecrystal/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_fiori_3/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_fiori_3_dark/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_fiori_3_hcb/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_fiori_3_hcw/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_hcb/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_horizon/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_horizon_dark/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_horizon_hcb/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_horizon_hcw/library.source.less +1 -1
- package/src/sap/ui/export/util/Filter.js +207 -0
package/package.json
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<name>sap.ui.export</name>
|
|
5
5
|
<vendor>SAP SE</vendor>
|
|
6
6
|
<copyright>SAPUI5
|
|
7
|
-
* (c) Copyright 2009-
|
|
8
|
-
<version>1.
|
|
7
|
+
* (c) Copyright 2009-2023 SAP SE. All rights reserved.</copyright>
|
|
8
|
+
<version>1.110.0</version>
|
|
9
9
|
|
|
10
10
|
<documentation>UI5 library: sap.ui.export</documentation>
|
|
11
11
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* SAPUI5
|
|
3
|
-
* (c) Copyright 2009-
|
|
3
|
+
* (c) Copyright 2009-2023 SAP SE. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
sap.ui.define([
|
|
@@ -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.
|
|
30
|
+
* @version 1.110.0
|
|
31
31
|
*
|
|
32
32
|
* @since 1.96
|
|
33
33
|
* @name sap.ui.export.ExportBase
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* SAPUI5
|
|
3
|
-
* (c) Copyright 2009-
|
|
3
|
+
* (c) Copyright 2009-2023 SAP SE. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
sap.ui.define(['./library', './ExportUtils', './ExportDialog', 'sap/m/MessageToast', 'sap/ui/core/Core', 'sap/ui/base/EventProvider', 'sap/ui/model/odata/v4/ODataModel', 'sap/ui/util/openWindow'], function(library, ExportUtils, ExportDialog, MessageToast, Core, EventProvider, ODataModel, openWindow) {
|
|
6
6
|
'use strict';
|
|
@@ -12,15 +12,14 @@ sap.ui.define(['./library', './ExportUtils', './ExportDialog', 'sap/m/MessageToa
|
|
|
12
12
|
* Any export related functionality is encapsuled in the <code>ExportHandler</code> which also stores user settings throughout the session.
|
|
13
13
|
*
|
|
14
14
|
* @param {object} [mCapabilities] Mapping object which references certain export capabilities
|
|
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.110.0
|
|
19
19
|
*
|
|
20
20
|
* @since 1.102
|
|
21
|
-
* @
|
|
21
|
+
* @alias sap.ui.export.ExportHandler
|
|
22
22
|
* @extends sap.ui.base.EventProvider
|
|
23
|
-
* @namespace
|
|
24
23
|
* @private
|
|
25
24
|
* @ui5-restricted sap.ui.comp.smarttable.SmartTable, sap.ui.mdc.Table
|
|
26
25
|
*/
|
|
@@ -59,6 +58,7 @@ sap.ui.define(['./library', './ExportUtils', './ExportDialog', 'sap/m/MessageToa
|
|
|
59
58
|
* @param {object} oEvent.getParameters
|
|
60
59
|
* @param {object} oEvent.getParameter.exportSettings Contains export-related configuration
|
|
61
60
|
* @param {object} oEvent.getParameter.userExportSettings User specific settings from the "Export As" dialog
|
|
61
|
+
* @param {sap.ui.export.util.Filter[]} oEvent.getParameter.filterSettings Array of filter settings for the exported data
|
|
62
62
|
*
|
|
63
63
|
* @since 1.102
|
|
64
64
|
* @public
|
|
@@ -77,8 +77,6 @@ sap.ui.define(['./library', './ExportUtils', './ExportDialog', 'sap/m/MessageToa
|
|
|
77
77
|
*
|
|
78
78
|
* @returns {this} Reference to <code>this</code> in order to allow method chaining
|
|
79
79
|
*
|
|
80
|
-
* @name sap.ui.export.ExportHandler#attachBeforeExport
|
|
81
|
-
* @function
|
|
82
80
|
* @since 1.102
|
|
83
81
|
* @public
|
|
84
82
|
*/
|
|
@@ -96,8 +94,6 @@ sap.ui.define(['./library', './ExportUtils', './ExportDialog', 'sap/m/MessageToa
|
|
|
96
94
|
*
|
|
97
95
|
* @returns {this} Reference to <code>this</code> in order to allow method chaining
|
|
98
96
|
*
|
|
99
|
-
* @name sap.ui.export.ExportHandler#detachBeforeExport
|
|
100
|
-
* @function
|
|
101
97
|
* @since 1.102
|
|
102
98
|
* @public
|
|
103
99
|
*/
|
|
@@ -115,7 +111,6 @@ sap.ui.define(['./library', './ExportUtils', './ExportDialog', 'sap/m/MessageToa
|
|
|
115
111
|
* The object must not be used anymore after destroy was called.
|
|
116
112
|
*
|
|
117
113
|
* @see sap.ui.base.Object#destroy
|
|
118
|
-
* @function
|
|
119
114
|
* @public
|
|
120
115
|
*/
|
|
121
116
|
ExportHandler.prototype.destroy = function() {
|
|
@@ -239,6 +234,7 @@ sap.ui.define(['./library', './ExportUtils', './ExportDialog', 'sap/m/MessageToa
|
|
|
239
234
|
*
|
|
240
235
|
* @param {object} mExportSettings mExportSettings ExportSettings that are used for the export
|
|
241
236
|
* @param {object} mCustomSettings Additional settings that are passed into the event
|
|
237
|
+
* @param {boolean} [mCustomSettings.includeFilterSettings] Defines whether the filter settings on the binding should be included in the exported file
|
|
242
238
|
* @param {object} mCloudFileInfo FileShareItem representation of the file
|
|
243
239
|
* @returns {Promise} A <code>Promise</code> that resolves with the desired export instance
|
|
244
240
|
* @private
|
|
@@ -252,14 +248,59 @@ sap.ui.define(['./library', './ExportUtils', './ExportDialog', 'sap/m/MessageToa
|
|
|
252
248
|
]).then(function(aResolve) {
|
|
253
249
|
var oResourceBundle = aResolve[0];
|
|
254
250
|
var oExportInstance = aResolve[1];
|
|
251
|
+
var aFilters = [];
|
|
252
|
+
var oFilterConfig;
|
|
253
|
+
|
|
254
|
+
if (mCustomSettings && mCustomSettings.includeFilterSettings) {
|
|
255
|
+
var oContext = mExportSettings.workbook.context;
|
|
256
|
+
|
|
257
|
+
if (!oContext) {
|
|
258
|
+
oContext = mExportSettings.workbook.context = {
|
|
259
|
+
metainfo: []
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
oFilterConfig = {
|
|
264
|
+
name: oResourceBundle.getText('FILTER_HEADER'),
|
|
265
|
+
items: []
|
|
266
|
+
};
|
|
267
|
+
aFilters = mCustomSettings.includeFilterSettings ? ExportUtils.getFilters(mExportSettings.dataSource) : [];
|
|
268
|
+
oContext.metaSheetName = oFilterConfig.name;
|
|
269
|
+
|
|
270
|
+
oContext.metainfo.push(oFilterConfig);
|
|
271
|
+
}
|
|
255
272
|
|
|
256
273
|
oExportInstance.attachBeforeExport(function(oEvent) {
|
|
257
274
|
var mEventExportSettings = oEvent.getParameter('exportSettings');
|
|
258
275
|
|
|
259
276
|
that.fireEvent('beforeExport', {
|
|
260
277
|
exportSettings: mEventExportSettings,
|
|
261
|
-
userExportSettings: mCustomSettings || {}
|
|
278
|
+
userExportSettings: mCustomSettings || {},
|
|
279
|
+
filterSettings: aFilters
|
|
262
280
|
}, false, false);
|
|
281
|
+
|
|
282
|
+
/* Sort filterSettings and write to metainfo */
|
|
283
|
+
aFilters.filter(function(oFilter) {
|
|
284
|
+
return oFilter && typeof oFilter.isA === 'function' && oFilter.isA('sap.ui.export.util.Filter');
|
|
285
|
+
}).sort(function(firstElement, secondElement) {
|
|
286
|
+
var sFirst = firstElement.getLabel().toLowerCase();
|
|
287
|
+
var sSecond = secondElement.getLabel().toLowerCase();
|
|
288
|
+
|
|
289
|
+
if (sFirst > sSecond) {
|
|
290
|
+
return 1;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (sFirst < sSecond) {
|
|
294
|
+
return -1;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
return 0;
|
|
298
|
+
}).forEach(function(oFilter) {
|
|
299
|
+
oFilterConfig.items.push({
|
|
300
|
+
key: oFilter.getLabel(),
|
|
301
|
+
value: oFilter.getValue()
|
|
302
|
+
});
|
|
303
|
+
});
|
|
263
304
|
});
|
|
264
305
|
|
|
265
306
|
if (mCloudFileInfo && typeof oExportInstance.attachBeforeSave === 'function') {
|
|
@@ -420,9 +461,7 @@ sap.ui.define(['./library', './ExportUtils', './ExportDialog', 'sap/m/MessageToa
|
|
|
420
461
|
* @param {function} [fnResolveColumnLabel] Resolves the label for a particular column that is not directly contained in the export settings
|
|
421
462
|
* @returns {Promise} A <code>Promise</code> that resolves once the data has been exported
|
|
422
463
|
*
|
|
423
|
-
* @name sap.ui.export.ExportHandler#exportAs
|
|
424
464
|
* @since 1.102
|
|
425
|
-
* @function
|
|
426
465
|
* @public
|
|
427
466
|
*/
|
|
428
467
|
ExportHandler.prototype.exportAs = function(oSettings, fnResolveColumnLabel) {
|
|
@@ -457,44 +496,20 @@ sap.ui.define(['./library', './ExportUtils', './ExportDialog', 'sap/m/MessageToa
|
|
|
457
496
|
if (mExportSettings.fileType === FileType.PDF || mDialogSettings.splitCells) {
|
|
458
497
|
mExportSettings.workbook.columns = ExportUtils.splitColumns(mExportSettings.workbook.columns, fnResolveColumnLabel);
|
|
459
498
|
}
|
|
460
|
-
|
|
461
|
-
if (mDialogSettings.includeFilterSettings) {
|
|
462
|
-
return ExportUtils.parseFilterConfiguration(oSettings.dataSource, fnResolveColumnLabel);
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
return Promise.resolve();
|
|
466
|
-
}).then(function(oFilterConfig) {
|
|
467
|
-
if (oFilterConfig) {
|
|
468
|
-
var oContext = mExportSettings.workbook.context;
|
|
469
|
-
|
|
470
|
-
if (!oContext) {
|
|
471
|
-
oContext = mExportSettings.workbook.context = {};
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
oContext.metaSheetName = oFilterConfig.name;
|
|
475
|
-
oContext.metainfo = Array.isArray(oContext.metainfo) ? oContext.metainfo.push(oFilterConfig) : [oFilterConfig];
|
|
476
|
-
}
|
|
477
|
-
|
|
478
499
|
if (mExportSettings.includeFilterSettings) {
|
|
479
500
|
return ExportUtils.parseTechnicalConfiguration();
|
|
480
501
|
}
|
|
481
502
|
|
|
482
503
|
return Promise.resolve();
|
|
483
|
-
}).then(function(
|
|
484
|
-
if (
|
|
504
|
+
}).then(function(oUserConfig) {
|
|
505
|
+
if (oUserConfig) {
|
|
485
506
|
var oContext = mExportSettings.workbook.context;
|
|
486
507
|
|
|
487
508
|
if (!oContext) {
|
|
488
509
|
oContext = mExportSettings.workbook.context = {};
|
|
489
510
|
}
|
|
490
511
|
|
|
491
|
-
|
|
492
|
-
aUserConfig.forEach(function(oUserConfig) {
|
|
493
|
-
oContext.metainfo.unshift(oUserConfig);
|
|
494
|
-
});
|
|
495
|
-
} else {
|
|
496
|
-
oContext.metainfo = aUserConfig;
|
|
497
|
-
}
|
|
512
|
+
oContext.metainfo = Array.isArray(oContext.metainfo) ? oContext.metainfo.push(oUserConfig) : [oUserConfig];
|
|
498
513
|
}
|
|
499
514
|
}).then(function() {
|
|
500
515
|
if (mExportSettings.destination === Destination.LOCAL) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* SAPUI5
|
|
3
|
-
* (c) Copyright 2009-
|
|
3
|
+
* (c) Copyright 2009-2023 SAP SE. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
sap.ui.define([
|
|
6
6
|
'./library',
|
|
@@ -9,12 +9,13 @@ sap.ui.define([
|
|
|
9
9
|
'sap/ui/core/Fragment',
|
|
10
10
|
'sap/ui/core/library',
|
|
11
11
|
'sap/ui/core/syncStyleClass',
|
|
12
|
+
'sap/ui/export/util/Filter',
|
|
12
13
|
'sap/ui/model/json/JSONModel',
|
|
13
14
|
'sap/ui/model/resource/ResourceModel',
|
|
14
15
|
'sap/ui/util/openWindow',
|
|
15
16
|
'sap/ui/VersionInfo',
|
|
16
17
|
'sap/ui/core/format/DateFormat'
|
|
17
|
-
], function(library, Log, Core, Fragment, coreLibrary, syncStyleClass, JSONModel, ResourceModel, openWindow, VersionInfo, DateFormat) {
|
|
18
|
+
], function(library, Log, Core, Fragment, coreLibrary, syncStyleClass, Filter, JSONModel, ResourceModel, openWindow, VersionInfo, DateFormat) {
|
|
18
19
|
'use strict';
|
|
19
20
|
|
|
20
21
|
// eslint-disable-next-line
|
|
@@ -132,7 +133,7 @@ sap.ui.define([
|
|
|
132
133
|
* Utilities related to export to enable reuse in integration scenarios (e.g. tables).
|
|
133
134
|
*
|
|
134
135
|
* @author SAP SE
|
|
135
|
-
* @version 1.
|
|
136
|
+
* @version 1.110.0
|
|
136
137
|
*
|
|
137
138
|
* @since 1.59
|
|
138
139
|
* @name sap.ui.export.ExportUtils
|
|
@@ -366,20 +367,6 @@ sap.ui.define([
|
|
|
366
367
|
});
|
|
367
368
|
},
|
|
368
369
|
|
|
369
|
-
/**
|
|
370
|
-
* Returns a different representation of the filter
|
|
371
|
-
* value in case the value is an instance of Date.
|
|
372
|
-
* The resutl of Date.prototype.toString function is
|
|
373
|
-
* too long and complex so we use the ISO-String
|
|
374
|
-
* instead.
|
|
375
|
-
*
|
|
376
|
-
* @param {*} vValue Filter value that might get converted
|
|
377
|
-
* @returns {*} The formatted value
|
|
378
|
-
*/
|
|
379
|
-
_getFormattedFilterValue: function(vValue) {
|
|
380
|
-
return vValue instanceof Date ? vValue.toISOString() : vValue;
|
|
381
|
-
},
|
|
382
|
-
|
|
383
370
|
/**
|
|
384
371
|
* Combines the filter operator with the value and
|
|
385
372
|
* creates a textual representation.
|
|
@@ -391,21 +378,27 @@ sap.ui.define([
|
|
|
391
378
|
_getReadableFilterValue: function(oFilter) {
|
|
392
379
|
switch (oFilter.op || oFilter.name) {
|
|
393
380
|
case '==':
|
|
394
|
-
return '=' + Utils._getFormattedFilterValue(oFilter.right.value);
|
|
395
381
|
case '>':
|
|
396
382
|
case '<':
|
|
397
383
|
case '!=':
|
|
398
384
|
case '<=':
|
|
399
385
|
case '>=':
|
|
400
|
-
return
|
|
386
|
+
return {
|
|
387
|
+
operator: oFilter.op || oFilter.name,
|
|
388
|
+
value: oFilter.right.value
|
|
389
|
+
};
|
|
401
390
|
case 'between':
|
|
402
|
-
return
|
|
391
|
+
return {
|
|
392
|
+
operator: oFilter.op || oFilter.name,
|
|
393
|
+
value: [oFilter.args[1].value, oFilter.args[2].value]
|
|
394
|
+
};
|
|
403
395
|
case 'contains':
|
|
404
|
-
return '*' + oFilter.args[1].value + '*';
|
|
405
396
|
case 'endswith':
|
|
406
|
-
return '*' + oFilter.args[1].value;
|
|
407
397
|
case 'startswith':
|
|
408
|
-
return
|
|
398
|
+
return {
|
|
399
|
+
operator: oFilter.op || oFilter.name,
|
|
400
|
+
value: oFilter.args[1].value
|
|
401
|
+
};
|
|
409
402
|
default:
|
|
410
403
|
throw Error('getReadableFilter');
|
|
411
404
|
}
|
|
@@ -483,10 +476,14 @@ sap.ui.define([
|
|
|
483
476
|
{
|
|
484
477
|
key: sProperty,
|
|
485
478
|
value: aFilters.reduce(function(acc, item) {
|
|
486
|
-
|
|
479
|
+
if (Array.isArray(item.value)) {
|
|
480
|
+
return acc.concat(item.value);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
acc.push(item.value);
|
|
487
484
|
|
|
488
|
-
return acc
|
|
489
|
-
},
|
|
485
|
+
return acc;
|
|
486
|
+
}, [])
|
|
490
487
|
}
|
|
491
488
|
];
|
|
492
489
|
}
|
|
@@ -531,7 +528,10 @@ sap.ui.define([
|
|
|
531
528
|
}
|
|
532
529
|
|
|
533
530
|
result = Utils._parseFilter(oUnaryFilter.arg);
|
|
534
|
-
|
|
531
|
+
|
|
532
|
+
if (oUnaryFilter.op === '!' && result[0].value) {
|
|
533
|
+
result[0].value.exclude = true;
|
|
534
|
+
}
|
|
535
535
|
|
|
536
536
|
return result;
|
|
537
537
|
},
|
|
@@ -556,85 +556,68 @@ sap.ui.define([
|
|
|
556
556
|
},
|
|
557
557
|
|
|
558
558
|
/**
|
|
559
|
-
*
|
|
560
|
-
* sap.ui.model.TreeBinding and extracts the filter
|
|
561
|
-
* configuration in a format that can be attached to
|
|
562
|
-
* a sap.ui.export.Spreadsheet instance.
|
|
563
|
-
*
|
|
564
|
-
* @param {sap.ui.model.ListBinding | sap.ui.model.TreeBinding} oBinding ListBinding or TreeBinding instance
|
|
565
|
-
* @param {function} fnCallback Callback function that is used to resolve the columns names according to their property
|
|
559
|
+
* This function has been deprecated and might be removed in future releases.
|
|
566
560
|
*
|
|
567
561
|
* @returns {Promise}
|
|
568
562
|
* Promise, which resolves with an object containing a name
|
|
569
563
|
* property and items array with key value pairs which can be
|
|
570
564
|
* attached to the metainfo in the sap.ui.export.Spreadsheet
|
|
571
565
|
* configuration
|
|
566
|
+
* @deprecated
|
|
572
567
|
*
|
|
573
568
|
* @ui5-restricted sap.ui.comp.smarttable.SmartTable
|
|
574
569
|
*/
|
|
575
|
-
parseFilterConfiguration: function(
|
|
576
|
-
|
|
577
|
-
oResourceBundlePromise.then(function(oResourceBundle) {
|
|
578
|
-
var oFilterConfig, sLabel;
|
|
579
|
-
|
|
580
|
-
oFilterConfig = {
|
|
581
|
-
name: oResourceBundle.getText('FILTER_HEADER'),
|
|
582
|
-
items: []
|
|
583
|
-
};
|
|
584
|
-
|
|
585
|
-
if (!oBinding || !(oBinding.isA('sap.ui.model.ListBinding') || oBinding.isA('sap.ui.model.TreeBinding'))) {
|
|
586
|
-
Log.error('A ListBinding is required for parsing the filter settings');
|
|
587
|
-
fnReject();
|
|
588
|
-
return null;
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
var oFilterInfo = oBinding.getFilterInfo();
|
|
592
|
-
if (oFilterInfo) {
|
|
593
|
-
oFilterConfig.items = Utils._parseFilter(oFilterInfo);
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
/* Resolve column labels */
|
|
597
|
-
if (typeof fnCallback === 'function') {
|
|
598
|
-
oFilterConfig.items.forEach(function(item) {
|
|
599
|
-
sLabel = fnCallback(item.key);
|
|
600
|
-
|
|
601
|
-
item.key = sLabel && typeof sLabel === 'string' ? sLabel : item.key;
|
|
602
|
-
});
|
|
603
|
-
}
|
|
570
|
+
parseFilterConfiguration: function() {
|
|
571
|
+
Log.error('Function is deprecated and must not be used anymore');
|
|
604
572
|
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
}
|
|
573
|
+
return oResourceBundlePromise.then(function(oResourceBundle) {
|
|
574
|
+
return {
|
|
575
|
+
name: oResourceBundle.getText('FILTER_HEADER'),
|
|
576
|
+
items: []
|
|
577
|
+
};
|
|
578
|
+
});
|
|
579
|
+
},
|
|
613
580
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
581
|
+
/**
|
|
582
|
+
* Accepts a binding of type sap.ui.model.ListBinding or
|
|
583
|
+
* sap.ui.model.TreeBinding and extracts the filter
|
|
584
|
+
* configuration in a format that can be attached to
|
|
585
|
+
* a sap.ui.export.Spreadsheet instance.
|
|
586
|
+
*
|
|
587
|
+
* @param {sap.ui.model.ListBinding | sap.ui.model.TreeBinding} oBinding ListBinding or TreeBinding instance
|
|
588
|
+
* @returns {sap.ui.export.util.Filter[]} Array of sap.ui.export.util.Filter objects. The Array is empty if no filters are available on the binding.
|
|
589
|
+
* @private
|
|
590
|
+
*/
|
|
591
|
+
getFilters: function(oBinding) {
|
|
592
|
+
var aFilters, oFilterInfo;
|
|
617
593
|
|
|
618
|
-
|
|
619
|
-
});
|
|
594
|
+
aFilters = [];
|
|
620
595
|
|
|
621
|
-
|
|
596
|
+
if (!oBinding || !(oBinding.isA('sap.ui.model.ListBinding') || !oBinding.isA('sap.ui.model.TreeBinding'))) {
|
|
597
|
+
Log.error('A ListBinding or TreeBinding is required for parsing the filter settings');
|
|
598
|
+
return aFilters;
|
|
599
|
+
}
|
|
622
600
|
|
|
623
|
-
|
|
601
|
+
oFilterInfo = oBinding.getFilterInfo();
|
|
602
|
+
if (oFilterInfo) {
|
|
603
|
+
Utils._parseFilter(oFilterInfo).forEach(function(oEntry) {
|
|
604
|
+
aFilters.push(new Filter(oEntry.key, oEntry.value));
|
|
624
605
|
});
|
|
625
|
-
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
return aFilters;
|
|
626
609
|
},
|
|
627
610
|
|
|
628
611
|
/**
|
|
629
612
|
* Promise, which resolves with an array containing username and
|
|
630
613
|
* time stamp at which the document was created
|
|
631
614
|
*
|
|
632
|
-
* @returns {Promise} Resolves when the technical information has been obtained
|
|
615
|
+
* @returns {Promise<object>} Resolves when the technical information has been obtained
|
|
633
616
|
*/
|
|
634
617
|
parseTechnicalConfiguration: function() {
|
|
635
|
-
var
|
|
618
|
+
var oUserConfig, oBundle, oUshellContainer;
|
|
636
619
|
|
|
637
|
-
|
|
620
|
+
oUserConfig = {};
|
|
638
621
|
|
|
639
622
|
/* sap/ushell/Container is not available through module loader */
|
|
640
623
|
oUshellContainer = sap.ushell && sap.ushell.Container;
|
|
@@ -642,28 +625,26 @@ sap.ui.define([
|
|
|
642
625
|
return Utils.getResourceBundle().then(function(oResourceBundle) {
|
|
643
626
|
oBundle = oResourceBundle;
|
|
644
627
|
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
]
|
|
653
|
-
});
|
|
628
|
+
oUserConfig.name = oBundle.getText('TECHNICAL_INFORMATION');
|
|
629
|
+
oUserConfig.items = [
|
|
630
|
+
{
|
|
631
|
+
key: oBundle.getText('CREATED_TIME'),
|
|
632
|
+
value: DateFormat.getDateTimeWithTimezoneInstance().format(new Date())
|
|
633
|
+
}
|
|
634
|
+
];
|
|
654
635
|
}).then(function() {
|
|
655
636
|
return oUshellContainer && typeof oUshellContainer.getServiceAsync === 'function' ?
|
|
656
637
|
oUshellContainer.getServiceAsync('UserInfo') : undefined;
|
|
657
638
|
}).then(function (oUserInfo) {
|
|
658
639
|
/* Add entry if UserInfo contains a proper name */
|
|
659
640
|
if (oUserInfo && oUserInfo.getFullName()) {
|
|
660
|
-
|
|
641
|
+
oUserConfig.items.unshift({
|
|
661
642
|
key: oBundle.getText('USER_NAME'),
|
|
662
643
|
value: oUserInfo.getFullName()
|
|
663
644
|
});
|
|
664
645
|
}
|
|
665
646
|
|
|
666
|
-
return
|
|
647
|
+
return oUserConfig;
|
|
667
648
|
});
|
|
668
649
|
},
|
|
669
650
|
|
|
@@ -1121,7 +1102,7 @@ sap.ui.define([
|
|
|
1121
1102
|
*
|
|
1122
1103
|
* @param {object} oContext Context object
|
|
1123
1104
|
* @param {string} [oContext.application] Name of the application (default: "SAP UI5")
|
|
1124
|
-
* @param {string} [oContext.version] Application version (default: "1.
|
|
1105
|
+
* @param {string} [oContext.version] Application version (default: "1.110.0")
|
|
1125
1106
|
* @param {string} [oContext.title] Title that will be written to the file (NOT the filename)
|
|
1126
1107
|
* @param {string} [oContext.modifiedBy] Optional user context that will be written to the file
|
|
1127
1108
|
* @param {string} [oContext.sheetName] Name of the data sheet - Maximum length of 31 characters
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* SAPUI5
|
|
3
|
-
* (c) Copyright 2009-
|
|
3
|
+
* (c) Copyright 2009-2023 SAP SE. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
sap.ui.define([
|
|
7
7
|
'sap/base/Log',
|
|
8
|
-
'sap/m/MessageToast',
|
|
9
8
|
'sap/ui/core/Core',
|
|
10
9
|
'sap/ui/export/ExportBase',
|
|
11
10
|
'sap/ui/export/ExportUtils',
|
|
12
|
-
'sap/ui/model/odata/v4/ODataModel'
|
|
13
|
-
|
|
11
|
+
'sap/ui/model/odata/v4/ODataModel',
|
|
12
|
+
'./ExportDialog'
|
|
13
|
+
], function(Log, Core, ExportBase, ExportUtils, ODataModel, ExportDialog) {
|
|
14
14
|
'use strict';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* @constructor 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
18
|
*
|
|
19
19
|
* @author SAP SE
|
|
20
|
-
* @version 1.
|
|
20
|
+
* @version 1.110.0
|
|
21
21
|
*
|
|
22
22
|
* @since 1.96
|
|
23
23
|
* @alias sap.ui.export.PortableDocument
|
|
@@ -358,7 +358,13 @@ sap.ui.define([
|
|
|
358
358
|
oBusyDialog.destroy();
|
|
359
359
|
}).catch(function(oError) {
|
|
360
360
|
oBusyDialog.destroy();
|
|
361
|
-
|
|
361
|
+
oError.text()
|
|
362
|
+
.then(function(sError) {
|
|
363
|
+
ExportDialog.showErrorMessage(sError);
|
|
364
|
+
})
|
|
365
|
+
.catch(function() {
|
|
366
|
+
ExportDialog.showErrorMessage(oResourceBundle.getText('PDF_GENERIC_ERROR'));
|
|
367
|
+
});
|
|
362
368
|
});
|
|
363
369
|
});
|
|
364
370
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* SAPUI5
|
|
3
|
-
* (c) Copyright 2009-
|
|
3
|
+
* (c) Copyright 2009-2023 SAP SE. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
sap.ui.define([
|
|
@@ -83,7 +83,7 @@ sap.ui.define([
|
|
|
83
83
|
* <li><code>workbook.context</code> - Context object that will be applied to the generated file. It may contain the following fields:</li>
|
|
84
84
|
* <ul>
|
|
85
85
|
* <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.
|
|
86
|
+
* <li><code>version</code> (string) - Application version that creates the XLSX document (default: "1.110.0")</li>
|
|
87
87
|
* <li><code>title</code> (string) - Title of the XLSX document (NOT the filename)</li>
|
|
88
88
|
* <li><code>modifiedBy</code> (string) - User context for the XLSX document</li>
|
|
89
89
|
* <li><code>sheetName</code> (string) - The label of the data sheet</li>
|
|
@@ -166,7 +166,7 @@ sap.ui.define([
|
|
|
166
166
|
* columns: aColumns,
|
|
167
167
|
* context: {
|
|
168
168
|
* application: 'Debug Test Application',
|
|
169
|
-
* version: '1.
|
|
169
|
+
* version: '1.110.0',
|
|
170
170
|
* title: 'Some random title',
|
|
171
171
|
* modifiedBy: 'John Doe',
|
|
172
172
|
* metaSheetName: 'Custom metadata',
|
|
@@ -278,7 +278,7 @@ sap.ui.define([
|
|
|
278
278
|
* @constructor The <code>sap.ui.export.Spreadsheet</code> class allows you to export table data from a UI5 application to a spreadsheet file.
|
|
279
279
|
*
|
|
280
280
|
* @author SAP SE
|
|
281
|
-
* @version 1.
|
|
281
|
+
* @version 1.110.0
|
|
282
282
|
*
|
|
283
283
|
* @since 1.50
|
|
284
284
|
* @name sap.ui.export.Spreadsheet
|
|
@@ -537,10 +537,14 @@ sap.ui.define([
|
|
|
537
537
|
* If <code>ClientListBinding</code>, we use the binding path to receive the data from the underlying model
|
|
538
538
|
*/
|
|
539
539
|
if (oBinding.isA('sap.ui.model.ClientListBinding')) {
|
|
540
|
-
var aData =
|
|
540
|
+
var aData = [];
|
|
541
|
+
|
|
542
|
+
oBinding.getAllCurrentContexts().forEach(function(oContext) {
|
|
543
|
+
aData.push(oContext.getObject());
|
|
544
|
+
});
|
|
541
545
|
|
|
542
546
|
oDataSource = {
|
|
543
|
-
data:
|
|
547
|
+
data: aData,
|
|
544
548
|
type: 'array'
|
|
545
549
|
};
|
|
546
550
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* SAPUI5
|
|
3
|
-
* (c) Copyright 2009-
|
|
3
|
+
* (c) Copyright 2009-2023 SAP SE. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -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.
|
|
25
|
+
* @version 1.110.0
|
|
26
26
|
*
|
|
27
27
|
* @private
|
|
28
28
|
* @since 1.50.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* SAPUI5
|
|
3
|
-
* (c) Copyright 2009-
|
|
3
|
+
* (c) Copyright 2009-2023 SAP SE. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -17,7 +17,7 @@ sap.ui.define([
|
|
|
17
17
|
* @namespace
|
|
18
18
|
* @alias sap.ui.export
|
|
19
19
|
* @author SAP SE
|
|
20
|
-
* @version 1.
|
|
20
|
+
* @version 1.110.0
|
|
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.
|
|
36
|
+
version: "1.110.0"
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
|
|
@@ -115,6 +115,12 @@ SIGNATURE_REASON=Reason
|
|
|
115
115
|
#XMSG: Message text informing that PDF is generated
|
|
116
116
|
PDF_GENERATION_IN_PROGRESS=PDF is being generated
|
|
117
117
|
|
|
118
|
+
#XMSG: Message text informing that there was an error in PDF generation.
|
|
119
|
+
PDF_GENERATION_ERROR=There has been an error during the PDF export
|
|
120
|
+
|
|
121
|
+
#XMSG: Error text informing when PDF generation is failed
|
|
122
|
+
PDF_GENERIC_ERROR=Error during PDF export
|
|
123
|
+
|
|
118
124
|
#XMSG: File name error text
|
|
119
125
|
FILENAME_ERROR=You cannot use any of the following characters in a file name: \\ / : * ? " < > |
|
|
120
126
|
|