@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
@@ -6,15 +6,13 @@ sap.ui.define(["exports", "../InitialConfiguration"], function (_exports, _Initi
|
|
6
6
|
});
|
7
7
|
_exports.getFirstDayOfWeek = void 0;
|
8
8
|
let formatSettings;
|
9
|
-
|
10
9
|
const getFirstDayOfWeek = () => {
|
11
10
|
if (formatSettings === undefined) {
|
12
11
|
formatSettings = (0, _InitialConfiguration.getFormatSettings)();
|
13
12
|
}
|
14
|
-
|
15
13
|
return formatSettings.firstDayOfWeek;
|
16
|
-
};
|
17
|
-
|
14
|
+
};
|
18
15
|
|
16
|
+
// eslint-disable-line
|
19
17
|
_exports.getFirstDayOfWeek = getFirstDayOfWeek;
|
20
18
|
});
|
@@ -6,6 +6,7 @@ sap.ui.define(["exports", "./Theme"], function (_exports, _Theme) {
|
|
6
6
|
});
|
7
7
|
_exports.setDefaultIconCollection = _exports.getEffectiveDefaultIconCollection = _exports.getDefaultIconCollection = void 0;
|
8
8
|
const IconCollectionConfiguration = new Map();
|
9
|
+
|
9
10
|
/**
|
10
11
|
* Sets the default icon collection (v4 or v5) per theme,
|
11
12
|
* which will be applied in case icon collection is not specified.
|
@@ -14,14 +15,13 @@ sap.ui.define(["exports", "./Theme"], function (_exports, _Theme) {
|
|
14
15
|
* @param {String} theme
|
15
16
|
* @param {String} collectionName
|
16
17
|
*/
|
17
|
-
|
18
18
|
const setDefaultIconCollection = (theme, collectionName) => {
|
19
19
|
if (collectionName === "horizon") {
|
20
20
|
collectionName = "SAP-icons-v5";
|
21
21
|
}
|
22
|
-
|
23
22
|
IconCollectionConfiguration.set(theme, collectionName);
|
24
23
|
};
|
24
|
+
|
25
25
|
/**
|
26
26
|
* Returns the default icon collection (v4 or v5) for given theme,
|
27
27
|
* that is configured.
|
@@ -29,32 +29,24 @@ sap.ui.define(["exports", "./Theme"], function (_exports, _Theme) {
|
|
29
29
|
* @param {String} theme
|
30
30
|
* @returns {String}
|
31
31
|
*/
|
32
|
-
|
33
|
-
|
34
32
|
_exports.setDefaultIconCollection = setDefaultIconCollection;
|
35
|
-
|
36
33
|
const getDefaultIconCollection = theme => {
|
37
34
|
return IconCollectionConfiguration.get(theme);
|
38
35
|
};
|
36
|
+
|
39
37
|
/**
|
40
38
|
* Returns the effective icon collection that will be applied for icon web components
|
41
39
|
* whenever namespace is not specified.
|
42
40
|
* @returns {String}
|
43
41
|
*/
|
44
|
-
|
45
|
-
|
46
42
|
_exports.getDefaultIconCollection = getDefaultIconCollection;
|
47
|
-
|
48
43
|
const getEffectiveDefaultIconCollection = () => {
|
49
44
|
const currentTheme = (0, _Theme.getTheme)();
|
50
45
|
const currentThemeConfiguration = IconCollectionConfiguration.get(currentTheme);
|
51
|
-
|
52
46
|
if (currentThemeConfiguration) {
|
53
47
|
return currentThemeConfiguration;
|
54
48
|
}
|
55
|
-
|
56
49
|
return (0, _Theme.isThemeFamily)("sap_horizon") ? "SAP-icons-v5" : "SAP-icons";
|
57
50
|
};
|
58
|
-
|
59
51
|
_exports.getEffectiveDefaultIconCollection = getEffectiveDefaultIconCollection;
|
60
52
|
});
|
@@ -7,18 +7,18 @@ sap.ui.define(["exports", "../InitialConfiguration", "../locale/languageChange",
|
|
7
7
|
_exports.setLanguage = _exports.setFetchDefaultLanguage = _exports.getLanguage = _exports.getFetchDefaultLanguage = void 0;
|
8
8
|
let language;
|
9
9
|
let fetchDefaultLanguage;
|
10
|
+
|
10
11
|
/**
|
11
12
|
* Returns the currently configured language, or the browser language as a fallback
|
12
13
|
* @returns {String}
|
13
14
|
*/
|
14
|
-
|
15
15
|
const getLanguage = () => {
|
16
16
|
if (language === undefined) {
|
17
17
|
language = (0, _InitialConfiguration.getLanguage)();
|
18
18
|
}
|
19
|
-
|
20
19
|
return language;
|
21
20
|
};
|
21
|
+
|
22
22
|
/**
|
23
23
|
* Changes the current language, re-fetches all message bundles, updates all language-aware components
|
24
24
|
* and returns a promise that resolves when all rendering is done
|
@@ -26,21 +26,18 @@ sap.ui.define(["exports", "../InitialConfiguration", "../locale/languageChange",
|
|
26
26
|
* @param newLanguage
|
27
27
|
* @returns {Promise<void>}
|
28
28
|
*/
|
29
|
-
|
30
|
-
|
31
29
|
_exports.getLanguage = getLanguage;
|
32
|
-
|
33
30
|
const setLanguage = async newLanguage => {
|
34
31
|
if (language === newLanguage) {
|
35
32
|
return;
|
36
33
|
}
|
37
|
-
|
38
34
|
language = newLanguage;
|
39
35
|
await (0, _languageChange.fireLanguageChange)(newLanguage);
|
40
36
|
await (0, _Render.reRenderAllUI5Elements)({
|
41
37
|
languageAware: true
|
42
38
|
});
|
43
39
|
};
|
40
|
+
|
44
41
|
/**
|
45
42
|
* Defines if the default language, that is inlined, should be
|
46
43
|
* fetched over the network instead of using the inlined one.
|
@@ -48,28 +45,21 @@ sap.ui.define(["exports", "../InitialConfiguration", "../locale/languageChange",
|
|
48
45
|
*
|
49
46
|
* @param {Boolean} fetchDefaultLanguage
|
50
47
|
*/
|
51
|
-
|
52
|
-
|
53
48
|
_exports.setLanguage = setLanguage;
|
54
|
-
|
55
49
|
const setFetchDefaultLanguage = fetchDefaultLang => {
|
56
50
|
fetchDefaultLanguage = fetchDefaultLang;
|
57
51
|
};
|
52
|
+
|
58
53
|
/**
|
59
54
|
* Returns if the default language, that is inlined, should be fetched over the network.
|
60
55
|
* @returns {Boolean}
|
61
56
|
*/
|
62
|
-
|
63
|
-
|
64
57
|
_exports.setFetchDefaultLanguage = setFetchDefaultLanguage;
|
65
|
-
|
66
58
|
const getFetchDefaultLanguage = () => {
|
67
59
|
if (fetchDefaultLanguage === undefined) {
|
68
60
|
setFetchDefaultLanguage((0, _InitialConfiguration.getFetchDefaultLanguage)());
|
69
61
|
}
|
70
|
-
|
71
62
|
return fetchDefaultLanguage;
|
72
63
|
};
|
73
|
-
|
74
64
|
_exports.getFetchDefaultLanguage = getFetchDefaultLanguage;
|
75
65
|
});
|
@@ -7,48 +7,38 @@ sap.ui.define(["exports", "../InitialConfiguration"], function (_exports, _Initi
|
|
7
7
|
_exports.skipOriginalEvent = _exports.setNoConflict = _exports.getNoConflict = void 0;
|
8
8
|
// Fire these events even with noConflict: true
|
9
9
|
const excludeList = ["value-changed"];
|
10
|
-
|
11
10
|
const shouldFireOriginalEvent = eventName => {
|
12
11
|
return excludeList.includes(eventName);
|
13
12
|
};
|
14
|
-
|
15
13
|
let noConflict;
|
16
|
-
|
17
14
|
const shouldNotFireOriginalEvent = eventName => {
|
18
15
|
const nc = getNoConflict();
|
19
16
|
return !(nc.events && nc.events.includes && nc.events.includes(eventName));
|
20
17
|
};
|
21
|
-
|
22
18
|
const getNoConflict = () => {
|
23
19
|
if (noConflict === undefined) {
|
24
20
|
noConflict = (0, _InitialConfiguration.getNoConflict)();
|
25
21
|
}
|
26
|
-
|
27
22
|
return noConflict;
|
28
23
|
};
|
29
|
-
|
30
24
|
_exports.getNoConflict = getNoConflict;
|
31
|
-
|
32
25
|
const skipOriginalEvent = eventName => {
|
33
|
-
const nc = getNoConflict();
|
26
|
+
const nc = getNoConflict();
|
34
27
|
|
28
|
+
// Always fire these events
|
35
29
|
if (shouldFireOriginalEvent(eventName)) {
|
36
30
|
return false;
|
37
|
-
}
|
38
|
-
|
31
|
+
}
|
39
32
|
|
33
|
+
// Read from the configuration
|
40
34
|
if (nc === true) {
|
41
35
|
return true;
|
42
36
|
}
|
43
|
-
|
44
37
|
return !shouldNotFireOriginalEvent(eventName);
|
45
38
|
};
|
46
|
-
|
47
39
|
_exports.skipOriginalEvent = skipOriginalEvent;
|
48
|
-
|
49
40
|
const setNoConflict = noConflictData => {
|
50
41
|
noConflict = noConflictData;
|
51
42
|
};
|
52
|
-
|
53
43
|
_exports.setNoConflict = setNoConflict;
|
54
44
|
});
|
@@ -7,9 +7,7 @@ sap.ui.define(["exports", "../InitialConfiguration", "./Language", "../util/getD
|
|
7
7
|
_exports.getRTL = void 0;
|
8
8
|
_getDesigntimePropertyAsArray = _interopRequireDefault(_getDesigntimePropertyAsArray);
|
9
9
|
_detectNavigatorLanguage = _interopRequireDefault(_detectNavigatorLanguage);
|
10
|
-
|
11
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
|
-
|
13
11
|
const M_ISO639_OLD_TO_NEW = {
|
14
12
|
"iw": "he",
|
15
13
|
"ji": "yi",
|
@@ -17,22 +15,18 @@ sap.ui.define(["exports", "../InitialConfiguration", "./Language", "../util/getD
|
|
17
15
|
"sh": "sr"
|
18
16
|
};
|
19
17
|
const A_RTL_LOCALES = (0, _getDesigntimePropertyAsArray.default)("$cldr-rtl-locales:ar,fa,he$") || [];
|
20
|
-
|
21
18
|
const impliesRTL = language => {
|
22
19
|
language = language && M_ISO639_OLD_TO_NEW[language] || language;
|
23
20
|
return A_RTL_LOCALES.indexOf(language) >= 0;
|
24
21
|
};
|
25
|
-
|
26
22
|
const getRTL = () => {
|
27
23
|
const configurationRTL = (0, _InitialConfiguration.getRTL)();
|
28
|
-
|
29
24
|
if (configurationRTL !== null) {
|
30
25
|
return !!configurationRTL;
|
31
26
|
}
|
32
|
-
|
33
27
|
return impliesRTL((0, _Language.getLanguage)() || (0, _detectNavigatorLanguage.default)());
|
34
|
-
};
|
35
|
-
|
28
|
+
};
|
36
29
|
|
30
|
+
// eslint-disable-line
|
37
31
|
_exports.getRTL = getRTL;
|
38
32
|
});
|
@@ -6,60 +6,49 @@ sap.ui.define(["exports", "../InitialConfiguration", "../Render", "../theming/ap
|
|
6
6
|
});
|
7
7
|
_exports.setTheme = _exports.isThemeFamily = _exports.isTheme = _exports.getTheme = void 0;
|
8
8
|
_applyTheme = _interopRequireDefault(_applyTheme);
|
9
|
-
|
10
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
-
|
12
10
|
let theme;
|
13
|
-
|
14
11
|
const getTheme = () => {
|
15
12
|
if (theme === undefined) {
|
16
13
|
theme = (0, _InitialConfiguration.getTheme)();
|
17
14
|
}
|
18
|
-
|
19
15
|
return theme;
|
20
16
|
};
|
21
|
-
|
22
17
|
_exports.getTheme = getTheme;
|
23
|
-
|
24
18
|
const setTheme = async newTheme => {
|
25
19
|
if (theme === newTheme) {
|
26
20
|
return;
|
27
21
|
}
|
22
|
+
theme = newTheme;
|
28
23
|
|
29
|
-
|
30
|
-
|
24
|
+
// Update CSS Custom Properties
|
31
25
|
await (0, _applyTheme.default)(theme);
|
32
26
|
await (0, _Render.reRenderAllUI5Elements)({
|
33
27
|
themeAware: true
|
34
28
|
});
|
35
29
|
};
|
30
|
+
|
36
31
|
/**
|
37
32
|
* Returns if the given theme name is the one currently applied.
|
38
33
|
* @private
|
39
34
|
* @param {String}
|
40
35
|
* @returns {boolean}
|
41
36
|
*/
|
42
|
-
|
43
|
-
|
44
37
|
_exports.setTheme = setTheme;
|
45
|
-
|
46
38
|
const isTheme = _theme => {
|
47
39
|
const currentTheme = getTheme();
|
48
40
|
return currentTheme === _theme || currentTheme === `${_theme}_exp`;
|
49
41
|
};
|
42
|
+
|
50
43
|
/**
|
51
44
|
* Returns if the current theme is part of given theme family
|
52
45
|
* @private
|
53
46
|
* @param {String} the theme family
|
54
47
|
* @returns {boolean}
|
55
48
|
*/
|
56
|
-
|
57
|
-
|
58
49
|
_exports.isTheme = isTheme;
|
59
|
-
|
60
50
|
const isThemeFamily = _theme => {
|
61
51
|
return getTheme().startsWith(_theme);
|
62
52
|
};
|
63
|
-
|
64
53
|
_exports.isThemeFamily = isThemeFamily;
|
65
54
|
});
|
@@ -8,9 +8,7 @@ sap.ui.define(["exports", "../Keys", "../util/getActiveElement", "../types/Navig
|
|
8
8
|
_getActiveElement = _interopRequireDefault(_getActiveElement);
|
9
9
|
_NavigationMode = _interopRequireDefault(_NavigationMode);
|
10
10
|
_ItemNavigationBehavior = _interopRequireDefault(_ItemNavigationBehavior);
|
11
|
-
|
12
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
-
|
14
12
|
/**
|
15
13
|
* The ItemNavigation class manages the calculations to determine the correct "tabindex" for a group of related items inside a root component.
|
16
14
|
* Important: ItemNavigation only does the calculations and does not change "tabindex" directly, this is a responsibility of the developer.
|
@@ -61,28 +59,22 @@ sap.ui.define(["exports", "../Keys", "../util/getActiveElement", "../types/Navig
|
|
61
59
|
*/
|
62
60
|
constructor(rootWebComponent, options = {}) {
|
63
61
|
this._setRootComponent(rootWebComponent);
|
64
|
-
|
65
62
|
this._initOptions(options);
|
66
63
|
}
|
67
|
-
|
68
64
|
_setRootComponent(rootWebComponent) {
|
69
65
|
if (!rootWebComponent.isUI5Element) {
|
70
66
|
throw new Error("The root web component must be a UI5 Element instance");
|
71
67
|
}
|
72
|
-
|
73
68
|
this.rootWebComponent = rootWebComponent;
|
74
69
|
this.rootWebComponent.addEventListener("keydown", this._onkeydown.bind(this));
|
75
|
-
|
76
70
|
this.rootWebComponent._onComponentStateFinalized = () => {
|
77
71
|
this._init();
|
78
72
|
};
|
79
73
|
}
|
80
|
-
|
81
74
|
_initOptions(options) {
|
82
75
|
if (typeof options.getItemsCallback !== "function") {
|
83
76
|
throw new Error("getItemsCallback is required");
|
84
77
|
}
|
85
|
-
|
86
78
|
this._getItems = options.getItemsCallback;
|
87
79
|
this._currentIndex = options.currentIndex || 0;
|
88
80
|
this._rowSize = options.rowSize || 1;
|
@@ -91,6 +83,7 @@ sap.ui.define(["exports", "../Keys", "../util/getActiveElement", "../types/Navig
|
|
91
83
|
this._affectedPropertiesNames = options.affectedPropertiesNames || [];
|
92
84
|
this._skipItemsSize = options.skipItemsSize || null;
|
93
85
|
}
|
86
|
+
|
94
87
|
/**
|
95
88
|
* Call this method to set a new "current" (selected) item in the item navigation
|
96
89
|
* Note: the item passed to this function must be one of the items, returned by the getItemsCallback function
|
@@ -98,48 +91,37 @@ sap.ui.define(["exports", "../Keys", "../util/getActiveElement", "../types/Navig
|
|
98
91
|
* @public
|
99
92
|
* @param current the new selected item
|
100
93
|
*/
|
101
|
-
|
102
|
-
|
103
94
|
setCurrentItem(current) {
|
104
95
|
const currentItemIndex = this._getItems().indexOf(current);
|
105
|
-
|
106
96
|
if (currentItemIndex === -1) {
|
107
97
|
console.warn(`The provided item is not managed by ItemNavigation`, current); // eslint-disable-line
|
108
|
-
|
109
98
|
return;
|
110
99
|
}
|
111
|
-
|
112
100
|
this._currentIndex = currentItemIndex;
|
113
|
-
|
114
101
|
this._applyTabIndex();
|
115
102
|
}
|
103
|
+
|
116
104
|
/**
|
117
105
|
* Call this method to dynamically change the row size
|
118
106
|
*
|
119
107
|
* @public
|
120
108
|
* @param newRowSize
|
121
109
|
*/
|
122
|
-
|
123
|
-
|
124
110
|
setRowSize(newRowSize) {
|
125
111
|
this._rowSize = newRowSize;
|
126
112
|
}
|
127
|
-
|
128
113
|
_init() {
|
129
114
|
this._getItems().forEach((item, idx) => {
|
130
115
|
item._tabIndex = idx === this._currentIndex ? "0" : "-1";
|
131
116
|
});
|
132
117
|
}
|
133
|
-
|
134
118
|
_onkeydown(event) {
|
135
119
|
if (!this._canNavigate()) {
|
136
120
|
return;
|
137
121
|
}
|
138
|
-
|
139
122
|
const horizontalNavigationOn = this._navigationMode === _NavigationMode.default.Horizontal || this._navigationMode === _NavigationMode.default.Auto;
|
140
123
|
const verticalNavigationOn = this._navigationMode === _NavigationMode.default.Vertical || this._navigationMode === _NavigationMode.default.Auto;
|
141
124
|
const isRTL = this.rootWebComponent.effectiveDir === "rtl";
|
142
|
-
|
143
125
|
if (isRTL && (0, _Keys.isLeft)(event) && horizontalNavigationOn) {
|
144
126
|
this._handleRight();
|
145
127
|
} else if (isRTL && (0, _Keys.isRight)(event) && horizontalNavigationOn) {
|
@@ -165,97 +147,75 @@ sap.ui.define(["exports", "../Keys", "../util/getActiveElement", "../types/Navig
|
|
165
147
|
}
|
166
148
|
|
167
149
|
event.preventDefault();
|
168
|
-
|
169
150
|
this._applyTabIndex();
|
170
|
-
|
171
151
|
this._focusCurrentItem();
|
172
152
|
}
|
173
|
-
|
174
153
|
_handleUp() {
|
175
154
|
const itemsLength = this._getItems().length;
|
176
|
-
|
177
155
|
if (this._currentIndex - this._rowSize >= 0) {
|
178
156
|
// no border reached, just decrease the index by a row
|
179
157
|
this._currentIndex -= this._rowSize;
|
180
158
|
return;
|
181
159
|
}
|
182
|
-
|
183
160
|
if (this._behavior === _ItemNavigationBehavior.default.Cyclic) {
|
184
161
|
// if cyclic, go to the **last** item in the **previous** column
|
185
162
|
const firstItemInThisColumnIndex = this._currentIndex % this._rowSize;
|
186
163
|
const firstItemInPreviousColumnIndex = firstItemInThisColumnIndex === 0 ? this._rowSize - 1 : firstItemInThisColumnIndex - 1; // find the first item in the previous column (if the current column is the first column -> move to the last column)
|
187
|
-
|
188
164
|
const rows = Math.ceil(itemsLength / this._rowSize); // how many rows there are (even if incomplete, f.e. for 14 items and _rowSize=4 -> 4 rows total, although only 2 items on the last row)
|
189
|
-
|
190
165
|
let lastItemInPreviousColumnIndex = firstItemInPreviousColumnIndex + (rows - 1) * this._rowSize; // multiply rows by columns, and add the column's first item's index
|
191
|
-
|
192
166
|
if (lastItemInPreviousColumnIndex > itemsLength - 1) {
|
193
167
|
// for incomplete rows, use the previous row's last item, as for them the last item is missing
|
194
168
|
lastItemInPreviousColumnIndex -= this._rowSize;
|
195
169
|
}
|
196
|
-
|
197
170
|
this._currentIndex = lastItemInPreviousColumnIndex;
|
198
171
|
} else {
|
199
172
|
// not cyclic, so just go to the first item
|
200
173
|
this._currentIndex = 0;
|
201
174
|
}
|
202
175
|
}
|
203
|
-
|
204
176
|
_handleDown() {
|
205
177
|
const itemsLength = this._getItems().length;
|
206
|
-
|
207
178
|
if (this._currentIndex + this._rowSize < itemsLength) {
|
208
179
|
// no border reached, just increase the index by a row
|
209
180
|
this._currentIndex += this._rowSize;
|
210
181
|
return;
|
211
182
|
}
|
212
|
-
|
213
183
|
if (this._behavior === _ItemNavigationBehavior.default.Cyclic) {
|
214
184
|
// if cyclic, go to the **first** item in the **next** column
|
215
185
|
const firstItemInThisColumnIndex = this._currentIndex % this._rowSize; // find the first item in the current column first
|
216
|
-
|
217
186
|
const firstItemInNextColumnIndex = (firstItemInThisColumnIndex + 1) % this._rowSize; // to get the first item in the next column, just increase the index by 1. The modulo by rows is for the case when we are at the last column
|
218
|
-
|
219
187
|
this._currentIndex = firstItemInNextColumnIndex;
|
220
188
|
} else {
|
221
189
|
// not cyclic, so just go to the last item
|
222
190
|
this._currentIndex = itemsLength - 1;
|
223
191
|
}
|
224
192
|
}
|
225
|
-
|
226
193
|
_handleLeft() {
|
227
194
|
const itemsLength = this._getItems().length;
|
228
|
-
|
229
195
|
if (this._currentIndex > 0) {
|
230
196
|
this._currentIndex -= 1;
|
231
197
|
return;
|
232
198
|
}
|
233
|
-
|
234
199
|
if (this._behavior === _ItemNavigationBehavior.default.Cyclic) {
|
235
200
|
// go to the first item in the next column
|
236
201
|
this._currentIndex = itemsLength - 1;
|
237
202
|
}
|
238
203
|
}
|
239
|
-
|
240
204
|
_handleRight() {
|
241
205
|
const itemsLength = this._getItems().length;
|
242
|
-
|
243
206
|
if (this._currentIndex < itemsLength - 1) {
|
244
207
|
this._currentIndex += 1;
|
245
208
|
return;
|
246
209
|
}
|
247
|
-
|
248
210
|
if (this._behavior === _ItemNavigationBehavior.default.Cyclic) {
|
249
211
|
// go to the first item in the next column
|
250
212
|
this._currentIndex = 0;
|
251
213
|
}
|
252
214
|
}
|
253
|
-
|
254
215
|
_handleHome() {
|
255
216
|
const homeEndRange = this._rowSize > 1 ? this._rowSize : this._getItems().length;
|
256
217
|
this._currentIndex -= this._currentIndex % homeEndRange;
|
257
218
|
}
|
258
|
-
|
259
219
|
_handleEnd() {
|
260
220
|
const homeEndRange = this._rowSize > 1 ? this._rowSize : this._getItems().length;
|
261
221
|
this._currentIndex += homeEndRange - 1 - this._currentIndex % homeEndRange; // eslint-disable-line
|
@@ -267,30 +227,25 @@ sap.ui.define(["exports", "../Keys", "../util/getActiveElement", "../types/Navig
|
|
267
227
|
// TODO: handle page up on matrix (grid) layout - ColorPalette, ProductSwitch.
|
268
228
|
return;
|
269
229
|
}
|
270
|
-
|
271
230
|
this._handlePageUpFlat();
|
272
231
|
}
|
273
|
-
|
274
232
|
_handlePageDown() {
|
275
233
|
if (this._rowSize > 1) {
|
276
234
|
// eslint-disable-next-line
|
277
235
|
// TODO: handle page up on matrix (grid) layout - ColorPalette, ProductSwitch.
|
278
236
|
return;
|
279
237
|
}
|
280
|
-
|
281
238
|
this._handlePageDownFlat();
|
282
239
|
}
|
240
|
+
|
283
241
|
/**
|
284
242
|
* Handles PAGE_UP in a flat list-like structure, both vertically and horizontally.
|
285
243
|
*/
|
286
|
-
|
287
|
-
|
288
244
|
_handlePageUpFlat() {
|
289
245
|
if (this._skipItemsSize === null) {
|
290
246
|
// Move the focus to the very top (as Home).
|
291
247
|
this._currentIndex -= this._currentIndex;
|
292
248
|
}
|
293
|
-
|
294
249
|
if (this._currentIndex + 1 > this._skipItemsSize) {
|
295
250
|
// When there are more than "skipItemsSize" number of items to the top,
|
296
251
|
// move the focus up/left with the predefined number.
|
@@ -300,19 +255,16 @@ sap.ui.define(["exports", "../Keys", "../util/getActiveElement", "../types/Navig
|
|
300
255
|
this._currentIndex -= this._currentIndex;
|
301
256
|
}
|
302
257
|
}
|
258
|
+
|
303
259
|
/**
|
304
260
|
* Handles PAGE_DOWN in a flat list-like structure, both vertically and horizontally.
|
305
261
|
*/
|
306
|
-
|
307
|
-
|
308
262
|
_handlePageDownFlat() {
|
309
263
|
if (this._skipItemsSize === null) {
|
310
264
|
// Move the focus to the very bottom (as End).
|
311
265
|
this._currentIndex = this._getItems().length - 1;
|
312
266
|
}
|
313
|
-
|
314
267
|
const currentToEndRange = this._getItems().length - this._currentIndex - 1;
|
315
|
-
|
316
268
|
if (currentToEndRange > this._skipItemsSize) {
|
317
269
|
// When there are more than "skipItemsSize" number of items until the bottom,
|
318
270
|
// move the focus down/right with the predefined number.
|
@@ -322,71 +274,55 @@ sap.ui.define(["exports", "../Keys", "../util/getActiveElement", "../types/Navig
|
|
322
274
|
this._currentIndex = this._getItems().length - 1;
|
323
275
|
}
|
324
276
|
}
|
325
|
-
|
326
277
|
_applyTabIndex() {
|
327
278
|
const items = this._getItems();
|
328
|
-
|
329
279
|
for (let i = 0; i < items.length; i++) {
|
330
280
|
items[i]._tabIndex = i === this._currentIndex ? "0" : "-1";
|
331
281
|
}
|
332
|
-
|
333
282
|
this._affectedPropertiesNames.forEach(propName => {
|
334
283
|
const prop = this.rootWebComponent[propName];
|
335
|
-
this.rootWebComponent[propName] = Array.isArray(prop) ? [...prop] : {
|
284
|
+
this.rootWebComponent[propName] = Array.isArray(prop) ? [...prop] : {
|
285
|
+
...prop
|
336
286
|
};
|
337
287
|
});
|
338
288
|
}
|
339
|
-
|
340
289
|
_focusCurrentItem() {
|
341
290
|
const currentItem = this._getCurrentItem();
|
342
|
-
|
343
291
|
if (currentItem) {
|
344
292
|
currentItem.focus();
|
345
293
|
}
|
346
294
|
}
|
347
|
-
|
348
295
|
_canNavigate() {
|
349
296
|
const currentItem = this._getCurrentItem();
|
350
|
-
|
351
297
|
const activeElement = (0, _getActiveElement.default)();
|
352
298
|
return currentItem && currentItem === activeElement;
|
353
299
|
}
|
354
|
-
|
355
300
|
_getCurrentItem() {
|
356
301
|
const items = this._getItems();
|
357
|
-
|
358
302
|
if (!items.length) {
|
359
303
|
return null;
|
360
|
-
}
|
361
|
-
|
304
|
+
}
|
362
305
|
|
306
|
+
// normalize the index
|
363
307
|
while (this._currentIndex >= items.length) {
|
364
308
|
this._currentIndex -= this._rowSize;
|
365
309
|
}
|
366
|
-
|
367
310
|
if (this._currentIndex < 0) {
|
368
311
|
this._currentIndex = 0;
|
369
312
|
}
|
370
|
-
|
371
313
|
const currentItem = items[this._currentIndex];
|
372
|
-
|
373
314
|
if (!currentItem) {
|
374
315
|
return;
|
375
316
|
}
|
376
|
-
|
377
317
|
if (currentItem.isUI5Element) {
|
378
318
|
return currentItem.getFocusDomRef();
|
379
319
|
}
|
380
|
-
|
381
320
|
if (!this.rootWebComponent.getDomRef()) {
|
382
321
|
return;
|
383
322
|
}
|
384
|
-
|
385
323
|
return this.rootWebComponent.getDomRef().querySelector(`#${currentItem.id}`);
|
386
324
|
}
|
387
|
-
|
388
325
|
}
|
389
|
-
|
390
326
|
var _default = ItemNavigation;
|
391
327
|
_exports.default = _default;
|
392
328
|
});
|