@ui5/webcomponents-base 0.0.0-4a28ecb24 → 0.0.0-4b9b0ab7c
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/CHANGELOG.md +64 -0
- package/bundle.esm.js +3 -1
- package/dist/Boot.d.ts +4 -3
- package/dist/Boot.js +25 -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 +18 -14
- package/dist/UI5Element.js +7 -20
- 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/asset-registries/Themes.js +2 -0
- package/dist/asset-registries/Themes.js.map +1 -1
- package/dist/assets/Boot.6335ce08.css +1 -0
- package/dist/assets/Boot.e74b2a49.js +9 -0
- package/dist/assets/bundle.esm.abaf0306.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/getSharedResource.js +9 -1
- package/dist/getSharedResource.js.map +1 -1
- 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/ThemeRegistered.d.ts +5 -0
- package/dist/theming/ThemeRegistered.js +14 -0
- package/dist/theming/ThemeRegistered.js.map +1 -0
- package/dist/theming/applyTheme.js +1 -0
- package/dist/theming/applyTheme.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/getClassCopy.d.ts +7 -9
- package/package-scripts.js +6 -2
- package/package.json +2 -2
- package/src/Boot.ts +29 -5
- package/src/Device.ts +113 -34
- package/src/InitialConfiguration.ts +1 -1
- package/src/UI5Element.ts +28 -25
- package/src/asset-registries/Icons.ts +26 -27
- package/src/asset-registries/Illustrations.ts +1 -1
- package/src/asset-registries/Themes.ts +7 -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/getSharedResource.ts +10 -1
- package/src/renderer/LitRenderer.ts +2 -2
- package/src/theming/CustomStyle.ts +7 -5
- package/src/theming/ThemeRegistered.ts +24 -0
- package/src/theming/applyTheme.ts +2 -0
- 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/dist/assets/bundle.esm.2e322362.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/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();
|
|
@@ -831,8 +844,8 @@ abstract class UI5Element extends HTMLElement {
|
|
|
831
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.
|
|
832
845
|
* @public
|
|
833
846
|
*/
|
|
834
|
-
getSlottedNodes(slotName: string) {
|
|
835
|
-
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>;
|
|
836
849
|
}
|
|
837
850
|
|
|
838
851
|
/**
|
|
@@ -1014,17 +1027,7 @@ abstract class UI5Element extends HTMLElement {
|
|
|
1014
1027
|
* Returns the metadata object for this UI5 Web Component Class
|
|
1015
1028
|
* @protected
|
|
1016
1029
|
*/
|
|
1017
|
-
static
|
|
1018
|
-
return metadata;
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
/**
|
|
1022
|
-
* Sets a new metadata object for this UI5 Web Component Class
|
|
1023
|
-
* @protected
|
|
1024
|
-
*/
|
|
1025
|
-
static set metadata(newMetadata) {
|
|
1026
|
-
metadata = newMetadata;
|
|
1027
|
-
}
|
|
1030
|
+
static metadata: Metadata = {};
|
|
1028
1031
|
|
|
1029
1032
|
/**
|
|
1030
1033
|
* Returns the CSS for this UI5 Web Component Class
|
|
@@ -1126,21 +1129,17 @@ abstract class UI5Element extends HTMLElement {
|
|
|
1126
1129
|
return this._metadata;
|
|
1127
1130
|
}
|
|
1128
1131
|
|
|
1129
|
-
const
|
|
1130
|
-
const metadataObjects = [effectiveMetadata];
|
|
1132
|
+
const metadataObjects = [this.metadata];
|
|
1131
1133
|
let klass = this; // eslint-disable-line
|
|
1132
1134
|
while (klass !== UI5Element) {
|
|
1133
1135
|
klass = Object.getPrototypeOf(klass);
|
|
1134
|
-
|
|
1135
|
-
metadataObjects.unshift(effectiveKlassMetadata);
|
|
1136
|
+
metadataObjects.unshift(klass.metadata);
|
|
1136
1137
|
}
|
|
1137
1138
|
const mergedMetadata = merge({}, ...metadataObjects) as Metadata;
|
|
1138
1139
|
|
|
1139
1140
|
this._metadata = new UI5ElementMetadata(mergedMetadata);
|
|
1140
1141
|
return this._metadata;
|
|
1141
1142
|
}
|
|
1142
|
-
|
|
1143
|
-
static decoratorMetadata: Metadata = {};
|
|
1144
1143
|
}
|
|
1145
1144
|
|
|
1146
1145
|
/**
|
|
@@ -1153,4 +1152,8 @@ const instanceOfUI5Element = (object: any): object is UI5Element => {
|
|
|
1153
1152
|
|
|
1154
1153
|
export default UI5Element;
|
|
1155
1154
|
export { instanceOfUI5Element };
|
|
1156
|
-
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,5 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_THEME } from "../generated/AssetParameters.js";
|
|
2
2
|
import { StyleData, StyleDataCSP } from "../types.js";
|
|
3
|
+
import { fireThemeRegistered } from "../theming/ThemeRegistered.js";
|
|
3
4
|
|
|
4
5
|
type ThemeData = {_: StyleDataCSP } | StyleDataCSP | string;
|
|
5
6
|
type ThemeLoader = (themeName: string) => Promise<ThemeData>;
|
|
@@ -13,6 +14,7 @@ const registerThemePropertiesLoader = (packageName: string, themeName: string, l
|
|
|
13
14
|
loaders.set(`${packageName}/${themeName}`, loader);
|
|
14
15
|
registeredPackages.add(packageName);
|
|
15
16
|
registeredThemes.add(themeName);
|
|
17
|
+
fireThemeRegistered(`${packageName}/${themeName}`);
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
const getThemeProperties = async (packageName: string, themeName: string) => {
|
|
@@ -65,3 +67,8 @@ export {
|
|
|
65
67
|
getRegisteredPackages,
|
|
66
68
|
isThemeRegistered,
|
|
67
69
|
};
|
|
70
|
+
|
|
71
|
+
export type {
|
|
72
|
+
ThemeData,
|
|
73
|
+
ThemeLoader,
|
|
74
|
+
};
|
|
@@ -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 };
|