diff options
Diffstat (limited to 'client/src/app/shared/shared-forms/select/select-checkbox.component.ts')
-rw-r--r-- | client/src/app/shared/shared-forms/select/select-checkbox.component.ts | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/client/src/app/shared/shared-forms/select/select-checkbox.component.ts b/client/src/app/shared/shared-forms/select/select-checkbox.component.ts index 93653fef1..fd683ae5d 100644 --- a/client/src/app/shared/shared-forms/select/select-checkbox.component.ts +++ b/client/src/app/shared/shared-forms/select/select-checkbox.component.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { Component, Input, forwardRef } from '@angular/core' | 1 | import { Component, Input, forwardRef, OnInit } from '@angular/core' |
2 | import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms' | 2 | import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms' |
3 | import { SelectOptionsItem } from './select-options.component' | 3 | import { SelectOptionsItem } from './select-options.component' |
4 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
4 | 5 | ||
5 | export type ItemSelectCheckboxValue = { id?: string | number, group?: string } | string | 6 | export type ItemSelectCheckboxValue = { id?: string | number, group?: string } | string |
6 | 7 | ||
@@ -16,12 +17,21 @@ export type ItemSelectCheckboxValue = { id?: string | number, group?: string } | | |||
16 | } | 17 | } |
17 | ] | 18 | ] |
18 | }) | 19 | }) |
19 | export class SelectCheckboxComponent implements ControlValueAccessor { | 20 | export class SelectCheckboxComponent implements OnInit, ControlValueAccessor { |
20 | @Input() availableItems: SelectOptionsItem[] = [] | 21 | @Input() availableItems: SelectOptionsItem[] = [] |
21 | @Input() selectedItems: ItemSelectCheckboxValue[] = [] | 22 | @Input() selectedItems: ItemSelectCheckboxValue[] = [] |
22 | @Input() selectableGroup: boolean | 23 | @Input() selectableGroup: boolean |
23 | @Input() selectableGroupAsModel: boolean | 24 | @Input() selectableGroupAsModel: boolean |
24 | @Input() maxSelectedItems: number | 25 | @Input() maxSelectedItems: number |
26 | @Input() placeholder: string | ||
27 | |||
28 | constructor ( | ||
29 | private i18n: I18n | ||
30 | ) {} | ||
31 | |||
32 | ngOnInit () { | ||
33 | if (!this.placeholder) this.placeholder = this.i18n('Add a new option') | ||
34 | } | ||
25 | 35 | ||
26 | propagateChange = (_: any) => { /* empty */ } | 36 | propagateChange = (_: any) => { /* empty */ } |
27 | 37 | ||