diff --git a/package.json b/package.json index d2e2f7c9f..f07d1019d 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,6 @@ { "name": "vgr-komponentkartan", - "version": "2.1.2-rc17", - "author": "Västra Götalandsregionen", "license": "MIT", "scripts": { diff --git a/src/app/komponentkarta/komponentkarta.component.html b/src/app/komponentkarta/komponentkarta.component.html index 9511f22eb..cf3a018d2 100644 --- a/src/app/komponentkarta/komponentkarta.component.html +++ b/src/app/komponentkarta/komponentkarta.component.html @@ -211,20 +211,18 @@

Fyra alternativ, varav ett inaktivt

-
Du har valt alternativ: {{selectedRadioOption.value}}

Fyra alternativ, ingen förvald

- + -
Du har valt alternativ: {{selectedRadioOption.value}}

Fyra alternativ, alla selected = false

- + +
+
Du har valt alternativ: {{selectedRadioOption.value}}

Tre inaktiva alternativ, varav ett förvalt

diff --git a/src/app/komponentkarta/komponentkarta.component.ts b/src/app/komponentkarta/komponentkarta.component.ts index f660669af..9f863c6f0 100644 --- a/src/app/komponentkarta/komponentkarta.component.ts +++ b/src/app/komponentkarta/komponentkarta.component.ts @@ -44,6 +44,8 @@ export class KomponentkartaComponent implements AfterViewInit { expanded: boolean; isReadonlyAndDisabled: boolean; isReadonlyAndDisabledMulti: boolean; + options: SelectableItem[]; + constructor(private modalService: ModalService) { this.isReadonlyAndDisabled = true; this.isReadonlyAndDisabledMulti = true; @@ -95,6 +97,11 @@ export class KomponentkartaComponent implements AfterViewInit { this.dropMultipleDownItems8[2].selected = true; this.dropDownItems9[7].selected = true; + + this.options = [ + { value: '1', displayName: 'Etta' }, { value: '2', displayName: 'Tvåa' } as SelectableItem, + { value: '3', displayName: 'Trea' }, { value: '4', displayName: 'Fyra' } as SelectableItem + ]; } showOneButtonModal() { @@ -164,6 +171,7 @@ export class KomponentkartaComponent implements AfterViewInit { onSelectedRadioOptionChanged(optionValue: number) { this.selectedRadioOption.value = optionValue; } + consoleLog(logText: string) { } diff --git a/src/lib/controls/dropdown-base/dropdown.base.component.ts b/src/lib/controls/dropdown-base/dropdown.base.component.ts index e636d15d8..f00a2f1a4 100644 --- a/src/lib/controls/dropdown-base/dropdown.base.component.ts +++ b/src/lib/controls/dropdown-base/dropdown.base.component.ts @@ -46,7 +46,7 @@ export abstract class DropdownBaseComponent { @Input() set items(value: DropdownItem[]) { // The scrollbar component would not refresh when items were changed unless we added a timeout... // Ugly solution for sure, but until a better one comes along it will have to do :( - this._items = value; + this._items = JSON.parse(JSON.stringify(value)); const selectedItems = this._items.filter(x => x.selected); if (selectedItems.length > 0) { diff --git a/src/lib/controls/radioGroup/radioGroup.component.ts b/src/lib/controls/radioGroup/radioGroup.component.ts index 20a49b548..644aa2286 100644 --- a/src/lib/controls/radioGroup/radioGroup.component.ts +++ b/src/lib/controls/radioGroup/radioGroup.component.ts @@ -24,8 +24,10 @@ export class RadioGroupComponent implements ControlValueAccessor, OnChanges, Aft public radiogroupItems: RadioGroupItem[] = []; @Input() set options(items: SelectableItem[]) { + const _items = JSON.parse(JSON.stringify(items)); + let newItem: RadioGroupItem; - items.forEach(item => { + _items.forEach(item => { newItem = item as RadioGroupItem; newItem.ariaid = Guid.newGuid(); this.radiogroupItems.push(newItem);