|
39 | 39 | <div |
40 | 40 | :style="{ paddingLeft: `${item.depth * 24}px` }" |
41 | 41 | class="d-flex align-center py-1 cursor-pointer hover-bg" |
42 | | - @click="toggleNode(item)" |
43 | 42 | > |
44 | 43 | <div class="d-flex justify-center" style="width: 24px"> |
45 | 44 | <v-icon |
46 | 45 | v-if="item.hasChildren" |
47 | 46 | :icon=" |
48 | | - openedTerms.includes(item.identifier) |
| 47 | + isOpen(item.identifier) |
49 | 48 | ? 'fas fa-caret-down' |
50 | 49 | : 'fas fa-caret-right' |
51 | 50 | " |
52 | 51 | size="small" |
53 | | - @click.stop="toggleNode(item)" |
| 52 | + @click="toggleNode(item)" |
54 | 53 | /> |
55 | 54 | </div> |
56 | 55 |
|
57 | 56 | <div |
58 | 57 | class="d-flex flex-row justify-center align-center flex-grow-1" |
| 58 | + @click="searchTerm(item)" |
59 | 59 | > |
60 | 60 | <span |
61 | 61 | :class="[ |
62 | 62 | 'chip-mimic mr-2', |
63 | | - item.isTarget |
| 63 | + item.isTarget || activeTerms.includes(item.identifier) |
64 | 64 | ? `bg-${color} text-white font-weight-bold elevation-2 border-0` |
65 | 65 | : `text-${color} border-${color}`, |
66 | 66 | ]" |
@@ -344,6 +344,21 @@ export default { |
344 | 344 | "openTerms", |
345 | 345 | "leavePage", |
346 | 346 | ]), |
| 347 | + /** |
| 348 | + * Give the result of the term selected |
| 349 | + * @param term |
| 350 | + */ |
| 351 | +
|
| 352 | + searchTerm(term) { |
| 353 | + this.resetPagination(); |
| 354 | + if (this.activeTerms.includes(term.identifier)) |
| 355 | + this.$router.push({ path: this.$route.path }); |
| 356 | + else |
| 357 | + this.$router.push({ |
| 358 | + path: this.$route.path, |
| 359 | + query: { term: encodeURIComponent(term.name) }, |
| 360 | + }); |
| 361 | + }, |
347 | 362 |
|
348 | 363 | // --- UPDATED HELPER: Find ALL Paths --- |
349 | 364 | // Returns Array of Arrays: [[Root, Child, Target], [Root, OtherChild, Target]] |
@@ -426,6 +441,15 @@ export default { |
426 | 441 | } |
427 | 442 | return filtered; |
428 | 443 | }, |
| 444 | +
|
| 445 | + /** |
| 446 | + * SAFE CHECK: Checks if a node is open regardless of ID type (String/Number) |
| 447 | + */ |
| 448 | + isOpen(identifier) { |
| 449 | + if (!this.openedTerms) return false; |
| 450 | + // Convert everything to String for comparison |
| 451 | + return this.openedTerms.map(String).includes(String(identifier)); |
| 452 | + }, |
429 | 453 | }, |
430 | 454 | }; |
431 | 455 | </script> |
|
0 commit comments