rez_core 4.0.106 → 4.0.108

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "4.0.106",
3
+ "version": "4.0.108",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -390,7 +390,11 @@ export class FilterService {
390
390
  const tabValue = tabs.value.toLowerCase();
391
391
 
392
392
  if (tabValue === 'others') {
393
- const valuesToExclude = showList.filter((v) => v !== 'all');
393
+ // Extract 'value' (IDs) from showList, ignore 'all'
394
+ const valuesToExclude = showList
395
+ .filter((v) => v.label.toLowerCase() !== 'all')
396
+ .map((v) => v.value);
397
+
394
398
  if (valuesToExclude.length > 0) {
395
399
  for (const value of valuesToExclude) {
396
400
  const resolvedId = await this.resolverService.getResolvedId(
@@ -556,53 +560,72 @@ export class FilterService {
556
560
  let filteredTabs: any[] = [];
557
561
 
558
562
  if (showList?.length > 0) {
559
- const isAllNeeded = layout?.isAllSelected && !showList.includes('all');
560
- if (isAllNeeded) showList.push('all');
563
+ // Extract tab IDs (values)
564
+ const showValues = showList.map((item) =>
565
+ item.value?.toString().toLowerCase(),
566
+ );
567
+
568
+ // Handle "all" logic
569
+ const isAllNeeded = layout?.isAllSelected && !showValues.includes('all');
570
+ if (isAllNeeded) {
571
+ showList.push({ label: 'All', value: 'all' });
572
+ showValues.push('all');
573
+ }
561
574
 
575
+ // Filter by value IDs (not labels)
562
576
  filteredTabs = allTabs.filter((tab) =>
563
- showList.includes(tab.tab_value.toLowerCase()),
577
+ showValues.includes(tab.tab_value?.toString().toLowerCase()),
564
578
  );
565
579
 
580
+ // Handle "all" tab
566
581
  const allTab = filteredTabs.find(
567
- (tab) => tab.tab_value?.toLowerCase() === 'all',
582
+ (tab) => tab.tab_value?.toString().toLowerCase() === 'all',
568
583
  );
569
584
  filteredTabs = filteredTabs.filter(
570
- (tab) => tab.tab_value?.toLowerCase() !== 'all',
585
+ (tab) => tab.tab_value?.toString().toLowerCase() !== 'all',
571
586
  );
572
587
 
573
588
  // SORTING LOGIC
574
589
  if (layout.sorting === 'asc') {
575
590
  filteredTabs.sort((a, b) =>
576
- a.tab_value.toLowerCase().localeCompare(b.tab_value.toLowerCase()),
591
+ a.tab_value.toString().localeCompare(b.tab_value.toString()),
577
592
  );
578
593
  } else if (layout.sorting === 'dsc') {
579
594
  filteredTabs.sort((a, b) =>
580
- b.tab_value.toLowerCase().localeCompare(a.tab_value.toLowerCase()),
595
+ b.tab_value.toString().localeCompare(a.tab_value.toString()),
581
596
  );
582
597
  } else if (layout.sorting === 'count_asc') {
583
598
  filteredTabs.sort((a, b) => a.tab_value_count - b.tab_value_count);
584
599
  } else if (layout.sorting === 'count_dsc') {
585
600
  filteredTabs.sort((a, b) => b.tab_value_count - a.tab_value_count);
586
601
  } else if (layout.sorting === 'custom') {
602
+ // Keep order same as showList
587
603
  const orderMap = new Map<string, number>(
588
- showList.map((val, index) => [val.toLowerCase(), index]),
604
+ showList.map((item, index) => [
605
+ item.value?.toString().toLowerCase(),
606
+ index,
607
+ ]),
589
608
  );
590
609
  filteredTabs.sort((a, b) => {
591
- const aIndex = orderMap.get(a.tab_value.toLowerCase()) ?? Infinity;
592
- const bIndex = orderMap.get(b.tab_value.toLowerCase()) ?? Infinity;
610
+ const aIndex =
611
+ orderMap.get(a.tab_value?.toString().toLowerCase()) ?? Infinity;
612
+ const bIndex =
613
+ orderMap.get(b.tab_value?.toString().toLowerCase()) ?? Infinity;
593
614
  return aIndex - bIndex;
594
615
  });
595
616
  }
596
617
 
618
+ // Re-add "all" tab at beginning if needed
597
619
  if (allTab) filteredTabs.unshift(allTab);
598
620
 
621
+ // Combine others if enabled
599
622
  if (layout?.isCombineOther) {
600
623
  const originalAllTab = allTabs.find(
601
- (tab) => tab.tab_value.toLowerCase() === 'all',
624
+ (tab) => tab.tab_value?.toString().toLowerCase() === 'all',
602
625
  );
603
626
  const allCount = originalAllTab?.tab_value_count ?? 0;
604
627
  const knownTabCountSum = filteredTabs
605
- .filter((tab) => tab.tab_value.toLowerCase() !== 'all')
628
+ .filter((tab) => tab.tab_value?.toString().toLowerCase() !== 'all')
606
629
  .reduce((acc, tab) => acc + tab.tab_value_count, 0);
607
630
 
608
631
  const othersCount = allCount - knownTabCountSum;