Skip to content

Commit

Permalink
fix(module: tree): reset style
Browse files Browse the repository at this point in the history
  • Loading branch information
simplejason committed May 31, 2018
1 parent 2c93645 commit 696cade
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 96 deletions.
50 changes: 24 additions & 26 deletions components/core/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -109,35 +109,33 @@
}

// hack tree css
.ant-tree-show-line {
> nz-tree-node:not(:last-child), .ant-tree-child-tree > nz-tree-node:not(:last-child) {
> li:before {
content: ' ';
width: 1px;
border-left: 1px solid @border-color-base;
height: 100%;
position: absolute;
left: 12px;
margin: 22px 0;
.ant-tree {
&.ant-tree-show-line {
> nz-tree-node:not(:last-child), .ant-tree-child-tree > nz-tree-node:not(:last-child) {
> li:before {
content: ' ';
width: 1px;
border-left: 1px solid @border-color-base;
height: 100%;
position: absolute;
left: 12px;
margin: 22px 0;
}
}
}
.ant-tree-child-tree > nz-tree-node:last-child {
> li:before {
content: ' ';
width: 1px;
border-left: 0px solid @border-color-base;
height: 100%;
position: absolute;
left: 12px;
margin: 22px 0;
.ant-tree-child-tree > nz-tree-node:last-child {
> li:before {
content: ' ';
width: 1px;
border-left: 0px solid @border-color-base;
height: 100%;
position: absolute;
left: 12px;
margin: 22px 0;
}
}
}
}

span {
&.ant-tree-icon_loading {
position: relative !important;
transform: translateX(0%) !important;
.font-highlight {
color: @highlight-color;
}
}

Expand Down
50 changes: 16 additions & 34 deletions components/tree/demo/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,48 +33,30 @@ export class NzDemoTreeBasicComponent implements OnInit {
key : '10001',
children: [
{
title : 'child1.1',
key : '100011',
children: []
title : 'child1.1',
key : '100011',
isLeaf: true
},
{
title : 'child1.2',
key : '100012',
children: [
{
title : 'grandchild1.2.1',
key : '1000121',
isLeaf : true,
disabled: true
},
{
title : 'grandchild1.2.2',
key : '1000122',
isLeaf: true
}
]
title : 'child1.2',
key : '100012',
isLeaf: true
}
]
}
]
}),
new NzTreeNode({
title : 'root2',
key : '1002',
children: [
{
title : 'child2.1',
key : '10021',
children : [],
disableCheckbox: true
},
{
title : 'child2.2',
key : '10022',
title : 'child2',
key : '10002',
children: [
{
title : 'grandchild2.2.1',
key : '100221',
title : 'grandchild1.2.1',
key : '1000121',
isLeaf : true,
disabled: true
},
{
title : 'grandchild1.2.2',
key : '1000122',
isLeaf: true
}
]
Expand Down
24 changes: 10 additions & 14 deletions components/tree/demo/draggable-confirm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ export class NzDemoTreeDraggableConfirmComponent {
key : '10001',
children: [
{
title : 'child1.1',
key : '100011',
children: []
title : 'child1.1',
key : '100011',
isLeaf: true
},
{
title : 'child1.2',
Expand All @@ -65,10 +65,6 @@ export class NzDemoTreeDraggableConfirmComponent {
]
}
]
},
{
title: 'child2',
key : '10002'
}
]
}),
Expand All @@ -77,23 +73,23 @@ export class NzDemoTreeDraggableConfirmComponent {
key : '1002',
children: [
{
title : 'child2.1',
key : '10021',
children: []
title : 'child2.1',
key : '10021',
isLeaf: true
},
{
title : 'child2.2',
key : '10022',
children: [
{
title: 'grandchild2.2.1',
key : '100221'
title : 'grandchild2.2.1',
key : '100221',
isLeaf: true
}
]
}
]
}),
new NzTreeNode({ title: 'root3', key: '1003' })
})
];

mouseAction(name: string, e: NzFormatEmitEvent): void {
Expand Down
24 changes: 10 additions & 14 deletions components/tree/demo/draggable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ export class NzDemoTreeDraggableComponent implements OnInit {
key : '10001',
children: [
{
title : 'child1.1',
key : '100011',
children: []
title : 'child1.1',
key : '100011',
isLeaf: true
},
{
title : 'child1.2',
Expand All @@ -57,10 +57,6 @@ export class NzDemoTreeDraggableComponent implements OnInit {
]
}
]
},
{
title: 'child2',
key : '10002'
}
]
}),
Expand All @@ -69,23 +65,23 @@ export class NzDemoTreeDraggableComponent implements OnInit {
key : '1002',
children: [
{
title : 'child2.1',
key : '10021',
children: []
title : 'child2.1',
key : '10021',
isLeaf: true
},
{
title : 'child2.2',
key : '10022',
children: [
{
title: 'grandchild2.2.1',
key : '100221'
title : 'grandchild2.2.1',
key : '100221',
isLeaf: true
}
]
}
]
}),
new NzTreeNode({ title: 'root3', key: '1003' })
})
];

mouseAction(name: string, e: NzFormatEmitEvent): void {
Expand Down
18 changes: 12 additions & 6 deletions components/tree/demo/line.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ export class NzDemoTreeLineComponent {
title : 'child1',
key : '10001',
children: [
{
title : 'child1.1',
key : '100011',
children: []
},
{
title : 'child1.2',
key : '100012',
Expand All @@ -51,7 +46,18 @@ export class NzDemoTreeLineComponent {
{
title : 'child2',
key : '10002',
children: []
children: [
{
title : 'grandchild2.1',
key : '1000122',
isLeaf: true
},
{
title : 'grandchild2.2',
key : '1000123',
isLeaf: true
}
]
}
]
}),
Expand Down
11 changes: 10 additions & 1 deletion components/tree/nz-tree-node.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { NzTreeService } from './nz-tree.service';
<ng-container *ngIf="nzShowExpand">
<span
class="ant-tree-switcher"
[ngStyle]="loadingStyle"
[class.ant-tree-switcher_open]="nzTreeNode.isExpanded && !nzTreeNode.isLeaf && !nzTreeNode.isLoading"
[class.ant-tree-switcher_close]="!nzTreeNode.isExpanded && !nzTreeNode.isLeaf && !nzTreeNode.isLoading"
[class.ant-tree-switcher-noop]="nzTreeNode.isLeaf && !nzTreeNode.isLoading"
Expand Down Expand Up @@ -64,7 +65,7 @@ import { NzTreeService } from './nz-tree.service';
<span class="ant-tree-title">
<ng-container *ngIf="matchValue.length==2">
<span>
{{matchValue[0]}}<span class="font-red">{{nzSearchValue}}</span>{{matchValue[1]}}
{{matchValue[0]}}<span class="font-highlight">{{nzSearchValue}}</span>{{matchValue[1]}}
</span>
</ng-container>
<ng-container *ngIf="matchValue.length!=2">
Expand Down Expand Up @@ -222,6 +223,14 @@ export class NzTreeNodeComponent implements OnInit, AfterViewInit {
return this._searchValue;
}

get loadingStyle(): { [key: string]: string } {
const isLoading = this.nzTreeNode.isLoading && !this.nzTreeNode.isLeaf;
return {
position : isLoading ? 'relative' : '',
transform: isLoading ? 'translateX(0%)' : ''
};
}

@Output() clickNode: EventEmitter<NzFormatEmitEvent> = new EventEmitter();
@Output() dblClick: EventEmitter<NzFormatEmitEvent> = new EventEmitter();
@Output() contextMenu: EventEmitter<NzFormatEmitEvent> = new EventEmitter();
Expand Down
2 changes: 1 addition & 1 deletion components/tree/nz-tree.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { forwardRef, Component, ContentChild, EventEmitter, Input, OnInit, Output, TemplateRef } from '@angular/core';
import { Component, ContentChild, EventEmitter, forwardRef, Input, OnInit, Output, TemplateRef } from '@angular/core';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
import { Observable } from 'rxjs/Observable';

Expand Down

0 comments on commit 696cade

Please sign in to comment.