Skip to content

Commit 9a7ffe4

Browse files
authored
feat(ui5-static-area-item): StaticAreaItem can now be scoped (#3076)
1 parent b00b02b commit 9a7ffe4

File tree

7 files changed

+29
-13
lines changed

7 files changed

+29
-13
lines changed

packages/base/hash.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Z2/FFhMi1aIykMRZ/8bE3YIatok=
1+
THl/rR2+CTzuEgv48kxhYOHQdU4=

packages/base/src/StaticAreaItem.js

+18-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import "./StaticArea.js";
22
import updateShadowRoot from "./updateShadowRoot.js";
33
import { renderFinished } from "./Render.js";
44
import getEffectiveContentDensity from "./util/getEffectiveContentDensity.js";
5+
import { getEffectiveScopingSuffixForTag } from "./CustomElementsScope.js";
56

67
/**
78
*
@@ -72,10 +73,24 @@ class StaticAreaItem extends HTMLElement {
7273
getStableDomRef(refName) {
7374
return this.shadowRoot.querySelector(`[data-ui5-stable=${refName}]`);
7475
}
75-
}
7676

77-
if (!customElements.get("ui5-static-area-item")) {
78-
customElements.define("ui5-static-area-item", StaticAreaItem);
77+
static getTag() {
78+
const pureTag = "ui5-static-area-item";
79+
const suffix = getEffectiveScopingSuffixForTag(pureTag);
80+
if (!suffix) {
81+
return pureTag;
82+
}
83+
84+
return `${pureTag}-${suffix}`;
85+
}
86+
87+
static createInstance() {
88+
if (!customElements.get(StaticAreaItem.getTag())) {
89+
customElements.define(StaticAreaItem.getTag(), StaticAreaItem);
90+
}
91+
92+
return document.createElement(this.getTag());
93+
}
7994
}
8095

8196
export default StaticAreaItem;

packages/base/src/UI5Element.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { boot } from "./Boot.js";
33
import UI5ElementMetadata from "./UI5ElementMetadata.js";
44
import EventProvider from "./EventProvider.js";
55
import getSingletonElementInstance from "./util/getSingletonElementInstance.js";
6-
import "./StaticAreaItem.js";
6+
import StaticAreaItem from "./StaticAreaItem.js";
77
import updateShadowRoot from "./updateShadowRoot.js";
88
import { renderDeferred, renderImmediately, cancelRender } from "./Render.js";
99
import { registerTag, isTagRegistered, recordTagRegistrationFailure } from "./CustomElementsRegistry.js";
@@ -796,7 +796,7 @@ class UI5Element extends HTMLElement {
796796
}
797797

798798
if (!this.staticAreaItem) {
799-
this.staticAreaItem = document.createElement("ui5-static-area-item");
799+
this.staticAreaItem = StaticAreaItem.createInstance();
800800
this.staticAreaItem.setOwnerElement(this);
801801
}
802802
if (!this.staticAreaItem.parentElement) {

packages/fiori/src/Wizard.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ class Wizard extends UI5Element {
485485
const iCurrStep = this.getSelectedStepIndex();
486486
const iStepsToShow = this.steps.length ? Math.floor(iWidth / MIN_STEP_WIDTH_WITH_TITLE) : Math.floor(iWidth / MIN_STEP_WIDTH_NO_TITLE);
487487

488-
const tabs = this.shadowRoot.querySelectorAll("ui5-wizard-tab");
488+
const tabs = this.shadowRoot.querySelectorAll("[ui5-wizard-tab]");
489489

490490
if (!tabs.length) {
491491
return;
@@ -564,7 +564,7 @@ class Wizard extends UI5Element {
564564
}
565565

566566
async _showPopover(oDomTarget, bAtStart) {
567-
const tabs = Array.from(this.shadowRoot.querySelectorAll("ui5-wizard-tab"));
567+
const tabs = Array.from(this.shadowRoot.querySelectorAll("[ui5-wizard-tab]"));
568568
this._groupedTabs = [];
569569

570570
const iFromStep = bAtStart ? 0 : this.stepsInHeaderDOM.indexOf(oDomTarget);
@@ -589,7 +589,7 @@ class Wizard extends UI5Element {
589589
}
590590

591591
_onOverflowStepButtonClick(event) {
592-
const tabs = Array.from(this.shadowRoot.querySelectorAll("ui5-wizard-tab"));
592+
const tabs = Array.from(this.shadowRoot.querySelectorAll("[ui5-wizard-tab]"));
593593
const stepRefId = event.target.getAttribute("data-ui5-header-tab-ref-id");
594594
const stepToSelect = this.slottedSteps[stepRefId - 1];
595595
const selectedStep = this.selectedStep;

packages/fiori/src/themes/WizardTab.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
:host(:not([hidden])) {
2-
/* Well known worakround to allow shrinking inside flex containers
2+
/* Well known worakround to allow shrinking inside flex containers
33
* and shrinking is needed so the texts trucnate properly.
44
*/
55
min-width: 1px;
@@ -146,7 +146,7 @@
146146
}
147147

148148
/* Workaround for IE to make the focus outline visible */
149-
ui5-wizard-tab .ui5-wiz-step-main {
149+
[ui5-wizard-tab] .ui5-wiz-step-main {
150150
pointer-events: none;
151151
}
152152

packages/ie11/hash.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
xVuUgxGGvkAKIY1Yw5I2hbPgG24=
1+
W5PC928lrjsUvm6BzHaYc00TH0o=

packages/ie11/src/theming/createComponentStyleTag.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import createStyleInHead from "@ui5/webcomponents-base/dist/util/createStyleInHead.js";
22
import getEffectiveStyle from "@ui5/webcomponents-base/dist/theming/getEffectiveStyle.js";
33
import { attachCustomCSSChange } from "@ui5/webcomponents-base/dist/theming/CustomStyle.js";
4+
import StaticAreaItem from "@ui5/webcomponents-base/dist/StaticAreaItem.js";
45
import adaptCSSForIE from "./adaptCSSForIE.js";
56
import { schedulePonyfill } from "./CSSVarsPonyfill.js";
67

@@ -29,7 +30,7 @@ const createComponentStyleTag = component => {
2930
// Append static CSS, if any, for IE
3031
let staticCssContent = getEffectiveStyle(ElementClass, true);
3132
if (staticCssContent) {
32-
staticCssContent = adaptCSSForIE(staticCssContent, "ui5-static-area-item");
33+
staticCssContent = adaptCSSForIE(staticCssContent, StaticAreaItem.getTag());
3334
cssContent = `${cssContent} ${staticCssContent}`;
3435
}
3536

0 commit comments

Comments
 (0)