@sapui5/sap.fe.macros 1.96.16 → 1.96.18
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
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
* SAPUI5
|
|
3
3
|
* (c) Copyright 2009-2023 SAP SE. All rights reserved.
|
|
4
4
|
*/
|
|
5
|
-
sap.ui.define(["sap/fe/macros/CommonHelper", "sap/fe/core/CommonUtils", "sap/ui/model/odata/v4/AnnotationHelper"], function(
|
|
5
|
+
sap.ui.define(["sap/fe/macros/CommonHelper", "sap/fe/core/CommonUtils", "sap/ui/model/odata/v4/AnnotationHelper", "sap/base/util/JSTokenizer"], function(
|
|
6
6
|
CommonHelper,
|
|
7
7
|
CommonUtils,
|
|
8
|
-
AnnotationHelper
|
|
8
|
+
AnnotationHelper,
|
|
9
|
+
JSTokenizer
|
|
9
10
|
) {
|
|
10
11
|
"use strict";
|
|
11
12
|
|
|
@@ -115,21 +116,21 @@ sap.ui.define(["sap/fe/macros/CommonHelper", "sap/fe/core/CommonUtils", "sap/ui/
|
|
|
115
116
|
constraints: function(oProperty, oInterface) {
|
|
116
117
|
var sValue = AnnotationHelper.format(oProperty, oInterface),
|
|
117
118
|
aMatches = sValue && sValue.match(/constraints:.*?({.*?})/),
|
|
118
|
-
|
|
119
|
+
oConstraints = aMatches ? JSTokenizer.parseJS(aMatches[1]) : {};
|
|
119
120
|
// Workaround. Add "V4: true" to DateTimeOffset constraints. AnnotationHelper is not aware of this flag.
|
|
120
|
-
if (sValue.
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
} else {
|
|
124
|
-
sConstraints = "{V4: true}";
|
|
125
|
-
}
|
|
121
|
+
if (sValue.includes("sap.ui.model.odata.type.DateTimeOffset")) {
|
|
122
|
+
// Ensure that V4:true is there. With the openUI5 BLI: CPOUI5ODATAV4-2131 the constraints are already include 'V4':true
|
|
123
|
+
oConstraints.V4 = true;
|
|
126
124
|
}
|
|
127
|
-
// Remove {nullable:false} from the constraints as it prevents from having an empty filter field
|
|
125
|
+
// Remove {nullable:false} from the constraints as it prevents from having an empty filter field
|
|
128
126
|
// in the case of a single-value filter
|
|
129
|
-
if (
|
|
130
|
-
|
|
127
|
+
if (oConstraints.nullable === false) {
|
|
128
|
+
delete oConstraints.nullable;
|
|
131
129
|
}
|
|
132
|
-
|
|
130
|
+
// Unfortunately, JSTokenizer does not provide a method to stringify (reversing parseJS).
|
|
131
|
+
// Using JSON.stringify and replacing double quotes with single quotes works at least in the known simple cases (flat objects not containing quotes in property names or values).
|
|
132
|
+
// If special cases should occur in future, this might need some adoption (depending on the required string format in that case).
|
|
133
|
+
return Object.keys(oConstraints).length === 0 ? undefined : JSON.stringify(oConstraints).replaceAll('"', "'");
|
|
133
134
|
},
|
|
134
135
|
formatOptions: function(oProperty, oInterface) {
|
|
135
136
|
// as the Annotation helper always returns "parseKeepsEmptyString: true" we need to prevent this in case a property (of type string) is nullable
|