Handle "private" tags, doctypes, correspondents

This commit is contained in:
shamoon
2023-03-06 16:32:20 -08:00
parent 2fe7f8be46
commit 22a13981f3
6 changed files with 59 additions and 5 deletions

View File

@@ -5,6 +5,7 @@
[disabled]="disabled"
[style.color]="textColor"
[style.background]="backgroundColor"
[class.private]="isPrivate"
[clearable]="allowNull"
[items]="items"
[addTag]="allowCreateNew && addItemRef"

View File

@@ -12,3 +12,8 @@
}
}
}
::ng-deep .private .ng-value-container {
font-style: italic;
opacity: .75;
}

View File

@@ -26,8 +26,23 @@ export class SelectComponent extends AbstractInputComponent<number> {
this.addItemRef = this.addItem.bind(this)
}
_items: any[]
@Input()
items: any[]
set items(items) {
if (this.value && items.find((i) => i.id === this.value) === undefined) {
items.push({
id: this.value,
name: $localize`Private`,
private: true,
})
}
this._items = items
}
get items(): any[] {
return this._items
}
@Input()
textColor: any
@@ -61,6 +76,10 @@ export class SelectComponent extends AbstractInputComponent<number> {
return this.createNew.observers.length > 0
}
get isPrivate(): boolean {
return this.items.find((i) => i.id === this.value)?.private
}
getSuggestions() {
if (this.suggestions && this.items) {
return this.suggestions