@annalib/anna-core 3.6.1 → 4.1.0

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.
@@ -2871,7 +2871,7 @@ class AnnaNonEditableGenericTableComponent {
2871
2871
  }
2872
2872
  searchForTheItem(str) {
2873
2873
  if (str) {
2874
- this.tooltipOptions = cloneDeep(this.clonedTooltipOptions.filter(item => item.label.toString().includes(str)));
2874
+ this.tooltipOptions = cloneDeep(this.clonedTooltipOptions.filter(item => item.label.toString().toLowerCase().includes(str.toLowerCase())));
2875
2875
  this.tooltipOptions.forEach(element => {
2876
2876
  element.label = this.boldString(element.label, str);
2877
2877
  });
@@ -2901,8 +2901,30 @@ class AnnaNonEditableGenericTableComponent {
2901
2901
  }
2902
2902
  }
2903
2903
  boldString(str, find) {
2904
- var re = new RegExp(find, 'g');
2905
- return str.replace(re, '<b>' + find + '</b>');
2904
+ let indexes = this.getIndicesOf(find, str, false);
2905
+ indexes.forEach((item, index) => {
2906
+ let startIndex = item + (index * 7); //Multiplying by 7 as there are 7char: <b></b>
2907
+ let endIndex = startIndex + find.length;
2908
+ let strToBeReplaced = str.substring(startIndex, endIndex);
2909
+ str = str.replace(strToBeReplaced, "<b>" + strToBeReplaced + "</b>");
2910
+ });
2911
+ return str;
2912
+ }
2913
+ getIndicesOf(searchStr, str, caseSensitive) {
2914
+ var searchStrLen = searchStr.length;
2915
+ if (searchStrLen == 0) {
2916
+ return [];
2917
+ }
2918
+ var startIndex = 0, index, indices = [];
2919
+ if (!caseSensitive) {
2920
+ str = str.toLowerCase();
2921
+ searchStr = searchStr.toLowerCase();
2922
+ }
2923
+ while ((index = str.indexOf(searchStr, startIndex)) > -1) {
2924
+ indices.push(index);
2925
+ startIndex = index + searchStrLen;
2926
+ }
2927
+ return indices;
2906
2928
  }
2907
2929
  removeBoldElementFromString(originalString) {
2908
2930
  let firstRegExp = new RegExp('<b>', 'g');