@ui5/webcomponents-localization 1.22.0-rc.0 → 1.22.0-rc.2
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/CHANGELOG.md +16 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/generated/assets/cldr/ar.json +102 -62
- package/dist/generated/assets/cldr/ar_EG.json +102 -62
- package/dist/generated/assets/cldr/ar_SA.json +102 -62
- package/dist/generated/assets/cldr/bg.json +364 -325
- package/dist/generated/assets/cldr/ca.json +491 -453
- package/dist/generated/assets/cldr/cs.json +431 -324
- package/dist/generated/assets/cldr/cy.json +608 -340
- package/dist/generated/assets/cldr/da.json +290 -227
- package/dist/generated/assets/cldr/de.json +348 -241
- package/dist/generated/assets/cldr/de_AT.json +348 -241
- package/dist/generated/assets/cldr/de_CH.json +347 -240
- package/dist/generated/assets/cldr/el.json +128 -100
- package/dist/generated/assets/cldr/el_CY.json +128 -100
- package/dist/generated/assets/cldr/en.json +538 -512
- package/dist/generated/assets/cldr/en_AU.json +583 -520
- package/dist/generated/assets/cldr/en_GB.json +485 -441
- package/dist/generated/assets/cldr/en_HK.json +519 -474
- package/dist/generated/assets/cldr/en_IE.json +485 -440
- package/dist/generated/assets/cldr/en_IN.json +465 -420
- package/dist/generated/assets/cldr/en_NZ.json +505 -460
- package/dist/generated/assets/cldr/en_PG.json +505 -460
- package/dist/generated/assets/cldr/en_SG.json +505 -460
- package/dist/generated/assets/cldr/en_ZA.json +485 -440
- package/dist/generated/assets/cldr/es.json +709 -456
- package/dist/generated/assets/cldr/es_AR.json +687 -434
- package/dist/generated/assets/cldr/es_BO.json +721 -468
- package/dist/generated/assets/cldr/es_CL.json +567 -422
- package/dist/generated/assets/cldr/es_CO.json +485 -339
- package/dist/generated/assets/cldr/es_MX.json +734 -481
- package/dist/generated/assets/cldr/es_PE.json +409 -372
- package/dist/generated/assets/cldr/es_UY.json +433 -396
- package/dist/generated/assets/cldr/es_VE.json +453 -416
- package/dist/generated/assets/cldr/et.json +340 -307
- package/dist/generated/assets/cldr/fa.json +96 -34
- package/dist/generated/assets/cldr/fi.json +359 -308
- package/dist/generated/assets/cldr/fr.json +347 -321
- package/dist/generated/assets/cldr/fr_BE.json +347 -321
- package/dist/generated/assets/cldr/fr_CA.json +458 -432
- package/dist/generated/assets/cldr/fr_CH.json +290 -264
- package/dist/generated/assets/cldr/fr_LU.json +347 -321
- package/dist/generated/assets/cldr/he.json +241 -130
- package/dist/generated/assets/cldr/hi.json +103 -53
- package/dist/generated/assets/cldr/hr.json +467 -410
- package/dist/generated/assets/cldr/hu.json +246 -195
- package/dist/generated/assets/cldr/id.json +478 -406
- package/dist/generated/assets/cldr/it.json +418 -362
- package/dist/generated/assets/cldr/it_CH.json +418 -362
- package/dist/generated/assets/cldr/ja.json +58 -18
- package/dist/generated/assets/cldr/kk.json +562 -398
- package/dist/generated/assets/cldr/ko.json +36 -15
- package/dist/generated/assets/cldr/lt.json +320 -231
- package/dist/generated/assets/cldr/lv.json +184 -120
- package/dist/generated/assets/cldr/ms.json +460 -388
- package/dist/generated/assets/cldr/nb.json +160 -92
- package/dist/generated/assets/cldr/nl.json +621 -373
- package/dist/generated/assets/cldr/nl_BE.json +621 -373
- package/dist/generated/assets/cldr/pl.json +590 -279
- package/dist/generated/assets/cldr/pt.json +696 -334
- package/dist/generated/assets/cldr/pt_PT.json +730 -454
- package/dist/generated/assets/cldr/ro.json +409 -339
- package/dist/generated/assets/cldr/ru.json +317 -279
- package/dist/generated/assets/cldr/ru_UA.json +312 -274
- package/dist/generated/assets/cldr/sk.json +454 -413
- package/dist/generated/assets/cldr/sl.json +118 -80
- package/dist/generated/assets/cldr/sr.json +294 -142
- package/dist/generated/assets/cldr/sr_Latn.json +972 -824
- package/dist/generated/assets/cldr/sv.json +382 -338
- package/dist/generated/assets/cldr/th.json +56 -36
- package/dist/generated/assets/cldr/tr.json +371 -320
- package/dist/generated/assets/cldr/uk.json +340 -290
- package/dist/generated/assets/cldr/vi.json +352 -328
- package/dist/generated/assets/cldr/zh_CN.json +34 -10
- package/dist/generated/assets/cldr/zh_HK.json +33 -9
- package/dist/generated/assets/cldr/zh_SG.json +33 -9
- package/dist/generated/assets/cldr/zh_TW.json +32 -8
- package/dist/sap/base/Event.js +59 -0
- package/dist/sap/base/Eventing.js +146 -0
- package/dist/sap/base/Log.js +2 -239
- package/dist/sap/base/assert.js +28 -1
- package/dist/sap/base/config/MemoryConfigurationProvider.js +20 -0
- package/dist/sap/base/config.js +17 -0
- package/dist/sap/base/i18n/Formatting.js +1130 -0
- package/dist/sap/base/i18n/LanguageTag.js +168 -30
- package/dist/sap/base/i18n/date/CalendarType.js +36 -1
- package/dist/sap/base/i18n/date/CalendarWeekNumbering.js +76 -1
- package/dist/sap/base/i18n/date/TimezoneUtils.js +242 -12
- package/dist/sap/base/strings/camelize.js +30 -0
- package/dist/sap/base/strings/formatMessage.js +88 -15
- package/dist/sap/base/util/ObjectPath.js +95 -3
- package/dist/sap/base/util/Version.js +157 -0
- package/dist/sap/base/util/_merge.js +83 -26
- package/dist/sap/base/util/array/uniqueSort.js +37 -15
- package/dist/sap/base/util/deepClone.js +102 -0
- package/dist/sap/base/util/deepEqual.js +75 -51
- package/dist/sap/base/util/extend.js +58 -7
- package/dist/sap/base/util/isEmptyObject.js +34 -0
- package/dist/sap/base/util/isPlainObject.js +35 -1
- package/dist/sap/base/util/now.js +24 -3
- package/dist/sap/base/util/resolveReference.js +157 -0
- package/dist/sap/base/util/uid.js +27 -0
- package/dist/sap/ui/base/DataType.js +657 -0
- package/dist/sap/ui/base/Interface.js +47 -1
- package/dist/sap/ui/base/Metadata.js +433 -180
- package/dist/sap/ui/base/Object.js +284 -48
- package/dist/sap/ui/core/CalendarType.js +23 -1
- package/dist/sap/ui/core/Locale.js +189 -57
- package/dist/sap/ui/core/LocaleData.js +2670 -1380
- package/dist/sap/ui/core/Supportability.js +5 -0
- package/dist/sap/ui/core/Theming.js +539 -0
- package/dist/sap/ui/core/date/Buddhist.js +162 -87
- package/dist/sap/ui/core/date/CalendarUtils.js +61 -21
- package/dist/sap/ui/core/date/CalendarWeekNumbering.js +29 -1
- package/dist/sap/ui/core/date/Gregorian.js +25 -10
- package/dist/sap/ui/core/date/Islamic.js +298 -185
- package/dist/sap/ui/core/date/Japanese.js +210 -115
- package/dist/sap/ui/core/date/Persian.js +324 -195
- package/dist/sap/ui/core/date/UI5Date.js +923 -237
- package/dist/sap/ui/core/date/UniversalDate.js +1238 -245
- package/dist/sap/ui/core/date/_Calendars.js +10 -1
- package/dist/sap/ui/core/format/DateFormat.js +3163 -2145
- package/dist/sap/ui/core/format/TimezoneUtil.js +23 -1
- package/package-scripts.cjs +4 -10
- package/package.json +9 -5
- package/tsconfig.json +2 -1
- package/used-modules.txt +20 -1
- package/dist/sap/ui/Device.js +0 -5
@@ -1,64 +1,300 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
/*!
|
2
|
+
* OpenUI5
|
3
|
+
* (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
5
|
+
*/
|
6
|
+
/**
|
7
|
+
* SAPUI5 base classes
|
8
|
+
*
|
9
|
+
* @namespace
|
10
|
+
* @name sap.ui.base
|
11
|
+
* @public
|
12
|
+
*/
|
13
|
+
// Provides class sap.ui.base.Object
|
14
|
+
import Metadata from "./Metadata.js";
|
15
|
+
import Log from "../../base/Log.js";
|
16
|
+
/**
|
17
|
+
* Constructor for an <code>sap.ui.base.Object</code>.
|
18
|
+
*
|
19
|
+
* Subclasses of this class should always call the constructor of their base class.
|
20
|
+
*
|
21
|
+
* @class Base class for all SAPUI5 Objects.
|
22
|
+
* @abstract
|
23
|
+
* @author Malte Wedel
|
24
|
+
* @version 1.120.3
|
25
|
+
* @public
|
26
|
+
* @alias sap.ui.base.Object
|
27
|
+
* @throws {Error} When an instance of the class or its subclasses is created without the <code>new</code> operator.
|
28
|
+
*/
|
29
|
+
var BaseObject = Metadata.createClass("sap.ui.base.Object", {
|
30
|
+
constructor: function () {
|
31
|
+
// complain if 'this' is not an instance of a subclass
|
32
|
+
if (!(this instanceof BaseObject)) {
|
33
|
+
throw Error("Cannot instantiate object: \"new\" is missing!");
|
8
34
|
}
|
35
|
+
}
|
9
36
|
});
|
10
|
-
|
11
|
-
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Destructor method for objects.
|
40
|
+
* @public
|
41
|
+
*/
|
42
|
+
BaseObject.prototype.destroy = function () {};
|
43
|
+
|
44
|
+
/**
|
45
|
+
* Returns the public facade of this object.
|
46
|
+
*
|
47
|
+
* By default, the public facade is implemented as an instance of {@link sap.ui.base.Interface},
|
48
|
+
* exposing the <code>publicMethods</code> as defined in the metadata of the class of this object.
|
49
|
+
*
|
50
|
+
* See the documentation of the {@link #.extend extend} method for an explanation of <code>publicMethods</code>.
|
51
|
+
*
|
52
|
+
* The facade is created on the first call of <code>getInterface</code> and reused for all later calls.
|
53
|
+
*
|
54
|
+
* @public
|
55
|
+
* @returns {sap.ui.base.Object} A facade for this object, with at least the public methods of the class of this.
|
56
|
+
*/
|
12
57
|
BaseObject.prototype.getInterface = function () {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
58
|
+
// New implementation that avoids the overhead of a dedicated member for the interface
|
59
|
+
// initially, an Object instance has no associated Interface and the getInterface
|
60
|
+
// method is defined only in the prototype. So the code here will be executed.
|
61
|
+
// It creates an interface (basically the same code as in the old implementation)
|
62
|
+
var oInterface = new BaseObject._Interface(this, this.getMetadata().getAllPublicMethods());
|
63
|
+
// Now this Object instance gets a new, private implementation of getInterface
|
64
|
+
// that returns the newly created oInterface. Future calls of getInterface on the
|
65
|
+
// same Object therefore will return the already created interface
|
66
|
+
this.getInterface = function () {
|
17
67
|
return oInterface;
|
68
|
+
};
|
69
|
+
// as the first caller doesn't benefit from the new method implementation we have to
|
70
|
+
// return the created interface as well.
|
71
|
+
return oInterface;
|
18
72
|
};
|
73
|
+
|
74
|
+
/**
|
75
|
+
* Returns the metadata for the class that this object belongs to.
|
76
|
+
*
|
77
|
+
* This method is only defined when metadata has been declared by using {@link sap.ui.base.Object.defineClass}
|
78
|
+
* or {@link sap.ui.base.Object.extend}.
|
79
|
+
*
|
80
|
+
* @return {sap.ui.base.Metadata} metadata for the class of the object
|
81
|
+
* @name sap.ui.base.Object#getMetadata
|
82
|
+
* @function
|
83
|
+
* @public
|
84
|
+
*/
|
85
|
+
|
86
|
+
/**
|
87
|
+
* The structure of the "metadata" object which is passed when inheriting from sap.ui.base.Object using its static "extend" method.
|
88
|
+
* See {@link sap.ui.base.Object.extend} for details on its usage.
|
89
|
+
*
|
90
|
+
* @typedef {object} sap.ui.base.Object.MetadataOptions
|
91
|
+
*
|
92
|
+
* @property {string[]} [interfaces] set of names of implemented interfaces (defaults to no interfaces)
|
93
|
+
* @property {boolean} [abstract=false] flag that marks the class as abstract (purely informational, defaults to false)
|
94
|
+
* @property {boolean} [final=false] flag that marks the class as final (defaults to false)
|
95
|
+
* @property {boolean} [deprecated=false] flag that marks the class as deprecated (defaults to false). May lead to an additional warning
|
96
|
+
* log message at runtime when the object is still used. For the documentation, also add a <code>@deprecated</code> tag in the JSDoc,
|
97
|
+
* describing since when it is deprecated and what any alternatives are.
|
98
|
+
*
|
99
|
+
* @public
|
100
|
+
*/
|
101
|
+
|
102
|
+
/**
|
103
|
+
* Creates a subclass of class sap.ui.base.Object with name <code>sClassName</code>
|
104
|
+
* and enriches it with the information contained in <code>oClassInfo</code>.
|
105
|
+
*
|
106
|
+
* <code>oClassInfo</code> might contain three kinds of information:
|
107
|
+
* <ul>
|
108
|
+
* <li><code>metadata:</code> an (optional) object literal with metadata about the class like implemented interfaces,
|
109
|
+
* see {@link sap.ui.base.Object.MetadataOptions MetadataOptions} for details.
|
110
|
+
* The information in the object literal will be wrapped by an instance of {@link sap.ui.base.Metadata Metadata}.
|
111
|
+
* Subclasses of sap.ui.base.Object can enrich the set of supported metadata (e.g. see {@link sap.ui.core.Element.extend}).
|
112
|
+
* </li>
|
113
|
+
*
|
114
|
+
* <li><code>constructor:</code> a function that serves as a constructor function for the new class.
|
115
|
+
* If no constructor function is given, the framework creates a default implementation that delegates all
|
116
|
+
* its arguments to the constructor function of the base class.
|
117
|
+
* </li>
|
118
|
+
*
|
119
|
+
* <li><i>any-other-name:</i> any other property in the <code>oClassInfo</code> is copied into the prototype
|
120
|
+
* object of the newly created class. Callers can thereby add methods or properties to all instances of the
|
121
|
+
* class. But be aware that the given values are shared between all instances of the class. Usually, it doesn't
|
122
|
+
* make sense to use primitive values here other than to declare public constants.
|
123
|
+
*
|
124
|
+
* If such a property has a function as its value, and if the property name does not start with an underscore
|
125
|
+
* or with the prefix "on", the property name will be automatically added to the list of public methods of the
|
126
|
+
* class (see property <code>publicMethods</code> in the <code>metadata</code> section). If a method's name
|
127
|
+
* matches that pattern, but is not meant to be public, it shouldn't be included in the class info object,
|
128
|
+
* but be assigned to the prototype instead.
|
129
|
+
* </li>
|
130
|
+
*
|
131
|
+
* </ul>
|
132
|
+
*
|
133
|
+
* The prototype object of the newly created class uses the same prototype as instances of the base class
|
134
|
+
* (prototype chaining).
|
135
|
+
*
|
136
|
+
* A metadata object is always created, even if there is no <code>metadata</code> entry in the <code>oClassInfo</code>
|
137
|
+
* object. A getter for the metadata is always attached to the prototype and to the class (constructor function)
|
138
|
+
* itself.
|
139
|
+
*
|
140
|
+
* Last but not least, with the third argument <code>FNMetaImpl</code> the constructor of a metadata class
|
141
|
+
* can be specified. Instances of that class will be used to represent metadata for the newly created class
|
142
|
+
* and for any subclass created from it. Typically, only frameworks will use this parameter to enrich the
|
143
|
+
* metadata for a new class hierarchy they introduce (e.g. {@link sap.ui.core.Element.extend Element}).
|
144
|
+
*
|
145
|
+
* @param {string} sClassName name of the class to be created
|
146
|
+
* @param {object} [oClassInfo] structured object with information about the class
|
147
|
+
* @param {function} [FNMetaImpl] constructor function for the metadata object. If not given, it defaults to sap.ui.base.Metadata.
|
148
|
+
* @return {function} the created class / constructor function
|
149
|
+
* @public
|
150
|
+
* @static
|
151
|
+
* @name sap.ui.base.Object.extend
|
152
|
+
* @function
|
153
|
+
* @since 1.3.1
|
154
|
+
*/
|
155
|
+
|
156
|
+
/**
|
157
|
+
* Creates metadata for a given class and attaches it to the constructor and prototype of that class.
|
158
|
+
*
|
159
|
+
* After creation, metadata can be retrieved with getMetadata().
|
160
|
+
*
|
161
|
+
* The static info can at least contain the following entries:
|
162
|
+
* <ul>
|
163
|
+
* <li>baseType: {string} fully qualified name of a base class or empty</li>
|
164
|
+
* <li>publicMethods: {string} an array of method names that will be visible in the interface proxy returned by {@link #getInterface}</li>
|
165
|
+
* </ul>
|
166
|
+
*
|
167
|
+
* @param {string} sClassName name of an (already declared) constructor function
|
168
|
+
* @param {object} oStaticInfo static info used to create the metadata object
|
169
|
+
* @param {string} oStaticInfo.baseType qualified name of a base class
|
170
|
+
* @param {string[]} oStaticInfo.publicMethods array of names of public methods
|
171
|
+
* @param {function} [FNMetaImpl] constructor function for the metadata object. If not given, it defaults to sap.ui.base.Metadata.
|
172
|
+
*
|
173
|
+
* @return {sap.ui.base.Metadata} the created metadata object
|
174
|
+
* @public
|
175
|
+
* @static
|
176
|
+
* @deprecated Since 1.3.1. Use the static <code>extend</code> method of the desired base class (e.g. {@link sap.ui.base.Object.extend})
|
177
|
+
*/
|
19
178
|
BaseObject.defineClass = function (sClassName, oStaticInfo, FNMetaImpl) {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
};
|
25
|
-
if (!oMetadata.isFinal()) {
|
26
|
-
fnClass.extend = function (sSCName, oSCClassInfo, fnSCMetaImpl) {
|
27
|
-
return Metadata.createClass(fnClass, sSCName, oSCClassInfo, fnSCMetaImpl || FNMetaImpl);
|
28
|
-
};
|
29
|
-
}
|
30
|
-
Log.debug('defined class \'' + sClassName + '\'' + (oMetadata.getParent() ? ' as subclass of ' + oMetadata.getParent().getName() : ''));
|
179
|
+
// create Metadata object
|
180
|
+
var oMetadata = new (FNMetaImpl || Metadata)(sClassName, oStaticInfo);
|
181
|
+
var fnClass = oMetadata.getClass();
|
182
|
+
fnClass.getMetadata = fnClass.prototype.getMetadata = function () {
|
31
183
|
return oMetadata;
|
184
|
+
};
|
185
|
+
// enrich function
|
186
|
+
if (!oMetadata.isFinal()) {
|
187
|
+
fnClass.extend = function (sSCName, oSCClassInfo, fnSCMetaImpl) {
|
188
|
+
return Metadata.createClass(fnClass, sSCName, oSCClassInfo, fnSCMetaImpl || FNMetaImpl);
|
189
|
+
};
|
190
|
+
}
|
191
|
+
Log.debug("defined class '" + sClassName + "'" + (oMetadata.getParent() ? " as subclass of " + oMetadata.getParent().getName() : ""));
|
192
|
+
return oMetadata;
|
32
193
|
};
|
194
|
+
|
195
|
+
/**
|
196
|
+
* Checks whether this object is an instance of the named type.
|
197
|
+
*
|
198
|
+
* This check is solely based on the type names as declared in the class metadata.
|
199
|
+
* It compares the given <code>vTypeName</code> with the name of the class of this object,
|
200
|
+
* with the names of any base class of that class and with the names of all interfaces
|
201
|
+
* implemented by any of the aforementioned classes.
|
202
|
+
*
|
203
|
+
* Instead of a single type name, an array of type names can be given and the method
|
204
|
+
* will check if this object is an instance of any of the listed types (logical or).
|
205
|
+
*
|
206
|
+
* Should the UI5 class system in future implement additional means of associating classes
|
207
|
+
* with type names (e.g. by introducing mixins), then this method might detect matches
|
208
|
+
* for those names as well.
|
209
|
+
*
|
210
|
+
* @example
|
211
|
+
* myObject.isA("sap.ui.core.Control"); // true if myObject is an instance of sap.ui.core.Control
|
212
|
+
* myObject.isA(["sap.ui.core.Control", "sap.ui.core.Fragment"]); // true if myObject is an instance of sap.ui.core.Control or sap.ui.core.Fragment
|
213
|
+
*
|
214
|
+
* @param {string|string[]} vTypeName Type or types to check for
|
215
|
+
* @returns {boolean} Whether this object is an instance of the given type or of any of the given types
|
216
|
+
* @public
|
217
|
+
* @since 1.56
|
218
|
+
*/
|
33
219
|
BaseObject.prototype.isA = function (vTypeName) {
|
34
|
-
|
220
|
+
return this.getMetadata().isA(vTypeName);
|
35
221
|
};
|
222
|
+
|
223
|
+
/**
|
224
|
+
* Checks whether the given object is an instance of the named type.
|
225
|
+
* This function is a short-hand convenience for {@link sap.ui.base.Object#isA}.
|
226
|
+
*
|
227
|
+
* Please see the API documentation of {@link sap.ui.base.Object#isA} for more details.
|
228
|
+
*
|
229
|
+
* @param {any} oObject Object which will be checked whether it is an instance of the given type
|
230
|
+
* @param {string|string[]} vTypeName Type or types to check for
|
231
|
+
* @returns {boolean} Whether the given object is an instance of the given type or of any of the given types
|
232
|
+
* @public
|
233
|
+
* @since 1.56
|
234
|
+
* @static
|
235
|
+
* @deprecated Since 1.120, please use {@link sap.ui.base.Object.isObjectA}.
|
236
|
+
*/
|
36
237
|
BaseObject.isA = function (oObject, vTypeName) {
|
37
|
-
|
238
|
+
return oObject instanceof BaseObject && oObject.isA(vTypeName);
|
38
239
|
};
|
240
|
+
|
241
|
+
/**
|
242
|
+
* Checks whether the given object is an instance of the named type.
|
243
|
+
* This function is a short-hand convenience for {@link sap.ui.base.Object#isA}.
|
244
|
+
*
|
245
|
+
* Please see the API documentation of {@link sap.ui.base.Object#isA} for more details.
|
246
|
+
*
|
247
|
+
* @param {any} oObject Object which will be checked whether it is an instance of the given type
|
248
|
+
* @param {string|string[]} vTypeName Type or types to check for
|
249
|
+
* @returns {boolean} Whether the given object is an instance of the given type or of any of the given types
|
250
|
+
* @public
|
251
|
+
* @since 1.120
|
252
|
+
* @static
|
253
|
+
*/
|
254
|
+
BaseObject.isObjectA = function (oObject, vTypeName) {
|
255
|
+
return oObject instanceof BaseObject && oObject.isA(vTypeName);
|
256
|
+
};
|
257
|
+
|
258
|
+
/**
|
259
|
+
* @param {sap.ui.base.Object} [oObject] Object for which a facade should be created
|
260
|
+
* @param {string[]} [aMethods=[]] Names of the methods, that should be available in the new facade
|
261
|
+
* @param {boolean} [_bReturnFacade=false] If true, the return value of a function call is this created Interface instance instead of the BaseObject interface
|
262
|
+
* @private
|
263
|
+
* @static
|
264
|
+
*/
|
39
265
|
BaseObject._Interface = function (oObject, aMethods, _bReturnFacade) {
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
}
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
266
|
+
// if object is null or undefined, return itself
|
267
|
+
if (!oObject) {
|
268
|
+
return oObject;
|
269
|
+
}
|
270
|
+
function fCreateDelegator(oObject, sMethodName) {
|
271
|
+
return function () {
|
272
|
+
// return oObject[sMethodName].apply(oObject, arguments);
|
273
|
+
var tmp = oObject[sMethodName].apply(oObject, arguments);
|
274
|
+
// to avoid to hide the implementation behind the interface you need
|
275
|
+
// to override the getInterface function in the object or create the interface with bFacade = true
|
276
|
+
if (_bReturnFacade) {
|
277
|
+
return this;
|
278
|
+
} else {
|
279
|
+
return tmp instanceof BaseObject ? tmp.getInterface() : tmp;
|
280
|
+
}
|
281
|
+
};
|
282
|
+
}
|
283
|
+
|
284
|
+
// if there are no methods return
|
285
|
+
if (!aMethods) {
|
286
|
+
return {};
|
287
|
+
}
|
288
|
+
var sMethodName;
|
289
|
+
|
290
|
+
// create functions for all delegated methods
|
291
|
+
// PERFOPT: 'cache' length of aMethods to reduce # of resolutions
|
292
|
+
for (var i = 0, ml = aMethods.length; i < ml; i++) {
|
293
|
+
sMethodName = aMethods[i];
|
294
|
+
//!oObject[sMethodName] for 'lazy' loading interface methods ;-)
|
295
|
+
if (!oObject[sMethodName] || typeof oObject[sMethodName] === "function") {
|
296
|
+
this[sMethodName] = fCreateDelegator(oObject, sMethodName);
|
62
297
|
}
|
298
|
+
}
|
63
299
|
};
|
64
300
|
export default BaseObject;
|
@@ -1,2 +1,24 @@
|
|
1
|
-
|
1
|
+
/*!
|
2
|
+
* OpenUI5
|
3
|
+
* (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
5
|
+
*/
|
6
|
+
// Provides type sap.ui.core.CalendarType.
|
7
|
+
import DataType from "../base/DataType.js";
|
8
|
+
import CalendarType from "../../base/i18n/date/CalendarType.js";
|
9
|
+
/**
|
10
|
+
* The types of <code>Calendar</code>.
|
11
|
+
*
|
12
|
+
* @enum {string}
|
13
|
+
* @name sap.ui.core.CalendarType
|
14
|
+
* @public
|
15
|
+
* @deprecated As of Version 1.120. Please use {@link module:sap/base/18n/date/CalendarType} instead.
|
16
|
+
* @borrows module:sap/base/i18n/date/CalendarType.Gregorian as Gregorian
|
17
|
+
* @borrows module:sap/base/i18n/date/CalendarType.Islamic as Islamic
|
18
|
+
* @borrows module:sap/base/i18n/date/CalendarType.Japanese as Japanese
|
19
|
+
* @borrows module:sap/base/i18n/date/CalendarType.Persian as Persian
|
20
|
+
* @borrows module:sap/base/i18n/date/CalendarType.Buddhist as Buddhist
|
21
|
+
*/
|
22
|
+
|
23
|
+
DataType.registerEnum("sap.ui.core.CalendarType", CalendarType);
|
2
24
|
export default CalendarType;
|
@@ -1,62 +1,194 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
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
|
-
getExtensionSubtags: function () {
|
37
|
-
return this.extensionSubtags;
|
38
|
-
},
|
39
|
-
getPrivateUse: function () {
|
40
|
-
return this.privateUse;
|
41
|
-
},
|
42
|
-
getPrivateUseSubtags: function () {
|
43
|
-
return this.privateUseSubtags;
|
44
|
-
},
|
45
|
-
hasPrivateUseSubtag: function (sSubtag) {
|
46
|
-
assert(sSubtag && sSubtag.match(/^[0-9A-Z]{1,8}$/i), 'subtag must be a valid BCP47 private use tag');
|
47
|
-
return this.privateUseSubtags.indexOf(sSubtag) >= 0;
|
48
|
-
},
|
49
|
-
toString: function () {
|
50
|
-
return this.oLanguageTag.toString();
|
51
|
-
},
|
52
|
-
getSAPLogonLanguage: function () {
|
53
|
-
return Localization._getSAPLogonLanguage(this);
|
1
|
+
/*!
|
2
|
+
* OpenUI5
|
3
|
+
* (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
5
|
+
*/
|
6
|
+
//Provides the locale object sap.ui.core.Locale
|
7
|
+
import assert from "../../base/assert.js";
|
8
|
+
import BaseObject from "../base/Object.js";
|
9
|
+
import Localization from "../../base/i18n/Localization.js";
|
10
|
+
import LanguageTag from "../../base/i18n/LanguageTag.js";
|
11
|
+
var mCache = Object.create(null);
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Creates an instance of the Locale.
|
15
|
+
*
|
16
|
+
* @class Locale represents a locale setting, consisting of a language, script, region, variants, extensions and private use section.
|
17
|
+
*
|
18
|
+
* @param {string} sLocale the locale identifier, in format en-US or en_US.
|
19
|
+
*
|
20
|
+
* @extends sap.ui.base.Object
|
21
|
+
* @author SAP SE
|
22
|
+
* @version 1.120.3
|
23
|
+
* @public
|
24
|
+
* @alias sap.ui.core.Locale
|
25
|
+
*/
|
26
|
+
var Locale = BaseObject.extend("sap.ui.core.Locale", /** @lends sap.ui.core.Locale.prototype */{
|
27
|
+
constructor: function (vLocale) {
|
28
|
+
BaseObject.apply(this);
|
29
|
+
if (vLocale instanceof LanguageTag) {
|
30
|
+
this.oLanguageTag = vLocale;
|
31
|
+
this.sLocaleId = this.oLanguageTag.toString();
|
32
|
+
} else {
|
33
|
+
this.oLanguageTag = new LanguageTag(vLocale);
|
34
|
+
this.sLocaleId = vLocale;
|
54
35
|
}
|
36
|
+
Object.assign(this, this.oLanguageTag);
|
37
|
+
this.sLanguage = this.language;
|
38
|
+
},
|
39
|
+
/**
|
40
|
+
* Get the locale language.
|
41
|
+
*
|
42
|
+
* Note that the case might differ from the original script tag
|
43
|
+
* (Lower case is enforced as recommended by BCP47/ISO639).
|
44
|
+
*
|
45
|
+
* @returns {string} the language code
|
46
|
+
* @public
|
47
|
+
*/
|
48
|
+
getLanguage: function () {
|
49
|
+
return this.language;
|
50
|
+
},
|
51
|
+
/**
|
52
|
+
* Get the locale script or <code>null</code> if none was specified.
|
53
|
+
*
|
54
|
+
* Note that the case might differ from the original language tag
|
55
|
+
* (Upper case first letter and lower case reminder enforced as
|
56
|
+
* recommended by BCP47/ISO15924)
|
57
|
+
*
|
58
|
+
* @returns {string|null} the script code or <code>null</code>
|
59
|
+
* @public
|
60
|
+
*/
|
61
|
+
getScript: function () {
|
62
|
+
return this.script;
|
63
|
+
},
|
64
|
+
/**
|
65
|
+
* Get the locale region or <code>null</code> if none was specified.
|
66
|
+
*
|
67
|
+
* Note that the case might differ from the original script tag
|
68
|
+
* (Upper case is enforced as recommended by BCP47/ISO3166-1).
|
69
|
+
*
|
70
|
+
* @returns {string} the ISO3166-1 region code (2-letter or 3-digits)
|
71
|
+
* @public
|
72
|
+
*/
|
73
|
+
getRegion: function () {
|
74
|
+
return this.region;
|
75
|
+
},
|
76
|
+
/**
|
77
|
+
* Get the locale variants as a single string or <code>null</code>.
|
78
|
+
*
|
79
|
+
* Multiple variants are separated by a dash '-'.
|
80
|
+
*
|
81
|
+
* @returns {string|null} the variant or <code>null</code>
|
82
|
+
* @public
|
83
|
+
*/
|
84
|
+
getVariant: function () {
|
85
|
+
return this.variant;
|
86
|
+
},
|
87
|
+
/**
|
88
|
+
* Get the locale variants as an array of individual variants.
|
89
|
+
*
|
90
|
+
* The separating dashes are not part of the result.
|
91
|
+
* If there is no variant section in the locale tag, an empty array is returned.
|
92
|
+
*
|
93
|
+
* @returns {string[]} the individual variant sections
|
94
|
+
* @public
|
95
|
+
*/
|
96
|
+
getVariantSubtags: function () {
|
97
|
+
return this.variantSubtags;
|
98
|
+
},
|
99
|
+
/**
|
100
|
+
* Get the locale extension as a single string or <code>null</code>.
|
101
|
+
*
|
102
|
+
* The extension always consists of a singleton character (not 'x'),
|
103
|
+
* a dash '-' and one or more extension token, each separated
|
104
|
+
* again with a dash.
|
105
|
+
*
|
106
|
+
* Use {@link #getExtensions} to get the individual extension tokens as an array.
|
107
|
+
*
|
108
|
+
* @returns {string|null} the extension or <code>null</code>
|
109
|
+
* @public
|
110
|
+
*/
|
111
|
+
getExtension: function () {
|
112
|
+
return this.extension;
|
113
|
+
},
|
114
|
+
/**
|
115
|
+
* Get the locale extensions as an array of tokens.
|
116
|
+
*
|
117
|
+
* The leading singleton and the separating dashes are not part of the result.
|
118
|
+
* If there is no extensions section in the locale tag, an empty array is returned.
|
119
|
+
*
|
120
|
+
* @returns {string[]} the individual extension sections
|
121
|
+
* @public
|
122
|
+
*/
|
123
|
+
getExtensionSubtags: function () {
|
124
|
+
return this.extensionSubtags;
|
125
|
+
},
|
126
|
+
/**
|
127
|
+
* Get the locale private use section or <code>null</code>.
|
128
|
+
*
|
129
|
+
* @returns {string} the private use section
|
130
|
+
* @public
|
131
|
+
*/
|
132
|
+
getPrivateUse: function () {
|
133
|
+
return this.privateUse;
|
134
|
+
},
|
135
|
+
/**
|
136
|
+
* Get the locale private use section as an array of tokens.
|
137
|
+
*
|
138
|
+
* The leading singleton and the separating dashes are not part of the result.
|
139
|
+
* If there is no private use section in the locale tag, an empty array is returned.
|
140
|
+
*
|
141
|
+
* @returns {string[]} the tokens of the private use section
|
142
|
+
* @public
|
143
|
+
*/
|
144
|
+
getPrivateUseSubtags: function () {
|
145
|
+
return this.privateUseSubtags;
|
146
|
+
},
|
147
|
+
/**
|
148
|
+
* Check if a subtag is provided
|
149
|
+
*
|
150
|
+
* @param {string} sSubtag The subtag to check
|
151
|
+
* @returns {boolean} Wether the subtag is provided or not
|
152
|
+
*/
|
153
|
+
hasPrivateUseSubtag: function (sSubtag) {
|
154
|
+
assert(sSubtag && sSubtag.match(/^[0-9A-Z]{1,8}$/i), "subtag must be a valid BCP47 private use tag");
|
155
|
+
return this.privateUseSubtags.indexOf(sSubtag) >= 0;
|
156
|
+
},
|
157
|
+
toString: function () {
|
158
|
+
return this.oLanguageTag.toString();
|
159
|
+
},
|
160
|
+
/**
|
161
|
+
* Best guess to get a proper SAP Logon Language for this locale.
|
162
|
+
*
|
163
|
+
* Conversions taken into account:
|
164
|
+
* <ul>
|
165
|
+
* <li>use the language part only</li>
|
166
|
+
* <li>convert old ISO639 codes to newer ones (e.g. 'iw' to 'he')</li>
|
167
|
+
* <li>for Chinese, map 'Traditional Chinese' or region 'TW' to SAP proprietary code 'zf'</li>
|
168
|
+
* <li>map private extensions x-saptrc, x-sappsd and saprigi to SAP pseudo languages '1Q', '2Q' and '3Q'</li>
|
169
|
+
* <li>remove ext. language sub tags</li>
|
170
|
+
* <li>convert to uppercase</li>
|
171
|
+
* </ul>
|
172
|
+
*
|
173
|
+
* Note that the conversion also returns a result for languages that are not
|
174
|
+
* supported by the default set of SAP languages. This method has no knowledge
|
175
|
+
* about the concrete languages of any given backend system.
|
176
|
+
*
|
177
|
+
* @returns {string} a language code that should
|
178
|
+
* @public
|
179
|
+
* @since 1.17.0
|
180
|
+
* @deprecated As of 1.44, use {@link sap.ui.core.Configuration#getSAPLogonLanguage} instead
|
181
|
+
* as that class allows to configure an SAP Logon language.
|
182
|
+
*/
|
183
|
+
getSAPLogonLanguage: function () {
|
184
|
+
return Localization._getSAPLogonLanguage(this);
|
185
|
+
}
|
55
186
|
});
|
56
187
|
Locale._getCoreLocale = function (oLocale) {
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
188
|
+
if (oLocale instanceof LanguageTag) {
|
189
|
+
oLocale = mCache[oLocale.toString()] || new Locale(oLocale);
|
190
|
+
mCache[oLocale.toString()] = oLocale;
|
191
|
+
}
|
192
|
+
return oLocale;
|
61
193
|
};
|
62
194
|
export default Locale;
|