@salesforcedevs/dx-components 0.19.3-alpha.20 → 0.19.3-alpha.24

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/dx-components",
3
- "version": "0.19.3-alpha.20",
3
+ "version": "0.19.3-alpha.24",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -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,6 +336,20 @@ export default class SidebarSearch extends LightningElement {
335
336
  }
336
337
 
337
338
  private dispatchHighlightedTermChange = debounce(() => {
339
+ const { termsToHighlight, phrasesToHighlight } =
340
+ this.engine?.state?.search?.response;
341
+ if (!termsToHighlight || !phrasesToHighlight) {
342
+ return;
343
+ }
344
+ console.log(termsToHighlight, Object.values(termsToHighlight))
345
+ const terms = new Set(
346
+ [
347
+ Object.values(termsToHighlight),
348
+ Object.values(phrasesToHighlight),
349
+ this.value
350
+ ].flat()
351
+ );
352
+ console.log({ terms });
338
353
  this.dispatchEvent(
339
354
  new CustomEvent("highlightedtermchange", {
340
355
  detail: this.value,
@@ -397,7 +412,6 @@ export default class SidebarSearch extends LightningElement {
397
412
  this.value = e.detail;
398
413
 
399
414
  this.handleValueChange(false);
400
- this.dispatchHighlightedTermChange();
401
415
  }
402
416
 
403
417
  private onInputFocus() {
@@ -36,6 +36,13 @@ export const highlightTerms = (
36
36
  console.error(e, element);
37
37
  }
38
38
 
39
+ element
40
+ .querySelectorAll("mark")
41
+ .forEach(
42
+ (el) =>
43
+ (el.style.backgroundColor = "var(--dx-g-yellow-vibrant-90)")
44
+ );
45
+
39
46
  const mark = element.querySelector("mark");
40
47
  if (mark && !scrolled) {
41
48
  scrolled = true;