-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
112 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 14 additions & 15 deletions
29
projects/wvr-elements/src/lib/wvr-list/wvr-list.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,34 @@ | ||
<wvr-list-wrapper #animationRoot> | ||
<ul *ngIf="listType==='unordered' || listType==='unstyled'" [ngClass]="{'list-unstyled': listType==='unstyled'}"> | ||
<ng-container *ngTemplateOutlet="listContent"></ng-container> | ||
|
||
<ul innerHtml="{{listItemsHtml}}" *ngIf="listType==='unordered' || listType==='unstyled'" [ngClass]="{'list-unstyled': listType==='unstyled'}"> | ||
</ul> | ||
|
||
<ol *ngIf="listType==='ordered'"> | ||
<ng-container *ngTemplateOutlet="listContent"></ng-container> | ||
<ol innerHtml="{{listItemsHtml}}" *ngIf="listType==='ordered'"> | ||
</ol> | ||
|
||
<dl *ngIf="listType==='described'"> | ||
<ng-container *ngTemplateOutlet="listContent"></ng-container> | ||
<dl innerHtml="{{listItemsHtml}}" *ngIf="listType==='described'"> | ||
</dl> | ||
|
||
<ul *ngIf="listType==='group-ul' || listType==='group'" class="list-group"> | ||
<ng-container *ngTemplateOutlet="listContent"></ng-container> | ||
<ul innerHtml="{{listItemsHtml}}" *ngIf="listType==='group-ul' || listType==='group'" class="list-group"> | ||
</ul> | ||
|
||
<div *ngIf="listType==='group-div'" class="list-group"> | ||
<ng-container *ngTemplateOutlet="listContent"></ng-container> | ||
<div innerHtml="{{listItemsHtml}}" *ngIf="listType==='group-div'" class="list-group"> | ||
</div> | ||
|
||
<ul *ngIf="listType==='group-flush'" class="list-group list-group-flush"> | ||
<ng-container *ngTemplateOutlet="listContent"></ng-container> | ||
<ul innerHtml="{{listItemsHtml}}" *ngIf="listType==='group-flush'" class="list-group list-group-flush"> | ||
</ul> | ||
|
||
<div *ngIf="listType==='group-custom-content'" class="list-group"> | ||
<ng-container *ngTemplateOutlet="listContent"></ng-container> | ||
<div innerHtml="{{listItemsHtml}}" *ngIf="listType==='group-custom-content'" class="list-group"> | ||
</div> | ||
|
||
</wvr-list-wrapper> | ||
|
||
<ng-template #listContent> | ||
|
||
<template> | ||
<ng-container *ngTemplateOutlet="contentProjection"></ng-container> | ||
</template> | ||
|
||
<ng-template #contentProjection> | ||
<ng-content select="wvr-list-item, wvr-list-item-element, .badge"></ng-content> | ||
</ng-template> | ||
|
30 changes: 28 additions & 2 deletions
30
projects/wvr-elements/src/lib/wvr-list/wvr-list.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,43 @@ | ||
import { Component, Injector, Input } from '@angular/core'; | ||
import { AfterContentInit, AfterViewInit, Component, Injector, Input } from '@angular/core'; | ||
import { SafeHtml } from '@angular/platform-browser'; | ||
import { Theme } from '../shared/theme.type'; | ||
import { WvrBaseComponent } from '../shared/wvr-base.component'; | ||
import { WvrListItemComponent } from './wvr-list-item/wvr-list-item.component'; | ||
|
||
@Component({ | ||
selector: 'wvr-list-element', | ||
templateUrl: './wvr-list.component.html', | ||
styleUrls: ['./wvr-list.component.scss'] | ||
}) | ||
export class WvrListComponent extends WvrBaseComponent { | ||
export class WvrListComponent extends WvrBaseComponent implements AfterContentInit { | ||
|
||
private readonly listItems: Array<WvrListItemComponent>; | ||
|
||
@Input() listType = 'unordered'; | ||
|
||
@Input() context: Theme; | ||
|
||
private _htmlString: string; | ||
|
||
get listItemsHtml(): SafeHtml { | ||
return this._htmlString; | ||
} | ||
|
||
constructor(injector: Injector) { | ||
super(injector); | ||
this.listItems = new Array<WvrListItemComponent>(); | ||
} | ||
|
||
addListItem(listItem: WvrListItemComponent): void { | ||
this.listItems.push(listItem); | ||
} | ||
|
||
ngAfterContentInit(): void { | ||
setTimeout(() => { | ||
this._htmlString = this.listItems | ||
.map(li => li.htmlContent) | ||
.join('\n'); | ||
}, 0); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters