@sapui5/sap.ui.export 1.98.0 → 1.99.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.
Files changed (58) hide show
  1. package/package.json +1 -1
  2. package/src/sap/ui/export/.library +1 -1
  3. package/src/sap/ui/export/ExportBase.js +1 -1
  4. package/src/sap/ui/export/ExportUtils.js +168 -145
  5. package/src/sap/ui/export/PortableDocument.js +55 -24
  6. package/src/sap/ui/export/Spreadsheet.js +3 -3
  7. package/src/sap/ui/export/SpreadsheetExport.js +1 -1
  8. package/src/sap/ui/export/fragments/SettingsDialog.fragment.xml +49 -0
  9. package/src/sap/ui/export/library.js +2 -2
  10. package/src/sap/ui/export/messagebundle.properties +41 -2
  11. package/src/sap/ui/export/messagebundle_ar.properties +27 -1
  12. package/src/sap/ui/export/messagebundle_bg.properties +27 -1
  13. package/src/sap/ui/export/messagebundle_ca.properties +27 -1
  14. package/src/sap/ui/export/messagebundle_cs.properties +27 -1
  15. package/src/sap/ui/export/messagebundle_cy.properties +27 -1
  16. package/src/sap/ui/export/messagebundle_da.properties +27 -1
  17. package/src/sap/ui/export/messagebundle_de.properties +27 -1
  18. package/src/sap/ui/export/messagebundle_el.properties +27 -1
  19. package/src/sap/ui/export/messagebundle_en.properties +27 -1
  20. package/src/sap/ui/export/messagebundle_en_GB.properties +27 -1
  21. package/src/sap/ui/export/messagebundle_en_US_sappsd.properties +28 -2
  22. package/src/sap/ui/export/messagebundle_en_US_saprigi.properties +27 -1
  23. package/src/sap/ui/export/messagebundle_en_US_saptrc.properties +26 -0
  24. package/src/sap/ui/export/messagebundle_es.properties +27 -1
  25. package/src/sap/ui/export/messagebundle_es_MX.properties +27 -1
  26. package/src/sap/ui/export/messagebundle_et.properties +27 -1
  27. package/src/sap/ui/export/messagebundle_fi.properties +27 -1
  28. package/src/sap/ui/export/messagebundle_fr.properties +27 -1
  29. package/src/sap/ui/export/messagebundle_fr_CA.properties +27 -1
  30. package/src/sap/ui/export/messagebundle_hi.properties +27 -1
  31. package/src/sap/ui/export/messagebundle_hr.properties +27 -1
  32. package/src/sap/ui/export/messagebundle_hu.properties +27 -1
  33. package/src/sap/ui/export/messagebundle_id.properties +27 -1
  34. package/src/sap/ui/export/messagebundle_it.properties +27 -1
  35. package/src/sap/ui/export/messagebundle_iw.properties +27 -1
  36. package/src/sap/ui/export/messagebundle_ja.properties +27 -1
  37. package/src/sap/ui/export/messagebundle_kk.properties +27 -1
  38. package/src/sap/ui/export/messagebundle_ko.properties +27 -1
  39. package/src/sap/ui/export/messagebundle_lt.properties +27 -1
  40. package/src/sap/ui/export/messagebundle_lv.properties +27 -1
  41. package/src/sap/ui/export/messagebundle_ms.properties +27 -1
  42. package/src/sap/ui/export/messagebundle_nl.properties +27 -1
  43. package/src/sap/ui/export/messagebundle_no.properties +27 -1
  44. package/src/sap/ui/export/messagebundle_pl.properties +27 -1
  45. package/src/sap/ui/export/messagebundle_pt.properties +27 -1
  46. package/src/sap/ui/export/messagebundle_pt_PT.properties +27 -1
  47. package/src/sap/ui/export/messagebundle_ro.properties +27 -1
  48. package/src/sap/ui/export/messagebundle_ru.properties +27 -1
  49. package/src/sap/ui/export/messagebundle_sh.properties +27 -1
  50. package/src/sap/ui/export/messagebundle_sk.properties +27 -1
  51. package/src/sap/ui/export/messagebundle_sl.properties +27 -1
  52. package/src/sap/ui/export/messagebundle_sv.properties +27 -1
  53. package/src/sap/ui/export/messagebundle_th.properties +27 -1
  54. package/src/sap/ui/export/messagebundle_tr.properties +27 -1
  55. package/src/sap/ui/export/messagebundle_uk.properties +27 -1
  56. package/src/sap/ui/export/messagebundle_vi.properties +27 -1
  57. package/src/sap/ui/export/messagebundle_zh_CN.properties +27 -1
  58. package/src/sap/ui/export/messagebundle_zh_TW.properties +27 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapui5/sap.ui.export",
3
- "version": "1.98.0",
3
+ "version": "1.99.0",
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)",
@@ -5,7 +5,7 @@
5
5
  <vendor>SAP SE</vendor>
6
6
  <copyright>SAPUI5
7
7
  * (c) Copyright 2009-2022 SAP SE. All rights reserved.</copyright>
8
- <version>1.98.0</version>
8
+ <version>1.99.0</version>
9
9
 
10
10
  <documentation>UI5 library: sap.ui.export</documentation>
11
11
 
@@ -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.98.0
18
+ * @version 1.99.0
19
19
  *
20
20
  * @since 1.96
21
21
  * @name sap.ui.export.ExportBase
@@ -3,33 +3,23 @@
3
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.98.0
111
+ * @version 1.99.0
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
  },
@@ -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.98.0")
937
+ * @param {string} [oContext.version] Application version (default: "1.99.0")
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
@@ -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.98.0
19
+ * @version 1.99.0
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
 
@@ -127,50 +135,73 @@ sap.ui.define([
127
135
  * Creates the DocumentDescription based on the given export
128
136
  * settings and assigns a unique Id to it.
129
137
  *
130
- * @param {Object} oWorkbook Workbook settings of the export configuration
138
+ * @param {Object} mSettings Export settings
131
139
  * @returns {Object} DocumentDescription object that contains all relevant export settings
132
140
  * @private
133
141
  */
134
- PortableDocument.prototype._createDocumentDescription = function(oWorkbook) {
142
+ PortableDocument.prototype._createDocumentDescription = function(mSettings) {
143
+ var oWorkbook = mSettings.workbook;
135
144
  var oDocumentDescription, oMetaInfo;
136
145
 
137
146
  oDocumentDescription = {
138
147
  "Title": oWorkbook.context.title,
139
148
  "Format": {
140
- "PaperSize": "DIN_A4",
141
- "Orientation": "LANDSCAPE",
142
- "FontSize": 12
149
+ "PaperSize": mSettings.paperSize,
150
+ "Orientation": mSettings.orientation,
151
+ "FontSize": Number(mSettings.fontSize),
152
+ "DoEnableAccessibility": mSettings.doEnableAccessibility
143
153
  },
144
154
  "Signature": {
145
- "DoSign": true,
146
- "Reason": ""
155
+ "DoSign": mSettings.signature,
156
+ "Reason": mSettings.signatureReason
147
157
  },
148
158
  "CoverPage": [],
149
159
  "TableColumns": []
150
160
  };
151
161
 
152
- oMetaInfo = oWorkbook.context.metaInfo;
162
+ oMetaInfo = oWorkbook.context.metainfo;
153
163
 
154
164
  /* Add metaInfo to CoverPage */
155
165
  if (oMetaInfo instanceof Array) {
156
- oMetaInfo.forEach(function(oGroup) {
157
- var oCoverPageGroup = {
158
- "Title": oGroup.name,
159
- "Content": []
160
- };
161
-
162
- oGroup.items.forEach(function(oItem) {
163
- oCoverPageGroup["Content"].push({
164
- "Name": oItem.key,
165
- "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);
166
175
  });
167
176
  });
168
- oDocumentDescription["CoverPage"].push(oCoverPageGroup);
169
- });
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
+ }
170
193
  }
171
194
 
172
- /* Add columns */
173
- 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) {
174
205
  oDocumentDescription["TableColumns"].push({
175
206
  "Name": Array.isArray(oColumn.property) ? oColumn.property[0] : oColumn.property,
176
207
  "Header": oColumn.label
@@ -293,7 +324,7 @@ sap.ui.define([
293
324
  return new Promise(function(fnResolve, fnReject) {
294
325
  var oDocumentDescription;
295
326
 
296
- oDocumentDescription = that._createDocumentDescription(mSettings.workbook);
327
+ oDocumentDescription = that._createDocumentDescription(mSettings);
297
328
  that.postDocumentDescription(oDocumentDescription, mSettings.dataSource, fnResolve, fnReject);
298
329
 
299
330
  }).then(function(sDocumentDescriptionId) {
@@ -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.98.0")</li>
86
+ * <li><code>version</code> (string) - Application version that creates the XLSX document (default: "1.99.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.98.0',
169
+ * version: '1.99.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.98.0
281
+ * @version 1.99.0
282
282
  *
283
283
  * @since 1.50
284
284
  * @name sap.ui.export.Spreadsheet
@@ -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.98.0
25
+ * @version 1.99.0
26
26
  * @static
27
27
  *
28
28
  * @private
@@ -0,0 +1,49 @@
1
+ <Dialog xmlns="sap.m" xmlns:core="sap.ui.core" id="exportSettingsDialog" title="{i18n>EXPORT_SETTINGS_TITLE}" horizontalScrolling="false" verticalScrolling="true" afterClose=".onAfterClose" class="sapUiContentPadding sapUiExportSettings">
2
+ <content>
3
+ <VBox renderType="Bare" width="100%">
4
+ <Label text="{i18n>FILE_NAME}" labelFor="exportSettingsDialog-fileName"/>
5
+ <Input id="exportSettingsDialog-fileName" value="{/fileName}" liveChange=".onFileNameChange" class="sapUiTinyMarginBottom"/>
6
+
7
+ <Label text="{i18n>SELECT_FORMAT}" labelFor="exportSettingsDialog-fileType" visible="{/devMode}"/>
8
+ <Select id="exportSettingsDialog-fileType" selectedKey="{/selectedFileType}" items="{path: '/fileType'}" change=".onFileTypeChange" width="100%" visible="{/devMode}">
9
+ <items>
10
+ <core:Item key="{key}" text="{text}"/>
11
+ </items>
12
+ </Select>
13
+
14
+ <CheckBox id="exportSettingsDialog-includeFilterSettings" selected="{/includeFilterSettings}" text="{i18n>INCLUDE_FILTER_SETTINGS}"/>
15
+ <CheckBox id="exportSettingsDialog-splitCells" selected="{/splitCells}" text="{i18n>SPLIT_CELLS}" visible="{path:'/selectedFileType', formatter: '.isXLSX'}"/> <!-- Will be hidden in case of PDF because it needs to be true always -->
16
+ <CheckBox id="exportSettingsDialog-addDateTime" selected="{/addDateTime}" text="{i18n>ADD_DATE_TIME}" visible="false"/>
17
+
18
+ <!-- PDF Specific settings -->
19
+ <Label text="{i18n>PAPER_SIZE}" labelFor="exportSettingsDialog-papersize" visible="{path:'/selectedFileType', formatter: '.isPDF'}"/>
20
+ <Select id="exportSettingsDialog-papersize" selectedKey="{/selectedPaperSize}" items="{path: '/paperSize'}" width="100%" visible="{path:'/selectedFileType', formatter: '.isPDF'}">
21
+ <items>
22
+ <core:Item key="{key}" text="{text}"/>
23
+ </items>
24
+ </Select>
25
+
26
+ <Label text="{i18n>ORIENTATION}" labelFor="exportSettingsDialog-orientation" visible="{path:'/selectedFileType', formatter: '.isPDF'}"/>
27
+ <Select id="exportSettingsDialog-orientation" selectedKey="{/selectedOrientation}" items="{path: '/orientation'}" width="100%" visible="{path:'/selectedFileType', formatter: '.isPDF'}">
28
+ <items>
29
+ <core:Item key="{key}" text="{text}"/>
30
+ </items>
31
+ </Select>
32
+
33
+ <Label text="{i18n>FONT_SIZE}" labelFor="exportSettingsDialog-fontSize" visible="{path:'/selectedFileType', formatter: '.isPDF'}"/>
34
+ <Input id="exportSettingsDialog-fontSize" value="{/fontSize}" liveChange=".onFontSizeChange" class="sapUiTinyMarginBottom" visible="{path:'/selectedFileType', formatter: '.isPDF'}"/>
35
+
36
+ <CheckBox id="exportSettingsDialog-accessibility" enabled="{/accessibilitySupported}" selected="{/doEnableAccessibility}" text="{i18n>ENABLE_ACCESSIBILITY}" tooltip="{i18n>TOOLTIP_PDF_ACCESSIBILITY}" visible="{path:'/selectedFileType', formatter: '.isPDF'}"/>
37
+ <CheckBox id="exportSettingsDialog-signature" enabled="{/signatureSupported}" selected="{/signature}" text="{i18n>ENABLE_SIGNATURE}" tooltip="{i18n>TOOLTIP_PDF_SIGNATURE}" visible="{path:'/selectedFileType', formatter: '.isPDF'}"/>
38
+
39
+ <Label id="exportSettingsDialog-signatureReasonLabel" text="{i18n>SIGNATURE_REASON}" labelFor="exportSettingsDialog-signatureReason" visible="{/signature}"/>
40
+ <Input id="exportSettingsDialog-signatureReason" value="{/signatureReason}" class="sapUiTinyMarginBottom" visible="{/signature}"/>
41
+ </VBox>
42
+ </content>
43
+ <beginButton>
44
+ <Button id="exportSettingsDialog-exportButton" press=".onExport" text="{i18n>EXPORT_BUTTON}" type="Emphasized"/>
45
+ </beginButton>
46
+ <endButton>
47
+ <Button id="exportSettingsDialog-cancelButton" press=".onCancel" text="{i18n>CANCEL_BUTTON}"/>
48
+ </endButton>
49
+ </Dialog>
@@ -17,7 +17,7 @@ sap.ui.define([
17
17
  * @namespace
18
18
  * @name sap.ui.export
19
19
  * @author SAP SE
20
- * @version 1.98.0
20
+ * @version 1.99.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.98.0"
36
+ version: "1.99.0"
37
37
  });
38
38
 
39
39