@salesforcedevs/docs-components
Advanced tools
Comparing version
@@ -12,2 +12,3 @@ { | ||
"doc/contentCallout", | ||
"doc/doDont", | ||
"doc/contentLayout", | ||
@@ -14,0 +15,0 @@ "doc/contentMedia", |
{ | ||
"name": "@salesforcedevs/docs-components", | ||
"version": "1.3.325-rnbtab-alpha1", | ||
"version": "1.3.325-rnbtab-alpha2", | ||
"description": "Docs Lightning web components for DSC", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -137,3 +137,3 @@ /* eslint-disable @lwc/lwc/no-inner-html */ | ||
theme: this.codeBlockTheme, | ||
title: "", // Default no title. | ||
header: "", // Default no title. | ||
variant: this.codeBlockType, | ||
@@ -177,3 +177,3 @@ isEncoded: true | ||
Object.assign(calloutCompEl, { | ||
title: type, | ||
header: type, | ||
variant: typeLower | ||
@@ -180,0 +180,0 @@ }); |
@@ -107,3 +107,3 @@ /* eslint-disable @lwc/lwc/no-document-query */ | ||
get showTabBasedRNB() { | ||
const tabPanelListItem: any = this.selectTabElement(); | ||
const tabPanelListItem: any = this.getTabPanelItems(); | ||
return tabPanelListItem?.id === RNB_BY_TAB ? true : false; | ||
@@ -116,3 +116,3 @@ } | ||
private selectTabElement() { | ||
private getTabPanelItems() { | ||
return document.querySelector("dx-tab-panel-list"); | ||
@@ -132,3 +132,3 @@ } | ||
if (this.showTabBasedRNB) { | ||
const tabPanelListItem: any = this.selectTabElement(); | ||
const tabPanelListItem: any = this.getTabPanelItems(); | ||
const tabPanels = | ||
@@ -148,22 +148,15 @@ tabPanelListItem?.querySelectorAll("dx-tab-panel"); | ||
private updateURL() { | ||
const tabPanelListItem: any = this.selectTabElement(); | ||
if (tabPanelListItem?.shadowRoot) { | ||
const tabPanelItems = | ||
tabPanelListItem.shadowRoot.querySelectorAll( | ||
"dx-tab-panel-item" | ||
); | ||
if (tabPanelItems) { | ||
tabPanelItems.forEach((tabPanelItem: any) => { | ||
const tab = tabPanelItem.shadowRoot.querySelector("button"); | ||
if (tab?.getAttribute("aria-selected") === "true") { | ||
const tabID = tab?.getAttribute("aria-label"); | ||
const url = new URL(window.location.href); | ||
if (url.searchParams.get("type") !== tabID) { | ||
url.searchParams.set("type", tabID); | ||
url.hash = ""; | ||
window.history.pushState({}, "", url.toString()); | ||
} | ||
const tabs = this.getAllTabs(); | ||
if (tabs.length > 0) { | ||
tabs.forEach((tab: any) => { | ||
if (tab?.getAttribute("aria-selected") === "true") { | ||
const tabID = tab?.getAttribute("aria-label"); | ||
const url = new URL(window.location.href); | ||
if (url.searchParams.get("type") !== tabID) { | ||
url.searchParams.set("type", tabID); | ||
url.hash = ""; | ||
window.history.pushState({}, "", url.toString()); | ||
} | ||
}); | ||
} | ||
} | ||
}); | ||
} | ||
@@ -235,19 +228,25 @@ } | ||
private getAllTabs(): any[] { | ||
const tabPanelListItem: any = this.getTabPanelItems(); | ||
if (tabPanelListItem?.shadowRoot) { | ||
return Array.from( | ||
tabPanelListItem.shadowRoot.querySelectorAll( | ||
"dx-tab-panel-item" | ||
) | ||
).map((tabPanelItem: any) => | ||
tabPanelItem.shadowRoot.querySelector("button") | ||
); | ||
} | ||
return []; | ||
} | ||
private selectTabById(tabId: string) { | ||
requestAnimationFrame(() => { | ||
const tabPanelListItem: any = this.selectTabElement(); | ||
if (tabPanelListItem?.shadowRoot) { | ||
const tabPanelItems = | ||
tabPanelListItem.shadowRoot.querySelectorAll( | ||
"dx-tab-panel-item" | ||
); | ||
if (tabPanelItems) { | ||
tabPanelItems.forEach((tabPanelItem: any) => { | ||
const tab = | ||
tabPanelItem.shadowRoot.querySelector("button"); | ||
if (tab?.getAttribute("aria-label") === tabId) { | ||
tab?.click(); | ||
} | ||
}); | ||
} | ||
const tabs = this.getAllTabs(); | ||
if (tabs.length > 0) { | ||
tabs.forEach((tab: any) => { | ||
if (tab?.getAttribute("aria-label") === tabId) { | ||
tab?.click(); | ||
} | ||
}); | ||
} | ||
@@ -254,0 +253,0 @@ }); |
260421
0.76%78
4%6685
0.8%