@salesforcedevs/docs-components 1.3.325-rnbtab-alpha2 → 1.3.325-rnbtab-alpha4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.3.325-rnbtab-alpha2",
3
+ "version": "1.3.325-rnbtab-alpha4",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -42,7 +42,6 @@ export default class ContentLayout extends LightningElement {
42
42
  @api language!: string;
43
43
  @api bailHref!: string;
44
44
  @api bailLabel!: string;
45
- @track initialIndex: number = 0;
46
45
 
47
46
  // This is needed for now to prevent failing snapshot tests due to links in the footer
48
47
  @api showFooter = false;
@@ -119,7 +118,9 @@ export default class ContentLayout extends LightningElement {
119
118
  updateRNB = () => {
120
119
  const headingElements = this.getHeadingElements();
121
120
  headingElements.forEach((headingElement: any) => {
121
+ // Sometimes elements hash and header is not being set when slot content is wrapped with div
122
122
  headingElement.hash = headingElement.attributes.hash?.nodeValue;
123
+ headingElement.header = headingElement.attributes.header?.nodeValue;
123
124
  });
124
125
  this.updateTocItems(headingElements);
125
126
  };
@@ -148,7 +149,8 @@ export default class ContentLayout extends LightningElement {
148
149
  if (tab?.getAttribute("aria-selected") === "true") {
149
150
  const tabID = tab?.getAttribute("aria-label");
150
151
  const url = new URL(window.location.href);
151
- if (url.searchParams.get("type") !== tabID) {
152
+ const selectedTabId = this.getSelectedTabId();
153
+ if (selectedTabId !== tabID) {
152
154
  url.searchParams.set("type", tabID);
153
155
  url.hash = "";
154
156
  window.history.pushState({}, "", url.toString());
@@ -212,10 +214,14 @@ export default class ContentLayout extends LightningElement {
212
214
  }
213
215
  }
214
216
 
215
- private restoreTabSelection() {
217
+ private getSelectedTabId() {
216
218
  const urlParams = new URLSearchParams(window.location.search);
217
219
  const selectedTabId = urlParams.get("type");
220
+ return selectedTabId;
221
+ }
218
222
 
223
+ private restoreTabSelection() {
224
+ const selectedTabId = this.getSelectedTabId();
219
225
  if (selectedTabId) {
220
226
  this.selectTabById(selectedTabId);
221
227
  }
@@ -444,16 +450,7 @@ export default class ContentLayout extends LightningElement {
444
450
  }
445
451
  };
446
452
 
447
- onSlotChange(e): void {
448
- const slot = e.target;
449
- const child = slot.assignedElements();
450
- const tabComponent = child.find(
451
- (element: any) =>
452
- element.tagName.toLowerCase() === "dx-tab-panel-list"
453
- );
454
- if (tabComponent) {
455
- tabComponent.initialIndex = this.initialIndex; // Set the index value on the child component
456
- }
453
+ onSlotChange(): void {
457
454
  this.updateRNB();
458
455
  }
459
456