@sapui5/sap.ui.export 1.97.1 → 1.99.1

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.
Files changed (75) hide show
  1. package/package.json +1 -1
  2. package/src/sap/ui/export/.library +2 -2
  3. package/src/sap/ui/export/ExportBase.js +2 -2
  4. package/src/sap/ui/export/ExportDialog.js +1 -1
  5. package/src/sap/ui/export/ExportUtils.js +170 -147
  6. package/src/sap/ui/export/PortableDocument.js +64 -27
  7. package/src/sap/ui/export/Spreadsheet.js +4 -4
  8. package/src/sap/ui/export/SpreadsheetExport.js +2 -2
  9. package/src/sap/ui/export/fragments/SettingsDialog.fragment.xml +49 -0
  10. package/src/sap/ui/export/js/XLSXBuilder.js.map +1 -1
  11. package/src/sap/ui/export/js/libs/JSZip3.js +3 -3
  12. package/src/sap/ui/export/library.js +3 -3
  13. package/src/sap/ui/export/messagebundle.properties +41 -2
  14. package/src/sap/ui/export/messagebundle_ar.properties +27 -1
  15. package/src/sap/ui/export/messagebundle_bg.properties +27 -1
  16. package/src/sap/ui/export/messagebundle_ca.properties +27 -1
  17. package/src/sap/ui/export/messagebundle_cs.properties +27 -1
  18. package/src/sap/ui/export/messagebundle_cy.properties +27 -1
  19. package/src/sap/ui/export/messagebundle_da.properties +27 -1
  20. package/src/sap/ui/export/messagebundle_de.properties +27 -1
  21. package/src/sap/ui/export/messagebundle_el.properties +27 -1
  22. package/src/sap/ui/export/messagebundle_en.properties +27 -1
  23. package/src/sap/ui/export/messagebundle_en_GB.properties +27 -1
  24. package/src/sap/ui/export/messagebundle_en_US_sappsd.properties +28 -2
  25. package/src/sap/ui/export/messagebundle_en_US_saprigi.properties +31 -3
  26. package/src/sap/ui/export/messagebundle_en_US_saptrc.properties +28 -2
  27. package/src/sap/ui/export/messagebundle_es.properties +27 -1
  28. package/src/sap/ui/export/messagebundle_es_MX.properties +27 -1
  29. package/src/sap/ui/export/messagebundle_et.properties +27 -1
  30. package/src/sap/ui/export/messagebundle_fi.properties +27 -1
  31. package/src/sap/ui/export/messagebundle_fr.properties +27 -1
  32. package/src/sap/ui/export/messagebundle_fr_CA.properties +27 -1
  33. package/src/sap/ui/export/messagebundle_hi.properties +27 -1
  34. package/src/sap/ui/export/messagebundle_hr.properties +27 -1
  35. package/src/sap/ui/export/messagebundle_hu.properties +27 -1
  36. package/src/sap/ui/export/messagebundle_id.properties +27 -1
  37. package/src/sap/ui/export/messagebundle_it.properties +27 -1
  38. package/src/sap/ui/export/messagebundle_iw.properties +27 -1
  39. package/src/sap/ui/export/messagebundle_ja.properties +27 -1
  40. package/src/sap/ui/export/messagebundle_kk.properties +27 -1
  41. package/src/sap/ui/export/messagebundle_ko.properties +27 -1
  42. package/src/sap/ui/export/messagebundle_lt.properties +27 -1
  43. package/src/sap/ui/export/messagebundle_lv.properties +27 -1
  44. package/src/sap/ui/export/messagebundle_ms.properties +28 -2
  45. package/src/sap/ui/export/messagebundle_nl.properties +27 -1
  46. package/src/sap/ui/export/messagebundle_no.properties +27 -1
  47. package/src/sap/ui/export/messagebundle_pl.properties +27 -1
  48. package/src/sap/ui/export/messagebundle_pt.properties +27 -1
  49. package/src/sap/ui/export/messagebundle_pt_PT.properties +27 -1
  50. package/src/sap/ui/export/messagebundle_ro.properties +27 -1
  51. package/src/sap/ui/export/messagebundle_ru.properties +27 -1
  52. package/src/sap/ui/export/messagebundle_sh.properties +27 -1
  53. package/src/sap/ui/export/messagebundle_sk.properties +27 -1
  54. package/src/sap/ui/export/messagebundle_sl.properties +27 -1
  55. package/src/sap/ui/export/messagebundle_sv.properties +27 -1
  56. package/src/sap/ui/export/messagebundle_th.properties +27 -1
  57. package/src/sap/ui/export/messagebundle_tr.properties +27 -1
  58. package/src/sap/ui/export/messagebundle_uk.properties +27 -1
  59. package/src/sap/ui/export/messagebundle_vi.properties +27 -1
  60. package/src/sap/ui/export/messagebundle_zh_CN.properties +27 -1
  61. package/src/sap/ui/export/messagebundle_zh_TW.properties +27 -1
  62. package/src/sap/ui/export/provider/DataProviderBase.js +2 -2
  63. package/src/sap/ui/export/themes/base/ExportUtils.less +1 -1
  64. package/src/sap/ui/export/themes/base/library.source.less +1 -1
  65. package/src/sap/ui/export/themes/sap_belize/library.source.less +1 -1
  66. package/src/sap/ui/export/themes/sap_belize_hcb/library.source.less +1 -1
  67. package/src/sap/ui/export/themes/sap_belize_hcw/library.source.less +1 -1
  68. package/src/sap/ui/export/themes/sap_belize_plus/library.source.less +1 -1
  69. package/src/sap/ui/export/themes/sap_bluecrystal/library.source.less +1 -1
  70. package/src/sap/ui/export/themes/sap_fiori_3/library.source.less +1 -1
  71. package/src/sap/ui/export/themes/sap_fiori_3_dark/library.source.less +1 -1
  72. package/src/sap/ui/export/themes/sap_fiori_3_hcb/library.source.less +1 -1
  73. package/src/sap/ui/export/themes/sap_fiori_3_hcw/library.source.less +1 -1
  74. package/src/sap/ui/export/themes/sap_hcb/library.source.less +1 -1
  75. package/src/sap/ui/export/themes/sap_horizon/library.source.less +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapui5/sap.ui.export",
3
- "version": "1.97.1",
3
+ "version": "1.99.1",
4
4
  "description": "SAPUI5 Library sap.ui.export",
5
5
  "homepage": "https://sap.github.io/ui5-tooling/pages/SAPUI5/",
6
6
  "author": "SAP SE (https://www.sap.com)",
@@ -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-2021 SAP SE. All rights reserved.</copyright>
8
- <version>1.97.1</version>
7
+ * (c) Copyright 2009-2022 SAP SE. All rights reserved.</copyright>
8
+ <version>1.99.1</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-2021 SAP SE. All rights reserved.
3
+ * (c) Copyright 2009-2022 SAP SE. All rights reserved.
4
4
  */
5
5
 
6
6
  sap.ui.define([
@@ -15,7 +15,7 @@ sap.ui.define([
15
15
  * @constructor The <code>sap.ui.export.ExportBase</code> class allows you to export table data from a UI5 application to a Portable Document Format (*.PDF) file.
16
16
  *
17
17
  * @author SAP SE
18
- * @version 1.97.1
18
+ * @version 1.99.1
19
19
  *
20
20
  * @since 1.96
21
21
  * @name sap.ui.export.ExportBase
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * SAPUI5
3
- * (c) Copyright 2009-2021 SAP SE. All rights reserved.
3
+ * (c) Copyright 2009-2022 SAP SE. All rights reserved.
4
4
  */
5
5
 
6
6
  /**
@@ -1,35 +1,25 @@
1
1
  /*!
2
2
  * SAPUI5
3
- * (c) Copyright 2009-2021 SAP SE. All rights reserved.
3
+ * (c) Copyright 2009-2022 SAP SE. All rights reserved.
4
4
  */
5
5
  sap.ui.define([
6
- 'sap/ui/core/library',
7
- 'sap/m/library',
8
6
  './library',
9
- 'sap/ui/core/Core',
10
7
  'sap/base/Log',
11
- 'sap/base/util/uid',
12
- 'sap/ui/core/Item',
8
+ 'sap/ui/core/Core',
9
+ 'sap/ui/core/Fragment',
10
+ 'sap/ui/core/library',
13
11
  'sap/ui/core/syncStyleClass',
14
12
  'sap/ui/model/json/JSONModel',
15
- 'sap/m/Button',
16
- 'sap/m/CheckBox',
17
- 'sap/m/Dialog',
18
- 'sap/m/Input',
19
- 'sap/m/Label',
20
- 'sap/m/Select',
21
- 'sap/m/Text',
22
- 'sap/m/VBox',
23
- 'sap/ui/VersionInfo',
24
- 'sap/ui/util/openWindow'
25
- ], function(coreLibrary, mLibrary, library, Core, Log, uid, Item, syncStyleClass, JSONModel, Button, CheckBox, Dialog, Input, Label, Select, Text, VBox, VersionInfo, openWindow) {
13
+ 'sap/ui/model/resource/ResourceModel',
14
+ 'sap/ui/util/openWindow',
15
+ 'sap/ui/VersionInfo'
16
+ ], function(library, Log, Core, Fragment, coreLibrary, syncStyleClass, JSONModel, ResourceModel, openWindow, VersionInfo) {
26
17
  'use strict';
27
18
 
28
19
  // eslint-disable-next-line
29
20
  /* global Blob, MouseEvent, FileReader, URL */
30
21
 
31
22
  // Shortcuts
32
- var ButtonType = mLibrary.ButtonType;
33
23
  var ValueState = coreLibrary.ValueState;
34
24
  var FileType = library.FileType;
35
25
  var EdmType = library.EdmType;
@@ -54,22 +44,36 @@ sap.ui.define([
54
44
  });
55
45
 
56
46
  /* Returns the Export Settings used by the User Settings Dialog */
57
- function getExportSettings(oCustomConfig, oResourceBundle, bDevMode) {
47
+ function getDefaultSettings(oCustomConfig, oResourceBundle, oExportCapabilities) {
58
48
  var sSelectedKey;
49
+ var aSupportedFormats = Object.keys(oExportCapabilities);
50
+
59
51
  var oDefaultConfig = {
60
52
  fileName: 'Standard',
61
- fileType: [
62
- {key: 'xlsx'}
63
- ],
53
+ fileType: [],
64
54
  selectedFileType: 'xlsx',
55
+ selectedPaperSize: 'DIN_A4',
56
+ selectedOrientation: 'LANDSCAPE',
65
57
  splitCells: false,
66
58
  includeFilterSettings: false,
67
- addDateTime: false
59
+ addDateTime: false,
60
+ doEnableAccessibility: false,
61
+ paperSize: [
62
+ {key: "DIN_A4", text: oResourceBundle.getText("PAPER_SIZE_A4")},
63
+ {key: "US_LETTER", text: oResourceBundle.getText("PAPER_SIZE_US_LETTER")}
64
+ ],
65
+ orientation: [
66
+ {key:"LANDSCAPE", text: oResourceBundle.getText("ORIENTATION_LAND")},
67
+ {key:"PORTRAIT", text: oResourceBundle.getText("ORIENTATION_PORT")}
68
+ ],
69
+ fontSize: 10,
70
+ signature: false,
71
+ signatureReason: ''
68
72
  };
69
73
 
70
- if (bDevMode) {
71
- oDefaultConfig.fileType.push({key: 'pdf'});
72
- }
74
+ aSupportedFormats.forEach(function(sFormat) {
75
+ oDefaultConfig.fileType.push({key: sFormat.toLowerCase()});
76
+ });
73
77
 
74
78
  var oExportConfig = Object.assign({}, oDefaultConfig, oCustomConfig || {});
75
79
 
@@ -90,11 +94,21 @@ sap.ui.define([
90
94
  return oExportConfig;
91
95
  }
92
96
 
97
+ function processExportSettings(oSettings) {
98
+ var oFinalSettings = {};
99
+
100
+ ["fileName", "selectedFileType", "selectedPaperSize", "selectedOrientation", "splitCells", "includeFilterSettings", "addDateTime", "doEnableAccessibility", "fontSize", "signature", "signatureReason"].forEach(function(sProperty) {
101
+ oFinalSettings[sProperty] = oSettings[sProperty];
102
+ });
103
+
104
+ return oFinalSettings;
105
+ }
106
+
93
107
  /**
94
108
  * Utilities related to export to enable reuse in integration scenarios (e.g. tables).
95
109
  *
96
110
  * @author SAP SE
97
- * @version 1.97.1
111
+ * @version 1.99.1
98
112
  *
99
113
  * @since 1.59
100
114
  * @name sap.ui.export.ExportUtils
@@ -154,138 +168,129 @@ sap.ui.define([
154
168
  *
155
169
  * @static
156
170
  */
157
- getExportSettingsViaDialog: function(mCustomConfig, oOpener, fnCallback, bDevMode) {
171
+ getExportSettingsViaDialog: function(mCustomConfig, oOpener, fnCallback, oExportCapabilities) {
158
172
  return new Promise(function (fnResolve, fnReject) {
159
173
  var oExportSettingsDialog;
160
174
 
161
175
  oResourceBundlePromise.then(function (oResourceBundle) {
162
-
163
176
  var oExportConfigModel = new JSONModel();
164
- oExportConfigModel.setData(getExportSettings(mCustomConfig, oResourceBundle, bDevMode));
165
-
166
- var sDialogId = uid();
167
-
168
- oExportSettingsDialog = new Dialog({
169
- id: sDialogId,
170
- title: oResourceBundle.getText('EXPORT_SETTINGS_TITLE'),
171
- horizontalScrolling: false,
172
- verticalScrolling: false,
173
- content: [
174
- //TBD: Maybe use a form here for ACC purposes
175
- new VBox({
176
- // changing the render type to Bare in order to render the colon by resuing the style classes from Form layout
177
- renderType: 'Bare',
178
- width: '100%',
179
- items: [
180
- //TBD: Hide controls (visible=false) when functionality is not yet implemented
181
- new Label({
182
- text: oResourceBundle.getText('FILE_NAME'),
183
- labelFor: sDialogId + '-fileName'
184
- }),
185
- new Input({
186
- id: sDialogId + '-fileName',
187
- value: '{/fileName}',
188
- liveChange: function (oEvent) {
189
- // user input validation for file name
190
- var oInput = oEvent.getSource();
191
- var sFileName = oEvent.getParameter('value');
192
- var oRegEx = /[\\/:|?"*<>]/;
193
- var oExportBtn = Core.byId(sDialogId + '-export');
194
- var bValidate = oRegEx.test(sFileName);
195
- if (bValidate) {
196
- oInput.setValueState(ValueState.Error);
197
- oInput.setValueStateText(oResourceBundle.getText('FILENAME_ERROR'));
198
- } else if (sFileName.length > 100) {
199
- oInput.setValueState(ValueState.Warning);
200
- oInput.setValueStateText(oResourceBundle.getText('FILENAME_WARNING'));
201
- } else {
202
- oInput.setValueState(ValueState.None);
203
- oInput.setValueStateText(null);
204
- }
205
- oExportBtn.setEnabled(!bValidate);
206
- }
207
- }).addStyleClass('sapUiTinyMarginBottom'),
208
- new Label({
209
- text: oResourceBundle.getText('SELECT_FORMAT'),
210
- labelFor: sDialogId + '-fileType',
211
- visible: !!bDevMode
212
- }),
213
- // sap.m.Select control disabled as there is only 1 option for now
214
- // control must be enabled when more file types are supported
215
- new Select({
216
- id: sDialogId + '-fileType',
217
- width: '100%',
218
- selectedKey: '{/selectedFileType}',
219
- items: {
220
- path: '/fileType',
221
- template: new Item({key: '{key}', text: '{text}'})
222
- },
223
- visible: !!bDevMode
224
- }),
225
- new CheckBox({
226
- id: sDialogId + '-splitCells',
227
- selected: '{/splitCells}',
228
- text: oResourceBundle.getText('SPLIT_CELLS')
229
- }),
230
- new CheckBox({
231
- id: sDialogId + '-includeFilterSettings',
232
- selected: '{/includeFilterSettings}',
233
- text: oResourceBundle.getText('INCLUDE_FILTER_SETTINGS')
234
- }),
235
- new CheckBox({
236
- id: sDialogId + '-addDateTime',
237
- selected: '{/addDateTime}',
238
- text: oResourceBundle.getText('ADD_DATE_TIME'),
239
- visible: false
240
- })
241
- ]
242
- // using the style class from Form layout to render colon after the label
243
- }).addStyleClass('sapUiExportSettingsLabel')
244
- ],
245
- endButton: new Button({
246
- id: sDialogId + '-cancel',
247
- text: oResourceBundle.getText('CANCEL_BUTTON'),
248
- press: function () {
177
+
178
+ oExportConfigModel.setData(getDefaultSettings(mCustomConfig, oResourceBundle, oExportCapabilities));
179
+
180
+ Fragment.load({
181
+ name: 'sap.ui.export.fragments.SettingsDialog',
182
+ type: 'XML',
183
+ controller: {
184
+ isPDF: function(sValue) {
185
+ return sValue === 'pdf';
186
+ },
187
+ isXLSX: function(sValue) {
188
+ return sValue === 'xlsx';
189
+ },
190
+ onCancel: function() {
249
191
  oExportSettingsDialog.close();
250
- }
251
- }),
252
- beginButton: new Button({
253
- id: sDialogId + '-export',
254
- text: oResourceBundle.getText('EXPORT_BUTTON'),
255
- type: ButtonType.Emphasized,
256
- press: function () {
192
+ },
193
+ onExport: function() {
257
194
  if (oExportSettingsDialog) {
258
195
  oExportSettingsDialog._bSuccess = true;
259
196
  oExportSettingsDialog.close();
260
- fnResolve(oExportConfigModel.getData());
197
+ fnResolve(processExportSettings(oExportConfigModel.getData()));
261
198
  }
199
+ },
200
+
201
+ /**
202
+ * User input validation for file name
203
+ *
204
+ * @param {sap.ui.base.Event} oEvent LiveChange event of the Input control
205
+ */
206
+ onFileNameChange: function(oEvent) {
207
+ var oInput = oEvent.getSource();
208
+ var sFileName = oEvent.getParameter('value');
209
+ var oRegEx = /[\\/:|?"*<>]/;
210
+ var oExportBtn = Core.byId('exportSettingsDialog-exportButton');
211
+ var bValidate = oRegEx.test(sFileName);
212
+ if (bValidate) {
213
+ oInput.setValueState(ValueState.Error);
214
+ oInput.setValueStateText(oResourceBundle.getText('FILENAME_ERROR'));
215
+ } else if (sFileName.length > 100) {
216
+ oInput.setValueState(ValueState.Warning);
217
+ oInput.setValueStateText(oResourceBundle.getText('FILENAME_WARNING'));
218
+ } else {
219
+ oInput.setValueState(ValueState.None);
220
+ oInput.setValueStateText(null);
221
+ }
222
+ oExportBtn.setEnabled(!bValidate);
223
+ },
224
+ onFileTypeChange: function(oEvent) {
225
+ var oSelectedItem = oEvent.getParameter("selectedItem");
226
+ if (oSelectedItem && oSelectedItem.getKey() === "pdf") {
227
+ oExportConfigModel.setProperty("/splitCells", true);
228
+ } else {
229
+ Core.byId('exportSettingsDialog-signatureReason').setVisible(false);
230
+ Core.byId('exportSettingsDialog-signatureReasonLabel').setVisible(false);
231
+ }
232
+ },
233
+ onFontSizeChange: function(oEvent) {
234
+ // user input validation for font size
235
+ var oInput = oEvent.getSource();
236
+ var sFontValue = oEvent.getParameter('value');
237
+ var oRegEx = /[^\d]/g;
238
+ var oExportBtn = Core.byId('exportSettingsDialog-exportButton');
239
+ var bValidate = oRegEx.test(sFontValue);
240
+ if (bValidate) {
241
+ oInput.setValueState(ValueState.Error);
242
+ oInput.setValueStateText(oResourceBundle.getText('NUMBER_ERROR'));
243
+ } else {
244
+ oInput.setValueState(ValueState.None);
245
+ oInput.setValueStateText(null);
246
+ }
247
+ oExportBtn.setEnabled(!bValidate);
248
+ },
249
+ onAfterClose: function() {
250
+ if (!oExportSettingsDialog._bSuccess) {
251
+ // Handle Cancel after close when export button was not pressed
252
+ // because a close could also be triggered via Esc
253
+ fnReject(null);
254
+ }
255
+ oExportSettingsDialog.destroy();
256
+ oExportSettingsDialog = null;
262
257
  }
263
- }),
264
- afterClose: function () {
265
- if (!oExportSettingsDialog._bSuccess) {
266
- // Handle Cancel after close when export button was not pressed
267
- // because a close could also be triggered via Esc
268
- fnReject(null);
269
- }
270
- oExportSettingsDialog.destroy();
271
- oExportSettingsDialog = null;
272
258
  }
273
- });
274
- // using the style class from Form layout to render colon after the label
275
- oExportSettingsDialog.addStyleClass('sapUiContentPadding sapUiExportSettings');
276
- oExportSettingsDialog.setModel(oExportConfigModel);
277
- if (oOpener) {
278
- syncStyleClass('sapUiSizeCompact', oOpener, oExportSettingsDialog);
279
- }
280
- oExportSettingsDialog.open();
259
+ }).then(function(oDialog) {
260
+ oExportSettingsDialog = oDialog;
281
261
 
282
- if (fnCallback) {
283
- fnCallback(oExportSettingsDialog);
284
- }
262
+ oExportSettingsDialog.setModel(oExportConfigModel);
263
+ oExportSettingsDialog.setModel(new ResourceModel({
264
+ bundle: oResourceBundle
265
+ }), 'i18n');
266
+
267
+ if (oOpener) {
268
+ syncStyleClass('sapUiSizeCompact', oOpener, oExportSettingsDialog);
269
+ }
270
+ oExportSettingsDialog.open();
271
+
272
+ if (fnCallback) {
273
+ fnCallback(oExportSettingsDialog);
274
+ }
275
+ });
285
276
  });
286
277
  });
287
278
  },
288
279
 
280
+ /**
281
+ * Returns a different representation of the filter
282
+ * value in case the value is an instance of Date.
283
+ * The resutl of Date.prototype.toString function is
284
+ * too long and complex so we use the ISO-String
285
+ * instead.
286
+ *
287
+ * @param {*} vValue Filter value that might get converted
288
+ * @returns {*} The formatted value
289
+ */
290
+ _getFormattedFilterValue: function(vValue) {
291
+ return vValue instanceof Date ? vValue.toISOString() : vValue;
292
+ },
293
+
289
294
  /**
290
295
  * Combines the filter operator with the value and
291
296
  * creates a textual representation.
@@ -297,15 +302,15 @@ sap.ui.define([
297
302
  _getReadableFilterValue: function(oFilter) {
298
303
  switch (oFilter.op || oFilter.name) {
299
304
  case '==':
300
- return '=' + oFilter.right.value;
305
+ return '=' + Utils._getFormattedFilterValue(oFilter.right.value);
301
306
  case '>':
302
307
  case '<':
303
308
  case '!=':
304
309
  case '<=':
305
310
  case '>=':
306
- return oFilter.op + oFilter.right.value;
311
+ return oFilter.op + Utils._getFormattedFilterValue(oFilter.right.value);
307
312
  case 'between':
308
- return oFilter.args[1].value + '...' + oFilter.args[2].value;
313
+ return Utils._getFormattedFilterValue(oFilter.args[1].value) + '...' + Utils._getFormattedFilterValue(oFilter.args[2].value);
309
314
  case 'contains':
310
315
  return '*' + oFilter.args[1].value + '*';
311
316
  case 'endswith':
@@ -487,7 +492,25 @@ sap.ui.define([
487
492
  });
488
493
  }
489
494
 
495
+ /* Sort filter settings */
496
+ oFilterConfig.items.sort(function(firstElement, secondElement) {
497
+ var sFirstValue = firstElement.key.toLowerCase();
498
+ var sSecondValue = secondElement.key.toLowerCase();
499
+
500
+ if (sFirstValue > sSecondValue) {
501
+ return 1;
502
+ }
503
+
504
+ if (sFirstValue < sSecondValue) {
505
+ return -1;
506
+ }
507
+
508
+ return 0;
509
+ });
510
+
490
511
  fnResolve(oFilterConfig);
512
+
513
+ return oResourceBundle;
491
514
  });
492
515
  });
493
516
  },
@@ -654,7 +677,7 @@ sap.ui.define([
654
677
  throw new Error(CLASS_NAME + ': dataSource has not been specified');
655
678
  }
656
679
 
657
- mDataSource.type = mDataSource.type || 'odata';
680
+ mDataSource.type = typeof mDataSource.type === 'string' && mDataSource.type.toLowerCase() || 'odata';
658
681
 
659
682
  if (mDataSource.type === 'array' && !Array.isArray(mDataSource.data)) {
660
683
  Log.warning(CLASS_NAME + ': Defined type does not match the provided data');
@@ -911,7 +934,7 @@ sap.ui.define([
911
934
  *
912
935
  * @param {Object} oContext Context object
913
936
  * @param {string} [oContext.application] Name of the application (default: "SAP UI5")
914
- * @param {string} [oContext.version] Application version (default: "1.97.1")
937
+ * @param {string} [oContext.version] Application version (default: "1.99.1")
915
938
  * @param {string} [oContext.title] Title that will be written to the file (NOT the filename)
916
939
  * @param {string} [oContext.modifiedBy] Optional user context that will be written to the file
917
940
  * @param {string} [oContext.sheetName] Name of the data sheet - Maximum length of 31 characters
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * SAPUI5
3
- * (c) Copyright 2009-2021 SAP SE. All rights reserved.
3
+ * (c) Copyright 2009-2022 SAP SE. All rights reserved.
4
4
  */
5
5
 
6
6
  sap.ui.define([
@@ -16,7 +16,7 @@ sap.ui.define([
16
16
  * @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.
17
17
  *
18
18
  * @author SAP SE
19
- * @version 1.97.1
19
+ * @version 1.99.1
20
20
  *
21
21
  * @since 1.96
22
22
  * @name sap.ui.export.PortableDocument
@@ -27,6 +27,14 @@ sap.ui.define([
27
27
 
28
28
  constructor: function(mSettings) {
29
29
  ExportBase.call(this, mSettings);
30
+
31
+
32
+ /* Only apply supported properties */
33
+ ['paperSize', 'orientation', 'font', 'fontSize', 'doEnableAccessibility', 'signature', 'signatureReason'].forEach(function(sProperty) {
34
+ if (typeof mSettings[sProperty] !== 'undefined') {
35
+ this._mSettings[sProperty] = mSettings[sProperty];
36
+ }
37
+ }.bind(this));
30
38
  }
31
39
  });
32
40
 
@@ -105,7 +113,6 @@ sap.ui.define([
105
113
 
106
114
  // Reference the Model for later use
107
115
  this._oModel = oModel;
108
- this._oModel.setUseBatch(false);
109
116
 
110
117
  /* Remove $format system query option because it would overwrite the "Accept" header */
111
118
  oDataUrl.search = oDataUrl.search.split('&').filter(function(val) {
@@ -128,50 +135,73 @@ sap.ui.define([
128
135
  * Creates the DocumentDescription based on the given export
129
136
  * settings and assigns a unique Id to it.
130
137
  *
131
- * @param {Object} oWorkbook Workbook settings of the export configuration
138
+ * @param {Object} mSettings Export settings
132
139
  * @returns {Object} DocumentDescription object that contains all relevant export settings
133
140
  * @private
134
141
  */
135
- PortableDocument.prototype._createDocumentDescription = function(oWorkbook) {
142
+ PortableDocument.prototype._createDocumentDescription = function(mSettings) {
143
+ var oWorkbook = mSettings.workbook;
136
144
  var oDocumentDescription, oMetaInfo;
137
145
 
138
146
  oDocumentDescription = {
139
147
  "Title": oWorkbook.context.title,
140
148
  "Format": {
141
- "PaperSize": "DIN_A4",
142
- "Orientation": "LANDSCAPE",
143
- "FontSize": 12
149
+ "PaperSize": mSettings.paperSize,
150
+ "Orientation": mSettings.orientation,
151
+ "FontSize": Number(mSettings.fontSize),
152
+ "DoEnableAccessibility": mSettings.doEnableAccessibility
144
153
  },
145
154
  "Signature": {
146
- "DoSign": true,
147
- "Reason": ""
155
+ "DoSign": mSettings.signature,
156
+ "Reason": mSettings.signatureReason
148
157
  },
149
158
  "CoverPage": [],
150
159
  "TableColumns": []
151
160
  };
152
161
 
153
- oMetaInfo = oWorkbook.context.metaInfo;
162
+ oMetaInfo = oWorkbook.context.metainfo;
154
163
 
155
164
  /* Add metaInfo to CoverPage */
156
165
  if (oMetaInfo instanceof Array) {
157
- oMetaInfo.forEach(function(oGroup) {
158
- var oCoverPageGroup = {
159
- "Title": oGroup.name,
160
- "Content": []
161
- };
162
-
163
- oGroup.items.forEach(function(oItem) {
164
- oCoverPageGroup["Content"].push({
165
- "Name": oItem.key,
166
- "Value": oItem.value
166
+ if (mSettings.dataSource.version == 2) {
167
+ oMetaInfo.forEach(function(oGroup) {
168
+ oGroup.items.forEach(function(oItem) {
169
+ var oCoverPageGroup = {
170
+ "Title": oGroup.name,
171
+ "Name": oItem.key,
172
+ "Value": oItem.value
173
+ };
174
+ oDocumentDescription["CoverPage"].push(oCoverPageGroup);
167
175
  });
168
176
  });
169
- oDocumentDescription["CoverPage"].push(oCoverPageGroup);
170
- });
177
+ } else {
178
+ oMetaInfo.forEach(function(oGroup) {
179
+ var oCoverPageGroup = {
180
+ "Title": oGroup.name,
181
+ "Content": []
182
+ };
183
+
184
+ oGroup.items.forEach(function(oItem) {
185
+ oCoverPageGroup["Content"].push({
186
+ "Name": oItem.key,
187
+ "Value": oItem.value
188
+ });
189
+ });
190
+ oDocumentDescription["CoverPage"].push(oCoverPageGroup);
191
+ });
192
+ }
171
193
  }
172
194
 
173
- /* Add columns */
174
- oWorkbook.columns.forEach(function(oColumn){
195
+ /* Eliminate duplicates and navigation properties before adding columns */
196
+ oWorkbook.columns.filter(function(oColumn, iIndex, aArray) {
197
+ var sProperty = Array.isArray(oColumn.property) ? oColumn.property[0] : oColumn.property;
198
+
199
+ return aArray.findIndex(function(oOtherColumn) {
200
+ var sOtherProperty = Array.isArray(oOtherColumn.property) ? oOtherColumn.property[0] : oOtherColumn.property;
201
+
202
+ return sProperty === sOtherProperty;
203
+ }) === iIndex && !/^to_\w+\/\w+/.test(sProperty);
204
+ }).forEach(function(oColumn) {
175
205
  oDocumentDescription["TableColumns"].push({
176
206
  "Name": Array.isArray(oColumn.property) ? oColumn.property[0] : oColumn.property,
177
207
  "Header": oColumn.label
@@ -265,11 +295,18 @@ sap.ui.define([
265
295
 
266
296
  oBinding.create(oDocumentDescription);
267
297
  } else {
298
+ var bUseBatch = oModel.bUseBatch;
299
+
300
+ oModel.setUseBatch(false);
268
301
  oModel.create(sPath, oDocumentDescription, {
269
302
  success: function(oData) {
303
+ oModel.setUseBatch(bUseBatch);
270
304
  fnSuccess(oData['Id']);
271
305
  },
272
- error: fnError
306
+ error: function(oError) {
307
+ oModel.setUseBatch(bUseBatch);
308
+ fnError(oError);
309
+ }
273
310
  });
274
311
  }
275
312
  };
@@ -287,7 +324,7 @@ sap.ui.define([
287
324
  return new Promise(function(fnResolve, fnReject) {
288
325
  var oDocumentDescription;
289
326
 
290
- oDocumentDescription = that._createDocumentDescription(mSettings.workbook);
327
+ oDocumentDescription = that._createDocumentDescription(mSettings);
291
328
  that.postDocumentDescription(oDocumentDescription, mSettings.dataSource, fnResolve, fnReject);
292
329
 
293
330
  }).then(function(sDocumentDescriptionId) {
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * SAPUI5
3
- * (c) Copyright 2009-2021 SAP SE. All rights reserved.
3
+ * (c) Copyright 2009-2022 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.97.1")</li>
86
+ * <li><code>version</code> (string) - Application version that creates the XLSX document (default: "1.99.1")</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.97.1',
169
+ * version: '1.99.1',
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.97.1
281
+ * @version 1.99.1
282
282
  *
283
283
  * @since 1.50
284
284
  * @name sap.ui.export.Spreadsheet
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * SAPUI5
3
- * (c) Copyright 2009-2021 SAP SE. All rights reserved.
3
+ * (c) Copyright 2009-2022 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
  * @class Utility class to perform spreadsheet export
24
24
  * @author SAP SE
25
- * @version 1.97.1
25
+ * @version 1.99.1
26
26
  * @static
27
27
  *
28
28
  * @private