Skip to content

Commit

Permalink
Merge branch 'feature/pipes'
Browse files Browse the repository at this point in the history
  • Loading branch information
aljlo2 committed Oct 10, 2024
2 parents ef22e01 + b8c3154 commit 8107932
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 9 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"rxjs": "^7.5.7",
"smoothscroll-polyfill": "^0.4.3",
"tslib": "^2.3.1",
"vgr-komponentkartan": "^12.0.2",
"vgr-komponentkartan": "^12.0.3",
"zone.js": "~0.14.2"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<vgr-menu-item link="/colours" text="Färgkarta"></vgr-menu-item>

<vgr-menu-item link="/sizes" text="Upplösning"></vgr-menu-item>
<vgr-menu-item link="/pipes" text="Pipes"></vgr-menu-item>
<vgr-menu-separator></vgr-menu-separator>
<vgr-submenu text="Komponenter">
<vgr-menu-item link="/actionPanels" text="Action panel"></vgr-menu-item>
Expand Down
4 changes: 3 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import { RadiogroupComponent } from './radiogroup/radiogroup.component';
import { registerLocaleData } from '@angular/common';
import localeSv from '@angular/common/locales/sv';
import { SelectablelistDocumentationComponent } from './selectablelist-documentation/selectablelist-documentation.component';
import { PipesDocumentationComponent } from './pipes-documentation/pipes-documentation.component';
registerLocaleData(localeSv);

@NgModule({
Expand Down Expand Up @@ -128,7 +129,8 @@ registerLocaleData(localeSv);
EditableTableDocumentationComponent,
ComboboxDocumentationComponent,
RadiogroupComponent,
SelectablelistDocumentationComponent
SelectablelistDocumentationComponent,
PipesDocumentationComponent
],
imports: [
KomponentkartanModule,
Expand Down
52 changes: 52 additions & 0 deletions src/app/pipes-documentation/pipes-documentation.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<vgr-page>
<vgr-page-header [title]="'Pipes'">
</vgr-page-header>

<vgr-page-body>
<!-- Färger -->
<vgr-page-block class="column-layout">
<h2>Dokumentation för tillgängliga Pipes i komponentkartan</h2>
<p>Det finns ett visst antal olika pipes som man via komponentkartan kan använda sig av, utöver de inbyggda som redan finns i Angular.</p>
<br>
<table class="property-table">
<tr>
<th>Namn</th>
<th>Beskrivning</th>
<th>Exempel</th>
</tr>
<tr>
<td>
hsaidPipe : string
</td>
<td>Pipe som tar in ett HSA-id (SEZZZZZZZZZZ-E0XXXXXXXXXX60) och returnerar sista delen av HSA-id:t (E0XXXXXXXXXX60)</td>
<td>'SEZZZ-E0XXX60' | hsaidPipe</td>
</tr>
<tr>
<td>
postnummer : string
</td>
<td>Pipe som tar in en sträng (5 siffror) och returnerar ett svenskt postnummer format (ex. XXX XX)</td>
<td>'47700' | postnummer</td>
</tr>
<tr>
<td>
personnummer : string
</td>
<td>Pipe som tar in en sträng (10 eller 12 siffror) och returnerar ett svenskt personnummer format (ex. YYYYMMDD-XXXX)</td>
<td>'191212121212' | personnummer</td>
</tr>
<tr>
<td>
komponentkartanCurrency : number
</td>
<td>Pipe som tar in ett nummer och returnerar detta med decimaltecken (default 2 decimaler, ex 12,00)</td>
<td>12 | komponentkartanCurrency</td>
</tr>
</table>
<br>
<h2>Exempel</h2>
<section [innerHTML]="pipesPageStructure" vgrHighlightCode>
</section>
</vgr-page-block>
</vgr-page-body>
</vgr-page>
23 changes: 23 additions & 0 deletions src/app/pipes-documentation/pipes-documentation.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Component } from '@angular/core';
import { HtmlEncodeService } from '../html-encode.service';

@Component({
selector: 'app-pipes-documentation',
templateUrl: './pipes-documentation.component.html',
styleUrls: ['./pipes.documentation.component.scss']
})
export class PipesDocumentationComponent {

pipesPageStructure: string;
pipesPage = `<div>{{ 120 | komponentkartanCurrency }}</div> // Output 120,00
<div>{{ 'SEZZZZZZZZZZ-E0XXXXXXXXXX60' | hsaidPipe }}</div> // Output E0XXXXXXXXXX60
<div>{{ '47700' | postnummer }}</div> // Output 477 00
<div>{{ '191212121212' | personnummer }}</div> // Output 19121212-1212`;
constructor(private htmlEncoder: HtmlEncodeService) {
this.pipesPageStructure = htmlEncoder.prepareHighlightedSection(this.pipesPage);
}




}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ul {
list-style-type: disc;
list-style-position: inside;
}
2 changes: 2 additions & 0 deletions src/app/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import { ComboboxDocumentationComponent } from './combobox-documentation/combobo
import { EditableTableDocumentationComponent } from './editable-table-documentation/editable-table-documentation.component'
import {RadiogroupComponent} from './radiogroup/radiogroup.component'
import { SelectablelistDocumentationComponent } from './selectablelist-documentation/selectablelist-documentation.component';
import { PipesDocumentationComponent } from './pipes-documentation/pipes-documentation.component';


export const appRoutes: Routes = [
Expand Down Expand Up @@ -76,6 +77,7 @@ export const appRoutes: Routes = [
{ path: 'pagebody', component: PageBodyDocumentationComponent },
{ path: 'card', component: CardComponent },
{ path: 'sizes', component: SizesComponent },
{ path: 'pipes', component: PipesDocumentationComponent },
{
path: 'menu', component: MenuComponent,
children: [{
Expand Down

0 comments on commit 8107932

Please sign in to comment.