65528: Renaming/Moving according to feedback; style and links added; chevrons fixed

This commit is contained in:
Marie Verdonck
2019-10-11 17:37:43 +02:00
parent 79424ac108
commit 3daf35e4a4
8 changed files with 243 additions and 228 deletions

View File

@@ -1,46 +1,47 @@
import {Component, OnInit} from '@angular/core';
import {CommunityListService} from '../CommunityListService';
import {FlatNode, CommunityListDataSource} from '../CommunityListDataSource';
import {CommunityListAdapter, FlatNode} from '../community-list-adapter';
import {CommunityListDatasource} from '../community-list-datasource';
import {FlatTreeControl} from '@angular/cdk/tree';
@Component({
selector: 'ds-community-list',
templateUrl: './community-list.component.html',
styleUrls: ['./community-list.component.scss']
selector: 'ds-community-list',
templateUrl: './community-list.component.html',
styleUrls: ['./community-list.component.scss']
})
export class CommunityListComponent implements OnInit {
private expandedNodes: FlatNode[] = [];
private expandedNodes: FlatNode[] = [];
treeControl = new FlatTreeControl<FlatNode>(
(node) => node.level, (node) => node.isExpandable
);
treeControl = new FlatTreeControl<FlatNode>(
(node) => node.level, (node) => node.isExpandable
);
dataSource: CommunityListDataSource;
dataSource: CommunityListDatasource;
constructor(private communityListService: CommunityListService) { }
ngOnInit() {
this.dataSource = new CommunityListDataSource(this.communityListService);
this.dataSource.loadCommunities(null);
}
hasChild = (_: number, node: FlatNode) => node.isExpandable;
shouldRender(node: FlatNode) {
const parent = node.parent;
return !parent || parent.isExpanded;
}
toggleExpanded(node: FlatNode) {
if (node.isExpanded) {
this.expandedNodes = this.expandedNodes.filter((node2) => node2.name !== node.name);
node.isExpanded = false;
} else {
this.expandedNodes.push(node);
node.isExpanded = true;
constructor(private communityListService: CommunityListAdapter) {
}
ngOnInit() {
this.dataSource = new CommunityListDatasource(this.communityListService);
this.dataSource.loadCommunities(null);
}
hasChild = (_: number, node: FlatNode) => node.isExpandable;
shouldRender(node: FlatNode) {
const parent = node.parent;
return !parent || parent.isExpanded;
}
toggleExpanded(node: FlatNode) {
if (node.isExpanded) {
this.expandedNodes = this.expandedNodes.filter((node2) => node2.name !== node.name);
node.isExpanded = false;
} else {
this.expandedNodes.push(node);
node.isExpanded = true;
}
this.dataSource.loadCommunities(this.expandedNodes);
}
this.dataSource.loadCommunities(this.expandedNodes);
}
}