@energycap/components 0.47.6 → 0.47.7-ECAP-35971-Multiselect-Updates.20261123-1057
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.
|
@@ -17,7 +17,7 @@ import { ClipboardService } from "ngx-clipboard";
|
|
|
17
17
|
import { EMPTY, ReplaySubject, Subject, forkJoin, fromEvent, interval, lastValueFrom, merge, of, race, timer } from "rxjs";
|
|
18
18
|
import { catchError, debounceTime, delay, distinctUntilChanged, filter, map, pluck, skipUntil, skipWhile, switchMap, take, takeUntil, tap } from "rxjs/operators";
|
|
19
19
|
import { DateTime, Info } from "luxon";
|
|
20
|
-
import { cloneDeep, get, isEqual, orderBy, range, sortBy, uniqueId, upperFirst } from "lodash-es";
|
|
20
|
+
import { cloneDeep, escape, get, isEqual, orderBy, range, sortBy, uniqueId, upperFirst } from "lodash-es";
|
|
21
21
|
import { ComponentPortal, TemplatePortal } from "@angular/cdk/portal";
|
|
22
22
|
import Popper from "popper.js";
|
|
23
23
|
var CacheService = class CacheService {
|
|
@@ -2595,10 +2595,11 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2595
2595
|
});
|
|
2596
2596
|
var HighlightTextPipe = class HighlightTextPipe {
|
|
2597
2597
|
transform(value, searchText, normalizePattern) {
|
|
2598
|
-
if (!value
|
|
2598
|
+
if (!value) return value;
|
|
2599
|
+
if (!searchText) return escape(value);
|
|
2599
2600
|
if (normalizePattern) return this.transformNormalized(value, searchText, normalizePattern);
|
|
2600
2601
|
const regex = new RegExp(this.escapeRegex(searchText), "gi");
|
|
2601
|
-
return
|
|
2602
|
+
return this.highlightMatches(value, regex);
|
|
2602
2603
|
}
|
|
2603
2604
|
transformNormalized(value, searchText, normalizePattern) {
|
|
2604
2605
|
let stripRegex;
|
|
@@ -2606,11 +2607,13 @@ var HighlightTextPipe = class HighlightTextPipe {
|
|
|
2606
2607
|
stripRegex = new RegExp(normalizePattern, "g");
|
|
2607
2608
|
} catch {
|
|
2608
2609
|
const regex = new RegExp(this.escapeRegex(searchText), "gi");
|
|
2609
|
-
return
|
|
2610
|
+
return this.highlightMatches(value, regex);
|
|
2610
2611
|
}
|
|
2611
2612
|
const exactRegex = new RegExp(this.escapeRegex(searchText), "gi");
|
|
2612
|
-
|
|
2613
|
-
|
|
2613
|
+
if (exactRegex.test(value)) {
|
|
2614
|
+
exactRegex.lastIndex = 0;
|
|
2615
|
+
return this.highlightMatches(value, exactRegex);
|
|
2616
|
+
}
|
|
2614
2617
|
const positionMap = [];
|
|
2615
2618
|
let normalizedValue = "";
|
|
2616
2619
|
for (let i = 0; i < value.length; i++) {
|
|
@@ -2621,12 +2624,12 @@ var HighlightTextPipe = class HighlightTextPipe {
|
|
|
2621
2624
|
}
|
|
2622
2625
|
}
|
|
2623
2626
|
const normalizedSearch = searchText.replace(stripRegex, "");
|
|
2624
|
-
if (!normalizedSearch) return value;
|
|
2627
|
+
if (!normalizedSearch) return escape(value);
|
|
2625
2628
|
const searchRegex = new RegExp(this.escapeRegex(normalizedSearch), "gi");
|
|
2626
2629
|
const matchedOriginalIndices = /* @__PURE__ */ new Set();
|
|
2627
2630
|
let match;
|
|
2628
2631
|
while ((match = searchRegex.exec(normalizedValue)) !== null) for (let i = match.index; i < match.index + match[0].length; i++) matchedOriginalIndices.add(positionMap[i]);
|
|
2629
|
-
if (matchedOriginalIndices.size === 0) return value;
|
|
2632
|
+
if (matchedOriginalIndices.size === 0) return escape(value);
|
|
2630
2633
|
let result = "";
|
|
2631
2634
|
let inHighlight = false;
|
|
2632
2635
|
for (let i = 0; i < value.length; i++) {
|
|
@@ -2638,11 +2641,22 @@ var HighlightTextPipe = class HighlightTextPipe {
|
|
|
2638
2641
|
result += `</strong>`;
|
|
2639
2642
|
inHighlight = false;
|
|
2640
2643
|
}
|
|
2641
|
-
result += value[i];
|
|
2644
|
+
result += escape(value[i]);
|
|
2642
2645
|
}
|
|
2643
2646
|
if (inHighlight) result += `</strong>`;
|
|
2644
2647
|
return result;
|
|
2645
2648
|
}
|
|
2649
|
+
highlightMatches(value, regex) {
|
|
2650
|
+
let result = "";
|
|
2651
|
+
let lastIndex = 0;
|
|
2652
|
+
let match;
|
|
2653
|
+
while ((match = regex.exec(value)) !== null) {
|
|
2654
|
+
result += escape(value.slice(lastIndex, match.index));
|
|
2655
|
+
result += this.strongWrap(escape(match[0]));
|
|
2656
|
+
lastIndex = match.index + match[0].length;
|
|
2657
|
+
}
|
|
2658
|
+
return result + escape(value.slice(lastIndex));
|
|
2659
|
+
}
|
|
2646
2660
|
strongWrap(match) {
|
|
2647
2661
|
return `<strong class="text-highlight">${match}</strong>`;
|
|
2648
2662
|
}
|