@ui5/webcomponents-localization 0.0.0-037d08c67
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 +6 -0
- package/.eslintrc.cjs +3 -0
- package/.npsrc.json +3 -0
- package/CHANGELOG.md +2261 -0
- package/LICENSE.txt +201 -0
- package/README.md +51 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/Assets-fetch.d.ts +1 -0
- package/dist/Assets-fetch.js +3 -0
- package/dist/Assets-fetch.js.map +1 -0
- package/dist/Assets-node.d.ts +11 -0
- package/dist/Assets-node.js +12 -0
- package/dist/Assets-node.js.map +1 -0
- package/dist/Assets.d.ts +1 -0
- package/dist/Assets.js +3 -0
- package/dist/Assets.js.map +1 -0
- package/dist/CalendarUtils.d.ts +3 -0
- package/dist/CalendarUtils.js +6 -0
- package/dist/CalendarUtils.js.map +1 -0
- package/dist/DateFormat.d.ts +5 -0
- package/dist/DateFormat.js +7 -0
- package/dist/DateFormat.js.map +1 -0
- package/dist/LocaleData.d.ts +5 -0
- package/dist/LocaleData.js +7 -0
- package/dist/LocaleData.js.map +1 -0
- package/dist/NumberFormat.d.ts +5 -0
- package/dist/NumberFormat.js +7 -0
- package/dist/NumberFormat.js.map +1 -0
- package/dist/dates/CalendarDate.d.ts +42 -0
- package/dist/dates/CalendarDate.js +193 -0
- package/dist/dates/CalendarDate.js.map +1 -0
- package/dist/dates/ExtremeDates.d.ts +5 -0
- package/dist/dates/ExtremeDates.js +29 -0
- package/dist/dates/ExtremeDates.js.map +1 -0
- package/dist/dates/UI5Date.d.ts +5 -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/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 +15 -0
- package/dist/dates/getRoundedTimestamp.js.map +1 -0
- package/dist/dates/getTodayUTCTimestamp.d.ts +7 -0
- package/dist/dates/getTodayUTCTimestamp.js +9 -0
- package/dist/dates/getTodayUTCTimestamp.js.map +1 -0
- package/dist/dates/modifyDateBy.d.ts +14 -0
- package/dist/dates/modifyDateBy.js +55 -0
- 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.d.ts +1 -0
- package/dist/features/calendar/Buddhist.js +2 -0
- package/dist/features/calendar/Buddhist.js.map +1 -0
- package/dist/features/calendar/Gregorian.d.ts +1 -0
- package/dist/features/calendar/Gregorian.js +2 -0
- package/dist/features/calendar/Gregorian.js.map +1 -0
- package/dist/features/calendar/Islamic.d.ts +1 -0
- package/dist/features/calendar/Islamic.js +2 -0
- package/dist/features/calendar/Islamic.js.map +1 -0
- package/dist/features/calendar/Japanese.d.ts +1 -0
- package/dist/features/calendar/Japanese.js +2 -0
- package/dist/features/calendar/Japanese.js.map +1 -0
- package/dist/features/calendar/Persian.d.ts +1 -0
- package/dist/features/calendar/Persian.js +2 -0
- package/dist/features/calendar/Persian.js.map +1 -0
- package/dist/generated/assets/cldr/Unicode-Data-Files-LICENSE.txt +27 -0
- package/dist/generated/assets/cldr/ar.json +7087 -0
- package/dist/generated/assets/cldr/ar_EG.json +7087 -0
- package/dist/generated/assets/cldr/ar_SA.json +7086 -0
- package/dist/generated/assets/cldr/bg.json +5981 -0
- package/dist/generated/assets/cldr/ca.json +6083 -0
- package/dist/generated/assets/cldr/cnr.json +6169 -0
- package/dist/generated/assets/cldr/cs.json +6709 -0
- package/dist/generated/assets/cldr/cy.json +6932 -0
- package/dist/generated/assets/cldr/da.json +5927 -0
- package/dist/generated/assets/cldr/de.json +6048 -0
- package/dist/generated/assets/cldr/de_AT.json +6049 -0
- package/dist/generated/assets/cldr/de_CH.json +6047 -0
- package/dist/generated/assets/cldr/el.json +5832 -0
- package/dist/generated/assets/cldr/el_CY.json +5832 -0
- package/dist/generated/assets/cldr/en.json +6044 -0
- package/dist/generated/assets/cldr/en_AU.json +6084 -0
- package/dist/generated/assets/cldr/en_GB.json +6075 -0
- package/dist/generated/assets/cldr/en_HK.json +6084 -0
- package/dist/generated/assets/cldr/en_IE.json +6075 -0
- package/dist/generated/assets/cldr/en_IN.json +6080 -0
- package/dist/generated/assets/cldr/en_NZ.json +6075 -0
- package/dist/generated/assets/cldr/en_PG.json +6076 -0
- package/dist/generated/assets/cldr/en_SG.json +6080 -0
- package/dist/generated/assets/cldr/en_ZA.json +6076 -0
- package/dist/generated/assets/cldr/es.json +6103 -0
- package/dist/generated/assets/cldr/es_AR.json +6106 -0
- package/dist/generated/assets/cldr/es_BO.json +6105 -0
- package/dist/generated/assets/cldr/es_CL.json +5998 -0
- package/dist/generated/assets/cldr/es_CO.json +5998 -0
- package/dist/generated/assets/cldr/es_MX.json +6107 -0
- package/dist/generated/assets/cldr/es_PE.json +5889 -0
- package/dist/generated/assets/cldr/es_UY.json +5891 -0
- package/dist/generated/assets/cldr/es_VE.json +5890 -0
- package/dist/generated/assets/cldr/et.json +6027 -0
- package/dist/generated/assets/cldr/fa.json +5950 -0
- package/dist/generated/assets/cldr/fi.json +6195 -0
- package/dist/generated/assets/cldr/fr.json +5997 -0
- package/dist/generated/assets/cldr/fr_BE.json +5997 -0
- package/dist/generated/assets/cldr/fr_CA.json +5991 -0
- package/dist/generated/assets/cldr/fr_CH.json +6015 -0
- package/dist/generated/assets/cldr/fr_LU.json +5997 -0
- package/dist/generated/assets/cldr/he.json +6541 -0
- package/dist/generated/assets/cldr/hi.json +5859 -0
- package/dist/generated/assets/cldr/hr.json +6196 -0
- package/dist/generated/assets/cldr/hu.json +5945 -0
- package/dist/generated/assets/cldr/id.json +5730 -0
- package/dist/generated/assets/cldr/it.json +5986 -0
- package/dist/generated/assets/cldr/it_CH.json +5986 -0
- package/dist/generated/assets/cldr/ja.json +5889 -0
- package/dist/generated/assets/cldr/kk.json +5939 -0
- package/dist/generated/assets/cldr/ko.json +5770 -0
- package/dist/generated/assets/cldr/lt.json +6578 -0
- package/dist/generated/assets/cldr/lv.json +6114 -0
- package/dist/generated/assets/cldr/mk.json +6045 -0
- package/dist/generated/assets/cldr/ms.json +5564 -0
- package/dist/generated/assets/cldr/nb.json +6035 -0
- package/dist/generated/assets/cldr/nl.json +6202 -0
- package/dist/generated/assets/cldr/nl_BE.json +6202 -0
- package/dist/generated/assets/cldr/pl.json +6589 -0
- package/dist/generated/assets/cldr/pt.json +6115 -0
- package/dist/generated/assets/cldr/pt_PT.json +6180 -0
- package/dist/generated/assets/cldr/ro.json +6200 -0
- package/dist/generated/assets/cldr/ru.json +6503 -0
- package/dist/generated/assets/cldr/ru_UA.json +6503 -0
- package/dist/generated/assets/cldr/sk.json +6432 -0
- package/dist/generated/assets/cldr/sl.json +6444 -0
- package/dist/generated/assets/cldr/sr.json +6241 -0
- package/dist/generated/assets/cldr/sr_Latn.json +6226 -0
- package/dist/generated/assets/cldr/sv.json +6076 -0
- package/dist/generated/assets/cldr/th.json +5875 -0
- package/dist/generated/assets/cldr/tr.json +6094 -0
- package/dist/generated/assets/cldr/uk.json +6454 -0
- package/dist/generated/assets/cldr/vi.json +5669 -0
- package/dist/generated/assets/cldr/zh_CN.json +5717 -0
- package/dist/generated/assets/cldr/zh_HK.json +5726 -0
- package/dist/generated/assets/cldr/zh_SG.json +5726 -0
- package/dist/generated/assets/cldr/zh_TW.json +5793 -0
- package/dist/generated/json-imports/LocaleData-fetch.d.ts +1 -0
- package/dist/generated/json-imports/LocaleData-fetch.js +93 -0
- package/dist/generated/json-imports/LocaleData-fetch.js.map +1 -0
- package/dist/generated/json-imports/LocaleData-node.d.ts +1 -0
- package/dist/generated/json-imports/LocaleData-node.js +93 -0
- package/dist/generated/json-imports/LocaleData-node.js.map +1 -0
- package/dist/generated/json-imports/LocaleData.d.ts +1 -0
- package/dist/generated/json-imports/LocaleData.js +93 -0
- package/dist/generated/json-imports/LocaleData.js.map +1 -0
- package/dist/getCachedLocaleDataInstance.d.ts +4 -0
- package/dist/getCachedLocaleDataInstance.js +10 -0
- package/dist/getCachedLocaleDataInstance.js.map +1 -0
- package/dist/locale/getLocaleData.d.ts +11 -0
- package/dist/locale/getLocaleData.js +23 -0
- package/dist/locale/getLocaleData.js.map +1 -0
- package/dist/sap/base/Event.js +59 -0
- package/dist/sap/base/Eventing.js +146 -0
- package/dist/sap/base/Log.js +3 -0
- package/dist/sap/base/assert.js +34 -0
- package/dist/sap/base/config/MemoryConfigurationProvider.js +20 -0
- package/dist/sap/base/config.js +17 -0
- package/dist/sap/base/i18n/Formatting.d.ts +8 -0
- package/dist/sap/base/i18n/Formatting.js +11 -0
- package/dist/sap/base/i18n/Formatting.js.map +1 -0
- package/dist/sap/base/i18n/LanguageTag.js +173 -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 +43 -0
- package/dist/sap/base/i18n/date/CalendarWeekNumbering.js +105 -0
- package/dist/sap/base/i18n/date/TimezoneUtils.js +319 -0
- package/dist/sap/base/strings/camelize.js +30 -0
- package/dist/sap/base/strings/formatMessage.js +93 -0
- package/dist/sap/base/util/LoaderExtensions.d.ts +4 -0
- package/dist/sap/base/util/LoaderExtensions.js +14 -0
- package/dist/sap/base/util/LoaderExtensions.js.map +1 -0
- package/dist/sap/base/util/ObjectPath.d.ts +4 -0
- package/dist/sap/base/util/ObjectPath.js +6 -0
- package/dist/sap/base/util/ObjectPath.js.map +1 -0
- package/dist/sap/base/util/Version.js +157 -0
- package/dist/sap/base/util/_merge.js +89 -0
- package/dist/sap/base/util/array/uniqueSort.js +41 -0
- package/dist/sap/base/util/deepClone.js +102 -0
- package/dist/sap/base/util/deepEqual.js +83 -0
- package/dist/sap/base/util/extend.js +61 -0
- package/dist/sap/base/util/isEmptyObject.js +34 -0
- package/dist/sap/base/util/isPlainObject.js +52 -0
- package/dist/sap/base/util/now.js +28 -0
- package/dist/sap/base/util/resolveReference.js +3 -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 +72 -0
- package/dist/sap/ui/base/Metadata.js +483 -0
- package/dist/sap/ui/base/Object.js +300 -0
- package/dist/sap/ui/core/CalendarType.js +24 -0
- package/dist/sap/ui/core/Configuration.d.ts +17 -0
- package/dist/sap/ui/core/Configuration.js +23 -0
- package/dist/sap/ui/core/Configuration.js.map +1 -0
- package/dist/sap/ui/core/Core.d.ts +25 -0
- package/dist/sap/ui/core/Core.js +13 -0
- package/dist/sap/ui/core/Core.js.map +1 -0
- package/dist/sap/ui/core/FormatSettings.d.ts +9 -0
- package/dist/sap/ui/core/FormatSettings.js +12 -0
- package/dist/sap/ui/core/FormatSettings.js.map +1 -0
- package/dist/sap/ui/core/Locale.js +194 -0
- package/dist/sap/ui/core/LocaleData.js +2717 -0
- 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 +196 -0
- package/dist/sap/ui/core/date/CalendarUtils.js +65 -0
- package/dist/sap/ui/core/date/CalendarWeekNumbering.js +30 -0
- package/dist/sap/ui/core/date/Gregorian.js +32 -0
- package/dist/sap/ui/core/date/Islamic.js +367 -0
- package/dist/sap/ui/core/date/Japanese.js +257 -0
- package/dist/sap/ui/core/date/Persian.js +394 -0
- package/dist/sap/ui/core/date/UI5Date.js +991 -0
- package/dist/sap/ui/core/date/UniversalDate.js +1324 -0
- package/dist/sap/ui/core/date/_Calendars.js +22 -0
- package/dist/sap/ui/core/format/DateFormat.js +3310 -0
- package/dist/sap/ui/core/format/NumberFormat.js +2835 -0
- package/dist/sap/ui/core/format/TimezoneUtil.js +24 -0
- package/package-scripts.cjs +35 -0
- package/package.json +46 -0
- package/tsconfig.json +24 -0
- package/used-modules.txt +52 -0
|
@@ -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,CAAC;QAChC,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;IACzE,CAAC;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"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
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 class module:sap/base/Event
|
|
7
|
+
|
|
8
|
+
const EVENT_PARAMETERS_SYMBOL = Symbol("parameters");
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @author SAP SE
|
|
12
|
+
* @version 1.120.17
|
|
13
|
+
*
|
|
14
|
+
* Creates an event with the given <code>sType</code>,
|
|
15
|
+
* linked to the provided <code>oTarget</code> and enriched with the <code>oParameters</code>.
|
|
16
|
+
*
|
|
17
|
+
* @param {string} sType The type of the event
|
|
18
|
+
* @param {object} oParameters Parameters for this event. The parameters will be accessible as properties of the Event instance.
|
|
19
|
+
*
|
|
20
|
+
* @alias module:sap/base/Event
|
|
21
|
+
* @namespace
|
|
22
|
+
* @private
|
|
23
|
+
* @ui5-restricted sap.ui.core
|
|
24
|
+
*/
|
|
25
|
+
class Event {
|
|
26
|
+
/**
|
|
27
|
+
*The type of the event
|
|
28
|
+
* @type {string}
|
|
29
|
+
* @private
|
|
30
|
+
* @ui5-restricted sap.ui.core
|
|
31
|
+
*/
|
|
32
|
+
#type;
|
|
33
|
+
constructor(sType, oParameters) {
|
|
34
|
+
//copy & freeze parameters
|
|
35
|
+
for (const param in oParameters) {
|
|
36
|
+
this[param] = oParameters[param];
|
|
37
|
+
Object.defineProperty(this, param, {
|
|
38
|
+
configurable: false,
|
|
39
|
+
writable: false
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
this[EVENT_PARAMETERS_SYMBOL] = oParameters;
|
|
43
|
+
this.#type = sType;
|
|
44
|
+
}
|
|
45
|
+
get type() {
|
|
46
|
+
return this.#type;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Returns the event parameters as map
|
|
50
|
+
* @param {module:sap/base/Event} oEvent The event object to retrieve the parameters
|
|
51
|
+
* @returns {object} Map of event parameters
|
|
52
|
+
* @private
|
|
53
|
+
* @ui5-restricted sap/base/i18n sap.ui.core
|
|
54
|
+
*/
|
|
55
|
+
static getParameters(oEvent) {
|
|
56
|
+
return Object.assign({}, oEvent[EVENT_PARAMETERS_SYMBOL]);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export default Event;
|
|
@@ -0,0 +1,146 @@
|
|
|
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 mixin sap/base/Eventing
|
|
7
|
+
import assert from "./assert.js";
|
|
8
|
+
import Event from "./Event.js";
|
|
9
|
+
/**
|
|
10
|
+
* Eventing
|
|
11
|
+
*
|
|
12
|
+
* @author SAP SE
|
|
13
|
+
* @version 1.120.17
|
|
14
|
+
*
|
|
15
|
+
* @since 1.120.0
|
|
16
|
+
* @private
|
|
17
|
+
* @ui5-restricted sap.ui.core sap/base/i18n
|
|
18
|
+
*/
|
|
19
|
+
class Eventing {
|
|
20
|
+
#mEventRegistry = {};
|
|
21
|
+
/**
|
|
22
|
+
* Attaches an event handler to the event with the given identifier.
|
|
23
|
+
*
|
|
24
|
+
* @param {string}
|
|
25
|
+
* sType The type of the event to listen for
|
|
26
|
+
* @param {function}
|
|
27
|
+
* fnFunction The handler function to call when the event occurs. The event
|
|
28
|
+
* object ({@link module:sap/base/Event}) is provided as first argument of the handler. Handlers must not change
|
|
29
|
+
* the content of the event.
|
|
30
|
+
* @param {object}
|
|
31
|
+
* [oData] An object that will be passed to the handler along with the event object when the event is fired
|
|
32
|
+
* @since 1.120.0
|
|
33
|
+
* @private
|
|
34
|
+
* @ui5-restricted sap.ui.core sap/base/i18n
|
|
35
|
+
*/
|
|
36
|
+
attachEvent(sType, fnFunction, oData) {
|
|
37
|
+
assert(typeof sType === "string" && sType, "Eventing.attachEvent: sType must be a non-empty string");
|
|
38
|
+
assert(typeof fnFunction === "function", "Eventing.attachEvent: fnFunction must be a function");
|
|
39
|
+
let aEventListeners = this.#mEventRegistry[sType];
|
|
40
|
+
if (!Array.isArray(aEventListeners)) {
|
|
41
|
+
aEventListeners = this.#mEventRegistry[sType] = [];
|
|
42
|
+
}
|
|
43
|
+
aEventListeners.push({
|
|
44
|
+
fnFunction: fnFunction,
|
|
45
|
+
oData: oData
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Attaches an event handler, called one time only, to the event with the given identifier.
|
|
51
|
+
*
|
|
52
|
+
* When the event occurs, the handler function is called and the handler registration is automatically removed afterwards.
|
|
53
|
+
*
|
|
54
|
+
* @param {string}
|
|
55
|
+
* sType The type of the event to listen for
|
|
56
|
+
* @param {function}
|
|
57
|
+
* fnFunction The handler function to call when the event occurs. The event
|
|
58
|
+
* object ({@link module:sap/base/Event}) is provided as first argument of the handler. Handlers must not change
|
|
59
|
+
* the content of the event.
|
|
60
|
+
* @param {object}
|
|
61
|
+
* [oData] An object that will be passed to the handler along with the event object when the event is fired
|
|
62
|
+
* @since 1.120.0
|
|
63
|
+
* @private
|
|
64
|
+
* @ui5-restricted sap.ui.core sap/base/i18n
|
|
65
|
+
*/
|
|
66
|
+
attachEventOnce(sType, fnFunction, oData) {
|
|
67
|
+
const fnOnce = oEvent => {
|
|
68
|
+
this.detachEvent(sType, fnOnce);
|
|
69
|
+
fnFunction.call(null, oEvent); // needs to do the same resolution as in fireEvent
|
|
70
|
+
};
|
|
71
|
+
fnOnce.oOriginal = {
|
|
72
|
+
fnFunction: fnFunction
|
|
73
|
+
};
|
|
74
|
+
this.attachEvent(sType, fnOnce, oData);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Removes a previously attached event handler from the event with the given identifier.
|
|
79
|
+
*
|
|
80
|
+
* The passed parameters must match those used for registration with {@link #attachEvent} beforehand.
|
|
81
|
+
*
|
|
82
|
+
* @param {string}
|
|
83
|
+
* sType The type of the event to detach from
|
|
84
|
+
* @param {function}
|
|
85
|
+
* fnFunction The handler function to detach from the event
|
|
86
|
+
* @since 1.120.0
|
|
87
|
+
* @private
|
|
88
|
+
* @ui5-restricted sap.ui.core sap/base/i18n
|
|
89
|
+
*/
|
|
90
|
+
detachEvent(sType, fnFunction) {
|
|
91
|
+
assert(typeof sType === "string" && sType, "Eventing.detachEvent: sType must be a non-empty string");
|
|
92
|
+
assert(typeof fnFunction === "function", "Eventing.detachEvent: fnFunction must be a function");
|
|
93
|
+
const aEventListeners = this.#mEventRegistry[sType];
|
|
94
|
+
if (!Array.isArray(aEventListeners)) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
let oFound;
|
|
98
|
+
for (let i = 0, iL = aEventListeners.length; i < iL; i++) {
|
|
99
|
+
if (aEventListeners[i].fnFunction === fnFunction) {
|
|
100
|
+
oFound = aEventListeners[i];
|
|
101
|
+
aEventListeners.splice(i, 1);
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// If no listener was found, look for original listeners of attachEventOnce
|
|
106
|
+
if (!oFound) {
|
|
107
|
+
for (let i = 0, iL = aEventListeners.length; i < iL; i++) {
|
|
108
|
+
const oOriginal = aEventListeners[i].fnFunction.oOriginal;
|
|
109
|
+
if (oOriginal && oOriginal.fnFunction === fnFunction) {
|
|
110
|
+
aEventListeners.splice(i, 1);
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// If we just deleted the last registered EventHandler, remove the whole entry from our map.
|
|
116
|
+
if (aEventListeners.length == 0) {
|
|
117
|
+
delete this.#mEventRegistry[sType];
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Fires an {@link module:sap/base/Event event} with the given settings and notifies all attached event handlers.
|
|
123
|
+
*
|
|
124
|
+
* @param {string}
|
|
125
|
+
* sType The type of the event to fire
|
|
126
|
+
* @param {object}
|
|
127
|
+
* [oParameters] Parameters which should be carried by the event
|
|
128
|
+
* @since 1.120.0
|
|
129
|
+
* @private
|
|
130
|
+
* @ui5-restricted sap.ui.core sap/base/i18n
|
|
131
|
+
*/
|
|
132
|
+
fireEvent(sType, oParameters) {
|
|
133
|
+
let aEventListeners, oEvent, i, iL, oInfo;
|
|
134
|
+
aEventListeners = this.#mEventRegistry[sType];
|
|
135
|
+
if (Array.isArray(aEventListeners)) {
|
|
136
|
+
// avoid issues with 'concurrent modification' (e.g. if an event listener unregisters itself).
|
|
137
|
+
aEventListeners = aEventListeners.slice();
|
|
138
|
+
oEvent = new Event(sType, oParameters);
|
|
139
|
+
for (i = 0, iL = aEventListeners.length; i < iL; i++) {
|
|
140
|
+
oInfo = aEventListeners[i];
|
|
141
|
+
oInfo.fnFunction.call(null, oEvent);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
export default Eventing;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// TODO-evo:assert on node throws an error if the assertion is violated
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A simple assertion mechanism that logs a message when a given condition is not met.
|
|
5
|
+
*
|
|
6
|
+
* <b>Note:</b> Calls to this method might be removed when the JavaScript code
|
|
7
|
+
* is optimized during build. Therefore, callers should not rely on any side effects
|
|
8
|
+
* of this method.
|
|
9
|
+
*
|
|
10
|
+
* @function
|
|
11
|
+
* @since 1.58
|
|
12
|
+
* @alias module:sap/base/assert
|
|
13
|
+
* @param {boolean} bResult Result of the checked assertion
|
|
14
|
+
* @param {string|function():any} vMessage Message that will be logged when the result is <code>false</code>.
|
|
15
|
+
* In case this is a function, the return value of the function will be displayed. This can be used to execute
|
|
16
|
+
* complex code only if the assertion fails.
|
|
17
|
+
* @public
|
|
18
|
+
* @SecSink {1|SECRET} Could expose secret data in logs
|
|
19
|
+
*
|
|
20
|
+
*/ /*!
|
|
21
|
+
* OpenUI5
|
|
22
|
+
* (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
|
|
23
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
var fnAssert = function (bResult, vMessage) {
|
|
27
|
+
if (!bResult) {
|
|
28
|
+
var sMessage = typeof vMessage === "function" ? vMessage() : vMessage;
|
|
29
|
+
/*eslint-disable no-console */
|
|
30
|
+
console.assert(bResult, sMessage);
|
|
31
|
+
/*eslint-enable no-console */
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
export default fnAssert;
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
import uid from "../util/uid.js";
|
|
7
|
+
var MemoryConfigurationProvider = function () {
|
|
8
|
+
this.oConfig = Object.create(null);
|
|
9
|
+
this.id = uid();
|
|
10
|
+
};
|
|
11
|
+
MemoryConfigurationProvider.prototype.getId = function () {
|
|
12
|
+
return this.id;
|
|
13
|
+
};
|
|
14
|
+
MemoryConfigurationProvider.prototype.get = function (sName) {
|
|
15
|
+
return this.oConfig[sName];
|
|
16
|
+
};
|
|
17
|
+
MemoryConfigurationProvider.prototype.set = function (sName, vValue) {
|
|
18
|
+
this.oConfig[sName] = vValue;
|
|
19
|
+
};
|
|
20
|
+
export default MemoryConfigurationProvider;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// called from sapui5, but not supported by us
|
|
2
|
+
const legacyFormats = ["sapUiLegacyTimeFormat", "sapUiABAPTimeFormat", "sapUiLegacyDateFormat", "sapUiABAPDateFormat", "sapUiLegacyNumberFormat", "sapUiABAPNumberFormat"];
|
|
3
|
+
export default {
|
|
4
|
+
getWritableInstance() {
|
|
5
|
+
return {
|
|
6
|
+
get({
|
|
7
|
+
name
|
|
8
|
+
}) {
|
|
9
|
+
if (legacyFormats.includes(name)) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
throw new Error("Localization :: missing configuration requested.");
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
Type: {}
|
|
17
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenUI5 Formatting Shim
|
|
3
|
+
*/
|
|
4
|
+
declare const Formatting: {
|
|
5
|
+
getABAPDateFormat: () => void;
|
|
6
|
+
getCustomIslamicCalendarData: typeof import("@ui5/webcomponents-base/dist/features/LegacyDateFormats.js").default.getLegacyDateCalendarCustomizing;
|
|
7
|
+
};
|
|
8
|
+
export default Formatting;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getLegacyDateCalendarCustomizing } from "@ui5/webcomponents-base/dist/config/FormatSettings.js";
|
|
2
|
+
const emptyFn = () => { };
|
|
3
|
+
/**
|
|
4
|
+
* OpenUI5 Formatting Shim
|
|
5
|
+
*/
|
|
6
|
+
const Formatting = {
|
|
7
|
+
getABAPDateFormat: emptyFn,
|
|
8
|
+
getCustomIslamicCalendarData: getLegacyDateCalendarCustomizing,
|
|
9
|
+
};
|
|
10
|
+
export default Formatting;
|
|
11
|
+
//# sourceMappingURL=Formatting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Formatting.js","sourceRoot":"","sources":["../../../../src/sap/base/i18n/Formatting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,uDAAuD,CAAC;AAEzG,MAAM,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEzB;;GAEG;AACH,MAAM,UAAU,GAAG;IAClB,iBAAiB,EAAE,OAAO;IAC1B,4BAA4B,EAAE,gCAAgC;CAC9D,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { getLegacyDateCalendarCustomizing } from \"@ui5/webcomponents-base/dist/config/FormatSettings.js\";\n\nconst emptyFn = () => {};\n\n/**\n * OpenUI5 Formatting Shim\n */\nconst Formatting = {\n\tgetABAPDateFormat: emptyFn,\n\tgetCustomIslamicCalendarData: getLegacyDateCalendarCustomizing,\n};\n\nexport default Formatting;\n"]}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A regular expression that describes language tags according to BCP-47.
|
|
3
|
+
* @see BCP47 "Tags for Identifying Languages" (http://www.ietf.org/rfc/bcp/bcp47.txt)
|
|
4
|
+
*
|
|
5
|
+
* The matching groups are
|
|
6
|
+
* 0=all
|
|
7
|
+
* 1=language (shortest ISO639 code + ext. language sub tags | 4digits (reserved) | registered language sub tags)
|
|
8
|
+
* 2=script (4 letters)
|
|
9
|
+
* 3=region (2 letter language or 3 digits)
|
|
10
|
+
* 4=variants (separated by '-', Note: capturing group contains leading '-' to shorten the regex!)
|
|
11
|
+
* 5=extensions (including leading singleton, multiple extensions separated by '-'.Note: capturing group contains leading '-' to shorten the regex!)
|
|
12
|
+
* 6=private use section (including leading 'x', multiple sections separated by '-')
|
|
13
|
+
*
|
|
14
|
+
* [-------------------- language ----------------------][--- script ---][------- region --------][------------- variants --------------][----------- extensions ------------][------ private use -------]
|
|
15
|
+
*/ /*!
|
|
16
|
+
* OpenUI5
|
|
17
|
+
* (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
|
|
18
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
//Provides the LanguageTag object module:sap/base/i18n/LanguageTag
|
|
22
|
+
|
|
23
|
+
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;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Creates an LanguageTag instance.
|
|
27
|
+
* LanguageTag represents a BCP-47 language tag, consisting of a language, script, region, variants, extensions and private use section.
|
|
28
|
+
*
|
|
29
|
+
* @class
|
|
30
|
+
*
|
|
31
|
+
* @param {string} sLanguageTag the language tag identifier, in format en-US or en_US.
|
|
32
|
+
*
|
|
33
|
+
* @author SAP SE
|
|
34
|
+
* @version 1.120.17
|
|
35
|
+
* @public
|
|
36
|
+
* @alias module:sap/base/i18n/LanguageTag
|
|
37
|
+
*/
|
|
38
|
+
class LanguageTag {
|
|
39
|
+
/**
|
|
40
|
+
* Get the 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
|
+
* @type {string}
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
language;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Get the script or <code>null</code> if none was specified.
|
|
52
|
+
*
|
|
53
|
+
* Note that the case might differ from the original language tag
|
|
54
|
+
* (Upper case first letter and lower case reminder enforced as
|
|
55
|
+
* recommended by BCP47/ISO15924)
|
|
56
|
+
*
|
|
57
|
+
* @type {string|null}
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
|
+
script;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Get the region or <code>null</code> if none was specified.
|
|
64
|
+
*
|
|
65
|
+
* Note that the case might differ from the original script tag
|
|
66
|
+
* (Upper case is enforced as recommended by BCP47/ISO3166-1).
|
|
67
|
+
*
|
|
68
|
+
* @type {string}
|
|
69
|
+
* @public
|
|
70
|
+
*/
|
|
71
|
+
region;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Get the variants as a single string or <code>null</code>.
|
|
75
|
+
*
|
|
76
|
+
* Multiple variants are separated by a dash '-'.
|
|
77
|
+
*
|
|
78
|
+
* @type {string|null}
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
81
|
+
variant;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Get the variants as an array of individual variants.
|
|
85
|
+
*
|
|
86
|
+
* The separating dashes are not part of the result.
|
|
87
|
+
* If there is no variant section in the language tag, an empty array is returned.
|
|
88
|
+
*
|
|
89
|
+
* @type {string[]}
|
|
90
|
+
* @public
|
|
91
|
+
*/
|
|
92
|
+
variantSubtags;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Get the extension as a single string or <code>null</code>.
|
|
96
|
+
*
|
|
97
|
+
* The extension always consists of a singleton character (not 'x'),
|
|
98
|
+
* a dash '-' and one or more extension token, each separated
|
|
99
|
+
* again with a dash.
|
|
100
|
+
*
|
|
101
|
+
* @type {string|null}
|
|
102
|
+
* @public
|
|
103
|
+
*/
|
|
104
|
+
extension;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Get the extensions as an array of tokens.
|
|
108
|
+
*
|
|
109
|
+
* The leading singleton and the separating dashes are not part of the result.
|
|
110
|
+
* If there is no extensions section in the language tag, an empty array is returned.
|
|
111
|
+
*
|
|
112
|
+
* @type {string[]}
|
|
113
|
+
* @public
|
|
114
|
+
*/
|
|
115
|
+
extensionSubtags;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Get the private use section or <code>null</code>.
|
|
119
|
+
*
|
|
120
|
+
* @type {string}
|
|
121
|
+
*/
|
|
122
|
+
privateUse;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Get the private use section as an array of tokens.
|
|
126
|
+
*
|
|
127
|
+
* The leading singleton and the separating dashes are not part of the result.
|
|
128
|
+
* If there is no private use section in the language tag, an empty array is returned.
|
|
129
|
+
*
|
|
130
|
+
* @type {string[]}
|
|
131
|
+
*/
|
|
132
|
+
privateUseSubtags;
|
|
133
|
+
constructor(sLanguageTag) {
|
|
134
|
+
var aResult = rLanguageTag.exec(sLanguageTag.replace(/_/g, "-"));
|
|
135
|
+
// If the given language tag string cannot be parsed by the regular expression above,
|
|
136
|
+
// we should at least tell the developer why the Core fails to load.
|
|
137
|
+
if (aResult === null) {
|
|
138
|
+
throw new TypeError("The given language tag'" + sLanguageTag + "' does not adhere to BCP-47.");
|
|
139
|
+
}
|
|
140
|
+
this.language = aResult[1] || null;
|
|
141
|
+
this.script = aResult[2] || null;
|
|
142
|
+
this.region = aResult[3] || null;
|
|
143
|
+
this.variant = aResult[4] && aResult[4].slice(1) || null; // remove leading dash from capturing group
|
|
144
|
+
this.variantSubtags = this.variant ? this.variant.split('-') : [];
|
|
145
|
+
this.extension = aResult[5] && aResult[5].slice(1) || null; // remove leading dash from capturing group
|
|
146
|
+
this.extensionSubtags = this.variant ? this.variant.split('-') : [];
|
|
147
|
+
this.privateUse = aResult[6] || null;
|
|
148
|
+
this.privateUseSubtags = this.privateUse ? this.privateUse.slice(2).split('-') : [];
|
|
149
|
+
// convert subtags according to the BCP47 recommendations
|
|
150
|
+
// - language: all lower case
|
|
151
|
+
// - script: lower case with the first letter capitalized
|
|
152
|
+
// - region: all upper case
|
|
153
|
+
if (this.language) {
|
|
154
|
+
this.language = this.language.toLowerCase();
|
|
155
|
+
}
|
|
156
|
+
if (this.script) {
|
|
157
|
+
this.script = this.script.toLowerCase().replace(/^[a-z]/, function ($) {
|
|
158
|
+
return $.toUpperCase();
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
if (this.region) {
|
|
162
|
+
this.region = this.region.toUpperCase();
|
|
163
|
+
}
|
|
164
|
+
Object.freeze(this);
|
|
165
|
+
}
|
|
166
|
+
toString() {
|
|
167
|
+
return this.#join(this.language, this.script, this.region, this.variant, this.extension, this.privateUse);
|
|
168
|
+
}
|
|
169
|
+
#join() {
|
|
170
|
+
return Array.prototype.filter.call(arguments, Boolean).join("-");
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
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,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The types of <code>Calendar</code>.
|
|
3
|
+
*
|
|
4
|
+
* @enum {string}
|
|
5
|
+
* @alias module:sap/base/i18n/date/CalendarType
|
|
6
|
+
* @public
|
|
7
|
+
* @since 1.120
|
|
8
|
+
*/ /*!
|
|
9
|
+
* OpenUI5
|
|
10
|
+
* (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
// Provides type module:sap/base/i18n/date/CalendarType.
|
|
15
|
+
|
|
16
|
+
var CalendarType = {
|
|
17
|
+
/**
|
|
18
|
+
* The Gregorian calendar
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
Gregorian: "Gregorian",
|
|
22
|
+
/**
|
|
23
|
+
* The Islamic calendar
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
Islamic: "Islamic",
|
|
27
|
+
/**
|
|
28
|
+
* The Japanese emperor calendar
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
Japanese: "Japanese",
|
|
32
|
+
/**
|
|
33
|
+
* The Persian Jalali calendar
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
Persian: "Persian",
|
|
37
|
+
/**
|
|
38
|
+
* The Thai buddhist calendar
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
Buddhist: "Buddhist"
|
|
42
|
+
};
|
|
43
|
+
export default CalendarType;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The <code>CalendarWeekNumbering</code> enum defines how to calculate calendar weeks. Each
|
|
3
|
+
* value defines:
|
|
4
|
+
* <ul>
|
|
5
|
+
* <li>The first day of the week,</li>
|
|
6
|
+
* <li>the first week of the year.</li>
|
|
7
|
+
* </ul>
|
|
8
|
+
*
|
|
9
|
+
* @enum {string}
|
|
10
|
+
* @public
|
|
11
|
+
* @alias module:sap/base/i18n/date/CalendarWeekNumbering
|
|
12
|
+
* @since 1.120
|
|
13
|
+
*/ /*!
|
|
14
|
+
* OpenUI5
|
|
15
|
+
* (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
|
|
16
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// Provides type module:sap/base/i18n/date/CalendarWeekNumbering.
|
|
20
|
+
|
|
21
|
+
var CalendarWeekNumbering = {
|
|
22
|
+
/**
|
|
23
|
+
* The default calendar week numbering:
|
|
24
|
+
*
|
|
25
|
+
* The framework determines the week numbering scheme; currently it is derived from the
|
|
26
|
+
* active format locale. Future versions of UI5 might select a different week numbering
|
|
27
|
+
* scheme.
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
Default: "Default",
|
|
32
|
+
/**
|
|
33
|
+
* Official calendar week numbering in most of Europe (ISO 8601 standard):
|
|
34
|
+
* <ul>
|
|
35
|
+
* <li>Monday is first day of the week,
|
|
36
|
+
* <li>the week containing January 4th is first week of the year.
|
|
37
|
+
* </ul>
|
|
38
|
+
*
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
ISO_8601: "ISO_8601",
|
|
42
|
+
/**
|
|
43
|
+
* Official calendar week numbering in much of the Middle East (Middle Eastern calendar):
|
|
44
|
+
* <ul>
|
|
45
|
+
* <li>Saturday is first day of the week,
|
|
46
|
+
* <li>the week containing January 1st is first week of the year.
|
|
47
|
+
* </ul>
|
|
48
|
+
*
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
MiddleEastern: "MiddleEastern",
|
|
52
|
+
/**
|
|
53
|
+
* Official calendar week numbering in the United States, Canada, Brazil, Israel, Japan, and
|
|
54
|
+
* other countries (Western traditional calendar):
|
|
55
|
+
* <ul>
|
|
56
|
+
* <li>Sunday is first day of the week,
|
|
57
|
+
* <li>the week containing January 1st is first week of the year.
|
|
58
|
+
* </ul>
|
|
59
|
+
*
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
WesternTraditional: "WesternTraditional"
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Returns an object containing the week configuration values for the given calendar week
|
|
67
|
+
* numbering algorithm.
|
|
68
|
+
*
|
|
69
|
+
* @param {module:sap/base/i18n/date/CalendarWeekNumbering} [sCalendarWeekNumbering=Default]
|
|
70
|
+
* The calendar week numbering algorithm
|
|
71
|
+
* @returns {{firstDayOfWeek: 0|1|2|3|4|5|6, minimalDaysInFirstWeek: 1|2|3|4|5|6|7}|undefined}
|
|
72
|
+
* The week configuration values or <code>undefined</code> if the given calendar week
|
|
73
|
+
* numbering algorithm is "Default"
|
|
74
|
+
*
|
|
75
|
+
* @function
|
|
76
|
+
* @name module:sap/base/i18n/date/CalendarWeekNumbering.getWeekConfigurationValues
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
79
|
+
Object.defineProperty(CalendarWeekNumbering, "getWeekConfigurationValues", {
|
|
80
|
+
// configurable : false,
|
|
81
|
+
// enumerable : false,
|
|
82
|
+
value: function (sCalendarWeekNumbering) {
|
|
83
|
+
switch (sCalendarWeekNumbering) {
|
|
84
|
+
case CalendarWeekNumbering.ISO_8601:
|
|
85
|
+
return {
|
|
86
|
+
firstDayOfWeek: 1,
|
|
87
|
+
minimalDaysInFirstWeek: 4
|
|
88
|
+
};
|
|
89
|
+
case CalendarWeekNumbering.MiddleEastern:
|
|
90
|
+
return {
|
|
91
|
+
firstDayOfWeek: 6,
|
|
92
|
+
minimalDaysInFirstWeek: 1
|
|
93
|
+
};
|
|
94
|
+
case CalendarWeekNumbering.WesternTraditional:
|
|
95
|
+
return {
|
|
96
|
+
firstDayOfWeek: 0,
|
|
97
|
+
minimalDaysInFirstWeek: 1
|
|
98
|
+
};
|
|
99
|
+
default:
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// writable : false
|
|
104
|
+
});
|
|
105
|
+
export default CalendarWeekNumbering;
|