intelica-library-ui 0.1.202 → 0.1.204
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.
|
@@ -89,7 +89,7 @@ class TermService {
|
|
|
89
89
|
_http = inject(HttpClient);
|
|
90
90
|
_config = inject(ConfigService);
|
|
91
91
|
GetTerms(languageCode, pageRoot) {
|
|
92
|
-
return this._http.get(`${this._config.environment?.
|
|
92
|
+
return this._http.get(`${this._config.environment?.termPath}/Term/GetPageTerm/${languageCode}/${pageRoot}`);
|
|
93
93
|
}
|
|
94
94
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TermService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
95
95
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TermService, providedIn: "root" });
|
|
@@ -1495,6 +1495,63 @@ class SharedService {
|
|
|
1495
1495
|
}
|
|
1496
1496
|
return colUnique;
|
|
1497
1497
|
}
|
|
1498
|
+
GetFilteredSearchKeyRecursive(listTempAll, key, value, operatorId, searchOnlyParent = true) {
|
|
1499
|
+
if (!value || value.length === 0)
|
|
1500
|
+
return listTempAll;
|
|
1501
|
+
if (!listTempAll || !key)
|
|
1502
|
+
return [];
|
|
1503
|
+
value = value.toString().toLowerCase();
|
|
1504
|
+
const words = value.includes("&") ? value.split("&").filter(Boolean) : [value];
|
|
1505
|
+
const matchesFilter = (item) => {
|
|
1506
|
+
const itemValue = item[key]?.toString()?.toLowerCase();
|
|
1507
|
+
switch (operatorId) {
|
|
1508
|
+
case 0: // 'Contains'
|
|
1509
|
+
return words.every((word) => itemValue?.includes(word));
|
|
1510
|
+
case 1: // 'Exact'
|
|
1511
|
+
return itemValue === value;
|
|
1512
|
+
case 2: // 'Begin'
|
|
1513
|
+
return itemValue?.startsWith(value);
|
|
1514
|
+
case 3: // 'Ends'
|
|
1515
|
+
return itemValue?.endsWith(value);
|
|
1516
|
+
default:
|
|
1517
|
+
return itemValue?.includes(value);
|
|
1518
|
+
}
|
|
1519
|
+
};
|
|
1520
|
+
const filterRecursive = (items, isTopLevel = true, parentMatched = false) => {
|
|
1521
|
+
const result = [];
|
|
1522
|
+
for (const item of items) {
|
|
1523
|
+
const currentMatches = matchesFilter(item);
|
|
1524
|
+
if (parentMatched) {
|
|
1525
|
+
result.push({ ...item });
|
|
1526
|
+
continue;
|
|
1527
|
+
}
|
|
1528
|
+
if (currentMatches) {
|
|
1529
|
+
if (searchOnlyParent) {
|
|
1530
|
+
result.push({ ...item });
|
|
1531
|
+
}
|
|
1532
|
+
else {
|
|
1533
|
+
const itemCopy = { ...item };
|
|
1534
|
+
if (itemCopy.children && Array.isArray(itemCopy.children) && itemCopy.children.length > 0) {
|
|
1535
|
+
itemCopy.children = filterRecursive(itemCopy.children, false, true);
|
|
1536
|
+
}
|
|
1537
|
+
result.push(itemCopy);
|
|
1538
|
+
}
|
|
1539
|
+
continue;
|
|
1540
|
+
}
|
|
1541
|
+
if (!searchOnlyParent && item.children && Array.isArray(item.children) && item.children.length > 0) {
|
|
1542
|
+
const filteredChildren = filterRecursive(item.children, false, false);
|
|
1543
|
+
if (filteredChildren.length > 0) {
|
|
1544
|
+
result.push({
|
|
1545
|
+
...item,
|
|
1546
|
+
children: filteredChildren
|
|
1547
|
+
});
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
return result;
|
|
1552
|
+
};
|
|
1553
|
+
return filterRecursive(listTempAll, true, false);
|
|
1554
|
+
}
|
|
1498
1555
|
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 });
|
|
1499
1556
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: SharedService, providedIn: "root" });
|
|
1500
1557
|
}
|
|
@@ -2689,8 +2746,10 @@ class TreeTableComponent {
|
|
|
2689
2746
|
this.SearchInput?.searchText !== "" &&
|
|
2690
2747
|
this.ListSearchOptions.length > 0) {
|
|
2691
2748
|
let Search = this.SearchInput.searchText?.trim()?.toLowerCase();
|
|
2692
|
-
let
|
|
2693
|
-
|
|
2749
|
+
let searchOption = this.ListSearchOptions.find((item) => item.id === this.SearchInput.fieldId);
|
|
2750
|
+
let searchValue = searchOption?.field || "code";
|
|
2751
|
+
let searchOnlyParent = searchOption?.searchOnlyParent ?? true;
|
|
2752
|
+
this.ListDataFilter = this.SharedService.GetFilteredSearchKeyRecursive([...this.ListData], searchValue, Search, this.SearchInput.operatorId, searchOnlyParent);
|
|
2694
2753
|
if (this.PaginatorTable) {
|
|
2695
2754
|
this.PaginatorTable.CurrentPage = 1;
|
|
2696
2755
|
this.CurrentPage = 1;
|