@sapui5/sap.ui.export 1.100.0 → 1.102.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.
- package/package.json +1 -1
- package/src/sap/ui/export/.library +2 -2
- package/src/sap/ui/export/ExportBase.js +29 -7
- package/src/sap/ui/export/ExportDialog.js +30 -22
- package/src/sap/ui/export/ExportHandler.js +463 -0
- package/src/sap/ui/export/ExportUtils.js +215 -97
- package/src/sap/ui/export/PortableDocument.js +94 -56
- package/src/sap/ui/export/Spreadsheet.js +35 -22
- package/src/sap/ui/export/SpreadsheetExport.js +1 -1
- package/src/sap/ui/export/fragments/SettingsDialog.fragment.xml +24 -14
- 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 +42 -15
- package/src/sap/ui/export/messagebundle.properties +55 -4
- package/src/sap/ui/export/messagebundle_ar.properties +34 -2
- package/src/sap/ui/export/messagebundle_bg.properties +34 -2
- package/src/sap/ui/export/messagebundle_ca.properties +34 -2
- package/src/sap/ui/export/messagebundle_cs.properties +34 -2
- package/src/sap/ui/export/messagebundle_cy.properties +34 -2
- package/src/sap/ui/export/messagebundle_da.properties +34 -2
- package/src/sap/ui/export/messagebundle_de.properties +34 -2
- package/src/sap/ui/export/messagebundle_el.properties +34 -2
- package/src/sap/ui/export/messagebundle_en.properties +33 -1
- package/src/sap/ui/export/messagebundle_en_GB.properties +33 -1
- package/src/sap/ui/export/messagebundle_en_US_sappsd.properties +33 -1
- package/src/sap/ui/export/messagebundle_en_US_saprigi.properties +33 -1
- package/src/sap/ui/export/messagebundle_en_US_saptrc.properties +33 -1
- package/src/sap/ui/export/messagebundle_es.properties +34 -2
- package/src/sap/ui/export/messagebundle_es_MX.properties +34 -2
- package/src/sap/ui/export/messagebundle_et.properties +34 -2
- package/src/sap/ui/export/messagebundle_fi.properties +34 -2
- package/src/sap/ui/export/messagebundle_fr.properties +39 -7
- package/src/sap/ui/export/messagebundle_fr_CA.properties +36 -4
- package/src/sap/ui/export/messagebundle_hi.properties +34 -2
- package/src/sap/ui/export/messagebundle_hr.properties +34 -2
- package/src/sap/ui/export/messagebundle_hu.properties +34 -2
- package/src/sap/ui/export/messagebundle_id.properties +35 -3
- package/src/sap/ui/export/messagebundle_it.properties +34 -2
- package/src/sap/ui/export/messagebundle_iw.properties +34 -2
- package/src/sap/ui/export/messagebundle_ja.properties +34 -2
- package/src/sap/ui/export/messagebundle_kk.properties +34 -2
- package/src/sap/ui/export/messagebundle_ko.properties +34 -2
- package/src/sap/ui/export/messagebundle_lt.properties +34 -2
- package/src/sap/ui/export/messagebundle_lv.properties +34 -2
- package/src/sap/ui/export/messagebundle_ms.properties +34 -2
- package/src/sap/ui/export/messagebundle_nl.properties +34 -2
- package/src/sap/ui/export/messagebundle_no.properties +34 -2
- package/src/sap/ui/export/messagebundle_pl.properties +34 -2
- package/src/sap/ui/export/messagebundle_pt.properties +34 -2
- package/src/sap/ui/export/messagebundle_pt_PT.properties +34 -2
- package/src/sap/ui/export/messagebundle_ro.properties +34 -2
- package/src/sap/ui/export/messagebundle_ru.properties +34 -2
- package/src/sap/ui/export/messagebundle_sh.properties +34 -2
- package/src/sap/ui/export/messagebundle_sk.properties +34 -2
- package/src/sap/ui/export/messagebundle_sl.properties +36 -4
- package/src/sap/ui/export/messagebundle_sv.properties +34 -2
- package/src/sap/ui/export/messagebundle_th.properties +34 -2
- package/src/sap/ui/export/messagebundle_tr.properties +34 -2
- package/src/sap/ui/export/messagebundle_uk.properties +34 -2
- package/src/sap/ui/export/messagebundle_vi.properties +34 -2
- package/src/sap/ui/export/messagebundle_zh_CN.properties +34 -2
- package/src/sap/ui/export/messagebundle_zh_TW.properties +34 -2
- package/src/sap/ui/export/provider/DataProviderBase.js +10 -10
|
@@ -5,18 +5,19 @@
|
|
|
5
5
|
|
|
6
6
|
sap.ui.define([
|
|
7
7
|
'sap/base/Log',
|
|
8
|
+
'sap/m/MessageToast',
|
|
8
9
|
'sap/ui/core/Core',
|
|
9
10
|
'sap/ui/export/ExportBase',
|
|
10
11
|
'sap/ui/export/ExportUtils',
|
|
11
12
|
'sap/ui/model/odata/v4/ODataModel'
|
|
12
|
-
], function(Log, Core, ExportBase, ExportUtils, ODataModel) {
|
|
13
|
+
], function(Log, MessageToast, Core, ExportBase, ExportUtils, ODataModel) {
|
|
13
14
|
'use strict';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* @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
18
|
*
|
|
18
19
|
* @author SAP SE
|
|
19
|
-
* @version 1.
|
|
20
|
+
* @version 1.102.1
|
|
20
21
|
*
|
|
21
22
|
* @since 1.96
|
|
22
23
|
* @alias sap.ui.export.PortableDocument
|
|
@@ -30,7 +31,7 @@ sap.ui.define([
|
|
|
30
31
|
|
|
31
32
|
|
|
32
33
|
/* Only apply supported properties */
|
|
33
|
-
['paperSize', 'orientation', 'font', 'fontSize', 'doEnableAccessibility', 'signature', 'signatureReason'].forEach(function(sProperty) {
|
|
34
|
+
['paperSize', 'orientation', 'font', 'fontSize', 'doEnableAccessibility', 'fitToPage', 'signature', 'signatureReason', 'pdfArchive'].forEach(function(sProperty) {
|
|
34
35
|
if (typeof mSettings[sProperty] !== 'undefined') {
|
|
35
36
|
this._mSettings[sProperty] = mSettings[sProperty];
|
|
36
37
|
}
|
|
@@ -42,9 +43,9 @@ sap.ui.define([
|
|
|
42
43
|
* Sets the data source configuration that will be used for exporting the data. If the passed parameter is null,
|
|
43
44
|
* the call will be ignored.
|
|
44
45
|
*
|
|
45
|
-
* @param {
|
|
46
|
+
* @param {object|sap.ui.model.ListBinding|sap.ui.model.TreeBinding} oDataSource Possible types are a data
|
|
46
47
|
* source configuration, a <code>sap.ui.model.ListBinding</code> or <code>sap.ui.model.TreeBinding</code>
|
|
47
|
-
* @returns {
|
|
48
|
+
* @returns {object|null} - Valid dataSource object or null in case the dataSource configuration is not supported
|
|
48
49
|
*
|
|
49
50
|
* @since 1.96
|
|
50
51
|
* @public
|
|
@@ -78,7 +79,7 @@ sap.ui.define([
|
|
|
78
79
|
* Creates a valid dataSource configuration
|
|
79
80
|
*
|
|
80
81
|
* @param {sap.ui.model.ListBinding|sap.ui.model.TreeBinding} oBinding - A subclass of <code>sap.ui.model.ListBinding</code> or <code>sap.ui.model.TreeBinding</code>
|
|
81
|
-
* @returns {
|
|
82
|
+
* @returns {object} - Valid data source configuration built upon the ListBinding
|
|
82
83
|
*/
|
|
83
84
|
PortableDocument.prototype.createDataSourceFromBinding = function(oBinding) {
|
|
84
85
|
|
|
@@ -135,8 +136,8 @@ sap.ui.define([
|
|
|
135
136
|
* Creates the DocumentDescription based on the given export
|
|
136
137
|
* settings and assigns a unique Id to it.
|
|
137
138
|
*
|
|
138
|
-
* @param {
|
|
139
|
-
* @returns {
|
|
139
|
+
* @param {object} mSettings Export settings
|
|
140
|
+
* @returns {object} DocumentDescription object that contains all relevant export settings
|
|
140
141
|
* @private
|
|
141
142
|
*/
|
|
142
143
|
PortableDocument.prototype._createDocumentDescription = function(mSettings) {
|
|
@@ -149,7 +150,14 @@ sap.ui.define([
|
|
|
149
150
|
"PaperSize": mSettings.paperSize,
|
|
150
151
|
"Orientation": mSettings.orientation,
|
|
151
152
|
"FontSize": Number(mSettings.fontSize),
|
|
152
|
-
"
|
|
153
|
+
"FitToPage": {
|
|
154
|
+
"IsEnabled": mSettings.fitToPage,
|
|
155
|
+
"MinimumFontSize": 4
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"PDFStandard": {
|
|
159
|
+
"DoEnableAccessibility": mSettings.doEnableAccessibility,
|
|
160
|
+
"UsePDFAConformance": mSettings.pdfArchive
|
|
153
161
|
},
|
|
154
162
|
"Signature": {
|
|
155
163
|
"DoSign": mSettings.signature,
|
|
@@ -192,7 +200,7 @@ sap.ui.define([
|
|
|
192
200
|
}
|
|
193
201
|
}
|
|
194
202
|
|
|
195
|
-
/* Eliminate duplicates
|
|
203
|
+
/* Eliminate duplicates before adding columns */
|
|
196
204
|
oWorkbook.columns.filter(function(oColumn, iIndex, aArray) {
|
|
197
205
|
var sProperty = Array.isArray(oColumn.property) ? oColumn.property[0] : oColumn.property;
|
|
198
206
|
|
|
@@ -200,7 +208,7 @@ sap.ui.define([
|
|
|
200
208
|
var sOtherProperty = Array.isArray(oOtherColumn.property) ? oOtherColumn.property[0] : oOtherColumn.property;
|
|
201
209
|
|
|
202
210
|
return sProperty === sOtherProperty;
|
|
203
|
-
}) === iIndex
|
|
211
|
+
}) === iIndex;
|
|
204
212
|
}).forEach(function(oColumn) {
|
|
205
213
|
oDocumentDescription["TableColumns"].push({
|
|
206
214
|
"Name": Array.isArray(oColumn.property) ? oColumn.property[0] : oColumn.property,
|
|
@@ -214,7 +222,7 @@ sap.ui.define([
|
|
|
214
222
|
/**
|
|
215
223
|
* Returns the name of the EntitySet that is being used with the given OData version.
|
|
216
224
|
*
|
|
217
|
-
* @param {
|
|
225
|
+
* @param {object} mDataSource DataSource object containing information about OData version
|
|
218
226
|
* @returns {string} Name of the EntitySet according to the OData version
|
|
219
227
|
*/
|
|
220
228
|
PortableDocument.prototype._getEntitySetName = function(mDataSource) {
|
|
@@ -226,7 +234,7 @@ sap.ui.define([
|
|
|
226
234
|
/**
|
|
227
235
|
* Returns the specific ODataModel that is being used for binding to the DocumentDescription EntitySet
|
|
228
236
|
*
|
|
229
|
-
* @param {
|
|
237
|
+
* @param {object} oDataSource DataSource settings of the export configuration
|
|
230
238
|
* @returns {ODataModel} ODataModel, either V2 or V4.
|
|
231
239
|
*/
|
|
232
240
|
PortableDocument.prototype._getModel = function(oDataSource) {
|
|
@@ -241,7 +249,7 @@ sap.ui.define([
|
|
|
241
249
|
/**
|
|
242
250
|
* Applies default settings to the export configuration.
|
|
243
251
|
*
|
|
244
|
-
* @param {
|
|
252
|
+
* @param {object} mSettings Export configuration object
|
|
245
253
|
* @returns {Promise} Promise that gets resolved when the default settings have been applied
|
|
246
254
|
*/
|
|
247
255
|
PortableDocument.prototype.setDefaultExportSettings = function(mSettings) {
|
|
@@ -251,7 +259,7 @@ sap.ui.define([
|
|
|
251
259
|
oContext = mSettings.workbook.context = {};
|
|
252
260
|
}
|
|
253
261
|
|
|
254
|
-
if (typeof oContext.title === 'string') {
|
|
262
|
+
if (typeof oContext.title === 'string' && oContext.title) {
|
|
255
263
|
return Promise.resolve();
|
|
256
264
|
}
|
|
257
265
|
|
|
@@ -265,71 +273,92 @@ sap.ui.define([
|
|
|
265
273
|
* DocumentDescription. The corresponding Id is assigned by
|
|
266
274
|
* the backend and passed to the event handler functions.
|
|
267
275
|
*
|
|
268
|
-
* @param {
|
|
269
|
-
* @param {
|
|
270
|
-
*
|
|
271
|
-
* @
|
|
276
|
+
* @param {object} oDocumentDescription DocumentDescription instance that is being created
|
|
277
|
+
* @param {object} oDataSource DataSource settings of the export configuration
|
|
278
|
+
*
|
|
279
|
+
* @returns {Promise} A Promise that resolves with the newly created Id of the DocumentDescription
|
|
272
280
|
*/
|
|
273
|
-
PortableDocument.prototype.postDocumentDescription = function(oDocumentDescription, oDataSource
|
|
281
|
+
PortableDocument.prototype.postDocumentDescription = function(oDocumentDescription, oDataSource) {
|
|
274
282
|
var oBinding, oModel, sPath;
|
|
275
283
|
|
|
276
284
|
oModel = this._getModel(oDataSource);
|
|
277
285
|
sPath = '/' + this._getEntitySetName(oDataSource);
|
|
278
286
|
|
|
279
287
|
if (!oModel || !oModel.isA(['sap.ui.model.odata.v4.ODataModel', 'sap.ui.model.odata.v2.ODataModel'])) {
|
|
280
|
-
|
|
288
|
+
return Promise.reject('Unsupported Model');
|
|
281
289
|
}
|
|
282
290
|
|
|
283
|
-
|
|
284
|
-
oBinding = oModel.bindList(sPath);
|
|
291
|
+
return new Promise(function(fnResolve, fnReject) {
|
|
285
292
|
|
|
286
|
-
|
|
287
|
-
|
|
293
|
+
if (oModel.isA('sap.ui.model.odata.v4.ODataModel')) {
|
|
294
|
+
oBinding = oModel.bindList(sPath);
|
|
288
295
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
} else {
|
|
292
|
-
fnError();
|
|
293
|
-
}
|
|
294
|
-
});
|
|
296
|
+
oBinding.attachCreateCompleted(function(oEvent) {
|
|
297
|
+
var success = oEvent.getParameter('success');
|
|
295
298
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
299
|
+
if (success) {
|
|
300
|
+
fnResolve(oEvent.getParameter('context').getObject()['Id']);
|
|
301
|
+
} else {
|
|
302
|
+
fnReject();
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
oBinding.create(oDocumentDescription);
|
|
307
|
+
} else {
|
|
308
|
+
var bUseBatch = oModel.bUseBatch;
|
|
309
|
+
|
|
310
|
+
oModel.setUseBatch(false);
|
|
311
|
+
oModel.create(sPath, oDocumentDescription, {
|
|
312
|
+
success: function(oData) {
|
|
313
|
+
oModel.setUseBatch(bUseBatch);
|
|
314
|
+
fnResolve(oData['Id']);
|
|
315
|
+
},
|
|
316
|
+
error: function(oError) {
|
|
317
|
+
oModel.setUseBatch(bUseBatch);
|
|
318
|
+
fnReject(oError);
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
});
|
|
312
323
|
};
|
|
313
324
|
|
|
314
325
|
/**
|
|
315
326
|
* Triggers the export process and returns a Promise the
|
|
316
327
|
* gets resolved as soon as the export is finished.
|
|
317
328
|
*
|
|
318
|
-
* @param {
|
|
329
|
+
* @param {object} mSettings Export settings
|
|
319
330
|
* @returns {Promise} Promise that is being resolved as soon as the PDF export is finished
|
|
320
331
|
*/
|
|
321
332
|
PortableDocument.prototype.createBuildPromise = function(mSettings) {
|
|
322
333
|
var that = this;
|
|
334
|
+
var oDocumentDescription;
|
|
335
|
+
var oBusyDialog;
|
|
336
|
+
var oResourceBundle = Core.getLibraryResourceBundle('sap.ui.export');
|
|
337
|
+
|
|
338
|
+
oBusyDialog = new sap.m.BusyDialog('PDFExportBusyDialog', {
|
|
339
|
+
title: oResourceBundle.getText('PROGRESS_TITLE'),
|
|
340
|
+
text: oResourceBundle.getText('PDF_GENERATION_IN_PROGRESS'),
|
|
341
|
+
showCancelButton: true,
|
|
342
|
+
close: function(oEvent) {
|
|
343
|
+
if (oEvent.getParameter('cancelPressed')) {
|
|
344
|
+
that.cancel();
|
|
345
|
+
oBusyDialog.destroy();
|
|
346
|
+
oBusyDialog = null;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
});
|
|
323
350
|
|
|
324
|
-
|
|
325
|
-
var oDocumentDescription;
|
|
351
|
+
oDocumentDescription = that._createDocumentDescription(mSettings);
|
|
326
352
|
|
|
327
|
-
|
|
328
|
-
|
|
353
|
+
return that.postDocumentDescription(oDocumentDescription, mSettings.dataSource).then(function(sDocumentDescriptionId) {
|
|
354
|
+
oBusyDialog.open();
|
|
329
355
|
|
|
330
|
-
|
|
331
|
-
return that.sendRequest(mSettings.dataSource.dataUrl, sDocumentDescriptionId).then(function(response) {
|
|
356
|
+
return oBusyDialog && that.sendRequest(mSettings.dataSource.dataUrl, sDocumentDescriptionId).then(function(response) {
|
|
332
357
|
ExportUtils.saveAsFile(response, mSettings.fileName);
|
|
358
|
+
oBusyDialog.destroy();
|
|
359
|
+
}).catch(function(oError) {
|
|
360
|
+
oBusyDialog.destroy();
|
|
361
|
+
sap.m.MessageToast.show('Error during PDF export!');
|
|
333
362
|
});
|
|
334
363
|
});
|
|
335
364
|
};
|
|
@@ -348,8 +377,8 @@ sap.ui.define([
|
|
|
348
377
|
/* Send GET request to receive PDF file */
|
|
349
378
|
oXHR.open('GET', sUrl);
|
|
350
379
|
oXHR.responseType = 'blob';
|
|
351
|
-
oXHR.setRequestHeader(
|
|
352
|
-
oXHR.setRequestHeader(
|
|
380
|
+
oXHR.setRequestHeader('Accept', this.getMimeType());
|
|
381
|
+
oXHR.setRequestHeader('SAP-Document-Description-Id', sDocumentDescriptionId);
|
|
353
382
|
|
|
354
383
|
oXHR.addEventListener('abort', function() {
|
|
355
384
|
fnReject('Request aborted');
|
|
@@ -373,6 +402,15 @@ sap.ui.define([
|
|
|
373
402
|
}.bind(this));
|
|
374
403
|
};
|
|
375
404
|
|
|
405
|
+
/**
|
|
406
|
+
* Returns the specific MIME type
|
|
407
|
+
*
|
|
408
|
+
* @returns {string} MIME type for Portable Document Format
|
|
409
|
+
*/
|
|
410
|
+
PortableDocument.prototype.getMimeType = function() {
|
|
411
|
+
return 'application/pdf';
|
|
412
|
+
};
|
|
413
|
+
|
|
376
414
|
/**
|
|
377
415
|
* Cancels the active request. If the request has not been sent
|
|
378
416
|
* or the response has been received already, this function has
|
|
@@ -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.
|
|
86
|
+
* <li><code>version</code> (string) - Application version that creates the XLSX document (default: "1.102.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.
|
|
169
|
+
* version: '1.102.1',
|
|
170
170
|
* title: 'Some random title',
|
|
171
171
|
* modifiedBy: 'John Doe',
|
|
172
172
|
* metaSheetName: 'Custom metadata',
|
|
@@ -248,10 +248,10 @@ sap.ui.define([
|
|
|
248
248
|
* object are limited to 31 characters each. If their value exceeds
|
|
249
249
|
* this maximum length, the value will be truncated.
|
|
250
250
|
*
|
|
251
|
-
* @param {
|
|
252
|
-
* @param {
|
|
251
|
+
* @param {object} mSettings - Export settings
|
|
252
|
+
* @param {object} mSettings.workbook - Spreadsheet properties
|
|
253
253
|
* @param {Array} mSettings.workbook.columns - Column configuration
|
|
254
|
-
* @param {
|
|
254
|
+
* @param {object} [mSettings.workbook.context] - Export context that will be applied to the exported file
|
|
255
255
|
* @param {string} [mSettings.workbook.context.application] - Application that created this XLSX
|
|
256
256
|
* @param {string} [mSettings.workbook.context.version] - Application version that was used to create this XLSX
|
|
257
257
|
* @param {string} [mSettings.workbook.context.title] - Title of the XLSX document (NOT the file name)
|
|
@@ -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.
|
|
281
|
+
* @version 1.102.1
|
|
282
282
|
*
|
|
283
283
|
* @since 1.50
|
|
284
284
|
* @name sap.ui.export.Spreadsheet
|
|
@@ -331,7 +331,7 @@ sap.ui.define([
|
|
|
331
331
|
*
|
|
332
332
|
* @function
|
|
333
333
|
* @name sap.ui.export.Spreadsheet#setDefaultExportSettings
|
|
334
|
-
* @param {
|
|
334
|
+
* @param {object} mParameters - Export parameters object
|
|
335
335
|
* @returns {Promise} Promise object
|
|
336
336
|
* @private
|
|
337
337
|
*/
|
|
@@ -396,7 +396,7 @@ sap.ui.define([
|
|
|
396
396
|
* the ODataMetaModel and attaches it to the export settings.
|
|
397
397
|
*
|
|
398
398
|
* @param {sap.ui.model.odata.ODataMetaModel} oMetaModel - ODataMetaModel instance that is used to request service specific code lists.
|
|
399
|
-
* @param {
|
|
399
|
+
* @param {object} mSettings - Export settings that will receive the code lists
|
|
400
400
|
* @returns {Promise} The returned Promise will always resolve with an Array
|
|
401
401
|
*/
|
|
402
402
|
Spreadsheet.requestCodeLists = function(oMetaModel) {
|
|
@@ -415,14 +415,17 @@ sap.ui.define([
|
|
|
415
415
|
|
|
416
416
|
/**
|
|
417
417
|
* The <code>beforeSave</code> event is fired just before the generated file is saved to the file system.
|
|
418
|
+
* This event allows you to prevent the default action that closes the <code>ExportDialog</code> and
|
|
419
|
+
* saves the file to your local device. If the default is prevented, the event handler is responsible
|
|
420
|
+
* for closing and destroying the <code>Dialog</code>.
|
|
418
421
|
*
|
|
419
422
|
* @name sap.ui.export.Spreadsheet#beforeSave
|
|
420
423
|
* @event
|
|
421
424
|
* @param {sap.ui.base.Event} oEvent
|
|
422
425
|
* @param {sap.ui.base.EventProvider} oEvent.getSource
|
|
423
426
|
* @param {object} oEvent.getParameters
|
|
424
|
-
*
|
|
425
427
|
* @param {ArrayBuffer} oEvent.getParameter.data The data parameter contains the generated file
|
|
428
|
+
* @param {sap.ui.export.ExportDialog} oEvent.getParameter.exportDialog The export dialog instance
|
|
426
429
|
*
|
|
427
430
|
* @since 1.61
|
|
428
431
|
* @public
|
|
@@ -488,6 +491,15 @@ sap.ui.define([
|
|
|
488
491
|
return this;
|
|
489
492
|
};
|
|
490
493
|
|
|
494
|
+
/**
|
|
495
|
+
* Returns the specific MIME type
|
|
496
|
+
*
|
|
497
|
+
* @returns {string} MIME type for Office Open XML Spreadsheet
|
|
498
|
+
*/
|
|
499
|
+
Spreadsheet.prototype.getMimeType = function() {
|
|
500
|
+
return 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
|
|
501
|
+
};
|
|
502
|
+
|
|
491
503
|
/**
|
|
492
504
|
* Progress callback. The function is called when the progress status changes.
|
|
493
505
|
*
|
|
@@ -512,7 +524,7 @@ sap.ui.define([
|
|
|
512
524
|
* Creates a valid dataSource configuration
|
|
513
525
|
*
|
|
514
526
|
* @param {sap.ui.model.ListBinding|sap.ui.model.TreeBinding} oBinding - A subclass of <code>sap.ui.model.ListBinding</code> or <code>sap.ui.model.TreeBinding</code>
|
|
515
|
-
* @returns {
|
|
527
|
+
* @returns {object} - Valid data source configuration built upon the ListBinding
|
|
516
528
|
*/
|
|
517
529
|
Spreadsheet.prototype.createDataSourceFromBinding = function(oBinding) {
|
|
518
530
|
/**
|
|
@@ -577,7 +589,7 @@ sap.ui.define([
|
|
|
577
589
|
* @param {string|Array|Object|sap.ui.model.ListBinding|sap.ui.model.TreeBinding} oDataSource Possible types are a plain
|
|
578
590
|
* string that contains an URL of an OData service, an array of JSON objects, a data source configuration,
|
|
579
591
|
* a <code>sap.ui.model.ListBinding</code> or <code>sap.ui.model.TreeBinding</code>
|
|
580
|
-
* @returns {
|
|
592
|
+
* @returns {object|null} - Valid dataSource object or null in case the dataSource configuration is not supported
|
|
581
593
|
*
|
|
582
594
|
* @since 1.73
|
|
583
595
|
* @public
|
|
@@ -625,7 +637,7 @@ sap.ui.define([
|
|
|
625
637
|
*
|
|
626
638
|
* @function
|
|
627
639
|
* @name sap.ui.export.Spreadsheet#createBuildPromise
|
|
628
|
-
* @param {
|
|
640
|
+
* @param {object} mParameters - Export parameters object
|
|
629
641
|
* @returns {Promise} Promise object
|
|
630
642
|
* @private
|
|
631
643
|
*/
|
|
@@ -662,20 +674,21 @@ sap.ui.define([
|
|
|
662
674
|
}
|
|
663
675
|
|
|
664
676
|
var executeDefaultAction = that.fireEvent('beforeSave', {
|
|
665
|
-
data: oMessage.spreadsheet
|
|
677
|
+
data: oMessage.spreadsheet,
|
|
678
|
+
exportDialog: progressDialog
|
|
666
679
|
}, true, true);
|
|
667
680
|
|
|
668
|
-
/*
|
|
669
|
-
* Keep the progress dialog open for 1 second to avoid
|
|
670
|
-
* screen flickering in case of extremely fast exports
|
|
671
|
-
*/
|
|
672
|
-
if (progressDialog) {
|
|
673
|
-
window.setTimeout(progressDialog.finish, 1000);
|
|
674
|
-
}
|
|
675
|
-
|
|
676
681
|
if (executeDefaultAction) {
|
|
682
|
+
/*
|
|
683
|
+
* Keep the progress dialog open for 1 second to avoid
|
|
684
|
+
* screen flickering in case of extremely fast exports
|
|
685
|
+
*/
|
|
686
|
+
if (progressDialog) {
|
|
687
|
+
window.setTimeout(progressDialog.finish, 1000);
|
|
688
|
+
}
|
|
689
|
+
|
|
677
690
|
ExportUtils.saveAsFile(new Blob([oMessage.spreadsheet], {
|
|
678
|
-
type:
|
|
691
|
+
type: that.getMimeType()
|
|
679
692
|
}), mParameters.fileName);
|
|
680
693
|
}
|
|
681
694
|
|
|
@@ -4,46 +4,56 @@
|
|
|
4
4
|
<Label text="{i18n>FILE_NAME}" labelFor="exportSettingsDialog-fileName"/>
|
|
5
5
|
<Input id="exportSettingsDialog-fileName" value="{/fileName}" liveChange=".onFileNameChange" class="sapUiTinyMarginBottom"/>
|
|
6
6
|
|
|
7
|
-
<Label text="{i18n>SELECT_FORMAT}" labelFor="exportSettingsDialog-fileType"
|
|
8
|
-
<Select id="exportSettingsDialog-fileType" selectedKey="{/
|
|
7
|
+
<Label text="{i18n>SELECT_FORMAT}" labelFor="exportSettingsDialog-fileType"/>
|
|
8
|
+
<Select id="exportSettingsDialog-fileType" selectedKey="{/fileType}" items="{path: '/fileTypeCollection'}" change=".onFileTypeChange" width="100%" class="sapUiTinyMarginBottom">
|
|
9
9
|
<items>
|
|
10
10
|
<core:Item key="{key}" text="{text}"/>
|
|
11
11
|
</items>
|
|
12
12
|
</Select>
|
|
13
13
|
|
|
14
|
-
<
|
|
15
|
-
<
|
|
14
|
+
<Label text="{i18n>SELECT_DESTINATION}" labelFor="exportSettingsDialog-destination" visible="{parts: ['/fileType', '/destinationCollection'], formatter: '.hasDestinations'}"/>
|
|
15
|
+
<Select id="exportSettingsDialog-destination" selectedKey="{/destination}" items="{path: '/destinationCollection'}" visible="{parts: ['/fileType', '/destinationCollection'], formatter: '.hasDestinations'}" width="100%" class="sapUiTinyMarginBottom">
|
|
16
|
+
<items>
|
|
17
|
+
<core:Item key="{key}" text="{text}"/>
|
|
18
|
+
</items>
|
|
19
|
+
</Select>
|
|
20
|
+
|
|
21
|
+
<CheckBox id="exportSettingsDialog-includeFilterSettings" selected="{/includeFilterSettings}" text="{i18n>INCLUDE_FILTER_SETTINGS}" visible="{path:'/fileType', formatter: '.isXLSX'}"/>
|
|
22
|
+
<CheckBox id="exportSettingsDialog-includeFilterSettings-PDF" enabled="{/capabilities/PDF/CoverPage}" selected="{/includeFilterSettings}" text="{i18n>INCLUDE_FILTER_SETTINGS}" visible="{path:'/fileType', formatter: '.isPDF'}" tooltip="{i18n>TOOLTIP_FILTER_SETTINGS}"/>
|
|
23
|
+
<CheckBox id="exportSettingsDialog-pdfArchive" enabled="{/capabilities/PDF/ArchiveFormat}" selected="{/pdfArchive}" text="{i18n>ARCHIVE_FORMAT}" visible="{path:'/fileType', formatter: '.isPDF'}" tooltip="{i18n>TOOLTIP_ARCHIVE_FORMAT}"/>
|
|
24
|
+
<CheckBox id="exportSettingsDialog-splitCells" selected="{/splitCells}" text="{i18n>SPLIT_CELLS}" visible="{path:'/fileType', formatter: '.isXLSX'}"/> <!-- Will be hidden in case of PDF because it needs to be always true -->
|
|
16
25
|
<CheckBox id="exportSettingsDialog-addDateTime" selected="{/addDateTime}" text="{i18n>ADD_DATE_TIME}" visible="false"/>
|
|
17
26
|
|
|
18
27
|
<!-- PDF Specific settings -->
|
|
19
|
-
<Label text="{i18n>PAPER_SIZE}" labelFor="exportSettingsDialog-papersize" visible="{path:'/
|
|
20
|
-
<Select id="exportSettingsDialog-papersize" selectedKey="{/
|
|
28
|
+
<Label text="{i18n>PAPER_SIZE}" labelFor="exportSettingsDialog-papersize" visible="{path:'/fileType', formatter: '.isPDF'}"/>
|
|
29
|
+
<Select id="exportSettingsDialog-papersize" selectedKey="{/paperSize}" items="{path: '/paperSizeCollection'}" width="100%" visible="{path:'/fileType', formatter: '.isPDF'}" class="sapUiTinyMarginBottom">
|
|
21
30
|
<items>
|
|
22
31
|
<core:Item key="{key}" text="{text}"/>
|
|
23
32
|
</items>
|
|
24
33
|
</Select>
|
|
25
34
|
|
|
26
|
-
<Label text="{i18n>ORIENTATION}" labelFor="exportSettingsDialog-orientation" visible="{path:'/
|
|
27
|
-
<Select id="exportSettingsDialog-orientation" selectedKey="{/
|
|
35
|
+
<Label text="{i18n>ORIENTATION}" labelFor="exportSettingsDialog-orientation" visible="{path:'/fileType', formatter: '.isPDF'}"/>
|
|
36
|
+
<Select id="exportSettingsDialog-orientation" selectedKey="{/orientation}" items="{path: '/orientationCollection'}" width="100%" visible="{path:'/fileType', formatter: '.isPDF'}" class="sapUiTinyMarginBottom">
|
|
28
37
|
<items>
|
|
29
38
|
<core:Item key="{key}" text="{text}"/>
|
|
30
39
|
</items>
|
|
31
40
|
</Select>
|
|
32
41
|
|
|
33
|
-
<Label text="{i18n>FONT_SIZE}" labelFor="exportSettingsDialog-fontSize" visible="{path:'/
|
|
34
|
-
<Input id="exportSettingsDialog-fontSize" value="{/fontSize}" liveChange=".onFontSizeChange" class="sapUiTinyMarginBottom" visible="{path:'/
|
|
42
|
+
<Label text="{i18n>FONT_SIZE}" labelFor="exportSettingsDialog-fontSize" visible="{path:'/fileType', formatter: '.isPDF'}"/>
|
|
43
|
+
<Input id="exportSettingsDialog-fontSize" value="{/fontSize}" enabled="{/capabilities/PDF/FontSize}" liveChange=".onFontSizeChange" class="sapUiTinyMarginBottom" visible="{path:'/fileType', formatter: '.isPDF'}" tooltip="{i18n>TOOLTIP_FONT_SIZE}"/>
|
|
35
44
|
|
|
36
|
-
<CheckBox id="exportSettingsDialog-accessibility"
|
|
37
|
-
<CheckBox id="exportSettingsDialog-
|
|
45
|
+
<CheckBox id="exportSettingsDialog-accessibility" selected="{/doEnableAccessibility}" text="{i18n>ENABLE_ACCESSIBILITY}" tooltip="{i18n>TOOLTIP_PDF_ACCESSIBILITY}" visible="{path:'/fileType', formatter: '.isPDF'}"/>
|
|
46
|
+
<CheckBox id="exportSettingsDialog-fitToPage" enabled="{/capabilities/PDF/FitToPage}" selected="{/fitToPage}" text="{i18n>FITTOPAGE}" tooltip="{i18n>TOOLTIP_FITTOPAGE}" visible="{path:'/fileType', formatter: '.isPDF'}"/>
|
|
47
|
+
<CheckBox id="exportSettingsDialog-signature" enabled="{/capabilities/PDF/Signature}" selected="{/signature}" text="{i18n>ENABLE_SIGNATURE}" tooltip="{i18n>TOOLTIP_PDF_SIGNATURE}" visible="{path:'/fileType', formatter: '.isPDF'}"/>
|
|
38
48
|
|
|
39
49
|
<Label id="exportSettingsDialog-signatureReasonLabel" text="{i18n>SIGNATURE_REASON}" labelFor="exportSettingsDialog-signatureReason" visible="{/signature}"/>
|
|
40
50
|
<Input id="exportSettingsDialog-signatureReason" value="{/signatureReason}" class="sapUiTinyMarginBottom" visible="{/signature}"/>
|
|
41
51
|
</VBox>
|
|
42
52
|
</content>
|
|
43
53
|
<beginButton>
|
|
44
|
-
<Button id="exportSettingsDialog-exportButton" press=".onExport" text="{
|
|
54
|
+
<Button id="exportSettingsDialog-exportButton" press=".onExport" text="{path:'/destination', formatter:'.formatExportButton'}" type="Emphasized"/>
|
|
45
55
|
</beginButton>
|
|
46
56
|
<endButton>
|
|
47
|
-
<Button id="exportSettingsDialog-cancelButton" press=".onCancel" text="{i18n>CANCEL_BUTTON}"/>
|
|
57
|
+
<Button id="exportSettingsDialog-cancelButton" press=".onCancel" text="{i18n>CANCEL_BUTTON}" type="Transparent"/>
|
|
48
58
|
</endButton>
|
|
49
59
|
</Dialog>
|