@salesforcedevs/docs-components 0.56.2-comp-flex-ref-2 → 0.56.2-seo-test1

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": "0.56.2-comp-flex-ref-2",
3
+ "version": "0.56.2-seo-test1",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -37,6 +37,7 @@ export default class AmfReference extends LightningElement {
37
37
  @api tocOptions?: string;
38
38
  @track navigation = [];
39
39
  @track versions: Array<ReferenceVersion> = [];
40
+ @api expandChildren?: string = null;
40
41
 
41
42
  // Update this to update what component gets rendered in the content block
42
43
  @track
@@ -371,13 +372,18 @@ export default class AmfReference extends LightningElement {
371
372
  }
372
373
  isChildrenLoading = true;
373
374
  } else {
375
+ if (this.isExpandChildrenEnabled(amfConfig.id)) {
376
+ this.expandChildTopics(amfConfig.topic);
377
+ }
374
378
  navItemChildren = amfConfig.topic.children;
375
379
  }
376
380
  // store nav items for each spec in order
377
381
  navAmfOrder[index] = {
378
382
  label: amfConfig.title,
379
383
  name: amfConfig.href,
380
- isExpanded: amfConfig.isSelected,
384
+ isExpanded:
385
+ amfConfig.isSelected ||
386
+ this.isExpandChildrenEnabled(amfConfig.id),
381
387
  children: navItemChildren,
382
388
  isChildrenLoading
383
389
  };
@@ -386,6 +392,20 @@ export default class AmfReference extends LightningElement {
386
392
  this.navigation = navAmfOrder;
387
393
  }
388
394
 
395
+ /**
396
+ * Expands each topic recursively.
397
+ */
398
+ private expandChildTopics(topic: any): void {
399
+ console.log("empty", topic);
400
+ }
401
+
402
+ /**
403
+ * Returns a boolean indicating whether the children should be expanded or not.
404
+ */
405
+ private isExpandChildrenEnabled(referenceId: string): boolean {
406
+ return this.expandChildren && this._currentReferenceId === referenceId;
407
+ }
408
+
389
409
  /**
390
410
  * Stores fetched AMF JSON value.
391
411
  * Creates and stores a new AmfModelParser instance for the AMF spec.
@@ -477,6 +497,7 @@ export default class AmfReference extends LightningElement {
477
497
  const model = this.amfMap[referenceId].parser.parsedModel;
478
498
 
479
499
  const children = [];
500
+ const expandChildren = this.isExpandChildrenEnabled(referenceId);
480
501
 
481
502
  NAVIGATION_ITEMS.forEach(
482
503
  ({ label, name, childrenPropertyName, type }) => {
@@ -519,7 +540,7 @@ export default class AmfReference extends LightningElement {
519
540
  parentReferencePath,
520
541
  this.metadata[amfTopicId]?.meta
521
542
  ),
522
- isExpanded: false,
543
+ isExpanded: expandChildren,
523
544
  children: childTopics
524
545
  });
525
546
  }
@@ -554,7 +575,7 @@ export default class AmfReference extends LightningElement {
554
575
  parentReferencePath,
555
576
  this.metadata[amfTopicId]?.meta
556
577
  ),
557
- isExpanded: false,
578
+ isExpanded: expandChildren,
558
579
  children: model[childrenPropertyName].map(
559
580
  (topic) => {
560
581
  const meta = this.addToMetadata(
@@ -1138,7 +1159,8 @@ export default class AmfReference extends LightningElement {
1138
1159
  const name = event.detail.name;
1139
1160
  if (name) {
1140
1161
  const urlReferenceId = this.getReferenceIdFromUrl(name);
1141
- const specBasedReference = this.isSpecBasedReference(urlReferenceId);
1162
+ const specBasedReference =
1163
+ this.isSpecBasedReference(urlReferenceId);
1142
1164
  if (specBasedReference) {
1143
1165
  const metaVal = this.getMetaFromUrl(name);
1144
1166
  const currentSelectedMeta = this.selectedTopic