@ui5/webcomponents-base 1.11.0-rc.1 → 1.11.0-rc.3
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 +23 -0
- package/bundle.esm.js +3 -1
- package/dist/UI5Element.d.ts +2 -2
- 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.76492ab6.js +60 -0
- package/dist/assets/test/pages/{i18n.html.4b1c0bdb.js → i18n.html.2fe80529.js} +1 -1
- package/dist/assets/test/pages/{i18n_texts.html.e98a417d.js → i18n_texts.html.fef7ef14.js} +1 -1
- 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/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/test/pages/AllTestElements.html +1 -1
- package/dist/test/pages/Configuration.html +1 -1
- package/dist/test/pages/ConfigurationScript.html +19 -2
- package/dist/test/pages/WithComplexTemplate.html +1 -1
- package/dist/test/pages/i18n.html +2 -2
- package/dist/test/pages/i18n_texts.html +2 -2
- package/dist/theming/getStylesString.d.ts +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/package-scripts.js +1 -1
- package/package.json +3 -3
- package/src/UI5Element.ts +2 -2
- 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/features/LegacyDateFormats.ts +40 -0
- package/src/features/OpenUI5Support.ts +5 -0
- package/src/theming/getEffectiveLinksHrefs.ts +1 -1
- package/src/theming/getStylesString.ts +1 -1
- package/src/util/AriaLabelHelper.ts +167 -12
- package/dist/assets/bundle.esm.25073731.js +0 -56
package/dist/config/Icons.d.ts
CHANGED
|
@@ -1,30 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
type IconCollection = "SAP-icons" | "SAP-icons-v4" | "SAP-icons-v5" | "horizon" | "tnt" | "tnt-v2" | "tnt-v3" | "business-suite" | "business-suite-v1" | "business-suite-v2" | string;
|
|
2
|
+
declare enum RegisteredIconCollection {
|
|
3
|
+
SAPIconsV4 = "SAP-icons-v4",
|
|
4
|
+
SAPIconsV5 = "SAP-icons-v5",
|
|
5
|
+
SAPIconsTNTV2 = "tnt-v2",
|
|
6
|
+
SAPIconsTNTV3 = "tnt-v3",
|
|
7
|
+
SAPBSIconsV1 = "business-suite-v1",
|
|
8
|
+
SAPBSIconsV2 = "business-suite-v2"
|
|
4
9
|
}
|
|
5
10
|
/**
|
|
6
|
-
* Sets the default icon collection
|
|
7
|
-
*
|
|
11
|
+
* Sets the default icon collection for a given theme.
|
|
12
|
+
*
|
|
13
|
+
* SAP Icons is the default icon collection (that resolves to SAP-icons version 5.x in Horizon theme family and SAP-icons version 4.x in all other themes)
|
|
14
|
+
* and to display icons from other collections, you have to specify the icon collection in addition to the icon name, for example: "tnt/actor", "business-suite/1x2-grid-layout", etc.
|
|
15
|
+
* This method allows setting another (built-in or custom) icon collection as default per theme.
|
|
16
|
+
*
|
|
17
|
+
* <b>Usage</b>
|
|
18
|
+
* <b>For example</b>, to make "SAP-icons version 5.x" the default icon collection in "sap_fiori_3":
|
|
19
|
+
*
|
|
20
|
+
* <pre>
|
|
21
|
+
* setDefaultIconCollection("sap_fiori_3", "SAP-icons-v5");
|
|
22
|
+
*
|
|
23
|
+
* <ui5-icon name="home"></ui5-icon>
|
|
24
|
+
* </pre>
|
|
25
|
+
*
|
|
26
|
+
* <b>For example</b>, to make a custom icon collection (with name "my-custom-collection") the default icon collection in "sap_fiori_3":
|
|
27
|
+
*
|
|
28
|
+
* <pre>
|
|
29
|
+
* setDefaultIconCollection("sap_fiori_3", "my-custom-collection");
|
|
30
|
+
*
|
|
31
|
+
* <ui5-icon name="custom-icon-name"></ui5-icon>
|
|
32
|
+
* </pre>
|
|
8
33
|
*
|
|
9
|
-
* Note: by default SAP-icons-v5 is used in all SAP Horizon variants and SAP-icons-v4 for all the rest.
|
|
10
34
|
* @public
|
|
11
|
-
* @param {string} theme
|
|
12
|
-
* @param {
|
|
35
|
+
* @param { string } theme
|
|
36
|
+
* @param { string } collectionName
|
|
13
37
|
*/
|
|
14
|
-
declare const setDefaultIconCollection: (theme: string, collectionName:
|
|
38
|
+
declare const setDefaultIconCollection: (theme: string, collectionName: IconCollection) => void;
|
|
15
39
|
/**
|
|
16
|
-
* Returns the default icon collection
|
|
17
|
-
* that is configured.
|
|
40
|
+
* Returns the configured default icon collection for a given theme.
|
|
18
41
|
*
|
|
19
|
-
* @param {string} theme
|
|
42
|
+
* @param { string } theme
|
|
20
43
|
* @public
|
|
21
|
-
* @returns {string | undefined}
|
|
44
|
+
* @returns { string | undefined }
|
|
22
45
|
*/
|
|
23
46
|
declare const getDefaultIconCollection: (theme: string) => string | undefined;
|
|
24
47
|
/**
|
|
25
|
-
* Returns the effective icon collection
|
|
26
|
-
*
|
|
27
|
-
* @
|
|
48
|
+
* Returns the effective icon collection,
|
|
49
|
+
* based on the default icon collection configuration and the current theme:
|
|
50
|
+
* @param { IconCollection } collectionName
|
|
51
|
+
* @returns { IconCollection } the effective collection name
|
|
28
52
|
*/
|
|
29
|
-
declare const
|
|
30
|
-
export { setDefaultIconCollection, getDefaultIconCollection,
|
|
53
|
+
declare const getEffectiveIconCollection: (collectionName?: IconCollection) => IconCollection;
|
|
54
|
+
export { setDefaultIconCollection, getDefaultIconCollection, getEffectiveIconCollection, RegisteredIconCollection, };
|
|
55
|
+
export type { IconCollection, };
|
package/dist/config/Icons.js
CHANGED
|
@@ -1,48 +1,103 @@
|
|
|
1
1
|
import { getTheme, isThemeFamily } from "./Theme.js";
|
|
2
|
+
import { getIconCollectionByAlias } from "../assets-meta/IconCollectionsAlias.js";
|
|
2
3
|
const IconCollectionConfiguration = new Map();
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
// All registered icon collections - all icon collections resolves to these options at the end
|
|
5
|
+
var RegisteredIconCollection;
|
|
6
|
+
(function (RegisteredIconCollection) {
|
|
7
|
+
RegisteredIconCollection["SAPIconsV4"] = "SAP-icons-v4";
|
|
8
|
+
RegisteredIconCollection["SAPIconsV5"] = "SAP-icons-v5";
|
|
9
|
+
RegisteredIconCollection["SAPIconsTNTV2"] = "tnt-v2";
|
|
10
|
+
RegisteredIconCollection["SAPIconsTNTV3"] = "tnt-v3";
|
|
11
|
+
RegisteredIconCollection["SAPBSIconsV1"] = "business-suite-v1";
|
|
12
|
+
RegisteredIconCollection["SAPBSIconsV2"] = "business-suite-v2";
|
|
13
|
+
})(RegisteredIconCollection || (RegisteredIconCollection = {}));
|
|
8
14
|
/**
|
|
9
|
-
* Sets the default icon collection
|
|
10
|
-
*
|
|
15
|
+
* Sets the default icon collection for a given theme.
|
|
16
|
+
*
|
|
17
|
+
* SAP Icons is the default icon collection (that resolves to SAP-icons version 5.x in Horizon theme family and SAP-icons version 4.x in all other themes)
|
|
18
|
+
* and to display icons from other collections, you have to specify the icon collection in addition to the icon name, for example: "tnt/actor", "business-suite/1x2-grid-layout", etc.
|
|
19
|
+
* This method allows setting another (built-in or custom) icon collection as default per theme.
|
|
20
|
+
*
|
|
21
|
+
* <b>Usage</b>
|
|
22
|
+
* <b>For example</b>, to make "SAP-icons version 5.x" the default icon collection in "sap_fiori_3":
|
|
23
|
+
*
|
|
24
|
+
* <pre>
|
|
25
|
+
* setDefaultIconCollection("sap_fiori_3", "SAP-icons-v5");
|
|
26
|
+
*
|
|
27
|
+
* <ui5-icon name="home"></ui5-icon>
|
|
28
|
+
* </pre>
|
|
29
|
+
*
|
|
30
|
+
* <b>For example</b>, to make a custom icon collection (with name "my-custom-collection") the default icon collection in "sap_fiori_3":
|
|
31
|
+
*
|
|
32
|
+
* <pre>
|
|
33
|
+
* setDefaultIconCollection("sap_fiori_3", "my-custom-collection");
|
|
34
|
+
*
|
|
35
|
+
* <ui5-icon name="custom-icon-name"></ui5-icon>
|
|
36
|
+
* </pre>
|
|
11
37
|
*
|
|
12
|
-
* Note: by default SAP-icons-v5 is used in all SAP Horizon variants and SAP-icons-v4 for all the rest.
|
|
13
38
|
* @public
|
|
14
|
-
* @param {string} theme
|
|
15
|
-
* @param {
|
|
39
|
+
* @param { string } theme
|
|
40
|
+
* @param { string } collectionName
|
|
16
41
|
*/
|
|
17
42
|
const setDefaultIconCollection = (theme, collectionName) => {
|
|
18
|
-
if (collectionName === "horizon") {
|
|
19
|
-
collectionName = IconCollection.v5;
|
|
20
|
-
}
|
|
21
43
|
IconCollectionConfiguration.set(theme, collectionName);
|
|
22
44
|
};
|
|
23
45
|
/**
|
|
24
|
-
* Returns the default icon collection
|
|
25
|
-
* that is configured.
|
|
46
|
+
* Returns the configured default icon collection for a given theme.
|
|
26
47
|
*
|
|
27
|
-
* @param {string} theme
|
|
48
|
+
* @param { string } theme
|
|
28
49
|
* @public
|
|
29
|
-
* @returns {string | undefined}
|
|
50
|
+
* @returns { string | undefined }
|
|
30
51
|
*/
|
|
31
52
|
const getDefaultIconCollection = (theme) => {
|
|
32
53
|
return IconCollectionConfiguration.get(theme);
|
|
33
54
|
};
|
|
34
55
|
/**
|
|
35
|
-
* Returns the effective icon collection
|
|
36
|
-
*
|
|
37
|
-
* @
|
|
56
|
+
* Returns the effective icon collection,
|
|
57
|
+
* based on the default icon collection configuration and the current theme:
|
|
58
|
+
* @param { IconCollection } collectionName
|
|
59
|
+
* @returns { IconCollection } the effective collection name
|
|
38
60
|
*/
|
|
39
|
-
const
|
|
61
|
+
const getEffectiveIconCollection = (collectionName) => {
|
|
40
62
|
const currentTheme = getTheme();
|
|
41
63
|
const currentThemeConfiguration = IconCollectionConfiguration.get(currentTheme);
|
|
42
|
-
|
|
43
|
-
|
|
64
|
+
// when no collection is set and default collection is configured - return the configured icon collection
|
|
65
|
+
if (!collectionName && currentThemeConfiguration) {
|
|
66
|
+
return getIconCollectionByAlias(currentThemeConfiguration);
|
|
67
|
+
}
|
|
68
|
+
// when collection is set - return the theme dependant icon collection
|
|
69
|
+
// when collection is not set and there is no default icon collection configured - return theme dependant icon collection
|
|
70
|
+
return getIconCollectionByTheme(collectionName);
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Returns the icon theme dependant collection, based on the collection name and current theme as follows:
|
|
74
|
+
*
|
|
75
|
+
* - "no collection" resolves to "SAP-icons-v4" in "Quartz" and "Belize", and to "SAP-icons-v5" in "Horizon" (or as confugred via setDefaultIconCollection)
|
|
76
|
+
* - "SAP-icons-v4" (and its alias "SAP-icons") forces "SAP-icons v4" in any theme and resolves to itself "SAP-icons-v4"
|
|
77
|
+
* - "SAP-icons-v5" (and its alias "horizon") forces "SAP-icons v5" in any theme and resolves to itself "SAP-icons-v5"
|
|
78
|
+
* - "tnt" (and its alias "SAP-icons-TNT") resolves to "tnt-v2" in "Quartz", "Belize", and resolves to "tnt-v3" in "Horizon"
|
|
79
|
+
* - "tnt-v2" forces "TNT icons v2" in any theme and resolves to itself "tnt-v2"
|
|
80
|
+
* - "tnt-v3" forces "TNT icons v3" in any theme and resolves to itself "tnt-v3"
|
|
81
|
+
* - "business-suite" (and its alias "BusinessSuiteInAppSymbols") resolves to "business-suite-v1" in "Quartz", "Belize", and resolves to "business-suite-v2" in "Horizon"
|
|
82
|
+
* - "business-suite-v1" forces "Business Suite icons v1" in any theme and resolves to itself "business-suite-v1"
|
|
83
|
+
* - "business-suite-v2" forces "Business Suite icons v2" in any theme and resolves to itself "business-suite-v2"
|
|
84
|
+
*
|
|
85
|
+
* <b>Note:</b> "SAP-icons-v4", "SAP-icons-v5", "tnt-v2", "tnt-v3", "business-suite-v1" and "business-suite-v2" are just returned
|
|
86
|
+
* @param { IconCollection } collectionName
|
|
87
|
+
* @returns { RegisteredIconCollection } the registered collection name
|
|
88
|
+
*/
|
|
89
|
+
const getIconCollectionByTheme = (collectionName) => {
|
|
90
|
+
const horizonThemeFamily = isThemeFamily("sap_horizon");
|
|
91
|
+
if (!collectionName) {
|
|
92
|
+
return horizonThemeFamily ? RegisteredIconCollection.SAPIconsV5 : RegisteredIconCollection.SAPIconsV4;
|
|
93
|
+
}
|
|
94
|
+
if (collectionName === "tnt") {
|
|
95
|
+
return horizonThemeFamily ? RegisteredIconCollection.SAPIconsTNTV3 : RegisteredIconCollection.SAPIconsTNTV2;
|
|
96
|
+
}
|
|
97
|
+
if (collectionName === "business-suite") {
|
|
98
|
+
return horizonThemeFamily ? RegisteredIconCollection.SAPBSIconsV2 : RegisteredIconCollection.SAPBSIconsV1;
|
|
44
99
|
}
|
|
45
|
-
return
|
|
100
|
+
return collectionName;
|
|
46
101
|
};
|
|
47
|
-
export { setDefaultIconCollection, getDefaultIconCollection,
|
|
102
|
+
export { setDefaultIconCollection, getDefaultIconCollection, getEffectiveIconCollection, RegisteredIconCollection, };
|
|
48
103
|
//# sourceMappingURL=Icons.js.map
|
package/dist/config/Icons.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icons.js","sourceRoot":"","sources":["../../src/config/Icons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"Icons.js","sourceRoot":"","sources":["../../src/config/Icons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAElF,MAAM,2BAA2B,GAAG,IAAI,GAAG,EAAkB,CAAC;AAK9D,8FAA8F;AAC9F,IAAK,wBAOJ;AAPD,WAAK,wBAAwB;IAC5B,uDAA2B,CAAA;IAC3B,uDAA2B,CAAA;IAC3B,oDAAwB,CAAA;IACxB,oDAAwB,CAAA;IACxB,8DAAkC,CAAA;IAClC,8DAAkC,CAAA;AACnC,CAAC,EAPI,wBAAwB,KAAxB,wBAAwB,QAO5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,wBAAwB,GAAG,CAAC,KAAa,EAAE,cAA8B,EAAE,EAAE;IAClF,2BAA2B,CAAC,GAAG,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;AACxD,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,wBAAwB,GAAG,CAAC,KAAa,EAAsB,EAAE;IACtE,OAAO,2BAA2B,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,0BAA0B,GAAG,CAAC,cAA+B,EAAkB,EAAE;IACtF,MAAM,YAAY,GAAG,QAAQ,EAAE,CAAC;IAChC,MAAM,yBAAyB,GAAG,2BAA2B,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAEhF,yGAAyG;IACzG,IAAI,CAAC,cAAc,IAAI,yBAAyB,EAAE;QACjD,OAAO,wBAAwB,CAAC,yBAAyB,CAAC,CAAC;KAC3D;IAED,sEAAsE;IACtE,yHAAyH;IACzH,OAAO,wBAAwB,CAAC,cAAc,CAAC,CAAC;AACjD,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,wBAAwB,GAAG,CAAC,cAA+B,EAA4B,EAAE;IAC9F,MAAM,kBAAkB,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC;IAExD,IAAI,CAAC,cAAc,EAAE;QACpB,OAAO,kBAAkB,CAAC,CAAC,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC,CAAC,wBAAwB,CAAC,UAAU,CAAC;KACtG;IAED,IAAI,cAAc,KAAK,KAAK,EAAE;QAC7B,OAAO,kBAAkB,CAAC,CAAC,CAAC,wBAAwB,CAAC,aAAa,CAAC,CAAC,CAAC,wBAAwB,CAAC,aAAa,CAAC;KAC5G;IAED,IAAI,cAAc,KAAK,gBAAgB,EAAE;QACxC,OAAO,kBAAkB,CAAC,CAAC,CAAC,wBAAwB,CAAC,YAAY,CAAC,CAAC,CAAC,wBAAwB,CAAC,YAAY,CAAC;KAC1G;IAED,OAAO,cAA0C,CAAC;AACnD,CAAC,CAAC;AAEF,OAAO,EACN,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,GACxB,CAAC"}
|
package/dist/config/RTL.js
CHANGED
|
@@ -24,6 +24,9 @@ const impliesRTL = (language) => {
|
|
|
24
24
|
* @returns {boolean} whether RTL should be used
|
|
25
25
|
*/
|
|
26
26
|
const getRTL = () => {
|
|
27
|
+
if (typeof document === "undefined") {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
27
30
|
const configurationRTL = getConfiguredRTL();
|
|
28
31
|
if (configurationRTL !== undefined) {
|
|
29
32
|
return !!configurationRTL;
|
package/dist/config/RTL.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RTL.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yCAAyC,CAAC;AACnF,OAAO,uBAAuB,MAAM,oCAAoC,CAAC;AAEzE,MAAM,mBAAmB,GAAG;IAC3B,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;CACV,CAAC;AAEF,MAAM,aAAa,GAAG,4BAA4B,CAAC,6BAA6B,CAAC,IAAI,EAAE,CAAC;AAExF;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,QAAgB,EAAE,EAAE;IACvC,QAAQ,GAAG,CAAC,QAAQ,IAAI,mBAAmB,CAAC,QAA4C,CAAC,CAAC,IAAI,QAAQ,CAAC;IAEvG,OAAO,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,GAAG,GAAY,EAAE;IAC5B,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;QACpC,OAAO,KAAK,CAAC;KACb;IAED,MAAM,gBAAgB,GAAG,gBAAgB,EAAE,CAAC;IAE5C,IAAI,gBAAgB,KAAK,SAAS,EAAE;QACnC,OAAO,CAAC,CAAC,gBAAgB,CAAC;KAC1B;IAED,OAAO,UAAU,CAAC,WAAW,EAAE,IAAI,uBAAuB,EAAE,CAAC,CAAC;AAC/D,CAAC,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,sBAAsB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FormatSettings } from "../config/FormatSettings.js";
|
|
2
|
+
type IslamicToGregorianMapping = {
|
|
3
|
+
dateFormat: string;
|
|
4
|
+
islamicMonthStart: string;
|
|
5
|
+
gregDate: string;
|
|
6
|
+
};
|
|
7
|
+
type LegacyDateCalendarCustomizing = Array<IslamicToGregorianMapping>;
|
|
8
|
+
declare class LegacyDateFormats {
|
|
9
|
+
/**
|
|
10
|
+
* Returns the currently set customizing data for Islamic calendar support
|
|
11
|
+
*
|
|
12
|
+
* @return {object[]} Returns an array that contains the customizing data.
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
static getLegacyDateCalendarCustomizing(this: void): LegacyDateCalendarCustomizing;
|
|
16
|
+
}
|
|
17
|
+
export default LegacyDateFormats;
|
|
18
|
+
export type { FormatSettings, LegacyDateCalendarCustomizing, };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getFormatSettings } from "../InitialConfiguration.js";
|
|
2
|
+
import { registerFeature } from "../FeaturesRegistry.js";
|
|
3
|
+
let formatSettings;
|
|
4
|
+
class LegacyDateFormats {
|
|
5
|
+
/**
|
|
6
|
+
* Returns the currently set customizing data for Islamic calendar support
|
|
7
|
+
*
|
|
8
|
+
* @return {object[]} Returns an array that contains the customizing data.
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
static getLegacyDateCalendarCustomizing() {
|
|
12
|
+
if (formatSettings === undefined) {
|
|
13
|
+
formatSettings = getFormatSettings();
|
|
14
|
+
}
|
|
15
|
+
return formatSettings.legacyDateCalendarCustomizing || [];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
registerFeature("LegacyDateFormats", LegacyDateFormats);
|
|
19
|
+
export default LegacyDateFormats;
|
|
20
|
+
//# sourceMappingURL=LegacyDateFormats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LegacyDateFormats.js","sourceRoot":"","sources":["../../src/features/LegacyDateFormats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAazD,IAAI,cAA8B,CAAC;AAEnC,MAAM,iBAAiB;IACtB;;;;;OAKG;IACH,MAAM,CAAC,gCAAgC;QACtC,IAAI,cAAc,KAAK,SAAS,EAAE;YACjC,cAAc,GAAG,iBAAiB,EAAE,CAAC;SACrC;QAED,OAAO,cAAc,CAAC,6BAA6B,IAAI,EAAE,CAAC;IAC3D,CAAC;CACD;AAED,eAAe,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAAC;AAExD,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CLDRData } from "../asset-registries/LocaleData.js";
|
|
2
|
+
import type { LegacyDateCalendarCustomizing } from "../features/LegacyDateFormats.js";
|
|
2
3
|
declare class OpenUI5Support {
|
|
3
4
|
static isLoaded(): boolean;
|
|
4
5
|
static init(): Promise<void>;
|
|
@@ -11,6 +12,7 @@ declare class OpenUI5Support {
|
|
|
11
12
|
calendarType: string;
|
|
12
13
|
formatSettings: {
|
|
13
14
|
firstDayOfWeek: any;
|
|
15
|
+
legacyDateCalendarCustomizing: LegacyDateCalendarCustomizing;
|
|
14
16
|
};
|
|
15
17
|
} | undefined;
|
|
16
18
|
static getLocaleDataObject(): CLDRData | undefined;
|
|
@@ -38,6 +38,7 @@ class OpenUI5Support {
|
|
|
38
38
|
calendarType: config.getCalendarType(),
|
|
39
39
|
formatSettings: {
|
|
40
40
|
firstDayOfWeek: LocaleData ? LocaleData.getInstance(config.getLocale()).getFirstDayOfWeek() : undefined,
|
|
41
|
+
legacyDateCalendarCustomizing: config.getFormatSettings().getLegacyDateCalendarCustomizing(),
|
|
41
42
|
},
|
|
42
43
|
};
|
|
43
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenUI5Support.js","sourceRoot":"","sources":["../../src/features/OpenUI5Support.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"OpenUI5Support.js","sourceRoot":"","sources":["../../src/features/OpenUI5Support.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,M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alendarCustomizing": [
|
|
17
|
+
{
|
|
18
|
+
"dateFormat": "A",
|
|
19
|
+
"islamicMonthStart": "14351201",
|
|
20
|
+
"gregDate": "20140925"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"dateFormat": "A",
|
|
24
|
+
"islamicMonthStart": "14360101",
|
|
25
|
+
"gregDate": "20141024"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"dateFormat": "A",
|
|
29
|
+
"islamicMonthStart": "14360201",
|
|
30
|
+
"gregDate": "20141123"
|
|
31
|
+
}
|
|
32
|
+
]
|
|
16
33
|
},
|
|
17
34
|
"theme": "sap_belize_hcb",
|
|
18
35
|
"noConflict": {
|
|
@@ -23,7 +40,7 @@
|
|
|
23
40
|
|
|
24
41
|
|
|
25
42
|
|
|
26
|
-
<script type="module" crossorigin src="/assets/bundle.esm.
|
|
43
|
+
<script type="module" crossorigin src="/assets/bundle.esm.76492ab6.js"></script>
|
|
27
44
|
</head>
|
|
28
45
|
|
|
29
46
|
<body>
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
<script type="module" crossorigin src="/assets/test/pages/i18n.html.
|
|
11
|
-
<link rel="modulepreload" href="/assets/bundle.esm.
|
|
10
|
+
<script type="module" crossorigin src="/assets/test/pages/i18n.html.2fe80529.js"></script>
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/bundle.esm.76492ab6.js">
|
|
12
12
|
</head>
|
|
13
13
|
|
|
14
14
|
<body>
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
<script type="module" crossorigin src="/assets/test/pages/i18n_texts.html.
|
|
12
|
-
<link rel="modulepreload" href="/assets/bundle.esm.
|
|
11
|
+
<script type="module" crossorigin src="/assets/test/pages/i18n_texts.html.fef7ef14.js"></script>
|
|
12
|
+
<link rel="modulepreload" crossorigin href="/assets/bundle.esm.76492ab6.js">
|
|
13
13
|
</head>
|
|
14
14
|
|
|
15
15
|
<body>
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
+
import UI5Element from "../UI5Element.js";
|
|
2
|
+
type MutationCallback = () => void;
|
|
1
3
|
declare const getEffectiveAriaLabelText: (el: HTMLElement) => string | undefined;
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param {HTMLElement} el Defines the HTMLElement, for which you need to get all related texts
|
|
7
|
+
*/
|
|
8
|
+
declare const getAllAccessibleNameRefTexts: (el: HTMLElement) => string;
|
|
2
9
|
/**
|
|
3
10
|
* @param {HTMLElement} el Defines the HTMLElement, for which you need to get all related "label for" texts
|
|
4
11
|
*/
|
|
5
12
|
declare const getAssociatedLabelForTexts: (el: HTMLElement) => string | undefined;
|
|
6
|
-
|
|
13
|
+
declare const registerUI5Element: (el: UI5Element, callback: MutationCallback) => void;
|
|
14
|
+
declare const deregisterUI5Element: (el: UI5Element) => void;
|
|
15
|
+
export { getEffectiveAriaLabelText, getAssociatedLabelForTexts, registerUI5Element, deregisterUI5Element, getAllAccessibleNameRefTexts, };
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
const associatedElements = new WeakMap();
|
|
2
|
+
const registeredElements = new WeakMap();
|
|
3
|
+
const observerOptions = {
|
|
4
|
+
attributes: true,
|
|
5
|
+
childList: true,
|
|
6
|
+
characterData: true,
|
|
7
|
+
subtree: true,
|
|
8
|
+
};
|
|
1
9
|
const getEffectiveAriaLabelText = (el) => {
|
|
2
10
|
const accessibleEl = el;
|
|
3
11
|
if (!accessibleEl.accessibleNameRef) {
|
|
@@ -6,31 +14,59 @@ const getEffectiveAriaLabelText = (el) => {
|
|
|
6
14
|
}
|
|
7
15
|
return undefined;
|
|
8
16
|
}
|
|
9
|
-
return
|
|
17
|
+
return getAllAccessibleNameRefTexts(el);
|
|
10
18
|
};
|
|
11
19
|
/**
|
|
12
20
|
*
|
|
13
21
|
* @param {HTMLElement} el Defines the HTMLElement, for which you need to get all related texts
|
|
14
22
|
*/
|
|
15
|
-
const
|
|
16
|
-
const ids = el.accessibleNameRef
|
|
23
|
+
const getAllAccessibleNameRefTexts = (el) => {
|
|
24
|
+
const ids = el.accessibleNameRef?.split(" ") ?? [];
|
|
17
25
|
const owner = el.getRootNode();
|
|
18
26
|
let result = "";
|
|
19
27
|
ids.forEach((elementId, index) => {
|
|
20
28
|
const element = owner.querySelector(`[id='${elementId}']`);
|
|
21
|
-
|
|
22
|
-
if (
|
|
23
|
-
result +=
|
|
29
|
+
const text = `${element && element.textContent ? element.textContent : ""}`;
|
|
30
|
+
if (text) {
|
|
31
|
+
result += text;
|
|
32
|
+
if (index < ids.length - 1) {
|
|
33
|
+
result += " ";
|
|
34
|
+
}
|
|
24
35
|
}
|
|
25
36
|
});
|
|
26
37
|
return result;
|
|
27
38
|
};
|
|
39
|
+
const _getAllAssociatedElementsFromDOM = (el) => {
|
|
40
|
+
const set = new Set();
|
|
41
|
+
// adding labels with attribute for matching the el.id
|
|
42
|
+
const labelsForAssociated = _getAssociatedLabels(el);
|
|
43
|
+
labelsForAssociated.forEach(itm => {
|
|
44
|
+
set.add(itm);
|
|
45
|
+
});
|
|
46
|
+
// adding other elements that id is the same as accessibleNameRef value
|
|
47
|
+
const value = el["accessibleNameRef"];
|
|
48
|
+
const ids = value?.split(" ") ?? [];
|
|
49
|
+
ids.forEach(id => {
|
|
50
|
+
const refEl = _getReferencedElementById(el, id);
|
|
51
|
+
if (refEl) {
|
|
52
|
+
set.add(refEl);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return Array.from(set);
|
|
56
|
+
};
|
|
57
|
+
const _getAssociatedLabels = (el) => {
|
|
58
|
+
const labels = el.getRootNode().querySelectorAll(`[for="${el.id}"]`);
|
|
59
|
+
return Array.from(labels);
|
|
60
|
+
};
|
|
61
|
+
const _getReferencedElementById = (el, elementId) => {
|
|
62
|
+
return el.getRootNode().querySelector(`[id='${elementId}']`);
|
|
63
|
+
};
|
|
28
64
|
/**
|
|
29
65
|
* @param {HTMLElement} el Defines the HTMLElement, for which you need to get all related "label for" texts
|
|
30
66
|
*/
|
|
31
67
|
const getAssociatedLabelForTexts = (el) => {
|
|
32
68
|
const results = [];
|
|
33
|
-
const labels =
|
|
69
|
+
const labels = _getAssociatedLabels(el);
|
|
34
70
|
labels.forEach((label) => {
|
|
35
71
|
const labelText = label.textContent;
|
|
36
72
|
labelText && results.push(labelText);
|
|
@@ -40,5 +76,96 @@ const getAssociatedLabelForTexts = (el) => {
|
|
|
40
76
|
}
|
|
41
77
|
return undefined;
|
|
42
78
|
};
|
|
43
|
-
|
|
79
|
+
const _createInvalidationCallback = (el) => {
|
|
80
|
+
const invalidationCallback = (changeInfo) => {
|
|
81
|
+
if (!(changeInfo && changeInfo.type === "property" && changeInfo.name === "accessibleNameRef")) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const registeredElement = registeredElements.get(el);
|
|
85
|
+
if (!registeredElement) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const oldAssociatedElements = registeredElement.observedElements;
|
|
89
|
+
const newAssociatedElements = _getAllAssociatedElementsFromDOM(el);
|
|
90
|
+
oldAssociatedElements.forEach(oldElement => {
|
|
91
|
+
if (!newAssociatedElements.includes(oldElement)) {
|
|
92
|
+
_removeObservedElementFromRegisteredElement(registeredElement, oldElement);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
newAssociatedElements.forEach(newElement => {
|
|
96
|
+
if (!oldAssociatedElements.includes(newElement)) {
|
|
97
|
+
_addObservedElementToRegisteredElement(registeredElement, newElement);
|
|
98
|
+
registeredElement.observedElements.push(newElement);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
registeredElement?.callback();
|
|
102
|
+
};
|
|
103
|
+
return invalidationCallback;
|
|
104
|
+
};
|
|
105
|
+
const registerUI5Element = (el, callback) => {
|
|
106
|
+
if (registeredElements.has(el)) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const allAssociatedElements = _getAllAssociatedElementsFromDOM(el);
|
|
110
|
+
const invalidationCallback = _createInvalidationCallback(el);
|
|
111
|
+
const registeredElement = {
|
|
112
|
+
host: el,
|
|
113
|
+
observedElements: allAssociatedElements,
|
|
114
|
+
callback,
|
|
115
|
+
invalidationCallback,
|
|
116
|
+
};
|
|
117
|
+
registeredElements.set(el, registeredElement);
|
|
118
|
+
el.attachInvalidate(invalidationCallback);
|
|
119
|
+
allAssociatedElements.forEach((element) => {
|
|
120
|
+
_addObservedElementToRegisteredElement(registeredElement, element);
|
|
121
|
+
});
|
|
122
|
+
callback();
|
|
123
|
+
};
|
|
124
|
+
const _addObservedElementToRegisteredElement = (registeredElement, element) => {
|
|
125
|
+
let associatedElement = associatedElements.get(element);
|
|
126
|
+
if (!associatedElement) {
|
|
127
|
+
associatedElement = { observer: null, callbacks: [] };
|
|
128
|
+
const observer = new MutationObserver(() => {
|
|
129
|
+
const callbacks = associatedElement.callbacks;
|
|
130
|
+
callbacks.forEach(callback => {
|
|
131
|
+
callback();
|
|
132
|
+
});
|
|
133
|
+
const domEl = document.getElementById(element.id);
|
|
134
|
+
// if no longer should be observed from this registeredElement, remove it
|
|
135
|
+
if (!(registeredElement.host.id === element.getAttribute("for") || domEl)) {
|
|
136
|
+
_removeObservedElementFromRegisteredElement(registeredElement, element);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
associatedElement.observer = observer;
|
|
140
|
+
observer.observe(element, observerOptions);
|
|
141
|
+
associatedElements.set(element, associatedElement);
|
|
142
|
+
}
|
|
143
|
+
if (!associatedElement.callbacks.includes(registeredElement.callback)) {
|
|
144
|
+
associatedElement.callbacks.push(registeredElement.callback);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const _removeObservedElementFromRegisteredElement = (registeredElement, element) => {
|
|
148
|
+
const associatedElement = associatedElements.get(element);
|
|
149
|
+
if (associatedElement) {
|
|
150
|
+
associatedElement.callbacks = associatedElement.callbacks.filter(itm => itm !== registeredElement.callback);
|
|
151
|
+
if (!associatedElement.callbacks.length) {
|
|
152
|
+
associatedElement.observer?.disconnect();
|
|
153
|
+
associatedElements.delete(element);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
registeredElement.observedElements = registeredElement.observedElements.filter(itm => itm !== element);
|
|
157
|
+
};
|
|
158
|
+
const deregisterUI5Element = (el) => {
|
|
159
|
+
const registeredElement = registeredElements.get(el);
|
|
160
|
+
if (!registeredElement) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const oldObservedElements = [...registeredElement.observedElements];
|
|
164
|
+
oldObservedElements.forEach(observedElement => {
|
|
165
|
+
_removeObservedElementFromRegisteredElement(registeredElement, observedElement);
|
|
166
|
+
});
|
|
167
|
+
el.detachInvalidate(registeredElement.invalidationCallback);
|
|
168
|
+
registeredElements.delete(el);
|
|
169
|
+
};
|
|
170
|
+
export { getEffectiveAriaLabelText, getAssociatedLabelForTexts, registerUI5Element, deregisterUI5Element, getAllAccessibleNameRefTexts, };
|
|
44
171
|
//# sourceMappingURL=AriaLabelHelper.js.map
|