@salesforcedevs/dx-components 1.3.206-alpha.19 → 1.3.206-alpha.20
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
|
@@ -41,52 +41,21 @@ const resultsTemplatesInnerHtml = `
|
|
|
41
41
|
<script
|
|
42
42
|
id="myDocumentResultTemplate"
|
|
43
43
|
class="result-template"
|
|
44
|
-
type="text/
|
|
44
|
+
type="text/underscore"
|
|
45
45
|
data-field-publicurl=""
|
|
46
46
|
>
|
|
47
47
|
<div class="dx-result">
|
|
48
48
|
<div class="dx-result-info">
|
|
49
49
|
<span class="CoveoFieldValue" data-field="@content_type" data-helper="badge" data-html-value="true"></span>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
<p class="dx-result-excerpt CoveoExcerpt"></p>
|
|
60
|
-
</div>
|
|
61
|
-
</script>
|
|
62
|
-
<script
|
|
63
|
-
id="myDefaultResultTemplate"
|
|
64
|
-
class="result-template"
|
|
65
|
-
type="text/html"
|
|
66
|
-
>
|
|
67
|
-
<div class="dx-result">
|
|
68
|
-
<div class="dx-result-info">
|
|
69
|
-
<span class="CoveoFieldValue" data-field="@content_type" data-helper="badge" data-html-value="true"></span>
|
|
70
|
-
<span class="CoveoFieldValue" data-field="@breadcrumbs" data-helper="breadcrumbs" data-html-value="true"></span>
|
|
71
|
-
<span class="CoveoFieldValue" data-field="@metabreadcrumbs" data-helper="metabreadcrumbs" data-html-value="true"></span>
|
|
72
|
-
</div>
|
|
73
|
-
<p class="dx-result-title">
|
|
74
|
-
<a class="CoveoResultLink"></a>
|
|
75
|
-
</p>
|
|
76
|
-
<p class="dx-result-excerpt CoveoExcerpt"></p>
|
|
77
|
-
</div>
|
|
78
|
-
</script>
|
|
79
|
-
<script
|
|
80
|
-
id="myDocumentResultTemplate"
|
|
81
|
-
class="result-template"
|
|
82
|
-
type="text/html"
|
|
83
|
-
data-field-publicurl=""
|
|
84
|
-
data-condition="!raw.breadcrumbs && !raw.metabreadcrumbs"
|
|
85
|
-
>
|
|
86
|
-
<div class="dx-result">
|
|
87
|
-
<div class="dx-result-info">
|
|
88
|
-
<span class="CoveoFieldValue" data-field="@content_type" data-helper="badge" data-html-value="true"></span>
|
|
89
|
-
<span class="CoveoFieldValue" data-field="@uri" data-helper="uriBreadcrumbs" data-html-value="true"></span>
|
|
50
|
+
<% if (!raw.breadcrumbs && !raw.metabreadcrumbs) { %>
|
|
51
|
+
<span class="CoveoFieldValue" data-field="@uri" data-helper="uriBreadcrumbs" data-html-value="true"></span>
|
|
52
|
+
<% } else { %>
|
|
53
|
+
<% if (raw.uri.includes('/references/')) { %>
|
|
54
|
+
<span class="CoveoFieldValue" data-field="@metabreadcrumbs" data-helper="metabreadcrumbs" data-html-value="true"></span>
|
|
55
|
+
<% } else { %>
|
|
56
|
+
<span class="CoveoFieldValue" data-field="@breadcrumbs" data-helper="breadcrumbs" data-html-value="true"></span>
|
|
57
|
+
<% } %>
|
|
58
|
+
<% } %>
|
|
90
59
|
</div>
|
|
91
60
|
<p class="dx-result-title">
|
|
92
61
|
<a
|
|
@@ -100,13 +69,20 @@ const resultsTemplatesInnerHtml = `
|
|
|
100
69
|
<script
|
|
101
70
|
id="myDefaultResultTemplate"
|
|
102
71
|
class="result-template"
|
|
103
|
-
type="text/
|
|
104
|
-
data-condition="!raw.breadcrumbs && !raw.metabreadcrumbs"
|
|
72
|
+
type="text/underscore"
|
|
105
73
|
>
|
|
106
74
|
<div class="dx-result">
|
|
107
75
|
<div class="dx-result-info">
|
|
108
76
|
<span class="CoveoFieldValue" data-field="@content_type" data-helper="badge" data-html-value="true"></span>
|
|
109
|
-
|
|
77
|
+
<% if (!raw.breadcrumbs && !raw.metabreadcrumbs) { %>
|
|
78
|
+
<span class="CoveoFieldValue" data-field="@uri" data-helper="uriBreadcrumbs" data-html-value="true"></span>
|
|
79
|
+
<% } else { %>
|
|
80
|
+
<% if (raw.uri.includes('/references/')) { %>
|
|
81
|
+
<span class="CoveoFieldValue" data-field="@metabreadcrumbs" data-helper="metabreadcrumbs" data-html-value="true"></span>
|
|
82
|
+
<% } else { %>
|
|
83
|
+
<span class="CoveoFieldValue" data-field="@breadcrumbs" data-helper="breadcrumbs" data-html-value="true"></span>
|
|
84
|
+
<% } %>
|
|
85
|
+
<% } %>
|
|
110
86
|
</div>
|
|
111
87
|
<p class="dx-result-title">
|
|
112
88
|
<a class="CoveoResultLink"></a>
|
|
@@ -204,7 +180,25 @@ const buildTemplateHelperUriBreadcrumbs = (value: string) => {
|
|
|
204
180
|
const buildTemplateHelperBreadcrumbs = (value: string) => {
|
|
205
181
|
const parts = value.split("/").filter((part) => part !== "");
|
|
206
182
|
|
|
207
|
-
// Don't show breadcrumbs if there's only one part
|
|
183
|
+
// Don't show breadcrumbs if there's only one part
|
|
184
|
+
if (parts.length === 1) {
|
|
185
|
+
return "";
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const breadcrumbs = processParts(parts);
|
|
189
|
+
|
|
190
|
+
// remove last breadcrumb item
|
|
191
|
+
breadcrumbs.pop();
|
|
192
|
+
|
|
193
|
+
return `
|
|
194
|
+
<span class="breadcrumb">/ ${breadcrumbs.join(" / ")} /</span>
|
|
195
|
+
`;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
const buildTemplateHelperMetaBreadcrumbs = (value: string) => {
|
|
199
|
+
const parts = value.split("/").filter((part) => part !== "");
|
|
200
|
+
|
|
201
|
+
// Don't show breadcrumbs if there's only one part
|
|
208
202
|
if (parts.length === 1) {
|
|
209
203
|
return "";
|
|
210
204
|
}
|
|
@@ -329,8 +323,6 @@ export default class SearchResults extends LightningElement {
|
|
|
329
323
|
Coveo.$$(root).on(Coveo.QueryEvents.deferredQuerySuccess, () => {
|
|
330
324
|
this.processBreadcrumbs(root);
|
|
331
325
|
|
|
332
|
-
this.filterBreadcrumbs();
|
|
333
|
-
|
|
334
326
|
window.onresize = debounce(() => {
|
|
335
327
|
this.processBreadcrumbs(root);
|
|
336
328
|
}, 10);
|
|
@@ -449,7 +441,7 @@ export default class SearchResults extends LightningElement {
|
|
|
449
441
|
|
|
450
442
|
Coveo.TemplateHelpers.registerTemplateHelper(
|
|
451
443
|
"metabreadcrumbs",
|
|
452
|
-
|
|
444
|
+
buildTemplateHelperMetaBreadcrumbs
|
|
453
445
|
);
|
|
454
446
|
|
|
455
447
|
Coveo.TemplateHelpers.registerTemplateHelper(
|
|
@@ -460,39 +452,6 @@ export default class SearchResults extends LightningElement {
|
|
|
460
452
|
Coveo.init(this.root);
|
|
461
453
|
}
|
|
462
454
|
|
|
463
|
-
filterBreadcrumbs() {
|
|
464
|
-
const resultList = this.template.querySelector(
|
|
465
|
-
".coveo-result-list-container"
|
|
466
|
-
);
|
|
467
|
-
|
|
468
|
-
requestAnimationFrame(() => {
|
|
469
|
-
const results = Array.from(resultList?.children || []);
|
|
470
|
-
|
|
471
|
-
// Hide the parent breadcrumb container if there are more than one breadcrumb
|
|
472
|
-
results.forEach((result) => {
|
|
473
|
-
const breadcrumbs = result.querySelectorAll(".breadcrumb");
|
|
474
|
-
|
|
475
|
-
if (breadcrumbs.length === 2) {
|
|
476
|
-
const breadcrumbParentOne = breadcrumbs[0].parentElement
|
|
477
|
-
?.parentElement as any;
|
|
478
|
-
const breadcrumbParentTwo = breadcrumbs[1].parentElement
|
|
479
|
-
?.parentElement as any;
|
|
480
|
-
|
|
481
|
-
const isRerencePage =
|
|
482
|
-
breadcrumbParentOne?.CoveoFieldValue?.result?.uri.includes(
|
|
483
|
-
"/references/"
|
|
484
|
-
);
|
|
485
|
-
|
|
486
|
-
if (isRerencePage) {
|
|
487
|
-
breadcrumbParentOne!.style.display = "none";
|
|
488
|
-
} else {
|
|
489
|
-
breadcrumbParentTwo!.style.display = "none";
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
});
|
|
493
|
-
});
|
|
494
|
-
}
|
|
495
|
-
|
|
496
455
|
renderedCallback() {
|
|
497
456
|
if (!this.isInitialized) {
|
|
498
457
|
if (Object.prototype.hasOwnProperty.call(window, "Coveo")) {
|