@sapui5/sap.ui.export 1.109.0 → 1.111.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 +7 -3
- package/src/sap/ui/export/ExportDialog.js +1 -1
- package/src/sap/ui/export/ExportHandler.js +58 -43
- package/src/sap/ui/export/ExportUtils.js +87 -100
- package/src/sap/ui/export/PortableDocument.js +60 -27
- package/src/sap/ui/export/Spreadsheet.js +10 -6
- package/src/sap/ui/export/SpreadsheetExport.js +2 -2
- package/src/sap/ui/export/fragments/SettingsDialog.fragment.xml +4 -4
- 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 +5 -1
- package/src/sap/ui/export/messagebundle_bg.properties +5 -1
- package/src/sap/ui/export/messagebundle_ca.properties +5 -1
- package/src/sap/ui/export/messagebundle_cs.properties +5 -1
- package/src/sap/ui/export/messagebundle_cy.properties +5 -1
- package/src/sap/ui/export/messagebundle_da.properties +5 -1
- package/src/sap/ui/export/messagebundle_de.properties +5 -1
- package/src/sap/ui/export/messagebundle_el.properties +5 -1
- package/src/sap/ui/export/messagebundle_en.properties +5 -1
- package/src/sap/ui/export/messagebundle_en_GB.properties +5 -1
- package/src/sap/ui/export/messagebundle_en_US_sappsd.properties +4 -0
- package/src/sap/ui/export/messagebundle_en_US_saprigi.properties +4 -0
- package/src/sap/ui/export/messagebundle_en_US_saptrc.properties +4 -0
- 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 +5 -1
- package/src/sap/ui/export/messagebundle_fr.properties +5 -1
- package/src/sap/ui/export/messagebundle_fr_CA.properties +7 -3
- package/src/sap/ui/export/messagebundle_hi.properties +5 -1
- package/src/sap/ui/export/messagebundle_hr.properties +4 -0
- package/src/sap/ui/export/messagebundle_hu.properties +5 -1
- package/src/sap/ui/export/messagebundle_id.properties +5 -1
- package/src/sap/ui/export/messagebundle_it.properties +5 -1
- package/src/sap/ui/export/messagebundle_iw.properties +4 -0
- package/src/sap/ui/export/messagebundle_ja.properties +5 -1
- package/src/sap/ui/export/messagebundle_kk.properties +5 -1
- 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 +5 -1
- package/src/sap/ui/export/messagebundle_ms.properties +5 -1
- package/src/sap/ui/export/messagebundle_nl.properties +5 -1
- package/src/sap/ui/export/messagebundle_no.properties +5 -1
- package/src/sap/ui/export/messagebundle_pl.properties +5 -1
- package/src/sap/ui/export/messagebundle_pt.properties +5 -1
- package/src/sap/ui/export/messagebundle_pt_PT.properties +5 -1
- package/src/sap/ui/export/messagebundle_ro.properties +5 -1
- package/src/sap/ui/export/messagebundle_ru.properties +4 -0
- package/src/sap/ui/export/messagebundle_sh.properties +5 -1
- package/src/sap/ui/export/messagebundle_sk.properties +5 -1
- package/src/sap/ui/export/messagebundle_sl.properties +5 -1
- package/src/sap/ui/export/messagebundle_sv.properties +5 -1
- package/src/sap/ui/export/messagebundle_th.properties +5 -1
- package/src/sap/ui/export/messagebundle_tr.properties +5 -1
- package/src/sap/ui/export/messagebundle_uk.properties +5 -1
- package/src/sap/ui/export/messagebundle_vi.properties +5 -1
- package/src/sap/ui/export/messagebundle_zh_CN.properties +5 -1
- package/src/sap/ui/export/messagebundle_zh_TW.properties +5 -1
- 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 +208 -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.111.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.111.0
|
|
31
31
|
*
|
|
32
32
|
* @since 1.96
|
|
33
33
|
* @name sap.ui.export.ExportBase
|
|
@@ -36,9 +36,11 @@ sap.ui.define([
|
|
|
36
36
|
*/
|
|
37
37
|
var ExportBase = EventProvider.extend('sap.ui.export.ExportBase', {
|
|
38
38
|
|
|
39
|
-
constructor: function(mSettings) {
|
|
39
|
+
constructor: function(mSettings, mCapabilities) {
|
|
40
40
|
EventProvider.call(this, mSettings);
|
|
41
41
|
|
|
42
|
+
this._mCapabilities = mCapabilities || {};
|
|
43
|
+
|
|
42
44
|
/* Default settings */
|
|
43
45
|
this._mSettings = {
|
|
44
46
|
fileName: 'Export'
|
|
@@ -121,6 +123,8 @@ sap.ui.define([
|
|
|
121
123
|
EventProvider.prototype.destroy.apply(this, arguments);
|
|
122
124
|
|
|
123
125
|
this.cancel();
|
|
126
|
+
this._mSettings = null;
|
|
127
|
+
this._mCapabilities = null;
|
|
124
128
|
this.bIsDestroyed = true;
|
|
125
129
|
};
|
|
126
130
|
|
|
@@ -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.111.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
|
*/
|
|
@@ -57,8 +56,9 @@ sap.ui.define(['./library', './ExportUtils', './ExportDialog', 'sap/m/MessageToa
|
|
|
57
56
|
* @param {sap.ui.base.Event} oEvent
|
|
58
57
|
* @param {sap.ui.base.EventProvider} oEvent.getSource
|
|
59
58
|
* @param {object} oEvent.getParameters
|
|
60
|
-
* @param {object} oEvent.
|
|
61
|
-
* @param {object} oEvent.
|
|
59
|
+
* @param {object} oEvent.getParameters.exportSettings Contains export-related configuration
|
|
60
|
+
* @param {object} oEvent.getParameters.userExportSettings User specific settings from the "Export As" dialog
|
|
61
|
+
* @param {sap.ui.export.util.Filter[]} oEvent.getParameters.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
|
|
@@ -248,18 +244,63 @@ sap.ui.define(['./library', './ExportUtils', './ExportDialog', 'sap/m/MessageToa
|
|
|
248
244
|
|
|
249
245
|
return Promise.all([
|
|
250
246
|
ExportUtils.getResourceBundle(),
|
|
251
|
-
ExportUtils.getExportInstance(mExportSettings)
|
|
247
|
+
ExportUtils.getExportInstance(mExportSettings, this._mCapabilities)
|
|
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.111.0
|
|
136
137
|
*
|
|
137
138
|
* @since 1.59
|
|
138
139
|
* @name sap.ui.export.ExportUtils
|
|
@@ -235,10 +236,13 @@ sap.ui.define([
|
|
|
235
236
|
if (typeof bRemoteDestination === 'object') {
|
|
236
237
|
fnCallback = oOpener;
|
|
237
238
|
oOpener = bRemoteDestination;
|
|
239
|
+
bRemoteDestination = undefined;
|
|
238
240
|
} else if (typeof bRemoteDestination === 'function') {
|
|
239
241
|
fnCallback = bRemoteDestination;
|
|
242
|
+
bRemoteDestination = undefined;
|
|
240
243
|
} else if (typeof oOpener === 'function') {
|
|
241
244
|
fnCallback = oOpener;
|
|
245
|
+
oOpener = null;
|
|
242
246
|
}
|
|
243
247
|
|
|
244
248
|
oResourceBundlePromise.then(function (oResourceBundle) {
|
|
@@ -366,20 +370,6 @@ sap.ui.define([
|
|
|
366
370
|
});
|
|
367
371
|
},
|
|
368
372
|
|
|
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
373
|
/**
|
|
384
374
|
* Combines the filter operator with the value and
|
|
385
375
|
* creates a textual representation.
|
|
@@ -391,21 +381,27 @@ sap.ui.define([
|
|
|
391
381
|
_getReadableFilterValue: function(oFilter) {
|
|
392
382
|
switch (oFilter.op || oFilter.name) {
|
|
393
383
|
case '==':
|
|
394
|
-
return '=' + Utils._getFormattedFilterValue(oFilter.right.value);
|
|
395
384
|
case '>':
|
|
396
385
|
case '<':
|
|
397
386
|
case '!=':
|
|
398
387
|
case '<=':
|
|
399
388
|
case '>=':
|
|
400
|
-
return
|
|
389
|
+
return {
|
|
390
|
+
operator: oFilter.op || oFilter.name,
|
|
391
|
+
value: oFilter.right.value
|
|
392
|
+
};
|
|
401
393
|
case 'between':
|
|
402
|
-
return
|
|
394
|
+
return {
|
|
395
|
+
operator: oFilter.op || oFilter.name,
|
|
396
|
+
value: [oFilter.args[1].value, oFilter.args[2].value]
|
|
397
|
+
};
|
|
403
398
|
case 'contains':
|
|
404
|
-
return '*' + oFilter.args[1].value + '*';
|
|
405
399
|
case 'endswith':
|
|
406
|
-
return '*' + oFilter.args[1].value;
|
|
407
400
|
case 'startswith':
|
|
408
|
-
return
|
|
401
|
+
return {
|
|
402
|
+
operator: oFilter.op || oFilter.name,
|
|
403
|
+
value: oFilter.args[1].value
|
|
404
|
+
};
|
|
409
405
|
default:
|
|
410
406
|
throw Error('getReadableFilter');
|
|
411
407
|
}
|
|
@@ -483,10 +479,14 @@ sap.ui.define([
|
|
|
483
479
|
{
|
|
484
480
|
key: sProperty,
|
|
485
481
|
value: aFilters.reduce(function(acc, item) {
|
|
486
|
-
|
|
482
|
+
if (Array.isArray(item.value)) {
|
|
483
|
+
return acc.concat(item.value);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
acc.push(item.value);
|
|
487
487
|
|
|
488
|
-
return acc
|
|
489
|
-
},
|
|
488
|
+
return acc;
|
|
489
|
+
}, [])
|
|
490
490
|
}
|
|
491
491
|
];
|
|
492
492
|
}
|
|
@@ -531,7 +531,10 @@ sap.ui.define([
|
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
result = Utils._parseFilter(oUnaryFilter.arg);
|
|
534
|
-
|
|
534
|
+
|
|
535
|
+
if (oUnaryFilter.op === '!' && result[0].value) {
|
|
536
|
+
result[0].value.exclude = true;
|
|
537
|
+
}
|
|
535
538
|
|
|
536
539
|
return result;
|
|
537
540
|
},
|
|
@@ -556,85 +559,68 @@ sap.ui.define([
|
|
|
556
559
|
},
|
|
557
560
|
|
|
558
561
|
/**
|
|
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
|
|
562
|
+
* This function has been deprecated and might be removed in future releases.
|
|
566
563
|
*
|
|
567
564
|
* @returns {Promise}
|
|
568
565
|
* Promise, which resolves with an object containing a name
|
|
569
566
|
* property and items array with key value pairs which can be
|
|
570
567
|
* attached to the metainfo in the sap.ui.export.Spreadsheet
|
|
571
568
|
* configuration
|
|
569
|
+
* @deprecated
|
|
572
570
|
*
|
|
573
571
|
* @ui5-restricted sap.ui.comp.smarttable.SmartTable
|
|
574
572
|
*/
|
|
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
|
-
}
|
|
573
|
+
parseFilterConfiguration: function() {
|
|
574
|
+
Log.error('Function is deprecated and must not be used anymore');
|
|
604
575
|
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
}
|
|
576
|
+
return oResourceBundlePromise.then(function(oResourceBundle) {
|
|
577
|
+
return {
|
|
578
|
+
name: oResourceBundle.getText('FILTER_HEADER'),
|
|
579
|
+
items: []
|
|
580
|
+
};
|
|
581
|
+
});
|
|
582
|
+
},
|
|
613
583
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
584
|
+
/**
|
|
585
|
+
* Accepts a binding of type sap.ui.model.ListBinding or
|
|
586
|
+
* sap.ui.model.TreeBinding and extracts the filter
|
|
587
|
+
* configuration in a format that can be attached to
|
|
588
|
+
* a sap.ui.export.Spreadsheet instance.
|
|
589
|
+
*
|
|
590
|
+
* @param {sap.ui.model.ListBinding | sap.ui.model.TreeBinding} oBinding ListBinding or TreeBinding instance
|
|
591
|
+
* @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.
|
|
592
|
+
* @private
|
|
593
|
+
*/
|
|
594
|
+
getFilters: function(oBinding) {
|
|
595
|
+
var aFilters, oFilterInfo;
|
|
617
596
|
|
|
618
|
-
|
|
619
|
-
});
|
|
597
|
+
aFilters = [];
|
|
620
598
|
|
|
621
|
-
|
|
599
|
+
if (!oBinding || !oBinding.isA(['sap.ui.model.ListBinding', 'sap.ui.model.TreeBinding'])) {
|
|
600
|
+
Log.error('A ListBinding or TreeBinding is required for parsing the filter settings');
|
|
601
|
+
return aFilters;
|
|
602
|
+
}
|
|
622
603
|
|
|
623
|
-
|
|
604
|
+
oFilterInfo = oBinding.getFilterInfo();
|
|
605
|
+
if (oFilterInfo) {
|
|
606
|
+
Utils._parseFilter(oFilterInfo).forEach(function(oEntry) {
|
|
607
|
+
aFilters.push(new Filter(oEntry.key, oEntry.value));
|
|
624
608
|
});
|
|
625
|
-
}
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
return aFilters;
|
|
626
612
|
},
|
|
627
613
|
|
|
628
614
|
/**
|
|
629
615
|
* Promise, which resolves with an array containing username and
|
|
630
616
|
* time stamp at which the document was created
|
|
631
617
|
*
|
|
632
|
-
* @returns {Promise} Resolves when the technical information has been obtained
|
|
618
|
+
* @returns {Promise<object>} Resolves when the technical information has been obtained
|
|
633
619
|
*/
|
|
634
620
|
parseTechnicalConfiguration: function() {
|
|
635
|
-
var
|
|
621
|
+
var oUserConfig, oBundle, oUshellContainer;
|
|
636
622
|
|
|
637
|
-
|
|
623
|
+
oUserConfig = {};
|
|
638
624
|
|
|
639
625
|
/* sap/ushell/Container is not available through module loader */
|
|
640
626
|
oUshellContainer = sap.ushell && sap.ushell.Container;
|
|
@@ -642,28 +628,26 @@ sap.ui.define([
|
|
|
642
628
|
return Utils.getResourceBundle().then(function(oResourceBundle) {
|
|
643
629
|
oBundle = oResourceBundle;
|
|
644
630
|
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
]
|
|
653
|
-
});
|
|
631
|
+
oUserConfig.name = oBundle.getText('TECHNICAL_INFORMATION');
|
|
632
|
+
oUserConfig.items = [
|
|
633
|
+
{
|
|
634
|
+
key: oBundle.getText('CREATED_TIME'),
|
|
635
|
+
value: DateFormat.getDateTimeWithTimezoneInstance().format(new Date())
|
|
636
|
+
}
|
|
637
|
+
];
|
|
654
638
|
}).then(function() {
|
|
655
639
|
return oUshellContainer && typeof oUshellContainer.getServiceAsync === 'function' ?
|
|
656
640
|
oUshellContainer.getServiceAsync('UserInfo') : undefined;
|
|
657
641
|
}).then(function (oUserInfo) {
|
|
658
642
|
/* Add entry if UserInfo contains a proper name */
|
|
659
643
|
if (oUserInfo && oUserInfo.getFullName()) {
|
|
660
|
-
|
|
644
|
+
oUserConfig.items.unshift({
|
|
661
645
|
key: oBundle.getText('USER_NAME'),
|
|
662
646
|
value: oUserInfo.getFullName()
|
|
663
647
|
});
|
|
664
648
|
}
|
|
665
649
|
|
|
666
|
-
return
|
|
650
|
+
return oUserConfig;
|
|
667
651
|
});
|
|
668
652
|
},
|
|
669
653
|
|
|
@@ -1004,14 +988,14 @@ sap.ui.define([
|
|
|
1004
988
|
if (oColumn.type === EdmType.DateTime) {
|
|
1005
989
|
|
|
1006
990
|
/*
|
|
1007
|
-
* Apply
|
|
1008
|
-
* in case no timezone
|
|
991
|
+
* Apply user timezone or UTC as fixed timezone
|
|
992
|
+
* in case no timezone was provided. This also
|
|
1009
993
|
* serves as a fallback if timezoneProperty
|
|
1010
994
|
* is defined but the Line Item has no value
|
|
1011
995
|
* for the referenced property name.
|
|
1012
996
|
*/
|
|
1013
997
|
if (!oColumn.timezone) {
|
|
1014
|
-
oColumn.timezone = oColumn.utc === false ?
|
|
998
|
+
oColumn.timezone = oColumn.utc === false ? Core.getConfiguration().getTimezone() : 'UTC';
|
|
1015
999
|
}
|
|
1016
1000
|
|
|
1017
1001
|
/* Remove obviously incorrect timezoneProperty settings */
|
|
@@ -1049,6 +1033,7 @@ sap.ui.define([
|
|
|
1049
1033
|
|
|
1050
1034
|
Utils._validateWorkbookContext(mWorkbook.context);
|
|
1051
1035
|
Utils._validateString(mWorkbook, 'hierarchyLevel');
|
|
1036
|
+
Utils._validateString(mWorkbook, 'drillState');
|
|
1052
1037
|
},
|
|
1053
1038
|
|
|
1054
1039
|
/**
|
|
@@ -1121,7 +1106,7 @@ sap.ui.define([
|
|
|
1121
1106
|
*
|
|
1122
1107
|
* @param {object} oContext Context object
|
|
1123
1108
|
* @param {string} [oContext.application] Name of the application (default: "SAP UI5")
|
|
1124
|
-
* @param {string} [oContext.version] Application version (default: "1.
|
|
1109
|
+
* @param {string} [oContext.version] Application version (default: "1.111.0")
|
|
1125
1110
|
* @param {string} [oContext.title] Title that will be written to the file (NOT the filename)
|
|
1126
1111
|
* @param {string} [oContext.modifiedBy] Optional user context that will be written to the file
|
|
1127
1112
|
* @param {string} [oContext.sheetName] Name of the data sheet - Maximum length of 31 characters
|
|
@@ -1267,11 +1252,13 @@ sap.ui.define([
|
|
|
1267
1252
|
* no specific FileType is defined in the export settings.
|
|
1268
1253
|
*
|
|
1269
1254
|
* @param {object} mSettings Export configuration with optional FileType
|
|
1270
|
-
* @
|
|
1255
|
+
* @param {object} [mCapabilities] Export Capabilities for all supported types
|
|
1256
|
+
* @returns {Promise<sap.ui.export.ExportBase>} A Promise that gets resolved with the requested instance
|
|
1271
1257
|
*/
|
|
1272
|
-
getExportInstance: function(mSettings) {
|
|
1258
|
+
getExportInstance: function(mSettings, mCapabilities) {
|
|
1273
1259
|
var sClassName, sFileType;
|
|
1274
1260
|
|
|
1261
|
+
mCapabilities = mCapabilities ? mCapabilities : {};
|
|
1275
1262
|
sFileType = typeof mSettings.fileType === 'string' ? mSettings.fileType.toUpperCase() : mSettings.fileType;
|
|
1276
1263
|
|
|
1277
1264
|
switch (sFileType) {
|
|
@@ -1284,7 +1271,7 @@ sap.ui.define([
|
|
|
1284
1271
|
|
|
1285
1272
|
return new Promise(function(fnResolve) {
|
|
1286
1273
|
sap.ui.require([sClassName], function(ExportClass) {
|
|
1287
|
-
fnResolve(new ExportClass(mSettings));
|
|
1274
|
+
fnResolve(new ExportClass(mSettings, mCapabilities[sFileType]));
|
|
1288
1275
|
});
|
|
1289
1276
|
});
|
|
1290
1277
|
},
|