@sapui5/sap.ui.export 1.117.2 → 1.119.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/sap/ui/export/.library +1 -1
- package/src/sap/ui/export/ExportBase.js +1 -1
- package/src/sap/ui/export/ExportHandler.js +1 -1
- package/src/sap/ui/export/ExportUtils.js +42 -11
- package/src/sap/ui/export/PortableDocument.js +22 -7
- package/src/sap/ui/export/Spreadsheet.js +46 -51
- 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 +11 -3
- package/src/sap/ui/export/messagebundle_el.properties +1 -1
- package/src/sap/ui/export/messagebundle_hr.properties +1 -1
- package/src/sap/ui/export/messagebundle_ja.properties +1 -1
- package/src/sap/ui/export/messagebundle_tr.properties +1 -1
- package/src/sap/ui/export/provider/DataProviderBase.js +1 -1
- package/src/sap/ui/export/util/Filter.js +1 -1
- package/src/sap/ui/export/util/PDFCapabilities.js +10 -9
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.119.0
|
|
31
31
|
*
|
|
32
32
|
* @since 1.96
|
|
33
33
|
* @alias sap.ui.export.ExportBase
|
|
@@ -16,7 +16,7 @@ sap.ui.define(['./library', './ExportUtils', './ExportDialog', './util/PDFCapabi
|
|
|
16
16
|
* @class The <code>sap.ui.export.ExportHandler</code> class allows you to export table data from an SAPUI5 application.
|
|
17
17
|
*
|
|
18
18
|
* @author SAP SE
|
|
19
|
-
* @version 1.
|
|
19
|
+
* @version 1.119.0
|
|
20
20
|
*
|
|
21
21
|
* @since 1.102
|
|
22
22
|
* @alias sap.ui.export.ExportHandler
|
|
@@ -4,19 +4,20 @@
|
|
|
4
4
|
*/
|
|
5
5
|
sap.ui.define([
|
|
6
6
|
'./library',
|
|
7
|
+
'./util/Filter',
|
|
7
8
|
'sap/base/Log',
|
|
8
9
|
'sap/ui/core/Core',
|
|
9
10
|
'sap/ui/core/Fragment',
|
|
11
|
+
'sap/ui/core/format/DateFormat',
|
|
10
12
|
'sap/ui/core/library',
|
|
11
13
|
'sap/ui/core/syncStyleClass',
|
|
12
|
-
'sap/ui/
|
|
14
|
+
'sap/ui/core/LocaleData',
|
|
13
15
|
'sap/ui/model/json/JSONModel',
|
|
14
16
|
'sap/ui/model/resource/ResourceModel',
|
|
17
|
+
'sap/ui/performance/trace/FESRHelper',
|
|
15
18
|
'sap/ui/util/openWindow',
|
|
16
|
-
'sap/ui/VersionInfo'
|
|
17
|
-
|
|
18
|
-
"sap/ui/performance/trace/FESRHelper"
|
|
19
|
-
], function(library, Log, Core, Fragment, coreLibrary, syncStyleClass, Filter, JSONModel, ResourceModel, openWindow, VersionInfo, DateFormat, FESRHelper) {
|
|
19
|
+
'sap/ui/VersionInfo'
|
|
20
|
+
], function(library, Filter, Log, Core, Fragment, DateFormat, coreLibrary, syncStyleClass, LocaleData, JSONModel, ResourceModel, FESRHelper, openWindow, VersionInfo) {
|
|
20
21
|
'use strict';
|
|
21
22
|
|
|
22
23
|
// eslint-disable-next-line
|
|
@@ -134,7 +135,7 @@ sap.ui.define([
|
|
|
134
135
|
* @class Utilities related to export to enable reuse in integration scenarios (e.g. tables).
|
|
135
136
|
*
|
|
136
137
|
* @author SAP SE
|
|
137
|
-
* @version 1.
|
|
138
|
+
* @version 1.119.0
|
|
138
139
|
*
|
|
139
140
|
* @since 1.59
|
|
140
141
|
* @alias sap.ui.export.ExportUtils
|
|
@@ -758,7 +759,7 @@ sap.ui.define([
|
|
|
758
759
|
link = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');
|
|
759
760
|
downloadSupported = 'download' in link;
|
|
760
761
|
|
|
761
|
-
/* Try ObjectURL Chrome, Firefox, Opera, Android, Safari (
|
|
762
|
+
/* Try ObjectURL Chrome, Firefox, Opera, Android, Safari (MacOS 10.1, iOS 13) */
|
|
762
763
|
if (downloadSupported) {
|
|
763
764
|
fnSave = function(data, fileName) {
|
|
764
765
|
link.download = fileName;
|
|
@@ -767,7 +768,7 @@ sap.ui.define([
|
|
|
767
768
|
};
|
|
768
769
|
}
|
|
769
770
|
|
|
770
|
-
/* In case of iOS Safari, MacOS Safari */
|
|
771
|
+
/* In case of iOS Safari, MacOS Safari (legacy) */
|
|
771
772
|
if (typeof fnSave === 'undefined') {
|
|
772
773
|
fnSave = function(data) {
|
|
773
774
|
var reader = new FileReader();
|
|
@@ -1004,10 +1005,23 @@ sap.ui.define([
|
|
|
1004
1005
|
sWidth = iWidth.toLowerCase();
|
|
1005
1006
|
iWidth = parseFloat(sWidth);
|
|
1006
1007
|
|
|
1008
|
+
/*
|
|
1009
|
+
* We need to convert the column width (rem/px) into
|
|
1010
|
+
* export specific character amount. This calculation
|
|
1011
|
+
* is based on Office Open SpreadsheetML
|
|
1012
|
+
* (ISO/IEC 29500-1:2016) section 18.3.1.13
|
|
1013
|
+
*
|
|
1014
|
+
* The following fixed values are:
|
|
1015
|
+
* 16: Amount of pixels per rem
|
|
1016
|
+
* 5: Padding and grid pixels
|
|
1017
|
+
* 8: Maxium pixel width per character
|
|
1018
|
+
* 100: Formula specific constant
|
|
1019
|
+
* 0.5: Formula specific constant
|
|
1020
|
+
*/
|
|
1007
1021
|
if (sWidth.indexOf('em') > 0) {
|
|
1008
|
-
iWidth = iWidth *
|
|
1022
|
+
iWidth = Math.floor((((iWidth * 16) - 5) / 8 * 100) + 0.5) / 100;
|
|
1009
1023
|
} else if (sWidth.indexOf('px') > 0) {
|
|
1010
|
-
iWidth = iWidth / 8;
|
|
1024
|
+
iWidth = Math.floor(((iWidth - 5) / 8 * 100) + 0.5) / 100;
|
|
1011
1025
|
}
|
|
1012
1026
|
}
|
|
1013
1027
|
|
|
@@ -1200,7 +1214,7 @@ sap.ui.define([
|
|
|
1200
1214
|
*
|
|
1201
1215
|
* @param {object} oContext Context object
|
|
1202
1216
|
* @param {string} [oContext.application] Name of the application (default: "SAP UI5")
|
|
1203
|
-
* @param {string} [oContext.version] Application version (default: "1.
|
|
1217
|
+
* @param {string} [oContext.version] Application version (default: "1.119.0")
|
|
1204
1218
|
* @param {string} [oContext.title] Title that will be written to the file (NOT the filename)
|
|
1205
1219
|
* @param {string} [oContext.modifiedBy] Optional user context that will be written to the file
|
|
1206
1220
|
* @param {string} [oContext.sheetName] Name of the data sheet - Maximum length of 31 characters
|
|
@@ -1608,6 +1622,23 @@ sap.ui.define([
|
|
|
1608
1622
|
}
|
|
1609
1623
|
|
|
1610
1624
|
return oDefaultFormatSettings;
|
|
1625
|
+
},
|
|
1626
|
+
|
|
1627
|
+
/**
|
|
1628
|
+
* Returns a map of translated timezone texts where each key
|
|
1629
|
+
* represents a IANA timezone id. The translated name is
|
|
1630
|
+
* according to the current UI5 Locale.
|
|
1631
|
+
*
|
|
1632
|
+
* @returns {object} Map of timezone translations
|
|
1633
|
+
*
|
|
1634
|
+
* @static
|
|
1635
|
+
* @private
|
|
1636
|
+
*/
|
|
1637
|
+
getTimezoneTranslations: function() {
|
|
1638
|
+
const oLocale = Core.getConfiguration().getLocale();
|
|
1639
|
+
const oLocaleData = LocaleData.getInstance(oLocale);
|
|
1640
|
+
|
|
1641
|
+
return oLocaleData.getTimezoneTranslations();
|
|
1611
1642
|
}
|
|
1612
1643
|
};
|
|
1613
1644
|
|
|
@@ -15,13 +15,14 @@ sap.ui.define([
|
|
|
15
15
|
], function(Log, Core, ExportBase, ExportUtils, Library, ODataModel, ExportDialog, BusyDialog) {
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
const FileType = Library.FileType;
|
|
19
|
+
const EdmType = Library.EdmType;
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* @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.
|
|
22
23
|
*
|
|
23
24
|
* @author SAP SE
|
|
24
|
-
* @version 1.
|
|
25
|
+
* @version 1.119.0
|
|
25
26
|
*
|
|
26
27
|
* @since 1.96
|
|
27
28
|
* @alias sap.ui.export.PortableDocument
|
|
@@ -252,11 +253,25 @@ sap.ui.define([
|
|
|
252
253
|
|
|
253
254
|
return sProperty === sOtherProperty;
|
|
254
255
|
}) === iIndex;
|
|
255
|
-
}).forEach(
|
|
256
|
-
|
|
257
|
-
"Name": Array.isArray(
|
|
258
|
-
"Header":
|
|
259
|
-
}
|
|
256
|
+
}).forEach((oColumnSettings) => {
|
|
257
|
+
const oColumn = {
|
|
258
|
+
"Name": Array.isArray(oColumnSettings.property) ? oColumnSettings.property[0] : oColumnSettings.property,
|
|
259
|
+
"Header": oColumnSettings.label
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
if (this._mCapabilities.IANATimezoneFormat && oColumnSettings.type === EdmType.DateTime) {
|
|
263
|
+
oColumn.Format = {
|
|
264
|
+
DisplayFormat: mSettings.dataSource.version == 2 ? "IANATIMEST" : "IANA-Timestamp"
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
if (oColumnSettings.timezoneProperty) {
|
|
268
|
+
oColumn.Format.IANATimezoneProperty = oColumnSettings.timezoneProperty;
|
|
269
|
+
} else if (oColumnSettings.timezone) {
|
|
270
|
+
oColumn.Format.IANATimezone = oColumnSettings.timezone;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
oDocumentDescription.TableColumns.push(oColumn);
|
|
260
275
|
});
|
|
261
276
|
|
|
262
277
|
return oDocumentDescription;
|
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
sap.ui.define([
|
|
7
|
-
'
|
|
7
|
+
'./library',
|
|
8
|
+
'./ExportBase',
|
|
8
9
|
'./ExportDialog',
|
|
9
|
-
'
|
|
10
|
-
'
|
|
11
|
-
'sap/ui/export/SpreadsheetExport',
|
|
10
|
+
'./ExportUtils',
|
|
11
|
+
'./SpreadsheetExport',
|
|
12
12
|
'sap/base/Log',
|
|
13
|
-
'sap/ui/
|
|
14
|
-
'sap/ui/
|
|
13
|
+
'sap/ui/core/Core',
|
|
14
|
+
'sap/ui/Device'
|
|
15
15
|
],
|
|
16
|
-
function(
|
|
16
|
+
function(Library, ExportBase, ExportDialog, ExportUtils, SpreadsheetExport, Log, Core, Device) {
|
|
17
17
|
'use strict';
|
|
18
18
|
|
|
19
19
|
// eslint-disable-next-line
|
|
@@ -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.119.0")</li>
|
|
88
88
|
* <li><code>title</code> (string) - Title of the XLSX document (NOT the filename)</li>
|
|
89
89
|
* <li><code>modifiedBy</code> (string) - User context for the XLSX document</li>
|
|
90
90
|
* <li><code>sheetName</code> (string) - The label of the data sheet</li>
|
|
@@ -167,7 +167,7 @@ sap.ui.define([
|
|
|
167
167
|
* columns: aColumns,
|
|
168
168
|
* context: {
|
|
169
169
|
* application: 'Debug Test Application',
|
|
170
|
-
* version: '1.
|
|
170
|
+
* version: '1.119.0',
|
|
171
171
|
* title: 'Some random title',
|
|
172
172
|
* modifiedBy: 'John Doe',
|
|
173
173
|
* metaSheetName: 'Custom metadata',
|
|
@@ -279,7 +279,7 @@ sap.ui.define([
|
|
|
279
279
|
* @class The <code>sap.ui.export.Spreadsheet</code> class allows you to export table data from a UI5 application to a spreadsheet file.
|
|
280
280
|
*
|
|
281
281
|
* @author SAP SE
|
|
282
|
-
* @version 1.
|
|
282
|
+
* @version 1.119.0
|
|
283
283
|
*
|
|
284
284
|
* @since 1.50
|
|
285
285
|
* @alias sap.ui.export.Spreadsheet
|
|
@@ -305,7 +305,7 @@ sap.ui.define([
|
|
|
305
305
|
}
|
|
306
306
|
}.bind(this));
|
|
307
307
|
|
|
308
|
-
this.codeListsPromise = this.codeListsPromise instanceof Promise ? this.codeListsPromise : Promise.resolve();
|
|
308
|
+
this.codeListsPromise = this.codeListsPromise instanceof Promise ? this.codeListsPromise : Promise.resolve([null, null]);
|
|
309
309
|
}
|
|
310
310
|
});
|
|
311
311
|
|
|
@@ -333,13 +333,36 @@ sap.ui.define([
|
|
|
333
333
|
* @param {object} mParameters - Export parameters object
|
|
334
334
|
* @returns {Promise} Promise object
|
|
335
335
|
*
|
|
336
|
+
* @async
|
|
336
337
|
* @private
|
|
337
338
|
*/
|
|
338
|
-
Spreadsheet.prototype.setDefaultExportSettings = function(mParameters) {
|
|
339
|
-
var
|
|
339
|
+
Spreadsheet.prototype.setDefaultExportSettings = async function(mParameters) {
|
|
340
|
+
var mCurrencySettings, mUnitSettings, oWorkbookContext, sCurrencyCode;
|
|
341
|
+
|
|
342
|
+
const oResourceBundle = await ExportUtils.getResourceBundle();
|
|
343
|
+
|
|
344
|
+
/* Attach timezone customizing */
|
|
345
|
+
mParameters.customizing.timezone = ExportUtils.getTimezoneTranslations();
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Check if a document title and a sheet name have been defined in the 'context' settings.
|
|
349
|
+
* Otherwise use default resource bundle properties
|
|
350
|
+
*/
|
|
351
|
+
oWorkbookContext = mParameters.workbook.context;
|
|
352
|
+
|
|
353
|
+
if (!(oWorkbookContext instanceof Object)) {
|
|
354
|
+
oWorkbookContext = mParameters.workbook.context = {};
|
|
355
|
+
}
|
|
356
|
+
if (!oWorkbookContext.title) {
|
|
357
|
+
oWorkbookContext.title = oResourceBundle.getText('XLSX_DEFAULT_TITLE');
|
|
358
|
+
}
|
|
359
|
+
if (!oWorkbookContext.sheetName) {
|
|
360
|
+
oWorkbookContext.sheetName = oResourceBundle.getText('XLSX_DEFAULT_SHEETNAME');
|
|
361
|
+
}
|
|
340
362
|
|
|
341
|
-
/* Initialize currency customizing for
|
|
363
|
+
/* Initialize currency customizing for currencies and units of measure */
|
|
342
364
|
mCurrencySettings = mParameters.customizing.currency = {};
|
|
365
|
+
mUnitSettings = mParameters.customizing.unit = {};
|
|
343
366
|
|
|
344
367
|
/* Attach custom currency configuration */
|
|
345
368
|
var oCustomCurrencies = Core.getConfiguration().getFormatSettings().getCustomCurrencies();
|
|
@@ -350,45 +373,17 @@ sap.ui.define([
|
|
|
350
373
|
}
|
|
351
374
|
}
|
|
352
375
|
|
|
353
|
-
|
|
354
|
-
|
|
376
|
+
/* Attach CodeLists customizing */
|
|
377
|
+
let sUnitCode;
|
|
378
|
+
const [mCurrencyCodes, mUnitsOfMeasure] = await this.codeListsPromise;
|
|
355
379
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
mUnitSettings = mParameters.customizing.unit = {};
|
|
361
|
-
mCurrencyCodes = aCodeLists[0];
|
|
362
|
-
mUnitsOfMeasure = aCodeLists[1];
|
|
363
|
-
|
|
364
|
-
for (sUnitCode in mCurrencyCodes) {
|
|
365
|
-
addUnit(sUnitCode, mCurrencyCodes[sUnitCode], mCurrencySettings);
|
|
366
|
-
}
|
|
380
|
+
for (sUnitCode in mCurrencyCodes) {
|
|
381
|
+
addUnit(sUnitCode, mCurrencyCodes[sUnitCode], mCurrencySettings);
|
|
382
|
+
}
|
|
367
383
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
}).then(function() {
|
|
372
|
-
|
|
373
|
-
/* Async call to resource bundle */
|
|
374
|
-
return Core.getLibraryResourceBundle('sap.ui.export', true);
|
|
375
|
-
}).then(function(oResourceBundle) {
|
|
376
|
-
var oWorkbookContext = mParameters.workbook.context;
|
|
377
|
-
|
|
378
|
-
/**
|
|
379
|
-
* Check if a document title and a sheet name have been defined in the 'context' settings.
|
|
380
|
-
* Otherwise use default resource bundle properties
|
|
381
|
-
*/
|
|
382
|
-
if (!(oWorkbookContext instanceof Object)) {
|
|
383
|
-
oWorkbookContext = mParameters.workbook.context = {};
|
|
384
|
-
}
|
|
385
|
-
if (!oWorkbookContext.title) {
|
|
386
|
-
oWorkbookContext.title = oResourceBundle.getText('XLSX_DEFAULT_TITLE');
|
|
387
|
-
}
|
|
388
|
-
if (!oWorkbookContext.sheetName) {
|
|
389
|
-
oWorkbookContext.sheetName = oResourceBundle.getText('XLSX_DEFAULT_SHEETNAME');
|
|
390
|
-
}
|
|
391
|
-
});
|
|
384
|
+
for (sUnitCode in mUnitsOfMeasure) {
|
|
385
|
+
addUnit(sUnitCode, mUnitsOfMeasure[sUnitCode], mUnitSettings);
|
|
386
|
+
}
|
|
392
387
|
};
|
|
393
388
|
|
|
394
389
|
/**
|
|
@@ -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.119.0
|
|
25
25
|
*
|
|
26
26
|
* @alias sap.ui.export.SpreadsheetExport
|
|
27
27
|
* @private
|