Skip to content

Commit

Permalink
Allow to define groupScale at node level
Browse files Browse the repository at this point in the history
  • Loading branch information
ben12 committed Nov 6, 2021
1 parent b7a14e0 commit 56a2a30
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
(mousedown)="pan ? panStartHandler($event) : true" (mousemove)="pan && panning ? panHandler($event) : true"
(click)="onClickChart($event)">
<orgchart-node [datasource]="datasource" [nodeHeading]="nodeHeading" [nodeContent]="nodeContent"
[nodeTemplate]="nodeTemplate" [groupScale]="groupScale" [select]="select" (nodeClick)="onNodeClick($event)"></orgchart-node>
[nodeTemplate]="nodeTemplate" [groupScale]="datasource.groupScale || groupScale" [select]="select" (nodeClick)="onNodeClick($event)"></orgchart-node>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component, OnInit, Input, Output, EventEmitter, TemplateRef } from '@angular/core';
import { Node } from '../shared/models/node.model';
import { NodeSelectService } from '../shared/services/node-select.service';

@Component({
Expand All @@ -8,7 +9,7 @@ import { NodeSelectService } from '../shared/services/node-select.service';
})
export class ChartContainerComponent implements OnInit {

@Input() datasource;
@Input() datasource: Node;
@Input() nodeHeading = 'name';
@Input() nodeContent = 'title';
@Input() nodeTemplate: TemplateRef<any>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ng-container *ngFor="let temp of Arr(groupScale);let j=index;">
<orgchart-node *ngIf="i + j < datasource.children.length" [datasource]="datasource.children[i + j]"
[nodeHeading]="nodeHeading" [nodeContent]="nodeContent" [nodeTemplate]="nodeTemplate"
[groupScale]="groupScale" [select]="select" (nodeClick)="onNodeClick($event)">
[groupScale]="datasource.children[i + j].groupScale || groupScale" [select]="select" (nodeClick)="onNodeClick($event)">
</orgchart-node>
</ng-container>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export class Node {
name: string;
title: string;
children?: Node[];
groupScale?: number;
}

0 comments on commit 56a2a30

Please sign in to comment.