@sapui5/sap.ui.export 1.108.2 → 1.110.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/ExportHandler.js +55 -40
- package/src/sap/ui/export/ExportUtils.js +75 -94
- package/src/sap/ui/export/PortableDocument.js +12 -6
- package/src/sap/ui/export/Spreadsheet.js +10 -6
- package/src/sap/ui/export/SpreadsheetExport.js +2 -2
- package/src/sap/ui/export/library.js +3 -3
- package/src/sap/ui/export/messagebundle.properties +6 -0
- package/src/sap/ui/export/messagebundle_ar.properties +4 -0
- package/src/sap/ui/export/messagebundle_bg.properties +4 -0
- package/src/sap/ui/export/messagebundle_ca.properties +4 -0
- package/src/sap/ui/export/messagebundle_cs.properties +4 -0
- package/src/sap/ui/export/messagebundle_cy.properties +4 -0
- package/src/sap/ui/export/messagebundle_da.properties +4 -0
- package/src/sap/ui/export/messagebundle_de.properties +4 -0
- package/src/sap/ui/export/messagebundle_el.properties +4 -0
- package/src/sap/ui/export/messagebundle_en.properties +4 -0
- package/src/sap/ui/export/messagebundle_en_GB.properties +4 -0
- package/src/sap/ui/export/messagebundle_en_US_sappsd.properties +5 -1
- package/src/sap/ui/export/messagebundle_en_US_saprigi.properties +4 -0
- package/src/sap/ui/export/messagebundle_en_US_saptrc.properties +5 -1
- package/src/sap/ui/export/messagebundle_es.properties +4 -0
- package/src/sap/ui/export/messagebundle_es_MX.properties +4 -0
- package/src/sap/ui/export/messagebundle_et.properties +4 -0
- package/src/sap/ui/export/messagebundle_fi.properties +4 -0
- package/src/sap/ui/export/messagebundle_fr.properties +4 -0
- package/src/sap/ui/export/messagebundle_fr_CA.properties +4 -0
- package/src/sap/ui/export/messagebundle_hi.properties +4 -0
- package/src/sap/ui/export/messagebundle_hr.properties +4 -0
- package/src/sap/ui/export/messagebundle_hu.properties +4 -0
- package/src/sap/ui/export/messagebundle_id.properties +4 -0
- package/src/sap/ui/export/messagebundle_it.properties +4 -0
- package/src/sap/ui/export/messagebundle_iw.properties +4 -0
- package/src/sap/ui/export/messagebundle_ja.properties +4 -0
- package/src/sap/ui/export/messagebundle_kk.properties +4 -0
- package/src/sap/ui/export/messagebundle_ko.properties +4 -0
- package/src/sap/ui/export/messagebundle_lt.properties +4 -0
- package/src/sap/ui/export/messagebundle_lv.properties +4 -0
- package/src/sap/ui/export/messagebundle_ms.properties +4 -0
- package/src/sap/ui/export/messagebundle_nl.properties +4 -0
- package/src/sap/ui/export/messagebundle_no.properties +4 -0
- package/src/sap/ui/export/messagebundle_pl.properties +4 -0
- package/src/sap/ui/export/messagebundle_pt.properties +4 -0
- package/src/sap/ui/export/messagebundle_pt_PT.properties +4 -0
- package/src/sap/ui/export/messagebundle_ro.properties +4 -0
- package/src/sap/ui/export/messagebundle_ru.properties +4 -0
- package/src/sap/ui/export/messagebundle_sh.properties +4 -0
- package/src/sap/ui/export/messagebundle_sk.properties +4 -0
- package/src/sap/ui/export/messagebundle_sl.properties +4 -0
- package/src/sap/ui/export/messagebundle_sv.properties +4 -0
- package/src/sap/ui/export/messagebundle_th.properties +4 -0
- package/src/sap/ui/export/messagebundle_tr.properties +4 -0
- package/src/sap/ui/export/messagebundle_uk.properties +4 -0
- package/src/sap/ui/export/messagebundle_vi.properties +4 -0
- package/src/sap/ui/export/messagebundle_zh_CN.properties +4 -0
- package/src/sap/ui/export/messagebundle_zh_TW.properties +4 -0
- package/src/sap/ui/export/provider/DataProviderBase.js +1 -1
- 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 +1 -1
- package/src/sap/ui/export/themes/sap_horizon_hcb/library.source.less +1 -1
- package/src/sap/ui/export/themes/sap_horizon_hcw/library.source.less +1 -1
- package/src/sap/ui/export/util/Filter.js +207 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SAPUI5
|
|
3
|
+
* (c) Copyright 2009-2023 SAP SE. All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
sap.ui.define(['sap/ui/base/Object'], function(BaseObject) {
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Representation of filter settings that are used for exporting.
|
|
10
|
+
*
|
|
11
|
+
* @param {string} sProperty Name of the technical filter property
|
|
12
|
+
* @param {object|object[]} vRawFilter Raw filter object
|
|
13
|
+
* @param {string} vRawFilter.operator Filter operator
|
|
14
|
+
* @param {string|string[]} vRawFilter.value Filter value(s)
|
|
15
|
+
* @param {boolean} [vRawFilter.exclude] Defines whether it is an exclude filter
|
|
16
|
+
* @param {string} [sLabel] Optional label for the filter property
|
|
17
|
+
*
|
|
18
|
+
* @constructor The <code>sap.ui.export.util.Filter</code> class represents filter settings that are used for the export.
|
|
19
|
+
* It provides the capability to have a visual representation of the filters in the exported document and offers
|
|
20
|
+
* convenience functions like <code>sap.ui.export.util.Filter#setType</code> to improve the result.
|
|
21
|
+
*
|
|
22
|
+
* @author SAP SE
|
|
23
|
+
* @version 1.110.0
|
|
24
|
+
*
|
|
25
|
+
* @since 1.110
|
|
26
|
+
* @name sap.ui.export.util.Filter
|
|
27
|
+
* @extends sap.ui.base.Object
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
var Filter = BaseObject.extend('sap.ui.export.util.Filter', {
|
|
31
|
+
constructor: function(sProperty, vRawFilter, sLabel) {
|
|
32
|
+
this.property = sProperty;
|
|
33
|
+
this.rawValues = Array.isArray(vRawFilter) ? vRawFilter : [vRawFilter];
|
|
34
|
+
this.label = typeof sLabel === 'string' ? sLabel : undefined;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Returns the technical name of the property on which the filter
|
|
40
|
+
* is applied.
|
|
41
|
+
*
|
|
42
|
+
* @returns {string} Name of the property
|
|
43
|
+
*
|
|
44
|
+
* @since 1.110
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
Filter.prototype.getProperty = function() {
|
|
48
|
+
return this.property;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Returns the filter label if available. Otherwise the name
|
|
53
|
+
* of the filter property will be returned.
|
|
54
|
+
*
|
|
55
|
+
* @returns {string} Filter label
|
|
56
|
+
*
|
|
57
|
+
* @since 1.110
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
|
+
Filter.prototype.getLabel = function() {
|
|
61
|
+
return this.label || this.property;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Returns the formatted filter value(s) as string. If there are
|
|
66
|
+
* multiple filters for the same property, which are combined via
|
|
67
|
+
* <code>OR</code>, it will return a semicolon-separated list of the
|
|
68
|
+
* filter values including their operators.
|
|
69
|
+
*
|
|
70
|
+
* @returns {string} Formatted and semicolon-separated filter settings
|
|
71
|
+
*
|
|
72
|
+
* @since 1.110
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
75
|
+
Filter.prototype.getValue = function() {
|
|
76
|
+
var aFormattedValues, fnFormat;
|
|
77
|
+
|
|
78
|
+
aFormattedValues = [];
|
|
79
|
+
fnFormat = this.type ? this.format || this.type.formatValue.bind(this.type) : this.format;
|
|
80
|
+
|
|
81
|
+
this.getRawValues().forEach(function(oRawFilter) {
|
|
82
|
+
var vValue = oRawFilter.value;
|
|
83
|
+
|
|
84
|
+
/* Apply format */
|
|
85
|
+
if (typeof fnFormat === 'function') {
|
|
86
|
+
if (Array.isArray(oRawFilter.value)) {
|
|
87
|
+
vValue = [];
|
|
88
|
+
oRawFilter.value.forEach(function(sVal) {
|
|
89
|
+
try {
|
|
90
|
+
vValue.push(fnFormat(sVal, 'string')); // Pass output type in case SimpleType.formatValue is being used
|
|
91
|
+
} catch (oError) {
|
|
92
|
+
vValue.push(sVal); // Ignore error and use raw value instead
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
} else {
|
|
96
|
+
try {
|
|
97
|
+
vValue = fnFormat(oRawFilter.value, 'string'); // Pass output type in case SimpleType.formatValue is being used
|
|
98
|
+
} catch (oError) { /* No action */}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* Append filter operator */
|
|
103
|
+
switch (oRawFilter.operator) {
|
|
104
|
+
case '==':
|
|
105
|
+
vValue = '=' + vValue;
|
|
106
|
+
break;
|
|
107
|
+
case 'between':
|
|
108
|
+
vValue = vValue[0] + '...' + vValue[1];
|
|
109
|
+
break;
|
|
110
|
+
case 'contains':
|
|
111
|
+
vValue = '*' + vValue + '*';
|
|
112
|
+
break;
|
|
113
|
+
case 'endswith':
|
|
114
|
+
vValue = '*' + vValue;
|
|
115
|
+
break;
|
|
116
|
+
case 'startswith':
|
|
117
|
+
vValue += '*';
|
|
118
|
+
break;
|
|
119
|
+
default:
|
|
120
|
+
vValue = oRawFilter.operator + vValue;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (oRawFilter.exclude) {
|
|
124
|
+
vValue = '!' + vValue;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
aFormattedValues.push(vValue);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
return aFormattedValues.join('; ');
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Returns an Array of raw filter settings
|
|
135
|
+
*
|
|
136
|
+
* @returns {Array} The raw filter settings
|
|
137
|
+
*
|
|
138
|
+
* @private
|
|
139
|
+
*/
|
|
140
|
+
Filter.prototype.getRawValues = function() {
|
|
141
|
+
return this.rawValues;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Uses the given format function to format all filter values.
|
|
146
|
+
* The function has to accept a single parameter of type <code>string</code>
|
|
147
|
+
* and needs to return a string value. The function will be called
|
|
148
|
+
* for every single raw value without the corresponding filter
|
|
149
|
+
* operator.
|
|
150
|
+
*
|
|
151
|
+
* If there is a "between" filter, the function will be called
|
|
152
|
+
* twice. In case of an error, the function call will be skipped,
|
|
153
|
+
* and the raw value will be taken instead.
|
|
154
|
+
*
|
|
155
|
+
* The format function has priority over the type-dependent format.
|
|
156
|
+
* To reset the format function and return to type-dependent
|
|
157
|
+
* formatting, the format function needs to be set to <code>null</code>.
|
|
158
|
+
*
|
|
159
|
+
* @param {function} fnFormat Format function that will be applied to the raw values
|
|
160
|
+
*
|
|
161
|
+
* @since 1.110
|
|
162
|
+
* @public
|
|
163
|
+
*/
|
|
164
|
+
Filter.prototype.setFormat = function(fnFormat) {
|
|
165
|
+
if (typeof fnFormat !== 'function' && fnFormat !== null) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
this.format = fnFormat;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Takes the given string as label of the filter.
|
|
174
|
+
*
|
|
175
|
+
* @param {string} sLabel Filter label
|
|
176
|
+
*
|
|
177
|
+
* @since 1.110
|
|
178
|
+
* @public
|
|
179
|
+
*
|
|
180
|
+
*/
|
|
181
|
+
Filter.prototype.setLabel = function(sLabel) {
|
|
182
|
+
if (typeof sLabel !== 'string' || !sLabel) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
this.label = sLabel;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Uses the given <code>sap.ui.model.SimpleType</code> instance
|
|
191
|
+
* to format the filter values accordingly.
|
|
192
|
+
*
|
|
193
|
+
* @param {sap.ui.model.SimpleType} oType Type instance that is used for formatting
|
|
194
|
+
*
|
|
195
|
+
* @since 1.110
|
|
196
|
+
* @public
|
|
197
|
+
*/
|
|
198
|
+
Filter.prototype.setType = function(oType) {
|
|
199
|
+
if (!oType || typeof oType.isA !== 'function' || !oType.isA('sap.ui.model.SimpleType')) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
this.type = oType;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
return Filter;
|
|
207
|
+
}, /* bExport= */ true);
|