1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 10:19:35 +02:00

adapt my-select-checkbox placeholder to its context

This commit is contained in:
Rigel Kent 2020-08-11 16:52:20 +02:00
parent 94676e631c
commit 857961f0ee
No known key found for this signature in database
GPG key ID: 5E53E96A494E452F
5 changed files with 17 additions and 3 deletions

View file

@ -1,6 +1,7 @@
import { Component, Input, forwardRef } from '@angular/core'
import { Component, Input, forwardRef, OnInit } from '@angular/core'
import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms'
import { SelectOptionsItem } from './select-options.component'
import { I18n } from '@ngx-translate/i18n-polyfill'
export type ItemSelectCheckboxValue = { id?: string | number, group?: string } | string
@ -16,12 +17,21 @@ 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
constructor (
private i18n: I18n
) {}
ngOnInit () {
if (!this.placeholder) this.placeholder = this.i18n('Add a new option')
}
propagateChange = (_: any) => { /* empty */ }