@salesforcedevs/docs-components 0.56.2-comp-flex-ref-1 → 0.56.2-seo-test2
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
|
@@ -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
|
|
@@ -105,7 +106,7 @@ export default class AmfReference extends LightningElement {
|
|
|
105
106
|
// This is to check if the url is hash based and redirect if needed
|
|
106
107
|
const redirectUrl = this.getHashBasedRedirectUrl();
|
|
107
108
|
if (redirectUrl) {
|
|
108
|
-
location.href = redirectUrl;
|
|
109
|
+
window.location.href = redirectUrl;
|
|
109
110
|
} else {
|
|
110
111
|
this.updateAmfConfigInView();
|
|
111
112
|
}
|
|
@@ -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:
|
|
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:
|
|
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:
|
|
568
|
+
isExpanded: expandChildren,
|
|
558
569
|
children: model[childrenPropertyName].map(
|
|
559
570
|
(topic) => {
|
|
560
571
|
const meta = this.addToMetadata(
|
|
@@ -591,16 +602,16 @@ export default class AmfReference extends LightningElement {
|
|
|
591
602
|
referenceId: string,
|
|
592
603
|
type: string,
|
|
593
604
|
topic: { id: string; domId: string }
|
|
594
|
-
): string {
|
|
605
|
+
): string | undefined {
|
|
595
606
|
const { urlIdentifer, prefix } = URL_CONFIG[type];
|
|
596
607
|
|
|
597
608
|
// encodeURI to avoid special characters in the URL meta.
|
|
598
609
|
const identifier =
|
|
599
610
|
topic[urlIdentifer] && this.encodeIdentifier(topic[urlIdentifer]);
|
|
600
|
-
|
|
611
|
+
let meta;
|
|
601
612
|
// Assuming that there will be an identifier always
|
|
602
613
|
if (identifier) {
|
|
603
|
-
|
|
614
|
+
meta = prefix ? `${prefix}${identifier}` : `${identifier}`;
|
|
604
615
|
this.metadata[meta] = {
|
|
605
616
|
parentReferencePath,
|
|
606
617
|
meta,
|
|
@@ -610,8 +621,8 @@ export default class AmfReference extends LightningElement {
|
|
|
610
621
|
identifier,
|
|
611
622
|
type
|
|
612
623
|
};
|
|
613
|
-
return meta;
|
|
614
624
|
}
|
|
625
|
+
return meta;
|
|
615
626
|
}
|
|
616
627
|
|
|
617
628
|
/**
|
|
@@ -768,7 +779,7 @@ export default class AmfReference extends LightningElement {
|
|
|
768
779
|
* The API Navigation event will always intend to navigate within the current reference
|
|
769
780
|
* @param event
|
|
770
781
|
*/
|
|
771
|
-
protected onApiNavigationChanged(
|
|
782
|
+
protected onApiNavigationChanged(): void {
|
|
772
783
|
const specBasedReference = this.isSpecBasedReference(
|
|
773
784
|
this._currentReferenceId
|
|
774
785
|
);
|
|
@@ -854,7 +865,7 @@ export default class AmfReference extends LightningElement {
|
|
|
854
865
|
const urlPath = referenceUrl.substring(
|
|
855
866
|
indexOfQueryParam >= 0 ? indexOfQueryParam : referenceUrl.length
|
|
856
867
|
);
|
|
857
|
-
return this.parseParams(urlPath)
|
|
868
|
+
return this.parseParams(urlPath).meta as string;
|
|
858
869
|
}
|
|
859
870
|
|
|
860
871
|
/**
|
|
@@ -883,6 +894,7 @@ export default class AmfReference extends LightningElement {
|
|
|
883
894
|
* For markdown based references gets topicId as last html path in the name, meta & type will be empty
|
|
884
895
|
*/
|
|
885
896
|
getReferenceMetaInfo(referenceUrl: string): RouteMeta | undefined {
|
|
897
|
+
let metaReferenceInfo;
|
|
886
898
|
if (referenceUrl) {
|
|
887
899
|
const referenceId = this.getReferenceIdFromUrl(referenceUrl);
|
|
888
900
|
let meta = "";
|
|
@@ -902,13 +914,14 @@ export default class AmfReference extends LightningElement {
|
|
|
902
914
|
} else {
|
|
903
915
|
topicId = this.getMarkdownReferenceMeta(referenceUrl);
|
|
904
916
|
}
|
|
905
|
-
|
|
917
|
+
metaReferenceInfo = {
|
|
906
918
|
referenceId,
|
|
907
919
|
meta,
|
|
908
920
|
topicId,
|
|
909
921
|
type
|
|
910
922
|
};
|
|
911
923
|
}
|
|
924
|
+
return metaReferenceInfo;
|
|
912
925
|
}
|
|
913
926
|
|
|
914
927
|
/**
|
|
@@ -946,10 +959,12 @@ export default class AmfReference extends LightningElement {
|
|
|
946
959
|
topicMeta: string
|
|
947
960
|
): string | undefined {
|
|
948
961
|
const amfConfig = this.getAmfConfigWithId(referenceId);
|
|
962
|
+
let referenceUrl;
|
|
949
963
|
if (amfConfig) {
|
|
950
964
|
const topics = amfConfig.topic?.children || [];
|
|
951
|
-
|
|
965
|
+
referenceUrl = this.getReferenceUrlInGivenTopics(topics, topicMeta);
|
|
952
966
|
}
|
|
967
|
+
return referenceUrl;
|
|
953
968
|
}
|
|
954
969
|
|
|
955
970
|
/**
|
|
@@ -1045,7 +1060,7 @@ export default class AmfReference extends LightningElement {
|
|
|
1045
1060
|
const referenceId = this.getReferenceIdFromUrl(url);
|
|
1046
1061
|
const referenceItem = this.getAmfConfigWithId(referenceId);
|
|
1047
1062
|
if (referenceItem) {
|
|
1048
|
-
location.href = referenceItem.href;
|
|
1063
|
+
window.location.href = referenceItem.href;
|
|
1049
1064
|
}
|
|
1050
1065
|
}
|
|
1051
1066
|
|
|
@@ -1105,7 +1120,7 @@ export default class AmfReference extends LightningElement {
|
|
|
1105
1120
|
if (redirectReferenceUrl) {
|
|
1106
1121
|
if (this.isParentReferencePath(referenceUrl)) {
|
|
1107
1122
|
// This is for CASE2 mentioned above, Where we need to navigate user to respective href
|
|
1108
|
-
location.href = redirectReferenceUrl;
|
|
1123
|
+
window.location.href = redirectReferenceUrl;
|
|
1109
1124
|
} else {
|
|
1110
1125
|
// This is for CASE 1,3 and 4 mentioned above, Where we need to update the browser history
|
|
1111
1126
|
window.history.replaceState({}, "", redirectReferenceUrl);
|
|
@@ -1133,8 +1148,9 @@ export default class AmfReference extends LightningElement {
|
|
|
1133
1148
|
onNavSelect(event: CustomEvent): void {
|
|
1134
1149
|
const name = event.detail.name;
|
|
1135
1150
|
if (name) {
|
|
1136
|
-
const
|
|
1137
|
-
const specBasedReference =
|
|
1151
|
+
const urlReferenceId = this.getReferenceIdFromUrl(name);
|
|
1152
|
+
const specBasedReference =
|
|
1153
|
+
this.isSpecBasedReference(urlReferenceId);
|
|
1138
1154
|
if (specBasedReference) {
|
|
1139
1155
|
const metaVal = this.getMetaFromUrl(name);
|
|
1140
1156
|
const currentSelectedMeta = this.selectedTopic
|
|
@@ -202,7 +202,7 @@ export default class ContentLayout extends LightningElement {
|
|
|
202
202
|
for (const headingElement of headingElements) {
|
|
203
203
|
// Sometimes elements hash is not being set when slot content is wrapped with div
|
|
204
204
|
headingElement.hash =
|
|
205
|
-
headingElement.attributes
|
|
205
|
+
headingElement.attributes.hash?.nodeValue;
|
|
206
206
|
}
|
|
207
207
|
const tocOptions = [];
|
|
208
208
|
for (const headingElement of headingElements) {
|
|
@@ -228,6 +228,7 @@ export default class ContentLayout extends LightningElement {
|
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
+
// eslint-disable-next-line no-undef
|
|
231
232
|
private scrollToHash(headingElements: NodeListOf<Element>): void {
|
|
232
233
|
let { hash } = window.location;
|
|
233
234
|
if (hash) {
|