Skip to content

Commit

Permalink
Merge branch 'feature/selectablelist_fixar'
Browse files Browse the repository at this point in the history
  • Loading branch information
aljlo2 committed Feb 2, 2024
2 parents 440c9af + a7eb65a commit 37e84ad
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

vgr-selectablelist-header,
vgr-selectablelist-row {
border-left: 4px solid transparent;
display: table-row;
height: 32px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export class SelectablelistComponent implements AfterContentInit, OnChanges, OnD
@HostBinding('attr.tabIndex') tabIndex = 0;

@Input() active: boolean;
@Input() setFirstSelectable: boolean = true;
@Input() useScrollbar: boolean = true;
@Input() maxHeight: number;
@HostBinding('attr.id') @Input() id: string;
Expand Down Expand Up @@ -174,7 +175,7 @@ export class SelectablelistComponent implements AfterContentInit, OnChanges, OnD
this.handleRowClicked(row);
});

if (this.active) {
if (this.active && this.setFirstSelectable) {
setTimeout(() => {
this.selectFirstSelectable();
}, 200);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h2>Exempel</h2>
<vgr-button (click)="addToList()">Lägg till fler rader</vgr-button>
<vgr-button (click)="removeFromList()">Ta bort rader</vgr-button>
</div>
<vgr-selectablelist [id]="'test'" [active]="true" (selectedChanged)="onSelectablelistChanged($event)" [maxHeight]="220">
<vgr-selectablelist [id]="'test'" [active]="true" [setFirstSelectable]="true" (selectedChanged)="onSelectablelistChanged($event)" [maxHeight]="220">
<vgr-selectablelist-header>
<vgr-selectablelist-header-column><strong>Utbetalning avser</strong>
</vgr-selectablelist-header-column>
Expand Down Expand Up @@ -58,11 +58,21 @@ <h2><code>&lt;vgr-selectablelist&gt;</code></h2>
<td>Talar om huruvida tabellen är aktiverad eller inte. Default värde är <code>false</code>.</td>
<td>[active]="true"</td>
</tr>
<tr>
<td>setFirstSelectable: boolean</td>
<td>Talar om huruvida första posten i tabellen automatiskt skall väljas. Default värde är <code>true</code>.</td>
<td>[setFirstSelectable]="true"</td>
</tr>
<tr>
<td>useScrollbar: boolean</td>
<td>Användaren kan välja om man vill ha med en synlig scrollbar eller inte. Default värde är <code>true</code>.</td>
<td>[useScrollbar]="false"</td>
</tr>
<tr>
<td>maxHeight: number</td>
<td>Användaren kan välja maxhöjd på listan utan att scrollbaren syns. Överskrids maxhöjden så kommer scrollbaren att synas.</td>
<td>[maxHeight]="220"</td>
</tr>
<tr>
<td>selectedChanged: EventEmitter&lt;any&gt;</td>
<td>Event som triggas när man väljer en ny rad i tabellen</td>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
import { HtmlEncodeService } from '../html-encode.service';

@Component({
selector: 'vgr-selectablelist-documentation',
templateUrl: './selectablelist-documentation.component.html',
styleUrls: ['./selectablelist-documentation.component.scss']
})
export class SelectablelistDocumentationComponent implements OnInit {
export class SelectablelistDocumentationComponent {

justeringar = [
{
Expand Down Expand Up @@ -61,7 +61,7 @@ export class SelectablelistDocumentationComponent implements OnInit {
}
]

exampleCode = `<vgr-selectablelist [id]="'test'" [active]="true (selectedChanged)="onSelectablelistChanged($event)">
exampleCode = `<vgr-selectablelist [id]="'test'" [active]="true" [setFirstSelectable]="true" (selectedChanged)="onSelectablelistChanged($event)" [maxHeight]="220">
<vgr-selectablelist-header>
<vgr-selectablelist-header-column><strong>Utbetalning avser</strong>
</vgr-selectablelist-header-column>
Expand All @@ -85,9 +85,6 @@ export class SelectablelistDocumentationComponent implements OnInit {
htmlEncoder.prepareHighlightedSection(this.exampleCode, 'HTML');
}

ngOnInit(): void {
}

onSelectablelistChanged(event) {
}

Expand Down

0 comments on commit 37e84ad

Please sign in to comment.