@openui5/sap.ui.webc.common 1.111.1 → 1.112.0
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/package.json +2 -2
- package/src/sap/ui/webc/common/.library +2 -2
- package/src/sap/ui/webc/common/Configuration.js +6 -0
- package/src/sap/ui/webc/common/Icons.js +6 -0
- package/src/sap/ui/webc/common/WebComponent.js +1 -1
- package/src/sap/ui/webc/common/WebComponentMetadata.js +1 -1
- package/src/sap/ui/webc/common/library.js +3 -3
- package/src/sap/ui/webc/common/thirdparty/base/Boot.js +2 -11
- package/src/sap/ui/webc/common/thirdparty/base/CSP.js +3 -14
- package/src/sap/ui/webc/common/thirdparty/base/CustomElementsRegistry.js +0 -21
- package/src/sap/ui/webc/common/thirdparty/base/CustomElementsScopeUtils.js +5 -22
- package/src/sap/ui/webc/common/thirdparty/base/DOMObserver.js +5 -18
- package/src/sap/ui/webc/common/thirdparty/base/Device.js +2 -35
- package/src/sap/ui/webc/common/thirdparty/base/EventProvider.js +2 -21
- package/src/sap/ui/webc/common/thirdparty/base/FeaturesRegistry.js +0 -4
- package/src/sap/ui/webc/common/thirdparty/base/FontFace.js +4 -8
- package/src/sap/ui/webc/common/thirdparty/base/InitialConfiguration.js +13 -42
- package/src/sap/ui/webc/common/thirdparty/base/Keys.js +3 -138
- package/src/sap/ui/webc/common/thirdparty/base/ManagedStyles.js +0 -19
- package/src/sap/ui/webc/common/thirdparty/base/MediaRange.js +4 -8
- package/src/sap/ui/webc/common/thirdparty/base/PropertiesFileFormat.js +2 -16
- package/src/sap/ui/webc/common/thirdparty/base/Render.js +14 -35
- package/src/sap/ui/webc/common/thirdparty/base/RenderQueue.js +1 -16
- package/src/sap/ui/webc/common/thirdparty/base/RenderScheduler.js +2 -10
- package/src/sap/ui/webc/common/thirdparty/base/Runtimes.js +18 -34
- package/src/sap/ui/webc/common/thirdparty/base/StaticAreaItem.js +4 -25
- package/src/sap/ui/webc/common/thirdparty/base/SystemCSSVars.js +0 -3
- package/src/sap/ui/webc/common/thirdparty/base/UI5Element.js +104 -246
- package/src/sap/ui/webc/common/thirdparty/base/UI5ElementMetadata.js +39 -84
- package/src/sap/ui/webc/common/thirdparty/base/animations/AnimationQueue.js +0 -11
- package/src/sap/ui/webc/common/thirdparty/base/animations/animate.js +0 -8
- package/src/sap/ui/webc/common/thirdparty/base/animations/scroll.js +0 -4
- package/src/sap/ui/webc/common/thirdparty/base/animations/slideDown.js +9 -10
- package/src/sap/ui/webc/common/thirdparty/base/animations/slideUp.js +4 -7
- package/src/sap/ui/webc/common/thirdparty/base/asset-registries/Icons.js +9 -34
- package/src/sap/ui/webc/common/thirdparty/base/asset-registries/Illustrations.js +0 -8
- package/src/sap/ui/webc/common/thirdparty/base/asset-registries/LocaleData.js +36 -57
- package/src/sap/ui/webc/common/thirdparty/base/asset-registries/Themes.js +4 -27
- package/src/sap/ui/webc/common/thirdparty/base/asset-registries/i18n.js +12 -37
- package/src/sap/ui/webc/common/thirdparty/base/assets-meta/IconCollectionsAlias.js +0 -1
- package/src/sap/ui/webc/common/thirdparty/base/config/AnimationMode.js +0 -7
- package/src/sap/ui/webc/common/thirdparty/base/config/CalendarType.js +2 -7
- package/src/sap/ui/webc/common/thirdparty/base/config/FormatSettings.js +2 -4
- package/src/sap/ui/webc/common/thirdparty/base/config/Icons.js +3 -11
- package/src/sap/ui/webc/common/thirdparty/base/config/Language.js +4 -14
- package/src/sap/ui/webc/common/thirdparty/base/config/NoConflict.js +4 -14
- package/src/sap/ui/webc/common/thirdparty/base/config/RTL.js +2 -8
- package/src/sap/ui/webc/common/thirdparty/base/config/Theme.js +4 -15
- package/src/sap/ui/webc/common/thirdparty/base/delegate/ItemNavigation.js +8 -72
- package/src/sap/ui/webc/common/thirdparty/base/delegate/ResizeHandler.js +8 -23
- package/src/sap/ui/webc/common/thirdparty/base/delegate/ScrollEnablement.js +9 -34
- package/src/sap/ui/webc/common/thirdparty/base/features/F6Navigation.js +1 -20
- package/src/sap/ui/webc/common/thirdparty/base/features/OpenUI5Enablement.js +0 -17
- package/src/sap/ui/webc/common/thirdparty/base/features/OpenUI5Support.js +0 -32
- package/src/sap/ui/webc/common/thirdparty/base/generated/VersionInfo.js +1 -1
- package/src/sap/ui/webc/common/thirdparty/base/getSharedResource.js +1 -9
- package/src/sap/ui/webc/common/thirdparty/base/i18nBundle.js +4 -18
- package/src/sap/ui/webc/common/thirdparty/base/locale/Locale.js +0 -25
- package/src/sap/ui/webc/common/thirdparty/base/locale/RTLAwareRegistry.js +0 -4
- package/src/sap/ui/webc/common/thirdparty/base/locale/applyDirection.js +0 -2
- package/src/sap/ui/webc/common/thirdparty/base/locale/directionChange.js +2 -9
- package/src/sap/ui/webc/common/thirdparty/base/locale/getEffectiveDir.js +4 -9
- package/src/sap/ui/webc/common/thirdparty/base/locale/getLocale.js +3 -11
- package/src/sap/ui/webc/common/thirdparty/base/locale/languageChange.js +0 -8
- package/src/sap/ui/webc/common/thirdparty/base/locale/nextFallbackLocale.js +4 -8
- package/src/sap/ui/webc/common/thirdparty/base/locale/normalizeLocale.js +8 -14
- package/src/sap/ui/webc/common/thirdparty/base/renderer/LitRenderer.js +0 -11
- package/src/sap/ui/webc/common/thirdparty/base/renderer/directives/style-map.js +7 -21
- package/src/sap/ui/webc/common/thirdparty/base/renderer/executeTemplate.js +1 -6
- package/src/sap/ui/webc/common/thirdparty/base/theming/CustomStyle.js +2 -16
- package/src/sap/ui/webc/common/thirdparty/base/theming/ThemeLoaded.js +0 -8
- package/src/sap/ui/webc/common/thirdparty/base/theming/applyTheme.js +6 -21
- package/src/sap/ui/webc/common/thirdparty/base/theming/getConstructableStyle.js +1 -6
- package/src/sap/ui/webc/common/thirdparty/base/theming/getEffectiveLinksHrefs.js +0 -7
- package/src/sap/ui/webc/common/thirdparty/base/theming/getEffectiveStyle.js +0 -8
- package/src/sap/ui/webc/common/thirdparty/base/theming/getStylesString.js +0 -4
- package/src/sap/ui/webc/common/thirdparty/base/theming/getThemeDesignerTheme.js +4 -22
- package/src/sap/ui/webc/common/thirdparty/base/theming/preloadLinks.js +0 -5
- package/src/sap/ui/webc/common/thirdparty/base/thirdparty/_merge.js +10 -20
- package/src/sap/ui/webc/common/thirdparty/base/thirdparty/isPlainObject.js +0 -6
- package/src/sap/ui/webc/common/thirdparty/base/thirdparty/merge.js +0 -3
- package/src/sap/ui/webc/common/thirdparty/base/types/CSSColor.js +0 -4
- package/src/sap/ui/webc/common/thirdparty/base/types/CSSSize.js +0 -4
- package/src/sap/ui/webc/common/thirdparty/base/types/CalendarType.js +0 -5
- package/src/sap/ui/webc/common/thirdparty/base/types/DataType.js +0 -8
- package/src/sap/ui/webc/common/thirdparty/base/types/Float.js +0 -5
- package/src/sap/ui/webc/common/thirdparty/base/types/Integer.js +0 -5
- package/src/sap/ui/webc/common/thirdparty/base/types/InvisibleMessageMode.js +0 -6
- package/src/sap/ui/webc/common/thirdparty/base/types/ItemNavigationBehavior.js +0 -2
- package/src/sap/ui/webc/common/thirdparty/base/types/PopupState.js +0 -8
- package/src/sap/ui/webc/common/thirdparty/base/types/ValueState.js +0 -5
- package/src/sap/ui/webc/common/thirdparty/base/updateShadowRoot.js +0 -5
- package/src/sap/ui/webc/common/thirdparty/base/util/AriaLabelHelper.js +1 -9
- package/src/sap/ui/webc/common/thirdparty/base/util/Caret.js +0 -6
- package/src/sap/ui/webc/common/thirdparty/base/util/ColorConversion.js +29 -46
- package/src/sap/ui/webc/common/thirdparty/base/util/FetchHelper.js +0 -10
- package/src/sap/ui/webc/common/thirdparty/base/util/FocusableElements.js +2 -19
- package/src/sap/ui/webc/common/thirdparty/base/util/InvisibleMessage.js +3 -9
- package/src/sap/ui/webc/common/thirdparty/base/util/PopupUtils.js +0 -28
- package/src/sap/ui/webc/common/thirdparty/base/util/SlotsHelper.js +4 -15
- package/src/sap/ui/webc/common/thirdparty/base/util/StringHelper.js +0 -7
- package/src/sap/ui/webc/common/thirdparty/base/util/TabbableElements.js +0 -12
- package/src/sap/ui/webc/common/thirdparty/base/util/arraysAreEqual.js +0 -4
- package/src/sap/ui/webc/common/thirdparty/base/util/clamp.js +0 -2
- package/src/sap/ui/webc/common/thirdparty/base/util/createLinkInHead.js +0 -2
- package/src/sap/ui/webc/common/thirdparty/base/util/createStyleInHead.js +0 -2
- package/src/sap/ui/webc/common/thirdparty/base/util/debounce.js +1 -3
- package/src/sap/ui/webc/common/thirdparty/base/util/detectNavigatorLanguage.js +0 -4
- package/src/sap/ui/webc/common/thirdparty/base/util/escapeRegex.js +0 -2
- package/src/sap/ui/webc/common/thirdparty/base/util/findNodeOwner.js +0 -6
- package/src/sap/ui/webc/common/thirdparty/base/util/formatMessage.js +2 -7
- package/src/sap/ui/webc/common/thirdparty/base/util/generateHighlightedMarkup.js +9 -17
- package/src/sap/ui/webc/common/thirdparty/base/util/getActiveElement.js +0 -4
- package/src/sap/ui/webc/common/thirdparty/base/util/getClassCopy.js +0 -3
- package/src/sap/ui/webc/common/thirdparty/base/util/getDesigntimePropertyAsArray.js +0 -2
- package/src/sap/ui/webc/common/thirdparty/base/util/getEffectiveContentDensity.js +0 -2
- package/src/sap/ui/webc/common/thirdparty/base/util/getFileExtension.js +0 -4
- package/src/sap/ui/webc/common/thirdparty/base/util/getNormalizedTarget.js +0 -4
- package/src/sap/ui/webc/common/thirdparty/base/util/getSingletonElementInstance.js +0 -4
- package/src/sap/ui/webc/common/thirdparty/base/util/isDefaultSlotProvided.js +0 -2
- package/src/sap/ui/webc/common/thirdparty/base/util/isDescendantOf.js +0 -6
- package/src/sap/ui/webc/common/thirdparty/base/util/isElementInView.js +0 -2
- package/src/sap/ui/webc/common/thirdparty/base/util/isNodeClickable.js +0 -5
- package/src/sap/ui/webc/common/thirdparty/base/util/isNodeHidden.js +0 -3
- package/src/sap/ui/webc/common/thirdparty/base/util/isNodeTabbable.js +0 -9
- package/src/sap/ui/webc/common/thirdparty/base/util/isValidPropertyName.js +1 -3
- package/src/sap/ui/webc/common/thirdparty/base/util/setToArray.js +0 -2
- package/src/sap/ui/webc/common/thirdparty/base/util/whenDOMReady.js +0 -2
- package/src/sap/ui/webc/common/thirdparty/icons/generated/json-imports/i18n.js +0 -52
- package/src/sap/ui/webc/common/thirdparty/icons/json-imports/Icons.js +0 -5
- package/src/sap/ui/webc/common/thirdparty/icons-business-suite/json-imports/Icons.js +0 -3
- package/src/sap/ui/webc/common/thirdparty/icons-tnt/json-imports/Icons.js +0 -3
- package/src/sap/ui/webc/common/thirdparty/lit-html/directive-helpers.js +62 -70
- package/src/sap/ui/webc/common/thirdparty/lit-html/directive.js +11 -20
- package/src/sap/ui/webc/common/thirdparty/lit-html/directives/class-map.js +0 -10
- package/src/sap/ui/webc/common/thirdparty/lit-html/directives/if-defined.js +0 -2
- package/src/sap/ui/webc/common/thirdparty/lit-html/directives/repeat.js +55 -71
- package/src/sap/ui/webc/common/thirdparty/lit-html/directives/unsafe-html.js +0 -4
- package/src/sap/ui/webc/common/thirdparty/lit-html/lit-html.js +96 -171
- package/src/sap/ui/webc/common/thirdparty/lit-html/static.js +34 -40
- package/src/sap/ui/webc/common/thirdparty/localization/DateFormat.js +0 -2
- package/src/sap/ui/webc/common/thirdparty/localization/LocaleData.js +0 -2
- package/src/sap/ui/webc/common/thirdparty/localization/dates/CalendarDate.js +13 -56
- package/src/sap/ui/webc/common/thirdparty/localization/dates/ExtremeDates.js +0 -11
- package/src/sap/ui/webc/common/thirdparty/localization/dates/calculateWeekNumber.js +5 -8
- package/src/sap/ui/webc/common/thirdparty/localization/dates/getRoundedTimestamp.js +0 -3
- package/src/sap/ui/webc/common/thirdparty/localization/dates/getTodayUTCTimestamp.js +0 -3
- package/src/sap/ui/webc/common/thirdparty/localization/dates/modifyDateBy.js +0 -9
- package/src/sap/ui/webc/common/thirdparty/localization/getCachedLocaleDataInstance.js +0 -5
- package/src/sap/ui/webc/common/thirdparty/localization/locale/getLocaleData.js +1 -6
- package/src/sap/ui/webc/common/thirdparty/theming/generated/json-imports/Themes.js +0 -16
- package/ui5.yaml +7 -7
- package/src/sap/ui/webc/common/thirdparty/icons-business-suite/main-milestone.js +0 -25
- package/src/sap/ui/webc/common/thirdparty/icons-business-suite/main-sequence.js +0 -25
@@ -7,42 +7,33 @@ sap.ui.define(["exports", "../getSharedResource", "../assets-meta/IconCollection
|
|
7
7
|
_exports.registerIconLoader = _exports.registerIconBundle = _exports.registerIcon = _exports.getIconDataSync = _exports.getIconData = _exports._getRegisteredNames = void 0;
|
8
8
|
_getSharedResource = _interopRequireDefault(_getSharedResource);
|
9
9
|
_IconCollectionsAlias = _interopRequireDefault(_IconCollectionsAlias);
|
10
|
-
|
11
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
|
-
|
13
11
|
const loaders = new Map();
|
14
12
|
const registry = (0, _getSharedResource.default)("SVGIcons.registry", new Map());
|
15
13
|
const iconCollectionPromises = (0, _getSharedResource.default)("SVGIcons.promises", new Map());
|
16
14
|
const ICON_NOT_FOUND = "ICON_NOT_FOUND";
|
15
|
+
|
17
16
|
/**
|
18
17
|
* @deprecated
|
19
18
|
*/
|
20
|
-
|
21
19
|
const registerIconBundle = async (collectionName, bundleData) => {
|
22
20
|
throw new Error("This method has been removed. Use `registerIconLoader` instead.");
|
23
21
|
};
|
24
|
-
|
25
22
|
_exports.registerIconBundle = registerIconBundle;
|
26
|
-
|
27
23
|
const registerIconLoader = async (collectionName, loader) => {
|
28
24
|
loaders.set(collectionName, loader);
|
29
25
|
};
|
30
|
-
|
31
26
|
_exports.registerIconLoader = registerIconLoader;
|
32
|
-
|
33
27
|
const _loadIconCollectionOnce = async collectionName => {
|
34
28
|
if (!iconCollectionPromises.has(collectionName)) {
|
35
29
|
if (!loaders.has(collectionName)) {
|
36
30
|
throw new Error(`No loader registered for the ${collectionName} icons collection. Probably you forgot to import the "AllIcons.js" module for the respective package.`);
|
37
31
|
}
|
38
|
-
|
39
32
|
const loadIcons = loaders.get(collectionName);
|
40
33
|
iconCollectionPromises.set(collectionName, loadIcons(collectionName));
|
41
34
|
}
|
42
|
-
|
43
35
|
return iconCollectionPromises.get(collectionName);
|
44
36
|
};
|
45
|
-
|
46
37
|
const _fillRegistry = bundleData => {
|
47
38
|
Object.keys(bundleData.data).forEach(iconName => {
|
48
39
|
const iconData = bundleData.data[iconName];
|
@@ -54,9 +45,9 @@ sap.ui.define(["exports", "../getSharedResource", "../assets-meta/IconCollection
|
|
54
45
|
packageName: bundleData.packageName
|
55
46
|
});
|
56
47
|
});
|
57
|
-
};
|
58
|
-
|
48
|
+
};
|
59
49
|
|
50
|
+
// set
|
60
51
|
const registerIcon = (name, {
|
61
52
|
pathData,
|
62
53
|
ltr,
|
@@ -68,7 +59,6 @@ sap.ui.define(["exports", "../getSharedResource", "../assets-meta/IconCollection
|
|
68
59
|
if (!collection) {
|
69
60
|
collection = (0, _Icons.getEffectiveDefaultIconCollection)();
|
70
61
|
}
|
71
|
-
|
72
62
|
const key = `${collection}/${name}`;
|
73
63
|
registry.set(key, {
|
74
64
|
pathData,
|
@@ -77,23 +67,21 @@ sap.ui.define(["exports", "../getSharedResource", "../assets-meta/IconCollection
|
|
77
67
|
packageName
|
78
68
|
});
|
79
69
|
};
|
80
|
-
|
81
70
|
_exports.registerIcon = registerIcon;
|
82
|
-
|
83
71
|
const _parseName = name => {
|
84
72
|
// silently support ui5-compatible URIs
|
85
73
|
if (name.startsWith("sap-icon://")) {
|
86
74
|
name = name.replace("sap-icon://", "");
|
87
75
|
}
|
88
|
-
|
89
76
|
let collection;
|
90
77
|
[name, collection] = name.split("/").reverse();
|
91
|
-
collection = collection || (0, _Icons.getEffectiveDefaultIconCollection)();
|
78
|
+
collection = collection || (0, _Icons.getEffectiveDefaultIconCollection)();
|
79
|
+
|
80
|
+
// Normalize collection name.
|
92
81
|
// - resolve `SAP-icons-TNT` to `tnt`.
|
93
82
|
// - resolve `BusinessSuiteInAppSymbols` to `business-suite`.
|
94
83
|
// - resolve `horizon` to `SAP-icons-v5`,
|
95
84
|
// Note: aliases can be made as a feature, if more collections need it or more aliases are needed.
|
96
|
-
|
97
85
|
collection = _normalizeCollection(collection);
|
98
86
|
name = name.replace("icon-", "");
|
99
87
|
const registryKey = `${collection}/${name}`;
|
@@ -103,47 +91,37 @@ sap.ui.define(["exports", "../getSharedResource", "../assets-meta/IconCollection
|
|
103
91
|
registryKey
|
104
92
|
};
|
105
93
|
};
|
106
|
-
|
107
94
|
const getIconDataSync = nameProp => {
|
108
95
|
const {
|
109
96
|
registryKey
|
110
97
|
} = _parseName(nameProp);
|
111
|
-
|
112
98
|
return registry.get(registryKey);
|
113
99
|
};
|
114
|
-
|
115
100
|
_exports.getIconDataSync = getIconDataSync;
|
116
|
-
|
117
101
|
const getIconData = async nameProp => {
|
118
102
|
const {
|
119
103
|
collection,
|
120
104
|
registryKey
|
121
105
|
} = _parseName(nameProp);
|
122
|
-
|
123
106
|
let iconData = ICON_NOT_FOUND;
|
124
|
-
|
125
107
|
try {
|
126
108
|
iconData = await _loadIconCollectionOnce(collection);
|
127
109
|
} catch (e) {
|
128
|
-
console.error(e.message);
|
129
|
-
/* eslint-disable-line */
|
110
|
+
console.error(e.message); /* eslint-disable-line */
|
130
111
|
}
|
131
112
|
|
132
113
|
if (iconData === ICON_NOT_FOUND) {
|
133
114
|
return iconData;
|
134
115
|
}
|
135
|
-
|
136
116
|
if (!registry.has(registryKey)) {
|
137
117
|
// not filled by another await. many getters will await on the same loader, but fill only once
|
138
118
|
_fillRegistry(iconData);
|
139
119
|
}
|
140
|
-
|
141
120
|
return registry.get(registryKey);
|
142
|
-
};
|
143
|
-
|
121
|
+
};
|
144
122
|
|
123
|
+
// test page usage only
|
145
124
|
_exports.getIconData = getIconData;
|
146
|
-
|
147
125
|
const _getRegisteredNames = async () => {
|
148
126
|
// fetch one icon of each collection to trigger the bundle load
|
149
127
|
await getIconData("edit");
|
@@ -151,14 +129,11 @@ sap.ui.define(["exports", "../getSharedResource", "../assets-meta/IconCollection
|
|
151
129
|
await getIconData("business-suite/3d");
|
152
130
|
return Array.from(registry.keys());
|
153
131
|
};
|
154
|
-
|
155
132
|
_exports._getRegisteredNames = _getRegisteredNames;
|
156
|
-
|
157
133
|
const _normalizeCollection = collectionName => {
|
158
134
|
if (_IconCollectionsAlias.default[collectionName]) {
|
159
135
|
return _IconCollectionsAlias.default[collectionName];
|
160
136
|
}
|
161
|
-
|
162
137
|
return collectionName;
|
163
138
|
};
|
164
139
|
});
|
@@ -6,12 +6,9 @@ sap.ui.define(["exports", "../getSharedResource"], function (_exports, _getShare
|
|
6
6
|
});
|
7
7
|
_exports.registerIllustration = _exports.getIllustrationDataSync = void 0;
|
8
8
|
_getSharedResource = _interopRequireDefault(_getSharedResource);
|
9
|
-
|
10
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
-
|
12
10
|
const registry = (0, _getSharedResource.default)("SVGIllustration.registry", new Map());
|
13
11
|
const ILLUSTRATION_NOT_FOUND = "ILLUSTRATION_NOT_FOUND";
|
14
|
-
|
15
12
|
const registerIllustration = (name, {
|
16
13
|
dialogSvg,
|
17
14
|
sceneSvg,
|
@@ -29,19 +26,14 @@ sap.ui.define(["exports", "../getSharedResource"], function (_exports, _getShare
|
|
29
26
|
subtitle
|
30
27
|
});
|
31
28
|
};
|
32
|
-
|
33
29
|
_exports.registerIllustration = registerIllustration;
|
34
|
-
|
35
30
|
const getIllustrationDataSync = nameProp => {
|
36
31
|
let set = "fiori";
|
37
|
-
|
38
32
|
if (nameProp.startsWith("Tnt")) {
|
39
33
|
set = "tnt";
|
40
34
|
nameProp = nameProp.replace(/^Tnt/, "");
|
41
35
|
}
|
42
|
-
|
43
36
|
return registry.get(`${set}/${nameProp}`) || ILLUSTRATION_NOT_FOUND;
|
44
37
|
};
|
45
|
-
|
46
38
|
_exports.getIllustrationDataSync = getIllustrationDataSync;
|
47
39
|
});
|
@@ -6,9 +6,7 @@ sap.ui.define(["exports", "../locale/languageChange", "../locale/getLocale", "..
|
|
6
6
|
});
|
7
7
|
_exports.registerLocaleDataLoader = _exports.getLocaleData = _exports.fetchCldr = void 0;
|
8
8
|
_getLocale = _interopRequireDefault(_getLocale);
|
9
|
-
|
10
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
-
|
12
10
|
const localeDataMap = new Map();
|
13
11
|
const loaders = new Map();
|
14
12
|
const cldrPromises = new Map();
|
@@ -20,156 +18,137 @@ sap.ui.define(["exports", "../locale/languageChange", "../locale/getLocale", "..
|
|
20
18
|
"in": "id"
|
21
19
|
};
|
22
20
|
const DEV_MODE = false;
|
23
|
-
|
24
21
|
const _showAssetsWarningOnce = localeId => {
|
25
22
|
if (warningShown) {
|
26
23
|
return;
|
27
24
|
}
|
28
|
-
|
29
25
|
if (!DEV_MODE) {
|
30
|
-
console.warn(`[LocaleData] Supported locale "${localeId}" not configured, import the "Assets.js" module from the webcomponents package you are using.`);
|
31
|
-
/* eslint-disable-line */
|
26
|
+
console.warn(`[LocaleData] Supported locale "${localeId}" not configured, import the "Assets.js" module from the webcomponents package you are using.`); /* eslint-disable-line */
|
32
27
|
} else {
|
33
|
-
console.warn(`[LocaleData] Note: in dev mode, CLDR assets might be disabled for performance reasons. Try running "ENABLE_CLDR=1 yarn start" to test CLDR assets.`);
|
34
|
-
/* eslint-disable-line */
|
28
|
+
console.warn(`[LocaleData] Note: in dev mode, CLDR assets might be disabled for performance reasons. Try running "ENABLE_CLDR=1 yarn start" to test CLDR assets.`); /* eslint-disable-line */
|
35
29
|
}
|
36
30
|
|
37
31
|
warningShown = true;
|
38
32
|
};
|
39
|
-
|
40
33
|
const calcLocale = (language, region, script) => {
|
41
34
|
// normalize language and handle special cases
|
42
|
-
language = language && M_ISO639_OLD_TO_NEW[language] || language;
|
43
|
-
|
35
|
+
language = language && M_ISO639_OLD_TO_NEW[language] || language;
|
36
|
+
// Special case 1: in an SAP context, the inclusive language code "no" always means Norwegian Bokmal ("nb")
|
44
37
|
if (language === "no") {
|
45
38
|
language = "nb";
|
46
|
-
}
|
47
|
-
|
48
|
-
|
39
|
+
}
|
40
|
+
// Special case 2: for Chinese, derive a default region from the script (this behavior is inherited from Java)
|
49
41
|
if (language === "zh" && !region) {
|
50
42
|
if (script === "Hans") {
|
51
43
|
region = "CN";
|
52
44
|
} else if (script === "Hant") {
|
53
45
|
region = "TW";
|
54
46
|
}
|
55
|
-
}
|
56
|
-
|
47
|
+
}
|
57
48
|
|
49
|
+
// Special case 3: for Serbian, there are cyrillic and latin scripts, "sh" and "sr-latn" map to "latin", "sr" maps to cyrillic.
|
58
50
|
if (language === "sh" || language === "sr" && script === "Latn") {
|
59
51
|
language = "sr";
|
60
52
|
region = "Latn";
|
61
|
-
}
|
62
|
-
|
53
|
+
}
|
63
54
|
|
55
|
+
// try language + region
|
64
56
|
let localeId = `${language}_${region}`;
|
65
|
-
|
66
57
|
if (_AssetParameters.SUPPORTED_LOCALES.includes(localeId)) {
|
67
58
|
if (loaders.has(localeId)) {
|
68
59
|
// supported and has loader
|
69
60
|
return localeId;
|
70
|
-
}
|
71
|
-
|
61
|
+
}
|
72
62
|
|
63
|
+
// supported, no loader - fallback to default and warn
|
73
64
|
_showAssetsWarningOnce(localeId);
|
74
|
-
|
75
65
|
return _AssetParameters.DEFAULT_LOCALE;
|
76
|
-
}
|
77
|
-
|
66
|
+
}
|
78
67
|
|
68
|
+
// not supported, try language only
|
79
69
|
localeId = language;
|
80
|
-
|
81
70
|
if (_AssetParameters.SUPPORTED_LOCALES.includes(localeId)) {
|
82
71
|
if (loaders.has(localeId)) {
|
83
72
|
// supported and has loader
|
84
73
|
return localeId;
|
85
|
-
}
|
86
|
-
|
74
|
+
}
|
87
75
|
|
76
|
+
// supported, no loader - fallback to default and warn
|
88
77
|
_showAssetsWarningOnce(localeId);
|
89
|
-
|
90
78
|
return _AssetParameters.DEFAULT_LOCALE;
|
91
|
-
}
|
92
|
-
|
79
|
+
}
|
93
80
|
|
81
|
+
// not supported - fallback to default locale
|
94
82
|
return _AssetParameters.DEFAULT_LOCALE;
|
95
|
-
};
|
96
|
-
|
83
|
+
};
|
97
84
|
|
85
|
+
// internal set data
|
98
86
|
const setLocaleData = (localeId, content) => {
|
99
87
|
localeDataMap.set(localeId, content);
|
100
|
-
};
|
101
|
-
|
88
|
+
};
|
102
89
|
|
90
|
+
// external getSync
|
103
91
|
const getLocaleData = localeId => {
|
104
92
|
// if there is no loader, the default fallback was fetched and a warning was given - use default locale instead
|
105
93
|
if (!loaders.has(localeId)) {
|
106
94
|
localeId = _AssetParameters.DEFAULT_LOCALE;
|
107
95
|
}
|
108
|
-
|
109
96
|
const content = localeDataMap.get(localeId);
|
110
|
-
|
111
97
|
if (!content) {
|
112
98
|
throw new Error(`CLDR data for locale ${localeId} is not loaded!`);
|
113
99
|
}
|
114
|
-
|
115
100
|
return content;
|
116
|
-
};
|
117
|
-
|
101
|
+
};
|
118
102
|
|
103
|
+
// load bundle over the network once
|
119
104
|
_exports.getLocaleData = getLocaleData;
|
120
|
-
|
121
105
|
const _loadCldrOnce = localeId => {
|
122
106
|
const loadCldr = loaders.get(localeId);
|
123
|
-
|
124
107
|
if (!cldrPromises.get(localeId)) {
|
125
108
|
cldrPromises.set(localeId, loadCldr(localeId));
|
126
109
|
}
|
127
|
-
|
128
110
|
return cldrPromises.get(localeId);
|
129
|
-
};
|
130
|
-
|
111
|
+
};
|
131
112
|
|
113
|
+
// external getAsync
|
132
114
|
const fetchCldr = async (language, region, script) => {
|
133
|
-
const localeId = calcLocale(language, region, script);
|
115
|
+
const localeId = calcLocale(language, region, script);
|
134
116
|
|
117
|
+
// reuse OpenUI5 CLDR if present
|
135
118
|
const OpenUI5Support = (0, _FeaturesRegistry.getFeature)("OpenUI5Support");
|
136
|
-
|
137
119
|
if (OpenUI5Support) {
|
138
120
|
const cldrContent = OpenUI5Support.getLocaleDataObject();
|
139
|
-
|
140
121
|
if (cldrContent) {
|
141
122
|
// only if openui5 actually returned valid content
|
142
123
|
setLocaleData(localeId, cldrContent);
|
143
124
|
return;
|
144
125
|
}
|
145
|
-
}
|
146
|
-
|
126
|
+
}
|
147
127
|
|
128
|
+
// fetch it
|
148
129
|
try {
|
149
130
|
const cldrContent = await _loadCldrOnce(localeId);
|
150
131
|
setLocaleData(localeId, cldrContent);
|
151
132
|
} catch (e) {
|
152
133
|
if (!reportedErrors.has(e.message)) {
|
153
134
|
reportedErrors.add(e.message);
|
154
|
-
console.error(e.message);
|
155
|
-
/* eslint-disable-line */
|
135
|
+
console.error(e.message); /* eslint-disable-line */
|
156
136
|
}
|
157
137
|
}
|
158
138
|
};
|
159
|
-
|
160
139
|
_exports.fetchCldr = fetchCldr;
|
161
|
-
|
162
140
|
const registerLocaleDataLoader = (localeId, loader) => {
|
163
141
|
loaders.set(localeId, loader);
|
164
|
-
};
|
165
|
-
|
142
|
+
};
|
166
143
|
|
144
|
+
// register default loader for "en" from ui5 CDN (dev workflow without assets)
|
167
145
|
_exports.registerLocaleDataLoader = registerLocaleDataLoader;
|
168
146
|
registerLocaleDataLoader("en", async runtimeLocaleId => {
|
169
147
|
return (await fetch(`https://ui5.sap.com/1.103.0/resources/sap/ui/core/cldr/en.json`)).json();
|
170
|
-
});
|
171
|
-
// re-fetch the required CDRD data.
|
148
|
+
});
|
172
149
|
|
150
|
+
// When the language changes dynamically (the user calls setLanguage),
|
151
|
+
// re-fetch the required CDRD data.
|
173
152
|
(0, _languageChange.attachLanguageChange)(() => {
|
174
153
|
const locale = (0, _getLocale.default)();
|
175
154
|
return fetchCldr(locale.getLanguage(), locale.getRegion(), locale.getScript());
|
@@ -9,6 +9,7 @@ sap.ui.define(["exports", "../generated/AssetParameters"], function (_exports, _
|
|
9
9
|
const loaders = new Map();
|
10
10
|
const registeredPackages = new Set();
|
11
11
|
const registeredThemes = new Set();
|
12
|
+
|
12
13
|
/**
|
13
14
|
* Used to provide CSS Vars for a specific theme for a specific package.
|
14
15
|
* The CSS Vars can be passed directly as a string (containing them), as an object with a "_" property(containing them in the "_" property), or as a URL.
|
@@ -24,78 +25,54 @@ sap.ui.define(["exports", "../generated/AssetParameters"], function (_exports, _
|
|
24
25
|
* @param style - the style content directly
|
25
26
|
* @deprecated
|
26
27
|
*/
|
27
|
-
|
28
28
|
const registerThemeProperties = (_packageName, _themeName, _style) => {
|
29
29
|
throw new Error("`registerThemeProperties` has been depracated. Use `registerThemePropertiesLoader` instead.");
|
30
30
|
};
|
31
|
-
|
32
31
|
_exports.registerThemeProperties = registerThemeProperties;
|
33
|
-
|
34
32
|
const registerThemePropertiesLoader = (packageName, themeName, loader) => {
|
35
33
|
loaders.set(`${packageName}/${themeName}`, loader);
|
36
34
|
registeredPackages.add(packageName);
|
37
35
|
registeredThemes.add(themeName);
|
38
36
|
};
|
39
|
-
|
40
37
|
_exports.registerThemePropertiesLoader = registerThemePropertiesLoader;
|
41
|
-
|
42
38
|
const getThemeProperties = async (packageName, themeName) => {
|
43
39
|
const style = themeStyles.get(`${packageName}_${themeName}`);
|
44
|
-
|
45
40
|
if (style !== undefined) {
|
46
41
|
// it's valid for style to be an empty string
|
47
42
|
return style;
|
48
43
|
}
|
49
|
-
|
50
44
|
if (!registeredThemes.has(themeName)) {
|
51
45
|
const regThemesStr = [...registeredThemes.values()].join(", ");
|
52
|
-
console.warn(`You have requested a non-registered theme ${themeName} - falling back to ${_AssetParameters.DEFAULT_THEME}. Registered themes are: ${regThemesStr}`);
|
53
|
-
/* eslint-disable-line */
|
54
|
-
|
46
|
+
console.warn(`You have requested a non-registered theme ${themeName} - falling back to ${_AssetParameters.DEFAULT_THEME}. Registered themes are: ${regThemesStr}`); /* eslint-disable-line */
|
55
47
|
return _getThemeProperties(packageName, _AssetParameters.DEFAULT_THEME);
|
56
48
|
}
|
57
|
-
|
58
49
|
return _getThemeProperties(packageName, themeName);
|
59
50
|
};
|
60
|
-
|
61
51
|
_exports.getThemeProperties = getThemeProperties;
|
62
|
-
|
63
52
|
const _getThemeProperties = async (packageName, themeName) => {
|
64
53
|
const loader = loaders.get(`${packageName}/${themeName}`);
|
65
|
-
|
66
54
|
if (!loader) {
|
67
55
|
// no themes for package
|
68
|
-
console.error(`Theme [${themeName}] not registered for package [${packageName}]`);
|
69
|
-
/* eslint-disable-line */
|
70
|
-
|
56
|
+
console.error(`Theme [${themeName}] not registered for package [${packageName}]`); /* eslint-disable-line */
|
71
57
|
return;
|
72
58
|
}
|
73
|
-
|
74
59
|
let data;
|
75
|
-
|
76
60
|
try {
|
77
61
|
data = await loader(themeName);
|
78
62
|
} catch (e) {
|
79
|
-
console.error(packageName, e.message);
|
80
|
-
/* eslint-disable-line */
|
81
|
-
|
63
|
+
console.error(packageName, e.message); /* eslint-disable-line */
|
82
64
|
return;
|
83
65
|
}
|
84
|
-
|
85
66
|
const themeProps = data._ || data;
|
86
67
|
themeStyles.set(`${packageName}_${themeName}`, themeProps);
|
87
68
|
return themeProps;
|
88
69
|
};
|
89
|
-
|
90
70
|
const getRegisteredPackages = () => {
|
91
71
|
return registeredPackages;
|
92
72
|
};
|
93
|
-
|
94
73
|
_exports.getRegisteredPackages = getRegisteredPackages;
|
95
|
-
|
96
74
|
const isThemeRegistered = theme => {
|
97
75
|
return registeredThemes.has(theme);
|
98
76
|
};
|
99
|
-
|
100
77
|
_exports.isThemeRegistered = isThemeRegistered;
|
101
78
|
});
|
@@ -8,15 +8,14 @@ sap.ui.define(["exports", "../locale/getLocale", "../locale/languageChange", "..
|
|
8
8
|
_getLocale = _interopRequireDefault(_getLocale);
|
9
9
|
_normalizeLocale = _interopRequireDefault(_normalizeLocale);
|
10
10
|
_nextFallbackLocale = _interopRequireDefault(_nextFallbackLocale);
|
11
|
-
|
12
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
-
|
14
12
|
// contains package names for which the warning has been shown
|
15
13
|
const warningShown = new Set();
|
16
14
|
const reportedErrors = new Set();
|
17
15
|
const bundleData = new Map();
|
18
16
|
const bundlePromises = new Map();
|
19
17
|
const loaders = new Map();
|
18
|
+
|
20
19
|
/**
|
21
20
|
* Registers i18n loader function for given package and locale.
|
22
21
|
*
|
@@ -25,63 +24,50 @@ sap.ui.define(["exports", "../locale/getLocale", "../locale/languageChange", "..
|
|
25
24
|
* @param {string} localeId locale that this loader can handle
|
26
25
|
* @param {function} loader async function that will be passed a localeId and should return a JSON object
|
27
26
|
*/
|
28
|
-
|
29
27
|
const registerI18nLoader = (packageName, localeId, loader) => {
|
30
28
|
// register loader by key
|
31
29
|
const bundleKey = `${packageName}/${localeId}`;
|
32
30
|
loaders.set(bundleKey, loader);
|
33
31
|
};
|
34
|
-
|
35
32
|
_exports.registerI18nLoader = registerI18nLoader;
|
36
|
-
|
37
33
|
const _setI18nBundleData = (packageName, data) => {
|
38
34
|
bundleData.set(packageName, data);
|
39
35
|
};
|
40
|
-
|
41
36
|
const getI18nBundleData = packageName => {
|
42
37
|
return bundleData.get(packageName);
|
43
38
|
};
|
39
|
+
|
44
40
|
/**
|
45
41
|
* @public
|
46
42
|
* @deprecated
|
47
43
|
*/
|
48
|
-
|
49
|
-
|
50
44
|
_exports.getI18nBundleData = getI18nBundleData;
|
51
|
-
|
52
45
|
const registerI18nBundle = (_packageName, _bundle) => {
|
53
46
|
throw new Error("This method has been removed. Use `registerI18nLoader` instead.");
|
54
47
|
};
|
55
|
-
|
56
48
|
_exports.registerI18nBundle = registerI18nBundle;
|
57
|
-
|
58
49
|
const _hasLoader = (packageName, localeId) => {
|
59
50
|
const bundleKey = `${packageName}/${localeId}`;
|
60
51
|
return loaders.has(bundleKey);
|
61
|
-
};
|
62
|
-
|
52
|
+
};
|
63
53
|
|
54
|
+
// load bundle over the network once
|
64
55
|
const _loadMessageBundleOnce = (packageName, localeId) => {
|
65
56
|
const bundleKey = `${packageName}/${localeId}`;
|
66
57
|
const loadMessageBundle = loaders.get(bundleKey);
|
67
|
-
|
68
58
|
if (!bundlePromises.get(bundleKey)) {
|
69
59
|
bundlePromises.set(bundleKey, loadMessageBundle(localeId));
|
70
60
|
}
|
71
|
-
|
72
61
|
return bundlePromises.get(bundleKey);
|
73
62
|
};
|
74
|
-
|
75
63
|
const _showAssetsWarningOnce = packageName => {
|
76
64
|
if (!warningShown.has(packageName)) {
|
77
|
-
console.warn(`[${packageName}]: Message bundle assets are not configured. Falling back to English texts.`,
|
78
|
-
/* eslint-disable-line */
|
79
|
-
` Add \`import "${packageName}/dist/Assets.js"\` in your bundle and make sure your build tool supports dynamic imports and JSON imports. See section "Assets" in the documentation for more information.`);
|
80
|
-
/* eslint-disable-line */
|
81
|
-
|
65
|
+
console.warn(`[${packageName}]: Message bundle assets are not configured. Falling back to English texts.`, /* eslint-disable-line */
|
66
|
+
` Add \`import "${packageName}/dist/Assets.js"\` in your bundle and make sure your build tool supports dynamic imports and JSON imports. See section "Assets" in the documentation for more information.`); /* eslint-disable-line */
|
82
67
|
warningShown.add(packageName);
|
83
68
|
}
|
84
69
|
};
|
70
|
+
|
85
71
|
/**
|
86
72
|
* This method preforms the asynchronous task of fetching the actual text resources. It will fetch
|
87
73
|
* each text resource over the network once (even for multiple calls to the same method).
|
@@ -91,47 +77,36 @@ sap.ui.define(["exports", "../locale/getLocale", "../locale/languageChange", "..
|
|
91
77
|
* @param {packageName} packageName the NPM package name
|
92
78
|
* @public
|
93
79
|
*/
|
94
|
-
|
95
|
-
|
96
80
|
const fetchI18nBundle = async packageName => {
|
97
81
|
const language = (0, _getLocale.default)().getLanguage();
|
98
82
|
const region = (0, _getLocale.default)().getRegion();
|
99
83
|
let localeId = (0, _normalizeLocale.default)(language + (region ? `-${region}` : ``));
|
100
|
-
|
101
84
|
while (localeId !== _AssetParameters.DEFAULT_LANGUAGE && !_hasLoader(packageName, localeId)) {
|
102
85
|
localeId = (0, _nextFallbackLocale.default)(localeId);
|
103
|
-
}
|
104
|
-
|
86
|
+
}
|
105
87
|
|
88
|
+
// use default language unless configured to always fetch it from the network
|
106
89
|
const fetchDefaultLanguage = (0, _Language.getFetchDefaultLanguage)();
|
107
|
-
|
108
90
|
if (localeId === _AssetParameters.DEFAULT_LANGUAGE && !fetchDefaultLanguage) {
|
109
91
|
_setI18nBundleData(packageName, null); // reset for the default language (if data was set for a previous language)
|
110
|
-
|
111
|
-
|
112
92
|
return;
|
113
93
|
}
|
114
|
-
|
115
94
|
if (!_hasLoader(packageName, localeId)) {
|
116
95
|
_showAssetsWarningOnce(packageName);
|
117
|
-
|
118
96
|
return;
|
119
97
|
}
|
120
|
-
|
121
98
|
try {
|
122
99
|
const data = await _loadMessageBundleOnce(packageName, localeId);
|
123
|
-
|
124
100
|
_setI18nBundleData(packageName, data);
|
125
101
|
} catch (e) {
|
126
102
|
if (!reportedErrors.has(e.message)) {
|
127
103
|
reportedErrors.add(e.message);
|
128
|
-
console.error(e.message);
|
129
|
-
/* eslint-disable-line */
|
104
|
+
console.error(e.message); /* eslint-disable-line */
|
130
105
|
}
|
131
106
|
}
|
132
|
-
};
|
133
|
-
|
107
|
+
};
|
134
108
|
|
109
|
+
// When the language changes dynamically (the user calls setLanguage), re-fetch all previously fetched bundles
|
135
110
|
_exports.fetchI18nBundle = fetchI18nBundle;
|
136
111
|
(0, _languageChange.attachLanguageChange)(() => {
|
137
112
|
const allPackages = [...bundleData.keys()];
|
@@ -6,26 +6,19 @@ sap.ui.define(["exports", "../InitialConfiguration", "../types/AnimationMode"],
|
|
6
6
|
});
|
7
7
|
_exports.setAnimationMode = _exports.getAnimationMode = void 0;
|
8
8
|
_AnimationMode = _interopRequireDefault(_AnimationMode);
|
9
|
-
|
10
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
-
|
12
10
|
let animationMode;
|
13
|
-
|
14
11
|
const getAnimationMode = () => {
|
15
12
|
if (animationMode === undefined) {
|
16
13
|
animationMode = (0, _InitialConfiguration.getAnimationMode)();
|
17
14
|
}
|
18
|
-
|
19
15
|
return animationMode;
|
20
16
|
};
|
21
|
-
|
22
17
|
_exports.getAnimationMode = getAnimationMode;
|
23
|
-
|
24
18
|
const setAnimationMode = newAnimationMode => {
|
25
19
|
if (Object.values(_AnimationMode.default).includes(newAnimationMode)) {
|
26
20
|
animationMode = newAnimationMode;
|
27
21
|
}
|
28
22
|
};
|
29
|
-
|
30
23
|
_exports.setAnimationMode = setAnimationMode;
|
31
24
|
});
|
@@ -6,23 +6,18 @@ sap.ui.define(["exports", "../types/CalendarType", "../InitialConfiguration"], f
|
|
6
6
|
});
|
7
7
|
_exports.getCalendarType = void 0;
|
8
8
|
_CalendarType = _interopRequireDefault(_CalendarType);
|
9
|
-
|
10
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
-
|
12
10
|
let calendarType;
|
13
|
-
|
14
11
|
const getCalendarType = () => {
|
15
12
|
if (calendarType === undefined) {
|
16
13
|
calendarType = (0, _InitialConfiguration.getCalendarType)();
|
17
14
|
}
|
18
|
-
|
19
15
|
if (_CalendarType.default.isValid(calendarType)) {
|
20
16
|
return calendarType;
|
21
17
|
}
|
22
|
-
|
23
18
|
return _CalendarType.default.Gregorian;
|
24
|
-
};
|
25
|
-
|
19
|
+
};
|
26
20
|
|
21
|
+
// eslint-disable-line
|
27
22
|
_exports.getCalendarType = getCalendarType;
|
28
23
|
});
|