@ui5/webcomponents-base 0.0.0-96e98c995 → 0.0.0-974b11d82
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 +53 -0
- package/bundle.esm.js +3 -1
- package/dist/Boot.js +4 -0
- 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 +19 -8
- package/dist/UI5Element.js +3 -2
- 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/bundle.esm.ea2cc5c5.js +60 -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 +17 -2
- package/dist/decorators/customElement.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/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 -9
- package/lib/generate-styles/index.js +10 -5
- package/package-scripts.js +8 -4
- package/package.json +2 -2
- package/src/Boot.ts +4 -0
- package/src/Device.ts +113 -34
- package/src/InitialConfiguration.ts +1 -1
- package/src/UI5Element.ts +28 -8
- 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 +42 -2
- 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/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
|
@@ -3,19 +3,24 @@ const path = require('path');
|
|
|
3
3
|
const CleanCSS = require('clean-css');
|
|
4
4
|
|
|
5
5
|
const generate = async () => {
|
|
6
|
-
await fs.mkdir("
|
|
6
|
+
await fs.mkdir("src/generated/css/", {recursive: true});
|
|
7
7
|
|
|
8
8
|
const files = (await fs.readdir("src/css/")).filter(file => file.endsWith(".css"));
|
|
9
9
|
const filesPromises = files.map(async file => {
|
|
10
10
|
let content = await fs.readFile(path.join("src/css/", file));
|
|
11
11
|
const res = new CleanCSS().minify(`${content}`);
|
|
12
|
-
content = `
|
|
12
|
+
content = `import type { StyleData } from "../../types.js";
|
|
13
|
+
|
|
14
|
+
const styleData: StyleData = {
|
|
13
15
|
packageName: "@ui5/webcomponents-base",
|
|
14
16
|
fileName: "${file}",
|
|
15
|
-
content: \`${res.styles}
|
|
16
|
-
}
|
|
17
|
+
content: \`${res.styles}\`,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default styleData;
|
|
21
|
+
`;
|
|
17
22
|
|
|
18
|
-
return fs.writeFile(path.join("
|
|
23
|
+
return fs.writeFile(path.join("src/generated/css/", `${file}.ts`), content);
|
|
19
24
|
});
|
|
20
25
|
|
|
21
26
|
return Promise.all(filesPromises);
|
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-974b11d82",
|
|
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-974b11d82",
|
|
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
|
@@ -27,6 +27,10 @@ const boot = async (): Promise<void> => {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
const bootExecutor = async (resolve: PromiseResolve) => {
|
|
30
|
+
if (typeof document === "undefined") {
|
|
31
|
+
resolve();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
30
34
|
registerCurrentRuntime();
|
|
31
35
|
|
|
32
36
|
const openUI5Support = getFeature<typeof OpenUI5Support>("OpenUI5Support");
|
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,
|
|
@@ -99,7 +109,12 @@ abstract class UI5Element extends HTMLElement {
|
|
|
99
109
|
static template?: TemplateFunction;
|
|
100
110
|
static staticAreaTemplate?: TemplateFunction;
|
|
101
111
|
static _metadata: UI5ElementMetadata;
|
|
102
|
-
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @deprecated
|
|
115
|
+
*/
|
|
116
|
+
static render: Renderer;
|
|
117
|
+
static renderer?: Renderer;
|
|
103
118
|
|
|
104
119
|
constructor() {
|
|
105
120
|
super();
|
|
@@ -764,15 +779,16 @@ abstract class UI5Element extends HTMLElement {
|
|
|
764
779
|
|
|
765
780
|
/**
|
|
766
781
|
* Set the focus to the element, returned by "getFocusDomRef()" (marked by "data-sap-focus-ref")
|
|
782
|
+
* @param {FocusOptions} focusOptions additional options for the focus
|
|
767
783
|
* @public
|
|
768
784
|
*/
|
|
769
|
-
async focus() {
|
|
785
|
+
async focus(focusOptions?: FocusOptions) {
|
|
770
786
|
await this._waitForDomRef();
|
|
771
787
|
|
|
772
788
|
const focusDomRef = this.getFocusDomRef();
|
|
773
789
|
|
|
774
790
|
if (focusDomRef && typeof focusDomRef.focus === "function") {
|
|
775
|
-
focusDomRef.focus();
|
|
791
|
+
focusDomRef.focus(focusOptions);
|
|
776
792
|
}
|
|
777
793
|
}
|
|
778
794
|
|
|
@@ -830,8 +846,8 @@ abstract class UI5Element extends HTMLElement {
|
|
|
830
846
|
* 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
847
|
* @public
|
|
832
848
|
*/
|
|
833
|
-
getSlottedNodes(slotName: string) {
|
|
834
|
-
return getSlottedNodesList((this as unknown as Record<string, Array<SlotValue>>)[slotName])
|
|
849
|
+
getSlottedNodes<T = Node>(slotName: string) {
|
|
850
|
+
return getSlottedNodesList((this as unknown as Record<string, Array<SlotValue>>)[slotName]) as Array<T>;
|
|
835
851
|
}
|
|
836
852
|
|
|
837
853
|
/**
|
|
@@ -1152,4 +1168,8 @@ const instanceOfUI5Element = (object: any): object is UI5Element => {
|
|
|
1152
1168
|
|
|
1153
1169
|
export default UI5Element;
|
|
1154
1170
|
export { instanceOfUI5Element };
|
|
1155
|
-
export type {
|
|
1171
|
+
export type {
|
|
1172
|
+
ChangeInfo,
|
|
1173
|
+
Renderer,
|
|
1174
|
+
RendererOptions,
|
|
1175
|
+
};
|
|
@@ -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 };
|