@sapui5/sap.ui.export 1.97.1 → 1.100.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/sap/ui/export/.library +2 -2
- package/src/sap/ui/export/ExportBase.js +2 -2
- package/src/sap/ui/export/ExportDialog.js +1 -1
- package/src/sap/ui/export/ExportUtils.js +175 -152
- package/src/sap/ui/export/PortableDocument.js +66 -29
- package/src/sap/ui/export/Spreadsheet.js +4 -4
- package/src/sap/ui/export/SpreadsheetExport.js +3 -4
- package/src/sap/ui/export/fragments/SettingsDialog.fragment.xml +49 -0
- 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/js/libs/JSZip3.js +3 -3
- package/src/sap/ui/export/library.js +3 -3
- package/src/sap/ui/export/messagebundle.properties +45 -6
- package/src/sap/ui/export/messagebundle_ar.properties +30 -2
- package/src/sap/ui/export/messagebundle_bg.properties +33 -5
- package/src/sap/ui/export/messagebundle_ca.properties +30 -2
- package/src/sap/ui/export/messagebundle_cs.properties +30 -2
- package/src/sap/ui/export/messagebundle_cy.properties +30 -2
- package/src/sap/ui/export/messagebundle_da.properties +30 -2
- package/src/sap/ui/export/messagebundle_de.properties +30 -2
- package/src/sap/ui/export/messagebundle_el.properties +30 -2
- package/src/sap/ui/export/messagebundle_en.properties +30 -2
- package/src/sap/ui/export/messagebundle_en_GB.properties +30 -2
- package/src/sap/ui/export/messagebundle_en_US_sappsd.properties +30 -4
- package/src/sap/ui/export/messagebundle_en_US_saprigi.properties +34 -4
- package/src/sap/ui/export/messagebundle_en_US_saptrc.properties +32 -4
- package/src/sap/ui/export/messagebundle_es.properties +30 -2
- package/src/sap/ui/export/messagebundle_es_MX.properties +30 -2
- package/src/sap/ui/export/messagebundle_et.properties +30 -2
- package/src/sap/ui/export/messagebundle_fi.properties +31 -3
- package/src/sap/ui/export/messagebundle_fr.properties +30 -2
- package/src/sap/ui/export/messagebundle_fr_CA.properties +30 -2
- package/src/sap/ui/export/messagebundle_hi.properties +30 -2
- package/src/sap/ui/export/messagebundle_hr.properties +30 -2
- package/src/sap/ui/export/messagebundle_hu.properties +30 -2
- package/src/sap/ui/export/messagebundle_id.properties +30 -2
- package/src/sap/ui/export/messagebundle_it.properties +30 -2
- package/src/sap/ui/export/messagebundle_iw.properties +30 -2
- package/src/sap/ui/export/messagebundle_ja.properties +30 -2
- package/src/sap/ui/export/messagebundle_kk.properties +30 -2
- package/src/sap/ui/export/messagebundle_ko.properties +30 -2
- package/src/sap/ui/export/messagebundle_lt.properties +30 -2
- package/src/sap/ui/export/messagebundle_lv.properties +30 -2
- package/src/sap/ui/export/messagebundle_ms.properties +31 -3
- package/src/sap/ui/export/messagebundle_nl.properties +30 -2
- package/src/sap/ui/export/messagebundle_no.properties +30 -2
- package/src/sap/ui/export/messagebundle_pl.properties +30 -2
- package/src/sap/ui/export/messagebundle_pt.properties +30 -2
- package/src/sap/ui/export/messagebundle_pt_PT.properties +30 -2
- package/src/sap/ui/export/messagebundle_ro.properties +30 -2
- package/src/sap/ui/export/messagebundle_ru.properties +30 -2
- package/src/sap/ui/export/messagebundle_sh.properties +30 -2
- package/src/sap/ui/export/messagebundle_sk.properties +30 -2
- package/src/sap/ui/export/messagebundle_sl.properties +30 -2
- package/src/sap/ui/export/messagebundle_sv.properties +30 -2
- package/src/sap/ui/export/messagebundle_th.properties +30 -2
- package/src/sap/ui/export/messagebundle_tr.properties +30 -2
- package/src/sap/ui/export/messagebundle_uk.properties +30 -2
- package/src/sap/ui/export/messagebundle_vi.properties +30 -2
- package/src/sap/ui/export/messagebundle_zh_CN.properties +30 -2
- package/src/sap/ui/export/messagebundle_zh_TW.properties +30 -2
- package/src/sap/ui/export/provider/DataProviderBase.js +2 -2
- package/src/sap/ui/export/themes/base/ExportUtils.less +1 -1
- package/src/sap/ui/export/themes/base/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_belize/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_belize_hcb/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_belize_hcw/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_belize_plus/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_bluecrystal/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_fiori_3/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_fiori_3_dark/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_fiori_3_hcb/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_fiori_3_hcw/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_hcb/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_horizon/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_horizon_dark/library.source.less +8 -0
- package/src/sap/ui/export/themes/sap_horizon_hcb/library.source.less +8 -0
- package/src/sap/ui/export/themes/sap_horizon_hcw/library.source.less +8 -0
package/package.json
CHANGED
|
@@ -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-
|
|
8
|
-
<version>1.
|
|
7
|
+
* (c) Copyright 2009-2022 SAP SE. All rights reserved.</copyright>
|
|
8
|
+
<version>1.100.0</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-
|
|
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.
|
|
18
|
+
* @version 1.100.0
|
|
19
19
|
*
|
|
20
20
|
* @since 1.96
|
|
21
21
|
* @name sap.ui.export.ExportBase
|
|
@@ -1,35 +1,25 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* SAPUI5
|
|
3
|
-
* (c) Copyright 2009-
|
|
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/
|
|
12
|
-
'sap/ui/core/
|
|
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/
|
|
16
|
-
'sap/
|
|
17
|
-
'sap/
|
|
18
|
-
|
|
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
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
53
|
+
fileType: [],
|
|
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
|
-
|
|
71
|
-
oDefaultConfig.fileType.push({key:
|
|
72
|
-
}
|
|
74
|
+
aSupportedFormats.forEach(function(sFormat) {
|
|
75
|
+
oDefaultConfig.fileType.push({key: sFormat.toUpperCase()});
|
|
76
|
+
});
|
|
73
77
|
|
|
74
78
|
var oExportConfig = Object.assign({}, oDefaultConfig, oCustomConfig || {});
|
|
75
79
|
|
|
@@ -77,7 +81,7 @@ sap.ui.define([
|
|
|
77
81
|
sSelectedKey = null;
|
|
78
82
|
|
|
79
83
|
if (!oExportConfig.fileType[i].text) {
|
|
80
|
-
oExportConfig.fileType[i].text = oResourceBundle.getText(oExportConfig.fileType[i].key
|
|
84
|
+
oExportConfig.fileType[i].text = oResourceBundle.getText(oExportConfig.fileType[i].key + '_FILETYPE');
|
|
81
85
|
}
|
|
82
86
|
if (oExportConfig.fileType[i].key === oExportConfig.selectedFileType) {
|
|
83
87
|
sSelectedKey = oExportConfig.fileType[i].key;
|
|
@@ -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.
|
|
111
|
+
* @version 1.100.0
|
|
98
112
|
*
|
|
99
113
|
* @since 1.59
|
|
100
114
|
* @name sap.ui.export.ExportUtils
|
|
@@ -146,146 +160,137 @@ sap.ui.define([
|
|
|
146
160
|
* Creates the Export settings dialog that can be used for configuring the spreadsheet before exporting.
|
|
147
161
|
*
|
|
148
162
|
* @param {Object} mCustomConfig Initial configuration of the settings dialog
|
|
149
|
-
* @param {
|
|
150
|
-
* @param {
|
|
151
|
-
* @param {
|
|
163
|
+
* @param {Object} oExportCapabilities Definition of supported export features
|
|
164
|
+
* @param {sap.ui.core.Control} [oOpener] The opener of the dialog
|
|
165
|
+
* @param {function(sap.m.Dialog)} [fnCallback] Handler function that is called once the dialog has been opened. A reference to the dialog is passed as parameter
|
|
152
166
|
*
|
|
153
167
|
* @returns {Promise} Promise which resolves with the export settings defined by the user
|
|
154
168
|
*
|
|
155
169
|
* @static
|
|
156
170
|
*/
|
|
157
|
-
getExportSettingsViaDialog: function(mCustomConfig, oOpener, fnCallback
|
|
171
|
+
getExportSettingsViaDialog: function(mCustomConfig, oExportCapabilities, oOpener, fnCallback) {
|
|
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
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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 === FileType.PDF;
|
|
186
|
+
},
|
|
187
|
+
isXLSX: function(sValue) {
|
|
188
|
+
return sValue === FileType.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() === FileType.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
|
-
|
|
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
|
-
|
|
283
|
-
|
|
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.
|
|
937
|
+
* @param {string} [oContext.version] Application version (default: "1.100.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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* SAPUI5
|
|
3
|
-
* (c) Copyright 2009-
|
|
3
|
+
* (c) Copyright 2009-2022 SAP SE. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
sap.ui.define([
|
|
@@ -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.
|
|
19
|
+
* @version 1.100.0
|
|
20
20
|
*
|
|
21
21
|
* @since 1.96
|
|
22
|
-
* @
|
|
23
|
-
* @extends sap.ui.
|
|
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', '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}
|
|
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(
|
|
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":
|
|
142
|
-
"Orientation":
|
|
143
|
-
"FontSize":
|
|
149
|
+
"PaperSize": mSettings.paperSize,
|
|
150
|
+
"Orientation": mSettings.orientation,
|
|
151
|
+
"FontSize": Number(mSettings.fontSize),
|
|
152
|
+
"DoEnableAccessibility": mSettings.doEnableAccessibility
|
|
144
153
|
},
|
|
145
154
|
"Signature": {
|
|
146
|
-
"DoSign":
|
|
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.
|
|
162
|
+
oMetaInfo = oWorkbook.context.metainfo;
|
|
154
163
|
|
|
155
164
|
/* Add metaInfo to CoverPage */
|
|
156
165
|
if (oMetaInfo instanceof Array) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
"
|
|
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
|
-
|
|
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
|
-
/*
|
|
174
|
-
oWorkbook.columns.
|
|
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:
|
|
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
|
|
327
|
+
oDocumentDescription = that._createDocumentDescription(mSettings);
|
|
291
328
|
that.postDocumentDescription(oDocumentDescription, mSettings.dataSource, fnResolve, fnReject);
|
|
292
329
|
|
|
293
330
|
}).then(function(sDocumentDescriptionId) {
|