@ui5/webcomponents-base 0.0.0-aeb93167c → 0.0.0-b053ad005
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 +3 -0
- package/CHANGELOG.md +84 -0
- package/README.md +26 -2
- package/bundle.esm.js +13 -11
- package/dist/AssetRegistry.js +8 -9
- package/dist/Boot.js +43 -0
- package/dist/CSP.js +59 -0
- package/dist/DOMObserver.js +65 -0
- package/dist/Device.js +62 -778
- package/dist/EventProvider.js +30 -26
- package/dist/FontFace.js +7 -95
- package/dist/InitialConfiguration.js +37 -21
- package/dist/Keys.js +51 -0
- package/dist/ManagedStyles.js +83 -0
- package/dist/MediaRange.js +109 -0
- package/{src/util/parseProperties.js → dist/PropertiesFileFormat.js} +6 -0
- package/dist/Render.js +175 -0
- package/dist/RenderScheduler.js +16 -138
- package/dist/StaticArea.js +1 -29
- package/dist/StaticAreaItem.js +56 -66
- package/dist/SystemCSSVars.js +4 -25
- package/dist/UI5Element.js +301 -383
- package/dist/UI5ElementMetadata.js +123 -16
- package/dist/asset-registries/Icons.js +121 -14
- package/dist/asset-registries/Illustrations.js +30 -0
- package/dist/asset-registries/LocaleData.js +91 -67
- package/dist/asset-registries/Themes.js +23 -33
- package/dist/asset-registries/i18n.js +61 -50
- package/dist/assets-meta/IconCollectionsAlias.js +18 -0
- package/dist/config/Language.js +18 -20
- package/dist/config/Theme.js +14 -0
- package/dist/css/FontFace.css +45 -0
- package/dist/css/OverrideFontFace.css +32 -0
- package/dist/css/SystemCSSVars.css +17 -0
- package/dist/delegate/ItemNavigation.js +233 -201
- package/dist/delegate/ResizeHandler.js +78 -37
- package/dist/delegate/ScrollEnablement.js +49 -20
- package/dist/features/OpenUI5Support.js +41 -6
- package/dist/generated/AssetParameters.js +1 -1
- package/dist/generated/css/FontFace.css.js +5 -0
- package/dist/generated/css/OverrideFontFace.css.js +5 -0
- package/dist/generated/css/SystemCSSVars.css.js +5 -0
- package/dist/i18nBundle.js +38 -4
- package/dist/isLegacyBrowser.js +3 -0
- package/dist/locale/applyDirection.js +6 -4
- package/dist/locale/directionChange.js +32 -0
- package/dist/locale/getEffectiveDir.js +28 -0
- package/dist/locale/languageChange.js +1 -1
- package/dist/renderer/LitRenderer.js +24 -21
- package/dist/renderer/directives/style-map.js +72 -0
- package/dist/resources/bundle.esm.js +17 -109
- package/dist/resources/bundle.esm.js.map +1 -1
- package/dist/sap/base/Log.js +241 -0
- package/dist/sap/base/assert.js +8 -0
- package/dist/sap/base/security/URLListValidator.js +148 -0
- package/dist/sap/base/security/sanitizeHTML.js +16 -0
- package/dist/sap/base/util/now.js +7 -0
- package/dist/sap/ui/thirdparty/caja-html-sanitizer.js +3585 -0
- package/dist/test-resources/assets/Themes.js +8 -8
- package/dist/test-resources/elements/Parent.js +6 -2
- package/dist/test-resources/elements/WithStaticArea.js +2 -1
- package/dist/test-resources/pages/AllTestElements.html +3 -3
- package/dist/test-resources/pages/Configuration.html +0 -2
- package/dist/test-resources/pages/ConfigurationScript.html +0 -2
- package/dist/test-resources/pages/i18n.html +2 -9
- package/dist/test-resources/specs/ConfigurationChange.spec.js +10 -8
- package/dist/test-resources/specs/ConfigurationScript.spec.js +25 -23
- package/dist/test-resources/specs/ConfigurationURL.spec.js +65 -17
- package/dist/test-resources/specs/CustomTheme.spec.js +9 -7
- package/dist/test-resources/specs/EventProvider.spec.js +63 -0
- package/dist/test-resources/specs/StaticArea.spec.js +56 -12
- package/dist/test-resources/specs/Theming.spec.js +12 -10
- package/dist/test-resources/specs/UI5ElementInvalidation.js +54 -70
- package/dist/test-resources/specs/UI5ElementLifecycle.js +17 -15
- package/dist/test-resources/specs/UI5ElementListenForChildPropChanges.spec.js +25 -51
- package/dist/test-resources/specs/UI5ElementMetadataExt.js +9 -7
- package/dist/test-resources/specs/UI5ElementPropertyValidation.js +7 -5
- package/dist/test-resources/specs/UI5ElementPropsAndAttrs.spec.js +37 -35
- package/dist/test-resources/specs/UI5ElementShadowDOM.js +10 -8
- package/dist/test-resources/specs/UI5ElementSlots.js +10 -8
- package/dist/theming/CustomStyle.js +2 -2
- package/dist/theming/applyTheme.js +5 -14
- package/dist/theming/getConstructableStyle.js +7 -6
- package/dist/theming/getEffectiveLinksHrefs.js +20 -0
- package/dist/theming/getEffectiveStyle.js +15 -8
- package/dist/theming/getStylesString.js +4 -2
- package/dist/theming/getThemeDesignerTheme.js +2 -1
- package/dist/theming/preloadLinks.js +23 -0
- package/dist/types/CSSColor.js +9 -0
- package/dist/types/CalendarType.js +1 -1
- package/dist/types/DataType.js +13 -1
- package/dist/types/Float.js +4 -0
- package/dist/types/Integer.js +4 -0
- package/dist/types/InvisibleMessageMode.js +30 -0
- package/dist/types/ItemNavigationBehavior.js +2 -7
- package/dist/types/PopupState.js +1 -1
- package/dist/types/ValueState.js +1 -1
- package/dist/updateShadowRoot.js +30 -0
- package/dist/util/AriaLabelHelper.js +4 -4
- package/dist/util/Caret.js +45 -0
- package/dist/util/ColorConversion.js +370 -0
- package/dist/util/FocusableElements.js +17 -6
- package/dist/util/HTMLSanitizer.js +7 -0
- package/dist/util/InvisibleMessage.js +58 -0
- package/dist/util/PopupUtils.js +93 -0
- package/dist/util/SlotsHelper.js +43 -0
- package/dist/util/TabbableElements.js +1 -1
- package/dist/util/arraysAreEqual.js +15 -0
- package/dist/util/clamp.js +12 -0
- package/dist/util/createLinkInHead.js +19 -0
- package/dist/util/debounce.js +17 -0
- package/dist/util/getActiveElement.js +11 -0
- package/dist/util/getClassCopy.js +10 -0
- package/dist/util/getEffectiveContentDensity.js +5 -0
- package/dist/util/isElementInView.js +15 -0
- package/dist/util/isNodeTabbable.js +4 -4
- package/hash.txt +1 -0
- package/index.js +1 -1
- package/lib/generate-asset-parameters/index.js +0 -1
- package/lib/generate-styles/index.js +18 -0
- package/package-scripts.js +37 -19
- package/package.json +19 -13
- package/src/AssetRegistry.js +8 -9
- package/src/Boot.js +43 -0
- package/src/CSP.js +59 -0
- package/src/DOMObserver.js +65 -0
- package/src/Device.js +62 -778
- package/src/EventProvider.js +30 -26
- package/src/FontFace.js +7 -95
- package/src/InitialConfiguration.js +37 -21
- package/src/Keys.js +51 -0
- package/src/ManagedStyles.js +83 -0
- package/src/MediaRange.js +109 -0
- package/{dist/util/parseProperties.js → src/PropertiesFileFormat.js} +6 -0
- package/src/Render.js +175 -0
- package/src/RenderScheduler.js +16 -138
- package/src/StaticArea.js +1 -29
- package/src/StaticAreaItem.js +56 -66
- package/src/SystemCSSVars.js +4 -25
- package/src/UI5Element.js +301 -383
- package/src/UI5ElementMetadata.js +123 -16
- package/src/asset-registries/Icons.js +121 -14
- package/src/asset-registries/Illustrations.js +30 -0
- package/src/asset-registries/LocaleData.js +91 -67
- package/src/asset-registries/Themes.js +23 -33
- package/src/asset-registries/i18n.js +61 -50
- package/src/assets-meta/IconCollectionsAlias.js +18 -0
- package/src/config/Language.js +18 -20
- package/src/config/Theme.js +14 -0
- package/src/css/FontFace.css +45 -0
- package/src/css/OverrideFontFace.css +32 -0
- package/src/css/SystemCSSVars.css +17 -0
- package/src/delegate/ItemNavigation.js +233 -201
- package/src/delegate/ResizeHandler.js +78 -37
- package/src/delegate/ScrollEnablement.js +49 -20
- package/src/features/OpenUI5Support.js +41 -6
- package/src/i18nBundle.js +38 -4
- package/src/isLegacyBrowser.js +3 -0
- package/src/locale/applyDirection.js +6 -4
- package/src/locale/directionChange.js +32 -0
- package/src/locale/getEffectiveDir.js +28 -0
- package/src/locale/languageChange.js +1 -1
- package/src/renderer/LitRenderer.js +24 -21
- package/src/renderer/directives/style-map.js +72 -0
- package/src/theming/CustomStyle.js +2 -2
- package/src/theming/applyTheme.js +5 -14
- package/src/theming/getConstructableStyle.js +7 -6
- package/src/theming/getEffectiveLinksHrefs.js +20 -0
- package/src/theming/getEffectiveStyle.js +15 -8
- package/src/theming/getStylesString.js +4 -2
- package/src/theming/getThemeDesignerTheme.js +2 -1
- package/src/theming/preloadLinks.js +23 -0
- package/src/types/CSSColor.js +9 -0
- package/src/types/CalendarType.js +1 -1
- package/src/types/DataType.js +13 -1
- package/src/types/Float.js +4 -0
- package/src/types/Integer.js +4 -0
- package/src/types/InvisibleMessageMode.js +30 -0
- package/src/types/ItemNavigationBehavior.js +2 -7
- package/src/types/PopupState.js +1 -1
- package/src/types/ValueState.js +1 -1
- package/src/updateShadowRoot.js +30 -0
- package/src/util/AriaLabelHelper.js +4 -4
- package/src/util/Caret.js +45 -0
- package/src/util/ColorConversion.js +370 -0
- package/src/util/FocusableElements.js +17 -6
- package/src/util/HTMLSanitizer.js +7 -0
- package/src/util/InvisibleMessage.js +58 -0
- package/src/util/PopupUtils.js +93 -0
- package/src/util/SlotsHelper.js +43 -0
- package/src/util/TabbableElements.js +1 -1
- package/src/util/arraysAreEqual.js +15 -0
- package/src/util/clamp.js +12 -0
- package/src/util/createLinkInHead.js +19 -0
- package/src/util/debounce.js +17 -0
- package/src/util/getActiveElement.js +11 -0
- package/src/util/getClassCopy.js +10 -0
- package/src/util/getEffectiveContentDensity.js +5 -0
- package/src/util/isElementInView.js +15 -0
- package/src/util/isNodeTabbable.js +4 -4
- package/used-modules.txt +7 -0
- package/bundle.es5.js +0 -28
- package/dist/SVGIconRegistry.js +0 -73
- package/dist/boot.js +0 -34
- package/dist/compatibility/DOMObserver.js +0 -62
- package/dist/compatibility/patchNodeValue.js +0 -24
- package/dist/compatibility/whenPolyfillLoaded.js +0 -26
- package/dist/config/AssetsPath.js +0 -17
- package/dist/delegate/CustomResize.js +0 -78
- package/dist/delegate/NativeResize.js +0 -45
- package/dist/features/PropertiesFormatSupport.js +0 -8
- package/dist/features/browsersupport/Edge.js +0 -6
- package/dist/features/browsersupport/IE11.js +0 -42
- package/dist/features/browsersupport/IE11WithWebComponentsPolyfill.js +0 -5
- package/dist/renderer/ifDefined.js +0 -21
- package/dist/renderer/scopeHTML.js +0 -32
- package/dist/resources/bundle.es5.js +0 -212
- package/dist/resources/bundle.es5.js.map +0 -1
- package/dist/theming/CSSVarsPonyfill.js +0 -68
- package/dist/theming/adaptCSSForIE.js +0 -95
- package/dist/theming/createComponentStyleTag.js +0 -54
- package/dist/theming/createThemePropertiesStyleTag.js +0 -20
- package/dist/thirdparty/Array.from.js +0 -16
- package/dist/thirdparty/Array.prototype.fill.js +0 -44
- package/dist/thirdparty/Array.prototype.find.js +0 -46
- package/dist/thirdparty/Array.prototype.includes.js +0 -51
- package/dist/thirdparty/Element.prototype.closest.js +0 -11
- package/dist/thirdparty/Element.prototype.matches.js +0 -6
- package/dist/thirdparty/Map.prototype.keys.js +0 -9
- package/dist/thirdparty/Number.isInteger.js +0 -5
- package/dist/thirdparty/Number.isNaN.js +0 -1
- package/dist/thirdparty/Number.parseFloat.js +0 -1
- package/dist/thirdparty/Number.parseInt.js +0 -1
- package/dist/thirdparty/Object.assign.js +0 -31
- package/dist/thirdparty/Object.entries.js +0 -11
- package/dist/thirdparty/Symbol.js +0 -2
- package/dist/thirdparty/WeakSet.js +0 -27
- package/dist/thirdparty/es6-string-methods.js +0 -182
- package/dist/thirdparty/events-polyfills.js +0 -89
- package/dist/thirdparty/fetch.js +0 -1
- package/dist/thirdparty/template.js +0 -600
- package/dist/thirdparty/webcomponents-sd-ce-pf.js +0 -318
- package/dist/util/EffectiveAssetPath.js +0 -27
- package/dist/util/isSlot.js +0 -3
- package/dist/webcomponentsjs/LICENSE.md +0 -19
- package/dist/webcomponentsjs/README.md +0 -229
- package/dist/webcomponentsjs/bundles/webcomponents-ce.js +0 -63
- package/dist/webcomponentsjs/bundles/webcomponents-ce.js.map +0 -1
- package/dist/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js +0 -297
- package/dist/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js.map +0 -1
- package/dist/webcomponentsjs/bundles/webcomponents-sd-ce.js +0 -208
- package/dist/webcomponentsjs/bundles/webcomponents-sd-ce.js.map +0 -1
- package/dist/webcomponentsjs/bundles/webcomponents-sd.js +0 -166
- package/dist/webcomponentsjs/bundles/webcomponents-sd.js.map +0 -1
- package/dist/webcomponentsjs/custom-elements-es5-adapter.js +0 -15
- package/dist/webcomponentsjs/package.json +0 -46
- package/dist/webcomponentsjs/src/entrypoints/custom-elements-es5-adapter-index.js +0 -16
- package/dist/webcomponentsjs/src/entrypoints/webcomponents-bundle-index.js +0 -53
- package/dist/webcomponentsjs/src/entrypoints/webcomponents-ce-index.js +0 -17
- package/dist/webcomponentsjs/src/entrypoints/webcomponents-sd-ce-index.js +0 -19
- package/dist/webcomponentsjs/src/entrypoints/webcomponents-sd-ce-pf-index.js +0 -28
- package/dist/webcomponentsjs/src/entrypoints/webcomponents-sd-index.js +0 -18
- package/dist/webcomponentsjs/webcomponents-bundle.js +0 -298
- package/dist/webcomponentsjs/webcomponents-bundle.js.map +0 -1
- package/dist/webcomponentsjs/webcomponents-loader.js +0 -185
- package/src/SVGIconRegistry.js +0 -73
- package/src/boot.js +0 -34
- package/src/compatibility/DOMObserver.js +0 -62
- package/src/compatibility/patchNodeValue.js +0 -24
- package/src/compatibility/whenPolyfillLoaded.js +0 -26
- package/src/config/AssetsPath.js +0 -17
- package/src/delegate/CustomResize.js +0 -78
- package/src/delegate/NativeResize.js +0 -45
- package/src/features/PropertiesFormatSupport.js +0 -8
- package/src/features/browsersupport/Edge.js +0 -6
- package/src/features/browsersupport/IE11.js +0 -42
- package/src/features/browsersupport/IE11WithWebComponentsPolyfill.js +0 -5
- package/src/renderer/ifDefined.js +0 -21
- package/src/renderer/scopeHTML.js +0 -32
- package/src/theming/CSSVarsPonyfill.js +0 -68
- package/src/theming/adaptCSSForIE.js +0 -95
- package/src/theming/createComponentStyleTag.js +0 -54
- package/src/theming/createThemePropertiesStyleTag.js +0 -20
- package/src/thirdparty/Array.from.js +0 -16
- package/src/thirdparty/Array.prototype.fill.js +0 -44
- package/src/thirdparty/Array.prototype.find.js +0 -46
- package/src/thirdparty/Array.prototype.includes.js +0 -51
- package/src/thirdparty/Element.prototype.closest.js +0 -11
- package/src/thirdparty/Element.prototype.matches.js +0 -6
- package/src/thirdparty/Map.prototype.keys.js +0 -9
- package/src/thirdparty/Number.isInteger.js +0 -5
- package/src/thirdparty/Number.isNaN.js +0 -1
- package/src/thirdparty/Number.parseFloat.js +0 -1
- package/src/thirdparty/Number.parseInt.js +0 -1
- package/src/thirdparty/Object.assign.js +0 -31
- package/src/thirdparty/Object.entries.js +0 -11
- package/src/thirdparty/Symbol.js +0 -2
- package/src/thirdparty/WeakSet.js +0 -27
- package/src/thirdparty/es6-string-methods.js +0 -182
- package/src/thirdparty/events-polyfills.js +0 -89
- package/src/thirdparty/fetch.js +0 -1
- package/src/thirdparty/template.js +0 -600
- package/src/thirdparty/webcomponents-sd-ce-pf.js +0 -318
- package/src/util/EffectiveAssetPath.js +0 -27
- package/src/util/isSlot.js +0 -3
package/dist/EventProvider.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
class EventProvider {
|
|
2
2
|
constructor() {
|
|
3
|
-
this._eventRegistry =
|
|
3
|
+
this._eventRegistry = new Map();
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
attachEvent(eventName, fnFunction) {
|
|
7
7
|
const eventRegistry = this._eventRegistry;
|
|
8
|
-
|
|
8
|
+
const eventListeners = eventRegistry.get(eventName);
|
|
9
9
|
|
|
10
10
|
if (!Array.isArray(eventListeners)) {
|
|
11
|
-
eventRegistry
|
|
12
|
-
|
|
11
|
+
eventRegistry.set(eventName, [fnFunction]);
|
|
12
|
+
return;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
eventListeners.
|
|
16
|
-
|
|
17
|
-
}
|
|
15
|
+
if (!eventListeners.includes(fnFunction)) {
|
|
16
|
+
eventListeners.push(fnFunction);
|
|
17
|
+
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
detachEvent(eventName, fnFunction) {
|
|
21
21
|
const eventRegistry = this._eventRegistry;
|
|
22
|
-
|
|
22
|
+
const eventListeners = eventRegistry.get(eventName);
|
|
23
23
|
|
|
24
24
|
if (!eventListeners) {
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
+
const indexOfFnToDetach = eventListeners.indexOf(fnFunction);
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
29
|
+
if (indexOfFnToDetach !== -1) {
|
|
30
|
+
eventListeners.splice(indexOfFnToDetach, 1);
|
|
31
|
+
}
|
|
31
32
|
|
|
32
33
|
if (eventListeners.length === 0) {
|
|
33
|
-
delete
|
|
34
|
+
eventRegistry.delete(eventName);
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
39
|
* Fires an event and returns the results of all event listeners as an array.
|
|
39
|
-
* Example: If listeners return promises, you can: await fireEvent("myEvent") to know when all listeners have finished.
|
|
40
40
|
*
|
|
41
41
|
* @param eventName the event to fire
|
|
42
42
|
* @param data optional data to pass to each event listener
|
|
@@ -44,37 +44,41 @@ class EventProvider {
|
|
|
44
44
|
*/
|
|
45
45
|
fireEvent(eventName, data) {
|
|
46
46
|
const eventRegistry = this._eventRegistry;
|
|
47
|
-
const eventListeners = eventRegistry
|
|
47
|
+
const eventListeners = eventRegistry.get(eventName);
|
|
48
48
|
|
|
49
49
|
if (!eventListeners) {
|
|
50
50
|
return [];
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
return eventListeners.map(
|
|
54
|
-
return
|
|
53
|
+
return eventListeners.map(fn => {
|
|
54
|
+
return fn.call(this, data); // eslint-disable-line
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Fires an event and returns a promise that will resolve once all listeners have resolved.
|
|
60
|
+
*
|
|
61
|
+
* @param eventName the event to fire
|
|
62
|
+
* @param data optional data to pass to each event listener
|
|
63
|
+
* @returns {Promise} a promise that will resolve when all listeners have resolved
|
|
64
|
+
*/
|
|
65
|
+
fireEventAsync(eventName, data) {
|
|
66
|
+
return Promise.all(this.fireEvent(eventName, data));
|
|
67
|
+
}
|
|
68
|
+
|
|
58
69
|
isHandlerAttached(eventName, fnFunction) {
|
|
59
70
|
const eventRegistry = this._eventRegistry;
|
|
60
|
-
const eventListeners = eventRegistry
|
|
71
|
+
const eventListeners = eventRegistry.get(eventName);
|
|
61
72
|
|
|
62
73
|
if (!eventListeners) {
|
|
63
74
|
return false;
|
|
64
75
|
}
|
|
65
76
|
|
|
66
|
-
|
|
67
|
-
const event = eventListeners[i];
|
|
68
|
-
if (event["function"] === fnFunction) { // eslint-disable-line
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return false;
|
|
77
|
+
return eventListeners.includes(fnFunction);
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
hasListeners(eventName) {
|
|
77
|
-
return !!this._eventRegistry
|
|
81
|
+
return !!this._eventRegistry.get(eventName);
|
|
78
82
|
}
|
|
79
83
|
}
|
|
80
84
|
|
package/dist/FontFace.js
CHANGED
|
@@ -1,95 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
* CSS font face used for the texts provided by SAP.
|
|
3
|
-
*/
|
|
4
|
-
import createStyleInHead from "./util/createStyleInHead.js";
|
|
1
|
+
import { hasStyle, createStyle } from "./ManagedStyles.js";
|
|
5
2
|
import { getFeature } from "./FeaturesRegistry.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const font72RegularWoff = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular.woff?ui5-webcomponents`;
|
|
9
|
-
const font72RegularWoff2 = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular.woff2?ui5-webcomponents`;
|
|
10
|
-
|
|
11
|
-
const font72RegularFullWoff = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular-full.woff?ui5-webcomponents`;
|
|
12
|
-
const font72RegularFullWoff2 = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular-full.woff2?ui5-webcomponents`;
|
|
13
|
-
|
|
14
|
-
const font72BoldWoff = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff?ui5-webcomponents`;
|
|
15
|
-
const font72BoldWoff2 = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff2?ui5-webcomponents`;
|
|
16
|
-
|
|
17
|
-
const font72BoldFullWoff = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff?ui5-webcomponents`;
|
|
18
|
-
const font72BoldFullWoff2 = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff2?ui5-webcomponents`;
|
|
19
|
-
|
|
20
|
-
const fontFaceCSS = `
|
|
21
|
-
@font-face {
|
|
22
|
-
font-family: "72";
|
|
23
|
-
font-style: normal;
|
|
24
|
-
font-weight: 400;
|
|
25
|
-
src: local("72"),
|
|
26
|
-
url(${font72RegularWoff2}) format("woff2"),
|
|
27
|
-
url(${font72RegularWoff}) format("woff");
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@font-face {
|
|
31
|
-
font-family: "72full";
|
|
32
|
-
font-style: normal;
|
|
33
|
-
font-weight: 400;
|
|
34
|
-
src: local('72-full'),
|
|
35
|
-
url(${font72RegularFullWoff2}) format("woff2"),
|
|
36
|
-
url(${font72RegularFullWoff}) format("woff");
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@font-face {
|
|
41
|
-
font-family: "72";
|
|
42
|
-
font-style: normal;
|
|
43
|
-
font-weight: 700;
|
|
44
|
-
src: local('72-Bold'),
|
|
45
|
-
url(${font72BoldWoff2}) format("woff2"),
|
|
46
|
-
url(${font72BoldWoff}) format("woff");
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@font-face {
|
|
50
|
-
font-family: "72full";
|
|
51
|
-
font-style: normal;
|
|
52
|
-
font-weight: 700;
|
|
53
|
-
src: local('72-Bold-full'),
|
|
54
|
-
url(${font72BoldFullWoff2}) format("woff2"),
|
|
55
|
-
url(${font72BoldFullWoff}) format("woff");
|
|
56
|
-
}
|
|
57
|
-
`;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Some diacritics are supported by the 72 font:
|
|
61
|
-
* * Grave
|
|
62
|
-
* * Acute
|
|
63
|
-
* * Circumflex
|
|
64
|
-
* * Tilde
|
|
65
|
-
*
|
|
66
|
-
* However, the following diacritics and the combination of multiple diacritics (including the supported ones) are not supported:
|
|
67
|
-
* * Breve
|
|
68
|
-
* * Horn
|
|
69
|
-
* * Dot below
|
|
70
|
-
* * Hook above
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* Override for the characters that aren't covered by the '72' font to other system fonts
|
|
74
|
-
*
|
|
75
|
-
* U+0102-0103: A and a with Breve
|
|
76
|
-
* U+01A0-01A1: O and o with Horn
|
|
77
|
-
* U+01AF-01B0: U and u with Horn
|
|
78
|
-
* U+1EA0-1EB7: A and a with diacritics that are not supported by the font and combination of multiple diacritics
|
|
79
|
-
* U+1EB8-1EC7: E and e with diacritics that are not supported by the font and combination of multiple diacritics
|
|
80
|
-
* U+1EC8-1ECB: I and i with diacritics that are not supported by the font and combination of multiple diacritics
|
|
81
|
-
* U+1ECC-1EE3: O and o with diacritics that are not supported by the font and combination of multiple diacritics
|
|
82
|
-
* U+1EE4-1EF1: U and u with diacritics that are not supported by the font and combination of multiple diacritics
|
|
83
|
-
* U+1EF4-1EF7: Y and y with diacritics that are not supported by the font and combination of multiple diacritics
|
|
84
|
-
*
|
|
85
|
-
*/
|
|
86
|
-
const overrideFontFaceCSS = `
|
|
87
|
-
@font-face {
|
|
88
|
-
font-family: '72override';
|
|
89
|
-
unicode-range: U+0102-0103, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EB7, U+1EB8-1EC7, U+1EC8-1ECB, U+1ECC-1EE3, U+1EE4-1EF1, U+1EF4-1EF7;
|
|
90
|
-
src: local('Arial'), local('Helvetica'), local('sans-serif');
|
|
91
|
-
}
|
|
92
|
-
`;
|
|
3
|
+
import fontFaceCSS from "./generated/css/FontFace.css.js";
|
|
4
|
+
import overrideFontFaceCSS from "./generated/css/OverrideFontFace.css.js";
|
|
93
5
|
|
|
94
6
|
const insertFontFace = () => {
|
|
95
7
|
const OpenUI5Support = getFeature("OpenUI5Support");
|
|
@@ -104,14 +16,14 @@ const insertFontFace = () => {
|
|
|
104
16
|
};
|
|
105
17
|
|
|
106
18
|
const insertMainFontFace = () => {
|
|
107
|
-
if (!
|
|
108
|
-
|
|
19
|
+
if (!hasStyle("data-ui5-font-face")) {
|
|
20
|
+
createStyle(fontFaceCSS, "data-ui5-font-face");
|
|
109
21
|
}
|
|
110
22
|
};
|
|
111
23
|
|
|
112
24
|
const insertOverrideFontFace = () => {
|
|
113
|
-
if (!
|
|
114
|
-
|
|
25
|
+
if (!hasStyle("data-ui5-font-face-override")) {
|
|
26
|
+
createStyle(overrideFontFaceCSS, "data-ui5-font-face-override");
|
|
115
27
|
}
|
|
116
28
|
};
|
|
117
29
|
|
|
@@ -12,8 +12,7 @@ let initialConfig = {
|
|
|
12
12
|
calendarType: null,
|
|
13
13
|
noConflict: false, // no URL
|
|
14
14
|
formatSettings: {},
|
|
15
|
-
|
|
16
|
-
assetsPath: "",
|
|
15
|
+
fetchDefaultLanguage: false,
|
|
17
16
|
};
|
|
18
17
|
|
|
19
18
|
/* General settings */
|
|
@@ -38,13 +37,13 @@ const getLanguage = () => {
|
|
|
38
37
|
};
|
|
39
38
|
|
|
40
39
|
/**
|
|
41
|
-
* Returns if the default language, that is inlined build time,
|
|
42
|
-
* should be
|
|
40
|
+
* Returns if the default language, that is inlined at build time,
|
|
41
|
+
* should be fetched over the network instead.
|
|
43
42
|
* @returns {Boolean}
|
|
44
43
|
*/
|
|
45
|
-
const
|
|
44
|
+
const getFetchDefaultLanguage = () => {
|
|
46
45
|
initConfiguration();
|
|
47
|
-
return initialConfig.
|
|
46
|
+
return initialConfig.fetchDefaultLanguage;
|
|
48
47
|
};
|
|
49
48
|
|
|
50
49
|
const getNoConflict = () => {
|
|
@@ -62,11 +61,6 @@ const getFormatSettings = () => {
|
|
|
62
61
|
return initialConfig.formatSettings;
|
|
63
62
|
};
|
|
64
63
|
|
|
65
|
-
const getAssetsPath = () => {
|
|
66
|
-
initConfiguration();
|
|
67
|
-
return initialConfig.assetsPath;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
64
|
const booleanMapping = new Map();
|
|
71
65
|
booleanMapping.set("true", true);
|
|
72
66
|
booleanMapping.set("false", false);
|
|
@@ -92,23 +86,47 @@ const parseConfigurationScript = () => {
|
|
|
92
86
|
const parseURLParameters = () => {
|
|
93
87
|
const params = new URLSearchParams(window.location.search);
|
|
94
88
|
|
|
89
|
+
// Process "sap-*" params first
|
|
95
90
|
params.forEach((value, key) => {
|
|
96
|
-
|
|
91
|
+
const parts = key.split("sap-").length;
|
|
92
|
+
if (parts === 0 || parts === key.split("sap-ui-").length) {
|
|
97
93
|
return;
|
|
98
94
|
}
|
|
99
95
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const param = key.split("sap-ui-")[1];
|
|
96
|
+
applyURLParam(key, value, "sap");
|
|
97
|
+
});
|
|
103
98
|
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
// Process "sap-ui-*" params
|
|
100
|
+
params.forEach((value, key) => {
|
|
101
|
+
if (!key.startsWith("sap-ui")) {
|
|
102
|
+
return;
|
|
106
103
|
}
|
|
107
104
|
|
|
108
|
-
|
|
105
|
+
applyURLParam(key, value, "sap-ui");
|
|
109
106
|
});
|
|
110
107
|
};
|
|
111
108
|
|
|
109
|
+
const normalizeParamValue = (param, value) => {
|
|
110
|
+
if (param === "theme" && value.includes("@")) { // the theme parameter might have @<URL-TO-THEME> in the value - strip this
|
|
111
|
+
return value.split("@")[0];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return value;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const applyURLParam = (key, value, paramType) => {
|
|
118
|
+
const lowerCaseValue = value.toLowerCase();
|
|
119
|
+
const param = key.split(`${paramType}-`)[1];
|
|
120
|
+
|
|
121
|
+
if (booleanMapping.has(value)) {
|
|
122
|
+
value = booleanMapping.get(lowerCaseValue);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
value = normalizeParamValue(param, value);
|
|
126
|
+
|
|
127
|
+
initialConfig[param] = value;
|
|
128
|
+
};
|
|
129
|
+
|
|
112
130
|
const applyOpenUI5Configuration = () => {
|
|
113
131
|
const OpenUI5Support = getFeature("OpenUI5Support");
|
|
114
132
|
if (!OpenUI5Support || !OpenUI5Support.isLoaded()) {
|
|
@@ -119,7 +137,6 @@ const applyOpenUI5Configuration = () => {
|
|
|
119
137
|
initialConfig = merge(initialConfig, OpenUI5Config);
|
|
120
138
|
};
|
|
121
139
|
|
|
122
|
-
|
|
123
140
|
const initConfiguration = () => {
|
|
124
141
|
if (initialized) {
|
|
125
142
|
return;
|
|
@@ -142,9 +159,8 @@ export {
|
|
|
142
159
|
getTheme,
|
|
143
160
|
getRTL,
|
|
144
161
|
getLanguage,
|
|
145
|
-
|
|
162
|
+
getFetchDefaultLanguage,
|
|
146
163
|
getNoConflict,
|
|
147
164
|
getCalendarType,
|
|
148
165
|
getFormatSettings,
|
|
149
|
-
getAssetsPath,
|
|
150
166
|
};
|
package/dist/Keys.js
CHANGED
|
@@ -105,8 +105,12 @@ const KeyCodes = {
|
|
|
105
105
|
|
|
106
106
|
const isEnter = event => (event.key ? event.key === "Enter" : event.keyCode === KeyCodes.ENTER) && !hasModifierKeys(event);
|
|
107
107
|
|
|
108
|
+
const isEnterShift = event => (event.key ? event.key === "Enter" : event.keyCode === KeyCodes.ENTER) && checkModifierKeys(event, false, false, true);
|
|
109
|
+
|
|
108
110
|
const isSpace = event => (event.key ? (event.key === "Spacebar" || event.key === " ") : event.keyCode === KeyCodes.SPACE) && !hasModifierKeys(event);
|
|
109
111
|
|
|
112
|
+
const isSpaceShift = event => (event.key ? (event.key === "Spacebar" || event.key === " ") : event.keyCode === KeyCodes.SPACE) && checkModifierKeys(event, false, false, true);
|
|
113
|
+
|
|
110
114
|
const isLeft = event => (event.key ? (event.key === "ArrowLeft" || event.key === "Left") : event.keyCode === KeyCodes.ARROW_LEFT) && !hasModifierKeys(event);
|
|
111
115
|
|
|
112
116
|
const isRight = event => (event.key ? (event.key === "ArrowRight" || event.key === "Right") : event.keyCode === KeyCodes.ARROW_RIGHT) && !hasModifierKeys(event);
|
|
@@ -115,6 +119,26 @@ const isUp = event => (event.key ? (event.key === "ArrowUp" || event.key === "Up
|
|
|
115
119
|
|
|
116
120
|
const isDown = event => (event.key ? (event.key === "ArrowDown" || event.key === "Down") : event.keyCode === KeyCodes.ARROW_DOWN) && !hasModifierKeys(event);
|
|
117
121
|
|
|
122
|
+
const isLeftCtrl = event => (event.key ? (event.key === "ArrowLeft" || event.key === "Left") : event.keyCode === KeyCodes.ARROW_LEFT) && checkModifierKeys(event, true, false, false);
|
|
123
|
+
|
|
124
|
+
const isRightCtrl = event => (event.key ? (event.key === "ArrowRight" || event.key === "Right") : event.keyCode === KeyCodes.ARROW_RIGHT) && checkModifierKeys(event, true, false, false);
|
|
125
|
+
|
|
126
|
+
const isUpCtrl = event => (event.key ? (event.key === "ArrowUp" || event.key === "Up") : event.keyCode === KeyCodes.ARROW_UP) && checkModifierKeys(event, true, false, false);
|
|
127
|
+
|
|
128
|
+
const isDownCtrl = event => (event.key ? (event.key === "ArrowDown" || event.key === "Down") : event.keyCode === KeyCodes.ARROW_DOWN) && checkModifierKeys(event, true, false, false);
|
|
129
|
+
|
|
130
|
+
const isUpShift = event => (event.key ? (event.key === "ArrowUp" || event.key === "Up") : event.keyCode === KeyCodes.ARROW_UP) && checkModifierKeys(event, false, false, true);
|
|
131
|
+
|
|
132
|
+
const isDownShift = event => (event.key ? (event.key === "ArrowDown" || event.key === "Down") : event.keyCode === KeyCodes.ARROW_DOWN) && checkModifierKeys(event, false, false, true);
|
|
133
|
+
|
|
134
|
+
const isLeftShift = event => (event.key ? (event.key === "ArrowLeft" || event.key === "Left") : event.keyCode === KeyCodes.ARROW_LEFT) && checkModifierKeys(event, false, false, true);
|
|
135
|
+
|
|
136
|
+
const isRightShift = event => (event.key ? (event.key === "ArrowRight" || event.key === "Right") : event.keyCode === KeyCodes.ARROW_RIGHT) && checkModifierKeys(event, false, false, true);
|
|
137
|
+
|
|
138
|
+
const isUpShiftCtrl = event => (event.key ? (event.key === "ArrowUp" || event.key === "Up") : event.keyCode === KeyCodes.ARROW_UP) && checkModifierKeys(event, true, false, true);
|
|
139
|
+
|
|
140
|
+
const isDownShiftCtrl = event => (event.key ? (event.key === "ArrowDown" || event.key === "Down") : event.keyCode === KeyCodes.ARROW_DOWN) && checkModifierKeys(event, true, false, true);
|
|
141
|
+
|
|
118
142
|
const isHome = event => (event.key ? event.key === "Home" : event.keyCode === KeyCodes.HOME) && !hasModifierKeys(event);
|
|
119
143
|
|
|
120
144
|
const isEnd = event => (event.key ? event.key === "End" : event.keyCode === KeyCodes.END) && !hasModifierKeys(event);
|
|
@@ -139,12 +163,20 @@ const isPageDown = event => (event.key ? event.key === "PageDown" : event.keyCod
|
|
|
139
163
|
|
|
140
164
|
const isPageUpShift = event => (event.key ? event.key === "PageUp" : event.keyCode === KeyCodes.PAGE_UP) && checkModifierKeys(event, false, false, true);
|
|
141
165
|
|
|
166
|
+
const isPageUpAlt = event => (event.key ? event.key === "PageUp" : event.keyCode === KeyCodes.PAGE_UP) && checkModifierKeys(event, false, true, false);
|
|
167
|
+
|
|
142
168
|
const isPageDownShift = event => (event.key ? event.key === "PageDown" : event.keyCode === KeyCodes.PAGE_DOWN) && checkModifierKeys(event, false, false, true);
|
|
143
169
|
|
|
170
|
+
const isPageDownAlt = event => (event.key ? event.key === "PageDown" : event.keyCode === KeyCodes.PAGE_DOWN) && checkModifierKeys(event, false, true, false);
|
|
171
|
+
|
|
144
172
|
const isPageUpShiftCtrl = event => (event.key ? event.key === "PageUp" : event.keyCode === KeyCodes.PAGE_UP) && checkModifierKeys(event, true, false, true);
|
|
145
173
|
|
|
146
174
|
const isPageDownShiftCtrl = event => (event.key ? event.key === "PageDown" : event.keyCode === KeyCodes.PAGE_DOWN) && checkModifierKeys(event, true, false, true);
|
|
147
175
|
|
|
176
|
+
const isPlus = event => (event.key ? event.key === "+" : event.keyCode === KeyCodes.PLUS) || (event.keyCode === KeyCodes.NUMPAD_PLUS && !hasModifierKeys(event));
|
|
177
|
+
|
|
178
|
+
const isMinus = event => (event.key ? event.key === "-" : event.keyCode === KeyCodes.MINUS) || (event.keyCode === KeyCodes.NUMPAD_MINUS && !hasModifierKeys(event));
|
|
179
|
+
|
|
148
180
|
const isShow = event => {
|
|
149
181
|
if (event.key) {
|
|
150
182
|
return isF4(event) || isShowByArrows(event);
|
|
@@ -159,6 +191,8 @@ const isF4 = event => {
|
|
|
159
191
|
|
|
160
192
|
const isF4Shift = event => (event.key ? event.key === "F4" : event.keyCode === KeyCodes.F4) && checkModifierKeys(event, false, false, true);
|
|
161
193
|
|
|
194
|
+
const isF7 = event => (event.key ? event.key === "F7" : event.keyCode === KeyCodes.F7) && !hasModifierKeys(event);
|
|
195
|
+
|
|
162
196
|
const isShowByArrows = event => {
|
|
163
197
|
return ((event.key === "ArrowDown" || event.key === "Down") || (event.key === "ArrowUp" || event.key === "Up")) && checkModifierKeys(event, /* Ctrl */ false, /* Alt */ true, /* Shift */ false);
|
|
164
198
|
};
|
|
@@ -171,13 +205,27 @@ const checkModifierKeys = (event, bCtrlKey, bAltKey, bShiftKey) => event.shiftKe
|
|
|
171
205
|
|
|
172
206
|
export {
|
|
173
207
|
isEnter,
|
|
208
|
+
isEnterShift,
|
|
174
209
|
isSpace,
|
|
210
|
+
isSpaceShift,
|
|
175
211
|
isLeft,
|
|
176
212
|
isRight,
|
|
177
213
|
isUp,
|
|
178
214
|
isDown,
|
|
215
|
+
isLeftCtrl,
|
|
216
|
+
isRightCtrl,
|
|
217
|
+
isUpCtrl,
|
|
218
|
+
isDownCtrl,
|
|
219
|
+
isUpShift,
|
|
220
|
+
isDownShift,
|
|
221
|
+
isLeftShift,
|
|
222
|
+
isRightShift,
|
|
223
|
+
isUpShiftCtrl,
|
|
224
|
+
isDownShiftCtrl,
|
|
179
225
|
isHome,
|
|
180
226
|
isEnd,
|
|
227
|
+
isPlus,
|
|
228
|
+
isMinus,
|
|
181
229
|
isHomeCtrl,
|
|
182
230
|
isEndCtrl,
|
|
183
231
|
isEscape,
|
|
@@ -188,10 +236,13 @@ export {
|
|
|
188
236
|
isShow,
|
|
189
237
|
isF4,
|
|
190
238
|
isF4Shift,
|
|
239
|
+
isF7,
|
|
191
240
|
isPageUp,
|
|
192
241
|
isPageDown,
|
|
193
242
|
isPageUpShift,
|
|
243
|
+
isPageUpAlt,
|
|
194
244
|
isPageDownShift,
|
|
245
|
+
isPageDownAlt,
|
|
195
246
|
isPageUpShiftCtrl,
|
|
196
247
|
isPageDownShiftCtrl,
|
|
197
248
|
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import createStyleInHead from "./util/createStyleInHead.js";
|
|
2
|
+
import createLinkInHead from "./util/createLinkInHead.js";
|
|
3
|
+
import { shouldUseLinks, getUrl } from "./CSP.js";
|
|
4
|
+
|
|
5
|
+
const getStyleId = (name, value) => {
|
|
6
|
+
return value ? `${name}|${value}` : name;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const createStyle = (data, name, value = "") => {
|
|
10
|
+
const content = typeof data === "string" ? data : data.content;
|
|
11
|
+
|
|
12
|
+
if (shouldUseLinks()) {
|
|
13
|
+
const attributes = {};
|
|
14
|
+
attributes[name] = value;
|
|
15
|
+
const href = getUrl(data.packageName, data.fileName);
|
|
16
|
+
createLinkInHead(href, attributes);
|
|
17
|
+
} else if (document.adoptedStyleSheets) {
|
|
18
|
+
const stylesheet = new CSSStyleSheet();
|
|
19
|
+
stylesheet.replaceSync(content);
|
|
20
|
+
stylesheet._ui5StyleId = getStyleId(name, value); // set an id so that we can find the style later
|
|
21
|
+
document.adoptedStyleSheets = [...document.adoptedStyleSheets, stylesheet];
|
|
22
|
+
} else {
|
|
23
|
+
const attributes = {};
|
|
24
|
+
attributes[name] = value;
|
|
25
|
+
createStyleInHead(content, attributes);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const updateStyle = (data, name, value = "") => {
|
|
30
|
+
const content = typeof data === "string" ? data : data.content;
|
|
31
|
+
|
|
32
|
+
if (shouldUseLinks()) {
|
|
33
|
+
document.querySelector(`head>link[${name}="${value}"]`).href = getUrl(data.packageName, data.fileName);
|
|
34
|
+
} else if (document.adoptedStyleSheets) {
|
|
35
|
+
document.adoptedStyleSheets.find(sh => sh._ui5StyleId === getStyleId(name, value)).replaceSync(content || "");
|
|
36
|
+
} else {
|
|
37
|
+
document.querySelector(`head>style[${name}="${value}"]`).textContent = content || "";
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const hasStyle = (name, value = "") => {
|
|
42
|
+
if (shouldUseLinks()) {
|
|
43
|
+
return !!document.querySelector(`head>link[${name}="${value}"]`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (document.adoptedStyleSheets) {
|
|
47
|
+
return !!document.adoptedStyleSheets.find(sh => sh._ui5StyleId === getStyleId(name, value));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return !!document.querySelector(`head>style[${name}="${value}"]`);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const removeStyle = (name, value = "") => {
|
|
54
|
+
if (shouldUseLinks()) {
|
|
55
|
+
const linkElement = document.querySelector(`head>link[${name}="${value}"]`);
|
|
56
|
+
if (linkElement) {
|
|
57
|
+
linkElement.parentElement.removeChild(linkElement);
|
|
58
|
+
}
|
|
59
|
+
} else if (document.adoptedStyleSheets) {
|
|
60
|
+
document.adoptedStyleSheets = document.adoptedStyleSheets.filter(sh => sh._ui5StyleId !== getStyleId(name, value));
|
|
61
|
+
} else {
|
|
62
|
+
const styleElement = document.querySelector(`head > style[${name}="${value}"]`);
|
|
63
|
+
if (styleElement) {
|
|
64
|
+
styleElement.parentElement.removeChild(styleElement);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const createOrUpdateStyle = (data, name, value = "") => {
|
|
70
|
+
if (hasStyle(name, value)) {
|
|
71
|
+
updateStyle(data, name, value);
|
|
72
|
+
} else {
|
|
73
|
+
createStyle(data, name, value);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export {
|
|
78
|
+
createStyle,
|
|
79
|
+
hasStyle,
|
|
80
|
+
updateStyle,
|
|
81
|
+
removeStyle,
|
|
82
|
+
createOrUpdateStyle,
|
|
83
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
const querySets = {};
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Initializes a screen width media query range set.
|
|
5
|
+
*
|
|
6
|
+
* This initialization step makes the range set ready to be used for one of the other functions in namespace <code>MediaRange</code>.
|
|
7
|
+
*
|
|
8
|
+
* A range set can be defined as shown in the following example:
|
|
9
|
+
* <pre>
|
|
10
|
+
* MediaRange.initRangeSet("MyRangeSet", [200, 400], ["Small", "Medium", "Large"]);
|
|
11
|
+
* </pre>
|
|
12
|
+
* This example defines the following named ranges:
|
|
13
|
+
* <ul>
|
|
14
|
+
* <li><code>"Small"</code>: For screens smaller than 200 pixels.</li>
|
|
15
|
+
* <li><code>"Medium"</code>: For screens greater than or equal to 200 pixels and smaller than 400 pixels.</li>
|
|
16
|
+
* <li><code>"Large"</code>: For screens greater than or equal to 400 pixels.</li>
|
|
17
|
+
* </ul>
|
|
18
|
+
*
|
|
19
|
+
* @param {string} name The name of the range set to be initialized.
|
|
20
|
+
* The name must be a valid id and consist only of letters and numeric digits.
|
|
21
|
+
*
|
|
22
|
+
* @param {int[]} [borders] The range borders
|
|
23
|
+
*
|
|
24
|
+
* @param {string[]} [names] The names of the ranges. The names must be a valid id and consist only of letters and digits.
|
|
25
|
+
*
|
|
26
|
+
* @name MediaRange.initRangeSet
|
|
27
|
+
* @function
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
const _initRangeSet = (name, borders, names) => {
|
|
31
|
+
querySets[name] = {
|
|
32
|
+
borders,
|
|
33
|
+
names,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Returns information about the current active range of the range set with the given name.
|
|
39
|
+
*
|
|
40
|
+
* If the optional parameter <code>width</code> is given, the active range will be determined for that width,
|
|
41
|
+
* otherwise it is determined for the current window size.
|
|
42
|
+
*
|
|
43
|
+
* @param {string} name The name of the range set. The range set must be initialized beforehand ({@link MediaRange.initRangeSet})
|
|
44
|
+
* @param {int} [width] An optional width, based on which the range should be determined;
|
|
45
|
+
* If <code>width</code> is not provided, the window size will be used.
|
|
46
|
+
* @returns {string} The name of the current active interval of the range set.
|
|
47
|
+
*
|
|
48
|
+
* @name MediaRange.getCurrentRange
|
|
49
|
+
* @function
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
const _getCurrentRange = (name, width = window.innerWidth) => {
|
|
53
|
+
const querySet = querySets[name];
|
|
54
|
+
let i = 0;
|
|
55
|
+
|
|
56
|
+
if (!querySet) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
for (; i < querySet.borders.length; i++) {
|
|
61
|
+
if (width < querySet.borders[i]) {
|
|
62
|
+
return querySet.names[i];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return querySet.names[i];
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Enumeration containing the names and settings of predefined screen width media query range sets.
|
|
71
|
+
*
|
|
72
|
+
* @namespace
|
|
73
|
+
* @name MediaRange.RANGESETS
|
|
74
|
+
* @public
|
|
75
|
+
*/
|
|
76
|
+
const RANGESETS = {
|
|
77
|
+
/**
|
|
78
|
+
* A 4-step range set (S-M-L-XL).
|
|
79
|
+
*
|
|
80
|
+
* The ranges of this set are:
|
|
81
|
+
* <ul>
|
|
82
|
+
* <li><code>"S"</code>: For screens smaller than 600 pixels.</li>
|
|
83
|
+
* <li><code>"M"</code>: For screens greater than or equal to 600 pixels and smaller than 1024 pixels.</li>
|
|
84
|
+
* <li><code>"L"</code>: For screens greater than or equal to 1024 pixels and smaller than 1440 pixels.</li>
|
|
85
|
+
* <li><code>"XL"</code>: For screens greater than or equal to 1440 pixels.</li>
|
|
86
|
+
* </ul>
|
|
87
|
+
*
|
|
88
|
+
* @name MediaRange.RANGESETS.RANGE_4STEPS
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
RANGE_4STEPS: "4Step",
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* API for screen width changes.
|
|
96
|
+
*
|
|
97
|
+
* @namespace
|
|
98
|
+
* @name MediaRange
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
const MediaRange = {
|
|
102
|
+
RANGESETS,
|
|
103
|
+
initRangeSet: _initRangeSet,
|
|
104
|
+
getCurrentRange: _getCurrentRange,
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
MediaRange.initRangeSet(MediaRange.RANGESETS.RANGE_4STEPS, [600, 1024, 1440], ["S", "M", "L", "XL"]);
|
|
108
|
+
|
|
109
|
+
export default MediaRange;
|
|
@@ -15,6 +15,12 @@ const mEscapes = {
|
|
|
15
15
|
"\\t": "\t",
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Parses a .properties format
|
|
20
|
+
* @param {string} sText the contents a of a .properties file
|
|
21
|
+
* @returns a object with key/value pairs parsed from the .properties file format
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
18
24
|
const parseProperties = sText => {
|
|
19
25
|
const properties = {},
|
|
20
26
|
aLines = sText.split(rLines);
|