aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-forms/select/select-checkbox.component.ts
diff options
context:
space:
mode:
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.ts7
1 files changed, 2 insertions, 5 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 c2523f15c..12f697628 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
@@ -2,7 +2,7 @@ import { Component, forwardRef, Input, OnInit } from '@angular/core'
2import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' 2import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
3import { SelectOptionsItem } from '../../../../types/select-options-item.model' 3import { SelectOptionsItem } from '../../../../types/select-options-item.model'
4 4
5export type ItemSelectCheckboxValue = { id?: string | number, group?: string } | string 5export type ItemSelectCheckboxValue = { id?: string, group?: string } | string
6 6
7@Component({ 7@Component({
8 selector: 'my-select-checkbox', 8 selector: 'my-select-checkbox',
@@ -21,7 +21,6 @@ export class SelectCheckboxComponent implements OnInit, ControlValueAccessor {
21 @Input() selectedItems: ItemSelectCheckboxValue[] = [] 21 @Input() selectedItems: ItemSelectCheckboxValue[] = []
22 @Input() selectableGroup: boolean 22 @Input() selectableGroup: boolean
23 @Input() selectableGroupAsModel: boolean 23 @Input() selectableGroupAsModel: boolean
24 @Input() maxSelectedItems: number
25 @Input() placeholder: string 24 @Input() placeholder: string
26 25
27 ngOnInit () { 26 ngOnInit () {
@@ -46,8 +45,6 @@ export class SelectCheckboxComponent implements OnInit, ControlValueAccessor {
46 } else { 45 } else {
47 this.selectedItems = items 46 this.selectedItems = items
48 } 47 }
49
50 this.propagateChange(this.selectedItems)
51 } 48 }
52 49
53 registerOnChange (fn: (_: any) => void) { 50 registerOnChange (fn: (_: any) => void) {
@@ -63,7 +60,7 @@ export class SelectCheckboxComponent implements OnInit, ControlValueAccessor {
63 } 60 }
64 61
65 compareFn (item: SelectOptionsItem, selected: ItemSelectCheckboxValue) { 62 compareFn (item: SelectOptionsItem, selected: ItemSelectCheckboxValue) {
66 if (typeof selected === 'string') { 63 if (typeof selected === 'string' || typeof selected === 'number') {
67 return item.id === selected 64 return item.id === selected
68 } 65 }
69 66