@leanix/components 0.4.707 → 0.4.708

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.
@@ -1878,19 +1878,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
1878
1878
  }] }] });
1879
1879
 
1880
1880
  class HighlightRangePipe {
1881
- transform(text, offset = 0, length = 0) {
1882
- const highlightedMarkup = this.doTransform(text, offset, length);
1881
+ transform(text, offset = 0, length = 0, className = 'termHighlight') {
1882
+ const effectiveClass = className && className.length > 0 ? className : 'termHighlight';
1883
+ const highlightedMarkup = this.doTransform(text, offset, length, effectiveClass);
1883
1884
  return DOMPurify.sanitize(highlightedMarkup, { ALLOWED_TAGS: ['span'], ALLOWED_ATTR: ['class'] });
1884
1885
  }
1885
- doTransform(text, offset, length) {
1886
+ doTransform(text, offset, length, className) {
1886
1887
  if (!text || offset < 0 || length < 0 || offset >= text?.length || offset + length > text?.length) {
1887
1888
  return '';
1888
1889
  }
1889
1890
  const highlightedPart = text.slice(offset, offset + length);
1890
- return text.slice(0, offset) + (highlightedPart.length !== 0 ? this.highlight(highlightedPart) : '') + text.slice(offset + length);
1891
+ return (text.slice(0, offset) + (highlightedPart.length !== 0 ? this.highlight(highlightedPart, className) : '') + text.slice(offset + length));
1891
1892
  }
1892
- highlight(text) {
1893
- return `<span class="termHighlight">${text}</span>`;
1893
+ highlight(text, highlightClass = 'termHighlight') {
1894
+ return `<span class="${highlightClass}">${text}</span>`;
1894
1895
  }
1895
1896
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: HighlightRangePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
1896
1897
  static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.17", ngImport: i0, type: HighlightRangePipe, isStandalone: true, name: "lxHighlightRange" }); }
@@ -1916,7 +1917,7 @@ class HighlightTermPipe {
1916
1917
  * @param options The highlight term search options.
1917
1918
  * @returns The transformed text with highlighted search term.
1918
1919
  */
1919
- transform(text, search, options = { exactMatch: false }) {
1920
+ transform(text, search, options = { exactMatch: false, className: 'termHighlight' }) {
1920
1921
  if (text) {
1921
1922
  const highlightedMarkup = this.doTransform(text, search, options);
1922
1923
  return highlightedMarkup ? DOMPurify.sanitize(highlightedMarkup, { ALLOWED_TAGS: ['span'], ALLOWED_ATTR: ['class'] }) : undefined;
@@ -1939,7 +1940,8 @@ class HighlightTermPipe {
1939
1940
  })
1940
1941
  .join('|');
1941
1942
  const regex = new RegExp(pattern, 'gi');
1942
- return text.replace(regex, (match) => `<span class="termHighlight">${match}</span>`); // add highlighting to matched regex pattern
1943
+ options.className = options.className && options.className.length > 0 ? options.className : 'termHighlight';
1944
+ return text.replace(regex, (match) => `<span class="${options?.className ?? 'termHighlight'}">${match}</span>`); // add highlighting to matched regex pattern
1943
1945
  }
1944
1946
  else {
1945
1947
  return text;