mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
65528: Renaming/Moving according to feedback; style and links added; chevrons fixed
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user