@salesforcedevs/dx-components 0.19.3-alpha.48 → 0.19.3-alpha.49
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
|
@@ -89,6 +89,25 @@ export default class SidebarSearch extends LightningElement {
|
|
|
89
89
|
private fetchingMoreResults: boolean = false;
|
|
90
90
|
private didRender = false;
|
|
91
91
|
|
|
92
|
+
private get termsToHighlight(): string[] | null {
|
|
93
|
+
const { termsToHighlight, phrasesToHighlight } =
|
|
94
|
+
this.engine?.state?.search?.response;
|
|
95
|
+
if (!termsToHighlight || !phrasesToHighlight) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
return Array.from(
|
|
99
|
+
new Set(
|
|
100
|
+
[
|
|
101
|
+
this.value,
|
|
102
|
+
Object.keys(termsToHighlight),
|
|
103
|
+
Object.keys(phrasesToHighlight),
|
|
104
|
+
Object.values(termsToHighlight),
|
|
105
|
+
Object.values(phrasesToHighlight)
|
|
106
|
+
].flat(2)
|
|
107
|
+
)
|
|
108
|
+
) as string[];
|
|
109
|
+
}
|
|
110
|
+
|
|
92
111
|
private get hasCorrectCoveoConfig(): boolean {
|
|
93
112
|
const coveoConfigurations = [
|
|
94
113
|
this.coveoOrganizationId,
|
|
@@ -330,32 +349,19 @@ export default class SidebarSearch extends LightningElement {
|
|
|
330
349
|
}
|
|
331
350
|
|
|
332
351
|
private dispatchHighlightedTermChange = () => {
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
352
|
+
if (this.termsToHighlight) {
|
|
353
|
+
console.log('dispatching terms to highlight')
|
|
354
|
+
this.dispatchEvent(
|
|
355
|
+
new CustomEvent("highlightedtermchange", {
|
|
356
|
+
detail: {
|
|
357
|
+
query: this.value,
|
|
358
|
+
termsToHighlight: this.termsToHighlight
|
|
359
|
+
},
|
|
360
|
+
composed: true,
|
|
361
|
+
bubbles: true
|
|
362
|
+
})
|
|
363
|
+
);
|
|
337
364
|
}
|
|
338
|
-
const normalizedTermsToHighlight = Array.from(
|
|
339
|
-
new Set(
|
|
340
|
-
[
|
|
341
|
-
this.value,
|
|
342
|
-
Object.keys(termsToHighlight),
|
|
343
|
-
Object.keys(phrasesToHighlight),
|
|
344
|
-
Object.values(termsToHighlight),
|
|
345
|
-
Object.values(phrasesToHighlight)
|
|
346
|
-
].flat(2)
|
|
347
|
-
)
|
|
348
|
-
);
|
|
349
|
-
this.dispatchEvent(
|
|
350
|
-
new CustomEvent("highlightedtermchange", {
|
|
351
|
-
detail: {
|
|
352
|
-
query: this.value,
|
|
353
|
-
termsToHighlight: normalizedTermsToHighlight
|
|
354
|
-
},
|
|
355
|
-
composed: true,
|
|
356
|
-
bubbles: true
|
|
357
|
-
})
|
|
358
|
-
);
|
|
359
365
|
};
|
|
360
366
|
|
|
361
367
|
private updateRecentSearches = () =>
|