From 0f6b26610639aecd230fca6e5d9dcd45b54a8430 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Wed, 10 Sep 2025 10:14:58 -0700 Subject: [PATCH] Cool parent revealing in detail dropdown --- .../common/input/tags/tags.component.html | 15 +++++++- .../common/input/tags/tags.component.scss | 37 +++++++++++++++++++ .../common/input/tags/tags.component.ts | 18 +++++++++ src-ui/src/main.ts | 4 ++ 4 files changed, 72 insertions(+), 2 deletions(-) diff --git a/src-ui/src/app/components/common/input/tags/tags.component.html b/src-ui/src/app/components/common/input/tags/tags.component.html index e14a190b9..6dcd74b4b 100644 --- a/src-ui/src/app/components/common/input/tags/tags.component.html +++ b/src-ui/src/app/components/common/input/tags/tags.component.html @@ -26,9 +26,20 @@ -
+
@if (item.id && tags) { - + @if (getTag(item.id)?.parent) { + + + + @for (p of getParentChain(item.id); track p.id) { + {{p.name}} + + } + + + } + }
diff --git a/src-ui/src/app/components/common/input/tags/tags.component.scss b/src-ui/src/app/components/common/input/tags/tags.component.scss index 342342f25..f944aa755 100644 --- a/src-ui/src/app/components/common/input/tags/tags.component.scss +++ b/src-ui/src/app/components/common/input/tags/tags.component.scss @@ -20,3 +20,40 @@ } } } + +// Dropdown hierarchy reveal for ng-select options +::ng-deep .ng-dropdown-panel .ng-option { + .tag-option-row { + font-size: 1rem; + } + + .hierarchy-reveal { + overflow: hidden; + max-width: 0; + transition: max-width 200ms ease; + } + + // .hierarchy-indicator { + // display: inline-block; + // width: .35rem; + // height: 1rem; + // border-radius: .25rem; + // background: var(--pngx-border-color, rgba(0,0,0,.2)); + // } + + .parents .badge { + white-space: nowrap; + } +} + +// Expand reveal area when hovering or when option is keyboard-marked +::ng-deep .ng-dropdown-panel .ng-option:hover .hierarchy-reveal, +::ng-deep .ng-dropdown-panel .ng-option.ng-option-marked .hierarchy-reveal { + max-width: 1000px; // effectively "auto" for transition +} + +// Fade indicator when expanded +::ng-deep .ng-dropdown-panel .ng-option:hover .hierarchy-indicator, +::ng-deep .ng-dropdown-panel .ng-option.ng-option-marked .hierarchy-indicator { + background: transparent; +} diff --git a/src-ui/src/app/components/common/input/tags/tags.component.ts b/src-ui/src/app/components/common/input/tags/tags.component.ts index ad7959ad6..1242d5a68 100644 --- a/src-ui/src/app/components/common/input/tags/tags.component.ts +++ b/src-ui/src/app/components/common/input/tags/tags.component.ts @@ -211,4 +211,22 @@ export class TagsComponent implements OnInit, ControlValueAccessor { this.tags.filter((t) => this.value.includes(t.id)) ) } + + /** + * Returns ancestors from root → immediate parent for a tag id + */ + getParentChain(id: number): Tag[] { + const chain: Tag[] = [] + let current = this.getTag(id) + const guard = new Set() + while (current?.parent) { + if (guard.has(current.parent)) break + guard.add(current.parent) + const parent = this.getTag(current.parent) + if (!parent) break + chain.unshift(parent) + current = parent + } + return chain + } } diff --git a/src-ui/src/main.ts b/src-ui/src/main.ts index 029ec72ac..b7159c30b 100644 --- a/src-ui/src/main.ts +++ b/src-ui/src/main.ts @@ -55,6 +55,7 @@ import { checkLg, chevronDoubleLeft, chevronDoubleRight, + chevronRight, clipboard, clipboardCheck, clipboardCheckFill, @@ -94,6 +95,7 @@ import { infoCircle, journals, link, + listNested, listTask, listUl, microsoft, @@ -264,6 +266,7 @@ const icons = { checkLg, chevronDoubleLeft, chevronDoubleRight, + chevronRight, clipboard, clipboardCheck, clipboardCheckFill, @@ -303,6 +306,7 @@ const icons = { infoCircle, journals, link, + listNested, listTask, listUl, microsoft,