Enhancement: allow tags list selection without auto parent/child

This commit is contained in:
shamoon 2025-11-04 08:28:14 -08:00
parent 74f72e417d
commit 3e3ff39b0c
No known key found for this signature in database
2 changed files with 6 additions and 2 deletions

View File

@ -210,6 +210,7 @@
<pngx-input-tags
[allowCreate]="false"
[title]="null"
[autoHeirarchy]="false"
formControlName="values"
></pngx-input-tags>
} @else if (

View File

@ -103,6 +103,9 @@ export class TagsComponent implements OnInit, ControlValueAccessor {
@Input()
multiple: boolean = true
@Input()
autoHeirarchy: boolean = true
@Output()
filterDocuments = new EventEmitter<Tag[]>()
@ -134,7 +137,7 @@ export class TagsComponent implements OnInit, ControlValueAccessor {
oldValue.splice(index, 1)
// remove children
oldValue = this.removeChildren(oldValue, tag)
if (this.autoHeirarchy) oldValue = this.removeChildren(oldValue, tag)
this.value = [...oldValue]
this.onChange(this.value)
@ -153,7 +156,7 @@ export class TagsComponent implements OnInit, ControlValueAccessor {
}
public onAdd(tag: Tag) {
if (tag.parent) {
if (this.autoHeirarchy && tag.parent) {
// add all parents recursively
const parent = this.getTag(tag.parent)
this.value = [...this.value, parent.id]