@ui5/webcomponents-base 0.0.0-96e98c995 → 0.0.0-97cba4b0b
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 +1 -0
- package/CHANGELOG.md +83 -0
- package/bundle.esm.js +3 -1
- package/dist/Boot.d.ts +4 -3
- package/dist/Boot.js +17 -4
- package/dist/Boot.js.map +1 -1
- package/dist/Device.js +109 -34
- package/dist/Device.js.map +1 -1
- package/dist/InitialConfiguration.js +1 -1
- package/dist/InitialConfiguration.js.map +1 -1
- package/dist/UI5Element.d.ts +20 -15
- package/dist/UI5Element.js +10 -22
- package/dist/UI5Element.js.map +1 -1
- package/dist/api.json +1 -1
- package/dist/asset-registries/Icons.d.ts +1 -1
- package/dist/asset-registries/Icons.js +21 -21
- package/dist/asset-registries/Icons.js.map +1 -1
- package/dist/asset-registries/Illustrations.d.ts +1 -1
- package/dist/asset-registries/Themes.d.ts +1 -0
- package/dist/assets/Boot.1c716721.js +9 -0
- package/dist/assets/Boot.6335ce08.css +1 -0
- package/dist/assets/bundle.esm.2f0ab67f.js +52 -0
- package/dist/assets-meta/IconCollectionsAlias.d.ts +24 -10
- package/dist/assets-meta/IconCollectionsAlias.js +29 -9
- package/dist/assets-meta/IconCollectionsAlias.js.map +1 -1
- package/dist/config/FormatSettings.d.ts +5 -1
- package/dist/config/FormatSettings.js +5 -1
- package/dist/config/FormatSettings.js.map +1 -1
- package/dist/config/Icons.d.ts +43 -18
- package/dist/config/Icons.js +80 -25
- package/dist/config/Icons.js.map +1 -1
- package/dist/config/RTL.js +3 -0
- package/dist/config/RTL.js.map +1 -1
- package/dist/decorators/customElement.d.ts +17 -2
- package/dist/decorators/customElement.js +20 -5
- package/dist/decorators/customElement.js.map +1 -1
- package/dist/decorators/event.js +6 -6
- package/dist/decorators/event.js.map +1 -1
- package/dist/decorators/property.js +6 -6
- package/dist/decorators/property.js.map +1 -1
- package/dist/decorators/slot.js +7 -7
- package/dist/decorators/slot.js.map +1 -1
- package/dist/delegate/ResizeHandler.d.ts +2 -1
- package/dist/delegate/ResizeHandler.js +3 -1
- package/dist/delegate/ResizeHandler.js.map +1 -1
- package/dist/features/F6Navigation.d.ts +3 -0
- package/dist/features/F6Navigation.js +77 -38
- package/dist/features/F6Navigation.js.map +1 -1
- package/dist/features/LegacyDateFormats.d.ts +18 -0
- package/dist/features/LegacyDateFormats.js +20 -0
- package/dist/features/LegacyDateFormats.js.map +1 -0
- package/dist/features/OpenUI5Support.d.ts +2 -0
- package/dist/features/OpenUI5Support.js +1 -0
- package/dist/features/OpenUI5Support.js.map +1 -1
- package/dist/generated/VersionInfo.js +3 -3
- package/dist/generated/css/BusyIndicator.css.d.ts +3 -0
- package/dist/generated/css/BusyIndicator.css.js +7 -5
- package/dist/generated/css/BusyIndicator.css.js.map +1 -0
- package/dist/generated/css/FontFace.css.d.ts +3 -0
- package/dist/generated/css/FontFace.css.js +7 -5
- package/dist/generated/css/FontFace.css.js.map +1 -0
- package/dist/generated/css/OverrideFontFace.css.d.ts +3 -0
- package/dist/generated/css/OverrideFontFace.css.js +7 -5
- package/dist/generated/css/OverrideFontFace.css.js.map +1 -0
- package/dist/generated/css/SystemCSSVars.css.d.ts +3 -0
- package/dist/generated/css/SystemCSSVars.css.js +7 -5
- package/dist/generated/css/SystemCSSVars.css.js.map +1 -0
- package/dist/getSharedResource.js +9 -1
- package/dist/getSharedResource.js.map +1 -1
- package/dist/global.d.ts +0 -6
- package/dist/renderer/LitRenderer.d.ts +3 -3
- package/dist/renderer/LitRenderer.js.map +1 -1
- package/dist/theming/CustomStyle.js +7 -5
- package/dist/theming/CustomStyle.js.map +1 -1
- package/dist/theming/getStylesString.d.ts +1 -1
- package/dist/types/AnimationMode.d.ts +1 -1
- package/dist/types/AnimationMode.js +1 -1
- package/dist/types/CSSColor.d.ts +0 -1
- package/dist/types/CSSColor.js +0 -1
- package/dist/types/CSSColor.js.map +1 -1
- package/dist/types/CalendarType.d.ts +1 -1
- package/dist/types/CalendarType.js +1 -1
- package/dist/types/Float.d.ts +0 -1
- package/dist/types/Float.js +0 -1
- package/dist/types/Float.js.map +1 -1
- package/dist/types/Integer.d.ts +0 -1
- package/dist/types/Integer.js +0 -1
- package/dist/types/Integer.js.map +1 -1
- package/dist/types/InvisibleMessageMode.d.ts +1 -1
- package/dist/types/InvisibleMessageMode.js +1 -1
- package/dist/types/ItemNavigationBehavior.d.ts +1 -1
- package/dist/types/ItemNavigationBehavior.js +1 -1
- package/dist/types/NavigationMode.d.ts +1 -1
- package/dist/types/NavigationMode.js +1 -1
- package/dist/types/ValueState.d.ts +1 -1
- package/dist/types/ValueState.js +1 -1
- package/dist/updateShadowRoot.js +4 -0
- package/dist/updateShadowRoot.js.map +1 -1
- package/dist/util/AriaLabelHelper.d.ts +10 -1
- package/dist/util/AriaLabelHelper.js +135 -8
- package/dist/util/AriaLabelHelper.js.map +1 -1
- package/dist/util/FocusableElements.js +11 -2
- package/dist/util/FocusableElements.js.map +1 -1
- package/dist/util/getClassCopy.d.ts +8 -10
- package/lib/generate-styles/index.js +10 -5
- package/package-scripts.js +8 -4
- package/package.json +2 -2
- package/src/Boot.ts +20 -5
- package/src/Device.ts +113 -34
- package/src/InitialConfiguration.ts +1 -1
- package/src/UI5Element.ts +31 -27
- package/src/asset-registries/Icons.ts +26 -27
- package/src/asset-registries/Illustrations.ts +1 -1
- package/src/asset-registries/Themes.ts +5 -0
- package/src/assets-meta/IconCollectionsAlias.ts +32 -9
- package/src/config/FormatSettings.ts +16 -2
- package/src/config/Icons.ts +92 -25
- package/src/config/RTL.ts +4 -0
- package/src/decorators/customElement.ts +45 -5
- package/src/decorators/event.ts +6 -6
- package/src/decorators/property.ts +6 -6
- package/src/decorators/slot.ts +7 -7
- package/src/delegate/ResizeHandler.ts +7 -2
- package/src/features/F6Navigation.ts +98 -44
- package/src/features/LegacyDateFormats.ts +40 -0
- package/src/features/OpenUI5Support.ts +5 -0
- package/src/generated/css/BusyIndicator.css.ts +9 -0
- package/src/generated/css/FontFace.css.ts +9 -0
- package/src/generated/css/OverrideFontFace.css.ts +9 -0
- package/src/generated/css/SystemCSSVars.css.ts +9 -0
- package/src/getSharedResource.ts +10 -1
- package/src/global.d.ts +0 -6
- package/src/renderer/LitRenderer.ts +2 -2
- package/src/theming/CustomStyle.ts +7 -5
- package/src/theming/getEffectiveLinksHrefs.ts +1 -1
- package/src/theming/getStylesString.ts +1 -1
- package/src/types/AnimationMode.ts +1 -1
- package/src/types/CSSColor.ts +0 -1
- package/src/types/CalendarType.ts +1 -1
- package/src/types/Float.ts +0 -1
- package/src/types/Integer.ts +0 -1
- package/src/types/InvisibleMessageMode.ts +1 -1
- package/src/types/ItemNavigationBehavior.ts +1 -1
- package/src/types/NavigationMode.ts +1 -1
- package/src/types/ValueState.ts +1 -1
- package/src/updateShadowRoot.ts +5 -0
- package/src/util/AriaLabelHelper.ts +167 -12
- package/src/util/FocusableElements.ts +12 -2
- package/dist/assets/bundle.esm.ba5d36d4.js +0 -56
- package/dist/decorators/fastNavigation.d.ts +0 -7
- package/dist/decorators/fastNavigation.js +0 -13
- package/dist/decorators/fastNavigation.js.map +0 -1
- package/dist/decorators/languageAware.d.ts +0 -7
- package/dist/decorators/languageAware.js +0 -13
- package/dist/decorators/languageAware.js.map +0 -1
- package/dist/decorators/themeAware.d.ts +0 -7
- package/dist/decorators/themeAware.js +0 -13
- package/dist/decorators/themeAware.js.map +0 -1
- package/src/decorators/fastNavigation.ts +0 -14
- package/src/decorators/languageAware.ts +0 -14
- package/src/decorators/themeAware.ts +0 -14
package/package-scripts.js
CHANGED
|
@@ -14,9 +14,9 @@ const viteConfig = `-c "${require.resolve("@ui5/webcomponents-tools/components-p
|
|
|
14
14
|
const eslintConfig = `--config ${require.resolve("@ui5/webcomponents-tools/components-package/eslint.js")}`;
|
|
15
15
|
|
|
16
16
|
const scripts = {
|
|
17
|
-
clean: "rimraf jsdoc-dist && rimraf dist && rimraf .port",
|
|
17
|
+
clean: "rimraf jsdoc-dist && rimraf src/generated && rimraf dist && rimraf .port",
|
|
18
18
|
lint: `eslint . ${eslintConfig}`,
|
|
19
|
-
prepare: "nps clean integrate copy
|
|
19
|
+
prepare: "cross-env UI5_TS=true nps clean integrate copy generateAssetParameters generateVersionInfo generateStyles generateTemplates typescript generateAPI",
|
|
20
20
|
typescript: "tsc",
|
|
21
21
|
integrate: {
|
|
22
22
|
default: "nps integrate.copy-used-modules integrate.replace-amd integrate.amd-to-es6 integrate.esm-abs-to-rel integrate.third-party",
|
|
@@ -31,7 +31,7 @@ const scripts = {
|
|
|
31
31
|
},
|
|
32
32
|
},
|
|
33
33
|
build: {
|
|
34
|
-
default: `nps lint
|
|
34
|
+
default: `nps prepare lint build.bundle`,
|
|
35
35
|
bundle: `vite build ${viteConfig}`,
|
|
36
36
|
},
|
|
37
37
|
copy: {
|
|
@@ -58,7 +58,11 @@ const scripts = {
|
|
|
58
58
|
styles: 'chokidar "src/css/*.css" -c "nps generateStyles"'
|
|
59
59
|
},
|
|
60
60
|
start: "nps prepare watch.withBundle",
|
|
61
|
-
test:
|
|
61
|
+
test: {
|
|
62
|
+
default: 'concurrently "nps test.wdio"',
|
|
63
|
+
ssr: `mocha test/ssr`,
|
|
64
|
+
wdio: `node "${LIB}/test-runner/test-runner.js"`
|
|
65
|
+
},
|
|
62
66
|
};
|
|
63
67
|
|
|
64
68
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/webcomponents-base",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-97cba4b0b",
|
|
4
4
|
"description": "UI5 Web Components: webcomponents.base",
|
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@buxlabs/amd-to-es6": "0.16.1",
|
|
38
38
|
"@openui5/sap.ui.core": "1.109.0",
|
|
39
|
-
"@ui5/webcomponents-tools": "0.0.0-
|
|
39
|
+
"@ui5/webcomponents-tools": "0.0.0-97cba4b0b",
|
|
40
40
|
"chromedriver": "109.0.0",
|
|
41
41
|
"clean-css": "^5.2.2",
|
|
42
42
|
"copy-and-watch": "^0.1.5",
|
package/src/Boot.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import whenDOMReady from "./util/whenDOMReady.js";
|
|
2
|
+
import EventProvider from "./EventProvider.js";
|
|
2
3
|
import insertFontFace from "./FontFace.js";
|
|
3
4
|
import insertSystemCSSVars from "./SystemCSSVars.js";
|
|
4
5
|
import { getTheme } from "./config/Theme.js";
|
|
@@ -9,15 +10,22 @@ import type OpenUI5Support from "./features/OpenUI5Support.js";
|
|
|
9
10
|
import type F6Navigation from "./features/F6Navigation.js";
|
|
10
11
|
import { PromiseResolve } from "./types.js";
|
|
11
12
|
|
|
13
|
+
let booted = false;
|
|
12
14
|
let bootPromise: Promise<void>;
|
|
15
|
+
const eventProvider = new EventProvider<void, void>();
|
|
13
16
|
|
|
14
17
|
/**
|
|
15
|
-
*
|
|
18
|
+
* Attaches a callback that will be executed after boot finishes.
|
|
19
|
+
* <b>Note:</b> If the framework already booted, the callback will be immediately executed.
|
|
16
20
|
* @public
|
|
17
|
-
* @param listener
|
|
21
|
+
* @param { Function } listener
|
|
18
22
|
*/
|
|
19
|
-
const attachBoot =
|
|
20
|
-
|
|
23
|
+
const attachBoot = (listener: () => void) => {
|
|
24
|
+
if (!booted) {
|
|
25
|
+
eventProvider.attachEvent("boot", listener);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
21
29
|
listener();
|
|
22
30
|
};
|
|
23
31
|
|
|
@@ -27,6 +35,11 @@ const boot = async (): Promise<void> => {
|
|
|
27
35
|
}
|
|
28
36
|
|
|
29
37
|
const bootExecutor = async (resolve: PromiseResolve) => {
|
|
38
|
+
if (typeof document === "undefined") {
|
|
39
|
+
resolve();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
30
43
|
registerCurrentRuntime();
|
|
31
44
|
|
|
32
45
|
const openUI5Support = getFeature<typeof OpenUI5Support>("OpenUI5Support");
|
|
@@ -48,10 +61,12 @@ const boot = async (): Promise<void> => {
|
|
|
48
61
|
insertSystemCSSVars();
|
|
49
62
|
|
|
50
63
|
resolve();
|
|
64
|
+
|
|
65
|
+
booted = true;
|
|
66
|
+
await eventProvider.fireEventAsync("boot");
|
|
51
67
|
};
|
|
52
68
|
|
|
53
69
|
bootPromise = new Promise(bootExecutor as (resolve: PromiseResolve) => void);
|
|
54
|
-
|
|
55
70
|
return bootPromise;
|
|
56
71
|
};
|
|
57
72
|
|
package/src/Device.ts
CHANGED
|
@@ -1,30 +1,98 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
const isSSR = typeof document === "undefined";
|
|
2
|
+
|
|
3
|
+
const internals = {
|
|
4
|
+
get userAgent() {
|
|
5
|
+
if (isSSR) {
|
|
6
|
+
return "";
|
|
7
|
+
}
|
|
8
|
+
return navigator.userAgent;
|
|
9
|
+
},
|
|
10
|
+
get touch() {
|
|
11
|
+
if (isSSR) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
return "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
15
|
+
},
|
|
16
|
+
get ie() {
|
|
17
|
+
if (isSSR) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
return /(msie|trident)/i.test(internals.userAgent);
|
|
21
|
+
},
|
|
22
|
+
get chrome() {
|
|
23
|
+
if (isSSR) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return !internals.ie && /(Chrome|CriOS)/.test(internals.userAgent);
|
|
27
|
+
},
|
|
28
|
+
get firefox() {
|
|
29
|
+
if (isSSR) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
return /Firefox/.test(internals.userAgent);
|
|
33
|
+
},
|
|
34
|
+
get safari() {
|
|
35
|
+
if (isSSR) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
return !internals.ie && !internals.chrome && /(Version|PhantomJS)\/(\d+\.\d+).*Safari/.test(internals.userAgent);
|
|
39
|
+
},
|
|
40
|
+
get webkit() {
|
|
41
|
+
if (isSSR) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
return !internals.ie && /webkit/.test(internals.userAgent);
|
|
45
|
+
},
|
|
46
|
+
get windows() {
|
|
47
|
+
if (isSSR) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
return navigator.platform.indexOf("Win") !== -1;
|
|
51
|
+
},
|
|
52
|
+
get iOS() {
|
|
53
|
+
if (isSSR) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
return !!(navigator.platform.match(/iPhone|iPad|iPod/)) || !!(internals.userAgent.match(/Mac/) && "ontouchend" in document);
|
|
57
|
+
},
|
|
58
|
+
get android() {
|
|
59
|
+
if (isSSR) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
return !internals.windows && /Android/.test(internals.userAgent);
|
|
63
|
+
},
|
|
64
|
+
get androidPhone() {
|
|
65
|
+
if (isSSR) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
return internals.android && /(?=android)(?=.*mobile)/i.test(internals.userAgent);
|
|
69
|
+
},
|
|
70
|
+
get ipad() {
|
|
71
|
+
if (isSSR) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
// With iOS 13 the string 'iPad' was removed from the user agent string through a browser setting, which is applied on all sites by default:
|
|
75
|
+
// "Request Desktop Website -> All websites" (for more infos see: https://forums.developer.apple.com/thread/119186).
|
|
76
|
+
// Therefore the OS is detected as MACINTOSH instead of iOS and the device is a tablet if the Device.support.touch is true.
|
|
77
|
+
return /ipad/i.test(internals.userAgent) || (/Macintosh/i.test(internals.userAgent) && "ontouchend" in document);
|
|
78
|
+
},
|
|
79
|
+
};
|
|
16
80
|
|
|
17
81
|
let windowsVersion: number;
|
|
18
82
|
let webkitVersion: number;
|
|
19
83
|
let tablet: boolean;
|
|
20
84
|
|
|
21
85
|
const isWindows8OrAbove = () => {
|
|
22
|
-
if (
|
|
86
|
+
if (isSSR) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (!internals.windows) {
|
|
23
91
|
return false;
|
|
24
92
|
}
|
|
25
93
|
|
|
26
94
|
if (windowsVersion === undefined) {
|
|
27
|
-
const matches =
|
|
95
|
+
const matches = internals.userAgent.match(/Windows NT (\d+).(\d)/);
|
|
28
96
|
windowsVersion = matches ? parseFloat(matches[1]) : 0;
|
|
29
97
|
}
|
|
30
98
|
|
|
@@ -32,12 +100,16 @@ const isWindows8OrAbove = () => {
|
|
|
32
100
|
};
|
|
33
101
|
|
|
34
102
|
const isWebkit537OrAbove = () => {
|
|
35
|
-
if (
|
|
103
|
+
if (isSSR) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (!internals.webkit) {
|
|
36
108
|
return false;
|
|
37
109
|
}
|
|
38
110
|
|
|
39
111
|
if (webkitVersion === undefined) {
|
|
40
|
-
const matches =
|
|
112
|
+
const matches = internals.userAgent.match(/(webkit)[ /]([\w.]+)/);
|
|
41
113
|
webkitVersion = matches ? parseFloat(matches[1]) : 0;
|
|
42
114
|
}
|
|
43
115
|
|
|
@@ -45,28 +117,32 @@ const isWebkit537OrAbove = () => {
|
|
|
45
117
|
};
|
|
46
118
|
|
|
47
119
|
const detectTablet = () => {
|
|
120
|
+
if (isSSR) {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
|
|
48
124
|
if (tablet !== undefined) {
|
|
49
125
|
return;
|
|
50
126
|
}
|
|
51
127
|
|
|
52
|
-
if (ipad) {
|
|
128
|
+
if (internals.ipad) {
|
|
53
129
|
tablet = true;
|
|
54
130
|
return;
|
|
55
131
|
}
|
|
56
132
|
|
|
57
|
-
if (touch) {
|
|
133
|
+
if (internals.touch) {
|
|
58
134
|
if (isWindows8OrAbove()) {
|
|
59
135
|
tablet = true;
|
|
60
136
|
return;
|
|
61
137
|
}
|
|
62
138
|
|
|
63
|
-
if (chrome && android) {
|
|
64
|
-
tablet = !/Mobile Safari\/[.0-9]+/.test(
|
|
139
|
+
if (internals.chrome && internals.android) {
|
|
140
|
+
tablet = !/Mobile Safari\/[.0-9]+/.test(internals.userAgent);
|
|
65
141
|
return;
|
|
66
142
|
}
|
|
67
143
|
|
|
68
144
|
let densityFactor = window.devicePixelRatio ? window.devicePixelRatio : 1; // may be undefined in Windows Phone devices
|
|
69
|
-
if (android && isWebkit537OrAbove()) {
|
|
145
|
+
if (internals.android && isWebkit537OrAbove()) {
|
|
70
146
|
densityFactor = 1;
|
|
71
147
|
}
|
|
72
148
|
|
|
@@ -74,26 +150,29 @@ const detectTablet = () => {
|
|
|
74
150
|
return;
|
|
75
151
|
}
|
|
76
152
|
|
|
77
|
-
tablet = (ie &&
|
|
153
|
+
tablet = (internals.ie && internals.userAgent.indexOf("Touch") !== -1) || (internals.android && !internals.androidPhone);
|
|
78
154
|
};
|
|
79
155
|
|
|
80
|
-
const supportsTouch = (): boolean => touch;
|
|
81
|
-
const isIE = (): boolean => ie;
|
|
82
|
-
const isSafari = (): boolean => safari;
|
|
83
|
-
const isChrome = (): boolean => chrome;
|
|
84
|
-
const isFirefox = (): boolean => firefox;
|
|
156
|
+
const supportsTouch = (): boolean => internals.touch;
|
|
157
|
+
const isIE = (): boolean => internals.ie;
|
|
158
|
+
const isSafari = (): boolean => internals.safari;
|
|
159
|
+
const isChrome = (): boolean => internals.chrome;
|
|
160
|
+
const isFirefox = (): boolean => internals.firefox;
|
|
85
161
|
|
|
86
162
|
const isTablet = (): boolean => {
|
|
87
163
|
detectTablet();
|
|
88
|
-
return (touch || isWindows8OrAbove()) && tablet;
|
|
164
|
+
return (internals.touch || isWindows8OrAbove()) && tablet;
|
|
89
165
|
};
|
|
90
166
|
|
|
91
167
|
const isPhone = (): boolean => {
|
|
92
168
|
detectTablet();
|
|
93
|
-
return touch && !tablet;
|
|
169
|
+
return internals.touch && !tablet;
|
|
94
170
|
};
|
|
95
171
|
|
|
96
172
|
const isDesktop = (): boolean => {
|
|
173
|
+
if (isSSR) {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
97
176
|
return (!isTablet() && !isPhone()) || isWindows8OrAbove();
|
|
98
177
|
};
|
|
99
178
|
|
|
@@ -102,11 +181,11 @@ const isCombi = (): boolean => {
|
|
|
102
181
|
};
|
|
103
182
|
|
|
104
183
|
const isIOS = (): boolean => {
|
|
105
|
-
return iOS;
|
|
184
|
+
return internals.iOS;
|
|
106
185
|
};
|
|
107
186
|
|
|
108
187
|
const isAndroid = (): boolean => {
|
|
109
|
-
return android || androidPhone;
|
|
188
|
+
return internals.android || internals.androidPhone;
|
|
110
189
|
};
|
|
111
190
|
|
|
112
191
|
export {
|
package/src/UI5Element.ts
CHANGED
|
@@ -23,14 +23,24 @@ import { getSlotName, getSlottedNodesList } from "./util/SlotsHelper.js";
|
|
|
23
23
|
import arraysAreEqual from "./util/arraysAreEqual.js";
|
|
24
24
|
import { markAsRtlAware } from "./locale/RTLAwareRegistry.js";
|
|
25
25
|
import preloadLinks from "./theming/preloadLinks.js";
|
|
26
|
-
import { TemplateFunction, TemplateFunctionResult } from "./renderer/executeTemplate.js";
|
|
27
|
-
import { PromiseResolve, ComponentStylesData, ClassMap } from "./types.js";
|
|
26
|
+
import type { TemplateFunction, TemplateFunctionResult } from "./renderer/executeTemplate.js";
|
|
27
|
+
import type { PromiseResolve, ComponentStylesData, ClassMap } from "./types.js";
|
|
28
28
|
|
|
29
29
|
let autoId = 0;
|
|
30
30
|
|
|
31
31
|
const elementTimeouts = new Map<string, Promise<void>>();
|
|
32
32
|
const uniqueDependenciesCache = new Map<typeof UI5Element, Array<typeof UI5Element>>();
|
|
33
33
|
|
|
34
|
+
type Renderer = (templateResult: TemplateFunctionResult, container: HTMLElement | DocumentFragment, styleStrOrHrefsArr: string | Array<string> | undefined, forStaticArea: boolean, options: RendererOptions) => void;
|
|
35
|
+
|
|
36
|
+
type RendererOptions = {
|
|
37
|
+
/**
|
|
38
|
+
* An object to use as the `this` value for event listeners. It's often
|
|
39
|
+
* useful to set this to the host component rendering a template.
|
|
40
|
+
*/
|
|
41
|
+
host?: object,
|
|
42
|
+
}
|
|
43
|
+
|
|
34
44
|
type ChangeInfo = {
|
|
35
45
|
type: "property" | "slot",
|
|
36
46
|
name: string,
|
|
@@ -67,8 +77,6 @@ function _invalidate(this: UI5Element, changeInfo: ChangeInfo) {
|
|
|
67
77
|
this._eventProvider.fireEvent("invalidate", { ...changeInfo, target: this });
|
|
68
78
|
}
|
|
69
79
|
|
|
70
|
-
let metadata = {} as Metadata;
|
|
71
|
-
|
|
72
80
|
/**
|
|
73
81
|
* Base class for all UI5 Web Components
|
|
74
82
|
*
|
|
@@ -99,7 +107,12 @@ abstract class UI5Element extends HTMLElement {
|
|
|
99
107
|
static template?: TemplateFunction;
|
|
100
108
|
static staticAreaTemplate?: TemplateFunction;
|
|
101
109
|
static _metadata: UI5ElementMetadata;
|
|
102
|
-
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @deprecated
|
|
113
|
+
*/
|
|
114
|
+
static render: Renderer;
|
|
115
|
+
static renderer?: Renderer;
|
|
103
116
|
|
|
104
117
|
constructor() {
|
|
105
118
|
super();
|
|
@@ -764,15 +777,16 @@ abstract class UI5Element extends HTMLElement {
|
|
|
764
777
|
|
|
765
778
|
/**
|
|
766
779
|
* Set the focus to the element, returned by "getFocusDomRef()" (marked by "data-sap-focus-ref")
|
|
780
|
+
* @param {FocusOptions} focusOptions additional options for the focus
|
|
767
781
|
* @public
|
|
768
782
|
*/
|
|
769
|
-
async focus() {
|
|
783
|
+
async focus(focusOptions?: FocusOptions) {
|
|
770
784
|
await this._waitForDomRef();
|
|
771
785
|
|
|
772
786
|
const focusDomRef = this.getFocusDomRef();
|
|
773
787
|
|
|
774
788
|
if (focusDomRef && typeof focusDomRef.focus === "function") {
|
|
775
|
-
focusDomRef.focus();
|
|
789
|
+
focusDomRef.focus(focusOptions);
|
|
776
790
|
}
|
|
777
791
|
}
|
|
778
792
|
|
|
@@ -830,8 +844,8 @@ abstract class UI5Element extends HTMLElement {
|
|
|
830
844
|
* Useful when there are transitive slots in nested component scenarios and you don't want to get a list of the slots, but rather of their content.
|
|
831
845
|
* @public
|
|
832
846
|
*/
|
|
833
|
-
getSlottedNodes(slotName: string) {
|
|
834
|
-
return getSlottedNodesList((this as unknown as Record<string, Array<SlotValue>>)[slotName])
|
|
847
|
+
getSlottedNodes<T = Node>(slotName: string) {
|
|
848
|
+
return getSlottedNodesList((this as unknown as Record<string, Array<SlotValue>>)[slotName]) as Array<T>;
|
|
835
849
|
}
|
|
836
850
|
|
|
837
851
|
/**
|
|
@@ -1013,17 +1027,7 @@ abstract class UI5Element extends HTMLElement {
|
|
|
1013
1027
|
* Returns the metadata object for this UI5 Web Component Class
|
|
1014
1028
|
* @protected
|
|
1015
1029
|
*/
|
|
1016
|
-
static
|
|
1017
|
-
return metadata;
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
/**
|
|
1021
|
-
* Sets a new metadata object for this UI5 Web Component Class
|
|
1022
|
-
* @protected
|
|
1023
|
-
*/
|
|
1024
|
-
static set metadata(newMetadata) {
|
|
1025
|
-
metadata = newMetadata;
|
|
1026
|
-
}
|
|
1030
|
+
static metadata: Metadata = {};
|
|
1027
1031
|
|
|
1028
1032
|
/**
|
|
1029
1033
|
* Returns the CSS for this UI5 Web Component Class
|
|
@@ -1125,21 +1129,17 @@ abstract class UI5Element extends HTMLElement {
|
|
|
1125
1129
|
return this._metadata;
|
|
1126
1130
|
}
|
|
1127
1131
|
|
|
1128
|
-
const
|
|
1129
|
-
const metadataObjects = [effectiveMetadata];
|
|
1132
|
+
const metadataObjects = [this.metadata];
|
|
1130
1133
|
let klass = this; // eslint-disable-line
|
|
1131
1134
|
while (klass !== UI5Element) {
|
|
1132
1135
|
klass = Object.getPrototypeOf(klass);
|
|
1133
|
-
|
|
1134
|
-
metadataObjects.unshift(effectiveKlassMetadata);
|
|
1136
|
+
metadataObjects.unshift(klass.metadata);
|
|
1135
1137
|
}
|
|
1136
1138
|
const mergedMetadata = merge({}, ...metadataObjects) as Metadata;
|
|
1137
1139
|
|
|
1138
1140
|
this._metadata = new UI5ElementMetadata(mergedMetadata);
|
|
1139
1141
|
return this._metadata;
|
|
1140
1142
|
}
|
|
1141
|
-
|
|
1142
|
-
static decoratorMetadata: Metadata = {};
|
|
1143
1143
|
}
|
|
1144
1144
|
|
|
1145
1145
|
/**
|
|
@@ -1152,4 +1152,8 @@ const instanceOfUI5Element = (object: any): object is UI5Element => {
|
|
|
1152
1152
|
|
|
1153
1153
|
export default UI5Element;
|
|
1154
1154
|
export { instanceOfUI5Element };
|
|
1155
|
-
export type {
|
|
1155
|
+
export type {
|
|
1156
|
+
ChangeInfo,
|
|
1157
|
+
Renderer,
|
|
1158
|
+
RendererOptions,
|
|
1159
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import getSharedResource from "../getSharedResource.js";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import { getIconCollectionByAlias } from "../assets-meta/IconCollectionsAlias.js";
|
|
3
|
+
import { getEffectiveIconCollection } from "../config/Icons.js";
|
|
4
4
|
import { I18nText } from "../i18nBundle.js";
|
|
5
5
|
import { TemplateFunction } from "../renderer/executeTemplate.js";
|
|
6
6
|
|
|
@@ -19,7 +19,7 @@ type CollectionData = {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
type IconData = {
|
|
22
|
-
collection
|
|
22
|
+
collection: string,
|
|
23
23
|
packageName: string,
|
|
24
24
|
pathData: string | Array<string>,
|
|
25
25
|
ltr: boolean,
|
|
@@ -67,11 +67,8 @@ const _fillRegistry = (bundleData: CollectionData) => {
|
|
|
67
67
|
|
|
68
68
|
// set
|
|
69
69
|
const registerIcon = (name: string, iconData: IconData) => { // eslint-disable-line
|
|
70
|
-
if (!iconData.collection) {
|
|
71
|
-
iconData.collection = getEffectiveDefaultIconCollection();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
70
|
const key = `${iconData.collection}/${name}`;
|
|
71
|
+
|
|
75
72
|
registry.set(key, {
|
|
76
73
|
pathData: iconData.pathData,
|
|
77
74
|
ltr: iconData.ltr,
|
|
@@ -79,38 +76,48 @@ const registerIcon = (name: string, iconData: IconData) => { // eslint-disable-l
|
|
|
79
76
|
packageName: iconData.packageName,
|
|
80
77
|
customTemplate: iconData.customTemplate,
|
|
81
78
|
viewBox: iconData.viewBox,
|
|
79
|
+
collection: iconData.collection,
|
|
82
80
|
});
|
|
83
81
|
};
|
|
84
82
|
|
|
85
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Processes the full icon name and splits it into - "name", "collection"
|
|
85
|
+
* to form the proper registry key ("collection/name") under which the icon is registered:
|
|
86
|
+
*
|
|
87
|
+
* - removes legacy protocol ("sap-icon://")
|
|
88
|
+
* - resolves aliases (f.e "SAP-icons-TNT/actor" => "tnt/actor")
|
|
89
|
+
* - determines theme dependant icon collection (f.e "home" => "SAP-icons-v4/home" in Quartz | "SAP-icons-v5/home" in Horizon)
|
|
90
|
+
*
|
|
91
|
+
* @param { string } name
|
|
92
|
+
* @return { object }
|
|
93
|
+
*/
|
|
94
|
+
const processName = (name: string) => {
|
|
86
95
|
// silently support ui5-compatible URIs
|
|
87
96
|
if (name.startsWith("sap-icon://")) {
|
|
88
97
|
name = name.replace("sap-icon://", "");
|
|
89
98
|
}
|
|
90
99
|
|
|
91
|
-
let collection;
|
|
100
|
+
let collection: string;
|
|
92
101
|
[name, collection] = name.split("/").reverse();
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
// Normalize collection name.
|
|
96
|
-
// - resolve `SAP-icons-TNT` to `tnt`.
|
|
97
|
-
// - resolve `BusinessSuiteInAppSymbols` to `business-suite`.
|
|
98
|
-
// - resolve `horizon` to `SAP-icons-v5`,
|
|
99
|
-
// Note: aliases can be made as a feature, if more collections need it or more aliases are needed.
|
|
100
|
-
collection = _normalizeCollection(collection);
|
|
102
|
+
|
|
101
103
|
name = name.replace("icon-", "");
|
|
102
104
|
|
|
105
|
+
if (collection) {
|
|
106
|
+
collection = getIconCollectionByAlias(collection);
|
|
107
|
+
}
|
|
108
|
+
collection = getEffectiveIconCollection(collection);
|
|
109
|
+
|
|
103
110
|
const registryKey = `${collection}/${name}`;
|
|
104
111
|
return { name, collection, registryKey };
|
|
105
112
|
};
|
|
106
113
|
|
|
107
114
|
const getIconDataSync = (name: string) => {
|
|
108
|
-
const { registryKey } =
|
|
115
|
+
const { registryKey } = processName(name);
|
|
109
116
|
return registry.get(registryKey);
|
|
110
117
|
};
|
|
111
118
|
|
|
112
119
|
const getIconData = async (name: string) => {
|
|
113
|
-
const { collection, registryKey } =
|
|
120
|
+
const { collection, registryKey } = processName(name);
|
|
114
121
|
|
|
115
122
|
let iconData: string | CollectionData = ICON_NOT_FOUND;
|
|
116
123
|
try {
|
|
@@ -140,14 +147,6 @@ const _getRegisteredNames = async () => {
|
|
|
140
147
|
return Array.from(registry.keys());
|
|
141
148
|
};
|
|
142
149
|
|
|
143
|
-
const _normalizeCollection = (collectionName: string) => {
|
|
144
|
-
if (IconCollectionsAlias[collectionName as keyof typeof IconCollectionsAlias]) {
|
|
145
|
-
return IconCollectionsAlias[collectionName as keyof typeof IconCollectionsAlias];
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return collectionName;
|
|
149
|
-
};
|
|
150
|
-
|
|
151
150
|
export {
|
|
152
151
|
registerIconLoader,
|
|
153
152
|
getIconData,
|
|
@@ -1,18 +1,41 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Supported icon collection
|
|
2
|
+
* Supported icon collection aliases.
|
|
3
3
|
*
|
|
4
4
|
* Users might specify a collection, using both the key and the value in the following key-value pairs,
|
|
5
5
|
* e.g the following pairs are completely exchangeable:
|
|
6
|
-
* "SAP-icons-TNT/actor" and "tnt/actor", "BusinessSuiteInAppSymbols/3d" and "business-suite/3d",
|
|
7
|
-
* "SAP-icons-v5/accept" and "horizon/accept".
|
|
8
6
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* - "SAP-icons/accept" and "SAP-icons-v4/accept"
|
|
8
|
+
* - "horizon/accept" and "SAP-icons-v5/accept"
|
|
9
|
+
* - "SAP-icons-TNT/actor" and "tnt/actor"
|
|
10
|
+
* - "BusinessSuiteInAppSymbols/3d" and "business-suite/3d"
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
"SAP-icons
|
|
14
|
-
"
|
|
15
|
-
"
|
|
12
|
+
enum IconCollectionsAlias {
|
|
13
|
+
"SAP-icons" = "SAP-icons-v4",
|
|
14
|
+
"horizon" = "SAP-icons-v5",
|
|
15
|
+
"SAP-icons-TNT" = "tnt",
|
|
16
|
+
"BusinessSuiteInAppSymbols" = "business-suite",
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Returns the mapped collection name for a given alias.
|
|
21
|
+
*
|
|
22
|
+
* <b>For example</b>:
|
|
23
|
+
* - "SAP-icons-TNT"resolves to "tnt"
|
|
24
|
+
* - "BusinessSuiteInAppSymbols" resolves to "business-suite"
|
|
25
|
+
* - "horizon" resolves to "SAP-icons-v5"
|
|
26
|
+
*
|
|
27
|
+
* @param { string } collectionName
|
|
28
|
+
* @return { string } the normalized collection name
|
|
29
|
+
*/
|
|
30
|
+
const getIconCollectionByAlias = (collectionName: string) => {
|
|
31
|
+
if (IconCollectionsAlias[collectionName as keyof typeof IconCollectionsAlias]) {
|
|
32
|
+
return IconCollectionsAlias[collectionName as keyof typeof IconCollectionsAlias];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return collectionName;
|
|
16
36
|
};
|
|
17
37
|
|
|
18
38
|
export default IconCollectionsAlias;
|
|
39
|
+
export {
|
|
40
|
+
getIconCollectionByAlias,
|
|
41
|
+
};
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import LegacyDateFormats from "../features/LegacyDateFormats.js";
|
|
2
|
+
import type { LegacyDateCalendarCustomizing } from "../features/LegacyDateFormats.js";
|
|
1
3
|
import { getFormatSettings } from "../InitialConfiguration.js";
|
|
4
|
+
import { getFeature } from "../FeaturesRegistry.js";
|
|
2
5
|
|
|
3
|
-
type FormatSettings = {
|
|
6
|
+
type FormatSettings = {
|
|
7
|
+
firstDayOfWeek?: number,
|
|
8
|
+
legacyDateCalendarCustomizing?: LegacyDateCalendarCustomizing,
|
|
9
|
+
};
|
|
4
10
|
|
|
5
11
|
let formatSettings: FormatSettings;
|
|
6
12
|
|
|
@@ -17,5 +23,13 @@ const getFirstDayOfWeek = (): number | undefined => {
|
|
|
17
23
|
return formatSettings.firstDayOfWeek;
|
|
18
24
|
};
|
|
19
25
|
|
|
20
|
-
|
|
26
|
+
const legacyDateFormats = getFeature<typeof LegacyDateFormats>("LegacyDateFormats");
|
|
27
|
+
|
|
28
|
+
const getLegacyDateCalendarCustomizing = legacyDateFormats ? LegacyDateFormats.getLegacyDateCalendarCustomizing : () => { return []; };
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
getFirstDayOfWeek,
|
|
32
|
+
getLegacyDateCalendarCustomizing,
|
|
33
|
+
};
|
|
34
|
+
|
|
21
35
|
export type { FormatSettings };
|