@ui5/webcomponents-base 0.0.0-0a35d6b3d → 0.0.0-0dd36ca4b
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 +653 -0
- package/README.md +0 -8
- package/config/wdio.conf.cjs +0 -8
- package/dist/.tsbuildinfo +1 -1
- package/dist/Boot.d.ts +3 -2
- package/dist/Boot.js +7 -5
- package/dist/Boot.js.map +1 -1
- package/dist/Device.d.ts +1 -2
- package/dist/Device.js +5 -12
- package/dist/Device.js.map +1 -1
- package/dist/IgnoreCustomElements.d.ts +3 -5
- package/dist/IgnoreCustomElements.js +3 -5
- package/dist/IgnoreCustomElements.js.map +1 -1
- package/dist/InitialConfiguration.d.ts +1 -2
- package/dist/InitialConfiguration.js +1 -5
- package/dist/InitialConfiguration.js.map +1 -1
- package/dist/Keys.d.ts +3 -1
- package/dist/Keys.js +5 -1
- package/dist/Keys.js.map +1 -1
- package/dist/ManagedStyles.js +24 -98
- package/dist/ManagedStyles.js.map +1 -1
- package/dist/MediaRange.d.ts +6 -6
- package/dist/MediaRange.js +16 -16
- package/dist/MediaRange.js.map +1 -1
- package/dist/UI5Element.d.ts +20 -28
- package/dist/UI5Element.js +89 -67
- package/dist/UI5Element.js.map +1 -1
- package/dist/UI5ElementMetadata.d.ts +9 -2
- package/dist/UI5ElementMetadata.js +23 -4
- package/dist/UI5ElementMetadata.js.map +1 -1
- package/dist/asset-registries/Icons.js +1 -1
- package/dist/asset-registries/Icons.js.map +1 -1
- package/dist/asset-registries/Illustrations.d.ts +1 -0
- package/dist/asset-registries/Illustrations.js +12 -19
- package/dist/asset-registries/Illustrations.js.map +1 -1
- package/dist/asset-registries/LocaleData.js +1 -1
- package/dist/asset-registries/LocaleData.js.map +1 -1
- package/dist/asset-registries/i18n.d.ts +2 -2
- package/dist/asset-registries/i18n.js +2 -2
- package/dist/asset-registries/i18n.js.map +1 -1
- package/dist/asset-registries/util/IconCollectionsByTheme.d.ts +1 -1
- package/dist/asset-registries/util/IconCollectionsByTheme.js +1 -1
- package/dist/asset-registries/util/IconCollectionsByTheme.js.map +1 -1
- package/dist/asset-registries/util/getIconCollectionByTheme.d.ts +3 -3
- package/dist/asset-registries/util/getIconCollectionByTheme.js +3 -3
- package/dist/asset-registries/util/getIconCollectionByTheme.js.map +1 -1
- package/dist/config/Icons.d.ts +7 -7
- package/dist/config/Icons.js +7 -7
- package/dist/config/Icons.js.map +1 -1
- package/dist/config/Language.d.ts +1 -1
- package/dist/config/Language.js +6 -3
- package/dist/config/Language.js.map +1 -1
- package/dist/config/Theme.d.ts +4 -3
- package/dist/config/Theme.js +13 -6
- package/dist/config/Theme.js.map +1 -1
- package/dist/config/ThemeRoot.d.ts +2 -4
- package/dist/config/ThemeRoot.js +2 -4
- package/dist/config/ThemeRoot.js.map +1 -1
- package/dist/config/Timezone.d.ts +1 -1
- package/dist/config/Timezone.js +1 -1
- package/dist/config/Timezone.js.map +1 -1
- package/dist/css/SystemCSSVars.css +0 -8
- package/dist/custom-elements-internal.json +2952 -0
- package/dist/custom-elements.json +322 -2891
- package/dist/decorators/customElement.d.ts +2 -2
- package/dist/decorators/customElement.js +9 -4
- package/dist/decorators/customElement.js.map +1 -1
- package/dist/decorators/event.d.ts +5 -2
- package/dist/decorators/event.js.map +1 -1
- package/dist/decorators.d.ts +5 -0
- package/dist/decorators.js +6 -0
- package/dist/decorators.js.map +1 -0
- package/dist/delegate/ItemNavigation.d.ts +8 -8
- package/dist/delegate/ItemNavigation.js +9 -9
- package/dist/delegate/ItemNavigation.js.map +1 -1
- package/dist/features/InputElementsFormSupport.d.ts +18 -0
- package/dist/features/InputElementsFormSupport.js +40 -0
- package/dist/features/InputElementsFormSupport.js.map +1 -0
- package/dist/features/OpenUI5Support.d.ts +0 -2
- package/dist/features/OpenUI5Support.js +6 -21
- package/dist/features/OpenUI5Support.js.map +1 -1
- package/dist/features/patchPatcher.d.ts +11 -0
- package/dist/features/patchPatcher.js +11 -0
- package/dist/features/patchPatcher.js.map +1 -0
- package/dist/features/patchPopup.d.ts +14 -0
- package/dist/features/patchPopup.js +50 -0
- package/dist/features/patchPopup.js.map +1 -0
- package/dist/generated/AssetParameters.js +1 -1
- package/dist/generated/AssetParameters.js.map +1 -1
- package/dist/generated/VersionInfo.js +5 -5
- package/dist/generated/VersionInfo.js.map +1 -1
- package/dist/generated/css/SystemCSSVars.css.js +1 -1
- package/dist/generated/css/SystemCSSVars.css.js.map +1 -1
- package/dist/locale/applyDirection.d.ts +3 -2
- package/dist/locale/applyDirection.js +3 -2
- package/dist/locale/applyDirection.js.map +1 -1
- package/dist/locale/getEffectiveDir.d.ts +1 -1
- package/dist/locale/getEffectiveDir.js +3 -19
- package/dist/locale/getEffectiveDir.js.map +1 -1
- package/dist/renderer/LitRenderer.js +2 -8
- package/dist/renderer/LitRenderer.js.map +1 -1
- package/dist/renderer/directives/style-map.d.ts +13 -0
- package/dist/renderer/directives/style-map.js +59 -59
- package/dist/renderer/directives/style-map.js.map +1 -0
- package/dist/sap/base/Log.js +698 -188
- package/dist/sap/base/assert.js +28 -1
- package/dist/sap/base/config/MemoryConfigurationProvider.js +20 -0
- package/dist/sap/base/security/URLListValidator.js +253 -6
- package/dist/sap/base/security/encodeCSS.js +34 -8
- package/dist/sap/base/security/encodeXML.js +47 -17
- package/dist/sap/base/security/sanitizeHTML.js +35 -13
- package/dist/sap/base/strings/toHex.js +27 -2
- package/dist/sap/base/util/now.js +24 -3
- package/dist/sap/base/util/uid.js +27 -0
- package/dist/sap/ui/thirdparty/caja-html-sanitizer.js +1 -1
- package/dist/ssr-dom-shim.d.ts +1 -0
- package/dist/ssr-dom-shim.js +12 -0
- package/dist/ssr-dom-shim.js.map +1 -0
- package/dist/ssr-dom.d.ts +0 -0
- package/dist/ssr-dom.js +0 -0
- package/dist/theming/getConstructableStyle.d.ts +1 -1
- package/dist/theming/getConstructableStyle.js +3 -3
- package/dist/theming/getConstructableStyle.js.map +1 -1
- package/dist/theming/getEffectiveStyle.d.ts +1 -1
- package/dist/theming/getEffectiveStyle.js +5 -12
- package/dist/theming/getEffectiveStyle.js.map +1 -1
- package/dist/types/AriaHasPopup.d.ts +32 -0
- package/dist/types/AriaHasPopup.js +34 -0
- package/dist/types/AriaHasPopup.js.map +1 -0
- package/dist/types/AriaLandmarkRole.d.ts +79 -0
- package/dist/types/AriaLandmarkRole.js +81 -0
- package/dist/types/AriaLandmarkRole.js.map +1 -0
- package/dist/types/AriaRole.d.ts +27 -0
- package/dist/types/AriaRole.js +29 -0
- package/dist/types/AriaRole.js.map +1 -0
- package/dist/types/DOMReference.d.ts +1 -1
- package/dist/types/DOMReference.js +1 -1
- package/dist/types/DOMReference.js.map +1 -1
- package/dist/types/MovePlacement.d.ts +20 -0
- package/dist/types/MovePlacement.js +22 -0
- package/dist/types/MovePlacement.js.map +1 -0
- package/dist/types/Orientation.d.ts +16 -0
- package/dist/types/Orientation.js +18 -0
- package/dist/types/Orientation.js.map +1 -0
- package/dist/types/ValueState.d.ts +3 -3
- package/dist/types/ValueState.js +3 -3
- package/dist/types/ValueState.js.map +1 -1
- package/dist/types.d.ts +24 -1
- package/dist/types.js.map +1 -1
- package/dist/updateShadowRoot.d.ts +1 -2
- package/dist/updateShadowRoot.js +5 -29
- package/dist/updateShadowRoot.js.map +1 -1
- package/dist/util/PopupUtils.d.ts +1 -3
- package/dist/util/PopupUtils.js +1 -15
- package/dist/util/PopupUtils.js.map +1 -1
- package/dist/util/clamp.js +2 -1
- package/dist/util/clamp.js.map +1 -1
- package/dist/util/createLinkInHead.d.ts +1 -1
- package/dist/util/createLinkInHead.js +1 -1
- package/dist/util/createLinkInHead.js.map +1 -1
- package/dist/util/detectNavigatorLanguage.d.ts +2 -2
- package/dist/util/detectNavigatorLanguage.js +6 -1
- package/dist/util/detectNavigatorLanguage.js.map +1 -1
- package/dist/util/dragAndDrop/DragRegistry.d.ts +12 -0
- package/dist/util/dragAndDrop/DragRegistry.js +68 -0
- package/dist/util/dragAndDrop/DragRegistry.js.map +1 -0
- package/dist/util/dragAndDrop/findClosestPosition.d.ts +7 -0
- package/dist/util/dragAndDrop/findClosestPosition.js +59 -0
- package/dist/util/dragAndDrop/findClosestPosition.js.map +1 -0
- package/dist/util/dragAndDrop/longDragOverHandler.d.ts +2 -0
- package/dist/util/dragAndDrop/longDragOverHandler.js +25 -0
- package/dist/util/dragAndDrop/longDragOverHandler.js.map +1 -0
- package/dist/util/getClassCopy.d.ts +13 -9
- package/dist/util/getDesigntimePropertyAsArray.d.ts +2 -2
- package/dist/util/getDesigntimePropertyAsArray.js +2 -1
- package/dist/util/getDesigntimePropertyAsArray.js.map +1 -1
- package/dist/vscode.html-custom-data.json +22 -0
- package/index.js +1 -17
- package/package-scripts.cjs +12 -10
- package/package.json +13 -7
- package/src/css/SystemCSSVars.css +0 -8
- package/tsconfig.json +3 -0
- package/.eslintignore +0 -16
- package/.eslintrc.cjs +0 -3
- package/bundle.esm.js +0 -67
- package/dist/CSP.d.ts +0 -30
- package/dist/CSP.js +0 -51
- package/dist/CSP.js.map +0 -1
- package/dist/StaticAreaItem.d.ts +0 -35
- package/dist/StaticAreaItem.js +0 -100
- package/dist/StaticAreaItem.js.map +0 -1
- package/dist/config/RTL.d.ts +0 -7
- package/dist/config/RTL.js +0 -37
- package/dist/config/RTL.js.map +0 -1
- package/dist/theming/getEffectiveLinksHrefs.d.ts +0 -3
- package/dist/theming/getEffectiveLinksHrefs.js +0 -17
- package/dist/theming/getEffectiveLinksHrefs.js.map +0 -1
- package/dist/theming/preloadLinks.d.ts +0 -3
- package/dist/theming/preloadLinks.js +0 -19
- package/dist/theming/preloadLinks.js.map +0 -1
- package/dist/util/createStyleInHead.d.ts +0 -8
- package/dist/util/createStyleInHead.js +0 -18
- package/dist/util/createStyleInHead.js.map +0 -1
- package/lib/generate-asset-parameters/index.js +0 -27
- package/lib/generate-styles/index.js +0 -31
- package/lib/generate-version-info/index.js +0 -32
- package/src/renderer/directives/style-map.js +0 -72
- package/used-modules.txt +0 -10
package/dist/UI5Element.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
|
+
import "@ui5/webcomponents-base/dist/ssr-dom.js";
|
|
1
3
|
import merge from "./thirdparty/merge.js";
|
|
2
4
|
import { boot } from "./Boot.js";
|
|
3
5
|
import UI5ElementMetadata from "./UI5ElementMetadata.js";
|
|
4
6
|
import EventProvider from "./EventProvider.js";
|
|
5
|
-
import getSingletonElementInstance from "./util/getSingletonElementInstance.js";
|
|
6
|
-
import StaticAreaItem from "./StaticAreaItem.js";
|
|
7
7
|
import updateShadowRoot from "./updateShadowRoot.js";
|
|
8
8
|
import { shouldIgnoreCustomElement } from "./IgnoreCustomElements.js";
|
|
9
|
-
import { renderDeferred, renderImmediately, cancelRender } from "./Render.js";
|
|
9
|
+
import { renderDeferred, renderImmediately, cancelRender, } from "./Render.js";
|
|
10
10
|
import { registerTag, isTagRegistered, recordTagRegistrationFailure } from "./CustomElementsRegistry.js";
|
|
11
11
|
import { observeDOMNode, unobserveDOMNode } from "./DOMObserver.js";
|
|
12
12
|
import { skipOriginalEvent } from "./config/NoConflict.js";
|
|
@@ -16,8 +16,8 @@ import isValidPropertyName from "./util/isValidPropertyName.js";
|
|
|
16
16
|
import { getSlotName, getSlottedNodesList } from "./util/SlotsHelper.js";
|
|
17
17
|
import arraysAreEqual from "./util/arraysAreEqual.js";
|
|
18
18
|
import { markAsRtlAware } from "./locale/RTLAwareRegistry.js";
|
|
19
|
-
import preloadLinks from "./theming/preloadLinks.js";
|
|
20
19
|
import executeTemplate from "./renderer/executeTemplate.js";
|
|
20
|
+
import { attachFormElementInternals, setFormValue } from "./features/InputElementsFormSupport.js";
|
|
21
21
|
let autoId = 0;
|
|
22
22
|
const elementTimeouts = new Map();
|
|
23
23
|
const uniqueDependenciesCache = new Map();
|
|
@@ -38,6 +38,22 @@ function _invalidate(changeInfo) {
|
|
|
38
38
|
renderDeferred(this);
|
|
39
39
|
this._invalidationEventProvider.fireEvent("invalidate", { ...changeInfo, target: this });
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* looks up a property descsriptor including in the prototype chain
|
|
43
|
+
* @param proto the starting prototype
|
|
44
|
+
* @param name the property to look for
|
|
45
|
+
* @returns the property descriptor if found directly or in the prototype chaing, undefined if not found
|
|
46
|
+
*/
|
|
47
|
+
function getPropertyDescriptor(proto, name) {
|
|
48
|
+
do {
|
|
49
|
+
const descriptor = Object.getOwnPropertyDescriptor(proto, name);
|
|
50
|
+
if (descriptor) {
|
|
51
|
+
return descriptor;
|
|
52
|
+
}
|
|
53
|
+
// go up the prototype chain
|
|
54
|
+
proto = Object.getPrototypeOf(proto);
|
|
55
|
+
} while (proto && proto !== HTMLElement.prototype);
|
|
56
|
+
}
|
|
41
57
|
/**
|
|
42
58
|
* @class
|
|
43
59
|
* Base class for all UI5 Web Components
|
|
@@ -66,7 +82,8 @@ class UI5Element extends HTMLElement {
|
|
|
66
82
|
this._state = { ...ctor.getMetadata().getInitialState() };
|
|
67
83
|
this._upgradeAllProperties();
|
|
68
84
|
if (ctor._needsShadowDOM()) {
|
|
69
|
-
|
|
85
|
+
const defaultOptions = { mode: "open" };
|
|
86
|
+
this.attachShadow({ ...defaultOptions, ...ctor.getMetadata().getShadowRootOptions() });
|
|
70
87
|
}
|
|
71
88
|
}
|
|
72
89
|
/**
|
|
@@ -85,10 +102,6 @@ class UI5Element extends HTMLElement {
|
|
|
85
102
|
const template = this.constructor.template;
|
|
86
103
|
return executeTemplate(template, this);
|
|
87
104
|
}
|
|
88
|
-
renderStatic() {
|
|
89
|
-
const template = this.constructor.staticAreaTemplate;
|
|
90
|
-
return executeTemplate(template, this);
|
|
91
|
-
}
|
|
92
105
|
/**
|
|
93
106
|
* Do not call this method from derivatives of UI5Element, use "onEnterDOM" only
|
|
94
107
|
* @private
|
|
@@ -129,9 +142,7 @@ class UI5Element extends HTMLElement {
|
|
|
129
142
|
this.onExitDOM();
|
|
130
143
|
this._fullyConnected = false;
|
|
131
144
|
}
|
|
132
|
-
|
|
133
|
-
this.staticAreaItem.parentElement.removeChild(this.staticAreaItem);
|
|
134
|
-
}
|
|
145
|
+
this._domRefReadyPromise._deferredResolve();
|
|
135
146
|
cancelRender(this);
|
|
136
147
|
}
|
|
137
148
|
/**
|
|
@@ -231,9 +242,9 @@ class UI5Element extends HTMLElement {
|
|
|
231
242
|
const localName = child.localName;
|
|
232
243
|
const shouldWaitForCustomElement = localName.includes("-") && !shouldIgnoreCustomElement(localName);
|
|
233
244
|
if (shouldWaitForCustomElement) {
|
|
234
|
-
const isDefined =
|
|
245
|
+
const isDefined = customElements.get(localName);
|
|
235
246
|
if (!isDefined) {
|
|
236
|
-
const whenDefinedPromise =
|
|
247
|
+
const whenDefinedPromise = customElements.whenDefined(localName); // Class registered, but instances not upgraded yet
|
|
237
248
|
let timeoutPromise = elementTimeouts.get(localName);
|
|
238
249
|
if (!timeoutPromise) {
|
|
239
250
|
timeoutPromise = new Promise(resolve => setTimeout(resolve, 1000));
|
|
@@ -241,7 +252,7 @@ class UI5Element extends HTMLElement {
|
|
|
241
252
|
}
|
|
242
253
|
await Promise.race([whenDefinedPromise, timeoutPromise]);
|
|
243
254
|
}
|
|
244
|
-
|
|
255
|
+
customElements.upgrade(child);
|
|
245
256
|
}
|
|
246
257
|
}
|
|
247
258
|
child = ctor.getMetadata().constructor.validateSlotValue(child, slotData);
|
|
@@ -281,6 +292,9 @@ class UI5Element extends HTMLElement {
|
|
|
281
292
|
reason: "children",
|
|
282
293
|
});
|
|
283
294
|
invalidated = true;
|
|
295
|
+
if (ctor.getMetadata().isFormAssociated()) {
|
|
296
|
+
setFormValue(this);
|
|
297
|
+
}
|
|
284
298
|
}
|
|
285
299
|
}
|
|
286
300
|
// If none of the slots had an invalidation due to changes to immediate children,
|
|
@@ -382,6 +396,16 @@ class UI5Element extends HTMLElement {
|
|
|
382
396
|
this[nameInCamelCase] = newPropertyValue;
|
|
383
397
|
}
|
|
384
398
|
}
|
|
399
|
+
formAssociatedCallback() {
|
|
400
|
+
const ctor = this.constructor;
|
|
401
|
+
if (!ctor.getMetadata().isFormAssociated()) {
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
attachFormElementInternals(this);
|
|
405
|
+
}
|
|
406
|
+
static get formAssociated() {
|
|
407
|
+
return this.getMetadata().isFormAssociated();
|
|
408
|
+
}
|
|
385
409
|
/**
|
|
386
410
|
* @private
|
|
387
411
|
*/
|
|
@@ -508,9 +532,9 @@ class UI5Element extends HTMLElement {
|
|
|
508
532
|
* 1) children: immediate children (HTML elements or text nodes) were added, removed or reordered in the slot
|
|
509
533
|
* 2) textcontent: text nodes in the slot changed value (or nested text nodes were added or changed value). Can only trigger for slots of "type: Node"
|
|
510
534
|
* 3) slotchange: a slot element, slotted inside that slot had its "slotchange" event listener called. This practically means that transitively slotted children changed.
|
|
511
|
-
*
|
|
535
|
+
* Can only trigger if the child of a slot is a slot element itself.
|
|
512
536
|
* 4) childchange: indicates that a UI5Element child in that slot was invalidated and in turn invalidated the component.
|
|
513
|
-
*
|
|
537
|
+
* Can only trigger for slots with "invalidateOnChildChange" metadata descriptor
|
|
514
538
|
*
|
|
515
539
|
* - newValue: the new value of the property (for type="property" only)
|
|
516
540
|
*
|
|
@@ -561,9 +585,6 @@ class UI5Element extends HTMLElement {
|
|
|
561
585
|
if (ctor._needsShadowDOM()) {
|
|
562
586
|
updateShadowRoot(this);
|
|
563
587
|
}
|
|
564
|
-
if (this.staticAreaItem) {
|
|
565
|
-
this.staticAreaItem.update();
|
|
566
|
-
}
|
|
567
588
|
// Safari requires that children get the slot attribute only after the slot tags have been rendered in the shadow DOM
|
|
568
589
|
if (hasIndividualSlots) {
|
|
569
590
|
this._assignIndividualSlotsToChildren();
|
|
@@ -603,11 +624,7 @@ class UI5Element extends HTMLElement {
|
|
|
603
624
|
if (!this.shadowRoot || this.shadowRoot.children.length === 0) {
|
|
604
625
|
return;
|
|
605
626
|
}
|
|
606
|
-
|
|
607
|
-
if (children.length !== 1) {
|
|
608
|
-
console.warn(`The shadow DOM for ${this.constructor.getMetadata().getTag()} does not have a top level element, the getDomRef() method might not work as expected`); // eslint-disable-line
|
|
609
|
-
}
|
|
610
|
-
return children[0];
|
|
627
|
+
return this.shadowRoot.children[0];
|
|
611
628
|
}
|
|
612
629
|
/**
|
|
613
630
|
* Returns the DOM Element marked with "data-sap-focus-ref" inside the template.
|
|
@@ -730,6 +747,13 @@ class UI5Element extends HTMLElement {
|
|
|
730
747
|
get classes() {
|
|
731
748
|
return {};
|
|
732
749
|
}
|
|
750
|
+
/**
|
|
751
|
+
* Returns the component accessibility info.
|
|
752
|
+
* @private
|
|
753
|
+
*/
|
|
754
|
+
get accessibilityInfo() {
|
|
755
|
+
return {};
|
|
756
|
+
}
|
|
733
757
|
/**
|
|
734
758
|
* Do not override this method in derivatives of UI5Element, use metadata properties instead
|
|
735
759
|
* @private
|
|
@@ -743,28 +767,6 @@ class UI5Element extends HTMLElement {
|
|
|
743
767
|
static _needsShadowDOM() {
|
|
744
768
|
return !!this.template || Object.prototype.hasOwnProperty.call(this.prototype, "render");
|
|
745
769
|
}
|
|
746
|
-
/**
|
|
747
|
-
* @private
|
|
748
|
-
*/
|
|
749
|
-
static _needsStaticArea() {
|
|
750
|
-
return !!this.staticAreaTemplate || Object.prototype.hasOwnProperty.call(this.prototype, "renderStatic");
|
|
751
|
-
}
|
|
752
|
-
/**
|
|
753
|
-
* @public
|
|
754
|
-
*/
|
|
755
|
-
getStaticAreaItemDomRef() {
|
|
756
|
-
if (!this.constructor._needsStaticArea()) {
|
|
757
|
-
throw new Error("This component does not use the static area");
|
|
758
|
-
}
|
|
759
|
-
if (!this.staticAreaItem) {
|
|
760
|
-
this.staticAreaItem = StaticAreaItem.createInstance();
|
|
761
|
-
this.staticAreaItem.setOwnerElement(this);
|
|
762
|
-
}
|
|
763
|
-
if (!this.staticAreaItem.parentElement) {
|
|
764
|
-
getSingletonElementInstance("ui5-static-area").appendChild(this.staticAreaItem);
|
|
765
|
-
}
|
|
766
|
-
return this.staticAreaItem.getDomRef();
|
|
767
|
-
}
|
|
768
770
|
/**
|
|
769
771
|
* @private
|
|
770
772
|
*/
|
|
@@ -789,8 +791,25 @@ class UI5Element extends HTMLElement {
|
|
|
789
791
|
if (propData.multiple && propData.defaultValue) {
|
|
790
792
|
throw new Error(`Cannot set a default value for property "${prop}". All multiple properties are empty arrays by default.`);
|
|
791
793
|
}
|
|
794
|
+
const descriptor = getPropertyDescriptor(proto, prop);
|
|
795
|
+
// if the decorator is on a setter, proxy the new setter to it
|
|
796
|
+
let origSet;
|
|
797
|
+
if (descriptor?.set) {
|
|
798
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
799
|
+
origSet = descriptor.set;
|
|
800
|
+
}
|
|
801
|
+
// if the decorator is on a setter, there will be a corresponding getter - proxy the new getter to it
|
|
802
|
+
let origGet;
|
|
803
|
+
if (descriptor?.get) {
|
|
804
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
805
|
+
origGet = descriptor.get;
|
|
806
|
+
}
|
|
792
807
|
Object.defineProperty(proto, prop, {
|
|
793
808
|
get() {
|
|
809
|
+
// proxy the getter to the original accessor if there was one
|
|
810
|
+
if (origGet) {
|
|
811
|
+
return origGet.call(this);
|
|
812
|
+
}
|
|
794
813
|
if (this._state[prop] !== undefined) {
|
|
795
814
|
return this._state[prop];
|
|
796
815
|
}
|
|
@@ -815,7 +834,7 @@ class UI5Element extends HTMLElement {
|
|
|
815
834
|
value = metadataCtor.validatePropertyValue(value, propData);
|
|
816
835
|
const propertyType = propData.type;
|
|
817
836
|
let propertyValidator = propData.validator;
|
|
818
|
-
const oldState = this._state[prop];
|
|
837
|
+
const oldState = origGet ? origGet.call(this) : this._state[prop];
|
|
819
838
|
if (propertyType && propertyType.isDataTypeClass) {
|
|
820
839
|
propertyValidator = propertyType;
|
|
821
840
|
}
|
|
@@ -829,13 +848,22 @@ class UI5Element extends HTMLElement {
|
|
|
829
848
|
isDifferent = oldState !== value;
|
|
830
849
|
}
|
|
831
850
|
if (isDifferent) {
|
|
832
|
-
|
|
851
|
+
// if the decorator is on a setter, use it for storage
|
|
852
|
+
if (origSet) {
|
|
853
|
+
origSet.call(this, value);
|
|
854
|
+
}
|
|
855
|
+
else {
|
|
856
|
+
this._state[prop] = value;
|
|
857
|
+
}
|
|
833
858
|
_invalidate.call(this, {
|
|
834
859
|
type: "property",
|
|
835
860
|
name: prop,
|
|
836
861
|
newValue: value,
|
|
837
862
|
oldValue: oldState,
|
|
838
863
|
});
|
|
864
|
+
if (ctor.getMetadata().isFormAssociated()) {
|
|
865
|
+
setFormValue(this);
|
|
866
|
+
}
|
|
839
867
|
this._updateAttribute(prop, value);
|
|
840
868
|
}
|
|
841
869
|
},
|
|
@@ -863,20 +891,6 @@ class UI5Element extends HTMLElement {
|
|
|
863
891
|
}
|
|
864
892
|
}
|
|
865
893
|
}
|
|
866
|
-
/**
|
|
867
|
-
* Returns the CSS for this UI5 Web Component Class
|
|
868
|
-
* @protected
|
|
869
|
-
*/
|
|
870
|
-
static get styles() {
|
|
871
|
-
return "";
|
|
872
|
-
}
|
|
873
|
-
/**
|
|
874
|
-
* Returns the Static Area CSS for this UI5 Web Component Class
|
|
875
|
-
* @protected
|
|
876
|
-
*/
|
|
877
|
-
static get staticAreaStyles() {
|
|
878
|
-
return "";
|
|
879
|
-
}
|
|
880
894
|
/**
|
|
881
895
|
* Returns an array with the dependencies for this UI5 Web Component, which could be:
|
|
882
896
|
* - composed components (used in its shadow root or static area item)
|
|
@@ -925,15 +939,14 @@ class UI5Element extends HTMLElement {
|
|
|
925
939
|
]);
|
|
926
940
|
const tag = this.getMetadata().getTag();
|
|
927
941
|
const definedLocally = isTagRegistered(tag);
|
|
928
|
-
const definedGlobally =
|
|
942
|
+
const definedGlobally = customElements.get(tag);
|
|
929
943
|
if (definedGlobally && !definedLocally) {
|
|
930
944
|
recordTagRegistrationFailure(tag);
|
|
931
945
|
}
|
|
932
946
|
else if (!definedGlobally) {
|
|
933
947
|
this._generateAccessors();
|
|
934
948
|
registerTag(tag);
|
|
935
|
-
|
|
936
|
-
preloadLinks(this);
|
|
949
|
+
customElements.define(tag, this);
|
|
937
950
|
}
|
|
938
951
|
return this;
|
|
939
952
|
}
|
|
@@ -956,12 +969,21 @@ class UI5Element extends HTMLElement {
|
|
|
956
969
|
this._metadata = new UI5ElementMetadata(mergedMetadata);
|
|
957
970
|
return this._metadata;
|
|
958
971
|
}
|
|
972
|
+
get validity() { return this._internals?.validity; }
|
|
973
|
+
get validationMessage() { return this._internals?.validationMessage; }
|
|
974
|
+
checkValidity() { return this._internals?.checkValidity(); }
|
|
975
|
+
reportValidity() { return this._internals?.reportValidity(); }
|
|
959
976
|
}
|
|
960
977
|
/**
|
|
961
978
|
* Returns the metadata object for this UI5 Web Component Class
|
|
962
979
|
* @protected
|
|
963
980
|
*/
|
|
964
981
|
UI5Element.metadata = {};
|
|
982
|
+
/**
|
|
983
|
+
* Returns the CSS for this UI5 Web Component Class
|
|
984
|
+
* @protected
|
|
985
|
+
*/
|
|
986
|
+
UI5Element.styles = "";
|
|
965
987
|
/**
|
|
966
988
|
* Always use duck-typing to cover all runtimes on the page.
|
|
967
989
|
*/
|
|
@@ -969,5 +991,5 @@ const instanceOfUI5Element = (object) => {
|
|
|
969
991
|
return "isUI5Element" in object;
|
|
970
992
|
};
|
|
971
993
|
export default UI5Element;
|
|
972
|
-
export { instanceOfUI5Element };
|
|
994
|
+
export { instanceOfUI5Element, };
|
|
973
995
|
//# sourceMappingURL=UI5Element.js.map
|