Skip to content

feat(ui5-static-area-item): StaticAreaItem can now be scoped #3076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/base/hash.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Z2/FFhMi1aIykMRZ/8bE3YIatok=
THl/rR2+CTzuEgv48kxhYOHQdU4=
21 changes: 18 additions & 3 deletions packages/base/src/StaticAreaItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import "./StaticArea.js";
import updateShadowRoot from "./updateShadowRoot.js";
import { renderFinished } from "./Render.js";
import getEffectiveContentDensity from "./util/getEffectiveContentDensity.js";
import { getEffectiveScopingSuffixForTag } from "./CustomElementsScope.js";

/**
*
Expand Down Expand Up @@ -72,10 +73,24 @@ class StaticAreaItem extends HTMLElement {
getStableDomRef(refName) {
return this.shadowRoot.querySelector(`[data-ui5-stable=${refName}]`);
}
}

if (!customElements.get("ui5-static-area-item")) {
customElements.define("ui5-static-area-item", StaticAreaItem);
static getTag() {
const pureTag = "ui5-static-area-item";
const suffix = getEffectiveScopingSuffixForTag(pureTag);
if (!suffix) {
return pureTag;
}

return `${pureTag}-${suffix}`;
}

static createInstance() {
if (!customElements.get(StaticAreaItem.getTag())) {
customElements.define(StaticAreaItem.getTag(), StaticAreaItem);
}

return document.createElement(this.getTag());
}
}

export default StaticAreaItem;
4 changes: 2 additions & 2 deletions packages/base/src/UI5Element.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { boot } from "./Boot.js";
import UI5ElementMetadata from "./UI5ElementMetadata.js";
import EventProvider from "./EventProvider.js";
import getSingletonElementInstance from "./util/getSingletonElementInstance.js";
import "./StaticAreaItem.js";
import StaticAreaItem from "./StaticAreaItem.js";
import updateShadowRoot from "./updateShadowRoot.js";
import { renderDeferred, renderImmediately, cancelRender } from "./Render.js";
import { registerTag, isTagRegistered, recordTagRegistrationFailure } from "./CustomElementsRegistry.js";
Expand Down Expand Up @@ -796,7 +796,7 @@ class UI5Element extends HTMLElement {
}

if (!this.staticAreaItem) {
this.staticAreaItem = document.createElement("ui5-static-area-item");
this.staticAreaItem = StaticAreaItem.createInstance();
this.staticAreaItem.setOwnerElement(this);
}
if (!this.staticAreaItem.parentElement) {
Expand Down
6 changes: 3 additions & 3 deletions packages/fiori/src/Wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ class Wizard extends UI5Element {
const iCurrStep = this.getSelectedStepIndex();
const iStepsToShow = this.steps.length ? Math.floor(iWidth / MIN_STEP_WIDTH_WITH_TITLE) : Math.floor(iWidth / MIN_STEP_WIDTH_NO_TITLE);

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

if (!tabs.length) {
return;
Expand Down Expand Up @@ -564,7 +564,7 @@ class Wizard extends UI5Element {
}

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

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

_onOverflowStepButtonClick(event) {
const tabs = Array.from(this.shadowRoot.querySelectorAll("ui5-wizard-tab"));
const tabs = Array.from(this.shadowRoot.querySelectorAll("[ui5-wizard-tab]"));
const stepRefId = event.target.getAttribute("data-ui5-header-tab-ref-id");
const stepToSelect = this.slottedSteps[stepRefId - 1];
const selectedStep = this.selectedStep;
Expand Down
4 changes: 2 additions & 2 deletions packages/fiori/src/themes/WizardTab.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:host(:not([hidden])) {
/* Well known worakround to allow shrinking inside flex containers
/* Well known worakround to allow shrinking inside flex containers
* and shrinking is needed so the texts trucnate properly.
*/
min-width: 1px;
Expand Down Expand Up @@ -146,7 +146,7 @@
}

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

Expand Down
2 changes: 1 addition & 1 deletion packages/ie11/hash.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
xVuUgxGGvkAKIY1Yw5I2hbPgG24=
W5PC928lrjsUvm6BzHaYc00TH0o=
3 changes: 2 additions & 1 deletion packages/ie11/src/theming/createComponentStyleTag.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import createStyleInHead from "@ui5/webcomponents-base/dist/util/createStyleInHead.js";
import getEffectiveStyle from "@ui5/webcomponents-base/dist/theming/getEffectiveStyle.js";
import { attachCustomCSSChange } from "@ui5/webcomponents-base/dist/theming/CustomStyle.js";
import StaticAreaItem from "@ui5/webcomponents-base/dist/StaticAreaItem.js";
import adaptCSSForIE from "./adaptCSSForIE.js";
import { schedulePonyfill } from "./CSSVarsPonyfill.js";

Expand Down Expand Up @@ -29,7 +30,7 @@ const createComponentStyleTag = component => {
// Append static CSS, if any, for IE
let staticCssContent = getEffectiveStyle(ElementClass, true);
if (staticCssContent) {
staticCssContent = adaptCSSForIE(staticCssContent, "ui5-static-area-item");
staticCssContent = adaptCSSForIE(staticCssContent, StaticAreaItem.getTag());
cssContent = `${cssContent} ${staticCssContent}`;
}

Expand Down