From b54bb3743ee4afcfdf3cbc9628a6fee5275d7e9e Mon Sep 17 00:00:00 2001 From: john Date: Wed, 7 Feb 2018 10:05:39 +0100 Subject: [PATCH 1/3] ny version 2.1.2-rc12 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d4da65e46..22b601dfc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vgr-komponentkartan", - "version": "2.1.2-rc11", + "version": "2.1.2-rc12", "author": "Västra Götalandsregionen", "license": "MIT", "scripts": { From 0f29f5f775806666050daa2b4942a4eaacdf9689 Mon Sep 17 00:00:00 2001 From: john Date: Mon, 12 Feb 2018 12:16:13 +0100 Subject: [PATCH 2/3] ny version 2.1.2-rc14 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 22b601dfc..a23aa1db5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vgr-komponentkartan", - "version": "2.1.2-rc12", + "version": "2.1.2-rc14", "author": "Västra Götalandsregionen", "license": "MIT", "scripts": { From 282c44298ca1ac628bd0db4f127a9e44807edc89 Mon Sep 17 00:00:00 2001 From: john Date: Mon, 12 Feb 2018 16:06:19 +0100 Subject: [PATCH 3/3] fixat buggarna deep clone --- src/app/komponentkarta/komponentkarta.component.html | 10 ++++------ src/app/komponentkarta/komponentkarta.component.ts | 8 ++++++++ .../controls/dropdown-base/dropdown.base.component.ts | 2 +- src/lib/controls/radioGroup/radioGroup.component.ts | 4 +++- 4 files changed, 16 insertions(+), 8 deletions(-) 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);