Skip to content

Commit 5a9e304

Browse files
authored
Merge pull request #8945 from IgniteUI/vslavov/tree-POC
IgxTree Implementation
2 parents dbdb58b + 12dee65 commit 5a9e304

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+6881
-53
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,27 @@ All notable changes for each version of this project will be documented in this
3131
- `onDataPreLoad` -> `dataPreLoad`
3232

3333
### New Features
34+
- Added `IgxTree` component
35+
- Allows users to render hierarchical data in an easy-to-navigate way. The control is **not** data bound and takes a declarative approach, giving users more control over what is being rendered.
36+
- Features API for handling selection (bi-state and cascading), node activation, node expansion state.
37+
- Features extensive and easy-to-use keyboard navigation, fully compliant with W3 standards.
38+
- Code example for a tree contructured from a hierarchical data set:
39+
```html
40+
<igx-tree>
41+
<igx-tree-node *ngFor="let node of data" [data]="node" [expanded]="isNodeExpanded(node)" [selected]="isNodeSelected(node)">
42+
{{ node.text }}
43+
<img [src]="node.image" alt="node.imageAlt" />
44+
<igx-tree-node *ngFor="let child of node.children" [data]="child" [expanded]="isNodeExpanded(child)" [selected]="isNodeSelected(child)">
45+
{{ child.text }}
46+
<igx-tree-node *ngFor="let leafChild of child.children" [data]="leafChild" [expanded]="isNodeExpanded(leafChild)" [selected]="isNodeSelected(leafChild)">
47+
<a igxTreeNodeLink href="{{leafChild.location}}" target="_blank">{{ leafChild.text }}</a>
48+
</igx-tree-node>
49+
</igx-tree-node>
50+
</igx-tree-node>
51+
</igx-tree>
52+
```
53+
- For more information, check out the [README](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/tree/README.md), [specification](https://github.com/IgniteUI/igniteui-angular/wiki/Tree-Specification) and [official documentation](https://www.infragistics.com/products/ignite-ui-angular/angular/components/tree)
54+
3455
- `IgxHierarchicalGrid`
3556
- Added support for exporting hierarchical data.
3657
- `IgxForOf`, `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ You can find source files under the [`src`](https://github.com/IgniteUI/igniteui
5656
|tabs|Available|[Readme](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/tabs/README.md)|[Docs](https://www.infragistics.com/products/ignite-ui-angular/angular/components/tabs)|||||
5757
|time picker|Available|[Readme](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/time-picker/README.md)|[Docs](https://www.infragistics.com/products/ignite-ui-angular/angular/components/time-picker)|||||
5858
|toast|Available|[Readme](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/toast/README.md)|[Docs](https://www.infragistics.com/products/ignite-ui-angular/angular/components/toast)|||||
59+
|tree|Available|[Readme](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/tree/README.md)|[Docs](https://www.infragistics.com/products/ignite-ui-angular/angular/components/tree)|||||
5960
|tree grid|Available|[Readme](https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/grids/tree-grid/README.md)|[Docs](https://www.infragistics.com/products/ignite-ui-angular/angular/components/treegrid/tree-grid)|||||
6061

6162
#### Components available in [igniteui-angular-charts](https://www.npmjs.com/package/igniteui-angular-charts)

projects/igniteui-angular/karma.azure.non-grid.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module.exports = function (config) {
2323
random: false
2424
},
2525
tagPrefix: '#',
26-
skipTags: 'hGrid,tGrid,grid,perf'
26+
skipTags: 'hGrid,tGrid,grid,perf,treeView'
2727
},
2828
port: 9876,
2929
colors: true,

projects/igniteui-angular/src/lib/banner/banner.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Component, NgModule, EventEmitter, Output, Input, ViewChild, ElementRef,
22
ContentChild, HostBinding } from '@angular/core';
33
import { IgxExpansionPanelModule } from '../expansion-panel/expansion-panel.module';
4-
import { AnimationSettings } from '../expansion-panel/expansion-panel.component';
54
import { IgxExpansionPanelComponent } from '../expansion-panel/public_api';
65
import { IgxIconModule, IgxIconComponent } from '../icon/public_api';
76
import { IToggleView } from '../core/navigation';
@@ -10,6 +9,7 @@ import { IgxRippleModule } from '../directives/ripple/ripple.directive';
109
import { IgxBannerActionsDirective } from './banner.directives';
1110
import { CommonModule } from '@angular/common';
1211
import { CancelableEventArgs, IBaseEventArgs } from '../core/utils';
12+
import { ToggleAnimationSettings } from '../expansion-panel/toggle-animation-component';
1313

1414
export interface BannerEventArgs extends IBaseEventArgs {
1515
banner: IgxBannerComponent;
@@ -111,11 +111,11 @@ export class IgxBannerComponent implements IToggleView {
111111
/**
112112
* Get the animation settings used by the banner open/close methods
113113
* ```typescript
114-
* let currentAnimations: AnimationSettings = banner.animationSettings
114+
* let currentAnimations: ToggleAnimationSettings = banner.animationSettings
115115
* ```
116116
*/
117117
@Input()
118-
public get animationSettings(): AnimationSettings {
118+
public get animationSettings(): ToggleAnimationSettings {
119119
return this._animationSettings ? this._animationSettings : this._expansionPanel.animationSettings;
120120
}
121121

@@ -124,10 +124,10 @@ export class IgxBannerComponent implements IToggleView {
124124
* ```typescript
125125
* import { slideInLeft, slideOutRight } from 'igniteui-angular';
126126
* ...
127-
* banner.animationSettings: AnimationSettings = { openAnimation: slideInLeft, closeAnimation: slideOutRight };
127+
* banner.animationSettings: ToggleAnimationSettings = { openAnimation: slideInLeft, closeAnimation: slideOutRight };
128128
* ```
129129
*/
130-
public set animationSettings(settings: AnimationSettings) {
130+
public set animationSettings(settings: ToggleAnimationSettings) {
131131
this._animationSettings = settings;
132132
}
133133
/**
@@ -166,7 +166,7 @@ export class IgxBannerComponent implements IToggleView {
166166
private _bannerActionTemplate: IgxBannerActionsDirective;
167167

168168
private _bannerEvent: BannerEventArgs;
169-
private _animationSettings: AnimationSettings;
169+
private _animationSettings: ToggleAnimationSettings;
170170

171171
constructor(public elementRef: ElementRef) { }
172172

projects/igniteui-angular/src/lib/core/i18n/resources.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ import { IChipResourceStrings, ChipResourceStringsEN } from './chip-resources';
88
import { IListResourceStrings, ListResourceStringsEN } from './list-resources';
99
import { CalendarResourceStringsEN, ICalendarResourceStrings } from './calendar-resources';
1010
import { IInputResourceStrings, InputResourceStringsEN } from './input-resources';
11+
import { ITreeResourceStrings, TreeResourceStringsEN } from './tree-resources';
1112

1213
export interface IResourceStrings extends IGridResourceStrings, ITimePickerResourceStrings, ICalendarResourceStrings,
1314
ICarouselResourceStrings, IChipResourceStrings, IInputResourceStrings, IDateRangePickerResourceStrings, IListResourceStrings,
14-
IPaginatorResourceStrings { }
15+
IPaginatorResourceStrings, ITreeResourceStrings { }
1516

1617
/**
1718
* @hidden
@@ -26,6 +27,7 @@ export const CurrentResourceStrings = {
2627
CarouselResStrings: cloneValue(CarouselResourceStringsEN),
2728
ListResStrings: cloneValue(ListResourceStringsEN),
2829
InputResStrings: cloneValue(InputResourceStringsEN),
30+
TreeResStrings: cloneValue(TreeResourceStringsEN),
2931
};
3032

3133
const updateResourceStrings = (currentStrings: IResourceStrings, newStrings: IResourceStrings) => {
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export interface ITreeResourceStrings {
2+
igx_expand?: string;
3+
igx_collapse?: string;
4+
}
5+
6+
export const TreeResourceStringsEN: ITreeResourceStrings = {
7+
igx_expand: 'Expand',
8+
igx_collapse: 'Collapse',
9+
};
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
////
2+
/// @group components
3+
/// @author <a href="https://github.com/desig9stein" target="_blank">Marin Popov</a>
4+
/// @requires {mixin} bem-block
5+
/// @requires {mixin} bem-elem
6+
/// @requires {mixin} bem-mod
7+
////
8+
9+
@include b(igx-tree) {
10+
@extend %tree-display !optional;
11+
}
12+
13+
@include b(igx-tree-node) {
14+
$this: bem--selector-to-string(&);
15+
@include register-component(str-slice($this, 2, -1));
16+
17+
@extend %tree-node !optional;
18+
19+
@include e(wrapper) {
20+
@extend %node-wrapper !optional;
21+
22+
&:hover {
23+
&::after {
24+
@extend %indigo-opacity !optional;
25+
}
26+
}
27+
}
28+
29+
@include e(wrapper, $m: cosy) {
30+
@extend %node-wrapper--cosy !optional;
31+
}
32+
33+
@include e(wrapper, $m: compact) {
34+
@extend %node-wrapper--compact !optional;
35+
}
36+
37+
// STATES START
38+
@include e(wrapper, $m: selected) {
39+
@extend %node-wrapper--selected !optional;
40+
}
41+
42+
@include e(wrapper, $m: active) {
43+
@extend %node-wrapper--active !optional;
44+
}
45+
46+
@include e(wrapper, $mods: (active, selected)) {
47+
@extend %node-wrapper--active-selected !optional;
48+
}
49+
50+
@include e(wrapper, $m: focused) {
51+
@extend %node-wrapper--focused !optional;
52+
}
53+
54+
@include e(wrapper, $m: disabled) {
55+
@extend %node-wrapper--disabled !optional;
56+
}
57+
// STATES END
58+
59+
@include e(content) {
60+
@extend %node-content !optional;
61+
}
62+
63+
@include e(spacer) {
64+
@extend %node-spacer !optional;
65+
}
66+
67+
@include e(toggle-button) {
68+
@extend %node-toggle-button !optional;
69+
}
70+
71+
@include e(toggle-button, $m: hidden) {
72+
@extend %node-toggle-button--hidden !optional;
73+
}
74+
75+
@include e(drop-indicator) {
76+
@extend %node-drop-indicator !optional;
77+
}
78+
79+
@include e(select) {
80+
@extend %node-select !optional;
81+
}
82+
83+
@include e(group) {
84+
@extend %node-group !optional;
85+
}
86+
}

0 commit comments

Comments
 (0)