diff --git a/projects/komponentkartan/package.json b/projects/komponentkartan/package.json index 49c115520..8267d99de 100644 --- a/projects/komponentkartan/package.json +++ b/projects/komponentkartan/package.json @@ -1,6 +1,6 @@ { "name": "vgr-komponentkartan", - "version": "7.8.1", + "version": "7.8.3", "peerDependencies": { "@angular/common": "^9.1.7", "@angular/core": "^9.1.7", diff --git a/projects/komponentkartan/src/lib/controls/dropdown-select/dropdown-item.component.ts b/projects/komponentkartan/src/lib/controls/dropdown-select/dropdown-item.component.ts index b577e0202..887ff0d86 100644 --- a/projects/komponentkartan/src/lib/controls/dropdown-select/dropdown-item.component.ts +++ b/projects/komponentkartan/src/lib/controls/dropdown-select/dropdown-item.component.ts @@ -1,10 +1,10 @@ -import { Component, Input, EventEmitter, Output, ViewChild, ElementRef } from '@angular/core'; +import { Component, Input, EventEmitter, Output, ViewChild, ElementRef, AfterViewInit } from '@angular/core'; @Component({ selector: 'vgr-dropdown-item', templateUrl: './dropdown-item.component.html' }) -export class DropdownItemComponent { +export class DropdownItemComponent implements AfterViewInit { @Input() selectedLabel: string; @Input() value: any; @@ -14,16 +14,19 @@ export class DropdownItemComponent { @Output() next = new EventEmitter(); @Output() nextMatch = new EventEmitter(); @ViewChild('item') item: ElementRef; - - get label(): any { - return this.value; - } - + label: string; multi = false; selected = false; visible = true; hasFocus = false; + ngAfterViewInit() { + this.label = (this.item.nativeElement as Node).textContent.trim(); + if (this.value === undefined) { + this.value = this.label; + } + } + toggleSelect() { if (this.multi) { this.selected = !this.selected; diff --git a/projects/komponentkartan/src/lib/controls/dropdown-select/dropdown-select.component.ts b/projects/komponentkartan/src/lib/controls/dropdown-select/dropdown-select.component.ts index 2bb28c1ef..6730f4329 100644 --- a/projects/komponentkartan/src/lib/controls/dropdown-select/dropdown-select.component.ts +++ b/projects/komponentkartan/src/lib/controls/dropdown-select/dropdown-select.component.ts @@ -196,7 +196,7 @@ export class DropdownSelectComponent implements OnChanges, AfterContentInit, Aft if (this.items) { this.items.forEach(item => { - item.visible = item.label.toString().toLowerCase().includes(value.toLowerCase()); + item.visible = item.label.toLowerCase().includes(value.toLowerCase()); }); this.visibleCount = this.items.filter(e => e.visible).length; this.updateAllCheckedStatus(); diff --git a/projects/komponentkartan/src/lib/controls/modal/modal.component.ts b/projects/komponentkartan/src/lib/controls/modal/modal.component.ts index a6b7b1878..ec4f36c53 100644 --- a/projects/komponentkartan/src/lib/controls/modal/modal.component.ts +++ b/projects/komponentkartan/src/lib/controls/modal/modal.component.ts @@ -1,3 +1,4 @@ + import { Component, AfterViewChecked, QueryList, forwardRef, ElementRef, ContentChildren, Renderer2, OnDestroy, Output, EventEmitter } from '@angular/core';