@salesforcedevs/dx-components 0.19.3-alpha.22 → 0.19.3-alpha.23
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
|
@@ -320,6 +320,7 @@ export default class SidebarSearch extends LightningElement {
|
|
|
320
320
|
|
|
321
321
|
private dispatchOnChangeEvent(results: Result[]) {
|
|
322
322
|
this.updateSessionStorage();
|
|
323
|
+
this.dispatchHighlightedTermChange();
|
|
323
324
|
this.dispatchEvent(
|
|
324
325
|
new CustomEvent("change", {
|
|
325
326
|
detail: {
|
|
@@ -335,8 +336,19 @@ export default class SidebarSearch extends LightningElement {
|
|
|
335
336
|
}
|
|
336
337
|
|
|
337
338
|
private dispatchHighlightedTermChange = debounce(() => {
|
|
338
|
-
|
|
339
|
-
|
|
339
|
+
const { termsToHighlight, phrasesToHighlight } =
|
|
340
|
+
this.engine?.state?.search?.response;
|
|
341
|
+
if (!termsToHighlight || !phrasesToHighlight) {
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
const terms = new Set(
|
|
345
|
+
[
|
|
346
|
+
Object.values(termsToHighlight),
|
|
347
|
+
Object.values(phrasesToHighlight),
|
|
348
|
+
this.value
|
|
349
|
+
].flat()
|
|
350
|
+
);
|
|
351
|
+
console.log({ terms });
|
|
340
352
|
this.dispatchEvent(
|
|
341
353
|
new CustomEvent("highlightedtermchange", {
|
|
342
354
|
detail: this.value,
|
|
@@ -399,7 +411,6 @@ export default class SidebarSearch extends LightningElement {
|
|
|
399
411
|
this.value = e.detail;
|
|
400
412
|
|
|
401
413
|
this.handleValueChange(false);
|
|
402
|
-
this.dispatchHighlightedTermChange();
|
|
403
414
|
}
|
|
404
415
|
|
|
405
416
|
private onInputFocus() {
|
|
@@ -36,10 +36,12 @@ export const highlightTerms = (
|
|
|
36
36
|
console.error(e, element);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
element
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
element
|
|
40
|
+
.querySelectorAll("mark")
|
|
41
|
+
.forEach(
|
|
42
|
+
(el) =>
|
|
43
|
+
(el.style.backgroundColor = "var(--dx-g-yellow-vibrant-90)")
|
|
44
|
+
);
|
|
43
45
|
|
|
44
46
|
const mark = element.querySelector("mark");
|
|
45
47
|
if (mark && !scrolled) {
|