]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-forms/select/select-checkbox.component.ts
Merge branch 'develop' into shorter-URLs-channels-accounts
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-forms / select / select-checkbox.component.ts
index 93653fef13de24239ee21b9a93a7731acd1ea72a..c2523f15cdfa2ca6f5564559450ccda816326943 100644 (file)
@@ -1,6 +1,6 @@
-import { Component, Input, forwardRef } from '@angular/core'
-import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms'
-import { SelectOptionsItem } from './select-options.component'
+import { Component, forwardRef, Input, OnInit } from '@angular/core'
+import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
+import { SelectOptionsItem } from '../../../../types/select-options-item.model'
 
 export type ItemSelectCheckboxValue = { id?: string | number, group?: string } | string
 
@@ -16,12 +16,17 @@ export type ItemSelectCheckboxValue = { id?: string | number, group?: string } |
     }
   ]
 })
-export class SelectCheckboxComponent implements ControlValueAccessor {
+export class SelectCheckboxComponent implements OnInit, ControlValueAccessor {
   @Input() availableItems: SelectOptionsItem[] = []
   @Input() selectedItems: ItemSelectCheckboxValue[] = []
   @Input() selectableGroup: boolean
   @Input() selectableGroupAsModel: boolean
   @Input() maxSelectedItems: number
+  @Input() placeholder: string
+
+  ngOnInit () {
+    if (!this.placeholder) this.placeholder = $localize`Add a new option`
+  }
 
   propagateChange = (_: any) => { /* empty */ }