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

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-test3",
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?: boolean = false;
40
41
 
41
42
  // Update this to update what component gets rendered in the content block
42
43
  @track
@@ -377,7 +378,9 @@ export default class AmfReference extends LightningElement {
377
378
  navAmfOrder[index] = {
378
379
  label: amfConfig.title,
379
380
  name: amfConfig.href,
380
- isExpanded: amfConfig.isSelected,
381
+ isExpanded:
382
+ amfConfig.isSelected ||
383
+ this.isExpandChildrenEnabled(amfConfig.id),
381
384
  children: navItemChildren,
382
385
  isChildrenLoading
383
386
  };
@@ -386,6 +389,13 @@ export default class AmfReference extends LightningElement {
386
389
  this.navigation = navAmfOrder;
387
390
  }
388
391
 
392
+ /**
393
+ * Returns a boolean indicating whether the children should be expanded or not.
394
+ */
395
+ private isExpandChildrenEnabled(referenceId: string): boolean {
396
+ return this.expandChildren && this._currentReferenceId === referenceId;
397
+ }
398
+
389
399
  /**
390
400
  * Stores fetched AMF JSON value.
391
401
  * Creates and stores a new AmfModelParser instance for the AMF spec.
@@ -477,6 +487,7 @@ export default class AmfReference extends LightningElement {
477
487
  const model = this.amfMap[referenceId].parser.parsedModel;
478
488
 
479
489
  const children = [];
490
+ const expandChildren = this.isExpandChildrenEnabled(referenceId);
480
491
 
481
492
  NAVIGATION_ITEMS.forEach(
482
493
  ({ label, name, childrenPropertyName, type }) => {
@@ -519,7 +530,7 @@ export default class AmfReference extends LightningElement {
519
530
  parentReferencePath,
520
531
  this.metadata[amfTopicId]?.meta
521
532
  ),
522
- isExpanded: false,
533
+ isExpanded: expandChildren,
523
534
  children: childTopics
524
535
  });
525
536
  }
@@ -554,7 +565,7 @@ export default class AmfReference extends LightningElement {
554
565
  parentReferencePath,
555
566
  this.metadata[amfTopicId]?.meta
556
567
  ),
557
- isExpanded: false,
568
+ isExpanded: expandChildren,
558
569
  children: model[childrenPropertyName].map(
559
570
  (topic) => {
560
571
  const meta = this.addToMetadata(
@@ -1138,7 +1149,8 @@ export default class AmfReference extends LightningElement {
1138
1149
  const name = event.detail.name;
1139
1150
  if (name) {
1140
1151
  const urlReferenceId = this.getReferenceIdFromUrl(name);
1141
- const specBasedReference = this.isSpecBasedReference(urlReferenceId);
1152
+ const specBasedReference =
1153
+ this.isSpecBasedReference(urlReferenceId);
1142
1154
  if (specBasedReference) {
1143
1155
  const metaVal = this.getMetaFromUrl(name);
1144
1156
  const currentSelectedMeta = this.selectedTopic