@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,89 @@
|
|
|
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 isPlainObject from "./isPlainObject.js";
|
|
7
|
+
var oToken = Object.create(null);
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Performs object extension by merging source objects into a target object.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* var oMerged = _merge(true, false, {}, {prop1:1}, {prop2:2});
|
|
14
|
+
*
|
|
15
|
+
* @function
|
|
16
|
+
* @since 1.71
|
|
17
|
+
* @private
|
|
18
|
+
* @alias module:sap/base/util/_merge
|
|
19
|
+
* @param {boolean} deep Shallow copy or deep merge
|
|
20
|
+
* @param {boolean} skipUndefined Whether <code>undefined</code> values will be skipped, otherwise <code>undefined</code> values will overwrite existing values
|
|
21
|
+
* @param {object} target The object that will receive new properties
|
|
22
|
+
* @param {...object} [source] One or more objects which get merged into the target object
|
|
23
|
+
* @return {object} the target object which is the result of the merge
|
|
24
|
+
*/
|
|
25
|
+
var fnMerge = function () {
|
|
26
|
+
/*
|
|
27
|
+
* The code in this function is taken from jQuery 3.6.0 "jQuery.extend" and got modified.
|
|
28
|
+
*
|
|
29
|
+
* jQuery JavaScript Library v3.6.0
|
|
30
|
+
* https://jquery.com/
|
|
31
|
+
*
|
|
32
|
+
* Copyright OpenJS Foundation and other contributors
|
|
33
|
+
* Released under the MIT license
|
|
34
|
+
* https://jquery.org/license
|
|
35
|
+
*/
|
|
36
|
+
var src,
|
|
37
|
+
copyIsArray,
|
|
38
|
+
copy,
|
|
39
|
+
name,
|
|
40
|
+
options,
|
|
41
|
+
clone,
|
|
42
|
+
target = arguments[2] || {},
|
|
43
|
+
i = 3,
|
|
44
|
+
length = arguments.length,
|
|
45
|
+
deep = arguments[0] || false,
|
|
46
|
+
skipToken = arguments[1] ? undefined : oToken;
|
|
47
|
+
|
|
48
|
+
// Handle case when target is a string or something (possible in deep copy)
|
|
49
|
+
if (typeof target !== "object" && typeof target !== "function") {
|
|
50
|
+
target = {};
|
|
51
|
+
}
|
|
52
|
+
for (; i < length; i++) {
|
|
53
|
+
if ((options = arguments[i]) != null) {
|
|
54
|
+
// Extend the base object
|
|
55
|
+
for (name in options) {
|
|
56
|
+
src = target[name];
|
|
57
|
+
copy = options[name];
|
|
58
|
+
|
|
59
|
+
// Prevent never-ending loop
|
|
60
|
+
// Prevent Object.prototype pollution for $.extend( true, ... )
|
|
61
|
+
// For further information, please visit https://github.com/jquery/jquery/pull/4333
|
|
62
|
+
if (name === "__proto__" || target === copy) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Recurse if we're merging plain objects or arrays
|
|
67
|
+
if (deep && copy && (isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {
|
|
68
|
+
if (copyIsArray) {
|
|
69
|
+
copyIsArray = false;
|
|
70
|
+
clone = src && Array.isArray(src) ? src : [];
|
|
71
|
+
} else {
|
|
72
|
+
clone = src && isPlainObject(src) ? src : {};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Never move original objects, clone them
|
|
76
|
+
target[name] = fnMerge(deep, arguments[1], clone, copy);
|
|
77
|
+
|
|
78
|
+
// Don't bring in undefined values
|
|
79
|
+
} else if (copy !== skipToken) {
|
|
80
|
+
target[name] = copy;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Return the modified object
|
|
87
|
+
return target;
|
|
88
|
+
};
|
|
89
|
+
export default fnMerge;
|
|
@@ -0,0 +1,41 @@
|
|
|
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 assert from "../../assert.js";
|
|
7
|
+
/**
|
|
8
|
+
* Sorts the given array in-place and removes any duplicates (identified by "===").
|
|
9
|
+
*
|
|
10
|
+
* Uses Array#sort()
|
|
11
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
|
|
12
|
+
*
|
|
13
|
+
* Use <code>jQuery.uniqueSort()</code> for arrays of DOMElements.
|
|
14
|
+
*
|
|
15
|
+
* @function
|
|
16
|
+
* @since 1.58
|
|
17
|
+
* @param {any[]} aArray An Array of any type
|
|
18
|
+
* @alias module:sap/base/util/array/uniqueSort
|
|
19
|
+
* @return {any[]} Same array as given (for chaining)
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
var fnUniqueSort = function (aArray) {
|
|
23
|
+
assert(Array.isArray(aArray), "uniqueSort: input parameter must be an Array");
|
|
24
|
+
var iLength = aArray.length;
|
|
25
|
+
if (iLength > 1) {
|
|
26
|
+
aArray.sort();
|
|
27
|
+
var j = 0;
|
|
28
|
+
for (var i = 1; i < iLength; i++) {
|
|
29
|
+
// invariant: i is the entry to check, j is the last unique entry known so far
|
|
30
|
+
if (aArray.indexOf(aArray[i]) === i) {
|
|
31
|
+
aArray[++j] = aArray[i];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// cut off the rest - if any
|
|
35
|
+
if (++j < iLength) {
|
|
36
|
+
aArray.splice(j, iLength - j);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return aArray;
|
|
40
|
+
};
|
|
41
|
+
export default fnUniqueSort;
|
|
@@ -0,0 +1,102 @@
|
|
|
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 isPlainObject from "./isPlainObject.js";
|
|
7
|
+
/**
|
|
8
|
+
* Creates a deep clone of the source value.
|
|
9
|
+
*
|
|
10
|
+
* Only arrays, JavaScript Date objects and objects that pass the {@link module:sap/base/util/isPlainObject isPlainObject}
|
|
11
|
+
* check will be cloned. For other object types, a <code>TypeError</code> will be thrown as there's no standard way
|
|
12
|
+
* to clone them. Primitive values (boolean, number, string) as well as <code>null</code> and <code>undefined</code>
|
|
13
|
+
* will be copied, they have value semantics anyhow.
|
|
14
|
+
*
|
|
15
|
+
* <code>deepClone</code> is designed to match the semantics of {@link module:sap/base/util/deepEqual deepEqual}.
|
|
16
|
+
* Any deeply cloned object should be deep-equal to the source. However, not every object that can be handled
|
|
17
|
+
* by <code>deepEqual</code> can also be deeply cloned (e.g. <code>deepClone</code> fails on non-plain objects).
|
|
18
|
+
*
|
|
19
|
+
* To limit the time needed for a deep clone and to avoid endless recursion in case of cyclic structures, the
|
|
20
|
+
* recursion depth is limited by the parameter <code>maxDepth</code>, which defaults to 10. When the recursion
|
|
21
|
+
* depth exceeds the given limit, a <code>TypeError</code> is thrown.
|
|
22
|
+
*
|
|
23
|
+
* Note that object identities are not honored by the clone operation. If the original source contained multiple
|
|
24
|
+
* references to the same plain object instance, the clone will contain a different clone for each reference.
|
|
25
|
+
*
|
|
26
|
+
* @example <caption>Simple operation</caption>
|
|
27
|
+
* var oSource = { a: 1, b: { x: "test", y : 5.0 }, c: new Date(), d: null };
|
|
28
|
+
* var oClone = deepClone(oValue);
|
|
29
|
+
*
|
|
30
|
+
* deepEqual(oClone, oSource); // true
|
|
31
|
+
* oClone !== oSource; // true
|
|
32
|
+
* oClone.b !== oSource.b; // true
|
|
33
|
+
* oClone.c !== oSource.c; // true
|
|
34
|
+
*
|
|
35
|
+
* @example <caption>Object Identities</caption>
|
|
36
|
+
* var oCommon = { me: "unique" };
|
|
37
|
+
* var oValue = { a: oCommon, b: oCommon };
|
|
38
|
+
* var oClone = deepClone(oValue);
|
|
39
|
+
*
|
|
40
|
+
* deepEqual(oClone, oSource); // true
|
|
41
|
+
* oSource.a === oSource.b; // true
|
|
42
|
+
* oClone.a === oClone.b; // false
|
|
43
|
+
* deepEqual(oClone.a, oClone.b); // true
|
|
44
|
+
*
|
|
45
|
+
* @since 1.63
|
|
46
|
+
* @public
|
|
47
|
+
* @alias module:sap/base/util/deepClone
|
|
48
|
+
* @param {any} src Source value that shall be cloned
|
|
49
|
+
* @param {int} [maxDepth=10] Maximum recursion depth for the clone operation, deeper structures will throw an error
|
|
50
|
+
* @returns {any} A clone of the source value
|
|
51
|
+
* @throws {TypeError} When a non-plain object is encountered or when the max structure depth is exceeded
|
|
52
|
+
*/
|
|
53
|
+
var fnDeepClone = function (src, maxDepth) {
|
|
54
|
+
if (!maxDepth) {
|
|
55
|
+
maxDepth = 10;
|
|
56
|
+
}
|
|
57
|
+
return clone(src, 0, maxDepth);
|
|
58
|
+
};
|
|
59
|
+
function clone(src, depth, maxDepth) {
|
|
60
|
+
// avoid endless recursion due to cyclic structures
|
|
61
|
+
if (depth > maxDepth) {
|
|
62
|
+
throw new TypeError("The structure depth of the source exceeds the maximum depth (" + maxDepth + ")");
|
|
63
|
+
}
|
|
64
|
+
if (src == null) {
|
|
65
|
+
return src;
|
|
66
|
+
} else if (src instanceof Date) {
|
|
67
|
+
if (src.clone) {
|
|
68
|
+
// sap.ui.core.date.UI5Date
|
|
69
|
+
return src.clone();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// clone date object using #getTime(). Officially the date constructor does not support parameter Date.
|
|
73
|
+
return new Date(src.getTime());
|
|
74
|
+
} else if (Array.isArray(src)) {
|
|
75
|
+
return cloneArray(src, depth, maxDepth);
|
|
76
|
+
} else if (typeof src === "object") {
|
|
77
|
+
return cloneObject(src, depth, maxDepth);
|
|
78
|
+
} else {
|
|
79
|
+
return src;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function cloneArray(src, depth, maxDepth) {
|
|
83
|
+
var aClone = [];
|
|
84
|
+
for (var i = 0; i < src.length; i++) {
|
|
85
|
+
aClone.push(clone(src[i], depth + 1, maxDepth));
|
|
86
|
+
}
|
|
87
|
+
return aClone;
|
|
88
|
+
}
|
|
89
|
+
function cloneObject(src, depth, maxDepth) {
|
|
90
|
+
if (!isPlainObject(src)) {
|
|
91
|
+
throw new TypeError("Cloning is only supported for plain objects");
|
|
92
|
+
}
|
|
93
|
+
var oClone = {};
|
|
94
|
+
for (var key in src) {
|
|
95
|
+
if (key === "__proto__") {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
oClone[key] = clone(src[key], depth + 1, maxDepth);
|
|
99
|
+
}
|
|
100
|
+
return oClone;
|
|
101
|
+
}
|
|
102
|
+
export default fnDeepClone;
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
/*global Node */
|
|
7
|
+
//@evo-todo check isEqualNode dependency: not yet available...
|
|
8
|
+
//@evo-todo dependency to global name 'Node' contradicts sap/base package
|
|
9
|
+
import Log from "../Log.js";
|
|
10
|
+
/**
|
|
11
|
+
* Compares the two given values for equality, especially by comparing the content.
|
|
12
|
+
*
|
|
13
|
+
* <b>Note:</b> Function does not work with comparing XML objects.
|
|
14
|
+
*
|
|
15
|
+
* @function
|
|
16
|
+
* @since 1.58
|
|
17
|
+
* @param {any} a A value of any type
|
|
18
|
+
* @param {any} b A value of any type
|
|
19
|
+
* @param {int} [maxDepth=10] Maximum recursion depth
|
|
20
|
+
* @param {boolean} [contains] Whether all existing properties in a are equal as in b
|
|
21
|
+
* @alias module:sap/base/util/deepEqual
|
|
22
|
+
* @return {boolean} Whether a and b are equal
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
var fnEqual = function (a, b, maxDepth, contains, depth) {
|
|
26
|
+
// Optional parameter normalization
|
|
27
|
+
if (typeof maxDepth == "boolean") {
|
|
28
|
+
contains = maxDepth;
|
|
29
|
+
maxDepth = undefined;
|
|
30
|
+
}
|
|
31
|
+
if (!depth) {
|
|
32
|
+
depth = 0;
|
|
33
|
+
}
|
|
34
|
+
if (!maxDepth) {
|
|
35
|
+
maxDepth = 10;
|
|
36
|
+
}
|
|
37
|
+
if (depth > maxDepth) {
|
|
38
|
+
Log.warning("deepEqual comparison exceeded maximum recursion depth of " + maxDepth + ". Treating values as unequal");
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
if (a === b || Number.isNaN(a) && Number.isNaN(b)) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
45
|
+
if (!contains && a.length !== b.length) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
if (a.length > b.length) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
for (var i = 0; i < a.length; i++) {
|
|
52
|
+
if (!fnEqual(a[i], b[i], maxDepth, contains, depth + 1)) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
if (typeof a == "object" && typeof b == "object") {
|
|
59
|
+
if (!a || !b) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
if (a.constructor !== b.constructor) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
if (!contains && Object.keys(a).length !== Object.keys(b).length) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
if (a instanceof Node) {
|
|
69
|
+
return a.isEqualNode(b);
|
|
70
|
+
}
|
|
71
|
+
if (a instanceof Date) {
|
|
72
|
+
return a.valueOf() === b.valueOf();
|
|
73
|
+
}
|
|
74
|
+
for (var i in a) {
|
|
75
|
+
if (!fnEqual(a[i], b[i], maxDepth, contains, depth + 1)) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
return false;
|
|
82
|
+
};
|
|
83
|
+
export default fnEqual;
|
|
@@ -0,0 +1,61 @@
|
|
|
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 _merge from "./_merge.js";
|
|
7
|
+
/**
|
|
8
|
+
* Performs object extension by merging source objects into a target object. Generates a shallow copy.
|
|
9
|
+
*
|
|
10
|
+
* If during merging a key in the target object exists it is overwritten with the source object's value.
|
|
11
|
+
* Usage is the same as <code>jQuery.extend(...)</code>.
|
|
12
|
+
* Values that are <code>undefined</code> are ignored.
|
|
13
|
+
*
|
|
14
|
+
* As alternative you may also use <code>Object.assign</code>, but note that <code>Object.assign</code>
|
|
15
|
+
* only copies enumerable and own properties and doesn't copy properties on the prototype and non-enumerable
|
|
16
|
+
* properties. Also, values that are <code>undefined</code> are NOT ignored.
|
|
17
|
+
*
|
|
18
|
+
* For deep copies, you may use {@link module:sap/base/util/deepExtend sap/base/util/deepExtend}.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* var oResult = extend({}, {
|
|
22
|
+
* prop1: {
|
|
23
|
+
* prop1a: "1a"
|
|
24
|
+
* }
|
|
25
|
+
* }, {
|
|
26
|
+
* prop2: {
|
|
27
|
+
* prop2a: "2a"
|
|
28
|
+
* }
|
|
29
|
+
* }, {
|
|
30
|
+
* prop1: {
|
|
31
|
+
* prop1b: "1b"
|
|
32
|
+
* }
|
|
33
|
+
* }, {
|
|
34
|
+
* prop2: undefined
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
*
|
|
38
|
+
* console.log(oResult);
|
|
39
|
+
* {
|
|
40
|
+
* "prop1": {
|
|
41
|
+
* "prop1b": "1b"
|
|
42
|
+
* },
|
|
43
|
+
* "prop2": {
|
|
44
|
+
* "prop2a": "2a"
|
|
45
|
+
* }
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
* @function
|
|
49
|
+
* @alias module:sap/base/util/extend
|
|
50
|
+
* @param {object} target The object that will receive new properties
|
|
51
|
+
* @param {...object} [source] One or more objects which get merged into the target object
|
|
52
|
+
* @return {object} the target object which is the result of the merge
|
|
53
|
+
* @public
|
|
54
|
+
* @since 1.71
|
|
55
|
+
*/
|
|
56
|
+
var fnExtend = function () {
|
|
57
|
+
var args = [false, true];
|
|
58
|
+
args.push.apply(args, arguments);
|
|
59
|
+
return _merge.apply(null, args);
|
|
60
|
+
};
|
|
61
|
+
export default fnExtend;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates if the given object is empty, that is that it has no enumerable properties.
|
|
3
|
+
*
|
|
4
|
+
* Note that <code>null</code> and <code>undefined</code> comply with this definition of 'empty'.
|
|
5
|
+
* The behavior for non-object values is undefined and might change in future.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* sap.ui.require(["sap/base/util/isEmptyObject"], function(isEmptyObject){
|
|
9
|
+
* isEmptyObject({}); // true
|
|
10
|
+
* isEmptyObject({test: '123'}); // false
|
|
11
|
+
* isEmptyObject(null); // true
|
|
12
|
+
* isEmptyObject(undefined); // true
|
|
13
|
+
* });
|
|
14
|
+
*
|
|
15
|
+
* @function
|
|
16
|
+
* @since 1.65
|
|
17
|
+
* @public
|
|
18
|
+
* @name module:sap/base/util/isEmptyObject
|
|
19
|
+
* @param {Object} obj the object which is checked
|
|
20
|
+
* @returns {boolean} whether or not the given object is empty
|
|
21
|
+
*/ /*!
|
|
22
|
+
* OpenUI5
|
|
23
|
+
* (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
|
|
24
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
var fnIsEmptyObject = function isEmptyObject(obj) {
|
|
28
|
+
// eslint-disable-next-line no-unreachable-loop
|
|
29
|
+
for (var sName in obj) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
33
|
+
};
|
|
34
|
+
export default fnIsEmptyObject;
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
var class2type = {};
|
|
8
|
+
var hasOwn = class2type.hasOwnProperty;
|
|
9
|
+
var toString = class2type.toString;
|
|
10
|
+
var fnToString = hasOwn.toString;
|
|
11
|
+
var ObjectFunctionString = fnToString.call(Object);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Checks whether the object is a plain object (created using "{}" or "new Object").
|
|
15
|
+
*
|
|
16
|
+
* @function
|
|
17
|
+
* @since 1.58
|
|
18
|
+
* @public
|
|
19
|
+
* @alias module:sap/base/util/isPlainObject
|
|
20
|
+
* @param {Object} obj the object which is checked
|
|
21
|
+
* @returns {boolean} whether or not the object is a plain object (created using "{}" or "new Object").
|
|
22
|
+
*/
|
|
23
|
+
var fnIsPlainObject = function (obj) {
|
|
24
|
+
/*
|
|
25
|
+
* The code in this function is taken from jQuery 3.6.0 "jQuery.isPlainObject" and got modified.
|
|
26
|
+
*
|
|
27
|
+
* jQuery JavaScript Library v3.6.0
|
|
28
|
+
* http://jquery.com/
|
|
29
|
+
*
|
|
30
|
+
* Copyright OpenJS Foundation and other contributors
|
|
31
|
+
* Released under the MIT license
|
|
32
|
+
* http://jquery.org/license
|
|
33
|
+
*/
|
|
34
|
+
var proto, Ctor;
|
|
35
|
+
|
|
36
|
+
// Detect obvious negatives
|
|
37
|
+
// Use toString instead of jQuery.type to catch host objects
|
|
38
|
+
if (!obj || toString.call(obj) !== "[object Object]") {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
proto = Object.getPrototypeOf(obj);
|
|
42
|
+
|
|
43
|
+
// Objects with no prototype (e.g., `Object.create( null )`) are plain
|
|
44
|
+
if (!proto) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Objects with a prototype are considered plain only if they were constructed by a global Object function
|
|
49
|
+
Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
|
|
50
|
+
return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
|
|
51
|
+
};
|
|
52
|
+
export default fnIsPlainObject;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// @evo-todo window.performance does not exist on node.js, but there is a module performance-now. Maybe use it
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns a high resolution timestamp in microseconds if supported by the environment, otherwise in milliseconds.
|
|
5
|
+
* The timestamp is based on 01/01/1970 00:00:00 (UNIX epoch) as float with microsecond precision or
|
|
6
|
+
* with millisecond precision, if high resolution timestamps are not available.
|
|
7
|
+
* The fractional part of the timestamp represents fractions of a millisecond.
|
|
8
|
+
* Converting to a <code>Date</code> is possible by using <code>require(["sap/base/util/now"], function(now){new Date(now());}</code>
|
|
9
|
+
*
|
|
10
|
+
* @function
|
|
11
|
+
* @since 1.58
|
|
12
|
+
* @public
|
|
13
|
+
* @alias module:sap/base/util/now
|
|
14
|
+
* @returns {float} timestamp in microseconds if supported by the environment otherwise in milliseconds
|
|
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
|
+
/*global performance */
|
|
21
|
+
|
|
22
|
+
var fnNow = !(typeof window != "undefined" && window.performance && performance.now && performance.timing) ? Date.now : function () {
|
|
23
|
+
var iNavigationStart = performance.timing.navigationStart;
|
|
24
|
+
return function perfnow() {
|
|
25
|
+
return iNavigationStart + performance.now();
|
|
26
|
+
};
|
|
27
|
+
}();
|
|
28
|
+
export default fnNow;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Some private variable used for creation of (pseudo-)unique IDs.
|
|
3
|
+
* @type int
|
|
4
|
+
* @private
|
|
5
|
+
*/ /*!
|
|
6
|
+
* OpenUI5
|
|
7
|
+
* (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
var iIdCounter = 0;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Creates and returns a pseudo-unique ID.
|
|
15
|
+
*
|
|
16
|
+
* No means for detection of overlap with already present or future UIDs.
|
|
17
|
+
*
|
|
18
|
+
* @function
|
|
19
|
+
* @since 1.58
|
|
20
|
+
* @alias module:sap/base/util/uid
|
|
21
|
+
* @return {string} A pseudo-unique id.
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
var fnUid = function uid() {
|
|
25
|
+
return "id-" + new Date().valueOf() + "-" + iIdCounter++;
|
|
26
|
+
};
|
|
27
|
+
export default fnUid;
|