@sapui5/sap.ui.export 1.98.0 → 1.101.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 (63) 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 +1 -1
  4. package/src/sap/ui/export/ExportUtils.js +222 -158
  5. package/src/sap/ui/export/PortableDocument.js +121 -63
  6. package/src/sap/ui/export/Spreadsheet.js +3 -3
  7. package/src/sap/ui/export/SpreadsheetExport.js +2 -3
  8. package/src/sap/ui/export/fragments/SettingsDialog.fragment.xml +52 -0
  9. package/src/sap/ui/export/js/XLSXBuilder.js +1 -1
  10. package/src/sap/ui/export/js/XLSXBuilder.js.map +1 -1
  11. package/src/sap/ui/export/library.js +17 -15
  12. package/src/sap/ui/export/messagebundle.properties +66 -6
  13. package/src/sap/ui/export/messagebundle_ar.properties +42 -2
  14. package/src/sap/ui/export/messagebundle_bg.properties +45 -5
  15. package/src/sap/ui/export/messagebundle_ca.properties +42 -2
  16. package/src/sap/ui/export/messagebundle_cs.properties +42 -2
  17. package/src/sap/ui/export/messagebundle_cy.properties +42 -2
  18. package/src/sap/ui/export/messagebundle_da.properties +42 -2
  19. package/src/sap/ui/export/messagebundle_de.properties +42 -2
  20. package/src/sap/ui/export/messagebundle_el.properties +42 -2
  21. package/src/sap/ui/export/messagebundle_en.properties +42 -2
  22. package/src/sap/ui/export/messagebundle_en_GB.properties +42 -2
  23. package/src/sap/ui/export/messagebundle_en_US_sappsd.properties +44 -4
  24. package/src/sap/ui/export/messagebundle_en_US_saprigi.properties +42 -2
  25. package/src/sap/ui/export/messagebundle_en_US_saptrc.properties +42 -2
  26. package/src/sap/ui/export/messagebundle_es.properties +42 -2
  27. package/src/sap/ui/export/messagebundle_es_MX.properties +42 -2
  28. package/src/sap/ui/export/messagebundle_et.properties +42 -2
  29. package/src/sap/ui/export/messagebundle_fi.properties +43 -3
  30. package/src/sap/ui/export/messagebundle_fr.properties +47 -7
  31. package/src/sap/ui/export/messagebundle_fr_CA.properties +42 -2
  32. package/src/sap/ui/export/messagebundle_hi.properties +42 -2
  33. package/src/sap/ui/export/messagebundle_hr.properties +42 -2
  34. package/src/sap/ui/export/messagebundle_hu.properties +42 -2
  35. package/src/sap/ui/export/messagebundle_id.properties +42 -2
  36. package/src/sap/ui/export/messagebundle_it.properties +42 -2
  37. package/src/sap/ui/export/messagebundle_iw.properties +42 -2
  38. package/src/sap/ui/export/messagebundle_ja.properties +42 -2
  39. package/src/sap/ui/export/messagebundle_kk.properties +42 -2
  40. package/src/sap/ui/export/messagebundle_ko.properties +42 -2
  41. package/src/sap/ui/export/messagebundle_lt.properties +42 -2
  42. package/src/sap/ui/export/messagebundle_lv.properties +42 -2
  43. package/src/sap/ui/export/messagebundle_ms.properties +42 -2
  44. package/src/sap/ui/export/messagebundle_nl.properties +42 -2
  45. package/src/sap/ui/export/messagebundle_no.properties +42 -2
  46. package/src/sap/ui/export/messagebundle_pl.properties +42 -2
  47. package/src/sap/ui/export/messagebundle_pt.properties +42 -2
  48. package/src/sap/ui/export/messagebundle_pt_PT.properties +42 -2
  49. package/src/sap/ui/export/messagebundle_ro.properties +42 -2
  50. package/src/sap/ui/export/messagebundle_ru.properties +42 -2
  51. package/src/sap/ui/export/messagebundle_sh.properties +42 -2
  52. package/src/sap/ui/export/messagebundle_sk.properties +42 -2
  53. package/src/sap/ui/export/messagebundle_sl.properties +42 -2
  54. package/src/sap/ui/export/messagebundle_sv.properties +42 -2
  55. package/src/sap/ui/export/messagebundle_th.properties +42 -2
  56. package/src/sap/ui/export/messagebundle_tr.properties +42 -2
  57. package/src/sap/ui/export/messagebundle_uk.properties +42 -2
  58. package/src/sap/ui/export/messagebundle_vi.properties +42 -2
  59. package/src/sap/ui/export/messagebundle_zh_CN.properties +42 -2
  60. package/src/sap/ui/export/messagebundle_zh_TW.properties +42 -2
  61. package/src/sap/ui/export/themes/sap_horizon_dark/library.source.less +8 -0
  62. package/src/sap/ui/export/themes/sap_horizon_hcb/library.source.less +8 -0
  63. package/src/sap/ui/export/themes/sap_horizon_hcw/library.source.less +8 -0
@@ -16,17 +16,25 @@ 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.101.0
20
20
  *
21
21
  * @since 1.96
22
- * @name sap.ui.export.PortableDocument
23
- * @extends sap.ui.base.ExportBase
22
+ * @alias sap.ui.export.PortableDocument
23
+ * @extends sap.ui.export.ExportBase
24
24
  * @private
25
25
  */
26
26
  var PortableDocument = ExportBase.extend('sap.ui.export.PortableDocument', {
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', 'fitToPage', 'signature', 'signatureReason', 'pdfArchive'].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,80 @@ 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
+ "FitToPage": {
153
+ "IsEnabled": mSettings.fitToPage,
154
+ "MinimumFontSize": 4
155
+ }
156
+ },
157
+ "PDFStandard": {
158
+ "DoEnableAccessibility": mSettings.doEnableAccessibility,
159
+ "UsePDFAConformance": mSettings.pdfArchive
143
160
  },
144
161
  "Signature": {
145
- "DoSign": true,
146
- "Reason": ""
162
+ "DoSign": mSettings.signature,
163
+ "Reason": mSettings.signatureReason
147
164
  },
148
165
  "CoverPage": [],
149
166
  "TableColumns": []
150
167
  };
151
168
 
152
- oMetaInfo = oWorkbook.context.metaInfo;
169
+ oMetaInfo = oWorkbook.context.metainfo;
153
170
 
154
171
  /* Add metaInfo to CoverPage */
155
172
  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
173
+ if (mSettings.dataSource.version == 2) {
174
+ oMetaInfo.forEach(function(oGroup) {
175
+ oGroup.items.forEach(function(oItem) {
176
+ var oCoverPageGroup = {
177
+ "Title": oGroup.name,
178
+ "Name": oItem.key,
179
+ "Value": oItem.value
180
+ };
181
+ oDocumentDescription["CoverPage"].push(oCoverPageGroup);
166
182
  });
167
183
  });
168
- oDocumentDescription["CoverPage"].push(oCoverPageGroup);
169
- });
184
+ } else {
185
+ oMetaInfo.forEach(function(oGroup) {
186
+ var oCoverPageGroup = {
187
+ "Title": oGroup.name,
188
+ "Content": []
189
+ };
190
+
191
+ oGroup.items.forEach(function(oItem) {
192
+ oCoverPageGroup["Content"].push({
193
+ "Name": oItem.key,
194
+ "Value": oItem.value
195
+ });
196
+ });
197
+ oDocumentDescription["CoverPage"].push(oCoverPageGroup);
198
+ });
199
+ }
170
200
  }
171
201
 
172
- /* Add columns */
173
- oWorkbook.columns.forEach(function(oColumn){
202
+ /* Eliminate duplicates and navigation properties before adding columns */
203
+ oWorkbook.columns.filter(function(oColumn, iIndex, aArray) {
204
+ var sProperty = Array.isArray(oColumn.property) ? oColumn.property[0] : oColumn.property;
205
+
206
+ return aArray.findIndex(function(oOtherColumn) {
207
+ var sOtherProperty = Array.isArray(oOtherColumn.property) ? oOtherColumn.property[0] : oOtherColumn.property;
208
+
209
+ return sProperty === sOtherProperty;
210
+ }) === iIndex && !/^to_\w+\/\w+/.test(sProperty);
211
+ }).forEach(function(oColumn) {
174
212
  oDocumentDescription["TableColumns"].push({
175
213
  "Name": Array.isArray(oColumn.property) ? oColumn.property[0] : oColumn.property,
176
214
  "Header": oColumn.label
@@ -220,7 +258,7 @@ sap.ui.define([
220
258
  oContext = mSettings.workbook.context = {};
221
259
  }
222
260
 
223
- if (typeof oContext.title === 'string') {
261
+ if (typeof oContext.title === 'string' && oContext.title) {
224
262
  return Promise.resolve();
225
263
  }
226
264
 
@@ -236,48 +274,51 @@ sap.ui.define([
236
274
  *
237
275
  * @param {Object} oDocumentDescription DocumentDescription instance that is being created
238
276
  * @param {Object} oDataSource DataSource settings of the export configuration
239
- * @param {function} fnSuccess Success handler function
240
- * @param {function} fnError Error handler function
277
+ *
278
+ * @returns {Promise} A Promise that resolves with the newly created Id of the DocumentDescription
241
279
  */
242
- PortableDocument.prototype.postDocumentDescription = function(oDocumentDescription, oDataSource, fnSuccess, fnError) {
280
+ PortableDocument.prototype.postDocumentDescription = function(oDocumentDescription, oDataSource) {
243
281
  var oBinding, oModel, sPath;
244
282
 
245
283
  oModel = this._getModel(oDataSource);
246
284
  sPath = '/' + this._getEntitySetName(oDataSource);
247
285
 
248
286
  if (!oModel || !oModel.isA(['sap.ui.model.odata.v4.ODataModel', 'sap.ui.model.odata.v2.ODataModel'])) {
249
- fnError('Unsupported Model');
287
+ return Promise.reject('Unsupported Model');
250
288
  }
251
289
 
252
- if (oModel.isA('sap.ui.model.odata.v4.ODataModel')) {
253
- oBinding = oModel.bindList(sPath);
290
+ return new Promise(function(fnResolve, fnReject) {
254
291
 
255
- oBinding.attachCreateCompleted(function(oEvent) {
256
- var success = oEvent.getParameter('success');
292
+ if (oModel.isA('sap.ui.model.odata.v4.ODataModel')) {
293
+ oBinding = oModel.bindList(sPath);
257
294
 
258
- if (success) {
259
- fnSuccess(oEvent.getParameter('context').getObject()['Id']);
260
- } else {
261
- fnError();
262
- }
263
- });
295
+ oBinding.attachCreateCompleted(function(oEvent) {
296
+ var success = oEvent.getParameter('success');
264
297
 
265
- oBinding.create(oDocumentDescription);
266
- } else {
267
- var bUseBatch = oModel.bUseBatch;
268
-
269
- oModel.setUseBatch(false);
270
- oModel.create(sPath, oDocumentDescription, {
271
- success: function(oData) {
272
- oModel.setUseBatch(bUseBatch);
273
- fnSuccess(oData['Id']);
274
- },
275
- error: function(oError) {
276
- oModel.setUseBatch(bUseBatch);
277
- fnError(oError);
278
- }
279
- });
280
- }
298
+ if (success) {
299
+ fnResolve(oEvent.getParameter('context').getObject()['Id']);
300
+ } else {
301
+ fnReject();
302
+ }
303
+ });
304
+
305
+ oBinding.create(oDocumentDescription);
306
+ } else {
307
+ var bUseBatch = oModel.bUseBatch;
308
+
309
+ oModel.setUseBatch(false);
310
+ oModel.create(sPath, oDocumentDescription, {
311
+ success: function(oData) {
312
+ oModel.setUseBatch(bUseBatch);
313
+ fnResolve(oData['Id']);
314
+ },
315
+ error: function(oError) {
316
+ oModel.setUseBatch(bUseBatch);
317
+ fnReject(oError);
318
+ }
319
+ });
320
+ }
321
+ });
281
322
  };
282
323
 
283
324
  /**
@@ -289,16 +330,33 @@ sap.ui.define([
289
330
  */
290
331
  PortableDocument.prototype.createBuildPromise = function(mSettings) {
291
332
  var that = this;
333
+ var oDocumentDescription;
334
+ var oBusyDialog;
335
+ var oResourceBundle = Core.getLibraryResourceBundle('sap.ui.export');
336
+
337
+ oBusyDialog = new sap.m.BusyDialog('PDFExportBusyDialog', {
338
+ title: oResourceBundle.getText("PROGRESS_TITLE"),
339
+ text: oResourceBundle.getText("PDF_GENERATION_IN_PROGRESS"),
340
+ showCancelButton: true,
341
+ close: function(oEvent) {
342
+ if (oEvent.getParameter("cancelPressed")) {
343
+ that.cancel();
344
+ oBusyDialog.destroy();
345
+ oBusyDialog = null;
346
+ }
347
+ }
348
+ });
292
349
 
293
- return new Promise(function(fnResolve, fnReject) {
294
- var oDocumentDescription;
295
-
296
- oDocumentDescription = that._createDocumentDescription(mSettings.workbook);
297
- that.postDocumentDescription(oDocumentDescription, mSettings.dataSource, fnResolve, fnReject);
350
+ oDocumentDescription = that._createDocumentDescription(mSettings);
298
351
 
299
- }).then(function(sDocumentDescriptionId) {
300
- return that.sendRequest(mSettings.dataSource.dataUrl, sDocumentDescriptionId).then(function(response) {
352
+ return that.postDocumentDescription(oDocumentDescription, mSettings.dataSource).then(function(sDocumentDescriptionId) {
353
+ oBusyDialog.open();
354
+ return oBusyDialog && that.sendRequest(mSettings.dataSource.dataUrl, sDocumentDescriptionId).then(function(response) {
301
355
  ExportUtils.saveAsFile(response, mSettings.fileName);
356
+ oBusyDialog && oBusyDialog.destroy();
357
+ }).catch(function(e) {
358
+ oBusyDialog && oBusyDialog.destroy();
359
+ new sap.m.MessageToast.show("Error during PDF export!");
302
360
  });
303
361
  });
304
362
  };
@@ -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.101.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.101.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.101.0
282
282
  *
283
283
  * @since 1.50
284
284
  * @name sap.ui.export.Spreadsheet
@@ -20,10 +20,9 @@ sap.ui.define(['sap/base/Log', 'sap/ui/export/ExportUtils'], function(Log, Expor
20
20
  /**
21
21
  * Utility class to perform spreadsheet export.
22
22
  *
23
- * @class Utility class to perform spreadsheet export
23
+ * @namespace
24
24
  * @author SAP SE
25
- * @version 1.98.0
26
- * @static
25
+ * @version 1.101.0
27
26
  *
28
27
  * @private
29
28
  * @since 1.50.0
@@ -0,0 +1,52 @@
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%" class="sapUiExportSettingsLabel">
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}" visible="{path:'/selectedFileType', formatter: '.isXLSX'}"/>
15
+ <CheckBox id="exportSettingsDialog-includeFilterSettings-PDF" enabled="{/capabilities/PDF/CoverPage}" selected="{/includeFilterSettings}" text="{i18n>INCLUDE_FILTER_SETTINGS}" visible="{path:'/selectedFileType', formatter: '.isPDF'}" tooltip="{i18n>TOOLTIP_FILTER_SETTINGS}"/>
16
+ <CheckBox id="exportSettingsDialog-pdfArchive" enabled="{/capabilities/PDF/ArchiveFormat}" selected="{/pdfArchive}" text="{i18n>ARCHIVE_FORMAT}" visible="{path:'/selectedFileType', formatter: '.isPDF'}" tooltip="{i18n>TOOLTIP_ARCHIVE_FORMAT}"/>
17
+ <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 -->
18
+ <CheckBox id="exportSettingsDialog-addDateTime" selected="{/addDateTime}" text="{i18n>ADD_DATE_TIME}" visible="false"/>
19
+
20
+ <!-- PDF Specific settings -->
21
+ <Label text="{i18n>PAPER_SIZE}" labelFor="exportSettingsDialog-papersize" visible="{path:'/selectedFileType', formatter: '.isPDF'}"/>
22
+ <Select id="exportSettingsDialog-papersize" selectedKey="{/selectedPaperSize}" items="{path: '/paperSize'}" width="100%" visible="{path:'/selectedFileType', formatter: '.isPDF'}">
23
+ <items>
24
+ <core:Item key="{key}" text="{text}"/>
25
+ </items>
26
+ </Select>
27
+
28
+ <Label text="{i18n>ORIENTATION}" labelFor="exportSettingsDialog-orientation" visible="{path:'/selectedFileType', formatter: '.isPDF'}"/>
29
+ <Select id="exportSettingsDialog-orientation" selectedKey="{/selectedOrientation}" items="{path: '/orientation'}" width="100%" visible="{path:'/selectedFileType', formatter: '.isPDF'}">
30
+ <items>
31
+ <core:Item key="{key}" text="{text}"/>
32
+ </items>
33
+ </Select>
34
+
35
+ <Label text="{i18n>FONT_SIZE}" labelFor="exportSettingsDialog-fontSize" visible="{path:'/selectedFileType', formatter: '.isPDF'}"/>
36
+ <Input id="exportSettingsDialog-fontSize" value="{/fontSize}" enabled="{/capabilities/PDF/FontSize}" liveChange=".onFontSizeChange" class="sapUiTinyMarginBottom" visible="{path:'/selectedFileType', formatter: '.isPDF'}" tooltip="{i18n>TOOLTIP_FONT_SIZE}"/>
37
+
38
+ <CheckBox id="exportSettingsDialog-accessibility" selected="{/doEnableAccessibility}" text="{i18n>ENABLE_ACCESSIBILITY}" tooltip="{i18n>TOOLTIP_PDF_ACCESSIBILITY}" visible="{path:'/selectedFileType', formatter: '.isPDF'}"/>
39
+ <CheckBox id="exportSettingsDialog-fitToPage" enabled="{/capabilities/PDF/FitToPage}" selected="{/fitToPage}" text="{i18n>FITTOPAGE}" tooltip="{i18n>TOOLTIP_FITTOPAGE}" visible="{path:'/selectedFileType', formatter: '.isPDF'}"/>
40
+ <CheckBox id="exportSettingsDialog-signature" enabled="{/capabilities/PDF/Signature}" selected="{/signature}" text="{i18n>ENABLE_SIGNATURE}" tooltip="{i18n>TOOLTIP_PDF_SIGNATURE}" visible="{path:'/selectedFileType', formatter: '.isPDF'}"/>
41
+
42
+ <Label id="exportSettingsDialog-signatureReasonLabel" text="{i18n>SIGNATURE_REASON}" labelFor="exportSettingsDialog-signatureReason" visible="{/signature}"/>
43
+ <Input id="exportSettingsDialog-signatureReason" value="{/signatureReason}" class="sapUiTinyMarginBottom" visible="{/signature}"/>
44
+ </VBox>
45
+ </content>
46
+ <beginButton>
47
+ <Button id="exportSettingsDialog-exportButton" press=".onExport" text="{i18n>EXPORT_BUTTON}" type="Emphasized"/>
48
+ </beginButton>
49
+ <endButton>
50
+ <Button id="exportSettingsDialog-cancelButton" press=".onCancel" text="{i18n>CANCEL_BUTTON}"/>
51
+ </endButton>
52
+ </Dialog>