Skip to content

Commit dfce8fa

Browse files
authored
Merge branch 'master' into issue.2915
2 parents 32f1514 + 3e36538 commit dfce8fa

File tree

6 files changed

+40
-8
lines changed

6 files changed

+40
-8
lines changed

src/contained-list/contained-list.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ import { ContainedListKind, ContainedListSize } from "./contained-list.enums";
2828
'cds--contained-list--sm': size === ContainedListSize.Small,
2929
'cds--contained-list--md': size === ContainedListSize.Medium,
3030
'cds--contained-list--lg': size === ContainedListSize.Large,
31-
'cds--contained-list--xl': size === ContainedListSize.ExtraLarge
31+
'cds--contained-list--xl': size === ContainedListSize.ExtraLarge,
32+
'cds--layout--size-sm': size === ContainedListSize.Small,
33+
'cds--layout--size-md': size === ContainedListSize.Medium,
34+
'cds--layout--size-lg': size === ContainedListSize.Large,
35+
'cds--layout--size-xl': size === ContainedListSize.ExtraLarge
3236
}">
3337
<div class="cds--contained-list__header">
3438
<div [id]="labelId" class="cds--contained-list__label">

src/contained-list/contained-list.stories.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ const withActionsTemplate = () => ({
183183
<svg ibmIcon="subtract--alt" size="16" class="cds--btn__icon"></svg>
184184
</button>
185185
</ng-template>
186-
<cds-contained-list label="List title">
186+
187+
<cds-contained-list label="List title" [size]="size">
187188
<cds-contained-list-item [action]="action">List item</cds-contained-list-item>
188189
<cds-contained-list-item [action]="action">List item</cds-contained-list-item>
189190
<cds-contained-list-item [action]="action">List item</cds-contained-list-item>
@@ -195,6 +196,7 @@ export const withActions = withActionsTemplate.bind({});
195196

196197
export const withActionsAndContextData = (args) => {
197198
args = {
199+
...args,
198200
items: [
199201
{
200202
id: 1,
@@ -228,8 +230,7 @@ export const withActionsAndContextData = (args) => {
228230
<svg ibmIcon="add" size="16" class="cds--btn__icon"></svg>
229231
</button>
230232
</ng-template>
231-
232-
<cds-contained-list label="List title">
233+
<cds-contained-list label="List title" [size]="size">
233234
<cds-contained-list-item
234235
*ngFor="let item of items"
235236
[action]="actionWithClick"

src/treeview/tree-node.component.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ import { Node } from "./tree-node.types";
8080
size="16">
8181
</svg>
8282
</ng-container>
83-
<ng-template *ngIf="isTemplate(icon)" [ngTemplateOutlet]="icon"></ng-template>
83+
<ng-template
84+
*ngIf="isTemplate(icon)"
85+
[ngTemplateOutlet]="icon"
86+
[ngTemplateOutletContext]="{ $implicit: iconContext }">
87+
</ng-template>
8488
{{label}}
8589
</span>
8690
</div>
@@ -113,6 +117,7 @@ export class TreeNodeComponent implements AfterContentChecked, OnInit, OnDestroy
113117
@Input() selected = false;
114118
@Input() value;
115119
@Input() icon: string | TemplateRef<any>;
120+
@Input() iconContext: any;
116121
@Input() children: Node[] = [];
117122

118123
/**
@@ -138,6 +143,7 @@ export class TreeNodeComponent implements AfterContentChecked, OnInit, OnDestroy
138143
this.selected = node.selected ?? this.selected;
139144
this.depth = node.depth ?? this.depth;
140145
this.children = node.children ?? this.children;
146+
this.iconContext = node.iconText ?? this.iconContext;
141147
}
142148

143149
get node() {

src/treeview/tree-node.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export interface Node {
99
expanded?: boolean;
1010
selected?: boolean;
1111
icon?: string | TemplateRef<any>;
12+
iconContext?: any;
1213
children?: Node[];
1314
[key: string]: any;
1415
}

src/treeview/treeview.component.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ import { TreeViewService } from "./treeview.service";
3232
*ngIf="label"
3333
[id]="id"
3434
class="cds--label">
35-
{{label}}
35+
<ng-container *ngIf="!isTemplate(label)">{{label}}</ng-container>
36+
<ng-template
37+
*ngIf="isTemplate(label)"
38+
[ngTemplateOutlet]="label"
39+
[ngTemplateOutletContext]="{ $implicit: labelContext }">
40+
</ng-template>
3641
</label>
3742
<div
3843
class="cds--tree"
@@ -80,6 +85,10 @@ export class TreeViewComponent implements AfterViewInit, OnInit, OnDestroy {
8085
* Tree view label
8186
*/
8287
@Input() label: string | TemplateRef<any>;
88+
/**
89+
* Optional context for label if it's a template
90+
*/
91+
@Input() labelContext: any;
8392
/**
8493
* Specify the size of the list items in the tree
8594
*/
@@ -154,6 +163,10 @@ export class TreeViewComponent implements AfterViewInit, OnInit, OnDestroy {
154163
}
155164
}
156165

166+
public isTemplate(value) {
167+
return value instanceof TemplateRef;
168+
}
169+
157170
public isProjected() {
158171
return this.treeViewService.contentProjected;
159172
}

src/ui-shell/sidenav/sidenav-item.component.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,18 @@ import { Router } from "@angular/router";
3131
3232
<ng-template #sidenavItemRouterTpl>
3333
<a
34+
[attr.title]="title ? title : null"
3435
[routerLink]="route"
36+
[relativeTo]="routeExtras?.relativeTo"
37+
[queryParams]="routeExtras?.queryParams"
38+
[fragment]="routeExtras?.fragment"
39+
[queryParamsHandling]="routeExtras?.queryParamsHandling"
40+
[preserveFragment]="routeExtras?.preserveFragment"
41+
[skipLocationChange]="routeExtras?.skipLocationChange"
42+
[replaceUrl]="routeExtras?.replaceUrl"
43+
[state]="routeExtras?.state"
3544
routerLinkActive="cds--side-nav__item--active"
36-
(click)="navigate($event)"
3745
ariaCurrentWhenActive="page"
38-
[attr.title]="title ? title : null"
3946
class="cds--side-nav__link">
4047
<ng-template [ngTemplateOutlet]="sidenavItemContentTpl"></ng-template>
4148
</a>

0 commit comments

Comments
 (0)