@ui5/webcomponents-localization 0.0.0-d9b978d1d → 0.0.0-da0d3eb88

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.
Files changed (217) hide show
  1. package/CHANGELOG.md +469 -0
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/dates/calculateWeekNumber.d.ts +2 -1
  4. package/dist/dates/calculateWeekNumber.js +6 -6
  5. package/dist/dates/calculateWeekNumber.js.map +1 -1
  6. package/dist/generated/assets/cldr/ar.json +102 -62
  7. package/dist/generated/assets/cldr/ar_EG.json +102 -62
  8. package/dist/generated/assets/cldr/ar_SA.json +102 -62
  9. package/dist/generated/assets/cldr/bg.json +364 -325
  10. package/dist/generated/assets/cldr/ca.json +491 -453
  11. package/{src/generated/assets/cldr/sr_Latn.json → dist/generated/assets/cldr/cnr.json} +471 -380
  12. package/dist/generated/assets/cldr/cs.json +431 -324
  13. package/dist/generated/assets/cldr/cy.json +608 -340
  14. package/dist/generated/assets/cldr/da.json +290 -227
  15. package/dist/generated/assets/cldr/de.json +348 -241
  16. package/dist/generated/assets/cldr/de_AT.json +348 -241
  17. package/dist/generated/assets/cldr/de_CH.json +347 -240
  18. package/dist/generated/assets/cldr/el.json +128 -100
  19. package/dist/generated/assets/cldr/el_CY.json +128 -100
  20. package/dist/generated/assets/cldr/en.json +538 -512
  21. package/dist/generated/assets/cldr/en_AU.json +583 -520
  22. package/dist/generated/assets/cldr/en_GB.json +485 -441
  23. package/dist/generated/assets/cldr/en_HK.json +519 -474
  24. package/dist/generated/assets/cldr/en_IE.json +485 -440
  25. package/dist/generated/assets/cldr/en_IN.json +465 -420
  26. package/dist/generated/assets/cldr/en_NZ.json +505 -460
  27. package/dist/generated/assets/cldr/en_PG.json +505 -460
  28. package/dist/generated/assets/cldr/en_SG.json +505 -460
  29. package/dist/generated/assets/cldr/en_ZA.json +485 -440
  30. package/dist/generated/assets/cldr/es.json +709 -456
  31. package/dist/generated/assets/cldr/es_AR.json +687 -434
  32. package/dist/generated/assets/cldr/es_BO.json +721 -468
  33. package/dist/generated/assets/cldr/es_CL.json +567 -422
  34. package/dist/generated/assets/cldr/es_CO.json +485 -339
  35. package/dist/generated/assets/cldr/es_MX.json +734 -481
  36. package/dist/generated/assets/cldr/es_PE.json +409 -372
  37. package/dist/generated/assets/cldr/es_UY.json +433 -396
  38. package/dist/generated/assets/cldr/es_VE.json +453 -416
  39. package/dist/generated/assets/cldr/et.json +340 -307
  40. package/dist/generated/assets/cldr/fa.json +96 -34
  41. package/dist/generated/assets/cldr/fi.json +359 -308
  42. package/dist/generated/assets/cldr/fr.json +347 -321
  43. package/dist/generated/assets/cldr/fr_BE.json +347 -321
  44. package/dist/generated/assets/cldr/fr_CA.json +458 -432
  45. package/dist/generated/assets/cldr/fr_CH.json +290 -264
  46. package/dist/generated/assets/cldr/fr_LU.json +347 -321
  47. package/dist/generated/assets/cldr/he.json +241 -130
  48. package/dist/generated/assets/cldr/hi.json +103 -53
  49. package/dist/generated/assets/cldr/hr.json +467 -410
  50. package/dist/generated/assets/cldr/hu.json +246 -195
  51. package/dist/generated/assets/cldr/id.json +478 -406
  52. package/dist/generated/assets/cldr/it.json +418 -362
  53. package/dist/generated/assets/cldr/it_CH.json +418 -362
  54. package/dist/generated/assets/cldr/ja.json +58 -18
  55. package/dist/generated/assets/cldr/kk.json +562 -398
  56. package/dist/generated/assets/cldr/ko.json +36 -15
  57. package/dist/generated/assets/cldr/lt.json +320 -231
  58. package/dist/generated/assets/cldr/lv.json +184 -120
  59. package/dist/generated/assets/cldr/mk.json +4408 -0
  60. package/dist/generated/assets/cldr/ms.json +460 -388
  61. package/dist/generated/assets/cldr/nb.json +160 -92
  62. package/dist/generated/assets/cldr/nl.json +621 -373
  63. package/dist/generated/assets/cldr/nl_BE.json +621 -373
  64. package/dist/generated/assets/cldr/pl.json +590 -279
  65. package/dist/generated/assets/cldr/pt.json +696 -334
  66. package/dist/generated/assets/cldr/pt_PT.json +730 -454
  67. package/dist/generated/assets/cldr/ro.json +409 -339
  68. package/dist/generated/assets/cldr/ru.json +317 -279
  69. package/dist/generated/assets/cldr/ru_UA.json +312 -274
  70. package/dist/generated/assets/cldr/sk.json +454 -413
  71. package/dist/generated/assets/cldr/sl.json +118 -80
  72. package/dist/generated/assets/cldr/sr.json +294 -142
  73. package/dist/generated/assets/cldr/sr_Latn.json +972 -824
  74. package/dist/generated/assets/cldr/sv.json +382 -338
  75. package/dist/generated/assets/cldr/th.json +56 -36
  76. package/dist/generated/assets/cldr/tr.json +371 -320
  77. package/dist/generated/assets/cldr/uk.json +340 -290
  78. package/dist/generated/assets/cldr/vi.json +352 -328
  79. package/dist/generated/assets/cldr/zh_CN.json +34 -10
  80. package/dist/generated/assets/cldr/zh_HK.json +33 -9
  81. package/dist/generated/assets/cldr/zh_SG.json +33 -9
  82. package/dist/generated/assets/cldr/zh_TW.json +52 -28
  83. package/dist/generated/json-imports/LocaleData.js +4 -2
  84. package/dist/generated/json-imports/LocaleData.js.map +1 -1
  85. package/dist/sap/base/Event.js +59 -0
  86. package/dist/sap/base/Eventing.js +146 -0
  87. package/dist/sap/base/Log.js +2 -239
  88. package/dist/sap/base/assert.js +28 -1
  89. package/dist/sap/base/config/MemoryConfigurationProvider.js +20 -0
  90. package/dist/sap/base/config.js +17 -0
  91. package/dist/sap/base/i18n/Formatting.js +1130 -0
  92. package/dist/sap/base/i18n/LanguageTag.js +168 -30
  93. package/dist/sap/base/i18n/date/CalendarType.js +36 -1
  94. package/dist/sap/base/i18n/date/CalendarWeekNumbering.js +76 -1
  95. package/dist/sap/base/i18n/date/TimezoneUtils.js +242 -12
  96. package/dist/sap/base/strings/camelize.js +30 -0
  97. package/dist/sap/base/strings/formatMessage.js +88 -15
  98. package/dist/sap/base/util/ObjectPath.d.ts +4 -0
  99. package/dist/sap/base/util/ObjectPath.js +4 -33
  100. package/dist/sap/base/util/ObjectPath.js.map +1 -0
  101. package/dist/sap/base/util/Version.js +157 -0
  102. package/dist/sap/base/util/_merge.js +83 -26
  103. package/dist/sap/base/util/array/uniqueSort.js +37 -15
  104. package/dist/sap/base/util/deepClone.js +102 -0
  105. package/dist/sap/base/util/deepEqual.js +75 -51
  106. package/dist/sap/base/util/extend.js +58 -7
  107. package/dist/sap/base/util/isEmptyObject.js +34 -0
  108. package/dist/sap/base/util/isPlainObject.js +35 -1
  109. package/dist/sap/base/util/now.js +24 -3
  110. package/dist/sap/base/util/resolveReference.js +3 -0
  111. package/dist/sap/base/util/uid.js +27 -0
  112. package/dist/sap/ui/base/DataType.js +657 -0
  113. package/dist/sap/ui/base/Interface.js +47 -1
  114. package/dist/sap/ui/base/Metadata.js +433 -180
  115. package/dist/sap/ui/base/Object.js +284 -48
  116. package/dist/sap/ui/core/CalendarType.js +23 -1
  117. package/dist/sap/ui/core/Locale.js +189 -57
  118. package/dist/sap/ui/core/LocaleData.js +2670 -1380
  119. package/dist/sap/ui/core/Supportability.js +5 -0
  120. package/dist/sap/ui/core/Theming.js +539 -0
  121. package/dist/sap/ui/core/date/Buddhist.js +162 -87
  122. package/dist/sap/ui/core/date/CalendarUtils.js +61 -21
  123. package/dist/sap/ui/core/date/CalendarWeekNumbering.js +29 -1
  124. package/dist/sap/ui/core/date/Gregorian.js +25 -10
  125. package/dist/sap/ui/core/date/Islamic.js +298 -185
  126. package/dist/sap/ui/core/date/Japanese.js +210 -115
  127. package/dist/sap/ui/core/date/Persian.js +324 -195
  128. package/dist/sap/ui/core/date/UI5Date.js +923 -237
  129. package/dist/sap/ui/core/date/UniversalDate.js +1238 -245
  130. package/dist/sap/ui/core/date/_Calendars.js +10 -1
  131. package/dist/sap/ui/core/format/DateFormat.js +3163 -2145
  132. package/dist/sap/ui/core/format/TimezoneUtil.js +23 -1
  133. package/package-scripts.cjs +7 -11
  134. package/package.json +11 -6
  135. package/tsconfig.json +2 -1
  136. package/used-modules.txt +20 -1
  137. package/dist/Assets-static.d.ts +0 -1
  138. package/dist/Assets-static.js +0 -3
  139. package/dist/Assets-static.js.map +0 -1
  140. package/dist/generated/json-imports/LocaleData-static.d.ts +0 -1
  141. package/dist/generated/json-imports/LocaleData-static.js +0 -88
  142. package/dist/generated/json-imports/LocaleData-static.js.map +0 -1
  143. package/dist/sap/ui/Device.js +0 -5
  144. package/src/generated/assets/cldr/ar.json +0 -5533
  145. package/src/generated/assets/cldr/ar_EG.json +0 -5533
  146. package/src/generated/assets/cldr/ar_SA.json +0 -5532
  147. package/src/generated/assets/cldr/bg.json +0 -4454
  148. package/src/generated/assets/cldr/ca.json +0 -4442
  149. package/src/generated/assets/cldr/cs.json +0 -4962
  150. package/src/generated/assets/cldr/cy.json +0 -5213
  151. package/src/generated/assets/cldr/da.json +0 -4310
  152. package/src/generated/assets/cldr/de.json +0 -4315
  153. package/src/generated/assets/cldr/de_AT.json +0 -4316
  154. package/src/generated/assets/cldr/de_CH.json +0 -4314
  155. package/src/generated/assets/cldr/el.json +0 -4283
  156. package/src/generated/assets/cldr/el_CY.json +0 -4283
  157. package/src/generated/assets/cldr/en.json +0 -4318
  158. package/src/generated/assets/cldr/en_AU.json +0 -4321
  159. package/src/generated/assets/cldr/en_GB.json +0 -4331
  160. package/src/generated/assets/cldr/en_HK.json +0 -4339
  161. package/src/generated/assets/cldr/en_IE.json +0 -4330
  162. package/src/generated/assets/cldr/en_IN.json +0 -4335
  163. package/src/generated/assets/cldr/en_NZ.json +0 -4330
  164. package/src/generated/assets/cldr/en_PG.json +0 -4331
  165. package/src/generated/assets/cldr/en_SG.json +0 -4335
  166. package/src/generated/assets/cldr/en_ZA.json +0 -4331
  167. package/src/generated/assets/cldr/es.json +0 -4333
  168. package/src/generated/assets/cldr/es_AR.json +0 -4336
  169. package/src/generated/assets/cldr/es_BO.json +0 -4335
  170. package/src/generated/assets/cldr/es_CL.json +0 -4336
  171. package/src/generated/assets/cldr/es_CO.json +0 -4335
  172. package/src/generated/assets/cldr/es_MX.json +0 -4337
  173. package/src/generated/assets/cldr/es_PE.json +0 -4335
  174. package/src/generated/assets/cldr/es_UY.json +0 -4337
  175. package/src/generated/assets/cldr/es_VE.json +0 -4336
  176. package/src/generated/assets/cldr/et.json +0 -4342
  177. package/src/generated/assets/cldr/fa.json +0 -4369
  178. package/src/generated/assets/cldr/fi.json +0 -4465
  179. package/src/generated/assets/cldr/fr.json +0 -4359
  180. package/src/generated/assets/cldr/fr_BE.json +0 -4359
  181. package/src/generated/assets/cldr/fr_CA.json +0 -4353
  182. package/src/generated/assets/cldr/fr_CH.json +0 -4377
  183. package/src/generated/assets/cldr/fr_LU.json +0 -4359
  184. package/src/generated/assets/cldr/he.json +0 -4871
  185. package/src/generated/assets/cldr/hi.json +0 -4297
  186. package/src/generated/assets/cldr/hr.json +0 -4585
  187. package/src/generated/assets/cldr/hu.json +0 -4366
  188. package/src/generated/assets/cldr/id.json +0 -4062
  189. package/src/generated/assets/cldr/it.json +0 -4301
  190. package/src/generated/assets/cldr/it_CH.json +0 -4301
  191. package/src/generated/assets/cldr/ja.json +0 -4213
  192. package/src/generated/assets/cldr/kk.json +0 -4341
  193. package/src/generated/assets/cldr/ko.json +0 -4191
  194. package/src/generated/assets/cldr/lt.json +0 -4852
  195. package/src/generated/assets/cldr/lv.json +0 -4589
  196. package/src/generated/assets/cldr/ms.json +0 -4023
  197. package/src/generated/assets/cldr/nb.json +0 -4337
  198. package/src/generated/assets/cldr/nl.json +0 -4296
  199. package/src/generated/assets/cldr/nl_BE.json +0 -4296
  200. package/src/generated/assets/cldr/pl.json +0 -4669
  201. package/src/generated/assets/cldr/pt.json +0 -4237
  202. package/src/generated/assets/cldr/pt_PT.json +0 -4374
  203. package/src/generated/assets/cldr/ro.json +0 -4565
  204. package/src/generated/assets/cldr/ru.json +0 -4911
  205. package/src/generated/assets/cldr/ru_UA.json +0 -4911
  206. package/src/generated/assets/cldr/sk.json +0 -4941
  207. package/src/generated/assets/cldr/sl.json +0 -4912
  208. package/src/generated/assets/cldr/sr.json +0 -4587
  209. package/src/generated/assets/cldr/sv.json +0 -4364
  210. package/src/generated/assets/cldr/th.json +0 -4216
  211. package/src/generated/assets/cldr/tr.json +0 -4402
  212. package/src/generated/assets/cldr/uk.json +0 -4860
  213. package/src/generated/assets/cldr/vi.json +0 -4072
  214. package/src/generated/assets/cldr/zh_CN.json +0 -4102
  215. package/src/generated/assets/cldr/zh_HK.json +0 -4110
  216. package/src/generated/assets/cldr/zh_SG.json +0 -4110
  217. package/src/generated/assets/cldr/zh_TW.json +0 -4133
@@ -1,64 +1,300 @@
1
- import Metadata from './Metadata.js';
2
- import Log from '../../base/Log.js';
3
- var BaseObject = Metadata.createClass('sap.ui.base.Object', {
4
- constructor: function () {
5
- if (!(this instanceof BaseObject)) {
6
- throw Error('Cannot instantiate object: "new" is missing!');
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.5
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
- BaseObject.prototype.destroy = function () {
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
- var oInterface = new BaseObject._Interface(this, this.getMetadata().getAllPublicMethods());
14
- this.getInterface = function () {
15
- return oInterface;
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
- var oMetadata = new (FNMetaImpl || Metadata)(sClassName, oStaticInfo);
21
- var fnClass = oMetadata.getClass();
22
- fnClass.getMetadata = fnClass.prototype.getMetadata = function () {
23
- return oMetadata;
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
- return this.getMetadata().isA(vTypeName);
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
- return oObject instanceof BaseObject && oObject.isA(vTypeName);
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
- if (!oObject) {
41
- return oObject;
42
- }
43
- function fCreateDelegator(oObject, sMethodName) {
44
- return function () {
45
- var tmp = oObject[sMethodName].apply(oObject, arguments);
46
- if (_bReturnFacade) {
47
- return this;
48
- } else {
49
- return tmp instanceof BaseObject ? tmp.getInterface() : tmp;
50
- }
51
- };
52
- }
53
- if (!aMethods) {
54
- return {};
55
- }
56
- var sMethodName;
57
- for (var i = 0, ml = aMethods.length; i < ml; i++) {
58
- sMethodName = aMethods[i];
59
- if (!oObject[sMethodName] || typeof oObject[sMethodName] === 'function') {
60
- this[sMethodName] = fCreateDelegator(oObject, sMethodName);
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
- import CalendarType from '../../base/i18n/date/CalendarType.js';
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
- import assert from '../../base/assert.js';
2
- import BaseObject from '../base/Object.js';
3
- import Localization from '../../base/i18n/Localization.js';
4
- import LanguageTag from '../../base/i18n/LanguageTag.js';
5
- var Locale = BaseObject.extend('sap.ui.core.Locale', {
6
- constructor: function (vLocale) {
7
- BaseObject.apply(this);
8
- if (vLocale instanceof LanguageTag) {
9
- this.oLanguageTag = vLocale;
10
- this.sLocaleId = this.oLanguageTag.toString();
11
- } else {
12
- this.oLanguageTag = new LanguageTag(vLocale);
13
- this.sLocaleId = vLocale;
14
- }
15
- Object.assign(this, this.oLanguageTag);
16
- this.sLanguage = this.language;
17
- },
18
- getLanguage: function () {
19
- return this.language;
20
- },
21
- getScript: function () {
22
- return this.script;
23
- },
24
- getRegion: function () {
25
- return this.region;
26
- },
27
- getVariant: function () {
28
- return this.variant;
29
- },
30
- getVariantSubtags: function () {
31
- return this.variantSubtags;
32
- },
33
- getExtension: function () {
34
- return this.extension;
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.5
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
- if (oLocale instanceof LanguageTag) {
58
- oLocale = new Locale(oLocale);
59
- }
60
- return oLocale;
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;