@ui5/webcomponents-base 1.4.0 → 1.7.0
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 +51 -0
- package/README.md +28 -6
- package/bundle.esm.js +7 -9
- package/dist/CustomElementsRegistry.js +1 -1
- package/dist/UI5Element.js +13 -1
- package/dist/asset-registries/Icons.js +1 -1
- package/dist/asset-registries/LocaleData.js +1 -1
- package/dist/asset-registries/i18n.js +3 -1
- package/dist/assets/bundle.esm.c6602dfc.js +43 -0
- package/dist/css/FontFace.css +9 -18
- package/dist/delegate/ItemNavigation.js +9 -4
- package/dist/features/F6Navigation.js +4 -0
- package/dist/generated/VersionInfo.js +3 -3
- package/dist/generated/css/FontFace.css.js +1 -1
- package/dist/i18nBundle.js +1 -1
- package/dist/types/DOMReference.js +24 -0
- package/dist/updateShadowRoot.js +1 -2
- package/dist/util/AriaLabelHelper.js +2 -4
- package/dist/util/Caret.js +1 -14
- package/dist/util/ColorConversion.js +30 -2
- package/dist/util/InvisibleMessage.js +9 -0
- package/dist/util/getEffectiveScrollbarStyle.js +5 -0
- package/dist/util/isDefaultSlotProvided.js +11 -0
- package/lib/generate-styles/index.js +1 -1
- package/package-scripts.js +14 -16
- package/package.json +4 -3
- package/src/CustomElementsRegistry.js +1 -1
- package/src/UI5Element.js +13 -1
- package/src/asset-registries/Icons.js +1 -1
- package/src/asset-registries/LocaleData.js +1 -1
- package/src/asset-registries/i18n.js +3 -1
- package/src/css/FontFace.css +9 -18
- package/src/delegate/ItemNavigation.js +9 -4
- package/src/features/F6Navigation.js +4 -0
- package/src/i18nBundle.js +1 -1
- package/src/types/DOMReference.js +24 -0
- package/src/updateShadowRoot.js +1 -2
- package/src/util/AriaLabelHelper.js +2 -4
- package/src/util/Caret.js +1 -14
- package/src/util/ColorConversion.js +30 -2
- package/src/util/InvisibleMessage.js +9 -0
- package/src/util/getEffectiveScrollbarStyle.js +5 -0
- package/src/util/isDefaultSlotProvided.js +11 -0
- package/config/.eslintrc.js +0 -3
- package/config/rollup.config.js +0 -1
- package/dist/isLegacyBrowser.js +0 -3
- package/dist/resources/bundle.esm.js +0 -32
- package/dist/resources/bundle.esm.js.map +0 -1
- package/dist/test-resources/assets/Themes.js +0 -17
- package/dist/test-resources/elements/Child.js +0 -35
- package/dist/test-resources/elements/Generic.js +0 -84
- package/dist/test-resources/elements/GenericExt.js +0 -26
- package/dist/test-resources/elements/NoShadowDOM.js +0 -13
- package/dist/test-resources/elements/Parent.js +0 -41
- package/dist/test-resources/elements/WithStaticArea.js +0 -77
- package/dist/test-resources/pages/AllTestElements.html +0 -42
- package/dist/test-resources/pages/Configuration.html +0 -18
- package/dist/test-resources/pages/ConfigurationScript.html +0 -34
- package/dist/test-resources/pages/assets/messagebundle_de.properties +0 -1
- package/dist/test-resources/pages/assets/messagebundle_en.properties +0 -1
- package/dist/test-resources/pages/assets/messagebundle_es.properties +0 -1
- package/dist/test-resources/pages/assets/messagebundle_fr.properties +0 -1
- package/dist/test-resources/pages/i18n.html +0 -33
- package/dist/test-resources/specs/ConfigurationChange.spec.js +0 -27
- package/dist/test-resources/specs/ConfigurationScript.spec.js +0 -63
- package/dist/test-resources/specs/ConfigurationURL.spec.js +0 -93
- package/dist/test-resources/specs/CustomTheme.spec.js +0 -27
- package/dist/test-resources/specs/EventProvider.spec.js +0 -63
- package/dist/test-resources/specs/StaticArea.spec.js +0 -78
- package/dist/test-resources/specs/Theming.spec.js +0 -44
- package/dist/test-resources/specs/UI5ElementInvalidation.js +0 -242
- package/dist/test-resources/specs/UI5ElementLifecycle.js +0 -98
- package/dist/test-resources/specs/UI5ElementListenForChildPropChanges.spec.js +0 -75
- package/dist/test-resources/specs/UI5ElementMetadataExt.js +0 -42
- package/dist/test-resources/specs/UI5ElementPropertyValidation.js +0 -14
- package/dist/test-resources/specs/UI5ElementPropsAndAttrs.spec.js +0 -67
- package/dist/test-resources/specs/UI5ElementShadowDOM.js +0 -24
- package/dist/test-resources/specs/UI5ElementSlots.js +0 -36
- package/dist/util/findNodeOwner.js +0 -35
- package/src/isLegacyBrowser.js +0 -3
- package/src/util/findNodeOwner.js +0 -35
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import DataType from "./DataType.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @class
|
|
5
|
+
* DOM Element reference or ID.
|
|
6
|
+
* <b>Note:</b> If an ID is passed, it is expected to be part of the same <code>document</code> element as the consuming component.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
class DOMReference extends DataType {
|
|
11
|
+
static isValid(value) {
|
|
12
|
+
return (typeof value === "string" || value instanceof HTMLElement);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static propertyToAttribute(propertyValue) {
|
|
16
|
+
if (propertyValue instanceof HTMLElement) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return propertyValue;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default DOMReference;
|
package/dist/updateShadowRoot.js
CHANGED
|
@@ -2,7 +2,6 @@ import executeTemplate from "./renderer/executeTemplate.js";
|
|
|
2
2
|
import getConstructableStyle from "./theming/getConstructableStyle.js";
|
|
3
3
|
import getEffectiveStyle from "./theming/getEffectiveStyle.js";
|
|
4
4
|
import getEffectiveLinksHrefs from "./theming/getEffectiveLinksHrefs.js";
|
|
5
|
-
import isLegacyBrowser from "./isLegacyBrowser.js";
|
|
6
5
|
import { shouldUseLinks } from "./CSP.js";
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -20,7 +19,7 @@ const updateShadowRoot = (element, forStaticArea = false) => {
|
|
|
20
19
|
styleStrOrHrefsArr = getEffectiveLinksHrefs(element.constructor, forStaticArea);
|
|
21
20
|
} else if (document.adoptedStyleSheets) { // Chrome
|
|
22
21
|
shadowRoot.adoptedStyleSheets = getConstructableStyle(element.constructor, forStaticArea);
|
|
23
|
-
} else
|
|
22
|
+
} else { // FF, Safari
|
|
24
23
|
styleStrOrHrefsArr = getEffectiveStyle(element.constructor, forStaticArea);
|
|
25
24
|
}
|
|
26
25
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import findNodeOwner from "./findNodeOwner.js";
|
|
2
|
-
|
|
3
1
|
const getEffectiveAriaLabelText = el => {
|
|
4
2
|
if (!el.accessibleNameRef) {
|
|
5
3
|
if (el.accessibleName) {
|
|
@@ -15,12 +13,12 @@ const getEffectiveAriaLabelText = el => {
|
|
|
15
13
|
/**
|
|
16
14
|
*
|
|
17
15
|
* @param {HTMLElement} el Defines the HTMLElement, for which you need to get all related texts
|
|
18
|
-
* @param {HTMLElement} ownerDocument (Optional) Defines the
|
|
16
|
+
* @param {Document|HTMLElement} ownerDocument (Optional) Defines the document or element where you want to search for the texts
|
|
19
17
|
* @param {String} readyIds (Optional) Defines a string of elements ids. The text of these elements will be returned. If used you should provide either el or ownerDocument
|
|
20
18
|
*/
|
|
21
19
|
const getAriaLabelledByTexts = (el, ownerDocument, readyIds = "") => {
|
|
22
20
|
const ids = (readyIds && readyIds.split(" ")) || el.accessibleNameRef.split(" ");
|
|
23
|
-
const owner = ownerDocument ||
|
|
21
|
+
const owner = ownerDocument || el.getRootNode();
|
|
24
22
|
let result = "";
|
|
25
23
|
|
|
26
24
|
ids.forEach((elementId, index) => {
|
package/dist/util/Caret.js
CHANGED
|
@@ -6,20 +6,7 @@ const getCaretPosition = field => {
|
|
|
6
6
|
// Initialize
|
|
7
7
|
let caretPos = 0;
|
|
8
8
|
|
|
9
|
-
//
|
|
10
|
-
if (document.selection) {
|
|
11
|
-
// Set focus on the element
|
|
12
|
-
field.focus();
|
|
13
|
-
|
|
14
|
-
// To get cursor position, get empty selection range
|
|
15
|
-
const selection = document.selection.createRange();
|
|
16
|
-
|
|
17
|
-
// Move selection start to 0 position
|
|
18
|
-
selection.moveStart("character", -field.value.length);
|
|
19
|
-
|
|
20
|
-
// The caret position is selection length
|
|
21
|
-
caretPos = selection.text.length;
|
|
22
|
-
} else if (field.selectionStart || field.selectionStart === "0") { // Firefox support
|
|
9
|
+
if (field.selectionStart || field.selectionStart === "0") { // Firefox support
|
|
23
10
|
caretPos = field.selectionDirection === "backward" ? field.selectionStart : field.selectionEnd;
|
|
24
11
|
}
|
|
25
12
|
|
|
@@ -163,7 +163,7 @@ const getRGBColor = color => {
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
if (color.startsWith("rgb")) {
|
|
166
|
-
return
|
|
166
|
+
return RGBStringToRGBObject(color);
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
// HEX
|
|
@@ -209,7 +209,7 @@ const RGBAToRGB = color => {
|
|
|
209
209
|
* Return an object with the properties for each of the main colors(red, green, blue)
|
|
210
210
|
* @param {String} color Receives a color in the following format: "rgb(0, 0, 0)
|
|
211
211
|
*/
|
|
212
|
-
const
|
|
212
|
+
const RGBStringToRGBObject = color => {
|
|
213
213
|
const openingBracketIndex = color.indexOf("("),
|
|
214
214
|
closingBraketIndex = color.indexOf(")"),
|
|
215
215
|
commasIndexes = [];
|
|
@@ -319,6 +319,32 @@ const HEXToRGB = hex => {
|
|
|
319
319
|
return rgbValues;
|
|
320
320
|
};
|
|
321
321
|
|
|
322
|
+
/**
|
|
323
|
+
* Returns the hex value of the color as string
|
|
324
|
+
* @param {Object} color Receives an object with the properties for each of the main colors(r, g, b)
|
|
325
|
+
*/
|
|
326
|
+
const RGBtoHEX = color => {
|
|
327
|
+
const hexMap = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E"];
|
|
328
|
+
let hexValue = "#";
|
|
329
|
+
|
|
330
|
+
let divisionNumber = color.r / 16;
|
|
331
|
+
let remainder = color.r % 16;
|
|
332
|
+
hexValue += String(hexMap[Math.floor(divisionNumber)]);
|
|
333
|
+
hexValue += String(hexMap[remainder]);
|
|
334
|
+
|
|
335
|
+
divisionNumber = color.g / 16;
|
|
336
|
+
remainder = color.g % 16;
|
|
337
|
+
hexValue += String(hexMap[Math.floor(divisionNumber)]);
|
|
338
|
+
hexValue += String(hexMap[remainder]);
|
|
339
|
+
|
|
340
|
+
divisionNumber = color.b / 16;
|
|
341
|
+
remainder = color.b % 16;
|
|
342
|
+
hexValue += String(hexMap[Math.floor(divisionNumber)]);
|
|
343
|
+
hexValue += String(hexMap[remainder]);
|
|
344
|
+
|
|
345
|
+
return hexValue;
|
|
346
|
+
};
|
|
347
|
+
|
|
322
348
|
const RGBToHSL = (color = {
|
|
323
349
|
r: undefined,
|
|
324
350
|
g: undefined,
|
|
@@ -367,4 +393,6 @@ export {
|
|
|
367
393
|
HSLToRGB,
|
|
368
394
|
HEXToRGB,
|
|
369
395
|
RGBToHSL,
|
|
396
|
+
RGBStringToRGBObject,
|
|
397
|
+
RGBtoHEX,
|
|
370
398
|
};
|
|
@@ -43,6 +43,7 @@ attachBoot(() => {
|
|
|
43
43
|
*
|
|
44
44
|
* @param {string} message String to be announced by the screen reader.
|
|
45
45
|
* @param {sap.ui.core.InvisibleMessageMode} mode The mode to be inserted in the aria-live attribute.
|
|
46
|
+
* @public
|
|
46
47
|
*/
|
|
47
48
|
const announce = (message, mode) => {
|
|
48
49
|
// If no type is presented, fallback to polite announcement.
|
|
@@ -55,6 +56,14 @@ const announce = (message, mode) => {
|
|
|
55
56
|
if (mode !== InvisibleMessageMode.Assertive && mode !== InvisibleMessageMode.Polite) {
|
|
56
57
|
console.warn(`You have entered an invalid mode. Valid values are: "Polite" and "Assertive". The framework will automatically set the mode to "Polite".`); // eslint-disable-line
|
|
57
58
|
}
|
|
59
|
+
|
|
60
|
+
// clear the span in order to avoid reading it out while in JAWS reading node
|
|
61
|
+
setTimeout(() => {
|
|
62
|
+
// ensure that we clear the text node only if no announce is made in the meantime
|
|
63
|
+
if (span.textContent === message) {
|
|
64
|
+
span.textContent = "";
|
|
65
|
+
}
|
|
66
|
+
}, 3000);
|
|
58
67
|
};
|
|
59
68
|
|
|
60
69
|
export default announce;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getSlotName } from "./SlotsHelper.js";
|
|
2
|
+
|
|
3
|
+
const isDefaultSlotProvided = element => {
|
|
4
|
+
return Array.from(element.childNodes).filter(node => {
|
|
5
|
+
return node.nodeType !== Node.COMMENT_NODE
|
|
6
|
+
&& getSlotName(node) === "default"
|
|
7
|
+
&& (node.nodeType !== Node.TEXT_NODE || node.nodeValue.trim().length !== 0);
|
|
8
|
+
}).length > 0;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default isDefaultSlotProvided;
|
|
@@ -3,7 +3,7 @@ const path = require('path');
|
|
|
3
3
|
const CleanCSS = require('clean-css');
|
|
4
4
|
|
|
5
5
|
const generate = async () => {
|
|
6
|
-
await fs.mkdir("dist/generated/css/");
|
|
6
|
+
await fs.mkdir("dist/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 => {
|
package/package-scripts.js
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
const resolve = require("resolve");
|
|
2
|
+
const path = require("path");
|
|
2
3
|
|
|
3
4
|
const assetParametersScript = resolve.sync("@ui5/webcomponents-base/lib/generate-asset-parameters/index.js");
|
|
4
5
|
const stylesScript = resolve.sync("@ui5/webcomponents-base/lib/generate-styles/index.js");
|
|
5
6
|
const versionScript = resolve.sync("@ui5/webcomponents-base/lib/generate-version-info/index.js");
|
|
6
|
-
const serve = resolve.sync("@ui5/webcomponents-tools/lib/serve/index.js");
|
|
7
7
|
const copyUsedModules = resolve.sync("@ui5/webcomponents-tools/lib/copy-list/index.js");
|
|
8
8
|
const esmAbsToRel = resolve.sync("@ui5/webcomponents-tools/lib/esm-abs-to-rel/index.js");
|
|
9
9
|
|
|
10
|
+
const LIB = path.join(__dirname, `../tools/lib/`);
|
|
11
|
+
|
|
12
|
+
const viteConfig = `-c "${require.resolve("@ui5/webcomponents-tools/components-package/vite.config.js")}"`;
|
|
13
|
+
const eslintConfig = `--config ${require.resolve("@ui5/webcomponents-tools/components-package/eslint.js")}`;
|
|
14
|
+
|
|
10
15
|
const scripts = {
|
|
11
16
|
clean: "rimraf dist && rimraf .port",
|
|
12
|
-
lint:
|
|
17
|
+
lint: `eslint . ${eslintConfig}`,
|
|
13
18
|
prepare: "nps clean integrate copy generateAssetParameters generateVersionInfo generateStyles",
|
|
14
19
|
integrate: {
|
|
15
20
|
default: "nps integrate.copy-used-modules integrate.replace-amd integrate.amd-to-es6 integrate.esm-abs-to-rel integrate.third-party",
|
|
@@ -25,31 +30,24 @@ const scripts = {
|
|
|
25
30
|
},
|
|
26
31
|
build: {
|
|
27
32
|
default: `nps lint prepare build.bundle`,
|
|
28
|
-
bundle:
|
|
33
|
+
bundle: `vite build ${viteConfig}`,
|
|
29
34
|
},
|
|
30
35
|
copy: {
|
|
31
|
-
default: "nps copy.src
|
|
36
|
+
default: "nps copy.src",
|
|
32
37
|
src: `copy-and-watch "src/**/*.{js,css}" dist/`,
|
|
33
|
-
test: `copy-and-watch "test/**/*.*" dist/test-resources`,
|
|
34
38
|
},
|
|
35
39
|
generateAssetParameters: `node "${assetParametersScript}"`,
|
|
36
40
|
generateVersionInfo: `node "${versionScript}"`,
|
|
37
41
|
generateStyles: `node "${stylesScript}"`,
|
|
38
42
|
watch: {
|
|
39
|
-
default: 'concurrently "nps watch.
|
|
43
|
+
default: 'concurrently "nps watch.src" "nps watch.styles"',
|
|
44
|
+
withBundle: 'concurrently "nps watch.src" "nps watch.bundle" "nps watch.styles"',
|
|
40
45
|
src: 'nps "copy.src --watch --skip-initial-copy"',
|
|
41
|
-
|
|
42
|
-
bundle: "rollup --config config/rollup.config.js -w --environment DEV",
|
|
46
|
+
bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
|
|
43
47
|
styles: 'chokidar "src/css/*.css" -c "nps generateStyles"'
|
|
44
48
|
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
serve: `node "${serve}" --dir="dist/" --port=9191 --packageName="@ui5/webcomponents-base"`,
|
|
48
|
-
test: {
|
|
49
|
-
// --success first - report the exit code of the test run (first command to finish), as serve is always terminated and has a non-0 exit code
|
|
50
|
-
default: 'concurrently "nps serve" "nps test.run" --kill-others --success first',
|
|
51
|
-
run: "cross-env WDIO_LOG_LEVEL=error FORCE_COLOR=0 wdio config/wdio.conf.js",
|
|
52
|
-
},
|
|
49
|
+
start: "nps prepare watch.withBundle",
|
|
50
|
+
test: `node "${LIB}/test-runner/test-runner.js"`,
|
|
53
51
|
};
|
|
54
52
|
|
|
55
53
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/webcomponents-base",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "UI5 Web Components: webcomponents.base",
|
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,13 +36,14 @@
|
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@buxlabs/amd-to-es6": "0.16.1",
|
|
38
38
|
"@openui5/sap.ui.core": "1.101.0",
|
|
39
|
-
"@ui5/webcomponents-tools": "1.
|
|
40
|
-
"chromedriver": "
|
|
39
|
+
"@ui5/webcomponents-tools": "1.7.0",
|
|
40
|
+
"chromedriver": "104.0.0",
|
|
41
41
|
"clean-css": "^5.2.2",
|
|
42
42
|
"copy-and-watch": "^0.1.5",
|
|
43
43
|
"cross-env": "^7.0.3",
|
|
44
44
|
"eslint": "^7.22.0",
|
|
45
45
|
"mkdirp": "^1.0.4",
|
|
46
|
+
"replace-in-file": "^6.3.5",
|
|
46
47
|
"resolve": "^1.20.0"
|
|
47
48
|
}
|
|
48
49
|
}
|
|
@@ -82,7 +82,7 @@ const displayFailedRegistrations = () => {
|
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
-
message = `${message}\n\nTo prevent other runtimes from defining tags that you use, consider using scoping or have third-party libraries use scoping: https://github.com/SAP/ui5-webcomponents/blob/
|
|
85
|
+
message = `${message}\n\nTo prevent other runtimes from defining tags that you use, consider using scoping or have third-party libraries use scoping: https://github.com/SAP/ui5-webcomponents/blob/main/docs/2-advanced/03-scoping.md.`;
|
|
86
86
|
|
|
87
87
|
console.warn(message); // eslint-disable-line
|
|
88
88
|
};
|
package/src/UI5Element.js
CHANGED
|
@@ -74,6 +74,7 @@ class UI5Element extends HTMLElement {
|
|
|
74
74
|
deferredResolve = resolve;
|
|
75
75
|
});
|
|
76
76
|
this._domRefReadyPromise._deferredResolve = deferredResolve;
|
|
77
|
+
this._doNotSyncAttributes = new Set(); // attributes that are excluded from attributeChangedCallback synchronization
|
|
77
78
|
|
|
78
79
|
this._initializeState();
|
|
79
80
|
this._upgradeAllProperties();
|
|
@@ -376,6 +377,10 @@ class UI5Element extends HTMLElement {
|
|
|
376
377
|
* @private
|
|
377
378
|
*/
|
|
378
379
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
380
|
+
if (this._doNotSyncAttributes.has(name)) { // This attribute is mutated internally, not by the user
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
|
|
379
384
|
const properties = this.constructor.getMetadata().getProperties();
|
|
380
385
|
const realName = name.replace(/^ui5-/, "");
|
|
381
386
|
const nameInCamelCase = kebabToCamelCase(realName);
|
|
@@ -409,7 +414,14 @@ class UI5Element extends HTMLElement {
|
|
|
409
414
|
this.removeAttribute(attrName);
|
|
410
415
|
}
|
|
411
416
|
} else if (isDescendantOf(propertyTypeClass, DataType)) {
|
|
412
|
-
|
|
417
|
+
const newAttrValue = propertyTypeClass.propertyToAttribute(newValue);
|
|
418
|
+
if (newAttrValue === null) { // null means there must be no attribute for the current value of the property
|
|
419
|
+
this._doNotSyncAttributes.add(attrName); // skip the attributeChangedCallback call for this attribute
|
|
420
|
+
this.removeAttribute(attrName); // remove the attribute safely (will not trigger synchronization to the property value due to the above line)
|
|
421
|
+
this._doNotSyncAttributes.delete(attrName); // enable synchronization again for this attribute
|
|
422
|
+
} else {
|
|
423
|
+
this.setAttribute(attrName, newAttrValue);
|
|
424
|
+
}
|
|
413
425
|
} else if (typeof newValue !== "object") {
|
|
414
426
|
if (attrValue !== newValue) {
|
|
415
427
|
this.setAttribute(attrName, newValue);
|
|
@@ -36,7 +36,7 @@ const _fillRegistry = bundleData => {
|
|
|
36
36
|
const iconData = bundleData.data[iconName];
|
|
37
37
|
|
|
38
38
|
registerIcon(iconName, {
|
|
39
|
-
pathData: iconData.path,
|
|
39
|
+
pathData: iconData.path || iconData.paths,
|
|
40
40
|
ltr: iconData.ltr,
|
|
41
41
|
accData: iconData.acc,
|
|
42
42
|
collection: bundleData.collection,
|
|
@@ -147,7 +147,7 @@ const registerLocaleDataLoader = (localeId, loader) => {
|
|
|
147
147
|
|
|
148
148
|
// register default loader for "en" from ui5 CDN (dev workflow without assets)
|
|
149
149
|
registerLocaleDataLoader("en", async runtimeLocaleId => {
|
|
150
|
-
return (await fetch(`https://
|
|
150
|
+
return (await fetch(`https://sdk.openui5.org/1.103.0/resources/sap/ui/core/cldr/en.json`)).json();
|
|
151
151
|
});
|
|
152
152
|
|
|
153
153
|
// When the language changes dynamically (the user calls setLanguage),
|
|
@@ -14,10 +14,12 @@ const bundlePromises = new Map();
|
|
|
14
14
|
const loaders = new Map();
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
+
* Registers i18n loader function for given package and locale.
|
|
17
18
|
*
|
|
19
|
+
* @public
|
|
18
20
|
* @param {string} packageName for which package this loader can fetch data
|
|
21
|
+
* @param {string} localeId locale that this loader can handle
|
|
19
22
|
* @param {function} loader async function that will be passed a localeId and should return a JSON object
|
|
20
|
-
* @param {Array} localeIds Array of locale IDs that this loader can handle
|
|
21
23
|
*/
|
|
22
24
|
const registerI18nLoader = (packageName, localeId, loader) => {
|
|
23
25
|
// register loader by key
|
package/src/css/FontFace.css
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
font-style: normal;
|
|
4
4
|
font-weight: 400;
|
|
5
5
|
src: local("72"),
|
|
6
|
-
url(https://
|
|
7
|
-
url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular.woff?ui5-webcomponents) format("woff");
|
|
6
|
+
url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular.woff2?ui5-webcomponents) format("woff2");
|
|
8
7
|
}
|
|
9
8
|
|
|
10
9
|
@font-face {
|
|
@@ -12,8 +11,7 @@
|
|
|
12
11
|
font-style: normal;
|
|
13
12
|
font-weight: 400;
|
|
14
13
|
src: local('72-full'),
|
|
15
|
-
url(https://
|
|
16
|
-
url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular-full.woff?ui5-webcomponents) format("woff");
|
|
14
|
+
url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular-full.woff2?ui5-webcomponents) format("woff2");
|
|
17
15
|
|
|
18
16
|
}
|
|
19
17
|
|
|
@@ -22,8 +20,7 @@
|
|
|
22
20
|
font-style: normal;
|
|
23
21
|
font-weight: 700;
|
|
24
22
|
src: local('72-Bold'),
|
|
25
|
-
url(https://
|
|
26
|
-
url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff?ui5-webcomponents) format("woff");
|
|
23
|
+
url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff2?ui5-webcomponents) format("woff2");
|
|
27
24
|
}
|
|
28
25
|
|
|
29
26
|
@font-face {
|
|
@@ -31,38 +28,33 @@
|
|
|
31
28
|
font-style: normal;
|
|
32
29
|
font-weight: 700;
|
|
33
30
|
src: local('72-Bold-full'),
|
|
34
|
-
url(https://
|
|
35
|
-
url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff?ui5-webcomponents) format("woff");
|
|
31
|
+
url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff2?ui5-webcomponents) format("woff2");
|
|
36
32
|
}
|
|
37
33
|
|
|
38
34
|
@font-face {
|
|
39
35
|
font-family: '72-Bold';
|
|
40
36
|
font-style: normal;
|
|
41
37
|
src: local('72-Bold'),
|
|
42
|
-
url(https://
|
|
43
|
-
url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff?ui5-webcomponents) format("woff");
|
|
38
|
+
url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff2?ui5-webcomponents) format("woff2");
|
|
44
39
|
}
|
|
45
40
|
|
|
46
41
|
@font-face {
|
|
47
42
|
font-family: '72-Boldfull';
|
|
48
43
|
font-style: normal;
|
|
49
|
-
src: url(https://
|
|
50
|
-
url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff?ui5-webcomponents) format("woff");
|
|
44
|
+
src: url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff2?ui5-webcomponents) format("woff2");
|
|
51
45
|
}
|
|
52
46
|
|
|
53
47
|
@font-face {
|
|
54
48
|
font-family: '72-Light';
|
|
55
49
|
font-style: normal;
|
|
56
50
|
src: local('72-Light'),
|
|
57
|
-
url(https://
|
|
58
|
-
url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Light.woff?ui5-webcomponents) format("woff");
|
|
51
|
+
url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Light.woff2?ui5-webcomponents) format("woff2");
|
|
59
52
|
}
|
|
60
53
|
|
|
61
54
|
@font-face {
|
|
62
55
|
font-family: '72-Lightfull';
|
|
63
56
|
font-style: normal;
|
|
64
|
-
src: url(https://
|
|
65
|
-
url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Light-full.woff?ui5-webcomponents) format("woff");
|
|
57
|
+
src: url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Light-full.woff2?ui5-webcomponents) format("woff2");
|
|
66
58
|
}
|
|
67
59
|
|
|
68
60
|
@font-face {
|
|
@@ -70,6 +62,5 @@
|
|
|
70
62
|
font-style: bold;
|
|
71
63
|
font-weight: 900;
|
|
72
64
|
src: local('72Black'),
|
|
73
|
-
url(https://
|
|
74
|
-
url(https://openui5nightly.hana.ondemand.com/resources/sap/ui/core/themes/sap_horizon/fonts/72-Black.woff?ui5-webcomponents) format("woff");
|
|
65
|
+
url(https://sdk.openui5.org.com/resources/sap/ui/core/themes/sap_horizon/fonts/72-Black.woff2?ui5-webcomponents) format("woff2");
|
|
75
66
|
}
|
|
@@ -133,15 +133,20 @@ class ItemNavigation {
|
|
|
133
133
|
|
|
134
134
|
const horizontalNavigationOn = this._navigationMode === NavigationMode.Horizontal || this._navigationMode === NavigationMode.Auto;
|
|
135
135
|
const verticalNavigationOn = this._navigationMode === NavigationMode.Vertical || this._navigationMode === NavigationMode.Auto;
|
|
136
|
+
const isRTL = this.rootWebComponent.effectiveDir === "rtl";
|
|
136
137
|
|
|
137
|
-
if (
|
|
138
|
-
this.
|
|
139
|
-
} else if (
|
|
140
|
-
this.
|
|
138
|
+
if (isRTL && isLeft(event) && horizontalNavigationOn) {
|
|
139
|
+
this._handleRight();
|
|
140
|
+
} else if (isRTL && isRight(event) && horizontalNavigationOn) {
|
|
141
|
+
this._handleLeft();
|
|
141
142
|
} else if (isLeft(event) && horizontalNavigationOn) {
|
|
142
143
|
this._handleLeft();
|
|
143
144
|
} else if (isRight(event) && horizontalNavigationOn) {
|
|
144
145
|
this._handleRight();
|
|
146
|
+
} else if (isUp(event) && verticalNavigationOn) {
|
|
147
|
+
this._handleUp();
|
|
148
|
+
} else if (isDown(event) && verticalNavigationOn) {
|
|
149
|
+
this._handleDown();
|
|
145
150
|
} else if (isHome(event)) {
|
|
146
151
|
this._handleHome();
|
|
147
152
|
} else if (isEnd(event)) {
|
|
@@ -21,6 +21,8 @@ class F6Navigation {
|
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
|
|
24
26
|
const nextIndex = this.groups.indexOf(this.selectedGroup);
|
|
25
27
|
let nextElement = null;
|
|
26
28
|
|
|
@@ -44,6 +46,8 @@ class F6Navigation {
|
|
|
44
46
|
return;
|
|
45
47
|
}
|
|
46
48
|
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
|
|
47
51
|
const nextIndex = this.groups.indexOf(this.selectedGroup);
|
|
48
52
|
let nextElement = null;
|
|
49
53
|
|
package/src/i18nBundle.js
CHANGED
|
@@ -37,7 +37,7 @@ class I18nBundle {
|
|
|
37
37
|
}
|
|
38
38
|
const messageText = bundle && bundle[textObj.key] ? bundle[textObj.key] : (textObj.defaultText || textObj.key);
|
|
39
39
|
|
|
40
|
-
return formatMessage(messageText, params);
|
|
40
|
+
return params.length ? formatMessage(messageText, params) : messageText;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import DataType from "./DataType.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @class
|
|
5
|
+
* DOM Element reference or ID.
|
|
6
|
+
* <b>Note:</b> If an ID is passed, it is expected to be part of the same <code>document</code> element as the consuming component.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
class DOMReference extends DataType {
|
|
11
|
+
static isValid(value) {
|
|
12
|
+
return (typeof value === "string" || value instanceof HTMLElement);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static propertyToAttribute(propertyValue) {
|
|
16
|
+
if (propertyValue instanceof HTMLElement) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return propertyValue;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default DOMReference;
|
package/src/updateShadowRoot.js
CHANGED
|
@@ -2,7 +2,6 @@ import executeTemplate from "./renderer/executeTemplate.js";
|
|
|
2
2
|
import getConstructableStyle from "./theming/getConstructableStyle.js";
|
|
3
3
|
import getEffectiveStyle from "./theming/getEffectiveStyle.js";
|
|
4
4
|
import getEffectiveLinksHrefs from "./theming/getEffectiveLinksHrefs.js";
|
|
5
|
-
import isLegacyBrowser from "./isLegacyBrowser.js";
|
|
6
5
|
import { shouldUseLinks } from "./CSP.js";
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -20,7 +19,7 @@ const updateShadowRoot = (element, forStaticArea = false) => {
|
|
|
20
19
|
styleStrOrHrefsArr = getEffectiveLinksHrefs(element.constructor, forStaticArea);
|
|
21
20
|
} else if (document.adoptedStyleSheets) { // Chrome
|
|
22
21
|
shadowRoot.adoptedStyleSheets = getConstructableStyle(element.constructor, forStaticArea);
|
|
23
|
-
} else
|
|
22
|
+
} else { // FF, Safari
|
|
24
23
|
styleStrOrHrefsArr = getEffectiveStyle(element.constructor, forStaticArea);
|
|
25
24
|
}
|
|
26
25
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import findNodeOwner from "./findNodeOwner.js";
|
|
2
|
-
|
|
3
1
|
const getEffectiveAriaLabelText = el => {
|
|
4
2
|
if (!el.accessibleNameRef) {
|
|
5
3
|
if (el.accessibleName) {
|
|
@@ -15,12 +13,12 @@ const getEffectiveAriaLabelText = el => {
|
|
|
15
13
|
/**
|
|
16
14
|
*
|
|
17
15
|
* @param {HTMLElement} el Defines the HTMLElement, for which you need to get all related texts
|
|
18
|
-
* @param {HTMLElement} ownerDocument (Optional) Defines the
|
|
16
|
+
* @param {Document|HTMLElement} ownerDocument (Optional) Defines the document or element where you want to search for the texts
|
|
19
17
|
* @param {String} readyIds (Optional) Defines a string of elements ids. The text of these elements will be returned. If used you should provide either el or ownerDocument
|
|
20
18
|
*/
|
|
21
19
|
const getAriaLabelledByTexts = (el, ownerDocument, readyIds = "") => {
|
|
22
20
|
const ids = (readyIds && readyIds.split(" ")) || el.accessibleNameRef.split(" ");
|
|
23
|
-
const owner = ownerDocument ||
|
|
21
|
+
const owner = ownerDocument || el.getRootNode();
|
|
24
22
|
let result = "";
|
|
25
23
|
|
|
26
24
|
ids.forEach((elementId, index) => {
|
package/src/util/Caret.js
CHANGED
|
@@ -6,20 +6,7 @@ const getCaretPosition = field => {
|
|
|
6
6
|
// Initialize
|
|
7
7
|
let caretPos = 0;
|
|
8
8
|
|
|
9
|
-
//
|
|
10
|
-
if (document.selection) {
|
|
11
|
-
// Set focus on the element
|
|
12
|
-
field.focus();
|
|
13
|
-
|
|
14
|
-
// To get cursor position, get empty selection range
|
|
15
|
-
const selection = document.selection.createRange();
|
|
16
|
-
|
|
17
|
-
// Move selection start to 0 position
|
|
18
|
-
selection.moveStart("character", -field.value.length);
|
|
19
|
-
|
|
20
|
-
// The caret position is selection length
|
|
21
|
-
caretPos = selection.text.length;
|
|
22
|
-
} else if (field.selectionStart || field.selectionStart === "0") { // Firefox support
|
|
9
|
+
if (field.selectionStart || field.selectionStart === "0") { // Firefox support
|
|
23
10
|
caretPos = field.selectionDirection === "backward" ? field.selectionStart : field.selectionEnd;
|
|
24
11
|
}
|
|
25
12
|
|
|
@@ -163,7 +163,7 @@ const getRGBColor = color => {
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
if (color.startsWith("rgb")) {
|
|
166
|
-
return
|
|
166
|
+
return RGBStringToRGBObject(color);
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
// HEX
|
|
@@ -209,7 +209,7 @@ const RGBAToRGB = color => {
|
|
|
209
209
|
* Return an object with the properties for each of the main colors(red, green, blue)
|
|
210
210
|
* @param {String} color Receives a color in the following format: "rgb(0, 0, 0)
|
|
211
211
|
*/
|
|
212
|
-
const
|
|
212
|
+
const RGBStringToRGBObject = color => {
|
|
213
213
|
const openingBracketIndex = color.indexOf("("),
|
|
214
214
|
closingBraketIndex = color.indexOf(")"),
|
|
215
215
|
commasIndexes = [];
|
|
@@ -319,6 +319,32 @@ const HEXToRGB = hex => {
|
|
|
319
319
|
return rgbValues;
|
|
320
320
|
};
|
|
321
321
|
|
|
322
|
+
/**
|
|
323
|
+
* Returns the hex value of the color as string
|
|
324
|
+
* @param {Object} color Receives an object with the properties for each of the main colors(r, g, b)
|
|
325
|
+
*/
|
|
326
|
+
const RGBtoHEX = color => {
|
|
327
|
+
const hexMap = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E"];
|
|
328
|
+
let hexValue = "#";
|
|
329
|
+
|
|
330
|
+
let divisionNumber = color.r / 16;
|
|
331
|
+
let remainder = color.r % 16;
|
|
332
|
+
hexValue += String(hexMap[Math.floor(divisionNumber)]);
|
|
333
|
+
hexValue += String(hexMap[remainder]);
|
|
334
|
+
|
|
335
|
+
divisionNumber = color.g / 16;
|
|
336
|
+
remainder = color.g % 16;
|
|
337
|
+
hexValue += String(hexMap[Math.floor(divisionNumber)]);
|
|
338
|
+
hexValue += String(hexMap[remainder]);
|
|
339
|
+
|
|
340
|
+
divisionNumber = color.b / 16;
|
|
341
|
+
remainder = color.b % 16;
|
|
342
|
+
hexValue += String(hexMap[Math.floor(divisionNumber)]);
|
|
343
|
+
hexValue += String(hexMap[remainder]);
|
|
344
|
+
|
|
345
|
+
return hexValue;
|
|
346
|
+
};
|
|
347
|
+
|
|
322
348
|
const RGBToHSL = (color = {
|
|
323
349
|
r: undefined,
|
|
324
350
|
g: undefined,
|
|
@@ -367,4 +393,6 @@ export {
|
|
|
367
393
|
HSLToRGB,
|
|
368
394
|
HEXToRGB,
|
|
369
395
|
RGBToHSL,
|
|
396
|
+
RGBStringToRGBObject,
|
|
397
|
+
RGBtoHEX,
|
|
370
398
|
};
|