@leanix/components 0.3.45 → 0.3.47

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.
@@ -980,7 +980,7 @@ class AutocloseDirective {
980
980
  onClick(target) {
981
981
  const clickedInside = this.elementRef.nativeElement.contains(target);
982
982
  if (!clickedInside) {
983
- this.autoclose.emit();
983
+ this.autoclose.emit(target);
984
984
  }
985
985
  }
986
986
  }
@@ -1368,20 +1368,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
1368
1368
  */
1369
1369
  const STANDARD_TOKENIZER_SEPERATORS = /[^a-zA-Z\d\s]/g;
1370
1370
  class HighlightTermPipe {
1371
- transform(text, search) {
1371
+ /**
1372
+ * Transforms the input text with highlighted text according to the provided search term.
1373
+ * @param text The input text.
1374
+ * @param search The search term to highlight.
1375
+ * @param options The highlight term search options.
1376
+ * @returns The transformed text with highlighted search term.
1377
+ */
1378
+ transform(text, search, options = { exactMatch: false }) {
1372
1379
  if (search && text) {
1373
- let pattern = search
1374
- .replace(STANDARD_TOKENIZER_SEPERATORS, ' ')
1375
- // replace special chars for a backslash for RegExp
1376
- .replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
1377
- pattern = pattern
1378
- .split(' ')
1379
- .filter((t) => {
1380
- return t.length > 0;
1381
- })
1382
- .join('|');
1380
+ let pattern = options.exactMatch ? search.trim() : search.replace(STANDARD_TOKENIZER_SEPERATORS, ' ');
1381
+ // replace special chars for a backslash for RegExp
1382
+ pattern = pattern.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
1383
+ pattern = options.exactMatch
1384
+ ? escape(pattern)
1385
+ : pattern
1386
+ .split(' ')
1387
+ .filter((t) => {
1388
+ return t.length > 0;
1389
+ })
1390
+ .join('|');
1383
1391
  const regex = new RegExp(pattern, 'gi');
1384
- text = _.escape(text);
1392
+ text = escape(text);
1385
1393
  return text.replace(regex, (match) => `<span class="termHighlight">${match}</span>`); // add highlighting to matched regex pattern
1386
1394
  }
1387
1395
  else {