@ui5/webcomponents-localization 0.0.0-b053ad005 → 0.0.0-b0b835975
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/.eslintignore +1 -1
- package/.npsrc.json +3 -0
- package/CHANGELOG.md +571 -0
- package/README.md +5 -6
- package/{src/Assets-static.js → dist/Assets-static.d.ts} +0 -1
- package/dist/Assets-static.js +1 -0
- package/dist/Assets-static.js.map +1 -0
- package/dist/Assets.d.ts +1 -0
- package/dist/Assets.js +1 -0
- package/dist/Assets.js.map +1 -0
- package/dist/DateFormat.d.ts +6 -0
- package/dist/DateFormat.js +6 -2
- package/dist/DateFormat.js.map +1 -0
- package/dist/LocaleData.d.ts +6 -0
- package/dist/LocaleData.js +6 -2
- package/dist/LocaleData.js.map +1 -0
- package/dist/dates/CalendarDate.d.ts +43 -0
- package/dist/dates/CalendarDate.js +171 -201
- package/dist/dates/CalendarDate.js.map +1 -0
- package/dist/dates/ExtremeDates.d.ts +5 -0
- package/dist/dates/ExtremeDates.js +25 -35
- package/dist/dates/ExtremeDates.js.map +1 -0
- package/dist/dates/UI5Date.d.ts +6 -0
- package/dist/dates/UI5Date.js +7 -0
- package/dist/dates/UI5Date.js.map +1 -0
- package/dist/dates/UniversalDate.d.ts +47 -0
- package/dist/dates/UniversalDate.js +5 -0
- package/dist/dates/UniversalDate.js.map +1 -0
- package/dist/dates/calculateWeekNumber.d.ts +5 -0
- package/dist/dates/calculateWeekNumber.js +42 -48
- package/dist/dates/calculateWeekNumber.js.map +1 -0
- package/dist/dates/convertMonthNumbersToMonthNames.d.ts +16 -0
- package/dist/dates/convertMonthNumbersToMonthNames.js +30 -0
- package/dist/dates/convertMonthNumbersToMonthNames.js.map +1 -0
- package/dist/dates/getDaysInMonth.d.ts +3 -0
- package/dist/dates/getDaysInMonth.js +10 -0
- package/dist/dates/getDaysInMonth.js.map +1 -0
- package/dist/dates/getRoundedTimestamp.d.ts +7 -0
- package/dist/dates/getRoundedTimestamp.js +10 -9
- package/dist/dates/getRoundedTimestamp.js.map +1 -0
- package/dist/dates/getTodayUTCTimestamp.d.ts +7 -0
- package/dist/dates/getTodayUTCTimestamp.js +3 -3
- package/dist/dates/getTodayUTCTimestamp.js.map +1 -0
- package/dist/dates/modifyDateBy.d.ts +14 -0
- package/dist/dates/modifyDateBy.js +42 -29
- package/dist/dates/modifyDateBy.js.map +1 -0
- package/dist/dates/transformDateToSecondaryType.d.ts +7 -0
- package/dist/dates/transformDateToSecondaryType.js +18 -0
- package/dist/dates/transformDateToSecondaryType.js.map +1 -0
- package/dist/features/calendar/Buddhist.js +1 -0
- package/dist/features/calendar/Buddhist.js.map +1 -0
- package/dist/features/calendar/Gregorian.js +1 -0
- package/dist/features/calendar/Gregorian.js.map +1 -0
- package/dist/features/calendar/Islamic.js +1 -0
- package/dist/features/calendar/Islamic.js.map +1 -0
- package/dist/features/calendar/Japanese.js +1 -0
- package/dist/features/calendar/Japanese.js.map +1 -0
- package/dist/features/calendar/Persian.js +1 -0
- package/dist/features/calendar/Persian.js.map +1 -0
- package/dist/generated/assets/cldr/ar.json +5531 -5906
- package/dist/generated/assets/cldr/ar_EG.json +5531 -5906
- package/dist/generated/assets/cldr/ar_SA.json +5530 -5906
- package/dist/generated/assets/cldr/bg.json +4452 -4979
- package/dist/generated/assets/cldr/ca.json +4440 -4996
- package/dist/generated/assets/cldr/cs.json +4960 -5498
- package/dist/generated/assets/cldr/cy.json +5211 -5884
- package/dist/generated/assets/cldr/da.json +4308 -4888
- package/dist/generated/assets/cldr/de.json +4313 -4916
- package/dist/generated/assets/cldr/de_AT.json +4314 -4917
- package/dist/generated/assets/cldr/de_CH.json +4312 -4915
- package/dist/generated/assets/cldr/el.json +4281 -4883
- package/dist/generated/assets/cldr/el_CY.json +4281 -4883
- package/dist/generated/assets/cldr/en.json +4316 -4971
- package/dist/generated/assets/cldr/en_AU.json +4319 -4962
- package/dist/generated/assets/cldr/en_GB.json +4329 -4971
- package/dist/generated/assets/cldr/en_HK.json +4337 -4977
- package/dist/generated/assets/cldr/en_IE.json +4328 -4971
- package/dist/generated/assets/cldr/en_IN.json +4333 -4972
- package/dist/generated/assets/cldr/en_NZ.json +4328 -4971
- package/dist/generated/assets/cldr/en_PG.json +4329 -4972
- package/dist/generated/assets/cldr/en_SG.json +4333 -4973
- package/dist/generated/assets/cldr/en_ZA.json +4329 -4972
- package/dist/generated/assets/cldr/es.json +4331 -4912
- package/dist/generated/assets/cldr/es_AR.json +4334 -4914
- package/dist/generated/assets/cldr/es_BO.json +4333 -4913
- package/dist/generated/assets/cldr/es_CL.json +4334 -4914
- package/dist/generated/assets/cldr/es_CO.json +4333 -4913
- package/dist/generated/assets/cldr/es_MX.json +4335 -4915
- package/dist/generated/assets/cldr/es_PE.json +4333 -4913
- package/dist/generated/assets/cldr/es_UY.json +4335 -4915
- package/dist/generated/assets/cldr/es_VE.json +4334 -4914
- package/dist/generated/assets/cldr/et.json +4340 -4967
- package/dist/generated/assets/cldr/fa.json +4367 -4883
- package/dist/generated/assets/cldr/fi.json +4463 -5008
- package/dist/generated/assets/cldr/fr.json +4357 -4979
- package/dist/generated/assets/cldr/fr_BE.json +4357 -4979
- package/dist/generated/assets/cldr/fr_CA.json +4351 -4973
- package/dist/generated/assets/cldr/fr_CH.json +4375 -4997
- package/dist/generated/assets/cldr/fr_LU.json +4357 -4979
- package/dist/generated/assets/cldr/he.json +4869 -5378
- package/dist/generated/assets/cldr/hi.json +4295 -4829
- package/dist/generated/assets/cldr/hr.json +4583 -4919
- package/dist/generated/assets/cldr/hu.json +4364 -4856
- package/dist/generated/assets/cldr/id.json +4060 -4658
- package/dist/generated/assets/cldr/it.json +4299 -4950
- package/dist/generated/assets/cldr/it_CH.json +4299 -4950
- package/dist/generated/assets/cldr/ja.json +4211 -4830
- package/dist/generated/assets/cldr/kk.json +4339 -4725
- package/dist/generated/assets/cldr/ko.json +4189 -4738
- package/dist/generated/assets/cldr/lt.json +4850 -5481
- package/dist/generated/assets/cldr/lv.json +4587 -5112
- package/dist/generated/assets/cldr/ms.json +4021 -4515
- package/dist/generated/assets/cldr/nb.json +4335 -4977
- package/dist/generated/assets/cldr/nl.json +4294 -4884
- package/dist/generated/assets/cldr/nl_BE.json +4294 -4884
- package/dist/generated/assets/cldr/pl.json +4667 -5176
- package/dist/generated/assets/cldr/pt.json +4235 -4805
- package/dist/generated/assets/cldr/pt_PT.json +4372 -4940
- package/dist/generated/assets/cldr/ro.json +4563 -5090
- package/dist/generated/assets/cldr/ru.json +4909 -5407
- package/dist/generated/assets/cldr/ru_UA.json +4909 -5407
- package/dist/generated/assets/cldr/sk.json +4939 -5370
- package/dist/generated/assets/cldr/sl.json +4910 -5340
- package/dist/generated/assets/cldr/sr.json +4585 -5126
- package/dist/generated/assets/cldr/sr_Latn.json +4574 -5127
- package/dist/generated/assets/cldr/sv.json +4362 -5011
- package/dist/generated/assets/cldr/th.json +4214 -4797
- package/dist/generated/assets/cldr/tr.json +4400 -4979
- package/dist/generated/assets/cldr/uk.json +4858 -5353
- package/dist/generated/assets/cldr/vi.json +4070 -4673
- package/dist/generated/assets/cldr/zh_CN.json +4100 -4632
- package/dist/generated/assets/cldr/zh_HK.json +4108 -4640
- package/dist/generated/assets/cldr/zh_SG.json +4108 -4640
- package/dist/generated/assets/cldr/zh_TW.json +4131 -4728
- package/dist/generated/json-imports/LocaleData-static.js +2 -1
- package/dist/generated/json-imports/LocaleData.js +2 -1
- package/dist/getCachedLocaleDataInstance.d.ts +4 -0
- package/dist/getCachedLocaleDataInstance.js +6 -9
- package/dist/getCachedLocaleDataInstance.js.map +1 -0
- package/dist/locale/getLocaleData.d.ts +11 -0
- package/dist/locale/getLocaleData.js +13 -17
- package/dist/locale/getLocaleData.js.map +1 -0
- package/dist/sap/base/Log.js +28 -29
- package/dist/sap/base/assert.js +5 -6
- package/dist/sap/base/i18n/LanguageTag.js +35 -0
- package/dist/sap/base/i18n/Localization.d.ts +4 -0
- package/dist/sap/base/i18n/Localization.js +12 -0
- package/dist/sap/base/i18n/Localization.js.map +1 -0
- package/dist/sap/base/i18n/date/CalendarType.js +8 -0
- package/dist/sap/base/i18n/date/CalendarWeekNumbering.js +30 -0
- package/dist/sap/base/i18n/date/TimezoneUtils.js +89 -0
- package/dist/sap/base/util/LoaderExtensions.d.ts +4 -0
- package/dist/sap/base/util/LoaderExtensions.js +9 -12
- package/dist/sap/base/util/LoaderExtensions.js.map +1 -0
- package/dist/sap/ui/base/Metadata.js +20 -9
- package/dist/sap/ui/core/CalendarType.js +2 -8
- package/dist/sap/ui/core/Configuration.d.ts +17 -0
- package/dist/sap/ui/core/Configuration.js +21 -0
- package/dist/sap/ui/core/Configuration.js.map +1 -0
- package/dist/sap/ui/core/Core.d.ts +26 -0
- package/dist/sap/ui/core/Core.js +7 -32
- package/dist/sap/ui/core/Core.js.map +1 -0
- package/dist/sap/ui/core/FormatSettings.d.ts +10 -0
- package/dist/sap/ui/core/FormatSettings.js +14 -0
- package/dist/sap/ui/core/FormatSettings.js.map +1 -0
- package/dist/sap/ui/core/Locale.js +28 -112
- package/dist/sap/ui/core/LocaleData.js +213 -40
- package/dist/sap/ui/core/date/Buddhist.js +0 -6
- package/dist/sap/ui/core/date/CalendarUtils.js +25 -0
- package/dist/sap/ui/core/date/CalendarWeekNumbering.js +2 -0
- package/dist/sap/ui/core/date/Islamic.js +3 -3
- package/dist/sap/ui/core/date/Japanese.js +4 -4
- package/dist/sap/ui/core/date/UI5Date.js +305 -0
- package/dist/sap/ui/core/date/UniversalDate.js +73 -26
- package/dist/sap/ui/core/format/DateFormat.js +848 -497
- package/dist/sap/ui/core/format/TimezoneUtil.js +2 -0
- package/{package-scripts.js → package-scripts.cjs} +7 -10
- package/package.json +7 -5
- package/tsconfig.json +14 -0
- package/used-modules.txt +9 -1
- package/hash.txt +0 -1
- package/src/Assets.js +0 -2
- package/src/DateFormat.js +0 -3
- package/src/LocaleData.js +0 -3
- package/src/dates/CalendarDate.js +0 -223
- package/src/dates/ExtremeDates.js +0 -39
- package/src/dates/calculateWeekNumber.js +0 -51
- package/src/dates/getRoundedTimestamp.js +0 -14
- package/src/dates/getTodayUTCTimestamp.js +0 -9
- package/src/dates/modifyDateBy.js +0 -42
- package/src/getCachedLocaleDataInstance.js +0 -13
- package/src/locale/getLocaleData.js +0 -27
- package/src/sap/base/util/LoaderExtensions.js +0 -17
- package/src/sap/ui/core/Core.js +0 -38
- /package/{config/.eslintrc.js → .eslintrc.cjs} +0 -0
- /package/{src/features/calendar/Buddhist.js → dist/features/calendar/Buddhist.d.ts} +0 -0
- /package/{src/features/calendar/Gregorian.js → dist/features/calendar/Gregorian.d.ts} +0 -0
- /package/{src/features/calendar/Islamic.js → dist/features/calendar/Islamic.d.ts} +0 -0
- /package/{src/features/calendar/Japanese.js → dist/features/calendar/Japanese.d.ts} +0 -0
- /package/{src/features/calendar/Persian.js → dist/features/calendar/Persian.d.ts} +0 -0
@@ -64,6 +64,7 @@ import ru_UA from "../assets/cldr/ru_UA.json";
|
|
64
64
|
import sk from "../assets/cldr/sk.json";
|
65
65
|
import sl from "../assets/cldr/sl.json";
|
66
66
|
import sr from "../assets/cldr/sr.json";
|
67
|
+
import sr_Latn from "../assets/cldr/sr_Latn.json";
|
67
68
|
import sv from "../assets/cldr/sv.json";
|
68
69
|
import th from "../assets/cldr/th.json";
|
69
70
|
import tr from "../assets/cldr/tr.json";
|
@@ -75,7 +76,7 @@ import zh_SG from "../assets/cldr/zh_SG.json";
|
|
75
76
|
import zh_TW from "../assets/cldr/zh_TW.json";
|
76
77
|
|
77
78
|
const cldrData = {
|
78
|
-
ar,ar_EG,ar_SA,bg,ca,cs,da,de,de_AT,de_CH,el,el_CY,en,en_AU,en_GB,en_HK,en_IE,en_IN,en_NZ,en_PG,en_SG,en_ZA,es,es_AR,es_BO,es_CL,es_CO,es_MX,es_PE,es_UY,es_VE,et,fa,fi,fr,fr_BE,fr_CA,fr_CH,fr_LU,he,hi,hr,hu,id,it,it_CH,ja,kk,ko,lt,lv,ms,nb,nl,nl_BE,pl,pt,pt_PT,ro,ru,ru_UA,sk,sl,sr,sv,th,tr,uk,vi,zh_CN,zh_HK,zh_SG,zh_TW
|
79
|
+
ar,ar_EG,ar_SA,bg,ca,cs,da,de,de_AT,de_CH,el,el_CY,en,en_AU,en_GB,en_HK,en_IE,en_IN,en_NZ,en_PG,en_SG,en_ZA,es,es_AR,es_BO,es_CL,es_CO,es_MX,es_PE,es_UY,es_VE,et,fa,fi,fr,fr_BE,fr_CA,fr_CH,fr_LU,he,hi,hr,hu,id,it,it_CH,ja,kk,ko,lt,lv,ms,nb,nl,nl_BE,pl,pt,pt_PT,ro,ru,ru_UA,sk,sl,sr,sr_Latn,sv,th,tr,uk,vi,zh_CN,zh_HK,zh_SG,zh_TW
|
79
80
|
};
|
80
81
|
|
81
82
|
const fetchCldrJson = async (localeId) => {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { registerLocaleDataLoader } from "@ui5/webcomponents-base/dist/asset-registries/LocaleData.js";
|
2
2
|
|
3
|
-
const availableLocales = ["ar","ar_EG","ar_SA","bg","ca","cs","da","de","de_AT","de_CH","el","el_CY","en","en_AU","en_GB","en_HK","en_IE","en_IN","en_NZ","en_PG","en_SG","en_ZA","es","es_AR","es_BO","es_CL","es_CO","es_MX","es_PE","es_UY","es_VE","et","fa","fi","fr","fr_BE","fr_CA","fr_CH","fr_LU","he","hi","hr","hu","id","it","it_CH","ja","kk","ko","lt","lv","ms","nb","nl","nl_BE","pl","pt","pt_PT","ro","ru","ru_UA","sk","sl","sr","sv","th","tr","uk","vi","zh_CN","zh_HK","zh_SG","zh_TW"];
|
3
|
+
const availableLocales = ["ar","ar_EG","ar_SA","bg","ca","cs","da","de","de_AT","de_CH","el","el_CY","en","en_AU","en_GB","en_HK","en_IE","en_IN","en_NZ","en_PG","en_SG","en_ZA","es","es_AR","es_BO","es_CL","es_CO","es_MX","es_PE","es_UY","es_VE","et","fa","fi","fr","fr_BE","fr_CA","fr_CH","fr_LU","he","hi","hr","hu","id","it","it_CH","ja","kk","ko","lt","lv","ms","nb","nl","nl_BE","pl","pt","pt_PT","ro","ru","ru_UA","sk","sl","sr","sr_Latn","sv","th","tr","uk","vi","zh_CN","zh_HK","zh_SG","zh_TW"];
|
4
4
|
|
5
5
|
const importCldrJson = async (localeId) => {
|
6
6
|
switch (localeId) {
|
@@ -68,6 +68,7 @@ const importCldrJson = async (localeId) => {
|
|
68
68
|
case "sk": return (await import("../assets/cldr/sk.json")).default;
|
69
69
|
case "sl": return (await import("../assets/cldr/sl.json")).default;
|
70
70
|
case "sr": return (await import("../assets/cldr/sr.json")).default;
|
71
|
+
case "sr_Latn": return (await import("../assets/cldr/sr_Latn.json")).default;
|
71
72
|
case "sv": return (await import("../assets/cldr/sv.json")).default;
|
72
73
|
case "th": return (await import("../assets/cldr/th.json")).default;
|
73
74
|
case "tr": return (await import("../assets/cldr/tr.json")).default;
|
@@ -1,13 +1,10 @@
|
|
1
1
|
import LocaleData from "./LocaleData.js";
|
2
|
-
|
3
2
|
const cache = new Map();
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
return cache.get(locale);
|
3
|
+
const getCachedLocaleDataInstance = (locale) => {
|
4
|
+
if (!cache.has(locale)) {
|
5
|
+
cache.set(locale, new LocaleData(locale));
|
6
|
+
}
|
7
|
+
return cache.get(locale);
|
11
8
|
};
|
12
|
-
|
13
9
|
export default getCachedLocaleDataInstance;
|
10
|
+
//# sourceMappingURL=getCachedLocaleDataInstance.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getCachedLocaleDataInstance.js","sourceRoot":"","sources":["../src/getCachedLocaleDataInstance.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAsB,CAAC;AAE5C,MAAM,2BAA2B,GAAG,CAAC,MAAc,EAAE,EAAE;IACtD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;QACvB,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,UAAU,CAAC,MAA4B,CAAC,CAAC,CAAC;KAChE;IAED,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAE,CAAC;AAC3B,CAAC,CAAC;AAEF,eAAe,2BAA2B,CAAC","sourcesContent":["import type Locale from \"@ui5/webcomponents-base/dist/locale/Locale.js\";\nimport type LocaleT from \"sap/ui/core/Locale\";\nimport LocaleData from \"./LocaleData.js\";\n\nconst cache = new Map<Locale, LocaleData>();\n\nconst getCachedLocaleDataInstance = (locale: Locale) => {\n\tif (!cache.has(locale)) {\n\t\tcache.set(locale, new LocaleData(locale as unknown as LocaleT));\n\t}\n\n\treturn cache.get(locale)!;\n};\n\nexport default getCachedLocaleDataInstance;\n"]}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import LocaleData from "../LocaleData.js";
|
2
|
+
/**
|
3
|
+
* Fetches and returns а LocaleData object for the required locale
|
4
|
+
* For more information on this object's API, please see:
|
5
|
+
* https://sdk.openui5.org/api/sap.ui.core.LocaleData
|
6
|
+
*
|
7
|
+
* @param { string } lang - if left empty, will use the configured/current locale
|
8
|
+
* @returns { Promise<LocaleData> }
|
9
|
+
*/
|
10
|
+
declare const getLocaleData: (lang: string) => Promise<LocaleData>;
|
11
|
+
export default getLocaleData;
|
@@ -1,27 +1,23 @@
|
|
1
1
|
import { fetchCldr } from "@ui5/webcomponents-base/dist/asset-registries/LocaleData.js";
|
2
2
|
import getLocale from "@ui5/webcomponents-base/dist/locale/getLocale.js";
|
3
|
-
import LocaleData from "../
|
4
|
-
|
3
|
+
import LocaleData from "../LocaleData.js";
|
5
4
|
const instances = new Map();
|
6
|
-
|
7
5
|
/**
|
8
6
|
* Fetches and returns а LocaleData object for the required locale
|
9
7
|
* For more information on this object's API, please see:
|
10
|
-
* https://
|
8
|
+
* https://sdk.openui5.org/api/sap.ui.core.LocaleData
|
11
9
|
*
|
12
|
-
* @param lang - if left empty, will use the configured/current locale
|
13
|
-
* @returns {LocaleData}
|
10
|
+
* @param { string } lang - if left empty, will use the configured/current locale
|
11
|
+
* @returns { Promise<LocaleData> }
|
14
12
|
*/
|
15
|
-
const getLocaleData = async lang => {
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
return instances.get(localeLang);
|
13
|
+
const getLocaleData = async (lang) => {
|
14
|
+
const locale = getLocale(lang);
|
15
|
+
const localeLang = locale.getLanguage();
|
16
|
+
if (!instances.has(localeLang)) {
|
17
|
+
await fetchCldr(locale.getLanguage(), locale.getRegion(), locale.getScript());
|
18
|
+
instances.set(localeLang, new LocaleData(locale));
|
19
|
+
}
|
20
|
+
return instances.get(localeLang);
|
25
21
|
};
|
26
|
-
|
27
22
|
export default getLocaleData;
|
23
|
+
//# sourceMappingURL=getLocaleData.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getLocaleData.js","sourceRoot":"","sources":["../../src/locale/getLocaleData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,6DAA6D,CAAC;AACxF,OAAO,SAAS,MAAM,kDAAkD,CAAC;AAEzE,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAE1C,MAAM,SAAS,GAAG,IAAI,GAAG,EAAsB,CAAC;AAEhD;;;;;;;GAOG;AACH,MAAM,aAAa,GAAG,KAAK,EAAE,IAAY,EAAuB,EAAE;IACjE,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IAExC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;QAC/B,MAAM,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,MAAM,CAAC,SAAS,EAAE,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;QAC9E,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,UAAU,CAAC,MAA4B,CAAC,CAAC,CAAC;KACxE;IAED,OAAO,SAAS,CAAC,GAAG,CAAC,UAAU,CAAE,CAAC;AACnC,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { fetchCldr } from \"@ui5/webcomponents-base/dist/asset-registries/LocaleData.js\";\nimport getLocale from \"@ui5/webcomponents-base/dist/locale/getLocale.js\";\nimport type LocaleT from \"sap/ui/core/Locale\";\nimport LocaleData from \"../LocaleData.js\";\n\nconst instances = new Map<string, LocaleData>();\n\n/**\n * Fetches and returns а LocaleData object for the required locale\n * For more information on this object's API, please see:\n * https://sdk.openui5.org/api/sap.ui.core.LocaleData\n *\n * @param { string } lang - if left empty, will use the configured/current locale\n * @returns { Promise<LocaleData> }\n */\nconst getLocaleData = async (lang: string): Promise<LocaleData> => {\n\tconst locale = getLocale(lang);\n\tconst localeLang = locale.getLanguage();\n\n\tif (!instances.has(localeLang)) {\n\t\tawait fetchCldr(locale.getLanguage(), locale.getRegion(), locale.getScript());\n\t\tinstances.set(localeLang, new LocaleData(locale as unknown as LocaleT));\n\t}\n\n\treturn instances.get(localeLang)!;\n};\n\nexport default getLocaleData;\n"]}
|
package/dist/sap/base/Log.js
CHANGED
@@ -10,7 +10,7 @@ Log.Level = {
|
|
10
10
|
TRACE: 5,
|
11
11
|
ALL: 5 + 1
|
12
12
|
};
|
13
|
-
var
|
13
|
+
var aLog = [], mMaxLevel = { '': Log.Level.ERROR }, iLogEntriesLimit = 3000, oListener = null, bLogSupportInfo = false;
|
14
14
|
function pad0(i, w) {
|
15
15
|
return ('000' + String(i)).slice(-w);
|
16
16
|
}
|
@@ -72,26 +72,26 @@ function getLogEntryListenerInstance() {
|
|
72
72
|
}
|
73
73
|
return oListener;
|
74
74
|
}
|
75
|
-
Log.fatal = function (sMessage,
|
76
|
-
log(Log.Level.FATAL, sMessage,
|
75
|
+
Log.fatal = function (sMessage, vDetails, sComponent, fnSupportInfo) {
|
76
|
+
log(Log.Level.FATAL, sMessage, vDetails, sComponent, fnSupportInfo);
|
77
77
|
};
|
78
|
-
Log.error = function (sMessage,
|
79
|
-
log(Log.Level.ERROR, sMessage,
|
78
|
+
Log.error = function (sMessage, vDetails, sComponent, fnSupportInfo) {
|
79
|
+
log(Log.Level.ERROR, sMessage, vDetails, sComponent, fnSupportInfo);
|
80
80
|
};
|
81
|
-
Log.warning = function (sMessage,
|
82
|
-
log(Log.Level.WARNING, sMessage,
|
81
|
+
Log.warning = function (sMessage, vDetails, sComponent, fnSupportInfo) {
|
82
|
+
log(Log.Level.WARNING, sMessage, vDetails, sComponent, fnSupportInfo);
|
83
83
|
};
|
84
|
-
Log.info = function (sMessage,
|
85
|
-
log(Log.Level.INFO, sMessage,
|
84
|
+
Log.info = function (sMessage, vDetails, sComponent, fnSupportInfo) {
|
85
|
+
log(Log.Level.INFO, sMessage, vDetails, sComponent, fnSupportInfo);
|
86
86
|
};
|
87
|
-
Log.debug = function (sMessage,
|
88
|
-
log(Log.Level.DEBUG, sMessage,
|
87
|
+
Log.debug = function (sMessage, vDetails, sComponent, fnSupportInfo) {
|
88
|
+
log(Log.Level.DEBUG, sMessage, vDetails, sComponent, fnSupportInfo);
|
89
89
|
};
|
90
|
-
Log.trace = function (sMessage,
|
91
|
-
log(Log.Level.TRACE, sMessage,
|
90
|
+
Log.trace = function (sMessage, vDetails, sComponent, fnSupportInfo) {
|
91
|
+
log(Log.Level.TRACE, sMessage, vDetails, sComponent, fnSupportInfo);
|
92
92
|
};
|
93
93
|
Log.setLevel = function (iLogLevel, sComponent, _bDefault) {
|
94
|
-
sComponent = sComponent ||
|
94
|
+
sComponent = sComponent || '';
|
95
95
|
if (!_bDefault || mMaxLevel[sComponent] == null) {
|
96
96
|
mMaxLevel[sComponent] = iLogLevel;
|
97
97
|
var sLogLevel;
|
@@ -104,24 +104,23 @@ Log.setLevel = function (iLogLevel, sComponent, _bDefault) {
|
|
104
104
|
}
|
105
105
|
};
|
106
106
|
Log.getLevel = function (sComponent) {
|
107
|
-
return level(sComponent
|
107
|
+
return level(sComponent);
|
108
108
|
};
|
109
109
|
Log.isLoggable = function (iLevel, sComponent) {
|
110
|
-
return (iLevel == null ? Log.Level.DEBUG : iLevel) <= level(sComponent
|
110
|
+
return (iLevel == null ? Log.Level.DEBUG : iLevel) <= level(sComponent);
|
111
111
|
};
|
112
112
|
Log.logSupportInfo = function (bEnabled) {
|
113
113
|
bLogSupportInfo = bEnabled;
|
114
114
|
};
|
115
|
-
function log(iLevel, sMessage,
|
116
|
-
if (!fnSupportInfo && !sComponent && typeof
|
117
|
-
fnSupportInfo =
|
118
|
-
|
115
|
+
function log(iLevel, sMessage, vDetails, sComponent, fnSupportInfo) {
|
116
|
+
if (!fnSupportInfo && !sComponent && typeof vDetails === 'function') {
|
117
|
+
fnSupportInfo = vDetails;
|
118
|
+
vDetails = '';
|
119
119
|
}
|
120
120
|
if (!fnSupportInfo && typeof sComponent === 'function') {
|
121
121
|
fnSupportInfo = sComponent;
|
122
122
|
sComponent = '';
|
123
123
|
}
|
124
|
-
sComponent = sComponent || sDefaultComponent;
|
125
124
|
if (iLevel <= level(sComponent)) {
|
126
125
|
var fNow = now(), oNow = new Date(fNow), iMicroSeconds = Math.floor((fNow - Math.floor(fNow)) * 1000), oLogEntry = {
|
127
126
|
time: pad0(oNow.getHours(), 2) + ':' + pad0(oNow.getMinutes(), 2) + ':' + pad0(oNow.getSeconds(), 2) + '.' + pad0(oNow.getMilliseconds(), 3) + pad0(iMicroSeconds, 3),
|
@@ -129,7 +128,7 @@ function log(iLevel, sMessage, sDetails, sComponent, fnSupportInfo) {
|
|
129
128
|
timestamp: fNow,
|
130
129
|
level: iLevel,
|
131
130
|
message: String(sMessage || ''),
|
132
|
-
details: String(
|
131
|
+
details: String(vDetails || ''),
|
133
132
|
component: String(sComponent || '')
|
134
133
|
};
|
135
134
|
if (bLogSupportInfo && typeof fnSupportInfo === 'function') {
|
@@ -145,27 +144,27 @@ function log(iLevel, sMessage, sDetails, sComponent, fnSupportInfo) {
|
|
145
144
|
oListener.onLogEntry(oLogEntry);
|
146
145
|
}
|
147
146
|
if (console) {
|
148
|
-
var isDetailsError =
|
147
|
+
var isDetailsError = vDetails instanceof Error, logText = oLogEntry.date + ' ' + oLogEntry.time + ' ' + oLogEntry.message + ' - ' + oLogEntry.details + ' ' + oLogEntry.component;
|
149
148
|
switch (iLevel) {
|
150
149
|
case Log.Level.FATAL:
|
151
150
|
case Log.Level.ERROR:
|
152
|
-
isDetailsError ? console.error(logText, '\n',
|
151
|
+
isDetailsError ? console.error(logText, '\n', vDetails) : console.error(logText);
|
153
152
|
break;
|
154
153
|
case Log.Level.WARNING:
|
155
|
-
isDetailsError ? console.warn(logText, '\n',
|
154
|
+
isDetailsError ? console.warn(logText, '\n', vDetails) : console.warn(logText);
|
156
155
|
break;
|
157
156
|
case Log.Level.INFO:
|
158
157
|
if (console.info) {
|
159
|
-
isDetailsError ? console.info(logText, '\n',
|
158
|
+
isDetailsError ? console.info(logText, '\n', vDetails) : console.info(logText);
|
160
159
|
} else {
|
161
|
-
isDetailsError ? console.log(logText, '\n',
|
160
|
+
isDetailsError ? console.log(logText, '\n', vDetails) : console.log(logText);
|
162
161
|
}
|
163
162
|
break;
|
164
163
|
case Log.Level.DEBUG:
|
165
|
-
isDetailsError ? console.debug(logText, '\n',
|
164
|
+
isDetailsError ? console.debug(logText, '\n', vDetails) : console.debug(logText);
|
166
165
|
break;
|
167
166
|
case Log.Level.TRACE:
|
168
|
-
isDetailsError ? console.trace(logText, '\n',
|
167
|
+
isDetailsError ? console.trace(logText, '\n', vDetails) : console.trace(logText);
|
169
168
|
break;
|
170
169
|
}
|
171
170
|
if (console.info && oLogEntry.supportInfo) {
|
package/dist/sap/base/assert.js
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
import Log from './Log.js';
|
2
1
|
var fnAssert = function (bResult, vMessage) {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
if (!bResult) {
|
3
|
+
var sMessage = typeof vMessage === "function" ? vMessage() : vMessage;
|
4
|
+
console.assert(bResult, sMessage);
|
5
|
+
}
|
7
6
|
};
|
8
|
-
export default fnAssert;
|
7
|
+
export default fnAssert;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
var rLanguageTag = /^((?:[A-Z]{2,3}(?:-[A-Z]{3}){0,3})|[A-Z]{4}|[A-Z]{5,8})(?:-([A-Z]{4}))?(?:-([A-Z]{2}|[0-9]{3}))?((?:-[0-9A-Z]{5,8}|-[0-9][0-9A-Z]{3})*)((?:-[0-9A-WYZ](?:-[0-9A-Z]{2,8})+)*)(?:-(X(?:-[0-9A-Z]{1,8})+))?$/i;
|
2
|
+
var LanguageTag = function (sLanguageTag) {
|
3
|
+
var aResult = rLanguageTag.exec(sLanguageTag.replace(/_/g, "-"));
|
4
|
+
if (aResult === null) {
|
5
|
+
throw new TypeError("The given language tag'" + sLanguageTag + "' does not adhere to BCP-47.");
|
6
|
+
}
|
7
|
+
this.language = aResult[1] || null;
|
8
|
+
this.script = aResult[2] || null;
|
9
|
+
this.region = aResult[3] || null;
|
10
|
+
this.variant = aResult[4] && aResult[4].slice(1) || null;
|
11
|
+
this.variantSubtags = this.variant ? this.variant.split("-") : [];
|
12
|
+
this.extension = aResult[5] && aResult[5].slice(1) || null;
|
13
|
+
this.extensionSubtags = this.variant ? this.variant.split("-") : [];
|
14
|
+
this.privateUse = aResult[6] || null;
|
15
|
+
this.privateUseSubtags = this.privateUse ? this.privateUse.slice(2).split("-") : [];
|
16
|
+
if (this.language) {
|
17
|
+
this.language = this.language.toLowerCase();
|
18
|
+
}
|
19
|
+
if (this.script) {
|
20
|
+
this.script = this.script.toLowerCase().replace(/^[a-z]/, function ($) {
|
21
|
+
return $.toUpperCase();
|
22
|
+
});
|
23
|
+
}
|
24
|
+
if (this.region) {
|
25
|
+
this.region = this.region.toUpperCase();
|
26
|
+
}
|
27
|
+
Object.freeze(this);
|
28
|
+
};
|
29
|
+
LanguageTag.prototype.toString = function () {
|
30
|
+
return join(this.language, this.script, this.region, this.variant, this.extension, this.privateUse);
|
31
|
+
};
|
32
|
+
function join() {
|
33
|
+
return Array.prototype.filter.call(arguments, Boolean).join("-");
|
34
|
+
}
|
35
|
+
export default LanguageTag;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
const M_ISO639_OLD_TO_NEW = {
|
2
|
+
"iw": "he",
|
3
|
+
"ji": "yi",
|
4
|
+
};
|
5
|
+
const getModernLanguage = (sLanguage) => {
|
6
|
+
return M_ISO639_OLD_TO_NEW[sLanguage] || sLanguage;
|
7
|
+
};
|
8
|
+
const Localization = {
|
9
|
+
getModernLanguage,
|
10
|
+
};
|
11
|
+
export default Localization;
|
12
|
+
//# sourceMappingURL=Localization.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Localization.js","sourceRoot":"","sources":["../../../../src/sap/base/i18n/Localization.ts"],"names":[],"mappings":"AAAA,MAAM,mBAAmB,GAAG;IAC3B,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;CACV,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,SAAiB,EAAE,EAAE;IAC/C,OAAO,mBAAmB,CAAC,SAA6C,CAAC,IAAI,SAAS,CAAC;AACxF,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG;IACpB,iBAAiB;CACjB,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["const M_ISO639_OLD_TO_NEW = {\n\t\"iw\": \"he\",\n\t\"ji\": \"yi\",\n};\n\nconst getModernLanguage = (sLanguage: string) => {\n\treturn M_ISO639_OLD_TO_NEW[sLanguage as keyof typeof M_ISO639_OLD_TO_NEW] || sLanguage;\n};\n\nconst Localization = {\n\tgetModernLanguage,\n};\n\nexport default Localization;\n"]}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
var CalendarWeekNumbering = {
|
2
|
+
Default: "Default",
|
3
|
+
ISO_8601: "ISO_8601",
|
4
|
+
MiddleEastern: "MiddleEastern",
|
5
|
+
WesternTraditional: "WesternTraditional"
|
6
|
+
};
|
7
|
+
Object.defineProperty(CalendarWeekNumbering, "getWeekConfigurationValues", {
|
8
|
+
value: function (sCalendarWeekNumbering) {
|
9
|
+
switch (sCalendarWeekNumbering) {
|
10
|
+
case CalendarWeekNumbering.ISO_8601:
|
11
|
+
return {
|
12
|
+
firstDayOfWeek: 1,
|
13
|
+
minimalDaysInFirstWeek: 4
|
14
|
+
};
|
15
|
+
case CalendarWeekNumbering.MiddleEastern:
|
16
|
+
return {
|
17
|
+
firstDayOfWeek: 6,
|
18
|
+
minimalDaysInFirstWeek: 1
|
19
|
+
};
|
20
|
+
case CalendarWeekNumbering.WesternTraditional:
|
21
|
+
return {
|
22
|
+
firstDayOfWeek: 0,
|
23
|
+
minimalDaysInFirstWeek: 1
|
24
|
+
};
|
25
|
+
default:
|
26
|
+
return undefined;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
});
|
30
|
+
export default CalendarWeekNumbering;
|
@@ -0,0 +1,89 @@
|
|
1
|
+
var TimezoneUtils = {};
|
2
|
+
var sLocalTimezone = "";
|
3
|
+
var aSupportedTimezoneIDs;
|
4
|
+
var oIntlDateTimeFormatCache = {
|
5
|
+
_oCache: new Map(),
|
6
|
+
_iCacheLimit: 10,
|
7
|
+
get: function (sTimezone) {
|
8
|
+
var cacheEntry = this._oCache.get(sTimezone);
|
9
|
+
if (cacheEntry) {
|
10
|
+
return cacheEntry;
|
11
|
+
}
|
12
|
+
var oOptions = {
|
13
|
+
hourCycle: "h23",
|
14
|
+
hour: "2-digit",
|
15
|
+
minute: "2-digit",
|
16
|
+
second: "2-digit",
|
17
|
+
fractionalSecondDigits: 3,
|
18
|
+
day: "2-digit",
|
19
|
+
month: "2-digit",
|
20
|
+
year: "numeric",
|
21
|
+
timeZone: sTimezone,
|
22
|
+
timeZoneName: "short",
|
23
|
+
era: "narrow",
|
24
|
+
weekday: "short"
|
25
|
+
};
|
26
|
+
var oInstance = new Intl.DateTimeFormat("en-US", oOptions);
|
27
|
+
if (this._oCache.size === this._iCacheLimit) {
|
28
|
+
this._oCache = new Map();
|
29
|
+
}
|
30
|
+
this._oCache.set(sTimezone, oInstance);
|
31
|
+
return oInstance;
|
32
|
+
}
|
33
|
+
};
|
34
|
+
TimezoneUtils.isValidTimezone = function (sTimezone) {
|
35
|
+
if (!sTimezone) {
|
36
|
+
return false;
|
37
|
+
}
|
38
|
+
if (Intl.supportedValuesOf) {
|
39
|
+
try {
|
40
|
+
aSupportedTimezoneIDs = aSupportedTimezoneIDs || Intl.supportedValuesOf("timeZone");
|
41
|
+
if (aSupportedTimezoneIDs.includes(sTimezone)) {
|
42
|
+
return true;
|
43
|
+
}
|
44
|
+
} catch (oError) {
|
45
|
+
aSupportedTimezoneIDs = [];
|
46
|
+
}
|
47
|
+
}
|
48
|
+
try {
|
49
|
+
oIntlDateTimeFormatCache.get(sTimezone);
|
50
|
+
return true;
|
51
|
+
} catch (oError) {
|
52
|
+
return false;
|
53
|
+
}
|
54
|
+
};
|
55
|
+
TimezoneUtils.convertToTimezone = function (oDate, sTargetTimezone) {
|
56
|
+
var oFormatParts = this._getParts(oDate, sTargetTimezone);
|
57
|
+
return TimezoneUtils._getDateFromParts(oFormatParts);
|
58
|
+
};
|
59
|
+
TimezoneUtils._getParts = function (oDate, sTargetTimezone) {
|
60
|
+
var sKey, oPart, oDateParts = Object.create(null), oIntlDate = oIntlDateTimeFormatCache.get(sTargetTimezone), oParts = oIntlDate.formatToParts(new Date(oDate.getTime()));
|
61
|
+
for (sKey in oParts) {
|
62
|
+
oPart = oParts[sKey];
|
63
|
+
if (oPart.type !== "literal") {
|
64
|
+
oDateParts[oPart.type] = oPart.value;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
return oDateParts;
|
68
|
+
};
|
69
|
+
TimezoneUtils._getDateFromParts = function (oParts) {
|
70
|
+
var oDate = new Date(0), iUTCYear = parseInt(oParts.year);
|
71
|
+
if (oParts.era === "B") {
|
72
|
+
iUTCYear = iUTCYear * -1 + 1;
|
73
|
+
}
|
74
|
+
oDate.setUTCFullYear(iUTCYear, parseInt(oParts.month) - 1, parseInt(oParts.day));
|
75
|
+
oDate.setUTCHours(parseInt(oParts.hour), parseInt(oParts.minute), parseInt(oParts.second), parseInt(oParts.fractionalSecond || 0));
|
76
|
+
return oDate;
|
77
|
+
};
|
78
|
+
TimezoneUtils.calculateOffset = function (oDate, sTimezoneSource) {
|
79
|
+
var oFirstGuess = this.convertToTimezone(oDate, sTimezoneSource), iInitialOffset = oDate.getTime() - oFirstGuess.getTime(), oDateSource = new Date(oDate.getTime() + iInitialOffset), oDateTarget = this.convertToTimezone(oDateSource, sTimezoneSource);
|
80
|
+
return (oDateSource.getTime() - oDateTarget.getTime()) / 1000;
|
81
|
+
};
|
82
|
+
TimezoneUtils.getLocalTimezone = function () {
|
83
|
+
if (sLocalTimezone) {
|
84
|
+
return sLocalTimezone;
|
85
|
+
}
|
86
|
+
sLocalTimezone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
|
87
|
+
return sLocalTimezone;
|
88
|
+
};
|
89
|
+
export default TimezoneUtils;
|
@@ -1,17 +1,14 @@
|
|
1
1
|
import { getLocaleData } from "@ui5/webcomponents-base/dist/asset-registries/LocaleData.js";
|
2
|
-
|
3
|
-
const
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
const localeId = moduleFormat[1];
|
10
|
-
return getLocaleData(localeId);
|
2
|
+
const loadResource = (moduleName) => {
|
3
|
+
const moduleFormat = moduleName.match(/sap\/ui\/core\/cldr\/(\w+)\.json/);
|
4
|
+
if (!moduleFormat) {
|
5
|
+
throw new Error(`Unknown module "${moduleName}"`);
|
6
|
+
}
|
7
|
+
const localeId = moduleFormat[1];
|
8
|
+
return getLocaleData(localeId);
|
11
9
|
};
|
12
|
-
|
13
10
|
const LoaderExtensions = {
|
14
|
-
|
11
|
+
loadResource,
|
15
12
|
};
|
16
|
-
|
17
13
|
export default LoaderExtensions;
|
14
|
+
//# sourceMappingURL=LoaderExtensions.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"LoaderExtensions.js","sourceRoot":"","sources":["../../../../src/sap/base/util/LoaderExtensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6DAA6D,CAAC;AAE5F,MAAM,YAAY,GAAG,CAAC,UAAkB,EAAE,EAAE;IAC3C,MAAM,YAAY,GAAG,UAAU,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAC1E,IAAI,CAAC,YAAY,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,mBAAmB,UAAU,GAAG,CAAC,CAAC;KAClD;IAED,MAAM,QAAQ,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;IACjC,OAAO,aAAa,CAAC,QAAQ,CAAC,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG;IACxB,YAAY;CACZ,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import { getLocaleData } from \"@ui5/webcomponents-base/dist/asset-registries/LocaleData.js\";\n\nconst loadResource = (moduleName: string) => {\n\tconst moduleFormat = moduleName.match(/sap\\/ui\\/core\\/cldr\\/(\\w+)\\.json/);\n\tif (!moduleFormat) {\n\t\tthrow new Error(`Unknown module \"${moduleName}\"`);\n\t}\n\n\tconst localeId = moduleFormat[1];\n\treturn getLocaleData(localeId);\n};\n\nconst LoaderExtensions = {\n\tloadResource,\n};\n\nexport default LoaderExtensions;\n"]}
|
@@ -2,6 +2,9 @@ import ObjectPath from '../../base/util/ObjectPath.js';
|
|
2
2
|
import assert from '../../base/assert.js';
|
3
3
|
import Log from '../../base/Log.js';
|
4
4
|
import uniqueSort from '../../base/util/array/uniqueSort.js';
|
5
|
+
function isFunction(obj) {
|
6
|
+
return typeof obj === 'function';
|
7
|
+
}
|
5
8
|
var Metadata = function (sClassName, oClassInfo) {
|
6
9
|
assert(typeof sClassName === 'string' && sClassName, 'Metadata: sClassName must be a non-empty string');
|
7
10
|
assert(typeof oClassInfo === 'object', 'Metadata: oClassInfo must be empty or an object');
|
@@ -13,7 +16,7 @@ var Metadata = function (sClassName, oClassInfo) {
|
|
13
16
|
oClassInfo.metadata.__version = 1;
|
14
17
|
}
|
15
18
|
oClassInfo.metadata.__version = oClassInfo.metadata.__version || 2;
|
16
|
-
if (
|
19
|
+
if (!isFunction(oClassInfo.constructor)) {
|
17
20
|
throw Error('constructor for class ' + sClassName + ' must have been declared before creating metadata for it');
|
18
21
|
}
|
19
22
|
this._sClassName = sClassName;
|
@@ -27,9 +30,17 @@ Metadata.prototype.extend = function (oClassInfo) {
|
|
27
30
|
Metadata.prototype.applySettings = function (oClassInfo) {
|
28
31
|
var that = this, oStaticInfo = oClassInfo.metadata, oPrototype;
|
29
32
|
if (oStaticInfo.baseType) {
|
30
|
-
var oParentClass
|
31
|
-
if (
|
32
|
-
|
33
|
+
var oParentClass;
|
34
|
+
if (isFunction(oStaticInfo.baseType)) {
|
35
|
+
oParentClass = oStaticInfo.baseType;
|
36
|
+
if (!isFunction(oParentClass.getMetadata)) {
|
37
|
+
throw new TypeError('baseType must be a UI5 class with a static getMetadata function');
|
38
|
+
}
|
39
|
+
} else {
|
40
|
+
oParentClass = ObjectPath.get(oStaticInfo.baseType);
|
41
|
+
if (!isFunction(oParentClass)) {
|
42
|
+
Log.fatal('base class \'' + oStaticInfo.baseType + '\' does not exist');
|
43
|
+
}
|
33
44
|
}
|
34
45
|
if (oParentClass.getMetadata) {
|
35
46
|
this._oParent = oParentClass.getMetadata();
|
@@ -167,12 +178,12 @@ Metadata.createClass = function (fnBaseClass, sClassName, oClassInfo, FNMetaImpl
|
|
167
178
|
sClassName = fnBaseClass;
|
168
179
|
fnBaseClass = null;
|
169
180
|
}
|
170
|
-
assert(!fnBaseClass ||
|
181
|
+
assert(!fnBaseClass || isFunction(fnBaseClass));
|
171
182
|
assert(typeof sClassName === 'string' && !!sClassName);
|
172
183
|
assert(!oClassInfo || typeof oClassInfo === 'object');
|
173
|
-
assert(!FNMetaImpl ||
|
184
|
+
assert(!FNMetaImpl || isFunction(FNMetaImpl));
|
174
185
|
FNMetaImpl = FNMetaImpl || Metadata;
|
175
|
-
if (
|
186
|
+
if (isFunction(FNMetaImpl.preprocessClassInfo)) {
|
176
187
|
oClassInfo = FNMetaImpl.preprocessClassInfo(oClassInfo);
|
177
188
|
}
|
178
189
|
oClassInfo = oClassInfo || {};
|
@@ -181,7 +192,7 @@ Metadata.createClass = function (fnBaseClass, sClassName, oClassInfo, FNMetaImpl
|
|
181
192
|
oClassInfo.constructor = undefined;
|
182
193
|
}
|
183
194
|
var fnClass = oClassInfo.constructor;
|
184
|
-
assert(!fnClass ||
|
195
|
+
assert(!fnClass || isFunction(fnClass));
|
185
196
|
if (fnBaseClass) {
|
186
197
|
if (!fnClass) {
|
187
198
|
if (oClassInfo.metadata.deprecated) {
|
@@ -197,7 +208,7 @@ Metadata.createClass = function (fnBaseClass, sClassName, oClassInfo, FNMetaImpl
|
|
197
208
|
}
|
198
209
|
fnClass.prototype = Object.create(fnBaseClass.prototype);
|
199
210
|
fnClass.prototype.constructor = fnClass;
|
200
|
-
oClassInfo.metadata.baseType = fnBaseClass
|
211
|
+
oClassInfo.metadata.baseType = fnBaseClass;
|
201
212
|
} else {
|
202
213
|
fnClass = fnClass || function () {
|
203
214
|
};
|
@@ -1,8 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Islamic: "Islamic",
|
4
|
-
Japanese: "Japanese",
|
5
|
-
Persian: "Persian",
|
6
|
-
Buddhist: "Buddhist"
|
7
|
-
};
|
8
|
-
export default CalendarType;
|
1
|
+
import CalendarType from '../../base/i18n/date/CalendarType.js';
|
2
|
+
export default CalendarType;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
/**
|
2
|
+
* OpenUI5 Configuration Shim
|
3
|
+
*/
|
4
|
+
declare const Configuration: {
|
5
|
+
getLanguage: () => string | undefined;
|
6
|
+
getCalendarType: () => import("@ui5/webcomponents-base/dist/types/CalendarType.js").default;
|
7
|
+
getSupportedLanguages: () => string[] | null;
|
8
|
+
getOriginInfo: () => void;
|
9
|
+
getFormatSettings: () => {
|
10
|
+
getFormatLocale: (lang?: string | undefined) => import("@ui5/webcomponents-base/dist/locale/Locale.js").default;
|
11
|
+
getLegacyDateFormat: () => void;
|
12
|
+
getCustomLocaleData: () => void;
|
13
|
+
getLegacyDateCalendarCustomizing: typeof import("@ui5/webcomponents-base/dist/features/LegacyDateFormats.js").default.getLegacyDateCalendarCustomizing;
|
14
|
+
};
|
15
|
+
getTimezone: () => string;
|
16
|
+
};
|
17
|
+
export default Configuration;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { getLanguage } from "@ui5/webcomponents-base/dist/config/Language.js";
|
2
|
+
import { getCalendarType } from "@ui5/webcomponents-base/dist/config/CalendarType.js";
|
3
|
+
import { getTimezone as getConfigTimezone } from "@ui5/webcomponents-base/dist/config/Timezone.js";
|
4
|
+
import getDesigntimePropertyAsArray from "@ui5/webcomponents-base/dist/util/getDesigntimePropertyAsArray.js";
|
5
|
+
// @ts-ignore
|
6
|
+
import TimezoneUtil from "./format/TimezoneUtil.js";
|
7
|
+
import FormatSettings from "./FormatSettings.js";
|
8
|
+
const emptyFn = () => { };
|
9
|
+
/**
|
10
|
+
* OpenUI5 Configuration Shim
|
11
|
+
*/
|
12
|
+
const Configuration = {
|
13
|
+
getLanguage,
|
14
|
+
getCalendarType,
|
15
|
+
getSupportedLanguages: () => getDesigntimePropertyAsArray("$core-i18n-locales:,ar,bg,ca,cs,da,de,el,en,es,et,fi,fr,hi,hr,hu,it,iw,ja,ko,lt,lv,nl,no,pl,pt,ro,ru,sh,sk,sl,sv,th,tr,uk,vi,zh_CN,zh_TW$"),
|
16
|
+
getOriginInfo: emptyFn,
|
17
|
+
getFormatSettings: () => FormatSettings,
|
18
|
+
getTimezone: () => getConfigTimezone() || TimezoneUtil.getLocalTimezone(),
|
19
|
+
};
|
20
|
+
export default Configuration;
|
21
|
+
//# sourceMappingURL=Configuration.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Configuration.js","sourceRoot":"","sources":["../../../../src/sap/ui/core/Configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AACtF,OAAO,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AACnG,OAAO,4BAA4B,MAAM,mEAAmE,CAAC;AAC7G,aAAa;AACb,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,cAAc,MAAM,qBAAqB,CAAC;AAEjD,MAAM,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEzB;;GAEG;AACH,MAAM,aAAa,GAAG;IACrB,WAAW;IACX,eAAe;IACf,qBAAqB,EAAE,GAAG,EAAE,CAAC,4BAA4B,CAAC,2IAA2I,CAAC;IACtM,aAAa,EAAE,OAAO;IACtB,iBAAiB,EAAE,GAAG,EAAE,CAAC,cAAc;IACvC,WAAW,EAAE,GAAG,EAAE,CAAC,iBAAiB,EAAE,IAAI,YAAY,CAAC,gBAAgB,EAAY;CACnF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { getLanguage } from \"@ui5/webcomponents-base/dist/config/Language.js\";\nimport { getCalendarType } from \"@ui5/webcomponents-base/dist/config/CalendarType.js\";\nimport { getTimezone as getConfigTimezone } from \"@ui5/webcomponents-base/dist/config/Timezone.js\";\nimport getDesigntimePropertyAsArray from \"@ui5/webcomponents-base/dist/util/getDesigntimePropertyAsArray.js\";\n// @ts-ignore\nimport TimezoneUtil from \"./format/TimezoneUtil.js\";\nimport FormatSettings from \"./FormatSettings.js\";\n\nconst emptyFn = () => {};\n\n/**\n * OpenUI5 Configuration Shim\n */\nconst Configuration = {\n\tgetLanguage,\n\tgetCalendarType,\n\tgetSupportedLanguages: () => getDesigntimePropertyAsArray(\"$core-i18n-locales:,ar,bg,ca,cs,da,de,el,en,es,et,fi,fr,hi,hr,hu,it,iw,ja,ko,lt,lv,nl,no,pl,pt,ro,ru,sh,sk,sl,sv,th,tr,uk,vi,zh_CN,zh_TW$\"),\n\tgetOriginInfo: emptyFn,\n\tgetFormatSettings: () => FormatSettings,\n\tgetTimezone: () => getConfigTimezone() || TimezoneUtil.getLocalTimezone() as string,\n};\n\nexport default Configuration;\n"]}
|