intelica-library-ui 0.1.209 → 0.1.211

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.
@@ -490,7 +490,8 @@ const RefreshTokenInterceptor = (req, next) => {
490
490
  };
491
491
  if (!req.url.includes("ValidateToken") &&
492
492
  !req.url.includes("environment.json") &&
493
- !req.url.includes("GetAuthenticationFromCache"))
493
+ !req.url.includes("GetAuthenticationFromCache") &&
494
+ !req.url.includes("SetCookies"))
494
495
  return from(httpClient.post(path, validateTokenQuery)).pipe(switchMap((response) => {
495
496
  if (response.expired) {
496
497
  Cookies.remove("token", cookieAttributesGeneral);
@@ -1552,6 +1553,66 @@ class SharedService {
1552
1553
  };
1553
1554
  return filterRecursive(listTempAll, true, false);
1554
1555
  }
1556
+ GetFilteredSearchMultipleKeysRecursive(listTempAll, keys, value, operatorId, searchOnlyParent = true) {
1557
+ if (!value || value.length === 0)
1558
+ return listTempAll;
1559
+ if (!listTempAll || !keys || keys.length === 0)
1560
+ return [];
1561
+ value = value.toString().toLowerCase();
1562
+ const words = value.includes("&") ? value.split("&").filter(Boolean) : [value];
1563
+ const matchesFilter = (item) => {
1564
+ // Verificar si coincide en CUALQUIERA de los campos
1565
+ return keys.some(key => {
1566
+ const itemValue = item[key]?.toString()?.toLowerCase();
1567
+ switch (operatorId) {
1568
+ case 0: // 'Contains'
1569
+ return words.every((word) => itemValue?.includes(word));
1570
+ case 1: // 'Exact'
1571
+ return itemValue === value;
1572
+ case 2: // 'Begin'
1573
+ return itemValue?.startsWith(value);
1574
+ case 3: // 'Ends'
1575
+ return itemValue?.endsWith(value);
1576
+ default:
1577
+ return itemValue?.includes(value);
1578
+ }
1579
+ });
1580
+ };
1581
+ const filterRecursive = (items, isTopLevel = true, parentMatched = false) => {
1582
+ const result = [];
1583
+ for (const item of items) {
1584
+ const currentMatches = matchesFilter(item);
1585
+ if (parentMatched) {
1586
+ result.push({ ...item });
1587
+ continue;
1588
+ }
1589
+ if (currentMatches) {
1590
+ if (searchOnlyParent) {
1591
+ result.push({ ...item });
1592
+ }
1593
+ else {
1594
+ const itemCopy = { ...item };
1595
+ if (itemCopy.children && Array.isArray(itemCopy.children) && itemCopy.children.length > 0) {
1596
+ itemCopy.children = filterRecursive(itemCopy.children, false, true);
1597
+ }
1598
+ result.push(itemCopy);
1599
+ }
1600
+ continue;
1601
+ }
1602
+ if (!searchOnlyParent && item.children && Array.isArray(item.children) && item.children.length > 0) {
1603
+ const filteredChildren = filterRecursive(item.children, false, false);
1604
+ if (filteredChildren.length > 0) {
1605
+ result.push({
1606
+ ...item,
1607
+ children: filteredChildren
1608
+ });
1609
+ }
1610
+ }
1611
+ }
1612
+ return result;
1613
+ };
1614
+ return filterRecursive(listTempAll, true, false);
1615
+ }
1555
1616
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: SharedService, deps: [{ token: i1.Location }, { token: TermPipe }], target: i0.ɵɵFactoryTarget.Injectable });
1556
1617
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: SharedService, providedIn: "root" });
1557
1618
  }
@@ -2755,7 +2816,13 @@ class TreeTableComponent {
2755
2816
  let searchOption = this.ListSearchOptions.find((item) => item.id === this.SearchInput.fieldId);
2756
2817
  let searchValue = searchOption?.field || "code";
2757
2818
  let searchOnlyParent = searchOption?.searchOnlyParent ?? true;
2758
- this.ListDataFilter = this.SharedService.GetFilteredSearchKeyRecursive([...this.ListData], searchValue, Search, this.SearchInput.operatorId, searchOnlyParent);
2819
+ if (searchValue.includes(',')) {
2820
+ const fields = searchValue.split(',').map((f) => f.trim());
2821
+ this.ListDataFilter = this.SharedService.GetFilteredSearchMultipleKeysRecursive([...this.ListData], fields, Search, this.SearchInput.operatorId, searchOnlyParent);
2822
+ }
2823
+ else {
2824
+ this.ListDataFilter = this.SharedService.GetFilteredSearchKeyRecursive([...this.ListData], searchValue, Search, this.SearchInput.operatorId, searchOnlyParent);
2825
+ }
2759
2826
  if (this.PaginatorTable) {
2760
2827
  this.PaginatorTable.CurrentPage = 1;
2761
2828
  this.CurrentPage = 1;