@sapui5/sap.ui.export 1.94.0 → 1.97.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 +45 -47
- package/src/sap/ui/export/ExportBase.js +197 -0
- package/src/sap/ui/export/ExportUtils.js +106 -23
- package/src/sap/ui/export/PortableDocument.js +371 -0
- package/src/sap/ui/export/Spreadsheet.js +36 -162
- package/src/sap/ui/export/SpreadsheetExport.js +136 -148
- package/src/sap/ui/export/js/SpreadsheetWorker.js +0 -1
- 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 +9 -2
- package/src/sap/ui/export/messagebundle.properties +3 -0
- package/src/sap/ui/export/messagebundle_ar.properties +2 -0
- package/src/sap/ui/export/messagebundle_bg.properties +2 -0
- package/src/sap/ui/export/messagebundle_ca.properties +2 -0
- package/src/sap/ui/export/messagebundle_cs.properties +2 -0
- package/src/sap/ui/export/messagebundle_cy.properties +2 -0
- package/src/sap/ui/export/messagebundle_da.properties +2 -0
- package/src/sap/ui/export/messagebundle_de.properties +2 -0
- package/src/sap/ui/export/messagebundle_el.properties +2 -0
- package/src/sap/ui/export/messagebundle_en.properties +2 -0
- package/src/sap/ui/export/messagebundle_en_GB.properties +2 -0
- package/src/sap/ui/export/messagebundle_en_US_sappsd.properties +2 -0
- package/src/sap/ui/export/messagebundle_en_US_saptrc.properties +2 -0
- package/src/sap/ui/export/messagebundle_es.properties +2 -0
- package/src/sap/ui/export/messagebundle_es_MX.properties +2 -0
- package/src/sap/ui/export/messagebundle_et.properties +2 -0
- package/src/sap/ui/export/messagebundle_fi.properties +2 -0
- package/src/sap/ui/export/messagebundle_fr.properties +2 -0
- package/src/sap/ui/export/messagebundle_fr_CA.properties +2 -0
- package/src/sap/ui/export/messagebundle_hi.properties +2 -0
- package/src/sap/ui/export/messagebundle_hr.properties +2 -0
- package/src/sap/ui/export/messagebundle_hu.properties +2 -0
- package/src/sap/ui/export/messagebundle_id.properties +2 -0
- package/src/sap/ui/export/messagebundle_it.properties +3 -1
- package/src/sap/ui/export/messagebundle_iw.properties +2 -0
- package/src/sap/ui/export/messagebundle_ja.properties +2 -0
- package/src/sap/ui/export/messagebundle_kk.properties +2 -0
- package/src/sap/ui/export/messagebundle_ko.properties +2 -0
- package/src/sap/ui/export/messagebundle_lt.properties +2 -0
- package/src/sap/ui/export/messagebundle_lv.properties +2 -0
- package/src/sap/ui/export/messagebundle_ms.properties +2 -0
- package/src/sap/ui/export/messagebundle_nl.properties +2 -0
- package/src/sap/ui/export/messagebundle_no.properties +2 -0
- package/src/sap/ui/export/messagebundle_pl.properties +2 -0
- package/src/sap/ui/export/messagebundle_pt.properties +2 -0
- package/src/sap/ui/export/messagebundle_pt_PT.properties +2 -0
- package/src/sap/ui/export/messagebundle_ro.properties +2 -0
- package/src/sap/ui/export/messagebundle_ru.properties +4 -2
- package/src/sap/ui/export/messagebundle_sh.properties +2 -0
- package/src/sap/ui/export/messagebundle_sk.properties +4 -2
- package/src/sap/ui/export/messagebundle_sl.properties +2 -0
- package/src/sap/ui/export/messagebundle_sv.properties +2 -0
- package/src/sap/ui/export/messagebundle_th.properties +2 -0
- package/src/sap/ui/export/messagebundle_tr.properties +2 -0
- package/src/sap/ui/export/messagebundle_uk.properties +2 -0
- package/src/sap/ui/export/messagebundle_vi.properties +2 -0
- package/src/sap/ui/export/messagebundle_zh_CN.properties +2 -0
- package/src/sap/ui/export/messagebundle_zh_TW.properties +2 -0
- package/src/sap/ui/export/provider/DataProviderBase.js +29 -30
- package/src/sap/ui/export/themes/sap_horizon/library.source.less +8 -0
- package/ui5.yaml +6 -4
- package/src/sap/ui/export/js/libs/uri.all.min.js +0 -3
- package/src/sap/ui/export/js/libs/uri.all.min.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,47 +1,45 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" ?>
|
|
2
|
-
<library xmlns="http://www.sap.com/sap.ui.library.xsd">
|
|
3
|
-
|
|
4
|
-
<name>sap.ui.export</name>
|
|
5
|
-
<vendor>SAP SE</vendor>
|
|
6
|
-
<copyright>SAPUI5
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
</library>
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
|
2
|
+
<library xmlns="http://www.sap.com/sap.ui.library.xsd">
|
|
3
|
+
|
|
4
|
+
<name>sap.ui.export</name>
|
|
5
|
+
<vendor>SAP SE</vendor>
|
|
6
|
+
<copyright>SAPUI5
|
|
7
|
+
* (c) Copyright 2009-2021 SAP SE. All rights reserved.</copyright>
|
|
8
|
+
<version>1.97.0</version>
|
|
9
|
+
|
|
10
|
+
<documentation>UI5 library: sap.ui.export</documentation>
|
|
11
|
+
|
|
12
|
+
<dependencies>
|
|
13
|
+
<dependency>
|
|
14
|
+
<libraryName>sap.ui.core</libraryName>
|
|
15
|
+
</dependency>
|
|
16
|
+
</dependencies>
|
|
17
|
+
|
|
18
|
+
<appData>
|
|
19
|
+
<!-- excludes for the JSDoc -->
|
|
20
|
+
<jsdoc xmlns="http://www.sap.com/ui5/buildext/jsdoc">
|
|
21
|
+
<exclude name="sap.ui.export.js."/>
|
|
22
|
+
</jsdoc>
|
|
23
|
+
<documentation xmlns="http://www.sap.com/ui5/buildext/documentation"
|
|
24
|
+
indexUrl="../../../../test-resources/sap/ui/export/demokit/docuindex.json" resolve="lib"/>
|
|
25
|
+
<releasenotes xmlns="http://www.sap.com/ui5/buildext/releasenotes"
|
|
26
|
+
url="../../../../test-resources/sap/ui/export/relnotes/changes-{major}.{minor}.json" resolve="lib"/>
|
|
27
|
+
<!-- excludes for the JSCoverage -->
|
|
28
|
+
<jscoverage xmlns="http://www.sap.com/ui5/buildext/jscoverage">
|
|
29
|
+
<exclude name="sap.ui.export.js."/>
|
|
30
|
+
</jscoverage>
|
|
31
|
+
<packaging xmlns="http://www.sap.com/ui5/buildext/packaging" version="2.0">
|
|
32
|
+
<module-infos>
|
|
33
|
+
<raw-module name="sap/ui/export/js/XLSXBuilder.js" requiresTopLevelScope="false" />
|
|
34
|
+
</module-infos>
|
|
35
|
+
<all-in-one>
|
|
36
|
+
<!-- exclude third party bundles and the worker code -->
|
|
37
|
+
<exclude name="sap/ui/export/js/**" />
|
|
38
|
+
</all-in-one>
|
|
39
|
+
</packaging>
|
|
40
|
+
<ownership xmlns="http://www.sap.com/ui5/buildext/ownership">
|
|
41
|
+
<component>CA-UI5-TBL</component><!-- default component for library -->
|
|
42
|
+
</ownership>
|
|
43
|
+
</appData>
|
|
44
|
+
|
|
45
|
+
</library>
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SAPUI5
|
|
3
|
+
* (c) Copyright 2009-2021 SAP SE. All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
sap.ui.define([
|
|
7
|
+
'sap/ui/core/Core',
|
|
8
|
+
'sap/ui/base/EventProvider',
|
|
9
|
+
'sap/base/Log',
|
|
10
|
+
'sap/ui/export/ExportUtils'
|
|
11
|
+
], function(Core, EventProvider, Log, ExportUtils) {
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
/**
|
|
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
|
+
*
|
|
17
|
+
* @author SAP SE
|
|
18
|
+
* @version 1.97.0
|
|
19
|
+
*
|
|
20
|
+
* @since 1.96
|
|
21
|
+
* @name sap.ui.export.ExportBase
|
|
22
|
+
* @extends sap.ui.base.EventProvider
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
var ExportBase = EventProvider.extend('sap.ui.export.ExportBase', {
|
|
26
|
+
|
|
27
|
+
constructor: function(mSettings) {
|
|
28
|
+
EventProvider.call(this, mSettings);
|
|
29
|
+
|
|
30
|
+
/* Default settings */
|
|
31
|
+
this._mSettings = {
|
|
32
|
+
fileName: 'Export'
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/* Only apply supported properties */
|
|
36
|
+
// IMPORTANT: keep count before dataSource to ensure that the expected count can be used for dataSource string
|
|
37
|
+
['count', 'dataSource', 'fileName', 'fileType', 'workbook'].forEach(function(sProperty) {
|
|
38
|
+
if (typeof mSettings[sProperty] !== 'undefined') {
|
|
39
|
+
this._mSettings[sProperty] = sProperty !== 'dataSource' ? mSettings[sProperty] : this.processDataSource(mSettings[sProperty]);
|
|
40
|
+
}
|
|
41
|
+
}.bind(this));
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The <code>beforeExport</code> event is fired just before the export process is started.
|
|
47
|
+
*
|
|
48
|
+
* @name sap.ui.export.ExportBase#beforeExport
|
|
49
|
+
* @event
|
|
50
|
+
* @param {sap.ui.base.Event} oEvent
|
|
51
|
+
* @param {sap.ui.base.EventProvider} oEvent.getSource
|
|
52
|
+
* @param {object} oEvent.getParameters
|
|
53
|
+
* @param {ArrayBuffer} oEvent.getParameter.exportSettings - Contains export-related configuration
|
|
54
|
+
*
|
|
55
|
+
* @since 1.96
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Attaches event handler <code>fnFunction</code> to the {@link sap.ui.export.ExportBase#event:beforeExport}
|
|
61
|
+
* event of this <code>sap.ui.export.ExportBase</code>.</br>
|
|
62
|
+
* When called, the context of the event handler (its <code>this</code>) will be bound to <code>oListener</code> if specified,
|
|
63
|
+
* otherwise it will be bound to this <code>sap.ui.export.ExportBase</code> itself.</br>
|
|
64
|
+
* This event is fired just before the export process is started.
|
|
65
|
+
*
|
|
66
|
+
* @param {object} [oData] An application-specific payload object that will be passed to the event handler along with the event object when firing the event
|
|
67
|
+
* @param {function} fnHandler The function to be called when the event occurs
|
|
68
|
+
* @param {object} [oListener] Context object to call the event handler with. Defaults to the <code>sap.ui.export.ExportBase</code> instance itself
|
|
69
|
+
*
|
|
70
|
+
* @returns {this} Reference to <code>this</code> in order to allow method chaining
|
|
71
|
+
*
|
|
72
|
+
* @name sap.ui.export.ExportBase#attachBeforeExport
|
|
73
|
+
* @function
|
|
74
|
+
* @since 1.96
|
|
75
|
+
* @public
|
|
76
|
+
*/
|
|
77
|
+
ExportBase.prototype.attachBeforeExport = function(oData, fnHandler, oListener) {
|
|
78
|
+
return this.attachEvent('beforeExport', oData, fnHandler, oListener);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Detaches event handler <code>fnFunction</code> from the {@link sap.ui.export.ExportBase#event:beforeExport}
|
|
83
|
+
* event of this <code>sap.ui.export.ExportBase</code>.</br>
|
|
84
|
+
* The passed function and listener object must match the ones used for event registration.
|
|
85
|
+
*
|
|
86
|
+
* @param {function} fnHandler The function to be called when the event occurs
|
|
87
|
+
* @param {object} [oListener] Context object on which the given function had to be called
|
|
88
|
+
*
|
|
89
|
+
* @returns {this} Reference to <code>this</code> in order to allow method chaining
|
|
90
|
+
*
|
|
91
|
+
* @name sap.ui.export.ExportBase#detachBeforeExport
|
|
92
|
+
* @function
|
|
93
|
+
* @since 1.96
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
ExportBase.prototype.detachBeforeExport = function(fnHandler, oListener) {
|
|
97
|
+
return this.detachEvent('beforeExport', fnHandler, oListener);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Cleans up the internal structures and removes all event handlers.
|
|
102
|
+
*
|
|
103
|
+
* The object must not be used anymore after destroy was called.
|
|
104
|
+
*
|
|
105
|
+
* @see sap.ui.base.Object#destroy
|
|
106
|
+
* @public
|
|
107
|
+
*/
|
|
108
|
+
ExportBase.prototype.destroy = function() {
|
|
109
|
+
EventProvider.prototype.destroy.apply(this, arguments);
|
|
110
|
+
|
|
111
|
+
this.cancel();
|
|
112
|
+
this.bIsDestroyed = true;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Cancels the current export process.
|
|
117
|
+
*
|
|
118
|
+
* @function
|
|
119
|
+
* @abstract
|
|
120
|
+
* @name sap.ui.export.ExportBase#cancel
|
|
121
|
+
* @public
|
|
122
|
+
*/
|
|
123
|
+
ExportBase.prototype.cancel = function() {
|
|
124
|
+
throw new Error('Abstract function not implemented');
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Sets the data source configuration that will be used for exporting the data. If the passed parameter is null,
|
|
129
|
+
* the call will be ignored.
|
|
130
|
+
*
|
|
131
|
+
* @param {Object|sap.ui.model.ListBinding|sap.ui.model.TreeBinding} oDataSource Possible types are a data
|
|
132
|
+
* source configuration, a <code>sap.ui.model.ListBinding</code> or <code>sap.ui.model.TreeBinding</code>
|
|
133
|
+
* @returns {Object|null} - Valid dataSource object or null in case the dataSource configuration is not supported
|
|
134
|
+
*
|
|
135
|
+
* @function
|
|
136
|
+
* @abstract
|
|
137
|
+
* @name sap.ui.export.ExportBase#processDataSource
|
|
138
|
+
* @public
|
|
139
|
+
*/
|
|
140
|
+
ExportBase.prototype.processDataSource = function(oDataSource) {
|
|
141
|
+
throw new Error('Abstract function not implemented');
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Applies default settings to the export configuration.
|
|
146
|
+
*
|
|
147
|
+
* @param {Object} mSettings Export settings that will be adjusted
|
|
148
|
+
*
|
|
149
|
+
* @function
|
|
150
|
+
* @abstract
|
|
151
|
+
*/
|
|
152
|
+
ExportBase.prototype.setDefaultExportSettings = function(mSettings) {
|
|
153
|
+
throw new Error('Abstract function not implemented');
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Creates a Promise that will be resolved after the export has been finished.
|
|
158
|
+
*
|
|
159
|
+
* @param {Object} mSettings Validated export configuration
|
|
160
|
+
*
|
|
161
|
+
* @function
|
|
162
|
+
* @abstract
|
|
163
|
+
*/
|
|
164
|
+
ExportBase.prototype.createBuildPromise = function(mSettings) {
|
|
165
|
+
throw new Error('Abstract function not implemented');
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Triggers the export process of the specific format.
|
|
170
|
+
*
|
|
171
|
+
* @returns {Promise} Promise that gets resolved once the data has been exported
|
|
172
|
+
*
|
|
173
|
+
* @function
|
|
174
|
+
* @name sap.ui.export.ExportBase#build
|
|
175
|
+
* @public
|
|
176
|
+
*/
|
|
177
|
+
ExportBase.prototype.build = function() {
|
|
178
|
+
var mParameters = this._mSettings;
|
|
179
|
+
|
|
180
|
+
if (this.bIsDestroyed) {
|
|
181
|
+
var sMessage = this.getMetadata().getName() + ': Cannot trigger build - the object has been destroyed';
|
|
182
|
+
|
|
183
|
+
Log.error(sMessage);
|
|
184
|
+
return Promise.reject(sMessage);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return this.setDefaultExportSettings(mParameters).then(function() {
|
|
188
|
+
this.fireEvent('beforeExport', {exportSettings: mParameters}, false, false);
|
|
189
|
+
|
|
190
|
+
ExportUtils.validateSettings(mParameters);
|
|
191
|
+
|
|
192
|
+
return this.createBuildPromise(mParameters);
|
|
193
|
+
}.bind(this));
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
return ExportBase;
|
|
197
|
+
});
|
|
@@ -25,7 +25,8 @@ sap.ui.define([
|
|
|
25
25
|
], function(coreLibrary, mLibrary, library, Core, Log, uid, Item, syncStyleClass, JSONModel, Button, CheckBox, Dialog, Input, Label, Select, Text, VBox, VersionInfo, openWindow) {
|
|
26
26
|
'use strict';
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
// eslint-disable-next-line
|
|
29
|
+
/* global Blob, MouseEvent, FileReader, URL */
|
|
29
30
|
|
|
30
31
|
// Shortcuts
|
|
31
32
|
var ButtonType = mLibrary.ButtonType;
|
|
@@ -53,7 +54,7 @@ sap.ui.define([
|
|
|
53
54
|
});
|
|
54
55
|
|
|
55
56
|
/* Returns the Export Settings used by the User Settings Dialog */
|
|
56
|
-
function getExportSettings(oCustomConfig, oResourceBundle) {
|
|
57
|
+
function getExportSettings(oCustomConfig, oResourceBundle, bDevMode) {
|
|
57
58
|
var sSelectedKey;
|
|
58
59
|
var oDefaultConfig = {
|
|
59
60
|
fileName: 'Standard',
|
|
@@ -66,6 +67,10 @@ sap.ui.define([
|
|
|
66
67
|
addDateTime: false
|
|
67
68
|
};
|
|
68
69
|
|
|
70
|
+
if (bDevMode) {
|
|
71
|
+
oDefaultConfig.fileType.push({key: 'pdf'});
|
|
72
|
+
}
|
|
73
|
+
|
|
69
74
|
var oExportConfig = Object.assign({}, oDefaultConfig, oCustomConfig || {});
|
|
70
75
|
|
|
71
76
|
for (var i = 0; i < oExportConfig.fileType.length; i++) {
|
|
@@ -89,7 +94,7 @@ sap.ui.define([
|
|
|
89
94
|
* Utilities related to export to enable reuse in integration scenarios (e.g. tables).
|
|
90
95
|
*
|
|
91
96
|
* @author SAP SE
|
|
92
|
-
* @version 1.
|
|
97
|
+
* @version 1.97.0
|
|
93
98
|
*
|
|
94
99
|
* @since 1.59
|
|
95
100
|
* @name sap.ui.export.ExportUtils
|
|
@@ -126,25 +131,37 @@ sap.ui.define([
|
|
|
126
131
|
return sUrl;
|
|
127
132
|
},
|
|
128
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Ensures that the URL is absolute, so that it can
|
|
136
|
+
* be used within a Web Worker.
|
|
137
|
+
*
|
|
138
|
+
* @param {string} url Relative URL that needs to be processed for Web Worker usage
|
|
139
|
+
* @returns {string|any} Returns the absolute URL or the original value in case there is no URL provided
|
|
140
|
+
*/
|
|
141
|
+
normalizeUrl: function(url) {
|
|
142
|
+
return url ? new URL(url, document.baseURI).toString() : url;
|
|
143
|
+
},
|
|
144
|
+
|
|
129
145
|
/**
|
|
130
146
|
* Creates the Export settings dialog that can be used for configuring the spreadsheet before exporting.
|
|
131
147
|
*
|
|
132
148
|
* @param {Object} mCustomConfig Initial configuration of the settings dialog
|
|
133
149
|
* @param {sap.ui.core.Control} oOpener The opener of the dialog
|
|
134
150
|
* @param {function} [fnCallback] Handler function that is called once the dialog has been opened. A reference to the dialog is passed as parameter
|
|
151
|
+
* @param {boolean} [bDevMode] Flag that allows to activate settings that are currently in development
|
|
135
152
|
*
|
|
136
153
|
* @returns {Promise} Promise which resolves with the export settings defined by the user
|
|
137
154
|
*
|
|
138
155
|
* @static
|
|
139
156
|
*/
|
|
140
|
-
getExportSettingsViaDialog: function(mCustomConfig, oOpener, fnCallback) {
|
|
157
|
+
getExportSettingsViaDialog: function(mCustomConfig, oOpener, fnCallback, bDevMode) {
|
|
141
158
|
return new Promise(function (fnResolve, fnReject) {
|
|
142
159
|
var oExportSettingsDialog;
|
|
143
160
|
|
|
144
161
|
oResourceBundlePromise.then(function (oResourceBundle) {
|
|
145
162
|
|
|
146
163
|
var oExportConfigModel = new JSONModel();
|
|
147
|
-
oExportConfigModel.setData(getExportSettings(mCustomConfig, oResourceBundle));
|
|
164
|
+
oExportConfigModel.setData(getExportSettings(mCustomConfig, oResourceBundle, bDevMode));
|
|
148
165
|
|
|
149
166
|
var sDialogId = uid();
|
|
150
167
|
|
|
@@ -191,7 +208,7 @@ sap.ui.define([
|
|
|
191
208
|
new Label({
|
|
192
209
|
text: oResourceBundle.getText('SELECT_FORMAT'),
|
|
193
210
|
labelFor: sDialogId + '-fileType',
|
|
194
|
-
visible:
|
|
211
|
+
visible: !!bDevMode
|
|
195
212
|
}),
|
|
196
213
|
// sap.m.Select control disabled as there is only 1 option for now
|
|
197
214
|
// control must be enabled when more file types are supported
|
|
@@ -199,11 +216,11 @@ sap.ui.define([
|
|
|
199
216
|
id: sDialogId + '-fileType',
|
|
200
217
|
width: '100%',
|
|
201
218
|
selectedKey: '{/selectedFileType}',
|
|
202
|
-
visible: false,
|
|
203
219
|
items: {
|
|
204
220
|
path: '/fileType',
|
|
205
221
|
template: new Item({key: '{key}', text: '{text}'})
|
|
206
|
-
}
|
|
222
|
+
},
|
|
223
|
+
visible: !!bDevMode
|
|
207
224
|
}),
|
|
208
225
|
new CheckBox({
|
|
209
226
|
id: sDialogId + '-splitCells',
|
|
@@ -273,7 +290,7 @@ sap.ui.define([
|
|
|
273
290
|
* Combines the filter operator with the value and
|
|
274
291
|
* creates a textual representation.
|
|
275
292
|
*
|
|
276
|
-
* @param
|
|
293
|
+
* @param {Object} oFilter A single filter object according to ListBinding#getFilterInfo
|
|
277
294
|
* @returns {string} Textual representation of the filter operation and value
|
|
278
295
|
* @private
|
|
279
296
|
*/
|
|
@@ -303,7 +320,7 @@ sap.ui.define([
|
|
|
303
320
|
/**
|
|
304
321
|
* Parse filter tree recursively.
|
|
305
322
|
*
|
|
306
|
-
* @param
|
|
323
|
+
* @param {Object} oFilter Filter configuration according to ListBinding#getFilterInfo
|
|
307
324
|
* @returns {Array} Array of filter entries
|
|
308
325
|
* @private
|
|
309
326
|
*/
|
|
@@ -326,7 +343,7 @@ sap.ui.define([
|
|
|
326
343
|
* Parses a logical filter and concatenates all
|
|
327
344
|
* subsequent filters.
|
|
328
345
|
*
|
|
329
|
-
* @param
|
|
346
|
+
* @param {Object} oLogicalFilter Filter object according to ListBinding#getFilterInfo
|
|
330
347
|
* @returns {Array} Array containing all filter settings
|
|
331
348
|
* @private
|
|
332
349
|
*/
|
|
@@ -367,7 +384,7 @@ sap.ui.define([
|
|
|
367
384
|
* Parses a binary filter and returns an Array that
|
|
368
385
|
* contains this explicit filter item.
|
|
369
386
|
*
|
|
370
|
-
* @param
|
|
387
|
+
* @param {Object} oBinaryFilter Filter object according to ListBinding#getFilterInfo
|
|
371
388
|
* @returns {Array} Array containing this explicit filter setting
|
|
372
389
|
* @private
|
|
373
390
|
*/
|
|
@@ -387,7 +404,7 @@ sap.ui.define([
|
|
|
387
404
|
* Parses an unary filter and returns a modified
|
|
388
405
|
* subsequent filter.
|
|
389
406
|
*
|
|
390
|
-
* @param
|
|
407
|
+
* @param {Object} oUnaryFilter Filter object according to ListBinding#getFilterInfo
|
|
391
408
|
* @returns {Array} Array containing the modified subsequent filter
|
|
392
409
|
* @private
|
|
393
410
|
*/
|
|
@@ -408,7 +425,7 @@ sap.ui.define([
|
|
|
408
425
|
* Parses an call filter and returns an Array containing
|
|
409
426
|
* this particular filter configuration.
|
|
410
427
|
*
|
|
411
|
-
* @param
|
|
428
|
+
* @param {Object} oCallFilter Filter object according to ListBinding#getFilterInfo
|
|
412
429
|
* @returns {Array} Array containing this explicit filter setting
|
|
413
430
|
* @private
|
|
414
431
|
*/
|
|
@@ -429,11 +446,8 @@ sap.ui.define([
|
|
|
429
446
|
* configuration in a format that can be attached to
|
|
430
447
|
* a sap.ui.export.Spreadsheet instance.
|
|
431
448
|
*
|
|
432
|
-
* @param
|
|
433
|
-
*
|
|
434
|
-
*
|
|
435
|
-
* @param fnCallback {function}
|
|
436
|
-
* Callback function that is used to resolve the columns names according to their property.
|
|
449
|
+
* @param {sap.ui.model.ListBinding | sap.ui.model.TreeBinding} oBinding ListBinding or TreeBinding instance
|
|
450
|
+
* @param {function} fnCallback Callback function that is used to resolve the columns names according to their property
|
|
437
451
|
*
|
|
438
452
|
* @returns {Promise}
|
|
439
453
|
* Promise, which resolves with an object containing a name
|
|
@@ -650,8 +664,19 @@ sap.ui.define([
|
|
|
650
664
|
mDataSource.count = mDataSource.data.length;
|
|
651
665
|
}
|
|
652
666
|
|
|
653
|
-
if (mDataSource.type === 'odata'
|
|
654
|
-
|
|
667
|
+
if (mDataSource.type === 'odata') {
|
|
668
|
+
if (typeof mDataSource.dataUrl !== 'string' || mDataSource.dataUrl.length === 0) {
|
|
669
|
+
throw new Error(CLASS_NAME + ': Unable to export data. No dataUrl provided.');
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// Ensure absolute URLs for dataUrl and serviceUrl
|
|
673
|
+
if (mDataSource.dataUrl) {
|
|
674
|
+
mDataSource.dataUrl = Utils.normalizeUrl(mDataSource.dataUrl);
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
if (mDataSource.serviceUrl) {
|
|
678
|
+
mDataSource.serviceUrl = Utils.normalizeUrl(mDataSource.serviceUrl);
|
|
679
|
+
}
|
|
655
680
|
}
|
|
656
681
|
|
|
657
682
|
if (typeof mDataSource.count !== 'number' || mDataSource.count < 0 || isNaN(mDataSource.count) || mDataSource.count % 1 !== 0) {
|
|
@@ -886,7 +911,7 @@ sap.ui.define([
|
|
|
886
911
|
*
|
|
887
912
|
* @param {Object} oContext Context object
|
|
888
913
|
* @param {string} [oContext.application] Name of the application (default: "SAP UI5")
|
|
889
|
-
* @param {string} [oContext.version] Application version (default: "1.
|
|
914
|
+
* @param {string} [oContext.version] Application version (default: "1.97.0")
|
|
890
915
|
* @param {string} [oContext.title] Title that will be written to the file (NOT the filename)
|
|
891
916
|
* @param {string} [oContext.modifiedBy] Optional user context that will be written to the file
|
|
892
917
|
* @param {string} [oContext.sheetName] Name of the data sheet - Maximum length of 31 characters
|
|
@@ -990,12 +1015,16 @@ sap.ui.define([
|
|
|
990
1015
|
* @param {Object} oCustomizing General export customizing
|
|
991
1016
|
* @param {Object} oCustomizing.currency Currency specific customizing
|
|
992
1017
|
* @param {Object} oCustomizing.unit Unit of measure specific customizing
|
|
993
|
-
* @param {string} sProperty
|
|
1018
|
+
* @param {string} sProperty Key property of the specific customizing setting
|
|
994
1019
|
* @private
|
|
995
1020
|
*/
|
|
996
1021
|
_validateScaleCustomizing: function(oCustomizing, sProperty) {
|
|
997
1022
|
var sKey, mScaleSettings;
|
|
998
1023
|
|
|
1024
|
+
if (!oCustomizing) {
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
999
1028
|
mScaleSettings = oCustomizing[sProperty];
|
|
1000
1029
|
|
|
1001
1030
|
if (!(mScaleSettings instanceof Object) || Array.isArray(mScaleSettings)) {
|
|
@@ -1012,6 +1041,60 @@ sap.ui.define([
|
|
|
1012
1041
|
}
|
|
1013
1042
|
}
|
|
1014
1043
|
}
|
|
1044
|
+
},
|
|
1045
|
+
|
|
1046
|
+
/**
|
|
1047
|
+
* Returns an instance of the specific export class that is evaluated
|
|
1048
|
+
* by FileType. The default class is sap/ui/export/Spreadsheet when
|
|
1049
|
+
* no specific FileType is defined in the export settings.
|
|
1050
|
+
*
|
|
1051
|
+
* @param {Object} mSettings Export configuration with optional FileType
|
|
1052
|
+
* @returns {Promise} A Promise that gets resolved with the requested instance
|
|
1053
|
+
*/
|
|
1054
|
+
getExportInstance: function(mSettings) {
|
|
1055
|
+
var sClassName, sFileType;
|
|
1056
|
+
|
|
1057
|
+
sFileType = typeof mSettings.fileType === 'string' ? mSettings.fileType.toUpperCase() : mSettings.fileType;
|
|
1058
|
+
|
|
1059
|
+
switch (sFileType) {
|
|
1060
|
+
case FileType.PDF:
|
|
1061
|
+
sClassName = 'sap/ui/export/PortableDocument';
|
|
1062
|
+
break;
|
|
1063
|
+
default:
|
|
1064
|
+
sClassName = 'sap/ui/export/Spreadsheet';
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
return new Promise(function(fnResolve) {
|
|
1068
|
+
sap.ui.require([sClassName], function(ExportClass) {
|
|
1069
|
+
fnResolve(new ExportClass(mSettings));
|
|
1070
|
+
});
|
|
1071
|
+
});
|
|
1072
|
+
},
|
|
1073
|
+
|
|
1074
|
+
/**
|
|
1075
|
+
* Returns the amount of data that is available on the backend
|
|
1076
|
+
* in case the binding provides this information.
|
|
1077
|
+
*
|
|
1078
|
+
* @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>
|
|
1079
|
+
* @return {number|null} Amount of data in the backend or null if the binding does not provide this information
|
|
1080
|
+
*/
|
|
1081
|
+
getCountFromBinding: function(oBinding) {
|
|
1082
|
+
var iCount;
|
|
1083
|
+
|
|
1084
|
+
if (typeof oBinding.getCount === 'function') {
|
|
1085
|
+
iCount = oBinding.getCount();
|
|
1086
|
+
} else if (!oBinding.isA('sap.ui.model.TreeBinding') // Explicitly exclude TreeBinding because Binding#getLength is numberOfExpandedLevels dependent
|
|
1087
|
+
&& typeof oBinding.isLengthFinal === 'function'
|
|
1088
|
+
&& oBinding.isLengthFinal()) {
|
|
1089
|
+
|
|
1090
|
+
iCount = oBinding.getLength();
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
if (typeof iCount !== 'number' || iCount < 0 || isNaN(iCount)) {
|
|
1094
|
+
iCount = null;
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
return iCount;
|
|
1015
1098
|
}
|
|
1016
1099
|
};
|
|
1017
1100
|
|